From: support Date: Thu, 23 Jun 2022 17:29:26 +0000 (+0000) Subject: Built motion from commit b48417e3.|2.6.11 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=73a79977e4a8e6395d1ffc439b8dd519350f6dcc;p=motion2.git Built motion from commit b48417e3.|2.6.11 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 7e596a1..2db350d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-23T17:04:56.422Z", + "time": "2022-06-23T17:21:22.585Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d5ebecb..7d1bf07 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-23T17:04:56.422Z", + "time": "2022-06-23T17:21:22.585Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/legacy-libs/detect-libc/LICENSE b/legacy-libs/detect-libc/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/legacy-libs/detect-libc/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/legacy-libs/detect-libc/README.md b/legacy-libs/detect-libc/README.md new file mode 100644 index 0000000..3176357 --- /dev/null +++ b/legacy-libs/detect-libc/README.md @@ -0,0 +1,78 @@ +# detect-libc + +Node.js module to detect the C standard library (libc) implementation +family and version in use on a given Linux system. + +Provides a value suitable for use with the `LIBC` option of +[prebuild](https://www.npmjs.com/package/prebuild), +[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and +[prebuild-install](https://www.npmjs.com/package/prebuild-install), +therefore allowing build and provision of pre-compiled binaries +for musl-based Linux e.g. Alpine as well as glibc-based. + +Currently supports libc detection of `glibc` and `musl`. + +## Install + +```sh +npm install detect-libc +``` + +## Usage + +### API + +```js +const { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc'); +``` + +* `GLIBC` is a String containing the value "glibc" for comparison with `family`. +* `MUSL` is a String containing the value "musl" for comparison with `family`. +* `family` is a String representing the system libc family. +* `version` is a String representing the system libc version number. +* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine. + +### detect-libc command line tool + +When run on a Linux system with a non-glibc libc, +the child command will be run with the `LIBC` environment variable +set to the relevant value. + +On all other platforms will run the child command as-is. + +The command line feature requires `spawnSync` provided by Node v0.12+. + +```sh +detect-libc child-command +``` + +## Integrating with prebuild + +```json + "scripts": { + "install": "detect-libc prebuild-install || node-gyp rebuild", + "test": "mocha && detect-libc prebuild-ci" + }, + "dependencies": { + "detect-libc": "^1.0.2", + "prebuild-install": "^2.2.0" + }, + "devDependencies": { + "prebuild": "^6.2.1", + "prebuild-ci": "^2.2.3" + } +``` + +## Licence + +Copyright 2017 Lovell Fuller + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/legacy-libs/detect-libc/bin/detect-libc.js b/legacy-libs/detect-libc/bin/detect-libc.js new file mode 100644 index 0000000..5486127 --- /dev/null +++ b/legacy-libs/detect-libc/bin/detect-libc.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +'use strict'; + +var spawnSync = require('child_process').spawnSync; +var libc = require('../'); + +var spawnOptions = { + env: process.env, + shell: true, + stdio: 'inherit' +}; + +if (libc.isNonGlibcLinux) { + spawnOptions.env.LIBC = process.env.LIBC || libc.family; +} + +process.exit(spawnSync(process.argv[2], process.argv.slice(3), spawnOptions).status); diff --git a/legacy-libs/detect-libc/lib/detect-libc.js b/legacy-libs/detect-libc/lib/detect-libc.js new file mode 100644 index 0000000..1855fe1 --- /dev/null +++ b/legacy-libs/detect-libc/lib/detect-libc.js @@ -0,0 +1,92 @@ +'use strict'; + +var platform = require('os').platform(); +var spawnSync = require('child_process').spawnSync; +var readdirSync = require('fs').readdirSync; + +var GLIBC = 'glibc'; +var MUSL = 'musl'; + +var spawnOptions = { + encoding: 'utf8', + env: process.env +}; + +if (!spawnSync) { + spawnSync = function () { + return { status: 126, stdout: '', stderr: '' }; + }; +} + +function contains (needle) { + return function (haystack) { + return haystack.indexOf(needle) !== -1; + }; +} + +function versionFromMuslLdd (out) { + return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1]; +} + +function safeReaddirSync (path) { + try { + return readdirSync(path); + } catch (e) {} + return []; +} + +var family = ''; +var version = ''; +var method = ''; + +if (platform === 'linux') { + // Try getconf + var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions); + if (glibc.status === 0) { + family = GLIBC; + version = glibc.stdout.trim().split(' ')[1]; + method = 'getconf'; + } else { + // Try ldd + var ldd = spawnSync('ldd', ['--version'], spawnOptions); + if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) { + family = MUSL; + version = versionFromMuslLdd(ldd.stdout); + method = 'ldd'; + } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) { + family = MUSL; + version = versionFromMuslLdd(ldd.stderr); + method = 'ldd'; + } else { + // Try filesystem (family only) + var lib = safeReaddirSync('/lib'); + if (lib.some(contains('-linux-gnu'))) { + family = GLIBC; + method = 'filesystem'; + } else if (lib.some(contains('libc.musl-'))) { + family = MUSL; + method = 'filesystem'; + } else if (lib.some(contains('ld-musl-'))) { + family = MUSL; + method = 'filesystem'; + } else { + var usrSbin = safeReaddirSync('/usr/sbin'); + if (usrSbin.some(contains('glibc'))) { + family = GLIBC; + method = 'filesystem'; + } + } + } + } +} + +var isNonGlibcLinux = (family !== '' && family !== GLIBC); + +module.exports = { + GLIBC: GLIBC, + MUSL: MUSL, + family: family, + version: version, + method: method, + isNonGlibcLinux: isNonGlibcLinux +}; diff --git a/legacy-libs/detect-libc/package.json b/legacy-libs/detect-libc/package.json new file mode 100644 index 0000000..b43a419 --- /dev/null +++ b/legacy-libs/detect-libc/package.json @@ -0,0 +1,106 @@ +{ + "_args": [ + [ + { + "raw": "detect-libc@^1.0.2", + "scope": null, + "escapedName": "detect-libc", + "name": "detect-libc", + "rawSpec": "^1.0.2", + "spec": ">=1.0.2 <2.0.0", + "type": "range" + }, + "/var/opt/motion2/node_modules/node-pre-gyp" + ] + ], + "_from": "detect-libc@>=1.0.2 <2.0.0", + "_id": "detect-libc@1.0.3", + "_inCache": true, + "_location": "/detect-libc", + "_nodeVersion": "8.1.3", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/detect-libc-1.0.3.tgz_1511377655799_0.23113705799914896" + }, + "_npmUser": { + "name": "lovell", + "email": "npm@lovell.info" + }, + "_npmVersion": "3.10.10", + "_phantomChildren": {}, + "_requested": { + "raw": "detect-libc@^1.0.2", + "scope": null, + "escapedName": "detect-libc", + "name": "detect-libc", + "rawSpec": "^1.0.2", + "spec": ">=1.0.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/node-pre-gyp" + ], + "_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "_shasum": "fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b", + "_shrinkwrap": null, + "_spec": "detect-libc@^1.0.2", + "_where": "/var/opt/motion2/node_modules/node-pre-gyp", + "author": { + "name": "Lovell Fuller", + "email": "npm@lovell.info" + }, + "bin": { + "detect-libc": "./bin/detect-libc.js" + }, + "bugs": { + "url": "https://github.com/lovell/detect-libc/issues" + }, + "contributors": [ + { + "name": "Niklas Salmoukas", + "email": "niklas@salmoukas.com" + } + ], + "dependencies": {}, + "description": "Node.js module to detect the C standard library (libc) implementation family and version", + "devDependencies": { + "ava": "^0.23.0", + "nyc": "^11.3.0", + "proxyquire": "^1.8.0", + "semistandard": "^11.0.0" + }, + "directories": {}, + "dist": { + "shasum": "fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b", + "tarball": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz" + }, + "engines": { + "node": ">=0.10" + }, + "gitHead": "88df1a5950bf3cd9bffa1e0137ab6471c4546118", + "homepage": "https://github.com/lovell/detect-libc#readme", + "keywords": [ + "libc", + "glibc", + "musl" + ], + "license": "Apache-2.0", + "main": "lib/detect-libc.js", + "maintainers": [ + { + "name": "lovell", + "email": "npm@lovell.info" + } + ], + "name": "detect-libc", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/lovell/detect-libc.git" + }, + "scripts": { + "test": "semistandard && nyc --reporter=lcov ava" + }, + "version": "1.0.3" +} diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index d7b7648..18fe8c0 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 _0xcc83=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x5206cc,_0x2a1a51){var _0x788939=function(_0x43327b){while(--_0x43327b){_0x5206cc['push'](_0x5206cc['shift']());}};_0x788939(++_0x2a1a51);}(_0xcc83,0xae));var _0x3cc8=function(_0x485df3,_0x40b7d8){_0x485df3=_0x485df3-0x0;var _0x4d7454=_0xcc83[_0x485df3];return _0x4d7454;};'use strict';var Sequelize=require(_0x3cc8('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cc8('0x1')],'get':function(_0x390f1c){return this[_0x3cc8('0x2')](_0x3cc8('0x3'));}},'action':{'type':Sequelize[_0x3cc8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3cc8('0x5'),'integration',_0x3cc8('0x6'),_0x3cc8('0x7'),_0x3cc8('0x8'),'browser',_0x3cc8('0x9'),_0x3cc8('0xa')]],'msg':_0x3cc8('0xb')}},'comment':_0x3cc8('0xb')},'data1':{'type':Sequelize[_0x3cc8('0x4')](0x1000),'comment':_0x3cc8('0xc')},'data2':{'type':Sequelize[_0x3cc8('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3cc8('0xd')},'data4':{'type':Sequelize[_0x3cc8('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x3cc8('0xe')},'data6':{'type':Sequelize[_0x3cc8('0x4')],'comments':_0x3cc8('0xf')},'data7':{'type':Sequelize[_0x3cc8('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x01e8=['TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x3e281d,_0x37cddb){var _0x5a843b=function(_0xbf7015){while(--_0xbf7015){_0x3e281d['push'](_0x3e281d['shift']());}};_0x5a843b(++_0x37cddb);}(_0x01e8,0x6e));var _0x801e=function(_0x1e8a13,_0x150633){_0x1e8a13=_0x1e8a13-0x0;var _0x1b5c34=_0x01e8[_0x1e8a13];return _0x1b5c34;};'use strict';var Sequelize=require(_0x801e('0x0'));module[_0x801e('0x1')]={'name':{'type':Sequelize[_0x801e('0x2')],'get':function(_0x5c46ca){return this[_0x801e('0x3')]('action');}},'action':{'type':Sequelize[_0x801e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x801e('0x5'),'motionbar',_0x801e('0x6'),_0x801e('0x7'),'browser',_0x801e('0x8'),_0x801e('0x9')]],'msg':_0x801e('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x801e('0xb')},'data2':{'type':Sequelize[_0x801e('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x801e('0x4')](0x1000),'comment':_0x801e('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x801e('0xd')},'data5':{'type':Sequelize[_0x801e('0x4')](0x1000),'comments':_0x801e('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x801e('0xf')},'data7':{'type':Sequelize[_0x801e('0x10')],'comments':_0x801e('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7a87cd3..d209530 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 _0x7851=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x103e0d,_0x1675a7){var _0x3e92d2=function(_0x1da3a2){while(--_0x1da3a2){_0x103e0d['push'](_0x103e0d['shift']());}};_0x3e92d2(++_0x1675a7);}(_0x7851,0xba));var _0x1785=function(_0x2fb0a7,_0x4cc844){_0x2fb0a7=_0x2fb0a7-0x0;var _0x5348a9=_0x7851[_0x2fb0a7];return _0x5348a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1785('0x0'));var zipdir=require(_0x1785('0x1'));var jsonpatch=require(_0x1785('0x2'));var rp=require('request-promise');var moment=require(_0x1785('0x3'));var BPromise=require(_0x1785('0x4'));var Mustache=require(_0x1785('0x5'));var util=require(_0x1785('0x6'));var path=require(_0x1785('0x7'));var sox=require(_0x1785('0x8'));var csv=require(_0x1785('0x9'));var ejs=require(_0x1785('0xa'));var fs=require('fs');var fs_extra=require(_0x1785('0xb'));var _=require(_0x1785('0xc'));var squel=require(_0x1785('0xd'));var crypto=require('crypto');var jsforce=require(_0x1785('0xe'));var deskjs=require(_0x1785('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1785('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1785('0x11'));var as=require(_0x1785('0x12'));var hardwareService=require(_0x1785('0x13'));var logger=require(_0x1785('0x14'))(_0x1785('0x15'));var utils=require(_0x1785('0x16'));var config=require(_0x1785('0x17'));var licenseUtil=require(_0x1785('0x18'));var db=require(_0x1785('0x19'))['db'];function respondWithStatusCode(_0x19018c,_0x189260){_0x189260=_0x189260||0xcc;return function(_0x5e526e){if(_0x5e526e){return _0x19018c[_0x1785('0x1a')](_0x189260);}return _0x19018c[_0x1785('0x1b')](_0x189260)[_0x1785('0x1c')]();};}function respondWithResult(_0x4467b1,_0x5c44f2){_0x5c44f2=_0x5c44f2||0xc8;return function(_0x3d5f21){if(_0x3d5f21){return _0x4467b1[_0x1785('0x1b')](_0x5c44f2)['json'](_0x3d5f21);}};}function respondWithFilteredResult(_0x1096be,_0x27b04d){return function(_0x46c8a6){if(_0x46c8a6){var _0x55ecec=typeof _0x27b04d[_0x1785('0x1d')]==='undefined'&&typeof _0x27b04d[_0x1785('0x1e')]===_0x1785('0x1f');var _0x28f341=_0x46c8a6[_0x1785('0x20')];var _0x5f2952=_0x55ecec?0x0:_0x27b04d[_0x1785('0x1d')];var _0x3483ca=_0x55ecec?_0x46c8a6['count']:_0x27b04d[_0x1785('0x1d')]+_0x27b04d[_0x1785('0x1e')];var _0x15d7c1;if(_0x3483ca>=_0x28f341){_0x3483ca=_0x28f341;_0x15d7c1=0xc8;}else{_0x15d7c1=0xce;}_0x1096be['status'](_0x15d7c1);return _0x1096be[_0x1785('0x21')](_0x1785('0x22'),_0x5f2952+'-'+_0x3483ca+'/'+_0x28f341)[_0x1785('0x23')](_0x46c8a6);}return null;};}function patchUpdates(_0x25b31c){return function(_0x22d559){try{jsonpatch[_0x1785('0x24')](_0x22d559,_0x25b31c,!![]);}catch(_0x4bcb11){return BPromise[_0x1785('0x25')](_0x4bcb11);}return _0x22d559[_0x1785('0x26')]();};}function saveUpdates(_0x2550e1,_0x34189a){return function(_0x59e6d0){if(_0x59e6d0){return _0x59e6d0[_0x1785('0x27')](_0x2550e1)[_0x1785('0x28')](function(_0x40b38f){return _0x40b38f;});}return null;};}function removeEntity(_0x588541,_0x2f6016){return function(_0x7f0cd0){if(_0x7f0cd0){return _0x7f0cd0[_0x1785('0x29')]()['then'](function(){_0x588541[_0x1785('0x1b')](0xcc)[_0x1785('0x1c')]();});}};}function handleEntityNotFound(_0x2b6004,_0x1ada4f){return function(_0x3e0c06){if(!_0x3e0c06){_0x2b6004[_0x1785('0x1a')](0x194);}return _0x3e0c06;};}function handleError(_0x26e2f6,_0x393c32){_0x393c32=_0x393c32||0x1f4;return function(_0x49ca21){logger[_0x1785('0x2a')](_0x49ca21[_0x1785('0x2b')]);if(_0x49ca21['name']){delete _0x49ca21[_0x1785('0x2c')];}_0x26e2f6[_0x1785('0x1b')](_0x393c32)['send'](_0x49ca21);};}exports['update']=function(_0x1307a7,_0x59fe51){if(_0x1307a7[_0x1785('0x2d')]['id']){delete _0x1307a7[_0x1785('0x2d')]['id'];}return db[_0x1785('0x2e')][_0x1785('0x2f')]({'where':{'id':_0x1307a7[_0x1785('0x30')]['id']}})['then'](handleEntityNotFound(_0x59fe51,null))[_0x1785('0x28')](saveUpdates(_0x1307a7[_0x1785('0x2d')],null))[_0x1785('0x28')](respondWithResult(_0x59fe51,null))[_0x1785('0x31')](handleError(_0x59fe51,null));};exports[_0x1785('0x29')]=function(_0x237298,_0x20872b){return db[_0x1785('0x2e')][_0x1785('0x2f')]({'where':{'id':_0x237298[_0x1785('0x30')]['id']}})[_0x1785('0x28')](handleEntityNotFound(_0x20872b,null))[_0x1785('0x28')](removeEntity(_0x20872b,null))[_0x1785('0x31')](handleError(_0x20872b,null));}; \ No newline at end of file +var _0xf5ef=['catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','update','body','Action','find','params'];(function(_0x4caea4,_0x4f02e4){var _0x207c7c=function(_0x1dc16a){while(--_0x1dc16a){_0x4caea4['push'](_0x4caea4['shift']());}};_0x207c7c(++_0x4f02e4);}(_0xf5ef,0xbd));var _0xff5e=function(_0x599582,_0x44d882){_0x599582=_0x599582-0x0;var _0x452182=_0xf5ef[_0x599582];return _0x452182;};'use strict';var emlformat=require(_0xff5e('0x0'));var rimraf=require(_0xff5e('0x1'));var zipdir=require(_0xff5e('0x2'));var jsonpatch=require(_0xff5e('0x3'));var rp=require(_0xff5e('0x4'));var moment=require(_0xff5e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xff5e('0x6'));var util=require(_0xff5e('0x7'));var path=require(_0xff5e('0x8'));var sox=require(_0xff5e('0x9'));var csv=require(_0xff5e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff5e('0xb'));var _=require('lodash');var squel=require(_0xff5e('0xc'));var crypto=require('crypto');var jsforce=require(_0xff5e('0xd'));var deskjs=require(_0xff5e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff5e('0xf'));var Redis=require(_0xff5e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff5e('0x11'));var as=require(_0xff5e('0x12'));var hardwareService=require(_0xff5e('0x13'));var logger=require(_0xff5e('0x14'))(_0xff5e('0x15'));var utils=require(_0xff5e('0x16'));var config=require(_0xff5e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xff5e('0x18'))['db'];function respondWithStatusCode(_0x30ff34,_0x575965){_0x575965=_0x575965||0xcc;return function(_0x4bfa67){if(_0x4bfa67){return _0x30ff34[_0xff5e('0x19')](_0x575965);}return _0x30ff34[_0xff5e('0x1a')](_0x575965)['end']();};}function respondWithResult(_0xd28e49,_0x3f0ec5){_0x3f0ec5=_0x3f0ec5||0xc8;return function(_0x4c410c){if(_0x4c410c){return _0xd28e49['status'](_0x3f0ec5)[_0xff5e('0x1b')](_0x4c410c);}};}function respondWithFilteredResult(_0x4bab1f,_0x23fe61){return function(_0x9d96c7){if(_0x9d96c7){var _0x2453a2=typeof _0x23fe61[_0xff5e('0x1c')]===_0xff5e('0x1d')&&typeof _0x23fe61[_0xff5e('0x1e')]==='undefined';var _0x303a30=_0x9d96c7['count'];var _0x34d703=_0x2453a2?0x0:_0x23fe61[_0xff5e('0x1c')];var _0x1b82af=_0x2453a2?_0x9d96c7[_0xff5e('0x1f')]:_0x23fe61['offset']+_0x23fe61[_0xff5e('0x1e')];var _0x57b576;if(_0x1b82af>=_0x303a30){_0x1b82af=_0x303a30;_0x57b576=0xc8;}else{_0x57b576=0xce;}_0x4bab1f['status'](_0x57b576);return _0x4bab1f[_0xff5e('0x20')](_0xff5e('0x21'),_0x34d703+'-'+_0x1b82af+'/'+_0x303a30)[_0xff5e('0x1b')](_0x9d96c7);}return null;};}function patchUpdates(_0x940e5a){return function(_0x3772ee){try{jsonpatch[_0xff5e('0x22')](_0x3772ee,_0x940e5a,!![]);}catch(_0x137544){return BPromise['reject'](_0x137544);}return _0x3772ee[_0xff5e('0x23')]();};}function saveUpdates(_0x435e29,_0x32c016){return function(_0x3bc340){if(_0x3bc340){return _0x3bc340['update'](_0x435e29)[_0xff5e('0x24')](function(_0x255cef){return _0x255cef;});}return null;};}function removeEntity(_0x3cb2e3,_0x27c973){return function(_0x2bd268){if(_0x2bd268){return _0x2bd268[_0xff5e('0x25')]()['then'](function(){_0x3cb2e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xde3f1a,_0x4b4210){return function(_0x238add){if(!_0x238add){_0xde3f1a[_0xff5e('0x19')](0x194);}return _0x238add;};}function handleError(_0x5da7dd,_0x3852e1){_0x3852e1=_0x3852e1||0x1f4;return function(_0x14cfe2){logger[_0xff5e('0x26')](_0x14cfe2['stack']);if(_0x14cfe2[_0xff5e('0x27')]){delete _0x14cfe2[_0xff5e('0x27')];}_0x5da7dd['status'](_0x3852e1)[_0xff5e('0x28')](_0x14cfe2);};}exports[_0xff5e('0x29')]=function(_0x429d7e,_0x15d89){if(_0x429d7e[_0xff5e('0x2a')]['id']){delete _0x429d7e[_0xff5e('0x2a')]['id'];}return db[_0xff5e('0x2b')][_0xff5e('0x2c')]({'where':{'id':_0x429d7e[_0xff5e('0x2d')]['id']}})[_0xff5e('0x24')](handleEntityNotFound(_0x15d89,null))['then'](saveUpdates(_0x429d7e['body'],null))[_0xff5e('0x24')](respondWithResult(_0x15d89,null))['catch'](handleError(_0x15d89,null));};exports[_0xff5e('0x25')]=function(_0x34a8f2,_0x40a542){return db[_0xff5e('0x2b')][_0xff5e('0x2c')]({'where':{'id':_0x34a8f2[_0xff5e('0x2d')]['id']}})[_0xff5e('0x24')](handleEntityNotFound(_0x40a542,null))['then'](removeEntity(_0x40a542,null))[_0xff5e('0x2e')](handleError(_0x40a542,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 62be46b..9eed198 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 _0xdf22=['bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','util','../../config/logger','api','moment'];(function(_0x54b306,_0x5208e6){var _0x50f13c=function(_0x5eed43){while(--_0x5eed43){_0x54b306['push'](_0x54b306['shift']());}};_0x50f13c(++_0x5208e6);}(_0xdf22,0x74));var _0x2df2=function(_0x10d350,_0x12fab8){_0x10d350=_0x10d350-0x0;var _0x247de1=_0xdf22[_0x10d350];return _0x247de1;};'use strict';var _=require('lodash');var util=require(_0x2df2('0x0'));var logger=require(_0x2df2('0x1'))(_0x2df2('0x2'));var moment=require(_0x2df2('0x3'));var BPromise=require(_0x2df2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df2('0x5'));var rimraf=require(_0x2df2('0x6'));var config=require(_0x2df2('0x7'));var attributes=require(_0x2df2('0x8'));module[_0x2df2('0x9')]=function(_0x4e2dc4,_0x338bbb){return _0x4e2dc4[_0x2df2('0xa')]('Action',attributes,{'tableName':_0x2df2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e9=['path','rimraf','exports','Action','tools_actions','util','../../config/logger','api','bluebird'];(function(_0x3e136f,_0x123d5e){var _0x231281=function(_0x484b01){while(--_0x484b01){_0x3e136f['push'](_0x3e136f['shift']());}};_0x231281(++_0x123d5e);}(_0x30e9,0x16d));var _0x930e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x30e9[_0x13ea00];return _0x1f7347;};'use strict';var _=require('lodash');var util=require(_0x930e('0x0'));var logger=require(_0x930e('0x1'))(_0x930e('0x2'));var moment=require('moment');var BPromise=require(_0x930e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x930e('0x4'));var rimraf=require(_0x930e('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x930e('0x6')]=function(_0x208f27,_0x5def83){return _0x208f27['define'](_0x930e('0x7'),attributes,{'tableName':_0x930e('0x8'),'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 de1cd8b..0937d80 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4975,0x86));var _0x5497=function(_0x528a5e,_0x397cbe){_0x528a5e=_0x528a5e-0x0;var _0x5b7355=_0x4975[_0x528a5e];return _0x5b7355;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x814b,0x1a2));var _0xb814=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x814b[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ba27b7b..3e8e135 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 _0xb32e=['/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete'];(function(_0x35c390,_0xb71e7a){var _0x2602cd=function(_0x3c941f){while(--_0x3c941f){_0x35c390['push'](_0x35c390['shift']());}};_0x2602cd(++_0xb71e7a);}(_0xb32e,0x13d));var _0xeb32=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb32e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xeb32('0x0'));var util=require('util');var path=require(_0xeb32('0x1'));var timeout=require(_0xeb32('0x2'));var express=require(_0xeb32('0x3'));var router=express[_0xeb32('0x4')]();var fs_extra=require(_0xeb32('0x5'));var auth=require(_0xeb32('0x6'));var interaction=require(_0xeb32('0x7'));var config=require(_0xeb32('0x8'));var controller=require(_0xeb32('0x9'));router[_0xeb32('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xeb32('0xb')]);router[_0xeb32('0xc')](_0xeb32('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb32('0xe')]=router; \ No newline at end of file +var _0xbcdf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1c6c14,_0x51e056){var _0x3dec50=function(_0x1eaca4){while(--_0x1eaca4){_0x1c6c14['push'](_0x1c6c14['shift']());}};_0x3dec50(++_0x51e056);}(_0xbcdf,0xfb));var _0xfbcd=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xbcdf[_0x19a49f];return _0x5351ae;};'use strict';var multer=require(_0xfbcd('0x0'));var util=require(_0xfbcd('0x1'));var path=require(_0xfbcd('0x2'));var timeout=require(_0xfbcd('0x3'));var express=require(_0xfbcd('0x4'));var router=express['Router']();var fs_extra=require(_0xfbcd('0x5'));var auth=require(_0xfbcd('0x6'));var interaction=require(_0xfbcd('0x7'));var config=require(_0xfbcd('0x8'));var controller=require(_0xfbcd('0x9'));router[_0xfbcd('0xa')](_0xfbcd('0xb'),auth[_0xfbcd('0xc')](),controller[_0xfbcd('0xd')]);router[_0xfbcd('0xe')]('/:id',auth[_0xfbcd('0xc')](),controller['destroy']);module[_0xfbcd('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d8a08c2..6655d1f 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 _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x564615,_0x51000c){var _0x3e5c3c=function(_0x35b777){while(--_0x35b777){_0x564615['push'](_0x564615['shift']());}};_0x3e5c3c(++_0x51000c);}(_0x6aa7,0x178));var _0x76aa=function(_0x4ef352,_0x622052){_0x4ef352=_0x4ef352-0x0;var _0xb33802=_0x6aa7[_0x4ef352];return _0xb33802;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0xb2a37f,_0x5732a8){var _0x4d3794=function(_0x51a88a){while(--_0x51a88a){_0xb2a37f['push'](_0xb2a37f['shift']());}};_0x4d3794(++_0x5732a8);}(_0x98a8,0x12c));var _0x898a=function(_0x101cf0,_0x4d8873){_0x101cf0=_0x101cf0-0x0;var _0x21d866=_0x98a8[_0x101cf0];return _0x21d866;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('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 67049a8..6a2fd26 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 _0x0426=['COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','Sequelize','AnalyticMetric','order','alias','output','web','fullPath','%s-%s.%s','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','save','update','destroy','then','get','CustomReports','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','AnalyticCustomReport','includeAll','include','findAll','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','autoAssociation','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x0426,0x188));var _0x6042=function(_0x1cb9b1,_0x38d288){_0x1cb9b1=_0x1cb9b1-0x0;var _0x1c0c2e=_0x0426[_0x1cb9b1];return _0x1c0c2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6042('0x0'));var zipdir=require(_0x6042('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6042('0x2'));var moment=require(_0x6042('0x3'));var BPromise=require(_0x6042('0x4'));var Mustache=require(_0x6042('0x5'));var util=require(_0x6042('0x6'));var path=require(_0x6042('0x7'));var sox=require('sox');var csv=require(_0x6042('0x8'));var ejs=require(_0x6042('0x9'));var fs=require('fs');var fs_extra=require(_0x6042('0xa'));var _=require(_0x6042('0xb'));var squel=require(_0x6042('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6042('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6042('0xe'));var Papa=require(_0x6042('0xf'));var Redis=require(_0x6042('0x10'));var authService=require(_0x6042('0x11'));var qs=require(_0x6042('0x12'));var as=require(_0x6042('0x13'));var hardwareService=require(_0x6042('0x14'));var logger=require('../../config/logger')(_0x6042('0x15'));var utils=require(_0x6042('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6042('0x17'))['db'];var dbH=require('../../mysqldb')[_0x6042('0x18')];function respondWithStatusCode(_0x3b77d6,_0x4f5f61){_0x4f5f61=_0x4f5f61||0xcc;return function(_0x2c4e4b){if(_0x2c4e4b){return _0x3b77d6[_0x6042('0x19')](_0x4f5f61);}return _0x3b77d6[_0x6042('0x1a')](_0x4f5f61)['end']();};}function respondWithResult(_0x3fce,_0x41b17e){_0x41b17e=_0x41b17e||0xc8;return function(_0x3e4d0b){if(_0x3e4d0b){return _0x3fce[_0x6042('0x1a')](_0x41b17e)['json'](_0x3e4d0b);}};}function respondWithFilteredResult(_0x5f4baf,_0x1eacfa){return function(_0x5ae454){if(_0x5ae454){var _0x25bd6f=typeof _0x1eacfa['offset']===_0x6042('0x1b')&&typeof _0x1eacfa[_0x6042('0x1c')]===_0x6042('0x1b');var _0x3a746c=_0x5ae454[_0x6042('0x1d')];var _0x4754b3=_0x25bd6f?0x0:_0x1eacfa[_0x6042('0x1e')];var _0x4d5115=_0x25bd6f?_0x5ae454[_0x6042('0x1d')]:_0x1eacfa[_0x6042('0x1e')]+_0x1eacfa[_0x6042('0x1c')];var _0x503bbf;if(_0x4d5115>=_0x3a746c){_0x4d5115=_0x3a746c;_0x503bbf=0xc8;}else{_0x503bbf=0xce;}_0x5f4baf['status'](_0x503bbf);return _0x5f4baf['set']('Content-Range',_0x4754b3+'-'+_0x4d5115+'/'+_0x3a746c)['json'](_0x5ae454);}return null;};}function patchUpdates(_0x3dbaa8){return function(_0xd911f1){try{jsonpatch['apply'](_0xd911f1,_0x3dbaa8,!![]);}catch(_0x310bb8){return BPromise['reject'](_0x310bb8);}return _0xd911f1[_0x6042('0x1f')]();};}function saveUpdates(_0x29696d,_0x163089){return function(_0x44f301){if(_0x44f301){return _0x44f301[_0x6042('0x20')](_0x29696d)['then'](function(_0x26e55b){return _0x26e55b;});}return null;};}function removeEntity(_0x15173c,_0x11291a){return function(_0x10801d){if(_0x10801d){return _0x10801d[_0x6042('0x21')]()[_0x6042('0x22')](function(){var _0x4426df=_0x10801d[_0x6042('0x23')]({'plain':!![]});var _0x1677d5=_0x6042('0x24');return db[_0x6042('0x25')]['destroy']({'where':{'type':_0x1677d5,'resourceId':_0x4426df['id']}})[_0x6042('0x22')](function(){return _0x10801d;});})['then'](function(){_0x15173c[_0x6042('0x1a')](0xcc)[_0x6042('0x26')]();});}};}function handleEntityNotFound(_0x37f8de,_0x5a54f7){return function(_0x1799a2){if(!_0x1799a2){_0x37f8de['sendStatus'](0x194);}return _0x1799a2;};}function handleError(_0x5309ec,_0x245cb7){_0x245cb7=_0x245cb7||0x1f4;return function(_0x47a6b1){logger[_0x6042('0x27')](_0x47a6b1[_0x6042('0x28')]);if(_0x47a6b1['name']){delete _0x47a6b1[_0x6042('0x29')];}_0x5309ec[_0x6042('0x1a')](_0x245cb7)[_0x6042('0x2a')](_0x47a6b1);};}exports['index']=function(_0x406110,_0x573743){var _0x13788c={},_0x280728={},_0x298737={'count':0x0,'rows':[]};var _0x428c80=_[_0x6042('0x2b')](db['AnalyticCustomReport'][_0x6042('0x2c')],function(_0x43b6a3){return{'name':_0x43b6a3['fieldName'],'type':_0x43b6a3[_0x6042('0x2d')][_0x6042('0x2e')]};});_0x280728[_0x6042('0x2f')]=_[_0x6042('0x2b')](_0x428c80,_0x6042('0x29'));_0x280728['query']=_['keys'](_0x406110[_0x6042('0x30')]);_0x280728['filters']=_[_0x6042('0x31')](_0x280728[_0x6042('0x2f')],_0x280728[_0x6042('0x30')]);_0x13788c['attributes']=_[_0x6042('0x31')](_0x280728[_0x6042('0x2f')],qs[_0x6042('0x32')](_0x406110[_0x6042('0x30')][_0x6042('0x32')]));_0x13788c[_0x6042('0x33')]=_0x13788c[_0x6042('0x33')][_0x6042('0x34')]?_0x13788c['attributes']:_0x280728['model'];if(!_0x406110['query'][_0x6042('0x35')](_0x6042('0x36'))){_0x13788c[_0x6042('0x1c')]=qs[_0x6042('0x1c')](_0x406110[_0x6042('0x30')]['limit']);_0x13788c[_0x6042('0x1e')]=qs[_0x6042('0x1e')](_0x406110['query']['offset']);}_0x13788c['order']=qs[_0x6042('0x37')](_0x406110['query'][_0x6042('0x37')]);_0x13788c[_0x6042('0x38')]=qs[_0x6042('0x39')](_['pick'](_0x406110[_0x6042('0x30')],_0x280728[_0x6042('0x39')]),_0x428c80);if(_0x406110['query']['filter']){_0x13788c['where']=_[_0x6042('0x3a')](_0x13788c[_0x6042('0x38')],{'$or':_['map'](_0x428c80,function(_0x2c38e6){if(_0x2c38e6[_0x6042('0x2d')]!==_0x6042('0x3b')){var _0x416fa3={};_0x416fa3[_0x2c38e6[_0x6042('0x29')]]={'$like':'%'+_0x406110[_0x6042('0x30')]['filter']+'%'};return _0x416fa3;}})});}_0x13788c=_[_0x6042('0x3a')]({},_0x13788c,_0x406110['options']);var _0x130779={'where':_0x13788c[_0x6042('0x38')]};return db[_0x6042('0x3c')][_0x6042('0x1d')](_0x130779)[_0x6042('0x22')](function(_0x39b8fb){_0x298737[_0x6042('0x1d')]=_0x39b8fb;if(_0x406110[_0x6042('0x30')][_0x6042('0x3d')]){_0x13788c[_0x6042('0x3e')]=[{'all':!![]}];}return db[_0x6042('0x3c')][_0x6042('0x3f')](_0x13788c);})[_0x6042('0x22')](function(_0x47094f){_0x298737['rows']=_0x47094f;return _0x298737;})[_0x6042('0x22')](respondWithFilteredResult(_0x573743,_0x13788c))[_0x6042('0x40')](handleError(_0x573743,null));};exports['show']=function(_0x54cf0e,_0x4e8a1a){var _0x32767b={'raw':![],'where':{'id':_0x54cf0e['params']['id']}},_0x4e3d21={};_0x4e3d21[_0x6042('0x2f')]=_[_0x6042('0x41')](db['AnalyticCustomReport'][_0x6042('0x2c')]);_0x4e3d21[_0x6042('0x30')]=_['keys'](_0x54cf0e[_0x6042('0x30')]);_0x4e3d21[_0x6042('0x39')]=_['intersection'](_0x4e3d21[_0x6042('0x2f')],_0x4e3d21[_0x6042('0x30')]);_0x32767b[_0x6042('0x33')]=_[_0x6042('0x31')](_0x4e3d21[_0x6042('0x2f')],qs[_0x6042('0x32')](_0x54cf0e['query'][_0x6042('0x32')]));_0x32767b[_0x6042('0x33')]=_0x32767b[_0x6042('0x33')]['length']?_0x32767b[_0x6042('0x33')]:_0x4e3d21[_0x6042('0x2f')];if(_0x54cf0e[_0x6042('0x30')][_0x6042('0x3d')]){_0x32767b[_0x6042('0x3e')]=[{'all':!![]}];}_0x32767b=_['merge']({},_0x32767b,_0x54cf0e['options']);return db[_0x6042('0x3c')]['find'](_0x32767b)[_0x6042('0x22')](handleEntityNotFound(_0x4e8a1a,null))[_0x6042('0x22')](respondWithResult(_0x4e8a1a,null))[_0x6042('0x40')](handleError(_0x4e8a1a,null));};exports['create']=function(_0x2d426f,_0x2c4cb9){return db[_0x6042('0x3c')][_0x6042('0x42')](_0x2d426f[_0x6042('0x43')],{})['then'](function(_0x239670){var _0x354852=_0x2d426f[_0x6042('0x44')]['get']({'plain':!![]});if(!_0x354852)throw new Error(_0x6042('0x45'));if(_0x354852['role']==='user'){var _0x48fb22=_0x239670[_0x6042('0x23')]({'plain':!![]});var _0x13e93d=_0x6042('0x46');return db[_0x6042('0x47')][_0x6042('0x48')]({'where':{'name':_0x13e93d,'userProfileId':_0x354852[_0x6042('0x49')]},'raw':!![]})[_0x6042('0x22')](function(_0x1d795e){if(_0x1d795e&&_0x1d795e[_0x6042('0x4a')]===0x0){return db[_0x6042('0x25')]['create']({'name':_0x48fb22[_0x6042('0x29')],'resourceId':_0x48fb22['id'],'type':_0x6042('0x24'),'sectionId':_0x1d795e['id']},{})[_0x6042('0x22')](function(){return _0x239670;});}else{return _0x239670;}})['catch'](function(_0xf962d8){logger[_0x6042('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf962d8);throw _0xf962d8;});}return _0x239670;})[_0x6042('0x22')](respondWithResult(_0x2c4cb9,0xc9))['catch'](handleError(_0x2c4cb9,null));};exports[_0x6042('0x20')]=function(_0x3914d0,_0x53904e){if(_0x3914d0[_0x6042('0x43')]['id']){delete _0x3914d0['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3914d0[_0x6042('0x4b')]['id']}})[_0x6042('0x22')](handleEntityNotFound(_0x53904e,null))[_0x6042('0x22')](saveUpdates(_0x3914d0[_0x6042('0x43')],null))['then'](respondWithResult(_0x53904e,null))[_0x6042('0x40')](handleError(_0x53904e,null));};exports[_0x6042('0x21')]=function(_0x4f2f30,_0x3ecfd7){return db['AnalyticCustomReport'][_0x6042('0x48')]({'where':{'id':_0x4f2f30[_0x6042('0x4b')]['id']}})[_0x6042('0x22')](handleEntityNotFound(_0x3ecfd7,null))[_0x6042('0x22')](removeEntity(_0x3ecfd7,null))[_0x6042('0x40')](handleError(_0x3ecfd7,null));};exports['preview']=function(_0x5c0c85,_0xffd933){var _0x502134=0xa;var _0xe0b59c=[_0x6042('0x4c'),_0x6042('0x4d'),_0x6042('0x4e'),_0x6042('0x4f')];var _0x4d6920={'SUM':_0x6042('0x50'),'COUNT':_0x6042('0x51'),'COUNT DISTINCT':_0x6042('0x52'),'MAX':_0x6042('0x53'),'MIN':_0x6042('0x54'),'AVG':_0x6042('0x55'),'GROUP_CONCAT':_0x6042('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e43c2={'SEC_TO_TIME':_0x6042('0x57'),'DATE':_0x6042('0x58'),'HOUR':_0x6042('0x59'),'ROUND':_0x6042('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x285b74=function(_0x1462ad){return!_[_0x6042('0x5b')]([_0x6042('0x5c'),_0x6042('0x5d'),_0x6042('0x5e'),_0x6042('0x5f')],_0x1462ad);};var _0x5b8c64=function(_0x5749b3){if(!_0x5749b3||!_0x5749b3[_0x6042('0x60')][_0x6042('0x34')]){return'';}for(var _0x39432f='(',_0x401ba5=0x0;_0x401ba5<_0x5749b3['rules'][_0x6042('0x34')];_0x401ba5+=0x1){_0x401ba5>0x0&&(_0x39432f+='\x20'+_0x5749b3[_0x6042('0x61')]+'\x20');_0x39432f+=_0x5749b3[_0x6042('0x60')][_0x401ba5]['group']?_0x5b8c64(_0x5749b3['rules'][_0x401ba5][_0x6042('0x62')]):_0x5749b3['rules'][_0x401ba5]['field']+'\x20'+_0x5749b3['rules'][_0x401ba5][_0x6042('0x63')]+(_0x285b74(_0x5749b3[_0x6042('0x60')][_0x401ba5]['condition'])?'\x20'+_0x5749b3[_0x6042('0x60')][_0x401ba5][_0x6042('0x64')]:'');}return _0x39432f+')';};var _0x425602={'where':{'id':_0x5c0c85[_0x6042('0x4b')]['id']}},_0x5484b4,_0x55618f,_0x19e434,_0x35b31b,_0x468c09;_0x425602=_[_0x6042('0x3a')]({},_0x425602,_0x5c0c85[_0x6042('0x65')]);return db[_0x6042('0x3c')][_0x6042('0x48')](_0x425602)[_0x6042('0x22')](function(_0x36dfd4){if(_0x36dfd4){_0x5484b4=_0x36dfd4;return _0x36dfd4[_0x6042('0x66')]();}return null;})[_0x6042('0x22')](function(_0xd282da){if(_0xd282da){if(!_0xd282da[_0x6042('0x34')]){throw new db['Sequelize'][(_0x6042('0x67'))](_0x6042('0x68'),0x193);}_0x55618f=_0xd282da;return db['AnalyticMetric'][_0x6042('0x3f')]({'raw':!![]});}return null;})[_0x6042('0x22')](function(_0x365f65){if(_0x365f65){_0x19e434=_[_0x6042('0x69')](_0x365f65,'id');var _0x9e9b10;var _0x5ce58e=squel[_0x6042('0x6a')]();_0x5ce58e[_0x6042('0x6b')](_0x5484b4['table']);for(var _0x2823f6=0x0;_0x2823f6<_0x55618f['length'];_0x2823f6+=0x1){_0x9e9b10=_0x55618f[_0x2823f6][_0x6042('0x6c')]?_0x19e434[_0x55618f[_0x2823f6]['MetricId']][_0x6042('0x6d')]:_0x55618f[_0x2823f6][_0x6042('0x6e')];_0x9e9b10=_0x55618f[_0x2823f6][_0x6042('0x6f')]?_[_0x6042('0x70')](_0x4d6920[_0x55618f[_0x2823f6]['function']],'%s',_0x9e9b10):_0x9e9b10;_0x9e9b10=_0x55618f[_0x2823f6][_0x6042('0x71')]?_[_0x6042('0x70')](_0x5e43c2[_0x55618f[_0x2823f6][_0x6042('0x71')]],'%s',_0x9e9b10):_0x9e9b10;if(_0x55618f[_0x2823f6][_0x6042('0x72')]){_0x5ce58e[_0x6042('0x62')](_0x9e9b10);}_0x55618f[_0x2823f6][_0x6042('0x73')]&&_0x5ce58e['order'](_0x9e9b10,_0x55618f[_0x2823f6]['orderBy']===_0x6042('0x74')?![]:!![]);_0x5ce58e[_0x6042('0x6e')](_0x9e9b10,_0x55618f[_0x2823f6]['alias']||_0x9e9b10);}if(_0x5484b4[_0x6042('0x75')]){_0x5484b4[_0x6042('0x75')]=JSON[_0x6042('0x76')](_0x5484b4[_0x6042('0x75')]);for(var _0xf2060f=0x0;_0xf2060f<_0x5484b4[_0x6042('0x75')][_0x6042('0x34')];_0xf2060f+=0x1){if(_0x5484b4[_0x6042('0x75')][_0xf2060f]['type']&&_[_0x6042('0x5b')](_0xe0b59c,_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x2d')])&&_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x77')]&&_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x78')]&&_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x79')]){_0x5ce58e[_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x2d')]](_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x78')],null,util[_0x6042('0x71')](_0x6042('0x7a'),_0x5484b4[_0x6042('0x7b')],_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x77')],_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x78')],_0x5484b4[_0x6042('0x75')][_0xf2060f][_0x6042('0x79')]));}}}if(_0x5484b4[_0x6042('0x7c')]){_0x5484b4[_0x6042('0x7c')]=JSON[_0x6042('0x76')](_0x5484b4[_0x6042('0x7c')]);_0x5ce58e[_0x6042('0x38')](_0x5b8c64(_0x5484b4[_0x6042('0x7c')][_0x6042('0x62')]));}_0x468c09=_0x5ce58e[_0x6042('0x7d')]();_0x5ce58e[_0x6042('0x1c')](_0x502134);_0x5ce58e[_0x6042('0x1e')](0x0);logger[_0x6042('0x7e')](_0x6042('0x7f'),_0x5ce58e[_0x6042('0x80')]());return dbH[_0x6042('0x81')]['query'](_0x5ce58e[_0x6042('0x80')](),{'type':dbH[_0x6042('0x81')][_0x6042('0x82')][_0x6042('0x83')]});}})['then'](respondWithResult(_0xffd933,null))[_0x6042('0x40')](handleError(_0xffd933,null));};function runReport(_0xb8da06,_0x81d3b,_0xb0bb20){var _0x13149d=_0x81d3b[_0x6042('0x29')];var _0x154935=0xa;var _0x5601ff=[_0x6042('0x4c'),'left_join',_0x6042('0x4e'),_0x6042('0x4f')];var _0x3df097={'SUM':_0x6042('0x50'),'COUNT':_0x6042('0x51'),'COUNT DISTINCT':_0x6042('0x52'),'MAX':_0x6042('0x53'),'MIN':_0x6042('0x54'),'AVG':_0x6042('0x55'),'GROUP_CONCAT':_0x6042('0x56'),'GROUP_CONCAT ASC':_0x6042('0x84'),'GROUP_CONCAT DESC':_0x6042('0x85')};var _0x57cbd3={'SEC_TO_TIME':_0x6042('0x57'),'DATE':_0x6042('0x58'),'HOUR':_0x6042('0x59'),'ROUND':_0x6042('0x5a'),'UNIX_TIMESTAMP':_0x6042('0x86')};var _0x5a4255=function(_0x2cdece){return!_['includes']([_0x6042('0x5c'),_0x6042('0x5d'),_0x6042('0x5e'),_0x6042('0x5f')],_0x2cdece);};var _0x5e2fd2=function(_0x5ac2ff){if(!_0x5ac2ff||!_0x5ac2ff['rules'][_0x6042('0x34')]){return'';}for(var _0x17defa='(',_0x2ebee1=0x0;_0x2ebee1<_0x5ac2ff[_0x6042('0x60')][_0x6042('0x34')];_0x2ebee1+=0x1){_0x2ebee1>0x0&&(_0x17defa+='\x20'+_0x5ac2ff['operator']+'\x20');_0x17defa+=_0x5ac2ff[_0x6042('0x60')][_0x2ebee1][_0x6042('0x62')]?_0x5e2fd2(_0x5ac2ff['rules'][_0x2ebee1][_0x6042('0x62')]):_0x5ac2ff['rules'][_0x2ebee1]['field']+'\x20'+_0x5ac2ff[_0x6042('0x60')][_0x2ebee1][_0x6042('0x63')]+(_0x5a4255(_0x5ac2ff['rules'][_0x2ebee1]['condition'])?'\x20'+_0x5ac2ff[_0x6042('0x60')][_0x2ebee1][_0x6042('0x64')]:'');}return _0x17defa+')';};var _0x5960a2={'where':{'id':_0xb8da06['id']}},_0x5ba1c4,_0x170c66,_0x1136f8,_0x1d2767,_0x15f8c9;_0x5960a2=_[_0x6042('0x3a')]({},_0x5960a2,_0xb0bb20);return db[_0x6042('0x3c')]['find'](_0x5960a2)[_0x6042('0x22')](function(_0x1afe88){if(_0x1afe88){_0x5ba1c4=_0x1afe88;return _0x1afe88[_0x6042('0x66')]();}return null;})[_0x6042('0x22')](function(_0x5dcda3){if(_0x5dcda3){if(!_0x5dcda3[_0x6042('0x34')]){throw new db[(_0x6042('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x170c66=_0x5dcda3;return db[_0x6042('0x88')]['findAll']({'raw':!![]});}return null;})[_0x6042('0x22')](function(_0x2bbc9a){if(_0x2bbc9a){_0x1136f8=_[_0x6042('0x69')](_0x2bbc9a,'id');var _0x19af66;var _0x429a84=squel[_0x6042('0x6a')]();_0x429a84[_0x6042('0x6b')](_0x5ba1c4[_0x6042('0x7b')]);for(var _0x332bc8=0x0;_0x332bc8<_0x170c66['length'];_0x332bc8+=0x1){_0x19af66=_0x170c66[_0x332bc8][_0x6042('0x6c')]?_0x1136f8[_0x170c66[_0x332bc8][_0x6042('0x6c')]][_0x6042('0x6d')]:_0x170c66[_0x332bc8][_0x6042('0x6e')];_0x19af66=_0x170c66[_0x332bc8][_0x6042('0x6f')]?_[_0x6042('0x70')](_0x3df097[_0x170c66[_0x332bc8][_0x6042('0x6f')]],'%s',_0x19af66):_0x19af66;_0x19af66=_0x170c66[_0x332bc8]['format']?_['replace'](_0x57cbd3[_0x170c66[_0x332bc8][_0x6042('0x71')]],'%s',_0x19af66):_0x19af66;if(_0x170c66[_0x332bc8][_0x6042('0x72')]){_0x429a84[_0x6042('0x62')](_0x19af66);}_0x170c66[_0x332bc8][_0x6042('0x73')]&&_0x429a84[_0x6042('0x89')](_0x19af66,_0x170c66[_0x332bc8][_0x6042('0x73')]===_0x6042('0x74')?![]:!![]);_0x429a84['field'](_0x19af66,_0x170c66[_0x332bc8][_0x6042('0x8a')]||_0x19af66);}if(_0x5ba1c4[_0x6042('0x75')]){_0x5ba1c4[_0x6042('0x75')]=JSON[_0x6042('0x76')](_0x5ba1c4[_0x6042('0x75')]);for(var _0x5483e2=0x0;_0x5483e2<_0x5ba1c4[_0x6042('0x75')][_0x6042('0x34')];_0x5483e2+=0x1){if(_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x2d')]&&_[_0x6042('0x5b')](_0x5601ff,_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x2d')])&&_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x77')]&&_0x5ba1c4['joins'][_0x5483e2][_0x6042('0x78')]&&_0x5ba1c4[_0x6042('0x75')][_0x5483e2]['foreignKey']){_0x429a84[_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x2d')]](_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x78')],null,util[_0x6042('0x71')]('%s.%s\x20=\x20%s.%s',_0x5ba1c4[_0x6042('0x7b')],_0x5ba1c4[_0x6042('0x75')][_0x5483e2]['parentKey'],_0x5ba1c4['joins'][_0x5483e2][_0x6042('0x78')],_0x5ba1c4[_0x6042('0x75')][_0x5483e2][_0x6042('0x79')]));}}}if(_0x5ba1c4[_0x6042('0x7c')]){_0x5ba1c4[_0x6042('0x7c')]=JSON['parse'](_0x5ba1c4[_0x6042('0x7c')]);_0x429a84[_0x6042('0x38')](_0x5e2fd2(_0x5ba1c4[_0x6042('0x7c')]['group']));}_0x15f8c9=_0x429a84[_0x6042('0x7d')]();_0x429a84[_0x6042('0x1c')](_0x154935);_0x429a84[_0x6042('0x1e')](0x0);return;}})[_0x6042('0x22')](function(){if(_0x81d3b[_0x6042('0x8b')]===_0x6042('0x8c')){return null;}var _0x55d254=_['merge'](_0x81d3b,{'name':_0x81d3b[_0x6042('0x8d')]||_0x81d3b['name']||_0x5ba1c4['name'],'basename':_0x13149d,'savename':util['format'](_0x6042('0x8e'),_0x81d3b['name']||_0x5ba1c4[_0x6042('0x29')],require('randomstring')['generate'](0x4),_0x81d3b[_0x6042('0x8b')]||'csv'),'reportId':_0x5ba1c4['id'],'reportType':_0x6042('0x8f')});return db[_0x6042('0x90')]['create'](_0x55d254,{'raw':!![]});})[_0x6042('0x22')](function(_0x24fa34){if(_0x5ba1c4[_0x6042('0x7b')]===_0x6042('0x91')){_0x15f8c9[_0x6042('0x38')](_0x5ba1c4[_0x6042('0x7b')]+_0x6042('0x92'),_0x81d3b['startDate'],_0x81d3b[_0x6042('0x93')]);}else{_0x15f8c9[_0x6042('0x38')](_0x5ba1c4[_0x6042('0x7b')]+_0x6042('0x94'),_0x81d3b[_0x6042('0x95')],_0x81d3b[_0x6042('0x93')]);}if(_0x24fa34){logger['info'](_0x6042('0x96'),_0x15f8c9['toString']());require(_0x6042('0x97'))['fork'](path[_0x6042('0x4c')](__dirname,_0x6042('0x98'),_0x24fa34[_0x6042('0x8b')]),[_0x24fa34['id'],_0x15f8c9[_0x6042('0x80')](),path[_0x6042('0x4c')](__dirname,_0x6042('0x99'),_0x24fa34[_0x6042('0x9a')]),_0x13149d]);return _0x24fa34;}else{var _0x1a0e29=squel[_0x6042('0x6a')]();_0x1a0e29[_0x6042('0x6b')]('('+_0x15f8c9[_0x6042('0x80')]()+')',_0x6042('0x9b'));_0x1a0e29['field'](_0x6042('0x9c'),'count');_0x15f8c9[_0x6042('0x1c')](_0x81d3b[_0x6042('0x1c')]||_0x154935);_0x15f8c9[_0x6042('0x1e')](_0x81d3b[_0x6042('0x1e')]||0x0);return dbH['sequelize'][_0x6042('0x30')](_0x1a0e29[_0x6042('0x80')](),{'type':dbH[_0x6042('0x81')][_0x6042('0x82')][_0x6042('0x83')]})[_0x6042('0x22')](function(_0x17985f){if(!_0x17985f[_0x6042('0x34')]){_0x1d2767=0x0;}else{_0x1d2767=_0x17985f[0x0][_0x6042('0x1d')]||0x0;}return dbH[_0x6042('0x81')][_0x6042('0x30')](_0x15f8c9[_0x6042('0x80')](),{'type':dbH[_0x6042('0x81')]['QueryTypes'][_0x6042('0x83')]});})[_0x6042('0x22')](function(_0x58a470){return{'rows':_0x58a470||[],'count':_0x1d2767};});}});}exports['run']=function(_0xacd731,_0x5bdd4e){return runReport(_0xacd731[_0x6042('0x4b')],_0xacd731[_0x6042('0x30')],_0xacd731[_0x6042('0x65')])[_0x6042('0x22')](respondWithResult(_0x5bdd4e,null))[_0x6042('0x40')](handleError(_0x5bdd4e,null));};exports[_0x6042('0x9d')]=runReport;exports[_0x6042('0x30')]=function(_0x3e4aca,_0x617515){var _0x541832=0xa;var _0x517714=[_0x6042('0x4c'),'left_join',_0x6042('0x4e'),_0x6042('0x4f')];var _0x5b4e90={'SUM':_0x6042('0x50'),'COUNT':_0x6042('0x51'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6042('0x53'),'MIN':'MIN(%s)','AVG':_0x6042('0x55'),'GROUP_CONCAT':_0x6042('0x56'),'GROUP_CONCAT ASC':_0x6042('0x84'),'GROUP_CONCAT DESC':_0x6042('0x85')};var _0x2f5f78={'SEC_TO_TIME':_0x6042('0x57'),'DATE':_0x6042('0x58'),'HOUR':_0x6042('0x59'),'ROUND':_0x6042('0x5a'),'UNIX_TIMESTAMP':_0x6042('0x86')};var _0x5c8ddf=function(_0x48c999){return!_[_0x6042('0x5b')]([_0x6042('0x5c'),_0x6042('0x5d'),_0x6042('0x5e'),_0x6042('0x5f')],_0x48c999);};var _0x4a855e=function(_0x25a944){if(!_0x25a944||!_0x25a944['rules'][_0x6042('0x34')]){return'';}for(var _0x5350fe='(',_0x967291=0x0;_0x967291<_0x25a944[_0x6042('0x60')]['length'];_0x967291+=0x1){_0x967291>0x0&&(_0x5350fe+='\x20'+_0x25a944[_0x6042('0x61')]+'\x20');_0x5350fe+=_0x25a944['rules'][_0x967291][_0x6042('0x62')]?_0x4a855e(_0x25a944[_0x6042('0x60')][_0x967291][_0x6042('0x62')]):_0x25a944[_0x6042('0x60')][_0x967291]['field']+'\x20'+_0x25a944[_0x6042('0x60')][_0x967291]['condition']+(_0x5c8ddf(_0x25a944[_0x6042('0x60')][_0x967291][_0x6042('0x63')])?'\x20'+_0x25a944[_0x6042('0x60')][_0x967291][_0x6042('0x64')]:'');}return _0x5350fe+')';};var _0x13cc9={'where':{'id':_0x3e4aca['params']['id']}},_0x306381,_0x506900,_0x3ac454,_0x3f7ce0,_0x8e764;_0x13cc9=_[_0x6042('0x3a')]({},_0x13cc9,_0x3e4aca[_0x6042('0x65')]);return db[_0x6042('0x3c')][_0x6042('0x48')](_0x13cc9)[_0x6042('0x22')](function(_0x311f8e){if(_0x311f8e){_0x306381=_0x311f8e;return _0x311f8e[_0x6042('0x66')]();}return null;})['then'](function(_0x527f13){if(_0x527f13){if(!_0x527f13[_0x6042('0x34')]){throw new db[(_0x6042('0x87'))]['ValidationErrorItem'](_0x6042('0x68'),0x193);}_0x506900=_0x527f13;return db[_0x6042('0x88')][_0x6042('0x3f')]({'raw':!![]});}return null;})[_0x6042('0x22')](function(_0x5bfbb6){if(_0x5bfbb6){_0x3ac454=_[_0x6042('0x69')](_0x5bfbb6,'id');var _0x90b386;var _0x36b20b=squel['select']();_0x36b20b[_0x6042('0x6b')](_0x306381[_0x6042('0x7b')]);for(var _0xdb9202=0x0;_0xdb9202<_0x506900['length'];_0xdb9202+=0x1){_0x90b386=_0x506900[_0xdb9202][_0x6042('0x6c')]?_0x3ac454[_0x506900[_0xdb9202][_0x6042('0x6c')]][_0x6042('0x6d')]:_0x506900[_0xdb9202][_0x6042('0x6e')];_0x90b386=_0x506900[_0xdb9202]['function']?_[_0x6042('0x70')](_0x5b4e90[_0x506900[_0xdb9202]['function']],'%s',_0x90b386):_0x90b386;_0x90b386=_0x506900[_0xdb9202][_0x6042('0x71')]?_[_0x6042('0x70')](_0x2f5f78[_0x506900[_0xdb9202]['format']],'%s',_0x90b386):_0x90b386;if(_0x506900[_0xdb9202][_0x6042('0x72')]){_0x36b20b[_0x6042('0x62')](_0x90b386);}_0x506900[_0xdb9202][_0x6042('0x73')]&&_0x36b20b[_0x6042('0x89')](_0x90b386,_0x506900[_0xdb9202][_0x6042('0x73')]===_0x6042('0x74')?![]:!![]);_0x36b20b[_0x6042('0x6e')](_0x90b386,_0x506900[_0xdb9202][_0x6042('0x8a')]||_0x90b386);}if(_0x306381[_0x6042('0x75')]){_0x306381[_0x6042('0x75')]=JSON['parse'](_0x306381[_0x6042('0x75')]);for(var _0x9ed19c=0x0;_0x9ed19c<_0x306381[_0x6042('0x75')][_0x6042('0x34')];_0x9ed19c+=0x1){if(_0x306381['joins'][_0x9ed19c][_0x6042('0x2d')]&&_[_0x6042('0x5b')](_0x517714,_0x306381[_0x6042('0x75')][_0x9ed19c]['type'])&&_0x306381[_0x6042('0x75')][_0x9ed19c][_0x6042('0x77')]&&_0x306381[_0x6042('0x75')][_0x9ed19c][_0x6042('0x78')]&&_0x306381[_0x6042('0x75')][_0x9ed19c][_0x6042('0x79')]){_0x36b20b[_0x306381['joins'][_0x9ed19c]['type']](_0x306381['joins'][_0x9ed19c][_0x6042('0x78')],null,util[_0x6042('0x71')]('%s.%s\x20=\x20%s.%s',_0x306381[_0x6042('0x7b')],_0x306381['joins'][_0x9ed19c][_0x6042('0x77')],_0x306381['joins'][_0x9ed19c][_0x6042('0x78')],_0x306381['joins'][_0x9ed19c]['foreignKey']));}}}if(_0x306381[_0x6042('0x7c')]){_0x306381[_0x6042('0x7c')]=JSON['parse'](_0x306381[_0x6042('0x7c')]);_0x36b20b[_0x6042('0x38')](_0x4a855e(_0x306381[_0x6042('0x7c')][_0x6042('0x62')]));}_0x8e764=_0x36b20b['clone']();_0x36b20b[_0x6042('0x1c')](_0x541832);_0x36b20b['offset'](0x0);logger[_0x6042('0x7e')](_0x6042('0x7f'),_0x36b20b[_0x6042('0x80')]());return dbH[_0x6042('0x81')]['query'](_0x36b20b[_0x6042('0x80')](),{'type':dbH['sequelize'][_0x6042('0x82')]['SELECT']});}})[_0x6042('0x22')](function(){return{'sql':_0x8e764['toString']()};})[_0x6042('0x22')](respondWithResult(_0x617515,null))[_0x6042('0x40')](handleError(_0x617515,null));}; \ No newline at end of file +var _0x4295=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','save','update','then','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','join','left_join','right_join','cross_join','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\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','foreignKey','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x1bda6c,_0x5440b1){var _0x501a86=function(_0x1de54c){while(--_0x1de54c){_0x1bda6c['push'](_0x1bda6c['shift']());}};_0x501a86(++_0x5440b1);}(_0x4295,0x147));var _0x5429=function(_0x37f89c,_0x49a16c){_0x37f89c=_0x37f89c-0x0;var _0x4ebeac=_0x4295[_0x37f89c];return _0x4ebeac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5429('0x0'));var zipdir=require(_0x5429('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5429('0x2'));var moment=require(_0x5429('0x3'));var BPromise=require(_0x5429('0x4'));var Mustache=require(_0x5429('0x5'));var util=require(_0x5429('0x6'));var path=require('path');var sox=require(_0x5429('0x7'));var csv=require(_0x5429('0x8'));var ejs=require(_0x5429('0x9'));var fs=require('fs');var fs_extra=require(_0x5429('0xa'));var _=require(_0x5429('0xb'));var squel=require(_0x5429('0xc'));var crypto=require(_0x5429('0xd'));var jsforce=require(_0x5429('0xe'));var deskjs=require(_0x5429('0xf'));var toCsv=require(_0x5429('0x8'));var querystring=require('querystring');var Papa=require(_0x5429('0x10'));var Redis=require(_0x5429('0x11'));var authService=require(_0x5429('0x12'));var qs=require(_0x5429('0x13'));var as=require(_0x5429('0x14'));var hardwareService=require(_0x5429('0x15'));var logger=require('../../config/logger')(_0x5429('0x16'));var utils=require(_0x5429('0x17'));var config=require(_0x5429('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5429('0x19'))['db'];var dbH=require(_0x5429('0x19'))[_0x5429('0x1a')];function respondWithStatusCode(_0x555e50,_0x2538fb){_0x2538fb=_0x2538fb||0xcc;return function(_0x4cad90){if(_0x4cad90){return _0x555e50[_0x5429('0x1b')](_0x2538fb);}return _0x555e50[_0x5429('0x1c')](_0x2538fb)[_0x5429('0x1d')]();};}function respondWithResult(_0x2f621c,_0xa00327){_0xa00327=_0xa00327||0xc8;return function(_0x26fd06){if(_0x26fd06){return _0x2f621c[_0x5429('0x1c')](_0xa00327)[_0x5429('0x1e')](_0x26fd06);}};}function respondWithFilteredResult(_0x18a1da,_0x28ccf5){return function(_0x240f6d){if(_0x240f6d){var _0x23eb53=typeof _0x28ccf5[_0x5429('0x1f')]===_0x5429('0x20')&&typeof _0x28ccf5['limit']==='undefined';var _0x2604ea=_0x240f6d[_0x5429('0x21')];var _0xf28029=_0x23eb53?0x0:_0x28ccf5[_0x5429('0x1f')];var _0x3f03b4=_0x23eb53?_0x240f6d['count']:_0x28ccf5[_0x5429('0x1f')]+_0x28ccf5['limit'];var _0x4c1733;if(_0x3f03b4>=_0x2604ea){_0x3f03b4=_0x2604ea;_0x4c1733=0xc8;}else{_0x4c1733=0xce;}_0x18a1da[_0x5429('0x1c')](_0x4c1733);return _0x18a1da['set']('Content-Range',_0xf28029+'-'+_0x3f03b4+'/'+_0x2604ea)[_0x5429('0x1e')](_0x240f6d);}return null;};}function patchUpdates(_0x2c48d4){return function(_0x74341c){try{jsonpatch['apply'](_0x74341c,_0x2c48d4,!![]);}catch(_0x26c499){return BPromise['reject'](_0x26c499);}return _0x74341c[_0x5429('0x22')]();};}function saveUpdates(_0x31c8dc,_0x3d46ff){return function(_0x5e25a9){if(_0x5e25a9){return _0x5e25a9[_0x5429('0x23')](_0x31c8dc)[_0x5429('0x24')](function(_0x182280){return _0x182280;});}return null;};}function removeEntity(_0x3e656c,_0x4e9d51){return function(_0x5358b1){if(_0x5358b1){return _0x5358b1['destroy']()['then'](function(){var _0x4ce40d=_0x5358b1[_0x5429('0x25')]({'plain':!![]});var _0x17f9a7=_0x5429('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x17f9a7,'resourceId':_0x4ce40d['id']}})['then'](function(){return _0x5358b1;});})['then'](function(){_0x3e656c[_0x5429('0x1c')](0xcc)[_0x5429('0x1d')]();});}};}function handleEntityNotFound(_0x380b97,_0x31ff4b){return function(_0x3e3e61){if(!_0x3e3e61){_0x380b97[_0x5429('0x1b')](0x194);}return _0x3e3e61;};}function handleError(_0xce55a,_0x54390e){_0x54390e=_0x54390e||0x1f4;return function(_0x13efa8){logger[_0x5429('0x27')](_0x13efa8[_0x5429('0x28')]);if(_0x13efa8[_0x5429('0x29')]){delete _0x13efa8[_0x5429('0x29')];}_0xce55a[_0x5429('0x1c')](_0x54390e)[_0x5429('0x2a')](_0x13efa8);};}exports[_0x5429('0x2b')]=function(_0x583c7f,_0x57c844){var _0x14c014={},_0x4597aa={},_0x29eccc={'count':0x0,'rows':[]};var _0x5b9e99=_[_0x5429('0x2c')](db[_0x5429('0x2d')]['rawAttributes'],function(_0x4c7363){return{'name':_0x4c7363[_0x5429('0x2e')],'type':_0x4c7363[_0x5429('0x2f')]['key']};});_0x4597aa['model']=_[_0x5429('0x2c')](_0x5b9e99,'name');_0x4597aa[_0x5429('0x30')]=_['keys'](_0x583c7f[_0x5429('0x30')]);_0x4597aa[_0x5429('0x31')]=_[_0x5429('0x32')](_0x4597aa[_0x5429('0x33')],_0x4597aa['query']);_0x14c014[_0x5429('0x34')]=_[_0x5429('0x32')](_0x4597aa[_0x5429('0x33')],qs['fields'](_0x583c7f[_0x5429('0x30')][_0x5429('0x35')]));_0x14c014['attributes']=_0x14c014['attributes'][_0x5429('0x36')]?_0x14c014[_0x5429('0x34')]:_0x4597aa[_0x5429('0x33')];if(!_0x583c7f[_0x5429('0x30')][_0x5429('0x37')](_0x5429('0x38'))){_0x14c014[_0x5429('0x39')]=qs[_0x5429('0x39')](_0x583c7f['query'][_0x5429('0x39')]);_0x14c014[_0x5429('0x1f')]=qs[_0x5429('0x1f')](_0x583c7f[_0x5429('0x30')][_0x5429('0x1f')]);}_0x14c014['order']=qs[_0x5429('0x3a')](_0x583c7f['query'][_0x5429('0x3a')]);_0x14c014[_0x5429('0x3b')]=qs['filters'](_[_0x5429('0x3c')](_0x583c7f['query'],_0x4597aa[_0x5429('0x31')]),_0x5b9e99);if(_0x583c7f[_0x5429('0x30')]['filter']){_0x14c014['where']=_[_0x5429('0x3d')](_0x14c014['where'],{'$or':_[_0x5429('0x2c')](_0x5b9e99,function(_0xe91d98){if(_0xe91d98[_0x5429('0x2f')]!==_0x5429('0x3e')){var _0x5d231d={};_0x5d231d[_0xe91d98[_0x5429('0x29')]]={'$like':'%'+_0x583c7f[_0x5429('0x30')]['filter']+'%'};return _0x5d231d;}})});}_0x14c014=_[_0x5429('0x3d')]({},_0x14c014,_0x583c7f[_0x5429('0x3f')]);var _0x50883f={'where':_0x14c014[_0x5429('0x3b')]};return db[_0x5429('0x2d')][_0x5429('0x21')](_0x50883f)[_0x5429('0x24')](function(_0xc2c1d1){_0x29eccc['count']=_0xc2c1d1;if(_0x583c7f[_0x5429('0x30')][_0x5429('0x40')]){_0x14c014[_0x5429('0x41')]=[{'all':!![]}];}return db[_0x5429('0x2d')]['findAll'](_0x14c014);})['then'](function(_0x9aedc2){_0x29eccc['rows']=_0x9aedc2;return _0x29eccc;})[_0x5429('0x24')](respondWithFilteredResult(_0x57c844,_0x14c014))['catch'](handleError(_0x57c844,null));};exports[_0x5429('0x42')]=function(_0x8287b0,_0xf12e6b){var _0x4e8946={'raw':![],'where':{'id':_0x8287b0[_0x5429('0x43')]['id']}},_0x293e55={};_0x293e55[_0x5429('0x33')]=_['keys'](db[_0x5429('0x2d')][_0x5429('0x44')]);_0x293e55[_0x5429('0x30')]=_[_0x5429('0x45')](_0x8287b0[_0x5429('0x30')]);_0x293e55[_0x5429('0x31')]=_[_0x5429('0x32')](_0x293e55[_0x5429('0x33')],_0x293e55[_0x5429('0x30')]);_0x4e8946[_0x5429('0x34')]=_[_0x5429('0x32')](_0x293e55[_0x5429('0x33')],qs[_0x5429('0x35')](_0x8287b0['query']['fields']));_0x4e8946['attributes']=_0x4e8946[_0x5429('0x34')][_0x5429('0x36')]?_0x4e8946[_0x5429('0x34')]:_0x293e55[_0x5429('0x33')];if(_0x8287b0[_0x5429('0x30')][_0x5429('0x40')]){_0x4e8946[_0x5429('0x41')]=[{'all':!![]}];}_0x4e8946=_[_0x5429('0x3d')]({},_0x4e8946,_0x8287b0[_0x5429('0x3f')]);return db[_0x5429('0x2d')]['find'](_0x4e8946)['then'](handleEntityNotFound(_0xf12e6b,null))[_0x5429('0x24')](respondWithResult(_0xf12e6b,null))[_0x5429('0x46')](handleError(_0xf12e6b,null));};exports[_0x5429('0x47')]=function(_0x1f6576,_0x2f9cc8){return db[_0x5429('0x2d')][_0x5429('0x47')](_0x1f6576[_0x5429('0x48')],{})['then'](function(_0x4eead3){var _0x28429f=_0x1f6576[_0x5429('0x49')][_0x5429('0x25')]({'plain':!![]});if(!_0x28429f)throw new Error(_0x5429('0x4a'));if(_0x28429f[_0x5429('0x4b')]===_0x5429('0x49')){var _0x129b2a=_0x4eead3['get']({'plain':!![]});var _0x32f0b9='Reports';return db[_0x5429('0x4c')][_0x5429('0x4d')]({'where':{'name':_0x32f0b9,'userProfileId':_0x28429f[_0x5429('0x4e')]},'raw':!![]})['then'](function(_0x59d84f){if(_0x59d84f&&_0x59d84f[_0x5429('0x4f')]===0x0){return db['UserProfileResource'][_0x5429('0x47')]({'name':_0x129b2a[_0x5429('0x29')],'resourceId':_0x129b2a['id'],'type':_0x5429('0x26'),'sectionId':_0x59d84f['id']},{})[_0x5429('0x24')](function(){return _0x4eead3;});}else{return _0x4eead3;}})[_0x5429('0x46')](function(_0x52327f){logger[_0x5429('0x27')](_0x5429('0x50'),_0x52327f);throw _0x52327f;});}return _0x4eead3;})[_0x5429('0x24')](respondWithResult(_0x2f9cc8,0xc9))[_0x5429('0x46')](handleError(_0x2f9cc8,null));};exports[_0x5429('0x23')]=function(_0x54ad43,_0xb344ea){if(_0x54ad43['body']['id']){delete _0x54ad43[_0x5429('0x48')]['id'];}return db[_0x5429('0x2d')][_0x5429('0x4d')]({'where':{'id':_0x54ad43[_0x5429('0x43')]['id']}})['then'](handleEntityNotFound(_0xb344ea,null))[_0x5429('0x24')](saveUpdates(_0x54ad43[_0x5429('0x48')],null))[_0x5429('0x24')](respondWithResult(_0xb344ea,null))['catch'](handleError(_0xb344ea,null));};exports[_0x5429('0x51')]=function(_0x3dd1e6,_0x2a0870){return db[_0x5429('0x2d')]['find']({'where':{'id':_0x3dd1e6[_0x5429('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a0870,null))[_0x5429('0x24')](removeEntity(_0x2a0870,null))[_0x5429('0x46')](handleError(_0x2a0870,null));};exports[_0x5429('0x52')]=function(_0x11b798,_0x36f4eb){var _0x513e86=0xa;var _0x37dc4c=[_0x5429('0x53'),_0x5429('0x54'),_0x5429('0x55'),_0x5429('0x56')];var _0x3f314f={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5429('0x57'),'GROUP_CONCAT':_0x5429('0x58'),'GROUP_CONCAT ASC':_0x5429('0x59'),'GROUP_CONCAT DESC':_0x5429('0x5a')};var _0x414b75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5429('0x5b'),'HOUR':_0x5429('0x5c'),'ROUND':_0x5429('0x5d'),'UNIX_TIMESTAMP':_0x5429('0x5e')};var _0x27d6f7=function(_0x384083){return!_[_0x5429('0x5f')](['IS\x20NULL',_0x5429('0x60'),_0x5429('0x61'),'IS\x20NOT\x20EMPTY'],_0x384083);};var _0x400082=function(_0xfb8d61){if(!_0xfb8d61||!_0xfb8d61[_0x5429('0x62')][_0x5429('0x36')]){return'';}for(var _0x5de8db='(',_0x516bf8=0x0;_0x516bf8<_0xfb8d61['rules'][_0x5429('0x36')];_0x516bf8+=0x1){_0x516bf8>0x0&&(_0x5de8db+='\x20'+_0xfb8d61[_0x5429('0x63')]+'\x20');_0x5de8db+=_0xfb8d61[_0x5429('0x62')][_0x516bf8][_0x5429('0x64')]?_0x400082(_0xfb8d61[_0x5429('0x62')][_0x516bf8][_0x5429('0x64')]):_0xfb8d61[_0x5429('0x62')][_0x516bf8][_0x5429('0x65')]+'\x20'+_0xfb8d61[_0x5429('0x62')][_0x516bf8]['condition']+(_0x27d6f7(_0xfb8d61['rules'][_0x516bf8][_0x5429('0x66')])?'\x20'+_0xfb8d61[_0x5429('0x62')][_0x516bf8][_0x5429('0x67')]:'');}return _0x5de8db+')';};var _0x52f5bf={'where':{'id':_0x11b798['params']['id']}},_0x1c8c14,_0x1a3ad6,_0x242c4e,_0x4be0b9,_0x4e1b56;_0x52f5bf=_[_0x5429('0x3d')]({},_0x52f5bf,_0x11b798['options']);return db['AnalyticCustomReport']['find'](_0x52f5bf)[_0x5429('0x24')](function(_0x22ff3f){if(_0x22ff3f){_0x1c8c14=_0x22ff3f;return _0x22ff3f[_0x5429('0x68')]();}return null;})['then'](function(_0x2602e8){if(_0x2602e8){if(!_0x2602e8['length']){throw new db[(_0x5429('0x69'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1a3ad6=_0x2602e8;return db[_0x5429('0x6a')][_0x5429('0x6b')]({'raw':!![]});}return null;})[_0x5429('0x24')](function(_0x459444){if(_0x459444){_0x242c4e=_[_0x5429('0x6c')](_0x459444,'id');var _0x37ac82;var _0x2c7ac9=squel[_0x5429('0x6d')]();_0x2c7ac9[_0x5429('0x6e')](_0x1c8c14[_0x5429('0x6f')]);for(var _0x5750d9=0x0;_0x5750d9<_0x1a3ad6[_0x5429('0x36')];_0x5750d9+=0x1){_0x37ac82=_0x1a3ad6[_0x5750d9][_0x5429('0x70')]?_0x242c4e[_0x1a3ad6[_0x5750d9][_0x5429('0x70')]][_0x5429('0x71')]:_0x1a3ad6[_0x5750d9]['field'];_0x37ac82=_0x1a3ad6[_0x5750d9][_0x5429('0x72')]?_['replace'](_0x3f314f[_0x1a3ad6[_0x5750d9][_0x5429('0x72')]],'%s',_0x37ac82):_0x37ac82;_0x37ac82=_0x1a3ad6[_0x5750d9]['format']?_[_0x5429('0x73')](_0x414b75[_0x1a3ad6[_0x5750d9][_0x5429('0x74')]],'%s',_0x37ac82):_0x37ac82;if(_0x1a3ad6[_0x5750d9][_0x5429('0x75')]){_0x2c7ac9['group'](_0x37ac82);}_0x1a3ad6[_0x5750d9][_0x5429('0x76')]&&_0x2c7ac9[_0x5429('0x77')](_0x37ac82,_0x1a3ad6[_0x5750d9]['orderBy']===_0x5429('0x78')?![]:!![]);_0x2c7ac9['field'](_0x37ac82,_0x1a3ad6[_0x5750d9][_0x5429('0x79')]||_0x37ac82);}if(_0x1c8c14[_0x5429('0x7a')]){_0x1c8c14[_0x5429('0x7a')]=JSON[_0x5429('0x7b')](_0x1c8c14[_0x5429('0x7a')]);for(var _0x17e5a4=0x0;_0x17e5a4<_0x1c8c14[_0x5429('0x7a')][_0x5429('0x36')];_0x17e5a4+=0x1){if(_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x2f')]&&_[_0x5429('0x5f')](_0x37dc4c,_0x1c8c14['joins'][_0x17e5a4][_0x5429('0x2f')])&&_0x1c8c14[_0x5429('0x7a')][_0x17e5a4]['parentKey']&&_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x7c')]&&_0x1c8c14[_0x5429('0x7a')][_0x17e5a4]['foreignKey']){_0x2c7ac9[_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x2f')]](_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x7c')],null,util[_0x5429('0x74')](_0x5429('0x7d'),_0x1c8c14[_0x5429('0x6f')],_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x7e')],_0x1c8c14[_0x5429('0x7a')][_0x17e5a4][_0x5429('0x7c')],_0x1c8c14['joins'][_0x17e5a4]['foreignKey']));}}}if(_0x1c8c14[_0x5429('0x7f')]){_0x1c8c14[_0x5429('0x7f')]=JSON[_0x5429('0x7b')](_0x1c8c14[_0x5429('0x7f')]);_0x2c7ac9['where'](_0x400082(_0x1c8c14['conditions'][_0x5429('0x64')]));}_0x4e1b56=_0x2c7ac9[_0x5429('0x80')]();_0x2c7ac9['limit'](_0x513e86);_0x2c7ac9[_0x5429('0x1f')](0x0);logger[_0x5429('0x81')](_0x5429('0x82'),_0x2c7ac9[_0x5429('0x83')]());return dbH[_0x5429('0x84')][_0x5429('0x30')](_0x2c7ac9[_0x5429('0x83')](),{'type':dbH['sequelize'][_0x5429('0x85')][_0x5429('0x86')]});}})[_0x5429('0x24')](respondWithResult(_0x36f4eb,null))[_0x5429('0x46')](handleError(_0x36f4eb,null));};function runReport(_0x1e309c,_0x3270ae,_0x2e3708){var _0x24b162=_0x3270ae['name'];var _0x5c6621=0xa;var _0x293755=[_0x5429('0x53'),_0x5429('0x54'),'right_join',_0x5429('0x56')];var _0x1b54da={'SUM':_0x5429('0x87'),'COUNT':_0x5429('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5429('0x89'),'MIN':_0x5429('0x8a'),'AVG':_0x5429('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5429('0x59'),'GROUP_CONCAT DESC':_0x5429('0x5a')};var _0x7d5673={'SEC_TO_TIME':_0x5429('0x8b'),'DATE':_0x5429('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5429('0x5d'),'UNIX_TIMESTAMP':_0x5429('0x5e')};var _0x231571=function(_0x365e33){return!_[_0x5429('0x5f')]([_0x5429('0x8c'),_0x5429('0x60'),'IS\x20EMPTY',_0x5429('0x8d')],_0x365e33);};var _0x276b75=function(_0x538805){if(!_0x538805||!_0x538805[_0x5429('0x62')][_0x5429('0x36')]){return'';}for(var _0xe72679='(',_0x4e604a=0x0;_0x4e604a<_0x538805[_0x5429('0x62')][_0x5429('0x36')];_0x4e604a+=0x1){_0x4e604a>0x0&&(_0xe72679+='\x20'+_0x538805[_0x5429('0x63')]+'\x20');_0xe72679+=_0x538805['rules'][_0x4e604a]['group']?_0x276b75(_0x538805['rules'][_0x4e604a][_0x5429('0x64')]):_0x538805['rules'][_0x4e604a][_0x5429('0x65')]+'\x20'+_0x538805['rules'][_0x4e604a][_0x5429('0x66')]+(_0x231571(_0x538805[_0x5429('0x62')][_0x4e604a]['condition'])?'\x20'+_0x538805['rules'][_0x4e604a][_0x5429('0x67')]:'');}return _0xe72679+')';};var _0x4a0540={'where':{'id':_0x1e309c['id']}},_0x2dd195,_0x1e7ed3,_0x2dd7b6,_0x2b8811,_0x482fa9;_0x4a0540=_[_0x5429('0x3d')]({},_0x4a0540,_0x2e3708);return db['AnalyticCustomReport']['find'](_0x4a0540)[_0x5429('0x24')](function(_0x1aa6ea){if(_0x1aa6ea){_0x2dd195=_0x1aa6ea;return _0x1aa6ea[_0x5429('0x68')]();}return null;})[_0x5429('0x24')](function(_0x414910){if(_0x414910){if(!_0x414910[_0x5429('0x36')]){throw new db[(_0x5429('0x69'))][(_0x5429('0x8e'))](_0x5429('0x8f'),0x193);}_0x1e7ed3=_0x414910;return db['AnalyticMetric'][_0x5429('0x6b')]({'raw':!![]});}return null;})[_0x5429('0x24')](function(_0x4ee01d){if(_0x4ee01d){_0x2dd7b6=_['keyBy'](_0x4ee01d,'id');var _0x5dcd4a;var _0x273ebd=squel[_0x5429('0x6d')]();_0x273ebd[_0x5429('0x6e')](_0x2dd195[_0x5429('0x6f')]);for(var _0x2417ba=0x0;_0x2417ba<_0x1e7ed3[_0x5429('0x36')];_0x2417ba+=0x1){_0x5dcd4a=_0x1e7ed3[_0x2417ba][_0x5429('0x70')]?_0x2dd7b6[_0x1e7ed3[_0x2417ba]['MetricId']]['metric']:_0x1e7ed3[_0x2417ba][_0x5429('0x65')];_0x5dcd4a=_0x1e7ed3[_0x2417ba][_0x5429('0x72')]?_[_0x5429('0x73')](_0x1b54da[_0x1e7ed3[_0x2417ba][_0x5429('0x72')]],'%s',_0x5dcd4a):_0x5dcd4a;_0x5dcd4a=_0x1e7ed3[_0x2417ba][_0x5429('0x74')]?_[_0x5429('0x73')](_0x7d5673[_0x1e7ed3[_0x2417ba]['format']],'%s',_0x5dcd4a):_0x5dcd4a;if(_0x1e7ed3[_0x2417ba]['groupBy']){_0x273ebd[_0x5429('0x64')](_0x5dcd4a);}_0x1e7ed3[_0x2417ba]['orderBy']&&_0x273ebd['order'](_0x5dcd4a,_0x1e7ed3[_0x2417ba][_0x5429('0x76')]===_0x5429('0x78')?![]:!![]);_0x273ebd['field'](_0x5dcd4a,_0x1e7ed3[_0x2417ba][_0x5429('0x79')]||_0x5dcd4a);}if(_0x2dd195[_0x5429('0x7a')]){_0x2dd195[_0x5429('0x7a')]=JSON['parse'](_0x2dd195['joins']);for(var _0x4b02e7=0x0;_0x4b02e7<_0x2dd195[_0x5429('0x7a')][_0x5429('0x36')];_0x4b02e7+=0x1){if(_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x2f')]&&_[_0x5429('0x5f')](_0x293755,_0x2dd195['joins'][_0x4b02e7][_0x5429('0x2f')])&&_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x7e')]&&_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x7c')]&&_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x90')]){_0x273ebd[_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x2f')]](_0x2dd195['joins'][_0x4b02e7][_0x5429('0x7c')],null,util[_0x5429('0x74')](_0x5429('0x7d'),_0x2dd195[_0x5429('0x6f')],_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x7e')],_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x7c')],_0x2dd195[_0x5429('0x7a')][_0x4b02e7][_0x5429('0x90')]));}}}if(_0x2dd195[_0x5429('0x7f')]){_0x2dd195[_0x5429('0x7f')]=JSON[_0x5429('0x7b')](_0x2dd195[_0x5429('0x7f')]);_0x273ebd[_0x5429('0x3b')](_0x276b75(_0x2dd195[_0x5429('0x7f')][_0x5429('0x64')]));}_0x482fa9=_0x273ebd[_0x5429('0x80')]();_0x273ebd[_0x5429('0x39')](_0x5c6621);_0x273ebd[_0x5429('0x1f')](0x0);return;}})[_0x5429('0x24')](function(){if(_0x3270ae['output']===_0x5429('0x91')){return null;}var _0x58c4ee=_[_0x5429('0x3d')](_0x3270ae,{'name':_0x3270ae[_0x5429('0x92')]||_0x3270ae[_0x5429('0x29')]||_0x2dd195['name'],'basename':_0x24b162,'savename':util[_0x5429('0x74')](_0x5429('0x93'),_0x3270ae['name']||_0x2dd195[_0x5429('0x29')],require(_0x5429('0x94'))[_0x5429('0x95')](0x4),_0x3270ae[_0x5429('0x96')]||_0x5429('0x97')),'reportId':_0x2dd195['id'],'reportType':_0x5429('0x98')});return db[_0x5429('0x99')][_0x5429('0x47')](_0x58c4ee,{'raw':!![]});})['then'](function(_0x554a9f){if(_0x2dd195[_0x5429('0x6f')]===_0x5429('0x9a')){_0x482fa9[_0x5429('0x3b')](_0x2dd195[_0x5429('0x6f')]+_0x5429('0x9b'),_0x3270ae[_0x5429('0x9c')],_0x3270ae[_0x5429('0x9d')]);}else{_0x482fa9['where'](_0x2dd195['table']+_0x5429('0x9e'),_0x3270ae['startDate'],_0x3270ae[_0x5429('0x9d')]);}if(_0x554a9f){logger['info']('Run\x20Query:',_0x482fa9[_0x5429('0x83')]());require('child_process')[_0x5429('0x9f')](path[_0x5429('0x53')](__dirname,_0x5429('0xa0'),_0x554a9f[_0x5429('0x96')]),[_0x554a9f['id'],_0x482fa9[_0x5429('0x83')](),path['join'](__dirname,_0x5429('0xa1'),_0x554a9f[_0x5429('0xa2')]),_0x24b162]);return _0x554a9f;}else{var _0x8eba4d=squel[_0x5429('0x6d')]();_0x8eba4d[_0x5429('0x6e')]('('+_0x482fa9[_0x5429('0x83')]()+')',_0x5429('0xa3'));_0x8eba4d[_0x5429('0x65')](_0x5429('0xa4'),'count');_0x482fa9[_0x5429('0x39')](_0x3270ae[_0x5429('0x39')]||_0x5c6621);_0x482fa9['offset'](_0x3270ae[_0x5429('0x1f')]||0x0);return dbH[_0x5429('0x84')][_0x5429('0x30')](_0x8eba4d[_0x5429('0x83')](),{'type':dbH[_0x5429('0x84')][_0x5429('0x85')]['SELECT']})[_0x5429('0x24')](function(_0x56a373){if(!_0x56a373[_0x5429('0x36')]){_0x2b8811=0x0;}else{_0x2b8811=_0x56a373[0x0][_0x5429('0x21')]||0x0;}return dbH['sequelize']['query'](_0x482fa9[_0x5429('0x83')](),{'type':dbH[_0x5429('0x84')][_0x5429('0x85')][_0x5429('0x86')]});})[_0x5429('0x24')](function(_0x1eabd9){return{'rows':_0x1eabd9||[],'count':_0x2b8811};});}});}exports[_0x5429('0xa5')]=function(_0x426c9b,_0x4a973d){return runReport(_0x426c9b[_0x5429('0x43')],_0x426c9b[_0x5429('0x30')],_0x426c9b[_0x5429('0x3f')])[_0x5429('0x24')](respondWithResult(_0x4a973d,null))[_0x5429('0x46')](handleError(_0x4a973d,null));};exports[_0x5429('0xa6')]=runReport;exports['query']=function(_0x3c1b08,_0x498326){var _0x2106ab=0xa;var _0x5118f6=['join','left_join',_0x5429('0x55'),_0x5429('0x56')];var _0x160d3f={'SUM':_0x5429('0x87'),'COUNT':_0x5429('0x88'),'COUNT DISTINCT':_0x5429('0xa7'),'MAX':_0x5429('0x89'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5429('0x59'),'GROUP_CONCAT DESC':_0x5429('0x5a')};var _0x2da5b7={'SEC_TO_TIME':_0x5429('0x8b'),'DATE':'DATE(%s)','HOUR':_0x5429('0x5c'),'ROUND':_0x5429('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x326e30=function(_0x10a2dc){return!_[_0x5429('0x5f')]([_0x5429('0x8c'),_0x5429('0x60'),_0x5429('0x61'),'IS\x20NOT\x20EMPTY'],_0x10a2dc);};var _0x51c654=function(_0x523c8f){if(!_0x523c8f||!_0x523c8f[_0x5429('0x62')]['length']){return'';}for(var _0x242568='(',_0x35a6c7=0x0;_0x35a6c7<_0x523c8f[_0x5429('0x62')]['length'];_0x35a6c7+=0x1){_0x35a6c7>0x0&&(_0x242568+='\x20'+_0x523c8f[_0x5429('0x63')]+'\x20');_0x242568+=_0x523c8f[_0x5429('0x62')][_0x35a6c7][_0x5429('0x64')]?_0x51c654(_0x523c8f[_0x5429('0x62')][_0x35a6c7]['group']):_0x523c8f[_0x5429('0x62')][_0x35a6c7][_0x5429('0x65')]+'\x20'+_0x523c8f[_0x5429('0x62')][_0x35a6c7][_0x5429('0x66')]+(_0x326e30(_0x523c8f['rules'][_0x35a6c7][_0x5429('0x66')])?'\x20'+_0x523c8f[_0x5429('0x62')][_0x35a6c7]['value']:'');}return _0x242568+')';};var _0x4f73a1={'where':{'id':_0x3c1b08[_0x5429('0x43')]['id']}},_0x501fca,_0x262407,_0x2803d4,_0x14e723,_0x2bc7b8;_0x4f73a1=_['merge']({},_0x4f73a1,_0x3c1b08[_0x5429('0x3f')]);return db[_0x5429('0x2d')][_0x5429('0x4d')](_0x4f73a1)[_0x5429('0x24')](function(_0x4f63c7){if(_0x4f63c7){_0x501fca=_0x4f63c7;return _0x4f63c7[_0x5429('0x68')]();}return null;})['then'](function(_0x2698ed){if(_0x2698ed){if(!_0x2698ed['length']){throw new db[(_0x5429('0x69'))][(_0x5429('0x8e'))](_0x5429('0x8f'),0x193);}_0x262407=_0x2698ed;return db[_0x5429('0x6a')][_0x5429('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x252aa1){if(_0x252aa1){_0x2803d4=_[_0x5429('0x6c')](_0x252aa1,'id');var _0x1bb8f9;var _0x3759b9=squel['select']();_0x3759b9[_0x5429('0x6e')](_0x501fca['table']);for(var _0x1b12c8=0x0;_0x1b12c8<_0x262407[_0x5429('0x36')];_0x1b12c8+=0x1){_0x1bb8f9=_0x262407[_0x1b12c8][_0x5429('0x70')]?_0x2803d4[_0x262407[_0x1b12c8][_0x5429('0x70')]][_0x5429('0x71')]:_0x262407[_0x1b12c8]['field'];_0x1bb8f9=_0x262407[_0x1b12c8]['function']?_['replace'](_0x160d3f[_0x262407[_0x1b12c8][_0x5429('0x72')]],'%s',_0x1bb8f9):_0x1bb8f9;_0x1bb8f9=_0x262407[_0x1b12c8][_0x5429('0x74')]?_[_0x5429('0x73')](_0x2da5b7[_0x262407[_0x1b12c8][_0x5429('0x74')]],'%s',_0x1bb8f9):_0x1bb8f9;if(_0x262407[_0x1b12c8][_0x5429('0x75')]){_0x3759b9[_0x5429('0x64')](_0x1bb8f9);}_0x262407[_0x1b12c8][_0x5429('0x76')]&&_0x3759b9['order'](_0x1bb8f9,_0x262407[_0x1b12c8][_0x5429('0x76')]===_0x5429('0x78')?![]:!![]);_0x3759b9[_0x5429('0x65')](_0x1bb8f9,_0x262407[_0x1b12c8][_0x5429('0x79')]||_0x1bb8f9);}if(_0x501fca[_0x5429('0x7a')]){_0x501fca[_0x5429('0x7a')]=JSON[_0x5429('0x7b')](_0x501fca['joins']);for(var _0x48f84e=0x0;_0x48f84e<_0x501fca[_0x5429('0x7a')][_0x5429('0x36')];_0x48f84e+=0x1){if(_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x2f')]&&_[_0x5429('0x5f')](_0x5118f6,_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x2f')])&&_0x501fca[_0x5429('0x7a')][_0x48f84e]['parentKey']&&_0x501fca[_0x5429('0x7a')][_0x48f84e]['foreignTable']&&_0x501fca[_0x5429('0x7a')][_0x48f84e]['foreignKey']){_0x3759b9[_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x2f')]](_0x501fca['joins'][_0x48f84e][_0x5429('0x7c')],null,util['format'](_0x5429('0x7d'),_0x501fca[_0x5429('0x6f')],_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x7e')],_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x7c')],_0x501fca[_0x5429('0x7a')][_0x48f84e][_0x5429('0x90')]));}}}if(_0x501fca[_0x5429('0x7f')]){_0x501fca[_0x5429('0x7f')]=JSON[_0x5429('0x7b')](_0x501fca['conditions']);_0x3759b9[_0x5429('0x3b')](_0x51c654(_0x501fca[_0x5429('0x7f')][_0x5429('0x64')]));}_0x2bc7b8=_0x3759b9[_0x5429('0x80')]();_0x3759b9['limit'](_0x2106ab);_0x3759b9['offset'](0x0);logger[_0x5429('0x81')]('Limited\x20Query:',_0x3759b9['toString']());return dbH[_0x5429('0x84')][_0x5429('0x30')](_0x3759b9[_0x5429('0x83')](),{'type':dbH[_0x5429('0x84')][_0x5429('0x85')][_0x5429('0x86')]});}})[_0x5429('0x24')](function(){return{'sql':_0x2bc7b8['toString']()};})['then'](respondWithResult(_0x498326,null))['catch'](handleError(_0x498326,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1ac581c..56dc4f4 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 _0x72ff=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','request-promise','rimraf','./analyticCustomReport.attributes'];(function(_0x328ba9,_0x30a9ee){var _0x7f08c3=function(_0xd85a51){while(--_0xd85a51){_0x328ba9['push'](_0x328ba9['shift']());}};_0x7f08c3(++_0x30a9ee);}(_0x72ff,0x1c7));var _0xf72f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x72ff[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf72f('0x0'));var util=require(_0xf72f('0x1'));var logger=require(_0xf72f('0x2'))(_0xf72f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf72f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf72f('0x5'));var config=require('../../config/environment');var attributes=require(_0xf72f('0x6'));module[_0xf72f('0x7')]=function(_0xe25106,_0x26ab51){return _0xe25106[_0xf72f('0x8')](_0xf72f('0x9'),attributes,{'tableName':_0xf72f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9685=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','request-promise','path','../../config/environment'];(function(_0xc9d60b,_0x4f4208){var _0x382273=function(_0x2d18b5){while(--_0x2d18b5){_0xc9d60b['push'](_0xc9d60b['shift']());}};_0x382273(++_0x4f4208);}(_0x9685,0x72));var _0x5968=function(_0xa59806,_0x4be614){_0xa59806=_0xa59806-0x0;var _0x94d9a9=_0x9685[_0xa59806];return _0x94d9a9;};'use strict';var _=require('lodash');var util=require(_0x5968('0x0'));var logger=require('../../config/logger')(_0x5968('0x1'));var moment=require(_0x5968('0x2'));var BPromise=require('bluebird');var rp=require(_0x5968('0x3'));var fs=require('fs');var path=require(_0x5968('0x4'));var rimraf=require('rimraf');var config=require(_0x5968('0x5'));var attributes=require(_0x5968('0x6'));module['exports']=function(_0x86f3f,_0x4da796){return _0x86f3f[_0x5968('0x7')](_0x5968('0x8'),attributes,{'tableName':_0x5968('0x9'),'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 a3a4769..17a1e77 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 _0x5b2e=['../../config/utils','rpc','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37f87a,_0x4a4484){var _0x22d489=function(_0x6c9677){while(--_0x6c9677){_0x37f87a['push'](_0x37f87a['shift']());}};_0x22d489(++_0x4a4484);}(_0x5b2e,0xc3));var _0xe5b2=function(_0x1460b3,_0x277a98){_0x1460b3=_0x1460b3-0x0;var _0x197470=_0x5b2e[_0x1460b3];return _0x197470;};'use strict';var _=require('lodash');var util=require(_0xe5b2('0x0'));var moment=require('moment');var BPromise=require(_0xe5b2('0x1'));var rs=require(_0xe5b2('0x2'));var fs=require('fs');var Redis=require(_0xe5b2('0x3'));var db=require(_0xe5b2('0x4'))['db'];var utils=require(_0xe5b2('0x5'));var logger=require('../../config/logger')(_0xe5b2('0x6'));var config=require(_0xe5b2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe5b2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x451d82,_0x4b4324,_0x3b0bf4){return new BPromise(function(_0x23874d,_0x59e065){return client[_0xe5b2('0x9')](_0x451d82,_0x3b0bf4)[_0xe5b2('0xa')](function(_0x14c17d){logger[_0xe5b2('0xb')](_0xe5b2('0xc'),_0x4b4324,_0xe5b2('0xd'));logger[_0xe5b2('0xe')](_0xe5b2('0xf'),_0x4b4324,_0xe5b2('0xd'),JSON[_0xe5b2('0x10')](_0x14c17d));if(_0x14c17d[_0xe5b2('0x11')]){if(_0x14c17d[_0xe5b2('0x11')][_0xe5b2('0x12')]===0x1f4){logger[_0xe5b2('0x11')](_0xe5b2('0xc'),_0x4b4324,_0x14c17d[_0xe5b2('0x11')][_0xe5b2('0x13')]);return _0x59e065(_0x14c17d[_0xe5b2('0x11')][_0xe5b2('0x13')]);}logger[_0xe5b2('0x11')](_0xe5b2('0xc'),_0x4b4324,_0x14c17d[_0xe5b2('0x11')]['message']);return _0x23874d(_0x14c17d[_0xe5b2('0x11')][_0xe5b2('0x13')]);}else{logger[_0xe5b2('0xb')](_0xe5b2('0xc'),_0x4b4324,'request\x20sent');_0x23874d(_0x14c17d['result']['message']);}})['catch'](function(_0x2d47d3){logger[_0xe5b2('0x11')](_0xe5b2('0xc'),_0x4b4324,_0x2d47d3);_0x59e065(_0x2d47d3);});});} \ No newline at end of file +var _0xf016=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xf016,0xa1));var _0x6f01=function(_0x19c447,_0x2469f8){_0x19c447=_0x19c447-0x0;var _0x4e7034=_0xf016[_0x19c447];return _0x4e7034;};'use strict';var _=require(_0x6f01('0x0'));var util=require(_0x6f01('0x1'));var moment=require(_0x6f01('0x2'));var BPromise=require(_0x6f01('0x3'));var rs=require(_0x6f01('0x4'));var fs=require('fs');var Redis=require(_0x6f01('0x5'));var db=require(_0x6f01('0x6'))['db'];var utils=require(_0x6f01('0x7'));var logger=require(_0x6f01('0x8'))(_0x6f01('0x9'));var config=require(_0x6f01('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6f01('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56cdc1,_0x13861d,_0x4b52d9){return new BPromise(function(_0x39a62f,_0x41f4fd){return client['request'](_0x56cdc1,_0x4b52d9)[_0x6f01('0xc')](function(_0x2a633a){logger[_0x6f01('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13861d,'request\x20sent');logger[_0x6f01('0xe')](_0x6f01('0xf'),_0x13861d,'request\x20sent',JSON[_0x6f01('0x10')](_0x2a633a));if(_0x2a633a['error']){if(_0x2a633a['error'][_0x6f01('0x11')]===0x1f4){logger[_0x6f01('0x12')](_0x6f01('0x13'),_0x13861d,_0x2a633a['error'][_0x6f01('0x14')]);return _0x41f4fd(_0x2a633a[_0x6f01('0x12')][_0x6f01('0x14')]);}logger['error'](_0x6f01('0x13'),_0x13861d,_0x2a633a['error'][_0x6f01('0x14')]);return _0x39a62f(_0x2a633a[_0x6f01('0x12')][_0x6f01('0x14')]);}else{logger[_0x6f01('0xd')](_0x6f01('0x13'),_0x13861d,_0x6f01('0x15'));_0x39a62f(_0x2a633a[_0x6f01('0x16')][_0x6f01('0x14')]);}})['catch'](function(_0x1f799e){logger[_0x6f01('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13861d,_0x1f799e);_0x41f4fd(_0x1f799e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index bb288d9..88e9b4b 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 _0xda05=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/preview','isAuthenticated','/:id/run','run','/:id/query','post','create','put','delete','destroy','exports','path','connect-timeout','express'];(function(_0x23af0d,_0x29ed6c){var _0x164fb6=function(_0x4ccdfe){while(--_0x4ccdfe){_0x23af0d['push'](_0x23af0d['shift']());}};_0x164fb6(++_0x29ed6c);}(_0xda05,0x1c9));var _0x5da0=function(_0x247402,_0x9556ed){_0x247402=_0x247402-0x0;var _0x21fbc0=_0xda05[_0x247402];return _0x21fbc0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5da0('0x0'));var timeout=require(_0x5da0('0x1'));var express=require(_0x5da0('0x2'));var router=express[_0x5da0('0x3')]();var fs_extra=require(_0x5da0('0x4'));var auth=require(_0x5da0('0x5'));var interaction=require(_0x5da0('0x6'));var config=require(_0x5da0('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x5da0('0x8')]('/',auth['isAuthenticated'](),controller[_0x5da0('0x9')]);router[_0x5da0('0x8')](_0x5da0('0xa'),auth['isAuthenticated'](),controller[_0x5da0('0xb')]);router['get'](_0x5da0('0xc'),auth[_0x5da0('0xd')](),controller['preview']);router[_0x5da0('0x8')](_0x5da0('0xe'),auth['isAuthenticated'](),controller[_0x5da0('0xf')]);router[_0x5da0('0x8')](_0x5da0('0x10'),auth[_0x5da0('0xd')](),controller['query']);router[_0x5da0('0x11')]('/',auth['isAuthenticated'](),controller[_0x5da0('0x12')]);router[_0x5da0('0x13')](_0x5da0('0xa'),auth[_0x5da0('0xd')](),controller['update']);router[_0x5da0('0x14')](_0x5da0('0xa'),auth[_0x5da0('0xd')](),controller[_0x5da0('0x15')]);module[_0x5da0('0x16')]=router; \ No newline at end of file +var _0x3bab=['query','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview'];(function(_0x40dcdb,_0x106713){var _0xdedf25=function(_0x5c3420){while(--_0x5c3420){_0x40dcdb['push'](_0x40dcdb['shift']());}};_0xdedf25(++_0x106713);}(_0x3bab,0xf8));var _0xb3ba=function(_0x55394d,_0x51c4f7){_0x55394d=_0x55394d-0x0;var _0x114bc5=_0x3bab[_0x55394d];return _0x114bc5;};'use strict';var multer=require(_0xb3ba('0x0'));var util=require(_0xb3ba('0x1'));var path=require(_0xb3ba('0x2'));var timeout=require(_0xb3ba('0x3'));var express=require(_0xb3ba('0x4'));var router=express[_0xb3ba('0x5')]();var fs_extra=require(_0xb3ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb3ba('0x7'));var config=require(_0xb3ba('0x8'));var controller=require(_0xb3ba('0x9'));router[_0xb3ba('0xa')]('/',auth[_0xb3ba('0xb')](),controller['index']);router[_0xb3ba('0xa')](_0xb3ba('0xc'),auth['isAuthenticated'](),controller[_0xb3ba('0xd')]);router['get'](_0xb3ba('0xe'),auth[_0xb3ba('0xb')](),controller[_0xb3ba('0xf')]);router[_0xb3ba('0xa')]('/:id/run',auth[_0xb3ba('0xb')](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0xb3ba('0x10')]);router[_0xb3ba('0x11')]('/',auth[_0xb3ba('0xb')](),controller['create']);router[_0xb3ba('0x12')](_0xb3ba('0xc'),auth[_0xb3ba('0xb')](),controller[_0xb3ba('0x13')]);router[_0xb3ba('0x14')](_0xb3ba('0xc'),auth[_0xb3ba('0xb')](),controller[_0xb3ba('0x15')]);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 07a073d..9165676 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x37299c,_0x4a0008){var _0x25dac8=function(_0x1a4d44){while(--_0x1a4d44){_0x37299c['push'](_0x37299c['shift']());}};_0x25dac8(++_0x4a0008);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3ca7a9,_0x4fc0c7){_0x3ca7a9=_0x3ca7a9-0x0;var _0x399428=_0xeec6[_0x3ca7a9];return _0x399428;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6b65e4d..b4f48b7 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x2b7dae,_0x1a00ef){var _0xe68f93=function(_0x3529fd){while(--_0x3529fd){_0x2b7dae['push'](_0x2b7dae['shift']());}};_0xe68f93(++_0x1a00ef);}(_0x1cb9,0x14e));var _0x91cb=function(_0xaec1e8,_0xdb31ae){_0xaec1e8=_0xaec1e8-0x0;var _0xcad183=_0x1cb9[_0xaec1e8];return _0xcad183;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x403a19,_0x1d9327){var _0x5f4938=function(_0x4bb9f5){while(--_0x4bb9f5){_0x403a19['push'](_0x403a19['shift']());}};_0x5f4938(++_0x1d9327);}(_0x187d,0x93));var _0xd187=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x187d[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index dd133fd..fbdb0c1 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 _0x4594=['api','moment','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','util','../../config/logger'];(function(_0x4637d2,_0x1cb4a9){var _0x5b2683=function(_0x1a59ca){while(--_0x1a59ca){_0x4637d2['push'](_0x4637d2['shift']());}};_0x5b2683(++_0x1cb4a9);}(_0x4594,0x132));var _0x4459=function(_0x49cab6,_0xff7be1){_0x49cab6=_0x49cab6-0x0;var _0x2b2b02=_0x4594[_0x49cab6];return _0x2b2b02;};'use strict';var _=require('lodash');var util=require(_0x4459('0x0'));var logger=require(_0x4459('0x1'))(_0x4459('0x2'));var moment=require(_0x4459('0x3'));var BPromise=require('bluebird');var rp=require(_0x4459('0x4'));var fs=require('fs');var path=require(_0x4459('0x5'));var rimraf=require(_0x4459('0x6'));var config=require('../../config/environment');var attributes=require(_0x4459('0x7'));module[_0x4459('0x8')]=function(_0x34e2a4,_0x2c10f7){return _0x34e2a4[_0x4459('0x9')](_0x4459('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b30=['./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d6f18,_0xa215b9){var _0x24981c=function(_0xe44d93){while(--_0xe44d93){_0x3d6f18['push'](_0x3d6f18['shift']());}};_0x24981c(++_0xa215b9);}(_0x1b30,0x1f0));var _0x01b3=function(_0x4eec6a,_0x41af19){_0x4eec6a=_0x4eec6a-0x0;var _0x157316=_0x1b30[_0x4eec6a];return _0x157316;};'use strict';var _=require('lodash');var util=require(_0x01b3('0x0'));var logger=require('../../config/logger')(_0x01b3('0x1'));var moment=require(_0x01b3('0x2'));var BPromise=require(_0x01b3('0x3'));var rp=require(_0x01b3('0x4'));var fs=require('fs');var path=require(_0x01b3('0x5'));var rimraf=require(_0x01b3('0x6'));var config=require(_0x01b3('0x7'));var attributes=require(_0x01b3('0x8'));module[_0x01b3('0x9')]=function(_0x2fd6b7,_0xa4fe59){return _0x2fd6b7['define'](_0x01b3('0xa'),attributes,{'tableName':_0x01b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4673511..8cbd33c 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 _0x7345=['error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x302481,_0x5ca7c5){var _0x2cd89f=function(_0x55724b){while(--_0x55724b){_0x302481['push'](_0x302481['shift']());}};_0x2cd89f(++_0x5ca7c5);}(_0x7345,0x1e9));var _0x5734=function(_0x12bcbd,_0x46a583){_0x12bcbd=_0x12bcbd-0x0;var _0x4b7bc1=_0x7345[_0x12bcbd];return _0x4b7bc1;};'use strict';var _=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var moment=require(_0x5734('0x2'));var BPromise=require('bluebird');var rs=require(_0x5734('0x3'));var fs=require('fs');var Redis=require(_0x5734('0x4'));var db=require(_0x5734('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5734('0x6'))(_0x5734('0x7'));var config=require(_0x5734('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ee6a,_0x84b6ba,_0x5a246b){return new BPromise(function(_0x349f7d,_0x386bef){return client[_0x5734('0xa')](_0x33ee6a,_0x5a246b)[_0x5734('0xb')](function(_0x4544c0){logger['info'](_0x5734('0xc'),_0x84b6ba,_0x5734('0xd'));logger[_0x5734('0xe')](_0x5734('0xf'),_0x84b6ba,_0x5734('0xd'),JSON[_0x5734('0x10')](_0x4544c0));if(_0x4544c0[_0x5734('0x11')]){if(_0x4544c0['error']['code']===0x1f4){logger['error'](_0x5734('0xc'),_0x84b6ba,_0x4544c0['error'][_0x5734('0x12')]);return _0x386bef(_0x4544c0[_0x5734('0x11')][_0x5734('0x12')]);}logger[_0x5734('0x11')](_0x5734('0xc'),_0x84b6ba,_0x4544c0['error'][_0x5734('0x12')]);return _0x349f7d(_0x4544c0[_0x5734('0x11')][_0x5734('0x12')]);}else{logger[_0x5734('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x84b6ba,_0x5734('0xd'));_0x349f7d(_0x4544c0[_0x5734('0x14')][_0x5734('0x12')]);}})[_0x5734('0x15')](function(_0x2bba43){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x84b6ba,_0x2bba43);_0x386bef(_0x2bba43);});});} \ No newline at end of file +var _0x36ec=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x196327,_0xa1d43a){var _0x2ea847=function(_0xd7cf3d){while(--_0xd7cf3d){_0x196327['push'](_0x196327['shift']());}};_0x2ea847(++_0xa1d43a);}(_0x36ec,0x86));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc36e('0x0'));var util=require(_0xc36e('0x1'));var moment=require(_0xc36e('0x2'));var BPromise=require(_0xc36e('0x3'));var rs=require(_0xc36e('0x4'));var fs=require('fs');var Redis=require(_0xc36e('0x5'));var db=require(_0xc36e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc36e('0x7'))(_0xc36e('0x8'));var config=require(_0xc36e('0x9'));var jayson=require(_0xc36e('0xa'));var client=jayson[_0xc36e('0xb')][_0xc36e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a57f8,_0x57c6f0,_0x58fb4c){return new BPromise(function(_0x61752a,_0x5dcd85){return client[_0xc36e('0xd')](_0x3a57f8,_0x58fb4c)[_0xc36e('0xe')](function(_0xa112e5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x57c6f0,_0xc36e('0xf'));logger[_0xc36e('0x10')](_0xc36e('0x11'),_0x57c6f0,'request\x20sent',JSON[_0xc36e('0x12')](_0xa112e5));if(_0xa112e5[_0xc36e('0x13')]){if(_0xa112e5[_0xc36e('0x13')][_0xc36e('0x14')]===0x1f4){logger[_0xc36e('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x57c6f0,_0xa112e5[_0xc36e('0x13')]['message']);return _0x5dcd85(_0xa112e5[_0xc36e('0x13')]['message']);}logger[_0xc36e('0x13')](_0xc36e('0x15'),_0x57c6f0,_0xa112e5['error'][_0xc36e('0x16')]);return _0x61752a(_0xa112e5[_0xc36e('0x13')][_0xc36e('0x16')]);}else{logger[_0xc36e('0x17')](_0xc36e('0x15'),_0x57c6f0,_0xc36e('0xf'));_0x61752a(_0xa112e5[_0xc36e('0x18')]['message']);}})['catch'](function(_0x18b4c4){logger[_0xc36e('0x13')](_0xc36e('0x15'),_0x57c6f0,_0x18b4c4);_0x5dcd85(_0x18b4c4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e7c2392..efd0df4 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 _0x9127=['/:id/query','query','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x9127,0x180));var _0x7912=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x9127[_0x102ff9];return _0x24fa97;};'use strict';var multer=require(_0x7912('0x0'));var util=require(_0x7912('0x1'));var path=require(_0x7912('0x2'));var timeout=require(_0x7912('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7912('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7912('0x5'));var config=require(_0x7912('0x6'));var controller=require(_0x7912('0x7'));router[_0x7912('0x8')]('/',auth[_0x7912('0x9')](),controller[_0x7912('0xa')]);router[_0x7912('0x8')](_0x7912('0xb'),auth['isAuthenticated'](),controller[_0x7912('0xc')]);router[_0x7912('0x8')](_0x7912('0xd'),auth[_0x7912('0x9')](),controller['preview']);router[_0x7912('0x8')]('/:id/run',auth[_0x7912('0x9')](),controller[_0x7912('0xe')]);router['get'](_0x7912('0xf'),auth[_0x7912('0x9')](),controller[_0x7912('0x10')]);router['post']('/',auth[_0x7912('0x9')](),controller[_0x7912('0x11')]);router['put'](_0x7912('0xb'),auth['isAuthenticated'](),controller[_0x7912('0x12')]);router['delete'](_0x7912('0xb'),auth[_0x7912('0x9')](),controller[_0x7912('0x13')]);module[_0x7912('0x14')]=router; \ No newline at end of file +var _0xf503=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4d5308,_0x268d72){var _0x56635a=function(_0xf2aa38){while(--_0xf2aa38){_0x4d5308['push'](_0x4d5308['shift']());}};_0x56635a(++_0x268d72);}(_0xf503,0x11a));var _0x3f50=function(_0xc5775d,_0x3701ab){_0xc5775d=_0xc5775d-0x0;var _0x3b4edd=_0xf503[_0xc5775d];return _0x3b4edd;};'use strict';var multer=require(_0x3f50('0x0'));var util=require(_0x3f50('0x1'));var path=require(_0x3f50('0x2'));var timeout=require(_0x3f50('0x3'));var express=require(_0x3f50('0x4'));var router=express[_0x3f50('0x5')]();var fs_extra=require(_0x3f50('0x6'));var auth=require(_0x3f50('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3f50('0x8'));var controller=require(_0x3f50('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3f50('0xa')](_0x3f50('0xb'),auth[_0x3f50('0xc')](),controller[_0x3f50('0xd')]);router[_0x3f50('0xa')](_0x3f50('0xe'),auth['isAuthenticated'](),controller[_0x3f50('0xf')]);router['get'](_0x3f50('0x10'),auth[_0x3f50('0xc')](),controller['run']);router[_0x3f50('0xa')](_0x3f50('0x11'),auth['isAuthenticated'](),controller[_0x3f50('0x12')]);router[_0x3f50('0x13')]('/',auth[_0x3f50('0xc')](),controller[_0x3f50('0x14')]);router[_0x3f50('0x15')](_0x3f50('0xb'),auth[_0x3f50('0xc')](),controller[_0x3f50('0x16')]);router[_0x3f50('0x17')]('/:id',auth[_0x3f50('0xc')](),controller[_0x3f50('0x18')]);module[_0x3f50('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 759dfa6..e8b63ae 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 _0x3bf9=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3bf9,0x8b));var _0x93bf=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0x3bf9[_0x4996d5];return _0x4793f9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x93bf('0x0'));module[_0x93bf('0x1')]={'name':{'type':Sequelize[_0x93bf('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x93bf('0x3')](_0x93bf('0x4'),_0x93bf('0x5'),_0x93bf('0x6')),'allowNull':![],'defaultValue':_0x93bf('0x4')},'savename':{'type':Sequelize[_0x93bf('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x93bf('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x93bf('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0x93bf('0x9')),'allowNull':![],'defaultValue':_0x93bf('0xa')},'reportId':{'type':Sequelize[_0x93bf('0xb')](0xb)[_0x93bf('0xc')]},'reportType':{'type':Sequelize[_0x93bf('0x2')]}}; \ No newline at end of file +var _0x46cf=['xlsx','DATE','Loading','scheduled','INTEGER','exports','STRING'];(function(_0x22ccff,_0x3b9a53){var _0x593172=function(_0x36a256){while(--_0x36a256){_0x22ccff['push'](_0x22ccff['shift']());}};_0x593172(++_0x3b9a53);}(_0x46cf,0x14e));var _0xf46c=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x46cf[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf46c('0x0')]={'name':{'type':Sequelize[_0xf46c('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xf46c('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xf46c('0x2')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xf46c('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf46c('0x3')]},'endDate':{'type':Sequelize[_0xf46c('0x3')]},'status':{'type':Sequelize[_0xf46c('0x1')],'defaultValue':_0xf46c('0x4')},'type':{'type':Sequelize['ENUM']('manual',_0xf46c('0x5')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xf46c('0x6')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d823d1b..889717a 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 _0x0c44=['name','keys','query','intersection','attributes','fields','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','count','includeAll','include','findAll','catch','length','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','download','basename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','savename','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','reject','then','destroy','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','map'];(function(_0x2d5881,_0x38f899){var _0x2b26c2=function(_0x2203bd){while(--_0x2203bd){_0x2d5881['push'](_0x2d5881['shift']());}};_0x2b26c2(++_0x38f899);}(_0x0c44,0x91));var _0x40c4=function(_0x911d76,_0x392f25){_0x911d76=_0x911d76-0x0;var _0x3ef002=_0x0c44[_0x911d76];return _0x3ef002;};'use strict';var emlformat=require(_0x40c4('0x0'));var rimraf=require(_0x40c4('0x1'));var zipdir=require(_0x40c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40c4('0x3'));var moment=require(_0x40c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40c4('0x5'));var util=require(_0x40c4('0x6'));var path=require('path');var sox=require(_0x40c4('0x7'));var csv=require(_0x40c4('0x8'));var ejs=require(_0x40c4('0x9'));var fs=require('fs');var fs_extra=require(_0x40c4('0xa'));var _=require(_0x40c4('0xb'));var squel=require(_0x40c4('0xc'));var crypto=require(_0x40c4('0xd'));var jsforce=require(_0x40c4('0xe'));var deskjs=require(_0x40c4('0xf'));var toCsv=require(_0x40c4('0x8'));var querystring=require(_0x40c4('0x10'));var Papa=require(_0x40c4('0x11'));var Redis=require(_0x40c4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x40c4('0x13'));var as=require(_0x40c4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40c4('0x15'))(_0x40c4('0x16'));var utils=require(_0x40c4('0x17'));var config=require(_0x40c4('0x18'));var licenseUtil=require(_0x40c4('0x19'));var db=require(_0x40c4('0x1a'))['db'];function respondWithStatusCode(_0x2c6eb2,_0x30340e){_0x30340e=_0x30340e||0xcc;return function(_0x380419){if(_0x380419){return _0x2c6eb2[_0x40c4('0x1b')](_0x30340e);}return _0x2c6eb2[_0x40c4('0x1c')](_0x30340e)[_0x40c4('0x1d')]();};}function respondWithResult(_0x1b1bec,_0x27a582){_0x27a582=_0x27a582||0xc8;return function(_0x244bb1){if(_0x244bb1){return _0x1b1bec['status'](_0x27a582)[_0x40c4('0x1e')](_0x244bb1);}};}function respondWithFilteredResult(_0x3e539c,_0x28e75b){return function(_0x485512){if(_0x485512){var _0x588173=typeof _0x28e75b['offset']===_0x40c4('0x1f')&&typeof _0x28e75b['limit']===_0x40c4('0x1f');var _0x2977b6=_0x485512['count'];var _0x1672c6=_0x588173?0x0:_0x28e75b[_0x40c4('0x20')];var _0x4b5331=_0x588173?_0x485512['count']:_0x28e75b['offset']+_0x28e75b[_0x40c4('0x21')];var _0x4fb9cd;if(_0x4b5331>=_0x2977b6){_0x4b5331=_0x2977b6;_0x4fb9cd=0xc8;}else{_0x4fb9cd=0xce;}_0x3e539c[_0x40c4('0x1c')](_0x4fb9cd);return _0x3e539c[_0x40c4('0x22')](_0x40c4('0x23'),_0x1672c6+'-'+_0x4b5331+'/'+_0x2977b6)[_0x40c4('0x1e')](_0x485512);}return null;};}function patchUpdates(_0x581647){return function(_0xd62635){try{jsonpatch['apply'](_0xd62635,_0x581647,!![]);}catch(_0x1fb377){return BPromise[_0x40c4('0x24')](_0x1fb377);}return _0xd62635['save']();};}function saveUpdates(_0x5b452e,_0x238d4d){return function(_0x460f2e){if(_0x460f2e){return _0x460f2e['update'](_0x5b452e)[_0x40c4('0x25')](function(_0x50e4bf){return _0x50e4bf;});}return null;};}function removeEntity(_0x568d1d,_0x59af9c){return function(_0x5c2eaf){if(_0x5c2eaf){return _0x5c2eaf[_0x40c4('0x26')]()[_0x40c4('0x25')](function(){var _0x17c13e=_0x5c2eaf['get']({'plain':!![]});var _0x2847e3='ExtractedReports';return db[_0x40c4('0x27')]['destroy']({'where':{'type':_0x2847e3,'resourceId':_0x17c13e['id']}})[_0x40c4('0x25')](function(){return _0x5c2eaf;});})[_0x40c4('0x25')](function(){_0x568d1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592b84,_0x4f87f4){return function(_0x53dc90){if(!_0x53dc90){_0x592b84[_0x40c4('0x1b')](0x194);}return _0x53dc90;};}function handleError(_0x13d497,_0xc961d9){_0xc961d9=_0xc961d9||0x1f4;return function(_0x23422b){logger[_0x40c4('0x28')](_0x23422b[_0x40c4('0x29')]);if(_0x23422b['name']){delete _0x23422b['name'];}_0x13d497['status'](_0xc961d9)[_0x40c4('0x2a')](_0x23422b);};}exports[_0x40c4('0x2b')]=function(_0x53c7c0,_0x1fa6cd){var _0x2fd30a={},_0x1b787f={},_0x54c72b={'count':0x0,'rows':[]};var _0x1e9383=_['map'](db['AnalyticExtractedReport'][_0x40c4('0x2c')],function(_0x36dd2f){return{'name':_0x36dd2f[_0x40c4('0x2d')],'type':_0x36dd2f['type'][_0x40c4('0x2e')]};});_0x1b787f[_0x40c4('0x2f')]=_[_0x40c4('0x30')](_0x1e9383,_0x40c4('0x31'));_0x1b787f['query']=_[_0x40c4('0x32')](_0x53c7c0[_0x40c4('0x33')]);_0x1b787f['filters']=_[_0x40c4('0x34')](_0x1b787f['model'],_0x1b787f[_0x40c4('0x33')]);_0x2fd30a[_0x40c4('0x35')]=_[_0x40c4('0x34')](_0x1b787f[_0x40c4('0x2f')],qs[_0x40c4('0x36')](_0x53c7c0[_0x40c4('0x33')][_0x40c4('0x36')]));_0x2fd30a[_0x40c4('0x35')]=_0x2fd30a[_0x40c4('0x35')]['length']?_0x2fd30a[_0x40c4('0x35')]:_0x1b787f[_0x40c4('0x2f')];if(!_0x53c7c0['query'][_0x40c4('0x37')]('nolimit')){_0x2fd30a[_0x40c4('0x21')]=qs[_0x40c4('0x21')](_0x53c7c0[_0x40c4('0x33')][_0x40c4('0x21')]);_0x2fd30a[_0x40c4('0x20')]=qs[_0x40c4('0x20')](_0x53c7c0[_0x40c4('0x33')][_0x40c4('0x20')]);}_0x2fd30a['order']=qs['sort'](_0x53c7c0[_0x40c4('0x33')]['sort']);_0x2fd30a[_0x40c4('0x38')]=qs[_0x40c4('0x39')](_[_0x40c4('0x3a')](_0x53c7c0['query'],_0x1b787f[_0x40c4('0x39')]),_0x1e9383);if(_0x53c7c0[_0x40c4('0x33')][_0x40c4('0x3b')]){_0x2fd30a[_0x40c4('0x38')]=_[_0x40c4('0x3c')](_0x2fd30a[_0x40c4('0x38')],{'$or':_['map'](_0x1e9383,function(_0xb386c5){if(_0xb386c5['type']!==_0x40c4('0x3d')){var _0x51e436={};_0x51e436[_0xb386c5[_0x40c4('0x31')]]={'$like':'%'+_0x53c7c0[_0x40c4('0x33')][_0x40c4('0x3b')]+'%'};return _0x51e436;}})});}_0x2fd30a=_['merge']({},_0x2fd30a,_0x53c7c0[_0x40c4('0x3e')]);var _0x498ddf={'where':_0x2fd30a['where']};return db[_0x40c4('0x3f')][_0x40c4('0x40')](_0x498ddf)[_0x40c4('0x25')](function(_0x4acf5d){_0x54c72b['count']=_0x4acf5d;if(_0x53c7c0['query'][_0x40c4('0x41')]){_0x2fd30a[_0x40c4('0x42')]=[{'all':!![]}];}return db[_0x40c4('0x3f')][_0x40c4('0x43')](_0x2fd30a);})[_0x40c4('0x25')](function(_0x31b4a5){_0x54c72b['rows']=_0x31b4a5;return _0x54c72b;})[_0x40c4('0x25')](respondWithFilteredResult(_0x1fa6cd,_0x2fd30a))[_0x40c4('0x44')](handleError(_0x1fa6cd,null));};exports['show']=function(_0x167486,_0x18901e){var _0x280b72={'raw':!![],'where':{'id':_0x167486['params']['id']}},_0x2db531={};_0x2db531[_0x40c4('0x2f')]=_['keys'](db[_0x40c4('0x3f')][_0x40c4('0x2c')]);_0x2db531[_0x40c4('0x33')]=_[_0x40c4('0x32')](_0x167486[_0x40c4('0x33')]);_0x2db531['filters']=_[_0x40c4('0x34')](_0x2db531['model'],_0x2db531[_0x40c4('0x33')]);_0x280b72['attributes']=_[_0x40c4('0x34')](_0x2db531[_0x40c4('0x2f')],qs['fields'](_0x167486['query'][_0x40c4('0x36')]));_0x280b72[_0x40c4('0x35')]=_0x280b72['attributes'][_0x40c4('0x45')]?_0x280b72[_0x40c4('0x35')]:_0x2db531[_0x40c4('0x2f')];if(_0x167486['query'][_0x40c4('0x41')]){_0x280b72[_0x40c4('0x42')]=[{'all':!![]}];}_0x280b72=_[_0x40c4('0x3c')]({},_0x280b72,_0x167486['options']);return db[_0x40c4('0x3f')]['find'](_0x280b72)[_0x40c4('0x25')](handleEntityNotFound(_0x18901e,null))['then'](respondWithResult(_0x18901e,null))[_0x40c4('0x44')](handleError(_0x18901e,null));};exports[_0x40c4('0x46')]=function(_0xc471ec,_0x2b4aad){return db['AnalyticExtractedReport'][_0x40c4('0x46')](_0xc471ec[_0x40c4('0x47')],{})[_0x40c4('0x25')](function(_0x1ba78d){var _0x4d6232=_0xc471ec['user'][_0x40c4('0x48')]({'plain':!![]});if(!_0x4d6232)throw new Error(_0x40c4('0x49'));if(_0x4d6232[_0x40c4('0x4a')]===_0x40c4('0x4b')){var _0x3cf8a6=_0x1ba78d[_0x40c4('0x48')]({'plain':!![]});var _0x2a0fe2=_0x40c4('0x4c');return db[_0x40c4('0x4d')][_0x40c4('0x4e')]({'where':{'name':_0x2a0fe2,'userProfileId':_0x4d6232[_0x40c4('0x4f')]},'raw':!![]})[_0x40c4('0x25')](function(_0x77d374){if(_0x77d374&&_0x77d374[_0x40c4('0x50')]===0x0){return db[_0x40c4('0x27')]['create']({'name':_0x3cf8a6['name'],'resourceId':_0x3cf8a6['id'],'type':_0x77d374[_0x40c4('0x31')],'sectionId':_0x77d374['id']},{})[_0x40c4('0x25')](function(){return _0x1ba78d;});}else{return _0x1ba78d;}})[_0x40c4('0x44')](function(_0x1b4d40){logger['error'](_0x40c4('0x51'),_0x1b4d40);throw _0x1b4d40;});}return _0x1ba78d;})[_0x40c4('0x25')](respondWithResult(_0x2b4aad,0xc9))[_0x40c4('0x44')](handleError(_0x2b4aad,null));};exports[_0x40c4('0x52')]=function(_0x21afc1,_0x1b77ec){if(_0x21afc1[_0x40c4('0x47')]['id']){delete _0x21afc1[_0x40c4('0x47')]['id'];}return db[_0x40c4('0x3f')][_0x40c4('0x4e')]({'where':{'id':_0x21afc1[_0x40c4('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b77ec,null))[_0x40c4('0x25')](saveUpdates(_0x21afc1[_0x40c4('0x47')],null))[_0x40c4('0x25')](respondWithResult(_0x1b77ec,null))['catch'](handleError(_0x1b77ec,null));};exports['destroy']=function(_0x4ad9a0,_0x2ea588){return db['AnalyticExtractedReport'][_0x40c4('0x4e')]({'where':{'id':_0x4ad9a0['params']['id']}})[_0x40c4('0x25')](handleEntityNotFound(_0x2ea588,null))[_0x40c4('0x25')](removeEntity(_0x2ea588,null))[_0x40c4('0x44')](handleError(_0x2ea588,null));};exports[_0x40c4('0x54')]=function(_0x1c335d,_0x36ed57,_0x2bc8d8){return db[_0x40c4('0x3f')][_0x40c4('0x4e')]({'where':{'id':_0x1c335d[_0x40c4('0x53')]['id']},'attributes':[_0x40c4('0x31'),_0x40c4('0x55'),'savename',_0x40c4('0x56')],'raw':!![]})[_0x40c4('0x25')](handleEntityNotFound(_0x36ed57,null))['then'](function(_0x60365b){if(_0x60365b){if(!fs[_0x40c4('0x57')](path[_0x40c4('0x58')](config[_0x40c4('0x59')],_0x40c4('0x5a'),_0x60365b['savename']))){throw new db[(_0x40c4('0x5b'))][(_0x40c4('0x5c'))](_0x40c4('0x5d'));}if(_0x1c335d[_0x40c4('0x33')][_0x40c4('0x5e')]){return _0x36ed57[_0x40c4('0x1b')](0xc8);}return _0x36ed57[_0x40c4('0x54')](path['join'](config['root'],_0x40c4('0x5a'),_0x60365b[_0x40c4('0x5f')]),util['format']('%s.%s',_0x60365b[_0x40c4('0x55')]||_0x60365b[_0x40c4('0x31')],_0x60365b[_0x40c4('0x56')][_0x40c4('0x60')]()));}})[_0x40c4('0x44')](handleError(_0x36ed57,null));}; \ No newline at end of file +var _0x4b4d=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','error','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','exists','format','%s.%s','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','ExtractedReports','name','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','order','sort'];(function(_0x5c93f4,_0x406fa1){var _0x4470a1=function(_0x3555fd){while(--_0x3555fd){_0x5c93f4['push'](_0x5c93f4['shift']());}};_0x4470a1(++_0x406fa1);}(_0x4b4d,0xd9));var _0xd4b4=function(_0x172d70,_0x29f71a){_0x172d70=_0x172d70-0x0;var _0x2741ca=_0x4b4d[_0x172d70];return _0x2741ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4b4('0x0'));var zipdir=require(_0xd4b4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4b4('0x2'));var moment=require(_0xd4b4('0x3'));var BPromise=require(_0xd4b4('0x4'));var Mustache=require(_0xd4b4('0x5'));var util=require(_0xd4b4('0x6'));var path=require(_0xd4b4('0x7'));var sox=require(_0xd4b4('0x8'));var csv=require(_0xd4b4('0x9'));var ejs=require(_0xd4b4('0xa'));var fs=require('fs');var fs_extra=require(_0xd4b4('0xb'));var _=require(_0xd4b4('0xc'));var squel=require(_0xd4b4('0xd'));var crypto=require(_0xd4b4('0xe'));var jsforce=require(_0xd4b4('0xf'));var deskjs=require(_0xd4b4('0x10'));var toCsv=require(_0xd4b4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd4b4('0x11'));var qs=require(_0xd4b4('0x12'));var as=require(_0xd4b4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4b4('0x14'))('api');var utils=require(_0xd4b4('0x15'));var config=require(_0xd4b4('0x16'));var licenseUtil=require(_0xd4b4('0x17'));var db=require(_0xd4b4('0x18'))['db'];function respondWithStatusCode(_0x4c247f,_0x1e40db){_0x1e40db=_0x1e40db||0xcc;return function(_0x193906){if(_0x193906){return _0x4c247f[_0xd4b4('0x19')](_0x1e40db);}return _0x4c247f[_0xd4b4('0x1a')](_0x1e40db)['end']();};}function respondWithResult(_0x324fe8,_0x1d4f32){_0x1d4f32=_0x1d4f32||0xc8;return function(_0x253497){if(_0x253497){return _0x324fe8[_0xd4b4('0x1a')](_0x1d4f32)[_0xd4b4('0x1b')](_0x253497);}};}function respondWithFilteredResult(_0x461f18,_0x72c131){return function(_0x365445){if(_0x365445){var _0x1d7b34=typeof _0x72c131[_0xd4b4('0x1c')]===_0xd4b4('0x1d')&&typeof _0x72c131[_0xd4b4('0x1e')]==='undefined';var _0x437b51=_0x365445[_0xd4b4('0x1f')];var _0x59f07c=_0x1d7b34?0x0:_0x72c131[_0xd4b4('0x1c')];var _0x2f0d6c=_0x1d7b34?_0x365445['count']:_0x72c131['offset']+_0x72c131[_0xd4b4('0x1e')];var _0xc26b4d;if(_0x2f0d6c>=_0x437b51){_0x2f0d6c=_0x437b51;_0xc26b4d=0xc8;}else{_0xc26b4d=0xce;}_0x461f18['status'](_0xc26b4d);return _0x461f18[_0xd4b4('0x20')]('Content-Range',_0x59f07c+'-'+_0x2f0d6c+'/'+_0x437b51)[_0xd4b4('0x1b')](_0x365445);}return null;};}function patchUpdates(_0x163ba5){return function(_0x14b996){try{jsonpatch[_0xd4b4('0x21')](_0x14b996,_0x163ba5,!![]);}catch(_0x103b0f){return BPromise[_0xd4b4('0x22')](_0x103b0f);}return _0x14b996[_0xd4b4('0x23')]();};}function saveUpdates(_0x20680e,_0x1ffb7a){return function(_0x26cbbe){if(_0x26cbbe){return _0x26cbbe[_0xd4b4('0x24')](_0x20680e)[_0xd4b4('0x25')](function(_0x35a73e){return _0x35a73e;});}return null;};}function removeEntity(_0x484902,_0x30dd39){return function(_0x221e5e){if(_0x221e5e){return _0x221e5e[_0xd4b4('0x26')]()['then'](function(){var _0xa69745=_0x221e5e['get']({'plain':!![]});var _0x5f59f6=_0xd4b4('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f59f6,'resourceId':_0xa69745['id']}})[_0xd4b4('0x25')](function(){return _0x221e5e;});})[_0xd4b4('0x25')](function(){_0x484902[_0xd4b4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcb3ffe,_0x170eed){return function(_0x3afaa0){if(!_0x3afaa0){_0xcb3ffe['sendStatus'](0x194);}return _0x3afaa0;};}function handleError(_0x28766a,_0x8120b3){_0x8120b3=_0x8120b3||0x1f4;return function(_0x23ee88){logger['error'](_0x23ee88['stack']);if(_0x23ee88[_0xd4b4('0x28')]){delete _0x23ee88['name'];}_0x28766a[_0xd4b4('0x1a')](_0x8120b3)['send'](_0x23ee88);};}exports[_0xd4b4('0x29')]=function(_0x53ab78,_0x35b983){var _0x48edf7={},_0x5cd713={},_0x5167eb={'count':0x0,'rows':[]};var _0x1e0e6f=_[_0xd4b4('0x2a')](db[_0xd4b4('0x2b')][_0xd4b4('0x2c')],function(_0x198347){return{'name':_0x198347['fieldName'],'type':_0x198347[_0xd4b4('0x2d')][_0xd4b4('0x2e')]};});_0x5cd713[_0xd4b4('0x2f')]=_['map'](_0x1e0e6f,'name');_0x5cd713[_0xd4b4('0x30')]=_[_0xd4b4('0x31')](_0x53ab78['query']);_0x5cd713[_0xd4b4('0x32')]=_['intersection'](_0x5cd713[_0xd4b4('0x2f')],_0x5cd713[_0xd4b4('0x30')]);_0x48edf7[_0xd4b4('0x33')]=_['intersection'](_0x5cd713['model'],qs[_0xd4b4('0x34')](_0x53ab78[_0xd4b4('0x30')]['fields']));_0x48edf7['attributes']=_0x48edf7[_0xd4b4('0x33')][_0xd4b4('0x35')]?_0x48edf7[_0xd4b4('0x33')]:_0x5cd713[_0xd4b4('0x2f')];if(!_0x53ab78['query']['hasOwnProperty']('nolimit')){_0x48edf7[_0xd4b4('0x1e')]=qs[_0xd4b4('0x1e')](_0x53ab78[_0xd4b4('0x30')][_0xd4b4('0x1e')]);_0x48edf7[_0xd4b4('0x1c')]=qs['offset'](_0x53ab78[_0xd4b4('0x30')]['offset']);}_0x48edf7[_0xd4b4('0x36')]=qs[_0xd4b4('0x37')](_0x53ab78[_0xd4b4('0x30')][_0xd4b4('0x37')]);_0x48edf7[_0xd4b4('0x38')]=qs[_0xd4b4('0x32')](_[_0xd4b4('0x39')](_0x53ab78[_0xd4b4('0x30')],_0x5cd713[_0xd4b4('0x32')]),_0x1e0e6f);if(_0x53ab78['query'][_0xd4b4('0x3a')]){_0x48edf7[_0xd4b4('0x38')]=_[_0xd4b4('0x3b')](_0x48edf7['where'],{'$or':_[_0xd4b4('0x2a')](_0x1e0e6f,function(_0x38d1b3){if(_0x38d1b3[_0xd4b4('0x2d')]!==_0xd4b4('0x3c')){var _0x3f1e3d={};_0x3f1e3d[_0x38d1b3[_0xd4b4('0x28')]]={'$like':'%'+_0x53ab78[_0xd4b4('0x30')]['filter']+'%'};return _0x3f1e3d;}})});}_0x48edf7=_[_0xd4b4('0x3b')]({},_0x48edf7,_0x53ab78[_0xd4b4('0x3d')]);var _0x4a4b95={'where':_0x48edf7[_0xd4b4('0x38')]};return db[_0xd4b4('0x2b')][_0xd4b4('0x1f')](_0x4a4b95)[_0xd4b4('0x25')](function(_0x2d5f3e){_0x5167eb[_0xd4b4('0x1f')]=_0x2d5f3e;if(_0x53ab78['query']['includeAll']){_0x48edf7[_0xd4b4('0x3e')]=[{'all':!![]}];}return db[_0xd4b4('0x2b')][_0xd4b4('0x3f')](_0x48edf7);})[_0xd4b4('0x25')](function(_0x2d2228){_0x5167eb[_0xd4b4('0x40')]=_0x2d2228;return _0x5167eb;})[_0xd4b4('0x25')](respondWithFilteredResult(_0x35b983,_0x48edf7))[_0xd4b4('0x41')](handleError(_0x35b983,null));};exports[_0xd4b4('0x42')]=function(_0x5e65bf,_0x41721b){var _0x2662ef={'raw':!![],'where':{'id':_0x5e65bf[_0xd4b4('0x43')]['id']}},_0x234faa={};_0x234faa[_0xd4b4('0x2f')]=_[_0xd4b4('0x31')](db[_0xd4b4('0x2b')]['rawAttributes']);_0x234faa[_0xd4b4('0x30')]=_[_0xd4b4('0x31')](_0x5e65bf['query']);_0x234faa[_0xd4b4('0x32')]=_[_0xd4b4('0x44')](_0x234faa['model'],_0x234faa['query']);_0x2662ef['attributes']=_[_0xd4b4('0x44')](_0x234faa[_0xd4b4('0x2f')],qs[_0xd4b4('0x34')](_0x5e65bf[_0xd4b4('0x30')][_0xd4b4('0x34')]));_0x2662ef['attributes']=_0x2662ef[_0xd4b4('0x33')][_0xd4b4('0x35')]?_0x2662ef[_0xd4b4('0x33')]:_0x234faa[_0xd4b4('0x2f')];if(_0x5e65bf[_0xd4b4('0x30')][_0xd4b4('0x45')]){_0x2662ef[_0xd4b4('0x3e')]=[{'all':!![]}];}_0x2662ef=_[_0xd4b4('0x3b')]({},_0x2662ef,_0x5e65bf[_0xd4b4('0x3d')]);return db[_0xd4b4('0x2b')][_0xd4b4('0x46')](_0x2662ef)[_0xd4b4('0x25')](handleEntityNotFound(_0x41721b,null))[_0xd4b4('0x25')](respondWithResult(_0x41721b,null))[_0xd4b4('0x41')](handleError(_0x41721b,null));};exports[_0xd4b4('0x47')]=function(_0x4e12d1,_0x38e19c){return db[_0xd4b4('0x2b')][_0xd4b4('0x47')](_0x4e12d1[_0xd4b4('0x48')],{})[_0xd4b4('0x25')](function(_0x122e8b){var _0x3720a9=_0x4e12d1[_0xd4b4('0x49')]['get']({'plain':!![]});if(!_0x3720a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3720a9['role']===_0xd4b4('0x49')){var _0x2a5ff1=_0x122e8b[_0xd4b4('0x4a')]({'plain':!![]});var _0x31f157=_0xd4b4('0x27');return db[_0xd4b4('0x4b')][_0xd4b4('0x46')]({'where':{'name':_0x31f157,'userProfileId':_0x3720a9[_0xd4b4('0x4c')]},'raw':!![]})[_0xd4b4('0x25')](function(_0x447c0d){if(_0x447c0d&&_0x447c0d['autoAssociation']===0x0){return db[_0xd4b4('0x4d')][_0xd4b4('0x47')]({'name':_0x2a5ff1[_0xd4b4('0x28')],'resourceId':_0x2a5ff1['id'],'type':_0x447c0d[_0xd4b4('0x28')],'sectionId':_0x447c0d['id']},{})[_0xd4b4('0x25')](function(){return _0x122e8b;});}else{return _0x122e8b;}})['catch'](function(_0x1bc5ad){logger[_0xd4b4('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bc5ad);throw _0x1bc5ad;});}return _0x122e8b;})[_0xd4b4('0x25')](respondWithResult(_0x38e19c,0xc9))[_0xd4b4('0x41')](handleError(_0x38e19c,null));};exports[_0xd4b4('0x24')]=function(_0x21d5a9,_0x4fe793){if(_0x21d5a9['body']['id']){delete _0x21d5a9[_0xd4b4('0x48')]['id'];}return db[_0xd4b4('0x2b')][_0xd4b4('0x46')]({'where':{'id':_0x21d5a9['params']['id']}})[_0xd4b4('0x25')](handleEntityNotFound(_0x4fe793,null))[_0xd4b4('0x25')](saveUpdates(_0x21d5a9['body'],null))[_0xd4b4('0x25')](respondWithResult(_0x4fe793,null))[_0xd4b4('0x41')](handleError(_0x4fe793,null));};exports[_0xd4b4('0x26')]=function(_0xb719fc,_0x5f49d7){return db[_0xd4b4('0x2b')][_0xd4b4('0x46')]({'where':{'id':_0xb719fc[_0xd4b4('0x43')]['id']}})[_0xd4b4('0x25')](handleEntityNotFound(_0x5f49d7,null))['then'](removeEntity(_0x5f49d7,null))[_0xd4b4('0x41')](handleError(_0x5f49d7,null));};exports[_0xd4b4('0x4f')]=function(_0x494f7f,_0x2ae440,_0x4995fa){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x494f7f[_0xd4b4('0x43')]['id']},'attributes':[_0xd4b4('0x28'),_0xd4b4('0x50'),_0xd4b4('0x51'),_0xd4b4('0x52')],'raw':!![]})[_0xd4b4('0x25')](handleEntityNotFound(_0x2ae440,null))['then'](function(_0x9a726d){if(_0x9a726d){if(!fs[_0xd4b4('0x53')](path[_0xd4b4('0x54')](config[_0xd4b4('0x55')],_0xd4b4('0x56'),_0x9a726d[_0xd4b4('0x51')]))){throw new db['Sequelize'][(_0xd4b4('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x494f7f[_0xd4b4('0x30')][_0xd4b4('0x58')]){return _0x2ae440[_0xd4b4('0x19')](0xc8);}return _0x2ae440[_0xd4b4('0x4f')](path['join'](config[_0xd4b4('0x55')],_0xd4b4('0x56'),_0x9a726d[_0xd4b4('0x51')]),util[_0xd4b4('0x59')](_0xd4b4('0x5a'),_0x9a726d[_0xd4b4('0x50')]||_0x9a726d['name'],_0x9a726d[_0xd4b4('0x52')]['toLowerCase']()));}})[_0xd4b4('0x41')](handleError(_0x2ae440,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f527fb8..d35e8a6 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 _0xa740=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x34727d,_0x1b3df4){var _0x175efc=function(_0x527de1){while(--_0x527de1){_0x34727d['push'](_0x34727d['shift']());}};_0x175efc(++_0x1b3df4);}(_0xa740,0xaf));var _0x0a74=function(_0x3bc255,_0x5712b0){_0x3bc255=_0x3bc255-0x0;var _0x14e4fc=_0xa740[_0x3bc255];return _0x14e4fc;};'use strict';var _=require('lodash');var util=require(_0x0a74('0x0'));var logger=require(_0x0a74('0x1'))(_0x0a74('0x2'));var moment=require(_0x0a74('0x3'));var BPromise=require(_0x0a74('0x4'));var rp=require(_0x0a74('0x5'));var fs=require('fs');var path=require(_0x0a74('0x6'));var rimraf=require(_0x0a74('0x7'));var config=require(_0x0a74('0x8'));var attributes=require(_0x0a74('0x9'));module[_0x0a74('0xa')]=function(_0x331e6e,_0xcb6e35){return _0x331e6e[_0x0a74('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x0a74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x163b=['rimraf','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x163b,0x16d));var _0xb163=function(_0x3f4ac8,_0x57a8fe){_0x3f4ac8=_0x3f4ac8-0x0;var _0x48cc0e=_0x163b[_0x3f4ac8];return _0x48cc0e;};'use strict';var _=require(_0xb163('0x0'));var util=require('util');var logger=require(_0xb163('0x1'))(_0xb163('0x2'));var moment=require('moment');var BPromise=require(_0xb163('0x3'));var rp=require(_0xb163('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb163('0x5'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xb163('0x6')]=function(_0x2210b2,_0x17e668){return _0x2210b2[_0xb163('0x7')](_0xb163('0x8'),attributes,{'tableName':_0xb163('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 42c3f89..2a68370 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 _0x6675=['stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x290681,_0x59d049){var _0xb8b577=function(_0x1586c5){while(--_0x1586c5){_0x290681['push'](_0x290681['shift']());}};_0xb8b577(++_0x59d049);}(_0x6675,0x15c));var _0x5667=function(_0x440ebe,_0x286deb){_0x440ebe=_0x440ebe-0x0;var _0x399cfb=_0x6675[_0x440ebe];return _0x399cfb;};'use strict';var _=require(_0x5667('0x0'));var util=require('util');var moment=require(_0x5667('0x1'));var BPromise=require(_0x5667('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5667('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5667('0x4'))(_0x5667('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5667('0x6')][_0x5667('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31ba0b,_0x4913c0,_0x32d471){return new BPromise(function(_0x264d45,_0x461471){return client['request'](_0x31ba0b,_0x32d471)[_0x5667('0x8')](function(_0x541731){logger[_0x5667('0x9')](_0x5667('0xa'),_0x4913c0,_0x5667('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4913c0,_0x5667('0xb'),JSON[_0x5667('0xc')](_0x541731));if(_0x541731[_0x5667('0xd')]){if(_0x541731[_0x5667('0xd')][_0x5667('0xe')]===0x1f4){logger['error'](_0x5667('0xa'),_0x4913c0,_0x541731[_0x5667('0xd')][_0x5667('0xf')]);return _0x461471(_0x541731['error'][_0x5667('0xf')]);}logger[_0x5667('0xd')](_0x5667('0xa'),_0x4913c0,_0x541731['error'][_0x5667('0xf')]);return _0x264d45(_0x541731[_0x5667('0xd')][_0x5667('0xf')]);}else{logger[_0x5667('0x9')](_0x5667('0xa'),_0x4913c0,'request\x20sent');_0x264d45(_0x541731[_0x5667('0x10')][_0x5667('0xf')]);}})[_0x5667('0x11')](function(_0x51fa54){logger[_0x5667('0xd')](_0x5667('0xa'),_0x4913c0,_0x51fa54);_0x461471(_0x51fa54);});});} \ No newline at end of file +var _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x21c69c,_0x1b7535){var _0x2acd03=function(_0x4c70f0){while(--_0x4c70f0){_0x21c69c['push'](_0x21c69c['shift']());}};_0x2acd03(++_0x1b7535);}(_0x7d25,0x8a));var _0x57d2=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7d25[_0x58e469];return _0x4c01c5;};'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')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 27eb1fe..a3e617d 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 _0xf1d5=['get','/:id/download','download','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','/:id','isAuthenticated'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xf1d5,0x1bf));var _0x5f1d=function(_0x2a3226,_0x11595e){_0x2a3226=_0x2a3226-0x0;var _0x377993=_0xf1d5[_0x2a3226];return _0x377993;};'use strict';var multer=require(_0x5f1d('0x0'));var util=require(_0x5f1d('0x1'));var path=require(_0x5f1d('0x2'));var timeout=require(_0x5f1d('0x3'));var express=require('express');var router=express[_0x5f1d('0x4')]();var fs_extra=require(_0x5f1d('0x5'));var auth=require(_0x5f1d('0x6'));var interaction=require(_0x5f1d('0x7'));var config=require(_0x5f1d('0x8'));var controller=require(_0x5f1d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f1d('0xa')]);router['get'](_0x5f1d('0xb'),auth[_0x5f1d('0xc')](),controller['show']);router[_0x5f1d('0xd')](_0x5f1d('0xe'),auth[_0x5f1d('0xc')](),controller[_0x5f1d('0xf')]);router['post']('/',auth[_0x5f1d('0xc')](),controller[_0x5f1d('0x10')]);router[_0x5f1d('0x11')](_0x5f1d('0xb'),auth['isAuthenticated'](),controller[_0x5f1d('0x12')]);router['delete'](_0x5f1d('0xb'),auth[_0x5f1d('0xc')](),controller['destroy']);module[_0x5f1d('0x13')]=router; \ No newline at end of file +var _0x6399=['create','update','delete','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','get','download','post'];(function(_0x57b4f2,_0x582a17){var _0x421370=function(_0x4c7c7c){while(--_0x4c7c7c){_0x57b4f2['push'](_0x57b4f2['shift']());}};_0x421370(++_0x582a17);}(_0x6399,0x189));var _0x9639=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6399[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9639('0x0'));var express=require(_0x9639('0x1'));var router=express[_0x9639('0x2')]();var fs_extra=require(_0x9639('0x3'));var auth=require(_0x9639('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9639('0x5'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x9639('0x6')](),controller[_0x9639('0x7')]);router['get'](_0x9639('0x8'),auth[_0x9639('0x6')](),controller['show']);router[_0x9639('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x9639('0xa')]);router[_0x9639('0xb')]('/',auth[_0x9639('0x6')](),controller[_0x9639('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9639('0xd')]);router[_0x9639('0xe')](_0x9639('0x8'),auth[_0x9639('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ca4709b..09e1b02 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 _0x8123=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8123,0x8a));var _0x3812=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x8123[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0x3812('0x0'));module[_0x3812('0x1')]={'field':{'type':Sequelize[_0x3812('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x3812('0x3')]},'format':{'type':Sequelize[_0x3812('0x3')]},'groupBy':{'type':Sequelize[_0x3812('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3812('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0860=['STRING','BOOLEAN','sequelize'];(function(_0x46c6b7,_0x48f8bb){var _0x561506=function(_0x46450a){while(--_0x46450a){_0x46c6b7['push'](_0x46c6b7['shift']());}};_0x561506(++_0x48f8bb);}(_0x0860,0x15b));var _0x0086=function(_0x156da8,_0x4be248){_0x156da8=_0x156da8-0x0;var _0xa96a29=_0x0860[_0x156da8];return _0xa96a29;};'use strict';var Sequelize=require(_0x0086('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x0086('0x1')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0086('0x1')]},'groupBy':{'type':Sequelize[_0x0086('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0086('0x1')]},'custom':{'type':Sequelize[_0x0086('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 49b3047..3afaaba 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 _0x439a=['ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','include','create','body','bulkCreate','find'];(function(_0x26ee60,_0x5871c8){var _0x43d418=function(_0x5649bf){while(--_0x5649bf){_0x26ee60['push'](_0x26ee60['shift']());}};_0x43d418(++_0x5871c8);}(_0x439a,0x186));var _0xa439=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0x439a[_0x33a47b];return _0x3164d0;};'use strict';var emlformat=require(_0xa439('0x0'));var rimraf=require(_0xa439('0x1'));var zipdir=require(_0xa439('0x2'));var jsonpatch=require(_0xa439('0x3'));var rp=require('request-promise');var moment=require(_0xa439('0x4'));var BPromise=require(_0xa439('0x5'));var Mustache=require(_0xa439('0x6'));var util=require(_0xa439('0x7'));var path=require('path');var sox=require(_0xa439('0x8'));var csv=require(_0xa439('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa439('0xa'));var _=require(_0xa439('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa439('0xc'));var toCsv=require(_0xa439('0x9'));var querystring=require(_0xa439('0xd'));var Papa=require(_0xa439('0xe'));var Redis=require('ioredis');var authService=require(_0xa439('0xf'));var qs=require(_0xa439('0x10'));var as=require(_0xa439('0x11'));var hardwareService=require(_0xa439('0x12'));var logger=require(_0xa439('0x13'))(_0xa439('0x14'));var utils=require(_0xa439('0x15'));var config=require(_0xa439('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26ce23,_0x1e99e5){_0x1e99e5=_0x1e99e5||0xcc;return function(_0x23aa51){if(_0x23aa51){return _0x26ce23[_0xa439('0x17')](_0x1e99e5);}return _0x26ce23[_0xa439('0x18')](_0x1e99e5)[_0xa439('0x19')]();};}function respondWithResult(_0x303c40,_0x510e8f){_0x510e8f=_0x510e8f||0xc8;return function(_0x5a4a83){if(_0x5a4a83){return _0x303c40[_0xa439('0x18')](_0x510e8f)[_0xa439('0x1a')](_0x5a4a83);}};}function respondWithFilteredResult(_0x45c4ec,_0x4ae5cb){return function(_0x4e35c0){if(_0x4e35c0){var _0x41be4e=typeof _0x4ae5cb['offset']===_0xa439('0x1b')&&typeof _0x4ae5cb[_0xa439('0x1c')]===_0xa439('0x1b');var _0x1909ab=_0x4e35c0['count'];var _0x42b3c1=_0x41be4e?0x0:_0x4ae5cb[_0xa439('0x1d')];var _0x285b65=_0x41be4e?_0x4e35c0[_0xa439('0x1e')]:_0x4ae5cb[_0xa439('0x1d')]+_0x4ae5cb[_0xa439('0x1c')];var _0x4e530f;if(_0x285b65>=_0x1909ab){_0x285b65=_0x1909ab;_0x4e530f=0xc8;}else{_0x4e530f=0xce;}_0x45c4ec[_0xa439('0x18')](_0x4e530f);return _0x45c4ec['set'](_0xa439('0x1f'),_0x42b3c1+'-'+_0x285b65+'/'+_0x1909ab)[_0xa439('0x1a')](_0x4e35c0);}return null;};}function patchUpdates(_0x41e404){return function(_0x5c6221){try{jsonpatch[_0xa439('0x20')](_0x5c6221,_0x41e404,!![]);}catch(_0x16250f){return BPromise[_0xa439('0x21')](_0x16250f);}return _0x5c6221[_0xa439('0x22')]();};}function saveUpdates(_0x543797,_0x4daff6){return function(_0x4ea2cd){if(_0x4ea2cd){return _0x4ea2cd[_0xa439('0x23')](_0x543797)[_0xa439('0x24')](function(_0x1a0a11){return _0x1a0a11;});}return null;};}function removeEntity(_0x13df5d,_0x3c5139){return function(_0x5cc4a8){if(_0x5cc4a8){return _0x5cc4a8[_0xa439('0x25')]()[_0xa439('0x24')](function(){_0x13df5d['status'](0xcc)[_0xa439('0x19')]();});}};}function handleEntityNotFound(_0x28a4f7,_0x415dba){return function(_0x6222dd){if(!_0x6222dd){_0x28a4f7[_0xa439('0x17')](0x194);}return _0x6222dd;};}function handleError(_0x28ee4e,_0x5acd51){_0x5acd51=_0x5acd51||0x1f4;return function(_0x5a9191){logger[_0xa439('0x26')](_0x5a9191['stack']);if(_0x5a9191[_0xa439('0x27')]){delete _0x5a9191['name'];}_0x28ee4e[_0xa439('0x18')](_0x5acd51)['send'](_0x5a9191);};}exports[_0xa439('0x28')]=function(_0x3ff4fb,_0x3348d5){var _0x53ff3b={},_0x45559b={},_0x248f3f={'count':0x0,'rows':[]};var _0x4f66aa=_[_0xa439('0x29')](db[_0xa439('0x2a')][_0xa439('0x2b')],function(_0x2cfb4f){return{'name':_0x2cfb4f[_0xa439('0x2c')],'type':_0x2cfb4f['type']['key']};});_0x45559b[_0xa439('0x2d')]=_[_0xa439('0x29')](_0x4f66aa,_0xa439('0x27'));_0x45559b[_0xa439('0x2e')]=_[_0xa439('0x2f')](_0x3ff4fb[_0xa439('0x2e')]);_0x45559b[_0xa439('0x30')]=_[_0xa439('0x31')](_0x45559b['model'],_0x45559b[_0xa439('0x2e')]);_0x53ff3b['attributes']=_['intersection'](_0x45559b[_0xa439('0x2d')],qs[_0xa439('0x32')](_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x32')]));_0x53ff3b[_0xa439('0x33')]=_0x53ff3b[_0xa439('0x33')][_0xa439('0x34')]?_0x53ff3b[_0xa439('0x33')]:_0x45559b[_0xa439('0x2d')];if(!_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x35')](_0xa439('0x36'))){_0x53ff3b['limit']=qs[_0xa439('0x1c')](_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x1c')]);_0x53ff3b[_0xa439('0x1d')]=qs['offset'](_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x1d')]);}_0x53ff3b[_0xa439('0x37')]=qs['sort'](_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x38')]);_0x53ff3b[_0xa439('0x39')]=qs['filters'](_['pick'](_0x3ff4fb[_0xa439('0x2e')],_0x45559b[_0xa439('0x30')]),_0x4f66aa);if(_0x3ff4fb[_0xa439('0x2e')][_0xa439('0x3a')]){_0x53ff3b[_0xa439('0x39')]=_[_0xa439('0x3b')](_0x53ff3b[_0xa439('0x39')],{'$or':_[_0xa439('0x29')](_0x4f66aa,function(_0x5a9872){if(_0x5a9872[_0xa439('0x3c')]!==_0xa439('0x3d')){var _0x46e51d={};_0x46e51d[_0x5a9872[_0xa439('0x27')]]={'$like':'%'+_0x3ff4fb['query'][_0xa439('0x3a')]+'%'};return _0x46e51d;}})});}_0x53ff3b=_[_0xa439('0x3b')]({},_0x53ff3b,_0x3ff4fb[_0xa439('0x3e')]);var _0x1c2f02={'where':_0x53ff3b[_0xa439('0x39')]};return db[_0xa439('0x2a')][_0xa439('0x1e')](_0x1c2f02)[_0xa439('0x24')](function(_0x475c8a){_0x248f3f[_0xa439('0x1e')]=_0x475c8a;if(_0x3ff4fb['query'][_0xa439('0x3f')]){_0x53ff3b['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa439('0x40')](_0x53ff3b);})[_0xa439('0x24')](function(_0xb5873){_0x248f3f['rows']=_0xb5873;return _0x248f3f;})[_0xa439('0x24')](respondWithFilteredResult(_0x3348d5,_0x53ff3b))[_0xa439('0x41')](handleError(_0x3348d5,null));};exports['show']=function(_0x389e45,_0xf25d9c){var _0x10af6b={'raw':![],'where':{'id':_0x389e45[_0xa439('0x42')]['id']}},_0x5736ca={};_0x5736ca[_0xa439('0x2d')]=_['keys'](db[_0xa439('0x2a')]['rawAttributes']);_0x5736ca[_0xa439('0x2e')]=_[_0xa439('0x2f')](_0x389e45[_0xa439('0x2e')]);_0x5736ca[_0xa439('0x30')]=_['intersection'](_0x5736ca[_0xa439('0x2d')],_0x5736ca[_0xa439('0x2e')]);_0x10af6b[_0xa439('0x33')]=_[_0xa439('0x31')](_0x5736ca[_0xa439('0x2d')],qs['fields'](_0x389e45['query'][_0xa439('0x32')]));_0x10af6b['attributes']=_0x10af6b[_0xa439('0x33')]['length']?_0x10af6b[_0xa439('0x33')]:_0x5736ca['model'];if(_0x389e45[_0xa439('0x2e')][_0xa439('0x3f')]){_0x10af6b[_0xa439('0x43')]=[{'all':!![]}];}_0x10af6b=_['merge']({},_0x10af6b,_0x389e45[_0xa439('0x3e')]);return db[_0xa439('0x2a')]['find'](_0x10af6b)['then'](handleEntityNotFound(_0xf25d9c,null))[_0xa439('0x24')](respondWithResult(_0xf25d9c,null))['catch'](handleError(_0xf25d9c,null));};exports[_0xa439('0x44')]=function(_0x589000,_0x50e13d){return db['AnalyticFieldReport']['create'](_0x589000[_0xa439('0x45')],{})[_0xa439('0x24')](respondWithResult(_0x50e13d,0xc9))[_0xa439('0x41')](handleError(_0x50e13d,null));};exports[_0xa439('0x46')]=function(_0x53f5f9,_0x5661cb){return db[_0xa439('0x2a')][_0xa439('0x46')](_0x53f5f9[_0xa439('0x45')],{'raw':![],'individualHooks':!![]})[_0xa439('0x24')](respondWithResult(_0x5661cb,0xc9))[_0xa439('0x41')](handleError(_0x5661cb,null));};exports['update']=function(_0xfb75f5,_0x548411){if(_0xfb75f5['body']['id']){delete _0xfb75f5[_0xa439('0x45')]['id'];}return db[_0xa439('0x2a')][_0xa439('0x47')]({'where':{'id':_0xfb75f5[_0xa439('0x42')]['id']}})['then'](handleEntityNotFound(_0x548411,null))[_0xa439('0x24')](saveUpdates(_0xfb75f5[_0xa439('0x45')],null))[_0xa439('0x24')](respondWithResult(_0x548411,null))['catch'](handleError(_0x548411,null));};exports[_0xa439('0x25')]=function(_0x25a3ad,_0x148922){return db['AnalyticFieldReport'][_0xa439('0x47')]({'where':{'id':_0x25a3ad[_0xa439('0x42')]['id']}})[_0xa439('0x24')](handleEntityNotFound(_0x148922,null))['then'](removeEntity(_0x148922,null))[_0xa439('0x41')](handleError(_0x148922,null));};exports['bulkDestroy']=function(_0x287e15,_0x3c0f01){return db[_0xa439('0x2a')][_0xa439('0x25')]({'where':{'id':_0x287e15['query'][_0xa439('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xa439('0x24')](respondWithResult(_0x3c0f01,0xcc))[_0xa439('0x41')](handleError(_0x3c0f01,null));};exports['addFields']=function(_0xedcbb7,_0x2824eb,_0xa844a3){return db[_0xa439('0x49')][_0xa439('0x4a')]({'where':{'id':_0xedcbb7[_0xa439('0x42')]['id']}})['then'](handleEntityNotFound(_0x2824eb,null))[_0xa439('0x24')](function(_0xe36b9c){if(_0xe36b9c){return db['sequelize'][_0xa439('0x4b')](function(_0x303815){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xedcbb7[_0xa439('0x42')]['id']},'transaction':_0x303815})[_0xa439('0x24')](function(_0x44a417){var _0x50d371=_[_0xa439('0x29')](_0xedcbb7['body'],function(_0x57fb32){delete _0x57fb32['id'];_0x57fb32[_0xa439('0x4c')]=_0xedcbb7[_0xa439('0x42')]['id'];return _0x57fb32;});return db['AnalyticFieldReport']['bulkCreate'](_0x50d371,{'transaction':_0x303815});});})['then'](function(){return db[_0xa439('0x2a')]['findAll']({'where':{'CustomReportId':_0xedcbb7[_0xa439('0x42')]['id']}});});}})[_0xa439('0x24')](respondWithResult(_0x2824eb,null))['catch'](handleError(_0x2824eb,null));}; \ No newline at end of file +var _0x0962=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','apply','reject','update','then','destroy','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2ba3ee,_0x34a4a1){var _0x572417=function(_0x41bf37){while(--_0x41bf37){_0x2ba3ee['push'](_0x2ba3ee['shift']());}};_0x572417(++_0x34a4a1);}(_0x0962,0x1d1));var _0x2096=function(_0x2c30c5,_0x59d67f){_0x2c30c5=_0x2c30c5-0x0;var _0x42bd4b=_0x0962[_0x2c30c5];return _0x42bd4b;};'use strict';var emlformat=require(_0x2096('0x0'));var rimraf=require(_0x2096('0x1'));var zipdir=require(_0x2096('0x2'));var jsonpatch=require(_0x2096('0x3'));var rp=require(_0x2096('0x4'));var moment=require(_0x2096('0x5'));var BPromise=require(_0x2096('0x6'));var Mustache=require(_0x2096('0x7'));var util=require(_0x2096('0x8'));var path=require(_0x2096('0x9'));var sox=require(_0x2096('0xa'));var csv=require(_0x2096('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2096('0xc'));var _=require('lodash');var squel=require(_0x2096('0xd'));var crypto=require(_0x2096('0xe'));var jsforce=require(_0x2096('0xf'));var deskjs=require(_0x2096('0x10'));var toCsv=require(_0x2096('0xb'));var querystring=require('querystring');var Papa=require(_0x2096('0x11'));var Redis=require(_0x2096('0x12'));var authService=require(_0x2096('0x13'));var qs=require(_0x2096('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2096('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2096('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2096('0x17'))['db'];function respondWithStatusCode(_0x3aac0f,_0x4daf53){_0x4daf53=_0x4daf53||0xcc;return function(_0x3fd69e){if(_0x3fd69e){return _0x3aac0f[_0x2096('0x18')](_0x4daf53);}return _0x3aac0f['status'](_0x4daf53)[_0x2096('0x19')]();};}function respondWithResult(_0x405698,_0x293fe7){_0x293fe7=_0x293fe7||0xc8;return function(_0x528575){if(_0x528575){return _0x405698[_0x2096('0x1a')](_0x293fe7)[_0x2096('0x1b')](_0x528575);}};}function respondWithFilteredResult(_0x1a5568,_0x1c38ab){return function(_0x3f3806){if(_0x3f3806){var _0x462885=typeof _0x1c38ab['offset']===_0x2096('0x1c')&&typeof _0x1c38ab['limit']===_0x2096('0x1c');var _0x5e9f01=_0x3f3806[_0x2096('0x1d')];var _0x4a9b85=_0x462885?0x0:_0x1c38ab['offset'];var _0x1f6f7f=_0x462885?_0x3f3806[_0x2096('0x1d')]:_0x1c38ab[_0x2096('0x1e')]+_0x1c38ab[_0x2096('0x1f')];var _0x23a76b;if(_0x1f6f7f>=_0x5e9f01){_0x1f6f7f=_0x5e9f01;_0x23a76b=0xc8;}else{_0x23a76b=0xce;}_0x1a5568['status'](_0x23a76b);return _0x1a5568['set']('Content-Range',_0x4a9b85+'-'+_0x1f6f7f+'/'+_0x5e9f01)[_0x2096('0x1b')](_0x3f3806);}return null;};}function patchUpdates(_0x217db2){return function(_0x168ead){try{jsonpatch[_0x2096('0x20')](_0x168ead,_0x217db2,!![]);}catch(_0x3014a4){return BPromise[_0x2096('0x21')](_0x3014a4);}return _0x168ead['save']();};}function saveUpdates(_0x413a66,_0x55c8db){return function(_0x1c6c41){if(_0x1c6c41){return _0x1c6c41[_0x2096('0x22')](_0x413a66)[_0x2096('0x23')](function(_0x17df46){return _0x17df46;});}return null;};}function removeEntity(_0x50ab17,_0x5ca4a6){return function(_0x162e7e){if(_0x162e7e){return _0x162e7e[_0x2096('0x24')]()['then'](function(){_0x50ab17[_0x2096('0x1a')](0xcc)[_0x2096('0x19')]();});}};}function handleEntityNotFound(_0x43ce2c,_0x1e97bd){return function(_0x2a5260){if(!_0x2a5260){_0x43ce2c[_0x2096('0x18')](0x194);}return _0x2a5260;};}function handleError(_0x4d1570,_0x16829c){_0x16829c=_0x16829c||0x1f4;return function(_0x36cbf8){logger['error'](_0x36cbf8['stack']);if(_0x36cbf8[_0x2096('0x25')]){delete _0x36cbf8[_0x2096('0x25')];}_0x4d1570[_0x2096('0x1a')](_0x16829c)[_0x2096('0x26')](_0x36cbf8);};}exports[_0x2096('0x27')]=function(_0x148fae,_0x3b5c03){var _0x13b84d={},_0x395645={},_0x2fde9b={'count':0x0,'rows':[]};var _0x308979=_[_0x2096('0x28')](db[_0x2096('0x29')][_0x2096('0x2a')],function(_0x5beffc){return{'name':_0x5beffc[_0x2096('0x2b')],'type':_0x5beffc[_0x2096('0x2c')][_0x2096('0x2d')]};});_0x395645['model']=_[_0x2096('0x28')](_0x308979,'name');_0x395645[_0x2096('0x2e')]=_[_0x2096('0x2f')](_0x148fae[_0x2096('0x2e')]);_0x395645['filters']=_[_0x2096('0x30')](_0x395645[_0x2096('0x31')],_0x395645[_0x2096('0x2e')]);_0x13b84d['attributes']=_[_0x2096('0x30')](_0x395645[_0x2096('0x31')],qs[_0x2096('0x32')](_0x148fae['query'][_0x2096('0x32')]));_0x13b84d[_0x2096('0x33')]=_0x13b84d[_0x2096('0x33')][_0x2096('0x34')]?_0x13b84d[_0x2096('0x33')]:_0x395645[_0x2096('0x31')];if(!_0x148fae[_0x2096('0x2e')]['hasOwnProperty'](_0x2096('0x35'))){_0x13b84d[_0x2096('0x1f')]=qs[_0x2096('0x1f')](_0x148fae[_0x2096('0x2e')][_0x2096('0x1f')]);_0x13b84d[_0x2096('0x1e')]=qs[_0x2096('0x1e')](_0x148fae[_0x2096('0x2e')][_0x2096('0x1e')]);}_0x13b84d[_0x2096('0x36')]=qs[_0x2096('0x37')](_0x148fae[_0x2096('0x2e')]['sort']);_0x13b84d[_0x2096('0x38')]=qs[_0x2096('0x39')](_[_0x2096('0x3a')](_0x148fae['query'],_0x395645[_0x2096('0x39')]),_0x308979);if(_0x148fae[_0x2096('0x2e')][_0x2096('0x3b')]){_0x13b84d[_0x2096('0x38')]=_['merge'](_0x13b84d[_0x2096('0x38')],{'$or':_[_0x2096('0x28')](_0x308979,function(_0x24e852){if(_0x24e852[_0x2096('0x2c')]!==_0x2096('0x3c')){var _0x7279bf={};_0x7279bf[_0x24e852[_0x2096('0x25')]]={'$like':'%'+_0x148fae[_0x2096('0x2e')][_0x2096('0x3b')]+'%'};return _0x7279bf;}})});}_0x13b84d=_[_0x2096('0x3d')]({},_0x13b84d,_0x148fae[_0x2096('0x3e')]);var _0x40dee4={'where':_0x13b84d[_0x2096('0x38')]};return db[_0x2096('0x29')][_0x2096('0x1d')](_0x40dee4)[_0x2096('0x23')](function(_0x54f9cd){_0x2fde9b[_0x2096('0x1d')]=_0x54f9cd;if(_0x148fae[_0x2096('0x2e')]['includeAll']){_0x13b84d[_0x2096('0x3f')]=[{'all':!![]}];}return db[_0x2096('0x29')][_0x2096('0x40')](_0x13b84d);})[_0x2096('0x23')](function(_0x29e700){_0x2fde9b['rows']=_0x29e700;return _0x2fde9b;})[_0x2096('0x23')](respondWithFilteredResult(_0x3b5c03,_0x13b84d))[_0x2096('0x41')](handleError(_0x3b5c03,null));};exports[_0x2096('0x42')]=function(_0x3d2160,_0x3319e6){var _0x4c892d={'raw':![],'where':{'id':_0x3d2160[_0x2096('0x43')]['id']}},_0x431412={};_0x431412[_0x2096('0x31')]=_[_0x2096('0x2f')](db[_0x2096('0x29')][_0x2096('0x2a')]);_0x431412[_0x2096('0x2e')]=_[_0x2096('0x2f')](_0x3d2160[_0x2096('0x2e')]);_0x431412[_0x2096('0x39')]=_['intersection'](_0x431412['model'],_0x431412[_0x2096('0x2e')]);_0x4c892d[_0x2096('0x33')]=_[_0x2096('0x30')](_0x431412[_0x2096('0x31')],qs[_0x2096('0x32')](_0x3d2160[_0x2096('0x2e')]['fields']));_0x4c892d['attributes']=_0x4c892d['attributes']['length']?_0x4c892d[_0x2096('0x33')]:_0x431412[_0x2096('0x31')];if(_0x3d2160[_0x2096('0x2e')][_0x2096('0x44')]){_0x4c892d[_0x2096('0x3f')]=[{'all':!![]}];}_0x4c892d=_['merge']({},_0x4c892d,_0x3d2160[_0x2096('0x3e')]);return db['AnalyticFieldReport'][_0x2096('0x45')](_0x4c892d)[_0x2096('0x23')](handleEntityNotFound(_0x3319e6,null))[_0x2096('0x23')](respondWithResult(_0x3319e6,null))[_0x2096('0x41')](handleError(_0x3319e6,null));};exports[_0x2096('0x46')]=function(_0xa0a0e,_0x4f3863){return db[_0x2096('0x29')][_0x2096('0x46')](_0xa0a0e[_0x2096('0x47')],{})[_0x2096('0x23')](respondWithResult(_0x4f3863,0xc9))[_0x2096('0x41')](handleError(_0x4f3863,null));};exports[_0x2096('0x48')]=function(_0x5657e0,_0x55acf3){return db[_0x2096('0x29')][_0x2096('0x48')](_0x5657e0[_0x2096('0x47')],{'raw':![],'individualHooks':!![]})[_0x2096('0x23')](respondWithResult(_0x55acf3,0xc9))[_0x2096('0x41')](handleError(_0x55acf3,null));};exports[_0x2096('0x22')]=function(_0x9fbd3f,_0xc84c32){if(_0x9fbd3f[_0x2096('0x47')]['id']){delete _0x9fbd3f[_0x2096('0x47')]['id'];}return db['AnalyticFieldReport'][_0x2096('0x45')]({'where':{'id':_0x9fbd3f['params']['id']}})[_0x2096('0x23')](handleEntityNotFound(_0xc84c32,null))[_0x2096('0x23')](saveUpdates(_0x9fbd3f['body'],null))[_0x2096('0x23')](respondWithResult(_0xc84c32,null))['catch'](handleError(_0xc84c32,null));};exports[_0x2096('0x24')]=function(_0x2c6dfb,_0x5d5f66){return db[_0x2096('0x29')][_0x2096('0x45')]({'where':{'id':_0x2c6dfb['params']['id']}})[_0x2096('0x23')](handleEntityNotFound(_0x5d5f66,null))[_0x2096('0x23')](removeEntity(_0x5d5f66,null))['catch'](handleError(_0x5d5f66,null));};exports[_0x2096('0x49')]=function(_0x2d3b88,_0x52e963){return db[_0x2096('0x29')][_0x2096('0x24')]({'where':{'id':_0x2d3b88[_0x2096('0x2e')][_0x2096('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x2096('0x23')](respondWithResult(_0x52e963,0xcc))[_0x2096('0x41')](handleError(_0x52e963,null));};exports['addFields']=function(_0xa4317e,_0x20b062,_0x2a4098){return db[_0x2096('0x4b')][_0x2096('0x4c')]({'where':{'id':_0xa4317e[_0x2096('0x43')]['id']}})['then'](handleEntityNotFound(_0x20b062,null))['then'](function(_0x57279b){if(_0x57279b){return db['sequelize'][_0x2096('0x4d')](function(_0x4482b8){return db[_0x2096('0x29')][_0x2096('0x24')]({'where':{'CustomReportId':_0xa4317e['params']['id']},'transaction':_0x4482b8})[_0x2096('0x23')](function(_0x1c8a3c){var _0x12274f=_[_0x2096('0x28')](_0xa4317e[_0x2096('0x47')],function(_0x5dbdea){delete _0x5dbdea['id'];_0x5dbdea[_0x2096('0x4e')]=_0xa4317e['params']['id'];return _0x5dbdea;});return db['AnalyticFieldReport'][_0x2096('0x48')](_0x12274f,{'transaction':_0x4482b8});});})[_0x2096('0x23')](function(){return db[_0x2096('0x29')][_0x2096('0x40')]({'where':{'CustomReportId':_0xa4317e['params']['id']}});});}})[_0x2096('0x23')](respondWithResult(_0x20b062,null))[_0x2096('0x41')](handleError(_0x20b062,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1e8e54a..826f3fb 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 _0x068a=['util','api','moment','request-promise','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash'];(function(_0x22af6b,_0x3da4e8){var _0x3330ef=function(_0x5617d9){while(--_0x5617d9){_0x22af6b['push'](_0x22af6b['shift']());}};_0x3330ef(++_0x3da4e8);}(_0x068a,0xa9));var _0xa068=function(_0x40c2c7,_0x61d089){_0x40c2c7=_0x40c2c7-0x0;var _0x3b7316=_0x068a[_0x40c2c7];return _0x3b7316;};'use strict';var _=require(_0xa068('0x0'));var util=require(_0xa068('0x1'));var logger=require('../../config/logger')(_0xa068('0x2'));var moment=require(_0xa068('0x3'));var BPromise=require('bluebird');var rp=require(_0xa068('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa068('0x5'));var config=require('../../config/environment');var attributes=require(_0xa068('0x6'));module[_0xa068('0x7')]=function(_0x89636c,_0x45a738){return _0x89636c[_0xa068('0x8')](_0xa068('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6388=['./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x6388,0xa9));var _0x8638=function(_0x12b16b,_0x55a909){_0x12b16b=_0x12b16b-0x0;var _0x3401e6=_0x6388[_0x12b16b];return _0x3401e6;};'use strict';var _=require(_0x8638('0x0'));var util=require(_0x8638('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8638('0x2'));var rp=require(_0x8638('0x3'));var fs=require('fs');var path=require(_0x8638('0x4'));var rimraf=require(_0x8638('0x5'));var config=require(_0x8638('0x6'));var attributes=require(_0x8638('0x7'));module[_0x8638('0x8')]=function(_0x9c6344,_0x580c9e){return _0x9c6344['define'](_0x8638('0x9'),attributes,{'tableName':_0x8638('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 9ec3a00..a716757 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 _0x1f6a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','ioredis'];(function(_0x595793,_0x5a290b){var _0x17a58c=function(_0xc0fc77){while(--_0xc0fc77){_0x595793['push'](_0x595793['shift']());}};_0x17a58c(++_0x5a290b);}(_0x1f6a,0x81));var _0xa1f6=function(_0x41b369,_0x29e21f){_0x41b369=_0x41b369-0x0;var _0x2af633=_0x1f6a[_0x41b369];return _0x2af633;};'use strict';var _=require(_0xa1f6('0x0'));var util=require(_0xa1f6('0x1'));var moment=require(_0xa1f6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1f6('0x3'));var db=require(_0xa1f6('0x4'))['db'];var utils=require(_0xa1f6('0x5'));var logger=require(_0xa1f6('0x6'))(_0xa1f6('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1f6('0x8'));var client=jayson[_0xa1f6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x552d64,_0x2acd05,_0x564be1){return new BPromise(function(_0x10bca4,_0x58390d){return client['request'](_0x552d64,_0x564be1)['then'](function(_0x371591){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2acd05,_0xa1f6('0xa'));logger[_0xa1f6('0xb')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2acd05,_0xa1f6('0xa'),JSON[_0xa1f6('0xc')](_0x371591));if(_0x371591[_0xa1f6('0xd')]){if(_0x371591[_0xa1f6('0xd')][_0xa1f6('0xe')]===0x1f4){logger[_0xa1f6('0xd')](_0xa1f6('0xf'),_0x2acd05,_0x371591[_0xa1f6('0xd')][_0xa1f6('0x10')]);return _0x58390d(_0x371591['error']['message']);}logger[_0xa1f6('0xd')](_0xa1f6('0xf'),_0x2acd05,_0x371591[_0xa1f6('0xd')]['message']);return _0x10bca4(_0x371591[_0xa1f6('0xd')][_0xa1f6('0x10')]);}else{logger[_0xa1f6('0x11')](_0xa1f6('0xf'),_0x2acd05,_0xa1f6('0xa'));_0x10bca4(_0x371591['result'][_0xa1f6('0x10')]);}})[_0xa1f6('0x12')](function(_0x50ecdd){logger['error'](_0xa1f6('0xf'),_0x2acd05,_0x50ecdd);_0x58390d(_0x50ecdd);});});} \ No newline at end of file +var _0x72b3=['../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0x72b3,0x1c0));var _0x372b=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x72b3[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0x372b('0x0'));var util=require(_0x372b('0x1'));var moment=require(_0x372b('0x2'));var BPromise=require(_0x372b('0x3'));var rs=require(_0x372b('0x4'));var fs=require('fs');var Redis=require(_0x372b('0x5'));var db=require(_0x372b('0x6'))['db'];var utils=require(_0x372b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x372b('0x8'));var jayson=require(_0x372b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x491a79,_0x35363c,_0x3db14f){return new BPromise(function(_0x5b0220,_0x20fe59){return client[_0x372b('0xa')](_0x491a79,_0x3db14f)['then'](function(_0x2e4fd3){logger[_0x372b('0xb')](_0x372b('0xc'),_0x35363c,_0x372b('0xd'));logger[_0x372b('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x35363c,_0x372b('0xd'),JSON['stringify'](_0x2e4fd3));if(_0x2e4fd3[_0x372b('0xf')]){if(_0x2e4fd3[_0x372b('0xf')]['code']===0x1f4){logger[_0x372b('0xf')](_0x372b('0xc'),_0x35363c,_0x2e4fd3[_0x372b('0xf')][_0x372b('0x10')]);return _0x20fe59(_0x2e4fd3[_0x372b('0xf')][_0x372b('0x10')]);}logger['error'](_0x372b('0xc'),_0x35363c,_0x2e4fd3[_0x372b('0xf')][_0x372b('0x10')]);return _0x5b0220(_0x2e4fd3[_0x372b('0xf')]['message']);}else{logger['info'](_0x372b('0xc'),_0x35363c,_0x372b('0xd'));_0x5b0220(_0x2e4fd3[_0x372b('0x11')][_0x372b('0x10')]);}})[_0x372b('0x12')](function(_0x60b8d5){logger[_0x372b('0xf')](_0x372b('0xc'),_0x35363c,_0x60b8d5);_0x20fe59(_0x60b8d5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 697459e..d8c8f5f 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x339775,_0xae2055){var _0x4b8b42=function(_0xa37a72){while(--_0xa37a72){_0x339775['push'](_0x339775['shift']());}};_0x4b8b42(++_0xae2055);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x77ccb,_0x1ff5ee){var _0x2a7869=function(_0x36e374){while(--_0x36e374){_0x77ccb['push'](_0x77ccb['shift']());}};_0x2a7869(++_0x1ff5ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 2e7cd0f..39a2b35 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 _0xc343=['STRING','name','sequelize'];(function(_0x15b7c2,_0x46d467){var _0x3a5d5e=function(_0x14617a){while(--_0x14617a){_0x15b7c2['push'](_0x15b7c2['shift']());}};_0x3a5d5e(++_0x46d467);}(_0xc343,0x173));var _0x3c34=function(_0x480bad,_0x118d2a){_0x480bad=_0x480bad-0x0;var _0x5c694d=_0xc343[_0x480bad];return _0x5c694d;};'use strict';var Sequelize=require(_0x3c34('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c34('0x1')],'allowNull':![],'unique':_0x3c34('0x2')},'table':{'type':Sequelize[_0x3c34('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa769=['STRING','name','sequelize'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa769,0xfb));var _0x9a76=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa769[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x9a76('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a76('0x1')],'allowNull':![],'unique':_0x9a76('0x2')},'table':{'type':Sequelize[_0x9a76('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x9a76('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e39e5a1..b83c5cf 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 _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','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','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x6bccfa,_0x456bcb){var _0x1ad77b=function(_0x3b79ea){while(--_0x3b79ea){_0x6bccfa['push'](_0x6bccfa['shift']());}};_0x1ad77b(++_0x456bcb);}(_0xabce,0x103));var _0xeabc=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xabce[_0x8de54f];return _0x14cba4;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');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(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x3514fa,_0xb3a0a){var _0x1c9222=function(_0x247caa){while(--_0x247caa){_0x3514fa['push'](_0x3514fa['shift']());}};_0x1c9222(++_0xb3a0a);}(_0x24ca,0x1bc));var _0xa24c=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x24ca[_0x37c07d];return _0x10dadc;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 1775a4a..fcface3 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 _0xdb2a=['bluebird','request-promise','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb2a,0x16f));var _0xadb2=function(_0x37d10b,_0x382b7a){_0x37d10b=_0x37d10b-0x0;var _0x1fed32=_0xdb2a[_0x37d10b];return _0x1fed32;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var logger=require(_0xadb2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadb2('0x3'));var rp=require(_0xadb2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb2('0x5'));var config=require('../../config/environment');var attributes=require(_0xadb2('0x6'));module[_0xadb2('0x7')]=function(_0x1f5c7e,_0x297e69){return _0x1f5c7e[_0xadb2('0x8')]('AnalyticMetric',attributes,{'tableName':_0xadb2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa751=['analytics_metrics','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0xa751,0x175));var _0x1a75=function(_0x5affb0,_0x36501a){_0x5affb0=_0x5affb0-0x0;var _0x2bf391=_0xa751[_0x5affb0];return _0x2bf391;};'use strict';var _=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var logger=require(_0x1a75('0x2'))(_0x1a75('0x3'));var moment=require('moment');var BPromise=require(_0x1a75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x5'));var rimraf=require(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x1a75('0x8')]=function(_0x220b14,_0x1719c1){return _0x220b14[_0x1a75('0x9')](_0x1a75('0xa'),attributes,{'tableName':_0x1a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index cada113..b464fe4 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 _0x7063=['error','code','message','AnalyticMetric,\x20%s,\x20%s','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x7063,0x1e4));var _0x3706=function(_0x4c0bd5,_0xbdb1bf){_0x4c0bd5=_0x4c0bd5-0x0;var _0x5a55bc=_0x7063[_0x4c0bd5];return _0x5a55bc;};'use strict';var _=require(_0x3706('0x0'));var util=require(_0x3706('0x1'));var moment=require(_0x3706('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3706('0x3'))['db'];var utils=require(_0x3706('0x4'));var logger=require(_0x3706('0x5'))('rpc');var config=require(_0x3706('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3706('0x7')][_0x3706('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f015d,_0x304aa9,_0x1566ae){return new BPromise(function(_0xf13529,_0x51dc68){return client[_0x3706('0x9')](_0x3f015d,_0x1566ae)[_0x3706('0xa')](function(_0x4dcb82){logger[_0x3706('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x304aa9,_0x3706('0xc'));logger[_0x3706('0xd')](_0x3706('0xe'),_0x304aa9,_0x3706('0xc'),JSON[_0x3706('0xf')](_0x4dcb82));if(_0x4dcb82[_0x3706('0x10')]){if(_0x4dcb82['error'][_0x3706('0x11')]===0x1f4){logger[_0x3706('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x304aa9,_0x4dcb82[_0x3706('0x10')][_0x3706('0x12')]);return _0x51dc68(_0x4dcb82['error'][_0x3706('0x12')]);}logger[_0x3706('0x10')](_0x3706('0x13'),_0x304aa9,_0x4dcb82['error'][_0x3706('0x12')]);return _0xf13529(_0x4dcb82[_0x3706('0x10')][_0x3706('0x12')]);}else{logger[_0x3706('0xb')](_0x3706('0x13'),_0x304aa9,_0x3706('0xc'));_0xf13529(_0x4dcb82['result'][_0x3706('0x12')]);}})['catch'](function(_0x5f418a){logger['error'](_0x3706('0x13'),_0x304aa9,_0x5f418a);_0x51dc68(_0x5f418a);});});} \ No newline at end of file +var _0xd4cd=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x219065,_0x5dd293){var _0x11b4c7=function(_0x5c6662){while(--_0x5c6662){_0x219065['push'](_0x219065['shift']());}};_0x11b4c7(++_0x5dd293);}(_0xd4cd,0x110));var _0xdd4c=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xd4cd[_0x3f25b2];return _0xd8caeb;};'use strict';var _=require(_0xdd4c('0x0'));var util=require(_0xdd4c('0x1'));var moment=require(_0xdd4c('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd4c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd4c('0x5'));var config=require(_0xdd4c('0x6'));var jayson=require(_0xdd4c('0x7'));var client=jayson[_0xdd4c('0x8')][_0xdd4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10b5b0,_0x45291c,_0x4a45db){return new BPromise(function(_0xe3c10a,_0x24b856){return client[_0xdd4c('0xa')](_0x10b5b0,_0x4a45db)[_0xdd4c('0xb')](function(_0x87eb2f){logger[_0xdd4c('0xc')](_0xdd4c('0xd'),_0x45291c,_0xdd4c('0xe'));logger['debug'](_0xdd4c('0xf'),_0x45291c,_0xdd4c('0xe'),JSON[_0xdd4c('0x10')](_0x87eb2f));if(_0x87eb2f['error']){if(_0x87eb2f[_0xdd4c('0x11')][_0xdd4c('0x12')]===0x1f4){logger['error'](_0xdd4c('0xd'),_0x45291c,_0x87eb2f[_0xdd4c('0x11')][_0xdd4c('0x13')]);return _0x24b856(_0x87eb2f[_0xdd4c('0x11')]['message']);}logger[_0xdd4c('0x11')](_0xdd4c('0xd'),_0x45291c,_0x87eb2f['error'][_0xdd4c('0x13')]);return _0xe3c10a(_0x87eb2f[_0xdd4c('0x11')][_0xdd4c('0x13')]);}else{logger[_0xdd4c('0xc')](_0xdd4c('0xd'),_0x45291c,_0xdd4c('0xe'));_0xe3c10a(_0x87eb2f['result'][_0xdd4c('0x13')]);}})['catch'](function(_0x8e7464){logger[_0xdd4c('0x11')](_0xdd4c('0xd'),_0x45291c,_0x8e7464);_0x24b856(_0x8e7464);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8d89520..40c11a2 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 _0x9879=['./analyticMetric.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x171eae,_0x3f4a62){var _0x1df649=function(_0x425767){while(--_0x425767){_0x171eae['push'](_0x171eae['shift']());}};_0x1df649(++_0x3f4a62);}(_0x9879,0x98));var _0x9987=function(_0x1bf4e8,_0x583680){_0x1bf4e8=_0x1bf4e8-0x0;var _0x4c8c3a=_0x9879[_0x1bf4e8];return _0x4c8c3a;};'use strict';var multer=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var path=require(_0x9987('0x2'));var timeout=require('connect-timeout');var express=require(_0x9987('0x3'));var router=express['Router']();var fs_extra=require(_0x9987('0x4'));var auth=require(_0x9987('0x5'));var interaction=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var controller=require(_0x9987('0x8'));router[_0x9987('0x9')]('/',auth[_0x9987('0xa')](),controller['index']);router[_0x9987('0x9')]('/:id',auth[_0x9987('0xa')](),controller[_0x9987('0xb')]);router[_0x9987('0xc')]('/',auth[_0x9987('0xa')](),controller[_0x9987('0xd')]);router[_0x9987('0xe')](_0x9987('0xf'),auth[_0x9987('0xa')](),controller[_0x9987('0x10')]);router[_0x9987('0x11')](_0x9987('0xf'),auth[_0x9987('0xa')](),controller[_0x9987('0x12')]);module[_0x9987('0x13')]=router; \ No newline at end of file +var _0x6a88=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6a88,0xa9));var _0x86a8=function(_0x2c26a0,_0x2b9577){_0x2c26a0=_0x2c26a0-0x0;var _0x3e26d2=_0x6a88[_0x2c26a0];return _0x3e26d2;};'use strict';var multer=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var path=require(_0x86a8('0x2'));var timeout=require(_0x86a8('0x3'));var express=require(_0x86a8('0x4'));var router=express[_0x86a8('0x5')]();var fs_extra=require(_0x86a8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x86a8('0x7'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x86a8('0x8')]('/',auth[_0x86a8('0x9')](),controller['index']);router[_0x86a8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x86a8('0xa')]);router[_0x86a8('0xb')]('/',auth['isAuthenticated'](),controller[_0x86a8('0xc')]);router[_0x86a8('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86a8('0xe')]);router[_0x86a8('0xf')](_0x86a8('0x10'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x11')]);module[_0x86a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 0c713e6..b841427 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 _0xe8e0=['exports','TEXT','sequelize'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xe8e0,0xb9));var _0x0e8e=function(_0x3577d0,_0x25dc65){_0x3577d0=_0x3577d0-0x0;var _0x5aecd1=_0xe8e0[_0x3577d0];return _0x5aecd1;};'use strict';var Sequelize=require(_0x0e8e('0x0'));module[_0x0e8e('0x1')]={'tree':{'type':Sequelize[_0x0e8e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf839=['TEXT','sequelize','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf839,0x9a));var _0x9f83=function(_0x2b55b8,_0x59bc1){_0x2b55b8=_0x2b55b8-0x0;var _0x3da2a5=_0xf839[_0x2b55b8];return _0x3da2a5;};'use strict';var Sequelize=require(_0x9f83('0x0'));module[_0x9f83('0x1')]={'tree':{'type':Sequelize[_0x9f83('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 2e1cc8c..4b09281 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 _0x713a=['rows','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','options','include','findAll'];(function(_0x5c9b36,_0x120079){var _0x47e999=function(_0x33d1ce){while(--_0x33d1ce){_0x5c9b36['push'](_0x5c9b36['shift']());}};_0x47e999(++_0x120079);}(_0x713a,0x97));var _0xa713=function(_0x1f2a53,_0x2d5da9){_0x1f2a53=_0x1f2a53-0x0;var _0x38b369=_0x713a[_0x1f2a53];return _0x38b369;};'use strict';var emlformat=require(_0xa713('0x0'));var rimraf=require(_0xa713('0x1'));var zipdir=require(_0xa713('0x2'));var jsonpatch=require(_0xa713('0x3'));var rp=require(_0xa713('0x4'));var moment=require(_0xa713('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa713('0x6'));var util=require(_0xa713('0x7'));var path=require(_0xa713('0x8'));var sox=require(_0xa713('0x9'));var csv=require(_0xa713('0xa'));var ejs=require(_0xa713('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa713('0xc'));var squel=require(_0xa713('0xd'));var crypto=require(_0xa713('0xe'));var jsforce=require(_0xa713('0xf'));var deskjs=require(_0xa713('0x10'));var toCsv=require(_0xa713('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa713('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa713('0x12'));var as=require(_0xa713('0x13'));var hardwareService=require(_0xa713('0x14'));var logger=require(_0xa713('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa713('0x16'));var db=require(_0xa713('0x17'))['db'];function respondWithStatusCode(_0x393405,_0x48047e){_0x48047e=_0x48047e||0xcc;return function(_0x529b8b){if(_0x529b8b){return _0x393405['sendStatus'](_0x48047e);}return _0x393405['status'](_0x48047e)['end']();};}function respondWithResult(_0x452316,_0x485162){_0x485162=_0x485162||0xc8;return function(_0x3aad71){if(_0x3aad71){return _0x452316[_0xa713('0x18')](_0x485162)['json'](_0x3aad71);}};}function respondWithFilteredResult(_0x36ba3,_0x416e9a){return function(_0x318bb1){if(_0x318bb1){var _0x4b023a=typeof _0x416e9a['offset']===_0xa713('0x19')&&typeof _0x416e9a[_0xa713('0x1a')]===_0xa713('0x19');var _0x170c40=_0x318bb1[_0xa713('0x1b')];var _0x3ffe93=_0x4b023a?0x0:_0x416e9a[_0xa713('0x1c')];var _0xd023d6=_0x4b023a?_0x318bb1[_0xa713('0x1b')]:_0x416e9a[_0xa713('0x1c')]+_0x416e9a[_0xa713('0x1a')];var _0x5b5437;if(_0xd023d6>=_0x170c40){_0xd023d6=_0x170c40;_0x5b5437=0xc8;}else{_0x5b5437=0xce;}_0x36ba3['status'](_0x5b5437);return _0x36ba3[_0xa713('0x1d')](_0xa713('0x1e'),_0x3ffe93+'-'+_0xd023d6+'/'+_0x170c40)[_0xa713('0x1f')](_0x318bb1);}return null;};}function patchUpdates(_0x5ce956){return function(_0x477fa1){try{jsonpatch['apply'](_0x477fa1,_0x5ce956,!![]);}catch(_0x34cb31){return BPromise[_0xa713('0x20')](_0x34cb31);}return _0x477fa1['save']();};}function saveUpdates(_0x55d068,_0x1c5382){return function(_0x3ca165){if(_0x3ca165){return _0x3ca165[_0xa713('0x21')](_0x55d068)[_0xa713('0x22')](function(_0x146277){return _0x146277;});}return null;};}function removeEntity(_0x5308b9,_0x1dbb09){return function(_0x3d1239){if(_0x3d1239){return _0x3d1239['destroy']()[_0xa713('0x22')](function(){_0x5308b9[_0xa713('0x18')](0xcc)[_0xa713('0x23')]();});}};}function handleEntityNotFound(_0x25bf6e,_0x406d8c){return function(_0x15f9bb){if(!_0x15f9bb){_0x25bf6e[_0xa713('0x24')](0x194);}return _0x15f9bb;};}function handleError(_0x44f7f1,_0x3d4ffe){_0x3d4ffe=_0x3d4ffe||0x1f4;return function(_0x466ef3){logger[_0xa713('0x25')](_0x466ef3[_0xa713('0x26')]);if(_0x466ef3[_0xa713('0x27')]){delete _0x466ef3[_0xa713('0x27')];}_0x44f7f1[_0xa713('0x18')](_0x3d4ffe)[_0xa713('0x28')](_0x466ef3);};}exports[_0xa713('0x29')]=function(_0x12d967,_0x543ab8){var _0x4c582d={},_0x158f68={},_0x6c2e96={'count':0x0,'rows':[]};var _0x51ee13=_[_0xa713('0x2a')](db[_0xa713('0x2b')][_0xa713('0x2c')],function(_0x2388bd){return{'name':_0x2388bd[_0xa713('0x2d')],'type':_0x2388bd['type'][_0xa713('0x2e')]};});_0x158f68[_0xa713('0x2f')]=_[_0xa713('0x2a')](_0x51ee13,_0xa713('0x27'));_0x158f68[_0xa713('0x30')]=_[_0xa713('0x31')](_0x12d967['query']);_0x158f68[_0xa713('0x32')]=_[_0xa713('0x33')](_0x158f68[_0xa713('0x2f')],_0x158f68['query']);_0x4c582d[_0xa713('0x34')]=_[_0xa713('0x33')](_0x158f68[_0xa713('0x2f')],qs[_0xa713('0x35')](_0x12d967[_0xa713('0x30')][_0xa713('0x35')]));_0x4c582d[_0xa713('0x34')]=_0x4c582d[_0xa713('0x34')][_0xa713('0x36')]?_0x4c582d[_0xa713('0x34')]:_0x158f68[_0xa713('0x2f')];if(!_0x12d967[_0xa713('0x30')][_0xa713('0x37')](_0xa713('0x38'))){_0x4c582d[_0xa713('0x1a')]=qs[_0xa713('0x1a')](_0x12d967[_0xa713('0x30')][_0xa713('0x1a')]);_0x4c582d[_0xa713('0x1c')]=qs[_0xa713('0x1c')](_0x12d967[_0xa713('0x30')][_0xa713('0x1c')]);}_0x4c582d['order']=qs['sort'](_0x12d967['query']['sort']);_0x4c582d[_0xa713('0x39')]=qs[_0xa713('0x32')](_[_0xa713('0x3a')](_0x12d967[_0xa713('0x30')],_0x158f68[_0xa713('0x32')]),_0x51ee13);if(_0x12d967['query'][_0xa713('0x3b')]){_0x4c582d[_0xa713('0x39')]=_[_0xa713('0x3c')](_0x4c582d[_0xa713('0x39')],{'$or':_['map'](_0x51ee13,function(_0x24d9ae){if(_0x24d9ae[_0xa713('0x3d')]!=='VIRTUAL'){var _0x3ea209={};_0x3ea209[_0x24d9ae[_0xa713('0x27')]]={'$like':'%'+_0x12d967[_0xa713('0x30')][_0xa713('0x3b')]+'%'};return _0x3ea209;}})});}_0x4c582d=_[_0xa713('0x3c')]({},_0x4c582d,_0x12d967[_0xa713('0x3e')]);var _0x58b2e2={'where':_0x4c582d[_0xa713('0x39')]};return db['AnalyticTreeReport'][_0xa713('0x1b')](_0x58b2e2)[_0xa713('0x22')](function(_0x15b078){_0x6c2e96[_0xa713('0x1b')]=_0x15b078;if(_0x12d967[_0xa713('0x30')]['includeAll']){_0x4c582d[_0xa713('0x3f')]=[{'all':!![]}];}return db[_0xa713('0x2b')][_0xa713('0x40')](_0x4c582d);})[_0xa713('0x22')](function(_0x2fd2d6){_0x6c2e96[_0xa713('0x41')]=_0x2fd2d6;return _0x6c2e96;})[_0xa713('0x22')](respondWithFilteredResult(_0x543ab8,_0x4c582d))['catch'](handleError(_0x543ab8,null));};exports['show']=function(_0xd6c972,_0x5832f0){var _0x1f31f6={'raw':!![],'where':{'id':_0xd6c972[_0xa713('0x42')]['id']}},_0x1f7f6f={};_0x1f7f6f[_0xa713('0x2f')]=_[_0xa713('0x31')](db[_0xa713('0x2b')][_0xa713('0x2c')]);_0x1f7f6f['query']=_['keys'](_0xd6c972[_0xa713('0x30')]);_0x1f7f6f[_0xa713('0x32')]=_[_0xa713('0x33')](_0x1f7f6f[_0xa713('0x2f')],_0x1f7f6f[_0xa713('0x30')]);_0x1f31f6[_0xa713('0x34')]=_[_0xa713('0x33')](_0x1f7f6f['model'],qs['fields'](_0xd6c972[_0xa713('0x30')][_0xa713('0x35')]));_0x1f31f6['attributes']=_0x1f31f6['attributes']['length']?_0x1f31f6[_0xa713('0x34')]:_0x1f7f6f['model'];if(_0xd6c972[_0xa713('0x30')][_0xa713('0x43')]){_0x1f31f6[_0xa713('0x3f')]=[{'all':!![]}];}_0x1f31f6=_[_0xa713('0x3c')]({},_0x1f31f6,_0xd6c972[_0xa713('0x3e')]);return db['AnalyticTreeReport'][_0xa713('0x44')](_0x1f31f6)[_0xa713('0x22')](handleEntityNotFound(_0x5832f0,null))[_0xa713('0x22')](respondWithResult(_0x5832f0,null))[_0xa713('0x45')](handleError(_0x5832f0,null));};exports[_0xa713('0x46')]=function(_0x21fea8,_0x400079){return db[_0xa713('0x2b')][_0xa713('0x46')](_0x21fea8[_0xa713('0x47')],{})[_0xa713('0x22')](respondWithResult(_0x400079,0xc9))[_0xa713('0x45')](handleError(_0x400079,null));};exports['update']=function(_0x3b3874,_0x3ce607){if(_0x3b3874[_0xa713('0x47')]['id']){delete _0x3b3874[_0xa713('0x47')]['id'];}return db[_0xa713('0x2b')][_0xa713('0x44')]({'where':{'id':_0x3b3874['params']['id']}})['then'](handleEntityNotFound(_0x3ce607,null))[_0xa713('0x22')](saveUpdates(_0x3b3874['body'],null))['then'](respondWithResult(_0x3ce607,null))[_0xa713('0x45')](handleError(_0x3ce607,null));};exports['destroy']=function(_0x14473d,_0x26791b){return db[_0xa713('0x2b')][_0xa713('0x44')]({'where':{'id':_0x14473d[_0xa713('0x42')]['id']}})[_0xa713('0x22')](handleEntityNotFound(_0x26791b,null))[_0xa713('0x22')](removeEntity(_0x26791b,null))['catch'](handleError(_0x26791b,null));}; \ No newline at end of file +var _0x3cfc=['VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','update','destroy','then','error','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','map'];(function(_0x28168c,_0x426c46){var _0x590141=function(_0x2a4639){while(--_0x2a4639){_0x28168c['push'](_0x28168c['shift']());}};_0x590141(++_0x426c46);}(_0x3cfc,0x11c));var _0xc3cf=function(_0x5af488,_0x5a7edf){_0x5af488=_0x5af488-0x0;var _0x1bf2f2=_0x3cfc[_0x5af488];return _0x1bf2f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3cf('0x0'));var jsonpatch=require(_0xc3cf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3cf('0x2'));var Mustache=require(_0xc3cf('0x3'));var util=require(_0xc3cf('0x4'));var path=require(_0xc3cf('0x5'));var sox=require('sox');var csv=require(_0xc3cf('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3cf('0x7'));var _=require(_0xc3cf('0x8'));var squel=require(_0xc3cf('0x9'));var crypto=require(_0xc3cf('0xa'));var jsforce=require(_0xc3cf('0xb'));var deskjs=require(_0xc3cf('0xc'));var toCsv=require(_0xc3cf('0x6'));var querystring=require(_0xc3cf('0xd'));var Papa=require('papaparse');var Redis=require(_0xc3cf('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc3cf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3cf('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc3cf('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3cf('0x12'))['db'];function respondWithStatusCode(_0x506373,_0x54d2cb){_0x54d2cb=_0x54d2cb||0xcc;return function(_0x2d6ad3){if(_0x2d6ad3){return _0x506373[_0xc3cf('0x13')](_0x54d2cb);}return _0x506373['status'](_0x54d2cb)[_0xc3cf('0x14')]();};}function respondWithResult(_0x187ce3,_0x4e327a){_0x4e327a=_0x4e327a||0xc8;return function(_0x31772f){if(_0x31772f){return _0x187ce3[_0xc3cf('0x15')](_0x4e327a)[_0xc3cf('0x16')](_0x31772f);}};}function respondWithFilteredResult(_0x1a0721,_0xc317e1){return function(_0xfe60f2){if(_0xfe60f2){var _0x44e6b6=typeof _0xc317e1[_0xc3cf('0x17')]===_0xc3cf('0x18')&&typeof _0xc317e1['limit']===_0xc3cf('0x18');var _0x3fbcfb=_0xfe60f2[_0xc3cf('0x19')];var _0x377815=_0x44e6b6?0x0:_0xc317e1[_0xc3cf('0x17')];var _0x156ffb=_0x44e6b6?_0xfe60f2[_0xc3cf('0x19')]:_0xc317e1[_0xc3cf('0x17')]+_0xc317e1['limit'];var _0x169946;if(_0x156ffb>=_0x3fbcfb){_0x156ffb=_0x3fbcfb;_0x169946=0xc8;}else{_0x169946=0xce;}_0x1a0721[_0xc3cf('0x15')](_0x169946);return _0x1a0721[_0xc3cf('0x1a')](_0xc3cf('0x1b'),_0x377815+'-'+_0x156ffb+'/'+_0x3fbcfb)[_0xc3cf('0x16')](_0xfe60f2);}return null;};}function patchUpdates(_0xa9949e){return function(_0x2f8639){try{jsonpatch['apply'](_0x2f8639,_0xa9949e,!![]);}catch(_0x1dda92){return BPromise[_0xc3cf('0x1c')](_0x1dda92);}return _0x2f8639['save']();};}function saveUpdates(_0x5cabfe,_0x30efc1){return function(_0x1d7242){if(_0x1d7242){return _0x1d7242[_0xc3cf('0x1d')](_0x5cabfe)['then'](function(_0x417a74){return _0x417a74;});}return null;};}function removeEntity(_0x4a1ab4,_0x20f691){return function(_0x4e31b6){if(_0x4e31b6){return _0x4e31b6[_0xc3cf('0x1e')]()[_0xc3cf('0x1f')](function(){_0x4a1ab4['status'](0xcc)[_0xc3cf('0x14')]();});}};}function handleEntityNotFound(_0x4d9f34,_0x3ff05a){return function(_0x18b9fe){if(!_0x18b9fe){_0x4d9f34['sendStatus'](0x194);}return _0x18b9fe;};}function handleError(_0x39fac3,_0x3798e2){_0x3798e2=_0x3798e2||0x1f4;return function(_0x2e9098){logger[_0xc3cf('0x20')](_0x2e9098['stack']);if(_0x2e9098[_0xc3cf('0x21')]){delete _0x2e9098[_0xc3cf('0x21')];}_0x39fac3[_0xc3cf('0x15')](_0x3798e2)[_0xc3cf('0x22')](_0x2e9098);};}exports[_0xc3cf('0x23')]=function(_0x5c073c,_0x1db264){var _0x4ebd3c={},_0x2b1bca={},_0x1b3dc5={'count':0x0,'rows':[]};var _0x40df6c=_['map'](db[_0xc3cf('0x24')][_0xc3cf('0x25')],function(_0x5523ee){return{'name':_0x5523ee[_0xc3cf('0x26')],'type':_0x5523ee[_0xc3cf('0x27')]['key']};});_0x2b1bca[_0xc3cf('0x28')]=_['map'](_0x40df6c,_0xc3cf('0x21'));_0x2b1bca[_0xc3cf('0x29')]=_[_0xc3cf('0x2a')](_0x5c073c[_0xc3cf('0x29')]);_0x2b1bca[_0xc3cf('0x2b')]=_[_0xc3cf('0x2c')](_0x2b1bca['model'],_0x2b1bca['query']);_0x4ebd3c[_0xc3cf('0x2d')]=_['intersection'](_0x2b1bca[_0xc3cf('0x28')],qs[_0xc3cf('0x2e')](_0x5c073c['query'][_0xc3cf('0x2e')]));_0x4ebd3c[_0xc3cf('0x2d')]=_0x4ebd3c[_0xc3cf('0x2d')]['length']?_0x4ebd3c[_0xc3cf('0x2d')]:_0x2b1bca[_0xc3cf('0x28')];if(!_0x5c073c[_0xc3cf('0x29')][_0xc3cf('0x2f')](_0xc3cf('0x30'))){_0x4ebd3c[_0xc3cf('0x31')]=qs[_0xc3cf('0x31')](_0x5c073c[_0xc3cf('0x29')][_0xc3cf('0x31')]);_0x4ebd3c[_0xc3cf('0x17')]=qs[_0xc3cf('0x17')](_0x5c073c['query'][_0xc3cf('0x17')]);}_0x4ebd3c[_0xc3cf('0x32')]=qs[_0xc3cf('0x33')](_0x5c073c[_0xc3cf('0x29')][_0xc3cf('0x33')]);_0x4ebd3c['where']=qs['filters'](_['pick'](_0x5c073c[_0xc3cf('0x29')],_0x2b1bca['filters']),_0x40df6c);if(_0x5c073c['query'][_0xc3cf('0x34')]){_0x4ebd3c[_0xc3cf('0x35')]=_[_0xc3cf('0x36')](_0x4ebd3c['where'],{'$or':_[_0xc3cf('0x37')](_0x40df6c,function(_0x21a206){if(_0x21a206['type']!==_0xc3cf('0x38')){var _0x36ddb5={};_0x36ddb5[_0x21a206[_0xc3cf('0x21')]]={'$like':'%'+_0x5c073c[_0xc3cf('0x29')][_0xc3cf('0x34')]+'%'};return _0x36ddb5;}})});}_0x4ebd3c=_[_0xc3cf('0x36')]({},_0x4ebd3c,_0x5c073c[_0xc3cf('0x39')]);var _0x1575ff={'where':_0x4ebd3c[_0xc3cf('0x35')]};return db[_0xc3cf('0x24')][_0xc3cf('0x19')](_0x1575ff)[_0xc3cf('0x1f')](function(_0x3fd6fa){_0x1b3dc5[_0xc3cf('0x19')]=_0x3fd6fa;if(_0x5c073c[_0xc3cf('0x29')][_0xc3cf('0x3a')]){_0x4ebd3c[_0xc3cf('0x3b')]=[{'all':!![]}];}return db[_0xc3cf('0x24')]['findAll'](_0x4ebd3c);})[_0xc3cf('0x1f')](function(_0x1e814a){_0x1b3dc5[_0xc3cf('0x3c')]=_0x1e814a;return _0x1b3dc5;})['then'](respondWithFilteredResult(_0x1db264,_0x4ebd3c))['catch'](handleError(_0x1db264,null));};exports[_0xc3cf('0x3d')]=function(_0x202957,_0x5177dd){var _0x53e1b0={'raw':!![],'where':{'id':_0x202957[_0xc3cf('0x3e')]['id']}},_0x275a34={};_0x275a34[_0xc3cf('0x28')]=_[_0xc3cf('0x2a')](db[_0xc3cf('0x24')]['rawAttributes']);_0x275a34[_0xc3cf('0x29')]=_[_0xc3cf('0x2a')](_0x202957[_0xc3cf('0x29')]);_0x275a34[_0xc3cf('0x2b')]=_[_0xc3cf('0x2c')](_0x275a34[_0xc3cf('0x28')],_0x275a34[_0xc3cf('0x29')]);_0x53e1b0[_0xc3cf('0x2d')]=_[_0xc3cf('0x2c')](_0x275a34[_0xc3cf('0x28')],qs[_0xc3cf('0x2e')](_0x202957['query'][_0xc3cf('0x2e')]));_0x53e1b0[_0xc3cf('0x2d')]=_0x53e1b0[_0xc3cf('0x2d')][_0xc3cf('0x3f')]?_0x53e1b0[_0xc3cf('0x2d')]:_0x275a34['model'];if(_0x202957[_0xc3cf('0x29')][_0xc3cf('0x3a')]){_0x53e1b0['include']=[{'all':!![]}];}_0x53e1b0=_['merge']({},_0x53e1b0,_0x202957[_0xc3cf('0x39')]);return db[_0xc3cf('0x24')][_0xc3cf('0x40')](_0x53e1b0)[_0xc3cf('0x1f')](handleEntityNotFound(_0x5177dd,null))['then'](respondWithResult(_0x5177dd,null))[_0xc3cf('0x41')](handleError(_0x5177dd,null));};exports['create']=function(_0x2b5f06,_0x34606e){return db[_0xc3cf('0x24')][_0xc3cf('0x42')](_0x2b5f06[_0xc3cf('0x43')],{})[_0xc3cf('0x1f')](respondWithResult(_0x34606e,0xc9))[_0xc3cf('0x41')](handleError(_0x34606e,null));};exports[_0xc3cf('0x1d')]=function(_0x25a2ad,_0x309696){if(_0x25a2ad[_0xc3cf('0x43')]['id']){delete _0x25a2ad[_0xc3cf('0x43')]['id'];}return db[_0xc3cf('0x24')][_0xc3cf('0x40')]({'where':{'id':_0x25a2ad['params']['id']}})[_0xc3cf('0x1f')](handleEntityNotFound(_0x309696,null))[_0xc3cf('0x1f')](saveUpdates(_0x25a2ad['body'],null))[_0xc3cf('0x1f')](respondWithResult(_0x309696,null))[_0xc3cf('0x41')](handleError(_0x309696,null));};exports[_0xc3cf('0x1e')]=function(_0x773234,_0x5186fc){return db['AnalyticTreeReport'][_0xc3cf('0x40')]({'where':{'id':_0x773234['params']['id']}})[_0xc3cf('0x1f')](handleEntityNotFound(_0x5186fc,null))[_0xc3cf('0x1f')](removeEntity(_0x5186fc,null))[_0xc3cf('0x41')](handleError(_0x5186fc,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3969a41..280a26a 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 _0x0f1f=['analytics_report_trees','lodash','moment','bluebird','request-promise','rimraf','AnalyticTreeReport'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x0f1f,0x1eb));var _0xf0f1=function(_0x401100,_0x55fd7d){_0x401100=_0x401100-0x0;var _0xaeb83e=_0x0f1f[_0x401100];return _0xaeb83e;};'use strict';var _=require(_0xf0f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf0f1('0x1'));var BPromise=require(_0xf0f1('0x2'));var rp=require(_0xf0f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0f1('0x4'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0xebb531,_0x51abd0){return _0xebb531['define'](_0xf0f1('0x5'),attributes,{'tableName':_0xf0f1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd16=['moment','bluebird','request-promise','path','../../config/environment','define','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0xbd16,0xc2));var _0x6bd1=function(_0x2a2c72,_0x3f5a4a){_0x2a2c72=_0x2a2c72-0x0;var _0x354f0e=_0xbd16[_0x2a2c72];return _0x354f0e;};'use strict';var _=require(_0x6bd1('0x0'));var util=require(_0x6bd1('0x1'));var logger=require(_0x6bd1('0x2'))(_0x6bd1('0x3'));var moment=require(_0x6bd1('0x4'));var BPromise=require(_0x6bd1('0x5'));var rp=require(_0x6bd1('0x6'));var fs=require('fs');var path=require(_0x6bd1('0x7'));var rimraf=require('rimraf');var config=require(_0x6bd1('0x8'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1693d5,_0x26fb01){return _0x1693d5[_0x6bd1('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x6bd1('0xa'),'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 a102ba7..857e1b0 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3c7056,_0x4fc530){var _0x4f9b36=function(_0x108f78){while(--_0x108f78){_0x3c7056['push'](_0x3c7056['shift']());}};_0x4f9b36(++_0x4fc530);}(_0x2ef3,0xba));var _0x32ef=function(_0x3efc38,_0x4a1948){_0x3efc38=_0x3efc38-0x0;var _0x57df80=_0x2ef3[_0x3efc38];return _0x57df80;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xadb5,0xad));var _0x5adb=function(_0x5dcbf3,_0xfbebb9){_0x5dcbf3=_0x5dcbf3-0x0;var _0x37cd27=_0xadb5[_0x5dcbf3];return _0x37cd27;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 7e981e7..c810899 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 _0x6de2=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x10dbab,_0x2e8174){var _0x408bfe=function(_0x4bca15){while(--_0x4bca15){_0x10dbab['push'](_0x10dbab['shift']());}};_0x408bfe(++_0x2e8174);}(_0x6de2,0xd3));var _0x26de=function(_0xbc1e06,_0xec7fb0){_0xbc1e06=_0xbc1e06-0x0;var _0x5e2079=_0x6de2[_0xbc1e06];return _0x5e2079;};'use strict';var multer=require(_0x26de('0x0'));var util=require('util');var path=require(_0x26de('0x1'));var timeout=require(_0x26de('0x2'));var express=require(_0x26de('0x3'));var router=express[_0x26de('0x4')]();var fs_extra=require(_0x26de('0x5'));var auth=require(_0x26de('0x6'));var interaction=require(_0x26de('0x7'));var config=require('../../config/environment');var controller=require(_0x26de('0x8'));router[_0x26de('0x9')]('/',auth[_0x26de('0xa')](),controller['index']);router[_0x26de('0x9')](_0x26de('0xb'),auth[_0x26de('0xa')](),controller['show']);router[_0x26de('0xc')]('/',auth[_0x26de('0xa')](),controller[_0x26de('0xd')]);router[_0x26de('0xe')](_0x26de('0xb'),auth['isAuthenticated'](),controller[_0x26de('0xf')]);router[_0x26de('0x10')](_0x26de('0xb'),auth[_0x26de('0xa')](),controller['destroy']);module[_0x26de('0x11')]=router; \ No newline at end of file +var _0x69e5=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','index','get','/:id','isAuthenticated','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1c1c5e,_0x270b07){var _0x236279=function(_0x331dda){while(--_0x331dda){_0x1c1c5e['push'](_0x1c1c5e['shift']());}};_0x236279(++_0x270b07);}(_0x69e5,0x1d8));var _0x569e=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x69e5[_0x3b594b];return _0x1ea5f8;};'use strict';var multer=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var path=require(_0x569e('0x2'));var timeout=require(_0x569e('0x3'));var express=require(_0x569e('0x4'));var router=express[_0x569e('0x5')]();var fs_extra=require(_0x569e('0x6'));var auth=require(_0x569e('0x7'));var interaction=require(_0x569e('0x8'));var config=require(_0x569e('0x9'));var controller=require(_0x569e('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x569e('0xb')]);router[_0x569e('0xc')](_0x569e('0xd'),auth[_0x569e('0xe')](),controller['show']);router[_0x569e('0xf')]('/',auth[_0x569e('0xe')](),controller[_0x569e('0x10')]);router['put'](_0x569e('0xd'),auth[_0x569e('0xe')](),controller[_0x569e('0x11')]);router[_0x569e('0x12')]('/:id',auth[_0x569e('0xe')](),controller[_0x569e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a9d1c39..8ec1310 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 _0x65f4=['STRING'];(function(_0x59cafe,_0x5a930b){var _0x378c62=function(_0x4d41e8){while(--_0x4d41e8){_0x59cafe['push'](_0x59cafe['shift']());}};_0x378c62(++_0x5a930b);}(_0x65f4,0x19a));var _0x465f=function(_0x13f25a,_0x429fad){_0x13f25a=_0x13f25a-0x0;var _0xd22b3e=_0x65f4[_0x13f25a];return _0xd22b3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x465f('0x0')]},'basename':{'type':Sequelize[_0x465f('0x0')]},'type':{'type':Sequelize[_0x465f('0x0')]}}; \ No newline at end of file +var _0xcabc=['exports','STRING'];(function(_0x4b13ce,_0x339cb0){var _0x427d4b=function(_0x26aaad){while(--_0x26aaad){_0x4b13ce['push'](_0x4b13ce['shift']());}};_0x427d4b(++_0x339cb0);}(_0xcabc,0x16a));var _0xccab=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcabc[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'name':{'type':Sequelize[_0xccab('0x1')]},'basename':{'type':Sequelize[_0xccab('0x1')]},'type':{'type':Sequelize[_0xccab('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ef8c3e0..3d0207c 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 _0x06bc=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','name','fieldName','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','merge','includeAll','include','Attachment','findAll','rows','catch','params','length','find','clone','options','get','omit','createdAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x561f40,_0x22bc3e){var _0x52ba0c=function(_0x413519){while(--_0x413519){_0x561f40['push'](_0x561f40['shift']());}};_0x52ba0c(++_0x22bc3e);}(_0x06bc,0x96));var _0xc06b=function(_0x2f00bd,_0x47ca41){_0x2f00bd=_0x2f00bd-0x0;var _0x1dbc01=_0x06bc[_0x2f00bd];return _0x1dbc01;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc06b('0x0'));var jsonpatch=require(_0xc06b('0x1'));var rp=require(_0xc06b('0x2'));var moment=require(_0xc06b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc06b('0x4'));var util=require(_0xc06b('0x5'));var path=require(_0xc06b('0x6'));var sox=require(_0xc06b('0x7'));var csv=require(_0xc06b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc06b('0x9'));var _=require(_0xc06b('0xa'));var squel=require('squel');var crypto=require(_0xc06b('0xb'));var jsforce=require(_0xc06b('0xc'));var deskjs=require(_0xc06b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc06b('0xe'));var Papa=require(_0xc06b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc06b('0x10'));var as=require(_0xc06b('0x11'));var hardwareService=require(_0xc06b('0x12'));var logger=require(_0xc06b('0x13'))(_0xc06b('0x14'));var utils=require(_0xc06b('0x15'));var config=require(_0xc06b('0x16'));var licenseUtil=require(_0xc06b('0x17'));var db=require(_0xc06b('0x18'))['db'];function respondWithStatusCode(_0x3c007f,_0x5b226c){_0x5b226c=_0x5b226c||0xcc;return function(_0x36e6f7){if(_0x36e6f7){return _0x3c007f[_0xc06b('0x19')](_0x5b226c);}return _0x3c007f[_0xc06b('0x1a')](_0x5b226c)[_0xc06b('0x1b')]();};}function respondWithResult(_0xbef10e,_0x15ae86){_0x15ae86=_0x15ae86||0xc8;return function(_0xaf9dc9){if(_0xaf9dc9){return _0xbef10e['status'](_0x15ae86)[_0xc06b('0x1c')](_0xaf9dc9);}};}function respondWithFilteredResult(_0x5516c1,_0x2ac1da){return function(_0x23e520){if(_0x23e520){var _0x52f566=typeof _0x2ac1da[_0xc06b('0x1d')]===_0xc06b('0x1e')&&typeof _0x2ac1da['limit']===_0xc06b('0x1e');var _0x4ac034=_0x23e520['count'];var _0x2ef698=_0x52f566?0x0:_0x2ac1da[_0xc06b('0x1d')];var _0x392ce3=_0x52f566?_0x23e520[_0xc06b('0x1f')]:_0x2ac1da[_0xc06b('0x1d')]+_0x2ac1da[_0xc06b('0x20')];var _0x829a61;if(_0x392ce3>=_0x4ac034){_0x392ce3=_0x4ac034;_0x829a61=0xc8;}else{_0x829a61=0xce;}_0x5516c1[_0xc06b('0x1a')](_0x829a61);return _0x5516c1[_0xc06b('0x21')]('Content-Range',_0x2ef698+'-'+_0x392ce3+'/'+_0x4ac034)[_0xc06b('0x1c')](_0x23e520);}return null;};}function patchUpdates(_0x28b1d9){return function(_0x1906d5){try{jsonpatch['apply'](_0x1906d5,_0x28b1d9,!![]);}catch(_0x49e328){return BPromise[_0xc06b('0x22')](_0x49e328);}return _0x1906d5[_0xc06b('0x23')]();};}function saveUpdates(_0x5aa864,_0x4890ca){return function(_0x3eeebb){if(_0x3eeebb){return _0x3eeebb[_0xc06b('0x24')](_0x5aa864)[_0xc06b('0x25')](function(_0x6f0364){return _0x6f0364;});}return null;};}function removeEntity(_0x286f9d,_0x336af6){return function(_0x48f8d0){if(_0x48f8d0){return _0x48f8d0[_0xc06b('0x26')]()[_0xc06b('0x25')](function(){_0x286f9d[_0xc06b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3266b1,_0x5ea256){return function(_0x3b7b1e){if(!_0x3b7b1e){_0x3266b1[_0xc06b('0x19')](0x194);}return _0x3b7b1e;};}function handleError(_0x1d42c4,_0x17fb91){_0x17fb91=_0x17fb91||0x1f4;return function(_0x1db002){logger[_0xc06b('0x27')](_0x1db002['stack']);if(_0x1db002[_0xc06b('0x28')]){delete _0x1db002['name'];}_0x1d42c4['status'](_0x17fb91)['send'](_0x1db002);};}exports['index']=function(_0x54b05c,_0x2bb8c3){var _0x12fa27={},_0x14f6c6={},_0x13be76={'count':0x0,'rows':[]};var _0xb8069e=_['map'](db['Attachment']['rawAttributes'],function(_0x197f11){return{'name':_0x197f11[_0xc06b('0x29')],'type':_0x197f11['type']['key']};});_0x14f6c6[_0xc06b('0x2a')]=_[_0xc06b('0x2b')](_0xb8069e,_0xc06b('0x28'));_0x14f6c6[_0xc06b('0x2c')]=_[_0xc06b('0x2d')](_0x54b05c[_0xc06b('0x2c')]);_0x14f6c6[_0xc06b('0x2e')]=_[_0xc06b('0x2f')](_0x14f6c6[_0xc06b('0x2a')],_0x14f6c6[_0xc06b('0x2c')]);_0x12fa27[_0xc06b('0x30')]=_[_0xc06b('0x2f')](_0x14f6c6[_0xc06b('0x2a')],qs[_0xc06b('0x31')](_0x54b05c[_0xc06b('0x2c')][_0xc06b('0x31')]));_0x12fa27[_0xc06b('0x30')]=_0x12fa27['attributes']['length']?_0x12fa27[_0xc06b('0x30')]:_0x14f6c6['model'];if(!_0x54b05c[_0xc06b('0x2c')]['hasOwnProperty'](_0xc06b('0x32'))){_0x12fa27['limit']=qs[_0xc06b('0x20')](_0x54b05c[_0xc06b('0x2c')][_0xc06b('0x20')]);_0x12fa27['offset']=qs[_0xc06b('0x1d')](_0x54b05c['query'][_0xc06b('0x1d')]);}_0x12fa27[_0xc06b('0x33')]=qs['sort'](_0x54b05c[_0xc06b('0x2c')][_0xc06b('0x34')]);_0x12fa27[_0xc06b('0x35')]=qs[_0xc06b('0x2e')](_[_0xc06b('0x36')](_0x54b05c[_0xc06b('0x2c')],_0x14f6c6[_0xc06b('0x2e')]),_0xb8069e);if(_0x54b05c[_0xc06b('0x2c')]['filter']){_0x12fa27['where']=_['merge'](_0x12fa27['where'],{'$or':_[_0xc06b('0x2b')](_0xb8069e,function(_0x4c1eb9){if(_0x4c1eb9[_0xc06b('0x37')]!==_0xc06b('0x38')){var _0x1ded92={};_0x1ded92[_0x4c1eb9['name']]={'$like':'%'+_0x54b05c[_0xc06b('0x2c')]['filter']+'%'};return _0x1ded92;}})});}_0x12fa27=_[_0xc06b('0x39')]({},_0x12fa27,_0x54b05c['options']);var _0x273e0f={'where':_0x12fa27[_0xc06b('0x35')]};return db['Attachment'][_0xc06b('0x1f')](_0x273e0f)[_0xc06b('0x25')](function(_0x28bec6){_0x13be76[_0xc06b('0x1f')]=_0x28bec6;if(_0x54b05c[_0xc06b('0x2c')][_0xc06b('0x3a')]){_0x12fa27[_0xc06b('0x3b')]=[{'all':!![]}];}return db[_0xc06b('0x3c')][_0xc06b('0x3d')](_0x12fa27);})[_0xc06b('0x25')](function(_0x310850){_0x13be76[_0xc06b('0x3e')]=_0x310850;return _0x13be76;})['then'](respondWithFilteredResult(_0x2bb8c3,_0x12fa27))[_0xc06b('0x3f')](handleError(_0x2bb8c3,null));};exports['show']=function(_0x11f6b6,_0x3b3eb4){var _0x14d6b4={'raw':!![],'where':{'id':_0x11f6b6[_0xc06b('0x40')]['id']}},_0x5cb270={};_0x5cb270[_0xc06b('0x2a')]=_[_0xc06b('0x2d')](db[_0xc06b('0x3c')]['rawAttributes']);_0x5cb270[_0xc06b('0x2c')]=_['keys'](_0x11f6b6[_0xc06b('0x2c')]);_0x5cb270['filters']=_['intersection'](_0x5cb270[_0xc06b('0x2a')],_0x5cb270[_0xc06b('0x2c')]);_0x14d6b4[_0xc06b('0x30')]=_[_0xc06b('0x2f')](_0x5cb270[_0xc06b('0x2a')],qs['fields'](_0x11f6b6['query'][_0xc06b('0x31')]));_0x14d6b4[_0xc06b('0x30')]=_0x14d6b4['attributes'][_0xc06b('0x41')]?_0x14d6b4[_0xc06b('0x30')]:_0x5cb270['model'];if(_0x11f6b6['query'][_0xc06b('0x3a')]){_0x14d6b4[_0xc06b('0x3b')]=[{'all':!![]}];}_0x14d6b4=_[_0xc06b('0x39')]({},_0x14d6b4,_0x11f6b6['options']);return db[_0xc06b('0x3c')][_0xc06b('0x42')](_0x14d6b4)['then'](handleEntityNotFound(_0x3b3eb4,null))[_0xc06b('0x25')](respondWithResult(_0x3b3eb4,null))[_0xc06b('0x3f')](handleError(_0x3b3eb4,null));};exports[_0xc06b('0x43')]=function(_0x5e04f1,_0x1cffe5){var _0x33ea71={'where':{'id':_0x5e04f1[_0xc06b('0x40')]['id']}},_0x369ff3={};_0x369ff3[_0xc06b('0x2a')]=_[_0xc06b('0x2d')](db[_0xc06b('0x3c')]['rawAttributes']);_0x33ea71['attributes']=_[_0xc06b('0x2f')](_0x369ff3[_0xc06b('0x2a')],qs[_0xc06b('0x31')](_0x5e04f1[_0xc06b('0x2c')][_0xc06b('0x31')]));_0x33ea71[_0xc06b('0x30')]=_0x33ea71['attributes'][_0xc06b('0x41')]?_0x33ea71['attributes']:_0x369ff3['model'];if(_0x5e04f1[_0xc06b('0x2c')]['includeAll']){_0x33ea71[_0xc06b('0x3b')]=[{'all':!![]}];}_0x33ea71=_[_0xc06b('0x39')]({},_0x33ea71,_0x5e04f1[_0xc06b('0x44')]);return db['Attachment']['find'](_0x33ea71)[_0xc06b('0x25')](handleEntityNotFound(_0x1cffe5,null))['then'](function(_0x2ed9a0){if(_0x2ed9a0){var _0x96b083=_0x2ed9a0[_0xc06b('0x45')]({'plain':!![]});_0x96b083=qs[_0xc06b('0x46')](_0x96b083,['id',_0xc06b('0x47'),'updatedAt']);_0x5e04f1[_0xc06b('0x48')]=_[_0xc06b('0x46')](_0x5e04f1[_0xc06b('0x48')],['id',_0xc06b('0x47'),'updatedAt']);return db[_0xc06b('0x3c')]['create'](_[_0xc06b('0x39')](_0x96b083,_0x5e04f1[_0xc06b('0x48')]),{'include':_0x5e04f1['query'][_0xc06b('0x3a')]?[{'all':!![]}]:undefined});}})[_0xc06b('0x25')](respondWithResult(_0x1cffe5,0xc9))['catch'](handleError(_0x1cffe5,null));};exports[_0xc06b('0x24')]=function(_0x7b96ac,_0x3c70da){if(_0x7b96ac['body']['id']){delete _0x7b96ac[_0xc06b('0x48')]['id'];}return db[_0xc06b('0x3c')][_0xc06b('0x42')]({'where':{'id':_0x7b96ac[_0xc06b('0x40')]['id']}})[_0xc06b('0x25')](handleEntityNotFound(_0x3c70da,null))[_0xc06b('0x25')](saveUpdates(_0x7b96ac[_0xc06b('0x48')],null))[_0xc06b('0x25')](respondWithResult(_0x3c70da,null))['catch'](handleError(_0x3c70da,null));};exports[_0xc06b('0x26')]=function(_0x4ef9e4,_0x2e4f60){return db[_0xc06b('0x3c')]['find']({'where':{'id':_0x4ef9e4[_0xc06b('0x40')]['id']}})[_0xc06b('0x25')](handleEntityNotFound(_0x2e4f60,null))[_0xc06b('0x25')](removeEntity(_0x2e4f60,null))['catch'](handleError(_0x2e4f60,null));};exports[_0xc06b('0x49')]=function(_0x363fc5,_0x146974,_0x2343fd){_0x363fc5[_0xc06b('0x48')][_0xc06b('0x28')]=_0x363fc5[_0xc06b('0x4a')][_0xc06b('0x4b')];_0x363fc5[_0xc06b('0x48')][_0xc06b('0x4c')]=_0x363fc5[_0xc06b('0x4a')][_0xc06b('0x4d')];_0x363fc5[_0xc06b('0x48')]['type']=_0x363fc5[_0xc06b('0x4a')][_0xc06b('0x4e')];return db[_0xc06b('0x3c')][_0xc06b('0x49')](_0x363fc5[_0xc06b('0x48')])[_0xc06b('0x25')](respondWithResult(_0x146974,0xc9))[_0xc06b('0x3f')](handleError(_0x146974,null));};exports[_0xc06b('0x4f')]=function(_0x5db43f,_0x3de777,_0x2aef74){return db[_0xc06b('0x3c')][_0xc06b('0x50')]({'where':{'id':_0x5db43f[_0xc06b('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3de777,null))['then'](function(_0xc31cb8){if(_0xc31cb8){var _0x507122=_0xc31cb8[_0xc06b('0x51')]!==null;var _0x59f98f=path['join'](config[_0xc06b('0x52')],_0xc06b('0x53'));if(_0x507122){_0x59f98f=path[_0xc06b('0x54')](_0x59f98f,'offline-chat/');}var _0x219128=path[_0xc06b('0x54')](_0x59f98f,_0xc31cb8[_0xc06b('0x4c')]);return _0x3de777[_0xc06b('0x4f')](_0x219128);}})[_0xc06b('0x3f')](handleError(_0x3de777,null));}; \ No newline at end of file +var _0x6f61=['model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','Attachment','includeAll','include','rows','catch','show','params','keys','find','clone','get','omit','createdAt','updatedAt','body','create','update','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x1fcc1e,_0x39efee){var _0x13497a=function(_0x56d1fe){while(--_0x56d1fe){_0x1fcc1e['push'](_0x1fcc1e['shift']());}};_0x13497a(++_0x39efee);}(_0x6f61,0x13b));var _0x16f6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f61[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x16f6('0x0'));var rimraf=require(_0x16f6('0x1'));var zipdir=require(_0x16f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16f6('0x3'));var moment=require(_0x16f6('0x4'));var BPromise=require(_0x16f6('0x5'));var Mustache=require('mustache');var util=require(_0x16f6('0x6'));var path=require(_0x16f6('0x7'));var sox=require(_0x16f6('0x8'));var csv=require(_0x16f6('0x9'));var ejs=require(_0x16f6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16f6('0xb'));var squel=require(_0x16f6('0xc'));var crypto=require(_0x16f6('0xd'));var jsforce=require(_0x16f6('0xe'));var deskjs=require(_0x16f6('0xf'));var toCsv=require(_0x16f6('0x9'));var querystring=require(_0x16f6('0x10'));var Papa=require(_0x16f6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x16f6('0x12'));var hardwareService=require(_0x16f6('0x13'));var logger=require(_0x16f6('0x14'))(_0x16f6('0x15'));var utils=require(_0x16f6('0x16'));var config=require(_0x16f6('0x17'));var licenseUtil=require(_0x16f6('0x18'));var db=require(_0x16f6('0x19'))['db'];function respondWithStatusCode(_0x1ed179,_0x1bbac7){_0x1bbac7=_0x1bbac7||0xcc;return function(_0x5e111f){if(_0x5e111f){return _0x1ed179['sendStatus'](_0x1bbac7);}return _0x1ed179['status'](_0x1bbac7)['end']();};}function respondWithResult(_0x60103,_0xf89fda){_0xf89fda=_0xf89fda||0xc8;return function(_0x46f76e){if(_0x46f76e){return _0x60103[_0x16f6('0x1a')](_0xf89fda)['json'](_0x46f76e);}};}function respondWithFilteredResult(_0x5c84b0,_0x1f34e9){return function(_0x10582c){if(_0x10582c){var _0x46078c=typeof _0x1f34e9[_0x16f6('0x1b')]===_0x16f6('0x1c')&&typeof _0x1f34e9[_0x16f6('0x1d')]===_0x16f6('0x1c');var _0x5a528a=_0x10582c['count'];var _0x578e30=_0x46078c?0x0:_0x1f34e9[_0x16f6('0x1b')];var _0x35fedb=_0x46078c?_0x10582c[_0x16f6('0x1e')]:_0x1f34e9['offset']+_0x1f34e9[_0x16f6('0x1d')];var _0x541619;if(_0x35fedb>=_0x5a528a){_0x35fedb=_0x5a528a;_0x541619=0xc8;}else{_0x541619=0xce;}_0x5c84b0[_0x16f6('0x1a')](_0x541619);return _0x5c84b0[_0x16f6('0x1f')](_0x16f6('0x20'),_0x578e30+'-'+_0x35fedb+'/'+_0x5a528a)[_0x16f6('0x21')](_0x10582c);}return null;};}function patchUpdates(_0x370332){return function(_0x16a56c){try{jsonpatch[_0x16f6('0x22')](_0x16a56c,_0x370332,!![]);}catch(_0x44e8a0){return BPromise[_0x16f6('0x23')](_0x44e8a0);}return _0x16a56c[_0x16f6('0x24')]();};}function saveUpdates(_0x5748be,_0x4b9d8c){return function(_0x3c74cb){if(_0x3c74cb){return _0x3c74cb['update'](_0x5748be)['then'](function(_0x4a43c7){return _0x4a43c7;});}return null;};}function removeEntity(_0x59bc70,_0x31c161){return function(_0x325c50){if(_0x325c50){return _0x325c50[_0x16f6('0x25')]()[_0x16f6('0x26')](function(){_0x59bc70[_0x16f6('0x1a')](0xcc)[_0x16f6('0x27')]();});}};}function handleEntityNotFound(_0x468091,_0x5be2be){return function(_0x406487){if(!_0x406487){_0x468091[_0x16f6('0x28')](0x194);}return _0x406487;};}function handleError(_0x4ad045,_0x478599){_0x478599=_0x478599||0x1f4;return function(_0x38dc02){logger[_0x16f6('0x29')](_0x38dc02[_0x16f6('0x2a')]);if(_0x38dc02[_0x16f6('0x2b')]){delete _0x38dc02[_0x16f6('0x2b')];}_0x4ad045['status'](_0x478599)['send'](_0x38dc02);};}exports[_0x16f6('0x2c')]=function(_0x2954ca,_0x42cba7){var _0x34c46d={},_0x55ecc9={},_0x569928={'count':0x0,'rows':[]};var _0x4f510d=_[_0x16f6('0x2d')](db['Attachment'][_0x16f6('0x2e')],function(_0x2d4c0a){return{'name':_0x2d4c0a[_0x16f6('0x2f')],'type':_0x2d4c0a[_0x16f6('0x30')][_0x16f6('0x31')]};});_0x55ecc9['model']=_['map'](_0x4f510d,_0x16f6('0x2b'));_0x55ecc9[_0x16f6('0x32')]=_['keys'](_0x2954ca['query']);_0x55ecc9[_0x16f6('0x33')]=_[_0x16f6('0x34')](_0x55ecc9[_0x16f6('0x35')],_0x55ecc9[_0x16f6('0x32')]);_0x34c46d[_0x16f6('0x36')]=_[_0x16f6('0x34')](_0x55ecc9['model'],qs[_0x16f6('0x37')](_0x2954ca[_0x16f6('0x32')][_0x16f6('0x37')]));_0x34c46d[_0x16f6('0x36')]=_0x34c46d[_0x16f6('0x36')][_0x16f6('0x38')]?_0x34c46d[_0x16f6('0x36')]:_0x55ecc9[_0x16f6('0x35')];if(!_0x2954ca['query'][_0x16f6('0x39')]('nolimit')){_0x34c46d[_0x16f6('0x1d')]=qs['limit'](_0x2954ca[_0x16f6('0x32')][_0x16f6('0x1d')]);_0x34c46d[_0x16f6('0x1b')]=qs[_0x16f6('0x1b')](_0x2954ca['query'][_0x16f6('0x1b')]);}_0x34c46d[_0x16f6('0x3a')]=qs['sort'](_0x2954ca[_0x16f6('0x32')][_0x16f6('0x3b')]);_0x34c46d[_0x16f6('0x3c')]=qs['filters'](_[_0x16f6('0x3d')](_0x2954ca['query'],_0x55ecc9[_0x16f6('0x33')]),_0x4f510d);if(_0x2954ca[_0x16f6('0x32')]['filter']){_0x34c46d[_0x16f6('0x3c')]=_[_0x16f6('0x3e')](_0x34c46d[_0x16f6('0x3c')],{'$or':_['map'](_0x4f510d,function(_0x414509){if(_0x414509[_0x16f6('0x30')]!=='VIRTUAL'){var _0x5a52f7={};_0x5a52f7[_0x414509[_0x16f6('0x2b')]]={'$like':'%'+_0x2954ca[_0x16f6('0x32')]['filter']+'%'};return _0x5a52f7;}})});}_0x34c46d=_[_0x16f6('0x3e')]({},_0x34c46d,_0x2954ca[_0x16f6('0x3f')]);var _0xef0a0a={'where':_0x34c46d['where']};return db[_0x16f6('0x40')][_0x16f6('0x1e')](_0xef0a0a)[_0x16f6('0x26')](function(_0x13a2f7){_0x569928['count']=_0x13a2f7;if(_0x2954ca['query'][_0x16f6('0x41')]){_0x34c46d[_0x16f6('0x42')]=[{'all':!![]}];}return db[_0x16f6('0x40')]['findAll'](_0x34c46d);})['then'](function(_0x256bc3){_0x569928[_0x16f6('0x43')]=_0x256bc3;return _0x569928;})[_0x16f6('0x26')](respondWithFilteredResult(_0x42cba7,_0x34c46d))[_0x16f6('0x44')](handleError(_0x42cba7,null));};exports[_0x16f6('0x45')]=function(_0x169371,_0x478ee0){var _0x27ed48={'raw':!![],'where':{'id':_0x169371[_0x16f6('0x46')]['id']}},_0x219d7d={};_0x219d7d[_0x16f6('0x35')]=_[_0x16f6('0x47')](db[_0x16f6('0x40')][_0x16f6('0x2e')]);_0x219d7d['query']=_['keys'](_0x169371[_0x16f6('0x32')]);_0x219d7d[_0x16f6('0x33')]=_['intersection'](_0x219d7d[_0x16f6('0x35')],_0x219d7d['query']);_0x27ed48[_0x16f6('0x36')]=_[_0x16f6('0x34')](_0x219d7d[_0x16f6('0x35')],qs[_0x16f6('0x37')](_0x169371[_0x16f6('0x32')][_0x16f6('0x37')]));_0x27ed48['attributes']=_0x27ed48[_0x16f6('0x36')]['length']?_0x27ed48[_0x16f6('0x36')]:_0x219d7d[_0x16f6('0x35')];if(_0x169371[_0x16f6('0x32')]['includeAll']){_0x27ed48[_0x16f6('0x42')]=[{'all':!![]}];}_0x27ed48=_[_0x16f6('0x3e')]({},_0x27ed48,_0x169371[_0x16f6('0x3f')]);return db[_0x16f6('0x40')][_0x16f6('0x48')](_0x27ed48)[_0x16f6('0x26')](handleEntityNotFound(_0x478ee0,null))[_0x16f6('0x26')](respondWithResult(_0x478ee0,null))[_0x16f6('0x44')](handleError(_0x478ee0,null));};exports[_0x16f6('0x49')]=function(_0x176840,_0x4aa7c1){var _0x746270={'where':{'id':_0x176840['params']['id']}},_0x3da469={};_0x3da469[_0x16f6('0x35')]=_[_0x16f6('0x47')](db[_0x16f6('0x40')]['rawAttributes']);_0x746270[_0x16f6('0x36')]=_[_0x16f6('0x34')](_0x3da469['model'],qs[_0x16f6('0x37')](_0x176840['query'][_0x16f6('0x37')]));_0x746270[_0x16f6('0x36')]=_0x746270[_0x16f6('0x36')]['length']?_0x746270[_0x16f6('0x36')]:_0x3da469['model'];if(_0x176840['query'][_0x16f6('0x41')]){_0x746270[_0x16f6('0x42')]=[{'all':!![]}];}_0x746270=_[_0x16f6('0x3e')]({},_0x746270,_0x176840['options']);return db[_0x16f6('0x40')][_0x16f6('0x48')](_0x746270)[_0x16f6('0x26')](handleEntityNotFound(_0x4aa7c1,null))[_0x16f6('0x26')](function(_0x34038e){if(_0x34038e){var _0x1a612f=_0x34038e[_0x16f6('0x4a')]({'plain':!![]});_0x1a612f=qs[_0x16f6('0x4b')](_0x1a612f,['id',_0x16f6('0x4c'),_0x16f6('0x4d')]);_0x176840[_0x16f6('0x4e')]=_[_0x16f6('0x4b')](_0x176840[_0x16f6('0x4e')],['id','createdAt',_0x16f6('0x4d')]);return db[_0x16f6('0x40')][_0x16f6('0x4f')](_[_0x16f6('0x3e')](_0x1a612f,_0x176840[_0x16f6('0x4e')]),{'include':_0x176840[_0x16f6('0x32')][_0x16f6('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4aa7c1,0xc9))[_0x16f6('0x44')](handleError(_0x4aa7c1,null));};exports[_0x16f6('0x50')]=function(_0x53ea72,_0x3a637a){if(_0x53ea72[_0x16f6('0x4e')]['id']){delete _0x53ea72[_0x16f6('0x4e')]['id'];}return db['Attachment'][_0x16f6('0x48')]({'where':{'id':_0x53ea72[_0x16f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a637a,null))[_0x16f6('0x26')](saveUpdates(_0x53ea72[_0x16f6('0x4e')],null))[_0x16f6('0x26')](respondWithResult(_0x3a637a,null))[_0x16f6('0x44')](handleError(_0x3a637a,null));};exports['destroy']=function(_0x216154,_0x41b142){return db[_0x16f6('0x40')][_0x16f6('0x48')]({'where':{'id':_0x216154[_0x16f6('0x46')]['id']}})[_0x16f6('0x26')](handleEntityNotFound(_0x41b142,null))[_0x16f6('0x26')](removeEntity(_0x41b142,null))['catch'](handleError(_0x41b142,null));};exports['create']=function(_0x19b252,_0x3b4fd5,_0x183d5e){_0x19b252[_0x16f6('0x4e')][_0x16f6('0x2b')]=_0x19b252['file']['originalname'];_0x19b252[_0x16f6('0x4e')][_0x16f6('0x51')]=_0x19b252[_0x16f6('0x52')][_0x16f6('0x53')];_0x19b252[_0x16f6('0x4e')][_0x16f6('0x30')]=_0x19b252[_0x16f6('0x52')][_0x16f6('0x54')];return db[_0x16f6('0x40')][_0x16f6('0x4f')](_0x19b252[_0x16f6('0x4e')])[_0x16f6('0x26')](respondWithResult(_0x3b4fd5,0xc9))[_0x16f6('0x44')](handleError(_0x3b4fd5,null));};exports[_0x16f6('0x55')]=function(_0x24e851,_0x2e8699,_0x5efe4d){return db[_0x16f6('0x40')][_0x16f6('0x56')]({'where':{'id':_0x24e851[_0x16f6('0x46')]['id']},'raw':!![]})[_0x16f6('0x26')](handleEntityNotFound(_0x2e8699,null))[_0x16f6('0x26')](function(_0x395d4b){if(_0x395d4b){var _0x21c608=_0x395d4b[_0x16f6('0x57')]!==null;var _0x160ca3=path[_0x16f6('0x58')](config[_0x16f6('0x59')],_0x16f6('0x5a'));if(_0x21c608){_0x160ca3=path[_0x16f6('0x58')](_0x160ca3,_0x16f6('0x5b'));}var _0x1b39a3=path['join'](_0x160ca3,_0x395d4b[_0x16f6('0x51')]);return _0x2e8699[_0x16f6('0x55')](_0x1b39a3);}})['catch'](handleError(_0x2e8699,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 60c0ea5..0f786b3 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 _0xb71d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','define','Attachment','attachments'];(function(_0x59f3c8,_0x269e43){var _0x320c2f=function(_0x2c22a5){while(--_0x2c22a5){_0x59f3c8['push'](_0x59f3c8['shift']());}};_0x320c2f(++_0x269e43);}(_0xb71d,0x15c));var _0xdb71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb71d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xdb71('0x0'));var util=require('util');var logger=require(_0xdb71('0x1'))(_0xdb71('0x2'));var moment=require(_0xdb71('0x3'));var BPromise=require(_0xdb71('0x4'));var rp=require(_0xdb71('0x5'));var fs=require('fs');var path=require(_0xdb71('0x6'));var rimraf=require(_0xdb71('0x7'));var config=require('../../config/environment');var attributes=require(_0xdb71('0x8'));module['exports']=function(_0x3c07be,_0x53898e){return _0x3c07be[_0xdb71('0x9')](_0xdb71('0xa'),attributes,{'tableName':_0xdb71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b67=['Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x26910e,_0x40184a){var _0x2c35bd=function(_0x42c9c7){while(--_0x42c9c7){_0x26910e['push'](_0x26910e['shift']());}};_0x2c35bd(++_0x40184a);}(_0x2b67,0x160));var _0x72b6=function(_0x5298f9,_0x4284b3){_0x5298f9=_0x5298f9-0x0;var _0x110fc1=_0x2b67[_0x5298f9];return _0x110fc1;};'use strict';var _=require(_0x72b6('0x0'));var util=require(_0x72b6('0x1'));var logger=require(_0x72b6('0x2'))(_0x72b6('0x3'));var moment=require(_0x72b6('0x4'));var BPromise=require(_0x72b6('0x5'));var rp=require(_0x72b6('0x6'));var fs=require('fs');var path=require(_0x72b6('0x7'));var rimraf=require(_0x72b6('0x8'));var config=require(_0x72b6('0x9'));var attributes=require(_0x72b6('0xa'));module[_0x72b6('0xb')]=function(_0x3075c1,_0xff31af){return _0x3075c1['define'](_0x72b6('0xc'),attributes,{'tableName':_0x72b6('0xd'),'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 2d711f6..9bc12ae 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 _0x6c50=['error','Attachment,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateAttachment','Attachment','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x6c50,0xa4));var _0x06c5=function(_0x44641b,_0x20d859){_0x44641b=_0x44641b-0x0;var _0x51c353=_0x6c50[_0x44641b];return _0x51c353;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var moment=require(_0x06c5('0x2'));var BPromise=require(_0x06c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x06c5('0x5'));var logger=require(_0x06c5('0x6'))(_0x06c5('0x7'));var config=require(_0x06c5('0x8'));var jayson=require(_0x06c5('0x9'));var client=jayson[_0x06c5('0xa')][_0x06c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427dd6,_0x181c7f,_0x17c636){return new BPromise(function(_0x154b0a,_0x546ae5){return client[_0x06c5('0xc')](_0x427dd6,_0x17c636)[_0x06c5('0xd')](function(_0x3010af){logger[_0x06c5('0xe')]('Attachment,\x20%s,\x20%s',_0x181c7f,'request\x20sent');logger['debug'](_0x06c5('0xf'),_0x181c7f,'request\x20sent',JSON['stringify'](_0x3010af));if(_0x3010af['error']){if(_0x3010af[_0x06c5('0x10')]['code']===0x1f4){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af[_0x06c5('0x10')]['message']);return _0x546ae5(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af['error']['message']);return _0x154b0a(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}else{logger[_0x06c5('0xe')]('Attachment,\x20%s,\x20%s',_0x181c7f,_0x06c5('0x13'));_0x154b0a(_0x3010af[_0x06c5('0x14')]['message']);}})[_0x06c5('0x15')](function(_0x9045e6){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x9045e6);_0x546ae5(_0x9045e6);});});}exports[_0x06c5('0x16')]=function(_0x36b9e9){var _0x44d14e=this;return new Promise(function(_0x18a070,_0x1393f5){return db[_0x06c5('0x17')][_0x06c5('0x18')](_0x36b9e9[_0x06c5('0x19')],{'raw':_0x36b9e9[_0x06c5('0x1a')]?_0x36b9e9[_0x06c5('0x1a')][_0x06c5('0x1b')]===undefined?!![]:![]:!![]})[_0x06c5('0xd')](function(_0x26a653){logger['info'](_0x06c5('0x16'),_0x36b9e9);logger[_0x06c5('0x1c')](_0x06c5('0x16'),_0x36b9e9,JSON[_0x06c5('0x1d')](_0x26a653));_0x18a070(_0x26a653);})[_0x06c5('0x15')](function(_0x3c9e49){logger[_0x06c5('0x10')]('CreateAttachment',_0x3c9e49[_0x06c5('0x12')],_0x36b9e9);_0x1393f5(_0x44d14e[_0x06c5('0x10')](0x1f4,_0x3c9e49[_0x06c5('0x12')]));});});}; \ No newline at end of file +var _0x7dc2=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27dc('0x0'));var BPromise=require(_0x27dc('0x1'));var rs=require(_0x27dc('0x2'));var fs=require('fs');var Redis=require(_0x27dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27dc('0x4'));var logger=require(_0x27dc('0x5'))('rpc');var config=require(_0x27dc('0x6'));var jayson=require(_0x27dc('0x7'));var client=jayson['client'][_0x27dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e10,_0x95bbb6,_0x3b3eee){return new BPromise(function(_0x5181ab,_0x45aa07){return client[_0x27dc('0x9')](_0x4d2e10,_0x3b3eee)[_0x27dc('0xa')](function(_0x242997){logger['info'](_0x27dc('0xb'),_0x95bbb6,'request\x20sent');logger[_0x27dc('0xc')](_0x27dc('0xd'),_0x95bbb6,_0x27dc('0xe'),JSON['stringify'](_0x242997));if(_0x242997['error']){if(_0x242997[_0x27dc('0xf')][_0x27dc('0x10')]===0x1f4){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x242997['error'][_0x27dc('0x11')]);return _0x45aa07(_0x242997['error'][_0x27dc('0x11')]);}logger['error'](_0x27dc('0xb'),_0x95bbb6,_0x242997[_0x27dc('0xf')][_0x27dc('0x11')]);return _0x5181ab(_0x242997[_0x27dc('0xf')]['message']);}else{logger[_0x27dc('0x12')](_0x27dc('0xb'),_0x95bbb6,_0x27dc('0xe'));_0x5181ab(_0x242997[_0x27dc('0x13')][_0x27dc('0x11')]);}})['catch'](function(_0x3ff8f8){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x3ff8f8);_0x45aa07(_0x3ff8f8);});});}exports[_0x27dc('0x14')]=function(_0x5d308b){var _0x5ecb19=this;return new Promise(function(_0x1ff9a2,_0x225b2c){return db[_0x27dc('0x15')][_0x27dc('0x16')](_0x5d308b[_0x27dc('0x17')],{'raw':_0x5d308b[_0x27dc('0x18')]?_0x5d308b[_0x27dc('0x18')][_0x27dc('0x19')]===undefined?!![]:![]:!![]})[_0x27dc('0xa')](function(_0x5064d5){logger[_0x27dc('0x12')](_0x27dc('0x14'),_0x5d308b);logger['debug'](_0x27dc('0x14'),_0x5d308b,JSON['stringify'](_0x5064d5));_0x1ff9a2(_0x5064d5);})['catch'](function(_0x2843b1){logger['error'](_0x27dc('0x14'),_0x2843b1['message'],_0x5d308b);_0x225b2c(_0x5ecb19['error'](0x1f4,_0x2843b1[_0x27dc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f9e0ed4..1d34e74 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0x0b0e[_0x3789b9];return _0x4d020d;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0450bba..6d9e07f 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x018f=['message','login','ad-login','signToken','use','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','adSsoEnabled','name','password','role','disabled','blockedAt','online','admin','user','domain','blocked','add','minutes','clearBlockUser','getLicense','catch','status','send'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x018f,0x93));var _0xf018=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x018f[_0x1602ef];return _0x5870ee;};'use strict';var passport=require(_0xf018('0x0'));var LocalStrategy=require(_0xf018('0x1'))[_0xf018('0x2')];var moment=require(_0xf018('0x3'));var ActiveDirectory=require(_0xf018('0x4'));var BPromise=require('bluebird');var util=require(_0xf018('0x5'));var db=require(_0xf018('0x6'))['db'];var authService=require(_0xf018('0x7'));var utils=require(_0xf018('0x8'));var config=require(_0xf018('0x9'));var logger=require(_0xf018('0xa'))('api');function isActiveDirectoryConfigured(_0x384ebf){var _0x10037a=![];if(typeof _0x384ebf[_0xf018('0xb')]!==_0xf018('0xc')){_0x10037a=_0x384ebf[_0xf018('0xb')][_0xf018('0xd')]&&_0x384ebf['activedirectory']['url']&&_0x384ebf[_0xf018('0xb')]['domain'];}return _0x10037a;}function adAuthenticate(_0x30ffce,_0x567a9e,_0xbf3094){return new BPromise(function(_0x564412,_0x238a06){try{var _0x1a387c=new ActiveDirectory(_0x30ffce);_0x1a387c[_0xf018('0xe')](_0x567a9e,_0xbf3094,function(_0x54042a,_0x453ce3){if(_0x54042a){logger[_0xf018('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x567a9e,util[_0xf018('0x10')](_0x54042a,{'showHidden':![],'depth':null}));_0x238a06(_0xf018('0x11'));}else if(!_0x453ce3){logger[_0xf018('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x567a9e);_0x238a06(_0xf018('0x11'));}else{_0x564412(_0x453ce3);}});}catch(_0x4d8581){_0x238a06(_0x4d8581);}});}function ActiveDirectoryAuthenticate(_0x1274d3,_0x56bc49,_0x47585c,_0x27d3bb){var _0x368b81,_0x4acc3d;if(!isActiveDirectoryConfigured(config)){logger[_0xf018('0xf')](_0xf018('0x12'),_0x56bc49);return _0x27d3bb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xf018('0x13')][_0xf018('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xf018('0x15')],'raw':!![]})[_0xf018('0x16')](function(_0x82377b){_0x368b81=_0x82377b;if(!_0x368b81[_0xf018('0x17')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x56bc49);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1274d3[_0xf018('0x14')]({'attributes':['id',_0xf018('0x18'),_0xf018('0x19'),'salt',_0xf018('0x1a'),_0xf018('0x1b'),'blocked',_0xf018('0x1c'),_0xf018('0x1d')],'where':{'name':_0x56bc49,'role':{'$or':[_0xf018('0x1e'),_0xf018('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0xf018('0x16')](function(_0x33969e){if(!_0x33969e||_0x33969e&&_0x33969e[_0xf018('0x18')]!==_0x56bc49){throw new Error(_0xf018('0x11'));}_0x4acc3d=_0x33969e;var _0xf59638=_0x4acc3d[_0xf018('0x18')]+'@'+config['activedirectory'][_0xf018('0x20')];return adAuthenticate(config[_0xf018('0xb')],_0xf59638,_0x47585c);})[_0xf018('0x16')](function(_0xcd60ea){if(_0x4acc3d[_0xf018('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x368b81[_0xf018('0x15')]>0x0){if(_0x4acc3d[_0xf018('0x21')]){if(moment(_0x4acc3d[_0xf018('0x1c')])[_0xf018('0x22')](_0x368b81[_0xf018('0x15')],_0xf018('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xf018('0x24')](_0x4acc3d,0x0,![],null)[_0xf018('0x16')](function(){return utils[_0xf018('0x25')](_0x4acc3d);})['then'](function(){return _0x27d3bb(null,_0x4acc3d);});}else{return utils[_0xf018('0x25')](_0x4acc3d)[_0xf018('0x16')](function(){return _0x27d3bb(null,_0x4acc3d);});}}else{return utils[_0xf018('0x25')](_0x4acc3d)[_0xf018('0x16')](function(){return _0x27d3bb(null,_0x4acc3d);});}})[_0xf018('0x26')](function(_0x14b726){return _0x27d3bb(null,![],_0x14b726);});}function handleError(_0x1098f8,_0x16b0ea,_0x11e872){return _0x1098f8[_0xf018('0x27')](_0x16b0ea||0x1f4)[_0xf018('0x28')]({'message':_0x11e872?_0x11e872[_0xf018('0x29')]||_0x11e872:''});}exports[_0xf018('0x2a')]=function(_0x1f8cff,_0x2bd0c8,_0x125ab9){passport['authenticate'](_0xf018('0x2b'),function(_0xfc5987,_0x3d6989,_0x13f242){var _0x29b237=_0xfc5987||_0x13f242;if(_0x29b237){return handleError(_0x2bd0c8,0x191,_0x29b237);}if(!_0x3d6989){return handleError(_0x2bd0c8,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x47679b={'payload':{'id':_0x3d6989['id'],'role':_0x3d6989[_0xf018('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xf018('0x2c')](_0x47679b)['then'](function(_0x1f5f5b){_0x2bd0c8['json']({'id':_0x3d6989['id'],'token':_0x1f5f5b,'statusCall':'','isAlreadyLogged':_0x3d6989[_0xf018('0x1d')]});});}})(_0x1f8cff,_0x2bd0c8,_0x125ab9);};passport[_0xf018('0x2d')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0xf018('0x19')},function(_0x3f7292,_0x118d79,_0x409d67){return ActiveDirectoryAuthenticate(db[_0xf018('0x2e')],_0x3f7292,_0x118d79,_0x409d67);})); \ No newline at end of file +var _0x60f5=['error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','blockDuration','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','Strategy','moment','util','../../mysqldb','../../components/auth/service','../../config/utils','activedirectory','undefined','baseDN','url','domain','authenticate'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x60f5,0x8b));var _0x560f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x60f5[_0x3b380d];return _0x54502b;};'use strict';var passport=require(_0x560f('0x0'));var LocalStrategy=require(_0x560f('0x1'))[_0x560f('0x2')];var moment=require(_0x560f('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x560f('0x4'));var db=require(_0x560f('0x5'))['db'];var authService=require(_0x560f('0x6'));var utils=require(_0x560f('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x25eb71){var _0x7ec0bc=![];if(typeof _0x25eb71[_0x560f('0x8')]!==_0x560f('0x9')){_0x7ec0bc=_0x25eb71['activedirectory'][_0x560f('0xa')]&&_0x25eb71[_0x560f('0x8')][_0x560f('0xb')]&&_0x25eb71['activedirectory'][_0x560f('0xc')];}return _0x7ec0bc;}function adAuthenticate(_0x11cbf8,_0x292a57,_0x676d75){return new BPromise(function(_0x5ae83d,_0x604a6b){try{var _0x4780bc=new ActiveDirectory(_0x11cbf8);_0x4780bc[_0x560f('0xd')](_0x292a57,_0x676d75,function(_0x504dee,_0x5645a2){if(_0x504dee){logger[_0x560f('0xe')](_0x560f('0xf'),_0x292a57,util[_0x560f('0x10')](_0x504dee,{'showHidden':![],'depth':null}));_0x604a6b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x5645a2){logger[_0x560f('0xe')](_0x560f('0x11'),_0x292a57);_0x604a6b(_0x560f('0x12'));}else{_0x5ae83d(_0x5645a2);}});}catch(_0x40a2aa){_0x604a6b(_0x40a2aa);}});}function ActiveDirectoryAuthenticate(_0x33f246,_0x15a162,_0x2c3eb6,_0xea5fa5){var _0x1640d6,_0x4c4897;if(!isActiveDirectoryConfigured(config)){logger[_0x560f('0xe')](_0x560f('0x13'),_0x15a162);return _0xea5fa5(null,![],{'message':_0x560f('0x12')});}return db[_0x560f('0x14')][_0x560f('0x15')]({'where':{'id':0x1},'attributes':[_0x560f('0x16'),'blockDuration'],'raw':!![]})[_0x560f('0x17')](function(_0x45f811){_0x1640d6=_0x45f811;if(!_0x1640d6['adSsoEnabled']){logger[_0x560f('0xe')](_0x560f('0x18'),_0x15a162);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x33f246[_0x560f('0x15')]({'attributes':['id',_0x560f('0x19'),_0x560f('0x1a'),_0x560f('0x1b'),_0x560f('0x1c'),_0x560f('0x1d'),_0x560f('0x1e'),_0x560f('0x1f'),_0x560f('0x20')],'where':{'name':_0x15a162,'role':{'$or':[_0x560f('0x21'),_0x560f('0x22'),_0x560f('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x5aeef9){if(!_0x5aeef9||_0x5aeef9&&_0x5aeef9['name']!==_0x15a162){throw new Error(_0x560f('0x12'));}_0x4c4897=_0x5aeef9;var _0x29ff51=_0x4c4897[_0x560f('0x19')]+'@'+config[_0x560f('0x8')][_0x560f('0xc')];return adAuthenticate(config['activedirectory'],_0x29ff51,_0x2c3eb6);})[_0x560f('0x17')](function(_0x3642cc){if(_0x4c4897[_0x560f('0x1d')]){throw new Error(_0x560f('0x12'));}if(_0x1640d6[_0x560f('0x24')]>0x0){if(_0x4c4897[_0x560f('0x1e')]){if(moment(_0x4c4897[_0x560f('0x1f')])[_0x560f('0x25')](_0x1640d6[_0x560f('0x24')],_0x560f('0x26'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x560f('0x27')](_0x4c4897,0x0,![],null)[_0x560f('0x17')](function(){return utils[_0x560f('0x28')](_0x4c4897);})[_0x560f('0x17')](function(){return _0xea5fa5(null,_0x4c4897);});}else{return utils[_0x560f('0x28')](_0x4c4897)['then'](function(){return _0xea5fa5(null,_0x4c4897);});}}else{return utils[_0x560f('0x28')](_0x4c4897)[_0x560f('0x17')](function(){return _0xea5fa5(null,_0x4c4897);});}})[_0x560f('0x29')](function(_0x16ec18){return _0xea5fa5(null,![],_0x16ec18);});}function handleError(_0x2d48ab,_0x355a6a,_0x3d6d04){return _0x2d48ab[_0x560f('0x2a')](_0x355a6a||0x1f4)[_0x560f('0x2b')]({'message':_0x3d6d04?_0x3d6d04[_0x560f('0x2c')]||_0x3d6d04:''});}exports[_0x560f('0x2d')]=function(_0x331591,_0x334f6f,_0x1823d7){passport['authenticate'](_0x560f('0x2e'),function(_0x1633f5,_0x3511f3,_0xfb8b01){var _0x5e7df3=_0x1633f5||_0xfb8b01;if(_0x5e7df3){return handleError(_0x334f6f,0x191,_0x5e7df3);}if(!_0x3511f3){return handleError(_0x334f6f,0x194,{'message':_0x560f('0x2f')});}else{var _0x436976={'payload':{'id':_0x3511f3['id'],'role':_0x3511f3[_0x560f('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x560f('0x30')](_0x436976)['then'](function(_0x95e6da){_0x334f6f['json']({'id':_0x3511f3['id'],'token':_0x95e6da,'statusCall':'','isAlreadyLogged':_0x3511f3['online']});});}})(_0x331591,_0x334f6f,_0x1823d7);};passport[_0x560f('0x31')](_0x560f('0x2e'),new LocalStrategy({'usernameField':_0x560f('0x19'),'passwordField':_0x560f('0x1a')},function(_0xc7cab3,_0x4b44e5,_0x411078){return ActiveDirectoryAuthenticate(db[_0x560f('0x32')],_0xc7cab3,_0x4b44e5,_0x411078);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a1f0260..4ac226d 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0d=['exports','Router'];(function(_0x37fa10,_0x5690ff){var _0x8dd0ee=function(_0x17fea5){while(--_0x17fea5){_0x37fa10['push'](_0x37fa10['shift']());}};_0x8dd0ee(++_0x5690ff);}(_0x0b0d,0x19d));var _0xd0b0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0b0d[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express[_0xd0b0('0x0')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0xd0b0('0x1')]=router; \ No newline at end of file +var _0x034f=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x3c1e23,_0x470bf7){var _0x3a4f60=function(_0x3180b9){while(--_0x3180b9){_0x3c1e23['push'](_0x3c1e23['shift']());}};_0x3a4f60(++_0x470bf7);}(_0x034f,0xc2));var _0xf034=function(_0x4cfb6f,_0x230c48){_0x4cfb6f=_0x4cfb6f-0x0;var _0x29ca2d=_0x034f[_0x4cfb6f];return _0x29ca2d;};'use strict';var express=require(_0xf034('0x0'));var router=express[_0xf034('0x1')]();var controller=require(_0xf034('0x2'));router[_0xf034('0x3')]('/',controller[_0xf034('0x4')]);module[_0xf034('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0807adf..1913b99 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x7eac31,_0x59bafb){var _0x29f4ee=function(_0x4d4ac6){while(--_0x4d4ac6){_0x7eac31['push'](_0x7eac31['shift']());}};_0x29f4ee(++_0x59bafb);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xda53f8,_0x2f7376){var _0x1613a1=function(_0x7eb1c3){while(--_0x7eb1c3){_0xda53f8['push'](_0xda53f8['shift']());}};_0x1613a1(++_0x2f7376);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 28112ef..6cfb1de 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 _0xfed1=['express','passport','./authGoogle.controller','../user/user.controller.js','get','login','setTokenCookie','exports'];(function(_0x493cea,_0x144c6a){var _0x1c32ba=function(_0x47c0f9){while(--_0x47c0f9){_0x493cea['push'](_0x493cea['shift']());}};_0x1c32ba(++_0x144c6a);}(_0xfed1,0xf0));var _0x1fed=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfed1[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x1fed('0x0'));var passport=require(_0x1fed('0x1'));var router=express['Router']();var controller=require(_0x1fed('0x2'));var userController=require(_0x1fed('0x3'));var authService=require('../../components/auth/service');router[_0x1fed('0x4')]('/',controller[_0x1fed('0x5')]);router['get']('/callback',controller['callback'],authService['isMiddleware'],userController[_0x1fed('0x5')],authService[_0x1fed('0x6')]);module[_0x1fed('0x7')]=router; \ No newline at end of file +var _0x5327=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','exports','express','passport'];(function(_0x575280,_0x25d860){var _0x11faae=function(_0x369433){while(--_0x369433){_0x575280['push'](_0x575280['shift']());}};_0x11faae(++_0x25d860);}(_0x5327,0x1d2));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x7532('0x0'));var passport=require(_0x7532('0x1'));var router=express['Router']();var controller=require(_0x7532('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x7532('0x3'));router[_0x7532('0x4')]('/',controller[_0x7532('0x5')]);router[_0x7532('0x4')](_0x7532('0x6'),controller[_0x7532('0x7')],authService['isMiddleware'],userController[_0x7532('0x5')],authService['setTokenCookie']);module[_0x7532('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 461b193..d90bd1e 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 _0x74b3=['validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords'];(function(_0x2ea591,_0x493fef){var _0x2ad7d1=function(_0x434685){while(--_0x434685){_0x2ea591['push'](_0x2ea591['shift']());}};_0x2ad7d1(++_0x493fef);}(_0x74b3,0x14f));var _0x374b=function(_0x3365fa,_0x1f27c9){_0x3365fa=_0x3365fa-0x0;var _0x573910=_0x74b3[_0x3365fa];return _0x573910;};'use strict';var util=require(_0x374b('0x0'));var passport=require(_0x374b('0x1'));var LocalStrategy=require('passport-local')[_0x374b('0x2')];var jayson=require(_0x374b('0x3'));var _=require(_0x374b('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x374b('0x5'));var utils=require(_0x374b('0x6'));var client=jayson[_0x374b('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x4cde5f,_0x112ccd,_0x16f7ab,_0x40fc43){var _0x147c1a,_0x432b0d;return db[_0x374b('0x8')][_0x374b('0x9')]({'where':{'id':0x1},'attributes':[_0x374b('0xa'),_0x374b('0xb')],'raw':!![]})[_0x374b('0xc')](function(_0x4d220d){_0x147c1a=_0x4d220d;return _0x4cde5f[_0x374b('0x9')]({'attributes':['id',_0x374b('0xd'),_0x374b('0xe'),_0x374b('0xf'),_0x374b('0x10'),'disabled','blocked',_0x374b('0x11'),'loginAttempts'],'where':{'name':_0x112ccd,'role':{'$or':['admin',_0x374b('0x12'),_0x374b('0x13')]}}});})['then'](function(_0x2e3802){if(!_0x2e3802||_0x2e3802&&_0x2e3802['name']!==_0x112ccd){throw new Error(_0x374b('0x14'));}else{_0x432b0d=_0x2e3802;return _0x432b0d;}})['then'](function(){_0x432b0d[_0x374b('0x15')](_0x16f7ab,function(_0x4ac813,_0x4e471e){var _0x3a177d=_0x432b0d['loginAttempts']+0x1;if(_0x4ac813){return _0x40fc43(_0x4ac813);}else if(!_0x4e471e){if(_0x432b0d[_0x374b('0x16')]){return _0x40fc43(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x147c1a[_0x374b('0xa')]>0x0){if(_0x432b0d[_0x374b('0x17')]){if(_0x147c1a['blockDuration']>0x0){if(moment(_0x432b0d[_0x374b('0x11')])[_0x374b('0x18')](_0x147c1a['blockDuration'],_0x374b('0x19'))>moment()){return _0x40fc43(null,![],{'message':_0x374b('0x14')});}else{return utils[_0x374b('0x1a')](_0x432b0d,_0x3a177d,![],null)[_0x374b('0xc')](function(){return _0x40fc43(null,![],{'message':_0x374b('0x14')});});}}else{return _0x40fc43(null,![],{'message':_0x374b('0x14')});}}else{if(_0x3a177d>=_0x147c1a[_0x374b('0xa')]){return utils[_0x374b('0x1a')](_0x432b0d,0x0,!![],moment())['then'](function(){return _0x40fc43(null,![],{'message':_0x374b('0x14')});});}else{return utils[_0x374b('0x1a')](_0x432b0d,_0x3a177d,![],null)[_0x374b('0xc')](function(){return _0x40fc43(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x40fc43(null,![],{'message':_0x374b('0x14')});}}else{if(_0x432b0d['disabled']){return _0x40fc43(null,![],{'message':_0x374b('0x14')});}else if(_0x147c1a[_0x374b('0xa')]>0x0){if(_0x432b0d[_0x374b('0x17')]){if(_0x147c1a[_0x374b('0xb')]>0x0){if(moment(_0x432b0d[_0x374b('0x11')])[_0x374b('0x18')](_0x147c1a['blockDuration'],_0x374b('0x19'))>moment()){return _0x40fc43(null,![],{'message':_0x374b('0x14')});}else{return utils[_0x374b('0x1a')](_0x432b0d,0x0,![],null)[_0x374b('0xc')](function(){return utils[_0x374b('0x1b')](_0x432b0d);})[_0x374b('0xc')](function(){return _0x40fc43(null,_0x432b0d);});}}else{return _0x40fc43(null,![],{'message':_0x374b('0x14')});}}else{return utils[_0x374b('0x1a')](_0x432b0d,0x0,![],null)[_0x374b('0xc')](function(){return utils['getLicense'](_0x432b0d);})[_0x374b('0xc')](function(){return _0x40fc43(null,_0x432b0d);})[_0x374b('0x1c')](function(_0x2328ff){return _0x40fc43(null,![],_0x2328ff);});}}else{if(_0x432b0d[_0x374b('0x17')]){return _0x40fc43(null,![],{'message':_0x374b('0x14')});}else{return utils[_0x374b('0x1b')](_0x432b0d)[_0x374b('0xc')](function(){return _0x40fc43(null,_0x432b0d);});}}}});})[_0x374b('0x1c')](function(_0x2b3b52){return _0x40fc43(null,![],_0x2b3b52);});}function sendServiceMail(_0x1de34b){return db[_0x374b('0x1d')][_0x374b('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x374b('0x1f')],'include':[{'model':db[_0x374b('0x20')],'as':_0x374b('0x21'),'include':[{'model':db[_0x374b('0x22')],'as':_0x374b('0x22')}]}]})[_0x374b('0xc')](function(_0x3778ab){if(!_0x3778ab){throw new Error(_0x374b('0x23'));}var _0x593c98=_0x3778ab['getSmtpOptions']();var _0x1c196b={'account':_0x593c98,'message':_['merge']({'from':util[_0x374b('0x24')](_0x374b('0x25'),_0x3778ab[_0x374b('0xd')],_0x3778ab[_0x374b('0x1f')]||_0x3778ab[_0x374b('0x21')][_0x374b('0x12')])},_0x1de34b)};return client[_0x374b('0x26')](_0x374b('0x27'),_0x1c196b);})[_0x374b('0xc')](function(_0x176a3a){if(_0x176a3a[_0x374b('0x28')]){throw new Error(util[_0x374b('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x176a3a[_0x374b('0x28')][_0x374b('0x29')]||JSON[_0x374b('0x2a')](_0x176a3a[_0x374b('0x28')])));}return!![];});}function handleError(_0x184368,_0x629adc,_0x4b17a1){return _0x184368['status'](_0x629adc||0x1f4)[_0x374b('0x2b')]({'message':_0x4b17a1?_0x4b17a1[_0x374b('0x29')]||_0x4b17a1:''});}exports[_0x374b('0x2c')]=function(_0x2842be,_0x1e24bf,_0x4c976b){passport[_0x374b('0x15')](_0x374b('0x2d'),function(_0x868b8c,_0x4294a4,_0x20c6f9){var _0xe90c73=_0x868b8c||_0x20c6f9;if(_0xe90c73){return handleError(_0x1e24bf,0x191,_0xe90c73);}if(!_0x4294a4){return handleError(_0x1e24bf,0x194,{'message':_0x374b('0x2e')});}else{var _0x56f186={'payload':{'id':_0x4294a4['id'],'role':_0x4294a4[_0x374b('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x374b('0x2f')](_0x56f186)['then'](function(_0x5324b1){_0x1e24bf['json']({'id':_0x4294a4['id'],'token':_0x5324b1,'statusCall':'','isAlreadyLogged':_0x4294a4[_0x374b('0x30')]});});}})(_0x2842be,_0x1e24bf,_0x4c976b);};exports[_0x374b('0x31')]=function(_0x431a55,_0x2487a4){if(!_0x431a55['body'][_0x374b('0x1f')]){return handleError(_0x2487a4,0x1f4,{'message':_0x374b('0x32')});}var _0x41921d=rs[_0x374b('0x33')]();_0x431a55[_0x374b('0x34')][_0x374b('0x1f')]=_0x431a55[_0x374b('0x34')]['email'][_0x374b('0x35')]()[_0x374b('0x36')]();var _0x4fd210;return db[_0x374b('0x8')][_0x374b('0x9')]({'where':{'id':0x1},'attributes':[_0x374b('0xa'),_0x374b('0xb')],'raw':!![]})[_0x374b('0xc')](function(_0x33cb16){_0x4fd210=_0x33cb16;return db[_0x374b('0x37')][_0x374b('0x1e')]({'where':{'email':_0x431a55[_0x374b('0x34')][_0x374b('0x1f')]}});})[_0x374b('0xc')](function(_0x30a1cc){if(!_0x30a1cc){throw new Error(_0x374b('0x38'));}if(_0x30a1cc[_0x374b('0x16')]){throw new Error(_0x374b('0x39'));}if(_0x30a1cc[_0x374b('0x17')]){if(moment(_0x30a1cc['blockedAt'])['add'](_0x4fd210['blockDuration'],'minutes')>moment()){throw new Error(_0x374b('0x3a'));}else{_0x30a1cc[_0x374b('0x17')]=![];_0x30a1cc[_0x374b('0x11')]=null;}}_0x30a1cc[_0x374b('0x3b')]=_0x41921d;_0x30a1cc[_0x374b('0x3c')]=Date[_0x374b('0x3d')]()+0x36ee80;return _0x30a1cc[_0x374b('0x3e')]();})[_0x374b('0xc')](function(){return sendServiceMail({'to':_0x431a55['body']['email'],'subject':_0x374b('0x3f'),'text':_0x374b('0x40')+_0x374b('0x41')+_0x374b('0x42')+_0x431a55[_0x374b('0x43')]['host']+_0x374b('0x44')+_0x41921d+'\x0a\x0a'+_0x374b('0x45')});})[_0x374b('0xc')](function(){_0x2487a4[_0x374b('0x46')](0xc8)[_0x374b('0x2b')]({'message':_0x374b('0x47')});})[_0x374b('0x1c')](function(_0x57e64c){return handleError(_0x2487a4,0x1f4,_0x57e64c);});};exports['reset']=function(_0x4fd1d0,_0x1676ae){return db[_0x374b('0x37')][_0x374b('0x1e')]({'where':{'resetPasswordToken':_0x4fd1d0[_0x374b('0x48')][_0x374b('0x49')],'resetPasswordExpires':{'$gt':Date[_0x374b('0x3d')]()}}})[_0x374b('0xc')](function(_0x115321){if(!_0x115321){throw new Error(_0x374b('0x4a'));}return db[_0x374b('0x8')][_0x374b('0x9')]({'attributes':['id','securePassword',_0x374b('0x4b'),_0x374b('0x4c')]})['then'](function(_0x59ae2b){if(_0x59ae2b[_0x374b('0x4d')])authService[_0x374b('0x4e')](_0x4fd1d0[_0x374b('0x34')]['password']);if(!_0x59ae2b['enforcePasswordHistory']||!_0x115321[_0x374b('0x4f')])return _0x115321;authService[_0x374b('0x50')](_0x4fd1d0[_0x374b('0x34')][_0x374b('0xe')],_0x115321[_0x374b('0x4f')],_0x59ae2b[_0x374b('0x4c')]);return _0x115321;})[_0x374b('0xc')](function(){_0x115321[_0x374b('0xe')]=_0x4fd1d0[_0x374b('0x34')]['password'];_0x115321['resetPasswordToken']=null;_0x115321['resetPasswordExpires']=null;return _0x115321[_0x374b('0x3e')]();});})[_0x374b('0xc')](function(){_0x1676ae[_0x374b('0x46')](0xc8)[_0x374b('0x2b')]({'message':_0x374b('0x51')});})[_0x374b('0x1c')](function(_0x5cecda){return handleError(_0x1676ae,0x1f4,_0x5cecda);});};passport[_0x374b('0x52')]('local-login',new LocalStrategy({'usernameField':_0x374b('0xd'),'passwordField':'password'},function(_0x438d78,_0x5490b1,_0x56bfbf){return localAuthenticate(db[_0x374b('0x37')],_0x438d78,_0x5490b1,_0x56bfbf);})); \ No newline at end of file +var _0x19ba=['catch','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','name','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','Password\x20reset!','local-login','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19ba,0x125));var _0xa19b=function(_0x192f6d,_0x3d8296){_0x192f6d=_0x192f6d-0x0;var _0x5b6f0f=_0x19ba[_0x192f6d];return _0x5b6f0f;};'use strict';var util=require('util');var passport=require(_0xa19b('0x0'));var LocalStrategy=require(_0xa19b('0x1'))['Strategy'];var jayson=require(_0xa19b('0x2'));var _=require(_0xa19b('0x3'));var rs=require(_0xa19b('0x4'));var moment=require(_0xa19b('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xa19b('0x6'));var utils=require(_0xa19b('0x7'));var client=jayson[_0xa19b('0x8')][_0xa19b('0x9')]({'port':0x232b});function localAuthenticate(_0x5471e2,_0x77e785,_0x2527d4,_0x307251){var _0x3e7dfc,_0x1aefac;return db[_0xa19b('0xa')][_0xa19b('0xb')]({'where':{'id':0x1},'attributes':[_0xa19b('0xc'),'blockDuration'],'raw':!![]})[_0xa19b('0xd')](function(_0x2e88b0){_0x3e7dfc=_0x2e88b0;return _0x5471e2[_0xa19b('0xb')]({'attributes':['id','name',_0xa19b('0xe'),_0xa19b('0xf'),_0xa19b('0x10'),_0xa19b('0x11'),_0xa19b('0x12'),'blockedAt',_0xa19b('0x13')],'where':{'name':_0x77e785,'role':{'$or':[_0xa19b('0x14'),_0xa19b('0x15'),_0xa19b('0x16')]}}});})[_0xa19b('0xd')](function(_0x23b5cb){if(!_0x23b5cb||_0x23b5cb&&_0x23b5cb['name']!==_0x77e785){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1aefac=_0x23b5cb;return _0x1aefac;}})[_0xa19b('0xd')](function(){_0x1aefac[_0xa19b('0x17')](_0x2527d4,function(_0x58475e,_0x32b129){var _0x37617d=_0x1aefac[_0xa19b('0x13')]+0x1;if(_0x58475e){return _0x307251(_0x58475e);}else if(!_0x32b129){if(_0x1aefac[_0xa19b('0x11')]){return _0x307251(null,![],{'message':_0xa19b('0x18')});}else if(_0x3e7dfc[_0xa19b('0xc')]>0x0){if(_0x1aefac['blocked']){if(_0x3e7dfc[_0xa19b('0x19')]>0x0){if(moment(_0x1aefac[_0xa19b('0x1a')])[_0xa19b('0x1b')](_0x3e7dfc[_0xa19b('0x19')],_0xa19b('0x1c'))>moment()){return _0x307251(null,![],{'message':_0xa19b('0x18')});}else{return utils['clearBlockUser'](_0x1aefac,_0x37617d,![],null)[_0xa19b('0xd')](function(){return _0x307251(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x307251(null,![],{'message':_0xa19b('0x18')});}}else{if(_0x37617d>=_0x3e7dfc[_0xa19b('0xc')]){return utils[_0xa19b('0x1d')](_0x1aefac,0x0,!![],moment())[_0xa19b('0xd')](function(){return _0x307251(null,![],{'message':_0xa19b('0x18')});});}else{return utils[_0xa19b('0x1d')](_0x1aefac,_0x37617d,![],null)[_0xa19b('0xd')](function(){return _0x307251(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x307251(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1aefac[_0xa19b('0x11')]){return _0x307251(null,![],{'message':_0xa19b('0x18')});}else if(_0x3e7dfc[_0xa19b('0xc')]>0x0){if(_0x1aefac['blocked']){if(_0x3e7dfc['blockDuration']>0x0){if(moment(_0x1aefac[_0xa19b('0x1a')])[_0xa19b('0x1b')](_0x3e7dfc[_0xa19b('0x19')],_0xa19b('0x1c'))>moment()){return _0x307251(null,![],{'message':_0xa19b('0x18')});}else{return utils[_0xa19b('0x1d')](_0x1aefac,0x0,![],null)[_0xa19b('0xd')](function(){return utils['getLicense'](_0x1aefac);})[_0xa19b('0xd')](function(){return _0x307251(null,_0x1aefac);});}}else{return _0x307251(null,![],{'message':_0xa19b('0x18')});}}else{return utils[_0xa19b('0x1d')](_0x1aefac,0x0,![],null)['then'](function(){return utils[_0xa19b('0x1e')](_0x1aefac);})['then'](function(){return _0x307251(null,_0x1aefac);})[_0xa19b('0x1f')](function(_0x72d42d){return _0x307251(null,![],_0x72d42d);});}}else{if(_0x1aefac[_0xa19b('0x12')]){return _0x307251(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa19b('0x1e')](_0x1aefac)[_0xa19b('0xd')](function(){return _0x307251(null,_0x1aefac);});}}}});})[_0xa19b('0x1f')](function(_0x1adfa2){return _0x307251(null,![],_0x1adfa2);});}function sendServiceMail(_0x4dce8e){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xa19b('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xa19b('0x21'),'include':[{'model':db[_0xa19b('0x22')],'as':_0xa19b('0x22')}]}]})[_0xa19b('0xd')](function(_0x1a0fff){if(!_0x1a0fff){throw new Error(_0xa19b('0x23'));}var _0x3ec813=_0x1a0fff[_0xa19b('0x24')]();var _0x29cba6={'account':_0x3ec813,'message':_[_0xa19b('0x25')]({'from':util[_0xa19b('0x26')](_0xa19b('0x27'),_0x1a0fff[_0xa19b('0x28')],_0x1a0fff[_0xa19b('0x20')]||_0x1a0fff['Smtp']['user'])},_0x4dce8e)};return client['request'](_0xa19b('0x29'),_0x29cba6);})['then'](function(_0x52e3ae){if(_0x52e3ae[_0xa19b('0x2a')]){throw new Error(util['format'](_0xa19b('0x2b'),_0x52e3ae['error']['message']||JSON[_0xa19b('0x2c')](_0x52e3ae[_0xa19b('0x2a')])));}return!![];});}function handleError(_0x1e3821,_0x5c50ea,_0x5b886c){return _0x1e3821[_0xa19b('0x2d')](_0x5c50ea||0x1f4)[_0xa19b('0x2e')]({'message':_0x5b886c?_0x5b886c[_0xa19b('0x2f')]||_0x5b886c:''});}exports[_0xa19b('0x30')]=function(_0x58900d,_0x35071e,_0x4d464d){passport[_0xa19b('0x17')]('local-login',function(_0x1ad11a,_0x3428cd,_0x2a79d6){var _0x44f543=_0x1ad11a||_0x2a79d6;if(_0x44f543){return handleError(_0x35071e,0x191,_0x44f543);}if(!_0x3428cd){return handleError(_0x35071e,0x194,{'message':_0xa19b('0x31')});}else{var _0x3298a7={'payload':{'id':_0x3428cd['id'],'role':_0x3428cd['role']},'options':{'expiresIn':0x15180}};return authService[_0xa19b('0x32')](_0x3298a7)[_0xa19b('0xd')](function(_0x23c4bd){_0x35071e['json']({'id':_0x3428cd['id'],'token':_0x23c4bd,'statusCall':'','isAlreadyLogged':_0x3428cd[_0xa19b('0x33')]});});}})(_0x58900d,_0x35071e,_0x4d464d);};exports['forgot']=function(_0xeee20e,_0x1d53e8){if(!_0xeee20e[_0xa19b('0x34')][_0xa19b('0x20')]){return handleError(_0x1d53e8,0x1f4,{'message':_0xa19b('0x35')});}var _0x1a1400=rs[_0xa19b('0x36')]();_0xeee20e['body'][_0xa19b('0x20')]=_0xeee20e[_0xa19b('0x34')][_0xa19b('0x20')][_0xa19b('0x37')]()[_0xa19b('0x38')]();var _0x5199c0;return db['Setting'][_0xa19b('0xb')]({'where':{'id':0x1},'attributes':[_0xa19b('0xc'),_0xa19b('0x19')],'raw':!![]})['then'](function(_0x3c711b){_0x5199c0=_0x3c711b;return db[_0xa19b('0x39')]['find']({'where':{'email':_0xeee20e['body'][_0xa19b('0x20')]}});})[_0xa19b('0xd')](function(_0x4b6c44){if(!_0x4b6c44){throw new Error(_0xa19b('0x3a'));}if(_0x4b6c44[_0xa19b('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4b6c44[_0xa19b('0x12')]){if(moment(_0x4b6c44['blockedAt'])[_0xa19b('0x1b')](_0x5199c0['blockDuration'],_0xa19b('0x1c'))>moment()){throw new Error(_0xa19b('0x3b'));}else{_0x4b6c44[_0xa19b('0x12')]=![];_0x4b6c44[_0xa19b('0x1a')]=null;}}_0x4b6c44[_0xa19b('0x3c')]=_0x1a1400;_0x4b6c44[_0xa19b('0x3d')]=Date['now']()+0x36ee80;return _0x4b6c44[_0xa19b('0x3e')]();})[_0xa19b('0xd')](function(){return sendServiceMail({'to':_0xeee20e['body'][_0xa19b('0x20')],'subject':_0xa19b('0x3f'),'text':_0xa19b('0x40')+_0xa19b('0x41')+'https://'+_0xeee20e['headers'][_0xa19b('0x42')]+_0xa19b('0x43')+_0x1a1400+'\x0a\x0a'+_0xa19b('0x44')});})[_0xa19b('0xd')](function(){_0x1d53e8[_0xa19b('0x2d')](0xc8)[_0xa19b('0x2e')]({'message':_0xa19b('0x45')});})['catch'](function(_0x20b29d){return handleError(_0x1d53e8,0x1f4,_0x20b29d);});};exports[_0xa19b('0x46')]=function(_0xde01c9,_0x882552){return db[_0xa19b('0x39')]['find']({'where':{'resetPasswordToken':_0xde01c9[_0xa19b('0x47')][_0xa19b('0x48')],'resetPasswordExpires':{'$gt':Date[_0xa19b('0x49')]()}}})['then'](function(_0x4b579c){if(!_0x4b579c){throw new Error(_0xa19b('0x4a'));}return db[_0xa19b('0xa')]['findOne']({'attributes':['id',_0xa19b('0x4b'),_0xa19b('0x4c'),_0xa19b('0x4d')]})[_0xa19b('0xd')](function(_0x4a2d52){if(_0x4a2d52[_0xa19b('0x4b')])authService['validatePasswordPattern'](_0xde01c9[_0xa19b('0x34')][_0xa19b('0xe')]);if(!_0x4a2d52[_0xa19b('0x4c')]||!_0x4b579c[_0xa19b('0x4e')])return _0x4b579c;authService['validatePasswordHistory'](_0xde01c9[_0xa19b('0x34')][_0xa19b('0xe')],_0x4b579c[_0xa19b('0x4e')],_0x4a2d52['passwordHistoryLimit']);return _0x4b579c;})[_0xa19b('0xd')](function(){_0x4b579c[_0xa19b('0xe')]=_0xde01c9[_0xa19b('0x34')][_0xa19b('0xe')];_0x4b579c['resetPasswordToken']=null;_0x4b579c['resetPasswordExpires']=null;return _0x4b579c[_0xa19b('0x3e')]();});})[_0xa19b('0xd')](function(){_0x882552[_0xa19b('0x2d')](0xc8)[_0xa19b('0x2e')]({'message':_0xa19b('0x4f')});})[_0xa19b('0x1f')](function(_0x12afa9){return handleError(_0x882552,0x1f4,_0x12afa9);});};passport['use'](_0xa19b('0x50'),new LocalStrategy({'usernameField':_0xa19b('0x28'),'passwordField':_0xa19b('0xe')},function(_0x47cbde,_0x5ca4a1,_0x24a48b){return localAuthenticate(db['User'],_0x47cbde,_0x5ca4a1,_0x24a48b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7ea1c7d..a5a47f6 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 _0x532d=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x1ca64e,_0x1a7bdc){var _0x4319cb=function(_0x4170a3){while(--_0x4170a3){_0x1ca64e['push'](_0x1ca64e['shift']());}};_0x4319cb(++_0x1a7bdc);}(_0x532d,0x157));var _0xd532=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0x532d[_0x4eaa4c];return _0x15aec6;};'use strict';var express=require(_0xd532('0x0'));var router=express[_0xd532('0x1')]();var controller=require(_0xd532('0x2'));router[_0xd532('0x3')]('/',controller[_0xd532('0x4')]);router[_0xd532('0x3')](_0xd532('0x5'),controller[_0xd532('0x6')]);router[_0xd532('0x3')](_0xd532('0x7'),controller[_0xd532('0x8')]);module[_0xd532('0x9')]=router; \ No newline at end of file +var _0x2fa0=['exports','Router','./authLocal.controller','post','login','/forgot','reset'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0x2fa0,0x71));var _0x02fa=function(_0x1f7661,_0x415f89){_0x1f7661=_0x1f7661-0x0;var _0x5605ea=_0x2fa0[_0x1f7661];return _0x5605ea;};'use strict';var express=require('express');var router=express[_0x02fa('0x0')]();var controller=require(_0x02fa('0x1'));router[_0x02fa('0x2')]('/',controller[_0x02fa('0x3')]);router[_0x02fa('0x2')](_0x02fa('0x4'),controller['forgot']);router[_0x02fa('0x2')]('/reset/:token',controller[_0x02fa('0x5')]);module[_0x02fa('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3d2505d..0a6d4df 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 _0x34a1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1d9efc,_0x5892d7){var _0x324b21=function(_0x2257f0){while(--_0x2257f0){_0x1d9efc['push'](_0x1d9efc['shift']());}};_0x324b21(++_0x5892d7);}(_0x34a1,0xf7));var _0x134a=function(_0x2a8d8a,_0x38d93a){_0x2a8d8a=_0x2a8d8a-0x0;var _0x325fa7=_0x34a1[_0x2a8d8a];return _0x325fa7;};'use strict';var Sequelize=require(_0x134a('0x0'));module[_0x134a('0x1')]={'name':{'type':Sequelize[_0x134a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x134a('0x2')]},'description':{'type':Sequelize[_0x134a('0x2')]},'status':{'type':Sequelize[_0x134a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x2400=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x53a763,_0x1cb5ee){var _0x4ca7a2=function(_0x252483){while(--_0x252483){_0x53a763['push'](_0x53a763['shift']());}};_0x4ca7a2(++_0x1cb5ee);}(_0x2400,0xb3));var _0x0240=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x2400[_0x2a55f8];return _0x245efd;};'use strict';var Sequelize=require(_0x0240('0x0'));module[_0x0240('0x1')]={'name':{'type':Sequelize[_0x0240('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0240('0x2')]},'description':{'type':Sequelize[_0x0240('0x2')]},'status':{'type':Sequelize[_0x0240('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0240('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 fe54275..278e11a 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 _0xf6f3=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x2283e1,_0x560558){var _0x57a1ab=function(_0x576d55){while(--_0x576d55){_0x2283e1['push'](_0x2283e1['shift']());}};_0x57a1ab(++_0x560558);}(_0xf6f3,0xa1));var _0x3f6f=function(_0x589989,_0x2cfd1f){_0x589989=_0x589989-0x0;var _0x50584f=_0xf6f3[_0x589989];return _0x50584f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f6f('0x0'));var jsonpatch=require(_0x3f6f('0x1'));var rp=require(_0x3f6f('0x2'));var moment=require(_0x3f6f('0x3'));var BPromise=require(_0x3f6f('0x4'));var Mustache=require(_0x3f6f('0x5'));var util=require(_0x3f6f('0x6'));var path=require(_0x3f6f('0x7'));var sox=require(_0x3f6f('0x8'));var csv=require('to-csv');var ejs=require(_0x3f6f('0x9'));var fs=require('fs');var fs_extra=require(_0x3f6f('0xa'));var _=require(_0x3f6f('0xb'));var squel=require(_0x3f6f('0xc'));var crypto=require(_0x3f6f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f6f('0xe'));var toCsv=require(_0x3f6f('0xf'));var querystring=require(_0x3f6f('0x10'));var Papa=require(_0x3f6f('0x11'));var Redis=require('ioredis');var authService=require(_0x3f6f('0x12'));var qs=require(_0x3f6f('0x13'));var as=require(_0x3f6f('0x14'));var hardwareService=require(_0x3f6f('0x15'));var logger=require('../../config/logger')(_0x3f6f('0x16'));var utils=require(_0x3f6f('0x17'));var config=require(_0x3f6f('0x18'));var licenseUtil=require(_0x3f6f('0x19'));var db=require(_0x3f6f('0x1a'))['db'];function respondWithStatusCode(_0x1bfb66,_0x407f24){_0x407f24=_0x407f24||0xcc;return function(_0x1fd22a){if(_0x1fd22a){return _0x1bfb66['sendStatus'](_0x407f24);}return _0x1bfb66[_0x3f6f('0x1b')](_0x407f24)[_0x3f6f('0x1c')]();};}function respondWithResult(_0x5f9195,_0x2d0973){_0x2d0973=_0x2d0973||0xc8;return function(_0x2dc60d){if(_0x2dc60d){return _0x5f9195[_0x3f6f('0x1b')](_0x2d0973)['json'](_0x2dc60d);}};}function respondWithFilteredResult(_0x534b09,_0x54c5a5){return function(_0x1134c9){if(_0x1134c9){var _0x1d2424=typeof _0x54c5a5['offset']===_0x3f6f('0x1d')&&typeof _0x54c5a5[_0x3f6f('0x1e')]===_0x3f6f('0x1d');var _0x48d26d=_0x1134c9[_0x3f6f('0x1f')];var _0x22a937=_0x1d2424?0x0:_0x54c5a5['offset'];var _0x5a6ddf=_0x1d2424?_0x1134c9[_0x3f6f('0x1f')]:_0x54c5a5['offset']+_0x54c5a5[_0x3f6f('0x1e')];var _0x4912cb;if(_0x5a6ddf>=_0x48d26d){_0x5a6ddf=_0x48d26d;_0x4912cb=0xc8;}else{_0x4912cb=0xce;}_0x534b09[_0x3f6f('0x1b')](_0x4912cb);return _0x534b09[_0x3f6f('0x20')](_0x3f6f('0x21'),_0x22a937+'-'+_0x5a6ddf+'/'+_0x48d26d)[_0x3f6f('0x22')](_0x1134c9);}return null;};}function patchUpdates(_0x3e18aa){return function(_0xbf50b8){try{jsonpatch[_0x3f6f('0x23')](_0xbf50b8,_0x3e18aa,!![]);}catch(_0x5173e3){return BPromise[_0x3f6f('0x24')](_0x5173e3);}return _0xbf50b8[_0x3f6f('0x25')]();};}function saveUpdates(_0x3eef12,_0x1d516d){return function(_0x522d22){if(_0x522d22){return _0x522d22[_0x3f6f('0x26')](_0x3eef12)[_0x3f6f('0x27')](function(_0x462328){return _0x462328;});}return null;};}function removeEntity(_0x34b283,_0x5eee43){return function(_0x2c3af0){if(_0x2c3af0){return _0x2c3af0[_0x3f6f('0x28')]()[_0x3f6f('0x27')](function(){_0x34b283[_0x3f6f('0x1b')](0xcc)[_0x3f6f('0x1c')]();});}};}function handleEntityNotFound(_0x35a4b9,_0x5afb24){return function(_0x1384f0){if(!_0x1384f0){_0x35a4b9['sendStatus'](0x194);}return _0x1384f0;};}function handleError(_0x161587,_0x40e1f2){_0x40e1f2=_0x40e1f2||0x1f4;return function(_0x56817c){logger[_0x3f6f('0x29')](_0x56817c[_0x3f6f('0x2a')]);if(_0x56817c[_0x3f6f('0x2b')]){delete _0x56817c['name'];}_0x161587[_0x3f6f('0x1b')](_0x40e1f2)['send'](_0x56817c);};}exports[_0x3f6f('0x2c')]=function(_0x561cf9,_0x273ac2){var _0xfc001b={},_0x3ed003={},_0x11059c={'count':0x0,'rows':[]};var _0x3a28ef=_[_0x3f6f('0x2d')](db[_0x3f6f('0x2e')][_0x3f6f('0x2f')],function(_0x33a3a2){return{'name':_0x33a3a2[_0x3f6f('0x30')],'type':_0x33a3a2[_0x3f6f('0x31')][_0x3f6f('0x32')]};});_0x3ed003[_0x3f6f('0x33')]=_[_0x3f6f('0x2d')](_0x3a28ef,_0x3f6f('0x2b'));_0x3ed003[_0x3f6f('0x34')]=_[_0x3f6f('0x35')](_0x561cf9[_0x3f6f('0x34')]);_0x3ed003[_0x3f6f('0x36')]=_[_0x3f6f('0x37')](_0x3ed003[_0x3f6f('0x33')],_0x3ed003['query']);_0xfc001b[_0x3f6f('0x38')]=_['intersection'](_0x3ed003[_0x3f6f('0x33')],qs['fields'](_0x561cf9[_0x3f6f('0x34')][_0x3f6f('0x39')]));_0xfc001b[_0x3f6f('0x38')]=_0xfc001b['attributes'][_0x3f6f('0x3a')]?_0xfc001b['attributes']:_0x3ed003['model'];if(!_0x561cf9[_0x3f6f('0x34')][_0x3f6f('0x3b')](_0x3f6f('0x3c'))){_0xfc001b[_0x3f6f('0x1e')]=qs[_0x3f6f('0x1e')](_0x561cf9[_0x3f6f('0x34')]['limit']);_0xfc001b[_0x3f6f('0x3d')]=qs[_0x3f6f('0x3d')](_0x561cf9['query'][_0x3f6f('0x3d')]);}_0xfc001b[_0x3f6f('0x3e')]=qs[_0x3f6f('0x3f')](_0x561cf9['query'][_0x3f6f('0x3f')]);_0xfc001b['where']=qs[_0x3f6f('0x36')](_[_0x3f6f('0x40')](_0x561cf9[_0x3f6f('0x34')],_0x3ed003[_0x3f6f('0x36')]),_0x3a28ef);if(_0x561cf9[_0x3f6f('0x34')][_0x3f6f('0x41')]){_0xfc001b[_0x3f6f('0x42')]=_[_0x3f6f('0x43')](_0xfc001b[_0x3f6f('0x42')],{'$or':_[_0x3f6f('0x2d')](_0x3a28ef,function(_0x131ef3){if(_0x131ef3[_0x3f6f('0x31')]!==_0x3f6f('0x44')){var _0x388397={};_0x388397[_0x131ef3[_0x3f6f('0x2b')]]={'$like':'%'+_0x561cf9[_0x3f6f('0x34')][_0x3f6f('0x41')]+'%'};return _0x388397;}})});}_0xfc001b=_[_0x3f6f('0x43')]({},_0xfc001b,_0x561cf9[_0x3f6f('0x45')]);var _0x5a65a2={'where':_0xfc001b['where']};return db[_0x3f6f('0x2e')][_0x3f6f('0x1f')](_0x5a65a2)[_0x3f6f('0x27')](function(_0x3012f4){_0x11059c['count']=_0x3012f4;if(_0x561cf9[_0x3f6f('0x34')]['includeAll']){_0xfc001b['include']=[{'all':!![]}];}return db[_0x3f6f('0x2e')][_0x3f6f('0x46')](_0xfc001b);})[_0x3f6f('0x27')](function(_0x332a64){_0x11059c[_0x3f6f('0x47')]=_0x332a64;return _0x11059c;})['then'](respondWithFilteredResult(_0x273ac2,_0xfc001b))[_0x3f6f('0x48')](handleError(_0x273ac2,null));};exports[_0x3f6f('0x49')]=function(_0x5aff61,_0x118015){var _0x934ac4={'raw':![],'where':{'id':_0x5aff61[_0x3f6f('0x4a')]['id']}},_0x23f8bc={};_0x23f8bc[_0x3f6f('0x33')]=_[_0x3f6f('0x35')](db['Automation'][_0x3f6f('0x2f')]);_0x23f8bc[_0x3f6f('0x34')]=_[_0x3f6f('0x35')](_0x5aff61[_0x3f6f('0x34')]);_0x23f8bc[_0x3f6f('0x36')]=_['intersection'](_0x23f8bc[_0x3f6f('0x33')],_0x23f8bc[_0x3f6f('0x34')]);_0x934ac4['attributes']=_[_0x3f6f('0x37')](_0x23f8bc[_0x3f6f('0x33')],qs[_0x3f6f('0x39')](_0x5aff61['query'][_0x3f6f('0x39')]));_0x934ac4[_0x3f6f('0x38')]=_0x934ac4[_0x3f6f('0x38')][_0x3f6f('0x3a')]?_0x934ac4[_0x3f6f('0x38')]:_0x23f8bc[_0x3f6f('0x33')];if(_0x5aff61[_0x3f6f('0x34')][_0x3f6f('0x4b')]){_0x934ac4[_0x3f6f('0x4c')]=[{'all':!![]}];}_0x934ac4=_['merge']({},_0x934ac4,_0x5aff61[_0x3f6f('0x45')]);return db['Automation'][_0x3f6f('0x4d')](_0x934ac4)[_0x3f6f('0x27')](handleEntityNotFound(_0x118015,null))[_0x3f6f('0x27')](respondWithResult(_0x118015,null))['catch'](handleError(_0x118015,null));};exports['create']=function(_0x3f9a20,_0x260639){return db['Automation'][_0x3f6f('0x4e')](_0x3f9a20[_0x3f6f('0x4f')],{})['then'](respondWithResult(_0x260639,0xc9))['catch'](handleError(_0x260639,null));};exports[_0x3f6f('0x26')]=function(_0x576418,_0x3fee12){if(_0x576418[_0x3f6f('0x4f')]['id']){delete _0x576418['body']['id'];}return db['Automation'][_0x3f6f('0x4d')]({'where':{'id':_0x576418[_0x3f6f('0x4a')]['id']}})[_0x3f6f('0x27')](handleEntityNotFound(_0x3fee12,null))[_0x3f6f('0x27')](saveUpdates(_0x576418['body'],null))[_0x3f6f('0x27')](respondWithResult(_0x3fee12,null))[_0x3f6f('0x48')](handleError(_0x3fee12,null));};exports[_0x3f6f('0x28')]=function(_0x348959,_0x3ac0b2){return db['Automation'][_0x3f6f('0x4d')]({'where':{'id':_0x348959[_0x3f6f('0x4a')]['id']}})[_0x3f6f('0x27')](handleEntityNotFound(_0x3ac0b2,null))[_0x3f6f('0x27')](removeEntity(_0x3ac0b2,null))[_0x3f6f('0x48')](handleError(_0x3ac0b2,null));};exports[_0x3f6f('0x50')]=function(_0x7388ef,_0x2c567f,_0x4a91cc){return db[_0x3f6f('0x51')][_0x3f6f('0x4d')]({'where':{'id':_0x7388ef[_0x3f6f('0x4a')]['id']}})[_0x3f6f('0x27')](handleEntityNotFound(_0x2c567f,null))[_0x3f6f('0x27')](function(_0x618714){if(_0x618714){return _0x618714[_0x3f6f('0x50')](_0x7388ef[_0x3f6f('0x4f')][_0x3f6f('0x52')],_[_0x3f6f('0x53')](_0x7388ef[_0x3f6f('0x4f')],['ids','id'])||{});}})[_0x3f6f('0x27')](respondWithResult(_0x2c567f,null))[_0x3f6f('0x48')](handleError(_0x2c567f,null));};exports[_0x3f6f('0x54')]=function(_0xbdeb8c,_0x1bf24c,_0x49d175){var _0xeca6b1={};var _0x492b89={};var _0x5085fc;var _0x3d155b;return db[_0x3f6f('0x2e')][_0x3f6f('0x55')]({'where':{'id':_0xbdeb8c[_0x3f6f('0x4a')]['id']}})[_0x3f6f('0x27')](handleEntityNotFound(_0x1bf24c,null))[_0x3f6f('0x27')](function(_0x3e81b2){if(_0x3e81b2){_0x5085fc=_0x3e81b2;_0x492b89[_0x3f6f('0x33')]=_[_0x3f6f('0x35')](db[_0x3f6f('0x51')][_0x3f6f('0x2f')]);_0x492b89[_0x3f6f('0x34')]=_['keys'](_0xbdeb8c['query']);_0x492b89['filters']=_[_0x3f6f('0x37')](_0x492b89['model'],_0x492b89['query']);_0xeca6b1['attributes']=_[_0x3f6f('0x37')](_0x492b89['model'],qs[_0x3f6f('0x39')](_0xbdeb8c[_0x3f6f('0x34')][_0x3f6f('0x39')]));_0xeca6b1[_0x3f6f('0x38')]=_0xeca6b1[_0x3f6f('0x38')][_0x3f6f('0x3a')]?_0xeca6b1[_0x3f6f('0x38')]:_0x492b89[_0x3f6f('0x33')];_0xeca6b1[_0x3f6f('0x3e')]=qs['sort'](_0xbdeb8c['query'][_0x3f6f('0x3f')]);_0xeca6b1[_0x3f6f('0x42')]=qs[_0x3f6f('0x36')](_['pick'](_0xbdeb8c[_0x3f6f('0x34')],_0x492b89[_0x3f6f('0x36')]));if(_0xbdeb8c['query'][_0x3f6f('0x41')]){_0xeca6b1[_0x3f6f('0x42')]=_[_0x3f6f('0x43')](_0xeca6b1['where'],{'$or':_[_0x3f6f('0x2d')](_0xeca6b1['attributes'],function(_0x387604){var _0x5abd50={};_0x5abd50[_0x387604]={'$like':'%'+_0xbdeb8c[_0x3f6f('0x34')][_0x3f6f('0x41')]+'%'};return _0x5abd50;})});}_0xeca6b1=_[_0x3f6f('0x43')]({},_0xeca6b1,_0xbdeb8c[_0x3f6f('0x45')]);return _0x5085fc[_0x3f6f('0x54')](_0xeca6b1);}})[_0x3f6f('0x27')](function(_0x52009d){if(_0x52009d){_0x3d155b=_0x52009d['length'];if(!_0xbdeb8c['query']['hasOwnProperty'](_0x3f6f('0x3c'))){_0xeca6b1['limit']=qs[_0x3f6f('0x1e')](_0xbdeb8c[_0x3f6f('0x34')][_0x3f6f('0x1e')]);_0xeca6b1[_0x3f6f('0x3d')]=qs[_0x3f6f('0x3d')](_0xbdeb8c[_0x3f6f('0x34')][_0x3f6f('0x3d')]);}return _0x5085fc[_0x3f6f('0x54')](_0xeca6b1);}})[_0x3f6f('0x27')](function(_0x266caf){if(_0x266caf){return _0x266caf?{'count':_0x3d155b,'rows':_0x266caf}:null;}})[_0x3f6f('0x27')](respondWithResult(_0x1bf24c,null))[_0x3f6f('0x48')](handleError(_0x1bf24c,null));};exports['addActions']=function(_0x111238,_0x23e04c,_0x240287){return db[_0x3f6f('0x56')][_0x3f6f('0x4d')]({'where':{'id':_0x111238[_0x3f6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23e04c,null))[_0x3f6f('0x27')](function(_0x451cd9){if(_0x451cd9){return _0x451cd9[_0x3f6f('0x57')](_0x111238['body'][_0x3f6f('0x52')],_[_0x3f6f('0x53')](_0x111238[_0x3f6f('0x4f')],[_0x3f6f('0x52'),'id'])||{});}})[_0x3f6f('0x27')](respondWithResult(_0x23e04c,null))[_0x3f6f('0x48')](handleError(_0x23e04c,null));};exports[_0x3f6f('0x58')]=function(_0x29c93a,_0x435724,_0x1cc0ff){var _0x4f1f4b={};var _0x294cb7={};var _0x253a27;var _0x45721a;return db['Automation'][_0x3f6f('0x55')]({'where':{'id':_0x29c93a[_0x3f6f('0x4a')]['id']}})[_0x3f6f('0x27')](handleEntityNotFound(_0x435724,null))[_0x3f6f('0x27')](function(_0x1ea8d7){if(_0x1ea8d7){_0x253a27=_0x1ea8d7;_0x294cb7[_0x3f6f('0x33')]=_['keys'](db[_0x3f6f('0x56')]['rawAttributes']);_0x294cb7[_0x3f6f('0x34')]=_[_0x3f6f('0x35')](_0x29c93a['query']);_0x294cb7[_0x3f6f('0x36')]=_[_0x3f6f('0x37')](_0x294cb7[_0x3f6f('0x33')],_0x294cb7[_0x3f6f('0x34')]);_0x4f1f4b[_0x3f6f('0x38')]=_[_0x3f6f('0x37')](_0x294cb7[_0x3f6f('0x33')],qs['fields'](_0x29c93a[_0x3f6f('0x34')]['fields']));_0x4f1f4b['attributes']=_0x4f1f4b[_0x3f6f('0x38')][_0x3f6f('0x3a')]?_0x4f1f4b['attributes']:_0x294cb7['model'];_0x4f1f4b['order']=qs[_0x3f6f('0x3f')](_0x29c93a[_0x3f6f('0x34')][_0x3f6f('0x3f')]);_0x4f1f4b[_0x3f6f('0x42')]=qs[_0x3f6f('0x36')](_['pick'](_0x29c93a[_0x3f6f('0x34')],_0x294cb7[_0x3f6f('0x36')]));if(_0x29c93a[_0x3f6f('0x34')][_0x3f6f('0x41')]){_0x4f1f4b[_0x3f6f('0x42')]=_[_0x3f6f('0x43')](_0x4f1f4b[_0x3f6f('0x42')],{'$or':_[_0x3f6f('0x2d')](_0x4f1f4b[_0x3f6f('0x38')],function(_0x1fb20e){var _0x1e3119={};_0x1e3119[_0x1fb20e]={'$like':'%'+_0x29c93a[_0x3f6f('0x34')][_0x3f6f('0x41')]+'%'};return _0x1e3119;})});}_0x4f1f4b=_[_0x3f6f('0x43')]({},_0x4f1f4b,_0x29c93a[_0x3f6f('0x45')]);return _0x253a27[_0x3f6f('0x58')](_0x4f1f4b);}})[_0x3f6f('0x27')](function(_0x2dabe8){if(_0x2dabe8){_0x45721a=_0x2dabe8[_0x3f6f('0x3a')];if(!_0x29c93a[_0x3f6f('0x34')][_0x3f6f('0x3b')](_0x3f6f('0x3c'))){_0x4f1f4b['limit']=qs[_0x3f6f('0x1e')](_0x29c93a['query'][_0x3f6f('0x1e')]);_0x4f1f4b[_0x3f6f('0x3d')]=qs[_0x3f6f('0x3d')](_0x29c93a[_0x3f6f('0x34')][_0x3f6f('0x3d')]);}return _0x253a27['getActions'](_0x4f1f4b);}})['then'](function(_0x51d1df){if(_0x51d1df){return _0x51d1df?{'count':_0x45721a,'rows':_0x51d1df}:null;}})['then'](respondWithResult(_0x435724,null))[_0x3f6f('0x48')](handleError(_0x435724,null));}; \ No newline at end of file +var _0xebed=['end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','omit','ids','getConditions','findOne','Condition','Action','addActions','getActions','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x21586f,_0x4bcf74){var _0x620124=function(_0x50f2eb){while(--_0x50f2eb){_0x21586f['push'](_0x21586f['shift']());}};_0x620124(++_0x4bcf74);}(_0xebed,0x143));var _0xdebe=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xebed[_0xc67528];return _0x38e26d;};'use strict';var emlformat=require(_0xdebe('0x0'));var rimraf=require(_0xdebe('0x1'));var zipdir=require(_0xdebe('0x2'));var jsonpatch=require(_0xdebe('0x3'));var rp=require('request-promise');var moment=require(_0xdebe('0x4'));var BPromise=require(_0xdebe('0x5'));var Mustache=require(_0xdebe('0x6'));var util=require(_0xdebe('0x7'));var path=require(_0xdebe('0x8'));var sox=require(_0xdebe('0x9'));var csv=require(_0xdebe('0xa'));var ejs=require(_0xdebe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdebe('0xc'));var squel=require('squel');var crypto=require(_0xdebe('0xd'));var jsforce=require(_0xdebe('0xe'));var deskjs=require(_0xdebe('0xf'));var toCsv=require(_0xdebe('0xa'));var querystring=require(_0xdebe('0x10'));var Papa=require('papaparse');var Redis=require(_0xdebe('0x11'));var authService=require(_0xdebe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdebe('0x13'));var hardwareService=require(_0xdebe('0x14'));var logger=require(_0xdebe('0x15'))(_0xdebe('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdebe('0x17'));var db=require(_0xdebe('0x18'))['db'];function respondWithStatusCode(_0x4744d9,_0x4b4b67){_0x4b4b67=_0x4b4b67||0xcc;return function(_0x4d0b2f){if(_0x4d0b2f){return _0x4744d9['sendStatus'](_0x4b4b67);}return _0x4744d9['status'](_0x4b4b67)[_0xdebe('0x19')]();};}function respondWithResult(_0x58fe6c,_0x3bd8c9){_0x3bd8c9=_0x3bd8c9||0xc8;return function(_0x1bf1ae){if(_0x1bf1ae){return _0x58fe6c[_0xdebe('0x1a')](_0x3bd8c9)[_0xdebe('0x1b')](_0x1bf1ae);}};}function respondWithFilteredResult(_0x14dfe7,_0x2ed283){return function(_0x147f74){if(_0x147f74){var _0x59b43a=typeof _0x2ed283[_0xdebe('0x1c')]==='undefined'&&typeof _0x2ed283['limit']===_0xdebe('0x1d');var _0x178b2a=_0x147f74[_0xdebe('0x1e')];var _0x3dd14f=_0x59b43a?0x0:_0x2ed283[_0xdebe('0x1c')];var _0x32c772=_0x59b43a?_0x147f74[_0xdebe('0x1e')]:_0x2ed283['offset']+_0x2ed283[_0xdebe('0x1f')];var _0x829dcf;if(_0x32c772>=_0x178b2a){_0x32c772=_0x178b2a;_0x829dcf=0xc8;}else{_0x829dcf=0xce;}_0x14dfe7['status'](_0x829dcf);return _0x14dfe7[_0xdebe('0x20')](_0xdebe('0x21'),_0x3dd14f+'-'+_0x32c772+'/'+_0x178b2a)[_0xdebe('0x1b')](_0x147f74);}return null;};}function patchUpdates(_0x23e4fd){return function(_0x2f7376){try{jsonpatch[_0xdebe('0x22')](_0x2f7376,_0x23e4fd,!![]);}catch(_0x526928){return BPromise[_0xdebe('0x23')](_0x526928);}return _0x2f7376[_0xdebe('0x24')]();};}function saveUpdates(_0xed1af6,_0x41d589){return function(_0x4af8a1){if(_0x4af8a1){return _0x4af8a1[_0xdebe('0x25')](_0xed1af6)[_0xdebe('0x26')](function(_0x25b0c6){return _0x25b0c6;});}return null;};}function removeEntity(_0x5b10f6,_0x24e6ec){return function(_0x5df31f){if(_0x5df31f){return _0x5df31f[_0xdebe('0x27')]()['then'](function(){_0x5b10f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32527c,_0x4d54a3){return function(_0x187691){if(!_0x187691){_0x32527c['sendStatus'](0x194);}return _0x187691;};}function handleError(_0x6088b4,_0xfcc0b5){_0xfcc0b5=_0xfcc0b5||0x1f4;return function(_0x316ded){logger[_0xdebe('0x28')](_0x316ded[_0xdebe('0x29')]);if(_0x316ded[_0xdebe('0x2a')]){delete _0x316ded[_0xdebe('0x2a')];}_0x6088b4[_0xdebe('0x1a')](_0xfcc0b5)[_0xdebe('0x2b')](_0x316ded);};}exports[_0xdebe('0x2c')]=function(_0x1122b5,_0x52e80a){var _0x10843c={},_0x243100={},_0x10a6a6={'count':0x0,'rows':[]};var _0x218cec=_['map'](db[_0xdebe('0x2d')][_0xdebe('0x2e')],function(_0x3a284f){return{'name':_0x3a284f[_0xdebe('0x2f')],'type':_0x3a284f['type'][_0xdebe('0x30')]};});_0x243100['model']=_['map'](_0x218cec,_0xdebe('0x2a'));_0x243100[_0xdebe('0x31')]=_[_0xdebe('0x32')](_0x1122b5[_0xdebe('0x31')]);_0x243100[_0xdebe('0x33')]=_['intersection'](_0x243100['model'],_0x243100['query']);_0x10843c[_0xdebe('0x34')]=_[_0xdebe('0x35')](_0x243100[_0xdebe('0x36')],qs[_0xdebe('0x37')](_0x1122b5[_0xdebe('0x31')][_0xdebe('0x37')]));_0x10843c[_0xdebe('0x34')]=_0x10843c['attributes']['length']?_0x10843c['attributes']:_0x243100[_0xdebe('0x36')];if(!_0x1122b5['query'][_0xdebe('0x38')](_0xdebe('0x39'))){_0x10843c[_0xdebe('0x1f')]=qs['limit'](_0x1122b5[_0xdebe('0x31')][_0xdebe('0x1f')]);_0x10843c[_0xdebe('0x1c')]=qs['offset'](_0x1122b5['query']['offset']);}_0x10843c['order']=qs[_0xdebe('0x3a')](_0x1122b5[_0xdebe('0x31')][_0xdebe('0x3a')]);_0x10843c['where']=qs[_0xdebe('0x33')](_[_0xdebe('0x3b')](_0x1122b5[_0xdebe('0x31')],_0x243100['filters']),_0x218cec);if(_0x1122b5['query'][_0xdebe('0x3c')]){_0x10843c[_0xdebe('0x3d')]=_[_0xdebe('0x3e')](_0x10843c[_0xdebe('0x3d')],{'$or':_[_0xdebe('0x3f')](_0x218cec,function(_0x379079){if(_0x379079[_0xdebe('0x40')]!==_0xdebe('0x41')){var _0x585855={};_0x585855[_0x379079[_0xdebe('0x2a')]]={'$like':'%'+_0x1122b5[_0xdebe('0x31')][_0xdebe('0x3c')]+'%'};return _0x585855;}})});}_0x10843c=_[_0xdebe('0x3e')]({},_0x10843c,_0x1122b5[_0xdebe('0x42')]);var _0x3e3866={'where':_0x10843c[_0xdebe('0x3d')]};return db[_0xdebe('0x2d')][_0xdebe('0x1e')](_0x3e3866)['then'](function(_0x5d7028){_0x10a6a6[_0xdebe('0x1e')]=_0x5d7028;if(_0x1122b5[_0xdebe('0x31')][_0xdebe('0x43')]){_0x10843c[_0xdebe('0x44')]=[{'all':!![]}];}return db[_0xdebe('0x2d')][_0xdebe('0x45')](_0x10843c);})[_0xdebe('0x26')](function(_0x2c60f6){_0x10a6a6[_0xdebe('0x46')]=_0x2c60f6;return _0x10a6a6;})['then'](respondWithFilteredResult(_0x52e80a,_0x10843c))[_0xdebe('0x47')](handleError(_0x52e80a,null));};exports[_0xdebe('0x48')]=function(_0xd4e7cf,_0x2165d3){var _0x46fc8d={'raw':![],'where':{'id':_0xd4e7cf[_0xdebe('0x49')]['id']}},_0x38b086={};_0x38b086[_0xdebe('0x36')]=_[_0xdebe('0x32')](db['Automation'][_0xdebe('0x2e')]);_0x38b086[_0xdebe('0x31')]=_['keys'](_0xd4e7cf[_0xdebe('0x31')]);_0x38b086[_0xdebe('0x33')]=_[_0xdebe('0x35')](_0x38b086[_0xdebe('0x36')],_0x38b086[_0xdebe('0x31')]);_0x46fc8d[_0xdebe('0x34')]=_[_0xdebe('0x35')](_0x38b086[_0xdebe('0x36')],qs['fields'](_0xd4e7cf['query'][_0xdebe('0x37')]));_0x46fc8d['attributes']=_0x46fc8d[_0xdebe('0x34')][_0xdebe('0x4a')]?_0x46fc8d[_0xdebe('0x34')]:_0x38b086[_0xdebe('0x36')];if(_0xd4e7cf[_0xdebe('0x31')][_0xdebe('0x43')]){_0x46fc8d[_0xdebe('0x44')]=[{'all':!![]}];}_0x46fc8d=_[_0xdebe('0x3e')]({},_0x46fc8d,_0xd4e7cf['options']);return db['Automation'][_0xdebe('0x4b')](_0x46fc8d)[_0xdebe('0x26')](handleEntityNotFound(_0x2165d3,null))[_0xdebe('0x26')](respondWithResult(_0x2165d3,null))['catch'](handleError(_0x2165d3,null));};exports[_0xdebe('0x4c')]=function(_0x43bd56,_0x13e30c){return db[_0xdebe('0x2d')][_0xdebe('0x4c')](_0x43bd56[_0xdebe('0x4d')],{})[_0xdebe('0x26')](respondWithResult(_0x13e30c,0xc9))[_0xdebe('0x47')](handleError(_0x13e30c,null));};exports[_0xdebe('0x25')]=function(_0x44612c,_0x36214f){if(_0x44612c[_0xdebe('0x4d')]['id']){delete _0x44612c['body']['id'];}return db['Automation'][_0xdebe('0x4b')]({'where':{'id':_0x44612c[_0xdebe('0x49')]['id']}})[_0xdebe('0x26')](handleEntityNotFound(_0x36214f,null))[_0xdebe('0x26')](saveUpdates(_0x44612c[_0xdebe('0x4d')],null))[_0xdebe('0x26')](respondWithResult(_0x36214f,null))[_0xdebe('0x47')](handleError(_0x36214f,null));};exports[_0xdebe('0x27')]=function(_0x387c9b,_0x32d998){return db[_0xdebe('0x2d')][_0xdebe('0x4b')]({'where':{'id':_0x387c9b['params']['id']}})[_0xdebe('0x26')](handleEntityNotFound(_0x32d998,null))[_0xdebe('0x26')](removeEntity(_0x32d998,null))[_0xdebe('0x47')](handleError(_0x32d998,null));};exports['addConditions']=function(_0x5f1dff,_0x1bd56b,_0x476a1c){return db['Condition'][_0xdebe('0x4b')]({'where':{'id':_0x5f1dff[_0xdebe('0x49')]['id']}})[_0xdebe('0x26')](handleEntityNotFound(_0x1bd56b,null))[_0xdebe('0x26')](function(_0x42aad6){if(_0x42aad6){return _0x42aad6['addConditions'](_0x5f1dff[_0xdebe('0x4d')]['ids'],_[_0xdebe('0x4e')](_0x5f1dff['body'],[_0xdebe('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x1bd56b,null))[_0xdebe('0x47')](handleError(_0x1bd56b,null));};exports[_0xdebe('0x50')]=function(_0x36b548,_0x114bee,_0x3e9e0a){var _0x47bb48={};var _0x5d414d={};var _0xe2e3c3;var _0x5af77f;return db[_0xdebe('0x2d')][_0xdebe('0x51')]({'where':{'id':_0x36b548[_0xdebe('0x49')]['id']}})[_0xdebe('0x26')](handleEntityNotFound(_0x114bee,null))[_0xdebe('0x26')](function(_0x1054e5){if(_0x1054e5){_0xe2e3c3=_0x1054e5;_0x5d414d[_0xdebe('0x36')]=_[_0xdebe('0x32')](db[_0xdebe('0x52')][_0xdebe('0x2e')]);_0x5d414d[_0xdebe('0x31')]=_[_0xdebe('0x32')](_0x36b548['query']);_0x5d414d[_0xdebe('0x33')]=_['intersection'](_0x5d414d[_0xdebe('0x36')],_0x5d414d[_0xdebe('0x31')]);_0x47bb48['attributes']=_[_0xdebe('0x35')](_0x5d414d[_0xdebe('0x36')],qs[_0xdebe('0x37')](_0x36b548[_0xdebe('0x31')][_0xdebe('0x37')]));_0x47bb48[_0xdebe('0x34')]=_0x47bb48[_0xdebe('0x34')][_0xdebe('0x4a')]?_0x47bb48['attributes']:_0x5d414d['model'];_0x47bb48['order']=qs[_0xdebe('0x3a')](_0x36b548[_0xdebe('0x31')][_0xdebe('0x3a')]);_0x47bb48[_0xdebe('0x3d')]=qs[_0xdebe('0x33')](_[_0xdebe('0x3b')](_0x36b548[_0xdebe('0x31')],_0x5d414d[_0xdebe('0x33')]));if(_0x36b548[_0xdebe('0x31')][_0xdebe('0x3c')]){_0x47bb48[_0xdebe('0x3d')]=_[_0xdebe('0x3e')](_0x47bb48['where'],{'$or':_['map'](_0x47bb48[_0xdebe('0x34')],function(_0x518633){var _0x337b3b={};_0x337b3b[_0x518633]={'$like':'%'+_0x36b548[_0xdebe('0x31')][_0xdebe('0x3c')]+'%'};return _0x337b3b;})});}_0x47bb48=_[_0xdebe('0x3e')]({},_0x47bb48,_0x36b548[_0xdebe('0x42')]);return _0xe2e3c3[_0xdebe('0x50')](_0x47bb48);}})[_0xdebe('0x26')](function(_0x1e276a){if(_0x1e276a){_0x5af77f=_0x1e276a['length'];if(!_0x36b548[_0xdebe('0x31')][_0xdebe('0x38')](_0xdebe('0x39'))){_0x47bb48['limit']=qs[_0xdebe('0x1f')](_0x36b548[_0xdebe('0x31')]['limit']);_0x47bb48[_0xdebe('0x1c')]=qs[_0xdebe('0x1c')](_0x36b548[_0xdebe('0x31')][_0xdebe('0x1c')]);}return _0xe2e3c3[_0xdebe('0x50')](_0x47bb48);}})[_0xdebe('0x26')](function(_0x25b4d8){if(_0x25b4d8){return _0x25b4d8?{'count':_0x5af77f,'rows':_0x25b4d8}:null;}})[_0xdebe('0x26')](respondWithResult(_0x114bee,null))[_0xdebe('0x47')](handleError(_0x114bee,null));};exports['addActions']=function(_0x458d0f,_0xda183d,_0xeabe37){return db[_0xdebe('0x53')][_0xdebe('0x4b')]({'where':{'id':_0x458d0f[_0xdebe('0x49')]['id']}})['then'](handleEntityNotFound(_0xda183d,null))[_0xdebe('0x26')](function(_0x436b38){if(_0x436b38){return _0x436b38[_0xdebe('0x54')](_0x458d0f[_0xdebe('0x4d')][_0xdebe('0x4f')],_[_0xdebe('0x4e')](_0x458d0f[_0xdebe('0x4d')],[_0xdebe('0x4f'),'id'])||{});}})['then'](respondWithResult(_0xda183d,null))[_0xdebe('0x47')](handleError(_0xda183d,null));};exports[_0xdebe('0x55')]=function(_0x16cf61,_0x4b0de3,_0x5dd01c){var _0x6631fd={};var _0x3a008f={};var _0x431b30;var _0x1078fc;return db[_0xdebe('0x2d')][_0xdebe('0x51')]({'where':{'id':_0x16cf61[_0xdebe('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b0de3,null))[_0xdebe('0x26')](function(_0x49dd9c){if(_0x49dd9c){_0x431b30=_0x49dd9c;_0x3a008f[_0xdebe('0x36')]=_['keys'](db[_0xdebe('0x53')]['rawAttributes']);_0x3a008f[_0xdebe('0x31')]=_[_0xdebe('0x32')](_0x16cf61[_0xdebe('0x31')]);_0x3a008f[_0xdebe('0x33')]=_[_0xdebe('0x35')](_0x3a008f[_0xdebe('0x36')],_0x3a008f[_0xdebe('0x31')]);_0x6631fd[_0xdebe('0x34')]=_[_0xdebe('0x35')](_0x3a008f['model'],qs[_0xdebe('0x37')](_0x16cf61[_0xdebe('0x31')][_0xdebe('0x37')]));_0x6631fd[_0xdebe('0x34')]=_0x6631fd[_0xdebe('0x34')][_0xdebe('0x4a')]?_0x6631fd['attributes']:_0x3a008f[_0xdebe('0x36')];_0x6631fd[_0xdebe('0x56')]=qs[_0xdebe('0x3a')](_0x16cf61[_0xdebe('0x31')]['sort']);_0x6631fd[_0xdebe('0x3d')]=qs[_0xdebe('0x33')](_[_0xdebe('0x3b')](_0x16cf61['query'],_0x3a008f['filters']));if(_0x16cf61[_0xdebe('0x31')][_0xdebe('0x3c')]){_0x6631fd[_0xdebe('0x3d')]=_[_0xdebe('0x3e')](_0x6631fd[_0xdebe('0x3d')],{'$or':_[_0xdebe('0x3f')](_0x6631fd[_0xdebe('0x34')],function(_0x3a6de8){var _0x4c6788={};_0x4c6788[_0x3a6de8]={'$like':'%'+_0x16cf61['query']['filter']+'%'};return _0x4c6788;})});}_0x6631fd=_[_0xdebe('0x3e')]({},_0x6631fd,_0x16cf61[_0xdebe('0x42')]);return _0x431b30[_0xdebe('0x55')](_0x6631fd);}})[_0xdebe('0x26')](function(_0x4ce5ae){if(_0x4ce5ae){_0x1078fc=_0x4ce5ae[_0xdebe('0x4a')];if(!_0x16cf61[_0xdebe('0x31')][_0xdebe('0x38')]('nolimit')){_0x6631fd[_0xdebe('0x1f')]=qs[_0xdebe('0x1f')](_0x16cf61[_0xdebe('0x31')][_0xdebe('0x1f')]);_0x6631fd[_0xdebe('0x1c')]=qs['offset'](_0x16cf61[_0xdebe('0x31')][_0xdebe('0x1c')]);}return _0x431b30[_0xdebe('0x55')](_0x6631fd);}})[_0xdebe('0x26')](function(_0x98c123){if(_0x98c123){return _0x98c123?{'count':_0x1078fc,'rows':_0x98c123}:null;}})['then'](respondWithResult(_0x4b0de3,null))[_0xdebe('0x47')](handleError(_0x4b0de3,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 51613fa..0736479 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 _0x9779=['../../config/logger','api','moment','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations'];(function(_0x4e3b9c,_0x4d76a3){var _0x358b13=function(_0x2409d6){while(--_0x2409d6){_0x4e3b9c['push'](_0x4e3b9c['shift']());}};_0x358b13(++_0x4d76a3);}(_0x9779,0x129));var _0x9977=function(_0x4284b9,_0x3e1727){_0x4284b9=_0x4284b9-0x0;var _0x353af6=_0x9779[_0x4284b9];return _0x353af6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9977('0x0'))(_0x9977('0x1'));var moment=require(_0x9977('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9977('0x3'));var config=require(_0x9977('0x4'));var attributes=require(_0x9977('0x5'));module[_0x9977('0x6')]=function(_0x10213f,_0x5d06d2){return _0x10213f['define'](_0x9977('0x7'),attributes,{'tableName':_0x9977('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90d9=['exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./automation.attributes'];(function(_0x41a154,_0x15c5d2){var _0x5b9819=function(_0x1d8ce5){while(--_0x1d8ce5){_0x41a154['push'](_0x41a154['shift']());}};_0x5b9819(++_0x15c5d2);}(_0x90d9,0x1d7));var _0x990d=function(_0x18b374,_0x371c93){_0x18b374=_0x18b374-0x0;var _0x50a999=_0x90d9[_0x18b374];return _0x50a999;};'use strict';var _=require(_0x990d('0x0'));var util=require(_0x990d('0x1'));var logger=require(_0x990d('0x2'))(_0x990d('0x3'));var moment=require(_0x990d('0x4'));var BPromise=require(_0x990d('0x5'));var rp=require(_0x990d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x990d('0x7'));var config=require('../../config/environment');var attributes=require(_0x990d('0x8'));module[_0x990d('0x9')]=function(_0x22955a,_0x306f1d){return _0x22955a[_0x990d('0xa')]('Automation',attributes,{'tableName':_0x990d('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 4e6a38c..9c8a34d 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 _0x5942=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d151d,_0x2d6f25){var _0x232cec=function(_0x35ce18){while(--_0x35ce18){_0x3d151d['push'](_0x3d151d['shift']());}};_0x232cec(++_0x2d6f25);}(_0x5942,0x16a));var _0x2594=function(_0x4440dc,_0x4e12ca){_0x4440dc=_0x4440dc-0x0;var _0x28beda=_0x5942[_0x4440dc];return _0x28beda;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var moment=require(_0x2594('0x2'));var BPromise=require(_0x2594('0x3'));var rs=require(_0x2594('0x4'));var fs=require('fs');var Redis=require(_0x2594('0x5'));var db=require(_0x2594('0x6'))['db'];var utils=require(_0x2594('0x7'));var logger=require(_0x2594('0x8'))(_0x2594('0x9'));var config=require(_0x2594('0xa'));var jayson=require(_0x2594('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381472,_0xd0ada5,_0x3d20aa){return new BPromise(function(_0x5707a0,_0x2b42d3){return client[_0x2594('0xc')](_0x381472,_0x3d20aa)['then'](function(_0x29517f){logger['info'](_0x2594('0xd'),_0xd0ada5,_0x2594('0xe'));logger[_0x2594('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0xd0ada5,_0x2594('0xe'),JSON[_0x2594('0x10')](_0x29517f));if(_0x29517f[_0x2594('0x11')]){if(_0x29517f[_0x2594('0x11')]['code']===0x1f4){logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);return _0x2b42d3(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')]['message']);return _0x5707a0(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}else{logger['info'](_0x2594('0xd'),_0xd0ada5,'request\x20sent');_0x5707a0(_0x29517f[_0x2594('0x13')][_0x2594('0x12')]);}})[_0x2594('0x14')](function(_0x33b4bc){logger[_0x2594('0x11')]('Automation,\x20%s,\x20%s',_0xd0ada5,_0x33b4bc);_0x2b42d3(_0x33b4bc);});});} \ No newline at end of file +var _0xf55c=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56babc,_0x363e8e){var _0x2168be=function(_0x1b4ce0){while(--_0x1b4ce0){_0x56babc['push'](_0x56babc['shift']());}};_0x2168be(++_0x363e8e);}(_0xf55c,0x1e7));var _0xcf55=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xf55c[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var moment=require(_0xcf55('0x1'));var BPromise=require(_0xcf55('0x2'));var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require(_0xcf55('0x4'));var db=require(_0xcf55('0x5'))['db'];var utils=require(_0xcf55('0x6'));var logger=require(_0xcf55('0x7'))('rpc');var config=require(_0xcf55('0x8'));var jayson=require(_0xcf55('0x9'));var client=jayson[_0xcf55('0xa')][_0xcf55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b3453,_0x29566b,_0x53deb4){return new BPromise(function(_0x7003f1,_0x3018aa){return client['request'](_0x4b3453,_0x53deb4)[_0xcf55('0xc')](function(_0x3ce5d2){logger[_0xcf55('0xd')](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));logger[_0xcf55('0x10')](_0xcf55('0x11'),_0x29566b,'request\x20sent',JSON[_0xcf55('0x12')](_0x3ce5d2));if(_0x3ce5d2[_0xcf55('0x13')]){if(_0x3ce5d2['error']['code']===0x1f4){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x3018aa(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x7003f1(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}else{logger['info'](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));_0x7003f1(_0x3ce5d2[_0xcf55('0x15')][_0xcf55('0x14')]);}})[_0xcf55('0x16')](function(_0x4b0c1a){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x4b0c1a);_0x3018aa(_0x4b0c1a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c9adb48..f88b328 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 _0x1dd4=['post','create','put','update','delete','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0xe053aa,_0x23e4fa){var _0x4ec783=function(_0xe1d0d5){while(--_0xe1d0d5){_0xe053aa['push'](_0xe053aa['shift']());}};_0x4ec783(++_0x23e4fa);}(_0x1dd4,0x1a9));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x41dd('0x0'));var express=require(_0x41dd('0x1'));var router=express[_0x41dd('0x2')]();var fs_extra=require(_0x41dd('0x3'));var auth=require(_0x41dd('0x4'));var interaction=require(_0x41dd('0x5'));var config=require(_0x41dd('0x6'));var controller=require('./automation.controller');router[_0x41dd('0x7')]('/',auth[_0x41dd('0x8')](),controller[_0x41dd('0x9')]);router[_0x41dd('0x7')](_0x41dd('0xa'),auth[_0x41dd('0x8')](),controller['show']);router[_0x41dd('0x7')](_0x41dd('0xb'),auth[_0x41dd('0x8')](),controller[_0x41dd('0xc')]);router[_0x41dd('0x7')](_0x41dd('0xd'),auth[_0x41dd('0x8')](),controller[_0x41dd('0xe')]);router[_0x41dd('0xf')]('/',auth[_0x41dd('0x8')](),controller[_0x41dd('0x10')]);router[_0x41dd('0xf')]('/:id/conditions',auth[_0x41dd('0x8')](),controller['addConditions']);router[_0x41dd('0xf')]('/:id/actions',auth[_0x41dd('0x8')](),controller['addActions']);router[_0x41dd('0x11')](_0x41dd('0xa'),auth['isAuthenticated'](),controller[_0x41dd('0x12')]);router[_0x41dd('0x13')](_0x41dd('0xa'),auth[_0x41dd('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9c5b=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','isAuthenticated','show','/:id/actions','getActions','post','/:id/conditions','addConditions','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0x9c5b,0x1cb));var _0xb9c5=function(_0x59c874,_0x4a487e){_0x59c874=_0x59c874-0x0;var _0x407a5c=_0x9c5b[_0x59c874];return _0x407a5c;};'use strict';var multer=require(_0xb9c5('0x0'));var util=require('util');var path=require(_0xb9c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xb9c5('0x2'));var router=express[_0xb9c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9c5('0x4'));var interaction=require(_0xb9c5('0x5'));var config=require(_0xb9c5('0x6'));var controller=require(_0xb9c5('0x7'));router[_0xb9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xb9c5('0x9')]);router[_0xb9c5('0x8')]('/:id',auth[_0xb9c5('0xa')](),controller[_0xb9c5('0xb')]);router[_0xb9c5('0x8')]('/:id/conditions',auth[_0xb9c5('0xa')](),controller['getConditions']);router['get'](_0xb9c5('0xc'),auth['isAuthenticated'](),controller[_0xb9c5('0xd')]);router[_0xb9c5('0xe')]('/',auth[_0xb9c5('0xa')](),controller['create']);router[_0xb9c5('0xe')](_0xb9c5('0xf'),auth[_0xb9c5('0xa')](),controller[_0xb9c5('0x10')]);router[_0xb9c5('0xe')]('/:id/actions',auth[_0xb9c5('0xa')](),controller['addActions']);router[_0xb9c5('0x11')](_0xb9c5('0x12'),auth[_0xb9c5('0xa')](),controller[_0xb9c5('0x13')]);router[_0xb9c5('0x14')](_0xb9c5('0x12'),auth['isAuthenticated'](),controller[_0xb9c5('0x15')]);module[_0xb9c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7729b06..516cbc4 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 _0xf041=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x7526b7,_0xe0597e){var _0x3a1c3d=function(_0x557daa){while(--_0x557daa){_0x7526b7['push'](_0x7526b7['shift']());}};_0x3a1c3d(++_0xe0597e);}(_0xf041,0x1d5));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1f04('0x0'));module[_0x1f04('0x1')]={'name':{'type':Sequelize[_0x1f04('0x2')],'unique':_0x1f04('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1f04('0x4')),'allowNull':![],'defaultValue':_0x1f04('0x4')},'description':{'type':Sequelize[_0x1f04('0x2')]},'active':{'type':Sequelize[_0x1f04('0x5')],'defaultValue':0x0,'comment':_0x1f04('0x6')},'limitCalls':{'type':Sequelize[_0x1f04('0x7')](0x4)[_0x1f04('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1f04('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f04('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f04('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1f04('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1f04('0xf')},'dialTimezone':{'type':Sequelize[_0x1f04('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1f04('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1f04('0x10')](_0x1f04('0x11'),_0x1f04('0x12'),_0x1f04('0x13')),'defaultValue':_0x1f04('0x11')},'dialAMDActive':{'type':Sequelize[_0x1f04('0x5')],'defaultValue':0x0,'comment':_0x1f04('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1f04('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1f04('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f04('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f04('0x18')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1f04('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f04('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f04('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1f04('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1f04('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f04('0x7')](0x9)[_0x1f04('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f04('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1f04('0x10')]('DESC','ASC'),'defaultValue':_0x1f04('0x1d')},'dialPrefix':{'type':Sequelize[_0x1f04('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f04('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x1f04('0x7')](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f04('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f04('0x7')](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f04('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1f04('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f04('0x25')}}; \ No newline at end of file +var _0x8880=['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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','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)','#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','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x213756,_0x56dbfd){var _0x5518f5=function(_0x120c6a){while(--_0x120c6a){_0x213756['push'](_0x213756['shift']());}};_0x5518f5(++_0x56dbfd);}(_0x8880,0xb5));var _0x0888=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x8880[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require('sequelize');module[_0x0888('0x0')]={'name':{'type':Sequelize[_0x0888('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0888('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x0888('0x3')},'description':{'type':Sequelize[_0x0888('0x1')]},'active':{'type':Sequelize[_0x0888('0x4')],'defaultValue':0x0,'comment':_0x0888('0x5')},'limitCalls':{'type':Sequelize[_0x0888('0x6')](0x4)[_0x0888('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0888('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0888('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0888('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0888('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0888('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0888('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)[_0x0888('0x7')],'defaultValue':0x3,'comment':_0x0888('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0888('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0888('0xf')},'dialTimezone':{'type':Sequelize[_0x0888('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0888('0x1')],'defaultValue':_0x0888('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x0888('0x2')](_0x0888('0x11'),'never',_0x0888('0x12')),'defaultValue':_0x0888('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0888('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x0888('0x6')](0x9)[_0x0888('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0888('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0888('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0888('0x6')](0x9)[_0x0888('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0888('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0888('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0888('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x0888('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0888('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0888('0x6')](0x9)[_0x0888('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0888('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0888('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0888('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0888('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0888('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0888('0x2')](_0x0888('0x1a'),_0x0888('0x1b')),'defaultValue':_0x0888('0x1a')},'dialPrefix':{'type':Sequelize[_0x0888('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0888('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0888('0x1c')},'dialCutDigit':{'type':Sequelize[_0x0888('0x6')](0x3)[_0x0888('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0888('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)[_0x0888('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0888('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)[_0x0888('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0888('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0888('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0888('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0888('0x6')](0x5)[_0x0888('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0888('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 992b7f4..9af7fdd 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 _0x6dcd=['ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','CmList','getBlackLists','addBlackLists','push','removeBlackLists','rimraf','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','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','createdAt','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item'];(function(_0x196154,_0x315041){var _0x1e355c=function(_0x19e74e){while(--_0x19e74e){_0x196154['push'](_0x196154['shift']());}};_0x1e355c(++_0x315041);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x6dcd[_0x397bfb];return _0x16c9b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6dc('0x1'));var rp=require(_0xd6dc('0x2'));var moment=require(_0xd6dc('0x3'));var BPromise=require(_0xd6dc('0x4'));var Mustache=require(_0xd6dc('0x5'));var util=require(_0xd6dc('0x6'));var path=require(_0xd6dc('0x7'));var sox=require(_0xd6dc('0x8'));var csv=require(_0xd6dc('0x9'));var ejs=require(_0xd6dc('0xa'));var fs=require('fs');var fs_extra=require(_0xd6dc('0xb'));var _=require(_0xd6dc('0xc'));var squel=require(_0xd6dc('0xd'));var crypto=require(_0xd6dc('0xe'));var jsforce=require(_0xd6dc('0xf'));var deskjs=require(_0xd6dc('0x10'));var toCsv=require(_0xd6dc('0x9'));var querystring=require('querystring');var Papa=require(_0xd6dc('0x11'));var Redis=require(_0xd6dc('0x12'));var authService=require(_0xd6dc('0x13'));var qs=require(_0xd6dc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6dc('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd6dc('0x16'));var licenseUtil=require(_0xd6dc('0x17'));var db=require(_0xd6dc('0x18'))['db'];function respondWithStatusCode(_0x5e94b3,_0x5d88f1){_0x5d88f1=_0x5d88f1||0xcc;return function(_0x3de00e){if(_0x3de00e){return _0x5e94b3[_0xd6dc('0x19')](_0x5d88f1);}return _0x5e94b3[_0xd6dc('0x1a')](_0x5d88f1)['end']();};}function respondWithResult(_0x40bd2c,_0x36722c){_0x36722c=_0x36722c||0xc8;return function(_0x5cb281){if(_0x5cb281){return _0x40bd2c[_0xd6dc('0x1a')](_0x36722c)[_0xd6dc('0x1b')](_0x5cb281);}};}function respondWithFilteredResult(_0x4c2347,_0x310868){return function(_0x1ef068){if(_0x1ef068){var _0x453bc4=typeof _0x310868[_0xd6dc('0x1c')]===_0xd6dc('0x1d')&&typeof _0x310868[_0xd6dc('0x1e')]===_0xd6dc('0x1d');var _0x1ed47b=_0x1ef068[_0xd6dc('0x1f')];var _0x4baa71=_0x453bc4?0x0:_0x310868[_0xd6dc('0x1c')];var _0xd99b5b=_0x453bc4?_0x1ef068[_0xd6dc('0x1f')]:_0x310868['offset']+_0x310868[_0xd6dc('0x1e')];var _0xf4982e;if(_0xd99b5b>=_0x1ed47b){_0xd99b5b=_0x1ed47b;_0xf4982e=0xc8;}else{_0xf4982e=0xce;}_0x4c2347[_0xd6dc('0x1a')](_0xf4982e);return _0x4c2347[_0xd6dc('0x20')](_0xd6dc('0x21'),_0x4baa71+'-'+_0xd99b5b+'/'+_0x1ed47b)[_0xd6dc('0x1b')](_0x1ef068);}return null;};}function patchUpdates(_0xde1b12){return function(_0x12c8ea){try{jsonpatch[_0xd6dc('0x22')](_0x12c8ea,_0xde1b12,!![]);}catch(_0x243780){return BPromise['reject'](_0x243780);}return _0x12c8ea[_0xd6dc('0x23')]();};}function saveUpdates(_0x586e87,_0x23093d){return function(_0x3688ae){if(_0x3688ae){return _0x3688ae[_0xd6dc('0x24')](_0x586e87)[_0xd6dc('0x25')](function(_0x905295){return _0x905295;});}return null;};}function removeEntity(_0x57f19c,_0x4e35b6){return function(_0x3a38be){if(_0x3a38be){return _0x3a38be[_0xd6dc('0x26')]()['then'](function(){var _0x40ab50=_0x3a38be[_0xd6dc('0x27')]({'plain':!![]});var _0x206ffa='IvrCampaigns';return db[_0xd6dc('0x28')][_0xd6dc('0x26')]({'where':{'type':_0x206ffa,'resourceId':_0x40ab50['id']}})[_0xd6dc('0x25')](function(){return _0x3a38be;});})[_0xd6dc('0x25')](function(){_0x57f19c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x522557,_0xaa5ba6){return function(_0x3ac99e){if(!_0x3ac99e){_0x522557[_0xd6dc('0x19')](0x194);}return _0x3ac99e;};}function handleError(_0x5de7cc,_0x22f9af){_0x22f9af=_0x22f9af||0x1f4;return function(_0x24d891){logger['error'](_0x24d891['stack']);if(_0x24d891['name']){delete _0x24d891[_0xd6dc('0x29')];}_0x5de7cc['status'](_0x22f9af)[_0xd6dc('0x2a')](_0x24d891);};}exports[_0xd6dc('0x2b')]=function(_0xc1312b,_0x5c2f06){var _0x77d021={},_0x41d29c={},_0x31ed53={'count':0x0,'rows':[]};var _0x297694=_[_0xd6dc('0x2c')](db[_0xd6dc('0x2d')][_0xd6dc('0x2e')],function(_0x52b610){return{'name':_0x52b610[_0xd6dc('0x2f')],'type':_0x52b610[_0xd6dc('0x30')]['key']};});_0x41d29c[_0xd6dc('0x31')]=_[_0xd6dc('0x2c')](_0x297694,_0xd6dc('0x29'));_0x41d29c[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0xc1312b[_0xd6dc('0x32')]);_0x41d29c[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0x41d29c['model'],_0x41d29c[_0xd6dc('0x32')]);_0x77d021['attributes']=_[_0xd6dc('0x35')](_0x41d29c[_0xd6dc('0x31')],qs['fields'](_0xc1312b['query'][_0xd6dc('0x36')]));_0x77d021['attributes']=_0x77d021[_0xd6dc('0x37')][_0xd6dc('0x38')]?_0x77d021[_0xd6dc('0x37')]:_0x41d29c[_0xd6dc('0x31')];if(!_0xc1312b['query'][_0xd6dc('0x39')](_0xd6dc('0x3a'))){_0x77d021[_0xd6dc('0x1e')]=qs[_0xd6dc('0x1e')](_0xc1312b['query'][_0xd6dc('0x1e')]);_0x77d021[_0xd6dc('0x1c')]=qs[_0xd6dc('0x1c')](_0xc1312b['query'][_0xd6dc('0x1c')]);}_0x77d021[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0xc1312b['query']['sort']);_0x77d021['where']=qs[_0xd6dc('0x34')](_[_0xd6dc('0x3d')](_0xc1312b[_0xd6dc('0x32')],_0x41d29c['filters']),_0x297694);if(_0xc1312b[_0xd6dc('0x32')][_0xd6dc('0x3e')]){_0x77d021[_0xd6dc('0x3f')]=_[_0xd6dc('0x40')](_0x77d021[_0xd6dc('0x3f')],{'$or':_[_0xd6dc('0x2c')](_0x297694,function(_0x1335df){if(_0x1335df[_0xd6dc('0x30')]!=='VIRTUAL'){var _0x123eff={};_0x123eff[_0x1335df['name']]={'$like':'%'+_0xc1312b['query'][_0xd6dc('0x3e')]+'%'};return _0x123eff;}})});}_0x77d021=_['merge']({},_0x77d021,_0xc1312b[_0xd6dc('0x41')]);var _0x2af4ae={'where':_0x77d021[_0xd6dc('0x3f')]};return db[_0xd6dc('0x2d')][_0xd6dc('0x1f')](_0x2af4ae)['then'](function(_0x1824a9){_0x31ed53[_0xd6dc('0x1f')]=_0x1824a9;if(_0xc1312b[_0xd6dc('0x32')][_0xd6dc('0x42')]){_0x77d021[_0xd6dc('0x43')]=[{'all':!![]}];}return db['Campaign'][_0xd6dc('0x44')](_0x77d021);})[_0xd6dc('0x25')](function(_0x17b8a4){_0x31ed53[_0xd6dc('0x45')]=_0x17b8a4;return _0x31ed53;})[_0xd6dc('0x25')](respondWithFilteredResult(_0x5c2f06,_0x77d021))['catch'](handleError(_0x5c2f06,null));};exports['show']=function(_0x88f7a5,_0x626f8d){var _0x14dba8={'raw':![],'where':{'id':_0x88f7a5[_0xd6dc('0x46')]['id']}},_0x5c7acd={};_0x5c7acd[_0xd6dc('0x31')]=_[_0xd6dc('0x33')](db[_0xd6dc('0x2d')][_0xd6dc('0x2e')]);_0x5c7acd[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x88f7a5[_0xd6dc('0x32')]);_0x5c7acd[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0x5c7acd[_0xd6dc('0x31')],_0x5c7acd['query']);_0x14dba8[_0xd6dc('0x37')]=_['intersection'](_0x5c7acd[_0xd6dc('0x31')],qs[_0xd6dc('0x36')](_0x88f7a5['query'][_0xd6dc('0x36')]));_0x14dba8[_0xd6dc('0x37')]=_0x14dba8[_0xd6dc('0x37')][_0xd6dc('0x38')]?_0x14dba8['attributes']:_0x5c7acd[_0xd6dc('0x31')];if(_0x88f7a5[_0xd6dc('0x32')]['includeAll']){_0x14dba8[_0xd6dc('0x43')]=[{'all':!![]}];}_0x14dba8=_[_0xd6dc('0x40')]({},_0x14dba8,_0x88f7a5[_0xd6dc('0x41')]);return db[_0xd6dc('0x2d')]['find'](_0x14dba8)['then'](handleEntityNotFound(_0x626f8d,null))[_0xd6dc('0x25')](respondWithResult(_0x626f8d,null))[_0xd6dc('0x47')](handleError(_0x626f8d,null));};exports[_0xd6dc('0x48')]=function(_0x1dbecd,_0x98a105){return db[_0xd6dc('0x2d')][_0xd6dc('0x48')](_0x1dbecd[_0xd6dc('0x49')],{})['then'](function(_0x3d6410){var _0x57ea71=_0x1dbecd['user'][_0xd6dc('0x27')]({'plain':!![]});if(!_0x57ea71)throw new Error(_0xd6dc('0x4a'));if(_0x57ea71[_0xd6dc('0x4b')]===_0xd6dc('0x4c')){var _0x56ac24=_0x3d6410[_0xd6dc('0x27')]({'plain':!![]});var _0x469a49=_0xd6dc('0x4d');return db[_0xd6dc('0x4e')][_0xd6dc('0x4f')]({'where':{'name':_0x469a49,'userProfileId':_0x57ea71[_0xd6dc('0x50')]},'raw':!![]})['then'](function(_0x548cb3){if(_0x548cb3&&_0x548cb3[_0xd6dc('0x51')]===0x0){return db[_0xd6dc('0x28')][_0xd6dc('0x48')]({'name':_0x56ac24['name'],'resourceId':_0x56ac24['id'],'type':_0x548cb3[_0xd6dc('0x29')],'sectionId':_0x548cb3['id']},{})[_0xd6dc('0x25')](function(){return _0x3d6410;});}else{return _0x3d6410;}})[_0xd6dc('0x47')](function(_0x471956){logger[_0xd6dc('0x52')](_0xd6dc('0x53'),_0x471956);throw _0x471956;});}return _0x3d6410;})[_0xd6dc('0x25')](respondWithResult(_0x98a105,0xc9))[_0xd6dc('0x47')](handleError(_0x98a105,null));};exports[_0xd6dc('0x54')]=function(_0x1c1564,_0xe2b949){var _0x4a56bc={'where':{'id':_0x1c1564[_0xd6dc('0x46')]['id']}},_0x4466f9={};_0x4466f9['model']=_[_0xd6dc('0x33')](db['Campaign'][_0xd6dc('0x2e')]);_0x4a56bc[_0xd6dc('0x37')]=_[_0xd6dc('0x35')](_0x4466f9[_0xd6dc('0x31')],qs['fields'](_0x1c1564[_0xd6dc('0x32')][_0xd6dc('0x36')]));_0x4a56bc[_0xd6dc('0x37')]=_0x4a56bc[_0xd6dc('0x37')]['length']?_0x4a56bc[_0xd6dc('0x37')]:_0x4466f9[_0xd6dc('0x31')];if(_0x1c1564[_0xd6dc('0x32')][_0xd6dc('0x42')]){_0x4a56bc[_0xd6dc('0x43')]=[{'all':!![]}];}_0x4a56bc=_['merge']({},_0x4a56bc,_0x1c1564[_0xd6dc('0x41')]);return db[_0xd6dc('0x2d')][_0xd6dc('0x4f')](_0x4a56bc)[_0xd6dc('0x25')](handleEntityNotFound(_0xe2b949,null))[_0xd6dc('0x25')](function(_0x3b5b8e){if(_0x3b5b8e){var _0x502ab2=_0x3b5b8e['get']({'plain':!![]});_0x502ab2=qs[_0xd6dc('0x55')](_0x502ab2,['id','createdAt',_0xd6dc('0x56')]);_0x1c1564[_0xd6dc('0x49')]=_[_0xd6dc('0x55')](_0x1c1564[_0xd6dc('0x49')],['id','createdAt',_0xd6dc('0x56')]);return db[_0xd6dc('0x2d')]['create'](_[_0xd6dc('0x40')](_0x502ab2,_0x1c1564[_0xd6dc('0x49')]),{'include':_0x1c1564[_0xd6dc('0x32')][_0xd6dc('0x42')]?[{'all':!![]}]:undefined})[_0xd6dc('0x25')](function(_0x24eda6){var _0x3fe3ca=_0x1c1564[_0xd6dc('0x4c')][_0xd6dc('0x27')]({'plain':!![]});if(!_0x3fe3ca)throw new Error(_0xd6dc('0x4a'));if(_0x3fe3ca['role']===_0xd6dc('0x4c')){var _0x1f0197=_0x24eda6[_0xd6dc('0x27')]({'plain':!![]});var _0x1e63f8=_0xd6dc('0x4d');return db[_0xd6dc('0x4e')][_0xd6dc('0x4f')]({'where':{'name':_0x1e63f8,'userProfileId':_0x3fe3ca['userProfileId']},'raw':!![]})[_0xd6dc('0x25')](function(_0x314aed){if(_0x314aed&&_0x314aed[_0xd6dc('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f0197['name'],'resourceId':_0x1f0197['id'],'type':_0x314aed[_0xd6dc('0x29')],'sectionId':_0x314aed['id']},{})[_0xd6dc('0x25')](function(){return _0x24eda6;});}else{return _0x24eda6;}})[_0xd6dc('0x47')](function(_0x4ea8c9){logger[_0xd6dc('0x52')](_0xd6dc('0x53'),_0x4ea8c9);throw _0x4ea8c9;});}return _0x24eda6;});}})[_0xd6dc('0x25')](respondWithResult(_0xe2b949,0xc9))[_0xd6dc('0x47')](handleError(_0xe2b949,null));};exports[_0xd6dc('0x24')]=function(_0xf979ba,_0x1a8953){if(_0xf979ba[_0xd6dc('0x49')]['id']){delete _0xf979ba[_0xd6dc('0x49')]['id'];}return db[_0xd6dc('0x2d')][_0xd6dc('0x4f')]({'where':{'id':_0xf979ba[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x1a8953,null))[_0xd6dc('0x25')](saveUpdates(_0xf979ba['body'],null))['then'](respondWithResult(_0x1a8953,null))['catch'](handleError(_0x1a8953,null));};exports[_0xd6dc('0x26')]=function(_0x3c97fb,_0x54e334){return db['Campaign']['find']({'where':{'id':_0x3c97fb[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x54e334,null))[_0xd6dc('0x25')](removeEntity(_0x54e334,null))[_0xd6dc('0x47')](handleError(_0x54e334,null));};exports[_0xd6dc('0x57')]=function(_0x1a609a,_0x5e7602,_0x392b5b){var _0x46980b={'raw':!![],'where':{}};var _0x528669={};var _0x37f485={'count':0x0,'rows':[]};return db[_0xd6dc('0x2d')][_0xd6dc('0x58')]({'where':{'id':_0x1a609a[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x5e7602,null))[_0xd6dc('0x25')](function(_0xf3bcbe){if(_0xf3bcbe){_0x528669[_0xd6dc('0x31')]=_['keys'](db[_0xd6dc('0x59')]['rawAttributes']);_0x528669[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x1a609a[_0xd6dc('0x32')]);_0x528669[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0x528669['model'],_0x528669[_0xd6dc('0x32')]);_0x46980b[_0xd6dc('0x37')]=_[_0xd6dc('0x35')](_0x528669[_0xd6dc('0x31')],qs[_0xd6dc('0x36')](_0x1a609a['query']['fields']));_0x46980b[_0xd6dc('0x37')]=_0x46980b['attributes'][_0xd6dc('0x38')]?_0x46980b[_0xd6dc('0x37')]:_0x528669['model'];if(!_0x1a609a[_0xd6dc('0x32')]['hasOwnProperty']('nolimit')){_0x46980b[_0xd6dc('0x1e')]=qs['limit'](_0x1a609a['query'][_0xd6dc('0x1e')]);_0x46980b[_0xd6dc('0x1c')]=qs['offset'](_0x1a609a[_0xd6dc('0x32')][_0xd6dc('0x1c')]);}_0x46980b[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0x1a609a[_0xd6dc('0x32')][_0xd6dc('0x3c')]);_0x46980b[_0xd6dc('0x3f')]=qs[_0xd6dc('0x34')](_[_0xd6dc('0x3d')](_0x1a609a[_0xd6dc('0x32')],_0x528669[_0xd6dc('0x34')]));_0x46980b[_0xd6dc('0x3f')][_0xd6dc('0x5a')]=_0xf3bcbe['id'];if(_0x1a609a['query'][_0xd6dc('0x3e')]){_0x46980b['where']=_['merge'](_0x46980b[_0xd6dc('0x3f')],{'$or':_['map'](_0x46980b['attributes'],function(_0x1deccb){var _0x1f251f={};_0x1f251f[_0x1deccb]={'$like':'%'+_0x1a609a[_0xd6dc('0x32')][_0xd6dc('0x3e')]+'%'};return _0x1f251f;})});}_0x46980b=_[_0xd6dc('0x40')]({},_0x46980b,_0x1a609a[_0xd6dc('0x41')]);return db[_0xd6dc('0x59')][_0xd6dc('0x1f')]({'where':_0x46980b[_0xd6dc('0x3f')]})['then'](function(_0x9cfa0c){_0x37f485['count']=_0x9cfa0c;if(_0x1a609a[_0xd6dc('0x32')][_0xd6dc('0x42')]){_0x46980b['include']=[{'all':!![]}];}return db[_0xd6dc('0x59')][_0xd6dc('0x44')](_0x46980b);})[_0xd6dc('0x25')](function(_0x2a5c6f){_0x37f485['rows']=_0x2a5c6f;return _0x37f485;});}})[_0xd6dc('0x25')](respondWithFilteredResult(_0x5e7602,_0x46980b))['catch'](handleError(_0x5e7602,null));};exports[_0xd6dc('0x5b')]=function(_0x2647af,_0x1bac04,_0xf10a6b){var _0x556521={'raw':!![],'where':{}};var _0x38ddae={};var _0x207641={'count':0x0,'rows':[]};return db[_0xd6dc('0x2d')][_0xd6dc('0x58')]({'where':{'id':_0x2647af[_0xd6dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bac04,null))[_0xd6dc('0x25')](function(_0x4a4d93){if(_0x4a4d93){_0x38ddae[_0xd6dc('0x31')]=_[_0xd6dc('0x33')](db['CmHopperHistory'][_0xd6dc('0x2e')]);_0x38ddae[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x2647af[_0xd6dc('0x32')]);_0x38ddae[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0x38ddae[_0xd6dc('0x31')],_0x38ddae[_0xd6dc('0x32')]);_0x556521['attributes']=_[_0xd6dc('0x35')](_0x38ddae[_0xd6dc('0x31')],qs[_0xd6dc('0x36')](_0x2647af[_0xd6dc('0x32')][_0xd6dc('0x36')]));_0x556521['attributes']=_0x556521[_0xd6dc('0x37')][_0xd6dc('0x38')]?_0x556521[_0xd6dc('0x37')]:_0x38ddae['model'];if(!_0x2647af['query']['hasOwnProperty']('nolimit')){_0x556521[_0xd6dc('0x1e')]=qs[_0xd6dc('0x1e')](_0x2647af[_0xd6dc('0x32')][_0xd6dc('0x1e')]);_0x556521[_0xd6dc('0x1c')]=qs[_0xd6dc('0x1c')](_0x2647af[_0xd6dc('0x32')][_0xd6dc('0x1c')]);}_0x556521[_0xd6dc('0x3b')]=qs['sort'](_0x2647af[_0xd6dc('0x32')][_0xd6dc('0x3c')]);_0x556521[_0xd6dc('0x3f')]=qs['filters'](_['pick'](_0x2647af[_0xd6dc('0x32')],_0x38ddae['filters']));_0x556521[_0xd6dc('0x3f')]['CampaignId']=_0x4a4d93['id'];if(_0x2647af[_0xd6dc('0x32')][_0xd6dc('0x3e')]){_0x556521['where']=_['merge'](_0x556521[_0xd6dc('0x3f')],{'$or':_[_0xd6dc('0x2c')](_0x556521[_0xd6dc('0x37')],function(_0x407399){var _0x32cf95={};_0x32cf95[_0x407399]={'$like':'%'+_0x2647af['query']['filter']+'%'};return _0x32cf95;})});}_0x556521=_[_0xd6dc('0x40')]({},_0x556521,_0x2647af[_0xd6dc('0x41')]);return db['CmHopperHistory'][_0xd6dc('0x1f')]({'where':_0x556521[_0xd6dc('0x3f')]})[_0xd6dc('0x25')](function(_0x25f8d0){_0x207641[_0xd6dc('0x1f')]=_0x25f8d0;if(_0x2647af[_0xd6dc('0x32')]['includeAll']){_0x556521[_0xd6dc('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd6dc('0x44')](_0x556521);})[_0xd6dc('0x25')](function(_0x1d1051){_0x207641[_0xd6dc('0x45')]=_0x1d1051;return _0x207641;});}})[_0xd6dc('0x25')](respondWithFilteredResult(_0x1bac04,_0x556521))[_0xd6dc('0x47')](handleError(_0x1bac04,null));};exports[_0xd6dc('0x5c')]=function(_0x1e87f7,_0x376174,_0x3a3774){var _0x17adca={'raw':!![],'where':{}};var _0x28def0={};var _0xa19688={'count':0x0,'rows':[]};return db['Campaign'][_0xd6dc('0x58')]({'where':{'id':_0x1e87f7[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x376174,null))['then'](function(_0x1a062a){if(_0x1a062a){_0x28def0[_0xd6dc('0x31')]=_[_0xd6dc('0x33')](db[_0xd6dc('0x5d')][_0xd6dc('0x2e')]);_0x28def0[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x1e87f7[_0xd6dc('0x32')]);_0x28def0[_0xd6dc('0x34')]=_['intersection'](_0x28def0[_0xd6dc('0x31')],_0x28def0['query']);_0x17adca['attributes']=_[_0xd6dc('0x35')](_0x28def0[_0xd6dc('0x31')],qs['fields'](_0x1e87f7[_0xd6dc('0x32')][_0xd6dc('0x36')]));_0x17adca[_0xd6dc('0x37')]=_0x17adca[_0xd6dc('0x37')]['length']?_0x17adca['attributes']:_0x28def0['model'];if(!_0x1e87f7[_0xd6dc('0x32')][_0xd6dc('0x39')]('nolimit')){_0x17adca[_0xd6dc('0x1e')]=qs[_0xd6dc('0x1e')](_0x1e87f7[_0xd6dc('0x32')][_0xd6dc('0x1e')]);_0x17adca['offset']=qs[_0xd6dc('0x1c')](_0x1e87f7['query']['offset']);}_0x17adca[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0x1e87f7['query'][_0xd6dc('0x3c')]);_0x17adca[_0xd6dc('0x3f')]=qs[_0xd6dc('0x34')](_[_0xd6dc('0x3d')](_0x1e87f7['query'],_0x28def0[_0xd6dc('0x34')]));_0x17adca[_0xd6dc('0x3f')][_0xd6dc('0x5a')]=_0x1a062a['id'];if(_0x1e87f7[_0xd6dc('0x32')][_0xd6dc('0x3e')]){_0x17adca[_0xd6dc('0x3f')]=_[_0xd6dc('0x40')](_0x17adca[_0xd6dc('0x3f')],{'$or':_[_0xd6dc('0x2c')](_0x17adca[_0xd6dc('0x37')],function(_0x1de555){var _0x546f97={};_0x546f97[_0x1de555]={'$like':'%'+_0x1e87f7[_0xd6dc('0x32')][_0xd6dc('0x3e')]+'%'};return _0x546f97;})});}_0x17adca=_[_0xd6dc('0x40')]({},_0x17adca,_0x1e87f7['options']);return db[_0xd6dc('0x5d')][_0xd6dc('0x1f')]({'where':_0x17adca['where']})['then'](function(_0x1f4894){_0xa19688[_0xd6dc('0x1f')]=_0x1f4894;if(_0x1e87f7['query'][_0xd6dc('0x42')]){_0x17adca[_0xd6dc('0x43')]=[{'all':!![]}];}return db[_0xd6dc('0x5d')][_0xd6dc('0x44')](_0x17adca);})[_0xd6dc('0x25')](function(_0x489774){_0xa19688[_0xd6dc('0x45')]=_0x489774;return _0xa19688;});}})[_0xd6dc('0x25')](respondWithFilteredResult(_0x376174,_0x17adca))[_0xd6dc('0x47')](handleError(_0x376174,null));};exports[_0xd6dc('0x5e')]=function(_0x1b31e1,_0x5c6096,_0x540c00){var _0x3dcf32={'raw':!![],'where':{}};var _0xe9fbcd={};var _0x3765ff={'count':0x0,'rows':[]};return db[_0xd6dc('0x2d')][_0xd6dc('0x58')]({'where':{'id':_0x1b31e1[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x5c6096,null))[_0xd6dc('0x25')](function(_0x694f86){if(_0x694f86){_0xe9fbcd[_0xd6dc('0x31')]=_[_0xd6dc('0x33')](db['CmHopperBlack'][_0xd6dc('0x2e')]);_0xe9fbcd[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x1b31e1[_0xd6dc('0x32')]);_0xe9fbcd[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0xe9fbcd[_0xd6dc('0x31')],_0xe9fbcd[_0xd6dc('0x32')]);_0x3dcf32[_0xd6dc('0x37')]=_[_0xd6dc('0x35')](_0xe9fbcd['model'],qs[_0xd6dc('0x36')](_0x1b31e1[_0xd6dc('0x32')][_0xd6dc('0x36')]));_0x3dcf32[_0xd6dc('0x37')]=_0x3dcf32[_0xd6dc('0x37')][_0xd6dc('0x38')]?_0x3dcf32[_0xd6dc('0x37')]:_0xe9fbcd[_0xd6dc('0x31')];if(!_0x1b31e1['query']['hasOwnProperty']('nolimit')){_0x3dcf32['limit']=qs[_0xd6dc('0x1e')](_0x1b31e1[_0xd6dc('0x32')][_0xd6dc('0x1e')]);_0x3dcf32[_0xd6dc('0x1c')]=qs['offset'](_0x1b31e1[_0xd6dc('0x32')]['offset']);}_0x3dcf32[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0x1b31e1[_0xd6dc('0x32')][_0xd6dc('0x3c')]);_0x3dcf32['where']=qs[_0xd6dc('0x34')](_[_0xd6dc('0x3d')](_0x1b31e1[_0xd6dc('0x32')],_0xe9fbcd[_0xd6dc('0x34')]));_0x3dcf32[_0xd6dc('0x3f')][_0xd6dc('0x5a')]=_0x694f86['id'];if(_0x1b31e1['query'][_0xd6dc('0x3e')]){_0x3dcf32[_0xd6dc('0x3f')]=_[_0xd6dc('0x40')](_0x3dcf32[_0xd6dc('0x3f')],{'$or':_[_0xd6dc('0x2c')](_0x3dcf32[_0xd6dc('0x37')],function(_0x6222cb){var _0x59b041={};_0x59b041[_0x6222cb]={'$like':'%'+_0x1b31e1[_0xd6dc('0x32')][_0xd6dc('0x3e')]+'%'};return _0x59b041;})});}_0x3dcf32=_[_0xd6dc('0x40')]({},_0x3dcf32,_0x1b31e1['options']);return db[_0xd6dc('0x5f')]['count']({'where':_0x3dcf32[_0xd6dc('0x3f')]})['then'](function(_0x3628ea){_0x3765ff[_0xd6dc('0x1f')]=_0x3628ea;if(_0x1b31e1[_0xd6dc('0x32')][_0xd6dc('0x42')]){_0x3dcf32['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3dcf32);})[_0xd6dc('0x25')](function(_0x1a067f){_0x3765ff[_0xd6dc('0x45')]=_0x1a067f;return _0x3765ff;});}})['then'](respondWithFilteredResult(_0x5c6096,_0x3dcf32))['catch'](handleError(_0x5c6096,null));};exports[_0xd6dc('0x60')]=function(_0x18ca3c,_0x503c39,_0x5917b3){var _0x280dc3={};var _0x5762c5={};var _0x523f30;var _0x5b3db6;return db[_0xd6dc('0x2d')][_0xd6dc('0x58')]({'where':{'id':_0x18ca3c['params']['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x503c39,null))[_0xd6dc('0x25')](function(_0x480c5c){if(_0x480c5c){_0x523f30=_0x480c5c;_0x5762c5[_0xd6dc('0x31')]=_[_0xd6dc('0x33')](db['CmList'][_0xd6dc('0x2e')]);_0x5762c5[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x18ca3c[_0xd6dc('0x32')]);_0x5762c5[_0xd6dc('0x34')]=_[_0xd6dc('0x35')](_0x5762c5[_0xd6dc('0x31')],_0x5762c5[_0xd6dc('0x32')]);_0x280dc3['attributes']=_['intersection'](_0x5762c5['model'],qs['fields'](_0x18ca3c[_0xd6dc('0x32')]['fields']));_0x280dc3[_0xd6dc('0x37')]=_0x280dc3['attributes']['length']?_0x280dc3[_0xd6dc('0x37')]:_0x5762c5[_0xd6dc('0x31')];_0x280dc3[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0x18ca3c[_0xd6dc('0x32')][_0xd6dc('0x3c')]);_0x280dc3[_0xd6dc('0x3f')]=qs[_0xd6dc('0x34')](_['pick'](_0x18ca3c[_0xd6dc('0x32')],_0x5762c5[_0xd6dc('0x34')]));if(_0x18ca3c[_0xd6dc('0x32')]['filter']){_0x280dc3[_0xd6dc('0x3f')]=_[_0xd6dc('0x40')](_0x280dc3[_0xd6dc('0x3f')],{'$or':_[_0xd6dc('0x2c')](_0x280dc3[_0xd6dc('0x37')],function(_0x76fbe){var _0x24df7a={};_0x24df7a[_0x76fbe]={'$like':'%'+_0x18ca3c[_0xd6dc('0x32')][_0xd6dc('0x3e')]+'%'};return _0x24df7a;})});}_0x280dc3=_['merge']({},_0x280dc3,_0x18ca3c['options']);return _0x523f30[_0xd6dc('0x60')](_0x280dc3);}})[_0xd6dc('0x25')](function(_0x295570){if(_0x295570){_0x5b3db6=_0x295570[_0xd6dc('0x38')];if(!_0x18ca3c[_0xd6dc('0x32')][_0xd6dc('0x39')](_0xd6dc('0x3a'))){_0x280dc3[_0xd6dc('0x1e')]=qs[_0xd6dc('0x1e')](_0x18ca3c[_0xd6dc('0x32')]['limit']);_0x280dc3[_0xd6dc('0x1c')]=qs['offset'](_0x18ca3c[_0xd6dc('0x32')][_0xd6dc('0x1c')]);}return _0x523f30['getLists'](_0x280dc3);}})[_0xd6dc('0x25')](function(_0x44be20){if(_0x44be20){return _0x44be20?{'count':_0x5b3db6,'rows':_0x44be20}:null;}})[_0xd6dc('0x25')](respondWithResult(_0x503c39,null))[_0xd6dc('0x47')](handleError(_0x503c39,null));};exports[_0xd6dc('0x61')]=function(_0x4e0f00,_0x1a10f8,_0x25b978){var _0x3d157d,_0x36ef21;var _0x1a875e=[];var _0x104c6f=moment()[_0xd6dc('0x62')](_0xd6dc('0x63'));return db[_0xd6dc('0x2d')][_0xd6dc('0x4f')]({'where':{'id':_0x4e0f00[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x1a10f8,null))[_0xd6dc('0x25')](function(_0x500d18){if(_0x500d18){_0x36ef21=_0x500d18;return _0x500d18[_0xd6dc('0x61')](_0x4e0f00['body'][_0xd6dc('0x64')],_[_0xd6dc('0x55')](_0x4e0f00[_0xd6dc('0x49')],['ids','id'])||{});}return null;})[_0xd6dc('0x65')](function(_0x2840fa){var _0x46cd50;var _0x3570b8;_0x3d157d=_0x2840fa||[];var _0x2ee539=[];if(_0x2840fa){for(var _0x5d8b54=0x0;_0x5d8b54<_0x2840fa['length'];_0x5d8b54+=0x1){var _0x11b1f2=_0x2840fa[_0x5d8b54][_0xd6dc('0x27')]({'plain':!![]});_0x36ef21[_0xd6dc('0x66')]=_0x4e0f00[_0xd6dc('0x49')][_0xd6dc('0x66')]?_0x4e0f00['body'][_0xd6dc('0x66')]:_0x36ef21[_0xd6dc('0x66')];switch(_0x36ef21[_0xd6dc('0x66')]){case _0xd6dc('0x67'):_0x46cd50=squel['insert']()['into'](_0xd6dc('0x68'))[_0xd6dc('0x69')]([_0xd6dc('0x6a'),_0xd6dc('0x6b'),_0xd6dc('0x6c'),_0xd6dc('0x6d'),_0xd6dc('0x5a'),'createdAt',_0xd6dc('0x56')],squel[_0xd6dc('0x6e')]()['field'](_0xd6dc('0x6a'),_0xd6dc('0x6a'))[_0xd6dc('0x6f')](_0xd6dc('0x70'),'scheduledAt')[_0xd6dc('0x6f')]('id','ContactId')[_0xd6dc('0x6f')](_0x11b1f2[_0xd6dc('0x71')][_0xd6dc('0x72')](),_0xd6dc('0x6d'))[_0xd6dc('0x6f')](_0x4e0f00['params']['id'][_0xd6dc('0x72')](),_0xd6dc('0x5a'))['field']('\x27'+_0x104c6f+'\x27',_0xd6dc('0x73'))[_0xd6dc('0x6f')]('\x27'+_0x104c6f+'\x27',_0xd6dc('0x56'))['from'](_0xd6dc('0x74'))[_0xd6dc('0x3f')]('deletedAt\x20IS\x20NULL')[_0xd6dc('0x3f')](_0xd6dc('0x75'),_0x11b1f2[_0xd6dc('0x71')][_0xd6dc('0x72')]())['where'](_0xd6dc('0x76'))[_0xd6dc('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xd6dc('0x77'))[_0xd6dc('0x78')](_0xd6dc('0x79'))[_0xd6dc('0x3f')](_0xd6dc('0x7a'),_0x4e0f00[_0xd6dc('0x46')]['id'][_0xd6dc('0x72')]()))['where'](_0xd6dc('0x7b'),squel[_0xd6dc('0x6e')]()[_0xd6dc('0x6f')](_0xd6dc('0x7c'))[_0xd6dc('0x78')]('cm_hopper')[_0xd6dc('0x3f')](_0xd6dc('0x7a'),_0x4e0f00['params']['id'][_0xd6dc('0x72')]())))[_0xd6dc('0x72')]();break;case _0xd6dc('0x7d'):_0x46cd50=squel['insert']()[_0xd6dc('0x7e')](_0xd6dc('0x68'))[_0xd6dc('0x69')]([_0xd6dc('0x6a'),_0xd6dc('0x6b'),_0xd6dc('0x6c'),'ListId',_0xd6dc('0x5a'),'createdAt',_0xd6dc('0x56')],squel[_0xd6dc('0x6e')]()[_0xd6dc('0x6f')](_0xd6dc('0x6a'),_0xd6dc('0x6a'))[_0xd6dc('0x6f')]('NOW()',_0xd6dc('0x6b'))[_0xd6dc('0x6f')]('id',_0xd6dc('0x6c'))[_0xd6dc('0x6f')](_0x11b1f2[_0xd6dc('0x71')][_0xd6dc('0x72')](),_0xd6dc('0x6d'))['field'](_0x4e0f00[_0xd6dc('0x46')]['id'][_0xd6dc('0x72')](),'CampaignId')[_0xd6dc('0x6f')]('\x27'+_0x104c6f+'\x27',_0xd6dc('0x73'))[_0xd6dc('0x6f')]('\x27'+_0x104c6f+'\x27',_0xd6dc('0x56'))[_0xd6dc('0x78')](_0xd6dc('0x74'))['where'](_0xd6dc('0x7f'))['where']('ListId\x20=\x20?',_0x11b1f2[_0xd6dc('0x71')][_0xd6dc('0x72')]())[_0xd6dc('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xd6dc('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd6dc('0x6e')]()[_0xd6dc('0x6f')](_0xd6dc('0x7c'))[_0xd6dc('0x78')](_0xd6dc('0x68'))[_0xd6dc('0x3f')](_0xd6dc('0x7a'),_0x4e0f00['params']['id'][_0xd6dc('0x72')]())))['toString']();break;default:_0x46cd50=squel[_0xd6dc('0x80')]()['into'](_0xd6dc('0x68'))[_0xd6dc('0x69')](['phone',_0xd6dc('0x6b'),_0xd6dc('0x6c'),_0xd6dc('0x6d'),_0xd6dc('0x5a'),_0xd6dc('0x73'),_0xd6dc('0x56')],squel[_0xd6dc('0x6e')]()[_0xd6dc('0x6f')](_0xd6dc('0x6a'),_0xd6dc('0x6a'))[_0xd6dc('0x6f')](_0xd6dc('0x70'),_0xd6dc('0x6b'))[_0xd6dc('0x6f')]('id',_0xd6dc('0x6c'))[_0xd6dc('0x6f')](_0x11b1f2['CmListId'][_0xd6dc('0x72')](),_0xd6dc('0x6d'))['field'](_0x4e0f00['params']['id'][_0xd6dc('0x72')](),_0xd6dc('0x5a'))['field']('\x27'+_0x104c6f+'\x27','createdAt')[_0xd6dc('0x6f')]('\x27'+_0x104c6f+'\x27',_0xd6dc('0x56'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xd6dc('0x3f')](_0xd6dc('0x75'),_0x11b1f2['CmListId'][_0xd6dc('0x72')]())[_0xd6dc('0x3f')](_0xd6dc('0x76')))[_0xd6dc('0x72')]();}_0x3570b8=squel[_0xd6dc('0x80')]()[_0xd6dc('0x7e')](_0xd6dc('0x81'))['fromQuery']([_0xd6dc('0x82'),_0xd6dc('0x6b'),_0xd6dc('0x6a'),_0xd6dc('0x83'),_0xd6dc('0x73'),'updatedAt'],squel['select']()[_0xd6dc('0x6f')](_0xd6dc('0x84'),'id')['field']('NOW()','scheduledAt')[_0xd6dc('0x6f')](_0xd6dc('0x85'),'phone')[_0xd6dc('0x6f')](_0xd6dc('0x86'),_0xd6dc('0x83'))['field']('\x27'+_0x104c6f+'\x27',_0xd6dc('0x73'))[_0xd6dc('0x6f')]('\x27'+_0x104c6f+'\x27',_0xd6dc('0x56'))[_0xd6dc('0x78')](_0xd6dc('0x87'),'ci')[_0xd6dc('0x88')](_0xd6dc('0x68'),'h',_0xd6dc('0x89'))[_0xd6dc('0x3f')]('h.ListId\x20=\x20?',_0x11b1f2[_0xd6dc('0x71')][_0xd6dc('0x72')]())['where'](_0xd6dc('0x8a'),_0x4e0f00['params']['id'][_0xd6dc('0x72')]())['where'](_0xd6dc('0x8b'),_0x104c6f))[_0xd6dc('0x72')]();_0x2ee539['push'](db[_0xd6dc('0x8c')][_0xd6dc('0x32')](_0x46cd50));_0x1a875e['push'](db[_0xd6dc('0x8c')][_0xd6dc('0x32')](_0x3570b8));}return BPromise[_0xd6dc('0x8d')](_0x2ee539);}})[_0xd6dc('0x25')](function(){return BPromise[_0xd6dc('0x8d')](_0x1a875e);})[_0xd6dc('0x25')](function(){return _0x3d157d;})[_0xd6dc('0x25')](respondWithResult(_0x1a10f8,null))['catch'](handleError(_0x1a10f8,null));};exports[_0xd6dc('0x8e')]=function(_0x289a62,_0x54f4fb,_0x10f99d){return db[_0xd6dc('0x2d')][_0xd6dc('0x4f')]({'where':{'id':_0x289a62[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x54f4fb,null))[_0xd6dc('0x25')](function(_0x1e0eb5){if(_0x1e0eb5){return _0x1e0eb5[_0xd6dc('0x8e')](_0x289a62[_0xd6dc('0x32')][_0xd6dc('0x64')]);}})[_0xd6dc('0x25')](function(_0x31b36c){if(_0x31b36c){return db[_0xd6dc('0x59')][_0xd6dc('0x26')]({'where':{'ListId':_0x289a62[_0xd6dc('0x32')]['ids'],'CampaignId':_0x289a62[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](function(){return _0x31b36c;});}})['then'](respondWithStatusCode(_0x54f4fb,null))[_0xd6dc('0x47')](handleError(_0x54f4fb,null));};exports['getBlackLists']=function(_0x18aaaa,_0x11c218,_0xa867e3){var _0x2e86f4={};var _0x3216d5={};var _0x3119d3;var _0x194376;return db['Campaign'][_0xd6dc('0x58')]({'where':{'id':_0x18aaaa[_0xd6dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x11c218,null))[_0xd6dc('0x25')](function(_0x31c252){if(_0x31c252){_0x3119d3=_0x31c252;_0x3216d5['model']=_[_0xd6dc('0x33')](db[_0xd6dc('0x8f')][_0xd6dc('0x2e')]);_0x3216d5[_0xd6dc('0x32')]=_[_0xd6dc('0x33')](_0x18aaaa[_0xd6dc('0x32')]);_0x3216d5['filters']=_[_0xd6dc('0x35')](_0x3216d5[_0xd6dc('0x31')],_0x3216d5[_0xd6dc('0x32')]);_0x2e86f4[_0xd6dc('0x37')]=_[_0xd6dc('0x35')](_0x3216d5[_0xd6dc('0x31')],qs['fields'](_0x18aaaa['query']['fields']));_0x2e86f4[_0xd6dc('0x37')]=_0x2e86f4['attributes'][_0xd6dc('0x38')]?_0x2e86f4[_0xd6dc('0x37')]:_0x3216d5[_0xd6dc('0x31')];_0x2e86f4[_0xd6dc('0x3b')]=qs[_0xd6dc('0x3c')](_0x18aaaa['query']['sort']);_0x2e86f4[_0xd6dc('0x3f')]=qs['filters'](_[_0xd6dc('0x3d')](_0x18aaaa[_0xd6dc('0x32')],_0x3216d5['filters']));if(_0x18aaaa['query'][_0xd6dc('0x3e')]){_0x2e86f4[_0xd6dc('0x3f')]=_[_0xd6dc('0x40')](_0x2e86f4['where'],{'$or':_[_0xd6dc('0x2c')](_0x2e86f4['attributes'],function(_0x34847a){var _0x4b2cb8={};_0x4b2cb8[_0x34847a]={'$like':'%'+_0x18aaaa[_0xd6dc('0x32')][_0xd6dc('0x3e')]+'%'};return _0x4b2cb8;})});}_0x2e86f4=_[_0xd6dc('0x40')]({},_0x2e86f4,_0x18aaaa['options']);return _0x3119d3[_0xd6dc('0x90')](_0x2e86f4);}})[_0xd6dc('0x25')](function(_0x1c774b){if(_0x1c774b){_0x194376=_0x1c774b[_0xd6dc('0x38')];if(!_0x18aaaa[_0xd6dc('0x32')][_0xd6dc('0x39')](_0xd6dc('0x3a'))){_0x2e86f4[_0xd6dc('0x1e')]=qs[_0xd6dc('0x1e')](_0x18aaaa[_0xd6dc('0x32')]['limit']);_0x2e86f4[_0xd6dc('0x1c')]=qs[_0xd6dc('0x1c')](_0x18aaaa[_0xd6dc('0x32')][_0xd6dc('0x1c')]);}return _0x3119d3[_0xd6dc('0x90')](_0x2e86f4);}})[_0xd6dc('0x25')](function(_0x5bc4e4){if(_0x5bc4e4){return _0x5bc4e4?{'count':_0x194376,'rows':_0x5bc4e4}:null;}})[_0xd6dc('0x25')](respondWithResult(_0x11c218,null))['catch'](handleError(_0x11c218,null));};exports[_0xd6dc('0x91')]=function(_0x4dd657,_0x18a345,_0x1b0846){var _0x55eb2b,_0x583b8b;var _0x56cd78=[];var _0x3a4b15=moment()['format'](_0xd6dc('0x63'));return db[_0xd6dc('0x2d')][_0xd6dc('0x4f')]({'where':{'id':_0x4dd657[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x18a345,null))[_0xd6dc('0x25')](function(_0x3d2691){if(_0x3d2691){_0x583b8b=_0x3d2691;return _0x3d2691[_0xd6dc('0x91')](_0x4dd657['body'][_0xd6dc('0x64')],_[_0xd6dc('0x55')](_0x4dd657[_0xd6dc('0x49')],['ids','id'])||{});}return null;})[_0xd6dc('0x65')](function(_0x2f6262){var _0x173854;var _0x55ccb7;_0x55eb2b=_0x2f6262||[];var _0x16f269=[];if(_0x2f6262){for(var _0x2b2863=0x0;_0x2b2863<_0x2f6262[_0xd6dc('0x38')];_0x2b2863+=0x1){var _0x430360=_0x2f6262[_0x2b2863][_0xd6dc('0x27')]({'plain':!![]});_0x173854=squel['insert']()[_0xd6dc('0x7e')]('cm_hopper_black')[_0xd6dc('0x69')]([_0xd6dc('0x6a'),'ContactId',_0xd6dc('0x6d'),_0xd6dc('0x5a'),_0xd6dc('0x73'),'updatedAt'],squel['select']()[_0xd6dc('0x6f')](_0xd6dc('0x6a'),'phone')[_0xd6dc('0x6f')]('id',_0xd6dc('0x6c'))[_0xd6dc('0x6f')](_0x430360[_0xd6dc('0x71')][_0xd6dc('0x72')](),_0xd6dc('0x6d'))['field'](_0x4dd657[_0xd6dc('0x46')]['id'][_0xd6dc('0x72')](),_0xd6dc('0x5a'))['field'](_0xd6dc('0x70'),_0xd6dc('0x73'))['field'](_0xd6dc('0x70'),_0xd6dc('0x56'))['from'](_0xd6dc('0x74'))[_0xd6dc('0x3f')](_0xd6dc('0x7f'))['where']('ListId\x20=\x20?',_0x430360[_0xd6dc('0x71')][_0xd6dc('0x72')]())[_0xd6dc('0x3f')](_0xd6dc('0x76')))[_0xd6dc('0x72')]();_0x16f269[_0xd6dc('0x92')](db[_0xd6dc('0x8c')][_0xd6dc('0x32')](_0x173854));}return BPromise[_0xd6dc('0x8d')](_0x16f269);}})[_0xd6dc('0x25')](function(){return _0x55eb2b;})[_0xd6dc('0x25')](respondWithResult(_0x18a345,null))[_0xd6dc('0x47')](handleError(_0x18a345,null));};exports[_0xd6dc('0x93')]=function(_0x3083a7,_0x266e31,_0x47899c){return db[_0xd6dc('0x2d')]['find']({'where':{'id':_0x3083a7[_0xd6dc('0x46')]['id']}})[_0xd6dc('0x25')](handleEntityNotFound(_0x266e31,null))['then'](function(_0x52c61e){if(_0x52c61e){return _0x52c61e[_0xd6dc('0x93')](_0x3083a7['query'][_0xd6dc('0x64')]);}})[_0xd6dc('0x25')](function(_0x4abfc4){if(_0x4abfc4){return db[_0xd6dc('0x5f')][_0xd6dc('0x26')]({'where':{'ListId':_0x3083a7[_0xd6dc('0x32')][_0xd6dc('0x64')],'CampaignId':_0x3083a7[_0xd6dc('0x46')]['id']}})['then'](function(){return _0x4abfc4;});}})[_0xd6dc('0x25')](respondWithStatusCode(_0x266e31,null))['catch'](handleError(_0x266e31,null));}; \ No newline at end of file +var _0xceb0=['options','includeAll','rows','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','nolimit','order','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','insert','ListId','NOW()','cm_contacts','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL'];(function(_0x95fa9d,_0x1e3ed6){var _0x3140a2=function(_0x2f8f0f){while(--_0x2f8f0f){_0x95fa9d['push'](_0x95fa9d['shift']());}};_0x3140a2(++_0x1e3ed6);}(_0xceb0,0x173));var _0x0ceb=function(_0x2233e1,_0x4aaf7e){_0x2233e1=_0x2233e1-0x0;var _0x364661=_0xceb0[_0x2233e1];return _0x364661;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ceb('0x0'));var moment=require('moment');var BPromise=require(_0x0ceb('0x1'));var Mustache=require(_0x0ceb('0x2'));var util=require(_0x0ceb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0ceb('0x4'));var ejs=require(_0x0ceb('0x5'));var fs=require('fs');var fs_extra=require(_0x0ceb('0x6'));var _=require('lodash');var squel=require(_0x0ceb('0x7'));var crypto=require(_0x0ceb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0ceb('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0ceb('0xa'));var Papa=require(_0x0ceb('0xb'));var Redis=require(_0x0ceb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ceb('0xd'));var hardwareService=require(_0x0ceb('0xe'));var logger=require(_0x0ceb('0xf'))(_0x0ceb('0x10'));var utils=require(_0x0ceb('0x11'));var config=require(_0x0ceb('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ceb('0x13'))['db'];function respondWithStatusCode(_0xe19006,_0x358801){_0x358801=_0x358801||0xcc;return function(_0x26cb7a){if(_0x26cb7a){return _0xe19006[_0x0ceb('0x14')](_0x358801);}return _0xe19006[_0x0ceb('0x15')](_0x358801)[_0x0ceb('0x16')]();};}function respondWithResult(_0x54f34e,_0x416fbb){_0x416fbb=_0x416fbb||0xc8;return function(_0x54a173){if(_0x54a173){return _0x54f34e['status'](_0x416fbb)[_0x0ceb('0x17')](_0x54a173);}};}function respondWithFilteredResult(_0x2e6128,_0x218d6e){return function(_0x536bdd){if(_0x536bdd){var _0x33a190=typeof _0x218d6e[_0x0ceb('0x18')]==='undefined'&&typeof _0x218d6e[_0x0ceb('0x19')]===_0x0ceb('0x1a');var _0x2046b6=_0x536bdd[_0x0ceb('0x1b')];var _0x18bed1=_0x33a190?0x0:_0x218d6e[_0x0ceb('0x18')];var _0x2c5a89=_0x33a190?_0x536bdd[_0x0ceb('0x1b')]:_0x218d6e[_0x0ceb('0x18')]+_0x218d6e[_0x0ceb('0x19')];var _0x9aaa59;if(_0x2c5a89>=_0x2046b6){_0x2c5a89=_0x2046b6;_0x9aaa59=0xc8;}else{_0x9aaa59=0xce;}_0x2e6128[_0x0ceb('0x15')](_0x9aaa59);return _0x2e6128[_0x0ceb('0x1c')](_0x0ceb('0x1d'),_0x18bed1+'-'+_0x2c5a89+'/'+_0x2046b6)[_0x0ceb('0x17')](_0x536bdd);}return null;};}function patchUpdates(_0x3dd970){return function(_0x241c07){try{jsonpatch['apply'](_0x241c07,_0x3dd970,!![]);}catch(_0x4eb712){return BPromise[_0x0ceb('0x1e')](_0x4eb712);}return _0x241c07[_0x0ceb('0x1f')]();};}function saveUpdates(_0x5d1235,_0x2fd374){return function(_0x54fce7){if(_0x54fce7){return _0x54fce7[_0x0ceb('0x20')](_0x5d1235)[_0x0ceb('0x21')](function(_0x28fb61){return _0x28fb61;});}return null;};}function removeEntity(_0x17efd7,_0x27e058){return function(_0x4a2b69){if(_0x4a2b69){return _0x4a2b69['destroy']()['then'](function(){var _0x1a1ab3=_0x4a2b69['get']({'plain':!![]});var _0x336ce9='IvrCampaigns';return db[_0x0ceb('0x22')][_0x0ceb('0x23')]({'where':{'type':_0x336ce9,'resourceId':_0x1a1ab3['id']}})[_0x0ceb('0x21')](function(){return _0x4a2b69;});})[_0x0ceb('0x21')](function(){_0x17efd7['status'](0xcc)[_0x0ceb('0x16')]();});}};}function handleEntityNotFound(_0x9246e1,_0x15a556){return function(_0x1451d3){if(!_0x1451d3){_0x9246e1[_0x0ceb('0x14')](0x194);}return _0x1451d3;};}function handleError(_0x4aa831,_0x2de4f3){_0x2de4f3=_0x2de4f3||0x1f4;return function(_0x3792bb){logger[_0x0ceb('0x24')](_0x3792bb[_0x0ceb('0x25')]);if(_0x3792bb[_0x0ceb('0x26')]){delete _0x3792bb[_0x0ceb('0x26')];}_0x4aa831['status'](_0x2de4f3)[_0x0ceb('0x27')](_0x3792bb);};}exports[_0x0ceb('0x28')]=function(_0x1b5337,_0x385d68){var _0x331e98={},_0x128102={},_0x1b97b4={'count':0x0,'rows':[]};var _0x293d4d=_[_0x0ceb('0x29')](db[_0x0ceb('0x2a')]['rawAttributes'],function(_0x503d0c){return{'name':_0x503d0c[_0x0ceb('0x2b')],'type':_0x503d0c['type'][_0x0ceb('0x2c')]};});_0x128102[_0x0ceb('0x2d')]=_[_0x0ceb('0x29')](_0x293d4d,'name');_0x128102[_0x0ceb('0x2e')]=_[_0x0ceb('0x2f')](_0x1b5337[_0x0ceb('0x2e')]);_0x128102[_0x0ceb('0x30')]=_[_0x0ceb('0x31')](_0x128102[_0x0ceb('0x2d')],_0x128102[_0x0ceb('0x2e')]);_0x331e98[_0x0ceb('0x32')]=_[_0x0ceb('0x31')](_0x128102[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x331e98['attributes']=_0x331e98[_0x0ceb('0x32')][_0x0ceb('0x34')]?_0x331e98[_0x0ceb('0x32')]:_0x128102[_0x0ceb('0x2d')];if(!_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x35')]('nolimit')){_0x331e98[_0x0ceb('0x19')]=qs['limit'](_0x1b5337['query']['limit']);_0x331e98[_0x0ceb('0x18')]=qs['offset'](_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x18')]);}_0x331e98['order']=qs[_0x0ceb('0x36')](_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x36')]);_0x331e98['where']=qs[_0x0ceb('0x30')](_[_0x0ceb('0x37')](_0x1b5337[_0x0ceb('0x2e')],_0x128102[_0x0ceb('0x30')]),_0x293d4d);if(_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x38')]){_0x331e98[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x331e98[_0x0ceb('0x39')],{'$or':_[_0x0ceb('0x29')](_0x293d4d,function(_0x10772c){if(_0x10772c[_0x0ceb('0x3b')]!==_0x0ceb('0x3c')){var _0x44099a={};_0x44099a[_0x10772c[_0x0ceb('0x26')]]={'$like':'%'+_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x38')]+'%'};return _0x44099a;}})});}_0x331e98=_[_0x0ceb('0x3a')]({},_0x331e98,_0x1b5337[_0x0ceb('0x3d')]);var _0x1368c5={'where':_0x331e98[_0x0ceb('0x39')]};return db[_0x0ceb('0x2a')][_0x0ceb('0x1b')](_0x1368c5)[_0x0ceb('0x21')](function(_0xe65a48){_0x1b97b4[_0x0ceb('0x1b')]=_0xe65a48;if(_0x1b5337[_0x0ceb('0x2e')][_0x0ceb('0x3e')]){_0x331e98['include']=[{'all':!![]}];}return db[_0x0ceb('0x2a')]['findAll'](_0x331e98);})['then'](function(_0x3d2607){_0x1b97b4[_0x0ceb('0x3f')]=_0x3d2607;return _0x1b97b4;})[_0x0ceb('0x21')](respondWithFilteredResult(_0x385d68,_0x331e98))['catch'](handleError(_0x385d68,null));};exports['show']=function(_0x13072a,_0x2f2f71){var _0x2cb999={'raw':![],'where':{'id':_0x13072a[_0x0ceb('0x40')]['id']}},_0x17ab4a={};_0x17ab4a[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db[_0x0ceb('0x2a')][_0x0ceb('0x41')]);_0x17ab4a['query']=_[_0x0ceb('0x2f')](_0x13072a[_0x0ceb('0x2e')]);_0x17ab4a[_0x0ceb('0x30')]=_[_0x0ceb('0x31')](_0x17ab4a['model'],_0x17ab4a[_0x0ceb('0x2e')]);_0x2cb999['attributes']=_[_0x0ceb('0x31')](_0x17ab4a['model'],qs[_0x0ceb('0x33')](_0x13072a[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x2cb999[_0x0ceb('0x32')]=_0x2cb999[_0x0ceb('0x32')][_0x0ceb('0x34')]?_0x2cb999[_0x0ceb('0x32')]:_0x17ab4a[_0x0ceb('0x2d')];if(_0x13072a['query'][_0x0ceb('0x3e')]){_0x2cb999[_0x0ceb('0x42')]=[{'all':!![]}];}_0x2cb999=_['merge']({},_0x2cb999,_0x13072a[_0x0ceb('0x3d')]);return db[_0x0ceb('0x2a')][_0x0ceb('0x43')](_0x2cb999)[_0x0ceb('0x21')](handleEntityNotFound(_0x2f2f71,null))[_0x0ceb('0x21')](respondWithResult(_0x2f2f71,null))['catch'](handleError(_0x2f2f71,null));};exports[_0x0ceb('0x44')]=function(_0x256760,_0x1a7c52){return db[_0x0ceb('0x2a')][_0x0ceb('0x44')](_0x256760[_0x0ceb('0x45')],{})[_0x0ceb('0x21')](function(_0x410e42){var _0x16e90f=_0x256760['user'][_0x0ceb('0x46')]({'plain':!![]});if(!_0x16e90f)throw new Error(_0x0ceb('0x47'));if(_0x16e90f[_0x0ceb('0x48')]===_0x0ceb('0x49')){var _0x51a9c8=_0x410e42['get']({'plain':!![]});var _0x34a427=_0x0ceb('0x4a');return db[_0x0ceb('0x4b')][_0x0ceb('0x43')]({'where':{'name':_0x34a427,'userProfileId':_0x16e90f[_0x0ceb('0x4c')]},'raw':!![]})['then'](function(_0x1afcd6){if(_0x1afcd6&&_0x1afcd6[_0x0ceb('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x51a9c8['name'],'resourceId':_0x51a9c8['id'],'type':_0x1afcd6[_0x0ceb('0x26')],'sectionId':_0x1afcd6['id']},{})[_0x0ceb('0x21')](function(){return _0x410e42;});}else{return _0x410e42;}})[_0x0ceb('0x4e')](function(_0x47c4d6){logger[_0x0ceb('0x24')](_0x0ceb('0x4f'),_0x47c4d6);throw _0x47c4d6;});}return _0x410e42;})['then'](respondWithResult(_0x1a7c52,0xc9))[_0x0ceb('0x4e')](handleError(_0x1a7c52,null));};exports[_0x0ceb('0x50')]=function(_0x2d4947,_0x51addf){var _0x3fe549={'where':{'id':_0x2d4947[_0x0ceb('0x40')]['id']}},_0x4d057f={};_0x4d057f[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db[_0x0ceb('0x2a')][_0x0ceb('0x41')]);_0x3fe549['attributes']=_[_0x0ceb('0x31')](_0x4d057f[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x2d4947[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x3fe549[_0x0ceb('0x32')]=_0x3fe549[_0x0ceb('0x32')][_0x0ceb('0x34')]?_0x3fe549[_0x0ceb('0x32')]:_0x4d057f[_0x0ceb('0x2d')];if(_0x2d4947['query'][_0x0ceb('0x3e')]){_0x3fe549[_0x0ceb('0x42')]=[{'all':!![]}];}_0x3fe549=_[_0x0ceb('0x3a')]({},_0x3fe549,_0x2d4947[_0x0ceb('0x3d')]);return db[_0x0ceb('0x2a')][_0x0ceb('0x43')](_0x3fe549)[_0x0ceb('0x21')](handleEntityNotFound(_0x51addf,null))['then'](function(_0x107a37){if(_0x107a37){var _0x391e2e=_0x107a37[_0x0ceb('0x46')]({'plain':!![]});_0x391e2e=qs[_0x0ceb('0x51')](_0x391e2e,['id',_0x0ceb('0x52'),_0x0ceb('0x53')]);_0x2d4947[_0x0ceb('0x45')]=_[_0x0ceb('0x51')](_0x2d4947[_0x0ceb('0x45')],['id',_0x0ceb('0x52'),_0x0ceb('0x53')]);return db['Campaign'][_0x0ceb('0x44')](_[_0x0ceb('0x3a')](_0x391e2e,_0x2d4947[_0x0ceb('0x45')]),{'include':_0x2d4947[_0x0ceb('0x2e')][_0x0ceb('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x5afd08){var _0x38da0b=_0x2d4947['user'][_0x0ceb('0x46')]({'plain':!![]});if(!_0x38da0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38da0b[_0x0ceb('0x48')]===_0x0ceb('0x49')){var _0x3dba7d=_0x5afd08[_0x0ceb('0x46')]({'plain':!![]});var _0x1b2ba9='IvrCampaigns';return db[_0x0ceb('0x4b')][_0x0ceb('0x43')]({'where':{'name':_0x1b2ba9,'userProfileId':_0x38da0b[_0x0ceb('0x4c')]},'raw':!![]})[_0x0ceb('0x21')](function(_0x4412f0){if(_0x4412f0&&_0x4412f0[_0x0ceb('0x4d')]===0x0){return db['UserProfileResource'][_0x0ceb('0x44')]({'name':_0x3dba7d[_0x0ceb('0x26')],'resourceId':_0x3dba7d['id'],'type':_0x4412f0[_0x0ceb('0x26')],'sectionId':_0x4412f0['id']},{})[_0x0ceb('0x21')](function(){return _0x5afd08;});}else{return _0x5afd08;}})['catch'](function(_0x5e53f8){logger[_0x0ceb('0x24')](_0x0ceb('0x4f'),_0x5e53f8);throw _0x5e53f8;});}return _0x5afd08;});}})[_0x0ceb('0x21')](respondWithResult(_0x51addf,0xc9))[_0x0ceb('0x4e')](handleError(_0x51addf,null));};exports[_0x0ceb('0x20')]=function(_0x27bc5e,_0x3c4fbe){if(_0x27bc5e['body']['id']){delete _0x27bc5e[_0x0ceb('0x45')]['id'];}return db[_0x0ceb('0x2a')][_0x0ceb('0x43')]({'where':{'id':_0x27bc5e[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x3c4fbe,null))[_0x0ceb('0x21')](saveUpdates(_0x27bc5e[_0x0ceb('0x45')],null))[_0x0ceb('0x21')](respondWithResult(_0x3c4fbe,null))[_0x0ceb('0x4e')](handleError(_0x3c4fbe,null));};exports[_0x0ceb('0x23')]=function(_0x5be1a1,_0x56e3a8){return db[_0x0ceb('0x2a')][_0x0ceb('0x43')]({'where':{'id':_0x5be1a1[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x56e3a8,null))[_0x0ceb('0x21')](removeEntity(_0x56e3a8,null))[_0x0ceb('0x4e')](handleError(_0x56e3a8,null));};exports[_0x0ceb('0x54')]=function(_0x58ebb8,_0x2af2b,_0x1b2a48){var _0x21945c={'raw':!![],'where':{}};var _0x53025d={};var _0x3f5c74={'count':0x0,'rows':[]};return db[_0x0ceb('0x2a')][_0x0ceb('0x55')]({'where':{'id':_0x58ebb8[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x2af2b,null))[_0x0ceb('0x21')](function(_0x1146f3){if(_0x1146f3){_0x53025d[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db[_0x0ceb('0x56')]['rawAttributes']);_0x53025d[_0x0ceb('0x2e')]=_[_0x0ceb('0x2f')](_0x58ebb8[_0x0ceb('0x2e')]);_0x53025d['filters']=_[_0x0ceb('0x31')](_0x53025d[_0x0ceb('0x2d')],_0x53025d[_0x0ceb('0x2e')]);_0x21945c['attributes']=_[_0x0ceb('0x31')](_0x53025d[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x21945c['attributes']=_0x21945c['attributes']['length']?_0x21945c[_0x0ceb('0x32')]:_0x53025d['model'];if(!_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x35')](_0x0ceb('0x57'))){_0x21945c[_0x0ceb('0x19')]=qs['limit'](_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x19')]);_0x21945c['offset']=qs[_0x0ceb('0x18')](_0x58ebb8['query'][_0x0ceb('0x18')]);}_0x21945c[_0x0ceb('0x58')]=qs[_0x0ceb('0x36')](_0x58ebb8[_0x0ceb('0x2e')]['sort']);_0x21945c[_0x0ceb('0x39')]=qs[_0x0ceb('0x30')](_[_0x0ceb('0x37')](_0x58ebb8['query'],_0x53025d[_0x0ceb('0x30')]));_0x21945c['where'][_0x0ceb('0x59')]=_0x1146f3['id'];if(_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x38')]){_0x21945c[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x21945c[_0x0ceb('0x39')],{'$or':_['map'](_0x21945c[_0x0ceb('0x32')],function(_0x1097f9){var _0x30b653={};_0x30b653[_0x1097f9]={'$like':'%'+_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x38')]+'%'};return _0x30b653;})});}_0x21945c=_[_0x0ceb('0x3a')]({},_0x21945c,_0x58ebb8[_0x0ceb('0x3d')]);return db[_0x0ceb('0x56')]['count']({'where':_0x21945c[_0x0ceb('0x39')]})[_0x0ceb('0x21')](function(_0x225735){_0x3f5c74['count']=_0x225735;if(_0x58ebb8[_0x0ceb('0x2e')][_0x0ceb('0x3e')]){_0x21945c[_0x0ceb('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x0ceb('0x5a')](_0x21945c);})['then'](function(_0x5b7511){_0x3f5c74[_0x0ceb('0x3f')]=_0x5b7511;return _0x3f5c74;});}})[_0x0ceb('0x21')](respondWithFilteredResult(_0x2af2b,_0x21945c))['catch'](handleError(_0x2af2b,null));};exports[_0x0ceb('0x5b')]=function(_0x86891b,_0x593ae0,_0x1c08a6){var _0x22585c={'raw':!![],'where':{}};var _0x517162={};var _0x5efd29={'count':0x0,'rows':[]};return db[_0x0ceb('0x2a')][_0x0ceb('0x55')]({'where':{'id':_0x86891b[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x593ae0,null))[_0x0ceb('0x21')](function(_0x3b952a){if(_0x3b952a){_0x517162[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db['CmHopperHistory'][_0x0ceb('0x41')]);_0x517162[_0x0ceb('0x2e')]=_[_0x0ceb('0x2f')](_0x86891b[_0x0ceb('0x2e')]);_0x517162[_0x0ceb('0x30')]=_[_0x0ceb('0x31')](_0x517162[_0x0ceb('0x2d')],_0x517162['query']);_0x22585c[_0x0ceb('0x32')]=_[_0x0ceb('0x31')](_0x517162[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x22585c['attributes']=_0x22585c[_0x0ceb('0x32')][_0x0ceb('0x34')]?_0x22585c[_0x0ceb('0x32')]:_0x517162[_0x0ceb('0x2d')];if(!_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x35')]('nolimit')){_0x22585c[_0x0ceb('0x19')]=qs[_0x0ceb('0x19')](_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x19')]);_0x22585c[_0x0ceb('0x18')]=qs['offset'](_0x86891b[_0x0ceb('0x2e')]['offset']);}_0x22585c[_0x0ceb('0x58')]=qs[_0x0ceb('0x36')](_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x36')]);_0x22585c[_0x0ceb('0x39')]=qs[_0x0ceb('0x30')](_[_0x0ceb('0x37')](_0x86891b[_0x0ceb('0x2e')],_0x517162[_0x0ceb('0x30')]));_0x22585c['where'][_0x0ceb('0x59')]=_0x3b952a['id'];if(_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x38')]){_0x22585c[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x22585c['where'],{'$or':_[_0x0ceb('0x29')](_0x22585c[_0x0ceb('0x32')],function(_0x5bfc47){var _0x48a44e={};_0x48a44e[_0x5bfc47]={'$like':'%'+_0x86891b[_0x0ceb('0x2e')][_0x0ceb('0x38')]+'%'};return _0x48a44e;})});}_0x22585c=_[_0x0ceb('0x3a')]({},_0x22585c,_0x86891b[_0x0ceb('0x3d')]);return db[_0x0ceb('0x5c')][_0x0ceb('0x1b')]({'where':_0x22585c[_0x0ceb('0x39')]})[_0x0ceb('0x21')](function(_0x3e20bc){_0x5efd29[_0x0ceb('0x1b')]=_0x3e20bc;if(_0x86891b[_0x0ceb('0x2e')]['includeAll']){_0x22585c['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0ceb('0x5a')](_0x22585c);})[_0x0ceb('0x21')](function(_0x2f9e99){_0x5efd29[_0x0ceb('0x3f')]=_0x2f9e99;return _0x5efd29;});}})['then'](respondWithFilteredResult(_0x593ae0,_0x22585c))[_0x0ceb('0x4e')](handleError(_0x593ae0,null));};exports[_0x0ceb('0x5d')]=function(_0x354cc9,_0x88170a,_0xbc0ec8){var _0x254a8a={'raw':!![],'where':{}};var _0x7021e9={};var _0x3dd13d={'count':0x0,'rows':[]};return db[_0x0ceb('0x2a')][_0x0ceb('0x55')]({'where':{'id':_0x354cc9[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x88170a,null))[_0x0ceb('0x21')](function(_0x480465){if(_0x480465){_0x7021e9[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db[_0x0ceb('0x5e')][_0x0ceb('0x41')]);_0x7021e9[_0x0ceb('0x2e')]=_['keys'](_0x354cc9[_0x0ceb('0x2e')]);_0x7021e9['filters']=_[_0x0ceb('0x31')](_0x7021e9[_0x0ceb('0x2d')],_0x7021e9[_0x0ceb('0x2e')]);_0x254a8a[_0x0ceb('0x32')]=_['intersection'](_0x7021e9[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x354cc9[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x254a8a['attributes']=_0x254a8a[_0x0ceb('0x32')]['length']?_0x254a8a[_0x0ceb('0x32')]:_0x7021e9['model'];if(!_0x354cc9[_0x0ceb('0x2e')]['hasOwnProperty'](_0x0ceb('0x57'))){_0x254a8a[_0x0ceb('0x19')]=qs['limit'](_0x354cc9[_0x0ceb('0x2e')]['limit']);_0x254a8a[_0x0ceb('0x18')]=qs[_0x0ceb('0x18')](_0x354cc9[_0x0ceb('0x2e')][_0x0ceb('0x18')]);}_0x254a8a[_0x0ceb('0x58')]=qs[_0x0ceb('0x36')](_0x354cc9[_0x0ceb('0x2e')][_0x0ceb('0x36')]);_0x254a8a['where']=qs[_0x0ceb('0x30')](_['pick'](_0x354cc9[_0x0ceb('0x2e')],_0x7021e9[_0x0ceb('0x30')]));_0x254a8a['where'][_0x0ceb('0x59')]=_0x480465['id'];if(_0x354cc9[_0x0ceb('0x2e')][_0x0ceb('0x38')]){_0x254a8a[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x254a8a[_0x0ceb('0x39')],{'$or':_[_0x0ceb('0x29')](_0x254a8a[_0x0ceb('0x32')],function(_0x38bc57){var _0x428c2b={};_0x428c2b[_0x38bc57]={'$like':'%'+_0x354cc9['query'][_0x0ceb('0x38')]+'%'};return _0x428c2b;})});}_0x254a8a=_[_0x0ceb('0x3a')]({},_0x254a8a,_0x354cc9[_0x0ceb('0x3d')]);return db[_0x0ceb('0x5e')][_0x0ceb('0x1b')]({'where':_0x254a8a['where']})[_0x0ceb('0x21')](function(_0x39b0ba){_0x3dd13d[_0x0ceb('0x1b')]=_0x39b0ba;if(_0x354cc9[_0x0ceb('0x2e')][_0x0ceb('0x3e')]){_0x254a8a[_0x0ceb('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0ceb('0x5a')](_0x254a8a);})[_0x0ceb('0x21')](function(_0x342d36){_0x3dd13d[_0x0ceb('0x3f')]=_0x342d36;return _0x3dd13d;});}})['then'](respondWithFilteredResult(_0x88170a,_0x254a8a))['catch'](handleError(_0x88170a,null));};exports[_0x0ceb('0x5f')]=function(_0x87a23d,_0x2ae363,_0x52ebc8){var _0x1af90b={'raw':!![],'where':{}};var _0x803210={};var _0xeb1c83={'count':0x0,'rows':[]};return db[_0x0ceb('0x2a')]['findOne']({'where':{'id':_0x87a23d[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x2ae363,null))[_0x0ceb('0x21')](function(_0xb9f7db){if(_0xb9f7db){_0x803210['model']=_[_0x0ceb('0x2f')](db[_0x0ceb('0x60')]['rawAttributes']);_0x803210[_0x0ceb('0x2e')]=_['keys'](_0x87a23d[_0x0ceb('0x2e')]);_0x803210[_0x0ceb('0x30')]=_[_0x0ceb('0x31')](_0x803210[_0x0ceb('0x2d')],_0x803210[_0x0ceb('0x2e')]);_0x1af90b[_0x0ceb('0x32')]=_['intersection'](_0x803210[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x87a23d['query'][_0x0ceb('0x33')]));_0x1af90b[_0x0ceb('0x32')]=_0x1af90b['attributes'][_0x0ceb('0x34')]?_0x1af90b[_0x0ceb('0x32')]:_0x803210[_0x0ceb('0x2d')];if(!_0x87a23d[_0x0ceb('0x2e')][_0x0ceb('0x35')](_0x0ceb('0x57'))){_0x1af90b['limit']=qs[_0x0ceb('0x19')](_0x87a23d[_0x0ceb('0x2e')][_0x0ceb('0x19')]);_0x1af90b[_0x0ceb('0x18')]=qs[_0x0ceb('0x18')](_0x87a23d['query'][_0x0ceb('0x18')]);}_0x1af90b['order']=qs[_0x0ceb('0x36')](_0x87a23d['query'][_0x0ceb('0x36')]);_0x1af90b[_0x0ceb('0x39')]=qs[_0x0ceb('0x30')](_[_0x0ceb('0x37')](_0x87a23d['query'],_0x803210[_0x0ceb('0x30')]));_0x1af90b[_0x0ceb('0x39')]['CampaignId']=_0xb9f7db['id'];if(_0x87a23d['query'][_0x0ceb('0x38')]){_0x1af90b[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x1af90b[_0x0ceb('0x39')],{'$or':_[_0x0ceb('0x29')](_0x1af90b[_0x0ceb('0x32')],function(_0x1fe92e){var _0x3595e8={};_0x3595e8[_0x1fe92e]={'$like':'%'+_0x87a23d['query'][_0x0ceb('0x38')]+'%'};return _0x3595e8;})});}_0x1af90b=_[_0x0ceb('0x3a')]({},_0x1af90b,_0x87a23d[_0x0ceb('0x3d')]);return db[_0x0ceb('0x60')][_0x0ceb('0x1b')]({'where':_0x1af90b['where']})[_0x0ceb('0x21')](function(_0x393e70){_0xeb1c83['count']=_0x393e70;if(_0x87a23d[_0x0ceb('0x2e')][_0x0ceb('0x3e')]){_0x1af90b[_0x0ceb('0x42')]=[{'all':!![]}];}return db[_0x0ceb('0x60')]['findAll'](_0x1af90b);})['then'](function(_0x44c57b){_0xeb1c83[_0x0ceb('0x3f')]=_0x44c57b;return _0xeb1c83;});}})[_0x0ceb('0x21')](respondWithFilteredResult(_0x2ae363,_0x1af90b))['catch'](handleError(_0x2ae363,null));};exports[_0x0ceb('0x61')]=function(_0xba3a34,_0x41c049,_0x499869){var _0x2078f5={};var _0x44447e={};var _0x752d67;var _0x321f22;return db[_0x0ceb('0x2a')]['findOne']({'where':{'id':_0xba3a34[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x41c049,null))[_0x0ceb('0x21')](function(_0x1daf76){if(_0x1daf76){_0x752d67=_0x1daf76;_0x44447e[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db[_0x0ceb('0x62')][_0x0ceb('0x41')]);_0x44447e[_0x0ceb('0x2e')]=_[_0x0ceb('0x2f')](_0xba3a34[_0x0ceb('0x2e')]);_0x44447e[_0x0ceb('0x30')]=_[_0x0ceb('0x31')](_0x44447e['model'],_0x44447e[_0x0ceb('0x2e')]);_0x2078f5[_0x0ceb('0x32')]=_['intersection'](_0x44447e['model'],qs[_0x0ceb('0x33')](_0xba3a34[_0x0ceb('0x2e')][_0x0ceb('0x33')]));_0x2078f5[_0x0ceb('0x32')]=_0x2078f5[_0x0ceb('0x32')]['length']?_0x2078f5[_0x0ceb('0x32')]:_0x44447e[_0x0ceb('0x2d')];_0x2078f5[_0x0ceb('0x58')]=qs['sort'](_0xba3a34[_0x0ceb('0x2e')]['sort']);_0x2078f5[_0x0ceb('0x39')]=qs[_0x0ceb('0x30')](_[_0x0ceb('0x37')](_0xba3a34[_0x0ceb('0x2e')],_0x44447e[_0x0ceb('0x30')]));if(_0xba3a34[_0x0ceb('0x2e')][_0x0ceb('0x38')]){_0x2078f5[_0x0ceb('0x39')]=_['merge'](_0x2078f5[_0x0ceb('0x39')],{'$or':_[_0x0ceb('0x29')](_0x2078f5[_0x0ceb('0x32')],function(_0x11e8e0){var _0x1bac42={};_0x1bac42[_0x11e8e0]={'$like':'%'+_0xba3a34[_0x0ceb('0x2e')][_0x0ceb('0x38')]+'%'};return _0x1bac42;})});}_0x2078f5=_[_0x0ceb('0x3a')]({},_0x2078f5,_0xba3a34[_0x0ceb('0x3d')]);return _0x752d67['getLists'](_0x2078f5);}})[_0x0ceb('0x21')](function(_0xde54b5){if(_0xde54b5){_0x321f22=_0xde54b5[_0x0ceb('0x34')];if(!_0xba3a34['query'][_0x0ceb('0x35')]('nolimit')){_0x2078f5[_0x0ceb('0x19')]=qs[_0x0ceb('0x19')](_0xba3a34['query'][_0x0ceb('0x19')]);_0x2078f5[_0x0ceb('0x18')]=qs[_0x0ceb('0x18')](_0xba3a34[_0x0ceb('0x2e')]['offset']);}return _0x752d67[_0x0ceb('0x61')](_0x2078f5);}})[_0x0ceb('0x21')](function(_0x16920a){if(_0x16920a){return _0x16920a?{'count':_0x321f22,'rows':_0x16920a}:null;}})['then'](respondWithResult(_0x41c049,null))[_0x0ceb('0x4e')](handleError(_0x41c049,null));};exports[_0x0ceb('0x63')]=function(_0x5244ea,_0x1a0ff6,_0x4319c5){var _0x42dfe2,_0x4b98cf;var _0xa64391=[];var _0x507155=moment()[_0x0ceb('0x64')](_0x0ceb('0x65'));return db[_0x0ceb('0x2a')]['find']({'where':{'id':_0x5244ea[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x1a0ff6,null))['then'](function(_0x453dc9){if(_0x453dc9){_0x4b98cf=_0x453dc9;return _0x453dc9['addLists'](_0x5244ea[_0x0ceb('0x45')]['ids'],_['omit'](_0x5244ea[_0x0ceb('0x45')],[_0x0ceb('0x66'),'id'])||{});}return null;})[_0x0ceb('0x67')](function(_0x4d780c){var _0x35e0af;var _0x49493f;_0x42dfe2=_0x4d780c||[];var _0x4be157=[];if(_0x4d780c){for(var _0x274912=0x0;_0x274912<_0x4d780c[_0x0ceb('0x34')];_0x274912+=0x1){var _0x4375d6=_0x4d780c[_0x274912]['get']({'plain':!![]});_0x4b98cf[_0x0ceb('0x68')]=_0x5244ea[_0x0ceb('0x45')][_0x0ceb('0x68')]?_0x5244ea['body'][_0x0ceb('0x68')]:_0x4b98cf[_0x0ceb('0x68')];switch(_0x4b98cf[_0x0ceb('0x68')]){case _0x0ceb('0x69'):_0x35e0af=squel['insert']()[_0x0ceb('0x6a')](_0x0ceb('0x6b'))[_0x0ceb('0x6c')]([_0x0ceb('0x6d'),_0x0ceb('0x6e'),_0x0ceb('0x6f'),'ListId',_0x0ceb('0x59'),_0x0ceb('0x52'),'updatedAt'],squel[_0x0ceb('0x70')]()['field'](_0x0ceb('0x6d'),'phone')['field']('NOW()',_0x0ceb('0x6e'))[_0x0ceb('0x71')]('id',_0x0ceb('0x6f'))[_0x0ceb('0x71')](_0x4375d6['CmListId'][_0x0ceb('0x72')](),'ListId')[_0x0ceb('0x71')](_0x5244ea['params']['id'][_0x0ceb('0x72')](),_0x0ceb('0x59'))[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27',_0x0ceb('0x52'))[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27',_0x0ceb('0x53'))[_0x0ceb('0x73')]('cm_contacts')[_0x0ceb('0x39')](_0x0ceb('0x74'))[_0x0ceb('0x39')](_0x0ceb('0x75'),_0x4375d6[_0x0ceb('0x76')]['toString']())[_0x0ceb('0x39')](_0x0ceb('0x77'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0ceb('0x70')]()[_0x0ceb('0x71')](_0x0ceb('0x78'))[_0x0ceb('0x73')](_0x0ceb('0x79'))[_0x0ceb('0x39')](_0x0ceb('0x7a'),_0x5244ea[_0x0ceb('0x40')]['id']['toString']()))[_0x0ceb('0x39')](_0x0ceb('0x7b'),squel[_0x0ceb('0x70')]()['field']('COALESCE(phone,\x27\x27)')[_0x0ceb('0x73')](_0x0ceb('0x6b'))[_0x0ceb('0x39')](_0x0ceb('0x7a'),_0x5244ea[_0x0ceb('0x40')]['id'][_0x0ceb('0x72')]())))[_0x0ceb('0x72')]();break;case'onlyIfOpen':_0x35e0af=squel[_0x0ceb('0x7c')]()[_0x0ceb('0x6a')](_0x0ceb('0x6b'))[_0x0ceb('0x6c')]([_0x0ceb('0x6d'),'scheduledAt',_0x0ceb('0x6f'),_0x0ceb('0x7d'),_0x0ceb('0x59'),'createdAt',_0x0ceb('0x53')],squel[_0x0ceb('0x70')]()['field']('phone',_0x0ceb('0x6d'))['field'](_0x0ceb('0x7e'),_0x0ceb('0x6e'))[_0x0ceb('0x71')]('id',_0x0ceb('0x6f'))[_0x0ceb('0x71')](_0x4375d6[_0x0ceb('0x76')]['toString'](),_0x0ceb('0x7d'))[_0x0ceb('0x71')](_0x5244ea[_0x0ceb('0x40')]['id'][_0x0ceb('0x72')](),'CampaignId')[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27','createdAt')[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27','updatedAt')[_0x0ceb('0x73')](_0x0ceb('0x7f'))[_0x0ceb('0x39')](_0x0ceb('0x74'))['where'](_0x0ceb('0x75'),_0x4375d6[_0x0ceb('0x76')][_0x0ceb('0x72')]())[_0x0ceb('0x39')](_0x0ceb('0x77'))[_0x0ceb('0x39')](_0x0ceb('0x7b'),squel[_0x0ceb('0x70')]()['field']('COALESCE(phone,\x27\x27)')[_0x0ceb('0x73')](_0x0ceb('0x6b'))['where'](_0x0ceb('0x7a'),_0x5244ea[_0x0ceb('0x40')]['id'][_0x0ceb('0x72')]())))[_0x0ceb('0x72')]();break;default:_0x35e0af=squel[_0x0ceb('0x7c')]()[_0x0ceb('0x6a')](_0x0ceb('0x6b'))[_0x0ceb('0x6c')](['phone',_0x0ceb('0x6e'),_0x0ceb('0x6f'),_0x0ceb('0x7d'),_0x0ceb('0x59'),_0x0ceb('0x52'),_0x0ceb('0x53')],squel[_0x0ceb('0x70')]()[_0x0ceb('0x71')](_0x0ceb('0x6d'),'phone')[_0x0ceb('0x71')]('NOW()',_0x0ceb('0x6e'))[_0x0ceb('0x71')]('id',_0x0ceb('0x6f'))[_0x0ceb('0x71')](_0x4375d6[_0x0ceb('0x76')][_0x0ceb('0x72')](),_0x0ceb('0x7d'))['field'](_0x5244ea['params']['id']['toString'](),_0x0ceb('0x59'))[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27',_0x0ceb('0x52'))[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27',_0x0ceb('0x53'))[_0x0ceb('0x73')](_0x0ceb('0x7f'))[_0x0ceb('0x39')](_0x0ceb('0x74'))[_0x0ceb('0x39')](_0x0ceb('0x75'),_0x4375d6[_0x0ceb('0x76')][_0x0ceb('0x72')]())[_0x0ceb('0x39')](_0x0ceb('0x77')))[_0x0ceb('0x72')]();}_0x49493f=squel['insert']()[_0x0ceb('0x6a')]('cm_hopper_additional_phones')[_0x0ceb('0x6c')]([_0x0ceb('0x80'),'scheduledAt',_0x0ceb('0x6d'),'OrderBy','createdAt',_0x0ceb('0x53')],squel[_0x0ceb('0x70')]()[_0x0ceb('0x71')](_0x0ceb('0x81'),'id')['field'](_0x0ceb('0x7e'),_0x0ceb('0x6e'))[_0x0ceb('0x71')](_0x0ceb('0x82'),_0x0ceb('0x6d'))[_0x0ceb('0x71')](_0x0ceb('0x83'),'OrderBy')[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27',_0x0ceb('0x52'))[_0x0ceb('0x71')]('\x27'+_0x507155+'\x27','updatedAt')[_0x0ceb('0x73')](_0x0ceb('0x84'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x0ceb('0x85'),_0x4375d6[_0x0ceb('0x76')][_0x0ceb('0x72')]())[_0x0ceb('0x39')](_0x0ceb('0x86'),_0x5244ea[_0x0ceb('0x40')]['id'][_0x0ceb('0x72')]())[_0x0ceb('0x39')](_0x0ceb('0x87'),_0x507155))['toString']();_0x4be157[_0x0ceb('0x88')](db[_0x0ceb('0x89')][_0x0ceb('0x2e')](_0x35e0af));_0xa64391[_0x0ceb('0x88')](db['sequelize'][_0x0ceb('0x2e')](_0x49493f));}return BPromise['all'](_0x4be157);}})[_0x0ceb('0x21')](function(){return BPromise[_0x0ceb('0x8a')](_0xa64391);})[_0x0ceb('0x21')](function(){return _0x42dfe2;})[_0x0ceb('0x21')](respondWithResult(_0x1a0ff6,null))[_0x0ceb('0x4e')](handleError(_0x1a0ff6,null));};exports[_0x0ceb('0x8b')]=function(_0x54bef7,_0x87130a,_0x5306ed){return db[_0x0ceb('0x2a')]['find']({'where':{'id':_0x54bef7['params']['id']}})['then'](handleEntityNotFound(_0x87130a,null))[_0x0ceb('0x21')](function(_0x302513){if(_0x302513){return _0x302513['removeLists'](_0x54bef7[_0x0ceb('0x2e')][_0x0ceb('0x66')]);}})[_0x0ceb('0x21')](function(_0x21b9ee){if(_0x21b9ee){return db[_0x0ceb('0x56')][_0x0ceb('0x23')]({'where':{'ListId':_0x54bef7[_0x0ceb('0x2e')][_0x0ceb('0x66')],'CampaignId':_0x54bef7[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](function(){return _0x21b9ee;});}})[_0x0ceb('0x21')](respondWithStatusCode(_0x87130a,null))[_0x0ceb('0x4e')](handleError(_0x87130a,null));};exports['getBlackLists']=function(_0x594501,_0x18f12d,_0x5cd778){var _0x450b5b={};var _0x344a9d={};var _0x8ccc83;var _0x2f8e58;return db[_0x0ceb('0x2a')]['findOne']({'where':{'id':_0x594501[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x18f12d,null))[_0x0ceb('0x21')](function(_0x507355){if(_0x507355){_0x8ccc83=_0x507355;_0x344a9d[_0x0ceb('0x2d')]=_[_0x0ceb('0x2f')](db['CmList']['rawAttributes']);_0x344a9d[_0x0ceb('0x2e')]=_[_0x0ceb('0x2f')](_0x594501[_0x0ceb('0x2e')]);_0x344a9d[_0x0ceb('0x30')]=_['intersection'](_0x344a9d[_0x0ceb('0x2d')],_0x344a9d[_0x0ceb('0x2e')]);_0x450b5b[_0x0ceb('0x32')]=_[_0x0ceb('0x31')](_0x344a9d[_0x0ceb('0x2d')],qs[_0x0ceb('0x33')](_0x594501[_0x0ceb('0x2e')]['fields']));_0x450b5b['attributes']=_0x450b5b[_0x0ceb('0x32')][_0x0ceb('0x34')]?_0x450b5b['attributes']:_0x344a9d[_0x0ceb('0x2d')];_0x450b5b[_0x0ceb('0x58')]=qs['sort'](_0x594501[_0x0ceb('0x2e')]['sort']);_0x450b5b[_0x0ceb('0x39')]=qs['filters'](_[_0x0ceb('0x37')](_0x594501[_0x0ceb('0x2e')],_0x344a9d[_0x0ceb('0x30')]));if(_0x594501[_0x0ceb('0x2e')]['filter']){_0x450b5b[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x450b5b['where'],{'$or':_[_0x0ceb('0x29')](_0x450b5b[_0x0ceb('0x32')],function(_0x3e7851){var _0x965ab={};_0x965ab[_0x3e7851]={'$like':'%'+_0x594501[_0x0ceb('0x2e')][_0x0ceb('0x38')]+'%'};return _0x965ab;})});}_0x450b5b=_[_0x0ceb('0x3a')]({},_0x450b5b,_0x594501[_0x0ceb('0x3d')]);return _0x8ccc83[_0x0ceb('0x8c')](_0x450b5b);}})[_0x0ceb('0x21')](function(_0x2464c9){if(_0x2464c9){_0x2f8e58=_0x2464c9[_0x0ceb('0x34')];if(!_0x594501['query'][_0x0ceb('0x35')]('nolimit')){_0x450b5b[_0x0ceb('0x19')]=qs['limit'](_0x594501['query'][_0x0ceb('0x19')]);_0x450b5b['offset']=qs[_0x0ceb('0x18')](_0x594501[_0x0ceb('0x2e')][_0x0ceb('0x18')]);}return _0x8ccc83[_0x0ceb('0x8c')](_0x450b5b);}})['then'](function(_0xad87ab){if(_0xad87ab){return _0xad87ab?{'count':_0x2f8e58,'rows':_0xad87ab}:null;}})[_0x0ceb('0x21')](respondWithResult(_0x18f12d,null))[_0x0ceb('0x4e')](handleError(_0x18f12d,null));};exports[_0x0ceb('0x8d')]=function(_0x2d9202,_0x24cd9b,_0x55ad74){var _0x266aba,_0x3bf9fa;var _0x511498=[];var _0x24d8f2=moment()[_0x0ceb('0x64')](_0x0ceb('0x65'));return db[_0x0ceb('0x2a')][_0x0ceb('0x43')]({'where':{'id':_0x2d9202[_0x0ceb('0x40')]['id']}})[_0x0ceb('0x21')](handleEntityNotFound(_0x24cd9b,null))[_0x0ceb('0x21')](function(_0x4f436a){if(_0x4f436a){_0x3bf9fa=_0x4f436a;return _0x4f436a[_0x0ceb('0x8d')](_0x2d9202[_0x0ceb('0x45')]['ids'],_[_0x0ceb('0x51')](_0x2d9202[_0x0ceb('0x45')],['ids','id'])||{});}return null;})[_0x0ceb('0x67')](function(_0x4838a5){var _0x368d5d;var _0x511352;_0x266aba=_0x4838a5||[];var _0xba946a=[];if(_0x4838a5){for(var _0x191d74=0x0;_0x191d74<_0x4838a5[_0x0ceb('0x34')];_0x191d74+=0x1){var _0x3c4736=_0x4838a5[_0x191d74][_0x0ceb('0x46')]({'plain':!![]});_0x368d5d=squel[_0x0ceb('0x7c')]()['into'](_0x0ceb('0x8e'))['fromQuery']([_0x0ceb('0x6d'),'ContactId','ListId','CampaignId',_0x0ceb('0x52'),'updatedAt'],squel[_0x0ceb('0x70')]()[_0x0ceb('0x71')](_0x0ceb('0x6d'),'phone')[_0x0ceb('0x71')]('id',_0x0ceb('0x6f'))[_0x0ceb('0x71')](_0x3c4736[_0x0ceb('0x76')][_0x0ceb('0x72')](),'ListId')[_0x0ceb('0x71')](_0x2d9202['params']['id'][_0x0ceb('0x72')](),'CampaignId')[_0x0ceb('0x71')]('NOW()',_0x0ceb('0x52'))[_0x0ceb('0x71')](_0x0ceb('0x7e'),_0x0ceb('0x53'))[_0x0ceb('0x73')](_0x0ceb('0x7f'))[_0x0ceb('0x39')]('deletedAt\x20IS\x20NULL')[_0x0ceb('0x39')](_0x0ceb('0x75'),_0x3c4736[_0x0ceb('0x76')][_0x0ceb('0x72')]())['where'](_0x0ceb('0x77')))['toString']();_0xba946a[_0x0ceb('0x88')](db[_0x0ceb('0x89')]['query'](_0x368d5d));}return BPromise[_0x0ceb('0x8a')](_0xba946a);}})[_0x0ceb('0x21')](function(){return _0x266aba;})['then'](respondWithResult(_0x24cd9b,null))[_0x0ceb('0x4e')](handleError(_0x24cd9b,null));};exports[_0x0ceb('0x8f')]=function(_0x4f9611,_0x47be26,_0xaa334f){return db['Campaign'][_0x0ceb('0x43')]({'where':{'id':_0x4f9611['params']['id']}})['then'](handleEntityNotFound(_0x47be26,null))[_0x0ceb('0x21')](function(_0x333757){if(_0x333757){return _0x333757[_0x0ceb('0x8f')](_0x4f9611['query'][_0x0ceb('0x66')]);}})[_0x0ceb('0x21')](function(_0x2a0571){if(_0x2a0571){return db[_0x0ceb('0x60')][_0x0ceb('0x23')]({'where':{'ListId':_0x4f9611[_0x0ceb('0x2e')]['ids'],'CampaignId':_0x4f9611['params']['id']}})[_0x0ceb('0x21')](function(){return _0x2a0571;});}})[_0x0ceb('0x21')](respondWithStatusCode(_0x47be26,null))[_0x0ceb('0x4e')](handleError(_0x47be26,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 61dc880..ed908a6 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4025fd,_0x392379){var _0x58fb64=function(_0x39369f){while(--_0x39369f){_0x4025fd['push'](_0x4025fd['shift']());}};_0x58fb64(++_0x392379);}(_0x7a54,0x106));var _0x47a5=function(_0x27b859,_0x2c34fc){_0x27b859=_0x27b859-0x0;var _0x1f0153=_0x7a54[_0x27b859];return _0x1f0153;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x469056,_0x4f46e1){var _0xba97aa=function(_0x217722){while(--_0x217722){_0x469056['push'](_0x469056['shift']());}};_0xba97aa(++_0x4f46e1);}(_0x7a54,0x106));var _0x47a5=function(_0x672ee4,_0x1ab74c){_0x672ee4=_0x672ee4-0x0;var _0x55bdd8=_0x7a54[_0x672ee4];return _0x55bdd8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index f9d48e2..be04642 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 _0x1120=['model','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','options','raw','attributes','include','map'];(function(_0x4bf0b5,_0xba25b7){var _0x51c87c=function(_0x3d8384){while(--_0x3d8384){_0x4bf0b5['push'](_0x4bf0b5['shift']());}};_0x51c87c(++_0xba25b7);}(_0x1120,0x140));var _0x0112=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1120[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var moment=require(_0x0112('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0112('0x3'));var logger=require(_0x0112('0x4'))(_0x0112('0x5'));var config=require(_0x0112('0x6'));var jayson=require(_0x0112('0x7'));var client=jayson[_0x0112('0x8')][_0x0112('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ad0d,_0x31d67a,_0x444422){return new BPromise(function(_0x2fd18c,_0x1e87af){return client['request'](_0x40ad0d,_0x444422)[_0x0112('0xa')](function(_0x26fd2e){logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));logger[_0x0112('0xe')](_0x0112('0xf'),_0x31d67a,'request\x20sent',JSON[_0x0112('0x10')](_0x26fd2e));if(_0x26fd2e[_0x0112('0x11')]){if(_0x26fd2e[_0x0112('0x11')][_0x0112('0x12')]===0x1f4){logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e[_0x0112('0x11')][_0x0112('0x13')]);return _0x1e87af(_0x26fd2e[_0x0112('0x11')]['message']);}logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e['error'][_0x0112('0x13')]);return _0x2fd18c(_0x26fd2e['error'][_0x0112('0x13')]);}else{logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));_0x2fd18c(_0x26fd2e['result'][_0x0112('0x13')]);}})[_0x0112('0x14')](function(_0x5ef9fe){logger['error']('Campaign,\x20%s,\x20%s',_0x31d67a,_0x5ef9fe);_0x1e87af(_0x5ef9fe);});});}exports[_0x0112('0x15')]=function(_0x58f0ed){var _0x5c2236=this;return new Promise(function(_0x4e34c1,_0x19f10e){return db[_0x0112('0x16')]['findAll']({'raw':_0x58f0ed['options']?_0x58f0ed[_0x0112('0x17')][_0x0112('0x18')]===undefined?!![]:![]:!![],'where':_0x58f0ed['options']?_0x58f0ed[_0x0112('0x17')]['where']||null:null,'attributes':_0x58f0ed['options']?_0x58f0ed['options'][_0x0112('0x19')]||null:null,'limit':_0x58f0ed[_0x0112('0x17')]?_0x58f0ed[_0x0112('0x17')]['limit']||null:null,'include':_0x58f0ed[_0x0112('0x17')]?_0x58f0ed[_0x0112('0x17')][_0x0112('0x1a')]?_[_0x0112('0x1b')](_0x58f0ed['options'][_0x0112('0x1a')],function(_0x408bb8){return{'model':db[_0x408bb8[_0x0112('0x1c')]],'as':_0x408bb8['as'],'attributes':_0x408bb8[_0x0112('0x19')],'include':_0x408bb8['include']?_[_0x0112('0x1b')](_0x408bb8['include'],function(_0x58ea13){return{'model':db[_0x58ea13[_0x0112('0x1c')]],'as':_0x58ea13['as'],'attributes':_0x58ea13['attributes'],'include':_0x58ea13[_0x0112('0x1a')]?_['map'](_0x58ea13[_0x0112('0x1a')],function(_0x58e5){return{'model':db[_0x58e5[_0x0112('0x1c')]],'as':_0x58e5['as'],'attributes':_0x58e5[_0x0112('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0112('0xa')](function(_0x11bd7f){logger[_0x0112('0xb')](_0x0112('0x15'),_0x58f0ed);logger[_0x0112('0xe')](_0x0112('0x15'),_0x58f0ed,JSON[_0x0112('0x10')](_0x11bd7f));_0x4e34c1(_0x11bd7f);})['catch'](function(_0x6d44bb){logger['error'](_0x0112('0x15'),_0x6d44bb[_0x0112('0x13')],_0x58f0ed);_0x19f10e(_0x5c2236[_0x0112('0x11')](0x1f4,_0x6d44bb['message']));});});}; \ No newline at end of file +var _0xcc73=['jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCampaign','Campaign','findAll','options','where','limit','include','attributes','map','model','stringify','util','moment','ioredis','../../config/utils','../../config/environment'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcc73[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var moment=require(_0x3cc7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cc7('0x4'));var jayson=require(_0x3cc7('0x5'));var client=jayson[_0x3cc7('0x6')][_0x3cc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127590,_0x5604df,_0x416c48){return new BPromise(function(_0x37c184,_0x3f2dd7){return client[_0x3cc7('0x8')](_0x127590,_0x416c48)['then'](function(_0x2ff7ba){logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));logger[_0x3cc7('0xc')](_0x3cc7('0xd'),_0x5604df,_0x3cc7('0xb'),JSON['stringify'](_0x2ff7ba));if(_0x2ff7ba['error']){if(_0x2ff7ba[_0x3cc7('0xe')]['code']===0x1f4){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x3f2dd7(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x37c184(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}else{logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));_0x37c184(_0x2ff7ba[_0x3cc7('0x10')][_0x3cc7('0xf')]);}})[_0x3cc7('0x11')](function(_0x386a31){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x386a31);_0x3f2dd7(_0x386a31);});});}exports[_0x3cc7('0x12')]=function(_0x2a4ddf){var _0xff4317=this;return new Promise(function(_0x118aa0,_0x2f196a){return db[_0x3cc7('0x13')][_0x3cc7('0x14')]({'raw':_0x2a4ddf[_0x3cc7('0x15')]?_0x2a4ddf['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a4ddf[_0x3cc7('0x15')]?_0x2a4ddf['options'][_0x3cc7('0x16')]||null:null,'attributes':_0x2a4ddf[_0x3cc7('0x15')]?_0x2a4ddf[_0x3cc7('0x15')]['attributes']||null:null,'limit':_0x2a4ddf['options']?_0x2a4ddf[_0x3cc7('0x15')][_0x3cc7('0x17')]||null:null,'include':_0x2a4ddf['options']?_0x2a4ddf[_0x3cc7('0x15')][_0x3cc7('0x18')]?_['map'](_0x2a4ddf[_0x3cc7('0x15')]['include'],function(_0x338cd3){return{'model':db[_0x338cd3['model']],'as':_0x338cd3['as'],'attributes':_0x338cd3[_0x3cc7('0x19')],'include':_0x338cd3[_0x3cc7('0x18')]?_[_0x3cc7('0x1a')](_0x338cd3[_0x3cc7('0x18')],function(_0x29d2c8){return{'model':db[_0x29d2c8[_0x3cc7('0x1b')]],'as':_0x29d2c8['as'],'attributes':_0x29d2c8['attributes'],'include':_0x29d2c8[_0x3cc7('0x18')]?_[_0x3cc7('0x1a')](_0x29d2c8[_0x3cc7('0x18')],function(_0x5f0a09){return{'model':db[_0x5f0a09[_0x3cc7('0x1b')]],'as':_0x5f0a09['as'],'attributes':_0x5f0a09['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bd571){logger[_0x3cc7('0x9')](_0x3cc7('0x12'),_0x2a4ddf);logger['debug'](_0x3cc7('0x12'),_0x2a4ddf,JSON[_0x3cc7('0x1c')](_0x4bd571));_0x118aa0(_0x4bd571);})[_0x3cc7('0x11')](function(_0x17aa73){logger[_0x3cc7('0xe')](_0x3cc7('0x12'),_0x17aa73[_0x3cc7('0xf')],_0x2a4ddf);_0x2f196a(_0xff4317[_0x3cc7('0xe')](0x1f4,_0x17aa73[_0x3cc7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4ecec51..ce5ae19 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 _0x73ef=['isAuthenticated','index','get','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/lists','/:id/blacklists','post','create','/:id/clone','addBlackLists','put','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0xee4f0d,_0x2d7af7){var _0x39d9d5=function(_0x4e9bd5){while(--_0x4e9bd5){_0xee4f0d['push'](_0xee4f0d['shift']());}};_0x39d9d5(++_0x2d7af7);}(_0x73ef,0x1b7));var _0xf73e=function(_0x1332c9,_0x3fab67){_0x1332c9=_0x1332c9-0x0;var _0xf3a17d=_0x73ef[_0x1332c9];return _0xf3a17d;};'use strict';var multer=require(_0xf73e('0x0'));var util=require(_0xf73e('0x1'));var path=require(_0xf73e('0x2'));var timeout=require(_0xf73e('0x3'));var express=require('express');var router=express[_0xf73e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf73e('0x5'));var interaction=require(_0xf73e('0x6'));var config=require(_0xf73e('0x7'));var controller=require(_0xf73e('0x8'));router['get']('/',auth[_0xf73e('0x9')](),controller[_0xf73e('0xa')]);router[_0xf73e('0xb')](_0xf73e('0xc'),auth['isAuthenticated'](),controller[_0xf73e('0xd')]);router[_0xf73e('0xb')]('/:id/hoppers',auth[_0xf73e('0x9')](),controller[_0xf73e('0xe')]);router[_0xf73e('0xb')](_0xf73e('0xf'),auth[_0xf73e('0x9')](),controller[_0xf73e('0x10')]);router[_0xf73e('0xb')](_0xf73e('0x11'),auth[_0xf73e('0x9')](),controller['getHopperFinals']);router[_0xf73e('0xb')]('/:id/hopper_black',auth[_0xf73e('0x9')](),controller['getHopperBlacks']);router[_0xf73e('0xb')](_0xf73e('0x12'),auth[_0xf73e('0x9')](),controller['getLists']);router[_0xf73e('0xb')](_0xf73e('0x13'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xf73e('0x14')]('/',auth[_0xf73e('0x9')](),controller[_0xf73e('0x15')]);router[_0xf73e('0x14')](_0xf73e('0x16'),auth[_0xf73e('0x9')](),controller['clone']);router['post'](_0xf73e('0x12'),auth[_0xf73e('0x9')](),controller['addLists']);router[_0xf73e('0x14')](_0xf73e('0x13'),auth[_0xf73e('0x9')](),controller[_0xf73e('0x17')]);router[_0xf73e('0x18')](_0xf73e('0xc'),auth[_0xf73e('0x9')](),controller['update']);router['delete']('/:id',auth[_0xf73e('0x9')](),controller['destroy']);router[_0xf73e('0x19')](_0xf73e('0x12'),auth['isAuthenticated'](),controller[_0xf73e('0x1a')]);router[_0xf73e('0x19')](_0xf73e('0x13'),auth[_0xf73e('0x9')](),controller[_0xf73e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x7e68=['./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4946fd,_0x234158){var _0x3a3637=function(_0x5180d6){while(--_0x5180d6){_0x4946fd['push'](_0x4946fd['shift']());}};_0x3a3637(++_0x234158);}(_0x7e68,0xd8));var _0x87e6=function(_0x4b3649,_0x1c7125){_0x4b3649=_0x4b3649-0x0;var _0x3deada=_0x7e68[_0x4b3649];return _0x3deada;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87e6('0x0'));var timeout=require(_0x87e6('0x1'));var express=require(_0x87e6('0x2'));var router=express[_0x87e6('0x3')]();var fs_extra=require(_0x87e6('0x4'));var auth=require(_0x87e6('0x5'));var interaction=require(_0x87e6('0x6'));var config=require(_0x87e6('0x7'));var controller=require(_0x87e6('0x8'));router[_0x87e6('0x9')]('/',auth['isAuthenticated'](),controller[_0x87e6('0xa')]);router['get'](_0x87e6('0xb'),auth[_0x87e6('0xc')](),controller['show']);router[_0x87e6('0x9')](_0x87e6('0xd'),auth[_0x87e6('0xc')](),controller[_0x87e6('0xe')]);router['get'](_0x87e6('0xf'),auth[_0x87e6('0xc')](),controller['getHopperHistories']);router['get'](_0x87e6('0x10'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x11')]);router[_0x87e6('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x87e6('0x12')]);router[_0x87e6('0x9')](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller['getLists']);router[_0x87e6('0x9')](_0x87e6('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x87e6('0x15')]('/',auth[_0x87e6('0xc')](),controller[_0x87e6('0x16')]);router[_0x87e6('0x15')](_0x87e6('0x17'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x18')]);router['post'](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x19')]);router['post'](_0x87e6('0x14'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x1a')]);router[_0x87e6('0x1b')](_0x87e6('0xb'),auth['isAuthenticated'](),controller[_0x87e6('0x1c')]);router[_0x87e6('0x1d')](_0x87e6('0xb'),auth[_0x87e6('0xc')](),controller['destroy']);router[_0x87e6('0x1d')](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x1e')]);router[_0x87e6('0x1d')](_0x87e6('0x14'),auth[_0x87e6('0xc')](),controller['removeBlackLists']);module[_0x87e6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8f9f3b9..ac3491c 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 _0x310b=['VIRTUAL','getDataValue','TEXT','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x310b,0x152));var _0xb310=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x310b[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xb310('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb310('0x1')]},'name':{'type':Sequelize[_0xb310('0x2')],'get':function(){return this[_0xb310('0x3')]('key');}}}; \ No newline at end of file +var _0x5334=['STRING','TEXT','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x4e185e,_0x49e5f3){var _0x1ff433=function(_0x858807){while(--_0x858807){_0x4e185e['push'](_0x4e185e['shift']());}};_0x1ff433(++_0x49e5f3);}(_0x5334,0x64));var _0x4533=function(_0x2eb1f4,_0xcedd8c){_0x2eb1f4=_0x2eb1f4-0x0;var _0x353022=_0x5334[_0x2eb1f4];return _0x353022;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'key':{'type':Sequelize[_0x4533('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4533('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4533('0x4')],'get':function(){return this[_0x4533('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3562651..14cfdc7 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 _0x06d1=['json','apply','reject','save','update','destroy','then','get','CannedAnswers','error','stack','name','send','CannedAnswer','rawAttributes','type','key','model','map','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x2cf113,_0x197ce1){var _0x3cae95=function(_0x8fc6a2){while(--_0x8fc6a2){_0x2cf113['push'](_0x2cf113['shift']());}};_0x3cae95(++_0x197ce1);}(_0x06d1,0xe5));var _0x106d=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x06d1[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0x106d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x106d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x106d('0x2'));var moment=require(_0x106d('0x3'));var BPromise=require(_0x106d('0x4'));var Mustache=require(_0x106d('0x5'));var util=require(_0x106d('0x6'));var path=require(_0x106d('0x7'));var sox=require(_0x106d('0x8'));var csv=require(_0x106d('0x9'));var ejs=require(_0x106d('0xa'));var fs=require('fs');var fs_extra=require(_0x106d('0xb'));var _=require(_0x106d('0xc'));var squel=require(_0x106d('0xd'));var crypto=require(_0x106d('0xe'));var jsforce=require(_0x106d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x106d('0x9'));var querystring=require(_0x106d('0x10'));var Papa=require(_0x106d('0x11'));var Redis=require(_0x106d('0x12'));var authService=require(_0x106d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x106d('0x14'));var logger=require(_0x106d('0x15'))(_0x106d('0x16'));var utils=require(_0x106d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38773f,_0x452329){_0x452329=_0x452329||0xcc;return function(_0x1b71a5){if(_0x1b71a5){return _0x38773f[_0x106d('0x18')](_0x452329);}return _0x38773f[_0x106d('0x19')](_0x452329)[_0x106d('0x1a')]();};}function respondWithResult(_0x50a636,_0x48ffe7){_0x48ffe7=_0x48ffe7||0xc8;return function(_0x152985){if(_0x152985){return _0x50a636['status'](_0x48ffe7)['json'](_0x152985);}};}function respondWithFilteredResult(_0x440d90,_0x3a20cd){return function(_0x1c2475){if(_0x1c2475){var _0x19e629=typeof _0x3a20cd[_0x106d('0x1b')]===_0x106d('0x1c')&&typeof _0x3a20cd[_0x106d('0x1d')]===_0x106d('0x1c');var _0x3c7bc6=_0x1c2475[_0x106d('0x1e')];var _0x2a202e=_0x19e629?0x0:_0x3a20cd[_0x106d('0x1b')];var _0x34e168=_0x19e629?_0x1c2475[_0x106d('0x1e')]:_0x3a20cd[_0x106d('0x1b')]+_0x3a20cd[_0x106d('0x1d')];var _0x13b9b1;if(_0x34e168>=_0x3c7bc6){_0x34e168=_0x3c7bc6;_0x13b9b1=0xc8;}else{_0x13b9b1=0xce;}_0x440d90['status'](_0x13b9b1);return _0x440d90['set'](_0x106d('0x1f'),_0x2a202e+'-'+_0x34e168+'/'+_0x3c7bc6)[_0x106d('0x20')](_0x1c2475);}return null;};}function patchUpdates(_0x49d9ac){return function(_0x8fcbba){try{jsonpatch[_0x106d('0x21')](_0x8fcbba,_0x49d9ac,!![]);}catch(_0x569ad7){return BPromise[_0x106d('0x22')](_0x569ad7);}return _0x8fcbba[_0x106d('0x23')]();};}function saveUpdates(_0x2c0752,_0x160af9){return function(_0x4dc00b){if(_0x4dc00b){return _0x4dc00b[_0x106d('0x24')](_0x2c0752)['then'](function(_0x13555b){return _0x13555b;});}return null;};}function removeEntity(_0x368d40,_0x2bbfef){return function(_0x2de5ce){if(_0x2de5ce){return _0x2de5ce[_0x106d('0x25')]()[_0x106d('0x26')](function(){var _0x38d16e=_0x2de5ce[_0x106d('0x27')]({'plain':!![]});var _0x555c1b=_0x106d('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x555c1b,'resourceId':_0x38d16e['id']}})[_0x106d('0x26')](function(){return _0x2de5ce;});})['then'](function(){_0x368d40['status'](0xcc)[_0x106d('0x1a')]();});}};}function handleEntityNotFound(_0x19c456,_0x430d4b){return function(_0x596372){if(!_0x596372){_0x19c456[_0x106d('0x18')](0x194);}return _0x596372;};}function handleError(_0x3e775f,_0x17d720){_0x17d720=_0x17d720||0x1f4;return function(_0x25b342){logger[_0x106d('0x29')](_0x25b342[_0x106d('0x2a')]);if(_0x25b342[_0x106d('0x2b')]){delete _0x25b342[_0x106d('0x2b')];}_0x3e775f[_0x106d('0x19')](_0x17d720)[_0x106d('0x2c')](_0x25b342);};}exports['index']=function(_0x2221c7,_0x58ed5b){var _0x27e0e2={},_0x3880cb={},_0x4f3275={'count':0x0,'rows':[]};var _0x18eff1=_['map'](db[_0x106d('0x2d')][_0x106d('0x2e')],function(_0x5e6285){return{'name':_0x5e6285['fieldName'],'type':_0x5e6285[_0x106d('0x2f')][_0x106d('0x30')]};});_0x3880cb[_0x106d('0x31')]=_[_0x106d('0x32')](_0x18eff1,_0x106d('0x2b'));_0x3880cb['query']=_[_0x106d('0x33')](_0x2221c7['query']);_0x3880cb[_0x106d('0x34')]=_['intersection'](_0x3880cb[_0x106d('0x31')],_0x3880cb[_0x106d('0x35')]);_0x27e0e2['attributes']=_[_0x106d('0x36')](_0x3880cb[_0x106d('0x31')],qs[_0x106d('0x37')](_0x2221c7[_0x106d('0x35')][_0x106d('0x37')]));_0x27e0e2[_0x106d('0x38')]=_0x27e0e2[_0x106d('0x38')][_0x106d('0x39')]?_0x27e0e2[_0x106d('0x38')]:_0x3880cb[_0x106d('0x31')];if(!_0x2221c7[_0x106d('0x35')][_0x106d('0x3a')](_0x106d('0x3b'))){_0x27e0e2[_0x106d('0x1d')]=qs[_0x106d('0x1d')](_0x2221c7[_0x106d('0x35')][_0x106d('0x1d')]);_0x27e0e2[_0x106d('0x1b')]=qs['offset'](_0x2221c7['query'][_0x106d('0x1b')]);}_0x27e0e2[_0x106d('0x3c')]=qs[_0x106d('0x3d')](_0x2221c7[_0x106d('0x35')][_0x106d('0x3d')]);_0x27e0e2[_0x106d('0x3e')]=qs['filters'](_[_0x106d('0x3f')](_0x2221c7[_0x106d('0x35')],_0x3880cb[_0x106d('0x34')]),_0x18eff1);if(_0x2221c7[_0x106d('0x35')][_0x106d('0x40')]){_0x27e0e2[_0x106d('0x3e')]=_[_0x106d('0x41')](_0x27e0e2[_0x106d('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2221c7[_0x106d('0x35')][_0x106d('0x40')]+'%'}},{'value':{'$like':'%'+_0x2221c7[_0x106d('0x35')][_0x106d('0x40')]+'%'}}]});}_0x27e0e2=_[_0x106d('0x41')]({},_0x27e0e2,_0x2221c7[_0x106d('0x42')]);var _0x5d9ffc={'where':_0x27e0e2[_0x106d('0x3e')]};return db[_0x106d('0x2d')][_0x106d('0x1e')](_0x5d9ffc)[_0x106d('0x26')](function(_0x571a81){_0x4f3275[_0x106d('0x1e')]=_0x571a81;if(_0x2221c7[_0x106d('0x35')][_0x106d('0x43')]){_0x27e0e2[_0x106d('0x44')]=[{'all':!![]}];}return db[_0x106d('0x2d')][_0x106d('0x45')](_0x27e0e2);})[_0x106d('0x26')](function(_0x4c6317){_0x4f3275[_0x106d('0x46')]=_0x4c6317;return _0x4f3275;})[_0x106d('0x26')](respondWithFilteredResult(_0x58ed5b,_0x27e0e2))[_0x106d('0x47')](handleError(_0x58ed5b,null));};exports['show']=function(_0x3b758d,_0x5e041a){var _0xb93f52={'raw':!![],'where':{'id':_0x3b758d[_0x106d('0x48')]['id']}},_0x6643d0={};_0x6643d0[_0x106d('0x31')]=_[_0x106d('0x33')](db[_0x106d('0x2d')][_0x106d('0x2e')]);_0x6643d0[_0x106d('0x35')]=_[_0x106d('0x33')](_0x3b758d[_0x106d('0x35')]);_0x6643d0[_0x106d('0x34')]=_[_0x106d('0x36')](_0x6643d0[_0x106d('0x31')],_0x6643d0[_0x106d('0x35')]);_0xb93f52['attributes']=_[_0x106d('0x36')](_0x6643d0[_0x106d('0x31')],qs[_0x106d('0x37')](_0x3b758d[_0x106d('0x35')][_0x106d('0x37')]));_0xb93f52[_0x106d('0x38')]=_0xb93f52[_0x106d('0x38')]['length']?_0xb93f52[_0x106d('0x38')]:_0x6643d0[_0x106d('0x31')];if(_0x3b758d['query']['includeAll']){_0xb93f52[_0x106d('0x44')]=[{'all':!![]}];}_0xb93f52=_[_0x106d('0x41')]({},_0xb93f52,_0x3b758d[_0x106d('0x42')]);return db[_0x106d('0x2d')][_0x106d('0x49')](_0xb93f52)[_0x106d('0x26')](handleEntityNotFound(_0x5e041a,null))['then'](respondWithResult(_0x5e041a,null))[_0x106d('0x47')](handleError(_0x5e041a,null));};exports[_0x106d('0x24')]=function(_0x5b5940,_0x2bcf53){if(_0x5b5940[_0x106d('0x4a')]['id']){delete _0x5b5940[_0x106d('0x4a')]['id'];}return db[_0x106d('0x2d')][_0x106d('0x49')]({'where':{'id':_0x5b5940['params']['id']}})[_0x106d('0x26')](handleEntityNotFound(_0x2bcf53,null))[_0x106d('0x26')](saveUpdates(_0x5b5940[_0x106d('0x4a')],null))[_0x106d('0x26')](respondWithResult(_0x2bcf53,null))[_0x106d('0x47')](handleError(_0x2bcf53,null));};exports['destroy']=function(_0x30310a,_0x42fe6c){return db[_0x106d('0x2d')][_0x106d('0x49')]({'where':{'id':_0x30310a[_0x106d('0x48')]['id']}})[_0x106d('0x26')](handleEntityNotFound(_0x42fe6c,null))[_0x106d('0x26')](removeEntity(_0x42fe6c,null))[_0x106d('0x47')](handleError(_0x42fe6c,null));};exports['create']=function(_0x1e8e2a,_0xebd988){var _0xc03c97={'key':_0x1e8e2a[_0x106d('0x4a')]['key']};if(_0x1e8e2a[_0x106d('0x4a')][_0x106d('0x4b')]){_0xc03c97['MailAccountId']=_0x1e8e2a[_0x106d('0x4a')][_0x106d('0x4b')];}else if(_0x1e8e2a['body']['SmsAccountId']){_0xc03c97[_0x106d('0x4c')]=_0x1e8e2a['body']['SmsAccountId'];}else if(_0x1e8e2a[_0x106d('0x4a')][_0x106d('0x4d')]){_0xc03c97[_0x106d('0x4d')]=_0x1e8e2a[_0x106d('0x4a')][_0x106d('0x4d')];}else if(_0x1e8e2a[_0x106d('0x4a')][_0x106d('0x4e')]){_0xc03c97[_0x106d('0x4e')]=_0x1e8e2a['body'][_0x106d('0x4e')];}return db[_0x106d('0x2d')][_0x106d('0x49')]({'where':_0xc03c97})['then'](function(_0x3b0fc3){if(_0x3b0fc3){throw new db[(_0x106d('0x4f'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x106d('0x2d')][_0x106d('0x50')](_0x1e8e2a[_0x106d('0x4a')]);})['then'](function(_0x38c80a){var _0x7bfbd4=_0x1e8e2a['user']['get']({'plain':!![]});if(!_0x7bfbd4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7bfbd4[_0x106d('0x51')]===_0x106d('0x52')){var _0x1a32a1=_0x38c80a['get']({'plain':!![]});return db[_0x106d('0x53')][_0x106d('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x7bfbd4[_0x106d('0x54')]},'raw':!![]})['then'](function(_0x5dc7fb){if(_0x5dc7fb&&_0x5dc7fb[_0x106d('0x55')]===0x0){return db['UserProfileResource'][_0x106d('0x50')]({'name':_0x1a32a1[_0x106d('0x2b')],'resourceId':_0x1a32a1['id'],'type':_0x5dc7fb['name'],'sectionId':_0x5dc7fb['id']},{})[_0x106d('0x26')](function(){return _0x38c80a;});}else{return _0x38c80a;}})['catch'](function(_0x11bca8){logger[_0x106d('0x29')](_0x106d('0x56'),_0x11bca8);throw _0x11bca8;});}return _0x38c80a;})[_0x106d('0x26')](respondWithResult(_0xebd988,0xc9))['catch'](handleError(_0xebd988,null));}; \ No newline at end of file +var _0x3a11=['CannedAnswers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','CannedAnswer','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','keys','rawAttributes','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x8883a7,_0x26d1ec){var _0x439aed=function(_0x121444){while(--_0x121444){_0x8883a7['push'](_0x8883a7['shift']());}};_0x439aed(++_0x26d1ec);}(_0x3a11,0xa9));var _0x13a1=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x3a11[_0x492af5];return _0x59f529;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x13a1('0x0'));var jsonpatch=require(_0x13a1('0x1'));var rp=require(_0x13a1('0x2'));var moment=require(_0x13a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x13a1('0x4'));var util=require(_0x13a1('0x5'));var path=require('path');var sox=require(_0x13a1('0x6'));var csv=require(_0x13a1('0x7'));var ejs=require(_0x13a1('0x8'));var fs=require('fs');var fs_extra=require(_0x13a1('0x9'));var _=require('lodash');var squel=require(_0x13a1('0xa'));var crypto=require(_0x13a1('0xb'));var jsforce=require(_0x13a1('0xc'));var deskjs=require(_0x13a1('0xd'));var toCsv=require(_0x13a1('0x7'));var querystring=require('querystring');var Papa=require(_0x13a1('0xe'));var Redis=require(_0x13a1('0xf'));var authService=require(_0x13a1('0x10'));var qs=require(_0x13a1('0x11'));var as=require(_0x13a1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13a1('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x13a1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c0fb,_0x2ae50a){_0x2ae50a=_0x2ae50a||0xcc;return function(_0x5d470f){if(_0x5d470f){return _0x45c0fb[_0x13a1('0x15')](_0x2ae50a);}return _0x45c0fb[_0x13a1('0x16')](_0x2ae50a)['end']();};}function respondWithResult(_0x2ecf51,_0x45b9d7){_0x45b9d7=_0x45b9d7||0xc8;return function(_0x306b1d){if(_0x306b1d){return _0x2ecf51[_0x13a1('0x16')](_0x45b9d7)['json'](_0x306b1d);}};}function respondWithFilteredResult(_0x2fdd3a,_0x545757){return function(_0x3179f4){if(_0x3179f4){var _0x17fb77=typeof _0x545757['offset']==='undefined'&&typeof _0x545757['limit']===_0x13a1('0x17');var _0x62f52f=_0x3179f4[_0x13a1('0x18')];var _0xde6840=_0x17fb77?0x0:_0x545757[_0x13a1('0x19')];var _0x7132c8=_0x17fb77?_0x3179f4['count']:_0x545757[_0x13a1('0x19')]+_0x545757[_0x13a1('0x1a')];var _0x3c93f4;if(_0x7132c8>=_0x62f52f){_0x7132c8=_0x62f52f;_0x3c93f4=0xc8;}else{_0x3c93f4=0xce;}_0x2fdd3a[_0x13a1('0x16')](_0x3c93f4);return _0x2fdd3a['set'](_0x13a1('0x1b'),_0xde6840+'-'+_0x7132c8+'/'+_0x62f52f)['json'](_0x3179f4);}return null;};}function patchUpdates(_0x3b7bcb){return function(_0x2a1897){try{jsonpatch['apply'](_0x2a1897,_0x3b7bcb,!![]);}catch(_0x36100a){return BPromise[_0x13a1('0x1c')](_0x36100a);}return _0x2a1897[_0x13a1('0x1d')]();};}function saveUpdates(_0x488afd,_0x58a9d4){return function(_0x3c67da){if(_0x3c67da){return _0x3c67da[_0x13a1('0x1e')](_0x488afd)[_0x13a1('0x1f')](function(_0x44e03c){return _0x44e03c;});}return null;};}function removeEntity(_0x2f4b6a,_0x1eacd5){return function(_0x43b3f0){if(_0x43b3f0){return _0x43b3f0[_0x13a1('0x20')]()[_0x13a1('0x1f')](function(){var _0x48e104=_0x43b3f0[_0x13a1('0x21')]({'plain':!![]});var _0x56d74d='CannedAnswers';return db[_0x13a1('0x22')][_0x13a1('0x20')]({'where':{'type':_0x56d74d,'resourceId':_0x48e104['id']}})[_0x13a1('0x1f')](function(){return _0x43b3f0;});})[_0x13a1('0x1f')](function(){_0x2f4b6a[_0x13a1('0x16')](0xcc)[_0x13a1('0x23')]();});}};}function handleEntityNotFound(_0xc0e89b,_0x180775){return function(_0x48748a){if(!_0x48748a){_0xc0e89b[_0x13a1('0x15')](0x194);}return _0x48748a;};}function handleError(_0x1e1a0b,_0x2e0f58){_0x2e0f58=_0x2e0f58||0x1f4;return function(_0x1bd3e4){logger[_0x13a1('0x24')](_0x1bd3e4[_0x13a1('0x25')]);if(_0x1bd3e4[_0x13a1('0x26')]){delete _0x1bd3e4[_0x13a1('0x26')];}_0x1e1a0b[_0x13a1('0x16')](_0x2e0f58)['send'](_0x1bd3e4);};}exports[_0x13a1('0x27')]=function(_0x41799b,_0x2c42b1){var _0x196db4={},_0x30ce82={},_0xfc0399={'count':0x0,'rows':[]};var _0x5263ae=_[_0x13a1('0x28')](db[_0x13a1('0x29')]['rawAttributes'],function(_0x23d740){return{'name':_0x23d740[_0x13a1('0x2a')],'type':_0x23d740['type'][_0x13a1('0x2b')]};});_0x30ce82[_0x13a1('0x2c')]=_[_0x13a1('0x28')](_0x5263ae,_0x13a1('0x26'));_0x30ce82[_0x13a1('0x2d')]=_['keys'](_0x41799b[_0x13a1('0x2d')]);_0x30ce82[_0x13a1('0x2e')]=_[_0x13a1('0x2f')](_0x30ce82[_0x13a1('0x2c')],_0x30ce82[_0x13a1('0x2d')]);_0x196db4[_0x13a1('0x30')]=_[_0x13a1('0x2f')](_0x30ce82[_0x13a1('0x2c')],qs[_0x13a1('0x31')](_0x41799b['query'][_0x13a1('0x31')]));_0x196db4[_0x13a1('0x30')]=_0x196db4['attributes'][_0x13a1('0x32')]?_0x196db4[_0x13a1('0x30')]:_0x30ce82[_0x13a1('0x2c')];if(!_0x41799b[_0x13a1('0x2d')][_0x13a1('0x33')]('nolimit')){_0x196db4[_0x13a1('0x1a')]=qs[_0x13a1('0x1a')](_0x41799b[_0x13a1('0x2d')][_0x13a1('0x1a')]);_0x196db4['offset']=qs['offset'](_0x41799b[_0x13a1('0x2d')]['offset']);}_0x196db4[_0x13a1('0x34')]=qs[_0x13a1('0x35')](_0x41799b['query'][_0x13a1('0x35')]);_0x196db4[_0x13a1('0x36')]=qs[_0x13a1('0x2e')](_[_0x13a1('0x37')](_0x41799b[_0x13a1('0x2d')],_0x30ce82[_0x13a1('0x2e')]),_0x5263ae);if(_0x41799b[_0x13a1('0x2d')][_0x13a1('0x38')]){_0x196db4[_0x13a1('0x36')]=_[_0x13a1('0x39')](_0x196db4[_0x13a1('0x36')],{'$or':[{'key':{'$like':'%'+_0x41799b['query'][_0x13a1('0x38')]+'%'}},{'value':{'$like':'%'+_0x41799b[_0x13a1('0x2d')][_0x13a1('0x38')]+'%'}}]});}_0x196db4=_[_0x13a1('0x39')]({},_0x196db4,_0x41799b['options']);var _0x3351fc={'where':_0x196db4[_0x13a1('0x36')]};return db[_0x13a1('0x29')][_0x13a1('0x18')](_0x3351fc)[_0x13a1('0x1f')](function(_0xaa0ede){_0xfc0399['count']=_0xaa0ede;if(_0x41799b[_0x13a1('0x2d')]['includeAll']){_0x196db4[_0x13a1('0x3a')]=[{'all':!![]}];}return db[_0x13a1('0x29')][_0x13a1('0x3b')](_0x196db4);})[_0x13a1('0x1f')](function(_0x508837){_0xfc0399['rows']=_0x508837;return _0xfc0399;})[_0x13a1('0x1f')](respondWithFilteredResult(_0x2c42b1,_0x196db4))[_0x13a1('0x3c')](handleError(_0x2c42b1,null));};exports[_0x13a1('0x3d')]=function(_0x2f40df,_0x3cfd4e){var _0x40747d={'raw':!![],'where':{'id':_0x2f40df[_0x13a1('0x3e')]['id']}},_0xc857b9={};_0xc857b9[_0x13a1('0x2c')]=_[_0x13a1('0x3f')](db[_0x13a1('0x29')][_0x13a1('0x40')]);_0xc857b9[_0x13a1('0x2d')]=_['keys'](_0x2f40df[_0x13a1('0x2d')]);_0xc857b9[_0x13a1('0x2e')]=_[_0x13a1('0x2f')](_0xc857b9[_0x13a1('0x2c')],_0xc857b9[_0x13a1('0x2d')]);_0x40747d[_0x13a1('0x30')]=_['intersection'](_0xc857b9[_0x13a1('0x2c')],qs[_0x13a1('0x31')](_0x2f40df['query'][_0x13a1('0x31')]));_0x40747d['attributes']=_0x40747d['attributes'][_0x13a1('0x32')]?_0x40747d['attributes']:_0xc857b9['model'];if(_0x2f40df['query']['includeAll']){_0x40747d[_0x13a1('0x3a')]=[{'all':!![]}];}_0x40747d=_[_0x13a1('0x39')]({},_0x40747d,_0x2f40df[_0x13a1('0x41')]);return db[_0x13a1('0x29')][_0x13a1('0x42')](_0x40747d)[_0x13a1('0x1f')](handleEntityNotFound(_0x3cfd4e,null))[_0x13a1('0x1f')](respondWithResult(_0x3cfd4e,null))['catch'](handleError(_0x3cfd4e,null));};exports['update']=function(_0x40db05,_0x40600c){if(_0x40db05[_0x13a1('0x43')]['id']){delete _0x40db05['body']['id'];}return db['CannedAnswer'][_0x13a1('0x42')]({'where':{'id':_0x40db05[_0x13a1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x40600c,null))[_0x13a1('0x1f')](saveUpdates(_0x40db05[_0x13a1('0x43')],null))[_0x13a1('0x1f')](respondWithResult(_0x40600c,null))['catch'](handleError(_0x40600c,null));};exports[_0x13a1('0x20')]=function(_0x503514,_0x495ca3){return db[_0x13a1('0x29')][_0x13a1('0x42')]({'where':{'id':_0x503514[_0x13a1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x495ca3,null))[_0x13a1('0x1f')](removeEntity(_0x495ca3,null))[_0x13a1('0x3c')](handleError(_0x495ca3,null));};exports[_0x13a1('0x44')]=function(_0x48709b,_0x37733c){var _0x21b44c={'key':_0x48709b[_0x13a1('0x43')][_0x13a1('0x2b')]};if(_0x48709b[_0x13a1('0x43')][_0x13a1('0x45')]){_0x21b44c[_0x13a1('0x45')]=_0x48709b[_0x13a1('0x43')][_0x13a1('0x45')];}else if(_0x48709b[_0x13a1('0x43')][_0x13a1('0x46')]){_0x21b44c[_0x13a1('0x46')]=_0x48709b['body']['SmsAccountId'];}else if(_0x48709b[_0x13a1('0x43')][_0x13a1('0x47')]){_0x21b44c[_0x13a1('0x47')]=_0x48709b[_0x13a1('0x43')][_0x13a1('0x47')];}else if(_0x48709b[_0x13a1('0x43')][_0x13a1('0x48')]){_0x21b44c['ChatWebsiteId']=_0x48709b[_0x13a1('0x43')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x21b44c})[_0x13a1('0x1f')](function(_0x40253e){if(_0x40253e){throw new db[(_0x13a1('0x49'))][(_0x13a1('0x4a'))](_0x13a1('0x4b'));}return db[_0x13a1('0x29')][_0x13a1('0x44')](_0x48709b[_0x13a1('0x43')]);})[_0x13a1('0x1f')](function(_0x285e2a){var _0x186ae0=_0x48709b['user'][_0x13a1('0x21')]({'plain':!![]});if(!_0x186ae0)throw new Error(_0x13a1('0x4c'));if(_0x186ae0[_0x13a1('0x4d')]===_0x13a1('0x4e')){var _0x5e1b8e=_0x285e2a[_0x13a1('0x21')]({'plain':!![]});return db[_0x13a1('0x4f')][_0x13a1('0x42')]({'where':{'name':_0x13a1('0x50'),'userProfileId':_0x186ae0['userProfileId']},'raw':!![]})[_0x13a1('0x1f')](function(_0x9a9a1f){if(_0x9a9a1f&&_0x9a9a1f[_0x13a1('0x51')]===0x0){return db['UserProfileResource'][_0x13a1('0x44')]({'name':_0x5e1b8e[_0x13a1('0x26')],'resourceId':_0x5e1b8e['id'],'type':_0x9a9a1f[_0x13a1('0x26')],'sectionId':_0x9a9a1f['id']},{})['then'](function(){return _0x285e2a;});}else{return _0x285e2a;}})[_0x13a1('0x3c')](function(_0x453930){logger['error'](_0x13a1('0x52'),_0x453930);throw _0x453930;});}return _0x285e2a;})[_0x13a1('0x1f')](respondWithResult(_0x37733c,0xc9))[_0x13a1('0x3c')](handleError(_0x37733c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b703ff7..07a85dc 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 _0x160b=['CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0xc18746,_0x7387a9){var _0x56c6cd=function(_0x307806){while(--_0x307806){_0xc18746['push'](_0xc18746['shift']());}};_0x56c6cd(++_0x7387a9);}(_0x160b,0xff));var _0xb160=function(_0x4f5d7e,_0x118431){_0x4f5d7e=_0x4f5d7e-0x0;var _0xaf263f=_0x160b[_0x4f5d7e];return _0xaf263f;};'use strict';var _=require(_0xb160('0x0'));var util=require(_0xb160('0x1'));var logger=require(_0xb160('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb160('0x3'));var rp=require(_0xb160('0x4'));var fs=require('fs');var path=require(_0xb160('0x5'));var rimraf=require(_0xb160('0x6'));var config=require(_0xb160('0x7'));var attributes=require(_0xb160('0x8'));module[_0xb160('0x9')]=function(_0x42a9c4,_0x29248e){return _0x42a9c4[_0xb160('0xa')](_0xb160('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb160('0xc'),'collate':_0xb160('0xd')});}; \ No newline at end of file +var _0x2ed3=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x8ce514,_0x468ecc){var _0x20afe9=function(_0x1bf3a8){while(--_0x1bf3a8){_0x8ce514['push'](_0x8ce514['shift']());}};_0x20afe9(++_0x468ecc);}(_0x2ed3,0xfa));var _0x32ed=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x2ed3[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var logger=require(_0x32ed('0x2'))('api');var moment=require(_0x32ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x32ed('0x4'));var fs=require('fs');var path=require(_0x32ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32ed('0x6'));module[_0x32ed('0x7')]=function(_0x2d1a93,_0x1a4152){return _0x2d1a93[_0x32ed('0x8')](_0x32ed('0x9'),attributes,{'tableName':_0x32ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32ed('0xb'),'collate':_0x32ed('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e2347ed..3262203 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52caa3,_0x181dc4){var _0x53bdc9=function(_0x59a120){while(--_0x59a120){_0x52caa3['push'](_0x52caa3['shift']());}};_0x53bdc9(++_0x181dc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1aa2e4,_0xbc7bde){var _0x329820=function(_0x945e1){while(--_0x945e1){_0x1aa2e4['push'](_0x1aa2e4['shift']());}};_0x329820(++_0xbc7bde);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 7c5811a..7fc0a13 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 _0x819f=['post','create','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get','isAuthenticated','show'];(function(_0x2c2c3c,_0x4ed336){var _0x5c320e=function(_0x5c6e89){while(--_0x5c6e89){_0x2c2c3c['push'](_0x2c2c3c['shift']());}};_0x5c320e(++_0x4ed336);}(_0x819f,0x8e));var _0xf819=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x819f[_0x49beea];return _0x27693a;};'use strict';var multer=require(_0xf819('0x0'));var util=require(_0xf819('0x1'));var path=require('path');var timeout=require(_0xf819('0x2'));var express=require(_0xf819('0x3'));var router=express[_0xf819('0x4')]();var fs_extra=require(_0xf819('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf819('0x6'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf819('0x7')]);router[_0xf819('0x8')]('/:id',auth[_0xf819('0x9')](),controller[_0xf819('0xa')]);router[_0xf819('0xb')]('/',auth[_0xf819('0x9')](),controller[_0xf819('0xc')]);router[_0xf819('0xd')](_0xf819('0xe'),auth[_0xf819('0x9')](),controller[_0xf819('0xf')]);router['delete']('/:id',auth[_0xf819('0x9')](),controller['destroy']);module[_0xf819('0x10')]=router; \ No newline at end of file +var _0x3b09=['put','/:id','exports','util','path','express','fs-extra','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','show','post','create'];(function(_0x55b79c,_0x39d43a){var _0x4e8743=function(_0x25a620){while(--_0x25a620){_0x55b79c['push'](_0x55b79c['shift']());}};_0x4e8743(++_0x39d43a);}(_0x3b09,0x137));var _0x93b0=function(_0xb5fb77,_0x2ec122){_0xb5fb77=_0xb5fb77-0x0;var _0x3f4101=_0x3b09[_0xb5fb77];return _0x3f4101;};'use strict';var multer=require('multer');var util=require(_0x93b0('0x0'));var path=require(_0x93b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x93b0('0x2'));var router=express['Router']();var fs_extra=require(_0x93b0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x93b0('0x4'));var config=require('../../config/environment');var controller=require(_0x93b0('0x5'));router[_0x93b0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x93b0('0x7')](),controller[_0x93b0('0x8')]);router[_0x93b0('0x9')]('/',auth[_0x93b0('0x7')](),controller[_0x93b0('0xa')]);router[_0x93b0('0xb')](_0x93b0('0xc'),auth[_0x93b0('0x7')](),controller['update']);router['delete'](_0x93b0('0xc'),auth[_0x93b0('0x7')](),controller['destroy']);module[_0x93b0('0xd')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4818859..bccad78 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 _0x99e9=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x457b8c,_0x40321a){var _0x3bb94f=function(_0x16ea94){while(--_0x16ea94){_0x457b8c['push'](_0x457b8c['shift']());}};_0x3bb94f(++_0x40321a);}(_0x99e9,0xb4));var _0x999e=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x99e9[_0x300860];return _0x2094ad;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'calldate':{'type':Sequelize[_0x999e('0x1')],'allowNull':![],'defaultValue':_0x999e('0x2')},'clid':{'type':Sequelize[_0x999e('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x999e('0x3')]},'dcontext':{'type':Sequelize[_0x999e('0x3')]},'channel':{'type':Sequelize[_0x999e('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x999e('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x999e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x999e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x999e('0x3')]},'amaflags':{'type':Sequelize[_0x999e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x999e('0x3')]},'uniqueid':{'type':Sequelize[_0x999e('0x3')]},'linkedid':{'type':Sequelize[_0x999e('0x3')]},'sequence':{'type':Sequelize[_0x999e('0x3')]},'peeraccount':{'type':Sequelize[_0x999e('0x3')]},'type':{'type':Sequelize[_0x999e('0x3')]},'tag':{'type':Sequelize[_0x999e('0x3')]}}; \ No newline at end of file +var _0xd634=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0xe9e8f9,_0xa250b8){var _0x28768e=function(_0x59087a){while(--_0x59087a){_0xe9e8f9['push'](_0xe9e8f9['shift']());}};_0x28768e(++_0xa250b8);}(_0xd634,0x151));var _0x4d63=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0xd634[_0x43b06b];return _0x2c555b;};'use strict';var Sequelize=require(_0x4d63('0x0'));module[_0x4d63('0x1')]={'calldate':{'type':Sequelize[_0x4d63('0x2')],'allowNull':![],'defaultValue':_0x4d63('0x3')},'clid':{'type':Sequelize[_0x4d63('0x4')]},'src':{'type':Sequelize[_0x4d63('0x4')]},'dst':{'type':Sequelize[_0x4d63('0x4')]},'dcontext':{'type':Sequelize[_0x4d63('0x4')]},'channel':{'type':Sequelize[_0x4d63('0x4')]},'dstchannel':{'type':Sequelize[_0x4d63('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4d63('0x4')]},'duration':{'type':Sequelize[_0x4d63('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4d63('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4d63('0x4')]},'amaflags':{'type':Sequelize[_0x4d63('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4d63('0x4')]},'userfield':{'type':Sequelize[_0x4d63('0x4')]},'uniqueid':{'type':Sequelize[_0x4d63('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4d63('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4d63('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e36466f..2c21878 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 _0x79a8=['reject','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x79a8,0x1d0));var _0x879a=function(_0x337570,_0xdd86bc){_0x337570=_0x337570-0x0;var _0x27b1fb=_0x79a8[_0x337570];return _0x27b1fb;};'use strict';var emlformat=require(_0x879a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x879a('0x1'));var jsonpatch=require(_0x879a('0x2'));var rp=require(_0x879a('0x3'));var moment=require('moment');var BPromise=require(_0x879a('0x4'));var Mustache=require('mustache');var util=require(_0x879a('0x5'));var path=require(_0x879a('0x6'));var sox=require(_0x879a('0x7'));var csv=require(_0x879a('0x8'));var ejs=require(_0x879a('0x9'));var fs=require('fs');var fs_extra=require(_0x879a('0xa'));var _=require(_0x879a('0xb'));var squel=require(_0x879a('0xc'));var crypto=require('crypto');var jsforce=require(_0x879a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x879a('0x8'));var querystring=require(_0x879a('0xe'));var Papa=require('papaparse');var Redis=require(_0x879a('0xf'));var authService=require(_0x879a('0x10'));var qs=require(_0x879a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x879a('0x12'));var logger=require(_0x879a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x879a('0x14'));var licenseUtil=require(_0x879a('0x15'));var db=require(_0x879a('0x16'))['db'];function respondWithStatusCode(_0x320115,_0x54a9b6){_0x54a9b6=_0x54a9b6||0xcc;return function(_0x4738b4){if(_0x4738b4){return _0x320115[_0x879a('0x17')](_0x54a9b6);}return _0x320115[_0x879a('0x18')](_0x54a9b6)[_0x879a('0x19')]();};}function respondWithResult(_0x1a20c5,_0x1c2853){_0x1c2853=_0x1c2853||0xc8;return function(_0x461f1e){if(_0x461f1e){return _0x1a20c5[_0x879a('0x18')](_0x1c2853)[_0x879a('0x1a')](_0x461f1e);}};}function respondWithFilteredResult(_0x16b649,_0x5b4dbe){return function(_0x4a1e0e){if(_0x4a1e0e){var _0x3b8680=typeof _0x5b4dbe[_0x879a('0x1b')]==='undefined'&&typeof _0x5b4dbe[_0x879a('0x1c')]===_0x879a('0x1d');var _0x149105=_0x4a1e0e[_0x879a('0x1e')];var _0x32d9f5=_0x3b8680?0x0:_0x5b4dbe[_0x879a('0x1b')];var _0x4160bd=_0x3b8680?_0x4a1e0e[_0x879a('0x1e')]:_0x5b4dbe[_0x879a('0x1b')]+_0x5b4dbe[_0x879a('0x1c')];var _0x14241a;if(_0x4160bd>=_0x149105){_0x4160bd=_0x149105;_0x14241a=0xc8;}else{_0x14241a=0xce;}_0x16b649[_0x879a('0x18')](_0x14241a);return _0x16b649[_0x879a('0x1f')](_0x879a('0x20'),_0x32d9f5+'-'+_0x4160bd+'/'+_0x149105)['json'](_0x4a1e0e);}return null;};}function patchUpdates(_0x830b36){return function(_0x326e6a){try{jsonpatch['apply'](_0x326e6a,_0x830b36,!![]);}catch(_0x25a57d){return BPromise[_0x879a('0x21')](_0x25a57d);}return _0x326e6a['save']();};}function saveUpdates(_0x56e394,_0x4ed0d6){return function(_0x28c401){if(_0x28c401){return _0x28c401[_0x879a('0x22')](_0x56e394)[_0x879a('0x23')](function(_0x38d42c){return _0x38d42c;});}return null;};}function removeEntity(_0x4c3808,_0x5c21e2){return function(_0x3674f9){if(_0x3674f9){return _0x3674f9[_0x879a('0x24')]()[_0x879a('0x23')](function(){_0x4c3808[_0x879a('0x18')](0xcc)[_0x879a('0x19')]();});}};}function handleEntityNotFound(_0x1dd818,_0x7d67ed){return function(_0x14213c){if(!_0x14213c){_0x1dd818[_0x879a('0x17')](0x194);}return _0x14213c;};}function handleError(_0x2ee375,_0x272bf9){_0x272bf9=_0x272bf9||0x1f4;return function(_0x3510cc){logger[_0x879a('0x25')](_0x3510cc['stack']);if(_0x3510cc[_0x879a('0x26')]){delete _0x3510cc[_0x879a('0x26')];}_0x2ee375[_0x879a('0x18')](_0x272bf9)[_0x879a('0x27')](_0x3510cc);};}exports[_0x879a('0x28')]=function(_0x3030e0,_0x3ef6c1){var _0x2d9ed3={},_0x3ca5cd={},_0x1b6c15={'count':0x0,'rows':[]};var _0x2605e9=_[_0x879a('0x29')](db[_0x879a('0x2a')][_0x879a('0x2b')],function(_0x99559){return{'name':_0x99559[_0x879a('0x2c')],'type':_0x99559[_0x879a('0x2d')][_0x879a('0x2e')]};});_0x3ca5cd['model']=_[_0x879a('0x29')](_0x2605e9,'name');_0x3ca5cd[_0x879a('0x2f')]=_[_0x879a('0x30')](_0x3030e0[_0x879a('0x2f')]);_0x3ca5cd['filters']=_[_0x879a('0x31')](_0x3ca5cd['model'],_0x3ca5cd['query']);_0x2d9ed3['attributes']=_['intersection'](_0x3ca5cd[_0x879a('0x32')],qs[_0x879a('0x33')](_0x3030e0['query'][_0x879a('0x33')]));_0x2d9ed3[_0x879a('0x34')]=_0x2d9ed3[_0x879a('0x34')]['length']?_0x2d9ed3[_0x879a('0x34')]:_0x3ca5cd[_0x879a('0x32')];if(!_0x3030e0[_0x879a('0x2f')][_0x879a('0x35')]('nolimit')){_0x2d9ed3[_0x879a('0x1c')]=qs[_0x879a('0x1c')](_0x3030e0[_0x879a('0x2f')][_0x879a('0x1c')]);_0x2d9ed3['offset']=qs[_0x879a('0x1b')](_0x3030e0['query'][_0x879a('0x1b')]);}_0x2d9ed3['order']=qs[_0x879a('0x36')](_0x3030e0[_0x879a('0x2f')]['sort']);_0x2d9ed3[_0x879a('0x37')]=qs[_0x879a('0x38')](_[_0x879a('0x39')](_0x3030e0[_0x879a('0x2f')],_0x3ca5cd['filters']),_0x2605e9);if(_0x3030e0[_0x879a('0x2f')][_0x879a('0x3a')]){_0x2d9ed3[_0x879a('0x37')]=_['merge'](_0x2d9ed3['where'],{'$or':_['map'](_0x2605e9,function(_0x5de17f){if(_0x5de17f['type']!==_0x879a('0x3b')){var _0x142bdc={};_0x142bdc[_0x5de17f[_0x879a('0x26')]]={'$like':'%'+_0x3030e0['query']['filter']+'%'};return _0x142bdc;}})});}_0x2d9ed3=_['merge']({},_0x2d9ed3,_0x3030e0[_0x879a('0x3c')]);var _0x5597f9={'where':_0x2d9ed3[_0x879a('0x37')]};return db[_0x879a('0x2a')][_0x879a('0x1e')](_0x5597f9)['then'](function(_0x4f9681){_0x1b6c15[_0x879a('0x1e')]=_0x4f9681;if(_0x3030e0['query'][_0x879a('0x3d')]){_0x2d9ed3[_0x879a('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0x879a('0x3f')](_0x2d9ed3);})[_0x879a('0x23')](function(_0x2cc43c){_0x1b6c15['rows']=_0x2cc43c;return _0x1b6c15;})[_0x879a('0x23')](respondWithFilteredResult(_0x3ef6c1,_0x2d9ed3))[_0x879a('0x40')](handleError(_0x3ef6c1,null));};exports['show']=function(_0x7d99a0,_0x2456a4){var _0x4dedfe={'raw':!![],'where':{'id':_0x7d99a0[_0x879a('0x41')]['id']}},_0x14f8e7={};_0x14f8e7[_0x879a('0x32')]=_[_0x879a('0x30')](db['Cdr'][_0x879a('0x2b')]);_0x14f8e7['query']=_[_0x879a('0x30')](_0x7d99a0['query']);_0x14f8e7[_0x879a('0x38')]=_['intersection'](_0x14f8e7[_0x879a('0x32')],_0x14f8e7[_0x879a('0x2f')]);_0x4dedfe[_0x879a('0x34')]=_[_0x879a('0x31')](_0x14f8e7[_0x879a('0x32')],qs[_0x879a('0x33')](_0x7d99a0['query'][_0x879a('0x33')]));_0x4dedfe[_0x879a('0x34')]=_0x4dedfe[_0x879a('0x34')]['length']?_0x4dedfe[_0x879a('0x34')]:_0x14f8e7[_0x879a('0x32')];if(_0x7d99a0[_0x879a('0x2f')]['includeAll']){_0x4dedfe[_0x879a('0x3e')]=[{'all':!![]}];}_0x4dedfe=_[_0x879a('0x42')]({},_0x4dedfe,_0x7d99a0[_0x879a('0x3c')]);return db[_0x879a('0x2a')]['find'](_0x4dedfe)['then'](handleEntityNotFound(_0x2456a4,null))[_0x879a('0x23')](respondWithResult(_0x2456a4,null))[_0x879a('0x40')](handleError(_0x2456a4,null));};exports['create']=function(_0x2ff7cd,_0x4420ac){return db['Cdr'][_0x879a('0x43')](_0x2ff7cd[_0x879a('0x44')],{})[_0x879a('0x23')](respondWithResult(_0x4420ac,0xc9))[_0x879a('0x40')](handleError(_0x4420ac,null));};exports['update']=function(_0x3ffbe6,_0x32933f){if(_0x3ffbe6[_0x879a('0x44')]['id']){delete _0x3ffbe6['body']['id'];}return db['Cdr'][_0x879a('0x45')]({'where':{'id':_0x3ffbe6[_0x879a('0x41')]['id']}})['then'](handleEntityNotFound(_0x32933f,null))[_0x879a('0x23')](saveUpdates(_0x3ffbe6[_0x879a('0x44')],null))[_0x879a('0x23')](respondWithResult(_0x32933f,null))['catch'](handleError(_0x32933f,null));};exports[_0x879a('0x24')]=function(_0x677418,_0xc1c234){return db[_0x879a('0x2a')]['find']({'where':{'id':_0x677418[_0x879a('0x41')]['id']}})[_0x879a('0x23')](handleEntityNotFound(_0xc1c234,null))['then'](removeEntity(_0xc1c234,null))[_0x879a('0x40')](handleError(_0xc1c234,null));};exports[_0x879a('0x46')]=function(_0x59ff36,_0x51644c){return db[_0x879a('0x2a')]['describe']()['then'](respondWithResult(_0x51644c,null))[_0x879a('0x40')](handleError(_0x51644c,null));}; \ No newline at end of file +var _0x9b67=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x5d28e0,_0x4bb9d8){var _0x53a924=function(_0x28b506){while(--_0x28b506){_0x5d28e0['push'](_0x5d28e0['shift']());}};_0x53a924(++_0x4bb9d8);}(_0x9b67,0xf6));var _0x79b6=function(_0x16c71e,_0x1759df){_0x16c71e=_0x16c71e-0x0;var _0x446a33=_0x9b67[_0x16c71e];return _0x446a33;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require('moment');var BPromise=require(_0x79b6('0x5'));var Mustache=require(_0x79b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b6('0x7'));var csv=require(_0x79b6('0x8'));var ejs=require(_0x79b6('0x9'));var fs=require('fs');var fs_extra=require(_0x79b6('0xa'));var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x8'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var licenseUtil=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];function respondWithStatusCode(_0x526727,_0xc05a77){_0xc05a77=_0xc05a77||0xcc;return function(_0x2df08d){if(_0x2df08d){return _0x526727[_0x79b6('0x19')](_0xc05a77);}return _0x526727[_0x79b6('0x1a')](_0xc05a77)[_0x79b6('0x1b')]();};}function respondWithResult(_0x40478d,_0x19d5b2){_0x19d5b2=_0x19d5b2||0xc8;return function(_0x3ef1fa){if(_0x3ef1fa){return _0x40478d[_0x79b6('0x1a')](_0x19d5b2)[_0x79b6('0x1c')](_0x3ef1fa);}};}function respondWithFilteredResult(_0x2ac966,_0x3563cc){return function(_0x1e8bf1){if(_0x1e8bf1){var _0x4cf491=typeof _0x3563cc[_0x79b6('0x1d')]===_0x79b6('0x1e')&&typeof _0x3563cc[_0x79b6('0x1f')]===_0x79b6('0x1e');var _0x2a8788=_0x1e8bf1[_0x79b6('0x20')];var _0x131bc5=_0x4cf491?0x0:_0x3563cc[_0x79b6('0x1d')];var _0x3ff583=_0x4cf491?_0x1e8bf1[_0x79b6('0x20')]:_0x3563cc[_0x79b6('0x1d')]+_0x3563cc[_0x79b6('0x1f')];var _0x1361f6;if(_0x3ff583>=_0x2a8788){_0x3ff583=_0x2a8788;_0x1361f6=0xc8;}else{_0x1361f6=0xce;}_0x2ac966['status'](_0x1361f6);return _0x2ac966[_0x79b6('0x21')]('Content-Range',_0x131bc5+'-'+_0x3ff583+'/'+_0x2a8788)[_0x79b6('0x1c')](_0x1e8bf1);}return null;};}function patchUpdates(_0x532e65){return function(_0x28b9c2){try{jsonpatch[_0x79b6('0x22')](_0x28b9c2,_0x532e65,!![]);}catch(_0x299bed){return BPromise['reject'](_0x299bed);}return _0x28b9c2[_0x79b6('0x23')]();};}function saveUpdates(_0x30dc0b,_0x53208a){return function(_0x565f86){if(_0x565f86){return _0x565f86[_0x79b6('0x24')](_0x30dc0b)[_0x79b6('0x25')](function(_0x9bd2cc){return _0x9bd2cc;});}return null;};}function removeEntity(_0x268826,_0x3b2a2a){return function(_0x488102){if(_0x488102){return _0x488102[_0x79b6('0x26')]()[_0x79b6('0x25')](function(){_0x268826[_0x79b6('0x1a')](0xcc)[_0x79b6('0x1b')]();});}};}function handleEntityNotFound(_0x4c275d,_0x53c03c){return function(_0x40ef76){if(!_0x40ef76){_0x4c275d[_0x79b6('0x19')](0x194);}return _0x40ef76;};}function handleError(_0x37b01b,_0xc25c99){_0xc25c99=_0xc25c99||0x1f4;return function(_0x4adf15){logger[_0x79b6('0x27')](_0x4adf15['stack']);if(_0x4adf15[_0x79b6('0x28')]){delete _0x4adf15[_0x79b6('0x28')];}_0x37b01b[_0x79b6('0x1a')](_0xc25c99)[_0x79b6('0x29')](_0x4adf15);};}exports['index']=function(_0x1484e5,_0x310832){var _0x53b463={},_0x158221={},_0x2d219c={'count':0x0,'rows':[]};var _0x1b1f2b=_[_0x79b6('0x2a')](db[_0x79b6('0x2b')][_0x79b6('0x2c')],function(_0x53b2f5){return{'name':_0x53b2f5[_0x79b6('0x2d')],'type':_0x53b2f5[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x158221[_0x79b6('0x30')]=_[_0x79b6('0x2a')](_0x1b1f2b,_0x79b6('0x28'));_0x158221['query']=_[_0x79b6('0x31')](_0x1484e5[_0x79b6('0x32')]);_0x158221[_0x79b6('0x33')]=_['intersection'](_0x158221['model'],_0x158221[_0x79b6('0x32')]);_0x53b463[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x158221[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x1484e5[_0x79b6('0x32')]['fields']));_0x53b463['attributes']=_0x53b463[_0x79b6('0x34')]['length']?_0x53b463[_0x79b6('0x34')]:_0x158221['model'];if(!_0x1484e5[_0x79b6('0x32')][_0x79b6('0x37')]('nolimit')){_0x53b463[_0x79b6('0x1f')]=qs[_0x79b6('0x1f')](_0x1484e5['query'][_0x79b6('0x1f')]);_0x53b463['offset']=qs[_0x79b6('0x1d')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x1d')]);}_0x53b463[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x39')]);_0x53b463[_0x79b6('0x3a')]=qs[_0x79b6('0x33')](_[_0x79b6('0x3b')](_0x1484e5['query'],_0x158221['filters']),_0x1b1f2b);if(_0x1484e5['query'][_0x79b6('0x3c')]){_0x53b463[_0x79b6('0x3a')]=_['merge'](_0x53b463[_0x79b6('0x3a')],{'$or':_['map'](_0x1b1f2b,function(_0x179a98){if(_0x179a98[_0x79b6('0x2e')]!==_0x79b6('0x3d')){var _0x53db1d={};_0x53db1d[_0x179a98[_0x79b6('0x28')]]={'$like':'%'+_0x1484e5['query'][_0x79b6('0x3c')]+'%'};return _0x53db1d;}})});}_0x53b463=_[_0x79b6('0x3e')]({},_0x53b463,_0x1484e5[_0x79b6('0x3f')]);var _0x2feeeb={'where':_0x53b463[_0x79b6('0x3a')]};return db['Cdr']['count'](_0x2feeeb)[_0x79b6('0x25')](function(_0x48ae49){_0x2d219c[_0x79b6('0x20')]=_0x48ae49;if(_0x1484e5[_0x79b6('0x32')][_0x79b6('0x40')]){_0x53b463[_0x79b6('0x41')]=[{'all':!![]}];}return db[_0x79b6('0x2b')][_0x79b6('0x42')](_0x53b463);})[_0x79b6('0x25')](function(_0x4a7f90){_0x2d219c[_0x79b6('0x43')]=_0x4a7f90;return _0x2d219c;})[_0x79b6('0x25')](respondWithFilteredResult(_0x310832,_0x53b463))[_0x79b6('0x44')](handleError(_0x310832,null));};exports[_0x79b6('0x45')]=function(_0x568f6b,_0x12ea22){var _0x4f803c={'raw':!![],'where':{'id':_0x568f6b[_0x79b6('0x46')]['id']}},_0x4ba212={};_0x4ba212[_0x79b6('0x30')]=_[_0x79b6('0x31')](db[_0x79b6('0x2b')][_0x79b6('0x2c')]);_0x4ba212[_0x79b6('0x32')]=_[_0x79b6('0x31')](_0x568f6b[_0x79b6('0x32')]);_0x4ba212['filters']=_[_0x79b6('0x35')](_0x4ba212['model'],_0x4ba212['query']);_0x4f803c[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x4ba212[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x568f6b[_0x79b6('0x32')][_0x79b6('0x36')]));_0x4f803c[_0x79b6('0x34')]=_0x4f803c[_0x79b6('0x34')][_0x79b6('0x47')]?_0x4f803c['attributes']:_0x4ba212[_0x79b6('0x30')];if(_0x568f6b[_0x79b6('0x32')][_0x79b6('0x40')]){_0x4f803c[_0x79b6('0x41')]=[{'all':!![]}];}_0x4f803c=_[_0x79b6('0x3e')]({},_0x4f803c,_0x568f6b['options']);return db[_0x79b6('0x2b')][_0x79b6('0x48')](_0x4f803c)['then'](handleEntityNotFound(_0x12ea22,null))['then'](respondWithResult(_0x12ea22,null))[_0x79b6('0x44')](handleError(_0x12ea22,null));};exports[_0x79b6('0x49')]=function(_0x247c79,_0xa0c396){return db[_0x79b6('0x2b')][_0x79b6('0x49')](_0x247c79[_0x79b6('0x4a')],{})[_0x79b6('0x25')](respondWithResult(_0xa0c396,0xc9))[_0x79b6('0x44')](handleError(_0xa0c396,null));};exports[_0x79b6('0x24')]=function(_0x15c795,_0x39972b){if(_0x15c795[_0x79b6('0x4a')]['id']){delete _0x15c795[_0x79b6('0x4a')]['id'];}return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x15c795[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x39972b,null))[_0x79b6('0x25')](saveUpdates(_0x15c795['body'],null))['then'](respondWithResult(_0x39972b,null))['catch'](handleError(_0x39972b,null));};exports['destroy']=function(_0x56deb2,_0x412c1e){return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x56deb2[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x412c1e,null))[_0x79b6('0x25')](removeEntity(_0x412c1e,null))['catch'](handleError(_0x412c1e,null));};exports[_0x79b6('0x4b')]=function(_0xa2ba0e,_0x58232b){return db[_0x79b6('0x2b')]['describe']()[_0x79b6('0x25')](respondWithResult(_0x58232b,null))['catch'](handleError(_0x58232b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e1944ac..4b50c20 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x23931d,_0x1a1c41){var _0x5d4f5f=function(_0x5cbbf5){while(--_0x5cbbf5){_0x23931d['push'](_0x23931d['shift']());}};_0x5d4f5f(++_0x1a1c41);}(_0x7a54,0x106));var _0x47a5=function(_0x484c37,_0x47029a){_0x484c37=_0x484c37-0x0;var _0x31669e=_0x7a54[_0x484c37];return _0x31669e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2289f9,_0x6bef86){var _0x6514aa=function(_0x57210b){while(--_0x57210b){_0x2289f9['push'](_0x2289f9['shift']());}};_0x6514aa(++_0x6bef86);}(_0x7a54,0x106));var _0x47a5=function(_0x7f89d4,_0x22bcdf){_0x7f89d4=_0x7f89d4-0x0;var _0x581da3=_0x7a54[_0x7f89d4];return _0x581da3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index eafa750..e60c381 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 _0x0166=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Cdr,\x20%s,\x20%s','result'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0x0166,0xfc));var _0x6016=function(_0x43d4a5,_0x1b8a5d){_0x43d4a5=_0x43d4a5-0x0;var _0x562069=_0x0166[_0x43d4a5];return _0x562069;};'use strict';var _=require(_0x6016('0x0'));var util=require(_0x6016('0x1'));var moment=require('moment');var BPromise=require(_0x6016('0x2'));var rs=require(_0x6016('0x3'));var fs=require('fs');var Redis=require(_0x6016('0x4'));var db=require(_0x6016('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6016('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6016('0x7'));var client=jayson[_0x6016('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cf1d8,_0x2bf0a6,_0x25189e){return new BPromise(function(_0x15ded2,_0x2b3a23){return client[_0x6016('0x9')](_0x4cf1d8,_0x25189e)[_0x6016('0xa')](function(_0xe74e07){logger[_0x6016('0xb')]('Cdr,\x20%s,\x20%s',_0x2bf0a6,'request\x20sent');logger[_0x6016('0xc')](_0x6016('0xd'),_0x2bf0a6,_0x6016('0xe'),JSON[_0x6016('0xf')](_0xe74e07));if(_0xe74e07[_0x6016('0x10')]){if(_0xe74e07[_0x6016('0x10')][_0x6016('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x2bf0a6,_0xe74e07[_0x6016('0x10')][_0x6016('0x12')]);return _0x2b3a23(_0xe74e07[_0x6016('0x10')][_0x6016('0x12')]);}logger[_0x6016('0x10')](_0x6016('0x13'),_0x2bf0a6,_0xe74e07['error']['message']);return _0x15ded2(_0xe74e07[_0x6016('0x10')][_0x6016('0x12')]);}else{logger[_0x6016('0xb')]('Cdr,\x20%s,\x20%s',_0x2bf0a6,_0x6016('0xe'));_0x15ded2(_0xe74e07[_0x6016('0x14')][_0x6016('0x12')]);}})['catch'](function(_0x458841){logger[_0x6016('0x10')](_0x6016('0x13'),_0x2bf0a6,_0x458841);_0x2b3a23(_0x458841);});});} \ No newline at end of file +var _0xdd96=['stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x259d09,_0xbe1403){var _0x205ca8=function(_0x6286aa){while(--_0x6286aa){_0x259d09['push'](_0x259d09['shift']());}};_0x205ca8(++_0xbe1403);}(_0xdd96,0x16e));var _0x6dd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6dd9('0x0'));var util=require('util');var moment=require(_0x6dd9('0x1'));var BPromise=require(_0x6dd9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dd9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dd9('0x4'));var logger=require(_0x6dd9('0x5'))('rpc');var config=require(_0x6dd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6dd9('0x7')][_0x6dd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33e6cf,_0x4c22c1,_0x1b1115){return new BPromise(function(_0x2adfc2,_0x2863f5){return client[_0x6dd9('0x9')](_0x33e6cf,_0x1b1115)[_0x6dd9('0xa')](function(_0x16ecdc){logger[_0x6dd9('0xb')](_0x6dd9('0xc'),_0x4c22c1,_0x6dd9('0xd'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4c22c1,_0x6dd9('0xd'),JSON[_0x6dd9('0xe')](_0x16ecdc));if(_0x16ecdc[_0x6dd9('0xf')]){if(_0x16ecdc[_0x6dd9('0xf')][_0x6dd9('0x10')]===0x1f4){logger[_0x6dd9('0xf')](_0x6dd9('0xc'),_0x4c22c1,_0x16ecdc[_0x6dd9('0xf')]['message']);return _0x2863f5(_0x16ecdc[_0x6dd9('0xf')][_0x6dd9('0x11')]);}logger[_0x6dd9('0xf')](_0x6dd9('0xc'),_0x4c22c1,_0x16ecdc['error'][_0x6dd9('0x11')]);return _0x2adfc2(_0x16ecdc[_0x6dd9('0xf')]['message']);}else{logger[_0x6dd9('0xb')](_0x6dd9('0xc'),_0x4c22c1,_0x6dd9('0xd'));_0x2adfc2(_0x16ecdc['result'][_0x6dd9('0x11')]);}})[_0x6dd9('0x12')](function(_0x2a72a){logger[_0x6dd9('0xf')](_0x6dd9('0xc'),_0x4c22c1,_0x2a72a);_0x2863f5(_0x2a72a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b3a92d1..22960ba 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x246426,_0x505c21){var _0x320fcf=function(_0x5f50dc){while(--_0x5f50dc){_0x246426['push'](_0x246426['shift']());}};_0x320fcf(++_0x505c21);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1398f67..018627b 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 _0x50b6=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x50b6,0x8d));var _0x650b=function(_0x2d252e,_0x53f616){_0x2d252e=_0x2d252e-0x0;var _0x13a6c4=_0x50b6[_0x2d252e];return _0x13a6c4;};'use strict';var Sequelize=require(_0x650b('0x0'));module[_0x650b('0x1')]={'priority':{'type':Sequelize[_0x650b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x650b('0x3')},'appdata':{'type':Sequelize[_0x650b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x650b('0x5')],'defaultValue':_0x650b('0x6')}}; \ No newline at end of file +var _0xfa89=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x189134,_0x3e6d13){var _0x282983=function(_0x43ab29){while(--_0x43ab29){_0x189134['push'](_0x189134['shift']());}};_0x282983(++_0x3e6d13);}(_0xfa89,0xa9));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9fa8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9fa8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9fa8('0x2')],'allowNull':![],'defaultValue':_0x9fa8('0x3')},'appdata':{'type':Sequelize[_0x9fa8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9fa8('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 983c0c6..298131d 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 _0xc4dd=['params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','then','destroy','error','stack','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','model','include','merge','options','find','update','body'];(function(_0x4dde32,_0x5c671d){var _0x5da244=function(_0x46b7da){while(--_0x46b7da){_0x4dde32['push'](_0x4dde32['shift']());}};_0x5da244(++_0x5c671d);}(_0xc4dd,0xad));var _0xdc4d=function(_0x39ff75,_0x2cfc9d){_0x39ff75=_0x39ff75-0x0;var _0xabfcd=_0xc4dd[_0x39ff75];return _0xabfcd;};'use strict';var emlformat=require(_0xdc4d('0x0'));var rimraf=require(_0xdc4d('0x1'));var zipdir=require(_0xdc4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc4d('0x3'));var moment=require(_0xdc4d('0x4'));var BPromise=require(_0xdc4d('0x5'));var Mustache=require(_0xdc4d('0x6'));var util=require(_0xdc4d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdc4d('0x8'));var ejs=require(_0xdc4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc4d('0xa'));var squel=require(_0xdc4d('0xb'));var crypto=require('crypto');var jsforce=require(_0xdc4d('0xc'));var deskjs=require(_0xdc4d('0xd'));var toCsv=require(_0xdc4d('0x8'));var querystring=require(_0xdc4d('0xe'));var Papa=require(_0xdc4d('0xf'));var Redis=require(_0xdc4d('0x10'));var authService=require(_0xdc4d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdc4d('0x12'));var hardwareService=require(_0xdc4d('0x13'));var logger=require('../../config/logger')(_0xdc4d('0x14'));var utils=require('../../config/utils');var config=require(_0xdc4d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487100,_0x351a48){_0x351a48=_0x351a48||0xcc;return function(_0xc63ead){if(_0xc63ead){return _0x487100[_0xdc4d('0x16')](_0x351a48);}return _0x487100['status'](_0x351a48)[_0xdc4d('0x17')]();};}function respondWithResult(_0x158295,_0x177547){_0x177547=_0x177547||0xc8;return function(_0x586e74){if(_0x586e74){return _0x158295[_0xdc4d('0x18')](_0x177547)['json'](_0x586e74);}};}function respondWithFilteredResult(_0x49235f,_0xf0f72c){return function(_0xff4e3){if(_0xff4e3){var _0x2c9835=typeof _0xf0f72c[_0xdc4d('0x19')]==='undefined'&&typeof _0xf0f72c[_0xdc4d('0x1a')]===_0xdc4d('0x1b');var _0x2caabc=_0xff4e3[_0xdc4d('0x1c')];var _0x504aa3=_0x2c9835?0x0:_0xf0f72c[_0xdc4d('0x19')];var _0x3203c1=_0x2c9835?_0xff4e3[_0xdc4d('0x1c')]:_0xf0f72c[_0xdc4d('0x19')]+_0xf0f72c[_0xdc4d('0x1a')];var _0x217fcb;if(_0x3203c1>=_0x2caabc){_0x3203c1=_0x2caabc;_0x217fcb=0xc8;}else{_0x217fcb=0xce;}_0x49235f[_0xdc4d('0x18')](_0x217fcb);return _0x49235f[_0xdc4d('0x1d')]('Content-Range',_0x504aa3+'-'+_0x3203c1+'/'+_0x2caabc)[_0xdc4d('0x1e')](_0xff4e3);}return null;};}function patchUpdates(_0x273af8){return function(_0x3900ce){try{jsonpatch[_0xdc4d('0x1f')](_0x3900ce,_0x273af8,!![]);}catch(_0x2eea2d){return BPromise['reject'](_0x2eea2d);}return _0x3900ce['save']();};}function saveUpdates(_0x2bca28,_0xa97815){return function(_0x3049a1){if(_0x3049a1){return _0x3049a1['update'](_0x2bca28)[_0xdc4d('0x20')](function(_0x4fee8a){return _0x4fee8a;});}return null;};}function removeEntity(_0xe30d3c,_0x25c8df){return function(_0x84132e){if(_0x84132e){return _0x84132e[_0xdc4d('0x21')]()[_0xdc4d('0x20')](function(){_0xe30d3c['status'](0xcc)[_0xdc4d('0x17')]();});}};}function handleEntityNotFound(_0x2def53,_0x722a8f){return function(_0xd6f0c7){if(!_0xd6f0c7){_0x2def53[_0xdc4d('0x16')](0x194);}return _0xd6f0c7;};}function handleError(_0x4f53ab,_0x22f9f2){_0x22f9f2=_0x22f9f2||0x1f4;return function(_0x1f51d9){logger[_0xdc4d('0x22')](_0x1f51d9[_0xdc4d('0x23')]);if(_0x1f51d9[_0xdc4d('0x24')]){delete _0x1f51d9[_0xdc4d('0x24')];}_0x4f53ab[_0xdc4d('0x18')](_0x22f9f2)[_0xdc4d('0x25')](_0x1f51d9);};}exports[_0xdc4d('0x26')]=function(_0x4933d6,_0x1c7270){var _0x31199d={'raw':!![],'where':{'id':_0x4933d6['params']['id']}},_0x286a52={};_0x286a52['model']=_[_0xdc4d('0x27')](db[_0xdc4d('0x28')][_0xdc4d('0x29')]);_0x286a52[_0xdc4d('0x2a')]=_['keys'](_0x4933d6[_0xdc4d('0x2a')]);_0x286a52[_0xdc4d('0x2b')]=_[_0xdc4d('0x2c')](_0x286a52['model'],_0x286a52[_0xdc4d('0x2a')]);_0x31199d[_0xdc4d('0x2d')]=_['intersection'](_0x286a52['model'],qs['fields'](_0x4933d6[_0xdc4d('0x2a')][_0xdc4d('0x2e')]));_0x31199d['attributes']=_0x31199d[_0xdc4d('0x2d')][_0xdc4d('0x2f')]?_0x31199d['attributes']:_0x286a52[_0xdc4d('0x30')];if(_0x4933d6[_0xdc4d('0x2a')]['includeAll']){_0x31199d[_0xdc4d('0x31')]=[{'all':!![]}];}_0x31199d=_[_0xdc4d('0x32')]({},_0x31199d,_0x4933d6[_0xdc4d('0x33')]);return db[_0xdc4d('0x28')][_0xdc4d('0x34')](_0x31199d)[_0xdc4d('0x20')](handleEntityNotFound(_0x1c7270,null))['then'](respondWithResult(_0x1c7270,null))['catch'](handleError(_0x1c7270,null));};exports[_0xdc4d('0x35')]=function(_0x279c46,_0x26ec16){if(_0x279c46[_0xdc4d('0x36')]['id']){delete _0x279c46[_0xdc4d('0x36')]['id'];}return db[_0xdc4d('0x28')][_0xdc4d('0x34')]({'where':{'id':_0x279c46[_0xdc4d('0x37')]['id']}})[_0xdc4d('0x20')](handleEntityNotFound(_0x26ec16,null))[_0xdc4d('0x20')](saveUpdates(_0x279c46[_0xdc4d('0x36')],null))[_0xdc4d('0x20')](respondWithResult(_0x26ec16,null))[_0xdc4d('0x38')](handleError(_0x26ec16,null));};exports[_0xdc4d('0x21')]=function(_0x4656a1,_0x1e2b0c){return db[_0xdc4d('0x28')][_0xdc4d('0x34')]({'where':{'id':_0x4656a1[_0xdc4d('0x37')]['id']}})[_0xdc4d('0x20')](handleEntityNotFound(_0x1e2b0c,null))['then'](removeEntity(_0x1e2b0c,null))[_0xdc4d('0x38')](handleError(_0x1e2b0c,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x51c287,_0x4f9382){var _0x25ed09=function(_0x3ae048){while(--_0x3ae048){_0x51c287['push'](_0x51c287['shift']());}};_0x25ed09(++_0x4f9382);}(_0xb43b,0x1b2));var _0xbb43=function(_0x503804,_0x17d0ec){_0x503804=_0x503804-0x0;var _0x358787=_0xb43b[_0x503804];return _0x358787;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['ChatApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 26e675a..1a89f94 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 _0xcea2=['rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xebf5,_0x3754f3){var _0x4c52bf=function(_0x3ccdde){while(--_0x3ccdde){_0xebf5['push'](_0xebf5['shift']());}};_0x4c52bf(++_0x3754f3);}(_0xcea2,0x15a));var _0x2cea=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xcea2[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cea('0xb'),'collate':_0x2cea('0xc')});}; \ No newline at end of file +var _0xabca=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','lodash'];(function(_0x3cc6f3,_0x470176){var _0x2f7115=function(_0x4b687c){while(--_0x4b687c){_0x3cc6f3['push'](_0x3cc6f3['shift']());}};_0x2f7115(++_0x470176);}(_0xabca,0x1af));var _0xaabc=function(_0xf0c8af,_0x4ceef4){_0xf0c8af=_0xf0c8af-0x0;var _0x2ceabf=_0xabca[_0xf0c8af];return _0x2ceabf;};'use strict';var _=require(_0xaabc('0x0'));var util=require(_0xaabc('0x1'));var logger=require('../../config/logger')(_0xaabc('0x2'));var moment=require(_0xaabc('0x3'));var BPromise=require(_0xaabc('0x4'));var rp=require(_0xaabc('0x5'));var fs=require('fs');var path=require(_0xaabc('0x6'));var rimraf=require(_0xaabc('0x7'));var config=require(_0xaabc('0x8'));var attributes=require(_0xaabc('0x9'));module[_0xaabc('0xa')]=function(_0x4bd5f6,_0x22cc90){return _0x4bd5f6['define'](_0xaabc('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f7c002b..0794b99 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 _0xd26b=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util'];(function(_0x393cd7,_0xdbe809){var _0x1c5e12=function(_0x43a859){while(--_0x43a859){_0x393cd7['push'](_0x393cd7['shift']());}};_0x1c5e12(++_0xdbe809);}(_0xd26b,0xfb));var _0xbd26=function(_0x4d4b88,_0xff28fb){_0x4d4b88=_0x4d4b88-0x0;var _0xfa7665=_0xd26b[_0x4d4b88];return _0xfa7665;};'use strict';var _=require('lodash');var util=require(_0xbd26('0x0'));var moment=require(_0xbd26('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd26('0x3'))['db'];var utils=require(_0xbd26('0x4'));var logger=require('../../config/logger')(_0xbd26('0x5'));var config=require(_0xbd26('0x6'));var jayson=require(_0xbd26('0x7'));var client=jayson[_0xbd26('0x8')][_0xbd26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ab34c,_0x13309c,_0x310480){return new BPromise(function(_0x3824f0,_0xa10675){return client[_0xbd26('0xa')](_0x4ab34c,_0x310480)[_0xbd26('0xb')](function(_0x36237d){logger[_0xbd26('0xc')](_0xbd26('0xd'),_0x13309c,_0xbd26('0xe'));logger['debug'](_0xbd26('0xf'),_0x13309c,_0xbd26('0xe'),JSON['stringify'](_0x36237d));if(_0x36237d['error']){if(_0x36237d[_0xbd26('0x10')][_0xbd26('0x11')]===0x1f4){logger[_0xbd26('0x10')](_0xbd26('0xd'),_0x13309c,_0x36237d[_0xbd26('0x10')][_0xbd26('0x12')]);return _0xa10675(_0x36237d['error'][_0xbd26('0x12')]);}logger[_0xbd26('0x10')](_0xbd26('0xd'),_0x13309c,_0x36237d[_0xbd26('0x10')][_0xbd26('0x12')]);return _0x3824f0(_0x36237d['error'][_0xbd26('0x12')]);}else{logger[_0xbd26('0xc')](_0xbd26('0xd'),_0x13309c,_0xbd26('0xe'));_0x3824f0(_0x36237d[_0xbd26('0x13')]['message']);}})[_0xbd26('0x14')](function(_0x27db90){logger[_0xbd26('0x10')](_0xbd26('0xd'),_0x13309c,_0x27db90);_0xa10675(_0x27db90);});});} \ No newline at end of file +var _0xa4ee=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3efc43,_0x1d1c91){var _0x3ddfbd=function(_0x54b175){while(--_0x54b175){_0x3efc43['push'](_0x3efc43['shift']());}};_0x3ddfbd(++_0x1d1c91);}(_0xa4ee,0x84));var _0xea4e=function(_0x4c1f1f,_0x3aa18d){_0x4c1f1f=_0x4c1f1f-0x0;var _0x4f9e3c=_0xa4ee[_0x4c1f1f];return _0x4f9e3c;};'use strict';var _=require(_0xea4e('0x0'));var util=require(_0xea4e('0x1'));var moment=require(_0xea4e('0x2'));var BPromise=require(_0xea4e('0x3'));var rs=require(_0xea4e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea4e('0x5'))['db'];var utils=require(_0xea4e('0x6'));var logger=require('../../config/logger')(_0xea4e('0x7'));var config=require(_0xea4e('0x8'));var jayson=require(_0xea4e('0x9'));var client=jayson[_0xea4e('0xa')][_0xea4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd811,_0x1ff28a,_0x5f2b74){return new BPromise(function(_0x40006d,_0x2d4543){return client[_0xea4e('0xc')](_0x5bd811,_0x5f2b74)[_0xea4e('0xd')](function(_0x1ee7ad){logger['info'](_0xea4e('0xe'),_0x1ff28a,_0xea4e('0xf'));logger[_0xea4e('0x10')](_0xea4e('0x11'),_0x1ff28a,_0xea4e('0xf'),JSON[_0xea4e('0x12')](_0x1ee7ad));if(_0x1ee7ad[_0xea4e('0x13')]){if(_0x1ee7ad[_0xea4e('0x13')]['code']===0x1f4){logger[_0xea4e('0x13')](_0xea4e('0xe'),_0x1ff28a,_0x1ee7ad[_0xea4e('0x13')]['message']);return _0x2d4543(_0x1ee7ad[_0xea4e('0x13')][_0xea4e('0x14')]);}logger[_0xea4e('0x13')](_0xea4e('0xe'),_0x1ff28a,_0x1ee7ad[_0xea4e('0x13')][_0xea4e('0x14')]);return _0x40006d(_0x1ee7ad[_0xea4e('0x13')][_0xea4e('0x14')]);}else{logger[_0xea4e('0x15')](_0xea4e('0xe'),_0x1ff28a,_0xea4e('0xf'));_0x40006d(_0x1ee7ad[_0xea4e('0x16')]['message']);}})['catch'](function(_0x11cd8a){logger['error'](_0xea4e('0xe'),_0x1ff28a,_0x11cd8a);_0x2d4543(_0x11cd8a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 32be390..d355964 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 _0x2650=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x2650,0x7f));var _0x0265=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2650[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0x0265('0x0'));var util=require(_0x0265('0x1'));var path=require(_0x0265('0x2'));var timeout=require('connect-timeout');var express=require(_0x0265('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0265('0x4'));var interaction=require(_0x0265('0x5'));var config=require(_0x0265('0x6'));var controller=require(_0x0265('0x7'));router[_0x0265('0x8')](_0x0265('0x9'),auth[_0x0265('0xa')](),controller[_0x0265('0xb')]);router[_0x0265('0xc')](_0x0265('0x9'),auth[_0x0265('0xa')](),controller[_0x0265('0xd')]);router[_0x0265('0xe')](_0x0265('0x9'),auth[_0x0265('0xa')](),controller[_0x0265('0xf')]);module[_0x0265('0x10')]=router; \ No newline at end of file +var _0x2f9e=['./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x350b3f,_0x38b101){var _0x24a447=function(_0x72ca6){while(--_0x72ca6){_0x350b3f['push'](_0x350b3f['shift']());}};_0x24a447(++_0x38b101);}(_0x2f9e,0xbe));var _0xe2f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f9e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe2f9('0x0'));var util=require(_0xe2f9('0x1'));var path=require(_0xe2f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe2f9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe2f9('0x4'));var config=require(_0xe2f9('0x5'));var controller=require(_0xe2f9('0x6'));router['get'](_0xe2f9('0x7'),auth[_0xe2f9('0x8')](),controller[_0xe2f9('0x9')]);router[_0xe2f9('0xa')]('/:id',auth[_0xe2f9('0x8')](),controller[_0xe2f9('0xb')]);router[_0xe2f9('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe2f9('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cc3722c..d37b2e4 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 _0x966f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x12cad4,_0x108240){var _0x475dd8=function(_0x209344){while(--_0x209344){_0x12cad4['push'](_0x12cad4['shift']());}};_0x475dd8(++_0x108240);}(_0x966f,0xbf));var _0xf966=function(_0x2be64f,_0x51ab84){_0x2be64f=_0x2be64f-0x0;var _0x42cad5=_0x966f[_0x2be64f];return _0x42cad5;};'use strict';var Sequelize=require(_0xf966('0x0'));module[_0xf966('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf966('0x2')]},'write':{'type':Sequelize[_0xf966('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdc7c=['STRING','BOOLEAN','sequelize'];(function(_0x2bcf2a,_0x534b7f){var _0x2907cb=function(_0x1e36d8){while(--_0x1e36d8){_0x2bcf2a['push'](_0x2bcf2a['shift']());}};_0x2907cb(++_0x534b7f);}(_0xdc7c,0xf2));var _0xcdc7=function(_0x57b2f4,_0x52046a){_0x57b2f4=_0x57b2f4-0x0;var _0xa8d0c0=_0xdc7c[_0x57b2f4];return _0xa8d0c0;};'use strict';var Sequelize=require(_0xcdc7('0x0'));module['exports']={'name':{'type':Sequelize[_0xcdc7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcdc7('0x1')]},'write':{'type':Sequelize[_0xcdc7('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 c10d847..fa685f7 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 _0xb9cd=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','ChatGroup','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','map','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','rawAttributes','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xb9cd,0x18c));var _0xdb9c=function(_0x2700d5,_0x1b113b){_0x2700d5=_0x2700d5-0x0;var _0xdc3338=_0xb9cd[_0x2700d5];return _0xdc3338;};'use strict';var emlformat=require(_0xdb9c('0x0'));var rimraf=require(_0xdb9c('0x1'));var zipdir=require(_0xdb9c('0x2'));var jsonpatch=require(_0xdb9c('0x3'));var rp=require('request-promise');var moment=require(_0xdb9c('0x4'));var BPromise=require(_0xdb9c('0x5'));var Mustache=require(_0xdb9c('0x6'));var util=require(_0xdb9c('0x7'));var path=require(_0xdb9c('0x8'));var sox=require(_0xdb9c('0x9'));var csv=require('to-csv');var ejs=require(_0xdb9c('0xa'));var fs=require('fs');var fs_extra=require(_0xdb9c('0xb'));var _=require(_0xdb9c('0xc'));var squel=require(_0xdb9c('0xd'));var crypto=require(_0xdb9c('0xe'));var jsforce=require(_0xdb9c('0xf'));var deskjs=require(_0xdb9c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdb9c('0x11'));var Papa=require(_0xdb9c('0x12'));var Redis=require(_0xdb9c('0x13'));var authService=require(_0xdb9c('0x14'));var qs=require(_0xdb9c('0x15'));var as=require(_0xdb9c('0x16'));var hardwareService=require(_0xdb9c('0x17'));var logger=require('../../config/logger')(_0xdb9c('0x18'));var utils=require('../../config/utils');var config=require(_0xdb9c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb9c('0x1a'))['db'];config['redis']=_[_0xdb9c('0x1b')](config[_0xdb9c('0x1c')],{'host':_0xdb9c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb9c('0x1c')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x5e944e,_0x32b6b7){_0x32b6b7=_0x32b6b7||0xcc;return function(_0x495de5){if(_0x495de5){return _0x5e944e[_0xdb9c('0x1e')](_0x32b6b7);}return _0x5e944e[_0xdb9c('0x1f')](_0x32b6b7)[_0xdb9c('0x20')]();};}function respondWithResult(_0x396bd1,_0x567a8c){_0x567a8c=_0x567a8c||0xc8;return function(_0x926f53){if(_0x926f53){return _0x396bd1[_0xdb9c('0x1f')](_0x567a8c)['json'](_0x926f53);}};}function respondWithFilteredResult(_0x41f638,_0x275548){return function(_0x32e384){if(_0x32e384){var _0x157381=typeof _0x275548[_0xdb9c('0x21')]===_0xdb9c('0x22')&&typeof _0x275548[_0xdb9c('0x23')]===_0xdb9c('0x22');var _0x1a5d06=_0x32e384['count'];var _0x3a895c=_0x157381?0x0:_0x275548['offset'];var _0x3ff364=_0x157381?_0x32e384[_0xdb9c('0x24')]:_0x275548[_0xdb9c('0x21')]+_0x275548[_0xdb9c('0x23')];var _0x241eb7;if(_0x3ff364>=_0x1a5d06){_0x3ff364=_0x1a5d06;_0x241eb7=0xc8;}else{_0x241eb7=0xce;}_0x41f638['status'](_0x241eb7);return _0x41f638[_0xdb9c('0x25')](_0xdb9c('0x26'),_0x3a895c+'-'+_0x3ff364+'/'+_0x1a5d06)[_0xdb9c('0x27')](_0x32e384);}return null;};}function patchUpdates(_0x2f7db0){return function(_0x30da7c){try{jsonpatch[_0xdb9c('0x28')](_0x30da7c,_0x2f7db0,!![]);}catch(_0x6e8fc8){return BPromise[_0xdb9c('0x29')](_0x6e8fc8);}return _0x30da7c[_0xdb9c('0x2a')]();};}function saveUpdates(_0x1f2479,_0xc02d9c){return function(_0x19b43c){if(_0x19b43c){return _0x19b43c[_0xdb9c('0x2b')](_0x1f2479)[_0xdb9c('0x2c')](function(_0x2a5b08){return _0x2a5b08;});}return null;};}function removeEntity(_0x63ac7,_0x37b8d9){return function(_0x10cfb6){if(_0x10cfb6){return _0x10cfb6[_0xdb9c('0x2d')]()[_0xdb9c('0x2c')](function(){_0x63ac7[_0xdb9c('0x1f')](0xcc)[_0xdb9c('0x20')]();});}};}function handleEntityNotFound(_0x2f527c,_0x5d3e53){return function(_0xf94433){if(!_0xf94433){_0x2f527c['sendStatus'](0x194);}return _0xf94433;};}function handleError(_0x40858f,_0x50d26c){_0x50d26c=_0x50d26c||0x1f4;return function(_0xfa86e7){logger[_0xdb9c('0x2e')](_0xfa86e7[_0xdb9c('0x2f')]);if(_0xfa86e7[_0xdb9c('0x30')]){delete _0xfa86e7[_0xdb9c('0x30')];}_0x40858f[_0xdb9c('0x1f')](_0x50d26c)['send'](_0xfa86e7);};}exports[_0xdb9c('0x31')]=function(_0x10a2ac,_0x5c2ac6){var _0x4e69f8={},_0x293100={},_0x469cca={'count':0x0,'rows':[]};var _0x4d3478=_['map'](db[_0xdb9c('0x32')]['rawAttributes'],function(_0x564b87){return{'name':_0x564b87[_0xdb9c('0x33')],'type':_0x564b87[_0xdb9c('0x34')][_0xdb9c('0x35')]};});_0x293100[_0xdb9c('0x36')]=_['map'](_0x4d3478,_0xdb9c('0x30'));_0x293100[_0xdb9c('0x37')]=_[_0xdb9c('0x38')](_0x10a2ac[_0xdb9c('0x37')]);_0x293100['filters']=_[_0xdb9c('0x39')](_0x293100[_0xdb9c('0x36')],_0x293100[_0xdb9c('0x37')]);_0x4e69f8[_0xdb9c('0x3a')]=_[_0xdb9c('0x39')](_0x293100[_0xdb9c('0x36')],qs['fields'](_0x10a2ac[_0xdb9c('0x37')][_0xdb9c('0x3b')]));_0x4e69f8[_0xdb9c('0x3a')]=_0x4e69f8[_0xdb9c('0x3a')][_0xdb9c('0x3c')]?_0x4e69f8['attributes']:_0x293100[_0xdb9c('0x36')];if(!_0x10a2ac['query']['hasOwnProperty'](_0xdb9c('0x3d'))){_0x4e69f8[_0xdb9c('0x23')]=qs[_0xdb9c('0x23')](_0x10a2ac[_0xdb9c('0x37')][_0xdb9c('0x23')]);_0x4e69f8[_0xdb9c('0x21')]=qs['offset'](_0x10a2ac[_0xdb9c('0x37')]['offset']);}_0x4e69f8[_0xdb9c('0x3e')]=qs[_0xdb9c('0x3f')](_0x10a2ac[_0xdb9c('0x37')]['sort']);_0x4e69f8[_0xdb9c('0x40')]=qs[_0xdb9c('0x41')](_['pick'](_0x10a2ac['query'],_0x293100['filters']),_0x4d3478);if(_0x10a2ac['query'][_0xdb9c('0x42')]){_0x4e69f8['where']=_['merge'](_0x4e69f8[_0xdb9c('0x40')],{'$or':_[_0xdb9c('0x43')](_0x4d3478,function(_0x279593){if(_0x279593[_0xdb9c('0x34')]!=='VIRTUAL'){var _0x165d65={};_0x165d65[_0x279593[_0xdb9c('0x30')]]={'$like':'%'+_0x10a2ac[_0xdb9c('0x37')][_0xdb9c('0x42')]+'%'};return _0x165d65;}})});}_0x4e69f8=_[_0xdb9c('0x44')]({},_0x4e69f8,_0x10a2ac[_0xdb9c('0x45')]);var _0x22822f={'where':_0x4e69f8[_0xdb9c('0x40')]};return db[_0xdb9c('0x32')]['count'](_0x22822f)[_0xdb9c('0x2c')](function(_0x149798){_0x469cca[_0xdb9c('0x24')]=_0x149798;if(_0x10a2ac[_0xdb9c('0x37')]['includeAll']){_0x4e69f8[_0xdb9c('0x46')]=[{'all':!![]}];}return db[_0xdb9c('0x32')][_0xdb9c('0x47')](_0x4e69f8);})[_0xdb9c('0x2c')](function(_0x367c51){_0x469cca[_0xdb9c('0x48')]=_0x367c51;return _0x469cca;})['then'](respondWithFilteredResult(_0x5c2ac6,_0x4e69f8))[_0xdb9c('0x49')](handleError(_0x5c2ac6,null));};exports[_0xdb9c('0x4a')]=function(_0xe03573,_0x54538d){var _0x2c57e2={'raw':!![],'where':{'id':_0xe03573[_0xdb9c('0x4b')]['id']}},_0x5ca330={};_0x5ca330[_0xdb9c('0x36')]=_[_0xdb9c('0x38')](db[_0xdb9c('0x32')]['rawAttributes']);_0x5ca330[_0xdb9c('0x37')]=_[_0xdb9c('0x38')](_0xe03573[_0xdb9c('0x37')]);_0x5ca330['filters']=_[_0xdb9c('0x39')](_0x5ca330[_0xdb9c('0x36')],_0x5ca330[_0xdb9c('0x37')]);_0x2c57e2[_0xdb9c('0x3a')]=_[_0xdb9c('0x39')](_0x5ca330[_0xdb9c('0x36')],qs[_0xdb9c('0x3b')](_0xe03573[_0xdb9c('0x37')][_0xdb9c('0x3b')]));_0x2c57e2[_0xdb9c('0x3a')]=_0x2c57e2[_0xdb9c('0x3a')]['length']?_0x2c57e2[_0xdb9c('0x3a')]:_0x5ca330[_0xdb9c('0x36')];if(_0xe03573[_0xdb9c('0x37')][_0xdb9c('0x4c')]){_0x2c57e2[_0xdb9c('0x46')]=[{'all':!![]}];}_0x2c57e2=_[_0xdb9c('0x44')]({},_0x2c57e2,_0xe03573[_0xdb9c('0x45')]);return db[_0xdb9c('0x32')][_0xdb9c('0x4d')](_0x2c57e2)[_0xdb9c('0x2c')](handleEntityNotFound(_0x54538d,null))[_0xdb9c('0x2c')](respondWithResult(_0x54538d,null))[_0xdb9c('0x49')](handleError(_0x54538d,null));};exports['create']=function(_0x557ed0,_0x3c2133){return db[_0xdb9c('0x32')][_0xdb9c('0x4e')](_0x557ed0[_0xdb9c('0x4f')],{})[_0xdb9c('0x2c')](respondWithResult(_0x3c2133,0xc9))[_0xdb9c('0x49')](handleError(_0x3c2133,null));};exports[_0xdb9c('0x2b')]=function(_0x106b9b,_0x21580f){if(_0x106b9b[_0xdb9c('0x4f')]['id']){delete _0x106b9b['body']['id'];}return db[_0xdb9c('0x32')][_0xdb9c('0x4d')]({'where':{'id':_0x106b9b[_0xdb9c('0x4b')]['id']}})[_0xdb9c('0x2c')](handleEntityNotFound(_0x21580f,null))['then'](saveUpdates(_0x106b9b[_0xdb9c('0x4f')],null))['then'](respondWithResult(_0x21580f,null))[_0xdb9c('0x49')](handleError(_0x21580f,null));};exports['destroy']=function(_0x46cbbd,_0x55ce22){return db[_0xdb9c('0x32')]['find']({'where':{'id':_0x46cbbd[_0xdb9c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x55ce22,null))[_0xdb9c('0x2c')](removeEntity(_0x55ce22,null))[_0xdb9c('0x49')](handleError(_0x55ce22,null));};exports[_0xdb9c('0x50')]=function(_0x307fc1,_0x509045){return db[_0xdb9c('0x32')][_0xdb9c('0x50')]()[_0xdb9c('0x2c')](respondWithResult(_0x509045,null))['catch'](handleError(_0x509045,null));};exports[_0xdb9c('0x51')]=function(_0x327cb7,_0x16014d,_0x4ee768){return db[_0xdb9c('0x52')][_0xdb9c('0x24')]({'where':{'ChatGroupId':_0x327cb7['params']['id'],'ToId':_0x327cb7[_0xdb9c('0x53')]['id'],'read':![]}})[_0xdb9c('0x2c')](function(_0x1d8c55){return{'id':_[_0xdb9c('0x54')](_0x327cb7['params']['id']),'count':_0x1d8c55};})[_0xdb9c('0x2c')](respondWithResult(_0x16014d,null))[_0xdb9c('0x49')](handleError(_0x16014d,null));};exports[_0xdb9c('0x55')]=function(_0x29f36a,_0x4f86bf,_0x45ad43){return db[_0xdb9c('0x32')][_0xdb9c('0x4d')]({'where':{'id':_0x29f36a[_0xdb9c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f86bf,null))['then'](function(_0x3fbe6c){if(_0x3fbe6c){return _0x3fbe6c[_0xdb9c('0x55')](_0x29f36a[_0xdb9c('0x4f')][_0xdb9c('0x56')],_[_0xdb9c('0x57')](_0x29f36a[_0xdb9c('0x4f')],[_0xdb9c('0x56'),'id'])||{});}})[_0xdb9c('0x2c')](respondWithResult(_0x4f86bf,null))[_0xdb9c('0x49')](handleError(_0x4f86bf,null));};exports[_0xdb9c('0x58')]=function(_0x20a6ef,_0x3e11ea,_0x45fc21){var _0x171288={};var _0xdfc67c={};var _0x5cde48;var _0x120e06;return db[_0xdb9c('0x32')][_0xdb9c('0x59')]({'where':{'id':_0x20a6ef['params']['id']}})['then'](handleEntityNotFound(_0x3e11ea,null))[_0xdb9c('0x2c')](function(_0x20f99c){if(_0x20f99c){_0x5cde48=_0x20f99c;_0xdfc67c[_0xdb9c('0x36')]=_[_0xdb9c('0x38')](db[_0xdb9c('0x5a')][_0xdb9c('0x5b')]);_0xdfc67c[_0xdb9c('0x37')]=_[_0xdb9c('0x38')](_0x20a6ef[_0xdb9c('0x37')]);_0xdfc67c[_0xdb9c('0x41')]=_[_0xdb9c('0x39')](_0xdfc67c[_0xdb9c('0x36')],_0xdfc67c[_0xdb9c('0x37')]);_0x171288['attributes']=_[_0xdb9c('0x39')](_0xdfc67c['model'],qs[_0xdb9c('0x3b')](_0x20a6ef[_0xdb9c('0x37')][_0xdb9c('0x3b')]));_0x171288[_0xdb9c('0x3a')]=_0x171288['attributes']['length']?_0x171288['attributes']:_0xdfc67c[_0xdb9c('0x36')];_0x171288[_0xdb9c('0x3e')]=qs[_0xdb9c('0x3f')](_0x20a6ef[_0xdb9c('0x37')]['sort']);_0x171288['where']=qs['filters'](_[_0xdb9c('0x5c')](_0x20a6ef[_0xdb9c('0x37')],_0xdfc67c[_0xdb9c('0x41')]));if(_0x20a6ef[_0xdb9c('0x37')][_0xdb9c('0x42')]){_0x171288[_0xdb9c('0x40')]=_[_0xdb9c('0x44')](_0x171288[_0xdb9c('0x40')],{'$or':_[_0xdb9c('0x43')](_0x171288[_0xdb9c('0x3a')],function(_0x323e15){var _0x587216={};_0x587216[_0x323e15]={'$like':'%'+_0x20a6ef['query'][_0xdb9c('0x42')]+'%'};return _0x587216;})});}_0x171288=_[_0xdb9c('0x44')]({},_0x171288,_0x20a6ef['options']);return _0x5cde48[_0xdb9c('0x58')](_0x171288);}})[_0xdb9c('0x2c')](function(_0x54ce5e){if(_0x54ce5e){_0x120e06=_0x54ce5e[_0xdb9c('0x3c')];if(!_0x20a6ef[_0xdb9c('0x37')][_0xdb9c('0x5d')]('nolimit')){_0x171288[_0xdb9c('0x23')]=qs[_0xdb9c('0x23')](_0x20a6ef[_0xdb9c('0x37')][_0xdb9c('0x23')]);_0x171288[_0xdb9c('0x21')]=qs[_0xdb9c('0x21')](_0x20a6ef['query']['offset']);}return _0x5cde48[_0xdb9c('0x58')](_0x171288);}})[_0xdb9c('0x2c')](function(_0x3808f6){if(_0x3808f6){return _0x3808f6?{'count':_0x120e06,'rows':_0x3808f6}:null;}})[_0xdb9c('0x2c')](respondWithResult(_0x3e11ea,null))[_0xdb9c('0x49')](handleError(_0x3e11ea,null));};exports['removeMembers']=function(_0x26ac00,_0x5967ec,_0x54b42c){return db[_0xdb9c('0x32')][_0xdb9c('0x4d')]({'where':{'id':_0x26ac00['params']['id']}})[_0xdb9c('0x2c')](handleEntityNotFound(_0x5967ec,null))[_0xdb9c('0x2c')](function(_0xa29426){if(_0xa29426){return _0xa29426[_0xdb9c('0x5e')](_0x26ac00[_0xdb9c('0x37')][_0xdb9c('0x56')]);}})[_0xdb9c('0x2c')](respondWithStatusCode(_0x5967ec,null))['catch'](handleError(_0x5967ec,null));};exports[_0xdb9c('0x5f')]=function(_0x378ba2,_0x592a10,_0x228464){if(_0x378ba2[_0xdb9c('0x4f')]['id']){delete _0x378ba2[_0xdb9c('0x4f')]['id'];}return db['ChatGroup'][_0xdb9c('0x4d')]({'where':{'id':_0x378ba2[_0xdb9c('0x4b')]['id']}})[_0xdb9c('0x2c')](handleEntityNotFound(_0x592a10,null))[_0xdb9c('0x2c')](function(_0x5daac2){if(_0x5daac2){_0x378ba2[_0xdb9c('0x4f')][_0xdb9c('0x60')]=_0x5daac2['id'];return db[_0xdb9c('0x52')][_0xdb9c('0x4e')](_0x378ba2[_0xdb9c('0x4f')]);}})[_0xdb9c('0x2c')](respondWithResult(_0x592a10,null))[_0xdb9c('0x49')](handleError(_0x592a10,null));};exports[_0xdb9c('0x61')]=function(_0x39015d,_0x448bf3,_0x300920){var _0x3a93a4={};var _0x587648={};var _0x240dea;var _0x1d1cd9;return db[_0xdb9c('0x32')]['findOne']({'where':{'id':_0x39015d[_0xdb9c('0x4b')]['id']}})[_0xdb9c('0x2c')](handleEntityNotFound(_0x448bf3,null))[_0xdb9c('0x2c')](function(_0x2f3403){if(_0x2f3403){_0x240dea=_0x2f3403;_0x587648[_0xdb9c('0x36')]=_[_0xdb9c('0x38')](db[_0xdb9c('0x52')][_0xdb9c('0x5b')]);_0x587648[_0xdb9c('0x37')]=_[_0xdb9c('0x38')](_0x39015d[_0xdb9c('0x37')]);_0x587648[_0xdb9c('0x41')]=_[_0xdb9c('0x39')](_0x587648[_0xdb9c('0x36')],_0x587648[_0xdb9c('0x37')]);_0x3a93a4[_0xdb9c('0x3a')]=_[_0xdb9c('0x39')](_0x587648[_0xdb9c('0x36')],qs[_0xdb9c('0x3b')](_0x39015d['query']['fields']));_0x3a93a4['attributes']=_0x3a93a4[_0xdb9c('0x3a')]['length']?_0x3a93a4[_0xdb9c('0x3a')]:_0x587648[_0xdb9c('0x36')];_0x3a93a4[_0xdb9c('0x3e')]=qs[_0xdb9c('0x3f')](_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x3f')]);_0x3a93a4[_0xdb9c('0x40')]=qs[_0xdb9c('0x41')](_[_0xdb9c('0x5c')](_0x39015d['query'],_0x587648[_0xdb9c('0x41')]));if(_0x39015d[_0xdb9c('0x37')]['filter']){_0x3a93a4[_0xdb9c('0x40')]=_['merge'](_0x3a93a4['where'],{'$or':_['map'](_0x3a93a4[_0xdb9c('0x3a')],function(_0x5620d4){var _0x320557={};_0x320557[_0x5620d4]={'$like':'%'+_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x42')]+'%'};return _0x320557;})});}if(_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x62')]){var _0x19ba63=_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x62')][_0xdb9c('0x63')](',');var _0x2a6ce1={};_0x2a6ce1[_0x19ba63[0x0]]={'$gte':moment(_0x19ba63[0x1])[_0xdb9c('0x64')](_0xdb9c('0x65'))};_0x3a93a4['where']=_[_0xdb9c('0x44')](_0x3a93a4[_0xdb9c('0x40')],_0x2a6ce1);}_0x3a93a4=_[_0xdb9c('0x44')]({},_0x3a93a4,_0x39015d['options']);return _0x240dea[_0xdb9c('0x61')](_0x3a93a4);}})[_0xdb9c('0x2c')](function(_0x7e80b4){if(_0x7e80b4){_0x1d1cd9=_0x7e80b4[_0xdb9c('0x3c')];if(!_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x5d')](_0xdb9c('0x3d'))){_0x3a93a4['limit']=qs[_0xdb9c('0x23')](_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x23')]);_0x3a93a4[_0xdb9c('0x21')]=qs[_0xdb9c('0x21')](_0x39015d[_0xdb9c('0x37')][_0xdb9c('0x21')]);}return _0x240dea[_0xdb9c('0x61')](_0x3a93a4);}})[_0xdb9c('0x2c')](function(_0x4936b7){if(_0x4936b7){return _0x4936b7?{'count':_0x1d1cd9,'rows':_0x4936b7}:null;}})['then'](respondWithResult(_0x448bf3,null))['catch'](handleError(_0x448bf3,null));}; \ No newline at end of file +var _0x6189=['count','set','apply','then','error','stack','name','index','map','ChatGroup','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','body','find','params','destroy','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','ChatInternalMessage','create','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x19ab90,_0x23773c){var _0x45b682=function(_0x21ae73){while(--_0x21ae73){_0x19ab90['push'](_0x19ab90['shift']());}};_0x45b682(++_0x23773c);}(_0x6189,0xec));var _0x9618=function(_0x15c59a,_0x3e1c89){_0x15c59a=_0x15c59a-0x0;var _0x5e8b4e=_0x6189[_0x15c59a];return _0x5e8b4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9618('0x0'));var zipdir=require(_0x9618('0x1'));var jsonpatch=require(_0x9618('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9618('0x3'));var Mustache=require('mustache');var util=require(_0x9618('0x4'));var path=require(_0x9618('0x5'));var sox=require(_0x9618('0x6'));var csv=require(_0x9618('0x7'));var ejs=require(_0x9618('0x8'));var fs=require('fs');var fs_extra=require(_0x9618('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9618('0xa'));var jsforce=require(_0x9618('0xb'));var deskjs=require(_0x9618('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9618('0xd'));var Redis=require(_0x9618('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9618('0xf'));var as=require(_0x9618('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9618('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9618('0x12'));var db=require(_0x9618('0x13'))['db'];config[_0x9618('0x14')]=_['defaults'](config['redis'],{'host':_0x9618('0x15'),'port':0x18eb});var socket=require(_0x9618('0x16'))(new Redis(config[_0x9618('0x14')]));require(_0x9618('0x17'))['register'](socket);function respondWithStatusCode(_0x53076e,_0x13d99e){_0x13d99e=_0x13d99e||0xcc;return function(_0x5a9a70){if(_0x5a9a70){return _0x53076e[_0x9618('0x18')](_0x13d99e);}return _0x53076e[_0x9618('0x19')](_0x13d99e)[_0x9618('0x1a')]();};}function respondWithResult(_0x13644c,_0x13a20b){_0x13a20b=_0x13a20b||0xc8;return function(_0xcfdc61){if(_0xcfdc61){return _0x13644c[_0x9618('0x19')](_0x13a20b)[_0x9618('0x1b')](_0xcfdc61);}};}function respondWithFilteredResult(_0x5cfbd8,_0xa607a1){return function(_0x314f2f){if(_0x314f2f){var _0x29b2f1=typeof _0xa607a1[_0x9618('0x1c')]===_0x9618('0x1d')&&typeof _0xa607a1[_0x9618('0x1e')]===_0x9618('0x1d');var _0x4bf6a1=_0x314f2f[_0x9618('0x1f')];var _0x1a1996=_0x29b2f1?0x0:_0xa607a1[_0x9618('0x1c')];var _0x2aac8c=_0x29b2f1?_0x314f2f[_0x9618('0x1f')]:_0xa607a1[_0x9618('0x1c')]+_0xa607a1[_0x9618('0x1e')];var _0x5c0f6b;if(_0x2aac8c>=_0x4bf6a1){_0x2aac8c=_0x4bf6a1;_0x5c0f6b=0xc8;}else{_0x5c0f6b=0xce;}_0x5cfbd8['status'](_0x5c0f6b);return _0x5cfbd8[_0x9618('0x20')]('Content-Range',_0x1a1996+'-'+_0x2aac8c+'/'+_0x4bf6a1)[_0x9618('0x1b')](_0x314f2f);}return null;};}function patchUpdates(_0x2d48f6){return function(_0x2653eb){try{jsonpatch[_0x9618('0x21')](_0x2653eb,_0x2d48f6,!![]);}catch(_0x4ce153){return BPromise['reject'](_0x4ce153);}return _0x2653eb['save']();};}function saveUpdates(_0x348c3a,_0x4c0bfc){return function(_0x2cfbbc){if(_0x2cfbbc){return _0x2cfbbc['update'](_0x348c3a)[_0x9618('0x22')](function(_0x56c52f){return _0x56c52f;});}return null;};}function removeEntity(_0x201cca,_0x5e3d56){return function(_0x4b41a2){if(_0x4b41a2){return _0x4b41a2['destroy']()[_0x9618('0x22')](function(){_0x201cca[_0x9618('0x19')](0xcc)[_0x9618('0x1a')]();});}};}function handleEntityNotFound(_0x13f1b2,_0x335bf7){return function(_0x1d5cbc){if(!_0x1d5cbc){_0x13f1b2[_0x9618('0x18')](0x194);}return _0x1d5cbc;};}function handleError(_0x4b5a8b,_0x238e4a){_0x238e4a=_0x238e4a||0x1f4;return function(_0x8b1ef4){logger[_0x9618('0x23')](_0x8b1ef4[_0x9618('0x24')]);if(_0x8b1ef4[_0x9618('0x25')]){delete _0x8b1ef4[_0x9618('0x25')];}_0x4b5a8b[_0x9618('0x19')](_0x238e4a)['send'](_0x8b1ef4);};}exports[_0x9618('0x26')]=function(_0x405331,_0x793f7e){var _0x14779c={},_0x5c9257={},_0x4d25f6={'count':0x0,'rows':[]};var _0x474caf=_[_0x9618('0x27')](db[_0x9618('0x28')][_0x9618('0x29')],function(_0x4e57f1){return{'name':_0x4e57f1['fieldName'],'type':_0x4e57f1[_0x9618('0x2a')]['key']};});_0x5c9257[_0x9618('0x2b')]=_[_0x9618('0x27')](_0x474caf,_0x9618('0x25'));_0x5c9257[_0x9618('0x2c')]=_[_0x9618('0x2d')](_0x405331[_0x9618('0x2c')]);_0x5c9257[_0x9618('0x2e')]=_[_0x9618('0x2f')](_0x5c9257[_0x9618('0x2b')],_0x5c9257['query']);_0x14779c[_0x9618('0x30')]=_[_0x9618('0x2f')](_0x5c9257['model'],qs[_0x9618('0x31')](_0x405331[_0x9618('0x2c')]['fields']));_0x14779c['attributes']=_0x14779c['attributes'][_0x9618('0x32')]?_0x14779c[_0x9618('0x30')]:_0x5c9257[_0x9618('0x2b')];if(!_0x405331[_0x9618('0x2c')][_0x9618('0x33')](_0x9618('0x34'))){_0x14779c[_0x9618('0x1e')]=qs['limit'](_0x405331[_0x9618('0x2c')][_0x9618('0x1e')]);_0x14779c[_0x9618('0x1c')]=qs['offset'](_0x405331['query'][_0x9618('0x1c')]);}_0x14779c[_0x9618('0x35')]=qs[_0x9618('0x36')](_0x405331['query'][_0x9618('0x36')]);_0x14779c[_0x9618('0x37')]=qs['filters'](_[_0x9618('0x38')](_0x405331[_0x9618('0x2c')],_0x5c9257[_0x9618('0x2e')]),_0x474caf);if(_0x405331[_0x9618('0x2c')][_0x9618('0x39')]){_0x14779c[_0x9618('0x37')]=_['merge'](_0x14779c['where'],{'$or':_[_0x9618('0x27')](_0x474caf,function(_0x1536c2){if(_0x1536c2[_0x9618('0x2a')]!==_0x9618('0x3a')){var _0x355d93={};_0x355d93[_0x1536c2[_0x9618('0x25')]]={'$like':'%'+_0x405331['query'][_0x9618('0x39')]+'%'};return _0x355d93;}})});}_0x14779c=_[_0x9618('0x3b')]({},_0x14779c,_0x405331[_0x9618('0x3c')]);var _0x38b307={'where':_0x14779c[_0x9618('0x37')]};return db[_0x9618('0x28')][_0x9618('0x1f')](_0x38b307)[_0x9618('0x22')](function(_0x4b7c87){_0x4d25f6[_0x9618('0x1f')]=_0x4b7c87;if(_0x405331[_0x9618('0x2c')][_0x9618('0x3d')]){_0x14779c[_0x9618('0x3e')]=[{'all':!![]}];}return db[_0x9618('0x28')][_0x9618('0x3f')](_0x14779c);})[_0x9618('0x22')](function(_0x33ddd4){_0x4d25f6[_0x9618('0x40')]=_0x33ddd4;return _0x4d25f6;})[_0x9618('0x22')](respondWithFilteredResult(_0x793f7e,_0x14779c))['catch'](handleError(_0x793f7e,null));};exports[_0x9618('0x41')]=function(_0x324aa2,_0x4766ca){var _0x573377={'raw':!![],'where':{'id':_0x324aa2['params']['id']}},_0x2cc6c1={};_0x2cc6c1['model']=_['keys'](db['ChatGroup'][_0x9618('0x29')]);_0x2cc6c1[_0x9618('0x2c')]=_[_0x9618('0x2d')](_0x324aa2[_0x9618('0x2c')]);_0x2cc6c1['filters']=_['intersection'](_0x2cc6c1[_0x9618('0x2b')],_0x2cc6c1['query']);_0x573377[_0x9618('0x30')]=_[_0x9618('0x2f')](_0x2cc6c1['model'],qs['fields'](_0x324aa2[_0x9618('0x2c')][_0x9618('0x31')]));_0x573377[_0x9618('0x30')]=_0x573377[_0x9618('0x30')]['length']?_0x573377['attributes']:_0x2cc6c1[_0x9618('0x2b')];if(_0x324aa2[_0x9618('0x2c')][_0x9618('0x3d')]){_0x573377[_0x9618('0x3e')]=[{'all':!![]}];}_0x573377=_[_0x9618('0x3b')]({},_0x573377,_0x324aa2[_0x9618('0x3c')]);return db[_0x9618('0x28')]['find'](_0x573377)[_0x9618('0x22')](handleEntityNotFound(_0x4766ca,null))[_0x9618('0x22')](respondWithResult(_0x4766ca,null))[_0x9618('0x42')](handleError(_0x4766ca,null));};exports['create']=function(_0x55c67f,_0x22dc95){return db[_0x9618('0x28')]['create'](_0x55c67f['body'],{})['then'](respondWithResult(_0x22dc95,0xc9))[_0x9618('0x42')](handleError(_0x22dc95,null));};exports['update']=function(_0x3beef6,_0x2cec85){if(_0x3beef6['body']['id']){delete _0x3beef6[_0x9618('0x43')]['id'];}return db['ChatGroup'][_0x9618('0x44')]({'where':{'id':_0x3beef6[_0x9618('0x45')]['id']}})[_0x9618('0x22')](handleEntityNotFound(_0x2cec85,null))['then'](saveUpdates(_0x3beef6[_0x9618('0x43')],null))['then'](respondWithResult(_0x2cec85,null))[_0x9618('0x42')](handleError(_0x2cec85,null));};exports[_0x9618('0x46')]=function(_0x22812b,_0x8c3277){return db[_0x9618('0x28')]['find']({'where':{'id':_0x22812b[_0x9618('0x45')]['id']}})['then'](handleEntityNotFound(_0x8c3277,null))['then'](removeEntity(_0x8c3277,null))[_0x9618('0x42')](handleError(_0x8c3277,null));};exports['describe']=function(_0x3e5d6f,_0x1feb26){return db[_0x9618('0x28')]['describe']()[_0x9618('0x22')](respondWithResult(_0x1feb26,null))['catch'](handleError(_0x1feb26,null));};exports[_0x9618('0x47')]=function(_0x15b794,_0x451c73,_0x29ef86){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x15b794['params']['id'],'ToId':_0x15b794[_0x9618('0x48')]['id'],'read':![]}})[_0x9618('0x22')](function(_0x326b53){return{'id':_[_0x9618('0x49')](_0x15b794[_0x9618('0x45')]['id']),'count':_0x326b53};})[_0x9618('0x22')](respondWithResult(_0x451c73,null))['catch'](handleError(_0x451c73,null));};exports[_0x9618('0x4a')]=function(_0x5e3e24,_0x47acec,_0x20fa62){return db[_0x9618('0x28')]['find']({'where':{'id':_0x5e3e24['params']['id']}})['then'](handleEntityNotFound(_0x47acec,null))['then'](function(_0x6abe24){if(_0x6abe24){return _0x6abe24[_0x9618('0x4a')](_0x5e3e24[_0x9618('0x43')][_0x9618('0x4b')],_[_0x9618('0x4c')](_0x5e3e24[_0x9618('0x43')],[_0x9618('0x4b'),'id'])||{});}})[_0x9618('0x22')](respondWithResult(_0x47acec,null))[_0x9618('0x42')](handleError(_0x47acec,null));};exports[_0x9618('0x4d')]=function(_0x512d60,_0x4690ec,_0x57f077){var _0x3a440a={};var _0x1259e3={};var _0x497ec7;var _0xd6b7f;return db[_0x9618('0x28')][_0x9618('0x4e')]({'where':{'id':_0x512d60[_0x9618('0x45')]['id']}})['then'](handleEntityNotFound(_0x4690ec,null))[_0x9618('0x22')](function(_0x359569){if(_0x359569){_0x497ec7=_0x359569;_0x1259e3[_0x9618('0x2b')]=_[_0x9618('0x2d')](db[_0x9618('0x4f')][_0x9618('0x29')]);_0x1259e3[_0x9618('0x2c')]=_[_0x9618('0x2d')](_0x512d60[_0x9618('0x2c')]);_0x1259e3[_0x9618('0x2e')]=_[_0x9618('0x2f')](_0x1259e3['model'],_0x1259e3[_0x9618('0x2c')]);_0x3a440a[_0x9618('0x30')]=_[_0x9618('0x2f')](_0x1259e3[_0x9618('0x2b')],qs[_0x9618('0x31')](_0x512d60[_0x9618('0x2c')][_0x9618('0x31')]));_0x3a440a[_0x9618('0x30')]=_0x3a440a[_0x9618('0x30')][_0x9618('0x32')]?_0x3a440a[_0x9618('0x30')]:_0x1259e3[_0x9618('0x2b')];_0x3a440a[_0x9618('0x35')]=qs[_0x9618('0x36')](_0x512d60['query']['sort']);_0x3a440a['where']=qs['filters'](_[_0x9618('0x38')](_0x512d60[_0x9618('0x2c')],_0x1259e3[_0x9618('0x2e')]));if(_0x512d60[_0x9618('0x2c')]['filter']){_0x3a440a[_0x9618('0x37')]=_[_0x9618('0x3b')](_0x3a440a[_0x9618('0x37')],{'$or':_['map'](_0x3a440a[_0x9618('0x30')],function(_0x1eba63){var _0x280672={};_0x280672[_0x1eba63]={'$like':'%'+_0x512d60['query'][_0x9618('0x39')]+'%'};return _0x280672;})});}_0x3a440a=_[_0x9618('0x3b')]({},_0x3a440a,_0x512d60['options']);return _0x497ec7['getMembers'](_0x3a440a);}})['then'](function(_0x9b57d9){if(_0x9b57d9){_0xd6b7f=_0x9b57d9['length'];if(!_0x512d60[_0x9618('0x2c')]['hasOwnProperty'](_0x9618('0x34'))){_0x3a440a[_0x9618('0x1e')]=qs[_0x9618('0x1e')](_0x512d60[_0x9618('0x2c')]['limit']);_0x3a440a[_0x9618('0x1c')]=qs[_0x9618('0x1c')](_0x512d60['query']['offset']);}return _0x497ec7['getMembers'](_0x3a440a);}})[_0x9618('0x22')](function(_0x3e2108){if(_0x3e2108){return _0x3e2108?{'count':_0xd6b7f,'rows':_0x3e2108}:null;}})[_0x9618('0x22')](respondWithResult(_0x4690ec,null))[_0x9618('0x42')](handleError(_0x4690ec,null));};exports[_0x9618('0x50')]=function(_0x1068fd,_0x29d9c5,_0x2e89ca){return db[_0x9618('0x28')][_0x9618('0x44')]({'where':{'id':_0x1068fd[_0x9618('0x45')]['id']}})[_0x9618('0x22')](handleEntityNotFound(_0x29d9c5,null))[_0x9618('0x22')](function(_0x1f02b7){if(_0x1f02b7){return _0x1f02b7[_0x9618('0x50')](_0x1068fd['query'][_0x9618('0x4b')]);}})[_0x9618('0x22')](respondWithStatusCode(_0x29d9c5,null))[_0x9618('0x42')](handleError(_0x29d9c5,null));};exports['addMessage']=function(_0x45afa9,_0x3eff59,_0x21117e){if(_0x45afa9['body']['id']){delete _0x45afa9[_0x9618('0x43')]['id'];}return db[_0x9618('0x28')][_0x9618('0x44')]({'where':{'id':_0x45afa9[_0x9618('0x45')]['id']}})[_0x9618('0x22')](handleEntityNotFound(_0x3eff59,null))[_0x9618('0x22')](function(_0x3823e1){if(_0x3823e1){_0x45afa9[_0x9618('0x43')][_0x9618('0x51')]=_0x3823e1['id'];return db[_0x9618('0x52')][_0x9618('0x53')](_0x45afa9[_0x9618('0x43')]);}})[_0x9618('0x22')](respondWithResult(_0x3eff59,null))[_0x9618('0x42')](handleError(_0x3eff59,null));};exports[_0x9618('0x54')]=function(_0x3e398a,_0x19efdf,_0x21d94a){var _0x722a57={};var _0x2459db={};var _0x5461bc;var _0x3d515f;return db[_0x9618('0x28')][_0x9618('0x4e')]({'where':{'id':_0x3e398a[_0x9618('0x45')]['id']}})[_0x9618('0x22')](handleEntityNotFound(_0x19efdf,null))['then'](function(_0xabc8bb){if(_0xabc8bb){_0x5461bc=_0xabc8bb;_0x2459db[_0x9618('0x2b')]=_[_0x9618('0x2d')](db['ChatInternalMessage'][_0x9618('0x29')]);_0x2459db[_0x9618('0x2c')]=_[_0x9618('0x2d')](_0x3e398a[_0x9618('0x2c')]);_0x2459db[_0x9618('0x2e')]=_[_0x9618('0x2f')](_0x2459db[_0x9618('0x2b')],_0x2459db[_0x9618('0x2c')]);_0x722a57[_0x9618('0x30')]=_[_0x9618('0x2f')](_0x2459db[_0x9618('0x2b')],qs[_0x9618('0x31')](_0x3e398a[_0x9618('0x2c')][_0x9618('0x31')]));_0x722a57['attributes']=_0x722a57[_0x9618('0x30')][_0x9618('0x32')]?_0x722a57[_0x9618('0x30')]:_0x2459db[_0x9618('0x2b')];_0x722a57[_0x9618('0x35')]=qs['sort'](_0x3e398a[_0x9618('0x2c')]['sort']);_0x722a57['where']=qs[_0x9618('0x2e')](_[_0x9618('0x38')](_0x3e398a[_0x9618('0x2c')],_0x2459db[_0x9618('0x2e')]));if(_0x3e398a['query'][_0x9618('0x39')]){_0x722a57[_0x9618('0x37')]=_[_0x9618('0x3b')](_0x722a57[_0x9618('0x37')],{'$or':_[_0x9618('0x27')](_0x722a57[_0x9618('0x30')],function(_0x54badb){var _0xce00e1={};_0xce00e1[_0x54badb]={'$like':'%'+_0x3e398a['query']['filter']+'%'};return _0xce00e1;})});}if(_0x3e398a[_0x9618('0x2c')][_0x9618('0x55')]){var _0x328777=_0x3e398a[_0x9618('0x2c')][_0x9618('0x55')][_0x9618('0x56')](',');var _0x1ba786={};_0x1ba786[_0x328777[0x0]]={'$gte':moment(_0x328777[0x1])[_0x9618('0x57')](_0x9618('0x58'))};_0x722a57[_0x9618('0x37')]=_[_0x9618('0x3b')](_0x722a57[_0x9618('0x37')],_0x1ba786);}_0x722a57=_[_0x9618('0x3b')]({},_0x722a57,_0x3e398a[_0x9618('0x3c')]);return _0x5461bc['getMessages'](_0x722a57);}})[_0x9618('0x22')](function(_0x4a584b){if(_0x4a584b){_0x3d515f=_0x4a584b[_0x9618('0x32')];if(!_0x3e398a[_0x9618('0x2c')][_0x9618('0x33')](_0x9618('0x34'))){_0x722a57[_0x9618('0x1e')]=qs[_0x9618('0x1e')](_0x3e398a['query'][_0x9618('0x1e')]);_0x722a57[_0x9618('0x1c')]=qs['offset'](_0x3e398a[_0x9618('0x2c')][_0x9618('0x1c')]);}return _0x5461bc['getMessages'](_0x722a57);}})[_0x9618('0x22')](function(_0x53c653){if(_0x53c653){return _0x53c653?{'count':_0x3d515f,'rows':_0x53c653}:null;}})[_0x9618('0x22')](respondWithResult(_0x19efdf,null))[_0x9618('0x42')](handleError(_0x19efdf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 312300f..1ac7449 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 _0xd08d=['hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd08d,0x81));var _0xdd08=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xd08d[_0x2e2681];return _0x368a64;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xdd08('0x0'))['db'][_0xdd08('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdd08('0x2'),'afterUpdate':_0xdd08('0x3'),'afterDestroy':_0xdd08('0x4')};function emitEvent(_0x521652){return function(_0x12efba,_0x5c7eda,_0x3c2175){ChatGroupEvents['emit'](_0x521652+':'+_0x12efba['id'],_0x12efba);ChatGroupEvents[_0xdd08('0x5')](_0x521652,_0x12efba);_0x3c2175(null);};}for(var e in events){if(events[_0xdd08('0x6')](e)){var event=events[e];ChatGroup[_0xdd08('0x7')](e,emitEvent(event));}}module[_0xdd08('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x9341=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x3ef8a9,_0x59a7c2){var _0x424f63=function(_0x7c1873){while(--_0x7c1873){_0x3ef8a9['push'](_0x3ef8a9['shift']());}};_0x424f63(++_0x59a7c2);}(_0x9341,0xff));var _0x1934=function(_0x2e4da7,_0x27958b){_0x2e4da7=_0x2e4da7-0x0;var _0x4f7a14=_0x9341[_0x2e4da7];return _0x4f7a14;};'use strict';var EventEmitter=require(_0x1934('0x0'));var ChatGroup=require(_0x1934('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1934('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1934('0x3'),'afterDestroy':_0x1934('0x4')};function emitEvent(_0x32935b){return function(_0x19f4ef,_0x26f28b,_0xa5db53){ChatGroupEvents[_0x1934('0x5')](_0x32935b+':'+_0x19f4ef['id'],_0x19f4ef);ChatGroupEvents[_0x1934('0x5')](_0x32935b,_0x19f4ef);_0xa5db53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x1934('0x6')](e,emitEvent(event));}}module[_0x1934('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6a5e74d..3e9bdca 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 _0x85aa=['bluebird','path','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x85aa,0x18c));var _0xa85a=function(_0x3fe0fd,_0x5c6efb){_0x3fe0fd=_0x3fe0fd-0x0;var _0x2725b1=_0x85aa[_0x3fe0fd];return _0x2725b1;};'use strict';var _=require(_0xa85a('0x0'));var util=require(_0xa85a('0x1'));var logger=require(_0xa85a('0x2'))('api');var moment=require(_0xa85a('0x3'));var BPromise=require(_0xa85a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa85a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa85a('0x6'));module['exports']=function(_0x5ec48d,_0x3286cf){return _0x5ec48d[_0xa85a('0x7')](_0xa85a('0x8'),attributes,{'tableName':_0xa85a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd1a=['api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xdd1a,0x1c5));var _0xadd1=function(_0x37d53b,_0x2b76e3){_0x37d53b=_0x37d53b-0x0;var _0x4d4c8d=_0xdd1a[_0x37d53b];return _0x4d4c8d;};'use strict';var _=require(_0xadd1('0x0'));var util=require(_0xadd1('0x1'));var logger=require(_0xadd1('0x2'))(_0xadd1('0x3'));var moment=require('moment');var BPromise=require(_0xadd1('0x4'));var rp=require(_0xadd1('0x5'));var fs=require('fs');var path=require(_0xadd1('0x6'));var rimraf=require(_0xadd1('0x7'));var config=require('../../config/environment');var attributes=require(_0xadd1('0x8'));module['exports']=function(_0x30ebb4,_0x26649e){return _0x30ebb4[_0xadd1('0x9')](_0xadd1('0xa'),attributes,{'tableName':_0xadd1('0xb'),'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 139ac20..51e15c1 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 _0x6aa7=['client','redis','defaults','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1c4716,_0x1157ed){var _0x11440d=function(_0x28ada0){while(--_0x28ada0){_0x1c4716['push'](_0x1c4716['shift']());}};_0x11440d(++_0x1157ed);}(_0x6aa7,0x178));var _0x76aa=function(_0x116a6a,_0x3e3745){_0x116a6a=_0x116a6a-0x0;var _0x3af9b4=_0x6aa7[_0x116a6a];return _0x3af9b4;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});} \ No newline at end of file +var _0x62c8=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x2bd6fd,_0x296b2f){var _0x448ff7=function(_0x216dbb){while(--_0x216dbb){_0x2bd6fd['push'](_0x2bd6fd['shift']());}};_0x448ff7(++_0x296b2f);}(_0x62c8,0x1ad));var _0x862c=function(_0x19d0b3,_0x3a1c83){_0x19d0b3=_0x19d0b3-0x0;var _0x321228=_0x62c8[_0x19d0b3];return _0x321228;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x862c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x862c('0x1'));var db=require(_0x862c('0x2'))['db'];var utils=require(_0x862c('0x3'));var logger=require(_0x862c('0x4'))(_0x862c('0x5'));var config=require(_0x862c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x862c('0x7')][_0x862c('0x8')]({'port':0x232a});config[_0x862c('0x9')]=_[_0x862c('0xa')](config[_0x862c('0x9')],{'host':_0x862c('0xb'),'port':0x18eb});var socket=require(_0x862c('0xc'))(new Redis(config[_0x862c('0x9')]));require(_0x862c('0xd'))[_0x862c('0xe')](socket);function respondWithRpcPromise(_0x355d4f,_0x52ec01,_0x602913){return new BPromise(function(_0x38eac3,_0xaca82b){return client[_0x862c('0xf')](_0x355d4f,_0x602913)[_0x862c('0x10')](function(_0x5cf76c){logger[_0x862c('0x11')](_0x862c('0x12'),_0x52ec01,_0x862c('0x13'));logger[_0x862c('0x14')](_0x862c('0x15'),_0x52ec01,_0x862c('0x13'),JSON[_0x862c('0x16')](_0x5cf76c));if(_0x5cf76c[_0x862c('0x17')]){if(_0x5cf76c[_0x862c('0x17')][_0x862c('0x18')]===0x1f4){logger[_0x862c('0x17')](_0x862c('0x12'),_0x52ec01,_0x5cf76c[_0x862c('0x17')][_0x862c('0x19')]);return _0xaca82b(_0x5cf76c[_0x862c('0x17')]['message']);}logger[_0x862c('0x17')]('ChatGroup,\x20%s,\x20%s',_0x52ec01,_0x5cf76c['error'][_0x862c('0x19')]);return _0x38eac3(_0x5cf76c['error'][_0x862c('0x19')]);}else{logger[_0x862c('0x11')](_0x862c('0x12'),_0x52ec01,_0x862c('0x13'));_0x38eac3(_0x5cf76c[_0x862c('0x1a')][_0x862c('0x19')]);}})[_0x862c('0x1b')](function(_0x34e930){logger[_0x862c('0x17')](_0x862c('0x12'),_0x52ec01,_0x34e930);_0xaca82b(_0x34e930);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2ba01b8..6cd93f7 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 _0x6d3e=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0x6d3e,0x77));var _0xe6d3=function(_0x368806,_0x56fb58){_0x368806=_0x368806-0x0;var _0x583624=_0x6d3e[_0x368806];return _0x583624;};'use strict';var ChatGroupEvents=require(_0xe6d3('0x0'));var events=[_0xe6d3('0x1'),_0xe6d3('0x2'),_0xe6d3('0x3')];function createListener(_0x17ba4d,_0x1087ba){return function(_0x5f187f){_0x1087ba[_0xe6d3('0x4')](_0x17ba4d,_0x5f187f);};}function removeListener(_0x74bf15,_0x3b4965){return function(){ChatGroupEvents[_0xe6d3('0x5')](_0x74bf15,_0x3b4965);};}exports[_0xe6d3('0x6')]=function(_0x446e78){for(var _0x2c2cbf=0x0,_0x3ade98=events[_0xe6d3('0x7')];_0x2c2cbf<_0x3ade98;_0x2c2cbf++){var _0x551e7e=events[_0x2c2cbf];var _0x16d397=createListener(_0xe6d3('0x8')+_0x551e7e,_0x446e78);ChatGroupEvents['on'](_0x551e7e,_0x16d397);}}; \ No newline at end of file +var _0x34c8=['emit','removeListener','chatGroup:','./chatGroup.events','remove'];(function(_0x4a6c4d,_0x455768){var _0x31800b=function(_0x203513){while(--_0x203513){_0x4a6c4d['push'](_0x4a6c4d['shift']());}};_0x31800b(++_0x455768);}(_0x34c8,0xa3));var _0x834c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x34c8[_0x4e676e];return _0x336a3c;};'use strict';var ChatGroupEvents=require(_0x834c('0x0'));var events=['save',_0x834c('0x1'),'update'];function createListener(_0x2addba,_0x7ab27d){return function(_0x56b2bd){_0x7ab27d[_0x834c('0x2')](_0x2addba,_0x56b2bd);};}function removeListener(_0x198818,_0x388562){return function(){ChatGroupEvents[_0x834c('0x3')](_0x198818,_0x388562);};}exports['register']=function(_0x2a85f){for(var _0x4929f6=0x0,_0x25102f=events['length'];_0x4929f6<_0x25102f;_0x4929f6++){var _0x5e2910=events[_0x4929f6];var _0xea0550=createListener(_0x834c('0x4')+_0x5e2910,_0x2a85f);ChatGroupEvents['on'](_0x5e2910,_0xea0550);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e783f3d..f656808 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 _0x7dab=['./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','/:id/members','removeMembers','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7dab,0x8e));var _0xb7da=function(_0x40114a,_0x2eb3b9){_0x40114a=_0x40114a-0x0;var _0x223f04=_0x7dab[_0x40114a];return _0x223f04;};'use strict';var multer=require(_0xb7da('0x0'));var util=require(_0xb7da('0x1'));var path=require(_0xb7da('0x2'));var timeout=require(_0xb7da('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb7da('0x4'));var auth=require(_0xb7da('0x5'));var interaction=require(_0xb7da('0x6'));var config=require(_0xb7da('0x7'));var controller=require(_0xb7da('0x8'));router[_0xb7da('0x9')]('/',auth[_0xb7da('0xa')](),controller[_0xb7da('0xb')]);router['get'](_0xb7da('0xc'),auth['isAuthenticated'](),controller[_0xb7da('0xd')]);router[_0xb7da('0x9')](_0xb7da('0xe'),auth[_0xb7da('0xa')](),controller['show']);router[_0xb7da('0x9')](_0xb7da('0xf'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x10')]);router[_0xb7da('0x9')]('/:id/members',auth[_0xb7da('0xa')](),controller[_0xb7da('0x11')]);router[_0xb7da('0x9')](_0xb7da('0x12'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x13')]);router[_0xb7da('0x14')]('/',auth[_0xb7da('0xa')](),controller[_0xb7da('0x15')]);router[_0xb7da('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xb7da('0x16')]);router[_0xb7da('0x14')]('/:id/messages',auth[_0xb7da('0xa')](),controller[_0xb7da('0x17')]);router['put'](_0xb7da('0xe'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x18')]);router[_0xb7da('0x19')](_0xb7da('0xe'),auth['isAuthenticated'](),controller[_0xb7da('0x1a')]);router['delete'](_0xb7da('0x1b'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x1c')]);module[_0xb7da('0x1d')]=router; \ No newline at end of file +var _0x05f9=['./chatGroup.controller','get','isAuthenticated','index','/:id','/:id/unread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','express','../../components/auth/service','../../config/environment'];(function(_0x2f813a,_0x362815){var _0x53f830=function(_0xbcaa21){while(--_0xbcaa21){_0x2f813a['push'](_0x2f813a['shift']());}};_0x53f830(++_0x362815);}(_0x05f9,0x73));var _0x905f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x05f9[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x905f('0x0'));var util=require(_0x905f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x905f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x905f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x905f('0x4'));var controller=require(_0x905f('0x5'));router[_0x905f('0x6')]('/',auth[_0x905f('0x7')](),controller[_0x905f('0x8')]);router[_0x905f('0x6')]('/describe',auth[_0x905f('0x7')](),controller['describe']);router[_0x905f('0x6')](_0x905f('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x905f('0xa'),auth[_0x905f('0x7')](),controller['getUnread']);router[_0x905f('0x6')]('/:id/members',auth[_0x905f('0x7')](),controller[_0x905f('0xb')]);router['get'](_0x905f('0xc'),auth[_0x905f('0x7')](),controller[_0x905f('0xd')]);router[_0x905f('0xe')]('/',auth[_0x905f('0x7')](),controller[_0x905f('0xf')]);router['post'](_0x905f('0x10'),auth[_0x905f('0x7')](),controller[_0x905f('0x11')]);router['post'](_0x905f('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x905f('0x12')]('/:id',auth[_0x905f('0x7')](),controller[_0x905f('0x13')]);router[_0x905f('0x14')](_0x905f('0x9'),auth['isAuthenticated'](),controller[_0x905f('0x15')]);router['delete']('/:id/members',auth[_0x905f('0x7')](),controller[_0x905f('0x16')]);module[_0x905f('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 07453db..26c0f24 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 _0x6cb4=['star','thumb','TEXT','STRING','DATE','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x77ec,_0x1aa9ab){var _0x4f2ab0=function(_0x4c9bb8){while(--_0x4c9bb8){_0x77ec['push'](_0x77ec['shift']());}};_0x4f2ab0(++_0x1aa9ab);}(_0x6cb4,0xff));var _0x46cb=function(_0x3d28a2,_0x4cb2b0){_0x3d28a2=_0x3d28a2-0x0;var _0x155b3d=_0x6cb4[_0x3d28a2];return _0x155b3d;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'closed':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x46cb('0x3')]},'ratingType':{'type':Sequelize[_0x46cb('0x4')](_0x46cb('0x5'),_0x46cb('0x6')),'defaultValue':_0x46cb('0x5')},'ratingMessage':{'type':Sequelize[_0x46cb('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x46cb('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x46cb('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x46cb('0x8')]},'note':{'type':Sequelize[_0x46cb('0x8')]},'browserName':{'type':Sequelize[_0x46cb('0x8')]},'browserVersion':{'type':Sequelize[_0x46cb('0x8')]},'osName':{'type':Sequelize[_0x46cb('0x8')]},'osVersion':{'type':Sequelize[_0x46cb('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x46cb('0x8')]},'deviceType':{'type':Sequelize[_0x46cb('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x46cb('0x8')]},'formData':{'type':Sequelize[_0x46cb('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x46cb('0x9')]},'lastMsgAt':{'type':Sequelize[_0x46cb('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x46cb('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x46cb('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb688=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','exports','BOOLEAN'];(function(_0xa650d8,_0x6d01ef){var _0x79ce97=function(_0x5ee62b){while(--_0x5ee62b){_0xa650d8['push'](_0xa650d8['shift']());}};_0x79ce97(++_0x6d01ef);}(_0xb688,0xcf));var _0x8b68=function(_0xa049a8,_0x40d684){_0xa049a8=_0xa049a8-0x0;var _0x582917=_0xb688[_0xa049a8];return _0x582917;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'closed':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8b68('0x2')]},'ratingType':{'type':Sequelize[_0x8b68('0x3')](_0x8b68('0x4'),_0x8b68('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8b68('0x6')]},'pathTranscript':{'type':Sequelize[_0x8b68('0x6')]},'mailTranscript':{'type':Sequelize[_0x8b68('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8b68('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8b68('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8b68('0x7')]},'browserName':{'type':Sequelize[_0x8b68('0x7')]},'browserVersion':{'type':Sequelize[_0x8b68('0x7')]},'osName':{'type':Sequelize[_0x8b68('0x7')]},'osVersion':{'type':Sequelize[_0x8b68('0x7')]},'deviceModel':{'type':Sequelize[_0x8b68('0x7')]},'deviceVendor':{'type':Sequelize[_0x8b68('0x7')]},'deviceType':{'type':Sequelize[_0x8b68('0x7')]},'referer':{'type':Sequelize[_0x8b68('0x6')]},'customerIp':{'type':Sequelize[_0x8b68('0x7')]},'formData':{'type':Sequelize[_0x8b68('0x6')](_0x8b68('0x9'))},'read1stAt':{'type':Sequelize[_0x8b68('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8b68('0x3')]('in',_0x8b68('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8b68('0x7')]},'customerPort':{'type':Sequelize[_0x8b68('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x8b68('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5258990..7d319f1 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 _0xd3b2=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','nolimit','includeAgent','push','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','createdAt','direction','read','Account','Owner','get','mkdirSync','Chat','toString','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','localhost','./chatInteraction.socket','register','jayson/promise','client','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','getOptions','chat','query','user','show','params','model','keys','ChatInteraction','filters','intersection','fields','attributes','length','includeAll','include','options','create','find','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','vidaooMetadata','parse','metadata','ValidationError','Sequelize','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','hasOwnProperty','order','sort','where','pick','filter','$gte','split'];(function(_0x236ff2,_0x522765){var _0x109f1d=function(_0x510f80){while(--_0x510f80){_0x236ff2['push'](_0x236ff2['shift']());}};_0x109f1d(++_0x522765);}(_0xd3b2,0x101));var _0x2d3b=function(_0x3baace,_0x549e97){_0x3baace=_0x3baace-0x0;var _0x5de4eb=_0xd3b2[_0x3baace];return _0x5de4eb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x2d3b('0x0'));var rp=require('request-promise');var moment=require(_0x2d3b('0x1'));var BPromise=require(_0x2d3b('0x2'));var Mustache=require(_0x2d3b('0x3'));var util=require(_0x2d3b('0x4'));var path=require(_0x2d3b('0x5'));var ejs=require(_0x2d3b('0x6'));var fs=require('fs');var _=require(_0x2d3b('0x7'));var Redis=require('ioredis');var interaction=require(_0x2d3b('0x8'));var qs=require(_0x2d3b('0x9'));var pdf=require(_0x2d3b('0xa'));var logger=require(_0x2d3b('0xb'))(_0x2d3b('0xc'));var config=require(_0x2d3b('0xd'));var db=require(_0x2d3b('0xe'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x2d3b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2d3b('0x10'))[_0x2d3b('0x11')](socket);var jayson=require(_0x2d3b('0x12'));var client=jayson[_0x2d3b('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x2d3b('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x7fb65a,_0xe6c084,_0x299d34,_0x4c1841){return new BPromise(function(_0x330f7e,_0x1a9a9e){var _0xcc6ef0=_0x4c1841||client;return _0xcc6ef0[_0x2d3b('0x14')](_0x7fb65a,_0x299d34)['then'](function(_0x3e1ecb){logger[_0x2d3b('0x15')](_0x2d3b('0x16'),_0xe6c084,'request\x20sent');logger[_0x2d3b('0x17')](_0x2d3b('0x18'),_0xe6c084,_0x2d3b('0x19'),JSON['stringify'](_0x3e1ecb));if(_0x3e1ecb[_0x2d3b('0x1a')]){if(_0x3e1ecb[_0x2d3b('0x1a')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xe6c084,_0x3e1ecb[_0x2d3b('0x1a')]['message']);return _0x1a9a9e(_0x3e1ecb[_0x2d3b('0x1a')]['message']);}logger[_0x2d3b('0x1a')](_0x2d3b('0x16'),_0xe6c084,_0x3e1ecb[_0x2d3b('0x1a')]['message']);return _0x330f7e(_0x3e1ecb['error'][_0x2d3b('0x1b')]);}else{logger[_0x2d3b('0x15')](_0x2d3b('0x16'),_0xe6c084,_0x2d3b('0x19'));_0x330f7e(_0x3e1ecb['result'][_0x2d3b('0x1b')]);}})[_0x2d3b('0x1c')](function(_0x4b3f01){logger[_0x2d3b('0x1a')](_0x2d3b('0x16'),_0xe6c084,_0x4b3f01);_0x1a9a9e(_0x4b3f01);});});}function respondWithStatusCode(_0x500031,_0x181dda){_0x181dda=_0x181dda||0xcc;return function(_0x6c0b73){if(_0x6c0b73){return _0x500031[_0x2d3b('0x1d')](_0x181dda);}return _0x500031[_0x2d3b('0x1e')](_0x181dda)[_0x2d3b('0x1f')]();};}function respondWithResult(_0x56a36a,_0x470b93){_0x470b93=_0x470b93||0xc8;return function(_0x263004){if(_0x263004){return _0x56a36a['status'](_0x470b93)[_0x2d3b('0x20')](_0x263004);}};}function respondWithFilteredResult(_0x40a5ed,_0x4f5fc2){return function(_0x56d73b){if(_0x56d73b){var _0x278f20=typeof _0x4f5fc2[_0x2d3b('0x21')]===_0x2d3b('0x22')&&typeof _0x4f5fc2[_0x2d3b('0x23')]===_0x2d3b('0x22');var _0x42904e=_0x56d73b[_0x2d3b('0x24')];var _0xc3a35d=_0x278f20?0x0:_0x4f5fc2[_0x2d3b('0x21')];var _0x32755f=_0x278f20?_0x56d73b[_0x2d3b('0x24')]:_0x4f5fc2[_0x2d3b('0x21')]+_0x4f5fc2['limit'];var _0x4480c3;if(_0x32755f>=_0x42904e){_0x32755f=_0x42904e;_0x4480c3=0xc8;}else{_0x4480c3=0xce;}_0x40a5ed[_0x2d3b('0x1e')](_0x4480c3);return _0x40a5ed[_0x2d3b('0x25')](_0x2d3b('0x26'),_0xc3a35d+'-'+_0x32755f+'/'+_0x42904e)[_0x2d3b('0x20')](_0x56d73b);}return null;};}function saveUpdates(_0x164088){return function(_0x204ad2){if(_0x204ad2){return _0x204ad2['update'](_0x164088)[_0x2d3b('0x27')](function(_0x4a7762){return _0x4a7762;});}return null;};}function removeEntity(_0x198cb2){return function(_0x5fd27f){if(_0x5fd27f){return _0x5fd27f[_0x2d3b('0x28')]()[_0x2d3b('0x27')](function(){_0x198cb2[_0x2d3b('0x1e')](0xcc)[_0x2d3b('0x1f')]();});}};}function handleEntityNotFound(_0xe0690d){return function(_0x108beb){if(!_0x108beb){_0xe0690d[_0x2d3b('0x1d')](0x194);}return _0x108beb;};}function handleError(_0xf881e1,_0x32d091){_0x32d091=_0x32d091||0x1f4;return function(_0x24ae5c){logger['error'](_0x24ae5c[_0x2d3b('0x29')]);if(_0x24ae5c[_0x2d3b('0x2a')]){delete _0x24ae5c['name'];}_0xf881e1[_0x2d3b('0x1e')](_0x32d091)[_0x2d3b('0x2b')](_0x24ae5c);};}function getMustacheRender(_0x5874e2,_0x280986){return Mustache[_0x2d3b('0x2c')](_0x5874e2,_[_0x2d3b('0x2d')](_0x280986[_0x2d3b('0x2e')],{'contact':_0x280986[_0x2d3b('0x2f')],'message':_0x280986[_0x2d3b('0x1b')],'agent':_0x280986[_0x2d3b('0x30')],'interaction':_0x280986[_0x2d3b('0x31')],'account':_0x280986[_0x2d3b('0x32')]}))||'';}exports[_0x2d3b('0x33')]=function(_0x40c4b9,_0x32fac9){var _0x4daaf7={};var _0x245283=_[_0x2d3b('0x34')](db['ChatInteraction'][_0x2d3b('0x35')],function(_0x3e63a7){return{'name':_0x3e63a7[_0x2d3b('0x36')],'type':_0x3e63a7[_0x2d3b('0x37')]['key']};});_0x4daaf7=qs[_0x2d3b('0x38')](_0x245283,_0x40c4b9);return interaction['findAll'](_0x2d3b('0x39'),_0x40c4b9[_0x2d3b('0x3a')],_0x40c4b9[_0x2d3b('0x3b')],_0x4daaf7,_0x245283)[_0x2d3b('0x27')](respondWithFilteredResult(_0x32fac9,_0x4daaf7))[_0x2d3b('0x1c')](handleError(_0x32fac9,null));};exports[_0x2d3b('0x3c')]=function(_0x36cf3e,_0x46b2ed){var _0x27c46d={'raw':![],'where':{'id':_0x36cf3e[_0x2d3b('0x3d')]['id']}},_0x127757={};_0x127757[_0x2d3b('0x3e')]=_[_0x2d3b('0x3f')](db[_0x2d3b('0x40')][_0x2d3b('0x35')]);_0x127757['query']=_[_0x2d3b('0x3f')](_0x36cf3e[_0x2d3b('0x3a')]);_0x127757[_0x2d3b('0x41')]=_[_0x2d3b('0x42')](_0x127757[_0x2d3b('0x3e')],_0x127757[_0x2d3b('0x3a')]);_0x27c46d['attributes']=_[_0x2d3b('0x42')](_0x127757[_0x2d3b('0x3e')],qs['fields'](_0x36cf3e['query'][_0x2d3b('0x43')]));_0x27c46d[_0x2d3b('0x44')]=_0x27c46d[_0x2d3b('0x44')][_0x2d3b('0x45')]?_0x27c46d[_0x2d3b('0x44')]:_0x127757[_0x2d3b('0x3e')];if(_0x36cf3e[_0x2d3b('0x3a')][_0x2d3b('0x46')]){_0x27c46d[_0x2d3b('0x47')]=[{'all':!![]}];}_0x27c46d=_[_0x2d3b('0x2d')]({},_0x27c46d,_0x36cf3e[_0x2d3b('0x48')]);return db[_0x2d3b('0x40')]['find'](_0x27c46d)['then'](handleEntityNotFound(_0x46b2ed,null))[_0x2d3b('0x27')](respondWithResult(_0x46b2ed,null))[_0x2d3b('0x1c')](handleError(_0x46b2ed,null));};exports[_0x2d3b('0x49')]=function(_0x5dca86,_0x47ffc2){return db[_0x2d3b('0x40')][_0x2d3b('0x49')](_0x5dca86['body'],{})[_0x2d3b('0x27')](respondWithResult(_0x47ffc2,0xc9))[_0x2d3b('0x1c')](handleError(_0x47ffc2,null));};exports['update']=function(_0x167be5,_0x46fa37){if(_0x167be5['body']['id']){delete _0x167be5[_0x2d3b('0x2e')]['id'];}return db[_0x2d3b('0x40')][_0x2d3b('0x4a')]({'where':{'id':_0x167be5[_0x2d3b('0x3d')]['id']}})[_0x2d3b('0x27')](handleEntityNotFound(_0x46fa37,null))[_0x2d3b('0x27')](saveUpdates(_0x167be5[_0x2d3b('0x2e')],null))[_0x2d3b('0x27')](respondWithResult(_0x46fa37,null))['catch'](handleError(_0x46fa37,null));};exports['destroy']=function(_0x4e9295,_0x26094c){return db['ChatInteraction'][_0x2d3b('0x4a')]({'where':{'id':_0x4e9295[_0x2d3b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x26094c,null))[_0x2d3b('0x27')](removeEntity(_0x26094c,null))[_0x2d3b('0x1c')](handleError(_0x26094c,null));};exports['describe']=function(_0x2fccf6,_0x30aea4){return db[_0x2d3b('0x40')][_0x2d3b('0x4b')]()[_0x2d3b('0x27')](respondWithResult(_0x30aea4,null))[_0x2d3b('0x1c')](handleError(_0x30aea4,null));};exports['createVidaooSession']=function(_0x4a35d1,_0x3eaa4d){var _0x107e90=_0x4a35d1[_0x2d3b('0x3d')]['id'];var _0x2e81c0;var _0x56cf91;var _0x413e1f;return db[_0x2d3b('0x40')]['findOne']({'where':{'id':_0x107e90}})[_0x2d3b('0x27')](function(_0x5779ed){_0x2e81c0=_0x5779ed;return db[_0x2d3b('0x4c')][_0x2d3b('0x4d')]({'where':{'id':_0x5779ed['ChatWebsiteId']},'attributes':['id',_0x2d3b('0x4e'),'vidaooEscalation',_0x2d3b('0x4f'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x2d3b('0x27')](function(_0x67d09d){if(_0x67d09d&&_0x67d09d[_0x2d3b('0x4e')]&&_0x67d09d['vidaooEscalation']){_0x56cf91=_0x67d09d;var _0x20ac55={'interaction':{'id':_0x107e90},'agent':{'id':_0x4a35d1[_0x2d3b('0x3b')]['id'],'name':_0x4a35d1[_0x2d3b('0x3b')]['name'],'fullname':_0x4a35d1['user'][_0x2d3b('0x50')],'email':_0x4a35d1[_0x2d3b('0x3b')][_0x2d3b('0x51')]},'contact':_0x4a35d1[_0x2d3b('0x2e')][_0x2d3b('0x2f')],'account':_0x4a35d1[_0x2d3b('0x2e')][_0x2d3b('0x32')]};var _0x2b79bc={'rejectUnauthorized':![],'method':_0x2d3b('0x52'),'url':_0x2d3b('0x53'),'headers':{'X-APIKEY':_0x67d09d[_0x2d3b('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4a35d1[_0x2d3b('0x3b')][_0x2d3b('0x51')]],'buttons':null,'topic':_0x56cf91[_0x2d3b('0x4f')],'note':_['isNull'](_0x56cf91[_0x2d3b('0x54')])?null:getMustacheRender(_0x56cf91[_0x2d3b('0x54')],_0x20ac55),'metadata':null},'redirect':_0x2d3b('0x55'),'json':!![]};try{if(!_[_0x2d3b('0x56')](_0x56cf91[_0x2d3b('0x57')])){var _0x3fde41=getMustacheRender(_0x56cf91['vidaooMetadata'],_0x20ac55);var _0x3478d8=JSON[_0x2d3b('0x58')](_0x3fde41);_0x2b79bc[_0x2d3b('0x2e')][_0x2d3b('0x59')]=_0x3478d8;}}catch(_0x5d18d4){throw new db['Sequelize'][(_0x2d3b('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b79bc);}else{throw new db[(_0x2d3b('0x5b'))][(_0x2d3b('0x5a'))](_0x2d3b('0x5c'));}})[_0x2d3b('0x27')](function(_0x22f0e7){_0x413e1f=_0x22f0e7;if(_0x413e1f['id']){var _0x53fe1f={'body':_0x413e1f['join_url'],'ChatWebsiteId':_0x56cf91['id'],'ChatInteractionId':_0x2e81c0['id'],'direction':'out','UserId':_0x4a35d1[_0x2d3b('0x3b')]['id']};return db[_0x2d3b('0x5d')]['create'](_0x53fe1f,{});}else{throw new db[(_0x2d3b('0x5b'))]['ValidationError'](_0x2d3b('0x5e'));}})[_0x2d3b('0x27')](function(){return _0x2e81c0[_0x2d3b('0x5f')]({'vidaooSessionId':_0x413e1f['id']});})['then'](respondWithResult(_0x3eaa4d,null))[_0x2d3b('0x1c')](handleError(_0x3eaa4d,null));};exports[_0x2d3b('0x60')]=function(_0x576508,_0x10ec6a){if(_0x576508['body']['id']){delete _0x576508[_0x2d3b('0x2e')]['id'];}return db[_0x2d3b('0x40')][_0x2d3b('0x4a')]({'where':{'id':_0x576508[_0x2d3b('0x3d')]['id']},'include':[{'model':db[_0x2d3b('0x61')],'as':_0x2d3b('0x62')}]})[_0x2d3b('0x27')](handleEntityNotFound(_0x10ec6a,null))['then'](saveUpdates(_0x576508['body'],null))['then'](respondWithResult(_0x10ec6a,null))[_0x2d3b('0x1c')](handleError(_0x10ec6a,null));};exports[_0x2d3b('0x63')]=function(_0x24b570,_0x1dab34){if(_0x24b570[_0x2d3b('0x2e')]['id']){delete _0x24b570['body']['id'];}return db[_0x2d3b('0x40')]['find']({'where':{'id':_0x24b570[_0x2d3b('0x3d')]['id']}})[_0x2d3b('0x27')](function(_0x3c67a5){if(!_0x3c67a5){logger[_0x2d3b('0x1a')](_0x2d3b('0x64'),_0x2d3b('0x63'),0x194,_0x2d3b('0x65'));_0x1dab34[_0x2d3b('0x1d')](0x194);}else{if(_0x3c67a5[_0x2d3b('0x66')]){throw new db[(_0x2d3b('0x5b'))]['ValidationError'](_0x2d3b('0x67'));}}return _0x3c67a5;})[_0x2d3b('0x27')](function(_0x9cdb21){if(_0x9cdb21){return _0x9cdb21[_0x2d3b('0x68')]({'closed':_0x24b570['body'][_0x2d3b('0x69')],'disposition':_0x24b570['body'][_0x2d3b('0x6a')]})[_0x2d3b('0x27')](function(_0x1b0f9c){return _0x1b0f9c;});}})[_0x2d3b('0x27')](function(){return respondWithRpcPromise(_0x2d3b('0x6b'),'abandon',_0x24b570[_0x2d3b('0x2e')],client9004);})[_0x2d3b('0x27')](respondWithResult(_0x1dab34,null))[_0x2d3b('0x1c')](handleError(_0x1dab34,null));};exports[_0x2d3b('0x6c')]=function(_0x782486,_0x1a7234){_0x782486['body'][_0x2d3b('0x2a')]=_0x782486[_0x2d3b('0x6d')]['originalname'];_0x782486[_0x2d3b('0x2e')][_0x2d3b('0x6e')]=_0x782486['file'][_0x2d3b('0x6f')];_0x782486[_0x2d3b('0x2e')][_0x2d3b('0x37')]=_0x782486[_0x2d3b('0x6d')]['mimetype'];return db['Attachment'][_0x2d3b('0x49')](_0x782486[_0x2d3b('0x2e')])[_0x2d3b('0x27')](respondWithResult(_0x1a7234,0xc9))[_0x2d3b('0x1c')](handleError(_0x1a7234,null));};exports[_0x2d3b('0x70')]=function(_0xc93305,_0x2820cb){return db['ChatInteraction'][_0x2d3b('0x4d')]({'where':{'id':_0xc93305['params']['id']},'raw':!![]})[_0x2d3b('0x27')](handleEntityNotFound(_0x2820cb,null))[_0x2d3b('0x27')](function(_0x47dd99){if(_0x47dd99){if(_0x47dd99[_0x2d3b('0x69')]){return _0x2820cb[_0x2d3b('0x1e')](0x193)[_0x2d3b('0x20')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x2d3b('0x4d')]({'where':{'id':_0xc93305['query'][_0x2d3b('0x71')]},'raw':!![]})['then'](handleEntityNotFound(_0x2820cb,null));}})[_0x2d3b('0x27')](function(_0x4d49b8){if(_0x4d49b8){var _0x217c3f=_0x4d49b8[_0x2d3b('0x72')]!==null;var _0x2b7783=path[_0x2d3b('0x73')](config[_0x2d3b('0x74')],_0x2d3b('0x75'));if(_0x217c3f){_0x2b7783=path['join'](_0x2b7783,_0x2d3b('0x76'));}var _0xad7da7=path[_0x2d3b('0x73')](_0x2b7783,_0x4d49b8[_0x2d3b('0x6e')]);return _0x2820cb[_0x2d3b('0x77')](_0xad7da7);}})[_0x2d3b('0x1c')](handleError(_0x2820cb,null));};exports[_0x2d3b('0x78')]=function(_0x6f04dc,_0x49842b){var _0x553731=null;var _0x411e5a=null;var _0x568dee=null;if(_0x6f04dc['body']['id']){delete _0x6f04dc[_0x2d3b('0x2e')]['id'];}if(_0x6f04dc[_0x2d3b('0x2e')][_0x2d3b('0x79')]){_0x568dee=path[_0x2d3b('0x73')](config['root'],_0x2d3b('0x7a'),util[_0x2d3b('0x7b')](_0x2d3b('0x7c'),Date[_0x2d3b('0x7d')]()));_0x6f04dc[_0x2d3b('0x2e')][_0x2d3b('0x7e')]=_0x568dee;}return db[_0x2d3b('0x40')]['find']({'where':{'id':_0x6f04dc[_0x2d3b('0x3d')]['id']},'include':[{'model':db[_0x2d3b('0x5d')],'as':_0x2d3b('0x7f'),'include':[{'model':db[_0x2d3b('0x80')],'as':_0x2d3b('0x80')}]}]})[_0x2d3b('0x27')](handleEntityNotFound(_0x49842b,null))[_0x2d3b('0x27')](saveUpdates(_0x6f04dc[_0x2d3b('0x2e')],null))['then'](function(_0x893571){if(_0x893571){_0x553731=_0x893571;return db['ChatWebsite'][_0x2d3b('0x4a')]({'where':{'id':_0x553731[_0x2d3b('0x81')]}});}})[_0x2d3b('0x27')](function(_0x554e75){if(_0x554e75){_0x411e5a=_0x554e75;return db[_0x2d3b('0x61')][_0x2d3b('0x4a')]({'where':{'id':_0x553731[_0x2d3b('0x82')]}});}})['then'](function(_0x548403){if(_0x548403){if(_0x568dee){var _0x33528e=null;for(var _0xeef061=0x1;_0xeef061<_0x553731[_0x2d3b('0x7f')]['length'];++_0xeef061){_0x33528e=_0x553731[_0x2d3b('0x7f')][_0xeef061];var _0x1f011c=_0x33528e[_0x2d3b('0x66')]?util[_0x2d3b('0x7b')](_0x2d3b('0x83'),_0x411e5a[_0x2d3b('0x84')],_0x33528e[_0x2d3b('0x66')]):'System';var _0x46b305=_0x6f04dc['body'][_0x2d3b('0x85')]||util[_0x2d3b('0x7b')]('%s%d',_0x2d3b('0x86'),_0x33528e[_0x2d3b('0x82')]);switch(_0x411e5a[_0x2d3b('0x87')]){case'website_alias':_0x1f011c=_0x33528e['UserId']?util[_0x2d3b('0x7b')](_0x2d3b('0x83'),_0x411e5a[_0x2d3b('0x84')],_0x33528e[_0x2d3b('0x66')]):_0x2d3b('0x88');break;case _0x2d3b('0x89'):_0x1f011c=_0x33528e[_0x2d3b('0x66')]?_0x33528e[_0x2d3b('0x80')][_0x2d3b('0x8a')]||_0x33528e[_0x2d3b('0x80')][_0x2d3b('0x50')]:_0x2d3b('0x88');break;case _0x2d3b('0x8b'):_0x1f011c=_0x33528e[_0x2d3b('0x66')]?_0x33528e[_0x2d3b('0x80')][_0x2d3b('0x50')]:_0x2d3b('0x88');break;default:_0x1f011c=_0x33528e[_0x2d3b('0x66')]?util['format'](_0x2d3b('0x83'),_0x411e5a[_0x2d3b('0x84')],_0x33528e[_0x2d3b('0x66')]):_0x2d3b('0x88');}var _0x210f5f=util[_0x2d3b('0x7b')](_0x2d3b('0x8c'),moment(_0x33528e['createdAt'])[_0x2d3b('0x7b')](_0x2d3b('0x8d')),_0x33528e['direction']==='in'?_0x46b305:_0x1f011c,_0x33528e['body']);if(!_0x33528e[_0x2d3b('0x8e')]){fs[_0x2d3b('0x8f')](_0x568dee,_0x210f5f);}}return db[_0x2d3b('0x90')][_0x2d3b('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2d3b('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2d3b('0x92'),'raw':!![]}]}]});}}})[_0x2d3b('0x27')](function(_0x252e47){if(!_0x252e47||!_0x252e47['Smtp']||!_0x6f04dc['body'])return _0x553731;var _0x5bf1b4=_0x252e47['getSmtpOptions']();return respondWithRpcPromise(_0x2d3b('0x93'),_0x2d3b('0x94'),{'account':_0x5bf1b4,'message':{'from':util['format'](_0x2d3b('0x95'),_0x252e47[_0x2d3b('0x2a')],_0x252e47['email']||_0x252e47[_0x2d3b('0x91')][_0x2d3b('0x3b')]),'to':_0x6f04dc['body'][_0x2d3b('0x79')],'subject':'Mail\x20Transcript','text':util[_0x2d3b('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x6f04dc[_0x2d3b('0x2e')][_0x2d3b('0x79')]),'attachments':[{'path':_0x568dee}]}})['then'](function(){return _0x553731;})[_0x2d3b('0x1c')](function(_0x2f22ab){logger[_0x2d3b('0x1a')](_0x2f22ab);});})[_0x2d3b('0x27')](respondWithStatusCode(_0x49842b,0xc8))[_0x2d3b('0x1c')](handleError(_0x49842b,null));};exports[_0x2d3b('0x96')]=function(_0x1bc8fe,_0x193453){return db[_0x2d3b('0x5d')]['find']({'where':{'id':_0x1bc8fe[_0x2d3b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x193453,null))[_0x2d3b('0x27')](function(_0x463c4c){if(_0x463c4c){return _0x463c4c[_0x2d3b('0x96')](_0x1bc8fe[_0x2d3b('0x2e')][_0x2d3b('0x97')],_[_0x2d3b('0x98')](_0x1bc8fe['body'],['ids','id'])||{});}})[_0x2d3b('0x27')](respondWithResult(_0x193453,null))[_0x2d3b('0x1c')](handleError(_0x193453,null));};exports['getMessages']=function(_0x19dee2,_0x33936f){var _0x1af4f1={'raw':![],'where':{}};var _0x49c1ca={};var _0x3d0b16={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2d3b('0x4d')]({'where':{'id':_0x19dee2[_0x2d3b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x33936f,null))[_0x2d3b('0x27')](function(_0x6e3bbd){if(_0x6e3bbd){_0x49c1ca['model']=_[_0x2d3b('0x3f')](db['ChatMessage'][_0x2d3b('0x35')]);_0x49c1ca[_0x2d3b('0x3a')]=_[_0x2d3b('0x3f')](_0x19dee2['query']);_0x49c1ca[_0x2d3b('0x41')]=_['intersection'](_0x49c1ca[_0x2d3b('0x3e')],_0x49c1ca[_0x2d3b('0x3a')]);_0x1af4f1['attributes']=_['intersection'](_0x49c1ca[_0x2d3b('0x3e')],qs['fields'](_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x43')]));_0x1af4f1['attributes']=_0x1af4f1[_0x2d3b('0x44')][_0x2d3b('0x45')]?_0x1af4f1['attributes']:_0x49c1ca[_0x2d3b('0x3e')];if(!_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x99')]('nolimit')){_0x1af4f1['limit']=qs[_0x2d3b('0x23')](_0x19dee2[_0x2d3b('0x3a')]['limit']);_0x1af4f1[_0x2d3b('0x21')]=qs[_0x2d3b('0x21')](_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x21')]);}_0x1af4f1[_0x2d3b('0x9a')]=qs[_0x2d3b('0x9b')](_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x9b')]);_0x1af4f1[_0x2d3b('0x9c')]=qs[_0x2d3b('0x41')](_[_0x2d3b('0x9d')](_0x19dee2[_0x2d3b('0x3a')],_0x49c1ca[_0x2d3b('0x41')]));_0x1af4f1[_0x2d3b('0x9c')]['ChatInteractionId']=_0x6e3bbd['id'];if(_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x9e')]){_0x1af4f1[_0x2d3b('0x9c')]=_[_0x2d3b('0x2d')](_0x1af4f1[_0x2d3b('0x9c')],{'$or':_[_0x2d3b('0x34')](_0x1af4f1[_0x2d3b('0x44')],function(_0x1084a){var _0xce7f49={};_0xce7f49[_0x1084a]={'$like':'%'+_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x9e')]+'%'};return _0xce7f49;})});}if(_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x9f')]){var _0x5a4cf0=_0x19dee2[_0x2d3b('0x3a')]['$gte'][_0x2d3b('0xa0')](',');var _0x3e0cb0={};_0x3e0cb0[_0x5a4cf0[0x0]]={'$gte':moment(_0x5a4cf0[0x1])[_0x2d3b('0x7b')](_0x2d3b('0xa1'))};_0x1af4f1[_0x2d3b('0x9c')]=_[_0x2d3b('0x2d')](_0x1af4f1['where'],_0x3e0cb0);}_0x1af4f1=_[_0x2d3b('0x2d')]({},_0x1af4f1,_0x19dee2[_0x2d3b('0x48')]);return db[_0x2d3b('0x5d')][_0x2d3b('0x24')]({'where':_0x1af4f1['where']})['then'](function(_0x54aeec){_0x3d0b16[_0x2d3b('0x24')]=_0x54aeec;if(_0x19dee2[_0x2d3b('0x3a')][_0x2d3b('0x46')]){_0x1af4f1[_0x2d3b('0x47')]=[{'all':!![]}];}return db[_0x2d3b('0x5d')][_0x2d3b('0xa2')](_0x1af4f1);})[_0x2d3b('0x27')](function(_0x13c408){_0x3d0b16[_0x2d3b('0xa3')]=_0x13c408;return _0x3d0b16;});}})[_0x2d3b('0x27')](respondWithFilteredResult(_0x33936f,_0x1af4f1))[_0x2d3b('0x1c')](handleError(_0x33936f,null));};exports[_0x2d3b('0xa4')]=function(_0x17ed94,_0x337dab){var _0x57a629={'where':{}},_0x257442={},_0x35acff={'count':0x0,'rows':[]};return db[_0x2d3b('0x40')][_0x2d3b('0x4d')]({'where':{'id':_0x17ed94[_0x2d3b('0x3d')]['id']}})[_0x2d3b('0x27')](handleEntityNotFound(_0x337dab,null))[_0x2d3b('0x27')](function(_0x40eb89){if(_0x40eb89){_0x257442[_0x2d3b('0x3e')]=_[_0x2d3b('0x3f')](db['ChatMessage'][_0x2d3b('0x35')]);_0x257442['query']=_[_0x2d3b('0x3f')](_0x17ed94[_0x2d3b('0x3a')]);_0x257442[_0x2d3b('0x41')]=_[_0x2d3b('0x42')](_0x257442[_0x2d3b('0x3e')],_0x257442[_0x2d3b('0x3a')]);_0x57a629[_0x2d3b('0x44')]=_[_0x2d3b('0x42')](_0x257442[_0x2d3b('0x3e')],qs['fields'](_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x43')]));_0x57a629['attributes']=_0x57a629[_0x2d3b('0x44')][_0x2d3b('0x45')]?_0x57a629[_0x2d3b('0x44')]:_0x257442[_0x2d3b('0x3e')];if(!_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x99')](_0x2d3b('0xa5'))){_0x57a629[_0x2d3b('0x23')]=qs['limit'](_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x23')]);_0x57a629[_0x2d3b('0x21')]=qs[_0x2d3b('0x21')](_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x21')]);}_0x57a629[_0x2d3b('0x9a')]=qs[_0x2d3b('0x9b')](_0x17ed94['query'][_0x2d3b('0x9b')]);_0x57a629[_0x2d3b('0x9c')]=qs['filters'](_[_0x2d3b('0x9d')](_0x17ed94[_0x2d3b('0x3a')],_0x257442['filters']));_0x57a629['where']['ChatInteractionId']=_0x40eb89['id'];if(_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x9e')]){_0x57a629[_0x2d3b('0x9c')]=_[_0x2d3b('0x2d')](_0x57a629[_0x2d3b('0x9c')],{'$or':_[_0x2d3b('0x34')](_0x57a629[_0x2d3b('0x44')],function(_0x4ebdd6){var _0x49fa15={};_0x49fa15[_0x4ebdd6]={'$like':'%'+_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x9e')]+'%'};return _0x49fa15;})});}_0x57a629[_0x2d3b('0x9c')][_0x2d3b('0x8e')]=![];if(_0x17ed94[_0x2d3b('0x3a')]['id']){_0x57a629[_0x2d3b('0x9c')]['id']={'$gt':_0x17ed94[_0x2d3b('0x3a')]['id']};}_0x57a629=_[_0x2d3b('0x2d')]({},_0x57a629,_0x17ed94['options']);return db['ChatMessage'][_0x2d3b('0x24')]({'where':_0x57a629[_0x2d3b('0x9c')]})['then'](function(_0x5f57d0){_0x35acff[_0x2d3b('0x24')]=_0x5f57d0;_0x57a629[_0x2d3b('0x47')]=[];if(_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0xa6')]){_0x57a629[_0x2d3b('0x47')][_0x2d3b('0xa7')]({'model':db[_0x2d3b('0x80')],'as':'User','attributes':['id',_0x2d3b('0x50'),'alias']});}if(_0x17ed94[_0x2d3b('0x3a')][_0x2d3b('0x46')]){_0x57a629['include']=[{'all':!![]}];}return db[_0x2d3b('0x5d')][_0x2d3b('0xa2')](_0x57a629);})[_0x2d3b('0x27')](function(_0x147c60){_0x35acff[_0x2d3b('0xa3')]=_0x147c60;return _0x35acff;});}})[_0x2d3b('0x27')](respondWithFilteredResult(_0x337dab,_0x57a629))['catch'](handleError(_0x337dab,null));};exports[_0x2d3b('0xa8')]=function(_0x7e5a8c,_0x12a506){return db[_0x2d3b('0x40')][_0x2d3b('0x4a')]({'where':{'id':_0x7e5a8c['params']['id']}})[_0x2d3b('0x27')](handleEntityNotFound(_0x12a506,null))[_0x2d3b('0x27')](function(_0x3f6a2d){if(_0x3f6a2d){return _0x3f6a2d[_0x2d3b('0xa9')](_0x7e5a8c['body']['ids'],_[_0x2d3b('0x98')](_0x7e5a8c['body'],[_0x2d3b('0x97'),'id'])||{})['spread'](function(){return db['Tag'][_0x2d3b('0xa2')]({'attributes':['id',_0x2d3b('0x2a'),'color'],'where':{'id':_0x7e5a8c[_0x2d3b('0x2e')][_0x2d3b('0x97')]}});})[_0x2d3b('0x27')](function(_0x413b23){socket[_0x2d3b('0xaa')](_0x2d3b('0xab'),{'id':Number(_0x7e5a8c[_0x2d3b('0x3d')]['id']),'tags':_0x413b23||[]});return{'id':Number(_0x7e5a8c[_0x2d3b('0x3d')]['id']),'tags':_0x413b23||[]};});}})['then'](respondWithResult(_0x12a506,null))[_0x2d3b('0x1c')](handleError(_0x12a506,null));};exports[_0x2d3b('0xac')]=function(_0x13632e,_0xd0918e){return db[_0x2d3b('0x40')][_0x2d3b('0x4a')]({'where':{'id':_0x13632e[_0x2d3b('0x3d')]['id']}})[_0x2d3b('0x27')](handleEntityNotFound(_0xd0918e,null))[_0x2d3b('0x27')](function(_0x31cd0e){if(_0x31cd0e){return _0x31cd0e[_0x2d3b('0xac')](_0x13632e['query'][_0x2d3b('0x97')]);}})[_0x2d3b('0x27')](respondWithStatusCode(_0xd0918e,null))[_0x2d3b('0x1c')](handleError(_0xd0918e,null));};exports['download']=function(_0x5a3e01,_0x587e41){var _0x1d1d51=moment()[_0x2d3b('0xad')]()['toString']();var _0x50decd=path['join'](config[_0x2d3b('0x74')],_0x2d3b('0xae'),_0x2d3b('0xaf'),_0x2d3b('0xb0'));var _0x1ec152=path[_0x2d3b('0x73')](config['root'],_0x2d3b('0xae'),_0x2d3b('0xaf'),_0x2d3b('0xb1'));var _0x272312=path[_0x2d3b('0x73')](_0x50decd,_0x1d1d51);var _0x27f66c=util[_0x2d3b('0x7b')](_0x2d3b('0xb2'),_0x5a3e01['params']['id'],_0x1d1d51);var _0x2940eb=path[_0x2d3b('0x73')](_0x50decd,_0x27f66c);var _0x9afc1f=[];_0x9afc1f[_0x2d3b('0xa7')]({'model':db['User'],'as':'User','attributes':['id',_0x2d3b('0x50')],'raw':!![]});_0x9afc1f[_0x2d3b('0xa7')]({'model':db[_0x2d3b('0x61')],'as':_0x2d3b('0x62'),'attributes':['id',_0x2d3b('0xb3'),_0x2d3b('0xb4')],'raw':!![]});if(_0x5a3e01['query']['attachments']){_0x9afc1f[_0x2d3b('0xa7')]({'model':db['Attachment'],'as':_0x2d3b('0xb5'),'raw':!![]});}var _0x2ad360=[{'model':db[_0x2d3b('0x5d')],'as':_0x2d3b('0x7f'),'attributes':['id',_0x2d3b('0x2e'),_0x2d3b('0xb6'),_0x2d3b('0xb7'),_0x2d3b('0x8e'),_0x2d3b('0xb8')],'include':_0x9afc1f}];_0x2ad360[_0x2d3b('0xa7')]({'model':db[_0x2d3b('0x4c')],'as':_0x2d3b('0xb9'),'attributes':['id',_0x2d3b('0x2a')]});_0x2ad360[_0x2d3b('0xa7')]({'model':db[_0x2d3b('0x80')],'as':_0x2d3b('0xba'),'attributes':['id',_0x2d3b('0x50')]});return db[_0x2d3b('0x40')][_0x2d3b('0x4a')]({'where':{'id':_0x5a3e01[_0x2d3b('0x3d')]['id']},'include':_0x2ad360})[_0x2d3b('0x27')](handleEntityNotFound(_0x587e41,null))[_0x2d3b('0x27')](function(_0x51b1af){if(_0x51b1af){var _0x3c302f=_0x51b1af[_0x2d3b('0xbb')]({'plain':!![]});fs[_0x2d3b('0xbc')](_0x272312);var _0x175ead={'channel':_0x2d3b('0xbd'),'account':_0x3c302f[_0x2d3b('0xb9')]['name'],'agent':_0x3c302f['Owner']?_0x3c302f['Owner']['fullname']:'N.A.','createdAt':moment(_0x3c302f[_0x2d3b('0xb6')])[_0x2d3b('0x7b')](_0x2d3b('0xa1'))[_0x2d3b('0xbe')](),'closedAt':_0x3c302f[_0x2d3b('0x69')]?moment(_0x3c302f[_0x2d3b('0xbf')])[_0x2d3b('0x7b')](_0x2d3b('0xa1'))[_0x2d3b('0xbe')]():'','disposition':_0x3c302f[_0x2d3b('0x6a')],'chatInfo':{'browser':_0x3c302f[_0x2d3b('0xc0')],'os':_0x3c302f[_0x2d3b('0xc1')],'referer':_0x3c302f[_0x2d3b('0xc2')],'customerIp':_0x3c302f[_0x2d3b('0xc3')],'customerPort':_0x3c302f[_0x2d3b('0xc4')]?_0x3c302f[_0x2d3b('0xc4')]:_0x2d3b('0xc5')},'messages':_(_0x3c302f[_0x2d3b('0x7f')])['tail']()[_0x2d3b('0x9e')]({'secret':![]})[_0x2d3b('0x34')](function(_0x5ebbf0){if(_0x5ebbf0['Attachment']){var _0x4a3ae0=path[_0x2d3b('0x73')](_0x1ec152,_0x5ebbf0[_0x2d3b('0xb5')][_0x2d3b('0x6e')]);if(fs[_0x2d3b('0xc6')](_0x4a3ae0)){fs[_0x2d3b('0xc7')](_0x4a3ae0)['pipe'](fs[_0x2d3b('0xc8')](path[_0x2d3b('0x73')](_0x272312,_0x5ebbf0[_0x2d3b('0xb5')][_0x2d3b('0x6e')])));}}return{'date':moment(_0x5ebbf0[_0x2d3b('0xb6')])[_0x2d3b('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2d3b('0xbe')](),'sender':_0x5ebbf0['direction']==='out'?_0x5ebbf0[_0x2d3b('0x80')]?_0x5ebbf0['User'][_0x2d3b('0x50')]:'System':_0x5ebbf0[_0x2d3b('0x62')][_0x2d3b('0xb3')]+(_0x5ebbf0[_0x2d3b('0x62')]['lastName']?'\x20'+_0x5ebbf0['Contact']['lastName']:''),'body':_0x5ebbf0[_0x2d3b('0xb5')]?_0x5ebbf0[_0x2d3b('0xb5')]['basename']:_0x5ebbf0[_0x2d3b('0x2e')],'direction':_0x5ebbf0[_0x2d3b('0xb7')]===_0x2d3b('0xc9')?'A':'C','secret':_0x5ebbf0[_0x2d3b('0x8e')],'read':_0x5ebbf0[_0x2d3b('0xb8')],'attachment':_0x5ebbf0[_0x2d3b('0xb5')]};})['value']()};return ejs[_0x2d3b('0xca')](path[_0x2d3b('0x73')](config[_0x2d3b('0x74')],_0x2d3b('0xae'),_0x2d3b('0xcb'),_0x2d3b('0xcc')),{'interaction':_0x175ead})[_0x2d3b('0x27')](function(_0x2385db){var _0x1b3013=path['join'](_0x272312,_0x2d3b('0xcd')+_0x3c302f['id']+'-'+_0x1d1d51+_0x2d3b('0xce'));var _0x2e9ba7={'path':_0x1b3013,'channel':_0x2d3b('0xbd'),'interactionId':_0x3c302f['id']};return pdf[_0x2d3b('0xcf')](_0x2385db,_0x2e9ba7);})[_0x2d3b('0x27')](function(){return new Promise(function(_0x3d0daf,_0xf81316){zipdir(_0x272312,{'saveTo':_0x2940eb},function(_0x1cc5d8,_0x17542c){if(_0x1cc5d8)return _0xf81316(_0x1cc5d8);return _0x3d0daf(_0x17542c);});})[_0x2d3b('0x27')](function(){return new BPromise(function(_0x107e66,_0x21be2d){rimraf(_0x272312,function(_0x38123e){if(_0x38123e)_0x21be2d(_0x38123e);return _0x107e66();});});})['then'](function(){return _0x587e41['download'](_0x2940eb,_0x27f66c,function(_0x220c50){if(_0x220c50){logger[_0x2d3b('0x1a')](_0x2d3b('0xd0'),_0x220c50);}else{fs['unlinkSync'](_0x2940eb);}});});});}else{return _0x587e41[_0x2d3b('0x1d')](0xc8);}})[_0x2d3b('0x1c')](handleError(_0x587e41,null));}; \ No newline at end of file +var _0x7ca5=['transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../mysqldb','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','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','offset','undefined','count','limit','set','Content-Range','update','stack','name','render','merge','body','contact','agent','index','map','ChatInteraction','fieldName','key','getOptions','findAll','chat','query','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','destroy','describe','createVidaooSession','params','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','type','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','User','CmContact','ContactId','Messages','%s%d','agentAlias','UserId','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','includeAgent','push','addTags','setTags','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','read','Account','Owner','mkdirSync','Chat','closedAt','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ca5,0x19c));var _0x57ca=function(_0x274fde,_0x34ef0b){_0x274fde=_0x274fde-0x0;var _0x280d4a=_0x7ca5[_0x274fde];return _0x280d4a;};'use strict';var rimraf=require(_0x57ca('0x0'));var zipdir=require(_0x57ca('0x1'));var rp=require(_0x57ca('0x2'));var moment=require(_0x57ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x57ca('0x4'));var util=require(_0x57ca('0x5'));var path=require(_0x57ca('0x6'));var ejs=require(_0x57ca('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x57ca('0x8'));var interaction=require(_0x57ca('0x9'));var qs=require(_0x57ca('0xa'));var pdf=require(_0x57ca('0xb'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x57ca('0xc'))['db'];config['redis']=_[_0x57ca('0xd')](config['redis'],{'host':_0x57ca('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x57ca('0xf'))['register'](socket);var jayson=require(_0x57ca('0x10'));var client=jayson[_0x57ca('0x11')][_0x57ca('0x12')]({'port':0x232b});var client9004=jayson[_0x57ca('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19f3bf,_0x771f3d,_0x4f9449,_0x7b7ff0){return new BPromise(function(_0x1d00d5,_0x1f51c3){var _0x186d81=_0x7b7ff0||client;return _0x186d81[_0x57ca('0x13')](_0x19f3bf,_0x4f9449)[_0x57ca('0x14')](function(_0x167458){logger[_0x57ca('0x15')](_0x57ca('0x16'),_0x771f3d,_0x57ca('0x17'));logger['debug'](_0x57ca('0x18'),_0x771f3d,'request\x20sent',JSON[_0x57ca('0x19')](_0x167458));if(_0x167458[_0x57ca('0x1a')]){if(_0x167458[_0x57ca('0x1a')][_0x57ca('0x1b')]===0x1f4){logger[_0x57ca('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x771f3d,_0x167458[_0x57ca('0x1a')][_0x57ca('0x1c')]);return _0x1f51c3(_0x167458[_0x57ca('0x1a')][_0x57ca('0x1c')]);}logger[_0x57ca('0x1a')](_0x57ca('0x16'),_0x771f3d,_0x167458[_0x57ca('0x1a')][_0x57ca('0x1c')]);return _0x1d00d5(_0x167458[_0x57ca('0x1a')][_0x57ca('0x1c')]);}else{logger['info'](_0x57ca('0x16'),_0x771f3d,_0x57ca('0x17'));_0x1d00d5(_0x167458[_0x57ca('0x1d')][_0x57ca('0x1c')]);}})[_0x57ca('0x1e')](function(_0x2a8c22){logger['error'](_0x57ca('0x16'),_0x771f3d,_0x2a8c22);_0x1f51c3(_0x2a8c22);});});}function respondWithStatusCode(_0x3daeed,_0x6b645a){_0x6b645a=_0x6b645a||0xcc;return function(_0x343528){if(_0x343528){return _0x3daeed[_0x57ca('0x1f')](_0x6b645a);}return _0x3daeed[_0x57ca('0x20')](_0x6b645a)[_0x57ca('0x21')]();};}function respondWithResult(_0x4edee2,_0x5d6411){_0x5d6411=_0x5d6411||0xc8;return function(_0x1f3527){if(_0x1f3527){return _0x4edee2['status'](_0x5d6411)[_0x57ca('0x22')](_0x1f3527);}};}function respondWithFilteredResult(_0x13a7d9,_0x614c4e){return function(_0x605eeb){if(_0x605eeb){var _0x59f68a=typeof _0x614c4e[_0x57ca('0x23')]===_0x57ca('0x24')&&typeof _0x614c4e['limit']===_0x57ca('0x24');var _0x9b6e24=_0x605eeb[_0x57ca('0x25')];var _0x31303e=_0x59f68a?0x0:_0x614c4e['offset'];var _0x5e40c0=_0x59f68a?_0x605eeb[_0x57ca('0x25')]:_0x614c4e[_0x57ca('0x23')]+_0x614c4e[_0x57ca('0x26')];var _0x3be0af;if(_0x5e40c0>=_0x9b6e24){_0x5e40c0=_0x9b6e24;_0x3be0af=0xc8;}else{_0x3be0af=0xce;}_0x13a7d9['status'](_0x3be0af);return _0x13a7d9[_0x57ca('0x27')](_0x57ca('0x28'),_0x31303e+'-'+_0x5e40c0+'/'+_0x9b6e24)[_0x57ca('0x22')](_0x605eeb);}return null;};}function saveUpdates(_0x474492){return function(_0x4eadc8){if(_0x4eadc8){return _0x4eadc8[_0x57ca('0x29')](_0x474492)[_0x57ca('0x14')](function(_0x5c155c){return _0x5c155c;});}return null;};}function removeEntity(_0x5e0e8f){return function(_0x30ae02){if(_0x30ae02){return _0x30ae02['destroy']()[_0x57ca('0x14')](function(){_0x5e0e8f[_0x57ca('0x20')](0xcc)[_0x57ca('0x21')]();});}};}function handleEntityNotFound(_0x4407d3){return function(_0x295da3){if(!_0x295da3){_0x4407d3['sendStatus'](0x194);}return _0x295da3;};}function handleError(_0x201d54,_0x26c36a){_0x26c36a=_0x26c36a||0x1f4;return function(_0x194469){logger[_0x57ca('0x1a')](_0x194469[_0x57ca('0x2a')]);if(_0x194469[_0x57ca('0x2b')]){delete _0x194469[_0x57ca('0x2b')];}_0x201d54[_0x57ca('0x20')](_0x26c36a)['send'](_0x194469);};}function getMustacheRender(_0x59b668,_0x256007){return Mustache[_0x57ca('0x2c')](_0x59b668,_[_0x57ca('0x2d')](_0x256007[_0x57ca('0x2e')],{'contact':_0x256007[_0x57ca('0x2f')],'message':_0x256007[_0x57ca('0x1c')],'agent':_0x256007[_0x57ca('0x30')],'interaction':_0x256007['interaction'],'account':_0x256007['account']}))||'';}exports[_0x57ca('0x31')]=function(_0x233d07,_0x5b621f){var _0x42fa30={};var _0x4a10a9=_[_0x57ca('0x32')](db[_0x57ca('0x33')]['rawAttributes'],function(_0x565eb6){return{'name':_0x565eb6[_0x57ca('0x34')],'type':_0x565eb6['type'][_0x57ca('0x35')]};});_0x42fa30=qs[_0x57ca('0x36')](_0x4a10a9,_0x233d07);return interaction[_0x57ca('0x37')](_0x57ca('0x38'),_0x233d07[_0x57ca('0x39')],_0x233d07['user'],_0x42fa30,_0x4a10a9)['then'](respondWithFilteredResult(_0x5b621f,_0x42fa30))[_0x57ca('0x1e')](handleError(_0x5b621f,null));};exports['show']=function(_0x5ac10c,_0x4dd903){var _0x10fd26={'raw':![],'where':{'id':_0x5ac10c['params']['id']}},_0x49bbf2={};_0x49bbf2[_0x57ca('0x3a')]=_[_0x57ca('0x3b')](db['ChatInteraction']['rawAttributes']);_0x49bbf2['query']=_[_0x57ca('0x3b')](_0x5ac10c[_0x57ca('0x39')]);_0x49bbf2[_0x57ca('0x3c')]=_[_0x57ca('0x3d')](_0x49bbf2[_0x57ca('0x3a')],_0x49bbf2[_0x57ca('0x39')]);_0x10fd26[_0x57ca('0x3e')]=_['intersection'](_0x49bbf2[_0x57ca('0x3a')],qs[_0x57ca('0x3f')](_0x5ac10c[_0x57ca('0x39')]['fields']));_0x10fd26[_0x57ca('0x3e')]=_0x10fd26[_0x57ca('0x3e')][_0x57ca('0x40')]?_0x10fd26[_0x57ca('0x3e')]:_0x49bbf2['model'];if(_0x5ac10c['query'][_0x57ca('0x41')]){_0x10fd26[_0x57ca('0x42')]=[{'all':!![]}];}_0x10fd26=_[_0x57ca('0x2d')]({},_0x10fd26,_0x5ac10c['options']);return db[_0x57ca('0x33')][_0x57ca('0x43')](_0x10fd26)['then'](handleEntityNotFound(_0x4dd903,null))[_0x57ca('0x14')](respondWithResult(_0x4dd903,null))[_0x57ca('0x1e')](handleError(_0x4dd903,null));};exports[_0x57ca('0x44')]=function(_0x5cdc41,_0x29d6ad){return db[_0x57ca('0x33')]['create'](_0x5cdc41[_0x57ca('0x2e')],{})[_0x57ca('0x14')](respondWithResult(_0x29d6ad,0xc9))[_0x57ca('0x1e')](handleError(_0x29d6ad,null));};exports['update']=function(_0x48d2d6,_0x23277b){if(_0x48d2d6[_0x57ca('0x2e')]['id']){delete _0x48d2d6[_0x57ca('0x2e')]['id'];}return db[_0x57ca('0x33')][_0x57ca('0x43')]({'where':{'id':_0x48d2d6['params']['id']}})[_0x57ca('0x14')](handleEntityNotFound(_0x23277b,null))[_0x57ca('0x14')](saveUpdates(_0x48d2d6['body'],null))[_0x57ca('0x14')](respondWithResult(_0x23277b,null))[_0x57ca('0x1e')](handleError(_0x23277b,null));};exports[_0x57ca('0x45')]=function(_0xa204ab,_0x5162ef){return db['ChatInteraction'][_0x57ca('0x43')]({'where':{'id':_0xa204ab['params']['id']}})[_0x57ca('0x14')](handleEntityNotFound(_0x5162ef,null))['then'](removeEntity(_0x5162ef,null))[_0x57ca('0x1e')](handleError(_0x5162ef,null));};exports[_0x57ca('0x46')]=function(_0x1553f9,_0x5f372d){return db[_0x57ca('0x33')][_0x57ca('0x46')]()[_0x57ca('0x14')](respondWithResult(_0x5f372d,null))[_0x57ca('0x1e')](handleError(_0x5f372d,null));};exports[_0x57ca('0x47')]=function(_0x1dc62e,_0x5860b1){var _0x2b0f03=_0x1dc62e[_0x57ca('0x48')]['id'];var _0x1f3a6d;var _0x48ede6;var _0x1f871f;return db[_0x57ca('0x33')][_0x57ca('0x49')]({'where':{'id':_0x2b0f03}})['then'](function(_0x4510c2){_0x1f3a6d=_0x4510c2;return db[_0x57ca('0x4a')]['findOne']({'where':{'id':_0x4510c2['ChatWebsiteId']},'attributes':['id',_0x57ca('0x4b'),_0x57ca('0x4c'),_0x57ca('0x4d'),_0x57ca('0x4e'),_0x57ca('0x4f')],'raw':!![]});})['then'](function(_0x6315e5){if(_0x6315e5&&_0x6315e5[_0x57ca('0x4b')]&&_0x6315e5[_0x57ca('0x4c')]){_0x48ede6=_0x6315e5;var _0x59c256={'interaction':{'id':_0x2b0f03},'agent':{'id':_0x1dc62e[_0x57ca('0x50')]['id'],'name':_0x1dc62e[_0x57ca('0x50')]['name'],'fullname':_0x1dc62e[_0x57ca('0x50')][_0x57ca('0x51')],'email':_0x1dc62e[_0x57ca('0x50')][_0x57ca('0x52')]},'contact':_0x1dc62e[_0x57ca('0x2e')][_0x57ca('0x2f')],'account':_0x1dc62e[_0x57ca('0x2e')]['account']};var _0x467dac={'rejectUnauthorized':![],'method':_0x57ca('0x53'),'url':_0x57ca('0x54'),'headers':{'X-APIKEY':_0x6315e5['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1dc62e[_0x57ca('0x50')][_0x57ca('0x52')]],'buttons':null,'topic':_0x48ede6[_0x57ca('0x4d')],'note':_[_0x57ca('0x55')](_0x48ede6['vidaooNote'])?null:getMustacheRender(_0x48ede6['vidaooNote'],_0x59c256),'metadata':null},'redirect':_0x57ca('0x56'),'json':!![]};try{if(!_[_0x57ca('0x55')](_0x48ede6[_0x57ca('0x4f')])){var _0x55329f=getMustacheRender(_0x48ede6[_0x57ca('0x4f')],_0x59c256);var _0x1a442b=JSON[_0x57ca('0x57')](_0x55329f);_0x467dac[_0x57ca('0x2e')][_0x57ca('0x58')]=_0x1a442b;}}catch(_0x501b5d){throw new db[(_0x57ca('0x59'))][(_0x57ca('0x5a'))](_0x57ca('0x5b'));}return rp(_0x467dac);}else{throw new db[(_0x57ca('0x59'))][(_0x57ca('0x5a'))](_0x57ca('0x5c'));}})[_0x57ca('0x14')](function(_0x53aaac){_0x1f871f=_0x53aaac;if(_0x1f871f['id']){var _0x4078a6={'body':_0x1f871f['join_url'],'ChatWebsiteId':_0x48ede6['id'],'ChatInteractionId':_0x1f3a6d['id'],'direction':_0x57ca('0x5d'),'UserId':_0x1dc62e[_0x57ca('0x50')]['id']};return db[_0x57ca('0x5e')][_0x57ca('0x44')](_0x4078a6,{});}else{throw new db['Sequelize']['ValidationError'](_0x57ca('0x5f'));}})['then'](function(){return _0x1f3a6d[_0x57ca('0x60')]({'vidaooSessionId':_0x1f871f['id']});})[_0x57ca('0x14')](respondWithResult(_0x5860b1,null))[_0x57ca('0x1e')](handleError(_0x5860b1,null));};exports[_0x57ca('0x61')]=function(_0x4c7073,_0x3742eb){if(_0x4c7073['body']['id']){delete _0x4c7073[_0x57ca('0x2e')]['id'];}return db[_0x57ca('0x33')][_0x57ca('0x43')]({'where':{'id':_0x4c7073[_0x57ca('0x48')]['id']},'include':[{'model':db['CmContact'],'as':_0x57ca('0x62')}]})[_0x57ca('0x14')](handleEntityNotFound(_0x3742eb,null))[_0x57ca('0x14')](saveUpdates(_0x4c7073[_0x57ca('0x2e')],null))[_0x57ca('0x14')](respondWithResult(_0x3742eb,null))['catch'](handleError(_0x3742eb,null));};exports[_0x57ca('0x63')]=function(_0x5b418a,_0x39fcf){if(_0x5b418a[_0x57ca('0x2e')]['id']){delete _0x5b418a[_0x57ca('0x2e')]['id'];}return db[_0x57ca('0x33')][_0x57ca('0x43')]({'where':{'id':_0x5b418a['params']['id']}})[_0x57ca('0x14')](function(_0x41ac8a){if(!_0x41ac8a){logger[_0x57ca('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x57ca('0x63'),0x194,_0x57ca('0x64'));_0x39fcf['sendStatus'](0x194);}else{if(_0x41ac8a['UserId']){throw new db[(_0x57ca('0x59'))][(_0x57ca('0x5a'))](_0x57ca('0x65'));}}return _0x41ac8a;})[_0x57ca('0x14')](function(_0x5c27e4){if(_0x5c27e4){return _0x5c27e4['update']({'closed':_0x5b418a['body'][_0x57ca('0x66')],'disposition':_0x5b418a['body'][_0x57ca('0x67')]})[_0x57ca('0x14')](function(_0x4895ed){return _0x4895ed;});}})[_0x57ca('0x14')](function(){return respondWithRpcPromise(_0x57ca('0x68'),_0x57ca('0x63'),_0x5b418a[_0x57ca('0x2e')],client9004);})[_0x57ca('0x14')](respondWithResult(_0x39fcf,null))[_0x57ca('0x1e')](handleError(_0x39fcf,null));};exports[_0x57ca('0x69')]=function(_0x5276b7,_0x5b66cf){_0x5276b7['body'][_0x57ca('0x2b')]=_0x5276b7[_0x57ca('0x6a')][_0x57ca('0x6b')];_0x5276b7[_0x57ca('0x2e')]['basename']=_0x5276b7[_0x57ca('0x6a')][_0x57ca('0x6c')];_0x5276b7['body'][_0x57ca('0x6d')]=_0x5276b7[_0x57ca('0x6a')][_0x57ca('0x6e')];return db[_0x57ca('0x6f')][_0x57ca('0x44')](_0x5276b7['body'])['then'](respondWithResult(_0x5b66cf,0xc9))['catch'](handleError(_0x5b66cf,null));};exports[_0x57ca('0x70')]=function(_0x4137e5,_0x4a6931){return db['ChatInteraction'][_0x57ca('0x49')]({'where':{'id':_0x4137e5[_0x57ca('0x48')]['id']},'raw':!![]})[_0x57ca('0x14')](handleEntityNotFound(_0x4a6931,null))[_0x57ca('0x14')](function(_0x3e0e09){if(_0x3e0e09){if(_0x3e0e09[_0x57ca('0x66')]){return _0x4a6931['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x57ca('0x6f')][_0x57ca('0x49')]({'where':{'id':_0x4137e5[_0x57ca('0x39')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x4a6931,null));}})[_0x57ca('0x14')](function(_0x164060){if(_0x164060){var _0x4fc4de=_0x164060[_0x57ca('0x71')]!==null;var _0x5b6879=path[_0x57ca('0x72')](config[_0x57ca('0x73')],_0x57ca('0x74'));if(_0x4fc4de){_0x5b6879=path[_0x57ca('0x72')](_0x5b6879,_0x57ca('0x75'));}var _0x2f1941=path['join'](_0x5b6879,_0x164060[_0x57ca('0x76')]);return _0x4a6931[_0x57ca('0x77')](_0x2f1941);}})[_0x57ca('0x1e')](handleError(_0x4a6931,null));};exports[_0x57ca('0x78')]=function(_0x2a174b,_0x17b178){var _0x2cbdcd=null;var _0x397a69=null;var _0x156a59=null;if(_0x2a174b['body']['id']){delete _0x2a174b['body']['id'];}if(_0x2a174b[_0x57ca('0x2e')][_0x57ca('0x79')]){_0x156a59=path[_0x57ca('0x72')](config[_0x57ca('0x73')],'server/files/chat/upload/',util[_0x57ca('0x7a')](_0x57ca('0x7b'),Date[_0x57ca('0x7c')]()));_0x2a174b[_0x57ca('0x2e')][_0x57ca('0x7d')]=_0x156a59;}return db['ChatInteraction']['find']({'where':{'id':_0x2a174b[_0x57ca('0x48')]['id']},'include':[{'model':db[_0x57ca('0x5e')],'as':'Messages','include':[{'model':db[_0x57ca('0x7e')],'as':'User'}]}]})[_0x57ca('0x14')](handleEntityNotFound(_0x17b178,null))[_0x57ca('0x14')](saveUpdates(_0x2a174b[_0x57ca('0x2e')],null))['then'](function(_0x2abccd){if(_0x2abccd){_0x2cbdcd=_0x2abccd;return db[_0x57ca('0x4a')]['find']({'where':{'id':_0x2cbdcd['ChatWebsiteId']}});}})[_0x57ca('0x14')](function(_0x2d98d1){if(_0x2d98d1){_0x397a69=_0x2d98d1;return db[_0x57ca('0x7f')][_0x57ca('0x43')]({'where':{'id':_0x2cbdcd[_0x57ca('0x80')]}});}})[_0x57ca('0x14')](function(_0x5e26d2){if(_0x5e26d2){if(_0x156a59){var _0x14dc84=null;for(var _0x4e6452=0x1;_0x4e6452<_0x2cbdcd[_0x57ca('0x81')]['length'];++_0x4e6452){_0x14dc84=_0x2cbdcd[_0x57ca('0x81')][_0x4e6452];var _0xe29bcb=_0x14dc84['UserId']?util[_0x57ca('0x7a')](_0x57ca('0x82'),_0x397a69[_0x57ca('0x83')],_0x14dc84[_0x57ca('0x84')]):_0x57ca('0x85');var _0x81371f=_0x2a174b[_0x57ca('0x2e')][_0x57ca('0x86')]||util[_0x57ca('0x7a')](_0x57ca('0x82'),_0x57ca('0x87'),_0x14dc84[_0x57ca('0x80')]);switch(_0x397a69[_0x57ca('0x88')]){case _0x57ca('0x89'):_0xe29bcb=_0x14dc84[_0x57ca('0x84')]?util[_0x57ca('0x7a')](_0x57ca('0x82'),_0x397a69['agentAlias'],_0x14dc84[_0x57ca('0x84')]):'System';break;case _0x57ca('0x8a'):_0xe29bcb=_0x14dc84['UserId']?_0x14dc84[_0x57ca('0x7e')][_0x57ca('0x8b')]||_0x14dc84[_0x57ca('0x7e')][_0x57ca('0x51')]:_0x57ca('0x85');break;case'agent_fullname':_0xe29bcb=_0x14dc84[_0x57ca('0x84')]?_0x14dc84[_0x57ca('0x7e')][_0x57ca('0x51')]:'System';break;default:_0xe29bcb=_0x14dc84[_0x57ca('0x84')]?util['format'](_0x57ca('0x82'),_0x397a69['agentAlias'],_0x14dc84[_0x57ca('0x84')]):_0x57ca('0x85');}var _0xeb144f=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x14dc84['createdAt'])[_0x57ca('0x7a')]('MM/DD/YYYY\x20HH:mm:ss'),_0x14dc84['direction']==='in'?_0x81371f:_0xe29bcb,_0x14dc84[_0x57ca('0x2e')]);if(!_0x14dc84[_0x57ca('0x8c')]){fs[_0x57ca('0x8d')](_0x156a59,_0xeb144f);}}return db[_0x57ca('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x57ca('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x57ca('0x90')],'as':_0x57ca('0x90'),'raw':!![]}]}]});}}})[_0x57ca('0x14')](function(_0x3fbf73){if(!_0x3fbf73||!_0x3fbf73[_0x57ca('0x91')]||!_0x2a174b[_0x57ca('0x2e')])return _0x2cbdcd;var _0x5f3cf4=_0x3fbf73[_0x57ca('0x92')]();return respondWithRpcPromise(_0x57ca('0x93'),'sendMail',{'account':_0x5f3cf4,'message':{'from':util[_0x57ca('0x7a')](_0x57ca('0x94'),_0x3fbf73[_0x57ca('0x2b')],_0x3fbf73['email']||_0x3fbf73['Smtp'][_0x57ca('0x50')]),'to':_0x2a174b[_0x57ca('0x2e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2a174b[_0x57ca('0x2e')][_0x57ca('0x79')]),'attachments':[{'path':_0x156a59}]}})['then'](function(){return _0x2cbdcd;})[_0x57ca('0x1e')](function(_0x10418d){logger[_0x57ca('0x1a')](_0x10418d);});})[_0x57ca('0x14')](respondWithStatusCode(_0x17b178,0xc8))[_0x57ca('0x1e')](handleError(_0x17b178,null));};exports[_0x57ca('0x95')]=function(_0x1b0426,_0x37a04d){return db[_0x57ca('0x5e')][_0x57ca('0x43')]({'where':{'id':_0x1b0426[_0x57ca('0x48')]['id']}})[_0x57ca('0x14')](handleEntityNotFound(_0x37a04d,null))['then'](function(_0x5bdb1c){if(_0x5bdb1c){return _0x5bdb1c[_0x57ca('0x95')](_0x1b0426[_0x57ca('0x2e')][_0x57ca('0x96')],_[_0x57ca('0x97')](_0x1b0426['body'],[_0x57ca('0x96'),'id'])||{});}})['then'](respondWithResult(_0x37a04d,null))[_0x57ca('0x1e')](handleError(_0x37a04d,null));};exports['getMessages']=function(_0x3dd2aa,_0x40293e){var _0x18b2da={'raw':![],'where':{}};var _0x3cb979={};var _0x407592={'count':0x0,'rows':[]};return db[_0x57ca('0x33')][_0x57ca('0x49')]({'where':{'id':_0x3dd2aa[_0x57ca('0x48')]['id']}})[_0x57ca('0x14')](handleEntityNotFound(_0x40293e,null))['then'](function(_0x1b7cd3){if(_0x1b7cd3){_0x3cb979[_0x57ca('0x3a')]=_[_0x57ca('0x3b')](db[_0x57ca('0x5e')][_0x57ca('0x98')]);_0x3cb979[_0x57ca('0x39')]=_[_0x57ca('0x3b')](_0x3dd2aa[_0x57ca('0x39')]);_0x3cb979[_0x57ca('0x3c')]=_[_0x57ca('0x3d')](_0x3cb979['model'],_0x3cb979[_0x57ca('0x39')]);_0x18b2da[_0x57ca('0x3e')]=_['intersection'](_0x3cb979['model'],qs[_0x57ca('0x3f')](_0x3dd2aa['query'][_0x57ca('0x3f')]));_0x18b2da['attributes']=_0x18b2da['attributes'][_0x57ca('0x40')]?_0x18b2da[_0x57ca('0x3e')]:_0x3cb979[_0x57ca('0x3a')];if(!_0x3dd2aa[_0x57ca('0x39')][_0x57ca('0x99')](_0x57ca('0x9a'))){_0x18b2da[_0x57ca('0x26')]=qs['limit'](_0x3dd2aa['query'][_0x57ca('0x26')]);_0x18b2da[_0x57ca('0x23')]=qs[_0x57ca('0x23')](_0x3dd2aa[_0x57ca('0x39')]['offset']);}_0x18b2da[_0x57ca('0x9b')]=qs[_0x57ca('0x9c')](_0x3dd2aa[_0x57ca('0x39')][_0x57ca('0x9c')]);_0x18b2da['where']=qs[_0x57ca('0x3c')](_[_0x57ca('0x9d')](_0x3dd2aa['query'],_0x3cb979[_0x57ca('0x3c')]));_0x18b2da[_0x57ca('0x9e')][_0x57ca('0x9f')]=_0x1b7cd3['id'];if(_0x3dd2aa['query'][_0x57ca('0xa0')]){_0x18b2da[_0x57ca('0x9e')]=_[_0x57ca('0x2d')](_0x18b2da[_0x57ca('0x9e')],{'$or':_[_0x57ca('0x32')](_0x18b2da[_0x57ca('0x3e')],function(_0x4f7196){var _0x22bb50={};_0x22bb50[_0x4f7196]={'$like':'%'+_0x3dd2aa[_0x57ca('0x39')][_0x57ca('0xa0')]+'%'};return _0x22bb50;})});}if(_0x3dd2aa['query'][_0x57ca('0xa1')]){var _0x5508b7=_0x3dd2aa[_0x57ca('0x39')][_0x57ca('0xa1')][_0x57ca('0xa2')](',');var _0x89f541={};_0x89f541[_0x5508b7[0x0]]={'$gte':moment(_0x5508b7[0x1])[_0x57ca('0x7a')](_0x57ca('0xa3'))};_0x18b2da[_0x57ca('0x9e')]=_[_0x57ca('0x2d')](_0x18b2da['where'],_0x89f541);}_0x18b2da=_[_0x57ca('0x2d')]({},_0x18b2da,_0x3dd2aa[_0x57ca('0xa4')]);return db['ChatMessage'][_0x57ca('0x25')]({'where':_0x18b2da['where']})[_0x57ca('0x14')](function(_0x344f6f){_0x407592[_0x57ca('0x25')]=_0x344f6f;if(_0x3dd2aa[_0x57ca('0x39')][_0x57ca('0x41')]){_0x18b2da['include']=[{'all':!![]}];}return db['ChatMessage'][_0x57ca('0x37')](_0x18b2da);})[_0x57ca('0x14')](function(_0x3fdb03){_0x407592[_0x57ca('0xa5')]=_0x3fdb03;return _0x407592;});}})['then'](respondWithFilteredResult(_0x40293e,_0x18b2da))[_0x57ca('0x1e')](handleError(_0x40293e,null));};exports[_0x57ca('0xa6')]=function(_0x3f71f2,_0x1fb929){var _0x40ce50={'where':{}},_0x50869d={},_0xafa3fe={'count':0x0,'rows':[]};return db[_0x57ca('0x33')][_0x57ca('0x49')]({'where':{'id':_0x3f71f2[_0x57ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1fb929,null))[_0x57ca('0x14')](function(_0x31007e){if(_0x31007e){_0x50869d['model']=_[_0x57ca('0x3b')](db[_0x57ca('0x5e')][_0x57ca('0x98')]);_0x50869d['query']=_[_0x57ca('0x3b')](_0x3f71f2[_0x57ca('0x39')]);_0x50869d[_0x57ca('0x3c')]=_[_0x57ca('0x3d')](_0x50869d[_0x57ca('0x3a')],_0x50869d[_0x57ca('0x39')]);_0x40ce50[_0x57ca('0x3e')]=_['intersection'](_0x50869d[_0x57ca('0x3a')],qs[_0x57ca('0x3f')](_0x3f71f2[_0x57ca('0x39')][_0x57ca('0x3f')]));_0x40ce50['attributes']=_0x40ce50[_0x57ca('0x3e')][_0x57ca('0x40')]?_0x40ce50[_0x57ca('0x3e')]:_0x50869d['model'];if(!_0x3f71f2[_0x57ca('0x39')][_0x57ca('0x99')](_0x57ca('0x9a'))){_0x40ce50[_0x57ca('0x26')]=qs[_0x57ca('0x26')](_0x3f71f2[_0x57ca('0x39')][_0x57ca('0x26')]);_0x40ce50['offset']=qs['offset'](_0x3f71f2[_0x57ca('0x39')][_0x57ca('0x23')]);}_0x40ce50['order']=qs[_0x57ca('0x9c')](_0x3f71f2[_0x57ca('0x39')][_0x57ca('0x9c')]);_0x40ce50['where']=qs[_0x57ca('0x3c')](_[_0x57ca('0x9d')](_0x3f71f2[_0x57ca('0x39')],_0x50869d[_0x57ca('0x3c')]));_0x40ce50['where']['ChatInteractionId']=_0x31007e['id'];if(_0x3f71f2[_0x57ca('0x39')][_0x57ca('0xa0')]){_0x40ce50[_0x57ca('0x9e')]=_[_0x57ca('0x2d')](_0x40ce50['where'],{'$or':_[_0x57ca('0x32')](_0x40ce50[_0x57ca('0x3e')],function(_0x27b455){var _0x313c9e={};_0x313c9e[_0x27b455]={'$like':'%'+_0x3f71f2['query']['filter']+'%'};return _0x313c9e;})});}_0x40ce50[_0x57ca('0x9e')][_0x57ca('0x8c')]=![];if(_0x3f71f2[_0x57ca('0x39')]['id']){_0x40ce50[_0x57ca('0x9e')]['id']={'$gt':_0x3f71f2['query']['id']};}_0x40ce50=_[_0x57ca('0x2d')]({},_0x40ce50,_0x3f71f2[_0x57ca('0xa4')]);return db['ChatMessage'][_0x57ca('0x25')]({'where':_0x40ce50['where']})[_0x57ca('0x14')](function(_0x1be26a){_0xafa3fe[_0x57ca('0x25')]=_0x1be26a;_0x40ce50[_0x57ca('0x42')]=[];if(_0x3f71f2[_0x57ca('0x39')][_0x57ca('0xa7')]){_0x40ce50[_0x57ca('0x42')][_0x57ca('0xa8')]({'model':db[_0x57ca('0x7e')],'as':_0x57ca('0x7e'),'attributes':['id',_0x57ca('0x51'),'alias']});}if(_0x3f71f2['query']['includeAll']){_0x40ce50[_0x57ca('0x42')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x40ce50);})[_0x57ca('0x14')](function(_0x1af4a2){_0xafa3fe[_0x57ca('0xa5')]=_0x1af4a2;return _0xafa3fe;});}})['then'](respondWithFilteredResult(_0x1fb929,_0x40ce50))[_0x57ca('0x1e')](handleError(_0x1fb929,null));};exports[_0x57ca('0xa9')]=function(_0x262b23,_0x318adf){return db['ChatInteraction'][_0x57ca('0x43')]({'where':{'id':_0x262b23[_0x57ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x318adf,null))[_0x57ca('0x14')](function(_0x20f504){if(_0x20f504){return _0x20f504[_0x57ca('0xaa')](_0x262b23[_0x57ca('0x2e')]['ids'],_['omit'](_0x262b23[_0x57ca('0x2e')],[_0x57ca('0x96'),'id'])||{})['spread'](function(){return db['Tag'][_0x57ca('0x37')]({'attributes':['id',_0x57ca('0x2b'),_0x57ca('0xab')],'where':{'id':_0x262b23[_0x57ca('0x2e')]['ids']}});})[_0x57ca('0x14')](function(_0x5e51e7){socket[_0x57ca('0xac')](_0x57ca('0xad'),{'id':Number(_0x262b23[_0x57ca('0x48')]['id']),'tags':_0x5e51e7||[]});return{'id':Number(_0x262b23[_0x57ca('0x48')]['id']),'tags':_0x5e51e7||[]};});}})['then'](respondWithResult(_0x318adf,null))[_0x57ca('0x1e')](handleError(_0x318adf,null));};exports[_0x57ca('0xae')]=function(_0x56b284,_0x4c86b1){return db[_0x57ca('0x33')]['find']({'where':{'id':_0x56b284[_0x57ca('0x48')]['id']}})[_0x57ca('0x14')](handleEntityNotFound(_0x4c86b1,null))['then'](function(_0x5809e4){if(_0x5809e4){return _0x5809e4['removeTags'](_0x56b284[_0x57ca('0x39')][_0x57ca('0x96')]);}})[_0x57ca('0x14')](respondWithStatusCode(_0x4c86b1,null))[_0x57ca('0x1e')](handleError(_0x4c86b1,null));};exports[_0x57ca('0x77')]=function(_0x4340a7,_0x3ac217){var _0x3d2771=moment()['unix']()[_0x57ca('0xaf')]();var _0x158349=path[_0x57ca('0x72')](config[_0x57ca('0x73')],_0x57ca('0xb0'),_0x57ca('0xb1'),_0x57ca('0xb2'));var _0x43585b=path[_0x57ca('0x72')](config[_0x57ca('0x73')],_0x57ca('0xb0'),_0x57ca('0xb1'),_0x57ca('0xb3'));var _0xf92680=path[_0x57ca('0x72')](_0x158349,_0x3d2771);var _0x2e895d=util[_0x57ca('0x7a')](_0x57ca('0xb4'),_0x4340a7[_0x57ca('0x48')]['id'],_0x3d2771);var _0x458c97=path[_0x57ca('0x72')](_0x158349,_0x2e895d);var _0x4fc78e=[];_0x4fc78e[_0x57ca('0xa8')]({'model':db[_0x57ca('0x7e')],'as':_0x57ca('0x7e'),'attributes':['id',_0x57ca('0x51')],'raw':!![]});_0x4fc78e[_0x57ca('0xa8')]({'model':db[_0x57ca('0x7f')],'as':_0x57ca('0x62'),'attributes':['id',_0x57ca('0xb5'),_0x57ca('0xb6')],'raw':!![]});if(_0x4340a7[_0x57ca('0x39')]['attachments']){_0x4fc78e[_0x57ca('0xa8')]({'model':db[_0x57ca('0x6f')],'as':_0x57ca('0x6f'),'raw':!![]});}var _0x4d27da=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x57ca('0x2e'),_0x57ca('0xb7'),_0x57ca('0xb8'),_0x57ca('0x8c'),_0x57ca('0xb9')],'include':_0x4fc78e}];_0x4d27da[_0x57ca('0xa8')]({'model':db[_0x57ca('0x4a')],'as':_0x57ca('0xba'),'attributes':['id',_0x57ca('0x2b')]});_0x4d27da[_0x57ca('0xa8')]({'model':db[_0x57ca('0x7e')],'as':_0x57ca('0xbb'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x57ca('0x43')]({'where':{'id':_0x4340a7[_0x57ca('0x48')]['id']},'include':_0x4d27da})[_0x57ca('0x14')](handleEntityNotFound(_0x3ac217,null))['then'](function(_0x227bb0){if(_0x227bb0){var _0x28fb12=_0x227bb0['get']({'plain':!![]});fs[_0x57ca('0xbc')](_0xf92680);var _0x648547={'channel':_0x57ca('0xbd'),'account':_0x28fb12[_0x57ca('0xba')]['name'],'agent':_0x28fb12[_0x57ca('0xbb')]?_0x28fb12[_0x57ca('0xbb')]['fullname']:'N.A.','createdAt':moment(_0x28fb12['createdAt'])[_0x57ca('0x7a')](_0x57ca('0xa3'))[_0x57ca('0xaf')](),'closedAt':_0x28fb12[_0x57ca('0x66')]?moment(_0x28fb12[_0x57ca('0xbe')])[_0x57ca('0x7a')](_0x57ca('0xa3'))[_0x57ca('0xaf')]():'','disposition':_0x28fb12['disposition'],'chatInfo':{'browser':_0x28fb12['browserName'],'os':_0x28fb12['osName'],'referer':_0x28fb12['referer'],'customerIp':_0x28fb12[_0x57ca('0xbf')],'customerPort':_0x28fb12[_0x57ca('0xc0')]?_0x28fb12[_0x57ca('0xc0')]:'N.A.'},'messages':_(_0x28fb12[_0x57ca('0x81')])['tail']()['filter']({'secret':![]})[_0x57ca('0x32')](function(_0x43260b){if(_0x43260b[_0x57ca('0x6f')]){var _0x57c6e6=path[_0x57ca('0x72')](_0x43585b,_0x43260b[_0x57ca('0x6f')][_0x57ca('0x76')]);if(fs[_0x57ca('0xc1')](_0x57c6e6)){fs[_0x57ca('0xc2')](_0x57c6e6)[_0x57ca('0xc3')](fs[_0x57ca('0xc4')](path[_0x57ca('0x72')](_0xf92680,_0x43260b[_0x57ca('0x6f')][_0x57ca('0x76')])));}}return{'date':moment(_0x43260b['createdAt'])[_0x57ca('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x57ca('0xaf')](),'sender':_0x43260b[_0x57ca('0xb8')]==='out'?_0x43260b['User']?_0x43260b[_0x57ca('0x7e')][_0x57ca('0x51')]:'System':_0x43260b[_0x57ca('0x62')][_0x57ca('0xb5')]+(_0x43260b['Contact'][_0x57ca('0xb6')]?'\x20'+_0x43260b['Contact'][_0x57ca('0xb6')]:''),'body':_0x43260b['Attachment']?_0x43260b[_0x57ca('0x6f')][_0x57ca('0x76')]:_0x43260b[_0x57ca('0x2e')],'direction':_0x43260b[_0x57ca('0xb8')]===_0x57ca('0x5d')?'A':'C','secret':_0x43260b[_0x57ca('0x8c')],'read':_0x43260b[_0x57ca('0xb9')],'attachment':_0x43260b['Attachment']};})[_0x57ca('0xc5')]()};return ejs[_0x57ca('0xc6')](path[_0x57ca('0x72')](config['root'],_0x57ca('0xb0'),_0x57ca('0xc7'),'downloadInteraction.ejs'),{'interaction':_0x648547})[_0x57ca('0x14')](function(_0x410707){var _0x15b2d7=path[_0x57ca('0x72')](_0xf92680,_0x57ca('0xc8')+_0x28fb12['id']+'-'+_0x3d2771+_0x57ca('0xc9'));var _0x4ceb9f={'path':_0x15b2d7,'channel':'Chat','interactionId':_0x28fb12['id']};return pdf['createPdfFromHTML'](_0x410707,_0x4ceb9f);})[_0x57ca('0x14')](function(){return new Promise(function(_0x38f951,_0x359364){zipdir(_0xf92680,{'saveTo':_0x458c97},function(_0x28705d,_0x463919){if(_0x28705d)return _0x359364(_0x28705d);return _0x38f951(_0x463919);});})[_0x57ca('0x14')](function(){return new BPromise(function(_0x1b8dd9,_0xc747cf){rimraf(_0xf92680,function(_0x36bde0){if(_0x36bde0)_0xc747cf(_0x36bde0);return _0x1b8dd9();});});})[_0x57ca('0x14')](function(){return _0x3ac217['download'](_0x458c97,_0x2e895d,function(_0x2276bd){if(_0x2276bd){logger[_0x57ca('0x1a')](_0x57ca('0xca'),_0x2276bd);}else{fs[_0x57ca('0xcb')](_0x458c97);}});});});}else{return _0x3ac217[_0x57ca('0x1f')](0xc8);}})[_0x57ca('0x1e')](handleError(_0x3ac217,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a339373..79c9557 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 _0x04cc=['then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','remove','getUsers'];(function(_0x4d88ac,_0x14bbd5){var _0xffa7de=function(_0x8b9497){while(--_0x8b9497){_0x4d88ac['push'](_0x4d88ac['shift']());}};_0xffa7de(++_0x14bbd5);}(_0x04cc,0x11a));var _0xc04c=function(_0x5bfaa7,_0x404773){_0x5bfaa7=_0x5bfaa7-0x0;var _0xe1b1a3=_0x04cc[_0x5bfaa7];return _0xe1b1a3;};'use strict';var EventEmitter=require(_0xc04c('0x0'));var ChatInteraction=require(_0xc04c('0x1'))['db'][_0xc04c('0x2')];var ChatMessage=require(_0xc04c('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc04c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc04c('0x4')};function emitEvent(_0x2fefd7){return function(_0x153c93,_0x14ac09,_0x28d35d){_0x153c93[_0xc04c('0x5')]({'attributes':['id'],'raw':!![]})[_0xc04c('0x6')](function(_0x5a6076){_0x153c93[_0xc04c('0x7')](_0xc04c('0x8'),_0x5a6076[_0xc04c('0x9')](function(_0x26a695){return{'id':_0x26a695['id']};}));return ChatMessage[_0xc04c('0xa')]({'where':{'ChatInteractionId':_0x153c93['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc04c('0x6')](function(_0x1c363d){_0x153c93[_0xc04c('0x7')]('unreadMessages',_0x1c363d['length']);ChatInteractionEvents[_0xc04c('0xb')](_0x2fefd7+':'+_0x153c93['id'],_0x153c93);ChatInteractionEvents[_0xc04c('0xb')](_0x2fefd7,_0x153c93);_0x28d35d(null);})[_0xc04c('0xc')](_0x28d35d(null));};}for(var e in events){if(events[_0xc04c('0xd')](e)){var event=events[e];ChatInteraction[_0xc04c('0xe')](e,emitEvent(event));}}module[_0xc04c('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xb5b5=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','update'];(function(_0xe93def,_0x3c2c71){var _0x3f688a=function(_0x5a0bac){while(--_0x5a0bac){_0xe93def['push'](_0xe93def['shift']());}};_0x3f688a(++_0x3c2c71);}(_0xb5b5,0x15b));var _0x5b5b=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xb5b5[_0x35ef6b];return _0x3ad145;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x5b5b('0x0'))['db'][_0x5b5b('0x1')];var ChatMessage=require(_0x5b5b('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5b5b('0x2')](0x0);var events={'afterCreate':_0x5b5b('0x3'),'afterUpdate':_0x5b5b('0x4'),'afterDestroy':_0x5b5b('0x5')};function emitEvent(_0x38dc0c){return function(_0x2536d2,_0x15d8c0,_0x25d0f1){_0x2536d2[_0x5b5b('0x6')]({'attributes':['id'],'raw':!![]})[_0x5b5b('0x7')](function(_0x8b3f05){_0x2536d2[_0x5b5b('0x8')]('Users',_0x8b3f05[_0x5b5b('0x9')](function(_0x122d55){return{'id':_0x122d55['id']};}));return ChatMessage[_0x5b5b('0xa')]({'where':{'ChatInteractionId':_0x2536d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b5b('0x7')](function(_0x1d1a13){_0x2536d2['setDataValue'](_0x5b5b('0xb'),_0x1d1a13[_0x5b5b('0xc')]);ChatInteractionEvents['emit'](_0x38dc0c+':'+_0x2536d2['id'],_0x2536d2);ChatInteractionEvents['emit'](_0x38dc0c,_0x2536d2);_0x25d0f1(null);})[_0x5b5b('0xd')](_0x25d0f1(null));};}for(var e in events){if(events[_0x5b5b('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5b5b('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 0dc3163..4447401 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 _0x42e7=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x15e051,_0x1b608d){var _0x3c1a38=function(_0x31db8b){while(--_0x31db8b){_0x15e051['push'](_0x15e051['shift']());}};_0x3c1a38(++_0x1b608d);}(_0x42e7,0xeb));var _0x742e=function(_0x5a2d9f,_0x17dc02){_0x5a2d9f=_0x5a2d9f-0x0;var _0x583a2c=_0x42e7[_0x5a2d9f];return _0x583a2c;};'use strict';var _=require('lodash');var util=require(_0x742e('0x0'));var logger=require('../../config/logger')(_0x742e('0x1'));var moment=require(_0x742e('0x2'));var BPromise=require(_0x742e('0x3'));var rp=require(_0x742e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x742e('0x5'));var config=require(_0x742e('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x742e('0x7')]=function(_0x148c38,_0xda4462){return _0x148c38[_0x742e('0x8')](_0x742e('0x9'),attributes,{'tableName':_0x742e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x131bc5,_0x551a07,_0x1fcd96){if(_0x131bc5[_0x742e('0xb')](_0x742e('0xc'))){_0x131bc5[_0x742e('0xd')]=moment()[_0x742e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fcd96(null,_0x131bc5);}},'charset':_0x742e('0xf'),'collate':_0x742e('0x10')});}; \ No newline at end of file +var _0xb902=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xbd4254,_0x31c08b){var _0x46c0f3=function(_0xd0dce7){while(--_0xd0dce7){_0xbd4254['push'](_0xbd4254['shift']());}};_0x46c0f3(++_0x31c08b);}(_0xb902,0x1e8));var _0x2b90=function(_0x379062,_0x25a617){_0x379062=_0x379062-0x0;var _0x4f9acd=_0xb902[_0x379062];return _0x4f9acd;};'use strict';var _=require(_0x2b90('0x0'));var util=require('util');var logger=require(_0x2b90('0x1'))(_0x2b90('0x2'));var moment=require(_0x2b90('0x3'));var BPromise=require(_0x2b90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b90('0x5'));var rimraf=require(_0x2b90('0x6'));var config=require(_0x2b90('0x7'));var attributes=require(_0x2b90('0x8'));module[_0x2b90('0x9')]=function(_0xb6bff4,_0x407032){return _0xb6bff4['define'](_0x2b90('0xa'),attributes,{'tableName':_0x2b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdbef19,_0x533906,_0x356523){if(_0xdbef19[_0x2b90('0xc')]('closed')){_0xdbef19[_0x2b90('0xd')]=moment()[_0x2b90('0xe')](_0x2b90('0xf'));}_0x356523(null,_0xdbef19);}},'charset':_0x2b90('0x10'),'collate':_0x2b90('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 25e7f07..b659e2c 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 _0x8e49=['http','redis','localhost','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','update','options','where','attributes','limit','then','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','ChatInteraction','addTags','omit','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x44089b,_0x94258a){var _0x3df97b=function(_0x5e8b17){while(--_0x5e8b17){_0x44089b['push'](_0x44089b['shift']());}};_0x3df97b(++_0x94258a);}(_0x8e49,0xc0));var _0x98e4=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x8e49[_0xd39959];return _0x1ff69c;};'use strict';var _=require(_0x98e4('0x0'));var util=require(_0x98e4('0x1'));var moment=require(_0x98e4('0x2'));var BPromise=require(_0x98e4('0x3'));var rs=require(_0x98e4('0x4'));var fs=require('fs');var Redis=require(_0x98e4('0x5'));var db=require(_0x98e4('0x6'))['db'];var utils=require(_0x98e4('0x7'));var logger=require(_0x98e4('0x8'))(_0x98e4('0x9'));var config=require(_0x98e4('0xa'));var jayson=require(_0x98e4('0xb'));var client=jayson[_0x98e4('0xc')][_0x98e4('0xd')]({'port':0x232a});config[_0x98e4('0xe')]=_['defaults'](config[_0x98e4('0xe')],{'host':_0x98e4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3abc85,_0x3bd1f0,_0x4ece51){return new BPromise(function(_0x21b090,_0x38498a){return client[_0x98e4('0x10')](_0x3abc85,_0x4ece51)['then'](function(_0x52d2d7){logger['info'](_0x98e4('0x11'),_0x3bd1f0,_0x98e4('0x12'));logger[_0x98e4('0x13')](_0x98e4('0x14'),_0x3bd1f0,_0x98e4('0x12'),JSON['stringify'](_0x52d2d7));if(_0x52d2d7['error']){if(_0x52d2d7[_0x98e4('0x15')][_0x98e4('0x16')]===0x1f4){logger['error'](_0x98e4('0x11'),_0x3bd1f0,_0x52d2d7[_0x98e4('0x15')][_0x98e4('0x17')]);return _0x38498a(_0x52d2d7[_0x98e4('0x15')]['message']);}logger[_0x98e4('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3bd1f0,_0x52d2d7['error'][_0x98e4('0x17')]);return _0x21b090(_0x52d2d7[_0x98e4('0x15')][_0x98e4('0x17')]);}else{logger[_0x98e4('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x3bd1f0,_0x98e4('0x12'));_0x21b090(_0x52d2d7['result']['message']);}})['catch'](function(_0x4704c4){logger[_0x98e4('0x15')](_0x98e4('0x11'),_0x3bd1f0,_0x4704c4);_0x38498a(_0x4704c4);});});}exports['UpdateChatInteraction']=function(_0x4795d8){var _0x269626=this;return new Promise(function(_0x2839ed,_0x82f293){return db['ChatInteraction'][_0x98e4('0x19')](_0x4795d8['body'],{'raw':_0x4795d8['options']?_0x4795d8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4795d8[_0x98e4('0x1a')]?_0x4795d8[_0x98e4('0x1a')][_0x98e4('0x1b')]||null:null,'attributes':_0x4795d8['options']?_0x4795d8[_0x98e4('0x1a')][_0x98e4('0x1c')]||null:null,'limit':_0x4795d8[_0x98e4('0x1a')]?_0x4795d8[_0x98e4('0x1a')][_0x98e4('0x1d')]||null:null})[_0x98e4('0x1e')](function(_0x368cbf){logger[_0x98e4('0x18')](_0x98e4('0x1f'),_0x4795d8);logger[_0x98e4('0x13')](_0x98e4('0x1f'),_0x4795d8,JSON[_0x98e4('0x20')](_0x368cbf));_0x2839ed(_0x368cbf);})[_0x98e4('0x21')](function(_0x58dda3){logger['error'](_0x98e4('0x1f'),_0x58dda3['message'],_0x4795d8);_0x82f293(_0x269626[_0x98e4('0x15')](0x1f4,_0x58dda3[_0x98e4('0x17')]));});});};exports[_0x98e4('0x22')]=function(_0x43a365){return new Promise(function(_0x4da46b,_0xa6cdd8){return db[_0x98e4('0x23')]['find']({'where':_0x43a365[_0x98e4('0x1a')]?_0x43a365['options']['where']||null:null})['then'](function(_0x1cc800){if(_0x1cc800){return _0x1cc800[_0x98e4('0x24')](_0x43a365['body']['ids'],_[_0x98e4('0x25')](_0x43a365[_0x98e4('0x26')],[_0x98e4('0x27'),'id'])||{});}})['spread'](function(_0x5d22f3){logger['info']('AddTags',_0x43a365);logger['debug'](_0x98e4('0x28'),_0x43a365,JSON[_0x98e4('0x20')](_0x5d22f3));_0x4da46b(_0x5d22f3);})['catch'](function(_0x1b0df5){logger[_0x98e4('0x15')](_0x98e4('0x28'),_0x1b0df5[_0x98e4('0x17')],_0x43a365);_0xa6cdd8(_this['error'](0x1f4,_0x1b0df5[_0x98e4('0x17')]));});});}; \ No newline at end of file +var _0xf068=['redis','defaults','localhost','socket.io-emitter','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateChatInteraction','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x19e317,_0x40333e){var _0x1d8b22=function(_0x51f241){while(--_0x51f241){_0x19e317['push'](_0x19e317['shift']());}};_0x1d8b22(++_0x40333e);}(_0xf068,0x153));var _0x8f06=function(_0x26d1ec,_0x35a1dd){_0x26d1ec=_0x26d1ec-0x0;var _0x1beb07=_0xf068[_0x26d1ec];return _0x1beb07;};'use strict';var _=require(_0x8f06('0x0'));var util=require(_0x8f06('0x1'));var moment=require(_0x8f06('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f06('0x3'));var fs=require('fs');var Redis=require(_0x8f06('0x4'));var db=require(_0x8f06('0x5'))['db'];var utils=require(_0x8f06('0x6'));var logger=require(_0x8f06('0x7'))(_0x8f06('0x8'));var config=require(_0x8f06('0x9'));var jayson=require(_0x8f06('0xa'));var client=jayson[_0x8f06('0xb')][_0x8f06('0xc')]({'port':0x232a});config[_0x8f06('0xd')]=_[_0x8f06('0xe')](config['redis'],{'host':_0x8f06('0xf'),'port':0x18eb});var socket=require(_0x8f06('0x10'))(new Redis(config[_0x8f06('0xd')]));require('./chatInteraction.socket')[_0x8f06('0x11')](socket);function respondWithRpcPromise(_0x5ee25d,_0x35cd92,_0x47f7c8){return new BPromise(function(_0x5c73dd,_0x4a57c1){return client['request'](_0x5ee25d,_0x47f7c8)[_0x8f06('0x12')](function(_0x13f129){logger['info'](_0x8f06('0x13'),_0x35cd92,_0x8f06('0x14'));logger['debug'](_0x8f06('0x15'),_0x35cd92,_0x8f06('0x14'),JSON['stringify'](_0x13f129));if(_0x13f129[_0x8f06('0x16')]){if(_0x13f129[_0x8f06('0x16')][_0x8f06('0x17')]===0x1f4){logger[_0x8f06('0x16')](_0x8f06('0x13'),_0x35cd92,_0x13f129[_0x8f06('0x16')]['message']);return _0x4a57c1(_0x13f129[_0x8f06('0x16')][_0x8f06('0x18')]);}logger[_0x8f06('0x16')](_0x8f06('0x13'),_0x35cd92,_0x13f129[_0x8f06('0x16')]['message']);return _0x5c73dd(_0x13f129[_0x8f06('0x16')]['message']);}else{logger[_0x8f06('0x19')](_0x8f06('0x13'),_0x35cd92,'request\x20sent');_0x5c73dd(_0x13f129[_0x8f06('0x1a')]['message']);}})['catch'](function(_0x1dd23c){logger[_0x8f06('0x16')](_0x8f06('0x13'),_0x35cd92,_0x1dd23c);_0x4a57c1(_0x1dd23c);});});}exports[_0x8f06('0x1b')]=function(_0x4088bd){var _0x3b1036=this;return new Promise(function(_0x257ea2,_0x411f6e){return db['ChatInteraction']['update'](_0x4088bd['body'],{'raw':_0x4088bd[_0x8f06('0x1c')]?_0x4088bd['options'][_0x8f06('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4088bd[_0x8f06('0x1c')]?_0x4088bd['options'][_0x8f06('0x1e')]||null:null,'attributes':_0x4088bd['options']?_0x4088bd[_0x8f06('0x1c')][_0x8f06('0x1f')]||null:null,'limit':_0x4088bd[_0x8f06('0x1c')]?_0x4088bd[_0x8f06('0x1c')][_0x8f06('0x20')]||null:null})['then'](function(_0x5b5847){logger[_0x8f06('0x19')]('UpdateChatInteraction',_0x4088bd);logger[_0x8f06('0x21')](_0x8f06('0x1b'),_0x4088bd,JSON[_0x8f06('0x22')](_0x5b5847));_0x257ea2(_0x5b5847);})[_0x8f06('0x23')](function(_0x546dfa){logger[_0x8f06('0x16')](_0x8f06('0x1b'),_0x546dfa[_0x8f06('0x18')],_0x4088bd);_0x411f6e(_0x3b1036[_0x8f06('0x16')](0x1f4,_0x546dfa[_0x8f06('0x18')]));});});};exports[_0x8f06('0x24')]=function(_0x25e02f){return new Promise(function(_0x113fb5,_0x460198){return db[_0x8f06('0x25')][_0x8f06('0x26')]({'where':_0x25e02f[_0x8f06('0x1c')]?_0x25e02f[_0x8f06('0x1c')][_0x8f06('0x1e')]||null:null})[_0x8f06('0x12')](function(_0x3a1d4c){if(_0x3a1d4c){return _0x3a1d4c[_0x8f06('0x27')](_0x25e02f['body'][_0x8f06('0x28')],_[_0x8f06('0x29')](_0x25e02f['body'],[_0x8f06('0x28'),'id'])||{});}})[_0x8f06('0x2a')](function(_0x2045b0){logger[_0x8f06('0x19')](_0x8f06('0x2b'),_0x25e02f);logger[_0x8f06('0x21')]('AddTags',_0x25e02f,JSON[_0x8f06('0x22')](_0x2045b0));_0x113fb5(_0x2045b0);})['catch'](function(_0x3021a8){logger[_0x8f06('0x16')](_0x8f06('0x2b'),_0x3021a8['message'],_0x25e02f);_0x460198(_this[_0x8f06('0x16')](0x1f4,_0x3021a8[_0x8f06('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7a637bb..b06abfd 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 _0x9e29=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x9e29,0xf4));var _0x99e2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9e29[_0x12fc8d];return _0x3f9d04;};'use strict';var ChatInteractionEvents=require(_0x99e2('0x0'));var events=[_0x99e2('0x1'),_0x99e2('0x2'),_0x99e2('0x3')];function createListener(_0x839be5,_0x21e46e){return function(_0x52a13f){_0x21e46e['emit'](_0x839be5,_0x52a13f);};}function removeListener(_0x2f37fe,_0x38d026){return function(){ChatInteractionEvents[_0x99e2('0x4')](_0x2f37fe,_0x38d026);};}exports[_0x99e2('0x5')]=function(_0x1c5d41){for(var _0x42edac=0x0,_0x19021d=events[_0x99e2('0x6')];_0x42edac<_0x19021d;_0x42edac++){var _0x14d341=events[_0x42edac];var _0x44c8fc=createListener(_0x99e2('0x7')+_0x14d341,_0x1c5d41);ChatInteractionEvents['on'](_0x14d341,_0x44c8fc);}}; \ No newline at end of file +var _0x447b=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','update','emit'];(function(_0x19c59b,_0x559eb4){var _0x32d2f7=function(_0x492074){while(--_0x492074){_0x19c59b['push'](_0x19c59b['shift']());}};_0x32d2f7(++_0x559eb4);}(_0x447b,0xe4));var _0xb447=function(_0x3991de,_0x2ffbd1){_0x3991de=_0x3991de-0x0;var _0x24d193=_0x447b[_0x3991de];return _0x24d193;};'use strict';var ChatInteractionEvents=require(_0xb447('0x0'));var events=[_0xb447('0x1'),'remove',_0xb447('0x2')];function createListener(_0x253864,_0x2a45d2){return function(_0x2108f4){_0x2a45d2[_0xb447('0x3')](_0x253864,_0x2108f4);};}function removeListener(_0xf8a88b,_0x161c5d){return function(){ChatInteractionEvents[_0xb447('0x4')](_0xf8a88b,_0x161c5d);};}exports[_0xb447('0x5')]=function(_0x1f132a){for(var _0x514a91=0x0,_0x4e0f42=events[_0xb447('0x6')];_0x514a91<_0x4e0f42;_0x514a91++){var _0x588700=events[_0x514a91];var _0x3ea00b=createListener(_0xb447('0x7')+_0x588700,_0x1f132a);ChatInteractionEvents['on'](_0x588700,_0x3ea00b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f7c7a5b..ca6ab82 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 _0x926b=['show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','originalname','replace','single','addMessage','tracked','chatinteraction:addtags','addTags','chat','update','put','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x926b,0x199));var _0xb926=function(_0x3f9729,_0x25bead){_0x3f9729=_0x3f9729-0x0;var _0x1c6055=_0x926b[_0x3f9729];return _0x1c6055;};'use strict';var multer=require(_0xb926('0x0'));var util=require('util');var path=require(_0xb926('0x1'));var timeout=require(_0xb926('0x2'));var express=require(_0xb926('0x3'));var router=express['Router']();var fs_extra=require(_0xb926('0x4'));var auth=require(_0xb926('0x5'));var interaction=require(_0xb926('0x6'));var config=require('../../config/environment');var controller=require(_0xb926('0x7'));router[_0xb926('0x8')]('/',auth[_0xb926('0x9')](),controller[_0xb926('0xa')]);router['get']('/describe',auth[_0xb926('0x9')](),controller[_0xb926('0xb')]);router['get'](_0xb926('0xc'),auth[_0xb926('0xd')](),controller[_0xb926('0xe')]);router[_0xb926('0x8')](_0xb926('0xf'),auth[_0xb926('0xd')](),controller[_0xb926('0x10')]);router['get'](_0xb926('0x11'),auth['isAuthenticated'](),controller[_0xb926('0x12')]);router['get'](_0xb926('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xb926('0x8')](_0xb926('0x14'),auth[_0xb926('0x9')](),controller[_0xb926('0x15')]);router[_0xb926('0x16')]('/',auth[_0xb926('0x9')](),controller[_0xb926('0x17')]);router[_0xb926('0x16')](_0xb926('0x18'),auth[_0xb926('0x9')](),controller[_0xb926('0x19')]);var upload=multer({'storage':multer[_0xb926('0x1a')]({'destination':function(_0x215657,_0x1e4d27,_0xc246a0){_0xc246a0(null,path['join'](config[_0xb926('0x1b')],_0xb926('0x1c')));},'filename':function(_0x19890a,_0x102b3c,_0x35d4a5){_0x35d4a5(null,util['format']('%s-%s',Date['now'](),_0x102b3c[_0xb926('0x1d')][_0xb926('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xb926('0x1f')]('file'),controller['attachmentUpload']);router[_0xb926('0x16')](_0xb926('0x11'),auth[_0xb926('0xd')](),controller[_0xb926('0x20')]);router[_0xb926('0x16')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xb926('0x21')]('chat',_0xb926('0x22')),controller[_0xb926('0x23')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xb926('0x21')](_0xb926('0x24'),'chatinteraction:update'),controller[_0xb926('0x25')]);router[_0xb926('0x26')]('/:id/custom_update',controller[_0xb926('0x27')]);router[_0xb926('0x26')](_0xb926('0x28'),auth[_0xb926('0xd')](),controller[_0xb926('0x29')]);router[_0xb926('0x26')]('/:id/close',controller['close']);router[_0xb926('0x2a')](_0xb926('0xc'),auth[_0xb926('0x9')](),interaction[_0xb926('0x21')]('chat',_0xb926('0x2b')),controller[_0xb926('0x2c')]);router[_0xb926('0x2a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xb926('0x2d')]);module[_0xb926('0x2e')]=router; \ No newline at end of file +var _0x037e=['/:id/tags','removeTags','multer','path','Router','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','tracked','chat','addTags','put','/:id','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy'];(function(_0x2e2d89,_0x4bb615){var _0x3aba90=function(_0x9daf58){while(--_0x9daf58){_0x2e2d89['push'](_0x2e2d89['shift']());}};_0x3aba90(++_0x4bb615);}(_0x037e,0x1a0));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe037('0x0'));var util=require('util');var path=require(_0xe037('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe037('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe037('0x3'));var controller=require(_0xe037('0x4'));router[_0xe037('0x5')]('/',auth[_0xe037('0x6')](),controller[_0xe037('0x7')]);router[_0xe037('0x5')](_0xe037('0x8'),auth[_0xe037('0x6')](),controller['describe']);router[_0xe037('0x5')]('/:id',auth[_0xe037('0x9')](),controller[_0xe037('0xa')]);router[_0xe037('0x5')](_0xe037('0xb'),auth[_0xe037('0x9')](),controller[_0xe037('0xc')]);router[_0xe037('0x5')]('/:id/messages',auth[_0xe037('0x6')](),controller[_0xe037('0xd')]);router['get'](_0xe037('0xe'),auth[_0xe037('0x9')](),controller[_0xe037('0xf')]);router[_0xe037('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0xe037('0x10')]);router[_0xe037('0x11')]('/',auth[_0xe037('0x6')](),controller[_0xe037('0x12')]);router[_0xe037('0x11')](_0xe037('0x13'),auth['isAuthenticated'](),controller[_0xe037('0x14')]);var upload=multer({'storage':multer[_0xe037('0x15')]({'destination':function(_0x5ef600,_0x394259,_0x566611){_0x566611(null,path[_0xe037('0x16')](config['root'],'server/files/attachments/'));},'filename':function(_0x14fe06,_0x3161d8,_0x24b57b){_0x24b57b(null,util[_0xe037('0x17')](_0xe037('0x18'),Date[_0xe037('0x19')](),_0x3161d8[_0xe037('0x1a')][_0xe037('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe037('0x11')]('/:id/attachment_upload',upload[_0xe037('0x1c')](_0xe037('0x1d')),controller[_0xe037('0x1e')]);router[_0xe037('0x11')](_0xe037('0x1f'),auth[_0xe037('0x9')](),controller['addMessage']);router[_0xe037('0x11')]('/:id/tags',auth[_0xe037('0x6')](),interaction[_0xe037('0x20')](_0xe037('0x21'),'chatinteraction:addtags'),controller[_0xe037('0x22')]);router[_0xe037('0x23')](_0xe037('0x24'),auth[_0xe037('0x6')](),interaction[_0xe037('0x20')](_0xe037('0x21'),_0xe037('0x25')),controller['update']);router[_0xe037('0x23')](_0xe037('0x26'),controller['customUpdate']);router[_0xe037('0x23')](_0xe037('0x27'),auth['isChatInteractionAuthorized'](),controller[_0xe037('0x28')]);router[_0xe037('0x23')](_0xe037('0x29'),controller['close']);router[_0xe037('0x2a')]('/:id',auth[_0xe037('0x6')](),interaction['tracked']('chat',_0xe037('0x2b')),controller['destroy']);router['delete'](_0xe037('0x2c'),auth[_0xe037('0x6')](),controller[_0xe037('0x2d')]);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 b26fd25..ca5ba88 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 _0xe199=['TEXT','INTEGER','sequelize'];(function(_0x103bae,_0x1b31e2){var _0x557e8a=function(_0x20c466){while(--_0x20c466){_0x103bae['push'](_0x103bae['shift']());}};_0x557e8a(++_0x1b31e2);}(_0xe199,0x1a6));var _0x9e19=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0xe199[_0x3f993e];return _0x39c135;};'use strict';var Sequelize=require(_0x9e19('0x0'));module['exports']={'body':{'type':Sequelize[_0x9e19('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9e19('0x2')]}}; \ No newline at end of file +var _0xc8ee=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x441fec,_0x2cba40){var _0x3ca07b=function(_0x307c67){while(--_0x307c67){_0x441fec['push'](_0x441fec['shift']());}};_0x3ca07b(++_0x2cba40);}(_0xc8ee,0x14b));var _0xec8e=function(_0x1c882f,_0x3786f6){_0x1c882f=_0x1c882f-0x0;var _0x5e01e9=_0xc8ee[_0x1c882f];return _0x5e01e9;};'use strict';var Sequelize=require(_0xec8e('0x0'));module[_0xec8e('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec8e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec8e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xec8e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 16406a9..081f6a8 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 _0xd2eb=['includeAll','include','findAll','rows','catch','show','create','body','params','destroy','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','getUsers','agent','admin','user','fullname','role','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','autoAssociation','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatInternalMessage'];(function(_0x5823e2,_0x5ec575){var _0xa50dee=function(_0x598714){while(--_0x598714){_0x5823e2['push'](_0x5823e2['shift']());}};_0xa50dee(++_0x5ec575);}(_0xd2eb,0x8d));var _0xbd2e=function(_0x4aa285,_0x1fe00d){_0x4aa285=_0x4aa285-0x0;var _0x2777ee=_0xd2eb[_0x4aa285];return _0x2777ee;};'use strict';var emlformat=require(_0xbd2e('0x0'));var rimraf=require(_0xbd2e('0x1'));var zipdir=require(_0xbd2e('0x2'));var jsonpatch=require(_0xbd2e('0x3'));var rp=require('request-promise');var moment=require(_0xbd2e('0x4'));var BPromise=require(_0xbd2e('0x5'));var Mustache=require(_0xbd2e('0x6'));var util=require(_0xbd2e('0x7'));var path=require(_0xbd2e('0x8'));var sox=require(_0xbd2e('0x9'));var csv=require(_0xbd2e('0xa'));var ejs=require(_0xbd2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbd2e('0xc'));var jsforce=require(_0xbd2e('0xd'));var deskjs=require(_0xbd2e('0xe'));var toCsv=require(_0xbd2e('0xa'));var querystring=require(_0xbd2e('0xf'));var Papa=require(_0xbd2e('0x10'));var Redis=require(_0xbd2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbd2e('0x12'));var as=require(_0xbd2e('0x13'));var hardwareService=require(_0xbd2e('0x14'));var logger=require(_0xbd2e('0x15'))('api');var utils=require(_0xbd2e('0x16'));var config=require(_0xbd2e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbd2e('0x18')]=_[_0xbd2e('0x19')](config[_0xbd2e('0x18')],{'host':_0xbd2e('0x1a'),'port':0x18eb});var socket=require(_0xbd2e('0x1b'))(new Redis(config[_0xbd2e('0x18')]));require('./chatInternalMessage.socket')[_0xbd2e('0x1c')](socket);function respondWithStatusCode(_0x45e39c,_0x38b87c){_0x38b87c=_0x38b87c||0xcc;return function(_0x238729){if(_0x238729){return _0x45e39c[_0xbd2e('0x1d')](_0x38b87c);}return _0x45e39c[_0xbd2e('0x1e')](_0x38b87c)[_0xbd2e('0x1f')]();};}function respondWithResult(_0x22d0e4,_0x4102b1){_0x4102b1=_0x4102b1||0xc8;return function(_0x2f5ab3){if(_0x2f5ab3){return _0x22d0e4[_0xbd2e('0x1e')](_0x4102b1)[_0xbd2e('0x20')](_0x2f5ab3);}};}function respondWithFilteredResult(_0x3484a7,_0x30ff99){return function(_0x1caa2c){if(_0x1caa2c){var _0x1691a3=typeof _0x30ff99['offset']==='undefined'&&typeof _0x30ff99['limit']===_0xbd2e('0x21');var _0x4a5bf8=_0x1caa2c[_0xbd2e('0x22')];var _0x3a523e=_0x1691a3?0x0:_0x30ff99[_0xbd2e('0x23')];var _0x89b3a8=_0x1691a3?_0x1caa2c[_0xbd2e('0x22')]:_0x30ff99[_0xbd2e('0x23')]+_0x30ff99[_0xbd2e('0x24')];var _0xeae289;if(_0x89b3a8>=_0x4a5bf8){_0x89b3a8=_0x4a5bf8;_0xeae289=0xc8;}else{_0xeae289=0xce;}_0x3484a7[_0xbd2e('0x1e')](_0xeae289);return _0x3484a7[_0xbd2e('0x25')](_0xbd2e('0x26'),_0x3a523e+'-'+_0x89b3a8+'/'+_0x4a5bf8)[_0xbd2e('0x20')](_0x1caa2c);}return null;};}function patchUpdates(_0x1bb30f){return function(_0x3ef12){try{jsonpatch[_0xbd2e('0x27')](_0x3ef12,_0x1bb30f,!![]);}catch(_0xd224a3){return BPromise['reject'](_0xd224a3);}return _0x3ef12[_0xbd2e('0x28')]();};}function saveUpdates(_0x37c675,_0x21d8d1){return function(_0x1f8934){if(_0x1f8934){return _0x1f8934[_0xbd2e('0x29')](_0x37c675)['then'](function(_0x4a1571){return _0x4a1571;});}return null;};}function removeEntity(_0x3341a1,_0x442888){return function(_0x162b7e){if(_0x162b7e){return _0x162b7e['destroy']()[_0xbd2e('0x2a')](function(){_0x3341a1[_0xbd2e('0x1e')](0xcc)[_0xbd2e('0x1f')]();});}};}function handleEntityNotFound(_0xda13eb,_0x2ed288){return function(_0x2c8ee9){if(!_0x2c8ee9){_0xda13eb[_0xbd2e('0x1d')](0x194);}return _0x2c8ee9;};}function handleError(_0x185113,_0xa37e75){_0xa37e75=_0xa37e75||0x1f4;return function(_0x5f1db9){logger[_0xbd2e('0x2b')](_0x5f1db9[_0xbd2e('0x2c')]);if(_0x5f1db9[_0xbd2e('0x2d')]){delete _0x5f1db9[_0xbd2e('0x2d')];}_0x185113['status'](_0xa37e75)['send'](_0x5f1db9);};}exports['index']=function(_0x5ada25,_0x3558dc){var _0x255761={},_0x4b8ef={},_0x222468={'count':0x0,'rows':[]};var _0x333582=_['map'](db['ChatInternalMessage'][_0xbd2e('0x2e')],function(_0xb721d1){return{'name':_0xb721d1['fieldName'],'type':_0xb721d1['type'][_0xbd2e('0x2f')]};});_0x4b8ef[_0xbd2e('0x30')]=_[_0xbd2e('0x31')](_0x333582,_0xbd2e('0x2d'));_0x4b8ef[_0xbd2e('0x32')]=_[_0xbd2e('0x33')](_0x5ada25[_0xbd2e('0x32')]);_0x4b8ef[_0xbd2e('0x34')]=_[_0xbd2e('0x35')](_0x4b8ef[_0xbd2e('0x30')],_0x4b8ef[_0xbd2e('0x32')]);_0x255761[_0xbd2e('0x36')]=_['intersection'](_0x4b8ef[_0xbd2e('0x30')],qs['fields'](_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x37')]));_0x255761[_0xbd2e('0x36')]=_0x255761[_0xbd2e('0x36')][_0xbd2e('0x38')]?_0x255761[_0xbd2e('0x36')]:_0x4b8ef[_0xbd2e('0x30')];if(!_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x39')](_0xbd2e('0x3a'))){_0x255761['limit']=qs[_0xbd2e('0x24')](_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x24')]);_0x255761[_0xbd2e('0x23')]=qs['offset'](_0x5ada25[_0xbd2e('0x32')]['offset']);}_0x255761[_0xbd2e('0x3b')]=qs[_0xbd2e('0x3c')](_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x3c')]);_0x255761['where']=qs['filters'](_[_0xbd2e('0x3d')](_0x5ada25[_0xbd2e('0x32')],_0x4b8ef['filters']),_0x333582);if(_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x3e')]){_0x255761[_0xbd2e('0x3f')]=_[_0xbd2e('0x40')](_0x255761[_0xbd2e('0x3f')],{'$or':_[_0xbd2e('0x31')](_0x333582,function(_0x2f10bd){if(_0x2f10bd[_0xbd2e('0x41')]!==_0xbd2e('0x42')){var _0x203608={};_0x203608[_0x2f10bd[_0xbd2e('0x2d')]]={'$like':'%'+_0x5ada25[_0xbd2e('0x32')]['filter']+'%'};return _0x203608;}})});}_0x255761=_[_0xbd2e('0x40')]({},_0x255761,_0x5ada25[_0xbd2e('0x43')]);var _0x1f53bc={'where':_0x255761[_0xbd2e('0x3f')]};return db[_0xbd2e('0x44')][_0xbd2e('0x22')](_0x1f53bc)[_0xbd2e('0x2a')](function(_0x1b112e){_0x222468[_0xbd2e('0x22')]=_0x1b112e;if(_0x5ada25[_0xbd2e('0x32')][_0xbd2e('0x45')]){_0x255761[_0xbd2e('0x46')]=[{'all':!![]}];}return db[_0xbd2e('0x44')][_0xbd2e('0x47')](_0x255761);})[_0xbd2e('0x2a')](function(_0x2a1cab){_0x222468[_0xbd2e('0x48')]=_0x2a1cab;return _0x222468;})[_0xbd2e('0x2a')](respondWithFilteredResult(_0x3558dc,_0x255761))[_0xbd2e('0x49')](handleError(_0x3558dc,null));};exports[_0xbd2e('0x4a')]=function(_0x5556c5,_0xf14e3){var _0x465bff={'raw':!![],'where':{'id':_0x5556c5['params']['id']}},_0x47a9e3={};_0x47a9e3['model']=_[_0xbd2e('0x33')](db[_0xbd2e('0x44')][_0xbd2e('0x2e')]);_0x47a9e3[_0xbd2e('0x32')]=_['keys'](_0x5556c5[_0xbd2e('0x32')]);_0x47a9e3[_0xbd2e('0x34')]=_[_0xbd2e('0x35')](_0x47a9e3[_0xbd2e('0x30')],_0x47a9e3[_0xbd2e('0x32')]);_0x465bff[_0xbd2e('0x36')]=_[_0xbd2e('0x35')](_0x47a9e3[_0xbd2e('0x30')],qs[_0xbd2e('0x37')](_0x5556c5[_0xbd2e('0x32')][_0xbd2e('0x37')]));_0x465bff[_0xbd2e('0x36')]=_0x465bff['attributes'][_0xbd2e('0x38')]?_0x465bff[_0xbd2e('0x36')]:_0x47a9e3[_0xbd2e('0x30')];if(_0x5556c5['query'][_0xbd2e('0x45')]){_0x465bff['include']=[{'all':!![]}];}_0x465bff=_[_0xbd2e('0x40')]({},_0x465bff,_0x5556c5['options']);return db[_0xbd2e('0x44')]['find'](_0x465bff)[_0xbd2e('0x2a')](handleEntityNotFound(_0xf14e3,null))[_0xbd2e('0x2a')](respondWithResult(_0xf14e3,null))[_0xbd2e('0x49')](handleError(_0xf14e3,null));};exports['create']=function(_0x47191c,_0x3564e4){return db[_0xbd2e('0x44')][_0xbd2e('0x4b')](_0x47191c[_0xbd2e('0x4c')],{})[_0xbd2e('0x2a')](respondWithResult(_0x3564e4,0xc9))[_0xbd2e('0x49')](handleError(_0x3564e4,null));};exports[_0xbd2e('0x29')]=function(_0x42a0ac,_0x2dee9d){if(_0x42a0ac[_0xbd2e('0x4c')]['id']){delete _0x42a0ac['body']['id'];}return db[_0xbd2e('0x44')]['find']({'where':{'id':_0x42a0ac[_0xbd2e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2dee9d,null))[_0xbd2e('0x2a')](saveUpdates(_0x42a0ac[_0xbd2e('0x4c')],null))[_0xbd2e('0x2a')](respondWithResult(_0x2dee9d,null))[_0xbd2e('0x49')](handleError(_0x2dee9d,null));};exports[_0xbd2e('0x4e')]=function(_0x3af300,_0x46935b){return db[_0xbd2e('0x44')][_0xbd2e('0x4f')]({'where':{'id':_0x3af300['params']['id']}})[_0xbd2e('0x2a')](handleEntityNotFound(_0x46935b,null))[_0xbd2e('0x2a')](removeEntity(_0x46935b,null))[_0xbd2e('0x49')](handleError(_0x46935b,null));};exports['describe']=function(_0x2f958a,_0x5c2a36){return db[_0xbd2e('0x44')][_0xbd2e('0x50')]()[_0xbd2e('0x2a')](respondWithResult(_0x5c2a36,null))[_0xbd2e('0x49')](handleError(_0x5c2a36,null));};function wrapUser(_0x524211){return function(_0x57e5b7){var _0x1973b4=_0x524211[_0xbd2e('0x51')]({'plain':!![]});_0x1973b4[_0xbd2e('0x52')]=[];if(_0x57e5b7){_0x1973b4[_0xbd2e('0x53')]=_0x57e5b7[_0xbd2e('0x54')];_0x1973b4[_0xbd2e('0x55')]=_0x57e5b7;}else{_0x1973b4[_0xbd2e('0x53')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1973b4[_0xbd2e('0x55')]={};}return _0x1973b4;};}exports[_0xbd2e('0x56')]=function(_0x5c1e32,_0x2b0d68,_0x26acc3){var _0xe93241=[];return db['User'][_0xbd2e('0x47')]({'where':{'role':[_0xbd2e('0x57'),_0xbd2e('0x58'),_0xbd2e('0x59')]},'attributes':['id',_0xbd2e('0x5a'),'name',_0xbd2e('0x5b'),'userpic','internal',_0xbd2e('0x5c'),'lastLoginAt',_0xbd2e('0x5d'),_0xbd2e('0x5e')],'order':qs[_0xbd2e('0x3c')](_0xbd2e('0x5f')),'include':[{'model':db[_0xbd2e('0x60')],'as':_0xbd2e('0x61'),'attributes':['id',_0xbd2e('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xbd2e('0x2a')](function(_0x21cae3){if(_0x21cae3){var _0x2606ae=_0x5c1e32['user']['get']({'plain':!![]});if(!_0x2606ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2606ae['role']===_0xbd2e('0x59')){return db['UserProfileSection'][_0xbd2e('0x4f')]({'where':{'name':'Agents','userProfileId':_0x2606ae['userProfileId']},'raw':!![]})[_0xbd2e('0x2a')](function(_0x229303){if(_0x229303){if(_0x229303[_0xbd2e('0x62')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x229303['id']},'raw':!![]})[_0xbd2e('0x2a')](function(_0x4291e2){var _0x1b3c74=[];if(_['isEmpty'](_0x4291e2)){_0x1b3c74=_[_0xbd2e('0x3e')](_0x21cae3,function(_0x2e4602){if(_0x2e4602[_0xbd2e('0x5b')]!==_0xbd2e('0x57')){return _0x2e4602;}});return _0x1b3c74;}else{for(var _0x25379f=0x0;_0x25379f<_0x21cae3[_0xbd2e('0x38')];_0x25379f++){var _0x26b3f0=_0x21cae3[_0x25379f];if(_0x26b3f0[_0xbd2e('0x5b')]===_0xbd2e('0x57')){var _0x525c0c=_[_0xbd2e('0x4f')](_0x4291e2,function(_0x1ab281){return _0x1ab281[_0xbd2e('0x63')]===_0x26b3f0['id'];});if(_0x525c0c)_0x1b3c74[_0xbd2e('0x64')](_0x26b3f0);}else{_0x1b3c74[_0xbd2e('0x64')](_0x26b3f0);}}return _0x1b3c74;}});}else{return _0x21cae3;}}else{var _0x5b2bbf=_[_0xbd2e('0x3e')](_0x21cae3,function(_0x3278e8){if(_0x3278e8[_0xbd2e('0x5b')]!=='agent'){return _0x3278e8;}});return _0x5b2bbf;}});}else{return _0x21cae3;}}})[_0xbd2e('0x2a')](function(_0x4881b8){var _0x20c716=[];if(_0x4881b8){_0xe93241=_0x4881b8;for(var _0x36631b=0x0;_0x36631b<_0x4881b8['length'];_0x36631b+=0x1){_0xe93241[_0x36631b][_0xbd2e('0x52')]=[];_0x20c716[_0xbd2e('0x64')](db[_0xbd2e('0x44')][_0xbd2e('0x4f')]({'where':{'FromId':[_0x5c1e32[_0xbd2e('0x59')]['id'],_0x4881b8[_0x36631b]['id']],'ToId':[_0x5c1e32[_0xbd2e('0x59')]['id'],_0x4881b8[_0x36631b]['id']],'ChatGroupId':null},'attributes':['id',_0xbd2e('0x54'),_0xbd2e('0x65'),_0xbd2e('0x66'),_0xbd2e('0x67'),_0xbd2e('0x4c')],'order':qs['sort'](_0xbd2e('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbd2e('0x2a')](wrapUser(_0x4881b8[_0x36631b])));}return BPromise['all'](_0x20c716);}return[];})[_0xbd2e('0x2a')](function(_0x56a8a8){return{'rows':_0x56a8a8,'count':_0x56a8a8[_0xbd2e('0x38')]};})[_0xbd2e('0x2a')](respondWithResult(_0x2b0d68,null))[_0xbd2e('0x49')](handleError(_0x2b0d68,null));}; \ No newline at end of file +var _0xc63e=['../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatInternalMessage','includeAll','findAll','rows','show','length','include','find','catch','create','body','params','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','user','fullname','role','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xc63e,0x130));var _0xec63=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xc63e[_0x45346d];return _0x5ce7ca;};'use strict';var emlformat=require(_0xec63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec63('0x1'));var jsonpatch=require(_0xec63('0x2'));var rp=require(_0xec63('0x3'));var moment=require(_0xec63('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xec63('0x5'));var util=require(_0xec63('0x6'));var path=require(_0xec63('0x7'));var sox=require(_0xec63('0x8'));var csv=require(_0xec63('0x9'));var ejs=require(_0xec63('0xa'));var fs=require('fs');var fs_extra=require(_0xec63('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xec63('0xc'));var jsforce=require(_0xec63('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec63('0xe'));var Papa=require('papaparse');var Redis=require(_0xec63('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec63('0x10'));var as=require(_0xec63('0x11'));var hardwareService=require(_0xec63('0x12'));var logger=require(_0xec63('0x13'))(_0xec63('0x14'));var utils=require('../../config/utils');var config=require(_0xec63('0x15'));var licenseUtil=require(_0xec63('0x16'));var db=require(_0xec63('0x17'))['db'];config[_0xec63('0x18')]=_['defaults'](config[_0xec63('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xec63('0x19'))(new Redis(config[_0xec63('0x18')]));require(_0xec63('0x1a'))[_0xec63('0x1b')](socket);function respondWithStatusCode(_0x24ed21,_0x40e2db){_0x40e2db=_0x40e2db||0xcc;return function(_0x69374b){if(_0x69374b){return _0x24ed21['sendStatus'](_0x40e2db);}return _0x24ed21['status'](_0x40e2db)['end']();};}function respondWithResult(_0x5ed4a7,_0x265f79){_0x265f79=_0x265f79||0xc8;return function(_0x40a183){if(_0x40a183){return _0x5ed4a7[_0xec63('0x1c')](_0x265f79)[_0xec63('0x1d')](_0x40a183);}};}function respondWithFilteredResult(_0x44f0c6,_0x3930ab){return function(_0x44afc1){if(_0x44afc1){var _0x375e44=typeof _0x3930ab[_0xec63('0x1e')]===_0xec63('0x1f')&&typeof _0x3930ab[_0xec63('0x20')]===_0xec63('0x1f');var _0x235f6f=_0x44afc1[_0xec63('0x21')];var _0x1b65c3=_0x375e44?0x0:_0x3930ab['offset'];var _0x3a50f4=_0x375e44?_0x44afc1[_0xec63('0x21')]:_0x3930ab[_0xec63('0x1e')]+_0x3930ab['limit'];var _0x4a6589;if(_0x3a50f4>=_0x235f6f){_0x3a50f4=_0x235f6f;_0x4a6589=0xc8;}else{_0x4a6589=0xce;}_0x44f0c6[_0xec63('0x1c')](_0x4a6589);return _0x44f0c6[_0xec63('0x22')](_0xec63('0x23'),_0x1b65c3+'-'+_0x3a50f4+'/'+_0x235f6f)[_0xec63('0x1d')](_0x44afc1);}return null;};}function patchUpdates(_0x30b186){return function(_0x25fc8f){try{jsonpatch[_0xec63('0x24')](_0x25fc8f,_0x30b186,!![]);}catch(_0x7620f5){return BPromise[_0xec63('0x25')](_0x7620f5);}return _0x25fc8f[_0xec63('0x26')]();};}function saveUpdates(_0x3b1dbd,_0x22cde2){return function(_0x4a4c6d){if(_0x4a4c6d){return _0x4a4c6d[_0xec63('0x27')](_0x3b1dbd)[_0xec63('0x28')](function(_0x26752b){return _0x26752b;});}return null;};}function removeEntity(_0x1489d6,_0x4eb3ae){return function(_0x32ae57){if(_0x32ae57){return _0x32ae57[_0xec63('0x29')]()['then'](function(){_0x1489d6[_0xec63('0x1c')](0xcc)[_0xec63('0x2a')]();});}};}function handleEntityNotFound(_0x536f45,_0x2b5852){return function(_0x45dd92){if(!_0x45dd92){_0x536f45['sendStatus'](0x194);}return _0x45dd92;};}function handleError(_0x2b4704,_0x163637){_0x163637=_0x163637||0x1f4;return function(_0x815625){logger[_0xec63('0x2b')](_0x815625[_0xec63('0x2c')]);if(_0x815625[_0xec63('0x2d')]){delete _0x815625['name'];}_0x2b4704['status'](_0x163637)[_0xec63('0x2e')](_0x815625);};}exports[_0xec63('0x2f')]=function(_0x10b21d,_0x1c9b72){var _0x52f31f={},_0x386b9e={},_0x363a01={'count':0x0,'rows':[]};var _0x58fa74=_[_0xec63('0x30')](db['ChatInternalMessage'][_0xec63('0x31')],function(_0x58266b){return{'name':_0x58266b[_0xec63('0x32')],'type':_0x58266b[_0xec63('0x33')]['key']};});_0x386b9e[_0xec63('0x34')]=_[_0xec63('0x30')](_0x58fa74,_0xec63('0x2d'));_0x386b9e[_0xec63('0x35')]=_[_0xec63('0x36')](_0x10b21d['query']);_0x386b9e[_0xec63('0x37')]=_[_0xec63('0x38')](_0x386b9e[_0xec63('0x34')],_0x386b9e['query']);_0x52f31f['attributes']=_[_0xec63('0x38')](_0x386b9e['model'],qs[_0xec63('0x39')](_0x10b21d[_0xec63('0x35')][_0xec63('0x39')]));_0x52f31f['attributes']=_0x52f31f[_0xec63('0x3a')]['length']?_0x52f31f[_0xec63('0x3a')]:_0x386b9e[_0xec63('0x34')];if(!_0x10b21d['query'][_0xec63('0x3b')](_0xec63('0x3c'))){_0x52f31f[_0xec63('0x20')]=qs[_0xec63('0x20')](_0x10b21d[_0xec63('0x35')]['limit']);_0x52f31f['offset']=qs[_0xec63('0x1e')](_0x10b21d[_0xec63('0x35')]['offset']);}_0x52f31f['order']=qs['sort'](_0x10b21d[_0xec63('0x35')][_0xec63('0x3d')]);_0x52f31f[_0xec63('0x3e')]=qs['filters'](_[_0xec63('0x3f')](_0x10b21d[_0xec63('0x35')],_0x386b9e[_0xec63('0x37')]),_0x58fa74);if(_0x10b21d[_0xec63('0x35')][_0xec63('0x40')]){_0x52f31f[_0xec63('0x3e')]=_[_0xec63('0x41')](_0x52f31f[_0xec63('0x3e')],{'$or':_[_0xec63('0x30')](_0x58fa74,function(_0x457d15){if(_0x457d15[_0xec63('0x33')]!=='VIRTUAL'){var _0x4e39c0={};_0x4e39c0[_0x457d15[_0xec63('0x2d')]]={'$like':'%'+_0x10b21d['query'][_0xec63('0x40')]+'%'};return _0x4e39c0;}})});}_0x52f31f=_['merge']({},_0x52f31f,_0x10b21d[_0xec63('0x42')]);var _0x546f02={'where':_0x52f31f[_0xec63('0x3e')]};return db[_0xec63('0x43')][_0xec63('0x21')](_0x546f02)['then'](function(_0x2d97e9){_0x363a01['count']=_0x2d97e9;if(_0x10b21d[_0xec63('0x35')][_0xec63('0x44')]){_0x52f31f['include']=[{'all':!![]}];}return db[_0xec63('0x43')][_0xec63('0x45')](_0x52f31f);})[_0xec63('0x28')](function(_0x34faf1){_0x363a01[_0xec63('0x46')]=_0x34faf1;return _0x363a01;})[_0xec63('0x28')](respondWithFilteredResult(_0x1c9b72,_0x52f31f))['catch'](handleError(_0x1c9b72,null));};exports[_0xec63('0x47')]=function(_0x3de545,_0x489146){var _0x1dfff0={'raw':!![],'where':{'id':_0x3de545['params']['id']}},_0xeec5da={};_0xeec5da[_0xec63('0x34')]=_['keys'](db[_0xec63('0x43')][_0xec63('0x31')]);_0xeec5da[_0xec63('0x35')]=_[_0xec63('0x36')](_0x3de545[_0xec63('0x35')]);_0xeec5da[_0xec63('0x37')]=_[_0xec63('0x38')](_0xeec5da['model'],_0xeec5da['query']);_0x1dfff0[_0xec63('0x3a')]=_[_0xec63('0x38')](_0xeec5da[_0xec63('0x34')],qs['fields'](_0x3de545[_0xec63('0x35')]['fields']));_0x1dfff0[_0xec63('0x3a')]=_0x1dfff0[_0xec63('0x3a')][_0xec63('0x48')]?_0x1dfff0['attributes']:_0xeec5da[_0xec63('0x34')];if(_0x3de545['query'][_0xec63('0x44')]){_0x1dfff0[_0xec63('0x49')]=[{'all':!![]}];}_0x1dfff0=_[_0xec63('0x41')]({},_0x1dfff0,_0x3de545['options']);return db[_0xec63('0x43')][_0xec63('0x4a')](_0x1dfff0)[_0xec63('0x28')](handleEntityNotFound(_0x489146,null))[_0xec63('0x28')](respondWithResult(_0x489146,null))[_0xec63('0x4b')](handleError(_0x489146,null));};exports[_0xec63('0x4c')]=function(_0x296745,_0x78e929){return db['ChatInternalMessage'][_0xec63('0x4c')](_0x296745[_0xec63('0x4d')],{})['then'](respondWithResult(_0x78e929,0xc9))[_0xec63('0x4b')](handleError(_0x78e929,null));};exports[_0xec63('0x27')]=function(_0x42d4fc,_0x4b308c){if(_0x42d4fc['body']['id']){delete _0x42d4fc[_0xec63('0x4d')]['id'];}return db[_0xec63('0x43')][_0xec63('0x4a')]({'where':{'id':_0x42d4fc[_0xec63('0x4e')]['id']}})[_0xec63('0x28')](handleEntityNotFound(_0x4b308c,null))[_0xec63('0x28')](saveUpdates(_0x42d4fc[_0xec63('0x4d')],null))['then'](respondWithResult(_0x4b308c,null))['catch'](handleError(_0x4b308c,null));};exports[_0xec63('0x29')]=function(_0x14971a,_0x35fc79){return db['ChatInternalMessage']['find']({'where':{'id':_0x14971a[_0xec63('0x4e')]['id']}})[_0xec63('0x28')](handleEntityNotFound(_0x35fc79,null))[_0xec63('0x28')](removeEntity(_0x35fc79,null))['catch'](handleError(_0x35fc79,null));};exports['describe']=function(_0x592be0,_0x599c9a){return db['ChatInternalMessage'][_0xec63('0x4f')]()[_0xec63('0x28')](respondWithResult(_0x599c9a,null))['catch'](handleError(_0x599c9a,null));};function wrapUser(_0x46eef4){return function(_0x53d306){var _0x4b4a62=_0x46eef4['get']({'plain':!![]});_0x4b4a62[_0xec63('0x50')]=[];if(_0x53d306){_0x4b4a62[_0xec63('0x51')]=_0x53d306['createdAt'];_0x4b4a62['lastMessage']=_0x53d306;}else{_0x4b4a62['lastMessageAt']=moment(0x0)[_0xec63('0x52')](_0xec63('0x53'));_0x4b4a62[_0xec63('0x54')]={};}return _0x4b4a62;};}exports[_0xec63('0x55')]=function(_0x4db48d,_0x2344db,_0x2b065e){var _0x253f56=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0xec63('0x56')]},'attributes':['id',_0xec63('0x57'),_0xec63('0x2d'),_0xec63('0x58'),'userpic',_0xec63('0x59'),_0xec63('0x5a'),_0xec63('0x5b'),'allowmessenger',_0xec63('0x5c')],'order':qs[_0xec63('0x3d')]('-online'),'include':[{'model':db[_0xec63('0x5d')],'as':_0xec63('0x5e'),'attributes':['id',_0xec63('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xec63('0x28')](function(_0x320477){if(_0x320477){var _0x24d4b8=_0x4db48d[_0xec63('0x56')][_0xec63('0x5f')]({'plain':!![]});if(!_0x24d4b8)throw new Error(_0xec63('0x60'));if(_0x24d4b8[_0xec63('0x58')]===_0xec63('0x56')){return db[_0xec63('0x61')]['find']({'where':{'name':_0xec63('0x62'),'userProfileId':_0x24d4b8['userProfileId']},'raw':!![]})['then'](function(_0x3b6a0f){if(_0x3b6a0f){if(_0x3b6a0f[_0xec63('0x63')]===0x0){return db[_0xec63('0x64')]['findAll']({'where':{'sectionId':_0x3b6a0f['id']},'raw':!![]})[_0xec63('0x28')](function(_0x4d8579){var _0x18f71f=[];if(_[_0xec63('0x65')](_0x4d8579)){_0x18f71f=_['filter'](_0x320477,function(_0x15e82d){if(_0x15e82d[_0xec63('0x58')]!==_0xec63('0x66')){return _0x15e82d;}});return _0x18f71f;}else{for(var _0x527976=0x0;_0x527976<_0x320477['length'];_0x527976++){var _0xd5957a=_0x320477[_0x527976];if(_0xd5957a[_0xec63('0x58')]===_0xec63('0x66')){var _0x2e304f=_[_0xec63('0x4a')](_0x4d8579,function(_0x159e39){return _0x159e39[_0xec63('0x67')]===_0xd5957a['id'];});if(_0x2e304f)_0x18f71f['push'](_0xd5957a);}else{_0x18f71f[_0xec63('0x68')](_0xd5957a);}}return _0x18f71f;}});}else{return _0x320477;}}else{var _0x562272=_['filter'](_0x320477,function(_0x346e2f){if(_0x346e2f['role']!=='agent'){return _0x346e2f;}});return _0x562272;}});}else{return _0x320477;}}})[_0xec63('0x28')](function(_0xba3826){var _0x2d1971=[];if(_0xba3826){_0x253f56=_0xba3826;for(var _0x38d731=0x0;_0x38d731<_0xba3826[_0xec63('0x48')];_0x38d731+=0x1){_0x253f56[_0x38d731][_0xec63('0x50')]=[];_0x2d1971[_0xec63('0x68')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x4db48d[_0xec63('0x56')]['id'],_0xba3826[_0x38d731]['id']],'ToId':[_0x4db48d['user']['id'],_0xba3826[_0x38d731]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xec63('0x69'),_0xec63('0x6a'),_0xec63('0x4d')],'order':qs['sort'](_0xec63('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xec63('0x28')](wrapUser(_0xba3826[_0x38d731])));}return BPromise[_0xec63('0x6c')](_0x2d1971);}return[];})['then'](function(_0x4bd79d){return{'rows':_0x4bd79d,'count':_0x4bd79d[_0xec63('0x48')]};})['then'](respondWithResult(_0x2344db,null))[_0xec63('0x4b')](handleError(_0x2344db,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2e2412e..f5ce002 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 _0xb0f6=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1ae062,_0x250a42){var _0x1b2ab3=function(_0xc89406){while(--_0xc89406){_0x1ae062['push'](_0x1ae062['shift']());}};_0x1b2ab3(++_0x250a42);}(_0xb0f6,0x91));var _0x6b0f=function(_0x481ebc,_0x452cd8){_0x481ebc=_0x481ebc-0x0;var _0x2c56d9=_0xb0f6[_0x481ebc];return _0x2c56d9;};'use strict';var EventEmitter=require(_0x6b0f('0x0'));var ChatInternalMessage=require(_0x6b0f('0x1'))['db'][_0x6b0f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6b0f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b0f('0x4'),'afterDestroy':_0x6b0f('0x5')};function emitEvent(_0x6276b9){return function(_0x132c6b,_0x4af6f8,_0x571be2){ChatInternalMessageEvents[_0x6b0f('0x6')](_0x6276b9+':'+_0x132c6b['id'],_0x132c6b);ChatInternalMessageEvents[_0x6b0f('0x6')](_0x6276b9,_0x132c6b);_0x571be2(null);};}for(var e in events){if(events[_0x6b0f('0x7')](e)){var event=events[e];ChatInternalMessage[_0x6b0f('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xd6b0=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','hasOwnProperty','hook','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd6b0,0x13b));var _0x0d6b=function(_0x3f8e06,_0x21d03f){_0x3f8e06=_0x3f8e06-0x0;var _0x209adf=_0xd6b0[_0x3f8e06];return _0x209adf;};'use strict';var EventEmitter=require(_0x0d6b('0x0'));var ChatInternalMessage=require(_0x0d6b('0x1'))['db'][_0x0d6b('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0d6b('0x3')](0x0);var events={'afterCreate':_0x0d6b('0x4'),'afterUpdate':'update','afterDestroy':_0x0d6b('0x5')};function emitEvent(_0x5ae368){return function(_0x227e7c,_0x15ef52,_0x49211f){ChatInternalMessageEvents['emit'](_0x5ae368+':'+_0x227e7c['id'],_0x227e7c);ChatInternalMessageEvents['emit'](_0x5ae368,_0x227e7c);_0x49211f(null);};}for(var e in events){if(events[_0x0d6b('0x6')](e)){var event=events[e];ChatInternalMessage[_0x0d6b('0x7')](e,emitEvent(event));}}module[_0x0d6b('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6051eb7..19c98c0 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 _0x94e2=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x58730c,_0x120cba){var _0x3fb53e=function(_0x44d534){while(--_0x44d534){_0x58730c['push'](_0x58730c['shift']());}};_0x3fb53e(++_0x120cba);}(_0x94e2,0x11e));var _0x294e=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x94e2[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x294e('0x0'));var util=require(_0x294e('0x1'));var logger=require('../../config/logger')(_0x294e('0x2'));var moment=require(_0x294e('0x3'));var BPromise=require(_0x294e('0x4'));var rp=require(_0x294e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x294e('0x6'));var attributes=require(_0x294e('0x7'));module['exports']=function(_0xa23e10,_0x24b27c){return _0xa23e10[_0x294e('0x8')](_0x294e('0x9'),attributes,{'tableName':_0x294e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7c34=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7c34,0xdb));var _0x47c3=function(_0x29e637,_0x13f9f0){_0x29e637=_0x29e637-0x0;var _0x5bd3a4=_0x7c34[_0x29e637];return _0x5bd3a4;};'use strict';var _=require(_0x47c3('0x0'));var util=require(_0x47c3('0x1'));var logger=require('../../config/logger')(_0x47c3('0x2'));var moment=require(_0x47c3('0x3'));var BPromise=require(_0x47c3('0x4'));var rp=require(_0x47c3('0x5'));var fs=require('fs');var path=require(_0x47c3('0x6'));var rimraf=require(_0x47c3('0x7'));var config=require(_0x47c3('0x8'));var attributes=require(_0x47c3('0x9'));module[_0x47c3('0xa')]=function(_0x386cc6,_0x16bde3){return _0x386cc6[_0x47c3('0xb')](_0x47c3('0xc'),attributes,{'tableName':_0x47c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x47c3('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index de9cfec..c1bafc2 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 _0xfdc5=['error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4003ca,_0x18f4ac){var _0x4738bd=function(_0x3dd3ee){while(--_0x3dd3ee){_0x4003ca['push'](_0x4003ca['shift']());}};_0x4738bd(++_0x18f4ac);}(_0xfdc5,0xa8));var _0x5fdc=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfdc5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5fdc('0x0'));var util=require(_0x5fdc('0x1'));var moment=require(_0x5fdc('0x2'));var BPromise=require(_0x5fdc('0x3'));var rs=require(_0x5fdc('0x4'));var fs=require('fs');var Redis=require(_0x5fdc('0x5'));var db=require(_0x5fdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fdc('0x7'))('rpc');var config=require(_0x5fdc('0x8'));var jayson=require(_0x5fdc('0x9'));var client=jayson[_0x5fdc('0xa')][_0x5fdc('0xb')]({'port':0x232a});config[_0x5fdc('0xc')]=_[_0x5fdc('0xd')](config[_0x5fdc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5fdc('0xe'))(new Redis(config[_0x5fdc('0xc')]));require(_0x5fdc('0xf'))[_0x5fdc('0x10')](socket);function respondWithRpcPromise(_0xf4684d,_0xbec595,_0x35acfb){return new BPromise(function(_0x17f967,_0x504e28){return client[_0x5fdc('0x11')](_0xf4684d,_0x35acfb)['then'](function(_0x537000){logger[_0x5fdc('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0xbec595,_0x5fdc('0x13'));logger['debug'](_0x5fdc('0x14'),_0xbec595,'request\x20sent',JSON['stringify'](_0x537000));if(_0x537000[_0x5fdc('0x15')]){if(_0x537000[_0x5fdc('0x15')][_0x5fdc('0x16')]===0x1f4){logger[_0x5fdc('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xbec595,_0x537000[_0x5fdc('0x15')][_0x5fdc('0x17')]);return _0x504e28(_0x537000[_0x5fdc('0x15')][_0x5fdc('0x17')]);}logger[_0x5fdc('0x15')](_0x5fdc('0x18'),_0xbec595,_0x537000[_0x5fdc('0x15')][_0x5fdc('0x17')]);return _0x17f967(_0x537000[_0x5fdc('0x15')]['message']);}else{logger[_0x5fdc('0x12')](_0x5fdc('0x18'),_0xbec595,_0x5fdc('0x13'));_0x17f967(_0x537000[_0x5fdc('0x19')][_0x5fdc('0x17')]);}})[_0x5fdc('0x1a')](function(_0x2c5fc0){logger[_0x5fdc('0x15')](_0x5fdc('0x18'),_0xbec595,_0x2c5fc0);_0x504e28(_0x2c5fc0);});});} \ No newline at end of file +var _0xabcb=['http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37f03a,_0x568501){var _0x4f6ad3=function(_0x4e6422){while(--_0x4e6422){_0x37f03a['push'](_0x37f03a['shift']());}};_0x4f6ad3(++_0x568501);}(_0xabcb,0xf9));var _0xbabc=function(_0x64c2e7,_0x4f757c){_0x64c2e7=_0x64c2e7-0x0;var _0x3ecb19=_0xabcb[_0x64c2e7];return _0x3ecb19;};'use strict';var _=require('lodash');var util=require(_0xbabc('0x0'));var moment=require(_0xbabc('0x1'));var BPromise=require(_0xbabc('0x2'));var rs=require(_0xbabc('0x3'));var fs=require('fs');var Redis=require(_0xbabc('0x4'));var db=require(_0xbabc('0x5'))['db'];var utils=require(_0xbabc('0x6'));var logger=require(_0xbabc('0x7'))(_0xbabc('0x8'));var config=require(_0xbabc('0x9'));var jayson=require(_0xbabc('0xa'));var client=jayson[_0xbabc('0xb')][_0xbabc('0xc')]({'port':0x232a});config[_0xbabc('0xd')]=_[_0xbabc('0xe')](config[_0xbabc('0xd')],{'host':_0xbabc('0xf'),'port':0x18eb});var socket=require(_0xbabc('0x10'))(new Redis(config[_0xbabc('0xd')]));require(_0xbabc('0x11'))['register'](socket);function respondWithRpcPromise(_0x290cb8,_0xf6ac41,_0xa4305c){return new BPromise(function(_0x4bd932,_0x3d5240){return client[_0xbabc('0x12')](_0x290cb8,_0xa4305c)[_0xbabc('0x13')](function(_0x41d379){logger['info'](_0xbabc('0x14'),_0xf6ac41,_0xbabc('0x15'));logger[_0xbabc('0x16')](_0xbabc('0x17'),_0xf6ac41,_0xbabc('0x15'),JSON[_0xbabc('0x18')](_0x41d379));if(_0x41d379[_0xbabc('0x19')]){if(_0x41d379['error'][_0xbabc('0x1a')]===0x1f4){logger[_0xbabc('0x19')](_0xbabc('0x14'),_0xf6ac41,_0x41d379['error'][_0xbabc('0x1b')]);return _0x3d5240(_0x41d379[_0xbabc('0x19')][_0xbabc('0x1b')]);}logger[_0xbabc('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0xf6ac41,_0x41d379[_0xbabc('0x19')]['message']);return _0x4bd932(_0x41d379[_0xbabc('0x19')][_0xbabc('0x1b')]);}else{logger['info'](_0xbabc('0x14'),_0xf6ac41,'request\x20sent');_0x4bd932(_0x41d379[_0xbabc('0x1c')][_0xbabc('0x1b')]);}})['catch'](function(_0x9ea880){logger['error'](_0xbabc('0x14'),_0xf6ac41,_0x9ea880);_0x3d5240(_0x9ea880);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7cc3f80..618e049 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 _0xf2b2=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf2b2,0x19a));var _0x2f2b=function(_0x41f012,_0x3bcc46){_0x41f012=_0x41f012-0x0;var _0x3dd2b9=_0xf2b2[_0x41f012];return _0x3dd2b9;};'use strict';var ChatInternalMessageEvents=require(_0x2f2b('0x0'));var events=[_0x2f2b('0x1'),_0x2f2b('0x2'),_0x2f2b('0x3')];function createListener(_0x23f30c,_0x1c6c7d){return function(_0xc1adac){_0x1c6c7d[_0x2f2b('0x4')](_0x23f30c,_0xc1adac);};}function removeListener(_0x4520c5,_0x2a4726){return function(){ChatInternalMessageEvents[_0x2f2b('0x5')](_0x4520c5,_0x2a4726);};}exports[_0x2f2b('0x6')]=function(_0x410a02){for(var _0xa6aaea=0x0,_0x21ae82=events['length'];_0xa6aaea<_0x21ae82;_0xa6aaea++){var _0x1fcf7b=events[_0xa6aaea];var _0x15234b=createListener(_0x2f2b('0x7')+_0x1fcf7b,_0x410a02);ChatInternalMessageEvents['on'](_0x1fcf7b,_0x15234b);}}; \ No newline at end of file +var _0xef78=['chatInternalMessage:','./chatInternalMessage.events','removeListener','length'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xef78,0x75));var _0x8ef7=function(_0x1bf0c9,_0x5bc860){_0x1bf0c9=_0x1bf0c9-0x0;var _0x44093a=_0xef78[_0x1bf0c9];return _0x44093a;};'use strict';var ChatInternalMessageEvents=require(_0x8ef7('0x0'));var events=['save','remove','update'];function createListener(_0x206f1f,_0x4c919d){return function(_0x5a151b){_0x4c919d['emit'](_0x206f1f,_0x5a151b);};}function removeListener(_0x2c0585,_0xab20a9){return function(){ChatInternalMessageEvents[_0x8ef7('0x1')](_0x2c0585,_0xab20a9);};}exports['register']=function(_0x5e5e33){for(var _0x551b63=0x0,_0x2714a4=events[_0x8ef7('0x2')];_0x551b63<_0x2714a4;_0x551b63++){var _0x5ca6fb=events[_0x551b63];var _0xb8cb40=createListener(_0x8ef7('0x3')+_0x5ca6fb,_0x5e5e33);ChatInternalMessageEvents['on'](_0x5ca6fb,_0xb8cb40);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2e689c1..1810f67 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 _0x4355=['./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post','create','put','/:id','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x4355,0x169));var _0x5435=function(_0x44689f,_0x1fb85f){_0x44689f=_0x44689f-0x0;var _0x5379fd=_0x4355[_0x44689f];return _0x5379fd;};'use strict';var multer=require(_0x5435('0x0'));var util=require(_0x5435('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5435('0x2'));var router=express[_0x5435('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5435('0x4'));var interaction=require(_0x5435('0x5'));var config=require(_0x5435('0x6'));var controller=require(_0x5435('0x7'));router[_0x5435('0x8')]('/',auth[_0x5435('0x9')](),controller[_0x5435('0xa')]);router['get'](_0x5435('0xb'),auth[_0x5435('0x9')](),controller[_0x5435('0xc')]);router[_0x5435('0x8')](_0x5435('0xd'),auth[_0x5435('0x9')](),controller[_0x5435('0xe')]);router[_0x5435('0x8')]('/:id',auth[_0x5435('0x9')](),controller[_0x5435('0xf')]);router[_0x5435('0x10')]('/',auth[_0x5435('0x9')](),controller[_0x5435('0x11')]);router[_0x5435('0x12')](_0x5435('0x13'),controller[_0x5435('0x14')]);router[_0x5435('0x15')](_0x5435('0x13'),auth[_0x5435('0x9')](),controller[_0x5435('0x16')]);module['exports']=router; \ No newline at end of file +var _0x49dc=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','destroy'];(function(_0x21ff2d,_0x1b4383){var _0x5823d4=function(_0x2adecf){while(--_0x2adecf){_0x21ff2d['push'](_0x21ff2d['shift']());}};_0x5823d4(++_0x1b4383);}(_0x49dc,0x1ee));var _0xc49d=function(_0x1737e5,_0x544887){_0x1737e5=_0x1737e5-0x0;var _0x610e07=_0x49dc[_0x1737e5];return _0x610e07;};'use strict';var multer=require(_0xc49d('0x0'));var util=require('util');var path=require(_0xc49d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc49d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc49d('0x3'));var interaction=require(_0xc49d('0x4'));var config=require('../../config/environment');var controller=require(_0xc49d('0x5'));router['get']('/',auth[_0xc49d('0x6')](),controller[_0xc49d('0x7')]);router[_0xc49d('0x8')]('/describe',auth[_0xc49d('0x6')](),controller[_0xc49d('0x9')]);router['get']('/users',auth[_0xc49d('0x6')](),controller['getUsers']);router[_0xc49d('0x8')](_0xc49d('0xa'),auth[_0xc49d('0x6')](),controller[_0xc49d('0xb')]);router[_0xc49d('0xc')]('/',auth[_0xc49d('0x6')](),controller[_0xc49d('0xd')]);router[_0xc49d('0xe')](_0xc49d('0xa'),controller['update']);router['delete'](_0xc49d('0xa'),auth[_0xc49d('0x6')](),controller[_0xc49d('0xf')]);module[_0xc49d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5817812..b86b93e 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 _0x6427=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0x5b0fcc,_0x449df1){var _0x16eb1e=function(_0x24a12f){while(--_0x24a12f){_0x5b0fcc['push'](_0x5b0fcc['shift']());}};_0x16eb1e(++_0x449df1);}(_0x6427,0xbe));var _0x7642=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6427[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0x7642('0x0')]={'body':{'type':Sequelize[_0x7642('0x1')](_0x7642('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7642('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7642('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7642('0x4')]('in','out'),'defaultValue':_0x7642('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7642('0x6')]},'providerName':{'type':Sequelize[_0x7642('0x7')]},'providerResponse':{'type':Sequelize[_0x7642('0x1')]}}; \ No newline at end of file +var _0x1707=['BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1707,0x1df));var _0x7170=function(_0x4c1842,_0x10bd93){_0x4c1842=_0x4c1842-0x0;var _0x5d2791=_0x1707[_0x4c1842];return _0x5d2791;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7170('0x2')),'defaultValue':_0x7170('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7170('0x3')]},'providerName':{'type':Sequelize[_0x7170('0x4')]},'providerResponse':{'type':Sequelize[_0x7170('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bae1f91..a927a56 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 _0xad6d=['rawAttributes','fieldName','model','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','filter','map','type','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','fields','options','find','create','body','update','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','user','role','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','SIP/%s','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','destroy','end','name','send','ChatMessage'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0xad6d,0x156));var _0xdad6=function(_0x10113d,_0x13a861){_0x10113d=_0x10113d-0x0;var _0xf52f5d=_0xad6d[_0x10113d];return _0xf52f5d;};'use strict';var emlformat=require(_0xdad6('0x0'));var rimraf=require(_0xdad6('0x1'));var zipdir=require(_0xdad6('0x2'));var jsonpatch=require(_0xdad6('0x3'));var rp=require('request-promise');var moment=require(_0xdad6('0x4'));var BPromise=require(_0xdad6('0x5'));var Mustache=require(_0xdad6('0x6'));var util=require('util');var path=require(_0xdad6('0x7'));var sox=require(_0xdad6('0x8'));var csv=require(_0xdad6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdad6('0xa'));var _=require('lodash');var squel=require(_0xdad6('0xb'));var crypto=require(_0xdad6('0xc'));var jsforce=require(_0xdad6('0xd'));var deskjs=require(_0xdad6('0xe'));var toCsv=require(_0xdad6('0x9'));var querystring=require('querystring');var Papa=require(_0xdad6('0xf'));var Redis=require(_0xdad6('0x10'));var authService=require(_0xdad6('0x11'));var qs=require(_0xdad6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdad6('0x13'));var logger=require('../../config/logger')(_0xdad6('0x14'));var utils=require(_0xdad6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdad6('0x16'));var db=require(_0xdad6('0x17'))['db'];config['redis']=_[_0xdad6('0x18')](config[_0xdad6('0x19')],{'host':_0xdad6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdad6('0x19')]));require('./chatMessage.socket')[_0xdad6('0x1b')](socket);var jayson=require(_0xdad6('0x1c'));var client=jayson[_0xdad6('0x1d')][_0xdad6('0x1e')]({'port':0x232c});var client9002=jayson[_0xdad6('0x1d')][_0xdad6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2d3eb6,_0x226bc3,_0xf06c5f,_0x408499){return new BPromise(function(_0x5866eb,_0x15411f){var _0xe0336c=_0x408499||client;return _0xe0336c[_0xdad6('0x1f')](_0x2d3eb6,_0xf06c5f)[_0xdad6('0x20')](function(_0x4ac849){logger[_0xdad6('0x21')](_0xdad6('0x22'),_0x226bc3,_0xdad6('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x226bc3,_0xdad6('0x23'),JSON[_0xdad6('0x24')](_0x4ac849));if(_0x4ac849[_0xdad6('0x25')]){if(_0x4ac849['error']['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x226bc3,_0x4ac849[_0xdad6('0x25')][_0xdad6('0x26')]);return _0x15411f(_0x4ac849[_0xdad6('0x25')]['message']);}logger['error'](_0xdad6('0x22'),_0x226bc3,_0x4ac849[_0xdad6('0x25')][_0xdad6('0x26')]);return _0x5866eb(_0x4ac849[_0xdad6('0x25')][_0xdad6('0x26')]);}else{logger[_0xdad6('0x21')](_0xdad6('0x22'),_0x226bc3,'request\x20sent');_0x5866eb(_0x4ac849[_0xdad6('0x27')]['message']);}})[_0xdad6('0x28')](function(_0x1cf561){logger[_0xdad6('0x25')](_0xdad6('0x22'),_0x226bc3,_0x1cf561);_0x15411f(_0x1cf561);});});}function respondWithStatusCode(_0x553354,_0x334dd4){_0x334dd4=_0x334dd4||0xcc;return function(_0x58d1c4){if(_0x58d1c4){return _0x553354[_0xdad6('0x29')](_0x334dd4);}return _0x553354[_0xdad6('0x2a')](_0x334dd4)['end']();};}function respondWithResult(_0x181f2d,_0x586960){_0x586960=_0x586960||0xc8;return function(_0x3fa92d){if(_0x3fa92d){return _0x181f2d[_0xdad6('0x2a')](_0x586960)[_0xdad6('0x2b')](_0x3fa92d);}};}function respondWithFilteredResult(_0x2f162a,_0x306a32){return function(_0xcb8cd8){if(_0xcb8cd8){var _0x19fc50=typeof _0x306a32['offset']==='undefined'&&typeof _0x306a32[_0xdad6('0x2c')]===_0xdad6('0x2d');var _0x261dc5=_0xcb8cd8[_0xdad6('0x2e')];var _0x2c79f5=_0x19fc50?0x0:_0x306a32[_0xdad6('0x2f')];var _0x38d2b0=_0x19fc50?_0xcb8cd8[_0xdad6('0x2e')]:_0x306a32[_0xdad6('0x2f')]+_0x306a32['limit'];var _0x1cc7ab;if(_0x38d2b0>=_0x261dc5){_0x38d2b0=_0x261dc5;_0x1cc7ab=0xc8;}else{_0x1cc7ab=0xce;}_0x2f162a[_0xdad6('0x2a')](_0x1cc7ab);return _0x2f162a[_0xdad6('0x30')]('Content-Range',_0x2c79f5+'-'+_0x38d2b0+'/'+_0x261dc5)['json'](_0xcb8cd8);}return null;};}function patchUpdates(_0xd2d79a){return function(_0x354a52){try{jsonpatch[_0xdad6('0x31')](_0x354a52,_0xd2d79a,!![]);}catch(_0x1934fe){return BPromise[_0xdad6('0x32')](_0x1934fe);}return _0x354a52[_0xdad6('0x33')]();};}function saveUpdates(_0x34f6c1,_0x57eb26){return function(_0x33f4ae){if(_0x33f4ae){return _0x33f4ae['update'](_0x34f6c1)[_0xdad6('0x20')](function(_0x428050){return _0x428050;});}return null;};}function removeEntity(_0x4a311c,_0x2281dd){return function(_0x3b7c4c){if(_0x3b7c4c){return _0x3b7c4c[_0xdad6('0x34')]()['then'](function(){_0x4a311c['status'](0xcc)[_0xdad6('0x35')]();});}};}function handleEntityNotFound(_0x55f1a5,_0x1bd65c){return function(_0x4ac115){if(!_0x4ac115){_0x55f1a5['sendStatus'](0x194);}return _0x4ac115;};}function handleError(_0xdeb6cc,_0x55dde1){_0x55dde1=_0x55dde1||0x1f4;return function(_0x4e310c){logger[_0xdad6('0x25')](_0x4e310c['stack']);if(_0x4e310c[_0xdad6('0x36')]){delete _0x4e310c[_0xdad6('0x36')];}_0xdeb6cc['status'](_0x55dde1)[_0xdad6('0x37')](_0x4e310c);};}exports['index']=function(_0x225ea3,_0x54295a){var _0xacd3c0={},_0x21b026={},_0x283ee6={'count':0x0,'rows':[]};var _0xff8d07=_['map'](db[_0xdad6('0x38')][_0xdad6('0x39')],function(_0x4e1826){return{'name':_0x4e1826[_0xdad6('0x3a')],'type':_0x4e1826['type']['key']};});_0x21b026[_0xdad6('0x3b')]=_['map'](_0xff8d07,_0xdad6('0x36'));_0x21b026['query']=_['keys'](_0x225ea3['query']);_0x21b026[_0xdad6('0x3c')]=_[_0xdad6('0x3d')](_0x21b026[_0xdad6('0x3b')],_0x21b026['query']);_0xacd3c0[_0xdad6('0x3e')]=_['intersection'](_0x21b026[_0xdad6('0x3b')],qs['fields'](_0x225ea3[_0xdad6('0x3f')]['fields']));_0xacd3c0[_0xdad6('0x3e')]=_0xacd3c0[_0xdad6('0x3e')][_0xdad6('0x40')]?_0xacd3c0['attributes']:_0x21b026[_0xdad6('0x3b')];if(!_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x41')](_0xdad6('0x42'))){_0xacd3c0['limit']=qs['limit'](_0x225ea3['query'][_0xdad6('0x2c')]);_0xacd3c0[_0xdad6('0x2f')]=qs[_0xdad6('0x2f')](_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x2f')]);}_0xacd3c0[_0xdad6('0x43')]=qs['sort'](_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x44')]);_0xacd3c0[_0xdad6('0x45')]=qs[_0xdad6('0x3c')](_['pick'](_0x225ea3[_0xdad6('0x3f')],_0x21b026[_0xdad6('0x3c')]),_0xff8d07);if(_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x46')]){_0xacd3c0[_0xdad6('0x45')]=_['merge'](_0xacd3c0[_0xdad6('0x45')],{'$or':_[_0xdad6('0x47')](_0xff8d07,function(_0x203a25){if(_0x203a25[_0xdad6('0x48')]!==_0xdad6('0x49')){var _0x5e639d={};_0x5e639d[_0x203a25[_0xdad6('0x36')]]={'$like':'%'+_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x46')]+'%'};return _0x5e639d;}})});}_0xacd3c0=_[_0xdad6('0x4a')]({},_0xacd3c0,_0x225ea3['options']);var _0x53cd0a={'where':_0xacd3c0[_0xdad6('0x45')]};return db[_0xdad6('0x38')]['count'](_0x53cd0a)[_0xdad6('0x20')](function(_0x11a0d1){_0x283ee6[_0xdad6('0x2e')]=_0x11a0d1;if(_0x225ea3[_0xdad6('0x3f')][_0xdad6('0x4b')]){_0xacd3c0[_0xdad6('0x4c')]=[{'all':!![]}];}return db[_0xdad6('0x38')][_0xdad6('0x4d')](_0xacd3c0);})['then'](function(_0xcc42e4){_0x283ee6[_0xdad6('0x4e')]=_0xcc42e4;return _0x283ee6;})['then'](respondWithFilteredResult(_0x54295a,_0xacd3c0))[_0xdad6('0x28')](handleError(_0x54295a,null));};exports['show']=function(_0x1f27e6,_0x467546){var _0x5ce9d4={'raw':!![],'where':{'id':_0x1f27e6[_0xdad6('0x4f')]['id']}},_0x1f65b8={};_0x1f65b8[_0xdad6('0x3b')]=_[_0xdad6('0x50')](db[_0xdad6('0x38')][_0xdad6('0x39')]);_0x1f65b8['query']=_[_0xdad6('0x50')](_0x1f27e6[_0xdad6('0x3f')]);_0x1f65b8[_0xdad6('0x3c')]=_['intersection'](_0x1f65b8[_0xdad6('0x3b')],_0x1f65b8[_0xdad6('0x3f')]);_0x5ce9d4[_0xdad6('0x3e')]=_[_0xdad6('0x3d')](_0x1f65b8['model'],qs[_0xdad6('0x51')](_0x1f27e6[_0xdad6('0x3f')][_0xdad6('0x51')]));_0x5ce9d4[_0xdad6('0x3e')]=_0x5ce9d4['attributes']['length']?_0x5ce9d4[_0xdad6('0x3e')]:_0x1f65b8[_0xdad6('0x3b')];if(_0x1f27e6[_0xdad6('0x3f')][_0xdad6('0x4b')]){_0x5ce9d4[_0xdad6('0x4c')]=[{'all':!![]}];}_0x5ce9d4=_[_0xdad6('0x4a')]({},_0x5ce9d4,_0x1f27e6[_0xdad6('0x52')]);return db['ChatMessage'][_0xdad6('0x53')](_0x5ce9d4)[_0xdad6('0x20')](handleEntityNotFound(_0x467546,null))[_0xdad6('0x20')](respondWithResult(_0x467546,null))[_0xdad6('0x28')](handleError(_0x467546,null));};exports[_0xdad6('0x54')]=function(_0x10cfb9,_0x2e185f){return db[_0xdad6('0x38')][_0xdad6('0x54')](_0x10cfb9[_0xdad6('0x55')],{})[_0xdad6('0x20')](respondWithResult(_0x2e185f,0xc9))[_0xdad6('0x28')](handleError(_0x2e185f,null));};exports[_0xdad6('0x56')]=function(_0x2339c5,_0x2d714b){if(_0x2339c5['body']['id']){delete _0x2339c5[_0xdad6('0x55')]['id'];}return db['ChatMessage'][_0xdad6('0x53')]({'where':{'id':_0x2339c5['params']['id']}})[_0xdad6('0x20')](handleEntityNotFound(_0x2d714b,null))[_0xdad6('0x20')](saveUpdates(_0x2339c5[_0xdad6('0x55')],null))['then'](respondWithResult(_0x2d714b,null))[_0xdad6('0x28')](handleError(_0x2d714b,null));};exports[_0xdad6('0x34')]=function(_0x2f7eb7,_0x344b14){return db['ChatMessage'][_0xdad6('0x53')]({'where':{'id':_0x2f7eb7[_0xdad6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x344b14,null))[_0xdad6('0x20')](removeEntity(_0x344b14,null))[_0xdad6('0x28')](handleError(_0x344b14,null));};exports[_0xdad6('0x57')]=function(_0x5ccea9,_0x5bc145){return db[_0xdad6('0x38')][_0xdad6('0x57')]()[_0xdad6('0x20')](respondWithResult(_0x5bc145,null))[_0xdad6('0x28')](handleError(_0x5bc145,null));};var interaction_log=require(_0xdad6('0x58'))(_0xdad6('0x59'));exports[_0xdad6('0x5a')]=function(_0x79f24c,_0x398cf1,_0x5d1c74){var _0x160731={'agent':{},'channel':_0xdad6('0x5b')};if(_0x79f24c[_0xdad6('0x55')]['id']){delete _0x79f24c[_0xdad6('0x55')]['id'];}_0x79f24c[_0xdad6('0x55')][_0xdad6('0x5c')]=!![];_0x79f24c['body'][_0xdad6('0x5d')]=moment()[_0xdad6('0x5e')](_0xdad6('0x5f'));_0x79f24c[_0xdad6('0x55')][_0xdad6('0x60')]=_0x79f24c[_0xdad6('0x55')][_0xdad6('0x60')]||_0x79f24c['user']['id'];_0x160731[_0xdad6('0x61')]['id']=_0x79f24c[_0xdad6('0x55')][_0xdad6('0x60')];return db[_0xdad6('0x38')][_0xdad6('0x53')]({'where':{'id':_0x79f24c[_0xdad6('0x4f')]['id'],'UserId':null}})[_0xdad6('0x20')](handleEntityNotFound(_0x398cf1,null))[_0xdad6('0x20')](saveUpdates(_0x79f24c[_0xdad6('0x55')],null))['then'](function(_0x59e799){if(_0x59e799){_0x160731[_0xdad6('0x26')]=_0x59e799[_0xdad6('0x62')]({'plain':!![]});return db[_0xdad6('0x63')][_0xdad6('0x53')]({'where':{'id':_0x59e799[_0xdad6('0x64')]}});}return null;})[_0xdad6('0x20')](handleEntityNotFound(_0x398cf1,null))[_0xdad6('0x20')](function(_0x44b0cb){if(_0x44b0cb){return _0x44b0cb[_0xdad6('0x56')]({'UserId':_0x79f24c[_0xdad6('0x55')][_0xdad6('0x60')],'read1stAt':_[_0xdad6('0x65')](_0x44b0cb[_0xdad6('0x66')])?moment()[_0xdad6('0x5e')](_0xdad6('0x5f')):undefined});}return null;})[_0xdad6('0x20')](function(_0x7a620){if(_0x7a620){_0x160731[_0xdad6('0x67')]=_0x7a620['get']({'plain':!![]});interaction_log[_0xdad6('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x79f24c[_0xdad6('0x68')]['id'],_0x79f24c[_0xdad6('0x68')]['name'],_0x79f24c['user'][_0xdad6('0x69')],_0x160731[_0xdad6('0x67')]['id'],_0x79f24c[_0xdad6('0x55')]?JSON[_0xdad6('0x24')](_0x79f24c['body']):'null');return respondWithRpcPromise(_0xdad6('0x6a'),_0xdad6('0x6b'),_0x160731);}return null;})[_0xdad6('0x20')](function(_0x26c391){var _0x182e56='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26c391[_0xdad6('0x26')][_0xdad6('0x6c')];return db['sequelize'][_0xdad6('0x3f')](_0x182e56,{'type':db[_0xdad6('0x6d')][_0xdad6('0x6e')]['SELECT'],'raw':!![]})[_0xdad6('0x20')](function(_0x32815e){return _0x32815e;});})['then'](function(_0x175da0){if(_0x175da0){_0x160731[_0xdad6('0x26')][_0xdad6('0x6f')]=_0x175da0[0x0];if(!_0x79f24c[_0xdad6('0x55')][_0xdad6('0x60')])return;return db[_0xdad6('0x70')]['find']({'where':{'id':_0x79f24c[_0xdad6('0x55')]['UserId'],'role':_0xdad6('0x61')},'attributes':['id',_0xdad6('0x36'),_0xdad6('0x71'),_0xdad6('0x72'),_0xdad6('0x73')],'raw':!![]});}return null;})[_0xdad6('0x20')](function(_0x4903bd){if(!_0x4903bd)return null;_0x160731[_0xdad6('0x26')][_0xdad6('0x61')]=_0x4903bd;return _0x160731;})[_0xdad6('0x20')](function(_0x7537b8){if(_0x7537b8){if(_0x79f24c[_0xdad6('0x55')][_0xdad6('0x74')]){_0x160731[_0xdad6('0x26')][_0xdad6('0x75')]=util[_0xdad6('0x5e')]('SIP/%s',_0x79f24c[_0xdad6('0x68')][_0xdad6('0x36')]);_0x160731[_0xdad6('0x26')][_0xdad6('0x76')]=_0x160731['channel'];_0x160731[_0xdad6('0x26')]['motionChannel']=_0x160731[_0xdad6('0x76')];_0x160731['message'][_0xdad6('0x77')]=_0xdad6('0x5a');return respondWithRpcPromise(_0xdad6('0x78'),_0xdad6('0x78'),{'event':_0xdad6('0x79'),'message':_[_0xdad6('0x4a')](_0x160731['message'],JSON['parse'](_0x160731[_0xdad6('0x67')][_0xdad6('0x7a')]))},client9002)[_0xdad6('0x20')](function(){return _0x160731;});}return _0x160731;}return null;})['then'](respondWithResult(_0x398cf1,null))['catch'](handleError(_0x398cf1,null));};var interaction_log=require('../../config/logger')(_0xdad6('0x59'));exports[_0xdad6('0x32')]=function(_0x51bbc2,_0xfeaf0b,_0x26d1e4){var _0x14fee9={'agent':{},'channel':_0xdad6('0x5b')};if(_0x51bbc2[_0xdad6('0x55')]['id']){delete _0x51bbc2['body']['id'];}_0x51bbc2[_0xdad6('0x55')]['UserId']=_0x51bbc2[_0xdad6('0x55')][_0xdad6('0x60')]||_0x51bbc2[_0xdad6('0x68')]['id'];_0x14fee9[_0xdad6('0x61')]['id']=_0x51bbc2['body']['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x51bbc2[_0xdad6('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xfeaf0b,null))[_0xdad6('0x20')](function(_0x11d9ae){if(_0x11d9ae){_0x14fee9[_0xdad6('0x26')]=_0x11d9ae['get']({'plain':!![]});return db[_0xdad6('0x63')][_0xdad6('0x53')]({'where':{'id':_0x11d9ae[_0xdad6('0x64')]}});}return null;})[_0xdad6('0x20')](handleEntityNotFound(_0xfeaf0b,null))[_0xdad6('0x20')](function(_0x514b7b){if(_0x514b7b){_0x14fee9[_0xdad6('0x67')]=_0x514b7b[_0xdad6('0x62')]({'plain':!![]});interaction_log[_0xdad6('0x21')](_0xdad6('0x7b'),_0x51bbc2[_0xdad6('0x68')]['id'],_0x51bbc2[_0xdad6('0x68')][_0xdad6('0x36')],_0x51bbc2['user'][_0xdad6('0x69')],_0x14fee9[_0xdad6('0x67')]['id'],_0x51bbc2[_0xdad6('0x55')]?JSON[_0xdad6('0x24')](_0x51bbc2[_0xdad6('0x55')]):_0xdad6('0x7c'));return respondWithRpcPromise(_0xdad6('0x7d'),_0xdad6('0x7e'),_0x14fee9);}return null;})['then'](function(_0x11220b){var _0xd9b4e9=_0xdad6('0x7f')+_0x11220b[_0xdad6('0x26')][_0xdad6('0x6c')];return db[_0xdad6('0x80')]['query'](_0xd9b4e9,{'type':db[_0xdad6('0x6d')][_0xdad6('0x6e')][_0xdad6('0x81')],'raw':!![]})[_0xdad6('0x20')](function(_0x258cb6){return _0x258cb6;});})[_0xdad6('0x20')](function(_0x213945){if(_0x213945){_0x14fee9[_0xdad6('0x26')]['contact']=_0x213945[0x0];if(!_0x51bbc2['body']['UserId'])return;return db[_0xdad6('0x70')][_0xdad6('0x53')]({'where':{'id':_0x51bbc2[_0xdad6('0x55')][_0xdad6('0x60')],'role':_0xdad6('0x61')},'attributes':['id',_0xdad6('0x36'),_0xdad6('0x71'),_0xdad6('0x72'),_0xdad6('0x73')],'raw':!![]});}return null;})['then'](function(_0x1913f7){if(!_0x1913f7)return null;_0x14fee9[_0xdad6('0x26')][_0xdad6('0x61')]=_0x1913f7;return _0x14fee9;})[_0xdad6('0x20')](function(_0x35899b){if(_0x35899b){_0x35899b[_0xdad6('0x26')][_0xdad6('0x75')]=util[_0xdad6('0x5e')](_0xdad6('0x82'),_0x51bbc2[_0xdad6('0x68')][_0xdad6('0x36')]);_0x35899b[_0xdad6('0x26')][_0xdad6('0x76')]=_0x14fee9[_0xdad6('0x76')];_0x35899b['message']['motionChannel']=_0x14fee9[_0xdad6('0x76')];_0x35899b['message'][_0xdad6('0x77')]=_0xdad6('0x32');respondWithRpcPromise(_0xdad6('0x78'),_0xdad6('0x78'),{'event':_0xdad6('0x83'),'message':_[_0xdad6('0x4a')](_0x14fee9[_0xdad6('0x26')],JSON[_0xdad6('0x84')](_0x14fee9[_0xdad6('0x67')][_0xdad6('0x7a')]))},client9002);return _0x14fee9;}return null;})[_0xdad6('0x20')](respondWithResult(_0xfeaf0b,null))[_0xdad6('0x28')](handleError(_0xfeaf0b,null));}; \ No newline at end of file +var _0x685f=['motionChannel','acceptmessage','merge','formData','params','ChatInteractionId','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','event','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','apply','reject','update','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','options','count','includeAll','findAll','rows','show','keys','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel'];(function(_0x28df99,_0x17d032){var _0x5978bf=function(_0x6606bd){while(--_0x6606bd){_0x28df99['push'](_0x28df99['shift']());}};_0x5978bf(++_0x17d032);}(_0x685f,0x120));var _0xf685=function(_0x3b4ed1,_0xf2ca19){_0x3b4ed1=_0x3b4ed1-0x0;var _0x23497e=_0x685f[_0x3b4ed1];return _0x23497e;};'use strict';var emlformat=require(_0xf685('0x0'));var rimraf=require(_0xf685('0x1'));var zipdir=require(_0xf685('0x2'));var jsonpatch=require(_0xf685('0x3'));var rp=require(_0xf685('0x4'));var moment=require(_0xf685('0x5'));var BPromise=require(_0xf685('0x6'));var Mustache=require(_0xf685('0x7'));var util=require(_0xf685('0x8'));var path=require(_0xf685('0x9'));var sox=require(_0xf685('0xa'));var csv=require(_0xf685('0xb'));var ejs=require(_0xf685('0xc'));var fs=require('fs');var fs_extra=require(_0xf685('0xd'));var _=require(_0xf685('0xe'));var squel=require(_0xf685('0xf'));var crypto=require(_0xf685('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xf685('0x11'));var toCsv=require(_0xf685('0xb'));var querystring=require(_0xf685('0x12'));var Papa=require(_0xf685('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf685('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf685('0x15'));var logger=require(_0xf685('0x16'))(_0xf685('0x17'));var utils=require(_0xf685('0x18'));var config=require(_0xf685('0x19'));var licenseUtil=require(_0xf685('0x1a'));var db=require(_0xf685('0x1b'))['db'];config['redis']=_[_0xf685('0x1c')](config[_0xf685('0x1d')],{'host':_0xf685('0x1e'),'port':0x18eb});var socket=require(_0xf685('0x1f'))(new Redis(config[_0xf685('0x1d')]));require('./chatMessage.socket')[_0xf685('0x20')](socket);var jayson=require(_0xf685('0x21'));var client=jayson[_0xf685('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xf685('0x22')][_0xf685('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3da4a9,_0x42df89,_0x111a65,_0x26c72c){return new BPromise(function(_0xd29a0f,_0x1e6957){var _0x4d3057=_0x26c72c||client;return _0x4d3057[_0xf685('0x24')](_0x3da4a9,_0x111a65)[_0xf685('0x25')](function(_0x12c94f){logger[_0xf685('0x26')](_0xf685('0x27'),_0x42df89,_0xf685('0x28'));logger[_0xf685('0x29')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x42df89,_0xf685('0x28'),JSON[_0xf685('0x2a')](_0x12c94f));if(_0x12c94f['error']){if(_0x12c94f[_0xf685('0x2b')][_0xf685('0x2c')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x42df89,_0x12c94f[_0xf685('0x2b')]['message']);return _0x1e6957(_0x12c94f['error'][_0xf685('0x2d')]);}logger[_0xf685('0x2b')](_0xf685('0x27'),_0x42df89,_0x12c94f[_0xf685('0x2b')][_0xf685('0x2d')]);return _0xd29a0f(_0x12c94f[_0xf685('0x2b')][_0xf685('0x2d')]);}else{logger[_0xf685('0x26')](_0xf685('0x27'),_0x42df89,_0xf685('0x28'));_0xd29a0f(_0x12c94f[_0xf685('0x2e')][_0xf685('0x2d')]);}})[_0xf685('0x2f')](function(_0x452224){logger['error'](_0xf685('0x27'),_0x42df89,_0x452224);_0x1e6957(_0x452224);});});}function respondWithStatusCode(_0x28bb1d,_0x4872f2){_0x4872f2=_0x4872f2||0xcc;return function(_0x328d85){if(_0x328d85){return _0x28bb1d[_0xf685('0x30')](_0x4872f2);}return _0x28bb1d[_0xf685('0x31')](_0x4872f2)['end']();};}function respondWithResult(_0x2ccfb5,_0x2290b8){_0x2290b8=_0x2290b8||0xc8;return function(_0x52d27e){if(_0x52d27e){return _0x2ccfb5[_0xf685('0x31')](_0x2290b8)[_0xf685('0x32')](_0x52d27e);}};}function respondWithFilteredResult(_0xf150fb,_0x5ad969){return function(_0x165775){if(_0x165775){var _0x121220=typeof _0x5ad969[_0xf685('0x33')]==='undefined'&&typeof _0x5ad969['limit']===_0xf685('0x34');var _0x4e9d6d=_0x165775['count'];var _0x1c1ae8=_0x121220?0x0:_0x5ad969[_0xf685('0x33')];var _0x4bb3bf=_0x121220?_0x165775['count']:_0x5ad969[_0xf685('0x33')]+_0x5ad969['limit'];var _0x94df1;if(_0x4bb3bf>=_0x4e9d6d){_0x4bb3bf=_0x4e9d6d;_0x94df1=0xc8;}else{_0x94df1=0xce;}_0xf150fb[_0xf685('0x31')](_0x94df1);return _0xf150fb['set']('Content-Range',_0x1c1ae8+'-'+_0x4bb3bf+'/'+_0x4e9d6d)[_0xf685('0x32')](_0x165775);}return null;};}function patchUpdates(_0x549ad7){return function(_0x4f4ed8){try{jsonpatch[_0xf685('0x35')](_0x4f4ed8,_0x549ad7,!![]);}catch(_0x171097){return BPromise[_0xf685('0x36')](_0x171097);}return _0x4f4ed8['save']();};}function saveUpdates(_0xbddf16,_0xb24ce4){return function(_0x1378e5){if(_0x1378e5){return _0x1378e5[_0xf685('0x37')](_0xbddf16)[_0xf685('0x25')](function(_0x43afaf){return _0x43afaf;});}return null;};}function removeEntity(_0x5105bf,_0x405986){return function(_0x44c09b){if(_0x44c09b){return _0x44c09b['destroy']()[_0xf685('0x25')](function(){_0x5105bf[_0xf685('0x31')](0xcc)[_0xf685('0x38')]();});}};}function handleEntityNotFound(_0x1575ac,_0x2754a6){return function(_0x51e23b){if(!_0x51e23b){_0x1575ac[_0xf685('0x30')](0x194);}return _0x51e23b;};}function handleError(_0x47674c,_0x5db033){_0x5db033=_0x5db033||0x1f4;return function(_0x547d60){logger[_0xf685('0x2b')](_0x547d60[_0xf685('0x39')]);if(_0x547d60[_0xf685('0x3a')]){delete _0x547d60['name'];}_0x47674c[_0xf685('0x31')](_0x5db033)[_0xf685('0x3b')](_0x547d60);};}exports[_0xf685('0x3c')]=function(_0x4ec810,_0x4fefdd){var _0x741f24={},_0x2076f6={},_0x2296e7={'count':0x0,'rows':[]};var _0x5224da=_['map'](db[_0xf685('0x3d')][_0xf685('0x3e')],function(_0x59a94f){return{'name':_0x59a94f[_0xf685('0x3f')],'type':_0x59a94f[_0xf685('0x40')][_0xf685('0x41')]};});_0x2076f6[_0xf685('0x42')]=_[_0xf685('0x43')](_0x5224da,_0xf685('0x3a'));_0x2076f6[_0xf685('0x44')]=_['keys'](_0x4ec810[_0xf685('0x44')]);_0x2076f6['filters']=_[_0xf685('0x45')](_0x2076f6['model'],_0x2076f6[_0xf685('0x44')]);_0x741f24[_0xf685('0x46')]=_[_0xf685('0x45')](_0x2076f6[_0xf685('0x42')],qs[_0xf685('0x47')](_0x4ec810['query'][_0xf685('0x47')]));_0x741f24[_0xf685('0x46')]=_0x741f24[_0xf685('0x46')][_0xf685('0x48')]?_0x741f24['attributes']:_0x2076f6[_0xf685('0x42')];if(!_0x4ec810['query'][_0xf685('0x49')](_0xf685('0x4a'))){_0x741f24[_0xf685('0x4b')]=qs[_0xf685('0x4b')](_0x4ec810[_0xf685('0x44')][_0xf685('0x4b')]);_0x741f24[_0xf685('0x33')]=qs[_0xf685('0x33')](_0x4ec810[_0xf685('0x44')][_0xf685('0x33')]);}_0x741f24[_0xf685('0x4c')]=qs['sort'](_0x4ec810[_0xf685('0x44')][_0xf685('0x4d')]);_0x741f24['where']=qs[_0xf685('0x4e')](_[_0xf685('0x4f')](_0x4ec810[_0xf685('0x44')],_0x2076f6[_0xf685('0x4e')]),_0x5224da);if(_0x4ec810[_0xf685('0x44')][_0xf685('0x50')]){_0x741f24[_0xf685('0x51')]=_['merge'](_0x741f24[_0xf685('0x51')],{'$or':_[_0xf685('0x43')](_0x5224da,function(_0x42d76b){if(_0x42d76b[_0xf685('0x40')]!==_0xf685('0x52')){var _0x5e763d={};_0x5e763d[_0x42d76b[_0xf685('0x3a')]]={'$like':'%'+_0x4ec810[_0xf685('0x44')]['filter']+'%'};return _0x5e763d;}})});}_0x741f24=_['merge']({},_0x741f24,_0x4ec810[_0xf685('0x53')]);var _0x349ee4={'where':_0x741f24[_0xf685('0x51')]};return db[_0xf685('0x3d')][_0xf685('0x54')](_0x349ee4)['then'](function(_0x1773af){_0x2296e7[_0xf685('0x54')]=_0x1773af;if(_0x4ec810[_0xf685('0x44')][_0xf685('0x55')]){_0x741f24['include']=[{'all':!![]}];}return db[_0xf685('0x3d')][_0xf685('0x56')](_0x741f24);})['then'](function(_0xcd5a5a){_0x2296e7[_0xf685('0x57')]=_0xcd5a5a;return _0x2296e7;})[_0xf685('0x25')](respondWithFilteredResult(_0x4fefdd,_0x741f24))[_0xf685('0x2f')](handleError(_0x4fefdd,null));};exports[_0xf685('0x58')]=function(_0x5ea657,_0x444ee4){var _0x1d86d0={'raw':!![],'where':{'id':_0x5ea657['params']['id']}},_0x5c5a17={};_0x5c5a17[_0xf685('0x42')]=_[_0xf685('0x59')](db['ChatMessage'][_0xf685('0x3e')]);_0x5c5a17[_0xf685('0x44')]=_[_0xf685('0x59')](_0x5ea657[_0xf685('0x44')]);_0x5c5a17[_0xf685('0x4e')]=_[_0xf685('0x45')](_0x5c5a17['model'],_0x5c5a17['query']);_0x1d86d0['attributes']=_[_0xf685('0x45')](_0x5c5a17['model'],qs[_0xf685('0x47')](_0x5ea657[_0xf685('0x44')][_0xf685('0x47')]));_0x1d86d0[_0xf685('0x46')]=_0x1d86d0[_0xf685('0x46')]['length']?_0x1d86d0['attributes']:_0x5c5a17[_0xf685('0x42')];if(_0x5ea657[_0xf685('0x44')]['includeAll']){_0x1d86d0['include']=[{'all':!![]}];}_0x1d86d0=_['merge']({},_0x1d86d0,_0x5ea657[_0xf685('0x53')]);return db['ChatMessage'][_0xf685('0x5a')](_0x1d86d0)['then'](handleEntityNotFound(_0x444ee4,null))[_0xf685('0x25')](respondWithResult(_0x444ee4,null))[_0xf685('0x2f')](handleError(_0x444ee4,null));};exports[_0xf685('0x5b')]=function(_0x197b78,_0x26ffff){return db[_0xf685('0x3d')]['create'](_0x197b78[_0xf685('0x5c')],{})[_0xf685('0x25')](respondWithResult(_0x26ffff,0xc9))['catch'](handleError(_0x26ffff,null));};exports[_0xf685('0x37')]=function(_0x760a4b,_0x5efe9a){if(_0x760a4b[_0xf685('0x5c')]['id']){delete _0x760a4b[_0xf685('0x5c')]['id'];}return db[_0xf685('0x3d')][_0xf685('0x5a')]({'where':{'id':_0x760a4b['params']['id']}})['then'](handleEntityNotFound(_0x5efe9a,null))['then'](saveUpdates(_0x760a4b['body'],null))[_0xf685('0x25')](respondWithResult(_0x5efe9a,null))['catch'](handleError(_0x5efe9a,null));};exports[_0xf685('0x5d')]=function(_0x513fd4,_0x462382){return db[_0xf685('0x3d')][_0xf685('0x5a')]({'where':{'id':_0x513fd4['params']['id']}})[_0xf685('0x25')](handleEntityNotFound(_0x462382,null))[_0xf685('0x25')](removeEntity(_0x462382,null))[_0xf685('0x2f')](handleError(_0x462382,null));};exports[_0xf685('0x5e')]=function(_0xd59889,_0x31d8a0){return db[_0xf685('0x3d')][_0xf685('0x5e')]()['then'](respondWithResult(_0x31d8a0,null))[_0xf685('0x2f')](handleError(_0x31d8a0,null));};var interaction_log=require('../../config/logger')(_0xf685('0x5f'));exports[_0xf685('0x60')]=function(_0x1e2731,_0x504715,_0x1d62d5){var _0x305b2b={'agent':{},'channel':_0xf685('0x61')};if(_0x1e2731[_0xf685('0x5c')]['id']){delete _0x1e2731[_0xf685('0x5c')]['id'];}_0x1e2731[_0xf685('0x5c')][_0xf685('0x62')]=!![];_0x1e2731['body'][_0xf685('0x63')]=moment()[_0xf685('0x64')](_0xf685('0x65'));_0x1e2731[_0xf685('0x5c')][_0xf685('0x66')]=_0x1e2731['body'][_0xf685('0x66')]||_0x1e2731[_0xf685('0x67')]['id'];_0x305b2b['agent']['id']=_0x1e2731[_0xf685('0x5c')][_0xf685('0x66')];return db[_0xf685('0x3d')]['find']({'where':{'id':_0x1e2731['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x504715,null))[_0xf685('0x25')](saveUpdates(_0x1e2731[_0xf685('0x5c')],null))[_0xf685('0x25')](function(_0x432d67){if(_0x432d67){_0x305b2b['message']=_0x432d67['get']({'plain':!![]});return db[_0xf685('0x68')][_0xf685('0x5a')]({'where':{'id':_0x432d67['ChatInteractionId']}});}return null;})[_0xf685('0x25')](handleEntityNotFound(_0x504715,null))[_0xf685('0x25')](function(_0x49b241){if(_0x49b241){return _0x49b241[_0xf685('0x37')]({'UserId':_0x1e2731[_0xf685('0x5c')][_0xf685('0x66')],'read1stAt':_['isNil'](_0x49b241[_0xf685('0x69')])?moment()[_0xf685('0x64')](_0xf685('0x65')):undefined});}return null;})[_0xf685('0x25')](function(_0x227f49){if(_0x227f49){_0x305b2b['interaction']=_0x227f49['get']({'plain':!![]});interaction_log['info'](_0xf685('0x6a'),_0x1e2731['user']['id'],_0x1e2731[_0xf685('0x67')][_0xf685('0x3a')],_0x1e2731[_0xf685('0x67')][_0xf685('0x6b')],_0x305b2b[_0xf685('0x6c')]['id'],_0x1e2731[_0xf685('0x5c')]?JSON[_0xf685('0x2a')](_0x1e2731[_0xf685('0x5c')]):_0xf685('0x6d'));return respondWithRpcPromise(_0xf685('0x6e'),_0xf685('0x6f'),_0x305b2b);}return null;})[_0xf685('0x25')](function(_0xc536d2){var _0x4f0e2f=_0xf685('0x70')+_0xc536d2[_0xf685('0x2d')][_0xf685('0x71')];return db[_0xf685('0x72')][_0xf685('0x44')](_0x4f0e2f,{'type':db[_0xf685('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0xf685('0x25')](function(_0x5d6b2f){return _0x5d6b2f;});})[_0xf685('0x25')](function(_0x1e132e){if(_0x1e132e){_0x305b2b['message'][_0xf685('0x74')]=_0x1e132e[0x0];if(!_0x1e2731['body']['UserId'])return;return db[_0xf685('0x75')][_0xf685('0x5a')]({'where':{'id':_0x1e2731[_0xf685('0x5c')][_0xf685('0x66')],'role':_0xf685('0x76')},'attributes':['id',_0xf685('0x3a'),_0xf685('0x77'),_0xf685('0x78'),_0xf685('0x79')],'raw':!![]});}return null;})['then'](function(_0x2d6943){if(!_0x2d6943)return null;_0x305b2b[_0xf685('0x2d')][_0xf685('0x76')]=_0x2d6943;return _0x305b2b;})[_0xf685('0x25')](function(_0x16defb){if(_0x16defb){if(_0x1e2731[_0xf685('0x5c')][_0xf685('0x7a')]){_0x305b2b[_0xf685('0x2d')][_0xf685('0x7b')]=util[_0xf685('0x64')](_0xf685('0x7c'),_0x1e2731[_0xf685('0x67')][_0xf685('0x3a')]);_0x305b2b['message'][_0xf685('0x7d')]=_0x305b2b[_0xf685('0x7d')];_0x305b2b['message'][_0xf685('0x7e')]=_0x305b2b[_0xf685('0x7d')];_0x305b2b['message']['event']=_0xf685('0x60');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xf685('0x7f'),'message':_[_0xf685('0x80')](_0x305b2b[_0xf685('0x2d')],JSON['parse'](_0x305b2b[_0xf685('0x6c')][_0xf685('0x81')]))},client9002)['then'](function(){return _0x305b2b;});}return _0x305b2b;}return null;})[_0xf685('0x25')](respondWithResult(_0x504715,null))['catch'](handleError(_0x504715,null));};var interaction_log=require('../../config/logger')(_0xf685('0x5f'));exports[_0xf685('0x36')]=function(_0x1750c8,_0x32f4bd,_0x71b3ef){var _0x1cae38={'agent':{},'channel':'chat'};if(_0x1750c8[_0xf685('0x5c')]['id']){delete _0x1750c8['body']['id'];}_0x1750c8[_0xf685('0x5c')][_0xf685('0x66')]=_0x1750c8['body'][_0xf685('0x66')]||_0x1750c8[_0xf685('0x67')]['id'];_0x1cae38[_0xf685('0x76')]['id']=_0x1750c8['body'][_0xf685('0x66')];return db['ChatMessage'][_0xf685('0x5a')]({'where':{'id':_0x1750c8[_0xf685('0x82')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32f4bd,null))[_0xf685('0x25')](function(_0x26f014){if(_0x26f014){_0x1cae38[_0xf685('0x2d')]=_0x26f014['get']({'plain':!![]});return db[_0xf685('0x68')][_0xf685('0x5a')]({'where':{'id':_0x26f014[_0xf685('0x83')]}});}return null;})[_0xf685('0x25')](handleEntityNotFound(_0x32f4bd,null))[_0xf685('0x25')](function(_0x5b17ed){if(_0x5b17ed){_0x1cae38[_0xf685('0x6c')]=_0x5b17ed[_0xf685('0x84')]({'plain':!![]});interaction_log[_0xf685('0x26')](_0xf685('0x85'),_0x1750c8[_0xf685('0x67')]['id'],_0x1750c8[_0xf685('0x67')][_0xf685('0x3a')],_0x1750c8[_0xf685('0x67')][_0xf685('0x6b')],_0x1cae38['interaction']['id'],_0x1750c8[_0xf685('0x5c')]?JSON[_0xf685('0x2a')](_0x1750c8[_0xf685('0x5c')]):_0xf685('0x6d'));return respondWithRpcPromise(_0xf685('0x86'),'rejectMessage',_0x1cae38);}return null;})[_0xf685('0x25')](function(_0xf97e77){var _0x337e94=_0xf685('0x70')+_0xf97e77[_0xf685('0x2d')]['ContactId'];return db[_0xf685('0x72')][_0xf685('0x44')](_0x337e94,{'type':db[_0xf685('0x73')]['QueryTypes'][_0xf685('0x87')],'raw':!![]})[_0xf685('0x25')](function(_0x188a88){return _0x188a88;});})[_0xf685('0x25')](function(_0x1c133c){if(_0x1c133c){_0x1cae38['message'][_0xf685('0x74')]=_0x1c133c[0x0];if(!_0x1750c8[_0xf685('0x5c')]['UserId'])return;return db[_0xf685('0x75')]['find']({'where':{'id':_0x1750c8['body'][_0xf685('0x66')],'role':_0xf685('0x76')},'attributes':['id','name',_0xf685('0x77'),_0xf685('0x78'),'internal'],'raw':!![]});}return null;})[_0xf685('0x25')](function(_0x92b678){if(!_0x92b678)return null;_0x1cae38['message'][_0xf685('0x76')]=_0x92b678;return _0x1cae38;})[_0xf685('0x25')](function(_0x276720){if(_0x276720){_0x276720[_0xf685('0x2d')][_0xf685('0x7b')]=util[_0xf685('0x64')](_0xf685('0x7c'),_0x1750c8[_0xf685('0x67')]['name']);_0x276720['message'][_0xf685('0x7d')]=_0x1cae38['channel'];_0x276720[_0xf685('0x2d')][_0xf685('0x7e')]=_0x1cae38['channel'];_0x276720[_0xf685('0x2d')][_0xf685('0x88')]=_0xf685('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0xf685('0x80')](_0x1cae38[_0xf685('0x2d')],JSON[_0xf685('0x89')](_0x1cae38[_0xf685('0x6c')]['formData']))},client9002);return _0x1cae38;}return null;})[_0xf685('0x25')](respondWithResult(_0x32f4bd,null))['catch'](handleError(_0x32f4bd,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 575e01b..ed15448 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 _0x1116=['remove','emit','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners','update'];(function(_0xe7643d,_0x19b5ea){var _0x2322d9=function(_0x33cc19){while(--_0x33cc19){_0xe7643d['push'](_0xe7643d['shift']());}};_0x2322d9(++_0x19b5ea);}(_0x1116,0x188));var _0x6111=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x1116[_0xf71120];return _0xbe2fd3;};'use strict';var EventEmitter=require(_0x6111('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x6111('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6111('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6111('0x3'),'afterDestroy':_0x6111('0x4')};function emitEvent(_0x2ce411){return function(_0x1b5eb8,_0x5387f6,_0x37d930){ChatMessageEvents[_0x6111('0x5')](_0x2ce411+':'+_0x1b5eb8['id'],_0x1b5eb8);ChatMessageEvents[_0x6111('0x5')](_0x2ce411,_0x1b5eb8);_0x37d930(null);};}for(var e in events){if(events[_0x6111('0x6')](e)){var event=events[e];ChatMessage[_0x6111('0x7')](e,emitEvent(event));}}module[_0x6111('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x1853=['exports','ChatMessage','save','update','emit'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1853,0x1aa));var _0x3185=function(_0x466091,_0xcdc0f7){_0x466091=_0x466091-0x0;var _0xfc1ee0=_0x1853[_0x466091];return _0xfc1ee0;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x3185('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3185('0x1'),'afterUpdate':_0x3185('0x2'),'afterDestroy':'remove'};function emitEvent(_0x38839d){return function(_0x2294a0,_0x1bf603,_0x5677e8){ChatMessageEvents[_0x3185('0x3')](_0x38839d+':'+_0x2294a0['id'],_0x2294a0);ChatMessageEvents[_0x3185('0x3')](_0x38839d,_0x2294a0);_0x5677e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3185('0x4')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 0a36d2d..ab7211d 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 _0x54a7=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','error','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4a82fa,_0x20592c){var _0x2fdec4=function(_0x42a716){while(--_0x42a716){_0x4a82fa['push'](_0x4a82fa['shift']());}};_0x2fdec4(++_0x20592c);}(_0x54a7,0xe9));var _0x754a=function(_0x122cbd,_0x19b7ce){_0x122cbd=_0x122cbd-0x0;var _0x5ea0b1=_0x54a7[_0x122cbd];return _0x5ea0b1;};'use strict';var _=require(_0x754a('0x0'));var util=require(_0x754a('0x1'));var logger=require(_0x754a('0x2'))('api');var moment=require(_0x754a('0x3'));var BPromise=require('bluebird');var rp=require(_0x754a('0x4'));var fs=require('fs');var path=require(_0x754a('0x5'));var rimraf=require(_0x754a('0x6'));var config=require(_0x754a('0x7'));var attributes=require(_0x754a('0x8'));module[_0x754a('0x9')]=function(_0x426afc,_0x3ed013){return _0x426afc[_0x754a('0xa')](_0x754a('0xb'),attributes,{'tableName':_0x754a('0xc'),'paranoid':![],'indexes':[{'name':_0x754a('0xd'),'fields':[_0x754a('0xe')],'type':_0x754a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b8f89,_0x3295bc,_0x362f32){var _0x5b8723=_0x426afc[_0x754a('0x10')];var _0x542c6e=_0x4b8f89[_0x754a('0x11')]({'plain':!![]});if(_0x542c6e[_0x754a('0x12')][_0x754a('0x13')]()==='in'||_0x542c6e[_0x754a('0x12')][_0x754a('0x13')]()===_0x754a('0x14')&&!_0x542c6e[_0x754a('0x15')]&&!_[_0x754a('0x16')](_0x542c6e[_0x754a('0x17')])){_0x5b8723[_0x754a('0x18')][_0x754a('0x19')]({'where':{'id':_0x542c6e[_0x754a('0x1a')]}})['then'](function(_0x1c8845){if(_0x1c8845){_0x1c8845[_0x754a('0x1b')]({'lastMsgAt':_0x542c6e[_0x754a('0x1c')],'lastMsgDirection':_0x542c6e[_0x754a('0x12')][_0x754a('0x13')]()});}})['catch'](function(_0x1ec937){console[_0x754a('0x1d')](_0x1ec937);});}_0x362f32();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3999=['error','utf8mb4','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','then','update','createdAt'];(function(_0x584b87,_0x3542b8){var _0x3e7b7e=function(_0xe8964d){while(--_0xe8964d){_0x584b87['push'](_0x584b87['shift']());}};_0x3e7b7e(++_0x3542b8);}(_0x3999,0x18a));var _0x9399=function(_0x456107,_0x5a3c97){_0x456107=_0x456107-0x0;var _0x205010=_0x3999[_0x456107];return _0x205010;};'use strict';var _=require(_0x9399('0x0'));var util=require('util');var logger=require(_0x9399('0x1'))(_0x9399('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9399('0x3'));var fs=require('fs');var path=require(_0x9399('0x4'));var rimraf=require(_0x9399('0x5'));var config=require(_0x9399('0x6'));var attributes=require(_0x9399('0x7'));module[_0x9399('0x8')]=function(_0xbe96e6,_0x82a508){return _0xbe96e6[_0x9399('0x9')]('ChatMessage',attributes,{'tableName':_0x9399('0xa'),'paranoid':![],'indexes':[{'name':_0x9399('0xb'),'fields':[_0x9399('0xc')],'type':_0x9399('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x182cce,_0x11b121,_0x5b68a7){var _0x3b1d12=_0xbe96e6[_0x9399('0xe')];var _0xded2a8=_0x182cce[_0x9399('0xf')]({'plain':!![]});if(_0xded2a8[_0x9399('0x10')][_0x9399('0x11')]()==='in'||_0xded2a8[_0x9399('0x10')]['toLowerCase']()===_0x9399('0x12')&&!_0xded2a8[_0x9399('0x13')]&&!_[_0x9399('0x14')](_0xded2a8[_0x9399('0x15')])){_0x3b1d12[_0x9399('0x16')]['findOne']({'where':{'id':_0xded2a8['ChatInteractionId']}})[_0x9399('0x17')](function(_0x2bac60){if(_0x2bac60){_0x2bac60[_0x9399('0x18')]({'lastMsgAt':_0xded2a8[_0x9399('0x19')],'lastMsgDirection':_0xded2a8[_0x9399('0x10')][_0x9399('0x11')]()});}})['catch'](function(_0x23f26a){console[_0x9399('0x1a')](_0x23f26a);});}_0x5b68a7();}},'charset':_0x9399('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e3f70f1..d4ca0c0 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 _0x1014=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','error','ChatMessage,\x20%s,\x20%s','message','request\x20sent','catch','CreateChatMessage','create','options','raw','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e26b5,_0xdc679c){var _0x1f8b6a=function(_0x34d4e2){while(--_0x34d4e2){_0x5e26b5['push'](_0x5e26b5['shift']());}};_0x1f8b6a(++_0xdc679c);}(_0x1014,0x1c7));var _0x4101=function(_0x401221,_0x7b3acc){_0x401221=_0x401221-0x0;var _0x5e9bb9=_0x1014[_0x401221];return _0x5e9bb9;};'use strict';var _=require('lodash');var util=require(_0x4101('0x0'));var moment=require('moment');var BPromise=require(_0x4101('0x1'));var rs=require(_0x4101('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4101('0x3'))['db'];var utils=require(_0x4101('0x4'));var logger=require('../../config/logger')(_0x4101('0x5'));var config=require(_0x4101('0x6'));var jayson=require(_0x4101('0x7'));var client=jayson[_0x4101('0x8')][_0x4101('0x9')]({'port':0x232a});config[_0x4101('0xa')]=_[_0x4101('0xb')](config[_0x4101('0xa')],{'host':_0x4101('0xc'),'port':0x18eb});var socket=require(_0x4101('0xd'))(new Redis(config[_0x4101('0xa')]));require('./chatMessage.socket')[_0x4101('0xe')](socket);function respondWithRpcPromise(_0x2f98ed,_0x57728d,_0x769161){return new BPromise(function(_0x154aae,_0x27e99b){return client[_0x4101('0xf')](_0x2f98ed,_0x769161)[_0x4101('0x10')](function(_0x1f1471){logger[_0x4101('0x11')]('ChatMessage,\x20%s,\x20%s',_0x57728d,'request\x20sent');logger[_0x4101('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57728d,'request\x20sent',JSON['stringify'](_0x1f1471));if(_0x1f1471[_0x4101('0x13')]){if(_0x1f1471[_0x4101('0x13')]['code']===0x1f4){logger[_0x4101('0x13')](_0x4101('0x14'),_0x57728d,_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);return _0x27e99b(_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);}logger[_0x4101('0x13')](_0x4101('0x14'),_0x57728d,_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);return _0x154aae(_0x1f1471[_0x4101('0x13')]['message']);}else{logger[_0x4101('0x11')](_0x4101('0x14'),_0x57728d,_0x4101('0x16'));_0x154aae(_0x1f1471['result'][_0x4101('0x15')]);}})[_0x4101('0x17')](function(_0x44f73e){logger[_0x4101('0x13')]('ChatMessage,\x20%s,\x20%s',_0x57728d,_0x44f73e);_0x27e99b(_0x44f73e);});});}exports[_0x4101('0x18')]=function(_0x2cb011){var _0x7f7e79=this;return new Promise(function(_0x13b129,_0xd88bcb){return db['ChatMessage'][_0x4101('0x19')](_0x2cb011['body'],{'raw':_0x2cb011[_0x4101('0x1a')]?_0x2cb011[_0x4101('0x1a')][_0x4101('0x1b')]===undefined?!![]:![]:!![]})[_0x4101('0x10')](function(_0x238134){logger[_0x4101('0x11')](_0x4101('0x18'),_0x2cb011);logger[_0x4101('0x12')](_0x4101('0x18'),_0x2cb011,JSON[_0x4101('0x1c')](_0x238134));_0x13b129(_0x238134);})[_0x4101('0x17')](function(_0x436a51){logger[_0x4101('0x13')]('CreateChatMessage',_0x436a51['message'],_0x2cb011);_0xd88bcb(_0x7f7e79[_0x4101('0x13')](0x1f4,_0x436a51['message']));});});}; \ No newline at end of file +var _0x52aa=['moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatMessage','create','body','options','raw','debug','stringify','lodash'];(function(_0x2f6411,_0x406e6e){var _0x310728=function(_0x290466){while(--_0x290466){_0x2f6411['push'](_0x2f6411['shift']());}};_0x310728(++_0x406e6e);}(_0x52aa,0x1c1));var _0xa52a=function(_0x1ac48e,_0x5c2868){_0x1ac48e=_0x1ac48e-0x0;var _0x222ddd=_0x52aa[_0x1ac48e];return _0x222ddd;};'use strict';var _=require(_0xa52a('0x0'));var util=require('util');var moment=require(_0xa52a('0x1'));var BPromise=require('bluebird');var rs=require(_0xa52a('0x2'));var fs=require('fs');var Redis=require(_0xa52a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa52a('0x4'));var logger=require('../../config/logger')(_0xa52a('0x5'));var config=require('../../config/environment');var jayson=require(_0xa52a('0x6'));var client=jayson[_0xa52a('0x7')]['http']({'port':0x232a});config[_0xa52a('0x8')]=_[_0xa52a('0x9')](config['redis'],{'host':_0xa52a('0xa'),'port':0x18eb});var socket=require(_0xa52a('0xb'))(new Redis(config['redis']));require(_0xa52a('0xc'))[_0xa52a('0xd')](socket);function respondWithRpcPromise(_0x4b81e5,_0x55f1b7,_0x2d19c5){return new BPromise(function(_0x2b3bb6,_0x377bce){return client['request'](_0x4b81e5,_0x2d19c5)[_0xa52a('0xe')](function(_0x2fb649){logger[_0xa52a('0xf')](_0xa52a('0x10'),_0x55f1b7,'request\x20sent');logger['debug'](_0xa52a('0x11'),_0x55f1b7,_0xa52a('0x12'),JSON['stringify'](_0x2fb649));if(_0x2fb649['error']){if(_0x2fb649[_0xa52a('0x13')]['code']===0x1f4){logger['error'](_0xa52a('0x10'),_0x55f1b7,_0x2fb649[_0xa52a('0x13')][_0xa52a('0x14')]);return _0x377bce(_0x2fb649['error']['message']);}logger[_0xa52a('0x13')](_0xa52a('0x10'),_0x55f1b7,_0x2fb649[_0xa52a('0x13')]['message']);return _0x2b3bb6(_0x2fb649['error'][_0xa52a('0x14')]);}else{logger[_0xa52a('0xf')](_0xa52a('0x10'),_0x55f1b7,_0xa52a('0x12'));_0x2b3bb6(_0x2fb649[_0xa52a('0x15')][_0xa52a('0x14')]);}})[_0xa52a('0x16')](function(_0x95a9d6){logger[_0xa52a('0x13')]('ChatMessage,\x20%s,\x20%s',_0x55f1b7,_0x95a9d6);_0x377bce(_0x95a9d6);});});}exports[_0xa52a('0x17')]=function(_0x3c6c09){var _0x575eeb=this;return new Promise(function(_0x5e6215,_0x215801){return db['ChatMessage'][_0xa52a('0x18')](_0x3c6c09[_0xa52a('0x19')],{'raw':_0x3c6c09[_0xa52a('0x1a')]?_0x3c6c09[_0xa52a('0x1a')][_0xa52a('0x1b')]===undefined?!![]:![]:!![]})[_0xa52a('0xe')](function(_0x31935f){logger['info'](_0xa52a('0x17'),_0x3c6c09);logger[_0xa52a('0x1c')]('CreateChatMessage',_0x3c6c09,JSON[_0xa52a('0x1d')](_0x31935f));_0x5e6215(_0x31935f);})[_0xa52a('0x16')](function(_0x360992){logger[_0xa52a('0x13')]('CreateChatMessage',_0x360992[_0xa52a('0x14')],_0x3c6c09);_0x215801(_0x575eeb[_0xa52a('0x13')](0x1f4,_0x360992[_0xa52a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7bd8458..4e4635f 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 _0xa8eb=['length','./chatMessage.events','remove','register'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xa8eb,0x179));var _0xba8e=function(_0x34aa65,_0x4fb4a0){_0x34aa65=_0x34aa65-0x0;var _0x3c39ce=_0xa8eb[_0x34aa65];return _0x3c39ce;};'use strict';var ChatMessageEvents=require(_0xba8e('0x0'));var events=['save',_0xba8e('0x1'),'update'];function createListener(_0xd7f19f,_0x35f485){return function(_0x3b8fee){_0x35f485['emit'](_0xd7f19f,_0x3b8fee);};}function removeListener(_0x353df2,_0x368ce6){return function(){ChatMessageEvents['removeListener'](_0x353df2,_0x368ce6);};}exports[_0xba8e('0x2')]=function(_0x57e345){for(var _0x14c3ac=0x0,_0x52a8ef=events[_0xba8e('0x3')];_0x14c3ac<_0x52a8ef;_0x14c3ac++){var _0x69ccbe=events[_0x14c3ac];var _0x4b1bd6=createListener('chatMessage:'+_0x69ccbe,_0x57e345);ChatMessageEvents['on'](_0x69ccbe,_0x4b1bd6);}}; \ No newline at end of file +var _0x33c5=['remove','emit','removeListener','register','length','chatMessage:','save'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x33c5,0xe6));var _0x533c=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x33c5[_0x20c9b2];return _0x2c6030;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x533c('0x0'),_0x533c('0x1'),'update'];function createListener(_0x9dafa,_0x26b916){return function(_0x221e43){_0x26b916[_0x533c('0x2')](_0x9dafa,_0x221e43);};}function removeListener(_0x358127,_0x49609e){return function(){ChatMessageEvents[_0x533c('0x3')](_0x358127,_0x49609e);};}exports[_0x533c('0x4')]=function(_0x31d912){for(var _0x151732=0x0,_0x34ca89=events[_0x533c('0x5')];_0x151732<_0x34ca89;_0x151732++){var _0x3a009b=events[_0x151732];var _0x36d74e=createListener(_0x533c('0x6')+_0x3a009b,_0x31d912);ChatMessageEvents['on'](_0x3a009b,_0x36d74e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d01a25a..a3502c3 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 _0x75c9=['create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','chat','chatmessage:create'];(function(_0x39eafc,_0x33c5e9){var _0x3008f6=function(_0x34479f){while(--_0x34479f){_0x39eafc['push'](_0x39eafc['shift']());}};_0x3008f6(++_0x33c5e9);}(_0x75c9,0x127));var _0x975c=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x75c9[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x975c('0x0'));var util=require('util');var path=require(_0x975c('0x1'));var timeout=require('connect-timeout');var express=require(_0x975c('0x2'));var router=express['Router']();var fs_extra=require(_0x975c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x975c('0x4'));var config=require(_0x975c('0x5'));var controller=require(_0x975c('0x6'));router[_0x975c('0x7')]('/',auth['isAuthenticated'](),controller[_0x975c('0x8')]);router[_0x975c('0x7')](_0x975c('0x9'),auth[_0x975c('0xa')](),controller['describe']);router[_0x975c('0x7')](_0x975c('0xb'),auth[_0x975c('0xa')](),controller[_0x975c('0xc')]);router[_0x975c('0xd')]('/',auth[_0x975c('0xa')](),interaction[_0x975c('0xe')](_0x975c('0xf'),_0x975c('0x10')),controller[_0x975c('0x11')]);router[_0x975c('0x12')]('/:id',controller[_0x975c('0x13')]);router[_0x975c('0x12')](_0x975c('0x14'),auth[_0x975c('0xa')](),controller[_0x975c('0x15')]);router[_0x975c('0x12')]('/:id/reject',auth[_0x975c('0xa')](),controller[_0x975c('0x16')]);router[_0x975c('0x17')](_0x975c('0xb'),auth['isAuthenticated'](),controller[_0x975c('0x18')]);module[_0x975c('0x19')]=router; \ No newline at end of file +var _0x3634=['util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','show','post','tracked','chatmessage:create','create','put','/:id','/:id/accept','/:id/reject','reject','delete','destroy'];(function(_0x3c0048,_0x5cd773){var _0x30cc52=function(_0x4f664d){while(--_0x4f664d){_0x3c0048['push'](_0x3c0048['shift']());}};_0x30cc52(++_0x5cd773);}(_0x3634,0x1ce));var _0x4363=function(_0x235e3c,_0x4f2c6f){_0x235e3c=_0x235e3c-0x0;var _0x390498=_0x3634[_0x235e3c];return _0x390498;};'use strict';var multer=require('multer');var util=require(_0x4363('0x0'));var path=require(_0x4363('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4363('0x2')]();var fs_extra=require(_0x4363('0x3'));var auth=require(_0x4363('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4363('0x5'));var controller=require('./chatMessage.controller');router[_0x4363('0x6')]('/',auth[_0x4363('0x7')](),controller['index']);router[_0x4363('0x6')]('/describe',auth[_0x4363('0x7')](),controller[_0x4363('0x8')]);router[_0x4363('0x6')]('/:id',auth[_0x4363('0x7')](),controller[_0x4363('0x9')]);router[_0x4363('0xa')]('/',auth[_0x4363('0x7')](),interaction[_0x4363('0xb')]('chat',_0x4363('0xc')),controller[_0x4363('0xd')]);router[_0x4363('0xe')](_0x4363('0xf'),controller['update']);router[_0x4363('0xe')](_0x4363('0x10'),auth[_0x4363('0x7')](),controller['accept']);router[_0x4363('0xe')](_0x4363('0x11'),auth[_0x4363('0x7')](),controller[_0x4363('0x12')]);router[_0x4363('0x13')](_0x4363('0xf'),auth[_0x4363('0x7')](),controller[_0x4363('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 31cbe8b..6681334 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 _0x5f66=['medium','TEXT','exports'];(function(_0x574a1f,_0x554c25){var _0xa334dc=function(_0x34df7f){while(--_0x34df7f){_0x574a1f['push'](_0x574a1f['shift']());}};_0xa334dc(++_0x554c25);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x1d1e67,_0x332843){var _0x2caf87=function(_0x2b1bd1){while(--_0x2b1bd1){_0x1d1e67['push'](_0x1d1e67['shift']());}};_0x2caf87(++_0x332843);}(_0xdb28,0x106));var _0x8db2=function(_0x488642,_0x4bebd2){_0x488642=_0x488642-0x0;var _0x3d209c=_0xdb28[_0x488642];return _0x3d209c;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 85d90ef..3499459 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x353ce0,_0x2242e2){var _0x5aa4c1=function(_0x202385){while(--_0x202385){_0x353ce0['push'](_0x353ce0['shift']());}};_0x5aa4c1(++_0x2242e2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x23d19d,_0x56fe71){var _0x139eee=function(_0xdb7f74){while(--_0xdb7f74){_0x23d19d['push'](_0x23d19d['shift']());}};_0x139eee(++_0x56fe71);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index d13276a..6387894 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3304=['remove','emit','hook','exports','setMaxListeners','save','update'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3304,0xc8));var _0x4330=function(_0x1d1d1a,_0x4d3eca){_0x1d1d1a=_0x1d1d1a-0x0;var _0x53027b=_0x3304[_0x1d1d1a];return _0x53027b;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4330('0x0')](0x0);var events={'afterCreate':_0x4330('0x1'),'afterUpdate':_0x4330('0x2'),'afterDestroy':_0x4330('0x3')};function emitEvent(_0x5f1fad){return function(_0xfd8c3e,_0x363ea6,_0xcc4149){ChatOfflineMessageEvents[_0x4330('0x4')](_0x5f1fad+':'+_0xfd8c3e['id'],_0xfd8c3e);ChatOfflineMessageEvents[_0x4330('0x4')](_0x5f1fad,_0xfd8c3e);_0xcc4149(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x4330('0x5')](e,emitEvent(event));}}module[_0x4330('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xaec7=['emit','hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','save','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaec7,0x8b));var _0x7aec=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xaec7[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require(_0x7aec('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x7aec('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7aec('0x2')](0x0);var events={'afterCreate':_0x7aec('0x3'),'afterUpdate':'update','afterDestroy':_0x7aec('0x4')};function emitEvent(_0x5dc44d){return function(_0x2c552f,_0x59871a,_0x15b9f7){ChatOfflineMessageEvents[_0x7aec('0x5')](_0x5dc44d+':'+_0x2c552f['id'],_0x2c552f);ChatOfflineMessageEvents[_0x7aec('0x5')](_0x5dc44d,_0x2c552f);_0x15b9f7(null);};}for(var e in events){if(events[_0x7aec('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x7aec('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c2ee5eb..43f4d60 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 _0x0282=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x4aabc1,_0x15e9b0){var _0x302c36=function(_0x5d2280){while(--_0x5d2280){_0x4aabc1['push'](_0x4aabc1['shift']());}};_0x302c36(++_0x15e9b0);}(_0x0282,0x118));var _0x2028=function(_0x144337,_0x1e2197){_0x144337=_0x144337-0x0;var _0x536147=_0x0282[_0x144337];return _0x536147;};'use strict';var attributes=require(_0x2028('0x0'));module['exports']=function(_0x41e43d){return _0x41e43d[_0x2028('0x1')](_0x2028('0x2'),attributes,{'tableName':_0x2028('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2028('0x4'),'collate':_0x2028('0x5')});}; \ No newline at end of file +var _0xb24b=['define','ChatOfflineMessage','chat_offline_messages','exports'];(function(_0x14c3e7,_0xb0e43b){var _0x26925b=function(_0xcaf04a){while(--_0xcaf04a){_0x14c3e7['push'](_0x14c3e7['shift']());}};_0x26925b(++_0xb0e43b);}(_0xb24b,0x1cb));var _0xbb24=function(_0x433be9,_0x23ab52){_0x433be9=_0x433be9-0x0;var _0x58a05f=_0xb24b[_0x433be9];return _0x58a05f;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xbb24('0x0')]=function(_0x2cf7e5){return _0x2cf7e5[_0xbb24('0x1')](_0xbb24('0x2'),attributes,{'tableName':_0xbb24('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2931980..7055551 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 _0xf463=['result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf463,0x94));var _0x3f46=function(_0x3b92df,_0xe3ea6b){_0x3b92df=_0x3b92df-0x0;var _0x175211=_0xf463[_0x3b92df];return _0x175211;};'use strict';var _=require('lodash');var util=require(_0x3f46('0x0'));var moment=require('moment');var BPromise=require(_0x3f46('0x1'));var rs=require(_0x3f46('0x2'));var fs=require('fs');var Redis=require(_0x3f46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f46('0x4'));var logger=require(_0x3f46('0x5'))(_0x3f46('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f46('0x7'));var client=jayson[_0x3f46('0x8')][_0x3f46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5626d5,_0x3ba556,_0x288523){return new BPromise(function(_0x43b630,_0x3d1c58){return client[_0x3f46('0xa')](_0x5626d5,_0x288523)['then'](function(_0x27985d){logger[_0x3f46('0xb')](_0x3f46('0xc'),_0x3ba556,_0x3f46('0xd'));logger[_0x3f46('0xe')](_0x3f46('0xf'),_0x3ba556,_0x3f46('0xd'),JSON[_0x3f46('0x10')](_0x27985d));if(_0x27985d[_0x3f46('0x11')]){if(_0x27985d[_0x3f46('0x11')][_0x3f46('0x12')]===0x1f4){logger[_0x3f46('0x11')](_0x3f46('0xc'),_0x3ba556,_0x27985d['error']['message']);return _0x3d1c58(_0x27985d[_0x3f46('0x11')][_0x3f46('0x13')]);}logger[_0x3f46('0x11')](_0x3f46('0xc'),_0x3ba556,_0x27985d['error'][_0x3f46('0x13')]);return _0x43b630(_0x27985d['error'][_0x3f46('0x13')]);}else{logger[_0x3f46('0xb')](_0x3f46('0xc'),_0x3ba556,'request\x20sent');_0x43b630(_0x27985d[_0x3f46('0x14')][_0x3f46('0x13')]);}})['catch'](function(_0x186678){logger[_0x3f46('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3ba556,_0x186678);_0x3d1c58(_0x186678);});});} \ No newline at end of file +var _0x49c2=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0xd070f5,_0x13fefd){var _0xf8dc56=function(_0x4a6223){while(--_0x4a6223){_0xd070f5['push'](_0xd070f5['shift']());}};_0xf8dc56(++_0x13fefd);}(_0x49c2,0x176));var _0x249c=function(_0x7ef709,_0x12cdce){_0x7ef709=_0x7ef709-0x0;var _0x502b71=_0x49c2[_0x7ef709];return _0x502b71;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var moment=require(_0x249c('0x2'));var BPromise=require(_0x249c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x249c('0x4'));var db=require(_0x249c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x249c('0x6'))(_0x249c('0x7'));var config=require('../../config/environment');var jayson=require(_0x249c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x559ced,_0x4e6e24,_0xbe365c){return new BPromise(function(_0x2d2d00,_0xfd28c0){return client[_0x249c('0x9')](_0x559ced,_0xbe365c)[_0x249c('0xa')](function(_0x3d61a2){logger[_0x249c('0xb')](_0x249c('0xc'),_0x4e6e24,_0x249c('0xd'));logger[_0x249c('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4e6e24,_0x249c('0xd'),JSON[_0x249c('0xf')](_0x3d61a2));if(_0x3d61a2['error']){if(_0x3d61a2['error'][_0x249c('0x10')]===0x1f4){logger[_0x249c('0x11')](_0x249c('0xc'),_0x4e6e24,_0x3d61a2[_0x249c('0x11')][_0x249c('0x12')]);return _0xfd28c0(_0x3d61a2[_0x249c('0x11')][_0x249c('0x12')]);}logger[_0x249c('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4e6e24,_0x3d61a2[_0x249c('0x11')][_0x249c('0x12')]);return _0x2d2d00(_0x3d61a2[_0x249c('0x11')][_0x249c('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4e6e24,_0x249c('0xd'));_0x2d2d00(_0x3d61a2[_0x249c('0x13')][_0x249c('0x12')]);}})[_0x249c('0x14')](function(_0x2d294a){logger[_0x249c('0x11')](_0x249c('0xc'),_0x4e6e24,_0x2d294a);_0xfd28c0(_0x2d294a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c4c1851..b34c412 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 _0x1ca4=['post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x1ca4,0x155));var _0x41ca=function(_0x2e2a96,_0x226e9f){_0x2e2a96=_0x2e2a96-0x0;var _0x3c07c6=_0x1ca4[_0x2e2a96];return _0x3c07c6;};'use strict';var multer=require(_0x41ca('0x0'));var util=require('util');var path=require(_0x41ca('0x1'));var timeout=require(_0x41ca('0x2'));var express=require(_0x41ca('0x3'));var router=express[_0x41ca('0x4')]();var fs_extra=require(_0x41ca('0x5'));var auth=require(_0x41ca('0x6'));var interaction=require(_0x41ca('0x7'));var config=require(_0x41ca('0x8'));var controller=require(_0x41ca('0x9'));router[_0x41ca('0xa')]('/',auth[_0x41ca('0xb')](),controller['index']);router[_0x41ca('0xa')](_0x41ca('0xc'),auth[_0x41ca('0xb')](),controller[_0x41ca('0xd')]);router[_0x41ca('0xa')](_0x41ca('0xe'),auth['isAuthenticated'](),controller[_0x41ca('0xf')]);router[_0x41ca('0x10')]('/',auth[_0x41ca('0xb')](),controller[_0x41ca('0x11')]);router['put'](_0x41ca('0xe'),auth['isAuthenticated'](),controller[_0x41ca('0x12')]);router[_0x41ca('0x13')]('/:id',auth[_0x41ca('0xb')](),controller['destroy']);module[_0x41ca('0x14')]=router; \ No newline at end of file +var _0xf99c=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy'];(function(_0x3f62b8,_0x3ed080){var _0x59cd53=function(_0x33409e){while(--_0x33409e){_0x3f62b8['push'](_0x3f62b8['shift']());}};_0x59cd53(++_0x3ed080);}(_0xf99c,0x1b9));var _0xcf99=function(_0x33d10a,_0x42d7e7){_0x33d10a=_0x33d10a-0x0;var _0x4b625d=_0xf99c[_0x33d10a];return _0x4b625d;};'use strict';var multer=require(_0xcf99('0x0'));var util=require(_0xcf99('0x1'));var path=require(_0xcf99('0x2'));var timeout=require(_0xcf99('0x3'));var express=require(_0xcf99('0x4'));var router=express[_0xcf99('0x5')]();var fs_extra=require(_0xcf99('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcf99('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xcf99('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf99('0x9')]);router[_0xcf99('0x8')](_0xcf99('0xa'),auth[_0xcf99('0xb')](),controller['describe']);router[_0xcf99('0x8')](_0xcf99('0xc'),auth[_0xcf99('0xb')](),controller[_0xcf99('0xd')]);router[_0xcf99('0xe')]('/',auth[_0xcf99('0xb')](),controller['create']);router[_0xcf99('0xf')](_0xcf99('0xc'),auth[_0xcf99('0xb')](),controller[_0xcf99('0x10')]);router[_0xcf99('0x11')](_0xcf99('0xc'),auth[_0xcf99('0xb')](),controller[_0xcf99('0x12')]);module[_0xcf99('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 38118d2..4b7b191 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 _0x1d61=['timeout','INTEGER','sequelize','mouseOver'];(function(_0x2d7f04,_0x50e80c){var _0x36d3e8=function(_0x2998a1){while(--_0x2998a1){_0x2d7f04['push'](_0x2d7f04['shift']());}};_0x36d3e8(++_0x50e80c);}(_0x1d61,0x13e));var _0x11d6=function(_0x4f5fab,_0x438a4b){_0x4f5fab=_0x4f5fab-0x0;var _0x3b0ac0=_0x1d61[_0x4f5fab];return _0x3b0ac0;};'use strict';var Sequelize=require(_0x11d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x11d6('0x1'),_0x11d6('0x2')),'defaultValue':_0x11d6('0x1')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x11d6('0x3')]}}; \ No newline at end of file +var _0xdcf5=['sequelize','exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x5ee456,_0x5bf330){var _0x2cfafc=function(_0x3d0af5){while(--_0x3d0af5){_0x5ee456['push'](_0x5ee456['shift']());}};_0x2cfafc(++_0x5bf330);}(_0xdcf5,0xcc));var _0x5dcf=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xdcf5[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x5dcf('0x0'));module[_0x5dcf('0x1')]={'name':{'type':Sequelize[_0x5dcf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5dcf('0x3')](_0x5dcf('0x4'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x5dcf('0x2')]},'timeout':{'type':Sequelize[_0x5dcf('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 08689c0..96397d3 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 _0x45d1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','update','then','destroy','end','error','name','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x45d1,0x1cb));var _0x145d=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x45d1[_0x539fb2];return _0x4d583d;};'use strict';var emlformat=require(_0x145d('0x0'));var rimraf=require(_0x145d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x145d('0x2'));var rp=require(_0x145d('0x3'));var moment=require('moment');var BPromise=require(_0x145d('0x4'));var Mustache=require('mustache');var util=require(_0x145d('0x5'));var path=require(_0x145d('0x6'));var sox=require(_0x145d('0x7'));var csv=require(_0x145d('0x8'));var ejs=require(_0x145d('0x9'));var fs=require('fs');var fs_extra=require(_0x145d('0xa'));var _=require(_0x145d('0xb'));var squel=require(_0x145d('0xc'));var crypto=require(_0x145d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x145d('0xe'));var Papa=require(_0x145d('0xf'));var Redis=require(_0x145d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x145d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x145d('0x12'));var logger=require(_0x145d('0x13'))(_0x145d('0x14'));var utils=require(_0x145d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x145d('0x16'));var db=require(_0x145d('0x17'))['db'];function respondWithStatusCode(_0x53956e,_0x70a6bd){_0x70a6bd=_0x70a6bd||0xcc;return function(_0x1a7e96){if(_0x1a7e96){return _0x53956e[_0x145d('0x18')](_0x70a6bd);}return _0x53956e[_0x145d('0x19')](_0x70a6bd)['end']();};}function respondWithResult(_0x5b8ffa,_0x100e7d){_0x100e7d=_0x100e7d||0xc8;return function(_0x851a19){if(_0x851a19){return _0x5b8ffa[_0x145d('0x19')](_0x100e7d)['json'](_0x851a19);}};}function respondWithFilteredResult(_0x24eaa2,_0x3e041a){return function(_0x5c0621){if(_0x5c0621){var _0x32f6eb=typeof _0x3e041a[_0x145d('0x1a')]==='undefined'&&typeof _0x3e041a[_0x145d('0x1b')]===_0x145d('0x1c');var _0x2f2353=_0x5c0621['count'];var _0x20a5b9=_0x32f6eb?0x0:_0x3e041a[_0x145d('0x1a')];var _0x197b53=_0x32f6eb?_0x5c0621[_0x145d('0x1d')]:_0x3e041a['offset']+_0x3e041a[_0x145d('0x1b')];var _0x295918;if(_0x197b53>=_0x2f2353){_0x197b53=_0x2f2353;_0x295918=0xc8;}else{_0x295918=0xce;}_0x24eaa2[_0x145d('0x19')](_0x295918);return _0x24eaa2['set'](_0x145d('0x1e'),_0x20a5b9+'-'+_0x197b53+'/'+_0x2f2353)[_0x145d('0x1f')](_0x5c0621);}return null;};}function patchUpdates(_0x4a6ef4){return function(_0x2e0d83){try{jsonpatch[_0x145d('0x20')](_0x2e0d83,_0x4a6ef4,!![]);}catch(_0x21b57f){return BPromise['reject'](_0x21b57f);}return _0x2e0d83['save']();};}function saveUpdates(_0x5c857e,_0x2a7d59){return function(_0x11bf8b){if(_0x11bf8b){return _0x11bf8b[_0x145d('0x21')](_0x5c857e)[_0x145d('0x22')](function(_0x50678e){return _0x50678e;});}return null;};}function removeEntity(_0x1a6cd2,_0x1f2eb8){return function(_0x5b6768){if(_0x5b6768){return _0x5b6768[_0x145d('0x23')]()['then'](function(){_0x1a6cd2['status'](0xcc)[_0x145d('0x24')]();});}};}function handleEntityNotFound(_0x583baf,_0x168a8f){return function(_0x227faa){if(!_0x227faa){_0x583baf[_0x145d('0x18')](0x194);}return _0x227faa;};}function handleError(_0x1a2307,_0x3402dc){_0x3402dc=_0x3402dc||0x1f4;return function(_0x2c4c88){logger[_0x145d('0x25')](_0x2c4c88['stack']);if(_0x2c4c88[_0x145d('0x26')]){delete _0x2c4c88['name'];}_0x1a2307[_0x145d('0x19')](_0x3402dc)['send'](_0x2c4c88);};}exports[_0x145d('0x27')]=function(_0x571909,_0x24a84c){var _0x3764c6={'raw':!![],'where':{'id':_0x571909[_0x145d('0x28')]['id']}},_0x1358b3={};_0x1358b3[_0x145d('0x29')]=_[_0x145d('0x2a')](db['ChatProactiveAction']['rawAttributes']);_0x1358b3['query']=_[_0x145d('0x2a')](_0x571909[_0x145d('0x2b')]);_0x1358b3[_0x145d('0x2c')]=_[_0x145d('0x2d')](_0x1358b3[_0x145d('0x29')],_0x1358b3['query']);_0x3764c6['attributes']=_['intersection'](_0x1358b3[_0x145d('0x29')],qs[_0x145d('0x2e')](_0x571909[_0x145d('0x2b')][_0x145d('0x2e')]));_0x3764c6[_0x145d('0x2f')]=_0x3764c6[_0x145d('0x2f')][_0x145d('0x30')]?_0x3764c6[_0x145d('0x2f')]:_0x1358b3[_0x145d('0x29')];if(_0x571909[_0x145d('0x2b')][_0x145d('0x31')]){_0x3764c6[_0x145d('0x32')]=[{'all':!![]}];}_0x3764c6=_[_0x145d('0x33')]({},_0x3764c6,_0x571909[_0x145d('0x34')]);return db['ChatProactiveAction'][_0x145d('0x35')](_0x3764c6)[_0x145d('0x22')](handleEntityNotFound(_0x24a84c,null))[_0x145d('0x22')](respondWithResult(_0x24a84c,null))[_0x145d('0x36')](handleError(_0x24a84c,null));};exports[_0x145d('0x37')]=function(_0x1a3782,_0x80e8b6){return db[_0x145d('0x38')][_0x145d('0x37')](_0x1a3782['body'],{})[_0x145d('0x22')](respondWithResult(_0x80e8b6,0xc9))[_0x145d('0x36')](handleError(_0x80e8b6,null));};exports[_0x145d('0x21')]=function(_0x410e94,_0x432283){if(_0x410e94[_0x145d('0x39')]['id']){delete _0x410e94['body']['id'];}return db['ChatProactiveAction'][_0x145d('0x35')]({'where':{'id':_0x410e94[_0x145d('0x28')]['id']}})[_0x145d('0x22')](handleEntityNotFound(_0x432283,null))[_0x145d('0x22')](saveUpdates(_0x410e94[_0x145d('0x39')],null))[_0x145d('0x22')](respondWithResult(_0x432283,null))['catch'](handleError(_0x432283,null));};exports[_0x145d('0x23')]=function(_0x52e88f,_0xdc819){return db[_0x145d('0x38')][_0x145d('0x35')]({'where':{'id':_0x52e88f[_0x145d('0x28')]['id']}})['then'](handleEntityNotFound(_0xdc819,null))['then'](removeEntity(_0xdc819,null))[_0x145d('0x36')](handleError(_0xdc819,null));}; \ No newline at end of file +var _0xb2ef=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','ChatProactiveAction','create','catch','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x1d7827,_0x42b0db){var _0xb449f1=function(_0x482ebc){while(--_0x482ebc){_0x1d7827['push'](_0x1d7827['shift']());}};_0xb449f1(++_0x42b0db);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x597e5a,_0x529d8c){_0x597e5a=_0x597e5a-0x0;var _0x51e3f6=_0xb2ef[_0x597e5a];return _0x51e3f6;};'use strict';var emlformat=require(_0xfb2e('0x0'));var rimraf=require(_0xfb2e('0x1'));var zipdir=require(_0xfb2e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb2e('0x3'));var moment=require(_0xfb2e('0x4'));var BPromise=require(_0xfb2e('0x5'));var Mustache=require('mustache');var util=require(_0xfb2e('0x6'));var path=require(_0xfb2e('0x7'));var sox=require(_0xfb2e('0x8'));var csv=require(_0xfb2e('0x9'));var ejs=require(_0xfb2e('0xa'));var fs=require('fs');var fs_extra=require(_0xfb2e('0xb'));var _=require(_0xfb2e('0xc'));var squel=require(_0xfb2e('0xd'));var crypto=require(_0xfb2e('0xe'));var jsforce=require(_0xfb2e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfb2e('0x9'));var querystring=require(_0xfb2e('0x10'));var Papa=require(_0xfb2e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb2e('0x12'));var as=require(_0xfb2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb2e('0x14'))(_0xfb2e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb2e('0x16'))['db'];function respondWithStatusCode(_0x5e81ea,_0x1e3a02){_0x1e3a02=_0x1e3a02||0xcc;return function(_0x8d5a90){if(_0x8d5a90){return _0x5e81ea[_0xfb2e('0x17')](_0x1e3a02);}return _0x5e81ea[_0xfb2e('0x18')](_0x1e3a02)[_0xfb2e('0x19')]();};}function respondWithResult(_0xebbee4,_0x5e01f4){_0x5e01f4=_0x5e01f4||0xc8;return function(_0x2116f9){if(_0x2116f9){return _0xebbee4[_0xfb2e('0x18')](_0x5e01f4)[_0xfb2e('0x1a')](_0x2116f9);}};}function respondWithFilteredResult(_0x363e52,_0x166b56){return function(_0x48da9b){if(_0x48da9b){var _0x4b0005=typeof _0x166b56['offset']==='undefined'&&typeof _0x166b56[_0xfb2e('0x1b')]===_0xfb2e('0x1c');var _0x4d7f55=_0x48da9b[_0xfb2e('0x1d')];var _0x1ab009=_0x4b0005?0x0:_0x166b56['offset'];var _0x48a297=_0x4b0005?_0x48da9b[_0xfb2e('0x1d')]:_0x166b56['offset']+_0x166b56[_0xfb2e('0x1b')];var _0x54c4c0;if(_0x48a297>=_0x4d7f55){_0x48a297=_0x4d7f55;_0x54c4c0=0xc8;}else{_0x54c4c0=0xce;}_0x363e52['status'](_0x54c4c0);return _0x363e52[_0xfb2e('0x1e')](_0xfb2e('0x1f'),_0x1ab009+'-'+_0x48a297+'/'+_0x4d7f55)[_0xfb2e('0x1a')](_0x48da9b);}return null;};}function patchUpdates(_0x5e37ee){return function(_0x555572){try{jsonpatch['apply'](_0x555572,_0x5e37ee,!![]);}catch(_0x365aff){return BPromise[_0xfb2e('0x20')](_0x365aff);}return _0x555572[_0xfb2e('0x21')]();};}function saveUpdates(_0x1e2d72,_0x35c1a8){return function(_0xce55ea){if(_0xce55ea){return _0xce55ea[_0xfb2e('0x22')](_0x1e2d72)[_0xfb2e('0x23')](function(_0x4555cf){return _0x4555cf;});}return null;};}function removeEntity(_0x310ff2,_0x2cd233){return function(_0x362fdf){if(_0x362fdf){return _0x362fdf[_0xfb2e('0x24')]()[_0xfb2e('0x23')](function(){_0x310ff2[_0xfb2e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x105c17,_0x49c216){return function(_0x331ee7){if(!_0x331ee7){_0x105c17[_0xfb2e('0x17')](0x194);}return _0x331ee7;};}function handleError(_0x5a7680,_0x4ef0f5){_0x4ef0f5=_0x4ef0f5||0x1f4;return function(_0x5f1950){logger['error'](_0x5f1950[_0xfb2e('0x25')]);if(_0x5f1950[_0xfb2e('0x26')]){delete _0x5f1950[_0xfb2e('0x26')];}_0x5a7680[_0xfb2e('0x18')](_0x4ef0f5)[_0xfb2e('0x27')](_0x5f1950);};}exports[_0xfb2e('0x28')]=function(_0x2ac1f1,_0x14c948){var _0x31e8a1={'raw':!![],'where':{'id':_0x2ac1f1[_0xfb2e('0x29')]['id']}},_0x2eef6d={};_0x2eef6d[_0xfb2e('0x2a')]=_[_0xfb2e('0x2b')](db['ChatProactiveAction'][_0xfb2e('0x2c')]);_0x2eef6d[_0xfb2e('0x2d')]=_[_0xfb2e('0x2b')](_0x2ac1f1[_0xfb2e('0x2d')]);_0x2eef6d[_0xfb2e('0x2e')]=_[_0xfb2e('0x2f')](_0x2eef6d['model'],_0x2eef6d[_0xfb2e('0x2d')]);_0x31e8a1[_0xfb2e('0x30')]=_[_0xfb2e('0x2f')](_0x2eef6d['model'],qs['fields'](_0x2ac1f1[_0xfb2e('0x2d')][_0xfb2e('0x31')]));_0x31e8a1[_0xfb2e('0x30')]=_0x31e8a1[_0xfb2e('0x30')][_0xfb2e('0x32')]?_0x31e8a1['attributes']:_0x2eef6d[_0xfb2e('0x2a')];if(_0x2ac1f1[_0xfb2e('0x2d')][_0xfb2e('0x33')]){_0x31e8a1['include']=[{'all':!![]}];}_0x31e8a1=_['merge']({},_0x31e8a1,_0x2ac1f1[_0xfb2e('0x34')]);return db[_0xfb2e('0x35')]['find'](_0x31e8a1)[_0xfb2e('0x23')](handleEntityNotFound(_0x14c948,null))[_0xfb2e('0x23')](respondWithResult(_0x14c948,null))['catch'](handleError(_0x14c948,null));};exports[_0xfb2e('0x36')]=function(_0x2d69bc,_0x15419f){return db[_0xfb2e('0x35')][_0xfb2e('0x36')](_0x2d69bc['body'],{})[_0xfb2e('0x23')](respondWithResult(_0x15419f,0xc9))[_0xfb2e('0x37')](handleError(_0x15419f,null));};exports['update']=function(_0x4b15a2,_0x58855d){if(_0x4b15a2[_0xfb2e('0x38')]['id']){delete _0x4b15a2[_0xfb2e('0x38')]['id'];}return db[_0xfb2e('0x35')][_0xfb2e('0x39')]({'where':{'id':_0x4b15a2['params']['id']}})[_0xfb2e('0x23')](handleEntityNotFound(_0x58855d,null))[_0xfb2e('0x23')](saveUpdates(_0x4b15a2[_0xfb2e('0x38')],null))[_0xfb2e('0x23')](respondWithResult(_0x58855d,null))[_0xfb2e('0x37')](handleError(_0x58855d,null));};exports[_0xfb2e('0x24')]=function(_0x1653bf,_0x115f33){return db[_0xfb2e('0x35')][_0xfb2e('0x39')]({'where':{'id':_0x1653bf['params']['id']}})[_0xfb2e('0x23')](handleEntityNotFound(_0x115f33,null))['then'](removeEntity(_0x115f33,null))['catch'](handleError(_0x115f33,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d511e84..2ca47ef 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 _0xd5e6=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x3765e6,_0x51e984){var _0x25c181=function(_0x5b9ff6){while(--_0x5b9ff6){_0x3765e6['push'](_0x3765e6['shift']());}};_0x25c181(++_0x51e984);}(_0xd5e6,0x1a3));var _0x6d5e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd5e6[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x6d5e('0x0'));var util=require(_0x6d5e('0x1'));var logger=require(_0x6d5e('0x2'))(_0x6d5e('0x3'));var moment=require('moment');var BPromise=require(_0x6d5e('0x4'));var rp=require(_0x6d5e('0x5'));var fs=require('fs');var path=require(_0x6d5e('0x6'));var rimraf=require(_0x6d5e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6d5e('0x8'));module[_0x6d5e('0x9')]=function(_0x113539,_0x10b044){return _0x113539[_0x6d5e('0xa')](_0x6d5e('0xb'),attributes,{'tableName':_0x6d5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd7=['define','chat_proactive_actions','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x6e652c,_0x192768){var _0x5c6a04=function(_0x1bc311){while(--_0x1bc311){_0x6e652c['push'](_0x6e652c['shift']());}};_0x5c6a04(++_0x192768);}(_0xbdd7,0xa2));var _0x7bdd=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbdd7[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7bdd('0x0'));var util=require('util');var logger=require(_0x7bdd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7bdd('0x2'));var rp=require(_0x7bdd('0x3'));var fs=require('fs');var path=require(_0x7bdd('0x4'));var rimraf=require(_0x7bdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bdd('0x6'));module[_0x7bdd('0x7')]=function(_0x3dd82c,_0x233465){return _0x3dd82c[_0x7bdd('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x7bdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 5b50eb7..e33a3aa 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 _0x6c89=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x6c89,0x12d));var _0x96c8=function(_0xc369b1,_0x2c147a){_0xc369b1=_0xc369b1-0x0;var _0x33fc2e=_0x6c89[_0xc369b1];return _0x33fc2e;};'use strict';var _=require('lodash');var util=require(_0x96c8('0x0'));var moment=require(_0x96c8('0x1'));var BPromise=require(_0x96c8('0x2'));var rs=require(_0x96c8('0x3'));var fs=require('fs');var Redis=require(_0x96c8('0x4'));var db=require(_0x96c8('0x5'))['db'];var utils=require(_0x96c8('0x6'));var logger=require('../../config/logger')(_0x96c8('0x7'));var config=require(_0x96c8('0x8'));var jayson=require(_0x96c8('0x9'));var client=jayson['client'][_0x96c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66dff2,_0x2ac8d0,_0x181ef9){return new BPromise(function(_0x2cbe77,_0x2fbede){return client[_0x96c8('0xb')](_0x66dff2,_0x181ef9)[_0x96c8('0xc')](function(_0x2776ee){logger[_0x96c8('0xd')](_0x96c8('0xe'),_0x2ac8d0,_0x96c8('0xf'));logger[_0x96c8('0x10')](_0x96c8('0x11'),_0x2ac8d0,_0x96c8('0xf'),JSON[_0x96c8('0x12')](_0x2776ee));if(_0x2776ee[_0x96c8('0x13')]){if(_0x2776ee[_0x96c8('0x13')][_0x96c8('0x14')]===0x1f4){logger[_0x96c8('0x13')](_0x96c8('0xe'),_0x2ac8d0,_0x2776ee[_0x96c8('0x13')][_0x96c8('0x15')]);return _0x2fbede(_0x2776ee[_0x96c8('0x13')]['message']);}logger['error'](_0x96c8('0xe'),_0x2ac8d0,_0x2776ee[_0x96c8('0x13')][_0x96c8('0x15')]);return _0x2cbe77(_0x2776ee['error'][_0x96c8('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2ac8d0,_0x96c8('0xf'));_0x2cbe77(_0x2776ee[_0x96c8('0x16')][_0x96c8('0x15')]);}})['catch'](function(_0x5c4343){logger[_0x96c8('0x13')](_0x96c8('0xe'),_0x2ac8d0,_0x5c4343);_0x2fbede(_0x5c4343);});});} \ No newline at end of file +var _0x924b=['http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4ee56d,_0x5cdca8){var _0x1d7b0f=function(_0x4fe301){while(--_0x4fe301){_0x4ee56d['push'](_0x4ee56d['shift']());}};_0x1d7b0f(++_0x5cdca8);}(_0x924b,0xc7));var _0xb924=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x924b[_0x2181fc];return _0x315da1;};'use strict';var _=require(_0xb924('0x0'));var util=require(_0xb924('0x1'));var moment=require(_0xb924('0x2'));var BPromise=require(_0xb924('0x3'));var rs=require(_0xb924('0x4'));var fs=require('fs');var Redis=require(_0xb924('0x5'));var db=require(_0xb924('0x6'))['db'];var utils=require(_0xb924('0x7'));var logger=require('../../config/logger')(_0xb924('0x8'));var config=require(_0xb924('0x9'));var jayson=require(_0xb924('0xa'));var client=jayson['client'][_0xb924('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a17f2,_0x22a4f8,_0x375f9b){return new BPromise(function(_0x39a70b,_0x4cfd37){return client['request'](_0x3a17f2,_0x375f9b)[_0xb924('0xc')](function(_0xf36abc){logger[_0xb924('0xd')](_0xb924('0xe'),_0x22a4f8,_0xb924('0xf'));logger[_0xb924('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x22a4f8,_0xb924('0xf'),JSON[_0xb924('0x11')](_0xf36abc));if(_0xf36abc[_0xb924('0x12')]){if(_0xf36abc[_0xb924('0x12')][_0xb924('0x13')]===0x1f4){logger[_0xb924('0x12')](_0xb924('0xe'),_0x22a4f8,_0xf36abc[_0xb924('0x12')][_0xb924('0x14')]);return _0x4cfd37(_0xf36abc[_0xb924('0x12')][_0xb924('0x14')]);}logger[_0xb924('0x12')](_0xb924('0xe'),_0x22a4f8,_0xf36abc[_0xb924('0x12')][_0xb924('0x14')]);return _0x39a70b(_0xf36abc[_0xb924('0x12')]['message']);}else{logger[_0xb924('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x22a4f8,_0xb924('0xf'));_0x39a70b(_0xf36abc['result'][_0xb924('0x14')]);}})['catch'](function(_0x2ff6dd){logger[_0xb924('0x12')](_0xb924('0xe'),_0x22a4f8,_0x2ff6dd);_0x4cfd37(_0x2ff6dd);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 5573471..94a1610 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 _0xee14=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4d3f0b,_0x44a31a){var _0x39ec4b=function(_0x4ef45c){while(--_0x4ef45c){_0x4d3f0b['push'](_0x4d3f0b['shift']());}};_0x39ec4b(++_0x44a31a);}(_0xee14,0x13a));var _0x4ee1=function(_0x1d5fb0,_0x23d0f2){_0x1d5fb0=_0x1d5fb0-0x0;var _0x53520e=_0xee14[_0x1d5fb0];return _0x53520e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get'](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xa')]);router[_0x4ee1('0xb')]('/',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0xd')]);router[_0x4ee1('0xe')](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/:id',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file +var _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x497f9a,_0xf611b6){var _0x48b7fc=function(_0x1f9f7f){while(--_0x1f9f7f){_0x497f9a['push'](_0x497f9a['shift']());}};_0x48b7fc(++_0xf611b6);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x40130d,_0x26895b){_0x40130d=_0x40130d-0x0;var _0x418b98=_0x3f8a[_0x40130d];return _0x418b98;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ec86b21..3da5755 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 _0x2d43=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5cc3a6,_0x3b9e90){var _0x189cfd=function(_0x59d3cb){while(--_0x59d3cb){_0x5cc3a6['push'](_0x5cc3a6['shift']());}};_0x189cfd(++_0x3b9e90);}(_0x2d43,0x18a));var _0x32d4=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x2d43[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x32d4('0x0'));module[_0x32d4('0x1')]={'name':{'type':Sequelize[_0x32d4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x32d4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32d4('0x4')](_0x32d4('0x5'),_0x32d4('0x6'),_0x32d4('0x7'))}}; \ No newline at end of file +var _0x6d30=['sequelize','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x5bf609,_0x5c1e35){var _0x3c3a74=function(_0x538a50){while(--_0x538a50){_0x5bf609['push'](_0x5bf609['shift']());}};_0x3c3a74(++_0x5c1e35);}(_0x6d30,0xee));var _0x06d3=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x6d30[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require(_0x06d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x06d3('0x1')],'unique':_0x06d3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x06d3('0x1')]},'timeout':{'type':Sequelize[_0x06d3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x06d3('0x4')]('rrmemory',_0x06d3('0x5'),_0x06d3('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 6186aa2..2d729e6 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 _0xa7d5=['tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserChatQueue','ChatQueueId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','Team','User','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field'];(function(_0x285c72,_0x17e370){var _0x5adc55=function(_0x162dec){while(--_0x162dec){_0x285c72['push'](_0x285c72['shift']());}};_0x5adc55(++_0x17e370);}(_0xa7d5,0x1e8));var _0x5a7d=function(_0x167a2b,_0x5b3a55){_0x167a2b=_0x167a2b-0x0;var _0x10a6b8=_0xa7d5[_0x167a2b];return _0x10a6b8;};'use strict';var emlformat=require(_0x5a7d('0x0'));var rimraf=require(_0x5a7d('0x1'));var zipdir=require(_0x5a7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7d('0x3'));var moment=require(_0x5a7d('0x4'));var BPromise=require(_0x5a7d('0x5'));var Mustache=require(_0x5a7d('0x6'));var util=require('util');var path=require(_0x5a7d('0x7'));var sox=require(_0x5a7d('0x8'));var csv=require(_0x5a7d('0x9'));var ejs=require(_0x5a7d('0xa'));var fs=require('fs');var fs_extra=require(_0x5a7d('0xb'));var _=require('lodash');var squel=require(_0x5a7d('0xc'));var crypto=require('crypto');var jsforce=require(_0x5a7d('0xd'));var deskjs=require(_0x5a7d('0xe'));var toCsv=require(_0x5a7d('0x9'));var querystring=require('querystring');var Papa=require(_0x5a7d('0xf'));var Redis=require(_0x5a7d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a7d('0x11'));var as=require(_0x5a7d('0x12'));var hardwareService=require(_0x5a7d('0x13'));var logger=require(_0x5a7d('0x14'))('api');var utils=require(_0x5a7d('0x15'));var config=require(_0x5a7d('0x16'));var licenseUtil=require(_0x5a7d('0x17'));var db=require(_0x5a7d('0x18'))['db'];config['redis']=_['defaults'](config[_0x5a7d('0x19')],{'host':_0x5a7d('0x1a'),'port':0x18eb});var socket=require(_0x5a7d('0x1b'))(new Redis(config[_0x5a7d('0x19')]));require(_0x5a7d('0x1c'))[_0x5a7d('0x1d')](socket);var jayson=require(_0x5a7d('0x1e'));var client=jayson['client'][_0x5a7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x7460ac,_0x23a6a1,_0x58975e,_0xd2b48d){return new BPromise(function(_0x527da5,_0x20dfe4){var _0x38bdcd=_0xd2b48d||client;return _0x38bdcd[_0x5a7d('0x20')](_0x7460ac,_0x58975e)['then'](function(_0x3cf376){logger[_0x5a7d('0x21')](_0x5a7d('0x22'),_0x23a6a1,'request\x20sent');logger[_0x5a7d('0x23')](_0x5a7d('0x24'),_0x23a6a1,_0x5a7d('0x25'),JSON[_0x5a7d('0x26')](_0x3cf376));if(_0x3cf376[_0x5a7d('0x27')]){if(_0x3cf376[_0x5a7d('0x27')][_0x5a7d('0x28')]===0x1f4){logger[_0x5a7d('0x27')](_0x5a7d('0x22'),_0x23a6a1,_0x3cf376[_0x5a7d('0x27')][_0x5a7d('0x29')]);return _0x20dfe4(_0x3cf376[_0x5a7d('0x27')][_0x5a7d('0x29')]);}logger['error'](_0x5a7d('0x22'),_0x23a6a1,_0x3cf376['error']['message']);return _0x527da5(_0x3cf376['error'][_0x5a7d('0x29')]);}else{logger[_0x5a7d('0x21')]('ChatQueue,\x20%s,\x20%s',_0x23a6a1,_0x5a7d('0x25'));_0x527da5(_0x3cf376['result']['message']);}})['catch'](function(_0x1a4eac){logger[_0x5a7d('0x27')](_0x5a7d('0x22'),_0x23a6a1,_0x1a4eac);_0x20dfe4(_0x1a4eac);});});}function respondWithStatusCode(_0x5676c,_0xd0a79f){_0xd0a79f=_0xd0a79f||0xcc;return function(_0x1a25c1){if(_0x1a25c1){return _0x5676c[_0x5a7d('0x2a')](_0xd0a79f);}return _0x5676c[_0x5a7d('0x2b')](_0xd0a79f)['end']();};}function respondWithResult(_0x158649,_0x291c9d){_0x291c9d=_0x291c9d||0xc8;return function(_0x4fe34b){if(_0x4fe34b){return _0x158649[_0x5a7d('0x2b')](_0x291c9d)[_0x5a7d('0x2c')](_0x4fe34b);}};}function respondWithFilteredResult(_0x43e29b,_0x36a88c){return function(_0x2ea8fa){if(_0x2ea8fa){var _0x54773c=typeof _0x36a88c[_0x5a7d('0x2d')]==='undefined'&&typeof _0x36a88c['limit']==='undefined';var _0xfd84bd=_0x2ea8fa[_0x5a7d('0x2e')];var _0xbe116d=_0x54773c?0x0:_0x36a88c['offset'];var _0x29c9af=_0x54773c?_0x2ea8fa[_0x5a7d('0x2e')]:_0x36a88c['offset']+_0x36a88c['limit'];var _0x24017b;if(_0x29c9af>=_0xfd84bd){_0x29c9af=_0xfd84bd;_0x24017b=0xc8;}else{_0x24017b=0xce;}_0x43e29b[_0x5a7d('0x2b')](_0x24017b);return _0x43e29b[_0x5a7d('0x2f')](_0x5a7d('0x30'),_0xbe116d+'-'+_0x29c9af+'/'+_0xfd84bd)[_0x5a7d('0x2c')](_0x2ea8fa);}return null;};}function patchUpdates(_0x229ebe){return function(_0x332d45){try{jsonpatch[_0x5a7d('0x31')](_0x332d45,_0x229ebe,!![]);}catch(_0x48ff0e){return BPromise[_0x5a7d('0x32')](_0x48ff0e);}return _0x332d45[_0x5a7d('0x33')]();};}function saveUpdates(_0x5d459b,_0x1d09ec){return function(_0x4bb4f2){if(_0x4bb4f2){return _0x4bb4f2[_0x5a7d('0x34')](_0x5d459b)[_0x5a7d('0x35')](function(_0x2213ce){return _0x2213ce;});}return null;};}function removeEntity(_0x22e60d,_0x26a4d5){return function(_0x9b554){if(_0x9b554){return _0x9b554[_0x5a7d('0x36')]()['then'](function(){var _0x14cdc3=_0x9b554[_0x5a7d('0x37')]({'plain':!![]});var _0x14d8ec=_0x5a7d('0x38');return db[_0x5a7d('0x39')][_0x5a7d('0x36')]({'where':{'type':_0x14d8ec,'resourceId':_0x14cdc3['id']}})[_0x5a7d('0x35')](function(){return _0x9b554;});})[_0x5a7d('0x35')](function(){_0x22e60d[_0x5a7d('0x2b')](0xcc)[_0x5a7d('0x3a')]();});}};}function handleEntityNotFound(_0xec433,_0x5cfefc){return function(_0x2f527a){if(!_0x2f527a){_0xec433[_0x5a7d('0x2a')](0x194);}return _0x2f527a;};}function handleError(_0x244aca,_0x471191){_0x471191=_0x471191||0x1f4;return function(_0x4676bc){logger[_0x5a7d('0x27')](_0x4676bc[_0x5a7d('0x3b')]);if(_0x4676bc[_0x5a7d('0x3c')]){delete _0x4676bc[_0x5a7d('0x3c')];}_0x244aca[_0x5a7d('0x2b')](_0x471191)[_0x5a7d('0x3d')](_0x4676bc);};}exports[_0x5a7d('0x3e')]=function(_0x52c892,_0x1f4f40){var _0x4ce581={},_0x2143b8={},_0x50adfb={'count':0x0,'rows':[]};var _0x5cc181=_[_0x5a7d('0x3f')](db[_0x5a7d('0x40')][_0x5a7d('0x41')],function(_0x38575d){return{'name':_0x38575d[_0x5a7d('0x42')],'type':_0x38575d[_0x5a7d('0x43')][_0x5a7d('0x44')]};});_0x2143b8[_0x5a7d('0x45')]=_[_0x5a7d('0x3f')](_0x5cc181,_0x5a7d('0x3c'));_0x2143b8[_0x5a7d('0x46')]=_[_0x5a7d('0x47')](_0x52c892['query']);_0x2143b8[_0x5a7d('0x48')]=_[_0x5a7d('0x49')](_0x2143b8[_0x5a7d('0x45')],_0x2143b8['query']);_0x4ce581[_0x5a7d('0x4a')]=_[_0x5a7d('0x49')](_0x2143b8['model'],qs[_0x5a7d('0x4b')](_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x4b')]));_0x4ce581[_0x5a7d('0x4a')]=_0x4ce581[_0x5a7d('0x4a')][_0x5a7d('0x4c')]?_0x4ce581[_0x5a7d('0x4a')]:_0x2143b8['model'];if(!_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x4d')](_0x5a7d('0x4e'))){_0x4ce581[_0x5a7d('0x4f')]=qs[_0x5a7d('0x4f')](_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x4f')]);_0x4ce581[_0x5a7d('0x2d')]=qs[_0x5a7d('0x2d')](_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x2d')]);}_0x4ce581['order']=qs[_0x5a7d('0x50')](_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x50')]);_0x4ce581[_0x5a7d('0x51')]=qs[_0x5a7d('0x48')](_[_0x5a7d('0x52')](_0x52c892['query'],_0x2143b8['filters']),_0x5cc181);if(_0x52c892['query'][_0x5a7d('0x53')]){_0x4ce581[_0x5a7d('0x51')]=_['merge'](_0x4ce581['where'],{'$or':_[_0x5a7d('0x3f')](_0x5cc181,function(_0x3c027e){if(_0x3c027e[_0x5a7d('0x43')]!==_0x5a7d('0x54')){var _0x382213={};_0x382213[_0x3c027e['name']]={'$like':'%'+_0x52c892[_0x5a7d('0x46')][_0x5a7d('0x53')]+'%'};return _0x382213;}})});}_0x4ce581=_[_0x5a7d('0x55')]({},_0x4ce581,_0x52c892[_0x5a7d('0x56')]);var _0x2b029c={'where':_0x4ce581['where']};return db[_0x5a7d('0x40')][_0x5a7d('0x2e')](_0x2b029c)[_0x5a7d('0x35')](function(_0x3ed2d3){_0x50adfb['count']=_0x3ed2d3;if(_0x52c892[_0x5a7d('0x46')]['includeAll']){_0x4ce581['include']=[{'all':!![]}];}return db['ChatQueue'][_0x5a7d('0x57')](_0x4ce581);})[_0x5a7d('0x35')](function(_0xd7c118){_0x50adfb[_0x5a7d('0x58')]=_0xd7c118;return _0x50adfb;})[_0x5a7d('0x35')](respondWithFilteredResult(_0x1f4f40,_0x4ce581))[_0x5a7d('0x59')](handleError(_0x1f4f40,null));};exports[_0x5a7d('0x5a')]=function(_0x2d68ef,_0x5aeb51){var _0x2f5af7={'raw':!![],'where':{'id':_0x2d68ef[_0x5a7d('0x5b')]['id']}},_0x5ccea2={};_0x5ccea2[_0x5a7d('0x45')]=_[_0x5a7d('0x47')](db[_0x5a7d('0x40')][_0x5a7d('0x41')]);_0x5ccea2['query']=_[_0x5a7d('0x47')](_0x2d68ef[_0x5a7d('0x46')]);_0x5ccea2[_0x5a7d('0x48')]=_[_0x5a7d('0x49')](_0x5ccea2[_0x5a7d('0x45')],_0x5ccea2['query']);_0x2f5af7[_0x5a7d('0x4a')]=_[_0x5a7d('0x49')](_0x5ccea2[_0x5a7d('0x45')],qs['fields'](_0x2d68ef[_0x5a7d('0x46')][_0x5a7d('0x4b')]));_0x2f5af7['attributes']=_0x2f5af7[_0x5a7d('0x4a')][_0x5a7d('0x4c')]?_0x2f5af7['attributes']:_0x5ccea2[_0x5a7d('0x45')];if(_0x2d68ef[_0x5a7d('0x46')][_0x5a7d('0x5c')]){_0x2f5af7[_0x5a7d('0x5d')]=[{'all':!![]}];}_0x2f5af7=_[_0x5a7d('0x55')]({},_0x2f5af7,_0x2d68ef[_0x5a7d('0x56')]);return db[_0x5a7d('0x40')][_0x5a7d('0x5e')](_0x2f5af7)[_0x5a7d('0x35')](handleEntityNotFound(_0x5aeb51,null))[_0x5a7d('0x35')](respondWithResult(_0x5aeb51,null))[_0x5a7d('0x59')](handleError(_0x5aeb51,null));};exports['create']=function(_0xba2712,_0x1b410f){return db[_0x5a7d('0x40')]['create'](_0xba2712['body'],{})[_0x5a7d('0x35')](function(_0x28b9da){var _0x360b8f=_0xba2712[_0x5a7d('0x5f')][_0x5a7d('0x37')]({'plain':!![]});if(!_0x360b8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x360b8f['role']===_0x5a7d('0x5f')){var _0x74d134=_0x28b9da[_0x5a7d('0x37')]({'plain':!![]});var _0x3851ea=_0x5a7d('0x38');return db[_0x5a7d('0x60')][_0x5a7d('0x5e')]({'where':{'name':_0x3851ea,'userProfileId':_0x360b8f[_0x5a7d('0x61')]},'raw':!![]})['then'](function(_0x589f8d){if(_0x589f8d&&_0x589f8d[_0x5a7d('0x62')]===0x0){return db[_0x5a7d('0x39')][_0x5a7d('0x63')]({'name':_0x74d134[_0x5a7d('0x3c')],'resourceId':_0x74d134['id'],'type':_0x589f8d[_0x5a7d('0x3c')],'sectionId':_0x589f8d['id']},{})[_0x5a7d('0x35')](function(){return _0x28b9da;});}else{return _0x28b9da;}})['catch'](function(_0x2ec085){logger[_0x5a7d('0x27')](_0x5a7d('0x64'),_0x2ec085);throw _0x2ec085;});}return _0x28b9da;})['then'](respondWithResult(_0x1b410f,0xc9))[_0x5a7d('0x59')](handleError(_0x1b410f,null));};exports['update']=function(_0x1d2469,_0x411f8b){if(_0x1d2469['body']['id']){delete _0x1d2469['body']['id'];}return db[_0x5a7d('0x40')][_0x5a7d('0x5e')]({'where':{'id':_0x1d2469[_0x5a7d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x411f8b,null))[_0x5a7d('0x35')](saveUpdates(_0x1d2469[_0x5a7d('0x65')],null))['then'](respondWithResult(_0x411f8b,null))['catch'](handleError(_0x411f8b,null));};exports[_0x5a7d('0x36')]=function(_0x4134d1,_0x305dfa){return db[_0x5a7d('0x40')][_0x5a7d('0x5e')]({'where':{'id':_0x4134d1[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](handleEntityNotFound(_0x305dfa,null))['then'](removeEntity(_0x305dfa,null))[_0x5a7d('0x59')](handleError(_0x305dfa,null));};exports['describe']=function(_0x2431d2,_0x58ebff){return db[_0x5a7d('0x40')]['describe']()['then'](respondWithResult(_0x58ebff,null))[_0x5a7d('0x59')](handleError(_0x58ebff,null));};exports[_0x5a7d('0x66')]=function(_0x4c6d11,_0x19f719,_0x547acb){var _0x54d63a={'raw':!![],'where':{}},_0x335329={},_0x43e44d;return db[_0x5a7d('0x40')][_0x5a7d('0x67')]({'where':{'id':_0x4c6d11[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](handleEntityNotFound(_0x19f719,null))['then'](function(_0x94dbb8){if(_0x94dbb8){_0x43e44d=_0x94dbb8['get']({'plain':!![]});_0x335329['model']=_[_0x5a7d('0x47')](db[_0x5a7d('0x68')]['rawAttributes']);_0x335329[_0x5a7d('0x46')]=_[_0x5a7d('0x47')](_0x4c6d11[_0x5a7d('0x46')]);_0x335329['filters']=_[_0x5a7d('0x49')](_0x335329[_0x5a7d('0x45')],_0x335329[_0x5a7d('0x46')]);_0x54d63a[_0x5a7d('0x4a')]=_['intersection'](_0x335329['model'],qs[_0x5a7d('0x4b')](_0x4c6d11[_0x5a7d('0x46')][_0x5a7d('0x4b')]));_0x54d63a[_0x5a7d('0x4a')]=_0x54d63a[_0x5a7d('0x4a')][_0x5a7d('0x4c')]?_0x54d63a[_0x5a7d('0x4a')]:_0x335329['model'];if(!_0x4c6d11['query']['hasOwnProperty'](_0x5a7d('0x4e'))){_0x54d63a[_0x5a7d('0x4f')]=qs[_0x5a7d('0x4f')](_0x4c6d11[_0x5a7d('0x46')][_0x5a7d('0x4f')]);_0x54d63a[_0x5a7d('0x2d')]=qs['offset'](_0x4c6d11[_0x5a7d('0x46')][_0x5a7d('0x2d')]);}_0x54d63a['order']=qs[_0x5a7d('0x50')](_0x4c6d11['query']['sort']);_0x54d63a['where']=qs[_0x5a7d('0x48')](_[_0x5a7d('0x52')](_0x4c6d11[_0x5a7d('0x46')],_0x335329[_0x5a7d('0x48')]));_0x54d63a[_0x5a7d('0x51')][_0x5a7d('0x69')]=_0x94dbb8['id'];if(_0x4c6d11['query'][_0x5a7d('0x53')]){_0x54d63a['where']=_[_0x5a7d('0x55')](_0x54d63a[_0x5a7d('0x51')],{'$or':_[_0x5a7d('0x3f')](_0x54d63a['attributes'],function(_0x10f064){var _0xe53533={};_0xe53533[_0x10f064]={'$like':'%'+_0x4c6d11['query'][_0x5a7d('0x53')]+'%'};return _0xe53533;})});}_0x54d63a=_['merge']({},_0x54d63a,_0x4c6d11[_0x5a7d('0x56')]);return db[_0x5a7d('0x68')][_0x5a7d('0x57')](_0x54d63a);}})[_0x5a7d('0x35')](function(_0x401ff0){if(_0x401ff0){return db['User']['findAndCountAll']({'where':{'id':_[_0x5a7d('0x3f')](_0x401ff0,'UserId'),'role':_0x5a7d('0x6a')},'attributes':['id','name',_0x5a7d('0x6b'),_0x5a7d('0x6c'),_0x5a7d('0x6d')]});}})[_0x5a7d('0x35')](function(_0x179e70){if(_0x179e70){return{'count':_0x179e70[_0x5a7d('0x2e')],'rows':_['map'](_0x179e70[_0x5a7d('0x58')],function(_0x17fcef){return{'membername':_0x17fcef['name'],'UserId':_0x17fcef['id'],'queue_name':_0x43e44d[_0x5a7d('0x3c')],'ChatQueueId':_0x43e44d['id'],'interface':util[_0x5a7d('0x6e')](_0x5a7d('0x6f'),_0x5a7d('0x70'),_0x17fcef[_0x5a7d('0x3c')]),'penalty':0x0,'paused':_0x17fcef[_0x5a7d('0x6b')],'createdAt':_0x17fcef[_0x5a7d('0x6d')],'updatedAt':_0x17fcef[_0x5a7d('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5a7d('0x35')](respondWithFilteredResult(_0x19f719,_0x54d63a))[_0x5a7d('0x59')](handleError(_0x19f719,null));};exports[_0x5a7d('0x71')]=function(_0x166931,_0x538bf9,_0x3b1ed6){var _0x30fbeb={};var _0x4fc1d4={};var _0x47749e;var _0x3ad434;return db[_0x5a7d('0x40')][_0x5a7d('0x67')]({'where':{'id':_0x166931[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](handleEntityNotFound(_0x538bf9,null))[_0x5a7d('0x35')](function(_0x34231c){if(_0x34231c){_0x47749e=_0x34231c;_0x4fc1d4[_0x5a7d('0x45')]=_[_0x5a7d('0x47')](db['Team'][_0x5a7d('0x41')]);_0x4fc1d4[_0x5a7d('0x46')]=_['keys'](_0x166931[_0x5a7d('0x46')]);_0x4fc1d4['filters']=_[_0x5a7d('0x49')](_0x4fc1d4['model'],_0x4fc1d4[_0x5a7d('0x46')]);_0x30fbeb['attributes']=_[_0x5a7d('0x49')](_0x4fc1d4['model'],qs[_0x5a7d('0x4b')](_0x166931['query'][_0x5a7d('0x4b')]));_0x30fbeb[_0x5a7d('0x4a')]=_0x30fbeb[_0x5a7d('0x4a')]['length']?_0x30fbeb[_0x5a7d('0x4a')]:_0x4fc1d4[_0x5a7d('0x45')];_0x30fbeb[_0x5a7d('0x72')]=qs[_0x5a7d('0x50')](_0x166931['query']['sort']);_0x30fbeb[_0x5a7d('0x51')]=qs['filters'](_['pick'](_0x166931[_0x5a7d('0x46')],_0x4fc1d4[_0x5a7d('0x48')]));if(_0x166931[_0x5a7d('0x46')][_0x5a7d('0x53')]){_0x30fbeb[_0x5a7d('0x51')]=_[_0x5a7d('0x55')](_0x30fbeb[_0x5a7d('0x51')],{'$or':_['map'](_0x30fbeb[_0x5a7d('0x4a')],function(_0x84f54d){var _0x40c660={};_0x40c660[_0x84f54d]={'$like':'%'+_0x166931[_0x5a7d('0x46')]['filter']+'%'};return _0x40c660;})});}_0x30fbeb=_['merge']({},_0x30fbeb,_0x166931['options']);return _0x47749e[_0x5a7d('0x71')](_0x30fbeb);}})[_0x5a7d('0x35')](function(_0x7f782f){if(_0x7f782f){_0x3ad434=_0x7f782f[_0x5a7d('0x4c')];if(!_0x166931[_0x5a7d('0x46')][_0x5a7d('0x4d')]('nolimit')){_0x30fbeb[_0x5a7d('0x4f')]=qs[_0x5a7d('0x4f')](_0x166931['query']['limit']);_0x30fbeb[_0x5a7d('0x2d')]=qs[_0x5a7d('0x2d')](_0x166931[_0x5a7d('0x46')][_0x5a7d('0x2d')]);}return _0x47749e[_0x5a7d('0x71')](_0x30fbeb);}})[_0x5a7d('0x35')](function(_0x4f455f){if(_0x4f455f){return _0x4f455f?{'count':_0x3ad434,'rows':_0x4f455f}:null;}})['then'](respondWithResult(_0x538bf9,null))['catch'](handleError(_0x538bf9,null));};exports['addTeams']=function(_0x45f95a,_0x64685f,_0x2cd1bc){var _0x6c4ba6=_0x45f95a[_0x5a7d('0x65')]['ids'];return db[_0x5a7d('0x73')][_0x5a7d('0x57')]({'where':{'id':_0x6c4ba6},'attributes':['id'],'include':[{'model':db[_0x5a7d('0x74')],'as':_0x5a7d('0x75'),'attributes':['id',_0x5a7d('0x3c'),'online',_0x5a7d('0x76'),_0x5a7d('0x77')],'raw':!![]}]})['then'](function(_0x1c56e2){if(_0x1c56e2){var _0x39e660=_[_0x5a7d('0x78')](_0x1c56e2,function(_0x2a1574){var _0x5313b6=_0x2a1574[_0x5a7d('0x37')]({'plain':!![]});return _0x5313b6[_0x5a7d('0x75')];});return db['ChatQueue']['find']({'where':{'id':_0x45f95a['params']['id']}})['then'](function(_0x205b82){return db[_0x5a7d('0x79')][_0x5a7d('0x7a')](function(_0x1dfbaf){return _0x205b82[_0x5a7d('0x7b')](_0x6c4ba6,{'transaction':_0x1dfbaf})[_0x5a7d('0x35')](function(){return BPromise[_0x5a7d('0x7c')](_0x39e660,function(_0x3d2704){return db[_0x5a7d('0x68')][_0x5a7d('0x7d')]({'where':{'UserId':_0x3d2704['id'],'ChatQueueId':_0x45f95a[_0x5a7d('0x5b')]['id']},'transaction':_0x1dfbaf});});})[_0x5a7d('0x35')](function(){_0x39e660[_0x5a7d('0x7e')](function(_0x3e130f){socket[_0x5a7d('0x7f')](_0x5a7d('0x80'),{'UserId':_0x3e130f['id'],'ChatQueueId':_0x205b82['id']});});});});});}})[_0x5a7d('0x35')](respondWithStatusCode(_0x64685f,null))[_0x5a7d('0x59')](handleError(_0x64685f,null));};exports['removeTeams']=function(_0xc633d1,_0x1ba058,_0x388a2c){return db['Team'][_0x5a7d('0x57')]({'where':{'id':_0xc633d1[_0x5a7d('0x46')][_0x5a7d('0x81')]},'attributes':['id'],'include':[{'model':db[_0x5a7d('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5a7d('0x35')](handleEntityNotFound(_0x1ba058,null))[_0x5a7d('0x35')](function(_0x1f343a){var _0x4075c4=_[_0x5a7d('0x3f')](_0x1f343a,'id');var _0x3d43a5=[];var _0x3911fd=[];var _0x361493=squel[_0x5a7d('0x82')]();_0x361493[_0x5a7d('0x83')](_0x5a7d('0x84'))['from'](_0x5a7d('0x85'),'tq')['join'](_0x5a7d('0x86'),'ut',_0x5a7d('0x87'))['where'](_0x5a7d('0x88'),_0xc633d1[_0x5a7d('0x5b')]['id']);for(var _0x233fc4=0x0;_0x233fc4<_0x1f343a[_0x5a7d('0x4c')];_0x233fc4+=0x1){let _0xf79767=_0x1f343a[_0x233fc4];for(var _0x5e4eb6=0x0;_0x5e4eb6<_0xf79767['Agents'][_0x5a7d('0x4c')];_0x5e4eb6+=0x1){let _0x1cae9c=_0xf79767[_0x5a7d('0x75')][_0x5e4eb6];var _0x49f09f=_0x361493[_0x5a7d('0x89')]();_0x49f09f[_0x5a7d('0x51')](_0x5a7d('0x8a'),_0x1cae9c['id']);_0x3911fd['push'](db[_0x5a7d('0x79')][_0x5a7d('0x46')](_0x49f09f[_0x5a7d('0x8b')](),{'type':db[_0x5a7d('0x79')][_0x5a7d('0x8c')]['SELECT']})['then'](function(_0x2caca2){if(_0x2caca2[_0x5a7d('0x4c')]===0x1){return _0x1cae9c['id'];}else{var _0x12eccc=_[_0x5a7d('0x8d')](_[_0x5a7d('0x3f')](_0x2caca2,_0x5a7d('0x8e')),function(_0x1da3bb){return _[_0x5a7d('0x8f')](_0x4075c4,_0x1da3bb);});if(_0x12eccc){return _0x1cae9c['id'];}}}));}}return BPromise[_0x5a7d('0x90')](_0x3911fd)[_0x5a7d('0x35')](function(_0x478799){_0x3d43a5=_(_0x3d43a5)[_0x5a7d('0x91')](_0x478799)['compact']()[_0x5a7d('0x92')]();return db[_0x5a7d('0x40')]['find']({'where':{'id':_0xc633d1[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](function(_0x1d9755){return db['sequelize']['transaction'](function(_0x2d853e){return _0x1d9755[_0x5a7d('0x93')](_0xc633d1[_0x5a7d('0x46')][_0x5a7d('0x81')],{'transaction':_0x2d853e})['then'](function(){if(!_[_0x5a7d('0x94')](_0x3d43a5)){return _0x1d9755[_0x5a7d('0x95')](_0x3d43a5,{'transaction':_0x2d853e});}})[_0x5a7d('0x35')](function(){_0x3d43a5[_0x5a7d('0x7e')](function(_0x776e1f){socket[_0x5a7d('0x7f')]('userChatQueue:remove',{'UserId':_0x776e1f,'ChatQueueId':_0x1d9755['id']});});});});});});})[_0x5a7d('0x35')](respondWithStatusCode(_0x1ba058,null))[_0x5a7d('0x59')](handleError(_0x1ba058,null));};exports[_0x5a7d('0x96')]=function(_0x5b52e2,_0x4e3152,_0x266051){return db[_0x5a7d('0x40')][_0x5a7d('0x5e')]({'where':{'id':_0x5b52e2[_0x5a7d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e3152,null))[_0x5a7d('0x35')](function(_0x4a7c57){if(_0x4a7c57){return _0x4a7c57[_0x5a7d('0x96')](_0x5b52e2['body'][_0x5a7d('0x81')],_[_0x5a7d('0x97')](_0x5b52e2[_0x5a7d('0x65')],[_0x5a7d('0x81'),'id'])||{})['spread'](function(_0x320ed7){for(var _0x288ed=0x0;_0x288ed<_0x5b52e2['body']['ids'][_0x5a7d('0x4c')];_0x288ed+=0x1){socket[_0x5a7d('0x7f')]('userChatQueue:save',{'UserId':Number(_0x5b52e2['body'][_0x5a7d('0x81')][_0x288ed]),'ChatQueueId':Number(_0x5b52e2[_0x5a7d('0x5b')]['id'])});}return _0x320ed7;});}})[_0x5a7d('0x35')](respondWithResult(_0x4e3152,null))[_0x5a7d('0x59')](handleError(_0x4e3152,null));};exports[_0x5a7d('0x95')]=function(_0x1ccd42,_0x331757,_0x14e90a){return db['ChatQueue'][_0x5a7d('0x5e')]({'where':{'id':_0x1ccd42[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](handleEntityNotFound(_0x331757,null))[_0x5a7d('0x35')](function(_0xc57c35){if(_0xc57c35){return _0xc57c35[_0x5a7d('0x95')](_0x1ccd42[_0x5a7d('0x46')]['ids'])[_0x5a7d('0x35')](function(){if(_[_0x5a7d('0x98')](_0x1ccd42[_0x5a7d('0x46')][_0x5a7d('0x81')])){for(var _0x4b25eb=0x0;_0x4b25eb<_0x1ccd42[_0x5a7d('0x46')][_0x5a7d('0x81')]['length'];_0x4b25eb+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x1ccd42['query'][_0x5a7d('0x81')][_0x4b25eb]),'ChatQueueId':Number(_0x1ccd42['params']['id'])});}}else{socket[_0x5a7d('0x7f')](_0x5a7d('0x99'),{'UserId':Number(_0x1ccd42[_0x5a7d('0x46')]['ids']),'ChatQueueId':Number(_0x1ccd42[_0x5a7d('0x5b')]['id'])});}});}})[_0x5a7d('0x35')](respondWithStatusCode(_0x331757,null))[_0x5a7d('0x59')](handleError(_0x331757,null));};exports[_0x5a7d('0x9a')]=function(_0x153988,_0x48cae6,_0x396c3e){var _0x5160e1={};var _0x42df2={};var _0x6ce241;var _0x138481;return db[_0x5a7d('0x40')][_0x5a7d('0x67')]({'where':{'id':_0x153988[_0x5a7d('0x5b')]['id']}})[_0x5a7d('0x35')](handleEntityNotFound(_0x48cae6,null))['then'](function(_0x38979a){if(_0x38979a){_0x6ce241=_0x38979a;_0x42df2[_0x5a7d('0x45')]=_[_0x5a7d('0x47')](db[_0x5a7d('0x74')]['rawAttributes']);_0x42df2[_0x5a7d('0x46')]=_[_0x5a7d('0x47')](_0x153988[_0x5a7d('0x46')]);_0x42df2[_0x5a7d('0x48')]=_[_0x5a7d('0x49')](_0x42df2[_0x5a7d('0x45')],_0x42df2['query']);_0x5160e1[_0x5a7d('0x4a')]=_['intersection'](_0x42df2[_0x5a7d('0x45')],qs['fields'](_0x153988[_0x5a7d('0x46')][_0x5a7d('0x4b')]));_0x5160e1[_0x5a7d('0x4a')]=_0x5160e1[_0x5a7d('0x4a')][_0x5a7d('0x4c')]?_0x5160e1[_0x5a7d('0x4a')]:_0x42df2[_0x5a7d('0x45')];_0x5160e1[_0x5a7d('0x72')]=qs[_0x5a7d('0x50')](_0x153988[_0x5a7d('0x46')][_0x5a7d('0x50')]);_0x5160e1['where']=qs[_0x5a7d('0x48')](_[_0x5a7d('0x52')](_0x153988[_0x5a7d('0x46')],_0x42df2[_0x5a7d('0x48')]));if(_0x153988[_0x5a7d('0x46')][_0x5a7d('0x53')]){_0x5160e1[_0x5a7d('0x51')]=_[_0x5a7d('0x55')](_0x5160e1['where'],{'$or':_[_0x5a7d('0x3f')](_0x5160e1['attributes'],function(_0x415c9f){var _0x1f12da={};_0x1f12da[_0x415c9f]={'$like':'%'+_0x153988[_0x5a7d('0x46')]['filter']+'%'};return _0x1f12da;})});}_0x5160e1=_[_0x5a7d('0x55')]({},_0x5160e1,_0x153988[_0x5a7d('0x56')]);return _0x6ce241[_0x5a7d('0x9a')](_0x5160e1);}})[_0x5a7d('0x35')](function(_0x2f7e61){if(_0x2f7e61){_0x138481=_0x2f7e61['length'];if(!_0x153988[_0x5a7d('0x46')][_0x5a7d('0x4d')](_0x5a7d('0x4e'))){_0x5160e1[_0x5a7d('0x4f')]=qs[_0x5a7d('0x4f')](_0x153988[_0x5a7d('0x46')][_0x5a7d('0x4f')]);_0x5160e1[_0x5a7d('0x2d')]=qs[_0x5a7d('0x2d')](_0x153988[_0x5a7d('0x46')][_0x5a7d('0x2d')]);}return _0x6ce241['getAgents'](_0x5160e1);}})[_0x5a7d('0x35')](function(_0x31e663){if(_0x31e663){return _0x31e663?{'count':_0x138481,'rows':_0x31e663}:null;}})[_0x5a7d('0x35')](respondWithResult(_0x48cae6,null))[_0x5a7d('0x59')](handleError(_0x48cae6,null));}; \ No newline at end of file +var _0x66f6=['lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','includeAll','findAll','rows','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserChatQueue','ChatQueueId','User','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','findOne','Team','filter','options','hasOwnProperty','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','fs-extra'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x66f6,0x11b));var _0x666f=function(_0x15e288,_0x4ca5a3){_0x15e288=_0x15e288-0x0;var _0x59dd3d=_0x66f6[_0x15e288];return _0x59dd3d;};'use strict';var emlformat=require(_0x666f('0x0'));var rimraf=require(_0x666f('0x1'));var zipdir=require(_0x666f('0x2'));var jsonpatch=require(_0x666f('0x3'));var rp=require(_0x666f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x666f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x666f('0x6'));var _=require(_0x666f('0x7'));var squel=require('squel');var crypto=require(_0x666f('0x8'));var jsforce=require(_0x666f('0x9'));var deskjs=require(_0x666f('0xa'));var toCsv=require(_0x666f('0xb'));var querystring=require('querystring');var Papa=require(_0x666f('0xc'));var Redis=require(_0x666f('0xd'));var authService=require(_0x666f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x666f('0xf'));var logger=require('../../config/logger')(_0x666f('0x10'));var utils=require('../../config/utils');var config=require(_0x666f('0x11'));var licenseUtil=require(_0x666f('0x12'));var db=require(_0x666f('0x13'))['db'];config[_0x666f('0x14')]=_[_0x666f('0x15')](config[_0x666f('0x14')],{'host':_0x666f('0x16'),'port':0x18eb});var socket=require(_0x666f('0x17'))(new Redis(config['redis']));require(_0x666f('0x18'))[_0x666f('0x19')](socket);var jayson=require(_0x666f('0x1a'));var client=jayson['client'][_0x666f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x21cdc5,_0x4775f1,_0x412838,_0x421c68){return new BPromise(function(_0x5021ca,_0x3ffd63){var _0x28220f=_0x421c68||client;return _0x28220f['request'](_0x21cdc5,_0x412838)[_0x666f('0x1c')](function(_0x4128d2){logger[_0x666f('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x4775f1,_0x666f('0x1e'));logger['debug'](_0x666f('0x1f'),_0x4775f1,'request\x20sent',JSON['stringify'](_0x4128d2));if(_0x4128d2[_0x666f('0x20')]){if(_0x4128d2[_0x666f('0x20')][_0x666f('0x21')]===0x1f4){logger[_0x666f('0x20')](_0x666f('0x22'),_0x4775f1,_0x4128d2[_0x666f('0x20')][_0x666f('0x23')]);return _0x3ffd63(_0x4128d2['error'][_0x666f('0x23')]);}logger['error'](_0x666f('0x22'),_0x4775f1,_0x4128d2[_0x666f('0x20')][_0x666f('0x23')]);return _0x5021ca(_0x4128d2[_0x666f('0x20')][_0x666f('0x23')]);}else{logger[_0x666f('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x4775f1,_0x666f('0x1e'));_0x5021ca(_0x4128d2[_0x666f('0x24')]['message']);}})[_0x666f('0x25')](function(_0x1153b0){logger['error'](_0x666f('0x22'),_0x4775f1,_0x1153b0);_0x3ffd63(_0x1153b0);});});}function respondWithStatusCode(_0x479eea,_0x54c27e){_0x54c27e=_0x54c27e||0xcc;return function(_0x54c827){if(_0x54c827){return _0x479eea['sendStatus'](_0x54c27e);}return _0x479eea[_0x666f('0x26')](_0x54c27e)[_0x666f('0x27')]();};}function respondWithResult(_0x1da2e3,_0x4dfa7a){_0x4dfa7a=_0x4dfa7a||0xc8;return function(_0x10c1c4){if(_0x10c1c4){return _0x1da2e3[_0x666f('0x26')](_0x4dfa7a)[_0x666f('0x28')](_0x10c1c4);}};}function respondWithFilteredResult(_0x5b618c,_0x51688c){return function(_0x15532d){if(_0x15532d){var _0x479d93=typeof _0x51688c[_0x666f('0x29')]===_0x666f('0x2a')&&typeof _0x51688c['limit']===_0x666f('0x2a');var _0x148006=_0x15532d[_0x666f('0x2b')];var _0x4bafa4=_0x479d93?0x0:_0x51688c['offset'];var _0x315543=_0x479d93?_0x15532d[_0x666f('0x2b')]:_0x51688c[_0x666f('0x29')]+_0x51688c['limit'];var _0x124cb7;if(_0x315543>=_0x148006){_0x315543=_0x148006;_0x124cb7=0xc8;}else{_0x124cb7=0xce;}_0x5b618c[_0x666f('0x26')](_0x124cb7);return _0x5b618c[_0x666f('0x2c')](_0x666f('0x2d'),_0x4bafa4+'-'+_0x315543+'/'+_0x148006)[_0x666f('0x28')](_0x15532d);}return null;};}function patchUpdates(_0x19f20c){return function(_0x37c289){try{jsonpatch[_0x666f('0x2e')](_0x37c289,_0x19f20c,!![]);}catch(_0x2c8ac3){return BPromise['reject'](_0x2c8ac3);}return _0x37c289[_0x666f('0x2f')]();};}function saveUpdates(_0x322ec5,_0x4b5d3e){return function(_0x3593a1){if(_0x3593a1){return _0x3593a1[_0x666f('0x30')](_0x322ec5)[_0x666f('0x1c')](function(_0x361de1){return _0x361de1;});}return null;};}function removeEntity(_0xd47d05,_0x455794){return function(_0x5ace63){if(_0x5ace63){return _0x5ace63[_0x666f('0x31')]()[_0x666f('0x1c')](function(){var _0x25b01b=_0x5ace63[_0x666f('0x32')]({'plain':!![]});var _0x1dac3c='ChatQueues';return db[_0x666f('0x33')]['destroy']({'where':{'type':_0x1dac3c,'resourceId':_0x25b01b['id']}})['then'](function(){return _0x5ace63;});})[_0x666f('0x1c')](function(){_0xd47d05[_0x666f('0x26')](0xcc)[_0x666f('0x27')]();});}};}function handleEntityNotFound(_0x2db44d,_0x4e517a){return function(_0x2c193f){if(!_0x2c193f){_0x2db44d[_0x666f('0x34')](0x194);}return _0x2c193f;};}function handleError(_0x312f9f,_0x35db54){_0x35db54=_0x35db54||0x1f4;return function(_0x15eca8){logger[_0x666f('0x20')](_0x15eca8[_0x666f('0x35')]);if(_0x15eca8[_0x666f('0x36')]){delete _0x15eca8[_0x666f('0x36')];}_0x312f9f[_0x666f('0x26')](_0x35db54)['send'](_0x15eca8);};}exports['index']=function(_0x4e1f05,_0x232aef){var _0x42bc3e={},_0x352d49={},_0x2d2acb={'count':0x0,'rows':[]};var _0x2f5ee0=_[_0x666f('0x37')](db[_0x666f('0x38')][_0x666f('0x39')],function(_0x3145a9){return{'name':_0x3145a9[_0x666f('0x3a')],'type':_0x3145a9[_0x666f('0x3b')][_0x666f('0x3c')]};});_0x352d49[_0x666f('0x3d')]=_[_0x666f('0x37')](_0x2f5ee0,_0x666f('0x36'));_0x352d49[_0x666f('0x3e')]=_[_0x666f('0x3f')](_0x4e1f05['query']);_0x352d49[_0x666f('0x40')]=_[_0x666f('0x41')](_0x352d49['model'],_0x352d49[_0x666f('0x3e')]);_0x42bc3e[_0x666f('0x42')]=_[_0x666f('0x41')](_0x352d49[_0x666f('0x3d')],qs[_0x666f('0x43')](_0x4e1f05[_0x666f('0x3e')][_0x666f('0x43')]));_0x42bc3e[_0x666f('0x42')]=_0x42bc3e[_0x666f('0x42')][_0x666f('0x44')]?_0x42bc3e[_0x666f('0x42')]:_0x352d49['model'];if(!_0x4e1f05[_0x666f('0x3e')]['hasOwnProperty'](_0x666f('0x45'))){_0x42bc3e[_0x666f('0x46')]=qs['limit'](_0x4e1f05['query'][_0x666f('0x46')]);_0x42bc3e[_0x666f('0x29')]=qs[_0x666f('0x29')](_0x4e1f05[_0x666f('0x3e')][_0x666f('0x29')]);}_0x42bc3e[_0x666f('0x47')]=qs[_0x666f('0x48')](_0x4e1f05['query'][_0x666f('0x48')]);_0x42bc3e[_0x666f('0x49')]=qs[_0x666f('0x40')](_[_0x666f('0x4a')](_0x4e1f05[_0x666f('0x3e')],_0x352d49[_0x666f('0x40')]),_0x2f5ee0);if(_0x4e1f05[_0x666f('0x3e')]['filter']){_0x42bc3e[_0x666f('0x49')]=_[_0x666f('0x4b')](_0x42bc3e[_0x666f('0x49')],{'$or':_[_0x666f('0x37')](_0x2f5ee0,function(_0x4a8d62){if(_0x4a8d62[_0x666f('0x3b')]!=='VIRTUAL'){var _0x47ee9c={};_0x47ee9c[_0x4a8d62['name']]={'$like':'%'+_0x4e1f05[_0x666f('0x3e')]['filter']+'%'};return _0x47ee9c;}})});}_0x42bc3e=_['merge']({},_0x42bc3e,_0x4e1f05['options']);var _0x49adf5={'where':_0x42bc3e['where']};return db['ChatQueue'][_0x666f('0x2b')](_0x49adf5)[_0x666f('0x1c')](function(_0x5efb39){_0x2d2acb[_0x666f('0x2b')]=_0x5efb39;if(_0x4e1f05[_0x666f('0x3e')][_0x666f('0x4c')]){_0x42bc3e['include']=[{'all':!![]}];}return db['ChatQueue'][_0x666f('0x4d')](_0x42bc3e);})[_0x666f('0x1c')](function(_0x312986){_0x2d2acb[_0x666f('0x4e')]=_0x312986;return _0x2d2acb;})[_0x666f('0x1c')](respondWithFilteredResult(_0x232aef,_0x42bc3e))[_0x666f('0x25')](handleError(_0x232aef,null));};exports[_0x666f('0x4f')]=function(_0x5564e8,_0x4b14e8){var _0x58151f={'raw':!![],'where':{'id':_0x5564e8[_0x666f('0x50')]['id']}},_0x597a21={};_0x597a21[_0x666f('0x3d')]=_[_0x666f('0x3f')](db[_0x666f('0x38')][_0x666f('0x39')]);_0x597a21[_0x666f('0x3e')]=_[_0x666f('0x3f')](_0x5564e8[_0x666f('0x3e')]);_0x597a21[_0x666f('0x40')]=_[_0x666f('0x41')](_0x597a21[_0x666f('0x3d')],_0x597a21[_0x666f('0x3e')]);_0x58151f[_0x666f('0x42')]=_[_0x666f('0x41')](_0x597a21[_0x666f('0x3d')],qs[_0x666f('0x43')](_0x5564e8[_0x666f('0x3e')]['fields']));_0x58151f[_0x666f('0x42')]=_0x58151f[_0x666f('0x42')][_0x666f('0x44')]?_0x58151f[_0x666f('0x42')]:_0x597a21[_0x666f('0x3d')];if(_0x5564e8[_0x666f('0x3e')][_0x666f('0x4c')]){_0x58151f[_0x666f('0x51')]=[{'all':!![]}];}_0x58151f=_['merge']({},_0x58151f,_0x5564e8['options']);return db[_0x666f('0x38')][_0x666f('0x52')](_0x58151f)[_0x666f('0x1c')](handleEntityNotFound(_0x4b14e8,null))['then'](respondWithResult(_0x4b14e8,null))[_0x666f('0x25')](handleError(_0x4b14e8,null));};exports[_0x666f('0x53')]=function(_0x32b87f,_0x1b3ee6){return db['ChatQueue']['create'](_0x32b87f[_0x666f('0x54')],{})[_0x666f('0x1c')](function(_0x28b6ac){var _0x15a28f=_0x32b87f['user'][_0x666f('0x32')]({'plain':!![]});if(!_0x15a28f)throw new Error(_0x666f('0x55'));if(_0x15a28f[_0x666f('0x56')]===_0x666f('0x57')){var _0x1ddc0c=_0x28b6ac[_0x666f('0x32')]({'plain':!![]});var _0x205d21=_0x666f('0x58');return db[_0x666f('0x59')][_0x666f('0x52')]({'where':{'name':_0x205d21,'userProfileId':_0x15a28f[_0x666f('0x5a')]},'raw':!![]})['then'](function(_0x569216){if(_0x569216&&_0x569216[_0x666f('0x5b')]===0x0){return db[_0x666f('0x33')][_0x666f('0x53')]({'name':_0x1ddc0c[_0x666f('0x36')],'resourceId':_0x1ddc0c['id'],'type':_0x569216[_0x666f('0x36')],'sectionId':_0x569216['id']},{})['then'](function(){return _0x28b6ac;});}else{return _0x28b6ac;}})['catch'](function(_0x1e9ee4){logger[_0x666f('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e9ee4);throw _0x1e9ee4;});}return _0x28b6ac;})[_0x666f('0x1c')](respondWithResult(_0x1b3ee6,0xc9))[_0x666f('0x25')](handleError(_0x1b3ee6,null));};exports[_0x666f('0x30')]=function(_0x23eb23,_0xfb56ba){if(_0x23eb23[_0x666f('0x54')]['id']){delete _0x23eb23[_0x666f('0x54')]['id'];}return db[_0x666f('0x38')]['find']({'where':{'id':_0x23eb23[_0x666f('0x50')]['id']}})['then'](handleEntityNotFound(_0xfb56ba,null))[_0x666f('0x1c')](saveUpdates(_0x23eb23[_0x666f('0x54')],null))[_0x666f('0x1c')](respondWithResult(_0xfb56ba,null))[_0x666f('0x25')](handleError(_0xfb56ba,null));};exports[_0x666f('0x31')]=function(_0x186b21,_0x3703ae){return db[_0x666f('0x38')][_0x666f('0x52')]({'where':{'id':_0x186b21['params']['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x3703ae,null))[_0x666f('0x1c')](removeEntity(_0x3703ae,null))['catch'](handleError(_0x3703ae,null));};exports[_0x666f('0x5c')]=function(_0x46bb55,_0xb82342){return db['ChatQueue'][_0x666f('0x5c')]()[_0x666f('0x1c')](respondWithResult(_0xb82342,null))[_0x666f('0x25')](handleError(_0xb82342,null));};exports[_0x666f('0x5d')]=function(_0x4f9930,_0x3a9d1e,_0x2ab237){var _0x3b8291={'raw':!![],'where':{}},_0x4d710d={},_0x4c99d1;return db['ChatQueue']['findOne']({'where':{'id':_0x4f9930['params']['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x3a9d1e,null))[_0x666f('0x1c')](function(_0x4cf98){if(_0x4cf98){_0x4c99d1=_0x4cf98[_0x666f('0x32')]({'plain':!![]});_0x4d710d['model']=_['keys'](db[_0x666f('0x5e')]['rawAttributes']);_0x4d710d[_0x666f('0x3e')]=_[_0x666f('0x3f')](_0x4f9930[_0x666f('0x3e')]);_0x4d710d[_0x666f('0x40')]=_[_0x666f('0x41')](_0x4d710d[_0x666f('0x3d')],_0x4d710d[_0x666f('0x3e')]);_0x3b8291['attributes']=_[_0x666f('0x41')](_0x4d710d[_0x666f('0x3d')],qs[_0x666f('0x43')](_0x4f9930[_0x666f('0x3e')]['fields']));_0x3b8291[_0x666f('0x42')]=_0x3b8291[_0x666f('0x42')][_0x666f('0x44')]?_0x3b8291[_0x666f('0x42')]:_0x4d710d[_0x666f('0x3d')];if(!_0x4f9930[_0x666f('0x3e')]['hasOwnProperty'](_0x666f('0x45'))){_0x3b8291[_0x666f('0x46')]=qs['limit'](_0x4f9930[_0x666f('0x3e')][_0x666f('0x46')]);_0x3b8291[_0x666f('0x29')]=qs[_0x666f('0x29')](_0x4f9930[_0x666f('0x3e')]['offset']);}_0x3b8291['order']=qs['sort'](_0x4f9930[_0x666f('0x3e')][_0x666f('0x48')]);_0x3b8291[_0x666f('0x49')]=qs[_0x666f('0x40')](_[_0x666f('0x4a')](_0x4f9930['query'],_0x4d710d['filters']));_0x3b8291[_0x666f('0x49')][_0x666f('0x5f')]=_0x4cf98['id'];if(_0x4f9930[_0x666f('0x3e')]['filter']){_0x3b8291[_0x666f('0x49')]=_[_0x666f('0x4b')](_0x3b8291[_0x666f('0x49')],{'$or':_[_0x666f('0x37')](_0x3b8291[_0x666f('0x42')],function(_0x294f82){var _0x31a1bb={};_0x31a1bb[_0x294f82]={'$like':'%'+_0x4f9930['query']['filter']+'%'};return _0x31a1bb;})});}_0x3b8291=_[_0x666f('0x4b')]({},_0x3b8291,_0x4f9930['options']);return db[_0x666f('0x5e')][_0x666f('0x4d')](_0x3b8291);}})[_0x666f('0x1c')](function(_0x8c2582){if(_0x8c2582){return db[_0x666f('0x60')]['findAndCountAll']({'where':{'id':_[_0x666f('0x37')](_0x8c2582,'UserId'),'role':'agent'},'attributes':['id',_0x666f('0x36'),'chatPause',_0x666f('0x61'),_0x666f('0x62')]});}})[_0x666f('0x1c')](function(_0x4ba1de){if(_0x4ba1de){return{'count':_0x4ba1de[_0x666f('0x2b')],'rows':_[_0x666f('0x37')](_0x4ba1de['rows'],function(_0x35afc6){return{'membername':_0x35afc6['name'],'UserId':_0x35afc6['id'],'queue_name':_0x4c99d1['name'],'ChatQueueId':_0x4c99d1['id'],'interface':util[_0x666f('0x63')](_0x666f('0x64'),'SIP',_0x35afc6[_0x666f('0x36')]),'penalty':0x0,'paused':_0x35afc6[_0x666f('0x65')],'createdAt':_0x35afc6[_0x666f('0x62')],'updatedAt':_0x35afc6[_0x666f('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x666f('0x1c')](respondWithFilteredResult(_0x3a9d1e,_0x3b8291))['catch'](handleError(_0x3a9d1e,null));};exports[_0x666f('0x66')]=function(_0x592031,_0x49ef85,_0x2582c4){var _0x4e7419={};var _0x5a1041={};var _0x5e0508;var _0x396d20;return db[_0x666f('0x38')][_0x666f('0x67')]({'where':{'id':_0x592031[_0x666f('0x50')]['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x49ef85,null))[_0x666f('0x1c')](function(_0x2744bc){if(_0x2744bc){_0x5e0508=_0x2744bc;_0x5a1041['model']=_[_0x666f('0x3f')](db[_0x666f('0x68')][_0x666f('0x39')]);_0x5a1041[_0x666f('0x3e')]=_[_0x666f('0x3f')](_0x592031['query']);_0x5a1041[_0x666f('0x40')]=_[_0x666f('0x41')](_0x5a1041[_0x666f('0x3d')],_0x5a1041['query']);_0x4e7419['attributes']=_[_0x666f('0x41')](_0x5a1041[_0x666f('0x3d')],qs[_0x666f('0x43')](_0x592031[_0x666f('0x3e')][_0x666f('0x43')]));_0x4e7419[_0x666f('0x42')]=_0x4e7419[_0x666f('0x42')][_0x666f('0x44')]?_0x4e7419[_0x666f('0x42')]:_0x5a1041['model'];_0x4e7419[_0x666f('0x47')]=qs['sort'](_0x592031[_0x666f('0x3e')][_0x666f('0x48')]);_0x4e7419[_0x666f('0x49')]=qs['filters'](_[_0x666f('0x4a')](_0x592031[_0x666f('0x3e')],_0x5a1041[_0x666f('0x40')]));if(_0x592031[_0x666f('0x3e')][_0x666f('0x69')]){_0x4e7419[_0x666f('0x49')]=_[_0x666f('0x4b')](_0x4e7419[_0x666f('0x49')],{'$or':_[_0x666f('0x37')](_0x4e7419['attributes'],function(_0x428079){var _0x1fa1be={};_0x1fa1be[_0x428079]={'$like':'%'+_0x592031['query'][_0x666f('0x69')]+'%'};return _0x1fa1be;})});}_0x4e7419=_[_0x666f('0x4b')]({},_0x4e7419,_0x592031[_0x666f('0x6a')]);return _0x5e0508['getTeams'](_0x4e7419);}})['then'](function(_0x59de2f){if(_0x59de2f){_0x396d20=_0x59de2f[_0x666f('0x44')];if(!_0x592031[_0x666f('0x3e')][_0x666f('0x6b')](_0x666f('0x45'))){_0x4e7419['limit']=qs[_0x666f('0x46')](_0x592031[_0x666f('0x3e')]['limit']);_0x4e7419[_0x666f('0x29')]=qs[_0x666f('0x29')](_0x592031[_0x666f('0x3e')][_0x666f('0x29')]);}return _0x5e0508[_0x666f('0x66')](_0x4e7419);}})[_0x666f('0x1c')](function(_0x3496f4){if(_0x3496f4){return _0x3496f4?{'count':_0x396d20,'rows':_0x3496f4}:null;}})[_0x666f('0x1c')](respondWithResult(_0x49ef85,null))['catch'](handleError(_0x49ef85,null));};exports[_0x666f('0x6c')]=function(_0x5ec03e,_0x2283a9,_0x18b33b){var _0x54ed40=_0x5ec03e[_0x666f('0x54')]['ids'];return db[_0x666f('0x68')][_0x666f('0x4d')]({'where':{'id':_0x54ed40},'attributes':['id'],'include':[{'model':db[_0x666f('0x60')],'as':_0x666f('0x6d'),'attributes':['id',_0x666f('0x36'),'online',_0x666f('0x6e'),_0x666f('0x6f')],'raw':!![]}]})['then'](function(_0x4160b9){if(_0x4160b9){var _0x4ba8ae=_[_0x666f('0x70')](_0x4160b9,function(_0x2eb2d0){var _0x1af33c=_0x2eb2d0[_0x666f('0x32')]({'plain':!![]});return _0x1af33c['Agents'];});return db[_0x666f('0x38')][_0x666f('0x52')]({'where':{'id':_0x5ec03e['params']['id']}})['then'](function(_0x31a4b2){return db[_0x666f('0x71')][_0x666f('0x72')](function(_0x20f733){return _0x31a4b2[_0x666f('0x6c')](_0x54ed40,{'transaction':_0x20f733})[_0x666f('0x1c')](function(){return BPromise[_0x666f('0x73')](_0x4ba8ae,function(_0x5b4d1f){return db['UserChatQueue'][_0x666f('0x74')]({'where':{'UserId':_0x5b4d1f['id'],'ChatQueueId':_0x5ec03e[_0x666f('0x50')]['id']},'transaction':_0x20f733});});})[_0x666f('0x1c')](function(){_0x4ba8ae[_0x666f('0x75')](function(_0x208090){socket[_0x666f('0x76')](_0x666f('0x77'),{'UserId':_0x208090['id'],'ChatQueueId':_0x31a4b2['id']});});});});});}})['then'](respondWithStatusCode(_0x2283a9,null))[_0x666f('0x25')](handleError(_0x2283a9,null));};exports[_0x666f('0x78')]=function(_0x59a687,_0x5acc0a,_0x42f4aa){return db[_0x666f('0x68')]['findAll']({'where':{'id':_0x59a687[_0x666f('0x3e')][_0x666f('0x79')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x666f('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x666f('0x1c')](handleEntityNotFound(_0x5acc0a,null))[_0x666f('0x1c')](function(_0x5e0048){var _0x418dc8=_['map'](_0x5e0048,'id');var _0x22391f=[];var _0x1034e4=[];var _0x32c37f=squel[_0x666f('0x7a')]();_0x32c37f['field'](_0x666f('0x7b'))[_0x666f('0x7c')]('team_has_chat_queues','tq')[_0x666f('0x7d')](_0x666f('0x7e'),'ut',_0x666f('0x7f'))[_0x666f('0x49')](_0x666f('0x80'),_0x59a687[_0x666f('0x50')]['id']);for(var _0x4937b6=0x0;_0x4937b6<_0x5e0048[_0x666f('0x44')];_0x4937b6+=0x1){let _0x5a0ac4=_0x5e0048[_0x4937b6];for(var _0xec33f=0x0;_0xec33f<_0x5a0ac4[_0x666f('0x6d')][_0x666f('0x44')];_0xec33f+=0x1){let _0x1848b1=_0x5a0ac4[_0x666f('0x6d')][_0xec33f];var _0xaf92d7=_0x32c37f['clone']();_0xaf92d7[_0x666f('0x49')](_0x666f('0x81'),_0x1848b1['id']);_0x1034e4[_0x666f('0x82')](db[_0x666f('0x71')][_0x666f('0x3e')](_0xaf92d7[_0x666f('0x83')](),{'type':db[_0x666f('0x71')]['QueryTypes'][_0x666f('0x84')]})[_0x666f('0x1c')](function(_0x1fd7d3){if(_0x1fd7d3[_0x666f('0x44')]===0x1){return _0x1848b1['id'];}else{var _0x5290d5=_['every'](_[_0x666f('0x37')](_0x1fd7d3,_0x666f('0x85')),function(_0x21db56){return _[_0x666f('0x86')](_0x418dc8,_0x21db56);});if(_0x5290d5){return _0x1848b1['id'];}}}));}}return BPromise['all'](_0x1034e4)[_0x666f('0x1c')](function(_0x323bf1){_0x22391f=_(_0x22391f)['union'](_0x323bf1)[_0x666f('0x87')]()[_0x666f('0x88')]();return db[_0x666f('0x38')][_0x666f('0x52')]({'where':{'id':_0x59a687['params']['id']}})[_0x666f('0x1c')](function(_0x88a9b3){return db[_0x666f('0x71')][_0x666f('0x72')](function(_0x52c91d){return _0x88a9b3['removeTeams'](_0x59a687[_0x666f('0x3e')][_0x666f('0x79')],{'transaction':_0x52c91d})['then'](function(){if(!_[_0x666f('0x89')](_0x22391f)){return _0x88a9b3[_0x666f('0x8a')](_0x22391f,{'transaction':_0x52c91d});}})['then'](function(){_0x22391f[_0x666f('0x75')](function(_0x1c6168){socket['emit'](_0x666f('0x8b'),{'UserId':_0x1c6168,'ChatQueueId':_0x88a9b3['id']});});});});});});})['then'](respondWithStatusCode(_0x5acc0a,null))[_0x666f('0x25')](handleError(_0x5acc0a,null));};exports[_0x666f('0x8c')]=function(_0xe19015,_0x54f9aa,_0x305020){return db[_0x666f('0x38')][_0x666f('0x52')]({'where':{'id':_0xe19015[_0x666f('0x50')]['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x54f9aa,null))['then'](function(_0x47424f){if(_0x47424f){return _0x47424f[_0x666f('0x8c')](_0xe19015[_0x666f('0x54')]['ids'],_[_0x666f('0x8d')](_0xe19015[_0x666f('0x54')],[_0x666f('0x79'),'id'])||{})[_0x666f('0x8e')](function(_0x355831){for(var _0x4a16da=0x0;_0x4a16da<_0xe19015['body'][_0x666f('0x79')][_0x666f('0x44')];_0x4a16da+=0x1){socket[_0x666f('0x76')](_0x666f('0x77'),{'UserId':Number(_0xe19015[_0x666f('0x54')][_0x666f('0x79')][_0x4a16da]),'ChatQueueId':Number(_0xe19015[_0x666f('0x50')]['id'])});}return _0x355831;});}})[_0x666f('0x1c')](respondWithResult(_0x54f9aa,null))[_0x666f('0x25')](handleError(_0x54f9aa,null));};exports[_0x666f('0x8a')]=function(_0x931fae,_0x2d0425,_0x20c953){return db[_0x666f('0x38')][_0x666f('0x52')]({'where':{'id':_0x931fae[_0x666f('0x50')]['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x2d0425,null))[_0x666f('0x1c')](function(_0x3217a3){if(_0x3217a3){return _0x3217a3[_0x666f('0x8a')](_0x931fae[_0x666f('0x3e')]['ids'])['then'](function(){if(_[_0x666f('0x8f')](_0x931fae['query'][_0x666f('0x79')])){for(var _0x3cf794=0x0;_0x3cf794<_0x931fae[_0x666f('0x3e')][_0x666f('0x79')]['length'];_0x3cf794+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x931fae[_0x666f('0x3e')][_0x666f('0x79')][_0x3cf794]),'ChatQueueId':Number(_0x931fae[_0x666f('0x50')]['id'])});}}else{socket[_0x666f('0x76')](_0x666f('0x8b'),{'UserId':Number(_0x931fae[_0x666f('0x3e')]['ids']),'ChatQueueId':Number(_0x931fae[_0x666f('0x50')]['id'])});}});}})[_0x666f('0x1c')](respondWithStatusCode(_0x2d0425,null))[_0x666f('0x25')](handleError(_0x2d0425,null));};exports[_0x666f('0x90')]=function(_0x179d05,_0x2f4219,_0x5b9436){var _0x35d8d1={};var _0x5be08b={};var _0x50da5b;var _0x4f4d71;return db['ChatQueue'][_0x666f('0x67')]({'where':{'id':_0x179d05[_0x666f('0x50')]['id']}})[_0x666f('0x1c')](handleEntityNotFound(_0x2f4219,null))['then'](function(_0x3e50a9){if(_0x3e50a9){_0x50da5b=_0x3e50a9;_0x5be08b['model']=_['keys'](db[_0x666f('0x60')][_0x666f('0x39')]);_0x5be08b[_0x666f('0x3e')]=_[_0x666f('0x3f')](_0x179d05['query']);_0x5be08b[_0x666f('0x40')]=_[_0x666f('0x41')](_0x5be08b['model'],_0x5be08b['query']);_0x35d8d1[_0x666f('0x42')]=_['intersection'](_0x5be08b[_0x666f('0x3d')],qs[_0x666f('0x43')](_0x179d05[_0x666f('0x3e')][_0x666f('0x43')]));_0x35d8d1[_0x666f('0x42')]=_0x35d8d1['attributes'][_0x666f('0x44')]?_0x35d8d1['attributes']:_0x5be08b[_0x666f('0x3d')];_0x35d8d1[_0x666f('0x47')]=qs['sort'](_0x179d05[_0x666f('0x3e')]['sort']);_0x35d8d1[_0x666f('0x49')]=qs[_0x666f('0x40')](_[_0x666f('0x4a')](_0x179d05[_0x666f('0x3e')],_0x5be08b[_0x666f('0x40')]));if(_0x179d05['query'][_0x666f('0x69')]){_0x35d8d1[_0x666f('0x49')]=_[_0x666f('0x4b')](_0x35d8d1[_0x666f('0x49')],{'$or':_[_0x666f('0x37')](_0x35d8d1['attributes'],function(_0x3fa3e2){var _0x3bd21a={};_0x3bd21a[_0x3fa3e2]={'$like':'%'+_0x179d05[_0x666f('0x3e')][_0x666f('0x69')]+'%'};return _0x3bd21a;})});}_0x35d8d1=_['merge']({},_0x35d8d1,_0x179d05[_0x666f('0x6a')]);return _0x50da5b[_0x666f('0x90')](_0x35d8d1);}})[_0x666f('0x1c')](function(_0x99b838){if(_0x99b838){_0x4f4d71=_0x99b838[_0x666f('0x44')];if(!_0x179d05[_0x666f('0x3e')][_0x666f('0x6b')](_0x666f('0x45'))){_0x35d8d1[_0x666f('0x46')]=qs[_0x666f('0x46')](_0x179d05[_0x666f('0x3e')][_0x666f('0x46')]);_0x35d8d1[_0x666f('0x29')]=qs['offset'](_0x179d05['query'][_0x666f('0x29')]);}return _0x50da5b[_0x666f('0x90')](_0x35d8d1);}})[_0x666f('0x1c')](function(_0x158280){if(_0x158280){return _0x158280?{'count':_0x4f4d71,'rows':_0x158280}:null;}})[_0x666f('0x1c')](respondWithResult(_0x2f4219,null))[_0x666f('0x25')](handleError(_0x2f4219,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9081c84..9f3652c 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 _0x4f38=['update','remove','emit','exports','events','ChatQueue','setMaxListeners','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4f38,0x11c));var _0x84f3=function(_0x262384,_0x31a89a){_0x262384=_0x262384-0x0;var _0x516fe6=_0x4f38[_0x262384];return _0x516fe6;};'use strict';var EventEmitter=require(_0x84f3('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x84f3('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x84f3('0x2')](0x0);var events={'afterCreate':_0x84f3('0x3'),'afterUpdate':_0x84f3('0x4'),'afterDestroy':_0x84f3('0x5')};function emitEvent(_0x54f66a){return function(_0x3aa6bc,_0x101dfb,_0x4b8e02){ChatQueueEvents[_0x84f3('0x6')](_0x54f66a+':'+_0x3aa6bc['id'],_0x3aa6bc);ChatQueueEvents['emit'](_0x54f66a,_0x3aa6bc);_0x4b8e02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x84f3('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xb0d9=['events','ChatQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x21bfaf,_0x32fd3e){var _0x1f2eef=function(_0x3b58f8){while(--_0x3b58f8){_0x21bfaf['push'](_0x21bfaf['shift']());}};_0x1f2eef(++_0x32fd3e);}(_0xb0d9,0x78));var _0x9b0d=function(_0x18b7bb,_0x2278e2){_0x18b7bb=_0x18b7bb-0x0;var _0x250e8c=_0xb0d9[_0x18b7bb];return _0x250e8c;};'use strict';var EventEmitter=require(_0x9b0d('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x9b0d('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9b0d('0x2')](0x0);var events={'afterCreate':_0x9b0d('0x3'),'afterUpdate':'update','afterDestroy':_0x9b0d('0x4')};function emitEvent(_0x55adee){return function(_0x394a0e,_0x1c4f45,_0x4b80a7){ChatQueueEvents[_0x9b0d('0x5')](_0x55adee+':'+_0x394a0e['id'],_0x394a0e);ChatQueueEvents[_0x9b0d('0x5')](_0x55adee,_0x394a0e);_0x4b80a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x9b0d('0x6')](e,emitEvent(event));}}module[_0x9b0d('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7cdb9b5..2104481 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 _0xb9e1=['moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x2329f3,_0x193f3d){var _0xe572b7=function(_0x4beee2){while(--_0x4beee2){_0x2329f3['push'](_0x2329f3['shift']());}};_0xe572b7(++_0x193f3d);}(_0xb9e1,0xcc));var _0x1b9e=function(_0x3be82b,_0x3ef4fb){_0x3be82b=_0x3be82b-0x0;var _0x293c0e=_0xb9e1[_0x3be82b];return _0x293c0e;};'use strict';var _=require(_0x1b9e('0x0'));var util=require(_0x1b9e('0x1'));var logger=require(_0x1b9e('0x2'))(_0x1b9e('0x3'));var moment=require(_0x1b9e('0x4'));var BPromise=require(_0x1b9e('0x5'));var rp=require(_0x1b9e('0x6'));var fs=require('fs');var path=require(_0x1b9e('0x7'));var rimraf=require('rimraf');var config=require(_0x1b9e('0x8'));var attributes=require(_0x1b9e('0x9'));module[_0x1b9e('0xa')]=function(_0x27f108,_0x5a3609){return _0x27f108['define'](_0x1b9e('0xb'),attributes,{'tableName':_0x1b9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fa=['api','bluebird','request-promise','./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger'];(function(_0x47c8d5,_0x5879ea){var _0xc00ac1=function(_0x3a7096){while(--_0x3a7096){_0x47c8d5['push'](_0x47c8d5['shift']());}};_0xc00ac1(++_0x5879ea);}(_0x72fa,0x1c9));var _0xa72f=function(_0x59ce68,_0x98d1b5){_0x59ce68=_0x59ce68-0x0;var _0x37c816=_0x72fa[_0x59ce68];return _0x37c816;};'use strict';var _=require('lodash');var util=require(_0xa72f('0x0'));var logger=require(_0xa72f('0x1'))(_0xa72f('0x2'));var moment=require('moment');var BPromise=require(_0xa72f('0x3'));var rp=require(_0xa72f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa72f('0x5'));module[_0xa72f('0x6')]=function(_0x16e607,_0x492321){return _0x16e607[_0xa72f('0x7')](_0xa72f('0x8'),attributes,{'tableName':'chat_queues','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 73274d2..30d14f6 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 _0x1abc=['then','stringify','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','options','raw','where','attributes','limit','map','include','model'];(function(_0x47d267,_0x5ebbeb){var _0x1bef7a=function(_0x2bcd3a){while(--_0x2bcd3a){_0x47d267['push'](_0x47d267['shift']());}};_0x1bef7a(++_0x5ebbeb);}(_0x1abc,0x107));var _0xc1ab=function(_0x20889a,_0x2fd6a6){_0x20889a=_0x20889a-0x0;var _0x1c515e=_0x1abc[_0x20889a];return _0x1c515e;};'use strict';var _=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var moment=require(_0xc1ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xc1ab('0x3'));var fs=require('fs');var Redis=require(_0xc1ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1ab('0x5'));var logger=require(_0xc1ab('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc1ab('0x7'));var client=jayson[_0xc1ab('0x8')][_0xc1ab('0x9')]({'port':0x232a});config[_0xc1ab('0xa')]=_[_0xc1ab('0xb')](config[_0xc1ab('0xa')],{'host':_0xc1ab('0xc'),'port':0x18eb});var socket=require(_0xc1ab('0xd'))(new Redis(config[_0xc1ab('0xa')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1568ec,_0x5e7da4,_0x82f8a6){return new BPromise(function(_0x490e33,_0x4ec759){return client[_0xc1ab('0xe')](_0x1568ec,_0x82f8a6)['then'](function(_0x1098dd){logger[_0xc1ab('0xf')]('ChatQueue,\x20%s,\x20%s',_0x5e7da4,_0xc1ab('0x10'));logger[_0xc1ab('0x11')](_0xc1ab('0x12'),_0x5e7da4,'request\x20sent',JSON['stringify'](_0x1098dd));if(_0x1098dd['error']){if(_0x1098dd[_0xc1ab('0x13')][_0xc1ab('0x14')]===0x1f4){logger['error'](_0xc1ab('0x15'),_0x5e7da4,_0x1098dd[_0xc1ab('0x13')][_0xc1ab('0x16')]);return _0x4ec759(_0x1098dd[_0xc1ab('0x13')][_0xc1ab('0x16')]);}logger[_0xc1ab('0x13')](_0xc1ab('0x15'),_0x5e7da4,_0x1098dd['error'][_0xc1ab('0x16')]);return _0x490e33(_0x1098dd[_0xc1ab('0x13')][_0xc1ab('0x16')]);}else{logger[_0xc1ab('0xf')]('ChatQueue,\x20%s,\x20%s',_0x5e7da4,'request\x20sent');_0x490e33(_0x1098dd['result'][_0xc1ab('0x16')]);}})[_0xc1ab('0x17')](function(_0x220dca){logger[_0xc1ab('0x13')](_0xc1ab('0x15'),_0x5e7da4,_0x220dca);_0x4ec759(_0x220dca);});});}exports[_0xc1ab('0x18')]=function(_0x1fe96b){var _0x4b5f19=this;return new Promise(function(_0x19e0b7,_0x14cba2){return db['ChatQueue']['findAll']({'raw':_0x1fe96b[_0xc1ab('0x19')]?_0x1fe96b[_0xc1ab('0x19')][_0xc1ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x1fe96b[_0xc1ab('0x19')]?_0x1fe96b[_0xc1ab('0x19')][_0xc1ab('0x1b')]||null:null,'attributes':_0x1fe96b['options']?_0x1fe96b[_0xc1ab('0x19')][_0xc1ab('0x1c')]||null:null,'limit':_0x1fe96b['options']?_0x1fe96b['options'][_0xc1ab('0x1d')]||null:null,'include':_0x1fe96b[_0xc1ab('0x19')]?_0x1fe96b[_0xc1ab('0x19')]['include']?_[_0xc1ab('0x1e')](_0x1fe96b[_0xc1ab('0x19')][_0xc1ab('0x1f')],function(_0x200dca){return{'model':db[_0x200dca[_0xc1ab('0x20')]],'as':_0x200dca['as'],'attributes':_0x200dca[_0xc1ab('0x1c')],'include':_0x200dca[_0xc1ab('0x1f')]?_[_0xc1ab('0x1e')](_0x200dca[_0xc1ab('0x1f')],function(_0x1faf82){return{'model':db[_0x1faf82[_0xc1ab('0x20')]],'as':_0x1faf82['as'],'attributes':_0x1faf82[_0xc1ab('0x1c')],'include':_0x1faf82[_0xc1ab('0x1f')]?_[_0xc1ab('0x1e')](_0x1faf82[_0xc1ab('0x1f')],function(_0x514278){return{'model':db[_0x514278[_0xc1ab('0x20')]],'as':_0x514278['as'],'attributes':_0x514278[_0xc1ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc1ab('0x21')](function(_0x4236fc){logger[_0xc1ab('0xf')](_0xc1ab('0x18'),_0x1fe96b);logger['debug']('GetChatQueue',_0x1fe96b,JSON[_0xc1ab('0x22')](_0x4236fc));_0x19e0b7(_0x4236fc);})[_0xc1ab('0x17')](function(_0x21ce61){logger[_0xc1ab('0x13')](_0xc1ab('0x18'),_0x21ce61[_0xc1ab('0x16')],_0x1fe96b);_0x14cba2(_0x4b5f19['error'](0x1f4,_0x21ce61[_0xc1ab('0x16')]));});});};exports[_0xc1ab('0x23')]=function(_0xb922dc){var _0x269db4=this;return new Promise(function(_0x527fb1,_0x1f1fac){return db['ChatQueue'][_0xc1ab('0x24')]({'raw':_0xb922dc[_0xc1ab('0x19')]?_0xb922dc[_0xc1ab('0x19')][_0xc1ab('0x1a')]===undefined?!![]:![]:!![],'where':_0xb922dc[_0xc1ab('0x19')]?_0xb922dc['options'][_0xc1ab('0x1b')]||null:null,'attributes':_0xb922dc['options']?_0xb922dc[_0xc1ab('0x19')][_0xc1ab('0x1c')]||null:null,'include':_0xb922dc[_0xc1ab('0x19')]?_0xb922dc[_0xc1ab('0x19')][_0xc1ab('0x1f')]?_['map'](_0xb922dc[_0xc1ab('0x19')][_0xc1ab('0x1f')],function(_0x59b39d){return{'model':db[_0x59b39d[_0xc1ab('0x20')]],'as':_0x59b39d['as'],'attributes':_0x59b39d[_0xc1ab('0x1c')],'include':_0x59b39d['include']?_[_0xc1ab('0x1e')](_0x59b39d['include'],function(_0x8b8b22){return{'model':db[_0x8b8b22[_0xc1ab('0x20')]],'as':_0x8b8b22['as'],'attributes':_0x8b8b22[_0xc1ab('0x1c')],'include':_0x8b8b22[_0xc1ab('0x1f')]?_['map'](_0x8b8b22[_0xc1ab('0x1f')],function(_0xcf19da){return{'model':db[_0xcf19da[_0xc1ab('0x20')]],'as':_0xcf19da['as'],'attributes':_0xcf19da[_0xc1ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc1ab('0x21')](function(_0x79f17a){logger[_0xc1ab('0xf')](_0xc1ab('0x23'),_0xb922dc);logger[_0xc1ab('0x11')](_0xc1ab('0x23'),_0xb922dc,JSON[_0xc1ab('0x22')](_0x79f17a));_0x527fb1(_0x79f17a);})['catch'](function(_0x13da7f){logger[_0xc1ab('0x13')](_0xc1ab('0x23'),_0x13da7f['message'],_0xb922dc);_0x1f1fac(_0x269db4[_0xc1ab('0x13')](0x1f4,_0x13da7f[_0xc1ab('0x16')]));});});}; \ No newline at end of file +var _0x0c19=['stringify','error','code','message','result','catch','GetChatQueue','findAll','options','include','map','model','attributes','ShowChatQueue','ChatQueue','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3755a4,_0x4d0c5d){var _0x15024f=function(_0x4e5b20){while(--_0x4e5b20){_0x3755a4['push'](_0x3755a4['shift']());}};_0x15024f(++_0x4d0c5d);}(_0x0c19,0xf5));var _0x90c1=function(_0xffc83e,_0x9e1b3d){_0xffc83e=_0xffc83e-0x0;var _0x1b9119=_0x0c19[_0xffc83e];return _0x1b9119;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var moment=require(_0x90c1('0x2'));var BPromise=require(_0x90c1('0x3'));var rs=require(_0x90c1('0x4'));var fs=require('fs');var Redis=require(_0x90c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90c1('0x6'));var logger=require(_0x90c1('0x7'))(_0x90c1('0x8'));var config=require('../../config/environment');var jayson=require(_0x90c1('0x9'));var client=jayson[_0x90c1('0xa')]['http']({'port':0x232a});config[_0x90c1('0xb')]=_[_0x90c1('0xc')](config[_0x90c1('0xb')],{'host':_0x90c1('0xd'),'port':0x18eb});var socket=require(_0x90c1('0xe'))(new Redis(config[_0x90c1('0xb')]));require(_0x90c1('0xf'))['register'](socket);function respondWithRpcPromise(_0x1cca46,_0x31f5fd,_0x47effd){return new BPromise(function(_0x12684e,_0x4e291e){return client['request'](_0x1cca46,_0x47effd)[_0x90c1('0x10')](function(_0x4d7a69){logger[_0x90c1('0x11')](_0x90c1('0x12'),_0x31f5fd,_0x90c1('0x13'));logger[_0x90c1('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x31f5fd,'request\x20sent',JSON[_0x90c1('0x15')](_0x4d7a69));if(_0x4d7a69[_0x90c1('0x16')]){if(_0x4d7a69[_0x90c1('0x16')][_0x90c1('0x17')]===0x1f4){logger['error'](_0x90c1('0x12'),_0x31f5fd,_0x4d7a69[_0x90c1('0x16')][_0x90c1('0x18')]);return _0x4e291e(_0x4d7a69[_0x90c1('0x16')][_0x90c1('0x18')]);}logger[_0x90c1('0x16')]('ChatQueue,\x20%s,\x20%s',_0x31f5fd,_0x4d7a69[_0x90c1('0x16')][_0x90c1('0x18')]);return _0x12684e(_0x4d7a69[_0x90c1('0x16')][_0x90c1('0x18')]);}else{logger[_0x90c1('0x11')](_0x90c1('0x12'),_0x31f5fd,_0x90c1('0x13'));_0x12684e(_0x4d7a69[_0x90c1('0x19')][_0x90c1('0x18')]);}})[_0x90c1('0x1a')](function(_0x2e6ecb){logger['error'](_0x90c1('0x12'),_0x31f5fd,_0x2e6ecb);_0x4e291e(_0x2e6ecb);});});}exports[_0x90c1('0x1b')]=function(_0x37e21b){var _0x1cd1f6=this;return new Promise(function(_0x242331,_0x3c8cc6){return db['ChatQueue'][_0x90c1('0x1c')]({'raw':_0x37e21b['options']?_0x37e21b[_0x90c1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x37e21b['options']?_0x37e21b[_0x90c1('0x1d')]['where']||null:null,'attributes':_0x37e21b['options']?_0x37e21b[_0x90c1('0x1d')]['attributes']||null:null,'limit':_0x37e21b['options']?_0x37e21b[_0x90c1('0x1d')]['limit']||null:null,'include':_0x37e21b[_0x90c1('0x1d')]?_0x37e21b['options'][_0x90c1('0x1e')]?_[_0x90c1('0x1f')](_0x37e21b[_0x90c1('0x1d')][_0x90c1('0x1e')],function(_0x174506){return{'model':db[_0x174506[_0x90c1('0x20')]],'as':_0x174506['as'],'attributes':_0x174506[_0x90c1('0x21')],'include':_0x174506['include']?_[_0x90c1('0x1f')](_0x174506[_0x90c1('0x1e')],function(_0x18d8ab){return{'model':db[_0x18d8ab[_0x90c1('0x20')]],'as':_0x18d8ab['as'],'attributes':_0x18d8ab[_0x90c1('0x21')],'include':_0x18d8ab[_0x90c1('0x1e')]?_[_0x90c1('0x1f')](_0x18d8ab[_0x90c1('0x1e')],function(_0x40c45d){return{'model':db[_0x40c45d[_0x90c1('0x20')]],'as':_0x40c45d['as'],'attributes':_0x40c45d[_0x90c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x90c1('0x10')](function(_0x46c65b){logger[_0x90c1('0x11')](_0x90c1('0x1b'),_0x37e21b);logger['debug'](_0x90c1('0x1b'),_0x37e21b,JSON[_0x90c1('0x15')](_0x46c65b));_0x242331(_0x46c65b);})[_0x90c1('0x1a')](function(_0x5be73c){logger[_0x90c1('0x16')](_0x90c1('0x1b'),_0x5be73c[_0x90c1('0x18')],_0x37e21b);_0x3c8cc6(_0x1cd1f6[_0x90c1('0x16')](0x1f4,_0x5be73c[_0x90c1('0x18')]));});});};exports[_0x90c1('0x22')]=function(_0x25a721){var _0x4d7a09=this;return new Promise(function(_0x2366b4,_0x41f885){return db[_0x90c1('0x23')]['find']({'raw':_0x25a721[_0x90c1('0x1d')]?_0x25a721[_0x90c1('0x1d')][_0x90c1('0x24')]===undefined?!![]:![]:!![],'where':_0x25a721[_0x90c1('0x1d')]?_0x25a721[_0x90c1('0x1d')][_0x90c1('0x25')]||null:null,'attributes':_0x25a721[_0x90c1('0x1d')]?_0x25a721[_0x90c1('0x1d')][_0x90c1('0x21')]||null:null,'include':_0x25a721[_0x90c1('0x1d')]?_0x25a721[_0x90c1('0x1d')][_0x90c1('0x1e')]?_[_0x90c1('0x1f')](_0x25a721[_0x90c1('0x1d')]['include'],function(_0x253e92){return{'model':db[_0x253e92[_0x90c1('0x20')]],'as':_0x253e92['as'],'attributes':_0x253e92[_0x90c1('0x21')],'include':_0x253e92[_0x90c1('0x1e')]?_['map'](_0x253e92['include'],function(_0x173dae){return{'model':db[_0x173dae[_0x90c1('0x20')]],'as':_0x173dae['as'],'attributes':_0x173dae[_0x90c1('0x21')],'include':_0x173dae[_0x90c1('0x1e')]?_['map'](_0x173dae['include'],function(_0x244800){return{'model':db[_0x244800[_0x90c1('0x20')]],'as':_0x244800['as'],'attributes':_0x244800[_0x90c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x90c1('0x10')](function(_0x295b4b){logger['info']('ShowChatQueue',_0x25a721);logger['debug'](_0x90c1('0x22'),_0x25a721,JSON[_0x90c1('0x15')](_0x295b4b));_0x2366b4(_0x295b4b);})[_0x90c1('0x1a')](function(_0x4e1dc5){logger[_0x90c1('0x16')]('ShowChatQueue',_0x4e1dc5['message'],_0x25a721);_0x41f885(_0x4d7a09[_0x90c1('0x16')](0x1f4,_0x4e1dc5[_0x90c1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e723353..ca9efa9 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 _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0x39ebfe,_0x1748f7){var _0x3a79df=function(_0x9c89cf){while(--_0x9c89cf){_0x39ebfe['push'](_0x39ebfe['shift']());}};_0x3a79df(++_0x1748f7);}(_0x2d17,0x17e));var _0x72d1=function(_0x55e595,_0x4bcbab){_0x55e595=_0x55e595-0x0;var _0x339a4b=_0x2d17[_0x55e595];return _0x339a4b;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file +var _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x425d,0x1e0));var _0xd425=function(_0x25eee5,_0x397933){_0x25eee5=_0x25eee5-0x0;var _0x49a41f=_0x425d[_0x25eee5];return _0x49a41f;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6412775..2e2017a 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x2c96c0,_0x490d48){var _0x30c3a9=function(_0x45c563){while(--_0x45c563){_0x2c96c0['push'](_0x2c96c0['shift']());}};_0x30c3a9(++_0x490d48);}(_0x55ca,0x126));var _0xa55c=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x55ca[_0x15d18f];return _0xd12bf7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x304e2a,_0x21653e){var _0x1e409c=function(_0x56dd08){while(--_0x56dd08){_0x304e2a['push'](_0x304e2a['shift']());}};_0x1e409c(++_0x21653e);}(_0xe14b,0x93));var _0xbe14=function(_0xdcbf1c,_0x438874){_0xdcbf1c=_0xdcbf1c-0x0;var _0x57116e=_0xe14b[_0xdcbf1c];return _0x57116e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d7adb49..34c67f6 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 _0x904c=['STRING','DATE','moment','sequelize','exports'];(function(_0x32f5ba,_0x2e66bf){var _0x2521a5=function(_0x411e93){while(--_0x411e93){_0x32f5ba['push'](_0x32f5ba['shift']());}};_0x2521a5(++_0x2e66bf);}(_0x904c,0xd9));var _0xc904=function(_0x37d268,_0x372782){_0x37d268=_0x37d268-0x0;var _0x19c77c=_0x904c[_0x37d268];return _0x19c77c;};'use strict';var moment=require(_0xc904('0x0'));var Sequelize=require(_0xc904('0x1'));module[_0xc904('0x2')]={'uniqueid':{'type':Sequelize[_0xc904('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc904('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc904('0x4')]},'exitAt':{'type':Sequelize[_0xc904('0x4')]},'reason':{'type':Sequelize[_0xc904('0x3')]}}; \ No newline at end of file +var _0x770a=['exports','STRING','DATE','moment','sequelize'];(function(_0x194047,_0x3d8da4){var _0x486b52=function(_0x1ecbcc){while(--_0x1ecbcc){_0x194047['push'](_0x194047['shift']());}};_0x486b52(++_0x3d8da4);}(_0x770a,0x1d9));var _0xa770=function(_0x3034d3,_0x22dd61){_0x3034d3=_0x3034d3-0x0;var _0x29fbec=_0x770a[_0x3034d3];return _0x29fbec;};'use strict';var moment=require(_0xa770('0x0'));var Sequelize=require(_0xa770('0x1'));module[_0xa770('0x2')]={'uniqueid':{'type':Sequelize[_0xa770('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa770('0x4')]},'acceptAt':{'type':Sequelize[_0xa770('0x4')]},'exitAt':{'type':Sequelize[_0xa770('0x4')]},'reason':{'type':Sequelize[_0xa770('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6971de6..8e2e4a8 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 _0xa93a=['end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','describe','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa93a,0xb8));var _0xaa93=function(_0x4cd037,_0x54d2d4){_0x4cd037=_0x4cd037-0x0;var _0x2cf9f3=_0xa93a[_0x4cd037];return _0x2cf9f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa93('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa93('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xaa93('0x2'));var util=require('util');var path=require(_0xaa93('0x3'));var sox=require(_0xaa93('0x4'));var csv=require(_0xaa93('0x5'));var ejs=require(_0xaa93('0x6'));var fs=require('fs');var fs_extra=require(_0xaa93('0x7'));var _=require('lodash');var squel=require(_0xaa93('0x8'));var crypto=require(_0xaa93('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaa93('0xa'));var toCsv=require('to-csv');var querystring=require(_0xaa93('0xb'));var Papa=require(_0xaa93('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa93('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa93('0xe'))(_0xaa93('0xf'));var utils=require(_0xaa93('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa93('0x11'))['db'];function respondWithStatusCode(_0x52fba9,_0x96fabf){_0x96fabf=_0x96fabf||0xcc;return function(_0x55f5dc){if(_0x55f5dc){return _0x52fba9[_0xaa93('0x12')](_0x96fabf);}return _0x52fba9[_0xaa93('0x13')](_0x96fabf)[_0xaa93('0x14')]();};}function respondWithResult(_0x2418e3,_0x3f9df4){_0x3f9df4=_0x3f9df4||0xc8;return function(_0x580151){if(_0x580151){return _0x2418e3[_0xaa93('0x13')](_0x3f9df4)['json'](_0x580151);}};}function respondWithFilteredResult(_0x2df8c8,_0xfcb352){return function(_0x59d73c){if(_0x59d73c){var _0x543a57=typeof _0xfcb352[_0xaa93('0x15')]===_0xaa93('0x16')&&typeof _0xfcb352[_0xaa93('0x17')]===_0xaa93('0x16');var _0x1f6d57=_0x59d73c[_0xaa93('0x18')];var _0x29f90a=_0x543a57?0x0:_0xfcb352[_0xaa93('0x15')];var _0x542a56=_0x543a57?_0x59d73c['count']:_0xfcb352[_0xaa93('0x15')]+_0xfcb352[_0xaa93('0x17')];var _0xae316;if(_0x542a56>=_0x1f6d57){_0x542a56=_0x1f6d57;_0xae316=0xc8;}else{_0xae316=0xce;}_0x2df8c8['status'](_0xae316);return _0x2df8c8[_0xaa93('0x19')](_0xaa93('0x1a'),_0x29f90a+'-'+_0x542a56+'/'+_0x1f6d57)['json'](_0x59d73c);}return null;};}function patchUpdates(_0x3df2f4){return function(_0x4cae27){try{jsonpatch[_0xaa93('0x1b')](_0x4cae27,_0x3df2f4,!![]);}catch(_0x5b7735){return BPromise[_0xaa93('0x1c')](_0x5b7735);}return _0x4cae27[_0xaa93('0x1d')]();};}function saveUpdates(_0x4d6a45,_0x9e28ff){return function(_0x4cd72b){if(_0x4cd72b){return _0x4cd72b[_0xaa93('0x1e')](_0x4d6a45)[_0xaa93('0x1f')](function(_0x4be9e1){return _0x4be9e1;});}return null;};}function removeEntity(_0x4fc233,_0x2a1683){return function(_0x6eb19e){if(_0x6eb19e){return _0x6eb19e[_0xaa93('0x20')]()['then'](function(){_0x4fc233['status'](0xcc)[_0xaa93('0x14')]();});}};}function handleEntityNotFound(_0x51a0de,_0x2b3d76){return function(_0x1e7e97){if(!_0x1e7e97){_0x51a0de[_0xaa93('0x12')](0x194);}return _0x1e7e97;};}function handleError(_0x584059,_0x2c2e8f){_0x2c2e8f=_0x2c2e8f||0x1f4;return function(_0x17e2e6){logger[_0xaa93('0x21')](_0x17e2e6[_0xaa93('0x22')]);if(_0x17e2e6['name']){delete _0x17e2e6[_0xaa93('0x23')];}_0x584059['status'](_0x2c2e8f)['send'](_0x17e2e6);};}exports['index']=function(_0x535a92,_0x3b7b4c){var _0x76cd82={},_0x46c3ae={},_0xc7028d={'count':0x0,'rows':[]};var _0x515d55=_[_0xaa93('0x24')](db[_0xaa93('0x25')][_0xaa93('0x26')],function(_0x185059){return{'name':_0x185059[_0xaa93('0x27')],'type':_0x185059[_0xaa93('0x28')][_0xaa93('0x29')]};});_0x46c3ae[_0xaa93('0x2a')]=_[_0xaa93('0x24')](_0x515d55,_0xaa93('0x23'));_0x46c3ae['query']=_['keys'](_0x535a92['query']);_0x46c3ae[_0xaa93('0x2b')]=_[_0xaa93('0x2c')](_0x46c3ae[_0xaa93('0x2a')],_0x46c3ae['query']);_0x76cd82['attributes']=_[_0xaa93('0x2c')](_0x46c3ae['model'],qs[_0xaa93('0x2d')](_0x535a92[_0xaa93('0x2e')][_0xaa93('0x2d')]));_0x76cd82[_0xaa93('0x2f')]=_0x76cd82['attributes'][_0xaa93('0x30')]?_0x76cd82[_0xaa93('0x2f')]:_0x46c3ae[_0xaa93('0x2a')];if(!_0x535a92[_0xaa93('0x2e')][_0xaa93('0x31')]('nolimit')){_0x76cd82[_0xaa93('0x17')]=qs['limit'](_0x535a92[_0xaa93('0x2e')][_0xaa93('0x17')]);_0x76cd82[_0xaa93('0x15')]=qs[_0xaa93('0x15')](_0x535a92[_0xaa93('0x2e')][_0xaa93('0x15')]);}_0x76cd82['order']=qs['sort'](_0x535a92['query'][_0xaa93('0x32')]);_0x76cd82['where']=qs[_0xaa93('0x2b')](_[_0xaa93('0x33')](_0x535a92['query'],_0x46c3ae[_0xaa93('0x2b')]),_0x515d55);if(_0x535a92[_0xaa93('0x2e')][_0xaa93('0x34')]){_0x76cd82[_0xaa93('0x35')]=_[_0xaa93('0x36')](_0x76cd82[_0xaa93('0x35')],{'$or':_[_0xaa93('0x24')](_0x515d55,function(_0x3442c4){if(_0x3442c4['type']!==_0xaa93('0x37')){var _0x2fede7={};_0x2fede7[_0x3442c4[_0xaa93('0x23')]]={'$like':'%'+_0x535a92[_0xaa93('0x2e')]['filter']+'%'};return _0x2fede7;}})});}_0x76cd82=_['merge']({},_0x76cd82,_0x535a92['options']);var _0x500d1a={'where':_0x76cd82[_0xaa93('0x35')]};return db[_0xaa93('0x25')][_0xaa93('0x18')](_0x500d1a)[_0xaa93('0x1f')](function(_0x55f701){_0xc7028d['count']=_0x55f701;if(_0x535a92[_0xaa93('0x2e')][_0xaa93('0x38')]){_0x76cd82['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xaa93('0x39')](_0x76cd82);})[_0xaa93('0x1f')](function(_0x5bf7be){_0xc7028d[_0xaa93('0x3a')]=_0x5bf7be;return _0xc7028d;})['then'](respondWithFilteredResult(_0x3b7b4c,_0x76cd82))[_0xaa93('0x3b')](handleError(_0x3b7b4c,null));};exports['show']=function(_0x491086,_0x35dc56){var _0x242d7a={'raw':!![],'where':{'id':_0x491086[_0xaa93('0x3c')]['id']}},_0x59d92e={};_0x59d92e[_0xaa93('0x2a')]=_[_0xaa93('0x3d')](db[_0xaa93('0x25')][_0xaa93('0x26')]);_0x59d92e[_0xaa93('0x2e')]=_[_0xaa93('0x3d')](_0x491086[_0xaa93('0x2e')]);_0x59d92e[_0xaa93('0x2b')]=_['intersection'](_0x59d92e[_0xaa93('0x2a')],_0x59d92e[_0xaa93('0x2e')]);_0x242d7a['attributes']=_['intersection'](_0x59d92e[_0xaa93('0x2a')],qs[_0xaa93('0x2d')](_0x491086[_0xaa93('0x2e')][_0xaa93('0x2d')]));_0x242d7a[_0xaa93('0x2f')]=_0x242d7a['attributes']['length']?_0x242d7a['attributes']:_0x59d92e[_0xaa93('0x2a')];if(_0x491086['query'][_0xaa93('0x38')]){_0x242d7a[_0xaa93('0x3e')]=[{'all':!![]}];}_0x242d7a=_[_0xaa93('0x36')]({},_0x242d7a,_0x491086[_0xaa93('0x3f')]);return db[_0xaa93('0x25')][_0xaa93('0x40')](_0x242d7a)[_0xaa93('0x1f')](handleEntityNotFound(_0x35dc56,null))[_0xaa93('0x1f')](respondWithResult(_0x35dc56,null))[_0xaa93('0x3b')](handleError(_0x35dc56,null));};exports[_0xaa93('0x41')]=function(_0x2370ea,_0x5bfdcf){return db[_0xaa93('0x25')]['create'](_0x2370ea[_0xaa93('0x42')],{})[_0xaa93('0x1f')](respondWithResult(_0x5bfdcf,0xc9))[_0xaa93('0x3b')](handleError(_0x5bfdcf,null));};exports[_0xaa93('0x1e')]=function(_0x1190e3,_0x1adfa8){if(_0x1190e3[_0xaa93('0x42')]['id']){delete _0x1190e3[_0xaa93('0x42')]['id'];}return db['ChatQueueReport'][_0xaa93('0x40')]({'where':{'id':_0x1190e3[_0xaa93('0x3c')]['id']}})[_0xaa93('0x1f')](handleEntityNotFound(_0x1adfa8,null))[_0xaa93('0x1f')](saveUpdates(_0x1190e3[_0xaa93('0x42')],null))[_0xaa93('0x1f')](respondWithResult(_0x1adfa8,null))['catch'](handleError(_0x1adfa8,null));};exports[_0xaa93('0x20')]=function(_0x2ff830,_0x3ca8e1){return db[_0xaa93('0x25')]['find']({'where':{'id':_0x2ff830['params']['id']}})[_0xaa93('0x1f')](handleEntityNotFound(_0x3ca8e1,null))[_0xaa93('0x1f')](removeEntity(_0x3ca8e1,null))[_0xaa93('0x3b')](handleError(_0x3ca8e1,null));};exports[_0xaa93('0x43')]=function(_0x2e8dfd,_0x683145){return db[_0xaa93('0x25')][_0xaa93('0x43')]()[_0xaa93('0x1f')](respondWithResult(_0x683145,null))[_0xaa93('0x3b')](handleError(_0x683145,null));}; \ No newline at end of file +var _0xd3e3=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatQueueReport','include','findAll','rows','show','params','find','catch','body','describe','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3e3,0xdd));var _0x3d3e=function(_0xe92588,_0x6d773c){_0xe92588=_0xe92588-0x0;var _0x29025e=_0xd3e3[_0xe92588];return _0x29025e;};'use strict';var emlformat=require(_0x3d3e('0x0'));var rimraf=require(_0x3d3e('0x1'));var zipdir=require(_0x3d3e('0x2'));var jsonpatch=require(_0x3d3e('0x3'));var rp=require('request-promise');var moment=require(_0x3d3e('0x4'));var BPromise=require(_0x3d3e('0x5'));var Mustache=require('mustache');var util=require(_0x3d3e('0x6'));var path=require(_0x3d3e('0x7'));var sox=require('sox');var csv=require(_0x3d3e('0x8'));var ejs=require(_0x3d3e('0x9'));var fs=require('fs');var fs_extra=require(_0x3d3e('0xa'));var _=require(_0x3d3e('0xb'));var squel=require(_0x3d3e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d3e('0xd'));var deskjs=require(_0x3d3e('0xe'));var toCsv=require(_0x3d3e('0x8'));var querystring=require('querystring');var Papa=require(_0x3d3e('0xf'));var Redis=require(_0x3d3e('0x10'));var authService=require(_0x3d3e('0x11'));var qs=require(_0x3d3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3e('0x13'));var logger=require('../../config/logger')(_0x3d3e('0x14'));var utils=require(_0x3d3e('0x15'));var config=require(_0x3d3e('0x16'));var licenseUtil=require(_0x3d3e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bab27,_0xc50a22){_0xc50a22=_0xc50a22||0xcc;return function(_0x59a93b){if(_0x59a93b){return _0x3bab27[_0x3d3e('0x18')](_0xc50a22);}return _0x3bab27[_0x3d3e('0x19')](_0xc50a22)[_0x3d3e('0x1a')]();};}function respondWithResult(_0xa72f73,_0x3c44cb){_0x3c44cb=_0x3c44cb||0xc8;return function(_0x27ac04){if(_0x27ac04){return _0xa72f73[_0x3d3e('0x19')](_0x3c44cb)[_0x3d3e('0x1b')](_0x27ac04);}};}function respondWithFilteredResult(_0xaa17,_0x5850b4){return function(_0x3856e9){if(_0x3856e9){var _0x2e664b=typeof _0x5850b4[_0x3d3e('0x1c')]==='undefined'&&typeof _0x5850b4['limit']===_0x3d3e('0x1d');var _0x5c19bf=_0x3856e9[_0x3d3e('0x1e')];var _0x3f661c=_0x2e664b?0x0:_0x5850b4[_0x3d3e('0x1c')];var _0x1fa3cc=_0x2e664b?_0x3856e9['count']:_0x5850b4['offset']+_0x5850b4[_0x3d3e('0x1f')];var _0x27c782;if(_0x1fa3cc>=_0x5c19bf){_0x1fa3cc=_0x5c19bf;_0x27c782=0xc8;}else{_0x27c782=0xce;}_0xaa17['status'](_0x27c782);return _0xaa17[_0x3d3e('0x20')](_0x3d3e('0x21'),_0x3f661c+'-'+_0x1fa3cc+'/'+_0x5c19bf)[_0x3d3e('0x1b')](_0x3856e9);}return null;};}function patchUpdates(_0x22083a){return function(_0x3c2c41){try{jsonpatch['apply'](_0x3c2c41,_0x22083a,!![]);}catch(_0x4a1354){return BPromise[_0x3d3e('0x22')](_0x4a1354);}return _0x3c2c41[_0x3d3e('0x23')]();};}function saveUpdates(_0x10314e,_0x326c3d){return function(_0x434949){if(_0x434949){return _0x434949[_0x3d3e('0x24')](_0x10314e)[_0x3d3e('0x25')](function(_0x18efd3){return _0x18efd3;});}return null;};}function removeEntity(_0x4f5377,_0x4c62af){return function(_0x5b9037){if(_0x5b9037){return _0x5b9037[_0x3d3e('0x26')]()[_0x3d3e('0x25')](function(){_0x4f5377[_0x3d3e('0x19')](0xcc)[_0x3d3e('0x1a')]();});}};}function handleEntityNotFound(_0x1e4116,_0x3860d6){return function(_0x42bd39){if(!_0x42bd39){_0x1e4116[_0x3d3e('0x18')](0x194);}return _0x42bd39;};}function handleError(_0x4e77d9,_0x353b74){_0x353b74=_0x353b74||0x1f4;return function(_0x41e53d){logger[_0x3d3e('0x27')](_0x41e53d[_0x3d3e('0x28')]);if(_0x41e53d[_0x3d3e('0x29')]){delete _0x41e53d[_0x3d3e('0x29')];}_0x4e77d9[_0x3d3e('0x19')](_0x353b74)['send'](_0x41e53d);};}exports[_0x3d3e('0x2a')]=function(_0x470030,_0x16e7d9){var _0xb50dfa={},_0x4498f0={},_0x5cffd0={'count':0x0,'rows':[]};var _0x2d78a3=_[_0x3d3e('0x2b')](db['ChatQueueReport'][_0x3d3e('0x2c')],function(_0x2b643b){return{'name':_0x2b643b[_0x3d3e('0x2d')],'type':_0x2b643b[_0x3d3e('0x2e')][_0x3d3e('0x2f')]};});_0x4498f0['model']=_[_0x3d3e('0x2b')](_0x2d78a3,'name');_0x4498f0['query']=_[_0x3d3e('0x30')](_0x470030[_0x3d3e('0x31')]);_0x4498f0[_0x3d3e('0x32')]=_[_0x3d3e('0x33')](_0x4498f0[_0x3d3e('0x34')],_0x4498f0[_0x3d3e('0x31')]);_0xb50dfa['attributes']=_[_0x3d3e('0x33')](_0x4498f0[_0x3d3e('0x34')],qs[_0x3d3e('0x35')](_0x470030['query'][_0x3d3e('0x35')]));_0xb50dfa[_0x3d3e('0x36')]=_0xb50dfa['attributes'][_0x3d3e('0x37')]?_0xb50dfa['attributes']:_0x4498f0['model'];if(!_0x470030['query'][_0x3d3e('0x38')](_0x3d3e('0x39'))){_0xb50dfa['limit']=qs['limit'](_0x470030[_0x3d3e('0x31')][_0x3d3e('0x1f')]);_0xb50dfa['offset']=qs['offset'](_0x470030['query'][_0x3d3e('0x1c')]);}_0xb50dfa['order']=qs[_0x3d3e('0x3a')](_0x470030[_0x3d3e('0x31')][_0x3d3e('0x3a')]);_0xb50dfa[_0x3d3e('0x3b')]=qs['filters'](_[_0x3d3e('0x3c')](_0x470030[_0x3d3e('0x31')],_0x4498f0[_0x3d3e('0x32')]),_0x2d78a3);if(_0x470030[_0x3d3e('0x31')][_0x3d3e('0x3d')]){_0xb50dfa['where']=_[_0x3d3e('0x3e')](_0xb50dfa[_0x3d3e('0x3b')],{'$or':_[_0x3d3e('0x2b')](_0x2d78a3,function(_0x2fc45c){if(_0x2fc45c['type']!=='VIRTUAL'){var _0x447da0={};_0x447da0[_0x2fc45c[_0x3d3e('0x29')]]={'$like':'%'+_0x470030['query'][_0x3d3e('0x3d')]+'%'};return _0x447da0;}})});}_0xb50dfa=_['merge']({},_0xb50dfa,_0x470030[_0x3d3e('0x3f')]);var _0x152ac6={'where':_0xb50dfa[_0x3d3e('0x3b')]};return db[_0x3d3e('0x40')]['count'](_0x152ac6)[_0x3d3e('0x25')](function(_0xd459b2){_0x5cffd0[_0x3d3e('0x1e')]=_0xd459b2;if(_0x470030[_0x3d3e('0x31')]['includeAll']){_0xb50dfa[_0x3d3e('0x41')]=[{'all':!![]}];}return db[_0x3d3e('0x40')][_0x3d3e('0x42')](_0xb50dfa);})[_0x3d3e('0x25')](function(_0x2fd4b4){_0x5cffd0[_0x3d3e('0x43')]=_0x2fd4b4;return _0x5cffd0;})[_0x3d3e('0x25')](respondWithFilteredResult(_0x16e7d9,_0xb50dfa))['catch'](handleError(_0x16e7d9,null));};exports[_0x3d3e('0x44')]=function(_0x4c157a,_0x1c15ff){var _0x2c1189={'raw':!![],'where':{'id':_0x4c157a[_0x3d3e('0x45')]['id']}},_0x259002={};_0x259002['model']=_[_0x3d3e('0x30')](db['ChatQueueReport'][_0x3d3e('0x2c')]);_0x259002[_0x3d3e('0x31')]=_['keys'](_0x4c157a['query']);_0x259002[_0x3d3e('0x32')]=_[_0x3d3e('0x33')](_0x259002[_0x3d3e('0x34')],_0x259002['query']);_0x2c1189[_0x3d3e('0x36')]=_['intersection'](_0x259002[_0x3d3e('0x34')],qs[_0x3d3e('0x35')](_0x4c157a['query']['fields']));_0x2c1189['attributes']=_0x2c1189[_0x3d3e('0x36')][_0x3d3e('0x37')]?_0x2c1189[_0x3d3e('0x36')]:_0x259002[_0x3d3e('0x34')];if(_0x4c157a[_0x3d3e('0x31')]['includeAll']){_0x2c1189[_0x3d3e('0x41')]=[{'all':!![]}];}_0x2c1189=_[_0x3d3e('0x3e')]({},_0x2c1189,_0x4c157a[_0x3d3e('0x3f')]);return db[_0x3d3e('0x40')][_0x3d3e('0x46')](_0x2c1189)[_0x3d3e('0x25')](handleEntityNotFound(_0x1c15ff,null))[_0x3d3e('0x25')](respondWithResult(_0x1c15ff,null))[_0x3d3e('0x47')](handleError(_0x1c15ff,null));};exports['create']=function(_0x6ffe29,_0x25d58e){return db[_0x3d3e('0x40')]['create'](_0x6ffe29[_0x3d3e('0x48')],{})['then'](respondWithResult(_0x25d58e,0xc9))[_0x3d3e('0x47')](handleError(_0x25d58e,null));};exports['update']=function(_0x333412,_0x3eca54){if(_0x333412['body']['id']){delete _0x333412[_0x3d3e('0x48')]['id'];}return db[_0x3d3e('0x40')][_0x3d3e('0x46')]({'where':{'id':_0x333412[_0x3d3e('0x45')]['id']}})[_0x3d3e('0x25')](handleEntityNotFound(_0x3eca54,null))[_0x3d3e('0x25')](saveUpdates(_0x333412[_0x3d3e('0x48')],null))['then'](respondWithResult(_0x3eca54,null))[_0x3d3e('0x47')](handleError(_0x3eca54,null));};exports[_0x3d3e('0x26')]=function(_0x39b425,_0x55f61d){return db['ChatQueueReport']['find']({'where':{'id':_0x39b425[_0x3d3e('0x45')]['id']}})[_0x3d3e('0x25')](handleEntityNotFound(_0x55f61d,null))[_0x3d3e('0x25')](removeEntity(_0x55f61d,null))['catch'](handleError(_0x55f61d,null));};exports[_0x3d3e('0x49')]=function(_0x538e5f,_0xdaaa84){return db['ChatQueueReport'][_0x3d3e('0x49')]()[_0x3d3e('0x25')](respondWithResult(_0xdaaa84,null))[_0x3d3e('0x47')](handleError(_0xdaaa84,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 230bac9..e3561ce 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bdd95,_0x3d0251){var _0xa776c0=function(_0x200f83){while(--_0x200f83){_0x3bdd95['push'](_0x3bdd95['shift']());}};_0xa776c0(++_0x3d0251);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x5bad8f,_0x3a51ef){var _0x2f643a=function(_0x23e4ed){while(--_0x23e4ed){_0x5bad8f['push'](_0x5bad8f['shift']());}};_0x2f643a(++_0x3a51ef);}(_0xe706,0xa3));var _0x6e70=function(_0x201043,_0x57e46b){_0x201043=_0x201043-0x0;var _0x29e5f2=_0xe706[_0x201043];return _0x29e5f2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 754fa31..08b4535 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 _0x23ca=['error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','raw','where','limit','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d9cc6,_0x4ba613){var _0x2165b7=function(_0x25a4f5){while(--_0x25a4f5){_0x5d9cc6['push'](_0x5d9cc6['shift']());}};_0x2165b7(++_0x4ba613);}(_0x23ca,0x130));var _0xa23c=function(_0x450869,_0x6f402d){_0x450869=_0x450869-0x0;var _0x3e261f=_0x23ca[_0x450869];return _0x3e261f;};'use strict';var _=require(_0xa23c('0x0'));var util=require('util');var moment=require(_0xa23c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa23c('0x2'));var fs=require('fs');var Redis=require(_0xa23c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa23c('0x4'));var logger=require(_0xa23c('0x5'))('rpc');var config=require(_0xa23c('0x6'));var jayson=require(_0xa23c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16f1c2,_0x36886e,_0x395993){return new BPromise(function(_0x4246f3,_0x565a88){return client['request'](_0x16f1c2,_0x395993)[_0xa23c('0x8')](function(_0x1609fa){logger[_0xa23c('0x9')](_0xa23c('0xa'),_0x36886e,_0xa23c('0xb'));logger[_0xa23c('0xc')](_0xa23c('0xd'),_0x36886e,_0xa23c('0xb'),JSON[_0xa23c('0xe')](_0x1609fa));if(_0x1609fa[_0xa23c('0xf')]){if(_0x1609fa['error'][_0xa23c('0x10')]===0x1f4){logger[_0xa23c('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x36886e,_0x1609fa['error'][_0xa23c('0x11')]);return _0x565a88(_0x1609fa[_0xa23c('0xf')][_0xa23c('0x11')]);}logger[_0xa23c('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x36886e,_0x1609fa[_0xa23c('0xf')][_0xa23c('0x11')]);return _0x4246f3(_0x1609fa[_0xa23c('0xf')][_0xa23c('0x11')]);}else{logger[_0xa23c('0x9')](_0xa23c('0xa'),_0x36886e,'request\x20sent');_0x4246f3(_0x1609fa[_0xa23c('0x12')][_0xa23c('0x11')]);}})[_0xa23c('0x13')](function(_0xb357bf){logger[_0xa23c('0xf')](_0xa23c('0xa'),_0x36886e,_0xb357bf);_0x565a88(_0xb357bf);});});}exports[_0xa23c('0x14')]=function(_0x5ea866){var _0x2d0294=this;return new Promise(function(_0x1bc489,_0x4163a3){return db[_0xa23c('0x15')][_0xa23c('0x16')](_0x5ea866['body'],{'raw':_0x5ea866[_0xa23c('0x17')]?_0x5ea866['options']['raw']===undefined?!![]:![]:!![]})[_0xa23c('0x8')](function(_0x71b9a6){logger[_0xa23c('0x9')]('CreateChatQueueReport',_0x5ea866);logger[_0xa23c('0xc')](_0xa23c('0x14'),_0x5ea866,JSON[_0xa23c('0xe')](_0x71b9a6));_0x1bc489(_0x71b9a6);})[_0xa23c('0x13')](function(_0x3269a9){logger[_0xa23c('0xf')]('CreateChatQueueReport',_0x3269a9['message'],_0x5ea866);_0x4163a3(_0x2d0294[_0xa23c('0xf')](0x1f4,_0x3269a9[_0xa23c('0x11')]));});});};exports[_0xa23c('0x18')]=function(_0x41a75b){var _0x544017=this;return new Promise(function(_0x301529,_0x11fefa){return db['ChatQueueReport'][_0xa23c('0x19')](_0x41a75b['body'],{'raw':_0x41a75b['options']?_0x41a75b[_0xa23c('0x17')][_0xa23c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41a75b[_0xa23c('0x17')]?_0x41a75b[_0xa23c('0x17')][_0xa23c('0x1b')]||null:null,'attributes':_0x41a75b[_0xa23c('0x17')]?_0x41a75b[_0xa23c('0x17')]['attributes']||null:null,'limit':_0x41a75b['options']?_0x41a75b[_0xa23c('0x17')][_0xa23c('0x1c')]||null:null})[_0xa23c('0x8')](function(_0x46e5c8){logger[_0xa23c('0x9')](_0xa23c('0x18'),_0x41a75b);logger[_0xa23c('0xc')](_0xa23c('0x18'),_0x41a75b,JSON[_0xa23c('0xe')](_0x46e5c8));_0x301529(_0x46e5c8);})[_0xa23c('0x13')](function(_0x2f0519){logger[_0xa23c('0xf')](_0xa23c('0x18'),_0x2f0519[_0xa23c('0x11')],_0x41a75b);_0x11fefa(_0x544017['error'](0x1f4,_0x2f0519[_0xa23c('0x11')]));});});}; \ No newline at end of file +var _0xf248=['code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x28d200,_0x3ad73c){var _0x273bf2=function(_0x2c10a6){while(--_0x2c10a6){_0x28d200['push'](_0x28d200['shift']());}};_0x273bf2(++_0x3ad73c);}(_0xf248,0xfc));var _0x8f24=function(_0x3e3d08,_0x5439be){_0x3e3d08=_0x3e3d08-0x0;var _0x44751a=_0xf248[_0x3e3d08];return _0x44751a;};'use strict';var _=require(_0x8f24('0x0'));var util=require(_0x8f24('0x1'));var moment=require(_0x8f24('0x2'));var BPromise=require(_0x8f24('0x3'));var rs=require(_0x8f24('0x4'));var fs=require('fs');var Redis=require(_0x8f24('0x5'));var db=require(_0x8f24('0x6'))['db'];var utils=require(_0x8f24('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8f24('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f24('0x9')][_0x8f24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435869,_0x4f8d83,_0x52d7dd){return new BPromise(function(_0x120961,_0xc463be){return client[_0x8f24('0xb')](_0x435869,_0x52d7dd)[_0x8f24('0xc')](function(_0x3f229f){logger[_0x8f24('0xd')](_0x8f24('0xe'),_0x4f8d83,_0x8f24('0xf'));logger[_0x8f24('0x10')](_0x8f24('0x11'),_0x4f8d83,_0x8f24('0xf'),JSON[_0x8f24('0x12')](_0x3f229f));if(_0x3f229f['error']){if(_0x3f229f[_0x8f24('0x13')][_0x8f24('0x14')]===0x1f4){logger[_0x8f24('0x13')](_0x8f24('0xe'),_0x4f8d83,_0x3f229f[_0x8f24('0x13')][_0x8f24('0x15')]);return _0xc463be(_0x3f229f[_0x8f24('0x13')]['message']);}logger[_0x8f24('0x13')](_0x8f24('0xe'),_0x4f8d83,_0x3f229f['error'][_0x8f24('0x15')]);return _0x120961(_0x3f229f[_0x8f24('0x13')]['message']);}else{logger[_0x8f24('0xd')](_0x8f24('0xe'),_0x4f8d83,_0x8f24('0xf'));_0x120961(_0x3f229f[_0x8f24('0x16')][_0x8f24('0x15')]);}})[_0x8f24('0x17')](function(_0x1d1913){logger[_0x8f24('0x13')](_0x8f24('0xe'),_0x4f8d83,_0x1d1913);_0xc463be(_0x1d1913);});});}exports[_0x8f24('0x18')]=function(_0x6a91e6){var _0xc076a5=this;return new Promise(function(_0x4ca9e3,_0x4c98a8){return db[_0x8f24('0x19')][_0x8f24('0x1a')](_0x6a91e6['body'],{'raw':_0x6a91e6[_0x8f24('0x1b')]?_0x6a91e6[_0x8f24('0x1b')][_0x8f24('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3c66fd){logger['info']('CreateChatQueueReport',_0x6a91e6);logger['debug'](_0x8f24('0x18'),_0x6a91e6,JSON['stringify'](_0x3c66fd));_0x4ca9e3(_0x3c66fd);})[_0x8f24('0x17')](function(_0x11e407){logger[_0x8f24('0x13')](_0x8f24('0x18'),_0x11e407[_0x8f24('0x15')],_0x6a91e6);_0x4c98a8(_0xc076a5[_0x8f24('0x13')](0x1f4,_0x11e407[_0x8f24('0x15')]));});});};exports[_0x8f24('0x1d')]=function(_0x26fb67){var _0x4781f1=this;return new Promise(function(_0x1f61eb,_0x29cc88){return db['ChatQueueReport'][_0x8f24('0x1e')](_0x26fb67[_0x8f24('0x1f')],{'raw':_0x26fb67['options']?_0x26fb67[_0x8f24('0x1b')][_0x8f24('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26fb67[_0x8f24('0x1b')]?_0x26fb67[_0x8f24('0x1b')][_0x8f24('0x20')]||null:null,'attributes':_0x26fb67[_0x8f24('0x1b')]?_0x26fb67[_0x8f24('0x1b')]['attributes']||null:null,'limit':_0x26fb67['options']?_0x26fb67[_0x8f24('0x1b')][_0x8f24('0x21')]||null:null})[_0x8f24('0xc')](function(_0x4c5656){logger['info'](_0x8f24('0x1d'),_0x26fb67);logger[_0x8f24('0x10')](_0x8f24('0x1d'),_0x26fb67,JSON[_0x8f24('0x12')](_0x4c5656));_0x1f61eb(_0x4c5656);})[_0x8f24('0x17')](function(_0x120fb3){logger['error']('UpdateChatQueueReport',_0x120fb3[_0x8f24('0x15')],_0x26fb67);_0x29cc88(_0x4781f1[_0x8f24('0x13')](0x1f4,_0x120fb3[_0x8f24('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d12874d..f96d7af 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 _0xe747=['isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','index','/:id','show'];(function(_0x1160d7,_0x8324ed){var _0x53df4c=function(_0xecfd16){while(--_0xecfd16){_0x1160d7['push'](_0x1160d7['shift']());}};_0x53df4c(++_0x8324ed);}(_0xe747,0x1c7));var _0x7e74=function(_0x2ae5b9,_0x5775d6){_0x2ae5b9=_0x2ae5b9-0x0;var _0x4e2029=_0xe747[_0x2ae5b9];return _0x4e2029;};'use strict';var multer=require(_0x7e74('0x0'));var util=require(_0x7e74('0x1'));var path=require(_0x7e74('0x2'));var timeout=require(_0x7e74('0x3'));var express=require(_0x7e74('0x4'));var router=express[_0x7e74('0x5')]();var fs_extra=require(_0x7e74('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e74('0x7'));var controller=require(_0x7e74('0x8'));router[_0x7e74('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e74('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7e74('0x9')](_0x7e74('0xb'),auth['isAuthenticated'](),controller[_0x7e74('0xc')]);router['post']('/',auth[_0x7e74('0xd')](),controller['create']);router[_0x7e74('0xe')](_0x7e74('0xb'),auth['isAuthenticated'](),controller[_0x7e74('0xf')]);router[_0x7e74('0x10')](_0x7e74('0xb'),auth[_0x7e74('0xd')](),controller['destroy']);module[_0x7e74('0x11')]=router; \ No newline at end of file +var _0x8734=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','create','put','delete','destroy','exports','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8734,0xdc));var _0x4873=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0x8734[_0x51b7c5];return _0x3355d7;};'use strict';var multer=require('multer');var util=require(_0x4873('0x0'));var path=require(_0x4873('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4873('0x2')]();var fs_extra=require(_0x4873('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4873('0x4'));var config=require(_0x4873('0x5'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x4873('0x6')](),controller[_0x4873('0x7')]);router[_0x4873('0x8')](_0x4873('0x9'),auth['isAuthenticated'](),controller[_0x4873('0xa')]);router['get'](_0x4873('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4873('0xc')]);router[_0x4873('0xd')](_0x4873('0xb'),auth[_0x4873('0x6')](),controller['update']);router[_0x4873('0xe')](_0x4873('0xb'),auth[_0x4873('0x6')](),controller[_0x4873('0xf')]);module[_0x4873('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index fa88453..d24375e 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x9bde,0xe1));var _0xe9bd=function(_0x290a5d,_0x756519){_0x290a5d=_0x290a5d-0x0;var _0x15ec07=_0x9bde[_0x290a5d];return _0x15ec07;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5c804e,_0x583316){var _0x317514=function(_0x266b66){while(--_0x266b66){_0x5c804e['push'](_0x5c804e['shift']());}};_0x317514(++_0x583316);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 11f0e15..417a6b8 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 _0x23c5=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields'];(function(_0x42939d,_0x24b834){var _0x11eed5=function(_0x1a86e7){while(--_0x1a86e7){_0x42939d['push'](_0x42939d['shift']());}};_0x11eed5(++_0x24b834);}(_0x23c5,0xfc));var _0x523c=function(_0x4b34ca,_0x3aa65d){_0x4b34ca=_0x4b34ca-0x0;var _0x2d7676=_0x23c5[_0x4b34ca];return _0x2d7676;};'use strict';var emlformat=require(_0x523c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x523c('0x1'));var jsonpatch=require(_0x523c('0x2'));var rp=require(_0x523c('0x3'));var moment=require(_0x523c('0x4'));var BPromise=require(_0x523c('0x5'));var Mustache=require(_0x523c('0x6'));var util=require(_0x523c('0x7'));var path=require('path');var sox=require(_0x523c('0x8'));var csv=require(_0x523c('0x9'));var ejs=require(_0x523c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x523c('0xb'));var squel=require(_0x523c('0xc'));var crypto=require(_0x523c('0xd'));var jsforce=require(_0x523c('0xe'));var deskjs=require(_0x523c('0xf'));var toCsv=require(_0x523c('0x9'));var querystring=require(_0x523c('0x10'));var Papa=require(_0x523c('0x11'));var Redis=require(_0x523c('0x12'));var authService=require(_0x523c('0x13'));var qs=require(_0x523c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x523c('0x15'));var logger=require(_0x523c('0x16'))(_0x523c('0x17'));var utils=require(_0x523c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x523c('0x19'))['db'];function respondWithStatusCode(_0x482ac0,_0x3e975b){_0x3e975b=_0x3e975b||0xcc;return function(_0x40eb24){if(_0x40eb24){return _0x482ac0[_0x523c('0x1a')](_0x3e975b);}return _0x482ac0['status'](_0x3e975b)[_0x523c('0x1b')]();};}function respondWithResult(_0x519b3d,_0x1f5372){_0x1f5372=_0x1f5372||0xc8;return function(_0x26749c){if(_0x26749c){return _0x519b3d[_0x523c('0x1c')](_0x1f5372)[_0x523c('0x1d')](_0x26749c);}};}function respondWithFilteredResult(_0x4f74b4,_0x2d4b3d){return function(_0x5bb114){if(_0x5bb114){var _0x4a27ce=typeof _0x2d4b3d['offset']===_0x523c('0x1e')&&typeof _0x2d4b3d[_0x523c('0x1f')]==='undefined';var _0x125e3e=_0x5bb114[_0x523c('0x20')];var _0x2cdd95=_0x4a27ce?0x0:_0x2d4b3d[_0x523c('0x21')];var _0x5393a9=_0x4a27ce?_0x5bb114[_0x523c('0x20')]:_0x2d4b3d['offset']+_0x2d4b3d[_0x523c('0x1f')];var _0x438766;if(_0x5393a9>=_0x125e3e){_0x5393a9=_0x125e3e;_0x438766=0xc8;}else{_0x438766=0xce;}_0x4f74b4[_0x523c('0x1c')](_0x438766);return _0x4f74b4[_0x523c('0x22')]('Content-Range',_0x2cdd95+'-'+_0x5393a9+'/'+_0x125e3e)['json'](_0x5bb114);}return null;};}function patchUpdates(_0x1e7055){return function(_0x3cb9c6){try{jsonpatch[_0x523c('0x23')](_0x3cb9c6,_0x1e7055,!![]);}catch(_0x1000f2){return BPromise[_0x523c('0x24')](_0x1000f2);}return _0x3cb9c6[_0x523c('0x25')]();};}function saveUpdates(_0x29f799,_0x4d8346){return function(_0x2938ee){if(_0x2938ee){return _0x2938ee['update'](_0x29f799)[_0x523c('0x26')](function(_0x855e9b){return _0x855e9b;});}return null;};}function removeEntity(_0x24d040,_0x1dfb11){return function(_0x217fbc){if(_0x217fbc){return _0x217fbc[_0x523c('0x27')]()['then'](function(){_0x24d040[_0x523c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b874,_0x23b259){return function(_0x38ae76){if(!_0x38ae76){_0x19b874[_0x523c('0x1a')](0x194);}return _0x38ae76;};}function handleError(_0x47f2d0,_0x4dad26){_0x4dad26=_0x4dad26||0x1f4;return function(_0x5bdc0f){logger[_0x523c('0x28')](_0x5bdc0f[_0x523c('0x29')]);if(_0x5bdc0f[_0x523c('0x2a')]){delete _0x5bdc0f[_0x523c('0x2a')];}_0x47f2d0[_0x523c('0x1c')](_0x4dad26)[_0x523c('0x2b')](_0x5bdc0f);};}exports[_0x523c('0x2c')]=function(_0x4b8ebb,_0x41fbba){var _0x30849d={},_0x4cd70f={},_0x354b98={'count':0x0,'rows':[]};var _0x57e891=_[_0x523c('0x2d')](db[_0x523c('0x2e')][_0x523c('0x2f')],function(_0x2cdb8b){return{'name':_0x2cdb8b[_0x523c('0x30')],'type':_0x2cdb8b['type'][_0x523c('0x31')]};});_0x4cd70f['model']=_[_0x523c('0x2d')](_0x57e891,_0x523c('0x2a'));_0x4cd70f[_0x523c('0x32')]=_[_0x523c('0x33')](_0x4b8ebb[_0x523c('0x32')]);_0x4cd70f[_0x523c('0x34')]=_['intersection'](_0x4cd70f[_0x523c('0x35')],_0x4cd70f[_0x523c('0x32')]);_0x30849d[_0x523c('0x36')]=_['intersection'](_0x4cd70f[_0x523c('0x35')],qs['fields'](_0x4b8ebb[_0x523c('0x32')][_0x523c('0x37')]));_0x30849d[_0x523c('0x36')]=_0x30849d[_0x523c('0x36')][_0x523c('0x38')]?_0x30849d[_0x523c('0x36')]:_0x4cd70f[_0x523c('0x35')];if(!_0x4b8ebb[_0x523c('0x32')][_0x523c('0x39')](_0x523c('0x3a'))){_0x30849d[_0x523c('0x1f')]=qs[_0x523c('0x1f')](_0x4b8ebb['query']['limit']);_0x30849d[_0x523c('0x21')]=qs['offset'](_0x4b8ebb['query']['offset']);}_0x30849d[_0x523c('0x3b')]=qs[_0x523c('0x3c')](_0x4b8ebb[_0x523c('0x32')]['sort']);_0x30849d[_0x523c('0x3d')]=qs[_0x523c('0x34')](_[_0x523c('0x3e')](_0x4b8ebb[_0x523c('0x32')],_0x4cd70f[_0x523c('0x34')]),_0x57e891);if(_0x4b8ebb['query'][_0x523c('0x3f')]){_0x30849d[_0x523c('0x3d')]=_[_0x523c('0x40')](_0x30849d[_0x523c('0x3d')],{'$or':_['map'](_0x57e891,function(_0x234ea6){if(_0x234ea6[_0x523c('0x41')]!==_0x523c('0x42')){var _0x121cfe={};_0x121cfe[_0x234ea6[_0x523c('0x2a')]]={'$like':'%'+_0x4b8ebb['query'][_0x523c('0x3f')]+'%'};return _0x121cfe;}})});}_0x30849d=_[_0x523c('0x40')]({},_0x30849d,_0x4b8ebb['options']);var _0x9447b7={'where':_0x30849d[_0x523c('0x3d')]};return db['ChatTransferReport'][_0x523c('0x20')](_0x9447b7)[_0x523c('0x26')](function(_0x45f8ac){_0x354b98['count']=_0x45f8ac;if(_0x4b8ebb[_0x523c('0x32')][_0x523c('0x43')]){_0x30849d[_0x523c('0x44')]=[{'all':!![]}];}return db[_0x523c('0x2e')][_0x523c('0x45')](_0x30849d);})[_0x523c('0x26')](function(_0x24fa21){_0x354b98['rows']=_0x24fa21;return _0x354b98;})[_0x523c('0x26')](respondWithFilteredResult(_0x41fbba,_0x30849d))[_0x523c('0x46')](handleError(_0x41fbba,null));};exports['show']=function(_0x330917,_0x490f96){var _0x28fe77={'raw':!![],'where':{'id':_0x330917[_0x523c('0x47')]['id']}},_0x36b873={};_0x36b873[_0x523c('0x35')]=_[_0x523c('0x33')](db[_0x523c('0x2e')]['rawAttributes']);_0x36b873[_0x523c('0x32')]=_[_0x523c('0x33')](_0x330917['query']);_0x36b873[_0x523c('0x34')]=_[_0x523c('0x48')](_0x36b873[_0x523c('0x35')],_0x36b873['query']);_0x28fe77[_0x523c('0x36')]=_[_0x523c('0x48')](_0x36b873[_0x523c('0x35')],qs[_0x523c('0x37')](_0x330917['query']['fields']));_0x28fe77[_0x523c('0x36')]=_0x28fe77['attributes']['length']?_0x28fe77[_0x523c('0x36')]:_0x36b873[_0x523c('0x35')];if(_0x330917[_0x523c('0x32')]['includeAll']){_0x28fe77[_0x523c('0x44')]=[{'all':!![]}];}_0x28fe77=_[_0x523c('0x40')]({},_0x28fe77,_0x330917['options']);return db['ChatTransferReport'][_0x523c('0x49')](_0x28fe77)[_0x523c('0x26')](handleEntityNotFound(_0x490f96,null))[_0x523c('0x26')](respondWithResult(_0x490f96,null))[_0x523c('0x46')](handleError(_0x490f96,null));};exports['create']=function(_0x228019,_0x1d9720){return db[_0x523c('0x2e')][_0x523c('0x4a')](_0x228019['body'],{})[_0x523c('0x26')](respondWithResult(_0x1d9720,0xc9))[_0x523c('0x46')](handleError(_0x1d9720,null));};exports['update']=function(_0x1fe073,_0x477733){if(_0x1fe073[_0x523c('0x4b')]['id']){delete _0x1fe073[_0x523c('0x4b')]['id'];}return db['ChatTransferReport'][_0x523c('0x49')]({'where':{'id':_0x1fe073[_0x523c('0x47')]['id']}})[_0x523c('0x26')](handleEntityNotFound(_0x477733,null))[_0x523c('0x26')](saveUpdates(_0x1fe073['body'],null))[_0x523c('0x26')](respondWithResult(_0x477733,null))['catch'](handleError(_0x477733,null));};exports['destroy']=function(_0x5a1c57,_0x3b45f2){return db['ChatTransferReport']['find']({'where':{'id':_0x5a1c57[_0x523c('0x47')]['id']}})[_0x523c('0x26')](handleEntityNotFound(_0x3b45f2,null))['then'](removeEntity(_0x3b45f2,null))[_0x523c('0x46')](handleError(_0x3b45f2,null));};exports[_0x523c('0x4c')]=function(_0x3a77da,_0x28cef5){return db[_0x523c('0x2e')][_0x523c('0x4c')]()['then'](respondWithResult(_0x28cef5,null))[_0x523c('0x46')](handleError(_0x28cef5,null));}; \ No newline at end of file +var _0x5ea1=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','limit','status','set','apply','reject','save','destroy','then','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ChatTransferReport','includeAll','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5ea1,0x97));var _0x15ea=function(_0x1246d7,_0x350673){_0x1246d7=_0x1246d7-0x0;var _0x5b41a3=_0x5ea1[_0x1246d7];return _0x5b41a3;};'use strict';var emlformat=require(_0x15ea('0x0'));var rimraf=require(_0x15ea('0x1'));var zipdir=require(_0x15ea('0x2'));var jsonpatch=require(_0x15ea('0x3'));var rp=require(_0x15ea('0x4'));var moment=require(_0x15ea('0x5'));var BPromise=require(_0x15ea('0x6'));var Mustache=require(_0x15ea('0x7'));var util=require(_0x15ea('0x8'));var path=require(_0x15ea('0x9'));var sox=require('sox');var csv=require(_0x15ea('0xa'));var ejs=require(_0x15ea('0xb'));var fs=require('fs');var fs_extra=require(_0x15ea('0xc'));var _=require('lodash');var squel=require(_0x15ea('0xd'));var crypto=require(_0x15ea('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x15ea('0xa'));var querystring=require(_0x15ea('0xf'));var Papa=require('papaparse');var Redis=require(_0x15ea('0x10'));var authService=require(_0x15ea('0x11'));var qs=require(_0x15ea('0x12'));var as=require(_0x15ea('0x13'));var hardwareService=require(_0x15ea('0x14'));var logger=require('../../config/logger')(_0x15ea('0x15'));var utils=require('../../config/utils');var config=require(_0x15ea('0x16'));var licenseUtil=require(_0x15ea('0x17'));var db=require(_0x15ea('0x18'))['db'];function respondWithStatusCode(_0x24f84f,_0x17fba6){_0x17fba6=_0x17fba6||0xcc;return function(_0x139a02){if(_0x139a02){return _0x24f84f[_0x15ea('0x19')](_0x17fba6);}return _0x24f84f['status'](_0x17fba6)[_0x15ea('0x1a')]();};}function respondWithResult(_0x46b888,_0x5165d0){_0x5165d0=_0x5165d0||0xc8;return function(_0x5087c8){if(_0x5087c8){return _0x46b888['status'](_0x5165d0)[_0x15ea('0x1b')](_0x5087c8);}};}function respondWithFilteredResult(_0x556af6,_0x1cff01){return function(_0x4780f8){if(_0x4780f8){var _0x316864=typeof _0x1cff01[_0x15ea('0x1c')]==='undefined'&&typeof _0x1cff01['limit']==='undefined';var _0x3aa2b4=_0x4780f8['count'];var _0x57a8f8=_0x316864?0x0:_0x1cff01[_0x15ea('0x1c')];var _0x228f6f=_0x316864?_0x4780f8[_0x15ea('0x1d')]:_0x1cff01[_0x15ea('0x1c')]+_0x1cff01[_0x15ea('0x1e')];var _0x274ecb;if(_0x228f6f>=_0x3aa2b4){_0x228f6f=_0x3aa2b4;_0x274ecb=0xc8;}else{_0x274ecb=0xce;}_0x556af6[_0x15ea('0x1f')](_0x274ecb);return _0x556af6[_0x15ea('0x20')]('Content-Range',_0x57a8f8+'-'+_0x228f6f+'/'+_0x3aa2b4)[_0x15ea('0x1b')](_0x4780f8);}return null;};}function patchUpdates(_0x3eeadd){return function(_0x5b9ccf){try{jsonpatch[_0x15ea('0x21')](_0x5b9ccf,_0x3eeadd,!![]);}catch(_0x5017ad){return BPromise[_0x15ea('0x22')](_0x5017ad);}return _0x5b9ccf[_0x15ea('0x23')]();};}function saveUpdates(_0x2b458b,_0x55f866){return function(_0x428f6a){if(_0x428f6a){return _0x428f6a['update'](_0x2b458b)['then'](function(_0x5a684b){return _0x5a684b;});}return null;};}function removeEntity(_0x48e7a0,_0x1d3f36){return function(_0x431bdc){if(_0x431bdc){return _0x431bdc[_0x15ea('0x24')]()[_0x15ea('0x25')](function(){_0x48e7a0[_0x15ea('0x1f')](0xcc)[_0x15ea('0x1a')]();});}};}function handleEntityNotFound(_0x5f45f3,_0x18aebd){return function(_0x2a5b90){if(!_0x2a5b90){_0x5f45f3[_0x15ea('0x19')](0x194);}return _0x2a5b90;};}function handleError(_0x51a42f,_0x413529){_0x413529=_0x413529||0x1f4;return function(_0x46cf53){logger[_0x15ea('0x26')](_0x46cf53[_0x15ea('0x27')]);if(_0x46cf53['name']){delete _0x46cf53['name'];}_0x51a42f['status'](_0x413529)[_0x15ea('0x28')](_0x46cf53);};}exports[_0x15ea('0x29')]=function(_0x4de4f6,_0x4b0899){var _0x3b5926={},_0x5bd588={},_0x2ec7a0={'count':0x0,'rows':[]};var _0xdd3c94=_['map'](db['ChatTransferReport'][_0x15ea('0x2a')],function(_0x2a05a0){return{'name':_0x2a05a0[_0x15ea('0x2b')],'type':_0x2a05a0[_0x15ea('0x2c')][_0x15ea('0x2d')]};});_0x5bd588[_0x15ea('0x2e')]=_[_0x15ea('0x2f')](_0xdd3c94,_0x15ea('0x30'));_0x5bd588[_0x15ea('0x31')]=_[_0x15ea('0x32')](_0x4de4f6[_0x15ea('0x31')]);_0x5bd588[_0x15ea('0x33')]=_[_0x15ea('0x34')](_0x5bd588[_0x15ea('0x2e')],_0x5bd588[_0x15ea('0x31')]);_0x3b5926['attributes']=_[_0x15ea('0x34')](_0x5bd588['model'],qs['fields'](_0x4de4f6['query'][_0x15ea('0x35')]));_0x3b5926[_0x15ea('0x36')]=_0x3b5926[_0x15ea('0x36')]['length']?_0x3b5926[_0x15ea('0x36')]:_0x5bd588[_0x15ea('0x2e')];if(!_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x37')](_0x15ea('0x38'))){_0x3b5926[_0x15ea('0x1e')]=qs['limit'](_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x1e')]);_0x3b5926['offset']=qs[_0x15ea('0x1c')](_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x1c')]);}_0x3b5926[_0x15ea('0x39')]=qs[_0x15ea('0x3a')](_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x3a')]);_0x3b5926[_0x15ea('0x3b')]=qs[_0x15ea('0x33')](_[_0x15ea('0x3c')](_0x4de4f6[_0x15ea('0x31')],_0x5bd588['filters']),_0xdd3c94);if(_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x3d')]){_0x3b5926['where']=_[_0x15ea('0x3e')](_0x3b5926[_0x15ea('0x3b')],{'$or':_['map'](_0xdd3c94,function(_0x1f6f03){if(_0x1f6f03[_0x15ea('0x2c')]!=='VIRTUAL'){var _0x11f1e1={};_0x11f1e1[_0x1f6f03[_0x15ea('0x30')]]={'$like':'%'+_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x3d')]+'%'};return _0x11f1e1;}})});}_0x3b5926=_['merge']({},_0x3b5926,_0x4de4f6['options']);var _0x13cfa4={'where':_0x3b5926[_0x15ea('0x3b')]};return db[_0x15ea('0x3f')]['count'](_0x13cfa4)[_0x15ea('0x25')](function(_0x41d587){_0x2ec7a0[_0x15ea('0x1d')]=_0x41d587;if(_0x4de4f6[_0x15ea('0x31')][_0x15ea('0x40')]){_0x3b5926['include']=[{'all':!![]}];}return db[_0x15ea('0x3f')][_0x15ea('0x41')](_0x3b5926);})[_0x15ea('0x25')](function(_0x536eb1){_0x2ec7a0[_0x15ea('0x42')]=_0x536eb1;return _0x2ec7a0;})['then'](respondWithFilteredResult(_0x4b0899,_0x3b5926))[_0x15ea('0x43')](handleError(_0x4b0899,null));};exports[_0x15ea('0x44')]=function(_0x57284e,_0x3c9d08){var _0x35d501={'raw':!![],'where':{'id':_0x57284e[_0x15ea('0x45')]['id']}},_0x339a4b={};_0x339a4b['model']=_[_0x15ea('0x32')](db[_0x15ea('0x3f')]['rawAttributes']);_0x339a4b[_0x15ea('0x31')]=_['keys'](_0x57284e[_0x15ea('0x31')]);_0x339a4b['filters']=_['intersection'](_0x339a4b[_0x15ea('0x2e')],_0x339a4b[_0x15ea('0x31')]);_0x35d501['attributes']=_[_0x15ea('0x34')](_0x339a4b[_0x15ea('0x2e')],qs['fields'](_0x57284e[_0x15ea('0x31')][_0x15ea('0x35')]));_0x35d501[_0x15ea('0x36')]=_0x35d501[_0x15ea('0x36')]['length']?_0x35d501[_0x15ea('0x36')]:_0x339a4b[_0x15ea('0x2e')];if(_0x57284e[_0x15ea('0x31')][_0x15ea('0x40')]){_0x35d501['include']=[{'all':!![]}];}_0x35d501=_[_0x15ea('0x3e')]({},_0x35d501,_0x57284e[_0x15ea('0x46')]);return db[_0x15ea('0x3f')][_0x15ea('0x47')](_0x35d501)['then'](handleEntityNotFound(_0x3c9d08,null))[_0x15ea('0x25')](respondWithResult(_0x3c9d08,null))[_0x15ea('0x43')](handleError(_0x3c9d08,null));};exports[_0x15ea('0x48')]=function(_0x4677da,_0x3d8595){return db[_0x15ea('0x3f')][_0x15ea('0x48')](_0x4677da[_0x15ea('0x49')],{})[_0x15ea('0x25')](respondWithResult(_0x3d8595,0xc9))[_0x15ea('0x43')](handleError(_0x3d8595,null));};exports[_0x15ea('0x4a')]=function(_0x2b4eb7,_0x3a9200){if(_0x2b4eb7[_0x15ea('0x49')]['id']){delete _0x2b4eb7[_0x15ea('0x49')]['id'];}return db[_0x15ea('0x3f')][_0x15ea('0x47')]({'where':{'id':_0x2b4eb7[_0x15ea('0x45')]['id']}})[_0x15ea('0x25')](handleEntityNotFound(_0x3a9200,null))[_0x15ea('0x25')](saveUpdates(_0x2b4eb7[_0x15ea('0x49')],null))[_0x15ea('0x25')](respondWithResult(_0x3a9200,null))[_0x15ea('0x43')](handleError(_0x3a9200,null));};exports[_0x15ea('0x24')]=function(_0xc8e72b,_0x2a13ef){return db[_0x15ea('0x3f')][_0x15ea('0x47')]({'where':{'id':_0xc8e72b['params']['id']}})[_0x15ea('0x25')](handleEntityNotFound(_0x2a13ef,null))[_0x15ea('0x25')](removeEntity(_0x2a13ef,null))[_0x15ea('0x43')](handleError(_0x2a13ef,null));};exports[_0x15ea('0x4b')]=function(_0x5958c1,_0x322213){return db[_0x15ea('0x3f')][_0x15ea('0x4b')]()[_0x15ea('0x25')](respondWithResult(_0x322213,null))[_0x15ea('0x43')](handleError(_0x322213,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a021f8b..5b50921 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 _0x827e=['report_chat_transfer','lodash','api','moment','bluebird','request-promise','path','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x312bf4,_0x352f71){var _0x1a4303=function(_0x29a668){while(--_0x29a668){_0x312bf4['push'](_0x312bf4['shift']());}};_0x1a4303(++_0x352f71);}(_0x827e,0x1b9));var _0xe827=function(_0x2607a1,_0x3b7944){_0x2607a1=_0x2607a1-0x0;var _0x57c25e=_0x827e[_0x2607a1];return _0x57c25e;};'use strict';var _=require(_0xe827('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe827('0x1'));var moment=require(_0xe827('0x2'));var BPromise=require(_0xe827('0x3'));var rp=require(_0xe827('0x4'));var fs=require('fs');var path=require(_0xe827('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe827('0x6'));module[_0xe827('0x7')]=function(_0x5a3e66,_0x3851d9){return _0x5a3e66[_0xe827('0x8')](_0xe827('0x9'),attributes,{'tableName':_0xe827('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf83f=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xf83f,0x1b0));var _0xff83=function(_0x471562,_0x2818be){_0x471562=_0x471562-0x0;var _0x6d3b98=_0xf83f[_0x471562];return _0x6d3b98;};'use strict';var _=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var logger=require(_0xff83('0x2'))('api');var moment=require(_0xff83('0x3'));var BPromise=require(_0xff83('0x4'));var rp=require(_0xff83('0x5'));var fs=require('fs');var path=require(_0xff83('0x6'));var rimraf=require(_0xff83('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xff83('0x8')]=function(_0x35b14c,_0x2f3874){return _0x35b14c[_0xff83('0x9')](_0xff83('0xa'),attributes,{'tableName':_0xff83('0xb'),'paranoid':![],'indexes':[{'name':_0xff83('0xc'),'fields':[_0xff83('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1d2f294..471b944 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 _0x54eb=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','../../config/utils','rpc','../../config/environment'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x54eb,0x1a4));var _0xb54e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x54eb[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb54e('0x0'));var BPromise=require(_0xb54e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb54e('0x2'));var logger=require('../../config/logger')(_0xb54e('0x3'));var config=require(_0xb54e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb54e('0x5')][_0xb54e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e26ad,_0xc395d3,_0x4a91fc){return new BPromise(function(_0x34d4ce,_0x24360b){return client[_0xb54e('0x7')](_0x4e26ad,_0x4a91fc)[_0xb54e('0x8')](function(_0x1562db){logger[_0xb54e('0x9')](_0xb54e('0xa'),_0xc395d3,_0xb54e('0xb'));logger[_0xb54e('0xc')](_0xb54e('0xd'),_0xc395d3,_0xb54e('0xb'),JSON[_0xb54e('0xe')](_0x1562db));if(_0x1562db[_0xb54e('0xf')]){if(_0x1562db['error']['code']===0x1f4){logger[_0xb54e('0xf')](_0xb54e('0xa'),_0xc395d3,_0x1562db['error'][_0xb54e('0x10')]);return _0x24360b(_0x1562db[_0xb54e('0xf')][_0xb54e('0x10')]);}logger[_0xb54e('0xf')](_0xb54e('0xa'),_0xc395d3,_0x1562db['error'][_0xb54e('0x10')]);return _0x34d4ce(_0x1562db[_0xb54e('0xf')]['message']);}else{logger[_0xb54e('0x9')](_0xb54e('0xa'),_0xc395d3,_0xb54e('0xb'));_0x34d4ce(_0x1562db['result'][_0xb54e('0x10')]);}})['catch'](function(_0x15e95d){logger[_0xb54e('0xf')](_0xb54e('0xa'),_0xc395d3,_0x15e95d);_0x24360b(_0x15e95d);});});} \ No newline at end of file +var _0xe6c1=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3b9d37,_0xfcd761){var _0x50fd97=function(_0x2873b0){while(--_0x2873b0){_0x3b9d37['push'](_0x3b9d37['shift']());}};_0x50fd97(++_0xfcd761);}(_0xe6c1,0x1a4));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1e6c('0x0'));var util=require(_0x1e6c('0x1'));var moment=require('moment');var BPromise=require(_0x1e6c('0x2'));var rs=require(_0x1e6c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e6c('0x4'))['db'];var utils=require(_0x1e6c('0x5'));var logger=require('../../config/logger')(_0x1e6c('0x6'));var config=require(_0x1e6c('0x7'));var jayson=require(_0x1e6c('0x8'));var client=jayson['client'][_0x1e6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c9ba2,_0x36e958,_0x23b942){return new BPromise(function(_0x1b0212,_0x20c350){return client['request'](_0x2c9ba2,_0x23b942)[_0x1e6c('0xa')](function(_0x3a1a79){logger[_0x1e6c('0xb')](_0x1e6c('0xc'),_0x36e958,_0x1e6c('0xd'));logger['debug'](_0x1e6c('0xe'),_0x36e958,_0x1e6c('0xd'),JSON[_0x1e6c('0xf')](_0x3a1a79));if(_0x3a1a79[_0x1e6c('0x10')]){if(_0x3a1a79[_0x1e6c('0x10')][_0x1e6c('0x11')]===0x1f4){logger['error'](_0x1e6c('0xc'),_0x36e958,_0x3a1a79[_0x1e6c('0x10')][_0x1e6c('0x12')]);return _0x20c350(_0x3a1a79[_0x1e6c('0x10')][_0x1e6c('0x12')]);}logger[_0x1e6c('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x36e958,_0x3a1a79['error']['message']);return _0x1b0212(_0x3a1a79[_0x1e6c('0x10')][_0x1e6c('0x12')]);}else{logger[_0x1e6c('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x36e958,_0x1e6c('0xd'));_0x1b0212(_0x3a1a79[_0x1e6c('0x13')][_0x1e6c('0x12')]);}})[_0x1e6c('0x14')](function(_0xda7ed5){logger[_0x1e6c('0x10')](_0x1e6c('0xc'),_0x36e958,_0xda7ed5);_0x20c350(_0xda7ed5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 79c51c7..18a4cb1 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 _0xca11=['destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','put','update','delete'];(function(_0x5d035a,_0x150506){var _0x3a530f=function(_0x13c18d){while(--_0x13c18d){_0x5d035a['push'](_0x5d035a['shift']());}};_0x3a530f(++_0x150506);}(_0xca11,0x181));var _0x1ca1=function(_0x213ddd,_0x615a2){_0x213ddd=_0x213ddd-0x0;var _0x56522d=_0xca11[_0x213ddd];return _0x56522d;};'use strict';var multer=require(_0x1ca1('0x0'));var util=require(_0x1ca1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ca1('0x2'));var router=express[_0x1ca1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ca1('0x4'));var config=require(_0x1ca1('0x5'));var controller=require('./chatTransferReport.controller');router[_0x1ca1('0x6')]('/',auth[_0x1ca1('0x7')](),controller[_0x1ca1('0x8')]);router['get'](_0x1ca1('0x9'),auth[_0x1ca1('0x7')](),controller['describe']);router['get'](_0x1ca1('0xa'),auth[_0x1ca1('0x7')](),controller['show']);router[_0x1ca1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1ca1('0xc')](_0x1ca1('0xa'),auth[_0x1ca1('0x7')](),controller[_0x1ca1('0xd')]);router[_0x1ca1('0xe')](_0x1ca1('0xa'),auth['isAuthenticated'](),controller[_0x1ca1('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc282=['put','/:id','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','describe','show','post','create'];(function(_0x4f297e,_0x5b1e53){var _0x5deafe=function(_0x2092e1){while(--_0x2092e1){_0x4f297e['push'](_0x4f297e['shift']());}};_0x5deafe(++_0x5b1e53);}(_0xc282,0x8a));var _0x2c28=function(_0x55e53d,_0xd6c766){_0x55e53d=_0x55e53d-0x0;var _0x5af639=_0xc282[_0x55e53d];return _0x5af639;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2c28('0x0'));var express=require(_0x2c28('0x1'));var router=express[_0x2c28('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2c28('0x3'));var interaction=require(_0x2c28('0x4'));var config=require(_0x2c28('0x5'));var controller=require(_0x2c28('0x6'));router[_0x2c28('0x7')]('/',auth['isAuthenticated'](),controller[_0x2c28('0x8')]);router['get']('/describe',auth[_0x2c28('0x9')](),controller[_0x2c28('0xa')]);router[_0x2c28('0x7')]('/:id',auth[_0x2c28('0x9')](),controller[_0x2c28('0xb')]);router[_0x2c28('0xc')]('/',auth[_0x2c28('0x9')](),controller[_0x2c28('0xd')]);router[_0x2c28('0xe')](_0x2c28('0xf'),auth['isAuthenticated'](),controller[_0x2c28('0x10')]);router[_0x2c28('0x11')](_0x2c28('0xf'),auth['isAuthenticated'](),controller[_0x2c28('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 57ed198..d42d447 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 _0xedd9=['mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3ae34a,_0x143082){var _0x4c9edc=function(_0x2796c8){while(--_0x2796c8){_0x3ae34a['push'](_0x3ae34a['shift']());}};_0x4c9edc(++_0x143082);}(_0xedd9,0xfc));var _0x9edd=function(_0x557678,_0x4a69bd){_0x557678=_0x557678-0x0;var _0x4cc5fc=_0xedd9[_0x557678];return _0x4cc5fc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'name':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'unique':_0x9edd('0x3')},'description':{'type':Sequelize[_0x9edd('0x2')]},'mapKey':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x4')},'key':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9edd('0x2')]},'animation':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9edd('0x9'),_0x9edd('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xb')},'start_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xc')},'offline_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'header_offline':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9edd('0x11')]},'closingQuestion':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x13')},'noteTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x14')},'closingMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x9edd('0x16'),_0x9edd('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x9edd('0x1a'),'required':!![]},'props':{'title':_0x9edd('0x1b'),'helpText':''}},{'type':_0x9edd('0x19'),'props':{'title':_0x9edd('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9edd('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x1d'))?JSON[_0x9edd('0x1e')](this[_0x9edd('0x1c')](_0x9edd('0x1d'))):{};},'set':function(_0x4d507f){return this['setDataValue'](_0x9edd('0x1d'),JSON[_0x9edd('0x18')](_0x4d507f));}},'offlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9edd('0x4')},'variable':null},{'type':_0x9edd('0x1f'),'config':{'placeholder':_0x9edd('0x20')},'props':{'title':'Comments','helpText':_0x9edd('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x22'))?JSON[_0x9edd('0x1e')](this['getDataValue'](_0x9edd('0x22'))):{};},'set':function(_0x3fb556){return this[_0x9edd('0x23')](_0x9edd('0x22'),JSON[_0x9edd('0x18')](_0x3fb556));}},'token':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return rs[_0x9edd('0x24')]();}},'autoclose':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9edd('0x2')]},'forwardOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9edd('0x2')]},'waitingTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x29')},'skipUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'sendUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9edd('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9edd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2b')},'messagesAlignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2c')},'defaultTitle':{'type':Sequelize[_0x9edd('0x2')]},'customerAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2d')},'systemAvatar':{'type':Sequelize[_0x9edd('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9edd('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![],'comment':_0x9edd('0x2f'),'set':function(_0x48958a){if(!_0x48958a)this[_0x9edd('0x23')]('mandatoryDispositionPauseId',null);this[_0x9edd('0x23')](_0x9edd('0x30'),_0x48958a);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9edd('0x2')]},'vidaooTopic':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x31')},'vidaooNote':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9edd('0x11')]}}; \ No newline at end of file +var _0x17ba=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','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}}','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x1c6865,_0x56ba7a){var _0x4a6290=function(_0x2806ac){while(--_0x2806ac){_0x1c6865['push'](_0x1c6865['shift']());}};_0x4a6290(++_0x56ba7a);}(_0x17ba,0xab));var _0xa17b=function(_0x332644,_0x33ff4){_0x332644=_0x332644-0x0;var _0x4eeb34=_0x17ba[_0x332644];return _0x4eeb34;};'use strict';var Sequelize=require(_0xa17b('0x0'));var rs=require(_0xa17b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'unique':_0xa17b('0x3')},'description':{'type':Sequelize[_0xa17b('0x2')]},'mapKey':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'key':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x5')},'customerAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa17b('0x2')]},'animation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0xb'),_0xa17b('0xc')),'defaultValue':_0xa17b('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xd')},'start_chat_button':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'header_offline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x10')},'download_transcript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa17b('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'skipMessageButton':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'conditionAgreement':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x16')},'ratingType':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0x17'),'thumb'),'defaultValue':_0xa17b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':function(){return JSON[_0xa17b('0x18')]({'items':[{'type':_0xa17b('0x19'),'variable':null,'config':{'placeholder':_0xa17b('0x1a'),'type':'text','required':!![]},'props':{'title':_0xa17b('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xa17b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xa17b('0x1b'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x1b'))):{};},'set':function(_0x3c32a5){return this[_0xa17b('0x1e')]('onlineForm',JSON['stringify'](_0x3c32a5));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa17b('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null},{'type':_0xa17b('0x1f'),'config':{'placeholder':_0xa17b('0x20')},'props':{'title':_0xa17b('0x20'),'helpText':_0xa17b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xa17b('0x1d')](_0xa17b('0x22'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x22'))):{};},'set':function(_0x2dc1f2){return this[_0xa17b('0x1e')]('offlineForm',JSON['stringify'](_0x2dc1f2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa17b('0x23')]();}},'autoclose':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa17b('0x2')]},'forwardOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa17b('0x2')]},'waitingTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x24')},'offlineMessageBody':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'sendUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa17b('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa17b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa17b('0x26');}},'notificationSound':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x27')},'verticalAlignment':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa17b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x28')},'systemAvatar':{'type':Sequelize[_0xa17b('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0x8')],'comment':_0xa17b('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x468c92){if(!_0x468c92)this[_0xa17b('0x1e')]('mandatoryDispositionPauseId',null);this[_0xa17b('0x1e')](_0xa17b('0x2a'),_0x468c92);}},'vidaooEscalation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa17b('0x2')]},'vidaooTopic':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x2b')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xa17b('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6d9b875..4313466 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 _0xd2c7=['interaction','contact','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','originalname','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','push','some','origin','remote','x-real-ip','remoteAddress','referer','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','onlineForm','items','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','CannedAnswer','removeAnswers','ids','addLogo','file','filename','addAvatar','agentAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','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','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','headers','user-agent','getResult','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','browser','version','format','unknown','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','ContactId'];(function(_0x26926c,_0x69b67){var _0x4dfaa6=function(_0x26ff0f){while(--_0x26ff0f){_0x26926c['push'](_0x26926c['shift']());}};_0x4dfaa6(++_0x69b67);}(_0xd2c7,0x1a9));var _0x7d2c=function(_0x4b41e0,_0x42bd44){_0x4b41e0=_0x4b41e0-0x0;var _0x287650=_0xd2c7[_0x4b41e0];return _0x287650;};'use strict';var BPromise=require(_0x7d2c('0x0'));var Mustache=require(_0x7d2c('0x1'));var util=require('util');var path=require(_0x7d2c('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d2c('0x3'));var _=require(_0x7d2c('0x4'));var querystring=require(_0x7d2c('0x5'));var Redis=require(_0x7d2c('0x6'));var qs=require(_0x7d2c('0x7'));var logger=require(_0x7d2c('0x8'))(_0x7d2c('0x9'));var config=require(_0x7d2c('0xa'));var url=require(_0x7d2c('0xb'));var db=require(_0x7d2c('0xc'))['db'];config['redis']=_[_0x7d2c('0xd')](config[_0x7d2c('0xe')],{'host':_0x7d2c('0xf'),'port':0x18eb});var socket=require(_0x7d2c('0x10'))(new Redis(config[_0x7d2c('0xe')]));require(_0x7d2c('0x11'))['register'](socket);var htmlToText=require(_0x7d2c('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x7d2c('0x13')][_0x7d2c('0x14')]({'port':0x232c});var client9002=jayson[_0x7d2c('0x13')][_0x7d2c('0x14')]({'port':0x232a});var client9003=jayson[_0x7d2c('0x13')]['http']({'port':0x232b});var client9001=jayson[_0x7d2c('0x13')][_0x7d2c('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x8b9e0b,_0x55467e,_0x23a78d,_0x595d4b){return new BPromise(function(_0xcb04c,_0x13915d){var _0x132665=_0x595d4b||client;return _0x132665[_0x7d2c('0x15')](_0x8b9e0b,_0x23a78d)[_0x7d2c('0x16')](function(_0x57c5fd){logger[_0x7d2c('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x55467e,'request\x20sent');logger[_0x7d2c('0x18')](_0x7d2c('0x19'),_0x55467e,_0x7d2c('0x1a'),JSON[_0x7d2c('0x1b')](_0x57c5fd));if(_0x57c5fd[_0x7d2c('0x1c')]){if(_0x57c5fd[_0x7d2c('0x1c')][_0x7d2c('0x1d')]===0x1f4){logger[_0x7d2c('0x1c')](_0x7d2c('0x1e'),_0x55467e,_0x57c5fd[_0x7d2c('0x1c')][_0x7d2c('0x1f')]);return _0x13915d(_0x57c5fd[_0x7d2c('0x1c')]['message']);}logger[_0x7d2c('0x1c')](_0x7d2c('0x1e'),_0x55467e,_0x57c5fd[_0x7d2c('0x1c')]['message']);return _0xcb04c(_0x57c5fd[_0x7d2c('0x1c')][_0x7d2c('0x1f')]);}else{logger['info'](_0x7d2c('0x1e'),_0x55467e,_0x7d2c('0x1a'));_0xcb04c(_0x57c5fd['result'][_0x7d2c('0x1f')]);}})[_0x7d2c('0x20')](function(_0x4ef1e7){logger[_0x7d2c('0x1c')](_0x7d2c('0x1e'),_0x55467e,_0x4ef1e7);_0x13915d(_0x4ef1e7);});});}function respondWithStatusCode(_0x3ac73b,_0x5de332){_0x5de332=_0x5de332||0xcc;return function(_0x57a781){if(_0x57a781){return _0x3ac73b[_0x7d2c('0x21')](_0x5de332);}return _0x3ac73b[_0x7d2c('0x22')](_0x5de332)[_0x7d2c('0x23')]();};}function respondWithResult(_0x366db7,_0x36e57b){_0x36e57b=_0x36e57b||0xc8;return function(_0x4f737a){if(_0x4f737a){return _0x366db7[_0x7d2c('0x22')](_0x36e57b)[_0x7d2c('0x24')](_0x4f737a);}};}function respondWithFilteredResult(_0x37d36d,_0x11dd23){return function(_0x3d6c51){if(_0x3d6c51){var _0x211ff3=typeof _0x11dd23[_0x7d2c('0x25')]==='undefined'&&typeof _0x11dd23[_0x7d2c('0x26')]===_0x7d2c('0x27');var _0x1231e1=_0x3d6c51[_0x7d2c('0x28')];var _0x3a5d0a=_0x211ff3?0x0:_0x11dd23[_0x7d2c('0x25')];var _0x4aa2a2=_0x211ff3?_0x3d6c51['count']:_0x11dd23[_0x7d2c('0x25')]+_0x11dd23[_0x7d2c('0x26')];var _0x4354da;if(_0x4aa2a2>=_0x1231e1){_0x4aa2a2=_0x1231e1;_0x4354da=0xc8;}else{_0x4354da=0xce;}_0x37d36d[_0x7d2c('0x22')](_0x4354da);return _0x37d36d[_0x7d2c('0x29')](_0x7d2c('0x2a'),_0x3a5d0a+'-'+_0x4aa2a2+'/'+_0x1231e1)[_0x7d2c('0x24')](_0x3d6c51);}return null;};}function saveUpdates(_0x56a7b4){return function(_0x5c04fb){if(_0x5c04fb){return _0x5c04fb[_0x7d2c('0x2b')](_0x56a7b4)[_0x7d2c('0x16')](function(_0x55d753){return _0x55d753;});}return null;};}function removeEntity(_0x591837){return function(_0x5db431){if(_0x5db431){return _0x5db431[_0x7d2c('0x2c')]()[_0x7d2c('0x16')](function(){var _0x516c4b=_0x5db431[_0x7d2c('0x2d')]({'plain':!![]});var _0x4ff1c4=_0x7d2c('0x2e');return db[_0x7d2c('0x2f')][_0x7d2c('0x2c')]({'where':{'type':_0x4ff1c4,'resourceId':_0x516c4b['id']}})[_0x7d2c('0x16')](function(){return _0x5db431;});})['then'](function(){_0x591837[_0x7d2c('0x22')](0xcc)[_0x7d2c('0x23')]();});}};}function handleEntityNotFound(_0x8a2bdb){return function(_0x39656e){if(!_0x39656e){_0x8a2bdb[_0x7d2c('0x21')](0x194);}return _0x39656e;};}function handleError(_0x51ca19,_0x397e50){_0x397e50=_0x397e50||0x1f4;return function(_0x437ed0){logger[_0x7d2c('0x1c')](_0x437ed0[_0x7d2c('0x30')]);if(_0x437ed0[_0x7d2c('0x31')]){delete _0x437ed0[_0x7d2c('0x31')];}_0x51ca19[_0x7d2c('0x22')](_0x397e50)['send'](_0x437ed0);};}exports[_0x7d2c('0x32')]=function(_0x940891,_0x5aad33){var _0x50884d={'include':[{'model':db[_0x7d2c('0x33')],'as':_0x7d2c('0x34')}]},_0x5c70a5={},_0x1a3880={'count':0x0,'rows':[]};var _0x4ae15a=_[_0x7d2c('0x35')](db[_0x7d2c('0x36')]['rawAttributes'],function(_0x1d6011){return{'name':_0x1d6011[_0x7d2c('0x37')],'type':_0x1d6011[_0x7d2c('0x38')][_0x7d2c('0x39')]};});_0x5c70a5[_0x7d2c('0x3a')]=_['map'](_0x4ae15a,_0x7d2c('0x31'));_0x5c70a5[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x940891[_0x7d2c('0x3b')]);_0x5c70a5[_0x7d2c('0x3d')]=_[_0x7d2c('0x3e')](_0x5c70a5[_0x7d2c('0x3a')],_0x5c70a5[_0x7d2c('0x3b')]);_0x50884d[_0x7d2c('0x3f')]=_[_0x7d2c('0x3e')](_0x5c70a5[_0x7d2c('0x3a')],qs[_0x7d2c('0x40')](_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x50884d[_0x7d2c('0x3f')]=_0x50884d[_0x7d2c('0x3f')][_0x7d2c('0x41')]?_0x50884d[_0x7d2c('0x3f')]:_0x5c70a5[_0x7d2c('0x3a')];if(!_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x42')](_0x7d2c('0x43'))){_0x50884d['limit']=qs[_0x7d2c('0x26')](_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x26')]);_0x50884d[_0x7d2c('0x25')]=qs[_0x7d2c('0x25')](_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x25')]);}_0x50884d[_0x7d2c('0x44')]=qs[_0x7d2c('0x45')](_0x940891[_0x7d2c('0x3b')]['sort']);_0x50884d['where']=qs[_0x7d2c('0x3d')](_[_0x7d2c('0x46')](_0x940891['query'],_0x5c70a5[_0x7d2c('0x3d')]),_0x4ae15a);if(_0x940891[_0x7d2c('0x3b')]['filter']){_0x50884d[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x50884d['where'],{'$or':_[_0x7d2c('0x35')](_0x4ae15a,function(_0x364a2d){if(_0x364a2d[_0x7d2c('0x38')]!==_0x7d2c('0x49')){var _0x32f896={};_0x32f896[_0x364a2d[_0x7d2c('0x31')]]={'$like':'%'+_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x4a')]+'%'};return _0x32f896;}})});}_0x50884d=_[_0x7d2c('0x48')]({},_0x50884d,_0x940891[_0x7d2c('0x4b')]);var _0x16db29={'where':_0x50884d[_0x7d2c('0x47')]};return db['ChatWebsite'][_0x7d2c('0x28')](_0x16db29)['then'](function(_0xdb864d){_0x1a3880[_0x7d2c('0x28')]=_0xdb864d;if(_0x940891[_0x7d2c('0x3b')][_0x7d2c('0x4c')]){_0x50884d[_0x7d2c('0x4d')]=[{'all':!![]}];}return db[_0x7d2c('0x36')]['findAll'](_0x50884d);})[_0x7d2c('0x16')](function(_0x302cf8){_0x1a3880[_0x7d2c('0x4e')]=_0x302cf8;return _0x1a3880;})[_0x7d2c('0x16')](respondWithFilteredResult(_0x5aad33,_0x50884d))[_0x7d2c('0x20')](handleError(_0x5aad33,null));};exports['show']=function(_0x29f418,_0x5921c4){var _0x5f138d={'raw':![],'where':{'id':_0x29f418[_0x7d2c('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0x7d2c('0x34')}]},_0x2aab87={};_0x2aab87[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db[_0x7d2c('0x36')][_0x7d2c('0x50')]);_0x2aab87[_0x7d2c('0x3b')]=_['keys'](_0x29f418[_0x7d2c('0x3b')]);_0x2aab87[_0x7d2c('0x3d')]=_[_0x7d2c('0x3e')](_0x2aab87['model'],_0x2aab87[_0x7d2c('0x3b')]);_0x5f138d[_0x7d2c('0x3f')]=_['intersection'](_0x2aab87[_0x7d2c('0x3a')],qs[_0x7d2c('0x40')](_0x29f418[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x5f138d['attributes']=_0x5f138d[_0x7d2c('0x3f')][_0x7d2c('0x41')]?_0x5f138d[_0x7d2c('0x3f')]:_0x2aab87[_0x7d2c('0x3a')];if(_0x29f418[_0x7d2c('0x3b')][_0x7d2c('0x4c')]){_0x5f138d[_0x7d2c('0x4d')]=[{'all':!![]}];}_0x5f138d=_[_0x7d2c('0x48')]({},_0x5f138d,_0x29f418[_0x7d2c('0x4b')]);return db[_0x7d2c('0x36')]['find'](_0x5f138d)[_0x7d2c('0x16')](handleEntityNotFound(_0x5921c4,null))[_0x7d2c('0x16')](respondWithResult(_0x5921c4,null))[_0x7d2c('0x20')](handleError(_0x5921c4,null));};exports[_0x7d2c('0x51')]=function(_0x451775,_0x2f8ff2){return db[_0x7d2c('0x36')][_0x7d2c('0x51')](_0x451775[_0x7d2c('0x52')],{})[_0x7d2c('0x16')](function(_0x3f8d50){var _0x2f75bf=_0x451775['user']['get']({'plain':!![]});if(!_0x2f75bf)throw new Error(_0x7d2c('0x53'));if(_0x2f75bf['role']==='user'){var _0x546038=_0x3f8d50[_0x7d2c('0x2d')]({'plain':!![]});var _0x3898d3=_0x7d2c('0x2e');return db[_0x7d2c('0x54')][_0x7d2c('0x55')]({'where':{'name':_0x3898d3,'userProfileId':_0x2f75bf[_0x7d2c('0x56')]},'raw':!![]})['then'](function(_0x3e8c26){if(_0x3e8c26&&_0x3e8c26[_0x7d2c('0x57')]===0x0){return db[_0x7d2c('0x2f')][_0x7d2c('0x51')]({'name':_0x546038['name'],'resourceId':_0x546038['id'],'type':_0x3e8c26[_0x7d2c('0x31')],'sectionId':_0x3e8c26['id']},{})[_0x7d2c('0x16')](function(){return _0x3f8d50;});}else{return _0x3f8d50;}})['catch'](function(_0x3c1c2e){logger['error'](_0x7d2c('0x58'),_0x3c1c2e);throw _0x3c1c2e;});}return _0x3f8d50;})['then'](respondWithResult(_0x2f8ff2,0xc9))[_0x7d2c('0x20')](handleError(_0x2f8ff2,null));};exports['update']=function(_0xfb3824,_0x8071ba){if(_0xfb3824['body']['id']){delete _0xfb3824[_0x7d2c('0x52')]['id'];}return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0xfb3824['params']['id']},'include':[{'model':db['Pause'],'as':_0x7d2c('0x34')}]})[_0x7d2c('0x16')](handleEntityNotFound(_0x8071ba,null))[_0x7d2c('0x16')](saveUpdates(_0xfb3824[_0x7d2c('0x52')],null))[_0x7d2c('0x16')](respondWithResult(_0x8071ba,null))['catch'](handleError(_0x8071ba,null));};exports['destroy']=function(_0x23fadf,_0x1c3f7f){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x23fadf[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x1c3f7f,null))[_0x7d2c('0x16')](removeEntity(_0x1c3f7f,null))[_0x7d2c('0x20')](handleError(_0x1c3f7f,null));};exports[_0x7d2c('0x59')]=function(_0x36f112,_0x4d642a){return db['ChatWebsite']['describe']()[_0x7d2c('0x16')](respondWithResult(_0x4d642a,null))['catch'](handleError(_0x4d642a,null));};exports[_0x7d2c('0x5a')]=function(_0x36831c,_0x153a9d){if(_0x36831c[_0x7d2c('0x52')]['id']){delete _0x36831c[_0x7d2c('0x52')]['id'];}return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x36831c[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x153a9d,null))['then'](function(_0x430ee0){if(_0x430ee0){_0x36831c['body'][_0x7d2c('0x5b')]=_0x430ee0['id'];return db[_0x7d2c('0x5c')][_0x7d2c('0x51')](_0x36831c['body']);}})['then'](respondWithResult(_0x153a9d,null))[_0x7d2c('0x20')](handleError(_0x153a9d,null));};exports[_0x7d2c('0x5d')]=function(_0x4ef945,_0xbc5150){var _0x11a2d6={'raw':![],'where':{}};var _0x2098d9={};var _0x36c51f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7d2c('0x5e')]({'where':{'id':_0x4ef945[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0xbc5150,null))[_0x7d2c('0x16')](function(_0x29a627){if(_0x29a627){_0x2098d9[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db['Disposition']['rawAttributes']);_0x2098d9['query']=_[_0x7d2c('0x3c')](_0x4ef945[_0x7d2c('0x3b')]);_0x2098d9[_0x7d2c('0x3d')]=_['intersection'](_0x2098d9[_0x7d2c('0x3a')],_0x2098d9[_0x7d2c('0x3b')]);_0x11a2d6['attributes']=_[_0x7d2c('0x3e')](_0x2098d9[_0x7d2c('0x3a')],qs['fields'](_0x4ef945[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x11a2d6[_0x7d2c('0x3f')]=_0x11a2d6[_0x7d2c('0x3f')][_0x7d2c('0x41')]?_0x11a2d6[_0x7d2c('0x3f')]:_0x2098d9[_0x7d2c('0x3a')];if(!_0x4ef945[_0x7d2c('0x3b')]['hasOwnProperty'](_0x7d2c('0x43'))){_0x11a2d6[_0x7d2c('0x26')]=qs[_0x7d2c('0x26')](_0x4ef945[_0x7d2c('0x3b')]['limit']);_0x11a2d6['offset']=qs[_0x7d2c('0x25')](_0x4ef945['query'][_0x7d2c('0x25')]);}_0x11a2d6[_0x7d2c('0x44')]=qs['sort'](_0x4ef945[_0x7d2c('0x3b')]['sort']);_0x11a2d6['where']=qs[_0x7d2c('0x3d')](_[_0x7d2c('0x46')](_0x4ef945['query'],_0x2098d9['filters']));_0x11a2d6[_0x7d2c('0x47')][_0x7d2c('0x5b')]=_0x29a627['id'];if(_0x4ef945['query'][_0x7d2c('0x4a')]){_0x11a2d6[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x11a2d6[_0x7d2c('0x47')],{'$or':_['map'](_0x11a2d6[_0x7d2c('0x3f')],function(_0x582a89){var _0x31d3d3={};_0x31d3d3[_0x582a89]={'$like':'%'+_0x4ef945['query']['filter']+'%'};return _0x31d3d3;})});}_0x11a2d6=_[_0x7d2c('0x48')]({},_0x11a2d6,_0x4ef945['options']);return db[_0x7d2c('0x5c')][_0x7d2c('0x28')]({'where':_0x11a2d6['where']})[_0x7d2c('0x16')](function(_0x5432da){_0x36c51f[_0x7d2c('0x28')]=_0x5432da;if(_0x4ef945[_0x7d2c('0x3b')][_0x7d2c('0x4c')]){_0x11a2d6[_0x7d2c('0x4d')]=[{'all':!![]}];}return db[_0x7d2c('0x5c')][_0x7d2c('0x5f')](_0x11a2d6);})[_0x7d2c('0x16')](function(_0x5e8803){_0x36c51f['rows']=_0x5e8803;return _0x36c51f;});}})['then'](respondWithFilteredResult(_0xbc5150,_0x11a2d6))['catch'](handleError(_0xbc5150,null));};exports['removeDispositions']=function(_0x1bf00c,_0x374a6f){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x1bf00c[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x374a6f,null))[_0x7d2c('0x16')](function(_0xc86c04){if(_0xc86c04){return _0xc86c04[_0x7d2c('0x60')](_0x1bf00c[_0x7d2c('0x3b')]['ids']);}})[_0x7d2c('0x16')](respondWithStatusCode(_0x374a6f,null))[_0x7d2c('0x20')](handleError(_0x374a6f,null));};exports['addAnswer']=function(_0x6e819b,_0x5c8cfa){if(_0x6e819b['body']['id']){delete _0x6e819b[_0x7d2c('0x52')]['id'];}return db['ChatWebsite'][_0x7d2c('0x55')]({'where':{'id':_0x6e819b[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x5c8cfa,null))['then'](function(_0x3f7b8d){if(_0x3f7b8d){_0x6e819b[_0x7d2c('0x52')][_0x7d2c('0x5b')]=_0x3f7b8d['id'];return db[_0x7d2c('0x61')][_0x7d2c('0x51')](_0x6e819b[_0x7d2c('0x52')]);}})[_0x7d2c('0x16')](respondWithResult(_0x5c8cfa,null))['catch'](handleError(_0x5c8cfa,null));};exports['getAnswers']=function(_0x4d8be7,_0x17899c){var _0x357b07={'raw':![],'where':{}};var _0x2dd700={};var _0x2d22c5={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7d2c('0x5e')]({'where':{'id':_0x4d8be7[_0x7d2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17899c,null))[_0x7d2c('0x16')](function(_0x38c178){if(_0x38c178){_0x2dd700[_0x7d2c('0x3a')]=_['keys'](db[_0x7d2c('0x61')]['rawAttributes']);_0x2dd700[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x4d8be7[_0x7d2c('0x3b')]);_0x2dd700[_0x7d2c('0x3d')]=_[_0x7d2c('0x3e')](_0x2dd700[_0x7d2c('0x3a')],_0x2dd700['query']);_0x357b07['attributes']=_['intersection'](_0x2dd700[_0x7d2c('0x3a')],qs[_0x7d2c('0x40')](_0x4d8be7['query'][_0x7d2c('0x40')]));_0x357b07['attributes']=_0x357b07['attributes'][_0x7d2c('0x41')]?_0x357b07[_0x7d2c('0x3f')]:_0x2dd700['model'];if(!_0x4d8be7[_0x7d2c('0x3b')][_0x7d2c('0x42')](_0x7d2c('0x43'))){_0x357b07[_0x7d2c('0x26')]=qs[_0x7d2c('0x26')](_0x4d8be7[_0x7d2c('0x3b')][_0x7d2c('0x26')]);_0x357b07[_0x7d2c('0x25')]=qs[_0x7d2c('0x25')](_0x4d8be7[_0x7d2c('0x3b')][_0x7d2c('0x25')]);}_0x357b07[_0x7d2c('0x44')]=qs[_0x7d2c('0x45')](_0x4d8be7['query']['sort']);_0x357b07[_0x7d2c('0x47')]=qs[_0x7d2c('0x3d')](_[_0x7d2c('0x46')](_0x4d8be7['query'],_0x2dd700[_0x7d2c('0x3d')]));_0x357b07['where'][_0x7d2c('0x5b')]=_0x38c178['id'];if(_0x4d8be7[_0x7d2c('0x3b')][_0x7d2c('0x4a')]){_0x357b07[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x357b07[_0x7d2c('0x47')],{'$or':_[_0x7d2c('0x35')](_0x357b07[_0x7d2c('0x3f')],function(_0x46ff05){var _0x1f4b7f={};_0x1f4b7f[_0x46ff05]={'$like':'%'+_0x4d8be7['query']['filter']+'%'};return _0x1f4b7f;})});}_0x357b07=_[_0x7d2c('0x48')]({},_0x357b07,_0x4d8be7[_0x7d2c('0x4b')]);return db[_0x7d2c('0x61')][_0x7d2c('0x28')]({'where':_0x357b07['where']})['then'](function(_0x46c9b2){_0x2d22c5['count']=_0x46c9b2;if(_0x4d8be7[_0x7d2c('0x3b')][_0x7d2c('0x4c')]){_0x357b07['include']=[{'all':!![]}];}return db[_0x7d2c('0x61')]['findAll'](_0x357b07);})[_0x7d2c('0x16')](function(_0x101f46){_0x2d22c5[_0x7d2c('0x4e')]=_0x101f46;return _0x2d22c5;});}})[_0x7d2c('0x16')](respondWithFilteredResult(_0x17899c,_0x357b07))['catch'](handleError(_0x17899c,null));};exports[_0x7d2c('0x62')]=function(_0x8c573b,_0x57ef0c){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x8c573b[_0x7d2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57ef0c,null))[_0x7d2c('0x16')](function(_0xb207af){if(_0xb207af){return _0xb207af['removeAnswers'](_0x8c573b[_0x7d2c('0x3b')][_0x7d2c('0x63')]);}})[_0x7d2c('0x16')](respondWithStatusCode(_0x57ef0c,null))['catch'](handleError(_0x57ef0c,null));};exports[_0x7d2c('0x64')]=function(_0xdb9b47,_0x11efa4){_0xdb9b47['body']['sitepic']=_0xdb9b47[_0x7d2c('0x65')][_0x7d2c('0x66')];return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0xdb9b47[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x11efa4,null))[_0x7d2c('0x16')](saveUpdates(_0xdb9b47['body'],null))[_0x7d2c('0x16')](respondWithResult(_0x11efa4,null))['catch'](handleError(_0x11efa4,null));};exports[_0x7d2c('0x67')]=function(_0x3498ae,_0x1e63ac){_0x3498ae[_0x7d2c('0x52')][_0x7d2c('0x68')]=_0x3498ae['file'][_0x7d2c('0x66')];return db['ChatWebsite'][_0x7d2c('0x55')]({'where':{'id':_0x3498ae[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x1e63ac,null))[_0x7d2c('0x16')](saveUpdates(_0x3498ae[_0x7d2c('0x52')],null))['then'](respondWithResult(_0x1e63ac,null))[_0x7d2c('0x20')](handleError(_0x1e63ac,null));};exports['addCustomerAvatar']=function(_0x3ac4cf,_0x429583){_0x3ac4cf[_0x7d2c('0x52')]['customerAvatar']=_0x3ac4cf[_0x7d2c('0x65')][_0x7d2c('0x66')];return db[_0x7d2c('0x36')]['find']({'where':{'id':_0x3ac4cf[_0x7d2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x429583,null))[_0x7d2c('0x16')](saveUpdates(_0x3ac4cf[_0x7d2c('0x52')],null))[_0x7d2c('0x16')](respondWithResult(_0x429583,null))[_0x7d2c('0x20')](handleError(_0x429583,null));};exports[_0x7d2c('0x69')]=function(_0x1e1ee7,_0x215035){_0x1e1ee7[_0x7d2c('0x52')]['systemAvatar']=_0x1e1ee7[_0x7d2c('0x65')][_0x7d2c('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x1e1ee7['params']['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x215035,null))[_0x7d2c('0x16')](saveUpdates(_0x1e1ee7[_0x7d2c('0x52')],null))[_0x7d2c('0x16')](respondWithResult(_0x215035,null))[_0x7d2c('0x20')](handleError(_0x215035,null));};exports[_0x7d2c('0x6a')]=function(_0x3d931c,_0x4b6155){var _0x241d3d=path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x6d'));var _0x1dfa11={'where':{'id':_0x3d931c[_0x7d2c('0x4f')]['id']},'attributes':['id',_0x7d2c('0x6e')],'raw':!![]};var _0x39050f=![];return require(_0x7d2c('0x6f'))[_0x7d2c('0x70')]()['then'](function(_0x141808){if(_0x141808){_0x39050f=_0x141808['custom'];}})[_0x7d2c('0x16')](function(){return db[_0x7d2c('0x36')][_0x7d2c('0x55')](_0x1dfa11);})[_0x7d2c('0x16')](handleEntityNotFound(_0x4b6155,null))[_0x7d2c('0x16')](function(_0x5e1424){if(_0x5e1424){if(!_[_0x7d2c('0x71')](_0x5e1424[_0x7d2c('0x6e')])){if(fs['existsSync'](path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],'server/files/images/logos/',_0x5e1424[_0x7d2c('0x6e')]))&&_0x39050f){_0x241d3d=path['join'](config['root'],_0x7d2c('0x72'),_0x5e1424['sitepic']);}}return _0x4b6155[_0x7d2c('0x73')](_0x241d3d);}})['catch'](handleError(_0x4b6155,null));};exports[_0x7d2c('0x74')]=function(_0x3a1811,_0x17d6ec){var _0x3fc299=path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x75'));var _0x384b00={'where':{'id':_0x3a1811['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x7d2c('0x36')][_0x7d2c('0x55')](_0x384b00)['then'](handleEntityNotFound(_0x17d6ec,null))[_0x7d2c('0x16')](function(_0x119c6b){if(_0x119c6b){if(!_[_0x7d2c('0x71')](_0x119c6b['agentAvatar'])){if(fs['existsSync'](path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x76'),_0x119c6b['agentAvatar']))){_0x3fc299=path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x76'),_0x119c6b[_0x7d2c('0x68')]);}}return _0x17d6ec[_0x7d2c('0x73')](_0x3fc299);}})[_0x7d2c('0x20')](handleError(_0x17d6ec,null));};exports[_0x7d2c('0x77')]=function(_0x189aab,_0x1d387a){var _0x1a2239=path['join'](config[_0x7d2c('0x6c')],_0x7d2c('0x78'));var _0x2ef853={'where':{'id':_0x189aab[_0x7d2c('0x4f')]['id']},'attributes':['id',_0x7d2c('0x79'),_0x7d2c('0x7a')],'raw':!![]};return db[_0x7d2c('0x36')][_0x7d2c('0x55')](_0x2ef853)[_0x7d2c('0x16')](handleEntityNotFound(_0x1d387a,null))['then'](function(_0x3197bc){if(_0x3197bc){if(!_[_0x7d2c('0x71')](_0x3197bc[_0x7d2c('0x79')])){if(fs[_0x7d2c('0x7b')](path['join'](config['root'],'server/files/images/avatars/',_0x3197bc[_0x7d2c('0x79')]))&&_0x3197bc[_0x7d2c('0x7a')]){_0x1a2239=path[_0x7d2c('0x6b')](config['root'],'server/files/images/avatars/',_0x3197bc[_0x7d2c('0x79')]);}}return _0x1d387a[_0x7d2c('0x73')](_0x1a2239);}})['catch'](handleError(_0x1d387a,null));};exports[_0x7d2c('0x7c')]=function(_0x517ba0,_0x5b8b97){var _0x3c017d=path[_0x7d2c('0x6b')](config['root'],_0x7d2c('0x7d'));var _0x341fad={'where':{'id':_0x517ba0[_0x7d2c('0x4f')]['id']},'attributes':['id',_0x7d2c('0x7e')],'raw':!![]};return db[_0x7d2c('0x36')]['find'](_0x341fad)[_0x7d2c('0x16')](handleEntityNotFound(_0x5b8b97,null))[_0x7d2c('0x16')](function(_0x1803bb){if(_0x1803bb){if(!_[_0x7d2c('0x71')](_0x1803bb[_0x7d2c('0x7e')])){if(fs[_0x7d2c('0x7b')](path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x76'),_0x1803bb[_0x7d2c('0x7e')]))){_0x3c017d=path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],_0x7d2c('0x76'),_0x1803bb['systemAvatar']);}}return _0x5b8b97[_0x7d2c('0x73')](_0x3c017d);}})[_0x7d2c('0x20')](handleError(_0x5b8b97,null));};exports['notify']=function(_0x3e434f,_0x1d8495){var _0x4ea334=require(_0x7d2c('0x7f'));var _0x1dc554=new _0x4ea334();var _0x3e1891=_0x1dc554['setUA'](_0x3e434f[_0x7d2c('0x80')][_0x7d2c('0x81')])[_0x7d2c('0x82')]();var _0x262cc5={'body':_0x3e434f[_0x7d2c('0x52')],'channel':_0x7d2c('0x83')};var _0x231d86=[];var _0x20cc80=[];var _0x5c3ca5={};var _0x50bf72=![];return db['CmContact'][_0x7d2c('0x59')]()['then'](function(_0x31c94f){if(!_0x31c94f){throw new db[(_0x7d2c('0x84'))]['ValidationError'](_0x7d2c('0x85'));}_0x231d86=_[_0x7d2c('0x86')](_[_0x7d2c('0x3c')](_0x31c94f),[_0x7d2c('0x87'),'updatedAt']);_0x20cc80=_[_0x7d2c('0x86')](_[_0x7d2c('0x3c')](_0x31c94f),[_0x7d2c('0x87'),_0x7d2c('0x88'),_0x7d2c('0x89'),_0x7d2c('0x8a')]);if(_0x3e434f[_0x7d2c('0x52')]['id']){delete _0x3e434f[_0x7d2c('0x52')]['id'];}if(_['isNil'](_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x8b')])){throw new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0x8d'));}if(_[_0x7d2c('0x71')](_0x3e434f[_0x7d2c('0x52')]['body'])||_0x3e434f[_0x7d2c('0x52')]['body']===''){throw new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0x8e'));}if(_['isNil'](_0x3e434f['body']['mapKey'])){throw new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20cc80);}if(!_[_0x7d2c('0x8f')](_0x20cc80,_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x90')])){throw new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0x91')+_0x20cc80);}_0x5c3ca5[_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x90')]]=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x8b')];})[_0x7d2c('0x16')](function(){return db[_0x7d2c('0x36')]['find']({'where':{'id':_0x3e434f[_0x7d2c('0x4f')]['id']},'include':[{'model':db[_0x7d2c('0x92')],'as':_0x7d2c('0x93'),'include':[{'model':db[_0x7d2c('0x94')],'as':_0x7d2c('0x95'),'where':_0x5c3ca5,'limit':0x1,'order':[[_0x7d2c('0x88'),_0x7d2c('0x96')]]}]},{'model':db[_0x7d2c('0x97')],'as':_0x7d2c('0x98')}]});})[_0x7d2c('0x16')](handleEntityNotFound(_0x1d8495,null))['then'](function(_0x451bad){if(_0x451bad&&_0x451bad[_0x7d2c('0x93')]){_0x262cc5[_0x7d2c('0x99')]=_0x451bad;_0x262cc5[_0x7d2c('0x9a')]=_0x451bad[_0x7d2c('0x98')];_0x262cc5[_0x7d2c('0x9b')]=_0x451bad[_0x7d2c('0x93')];_0x262cc5[_0x7d2c('0x9a')]=_[_0x7d2c('0x9c')](_0x262cc5[_0x7d2c('0x9a')],[_0x7d2c('0x9d')],[_0x7d2c('0x9e')]);if(_0x262cc5[_0x7d2c('0x99')][_0x7d2c('0x98')]){delete _0x262cc5[_0x7d2c('0x99')][_0x7d2c('0x98')];}if(_0x262cc5[_0x7d2c('0x99')]['List']&&_0x262cc5[_0x7d2c('0x99')][_0x7d2c('0x93')][_0x7d2c('0x95')][_0x7d2c('0x41')]){return _0x262cc5[_0x7d2c('0x99')][_0x7d2c('0x93')][_0x7d2c('0x95')][0x0];}var _0x1d6250=_[_0x7d2c('0xd')](_0x3e434f[_0x7d2c('0x52')],{'firstName':_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x8b')],'ListId':_0x451bad[_0x7d2c('0x8a')]});_0x1d6250[_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x90')]]=_0x3e434f['body'][_0x7d2c('0x8b')];return db[_0x7d2c('0x94')]['create'](_0x1d6250,{'fields':_0x231d86,'raw':!![]});}})[_0x7d2c('0x16')](handleEntityNotFound(_0x1d8495,null))[_0x7d2c('0x16')](function(_0x4ce501){_0x262cc5['contact']=_0x4ce501;var _0x134ef2=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0x9f')];if(_0x3e434f[_0x7d2c('0x80')][_0x7d2c('0xa0')]){_0x134ef2=_0x3e434f['headers'][_0x7d2c('0xa0')];}else if(_0x3e434f[_0x7d2c('0x80')][_0x7d2c('0xa1')]){_0x134ef2=_[_0x7d2c('0xa2')](_0x3e434f[_0x7d2c('0x80')]['x-forwarded-for'][_0x7d2c('0xa3')](','));}if(_0x4ce501){var _0x57122b={'ContactId':_0x4ce501['id'],'ChatWebsiteId':_0x3e434f['params']['id'],'from':(_0x4ce501[_0x7d2c('0xa4')]||'')+'\x20'+(_0x4ce501['lastName']||''),'customerIp':_0x134ef2,'customerPort':_0x3e434f[_0x7d2c('0x80')][_0x7d2c('0xa5')]?_0x3e434f[_0x7d2c('0x80')]['x-real-port']:null,'referer':_0x3e434f[_0x7d2c('0x52')]['referer'],'browserName':_0x3e1891[_0x7d2c('0xa6')][_0x7d2c('0x31')]&&_0x3e1891['browser'][_0x7d2c('0xa7')]?util[_0x7d2c('0xa8')]('%s\x20%s',_0x3e1891[_0x7d2c('0xa6')][_0x7d2c('0x31')],_0x3e1891['browser']['version']):'unknown','browserVersion':_0x3e1891[_0x7d2c('0xa6')][_0x7d2c('0xa7')]||_0x7d2c('0xa9'),'osName':util[_0x7d2c('0xa8')]('%s\x20%s',_0x3e1891['os'][_0x7d2c('0x31')],_0x3e1891['os'][_0x7d2c('0xa7')]),'osVersion':_0x3e1891['os'][_0x7d2c('0xa7')],'deviceModel':_0x3e1891[_0x7d2c('0xaa')][_0x7d2c('0x3a')]&&_0x3e1891['device']['vendor']?util[_0x7d2c('0xa8')](_0x7d2c('0xab'),_0x3e1891['device'][_0x7d2c('0x3a')],_0x3e1891['device'][_0x7d2c('0xac')],_0x3e1891[_0x7d2c('0xaa')][_0x7d2c('0x38')]):null,'deviceVendor':_0x3e1891[_0x7d2c('0xaa')]['vendor'],'deviceType':_0x3e1891[_0x7d2c('0xaa')][_0x7d2c('0x38')],'formData':JSON[_0x7d2c('0x1b')](_0x3e434f[_0x7d2c('0x52')])};var _0x526141={'ChatWebsiteId':_0x3e434f['params']['id'],'closed':![]};if(_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xad')]){_0x526141[_0x7d2c('0xad')]=_0x3e434f[_0x7d2c('0x52')]['threadId'];return db['ChatInteraction'][_0x7d2c('0x55')]({'where':_0x526141})[_0x7d2c('0x16')](function(_0x1614ff){if(_0x1614ff){return[_0x1614ff,![]];}_0x57122b['threadId']=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xad')];_0x57122b[_0x7d2c('0xae')]=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xae')];return db[_0x7d2c('0xaf')][_0x7d2c('0x51')](_0x57122b)[_0x7d2c('0x16')](function(_0x216f16){return[_0x216f16,!![]];});});}_0x526141[_0x7d2c('0xb0')]=_0x4ce501['id'];if(_0x3e434f['body'][_0x7d2c('0xb1')]&&_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xb1')]['id']){_0x526141['id']=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xb1')]['id'];return db[_0x7d2c('0xaf')][_0x7d2c('0x55')]({'where':_0x526141})['then'](function(_0x2fad2c){if(_0x2fad2c){return[_0x2fad2c,![]];}return db['ChatInteraction'][_0x7d2c('0x51')](_0x57122b)['then'](function(_0x46cd7e){return[_0x46cd7e,!![]];});});}return db[_0x7d2c('0xaf')][_0x7d2c('0x51')](_0x57122b)[_0x7d2c('0x16')](function(_0x205774){return[_0x205774,!![]];});}})['spread'](function(_0x34517f,_0x55f6e2){if(_0x34517f){_0x50bf72=_0x55f6e2;if(!_0x55f6e2){var _0x418c63={'from':(_0x262cc5['contact'][_0x7d2c('0xa4')]||'')+'\x20'+(_0x262cc5[_0x7d2c('0xb2')][_0x7d2c('0xb3')]||'')};if(_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xad')]&&_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xb4')]&&_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xad')]!=_0x3e434f[_0x7d2c('0x52')][_0x7d2c('0xb4')]){_0x418c63[_0x7d2c('0xad')]=_0x3e434f[_0x7d2c('0x52')]['messageId'];}return _0x34517f[_0x7d2c('0x2b')](_0x418c63);}else{return _0x34517f;}}})['then'](function(_0x5e0dce){_0x262cc5[_0x7d2c('0xb1')]=_0x5e0dce['get']({'plain':!![]});_0x262cc5[_0x7d2c('0xb1')]['created']=_0x50bf72;if(_0x262cc5[_0x7d2c('0xb1')][_0x7d2c('0xb5')]){if(_0x262cc5[_0x7d2c('0x99')][_0x7d2c('0xb6')]){_0x262cc5[_0x7d2c('0x9a')]['push']({'id':0x0,'priority':_0x262cc5[_0x7d2c('0x9a')][_0x7d2c('0x41')]+0x1,'app':_0x7d2c('0xb7'),'appdata':_0x7d2c('0xb8'),'interval':_0x7d2c('0xb9')});}}return db[_0x7d2c('0xba')]['create']({'body':_0x3e434f[_0x7d2c('0x52')]['body'],'ChatWebsiteId':_0x3e434f[_0x7d2c('0x4f')]['id'],'ChatInteractionId':_0x5e0dce['id'],'direction':'in','ContactId':_0x262cc5['contact']['id'],'AttachmentId':_0x3e434f[_0x7d2c('0x52')]['AttachmentId']});})[_0x7d2c('0x16')](function(_0x5944f1){_0x262cc5['message']=_0x5944f1;if(_0x262cc5[_0x7d2c('0xb1')][_0x7d2c('0xbb')]){return db[_0x7d2c('0xbc')][_0x7d2c('0x55')]({'attributes':['id',_0x7d2c('0x31')],'where':{'id':_0x262cc5[_0x7d2c('0xb1')]['UserId']}})[_0x7d2c('0x16')](function(_0x260f54){if(_0x260f54){_0x262cc5[_0x7d2c('0x9a')][_0x7d2c('0xbd')]({'id':0x0,'priority':0x0,'app':_0x7d2c('0xbe'),'appdata':_0x260f54[_0x7d2c('0x31')]+','+(_0x262cc5[_0x7d2c('0x99')][_0x7d2c('0xbf')]||0xa),'interval':_0x7d2c('0xb9')});_0x262cc5[_0x7d2c('0xc0')]=!![];}return respondWithRpcPromise(_0x7d2c('0xc1'),_0x7d2c('0xc2'),_0x262cc5);});}return respondWithRpcPromise('Start',_0x7d2c('0xc2'),_0x262cc5);})['then'](function(_0x154e7f){respondWithRpcPromise(_0x7d2c('0xc3'),_0x7d2c('0xc3'),{'event':_0x7d2c('0xc4'),'message':_0x154e7f},client9002);return _0x154e7f;})[_0x7d2c('0x16')](respondWithResult(_0x1d8495,null))[_0x7d2c('0x20')](handleError(_0x1d8495,null));};exports['offline']=function(_0x4a106b,_0x224dcc){var _0x10efc0,_0x54b45c,_0x30c376;var _0x47d50a=[];var _0x45e702={};var _0x181f6a=_0x4a106b[_0x7d2c('0xc5')]||[];var _0x5a8565=[];var _0x2b965e;return db[_0x7d2c('0x94')][_0x7d2c('0x59')]()[_0x7d2c('0x16')](function(_0x1ea782){if(!_0x1ea782){throw new db[(_0x7d2c('0x84'))]['ValidationError'](_0x7d2c('0x85'));}_0x47d50a=_[_0x7d2c('0x86')](_[_0x7d2c('0x3c')](_0x1ea782),[_0x7d2c('0x87'),_0x7d2c('0x88'),_0x7d2c('0x89'),_0x7d2c('0x8a')]);if(_0x4a106b[_0x7d2c('0x52')]['id']){delete _0x4a106b[_0x7d2c('0x52')]['id'];}if(_[_0x7d2c('0x71')](_0x4a106b[_0x7d2c('0x52')]['from'])){throw _0x224dcc[_0x7d2c('0x22')](0x1f4)[_0x7d2c('0xc6')](new db['Sequelize'][(_0x7d2c('0x8c'))](_0x7d2c('0x8d')));}if(_[_0x7d2c('0x71')](_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x52')])||_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x52')]===''){throw _0x224dcc[_0x7d2c('0x22')](0x1f4)['send'](new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0x8e')));}if(_['isNil'](_0x4a106b[_0x7d2c('0x52')]['mapKeyOffline'])){throw _0x224dcc['status'](0x1f4)[_0x7d2c('0xc6')](new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0xc7')+_0x47d50a));}if(!_[_0x7d2c('0x8f')](_0x47d50a,_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0xc8')])){throw _0x224dcc[_0x7d2c('0x22')](0x1f4)[_0x7d2c('0xc6')](new db[(_0x7d2c('0x84'))][(_0x7d2c('0x8c'))](_0x7d2c('0xc9')+_0x47d50a));}_0x45e702[_0x4a106b['body'][_0x7d2c('0xc8')]]=_0x4a106b['body'][_0x7d2c('0x8b')];})['then'](function(){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x4a106b[_0x7d2c('0x4f')]['id']},'include':[{'model':db[_0x7d2c('0x92')],'as':'List'},{'model':db[_0x7d2c('0xca')],'as':'MailAccount'}]});})[_0x7d2c('0x16')](handleEntityNotFound(_0x224dcc,null))[_0x7d2c('0x16')](function(_0x5959e3){if(_0x5959e3&&_0x5959e3['List']){_0x54b45c=_0x5959e3;var _0x3fe6a1=_[_0x7d2c('0xd')](_0x4a106b[_0x7d2c('0x52')],{'firstName':_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x8b')],'phone':_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x8b')],'ListId':_0x5959e3[_0x7d2c('0x8a')]});_0x3fe6a1[_0x4a106b[_0x7d2c('0x52')]['mapKeyOffline']]=_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x8b')];return db[_0x7d2c('0x94')][_0x7d2c('0xcb')]({'where':_0x45e702,'defaults':_0x3fe6a1});}})[_0x7d2c('0xcc')](function(_0x5af1dc){if(_0x5af1dc){_0x30c376=_0x5af1dc;var _0x162a6b=fs[_0x7d2c('0xcd')](path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],'server/files/templates/chatOfflineMessage.ejs'),_0x7d2c('0xce'));var _0x3caaf3=ejs[_0x7d2c('0xcf')](_0x162a6b,{'body':_[_0x7d2c('0xd0')](_0x4a106b[_0x7d2c('0x52')][_0x7d2c('0x52')]),'bodyTitle':_0x54b45c[_0x7d2c('0xd1')]});return db[_0x7d2c('0xd2')]['create']({'body':_0x3caaf3,'plainBody':htmlToText['fromString'](_0x3caaf3),'ContactId':_0x5af1dc['id'],'ChatWebsiteId':_0x54b45c['id']});}})[_0x7d2c('0x16')](function(_0x17eccf){_0x2b965e=_0x17eccf;if(_0x181f6a[_0x7d2c('0x41')]){var _0x35f6dd=_0x181f6a[_0x7d2c('0x35')](function(_0xfdd8e8){return{'name':_0xfdd8e8['originalname'],'basename':_0xfdd8e8[_0x7d2c('0x66')],'type':_0xfdd8e8['mimetype'],'ChatOfflineMessageId':_0x17eccf['id']};});_0x5a8565=_0x35f6dd[_0x7d2c('0x35')](_0x2cf79c=>{var _0x5adc7c={'filename':_0x2cf79c['name'],'path':path[_0x7d2c('0x6b')](config['root'],'server',_0x7d2c('0xc5'),_0x7d2c('0xd3'),_0x7d2c('0xd4'),_0x2cf79c[_0x7d2c('0xd5')])};return _0x5adc7c;});if(!_0x54b45c[_0x7d2c('0xd6')]){return db[_0x7d2c('0xd7')]['transaction'](function(_0x5b4307){return db[_0x7d2c('0xd8')][_0x7d2c('0xd9')](_0x35f6dd,{'transaction':_0x5b4307});});}}})[_0x7d2c('0x16')](function(){if(_0x2b965e){_0x10efc0=_0x2b965e;return db[_0x7d2c('0xca')][_0x7d2c('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0x7d2c('0xda')],'as':_0x7d2c('0xdb'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x378ddc){if(_0x378ddc&&_0x378ddc[_0x7d2c('0xdb')]&&_0x54b45c['forwardOffline']&&_0x54b45c[_0x7d2c('0xdc')]){var _0x323be2=_0x378ddc[_0x7d2c('0xdd')]();return respondWithRpcPromise(_0x7d2c('0xde'),_0x7d2c('0xdf'),{'account':_0x323be2,'message':{'from':util[_0x7d2c('0xa8')](_0x7d2c('0xe0'),_0x378ddc[_0x7d2c('0x31')],_0x378ddc[_0x7d2c('0xe1')]||_0x378ddc[_0x7d2c('0xdb')][_0x7d2c('0xe2')]),'to':_0x54b45c[_0x7d2c('0xdc')],'subject':_0x54b45c[_0x7d2c('0xe3')],'html':_0x10efc0[_0x7d2c('0x52')],'attachments':_0x5a8565}},client9003)['then'](function(){return _0x10efc0;})['catch'](function(_0x9acace){logger['error'](_0x9acace);});}})[_0x7d2c('0x16')](function(){if(_0x54b45c&&_0x54b45c[_0x7d2c('0xd6')]&&_0x54b45c['MailAccountId']){var _0x89628f=[];if(_0x181f6a['length']){_0x89628f=_0x181f6a[_0x7d2c('0x35')](function(_0x99e053){return{'name':_0x99e053[_0x7d2c('0xe4')],'basename':_0x99e053[_0x7d2c('0x66')],'type':_0x99e053['mimetype'],'ChatOfflineMessageId':_0x2b965e['id']};});}var _0x5d07d1;if(!_[_0x7d2c('0x71')](_0x54b45c[_0x7d2c('0xe5')])){var _0x2994a2=_[_0x7d2c('0x35')](_0x4a106b[_0x7d2c('0x52')],function(_0x46a25b){return _0x46a25b;});var _0x519145=_[_0x7d2c('0xe6')](_0x2994a2)[0x0];var _0x16be72=_[_0x7d2c('0xe7')](_0x519145,function(_0x250254){return _0x250254;});_0x5d07d1=_0x16be72[0x1][_0x54b45c['subjectOffline']];}var _0x33beeb={'from':_0x30c376[_0x7d2c('0xe1')],'firstName':_0x30c376[_0x7d2c('0xa4')],'lastName':_0x30c376[_0x7d2c('0xb3')],'mapKey':_0x7d2c('0xe1'),'message':{'from':_0x30c376['email'],'to':_0x54b45c['MailAccount'][_0x7d2c('0xe1')],'cc':'','subject':_[_0x7d2c('0x71')](_0x5d07d1)?_0x54b45c['offlineMessageSubject']:_0x5d07d1,'messageId':'','sentAt':new Date(),'attach':_0x89628f['length'],'attachments':_0x89628f,'originChannel':_0x7d2c('0xe8'),'ChatWebsiteId':_0x54b45c['id'],'ChatOfflineMessageId':_0x10efc0['id'],'originTo':_0x54b45c[_0x7d2c('0xca')][_0x7d2c('0xe1')]},'body':_0x10efc0[_0x7d2c('0x52')]};var _0x23ec5f={'account':{'id':_0x54b45c[_0x7d2c('0xe9')]},'body':_0x33beeb,'log':_0x7d2c('0xea')};return respondWithRpcPromise('NotifyMailAccount',_0x7d2c('0xeb'),_0x23ec5f,client9001)[_0x7d2c('0x16')](function(){return _0x10efc0;})['catch'](function(_0x5f36ad){logger[_0x7d2c('0x1c')](_0x5f36ad);});}return;})['then'](function(){if(_0x10efc0){return _0x10efc0;}})['then'](respondWithResult(_0x224dcc,null))['catch'](function(_0x30136e){logger[_0x7d2c('0x1c')](_0x7d2c('0x20'),_0x30136e);for(var _0x4f9355 of _0x181f6a){var _0x391609=path['join'](config[_0x7d2c('0x6c')],_0x7d2c('0xec'),_0x7d2c('0xc5'),_0x7d2c('0xd3'),_0x7d2c('0xd4'),_0x4f9355[_0x7d2c('0x66')]);fs_extra['remove'](_0x391609)[_0x7d2c('0x20')](function(_0x4b0c15){logger[_0x7d2c('0x1c')](_0x7d2c('0xed'),_0x391609,_0x4b0c15);});}});};exports[_0x7d2c('0xee')]=function(_0x49ccf7,_0x1a7e15){return db[_0x7d2c('0xaf')][_0x7d2c('0x55')]({'where':{'id':_0x49ccf7[_0x7d2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a7e15,null))[_0x7d2c('0x16')](function(_0x5e364e){if(_0x5e364e){return _0x5e364e[_0x7d2c('0xee')](_0x49ccf7[_0x7d2c('0x52')][_0x7d2c('0x63')],_[_0x7d2c('0xef')](_0x49ccf7[_0x7d2c('0x52')],[_0x7d2c('0x63'),'id'])||{});}})[_0x7d2c('0x16')](respondWithResult(_0x1a7e15,null))[_0x7d2c('0x20')](handleError(_0x1a7e15,null));};exports[_0x7d2c('0xf0')]=function(_0x2174df,_0x3e5083){var _0x3c1810={'raw':![],'where':{}};var _0x34d95c={};var _0x24bff4={'count':0x0,'rows':[]};return db[_0x7d2c('0x36')][_0x7d2c('0x5e')]({'where':{'id':_0x2174df['params']['id']}})['then'](handleEntityNotFound(_0x3e5083,null))['then'](function(_0x917163){if(_0x917163){_0x34d95c[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db[_0x7d2c('0xaf')][_0x7d2c('0x50')]);_0x34d95c[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x2174df[_0x7d2c('0x3b')]);_0x34d95c['filters']=_['intersection'](_0x34d95c['model'],_0x34d95c['query']);_0x3c1810[_0x7d2c('0x3f')]=_['intersection'](_0x34d95c['model'],qs[_0x7d2c('0x40')](_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x3c1810[_0x7d2c('0x3f')]=_0x3c1810[_0x7d2c('0x3f')][_0x7d2c('0x41')]?_0x3c1810['attributes']:_0x34d95c['model'];if(!_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0x42')](_0x7d2c('0x43'))){_0x3c1810[_0x7d2c('0x26')]=qs[_0x7d2c('0x26')](_0x2174df['query'][_0x7d2c('0x26')]);_0x3c1810[_0x7d2c('0x25')]=qs['offset'](_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0x25')]);}_0x3c1810[_0x7d2c('0x44')]=qs[_0x7d2c('0x45')](_0x2174df['query'][_0x7d2c('0x45')]);_0x3c1810[_0x7d2c('0x47')]=qs[_0x7d2c('0x3d')](_[_0x7d2c('0x46')](_0x2174df['query'],_0x34d95c[_0x7d2c('0x3d')]));_0x3c1810[_0x7d2c('0x47')]['ChatWebsiteId']=_0x917163['id'];if(_0x2174df['query']['filter']){_0x3c1810[_0x7d2c('0x47')]=_['merge'](_0x3c1810['where'],{'$or':_[_0x7d2c('0x35')](_0x3c1810[_0x7d2c('0x3f')],function(_0x455aaa){var _0x2d936d={};_0x2d936d[_0x455aaa]={'$like':'%'+_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0x4a')]+'%'};return _0x2d936d;})});}_0x3c1810=_[_0x7d2c('0x48')]({},_0x3c1810,_0x2174df[_0x7d2c('0x4b')]);return db['ChatInteraction'][_0x7d2c('0x28')]({'where':_0x3c1810[_0x7d2c('0x47')]})['then'](function(_0x4f644b){_0x24bff4[_0x7d2c('0x28')]=_0x4f644b;if(_0x2174df['query'][_0x7d2c('0x4c')]){_0x3c1810['include']=[{'model':db[_0x7d2c('0x94')],'as':_0x7d2c('0xf1'),'required':![]},{'model':db[_0x7d2c('0xbc')],'as':'Owner','attributes':[_0x7d2c('0x31'),_0x7d2c('0xf2'),_0x7d2c('0xf3')],'required':![]},{'model':db[_0x7d2c('0xf4')],'as':_0x7d2c('0xf5'),'attributes':['id','name',_0x7d2c('0xf6')],'where':_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0xf7')]?{'id':_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0xf7')]}:undefined,'required':_0x2174df[_0x7d2c('0x3b')][_0x7d2c('0xf7')]?!![]:![]}];}return db[_0x7d2c('0xaf')][_0x7d2c('0x5f')](_0x3c1810);})[_0x7d2c('0x16')](function(_0xe2d5cd){_0x24bff4[_0x7d2c('0x4e')]=_0xe2d5cd;return _0x24bff4;});}})[_0x7d2c('0x16')](respondWithFilteredResult(_0x3e5083,_0x3c1810))[_0x7d2c('0x20')](handleError(_0x3e5083,null));};function iftimePromise(_0x3de927,_0x2d71ac){return respondWithRpcPromise(_0x7d2c('0xf8'),_0x7d2c('0xf9'),{'command':_0x2d71ac[_0x7d2c('0xfa')]?util['format']('iftime\x20%s,%s',_0x3de927[_0x7d2c('0xfb')],_0x2d71ac[_0x7d2c('0xfa')]):util[_0x7d2c('0xa8')](_0x7d2c('0xfc'),_0x3de927['interval'])},client9002)['then'](function(_0x57b105){var _0x5bad94=_0x57b105&&_0x57b105[_0x7d2c('0xfd')]('true')>=0x0?!![]:![];logger[_0x7d2c('0x17')](_0x7d2c('0xfe'),_0x2d71ac['id'],_0x3de927['id'],_0x3de927['interval'],_0x5bad94?_0x7d2c('0xff'):_0x7d2c('0x100'),_0x2d71ac[_0x7d2c('0xfa')]?_0x2d71ac['timezone']:_0x7d2c('0x101'));return _0x5bad94;})[_0x7d2c('0x20')](function(_0xf25a0b){logger[_0x7d2c('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2d71ac['id'],_0x3de927['id'],_0x3de927[_0x7d2c('0xfb')],util['inspect'](_0xf25a0b,{'showHidden':![],'depth':null}),_0x2d71ac[_0x7d2c('0xfa')]?_0x2d71ac['timezone']:_0x7d2c('0x101'));return![];});}exports['getSnippet']=function(_0x2d9216,_0x151d02){var _0x3565cc=0x0;var _0x54ace7=0x0;var _0x386159=![];var _0x1a350c;var _0x5008c0;return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x2d9216[_0x7d2c('0x4f')]['id']},'include':[{'model':db['Interval'],'as':_0x7d2c('0x102'),'include':[{'model':db[_0x7d2c('0x102')],'as':_0x7d2c('0x103'),'attributes':['id',_0x7d2c('0xfb')],'raw':!![]}]}]})[_0x7d2c('0x16')](handleEntityNotFound(_0x151d02,null))['then'](function(_0x103235){if(_0x103235){_0x1a350c=_0x103235;return _0x103235[_0x7d2c('0x104')]({'raw':!![]});}})[_0x7d2c('0x16')](function(_0x205da3){if(_0x1a350c){if(_0x205da3){_0x5008c0=_0x205da3;}}return require(_0x7d2c('0x6f'))['getLicense']();})[_0x7d2c('0x16')](function(_0x3b0e63){if(_0x3b0e63){_0x54ace7=_0x3b0e63[_0x7d2c('0x105')];_0x386159=_0x3b0e63[_0x7d2c('0x106')];}})[_0x7d2c('0x16')](function(){return db[_0x7d2c('0xaf')]['count']({'where':{'closed':![]}});})[_0x7d2c('0x16')](function(_0x3cab99){_0x3565cc=_0x3cab99;if(_0x54ace7&&_0x3cab99>_0x54ace7){return db[_0x7d2c('0x107')][_0x7d2c('0x5e')]({'where':{'id':0x1}})[_0x7d2c('0x16')](function(_0x3df6c7){if(_0x3df6c7){_0x3df6c7[_0x7d2c('0x108')]('chatLicenseExceeded');}});}})[_0x7d2c('0x16')](function(){if(_0x1a350c[_0x7d2c('0x102')]&&_0x1a350c['Interval'][_0x7d2c('0x103')]){var _0xafdadc=[];for(var _0x2c13be=0x0;_0x2c13be<_0x1a350c[_0x7d2c('0x102')]['Intervals']['length'];_0x2c13be++){var _0x530110=_0x1a350c[_0x7d2c('0x102')][_0x7d2c('0x103')][_0x2c13be][_0x7d2c('0x2d')]({'plain':!![]});_0xafdadc[_0x7d2c('0x109')](iftimePromise(_0x530110,_0x1a350c));}return BPromise['all'](_0xafdadc)[_0x7d2c('0x16')](function(_0xd769fb){return _[_0x7d2c('0x10a')](_0xd769fb);});}else{return!![];}})[_0x7d2c('0x16')](function(_0x5be9ec){var _0x5c1390=fs[_0x7d2c('0xcd')](path[_0x7d2c('0x6b')](config[_0x7d2c('0x6c')],'server/files/chat/iframe.ejs'),_0x7d2c('0xce'));var _0x463c55=new url['URL'](_0x1a350c['address'])[_0x7d2c('0x10b')];var _0xa4c250='3.1.0';var _0x2ac71c=![];var _0x18e98e={'chatVersion':_0xa4c250,'chatWebsiteAddressOrigin':_0x463c55,'remote':_0x1a350c[_0x7d2c('0x10c')],'query':querystring[_0x7d2c('0x1b')](_[_0x7d2c('0x48')](_0x1a350c[_0x7d2c('0x2d')]({'plain':!![]}),{'customerIp':_0x2d9216[_0x7d2c('0x80')]['x-forwarded-for']||_0x2d9216['headers'][_0x7d2c('0x10d')]||_0x2d9216['connection'][_0x7d2c('0x10e')]||_0x2d9216['ip'],'referer':_0x2d9216['headers'][_0x7d2c('0x10f')],'openedInteractions':_0x3565cc,'maxInteractions':_0x54ace7,'virtual':_0x386159[_0x7d2c('0x105')],'online':_0x5be9ec,'custom':_0x386159}))['replace'](/'/g,'\x5c\x27')};_0x151d02[_0x7d2c('0xc6')](ejs[_0x7d2c('0xcf')](Mustache[_0x7d2c('0xcf')](_0x5c1390,_0x18e98e),{'proactiveActions':_0x5008c0,'alignment':_0x1a350c[_0x7d2c('0x110')],'verticalAlignment':_0x1a350c[_0x7d2c('0x111')],'div_color':_0x1a350c[_0x7d2c('0xf6')],'labelText':_0x1a350c[_0x7d2c('0x112')],'text_color':_0x1a350c[_0x7d2c('0x113')],'text_button_color':_0x1a350c[_0x7d2c('0x114')],'button_color':_0x1a350c[_0x7d2c('0x115')],'background_color':_0x1a350c['backgroundColor'],'hideWhenOffline':_0x1a350c['hideWhenOffline'],'intervalId':_0x1a350c[_0x7d2c('0x116')],'isDevelopment':_0x2ac71c,'chatVersion':_0xa4c250}));})['catch'](handleError(_0x151d02,null));};exports[_0x7d2c('0x117')]=function(_0x512138,_0x566428){var _0x1dd0cf=_0x512138[_0x7d2c('0x4f')]['id'];var _0x918f38=_0x512138['body'];var _0x3bbf37=0xc8;var _0x2ecd5c=null;return db[_0x7d2c('0xd7')][_0x7d2c('0x118')]({'isolationLevel':db[_0x7d2c('0xd7')][_0x7d2c('0x119')][_0x7d2c('0x11a')][_0x7d2c('0x11b')]},function(_0x3df260){return db[_0x7d2c('0x36')]['findOne']({'where':{'id':_0x1dd0cf},'transaction':_0x3df260})[_0x7d2c('0x16')](function(_0x953c0c){if(_0x953c0c){return db[_0x7d2c('0x97')][_0x7d2c('0x2c')]({'where':{'ChatWebsiteId':_0x1dd0cf},'transaction':_0x3df260})[_0x7d2c('0x16')](function(){var _0x4e3794=_[_0x7d2c('0x35')](_0x918f38,function(_0x3d06e7){_0x3d06e7[_0x7d2c('0x5b')]=_0x1dd0cf;return _0x3d06e7;});return db['ChatApplication']['bulkCreate'](_0x4e3794,{'transaction':_0x3df260});});}else{_0x3bbf37=0x194;_0x2ecd5c=[];}});})[_0x7d2c('0x16')](function(){if(_0x3bbf37!==0x194){return db[_0x7d2c('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1dd0cf},'order':_0x7d2c('0x9d')})[_0x7d2c('0x16')](function(_0x2974b5){_0x2ecd5c=_0x2974b5;});}})['catch'](function(_0x1f8660){_0x3bbf37=0x1f4;logger[_0x7d2c('0x1c')](_0x1f8660[_0x7d2c('0x30')]);if(_0x1f8660[_0x7d2c('0x31')]){delete _0x1f8660[_0x7d2c('0x31')];}_0x2ecd5c=_0x1f8660;})[_0x7d2c('0x11c')](function(){if(_0x2ecd5c===null){_0x566428[_0x7d2c('0x21')](_0x3bbf37);}else{if(_0x3bbf37===0x1f4){_0x566428['status'](_0x3bbf37)[_0x7d2c('0xc6')](_0x2ecd5c);}else{_0x566428['status'](_0x3bbf37)['json'](_0x2ecd5c);}}});};exports[_0x7d2c('0x11d')]=function(_0x463a32,_0x3778b4){var _0x414143={};var _0x5b48c1={};var _0x170c59;var _0x41ef0f;return db[_0x7d2c('0x36')][_0x7d2c('0x5e')]({'where':{'id':_0x463a32[_0x7d2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3778b4,null))[_0x7d2c('0x16')](function(_0x2fdfcb){if(_0x2fdfcb){_0x170c59=_0x2fdfcb;_0x5b48c1['model']=_[_0x7d2c('0x3c')](db[_0x7d2c('0x97')]['rawAttributes']);_0x5b48c1[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x463a32[_0x7d2c('0x3b')]);_0x5b48c1[_0x7d2c('0x3d')]=_['intersection'](_0x5b48c1[_0x7d2c('0x3a')],_0x5b48c1['query']);_0x414143[_0x7d2c('0x3f')]=_[_0x7d2c('0x3e')](_0x5b48c1[_0x7d2c('0x3a')],qs['fields'](_0x463a32[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x414143[_0x7d2c('0x3f')]=_0x414143['attributes'][_0x7d2c('0x41')]?_0x414143[_0x7d2c('0x3f')]:_0x5b48c1[_0x7d2c('0x3a')];_0x414143[_0x7d2c('0x44')]=qs['sort'](_0x463a32[_0x7d2c('0x3b')]['sort']);_0x414143['where']=qs['filters'](_[_0x7d2c('0x46')](_0x463a32[_0x7d2c('0x3b')],_0x5b48c1[_0x7d2c('0x3d')]));if(_0x463a32[_0x7d2c('0x3b')][_0x7d2c('0x4a')]){_0x414143[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x414143['where'],{'$or':_[_0x7d2c('0x35')](_0x414143[_0x7d2c('0x3f')],function(_0x612c77){var _0x35930f={};_0x35930f[_0x612c77]={'$like':'%'+_0x463a32[_0x7d2c('0x3b')]['filter']+'%'};return _0x35930f;})});}_0x414143=_['merge']({},_0x414143,_0x463a32['options']);return _0x170c59[_0x7d2c('0x11d')](_0x414143);}})[_0x7d2c('0x16')](function(_0x3647eb){if(_0x3647eb){_0x41ef0f=_0x3647eb[_0x7d2c('0x41')];if(!_0x463a32[_0x7d2c('0x3b')][_0x7d2c('0x42')](_0x7d2c('0x43'))){_0x414143[_0x7d2c('0x26')]=qs['limit'](_0x463a32[_0x7d2c('0x3b')]['limit']);_0x414143['offset']=qs[_0x7d2c('0x25')](_0x463a32['query']['offset']);}return _0x170c59['getApplications'](_0x414143);}})[_0x7d2c('0x16')](function(_0x5e416f){if(_0x5e416f){return _0x5e416f?{'count':_0x41ef0f,'rows':_0x5e416f}:null;}})[_0x7d2c('0x16')](respondWithResult(_0x3778b4,null))[_0x7d2c('0x20')](handleError(_0x3778b4,null));};exports['addProactiveActions']=function(_0x458ce0,_0x5e8a13){return db[_0x7d2c('0x11e')][_0x7d2c('0x55')]({'where':{'id':_0x458ce0[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x5e8a13,null))[_0x7d2c('0x16')](function(_0x6adc15){if(_0x6adc15){return _0x6adc15[_0x7d2c('0x11f')](_0x458ce0[_0x7d2c('0x52')]['ids'],_[_0x7d2c('0xef')](_0x458ce0[_0x7d2c('0x52')],[_0x7d2c('0x63'),'id'])||{});}})[_0x7d2c('0x16')](respondWithResult(_0x5e8a13,null))[_0x7d2c('0x20')](handleError(_0x5e8a13,null));};exports[_0x7d2c('0x104')]=function(_0x389838,_0x11d38){var _0x3ef8cf={};var _0x29c04c={};var _0x5a7a82;var _0x52c72b;return db[_0x7d2c('0x36')]['findOne']({'where':{'id':_0x389838[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x11d38,null))[_0x7d2c('0x16')](function(_0x4269d1){if(_0x4269d1){_0x5a7a82=_0x4269d1;_0x29c04c[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db[_0x7d2c('0x120')][_0x7d2c('0x50')]);_0x29c04c[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x389838[_0x7d2c('0x3b')]);_0x29c04c[_0x7d2c('0x3d')]=_[_0x7d2c('0x3e')](_0x29c04c['model'],_0x29c04c[_0x7d2c('0x3b')]);_0x3ef8cf[_0x7d2c('0x3f')]=_[_0x7d2c('0x3e')](_0x29c04c['model'],qs['fields'](_0x389838['query']['fields']));_0x3ef8cf['attributes']=_0x3ef8cf['attributes'][_0x7d2c('0x41')]?_0x3ef8cf[_0x7d2c('0x3f')]:_0x29c04c[_0x7d2c('0x3a')];_0x3ef8cf['order']=qs[_0x7d2c('0x45')](_0x389838[_0x7d2c('0x3b')]['sort']);_0x3ef8cf[_0x7d2c('0x47')]=qs[_0x7d2c('0x3d')](_['pick'](_0x389838[_0x7d2c('0x3b')],_0x29c04c[_0x7d2c('0x3d')]));if(_0x389838[_0x7d2c('0x3b')][_0x7d2c('0x4a')]){_0x3ef8cf['where']=_[_0x7d2c('0x48')](_0x3ef8cf[_0x7d2c('0x47')],{'$or':_[_0x7d2c('0x35')](_0x3ef8cf[_0x7d2c('0x3f')],function(_0x2579ce){var _0x526756={};_0x526756[_0x2579ce]={'$like':'%'+_0x389838['query'][_0x7d2c('0x4a')]+'%'};return _0x526756;})});}_0x3ef8cf=_[_0x7d2c('0x48')]({},_0x3ef8cf,_0x389838[_0x7d2c('0x4b')]);return _0x5a7a82[_0x7d2c('0x104')](_0x3ef8cf);}})[_0x7d2c('0x16')](function(_0x42602e){if(_0x42602e){_0x52c72b=_0x42602e[_0x7d2c('0x41')];if(!_0x389838[_0x7d2c('0x3b')][_0x7d2c('0x42')]('nolimit')){_0x3ef8cf[_0x7d2c('0x26')]=qs['limit'](_0x389838[_0x7d2c('0x3b')][_0x7d2c('0x26')]);_0x3ef8cf[_0x7d2c('0x25')]=qs[_0x7d2c('0x25')](_0x389838[_0x7d2c('0x3b')][_0x7d2c('0x25')]);}return _0x5a7a82[_0x7d2c('0x104')](_0x3ef8cf);}})[_0x7d2c('0x16')](function(_0x2bed6e){if(_0x2bed6e){return _0x2bed6e?{'count':_0x52c72b,'rows':_0x2bed6e}:null;}})[_0x7d2c('0x16')](respondWithResult(_0x11d38,null))['catch'](handleError(_0x11d38,null));};exports[_0x7d2c('0x121')]=function(_0x1635c3,_0x385ae5){var _0x34d6a6=_0x1635c3[_0x7d2c('0x3b')]['online']==='false'?'offlineForm':_0x7d2c('0x122');return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'attributes':['id',_0x34d6a6],'where':{'id':_0x1635c3[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x385ae5,null))[_0x7d2c('0x16')](function(_0x39fbff){if(_0x39fbff){var _0x4299d1=_0x39fbff[_0x34d6a6];var _0x4e67b2=_0x4299d1&&_0x4299d1['items']?_0x4299d1[_0x7d2c('0x123')]:[];_0x385ae5[_0x7d2c('0xc6')]({'fromKey':_[_0x7d2c('0x71')](_0x4299d1['fromKey'])?undefined:_0x4299d1['fromKey'],'count':_0x4e67b2[_0x7d2c('0x41')],'rows':_0x4e67b2});}})[_0x7d2c('0x20')](handleError(_0x385ae5,null));};exports[_0x7d2c('0x124')]=function(_0x5ebac0,_0x227845){var _0x2003d3={'raw':![],'where':{}};var _0x10c9c0={};var _0x57fb94={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7d2c('0x5e')]({'where':{'id':_0x5ebac0[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x227845,null))[_0x7d2c('0x16')](function(_0x4488eb){if(_0x4488eb){_0x10c9c0[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db[_0x7d2c('0xd2')]['rawAttributes']);_0x10c9c0[_0x7d2c('0x3b')]=_[_0x7d2c('0x3c')](_0x5ebac0[_0x7d2c('0x3b')]);_0x10c9c0[_0x7d2c('0x3d')]=_[_0x7d2c('0x3e')](_0x10c9c0[_0x7d2c('0x3a')],_0x10c9c0[_0x7d2c('0x3b')]);_0x2003d3[_0x7d2c('0x3f')]=_[_0x7d2c('0x3e')](_0x10c9c0[_0x7d2c('0x3a')],qs['fields'](_0x5ebac0[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x2003d3['attributes']=_0x2003d3['attributes'][_0x7d2c('0x41')]?_0x2003d3[_0x7d2c('0x3f')]:_0x10c9c0['model'];if(!_0x5ebac0[_0x7d2c('0x3b')][_0x7d2c('0x42')]('nolimit')){_0x2003d3[_0x7d2c('0x26')]=qs[_0x7d2c('0x26')](_0x5ebac0[_0x7d2c('0x3b')]['limit']);_0x2003d3[_0x7d2c('0x25')]=qs['offset'](_0x5ebac0[_0x7d2c('0x3b')]['offset']);}_0x2003d3['order']=qs['sort'](_0x5ebac0[_0x7d2c('0x3b')][_0x7d2c('0x45')]);_0x2003d3[_0x7d2c('0x47')]=qs['filters'](_[_0x7d2c('0x46')](_0x5ebac0[_0x7d2c('0x3b')],_0x10c9c0['filters']));_0x2003d3[_0x7d2c('0x47')]['ChatWebsiteId']=_0x4488eb['id'];if(_0x5ebac0[_0x7d2c('0x3b')][_0x7d2c('0x4a')]){_0x2003d3[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x2003d3[_0x7d2c('0x47')],{'$or':_[_0x7d2c('0x35')](_0x2003d3[_0x7d2c('0x3f')],function(_0x2c826b){var _0x5a500f={};_0x5a500f[_0x2c826b]={'$like':'%'+_0x5ebac0[_0x7d2c('0x3b')]['filter']+'%'};return _0x5a500f;})});}_0x2003d3=_[_0x7d2c('0x48')]({},_0x2003d3,_0x5ebac0[_0x7d2c('0x4b')]);return db[_0x7d2c('0xd2')]['count']({'where':_0x2003d3[_0x7d2c('0x47')]})['then'](function(_0xf391df){_0x57fb94[_0x7d2c('0x28')]=_0xf391df;if(_0x5ebac0['query']['includeAll']){_0x2003d3['include']=[{'all':!![]}];}else{_0x2003d3[_0x7d2c('0x4d')]=[{'model':db['CmContact'],'as':_0x7d2c('0xf1'),'required':![]},{'model':db[_0x7d2c('0xd8')],'as':_0x7d2c('0x125'),'required':![]}];}return db[_0x7d2c('0xd2')]['findAll'](_0x2003d3);})[_0x7d2c('0x16')](function(_0x274bfa){_0x57fb94[_0x7d2c('0x4e')]=_0x274bfa;return _0x57fb94;});}})['then'](respondWithFilteredResult(_0x227845,_0x2003d3))[_0x7d2c('0x20')](handleError(_0x227845,null));};exports[_0x7d2c('0x126')]=function(_0x17dd8d,_0x4c74c9){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x17dd8d['params']['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x4c74c9,null))[_0x7d2c('0x16')](function(_0x472ddc){if(_0x472ddc){return _0x472ddc[_0x7d2c('0x126')](_0x17dd8d[_0x7d2c('0x52')][_0x7d2c('0x63')],_['omit'](_0x17dd8d[_0x7d2c('0x52')],[_0x7d2c('0x63'),'id'])||{})[_0x7d2c('0xcc')](function(_0x4324ef){for(var _0x47eb84=0x0;_0x47eb84<_0x17dd8d[_0x7d2c('0x52')][_0x7d2c('0x63')][_0x7d2c('0x41')];_0x47eb84+=0x1){socket[_0x7d2c('0x127')](_0x7d2c('0x128'),{'UserId':Number(_0x17dd8d[_0x7d2c('0x52')]['ids'][_0x47eb84]),'ChatWebsiteId':Number(_0x17dd8d['params']['id'])});}return _0x4324ef;});}})[_0x7d2c('0x16')](respondWithResult(_0x4c74c9,null))[_0x7d2c('0x20')](handleError(_0x4c74c9,null));};exports[_0x7d2c('0x129')]=function(_0x1008c7,_0x58a74e){return db[_0x7d2c('0x36')][_0x7d2c('0x55')]({'where':{'id':_0x1008c7['params']['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x58a74e,null))[_0x7d2c('0x16')](function(_0x293032){if(_0x293032){return _0x293032[_0x7d2c('0x129')](_0x1008c7['query'][_0x7d2c('0x63')])[_0x7d2c('0x16')](function(){if(_[_0x7d2c('0x12a')](_0x1008c7[_0x7d2c('0x3b')][_0x7d2c('0x63')])){for(var _0x3e927b=0x0;_0x3e927b<_0x1008c7[_0x7d2c('0x3b')]['ids'][_0x7d2c('0x41')];_0x3e927b+=0x1){socket['emit'](_0x7d2c('0x12b'),{'UserId':Number(_0x1008c7['query'][_0x7d2c('0x63')][_0x3e927b]),'ChatWebsiteId':Number(_0x1008c7['params']['id'])});}}else{socket[_0x7d2c('0x127')](_0x7d2c('0x12b'),{'UserId':Number(_0x1008c7[_0x7d2c('0x3b')][_0x7d2c('0x63')]),'ChatWebsiteId':Number(_0x1008c7[_0x7d2c('0x4f')]['id'])});}});}})[_0x7d2c('0x16')](respondWithStatusCode(_0x58a74e,null))['catch'](handleError(_0x58a74e,null));};exports['getAgents']=function(_0x52d93e,_0x30c0ed){var _0x4c3036={};var _0x57b799={};var _0x358fd;var _0x537f8c;return db[_0x7d2c('0x36')][_0x7d2c('0x5e')]({'where':{'id':_0x52d93e[_0x7d2c('0x4f')]['id']}})[_0x7d2c('0x16')](handleEntityNotFound(_0x30c0ed,null))[_0x7d2c('0x16')](function(_0x38c37b){if(_0x38c37b){_0x358fd=_0x38c37b;_0x57b799[_0x7d2c('0x3a')]=_[_0x7d2c('0x3c')](db[_0x7d2c('0xbc')][_0x7d2c('0x50')]);_0x57b799[_0x7d2c('0x3b')]=_['keys'](_0x52d93e[_0x7d2c('0x3b')]);_0x57b799['filters']=_['intersection'](_0x57b799[_0x7d2c('0x3a')],_0x57b799[_0x7d2c('0x3b')]);_0x4c3036[_0x7d2c('0x3f')]=_['intersection'](_0x57b799[_0x7d2c('0x3a')],qs[_0x7d2c('0x40')](_0x52d93e[_0x7d2c('0x3b')][_0x7d2c('0x40')]));_0x4c3036[_0x7d2c('0x3f')]=_0x4c3036[_0x7d2c('0x3f')][_0x7d2c('0x41')]?_0x4c3036['attributes']:_0x57b799[_0x7d2c('0x3a')];_0x4c3036[_0x7d2c('0x44')]=qs['sort'](_0x52d93e['query']['sort']);_0x4c3036['where']=qs[_0x7d2c('0x3d')](_['pick'](_0x52d93e[_0x7d2c('0x3b')],_0x57b799['filters']));if(_0x52d93e[_0x7d2c('0x3b')][_0x7d2c('0x4a')]){_0x4c3036[_0x7d2c('0x47')]=_[_0x7d2c('0x48')](_0x4c3036[_0x7d2c('0x47')],{'$or':_[_0x7d2c('0x35')](_0x4c3036[_0x7d2c('0x3f')],function(_0x40b09a){var _0xe0efcf={};_0xe0efcf[_0x40b09a]={'$like':'%'+_0x52d93e[_0x7d2c('0x3b')][_0x7d2c('0x4a')]+'%'};return _0xe0efcf;})});}_0x4c3036=_['merge']({},_0x4c3036,_0x52d93e[_0x7d2c('0x4b')]);return _0x358fd[_0x7d2c('0x12c')](_0x4c3036);}})[_0x7d2c('0x16')](function(_0x146fd4){if(_0x146fd4){_0x537f8c=_0x146fd4[_0x7d2c('0x41')];if(!_0x52d93e[_0x7d2c('0x3b')]['hasOwnProperty'](_0x7d2c('0x43'))){_0x4c3036[_0x7d2c('0x26')]=qs['limit'](_0x52d93e[_0x7d2c('0x3b')][_0x7d2c('0x26')]);_0x4c3036[_0x7d2c('0x25')]=qs['offset'](_0x52d93e['query'][_0x7d2c('0x25')]);}return _0x358fd[_0x7d2c('0x12c')](_0x4c3036);}})['then'](function(_0x42c15a){if(_0x42c15a){return _0x42c15a?{'count':_0x537f8c,'rows':_0x42c15a}:null;}})[_0x7d2c('0x16')](respondWithResult(_0x30c0ed,null))[_0x7d2c('0x20')](handleError(_0x30c0ed,null));}; \ No newline at end of file +var _0x7254=['contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','MailAccount','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','push','server/files/chat/iframe.ejs','URL','origin','3.1.0','x-real-ip','connection','remoteAddress','replace','alignment','backgroundColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','end','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','name','rows','show','params','includeAll','include','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','findOne','keys','Disposition','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','server/files/images/logos/','existsSync','agentAvatar','download','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','setUA','headers','chat','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','applications','Applications','orderBy','priority','account'];(function(_0x143f3c,_0x719fc0){var _0x16b449=function(_0x5af8f7){while(--_0x5af8f7){_0x143f3c['push'](_0x143f3c['shift']());}};_0x16b449(++_0x719fc0);}(_0x7254,0x1c2));var _0x4725=function(_0x3753b9,_0xf5eff5){_0x3753b9=_0x3753b9-0x0;var _0x18cdf1=_0x7254[_0x3753b9];return _0x18cdf1;};'use strict';var BPromise=require(_0x4725('0x0'));var Mustache=require(_0x4725('0x1'));var util=require(_0x4725('0x2'));var path=require(_0x4725('0x3'));var ejs=require(_0x4725('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4725('0x5'));var querystring=require(_0x4725('0x6'));var Redis=require(_0x4725('0x7'));var qs=require(_0x4725('0x8'));var logger=require('../../config/logger')(_0x4725('0x9'));var config=require(_0x4725('0xa'));var url=require('url');var db=require(_0x4725('0xb'))['db'];config[_0x4725('0xc')]=_[_0x4725('0xd')](config[_0x4725('0xc')],{'host':_0x4725('0xe'),'port':0x18eb});var socket=require(_0x4725('0xf'))(new Redis(config['redis']));require(_0x4725('0x10'))['register'](socket);var htmlToText=require(_0x4725('0x11'));var jayson=require(_0x4725('0x12'));var client=jayson[_0x4725('0x13')][_0x4725('0x14')]({'port':0x232c});var client9002=jayson[_0x4725('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x4725('0x13')][_0x4725('0x14')]({'port':0x232b});var client9001=jayson['client'][_0x4725('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x1c43eb,_0x36a4d7,_0x84c436,_0x28a798){return new BPromise(function(_0x3ca092,_0x5d5566){var _0x322712=_0x28a798||client;return _0x322712[_0x4725('0x15')](_0x1c43eb,_0x84c436)[_0x4725('0x16')](function(_0x1dd828){logger['info'](_0x4725('0x17'),_0x36a4d7,_0x4725('0x18'));logger[_0x4725('0x19')](_0x4725('0x1a'),_0x36a4d7,_0x4725('0x18'),JSON['stringify'](_0x1dd828));if(_0x1dd828[_0x4725('0x1b')]){if(_0x1dd828[_0x4725('0x1b')][_0x4725('0x1c')]===0x1f4){logger[_0x4725('0x1b')](_0x4725('0x17'),_0x36a4d7,_0x1dd828[_0x4725('0x1b')][_0x4725('0x1d')]);return _0x5d5566(_0x1dd828['error'][_0x4725('0x1d')]);}logger[_0x4725('0x1b')](_0x4725('0x17'),_0x36a4d7,_0x1dd828['error'][_0x4725('0x1d')]);return _0x3ca092(_0x1dd828['error'][_0x4725('0x1d')]);}else{logger[_0x4725('0x1e')](_0x4725('0x17'),_0x36a4d7,'request\x20sent');_0x3ca092(_0x1dd828['result'][_0x4725('0x1d')]);}})[_0x4725('0x1f')](function(_0x383a22){logger['error'](_0x4725('0x17'),_0x36a4d7,_0x383a22);_0x5d5566(_0x383a22);});});}function respondWithStatusCode(_0x940cd6,_0xc39cb4){_0xc39cb4=_0xc39cb4||0xcc;return function(_0x217276){if(_0x217276){return _0x940cd6[_0x4725('0x20')](_0xc39cb4);}return _0x940cd6[_0x4725('0x21')](_0xc39cb4)['end']();};}function respondWithResult(_0x356e5c,_0x9459){_0x9459=_0x9459||0xc8;return function(_0x4cf357){if(_0x4cf357){return _0x356e5c['status'](_0x9459)[_0x4725('0x22')](_0x4cf357);}};}function respondWithFilteredResult(_0x1c920d,_0x39af79){return function(_0x734a8a){if(_0x734a8a){var _0x173e49=typeof _0x39af79[_0x4725('0x23')]===_0x4725('0x24')&&typeof _0x39af79[_0x4725('0x25')]===_0x4725('0x24');var _0x41672b=_0x734a8a[_0x4725('0x26')];var _0x3ceaee=_0x173e49?0x0:_0x39af79[_0x4725('0x23')];var _0x21a492=_0x173e49?_0x734a8a[_0x4725('0x26')]:_0x39af79[_0x4725('0x23')]+_0x39af79[_0x4725('0x25')];var _0x430a44;if(_0x21a492>=_0x41672b){_0x21a492=_0x41672b;_0x430a44=0xc8;}else{_0x430a44=0xce;}_0x1c920d[_0x4725('0x21')](_0x430a44);return _0x1c920d[_0x4725('0x27')](_0x4725('0x28'),_0x3ceaee+'-'+_0x21a492+'/'+_0x41672b)['json'](_0x734a8a);}return null;};}function saveUpdates(_0x491d6d){return function(_0x2db1f7){if(_0x2db1f7){return _0x2db1f7[_0x4725('0x29')](_0x491d6d)[_0x4725('0x16')](function(_0x362b30){return _0x362b30;});}return null;};}function removeEntity(_0x130d25){return function(_0x52bd97){if(_0x52bd97){return _0x52bd97[_0x4725('0x2a')]()[_0x4725('0x16')](function(){var _0x5a69c6=_0x52bd97[_0x4725('0x2b')]({'plain':!![]});var _0x36c6be=_0x4725('0x2c');return db['UserProfileResource'][_0x4725('0x2a')]({'where':{'type':_0x36c6be,'resourceId':_0x5a69c6['id']}})[_0x4725('0x16')](function(){return _0x52bd97;});})['then'](function(){_0x130d25['status'](0xcc)[_0x4725('0x2d')]();});}};}function handleEntityNotFound(_0x1ae19c){return function(_0x35779b){if(!_0x35779b){_0x1ae19c[_0x4725('0x20')](0x194);}return _0x35779b;};}function handleError(_0x44236a,_0x1ac9be){_0x1ac9be=_0x1ac9be||0x1f4;return function(_0x4fb76a){logger['error'](_0x4fb76a['stack']);if(_0x4fb76a['name']){delete _0x4fb76a['name'];}_0x44236a[_0x4725('0x21')](_0x1ac9be)[_0x4725('0x2e')](_0x4fb76a);};}exports[_0x4725('0x2f')]=function(_0x53607a,_0x5879d5){var _0x40d83f={'include':[{'model':db[_0x4725('0x30')],'as':_0x4725('0x31')}]},_0xf71a2f={},_0xf250c1={'count':0x0,'rows':[]};var _0x55094f=_['map'](db[_0x4725('0x32')][_0x4725('0x33')],function(_0x2e54f9){return{'name':_0x2e54f9[_0x4725('0x34')],'type':_0x2e54f9['type'][_0x4725('0x35')]};});_0xf71a2f[_0x4725('0x36')]=_[_0x4725('0x37')](_0x55094f,'name');_0xf71a2f[_0x4725('0x38')]=_['keys'](_0x53607a[_0x4725('0x38')]);_0xf71a2f['filters']=_[_0x4725('0x39')](_0xf71a2f['model'],_0xf71a2f[_0x4725('0x38')]);_0x40d83f[_0x4725('0x3a')]=_['intersection'](_0xf71a2f['model'],qs[_0x4725('0x3b')](_0x53607a[_0x4725('0x38')]['fields']));_0x40d83f[_0x4725('0x3a')]=_0x40d83f[_0x4725('0x3a')][_0x4725('0x3c')]?_0x40d83f['attributes']:_0xf71a2f['model'];if(!_0x53607a['query'][_0x4725('0x3d')](_0x4725('0x3e'))){_0x40d83f[_0x4725('0x25')]=qs[_0x4725('0x25')](_0x53607a[_0x4725('0x38')][_0x4725('0x25')]);_0x40d83f[_0x4725('0x23')]=qs[_0x4725('0x23')](_0x53607a[_0x4725('0x38')][_0x4725('0x23')]);}_0x40d83f[_0x4725('0x3f')]=qs[_0x4725('0x40')](_0x53607a['query'][_0x4725('0x40')]);_0x40d83f[_0x4725('0x41')]=qs[_0x4725('0x42')](_['pick'](_0x53607a[_0x4725('0x38')],_0xf71a2f[_0x4725('0x42')]),_0x55094f);if(_0x53607a[_0x4725('0x38')][_0x4725('0x43')]){_0x40d83f['where']=_[_0x4725('0x44')](_0x40d83f[_0x4725('0x41')],{'$or':_['map'](_0x55094f,function(_0x3ca57c){if(_0x3ca57c[_0x4725('0x45')]!==_0x4725('0x46')){var _0x1a858a={};_0x1a858a[_0x3ca57c[_0x4725('0x47')]]={'$like':'%'+_0x53607a[_0x4725('0x38')]['filter']+'%'};return _0x1a858a;}})});}_0x40d83f=_['merge']({},_0x40d83f,_0x53607a['options']);var _0x2e2ba8={'where':_0x40d83f[_0x4725('0x41')]};return db[_0x4725('0x32')][_0x4725('0x26')](_0x2e2ba8)['then'](function(_0x3829a0){_0xf250c1[_0x4725('0x26')]=_0x3829a0;if(_0x53607a[_0x4725('0x38')]['includeAll']){_0x40d83f['include']=[{'all':!![]}];}return db[_0x4725('0x32')]['findAll'](_0x40d83f);})[_0x4725('0x16')](function(_0x246a2a){_0xf250c1[_0x4725('0x48')]=_0x246a2a;return _0xf250c1;})['then'](respondWithFilteredResult(_0x5879d5,_0x40d83f))['catch'](handleError(_0x5879d5,null));};exports[_0x4725('0x49')]=function(_0x325e3d,_0x55cf4d){var _0x14f4f3={'raw':![],'where':{'id':_0x325e3d[_0x4725('0x4a')]['id']},'include':[{'model':db[_0x4725('0x30')],'as':_0x4725('0x31')}]},_0x46208c={};_0x46208c['model']=_['keys'](db[_0x4725('0x32')][_0x4725('0x33')]);_0x46208c[_0x4725('0x38')]=_['keys'](_0x325e3d[_0x4725('0x38')]);_0x46208c[_0x4725('0x42')]=_['intersection'](_0x46208c[_0x4725('0x36')],_0x46208c[_0x4725('0x38')]);_0x14f4f3[_0x4725('0x3a')]=_[_0x4725('0x39')](_0x46208c['model'],qs[_0x4725('0x3b')](_0x325e3d[_0x4725('0x38')][_0x4725('0x3b')]));_0x14f4f3['attributes']=_0x14f4f3[_0x4725('0x3a')][_0x4725('0x3c')]?_0x14f4f3[_0x4725('0x3a')]:_0x46208c[_0x4725('0x36')];if(_0x325e3d['query'][_0x4725('0x4b')]){_0x14f4f3[_0x4725('0x4c')]=[{'all':!![]}];}_0x14f4f3=_[_0x4725('0x44')]({},_0x14f4f3,_0x325e3d[_0x4725('0x4d')]);return db[_0x4725('0x32')]['find'](_0x14f4f3)[_0x4725('0x16')](handleEntityNotFound(_0x55cf4d,null))['then'](respondWithResult(_0x55cf4d,null))['catch'](handleError(_0x55cf4d,null));};exports['create']=function(_0x33ea79,_0x17c3ab){return db[_0x4725('0x32')]['create'](_0x33ea79['body'],{})[_0x4725('0x16')](function(_0x1461af){var _0x2a27ff=_0x33ea79[_0x4725('0x4e')]['get']({'plain':!![]});if(!_0x2a27ff)throw new Error(_0x4725('0x4f'));if(_0x2a27ff['role']===_0x4725('0x4e')){var _0x4fdcf6=_0x1461af[_0x4725('0x2b')]({'plain':!![]});var _0x304789=_0x4725('0x2c');return db[_0x4725('0x50')][_0x4725('0x51')]({'where':{'name':_0x304789,'userProfileId':_0x2a27ff[_0x4725('0x52')]},'raw':!![]})[_0x4725('0x16')](function(_0xfb8656){if(_0xfb8656&&_0xfb8656['autoAssociation']===0x0){return db[_0x4725('0x53')][_0x4725('0x54')]({'name':_0x4fdcf6[_0x4725('0x47')],'resourceId':_0x4fdcf6['id'],'type':_0xfb8656['name'],'sectionId':_0xfb8656['id']},{})['then'](function(){return _0x1461af;});}else{return _0x1461af;}})[_0x4725('0x1f')](function(_0x3a7d57){logger[_0x4725('0x1b')](_0x4725('0x55'),_0x3a7d57);throw _0x3a7d57;});}return _0x1461af;})['then'](respondWithResult(_0x17c3ab,0xc9))['catch'](handleError(_0x17c3ab,null));};exports[_0x4725('0x29')]=function(_0x299e66,_0x1a625c){if(_0x299e66[_0x4725('0x56')]['id']){delete _0x299e66[_0x4725('0x56')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x299e66[_0x4725('0x4a')]['id']},'include':[{'model':db['Pause'],'as':_0x4725('0x31')}]})[_0x4725('0x16')](handleEntityNotFound(_0x1a625c,null))[_0x4725('0x16')](saveUpdates(_0x299e66['body'],null))[_0x4725('0x16')](respondWithResult(_0x1a625c,null))[_0x4725('0x1f')](handleError(_0x1a625c,null));};exports[_0x4725('0x2a')]=function(_0x48d980,_0x10f0b6){return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0x48d980[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x10f0b6,null))[_0x4725('0x16')](removeEntity(_0x10f0b6,null))[_0x4725('0x1f')](handleError(_0x10f0b6,null));};exports[_0x4725('0x57')]=function(_0x508f0f,_0x342051){return db[_0x4725('0x32')][_0x4725('0x57')]()['then'](respondWithResult(_0x342051,null))['catch'](handleError(_0x342051,null));};exports[_0x4725('0x58')]=function(_0x397416,_0x5ee5ad){if(_0x397416[_0x4725('0x56')]['id']){delete _0x397416[_0x4725('0x56')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x397416['params']['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x5ee5ad,null))['then'](function(_0x5dbc5d){if(_0x5dbc5d){_0x397416['body'][_0x4725('0x59')]=_0x5dbc5d['id'];return db['Disposition'][_0x4725('0x54')](_0x397416[_0x4725('0x56')]);}})[_0x4725('0x16')](respondWithResult(_0x5ee5ad,null))[_0x4725('0x1f')](handleError(_0x5ee5ad,null));};exports['getDispositions']=function(_0x2c6e9e,_0x2a7f6a){var _0x8b739d={'raw':![],'where':{}};var _0x3b8e0f={};var _0x5533d7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4725('0x5a')]({'where':{'id':_0x2c6e9e[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x2a7f6a,null))[_0x4725('0x16')](function(_0x55e36b){if(_0x55e36b){_0x3b8e0f[_0x4725('0x36')]=_[_0x4725('0x5b')](db[_0x4725('0x5c')][_0x4725('0x33')]);_0x3b8e0f[_0x4725('0x38')]=_[_0x4725('0x5b')](_0x2c6e9e[_0x4725('0x38')]);_0x3b8e0f['filters']=_[_0x4725('0x39')](_0x3b8e0f[_0x4725('0x36')],_0x3b8e0f[_0x4725('0x38')]);_0x8b739d[_0x4725('0x3a')]=_['intersection'](_0x3b8e0f['model'],qs['fields'](_0x2c6e9e[_0x4725('0x38')]['fields']));_0x8b739d[_0x4725('0x3a')]=_0x8b739d[_0x4725('0x3a')][_0x4725('0x3c')]?_0x8b739d[_0x4725('0x3a')]:_0x3b8e0f[_0x4725('0x36')];if(!_0x2c6e9e[_0x4725('0x38')][_0x4725('0x3d')]('nolimit')){_0x8b739d[_0x4725('0x25')]=qs['limit'](_0x2c6e9e[_0x4725('0x38')][_0x4725('0x25')]);_0x8b739d['offset']=qs[_0x4725('0x23')](_0x2c6e9e[_0x4725('0x38')][_0x4725('0x23')]);}_0x8b739d[_0x4725('0x3f')]=qs[_0x4725('0x40')](_0x2c6e9e[_0x4725('0x38')]['sort']);_0x8b739d['where']=qs[_0x4725('0x42')](_[_0x4725('0x5d')](_0x2c6e9e[_0x4725('0x38')],_0x3b8e0f[_0x4725('0x42')]));_0x8b739d[_0x4725('0x41')][_0x4725('0x59')]=_0x55e36b['id'];if(_0x2c6e9e[_0x4725('0x38')][_0x4725('0x43')]){_0x8b739d[_0x4725('0x41')]=_[_0x4725('0x44')](_0x8b739d[_0x4725('0x41')],{'$or':_['map'](_0x8b739d[_0x4725('0x3a')],function(_0x475d11){var _0xdbf213={};_0xdbf213[_0x475d11]={'$like':'%'+_0x2c6e9e[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0xdbf213;})});}_0x8b739d=_['merge']({},_0x8b739d,_0x2c6e9e['options']);return db[_0x4725('0x5c')][_0x4725('0x26')]({'where':_0x8b739d[_0x4725('0x41')]})[_0x4725('0x16')](function(_0x15a13d){_0x5533d7[_0x4725('0x26')]=_0x15a13d;if(_0x2c6e9e['query'][_0x4725('0x4b')]){_0x8b739d[_0x4725('0x4c')]=[{'all':!![]}];}return db[_0x4725('0x5c')][_0x4725('0x5e')](_0x8b739d);})['then'](function(_0x5c7a80){_0x5533d7['rows']=_0x5c7a80;return _0x5533d7;});}})[_0x4725('0x16')](respondWithFilteredResult(_0x2a7f6a,_0x8b739d))[_0x4725('0x1f')](handleError(_0x2a7f6a,null));};exports[_0x4725('0x5f')]=function(_0x5cf0f0,_0x2ff059){return db['ChatWebsite'][_0x4725('0x51')]({'where':{'id':_0x5cf0f0[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x2ff059,null))['then'](function(_0xeda86e){if(_0xeda86e){return _0xeda86e[_0x4725('0x5f')](_0x5cf0f0[_0x4725('0x38')][_0x4725('0x60')]);}})[_0x4725('0x16')](respondWithStatusCode(_0x2ff059,null))[_0x4725('0x1f')](handleError(_0x2ff059,null));};exports['addAnswer']=function(_0x1ca652,_0x3a62a7){if(_0x1ca652[_0x4725('0x56')]['id']){delete _0x1ca652[_0x4725('0x56')]['id'];}return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0x1ca652['params']['id']}})['then'](handleEntityNotFound(_0x3a62a7,null))[_0x4725('0x16')](function(_0x395e10){if(_0x395e10){_0x1ca652[_0x4725('0x56')]['ChatWebsiteId']=_0x395e10['id'];return db[_0x4725('0x61')][_0x4725('0x54')](_0x1ca652[_0x4725('0x56')]);}})[_0x4725('0x16')](respondWithResult(_0x3a62a7,null))['catch'](handleError(_0x3a62a7,null));};exports[_0x4725('0x62')]=function(_0x179d9a,_0x5221f4){var _0x511bc9={'raw':![],'where':{}};var _0x25c10c={};var _0x5c662e={'count':0x0,'rows':[]};return db[_0x4725('0x32')][_0x4725('0x5a')]({'where':{'id':_0x179d9a['params']['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x5221f4,null))['then'](function(_0xb0f567){if(_0xb0f567){_0x25c10c[_0x4725('0x36')]=_[_0x4725('0x5b')](db[_0x4725('0x61')][_0x4725('0x33')]);_0x25c10c[_0x4725('0x38')]=_[_0x4725('0x5b')](_0x179d9a[_0x4725('0x38')]);_0x25c10c[_0x4725('0x42')]=_['intersection'](_0x25c10c[_0x4725('0x36')],_0x25c10c[_0x4725('0x38')]);_0x511bc9[_0x4725('0x3a')]=_['intersection'](_0x25c10c[_0x4725('0x36')],qs[_0x4725('0x3b')](_0x179d9a[_0x4725('0x38')][_0x4725('0x3b')]));_0x511bc9[_0x4725('0x3a')]=_0x511bc9[_0x4725('0x3a')][_0x4725('0x3c')]?_0x511bc9[_0x4725('0x3a')]:_0x25c10c[_0x4725('0x36')];if(!_0x179d9a[_0x4725('0x38')][_0x4725('0x3d')](_0x4725('0x3e'))){_0x511bc9['limit']=qs[_0x4725('0x25')](_0x179d9a[_0x4725('0x38')][_0x4725('0x25')]);_0x511bc9[_0x4725('0x23')]=qs['offset'](_0x179d9a[_0x4725('0x38')][_0x4725('0x23')]);}_0x511bc9[_0x4725('0x3f')]=qs[_0x4725('0x40')](_0x179d9a[_0x4725('0x38')][_0x4725('0x40')]);_0x511bc9[_0x4725('0x41')]=qs[_0x4725('0x42')](_[_0x4725('0x5d')](_0x179d9a[_0x4725('0x38')],_0x25c10c[_0x4725('0x42')]));_0x511bc9[_0x4725('0x41')][_0x4725('0x59')]=_0xb0f567['id'];if(_0x179d9a['query'][_0x4725('0x43')]){_0x511bc9[_0x4725('0x41')]=_[_0x4725('0x44')](_0x511bc9[_0x4725('0x41')],{'$or':_[_0x4725('0x37')](_0x511bc9[_0x4725('0x3a')],function(_0x1166d7){var _0x2fad29={};_0x2fad29[_0x1166d7]={'$like':'%'+_0x179d9a[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0x2fad29;})});}_0x511bc9=_[_0x4725('0x44')]({},_0x511bc9,_0x179d9a[_0x4725('0x4d')]);return db[_0x4725('0x61')][_0x4725('0x26')]({'where':_0x511bc9[_0x4725('0x41')]})['then'](function(_0x3d89a9){_0x5c662e['count']=_0x3d89a9;if(_0x179d9a[_0x4725('0x38')][_0x4725('0x4b')]){_0x511bc9[_0x4725('0x4c')]=[{'all':!![]}];}return db[_0x4725('0x61')]['findAll'](_0x511bc9);})[_0x4725('0x16')](function(_0x484139){_0x5c662e[_0x4725('0x48')]=_0x484139;return _0x5c662e;});}})[_0x4725('0x16')](respondWithFilteredResult(_0x5221f4,_0x511bc9))[_0x4725('0x1f')](handleError(_0x5221f4,null));};exports[_0x4725('0x63')]=function(_0x375e13,_0x32a143){return db['ChatWebsite'][_0x4725('0x51')]({'where':{'id':_0x375e13[_0x4725('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32a143,null))[_0x4725('0x16')](function(_0x475044){if(_0x475044){return _0x475044['removeAnswers'](_0x375e13[_0x4725('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x32a143,null))[_0x4725('0x1f')](handleError(_0x32a143,null));};exports[_0x4725('0x64')]=function(_0xe26fd1,_0x4d6ee1){_0xe26fd1[_0x4725('0x56')][_0x4725('0x65')]=_0xe26fd1[_0x4725('0x66')][_0x4725('0x67')];return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0xe26fd1[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x4d6ee1,null))['then'](saveUpdates(_0xe26fd1[_0x4725('0x56')],null))[_0x4725('0x16')](respondWithResult(_0x4d6ee1,null))[_0x4725('0x1f')](handleError(_0x4d6ee1,null));};exports[_0x4725('0x68')]=function(_0x1f661d,_0x2b521e){_0x1f661d[_0x4725('0x56')]['agentAvatar']=_0x1f661d[_0x4725('0x66')][_0x4725('0x67')];return db[_0x4725('0x32')]['find']({'where':{'id':_0x1f661d[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x2b521e,null))[_0x4725('0x16')](saveUpdates(_0x1f661d[_0x4725('0x56')],null))[_0x4725('0x16')](respondWithResult(_0x2b521e,null))['catch'](handleError(_0x2b521e,null));};exports['addCustomerAvatar']=function(_0x413b65,_0x1b77af){_0x413b65[_0x4725('0x56')][_0x4725('0x69')]=_0x413b65['file'][_0x4725('0x67')];return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0x413b65['params']['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x1b77af,null))['then'](saveUpdates(_0x413b65['body'],null))[_0x4725('0x16')](respondWithResult(_0x1b77af,null))[_0x4725('0x1f')](handleError(_0x1b77af,null));};exports[_0x4725('0x6a')]=function(_0x73a70d,_0x55a1f8){_0x73a70d[_0x4725('0x56')][_0x4725('0x6b')]=_0x73a70d['file'][_0x4725('0x67')];return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0x73a70d[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x55a1f8,null))[_0x4725('0x16')](saveUpdates(_0x73a70d[_0x4725('0x56')],null))['then'](respondWithResult(_0x55a1f8,null))[_0x4725('0x1f')](handleError(_0x55a1f8,null));};exports[_0x4725('0x6c')]=function(_0x4e3436,_0x3fdd45){var _0x31bf35=path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x6f'));var _0x10d08c={'where':{'id':_0x4e3436[_0x4725('0x4a')]['id']},'attributes':['id',_0x4725('0x65')],'raw':!![]};var _0x5c54bb=![];return require('../../config/license/util')['getLicense']()[_0x4725('0x16')](function(_0x3ce0b7){if(_0x3ce0b7){_0x5c54bb=_0x3ce0b7[_0x4725('0x70')];}})['then'](function(){return db[_0x4725('0x32')][_0x4725('0x51')](_0x10d08c);})[_0x4725('0x16')](handleEntityNotFound(_0x3fdd45,null))[_0x4725('0x16')](function(_0x3170b0){if(_0x3170b0){if(!_[_0x4725('0x71')](_0x3170b0[_0x4725('0x65')])){if(fs['existsSync'](path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x72'),_0x3170b0[_0x4725('0x65')]))&&_0x5c54bb){_0x31bf35=path[_0x4725('0x6d')](config['root'],_0x4725('0x72'),_0x3170b0[_0x4725('0x65')]);}}return _0x3fdd45['download'](_0x31bf35);}})[_0x4725('0x1f')](handleError(_0x3fdd45,null));};exports['getAvatar']=function(_0x2c280f,_0x5e87b0){var _0x520094=path['join'](config[_0x4725('0x6e')],'server/files/images/avatars/default_avatar.png');var _0x40ebd6={'where':{'id':_0x2c280f[_0x4725('0x4a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x4725('0x32')][_0x4725('0x51')](_0x40ebd6)[_0x4725('0x16')](handleEntityNotFound(_0x5e87b0,null))['then'](function(_0x2fe035){if(_0x2fe035){if(!_[_0x4725('0x71')](_0x2fe035['agentAvatar'])){if(fs[_0x4725('0x73')](path[_0x4725('0x6d')](config[_0x4725('0x6e')],'server/files/images/avatars/',_0x2fe035[_0x4725('0x74')]))){_0x520094=path[_0x4725('0x6d')](config['root'],'server/files/images/avatars/',_0x2fe035['agentAvatar']);}}return _0x5e87b0[_0x4725('0x75')](_0x520094);}})[_0x4725('0x1f')](handleError(_0x5e87b0,null));};exports['getCustomerAvatar']=function(_0x11de55,_0x547d68){var _0x1e0715=path[_0x4725('0x6d')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0xccc3d8={'where':{'id':_0x11de55[_0x4725('0x4a')]['id']},'attributes':['id',_0x4725('0x69'),_0x4725('0x76')],'raw':!![]};return db[_0x4725('0x32')][_0x4725('0x51')](_0xccc3d8)['then'](handleEntityNotFound(_0x547d68,null))[_0x4725('0x16')](function(_0x14c4e7){if(_0x14c4e7){if(!_[_0x4725('0x71')](_0x14c4e7[_0x4725('0x69')])){if(fs[_0x4725('0x73')](path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x77'),_0x14c4e7[_0x4725('0x69')]))&&_0x14c4e7['showCustomerAvatar']){_0x1e0715=path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x77'),_0x14c4e7[_0x4725('0x69')]);}}return _0x547d68['download'](_0x1e0715);}})[_0x4725('0x1f')](handleError(_0x547d68,null));};exports[_0x4725('0x78')]=function(_0x117163,_0xaa175a){var _0x43674d=path[_0x4725('0x6d')](config[_0x4725('0x6e')],'server/files/images/avatars/system_avatar.png');var _0x4a5c7e={'where':{'id':_0x117163['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x4725('0x32')][_0x4725('0x51')](_0x4a5c7e)[_0x4725('0x16')](handleEntityNotFound(_0xaa175a,null))['then'](function(_0x2f83bf){if(_0x2f83bf){if(!_['isNil'](_0x2f83bf['systemAvatar'])){if(fs[_0x4725('0x73')](path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x77'),_0x2f83bf[_0x4725('0x6b')]))){_0x43674d=path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0x77'),_0x2f83bf['systemAvatar']);}}return _0xaa175a[_0x4725('0x75')](_0x43674d);}})[_0x4725('0x1f')](handleError(_0xaa175a,null));};exports[_0x4725('0x79')]=function(_0x22c098,_0x1e244e){var _0x449e79=require(_0x4725('0x7a'));var _0x46de53=new _0x449e79();var _0x55bcc3=_0x46de53[_0x4725('0x7b')](_0x22c098[_0x4725('0x7c')]['user-agent'])['getResult']();var _0x2446d7={'body':_0x22c098[_0x4725('0x56')],'channel':_0x4725('0x7d')};var _0x269501=[];var _0x152a95=[];var _0x267c8e={};var _0x39a6ca=![];return db['CmContact'][_0x4725('0x57')]()[_0x4725('0x16')](function(_0x56d6e2){if(!_0x56d6e2){throw new db[(_0x4725('0x7e'))]['ValidationError'](_0x4725('0x7f'));}_0x269501=_['difference'](_[_0x4725('0x5b')](_0x56d6e2),[_0x4725('0x80'),_0x4725('0x81')]);_0x152a95=_['difference'](_[_0x4725('0x5b')](_0x56d6e2),[_0x4725('0x80'),'updatedAt',_0x4725('0x82'),'ListId']);if(_0x22c098[_0x4725('0x56')]['id']){delete _0x22c098[_0x4725('0x56')]['id'];}if(_[_0x4725('0x71')](_0x22c098['body'][_0x4725('0x83')])){throw new db[(_0x4725('0x7e'))][(_0x4725('0x84'))]('from\x20is\x20mandatory');}if(_[_0x4725('0x71')](_0x22c098[_0x4725('0x56')][_0x4725('0x56')])||_0x22c098['body'][_0x4725('0x56')]===''){throw new db[(_0x4725('0x7e'))]['ValidationError'](_0x4725('0x85'));}if(_[_0x4725('0x71')](_0x22c098['body'][_0x4725('0x86')])){throw new db[(_0x4725('0x7e'))][(_0x4725('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x152a95);}if(!_[_0x4725('0x87')](_0x152a95,_0x22c098[_0x4725('0x56')][_0x4725('0x86')])){throw new db[(_0x4725('0x7e'))]['ValidationError'](_0x4725('0x88')+_0x152a95);}_0x267c8e[_0x22c098[_0x4725('0x56')][_0x4725('0x86')]]=_0x22c098[_0x4725('0x56')][_0x4725('0x83')];})[_0x4725('0x16')](function(){return db[_0x4725('0x32')][_0x4725('0x51')]({'where':{'id':_0x22c098[_0x4725('0x4a')]['id']},'include':[{'model':db[_0x4725('0x89')],'as':_0x4725('0x8a'),'include':[{'model':db[_0x4725('0x8b')],'as':_0x4725('0x8c'),'where':_0x267c8e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x1e244e,null))['then'](function(_0x425a2f){if(_0x425a2f&&_0x425a2f[_0x4725('0x8a')]){_0x2446d7['account']=_0x425a2f;_0x2446d7[_0x4725('0x8d')]=_0x425a2f[_0x4725('0x8e')];_0x2446d7['list']=_0x425a2f[_0x4725('0x8a')];_0x2446d7['applications']=_[_0x4725('0x8f')](_0x2446d7[_0x4725('0x8d')],[_0x4725('0x90')],['asc']);if(_0x2446d7['account']['Applications']){delete _0x2446d7['account'][_0x4725('0x8e')];}if(_0x2446d7[_0x4725('0x91')][_0x4725('0x8a')]&&_0x2446d7[_0x4725('0x91')]['List'][_0x4725('0x8c')][_0x4725('0x3c')]){return _0x2446d7['account'][_0x4725('0x8a')]['Contacts'][0x0];}var _0x4afae8=_[_0x4725('0xd')](_0x22c098[_0x4725('0x56')],{'firstName':_0x22c098[_0x4725('0x56')][_0x4725('0x83')],'ListId':_0x425a2f['ListId']});_0x4afae8[_0x22c098[_0x4725('0x56')][_0x4725('0x86')]]=_0x22c098[_0x4725('0x56')][_0x4725('0x83')];return db['CmContact'][_0x4725('0x54')](_0x4afae8,{'fields':_0x269501,'raw':!![]});}})[_0x4725('0x16')](handleEntityNotFound(_0x1e244e,null))[_0x4725('0x16')](function(_0x4a6d6a){_0x2446d7[_0x4725('0x92')]=_0x4a6d6a;var _0x431f27=_0x22c098[_0x4725('0x56')]['customerIp'];if(_0x22c098[_0x4725('0x7c')]['cf-connecting-ip']){_0x431f27=_0x22c098['headers'][_0x4725('0x93')];}else if(_0x22c098[_0x4725('0x7c')][_0x4725('0x94')]){_0x431f27=_['first'](_0x22c098[_0x4725('0x7c')][_0x4725('0x94')][_0x4725('0x95')](','));}if(_0x4a6d6a){var _0x1a77d5={'ContactId':_0x4a6d6a['id'],'ChatWebsiteId':_0x22c098['params']['id'],'from':(_0x4a6d6a[_0x4725('0x96')]||'')+'\x20'+(_0x4a6d6a[_0x4725('0x97')]||''),'customerIp':_0x431f27,'customerPort':_0x22c098['headers'][_0x4725('0x98')]?_0x22c098[_0x4725('0x7c')][_0x4725('0x98')]:null,'referer':_0x22c098['body'][_0x4725('0x99')],'browserName':_0x55bcc3[_0x4725('0x9a')]['name']&&_0x55bcc3['browser'][_0x4725('0x9b')]?util['format'](_0x4725('0x9c'),_0x55bcc3['browser']['name'],_0x55bcc3[_0x4725('0x9a')][_0x4725('0x9b')]):_0x4725('0x9d'),'browserVersion':_0x55bcc3[_0x4725('0x9a')]['version']||_0x4725('0x9d'),'osName':util[_0x4725('0x9e')](_0x4725('0x9c'),_0x55bcc3['os'][_0x4725('0x47')],_0x55bcc3['os'][_0x4725('0x9b')]),'osVersion':_0x55bcc3['os'][_0x4725('0x9b')],'deviceModel':_0x55bcc3[_0x4725('0x9f')][_0x4725('0x36')]&&_0x55bcc3[_0x4725('0x9f')]['vendor']?util['format']('%s\x20%s\x20%s',_0x55bcc3[_0x4725('0x9f')][_0x4725('0x36')],_0x55bcc3[_0x4725('0x9f')][_0x4725('0xa0')],_0x55bcc3[_0x4725('0x9f')][_0x4725('0x45')]):null,'deviceVendor':_0x55bcc3['device']['vendor'],'deviceType':_0x55bcc3[_0x4725('0x9f')][_0x4725('0x45')],'formData':JSON[_0x4725('0xa1')](_0x22c098[_0x4725('0x56')])};var _0x15fca4={'ChatWebsiteId':_0x22c098['params']['id'],'closed':![]};if(_0x22c098[_0x4725('0x56')]['threadId']){_0x15fca4[_0x4725('0xa2')]=_0x22c098['body'][_0x4725('0xa2')];return db['ChatInteraction']['find']({'where':_0x15fca4})[_0x4725('0x16')](function(_0x41c087){if(_0x41c087){return[_0x41c087,![]];}_0x1a77d5[_0x4725('0xa2')]=_0x22c098['body'][_0x4725('0xa2')];_0x1a77d5[_0x4725('0xa3')]=_0x22c098[_0x4725('0x56')]['externalUrl'];return db[_0x4725('0xa4')][_0x4725('0x54')](_0x1a77d5)['then'](function(_0x3a9e17){return[_0x3a9e17,!![]];});});}_0x15fca4[_0x4725('0xa5')]=_0x4a6d6a['id'];if(_0x22c098[_0x4725('0x56')][_0x4725('0xa6')]&&_0x22c098[_0x4725('0x56')]['interaction']['id']){_0x15fca4['id']=_0x22c098['body'][_0x4725('0xa6')]['id'];return db[_0x4725('0xa4')]['find']({'where':_0x15fca4})[_0x4725('0x16')](function(_0x3e4237){if(_0x3e4237){return[_0x3e4237,![]];}return db[_0x4725('0xa4')]['create'](_0x1a77d5)[_0x4725('0x16')](function(_0x3ae973){return[_0x3ae973,!![]];});});}return db['ChatInteraction']['create'](_0x1a77d5)['then'](function(_0x517edc){return[_0x517edc,!![]];});}})['spread'](function(_0x1e0db4,_0x4317e2){if(_0x1e0db4){_0x39a6ca=_0x4317e2;if(!_0x4317e2){var _0x231192={'from':(_0x2446d7[_0x4725('0x92')]['firstName']||'')+'\x20'+(_0x2446d7[_0x4725('0x92')][_0x4725('0x97')]||'')};if(_0x22c098[_0x4725('0x56')]['threadId']&&_0x22c098[_0x4725('0x56')][_0x4725('0xa7')]&&_0x22c098[_0x4725('0x56')][_0x4725('0xa2')]!=_0x22c098[_0x4725('0x56')][_0x4725('0xa7')]){_0x231192[_0x4725('0xa2')]=_0x22c098[_0x4725('0x56')][_0x4725('0xa7')];}return _0x1e0db4[_0x4725('0x29')](_0x231192);}else{return _0x1e0db4;}}})[_0x4725('0x16')](function(_0x1aa4da){_0x2446d7[_0x4725('0xa6')]=_0x1aa4da[_0x4725('0x2b')]({'plain':!![]});_0x2446d7[_0x4725('0xa6')][_0x4725('0xa8')]=_0x39a6ca;if(_0x2446d7['interaction']['created']){if(_0x2446d7[_0x4725('0x91')][_0x4725('0xa9')]){_0x2446d7['applications']['push']({'id':0x0,'priority':_0x2446d7[_0x4725('0x8d')][_0x4725('0x3c')]+0x1,'app':_0x4725('0xaa'),'appdata':_0x4725('0xab'),'interval':_0x4725('0xac')});}}return db[_0x4725('0xad')][_0x4725('0x54')]({'body':_0x22c098['body']['body'],'ChatWebsiteId':_0x22c098[_0x4725('0x4a')]['id'],'ChatInteractionId':_0x1aa4da['id'],'direction':'in','ContactId':_0x2446d7['contact']['id'],'AttachmentId':_0x22c098[_0x4725('0x56')][_0x4725('0xae')]});})['then'](function(_0x436928){_0x2446d7[_0x4725('0x1d')]=_0x436928;if(_0x2446d7['interaction'][_0x4725('0xaf')]){return db['User'][_0x4725('0x51')]({'attributes':['id',_0x4725('0x47')],'where':{'id':_0x2446d7[_0x4725('0xa6')][_0x4725('0xaf')]}})[_0x4725('0x16')](function(_0x116cfb){if(_0x116cfb){_0x2446d7[_0x4725('0x8d')][_0x4725('0xb0')]({'id':0x0,'priority':0x0,'app':_0x4725('0xb1'),'appdata':_0x116cfb[_0x4725('0x47')]+','+(_0x2446d7['account'][_0x4725('0xb2')]||0xa),'interval':_0x4725('0xac')});_0x2446d7[_0x4725('0xb3')]=!![];}return respondWithRpcPromise(_0x4725('0xb4'),_0x4725('0xb5'),_0x2446d7);});}return respondWithRpcPromise('Start','startRouting',_0x2446d7);})[_0x4725('0x16')](function(_0xc74e9a){respondWithRpcPromise(_0x4725('0xb6'),'EventManager',{'event':_0x4725('0x79'),'message':_0xc74e9a},client9002);return _0xc74e9a;})['then'](respondWithResult(_0x1e244e,null))['catch'](handleError(_0x1e244e,null));};exports[_0x4725('0xb7')]=function(_0x47fc01,_0x21a2a1){var _0x2dcc8f,_0x4c454c,_0x6f8a07;var _0x38a6c3=[];var _0xb2f5ed={};var _0x4e8567=_0x47fc01[_0x4725('0xb8')]||[];var _0x1737a2=[];var _0x2f7081;return db['CmContact'][_0x4725('0x57')]()[_0x4725('0x16')](function(_0x12fbab){if(!_0x12fbab){throw new db[(_0x4725('0x7e'))][(_0x4725('0x84'))](_0x4725('0x7f'));}_0x38a6c3=_[_0x4725('0xb9')](_['keys'](_0x12fbab),[_0x4725('0x80'),_0x4725('0x81'),'CompanyId',_0x4725('0xba')]);if(_0x47fc01[_0x4725('0x56')]['id']){delete _0x47fc01[_0x4725('0x56')]['id'];}if(_[_0x4725('0x71')](_0x47fc01[_0x4725('0x56')][_0x4725('0x83')])){throw _0x21a2a1[_0x4725('0x21')](0x1f4)[_0x4725('0x2e')](new db[(_0x4725('0x7e'))][(_0x4725('0x84'))](_0x4725('0xbb')));}if(_[_0x4725('0x71')](_0x47fc01['body'][_0x4725('0x56')])||_0x47fc01[_0x4725('0x56')][_0x4725('0x56')]===''){throw _0x21a2a1[_0x4725('0x21')](0x1f4)[_0x4725('0x2e')](new db[(_0x4725('0x7e'))]['ValidationError'](_0x4725('0x85')));}if(_[_0x4725('0x71')](_0x47fc01[_0x4725('0x56')][_0x4725('0xbc')])){throw _0x21a2a1[_0x4725('0x21')](0x1f4)[_0x4725('0x2e')](new db['Sequelize']['ValidationError'](_0x4725('0xbd')+_0x38a6c3));}if(!_[_0x4725('0x87')](_0x38a6c3,_0x47fc01[_0x4725('0x56')][_0x4725('0xbc')])){throw _0x21a2a1[_0x4725('0x21')](0x1f4)[_0x4725('0x2e')](new db['Sequelize'][(_0x4725('0x84'))](_0x4725('0xbe')+_0x38a6c3));}_0xb2f5ed[_0x47fc01['body'][_0x4725('0xbc')]]=_0x47fc01['body']['from'];})[_0x4725('0x16')](function(){return db[_0x4725('0x32')]['find']({'where':{'id':_0x47fc01[_0x4725('0x4a')]['id']},'include':[{'model':db[_0x4725('0x89')],'as':_0x4725('0x8a')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x4725('0x16')](handleEntityNotFound(_0x21a2a1,null))[_0x4725('0x16')](function(_0x11783d){if(_0x11783d&&_0x11783d[_0x4725('0x8a')]){_0x4c454c=_0x11783d;var _0x3ad05a=_[_0x4725('0xd')](_0x47fc01[_0x4725('0x56')],{'firstName':_0x47fc01[_0x4725('0x56')][_0x4725('0x83')],'phone':_0x47fc01[_0x4725('0x56')][_0x4725('0x83')],'ListId':_0x11783d[_0x4725('0xba')]});_0x3ad05a[_0x47fc01[_0x4725('0x56')][_0x4725('0xbc')]]=_0x47fc01[_0x4725('0x56')][_0x4725('0x83')];return db[_0x4725('0x8b')][_0x4725('0xbf')]({'where':_0xb2f5ed,'defaults':_0x3ad05a});}})[_0x4725('0xc0')](function(_0x400dbe){if(_0x400dbe){_0x6f8a07=_0x400dbe;var _0x5c7aca=fs[_0x4725('0xc1')](path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0xc2')),_0x4725('0xc3'));var _0x51c7c5=ejs[_0x4725('0xc4')](_0x5c7aca,{'body':_[_0x4725('0xc5')](_0x47fc01[_0x4725('0x56')]['body']),'bodyTitle':_0x4c454c[_0x4725('0xc6')]});return db[_0x4725('0xc7')][_0x4725('0x54')]({'body':_0x51c7c5,'plainBody':htmlToText[_0x4725('0xc8')](_0x51c7c5),'ContactId':_0x400dbe['id'],'ChatWebsiteId':_0x4c454c['id']});}})[_0x4725('0x16')](function(_0x865260){_0x2f7081=_0x865260;if(_0x4e8567[_0x4725('0x3c')]){var _0x405f12=_0x4e8567['map'](function(_0x4b73cf){return{'name':_0x4b73cf[_0x4725('0xc9')],'basename':_0x4b73cf[_0x4725('0x67')],'type':_0x4b73cf[_0x4725('0xca')],'ChatOfflineMessageId':_0x865260['id']};});_0x1737a2=_0x405f12['map'](_0xd1a18=>{var _0x221c47={'filename':_0xd1a18[_0x4725('0x47')],'path':path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0xcb'),_0x4725('0xb8'),_0x4725('0xcc'),_0x4725('0xcd'),_0xd1a18['basename'])};return _0x221c47;});if(!_0x4c454c[_0x4725('0xce')]){return db[_0x4725('0xcf')][_0x4725('0xd0')](function(_0x114543){return db['Attachment'][_0x4725('0xd1')](_0x405f12,{'transaction':_0x114543});});}}})['then'](function(){if(_0x2f7081){_0x2dcc8f=_0x2f7081;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4725('0xd2')],'as':_0x4725('0xd3'),'raw':!![],'include':[{'model':db[_0x4725('0xd4')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x4f210d){if(_0x4f210d&&_0x4f210d['Smtp']&&_0x4c454c[_0x4725('0xd5')]&&_0x4c454c[_0x4725('0xd6')]){var _0x5be7e5=_0x4f210d['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x4725('0xd7'),{'account':_0x5be7e5,'message':{'from':util[_0x4725('0x9e')](_0x4725('0xd8'),_0x4f210d[_0x4725('0x47')],_0x4f210d[_0x4725('0xd9')]||_0x4f210d[_0x4725('0xd3')][_0x4725('0x4e')]),'to':_0x4c454c['forwardOfflineAddress'],'subject':_0x4c454c['offlineMessageSubject'],'html':_0x2dcc8f[_0x4725('0x56')],'attachments':_0x1737a2}},client9003)[_0x4725('0x16')](function(){return _0x2dcc8f;})[_0x4725('0x1f')](function(_0x19a0a3){logger[_0x4725('0x1b')](_0x19a0a3);});}})[_0x4725('0x16')](function(){if(_0x4c454c&&_0x4c454c[_0x4725('0xce')]&&_0x4c454c[_0x4725('0xda')]){var _0x21992e=[];if(_0x4e8567[_0x4725('0x3c')]){_0x21992e=_0x4e8567[_0x4725('0x37')](function(_0x25ad91){return{'name':_0x25ad91[_0x4725('0xc9')],'basename':_0x25ad91[_0x4725('0x67')],'type':_0x25ad91['mimetype'],'ChatOfflineMessageId':_0x2f7081['id']};});}var _0x1f8842;if(!_[_0x4725('0x71')](_0x4c454c[_0x4725('0xdb')])){var _0x36ebe9=_[_0x4725('0x37')](_0x47fc01[_0x4725('0x56')],function(_0x190ef5){return _0x190ef5;});var _0x37fc4f=_[_0x4725('0xdc')](_0x36ebe9)[0x0];var _0x3c3992=_[_0x4725('0xdd')](_0x37fc4f,function(_0x1bb001){return _0x1bb001;});_0x1f8842=_0x3c3992[0x1][_0x4c454c[_0x4725('0xdb')]];}var _0x1eb0e0={'from':_0x6f8a07[_0x4725('0xd9')],'firstName':_0x6f8a07[_0x4725('0x96')],'lastName':_0x6f8a07[_0x4725('0x97')],'mapKey':_0x4725('0xd9'),'message':{'from':_0x6f8a07[_0x4725('0xd9')],'to':_0x4c454c['MailAccount'][_0x4725('0xd9')],'cc':'','subject':_['isNil'](_0x1f8842)?_0x4c454c[_0x4725('0xde')]:_0x1f8842,'messageId':'','sentAt':new Date(),'attach':_0x21992e[_0x4725('0x3c')],'attachments':_0x21992e,'originChannel':_0x4725('0xdf'),'ChatWebsiteId':_0x4c454c['id'],'ChatOfflineMessageId':_0x2dcc8f['id'],'originTo':_0x4c454c[_0x4725('0xe0')][_0x4725('0xd9')]},'body':_0x2dcc8f[_0x4725('0x56')]};var _0x5a1ac9={'account':{'id':_0x4c454c['MailAccountId']},'body':_0x1eb0e0,'log':_0x4725('0xe1')};return respondWithRpcPromise('NotifyMailAccount',_0x4725('0xe2'),_0x5a1ac9,client9001)[_0x4725('0x16')](function(){return _0x2dcc8f;})['catch'](function(_0x34cea9){logger[_0x4725('0x1b')](_0x34cea9);});}return;})[_0x4725('0x16')](function(){if(_0x2dcc8f){return _0x2dcc8f;}})[_0x4725('0x16')](respondWithResult(_0x21a2a1,null))['catch'](function(_0x5b219c){logger['error'](_0x4725('0x1f'),_0x5b219c);for(var _0x21c3ca of _0x4e8567){var _0x44cb64=path[_0x4725('0x6d')](config[_0x4725('0x6e')],_0x4725('0xcb'),_0x4725('0xb8'),'attachments',_0x4725('0xcd'),_0x21c3ca[_0x4725('0x67')]);fs_extra[_0x4725('0xe3')](_0x44cb64)[_0x4725('0x1f')](function(_0x56c65a){logger[_0x4725('0x1b')](_0x4725('0xe4'),_0x44cb64,_0x56c65a);});}});};exports['addInteraction']=function(_0x4a4548,_0x4defea){return db['ChatInteraction'][_0x4725('0x51')]({'where':{'id':_0x4a4548['params']['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x4defea,null))[_0x4725('0x16')](function(_0x3ebab6){if(_0x3ebab6){return _0x3ebab6[_0x4725('0xe5')](_0x4a4548[_0x4725('0x56')]['ids'],_[_0x4725('0xe6')](_0x4a4548[_0x4725('0x56')],[_0x4725('0x60'),'id'])||{});}})['then'](respondWithResult(_0x4defea,null))['catch'](handleError(_0x4defea,null));};exports[_0x4725('0xe7')]=function(_0x37bd01,_0x45ea55){var _0x5d411c={'raw':![],'where':{}};var _0x2e1d7c={};var _0x43ce61={'count':0x0,'rows':[]};return db[_0x4725('0x32')][_0x4725('0x5a')]({'where':{'id':_0x37bd01[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x45ea55,null))[_0x4725('0x16')](function(_0xb2237c){if(_0xb2237c){_0x2e1d7c[_0x4725('0x36')]=_[_0x4725('0x5b')](db[_0x4725('0xa4')][_0x4725('0x33')]);_0x2e1d7c['query']=_[_0x4725('0x5b')](_0x37bd01[_0x4725('0x38')]);_0x2e1d7c[_0x4725('0x42')]=_['intersection'](_0x2e1d7c[_0x4725('0x36')],_0x2e1d7c[_0x4725('0x38')]);_0x5d411c[_0x4725('0x3a')]=_[_0x4725('0x39')](_0x2e1d7c['model'],qs[_0x4725('0x3b')](_0x37bd01[_0x4725('0x38')][_0x4725('0x3b')]));_0x5d411c['attributes']=_0x5d411c[_0x4725('0x3a')][_0x4725('0x3c')]?_0x5d411c['attributes']:_0x2e1d7c[_0x4725('0x36')];if(!_0x37bd01[_0x4725('0x38')][_0x4725('0x3d')](_0x4725('0x3e'))){_0x5d411c[_0x4725('0x25')]=qs[_0x4725('0x25')](_0x37bd01[_0x4725('0x38')][_0x4725('0x25')]);_0x5d411c[_0x4725('0x23')]=qs[_0x4725('0x23')](_0x37bd01['query'][_0x4725('0x23')]);}_0x5d411c[_0x4725('0x3f')]=qs['sort'](_0x37bd01[_0x4725('0x38')][_0x4725('0x40')]);_0x5d411c[_0x4725('0x41')]=qs['filters'](_[_0x4725('0x5d')](_0x37bd01[_0x4725('0x38')],_0x2e1d7c[_0x4725('0x42')]));_0x5d411c['where'][_0x4725('0x59')]=_0xb2237c['id'];if(_0x37bd01['query'][_0x4725('0x43')]){_0x5d411c[_0x4725('0x41')]=_[_0x4725('0x44')](_0x5d411c[_0x4725('0x41')],{'$or':_[_0x4725('0x37')](_0x5d411c[_0x4725('0x3a')],function(_0x573f56){var _0xd63070={};_0xd63070[_0x573f56]={'$like':'%'+_0x37bd01[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0xd63070;})});}_0x5d411c=_[_0x4725('0x44')]({},_0x5d411c,_0x37bd01['options']);return db[_0x4725('0xa4')][_0x4725('0x26')]({'where':_0x5d411c['where']})[_0x4725('0x16')](function(_0x4a942f){_0x43ce61['count']=_0x4a942f;if(_0x37bd01[_0x4725('0x38')][_0x4725('0x4b')]){_0x5d411c[_0x4725('0x4c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4725('0xe8')],'as':_0x4725('0xe9'),'attributes':[_0x4725('0x47'),_0x4725('0xea'),_0x4725('0xeb')],'required':![]},{'model':db[_0x4725('0xec')],'as':_0x4725('0xed'),'attributes':['id',_0x4725('0x47'),_0x4725('0xee')],'where':_0x37bd01[_0x4725('0x38')][_0x4725('0xef')]?{'id':_0x37bd01['query'][_0x4725('0xef')]}:undefined,'required':_0x37bd01[_0x4725('0x38')][_0x4725('0xef')]?!![]:![]}];}return db[_0x4725('0xa4')]['findAll'](_0x5d411c);})[_0x4725('0x16')](function(_0xfe5f59){_0x43ce61['rows']=_0xfe5f59;return _0x43ce61;});}})['then'](respondWithFilteredResult(_0x45ea55,_0x5d411c))[_0x4725('0x1f')](handleError(_0x45ea55,null));};function iftimePromise(_0x4be39f,_0x2a0da6){return respondWithRpcPromise(_0x4725('0xf0'),_0x4725('0xf1'),{'command':_0x2a0da6[_0x4725('0xf2')]?util['format'](_0x4725('0xf3'),_0x4be39f[_0x4725('0xf4')],_0x2a0da6[_0x4725('0xf2')]):util[_0x4725('0x9e')](_0x4725('0xf5'),_0x4be39f['interval'])},client9002)[_0x4725('0x16')](function(_0x20c62a){var _0x31081a=_0x20c62a&&_0x20c62a[_0x4725('0xf6')](_0x4725('0xf7'))>=0x0?!![]:![];logger[_0x4725('0x1e')](_0x4725('0xf8'),_0x2a0da6['id'],_0x4be39f['id'],_0x4be39f[_0x4725('0xf4')],_0x31081a?'ONLINE':_0x4725('0xf9'),_0x2a0da6[_0x4725('0xf2')]?_0x2a0da6['timezone']:_0x4725('0xfa'));return _0x31081a;})['catch'](function(_0x3faef4){logger['error'](_0x4725('0xf8'),_0x2a0da6['id'],_0x4be39f['id'],_0x4be39f[_0x4725('0xf4')],util[_0x4725('0xfb')](_0x3faef4,{'showHidden':![],'depth':null}),_0x2a0da6[_0x4725('0xf2')]?_0x2a0da6[_0x4725('0xf2')]:_0x4725('0xfa'));return![];});}exports[_0x4725('0xf1')]=function(_0x9ce227,_0x44ecd6){var _0x3a1f86=0x0;var _0x3922f5=0x0;var _0x23a09f=![];var _0x34fe09;var _0x16d71f;return db[_0x4725('0x32')]['find']({'where':{'id':_0x9ce227[_0x4725('0x4a')]['id']},'include':[{'model':db['Interval'],'as':_0x4725('0xfc'),'include':[{'model':db[_0x4725('0xfc')],'as':_0x4725('0xfd'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x4725('0x16')](handleEntityNotFound(_0x44ecd6,null))[_0x4725('0x16')](function(_0x44785d){if(_0x44785d){_0x34fe09=_0x44785d;return _0x44785d[_0x4725('0xfe')]({'raw':!![]});}})[_0x4725('0x16')](function(_0x4016c4){if(_0x34fe09){if(_0x4016c4){_0x16d71f=_0x4016c4;}}return require(_0x4725('0xff'))['getLicense']();})['then'](function(_0xc1b6ab){if(_0xc1b6ab){_0x3922f5=_0xc1b6ab[_0x4725('0x100')];_0x23a09f=_0xc1b6ab[_0x4725('0x70')];}})[_0x4725('0x16')](function(){return db[_0x4725('0xa4')][_0x4725('0x26')]({'where':{'closed':![]}});})[_0x4725('0x16')](function(_0x3c5c71){_0x3a1f86=_0x3c5c71;if(_0x3922f5&&_0x3c5c71>_0x3922f5){return db[_0x4725('0x101')][_0x4725('0x5a')]({'where':{'id':0x1}})[_0x4725('0x16')](function(_0x4f3ab0){if(_0x4f3ab0){_0x4f3ab0[_0x4725('0x102')](_0x4725('0x103'));}});}})[_0x4725('0x16')](function(){if(_0x34fe09[_0x4725('0xfc')]&&_0x34fe09[_0x4725('0xfc')][_0x4725('0xfd')]){var _0x198e13=[];for(var _0x2d0aab=0x0;_0x2d0aab<_0x34fe09[_0x4725('0xfc')][_0x4725('0xfd')][_0x4725('0x3c')];_0x2d0aab++){var _0xe4ce75=_0x34fe09[_0x4725('0xfc')]['Intervals'][_0x2d0aab][_0x4725('0x2b')]({'plain':!![]});_0x198e13[_0x4725('0x104')](iftimePromise(_0xe4ce75,_0x34fe09));}return BPromise['all'](_0x198e13)[_0x4725('0x16')](function(_0x59926d){return _['some'](_0x59926d);});}else{return!![];}})[_0x4725('0x16')](function(_0x1301f5){var _0x519ac5=fs[_0x4725('0xc1')](path[_0x4725('0x6d')](config['root'],_0x4725('0x105')),_0x4725('0xc3'));var _0x455632=new url[(_0x4725('0x106'))](_0x34fe09['address'])[_0x4725('0x107')];var _0xe9b37a=_0x4725('0x108');var _0x561651=![];var _0x2ab7b6={'chatVersion':_0xe9b37a,'chatWebsiteAddressOrigin':_0x455632,'remote':_0x34fe09['remote'],'query':querystring['stringify'](_[_0x4725('0x44')](_0x34fe09['get']({'plain':!![]}),{'customerIp':_0x9ce227[_0x4725('0x7c')][_0x4725('0x94')]||_0x9ce227[_0x4725('0x7c')][_0x4725('0x109')]||_0x9ce227[_0x4725('0x10a')][_0x4725('0x10b')]||_0x9ce227['ip'],'referer':_0x9ce227[_0x4725('0x7c')]['referer'],'openedInteractions':_0x3a1f86,'maxInteractions':_0x3922f5,'virtual':_0x23a09f[_0x4725('0x100')],'online':_0x1301f5,'custom':_0x23a09f}))[_0x4725('0x10c')](/'/g,'\x5c\x27')};_0x44ecd6[_0x4725('0x2e')](ejs[_0x4725('0xc4')](Mustache[_0x4725('0xc4')](_0x519ac5,_0x2ab7b6),{'proactiveActions':_0x16d71f,'alignment':_0x34fe09[_0x4725('0x10d')],'verticalAlignment':_0x34fe09['verticalAlignment'],'div_color':_0x34fe09[_0x4725('0xee')],'labelText':_0x34fe09['labelText'],'text_color':_0x34fe09['textColor'],'text_button_color':_0x34fe09['textButtonColor'],'button_color':_0x34fe09['color_button'],'background_color':_0x34fe09[_0x4725('0x10e')],'hideWhenOffline':_0x34fe09[_0x4725('0x10f')],'intervalId':_0x34fe09[_0x4725('0x110')],'isDevelopment':_0x561651,'chatVersion':_0xe9b37a}));})[_0x4725('0x1f')](handleError(_0x44ecd6,null));};exports['addApplications']=function(_0x2ddc6d,_0x396c05){var _0x530c89=_0x2ddc6d['params']['id'];var _0x3daa60=_0x2ddc6d[_0x4725('0x56')];var _0x56dd9d=0xc8;var _0x1e3259=null;return db[_0x4725('0xcf')]['transaction']({'isolationLevel':db[_0x4725('0xcf')]['Transaction'][_0x4725('0x111')][_0x4725('0x112')]},function(_0x529e1e){return db[_0x4725('0x32')][_0x4725('0x5a')]({'where':{'id':_0x530c89},'transaction':_0x529e1e})[_0x4725('0x16')](function(_0x3901fd){if(_0x3901fd){return db[_0x4725('0x113')][_0x4725('0x2a')]({'where':{'ChatWebsiteId':_0x530c89},'transaction':_0x529e1e})[_0x4725('0x16')](function(){var _0x2c0012=_[_0x4725('0x37')](_0x3daa60,function(_0x3ba148){_0x3ba148[_0x4725('0x59')]=_0x530c89;return _0x3ba148;});return db['ChatApplication'][_0x4725('0xd1')](_0x2c0012,{'transaction':_0x529e1e});});}else{_0x56dd9d=0x194;_0x1e3259=[];}});})[_0x4725('0x16')](function(){if(_0x56dd9d!==0x194){return db['ChatApplication'][_0x4725('0x114')]({'where':{'ChatWebsiteId':_0x530c89},'order':_0x4725('0x90')})[_0x4725('0x16')](function(_0x490fdb){_0x1e3259=_0x490fdb;});}})['catch'](function(_0x8b3613){_0x56dd9d=0x1f4;logger[_0x4725('0x1b')](_0x8b3613['stack']);if(_0x8b3613[_0x4725('0x47')]){delete _0x8b3613[_0x4725('0x47')];}_0x1e3259=_0x8b3613;})[_0x4725('0x115')](function(){if(_0x1e3259===null){_0x396c05[_0x4725('0x20')](_0x56dd9d);}else{if(_0x56dd9d===0x1f4){_0x396c05[_0x4725('0x21')](_0x56dd9d)['send'](_0x1e3259);}else{_0x396c05['status'](_0x56dd9d)[_0x4725('0x22')](_0x1e3259);}}});};exports['getApplications']=function(_0x144ef5,_0xd3229c){var _0x41acf7={};var _0x62fac7={};var _0x486f1b;var _0x34ee40;return db[_0x4725('0x32')]['findOne']({'where':{'id':_0x144ef5[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0xd3229c,null))[_0x4725('0x16')](function(_0x250fa9){if(_0x250fa9){_0x486f1b=_0x250fa9;_0x62fac7['model']=_[_0x4725('0x5b')](db[_0x4725('0x113')][_0x4725('0x33')]);_0x62fac7[_0x4725('0x38')]=_[_0x4725('0x5b')](_0x144ef5[_0x4725('0x38')]);_0x62fac7['filters']=_[_0x4725('0x39')](_0x62fac7[_0x4725('0x36')],_0x62fac7[_0x4725('0x38')]);_0x41acf7[_0x4725('0x3a')]=_['intersection'](_0x62fac7[_0x4725('0x36')],qs[_0x4725('0x3b')](_0x144ef5[_0x4725('0x38')]['fields']));_0x41acf7[_0x4725('0x3a')]=_0x41acf7['attributes'][_0x4725('0x3c')]?_0x41acf7['attributes']:_0x62fac7[_0x4725('0x36')];_0x41acf7['order']=qs['sort'](_0x144ef5['query'][_0x4725('0x40')]);_0x41acf7['where']=qs['filters'](_[_0x4725('0x5d')](_0x144ef5['query'],_0x62fac7[_0x4725('0x42')]));if(_0x144ef5[_0x4725('0x38')][_0x4725('0x43')]){_0x41acf7[_0x4725('0x41')]=_['merge'](_0x41acf7['where'],{'$or':_[_0x4725('0x37')](_0x41acf7[_0x4725('0x3a')],function(_0x45593b){var _0x207398={};_0x207398[_0x45593b]={'$like':'%'+_0x144ef5[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0x207398;})});}_0x41acf7=_[_0x4725('0x44')]({},_0x41acf7,_0x144ef5[_0x4725('0x4d')]);return _0x486f1b[_0x4725('0x116')](_0x41acf7);}})[_0x4725('0x16')](function(_0xd080eb){if(_0xd080eb){_0x34ee40=_0xd080eb[_0x4725('0x3c')];if(!_0x144ef5[_0x4725('0x38')][_0x4725('0x3d')]('nolimit')){_0x41acf7['limit']=qs[_0x4725('0x25')](_0x144ef5[_0x4725('0x38')][_0x4725('0x25')]);_0x41acf7[_0x4725('0x23')]=qs[_0x4725('0x23')](_0x144ef5['query'][_0x4725('0x23')]);}return _0x486f1b[_0x4725('0x116')](_0x41acf7);}})[_0x4725('0x16')](function(_0x2513f6){if(_0x2513f6){return _0x2513f6?{'count':_0x34ee40,'rows':_0x2513f6}:null;}})[_0x4725('0x16')](respondWithResult(_0xd3229c,null))[_0x4725('0x1f')](handleError(_0xd3229c,null));};exports[_0x4725('0x117')]=function(_0x4d4547,_0x2094ac){return db[_0x4725('0x118')]['find']({'where':{'id':_0x4d4547[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x2094ac,null))['then'](function(_0x204cbb){if(_0x204cbb){return _0x204cbb[_0x4725('0x117')](_0x4d4547[_0x4725('0x56')][_0x4725('0x60')],_['omit'](_0x4d4547[_0x4725('0x56')],[_0x4725('0x60'),'id'])||{});}})['then'](respondWithResult(_0x2094ac,null))[_0x4725('0x1f')](handleError(_0x2094ac,null));};exports[_0x4725('0xfe')]=function(_0x2b46a4,_0x7ca344){var _0x285439={};var _0x34d4c2={};var _0x22ea7f;var _0x466386;return db['ChatWebsite'][_0x4725('0x5a')]({'where':{'id':_0x2b46a4['params']['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x7ca344,null))[_0x4725('0x16')](function(_0x4ed9fb){if(_0x4ed9fb){_0x22ea7f=_0x4ed9fb;_0x34d4c2['model']=_[_0x4725('0x5b')](db[_0x4725('0x119')][_0x4725('0x33')]);_0x34d4c2[_0x4725('0x38')]=_['keys'](_0x2b46a4[_0x4725('0x38')]);_0x34d4c2[_0x4725('0x42')]=_[_0x4725('0x39')](_0x34d4c2[_0x4725('0x36')],_0x34d4c2[_0x4725('0x38')]);_0x285439['attributes']=_['intersection'](_0x34d4c2['model'],qs[_0x4725('0x3b')](_0x2b46a4[_0x4725('0x38')][_0x4725('0x3b')]));_0x285439['attributes']=_0x285439[_0x4725('0x3a')][_0x4725('0x3c')]?_0x285439[_0x4725('0x3a')]:_0x34d4c2[_0x4725('0x36')];_0x285439[_0x4725('0x3f')]=qs[_0x4725('0x40')](_0x2b46a4[_0x4725('0x38')][_0x4725('0x40')]);_0x285439[_0x4725('0x41')]=qs[_0x4725('0x42')](_[_0x4725('0x5d')](_0x2b46a4[_0x4725('0x38')],_0x34d4c2[_0x4725('0x42')]));if(_0x2b46a4['query'][_0x4725('0x43')]){_0x285439[_0x4725('0x41')]=_['merge'](_0x285439[_0x4725('0x41')],{'$or':_[_0x4725('0x37')](_0x285439[_0x4725('0x3a')],function(_0xceeaf3){var _0x5637bb={};_0x5637bb[_0xceeaf3]={'$like':'%'+_0x2b46a4[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0x5637bb;})});}_0x285439=_[_0x4725('0x44')]({},_0x285439,_0x2b46a4['options']);return _0x22ea7f[_0x4725('0xfe')](_0x285439);}})[_0x4725('0x16')](function(_0x1819b5){if(_0x1819b5){_0x466386=_0x1819b5['length'];if(!_0x2b46a4['query'][_0x4725('0x3d')](_0x4725('0x3e'))){_0x285439[_0x4725('0x25')]=qs[_0x4725('0x25')](_0x2b46a4[_0x4725('0x38')]['limit']);_0x285439[_0x4725('0x23')]=qs[_0x4725('0x23')](_0x2b46a4['query'][_0x4725('0x23')]);}return _0x22ea7f[_0x4725('0xfe')](_0x285439);}})[_0x4725('0x16')](function(_0x39dacb){if(_0x39dacb){return _0x39dacb?{'count':_0x466386,'rows':_0x39dacb}:null;}})['then'](respondWithResult(_0x7ca344,null))[_0x4725('0x1f')](handleError(_0x7ca344,null));};exports[_0x4725('0x11a')]=function(_0x4952d7,_0xc5dd48){var _0x4769bd=_0x4952d7[_0x4725('0x38')][_0x4725('0x11b')]==='false'?_0x4725('0x11c'):_0x4725('0x11d');return db[_0x4725('0x32')]['find']({'attributes':['id',_0x4769bd],'where':{'id':_0x4952d7[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0xc5dd48,null))['then'](function(_0xb5a80e){if(_0xb5a80e){var _0xe12afb=_0xb5a80e[_0x4769bd];var _0x7619d5=_0xe12afb&&_0xe12afb[_0x4725('0x11e')]?_0xe12afb[_0x4725('0x11e')]:[];_0xc5dd48[_0x4725('0x2e')]({'fromKey':_[_0x4725('0x71')](_0xe12afb['fromKey'])?undefined:_0xe12afb[_0x4725('0x11f')],'count':_0x7619d5[_0x4725('0x3c')],'rows':_0x7619d5});}})[_0x4725('0x1f')](handleError(_0xc5dd48,null));};exports[_0x4725('0x120')]=function(_0x2fb6c8,_0x1a63f8){var _0x3b5345={'raw':![],'where':{}};var _0x58274e={};var _0x54d9c7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4725('0x5a')]({'where':{'id':_0x2fb6c8[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x1a63f8,null))[_0x4725('0x16')](function(_0x4d01e1){if(_0x4d01e1){_0x58274e[_0x4725('0x36')]=_[_0x4725('0x5b')](db[_0x4725('0xc7')][_0x4725('0x33')]);_0x58274e[_0x4725('0x38')]=_['keys'](_0x2fb6c8['query']);_0x58274e[_0x4725('0x42')]=_[_0x4725('0x39')](_0x58274e[_0x4725('0x36')],_0x58274e[_0x4725('0x38')]);_0x3b5345['attributes']=_['intersection'](_0x58274e[_0x4725('0x36')],qs[_0x4725('0x3b')](_0x2fb6c8[_0x4725('0x38')][_0x4725('0x3b')]));_0x3b5345['attributes']=_0x3b5345[_0x4725('0x3a')][_0x4725('0x3c')]?_0x3b5345[_0x4725('0x3a')]:_0x58274e['model'];if(!_0x2fb6c8[_0x4725('0x38')][_0x4725('0x3d')]('nolimit')){_0x3b5345['limit']=qs['limit'](_0x2fb6c8[_0x4725('0x38')]['limit']);_0x3b5345['offset']=qs[_0x4725('0x23')](_0x2fb6c8[_0x4725('0x38')][_0x4725('0x23')]);}_0x3b5345[_0x4725('0x3f')]=qs[_0x4725('0x40')](_0x2fb6c8[_0x4725('0x38')][_0x4725('0x40')]);_0x3b5345[_0x4725('0x41')]=qs['filters'](_[_0x4725('0x5d')](_0x2fb6c8[_0x4725('0x38')],_0x58274e[_0x4725('0x42')]));_0x3b5345[_0x4725('0x41')]['ChatWebsiteId']=_0x4d01e1['id'];if(_0x2fb6c8[_0x4725('0x38')]['filter']){_0x3b5345['where']=_[_0x4725('0x44')](_0x3b5345[_0x4725('0x41')],{'$or':_['map'](_0x3b5345[_0x4725('0x3a')],function(_0x5433cf){var _0x2fd736={};_0x2fd736[_0x5433cf]={'$like':'%'+_0x2fb6c8[_0x4725('0x38')][_0x4725('0x43')]+'%'};return _0x2fd736;})});}_0x3b5345=_[_0x4725('0x44')]({},_0x3b5345,_0x2fb6c8[_0x4725('0x4d')]);return db[_0x4725('0xc7')][_0x4725('0x26')]({'where':_0x3b5345[_0x4725('0x41')]})['then'](function(_0x1b96b6){_0x54d9c7[_0x4725('0x26')]=_0x1b96b6;if(_0x2fb6c8['query'][_0x4725('0x4b')]){_0x3b5345['include']=[{'all':!![]}];}else{_0x3b5345[_0x4725('0x4c')]=[{'model':db[_0x4725('0x8b')],'as':_0x4725('0x121'),'required':![]},{'model':db[_0x4725('0x122')],'as':'Attachments','required':![]}];}return db[_0x4725('0xc7')][_0x4725('0x5e')](_0x3b5345);})[_0x4725('0x16')](function(_0x2237df){_0x54d9c7[_0x4725('0x48')]=_0x2237df;return _0x54d9c7;});}})['then'](respondWithFilteredResult(_0x1a63f8,_0x3b5345))[_0x4725('0x1f')](handleError(_0x1a63f8,null));};exports[_0x4725('0x123')]=function(_0x2ad27c,_0x461171){return db['ChatWebsite'][_0x4725('0x51')]({'where':{'id':_0x2ad27c[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x461171,null))[_0x4725('0x16')](function(_0x210ad8){if(_0x210ad8){return _0x210ad8[_0x4725('0x123')](_0x2ad27c['body'][_0x4725('0x60')],_[_0x4725('0xe6')](_0x2ad27c[_0x4725('0x56')],[_0x4725('0x60'),'id'])||{})[_0x4725('0xc0')](function(_0x27c893){for(var _0x388d55=0x0;_0x388d55<_0x2ad27c[_0x4725('0x56')][_0x4725('0x60')][_0x4725('0x3c')];_0x388d55+=0x1){socket[_0x4725('0x124')](_0x4725('0x125'),{'UserId':Number(_0x2ad27c[_0x4725('0x56')][_0x4725('0x60')][_0x388d55]),'ChatWebsiteId':Number(_0x2ad27c[_0x4725('0x4a')]['id'])});}return _0x27c893;});}})[_0x4725('0x16')](respondWithResult(_0x461171,null))['catch'](handleError(_0x461171,null));};exports[_0x4725('0x126')]=function(_0x10afab,_0x3cd5fa){return db['ChatWebsite']['find']({'where':{'id':_0x10afab[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x3cd5fa,null))[_0x4725('0x16')](function(_0x2a7c96){if(_0x2a7c96){return _0x2a7c96[_0x4725('0x126')](_0x10afab['query']['ids'])[_0x4725('0x16')](function(){if(_[_0x4725('0x127')](_0x10afab['query'][_0x4725('0x60')])){for(var _0x3eff5a=0x0;_0x3eff5a<_0x10afab[_0x4725('0x38')][_0x4725('0x60')][_0x4725('0x3c')];_0x3eff5a+=0x1){socket['emit'](_0x4725('0x128'),{'UserId':Number(_0x10afab[_0x4725('0x38')][_0x4725('0x60')][_0x3eff5a]),'ChatWebsiteId':Number(_0x10afab[_0x4725('0x4a')]['id'])});}}else{socket[_0x4725('0x124')](_0x4725('0x128'),{'UserId':Number(_0x10afab['query'][_0x4725('0x60')]),'ChatWebsiteId':Number(_0x10afab[_0x4725('0x4a')]['id'])});}});}})[_0x4725('0x16')](respondWithStatusCode(_0x3cd5fa,null))[_0x4725('0x1f')](handleError(_0x3cd5fa,null));};exports['getAgents']=function(_0x57555d,_0x93362e){var _0x8ead0a={};var _0x4cf039={};var _0xeae4d1;var _0x59a719;return db[_0x4725('0x32')][_0x4725('0x5a')]({'where':{'id':_0x57555d[_0x4725('0x4a')]['id']}})[_0x4725('0x16')](handleEntityNotFound(_0x93362e,null))[_0x4725('0x16')](function(_0x57a0cc){if(_0x57a0cc){_0xeae4d1=_0x57a0cc;_0x4cf039[_0x4725('0x36')]=_[_0x4725('0x5b')](db['User'][_0x4725('0x33')]);_0x4cf039[_0x4725('0x38')]=_[_0x4725('0x5b')](_0x57555d[_0x4725('0x38')]);_0x4cf039['filters']=_[_0x4725('0x39')](_0x4cf039['model'],_0x4cf039['query']);_0x8ead0a[_0x4725('0x3a')]=_[_0x4725('0x39')](_0x4cf039[_0x4725('0x36')],qs['fields'](_0x57555d['query'][_0x4725('0x3b')]));_0x8ead0a[_0x4725('0x3a')]=_0x8ead0a['attributes'][_0x4725('0x3c')]?_0x8ead0a[_0x4725('0x3a')]:_0x4cf039['model'];_0x8ead0a[_0x4725('0x3f')]=qs['sort'](_0x57555d[_0x4725('0x38')]['sort']);_0x8ead0a[_0x4725('0x41')]=qs[_0x4725('0x42')](_[_0x4725('0x5d')](_0x57555d['query'],_0x4cf039[_0x4725('0x42')]));if(_0x57555d['query'][_0x4725('0x43')]){_0x8ead0a[_0x4725('0x41')]=_[_0x4725('0x44')](_0x8ead0a[_0x4725('0x41')],{'$or':_[_0x4725('0x37')](_0x8ead0a[_0x4725('0x3a')],function(_0x3d627c){var _0x3d4638={};_0x3d4638[_0x3d627c]={'$like':'%'+_0x57555d[_0x4725('0x38')]['filter']+'%'};return _0x3d4638;})});}_0x8ead0a=_[_0x4725('0x44')]({},_0x8ead0a,_0x57555d[_0x4725('0x4d')]);return _0xeae4d1[_0x4725('0x129')](_0x8ead0a);}})[_0x4725('0x16')](function(_0x568d09){if(_0x568d09){_0x59a719=_0x568d09[_0x4725('0x3c')];if(!_0x57555d[_0x4725('0x38')][_0x4725('0x3d')](_0x4725('0x3e'))){_0x8ead0a['limit']=qs[_0x4725('0x25')](_0x57555d[_0x4725('0x38')][_0x4725('0x25')]);_0x8ead0a[_0x4725('0x23')]=qs[_0x4725('0x23')](_0x57555d[_0x4725('0x38')]['offset']);}return _0xeae4d1[_0x4725('0x129')](_0x8ead0a);}})['then'](function(_0x440670){if(_0x440670){return _0x440670?{'count':_0x59a719,'rows':_0x440670}:null;}})['then'](respondWithResult(_0x93362e,null))[_0x4725('0x1f')](handleError(_0x93362e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e42eb58..89acc85 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 _0x5697=['ChatWebsite','setMaxListeners','save','hook','exports','events'];(function(_0x3e95cb,_0x4f5933){var _0x2c2e48=function(_0x569577){while(--_0x569577){_0x3e95cb['push'](_0x3e95cb['shift']());}};_0x2c2e48(++_0x4f5933);}(_0x5697,0x1b5));var _0x7569=function(_0x340d75,_0x561cb0){_0x340d75=_0x340d75-0x0;var _0x3f1114=_0x5697[_0x340d75];return _0x3f1114;};'use strict';var EventEmitter=require(_0x7569('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x7569('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7569('0x2')](0x0);var events={'afterCreate':_0x7569('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4eff57){return function(_0x499e06,_0x48340f,_0x32db80){ChatWebsiteEvents['emit'](_0x4eff57+':'+_0x499e06['id'],_0x499e06);ChatWebsiteEvents['emit'](_0x4eff57,_0x499e06);_0x32db80(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x7569('0x4')](e,emitEvent(event));}}module[_0x7569('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc0a4=['hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc0a4,0x147));var _0x4c0a=function(_0x79037b,_0x3f1007){_0x79037b=_0x79037b-0x0;var _0x10c6b8=_0xc0a4[_0x79037b];return _0x10c6b8;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x4c0a('0x0'))['db'][_0x4c0a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4c0a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c0a('0x3'),'afterDestroy':_0x4c0a('0x4')};function emitEvent(_0x4540ae){return function(_0x23a18d,_0x44b0e7,_0x5d2401){ChatWebsiteEvents[_0x4c0a('0x5')](_0x4540ae+':'+_0x23a18d['id'],_0x23a18d);ChatWebsiteEvents[_0x4c0a('0x5')](_0x4540ae,_0x23a18d);_0x5d2401(null);};}for(var e in events){if(events[_0x4c0a('0x6')](e)){var event=events[e];ChatWebsite[_0x4c0a('0x7')](e,emitEvent(event));}}module[_0x4c0a('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2141b2a..c24a77a 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 _0xcc10=['../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','api','moment','path'];(function(_0x4ebf01,_0x96e1c4){var _0x7f2f65=function(_0x997311){while(--_0x997311){_0x4ebf01['push'](_0x4ebf01['shift']());}};_0x7f2f65(++_0x96e1c4);}(_0xcc10,0x7d));var _0x0cc1=function(_0x284ca1,_0x8d4369){_0x284ca1=_0x284ca1-0x0;var _0xbe5fec=_0xcc10[_0x284ca1];return _0xbe5fec;};'use strict';var _=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var logger=require('../../config/logger')(_0x0cc1('0x2'));var moment=require(_0x0cc1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cc1('0x4'));var rimraf=require('rimraf');var config=require(_0x0cc1('0x5'));var attributes=require(_0x0cc1('0x6'));module[_0x0cc1('0x7')]=function(_0x99a8a7,_0xdfeb62){return _0x99a8a7['define'](_0x0cc1('0x8'),attributes,{'tableName':_0x0cc1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0186=['moment','bluebird','request-promise','path','../../config/environment','define','ChatWebsite','chat_websites','util','../../config/logger'];(function(_0x3d4c73,_0x577100){var _0x16aed3=function(_0x265264){while(--_0x265264){_0x3d4c73['push'](_0x3d4c73['shift']());}};_0x16aed3(++_0x577100);}(_0x0186,0x1ac));var _0x6018=function(_0x344c94,_0xa0fa32){_0x344c94=_0x344c94-0x0;var _0x44e5d4=_0x0186[_0x344c94];return _0x44e5d4;};'use strict';var _=require('lodash');var util=require(_0x6018('0x0'));var logger=require(_0x6018('0x1'))('api');var moment=require(_0x6018('0x2'));var BPromise=require(_0x6018('0x3'));var rp=require(_0x6018('0x4'));var fs=require('fs');var path=require(_0x6018('0x5'));var rimraf=require('rimraf');var config=require(_0x6018('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x4f6d68,_0x40f50b){return _0x4f6d68[_0x6018('0x7')](_0x6018('0x8'),attributes,{'tableName':_0x6018('0x9'),'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 7eda96f..7a0d570 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 _0x8675=['ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','debug'];(function(_0x5c6ef0,_0x40b9a1){var _0x1db1a9=function(_0x97598d){while(--_0x97598d){_0x5c6ef0['push'](_0x5c6ef0['shift']());}};_0x1db1a9(++_0x40b9a1);}(_0x8675,0xdf));var _0x5867=function(_0x2b3248,_0x4681c3){_0x2b3248=_0x2b3248-0x0;var _0x4c273=_0x8675[_0x2b3248];return _0x4c273;};'use strict';var _=require(_0x5867('0x0'));var util=require('util');var moment=require(_0x5867('0x1'));var BPromise=require(_0x5867('0x2'));var rs=require(_0x5867('0x3'));var fs=require('fs');var Redis=require(_0x5867('0x4'));var db=require(_0x5867('0x5'))['db'];var utils=require(_0x5867('0x6'));var logger=require(_0x5867('0x7'))(_0x5867('0x8'));var config=require(_0x5867('0x9'));var jayson=require(_0x5867('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5867('0xb')]=_[_0x5867('0xc')](config[_0x5867('0xb')],{'host':_0x5867('0xd'),'port':0x18eb});var socket=require(_0x5867('0xe'))(new Redis(config[_0x5867('0xb')]));require(_0x5867('0xf'))[_0x5867('0x10')](socket);function respondWithRpcPromise(_0x437820,_0x18be77,_0x238e16){return new BPromise(function(_0x322f1f,_0xcc2c6e){return client[_0x5867('0x11')](_0x437820,_0x238e16)['then'](function(_0x4cc23b){logger['info'](_0x5867('0x12'),_0x18be77,'request\x20sent');logger[_0x5867('0x13')](_0x5867('0x14'),_0x18be77,_0x5867('0x15'),JSON[_0x5867('0x16')](_0x4cc23b));if(_0x4cc23b[_0x5867('0x17')]){if(_0x4cc23b['error']['code']===0x1f4){logger[_0x5867('0x17')](_0x5867('0x12'),_0x18be77,_0x4cc23b['error'][_0x5867('0x18')]);return _0xcc2c6e(_0x4cc23b[_0x5867('0x17')][_0x5867('0x18')]);}logger['error'](_0x5867('0x12'),_0x18be77,_0x4cc23b[_0x5867('0x17')]['message']);return _0x322f1f(_0x4cc23b[_0x5867('0x17')][_0x5867('0x18')]);}else{logger[_0x5867('0x19')](_0x5867('0x12'),_0x18be77,'request\x20sent');_0x322f1f(_0x4cc23b['result']['message']);}})[_0x5867('0x1a')](function(_0x56732b){logger[_0x5867('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x18be77,_0x56732b);_0xcc2c6e(_0x56732b);});});} \ No newline at end of file +var _0xc8c5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','socket.io-emitter','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0xc8c5,0xbe));var _0x5c8c=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0xc8c5[_0x2c0b5c];return _0x331c54;};'use strict';var _=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var moment=require(_0x5c8c('0x2'));var BPromise=require(_0x5c8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c8c('0x4'));var db=require(_0x5c8c('0x5'))['db'];var utils=require(_0x5c8c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c8c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c8c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x5c8c('0x9')](config[_0x5c8c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c8c('0xb'))(new Redis(config[_0x5c8c('0xa')]));require(_0x5c8c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1fcf5e,_0x39555f,_0xf3b31f){return new BPromise(function(_0x1cdb94,_0x59b50a){return client[_0x5c8c('0xd')](_0x1fcf5e,_0xf3b31f)['then'](function(_0xe13a25){logger[_0x5c8c('0xe')](_0x5c8c('0xf'),_0x39555f,_0x5c8c('0x10'));logger[_0x5c8c('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x39555f,_0x5c8c('0x10'),JSON[_0x5c8c('0x12')](_0xe13a25));if(_0xe13a25[_0x5c8c('0x13')]){if(_0xe13a25[_0x5c8c('0x13')][_0x5c8c('0x14')]===0x1f4){logger[_0x5c8c('0x13')](_0x5c8c('0xf'),_0x39555f,_0xe13a25[_0x5c8c('0x13')][_0x5c8c('0x15')]);return _0x59b50a(_0xe13a25[_0x5c8c('0x13')][_0x5c8c('0x15')]);}logger[_0x5c8c('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x39555f,_0xe13a25[_0x5c8c('0x13')][_0x5c8c('0x15')]);return _0x1cdb94(_0xe13a25['error'][_0x5c8c('0x15')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x39555f,'request\x20sent');_0x1cdb94(_0xe13a25[_0x5c8c('0x16')]['message']);}})[_0x5c8c('0x17')](function(_0x53a074){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x39555f,_0x53a074);_0x59b50a(_0x53a074);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 87c4491..fd114da 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 _0x5079=['remove','update','length','save'];(function(_0x138386,_0x2a3ea6){var _0x20fac1=function(_0x3398e9){while(--_0x3398e9){_0x138386['push'](_0x138386['shift']());}};_0x20fac1(++_0x2a3ea6);}(_0x5079,0x17b));var _0x9507=function(_0x20d6f0,_0x33e54c){_0x20d6f0=_0x20d6f0-0x0;var _0x105ceb=_0x5079[_0x20d6f0];return _0x105ceb;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x9507('0x0'),_0x9507('0x1'),_0x9507('0x2')];function createListener(_0x4ce57b,_0xfdf200){return function(_0x3e0e9e){_0xfdf200['emit'](_0x4ce57b,_0x3e0e9e);};}function removeListener(_0x146cdb,_0x1e9e62){return function(){ChatWebsiteEvents['removeListener'](_0x146cdb,_0x1e9e62);};}exports['register']=function(_0x18299f){for(var _0x27226b=0x0,_0xecfcc5=events[_0x9507('0x3')];_0x27226b<_0xecfcc5;_0x27226b++){var _0x478fd8=events[_0x27226b];var _0x8c1256=createListener('chatWebsite:'+_0x478fd8,_0x18299f);ChatWebsiteEvents['on'](_0x478fd8,_0x8c1256);}}; \ No newline at end of file +var _0xdcaa=['chatWebsite:','remove','update','emit','removeListener','register','length'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xdcaa,0x1dd));var _0xadca=function(_0x2d1904,_0x28d286){_0x2d1904=_0x2d1904-0x0;var _0x464c5b=_0xdcaa[_0x2d1904];return _0x464c5b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xadca('0x0'),_0xadca('0x1')];function createListener(_0xe8de4c,_0x46110c){return function(_0xf4d57){_0x46110c[_0xadca('0x2')](_0xe8de4c,_0xf4d57);};}function removeListener(_0x269e60,_0x448ac6){return function(){ChatWebsiteEvents[_0xadca('0x3')](_0x269e60,_0x448ac6);};}exports[_0xadca('0x4')]=function(_0x5398fe){for(var _0x1850e0=0x0,_0x1eab6d=events[_0xadca('0x5')];_0x1850e0<_0x1eab6d;_0x1850e0++){var _0x1f624c=events[_0x1850e0];var _0x4c530a=createListener(_0xadca('0x6')+_0x1f624c,_0x5398fe);ChatWebsiteEvents['on'](_0x1f624c,_0x4c530a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6a57991..4fe6567 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 _0x8794=['addAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','extname','/:id/offline','any','offline','addInteraction','addApplications','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','now'];(function(_0x1e4fe8,_0x217264){var _0x8113f=function(_0x12f489){while(--_0x12f489){_0x1e4fe8['push'](_0x1e4fe8['shift']());}};_0x8113f(++_0x217264);}(_0x8794,0x13b));var _0x4879=function(_0x14cc59,_0x361208){_0x14cc59=_0x14cc59-0x0;var _0x31c77c=_0x8794[_0x14cc59];return _0x31c77c;};'use strict';var multer=require(_0x4879('0x0'));var util=require(_0x4879('0x1'));var path=require(_0x4879('0x2'));var timeout=require(_0x4879('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4879('0x4'));var auth=require(_0x4879('0x5'));var interaction=require(_0x4879('0x6'));var config=require(_0x4879('0x7'));var controller=require(_0x4879('0x8'));router[_0x4879('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4879('0x9')](_0x4879('0xa'),auth[_0x4879('0xb')](),controller[_0x4879('0xc')]);router['get'](_0x4879('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4879('0x9')]('/:id/dispositions',auth[_0x4879('0xb')](),controller[_0x4879('0xe')]);router[_0x4879('0x9')](_0x4879('0xf'),auth[_0x4879('0xb')](),controller[_0x4879('0x10')]);router[_0x4879('0x9')]('/:id/logo',controller['getLogo']);router[_0x4879('0x9')](_0x4879('0x11'),controller[_0x4879('0x12')]);router[_0x4879('0x9')](_0x4879('0x13'),controller['getCustomerAvatar']);router[_0x4879('0x9')](_0x4879('0x14'),controller[_0x4879('0x15')]);router[_0x4879('0x9')](_0x4879('0x16'),auth[_0x4879('0xb')](),controller[_0x4879('0x17')]);router[_0x4879('0x9')](_0x4879('0x18'),controller['getSnippet']);router['get'](_0x4879('0x19'),auth[_0x4879('0xb')](),controller['getApplications']);router[_0x4879('0x9')](_0x4879('0x1a'),auth[_0x4879('0xb')](),controller[_0x4879('0x1b')]);router[_0x4879('0x9')](_0x4879('0x1c'),controller[_0x4879('0x1d')]);router[_0x4879('0x9')](_0x4879('0x1e'),auth[_0x4879('0xb')](),controller['getOfflineMessages']);router[_0x4879('0x9')]('/:id/users',auth[_0x4879('0xb')](),controller[_0x4879('0x1f')]);router[_0x4879('0x20')]('/',auth[_0x4879('0xb')](),controller[_0x4879('0x21')]);router[_0x4879('0x20')](_0x4879('0x22'),auth[_0x4879('0xb')](),controller[_0x4879('0x23')]);router[_0x4879('0x20')]('/:id/canned_answers',auth[_0x4879('0xb')](),controller[_0x4879('0x24')]);var upload=multer({'storage':multer[_0x4879('0x25')]({'destination':function(_0x4e4c28,_0xc4e0e5,_0x14f241){_0x14f241(null,path[_0x4879('0x26')](config[_0x4879('0x27')],_0x4879('0x28')));},'filename':function(_0x3def8d,_0x359089,_0x387514){_0x387514(null,util[_0x4879('0x29')](_0x4879('0x2a'),Date['now'](),_0x359089[_0x4879('0x2b')]));}})});router['post'](_0x4879('0x2c'),upload[_0x4879('0x2d')](_0x4879('0x2e')),controller[_0x4879('0x2f')]);var upload=multer({'storage':multer[_0x4879('0x25')]({'destination':function(_0x2e682c,_0x533e76,_0x1c40de){_0x1c40de(null,path['join'](config[_0x4879('0x27')],_0x4879('0x30')));},'filename':function(_0x3dcb43,_0x3ef923,_0x162af7){_0x162af7(null,util['format'](_0x4879('0x2a'),Date[_0x4879('0x31')](),_0x3ef923[_0x4879('0x2b')]));}})});router[_0x4879('0x20')](_0x4879('0x11'),upload[_0x4879('0x2d')](_0x4879('0x2e')),controller[_0x4879('0x32')]);var upload=multer({'storage':multer[_0x4879('0x25')]({'destination':function(_0x3850de,_0x190dad,_0x303fbc){_0x303fbc(null,path[_0x4879('0x26')](config[_0x4879('0x27')],_0x4879('0x30')));},'filename':function(_0x4b6f8d,_0xbb59a0,_0x542fe8){_0x542fe8(null,util[_0x4879('0x29')](_0x4879('0x2a'),Date[_0x4879('0x31')](),_0xbb59a0[_0x4879('0x2b')]));}})});router[_0x4879('0x20')]('/:id/customer_avatar',upload[_0x4879('0x2d')](_0x4879('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x4879('0x25')]({'destination':function(_0x1cd091,_0x3595ec,_0x424583){_0x424583(null,path[_0x4879('0x26')](config[_0x4879('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1ac35c,_0xdbb536,_0x340473){_0x340473(null,util[_0x4879('0x29')](_0x4879('0x2a'),Date[_0x4879('0x31')](),_0xdbb536[_0x4879('0x2b')]));}})});router[_0x4879('0x20')]('/:id/system_avatar',upload['single'](_0x4879('0x2e')),controller[_0x4879('0x33')]);router[_0x4879('0x20')](_0x4879('0x34'),controller[_0x4879('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x972a13,_0xaacb88,_0x28714b){const _0x3d01cc=path['join'](config[_0x4879('0x27')],_0x4879('0x36'),_0x4879('0x37'),_0x4879('0x38'));fs_extra['ensureDir'](_0x3d01cc,function(){_0x28714b(null,_0x3d01cc);});},'filename':function(_0xf9a85,_0x5d0fbb,_0x135ce0){const _0x111e92=_0x5d0fbb[_0x4879('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x496274=path[_0x4879('0x39')](_0x111e92);const _0x816539=Date[_0x4879('0x31')]()+'-'+_0x111e92['replace'](_0x496274,'')+_0x496274;_0x135ce0(null,_0x816539);}})});router['post'](_0x4879('0x3a'),offlineUploadMulter[_0x4879('0x3b')](),controller[_0x4879('0x3c')]);router['post']('/:id/interactions',auth[_0x4879('0xb')](),controller[_0x4879('0x3d')]);router[_0x4879('0x20')]('/:id/applications',auth[_0x4879('0xb')](),controller[_0x4879('0x3e')]);router['post']('/:id/proactive_actions',auth[_0x4879('0xb')](),controller['addProactiveActions']);router[_0x4879('0x20')](_0x4879('0x3f'),auth[_0x4879('0xb')](),controller[_0x4879('0x40')]);router[_0x4879('0x41')]('/:id',auth['isAuthenticated'](),controller[_0x4879('0x42')]);router[_0x4879('0x43')](_0x4879('0xd'),auth[_0x4879('0xb')](),controller[_0x4879('0x44')]);router[_0x4879('0x43')](_0x4879('0x22'),auth[_0x4879('0xb')](),controller[_0x4879('0x45')]);router[_0x4879('0x43')]('/:id/canned_answers',auth[_0x4879('0xb')](),controller[_0x4879('0x46')]);router[_0x4879('0x43')](_0x4879('0x3f'),auth[_0x4879('0xb')](),controller[_0x4879('0x47')]);module[_0x4879('0x48')]=router; \ No newline at end of file +var _0x4733=['getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','file','addLogo','single','addAvatar','diskStorage','server/files/images/avatars/','/:id/notify','notify','attachments','offline-chat','replace','extname','/:id/offline','offline','addProactiveActions','/:id','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x5391f9,_0x49b38b){var _0x9e3a1f=function(_0x5d046b){while(--_0x5d046b){_0x5391f9['push'](_0x5391f9['shift']());}};_0x9e3a1f(++_0x49b38b);}(_0x4733,0x158));var _0x3473=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x4733[_0x133277];return _0x5b4a22;};'use strict';var multer=require(_0x3473('0x0'));var util=require(_0x3473('0x1'));var path=require(_0x3473('0x2'));var timeout=require(_0x3473('0x3'));var express=require(_0x3473('0x4'));var router=express[_0x3473('0x5')]();var fs_extra=require(_0x3473('0x6'));var auth=require(_0x3473('0x7'));var interaction=require(_0x3473('0x8'));var config=require(_0x3473('0x9'));var controller=require(_0x3473('0xa'));router[_0x3473('0xb')]('/',auth[_0x3473('0xc')](),controller[_0x3473('0xd')]);router[_0x3473('0xb')](_0x3473('0xe'),auth['isAuthenticated'](),controller[_0x3473('0xf')]);router['get']('/:id',auth[_0x3473('0xc')](),controller[_0x3473('0x10')]);router[_0x3473('0xb')](_0x3473('0x11'),auth[_0x3473('0xc')](),controller[_0x3473('0x12')]);router['get'](_0x3473('0x13'),auth['isAuthenticated'](),controller[_0x3473('0x14')]);router[_0x3473('0xb')]('/:id/logo',controller[_0x3473('0x15')]);router[_0x3473('0xb')](_0x3473('0x16'),controller[_0x3473('0x17')]);router[_0x3473('0xb')](_0x3473('0x18'),controller[_0x3473('0x19')]);router[_0x3473('0xb')](_0x3473('0x1a'),controller['getSystemAvatar']);router['get'](_0x3473('0x1b'),auth[_0x3473('0xc')](),controller[_0x3473('0x1c')]);router[_0x3473('0xb')]('/:id/snippet',controller[_0x3473('0x1d')]);router[_0x3473('0xb')](_0x3473('0x1e'),auth[_0x3473('0xc')](),controller[_0x3473('0x1f')]);router[_0x3473('0xb')](_0x3473('0x20'),auth[_0x3473('0xc')](),controller[_0x3473('0x21')]);router[_0x3473('0xb')](_0x3473('0x22'),controller[_0x3473('0x23')]);router['get'](_0x3473('0x24'),auth[_0x3473('0xc')](),controller[_0x3473('0x25')]);router['get'](_0x3473('0x26'),auth[_0x3473('0xc')](),controller[_0x3473('0x27')]);router['post']('/',auth[_0x3473('0xc')](),controller[_0x3473('0x28')]);router[_0x3473('0x29')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3473('0x2a')]);router[_0x3473('0x29')](_0x3473('0x13'),auth[_0x3473('0xc')](),controller[_0x3473('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x345785,_0x24c3aa,_0x133227){_0x133227(null,path[_0x3473('0x2c')](config[_0x3473('0x2d')],_0x3473('0x2e')));},'filename':function(_0x1c4911,_0x3fbb76,_0x12ada7){_0x12ada7(null,util[_0x3473('0x2f')](_0x3473('0x30'),Date[_0x3473('0x31')](),_0x3fbb76[_0x3473('0x32')]));}})});router[_0x3473('0x29')](_0x3473('0x33'),upload['single'](_0x3473('0x34')),controller[_0x3473('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x265e40,_0x30efc4,_0xdcbb80){_0xdcbb80(null,path[_0x3473('0x2c')](config[_0x3473('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x3f78bf,_0x5c3915,_0x27e8dc){_0x27e8dc(null,util[_0x3473('0x2f')](_0x3473('0x30'),Date[_0x3473('0x31')](),_0x5c3915['originalname']));}})});router['post'](_0x3473('0x16'),upload[_0x3473('0x36')](_0x3473('0x34')),controller[_0x3473('0x37')]);var upload=multer({'storage':multer[_0x3473('0x38')]({'destination':function(_0x1b7b02,_0x661cee,_0xbd84f1){_0xbd84f1(null,path['join'](config['root'],_0x3473('0x39')));},'filename':function(_0x1070b6,_0x4a7f64,_0x3c5fd7){_0x3c5fd7(null,util[_0x3473('0x2f')]('%s-%s',Date[_0x3473('0x31')](),_0x4a7f64[_0x3473('0x32')]));}})});router['post'](_0x3473('0x18'),upload[_0x3473('0x36')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3473('0x38')]({'destination':function(_0x40269d,_0x3f2dd6,_0x544b6f){_0x544b6f(null,path[_0x3473('0x2c')](config[_0x3473('0x2d')],_0x3473('0x39')));},'filename':function(_0x11fd08,_0x9b650e,_0x2f9d9a){_0x2f9d9a(null,util[_0x3473('0x2f')](_0x3473('0x30'),Date[_0x3473('0x31')](),_0x9b650e[_0x3473('0x32')]));}})});router[_0x3473('0x29')](_0x3473('0x1a'),upload[_0x3473('0x36')]('file'),controller['addSystemAvatar']);router['post'](_0x3473('0x3a'),controller[_0x3473('0x3b')]);const offlineUploadMulter=multer({'storage':multer[_0x3473('0x38')]({'destination':function(_0x4ad279,_0x3a8af5,_0x129497){const _0x40f659=path[_0x3473('0x2c')](config[_0x3473('0x2d')],'server/files',_0x3473('0x3c'),_0x3473('0x3d'));fs_extra['ensureDir'](_0x40f659,function(){_0x129497(null,_0x40f659);});},'filename':function(_0xcd463b,_0x1ff000,_0x1c2297){const _0x2af036=_0x1ff000[_0x3473('0x32')][_0x3473('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1ff1f4=path[_0x3473('0x3f')](_0x2af036);const _0x3a10eb=Date[_0x3473('0x31')]()+'-'+_0x2af036[_0x3473('0x3e')](_0x1ff1f4,'')+_0x1ff1f4;_0x1c2297(null,_0x3a10eb);}})});router[_0x3473('0x29')](_0x3473('0x40'),offlineUploadMulter['any'](),controller[_0x3473('0x41')]);router[_0x3473('0x29')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0x3473('0x29')](_0x3473('0x1e'),auth[_0x3473('0xc')](),controller['addApplications']);router[_0x3473('0x29')](_0x3473('0x20'),auth[_0x3473('0xc')](),controller[_0x3473('0x42')]);router[_0x3473('0x29')](_0x3473('0x26'),auth[_0x3473('0xc')](),controller['addAgents']);router['put'](_0x3473('0x43'),auth['isAuthenticated'](),controller[_0x3473('0x44')]);router[_0x3473('0x45')](_0x3473('0x43'),auth[_0x3473('0xc')](),controller[_0x3473('0x46')]);router[_0x3473('0x45')](_0x3473('0x11'),auth[_0x3473('0xc')](),controller['removeDispositions']);router[_0x3473('0x45')]('/:id/canned_answers',auth[_0x3473('0xc')](),controller[_0x3473('0x47')]);router[_0x3473('0x45')]('/:id/users',auth[_0x3473('0xc')](),controller[_0x3473('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 661367d..dcc2450 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd8e=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x3308e5,_0x34e791){var _0xd60ecb=function(_0x170704){while(--_0x170704){_0x3308e5['push'](_0x3308e5['shift']());}};_0xd60ecb(++_0x34e791);}(_0xbd8e,0x1bc));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};var beaverLogger=require(_0xebd8('0x0'));var express=require(_0xebd8('0x1'));var auth=require(_0xebd8('0x2'));var config=require(_0xebd8('0x3'));var router=express['Router']();var isProduction=config[_0xebd8('0x4')]==='production'||![];function clientSideLogs(_0x57bb77,_0x346942,_0x184ca9){var _0x353a25=_0x57bb77['app'][_0xebd8('0x5')](_0xebd8('0x6'));if(!_0x353a25){throw new Error(_0xebd8('0x7'));}return beaverLogger[_0xebd8('0x8')]({'uri':_0xebd8('0x9'),'logger':_0x353a25,'enableCors':!isProduction})(_0x57bb77,_0x346942,_0x184ca9);}router[_0xebd8('0xa')](auth[_0xebd8('0xb')](),clientSideLogs);module[_0xebd8('0xc')]=router; \ No newline at end of file +var _0x750d=['Router','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','express','../config/environment'];(function(_0x2db1c2,_0x1e09a3){var _0x56a44c=function(_0x38df32){while(--_0x38df32){_0x2db1c2['push'](_0x2db1c2['shift']());}};_0x56a44c(++_0x1e09a3);}(_0x750d,0x7c));var _0xd750=function(_0x5341ce,_0x2551e4){_0x5341ce=_0x5341ce-0x0;var _0x3b3f98=_0x750d[_0x5341ce];return _0x3b3f98;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd750('0x0'));var auth=require('../components/auth/service');var config=require(_0xd750('0x1'));var router=express[_0xd750('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x15332d,_0x18ed36,_0x435eb4){var _0x36093e=_0x15332d['app']['get'](_0xd750('0x3'));if(!_0x36093e){throw new Error(_0xd750('0x4'));}return beaverLogger[_0xd750('0x5')]({'uri':_0xd750('0x6'),'logger':_0x36093e,'enableCors':!isProduction})(_0x15332d,_0x18ed36,_0x435eb4);}router['use'](auth[_0xd750('0x7')](),clientSideLogs);module[_0xd750('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 05fb721..408bc4f 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 _0x4eec=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x189d12,_0x17aafc){var _0x39b0ad=function(_0x21a7de){while(--_0x21a7de){_0x189d12['push'](_0x189d12['shift']());}};_0x39b0ad(++_0x17aafc);}(_0x4eec,0xeb));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4ee('0x0'));module[_0xc4ee('0x1')]={'name':{'type':Sequelize[_0xc4ee('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc4ee('0x3')]('AmazonAWS',_0xc4ee('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc4ee('0x3')]('Outlook365',_0xc4ee('0x5'))},'data1':{'type':Sequelize[_0xc4ee('0x2')],'comment':_0xc4ee('0x6')},'data2':{'type':Sequelize[_0xc4ee('0x2')],'comment':_0xc4ee('0x7')},'data3':{'type':Sequelize[_0xc4ee('0x2')],'comment':_0xc4ee('0x8')},'data4':{'type':Sequelize[_0xc4ee('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xc4ee('0x9')],'comment':_0xc4ee('0xa')},'data6':{'type':Sequelize[_0xc4ee('0x9')],'comment':_0xc4ee('0xb')},'data7':{'type':Sequelize[_0xc4ee('0x9')],'comment':_0xc4ee('0xc')}}; \ No newline at end of file +var _0xd27a=['ENUM','Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xd27a,0x99));var _0xad27=function(_0x408e16,_0x5a35d5){_0x408e16=_0x408e16-0x0;var _0x556ae4=_0xd27a[_0x408e16];return _0x556ae4;};'use strict';var Sequelize=require(_0xad27('0x0'));module[_0xad27('0x1')]={'name':{'type':Sequelize[_0xad27('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xad27('0x3')]('AmazonAWS',_0xad27('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xad27('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xad27('0x2')],'comment':_0xad27('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0xad27('0x7')},'data3':{'type':Sequelize[_0xad27('0x2')],'comment':_0xad27('0x8')},'data4':{'type':Sequelize[_0xad27('0x2')],'comment':_0xad27('0x9')},'data5':{'type':Sequelize[_0xad27('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xad27('0xa')],'comment':_0xad27('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xad27('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2a1f3c3..9c94271 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 _0x3d47=['../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','intersection','include','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','findOne','user','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','state','base64','toString','ascii','parse','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor'];(function(_0x132edb,_0x54e052){var _0x294aab=function(_0x3630cf){while(--_0x3630cf){_0x132edb['push'](_0x132edb['shift']());}};_0x294aab(++_0x54e052);}(_0x3d47,0xbb));var _0x73d4=function(_0x41bf53,_0x243297){_0x41bf53=_0x41bf53-0x0;var _0x4c75d8=_0x3d47[_0x41bf53];return _0x4c75d8;};'use strict';var _=require('lodash');var Redis=require(_0x73d4('0x0'));var qs=require(_0x73d4('0x1'));var encryptor=require(_0x73d4('0x2'));var config=require(_0x73d4('0x3'));var logger=require(_0x73d4('0x4'))('api');var db=require(_0x73d4('0x5'))['db'];var oauth=require(_0x73d4('0x6'));config['redis']=_['defaults'](config[_0x73d4('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x73d4('0x7')]);function respondWithStatusCode(_0x153f1d,_0x3faff7){_0x3faff7=_0x3faff7||0xcc;return function(_0x3dab0f){if(_0x3dab0f){return _0x153f1d[_0x73d4('0x8')](_0x3faff7);}return _0x153f1d['status'](_0x3faff7)[_0x73d4('0x9')]();};}function respondWithResult(_0x5d3c6c,_0x1af0cc){_0x1af0cc=_0x1af0cc||0xc8;return function(_0x222d7c){if(_0x222d7c){return _0x5d3c6c[_0x73d4('0xa')](_0x1af0cc)[_0x73d4('0xb')](_0x222d7c);}};}function respondWithFilteredResult(_0x2ea594,_0xa6d5dd){return function(_0x197d49){if(_0x197d49){var _0x5275d1=typeof _0xa6d5dd[_0x73d4('0xc')]===_0x73d4('0xd')&&typeof _0xa6d5dd[_0x73d4('0xe')]===_0x73d4('0xd');var _0x810959=_0x197d49['count'];var _0x10b0ac=_0x5275d1?0x0:_0xa6d5dd[_0x73d4('0xc')];var _0x13501b=_0x5275d1?_0x197d49['count']:_0xa6d5dd['offset']+_0xa6d5dd[_0x73d4('0xe')];var _0x1b6b52;if(_0x13501b>=_0x810959){_0x13501b=_0x810959;_0x1b6b52=0xc8;}else{_0x1b6b52=0xce;}_0x2ea594['status'](_0x1b6b52);return _0x2ea594[_0x73d4('0xf')](_0x73d4('0x10'),_0x10b0ac+'-'+_0x13501b+'/'+_0x810959)[_0x73d4('0xb')](_0x197d49);}return null;};}function saveUpdates(_0x2e66c3){return function(_0x20bfa4){if(_0x20bfa4){return _0x20bfa4['update'](_0x2e66c3)[_0x73d4('0x11')](function(_0x10f9e0){return _0x10f9e0;});}return null;};}function removeEntity(_0x7be2de){return function(_0x24fc50){if(_0x24fc50){return _0x24fc50[_0x73d4('0x12')]()[_0x73d4('0x11')](function(){_0x7be2de[_0x73d4('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263775){return function(_0x1b25ff){if(!_0x1b25ff){_0x263775['sendStatus'](0x194);}return _0x1b25ff;};}function handleError(_0x452aa1,_0x287b98){_0x287b98=_0x287b98||0x1f4;return function(_0x4e0960){logger[_0x73d4('0x13')](_0x4e0960[_0x73d4('0x14')]);if(_0x4e0960['name']){delete _0x4e0960[_0x73d4('0x15')];}_0x452aa1[_0x73d4('0xa')](_0x287b98)[_0x73d4('0x16')](_0x4e0960);};}function maskClientSecret(_0x3fd0c1){return _[_0x73d4('0x17')](_0x3fd0c1[_0x73d4('0x18')](0x0,0x3),0x14,'*');}exports[_0x73d4('0x19')]=function(_0xf0806e,_0x265ea8){var _0x30dbe3={},_0x1302df={},_0xdf32dd={'count':0x0,'rows':[]};var _0x51b429=_[_0x73d4('0x1a')](db[_0x73d4('0x1b')]['rawAttributes'],function(_0x80e9ad){return{'name':_0x80e9ad[_0x73d4('0x1c')],'type':_0x80e9ad[_0x73d4('0x1d')]['key']};});_0x1302df['model']=_[_0x73d4('0x1a')](_0x51b429,_0x73d4('0x15'));_0x1302df[_0x73d4('0x1e')]=_[_0x73d4('0x1f')](_0xf0806e['query']);_0x1302df[_0x73d4('0x20')]=_['intersection'](_0x1302df['model'],_0x1302df[_0x73d4('0x1e')]);_0x30dbe3[_0x73d4('0x21')]=_['intersection'](_0x1302df['model'],qs[_0x73d4('0x22')](_0xf0806e[_0x73d4('0x1e')][_0x73d4('0x22')]));_0x30dbe3[_0x73d4('0x21')]=_0x30dbe3['attributes'][_0x73d4('0x23')]?_0x30dbe3[_0x73d4('0x21')]:_0x1302df[_0x73d4('0x24')];if(!_0xf0806e['query'][_0x73d4('0x25')](_0x73d4('0x26'))){_0x30dbe3['limit']=qs[_0x73d4('0xe')](_0xf0806e['query']['limit']);_0x30dbe3['offset']=qs[_0x73d4('0xc')](_0xf0806e[_0x73d4('0x1e')][_0x73d4('0xc')]);}_0x30dbe3[_0x73d4('0x27')]=qs[_0x73d4('0x28')](_0xf0806e[_0x73d4('0x1e')][_0x73d4('0x28')]);_0x30dbe3[_0x73d4('0x29')]=qs['filters'](_[_0x73d4('0x2a')](_0xf0806e[_0x73d4('0x1e')],_0x1302df['filters']),_0x51b429);if(_0xf0806e[_0x73d4('0x1e')][_0x73d4('0x2b')]){_0x30dbe3[_0x73d4('0x29')]=_[_0x73d4('0x2c')](_0x30dbe3[_0x73d4('0x29')],{'$or':_[_0x73d4('0x1a')](_0x51b429,function(_0x5aed40){if(_0x5aed40[_0x73d4('0x1d')]!==_0x73d4('0x2d')){var _0xb125f7={};_0xb125f7[_0x5aed40[_0x73d4('0x15')]]={'$like':'%'+_0xf0806e[_0x73d4('0x1e')][_0x73d4('0x2b')]+'%'};return _0xb125f7;}})});}_0x30dbe3=_[_0x73d4('0x2c')]({},_0x30dbe3,_0xf0806e[_0x73d4('0x2e')]);var _0x5dd8cc={'where':_0x30dbe3[_0x73d4('0x29')]};return db[_0x73d4('0x1b')][_0x73d4('0x2f')](_0x5dd8cc)['then'](function(_0x5c886f){_0xdf32dd[_0x73d4('0x2f')]=_0x5c886f;if(_0xf0806e[_0x73d4('0x1e')][_0x73d4('0x30')]){_0x30dbe3['include']=[{'all':!![]}];}return db[_0x73d4('0x1b')][_0x73d4('0x31')](_0x30dbe3);})[_0x73d4('0x11')](function(_0x536421){_0xdf32dd[_0x73d4('0x32')]=_[_0x73d4('0x1a')](_0x536421,function(_0x417ca9){if(_0x417ca9[_0x73d4('0x33')]===_0x73d4('0x34')){var _0x467e73=encryptor[_0x73d4('0x35')](_0x417ca9[_0x73d4('0x36')]);_0x417ca9['data3']=maskClientSecret(_0x467e73);}return _0x417ca9;});return _0xdf32dd;})[_0x73d4('0x11')](respondWithFilteredResult(_0x265ea8,_0x30dbe3))[_0x73d4('0x37')](handleError(_0x265ea8,null));};exports[_0x73d4('0x38')]=function(_0x4abf9b,_0x550bb4){var _0x12d71f={'raw':!![],'where':{'id':_0x4abf9b[_0x73d4('0x39')]['id']}},_0x1b1471={};_0x1b1471[_0x73d4('0x24')]=_[_0x73d4('0x1f')](db[_0x73d4('0x1b')][_0x73d4('0x3a')]);_0x1b1471[_0x73d4('0x1e')]=_['keys'](_0x4abf9b[_0x73d4('0x1e')]);_0x1b1471[_0x73d4('0x20')]=_[_0x73d4('0x3b')](_0x1b1471[_0x73d4('0x24')],_0x1b1471[_0x73d4('0x1e')]);_0x12d71f[_0x73d4('0x21')]=_['intersection'](_0x1b1471[_0x73d4('0x24')],qs[_0x73d4('0x22')](_0x4abf9b[_0x73d4('0x1e')][_0x73d4('0x22')]));_0x12d71f[_0x73d4('0x21')]=_0x12d71f[_0x73d4('0x21')][_0x73d4('0x23')]?_0x12d71f[_0x73d4('0x21')]:_0x1b1471[_0x73d4('0x24')];if(_0x4abf9b['query'][_0x73d4('0x30')]){_0x12d71f[_0x73d4('0x3c')]=[{'all':!![]}];}_0x12d71f=_[_0x73d4('0x2c')]({},_0x12d71f,_0x4abf9b[_0x73d4('0x2e')]);return db[_0x73d4('0x1b')][_0x73d4('0x3d')](_0x12d71f)[_0x73d4('0x11')](handleEntityNotFound(_0x550bb4,null))[_0x73d4('0x11')](function(_0x5f32fb){if(_0x5f32fb['service']===_0x73d4('0x34')){var _0x29fc61=encryptor[_0x73d4('0x35')](_0x5f32fb[_0x73d4('0x36')]);_0x5f32fb[_0x73d4('0x36')]=maskClientSecret(_0x29fc61);}return _0x5f32fb;})['then'](respondWithResult(_0x550bb4,null))[_0x73d4('0x37')](handleError(_0x550bb4,null));};exports['create']=function(_0x41fe38,_0xaa5b60){if(!_0x41fe38[_0x73d4('0x3e')][_0x73d4('0x15')])throw new Error(_0x73d4('0x3f'));if(!_0x41fe38[_0x73d4('0x3e')][_0x73d4('0x33')])throw new Error(_0x73d4('0x40'));var _0x1f8170=db['CloudProvider'][_0x73d4('0x3a')][_0x73d4('0x33')][_0x73d4('0x41')];if(!_0x1f8170[_0x73d4('0x42')](_0x41fe38['body'][_0x73d4('0x33')]))throw new Error(_0x73d4('0x43')+_0x1f8170['join'](',\x20'));if(_0x41fe38['body']['service']===_0x73d4('0x34')&&_0x41fe38[_0x73d4('0x3e')]['data3']){_0x41fe38[_0x73d4('0x3e')][_0x73d4('0x36')]=encryptor[_0x73d4('0x44')](_0x41fe38[_0x73d4('0x3e')][_0x73d4('0x36')]);}return db[_0x73d4('0x1b')][_0x73d4('0x45')](_0x41fe38[_0x73d4('0x3e')],{})[_0x73d4('0x11')](respondWithResult(_0xaa5b60,0xc9))[_0x73d4('0x37')](handleError(_0xaa5b60,null));};exports['update']=function(_0x5bc567,_0x414645){if(_0x5bc567['body']['id']){delete _0x5bc567[_0x73d4('0x3e')]['id'];}return db[_0x73d4('0x1b')]['find']({'where':{'id':_0x5bc567[_0x73d4('0x39')]['id']}})[_0x73d4('0x11')](handleEntityNotFound(_0x414645,null))[_0x73d4('0x11')](function(_0x569b3b){if(_0x569b3b[_0x73d4('0x33')]===_0x73d4('0x34')&&_0x5bc567[_0x73d4('0x3e')][_0x73d4('0x36')]){_0x5bc567['body'][_0x73d4('0x36')]=encryptor[_0x73d4('0x44')](_0x5bc567[_0x73d4('0x3e')][_0x73d4('0x36')]);}return _0x569b3b;})[_0x73d4('0x11')](saveUpdates(_0x5bc567[_0x73d4('0x3e')],null))[_0x73d4('0x11')](respondWithResult(_0x414645,null))[_0x73d4('0x37')](handleError(_0x414645,null));};exports[_0x73d4('0x12')]=function(_0x3a1d00,_0x56a63f){return db[_0x73d4('0x1b')][_0x73d4('0x3d')]({'where':{'id':_0x3a1d00[_0x73d4('0x39')]['id']}})[_0x73d4('0x11')](handleEntityNotFound(_0x56a63f,null))[_0x73d4('0x11')](removeEntity(_0x56a63f,null))['catch'](handleError(_0x56a63f,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4678ed,_0x4dd00f){return db[_0x73d4('0x1b')][_0x73d4('0x46')]({'where':{'id':_0x4678ed[_0x73d4('0x39')]['id']},'raw':!![]})[_0x73d4('0x11')](function(_0x4a8d2){if(!_0x4a8d2)return _0x4dd00f['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x4a8d2,_0x4678ed[_0x73d4('0x47')]['id'])};})[_0x73d4('0x11')](respondWithResult(_0x4dd00f,null))[_0x73d4('0x37')](handleError(_0x4dd00f,null));};exports[_0x73d4('0x48')]=function(_0x1ffbde,_0x549b78){var _0x216c1e=_0x1ffbde[_0x73d4('0x3e')];var _0x331964;var _0x4412a3;if(_0x216c1e[_0x73d4('0x13')])throw _0x216c1e;redis['get'](_0x216c1e['state'])[_0x73d4('0x11')](function(_0x54b76e){if(!_0x54b76e)throw new Error(_0x73d4('0x49'));_0x331964=JSON['parse'](_0x54b76e);var _0x274371=Buffer['from'](_0x216c1e[_0x73d4('0x4a')],_0x73d4('0x4b'))[_0x73d4('0x4c')](_0x73d4('0x4d'));_0x4412a3=JSON[_0x73d4('0x4e')](_0x274371);if(!oauth[_0x73d4('0x4f')](_0x216c1e[_0x73d4('0x50')],_0x331964['oauth2Claims']))throw new Error(_0x73d4('0x51'));redis[_0x73d4('0x52')](_0x216c1e[_0x73d4('0x4a')]);return oauth[_0x73d4('0x53')](_0x216c1e[_0x73d4('0x54')],_0x331964);})[_0x73d4('0x11')](function(_0xdd6776){_0x331964[_0x73d4('0x55')]=_0xdd6776['access_token'];_0x331964[_0x73d4('0x56')]=_0xdd6776[_0x73d4('0x57')];return db['CloudProvider']['update']({'data5':_0x331964[_0x73d4('0x55')],'data6':_0x331964[_0x73d4('0x56')]},{'where':{'id':_0x331964['id']}});})[_0x73d4('0x11')](function(){oauth[_0x73d4('0x58')](_0x331964);socket[_0x73d4('0x59')](_0x73d4('0x5a'),{'id':_0x4412a3['id']});return;})[_0x73d4('0x11')](respondWithStatusCode(_0x549b78,null))[_0x73d4('0x37')](function(_0x5dbe62){if(_0x4412a3){socket[_0x73d4('0x59')](_0x73d4('0x5b'),{'id':_0x4412a3['id']});}if(!_0x331964){logger[_0x73d4('0x13')](_0x73d4('0x5c'),_0x5dbe62);return _0x549b78['status'](0x1f4)[_0x73d4('0x16')](_0x5dbe62['message']);}logger['error'](_0x73d4('0x5d'),_0x331964['id'],JSON[_0x73d4('0x5e')](_0x5dbe62));});}; \ No newline at end of file +var _0xb6f2=['toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','error','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','MicrosoftAzure','decryptString','data3','catch','show','keys','length','include','find','service','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64'];(function(_0x99004e,_0x20aec4){var _0x3f79ad=function(_0x3428c3){while(--_0x3428c3){_0x99004e['push'](_0x99004e['shift']());}};_0x3f79ad(++_0x20aec4);}(_0xb6f2,0xce));var _0x2b6f=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb6f2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x2b6f('0x0'));var Redis=require(_0x2b6f('0x1'));var qs=require(_0x2b6f('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2b6f('0x3'));var db=require(_0x2b6f('0x4'))['db'];var oauth=require(_0x2b6f('0x5'));config[_0x2b6f('0x6')]=_[_0x2b6f('0x7')](config[_0x2b6f('0x6')],{'host':_0x2b6f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b6f('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1e23c2,_0x3d5767){_0x3d5767=_0x3d5767||0xcc;return function(_0x82ba69){if(_0x82ba69){return _0x1e23c2[_0x2b6f('0x9')](_0x3d5767);}return _0x1e23c2[_0x2b6f('0xa')](_0x3d5767)[_0x2b6f('0xb')]();};}function respondWithResult(_0x264226,_0x500cc8){_0x500cc8=_0x500cc8||0xc8;return function(_0x48bbc){if(_0x48bbc){return _0x264226[_0x2b6f('0xa')](_0x500cc8)[_0x2b6f('0xc')](_0x48bbc);}};}function respondWithFilteredResult(_0x20cb41,_0x61dcbd){return function(_0x519ad2){if(_0x519ad2){var _0x3df854=typeof _0x61dcbd['offset']==='undefined'&&typeof _0x61dcbd[_0x2b6f('0xd')]==='undefined';var _0x54f8c8=_0x519ad2[_0x2b6f('0xe')];var _0x143f60=_0x3df854?0x0:_0x61dcbd[_0x2b6f('0xf')];var _0x17ee5f=_0x3df854?_0x519ad2[_0x2b6f('0xe')]:_0x61dcbd['offset']+_0x61dcbd[_0x2b6f('0xd')];var _0x4379dd;if(_0x17ee5f>=_0x54f8c8){_0x17ee5f=_0x54f8c8;_0x4379dd=0xc8;}else{_0x4379dd=0xce;}_0x20cb41[_0x2b6f('0xa')](_0x4379dd);return _0x20cb41[_0x2b6f('0x10')](_0x2b6f('0x11'),_0x143f60+'-'+_0x17ee5f+'/'+_0x54f8c8)[_0x2b6f('0xc')](_0x519ad2);}return null;};}function saveUpdates(_0x308211){return function(_0x331cd1){if(_0x331cd1){return _0x331cd1[_0x2b6f('0x12')](_0x308211)[_0x2b6f('0x13')](function(_0x31e31f){return _0x31e31f;});}return null;};}function removeEntity(_0x43092a){return function(_0x380dca){if(_0x380dca){return _0x380dca[_0x2b6f('0x14')]()[_0x2b6f('0x13')](function(){_0x43092a[_0x2b6f('0xa')](0xcc)[_0x2b6f('0xb')]();});}};}function handleEntityNotFound(_0xadbecc){return function(_0x4a12cc){if(!_0x4a12cc){_0xadbecc[_0x2b6f('0x9')](0x194);}return _0x4a12cc;};}function handleError(_0x34c74f,_0x28c5c2){_0x28c5c2=_0x28c5c2||0x1f4;return function(_0x1dfc00){logger[_0x2b6f('0x15')](_0x1dfc00['stack']);if(_0x1dfc00[_0x2b6f('0x16')]){delete _0x1dfc00[_0x2b6f('0x16')];}_0x34c74f[_0x2b6f('0xa')](_0x28c5c2)['send'](_0x1dfc00);};}function maskClientSecret(_0x33f1eb){return _['padEnd'](_0x33f1eb[_0x2b6f('0x17')](0x0,0x3),0x14,'*');}exports[_0x2b6f('0x18')]=function(_0x5814b4,_0x124883){var _0x4af4b8={},_0x158f6e={},_0x1f4d61={'count':0x0,'rows':[]};var _0x186269=_[_0x2b6f('0x19')](db[_0x2b6f('0x1a')][_0x2b6f('0x1b')],function(_0x56dbe3){return{'name':_0x56dbe3[_0x2b6f('0x1c')],'type':_0x56dbe3[_0x2b6f('0x1d')][_0x2b6f('0x1e')]};});_0x158f6e[_0x2b6f('0x1f')]=_[_0x2b6f('0x19')](_0x186269,_0x2b6f('0x16'));_0x158f6e['query']=_['keys'](_0x5814b4[_0x2b6f('0x20')]);_0x158f6e[_0x2b6f('0x21')]=_[_0x2b6f('0x22')](_0x158f6e['model'],_0x158f6e[_0x2b6f('0x20')]);_0x4af4b8[_0x2b6f('0x23')]=_[_0x2b6f('0x22')](_0x158f6e[_0x2b6f('0x1f')],qs[_0x2b6f('0x24')](_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0x24')]));_0x4af4b8['attributes']=_0x4af4b8[_0x2b6f('0x23')]['length']?_0x4af4b8[_0x2b6f('0x23')]:_0x158f6e[_0x2b6f('0x1f')];if(!_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0x25')](_0x2b6f('0x26'))){_0x4af4b8[_0x2b6f('0xd')]=qs[_0x2b6f('0xd')](_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0xd')]);_0x4af4b8[_0x2b6f('0xf')]=qs[_0x2b6f('0xf')](_0x5814b4['query'][_0x2b6f('0xf')]);}_0x4af4b8[_0x2b6f('0x27')]=qs[_0x2b6f('0x28')](_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0x28')]);_0x4af4b8[_0x2b6f('0x29')]=qs[_0x2b6f('0x21')](_[_0x2b6f('0x2a')](_0x5814b4['query'],_0x158f6e[_0x2b6f('0x21')]),_0x186269);if(_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0x2b')]){_0x4af4b8['where']=_[_0x2b6f('0x2c')](_0x4af4b8[_0x2b6f('0x29')],{'$or':_[_0x2b6f('0x19')](_0x186269,function(_0x43b9f2){if(_0x43b9f2['type']!==_0x2b6f('0x2d')){var _0x1e55c9={};_0x1e55c9[_0x43b9f2['name']]={'$like':'%'+_0x5814b4['query'][_0x2b6f('0x2b')]+'%'};return _0x1e55c9;}})});}_0x4af4b8=_['merge']({},_0x4af4b8,_0x5814b4[_0x2b6f('0x2e')]);var _0x1a877a={'where':_0x4af4b8[_0x2b6f('0x29')]};return db[_0x2b6f('0x1a')][_0x2b6f('0xe')](_0x1a877a)['then'](function(_0x19b50c){_0x1f4d61[_0x2b6f('0xe')]=_0x19b50c;if(_0x5814b4[_0x2b6f('0x20')][_0x2b6f('0x2f')]){_0x4af4b8['include']=[{'all':!![]}];}return db[_0x2b6f('0x1a')][_0x2b6f('0x30')](_0x4af4b8);})['then'](function(_0x256d12){_0x1f4d61['rows']=_[_0x2b6f('0x19')](_0x256d12,function(_0x1a130e){if(_0x1a130e['service']===_0x2b6f('0x31')){var _0x1ac914=encryptor[_0x2b6f('0x32')](_0x1a130e['data3']);_0x1a130e[_0x2b6f('0x33')]=maskClientSecret(_0x1ac914);}return _0x1a130e;});return _0x1f4d61;})[_0x2b6f('0x13')](respondWithFilteredResult(_0x124883,_0x4af4b8))[_0x2b6f('0x34')](handleError(_0x124883,null));};exports[_0x2b6f('0x35')]=function(_0xca9842,_0x4bc6c3){var _0x3e8ede={'raw':!![],'where':{'id':_0xca9842['params']['id']}},_0x46f837={};_0x46f837[_0x2b6f('0x1f')]=_[_0x2b6f('0x36')](db[_0x2b6f('0x1a')]['rawAttributes']);_0x46f837['query']=_[_0x2b6f('0x36')](_0xca9842['query']);_0x46f837[_0x2b6f('0x21')]=_['intersection'](_0x46f837[_0x2b6f('0x1f')],_0x46f837[_0x2b6f('0x20')]);_0x3e8ede[_0x2b6f('0x23')]=_[_0x2b6f('0x22')](_0x46f837['model'],qs[_0x2b6f('0x24')](_0xca9842[_0x2b6f('0x20')][_0x2b6f('0x24')]));_0x3e8ede[_0x2b6f('0x23')]=_0x3e8ede[_0x2b6f('0x23')][_0x2b6f('0x37')]?_0x3e8ede[_0x2b6f('0x23')]:_0x46f837['model'];if(_0xca9842[_0x2b6f('0x20')][_0x2b6f('0x2f')]){_0x3e8ede[_0x2b6f('0x38')]=[{'all':!![]}];}_0x3e8ede=_[_0x2b6f('0x2c')]({},_0x3e8ede,_0xca9842[_0x2b6f('0x2e')]);return db[_0x2b6f('0x1a')][_0x2b6f('0x39')](_0x3e8ede)['then'](handleEntityNotFound(_0x4bc6c3,null))[_0x2b6f('0x13')](function(_0x5632ba){if(_0x5632ba[_0x2b6f('0x3a')]===_0x2b6f('0x31')){var _0x472f0a=encryptor[_0x2b6f('0x32')](_0x5632ba[_0x2b6f('0x33')]);_0x5632ba['data3']=maskClientSecret(_0x472f0a);}return _0x5632ba;})[_0x2b6f('0x13')](respondWithResult(_0x4bc6c3,null))[_0x2b6f('0x34')](handleError(_0x4bc6c3,null));};exports[_0x2b6f('0x3b')]=function(_0x15afc9,_0x2c60b1){if(!_0x15afc9[_0x2b6f('0x3c')][_0x2b6f('0x16')])throw new Error(_0x2b6f('0x3d'));if(!_0x15afc9['body']['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0xa361e9=db['CloudProvider'][_0x2b6f('0x1b')][_0x2b6f('0x3a')][_0x2b6f('0x3e')];if(!_0xa361e9[_0x2b6f('0x3f')](_0x15afc9[_0x2b6f('0x3c')][_0x2b6f('0x3a')]))throw new Error(_0x2b6f('0x40')+_0xa361e9[_0x2b6f('0x41')](',\x20'));if(_0x15afc9[_0x2b6f('0x3c')]['service']===_0x2b6f('0x31')&&_0x15afc9[_0x2b6f('0x3c')][_0x2b6f('0x33')]){_0x15afc9[_0x2b6f('0x3c')]['data3']=encryptor[_0x2b6f('0x42')](_0x15afc9[_0x2b6f('0x3c')]['data3']);}return db[_0x2b6f('0x1a')][_0x2b6f('0x3b')](_0x15afc9['body'],{})['then'](respondWithResult(_0x2c60b1,0xc9))[_0x2b6f('0x34')](handleError(_0x2c60b1,null));};exports['update']=function(_0x4d7a02,_0x37be4a){if(_0x4d7a02['body']['id']){delete _0x4d7a02[_0x2b6f('0x3c')]['id'];}return db[_0x2b6f('0x1a')][_0x2b6f('0x39')]({'where':{'id':_0x4d7a02[_0x2b6f('0x43')]['id']}})[_0x2b6f('0x13')](handleEntityNotFound(_0x37be4a,null))[_0x2b6f('0x13')](function(_0x515bad){if(_0x515bad[_0x2b6f('0x3a')]===_0x2b6f('0x31')&&_0x4d7a02[_0x2b6f('0x3c')][_0x2b6f('0x33')]){_0x4d7a02[_0x2b6f('0x3c')][_0x2b6f('0x33')]=encryptor[_0x2b6f('0x42')](_0x4d7a02[_0x2b6f('0x3c')]['data3']);}return _0x515bad;})[_0x2b6f('0x13')](saveUpdates(_0x4d7a02[_0x2b6f('0x3c')],null))[_0x2b6f('0x13')](respondWithResult(_0x37be4a,null))['catch'](handleError(_0x37be4a,null));};exports['destroy']=function(_0x515fe3,_0x3dd3fe){return db[_0x2b6f('0x1a')][_0x2b6f('0x39')]({'where':{'id':_0x515fe3[_0x2b6f('0x43')]['id']}})[_0x2b6f('0x13')](handleEntityNotFound(_0x3dd3fe,null))['then'](removeEntity(_0x3dd3fe,null))[_0x2b6f('0x34')](handleError(_0x3dd3fe,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4c855f,_0x278715){return db['CloudProvider'][_0x2b6f('0x44')]({'where':{'id':_0x4c855f[_0x2b6f('0x43')]['id']},'raw':!![]})[_0x2b6f('0x13')](function(_0x3c1076){if(!_0x3c1076)return _0x278715[_0x2b6f('0x9')](0x194);return{'url':oauth[_0x2b6f('0x45')](_0x3c1076,_0x4c855f['user']['id'])};})['then'](respondWithResult(_0x278715,null))[_0x2b6f('0x34')](handleError(_0x278715,null));};exports[_0x2b6f('0x46')]=function(_0x3541ea,_0x579b53){var _0x10198e=_0x3541ea[_0x2b6f('0x3c')];var _0x1d293d;var _0x4ade4e;if(_0x10198e['error'])throw _0x10198e;redis[_0x2b6f('0x47')](_0x10198e[_0x2b6f('0x48')])[_0x2b6f('0x13')](function(_0xc5e55a){if(!_0xc5e55a)throw new Error(_0x2b6f('0x49'));_0x1d293d=JSON['parse'](_0xc5e55a);var _0x1f8b7f=Buffer[_0x2b6f('0x4a')](_0x10198e[_0x2b6f('0x48')],_0x2b6f('0x4b'))[_0x2b6f('0x4c')](_0x2b6f('0x4d'));_0x4ade4e=JSON[_0x2b6f('0x4e')](_0x1f8b7f);if(!oauth[_0x2b6f('0x4f')](_0x10198e[_0x2b6f('0x50')],_0x1d293d[_0x2b6f('0x51')]))throw new Error(_0x2b6f('0x52'));redis['del'](_0x10198e[_0x2b6f('0x48')]);return oauth[_0x2b6f('0x53')](_0x10198e[_0x2b6f('0x54')],_0x1d293d);})[_0x2b6f('0x13')](function(_0x337e97){_0x1d293d[_0x2b6f('0x55')]=_0x337e97['access_token'];_0x1d293d[_0x2b6f('0x56')]=_0x337e97[_0x2b6f('0x57')];return db[_0x2b6f('0x1a')]['update']({'data5':_0x1d293d[_0x2b6f('0x55')],'data6':_0x1d293d[_0x2b6f('0x56')]},{'where':{'id':_0x1d293d['id']}});})[_0x2b6f('0x13')](function(){oauth[_0x2b6f('0x58')](_0x1d293d);socket[_0x2b6f('0x59')](_0x2b6f('0x5a'),{'id':_0x4ade4e['id']});return;})[_0x2b6f('0x13')](respondWithStatusCode(_0x579b53,null))[_0x2b6f('0x34')](function(_0xaf8971){if(_0x4ade4e){socket[_0x2b6f('0x59')](_0x2b6f('0x5b'),{'id':_0x4ade4e['id']});}if(!_0x1d293d){logger[_0x2b6f('0x15')](_0x2b6f('0x5c'),_0xaf8971);return _0x579b53['status'](0x1f4)['send'](_0xaf8971[_0x2b6f('0x5d')]);}logger[_0x2b6f('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1d293d['id'],JSON['stringify'](_0xaf8971));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index acc3a83..66ae21e 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 _0x9280=['bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger'];(function(_0x541a6b,_0x3ed296){var _0x41b7ed=function(_0x1f9f52){while(--_0x1f9f52){_0x541a6b['push'](_0x541a6b['shift']());}};_0x41b7ed(++_0x3ed296);}(_0x9280,0x19f));var _0x0928=function(_0x5d91bd,_0x395795){_0x5d91bd=_0x5d91bd-0x0;var _0x2b2b3e=_0x9280[_0x5d91bd];return _0x2b2b3e;};'use strict';var _=require(_0x0928('0x0'));var util=require(_0x0928('0x1'));var logger=require(_0x0928('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0928('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0928('0x4'));var rimraf=require(_0x0928('0x5'));var config=require(_0x0928('0x6'));var attributes=require(_0x0928('0x7'));module[_0x0928('0x8')]=function(_0x464e36,_0x513937){return _0x464e36[_0x0928('0x9')](_0x0928('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2658=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x234d62,_0x39aafc){var _0x4f5ae3=function(_0x4816a9){while(--_0x4816a9){_0x234d62['push'](_0x234d62['shift']());}};_0x4f5ae3(++_0x39aafc);}(_0x2658,0xa8));var _0x8265=function(_0x489959,_0x55c7d5){_0x489959=_0x489959-0x0;var _0x43f533=_0x2658[_0x489959];return _0x43f533;};'use strict';var _=require(_0x8265('0x0'));var util=require(_0x8265('0x1'));var logger=require(_0x8265('0x2'))(_0x8265('0x3'));var moment=require(_0x8265('0x4'));var BPromise=require('bluebird');var rp=require(_0x8265('0x5'));var fs=require('fs');var path=require(_0x8265('0x6'));var rimraf=require(_0x8265('0x7'));var config=require(_0x8265('0x8'));var attributes=require('./cloudProvider.attributes');module[_0x8265('0x9')]=function(_0x44a05e,_0xb00032){return _0x44a05e[_0x8265('0xa')](_0x8265('0xb'),attributes,{'tableName':_0x8265('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 045b1b5..2d6c077 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d71=['redirect_uri','data4','form_post','state','nonce','prompt','key','oauth2Claims','oauth2/','set','payload','iss','issuer','aud','isAfter','exp','data3','CloudProvider','findOne','refresh_token','decryptString','data2','data5','access_token','data6','update','then','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','{TENANT_ID}','intervals','bind','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','/.default','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365','replace','code','id_token','from','stringify','base64','randomBytes','toString','client_id','data1','response_type','join'];(function(_0x3b7e80,_0x3d1b12){var _0xe3c04d=function(_0x236aa9){while(--_0x236aa9){_0x3b7e80['push'](_0x3b7e80['shift']());}};_0xe3c04d(++_0x3d1b12);}(_0x1d71,0x71));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d7('0x0'));var crypto=require('crypto');var jwt=require(_0x11d7('0x1'));var moment=require('moment');var Redis=require(_0x11d7('0x2'));var rp=require(_0x11d7('0x3'));var util=require(_0x11d7('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x11d7('0x5'));var logger=require(_0x11d7('0x6'))(_0x11d7('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x11d7('0x8'))['db'];config[_0x11d7('0x9')]=_[_0x11d7('0xa')](config[_0x11d7('0x9')],{'host':_0x11d7('0xb'),'port':0x18eb});var redis=new Redis(config[_0x11d7('0x9')]);var MICROSOFT_AUTH_URL=_0x11d7('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x11d7('0xd'),_0x11d7('0xe'),_0x11d7('0xf'),_0x11d7('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x11d7('0x11'),_0x11d7('0x12')],'Dynamics365':['openid',_0x11d7('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x11d7('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x11d7('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x186211){var _0x5ab372=_[_0x11d7('0x15')](AZURE_AUTH_SCOPES[_0x186211[_0x11d7('0x16')]]);if(_0x186211[_0x11d7('0x16')]==='Dynamics365')_0x5ab372[_0x11d7('0x17')](_0x186211[_0x11d7('0x18')]+_0x11d7('0x19'));return _0x5ab372['join']('\x20');}function getAccessTokenScope(_0x59dcb6){if(_0x59dcb6[_0x11d7('0x16')]===_0x11d7('0x1a'))return _0x11d7('0x1b');if(_0x59dcb6[_0x11d7('0x16')]===_0x11d7('0x1c'))return _0x59dcb6[_0x11d7('0x18')]+_0x11d7('0x19');}function generateMicrosoftAuthorizationUrl(_0x138dfe,_0x1c7392){var _0x2030c1=MICROSOFT_AUTH_URL[_0x11d7('0x1d')]('{TENANT_ID}',_0x138dfe['data2']);var _0xe81ed8=[_0x11d7('0x1e'),_0x11d7('0x1f')];var _0x1b17f4=Buffer[_0x11d7('0x20')](JSON[_0x11d7('0x21')]({'id':_0x1c7392}))['toString'](_0x11d7('0x22'));var _0x2df932=crypto[_0x11d7('0x23')](0x10)[_0x11d7('0x24')]('hex');var _0x1299ee=getAuthorizationScopes(_0x138dfe);var _0x44306d=[{'key':_0x11d7('0x25'),'value':_0x138dfe[_0x11d7('0x26')]},{'key':_0x11d7('0x27'),'value':encodeURIComponent(_0xe81ed8[_0x11d7('0x28')]('\x20'))},{'key':_0x11d7('0x29'),'value':_0x138dfe[_0x11d7('0x2a')]},{'key':'response_mode','value':_0x11d7('0x2b')},{'key':'scope','value':encodeURIComponent(_0x1299ee)},{'key':_0x11d7('0x2c'),'value':_0x1b17f4},{'key':_0x11d7('0x2d'),'value':_0x2df932},{'key':_0x11d7('0x2e'),'value':'login'}];var _0x1ae94f=_0x2030c1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x11d7('0x15')](_0x44306d,function(_0x46264e){return _0x46264e[_0x11d7('0x2f')]+'='+_0x46264e['value'];})[_0x11d7('0x28')]('&');_0x138dfe[_0x11d7('0x30')]={'issuer':_0x2030c1[_0x11d7('0x1d')](_0x11d7('0x31'),''),'audience':_0x138dfe['data1'],'state':_0x1b17f4,'nonce':_0x2df932};redis[_0x11d7('0x32')](_0x1b17f4,JSON[_0x11d7('0x21')](_0x138dfe));return _0x1ae94f;}function isValidIdToken(_0x10d078,_0x1be893){try{var _0x17ea7b=jwt['decode'](_0x10d078,{'complete':!![]});var _0x5caf6d=_0x17ea7b[_0x11d7('0x33')];if(_0x5caf6d[_0x11d7('0x34')]!==_0x1be893[_0x11d7('0x35')])return![];if(_0x5caf6d[_0x11d7('0x36')]!==_0x1be893['audience'])return![];if(_0x5caf6d[_0x11d7('0x2d')]!==_0x1be893['nonce'])return![];if(moment()[_0x11d7('0x37')](moment['unix'](_0x5caf6d[_0x11d7('0x38')])))return![];return!![];}catch(_0x4bfaaf){throw _0x4bfaaf;}}function refreshOauth2MicrosoftAccessToken(_0x8d4aad){return Promise['resolve']()['then'](function(){if(_0x8d4aad[_0x11d7('0x39')])return _0x8d4aad;return db[_0x11d7('0x3a')][_0x11d7('0x3b')]({'where':{'id':_0x8d4aad['id']},'raw':!![]});})['then'](function(_0x36169e){var _0x4003fe={'grant_type':_0x11d7('0x3c'),'refresh_token':_0x36169e['data6'],'scope':getAccessTokenScope(_0x36169e),'redirect_uri':_0x36169e['data4'],'client_id':_0x36169e[_0x11d7('0x26')],'client_secret':encryptor[_0x11d7('0x3d')](_0x36169e[_0x11d7('0x39')])};var _0x16dca9={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x11d7('0x1d')]('{TENANT_ID}',_0x36169e[_0x11d7('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4003fe,'json':!![]};return rp(_0x16dca9);})['then'](function(_0x35f980){_0x8d4aad[_0x11d7('0x3f')]=_0x35f980[_0x11d7('0x40')];_0x8d4aad[_0x11d7('0x41')]=_0x35f980[_0x11d7('0x3c')];return db[_0x11d7('0x3a')][_0x11d7('0x42')]({'data5':_0x8d4aad[_0x11d7('0x3f')],'data6':_0x8d4aad[_0x11d7('0x41')]},{'where':{'id':_0x8d4aad['id']}});})[_0x11d7('0x43')](function(){return _0x8d4aad;})['catch'](function(_0x59e24b){logger[_0x11d7('0x44')](_0x11d7('0x45'),_0x8d4aad['id'],_0x59e24b);});}function getOauth2MicrosoftAccessToken(_0x2875c8,_0x26b1e2){var _0x40c428={'grant_type':_0x11d7('0x46'),'code':_0x2875c8,'scope':getAccessTokenScope(_0x26b1e2),'redirect_uri':_0x26b1e2[_0x11d7('0x2a')],'client_id':_0x26b1e2['data1'],'client_secret':encryptor[_0x11d7('0x3d')](_0x26b1e2[_0x11d7('0x39')])};var _0x59486e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x11d7('0x1d')](_0x11d7('0x47'),_0x26b1e2[_0x11d7('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x40c428,'json':!![]};return rp(_0x59486e);}function startRefreshInterval(_0xafb004){var _0x5365c2=schedule[_0x11d7('0x48')];if(_0x5365c2[_0xafb004['id']])clearInterval(_0x5365c2[_0xafb004['id']]);_0x5365c2[_0xafb004['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x11d7('0x49')](this,{'id':_0xafb004['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x11d7('0x48')]=_0x5365c2;}function startAllRefreshIntervals(){return db[_0x11d7('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x58ebb3){var _0x1492b4=_0x58ebb3[_0x11d7('0x15')](function(_0x28ee70){return refreshOauth2MicrosoftAccessToken(_0x28ee70)[_0x11d7('0x43')](function(_0x2109f2){startRefreshInterval(_0x2109f2);});});return Promise[_0x11d7('0x4a')](_0x1492b4);})['catch'](function(_0x2c9fe4){var _0x364599=_0x2c9fe4?util['inspect'](_0x2c9fe4,{'showHidden':![],'depth':null}):'';logger[_0x11d7('0x44')](_0x11d7('0x4b'),_0x364599);});}module[_0x11d7('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb70c=['openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','redirect_uri','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','data4','decryptString','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x5847,_0xa770eb){var _0x273c96=function(_0x396df9){while(--_0x396df9){_0x5847['push'](_0x5847['shift']());}};_0x273c96(++_0xa770eb);}(_0xb70c,0x1d4));var _0xcb70=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0xb70c[_0x3cb21e];return _0xeacd6a;};'use strict';var _=require('lodash');var crypto=require(_0xcb70('0x0'));var jwt=require(_0xcb70('0x1'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0xcb70('0x2'));var util=require(_0xcb70('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0xcb70('0x4'));var logger=require(_0xcb70('0x5'))(_0xcb70('0x6'));var schedule=require(_0xcb70('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcb70('0x8')](config[_0xcb70('0x9')],{'host':_0xcb70('0xa'),'port':0x18eb});var redis=new Redis(config[_0xcb70('0x9')]);var MICROSOFT_AUTH_URL=_0xcb70('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xcb70('0xc'),'profile',_0xcb70('0xd'),'offline_access',_0xcb70('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0xcb70('0xf')],'Dynamics365':['openid',_0xcb70('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xcb70('0x11');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x237e2f){var _0x45dbca=_['map'](AZURE_AUTH_SCOPES[_0x237e2f[_0xcb70('0x12')]]);if(_0x237e2f[_0xcb70('0x12')]===_0xcb70('0x13'))_0x45dbca['push'](_0x237e2f[_0xcb70('0x14')]+_0xcb70('0x15'));return _0x45dbca[_0xcb70('0x16')]('\x20');}function getAccessTokenScope(_0x2c7d76){if(_0x2c7d76[_0xcb70('0x12')]===_0xcb70('0x17'))return _0xcb70('0xe');if(_0x2c7d76[_0xcb70('0x12')]===_0xcb70('0x13'))return _0x2c7d76[_0xcb70('0x14')]+_0xcb70('0x15');}function generateMicrosoftAuthorizationUrl(_0xda8786,_0x3bd582){var _0x45fe1b=MICROSOFT_AUTH_URL[_0xcb70('0x18')](_0xcb70('0x19'),_0xda8786[_0xcb70('0x1a')]);var _0xb2f8b5=[_0xcb70('0x1b'),_0xcb70('0x1c')];var _0x5cdf27=Buffer[_0xcb70('0x1d')](JSON[_0xcb70('0x1e')]({'id':_0x3bd582}))['toString'](_0xcb70('0x1f'));var _0x34dfd8=crypto[_0xcb70('0x20')](0x10)[_0xcb70('0x21')](_0xcb70('0x22'));var _0x3ddee7=getAuthorizationScopes(_0xda8786);var _0x18df9b=[{'key':_0xcb70('0x23'),'value':_0xda8786[_0xcb70('0x24')]},{'key':'response_type','value':encodeURIComponent(_0xb2f8b5['join']('\x20'))},{'key':_0xcb70('0x25'),'value':_0xda8786['data4']},{'key':'response_mode','value':'form_post'},{'key':_0xcb70('0x26'),'value':encodeURIComponent(_0x3ddee7)},{'key':_0xcb70('0x27'),'value':_0x5cdf27},{'key':_0xcb70('0x28'),'value':_0x34dfd8},{'key':_0xcb70('0x29'),'value':_0xcb70('0x2a')}];var _0x19c29f=_0x45fe1b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xcb70('0x2b')](_0x18df9b,function(_0x52876b){return _0x52876b[_0xcb70('0x2c')]+'='+_0x52876b[_0xcb70('0x2d')];})[_0xcb70('0x16')]('&');_0xda8786[_0xcb70('0x2e')]={'issuer':_0x45fe1b[_0xcb70('0x18')](_0xcb70('0x2f'),''),'audience':_0xda8786[_0xcb70('0x24')],'state':_0x5cdf27,'nonce':_0x34dfd8};redis['set'](_0x5cdf27,JSON['stringify'](_0xda8786));return _0x19c29f;}function isValidIdToken(_0x200747,_0x371e9d){try{var _0x19ef7a=jwt[_0xcb70('0x30')](_0x200747,{'complete':!![]});var _0x419100=_0x19ef7a[_0xcb70('0x31')];if(_0x419100[_0xcb70('0x32')]!==_0x371e9d[_0xcb70('0x33')])return![];if(_0x419100[_0xcb70('0x34')]!==_0x371e9d[_0xcb70('0x35')])return![];if(_0x419100[_0xcb70('0x28')]!==_0x371e9d[_0xcb70('0x28')])return![];if(moment()[_0xcb70('0x36')](moment[_0xcb70('0x37')](_0x419100[_0xcb70('0x38')])))return![];return!![];}catch(_0x1b4ba7){throw _0x1b4ba7;}}function refreshOauth2MicrosoftAccessToken(_0xa8d181){return Promise[_0xcb70('0x39')]()[_0xcb70('0x3a')](function(){if(_0xa8d181[_0xcb70('0x3b')])return _0xa8d181;return db[_0xcb70('0x3c')][_0xcb70('0x3d')]({'where':{'id':_0xa8d181['id']},'raw':!![]});})[_0xcb70('0x3a')](function(_0x5640a4){var _0x45664={'grant_type':'refresh_token','refresh_token':_0x5640a4[_0xcb70('0x3e')],'scope':getAccessTokenScope(_0x5640a4),'redirect_uri':_0x5640a4[_0xcb70('0x3f')],'client_id':_0x5640a4[_0xcb70('0x24')],'client_secret':encryptor[_0xcb70('0x40')](_0x5640a4[_0xcb70('0x3b')])};var _0x2bbb3e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xcb70('0x18')](_0xcb70('0x19'),_0x5640a4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x45664,'json':!![]};return rp(_0x2bbb3e);})[_0xcb70('0x3a')](function(_0x224dd8){_0xa8d181[_0xcb70('0x41')]=_0x224dd8[_0xcb70('0x42')];_0xa8d181[_0xcb70('0x3e')]=_0x224dd8[_0xcb70('0x43')];return db['CloudProvider'][_0xcb70('0x44')]({'data5':_0xa8d181['data5'],'data6':_0xa8d181['data6']},{'where':{'id':_0xa8d181['id']}});})[_0xcb70('0x3a')](function(){return _0xa8d181;})[_0xcb70('0x45')](function(_0x5240a8){logger[_0xcb70('0x46')](_0xcb70('0x47'),_0xa8d181['id'],_0x5240a8);});}function getOauth2MicrosoftAccessToken(_0x346be6,_0x4ba0f8){var _0x2db970={'grant_type':_0xcb70('0x48'),'code':_0x346be6,'scope':getAccessTokenScope(_0x4ba0f8),'redirect_uri':_0x4ba0f8[_0xcb70('0x3f')],'client_id':_0x4ba0f8[_0xcb70('0x24')],'client_secret':encryptor['decryptString'](_0x4ba0f8[_0xcb70('0x3b')])};var _0x2124b2={'method':_0xcb70('0x49'),'uri':MICROSOFT_AUTH_URL[_0xcb70('0x18')](_0xcb70('0x19'),_0x4ba0f8[_0xcb70('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2db970,'json':!![]};return rp(_0x2124b2);}function startRefreshInterval(_0x34cff8){var _0x58e08c=schedule[_0xcb70('0x4a')];if(_0x58e08c[_0x34cff8['id']])clearInterval(_0x58e08c[_0x34cff8['id']]);_0x58e08c[_0x34cff8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xcb70('0x4b')](this,{'id':_0x34cff8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x58e08c;}function startAllRefreshIntervals(){return db[_0xcb70('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xcb70('0x3a')](function(_0x32a0bb){var _0x222752=_0x32a0bb[_0xcb70('0x2b')](function(_0xf33627){return refreshOauth2MicrosoftAccessToken(_0xf33627)[_0xcb70('0x3a')](function(_0x22f8ea){startRefreshInterval(_0x22f8ea);});});return Promise[_0xcb70('0x4c')](_0x222752);})[_0xcb70('0x45')](function(_0x3cd8b8){var _0x189dad=_0x3cd8b8?util[_0xcb70('0x4d')](_0x3cd8b8,{'showHidden':![],'depth':null}):'';logger[_0xcb70('0x46')](_0xcb70('0x4e'),_0x189dad);});}module[_0xcb70('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index e864b7c..81cfb65 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 _0xa5c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x58dc59,_0x351208){_0x58dc59=_0x58dc59-0x0;var _0x4a2c8b=_0xa5c1[_0x58dc59];return _0x4a2c8b;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('CloudProvider,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});} \ No newline at end of file +var _0x3646=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','info','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3646,0x15f));var _0x6364=function(_0x4cb655,_0x2db09f){_0x4cb655=_0x4cb655-0x0;var _0x406fb0=_0x3646[_0x4cb655];return _0x406fb0;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var moment=require(_0x6364('0x2'));var BPromise=require(_0x6364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6364('0x4'));var db=require(_0x6364('0x5'))['db'];var utils=require(_0x6364('0x6'));var logger=require(_0x6364('0x7'))(_0x6364('0x8'));var config=require(_0x6364('0x9'));var jayson=require(_0x6364('0xa'));var client=jayson[_0x6364('0xb')][_0x6364('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x681d9c,_0x256949,_0x520a3d){return new BPromise(function(_0x1be238,_0x24706f){return client[_0x6364('0xd')](_0x681d9c,_0x520a3d)[_0x6364('0xe')](function(_0x4945cd){logger['info']('CloudProvider,\x20%s,\x20%s',_0x256949,_0x6364('0xf'));logger[_0x6364('0x10')](_0x6364('0x11'),_0x256949,_0x6364('0xf'),JSON[_0x6364('0x12')](_0x4945cd));if(_0x4945cd[_0x6364('0x13')]){if(_0x4945cd[_0x6364('0x13')]['code']===0x1f4){logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x4945cd[_0x6364('0x13')]['message']);return _0x24706f(_0x4945cd[_0x6364('0x13')][_0x6364('0x15')]);}logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x4945cd['error'][_0x6364('0x15')]);return _0x1be238(_0x4945cd['error'][_0x6364('0x15')]);}else{logger[_0x6364('0x16')](_0x6364('0x14'),_0x256949,'request\x20sent');_0x1be238(_0x4945cd[_0x6364('0x17')][_0x6364('0x15')]);}})[_0x6364('0x18')](function(_0x363fd7){logger[_0x6364('0x13')](_0x6364('0x14'),_0x256949,_0x363fd7);_0x24706f(_0x363fd7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b7f1aa7..efadbfd 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x365882,_0x34bf3f){var _0x3bcd97=function(_0x27da69){while(--_0x27da69){_0x365882['push'](_0x365882['shift']());}};_0x3bcd97(++_0x34bf3f);}(_0x2ef3,0xba));var _0x32ef=function(_0x446ef9,_0x7fa2f7){_0x446ef9=_0x446ef9-0x0;var _0x1b348a=_0x2ef3[_0x446ef9];return _0x1b348a;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1e70b0,_0x47c603){var _0x5e86d7=function(_0x1c17e1){while(--_0x1c17e1){_0x1e70b0['push'](_0x1e70b0['shift']());}};_0x5e86d7(++_0x47c603);}(_0xadb5,0xad));var _0x5adb=function(_0x514a50,_0x22e173){_0x514a50=_0x514a50-0x0;var _0x4b086f=_0xadb5[_0x514a50];return _0x4b086f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 06066c6..222e58f 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 _0x3df4=['STRING','exports'];(function(_0x96f54d,_0x5e5d21){var _0xdb885c=function(_0x35225c){while(--_0x35225c){_0x96f54d['push'](_0x96f54d['shift']());}};_0xdb885c(++_0x5e5d21);}(_0x3df4,0x137));var _0x43df=function(_0x58cd9c,_0x584d3d){_0x58cd9c=_0x58cd9c-0x0;var _0x93fd95=_0x3df4[_0x58cd9c];return _0x93fd95;};'use strict';var Sequelize=require('sequelize');module[_0x43df('0x0')]={'name':{'type':Sequelize[_0x43df('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x43df('0x1')]},'website':{'type':Sequelize[_0x43df('0x1')]},'phone':{'type':Sequelize[_0x43df('0x1')]},'fax':{'type':Sequelize[_0x43df('0x1')]},'type':{'type':Sequelize[_0x43df('0x1')]},'street':{'type':Sequelize[_0x43df('0x1')]},'postalCode':{'type':Sequelize[_0x43df('0x1')]},'city':{'type':Sequelize[_0x43df('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x43df('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x43df('0x1')]},'sStreet':{'type':Sequelize[_0x43df('0x1')]},'sPostalCode':{'type':Sequelize[_0x43df('0x1')]},'sCity':{'type':Sequelize[_0x43df('0x1')]},'sCountry':{'type':Sequelize[_0x43df('0x1')]},'description':{'type':Sequelize[_0x43df('0x1')]}}; \ No newline at end of file +var _0x238f=['sequelize','exports','STRING','name'];(function(_0x3fe0ec,_0x51e29e){var _0x1ce57b=function(_0x3635f3){while(--_0x3635f3){_0x3fe0ec['push'](_0x3fe0ec['shift']());}};_0x1ce57b(++_0x51e29e);}(_0x238f,0x1d4));var _0xf238=function(_0xa40d71,_0x4098b4){_0xa40d71=_0xa40d71-0x0;var _0x26a223=_0x238f[_0xa40d71];return _0x26a223;};'use strict';var Sequelize=require(_0xf238('0x0'));module[_0xf238('0x1')]={'name':{'type':Sequelize[_0xf238('0x2')],'unique':_0xf238('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf238('0x2')]},'companyId':{'type':Sequelize[_0xf238('0x2')]},'website':{'type':Sequelize[_0xf238('0x2')]},'phone':{'type':Sequelize[_0xf238('0x2')]},'fax':{'type':Sequelize[_0xf238('0x2')]},'type':{'type':Sequelize[_0xf238('0x2')]},'street':{'type':Sequelize[_0xf238('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf238('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf238('0x2')]},'sStreet':{'type':Sequelize[_0xf238('0x2')]},'sPostalCode':{'type':Sequelize[_0xf238('0x2')]},'sCity':{'type':Sequelize[_0xf238('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf238('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index caad961..dc9378a 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 _0x71f1=['Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','findAll','rows','catch','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','omit','findOne','rawAttributes','pick','map','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71f1,0x130));var _0x171f=function(_0x356dcc,_0x51f8f7){_0x356dcc=_0x356dcc-0x0;var _0xe6c019=_0x71f1[_0x356dcc];return _0xe6c019;};'use strict';var emlformat=require(_0x171f('0x0'));var rimraf=require(_0x171f('0x1'));var zipdir=require(_0x171f('0x2'));var jsonpatch=require(_0x171f('0x3'));var rp=require(_0x171f('0x4'));var moment=require(_0x171f('0x5'));var BPromise=require(_0x171f('0x6'));var Mustache=require(_0x171f('0x7'));var util=require('util');var path=require(_0x171f('0x8'));var sox=require(_0x171f('0x9'));var csv=require('to-csv');var ejs=require(_0x171f('0xa'));var fs=require('fs');var fs_extra=require(_0x171f('0xb'));var _=require('lodash');var squel=require(_0x171f('0xc'));var crypto=require('crypto');var jsforce=require(_0x171f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x171f('0xe'));var querystring=require(_0x171f('0xf'));var Papa=require(_0x171f('0x10'));var Redis=require(_0x171f('0x11'));var authService=require(_0x171f('0x12'));var qs=require(_0x171f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x171f('0x14'));var logger=require(_0x171f('0x15'))(_0x171f('0x16'));var utils=require('../../config/utils');var config=require(_0x171f('0x17'));var licenseUtil=require(_0x171f('0x18'));var db=require(_0x171f('0x19'))['db'];function respondWithStatusCode(_0x1625b8,_0x16872d){_0x16872d=_0x16872d||0xcc;return function(_0x4700fa){if(_0x4700fa){return _0x1625b8[_0x171f('0x1a')](_0x16872d);}return _0x1625b8[_0x171f('0x1b')](_0x16872d)[_0x171f('0x1c')]();};}function respondWithResult(_0x22bc15,_0x40d518){_0x40d518=_0x40d518||0xc8;return function(_0x5379ec){if(_0x5379ec){return _0x22bc15[_0x171f('0x1b')](_0x40d518)[_0x171f('0x1d')](_0x5379ec);}};}function respondWithFilteredResult(_0x5bee2b,_0x30c96b){return function(_0x48e57c){if(_0x48e57c){var _0x438aac=typeof _0x30c96b[_0x171f('0x1e')]===_0x171f('0x1f')&&typeof _0x30c96b[_0x171f('0x20')]==='undefined';var _0x20e157=_0x48e57c[_0x171f('0x21')];var _0x24f13e=_0x438aac?0x0:_0x30c96b['offset'];var _0x104f28=_0x438aac?_0x48e57c[_0x171f('0x21')]:_0x30c96b[_0x171f('0x1e')]+_0x30c96b[_0x171f('0x20')];var _0x2afe9c;if(_0x104f28>=_0x20e157){_0x104f28=_0x20e157;_0x2afe9c=0xc8;}else{_0x2afe9c=0xce;}_0x5bee2b[_0x171f('0x1b')](_0x2afe9c);return _0x5bee2b['set']('Content-Range',_0x24f13e+'-'+_0x104f28+'/'+_0x20e157)[_0x171f('0x1d')](_0x48e57c);}return null;};}function patchUpdates(_0x685464){return function(_0x16bd9f){try{jsonpatch[_0x171f('0x22')](_0x16bd9f,_0x685464,!![]);}catch(_0x2946fd){return BPromise[_0x171f('0x23')](_0x2946fd);}return _0x16bd9f['save']();};}function saveUpdates(_0x23ad7e,_0x5acae4){return function(_0x34915d){if(_0x34915d){return _0x34915d[_0x171f('0x24')](_0x23ad7e)['then'](function(_0x2834f6){return _0x2834f6;});}return null;};}function removeEntity(_0x2fa751,_0x2f7bd9){return function(_0x5c8539){if(_0x5c8539){return _0x5c8539[_0x171f('0x25')]()[_0x171f('0x26')](function(){var _0x1a5205=_0x5c8539[_0x171f('0x27')]({'plain':!![]});var _0x56c308=_0x171f('0x28');return db[_0x171f('0x29')]['destroy']({'where':{'type':_0x56c308,'resourceId':_0x1a5205['id']}})[_0x171f('0x26')](function(){return _0x5c8539;});})[_0x171f('0x26')](function(){_0x2fa751[_0x171f('0x1b')](0xcc)[_0x171f('0x1c')]();});}};}function handleEntityNotFound(_0x27ec9c,_0x46f166){return function(_0x41bb84){if(!_0x41bb84){_0x27ec9c[_0x171f('0x1a')](0x194);}return _0x41bb84;};}function handleError(_0x1ae388,_0x56fcfb){_0x56fcfb=_0x56fcfb||0x1f4;return function(_0x4cad86){logger[_0x171f('0x2a')](_0x4cad86['stack']);if(_0x4cad86[_0x171f('0x2b')]){delete _0x4cad86[_0x171f('0x2b')];}_0x1ae388[_0x171f('0x1b')](_0x56fcfb)[_0x171f('0x2c')](_0x4cad86);};}exports[_0x171f('0x2d')]=function(_0x4e018c,_0x3ff13b){var _0x19e616={},_0x17f02f={},_0x208903={'count':0x0,'rows':[]};return db[_0x171f('0x2e')][_0x171f('0x2f')]()['then'](function(_0x1a5c0d){_0x17f02f[_0x171f('0x30')]=_[_0x171f('0x31')](_0x1a5c0d);_0x17f02f[_0x171f('0x32')]=_[_0x171f('0x31')](_0x4e018c[_0x171f('0x32')]);_0x17f02f[_0x171f('0x33')]=_[_0x171f('0x34')](_0x17f02f[_0x171f('0x30')],_0x17f02f[_0x171f('0x32')]);_0x19e616[_0x171f('0x35')]=_[_0x171f('0x34')](_0x17f02f['model'],qs[_0x171f('0x36')](_0x4e018c[_0x171f('0x32')]['fields']));_0x19e616[_0x171f('0x35')]=_0x19e616['attributes'][_0x171f('0x37')]?_0x19e616[_0x171f('0x35')]:_0x17f02f[_0x171f('0x30')];if(!_0x4e018c['query'][_0x171f('0x38')](_0x171f('0x39'))){_0x19e616[_0x171f('0x20')]=qs[_0x171f('0x20')](_0x4e018c[_0x171f('0x32')]['limit']);_0x19e616[_0x171f('0x1e')]=qs[_0x171f('0x1e')](_0x4e018c[_0x171f('0x32')][_0x171f('0x1e')]);}_0x19e616[_0x171f('0x3a')]=qs[_0x171f('0x3b')](_0x4e018c[_0x171f('0x32')]['sort']);_0x19e616['where']=qs['filters'](_['pick'](_0x4e018c[_0x171f('0x32')],_0x17f02f[_0x171f('0x33')]),_0x1a5c0d);if(_0x4e018c[_0x171f('0x32')][_0x171f('0x3c')]){_0x19e616[_0x171f('0x3d')]=_[_0x171f('0x3e')](_0x19e616[_0x171f('0x3d')],{'$or':_['map'](_0x19e616[_0x171f('0x35')],function(_0x97d8b1){var _0x26b01b={};_0x26b01b[_0x97d8b1]={'$like':'%'+_0x4e018c[_0x171f('0x32')][_0x171f('0x3c')]+'%'};return _0x26b01b;})});}_0x19e616=_['merge']({},_0x19e616,_0x4e018c['options']);var _0x1b772e={'where':_0x19e616[_0x171f('0x3d')]};return db[_0x171f('0x2e')][_0x171f('0x21')](_0x1b772e)[_0x171f('0x26')](function(_0xa0d687){_0x208903[_0x171f('0x21')]=_0xa0d687;if(_0x4e018c[_0x171f('0x32')][_0x171f('0x3f')]){_0x19e616['include']=[{'all':!![]}];}return db[_0x171f('0x2e')][_0x171f('0x40')](_0x19e616);})[_0x171f('0x26')](function(_0x3000ed){_0x208903[_0x171f('0x41')]=_0x3000ed;return _0x208903;})[_0x171f('0x26')](respondWithFilteredResult(_0x3ff13b,_0x19e616))[_0x171f('0x42')](handleError(_0x3ff13b,null));})['catch'](handleError(_0x3ff13b,null));};exports['show']=function(_0x2779a9,_0x20471e){var _0x4df7f2={'raw':![],'where':{'id':_0x2779a9[_0x171f('0x43')]['id']}},_0x19b386={};_0x19b386[_0x171f('0x30')]=_[_0x171f('0x31')](db[_0x171f('0x2e')]['rawAttributes']);_0x19b386[_0x171f('0x32')]=_[_0x171f('0x31')](_0x2779a9['query']);_0x19b386['filters']=_['intersection'](_0x19b386[_0x171f('0x30')],_0x19b386['query']);_0x4df7f2[_0x171f('0x35')]=_[_0x171f('0x34')](_0x19b386[_0x171f('0x30')],qs[_0x171f('0x36')](_0x2779a9['query'][_0x171f('0x36')]));_0x4df7f2[_0x171f('0x35')]=_0x4df7f2[_0x171f('0x35')][_0x171f('0x37')]?_0x4df7f2['attributes']:_0x19b386[_0x171f('0x30')];if(_0x2779a9[_0x171f('0x32')][_0x171f('0x3f')]){_0x4df7f2[_0x171f('0x44')]=[{'all':!![]}];}_0x4df7f2=_[_0x171f('0x3e')]({},_0x4df7f2,_0x2779a9[_0x171f('0x45')]);return db[_0x171f('0x2e')][_0x171f('0x46')](_0x4df7f2)[_0x171f('0x26')](handleEntityNotFound(_0x20471e,null))[_0x171f('0x26')](respondWithResult(_0x20471e,null))['catch'](handleError(_0x20471e,null));};exports[_0x171f('0x47')]=function(_0x57e528,_0x29c676){return db[_0x171f('0x2e')][_0x171f('0x47')](_0x57e528['body'],{})[_0x171f('0x26')](function(_0x3f8d46){var _0x21d466=_0x57e528[_0x171f('0x48')][_0x171f('0x27')]({'plain':!![]});if(!_0x21d466)throw new Error(_0x171f('0x49'));if(_0x21d466['role']==='user'){var _0x133bc1=_0x3f8d46[_0x171f('0x27')]({'plain':!![]});var _0x432eb8=_0x171f('0x28');return db[_0x171f('0x4a')][_0x171f('0x46')]({'where':{'name':_0x432eb8,'userProfileId':_0x21d466[_0x171f('0x4b')]},'raw':!![]})[_0x171f('0x26')](function(_0x2f74bd){if(_0x2f74bd&&_0x2f74bd['autoAssociation']===0x0){return db[_0x171f('0x29')][_0x171f('0x47')]({'name':_0x133bc1[_0x171f('0x2b')],'resourceId':_0x133bc1['id'],'type':_0x2f74bd[_0x171f('0x2b')],'sectionId':_0x2f74bd['id']},{})[_0x171f('0x26')](function(){return _0x3f8d46;});}else{return _0x3f8d46;}})[_0x171f('0x42')](function(_0x3be308){logger['error'](_0x171f('0x4c'),_0x3be308);throw _0x3be308;});}return _0x3f8d46;})[_0x171f('0x26')](respondWithResult(_0x29c676,0xc9))[_0x171f('0x42')](handleError(_0x29c676,null));};exports[_0x171f('0x24')]=function(_0x1882bf,_0x1c2493){if(_0x1882bf[_0x171f('0x4d')]['id']){delete _0x1882bf[_0x171f('0x4d')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x1882bf[_0x171f('0x43')]['id']}})[_0x171f('0x26')](handleEntityNotFound(_0x1c2493,null))[_0x171f('0x26')](saveUpdates(_0x1882bf[_0x171f('0x4d')],null))[_0x171f('0x26')](respondWithResult(_0x1c2493,null))['catch'](handleError(_0x1c2493,null));};exports['destroy']=function(_0x3a5f24,_0x238cb1){return db[_0x171f('0x2e')][_0x171f('0x46')]({'where':{'id':_0x3a5f24[_0x171f('0x43')]['id']}})[_0x171f('0x26')](handleEntityNotFound(_0x238cb1,null))[_0x171f('0x26')](removeEntity(_0x238cb1,null))[_0x171f('0x42')](handleError(_0x238cb1,null));};exports[_0x171f('0x2f')]=function(_0x1509cf,_0x2ea4c9){return db['CmCompany']['describe']()[_0x171f('0x26')](respondWithResult(_0x2ea4c9,null))[_0x171f('0x42')](handleError(_0x2ea4c9,null));};exports[_0x171f('0x4e')]=function(_0x456873,_0x25c30a,_0x515096){return db[_0x171f('0x4f')]['find']({'where':{'id':_0x456873[_0x171f('0x43')]['id']}})[_0x171f('0x26')](handleEntityNotFound(_0x25c30a,null))[_0x171f('0x26')](function(_0x2b44a6){if(_0x2b44a6){return _0x2b44a6[_0x171f('0x4e')](_0x456873[_0x171f('0x4d')]['ids'],_[_0x171f('0x50')](_0x456873['body'],['ids','id'])||{});}})[_0x171f('0x26')](respondWithResult(_0x25c30a,null))['catch'](handleError(_0x25c30a,null));};exports['getContacts']=function(_0x352977,_0xcceec0,_0x14f74b){var _0x33ff4a={};var _0x4ecb64={};var _0x11c330;var _0x350dcf;return db['CmCompany'][_0x171f('0x51')]({'where':{'id':_0x352977[_0x171f('0x43')]['id']}})[_0x171f('0x26')](handleEntityNotFound(_0xcceec0,null))[_0x171f('0x26')](function(_0x7dd1f2){if(_0x7dd1f2){_0x11c330=_0x7dd1f2;_0x4ecb64[_0x171f('0x30')]=_[_0x171f('0x31')](db[_0x171f('0x4f')][_0x171f('0x52')]);_0x4ecb64['query']=_['keys'](_0x352977[_0x171f('0x32')]);_0x4ecb64[_0x171f('0x33')]=_[_0x171f('0x34')](_0x4ecb64[_0x171f('0x30')],_0x4ecb64['query']);_0x33ff4a[_0x171f('0x35')]=_[_0x171f('0x34')](_0x4ecb64['model'],qs[_0x171f('0x36')](_0x352977[_0x171f('0x32')]['fields']));_0x33ff4a[_0x171f('0x35')]=_0x33ff4a[_0x171f('0x35')][_0x171f('0x37')]?_0x33ff4a['attributes']:_0x4ecb64['model'];_0x33ff4a[_0x171f('0x3a')]=qs[_0x171f('0x3b')](_0x352977[_0x171f('0x32')][_0x171f('0x3b')]);_0x33ff4a['where']=qs[_0x171f('0x33')](_[_0x171f('0x53')](_0x352977[_0x171f('0x32')],_0x4ecb64[_0x171f('0x33')]));if(_0x352977[_0x171f('0x32')][_0x171f('0x3c')]){_0x33ff4a[_0x171f('0x3d')]=_[_0x171f('0x3e')](_0x33ff4a[_0x171f('0x3d')],{'$or':_[_0x171f('0x54')](_0x33ff4a[_0x171f('0x35')],function(_0x496bec){var _0x394ea3={};_0x394ea3[_0x496bec]={'$like':'%'+_0x352977[_0x171f('0x32')][_0x171f('0x3c')]+'%'};return _0x394ea3;})});}_0x33ff4a=_[_0x171f('0x3e')]({},_0x33ff4a,_0x352977[_0x171f('0x45')]);return _0x11c330[_0x171f('0x55')](_0x33ff4a);}})[_0x171f('0x26')](function(_0x57e568){if(_0x57e568){_0x350dcf=_0x57e568[_0x171f('0x37')];if(!_0x352977[_0x171f('0x32')][_0x171f('0x38')]('nolimit')){_0x33ff4a['limit']=qs[_0x171f('0x20')](_0x352977['query'][_0x171f('0x20')]);_0x33ff4a[_0x171f('0x1e')]=qs['offset'](_0x352977['query'][_0x171f('0x1e')]);}return _0x11c330[_0x171f('0x55')](_0x33ff4a);}})[_0x171f('0x26')](function(_0x2051a7){if(_0x2051a7){return _0x2051a7?{'count':_0x350dcf,'rows':_0x2051a7}:null;}})[_0x171f('0x26')](respondWithResult(_0xcceec0,null))[_0x171f('0x42')](handleError(_0xcceec0,null));}; \ No newline at end of file +var _0xcfd3=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','params','CmContact','addContacts','getContacts','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection'];(function(_0x372de8,_0x186bf2){var _0x598aa5=function(_0xba495f){while(--_0xba495f){_0x372de8['push'](_0x372de8['shift']());}};_0x598aa5(++_0x186bf2);}(_0xcfd3,0xca));var _0x3cfd=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcfd3[_0x25701b];return _0x3a8a2c;};'use strict';var emlformat=require(_0x3cfd('0x0'));var rimraf=require(_0x3cfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cfd('0x2'));var rp=require(_0x3cfd('0x3'));var moment=require(_0x3cfd('0x4'));var BPromise=require(_0x3cfd('0x5'));var Mustache=require(_0x3cfd('0x6'));var util=require(_0x3cfd('0x7'));var path=require(_0x3cfd('0x8'));var sox=require(_0x3cfd('0x9'));var csv=require(_0x3cfd('0xa'));var ejs=require(_0x3cfd('0xb'));var fs=require('fs');var fs_extra=require(_0x3cfd('0xc'));var _=require(_0x3cfd('0xd'));var squel=require(_0x3cfd('0xe'));var crypto=require('crypto');var jsforce=require(_0x3cfd('0xf'));var deskjs=require(_0x3cfd('0x10'));var toCsv=require(_0x3cfd('0xa'));var querystring=require(_0x3cfd('0x11'));var Papa=require('papaparse');var Redis=require(_0x3cfd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3cfd('0x13'));var as=require(_0x3cfd('0x14'));var hardwareService=require(_0x3cfd('0x15'));var logger=require(_0x3cfd('0x16'))(_0x3cfd('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cfd('0x18'));var db=require(_0x3cfd('0x19'))['db'];function respondWithStatusCode(_0x40c4c0,_0x47ef97){_0x47ef97=_0x47ef97||0xcc;return function(_0x2c59c8){if(_0x2c59c8){return _0x40c4c0['sendStatus'](_0x47ef97);}return _0x40c4c0[_0x3cfd('0x1a')](_0x47ef97)[_0x3cfd('0x1b')]();};}function respondWithResult(_0x5d2502,_0x50282e){_0x50282e=_0x50282e||0xc8;return function(_0x575d63){if(_0x575d63){return _0x5d2502[_0x3cfd('0x1a')](_0x50282e)[_0x3cfd('0x1c')](_0x575d63);}};}function respondWithFilteredResult(_0x55b15a,_0x200f6c){return function(_0x1c671e){if(_0x1c671e){var _0x27a3b1=typeof _0x200f6c[_0x3cfd('0x1d')]===_0x3cfd('0x1e')&&typeof _0x200f6c[_0x3cfd('0x1f')]===_0x3cfd('0x1e');var _0x5e03b7=_0x1c671e[_0x3cfd('0x20')];var _0x2f908c=_0x27a3b1?0x0:_0x200f6c[_0x3cfd('0x1d')];var _0x4c68da=_0x27a3b1?_0x1c671e[_0x3cfd('0x20')]:_0x200f6c[_0x3cfd('0x1d')]+_0x200f6c['limit'];var _0x288931;if(_0x4c68da>=_0x5e03b7){_0x4c68da=_0x5e03b7;_0x288931=0xc8;}else{_0x288931=0xce;}_0x55b15a['status'](_0x288931);return _0x55b15a[_0x3cfd('0x21')]('Content-Range',_0x2f908c+'-'+_0x4c68da+'/'+_0x5e03b7)['json'](_0x1c671e);}return null;};}function patchUpdates(_0x3dc9ae){return function(_0x695f8e){try{jsonpatch[_0x3cfd('0x22')](_0x695f8e,_0x3dc9ae,!![]);}catch(_0x57f8bc){return BPromise[_0x3cfd('0x23')](_0x57f8bc);}return _0x695f8e['save']();};}function saveUpdates(_0xe172b4,_0x5bcc7b){return function(_0x3883b9){if(_0x3883b9){return _0x3883b9[_0x3cfd('0x24')](_0xe172b4)[_0x3cfd('0x25')](function(_0x3c2676){return _0x3c2676;});}return null;};}function removeEntity(_0x44b5b1,_0x3aafc3){return function(_0x610514){if(_0x610514){return _0x610514['destroy']()[_0x3cfd('0x25')](function(){var _0x2c4bb0=_0x610514[_0x3cfd('0x26')]({'plain':!![]});var _0xa0b486=_0x3cfd('0x27');return db[_0x3cfd('0x28')][_0x3cfd('0x29')]({'where':{'type':_0xa0b486,'resourceId':_0x2c4bb0['id']}})['then'](function(){return _0x610514;});})[_0x3cfd('0x25')](function(){_0x44b5b1[_0x3cfd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353b59,_0x47f0fd){return function(_0x3cdaad){if(!_0x3cdaad){_0x353b59['sendStatus'](0x194);}return _0x3cdaad;};}function handleError(_0x19bd98,_0x117484){_0x117484=_0x117484||0x1f4;return function(_0x10a7d0){logger[_0x3cfd('0x2a')](_0x10a7d0[_0x3cfd('0x2b')]);if(_0x10a7d0[_0x3cfd('0x2c')]){delete _0x10a7d0['name'];}_0x19bd98[_0x3cfd('0x1a')](_0x117484)[_0x3cfd('0x2d')](_0x10a7d0);};}exports[_0x3cfd('0x2e')]=function(_0x16aea7,_0x575361){var _0x22f1db={},_0x49e67d={},_0x579675={'count':0x0,'rows':[]};return db[_0x3cfd('0x2f')][_0x3cfd('0x30')]()[_0x3cfd('0x25')](function(_0x51b608){_0x49e67d['model']=_[_0x3cfd('0x31')](_0x51b608);_0x49e67d['query']=_[_0x3cfd('0x31')](_0x16aea7[_0x3cfd('0x32')]);_0x49e67d[_0x3cfd('0x33')]=_[_0x3cfd('0x34')](_0x49e67d[_0x3cfd('0x35')],_0x49e67d['query']);_0x22f1db['attributes']=_[_0x3cfd('0x34')](_0x49e67d[_0x3cfd('0x35')],qs['fields'](_0x16aea7[_0x3cfd('0x32')][_0x3cfd('0x36')]));_0x22f1db[_0x3cfd('0x37')]=_0x22f1db['attributes'][_0x3cfd('0x38')]?_0x22f1db[_0x3cfd('0x37')]:_0x49e67d['model'];if(!_0x16aea7['query'][_0x3cfd('0x39')](_0x3cfd('0x3a'))){_0x22f1db[_0x3cfd('0x1f')]=qs[_0x3cfd('0x1f')](_0x16aea7[_0x3cfd('0x32')]['limit']);_0x22f1db[_0x3cfd('0x1d')]=qs[_0x3cfd('0x1d')](_0x16aea7[_0x3cfd('0x32')][_0x3cfd('0x1d')]);}_0x22f1db[_0x3cfd('0x3b')]=qs[_0x3cfd('0x3c')](_0x16aea7['query'][_0x3cfd('0x3c')]);_0x22f1db['where']=qs[_0x3cfd('0x33')](_[_0x3cfd('0x3d')](_0x16aea7[_0x3cfd('0x32')],_0x49e67d[_0x3cfd('0x33')]),_0x51b608);if(_0x16aea7[_0x3cfd('0x32')][_0x3cfd('0x3e')]){_0x22f1db[_0x3cfd('0x3f')]=_[_0x3cfd('0x40')](_0x22f1db[_0x3cfd('0x3f')],{'$or':_[_0x3cfd('0x41')](_0x22f1db[_0x3cfd('0x37')],function(_0x52b9a4){var _0x4802fb={};_0x4802fb[_0x52b9a4]={'$like':'%'+_0x16aea7[_0x3cfd('0x32')][_0x3cfd('0x3e')]+'%'};return _0x4802fb;})});}_0x22f1db=_[_0x3cfd('0x40')]({},_0x22f1db,_0x16aea7[_0x3cfd('0x42')]);var _0xd1cf7={'where':_0x22f1db[_0x3cfd('0x3f')]};return db[_0x3cfd('0x2f')][_0x3cfd('0x20')](_0xd1cf7)[_0x3cfd('0x25')](function(_0x3f8844){_0x579675[_0x3cfd('0x20')]=_0x3f8844;if(_0x16aea7[_0x3cfd('0x32')][_0x3cfd('0x43')]){_0x22f1db[_0x3cfd('0x44')]=[{'all':!![]}];}return db['CmCompany'][_0x3cfd('0x45')](_0x22f1db);})['then'](function(_0x16f364){_0x579675[_0x3cfd('0x46')]=_0x16f364;return _0x579675;})['then'](respondWithFilteredResult(_0x575361,_0x22f1db))[_0x3cfd('0x47')](handleError(_0x575361,null));})['catch'](handleError(_0x575361,null));};exports[_0x3cfd('0x48')]=function(_0x54079f,_0x29e5a6){var _0x5b810e={'raw':![],'where':{'id':_0x54079f['params']['id']}},_0xc0eb3e={};_0xc0eb3e[_0x3cfd('0x35')]=_[_0x3cfd('0x31')](db['CmCompany']['rawAttributes']);_0xc0eb3e[_0x3cfd('0x32')]=_[_0x3cfd('0x31')](_0x54079f[_0x3cfd('0x32')]);_0xc0eb3e[_0x3cfd('0x33')]=_['intersection'](_0xc0eb3e['model'],_0xc0eb3e[_0x3cfd('0x32')]);_0x5b810e[_0x3cfd('0x37')]=_[_0x3cfd('0x34')](_0xc0eb3e['model'],qs[_0x3cfd('0x36')](_0x54079f['query']['fields']));_0x5b810e[_0x3cfd('0x37')]=_0x5b810e[_0x3cfd('0x37')]['length']?_0x5b810e[_0x3cfd('0x37')]:_0xc0eb3e[_0x3cfd('0x35')];if(_0x54079f['query'][_0x3cfd('0x43')]){_0x5b810e[_0x3cfd('0x44')]=[{'all':!![]}];}_0x5b810e=_[_0x3cfd('0x40')]({},_0x5b810e,_0x54079f['options']);return db[_0x3cfd('0x2f')]['find'](_0x5b810e)['then'](handleEntityNotFound(_0x29e5a6,null))['then'](respondWithResult(_0x29e5a6,null))[_0x3cfd('0x47')](handleError(_0x29e5a6,null));};exports['create']=function(_0x4c5463,_0x20cf95){return db[_0x3cfd('0x2f')][_0x3cfd('0x49')](_0x4c5463[_0x3cfd('0x4a')],{})[_0x3cfd('0x25')](function(_0x108fef){var _0x5a324c=_0x4c5463[_0x3cfd('0x4b')][_0x3cfd('0x26')]({'plain':!![]});if(!_0x5a324c)throw new Error(_0x3cfd('0x4c'));if(_0x5a324c[_0x3cfd('0x4d')]==='user'){var _0x390409=_0x108fef[_0x3cfd('0x26')]({'plain':!![]});var _0x27e414=_0x3cfd('0x27');return db[_0x3cfd('0x4e')][_0x3cfd('0x4f')]({'where':{'name':_0x27e414,'userProfileId':_0x5a324c['userProfileId']},'raw':!![]})[_0x3cfd('0x25')](function(_0x4a9e2e){if(_0x4a9e2e&&_0x4a9e2e['autoAssociation']===0x0){return db[_0x3cfd('0x28')][_0x3cfd('0x49')]({'name':_0x390409[_0x3cfd('0x2c')],'resourceId':_0x390409['id'],'type':_0x4a9e2e[_0x3cfd('0x2c')],'sectionId':_0x4a9e2e['id']},{})[_0x3cfd('0x25')](function(){return _0x108fef;});}else{return _0x108fef;}})[_0x3cfd('0x47')](function(_0x27f379){logger[_0x3cfd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27f379);throw _0x27f379;});}return _0x108fef;})[_0x3cfd('0x25')](respondWithResult(_0x20cf95,0xc9))[_0x3cfd('0x47')](handleError(_0x20cf95,null));};exports[_0x3cfd('0x24')]=function(_0x198d31,_0x36febe){if(_0x198d31[_0x3cfd('0x4a')]['id']){delete _0x198d31[_0x3cfd('0x4a')]['id'];}return db[_0x3cfd('0x2f')][_0x3cfd('0x4f')]({'where':{'id':_0x198d31['params']['id']}})[_0x3cfd('0x25')](handleEntityNotFound(_0x36febe,null))[_0x3cfd('0x25')](saveUpdates(_0x198d31[_0x3cfd('0x4a')],null))[_0x3cfd('0x25')](respondWithResult(_0x36febe,null))[_0x3cfd('0x47')](handleError(_0x36febe,null));};exports[_0x3cfd('0x29')]=function(_0x370221,_0x1141d7){return db[_0x3cfd('0x2f')][_0x3cfd('0x4f')]({'where':{'id':_0x370221[_0x3cfd('0x50')]['id']}})[_0x3cfd('0x25')](handleEntityNotFound(_0x1141d7,null))['then'](removeEntity(_0x1141d7,null))[_0x3cfd('0x47')](handleError(_0x1141d7,null));};exports['describe']=function(_0x3853e7,_0x483f26){return db[_0x3cfd('0x2f')][_0x3cfd('0x30')]()[_0x3cfd('0x25')](respondWithResult(_0x483f26,null))[_0x3cfd('0x47')](handleError(_0x483f26,null));};exports['addContacts']=function(_0x1d317d,_0x5a364d,_0x1eac6e){return db[_0x3cfd('0x51')]['find']({'where':{'id':_0x1d317d[_0x3cfd('0x50')]['id']}})[_0x3cfd('0x25')](handleEntityNotFound(_0x5a364d,null))[_0x3cfd('0x25')](function(_0x5c3dbd){if(_0x5c3dbd){return _0x5c3dbd[_0x3cfd('0x52')](_0x1d317d[_0x3cfd('0x4a')]['ids'],_['omit'](_0x1d317d[_0x3cfd('0x4a')],['ids','id'])||{});}})[_0x3cfd('0x25')](respondWithResult(_0x5a364d,null))['catch'](handleError(_0x5a364d,null));};exports[_0x3cfd('0x53')]=function(_0x5127ba,_0x1519cc,_0x4e980b){var _0x69a72a={};var _0x53150b={};var _0x225bbd;var _0x2874ec;return db['CmCompany'][_0x3cfd('0x54')]({'where':{'id':_0x5127ba['params']['id']}})[_0x3cfd('0x25')](handleEntityNotFound(_0x1519cc,null))['then'](function(_0x1b62b2){if(_0x1b62b2){_0x225bbd=_0x1b62b2;_0x53150b[_0x3cfd('0x35')]=_[_0x3cfd('0x31')](db[_0x3cfd('0x51')]['rawAttributes']);_0x53150b[_0x3cfd('0x32')]=_[_0x3cfd('0x31')](_0x5127ba[_0x3cfd('0x32')]);_0x53150b[_0x3cfd('0x33')]=_[_0x3cfd('0x34')](_0x53150b[_0x3cfd('0x35')],_0x53150b[_0x3cfd('0x32')]);_0x69a72a[_0x3cfd('0x37')]=_[_0x3cfd('0x34')](_0x53150b[_0x3cfd('0x35')],qs[_0x3cfd('0x36')](_0x5127ba[_0x3cfd('0x32')][_0x3cfd('0x36')]));_0x69a72a['attributes']=_0x69a72a[_0x3cfd('0x37')][_0x3cfd('0x38')]?_0x69a72a[_0x3cfd('0x37')]:_0x53150b[_0x3cfd('0x35')];_0x69a72a[_0x3cfd('0x3b')]=qs[_0x3cfd('0x3c')](_0x5127ba['query']['sort']);_0x69a72a[_0x3cfd('0x3f')]=qs[_0x3cfd('0x33')](_[_0x3cfd('0x3d')](_0x5127ba['query'],_0x53150b[_0x3cfd('0x33')]));if(_0x5127ba[_0x3cfd('0x32')][_0x3cfd('0x3e')]){_0x69a72a['where']=_[_0x3cfd('0x40')](_0x69a72a[_0x3cfd('0x3f')],{'$or':_[_0x3cfd('0x41')](_0x69a72a[_0x3cfd('0x37')],function(_0x18cb29){var _0x195a8d={};_0x195a8d[_0x18cb29]={'$like':'%'+_0x5127ba[_0x3cfd('0x32')]['filter']+'%'};return _0x195a8d;})});}_0x69a72a=_[_0x3cfd('0x40')]({},_0x69a72a,_0x5127ba[_0x3cfd('0x42')]);return _0x225bbd[_0x3cfd('0x53')](_0x69a72a);}})[_0x3cfd('0x25')](function(_0x57661c){if(_0x57661c){_0x2874ec=_0x57661c[_0x3cfd('0x38')];if(!_0x5127ba[_0x3cfd('0x32')][_0x3cfd('0x39')](_0x3cfd('0x3a'))){_0x69a72a[_0x3cfd('0x1f')]=qs['limit'](_0x5127ba['query'][_0x3cfd('0x1f')]);_0x69a72a[_0x3cfd('0x1d')]=qs['offset'](_0x5127ba[_0x3cfd('0x32')][_0x3cfd('0x1d')]);}return _0x225bbd[_0x3cfd('0x53')](_0x69a72a);}})['then'](function(_0x590223){if(_0x590223){return _0x590223?{'count':_0x2874ec,'rows':_0x590223}:null;}})[_0x3cfd('0x25')](respondWithResult(_0x1519cc,null))['catch'](handleError(_0x1519cc,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6208480..783c29f 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 _0xecf5=['define','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xecf5,0x1b9));var _0x5ecf=function(_0x3e1139,_0x5106a2){_0x3e1139=_0x3e1139-0x0;var _0x26905d=_0xecf5[_0x3e1139];return _0x26905d;};'use strict';var _=require(_0x5ecf('0x0'));var util=require(_0x5ecf('0x1'));var logger=require(_0x5ecf('0x2'))('api');var moment=require(_0x5ecf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ecf('0x4'));var rimraf=require(_0x5ecf('0x5'));var config=require(_0x5ecf('0x6'));var attributes=require(_0x5ecf('0x7'));module[_0x5ecf('0x8')]=function(_0x5061fe,_0x5bea97){return _0x5061fe[_0x5ecf('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6046=['./cmCompany.attributes','CmCompany','cm_companies','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x2d864b,_0x30532d){var _0x3c10f4=function(_0x24a085){while(--_0x24a085){_0x2d864b['push'](_0x2d864b['shift']());}};_0x3c10f4(++_0x30532d);}(_0x6046,0x17d));var _0x6604=function(_0x19e035,_0x1b1986){_0x19e035=_0x19e035-0x0;var _0x13e159=_0x6046[_0x19e035];return _0x13e159;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6604('0x0'))(_0x6604('0x1'));var moment=require(_0x6604('0x2'));var BPromise=require(_0x6604('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6604('0x4'));var rimraf=require('rimraf');var config=require(_0x6604('0x5'));var attributes=require(_0x6604('0x6'));module['exports']=function(_0x357707,_0x768cea){return _0x357707['define'](_0x6604('0x7'),attributes,{'tableName':_0x6604('0x8'),'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 c123765..4c83174 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 _0x28e4=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b4b0c,_0x3061f3){var _0x5ceca8=function(_0x7b2639){while(--_0x7b2639){_0x2b4b0c['push'](_0x2b4b0c['shift']());}};_0x5ceca8(++_0x3061f3);}(_0x28e4,0x10d));var _0x428e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28e4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x428e('0x0'));var moment=require(_0x428e('0x1'));var BPromise=require(_0x428e('0x2'));var rs=require(_0x428e('0x3'));var fs=require('fs');var Redis=require(_0x428e('0x4'));var db=require(_0x428e('0x5'))['db'];var utils=require(_0x428e('0x6'));var logger=require(_0x428e('0x7'))(_0x428e('0x8'));var config=require(_0x428e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x428e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52978f,_0x3ddf52,_0x15153c){return new BPromise(function(_0x576f11,_0x3c3d5e){return client[_0x428e('0xb')](_0x52978f,_0x15153c)[_0x428e('0xc')](function(_0x14a2c4){logger[_0x428e('0xd')](_0x428e('0xe'),_0x3ddf52,_0x428e('0xf'));logger[_0x428e('0x10')](_0x428e('0x11'),_0x3ddf52,'request\x20sent',JSON[_0x428e('0x12')](_0x14a2c4));if(_0x14a2c4[_0x428e('0x13')]){if(_0x14a2c4[_0x428e('0x13')]['code']===0x1f4){logger[_0x428e('0x13')](_0x428e('0xe'),_0x3ddf52,_0x14a2c4['error']['message']);return _0x3c3d5e(_0x14a2c4[_0x428e('0x13')][_0x428e('0x14')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x3ddf52,_0x14a2c4[_0x428e('0x13')][_0x428e('0x14')]);return _0x576f11(_0x14a2c4[_0x428e('0x13')][_0x428e('0x14')]);}else{logger[_0x428e('0xd')](_0x428e('0xe'),_0x3ddf52,_0x428e('0xf'));_0x576f11(_0x14a2c4['result'][_0x428e('0x14')]);}})[_0x428e('0x15')](function(_0x528e26){logger[_0x428e('0x13')](_0x428e('0xe'),_0x3ddf52,_0x528e26);_0x3c3d5e(_0x528e26);});});} \ No newline at end of file +var _0x2d29=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3d9e47,_0x50dca9){var _0x435436=function(_0x17abb4){while(--_0x17abb4){_0x3d9e47['push'](_0x3d9e47['shift']());}};_0x435436(++_0x50dca9);}(_0x2d29,0x186));var _0x92d2=function(_0x1c8afd,_0x28037c){_0x1c8afd=_0x1c8afd-0x0;var _0x599c76=_0x2d29[_0x1c8afd];return _0x599c76;};'use strict';var _=require(_0x92d2('0x0'));var util=require(_0x92d2('0x1'));var moment=require(_0x92d2('0x2'));var BPromise=require(_0x92d2('0x3'));var rs=require(_0x92d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d2('0x5'))['db'];var utils=require(_0x92d2('0x6'));var logger=require('../../config/logger')(_0x92d2('0x7'));var config=require(_0x92d2('0x8'));var jayson=require(_0x92d2('0x9'));var client=jayson[_0x92d2('0xa')][_0x92d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492360,_0x16b97d,_0x140e9a){return new BPromise(function(_0x4f5df1,_0x35d7af){return client['request'](_0x492360,_0x140e9a)['then'](function(_0x260889){logger[_0x92d2('0xc')](_0x92d2('0xd'),_0x16b97d,_0x92d2('0xe'));logger[_0x92d2('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x16b97d,'request\x20sent',JSON[_0x92d2('0x10')](_0x260889));if(_0x260889['error']){if(_0x260889[_0x92d2('0x11')][_0x92d2('0x12')]===0x1f4){logger['error'](_0x92d2('0xd'),_0x16b97d,_0x260889['error'][_0x92d2('0x13')]);return _0x35d7af(_0x260889['error'][_0x92d2('0x13')]);}logger[_0x92d2('0x11')]('CmCompany,\x20%s,\x20%s',_0x16b97d,_0x260889[_0x92d2('0x11')][_0x92d2('0x13')]);return _0x4f5df1(_0x260889[_0x92d2('0x11')][_0x92d2('0x13')]);}else{logger[_0x92d2('0xc')](_0x92d2('0xd'),_0x16b97d,_0x92d2('0xe'));_0x4f5df1(_0x260889[_0x92d2('0x14')]['message']);}})[_0x92d2('0x15')](function(_0x2c81e2){logger['error'](_0x92d2('0xd'),_0x16b97d,_0x2c81e2);_0x35d7af(_0x2c81e2);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 937c9c2..62b2183 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 _0x74c6=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x74c6,0x1ae));var _0x674c=function(_0x1b6594,_0x4a2158){_0x1b6594=_0x1b6594-0x0;var _0x9db1f1=_0x74c6[_0x1b6594];return _0x9db1f1;};'use strict';var multer=require(_0x674c('0x0'));var util=require(_0x674c('0x1'));var path=require(_0x674c('0x2'));var timeout=require('connect-timeout');var express=require(_0x674c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x674c('0x4'));var interaction=require(_0x674c('0x5'));var config=require(_0x674c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x674c('0x7')](),controller[_0x674c('0x8')]);router[_0x674c('0x9')](_0x674c('0xa'),auth['isAuthenticated'](),controller[_0x674c('0xb')]);router[_0x674c('0x9')](_0x674c('0xc'),auth[_0x674c('0x7')](),controller[_0x674c('0xd')]);router[_0x674c('0x9')](_0x674c('0xe'),auth['isAuthenticated'](),controller[_0x674c('0xf')]);router[_0x674c('0x10')]('/',auth[_0x674c('0x7')](),controller[_0x674c('0x11')]);router['post'](_0x674c('0xe'),auth[_0x674c('0x7')](),controller[_0x674c('0x12')]);router['put'](_0x674c('0xc'),auth[_0x674c('0x7')](),controller[_0x674c('0x13')]);router[_0x674c('0x14')](_0x674c('0xc'),auth[_0x674c('0x7')](),controller[_0x674c('0x15')]);module[_0x674c('0x16')]=router; \ No newline at end of file +var _0x3051=['show','post','create','/:id/contacts','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe'];(function(_0x96c2f6,_0x5e66be){var _0x2fd9f6=function(_0x4a1e1f){while(--_0x4a1e1f){_0x96c2f6['push'](_0x96c2f6['shift']());}};_0x2fd9f6(++_0x5e66be);}(_0x3051,0x179));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var path=require(_0x1305('0x2'));var timeout=require(_0x1305('0x3'));var express=require(_0x1305('0x4'));var router=express[_0x1305('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1305('0x6'));var interaction=require(_0x1305('0x7'));var config=require(_0x1305('0x8'));var controller=require(_0x1305('0x9'));router[_0x1305('0xa')]('/',auth[_0x1305('0xb')](),controller[_0x1305('0xc')]);router[_0x1305('0xa')]('/describe',auth[_0x1305('0xb')](),controller[_0x1305('0xd')]);router[_0x1305('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1305('0xe')]);router[_0x1305('0xa')]('/:id/contacts',auth[_0x1305('0xb')](),controller['getContacts']);router[_0x1305('0xf')]('/',auth[_0x1305('0xb')](),controller[_0x1305('0x10')]);router[_0x1305('0xf')](_0x1305('0x11'),auth[_0x1305('0xb')](),controller['addContacts']);router['put']('/:id',auth[_0x1305('0xb')](),controller[_0x1305('0x12')]);router[_0x1305('0x13')](_0x1305('0x14'),auth[_0x1305('0xb')](),controller[_0x1305('0x15')]);module[_0x1305('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f1879b8..ce505b3 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 _0xe856=['sequelize','exports','STRING','TEXT','DATE','NOW','INTEGER'];(function(_0x3432ff,_0x3080ca){var _0x38c4ea=function(_0x242e64){while(--_0x242e64){_0x3432ff['push'](_0x3432ff['shift']());}};_0x38c4ea(++_0x3080ca);}(_0xe856,0x1ab));var _0x6e85=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe856[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var Sequelize=require(_0x6e85('0x0'));module[_0x6e85('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6e85('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6e85('0x2')]},'country':{'type':Sequelize[_0x6e85('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6e85('0x2')]},'description':{'type':Sequelize[_0x6e85('0x3')]},'phone':{'type':Sequelize[_0x6e85('0x2')]},'mobile':{'type':Sequelize[_0x6e85('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x6e85('0x2')]},'facebook':{'type':Sequelize[_0x6e85('0x2')]},'fb_data':{'type':Sequelize[_0x6e85('0x2')]},'twitter':{'type':Sequelize[_0x6e85('0x2')]},'skype':{'type':Sequelize[_0x6e85('0x2')]},'teams':{'type':Sequelize[_0x6e85('0x2')]},'viber':{'type':Sequelize[_0x6e85('0x2')]},'line':{'type':Sequelize[_0x6e85('0x2')]},'wechat':{'type':Sequelize[_0x6e85('0x2')]},'telegram':{'type':Sequelize[_0x6e85('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x6e85('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6e85('0x4')],'defaultValue':Sequelize[_0x6e85('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x6e85('0x6')]}}; \ No newline at end of file +var _0x4420=['TEXT','INTEGER','UNSIGNED','sequelize','exports','STRING'];(function(_0x18272f,_0x12cd11){var _0xc3c64b=function(_0x542a4a){while(--_0x542a4a){_0x18272f['push'](_0x18272f['shift']());}};_0xc3c64b(++_0x12cd11);}(_0x4420,0x141));var _0x0442=function(_0x164d60,_0x4ebaf5){_0x164d60=_0x164d60-0x0;var _0x293a58=_0x4420[_0x164d60];return _0x293a58;};'use strict';var _=require('lodash');var Sequelize=require(_0x0442('0x0'));module[_0x0442('0x1')]={'firstName':{'type':Sequelize[_0x0442('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0442('0x2')]},'street':{'type':Sequelize[_0x0442('0x2')]},'postalCode':{'type':Sequelize[_0x0442('0x2')]},'city':{'type':Sequelize[_0x0442('0x2')]},'country':{'type':Sequelize[_0x0442('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0442('0x2')]},'description':{'type':Sequelize[_0x0442('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0442('0x2')]},'fax':{'type':Sequelize[_0x0442('0x2')]},'email':{'type':Sequelize[_0x0442('0x2')]},'url':{'type':Sequelize[_0x0442('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x0442('0x2')]},'twitter':{'type':Sequelize[_0x0442('0x2')]},'skype':{'type':Sequelize[_0x0442('0x2')]},'teams':{'type':Sequelize[_0x0442('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x0442('0x2')]},'wechat':{'type':Sequelize[_0x0442('0x2')]},'telegram':{'type':Sequelize[_0x0442('0x2')]},'UserId':{'type':Sequelize[_0x0442('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x0442('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0442('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x0442('0x2')]},'utcOffset':{'type':Sequelize[_0x0442('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e7a1dbd..7a91538 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','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','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','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','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1b60ffd..452b7c8 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3a8=['update','remove','emit','hasOwnProperty','hook','exports','events','CmContact','setMaxListeners','save'];(function(_0x5187bb,_0x4c73c5){var _0x385a08=function(_0x13a142){while(--_0x13a142){_0x5187bb['push'](_0x5187bb['shift']());}};_0x385a08(++_0x4c73c5);}(_0xc3a8,0xf6));var _0x8c3a=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xc3a8[_0x28fbbf];return _0x543af6;};'use strict';var EventEmitter=require(_0x8c3a('0x0'));var CmContact=require('../../mysqldb')['db'][_0x8c3a('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8c3a('0x2')](0x0);var events={'afterCreate':_0x8c3a('0x3'),'afterUpdate':_0x8c3a('0x4'),'afterDestroy':_0x8c3a('0x5')};function emitEvent(_0x535cf7){return function(_0xab4150,_0x1630ba,_0x27801b){CmContactEvents[_0x8c3a('0x6')](_0x535cf7+':'+_0xab4150['id'],_0xab4150);CmContactEvents['emit'](_0x535cf7,_0xab4150);_0x27801b(null);};}for(var e in events){if(events[_0x8c3a('0x7')](e)){var event=events[e];CmContact[_0x8c3a('0x8')](e,emitEvent(event));}}module[_0x8c3a('0x9')]=CmContactEvents; \ No newline at end of file +var _0xc493=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x186222,_0x3bdfb0){var _0x226a38=function(_0x3b071f){while(--_0x3b071f){_0x186222['push'](_0x186222['shift']());}};_0x226a38(++_0x3bdfb0);}(_0xc493,0x15f));var _0x3c49=function(_0xe86b03,_0x4f1d99){_0xe86b03=_0xe86b03-0x0;var _0x2711d6=_0xc493[_0xe86b03];return _0x2711d6;};'use strict';var EventEmitter=require(_0x3c49('0x0'));var CmContact=require(_0x3c49('0x1'))['db'][_0x3c49('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3c49('0x3')](0x0);var events={'afterCreate':_0x3c49('0x4'),'afterUpdate':_0x3c49('0x5'),'afterDestroy':_0x3c49('0x6')};function emitEvent(_0x2b2e20){return function(_0x27ba5d,_0x4f9e6f,_0x3aba76){CmContactEvents[_0x3c49('0x7')](_0x2b2e20+':'+_0x27ba5d['id'],_0x27ba5d);CmContactEvents[_0x3c49('0x7')](_0x2b2e20,_0x27ba5d);_0x3aba76(null);};}for(var e in events){if(events[_0x3c49('0x8')](e)){var event=events[e];CmContact[_0x3c49('0x9')](e,emitEvent(event));}}module[_0x3c49('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index bc4af68..3052564 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff33=['always','onlyIfOpen','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','Lists','length','dialCheckDuplicateType'];(function(_0x59e956,_0xdabc4c){var _0x4b1f9b=function(_0x1a3e86){while(--_0x1a3e86){_0x59e956['push'](_0x59e956['shift']());}};_0x4b1f9b(++_0xdabc4c);}(_0xff33,0xa7));var _0x3ff3=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0xff33[_0x20bc10];return _0x3bd5ce;};'use strict';var _=require(_0x3ff3('0x0'));var util=require(_0x3ff3('0x1'));var logger=require('../../config/logger')(_0x3ff3('0x2'));var moment=require(_0x3ff3('0x3'));var BPromise=require(_0x3ff3('0x4'));var rp=require(_0x3ff3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ff3('0x6'));var config=require(_0x3ff3('0x7'));var shared=require(_0x3ff3('0x8'));var attributes=require(_0x3ff3('0x9'));module[_0x3ff3('0xa')]=function(_0x1296b9,_0x56a770){return _0x1296b9['define'](_0x3ff3('0xb'),attributes,{'tableName':_0x3ff3('0xc'),'paranoid':!![],'indexes':[{'name':_0x3ff3('0xd'),'fields':[_0x3ff3('0xd')]},{'name':_0x3ff3('0xe'),'fields':[_0x3ff3('0xf'),_0x3ff3('0x10'),'phone',_0x3ff3('0x11'),_0x3ff3('0x12'),_0x3ff3('0x13')],'type':_0x3ff3('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3ff3('0x15'),'hooks':{'afterCreate':function(_0x3f5fb6,_0x5a780a,_0x224c1b){var _0x58f1c7=_0x1296b9[_0x3ff3('0x16')];var _0x215a7f=_0x3f5fb6[_0x3ff3('0x17')]({'plain':!![]});function _0x4a883c(){return function(_0x19d7e3){logger[_0x3ff3('0x18')](_0x3ff3('0x19'),_0x3ff3('0x1a'),util[_0x3ff3('0x1b')](_0x19d7e3,{'showHidden':![],'depth':null}));};}function _0x5a95a7(_0x21f3cd,_0x30913d){var _0x396e40=_0x30913d['scheduledat']?_0x30913d[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e'));return new BPromise(function(_0x55588c,_0x398f09){if(_[_0x3ff3('0x1f')](_0x30913d[_0x3ff3('0x20')])){_0x55588c({'ret':_0x396e40});}else{_0x58f1c7[_0x3ff3('0x21')][_0x3ff3('0x22')]({'where':{'id':_0x21f3cd['id']}})[_0x3ff3('0x23')](function(_0x1e4fb8){if(!_[_0x3ff3('0x1f')](_0x1e4fb8)){var _0x109fc9=_0x1e4fb8[_0x3ff3('0x20')];if(!_['isNil'](_0x109fc9)){var _0x527fd7=shared['timezones'];var _0x586781=_0x527fd7[_0x109fc9];var _0x1cebc0=_0x527fd7[_0x30913d['dialTimezone']];if(!_['isNil'](_0x586781)&&!_['isNil'](_0x1cebc0)){var _0x98cdfa=_0x586781[_0x3ff3('0x24')]-_0x1cebc0[_0x3ff3('0x24')];_0x396e40=_0x30913d[_0x3ff3('0x1c')]?_0x30913d['scheduledat']:moment();var _0x44dd28=moment(_0x396e40)[_0x3ff3('0x25')](_0x98cdfa,_0x3ff3('0x26'));_0x55588c({'ret':_0x44dd28[_0x3ff3('0x1d')](_0x3ff3('0x1e'))});}else _0x55588c({'ret':_0x396e40});}else _0x55588c({'ret':_0x396e40});}else{_0x55588c({'ret':_0x396e40});}});}});return 0xa;}var _0x256498=function(_0x4bb83a){return new BPromise(function(_0x128d59,_0x69431){_0x5a95a7(_0x4bb83a,_0x215a7f)[_0x3ff3('0x23')](function(_0x24345d){_0x215a7f[_0x3ff3('0x1c')]=_0x24345d[_0x3ff3('0x27')];_0x58f1c7[_0x3ff3('0x28')]['findOne']({'where':{'phone':_0x215a7f[_0x3ff3('0xd')],'VoiceQueueId':_0x4bb83a['id']}})[_0x3ff3('0x23')](function(_0x573b5a){if(!_[_0x3ff3('0x1f')](_0x573b5a)){throw new Error(_0x3ff3('0x29')+_0x215a7f['phone']+_0x3ff3('0x2a')+_0x4bb83a['id']);}return _0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'priority':_0x215a7f[_0x3ff3('0x2d')]?_0x215a7f[_0x3ff3('0x2d')]:0x2,'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')),'callback':_0x215a7f[_0x3ff3('0x2e')]?!![]:![],'callbackuniqueid':_0x215a7f['callbackUniqueid']?_0x215a7f[_0x3ff3('0x2e')]:undefined,'callbackat':_0x215a7f[_0x3ff3('0x2e')]?moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')):undefined,'VoiceQueueId':_0x4bb83a['id']});})[_0x3ff3('0x2f')](function(_0x4ee5c2){_0x69431(_0x4ee5c2);});});});};var _0x3a7e80=function(_0x239909){return new BPromise(function(_0x5c4f37,_0x5e11c5){_0x5a95a7(_0x239909,_0x215a7f)[_0x3ff3('0x23')](function(_0x44c68d){_0x215a7f[_0x3ff3('0x1c')]=_0x44c68d[_0x3ff3('0x27')];_0x58f1c7[_0x3ff3('0x28')]['findOne']({'where':{'phone':_0x215a7f[_0x3ff3('0xd')],'VoiceQueueId':_0x239909['id']}})['then'](function(_0x34818c){if(!_[_0x3ff3('0x1f')](_0x34818c)){throw new Error(_0x3ff3('0x29')+_0x215a7f[_0x3ff3('0xd')]+_0x3ff3('0x30')+_0x239909['id']);}return _0x58f1c7[_0x3ff3('0x31')][_0x3ff3('0x22')]({'where':{'calleridnum':_0x215a7f[_0x3ff3('0xd')],'VoiceQueueId':_0x239909['id']}});})[_0x3ff3('0x23')](function(_0x5aab78){if(!_[_0x3ff3('0x1f')](_0x5aab78)){throw new Error(_0x3ff3('0x32')+_0x215a7f[_0x3ff3('0xd')]+_0x3ff3('0x33')+_0x239909['id']);}return _0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'priority':_0x215a7f[_0x3ff3('0x2d')]?_0x215a7f['priority']:0x2,'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')),'callback':_0x215a7f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x215a7f[_0x3ff3('0x2e')]?_0x215a7f[_0x3ff3('0x2e')]:undefined,'callbackat':_0x215a7f[_0x3ff3('0x2e')]?moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')):undefined,'VoiceQueueId':_0x239909['id']});})[_0x3ff3('0x2f')](function(_0x3aae1f){_0x5e11c5(_0x3aae1f);});});});};function _0x321e2c(){return function(_0x1da86e){logger[_0x3ff3('0x18')](_0x3ff3('0x19'),_0x3ff3('0x1a'),util[_0x3ff3('0x1b')](_0x1da86e,{'showHidden':![],'depth':null}));};}function _0xd65b06(_0x7fa92c,_0x29b600){var _0x3d031b=_0x29b600['scheduledat']?_0x29b600['scheduledat']:moment()['format'](_0x3ff3('0x1e'));return new BPromise(function(_0x94a9c5,_0x417ef9){if(_[_0x3ff3('0x1f')](_0x29b600[_0x3ff3('0x20')])){_0x94a9c5({'ret':_0x3d031b});}else{_0x58f1c7[_0x3ff3('0x34')]['findOne']({'where':{'id':_0x7fa92c['id']}})[_0x3ff3('0x23')](function(_0x78fdd3){if(!_[_0x3ff3('0x1f')](_0x78fdd3)){var _0x42b65c=_0x78fdd3['dialTimezone'];if(!_[_0x3ff3('0x1f')](_0x42b65c)){var _0x531020=shared[_0x3ff3('0x35')];var _0x364ddd=_0x531020[_0x42b65c];var _0x5ea885=_0x531020[_0x29b600[_0x3ff3('0x20')]];if(!_['isNil'](_0x364ddd)&&!_['isNil'](_0x5ea885)){var _0x30f6f7=_0x364ddd[_0x3ff3('0x24')]-_0x5ea885['utcOffset'];_0x3d031b=_0x29b600[_0x3ff3('0x1c')]?_0x29b600[_0x3ff3('0x1c')]:moment();var _0x31e648=moment(_0x3d031b)[_0x3ff3('0x25')](_0x30f6f7,_0x3ff3('0x26'));_0x94a9c5({'ret':_0x31e648[_0x3ff3('0x1d')](_0x3ff3('0x1e'))});}else _0x94a9c5({'ret':_0x3d031b});}else _0x94a9c5({'ret':_0x3d031b});}else{_0x94a9c5({'ret':_0x3d031b});}});}});return 0xa;}var _0x3eecf2=function(_0x30c6d7){return new BPromise(function(_0x2ea6ff,_0x55f019){_0xd65b06(_0x30c6d7,_0x215a7f)[_0x3ff3('0x23')](function(_0x384503){_0x215a7f[_0x3ff3('0x1c')]=_0x384503[_0x3ff3('0x27')];_0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x22')]({'where':{'phone':_0x215a7f[_0x3ff3('0xd')],'CampaignId':_0x30c6d7['id']}})[_0x3ff3('0x23')](function(_0x3abd6d){if(!_['isNil'](_0x3abd6d)){throw new Error(_0x3ff3('0x29')+_0x215a7f['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x30c6d7['id']);}return _0x58f1c7['CmHopper'][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'priority':_0x215a7f[_0x3ff3('0x2d')]?_0x215a7f[_0x3ff3('0x2d')]:0x2,'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')),'callback':_0x215a7f[_0x3ff3('0x2e')]?!![]:![],'callbackuniqueid':_0x215a7f[_0x3ff3('0x2e')]?_0x215a7f['callbackUniqueid']:undefined,'callbackat':_0x215a7f[_0x3ff3('0x2e')]?moment()['format'](_0x3ff3('0x1e')):undefined,'CampaignId':_0x30c6d7['id']});})[_0x3ff3('0x2f')](function(_0x502b66){_0x55f019(_0x502b66);});});});};var _0x50b560=function(_0x3bb096){return new BPromise(function(_0x2fd170,_0xe73f9b){_0xd65b06(_0x3bb096,_0x215a7f)[_0x3ff3('0x23')](function(_0x414eb8){_0x215a7f[_0x3ff3('0x1c')]=_0x414eb8[_0x3ff3('0x27')];_0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x22')]({'where':{'phone':_0x215a7f[_0x3ff3('0xd')],'CampaignId':_0x3bb096['id']}})[_0x3ff3('0x23')](function(_0x204767){if(!_[_0x3ff3('0x1f')](_0x204767)){throw new Error(_0x3ff3('0x29')+_0x215a7f[_0x3ff3('0xd')]+_0x3ff3('0x36')+_0x3bb096['id']);}return _0x58f1c7['CmHopperFinal'][_0x3ff3('0x22')]({'where':{'calleridnum':_0x215a7f['phone'],'CampaignId':_0x3bb096['id']}});})[_0x3ff3('0x23')](function(_0x48c24b){if(!_[_0x3ff3('0x1f')](_0x48c24b)){throw new Error(_0x3ff3('0x32')+_0x215a7f[_0x3ff3('0xd')]+_0x3ff3('0x37')+_0x3bb096['id']);}return _0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f['ListId'],'priority':_0x215a7f[_0x3ff3('0x2d')]?_0x215a7f[_0x3ff3('0x2d')]:0x2,'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')),'callback':_0x215a7f[_0x3ff3('0x2e')]?!![]:![],'callbackuniqueid':_0x215a7f[_0x3ff3('0x2e')]?_0x215a7f[_0x3ff3('0x2e')]:undefined,'callbackat':_0x215a7f[_0x3ff3('0x2e')]?moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')):undefined,'CampaignId':_0x3bb096['id']});})[_0x3ff3('0x2f')](function(_0x1b9521){_0xe73f9b(_0x1b9521);});});});};if(_0x215a7f[_0x3ff3('0x2c')]){_0x58f1c7[_0x3ff3('0x21')][_0x3ff3('0x38')]({'where':{'type':_0x3ff3('0x39')},'attributes':['id','dialCheckDuplicateType',_0x3ff3('0x20')],'include':[{'model':_0x58f1c7['CmList'],'as':_0x3ff3('0x3a'),'where':{'id':_0x215a7f['ListId']}}]})[_0x3ff3('0x23')](function(_0x3d6096){if(_0x3d6096){var _0x4914e7=[];for(var _0x898b9e=0x0,_0x59ce4f;_0x898b9e<_0x3d6096[_0x3ff3('0x3b')];_0x898b9e+=0x1){_0x59ce4f=_0x3d6096[_0x898b9e][_0x3ff3('0x17')]({'plain':!![]});switch(_0x59ce4f[_0x3ff3('0x3c')]){case _0x3ff3('0x3d'):_0x3a7e80(_0x59ce4f)[_0x3ff3('0x2f')](_0x4a883c());break;case _0x3ff3('0x3e'):_0x256498(_0x59ce4f)[_0x3ff3('0x2f')](_0x4a883c());break;default:_0xd65b06(_0x59ce4f,_0x215a7f)[_0x3ff3('0x23')](function(_0xb656a2){_0x215a7f[_0x3ff3('0x1c')]=_0xb656a2[_0x3ff3('0x27')];_0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f['scheduledat']:moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')),'priority':_0x215a7f[_0x3ff3('0x2d')]?_0x215a7f['priority']:0x2,'callback':_0x215a7f[_0x3ff3('0x2e')]?!![]:![],'callbackuniqueid':_0x215a7f['callbackUniqueid']?_0x215a7f[_0x3ff3('0x2e')]:undefined,'callbackat':_0x215a7f[_0x3ff3('0x2e')]?moment()[_0x3ff3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x59ce4f['id']})[_0x3ff3('0x2f')](_0x4a883c());});}}}})[_0x3ff3('0x23')](function(){return _0x58f1c7[_0x3ff3('0x21')]['findAll']({'where':{'type':_0x3ff3('0x39')},'attributes':['id'],'include':[{'model':_0x58f1c7[_0x3ff3('0x3f')],'as':_0x3ff3('0x40'),'where':{'id':_0x215a7f[_0x3ff3('0x2c')]}}]})[_0x3ff3('0x23')](function(_0x2c8c0c){if(_0x2c8c0c){var _0x42b752=[];for(var _0x15c924=0x0,_0x52ea1f;_0x15c924<_0x2c8c0c[_0x3ff3('0x3b')];_0x15c924+=0x1){_0x52ea1f=_0x2c8c0c[_0x15c924][_0x3ff3('0x17')]({'plain':!![]});_0x58f1c7[_0x3ff3('0x41')]['create']({'phone':_0x215a7f['phone'],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'VoiceQueueId':_0x52ea1f['id']})[_0x3ff3('0x2f')](function(_0x7cf8e){logger['error'](_0x3ff3('0x42'),_0x3ff3('0x1a'),_0x7cf8e[_0x3ff3('0x43')]);});}}});})[_0x3ff3('0x23')](function(){return _0x58f1c7[_0x3ff3('0x34')][_0x3ff3('0x38')]({'attributes':['id','dialCheckDuplicateType',_0x3ff3('0x20')],'include':[{'model':_0x58f1c7[_0x3ff3('0x3f')],'as':_0x3ff3('0x3a'),'where':{'id':_0x215a7f[_0x3ff3('0x2c')]}}]})[_0x3ff3('0x23')](function(_0x59171b){if(_0x59171b){var _0x458f5a=[];for(var _0x4ff4ea=0x0,_0x925f6;_0x4ff4ea<_0x59171b['length'];_0x4ff4ea+=0x1){_0x925f6=_0x59171b[_0x4ff4ea][_0x3ff3('0x17')]({'plain':!![]});switch(_0x925f6[_0x3ff3('0x3c')]){case _0x3ff3('0x3d'):_0x50b560(_0x925f6)['catch'](_0x321e2c());break;case _0x3ff3('0x3e'):_0x3eecf2(_0x925f6)[_0x3ff3('0x2f')](_0x321e2c());break;default:_0x58f1c7[_0x3ff3('0x28')][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'scheduledat':_0x215a7f[_0x3ff3('0x1c')]?_0x215a7f[_0x3ff3('0x1c')]:moment()[_0x3ff3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x215a7f['priority']?_0x215a7f[_0x3ff3('0x2d')]:0x2,'callback':_0x215a7f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x215a7f[_0x3ff3('0x2e')]?_0x215a7f[_0x3ff3('0x2e')]:undefined,'callbackat':_0x215a7f['callbackUniqueid']?moment()[_0x3ff3('0x1d')](_0x3ff3('0x1e')):undefined,'CampaignId':_0x925f6['id']})[_0x3ff3('0x2f')](_0x321e2c());}}}});})[_0x3ff3('0x23')](function(){return _0x58f1c7[_0x3ff3('0x34')][_0x3ff3('0x38')]({'attributes':['id'],'include':[{'model':_0x58f1c7[_0x3ff3('0x3f')],'as':_0x3ff3('0x40'),'where':{'id':_0x215a7f['ListId']}}]})['then'](function(_0xf0e9cd){if(_0xf0e9cd){var _0x314afb=[];for(var _0x360302=0x0,_0x222f2f;_0x360302<_0xf0e9cd[_0x3ff3('0x3b')];_0x360302+=0x1){_0x222f2f=_0xf0e9cd[_0x360302][_0x3ff3('0x17')]({'plain':!![]});_0x58f1c7['CmHopperBlack'][_0x3ff3('0x2b')]({'phone':_0x215a7f[_0x3ff3('0xd')],'ContactId':_0x215a7f['id'],'ListId':_0x215a7f[_0x3ff3('0x2c')],'CampaignId':_0x222f2f['id']})[_0x3ff3('0x2f')](function(_0x5e3d74){logger[_0x3ff3('0x18')]('cmContact,\x20%s,\x20%s',_0x3ff3('0x1a'),_0x5e3d74[_0x3ff3('0x43')]);});}}});})[_0x3ff3('0x23')](function(){_0x224c1b();})[_0x3ff3('0x2f')](function(_0x3d4702){logger['error']('cmContact,\x20%s,\x20%s',_0x3ff3('0x1a'),_0x3d4702['message']);_0x224c1b(_0x3d4702);});}else{_0x224c1b(new Error(_0x3ff3('0x44')));}},'afterDestroy':function(_0x378b1a,_0x1eb0e2,_0x490a9e){var _0x333a27=_0x1296b9[_0x3ff3('0x16')];var _0x3b5e64=_0x378b1a['get']({'plain':!![]});return _0x333a27['CmHopper'][_0x3ff3('0x38')]({'raw':!![],'where':{'ListId':_0x3b5e64[_0x3ff3('0x2c')],'ContactId':_0x3b5e64['id']}})[_0x3ff3('0x23')](function(_0x59503c){if(!_[_0x3ff3('0x45')](_0x59503c)){var _0x41f225=[];for(var _0x30d170=0x0;_0x30d170<_0x59503c[_0x3ff3('0x3b')];_0x30d170+=0x1){var _0x27921c=_0x333a27[_0x3ff3('0x28')]['destroy']({'where':{'ListId':_0x59503c[_0x30d170]['ListId'],'ContactId':_0x59503c[_0x30d170][_0x3ff3('0x46')],'VoiceQueueId':_0x59503c[_0x30d170][_0x3ff3('0x47')],'CampaignId':_0x59503c[_0x30d170][_0x3ff3('0x48')]}});_0x41f225[_0x3ff3('0x49')](_0x27921c);}return BPromise['all'](_0x41f225);}})[_0x3ff3('0x23')](function(_0x59e8c7){logger['info'](_0x3ff3('0x4a'),util[_0x3ff3('0x1b')](_0x59e8c7,{'showHidden':![],'depth':null}));_0x490a9e();})[_0x3ff3('0x2f')](function(_0x4b95c7){logger[_0x3ff3('0x18')](_0x3ff3('0x4b'),util[_0x3ff3('0x1b')](_0x4b95c7,{'showHidden':![],'depth':null}));_0x490a9e(_0x4b95c7);});}}});}; \ No newline at end of file +var _0x810e=['format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','callbackUniqueid','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','priority','catch','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','CmList','Lists','length','get','dialCheckDuplicateType','always','onlyIfOpen','cmContact,\x20%s,\x20%s','message','BlackLists','CmHopperBlack','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','cmContact','afterCreate','inspect','scheduledat'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x810e,0x7d));var _0xe810=function(_0x3b7cc2,_0x41ac85){_0x3b7cc2=_0x3b7cc2-0x0;var _0x3b1f4=_0x810e[_0x3b7cc2];return _0x3b1f4;};'use strict';var _=require(_0xe810('0x0'));var util=require(_0xe810('0x1'));var logger=require(_0xe810('0x2'))(_0xe810('0x3'));var moment=require(_0xe810('0x4'));var BPromise=require('bluebird');var rp=require(_0xe810('0x5'));var fs=require('fs');var path=require(_0xe810('0x6'));var rimraf=require('rimraf');var config=require(_0xe810('0x7'));var shared=require(_0xe810('0x8'));var attributes=require(_0xe810('0x9'));module[_0xe810('0xa')]=function(_0x527f30,_0x45c624){return _0x527f30['define']('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xe810('0xb'),'fields':['phone']},{'name':_0xe810('0xc'),'fields':[_0xe810('0xd'),_0xe810('0xe'),'phone',_0xe810('0xf'),'fax',_0xe810('0x10')],'type':_0xe810('0x11')}],'timestamps':!![],'charset':_0xe810('0x12'),'collate':_0xe810('0x13'),'hooks':{'afterCreate':function(_0x377623,_0x111202,_0x322f09){var _0x1f954a=_0x527f30[_0xe810('0x14')];var _0x46ddfa=_0x377623['get']({'plain':!![]});function _0x69c0b5(){return function(_0x5f3e66){logger['error'](_0xe810('0x15'),_0xe810('0x16'),util[_0xe810('0x17')](_0x5f3e66,{'showHidden':![],'depth':null}));};}function _0x2eb918(_0x480565,_0x144e99){var _0x5bc7e3=_0x144e99[_0xe810('0x18')]?_0x144e99[_0xe810('0x18')]:moment()[_0xe810('0x19')](_0xe810('0x1a'));return new BPromise(function(_0x50fc30,_0x1b76dc){if(_[_0xe810('0x1b')](_0x144e99[_0xe810('0x1c')])){_0x50fc30({'ret':_0x5bc7e3});}else{_0x1f954a[_0xe810('0x1d')][_0xe810('0x1e')]({'where':{'id':_0x480565['id']}})[_0xe810('0x1f')](function(_0x4d3b24){if(!_['isNil'](_0x4d3b24)){var _0x261640=_0x4d3b24[_0xe810('0x1c')];if(!_[_0xe810('0x1b')](_0x261640)){var _0x5501fa=shared[_0xe810('0x20')];var _0x3318d0=_0x5501fa[_0x261640];var _0xce05bc=_0x5501fa[_0x144e99[_0xe810('0x1c')]];if(!_[_0xe810('0x1b')](_0x3318d0)&&!_[_0xe810('0x1b')](_0xce05bc)){var _0x3c00c6=_0x3318d0['utcOffset']-_0xce05bc[_0xe810('0x21')];_0x5bc7e3=_0x144e99[_0xe810('0x18')]?_0x144e99['scheduledat']:moment();var _0x2ade87=moment(_0x5bc7e3)[_0xe810('0x22')](_0x3c00c6,_0xe810('0x23'));_0x50fc30({'ret':_0x2ade87[_0xe810('0x19')](_0xe810('0x1a'))});}else _0x50fc30({'ret':_0x5bc7e3});}else _0x50fc30({'ret':_0x5bc7e3});}else{_0x50fc30({'ret':_0x5bc7e3});}});}});return 0xa;}var _0x4c1168=function(_0x3e7949){return new BPromise(function(_0x1da5e7,_0x17d91c){_0x2eb918(_0x3e7949,_0x46ddfa)[_0xe810('0x1f')](function(_0x2bbb32){_0x46ddfa['scheduledat']=_0x2bbb32[_0xe810('0x24')];_0x1f954a[_0xe810('0x25')][_0xe810('0x1e')]({'where':{'phone':_0x46ddfa['phone'],'VoiceQueueId':_0x3e7949['id']}})[_0xe810('0x1f')](function(_0x4aeffb){if(!_['isNil'](_0x4aeffb)){throw new Error('cmContact,\x20afterCreate\x20'+_0x46ddfa[_0xe810('0xb')]+_0xe810('0x26')+_0x3e7949['id']);}return _0x1f954a[_0xe810('0x25')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa[_0xe810('0x28')],'priority':_0x46ddfa['priority']?_0x46ddfa['priority']:0x2,'scheduledat':_0x46ddfa[_0xe810('0x18')]?_0x46ddfa['scheduledat']:moment()[_0xe810('0x19')](_0xe810('0x1a')),'callback':_0x46ddfa[_0xe810('0x29')]?!![]:![],'callbackuniqueid':_0x46ddfa['callbackUniqueid']?_0x46ddfa[_0xe810('0x29')]:undefined,'callbackat':_0x46ddfa[_0xe810('0x29')]?moment()['format'](_0xe810('0x1a')):undefined,'VoiceQueueId':_0x3e7949['id']});})['catch'](function(_0x39f69d){_0x17d91c(_0x39f69d);});});});};var _0x1327ce=function(_0x502a41){return new BPromise(function(_0x79696,_0x347349){_0x2eb918(_0x502a41,_0x46ddfa)[_0xe810('0x1f')](function(_0xccfc86){_0x46ddfa[_0xe810('0x18')]=_0xccfc86[_0xe810('0x24')];_0x1f954a[_0xe810('0x25')][_0xe810('0x1e')]({'where':{'phone':_0x46ddfa[_0xe810('0xb')],'VoiceQueueId':_0x502a41['id']}})[_0xe810('0x1f')](function(_0x4d7547){if(!_[_0xe810('0x1b')](_0x4d7547)){throw new Error(_0xe810('0x2a')+_0x46ddfa[_0xe810('0xb')]+_0xe810('0x2b')+_0x502a41['id']);}return _0x1f954a['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x46ddfa[_0xe810('0xb')],'VoiceQueueId':_0x502a41['id']}});})[_0xe810('0x1f')](function(_0x318bf3){if(!_[_0xe810('0x1b')](_0x318bf3)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x46ddfa[_0xe810('0xb')]+_0xe810('0x2c')+_0x502a41['id']);}return _0x1f954a[_0xe810('0x25')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa[_0xe810('0x28')],'priority':_0x46ddfa[_0xe810('0x2d')]?_0x46ddfa['priority']:0x2,'scheduledat':_0x46ddfa[_0xe810('0x18')]?_0x46ddfa['scheduledat']:moment()[_0xe810('0x19')](_0xe810('0x1a')),'callback':_0x46ddfa['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46ddfa[_0xe810('0x29')]?_0x46ddfa[_0xe810('0x29')]:undefined,'callbackat':_0x46ddfa[_0xe810('0x29')]?moment()[_0xe810('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x502a41['id']});})[_0xe810('0x2e')](function(_0x1027f9){_0x347349(_0x1027f9);});});});};function _0x4fe80a(){return function(_0x866d0a){logger[_0xe810('0x2f')](_0xe810('0x15'),'afterCreate',util[_0xe810('0x17')](_0x866d0a,{'showHidden':![],'depth':null}));};}function _0x118b29(_0x33b456,_0x343766){var _0x15f278=_0x343766[_0xe810('0x18')]?_0x343766[_0xe810('0x18')]:moment()['format'](_0xe810('0x1a'));return new BPromise(function(_0x110ea6,_0x592497){if(_['isNil'](_0x343766[_0xe810('0x1c')])){_0x110ea6({'ret':_0x15f278});}else{_0x1f954a[_0xe810('0x30')][_0xe810('0x1e')]({'where':{'id':_0x33b456['id']}})[_0xe810('0x1f')](function(_0x7540bd){if(!_[_0xe810('0x1b')](_0x7540bd)){var _0x48a383=_0x7540bd[_0xe810('0x1c')];if(!_[_0xe810('0x1b')](_0x48a383)){var _0x24bb82=shared[_0xe810('0x20')];var _0xdcd560=_0x24bb82[_0x48a383];var _0x46f95b=_0x24bb82[_0x343766[_0xe810('0x1c')]];if(!_['isNil'](_0xdcd560)&&!_[_0xe810('0x1b')](_0x46f95b)){var _0x4ac418=_0xdcd560['utcOffset']-_0x46f95b[_0xe810('0x21')];_0x15f278=_0x343766[_0xe810('0x18')]?_0x343766[_0xe810('0x18')]:moment();var _0x4142fd=moment(_0x15f278)[_0xe810('0x22')](_0x4ac418,'minutes');_0x110ea6({'ret':_0x4142fd[_0xe810('0x19')](_0xe810('0x1a'))});}else _0x110ea6({'ret':_0x15f278});}else _0x110ea6({'ret':_0x15f278});}else{_0x110ea6({'ret':_0x15f278});}});}});return 0xa;}var _0x310a9b=function(_0x72ead){return new BPromise(function(_0x219287,_0x5aa948){_0x118b29(_0x72ead,_0x46ddfa)['then'](function(_0x54b393){_0x46ddfa[_0xe810('0x18')]=_0x54b393[_0xe810('0x24')];_0x1f954a['CmHopper'][_0xe810('0x1e')]({'where':{'phone':_0x46ddfa[_0xe810('0xb')],'CampaignId':_0x72ead['id']}})[_0xe810('0x1f')](function(_0x4a31c8){if(!_['isNil'](_0x4a31c8)){throw new Error(_0xe810('0x2a')+_0x46ddfa['phone']+_0xe810('0x31')+_0x72ead['id']);}return _0x1f954a[_0xe810('0x25')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa['ListId'],'priority':_0x46ddfa[_0xe810('0x2d')]?_0x46ddfa['priority']:0x2,'scheduledat':_0x46ddfa['scheduledat']?_0x46ddfa[_0xe810('0x18')]:moment()[_0xe810('0x19')](_0xe810('0x1a')),'callback':_0x46ddfa[_0xe810('0x29')]?!![]:![],'callbackuniqueid':_0x46ddfa[_0xe810('0x29')]?_0x46ddfa[_0xe810('0x29')]:undefined,'callbackat':_0x46ddfa[_0xe810('0x29')]?moment()[_0xe810('0x19')](_0xe810('0x1a')):undefined,'CampaignId':_0x72ead['id']});})[_0xe810('0x2e')](function(_0x11bef5){_0x5aa948(_0x11bef5);});});});};var _0x2fceca=function(_0x2b053d){return new BPromise(function(_0x38a011,_0x5b4ae8){_0x118b29(_0x2b053d,_0x46ddfa)[_0xe810('0x1f')](function(_0x239e55){_0x46ddfa[_0xe810('0x18')]=_0x239e55['ret'];_0x1f954a['CmHopper'][_0xe810('0x1e')]({'where':{'phone':_0x46ddfa['phone'],'CampaignId':_0x2b053d['id']}})['then'](function(_0xb48770){if(!_[_0xe810('0x1b')](_0xb48770)){throw new Error(_0xe810('0x2a')+_0x46ddfa['phone']+_0xe810('0x32')+_0x2b053d['id']);}return _0x1f954a[_0xe810('0x33')][_0xe810('0x1e')]({'where':{'calleridnum':_0x46ddfa['phone'],'CampaignId':_0x2b053d['id']}});})[_0xe810('0x1f')](function(_0x60990b){if(!_[_0xe810('0x1b')](_0x60990b)){throw new Error(_0xe810('0x34')+_0x46ddfa[_0xe810('0xb')]+_0xe810('0x35')+_0x2b053d['id']);}return _0x1f954a[_0xe810('0x25')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa['ListId'],'priority':_0x46ddfa[_0xe810('0x2d')]?_0x46ddfa[_0xe810('0x2d')]:0x2,'scheduledat':_0x46ddfa['scheduledat']?_0x46ddfa[_0xe810('0x18')]:moment()[_0xe810('0x19')](_0xe810('0x1a')),'callback':_0x46ddfa[_0xe810('0x29')]?!![]:![],'callbackuniqueid':_0x46ddfa[_0xe810('0x29')]?_0x46ddfa['callbackUniqueid']:undefined,'callbackat':_0x46ddfa[_0xe810('0x29')]?moment()[_0xe810('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2b053d['id']});})[_0xe810('0x2e')](function(_0x1deb40){_0x5b4ae8(_0x1deb40);});});});};if(_0x46ddfa[_0xe810('0x28')]){_0x1f954a[_0xe810('0x1d')][_0xe810('0x36')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0xe810('0x1c')],'include':[{'model':_0x1f954a[_0xe810('0x37')],'as':_0xe810('0x38'),'where':{'id':_0x46ddfa[_0xe810('0x28')]}}]})[_0xe810('0x1f')](function(_0x328639){if(_0x328639){var _0xeee8c7=[];for(var _0x1e7eae=0x0,_0x2f0142;_0x1e7eae<_0x328639[_0xe810('0x39')];_0x1e7eae+=0x1){_0x2f0142=_0x328639[_0x1e7eae][_0xe810('0x3a')]({'plain':!![]});switch(_0x2f0142[_0xe810('0x3b')]){case _0xe810('0x3c'):_0x1327ce(_0x2f0142)[_0xe810('0x2e')](_0x69c0b5());break;case _0xe810('0x3d'):_0x4c1168(_0x2f0142)['catch'](_0x69c0b5());break;default:_0x118b29(_0x2f0142,_0x46ddfa)[_0xe810('0x1f')](function(_0x8b41d8){_0x46ddfa[_0xe810('0x18')]=_0x8b41d8[_0xe810('0x24')];_0x1f954a[_0xe810('0x25')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa['ListId'],'scheduledat':_0x46ddfa['scheduledat']?_0x46ddfa[_0xe810('0x18')]:moment()[_0xe810('0x19')](_0xe810('0x1a')),'priority':_0x46ddfa[_0xe810('0x2d')]?_0x46ddfa[_0xe810('0x2d')]:0x2,'callback':_0x46ddfa['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46ddfa[_0xe810('0x29')]?_0x46ddfa[_0xe810('0x29')]:undefined,'callbackat':_0x46ddfa['callbackUniqueid']?moment()['format'](_0xe810('0x1a')):undefined,'VoiceQueueId':_0x2f0142['id']})[_0xe810('0x2e')](_0x69c0b5());});}}}})[_0xe810('0x1f')](function(){return _0x1f954a[_0xe810('0x1d')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1f954a[_0xe810('0x37')],'as':'BlackLists','where':{'id':_0x46ddfa[_0xe810('0x28')]}}]})[_0xe810('0x1f')](function(_0xd9c781){if(_0xd9c781){var _0x24bd63=[];for(var _0x5cbc29=0x0,_0x2e98b2;_0x5cbc29<_0xd9c781[_0xe810('0x39')];_0x5cbc29+=0x1){_0x2e98b2=_0xd9c781[_0x5cbc29][_0xe810('0x3a')]({'plain':!![]});_0x1f954a['CmHopperBlack'][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa['ListId'],'VoiceQueueId':_0x2e98b2['id']})[_0xe810('0x2e')](function(_0x1f380a){logger[_0xe810('0x2f')](_0xe810('0x3e'),_0xe810('0x16'),_0x1f380a[_0xe810('0x3f')]);});}}});})[_0xe810('0x1f')](function(){return _0x1f954a[_0xe810('0x30')][_0xe810('0x36')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1f954a['CmList'],'as':'Lists','where':{'id':_0x46ddfa[_0xe810('0x28')]}}]})['then'](function(_0x582435){if(_0x582435){var _0x457121=[];for(var _0x22e5fe=0x0,_0x514d8b;_0x22e5fe<_0x582435['length'];_0x22e5fe+=0x1){_0x514d8b=_0x582435[_0x22e5fe][_0xe810('0x3a')]({'plain':!![]});switch(_0x514d8b[_0xe810('0x3b')]){case _0xe810('0x3c'):_0x2fceca(_0x514d8b)[_0xe810('0x2e')](_0x4fe80a());break;case _0xe810('0x3d'):_0x310a9b(_0x514d8b)[_0xe810('0x2e')](_0x4fe80a());break;default:_0x1f954a[_0xe810('0x25')]['create']({'phone':_0x46ddfa['phone'],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa[_0xe810('0x28')],'scheduledat':_0x46ddfa['scheduledat']?_0x46ddfa[_0xe810('0x18')]:moment()[_0xe810('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x46ddfa[_0xe810('0x2d')]?_0x46ddfa[_0xe810('0x2d')]:0x2,'callback':_0x46ddfa[_0xe810('0x29')]?!![]:![],'callbackuniqueid':_0x46ddfa[_0xe810('0x29')]?_0x46ddfa[_0xe810('0x29')]:undefined,'callbackat':_0x46ddfa[_0xe810('0x29')]?moment()['format'](_0xe810('0x1a')):undefined,'CampaignId':_0x514d8b['id']})['catch'](_0x4fe80a());}}}});})[_0xe810('0x1f')](function(){return _0x1f954a[_0xe810('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x1f954a['CmList'],'as':_0xe810('0x40'),'where':{'id':_0x46ddfa[_0xe810('0x28')]}}]})['then'](function(_0x2acc36){if(_0x2acc36){var _0x4e432f=[];for(var _0x4f985d=0x0,_0x5b75f4;_0x4f985d<_0x2acc36[_0xe810('0x39')];_0x4f985d+=0x1){_0x5b75f4=_0x2acc36[_0x4f985d][_0xe810('0x3a')]({'plain':!![]});_0x1f954a[_0xe810('0x41')][_0xe810('0x27')]({'phone':_0x46ddfa[_0xe810('0xb')],'ContactId':_0x46ddfa['id'],'ListId':_0x46ddfa[_0xe810('0x28')],'CampaignId':_0x5b75f4['id']})[_0xe810('0x2e')](function(_0x6494ba){logger[_0xe810('0x2f')](_0xe810('0x3e'),_0xe810('0x16'),_0x6494ba[_0xe810('0x3f')]);});}}});})[_0xe810('0x1f')](function(){_0x322f09();})[_0xe810('0x2e')](function(_0x3d9998){logger[_0xe810('0x2f')](_0xe810('0x3e'),_0xe810('0x16'),_0x3d9998[_0xe810('0x3f')]);_0x322f09(_0x3d9998);});}else{_0x322f09(new Error(_0xe810('0x42')));}},'afterDestroy':function(_0x4a4036,_0x434fa1,_0x587a35){var _0x17437a=_0x527f30[_0xe810('0x14')];var _0x387679=_0x4a4036['get']({'plain':!![]});return _0x17437a[_0xe810('0x25')][_0xe810('0x36')]({'raw':!![],'where':{'ListId':_0x387679[_0xe810('0x28')],'ContactId':_0x387679['id']}})[_0xe810('0x1f')](function(_0x4f855d){if(!_[_0xe810('0x43')](_0x4f855d)){var _0x36b8b1=[];for(var _0x4b1cca=0x0;_0x4b1cca<_0x4f855d[_0xe810('0x39')];_0x4b1cca+=0x1){var _0x53b101=_0x17437a[_0xe810('0x25')][_0xe810('0x44')]({'where':{'ListId':_0x4f855d[_0x4b1cca][_0xe810('0x28')],'ContactId':_0x4f855d[_0x4b1cca][_0xe810('0x45')],'VoiceQueueId':_0x4f855d[_0x4b1cca]['VoiceQueueId'],'CampaignId':_0x4f855d[_0x4b1cca][_0xe810('0x46')]}});_0x36b8b1[_0xe810('0x47')](_0x53b101);}return BPromise[_0xe810('0x48')](_0x36b8b1);}})['then'](function(_0x2a329f){logger[_0xe810('0x49')](_0xe810('0x4a'),util[_0xe810('0x17')](_0x2a329f,{'showHidden':![],'depth':null}));_0x587a35();})[_0xe810('0x2e')](function(_0x360ab5){logger['error']('[CmContact][afterDestroy][Error]',util[_0xe810('0x17')](_0x360ab5,{'showHidden':![],'depth':null}));_0x587a35(_0x360ab5);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 02a35ea..a0acd54 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3fdead,_0x570297){var _0x546e65=function(_0x5a6460){while(--_0x5a6460){_0x3fdead['push'](_0x3fdead['shift']());}};_0x546e65(++_0x570297);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c720e73..208cad3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc718=['STRING','PHONE','sequelize','INTEGER'];(function(_0x29eeec,_0x337c09){var _0x2cf46e=function(_0x491b79){while(--_0x491b79){_0x29eeec['push'](_0x29eeec['shift']());}};_0x2cf46e(++_0x337c09);}(_0xc718,0xb6));var _0x8c71=function(_0xcb2404,_0x390c79){_0xcb2404=_0xcb2404-0x0;var _0x219adb=_0xc718[_0xcb2404];return _0x219adb;};'use strict';var Sequelize=require(_0x8c71('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x8c71('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8c71('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8c71('0x2')],'defaultValue':_0x8c71('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x4876=['INTEGER','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x6487('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x6487('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x6487('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x6487('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 34a28a9..c693472 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed33=['include','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','destroy','then','get','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','length','order','sort','where','pick','merge','options','includeAll'];(function(_0x21747a,_0x2bf4d5){var _0x365f2a=function(_0x1e2b22){while(--_0x1e2b22){_0x21747a['push'](_0x21747a['shift']());}};_0x365f2a(++_0x2bf4d5);}(_0xed33,0x1e4));var _0x3ed3=function(_0x56e4b9,_0x292b1a){_0x56e4b9=_0x56e4b9-0x0;var _0x448e90=_0xed33[_0x56e4b9];return _0x448e90;};'use strict';var emlformat=require(_0x3ed3('0x0'));var rimraf=require(_0x3ed3('0x1'));var zipdir=require(_0x3ed3('0x2'));var jsonpatch=require(_0x3ed3('0x3'));var rp=require(_0x3ed3('0x4'));var moment=require(_0x3ed3('0x5'));var BPromise=require(_0x3ed3('0x6'));var Mustache=require('mustache');var util=require(_0x3ed3('0x7'));var path=require(_0x3ed3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ed3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ed3('0xa'));var squel=require(_0x3ed3('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ed3('0xc'));var deskjs=require(_0x3ed3('0xd'));var toCsv=require(_0x3ed3('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3ed3('0xf'));var authService=require(_0x3ed3('0x10'));var qs=require(_0x3ed3('0x11'));var as=require(_0x3ed3('0x12'));var hardwareService=require(_0x3ed3('0x13'));var logger=require(_0x3ed3('0x14'))(_0x3ed3('0x15'));var utils=require('../../config/utils');var config=require(_0x3ed3('0x16'));var licenseUtil=require(_0x3ed3('0x17'));var db=require(_0x3ed3('0x18'))['db'];function respondWithStatusCode(_0x8931a8,_0x23ad7e){_0x23ad7e=_0x23ad7e||0xcc;return function(_0x2b83d7){if(_0x2b83d7){return _0x8931a8[_0x3ed3('0x19')](_0x23ad7e);}return _0x8931a8['status'](_0x23ad7e)['end']();};}function respondWithResult(_0x226fe6,_0x280ad6){_0x280ad6=_0x280ad6||0xc8;return function(_0x2e6543){if(_0x2e6543){return _0x226fe6['status'](_0x280ad6)['json'](_0x2e6543);}};}function respondWithFilteredResult(_0x13aebd,_0x1bec31){return function(_0x27bbc2){if(_0x27bbc2){var _0x2c2e0e=typeof _0x1bec31[_0x3ed3('0x1a')]===_0x3ed3('0x1b')&&typeof _0x1bec31[_0x3ed3('0x1c')]===_0x3ed3('0x1b');var _0x2baa52=_0x27bbc2['count'];var _0x1bb6e1=_0x2c2e0e?0x0:_0x1bec31['offset'];var _0x57ec03=_0x2c2e0e?_0x27bbc2[_0x3ed3('0x1d')]:_0x1bec31['offset']+_0x1bec31[_0x3ed3('0x1c')];var _0x542103;if(_0x57ec03>=_0x2baa52){_0x57ec03=_0x2baa52;_0x542103=0xc8;}else{_0x542103=0xce;}_0x13aebd[_0x3ed3('0x1e')](_0x542103);return _0x13aebd[_0x3ed3('0x1f')](_0x3ed3('0x20'),_0x1bb6e1+'-'+_0x57ec03+'/'+_0x2baa52)[_0x3ed3('0x21')](_0x27bbc2);}return null;};}function patchUpdates(_0x435d9a){return function(_0x31edb4){try{jsonpatch[_0x3ed3('0x22')](_0x31edb4,_0x435d9a,!![]);}catch(_0x48dcaf){return BPromise[_0x3ed3('0x23')](_0x48dcaf);}return _0x31edb4['save']();};}function saveUpdates(_0x4e1526,_0x305fae){return function(_0x49046f){if(_0x49046f){return _0x49046f[_0x3ed3('0x24')](_0x4e1526)['then'](function(_0x435911){return _0x435911;});}return null;};}function removeEntity(_0x2bf6ee,_0x39bfaf){return function(_0x3c1a9d){if(_0x3c1a9d){return _0x3c1a9d[_0x3ed3('0x25')]()[_0x3ed3('0x26')](function(){var _0x5b69e6=_0x3c1a9d[_0x3ed3('0x27')]({'plain':!![]});var _0x1cd220='CmContactHasItems';return db['UserProfileResource'][_0x3ed3('0x25')]({'where':{'type':_0x1cd220,'resourceId':_0x5b69e6['id']}})[_0x3ed3('0x26')](function(){return _0x3c1a9d;});})[_0x3ed3('0x26')](function(){_0x2bf6ee[_0x3ed3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a81f5,_0x3b6655){return function(_0x17b359){if(!_0x17b359){_0x4a81f5[_0x3ed3('0x19')](0x194);}return _0x17b359;};}function handleError(_0x29ac54,_0xd936d6){_0xd936d6=_0xd936d6||0x1f4;return function(_0xd979be){logger[_0x3ed3('0x28')](_0xd979be['stack']);if(_0xd979be[_0x3ed3('0x29')]){delete _0xd979be[_0x3ed3('0x29')];}_0x29ac54[_0x3ed3('0x1e')](_0xd936d6)[_0x3ed3('0x2a')](_0xd979be);};}exports[_0x3ed3('0x2b')]=function(_0x3f953d,_0x2ae7d7){var _0x5aae9d={},_0x7069bd={},_0x1e0fd8={'count':0x0,'rows':[]};var _0x2154da=_[_0x3ed3('0x2c')](db[_0x3ed3('0x2d')][_0x3ed3('0x2e')],function(_0x31428e){return{'name':_0x31428e[_0x3ed3('0x2f')],'type':_0x31428e[_0x3ed3('0x30')]['key']};});_0x7069bd['model']=_[_0x3ed3('0x2c')](_0x2154da,_0x3ed3('0x29'));_0x7069bd[_0x3ed3('0x31')]=_['keys'](_0x3f953d['query']);_0x7069bd[_0x3ed3('0x32')]=_[_0x3ed3('0x33')](_0x7069bd[_0x3ed3('0x34')],_0x7069bd[_0x3ed3('0x31')]);_0x5aae9d[_0x3ed3('0x35')]=_[_0x3ed3('0x33')](_0x7069bd['model'],qs['fields'](_0x3f953d[_0x3ed3('0x31')]['fields']));_0x5aae9d[_0x3ed3('0x35')]=_0x5aae9d[_0x3ed3('0x35')][_0x3ed3('0x36')]?_0x5aae9d[_0x3ed3('0x35')]:_0x7069bd[_0x3ed3('0x34')];if(!_0x3f953d[_0x3ed3('0x31')]['hasOwnProperty']('nolimit')){_0x5aae9d[_0x3ed3('0x1c')]=qs[_0x3ed3('0x1c')](_0x3f953d['query'][_0x3ed3('0x1c')]);_0x5aae9d['offset']=qs[_0x3ed3('0x1a')](_0x3f953d[_0x3ed3('0x31')]['offset']);}_0x5aae9d[_0x3ed3('0x37')]=qs[_0x3ed3('0x38')](_0x3f953d['query']['sort']);_0x5aae9d[_0x3ed3('0x39')]=qs[_0x3ed3('0x32')](_[_0x3ed3('0x3a')](_0x3f953d[_0x3ed3('0x31')],_0x7069bd[_0x3ed3('0x32')]),_0x2154da);if(_0x3f953d[_0x3ed3('0x31')]['filter']){_0x5aae9d[_0x3ed3('0x39')]=_[_0x3ed3('0x3b')](_0x5aae9d[_0x3ed3('0x39')],{'$or':_[_0x3ed3('0x2c')](_0x2154da,function(_0x46999e){if(_0x46999e[_0x3ed3('0x30')]!=='VIRTUAL'){var _0x135dd8={};_0x135dd8[_0x46999e['name']]={'$like':'%'+_0x3f953d[_0x3ed3('0x31')]['filter']+'%'};return _0x135dd8;}})});}_0x5aae9d=_[_0x3ed3('0x3b')]({},_0x5aae9d,_0x3f953d[_0x3ed3('0x3c')]);var _0x567887={'where':_0x5aae9d['where']};return db['CmContactHasItem'][_0x3ed3('0x1d')](_0x567887)[_0x3ed3('0x26')](function(_0x59093a){_0x1e0fd8['count']=_0x59093a;if(_0x3f953d[_0x3ed3('0x31')][_0x3ed3('0x3d')]){_0x5aae9d[_0x3ed3('0x3e')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x5aae9d);})['then'](function(_0xa7611c){_0x1e0fd8[_0x3ed3('0x3f')]=_0xa7611c;return _0x1e0fd8;})['then'](respondWithFilteredResult(_0x2ae7d7,_0x5aae9d))[_0x3ed3('0x40')](handleError(_0x2ae7d7,null));};exports[_0x3ed3('0x41')]=function(_0x219cc1,_0x293ec2){var _0x492587={'raw':!![],'where':{'id':_0x219cc1[_0x3ed3('0x42')]['id']}},_0x90ac86={};_0x90ac86[_0x3ed3('0x34')]=_['keys'](db[_0x3ed3('0x2d')][_0x3ed3('0x2e')]);_0x90ac86['query']=_['keys'](_0x219cc1[_0x3ed3('0x31')]);_0x90ac86['filters']=_[_0x3ed3('0x33')](_0x90ac86[_0x3ed3('0x34')],_0x90ac86[_0x3ed3('0x31')]);_0x492587[_0x3ed3('0x35')]=_['intersection'](_0x90ac86['model'],qs[_0x3ed3('0x43')](_0x219cc1[_0x3ed3('0x31')][_0x3ed3('0x43')]));_0x492587[_0x3ed3('0x35')]=_0x492587[_0x3ed3('0x35')][_0x3ed3('0x36')]?_0x492587['attributes']:_0x90ac86[_0x3ed3('0x34')];if(_0x219cc1['query'][_0x3ed3('0x3d')]){_0x492587[_0x3ed3('0x3e')]=[{'all':!![]}];}_0x492587=_[_0x3ed3('0x3b')]({},_0x492587,_0x219cc1[_0x3ed3('0x3c')]);return db[_0x3ed3('0x2d')][_0x3ed3('0x44')](_0x492587)[_0x3ed3('0x26')](handleEntityNotFound(_0x293ec2,null))[_0x3ed3('0x26')](respondWithResult(_0x293ec2,null))[_0x3ed3('0x40')](handleError(_0x293ec2,null));};exports[_0x3ed3('0x45')]=function(_0x4c0b2f,_0x501d92){return db[_0x3ed3('0x2d')]['create'](_0x4c0b2f[_0x3ed3('0x46')],{})[_0x3ed3('0x26')](function(_0x46fa18){var _0x2f39a0=_0x4c0b2f[_0x3ed3('0x47')][_0x3ed3('0x27')]({'plain':!![]});if(!_0x2f39a0)throw new Error(_0x3ed3('0x48'));if(_0x2f39a0[_0x3ed3('0x49')]===_0x3ed3('0x47')){var _0x278243=_0x46fa18[_0x3ed3('0x27')]({'plain':!![]});var _0x531914='CmContactHasItems';return db['UserProfileSection'][_0x3ed3('0x44')]({'where':{'name':_0x531914,'userProfileId':_0x2f39a0[_0x3ed3('0x4a')]},'raw':!![]})[_0x3ed3('0x26')](function(_0x338e90){if(_0x338e90&&_0x338e90[_0x3ed3('0x4b')]===0x0){return db[_0x3ed3('0x4c')][_0x3ed3('0x45')]({'name':_0x278243[_0x3ed3('0x29')],'resourceId':_0x278243['id'],'type':_0x338e90[_0x3ed3('0x29')],'sectionId':_0x338e90['id']},{})[_0x3ed3('0x26')](function(){return _0x46fa18;});}else{return _0x46fa18;}})['catch'](function(_0x136352){logger['error'](_0x3ed3('0x4d'),_0x136352);throw _0x136352;});}return _0x46fa18;})['then'](respondWithResult(_0x501d92,0xc9))[_0x3ed3('0x40')](handleError(_0x501d92,null));};exports['update']=function(_0x5f28d1,_0x41d7e3){if(_0x5f28d1[_0x3ed3('0x46')]['id']){delete _0x5f28d1[_0x3ed3('0x46')]['id'];}return db[_0x3ed3('0x2d')][_0x3ed3('0x44')]({'where':{'id':_0x5f28d1[_0x3ed3('0x42')]['id']}})[_0x3ed3('0x26')](handleEntityNotFound(_0x41d7e3,null))[_0x3ed3('0x26')](saveUpdates(_0x5f28d1[_0x3ed3('0x46')],null))['then'](respondWithResult(_0x41d7e3,null))[_0x3ed3('0x40')](handleError(_0x41d7e3,null));};exports[_0x3ed3('0x25')]=function(_0x3f14c1,_0x37e986){return db[_0x3ed3('0x2d')][_0x3ed3('0x44')]({'where':{'id':_0x3f14c1[_0x3ed3('0x42')]['id']}})[_0x3ed3('0x26')](handleEntityNotFound(_0x37e986,null))[_0x3ed3('0x26')](removeEntity(_0x37e986,null))[_0x3ed3('0x40')](handleError(_0x37e986,null));}; \ No newline at end of file +var _0x287f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','catch','rawAttributes','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x217214,_0x5133d8){var _0x5a4889=function(_0x3a7dbd){while(--_0x3a7dbd){_0x217214['push'](_0x217214['shift']());}};_0x5a4889(++_0x5133d8);}(_0x287f,0x13a));var _0xf287=function(_0x3fbcaf,_0x4cb505){_0x3fbcaf=_0x3fbcaf-0x0;var _0x37d09e=_0x287f[_0x3fbcaf];return _0x37d09e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf287('0x0'));var zipdir=require(_0xf287('0x1'));var jsonpatch=require(_0xf287('0x2'));var rp=require(_0xf287('0x3'));var moment=require('moment');var BPromise=require(_0xf287('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf287('0x5'));var csv=require(_0xf287('0x6'));var ejs=require(_0xf287('0x7'));var fs=require('fs');var fs_extra=require(_0xf287('0x8'));var _=require(_0xf287('0x9'));var squel=require(_0xf287('0xa'));var crypto=require('crypto');var jsforce=require(_0xf287('0xb'));var deskjs=require(_0xf287('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf287('0xd'));var Papa=require(_0xf287('0xe'));var Redis=require(_0xf287('0xf'));var authService=require(_0xf287('0x10'));var qs=require(_0xf287('0x11'));var as=require(_0xf287('0x12'));var hardwareService=require(_0xf287('0x13'));var logger=require(_0xf287('0x14'))(_0xf287('0x15'));var utils=require('../../config/utils');var config=require(_0xf287('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x212ed1,_0x286884){_0x286884=_0x286884||0xcc;return function(_0x3a7769){if(_0x3a7769){return _0x212ed1[_0xf287('0x17')](_0x286884);}return _0x212ed1[_0xf287('0x18')](_0x286884)[_0xf287('0x19')]();};}function respondWithResult(_0x5ca320,_0x436432){_0x436432=_0x436432||0xc8;return function(_0x2f0e19){if(_0x2f0e19){return _0x5ca320['status'](_0x436432)[_0xf287('0x1a')](_0x2f0e19);}};}function respondWithFilteredResult(_0x1771b2,_0x31dc75){return function(_0x465d6e){if(_0x465d6e){var _0x473685=typeof _0x31dc75[_0xf287('0x1b')]===_0xf287('0x1c')&&typeof _0x31dc75[_0xf287('0x1d')]===_0xf287('0x1c');var _0x1d224c=_0x465d6e[_0xf287('0x1e')];var _0x25b210=_0x473685?0x0:_0x31dc75[_0xf287('0x1b')];var _0x5b416f=_0x473685?_0x465d6e[_0xf287('0x1e')]:_0x31dc75['offset']+_0x31dc75[_0xf287('0x1d')];var _0x12ca8a;if(_0x5b416f>=_0x1d224c){_0x5b416f=_0x1d224c;_0x12ca8a=0xc8;}else{_0x12ca8a=0xce;}_0x1771b2[_0xf287('0x18')](_0x12ca8a);return _0x1771b2[_0xf287('0x1f')](_0xf287('0x20'),_0x25b210+'-'+_0x5b416f+'/'+_0x1d224c)[_0xf287('0x1a')](_0x465d6e);}return null;};}function patchUpdates(_0x50932b){return function(_0x2effe6){try{jsonpatch[_0xf287('0x21')](_0x2effe6,_0x50932b,!![]);}catch(_0x128ec8){return BPromise[_0xf287('0x22')](_0x128ec8);}return _0x2effe6[_0xf287('0x23')]();};}function saveUpdates(_0x4663e9,_0x4b5076){return function(_0x25504b){if(_0x25504b){return _0x25504b[_0xf287('0x24')](_0x4663e9)[_0xf287('0x25')](function(_0x35ae93){return _0x35ae93;});}return null;};}function removeEntity(_0x4348dc,_0x3f4c52){return function(_0x341c25){if(_0x341c25){return _0x341c25[_0xf287('0x26')]()['then'](function(){var _0x366b77=_0x341c25[_0xf287('0x27')]({'plain':!![]});var _0x394466=_0xf287('0x28');return db[_0xf287('0x29')][_0xf287('0x26')]({'where':{'type':_0x394466,'resourceId':_0x366b77['id']}})[_0xf287('0x25')](function(){return _0x341c25;});})[_0xf287('0x25')](function(){_0x4348dc[_0xf287('0x18')](0xcc)[_0xf287('0x19')]();});}};}function handleEntityNotFound(_0x4689e5,_0x2d4476){return function(_0x5e9bf6){if(!_0x5e9bf6){_0x4689e5[_0xf287('0x17')](0x194);}return _0x5e9bf6;};}function handleError(_0x17b2bb,_0x57211a){_0x57211a=_0x57211a||0x1f4;return function(_0x394604){logger[_0xf287('0x2a')](_0x394604[_0xf287('0x2b')]);if(_0x394604[_0xf287('0x2c')]){delete _0x394604[_0xf287('0x2c')];}_0x17b2bb[_0xf287('0x18')](_0x57211a)[_0xf287('0x2d')](_0x394604);};}exports[_0xf287('0x2e')]=function(_0x55421,_0x33975e){var _0x57ef46={},_0x21eacd={},_0x41b074={'count':0x0,'rows':[]};var _0xdbc8c5=_[_0xf287('0x2f')](db[_0xf287('0x30')]['rawAttributes'],function(_0x2c2bfb){return{'name':_0x2c2bfb[_0xf287('0x31')],'type':_0x2c2bfb[_0xf287('0x32')][_0xf287('0x33')]};});_0x21eacd[_0xf287('0x34')]=_[_0xf287('0x2f')](_0xdbc8c5,_0xf287('0x2c'));_0x21eacd['query']=_[_0xf287('0x35')](_0x55421[_0xf287('0x36')]);_0x21eacd[_0xf287('0x37')]=_['intersection'](_0x21eacd[_0xf287('0x34')],_0x21eacd[_0xf287('0x36')]);_0x57ef46[_0xf287('0x38')]=_['intersection'](_0x21eacd[_0xf287('0x34')],qs[_0xf287('0x39')](_0x55421[_0xf287('0x36')]['fields']));_0x57ef46[_0xf287('0x38')]=_0x57ef46[_0xf287('0x38')][_0xf287('0x3a')]?_0x57ef46[_0xf287('0x38')]:_0x21eacd[_0xf287('0x34')];if(!_0x55421['query'][_0xf287('0x3b')](_0xf287('0x3c'))){_0x57ef46[_0xf287('0x1d')]=qs[_0xf287('0x1d')](_0x55421[_0xf287('0x36')][_0xf287('0x1d')]);_0x57ef46[_0xf287('0x1b')]=qs['offset'](_0x55421[_0xf287('0x36')][_0xf287('0x1b')]);}_0x57ef46['order']=qs[_0xf287('0x3d')](_0x55421[_0xf287('0x36')][_0xf287('0x3d')]);_0x57ef46['where']=qs[_0xf287('0x37')](_[_0xf287('0x3e')](_0x55421['query'],_0x21eacd[_0xf287('0x37')]),_0xdbc8c5);if(_0x55421['query'][_0xf287('0x3f')]){_0x57ef46[_0xf287('0x40')]=_[_0xf287('0x41')](_0x57ef46['where'],{'$or':_['map'](_0xdbc8c5,function(_0x2ef5ba){if(_0x2ef5ba[_0xf287('0x32')]!=='VIRTUAL'){var _0x39afeb={};_0x39afeb[_0x2ef5ba[_0xf287('0x2c')]]={'$like':'%'+_0x55421[_0xf287('0x36')][_0xf287('0x3f')]+'%'};return _0x39afeb;}})});}_0x57ef46=_[_0xf287('0x41')]({},_0x57ef46,_0x55421[_0xf287('0x42')]);var _0x27b74e={'where':_0x57ef46[_0xf287('0x40')]};return db[_0xf287('0x30')]['count'](_0x27b74e)[_0xf287('0x25')](function(_0x2648e7){_0x41b074[_0xf287('0x1e')]=_0x2648e7;if(_0x55421[_0xf287('0x36')]['includeAll']){_0x57ef46[_0xf287('0x43')]=[{'all':!![]}];}return db[_0xf287('0x30')][_0xf287('0x44')](_0x57ef46);})['then'](function(_0x5d8888){_0x41b074['rows']=_0x5d8888;return _0x41b074;})[_0xf287('0x25')](respondWithFilteredResult(_0x33975e,_0x57ef46))[_0xf287('0x45')](handleError(_0x33975e,null));};exports['show']=function(_0x5f0e5f,_0x2566bf){var _0xcdbb6a={'raw':!![],'where':{'id':_0x5f0e5f['params']['id']}},_0x453002={};_0x453002['model']=_[_0xf287('0x35')](db[_0xf287('0x30')][_0xf287('0x46')]);_0x453002[_0xf287('0x36')]=_[_0xf287('0x35')](_0x5f0e5f[_0xf287('0x36')]);_0x453002[_0xf287('0x37')]=_[_0xf287('0x47')](_0x453002[_0xf287('0x34')],_0x453002[_0xf287('0x36')]);_0xcdbb6a['attributes']=_[_0xf287('0x47')](_0x453002[_0xf287('0x34')],qs[_0xf287('0x39')](_0x5f0e5f['query'][_0xf287('0x39')]));_0xcdbb6a[_0xf287('0x38')]=_0xcdbb6a[_0xf287('0x38')][_0xf287('0x3a')]?_0xcdbb6a[_0xf287('0x38')]:_0x453002[_0xf287('0x34')];if(_0x5f0e5f[_0xf287('0x36')][_0xf287('0x48')]){_0xcdbb6a[_0xf287('0x43')]=[{'all':!![]}];}_0xcdbb6a=_[_0xf287('0x41')]({},_0xcdbb6a,_0x5f0e5f[_0xf287('0x42')]);return db[_0xf287('0x30')][_0xf287('0x49')](_0xcdbb6a)[_0xf287('0x25')](handleEntityNotFound(_0x2566bf,null))[_0xf287('0x25')](respondWithResult(_0x2566bf,null))[_0xf287('0x45')](handleError(_0x2566bf,null));};exports['create']=function(_0x689cc1,_0x3c3fd1){return db[_0xf287('0x30')][_0xf287('0x4a')](_0x689cc1['body'],{})['then'](function(_0x18ed8e){var _0xed18cf=_0x689cc1[_0xf287('0x4b')][_0xf287('0x27')]({'plain':!![]});if(!_0xed18cf)throw new Error(_0xf287('0x4c'));if(_0xed18cf['role']===_0xf287('0x4b')){var _0x189c7a=_0x18ed8e[_0xf287('0x27')]({'plain':!![]});var _0x4f8a7a=_0xf287('0x28');return db[_0xf287('0x4d')]['find']({'where':{'name':_0x4f8a7a,'userProfileId':_0xed18cf[_0xf287('0x4e')]},'raw':!![]})[_0xf287('0x25')](function(_0x2adef8){if(_0x2adef8&&_0x2adef8['autoAssociation']===0x0){return db[_0xf287('0x29')]['create']({'name':_0x189c7a[_0xf287('0x2c')],'resourceId':_0x189c7a['id'],'type':_0x2adef8[_0xf287('0x2c')],'sectionId':_0x2adef8['id']},{})[_0xf287('0x25')](function(){return _0x18ed8e;});}else{return _0x18ed8e;}})[_0xf287('0x45')](function(_0x15ede0){logger['error'](_0xf287('0x4f'),_0x15ede0);throw _0x15ede0;});}return _0x18ed8e;})[_0xf287('0x25')](respondWithResult(_0x3c3fd1,0xc9))[_0xf287('0x45')](handleError(_0x3c3fd1,null));};exports['update']=function(_0x1daeb4,_0x59f959){if(_0x1daeb4[_0xf287('0x50')]['id']){delete _0x1daeb4[_0xf287('0x50')]['id'];}return db[_0xf287('0x30')][_0xf287('0x49')]({'where':{'id':_0x1daeb4[_0xf287('0x51')]['id']}})[_0xf287('0x25')](handleEntityNotFound(_0x59f959,null))['then'](saveUpdates(_0x1daeb4[_0xf287('0x50')],null))['then'](respondWithResult(_0x59f959,null))[_0xf287('0x45')](handleError(_0x59f959,null));};exports[_0xf287('0x26')]=function(_0x2e9e4c,_0x26364a){return db['CmContactHasItem'][_0xf287('0x49')]({'where':{'id':_0x2e9e4c[_0xf287('0x51')]['id']}})[_0xf287('0x25')](handleEntityNotFound(_0x26364a,null))['then'](removeEntity(_0x26364a,null))[_0xf287('0x45')](handleError(_0x26364a,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index fba5688..cfb3598 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e1=['CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x3ea7e9,_0x472bc5){var _0x26388b=function(_0x131ea1){while(--_0x131ea1){_0x3ea7e9['push'](_0x3ea7e9['shift']());}};_0x26388b(++_0x472bc5);}(_0xd4e1,0x9c));var _0x1d4e=function(_0x43c139,_0x17a132){_0x43c139=_0x43c139-0x0;var _0x58e477=_0xd4e1[_0x43c139];return _0x58e477;};'use strict';var _=require(_0x1d4e('0x0'));var util=require('util');var logger=require(_0x1d4e('0x1'))(_0x1d4e('0x2'));var moment=require(_0x1d4e('0x3'));var BPromise=require(_0x1d4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4e('0x5'));var config=require(_0x1d4e('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x1d4e('0x7')]=function(_0x1122be,_0x18c59f){return _0x1122be[_0x1d4e('0x8')](_0x1d4e('0x9'),attributes,{'tableName':_0x1d4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcfe=['request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird'];(function(_0x16ca06,_0x15df40){var _0x41df4c=function(_0x10d0ab){while(--_0x10d0ab){_0x16ca06['push'](_0x16ca06['shift']());}};_0x41df4c(++_0x15df40);}(_0xdcfe,0x17b));var _0xedcf=function(_0x429656,_0x2b5514){_0x429656=_0x429656-0x0;var _0x47f003=_0xdcfe[_0x429656];return _0x47f003;};'use strict';var _=require(_0xedcf('0x0'));var util=require('util');var logger=require(_0xedcf('0x1'))(_0xedcf('0x2'));var moment=require(_0xedcf('0x3'));var BPromise=require(_0xedcf('0x4'));var rp=require(_0xedcf('0x5'));var fs=require('fs');var path=require(_0xedcf('0x6'));var rimraf=require('rimraf');var config=require(_0xedcf('0x7'));var attributes=require(_0xedcf('0x8'));module[_0xedcf('0x9')]=function(_0x52188d,_0x286b03){return _0x52188d[_0xedcf('0xa')]('CmContactHasItem',attributes,{'tableName':_0xedcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 8e15b18..758080b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cba=['request\x20sent','debug','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x6cba,0x79));var _0xa6cb=function(_0x504d1e,_0x358b66){_0x504d1e=_0x504d1e-0x0;var _0xe0f72d=_0x6cba[_0x504d1e];return _0xe0f72d;};'use strict';var _=require(_0xa6cb('0x0'));var util=require('util');var moment=require(_0xa6cb('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6cb('0x3'))['db'];var utils=require(_0xa6cb('0x4'));var logger=require(_0xa6cb('0x5'))(_0xa6cb('0x6'));var config=require(_0xa6cb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa6cb('0x8')][_0xa6cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa11d,_0x519198,_0x3701f7){return new BPromise(function(_0x6c6739,_0x2fff18){return client[_0xa6cb('0xa')](_0x4aa11d,_0x3701f7)['then'](function(_0x17baf4){logger[_0xa6cb('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x519198,_0xa6cb('0xc'));logger[_0xa6cb('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x519198,_0xa6cb('0xc'),JSON[_0xa6cb('0xe')](_0x17baf4));if(_0x17baf4[_0xa6cb('0xf')]){if(_0x17baf4['error']['code']===0x1f4){logger['error'](_0xa6cb('0x10'),_0x519198,_0x17baf4['error'][_0xa6cb('0x11')]);return _0x2fff18(_0x17baf4[_0xa6cb('0xf')][_0xa6cb('0x11')]);}logger['error'](_0xa6cb('0x10'),_0x519198,_0x17baf4[_0xa6cb('0xf')][_0xa6cb('0x11')]);return _0x6c6739(_0x17baf4[_0xa6cb('0xf')][_0xa6cb('0x11')]);}else{logger['info'](_0xa6cb('0x10'),_0x519198,_0xa6cb('0xc'));_0x6c6739(_0x17baf4[_0xa6cb('0x12')][_0xa6cb('0x11')]);}})['catch'](function(_0x1adec7){logger[_0xa6cb('0xf')](_0xa6cb('0x10'),_0x519198,_0x1adec7);_0x2fff18(_0x1adec7);});});} \ No newline at end of file +var _0x5803=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x107d22,_0xf70bed){var _0x1eaeb1=function(_0x28039a){while(--_0x28039a){_0x107d22['push'](_0x107d22['shift']());}};_0x1eaeb1(++_0xf70bed);}(_0x5803,0x192));var _0x3580=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5803[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x3580('0x0'));var util=require(_0x3580('0x1'));var moment=require(_0x3580('0x2'));var BPromise=require(_0x3580('0x3'));var rs=require(_0x3580('0x4'));var fs=require('fs');var Redis=require(_0x3580('0x5'));var db=require(_0x3580('0x6'))['db'];var utils=require(_0x3580('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3580('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x283746,_0x20affb,_0x168720){return new BPromise(function(_0x194d2d,_0x169175){return client[_0x3580('0x9')](_0x283746,_0x168720)[_0x3580('0xa')](function(_0x226f94){logger[_0x3580('0xb')](_0x3580('0xc'),_0x20affb,_0x3580('0xd'));logger[_0x3580('0xe')](_0x3580('0xf'),_0x20affb,_0x3580('0xd'),JSON[_0x3580('0x10')](_0x226f94));if(_0x226f94[_0x3580('0x11')]){if(_0x226f94[_0x3580('0x11')][_0x3580('0x12')]===0x1f4){logger[_0x3580('0x11')](_0x3580('0xc'),_0x20affb,_0x226f94[_0x3580('0x11')]['message']);return _0x169175(_0x226f94[_0x3580('0x11')][_0x3580('0x13')]);}logger[_0x3580('0x11')](_0x3580('0xc'),_0x20affb,_0x226f94[_0x3580('0x11')][_0x3580('0x13')]);return _0x194d2d(_0x226f94[_0x3580('0x11')][_0x3580('0x13')]);}else{logger[_0x3580('0xb')](_0x3580('0xc'),_0x20affb,_0x3580('0xd'));_0x194d2d(_0x226f94[_0x3580('0x14')][_0x3580('0x13')]);}})[_0x3580('0x15')](function(_0x8fa154){logger[_0x3580('0x11')](_0x3580('0xc'),_0x20affb,_0x8fa154);_0x169175(_0x8fa154);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ec653f2..526b699 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f07=['../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','isAuthenticated','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x8f07,0x161));var _0x78f0=function(_0x460e9e,_0x5bf3e8){_0x460e9e=_0x460e9e-0x0;var _0x4a9504=_0x8f07[_0x460e9e];return _0x4a9504;};'use strict';var multer=require('multer');var util=require(_0x78f0('0x0'));var path=require('path');var timeout=require(_0x78f0('0x1'));var express=require(_0x78f0('0x2'));var router=express['Router']();var fs_extra=require(_0x78f0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x78f0('0x4'));var config=require(_0x78f0('0x5'));var controller=require(_0x78f0('0x6'));router[_0x78f0('0x7')]('/',auth['isAuthenticated'](),controller[_0x78f0('0x8')]);router[_0x78f0('0x7')]('/:id',auth[_0x78f0('0x9')](),controller[_0x78f0('0xa')]);router[_0x78f0('0xb')]('/',auth['isAuthenticated'](),controller[_0x78f0('0xc')]);router[_0x78f0('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x78f0('0xe')]('/:id',auth[_0x78f0('0x9')](),controller[_0x78f0('0xf')]);module[_0x78f0('0x10')]=router; \ No newline at end of file +var _0x0a33=['./cmContactHasItem.controller','get','index','/:id','post','create','update','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fee52,_0x3b8296){var _0x356ab7=function(_0x37718a){while(--_0x37718a){_0x4fee52['push'](_0x4fee52['shift']());}};_0x356ab7(++_0x3b8296);}(_0x0a33,0x128));var _0x30a3=function(_0x5813c1,_0x548630){_0x5813c1=_0x5813c1-0x0;var _0xb293a=_0x0a33[_0x5813c1];return _0xb293a;};'use strict';var multer=require(_0x30a3('0x0'));var util=require('util');var path=require(_0x30a3('0x1'));var timeout=require(_0x30a3('0x2'));var express=require(_0x30a3('0x3'));var router=express[_0x30a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30a3('0x5'));var interaction=require(_0x30a3('0x6'));var config=require(_0x30a3('0x7'));var controller=require(_0x30a3('0x8'));router[_0x30a3('0x9')]('/',auth['isAuthenticated'](),controller[_0x30a3('0xa')]);router[_0x30a3('0x9')](_0x30a3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x30a3('0xc')]('/',auth['isAuthenticated'](),controller[_0x30a3('0xd')]);router['put'](_0x30a3('0xb'),auth['isAuthenticated'](),controller[_0x30a3('0xe')]);router[_0x30a3('0xf')](_0x30a3('0xb'),auth[_0x30a3('0x10')](),controller[_0x30a3('0x11')]);module[_0x30a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7dd3ab3..b78e42b 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 _0x390f=['sequelize','exports','getDataValue','alias','STRING','TEXT','type','select','parse','values','isArray','setDataValue','stringify','ENUM','voice'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x390f,0x96));var _0xf390=function(_0x32ddd2,_0xe0f618){_0x32ddd2=_0x32ddd2-0x0;var _0x48de30=_0x390f[_0x32ddd2];return _0x48de30;};'use strict';var Sequelize=require(_0xf390('0x0'));var _=require('lodash');module[_0xf390('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x51a9b2){return this[_0xf390('0x2')](_0xf390('0x3'));}},'alias':{'type':Sequelize[_0xf390('0x4')],'allowNull':![],'set':function(_0x448a2c){this['setDataValue']('alias',_0x448a2c?_0x448a2c:this[_0xf390('0x2')]('name'));}},'type':{'type':Sequelize[_0xf390('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xf390('0x5')]('long'),'get':function(){if(this[_0xf390('0x2')](_0xf390('0x6'))===_0xf390('0x7')){return JSON[_0xf390('0x8')](this['getDataValue'](_0xf390('0x9')));}else{return this[_0xf390('0x2')](_0xf390('0x9'));}},'set':function(_0x51384f){if(Array[_0xf390('0xa')](_0x51384f)){this[_0xf390('0xb')](_0xf390('0x9'),JSON[_0xf390('0xc')](_0x51384f));}else{this[_0xf390('0xb')](_0xf390('0x9'),_0x51384f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf390('0xd')](_0xf390('0xe'))}}; \ No newline at end of file +var _0x4f51=['VIRTUAL','alias','STRING','setDataValue','getDataValue','name','parse','values','stringify','BOOLEAN','ENUM','voice','exports'];(function(_0x4f1789,_0x37fda7){var _0x5bb8fe=function(_0x4d1d04){while(--_0x4d1d04){_0x4f1789['push'](_0x4f1789['shift']());}};_0x5bb8fe(++_0x37fda7);}(_0x4f51,0x15e));var _0x14f5=function(_0x837dad,_0x1d9098){_0x837dad=_0x837dad-0x0;var _0x1d62d3=_0x4f51[_0x837dad];return _0x1d62d3;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x14f5('0x0')]={'name':{'type':Sequelize[_0x14f5('0x1')],'get':function(_0x1997cf){return this['getDataValue'](_0x14f5('0x2'));}},'alias':{'type':Sequelize[_0x14f5('0x3')],'allowNull':![],'set':function(_0x269f74){this[_0x14f5('0x4')]('alias',_0x269f74?_0x269f74:this[_0x14f5('0x5')](_0x14f5('0x6')));}},'type':{'type':Sequelize[_0x14f5('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x14f5('0x5')]('type')==='select'){return JSON[_0x14f5('0x7')](this[_0x14f5('0x5')]('values'));}else{return this[_0x14f5('0x5')]('values');}},'set':function(_0xe2eb58){if(Array['isArray'](_0xe2eb58)){this[_0x14f5('0x4')](_0x14f5('0x8'),JSON[_0x14f5('0x9')](_0xe2eb58));}else{this[_0x14f5('0x4')](_0x14f5('0x8'),_0xe2eb58);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x14f5('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x14f5('0xb')](_0x14f5('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 35f5f45..12a1e87 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 _0x1400=['key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','update','body','create','Sequelize','text','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','reject','destroy','then','error','stack','name','send','index','CmCustomField','fieldName','type'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x1400,0xc7));var _0x0140=function(_0x524042,_0x1b85d7){_0x524042=_0x524042-0x0;var _0x2f6e83=_0x1400[_0x524042];return _0x2f6e83;};'use strict';var emlformat=require(_0x0140('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0140('0x1'));var jsonpatch=require(_0x0140('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0140('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0140('0x4'));var csv=require(_0x0140('0x5'));var ejs=require(_0x0140('0x6'));var fs=require('fs');var fs_extra=require(_0x0140('0x7'));var _=require(_0x0140('0x8'));var squel=require('squel');var crypto=require(_0x0140('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0140('0xa'));var toCsv=require(_0x0140('0x5'));var querystring=require(_0x0140('0xb'));var Papa=require(_0x0140('0xc'));var Redis=require(_0x0140('0xd'));var authService=require(_0x0140('0xe'));var qs=require(_0x0140('0xf'));var as=require(_0x0140('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0140('0x11'));var config=require(_0x0140('0x12'));var licenseUtil=require(_0x0140('0x13'));var db=require(_0x0140('0x14'))['db'];function respondWithStatusCode(_0x2f3e1d,_0x3f221c){_0x3f221c=_0x3f221c||0xcc;return function(_0x1c9ee9){if(_0x1c9ee9){return _0x2f3e1d[_0x0140('0x15')](_0x3f221c);}return _0x2f3e1d[_0x0140('0x16')](_0x3f221c)['end']();};}function respondWithResult(_0x316b9e,_0x1d3ffb){_0x1d3ffb=_0x1d3ffb||0xc8;return function(_0x40a938){if(_0x40a938){return _0x316b9e['status'](_0x1d3ffb)[_0x0140('0x17')](_0x40a938);}};}function respondWithFilteredResult(_0x419548,_0x4d677b){return function(_0x45d377){if(_0x45d377){var _0x350f4f=typeof _0x4d677b['offset']===_0x0140('0x18')&&typeof _0x4d677b['limit']===_0x0140('0x18');var _0x4755b7=_0x45d377['count'];var _0x143c28=_0x350f4f?0x0:_0x4d677b[_0x0140('0x19')];var _0x572e98=_0x350f4f?_0x45d377[_0x0140('0x1a')]:_0x4d677b[_0x0140('0x19')]+_0x4d677b[_0x0140('0x1b')];var _0x48633d;if(_0x572e98>=_0x4755b7){_0x572e98=_0x4755b7;_0x48633d=0xc8;}else{_0x48633d=0xce;}_0x419548[_0x0140('0x16')](_0x48633d);return _0x419548[_0x0140('0x1c')](_0x0140('0x1d'),_0x143c28+'-'+_0x572e98+'/'+_0x4755b7)[_0x0140('0x17')](_0x45d377);}return null;};}function patchUpdates(_0x3ed80a){return function(_0x194e7d){try{jsonpatch['apply'](_0x194e7d,_0x3ed80a,!![]);}catch(_0x5e06a3){return BPromise[_0x0140('0x1e')](_0x5e06a3);}return _0x194e7d['save']();};}function saveUpdates(_0x1edef2,_0x39a459){return function(_0x1fa82f){if(_0x1fa82f){return _0x1fa82f['update'](_0x1edef2)['then'](function(_0x5b9122){return _0x5b9122;});}return null;};}function removeEntity(_0x517cec,_0x46a2d0){return function(_0x5d29ca){if(_0x5d29ca){return _0x5d29ca[_0x0140('0x1f')]()[_0x0140('0x20')](function(){_0x517cec[_0x0140('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393437,_0x1b7e1d){return function(_0x3344d1){if(!_0x3344d1){_0x393437[_0x0140('0x15')](0x194);}return _0x3344d1;};}function handleError(_0x264f41,_0xf8dc6){_0xf8dc6=_0xf8dc6||0x1f4;return function(_0x45a133){logger[_0x0140('0x21')](_0x45a133[_0x0140('0x22')]);if(_0x45a133['name']){delete _0x45a133[_0x0140('0x23')];}_0x264f41[_0x0140('0x16')](_0xf8dc6)[_0x0140('0x24')](_0x45a133);};}exports[_0x0140('0x25')]=function(_0x57b1b2,_0x1eac7b){var _0x41cab0={},_0x4b6692={},_0x2d4063={'count':0x0,'rows':[]};var _0x2b99f6=_['map'](db[_0x0140('0x26')]['rawAttributes'],function(_0x503012){return{'name':_0x503012[_0x0140('0x27')],'type':_0x503012[_0x0140('0x28')][_0x0140('0x29')]};});_0x4b6692[_0x0140('0x2a')]=_[_0x0140('0x2b')](_[_0x0140('0x2c')](_0x2b99f6,_0x0140('0x23')),[_0x0140('0x23')]);_0x4b6692[_0x0140('0x2d')]=_[_0x0140('0x2e')](_0x57b1b2[_0x0140('0x2d')]);_0x4b6692[_0x0140('0x2f')]=_[_0x0140('0x30')](_0x4b6692[_0x0140('0x2a')],_0x4b6692[_0x0140('0x2d')]);_0x41cab0[_0x0140('0x31')]=_[_0x0140('0x30')](_0x4b6692[_0x0140('0x2a')],qs['fields'](_0x57b1b2[_0x0140('0x2d')][_0x0140('0x32')]));_0x41cab0[_0x0140('0x31')]=_0x41cab0[_0x0140('0x31')][_0x0140('0x33')]?_0x41cab0[_0x0140('0x31')]:_0x4b6692[_0x0140('0x2a')];if(!_0x57b1b2[_0x0140('0x2d')][_0x0140('0x34')](_0x0140('0x35'))){_0x41cab0[_0x0140('0x1b')]=qs[_0x0140('0x1b')](_0x57b1b2[_0x0140('0x2d')]['limit']);_0x41cab0[_0x0140('0x19')]=qs[_0x0140('0x19')](_0x57b1b2[_0x0140('0x2d')][_0x0140('0x19')]);}_0x41cab0['order']=qs[_0x0140('0x36')](_0x57b1b2[_0x0140('0x2d')][_0x0140('0x36')]);_0x41cab0[_0x0140('0x37')]=qs['filters'](_['pick'](_0x57b1b2['query'],_0x4b6692['filters']),_0x2b99f6);if(_0x57b1b2[_0x0140('0x2d')][_0x0140('0x38')]){_0x41cab0['where']=_['merge'](_0x41cab0[_0x0140('0x37')],{'$or':_['map'](_0x2b99f6,function(_0x42b4e7){if(_0x42b4e7[_0x0140('0x28')]!==_0x0140('0x39')){var _0xc5d7ca={};_0xc5d7ca[_0x42b4e7[_0x0140('0x23')]]={'$like':'%'+_0x57b1b2[_0x0140('0x2d')][_0x0140('0x38')]+'%'};return _0xc5d7ca;}})});}_0x41cab0=_[_0x0140('0x3a')]({},_0x41cab0,_0x57b1b2[_0x0140('0x3b')]);var _0x211d1f={'where':_0x41cab0['where']};return db[_0x0140('0x26')]['count'](_0x211d1f)[_0x0140('0x20')](function(_0x55881e){_0x2d4063[_0x0140('0x1a')]=_0x55881e;if(_0x57b1b2[_0x0140('0x2d')][_0x0140('0x3c')]){_0x41cab0[_0x0140('0x3d')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x41cab0);})['then'](function(_0x3f8d01){_0x2d4063[_0x0140('0x3e')]=_0x3f8d01;return _0x2d4063;})[_0x0140('0x20')](respondWithFilteredResult(_0x1eac7b,_0x41cab0))[_0x0140('0x3f')](handleError(_0x1eac7b,null));};exports[_0x0140('0x40')]=function(_0x5957b1,_0x15a142){var _0xddfcb0={'raw':!![],'where':{'id':_0x5957b1[_0x0140('0x41')]['id']}},_0x3ec88d={};_0x3ec88d[_0x0140('0x2a')]=_[_0x0140('0x2e')](db['CmCustomField'][_0x0140('0x42')]);_0x3ec88d['query']=_[_0x0140('0x2e')](_0x5957b1['query']);_0x3ec88d['filters']=_[_0x0140('0x30')](_0x3ec88d['model'],_0x3ec88d[_0x0140('0x2d')]);_0xddfcb0[_0x0140('0x31')]=_[_0x0140('0x30')](_0x3ec88d['model'],qs[_0x0140('0x32')](_0x5957b1[_0x0140('0x2d')]['fields']));_0xddfcb0[_0x0140('0x31')]=_0xddfcb0[_0x0140('0x31')]['length']?_0xddfcb0[_0x0140('0x31')]:_0x3ec88d['model'];if(_0x5957b1[_0x0140('0x2d')][_0x0140('0x3c')]){_0xddfcb0['include']=[{'all':!![]}];}_0xddfcb0=_[_0x0140('0x3a')]({},_0xddfcb0,_0x5957b1[_0x0140('0x3b')]);return db[_0x0140('0x26')][_0x0140('0x43')](_0xddfcb0)[_0x0140('0x20')](handleEntityNotFound(_0x15a142,null))[_0x0140('0x20')](respondWithResult(_0x15a142,null))[_0x0140('0x3f')](handleError(_0x15a142,null));};exports[_0x0140('0x44')]=function(_0x52c64f,_0x1f38db){if(_0x52c64f[_0x0140('0x45')]['id']){delete _0x52c64f[_0x0140('0x45')]['id'];}return db['CmCustomField'][_0x0140('0x43')]({'where':{'id':_0x52c64f[_0x0140('0x41')]['id']}})[_0x0140('0x20')](handleEntityNotFound(_0x1f38db,null))['then'](saveUpdates(_0x52c64f[_0x0140('0x45')],null))[_0x0140('0x20')](respondWithResult(_0x1f38db,null))[_0x0140('0x3f')](handleError(_0x1f38db,null));};exports[_0x0140('0x1f')]=function(_0x57fdce,_0x4005a2){return db[_0x0140('0x26')][_0x0140('0x43')]({'where':{'id':_0x57fdce[_0x0140('0x41')]['id']}})['then'](handleEntityNotFound(_0x4005a2,null))[_0x0140('0x20')](removeEntity(_0x4005a2,null))[_0x0140('0x3f')](handleError(_0x4005a2,null));};exports[_0x0140('0x46')]=function(_0x24a825,_0xb80394){var _0x1ecfd1;return db['sequelize']['transaction'](function(_0xcbf84e){return db[_0x0140('0x26')][_0x0140('0x46')](_0x24a825[_0x0140('0x45')],{'transaction':_0xcbf84e})[_0x0140('0x20')](function(_0x3399b6){_0x1ecfd1=_0x3399b6;var _0x3f837c={'type':db[_0x0140('0x47')]['TEXT'],'transaction':_0xcbf84e};switch(_0x24a825['body'][_0x0140('0x28')]){case _0x0140('0x48'):_0x3f837c['type']=db[_0x0140('0x47')]['TEXT'];break;case'number':_0x3f837c[_0x0140('0x28')]=db[_0x0140('0x47')][_0x0140('0x49')];break;case'switch':_0x3f837c[_0x0140('0x28')]=db[_0x0140('0x47')][_0x0140('0x4a')];_0x3f837c[_0x0140('0x4b')]=![];break;default:}return db['sequelize'][_0x0140('0x4c')][_0x0140('0x4d')](_0x0140('0x4e'),util[_0x0140('0x4f')]('cf_%d',_0x1ecfd1['id']),_0x3f837c);})['then'](function(){return _0x1ecfd1;});})[_0x0140('0x20')](respondWithResult(_0xb80394,0xc9))[_0x0140('0x3f')](handleError(_0xb80394,null));}; \ No newline at end of file +var _0x7c16=['includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','destroy','then','error','name','index','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL'];(function(_0x5df049,_0x260c2a){var _0x4886e2=function(_0x346d66){while(--_0x346d66){_0x5df049['push'](_0x5df049['shift']());}};_0x4886e2(++_0x260c2a);}(_0x7c16,0x16a));var _0x67c1=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0x7c16[_0x239b5e];return _0x577f3d;};'use strict';var emlformat=require(_0x67c1('0x0'));var rimraf=require(_0x67c1('0x1'));var zipdir=require(_0x67c1('0x2'));var jsonpatch=require(_0x67c1('0x3'));var rp=require(_0x67c1('0x4'));var moment=require(_0x67c1('0x5'));var BPromise=require(_0x67c1('0x6'));var Mustache=require('mustache');var util=require(_0x67c1('0x7'));var path=require('path');var sox=require(_0x67c1('0x8'));var csv=require(_0x67c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67c1('0xa'));var _=require(_0x67c1('0xb'));var squel=require('squel');var crypto=require(_0x67c1('0xc'));var jsforce=require(_0x67c1('0xd'));var deskjs=require(_0x67c1('0xe'));var toCsv=require(_0x67c1('0x9'));var querystring=require(_0x67c1('0xf'));var Papa=require(_0x67c1('0x10'));var Redis=require(_0x67c1('0x11'));var authService=require(_0x67c1('0x12'));var qs=require(_0x67c1('0x13'));var as=require(_0x67c1('0x14'));var hardwareService=require(_0x67c1('0x15'));var logger=require(_0x67c1('0x16'))('api');var utils=require(_0x67c1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x67c1('0x18'));var db=require(_0x67c1('0x19'))['db'];function respondWithStatusCode(_0x3fe670,_0x11d634){_0x11d634=_0x11d634||0xcc;return function(_0x100383){if(_0x100383){return _0x3fe670[_0x67c1('0x1a')](_0x11d634);}return _0x3fe670[_0x67c1('0x1b')](_0x11d634)[_0x67c1('0x1c')]();};}function respondWithResult(_0x15c70f,_0x41ce5c){_0x41ce5c=_0x41ce5c||0xc8;return function(_0x4627b4){if(_0x4627b4){return _0x15c70f[_0x67c1('0x1b')](_0x41ce5c)[_0x67c1('0x1d')](_0x4627b4);}};}function respondWithFilteredResult(_0x4fa62b,_0x5a9326){return function(_0xcfcf59){if(_0xcfcf59){var _0x2afceb=typeof _0x5a9326[_0x67c1('0x1e')]==='undefined'&&typeof _0x5a9326[_0x67c1('0x1f')]==='undefined';var _0x16bd68=_0xcfcf59['count'];var _0x2420c9=_0x2afceb?0x0:_0x5a9326['offset'];var _0x1a47d5=_0x2afceb?_0xcfcf59[_0x67c1('0x20')]:_0x5a9326[_0x67c1('0x1e')]+_0x5a9326[_0x67c1('0x1f')];var _0x2745ba;if(_0x1a47d5>=_0x16bd68){_0x1a47d5=_0x16bd68;_0x2745ba=0xc8;}else{_0x2745ba=0xce;}_0x4fa62b[_0x67c1('0x1b')](_0x2745ba);return _0x4fa62b[_0x67c1('0x21')]('Content-Range',_0x2420c9+'-'+_0x1a47d5+'/'+_0x16bd68)[_0x67c1('0x1d')](_0xcfcf59);}return null;};}function patchUpdates(_0x47b553){return function(_0x13c60e){try{jsonpatch[_0x67c1('0x22')](_0x13c60e,_0x47b553,!![]);}catch(_0x1993df){return BPromise['reject'](_0x1993df);}return _0x13c60e[_0x67c1('0x23')]();};}function saveUpdates(_0x1fe40e,_0x326253){return function(_0x118c98){if(_0x118c98){return _0x118c98[_0x67c1('0x24')](_0x1fe40e)['then'](function(_0x16c000){return _0x16c000;});}return null;};}function removeEntity(_0x270ade,_0x14d654){return function(_0xe5ab73){if(_0xe5ab73){return _0xe5ab73[_0x67c1('0x25')]()[_0x67c1('0x26')](function(){_0x270ade[_0x67c1('0x1b')](0xcc)[_0x67c1('0x1c')]();});}};}function handleEntityNotFound(_0x5b051e,_0x3846c1){return function(_0x2143d5){if(!_0x2143d5){_0x5b051e[_0x67c1('0x1a')](0x194);}return _0x2143d5;};}function handleError(_0x34aad4,_0x2180c9){_0x2180c9=_0x2180c9||0x1f4;return function(_0x46572e){logger[_0x67c1('0x27')](_0x46572e['stack']);if(_0x46572e[_0x67c1('0x28')]){delete _0x46572e[_0x67c1('0x28')];}_0x34aad4['status'](_0x2180c9)['send'](_0x46572e);};}exports[_0x67c1('0x29')]=function(_0x41818d,_0x210b26){var _0x21df18={},_0x28b453={},_0x577ca5={'count':0x0,'rows':[]};var _0x38c63c=_['map'](db[_0x67c1('0x2a')][_0x67c1('0x2b')],function(_0x253d31){return{'name':_0x253d31[_0x67c1('0x2c')],'type':_0x253d31['type'][_0x67c1('0x2d')]};});_0x28b453[_0x67c1('0x2e')]=_[_0x67c1('0x2f')](_['map'](_0x38c63c,_0x67c1('0x28')),[_0x67c1('0x28')]);_0x28b453['query']=_[_0x67c1('0x30')](_0x41818d[_0x67c1('0x31')]);_0x28b453[_0x67c1('0x32')]=_[_0x67c1('0x33')](_0x28b453['model'],_0x28b453[_0x67c1('0x31')]);_0x21df18['attributes']=_[_0x67c1('0x33')](_0x28b453[_0x67c1('0x2e')],qs[_0x67c1('0x34')](_0x41818d[_0x67c1('0x31')][_0x67c1('0x34')]));_0x21df18[_0x67c1('0x35')]=_0x21df18['attributes'][_0x67c1('0x36')]?_0x21df18[_0x67c1('0x35')]:_0x28b453[_0x67c1('0x2e')];if(!_0x41818d[_0x67c1('0x31')][_0x67c1('0x37')](_0x67c1('0x38'))){_0x21df18[_0x67c1('0x1f')]=qs[_0x67c1('0x1f')](_0x41818d[_0x67c1('0x31')]['limit']);_0x21df18[_0x67c1('0x1e')]=qs[_0x67c1('0x1e')](_0x41818d['query'][_0x67c1('0x1e')]);}_0x21df18['order']=qs['sort'](_0x41818d[_0x67c1('0x31')][_0x67c1('0x39')]);_0x21df18[_0x67c1('0x3a')]=qs[_0x67c1('0x32')](_['pick'](_0x41818d[_0x67c1('0x31')],_0x28b453['filters']),_0x38c63c);if(_0x41818d[_0x67c1('0x31')][_0x67c1('0x3b')]){_0x21df18[_0x67c1('0x3a')]=_[_0x67c1('0x3c')](_0x21df18[_0x67c1('0x3a')],{'$or':_['map'](_0x38c63c,function(_0x4625e6){if(_0x4625e6[_0x67c1('0x3d')]!==_0x67c1('0x3e')){var _0x173a5f={};_0x173a5f[_0x4625e6[_0x67c1('0x28')]]={'$like':'%'+_0x41818d[_0x67c1('0x31')]['filter']+'%'};return _0x173a5f;}})});}_0x21df18=_[_0x67c1('0x3c')]({},_0x21df18,_0x41818d['options']);var _0xde3bf={'where':_0x21df18['where']};return db[_0x67c1('0x2a')]['count'](_0xde3bf)[_0x67c1('0x26')](function(_0x5d7c20){_0x577ca5[_0x67c1('0x20')]=_0x5d7c20;if(_0x41818d[_0x67c1('0x31')][_0x67c1('0x3f')]){_0x21df18[_0x67c1('0x40')]=[{'all':!![]}];}return db[_0x67c1('0x2a')][_0x67c1('0x41')](_0x21df18);})[_0x67c1('0x26')](function(_0x104584){_0x577ca5[_0x67c1('0x42')]=_0x104584;return _0x577ca5;})[_0x67c1('0x26')](respondWithFilteredResult(_0x210b26,_0x21df18))[_0x67c1('0x43')](handleError(_0x210b26,null));};exports[_0x67c1('0x44')]=function(_0x20d224,_0x50ed79){var _0x34297f={'raw':!![],'where':{'id':_0x20d224['params']['id']}},_0x39f1ec={};_0x39f1ec[_0x67c1('0x2e')]=_[_0x67c1('0x30')](db[_0x67c1('0x2a')][_0x67c1('0x2b')]);_0x39f1ec[_0x67c1('0x31')]=_[_0x67c1('0x30')](_0x20d224[_0x67c1('0x31')]);_0x39f1ec[_0x67c1('0x32')]=_['intersection'](_0x39f1ec[_0x67c1('0x2e')],_0x39f1ec['query']);_0x34297f[_0x67c1('0x35')]=_[_0x67c1('0x33')](_0x39f1ec['model'],qs['fields'](_0x20d224['query'][_0x67c1('0x34')]));_0x34297f[_0x67c1('0x35')]=_0x34297f[_0x67c1('0x35')][_0x67c1('0x36')]?_0x34297f[_0x67c1('0x35')]:_0x39f1ec[_0x67c1('0x2e')];if(_0x20d224[_0x67c1('0x31')][_0x67c1('0x3f')]){_0x34297f[_0x67c1('0x40')]=[{'all':!![]}];}_0x34297f=_[_0x67c1('0x3c')]({},_0x34297f,_0x20d224['options']);return db[_0x67c1('0x2a')][_0x67c1('0x45')](_0x34297f)[_0x67c1('0x26')](handleEntityNotFound(_0x50ed79,null))['then'](respondWithResult(_0x50ed79,null))[_0x67c1('0x43')](handleError(_0x50ed79,null));};exports['update']=function(_0x2e6dfb,_0x35a487){if(_0x2e6dfb[_0x67c1('0x46')]['id']){delete _0x2e6dfb[_0x67c1('0x46')]['id'];}return db[_0x67c1('0x2a')][_0x67c1('0x45')]({'where':{'id':_0x2e6dfb[_0x67c1('0x47')]['id']}})[_0x67c1('0x26')](handleEntityNotFound(_0x35a487,null))[_0x67c1('0x26')](saveUpdates(_0x2e6dfb[_0x67c1('0x46')],null))[_0x67c1('0x26')](respondWithResult(_0x35a487,null))[_0x67c1('0x43')](handleError(_0x35a487,null));};exports['destroy']=function(_0x265b4a,_0x8be1be){return db[_0x67c1('0x2a')]['find']({'where':{'id':_0x265b4a['params']['id']}})['then'](handleEntityNotFound(_0x8be1be,null))[_0x67c1('0x26')](removeEntity(_0x8be1be,null))[_0x67c1('0x43')](handleError(_0x8be1be,null));};exports[_0x67c1('0x48')]=function(_0x349489,_0x17ed3d){var _0x5204ce;return db[_0x67c1('0x49')][_0x67c1('0x4a')](function(_0x455b08){return db[_0x67c1('0x2a')][_0x67c1('0x48')](_0x349489[_0x67c1('0x46')],{'transaction':_0x455b08})[_0x67c1('0x26')](function(_0x522bf3){_0x5204ce=_0x522bf3;var _0x21fefc={'type':db[_0x67c1('0x4b')][_0x67c1('0x4c')],'transaction':_0x455b08};switch(_0x349489[_0x67c1('0x46')]['type']){case _0x67c1('0x4d'):_0x21fefc['type']=db[_0x67c1('0x4b')][_0x67c1('0x4c')];break;case _0x67c1('0x4e'):_0x21fefc[_0x67c1('0x3d')]=db[_0x67c1('0x4b')][_0x67c1('0x4f')];break;case _0x67c1('0x50'):_0x21fefc['type']=db[_0x67c1('0x4b')][_0x67c1('0x51')];_0x21fefc[_0x67c1('0x52')]=![];break;default:}return db['sequelize']['queryInterface'][_0x67c1('0x53')](_0x67c1('0x54'),util['format']('cf_%d',_0x5204ce['id']),_0x21fefc);})[_0x67c1('0x26')](function(){return _0x5204ce;});})['then'](respondWithResult(_0x17ed3d,0xc9))[_0x67c1('0x43')](handleError(_0x17ed3d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8bd71cd..0e9524a 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 _0xc786=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCustomField','util','api'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0xc786,0x80));var _0x6c78=function(_0x230668,_0x392bbf){_0x230668=_0x230668-0x0;var _0x51fbd9=_0xc786[_0x230668];return _0x51fbd9;};'use strict';var _=require('lodash');var util=require(_0x6c78('0x0'));var logger=require('../../config/logger')(_0x6c78('0x1'));var moment=require(_0x6c78('0x2'));var BPromise=require(_0x6c78('0x3'));var rp=require(_0x6c78('0x4'));var fs=require('fs');var path=require(_0x6c78('0x5'));var rimraf=require(_0x6c78('0x6'));var config=require(_0x6c78('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x6c78('0x8')]=function(_0x24b255,_0x4bc782){return _0x24b255['define'](_0x6c78('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2cf=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x28407f,_0x432338){var _0x3f3976=function(_0x340734){while(--_0x340734){_0x28407f['push'](_0x28407f['shift']());}};_0x3f3976(++_0x432338);}(_0xb2cf,0xc5));var _0xfb2c=function(_0x493296,_0xd40695){_0x493296=_0x493296-0x0;var _0x1ecb27=_0xb2cf[_0x493296];return _0x1ecb27;};'use strict';var _=require(_0xfb2c('0x0'));var util=require(_0xfb2c('0x1'));var logger=require(_0xfb2c('0x2'))('api');var moment=require(_0xfb2c('0x3'));var BPromise=require(_0xfb2c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb2c('0x5'));var rimraf=require(_0xfb2c('0x6'));var config=require(_0xfb2c('0x7'));var attributes=require(_0xfb2c('0x8'));module[_0xfb2c('0x9')]=function(_0x453189,_0x3e4975){return _0x453189[_0xfb2c('0xa')](_0xfb2c('0xb'),attributes,{'tableName':_0xfb2c('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 958e839..28b6edf 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 _0xf3ad=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x1b0a23,_0xe0a7e){var _0x382e02=function(_0x2cc774){while(--_0x2cc774){_0x1b0a23['push'](_0x1b0a23['shift']());}};_0x382e02(++_0xe0a7e);}(_0xf3ad,0xee));var _0xdf3a=function(_0x5a4f20,_0x2d2a5a){_0x5a4f20=_0x5a4f20-0x0;var _0xe7f057=_0xf3ad[_0x5a4f20];return _0xe7f057;};'use strict';var _=require(_0xdf3a('0x0'));var util=require(_0xdf3a('0x1'));var moment=require(_0xdf3a('0x2'));var BPromise=require(_0xdf3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3a('0x5'));var logger=require(_0xdf3a('0x6'))(_0xdf3a('0x7'));var config=require(_0xdf3a('0x8'));var jayson=require(_0xdf3a('0x9'));var client=jayson[_0xdf3a('0xa')][_0xdf3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a6414,_0x4b9f73,_0x224ee7){return new BPromise(function(_0x56abce,_0x310745){return client[_0xdf3a('0xc')](_0x1a6414,_0x224ee7)['then'](function(_0xd55057){logger['info'](_0xdf3a('0xd'),_0x4b9f73,_0xdf3a('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4b9f73,'request\x20sent',JSON[_0xdf3a('0xf')](_0xd55057));if(_0xd55057[_0xdf3a('0x10')]){if(_0xd55057[_0xdf3a('0x10')][_0xdf3a('0x11')]===0x1f4){logger[_0xdf3a('0x10')](_0xdf3a('0xd'),_0x4b9f73,_0xd55057[_0xdf3a('0x10')][_0xdf3a('0x12')]);return _0x310745(_0xd55057[_0xdf3a('0x10')][_0xdf3a('0x12')]);}logger[_0xdf3a('0x10')](_0xdf3a('0xd'),_0x4b9f73,_0xd55057[_0xdf3a('0x10')]['message']);return _0x56abce(_0xd55057[_0xdf3a('0x10')][_0xdf3a('0x12')]);}else{logger[_0xdf3a('0x13')](_0xdf3a('0xd'),_0x4b9f73,_0xdf3a('0xe'));_0x56abce(_0xd55057[_0xdf3a('0x14')][_0xdf3a('0x12')]);}})[_0xdf3a('0x15')](function(_0x4a800f){logger[_0xdf3a('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4b9f73,_0x4a800f);_0x310745(_0x4a800f);});});} \ No newline at end of file +var _0xcbed=['../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x8864dd,_0x120434){var _0x4c1074=function(_0x5c6bc7){while(--_0x5c6bc7){_0x8864dd['push'](_0x8864dd['shift']());}};_0x4c1074(++_0x120434);}(_0xcbed,0xf4));var _0xdcbe=function(_0x59ef33,_0x25bf7d){_0x59ef33=_0x59ef33-0x0;var _0x22e5a0=_0xcbed[_0x59ef33];return _0x22e5a0;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var moment=require('moment');var BPromise=require(_0xdcbe('0x2'));var rs=require(_0xdcbe('0x3'));var fs=require('fs');var Redis=require(_0xdcbe('0x4'));var db=require(_0xdcbe('0x5'))['db'];var utils=require(_0xdcbe('0x6'));var logger=require(_0xdcbe('0x7'))('rpc');var config=require(_0xdcbe('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdcbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x415baa,_0x432903,_0x55b97a){return new BPromise(function(_0x4f5a5f,_0x1d0c14){return client[_0xdcbe('0xa')](_0x415baa,_0x55b97a)[_0xdcbe('0xb')](function(_0x5509d7){logger[_0xdcbe('0xc')](_0xdcbe('0xd'),_0x432903,_0xdcbe('0xe'));logger['debug'](_0xdcbe('0xf'),_0x432903,_0xdcbe('0xe'),JSON[_0xdcbe('0x10')](_0x5509d7));if(_0x5509d7[_0xdcbe('0x11')]){if(_0x5509d7[_0xdcbe('0x11')][_0xdcbe('0x12')]===0x1f4){logger[_0xdcbe('0x11')]('CmCustomField,\x20%s,\x20%s',_0x432903,_0x5509d7[_0xdcbe('0x11')][_0xdcbe('0x13')]);return _0x1d0c14(_0x5509d7[_0xdcbe('0x11')]['message']);}logger[_0xdcbe('0x11')](_0xdcbe('0xd'),_0x432903,_0x5509d7['error'][_0xdcbe('0x13')]);return _0x4f5a5f(_0x5509d7[_0xdcbe('0x11')]['message']);}else{logger[_0xdcbe('0xc')]('CmCustomField,\x20%s,\x20%s',_0x432903,'request\x20sent');_0x4f5a5f(_0x5509d7['result'][_0xdcbe('0x13')]);}})[_0xdcbe('0x14')](function(_0x94367c){logger['error'](_0xdcbe('0xd'),_0x432903,_0x94367c);_0x1d0c14(_0x94367c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 54c9198..39183bf 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 _0x635c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports','util'];(function(_0x1af6cf,_0x4aaef5){var _0x5b2f29=function(_0x3344d1){while(--_0x3344d1){_0x1af6cf['push'](_0x1af6cf['shift']());}};_0x5b2f29(++_0x4aaef5);}(_0x635c,0xa1));var _0xc635=function(_0x42af89,_0x1bcbe9){_0x42af89=_0x42af89-0x0;var _0xf54f3=_0x635c[_0x42af89];return _0xf54f3;};'use strict';var multer=require('multer');var util=require(_0xc635('0x0'));var path=require(_0xc635('0x1'));var timeout=require(_0xc635('0x2'));var express=require(_0xc635('0x3'));var router=express['Router']();var fs_extra=require(_0xc635('0x4'));var auth=require(_0xc635('0x5'));var interaction=require(_0xc635('0x6'));var config=require(_0xc635('0x7'));var controller=require(_0xc635('0x8'));router[_0xc635('0x9')]('/',auth[_0xc635('0xa')](),controller['index']);router[_0xc635('0x9')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller['show']);router[_0xc635('0xc')]('/',auth[_0xc635('0xa')](),controller[_0xc635('0xd')]);router[_0xc635('0xe')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller[_0xc635('0xf')]);router[_0xc635('0x10')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller['destroy']);module[_0xc635('0x11')]=router; \ No newline at end of file +var _0xe008=['./cmCustomField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xe008,0x14f));var _0x8e00=function(_0x14741f,_0xe07cd1){_0x14741f=_0x14741f-0x0;var _0x105ca4=_0xe008[_0x14741f];return _0x105ca4;};'use strict';var multer=require('multer');var util=require(_0x8e00('0x0'));var path=require(_0x8e00('0x1'));var timeout=require(_0x8e00('0x2'));var express=require(_0x8e00('0x3'));var router=express[_0x8e00('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e00('0x5'));var interaction=require(_0x8e00('0x6'));var config=require('../../config/environment');var controller=require(_0x8e00('0x7'));router[_0x8e00('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e00('0x9')]);router[_0x8e00('0x8')](_0x8e00('0xa'),auth[_0x8e00('0xb')](),controller[_0x8e00('0xc')]);router['post']('/',auth[_0x8e00('0xb')](),controller[_0x8e00('0xd')]);router[_0x8e00('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8e00('0xf')]);router[_0x8e00('0x10')]('/:id',auth[_0x8e00('0xb')](),controller['destroy']);module[_0x8e00('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f93b498..dbeca1e 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 _0xf418=['INTEGER','BOOLEAN','contactListQueue','moment','exports','STRING','DATE','format'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf418,0x6b));var _0x8f41=function(_0x51517a,_0x5eb51f){_0x51517a=_0x51517a-0x0;var _0x15de83=_0xf418[_0x51517a];return _0x15de83;};'use strict';var moment=require(_0x8f41('0x0'));var Sequelize=require('sequelize');module[_0x8f41('0x1')]={'phone':{'type':Sequelize[_0x8f41('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8f41('0x3')],'defaultValue':moment()[_0x8f41('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8f41('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f41('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8f41('0x3')]},'priority':{'type':Sequelize[_0x8f41('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8f41('0x5')],'unique':_0x8f41('0x7')},'ListId':{'type':Sequelize[_0x8f41('0x5')],'unique':_0x8f41('0x7')},'UserId':{'type':Sequelize[_0x8f41('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8f41('0x7')},'CampaignId':{'type':Sequelize[_0x8f41('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f41('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x8f41('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3d10=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3d10,0x67));var _0x03d1=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x3d10[_0x5e238b];return _0x389bea;};'use strict';var moment=require(_0x03d1('0x0'));var Sequelize=require(_0x03d1('0x1'));module['exports']={'phone':{'type':Sequelize[_0x03d1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x03d1('0x4')],'defaultValue':moment()[_0x03d1('0x5')](_0x03d1('0x6'))},'countbusyretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x03d1('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x03d1('0x7')],'unique':_0x03d1('0x8')},'ListId':{'type':Sequelize[_0x03d1('0x7')],'unique':_0x03d1('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x03d1('0x7')],'unique':_0x03d1('0x8')},'CampaignId':{'type':Sequelize[_0x03d1('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x03d1('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x03d1('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x03d1('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4967260..21a3ee2 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 _0xb205=['$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','CmHopper','intersection','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','lastName','isNil','calleridname','firstName','finally','end','getPreview','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','Contact','getOpenContacts','getVoiceQueues','outbound','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','undefined','count','set','update','then','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','concat','filters','$and','$or','$gt','$gte'];(function(_0x6f033,_0x44cd29){var _0x44c23e=function(_0x385b5e){while(--_0x385b5e){_0x6f033['push'](_0x6f033['shift']());}};_0x44c23e(++_0x44cd29);}(_0xb205,0xf0));var _0x5b20=function(_0x435f3a,_0x9ebf77){_0x435f3a=_0x435f3a-0x0;var _0x2075fa=_0xb205[_0x435f3a];return _0x2075fa;};'use strict';var moment=require(_0x5b20('0x0'));var _=require(_0x5b20('0x1'));var qs=require(_0x5b20('0x2'));var logger=require(_0x5b20('0x3'))(_0x5b20('0x4'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x37fe91,_0x573200){_0x573200=_0x573200||0xc8;return function(_0x17046a){if(_0x17046a){return _0x37fe91[_0x5b20('0x5')](_0x573200)['json'](_0x17046a);}};}function respondWithFilteredResult(_0x3206cd,_0x29d926){return function(_0x364e48){if(_0x364e48){var _0x5c1ff9=typeof _0x29d926[_0x5b20('0x6')]===_0x5b20('0x7')&&typeof _0x29d926['limit']==='undefined';var _0x2b5b5f=_0x364e48[_0x5b20('0x8')];var _0x36ef1b=_0x5c1ff9?0x0:_0x29d926[_0x5b20('0x6')];var _0xe0246d=_0x5c1ff9?_0x364e48[_0x5b20('0x8')]:_0x29d926[_0x5b20('0x6')]+_0x29d926['limit'];var _0xdec7cd;if(_0xe0246d>=_0x2b5b5f){_0xe0246d=_0x2b5b5f;_0xdec7cd=0xc8;}else{_0xdec7cd=0xce;}_0x3206cd[_0x5b20('0x5')](_0xdec7cd);return _0x3206cd[_0x5b20('0x9')]('Content-Range',_0x36ef1b+'-'+_0xe0246d+'/'+_0x2b5b5f)['json'](_0x364e48);}return null;};}function saveUpdates(_0x2a13ac,_0x374632){return function(_0xf721a0){if(_0xf721a0){return _0xf721a0[_0x5b20('0xa')](_0x2a13ac)[_0x5b20('0xb')](function(_0x4c76d8){return _0x4c76d8;});}return null;};}function handleEntityNotFound(_0x42fbb0,_0x32c2df){return function(_0x180185){if(!_0x180185){_0x42fbb0[_0x5b20('0xc')](0x194);}return _0x180185;};}function handleError(_0x519f9f,_0x5247f9){_0x5247f9=_0x5247f9||0x1f4;return function(_0x25b9ab){logger['error'](_0x25b9ab['stack']);if(_0x25b9ab[_0x5b20('0xd')]){delete _0x25b9ab['name'];}_0x519f9f[_0x5b20('0x5')](_0x5247f9)[_0x5b20('0xe')](_0x25b9ab);};}exports[_0x5b20('0xf')]=function(_0x498986,_0x44ac15){var _0x301c9a={},_0x3e37ef={},_0x43199f={'count':0x0,'rows':[]};var _0x4aca0f=_[_0x5b20('0x10')](db['CmHopper'][_0x5b20('0x11')],function(_0x30da3b){return{'name':_0x30da3b['fieldName'],'type':_0x30da3b[_0x5b20('0x12')][_0x5b20('0x13')]};});_0x3e37ef[_0x5b20('0x14')]=_['map'](_0x4aca0f,_0x5b20('0xd'));_0x3e37ef[_0x5b20('0x15')]=_['keys'](_0x498986[_0x5b20('0x15')]);_0x3e37ef['filters']=_['intersection'](_0x3e37ef[_0x5b20('0x14')],_0x3e37ef['query']);_0x3e37ef['filters']=_[_0x5b20('0x16')](_0x3e37ef[_0x5b20('0x17')],[_0x5b20('0x18'),_0x5b20('0x19'),_0x5b20('0x1a'),_0x5b20('0x1b'),_0x5b20('0x1c'),_0x5b20('0x1d'),'$ne',_0x5b20('0x1e'),_0x5b20('0x1f'),_0x5b20('0x20'),_0x5b20('0x21'),_0x5b20('0x22'),_0x5b20('0x23'),'$like',_0x5b20('0x24'),'$iLike',_0x5b20('0x25'),_0x5b20('0x26'),_0x5b20('0x27'),'$contains','$contained',_0x5b20('0x28')]);_0x301c9a[_0x5b20('0x29')]=_['intersection'](_0x3e37ef['model'],qs[_0x5b20('0x2a')](_0x498986['query'][_0x5b20('0x2a')]));_0x301c9a[_0x5b20('0x29')]=_0x301c9a[_0x5b20('0x29')][_0x5b20('0x2b')]?_0x301c9a['attributes']:_0x3e37ef[_0x5b20('0x14')];if(!_0x498986[_0x5b20('0x15')][_0x5b20('0x2c')](_0x5b20('0x2d'))){_0x301c9a['limit']=qs[_0x5b20('0x2e')](_0x498986[_0x5b20('0x15')][_0x5b20('0x2e')]);_0x301c9a[_0x5b20('0x6')]=qs[_0x5b20('0x6')](_0x498986[_0x5b20('0x15')][_0x5b20('0x6')]);}_0x301c9a[_0x5b20('0x2f')]=qs[_0x5b20('0x30')](_0x498986[_0x5b20('0x15')][_0x5b20('0x30')]);_0x301c9a[_0x5b20('0x31')]=qs[_0x5b20('0x17')](_[_0x5b20('0x32')](_0x498986[_0x5b20('0x15')],_0x3e37ef['filters']),_0x4aca0f);if(_0x498986['query']['filter']){_0x301c9a[_0x5b20('0x31')]=_[_0x5b20('0x33')](_0x301c9a[_0x5b20('0x31')],{'$or':_[_0x5b20('0x10')](_0x4aca0f,function(_0x5d3e95){if(_0x5d3e95['type']!==_0x5b20('0x34')){var _0x1c8ed6={};_0x1c8ed6[_0x5d3e95[_0x5b20('0xd')]]={'$like':'%'+_0x498986[_0x5b20('0x15')][_0x5b20('0x35')]+'%'};return _0x1c8ed6;}})});}_0x301c9a=_[_0x5b20('0x33')]({},_0x301c9a,_0x498986[_0x5b20('0x36')]);var _0x4f117d={'where':_0x301c9a['where']};return db['CmHopper'][_0x5b20('0x8')](_0x4f117d)[_0x5b20('0xb')](function(_0x29c731){_0x43199f[_0x5b20('0x8')]=_0x29c731;if(_0x498986[_0x5b20('0x15')][_0x5b20('0x37')]){_0x301c9a['include']=[{'all':!![]}];}return db['CmHopper'][_0x5b20('0x38')](_0x301c9a);})[_0x5b20('0xb')](function(_0x53abbf){_0x43199f[_0x5b20('0x39')]=_0x53abbf;return _0x43199f;})[_0x5b20('0xb')](respondWithFilteredResult(_0x44ac15,_0x301c9a))[_0x5b20('0x3a')](handleError(_0x44ac15,null));};exports[_0x5b20('0x3b')]=function(_0x368990,_0x1899e1){var _0x1e047b={'raw':!![],'where':{'id':_0x368990[_0x5b20('0x3c')]['id']}},_0x426ad4={};_0x426ad4[_0x5b20('0x14')]=_[_0x5b20('0x3d')](db[_0x5b20('0x3e')]['rawAttributes']);_0x426ad4[_0x5b20('0x15')]=_[_0x5b20('0x3d')](_0x368990[_0x5b20('0x15')]);_0x426ad4[_0x5b20('0x17')]=_[_0x5b20('0x3f')](_0x426ad4[_0x5b20('0x14')],_0x426ad4[_0x5b20('0x15')]);_0x1e047b[_0x5b20('0x29')]=_[_0x5b20('0x3f')](_0x426ad4[_0x5b20('0x14')],qs[_0x5b20('0x2a')](_0x368990[_0x5b20('0x15')][_0x5b20('0x2a')]));_0x1e047b[_0x5b20('0x29')]=_0x1e047b[_0x5b20('0x29')][_0x5b20('0x2b')]?_0x1e047b[_0x5b20('0x29')]:_0x426ad4[_0x5b20('0x14')];if(_0x368990[_0x5b20('0x15')][_0x5b20('0x37')]){_0x1e047b[_0x5b20('0x40')]=[{'all':!![]}];}_0x1e047b=_[_0x5b20('0x33')]({},_0x1e047b,_0x368990[_0x5b20('0x36')]);return db[_0x5b20('0x3e')][_0x5b20('0x41')](_0x1e047b)[_0x5b20('0xb')](handleEntityNotFound(_0x1899e1,null))[_0x5b20('0xb')](respondWithResult(_0x1899e1,null))['catch'](handleError(_0x1899e1,null));};exports[_0x5b20('0x42')]=function(_0x407467,_0x852527){return db[_0x5b20('0x3e')][_0x5b20('0x42')](_0x407467[_0x5b20('0x43')],{})[_0x5b20('0xb')](respondWithResult(_0x852527,0xc9))['catch'](handleError(_0x852527,null));};exports[_0x5b20('0xa')]=function(_0x2c47a6,_0x33c6d9){if(_0x2c47a6[_0x5b20('0x43')]['id']){delete _0x2c47a6[_0x5b20('0x43')]['id'];}return db[_0x5b20('0x3e')][_0x5b20('0x41')]({'where':{'id':_0x2c47a6['params']['id']}})[_0x5b20('0xb')](handleEntityNotFound(_0x33c6d9,null))[_0x5b20('0xb')](saveUpdates(_0x2c47a6['body'],null))[_0x5b20('0xb')](respondWithResult(_0x33c6d9,null))[_0x5b20('0x3a')](handleError(_0x33c6d9,null));};exports['describe']=function(_0x2b726c,_0x365af7){return db[_0x5b20('0x3e')][_0x5b20('0x44')]()[_0x5b20('0xb')](respondWithResult(_0x365af7,null))[_0x5b20('0x3a')](handleError(_0x365af7,null));};exports[_0x5b20('0x45')]=function(_0x36c204,_0x58bd13){var _0xbb6a0b;var _0x1e84ff=_0x36c204[_0x5b20('0x3c')]['id'];return db[_0x5b20('0x3e')][_0x5b20('0x41')]({'where':{'id':_0x36c204[_0x5b20('0x3c')]['id']}})['then'](handleEntityNotFound(_0x58bd13,null))[_0x5b20('0xb')](function(_0x220ff7){if(_0x220ff7){return _0x220ff7['destroy']()[_0x5b20('0xb')](function(_0x48d5f2){return _0x48d5f2;});}})[_0x5b20('0xb')](function(_0x3c224d){_0xbb6a0b=_0x3c224d;if(_0x3c224d){if(_0x3c224d[_0x5b20('0x46')]||_0x3c224d[_0x5b20('0x47')]){return db[_0x3c224d['VoiceQueueId']?_0x5b20('0x48'):_0x5b20('0x49')][_0x5b20('0x41')]({'where':{'id':_0x3c224d[_0x5b20('0x46')]?_0x3c224d[_0x5b20('0x46')]:_0x3c224d[_0x5b20('0x47')]},'attributes':['id',_0x5b20('0xd')],'raw':!![]});}}})['then'](function(_0x55fc94){var _0x2699bf={};if(_0x55fc94){_[_0x5b20('0x33')](_0x2699bf,_[_0x5b20('0x4a')](_0xbb6a0b['dataValues'],[_0x5b20('0x4b'),_0x5b20('0x4c'),'id']));_0x2699bf[_0x5b20('0x4d')]=0x15;_0x2699bf['statedesc']=_0x5b20('0x4e');_0x2699bf[_0x5b20('0x4f')]=_0x55fc94[_0x5b20('0xd')];_0x2699bf['membername']=_0x36c204[_0x5b20('0x50')]['name'];_0x2699bf[_0x5b20('0x51')]=_0x36c204[_0x5b20('0x50')]['id'];_0x2699bf[_0x5b20('0x4e')]=!![];_0x2699bf[_0x5b20('0x52')]=moment()['format'](_0x5b20('0x53'));_0x2699bf['calleridnum']=_0xbb6a0b[_0x5b20('0x54')];_0x2699bf['campaigntype']=_0xbb6a0b['VoiceQueueId']?_0x5b20('0x55'):_0x5b20('0x56');return db[_0x5b20('0x57')][_0x5b20('0x41')]({'where':{'id':_0x2699bf['ContactId']},'attributes':['firstName',_0x5b20('0x58')]})[_0x5b20('0xb')](function(_0x1cca2c){if(!_[_0x5b20('0x59')](_0x58bd13)&&!_[_0x5b20('0x59')](_0x1cca2c['firstName'])){_0x2699bf[_0x5b20('0x5a')]=_0x1cca2c[_0x5b20('0x5b')];if(!_[_0x5b20('0x59')](_0x1cca2c[_0x5b20('0x58')])){_0x2699bf[_0x5b20('0x5a')]+='\x20'+_0x1cca2c[_0x5b20('0x58')];}}})[_0x5b20('0x5c')](function(){return db['CmHopperFinal'][_0x5b20('0x42')](_0x2699bf);});}})[_0x5b20('0xb')](function(_0x2a9ca9){return db['CmHopperAdditionalPhone'][_0x5b20('0x45')]({'where':{'CmHopperId':_0x1e84ff}});})[_0x5b20('0xb')](function(){return _0x58bd13[_0x5b20('0x5')](0xcc)[_0x5b20('0x5d')]();})['catch'](handleError(_0x58bd13,null));};exports[_0x5b20('0x5e')]=function(_0x301a89,_0x404f87){var _0x290ddb=[];return db[_0x5b20('0x57')]['describe']()['then'](function(_0x4d4f17){_0x290ddb=_['keys'](_0x4d4f17);return _0x301a89['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5b20('0x5f')},'attributes':['id',_0x5b20('0x60'),_0x5b20('0x61')],'raw':!![]});})[_0x5b20('0xb')](function(_0x500a58){if(_0x500a58&&_0x500a58['length']){return db[_0x5b20('0x62')][_0x5b20('0x63')](function(_0x2db7a7){var _0xb1a217={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5b20('0x10')](_0x500a58,'id')},'$or':[{'UserId':null},{'UserId':_0x301a89[_0x5b20('0x50')]['id']}]};var _0x42e992={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x500a58)[_0x5b20('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x5b20('0x10')]('id')[_0x5b20('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x301a89['user']['id']}]};var _0xa346dc={'$or':[_0xb1a217,_0x42e992]};var _0x3015dd=[];if(_0x301a89[_0x5b20('0x43')][_0x5b20('0x65')]&&_0x301a89[_0x5b20('0x43')]['direction']===_0x5b20('0x66')){if(!_[_0x5b20('0x67')](_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')])){_0xa346dc['id']={'$in':_0x301a89[_0x5b20('0x43')]['hopperIds']};}_0x3015dd=[[_0x5b20('0x69'),_0x5b20('0x6a')],[_0x5b20('0x6b'),_0x500a58[0x0][_0x5b20('0x60')]===_0x5b20('0x6a')?_0x5b20('0x6c'):_0x5b20('0x6a')],db[_0x5b20('0x62')]['literal'](_0x5b20('0x6d')),['id','DESC']];}else{if(!_['isEmpty'](_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')])){_0xa346dc['id']={'$notIn':_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')]};}_0x3015dd=[[_0x5b20('0x69'),_0x5b20('0x6c')],[_0x5b20('0x6b'),_0x500a58[0x0][_0x5b20('0x60')]],db[_0x5b20('0x62')][_0x5b20('0x6e')](_0x5b20('0x6f')),['id','ASC']];}return db[_0x5b20('0x3e')]['findOne']({'attributes':['id',_0x5b20('0x70'),_0x5b20('0x54'),_0x5b20('0x71')],'where':_0xa346dc,'order':_0x3015dd,'transaction':_0x2db7a7,'lock':_0x2db7a7[_0x5b20('0x72')][_0x5b20('0x73')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x290ddb,'include':[{'model':db[_0x5b20('0x74')],'as':_0x5b20('0x75'),'attributes':['id',_0x5b20('0xd')]}]},{'model':db[_0x5b20('0x76')],'as':_0x5b20('0x77'),'attributes':['id',_0x5b20('0xd')]},{'model':db[_0x5b20('0x48')],'as':_0x5b20('0x78'),'attributes':['id','name',_0x5b20('0x79')]}]})['then'](function(_0x24e77c){if(_0x24e77c){return _0x24e77c[_0x5b20('0xa')]({'UserId':_0x301a89['user']['id']},{'transaction':_0x2db7a7});}});});}})[_0x5b20('0xb')](handleEntityNotFound(_0x404f87,null))[_0x5b20('0xb')](respondWithResult(_0x404f87,null))[_0x5b20('0x3a')](handleError(_0x404f87,null));};exports[_0x5b20('0x7a')]=function(_0x360ec6,_0xaf8013,_0x2cc4b4){var _0x504968=[];var _0x279c1d=_0x360ec6['params']['id'];var _0x52fccc=_0x360ec6[_0x5b20('0x50')]['id'];return db[_0x5b20('0x57')]['describe']()[_0x5b20('0xb')](function(_0x19bc2f){_0x504968=_['keys'](_0x19bc2f);return db[_0x5b20('0x62')][_0x5b20('0x63')](function(_0x371f63){const _0xf00341={'id':_0x279c1d};return db[_0x5b20('0x3e')]['findOne']({'attributes':['id','scheduledat',_0x5b20('0x71')],'where':_0xf00341,'transaction':_0x371f63,'lock':_0x371f63[_0x5b20('0x72')][_0x5b20('0x73')],'include':[{'model':db[_0x5b20('0x57')],'as':_0x5b20('0x7b'),'attributes':_0x504968,'include':[{'model':db['CmCompany'],'as':_0x5b20('0x75'),'attributes':['id',_0x5b20('0xd')]}]},{'model':db[_0x5b20('0x76')],'as':_0x5b20('0x77'),'attributes':['id',_0x5b20('0xd')]},{'model':db[_0x5b20('0x48')],'as':_0x5b20('0x78'),'attributes':['id',_0x5b20('0xd'),_0x5b20('0x79')]}]})['then'](function(_0x2abfc5){if(_0x2abfc5){return _0x2abfc5[_0x5b20('0xa')]({'UserId':_0x52fccc},{'transaction':_0x371f63});}});});})[_0x5b20('0xb')](handleEntityNotFound(_0xaf8013,null))['then'](respondWithResult(_0xaf8013,null))['catch'](handleError(_0xaf8013,null));};exports[_0x5b20('0x7c')]=function(_0xfc7f55,_0x32c823){return _0xfc7f55[_0x5b20('0x50')][_0x5b20('0x7d')]({'where':{'type':_0x5b20('0x7e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x5b20('0xb')](function(_0x1b70c4){if(_0x1b70c4&&_0x1b70c4['length']){return db[_0x5b20('0x3e')][_0x5b20('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5b20('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x1b70c4,'id')},'$or':[{'UserId':null},{'UserId':_0xfc7f55[_0x5b20('0x50')]['id']}]}});}return 0x0;})[_0x5b20('0xb')](function(_0x26b93a){if(!_['isNil'](_0x26b93a)&&_[_0x5b20('0x7f')](_0x26b93a)){return _0x32c823[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')]({'contacts':_0x26b93a});}else{logger['error'](_0x5b20('0x81'),_0x5b20('0x7c'),0x194,_0x5b20('0x82'));_0x32c823[_0x5b20('0xc')](0x194);}})['catch'](handleError(_0x32c823,null));};exports['getTimezones']=function(_0x214a96,_0x210584){var _0x54d54f=shared[_0x5b20('0x83')];var _0x5f541d=[];_[_0x5b20('0x10')](_0x54d54f,function(_0x129b81){_0x5f541d[_0x5b20('0x84')]({'id':_0x129b81[_0x5b20('0xd')],'name':_0x129b81[_0x5b20('0xd')],'utcOffset':_0x129b81[_0x5b20('0x85')]});});return _0x210584[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')]({'tz':_0x5f541d});};exports['getTimezone']=function(_0x5438ca,_0xa18191){var _0x205e5e=shared[_0x5b20('0x83')];var _0x41a5d0={};if(!_['isNil'](_0x205e5e[_0x5438ca[_0x5b20('0x43')]['id']]))_0x41a5d0=_0x205e5e[_0x5438ca[_0x5b20('0x43')]['id']];return _0xa18191[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')](_0x41a5d0);}; \ No newline at end of file +var _0x8ef6=['error','stack','name','send','map','CmHopper','fieldName','type','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$in','$notIn','$like','$notLike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','order','sort','pick','filter','merge','where','options','then','includeAll','include','rows','catch','show','params','rawAttributes','create','body','describe','destroy','find','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','findOne','LOCK','UPDATE','getOpenContacts','preview','isNumber','entity\x20not\x20found','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','update','sendStatus'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x8ef6,0xf2));var _0x68ef=function(_0x25310e,_0x505198){_0x25310e=_0x25310e-0x0;var _0x2f7837=_0x8ef6[_0x25310e];return _0x2f7837;};'use strict';var moment=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var qs=require(_0x68ef('0x2'));var logger=require(_0x68ef('0x3'))(_0x68ef('0x4'));var shared=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];function respondWithResult(_0x4a72b8,_0x27d0af){_0x27d0af=_0x27d0af||0xc8;return function(_0x129ce){if(_0x129ce){return _0x4a72b8[_0x68ef('0x7')](_0x27d0af)[_0x68ef('0x8')](_0x129ce);}};}function respondWithFilteredResult(_0x4d26e3,_0x4f77f3){return function(_0x3c2ff3){if(_0x3c2ff3){var _0x4740e8=typeof _0x4f77f3[_0x68ef('0x9')]==='undefined'&&typeof _0x4f77f3[_0x68ef('0xa')]===_0x68ef('0xb');var _0x1bee73=_0x3c2ff3[_0x68ef('0xc')];var _0x112b18=_0x4740e8?0x0:_0x4f77f3[_0x68ef('0x9')];var _0x304a60=_0x4740e8?_0x3c2ff3[_0x68ef('0xc')]:_0x4f77f3[_0x68ef('0x9')]+_0x4f77f3[_0x68ef('0xa')];var _0x3afc1d;if(_0x304a60>=_0x1bee73){_0x304a60=_0x1bee73;_0x3afc1d=0xc8;}else{_0x3afc1d=0xce;}_0x4d26e3[_0x68ef('0x7')](_0x3afc1d);return _0x4d26e3['set'](_0x68ef('0xd'),_0x112b18+'-'+_0x304a60+'/'+_0x1bee73)[_0x68ef('0x8')](_0x3c2ff3);}return null;};}function saveUpdates(_0x1e117a,_0x454ef4){return function(_0x40f253){if(_0x40f253){return _0x40f253[_0x68ef('0xe')](_0x1e117a)['then'](function(_0x3b48dd){return _0x3b48dd;});}return null;};}function handleEntityNotFound(_0xc50cce,_0x2657c5){return function(_0x47fbb5){if(!_0x47fbb5){_0xc50cce[_0x68ef('0xf')](0x194);}return _0x47fbb5;};}function handleError(_0x1764de,_0x24682d){_0x24682d=_0x24682d||0x1f4;return function(_0x5005ba){logger[_0x68ef('0x10')](_0x5005ba[_0x68ef('0x11')]);if(_0x5005ba[_0x68ef('0x12')]){delete _0x5005ba[_0x68ef('0x12')];}_0x1764de['status'](_0x24682d)[_0x68ef('0x13')](_0x5005ba);};}exports['index']=function(_0x5cbb78,_0x2633c1){var _0x404870={},_0x4ade0d={},_0x527870={'count':0x0,'rows':[]};var _0x3c4c1f=_[_0x68ef('0x14')](db[_0x68ef('0x15')]['rawAttributes'],function(_0x1dc49c){return{'name':_0x1dc49c[_0x68ef('0x16')],'type':_0x1dc49c[_0x68ef('0x17')]['key']};});_0x4ade0d[_0x68ef('0x18')]=_[_0x68ef('0x14')](_0x3c4c1f,'name');_0x4ade0d[_0x68ef('0x19')]=_[_0x68ef('0x1a')](_0x5cbb78[_0x68ef('0x19')]);_0x4ade0d['filters']=_['intersection'](_0x4ade0d['model'],_0x4ade0d[_0x68ef('0x19')]);_0x4ade0d[_0x68ef('0x1b')]=_[_0x68ef('0x1c')](_0x4ade0d[_0x68ef('0x1b')],[_0x68ef('0x1d'),_0x68ef('0x1e'),_0x68ef('0x1f'),_0x68ef('0x20'),_0x68ef('0x21'),_0x68ef('0x22'),'$ne',_0x68ef('0x23'),'$not','$between','$notBetween',_0x68ef('0x24'),_0x68ef('0x25'),_0x68ef('0x26'),_0x68ef('0x27'),'$iLike','$notILike',_0x68ef('0x26'),_0x68ef('0x28'),_0x68ef('0x29'),_0x68ef('0x2a'),_0x68ef('0x2b')]);_0x404870[_0x68ef('0x2c')]=_[_0x68ef('0x2d')](_0x4ade0d[_0x68ef('0x18')],qs['fields'](_0x5cbb78[_0x68ef('0x19')][_0x68ef('0x2e')]));_0x404870[_0x68ef('0x2c')]=_0x404870['attributes'][_0x68ef('0x2f')]?_0x404870['attributes']:_0x4ade0d[_0x68ef('0x18')];if(!_0x5cbb78[_0x68ef('0x19')]['hasOwnProperty']('nolimit')){_0x404870[_0x68ef('0xa')]=qs[_0x68ef('0xa')](_0x5cbb78['query'][_0x68ef('0xa')]);_0x404870[_0x68ef('0x9')]=qs[_0x68ef('0x9')](_0x5cbb78[_0x68ef('0x19')]['offset']);}_0x404870[_0x68ef('0x30')]=qs[_0x68ef('0x31')](_0x5cbb78['query'][_0x68ef('0x31')]);_0x404870['where']=qs[_0x68ef('0x1b')](_[_0x68ef('0x32')](_0x5cbb78['query'],_0x4ade0d[_0x68ef('0x1b')]),_0x3c4c1f);if(_0x5cbb78['query'][_0x68ef('0x33')]){_0x404870['where']=_[_0x68ef('0x34')](_0x404870[_0x68ef('0x35')],{'$or':_[_0x68ef('0x14')](_0x3c4c1f,function(_0x569949){if(_0x569949[_0x68ef('0x17')]!=='VIRTUAL'){var _0x476938={};_0x476938[_0x569949['name']]={'$like':'%'+_0x5cbb78[_0x68ef('0x19')][_0x68ef('0x33')]+'%'};return _0x476938;}})});}_0x404870=_[_0x68ef('0x34')]({},_0x404870,_0x5cbb78[_0x68ef('0x36')]);var _0x2181d9={'where':_0x404870[_0x68ef('0x35')]};return db['CmHopper'][_0x68ef('0xc')](_0x2181d9)[_0x68ef('0x37')](function(_0x32074a){_0x527870['count']=_0x32074a;if(_0x5cbb78[_0x68ef('0x19')][_0x68ef('0x38')]){_0x404870[_0x68ef('0x39')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x404870);})[_0x68ef('0x37')](function(_0xec7de3){_0x527870[_0x68ef('0x3a')]=_0xec7de3;return _0x527870;})[_0x68ef('0x37')](respondWithFilteredResult(_0x2633c1,_0x404870))[_0x68ef('0x3b')](handleError(_0x2633c1,null));};exports[_0x68ef('0x3c')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1={'raw':!![],'where':{'id':_0x41ffe0[_0x68ef('0x3d')]['id']}},_0xd7f9ca={};_0xd7f9ca[_0x68ef('0x18')]=_['keys'](db[_0x68ef('0x15')][_0x68ef('0x3e')]);_0xd7f9ca[_0x68ef('0x19')]=_[_0x68ef('0x1a')](_0x41ffe0[_0x68ef('0x19')]);_0xd7f9ca[_0x68ef('0x1b')]=_['intersection'](_0xd7f9ca[_0x68ef('0x18')],_0xd7f9ca[_0x68ef('0x19')]);_0xaf7df1[_0x68ef('0x2c')]=_[_0x68ef('0x2d')](_0xd7f9ca[_0x68ef('0x18')],qs[_0x68ef('0x2e')](_0x41ffe0[_0x68ef('0x19')][_0x68ef('0x2e')]));_0xaf7df1[_0x68ef('0x2c')]=_0xaf7df1['attributes'][_0x68ef('0x2f')]?_0xaf7df1[_0x68ef('0x2c')]:_0xd7f9ca[_0x68ef('0x18')];if(_0x41ffe0[_0x68ef('0x19')][_0x68ef('0x38')]){_0xaf7df1[_0x68ef('0x39')]=[{'all':!![]}];}_0xaf7df1=_[_0x68ef('0x34')]({},_0xaf7df1,_0x41ffe0['options']);return db[_0x68ef('0x15')]['find'](_0xaf7df1)[_0x68ef('0x37')](handleEntityNotFound(_0x5b1246,null))[_0x68ef('0x37')](respondWithResult(_0x5b1246,null))[_0x68ef('0x3b')](handleError(_0x5b1246,null));};exports[_0x68ef('0x3f')]=function(_0x5a1330,_0x428456){return db['CmHopper'][_0x68ef('0x3f')](_0x5a1330['body'],{})[_0x68ef('0x37')](respondWithResult(_0x428456,0xc9))[_0x68ef('0x3b')](handleError(_0x428456,null));};exports[_0x68ef('0xe')]=function(_0x5c4a66,_0x59b148){if(_0x5c4a66[_0x68ef('0x40')]['id']){delete _0x5c4a66[_0x68ef('0x40')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x5c4a66['params']['id']}})[_0x68ef('0x37')](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x37')](saveUpdates(_0x5c4a66[_0x68ef('0x40')],null))[_0x68ef('0x37')](respondWithResult(_0x59b148,null))[_0x68ef('0x3b')](handleError(_0x59b148,null));};exports['describe']=function(_0x55f385,_0xc39f5b){return db[_0x68ef('0x15')][_0x68ef('0x41')]()[_0x68ef('0x37')](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x42')]=function(_0x474e5a,_0x1c9b6f){var _0x14142a;var _0x53880c=_0x474e5a['params']['id'];return db[_0x68ef('0x15')][_0x68ef('0x43')]({'where':{'id':_0x474e5a['params']['id']}})[_0x68ef('0x37')](handleEntityNotFound(_0x1c9b6f,null))[_0x68ef('0x37')](function(_0x3a82a0){if(_0x3a82a0){return _0x3a82a0[_0x68ef('0x42')]()[_0x68ef('0x37')](function(_0x4f0f77){return _0x4f0f77;});}})[_0x68ef('0x37')](function(_0x3984ca){_0x14142a=_0x3984ca;if(_0x3984ca){if(_0x3984ca[_0x68ef('0x44')]||_0x3984ca['CampaignId']){return db[_0x3984ca[_0x68ef('0x44')]?_0x68ef('0x45'):_0x68ef('0x46')]['find']({'where':{'id':_0x3984ca[_0x68ef('0x44')]?_0x3984ca['VoiceQueueId']:_0x3984ca['CampaignId']},'attributes':['id',_0x68ef('0x12')],'raw':!![]});}}})['then'](function(_0x39dd21){var _0xb33afd={};if(_0x39dd21){_[_0x68ef('0x34')](_0xb33afd,_[_0x68ef('0x47')](_0x14142a[_0x68ef('0x48')],[_0x68ef('0x49'),_0x68ef('0x4a'),'id']));_0xb33afd[_0x68ef('0x4b')]=0x15;_0xb33afd[_0x68ef('0x4c')]=_0x68ef('0x4d');_0xb33afd['campaign']=_0x39dd21['name'];_0xb33afd[_0x68ef('0x4e')]=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x12')];_0xb33afd[_0x68ef('0x50')]=_0x474e5a[_0x68ef('0x4f')]['id'];_0xb33afd[_0x68ef('0x4d')]=!![];_0xb33afd[_0x68ef('0x51')]=moment()[_0x68ef('0x52')](_0x68ef('0x53'));_0xb33afd['calleridnum']=_0x14142a['phone'];_0xb33afd[_0x68ef('0x54')]=_0x14142a['VoiceQueueId']?_0x68ef('0x55'):'ivr';return db[_0x68ef('0x56')][_0x68ef('0x43')]({'where':{'id':_0xb33afd['ContactId']},'attributes':[_0x68ef('0x57'),'lastName']})[_0x68ef('0x37')](function(_0x15c1ee){if(!_[_0x68ef('0x58')](_0x1c9b6f)&&!_[_0x68ef('0x58')](_0x15c1ee[_0x68ef('0x57')])){_0xb33afd[_0x68ef('0x59')]=_0x15c1ee['firstName'];if(!_[_0x68ef('0x58')](_0x15c1ee[_0x68ef('0x5a')])){_0xb33afd[_0x68ef('0x59')]+='\x20'+_0x15c1ee[_0x68ef('0x5a')];}}})[_0x68ef('0x5b')](function(){return db[_0x68ef('0x5c')]['create'](_0xb33afd);});}})[_0x68ef('0x37')](function(_0x42d2a3){return db['CmHopperAdditionalPhone'][_0x68ef('0x42')]({'where':{'CmHopperId':_0x53880c}});})[_0x68ef('0x37')](function(){return _0x1c9b6f[_0x68ef('0x7')](0xcc)['end']();})[_0x68ef('0x3b')](handleError(_0x1c9b6f,null));};exports['getPreview']=function(_0x5412ea,_0x3e5cca){var _0x540da5=[];return db[_0x68ef('0x56')]['describe']()[_0x68ef('0x37')](function(_0x9e8554){_0x540da5=_[_0x68ef('0x1a')](_0x9e8554);return _0x5412ea[_0x68ef('0x4f')][_0x68ef('0x5d')]({'where':{'type':_0x68ef('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x68ef('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x68ef('0x37')](function(_0x4b0c3e){if(_0x4b0c3e&&_0x4b0c3e[_0x68ef('0x2f')]){return db[_0x68ef('0x60')][_0x68ef('0x61')](function(_0xf0a40f){var _0x2f409c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x68ef('0x52')](_0x68ef('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x4b0c3e,'id')},'$or':[{'UserId':null},{'UserId':_0x5412ea[_0x68ef('0x4f')]['id']}]};var _0x11bab3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4b0c3e)[_0x68ef('0x33')]([_0x68ef('0x62'),0x0])[_0x68ef('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5412ea[_0x68ef('0x4f')]['id']}]};var _0x561e8d={'$or':[_0x2f409c,_0x11bab3]};var _0x1ed172=[];if(_0x5412ea['body']['direction']&&_0x5412ea[_0x68ef('0x40')][_0x68ef('0x63')]===_0x68ef('0x64')){if(!_[_0x68ef('0x65')](_0x5412ea['body'][_0x68ef('0x66')])){_0x561e8d['id']={'$in':_0x5412ea['body'][_0x68ef('0x66')]};}_0x1ed172=[[_0x68ef('0x67'),_0x68ef('0x68')],['scheduledAt',_0x4b0c3e[0x0]['dialOrderByScheduledAt']===_0x68ef('0x68')?_0x68ef('0x69'):_0x68ef('0x68')],db[_0x68ef('0x60')]['literal'](_0x68ef('0x6a')),['id',_0x68ef('0x69')]];}else{if(!_[_0x68ef('0x65')](_0x5412ea[_0x68ef('0x40')]['hopperIds'])){_0x561e8d['id']={'$notIn':_0x5412ea[_0x68ef('0x40')]['hopperIds']};}_0x1ed172=[[_0x68ef('0x67'),_0x68ef('0x69')],[_0x68ef('0x6b'),_0x4b0c3e[0x0][_0x68ef('0x5f')]],db[_0x68ef('0x60')]['literal'](_0x68ef('0x6c')),['id',_0x68ef('0x68')]];}return db[_0x68ef('0x15')]['findOne']({'attributes':['id',_0x68ef('0x6d'),'phone',_0x68ef('0x6e')],'where':_0x561e8d,'order':_0x1ed172,'transaction':_0xf0a40f,'lock':_0xf0a40f['LOCK']['UPDATE'],'include':[{'model':db[_0x68ef('0x56')],'as':_0x68ef('0x6f'),'attributes':_0x540da5,'include':[{'model':db[_0x68ef('0x70')],'as':_0x68ef('0x71'),'attributes':['id','name']}]},{'model':db[_0x68ef('0x72')],'as':_0x68ef('0x73'),'attributes':['id',_0x68ef('0x12')]},{'model':db['VoiceQueue'],'as':_0x68ef('0x74'),'attributes':['id',_0x68ef('0x12'),_0x68ef('0x75')]}]})[_0x68ef('0x37')](function(_0x2f551d){if(_0x2f551d){return _0x2f551d[_0x68ef('0xe')]({'UserId':_0x5412ea[_0x68ef('0x4f')]['id']},{'transaction':_0xf0a40f});}});});}})[_0x68ef('0x37')](handleEntityNotFound(_0x3e5cca,null))[_0x68ef('0x37')](respondWithResult(_0x3e5cca,null))[_0x68ef('0x3b')](handleError(_0x3e5cca,null));};exports[_0x68ef('0x76')]=function(_0x6a48ad,_0x50e298,_0x15378c){var _0x391a81=[];var _0x5db443=_0x6a48ad['params']['id'];var _0x12942d=_0x6a48ad['user']['id'];return db[_0x68ef('0x56')][_0x68ef('0x41')]()['then'](function(_0x4e0874){_0x391a81=_[_0x68ef('0x1a')](_0x4e0874);return db['sequelize'][_0x68ef('0x61')](function(_0x5e61af){const _0x34fa4a={'id':_0x5db443};return db['CmHopper'][_0x68ef('0x77')]({'attributes':['id',_0x68ef('0x6d'),'recallme'],'where':_0x34fa4a,'transaction':_0x5e61af,'lock':_0x5e61af[_0x68ef('0x78')][_0x68ef('0x79')],'include':[{'model':db[_0x68ef('0x56')],'as':_0x68ef('0x6f'),'attributes':_0x391a81,'include':[{'model':db['CmCompany'],'as':_0x68ef('0x71'),'attributes':['id',_0x68ef('0x12')]}]},{'model':db['CmList'],'as':_0x68ef('0x73'),'attributes':['id',_0x68ef('0x12')]},{'model':db[_0x68ef('0x45')],'as':'Queue','attributes':['id',_0x68ef('0x12'),'dialActive']}]})[_0x68ef('0x37')](function(_0x36c109){if(_0x36c109){return _0x36c109['update']({'UserId':_0x12942d},{'transaction':_0x5e61af});}});});})['then'](handleEntityNotFound(_0x50e298,null))['then'](respondWithResult(_0x50e298,null))['catch'](handleError(_0x50e298,null));};exports[_0x68ef('0x7a')]=function(_0x28ad22,_0x1217f9){return _0x28ad22[_0x68ef('0x4f')][_0x68ef('0x5d')]({'where':{'type':_0x68ef('0x5e'),'dialActive':!![],'dialMethod':_0x68ef('0x7b')},'attributes':['id'],'raw':!![]})[_0x68ef('0x37')](function(_0x24ba34){if(_0x24ba34&&_0x24ba34[_0x68ef('0x2f')]){return db[_0x68ef('0x15')][_0x68ef('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x68ef('0x52')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x68ef('0x14')](_0x24ba34,'id')},'$or':[{'UserId':null},{'UserId':_0x28ad22['user']['id']}]}});}return 0x0;})[_0x68ef('0x37')](function(_0x5b39a8){if(!_['isNil'](_0x5b39a8)&&_[_0x68ef('0x7c')](_0x5b39a8)){return _0x1217f9[_0x68ef('0x7')](0xc8)[_0x68ef('0x8')]({'contacts':_0x5b39a8});}else{logger[_0x68ef('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x68ef('0x7d'));_0x1217f9[_0x68ef('0xf')](0x194);}})[_0x68ef('0x3b')](handleError(_0x1217f9,null));};exports['getTimezones']=function(_0x3b5078,_0x23c69e){var _0x20c185=shared[_0x68ef('0x7e')];var _0x4dc885=[];_[_0x68ef('0x14')](_0x20c185,function(_0x1d158f){_0x4dc885[_0x68ef('0x7f')]({'id':_0x1d158f[_0x68ef('0x12')],'name':_0x1d158f[_0x68ef('0x12')],'utcOffset':_0x1d158f[_0x68ef('0x80')]});});return _0x23c69e['status'](0xc8)[_0x68ef('0x8')]({'tz':_0x4dc885});};exports['getTimezone']=function(_0xea97f4,_0x9b55f7){var _0x37da0a=shared[_0x68ef('0x7e')];var _0x58067b={};if(!_[_0x68ef('0x58')](_0x37da0a[_0xea97f4['body']['id']]))_0x58067b=_0x37da0a[_0xea97f4[_0x68ef('0x40')]['id']];return _0x9b55f7[_0x68ef('0x7')](0xc8)['json'](_0x58067b);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 657205c..a1ea7a7 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 _0xbd51=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x512b9f,_0x30b7fd){_0x512b9f=_0x512b9f-0x0;var _0x22e8fc=_0xbd51[_0x512b9f];return _0x22e8fc;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]},{'name':'phone','fields':[_0x1bd5('0xb')]},{'name':'priority','fields':[_0x1bd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37d5a8,_0x5d5b9d){var _0x56c600=function(_0x513474){while(--_0x513474){_0x37d5a8['push'](_0x37d5a8['shift']());}};_0x56c600(++_0x5d5b9d);}(_0x1883,0xab));var _0x3188=function(_0x42f27f,_0xec4e1e){_0x42f27f=_0x42f27f-0x0;var _0x30aa82=_0x1883[_0x42f27f];return _0x30aa82;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7c07298..4fd9cc9 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 _0x6a78=['UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','length','includes','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','then','info','stringify','error','message','ShowCmHopper','find','raw','debug','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','describe','sequelize','transaction','order','LOCK'];(function(_0x3986b8,_0x1e6bbf){var _0x19e94e=function(_0x41c69b){while(--_0x41c69b){_0x3986b8['push'](_0x3986b8['shift']());}};_0x19e94e(++_0x1e6bbf);}(_0x6a78,0x1c4));var _0x86a7=function(_0x211caf,_0x3f4636){_0x211caf=_0x211caf-0x0;var _0x3357ff=_0x6a78[_0x211caf];return _0x3357ff;};'use strict';var _=require(_0x86a7('0x0'));var util=require(_0x86a7('0x1'));var moment=require(_0x86a7('0x2'));var BPromise=require(_0x86a7('0x3'));var db=require(_0x86a7('0x4'))['db'];var logger=require(_0x86a7('0x5'))(_0x86a7('0x6'));exports[_0x86a7('0x7')]=function(_0x426435){var _0x363dc4=this;return new Promise(function(_0x530d7c,_0x97928f){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'raw':_0x426435[_0x86a7('0xa')]?_0x426435['options']['raw']===undefined?!![]:![]:!![],'where':_0x426435[_0x86a7('0xa')]?_0x426435['options'][_0x86a7('0xb')]||null:null,'attributes':_0x426435['options']?_0x426435[_0x86a7('0xa')][_0x86a7('0xc')]||null:null,'limit':_0x426435[_0x86a7('0xa')]?_0x426435[_0x86a7('0xa')][_0x86a7('0xd')]||null:null,'include':_0x426435[_0x86a7('0xa')]?_0x426435[_0x86a7('0xa')][_0x86a7('0xe')]?_[_0x86a7('0xf')](_0x426435[_0x86a7('0xa')]['include'],function(_0x5a326f){return{'model':db[_0x5a326f[_0x86a7('0x10')]],'as':_0x5a326f['as'],'attributes':_0x5a326f[_0x86a7('0xc')],'include':_0x5a326f[_0x86a7('0xe')]?_[_0x86a7('0xf')](_0x5a326f[_0x86a7('0xe')],function(_0x165877){return{'model':db[_0x165877[_0x86a7('0x10')]],'as':_0x165877['as'],'attributes':_0x165877[_0x86a7('0xc')],'include':_0x165877['include']?_[_0x86a7('0xf')](_0x165877[_0x86a7('0xe')],function(_0x8c56ef){return{'model':db[_0x8c56ef['model']],'as':_0x8c56ef['as'],'attributes':_0x8c56ef[_0x86a7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x86a7('0x11')](function(_0x484ef6){logger[_0x86a7('0x12')](_0x86a7('0x7'),_0x426435);logger['debug'](_0x86a7('0x7'),_0x426435,JSON[_0x86a7('0x13')](_0x484ef6));_0x530d7c(_0x484ef6);})['catch'](function(_0x2d0699){logger[_0x86a7('0x14')](_0x86a7('0x7'),_0x2d0699[_0x86a7('0x15')],_0x426435);_0x97928f(_0x363dc4[_0x86a7('0x14')](0x1f4,_0x2d0699[_0x86a7('0x15')]));});});};exports[_0x86a7('0x16')]=function(_0xfed972){var _0x9f1cc0=this;return new Promise(function(_0x56b334,_0x53c5ae){return db[_0x86a7('0x8')][_0x86a7('0x17')]({'raw':_0xfed972[_0x86a7('0xa')]?_0xfed972[_0x86a7('0xa')][_0x86a7('0x18')]===undefined?!![]:![]:!![],'where':_0xfed972[_0x86a7('0xa')]?_0xfed972[_0x86a7('0xa')][_0x86a7('0xb')]||null:null,'attributes':_0xfed972[_0x86a7('0xa')]?_0xfed972[_0x86a7('0xa')][_0x86a7('0xc')]||null:null,'include':_0xfed972[_0x86a7('0xa')]?_0xfed972[_0x86a7('0xa')]['include']?_[_0x86a7('0xf')](_0xfed972[_0x86a7('0xa')][_0x86a7('0xe')],function(_0x3af2d0){return{'model':db[_0x3af2d0[_0x86a7('0x10')]],'as':_0x3af2d0['as'],'attributes':_0x3af2d0['attributes'],'include':_0x3af2d0[_0x86a7('0xe')]?_[_0x86a7('0xf')](_0x3af2d0[_0x86a7('0xe')],function(_0xaede3){return{'model':db[_0xaede3[_0x86a7('0x10')]],'as':_0xaede3['as'],'attributes':_0xaede3[_0x86a7('0xc')],'include':_0xaede3[_0x86a7('0xe')]?_['map'](_0xaede3[_0x86a7('0xe')],function(_0x5abe10){return{'model':db[_0x5abe10[_0x86a7('0x10')]],'as':_0x5abe10['as'],'attributes':_0x5abe10[_0x86a7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x86a7('0x11')](function(_0x40f4aa){logger[_0x86a7('0x12')](_0x86a7('0x16'),_0xfed972);logger[_0x86a7('0x19')](_0x86a7('0x16'),_0xfed972,JSON[_0x86a7('0x13')](_0x40f4aa));_0x56b334(_0x40f4aa);})[_0x86a7('0x1a')](function(_0x59f079){logger[_0x86a7('0x14')](_0x86a7('0x16'),_0x59f079['message'],_0xfed972);_0x53c5ae(_0x9f1cc0[_0x86a7('0x14')](0x1f4,_0x59f079[_0x86a7('0x15')]));});});};exports[_0x86a7('0x1b')]=function(_0x24a410){var _0x17f7f5=this;return new Promise(function(_0x2cc15c,_0x23371f){return db['CmHopper'][_0x86a7('0x1c')](_0x24a410[_0x86a7('0x1d')],{'raw':_0x24a410[_0x86a7('0xa')]?_0x24a410[_0x86a7('0xa')][_0x86a7('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x10ebf1){logger['info'](_0x86a7('0x1b'),_0x24a410);logger['debug']('CreateCmHopper',_0x24a410,JSON[_0x86a7('0x13')](_0x10ebf1));_0x2cc15c(_0x10ebf1);})[_0x86a7('0x1a')](function(_0x6b1a3c){logger[_0x86a7('0x14')](_0x86a7('0x1b'),_0x6b1a3c[_0x86a7('0x15')],_0x24a410);_0x23371f(_0x17f7f5[_0x86a7('0x14')](0x1f4,_0x6b1a3c['message']));});});};exports[_0x86a7('0x1e')]=function(_0x196c8c){var _0x4dcb1b=this;return new Promise(function(_0x2982fe,_0x300aed){return db[_0x86a7('0x8')][_0x86a7('0x1f')](_0x196c8c[_0x86a7('0x1d')],{'raw':_0x196c8c[_0x86a7('0xa')]?_0x196c8c[_0x86a7('0xa')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196c8c[_0x86a7('0xa')]?_0x196c8c[_0x86a7('0xa')]['where']||null:null,'attributes':_0x196c8c[_0x86a7('0xa')]?_0x196c8c[_0x86a7('0xa')]['attributes']||null:null,'limit':_0x196c8c[_0x86a7('0xa')]?_0x196c8c['options'][_0x86a7('0xd')]||null:null})[_0x86a7('0x11')](function(_0x4bd88d){logger['info'](_0x86a7('0x1e'),_0x196c8c);logger[_0x86a7('0x12')](_0x86a7('0x20'),JSON[_0x86a7('0x13')](_0x196c8c[_0x86a7('0xa')]['where']),_0x196c8c[_0x86a7('0x1d')]['active']);logger[_0x86a7('0x19')](_0x86a7('0x1e'),_0x196c8c,JSON[_0x86a7('0x13')](_0x4bd88d));_0x2982fe(_0x4bd88d);})[_0x86a7('0x1a')](function(_0x4a6e86){logger[_0x86a7('0x14')](_0x86a7('0x1e'),_0x4a6e86['message'],_0x196c8c);_0x300aed(_0x4dcb1b[_0x86a7('0x14')](0x1f4,_0x4a6e86['message']));});});};exports[_0x86a7('0x21')]=function(_0x520672){var _0x37ad04=this;return new Promise(function(_0x375f88,_0x264eab){return db[_0x86a7('0x8')][_0x86a7('0x22')]({'where':_0x520672[_0x86a7('0xa')]?_0x520672[_0x86a7('0xa')][_0x86a7('0xb')]||null:null})[_0x86a7('0x11')](function(_0x27fc07){logger[_0x86a7('0x12')](_0x86a7('0x21'),_0x520672);logger[_0x86a7('0x19')](_0x86a7('0x21'),_0x520672,JSON[_0x86a7('0x13')](_0x27fc07));_0x375f88(_0x27fc07);})['catch'](function(_0x40017e){logger[_0x86a7('0x14')](_0x86a7('0x21'),_0x40017e['message'],_0x520672);_0x264eab(_0x37ad04[_0x86a7('0x14')](0x1f4,_0x40017e[_0x86a7('0x15')]));});});};exports['GetContactDialer']=function(_0x15da87){var _0x40e215=this;return new Promise(function(_0x13c56f,_0x2285ed){return db['CmContact'][_0x86a7('0x23')]()[_0x86a7('0x11')](function(_0x1975d3){return db[_0x86a7('0x24')][_0x86a7('0x25')](function(_0x44de44){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'where':_0x15da87['options']?_0x15da87[_0x86a7('0xa')]['where']||null:null,'attributes':_0x15da87[_0x86a7('0xa')]?_0x15da87[_0x86a7('0xa')][_0x86a7('0xc')]||null:null,'limit':_0x15da87[_0x86a7('0xa')]?_0x15da87[_0x86a7('0xa')][_0x86a7('0xd')]||null:null,'order':_0x15da87['options']?_0x15da87[_0x86a7('0xa')][_0x86a7('0x26')]||null:null,'transaction':_0x44de44,'lock':_0x44de44[_0x86a7('0x27')][_0x86a7('0x28')],'include':[{'model':db[_0x86a7('0x29')],'as':_0x86a7('0x2a'),'attributes':_[_0x86a7('0x2b')](_0x1975d3)},{'model':db[_0x86a7('0x2c')],'as':_0x86a7('0x2d'),'attributes':['id',_0x86a7('0x2e'),_0x86a7('0x2f')]}]})[_0x86a7('0x11')](function(_0x233963){var _0x3cf22d=[];var _0x1d6967=[];for(var _0x5542d7=0x0;_0x5542d7<_0x233963[_0x86a7('0x30')];_0x5542d7+=0x1){var _0x35c703=_0x233963[_0x5542d7]['UserId'];if(_0x35c703===null){_0x3cf22d['push'](_0x233963[_0x5542d7][_0x86a7('0x1f')](_0x15da87[_0x86a7('0x1d')],{'transaction':_0x44de44}));}else if(!_0x1d6967[_0x86a7('0x31')](_0x35c703)){_0x1d6967[_0x86a7('0x32')](_0x35c703);_0x3cf22d[_0x86a7('0x32')](_0x233963[_0x5542d7][_0x86a7('0x1f')](_0x15da87[_0x86a7('0x1d')],{'transaction':_0x44de44}));}}return BPromise[_0x86a7('0x33')](_0x3cf22d);});})[_0x86a7('0x11')](function(_0x6dfcfc){logger[_0x86a7('0x12')](_0x86a7('0x34'),_0x15da87);if(_0x6dfcfc[_0x86a7('0x30')]>0x0){logger[_0x86a7('0x12')](_0x86a7('0x35'),_0x6dfcfc[0x0][_0x86a7('0x36')]['id'],_0x6dfcfc[0x0]['dataValues'][_0x86a7('0x37')],_0x6dfcfc[0x0][_0x86a7('0x36')][_0x86a7('0x38')]);}logger[_0x86a7('0x19')](_0x86a7('0x34'),_0x15da87,JSON[_0x86a7('0x13')](_0x6dfcfc));_0x13c56f(_0x6dfcfc);})[_0x86a7('0x1a')](function(_0x3f9a46){logger[_0x86a7('0x14')](_0x86a7('0x34'),_0x3f9a46[_0x86a7('0x15')],_0x15da87);_0x2285ed(_0x40e215[_0x86a7('0x14')](0x1f4,_0x3f9a46[_0x86a7('0x15')]));});});});};exports[_0x86a7('0x39')]=function(_0x5961f8){var _0x1e9d61=this;return new Promise(function(_0x54c4a8,_0x7e4da5){return db[_0x86a7('0x24')][_0x86a7('0x25')](function(_0x2c77bd){return db['CmHopperFinal'][_0x86a7('0x1c')](_0x5961f8[_0x86a7('0x1d')],{'raw':_0x5961f8[_0x86a7('0xa')]?_0x5961f8[_0x86a7('0xa')][_0x86a7('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2c77bd})[_0x86a7('0x11')](function(){logger[_0x86a7('0x12')](_0x86a7('0x3a'),JSON[_0x86a7('0x13')](_0x5961f8[_0x86a7('0xa')][_0x86a7('0xb')]),_0x5961f8[_0x86a7('0xa')][_0x86a7('0xb')][_0x86a7('0x38')]);return db['CmHopper'][_0x86a7('0x22')]({'where':_0x5961f8[_0x86a7('0xa')]?_0x5961f8[_0x86a7('0xa')][_0x86a7('0xb')]||null:null,'transaction':_0x2c77bd});});})[_0x86a7('0x11')](function(_0x44a69b){logger[_0x86a7('0x12')](_0x86a7('0x39'),_0x5961f8);logger[_0x86a7('0x19')](_0x86a7('0x39'),_0x5961f8,JSON[_0x86a7('0x13')](_0x44a69b));_0x54c4a8(_0x44a69b);})['catch'](function(_0x3282d2){logger[_0x86a7('0x14')](_0x86a7('0x39'),_0x3282d2[_0x86a7('0x15')],_0x5961f8);_0x7e4da5(_0x1e9d61[_0x86a7('0x14')](0x1f4,_0x3282d2[_0x86a7('0x15')]));});});};exports['CountReScheduled']=function(_0x274bb2){var _0x510300=this;return new Promise(function(_0x2d0df3,_0x291019){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'raw':_0x274bb2[_0x86a7('0xa')]?_0x274bb2[_0x86a7('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x274bb2[_0x86a7('0xa')]?_0x274bb2[_0x86a7('0xa')]['where']||null:null,'attributes':[[db[_0x86a7('0x24')]['fn']('COUNT',db[_0x86a7('0x24')]['fn']('IF',db['sequelize']['literal'](_0x86a7('0x3b')+util['format'](_0x86a7('0x3c'),moment()['format'](_0x86a7('0x3d')))+_0x86a7('0x3e')))),_0x86a7('0x3f')]]})[_0x86a7('0x11')](function(_0x220e0c){logger['info'](_0x86a7('0x40'),_0x274bb2);logger[_0x86a7('0x19')]('CountReScheduled',_0x274bb2,JSON[_0x86a7('0x13')](_0x220e0c));_0x2d0df3(_0x220e0c);})[_0x86a7('0x1a')](function(_0x40a88c){logger[_0x86a7('0x14')](_0x86a7('0x40'),_0x40a88c['message'],_0x274bb2);_0x291019(_0x510300[_0x86a7('0x14')](0x1f4,_0x40a88c['message']));});});};exports[_0x86a7('0x41')]=function(_0x56b9c8){var _0x4227f0=this;return new Promise(function(_0x2826f0,_0x56a281){return db['CmContact'][_0x86a7('0x23')]()[_0x86a7('0x11')](function(){return db[_0x86a7('0x24')][_0x86a7('0x25')](function(_0x1843e9){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'where':_0x56b9c8[_0x86a7('0xa')]?_0x56b9c8[_0x86a7('0xa')][_0x86a7('0xb')]||null:null,'attributes':_0x56b9c8[_0x86a7('0xa')]?_0x56b9c8['options'][_0x86a7('0xc')]||null:null,'limit':0x1,'order':_0x56b9c8[_0x86a7('0xa')]?_0x56b9c8['options'][_0x86a7('0x26')]||null:null,'group':db['CmHopper'][_0x86a7('0x42')],'transaction':_0x1843e9,'lock':_0x1843e9[_0x86a7('0x27')][_0x86a7('0x28')],'include':_0x56b9c8['options']?_0x56b9c8['options']['include']?_['map'](_0x56b9c8[_0x86a7('0xa')][_0x86a7('0xe')],function(_0x358d26){return{'model':db[_0x358d26['model']],'as':_0x358d26['as'],'attributes':_0x358d26[_0x86a7('0xc')],'include':_0x358d26[_0x86a7('0xe')]?_[_0x86a7('0xf')](_0x358d26['include'],function(_0xdd2abd){return{'model':db[_0xdd2abd[_0x86a7('0x10')]],'as':_0xdd2abd['as'],'attributes':_0xdd2abd[_0x86a7('0xc')],'include':_0xdd2abd[_0x86a7('0xe')]?_[_0x86a7('0xf')](_0xdd2abd['include'],function(_0x25eed3){return{'model':db[_0x25eed3[_0x86a7('0x10')]],'as':_0x25eed3['as'],'attributes':_0x25eed3[_0x86a7('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46013b){var _0x2b1edb=[];for(var _0x4688c3=0x0;_0x4688c3<_0x46013b[_0x86a7('0x30')];_0x4688c3+=0x1){_0x2b1edb[_0x86a7('0x32')](_0x46013b[_0x4688c3][_0x86a7('0x1f')](_0x56b9c8['body'],{'transaction':_0x1843e9}));}return BPromise[_0x86a7('0x33')](_0x2b1edb);});})[_0x86a7('0x11')](function(_0x225f21){logger[_0x86a7('0x12')]('GetContactRecallMe',_0x56b9c8);logger[_0x86a7('0x19')](_0x86a7('0x41'),_0x56b9c8,JSON[_0x86a7('0x13')](_0x225f21));_0x2826f0(_0x225f21);})[_0x86a7('0x1a')](function(_0xa29fc4){logger[_0x86a7('0x14')](_0x86a7('0x41'),_0xa29fc4[_0x86a7('0x15')],_0x56b9c8);_0x56a281(_0x4227f0[_0x86a7('0x14')](0x1f4,_0xa29fc4[_0x86a7('0x15')]));});});});};exports[_0x86a7('0x43')]=function(_0x576e96){var _0x1e9007=this;return new Promise(function(_0x1162ee,_0x284b32){db['CmContact'][_0x86a7('0x23')]()[_0x86a7('0x11')](function(_0x2ff229){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'raw':_0x576e96[_0x86a7('0xa')]?_0x576e96['options'][_0x86a7('0x18')]===undefined?!![]:![]:!![],'where':_0x576e96['options']?_0x576e96['options'][_0x86a7('0xb')]||null:null,'attributes':_0x576e96[_0x86a7('0xa')]?_0x576e96[_0x86a7('0xa')][_0x86a7('0xc')]||null:null,'limit':_0x576e96['options']?_0x576e96[_0x86a7('0xa')]['limit']||null:null,'include':_0x576e96[_0x86a7('0xa')]?_0x576e96[_0x86a7('0xa')]['include']?_['map'](_0x576e96['options']['include'],function(_0xb16070){return{'model':db[_0xb16070[_0x86a7('0x10')]],'as':_0xb16070['as'],'attributes':_0xb16070['as']===_0x86a7('0x2a')?_[_0x86a7('0x2b')](_0x2ff229):_0xb16070[_0x86a7('0xc')],'include':_0xb16070[_0x86a7('0xe')]?_[_0x86a7('0xf')](_0xb16070['include'],function(_0xf346df){return{'model':db[_0xf346df['model']],'as':_0xf346df['as'],'attributes':_0xf346df['attributes'],'include':_0xf346df['include']?_[_0x86a7('0xf')](_0xf346df[_0x86a7('0xe')],function(_0x2b146f){return{'model':db[_0x2b146f[_0x86a7('0x10')]],'as':_0x2b146f['as'],'attributes':_0x2b146f[_0x86a7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x86a7('0x11')](function(_0x1e976d){logger[_0x86a7('0x12')](_0x86a7('0x7'),_0x576e96);logger[_0x86a7('0x19')](_0x86a7('0x7'),_0x576e96,JSON[_0x86a7('0x13')](_0x1e976d));_0x1162ee(_0x1e976d);})['catch'](function(_0x5a9821){logger[_0x86a7('0x14')](_0x86a7('0x7'),_0x5a9821[_0x86a7('0x15')],_0x576e96);_0x284b32(_0x1e9007[_0x86a7('0x14')](0x1f4,_0x5a9821[_0x86a7('0x15')]));});});});};exports[_0x86a7('0x44')]=function(_0x2242ac){var _0x2e9d17=this;return new Promise(function(_0x2a73a0,_0x3d8127){return db[_0x86a7('0x29')][_0x86a7('0x45')]({'raw':!![],'where':{'phone':_0x2242ac[_0x86a7('0xa')][_0x86a7('0xb')][_0x86a7('0x46')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0xbddd12){logger[_0x86a7('0x12')](_0x86a7('0x47'),_0x2242ac);logger['debug'](_0x86a7('0x47'),_0x2242ac,JSON['stringify'](_0xbddd12));_0x2a73a0(_0xbddd12);})[_0x86a7('0x1a')](function(_0x5f3bb7){logger['error']('getContactByPhone',_0x5f3bb7[_0x86a7('0x15')],_0x2242ac);_0x3d8127(_0x2e9d17['error'](0x1f4,_0x5f3bb7[_0x86a7('0x15')]));});});};exports[_0x86a7('0x48')]=function(_0x50c75f){var _0x3c5e83=this;return new Promise(function(_0x472045,_0x25f970){return db[_0x86a7('0x24')][_0x86a7('0x25')](function(_0x31e20d){var _0x401c1b=_0x50c75f[_0x86a7('0xa')]&&_0x50c75f[_0x86a7('0xa')]['where']?_0x50c75f['options']['where']:{};return db[_0x86a7('0x8')]['update'](_0x50c75f[_0x86a7('0x1d')],{'where':_0x401c1b,'transaction':_0x31e20d})[_0x86a7('0x11')](function(_0x3a89a9){logger[_0x86a7('0x12')](_0x86a7('0x48'),_0x50c75f);logger[_0x86a7('0x19')](_0x86a7('0x48'),_0x50c75f,JSON['stringify'](_0x3a89a9));_0x472045(_0x3a89a9);})[_0x86a7('0x1a')](function(_0x990927){logger[_0x86a7('0x14')](_0x86a7('0x48'),_0x990927[_0x86a7('0x15')],_0x50c75f);_0x25f970(_0x3c5e83['error'](0x1f4,_0x990927[_0x86a7('0x15')]));});});});};exports[_0x86a7('0x49')]=function(_0x3af207){var _0x293153=this;var _0x56a9a5=_0x3af207[_0x86a7('0x1d')][_0x86a7('0xb')][_0x86a7('0x4a')];var _0x15e8d4=_0x3af207[_0x86a7('0x1d')]['where']['interval'];var _0x470ed2=_0x3af207['body'][_0x86a7('0xb')][_0x86a7('0x4b')];return new Promise(function(_0x46a39c,_0x3456b1){return db[_0x86a7('0x8')][_0x86a7('0x9')]({'where':{'voiceQueueId':{'$in':_0x56a9a5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x86a7('0x4c')](_0x86a7('0x4d')+_0x15e8d4+_0x86a7('0x4e')),'$gt':db[_0x86a7('0x24')]['literal']('NOW()')}},'UserId':{'$in':_0x470ed2}},'include':[{'model':db[_0x86a7('0x29')],'as':_0x86a7('0x2a')},{'model':db[_0x86a7('0x2c')],'as':_0x86a7('0x2d'),'attributes':['id','name',_0x86a7('0x2f')]},{'model':db[_0x86a7('0x4f')],'as':_0x86a7('0x50')}]})[_0x86a7('0x11')](function(_0x188e35){if(_0x188e35[_0x86a7('0x30')]>0x0){return db[_0x86a7('0x24')][_0x86a7('0x25')](function(_0x4d7ba6){return db[_0x86a7('0x8')][_0x86a7('0x1f')]({'recallmeNotifiedDate':db[_0x86a7('0x24')][_0x86a7('0x4c')](_0x86a7('0x51'))},{'where':{'id':{'$in':_[_0x86a7('0xf')](_0x188e35,'id')}},'transaction':_0x4d7ba6})[_0x86a7('0x11')](function(){_0x46a39c(_0x188e35);})[_0x86a7('0x1a')](function(_0x40b1e0){logger[_0x86a7('0x14')](_0x86a7('0x49'),_0x40b1e0[_0x86a7('0x15')],_0x3af207);_0x3456b1(_0x293153[_0x86a7('0x14')](0x1f4,_0x40b1e0[_0x86a7('0x15')]));});})[_0x86a7('0x1a')](function(_0x13bc7f){logger[_0x86a7('0x14')](_0x86a7('0x49'),_0x13bc7f[_0x86a7('0x15')],_0x3af207);_0x3456b1(_0x293153['error'](0x1f4,_0x13bc7f[_0x86a7('0x15')]));});}else{_0x46a39c(_0x188e35);}});});}; \ No newline at end of file +var _0x0727=['length','UserId','push','update','includes','all','dataValues','ContactId','GetContactDialer','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','where','attributes','limit','include','map','model','info','GetCmHopper','stringify','catch','message','error','ShowCmHopper','then','debug','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','UPDATE','Contact','keys','User','Agent','name','voicePause'];(function(_0x263160,_0x5a4bea){var _0x4b599b=function(_0x1f2777){while(--_0x1f2777){_0x263160['push'](_0x263160['shift']());}};_0x4b599b(++_0x5a4bea);}(_0x0727,0x110));var _0x7072=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0x0727[_0xd8aad0];return _0x570860;};'use strict';var _=require('lodash');var util=require(_0x7072('0x0'));var moment=require(_0x7072('0x1'));var BPromise=require(_0x7072('0x2'));var db=require(_0x7072('0x3'))['db'];var logger=require(_0x7072('0x4'))(_0x7072('0x5'));exports['GetCmHopper']=function(_0x4131a5){var _0x137e31=this;return new Promise(function(_0x461a50,_0x2df17b){return db[_0x7072('0x6')]['findAll']({'raw':_0x4131a5[_0x7072('0x7')]?_0x4131a5['options'][_0x7072('0x8')]===undefined?!![]:![]:!![],'where':_0x4131a5['options']?_0x4131a5[_0x7072('0x7')][_0x7072('0x9')]||null:null,'attributes':_0x4131a5[_0x7072('0x7')]?_0x4131a5[_0x7072('0x7')][_0x7072('0xa')]||null:null,'limit':_0x4131a5[_0x7072('0x7')]?_0x4131a5[_0x7072('0x7')][_0x7072('0xb')]||null:null,'include':_0x4131a5[_0x7072('0x7')]?_0x4131a5[_0x7072('0x7')][_0x7072('0xc')]?_[_0x7072('0xd')](_0x4131a5[_0x7072('0x7')][_0x7072('0xc')],function(_0x7aa9e3){return{'model':db[_0x7aa9e3[_0x7072('0xe')]],'as':_0x7aa9e3['as'],'attributes':_0x7aa9e3['attributes'],'include':_0x7aa9e3[_0x7072('0xc')]?_[_0x7072('0xd')](_0x7aa9e3[_0x7072('0xc')],function(_0x309b5d){return{'model':db[_0x309b5d['model']],'as':_0x309b5d['as'],'attributes':_0x309b5d[_0x7072('0xa')],'include':_0x309b5d[_0x7072('0xc')]?_['map'](_0x309b5d[_0x7072('0xc')],function(_0x573bda){return{'model':db[_0x573bda[_0x7072('0xe')]],'as':_0x573bda['as'],'attributes':_0x573bda['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a886){logger[_0x7072('0xf')](_0x7072('0x10'),_0x4131a5);logger['debug'](_0x7072('0x10'),_0x4131a5,JSON[_0x7072('0x11')](_0x41a886));_0x461a50(_0x41a886);})[_0x7072('0x12')](function(_0x1db64f){logger['error'](_0x7072('0x10'),_0x1db64f[_0x7072('0x13')],_0x4131a5);_0x2df17b(_0x137e31[_0x7072('0x14')](0x1f4,_0x1db64f[_0x7072('0x13')]));});});};exports[_0x7072('0x15')]=function(_0x2c1df8){var _0xde92e6=this;return new Promise(function(_0x5253a3,_0x4caa75){return db['CmHopper']['find']({'raw':_0x2c1df8[_0x7072('0x7')]?_0x2c1df8[_0x7072('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x2c1df8[_0x7072('0x7')]?_0x2c1df8[_0x7072('0x7')]['where']||null:null,'attributes':_0x2c1df8['options']?_0x2c1df8[_0x7072('0x7')]['attributes']||null:null,'include':_0x2c1df8[_0x7072('0x7')]?_0x2c1df8['options'][_0x7072('0xc')]?_[_0x7072('0xd')](_0x2c1df8['options'][_0x7072('0xc')],function(_0x320733){return{'model':db[_0x320733['model']],'as':_0x320733['as'],'attributes':_0x320733[_0x7072('0xa')],'include':_0x320733[_0x7072('0xc')]?_['map'](_0x320733['include'],function(_0x422052){return{'model':db[_0x422052['model']],'as':_0x422052['as'],'attributes':_0x422052[_0x7072('0xa')],'include':_0x422052[_0x7072('0xc')]?_[_0x7072('0xd')](_0x422052[_0x7072('0xc')],function(_0xa78551){return{'model':db[_0xa78551['model']],'as':_0xa78551['as'],'attributes':_0xa78551[_0x7072('0xa')]};}):[]};}):[]};}):[]:[]})[_0x7072('0x16')](function(_0x3fad4a){logger[_0x7072('0xf')]('ShowCmHopper',_0x2c1df8);logger[_0x7072('0x17')](_0x7072('0x15'),_0x2c1df8,JSON[_0x7072('0x11')](_0x3fad4a));_0x5253a3(_0x3fad4a);})[_0x7072('0x12')](function(_0x50890f){logger[_0x7072('0x14')]('ShowCmHopper',_0x50890f[_0x7072('0x13')],_0x2c1df8);_0x4caa75(_0xde92e6[_0x7072('0x14')](0x1f4,_0x50890f[_0x7072('0x13')]));});});};exports['CreateCmHopper']=function(_0x479941){var _0x155fd6=this;return new Promise(function(_0x25da43,_0xb1765f){return db[_0x7072('0x6')]['create'](_0x479941[_0x7072('0x18')],{'raw':_0x479941[_0x7072('0x7')]?_0x479941['options'][_0x7072('0x8')]===undefined?!![]:![]:!![]})['then'](function(_0x181a68){logger['info'](_0x7072('0x19'),_0x479941);logger[_0x7072('0x17')](_0x7072('0x19'),_0x479941,JSON['stringify'](_0x181a68));_0x25da43(_0x181a68);})[_0x7072('0x12')](function(_0x1c06e3){logger[_0x7072('0x14')](_0x7072('0x19'),_0x1c06e3[_0x7072('0x13')],_0x479941);_0xb1765f(_0x155fd6['error'](0x1f4,_0x1c06e3['message']));});});};exports[_0x7072('0x1a')]=function(_0x3e0120){var _0x42fa43=this;return new Promise(function(_0x9dd707,_0x32b263){return db[_0x7072('0x6')]['update'](_0x3e0120['body'],{'raw':_0x3e0120[_0x7072('0x7')]?_0x3e0120[_0x7072('0x7')][_0x7072('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0120[_0x7072('0x7')]?_0x3e0120[_0x7072('0x7')][_0x7072('0x9')]||null:null,'attributes':_0x3e0120[_0x7072('0x7')]?_0x3e0120[_0x7072('0x7')]['attributes']||null:null,'limit':_0x3e0120[_0x7072('0x7')]?_0x3e0120[_0x7072('0x7')][_0x7072('0xb')]||null:null})[_0x7072('0x16')](function(_0x3d4c74){logger[_0x7072('0xf')]('UpdateCmHopper',_0x3e0120);logger[_0x7072('0xf')](_0x7072('0x1b'),JSON[_0x7072('0x11')](_0x3e0120[_0x7072('0x7')][_0x7072('0x9')]),_0x3e0120[_0x7072('0x18')][_0x7072('0x1c')]);logger[_0x7072('0x17')](_0x7072('0x1a'),_0x3e0120,JSON['stringify'](_0x3d4c74));_0x9dd707(_0x3d4c74);})['catch'](function(_0xc5c3a1){logger[_0x7072('0x14')](_0x7072('0x1a'),_0xc5c3a1[_0x7072('0x13')],_0x3e0120);_0x32b263(_0x42fa43[_0x7072('0x14')](0x1f4,_0xc5c3a1[_0x7072('0x13')]));});});};exports[_0x7072('0x1d')]=function(_0x570e63){var _0x8fd4c=this;return new Promise(function(_0x5e7df1,_0x19e39e){return db[_0x7072('0x6')][_0x7072('0x1e')]({'where':_0x570e63[_0x7072('0x7')]?_0x570e63[_0x7072('0x7')][_0x7072('0x9')]||null:null})[_0x7072('0x16')](function(_0x291340){logger[_0x7072('0xf')](_0x7072('0x1d'),_0x570e63);logger[_0x7072('0x17')](_0x7072('0x1d'),_0x570e63,JSON['stringify'](_0x291340));_0x5e7df1(_0x291340);})[_0x7072('0x12')](function(_0x15aea6){logger[_0x7072('0x14')](_0x7072('0x1d'),_0x15aea6[_0x7072('0x13')],_0x570e63);_0x19e39e(_0x8fd4c[_0x7072('0x14')](0x1f4,_0x15aea6[_0x7072('0x13')]));});});};exports['GetContactDialer']=function(_0x3ac65e){var _0x4cad3c=this;return new Promise(function(_0x1145d9,_0x6b2778){return db[_0x7072('0x1f')][_0x7072('0x20')]()[_0x7072('0x16')](function(_0x402a4e){return db[_0x7072('0x21')][_0x7072('0x22')](function(_0x3e0ee8){return db[_0x7072('0x6')][_0x7072('0x23')]({'where':_0x3ac65e[_0x7072('0x7')]?_0x3ac65e[_0x7072('0x7')][_0x7072('0x9')]||null:null,'attributes':_0x3ac65e[_0x7072('0x7')]?_0x3ac65e[_0x7072('0x7')][_0x7072('0xa')]||null:null,'limit':_0x3ac65e[_0x7072('0x7')]?_0x3ac65e['options'][_0x7072('0xb')]||null:null,'order':_0x3ac65e['options']?_0x3ac65e['options'][_0x7072('0x24')]||null:null,'transaction':_0x3e0ee8,'lock':_0x3e0ee8['LOCK'][_0x7072('0x25')],'include':[{'model':db[_0x7072('0x1f')],'as':_0x7072('0x26'),'attributes':_[_0x7072('0x27')](_0x402a4e)},{'model':db[_0x7072('0x28')],'as':_0x7072('0x29'),'attributes':['id',_0x7072('0x2a'),_0x7072('0x2b')]}]})['then'](function(_0xdcabe3){var _0x20085e=[];var _0xe71d3a=[];for(var _0x23b744=0x0;_0x23b744<_0xdcabe3[_0x7072('0x2c')];_0x23b744+=0x1){var _0x4a8101=_0xdcabe3[_0x23b744][_0x7072('0x2d')];if(_0x4a8101===null){_0x20085e[_0x7072('0x2e')](_0xdcabe3[_0x23b744][_0x7072('0x2f')](_0x3ac65e['body'],{'transaction':_0x3e0ee8}));}else if(!_0xe71d3a[_0x7072('0x30')](_0x4a8101)){_0xe71d3a[_0x7072('0x2e')](_0x4a8101);_0x20085e[_0x7072('0x2e')](_0xdcabe3[_0x23b744][_0x7072('0x2f')](_0x3ac65e['body'],{'transaction':_0x3e0ee8}));}}return BPromise[_0x7072('0x31')](_0x20085e);});})[_0x7072('0x16')](function(_0x47225a){logger[_0x7072('0xf')]('GetContactDialer',_0x3ac65e);if(_0x47225a[_0x7072('0x2c')]>0x0){logger[_0x7072('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x47225a[0x0]['dataValues']['id'],_0x47225a[0x0][_0x7072('0x32')][_0x7072('0x33')],_0x47225a[0x0][_0x7072('0x32')]['active']);}logger[_0x7072('0x17')]('GetContactDialer',_0x3ac65e,JSON[_0x7072('0x11')](_0x47225a));_0x1145d9(_0x47225a);})[_0x7072('0x12')](function(_0x282867){logger[_0x7072('0x14')](_0x7072('0x34'),_0x282867['message'],_0x3ac65e);_0x6b2778(_0x4cad3c[_0x7072('0x14')](0x1f4,_0x282867[_0x7072('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x258cb9){var _0xe1c4c4=this;return new Promise(function(_0x5cdb1f,_0x76a630){return db[_0x7072('0x21')][_0x7072('0x22')](function(_0xc4d49){return db['CmHopperFinal'][_0x7072('0x35')](_0x258cb9[_0x7072('0x18')],{'raw':_0x258cb9[_0x7072('0x7')]?_0x258cb9[_0x7072('0x7')][_0x7072('0x8')]===undefined?!![]:![]:!![],'transaction':_0xc4d49})[_0x7072('0x16')](function(){logger[_0x7072('0xf')](_0x7072('0x36'),JSON[_0x7072('0x11')](_0x258cb9[_0x7072('0x7')][_0x7072('0x9')]),_0x258cb9['options'][_0x7072('0x9')]['active']);return db[_0x7072('0x6')][_0x7072('0x1e')]({'where':_0x258cb9['options']?_0x258cb9[_0x7072('0x7')][_0x7072('0x9')]||null:null,'transaction':_0xc4d49});});})[_0x7072('0x16')](function(_0x21893f){logger['info'](_0x7072('0x37'),_0x258cb9);logger[_0x7072('0x17')]('MoveContactManagedDialer',_0x258cb9,JSON[_0x7072('0x11')](_0x21893f));_0x5cdb1f(_0x21893f);})[_0x7072('0x12')](function(_0x5ad3e5){logger[_0x7072('0x14')](_0x7072('0x37'),_0x5ad3e5['message'],_0x258cb9);_0x76a630(_0xe1c4c4[_0x7072('0x14')](0x1f4,_0x5ad3e5[_0x7072('0x13')]));});});};exports[_0x7072('0x38')]=function(_0x30d64f){var _0x103bdd=this;return new Promise(function(_0x58d375,_0x274b49){return db[_0x7072('0x6')][_0x7072('0x23')]({'raw':_0x30d64f[_0x7072('0x7')]?_0x30d64f['options'][_0x7072('0x8')]===undefined?!![]:![]:!![],'where':_0x30d64f[_0x7072('0x7')]?_0x30d64f[_0x7072('0x7')][_0x7072('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0x7072('0x39'),db[_0x7072('0x21')]['fn']('IF',db[_0x7072('0x21')][_0x7072('0x3a')](_0x7072('0x3b')+util[_0x7072('0x3c')]('\x22%s\x22',moment()[_0x7072('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x7072('0x3d')))),_0x7072('0x3e')]]})[_0x7072('0x16')](function(_0x4ebb28){logger[_0x7072('0xf')]('CountReScheduled',_0x30d64f);logger['debug']('CountReScheduled',_0x30d64f,JSON[_0x7072('0x11')](_0x4ebb28));_0x58d375(_0x4ebb28);})[_0x7072('0x12')](function(_0x41c801){logger[_0x7072('0x14')]('CountReScheduled',_0x41c801[_0x7072('0x13')],_0x30d64f);_0x274b49(_0x103bdd[_0x7072('0x14')](0x1f4,_0x41c801['message']));});});};exports[_0x7072('0x3f')]=function(_0x7de2c8){var _0x14f842=this;return new Promise(function(_0x2d81ca,_0x3f7299){return db[_0x7072('0x1f')][_0x7072('0x20')]()[_0x7072('0x16')](function(){return db[_0x7072('0x21')][_0x7072('0x22')](function(_0x320fce){return db[_0x7072('0x6')][_0x7072('0x23')]({'where':_0x7de2c8[_0x7072('0x7')]?_0x7de2c8[_0x7072('0x7')]['where']||null:null,'attributes':_0x7de2c8[_0x7072('0x7')]?_0x7de2c8[_0x7072('0x7')][_0x7072('0xa')]||null:null,'limit':0x1,'order':_0x7de2c8[_0x7072('0x7')]?_0x7de2c8[_0x7072('0x7')]['order']||null:null,'group':db[_0x7072('0x6')][_0x7072('0x2d')],'transaction':_0x320fce,'lock':_0x320fce['LOCK'][_0x7072('0x25')],'include':_0x7de2c8['options']?_0x7de2c8[_0x7072('0x7')][_0x7072('0xc')]?_['map'](_0x7de2c8[_0x7072('0x7')][_0x7072('0xc')],function(_0x11c349){return{'model':db[_0x11c349[_0x7072('0xe')]],'as':_0x11c349['as'],'attributes':_0x11c349['attributes'],'include':_0x11c349['include']?_['map'](_0x11c349['include'],function(_0x52f3c9){return{'model':db[_0x52f3c9['model']],'as':_0x52f3c9['as'],'attributes':_0x52f3c9[_0x7072('0xa')],'include':_0x52f3c9[_0x7072('0xc')]?_[_0x7072('0xd')](_0x52f3c9[_0x7072('0xc')],function(_0x4d6d22){return{'model':db[_0x4d6d22[_0x7072('0xe')]],'as':_0x4d6d22['as'],'attributes':_0x4d6d22[_0x7072('0xa')]};}):[]};}):[]};}):[]:[]})[_0x7072('0x16')](function(_0x5d4273){var _0x2d8923=[];for(var _0x4f2f5f=0x0;_0x4f2f5f<_0x5d4273[_0x7072('0x2c')];_0x4f2f5f+=0x1){_0x2d8923['push'](_0x5d4273[_0x4f2f5f][_0x7072('0x2f')](_0x7de2c8[_0x7072('0x18')],{'transaction':_0x320fce}));}return BPromise[_0x7072('0x31')](_0x2d8923);});})[_0x7072('0x16')](function(_0x5aacda){logger['info']('GetContactRecallMe',_0x7de2c8);logger[_0x7072('0x17')](_0x7072('0x3f'),_0x7de2c8,JSON[_0x7072('0x11')](_0x5aacda));_0x2d81ca(_0x5aacda);})[_0x7072('0x12')](function(_0x548e47){logger[_0x7072('0x14')]('GetContactRecallMe',_0x548e47[_0x7072('0x13')],_0x7de2c8);_0x3f7299(_0x14f842[_0x7072('0x14')](0x1f4,_0x548e47[_0x7072('0x13')]));});});});};exports[_0x7072('0x40')]=function(_0x4c42b2){var _0xaf7a0=this;return new Promise(function(_0x4218af,_0x2f0c95){db[_0x7072('0x1f')][_0x7072('0x20')]()[_0x7072('0x16')](function(_0x43b29d){return db[_0x7072('0x6')]['findAll']({'raw':_0x4c42b2[_0x7072('0x7')]?_0x4c42b2[_0x7072('0x7')][_0x7072('0x8')]===undefined?!![]:![]:!![],'where':_0x4c42b2['options']?_0x4c42b2[_0x7072('0x7')][_0x7072('0x9')]||null:null,'attributes':_0x4c42b2['options']?_0x4c42b2[_0x7072('0x7')]['attributes']||null:null,'limit':_0x4c42b2['options']?_0x4c42b2[_0x7072('0x7')][_0x7072('0xb')]||null:null,'include':_0x4c42b2[_0x7072('0x7')]?_0x4c42b2[_0x7072('0x7')][_0x7072('0xc')]?_[_0x7072('0xd')](_0x4c42b2[_0x7072('0x7')][_0x7072('0xc')],function(_0x5922d0){return{'model':db[_0x5922d0['model']],'as':_0x5922d0['as'],'attributes':_0x5922d0['as']==='Contact'?_[_0x7072('0x27')](_0x43b29d):_0x5922d0[_0x7072('0xa')],'include':_0x5922d0[_0x7072('0xc')]?_[_0x7072('0xd')](_0x5922d0[_0x7072('0xc')],function(_0x22e51a){return{'model':db[_0x22e51a['model']],'as':_0x22e51a['as'],'attributes':_0x22e51a[_0x7072('0xa')],'include':_0x22e51a['include']?_[_0x7072('0xd')](_0x22e51a[_0x7072('0xc')],function(_0x40cc60){return{'model':db[_0x40cc60[_0x7072('0xe')]],'as':_0x40cc60['as'],'attributes':_0x40cc60[_0x7072('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be927){logger[_0x7072('0xf')](_0x7072('0x10'),_0x4c42b2);logger[_0x7072('0x17')](_0x7072('0x10'),_0x4c42b2,JSON[_0x7072('0x11')](_0x5be927));_0x4218af(_0x5be927);})[_0x7072('0x12')](function(_0x3cabfe){logger[_0x7072('0x14')](_0x7072('0x10'),_0x3cabfe[_0x7072('0x13')],_0x4c42b2);_0x2f0c95(_0xaf7a0['error'](0x1f4,_0x3cabfe[_0x7072('0x13')]));});});});};exports[_0x7072('0x41')]=function(_0xf4f151){var _0x3baf69=this;return new Promise(function(_0x4ae4e5,_0x559ce2){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0xf4f151[_0x7072('0x7')][_0x7072('0x9')][_0x7072('0x42')]},'attributes':['id',_0x7072('0x43')],'order':[['id',_0x7072('0x44')]]})['then'](function(_0x5a8fb6){logger[_0x7072('0xf')](_0x7072('0x45'),_0xf4f151);logger[_0x7072('0x17')](_0x7072('0x45'),_0xf4f151,JSON[_0x7072('0x11')](_0x5a8fb6));_0x4ae4e5(_0x5a8fb6);})[_0x7072('0x12')](function(_0x59d9f2){logger[_0x7072('0x14')](_0x7072('0x45'),_0x59d9f2[_0x7072('0x13')],_0xf4f151);_0x559ce2(_0x3baf69[_0x7072('0x14')](0x1f4,_0x59d9f2[_0x7072('0x13')]));});});};exports[_0x7072('0x46')]=function(_0x3044eb){var _0x206068=this;return new Promise(function(_0x5bc4e9,_0x4c98aa){return db[_0x7072('0x21')][_0x7072('0x22')](function(_0x3e353e){var _0x5a1ae7=_0x3044eb[_0x7072('0x7')]&&_0x3044eb[_0x7072('0x7')][_0x7072('0x9')]?_0x3044eb[_0x7072('0x7')]['where']:{};return db[_0x7072('0x6')][_0x7072('0x2f')](_0x3044eb[_0x7072('0x18')],{'where':_0x5a1ae7,'transaction':_0x3e353e})[_0x7072('0x16')](function(_0x2f29f6){logger[_0x7072('0xf')](_0x7072('0x46'),_0x3044eb);logger[_0x7072('0x17')](_0x7072('0x46'),_0x3044eb,JSON['stringify'](_0x2f29f6));_0x5bc4e9(_0x2f29f6);})['catch'](function(_0xc8c016){logger[_0x7072('0x14')](_0x7072('0x46'),_0xc8c016['message'],_0x3044eb);_0x4c98aa(_0x206068[_0x7072('0x14')](0x1f4,_0xc8c016[_0x7072('0x13')]));});});});};exports[_0x7072('0x47')]=function(_0x35f9fd){var _0x12b868=this;var _0x575d76=_0x35f9fd[_0x7072('0x18')]['where'][_0x7072('0x48')];var _0xb83bf6=_0x35f9fd[_0x7072('0x18')][_0x7072('0x9')]['interval'];var _0x3d15f9=_0x35f9fd['body'][_0x7072('0x9')][_0x7072('0x49')];return new Promise(function(_0x2f3a27,_0x426b4b){return db[_0x7072('0x6')][_0x7072('0x23')]({'where':{'voiceQueueId':{'$in':_0x575d76},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7072('0x21')][_0x7072('0x3a')](_0x7072('0x4a')+_0xb83bf6+_0x7072('0x4b')),'$gt':db[_0x7072('0x21')][_0x7072('0x3a')](_0x7072('0x4c'))}},'UserId':{'$in':_0x3d15f9}},'include':[{'model':db[_0x7072('0x1f')],'as':'Contact'},{'model':db[_0x7072('0x28')],'as':_0x7072('0x29'),'attributes':['id',_0x7072('0x2a'),'voicePause']},{'model':db[_0x7072('0x4d')],'as':_0x7072('0x4e')}]})['then'](function(_0x283d86){if(_0x283d86[_0x7072('0x2c')]>0x0){return db[_0x7072('0x21')][_0x7072('0x22')](function(_0x4b84d9){return db[_0x7072('0x6')][_0x7072('0x2f')]({'recallmeNotifiedDate':db[_0x7072('0x21')][_0x7072('0x3a')](_0x7072('0x4c'))},{'where':{'id':{'$in':_[_0x7072('0xd')](_0x283d86,'id')}},'transaction':_0x4b84d9})[_0x7072('0x16')](function(){_0x2f3a27(_0x283d86);})[_0x7072('0x12')](function(_0x5388fc){logger[_0x7072('0x14')](_0x7072('0x47'),_0x5388fc[_0x7072('0x13')],_0x35f9fd);_0x426b4b(_0x12b868[_0x7072('0x14')](0x1f4,_0x5388fc[_0x7072('0x13')]));});})['catch'](function(_0x4d9f2a){logger['error'](_0x7072('0x47'),_0x4d9f2a[_0x7072('0x13')],_0x35f9fd);_0x426b4b(_0x12b868[_0x7072('0x14')](0x1f4,_0x4d9f2a['message']));});}else{_0x2f3a27(_0x283d86);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3a6fc6d..9f6fea5 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 _0x8f64=['put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone'];(function(_0x12a4fa,_0x4b927e){var _0x5baea6=function(_0x2d9237){while(--_0x2d9237){_0x12a4fa['push'](_0x12a4fa['shift']());}};_0x5baea6(++_0x4b927e);}(_0x8f64,0x14a));var _0x48f6=function(_0xcf8a1f,_0x6646a1){_0xcf8a1f=_0xcf8a1f-0x0;var _0xaf9b14=_0x8f64[_0xcf8a1f];return _0xaf9b14;};'use strict';var express=require(_0x48f6('0x0'));var router=express[_0x48f6('0x1')]();var auth=require(_0x48f6('0x2'));var controller=require(_0x48f6('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x48f6('0x4')](_0x48f6('0x5'),auth[_0x48f6('0x6')](),controller[_0x48f6('0x7')]);router[_0x48f6('0x4')](_0x48f6('0x8'),auth['isAuthenticated'](),controller[_0x48f6('0x9')]);router[_0x48f6('0x4')](_0x48f6('0xa'),auth[_0x48f6('0x6')](),controller[_0x48f6('0xb')]);router['get'](_0x48f6('0xc'),auth[_0x48f6('0x6')](),controller[_0x48f6('0xd')]);router[_0x48f6('0x4')](_0x48f6('0xe'),auth[_0x48f6('0x6')](),controller['getPreviewRecall']);router[_0x48f6('0xf')]('/',auth['isAuthenticated'](),controller[_0x48f6('0x10')]);router[_0x48f6('0xf')](_0x48f6('0x11'),auth[_0x48f6('0x6')](),controller[_0x48f6('0x12')]);router['post'](_0x48f6('0x13'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x48f6('0x14')](_0x48f6('0xc'),auth[_0x48f6('0x6')](),controller[_0x48f6('0x15')]);router[_0x48f6('0x16')](_0x48f6('0xc'),auth['isAuthenticated'](),controller[_0x48f6('0x17')]);module[_0x48f6('0x18')]=router; \ No newline at end of file +var _0xe479=['destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','update','delete','/:id'];(function(_0x14a2e4,_0x9133cd){var _0x41e761=function(_0x549347){while(--_0x549347){_0x14a2e4['push'](_0x14a2e4['shift']());}};_0x41e761(++_0x9133cd);}(_0xe479,0xda));var _0x9e47=function(_0x223fee,_0x558b1f){_0x223fee=_0x223fee-0x0;var _0x5eb032=_0xe479[_0x223fee];return _0x5eb032;};'use strict';var express=require(_0x9e47('0x0'));var router=express[_0x9e47('0x1')]();var auth=require(_0x9e47('0x2'));var controller=require(_0x9e47('0x3'));router[_0x9e47('0x4')]('/',auth[_0x9e47('0x5')](),controller['index']);router[_0x9e47('0x4')]('/describe',auth[_0x9e47('0x5')](),controller[_0x9e47('0x6')]);router[_0x9e47('0x4')](_0x9e47('0x7'),auth[_0x9e47('0x5')](),controller[_0x9e47('0x8')]);router[_0x9e47('0x4')](_0x9e47('0x9'),auth[_0x9e47('0x5')](),controller[_0x9e47('0xa')]);router[_0x9e47('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x9e47('0xb')]);router[_0x9e47('0x4')](_0x9e47('0xc'),auth[_0x9e47('0x5')](),controller[_0x9e47('0xd')]);router[_0x9e47('0xe')]('/',auth[_0x9e47('0x5')](),controller[_0x9e47('0xf')]);router[_0x9e47('0xe')]('/preview',auth['isAuthenticated'](),controller[_0x9e47('0x10')]);router[_0x9e47('0xe')](_0x9e47('0x11'),auth['isAuthenticated'](),controller[_0x9e47('0x12')]);router['put']('/:id',auth[_0x9e47('0x5')](),controller[_0x9e47('0x13')]);router[_0x9e47('0x14')](_0x9e47('0x15'),auth[_0x9e47('0x5')](),controller[_0x9e47('0x16')]);module[_0x9e47('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 2fb0068..0cba5e9 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcac4=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER'];(function(_0x9cf5e1,_0x4ae91d){var _0xf97089=function(_0x181503){while(--_0x181503){_0x9cf5e1['push'](_0x9cf5e1['shift']());}};_0xf97089(++_0x4ae91d);}(_0xcac4,0x154));var _0x4cac=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xcac4[_0xd1d19a];return _0x52a79d;};'use strict';var moment=require(_0x4cac('0x0'));var Sequelize=require('sequelize');module[_0x4cac('0x1')]={'CmHopperId':{'type':Sequelize[_0x4cac('0x2')]},'phone':{'type':Sequelize[_0x4cac('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4cac('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4cac('0x4')],'defaultValue':moment()[_0x4cac('0x5')](_0x4cac('0x6'))},'countbusyretry':{'type':Sequelize[_0x4cac('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4cac('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4cac('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4cac('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd277=['sequelize','exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0xd277,0xbc));var _0x7d27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd277[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7d27('0x0'));var Sequelize=require(_0x7d27('0x1'));module[_0x7d27('0x2')]={'CmHopperId':{'type':Sequelize[_0x7d27('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7d27('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7d27('0x4')],'defaultValue':moment()[_0x7d27('0x5')](_0x7d27('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7d27('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d27('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7d27('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7d27('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7d27('0x3')],'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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2a07fa5..0177d51 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf96=['length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','set','reject','update','then','destroy','get','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields'];(function(_0x770cda,_0x2bf304){var _0x7e7f57=function(_0x4daa5c){while(--_0x4daa5c){_0x770cda['push'](_0x770cda['shift']());}};_0x7e7f57(++_0x2bf304);}(_0xdf96,0x6e));var _0x6df9=function(_0x1ce54f,_0x4a8970){_0x1ce54f=_0x1ce54f-0x0;var _0x203698=_0xdf96[_0x1ce54f];return _0x203698;};'use strict';var emlformat=require(_0x6df9('0x0'));var rimraf=require(_0x6df9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6df9('0x2'));var rp=require(_0x6df9('0x3'));var moment=require(_0x6df9('0x4'));var BPromise=require(_0x6df9('0x5'));var Mustache=require(_0x6df9('0x6'));var util=require(_0x6df9('0x7'));var path=require(_0x6df9('0x8'));var sox=require(_0x6df9('0x9'));var csv=require(_0x6df9('0xa'));var ejs=require(_0x6df9('0xb'));var fs=require('fs');var fs_extra=require(_0x6df9('0xc'));var _=require(_0x6df9('0xd'));var squel=require(_0x6df9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6df9('0xa'));var querystring=require(_0x6df9('0xf'));var Papa=require('papaparse');var Redis=require(_0x6df9('0x10'));var authService=require(_0x6df9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6df9('0x12'))(_0x6df9('0x13'));var utils=require('../../config/utils');var config=require(_0x6df9('0x14'));var licenseUtil=require(_0x6df9('0x15'));var db=require(_0x6df9('0x16'))['db'];function respondWithStatusCode(_0x373d74,_0x5c57fe){_0x5c57fe=_0x5c57fe||0xcc;return function(_0x4e3081){if(_0x4e3081){return _0x373d74[_0x6df9('0x17')](_0x5c57fe);}return _0x373d74[_0x6df9('0x18')](_0x5c57fe)['end']();};}function respondWithResult(_0x468026,_0x155ce1){_0x155ce1=_0x155ce1||0xc8;return function(_0xfce552){if(_0xfce552){return _0x468026[_0x6df9('0x18')](_0x155ce1)[_0x6df9('0x19')](_0xfce552);}};}function respondWithFilteredResult(_0x37c024,_0x20e9ac){return function(_0x253a16){if(_0x253a16){var _0x51eac1=typeof _0x20e9ac['offset']===_0x6df9('0x1a')&&typeof _0x20e9ac[_0x6df9('0x1b')]==='undefined';var _0x4e07e2=_0x253a16['count'];var _0x4a4f41=_0x51eac1?0x0:_0x20e9ac['offset'];var _0x21d871=_0x51eac1?_0x253a16['count']:_0x20e9ac['offset']+_0x20e9ac[_0x6df9('0x1b')];var _0x3d488f;if(_0x21d871>=_0x4e07e2){_0x21d871=_0x4e07e2;_0x3d488f=0xc8;}else{_0x3d488f=0xce;}_0x37c024[_0x6df9('0x18')](_0x3d488f);return _0x37c024[_0x6df9('0x1c')]('Content-Range',_0x4a4f41+'-'+_0x21d871+'/'+_0x4e07e2)[_0x6df9('0x19')](_0x253a16);}return null;};}function patchUpdates(_0x32e53e){return function(_0x4d67e8){try{jsonpatch['apply'](_0x4d67e8,_0x32e53e,!![]);}catch(_0xf6371){return BPromise[_0x6df9('0x1d')](_0xf6371);}return _0x4d67e8['save']();};}function saveUpdates(_0x2fe242,_0x561c11){return function(_0x8136ba){if(_0x8136ba){return _0x8136ba[_0x6df9('0x1e')](_0x2fe242)[_0x6df9('0x1f')](function(_0x34daa3){return _0x34daa3;});}return null;};}function removeEntity(_0x3971de,_0x2040cc){return function(_0x212a1c){if(_0x212a1c){return _0x212a1c[_0x6df9('0x20')]()[_0x6df9('0x1f')](function(){var _0x47b3da=_0x212a1c[_0x6df9('0x21')]({'plain':!![]});var _0x3e28ce='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x6df9('0x20')]({'where':{'type':_0x3e28ce,'resourceId':_0x47b3da['id']}})[_0x6df9('0x1f')](function(){return _0x212a1c;});})[_0x6df9('0x1f')](function(){_0x3971de[_0x6df9('0x18')](0xcc)[_0x6df9('0x22')]();});}};}function handleEntityNotFound(_0x3da9f7,_0x3c408f){return function(_0xead212){if(!_0xead212){_0x3da9f7['sendStatus'](0x194);}return _0xead212;};}function handleError(_0x3eb995,_0x3d79f2){_0x3d79f2=_0x3d79f2||0x1f4;return function(_0x1b8643){logger[_0x6df9('0x23')](_0x1b8643[_0x6df9('0x24')]);if(_0x1b8643[_0x6df9('0x25')]){delete _0x1b8643['name'];}_0x3eb995[_0x6df9('0x18')](_0x3d79f2)[_0x6df9('0x26')](_0x1b8643);};}exports[_0x6df9('0x27')]=function(_0x5c2837,_0x1d3802){var _0x2f5833={},_0x5cc85d={},_0x5f1851={'count':0x0,'rows':[]};var _0xac48be=_[_0x6df9('0x28')](db[_0x6df9('0x29')][_0x6df9('0x2a')],function(_0x332a86){return{'name':_0x332a86[_0x6df9('0x2b')],'type':_0x332a86[_0x6df9('0x2c')][_0x6df9('0x2d')]};});_0x5cc85d['model']=_['map'](_0xac48be,_0x6df9('0x25'));_0x5cc85d[_0x6df9('0x2e')]=_['keys'](_0x5c2837['query']);_0x5cc85d[_0x6df9('0x2f')]=_['intersection'](_0x5cc85d[_0x6df9('0x30')],_0x5cc85d[_0x6df9('0x2e')]);_0x2f5833[_0x6df9('0x31')]=_[_0x6df9('0x32')](_0x5cc85d[_0x6df9('0x30')],qs['fields'](_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x33')]));_0x2f5833['attributes']=_0x2f5833[_0x6df9('0x31')][_0x6df9('0x34')]?_0x2f5833[_0x6df9('0x31')]:_0x5cc85d[_0x6df9('0x30')];if(!_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x35')]('nolimit')){_0x2f5833[_0x6df9('0x1b')]=qs['limit'](_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x1b')]);_0x2f5833[_0x6df9('0x36')]=qs['offset'](_0x5c2837['query'][_0x6df9('0x36')]);}_0x2f5833['order']=qs[_0x6df9('0x37')](_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x37')]);_0x2f5833[_0x6df9('0x38')]=qs[_0x6df9('0x2f')](_[_0x6df9('0x39')](_0x5c2837[_0x6df9('0x2e')],_0x5cc85d['filters']),_0xac48be);if(_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x3a')]){_0x2f5833[_0x6df9('0x38')]=_[_0x6df9('0x3b')](_0x2f5833['where'],{'$or':_[_0x6df9('0x28')](_0xac48be,function(_0x2c5de4){if(_0x2c5de4['type']!==_0x6df9('0x3c')){var _0x46d4df={};_0x46d4df[_0x2c5de4[_0x6df9('0x25')]]={'$like':'%'+_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x3a')]+'%'};return _0x46d4df;}})});}_0x2f5833=_[_0x6df9('0x3b')]({},_0x2f5833,_0x5c2837['options']);var _0x1b48f5={'where':_0x2f5833[_0x6df9('0x38')]};return db[_0x6df9('0x29')]['count'](_0x1b48f5)[_0x6df9('0x1f')](function(_0xe01ff4){_0x5f1851['count']=_0xe01ff4;if(_0x5c2837[_0x6df9('0x2e')][_0x6df9('0x3d')]){_0x2f5833[_0x6df9('0x3e')]=[{'all':!![]}];}return db[_0x6df9('0x29')][_0x6df9('0x3f')](_0x2f5833);})[_0x6df9('0x1f')](function(_0x228040){_0x5f1851['rows']=_0x228040;return _0x5f1851;})[_0x6df9('0x1f')](respondWithFilteredResult(_0x1d3802,_0x2f5833))[_0x6df9('0x40')](handleError(_0x1d3802,null));};exports[_0x6df9('0x41')]=function(_0x33130e,_0x47066e){var _0x232035={'raw':!![],'where':{'id':_0x33130e[_0x6df9('0x42')]['id']}},_0x5467a7={};_0x5467a7[_0x6df9('0x30')]=_[_0x6df9('0x43')](db[_0x6df9('0x29')][_0x6df9('0x2a')]);_0x5467a7[_0x6df9('0x2e')]=_[_0x6df9('0x43')](_0x33130e['query']);_0x5467a7['filters']=_[_0x6df9('0x32')](_0x5467a7[_0x6df9('0x30')],_0x5467a7['query']);_0x232035[_0x6df9('0x31')]=_['intersection'](_0x5467a7['model'],qs[_0x6df9('0x33')](_0x33130e[_0x6df9('0x2e')][_0x6df9('0x33')]));_0x232035['attributes']=_0x232035[_0x6df9('0x31')]['length']?_0x232035[_0x6df9('0x31')]:_0x5467a7[_0x6df9('0x30')];if(_0x33130e[_0x6df9('0x2e')][_0x6df9('0x3d')]){_0x232035[_0x6df9('0x3e')]=[{'all':!![]}];}_0x232035=_[_0x6df9('0x3b')]({},_0x232035,_0x33130e[_0x6df9('0x44')]);return db[_0x6df9('0x29')][_0x6df9('0x45')](_0x232035)[_0x6df9('0x1f')](handleEntityNotFound(_0x47066e,null))[_0x6df9('0x1f')](respondWithResult(_0x47066e,null))[_0x6df9('0x40')](handleError(_0x47066e,null));};exports[_0x6df9('0x46')]=function(_0x3cf8bf,_0x453780){return db[_0x6df9('0x29')]['create'](_0x3cf8bf[_0x6df9('0x47')],{})[_0x6df9('0x1f')](function(_0x3b4218){var _0x4b8c90=_0x3cf8bf[_0x6df9('0x48')][_0x6df9('0x21')]({'plain':!![]});if(!_0x4b8c90)throw new Error(_0x6df9('0x49'));if(_0x4b8c90[_0x6df9('0x4a')]===_0x6df9('0x48')){var _0x5ae0fe=_0x3b4218[_0x6df9('0x21')]({'plain':!![]});var _0x46c289=_0x6df9('0x4b');return db[_0x6df9('0x4c')][_0x6df9('0x45')]({'where':{'name':_0x46c289,'userProfileId':_0x4b8c90[_0x6df9('0x4d')]},'raw':!![]})[_0x6df9('0x1f')](function(_0xbe71f7){if(_0xbe71f7&&_0xbe71f7[_0x6df9('0x4e')]===0x0){return db[_0x6df9('0x4f')][_0x6df9('0x46')]({'name':_0x5ae0fe[_0x6df9('0x25')],'resourceId':_0x5ae0fe['id'],'type':_0xbe71f7[_0x6df9('0x25')],'sectionId':_0xbe71f7['id']},{})[_0x6df9('0x1f')](function(){return _0x3b4218;});}else{return _0x3b4218;}})[_0x6df9('0x40')](function(_0x495578){logger['error'](_0x6df9('0x50'),_0x495578);throw _0x495578;});}return _0x3b4218;})[_0x6df9('0x1f')](respondWithResult(_0x453780,0xc9))['catch'](handleError(_0x453780,null));};exports[_0x6df9('0x1e')]=function(_0x119ac9,_0x26accd){if(_0x119ac9[_0x6df9('0x47')]['id']){delete _0x119ac9[_0x6df9('0x47')]['id'];}return db[_0x6df9('0x29')]['find']({'where':{'id':_0x119ac9[_0x6df9('0x42')]['id']}})[_0x6df9('0x1f')](handleEntityNotFound(_0x26accd,null))[_0x6df9('0x1f')](saveUpdates(_0x119ac9[_0x6df9('0x47')],null))[_0x6df9('0x1f')](respondWithResult(_0x26accd,null))[_0x6df9('0x40')](handleError(_0x26accd,null));};exports[_0x6df9('0x20')]=function(_0x310e4b,_0x3f444a){return db[_0x6df9('0x29')][_0x6df9('0x45')]({'where':{'id':_0x310e4b[_0x6df9('0x42')]['id']}})[_0x6df9('0x1f')](handleEntityNotFound(_0x3f444a,null))['then'](removeEntity(_0x3f444a,null))[_0x6df9('0x40')](handleError(_0x3f444a,null));}; \ No newline at end of file +var _0x573e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x30319c,_0x322bf7){var _0x175099=function(_0x1af694){while(--_0x1af694){_0x30319c['push'](_0x30319c['shift']());}};_0x175099(++_0x322bf7);}(_0x573e,0x1e9));var _0xe573=function(_0x14ec37,_0x11118c){_0x14ec37=_0x14ec37-0x0;var _0x10bf3b=_0x573e[_0x14ec37];return _0x10bf3b;};'use strict';var emlformat=require(_0xe573('0x0'));var rimraf=require(_0xe573('0x1'));var zipdir=require(_0xe573('0x2'));var jsonpatch=require(_0xe573('0x3'));var rp=require(_0xe573('0x4'));var moment=require(_0xe573('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe573('0x6'));var util=require('util');var path=require(_0xe573('0x7'));var sox=require('sox');var csv=require(_0xe573('0x8'));var ejs=require(_0xe573('0x9'));var fs=require('fs');var fs_extra=require(_0xe573('0xa'));var _=require('lodash');var squel=require(_0xe573('0xb'));var crypto=require(_0xe573('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe573('0xd'));var toCsv=require(_0xe573('0x8'));var querystring=require(_0xe573('0xe'));var Papa=require(_0xe573('0xf'));var Redis=require(_0xe573('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe573('0x11'));var as=require(_0xe573('0x12'));var hardwareService=require(_0xe573('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe573('0x14'));var config=require(_0xe573('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe573('0x16'))['db'];function respondWithStatusCode(_0x31a1d2,_0x5ea37c){_0x5ea37c=_0x5ea37c||0xcc;return function(_0x3291f9){if(_0x3291f9){return _0x31a1d2[_0xe573('0x17')](_0x5ea37c);}return _0x31a1d2[_0xe573('0x18')](_0x5ea37c)[_0xe573('0x19')]();};}function respondWithResult(_0x20dd23,_0x5547ff){_0x5547ff=_0x5547ff||0xc8;return function(_0x4eb606){if(_0x4eb606){return _0x20dd23[_0xe573('0x18')](_0x5547ff)[_0xe573('0x1a')](_0x4eb606);}};}function respondWithFilteredResult(_0x1581b8,_0x276920){return function(_0x4cd32b){if(_0x4cd32b){var _0x34268d=typeof _0x276920[_0xe573('0x1b')]===_0xe573('0x1c')&&typeof _0x276920[_0xe573('0x1d')]===_0xe573('0x1c');var _0x1d30f0=_0x4cd32b[_0xe573('0x1e')];var _0x3986b9=_0x34268d?0x0:_0x276920[_0xe573('0x1b')];var _0x124f72=_0x34268d?_0x4cd32b[_0xe573('0x1e')]:_0x276920[_0xe573('0x1b')]+_0x276920[_0xe573('0x1d')];var _0x20f8d8;if(_0x124f72>=_0x1d30f0){_0x124f72=_0x1d30f0;_0x20f8d8=0xc8;}else{_0x20f8d8=0xce;}_0x1581b8[_0xe573('0x18')](_0x20f8d8);return _0x1581b8[_0xe573('0x1f')](_0xe573('0x20'),_0x3986b9+'-'+_0x124f72+'/'+_0x1d30f0)[_0xe573('0x1a')](_0x4cd32b);}return null;};}function patchUpdates(_0x43b012){return function(_0x33a302){try{jsonpatch[_0xe573('0x21')](_0x33a302,_0x43b012,!![]);}catch(_0x1411f1){return BPromise[_0xe573('0x22')](_0x1411f1);}return _0x33a302[_0xe573('0x23')]();};}function saveUpdates(_0x25c233,_0x3e4e1b){return function(_0x4ba1ba){if(_0x4ba1ba){return _0x4ba1ba['update'](_0x25c233)[_0xe573('0x24')](function(_0x358670){return _0x358670;});}return null;};}function removeEntity(_0x20cb77,_0x385aa3){return function(_0xbc3add){if(_0xbc3add){return _0xbc3add[_0xe573('0x25')]()[_0xe573('0x24')](function(){var _0x3573c2=_0xbc3add[_0xe573('0x26')]({'plain':!![]});var _0x9d3dd9=_0xe573('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x9d3dd9,'resourceId':_0x3573c2['id']}})[_0xe573('0x24')](function(){return _0xbc3add;});})[_0xe573('0x24')](function(){_0x20cb77[_0xe573('0x18')](0xcc)[_0xe573('0x19')]();});}};}function handleEntityNotFound(_0x3914ac,_0x47abb7){return function(_0x96ad0f){if(!_0x96ad0f){_0x3914ac[_0xe573('0x17')](0x194);}return _0x96ad0f;};}function handleError(_0x2717a4,_0x56c577){_0x56c577=_0x56c577||0x1f4;return function(_0x464399){logger[_0xe573('0x28')](_0x464399['stack']);if(_0x464399[_0xe573('0x29')]){delete _0x464399[_0xe573('0x29')];}_0x2717a4[_0xe573('0x18')](_0x56c577)[_0xe573('0x2a')](_0x464399);};}exports[_0xe573('0x2b')]=function(_0x228853,_0x295607){var _0x1366ab={},_0x462674={},_0x46f57b={'count':0x0,'rows':[]};var _0x2dd890=_[_0xe573('0x2c')](db[_0xe573('0x2d')][_0xe573('0x2e')],function(_0x43a1f0){return{'name':_0x43a1f0[_0xe573('0x2f')],'type':_0x43a1f0[_0xe573('0x30')][_0xe573('0x31')]};});_0x462674[_0xe573('0x32')]=_['map'](_0x2dd890,_0xe573('0x29'));_0x462674['query']=_[_0xe573('0x33')](_0x228853[_0xe573('0x34')]);_0x462674[_0xe573('0x35')]=_[_0xe573('0x36')](_0x462674[_0xe573('0x32')],_0x462674[_0xe573('0x34')]);_0x1366ab[_0xe573('0x37')]=_[_0xe573('0x36')](_0x462674[_0xe573('0x32')],qs[_0xe573('0x38')](_0x228853[_0xe573('0x34')]['fields']));_0x1366ab[_0xe573('0x37')]=_0x1366ab[_0xe573('0x37')][_0xe573('0x39')]?_0x1366ab[_0xe573('0x37')]:_0x462674['model'];if(!_0x228853['query']['hasOwnProperty'](_0xe573('0x3a'))){_0x1366ab[_0xe573('0x1d')]=qs[_0xe573('0x1d')](_0x228853[_0xe573('0x34')][_0xe573('0x1d')]);_0x1366ab[_0xe573('0x1b')]=qs[_0xe573('0x1b')](_0x228853[_0xe573('0x34')][_0xe573('0x1b')]);}_0x1366ab[_0xe573('0x3b')]=qs[_0xe573('0x3c')](_0x228853[_0xe573('0x34')][_0xe573('0x3c')]);_0x1366ab[_0xe573('0x3d')]=qs[_0xe573('0x35')](_['pick'](_0x228853['query'],_0x462674['filters']),_0x2dd890);if(_0x228853[_0xe573('0x34')][_0xe573('0x3e')]){_0x1366ab[_0xe573('0x3d')]=_[_0xe573('0x3f')](_0x1366ab[_0xe573('0x3d')],{'$or':_[_0xe573('0x2c')](_0x2dd890,function(_0x553fa1){if(_0x553fa1[_0xe573('0x30')]!==_0xe573('0x40')){var _0x26fb30={};_0x26fb30[_0x553fa1[_0xe573('0x29')]]={'$like':'%'+_0x228853[_0xe573('0x34')]['filter']+'%'};return _0x26fb30;}})});}_0x1366ab=_[_0xe573('0x3f')]({},_0x1366ab,_0x228853[_0xe573('0x41')]);var _0x557aae={'where':_0x1366ab[_0xe573('0x3d')]};return db[_0xe573('0x2d')][_0xe573('0x1e')](_0x557aae)[_0xe573('0x24')](function(_0x839bb2){_0x46f57b[_0xe573('0x1e')]=_0x839bb2;if(_0x228853[_0xe573('0x34')][_0xe573('0x42')]){_0x1366ab[_0xe573('0x43')]=[{'all':!![]}];}return db[_0xe573('0x2d')]['findAll'](_0x1366ab);})['then'](function(_0x2fd89e){_0x46f57b[_0xe573('0x44')]=_0x2fd89e;return _0x46f57b;})[_0xe573('0x24')](respondWithFilteredResult(_0x295607,_0x1366ab))['catch'](handleError(_0x295607,null));};exports[_0xe573('0x45')]=function(_0x22e887,_0x40ee2e){var _0x4785b3={'raw':!![],'where':{'id':_0x22e887[_0xe573('0x46')]['id']}},_0x346bf5={};_0x346bf5[_0xe573('0x32')]=_[_0xe573('0x33')](db[_0xe573('0x2d')]['rawAttributes']);_0x346bf5['query']=_['keys'](_0x22e887['query']);_0x346bf5[_0xe573('0x35')]=_['intersection'](_0x346bf5['model'],_0x346bf5[_0xe573('0x34')]);_0x4785b3[_0xe573('0x37')]=_[_0xe573('0x36')](_0x346bf5['model'],qs[_0xe573('0x38')](_0x22e887['query'][_0xe573('0x38')]));_0x4785b3[_0xe573('0x37')]=_0x4785b3[_0xe573('0x37')][_0xe573('0x39')]?_0x4785b3[_0xe573('0x37')]:_0x346bf5['model'];if(_0x22e887[_0xe573('0x34')][_0xe573('0x42')]){_0x4785b3['include']=[{'all':!![]}];}_0x4785b3=_['merge']({},_0x4785b3,_0x22e887[_0xe573('0x41')]);return db[_0xe573('0x2d')][_0xe573('0x47')](_0x4785b3)[_0xe573('0x24')](handleEntityNotFound(_0x40ee2e,null))[_0xe573('0x24')](respondWithResult(_0x40ee2e,null))[_0xe573('0x48')](handleError(_0x40ee2e,null));};exports[_0xe573('0x49')]=function(_0x41d82a,_0x306f4e){return db[_0xe573('0x2d')]['create'](_0x41d82a['body'],{})[_0xe573('0x24')](function(_0x6e1c46){var _0x36245e=_0x41d82a['user']['get']({'plain':!![]});if(!_0x36245e)throw new Error(_0xe573('0x4a'));if(_0x36245e[_0xe573('0x4b')]===_0xe573('0x4c')){var _0x5bb3c4=_0x6e1c46[_0xe573('0x26')]({'plain':!![]});var _0x25db4e=_0xe573('0x27');return db[_0xe573('0x4d')][_0xe573('0x47')]({'where':{'name':_0x25db4e,'userProfileId':_0x36245e['userProfileId']},'raw':!![]})[_0xe573('0x24')](function(_0x2628e1){if(_0x2628e1&&_0x2628e1['autoAssociation']===0x0){return db['UserProfileResource'][_0xe573('0x49')]({'name':_0x5bb3c4[_0xe573('0x29')],'resourceId':_0x5bb3c4['id'],'type':_0x2628e1[_0xe573('0x29')],'sectionId':_0x2628e1['id']},{})[_0xe573('0x24')](function(){return _0x6e1c46;});}else{return _0x6e1c46;}})['catch'](function(_0x1aa5db){logger['error'](_0xe573('0x4e'),_0x1aa5db);throw _0x1aa5db;});}return _0x6e1c46;})['then'](respondWithResult(_0x306f4e,0xc9))[_0xe573('0x48')](handleError(_0x306f4e,null));};exports[_0xe573('0x4f')]=function(_0x2892d9,_0x374365){if(_0x2892d9[_0xe573('0x50')]['id']){delete _0x2892d9[_0xe573('0x50')]['id'];}return db[_0xe573('0x2d')]['find']({'where':{'id':_0x2892d9['params']['id']}})[_0xe573('0x24')](handleEntityNotFound(_0x374365,null))[_0xe573('0x24')](saveUpdates(_0x2892d9['body'],null))[_0xe573('0x24')](respondWithResult(_0x374365,null))['catch'](handleError(_0x374365,null));};exports[_0xe573('0x25')]=function(_0x1fa334,_0x43047d){return db['CmHopperAdditionalPhone'][_0xe573('0x47')]({'where':{'id':_0x1fa334[_0xe573('0x46')]['id']}})[_0xe573('0x24')](handleEntityNotFound(_0x43047d,null))[_0xe573('0x24')](removeEntity(_0x43047d,null))['catch'](handleError(_0x43047d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 335dfba..6b6d9c6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf722=['../../config/environment','exports','lodash','util','../../config/logger','api','request-promise'];(function(_0x36bf36,_0x185b5f){var _0xabc2a2=function(_0x4d447d){while(--_0x4d447d){_0x36bf36['push'](_0x36bf36['shift']());}};_0xabc2a2(++_0x185b5f);}(_0xf722,0xb1));var _0x2f72=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf722[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var logger=require(_0x2f72('0x2'))(_0x2f72('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f72('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x2f72('0x6')]=function(_0x4e716e,_0x39dcc0){return _0x4e716e['define']('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec3f=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec3f,0x1ee));var _0xfec3=function(_0x1df951,_0x405a24){_0x1df951=_0x1df951-0x0;var _0xcd27a8=_0xec3f[_0x1df951];return _0xcd27a8;};'use strict';var _=require(_0xfec3('0x0'));var util=require(_0xfec3('0x1'));var logger=require(_0xfec3('0x2'))(_0xfec3('0x3'));var moment=require(_0xfec3('0x4'));var BPromise=require(_0xfec3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfec3('0x6'));var config=require(_0xfec3('0x7'));var attributes=require(_0xfec3('0x8'));module[_0xfec3('0x9')]=function(_0x29dfe9,_0x21fd87){return _0x29dfe9[_0xfec3('0xa')](_0xfec3('0xb'),attributes,{'tableName':_0xfec3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 35af4a6..6a41ed5 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf485=['http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countbusyretry','countnosuchnumberretry','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x31b24f,_0x5609d4){var _0x3f646b=function(_0x51be24){while(--_0x51be24){_0x31b24f['push'](_0x31b24f['shift']());}};_0x3f646b(++_0x5609d4);}(_0xf485,0x1af));var _0x5f48=function(_0x5a2d02,_0x1193e4){_0x5a2d02=_0x5a2d02-0x0;var _0x22520c=_0xf485[_0x5a2d02];return _0x22520c;};'use strict';var _=require(_0x5f48('0x0'));var util=require('util');var moment=require(_0x5f48('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f48('0x2'));var fs=require('fs');var Redis=require(_0x5f48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f48('0x4'));var logger=require(_0x5f48('0x5'))(_0x5f48('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f48('0x7'));var client=jayson[_0x5f48('0x8')][_0x5f48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x427713,_0x2013b2,_0x475a1a){return new BPromise(function(_0x1c33dd,_0x3ea948){return client[_0x5f48('0xa')](_0x427713,_0x475a1a)['then'](function(_0x1cfc7f){logger[_0x5f48('0xb')](_0x5f48('0xc'),_0x2013b2,_0x5f48('0xd'));logger[_0x5f48('0xe')](_0x5f48('0xf'),_0x2013b2,_0x5f48('0xd'),JSON['stringify'](_0x1cfc7f));if(_0x1cfc7f[_0x5f48('0x10')]){if(_0x1cfc7f[_0x5f48('0x10')]['code']===0x1f4){logger[_0x5f48('0x10')](_0x5f48('0xc'),_0x2013b2,_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);return _0x3ea948(_0x1cfc7f[_0x5f48('0x10')]['message']);}logger['error'](_0x5f48('0xc'),_0x2013b2,_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);return _0x1c33dd(_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);}else{logger[_0x5f48('0xb')](_0x5f48('0xc'),_0x2013b2,_0x5f48('0xd'));_0x1c33dd(_0x1cfc7f['result'][_0x5f48('0x11')]);}})[_0x5f48('0x12')](function(_0x29adc2){logger[_0x5f48('0x10')](_0x5f48('0xc'),_0x2013b2,_0x29adc2);_0x3ea948(_0x29adc2);});});}exports['VerifyAdditionalPhones']=function(_0x1d6054){var _0x761798=this;return new Promise(function(_0x36896c,_0x20ad28){return db[_0x5f48('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x1d6054[_0x5f48('0x14')][_0x5f48('0x15')],'ListId':_0x1d6054[_0x5f48('0x14')][_0x5f48('0x16')],'VoiceQueueId':_0x1d6054[_0x5f48('0x14')][_0x5f48('0x17')]===undefined?null:_0x1d6054[_0x5f48('0x14')][_0x5f48('0x17')],'CampaignId':_0x1d6054['body']['CampaignId']===undefined?null:_0x1d6054[_0x5f48('0x14')][_0x5f48('0x18')]}})['then'](function(_0x40ab87){if(_0x40ab87!=null){return db[_0x5f48('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x40ab87['id'],'OrderBy':{'$gt':_0x40ab87[_0x5f48('0x1a')]}},'order':[['OrderBy',_0x5f48('0x1b')]]})[_0x5f48('0x1c')](function(_0x181fc5){var _0x4b99a7=0x0;if(_0x181fc5){if(_0x181fc5['countbusyretry']+_0x181fc5[_0x5f48('0x1d')]+_0x181fc5[_0x5f48('0x1e')]+_0x181fc5['countnosuchnumberretry']+_0x181fc5['countdropretry']+_0x181fc5[_0x5f48('0x1f')]+_0x181fc5['countmachineretry']+_0x181fc5[_0x5f48('0x20')]<_0x1d6054[_0x5f48('0x21')][_0x5f48('0x22')])_0x4b99a7=0x1;_0x36896c({'additional':_0x4b99a7});}else{return db[_0x5f48('0x19')][_0x5f48('0x23')]({'raw':!![],'where':{'CmHopperId':_0x40ab87['id']},'order':[[_0x5f48('0x1a'),_0x5f48('0x1b')]]})[_0x5f48('0x1c')](function(_0x16a0cd){var _0x4731ab=0x0;if(_0x16a0cd){if(_0x16a0cd[_0x5f48('0x24')]+_0x16a0cd[_0x5f48('0x1d')]+_0x16a0cd[_0x5f48('0x1e')]+_0x16a0cd[_0x5f48('0x25')]+_0x16a0cd['countdropretry']+_0x16a0cd[_0x5f48('0x1f')]+_0x16a0cd[_0x5f48('0x26')]+_0x16a0cd[_0x5f48('0x20')]<_0x1d6054['entity'][_0x5f48('0x22')])_0x4731ab=0x1;_0x36896c({'additional':_0x4731ab});}else{_0x36896c({'additional':0x0});}})[_0x5f48('0x12')](function(_0x1a244a){logger[_0x5f48('0x10')](_0x5f48('0x27'),_0x1a244a['message']);_0x20ad28(_0x761798[_0x5f48('0x10')](0x1f4,_0x1a244a['message']));});}})[_0x5f48('0x12')](function(_0x432d21){logger[_0x5f48('0x10')](_0x5f48('0x27'),_0x432d21[_0x5f48('0x11')]);_0x20ad28(_0x761798[_0x5f48('0x10')](0x1f4,_0x432d21[_0x5f48('0x11')]));});}else _0x36896c({'additional':0x0});});});};exports[_0x5f48('0x28')]=function(_0x257d04){var _0x1fbd2d=this;return new Promise(function(_0xe91cc5,_0x46734d){return db['CmHopper'][_0x5f48('0x23')]({'raw':!![],'where':{'ContactId':_0x257d04[_0x5f48('0x14')][_0x5f48('0x15')],'ListId':_0x257d04['body'][_0x5f48('0x16')],'VoiceQueueId':_0x257d04['body'][_0x5f48('0x17')]===undefined?null:_0x257d04[_0x5f48('0x14')][_0x5f48('0x17')],'CampaignId':_0x257d04[_0x5f48('0x14')][_0x5f48('0x18')]===undefined?null:_0x257d04[_0x5f48('0x14')]['CampaignId']}})['then'](function(_0x4c4a21){if(_0x4c4a21!=null){return db[_0x5f48('0x19')][_0x5f48('0x23')]({'raw':!![],'where':{'CmHopperId':_0x4c4a21['id'],'OrderBy':{'$gte':_0x4c4a21['OrderBy']}},'order':[[_0x5f48('0x1a'),_0x5f48('0x1b')]]})[_0x5f48('0x1c')](function(_0x1b8784){if(_0x1b8784)return activateAdditionalPhone(_0x4c4a21,_0x257d04[_0x5f48('0x14')],_0x1b8784,_0x257d04[_0x5f48('0x29')],_0x257d04[_0x5f48('0x2a')])[_0x5f48('0x1c')](function(_0xc1a98d){_0xe91cc5(_0xc1a98d);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4c4a21['id']},'order':[['OrderBy',_0x5f48('0x1b')]]})[_0x5f48('0x1c')](function(_0x10b9a6){if(_0x10b9a6)return activateAdditionalPhone(_0x4c4a21,_0x257d04[_0x5f48('0x14')],_0x10b9a6,_0x257d04[_0x5f48('0x29')],_0x257d04['waitTime'])[_0x5f48('0x1c')](function(_0x153267){_0xe91cc5(_0x153267);});else{_0xe91cc5({'id':_0x4c4a21['id'],'phone':''});}})[_0x5f48('0x12')](function(_0xa0c646){logger[_0x5f48('0x10')](_0x5f48('0x27'),_0xa0c646[_0x5f48('0x11')]);_0x46734d(_0x1fbd2d['error'](0x1f4,_0xa0c646[_0x5f48('0x11')]));});}})[_0x5f48('0x12')](function(_0x6c84e1){logger[_0x5f48('0x10')](_0x5f48('0x27'),_0x6c84e1['message']);_0x46734d(_0x1fbd2d['error'](0x1f4,_0x6c84e1[_0x5f48('0x11')]));});}else _0xe91cc5(0x1);});});};function activateAdditionalPhone(_0x43a7cc,_0x4a53c0,_0x1c5884,_0x5cbd30,_0x885911){return new Promise(function(_0x9b3da7,_0x4f3ff5){var _0x1baa73;if(_[_0x5f48('0x2b')](_0x1c5884['scheduledat'])){_0x1c5884['scheduledat']=moment();}if(moment()>moment(_0x1c5884[_0x5f48('0x2c')])){_0x1baa73=moment()[_0x5f48('0x2d')](_0x885911||0x3,_0x5f48('0x2e'));}else{if(_0x1c5884[_0x5f48('0x1a')]==0x0){_0x1baa73=moment(_0x1c5884[_0x5f48('0x2c')]);}else{_0x1baa73=moment()[_0x5f48('0x2d')](_0x885911||0x3,_0x5f48('0x2e'));}}if(_[_0x5f48('0x2b')](_0x1baa73)){_0x1baa73=moment()[_0x5f48('0x2d')](_0x885911||0x3,_0x5f48('0x2e'));}var _0x1460fb={'phone':_0x43a7cc['phone'],'active':0x0,'OrderBy':_[_0x5f48('0x2b')](_0x43a7cc[_0x5f48('0x1a')])?0x0:_0x43a7cc[_0x5f48('0x1a')],'scheduledat':moment()[_0x5f48('0x2d')](_0x5cbd30||0x1,'minutes'),'countbusyretry':_0x4a53c0[_0x5f48('0x24')],'countcongestionretry':_0x4a53c0['countcongestionretry'],'countnoanswerretry':_0x4a53c0[_0x5f48('0x1e')],'countnosuchnumberretry':_0x4a53c0[_0x5f48('0x25')],'countdropretry':_0x4a53c0['countdropretry'],'countabandonedretry':_0x4a53c0[_0x5f48('0x1f')],'countmachineretry':_0x4a53c0[_0x5f48('0x26')],'countagentrejectretry':_0x4a53c0[_0x5f48('0x20')],'createdAt':_0x4a53c0[_0x5f48('0x2f')],'updatedAt':_0x4a53c0['updatedAt']};var _0xf98039={'CmHopperId':_0x43a7cc['id'],'phone':_0x1c5884[_0x5f48('0x30')],'active':0x0,'OrderBy':_[_0x5f48('0x2b')](_0x1c5884[_0x5f48('0x1a')])?0x0:_0x1c5884[_0x5f48('0x1a')],'scheduledat':_0x1baa73,'countbusyretry':_0x1c5884[_0x5f48('0x24')],'countcongestionretry':_0x1c5884[_0x5f48('0x1d')],'countnoanswerretry':_0x1c5884[_0x5f48('0x1e')],'countnosuchnumberretry':_0x1c5884[_0x5f48('0x25')],'countdropretry':_0x1c5884['countdropretry'],'countabandonedretry':_0x1c5884[_0x5f48('0x1f')],'countmachineretry':_0x1c5884[_0x5f48('0x26')],'countagentrejectretry':_0x1c5884[_0x5f48('0x20')],'createdAt':_0x1c5884[_0x5f48('0x2f')],'updatedAt':_0x1c5884['updatedAt']};return db[_0x5f48('0x31')][_0x5f48('0x32')](function(_0x5b9ecc){return db[_0x5f48('0x19')][_0x5f48('0x33')](_0x1460fb,{'where':{'id':_0x1c5884['id']}},{'transaction':_0x5b9ecc})['then'](function(){return db[_0x5f48('0x13')][_0x5f48('0x33')](_0xf98039,{'where':{'id':_0x43a7cc['id']}},{'transaction':_0x5b9ecc});});})[_0x5f48('0x1c')](function(_0x5a4b69){_0x9b3da7({'id':_0x43a7cc['id'],'phone':_0x1c5884['phone']});})['catch'](function(_0x55afb4){logger[_0x5f48('0x10')](_0x5f48('0x34'),_0x55afb4[_0x5f48('0x11')]);_0x4f3ff5({'error':_0x55afb4['message']});});});}exports[_0x5f48('0x35')]=function(_0x50fae9){var _0x1676f5=this;return new Promise(function(_0x2edc25,_0xeeaee){return db['CmHopper'][_0x5f48('0x33')](_0x50fae9[_0x5f48('0x14')][_0x5f48('0x36')],{'where':{'id':_0x50fae9[_0x5f48('0x14')]['id']}})[_0x5f48('0x1c')](function(_0xd8374c){_0x2edc25(_0xd8374c);})[_0x5f48('0x12')](function(_0x11bc0d){logger[_0x5f48('0x10')](_0x5f48('0x35'),_0x11bc0d[_0x5f48('0x11')]);_0xeeaee(_0x1676f5[_0x5f48('0x10')](0x1f4,_0x11bc0d['message']));});});}; \ No newline at end of file +var _0x539e=['isNil','add','countabandonedretry','createdAt','updatedAt','phone','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countcongestionretry','entity','duration','waitTime','scheduledat','minutes'];(function(_0x3ed07c,_0x414025){var _0x5c32bc=function(_0x322d47){while(--_0x322d47){_0x3ed07c['push'](_0x3ed07c['shift']());}};_0x5c32bc(++_0x414025);}(_0x539e,0x127));var _0xe539=function(_0x372c7c,_0x61b580){_0x372c7c=_0x372c7c-0x0;var _0x2ab5f7=_0x539e[_0x372c7c];return _0x2ab5f7;};'use strict';var _=require(_0xe539('0x0'));var util=require(_0xe539('0x1'));var moment=require(_0xe539('0x2'));var BPromise=require(_0xe539('0x3'));var rs=require(_0xe539('0x4'));var fs=require('fs');var Redis=require(_0xe539('0x5'));var db=require(_0xe539('0x6'))['db'];var utils=require(_0xe539('0x7'));var logger=require('../../config/logger')(_0xe539('0x8'));var config=require(_0xe539('0x9'));var jayson=require(_0xe539('0xa'));var client=jayson[_0xe539('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x167ab5,_0x4fdb8a,_0x4a2c4f){return new BPromise(function(_0xbdd3e7,_0x46c0fd){return client[_0xe539('0xc')](_0x167ab5,_0x4a2c4f)['then'](function(_0x2e24d7){logger[_0xe539('0xd')](_0xe539('0xe'),_0x4fdb8a,'request\x20sent');logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4fdb8a,'request\x20sent',JSON[_0xe539('0xf')](_0x2e24d7));if(_0x2e24d7[_0xe539('0x10')]){if(_0x2e24d7[_0xe539('0x10')][_0xe539('0x11')]===0x1f4){logger[_0xe539('0x10')](_0xe539('0xe'),_0x4fdb8a,_0x2e24d7[_0xe539('0x10')][_0xe539('0x12')]);return _0x46c0fd(_0x2e24d7[_0xe539('0x10')][_0xe539('0x12')]);}logger[_0xe539('0x10')](_0xe539('0xe'),_0x4fdb8a,_0x2e24d7['error']['message']);return _0xbdd3e7(_0x2e24d7[_0xe539('0x10')][_0xe539('0x12')]);}else{logger['info'](_0xe539('0xe'),_0x4fdb8a,_0xe539('0x13'));_0xbdd3e7(_0x2e24d7[_0xe539('0x14')][_0xe539('0x12')]);}})[_0xe539('0x15')](function(_0x43682b){logger[_0xe539('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4fdb8a,_0x43682b);_0x46c0fd(_0x43682b);});});}exports[_0xe539('0x16')]=function(_0xf7d046){var _0x13f97d=this;return new Promise(function(_0x80ed12,_0x905790){return db[_0xe539('0x17')][_0xe539('0x18')]({'raw':!![],'where':{'ContactId':_0xf7d046[_0xe539('0x19')][_0xe539('0x1a')],'ListId':_0xf7d046[_0xe539('0x19')][_0xe539('0x1b')],'VoiceQueueId':_0xf7d046['body'][_0xe539('0x1c')]===undefined?null:_0xf7d046[_0xe539('0x19')][_0xe539('0x1c')],'CampaignId':_0xf7d046[_0xe539('0x19')][_0xe539('0x1d')]===undefined?null:_0xf7d046[_0xe539('0x19')][_0xe539('0x1d')]}})['then'](function(_0x2f4291){if(_0x2f4291!=null){return db[_0xe539('0x1e')][_0xe539('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2f4291['id'],'OrderBy':{'$gt':_0x2f4291[_0xe539('0x1f')]}},'order':[[_0xe539('0x1f'),_0xe539('0x20')]]})[_0xe539('0x21')](function(_0x2bbdb4){var _0x533f94=0x0;if(_0x2bbdb4){if(_0x2bbdb4[_0xe539('0x22')]+_0x2bbdb4['countcongestionretry']+_0x2bbdb4[_0xe539('0x23')]+_0x2bbdb4[_0xe539('0x24')]+_0x2bbdb4[_0xe539('0x25')]+_0x2bbdb4['countabandonedretry']+_0x2bbdb4[_0xe539('0x26')]+_0x2bbdb4[_0xe539('0x27')]<_0xf7d046['entity'][_0xe539('0x28')])_0x533f94=0x1;_0x80ed12({'additional':_0x533f94});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2f4291['id']},'order':[[_0xe539('0x1f'),'ASC']]})[_0xe539('0x21')](function(_0xec43c3){var _0x27730b=0x0;if(_0xec43c3){if(_0xec43c3[_0xe539('0x22')]+_0xec43c3[_0xe539('0x29')]+_0xec43c3[_0xe539('0x23')]+_0xec43c3['countnosuchnumberretry']+_0xec43c3[_0xe539('0x25')]+_0xec43c3['countabandonedretry']+_0xec43c3[_0xe539('0x26')]+_0xec43c3[_0xe539('0x27')]<_0xf7d046[_0xe539('0x2a')][_0xe539('0x28')])_0x27730b=0x1;_0x80ed12({'additional':_0x27730b});}else{_0x80ed12({'additional':0x0});}})[_0xe539('0x15')](function(_0x8f662e){logger[_0xe539('0x10')](_0xe539('0x16'),_0x8f662e[_0xe539('0x12')]);_0x905790(_0x13f97d[_0xe539('0x10')](0x1f4,_0x8f662e['message']));});}})[_0xe539('0x15')](function(_0x487044){logger['error'](_0xe539('0x16'),_0x487044['message']);_0x905790(_0x13f97d[_0xe539('0x10')](0x1f4,_0x487044[_0xe539('0x12')]));});}else _0x80ed12({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x9335cf){var _0x1a4b3f=this;return new Promise(function(_0xc9509f,_0x11d04e){return db['CmHopper'][_0xe539('0x18')]({'raw':!![],'where':{'ContactId':_0x9335cf[_0xe539('0x19')][_0xe539('0x1a')],'ListId':_0x9335cf['body'][_0xe539('0x1b')],'VoiceQueueId':_0x9335cf[_0xe539('0x19')]['VoiceQueueId']===undefined?null:_0x9335cf['body'][_0xe539('0x1c')],'CampaignId':_0x9335cf['body']['CampaignId']===undefined?null:_0x9335cf[_0xe539('0x19')]['CampaignId']}})['then'](function(_0xa1a4){if(_0xa1a4!=null){return db[_0xe539('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xa1a4['id'],'OrderBy':{'$gte':_0xa1a4['OrderBy']}},'order':[['OrderBy',_0xe539('0x20')]]})[_0xe539('0x21')](function(_0x5a62e5){if(_0x5a62e5)return activateAdditionalPhone(_0xa1a4,_0x9335cf[_0xe539('0x19')],_0x5a62e5,_0x9335cf[_0xe539('0x2b')],_0x9335cf[_0xe539('0x2c')])[_0xe539('0x21')](function(_0x3b59cb){_0xc9509f(_0x3b59cb);});else{return db[_0xe539('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xa1a4['id']},'order':[['OrderBy',_0xe539('0x20')]]})[_0xe539('0x21')](function(_0x49e0a4){if(_0x49e0a4)return activateAdditionalPhone(_0xa1a4,_0x9335cf[_0xe539('0x19')],_0x49e0a4,_0x9335cf[_0xe539('0x2b')],_0x9335cf[_0xe539('0x2c')])[_0xe539('0x21')](function(_0x1eb612){_0xc9509f(_0x1eb612);});else{_0xc9509f({'id':_0xa1a4['id'],'phone':''});}})[_0xe539('0x15')](function(_0x4b15f5){logger[_0xe539('0x10')](_0xe539('0x16'),_0x4b15f5[_0xe539('0x12')]);_0x11d04e(_0x1a4b3f[_0xe539('0x10')](0x1f4,_0x4b15f5['message']));});}})['catch'](function(_0x2bdf5c){logger[_0xe539('0x10')](_0xe539('0x16'),_0x2bdf5c['message']);_0x11d04e(_0x1a4b3f[_0xe539('0x10')](0x1f4,_0x2bdf5c[_0xe539('0x12')]));});}else _0xc9509f(0x1);});});};function activateAdditionalPhone(_0x8a1462,_0x5853ab,_0x3628b0,_0x4897ff,_0x28c3b8){return new Promise(function(_0x3493b5,_0x5cd65a){var _0x395d89;if(_['isNil'](_0x3628b0[_0xe539('0x2d')])){_0x3628b0[_0xe539('0x2d')]=moment();}if(moment()>moment(_0x3628b0[_0xe539('0x2d')])){_0x395d89=moment()['add'](_0x28c3b8||0x3,_0xe539('0x2e'));}else{if(_0x3628b0[_0xe539('0x1f')]==0x0){_0x395d89=moment(_0x3628b0[_0xe539('0x2d')]);}else{_0x395d89=moment()['add'](_0x28c3b8||0x3,_0xe539('0x2e'));}}if(_[_0xe539('0x2f')](_0x395d89)){_0x395d89=moment()[_0xe539('0x30')](_0x28c3b8||0x3,_0xe539('0x2e'));}var _0x5a1ebb={'phone':_0x8a1462['phone'],'active':0x0,'OrderBy':_['isNil'](_0x8a1462[_0xe539('0x1f')])?0x0:_0x8a1462[_0xe539('0x1f')],'scheduledat':moment()[_0xe539('0x30')](_0x4897ff||0x1,'minutes'),'countbusyretry':_0x5853ab[_0xe539('0x22')],'countcongestionretry':_0x5853ab[_0xe539('0x29')],'countnoanswerretry':_0x5853ab[_0xe539('0x23')],'countnosuchnumberretry':_0x5853ab[_0xe539('0x24')],'countdropretry':_0x5853ab[_0xe539('0x25')],'countabandonedretry':_0x5853ab[_0xe539('0x31')],'countmachineretry':_0x5853ab[_0xe539('0x26')],'countagentrejectretry':_0x5853ab[_0xe539('0x27')],'createdAt':_0x5853ab[_0xe539('0x32')],'updatedAt':_0x5853ab[_0xe539('0x33')]};var _0x840685={'CmHopperId':_0x8a1462['id'],'phone':_0x3628b0[_0xe539('0x34')],'active':0x0,'OrderBy':_[_0xe539('0x2f')](_0x3628b0[_0xe539('0x1f')])?0x0:_0x3628b0[_0xe539('0x1f')],'scheduledat':_0x395d89,'countbusyretry':_0x3628b0[_0xe539('0x22')],'countcongestionretry':_0x3628b0[_0xe539('0x29')],'countnoanswerretry':_0x3628b0[_0xe539('0x23')],'countnosuchnumberretry':_0x3628b0[_0xe539('0x24')],'countdropretry':_0x3628b0[_0xe539('0x25')],'countabandonedretry':_0x3628b0['countabandonedretry'],'countmachineretry':_0x3628b0[_0xe539('0x26')],'countagentrejectretry':_0x3628b0[_0xe539('0x27')],'createdAt':_0x3628b0['createdAt'],'updatedAt':_0x3628b0[_0xe539('0x33')]};return db['sequelize'][_0xe539('0x35')](function(_0x56c8da){return db['CmHopperAdditionalPhone'][_0xe539('0x36')](_0x5a1ebb,{'where':{'id':_0x3628b0['id']}},{'transaction':_0x56c8da})[_0xe539('0x21')](function(){return db['CmHopper'][_0xe539('0x36')](_0x840685,{'where':{'id':_0x8a1462['id']}},{'transaction':_0x56c8da});});})[_0xe539('0x21')](function(_0x2f9303){_0x3493b5({'id':_0x8a1462['id'],'phone':_0x3628b0[_0xe539('0x34')]});})['catch'](function(_0x2530ba){logger['error']('activateAdditionalPhone',_0x2530ba[_0xe539('0x12')]);_0x5cd65a({'error':_0x2530ba[_0xe539('0x12')]});});});}exports[_0xe539('0x37')]=function(_0x4244e9){var _0x3f6c03=this;return new Promise(function(_0x2cc54e,_0x48856b){return db[_0xe539('0x17')][_0xe539('0x36')](_0x4244e9[_0xe539('0x19')][_0xe539('0x38')],{'where':{'id':_0x4244e9[_0xe539('0x19')]['id']}})[_0xe539('0x21')](function(_0x34ebd9){_0x2cc54e(_0x34ebd9);})['catch'](function(_0x4522f1){logger[_0xe539('0x10')](_0xe539('0x37'),_0x4522f1['message']);_0x48856b(_0x3f6c03[_0xe539('0x10')](0x1f4,_0x4522f1[_0xe539('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index a3c62d0..b1a76db 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfac9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0xff1c5d,_0x2202f2){var _0x2f801a=function(_0x269497){while(--_0x269497){_0xff1c5d['push'](_0xff1c5d['shift']());}};_0x2f801a(++_0x2202f2);}(_0xfac9,0x1d0));var _0x9fac=function(_0x2aa916,_0x1ab327){_0x2aa916=_0x2aa916-0x0;var _0x3368c9=_0xfac9[_0x2aa916];return _0x3368c9;};'use strict';var multer=require(_0x9fac('0x0'));var util=require('util');var path=require(_0x9fac('0x1'));var timeout=require(_0x9fac('0x2'));var express=require('express');var router=express[_0x9fac('0x3')]();var fs_extra=require(_0x9fac('0x4'));var auth=require(_0x9fac('0x5'));var interaction=require(_0x9fac('0x6'));var config=require(_0x9fac('0x7'));var controller=require(_0x9fac('0x8'));router[_0x9fac('0x9')]('/',auth[_0x9fac('0xa')](),controller[_0x9fac('0xb')]);router[_0x9fac('0x9')](_0x9fac('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9fac('0xa')](),controller[_0x9fac('0xd')]);router[_0x9fac('0xe')](_0x9fac('0xc'),auth['isAuthenticated'](),controller[_0x9fac('0xf')]);router[_0x9fac('0x10')](_0x9fac('0xc'),auth[_0x9fac('0xa')](),controller[_0x9fac('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8bd6=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show'];(function(_0x60bc8b,_0x3510a5){var _0x519412=function(_0x5c854f){while(--_0x5c854f){_0x60bc8b['push'](_0x60bc8b['shift']());}};_0x519412(++_0x3510a5);}(_0x8bd6,0x144));var _0x68bd=function(_0x2fa7ee,_0x14c4a7){_0x2fa7ee=_0x2fa7ee-0x0;var _0x2ec7e3=_0x8bd6[_0x2fa7ee];return _0x2ec7e3;};'use strict';var multer=require(_0x68bd('0x0'));var util=require(_0x68bd('0x1'));var path=require(_0x68bd('0x2'));var timeout=require(_0x68bd('0x3'));var express=require(_0x68bd('0x4'));var router=express[_0x68bd('0x5')]();var fs_extra=require(_0x68bd('0x6'));var auth=require(_0x68bd('0x7'));var interaction=require(_0x68bd('0x8'));var config=require(_0x68bd('0x9'));var controller=require(_0x68bd('0xa'));router[_0x68bd('0xb')]('/',auth[_0x68bd('0xc')](),controller[_0x68bd('0xd')]);router[_0x68bd('0xb')](_0x68bd('0xe'),auth[_0x68bd('0xc')](),controller[_0x68bd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x68bd('0x10')]('/:id',auth[_0x68bd('0xc')](),controller[_0x68bd('0x11')]);router[_0x68bd('0x12')](_0x68bd('0xe'),auth[_0x68bd('0xc')](),controller['destroy']);module[_0x68bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3668c6b..fc2a47e 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 _0x374c=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x46a635,_0x3cf6f0){var _0xff72f1=function(_0x3ac57b){while(--_0x3ac57b){_0x46a635['push'](_0x46a635['shift']());}};_0xff72f1(++_0x3cf6f0);}(_0x374c,0x1e3));var _0xc374=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x374c[_0x50aa2e];return _0x5e07f0;};'use strict';var moment=require('moment');var Sequelize=require(_0xc374('0x0'));module[_0xc374('0x1')]={'phone':{'type':Sequelize[_0xc374('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc374('0x3')],'unique':_0xc374('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc374('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xc374('0x4')}}; \ No newline at end of file +var _0x0eab=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x12c040,_0x3e4161){var _0x11f212=function(_0x1049d4){while(--_0x1049d4){_0x12c040['push'](_0x12c040['shift']());}};_0x11f212(++_0x3e4161);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x587181,_0x5e017f){_0x587181=_0x587181-0x0;var _0x5e4b12=_0x0eab[_0x587181];return _0x5e4b12;};'use strict';var moment=require(_0xb0ea('0x0'));var Sequelize=require(_0xb0ea('0x1'));module[_0xb0ea('0x2')]={'phone':{'type':Sequelize[_0xb0ea('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb0ea('0x4')],'unique':_0xb0ea('0x5')},'ListId':{'type':Sequelize[_0xb0ea('0x4')],'unique':_0xb0ea('0x5')},'VoiceQueueId':{'type':Sequelize[_0xb0ea('0x4')],'unique':_0xb0ea('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5a9edba..dbecfa1 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 _0xf2bc=['stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2bc,0x14a));var _0xcf2b=function(_0xe1b2a8,_0x38f786){_0xe1b2a8=_0xe1b2a8-0x0;var _0x554804=_0xf2bc[_0xe1b2a8];return _0x554804;};'use strict';var emlformat=require(_0xcf2b('0x0'));var rimraf=require(_0xcf2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf2b('0x2'));var Mustache=require(_0xcf2b('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcf2b('0x4'));var ejs=require(_0xcf2b('0x5'));var fs=require('fs');var fs_extra=require(_0xcf2b('0x6'));var _=require(_0xcf2b('0x7'));var squel=require(_0xcf2b('0x8'));var crypto=require(_0xcf2b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xcf2b('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcf2b('0xb'));var Papa=require(_0xcf2b('0xc'));var Redis=require(_0xcf2b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcf2b('0xe'));var as=require(_0xcf2b('0xf'));var hardwareService=require(_0xcf2b('0x10'));var logger=require(_0xcf2b('0x11'))(_0xcf2b('0x12'));var utils=require(_0xcf2b('0x13'));var config=require(_0xcf2b('0x14'));var licenseUtil=require(_0xcf2b('0x15'));var db=require(_0xcf2b('0x16'))['db'];function respondWithStatusCode(_0x564188,_0x8f4aab){_0x8f4aab=_0x8f4aab||0xcc;return function(_0x2b5925){if(_0x2b5925){return _0x564188[_0xcf2b('0x17')](_0x8f4aab);}return _0x564188[_0xcf2b('0x18')](_0x8f4aab)[_0xcf2b('0x19')]();};}function respondWithResult(_0x551a2c,_0x2e58bc){_0x2e58bc=_0x2e58bc||0xc8;return function(_0x3be92f){if(_0x3be92f){return _0x551a2c[_0xcf2b('0x18')](_0x2e58bc)[_0xcf2b('0x1a')](_0x3be92f);}};}function respondWithFilteredResult(_0x2576ea,_0x460639){return function(_0x1f9812){if(_0x1f9812){var _0x21b2a2=typeof _0x460639[_0xcf2b('0x1b')]==='undefined'&&typeof _0x460639['limit']===_0xcf2b('0x1c');var _0xa51481=_0x1f9812[_0xcf2b('0x1d')];var _0x16169f=_0x21b2a2?0x0:_0x460639[_0xcf2b('0x1b')];var _0x24e885=_0x21b2a2?_0x1f9812[_0xcf2b('0x1d')]:_0x460639[_0xcf2b('0x1b')]+_0x460639[_0xcf2b('0x1e')];var _0x3160f5;if(_0x24e885>=_0xa51481){_0x24e885=_0xa51481;_0x3160f5=0xc8;}else{_0x3160f5=0xce;}_0x2576ea[_0xcf2b('0x18')](_0x3160f5);return _0x2576ea[_0xcf2b('0x1f')](_0xcf2b('0x20'),_0x16169f+'-'+_0x24e885+'/'+_0xa51481)['json'](_0x1f9812);}return null;};}function patchUpdates(_0x71f092){return function(_0x4e98c6){try{jsonpatch[_0xcf2b('0x21')](_0x4e98c6,_0x71f092,!![]);}catch(_0x36b70d){return BPromise[_0xcf2b('0x22')](_0x36b70d);}return _0x4e98c6[_0xcf2b('0x23')]();};}function saveUpdates(_0xe5ce28,_0x311d45){return function(_0x33eaba){if(_0x33eaba){return _0x33eaba[_0xcf2b('0x24')](_0xe5ce28)[_0xcf2b('0x25')](function(_0x59ae59){return _0x59ae59;});}return null;};}function removeEntity(_0xee3e7e,_0x30b48f){return function(_0x14cde2){if(_0x14cde2){return _0x14cde2[_0xcf2b('0x26')]()[_0xcf2b('0x25')](function(){_0xee3e7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x363e08,_0x463b13){return function(_0x1e7e0a){if(!_0x1e7e0a){_0x363e08[_0xcf2b('0x17')](0x194);}return _0x1e7e0a;};}function handleError(_0x4eb59a,_0x55fdfe){_0x55fdfe=_0x55fdfe||0x1f4;return function(_0x39fdc3){logger[_0xcf2b('0x27')](_0x39fdc3[_0xcf2b('0x28')]);if(_0x39fdc3[_0xcf2b('0x29')]){delete _0x39fdc3[_0xcf2b('0x29')];}_0x4eb59a['status'](_0x55fdfe)['send'](_0x39fdc3);};}exports[_0xcf2b('0x2a')]=function(_0x4d3b50,_0x101cb5){var _0x5d5823={},_0x16580e={},_0x30312c={'count':0x0,'rows':[]};var _0x549c05=_[_0xcf2b('0x2b')](db[_0xcf2b('0x2c')][_0xcf2b('0x2d')],function(_0x524777){return{'name':_0x524777[_0xcf2b('0x2e')],'type':_0x524777[_0xcf2b('0x2f')]['key']};});_0x16580e['model']=_[_0xcf2b('0x2b')](_0x549c05,_0xcf2b('0x29'));_0x16580e[_0xcf2b('0x30')]=_['keys'](_0x4d3b50[_0xcf2b('0x30')]);_0x16580e[_0xcf2b('0x31')]=_[_0xcf2b('0x32')](_0x16580e[_0xcf2b('0x33')],_0x16580e[_0xcf2b('0x30')]);_0x5d5823[_0xcf2b('0x34')]=_[_0xcf2b('0x32')](_0x16580e['model'],qs['fields'](_0x4d3b50[_0xcf2b('0x30')][_0xcf2b('0x35')]));_0x5d5823[_0xcf2b('0x34')]=_0x5d5823[_0xcf2b('0x34')][_0xcf2b('0x36')]?_0x5d5823[_0xcf2b('0x34')]:_0x16580e['model'];if(!_0x4d3b50['query'][_0xcf2b('0x37')]('nolimit')){_0x5d5823[_0xcf2b('0x1e')]=qs['limit'](_0x4d3b50[_0xcf2b('0x30')][_0xcf2b('0x1e')]);_0x5d5823['offset']=qs['offset'](_0x4d3b50['query']['offset']);}_0x5d5823[_0xcf2b('0x38')]=qs['sort'](_0x4d3b50[_0xcf2b('0x30')]['sort']);_0x5d5823['where']=qs['filters'](_[_0xcf2b('0x39')](_0x4d3b50[_0xcf2b('0x30')],_0x16580e[_0xcf2b('0x31')]),_0x549c05);if(_0x4d3b50['query'][_0xcf2b('0x3a')]){_0x5d5823['where']=_[_0xcf2b('0x3b')](_0x5d5823[_0xcf2b('0x3c')],{'$or':_['map'](_0x549c05,function(_0x4e0888){if(_0x4e0888[_0xcf2b('0x2f')]!==_0xcf2b('0x3d')){var _0x50def4={};_0x50def4[_0x4e0888[_0xcf2b('0x29')]]={'$like':'%'+_0x4d3b50[_0xcf2b('0x30')][_0xcf2b('0x3a')]+'%'};return _0x50def4;}})});}_0x5d5823=_[_0xcf2b('0x3b')]({},_0x5d5823,_0x4d3b50[_0xcf2b('0x3e')]);var _0x1696a8={'where':_0x5d5823[_0xcf2b('0x3c')]};return db[_0xcf2b('0x2c')]['count'](_0x1696a8)[_0xcf2b('0x25')](function(_0x21c667){_0x30312c[_0xcf2b('0x1d')]=_0x21c667;if(_0x4d3b50[_0xcf2b('0x30')][_0xcf2b('0x3f')]){_0x5d5823[_0xcf2b('0x40')]=[{'all':!![]}];}return db[_0xcf2b('0x2c')][_0xcf2b('0x41')](_0x5d5823);})['then'](function(_0x2112e5){_0x30312c[_0xcf2b('0x42')]=_0x2112e5;return _0x30312c;})[_0xcf2b('0x25')](respondWithFilteredResult(_0x101cb5,_0x5d5823))[_0xcf2b('0x43')](handleError(_0x101cb5,null));};exports[_0xcf2b('0x44')]=function(_0x47e9f8,_0x3d324a){var _0x777343={'raw':!![],'where':{'id':_0x47e9f8[_0xcf2b('0x45')]['id']}},_0x55810d={};_0x55810d[_0xcf2b('0x33')]=_[_0xcf2b('0x46')](db['CmHopperBlack'][_0xcf2b('0x2d')]);_0x55810d[_0xcf2b('0x30')]=_[_0xcf2b('0x46')](_0x47e9f8[_0xcf2b('0x30')]);_0x55810d[_0xcf2b('0x31')]=_[_0xcf2b('0x32')](_0x55810d[_0xcf2b('0x33')],_0x55810d[_0xcf2b('0x30')]);_0x777343[_0xcf2b('0x34')]=_[_0xcf2b('0x32')](_0x55810d[_0xcf2b('0x33')],qs['fields'](_0x47e9f8[_0xcf2b('0x30')][_0xcf2b('0x35')]));_0x777343[_0xcf2b('0x34')]=_0x777343['attributes'][_0xcf2b('0x36')]?_0x777343[_0xcf2b('0x34')]:_0x55810d[_0xcf2b('0x33')];if(_0x47e9f8[_0xcf2b('0x30')][_0xcf2b('0x3f')]){_0x777343[_0xcf2b('0x40')]=[{'all':!![]}];}_0x777343=_[_0xcf2b('0x3b')]({},_0x777343,_0x47e9f8['options']);return db[_0xcf2b('0x2c')][_0xcf2b('0x47')](_0x777343)[_0xcf2b('0x25')](handleEntityNotFound(_0x3d324a,null))[_0xcf2b('0x25')](respondWithResult(_0x3d324a,null))['catch'](handleError(_0x3d324a,null));};exports[_0xcf2b('0x24')]=function(_0x3872dd,_0x241da){if(_0x3872dd[_0xcf2b('0x48')]['id']){delete _0x3872dd['body']['id'];}return db[_0xcf2b('0x2c')][_0xcf2b('0x47')]({'where':{'id':_0x3872dd[_0xcf2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x241da,null))[_0xcf2b('0x25')](saveUpdates(_0x3872dd['body'],null))[_0xcf2b('0x25')](respondWithResult(_0x241da,null))['catch'](handleError(_0x241da,null));};exports[_0xcf2b('0x26')]=function(_0x31a530,_0x38eeeb){return db[_0xcf2b('0x2c')][_0xcf2b('0x47')]({'where':{'id':_0x31a530[_0xcf2b('0x45')]['id']}})[_0xcf2b('0x25')](handleEntityNotFound(_0x38eeeb,null))[_0xcf2b('0x25')](removeEntity(_0x38eeeb,null))[_0xcf2b('0x43')](handleError(_0x38eeeb,null));};exports[_0xcf2b('0x49')]=function(_0x1afe67,_0x26aef4){return db[_0xcf2b('0x2c')]['describe']()[_0xcf2b('0x25')](respondWithResult(_0x26aef4,null))[_0xcf2b('0x43')](handleError(_0x26aef4,null));}; \ No newline at end of file +var _0xa201=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','include','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0xa201,0x1eb));var _0x1a20=function(_0x7aedef,_0x3aadd8){_0x7aedef=_0x7aedef-0x0;var _0x34ea60=_0xa201[_0x7aedef];return _0x34ea60;};'use strict';var emlformat=require(_0x1a20('0x0'));var rimraf=require(_0x1a20('0x1'));var zipdir=require(_0x1a20('0x2'));var jsonpatch=require(_0x1a20('0x3'));var rp=require(_0x1a20('0x4'));var moment=require('moment');var BPromise=require(_0x1a20('0x5'));var Mustache=require(_0x1a20('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1a20('0x7'));var csv=require(_0x1a20('0x8'));var ejs=require(_0x1a20('0x9'));var fs=require('fs');var fs_extra=require(_0x1a20('0xa'));var _=require(_0x1a20('0xb'));var squel=require(_0x1a20('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a20('0xd'));var deskjs=require(_0x1a20('0xe'));var toCsv=require(_0x1a20('0x8'));var querystring=require('querystring');var Papa=require(_0x1a20('0xf'));var Redis=require(_0x1a20('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a20('0x11'));var hardwareService=require(_0x1a20('0x12'));var logger=require('../../config/logger')(_0x1a20('0x13'));var utils=require(_0x1a20('0x14'));var config=require(_0x1a20('0x15'));var licenseUtil=require(_0x1a20('0x16'));var db=require(_0x1a20('0x17'))['db'];function respondWithStatusCode(_0x5a3131,_0x169f78){_0x169f78=_0x169f78||0xcc;return function(_0x4275aa){if(_0x4275aa){return _0x5a3131['sendStatus'](_0x169f78);}return _0x5a3131['status'](_0x169f78)[_0x1a20('0x18')]();};}function respondWithResult(_0x406a82,_0x20fff6){_0x20fff6=_0x20fff6||0xc8;return function(_0x2df74b){if(_0x2df74b){return _0x406a82['status'](_0x20fff6)[_0x1a20('0x19')](_0x2df74b);}};}function respondWithFilteredResult(_0x2e8241,_0x18b4ef){return function(_0xcd73d2){if(_0xcd73d2){var _0x1ae80f=typeof _0x18b4ef[_0x1a20('0x1a')]==='undefined'&&typeof _0x18b4ef[_0x1a20('0x1b')]===_0x1a20('0x1c');var _0x9ee6a7=_0xcd73d2[_0x1a20('0x1d')];var _0x490c8d=_0x1ae80f?0x0:_0x18b4ef[_0x1a20('0x1a')];var _0x3b2ea0=_0x1ae80f?_0xcd73d2[_0x1a20('0x1d')]:_0x18b4ef[_0x1a20('0x1a')]+_0x18b4ef[_0x1a20('0x1b')];var _0x446a72;if(_0x3b2ea0>=_0x9ee6a7){_0x3b2ea0=_0x9ee6a7;_0x446a72=0xc8;}else{_0x446a72=0xce;}_0x2e8241[_0x1a20('0x1e')](_0x446a72);return _0x2e8241[_0x1a20('0x1f')]('Content-Range',_0x490c8d+'-'+_0x3b2ea0+'/'+_0x9ee6a7)[_0x1a20('0x19')](_0xcd73d2);}return null;};}function patchUpdates(_0x46ec9e){return function(_0x2604d7){try{jsonpatch['apply'](_0x2604d7,_0x46ec9e,!![]);}catch(_0x7ece1f){return BPromise[_0x1a20('0x20')](_0x7ece1f);}return _0x2604d7[_0x1a20('0x21')]();};}function saveUpdates(_0x1005f5,_0x367da5){return function(_0xe1038d){if(_0xe1038d){return _0xe1038d[_0x1a20('0x22')](_0x1005f5)[_0x1a20('0x23')](function(_0x32b5ea){return _0x32b5ea;});}return null;};}function removeEntity(_0x1e5c3f,_0xa43b9c){return function(_0x302382){if(_0x302382){return _0x302382[_0x1a20('0x24')]()[_0x1a20('0x23')](function(){_0x1e5c3f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x548a52,_0x1417e2){return function(_0x55b650){if(!_0x55b650){_0x548a52[_0x1a20('0x25')](0x194);}return _0x55b650;};}function handleError(_0x36168c,_0x3f2b53){_0x3f2b53=_0x3f2b53||0x1f4;return function(_0x897e71){logger[_0x1a20('0x26')](_0x897e71[_0x1a20('0x27')]);if(_0x897e71[_0x1a20('0x28')]){delete _0x897e71[_0x1a20('0x28')];}_0x36168c[_0x1a20('0x1e')](_0x3f2b53)['send'](_0x897e71);};}exports[_0x1a20('0x29')]=function(_0x1695c4,_0x346df2){var _0x400eaf={},_0x426977={},_0x4daaec={'count':0x0,'rows':[]};var _0x240a7d=_[_0x1a20('0x2a')](db[_0x1a20('0x2b')][_0x1a20('0x2c')],function(_0x4fa405){return{'name':_0x4fa405['fieldName'],'type':_0x4fa405[_0x1a20('0x2d')][_0x1a20('0x2e')]};});_0x426977[_0x1a20('0x2f')]=_['map'](_0x240a7d,'name');_0x426977[_0x1a20('0x30')]=_[_0x1a20('0x31')](_0x1695c4[_0x1a20('0x30')]);_0x426977['filters']=_[_0x1a20('0x32')](_0x426977[_0x1a20('0x2f')],_0x426977['query']);_0x400eaf[_0x1a20('0x33')]=_[_0x1a20('0x32')](_0x426977[_0x1a20('0x2f')],qs['fields'](_0x1695c4[_0x1a20('0x30')][_0x1a20('0x34')]));_0x400eaf['attributes']=_0x400eaf[_0x1a20('0x33')][_0x1a20('0x35')]?_0x400eaf['attributes']:_0x426977[_0x1a20('0x2f')];if(!_0x1695c4[_0x1a20('0x30')][_0x1a20('0x36')](_0x1a20('0x37'))){_0x400eaf[_0x1a20('0x1b')]=qs[_0x1a20('0x1b')](_0x1695c4[_0x1a20('0x30')][_0x1a20('0x1b')]);_0x400eaf[_0x1a20('0x1a')]=qs['offset'](_0x1695c4[_0x1a20('0x30')]['offset']);}_0x400eaf[_0x1a20('0x38')]=qs[_0x1a20('0x39')](_0x1695c4['query'][_0x1a20('0x39')]);_0x400eaf[_0x1a20('0x3a')]=qs[_0x1a20('0x3b')](_[_0x1a20('0x3c')](_0x1695c4[_0x1a20('0x30')],_0x426977[_0x1a20('0x3b')]),_0x240a7d);if(_0x1695c4[_0x1a20('0x30')][_0x1a20('0x3d')]){_0x400eaf['where']=_[_0x1a20('0x3e')](_0x400eaf[_0x1a20('0x3a')],{'$or':_[_0x1a20('0x2a')](_0x240a7d,function(_0x3fffe8){if(_0x3fffe8['type']!==_0x1a20('0x3f')){var _0x19b8ef={};_0x19b8ef[_0x3fffe8['name']]={'$like':'%'+_0x1695c4[_0x1a20('0x30')][_0x1a20('0x3d')]+'%'};return _0x19b8ef;}})});}_0x400eaf=_[_0x1a20('0x3e')]({},_0x400eaf,_0x1695c4[_0x1a20('0x40')]);var _0x1b96ae={'where':_0x400eaf[_0x1a20('0x3a')]};return db[_0x1a20('0x2b')][_0x1a20('0x1d')](_0x1b96ae)[_0x1a20('0x23')](function(_0x46e17c){_0x4daaec[_0x1a20('0x1d')]=_0x46e17c;if(_0x1695c4['query'][_0x1a20('0x41')]){_0x400eaf['include']=[{'all':!![]}];}return db[_0x1a20('0x2b')]['findAll'](_0x400eaf);})[_0x1a20('0x23')](function(_0x4473c3){_0x4daaec['rows']=_0x4473c3;return _0x4daaec;})['then'](respondWithFilteredResult(_0x346df2,_0x400eaf))[_0x1a20('0x42')](handleError(_0x346df2,null));};exports[_0x1a20('0x43')]=function(_0x59396b,_0x14a5ba){var _0x370026={'raw':!![],'where':{'id':_0x59396b['params']['id']}},_0x2fcfe4={};_0x2fcfe4[_0x1a20('0x2f')]=_[_0x1a20('0x31')](db['CmHopperBlack'][_0x1a20('0x2c')]);_0x2fcfe4['query']=_[_0x1a20('0x31')](_0x59396b['query']);_0x2fcfe4[_0x1a20('0x3b')]=_[_0x1a20('0x32')](_0x2fcfe4[_0x1a20('0x2f')],_0x2fcfe4[_0x1a20('0x30')]);_0x370026['attributes']=_[_0x1a20('0x32')](_0x2fcfe4[_0x1a20('0x2f')],qs[_0x1a20('0x34')](_0x59396b[_0x1a20('0x30')][_0x1a20('0x34')]));_0x370026['attributes']=_0x370026['attributes'][_0x1a20('0x35')]?_0x370026['attributes']:_0x2fcfe4[_0x1a20('0x2f')];if(_0x59396b[_0x1a20('0x30')]['includeAll']){_0x370026[_0x1a20('0x44')]=[{'all':!![]}];}_0x370026=_['merge']({},_0x370026,_0x59396b['options']);return db[_0x1a20('0x2b')][_0x1a20('0x45')](_0x370026)[_0x1a20('0x23')](handleEntityNotFound(_0x14a5ba,null))[_0x1a20('0x23')](respondWithResult(_0x14a5ba,null))[_0x1a20('0x42')](handleError(_0x14a5ba,null));};exports[_0x1a20('0x22')]=function(_0x4d83e7,_0x1a5e7e){if(_0x4d83e7[_0x1a20('0x46')]['id']){delete _0x4d83e7['body']['id'];}return db[_0x1a20('0x2b')][_0x1a20('0x45')]({'where':{'id':_0x4d83e7[_0x1a20('0x47')]['id']}})[_0x1a20('0x23')](handleEntityNotFound(_0x1a5e7e,null))[_0x1a20('0x23')](saveUpdates(_0x4d83e7[_0x1a20('0x46')],null))[_0x1a20('0x23')](respondWithResult(_0x1a5e7e,null))[_0x1a20('0x42')](handleError(_0x1a5e7e,null));};exports['destroy']=function(_0x13ef2f,_0x2a18d9){return db['CmHopperBlack'][_0x1a20('0x45')]({'where':{'id':_0x13ef2f['params']['id']}})[_0x1a20('0x23')](handleEntityNotFound(_0x2a18d9,null))[_0x1a20('0x23')](removeEntity(_0x2a18d9,null))[_0x1a20('0x42')](handleError(_0x2a18d9,null));};exports[_0x1a20('0x48')]=function(_0xb470ed,_0x4e9734){return db[_0x1a20('0x2b')][_0x1a20('0x48')]()[_0x1a20('0x23')](respondWithResult(_0x4e9734,null))['catch'](handleError(_0x4e9734,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e40d3db..1f96bcf 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 _0x7260=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7260,0x112));var _0x0726=function(_0x112c53,_0x3dd1d4){_0x112c53=_0x112c53-0x0;var _0x1c3297=_0x7260[_0x112c53];return _0x1c3297;};'use strict';var _=require('lodash');var util=require(_0x0726('0x0'));var logger=require(_0x0726('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0726('0x2'));var rp=require(_0x0726('0x3'));var fs=require('fs');var path=require(_0x0726('0x4'));var rimraf=require(_0x0726('0x5'));var config=require(_0x0726('0x6'));var attributes=require(_0x0726('0x7'));module[_0x0726('0x8')]=function(_0x5254fd,_0xb6ce55){return _0x5254fd[_0x0726('0x9')](_0x0726('0xa'),attributes,{'tableName':_0x0726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80da=['exports','define','CmHopperBlack','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x15e47f,_0x9799d){var _0x41f7b1=function(_0x2d7abc){while(--_0x2d7abc){_0x15e47f['push'](_0x15e47f['shift']());}};_0x41f7b1(++_0x9799d);}(_0x80da,0x85));var _0xa80d=function(_0x1b31d5,_0x112bb2){_0x1b31d5=_0x1b31d5-0x0;var _0x6084e9=_0x80da[_0x1b31d5];return _0x6084e9;};'use strict';var _=require(_0xa80d('0x0'));var util=require('util');var logger=require(_0xa80d('0x1'))(_0xa80d('0x2'));var moment=require(_0xa80d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa80d('0x4'));var rimraf=require(_0xa80d('0x5'));var config=require(_0xa80d('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0xa80d('0x7')]=function(_0x58f404,_0xbfaeb6){return _0x58f404[_0xa80d('0x8')](_0xa80d('0x9'),attributes,{'tableName':'cm_hopper_black','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 c9cb6a9..6c9bfd9 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 _0x7c48=['model','CmHopperBlack','update','body','raw','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map'];(function(_0x2cceb1,_0x499a5b){var _0x482cb4=function(_0x538ce7){while(--_0x538ce7){_0x2cceb1['push'](_0x2cceb1['shift']());}};_0x482cb4(++_0x499a5b);}(_0x7c48,0xcc));var _0x87c4=function(_0x18b591,_0x2b65dd){_0x18b591=_0x18b591-0x0;var _0xb6773a=_0x7c48[_0x18b591];return _0xb6773a;};'use strict';var _=require(_0x87c4('0x0'));var util=require(_0x87c4('0x1'));var moment=require(_0x87c4('0x2'));var BPromise=require(_0x87c4('0x3'));var rs=require(_0x87c4('0x4'));var fs=require('fs');var Redis=require(_0x87c4('0x5'));var db=require(_0x87c4('0x6'))['db'];var utils=require(_0x87c4('0x7'));var logger=require(_0x87c4('0x8'))('rpc');var config=require(_0x87c4('0x9'));var jayson=require(_0x87c4('0xa'));var client=jayson[_0x87c4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ab9f,_0x4169bd,_0xef8d89){return new BPromise(function(_0xd4b2dc,_0x119dba){return client[_0x87c4('0xc')](_0x13ab9f,_0xef8d89)[_0x87c4('0xd')](function(_0x13fe24){logger[_0x87c4('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4169bd,_0x87c4('0xf'));logger[_0x87c4('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4169bd,'request\x20sent',JSON[_0x87c4('0x11')](_0x13fe24));if(_0x13fe24['error']){if(_0x13fe24[_0x87c4('0x12')][_0x87c4('0x13')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4169bd,_0x13fe24[_0x87c4('0x12')][_0x87c4('0x14')]);return _0x119dba(_0x13fe24[_0x87c4('0x12')]['message']);}logger[_0x87c4('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x4169bd,_0x13fe24[_0x87c4('0x12')]['message']);return _0xd4b2dc(_0x13fe24['error'][_0x87c4('0x14')]);}else{logger[_0x87c4('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4169bd,_0x87c4('0xf'));_0xd4b2dc(_0x13fe24['result']['message']);}})['catch'](function(_0x219dc0){logger[_0x87c4('0x12')](_0x87c4('0x15'),_0x4169bd,_0x219dc0);_0x119dba(_0x219dc0);});});}exports[_0x87c4('0x16')]=function(_0x32b8ac){var _0x4168a7=this;return new Promise(function(_0x8353fd,_0x3cb2d6){return db['CmHopperBlack'][_0x87c4('0x17')]({'raw':_0x32b8ac[_0x87c4('0x18')]?_0x32b8ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x32b8ac[_0x87c4('0x18')]?_0x32b8ac[_0x87c4('0x18')][_0x87c4('0x19')]||null:null,'attributes':_0x32b8ac[_0x87c4('0x18')]?_0x32b8ac['options'][_0x87c4('0x1a')]||null:null,'limit':_0x32b8ac[_0x87c4('0x18')]?_0x32b8ac['options'][_0x87c4('0x1b')]||null:null,'include':_0x32b8ac[_0x87c4('0x18')]?_0x32b8ac[_0x87c4('0x18')][_0x87c4('0x1c')]?_[_0x87c4('0x1d')](_0x32b8ac[_0x87c4('0x18')][_0x87c4('0x1c')],function(_0x38ed4e){return{'model':db[_0x38ed4e[_0x87c4('0x1e')]],'as':_0x38ed4e['as'],'attributes':_0x38ed4e[_0x87c4('0x1a')],'include':_0x38ed4e[_0x87c4('0x1c')]?_[_0x87c4('0x1d')](_0x38ed4e[_0x87c4('0x1c')],function(_0x3df112){return{'model':db[_0x3df112[_0x87c4('0x1e')]],'as':_0x3df112['as'],'attributes':_0x3df112[_0x87c4('0x1a')],'include':_0x3df112['include']?_[_0x87c4('0x1d')](_0x3df112[_0x87c4('0x1c')],function(_0x43fa04){return{'model':db[_0x43fa04[_0x87c4('0x1e')]],'as':_0x43fa04['as'],'attributes':_0x43fa04[_0x87c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x87c4('0xd')](function(_0x128b52){logger[_0x87c4('0xe')](_0x87c4('0x16'),_0x32b8ac);logger[_0x87c4('0x10')](_0x87c4('0x16'),_0x32b8ac,JSON[_0x87c4('0x11')](_0x128b52));_0x8353fd(_0x128b52);})['catch'](function(_0x268355){logger[_0x87c4('0x12')]('GetCmHopperBlack',_0x268355[_0x87c4('0x14')],_0x32b8ac);_0x3cb2d6(_0x4168a7[_0x87c4('0x12')](0x1f4,_0x268355[_0x87c4('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x16caa2){var _0x4eb374=this;return new Promise(function(_0x287f83,_0x3ad8e7){return db[_0x87c4('0x1f')][_0x87c4('0x20')](_0x16caa2[_0x87c4('0x21')],{'raw':_0x16caa2[_0x87c4('0x18')]?_0x16caa2[_0x87c4('0x18')][_0x87c4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16caa2[_0x87c4('0x18')]?_0x16caa2['options'][_0x87c4('0x19')]||null:null,'attributes':_0x16caa2[_0x87c4('0x18')]?_0x16caa2[_0x87c4('0x18')][_0x87c4('0x1a')]||null:null,'limit':_0x16caa2[_0x87c4('0x18')]?_0x16caa2[_0x87c4('0x18')][_0x87c4('0x1b')]||null:null})[_0x87c4('0xd')](function(_0x56dd6d){logger['info'](_0x87c4('0x23'),_0x16caa2);logger[_0x87c4('0x10')](_0x87c4('0x23'),_0x16caa2,JSON['stringify'](_0x56dd6d));_0x287f83(_0x56dd6d);})[_0x87c4('0x24')](function(_0x530e5f){logger['error']('UpdateCmHopperBlack',_0x530e5f[_0x87c4('0x14')],_0x16caa2);_0x3ad8e7(_0x4eb374[_0x87c4('0x12')](0x1f4,_0x530e5f['message']));});});};exports[_0x87c4('0x25')]=function(_0x2fb6d1){var _0x1c73d1=this;return new Promise(function(_0x37d6c0,_0x7420b2){return db[_0x87c4('0x1f')][_0x87c4('0x26')]({'where':_0x2fb6d1[_0x87c4('0x18')]?_0x2fb6d1['options']['where']||null:null})['then'](function(_0x4f3b12){logger['info'](_0x87c4('0x25'),_0x2fb6d1);logger[_0x87c4('0x10')]('DestroyCmHopperBlack',_0x2fb6d1,JSON[_0x87c4('0x11')](_0x4f3b12));_0x37d6c0(_0x4f3b12);})['catch'](function(_0x29b684){logger[_0x87c4('0x12')]('DestroyCmHopperBlack',_0x29b684[_0x87c4('0x14')],_0x2fb6d1);_0x7420b2(_0x1c73d1[_0x87c4('0x12')](0x1f4,_0x29b684[_0x87c4('0x14')]));});});}; \ No newline at end of file +var _0x3c06=['attributes','limit','include','map','model','then','info','catch','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where'];(function(_0x5ecb9d,_0x19de24){var _0x275238=function(_0x13d009){while(--_0x13d009){_0x5ecb9d['push'](_0x5ecb9d['shift']());}};_0x275238(++_0x19de24);}(_0x3c06,0x80));var _0x63c0=function(_0x5b2a20,_0x53a830){_0x5b2a20=_0x5b2a20-0x0;var _0x9d623a=_0x3c06[_0x5b2a20];return _0x9d623a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x63c0('0x0'));var BPromise=require(_0x63c0('0x1'));var rs=require(_0x63c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63c0('0x3'))['db'];var utils=require(_0x63c0('0x4'));var logger=require('../../config/logger')(_0x63c0('0x5'));var config=require(_0x63c0('0x6'));var jayson=require(_0x63c0('0x7'));var client=jayson[_0x63c0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x120e3f,_0x344dde,_0x5542e2){return new BPromise(function(_0x39dbd9,_0x2e0267){return client[_0x63c0('0x9')](_0x120e3f,_0x5542e2)['then'](function(_0x4516d1){logger['info'](_0x63c0('0xa'),_0x344dde,_0x63c0('0xb'));logger[_0x63c0('0xc')](_0x63c0('0xd'),_0x344dde,'request\x20sent',JSON[_0x63c0('0xe')](_0x4516d1));if(_0x4516d1['error']){if(_0x4516d1[_0x63c0('0xf')][_0x63c0('0x10')]===0x1f4){logger[_0x63c0('0xf')](_0x63c0('0xa'),_0x344dde,_0x4516d1['error'][_0x63c0('0x11')]);return _0x2e0267(_0x4516d1[_0x63c0('0xf')][_0x63c0('0x11')]);}logger[_0x63c0('0xf')](_0x63c0('0xa'),_0x344dde,_0x4516d1['error'][_0x63c0('0x11')]);return _0x39dbd9(_0x4516d1['error'][_0x63c0('0x11')]);}else{logger['info'](_0x63c0('0xa'),_0x344dde,_0x63c0('0xb'));_0x39dbd9(_0x4516d1[_0x63c0('0x12')][_0x63c0('0x11')]);}})['catch'](function(_0x551a6f){logger[_0x63c0('0xf')](_0x63c0('0xa'),_0x344dde,_0x551a6f);_0x2e0267(_0x551a6f);});});}exports['GetCmHopperBlack']=function(_0x2057b0){var _0x36fad7=this;return new Promise(function(_0x2e1bcb,_0x35fd9a){return db[_0x63c0('0x13')][_0x63c0('0x14')]({'raw':_0x2057b0[_0x63c0('0x15')]?_0x2057b0['options'][_0x63c0('0x16')]===undefined?!![]:![]:!![],'where':_0x2057b0[_0x63c0('0x15')]?_0x2057b0['options'][_0x63c0('0x17')]||null:null,'attributes':_0x2057b0[_0x63c0('0x15')]?_0x2057b0[_0x63c0('0x15')][_0x63c0('0x18')]||null:null,'limit':_0x2057b0[_0x63c0('0x15')]?_0x2057b0['options'][_0x63c0('0x19')]||null:null,'include':_0x2057b0[_0x63c0('0x15')]?_0x2057b0[_0x63c0('0x15')][_0x63c0('0x1a')]?_[_0x63c0('0x1b')](_0x2057b0[_0x63c0('0x15')][_0x63c0('0x1a')],function(_0x22b0a1){return{'model':db[_0x22b0a1[_0x63c0('0x1c')]],'as':_0x22b0a1['as'],'attributes':_0x22b0a1[_0x63c0('0x18')],'include':_0x22b0a1[_0x63c0('0x1a')]?_[_0x63c0('0x1b')](_0x22b0a1[_0x63c0('0x1a')],function(_0x128f15){return{'model':db[_0x128f15[_0x63c0('0x1c')]],'as':_0x128f15['as'],'attributes':_0x128f15[_0x63c0('0x18')],'include':_0x128f15[_0x63c0('0x1a')]?_['map'](_0x128f15[_0x63c0('0x1a')],function(_0x12b2e5){return{'model':db[_0x12b2e5[_0x63c0('0x1c')]],'as':_0x12b2e5['as'],'attributes':_0x12b2e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x63c0('0x1d')](function(_0x234fd1){logger[_0x63c0('0x1e')]('GetCmHopperBlack',_0x2057b0);logger[_0x63c0('0xc')]('GetCmHopperBlack',_0x2057b0,JSON[_0x63c0('0xe')](_0x234fd1));_0x2e1bcb(_0x234fd1);})[_0x63c0('0x1f')](function(_0x55d1f8){logger['error'](_0x63c0('0x20'),_0x55d1f8[_0x63c0('0x11')],_0x2057b0);_0x35fd9a(_0x36fad7[_0x63c0('0xf')](0x1f4,_0x55d1f8['message']));});});};exports[_0x63c0('0x21')]=function(_0x16f9ad){var _0x48a96a=this;return new Promise(function(_0x36e217,_0x10e94c){return db[_0x63c0('0x13')][_0x63c0('0x22')](_0x16f9ad[_0x63c0('0x23')],{'raw':_0x16f9ad[_0x63c0('0x15')]?_0x16f9ad['options'][_0x63c0('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16f9ad['options']?_0x16f9ad['options']['where']||null:null,'attributes':_0x16f9ad[_0x63c0('0x15')]?_0x16f9ad['options'][_0x63c0('0x18')]||null:null,'limit':_0x16f9ad[_0x63c0('0x15')]?_0x16f9ad['options'][_0x63c0('0x19')]||null:null})[_0x63c0('0x1d')](function(_0x94fc80){logger[_0x63c0('0x1e')](_0x63c0('0x21'),_0x16f9ad);logger[_0x63c0('0xc')](_0x63c0('0x21'),_0x16f9ad,JSON[_0x63c0('0xe')](_0x94fc80));_0x36e217(_0x94fc80);})[_0x63c0('0x1f')](function(_0x44d02f){logger['error'](_0x63c0('0x21'),_0x44d02f['message'],_0x16f9ad);_0x10e94c(_0x48a96a[_0x63c0('0xf')](0x1f4,_0x44d02f[_0x63c0('0x11')]));});});};exports[_0x63c0('0x24')]=function(_0x1b051a){var _0x2623e5=this;return new Promise(function(_0x22b0fc,_0x4a3290){return db[_0x63c0('0x13')][_0x63c0('0x25')]({'where':_0x1b051a[_0x63c0('0x15')]?_0x1b051a[_0x63c0('0x15')][_0x63c0('0x17')]||null:null})[_0x63c0('0x1d')](function(_0x5bb6d0){logger[_0x63c0('0x1e')](_0x63c0('0x24'),_0x1b051a);logger['debug']('DestroyCmHopperBlack',_0x1b051a,JSON[_0x63c0('0xe')](_0x5bb6d0));_0x22b0fc(_0x5bb6d0);})[_0x63c0('0x1f')](function(_0x20b9eb){logger['error'](_0x63c0('0x24'),_0x20b9eb[_0x63c0('0x11')],_0x1b051a);_0x4a3290(_0x2623e5[_0x63c0('0xf')](0x1f4,_0x20b9eb['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 48bf9ab..d880019 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 _0x5162=['/:id','show','update','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe'];(function(_0x127b06,_0x1e1fd1){var _0x3ebe23=function(_0x2b133c){while(--_0x2b133c){_0x127b06['push'](_0x127b06['shift']());}};_0x3ebe23(++_0x1e1fd1);}(_0x5162,0x103));var _0x2516=function(_0x48f9d2,_0x33ba0d){_0x48f9d2=_0x48f9d2-0x0;var _0x5228da=_0x5162[_0x48f9d2];return _0x5228da;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['put'](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2516('0xe')]=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index fedcb0b..7a65f24 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 _0x04e7=['endtime','setDataValue','BOOLEAN','moment','INTEGER','STRING','DATE'];(function(_0x46f322,_0x583830){var _0x30b247=function(_0x6677e9){while(--_0x6677e9){_0x46f322['push'](_0x46f322['shift']());}};_0x30b247(++_0x583830);}(_0x04e7,0xa4));var _0x704e=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x04e7[_0x2e76a7];return _0x454cde;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x704e('0x0'));module['exports']={'state':{'type':Sequelize[_0x704e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x704e('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x704e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x704e('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x704e('0x2')]},'calleridname':{'type':Sequelize[_0x704e('0x2')]},'starttime':{'type':Sequelize[_0x704e('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x704e('0x3')]},'droptime':{'type':Sequelize[_0x704e('0x3')]},'endtime':{'type':Sequelize[_0x704e('0x3')]},'ringtime':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x704e('0x2')]},'membername':{'type':Sequelize[_0x704e('0x2')]},'reason':{'type':Sequelize[_0x704e('0x2')]},'disposition':{'type':Sequelize[_0x704e('0x2')]},'secondDisposition':{'type':Sequelize[_0x704e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x704e('0x2')]},'dispositionat':{'type':Sequelize[_0x704e('0x3')],'set':function(_0x57c2a1){var _0x116354=this['getDataValue'](_0x704e('0x4'));if(_0x116354&&_0x57c2a1){this[_0x704e('0x5')]('followuptime',moment(_0x57c2a1)['diff'](moment(_0x116354),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x704e('0x6')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x704e('0x6')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x704e('0x3')]},'callback':{'type':Sequelize[_0x704e('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x704e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x704e('0x3')]},'deleted':{'type':Sequelize[_0x704e('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x704e('0x3')]},'recallme':{'type':Sequelize[_0x704e('0x6')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x704e('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x704e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9540=['INTEGER','STRING','DATE','endtime','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x47eac6,_0x2851e7){var _0x591170=function(_0x192155){while(--_0x192155){_0x47eac6['push'](_0x47eac6['shift']());}};_0x591170(++_0x2851e7);}(_0x9540,0x8f));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0954('0x0'));module['exports']={'state':{'type':Sequelize[_0x0954('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0954('0x2')]},'scheduledat':{'type':Sequelize[_0x0954('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0954('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0954('0x2')]},'calleridnum':{'type':Sequelize[_0x0954('0x2')]},'calleridname':{'type':Sequelize[_0x0954('0x2')]},'starttime':{'type':Sequelize[_0x0954('0x3')]},'responsetime':{'type':Sequelize[_0x0954('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0954('0x3')]},'ringtime':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0954('0x2')]},'campaign':{'type':Sequelize[_0x0954('0x2')]},'campaigntype':{'type':Sequelize[_0x0954('0x2')]},'membername':{'type':Sequelize[_0x0954('0x2')]},'reason':{'type':Sequelize[_0x0954('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0954('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0954('0x2')]},'dispositionat':{'type':Sequelize[_0x0954('0x3')],'set':function(_0x5138ad){var _0x29fbde=this['getDataValue'](_0x0954('0x4'));if(_0x29fbde&&_0x5138ad){this['setDataValue'](_0x0954('0x5'),moment(_0x5138ad)[_0x0954('0x6')](moment(_0x29fbde),_0x0954('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0954('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0954('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0954('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0954('0x3')]},'callback':{'type':Sequelize[_0x0954('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0954('0x3')]},'deleted':{'type':Sequelize[_0x0954('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0954('0x3')]},'recallme':{'type':Sequelize[_0x0954('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0954('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0954('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0954('0x1')],'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 95385b6..92ea3ad 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 _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x21f197,_0x38ee7e){var _0x3f070e=function(_0x3814a8){while(--_0x3814a8){_0x21f197['push'](_0x21f197['shift']());}};_0x3f070e(++_0x38ee7e);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x5d17,0x114));var _0x75d1=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x5d17[_0x366388];return _0x41c97e;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 14312c2..64f38d7 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 _0xc36b=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf','exports','define'];(function(_0xf79080,_0xd8fefe){var _0x2994e0=function(_0x23c211){while(--_0x23c211){_0xf79080['push'](_0xf79080['shift']());}};_0x2994e0(++_0xd8fefe);}(_0xc36b,0x13c));var _0xbc36=function(_0x28e28b,_0x340c0f){_0x28e28b=_0x28e28b-0x0;var _0x40a4e1=_0xc36b[_0x28e28b];return _0x40a4e1;};'use strict';var _=require(_0xbc36('0x0'));var util=require(_0xbc36('0x1'));var logger=require(_0xbc36('0x2'))(_0xbc36('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc36('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc36('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xbc36('0x6')]=function(_0xb302c7,_0x7841ce){return _0xb302c7[_0xbc36('0x7')](_0xbc36('0x8'),attributes,{'tableName':_0xbc36('0x9'),'paranoid':![],'indexes':[{'name':_0xbc36('0xa'),'fields':['calleridnum']},{'name':_0xbc36('0xb'),'fields':[_0xbc36('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f6a=['CmHopperFinal','cm_hopper_final','calleridnum','lodash','util','api','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','exports','define'];(function(_0x14b7fa,_0x321343){var _0x17831c=function(_0x19d79c){while(--_0x19d79c){_0x14b7fa['push'](_0x14b7fa['shift']());}};_0x17831c(++_0x321343);}(_0x8f6a,0x78));var _0xa8f6=function(_0x2d21af,_0x37c57e){_0x2d21af=_0x2d21af-0x0;var _0x14ddd3=_0x8f6a[_0x2d21af];return _0x14ddd3;};'use strict';var _=require(_0xa8f6('0x0'));var util=require(_0xa8f6('0x1'));var logger=require('../../config/logger')(_0xa8f6('0x2'));var moment=require(_0xa8f6('0x3'));var BPromise=require(_0xa8f6('0x4'));var rp=require(_0xa8f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8f6('0x6'));var config=require('../../config/environment');var attributes=require(_0xa8f6('0x7'));module[_0xa8f6('0x8')]=function(_0x180ced,_0x1cded4){return _0x180ced[_0xa8f6('0x9')](_0xa8f6('0xa'),attributes,{'tableName':_0xa8f6('0xb'),'paranoid':![],'indexes':[{'name':_0xa8f6('0xc'),'fields':[_0xa8f6('0xc')]},{'name':'uniqueid','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 8f94545..bbaafb9 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xb3a655,_0x4905b7){var _0x538d97=function(_0x231391){while(--_0x231391){_0xb3a655['push'](_0xb3a655['shift']());}};_0x538d97(++_0x4905b7);}(_0x7a54,0x106));var _0x47a5=function(_0x3d217f,_0xb33b77){_0x3d217f=_0x3d217f-0x0;var _0x52e174=_0x7a54[_0x3d217f];return _0x52e174;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x455ef9,_0x1ab9e0){var _0x28f66b=function(_0x10b66c){while(--_0x10b66c){_0x455ef9['push'](_0x455ef9['shift']());}};_0x28f66b(++_0x1ab9e0);}(_0x7a54,0x106));var _0x47a5=function(_0x480839,_0x513c4a){_0x480839=_0x480839-0x0;var _0x3abb26=_0x7a54[_0x480839];return _0x3abb26;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 32cccc3..e4466a9 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 _0x5d2c=['/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','put'];(function(_0x53f85e,_0x1ee067){var _0xc1ea07=function(_0x3334ff){while(--_0x3334ff){_0x53f85e['push'](_0x53f85e['shift']());}};_0xc1ea07(++_0x1ee067);}(_0x5d2c,0x144));var _0xc5d2=function(_0x2ad70b,_0x3e9813){_0x2ad70b=_0x2ad70b-0x0;var _0x8e0829=_0x5d2c[_0x2ad70b];return _0x8e0829;};'use strict';var multer=require(_0xc5d2('0x0'));var util=require('util');var path=require(_0xc5d2('0x1'));var timeout=require(_0xc5d2('0x2'));var express=require('express');var router=express[_0xc5d2('0x3')]();var fs_extra=require(_0xc5d2('0x4'));var auth=require(_0xc5d2('0x5'));var interaction=require(_0xc5d2('0x6'));var config=require(_0xc5d2('0x7'));var controller=require(_0xc5d2('0x8'));router[_0xc5d2('0x9')]('/',auth[_0xc5d2('0xa')](),controller[_0xc5d2('0xb')]);router[_0xc5d2('0x9')]('/describe',auth[_0xc5d2('0xa')](),controller[_0xc5d2('0xc')]);router[_0xc5d2('0x9')]('/:id',auth[_0xc5d2('0xa')](),controller[_0xc5d2('0xd')]);router[_0xc5d2('0x9')](_0xc5d2('0xe'),auth[_0xc5d2('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xc5d2('0xf'),auth[_0xc5d2('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc5d2('0x10')](_0xc5d2('0x11'),auth[_0xc5d2('0xa')](),controller[_0xc5d2('0x12')]);router[_0xc5d2('0x10')](_0xc5d2('0x13'),auth[_0xc5d2('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xc5d2('0x10')]('/checkContactHopper',auth[_0xc5d2('0xa')](),controller['checkContactHopper']);router[_0xc5d2('0x14')](_0xc5d2('0x15'),auth[_0xc5d2('0xa')](),controller['update']);module[_0xc5d2('0x16')]=router; \ No newline at end of file +var _0xc7f8=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x2e353f,_0x15d70a){var _0x4b0700=function(_0x2140ee){while(--_0x2140ee){_0x2e353f['push'](_0x2e353f['shift']());}};_0x4b0700(++_0x15d70a);}(_0xc7f8,0xcf));var _0x8c7f=function(_0x3bb6e3,_0x1fa3f7){_0x3bb6e3=_0x3bb6e3-0x0;var _0x1ff46c=_0xc7f8[_0x3bb6e3];return _0x1ff46c;};'use strict';var multer=require(_0x8c7f('0x0'));var util=require(_0x8c7f('0x1'));var path=require(_0x8c7f('0x2'));var timeout=require(_0x8c7f('0x3'));var express=require(_0x8c7f('0x4'));var router=express['Router']();var fs_extra=require(_0x8c7f('0x5'));var auth=require(_0x8c7f('0x6'));var interaction=require(_0x8c7f('0x7'));var config=require(_0x8c7f('0x8'));var controller=require(_0x8c7f('0x9'));router[_0x8c7f('0xa')]('/',auth[_0x8c7f('0xb')](),controller['index']);router[_0x8c7f('0xa')]('/describe',auth[_0x8c7f('0xb')](),controller[_0x8c7f('0xc')]);router['get'](_0x8c7f('0xd'),auth[_0x8c7f('0xb')](),controller[_0x8c7f('0xe')]);router[_0x8c7f('0xa')](_0x8c7f('0xf'),auth[_0x8c7f('0xb')](),controller[_0x8c7f('0x10')]);router[_0x8c7f('0xa')](_0x8c7f('0x11'),auth['isAuthenticated'](),controller[_0x8c7f('0x12')]);router[_0x8c7f('0x13')](_0x8c7f('0x14'),auth['isAuthenticated'](),controller[_0x8c7f('0x15')]);router[_0x8c7f('0x13')](_0x8c7f('0x16'),auth['isAuthenticated'](),controller[_0x8c7f('0x17')]);router[_0x8c7f('0x13')](_0x8c7f('0x18'),auth[_0x8c7f('0xb')](),controller[_0x8c7f('0x19')]);router['put'](_0x8c7f('0xd'),auth[_0x8c7f('0xb')](),controller[_0x8c7f('0x1a')]);module[_0x8c7f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6838c19..4b3278e 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 _0x78ab=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3c4702,_0x315207){var _0x186a83=function(_0x5a2786){while(--_0x5a2786){_0x3c4702['push'](_0x3c4702['shift']());}};_0x186a83(++_0x315207);}(_0x78ab,0x81));var _0xb78a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x78ab[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xb78a('0x0'));module[_0xb78a('0x1')]={'state':{'type':Sequelize[_0xb78a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb78a('0x3')]},'scheduledat':{'type':Sequelize[_0xb78a('0x4')]},'countbusyretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb78a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb78a('0x3')]},'calleridnum':{'type':Sequelize[_0xb78a('0x3')]},'calleridname':{'type':Sequelize[_0xb78a('0x3')]},'starttime':{'type':Sequelize[_0xb78a('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb78a('0x4')]},'endtime':{'type':Sequelize[_0xb78a('0x4')]},'ringtime':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb78a('0x3')]},'campaigntype':{'type':Sequelize[_0xb78a('0x3')]},'membername':{'type':Sequelize[_0xb78a('0x3')]},'reason':{'type':Sequelize[_0xb78a('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb78a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb78a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb78a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb78a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb78a('0x4')]},'edited':{'type':Sequelize[_0xb78a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb78a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a07=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x14d6d7,_0x3ca897){var _0x2ac32b=function(_0x3bf20a){while(--_0x3bf20a){_0x14d6d7['push'](_0x14d6d7['shift']());}};_0x2ac32b(++_0x3ca897);}(_0x2a07,0x74));var _0x72a0=function(_0x580cee,_0x189c97){_0x580cee=_0x580cee-0x0;var _0x47dfe9=_0x2a07[_0x580cee];return _0x47dfe9;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'state':{'type':Sequelize[_0x72a0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x72a0('0x3')]},'scheduledat':{'type':Sequelize[_0x72a0('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x72a0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x72a0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x72a0('0x3')]},'calleridnum':{'type':Sequelize[_0x72a0('0x3')]},'calleridname':{'type':Sequelize[_0x72a0('0x3')]},'starttime':{'type':Sequelize[_0x72a0('0x4')]},'responsetime':{'type':Sequelize[_0x72a0('0x4')]},'answertime':{'type':Sequelize[_0x72a0('0x4')]},'droptime':{'type':Sequelize[_0x72a0('0x4')]},'endtime':{'type':Sequelize[_0x72a0('0x4')]},'ringtime':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x72a0('0x3')]},'campaign':{'type':Sequelize[_0x72a0('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x72a0('0x3')]},'reason':{'type':Sequelize[_0x72a0('0x3')]},'amd':{'type':Sequelize[_0x72a0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x72a0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x72a0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72a0('0x4')]},'recallme':{'type':Sequelize[_0x72a0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x72a0('0x4')]},'edited':{'type':Sequelize[_0x72a0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x72a0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 58be6d6..fbb39c3 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 _0x95a2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','length','options','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x95a2,0x12a));var _0x295a=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x95a2[_0x416a0a];return _0x574c9f;};'use strict';var emlformat=require(_0x295a('0x0'));var rimraf=require(_0x295a('0x1'));var zipdir=require(_0x295a('0x2'));var jsonpatch=require(_0x295a('0x3'));var rp=require(_0x295a('0x4'));var moment=require(_0x295a('0x5'));var BPromise=require(_0x295a('0x6'));var Mustache=require('mustache');var util=require(_0x295a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x295a('0x8'));var ejs=require(_0x295a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x295a('0xa'));var squel=require(_0x295a('0xb'));var crypto=require(_0x295a('0xc'));var jsforce=require(_0x295a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x295a('0x8'));var querystring=require('querystring');var Papa=require(_0x295a('0xe'));var Redis=require(_0x295a('0xf'));var authService=require(_0x295a('0x10'));var qs=require(_0x295a('0x11'));var as=require(_0x295a('0x12'));var hardwareService=require(_0x295a('0x13'));var logger=require(_0x295a('0x14'))(_0x295a('0x15'));var utils=require(_0x295a('0x16'));var config=require(_0x295a('0x17'));var licenseUtil=require(_0x295a('0x18'));var db=require(_0x295a('0x19'))['db'];function respondWithStatusCode(_0x3cdd1a,_0x3258b2){_0x3258b2=_0x3258b2||0xcc;return function(_0xc88a06){if(_0xc88a06){return _0x3cdd1a[_0x295a('0x1a')](_0x3258b2);}return _0x3cdd1a[_0x295a('0x1b')](_0x3258b2)[_0x295a('0x1c')]();};}function respondWithResult(_0x532915,_0x50240a){_0x50240a=_0x50240a||0xc8;return function(_0x5dab21){if(_0x5dab21){return _0x532915[_0x295a('0x1b')](_0x50240a)[_0x295a('0x1d')](_0x5dab21);}};}function respondWithFilteredResult(_0x4f6335,_0x407195){return function(_0x2a477a){if(_0x2a477a){var _0x572ece=typeof _0x407195['offset']===_0x295a('0x1e')&&typeof _0x407195[_0x295a('0x1f')]==='undefined';var _0x205839=_0x2a477a[_0x295a('0x20')];var _0x1b82a5=_0x572ece?0x0:_0x407195['offset'];var _0x2836e4=_0x572ece?_0x2a477a[_0x295a('0x20')]:_0x407195[_0x295a('0x21')]+_0x407195['limit'];var _0x10fd02;if(_0x2836e4>=_0x205839){_0x2836e4=_0x205839;_0x10fd02=0xc8;}else{_0x10fd02=0xce;}_0x4f6335['status'](_0x10fd02);return _0x4f6335[_0x295a('0x22')](_0x295a('0x23'),_0x1b82a5+'-'+_0x2836e4+'/'+_0x205839)[_0x295a('0x1d')](_0x2a477a);}return null;};}function patchUpdates(_0x14d470){return function(_0x513c98){try{jsonpatch[_0x295a('0x24')](_0x513c98,_0x14d470,!![]);}catch(_0x4a86f0){return BPromise[_0x295a('0x25')](_0x4a86f0);}return _0x513c98[_0x295a('0x26')]();};}function saveUpdates(_0x3b256f,_0x4f3311){return function(_0x43a566){if(_0x43a566){return _0x43a566[_0x295a('0x27')](_0x3b256f)[_0x295a('0x28')](function(_0x5a8c11){return _0x5a8c11;});}return null;};}function removeEntity(_0x2bf93b,_0x258084){return function(_0x3ceec4){if(_0x3ceec4){return _0x3ceec4['destroy']()[_0x295a('0x28')](function(){_0x2bf93b['status'](0xcc)[_0x295a('0x1c')]();});}};}function handleEntityNotFound(_0x30ffe6,_0x3caaf2){return function(_0x4b0278){if(!_0x4b0278){_0x30ffe6[_0x295a('0x1a')](0x194);}return _0x4b0278;};}function handleError(_0x4237db,_0x3d09a3){_0x3d09a3=_0x3d09a3||0x1f4;return function(_0x76906b){logger[_0x295a('0x29')](_0x76906b[_0x295a('0x2a')]);if(_0x76906b[_0x295a('0x2b')]){delete _0x76906b[_0x295a('0x2b')];}_0x4237db[_0x295a('0x1b')](_0x3d09a3)[_0x295a('0x2c')](_0x76906b);};}exports[_0x295a('0x2d')]=function(_0x24f33d,_0x162ea2){var _0x1844ea={},_0x31a48c={},_0x191679={'count':0x0,'rows':[]};var _0x59cc70=_['map'](db[_0x295a('0x2e')][_0x295a('0x2f')],function(_0x7168fb){return{'name':_0x7168fb[_0x295a('0x30')],'type':_0x7168fb[_0x295a('0x31')][_0x295a('0x32')]};});_0x31a48c['model']=_[_0x295a('0x33')](_0x59cc70,_0x295a('0x2b'));_0x31a48c[_0x295a('0x34')]=_[_0x295a('0x35')](_0x24f33d['query']);_0x31a48c['filters']=_[_0x295a('0x36')](_0x31a48c[_0x295a('0x37')],_0x31a48c[_0x295a('0x34')]);_0x1844ea[_0x295a('0x38')]=_['intersection'](_0x31a48c[_0x295a('0x37')],qs[_0x295a('0x39')](_0x24f33d['query'][_0x295a('0x39')]));_0x1844ea[_0x295a('0x38')]=_0x1844ea[_0x295a('0x38')]['length']?_0x1844ea[_0x295a('0x38')]:_0x31a48c[_0x295a('0x37')];if(!_0x24f33d[_0x295a('0x34')][_0x295a('0x3a')](_0x295a('0x3b'))){_0x1844ea[_0x295a('0x1f')]=qs[_0x295a('0x1f')](_0x24f33d[_0x295a('0x34')][_0x295a('0x1f')]);_0x1844ea['offset']=qs[_0x295a('0x21')](_0x24f33d['query']['offset']);}_0x1844ea[_0x295a('0x3c')]=qs['sort'](_0x24f33d[_0x295a('0x34')]['sort']);_0x1844ea[_0x295a('0x3d')]=qs[_0x295a('0x3e')](_[_0x295a('0x3f')](_0x24f33d['query'],_0x31a48c[_0x295a('0x3e')]),_0x59cc70);if(_0x24f33d[_0x295a('0x34')]['filter']){_0x1844ea[_0x295a('0x3d')]=_[_0x295a('0x40')](_0x1844ea['where'],{'$or':_[_0x295a('0x33')](_0x59cc70,function(_0x1a83c8){if(_0x1a83c8[_0x295a('0x31')]!==_0x295a('0x41')){var _0x14ffbc={};_0x14ffbc[_0x1a83c8[_0x295a('0x2b')]]={'$like':'%'+_0x24f33d[_0x295a('0x34')][_0x295a('0x42')]+'%'};return _0x14ffbc;}})});}_0x1844ea=_[_0x295a('0x40')]({},_0x1844ea,_0x24f33d['options']);var _0x3a86a3={'where':_0x1844ea[_0x295a('0x3d')]};return db[_0x295a('0x2e')][_0x295a('0x20')](_0x3a86a3)[_0x295a('0x28')](function(_0x1accc9){_0x191679[_0x295a('0x20')]=_0x1accc9;if(_0x24f33d['query'][_0x295a('0x43')]){_0x1844ea[_0x295a('0x44')]=[{'all':!![]}];}return db[_0x295a('0x2e')][_0x295a('0x45')](_0x1844ea);})[_0x295a('0x28')](function(_0x3ffe01){_0x191679['rows']=_0x3ffe01;return _0x191679;})[_0x295a('0x28')](respondWithFilteredResult(_0x162ea2,_0x1844ea))[_0x295a('0x46')](handleError(_0x162ea2,null));};exports['show']=function(_0x3f1fbe,_0x4fe10c){var _0x40275f={'raw':!![],'where':{'id':_0x3f1fbe['params']['id']}},_0x255814={};_0x255814['model']=_[_0x295a('0x35')](db[_0x295a('0x2e')][_0x295a('0x2f')]);_0x255814[_0x295a('0x34')]=_[_0x295a('0x35')](_0x3f1fbe[_0x295a('0x34')]);_0x255814[_0x295a('0x3e')]=_[_0x295a('0x36')](_0x255814[_0x295a('0x37')],_0x255814[_0x295a('0x34')]);_0x40275f[_0x295a('0x38')]=_[_0x295a('0x36')](_0x255814[_0x295a('0x37')],qs[_0x295a('0x39')](_0x3f1fbe['query'][_0x295a('0x39')]));_0x40275f['attributes']=_0x40275f[_0x295a('0x38')][_0x295a('0x47')]?_0x40275f[_0x295a('0x38')]:_0x255814[_0x295a('0x37')];if(_0x3f1fbe[_0x295a('0x34')][_0x295a('0x43')]){_0x40275f[_0x295a('0x44')]=[{'all':!![]}];}_0x40275f=_[_0x295a('0x40')]({},_0x40275f,_0x3f1fbe[_0x295a('0x48')]);return db[_0x295a('0x2e')][_0x295a('0x49')](_0x40275f)[_0x295a('0x28')](handleEntityNotFound(_0x4fe10c,null))[_0x295a('0x28')](respondWithResult(_0x4fe10c,null))[_0x295a('0x46')](handleError(_0x4fe10c,null));};exports['create']=function(_0x1f5177,_0x27028d){return db[_0x295a('0x2e')][_0x295a('0x4a')](_0x1f5177[_0x295a('0x4b')],{})['then'](respondWithResult(_0x27028d,0xc9))[_0x295a('0x46')](handleError(_0x27028d,null));};exports[_0x295a('0x4c')]=function(_0x27c775,_0x3f8f7d){return db[_0x295a('0x2e')][_0x295a('0x4c')]()[_0x295a('0x28')](respondWithResult(_0x3f8f7d,null))[_0x295a('0x46')](handleError(_0x3f8f7d,null));};exports[_0x295a('0x27')]=function(_0x1e7619,_0x2aa210){if(_0x1e7619[_0x295a('0x4b')][_0x295a('0x4d')]){delete _0x1e7619[_0x295a('0x4b')][_0x295a('0x4d')];}return db['CmHopperHistory'][_0x295a('0x49')]({'where':{'uniqueid':_0x1e7619[_0x295a('0x4e')]['id']}})[_0x295a('0x28')](handleEntityNotFound(_0x2aa210,null))[_0x295a('0x28')](saveUpdates(_0x1e7619[_0x295a('0x4b')],null))[_0x295a('0x28')](respondWithResult(_0x2aa210,null))['catch'](handleError(_0x2aa210,null));}; \ No newline at end of file +var _0xbc1a=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','options','includeAll','include','findAll','show','params','catch','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','CmHopperHistory','rawAttributes'];(function(_0x5481df,_0x4c6063){var _0x95c09a=function(_0x122167){while(--_0x122167){_0x5481df['push'](_0x5481df['shift']());}};_0x95c09a(++_0x4c6063);}(_0xbc1a,0x1d8));var _0xabc1=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xbc1a[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0xabc1('0x0'));var rimraf=require(_0xabc1('0x1'));var zipdir=require(_0xabc1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabc1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xabc1('0x4'));var util=require(_0xabc1('0x5'));var path=require('path');var sox=require(_0xabc1('0x6'));var csv=require(_0xabc1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabc1('0x8'));var squel=require(_0xabc1('0x9'));var crypto=require(_0xabc1('0xa'));var jsforce=require(_0xabc1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xabc1('0x7'));var querystring=require(_0xabc1('0xc'));var Papa=require(_0xabc1('0xd'));var Redis=require(_0xabc1('0xe'));var authService=require(_0xabc1('0xf'));var qs=require(_0xabc1('0x10'));var as=require(_0xabc1('0x11'));var hardwareService=require(_0xabc1('0x12'));var logger=require(_0xabc1('0x13'))(_0xabc1('0x14'));var utils=require(_0xabc1('0x15'));var config=require(_0xabc1('0x16'));var licenseUtil=require(_0xabc1('0x17'));var db=require(_0xabc1('0x18'))['db'];function respondWithStatusCode(_0x3bf283,_0x5c3e9f){_0x5c3e9f=_0x5c3e9f||0xcc;return function(_0x4e06b3){if(_0x4e06b3){return _0x3bf283[_0xabc1('0x19')](_0x5c3e9f);}return _0x3bf283['status'](_0x5c3e9f)[_0xabc1('0x1a')]();};}function respondWithResult(_0x270284,_0x2f19fa){_0x2f19fa=_0x2f19fa||0xc8;return function(_0x59c2f5){if(_0x59c2f5){return _0x270284[_0xabc1('0x1b')](_0x2f19fa)[_0xabc1('0x1c')](_0x59c2f5);}};}function respondWithFilteredResult(_0x25c554,_0x2b18e7){return function(_0xa2f5fb){if(_0xa2f5fb){var _0x44f117=typeof _0x2b18e7[_0xabc1('0x1d')]===_0xabc1('0x1e')&&typeof _0x2b18e7[_0xabc1('0x1f')]===_0xabc1('0x1e');var _0x1cc6be=_0xa2f5fb['count'];var _0x55901b=_0x44f117?0x0:_0x2b18e7[_0xabc1('0x1d')];var _0xf1732d=_0x44f117?_0xa2f5fb[_0xabc1('0x20')]:_0x2b18e7[_0xabc1('0x1d')]+_0x2b18e7[_0xabc1('0x1f')];var _0x20c83c;if(_0xf1732d>=_0x1cc6be){_0xf1732d=_0x1cc6be;_0x20c83c=0xc8;}else{_0x20c83c=0xce;}_0x25c554[_0xabc1('0x1b')](_0x20c83c);return _0x25c554[_0xabc1('0x21')](_0xabc1('0x22'),_0x55901b+'-'+_0xf1732d+'/'+_0x1cc6be)[_0xabc1('0x1c')](_0xa2f5fb);}return null;};}function patchUpdates(_0x2e7017){return function(_0x52e8a7){try{jsonpatch[_0xabc1('0x23')](_0x52e8a7,_0x2e7017,!![]);}catch(_0x5a81b0){return BPromise[_0xabc1('0x24')](_0x5a81b0);}return _0x52e8a7[_0xabc1('0x25')]();};}function saveUpdates(_0xc1db6,_0x51506c){return function(_0x1cab22){if(_0x1cab22){return _0x1cab22[_0xabc1('0x26')](_0xc1db6)[_0xabc1('0x27')](function(_0x35c788){return _0x35c788;});}return null;};}function removeEntity(_0x18edff,_0x572651){return function(_0x4b9438){if(_0x4b9438){return _0x4b9438[_0xabc1('0x28')]()[_0xabc1('0x27')](function(){_0x18edff[_0xabc1('0x1b')](0xcc)[_0xabc1('0x1a')]();});}};}function handleEntityNotFound(_0x3a16f3,_0x4d99b1){return function(_0x480a43){if(!_0x480a43){_0x3a16f3[_0xabc1('0x19')](0x194);}return _0x480a43;};}function handleError(_0x5719ba,_0x129a3f){_0x129a3f=_0x129a3f||0x1f4;return function(_0x29e99a){logger['error'](_0x29e99a[_0xabc1('0x29')]);if(_0x29e99a[_0xabc1('0x2a')]){delete _0x29e99a[_0xabc1('0x2a')];}_0x5719ba[_0xabc1('0x1b')](_0x129a3f)[_0xabc1('0x2b')](_0x29e99a);};}exports['index']=function(_0x19c817,_0x56244d){var _0x1df625={},_0x7a94d9={},_0x2b8520={'count':0x0,'rows':[]};var _0x492884=_['map'](db[_0xabc1('0x2c')][_0xabc1('0x2d')],function(_0x53b332){return{'name':_0x53b332[_0xabc1('0x2e')],'type':_0x53b332[_0xabc1('0x2f')][_0xabc1('0x30')]};});_0x7a94d9[_0xabc1('0x31')]=_[_0xabc1('0x32')](_0x492884,_0xabc1('0x2a'));_0x7a94d9[_0xabc1('0x33')]=_[_0xabc1('0x34')](_0x19c817[_0xabc1('0x33')]);_0x7a94d9[_0xabc1('0x35')]=_[_0xabc1('0x36')](_0x7a94d9[_0xabc1('0x31')],_0x7a94d9[_0xabc1('0x33')]);_0x1df625[_0xabc1('0x37')]=_[_0xabc1('0x36')](_0x7a94d9['model'],qs[_0xabc1('0x38')](_0x19c817['query']['fields']));_0x1df625[_0xabc1('0x37')]=_0x1df625['attributes'][_0xabc1('0x39')]?_0x1df625[_0xabc1('0x37')]:_0x7a94d9[_0xabc1('0x31')];if(!_0x19c817[_0xabc1('0x33')]['hasOwnProperty']('nolimit')){_0x1df625['limit']=qs[_0xabc1('0x1f')](_0x19c817[_0xabc1('0x33')][_0xabc1('0x1f')]);_0x1df625[_0xabc1('0x1d')]=qs[_0xabc1('0x1d')](_0x19c817['query'][_0xabc1('0x1d')]);}_0x1df625[_0xabc1('0x3a')]=qs[_0xabc1('0x3b')](_0x19c817[_0xabc1('0x33')]['sort']);_0x1df625[_0xabc1('0x3c')]=qs['filters'](_[_0xabc1('0x3d')](_0x19c817['query'],_0x7a94d9[_0xabc1('0x35')]),_0x492884);if(_0x19c817[_0xabc1('0x33')]['filter']){_0x1df625[_0xabc1('0x3c')]=_[_0xabc1('0x3e')](_0x1df625[_0xabc1('0x3c')],{'$or':_[_0xabc1('0x32')](_0x492884,function(_0x137e90){if(_0x137e90['type']!=='VIRTUAL'){var _0x360a45={};_0x360a45[_0x137e90[_0xabc1('0x2a')]]={'$like':'%'+_0x19c817['query']['filter']+'%'};return _0x360a45;}})});}_0x1df625=_['merge']({},_0x1df625,_0x19c817[_0xabc1('0x3f')]);var _0x2b782b={'where':_0x1df625['where']};return db[_0xabc1('0x2c')]['count'](_0x2b782b)['then'](function(_0x18904b){_0x2b8520[_0xabc1('0x20')]=_0x18904b;if(_0x19c817[_0xabc1('0x33')][_0xabc1('0x40')]){_0x1df625[_0xabc1('0x41')]=[{'all':!![]}];}return db[_0xabc1('0x2c')][_0xabc1('0x42')](_0x1df625);})[_0xabc1('0x27')](function(_0x48d1fa){_0x2b8520['rows']=_0x48d1fa;return _0x2b8520;})[_0xabc1('0x27')](respondWithFilteredResult(_0x56244d,_0x1df625))['catch'](handleError(_0x56244d,null));};exports[_0xabc1('0x43')]=function(_0x2a20a1,_0x33a678){var _0x29044a={'raw':!![],'where':{'id':_0x2a20a1[_0xabc1('0x44')]['id']}},_0x65955f={};_0x65955f['model']=_['keys'](db[_0xabc1('0x2c')]['rawAttributes']);_0x65955f[_0xabc1('0x33')]=_[_0xabc1('0x34')](_0x2a20a1[_0xabc1('0x33')]);_0x65955f[_0xabc1('0x35')]=_[_0xabc1('0x36')](_0x65955f[_0xabc1('0x31')],_0x65955f[_0xabc1('0x33')]);_0x29044a[_0xabc1('0x37')]=_[_0xabc1('0x36')](_0x65955f['model'],qs[_0xabc1('0x38')](_0x2a20a1[_0xabc1('0x33')][_0xabc1('0x38')]));_0x29044a['attributes']=_0x29044a[_0xabc1('0x37')]['length']?_0x29044a[_0xabc1('0x37')]:_0x65955f['model'];if(_0x2a20a1[_0xabc1('0x33')][_0xabc1('0x40')]){_0x29044a['include']=[{'all':!![]}];}_0x29044a=_[_0xabc1('0x3e')]({},_0x29044a,_0x2a20a1[_0xabc1('0x3f')]);return db[_0xabc1('0x2c')]['find'](_0x29044a)[_0xabc1('0x27')](handleEntityNotFound(_0x33a678,null))['then'](respondWithResult(_0x33a678,null))[_0xabc1('0x45')](handleError(_0x33a678,null));};exports[_0xabc1('0x46')]=function(_0x5631a5,_0x134765){return db[_0xabc1('0x2c')][_0xabc1('0x46')](_0x5631a5['body'],{})['then'](respondWithResult(_0x134765,0xc9))[_0xabc1('0x45')](handleError(_0x134765,null));};exports['describe']=function(_0x4b730b,_0x2db814){return db['CmHopperHistory'][_0xabc1('0x47')]()[_0xabc1('0x27')](respondWithResult(_0x2db814,null))[_0xabc1('0x45')](handleError(_0x2db814,null));};exports[_0xabc1('0x26')]=function(_0x416242,_0x39644c){if(_0x416242[_0xabc1('0x48')][_0xabc1('0x49')]){delete _0x416242[_0xabc1('0x48')]['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x416242[_0xabc1('0x44')]['id']}})['then'](handleEntityNotFound(_0x39644c,null))[_0xabc1('0x27')](saveUpdates(_0x416242['body'],null))['then'](respondWithResult(_0x39644c,null))[_0xabc1('0x45')](handleError(_0x39644c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e52cc0b..2d08253 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 _0xf69c=['path','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0x78aa15,_0x26a15e){var _0x839de8=function(_0x4c46b1){while(--_0x4c46b1){_0x78aa15['push'](_0x78aa15['shift']());}};_0x839de8(++_0x26a15e);}(_0xf69c,0x151));var _0xcf69=function(_0x48a0b4,_0x2a4c3f){_0x48a0b4=_0x48a0b4-0x0;var _0x44b1e6=_0xf69c[_0x48a0b4];return _0x44b1e6;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var logger=require(_0xcf69('0x1'))(_0xcf69('0x2'));var moment=require('moment');var BPromise=require(_0xcf69('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf69('0x4'));var rimraf=require('rimraf');var config=require(_0xcf69('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0xcf69('0x6')]=function(_0x168197,_0x225c65){return _0x168197[_0xcf69('0x7')](_0xcf69('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xcf69('0x9'),'fields':[_0xcf69('0x9')]},{'name':_0xcf69('0xa'),'fields':[_0xcf69('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xc113,0x1ab));var _0x3c11=function(_0x4cd578,_0x40a350){_0x4cd578=_0x4cd578-0x0;var _0x59d511=_0xc113[_0x4cd578];return _0x59d511;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b1f1e31..40271b7 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 _0x01f6=['predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','CreateCmHopperHistory','debug','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','literal','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x01f6,0xea));var _0x601f=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x01f6[_0xbe40ad];return _0x50fac9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x601f('0x0'));var BPromise=require(_0x601f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x601f('0x2'));var db=require(_0x601f('0x3'))['db'];var utils=require(_0x601f('0x4'));var logger=require(_0x601f('0x5'))(_0x601f('0x6'));var config=require('../../config/environment');var jayson=require(_0x601f('0x7'));var client=jayson['client'][_0x601f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4822c4,_0x54bb25,_0x5c7026){return new BPromise(function(_0x3c3b38,_0x3a8d6c){return client[_0x601f('0x9')](_0x4822c4,_0x5c7026)[_0x601f('0xa')](function(_0x37335b){logger[_0x601f('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x54bb25,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x54bb25,_0x601f('0xc'),JSON[_0x601f('0xd')](_0x37335b));if(_0x37335b['error']){if(_0x37335b[_0x601f('0xe')][_0x601f('0xf')]===0x1f4){logger[_0x601f('0xe')](_0x601f('0x10'),_0x54bb25,_0x37335b[_0x601f('0xe')]['message']);return _0x3a8d6c(_0x37335b[_0x601f('0xe')][_0x601f('0x11')]);}logger[_0x601f('0xe')](_0x601f('0x10'),_0x54bb25,_0x37335b[_0x601f('0xe')][_0x601f('0x11')]);return _0x3c3b38(_0x37335b['error']['message']);}else{logger[_0x601f('0xb')](_0x601f('0x10'),_0x54bb25,_0x601f('0xc'));_0x3c3b38(_0x37335b[_0x601f('0x12')][_0x601f('0x11')]);}})[_0x601f('0x13')](function(_0x44fdf9){logger[_0x601f('0xe')](_0x601f('0x10'),_0x54bb25,_0x44fdf9);_0x3a8d6c(_0x44fdf9);});});}exports['CreateCmHopperHistory']=function(_0x53fa67){var _0x1e2c46=this;return new Promise(function(_0x40faa0,_0x2399da){return db[_0x601f('0x14')][_0x601f('0x15')](_0x53fa67[_0x601f('0x16')],{'raw':_0x53fa67[_0x601f('0x17')]?_0x53fa67[_0x601f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x601f('0xa')](function(_0xaf88cc){logger['info'](_0x601f('0x18'),_0x53fa67);logger[_0x601f('0x19')](_0x601f('0x18'),_0x53fa67,JSON['stringify'](_0xaf88cc));_0x40faa0(_0xaf88cc);})[_0x601f('0x13')](function(_0x2210e3){logger['error']('CreateCmHopperHistory',_0x2210e3[_0x601f('0x11')],_0x53fa67);_0x2399da(_0x1e2c46['error'](0x1f4,_0x2210e3[_0x601f('0x11')]));});});};exports['AvgHandleTime']=function(_0x1c9ef3){var _0x933313=this;return new Promise(function(_0x11e1f5,_0x15fbcb){return db['CmHopperHistory'][_0x601f('0x1a')]({'raw':_0x1c9ef3['options']?_0x1c9ef3['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c9ef3[_0x601f('0x17')]?_0x1c9ef3[_0x601f('0x17')][_0x601f('0x1b')]||null:null,'attributes':[[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')][_0x601f('0x1e')]('id')),_0x601f('0x1f')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')]['literal'](_0x601f('0x20')))),'predictiveIntervalAnsweredCalls'],[db[_0x601f('0x1c')]['fn']('COUNT',db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')]['literal'](_0x601f('0x21')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0x601f('0x23')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x24'),db['sequelize']['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x25')))),_0x601f('0x26')],[db['sequelize']['fn'](_0x601f('0x24'),db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x27')))),_0x601f('0x28')]]})['then'](function(_0x58712a){logger['info'](_0x601f('0x29'),_0x1c9ef3);logger[_0x601f('0x19')]('AvgHandleTime',_0x1c9ef3,JSON[_0x601f('0xd')](_0x58712a));_0x11e1f5(_0x58712a);})[_0x601f('0x13')](function(_0x3cb6b4){logger[_0x601f('0xe')]('AvgHandleTime',_0x3cb6b4[_0x601f('0x11')],_0x1c9ef3);_0x15fbcb(_0x933313['error'](0x1f4,_0x3cb6b4[_0x601f('0x11')]));});});};exports[_0x601f('0x2a')]=function(_0x24ed27){var _0x27fbb7=this;return new Promise(function(_0x907e17,_0x2273d1){return db[_0x601f('0x14')][_0x601f('0x1a')]({'raw':_0x24ed27[_0x601f('0x17')]?_0x24ed27['options'][_0x601f('0x2b')]===undefined?!![]:![]:!![],'where':_0x24ed27[_0x601f('0x17')]?_0x24ed27['options'][_0x601f('0x1b')]||null:null,'attributes':[[_0x601f('0x2c'),_0x601f('0x2d')],[db['sequelize']['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x2f')))),_0x601f('0x30')],[db['sequelize']['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')]['literal'](_0x601f('0x20')))),_0x601f('0x31')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db['sequelize']['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x32')))),_0x601f('0x33')],[db[_0x601f('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x34')))),_0x601f('0x35')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x601f('0x36')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x37')))),_0x601f('0x38')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x39')))),_0x601f('0x3a')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x3b')))),'outboundBlacklistCallsDay'],[db[_0x601f('0x1c')]['fn']('COUNT',db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x601f('0x3c')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x601f('0x3d')],[db[_0x601f('0x1c')]['fn']('COUNT',db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x601f('0x3e')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x3f')))),_0x601f('0x3d')],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db['sequelize'][_0x601f('0x22')](_0x601f('0x40')))),_0x601f('0x41')]],'group':[_0x601f('0x2c')]})[_0x601f('0xa')](function(_0x4b099e){logger[_0x601f('0xb')](_0x601f('0x2a'),_0x24ed27);logger['debug'](_0x601f('0x2a'),_0x24ed27,JSON['stringify'](_0x4b099e));_0x907e17(_0x4b099e);})['catch'](function(_0x5e9025){logger['error']('GetVoiceQueueHopperHistory',_0x5e9025[_0x601f('0x11')],_0x24ed27);_0x2273d1(_0x27fbb7[_0x601f('0xe')](0x1f4,_0x5e9025[_0x601f('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x2728f1){var _0x3d4c93=this;return new Promise(function(_0xd35d26,_0x56f807){return db['CmHopperHistory'][_0x601f('0x1a')]({'raw':_0x2728f1[_0x601f('0x17')]?_0x2728f1[_0x601f('0x17')][_0x601f('0x2b')]===undefined?!![]:![]:!![],'where':_0x2728f1[_0x601f('0x17')]?_0x2728f1[_0x601f('0x17')][_0x601f('0x1b')]||null:null,'attributes':[[_0x601f('0x2c'),'name'],[db[_0x601f('0x1c')]['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')][_0x601f('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x601f('0x1d'),db[_0x601f('0x1c')]['fn']('IF',db[_0x601f('0x1c')][_0x601f('0x22')](_0x601f('0x20')))),_0x601f('0x42')]],'group':[_0x601f('0x2c')]})[_0x601f('0xa')](function(_0x41f500){logger['info'](_0x601f('0x43'),_0x2728f1);logger['debug']('GetCampaignHopperHistory',_0x2728f1,JSON[_0x601f('0xd')](_0x41f500));_0xd35d26(_0x41f500);})['catch'](function(_0xc8121){logger[_0x601f('0xe')](_0x601f('0x43'),_0xc8121[_0x601f('0x11')],_0x2728f1);_0x56f807(_0x3d4c93[_0x601f('0xe')](0x1f4,_0xc8121['message']));});});}; \ No newline at end of file +var _0xeffd=['body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','COUNT','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create'];(function(_0x192f8a,_0x5c4a7c){var _0x2d43f4=function(_0x5269d8){while(--_0x5269d8){_0x192f8a['push'](_0x192f8a['shift']());}};_0x2d43f4(++_0x5c4a7c);}(_0xeffd,0x6b));var _0xdeff=function(_0xa5b643,_0x36c023){_0xa5b643=_0xa5b643-0x0;var _0x51969b=_0xeffd[_0xa5b643];return _0x51969b;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}exports['CreateCmHopperHistory']=function(_0x5c9837){var _0x35635f=this;return new Promise(function(_0x369e13,_0x4b14b6){return db[_0xdeff('0x19')][_0xdeff('0x1a')](_0x5c9837[_0xdeff('0x1b')],{'raw':_0x5c9837[_0xdeff('0x1c')]?_0x5c9837[_0xdeff('0x1c')][_0xdeff('0x1d')]===undefined?!![]:![]:!![]})[_0xdeff('0xd')](function(_0x919c93){logger['info']('CreateCmHopperHistory',_0x5c9837);logger['debug'](_0xdeff('0x1e'),_0x5c9837,JSON['stringify'](_0x919c93));_0x369e13(_0x919c93);})[_0xdeff('0x18')](function(_0x91c0b4){logger['error'](_0xdeff('0x1e'),_0x91c0b4[_0xdeff('0x16')],_0x5c9837);_0x4b14b6(_0x35635f['error'](0x1f4,_0x91c0b4['message']));});});};exports[_0xdeff('0x1f')]=function(_0x15c425){var _0x253eed=this;return new Promise(function(_0x31510c,_0x32add9){return db['CmHopperHistory'][_0xdeff('0x20')]({'raw':_0x15c425[_0xdeff('0x1c')]?_0x15c425[_0xdeff('0x1c')][_0xdeff('0x1d')]===undefined?!![]:![]:!![],'where':_0x15c425[_0xdeff('0x1c')]?_0x15c425[_0xdeff('0x1c')][_0xdeff('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x25')))),_0xdeff('0x26')],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xdeff('0x27')],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')]['literal'](_0xdeff('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xdeff('0x29'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xdeff('0x2a')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x29'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xdeff('0xd')](function(_0x5cef77){logger[_0xdeff('0xe')](_0xdeff('0x1f'),_0x15c425);logger[_0xdeff('0x10')](_0xdeff('0x1f'),_0x15c425,JSON[_0xdeff('0x12')](_0x5cef77));_0x31510c(_0x5cef77);})[_0xdeff('0x18')](function(_0x52baf5){logger[_0xdeff('0x13')](_0xdeff('0x1f'),_0x52baf5['message'],_0x15c425);_0x32add9(_0x253eed[_0xdeff('0x13')](0x1f4,_0x52baf5[_0xdeff('0x16')]));});});};exports[_0xdeff('0x2c')]=function(_0x387c19){var _0x233479=this;return new Promise(function(_0xe511b2,_0x4268e4){return db[_0xdeff('0x19')]['findAll']({'raw':_0x387c19[_0xdeff('0x1c')]?_0x387c19['options'][_0xdeff('0x1d')]===undefined?!![]:![]:!![],'where':_0x387c19[_0xdeff('0x1c')]?_0x387c19[_0xdeff('0x1c')]['where']||null:null,'attributes':[[_0xdeff('0x2d'),_0xdeff('0x2e')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db['sequelize'][_0xdeff('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0xdeff('0x2f')],[db[_0xdeff('0x23')]['fn']('COUNT',db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x30')))),_0xdeff('0x31')],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x25')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x32')))),_0xdeff('0x33')],[db[_0xdeff('0x23')]['fn']('COUNT',db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x208,\x201,\x20null'))),_0xdeff('0x34')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db['sequelize'][_0xdeff('0x24')](_0xdeff('0x35')))),_0xdeff('0x36')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdeff('0x37')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')]['literal'](_0xdeff('0x38')))),_0xdeff('0x39')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db['sequelize'][_0xdeff('0x24')]('`state`\x20=\x2013,\x201,\x20null'))),_0xdeff('0x3a')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db['sequelize']['literal'](_0xdeff('0x3b')))),_0xdeff('0x3c')],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')]['literal'](_0xdeff('0x3d')))),_0xdeff('0x3e')],[db[_0xdeff('0x23')]['fn']('COUNT',db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')](_0xdeff('0x3f')))),_0xdeff('0x3c')],[db[_0xdeff('0x23')]['fn'](_0xdeff('0x22'),db['sequelize']['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xdeff('0x40')]],'group':[_0xdeff('0x2d')]})[_0xdeff('0xd')](function(_0x33482b){logger[_0xdeff('0xe')](_0xdeff('0x2c'),_0x387c19);logger[_0xdeff('0x10')](_0xdeff('0x2c'),_0x387c19,JSON['stringify'](_0x33482b));_0xe511b2(_0x33482b);})[_0xdeff('0x18')](function(_0x3a518d){logger[_0xdeff('0x13')]('GetVoiceQueueHopperHistory',_0x3a518d['message'],_0x387c19);_0x4268e4(_0x233479[_0xdeff('0x13')](0x1f4,_0x3a518d[_0xdeff('0x16')]));});});};exports[_0xdeff('0x41')]=function(_0x22c5cc){var _0x440053=this;return new Promise(function(_0x3db4fd,_0x5eabdf){return db['CmHopperHistory'][_0xdeff('0x20')]({'raw':_0x22c5cc[_0xdeff('0x1c')]?_0x22c5cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x22c5cc[_0xdeff('0x1c')]?_0x22c5cc[_0xdeff('0x1c')]['where']||null:null,'attributes':[[_0xdeff('0x2d'),_0xdeff('0x2e')],[db['sequelize']['fn'](_0xdeff('0x22'),db[_0xdeff('0x23')]['col']('id')),_0xdeff('0x42')],[db[_0xdeff('0x23')]['fn']('COUNT',db[_0xdeff('0x23')]['fn']('IF',db[_0xdeff('0x23')][_0xdeff('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xdeff('0x2d')]})['then'](function(_0x38df65){logger[_0xdeff('0xe')](_0xdeff('0x41'),_0x22c5cc);logger[_0xdeff('0x10')](_0xdeff('0x41'),_0x22c5cc,JSON['stringify'](_0x38df65));_0x3db4fd(_0x38df65);})['catch'](function(_0x98d18c){logger[_0xdeff('0x13')](_0xdeff('0x41'),_0x98d18c[_0xdeff('0x16')],_0x22c5cc);_0x5eabdf(_0x440053[_0xdeff('0x13')](0x1f4,_0x98d18c[_0xdeff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index de8f899..b92f875 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 _0xd5a8=['create','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show'];(function(_0xd9f3f0,_0x5d292a){var _0x54995a=function(_0x54ca4d){while(--_0x54ca4d){_0xd9f3f0['push'](_0xd9f3f0['shift']());}};_0x54995a(++_0x5d292a);}(_0xd5a8,0x147));var _0x8d5a=function(_0x2d4fe8,_0x2901b6){_0x2d4fe8=_0x2d4fe8-0x0;var _0x5bdf52=_0xd5a8[_0x2d4fe8];return _0x5bdf52;};'use strict';var multer=require('multer');var util=require(_0x8d5a('0x0'));var path=require(_0x8d5a('0x1'));var timeout=require(_0x8d5a('0x2'));var express=require(_0x8d5a('0x3'));var router=express[_0x8d5a('0x4')]();var fs_extra=require(_0x8d5a('0x5'));var auth=require(_0x8d5a('0x6'));var interaction=require(_0x8d5a('0x7'));var config=require(_0x8d5a('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x8d5a('0x9')](),controller[_0x8d5a('0xa')]);router['get'](_0x8d5a('0xb'),auth[_0x8d5a('0x9')](),controller['describe']);router[_0x8d5a('0xc')](_0x8d5a('0xd'),auth[_0x8d5a('0x9')](),controller[_0x8d5a('0xe')]);router['post']('/',auth[_0x8d5a('0x9')](),controller[_0x8d5a('0xf')]);router[_0x8d5a('0x10')](_0x8d5a('0xd'),auth[_0x8d5a('0x9')](),controller[_0x8d5a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdc19=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x4f94b4,_0xddca5d){var _0xbc5b3=function(_0x1c76e2){while(--_0x1c76e2){_0x4f94b4['push'](_0x4f94b4['shift']());}};_0xbc5b3(++_0xddca5d);}(_0xdc19,0xa6));var _0x9dc1=function(_0x1557d3,_0x576645){_0x1557d3=_0x1557d3-0x0;var _0x1b9f33=_0xdc19[_0x1557d3];return _0x1b9f33;};'use strict';var multer=require(_0x9dc1('0x0'));var util=require(_0x9dc1('0x1'));var path=require(_0x9dc1('0x2'));var timeout=require(_0x9dc1('0x3'));var express=require(_0x9dc1('0x4'));var router=express[_0x9dc1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9dc1('0x6'));var interaction=require(_0x9dc1('0x7'));var config=require('../../config/environment');var controller=require(_0x9dc1('0x8'));router[_0x9dc1('0x9')]('/',auth[_0x9dc1('0xa')](),controller[_0x9dc1('0xb')]);router['get'](_0x9dc1('0xc'),auth[_0x9dc1('0xa')](),controller[_0x9dc1('0xd')]);router[_0x9dc1('0x9')](_0x9dc1('0xe'),auth[_0x9dc1('0xa')](),controller[_0x9dc1('0xf')]);router[_0x9dc1('0x10')]('/',auth[_0x9dc1('0xa')](),controller[_0x9dc1('0x11')]);router[_0x9dc1('0x12')](_0x9dc1('0xe'),auth[_0x9dc1('0xa')](),controller[_0x9dc1('0x13')]);module[_0x9dc1('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 77f1ae5..888b940 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 _0xfd8f=['name','STRING','sequelize','exports'];(function(_0x4bc7c8,_0x54801b){var _0x211398=function(_0x5091f8){while(--_0x5091f8){_0x4bc7c8['push'](_0x4bc7c8['shift']());}};_0x211398(++_0x54801b);}(_0xfd8f,0xae));var _0xffd8=function(_0x4cfb50,_0x5641c6){_0x4cfb50=_0x4cfb50-0x0;var _0x162ef2=_0xfd8f[_0x4cfb50];return _0x162ef2;};'use strict';var Sequelize=require(_0xffd8('0x0'));module[_0xffd8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xffd8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xffd8('0x3')]},'dialPrefix':{'type':Sequelize[_0xffd8('0x3')]}}; \ No newline at end of file +var _0xcabc=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcabc,0x16a));var _0xccab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcabc[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'name':{'type':Sequelize[_0xccab('0x1')],'unique':_0xccab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xccab('0x1')]},'dialPrefix':{'type':Sequelize[_0xccab('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ca0b3af..021cc74 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 _0xbce1=['set','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','describe','addDisposition','Disposition','findOne','order','ListId','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','Sequelize','TEXT','number','INTEGER','defaultValue','sequelize','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','count'];(function(_0x3da09c,_0x9884f2){var _0x9f9809=function(_0x1b0948){while(--_0x1b0948){_0x3da09c['push'](_0x3da09c['shift']());}};_0x9f9809(++_0x9884f2);}(_0xbce1,0x7c));var _0x1bce=function(_0x4725c1,_0x5ee2af){_0x4725c1=_0x4725c1-0x0;var _0x13ef4e=_0xbce1[_0x4725c1];return _0x13ef4e;};'use strict';var emlformat=require(_0x1bce('0x0'));var rimraf=require(_0x1bce('0x1'));var zipdir=require(_0x1bce('0x2'));var jsonpatch=require(_0x1bce('0x3'));var rp=require('request-promise');var moment=require(_0x1bce('0x4'));var BPromise=require(_0x1bce('0x5'));var Mustache=require(_0x1bce('0x6'));var util=require(_0x1bce('0x7'));var path=require(_0x1bce('0x8'));var sox=require('sox');var csv=require(_0x1bce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bce('0xa'));var _=require(_0x1bce('0xb'));var squel=require(_0x1bce('0xc'));var crypto=require(_0x1bce('0xd'));var jsforce=require(_0x1bce('0xe'));var deskjs=require(_0x1bce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1bce('0x10'));var Papa=require(_0x1bce('0x11'));var Redis=require(_0x1bce('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1bce('0x13'));var as=require(_0x1bce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bce('0x15'))('api');var utils=require(_0x1bce('0x16'));var config=require(_0x1bce('0x17'));var licenseUtil=require(_0x1bce('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x1bce('0x19')]=_[_0x1bce('0x1a')](config['redis'],{'host':_0x1bce('0x1b'),'port':0x18eb});var socket=require(_0x1bce('0x1c'))(new Redis(config[_0x1bce('0x19')]));require('./cmList.socket')[_0x1bce('0x1d')](socket);function respondWithStatusCode(_0x598c6c,_0x28d551){_0x28d551=_0x28d551||0xcc;return function(_0x4e0d6d){if(_0x4e0d6d){return _0x598c6c[_0x1bce('0x1e')](_0x28d551);}return _0x598c6c['status'](_0x28d551)[_0x1bce('0x1f')]();};}function respondWithResult(_0x3f4927,_0x504506){_0x504506=_0x504506||0xc8;return function(_0x401559){if(_0x401559){return _0x3f4927[_0x1bce('0x20')](_0x504506)[_0x1bce('0x21')](_0x401559);}};}function respondWithFilteredResult(_0x91f57,_0x45aa07){return function(_0x5b9ee5){if(_0x5b9ee5){var _0x3934d7=typeof _0x45aa07[_0x1bce('0x22')]==='undefined'&&typeof _0x45aa07['limit']==='undefined';var _0x3cb958=_0x5b9ee5[_0x1bce('0x23')];var _0x548d2e=_0x3934d7?0x0:_0x45aa07[_0x1bce('0x22')];var _0x503f10=_0x3934d7?_0x5b9ee5[_0x1bce('0x23')]:_0x45aa07[_0x1bce('0x22')]+_0x45aa07['limit'];var _0x500de7;if(_0x503f10>=_0x3cb958){_0x503f10=_0x3cb958;_0x500de7=0xc8;}else{_0x500de7=0xce;}_0x91f57[_0x1bce('0x20')](_0x500de7);return _0x91f57[_0x1bce('0x24')]('Content-Range',_0x548d2e+'-'+_0x503f10+'/'+_0x3cb958)['json'](_0x5b9ee5);}return null;};}function patchUpdates(_0x2022af){return function(_0x5972e2){try{jsonpatch[_0x1bce('0x25')](_0x5972e2,_0x2022af,!![]);}catch(_0x3567f1){return BPromise[_0x1bce('0x26')](_0x3567f1);}return _0x5972e2['save']();};}function saveUpdates(_0x4d723d,_0x49f424){return function(_0x2dd7d0){if(_0x2dd7d0){return _0x2dd7d0[_0x1bce('0x27')](_0x4d723d)[_0x1bce('0x28')](function(_0x3d26ee){return _0x3d26ee;});}return null;};}function removeEntity(_0xd71871,_0x1d2687){return function(_0x3e9e5a){if(_0x3e9e5a){return _0x3e9e5a[_0x1bce('0x29')]()[_0x1bce('0x28')](function(){var _0x2098a5=_0x3e9e5a[_0x1bce('0x2a')]({'plain':!![]});var _0x3d15a7='Lists';return db[_0x1bce('0x2b')][_0x1bce('0x29')]({'where':{'type':_0x3d15a7,'resourceId':_0x2098a5['id']}})['then'](function(){return _0x3e9e5a;});})[_0x1bce('0x28')](function(){_0xd71871['status'](0xcc)[_0x1bce('0x1f')]();});}};}function handleEntityNotFound(_0xcff3d4,_0x27c5c5){return function(_0x183f2e){if(!_0x183f2e){_0xcff3d4[_0x1bce('0x1e')](0x194);}return _0x183f2e;};}function handleError(_0x11feda,_0x537b8e){_0x537b8e=_0x537b8e||0x1f4;return function(_0xcdab69){logger[_0x1bce('0x2c')](_0xcdab69[_0x1bce('0x2d')]);if(_0xcdab69[_0x1bce('0x2e')]){delete _0xcdab69[_0x1bce('0x2e')];}_0x11feda[_0x1bce('0x20')](_0x537b8e)[_0x1bce('0x2f')](_0xcdab69);};}exports['index']=function(_0x4437ce,_0x52467a){var _0x4fd759={},_0x143477={},_0x57ff1d={'count':0x0,'rows':[]};var _0x2c3898=_['map'](db[_0x1bce('0x30')][_0x1bce('0x31')],function(_0x255b1c){return{'name':_0x255b1c[_0x1bce('0x32')],'type':_0x255b1c[_0x1bce('0x33')][_0x1bce('0x34')]};});_0x143477[_0x1bce('0x35')]=_[_0x1bce('0x36')](_0x2c3898,_0x1bce('0x2e'));_0x143477[_0x1bce('0x37')]=_[_0x1bce('0x38')](_0x4437ce[_0x1bce('0x37')]);_0x143477[_0x1bce('0x39')]=_[_0x1bce('0x3a')](_0x143477['model'],_0x143477['query']);_0x4fd759[_0x1bce('0x3b')]=_['intersection'](_0x143477['model'],qs['fields'](_0x4437ce[_0x1bce('0x37')][_0x1bce('0x3c')]));_0x4fd759[_0x1bce('0x3b')]=_0x4fd759[_0x1bce('0x3b')]['length']?_0x4fd759[_0x1bce('0x3b')]:_0x143477[_0x1bce('0x35')];if(!_0x4437ce[_0x1bce('0x37')][_0x1bce('0x3d')](_0x1bce('0x3e'))){_0x4fd759[_0x1bce('0x3f')]=qs[_0x1bce('0x3f')](_0x4437ce['query'][_0x1bce('0x3f')]);_0x4fd759[_0x1bce('0x22')]=qs[_0x1bce('0x22')](_0x4437ce[_0x1bce('0x37')]['offset']);}_0x4fd759['order']=qs[_0x1bce('0x40')](_0x4437ce['query'][_0x1bce('0x40')]);_0x4fd759['where']=qs[_0x1bce('0x39')](_[_0x1bce('0x41')](_0x4437ce[_0x1bce('0x37')],_0x143477[_0x1bce('0x39')]),_0x2c3898);if(_0x4437ce[_0x1bce('0x37')][_0x1bce('0x42')]){_0x4fd759['where']=_[_0x1bce('0x43')](_0x4fd759[_0x1bce('0x44')],{'$or':_[_0x1bce('0x36')](_0x2c3898,function(_0x28f1cc){if(_0x28f1cc[_0x1bce('0x33')]!=='VIRTUAL'){var _0x165798={};_0x165798[_0x28f1cc[_0x1bce('0x2e')]]={'$like':'%'+_0x4437ce['query'][_0x1bce('0x42')]+'%'};return _0x165798;}})});}_0x4fd759=_[_0x1bce('0x43')]({},_0x4fd759,_0x4437ce['options']);var _0x21d00a={'where':_0x4fd759[_0x1bce('0x44')]};return db[_0x1bce('0x30')][_0x1bce('0x23')](_0x21d00a)[_0x1bce('0x28')](function(_0x31315a){_0x57ff1d['count']=_0x31315a;if(_0x4437ce[_0x1bce('0x37')][_0x1bce('0x45')]){_0x4fd759[_0x1bce('0x46')]=[{'all':!![]}];}return db[_0x1bce('0x30')][_0x1bce('0x47')](_0x4fd759);})[_0x1bce('0x28')](function(_0x2d1df3){_0x57ff1d['rows']=_0x2d1df3;return _0x57ff1d;})[_0x1bce('0x28')](respondWithFilteredResult(_0x52467a,_0x4fd759))[_0x1bce('0x48')](handleError(_0x52467a,null));};exports['show']=function(_0x1a6de1,_0x199f4c){var _0x26cd38={'raw':![],'where':{'id':_0x1a6de1[_0x1bce('0x49')]['id']}},_0x379d88={};_0x379d88[_0x1bce('0x35')]=_[_0x1bce('0x38')](db[_0x1bce('0x30')]['rawAttributes']);_0x379d88['query']=_[_0x1bce('0x38')](_0x1a6de1[_0x1bce('0x37')]);_0x379d88[_0x1bce('0x39')]=_[_0x1bce('0x3a')](_0x379d88['model'],_0x379d88[_0x1bce('0x37')]);_0x26cd38['attributes']=_[_0x1bce('0x3a')](_0x379d88[_0x1bce('0x35')],qs[_0x1bce('0x3c')](_0x1a6de1[_0x1bce('0x37')][_0x1bce('0x3c')]));_0x26cd38['attributes']=_0x26cd38[_0x1bce('0x3b')][_0x1bce('0x4a')]?_0x26cd38['attributes']:_0x379d88[_0x1bce('0x35')];if(_0x1a6de1[_0x1bce('0x37')][_0x1bce('0x45')]){_0x26cd38[_0x1bce('0x46')]=[{'all':!![]}];}_0x26cd38=_[_0x1bce('0x43')]({},_0x26cd38,_0x1a6de1[_0x1bce('0x4b')]);return db['CmList'][_0x1bce('0x4c')](_0x26cd38)[_0x1bce('0x28')](handleEntityNotFound(_0x199f4c,null))['then'](respondWithResult(_0x199f4c,null))[_0x1bce('0x48')](handleError(_0x199f4c,null));};exports['create']=function(_0x354b44,_0xbd874c){return db[_0x1bce('0x30')][_0x1bce('0x4d')](_0x354b44[_0x1bce('0x4e')],{})[_0x1bce('0x28')](function(_0x198e6d){var _0x1b9be9=_0x354b44[_0x1bce('0x4f')][_0x1bce('0x2a')]({'plain':!![]});if(!_0x1b9be9)throw new Error(_0x1bce('0x50'));if(_0x1b9be9[_0x1bce('0x51')]===_0x1bce('0x4f')){var _0x40c210=_0x198e6d['get']({'plain':!![]});var _0x41b18d=_0x1bce('0x52');return db['UserProfileSection'][_0x1bce('0x4c')]({'where':{'name':_0x41b18d,'userProfileId':_0x1b9be9['userProfileId']},'raw':!![]})[_0x1bce('0x28')](function(_0x262f83){if(_0x262f83&&_0x262f83['autoAssociation']===0x0){return db[_0x1bce('0x2b')][_0x1bce('0x4d')]({'name':_0x40c210[_0x1bce('0x2e')],'resourceId':_0x40c210['id'],'type':_0x262f83[_0x1bce('0x2e')],'sectionId':_0x262f83['id']},{})[_0x1bce('0x28')](function(){return _0x198e6d;});}else{return _0x198e6d;}})['catch'](function(_0x53f84c){logger[_0x1bce('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f84c);throw _0x53f84c;});}return _0x198e6d;})[_0x1bce('0x28')](respondWithResult(_0xbd874c,0xc9))[_0x1bce('0x48')](handleError(_0xbd874c,null));};exports[_0x1bce('0x27')]=function(_0x5f46ca,_0x135824){if(_0x5f46ca['body']['id']){delete _0x5f46ca[_0x1bce('0x4e')]['id'];}return db[_0x1bce('0x30')][_0x1bce('0x4c')]({'where':{'id':_0x5f46ca[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x135824,null))[_0x1bce('0x28')](saveUpdates(_0x5f46ca[_0x1bce('0x4e')],null))['then'](respondWithResult(_0x135824,null))[_0x1bce('0x48')](handleError(_0x135824,null));};exports[_0x1bce('0x29')]=function(_0x303c62,_0x19a4b9){return db[_0x1bce('0x30')]['find']({'where':{'id':_0x303c62[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x19a4b9,null))[_0x1bce('0x28')](removeEntity(_0x19a4b9,null))[_0x1bce('0x48')](handleError(_0x19a4b9,null));};exports[_0x1bce('0x53')]=function(_0x4cf9b6,_0x398043){return db['CmList'][_0x1bce('0x53')]()['then'](respondWithResult(_0x398043,null))['catch'](handleError(_0x398043,null));};exports[_0x1bce('0x54')]=function(_0xd71b52,_0xcfa07d,_0x4a986d){if(_0xd71b52['body']['id']){delete _0xd71b52[_0x1bce('0x4e')]['id'];}return db[_0x1bce('0x30')]['find']({'where':{'id':_0xd71b52[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0xcfa07d,null))[_0x1bce('0x28')](function(_0x2bd00c){if(_0x2bd00c){_0xd71b52[_0x1bce('0x4e')]['ListId']=_0x2bd00c['id'];return db[_0x1bce('0x55')][_0x1bce('0x4d')](_0xd71b52[_0x1bce('0x4e')]);}})['then'](respondWithResult(_0xcfa07d,null))[_0x1bce('0x48')](handleError(_0xcfa07d,null));};exports['getDispositions']=function(_0x37acac,_0x2d8a05,_0xecf848){var _0x523d67={'raw':![],'where':{}};var _0x240517={};var _0x3df71b={'count':0x0,'rows':[]};return db[_0x1bce('0x30')][_0x1bce('0x56')]({'where':{'id':_0x37acac[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x2d8a05,null))[_0x1bce('0x28')](function(_0x47cf8a){if(_0x47cf8a){_0x240517[_0x1bce('0x35')]=_['keys'](db[_0x1bce('0x55')]['rawAttributes']);_0x240517[_0x1bce('0x37')]=_['keys'](_0x37acac[_0x1bce('0x37')]);_0x240517['filters']=_[_0x1bce('0x3a')](_0x240517[_0x1bce('0x35')],_0x240517[_0x1bce('0x37')]);_0x523d67[_0x1bce('0x3b')]=_[_0x1bce('0x3a')](_0x240517['model'],qs[_0x1bce('0x3c')](_0x37acac['query'][_0x1bce('0x3c')]));_0x523d67[_0x1bce('0x3b')]=_0x523d67[_0x1bce('0x3b')][_0x1bce('0x4a')]?_0x523d67[_0x1bce('0x3b')]:_0x240517['model'];if(!_0x37acac['query'][_0x1bce('0x3d')](_0x1bce('0x3e'))){_0x523d67['limit']=qs['limit'](_0x37acac[_0x1bce('0x37')]['limit']);_0x523d67['offset']=qs[_0x1bce('0x22')](_0x37acac['query']['offset']);}_0x523d67[_0x1bce('0x57')]=qs[_0x1bce('0x40')](_0x37acac[_0x1bce('0x37')]['sort']);_0x523d67['where']=qs[_0x1bce('0x39')](_['pick'](_0x37acac['query'],_0x240517[_0x1bce('0x39')]));_0x523d67[_0x1bce('0x44')][_0x1bce('0x58')]=_0x47cf8a['id'];if(_0x37acac[_0x1bce('0x37')]['filter']){_0x523d67['where']=_[_0x1bce('0x43')](_0x523d67[_0x1bce('0x44')],{'$or':_[_0x1bce('0x36')](_0x523d67['attributes'],function(_0x287d9f){var _0x1a429e={};_0x1a429e[_0x287d9f]={'$like':'%'+_0x37acac[_0x1bce('0x37')]['filter']+'%'};return _0x1a429e;})});}_0x523d67=_['merge']({},_0x523d67,_0x37acac[_0x1bce('0x4b')]);return db['Disposition'][_0x1bce('0x23')]({'where':_0x523d67[_0x1bce('0x44')]})['then'](function(_0x54aa8a){_0x3df71b[_0x1bce('0x23')]=_0x54aa8a;if(_0x37acac[_0x1bce('0x37')][_0x1bce('0x45')]){_0x523d67[_0x1bce('0x46')]=[{'all':!![]}];}return db[_0x1bce('0x55')][_0x1bce('0x47')](_0x523d67);})[_0x1bce('0x28')](function(_0x5ba62f){_0x3df71b[_0x1bce('0x59')]=_0x5ba62f;return _0x3df71b;});}})[_0x1bce('0x28')](respondWithFilteredResult(_0x2d8a05,_0x523d67))['catch'](handleError(_0x2d8a05,null));};exports[_0x1bce('0x5a')]=function(_0x12774e,_0x3fd577,_0x313967){return db[_0x1bce('0x30')]['find']({'where':{'id':_0x12774e['params']['id']}})['then'](handleEntityNotFound(_0x3fd577,null))[_0x1bce('0x28')](function(_0x16ec87){if(_0x16ec87){return _0x16ec87[_0x1bce('0x5a')](_0x12774e[_0x1bce('0x37')][_0x1bce('0x5b')]);}})[_0x1bce('0x28')](respondWithStatusCode(_0x3fd577,null))[_0x1bce('0x48')](handleError(_0x3fd577,null));};exports[_0x1bce('0x5c')]=function(_0x5c23d3,_0x166e50,_0x2477ea){return db['CmList'][_0x1bce('0x4c')]({'where':{'id':_0x5c23d3[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x166e50,null))[_0x1bce('0x28')](function(_0x22f828){if(_0x22f828){var _0x10929e=[];var _0x4263e9={'success':[],'errors':[]};return db[_0x1bce('0x5d')][_0x1bce('0x53')]()[_0x1bce('0x28')](function(_0x182945){if(_0x5c23d3[_0x1bce('0x4e')]['tags']&&_[_0x1bce('0x5e')](_0x5c23d3[_0x1bce('0x4e')]['tags'])){if(_0x5c23d3[_0x1bce('0x4e')][_0x1bce('0x5f')]['length']){_0x5c23d3[_0x1bce('0x4e')][_0x1bce('0x5f')]=_0x5c23d3[_0x1bce('0x4e')][_0x1bce('0x5f')]['join'](';')+';';}else{_0x5c23d3[_0x1bce('0x4e')][_0x1bce('0x5f')]=null;}}else{_0x5c23d3[_0x1bce('0x4e')][_0x1bce('0x5f')]=null;}if(_0x5c23d3[_0x1bce('0x4e')]&&_[_0x1bce('0x5e')](_0x5c23d3['body'])){for(var _0x247867=0x0;_0x247867<_0x5c23d3['body'][_0x1bce('0x4a')];_0x247867+=0x1){_0x5c23d3[_0x1bce('0x4e')][_0x247867][_0x1bce('0x58')]=_0x5c23d3[_0x1bce('0x49')]['id'];_0x10929e[_0x1bce('0x60')](_0x5c23d3['body'][_0x247867]);}return BPromise[_0x1bce('0x61')](_0x10929e,function(_0x17b80b){return db[_0x1bce('0x5d')][_0x1bce('0x4d')](_[_0x1bce('0x62')](_0x17b80b,[_0x1bce('0x5b'),'id'])||{},{'fields':_['keys'](_0x182945),'raw':!![]})['then'](function(_0x3e41ac){_0x4263e9[_0x1bce('0x63')][_0x1bce('0x60')](_0x3e41ac[_0x1bce('0x64')]);})[_0x1bce('0x48')](function(_0x1c60f4){_0x4263e9[_0x1bce('0x65')][_0x1bce('0x60')]({'data':_0x17b80b,'error':_0x1c60f4[_0x1bce('0x66')]});});})[_0x1bce('0x28')](function(_0x1cfefa){return _0x4263e9;})[_0x1bce('0x48')](function(_0x271491){return _0x271491;});}else{_0x166e50[_0x1bce('0x20')](0x190)[_0x1bce('0x21')]({'message':_0x1bce('0x67')});}});}})[_0x1bce('0x28')](respondWithResult(_0x166e50,null))[_0x1bce('0x48')](handleError(_0x166e50,null));};exports[_0x1bce('0x68')]=function(_0x5f1f7e,_0x1f299c,_0x48b37a){var _0x13775d;return db['CmList'][_0x1bce('0x4c')]({'where':{'id':_0x5f1f7e[_0x1bce('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x1bce('0x69')}]})[_0x1bce('0x28')](handleEntityNotFound(_0x1f299c,null))[_0x1bce('0x28')](function(_0x95b4f7){if(_0x95b4f7){_0x13775d=_0x95b4f7;return db['CmContact']['rawAttributes'];}})['then'](function(_0x1734e0){if(_0x1734e0){var _0x5a7e53={};var _0x5cc208={};_0x5cc208[_0x1bce('0x35')]=_['concat'](_[_0x1bce('0x38')](_0x1734e0),_[_0x1bce('0x36')](_0x13775d[_0x1bce('0x69')],function(_0x2c6c2c){return util['format']('cf_%d',_0x2c6c2c['id']);}));_0x5cc208[_0x1bce('0x37')]=_[_0x1bce('0x38')](_0x5f1f7e[_0x1bce('0x37')]);_0x5cc208[_0x1bce('0x39')]=_[_0x1bce('0x3a')](_0x5cc208[_0x1bce('0x35')],_0x5cc208[_0x1bce('0x37')]);_0x5a7e53['attributes']=_[_0x1bce('0x3a')](_0x5cc208['model'],qs['fields'](_0x5f1f7e['query'][_0x1bce('0x3c')]));_0x5a7e53[_0x1bce('0x3b')]=_0x5a7e53[_0x1bce('0x3b')][_0x1bce('0x4a')]?_0x5a7e53[_0x1bce('0x3b')]:_0x5cc208[_0x1bce('0x35')];if(!_0x5f1f7e['query'][_0x1bce('0x3d')](_0x1bce('0x3e'))){_0x5a7e53['limit']=qs[_0x1bce('0x3f')](_0x5f1f7e[_0x1bce('0x37')][_0x1bce('0x3f')]);_0x5a7e53[_0x1bce('0x22')]=qs[_0x1bce('0x22')](_0x5f1f7e[_0x1bce('0x37')]['offset']);}_0x5a7e53['order']=qs[_0x1bce('0x40')](_0x5f1f7e[_0x1bce('0x37')]['sort']);_0x5a7e53[_0x1bce('0x44')]=qs['filters'](_[_0x1bce('0x41')](_0x5f1f7e[_0x1bce('0x37')],_0x5cc208[_0x1bce('0x39')]));_0x5a7e53[_0x1bce('0x6a')]=!![];if(_0x5f1f7e[_0x1bce('0x37')][_0x1bce('0x42')]){_0x5a7e53[_0x1bce('0x44')]=_[_0x1bce('0x43')](_0x5a7e53['where'],{'$or':_[_0x1bce('0x36')](_0x5a7e53[_0x1bce('0x3b')],function(_0x1ee099){var _0x1184ae={};_0x1184ae[_0x1ee099]={'$like':'%'+_0x5f1f7e[_0x1bce('0x37')]['filter']+'%'};return _0x1184ae;})});}_0x5a7e53=_[_0x1bce('0x43')]({},_0x5a7e53,_0x5f1f7e[_0x1bce('0x4b')]);return _0x13775d[_0x1bce('0x68')](_0x5a7e53);}})[_0x1bce('0x28')](respondWithResult(_0x1f299c,null))[_0x1bce('0x48')](handleError(_0x1f299c,null));};exports[_0x1bce('0x6b')]=function(_0x357137,_0x222e6c,_0x5051b5){var _0x2481d4;var _0x4c72c0;var _0x2f6a17;var _0x1fee2b=_0x357137[_0x1bce('0x49')]['id'];csv_results=[];return db[_0x1bce('0x6c')][_0x1bce('0x47')]({'attributes':['id',_0x1bce('0x2e')],'raw':!![],'order':[_0x1bce('0x6d')]})[_0x1bce('0x28')](function(_0x3d5a18){_0x2481d4=_0x3d5a18;var _0x14c5ac=_[_0x1bce('0x38')](db[_0x1bce('0x5d')][_0x1bce('0x31')]);return db[_0x1bce('0x6e')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0x1bce('0x28')](function(_0x256811){_0x4c72c0=_0x256811;var _0x364de9=squel[_0x1bce('0x6f')]()[_0x1bce('0x3c')](_0x14c5ac)[_0x1bce('0x70')](_0x1bce('0x71'),'c')[_0x1bce('0x44')](_0x1bce('0x72'),_0x1fee2b)['where'](_0x1bce('0x73'))[_0x1bce('0x74')]();for(var _0x3eade2=0x0;_0x3eade2<_0x4c72c0[_0x1bce('0x4a')];_0x3eade2++){_0x364de9[_0x1bce('0x75')](_0x1bce('0x76')+_0x4c72c0[_0x3eade2]['id'],_0x1bce('0x77')+_0x4c72c0[_0x3eade2][_0x1bce('0x78')]);}for(var _0x3eade2=0x0;_0x3eade2<_0x2481d4[_0x1bce('0x4a')];_0x3eade2++){_0x364de9['field'](squel[_0x1bce('0x6f')]()[_0x1bce('0x75')](_0x1bce('0x79'))['from'](_0x1bce('0x7a'))[_0x1bce('0x44')]('ItemTypeId\x20=\x20?',_0x2481d4[_0x3eade2]['id'])[_0x1bce('0x44')](_0x1bce('0x7b')),_0x1bce('0x7c')+_0x2481d4[_0x3eade2]['name']);_0x364de9['field'](squel[_0x1bce('0x6f')]()['field'](_0x1bce('0x7d'))[_0x1bce('0x70')](_0x1bce('0x7a'))[_0x1bce('0x44')]('ItemTypeId\x20=\x20?',_0x2481d4[_0x3eade2]['id'])[_0x1bce('0x44')](_0x1bce('0x7b')),_0x1bce('0x7e')+_0x2481d4[_0x3eade2][_0x1bce('0x2e')]);}var _0x2a0f33=[];_0x2a0f33[_0x1bce('0x60')](_0x364de9[_0x1bce('0x7f')]());BPromise['each'](_0x2a0f33,handleQuery)[_0x1bce('0x28')](function(_0x5561ba){handleQuery(_0x364de9['toString']());var _0x101f44=csv_results[0x0];if(!_[_0x1bce('0x80')](_0x101f44)){var _0x57c2dd=toCsv(_0x101f44);var _0x446819=Date[_0x1bce('0x81')]();fs[_0x1bce('0x82')](util[_0x1bce('0x83')](_0x1bce('0x84'),_0x1fee2b,_0x446819),_0x57c2dd);_0x222e6c[_0x1bce('0x85')](_0x1bce('0x86'),_0x1bce('0x87')+util[_0x1bce('0x83')](_0x1bce('0x88'),_0x1fee2b,_0x446819));_0x222e6c[_0x1bce('0x85')](_0x1bce('0x89'),_0x1bce('0x8a'));return _0x222e6c[_0x1bce('0x8b')](util[_0x1bce('0x83')](_0x1bce('0x84'),_0x1fee2b,_0x446819));}else{return _0x222e6c['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x2e088c,_0x4b30bd,_0x7fd959){var _0x4f5bea;delete _0x2e088c[_0x1bce('0x4e')]['id'];return db[_0x1bce('0x30')][_0x1bce('0x56')]({'where':{'id':_0x2e088c['params']['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x4b30bd,null))[_0x1bce('0x28')](function(_0x56c86b){if(_0x56c86b){return db['sequelize']['transaction'](function(_0x4f2f23){return db['CmCustomField'][_0x1bce('0x4d')](_0x2e088c[_0x1bce('0x4e')],{'transaction':_0x4f2f23})[_0x1bce('0x28')](function(_0x4f371c){_0x4f5bea=_0x4f371c;return _0x56c86b['addCustomFields'](_0x4f371c,{'transaction':_0x4f2f23});})[_0x1bce('0x28')](function(){var _0x27b43a={'type':db[_0x1bce('0x8c')]['TEXT'],'transaction':_0x4f2f23};switch(_0x2e088c['body'][_0x1bce('0x33')]){case'text':_0x27b43a[_0x1bce('0x33')]=db[_0x1bce('0x8c')][_0x1bce('0x8d')];break;case _0x1bce('0x8e'):_0x27b43a[_0x1bce('0x33')]=db['Sequelize'][_0x1bce('0x8f')];break;case'switch':_0x27b43a[_0x1bce('0x33')]=db['Sequelize']['BOOLEAN'];_0x27b43a[_0x1bce('0x90')]=![];break;default:}return db[_0x1bce('0x91')][_0x1bce('0x92')][_0x1bce('0x93')](_0x1bce('0x71'),util['format']('cf_%s',_0x4f5bea['id']),_0x27b43a);})[_0x1bce('0x28')](function(){return _0x4f5bea;});});}})[_0x1bce('0x28')](respondWithResult(_0x4b30bd,null))['catch'](handleError(_0x4b30bd,null));};exports[_0x1bce('0x94')]=function(_0x158695,_0x204293,_0x942dcc){var _0x3f97c6={};var _0x565fdd={};var _0x7ba7c4;var _0x4744ec;return db[_0x1bce('0x30')][_0x1bce('0x56')]({'where':{'id':_0x158695[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x204293,null))[_0x1bce('0x28')](function(_0x1e82e4){if(_0x1e82e4){_0x7ba7c4=_0x1e82e4;_0x565fdd[_0x1bce('0x35')]=_['keys'](db[_0x1bce('0x6e')]['rawAttributes']);_0x565fdd[_0x1bce('0x37')]=_[_0x1bce('0x38')](_0x158695[_0x1bce('0x37')]);_0x565fdd[_0x1bce('0x39')]=_['intersection'](_0x565fdd[_0x1bce('0x35')],_0x565fdd['query']);_0x3f97c6[_0x1bce('0x3b')]=_[_0x1bce('0x3a')](_0x565fdd[_0x1bce('0x35')],qs[_0x1bce('0x3c')](_0x158695[_0x1bce('0x37')][_0x1bce('0x3c')]));_0x3f97c6[_0x1bce('0x3b')]=_0x3f97c6[_0x1bce('0x3b')][_0x1bce('0x4a')]?_0x3f97c6[_0x1bce('0x3b')]:_0x565fdd[_0x1bce('0x35')];_0x3f97c6[_0x1bce('0x57')]=qs['sort'](_0x158695['query'][_0x1bce('0x40')]);_0x3f97c6[_0x1bce('0x44')]=qs[_0x1bce('0x39')](_[_0x1bce('0x41')](_0x158695[_0x1bce('0x37')],_0x565fdd[_0x1bce('0x39')]));_0x3f97c6[_0x1bce('0x44')]=_[_0x1bce('0x43')](_0x3f97c6[_0x1bce('0x44')],{'$or':[{'ListId':_0x1e82e4['id']},{'ListId':null}]});if(_0x158695[_0x1bce('0x37')][_0x1bce('0x42')]){_0x3f97c6['where']=_['merge'](_0x3f97c6[_0x1bce('0x44')],{'$or':_[_0x1bce('0x36')](_0x3f97c6[_0x1bce('0x3b')],function(_0x192147){var _0xc52810={};_0xc52810[_0x192147]={'$like':'%'+_0x158695[_0x1bce('0x37')][_0x1bce('0x42')]+'%'};return _0xc52810;})});}_0x3f97c6=_[_0x1bce('0x43')]({},_0x3f97c6,_0x158695[_0x1bce('0x4b')]);return db['CmCustomField'][_0x1bce('0x95')](_0x3f97c6);}})[_0x1bce('0x28')](respondWithResult(_0x204293,null))[_0x1bce('0x48')](handleError(_0x204293,null));};exports[_0x1bce('0x96')]=function(_0xcab6cb,_0x4ff7df){return db[_0x1bce('0x6e')]['findAndCountAll']({'where':{'ListId':null}})[_0x1bce('0x28')](handleEntityNotFound(_0x4ff7df,null))['then'](function(_0x120e7c){return _0x120e7c;})[_0x1bce('0x28')](respondWithResult(_0x4ff7df,null))[_0x1bce('0x48')](handleError(_0x4ff7df,null));};exports['addAgents']=function(_0x439c6f,_0x5e3b79,_0xc05583){return db[_0x1bce('0x30')][_0x1bce('0x4c')]({'where':{'id':_0x439c6f[_0x1bce('0x49')]['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x5e3b79,null))[_0x1bce('0x28')](function(_0x51c9ad){if(_0x51c9ad){return _0x51c9ad[_0x1bce('0x97')](_0x439c6f['body'][_0x1bce('0x5b')],_[_0x1bce('0x62')](_0x439c6f['body'],[_0x1bce('0x5b'),'id'])||{})[_0x1bce('0x98')](function(_0x3f6248){for(var _0x2ddd09=0x0;_0x2ddd09<_0x439c6f[_0x1bce('0x4e')]['ids'][_0x1bce('0x4a')];_0x2ddd09+=0x1){socket[_0x1bce('0x99')](_0x1bce('0x9a'),{'UserId':Number(_0x439c6f[_0x1bce('0x4e')][_0x1bce('0x5b')][_0x2ddd09]),'CmListId':Number(_0x439c6f[_0x1bce('0x49')]['id'])});}return _0x3f6248;});}})['then'](respondWithResult(_0x5e3b79,null))[_0x1bce('0x48')](handleError(_0x5e3b79,null));};exports['removeAgents']=function(_0x5c9f44,_0x2fbc29,_0xecb163){return db[_0x1bce('0x30')][_0x1bce('0x4c')]({'where':{'id':_0x5c9f44['params']['id']}})['then'](handleEntityNotFound(_0x2fbc29,null))[_0x1bce('0x28')](function(_0x263f87){if(_0x263f87){return _0x263f87[_0x1bce('0x9b')](_0x5c9f44[_0x1bce('0x37')][_0x1bce('0x5b')])[_0x1bce('0x28')](function(){if(_['isArray'](_0x5c9f44[_0x1bce('0x37')][_0x1bce('0x5b')])){for(var _0x48f7ee=0x0;_0x48f7ee<_0x5c9f44[_0x1bce('0x37')][_0x1bce('0x5b')][_0x1bce('0x4a')];_0x48f7ee+=0x1){socket[_0x1bce('0x99')]('userCmList:remove',{'UserId':Number(_0x5c9f44[_0x1bce('0x37')][_0x1bce('0x5b')][_0x48f7ee]),'CmListId':Number(_0x5c9f44[_0x1bce('0x49')]['id'])});}}else{socket[_0x1bce('0x99')](_0x1bce('0x9c'),{'UserId':Number(_0x5c9f44[_0x1bce('0x37')]['ids']),'CmListId':Number(_0x5c9f44[_0x1bce('0x49')]['id'])});}});}})[_0x1bce('0x28')](respondWithStatusCode(_0x2fbc29,null))[_0x1bce('0x48')](handleError(_0x2fbc29,null));};exports[_0x1bce('0x9d')]=function(_0x40df25,_0x558fe0,_0x50164c){var _0x596c32={};var _0x390c05={};var _0xb0c51d;var _0x4c6bb9;return db[_0x1bce('0x30')][_0x1bce('0x56')]({'where':{'id':_0x40df25['params']['id']}})[_0x1bce('0x28')](handleEntityNotFound(_0x558fe0,null))[_0x1bce('0x28')](function(_0x215b7c){if(_0x215b7c){_0xb0c51d=_0x215b7c;_0x390c05['model']=_[_0x1bce('0x38')](db[_0x1bce('0x9e')][_0x1bce('0x31')]);_0x390c05['query']=_[_0x1bce('0x38')](_0x40df25[_0x1bce('0x37')]);_0x390c05[_0x1bce('0x39')]=_[_0x1bce('0x3a')](_0x390c05[_0x1bce('0x35')],_0x390c05[_0x1bce('0x37')]);_0x596c32['attributes']=_[_0x1bce('0x3a')](_0x390c05['model'],qs[_0x1bce('0x3c')](_0x40df25[_0x1bce('0x37')][_0x1bce('0x3c')]));_0x596c32[_0x1bce('0x3b')]=_0x596c32[_0x1bce('0x3b')][_0x1bce('0x4a')]?_0x596c32['attributes']:_0x390c05[_0x1bce('0x35')];_0x596c32['order']=qs['sort'](_0x40df25[_0x1bce('0x37')][_0x1bce('0x40')]);_0x596c32['where']=qs[_0x1bce('0x39')](_[_0x1bce('0x41')](_0x40df25[_0x1bce('0x37')],_0x390c05[_0x1bce('0x39')]));if(_0x40df25[_0x1bce('0x37')][_0x1bce('0x42')]){_0x596c32[_0x1bce('0x44')]=_[_0x1bce('0x43')](_0x596c32[_0x1bce('0x44')],{'$or':_[_0x1bce('0x36')](_0x596c32[_0x1bce('0x3b')],function(_0x14e327){var _0x5ebb11={};_0x5ebb11[_0x14e327]={'$like':'%'+_0x40df25[_0x1bce('0x37')][_0x1bce('0x42')]+'%'};return _0x5ebb11;})});}_0x596c32=_[_0x1bce('0x43')]({},_0x596c32,_0x40df25[_0x1bce('0x4b')]);return _0xb0c51d[_0x1bce('0x9d')](_0x596c32);}})[_0x1bce('0x28')](function(_0x1ed86b){if(_0x1ed86b){_0x4c6bb9=_0x1ed86b[_0x1bce('0x4a')];if(!_0x40df25[_0x1bce('0x37')][_0x1bce('0x3d')](_0x1bce('0x3e'))){_0x596c32[_0x1bce('0x3f')]=qs[_0x1bce('0x3f')](_0x40df25['query']['limit']);_0x596c32['offset']=qs[_0x1bce('0x22')](_0x40df25['query'][_0x1bce('0x22')]);}return _0xb0c51d[_0x1bce('0x9d')](_0x596c32);}})['then'](function(_0x19287f){if(_0x19287f){return _0x19287f?{'count':_0x4c6bb9,'rows':_0x19287f}:null;}})[_0x1bce('0x28')](respondWithResult(_0x558fe0,null))[_0x1bce('0x48')](handleError(_0x558fe0,null));};function handleQuery(_0x19d79d){logger[_0x1bce('0x9f')](_0x19d79d);return db[_0x1bce('0x91')][_0x1bce('0x37')](_0x19d79d)[_0x1bce('0x98')](function(_0x134edf){csv_results['push'](_0x134edf);})[_0x1bce('0x48')](function(_0x4828a9){logger['error'](_0x4828a9[_0x1bce('0x66')]);});} \ No newline at end of file +var _0x22bd=['getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','update','UserProfileResource','destroy','then','error','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','findAll','rows','removeDispositions','ids','CmContact','tags','isArray','push','each','success','errors','message','getContacts','CmCustomField','CustomFields','format','nolimit','order','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','customField_','item','ItemTypeId\x20=\x20?','additionalPhone_','description','cm_contact_has_items','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize'];(function(_0x1f0ad7,_0xbdbf69){var _0xc907ef=function(_0x8bc3ef){while(--_0x8bc3ef){_0x1f0ad7['push'](_0x1f0ad7['shift']());}};_0xc907ef(++_0xbdbf69);}(_0x22bd,0x140));var _0xd22b=function(_0x1750de,_0x3bc7ad){_0x1750de=_0x1750de-0x0;var _0x490134=_0x22bd[_0x1750de];return _0x490134;};'use strict';var emlformat=require(_0xd22b('0x0'));var rimraf=require(_0xd22b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd22b('0x2'));var rp=require(_0xd22b('0x3'));var moment=require(_0xd22b('0x4'));var BPromise=require(_0xd22b('0x5'));var Mustache=require('mustache');var util=require(_0xd22b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd22b('0x7'));var fs=require('fs');var fs_extra=require(_0xd22b('0x8'));var _=require('lodash');var squel=require(_0xd22b('0x9'));var crypto=require(_0xd22b('0xa'));var jsforce=require(_0xd22b('0xb'));var deskjs=require(_0xd22b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd22b('0xd'));var Papa=require(_0xd22b('0xe'));var Redis=require('ioredis');var authService=require(_0xd22b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd22b('0x10'));var utils=require(_0xd22b('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd22b('0x12'));var db=require(_0xd22b('0x13'))['db'];var csv_results;config['redis']=_[_0xd22b('0x14')](config[_0xd22b('0x15')],{'host':_0xd22b('0x16'),'port':0x18eb});var socket=require(_0xd22b('0x17'))(new Redis(config['redis']));require(_0xd22b('0x18'))['register'](socket);function respondWithStatusCode(_0x521336,_0x4aa5f8){_0x4aa5f8=_0x4aa5f8||0xcc;return function(_0x39c463){if(_0x39c463){return _0x521336[_0xd22b('0x19')](_0x4aa5f8);}return _0x521336['status'](_0x4aa5f8)[_0xd22b('0x1a')]();};}function respondWithResult(_0x3b23cb,_0x42afef){_0x42afef=_0x42afef||0xc8;return function(_0xbee94d){if(_0xbee94d){return _0x3b23cb[_0xd22b('0x1b')](_0x42afef)[_0xd22b('0x1c')](_0xbee94d);}};}function respondWithFilteredResult(_0x1ab3fa,_0x28fd71){return function(_0x3fe95f){if(_0x3fe95f){var _0x196af0=typeof _0x28fd71[_0xd22b('0x1d')]===_0xd22b('0x1e')&&typeof _0x28fd71['limit']===_0xd22b('0x1e');var _0x24eb4d=_0x3fe95f[_0xd22b('0x1f')];var _0x202461=_0x196af0?0x0:_0x28fd71[_0xd22b('0x1d')];var _0x6666a0=_0x196af0?_0x3fe95f[_0xd22b('0x1f')]:_0x28fd71[_0xd22b('0x1d')]+_0x28fd71[_0xd22b('0x20')];var _0x3596df;if(_0x6666a0>=_0x24eb4d){_0x6666a0=_0x24eb4d;_0x3596df=0xc8;}else{_0x3596df=0xce;}_0x1ab3fa[_0xd22b('0x1b')](_0x3596df);return _0x1ab3fa[_0xd22b('0x21')]('Content-Range',_0x202461+'-'+_0x6666a0+'/'+_0x24eb4d)[_0xd22b('0x1c')](_0x3fe95f);}return null;};}function patchUpdates(_0x1a4823){return function(_0xa0b815){try{jsonpatch[_0xd22b('0x22')](_0xa0b815,_0x1a4823,!![]);}catch(_0x224e8b){return BPromise['reject'](_0x224e8b);}return _0xa0b815['save']();};}function saveUpdates(_0x1edb45,_0x7dbfe2){return function(_0x4cb6f3){if(_0x4cb6f3){return _0x4cb6f3[_0xd22b('0x23')](_0x1edb45)['then'](function(_0x2711de){return _0x2711de;});}return null;};}function removeEntity(_0x3f915d,_0x4c566e){return function(_0x332542){if(_0x332542){return _0x332542['destroy']()['then'](function(){var _0x592eec=_0x332542['get']({'plain':!![]});var _0x1f8e54='Lists';return db[_0xd22b('0x24')][_0xd22b('0x25')]({'where':{'type':_0x1f8e54,'resourceId':_0x592eec['id']}})[_0xd22b('0x26')](function(){return _0x332542;});})[_0xd22b('0x26')](function(){_0x3f915d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x169008,_0x4a91c4){return function(_0x3da21d){if(!_0x3da21d){_0x169008[_0xd22b('0x19')](0x194);}return _0x3da21d;};}function handleError(_0x2e94d4,_0x3f0001){_0x3f0001=_0x3f0001||0x1f4;return function(_0x329f5e){logger[_0xd22b('0x27')](_0x329f5e['stack']);if(_0x329f5e[_0xd22b('0x28')]){delete _0x329f5e['name'];}_0x2e94d4[_0xd22b('0x1b')](_0x3f0001)[_0xd22b('0x29')](_0x329f5e);};}exports[_0xd22b('0x2a')]=function(_0xc4c672,_0x69abef){var _0x205ee4={},_0x4dffa3={},_0x3adbdd={'count':0x0,'rows':[]};var _0x3b5d0a=_[_0xd22b('0x2b')](db[_0xd22b('0x2c')][_0xd22b('0x2d')],function(_0x7a6eac){return{'name':_0x7a6eac[_0xd22b('0x2e')],'type':_0x7a6eac[_0xd22b('0x2f')][_0xd22b('0x30')]};});_0x4dffa3[_0xd22b('0x31')]=_[_0xd22b('0x2b')](_0x3b5d0a,'name');_0x4dffa3[_0xd22b('0x32')]=_[_0xd22b('0x33')](_0xc4c672[_0xd22b('0x32')]);_0x4dffa3[_0xd22b('0x34')]=_[_0xd22b('0x35')](_0x4dffa3[_0xd22b('0x31')],_0x4dffa3['query']);_0x205ee4[_0xd22b('0x36')]=_[_0xd22b('0x35')](_0x4dffa3[_0xd22b('0x31')],qs[_0xd22b('0x37')](_0xc4c672[_0xd22b('0x32')][_0xd22b('0x37')]));_0x205ee4[_0xd22b('0x36')]=_0x205ee4['attributes'][_0xd22b('0x38')]?_0x205ee4[_0xd22b('0x36')]:_0x4dffa3[_0xd22b('0x31')];if(!_0xc4c672['query']['hasOwnProperty']('nolimit')){_0x205ee4['limit']=qs['limit'](_0xc4c672['query'][_0xd22b('0x20')]);_0x205ee4['offset']=qs[_0xd22b('0x1d')](_0xc4c672[_0xd22b('0x32')][_0xd22b('0x1d')]);}_0x205ee4['order']=qs[_0xd22b('0x39')](_0xc4c672['query'][_0xd22b('0x39')]);_0x205ee4[_0xd22b('0x3a')]=qs[_0xd22b('0x34')](_[_0xd22b('0x3b')](_0xc4c672[_0xd22b('0x32')],_0x4dffa3[_0xd22b('0x34')]),_0x3b5d0a);if(_0xc4c672['query'][_0xd22b('0x3c')]){_0x205ee4['where']=_[_0xd22b('0x3d')](_0x205ee4['where'],{'$or':_[_0xd22b('0x2b')](_0x3b5d0a,function(_0x31cd60){if(_0x31cd60[_0xd22b('0x2f')]!==_0xd22b('0x3e')){var _0x174dba={};_0x174dba[_0x31cd60[_0xd22b('0x28')]]={'$like':'%'+_0xc4c672[_0xd22b('0x32')][_0xd22b('0x3c')]+'%'};return _0x174dba;}})});}_0x205ee4=_['merge']({},_0x205ee4,_0xc4c672['options']);var _0x4f4c94={'where':_0x205ee4[_0xd22b('0x3a')]};return db[_0xd22b('0x2c')]['count'](_0x4f4c94)['then'](function(_0x25462e){_0x3adbdd[_0xd22b('0x1f')]=_0x25462e;if(_0xc4c672[_0xd22b('0x32')]['includeAll']){_0x205ee4[_0xd22b('0x3f')]=[{'all':!![]}];}return db[_0xd22b('0x2c')]['findAll'](_0x205ee4);})['then'](function(_0x1ff6b6){_0x3adbdd['rows']=_0x1ff6b6;return _0x3adbdd;})[_0xd22b('0x26')](respondWithFilteredResult(_0x69abef,_0x205ee4))[_0xd22b('0x40')](handleError(_0x69abef,null));};exports[_0xd22b('0x41')]=function(_0x2cf2f4,_0xd4dfa1){var _0x1bb335={'raw':![],'where':{'id':_0x2cf2f4[_0xd22b('0x42')]['id']}},_0x582928={};_0x582928['model']=_[_0xd22b('0x33')](db[_0xd22b('0x2c')][_0xd22b('0x2d')]);_0x582928[_0xd22b('0x32')]=_[_0xd22b('0x33')](_0x2cf2f4[_0xd22b('0x32')]);_0x582928['filters']=_[_0xd22b('0x35')](_0x582928['model'],_0x582928[_0xd22b('0x32')]);_0x1bb335[_0xd22b('0x36')]=_[_0xd22b('0x35')](_0x582928[_0xd22b('0x31')],qs[_0xd22b('0x37')](_0x2cf2f4[_0xd22b('0x32')][_0xd22b('0x37')]));_0x1bb335['attributes']=_0x1bb335[_0xd22b('0x36')][_0xd22b('0x38')]?_0x1bb335['attributes']:_0x582928[_0xd22b('0x31')];if(_0x2cf2f4[_0xd22b('0x32')][_0xd22b('0x43')]){_0x1bb335[_0xd22b('0x3f')]=[{'all':!![]}];}_0x1bb335=_['merge']({},_0x1bb335,_0x2cf2f4[_0xd22b('0x44')]);return db[_0xd22b('0x2c')][_0xd22b('0x45')](_0x1bb335)[_0xd22b('0x26')](handleEntityNotFound(_0xd4dfa1,null))[_0xd22b('0x26')](respondWithResult(_0xd4dfa1,null))[_0xd22b('0x40')](handleError(_0xd4dfa1,null));};exports['create']=function(_0x5d3cd5,_0x1d12b1){return db[_0xd22b('0x2c')][_0xd22b('0x46')](_0x5d3cd5[_0xd22b('0x47')],{})[_0xd22b('0x26')](function(_0x3a87c3){var _0x5802a5=_0x5d3cd5['user'][_0xd22b('0x48')]({'plain':!![]});if(!_0x5802a5)throw new Error(_0xd22b('0x49'));if(_0x5802a5[_0xd22b('0x4a')]===_0xd22b('0x4b')){var _0x1a59af=_0x3a87c3[_0xd22b('0x48')]({'plain':!![]});var _0x3335d2=_0xd22b('0x4c');return db[_0xd22b('0x4d')][_0xd22b('0x45')]({'where':{'name':_0x3335d2,'userProfileId':_0x5802a5[_0xd22b('0x4e')]},'raw':!![]})['then'](function(_0x4616ad){if(_0x4616ad&&_0x4616ad['autoAssociation']===0x0){return db[_0xd22b('0x24')]['create']({'name':_0x1a59af['name'],'resourceId':_0x1a59af['id'],'type':_0x4616ad[_0xd22b('0x28')],'sectionId':_0x4616ad['id']},{})['then'](function(){return _0x3a87c3;});}else{return _0x3a87c3;}})[_0xd22b('0x40')](function(_0x40fc1){logger[_0xd22b('0x27')](_0xd22b('0x4f'),_0x40fc1);throw _0x40fc1;});}return _0x3a87c3;})[_0xd22b('0x26')](respondWithResult(_0x1d12b1,0xc9))['catch'](handleError(_0x1d12b1,null));};exports['update']=function(_0x52564d,_0x4e7368){if(_0x52564d[_0xd22b('0x47')]['id']){delete _0x52564d[_0xd22b('0x47')]['id'];}return db[_0xd22b('0x2c')]['find']({'where':{'id':_0x52564d[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x4e7368,null))[_0xd22b('0x26')](saveUpdates(_0x52564d[_0xd22b('0x47')],null))[_0xd22b('0x26')](respondWithResult(_0x4e7368,null))[_0xd22b('0x40')](handleError(_0x4e7368,null));};exports[_0xd22b('0x25')]=function(_0x4300c6,_0x32a8c7){return db[_0xd22b('0x2c')][_0xd22b('0x45')]({'where':{'id':_0x4300c6[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x32a8c7,null))[_0xd22b('0x26')](removeEntity(_0x32a8c7,null))[_0xd22b('0x40')](handleError(_0x32a8c7,null));};exports[_0xd22b('0x50')]=function(_0x3f8bda,_0x27f89d){return db[_0xd22b('0x2c')][_0xd22b('0x50')]()[_0xd22b('0x26')](respondWithResult(_0x27f89d,null))[_0xd22b('0x40')](handleError(_0x27f89d,null));};exports[_0xd22b('0x51')]=function(_0x309937,_0x3cc37e,_0x55a357){if(_0x309937[_0xd22b('0x47')]['id']){delete _0x309937['body']['id'];}return db['CmList'][_0xd22b('0x45')]({'where':{'id':_0x309937[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x3cc37e,null))[_0xd22b('0x26')](function(_0x12a57b){if(_0x12a57b){_0x309937[_0xd22b('0x47')][_0xd22b('0x52')]=_0x12a57b['id'];return db[_0xd22b('0x53')][_0xd22b('0x46')](_0x309937[_0xd22b('0x47')]);}})[_0xd22b('0x26')](respondWithResult(_0x3cc37e,null))['catch'](handleError(_0x3cc37e,null));};exports['getDispositions']=function(_0x484542,_0x337d80,_0x5cc820){var _0x23e41d={'raw':![],'where':{}};var _0x29cb67={};var _0x57ddb4={'count':0x0,'rows':[]};return db[_0xd22b('0x2c')][_0xd22b('0x54')]({'where':{'id':_0x484542['params']['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x337d80,null))[_0xd22b('0x26')](function(_0x5bf262){if(_0x5bf262){_0x29cb67[_0xd22b('0x31')]=_[_0xd22b('0x33')](db[_0xd22b('0x53')][_0xd22b('0x2d')]);_0x29cb67['query']=_['keys'](_0x484542[_0xd22b('0x32')]);_0x29cb67[_0xd22b('0x34')]=_[_0xd22b('0x35')](_0x29cb67[_0xd22b('0x31')],_0x29cb67[_0xd22b('0x32')]);_0x23e41d[_0xd22b('0x36')]=_[_0xd22b('0x35')](_0x29cb67[_0xd22b('0x31')],qs[_0xd22b('0x37')](_0x484542['query'][_0xd22b('0x37')]));_0x23e41d[_0xd22b('0x36')]=_0x23e41d[_0xd22b('0x36')][_0xd22b('0x38')]?_0x23e41d[_0xd22b('0x36')]:_0x29cb67[_0xd22b('0x31')];if(!_0x484542['query'][_0xd22b('0x55')]('nolimit')){_0x23e41d[_0xd22b('0x20')]=qs[_0xd22b('0x20')](_0x484542[_0xd22b('0x32')]['limit']);_0x23e41d['offset']=qs[_0xd22b('0x1d')](_0x484542[_0xd22b('0x32')][_0xd22b('0x1d')]);}_0x23e41d['order']=qs[_0xd22b('0x39')](_0x484542[_0xd22b('0x32')][_0xd22b('0x39')]);_0x23e41d[_0xd22b('0x3a')]=qs[_0xd22b('0x34')](_[_0xd22b('0x3b')](_0x484542[_0xd22b('0x32')],_0x29cb67[_0xd22b('0x34')]));_0x23e41d[_0xd22b('0x3a')][_0xd22b('0x52')]=_0x5bf262['id'];if(_0x484542[_0xd22b('0x32')][_0xd22b('0x3c')]){_0x23e41d[_0xd22b('0x3a')]=_[_0xd22b('0x3d')](_0x23e41d['where'],{'$or':_[_0xd22b('0x2b')](_0x23e41d[_0xd22b('0x36')],function(_0x5cc479){var _0x132a4d={};_0x132a4d[_0x5cc479]={'$like':'%'+_0x484542[_0xd22b('0x32')][_0xd22b('0x3c')]+'%'};return _0x132a4d;})});}_0x23e41d=_['merge']({},_0x23e41d,_0x484542['options']);return db[_0xd22b('0x53')][_0xd22b('0x1f')]({'where':_0x23e41d[_0xd22b('0x3a')]})[_0xd22b('0x26')](function(_0x1ac665){_0x57ddb4[_0xd22b('0x1f')]=_0x1ac665;if(_0x484542[_0xd22b('0x32')][_0xd22b('0x43')]){_0x23e41d[_0xd22b('0x3f')]=[{'all':!![]}];}return db[_0xd22b('0x53')][_0xd22b('0x56')](_0x23e41d);})[_0xd22b('0x26')](function(_0x4f2630){_0x57ddb4[_0xd22b('0x57')]=_0x4f2630;return _0x57ddb4;});}})[_0xd22b('0x26')](respondWithFilteredResult(_0x337d80,_0x23e41d))[_0xd22b('0x40')](handleError(_0x337d80,null));};exports[_0xd22b('0x58')]=function(_0x555c35,_0x198042,_0x5d407d){return db[_0xd22b('0x2c')][_0xd22b('0x45')]({'where':{'id':_0x555c35['params']['id']}})['then'](handleEntityNotFound(_0x198042,null))[_0xd22b('0x26')](function(_0x456fa4){if(_0x456fa4){return _0x456fa4['removeDispositions'](_0x555c35['query'][_0xd22b('0x59')]);}})[_0xd22b('0x26')](respondWithStatusCode(_0x198042,null))[_0xd22b('0x40')](handleError(_0x198042,null));};exports['addContacts']=function(_0x2e3e57,_0x113936,_0x553902){return db['CmList'][_0xd22b('0x45')]({'where':{'id':_0x2e3e57[_0xd22b('0x42')]['id']}})['then'](handleEntityNotFound(_0x113936,null))[_0xd22b('0x26')](function(_0x4ede92){if(_0x4ede92){var _0x3486d6=[];var _0xd7c311={'success':[],'errors':[]};return db[_0xd22b('0x5a')][_0xd22b('0x50')]()[_0xd22b('0x26')](function(_0x18cf04){if(_0x2e3e57[_0xd22b('0x47')][_0xd22b('0x5b')]&&_[_0xd22b('0x5c')](_0x2e3e57[_0xd22b('0x47')]['tags'])){if(_0x2e3e57['body']['tags'][_0xd22b('0x38')]){_0x2e3e57[_0xd22b('0x47')][_0xd22b('0x5b')]=_0x2e3e57[_0xd22b('0x47')]['tags']['join'](';')+';';}else{_0x2e3e57[_0xd22b('0x47')]['tags']=null;}}else{_0x2e3e57[_0xd22b('0x47')][_0xd22b('0x5b')]=null;}if(_0x2e3e57[_0xd22b('0x47')]&&_[_0xd22b('0x5c')](_0x2e3e57[_0xd22b('0x47')])){for(var _0x10340d=0x0;_0x10340d<_0x2e3e57['body'][_0xd22b('0x38')];_0x10340d+=0x1){_0x2e3e57[_0xd22b('0x47')][_0x10340d][_0xd22b('0x52')]=_0x2e3e57[_0xd22b('0x42')]['id'];_0x3486d6[_0xd22b('0x5d')](_0x2e3e57[_0xd22b('0x47')][_0x10340d]);}return BPromise[_0xd22b('0x5e')](_0x3486d6,function(_0x681dcd){return db[_0xd22b('0x5a')][_0xd22b('0x46')](_['omit'](_0x681dcd,[_0xd22b('0x59'),'id'])||{},{'fields':_[_0xd22b('0x33')](_0x18cf04),'raw':!![]})[_0xd22b('0x26')](function(_0x16aebd){_0xd7c311[_0xd22b('0x5f')][_0xd22b('0x5d')](_0x16aebd['dataValues']);})[_0xd22b('0x40')](function(_0x57d590){_0xd7c311[_0xd22b('0x60')][_0xd22b('0x5d')]({'data':_0x681dcd,'error':_0x57d590[_0xd22b('0x61')]});});})[_0xd22b('0x26')](function(_0xe02edf){return _0xd7c311;})['catch'](function(_0x1b0550){return _0x1b0550;});}else{_0x113936['status'](0x190)[_0xd22b('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd22b('0x26')](respondWithResult(_0x113936,null))[_0xd22b('0x40')](handleError(_0x113936,null));};exports[_0xd22b('0x62')]=function(_0x4bd8d6,_0x5a0439,_0x302271){var _0xe75d22;return db[_0xd22b('0x2c')][_0xd22b('0x45')]({'where':{'id':_0x4bd8d6[_0xd22b('0x42')]['id']},'include':[{'model':db[_0xd22b('0x63')],'as':_0xd22b('0x64')}]})[_0xd22b('0x26')](handleEntityNotFound(_0x5a0439,null))[_0xd22b('0x26')](function(_0x3e41bc){if(_0x3e41bc){_0xe75d22=_0x3e41bc;return db['CmContact']['rawAttributes'];}})[_0xd22b('0x26')](function(_0x4c237a){if(_0x4c237a){var _0x5c55d5={};var _0x2b0b7a={};_0x2b0b7a[_0xd22b('0x31')]=_['concat'](_[_0xd22b('0x33')](_0x4c237a),_[_0xd22b('0x2b')](_0xe75d22[_0xd22b('0x64')],function(_0x34321a){return util[_0xd22b('0x65')]('cf_%d',_0x34321a['id']);}));_0x2b0b7a[_0xd22b('0x32')]=_[_0xd22b('0x33')](_0x4bd8d6[_0xd22b('0x32')]);_0x2b0b7a['filters']=_[_0xd22b('0x35')](_0x2b0b7a[_0xd22b('0x31')],_0x2b0b7a[_0xd22b('0x32')]);_0x5c55d5[_0xd22b('0x36')]=_['intersection'](_0x2b0b7a['model'],qs[_0xd22b('0x37')](_0x4bd8d6[_0xd22b('0x32')]['fields']));_0x5c55d5[_0xd22b('0x36')]=_0x5c55d5[_0xd22b('0x36')][_0xd22b('0x38')]?_0x5c55d5[_0xd22b('0x36')]:_0x2b0b7a[_0xd22b('0x31')];if(!_0x4bd8d6[_0xd22b('0x32')][_0xd22b('0x55')](_0xd22b('0x66'))){_0x5c55d5[_0xd22b('0x20')]=qs[_0xd22b('0x20')](_0x4bd8d6[_0xd22b('0x32')][_0xd22b('0x20')]);_0x5c55d5['offset']=qs[_0xd22b('0x1d')](_0x4bd8d6[_0xd22b('0x32')][_0xd22b('0x1d')]);}_0x5c55d5[_0xd22b('0x67')]=qs[_0xd22b('0x39')](_0x4bd8d6[_0xd22b('0x32')][_0xd22b('0x39')]);_0x5c55d5[_0xd22b('0x3a')]=qs['filters'](_[_0xd22b('0x3b')](_0x4bd8d6[_0xd22b('0x32')],_0x2b0b7a[_0xd22b('0x34')]));_0x5c55d5['raw']=!![];if(_0x4bd8d6['query'][_0xd22b('0x3c')]){_0x5c55d5[_0xd22b('0x3a')]=_['merge'](_0x5c55d5[_0xd22b('0x3a')],{'$or':_[_0xd22b('0x2b')](_0x5c55d5['attributes'],function(_0x2aa632){var _0x408e38={};_0x408e38[_0x2aa632]={'$like':'%'+_0x4bd8d6[_0xd22b('0x32')]['filter']+'%'};return _0x408e38;})});}_0x5c55d5=_[_0xd22b('0x3d')]({},_0x5c55d5,_0x4bd8d6[_0xd22b('0x44')]);return _0xe75d22[_0xd22b('0x62')](_0x5c55d5);}})['then'](respondWithResult(_0x5a0439,null))[_0xd22b('0x40')](handleError(_0x5a0439,null));};exports[_0xd22b('0x68')]=function(_0x438850,_0x2ee8a4,_0x4a27a3){var _0x119b2b;var _0x379e0b;var _0x3b54f4;var _0x33139f=_0x438850[_0xd22b('0x42')]['id'];csv_results=[];return db[_0xd22b('0x69')][_0xd22b('0x56')]({'attributes':['id',_0xd22b('0x28')],'raw':!![],'order':[_0xd22b('0x6a')]})[_0xd22b('0x26')](function(_0x13d2ea){_0x119b2b=_0x13d2ea;var _0x184622=_['keys'](db['CmContact'][_0xd22b('0x2d')]);return db[_0xd22b('0x63')]['findAll']({'raw':!![],'attributes':['id',_0xd22b('0x6b')]})['then'](function(_0x298162){_0x379e0b=_0x298162;var _0x22eb18=squel[_0xd22b('0x6c')]()[_0xd22b('0x37')](_0x184622)[_0xd22b('0x6d')](_0xd22b('0x6e'),'c')[_0xd22b('0x3a')]('c.ListId\x20=\x20?',_0x33139f)[_0xd22b('0x3a')](_0xd22b('0x6f'))[_0xd22b('0x70')]();for(var _0xcc915f=0x0;_0xcc915f<_0x379e0b[_0xd22b('0x38')];_0xcc915f++){_0x22eb18[_0xd22b('0x71')]('c.cf_'+_0x379e0b[_0xcc915f]['id'],_0xd22b('0x72')+_0x379e0b[_0xcc915f]['alias']);}for(var _0xcc915f=0x0;_0xcc915f<_0x119b2b[_0xd22b('0x38')];_0xcc915f++){_0x22eb18[_0xd22b('0x71')](squel[_0xd22b('0x6c')]()[_0xd22b('0x71')](_0xd22b('0x73'))[_0xd22b('0x6d')]('cm_contact_has_items')[_0xd22b('0x3a')](_0xd22b('0x74'),_0x119b2b[_0xcc915f]['id'])[_0xd22b('0x3a')]('CmContactId\x20=\x20c.id'),_0xd22b('0x75')+_0x119b2b[_0xcc915f][_0xd22b('0x28')]);_0x22eb18[_0xd22b('0x71')](squel[_0xd22b('0x6c')]()['field'](_0xd22b('0x76'))[_0xd22b('0x6d')](_0xd22b('0x77'))[_0xd22b('0x3a')]('ItemTypeId\x20=\x20?',_0x119b2b[_0xcc915f]['id'])['where'](_0xd22b('0x78')),'description_additionalPhone_'+_0x119b2b[_0xcc915f][_0xd22b('0x28')]);}var _0x533f56=[];_0x533f56[_0xd22b('0x5d')](_0x22eb18[_0xd22b('0x79')]());BPromise[_0xd22b('0x5e')](_0x533f56,handleQuery)[_0xd22b('0x26')](function(_0x3a94ca){handleQuery(_0x22eb18[_0xd22b('0x79')]());var _0x538d6e=csv_results[0x0];if(!_[_0xd22b('0x7a')](_0x538d6e)){var _0x34c2bc=toCsv(_0x538d6e);var _0x1f3317=Date[_0xd22b('0x7b')]();fs[_0xd22b('0x7c')](util[_0xd22b('0x65')](_0xd22b('0x7d'),_0x33139f,_0x1f3317),_0x34c2bc);_0x2ee8a4[_0xd22b('0x7e')](_0xd22b('0x7f'),'attachment;\x20filename='+util['format'](_0xd22b('0x80'),_0x33139f,_0x1f3317));_0x2ee8a4[_0xd22b('0x7e')](_0xd22b('0x81'),_0xd22b('0x82'));return _0x2ee8a4[_0xd22b('0x83')](util[_0xd22b('0x65')]('/tmp/list_%d_%s.csv',_0x33139f,_0x1f3317));}else{return _0x2ee8a4[_0xd22b('0x19')](0xcc);}});});});};exports['addCustomField']=function(_0x3bb407,_0x475039,_0x6cad11){var _0x3a8da4;delete _0x3bb407[_0xd22b('0x47')]['id'];return db['CmList'][_0xd22b('0x54')]({'where':{'id':_0x3bb407[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x475039,null))[_0xd22b('0x26')](function(_0x4f28eb){if(_0x4f28eb){return db['sequelize'][_0xd22b('0x84')](function(_0x282a40){return db[_0xd22b('0x63')][_0xd22b('0x46')](_0x3bb407[_0xd22b('0x47')],{'transaction':_0x282a40})[_0xd22b('0x26')](function(_0x1cfe11){_0x3a8da4=_0x1cfe11;return _0x4f28eb[_0xd22b('0x85')](_0x1cfe11,{'transaction':_0x282a40});})[_0xd22b('0x26')](function(){var _0x373f5d={'type':db[_0xd22b('0x86')][_0xd22b('0x87')],'transaction':_0x282a40};switch(_0x3bb407[_0xd22b('0x47')]['type']){case _0xd22b('0x88'):_0x373f5d[_0xd22b('0x2f')]=db[_0xd22b('0x86')][_0xd22b('0x87')];break;case _0xd22b('0x89'):_0x373f5d['type']=db['Sequelize'][_0xd22b('0x8a')];break;case _0xd22b('0x8b'):_0x373f5d['type']=db['Sequelize']['BOOLEAN'];_0x373f5d[_0xd22b('0x8c')]=![];break;default:}return db[_0xd22b('0x8d')]['queryInterface']['addColumn']('cm_contacts',util['format']('cf_%s',_0x3a8da4['id']),_0x373f5d);})[_0xd22b('0x26')](function(){return _0x3a8da4;});});}})[_0xd22b('0x26')](respondWithResult(_0x475039,null))[_0xd22b('0x40')](handleError(_0x475039,null));};exports[_0xd22b('0x8e')]=function(_0x551357,_0x20c597,_0x50ef46){var _0x2de8d5={};var _0x4d0ff7={};var _0x32e7d9;var _0x362498;return db['CmList']['findOne']({'where':{'id':_0x551357[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x20c597,null))[_0xd22b('0x26')](function(_0x2bb741){if(_0x2bb741){_0x32e7d9=_0x2bb741;_0x4d0ff7[_0xd22b('0x31')]=_[_0xd22b('0x33')](db['CmCustomField'][_0xd22b('0x2d')]);_0x4d0ff7['query']=_[_0xd22b('0x33')](_0x551357[_0xd22b('0x32')]);_0x4d0ff7[_0xd22b('0x34')]=_[_0xd22b('0x35')](_0x4d0ff7[_0xd22b('0x31')],_0x4d0ff7['query']);_0x2de8d5[_0xd22b('0x36')]=_[_0xd22b('0x35')](_0x4d0ff7['model'],qs[_0xd22b('0x37')](_0x551357[_0xd22b('0x32')][_0xd22b('0x37')]));_0x2de8d5[_0xd22b('0x36')]=_0x2de8d5[_0xd22b('0x36')][_0xd22b('0x38')]?_0x2de8d5[_0xd22b('0x36')]:_0x4d0ff7[_0xd22b('0x31')];_0x2de8d5[_0xd22b('0x67')]=qs[_0xd22b('0x39')](_0x551357['query'][_0xd22b('0x39')]);_0x2de8d5['where']=qs['filters'](_[_0xd22b('0x3b')](_0x551357['query'],_0x4d0ff7[_0xd22b('0x34')]));_0x2de8d5[_0xd22b('0x3a')]=_[_0xd22b('0x3d')](_0x2de8d5[_0xd22b('0x3a')],{'$or':[{'ListId':_0x2bb741['id']},{'ListId':null}]});if(_0x551357['query'][_0xd22b('0x3c')]){_0x2de8d5[_0xd22b('0x3a')]=_[_0xd22b('0x3d')](_0x2de8d5['where'],{'$or':_[_0xd22b('0x2b')](_0x2de8d5[_0xd22b('0x36')],function(_0x4801f6){var _0x2388bf={};_0x2388bf[_0x4801f6]={'$like':'%'+_0x551357[_0xd22b('0x32')][_0xd22b('0x3c')]+'%'};return _0x2388bf;})});}_0x2de8d5=_[_0xd22b('0x3d')]({},_0x2de8d5,_0x551357[_0xd22b('0x44')]);return db[_0xd22b('0x63')][_0xd22b('0x8f')](_0x2de8d5);}})[_0xd22b('0x26')](respondWithResult(_0x20c597,null))[_0xd22b('0x40')](handleError(_0x20c597,null));};exports[_0xd22b('0x90')]=function(_0x49001d,_0x1bd04d){return db[_0xd22b('0x63')][_0xd22b('0x8f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1bd04d,null))[_0xd22b('0x26')](function(_0x902be8){return _0x902be8;})[_0xd22b('0x26')](respondWithResult(_0x1bd04d,null))[_0xd22b('0x40')](handleError(_0x1bd04d,null));};exports[_0xd22b('0x91')]=function(_0x3f49c7,_0xc9647e,_0x592ed0){return db[_0xd22b('0x2c')][_0xd22b('0x45')]({'where':{'id':_0x3f49c7[_0xd22b('0x42')]['id']}})['then'](handleEntityNotFound(_0xc9647e,null))['then'](function(_0x26ecba){if(_0x26ecba){return _0x26ecba[_0xd22b('0x91')](_0x3f49c7[_0xd22b('0x47')][_0xd22b('0x59')],_[_0xd22b('0x92')](_0x3f49c7[_0xd22b('0x47')],[_0xd22b('0x59'),'id'])||{})[_0xd22b('0x93')](function(_0x16df10){for(var _0x35d305=0x0;_0x35d305<_0x3f49c7[_0xd22b('0x47')][_0xd22b('0x59')][_0xd22b('0x38')];_0x35d305+=0x1){socket[_0xd22b('0x94')](_0xd22b('0x95'),{'UserId':Number(_0x3f49c7[_0xd22b('0x47')][_0xd22b('0x59')][_0x35d305]),'CmListId':Number(_0x3f49c7[_0xd22b('0x42')]['id'])});}return _0x16df10;});}})['then'](respondWithResult(_0xc9647e,null))[_0xd22b('0x40')](handleError(_0xc9647e,null));};exports['removeAgents']=function(_0x48f88e,_0x29e650,_0x4a452c){return db[_0xd22b('0x2c')][_0xd22b('0x45')]({'where':{'id':_0x48f88e[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x29e650,null))[_0xd22b('0x26')](function(_0x42d20e){if(_0x42d20e){return _0x42d20e['removeAgents'](_0x48f88e[_0xd22b('0x32')][_0xd22b('0x59')])[_0xd22b('0x26')](function(){if(_['isArray'](_0x48f88e[_0xd22b('0x32')]['ids'])){for(var _0x1f7c00=0x0;_0x1f7c00<_0x48f88e[_0xd22b('0x32')][_0xd22b('0x59')][_0xd22b('0x38')];_0x1f7c00+=0x1){socket[_0xd22b('0x94')](_0xd22b('0x96'),{'UserId':Number(_0x48f88e[_0xd22b('0x32')][_0xd22b('0x59')][_0x1f7c00]),'CmListId':Number(_0x48f88e[_0xd22b('0x42')]['id'])});}}else{socket['emit'](_0xd22b('0x96'),{'UserId':Number(_0x48f88e[_0xd22b('0x32')][_0xd22b('0x59')]),'CmListId':Number(_0x48f88e[_0xd22b('0x42')]['id'])});}});}})[_0xd22b('0x26')](respondWithStatusCode(_0x29e650,null))[_0xd22b('0x40')](handleError(_0x29e650,null));};exports[_0xd22b('0x97')]=function(_0x3644ef,_0x129906,_0x184eb4){var _0x54bcd2={};var _0x31f470={};var _0x4dfae6;var _0x45008b;return db[_0xd22b('0x2c')]['findOne']({'where':{'id':_0x3644ef[_0xd22b('0x42')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0x129906,null))[_0xd22b('0x26')](function(_0x4c9956){if(_0x4c9956){_0x4dfae6=_0x4c9956;_0x31f470[_0xd22b('0x31')]=_['keys'](db[_0xd22b('0x98')][_0xd22b('0x2d')]);_0x31f470[_0xd22b('0x32')]=_[_0xd22b('0x33')](_0x3644ef[_0xd22b('0x32')]);_0x31f470[_0xd22b('0x34')]=_[_0xd22b('0x35')](_0x31f470[_0xd22b('0x31')],_0x31f470['query']);_0x54bcd2[_0xd22b('0x36')]=_['intersection'](_0x31f470[_0xd22b('0x31')],qs['fields'](_0x3644ef['query'][_0xd22b('0x37')]));_0x54bcd2[_0xd22b('0x36')]=_0x54bcd2['attributes']['length']?_0x54bcd2['attributes']:_0x31f470[_0xd22b('0x31')];_0x54bcd2[_0xd22b('0x67')]=qs[_0xd22b('0x39')](_0x3644ef[_0xd22b('0x32')][_0xd22b('0x39')]);_0x54bcd2['where']=qs[_0xd22b('0x34')](_[_0xd22b('0x3b')](_0x3644ef[_0xd22b('0x32')],_0x31f470[_0xd22b('0x34')]));if(_0x3644ef[_0xd22b('0x32')][_0xd22b('0x3c')]){_0x54bcd2[_0xd22b('0x3a')]=_[_0xd22b('0x3d')](_0x54bcd2[_0xd22b('0x3a')],{'$or':_[_0xd22b('0x2b')](_0x54bcd2['attributes'],function(_0x5dae80){var _0x7a9265={};_0x7a9265[_0x5dae80]={'$like':'%'+_0x3644ef[_0xd22b('0x32')][_0xd22b('0x3c')]+'%'};return _0x7a9265;})});}_0x54bcd2=_['merge']({},_0x54bcd2,_0x3644ef[_0xd22b('0x44')]);return _0x4dfae6[_0xd22b('0x97')](_0x54bcd2);}})[_0xd22b('0x26')](function(_0x42f4bd){if(_0x42f4bd){_0x45008b=_0x42f4bd[_0xd22b('0x38')];if(!_0x3644ef['query'][_0xd22b('0x55')](_0xd22b('0x66'))){_0x54bcd2[_0xd22b('0x20')]=qs[_0xd22b('0x20')](_0x3644ef[_0xd22b('0x32')][_0xd22b('0x20')]);_0x54bcd2[_0xd22b('0x1d')]=qs['offset'](_0x3644ef[_0xd22b('0x32')][_0xd22b('0x1d')]);}return _0x4dfae6[_0xd22b('0x97')](_0x54bcd2);}})[_0xd22b('0x26')](function(_0x53ec05){if(_0x53ec05){return _0x53ec05?{'count':_0x45008b,'rows':_0x53ec05}:null;}})[_0xd22b('0x26')](respondWithResult(_0x129906,null))[_0xd22b('0x40')](handleError(_0x129906,null));};function handleQuery(_0x8645c){logger[_0xd22b('0x99')](_0x8645c);return db[_0xd22b('0x8d')][_0xd22b('0x32')](_0x8645c)[_0xd22b('0x93')](function(_0x4efd1e){csv_results[_0xd22b('0x5d')](_0x4efd1e);})[_0xd22b('0x40')](function(_0x55b87a){logger[_0xd22b('0x27')](_0x55b87a[_0xd22b('0x61')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 28a0c29..77c8dbf 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2828b3,_0x2bb499){var _0x3ddbce=function(_0x424ced){while(--_0x424ced){_0x2828b3['push'](_0x2828b3['shift']());}};_0x3ddbce(++_0x2bb499);}(_0x814b,0x1a2));var _0xb814=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x814b[_0x86c6cb];return _0x1b1592;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1c9648,_0x19f34f){var _0x8be4fb=function(_0x57192c){while(--_0x57192c){_0x1c9648['push'](_0x1c9648['shift']());}};_0x8be4fb(++_0x19f34f);}(_0x814b,0x1a2));var _0xb814=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x814b[_0x1b6c6d];return _0x290d9d;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 61ca5e2..80a8e4b 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 _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x561222,_0x18b75b){_0x561222=_0x561222-0x0;var _0x43494b=_0x6f0d[_0x561222];return _0x43494b;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0xd7c26f,_0x852048){var _0x4f0478=function(_0x4960a6){while(--_0x4960a6){_0xd7c26f['push'](_0xd7c26f['shift']());}};_0x4f0478(++_0x852048);}(_0x2dae,0xc3));var _0xe2da=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x2dae[_0x22c684];return _0x39fcbb;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 8a8cdf6..a289ae3 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 _0x2e7f=['error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x182f79,_0x1f7bfc){var _0x5d8c58=function(_0xaf82c3){while(--_0xaf82c3){_0x182f79['push'](_0x182f79['shift']());}};_0x5d8c58(++_0x1f7bfc);}(_0x2e7f,0x108));var _0xf2e7=function(_0x197560,_0x493652){_0x197560=_0x197560-0x0;var _0x576a01=_0x2e7f[_0x197560];return _0x576a01;};'use strict';var _=require(_0xf2e7('0x0'));var util=require(_0xf2e7('0x1'));var moment=require('moment');var BPromise=require(_0xf2e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2e7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2e7('0x4'));var logger=require(_0xf2e7('0x5'))(_0xf2e7('0x6'));var config=require(_0xf2e7('0x7'));var jayson=require(_0xf2e7('0x8'));var client=jayson[_0xf2e7('0x9')][_0xf2e7('0xa')]({'port':0x232a});config[_0xf2e7('0xb')]=_['defaults'](config['redis'],{'host':_0xf2e7('0xc'),'port':0x18eb});var socket=require(_0xf2e7('0xd'))(new Redis(config['redis']));require(_0xf2e7('0xe'))[_0xf2e7('0xf')](socket);function respondWithRpcPromise(_0x5247dd,_0x109316,_0x38d174){return new BPromise(function(_0x42aab3,_0x4df6c1){return client[_0xf2e7('0x10')](_0x5247dd,_0x38d174)[_0xf2e7('0x11')](function(_0xa67a7c){logger[_0xf2e7('0x12')](_0xf2e7('0x13'),_0x109316,_0xf2e7('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x109316,_0xf2e7('0x14'),JSON[_0xf2e7('0x15')](_0xa67a7c));if(_0xa67a7c[_0xf2e7('0x16')]){if(_0xa67a7c['error'][_0xf2e7('0x17')]===0x1f4){logger[_0xf2e7('0x16')](_0xf2e7('0x13'),_0x109316,_0xa67a7c['error'][_0xf2e7('0x18')]);return _0x4df6c1(_0xa67a7c[_0xf2e7('0x16')]['message']);}logger[_0xf2e7('0x16')](_0xf2e7('0x13'),_0x109316,_0xa67a7c[_0xf2e7('0x16')][_0xf2e7('0x18')]);return _0x42aab3(_0xa67a7c[_0xf2e7('0x16')][_0xf2e7('0x18')]);}else{logger[_0xf2e7('0x12')](_0xf2e7('0x13'),_0x109316,_0xf2e7('0x14'));_0x42aab3(_0xa67a7c[_0xf2e7('0x19')][_0xf2e7('0x18')]);}})['catch'](function(_0x457190){logger[_0xf2e7('0x16')]('CmList,\x20%s,\x20%s',_0x109316,_0x457190);_0x4df6c1(_0x457190);});});} \ No newline at end of file +var _0x6904=['CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','./cmList.socket','register','request','then'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x6904,0x91));var _0x4690=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x6904[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x4690('0x0'));var util=require(_0x4690('0x1'));var moment=require(_0x4690('0x2'));var BPromise=require('bluebird');var rs=require(_0x4690('0x3'));var fs=require('fs');var Redis=require(_0x4690('0x4'));var db=require(_0x4690('0x5'))['db'];var utils=require(_0x4690('0x6'));var logger=require(_0x4690('0x7'))('rpc');var config=require(_0x4690('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4690('0x9')][_0x4690('0xa')]({'port':0x232a});config['redis']=_[_0x4690('0xb')](config[_0x4690('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4690('0xc')]));require(_0x4690('0xd'))[_0x4690('0xe')](socket);function respondWithRpcPromise(_0x14eeaa,_0x4900bc,_0x236e36){return new BPromise(function(_0x5593e7,_0x563045){return client[_0x4690('0xf')](_0x14eeaa,_0x236e36)[_0x4690('0x10')](function(_0x2d8f15){logger['info'](_0x4690('0x11'),_0x4900bc,_0x4690('0x12'));logger[_0x4690('0x13')](_0x4690('0x14'),_0x4900bc,'request\x20sent',JSON['stringify'](_0x2d8f15));if(_0x2d8f15['error']){if(_0x2d8f15['error'][_0x4690('0x15')]===0x1f4){logger[_0x4690('0x16')](_0x4690('0x11'),_0x4900bc,_0x2d8f15[_0x4690('0x16')][_0x4690('0x17')]);return _0x563045(_0x2d8f15[_0x4690('0x16')][_0x4690('0x17')]);}logger[_0x4690('0x16')](_0x4690('0x11'),_0x4900bc,_0x2d8f15[_0x4690('0x16')][_0x4690('0x17')]);return _0x5593e7(_0x2d8f15[_0x4690('0x16')][_0x4690('0x17')]);}else{logger[_0x4690('0x18')](_0x4690('0x11'),_0x4900bc,_0x4690('0x12'));_0x5593e7(_0x2d8f15[_0x4690('0x19')][_0x4690('0x17')]);}})[_0x4690('0x1a')](function(_0x3db7f4){logger[_0x4690('0x16')]('CmList,\x20%s,\x20%s',_0x4900bc,_0x3db7f4);_0x563045(_0x3db7f4);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7bbe719..7ed3d04 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 _0xcc0c=['./cmList.events','save','remove','update','length','cmList:'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xcc0c,0x102));var _0xccc0=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0xcc0c[_0x22e101];return _0xa51f61;};'use strict';var CmListEvents=require(_0xccc0('0x0'));var events=[_0xccc0('0x1'),_0xccc0('0x2'),_0xccc0('0x3')];function createListener(_0x10af09,_0x155063){return function(_0x2ebeca){_0x155063['emit'](_0x10af09,_0x2ebeca);};}function removeListener(_0x1f3d3e,_0x3cd3c2){return function(){CmListEvents['removeListener'](_0x1f3d3e,_0x3cd3c2);};}exports['register']=function(_0x1d99f6){for(var _0x5629d2=0x0,_0x2a54a6=events[_0xccc0('0x4')];_0x5629d2<_0x2a54a6;_0x5629d2++){var _0x536ff0=events[_0x5629d2];var _0xe587c2=createListener(_0xccc0('0x5')+_0x536ff0,_0x1d99f6);CmListEvents['on'](_0x536ff0,_0xe587c2);}}; \ No newline at end of file +var _0xf312=['removeListener','register','length','./cmList.events','remove','update','emit'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xf312,0x122));var _0x2f31=function(_0x57a8a1,_0x154bd5){_0x57a8a1=_0x57a8a1-0x0;var _0x346d17=_0xf312[_0x57a8a1];return _0x346d17;};'use strict';var CmListEvents=require(_0x2f31('0x0'));var events=['save',_0x2f31('0x1'),_0x2f31('0x2')];function createListener(_0x284676,_0x34fd1c){return function(_0x5e3875){_0x34fd1c[_0x2f31('0x3')](_0x284676,_0x5e3875);};}function removeListener(_0x5a7c66,_0x19cca7){return function(){CmListEvents[_0x2f31('0x4')](_0x5a7c66,_0x19cca7);};}exports[_0x2f31('0x5')]=function(_0x5f0b74){for(var _0x9d02a6=0x0,_0x239f25=events[_0x2f31('0x6')];_0x9d02a6<_0x239f25;_0x9d02a6++){var _0x1980dc=events[_0x9d02a6];var _0x4441d6=createListener('cmList:'+_0x1980dc,_0x5f0b74);CmListEvents['on'](_0x1980dc,_0x4441d6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f8ca383..2e2529f 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 _0xdd66=['/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','delete','removeDispositions','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields'];(function(_0xfb0266,_0x2befed){var _0x33ae42=function(_0x42aa8d){while(--_0x42aa8d){_0xfb0266['push'](_0xfb0266['shift']());}};_0x33ae42(++_0x2befed);}(_0xdd66,0x121));var _0x6dd6=function(_0x36707b,_0x4e5bdb){_0x36707b=_0x36707b-0x0;var _0x4e4d87=_0xdd66[_0x36707b];return _0x4e4d87;};'use strict';var multer=require('multer');var util=require(_0x6dd6('0x0'));var path=require(_0x6dd6('0x1'));var timeout=require('connect-timeout');var express=require(_0x6dd6('0x2'));var router=express[_0x6dd6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6dd6('0x4'));var interaction=require(_0x6dd6('0x5'));var config=require(_0x6dd6('0x6'));var controller=require(_0x6dd6('0x7'));router[_0x6dd6('0x8')]('/',auth['isAuthenticated'](),controller[_0x6dd6('0x9')]);router[_0x6dd6('0x8')](_0x6dd6('0xa'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0xc')]);router['get'](_0x6dd6('0xd'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0xe')]);router[_0x6dd6('0x8')](_0x6dd6('0xf'),auth['isAuthenticated'](),controller[_0x6dd6('0x10')]);router['get'](_0x6dd6('0x11'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x12')]);router['get'](_0x6dd6('0x13'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x14')]);router[_0x6dd6('0x8')](_0x6dd6('0x15'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x16')]);router[_0x6dd6('0x8')](_0x6dd6('0x17'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x18')]);router['get'](_0x6dd6('0x19'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x1a')]);router[_0x6dd6('0x1b')]('/',auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x1c')]);router[_0x6dd6('0x1b')](_0x6dd6('0x11'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x1d')]);router[_0x6dd6('0x1b')]('/:id/contacts',auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x1e')]);router['post'](_0x6dd6('0x17'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x1f')]);router[_0x6dd6('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x6dd6('0x20')]);router['put'](_0x6dd6('0xf'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x21')]);router[_0x6dd6('0x22')](_0x6dd6('0xf'),auth[_0x6dd6('0xb')](),controller['destroy']);router[_0x6dd6('0x22')](_0x6dd6('0x11'),auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x23')]);router['delete']('/:id/users',auth[_0x6dd6('0xb')](),controller[_0x6dd6('0x24')]);module[_0x6dd6('0x25')]=router; \ No newline at end of file +var _0xb093=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','create','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','removeDispositions','removeAgents'];(function(_0x2d4ae6,_0x4e7db2){var _0x9b1c0a=function(_0x4674c5){while(--_0x4674c5){_0x2d4ae6['push'](_0x2d4ae6['shift']());}};_0x9b1c0a(++_0x4e7db2);}(_0xb093,0xfd));var _0x3b09=function(_0x2651fb,_0x19916a){_0x2651fb=_0x2651fb-0x0;var _0x2ca1b9=_0xb093[_0x2651fb];return _0x2ca1b9;};'use strict';var multer=require(_0x3b09('0x0'));var util=require(_0x3b09('0x1'));var path=require(_0x3b09('0x2'));var timeout=require(_0x3b09('0x3'));var express=require(_0x3b09('0x4'));var router=express['Router']();var fs_extra=require(_0x3b09('0x5'));var auth=require(_0x3b09('0x6'));var interaction=require(_0x3b09('0x7'));var config=require('../../config/environment');var controller=require(_0x3b09('0x8'));router[_0x3b09('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b09('0xa')]);router[_0x3b09('0x9')](_0x3b09('0xb'),auth[_0x3b09('0xc')](),controller['describe']);router[_0x3b09('0x9')](_0x3b09('0xd'),auth[_0x3b09('0xc')](),controller[_0x3b09('0xe')]);router[_0x3b09('0x9')]('/:id',auth[_0x3b09('0xc')](),controller[_0x3b09('0xf')]);router[_0x3b09('0x9')](_0x3b09('0x10'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x11')]);router[_0x3b09('0x9')](_0x3b09('0x12'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x13')]);router[_0x3b09('0x9')](_0x3b09('0x14'),auth[_0x3b09('0xc')](),controller['getContactsCsv']);router[_0x3b09('0x9')](_0x3b09('0x15'),auth['isAuthenticated'](),controller[_0x3b09('0x16')]);router[_0x3b09('0x9')](_0x3b09('0x17'),auth[_0x3b09('0xc')](),controller['getAgents']);router[_0x3b09('0x18')]('/',auth[_0x3b09('0xc')](),controller[_0x3b09('0x19')]);router[_0x3b09('0x18')](_0x3b09('0x10'),auth[_0x3b09('0xc')](),controller['addDisposition']);router['post'](_0x3b09('0x12'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x1a')]);router['post'](_0x3b09('0x15'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x1b')]);router[_0x3b09('0x18')](_0x3b09('0x17'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x1c')]);router['put'](_0x3b09('0x1d'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x1e')]);router[_0x3b09('0x1f')](_0x3b09('0x1d'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x20')]);router['delete'](_0x3b09('0x10'),auth['isAuthenticated'](),controller[_0x3b09('0x21')]);router[_0x3b09('0x1f')](_0x3b09('0x17'),auth[_0x3b09('0xc')](),controller[_0x3b09('0x22')]);module[_0x3b09('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e43ee22..ea3ec81 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 _0xdb2b=['exports','field','STRING','sequelize'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0xdb2b,0xbf));var _0xbdb2=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0xdb2b[_0x4fa438];return _0x4e3958;};'use strict';var Sequelize=require(_0xbdb2('0x0'));module[_0xbdb2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x423140){return this['getDataValue'](_0xbdb2('0x2'));}},'field':{'type':Sequelize[_0xbdb2('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xbdb2('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xbdb2('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xf348=['sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x41bd14,_0x487433){var _0x5d5d10=function(_0x92374e){while(--_0x92374e){_0x41bd14['push'](_0x41bd14['shift']());}};_0x5d5d10(++_0x487433);}(_0xf348,0xd8));var _0x8f34=function(_0xa9190e,_0x56fe29){_0xa9190e=_0xa9190e-0x0;var _0x10bc2d=_0xf348[_0xa9190e];return _0x10bc2d;};'use strict';var Sequelize=require(_0x8f34('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f34('0x1')],'get':function(_0x3baa7){return this[_0x8f34('0x2')]('field');}},'field':{'type':Sequelize[_0x8f34('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8f34('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 370461e..fea7ca7 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4f4b4e,_0x3aba9c){var _0x592918=function(_0x2a06a4){while(--_0x2a06a4){_0x4f4b4e['push'](_0x4f4b4e['shift']());}};_0x592918(++_0x3aba9c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5eaa1b,_0x285e64){var _0x5b910f=function(_0x22e4a1){while(--_0x22e4a1){_0x5eaa1b['push'](_0x5eaa1b['shift']());}};_0x5b910f(++_0x285e64);}(_0x7a54,0x106));var _0x47a5=function(_0x3c838b,_0x611045){_0x3c838b=_0x3c838b-0x0;var _0x23581a=_0x7a54[_0x3c838b];return _0x23581a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index db54d7d..465a792 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 _0x4dd9=['request-promise','path','define','Condition','lodash','util','../../config/logger','api'];(function(_0x5adb18,_0x222326){var _0x420c98=function(_0x146b7b){while(--_0x146b7b){_0x5adb18['push'](_0x5adb18['shift']());}};_0x420c98(++_0x222326);}(_0x4dd9,0x144));var _0x94dd=function(_0x230949,_0x790da6){_0x230949=_0x230949-0x0;var _0x54a3dd=_0x4dd9[_0x230949];return _0x54a3dd;};'use strict';var _=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var logger=require(_0x94dd('0x2'))(_0x94dd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x94dd('0x4'));var fs=require('fs');var path=require(_0x94dd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x308798,_0x14204a){return _0x308798[_0x94dd('0x6')](_0x94dd('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf392=['bluebird','request-promise','path','rimraf','../../config/environment','define','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x373c28,_0x30dcb4){var _0x21c96d=function(_0x460631){while(--_0x460631){_0x373c28['push'](_0x373c28['shift']());}};_0x21c96d(++_0x30dcb4);}(_0xf392,0x163));var _0x2f39=function(_0x369758,_0x48a9db){_0x369758=_0x369758-0x0;var _0x1761aa=_0xf392[_0x369758];return _0x1761aa;};'use strict';var _=require(_0x2f39('0x0'));var util=require(_0x2f39('0x1'));var logger=require(_0x2f39('0x2'))(_0x2f39('0x3'));var moment=require(_0x2f39('0x4'));var BPromise=require(_0x2f39('0x5'));var rp=require(_0x2f39('0x6'));var fs=require('fs');var path=require(_0x2f39('0x7'));var rimraf=require(_0x2f39('0x8'));var config=require(_0x2f39('0x9'));var attributes=require('./condition.attributes');module['exports']=function(_0x2a2308,_0x5b713d){return _0x2a2308[_0x2f39('0xa')]('Condition',attributes,{'tableName':_0x2f39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 36ba6af..1490255 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 _0xa6f9=['client','http','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x55f5f1,_0x11660f){var _0x20f0ec=function(_0x597f54){while(--_0x597f54){_0x55f5f1['push'](_0x55f5f1['shift']());}};_0x20f0ec(++_0x11660f);}(_0xa6f9,0x1db));var _0x9a6f=function(_0x40fd2c,_0x321ac8){_0x40fd2c=_0x40fd2c-0x0;var _0x581c40=_0xa6f9[_0x40fd2c];return _0x581c40;};'use strict';var _=require(_0x9a6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9a6f('0x1'));var rs=require(_0x9a6f('0x2'));var fs=require('fs');var Redis=require(_0x9a6f('0x3'));var db=require(_0x9a6f('0x4'))['db'];var utils=require(_0x9a6f('0x5'));var logger=require(_0x9a6f('0x6'))(_0x9a6f('0x7'));var config=require(_0x9a6f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a6f('0x9')][_0x9a6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x445d86,_0x3f4ba3,_0x1300d5){return new BPromise(function(_0x37b009,_0x5e4bb4){return client[_0x9a6f('0xb')](_0x445d86,_0x1300d5)['then'](function(_0x4a34ae){logger[_0x9a6f('0xc')](_0x9a6f('0xd'),_0x3f4ba3,'request\x20sent');logger[_0x9a6f('0xe')](_0x9a6f('0xf'),_0x3f4ba3,_0x9a6f('0x10'),JSON['stringify'](_0x4a34ae));if(_0x4a34ae['error']){if(_0x4a34ae[_0x9a6f('0x11')][_0x9a6f('0x12')]===0x1f4){logger[_0x9a6f('0x11')](_0x9a6f('0xd'),_0x3f4ba3,_0x4a34ae['error']['message']);return _0x5e4bb4(_0x4a34ae[_0x9a6f('0x11')][_0x9a6f('0x13')]);}logger[_0x9a6f('0x11')](_0x9a6f('0xd'),_0x3f4ba3,_0x4a34ae[_0x9a6f('0x11')][_0x9a6f('0x13')]);return _0x37b009(_0x4a34ae['error'][_0x9a6f('0x13')]);}else{logger[_0x9a6f('0xc')](_0x9a6f('0xd'),_0x3f4ba3,_0x9a6f('0x10'));_0x37b009(_0x4a34ae[_0x9a6f('0x14')][_0x9a6f('0x13')]);}})[_0x9a6f('0x15')](function(_0x32d770){logger[_0x9a6f('0x11')](_0x9a6f('0xd'),_0x3f4ba3,_0x32d770);_0x5e4bb4(_0x32d770);});});} \ No newline at end of file +var _0x4265=['then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http'];(function(_0x45ae47,_0x2ffbb7){var _0x3eb901=function(_0x2c444f){while(--_0x2c444f){_0x45ae47['push'](_0x45ae47['shift']());}};_0x3eb901(++_0x2ffbb7);}(_0x4265,0xe6));var _0x5426=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4265[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x5426('0x0'));var util=require(_0x5426('0x1'));var moment=require(_0x5426('0x2'));var BPromise=require(_0x5426('0x3'));var rs=require(_0x5426('0x4'));var fs=require('fs');var Redis=require(_0x5426('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5426('0x6'))(_0x5426('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5426('0x8')][_0x5426('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7680,_0x28b832,_0x2ad360){return new BPromise(function(_0x5e8d8b,_0x4b9c66){return client['request'](_0x3e7680,_0x2ad360)[_0x5426('0xa')](function(_0x49325c){logger[_0x5426('0xb')](_0x5426('0xc'),_0x28b832,_0x5426('0xd'));logger['debug'](_0x5426('0xe'),_0x28b832,_0x5426('0xd'),JSON['stringify'](_0x49325c));if(_0x49325c[_0x5426('0xf')]){if(_0x49325c[_0x5426('0xf')][_0x5426('0x10')]===0x1f4){logger[_0x5426('0xf')](_0x5426('0xc'),_0x28b832,_0x49325c['error'][_0x5426('0x11')]);return _0x4b9c66(_0x49325c[_0x5426('0xf')][_0x5426('0x11')]);}logger[_0x5426('0xf')](_0x5426('0xc'),_0x28b832,_0x49325c[_0x5426('0xf')][_0x5426('0x11')]);return _0x5e8d8b(_0x49325c[_0x5426('0xf')]['message']);}else{logger['info'](_0x5426('0xc'),_0x28b832,'request\x20sent');_0x5e8d8b(_0x49325c[_0x5426('0x12')][_0x5426('0x11')]);}})[_0x5426('0x13')](function(_0xa27b6f){logger[_0x5426('0xf')](_0x5426('0xc'),_0x28b832,_0xa27b6f);_0x4b9c66(_0xa27b6f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 91d8175..fcac4c3 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 _0xf2b9=['delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xf2b9,0xce));var _0x9f2b=function(_0x763108,_0x35539f){_0x763108=_0x763108-0x0;var _0x133a4e=_0xf2b9[_0x763108];return _0x133a4e;};'use strict';var multer=require(_0x9f2b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f2b('0x1'));var router=express['Router']();var fs_extra=require(_0x9f2b('0x2'));var auth=require(_0x9f2b('0x3'));var interaction=require(_0x9f2b('0x4'));var config=require(_0x9f2b('0x5'));var controller=require('./condition.controller');router[_0x9f2b('0x6')](_0x9f2b('0x7'),auth[_0x9f2b('0x8')](),controller[_0x9f2b('0x9')]);router[_0x9f2b('0xa')](_0x9f2b('0x7'),auth[_0x9f2b('0x8')](),controller[_0x9f2b('0xb')]);module['exports']=router; \ No newline at end of file +var _0xc769=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x3754d6,_0x292ba8){var _0x20fcca=function(_0x1a277d){while(--_0x1a277d){_0x3754d6['push'](_0x3754d6['shift']());}};_0x20fcca(++_0x292ba8);}(_0xc769,0x1ef));var _0x9c76=function(_0x102380,_0x2e92e3){_0x102380=_0x102380-0x0;var _0x4f78b7=_0xc769[_0x102380];return _0x4f78b7;};'use strict';var multer=require(_0x9c76('0x0'));var util=require(_0x9c76('0x1'));var path=require(_0x9c76('0x2'));var timeout=require(_0x9c76('0x3'));var express=require(_0x9c76('0x4'));var router=express[_0x9c76('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9c76('0x6'));var interaction=require(_0x9c76('0x7'));var config=require(_0x9c76('0x8'));var controller=require(_0x9c76('0x9'));router['put'](_0x9c76('0xa'),auth[_0x9c76('0xb')](),controller[_0x9c76('0xc')]);router[_0x9c76('0xd')]('/:id',auth[_0x9c76('0xb')](),controller[_0x9c76('0xe')]);module[_0x9c76('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 88dead1..2b4f8a8 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa80c=['exports','INTEGER','sequelize'];(function(_0x4a4d4e,_0x2f72a3){var _0x2417f4=function(_0x5527f1){while(--_0x5527f1){_0x4a4d4e['push'](_0x4a4d4e['shift']());}};_0x2417f4(++_0x2f72a3);}(_0xa80c,0xc2));var _0xca80=function(_0xf0cf28,_0x1a5fe2){_0xf0cf28=_0xf0cf28-0x0;var _0x2d367d=_0xa80c[_0xf0cf28];return _0x2d367d;};'use strict';var Sequelize=require(_0xca80('0x0'));module[_0xca80('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xca80('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x105a=['sequelize','exports'];(function(_0x181148,_0x132a23){var _0x4c1740=function(_0x3d5f68){while(--_0x3d5f68){_0x181148['push'](_0x181148['shift']());}};_0x4c1740(++_0x132a23);}(_0x105a,0x7a));var _0xa105=function(_0x1efe58,_0x202a22){_0x1efe58=_0x1efe58-0x0;var _0x5611a1=_0x105a[_0x1efe58];return _0x5611a1;};'use strict';var Sequelize=require(_0xa105('0x0'));module[_0xa105('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c12d8dd..2902e3c 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cf8=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','ContactItemType','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4fb34f,_0x1a95cf){var _0x1d4726=function(_0x158f05){while(--_0x158f05){_0x4fb34f['push'](_0x4fb34f['shift']());}};_0x1d4726(++_0x1a95cf);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x4cf8[_0x2085f3];return _0x384e3c;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['ContactItemType'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['ContactItemType'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='ContactItemTypes';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](db['CmContactHasItem'][_0x84cf('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3912cb['params']['id']}}))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))[_0x84cf('0x49')](handleError(_0x2a4f20,null));}; \ No newline at end of file +var _0xfb11=['show','keys','rawAttributes','includeAll','include','find','body','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ContactItemType','findAll','rows','catch'];(function(_0x4b74ab,_0xb66cf6){var _0x5dba22=function(_0x1b1440){while(--_0x1b1440){_0x4b74ab['push'](_0x4b74ab['shift']());}};_0x5dba22(++_0xb66cf6);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xfb11[_0x25bea7];return _0x175952;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){var _0x5fc9e6=_0x4272c7[_0x1fb1('0x25')]({'plain':!![]});var _0x1353a4=_0x1fb1('0x26');return db[_0x1fb1('0x27')]['destroy']({'where':{'type':_0x1353a4,'resourceId':_0x5fc9e6['id']}})[_0x1fb1('0x23')](function(){return _0x4272c7;});})[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1898e7,_0x29e1bd){return function(_0x1a74c4){if(!_0x1a74c4){_0x1898e7[_0x1fb1('0x28')](0x194);}return _0x1a74c4;};}function handleError(_0xa7bba,_0x33a3b7){_0x33a3b7=_0x33a3b7||0x1f4;return function(_0x5e99e7){logger[_0x1fb1('0x29')](_0x5e99e7[_0x1fb1('0x2a')]);if(_0x5e99e7[_0x1fb1('0x2b')]){delete _0x5e99e7[_0x1fb1('0x2b')];}_0xa7bba['status'](_0x33a3b7)[_0x1fb1('0x2c')](_0x5e99e7);};}exports[_0x1fb1('0x2d')]=function(_0x90d8ef,_0x1b71cb){var _0x5402e9={},_0x245f84={},_0x30c8eb={'count':0x0,'rows':[]};var _0x5d45a5=_[_0x1fb1('0x2e')](db['ContactItemType']['rawAttributes'],function(_0x354e92){return{'name':_0x354e92[_0x1fb1('0x2f')],'type':_0x354e92['type'][_0x1fb1('0x30')]};});_0x245f84[_0x1fb1('0x31')]=_[_0x1fb1('0x2e')](_0x5d45a5,_0x1fb1('0x2b'));_0x245f84[_0x1fb1('0x32')]=_['keys'](_0x90d8ef[_0x1fb1('0x32')]);_0x245f84[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],_0x245f84[_0x1fb1('0x32')]);_0x5402e9[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x90d8ef['query'][_0x1fb1('0x36')]));_0x5402e9['attributes']=_0x5402e9[_0x1fb1('0x35')]['length']?_0x5402e9[_0x1fb1('0x35')]:_0x245f84['model'];if(!_0x90d8ef['query'][_0x1fb1('0x37')](_0x1fb1('0x38'))){_0x5402e9[_0x1fb1('0x1d')]=qs[_0x1fb1('0x1d')](_0x90d8ef['query'][_0x1fb1('0x1d')]);_0x5402e9[_0x1fb1('0x1b')]=qs[_0x1fb1('0x1b')](_0x90d8ef['query'][_0x1fb1('0x1b')]);}_0x5402e9[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3a')]);_0x5402e9[_0x1fb1('0x3b')]=qs[_0x1fb1('0x33')](_['pick'](_0x90d8ef[_0x1fb1('0x32')],_0x245f84[_0x1fb1('0x33')]),_0x5d45a5);if(_0x90d8ef['query'][_0x1fb1('0x3c')]){_0x5402e9['where']=_[_0x1fb1('0x3d')](_0x5402e9[_0x1fb1('0x3b')],{'$or':_[_0x1fb1('0x2e')](_0x5d45a5,function(_0x439eec){if(_0x439eec[_0x1fb1('0x3e')]!==_0x1fb1('0x3f')){var _0x927301={};_0x927301[_0x439eec[_0x1fb1('0x2b')]]={'$like':'%'+_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3c')]+'%'};return _0x927301;}})});}_0x5402e9=_[_0x1fb1('0x3d')]({},_0x5402e9,_0x90d8ef[_0x1fb1('0x40')]);var _0xafc9a7={'where':_0x5402e9[_0x1fb1('0x3b')]};return db[_0x1fb1('0x41')]['count'](_0xafc9a7)[_0x1fb1('0x23')](function(_0xca1fd3){_0x30c8eb[_0x1fb1('0x1e')]=_0xca1fd3;if(_0x90d8ef[_0x1fb1('0x32')]['includeAll']){_0x5402e9['include']=[{'all':!![]}];}return db[_0x1fb1('0x41')][_0x1fb1('0x42')](_0x5402e9);})[_0x1fb1('0x23')](function(_0x3edc8a){_0x30c8eb[_0x1fb1('0x43')]=_0x3edc8a;return _0x30c8eb;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x1b71cb,_0x5402e9))[_0x1fb1('0x44')](handleError(_0x1b71cb,null));};exports[_0x1fb1('0x45')]=function(_0x14aa27,_0x320bda){var _0x4a943c={'raw':!![],'where':{'id':_0x14aa27['params']['id']}},_0x44ccbe={};_0x44ccbe['model']=_[_0x1fb1('0x46')](db[_0x1fb1('0x41')][_0x1fb1('0x47')]);_0x44ccbe[_0x1fb1('0x32')]=_['keys'](_0x14aa27['query']);_0x44ccbe[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],_0x44ccbe[_0x1fb1('0x32')]);_0x4a943c[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x14aa27[_0x1fb1('0x32')]['fields']));_0x4a943c['attributes']=_0x4a943c[_0x1fb1('0x35')]['length']?_0x4a943c[_0x1fb1('0x35')]:_0x44ccbe[_0x1fb1('0x31')];if(_0x14aa27[_0x1fb1('0x32')][_0x1fb1('0x48')]){_0x4a943c[_0x1fb1('0x49')]=[{'all':!![]}];}_0x4a943c=_[_0x1fb1('0x3d')]({},_0x4a943c,_0x14aa27['options']);return db[_0x1fb1('0x41')][_0x1fb1('0x4a')](_0x4a943c)[_0x1fb1('0x23')](handleEntityNotFound(_0x320bda,null))['then'](respondWithResult(_0x320bda,null))[_0x1fb1('0x44')](handleError(_0x320bda,null));};exports['create']=function(_0x6e105b,_0xba4fa7){return db[_0x1fb1('0x41')]['create'](_0x6e105b[_0x1fb1('0x4b')],{})[_0x1fb1('0x23')](function(_0x52271f){var _0xe492ab=_0x6e105b[_0x1fb1('0x4c')][_0x1fb1('0x25')]({'plain':!![]});if(!_0xe492ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe492ab['role']==='user'){var _0x31a85a=_0x52271f[_0x1fb1('0x25')]({'plain':!![]});var _0x1e2754=_0x1fb1('0x26');return db[_0x1fb1('0x4d')][_0x1fb1('0x4a')]({'where':{'name':_0x1e2754,'userProfileId':_0xe492ab['userProfileId']},'raw':!![]})['then'](function(_0x267c36){if(_0x267c36&&_0x267c36[_0x1fb1('0x4e')]===0x0){return db[_0x1fb1('0x27')][_0x1fb1('0x4f')]({'name':_0x31a85a['name'],'resourceId':_0x31a85a['id'],'type':_0x267c36['name'],'sectionId':_0x267c36['id']},{})[_0x1fb1('0x23')](function(){return _0x52271f;});}else{return _0x52271f;}})['catch'](function(_0x41fefb){logger['error'](_0x1fb1('0x50'),_0x41fefb);throw _0x41fefb;});}return _0x52271f;})['then'](respondWithResult(_0xba4fa7,0xc9))[_0x1fb1('0x44')](handleError(_0xba4fa7,null));};exports[_0x1fb1('0x22')]=function(_0x1475ee,_0xca9395){if(_0x1475ee[_0x1fb1('0x4b')]['id']){delete _0x1475ee['body']['id'];}return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x1475ee[_0x1fb1('0x51')]['id']}})['then'](handleEntityNotFound(_0xca9395,null))['then'](saveUpdates(_0x1475ee[_0x1fb1('0x4b')],null))[_0x1fb1('0x23')](respondWithResult(_0xca9395,null))[_0x1fb1('0x44')](handleError(_0xca9395,null));};exports[_0x1fb1('0x24')]=function(_0x439670,_0xc9e8d4){return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x439670[_0x1fb1('0x51')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xc9e8d4,null))[_0x1fb1('0x23')](db[_0x1fb1('0x52')][_0x1fb1('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x439670[_0x1fb1('0x51')]['id']}}))['then'](removeEntity(_0xc9e8d4,null))[_0x1fb1('0x44')](handleError(_0xc9e8d4,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0816884..15402d2 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68f0=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0x2d83ec,_0x528cce){var _0x12f1dc=function(_0x5c9924){while(--_0x5c9924){_0x2d83ec['push'](_0x2d83ec['shift']());}};_0x12f1dc(++_0x528cce);}(_0x68f0,0x197));var _0x068f=function(_0x577a2e,_0x3816f0){_0x577a2e=_0x577a2e-0x0;var _0x3ac138=_0x68f0[_0x577a2e];return _0x3ac138;};'use strict';var _=require(_0x068f('0x0'));var util=require(_0x068f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x068f('0x2'));var rp=require(_0x068f('0x3'));var fs=require('fs');var path=require(_0x068f('0x4'));var rimraf=require(_0x068f('0x5'));var config=require(_0x068f('0x6'));var attributes=require(_0x068f('0x7'));module[_0x068f('0x8')]=function(_0x52daf1,_0xe81465){return _0x52daf1['define'](_0x068f('0x9'),attributes,{'tableName':_0x068f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25a=['lodash','util','../../config/logger','api','request-promise','path','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0xd0efc2,_0x83fe43){var _0x56e170=function(_0x34f715){while(--_0x34f715){_0xd0efc2['push'](_0xd0efc2['shift']());}};_0x56e170(++_0x83fe43);}(_0xa25a,0x1a4));var _0xaa25=function(_0x39696d,_0x24f2f2){_0x39696d=_0x39696d-0x0;var _0x2e1bc0=_0xa25a[_0x39696d];return _0x2e1bc0;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa25('0x4'));var fs=require('fs');var path=require(_0xaa25('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa25('0x6'));module[_0xaa25('0x7')]=function(_0x5b2ea6,_0x4d4c58){return _0x5b2ea6[_0xaa25('0x8')](_0xaa25('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 0d3e95e..d1f1796 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x784a=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info'];(function(_0x4d72c9,_0x519e4a){var _0x4f5143=function(_0x21be84){while(--_0x21be84){_0x4d72c9['push'](_0x4d72c9['shift']());}};_0x4f5143(++_0x519e4a);}(_0x784a,0x130));var _0xa784=function(_0x4c7232,_0x4109aa){_0x4c7232=_0x4c7232-0x0;var _0x2175ca=_0x784a[_0x4c7232];return _0x2175ca;};'use strict';var _=require(_0xa784('0x0'));var util=require(_0xa784('0x1'));var moment=require(_0xa784('0x2'));var BPromise=require('bluebird');var rs=require(_0xa784('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa784('0x4'))['db'];var utils=require(_0xa784('0x5'));var logger=require('../../config/logger')(_0xa784('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa784('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36cdce,_0x39c6d0,_0x5e66c0){return new BPromise(function(_0x7a773,_0x2ed29f){return client[_0xa784('0x8')](_0x36cdce,_0x5e66c0)[_0xa784('0x9')](function(_0xf850d){logger[_0xa784('0xa')](_0xa784('0xb'),_0x39c6d0,_0xa784('0xc'));logger[_0xa784('0xd')](_0xa784('0xe'),_0x39c6d0,_0xa784('0xc'),JSON[_0xa784('0xf')](_0xf850d));if(_0xf850d[_0xa784('0x10')]){if(_0xf850d[_0xa784('0x10')][_0xa784('0x11')]===0x1f4){logger[_0xa784('0x10')](_0xa784('0xb'),_0x39c6d0,_0xf850d['error'][_0xa784('0x12')]);return _0x2ed29f(_0xf850d[_0xa784('0x10')][_0xa784('0x12')]);}logger[_0xa784('0x10')]('ContactItemType,\x20%s,\x20%s',_0x39c6d0,_0xf850d['error'][_0xa784('0x12')]);return _0x7a773(_0xf850d[_0xa784('0x10')]['message']);}else{logger[_0xa784('0xa')]('ContactItemType,\x20%s,\x20%s',_0x39c6d0,_0xa784('0xc'));_0x7a773(_0xf850d[_0xa784('0x13')][_0xa784('0x12')]);}})[_0xa784('0x14')](function(_0x4dac88){logger[_0xa784('0x10')](_0xa784('0xb'),_0x39c6d0,_0x4dac88);_0x2ed29f(_0x4dac88);});});} \ No newline at end of file +var _0x768a=['ContactItemType,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2551ca,_0x3f8886){var _0x19a175=function(_0x24f6a8){while(--_0x24f6a8){_0x2551ca['push'](_0x2551ca['shift']());}};_0x19a175(++_0x3f8886);}(_0x768a,0x10d));var _0xa768=function(_0x24c57b,_0x2ab0c0){_0x24c57b=_0x24c57b-0x0;var _0x1d0146=_0x768a[_0x24c57b];return _0x1d0146;};'use strict';var _=require('lodash');var util=require(_0xa768('0x0'));var moment=require(_0xa768('0x1'));var BPromise=require(_0xa768('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa768('0x3'));var db=require(_0xa768('0x4'))['db'];var utils=require(_0xa768('0x5'));var logger=require(_0xa768('0x6'))('rpc');var config=require(_0xa768('0x7'));var jayson=require(_0xa768('0x8'));var client=jayson[_0xa768('0x9')][_0xa768('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x148ab4,_0x3c1679,_0x2bcd66){return new BPromise(function(_0x39095a,_0x4ff0d5){return client[_0xa768('0xb')](_0x148ab4,_0x2bcd66)[_0xa768('0xc')](function(_0x31523e){logger['info']('ContactItemType,\x20%s,\x20%s',_0x3c1679,_0xa768('0xd'));logger[_0xa768('0xe')](_0xa768('0xf'),_0x3c1679,_0xa768('0xd'),JSON[_0xa768('0x10')](_0x31523e));if(_0x31523e[_0xa768('0x11')]){if(_0x31523e['error'][_0xa768('0x12')]===0x1f4){logger['error'](_0xa768('0x13'),_0x3c1679,_0x31523e['error'][_0xa768('0x14')]);return _0x4ff0d5(_0x31523e[_0xa768('0x11')]['message']);}logger[_0xa768('0x11')]('ContactItemType,\x20%s,\x20%s',_0x3c1679,_0x31523e['error'][_0xa768('0x14')]);return _0x39095a(_0x31523e['error']['message']);}else{logger[_0xa768('0x15')](_0xa768('0x13'),_0x3c1679,'request\x20sent');_0x39095a(_0x31523e[_0xa768('0x16')][_0xa768('0x14')]);}})[_0xa768('0x17')](function(_0x4f87e7){logger[_0xa768('0x11')](_0xa768('0x13'),_0x3c1679,_0x4f87e7);_0x4ff0d5(_0x4f87e7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 27c5ed7..17b6bff 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbed3=['show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x21b771,_0x4bbdaa){var _0x485e47=function(_0x4a1149){while(--_0x4a1149){_0x21b771['push'](_0x21b771['shift']());}};_0x485e47(++_0x4bbdaa);}(_0xbed3,0x1a4));var _0x3bed=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbed3[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x3bed('0x0'));var util=require(_0x3bed('0x1'));var path=require(_0x3bed('0x2'));var timeout=require(_0x3bed('0x3'));var express=require(_0x3bed('0x4'));var router=express[_0x3bed('0x5')]();var fs_extra=require(_0x3bed('0x6'));var auth=require(_0x3bed('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3bed('0x8'));var controller=require('./contactItemType.controller');router[_0x3bed('0x9')]('/',auth[_0x3bed('0xa')](),controller['index']);router[_0x3bed('0x9')](_0x3bed('0xb'),auth[_0x3bed('0xa')](),controller[_0x3bed('0xc')]);router['post']('/',auth[_0x3bed('0xa')](),controller[_0x3bed('0xd')]);router[_0x3bed('0xe')](_0x3bed('0xb'),auth[_0x3bed('0xa')](),controller[_0x3bed('0xf')]);router['delete'](_0x3bed('0xb'),auth[_0x3bed('0xa')](),controller[_0x3bed('0x10')]);module[_0x3bed('0x11')]=router; \ No newline at end of file +var _0xfe25=['show','create','put','destroy','multer','util','path','../../config/environment','get','/:id','isAuthenticated'];(function(_0x51e2f4,_0x1acff9){var _0x39ece2=function(_0x3709f0){while(--_0x3709f0){_0x51e2f4['push'](_0x51e2f4['shift']());}};_0x39ece2(++_0x1acff9);}(_0xfe25,0xbf));var _0x5fe2=function(_0x16343e,_0x33dc3e){_0x16343e=_0x16343e-0x0;var _0x29036b=_0xfe25[_0x16343e];return _0x29036b;};'use strict';var multer=require(_0x5fe2('0x0'));var util=require(_0x5fe2('0x1'));var path=require(_0x5fe2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fe2('0x3'));var controller=require('./contactItemType.controller');router[_0x5fe2('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fe2('0x4')](_0x5fe2('0x5'),auth[_0x5fe2('0x6')](),controller[_0x5fe2('0x7')]);router['post']('/',auth[_0x5fe2('0x6')](),controller[_0x5fe2('0x8')]);router[_0x5fe2('0x9')](_0x5fe2('0x5'),auth[_0x5fe2('0x6')](),controller['update']);router['delete'](_0x5fe2('0x5'),auth[_0x5fe2('0x6')](),controller[_0x5fe2('0xa')]);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 4d27891..017bb34 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 _0xbaf0=['name','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5d8d48b..fa3b1c2 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 _0x3842=['findOne','pick','getItems','hasOwnProperty','nolimit','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','find','catch','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3842,0x101));var _0x2384=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3842[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2384('0x0'));var jsonpatch=require(_0x2384('0x1'));var rp=require(_0x2384('0x2'));var moment=require(_0x2384('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2384('0x4'));var util=require(_0x2384('0x5'));var path=require(_0x2384('0x6'));var sox=require(_0x2384('0x7'));var csv=require(_0x2384('0x8'));var ejs=require(_0x2384('0x9'));var fs=require('fs');var fs_extra=require(_0x2384('0xa'));var _=require(_0x2384('0xb'));var squel=require(_0x2384('0xc'));var crypto=require(_0x2384('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2384('0x8'));var querystring=require('querystring');var Papa=require(_0x2384('0xe'));var Redis=require(_0x2384('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2384('0x10'));var as=require(_0x2384('0x11'));var hardwareService=require(_0x2384('0x12'));var logger=require(_0x2384('0x13'))('api');var utils=require(_0x2384('0x14'));var config=require(_0x2384('0x15'));var licenseUtil=require(_0x2384('0x16'));var db=require('../../mysqldb')['db'];config[_0x2384('0x17')]=_['defaults'](config['redis'],{'host':_0x2384('0x18'),'port':0x18eb});var socket=require(_0x2384('0x19'))(new Redis(config[_0x2384('0x17')]));require('./dashboard.socket')[_0x2384('0x1a')](socket);function respondWithStatusCode(_0x30da2b,_0x210f11){_0x210f11=_0x210f11||0xcc;return function(_0x12b42b){if(_0x12b42b){return _0x30da2b[_0x2384('0x1b')](_0x210f11);}return _0x30da2b[_0x2384('0x1c')](_0x210f11)[_0x2384('0x1d')]();};}function respondWithResult(_0x115111,_0x3996eb){_0x3996eb=_0x3996eb||0xc8;return function(_0x3cac9d){if(_0x3cac9d){return _0x115111['status'](_0x3996eb)['json'](_0x3cac9d);}};}function respondWithFilteredResult(_0x17af81,_0xd5e447){return function(_0x15a48c){if(_0x15a48c){var _0x9a904c=typeof _0xd5e447[_0x2384('0x1e')]==='undefined'&&typeof _0xd5e447[_0x2384('0x1f')]===_0x2384('0x20');var _0x5c69cd=_0x15a48c[_0x2384('0x21')];var _0x3615fc=_0x9a904c?0x0:_0xd5e447[_0x2384('0x1e')];var _0x28763e=_0x9a904c?_0x15a48c[_0x2384('0x21')]:_0xd5e447[_0x2384('0x1e')]+_0xd5e447[_0x2384('0x1f')];var _0x2a9d8f;if(_0x28763e>=_0x5c69cd){_0x28763e=_0x5c69cd;_0x2a9d8f=0xc8;}else{_0x2a9d8f=0xce;}_0x17af81[_0x2384('0x1c')](_0x2a9d8f);return _0x17af81[_0x2384('0x22')](_0x2384('0x23'),_0x3615fc+'-'+_0x28763e+'/'+_0x5c69cd)[_0x2384('0x24')](_0x15a48c);}return null;};}function patchUpdates(_0x1e6b4b){return function(_0xe8f8ce){try{jsonpatch['apply'](_0xe8f8ce,_0x1e6b4b,!![]);}catch(_0x74ca74){return BPromise[_0x2384('0x25')](_0x74ca74);}return _0xe8f8ce['save']();};}function saveUpdates(_0xe26ece,_0x22d063){return function(_0x4e930a){if(_0x4e930a){return _0x4e930a[_0x2384('0x26')](_0xe26ece)[_0x2384('0x27')](function(_0x13ae01){return _0x13ae01;});}return null;};}function removeEntity(_0x2047bf,_0x80ebd2){return function(_0x2c7eed){if(_0x2c7eed){return _0x2c7eed[_0x2384('0x28')]()['then'](function(){var _0x4cc788=_0x2c7eed[_0x2384('0x29')]({'plain':!![]});var _0xfb80c=_0x2384('0x2a');return db[_0x2384('0x2b')][_0x2384('0x28')]({'where':{'type':_0xfb80c,'resourceId':_0x4cc788['id']}})[_0x2384('0x27')](function(){return _0x2c7eed;});})[_0x2384('0x27')](function(){_0x2047bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c557a,_0x4e9501){return function(_0x3a6c07){if(!_0x3a6c07){_0x5c557a[_0x2384('0x1b')](0x194);}return _0x3a6c07;};}function handleError(_0x33f405,_0x1b1768){_0x1b1768=_0x1b1768||0x1f4;return function(_0x473b91){logger[_0x2384('0x2c')](_0x473b91[_0x2384('0x2d')]);if(_0x473b91[_0x2384('0x2e')]){delete _0x473b91['name'];}_0x33f405[_0x2384('0x1c')](_0x1b1768)[_0x2384('0x2f')](_0x473b91);};}exports[_0x2384('0x30')]=function(_0x4f1b41,_0x4d1332){var _0x3fee17={},_0x3013e7={},_0x1137d8={'count':0x0,'rows':[]};var _0x5e20b6=_[_0x2384('0x31')](db[_0x2384('0x32')][_0x2384('0x33')],function(_0x4f0ea2){return{'name':_0x4f0ea2[_0x2384('0x34')],'type':_0x4f0ea2[_0x2384('0x35')][_0x2384('0x36')]};});_0x3013e7['model']=_['map'](_0x5e20b6,_0x2384('0x2e'));_0x3013e7[_0x2384('0x37')]=_[_0x2384('0x38')](_0x4f1b41[_0x2384('0x37')]);_0x3013e7[_0x2384('0x39')]=_[_0x2384('0x3a')](_0x3013e7[_0x2384('0x3b')],_0x3013e7['query']);_0x3fee17[_0x2384('0x3c')]=_[_0x2384('0x3a')](_0x3013e7[_0x2384('0x3b')],qs['fields'](_0x4f1b41[_0x2384('0x37')][_0x2384('0x3d')]));_0x3fee17['attributes']=_0x3fee17[_0x2384('0x3c')][_0x2384('0x3e')]?_0x3fee17[_0x2384('0x3c')]:_0x3013e7['model'];if(!_0x4f1b41['query']['hasOwnProperty']('nolimit')){_0x3fee17['limit']=qs['limit'](_0x4f1b41[_0x2384('0x37')]['limit']);_0x3fee17[_0x2384('0x1e')]=qs[_0x2384('0x1e')](_0x4f1b41[_0x2384('0x37')][_0x2384('0x1e')]);}_0x3fee17[_0x2384('0x3f')]=qs[_0x2384('0x40')](_0x4f1b41['query'][_0x2384('0x40')]);_0x3fee17[_0x2384('0x41')]=qs['filters'](_['pick'](_0x4f1b41['query'],_0x3013e7['filters']),_0x5e20b6);if(_0x4f1b41[_0x2384('0x37')][_0x2384('0x42')]){_0x3fee17[_0x2384('0x41')]=_[_0x2384('0x43')](_0x3fee17[_0x2384('0x41')],{'$or':_[_0x2384('0x31')](_0x5e20b6,function(_0x5ae243){if(_0x5ae243[_0x2384('0x35')]!=='VIRTUAL'){var _0x38eff9={};_0x38eff9[_0x5ae243[_0x2384('0x2e')]]={'$like':'%'+_0x4f1b41[_0x2384('0x37')][_0x2384('0x42')]+'%'};return _0x38eff9;}})});}_0x3fee17=_[_0x2384('0x43')]({},_0x3fee17,_0x4f1b41['options']);var _0x159a1c={'where':_0x3fee17[_0x2384('0x41')]};return db[_0x2384('0x32')][_0x2384('0x21')](_0x159a1c)[_0x2384('0x27')](function(_0x48d66d){_0x1137d8[_0x2384('0x21')]=_0x48d66d;if(_0x4f1b41['query'][_0x2384('0x44')]){_0x3fee17[_0x2384('0x45')]=[{'all':!![]}];}return db[_0x2384('0x32')][_0x2384('0x46')](_0x3fee17);})[_0x2384('0x27')](function(_0x110a44){_0x1137d8[_0x2384('0x47')]=_0x110a44;return _0x1137d8;})[_0x2384('0x27')](respondWithFilteredResult(_0x4d1332,_0x3fee17))['catch'](handleError(_0x4d1332,null));};exports[_0x2384('0x48')]=function(_0x483b25,_0x3c142d){var _0x580849={'raw':![],'where':{'id':_0x483b25['params']['id']}},_0x49dc8f={};_0x49dc8f[_0x2384('0x3b')]=_[_0x2384('0x38')](db[_0x2384('0x32')][_0x2384('0x33')]);_0x49dc8f[_0x2384('0x37')]=_[_0x2384('0x38')](_0x483b25['query']);_0x49dc8f[_0x2384('0x39')]=_[_0x2384('0x3a')](_0x49dc8f[_0x2384('0x3b')],_0x49dc8f[_0x2384('0x37')]);_0x580849['attributes']=_[_0x2384('0x3a')](_0x49dc8f['model'],qs[_0x2384('0x3d')](_0x483b25[_0x2384('0x37')]['fields']));_0x580849[_0x2384('0x3c')]=_0x580849['attributes'][_0x2384('0x3e')]?_0x580849[_0x2384('0x3c')]:_0x49dc8f[_0x2384('0x3b')];if(_0x483b25['query']['includeAll']){_0x580849['include']=[{'all':!![]}];}_0x580849=_[_0x2384('0x43')]({},_0x580849,_0x483b25['options']);return db[_0x2384('0x32')][_0x2384('0x49')](_0x580849)[_0x2384('0x27')](handleEntityNotFound(_0x3c142d,null))[_0x2384('0x27')](respondWithResult(_0x3c142d,null))[_0x2384('0x4a')](handleError(_0x3c142d,null));};exports['create']=function(_0x4497b7,_0x17a11f){return db[_0x2384('0x32')][_0x2384('0x4b')](_0x4497b7[_0x2384('0x4c')],{})[_0x2384('0x27')](function(_0x433506){var _0x1aa78d=_0x4497b7[_0x2384('0x4d')][_0x2384('0x29')]({'plain':!![]});if(!_0x1aa78d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aa78d['role']===_0x2384('0x4d')){var _0xa1cd64=_0x433506[_0x2384('0x29')]({'plain':!![]});var _0x44248f='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x44248f,'userProfileId':_0x1aa78d[_0x2384('0x4e')]},'raw':!![]})[_0x2384('0x27')](function(_0x50205e){if(_0x50205e&&_0x50205e['autoAssociation']===0x0){return db[_0x2384('0x2b')]['create']({'name':_0xa1cd64[_0x2384('0x2e')],'resourceId':_0xa1cd64['id'],'type':_0x50205e[_0x2384('0x2e')],'sectionId':_0x50205e['id']},{})[_0x2384('0x27')](function(){return _0x433506;});}else{return _0x433506;}})['catch'](function(_0x526911){logger[_0x2384('0x2c')](_0x2384('0x4f'),_0x526911);throw _0x526911;});}return _0x433506;})[_0x2384('0x27')](respondWithResult(_0x17a11f,0xc9))[_0x2384('0x4a')](handleError(_0x17a11f,null));};exports['clone']=function(_0x4fdd66,_0xcbd05a){var _0x4169c7={'where':{'id':_0x4fdd66[_0x2384('0x50')]['id']}},_0x4d9361={};_0x4d9361[_0x2384('0x3b')]=_[_0x2384('0x38')](db[_0x2384('0x32')][_0x2384('0x33')]);_0x4169c7[_0x2384('0x3c')]=_[_0x2384('0x3a')](_0x4d9361['model'],qs[_0x2384('0x3d')](_0x4fdd66[_0x2384('0x37')][_0x2384('0x3d')]));_0x4169c7[_0x2384('0x3c')]=_0x4169c7[_0x2384('0x3c')][_0x2384('0x3e')]?_0x4169c7[_0x2384('0x3c')]:_0x4d9361[_0x2384('0x3b')];if(_0x4fdd66[_0x2384('0x37')][_0x2384('0x44')]){_0x4169c7[_0x2384('0x45')]=[{'all':!![]}];}_0x4169c7=_[_0x2384('0x43')]({},_0x4169c7,_0x4fdd66[_0x2384('0x51')]);return db[_0x2384('0x32')][_0x2384('0x49')](_0x4169c7)[_0x2384('0x27')](handleEntityNotFound(_0xcbd05a,null))['then'](function(_0x715739){if(_0x715739){var _0x5bb2dc=_0x715739[_0x2384('0x29')]({'plain':!![]});_0x5bb2dc=qs[_0x2384('0x52')](_0x5bb2dc,['id',_0x2384('0x53'),_0x2384('0x54')]);_0x4fdd66['body']=_[_0x2384('0x52')](_0x4fdd66[_0x2384('0x4c')],['id',_0x2384('0x53'),_0x2384('0x54')]);return db[_0x2384('0x32')][_0x2384('0x4b')](_[_0x2384('0x43')](_0x5bb2dc,_0x4fdd66['body']),{'include':_0x4fdd66[_0x2384('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x2384('0x27')](function(_0x29eb46){var _0x1084b8=_0x4fdd66[_0x2384('0x4d')][_0x2384('0x29')]({'plain':!![]});if(!_0x1084b8)throw new Error(_0x2384('0x55'));if(_0x1084b8[_0x2384('0x56')]===_0x2384('0x4d')){var _0x2c630b=_0x29eb46['get']({'plain':!![]});var _0x4469ec=_0x2384('0x2a');return db[_0x2384('0x57')][_0x2384('0x49')]({'where':{'name':_0x4469ec,'userProfileId':_0x1084b8[_0x2384('0x4e')]},'raw':!![]})[_0x2384('0x27')](function(_0x40956c){if(_0x40956c&&_0x40956c[_0x2384('0x58')]===0x0){return db[_0x2384('0x2b')]['create']({'name':_0x2c630b[_0x2384('0x2e')],'resourceId':_0x2c630b['id'],'type':_0x40956c[_0x2384('0x2e')],'sectionId':_0x40956c['id']},{})[_0x2384('0x27')](function(){return _0x29eb46;});}else{return _0x29eb46;}})['catch'](function(_0x3f7c73){logger['error'](_0x2384('0x4f'),_0x3f7c73);throw _0x3f7c73;});}return _0x29eb46;});}})[_0x2384('0x27')](respondWithResult(_0xcbd05a,0xc9))[_0x2384('0x4a')](handleError(_0xcbd05a,null));};exports[_0x2384('0x26')]=function(_0x3c941b,_0x4da6d3){if(_0x3c941b[_0x2384('0x4c')]['id']){delete _0x3c941b[_0x2384('0x4c')]['id'];}return db['Dashboard'][_0x2384('0x49')]({'where':{'id':_0x3c941b[_0x2384('0x50')]['id']}})[_0x2384('0x27')](handleEntityNotFound(_0x4da6d3,null))[_0x2384('0x27')](saveUpdates(_0x3c941b[_0x2384('0x4c')],null))[_0x2384('0x27')](respondWithResult(_0x4da6d3,null))[_0x2384('0x4a')](handleError(_0x4da6d3,null));};exports[_0x2384('0x28')]=function(_0x4fd232,_0x124e79){return db[_0x2384('0x32')][_0x2384('0x49')]({'where':{'id':_0x4fd232[_0x2384('0x50')]['id']}})[_0x2384('0x27')](handleEntityNotFound(_0x124e79,null))[_0x2384('0x27')](removeEntity(_0x124e79,null))[_0x2384('0x4a')](handleError(_0x124e79,null));};function widgetAttributes(_0x496b07){try{switch(_0x496b07[_0x2384('0x35')]){case'iframe':return[{'name':'attrUrl','value':_0x496b07['attrUrl']||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0][_0x2384('0x5a')]:undefined)||_0x2384('0x5b')}];case'custom':return[{'name':_0x2384('0x5c'),'value':_0x496b07['attrPath']||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0][_0x2384('0x5a')]:undefined)||''}];case'clock':return[{'name':_0x2384('0x5d'),'value':_0x496b07[_0x2384('0x5d')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0][_0x2384('0x5a')]:undefined)||_0x2384('0x5e')},{'name':_0x2384('0x5f'),'value':_0x496b07[_0x2384('0x5f')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x1]?_0x496b07['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0x2384('0x60'),'value':_0x496b07[_0x2384('0x60')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x2]?_0x496b07[_0x2384('0x59')][0x2]['value']:undefined)||0xc}];case _0x2384('0x61'):return[{'name':_0x2384('0x62'),'value':_0x496b07[_0x2384('0x62')]||(_0x496b07['attrs']&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07['attrs'][0x0][_0x2384('0x5a')]:undefined)||_0x2384('0x63')},{'name':_0x2384('0x64'),'value':_0x496b07['attrVoiceQueues']||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x1]?_0x496b07[_0x2384('0x59')][0x1][_0x2384('0x5a')]:undefined)||[]},{'name':'attrFontSize','value':_0x496b07[_0x2384('0x60')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x2]?_0x496b07[_0x2384('0x59')][0x2][_0x2384('0x5a')]:undefined)||0x14},{'name':_0x2384('0x65'),'value':_0x496b07[_0x2384('0x65')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x3]?_0x496b07[_0x2384('0x59')][0x3]['value']:undefined)||_0x2384('0x66')},{'name':_0x2384('0x67'),'value':_0x496b07[_0x2384('0x67')]||(_0x496b07['attrs']&&_0x496b07[_0x2384('0x59')][0x4]?_0x496b07['attrs'][0x4][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x68'),'value':_0x496b07[_0x2384('0x68')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x5]?_0x496b07[_0x2384('0x59')][0x5][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x69'),'value':_0x496b07[_0x2384('0x69')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x6]?_0x496b07['attrs'][0x6][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x6a'),'value':_0x496b07[_0x2384('0x6a')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07['attrs'][0x7]?_0x496b07[_0x2384('0x59')][0x7]['value']:undefined)||''},{'name':_0x2384('0x6b'),'value':_0x496b07['attrWhatsappAccounts']||(_0x496b07[_0x2384('0x59')]&&_0x496b07['attrs'][0x8]?_0x496b07[_0x2384('0x59')][0x8][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x6c'),'value':_0x496b07[_0x2384('0x6c')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x9]?_0x496b07[_0x2384('0x59')][0x9][_0x2384('0x5a')]:undefined)||''}];case _0x2384('0x6d'):case _0x2384('0x6e'):return[{'name':_0x2384('0x6f'),'value':_0x496b07[_0x2384('0x6f')]||(_0x496b07['attrs']&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0][_0x2384('0x5a')]:undefined)||_0x2384('0x63')},{'name':'attrSerie2','value':_0x496b07['attrSerie2']||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x1]?_0x496b07['attrs'][0x1][_0x2384('0x5a')]:undefined)||null},{'name':_0x2384('0x70'),'value':_0x496b07[_0x2384('0x70')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x2]?_0x496b07[_0x2384('0x59')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x496b07[_0x2384('0x64')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x3]?_0x496b07[_0x2384('0x59')][0x3][_0x2384('0x5a')]:undefined)||[]},{'name':'attrChannel','value':_0x496b07['attrChannel']||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x4]?_0x496b07[_0x2384('0x59')][0x4][_0x2384('0x5a')]:undefined)||_0x2384('0x66')},{'name':_0x2384('0x67'),'value':_0x496b07[_0x2384('0x67')]||(_0x496b07['attrs']&&_0x496b07['attrs'][0x5]?_0x496b07[_0x2384('0x59')][0x5]['value']:undefined)||''},{'name':_0x2384('0x68'),'value':_0x496b07[_0x2384('0x68')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x6]?_0x496b07['attrs'][0x6][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x69'),'value':_0x496b07['attrSmsAccounts']||(_0x496b07[_0x2384('0x59')]&&_0x496b07['attrs'][0x7]?_0x496b07[_0x2384('0x59')][0x7][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x6a'),'value':_0x496b07['attrOpenchannelAccounts']||(_0x496b07['attrs']&&_0x496b07['attrs'][0x8]?_0x496b07['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x496b07[_0x2384('0x6b')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x9]?_0x496b07[_0x2384('0x59')][0x9][_0x2384('0x5a')]:undefined)||''},{'name':_0x2384('0x6c'),'value':_0x496b07[_0x2384('0x6c')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0xa]?_0x496b07[_0x2384('0x59')][0xa][_0x2384('0x5a')]:undefined)||''}];case _0x2384('0x71'):return[{'name':_0x2384('0x72'),'type':_0x496b07[_0x2384('0x73')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0][_0x2384('0x35')]:undefined)||null,'value':_0x496b07[_0x2384('0x72')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x0]?_0x496b07[_0x2384('0x59')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x496b07[_0x2384('0x74')]||(_0x496b07[_0x2384('0x59')]&&_0x496b07[_0x2384('0x59')][0x1]?_0x496b07[_0x2384('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4705a6){logger[_0x2384('0x2c')](_0x2384('0x75'),JSON[_0x2384('0x76')](_0x4705a6));return[];}}exports[_0x2384('0x77')]=function(_0x21c566,_0x3c743e,_0x33c1e6){if(_0x21c566[_0x2384('0x4c')]['id']){delete _0x21c566[_0x2384('0x4c')]['id'];}return db[_0x2384('0x32')][_0x2384('0x49')]({'where':{'id':_0x21c566[_0x2384('0x50')]['id']}})[_0x2384('0x27')](handleEntityNotFound(_0x3c743e,null))[_0x2384('0x27')](function(_0x5a15ce){if(_0x5a15ce){_0x21c566[_0x2384('0x4c')]['DashboardId']=_0x5a15ce['id'];_0x21c566[_0x2384('0x4c')]['attrs']=widgetAttributes(_0x21c566[_0x2384('0x4c')]);return db[_0x2384('0x78')][_0x2384('0x4b')](_0x21c566[_0x2384('0x4c')]);}})['then'](respondWithResult(_0x3c743e,null))[_0x2384('0x4a')](handleError(_0x3c743e,null));};exports['getItems']=function(_0x1dd670,_0x426162,_0x140a15){var _0x11dc87={};var _0x2eefb3={};var _0x2e0645;var _0x5ddbb2;return db[_0x2384('0x32')][_0x2384('0x79')]({'where':{'id':_0x1dd670[_0x2384('0x50')]['id']}})[_0x2384('0x27')](handleEntityNotFound(_0x426162,null))[_0x2384('0x27')](function(_0x55be29){if(_0x55be29){_0x2e0645=_0x55be29;_0x2eefb3[_0x2384('0x3b')]=_['keys'](db[_0x2384('0x78')][_0x2384('0x33')]);_0x2eefb3['query']=_[_0x2384('0x38')](_0x1dd670[_0x2384('0x37')]);_0x2eefb3[_0x2384('0x39')]=_[_0x2384('0x3a')](_0x2eefb3[_0x2384('0x3b')],_0x2eefb3[_0x2384('0x37')]);_0x11dc87['attributes']=_['intersection'](_0x2eefb3[_0x2384('0x3b')],qs['fields'](_0x1dd670[_0x2384('0x37')][_0x2384('0x3d')]));_0x11dc87['attributes']=_0x11dc87[_0x2384('0x3c')]['length']?_0x11dc87['attributes']:_0x2eefb3['model'];_0x11dc87[_0x2384('0x3f')]=qs[_0x2384('0x40')](_0x1dd670[_0x2384('0x37')][_0x2384('0x40')]);_0x11dc87[_0x2384('0x41')]=qs[_0x2384('0x39')](_[_0x2384('0x7a')](_0x1dd670[_0x2384('0x37')],_0x2eefb3['filters']));if(_0x1dd670[_0x2384('0x37')][_0x2384('0x42')]){_0x11dc87[_0x2384('0x41')]=_['merge'](_0x11dc87[_0x2384('0x41')],{'$or':_['map'](_0x11dc87[_0x2384('0x3c')],function(_0x4aa410){var _0x165eba={};_0x165eba[_0x4aa410]={'$like':'%'+_0x1dd670[_0x2384('0x37')]['filter']+'%'};return _0x165eba;})});}_0x11dc87=_[_0x2384('0x43')]({},_0x11dc87,_0x1dd670['options']);return _0x2e0645[_0x2384('0x7b')](_0x11dc87);}})['then'](function(_0x4907fc){if(_0x4907fc){_0x5ddbb2=_0x4907fc['length'];if(!_0x1dd670[_0x2384('0x37')][_0x2384('0x7c')](_0x2384('0x7d'))){_0x11dc87[_0x2384('0x1f')]=qs[_0x2384('0x1f')](_0x1dd670[_0x2384('0x37')][_0x2384('0x1f')]);_0x11dc87['offset']=qs[_0x2384('0x1e')](_0x1dd670[_0x2384('0x37')]['offset']);}return _0x2e0645[_0x2384('0x7b')](_0x11dc87);}})[_0x2384('0x27')](function(_0x80eaaa){if(_0x80eaaa){return _0x80eaaa?{'count':_0x5ddbb2,'rows':_0x80eaaa}:null;}})[_0x2384('0x27')](respondWithResult(_0x426162,null))[_0x2384('0x4a')](handleError(_0x426162,null));}; \ No newline at end of file +var _0xe7f2=['reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','destroy','then','get','UserProfileResource','error','name','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','Dashboard','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport'];(function(_0x2f67f3,_0x40986f){var _0x2b6fc1=function(_0x3e9bcf){while(--_0x3e9bcf){_0x2f67f3['push'](_0x2f67f3['shift']());}};_0x2b6fc1(++_0x40986f);}(_0xe7f2,0x10d));var _0x2e7f=function(_0x2ecf9d,_0x4953f6){_0x2ecf9d=_0x2ecf9d-0x0;var _0x126e08=_0xe7f2[_0x2ecf9d];return _0x126e08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e7f('0x0'));var zipdir=require(_0x2e7f('0x1'));var jsonpatch=require(_0x2e7f('0x2'));var rp=require(_0x2e7f('0x3'));var moment=require(_0x2e7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2e7f('0x5'));var util=require(_0x2e7f('0x6'));var path=require(_0x2e7f('0x7'));var sox=require(_0x2e7f('0x8'));var csv=require(_0x2e7f('0x9'));var ejs=require(_0x2e7f('0xa'));var fs=require('fs');var fs_extra=require(_0x2e7f('0xb'));var _=require('lodash');var squel=require(_0x2e7f('0xc'));var crypto=require(_0x2e7f('0xd'));var jsforce=require(_0x2e7f('0xe'));var deskjs=require(_0x2e7f('0xf'));var toCsv=require(_0x2e7f('0x9'));var querystring=require(_0x2e7f('0x10'));var Papa=require('papaparse');var Redis=require(_0x2e7f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e7f('0x12'));var hardwareService=require(_0x2e7f('0x13'));var logger=require(_0x2e7f('0x14'))('api');var utils=require(_0x2e7f('0x15'));var config=require(_0x2e7f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e7f('0x17'))['db'];config[_0x2e7f('0x18')]=_[_0x2e7f('0x19')](config[_0x2e7f('0x18')],{'host':_0x2e7f('0x1a'),'port':0x18eb});var socket=require(_0x2e7f('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')[_0x2e7f('0x1c')](socket);function respondWithStatusCode(_0x5e1ad6,_0x356392){_0x356392=_0x356392||0xcc;return function(_0x202328){if(_0x202328){return _0x5e1ad6[_0x2e7f('0x1d')](_0x356392);}return _0x5e1ad6[_0x2e7f('0x1e')](_0x356392)[_0x2e7f('0x1f')]();};}function respondWithResult(_0x5838ba,_0x4df648){_0x4df648=_0x4df648||0xc8;return function(_0x495344){if(_0x495344){return _0x5838ba['status'](_0x4df648)['json'](_0x495344);}};}function respondWithFilteredResult(_0x4d4adc,_0x2b4f64){return function(_0x2dd387){if(_0x2dd387){var _0x14e0e6=typeof _0x2b4f64[_0x2e7f('0x20')]===_0x2e7f('0x21')&&typeof _0x2b4f64[_0x2e7f('0x22')]===_0x2e7f('0x21');var _0x4fc670=_0x2dd387[_0x2e7f('0x23')];var _0x416631=_0x14e0e6?0x0:_0x2b4f64[_0x2e7f('0x20')];var _0x5ceef0=_0x14e0e6?_0x2dd387['count']:_0x2b4f64['offset']+_0x2b4f64['limit'];var _0x1d2cd4;if(_0x5ceef0>=_0x4fc670){_0x5ceef0=_0x4fc670;_0x1d2cd4=0xc8;}else{_0x1d2cd4=0xce;}_0x4d4adc[_0x2e7f('0x1e')](_0x1d2cd4);return _0x4d4adc[_0x2e7f('0x24')]('Content-Range',_0x416631+'-'+_0x5ceef0+'/'+_0x4fc670)[_0x2e7f('0x25')](_0x2dd387);}return null;};}function patchUpdates(_0x1f0321){return function(_0xf961fa){try{jsonpatch['apply'](_0xf961fa,_0x1f0321,!![]);}catch(_0x3cb2dd){return BPromise['reject'](_0x3cb2dd);}return _0xf961fa[_0x2e7f('0x26')]();};}function saveUpdates(_0x59a09a,_0x339841){return function(_0x1e46c0){if(_0x1e46c0){return _0x1e46c0['update'](_0x59a09a)['then'](function(_0x5f345d){return _0x5f345d;});}return null;};}function removeEntity(_0x44e4de,_0x1b1bd0){return function(_0x59d358){if(_0x59d358){return _0x59d358[_0x2e7f('0x27')]()[_0x2e7f('0x28')](function(){var _0x256883=_0x59d358[_0x2e7f('0x29')]({'plain':!![]});var _0x210bcc='CustomDashboards';return db[_0x2e7f('0x2a')][_0x2e7f('0x27')]({'where':{'type':_0x210bcc,'resourceId':_0x256883['id']}})['then'](function(){return _0x59d358;});})[_0x2e7f('0x28')](function(){_0x44e4de[_0x2e7f('0x1e')](0xcc)[_0x2e7f('0x1f')]();});}};}function handleEntityNotFound(_0x58a53f,_0xf3569c){return function(_0x32fcdb){if(!_0x32fcdb){_0x58a53f[_0x2e7f('0x1d')](0x194);}return _0x32fcdb;};}function handleError(_0x4a3f91,_0x1132fc){_0x1132fc=_0x1132fc||0x1f4;return function(_0x5b420b){logger[_0x2e7f('0x2b')](_0x5b420b['stack']);if(_0x5b420b[_0x2e7f('0x2c')]){delete _0x5b420b[_0x2e7f('0x2c')];}_0x4a3f91['status'](_0x1132fc)['send'](_0x5b420b);};}exports[_0x2e7f('0x2d')]=function(_0x511389,_0x963d80){var _0x11a298={},_0x31b86c={},_0x51cb6c={'count':0x0,'rows':[]};var _0x341b4a=_[_0x2e7f('0x2e')](db['Dashboard']['rawAttributes'],function(_0x55f4be){return{'name':_0x55f4be[_0x2e7f('0x2f')],'type':_0x55f4be[_0x2e7f('0x30')][_0x2e7f('0x31')]};});_0x31b86c['model']=_[_0x2e7f('0x2e')](_0x341b4a,_0x2e7f('0x2c'));_0x31b86c[_0x2e7f('0x32')]=_[_0x2e7f('0x33')](_0x511389['query']);_0x31b86c['filters']=_[_0x2e7f('0x34')](_0x31b86c[_0x2e7f('0x35')],_0x31b86c[_0x2e7f('0x32')]);_0x11a298[_0x2e7f('0x36')]=_[_0x2e7f('0x34')](_0x31b86c[_0x2e7f('0x35')],qs[_0x2e7f('0x37')](_0x511389['query'][_0x2e7f('0x37')]));_0x11a298['attributes']=_0x11a298[_0x2e7f('0x36')][_0x2e7f('0x38')]?_0x11a298[_0x2e7f('0x36')]:_0x31b86c[_0x2e7f('0x35')];if(!_0x511389['query'][_0x2e7f('0x39')](_0x2e7f('0x3a'))){_0x11a298[_0x2e7f('0x22')]=qs[_0x2e7f('0x22')](_0x511389['query'][_0x2e7f('0x22')]);_0x11a298['offset']=qs['offset'](_0x511389[_0x2e7f('0x32')]['offset']);}_0x11a298['order']=qs[_0x2e7f('0x3b')](_0x511389[_0x2e7f('0x32')][_0x2e7f('0x3b')]);_0x11a298[_0x2e7f('0x3c')]=qs[_0x2e7f('0x3d')](_[_0x2e7f('0x3e')](_0x511389[_0x2e7f('0x32')],_0x31b86c['filters']),_0x341b4a);if(_0x511389[_0x2e7f('0x32')][_0x2e7f('0x3f')]){_0x11a298[_0x2e7f('0x3c')]=_[_0x2e7f('0x40')](_0x11a298['where'],{'$or':_[_0x2e7f('0x2e')](_0x341b4a,function(_0x5eccf1){if(_0x5eccf1[_0x2e7f('0x30')]!=='VIRTUAL'){var _0x1e4aa6={};_0x1e4aa6[_0x5eccf1[_0x2e7f('0x2c')]]={'$like':'%'+_0x511389[_0x2e7f('0x32')][_0x2e7f('0x3f')]+'%'};return _0x1e4aa6;}})});}_0x11a298=_['merge']({},_0x11a298,_0x511389['options']);var _0x36a7c8={'where':_0x11a298[_0x2e7f('0x3c')]};return db[_0x2e7f('0x41')][_0x2e7f('0x23')](_0x36a7c8)[_0x2e7f('0x28')](function(_0x53a926){_0x51cb6c[_0x2e7f('0x23')]=_0x53a926;if(_0x511389['query'][_0x2e7f('0x42')]){_0x11a298['include']=[{'all':!![]}];}return db[_0x2e7f('0x41')][_0x2e7f('0x43')](_0x11a298);})['then'](function(_0x4a689a){_0x51cb6c[_0x2e7f('0x44')]=_0x4a689a;return _0x51cb6c;})['then'](respondWithFilteredResult(_0x963d80,_0x11a298))[_0x2e7f('0x45')](handleError(_0x963d80,null));};exports[_0x2e7f('0x46')]=function(_0x2b8e7d,_0x5f5aa8){var _0x36eef8={'raw':![],'where':{'id':_0x2b8e7d[_0x2e7f('0x47')]['id']}},_0x39ac80={};_0x39ac80['model']=_[_0x2e7f('0x33')](db[_0x2e7f('0x41')][_0x2e7f('0x48')]);_0x39ac80[_0x2e7f('0x32')]=_[_0x2e7f('0x33')](_0x2b8e7d['query']);_0x39ac80['filters']=_[_0x2e7f('0x34')](_0x39ac80[_0x2e7f('0x35')],_0x39ac80['query']);_0x36eef8[_0x2e7f('0x36')]=_[_0x2e7f('0x34')](_0x39ac80[_0x2e7f('0x35')],qs[_0x2e7f('0x37')](_0x2b8e7d[_0x2e7f('0x32')]['fields']));_0x36eef8['attributes']=_0x36eef8['attributes'][_0x2e7f('0x38')]?_0x36eef8[_0x2e7f('0x36')]:_0x39ac80['model'];if(_0x2b8e7d[_0x2e7f('0x32')][_0x2e7f('0x42')]){_0x36eef8[_0x2e7f('0x49')]=[{'all':!![]}];}_0x36eef8=_[_0x2e7f('0x40')]({},_0x36eef8,_0x2b8e7d[_0x2e7f('0x4a')]);return db[_0x2e7f('0x41')]['find'](_0x36eef8)[_0x2e7f('0x28')](handleEntityNotFound(_0x5f5aa8,null))['then'](respondWithResult(_0x5f5aa8,null))[_0x2e7f('0x45')](handleError(_0x5f5aa8,null));};exports[_0x2e7f('0x4b')]=function(_0x5b3207,_0x158950){return db[_0x2e7f('0x41')][_0x2e7f('0x4b')](_0x5b3207[_0x2e7f('0x4c')],{})[_0x2e7f('0x28')](function(_0x27595c){var _0x27f075=_0x5b3207[_0x2e7f('0x4d')]['get']({'plain':!![]});if(!_0x27f075)throw new Error(_0x2e7f('0x4e'));if(_0x27f075[_0x2e7f('0x4f')]===_0x2e7f('0x4d')){var _0x2f7c02=_0x27595c[_0x2e7f('0x29')]({'plain':!![]});var _0x234a3d=_0x2e7f('0x50');return db[_0x2e7f('0x51')]['find']({'where':{'name':_0x234a3d,'userProfileId':_0x27f075[_0x2e7f('0x52')]},'raw':!![]})['then'](function(_0x514dd7){if(_0x514dd7&&_0x514dd7[_0x2e7f('0x53')]===0x0){return db['UserProfileResource'][_0x2e7f('0x4b')]({'name':_0x2f7c02['name'],'resourceId':_0x2f7c02['id'],'type':_0x514dd7[_0x2e7f('0x2c')],'sectionId':_0x514dd7['id']},{})[_0x2e7f('0x28')](function(){return _0x27595c;});}else{return _0x27595c;}})[_0x2e7f('0x45')](function(_0x25bb87){logger[_0x2e7f('0x2b')](_0x2e7f('0x54'),_0x25bb87);throw _0x25bb87;});}return _0x27595c;})[_0x2e7f('0x28')](respondWithResult(_0x158950,0xc9))['catch'](handleError(_0x158950,null));};exports[_0x2e7f('0x55')]=function(_0x346f64,_0x2dd101){var _0x334405={'where':{'id':_0x346f64['params']['id']}},_0x1396a2={};_0x1396a2[_0x2e7f('0x35')]=_['keys'](db[_0x2e7f('0x41')][_0x2e7f('0x48')]);_0x334405[_0x2e7f('0x36')]=_[_0x2e7f('0x34')](_0x1396a2['model'],qs[_0x2e7f('0x37')](_0x346f64[_0x2e7f('0x32')][_0x2e7f('0x37')]));_0x334405[_0x2e7f('0x36')]=_0x334405['attributes'][_0x2e7f('0x38')]?_0x334405[_0x2e7f('0x36')]:_0x1396a2[_0x2e7f('0x35')];if(_0x346f64[_0x2e7f('0x32')][_0x2e7f('0x42')]){_0x334405[_0x2e7f('0x49')]=[{'all':!![]}];}_0x334405=_[_0x2e7f('0x40')]({},_0x334405,_0x346f64['options']);return db[_0x2e7f('0x41')][_0x2e7f('0x56')](_0x334405)['then'](handleEntityNotFound(_0x2dd101,null))['then'](function(_0x2b0bd1){if(_0x2b0bd1){var _0x1b34e6=_0x2b0bd1[_0x2e7f('0x29')]({'plain':!![]});_0x1b34e6=qs[_0x2e7f('0x57')](_0x1b34e6,['id',_0x2e7f('0x58'),'updatedAt']);_0x346f64[_0x2e7f('0x4c')]=_[_0x2e7f('0x57')](_0x346f64['body'],['id',_0x2e7f('0x58'),_0x2e7f('0x59')]);return db[_0x2e7f('0x41')][_0x2e7f('0x4b')](_[_0x2e7f('0x40')](_0x1b34e6,_0x346f64[_0x2e7f('0x4c')]),{'include':_0x346f64['query'][_0x2e7f('0x42')]?[{'all':!![]}]:undefined})[_0x2e7f('0x28')](function(_0x3820ab){var _0x40feea=_0x346f64['user'][_0x2e7f('0x29')]({'plain':!![]});if(!_0x40feea)throw new Error(_0x2e7f('0x4e'));if(_0x40feea[_0x2e7f('0x4f')]===_0x2e7f('0x4d')){var _0x370993=_0x3820ab[_0x2e7f('0x29')]({'plain':!![]});var _0x5bce48=_0x2e7f('0x50');return db[_0x2e7f('0x51')][_0x2e7f('0x56')]({'where':{'name':_0x5bce48,'userProfileId':_0x40feea[_0x2e7f('0x52')]},'raw':!![]})[_0x2e7f('0x28')](function(_0x2839f3){if(_0x2839f3&&_0x2839f3[_0x2e7f('0x53')]===0x0){return db[_0x2e7f('0x2a')][_0x2e7f('0x4b')]({'name':_0x370993[_0x2e7f('0x2c')],'resourceId':_0x370993['id'],'type':_0x2839f3[_0x2e7f('0x2c')],'sectionId':_0x2839f3['id']},{})[_0x2e7f('0x28')](function(){return _0x3820ab;});}else{return _0x3820ab;}})[_0x2e7f('0x45')](function(_0x2b9442){logger[_0x2e7f('0x2b')](_0x2e7f('0x54'),_0x2b9442);throw _0x2b9442;});}return _0x3820ab;});}})[_0x2e7f('0x28')](respondWithResult(_0x2dd101,0xc9))[_0x2e7f('0x45')](handleError(_0x2dd101,null));};exports[_0x2e7f('0x5a')]=function(_0x10d3a5,_0x1478f4){if(_0x10d3a5['body']['id']){delete _0x10d3a5['body']['id'];}return db[_0x2e7f('0x41')][_0x2e7f('0x56')]({'where':{'id':_0x10d3a5[_0x2e7f('0x47')]['id']}})[_0x2e7f('0x28')](handleEntityNotFound(_0x1478f4,null))[_0x2e7f('0x28')](saveUpdates(_0x10d3a5[_0x2e7f('0x4c')],null))[_0x2e7f('0x28')](respondWithResult(_0x1478f4,null))[_0x2e7f('0x45')](handleError(_0x1478f4,null));};exports[_0x2e7f('0x27')]=function(_0x4190e1,_0x167d62){return db['Dashboard'][_0x2e7f('0x56')]({'where':{'id':_0x4190e1['params']['id']}})[_0x2e7f('0x28')](handleEntityNotFound(_0x167d62,null))[_0x2e7f('0x28')](removeEntity(_0x167d62,null))[_0x2e7f('0x45')](handleError(_0x167d62,null));};function widgetAttributes(_0x4b2205){try{switch(_0x4b2205['type']){case _0x2e7f('0x5b'):return[{'name':_0x2e7f('0x5c'),'value':_0x4b2205[_0x2e7f('0x5c')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205['attrs'][0x0]['value']:undefined)||'https://'}];case _0x2e7f('0x5e'):return[{'name':_0x2e7f('0x5f'),'value':_0x4b2205[_0x2e7f('0x5f')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205['attrs'][0x0][_0x2e7f('0x60')]:undefined)||''}];case _0x2e7f('0x61'):return[{'name':_0x2e7f('0x62'),'value':_0x4b2205[_0x2e7f('0x62')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205['attrs'][0x0]['value']:undefined)||_0x2e7f('0x63')},{'name':_0x2e7f('0x64'),'value':_0x4b2205[_0x2e7f('0x64')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x1]?_0x4b2205[_0x2e7f('0x5d')][0x1][_0x2e7f('0x60')]:undefined)||_0x2e7f('0x65')},{'name':'attrFontSize','value':_0x4b2205['attrFontSize']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x2]?_0x4b2205[_0x2e7f('0x5d')][0x2][_0x2e7f('0x60')]:undefined)||0xc}];case _0x2e7f('0x66'):return[{'name':_0x2e7f('0x67'),'value':_0x4b2205['attrMetric']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205['attrs'][0x0]?_0x4b2205[_0x2e7f('0x5d')][0x0][_0x2e7f('0x60')]:undefined)||'total'},{'name':_0x2e7f('0x68'),'value':_0x4b2205[_0x2e7f('0x68')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x1]?_0x4b2205[_0x2e7f('0x5d')][0x1][_0x2e7f('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x4b2205['attrFontSize']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x2]?_0x4b2205[_0x2e7f('0x5d')][0x2][_0x2e7f('0x60')]:undefined)||0x14},{'name':_0x2e7f('0x69'),'value':_0x4b2205[_0x2e7f('0x69')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205['attrs'][0x3]?_0x4b2205[_0x2e7f('0x5d')][0x3][_0x2e7f('0x60')]:undefined)||_0x2e7f('0x6a')},{'name':_0x2e7f('0x6b'),'value':_0x4b2205[_0x2e7f('0x6b')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x4]?_0x4b2205[_0x2e7f('0x5d')][0x4]['value']:undefined)||''},{'name':_0x2e7f('0x6c'),'value':_0x4b2205[_0x2e7f('0x6c')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x5]?_0x4b2205[_0x2e7f('0x5d')][0x5][_0x2e7f('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4b2205[_0x2e7f('0x6d')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x6]?_0x4b2205['attrs'][0x6][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x6e'),'value':_0x4b2205[_0x2e7f('0x6e')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205['attrs'][0x7]?_0x4b2205['attrs'][0x7]['value']:undefined)||''},{'name':_0x2e7f('0x6f'),'value':_0x4b2205['attrWhatsappAccounts']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x8]?_0x4b2205[_0x2e7f('0x5d')][0x8][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x70'),'value':_0x4b2205['attrChatWebsites']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x9]?_0x4b2205[_0x2e7f('0x5d')][0x9][_0x2e7f('0x60')]:undefined)||''}];case _0x2e7f('0x71'):case _0x2e7f('0x72'):return[{'name':_0x2e7f('0x73'),'value':_0x4b2205['attrSerie1']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205[_0x2e7f('0x5d')][0x0][_0x2e7f('0x60')]:undefined)||_0x2e7f('0x74')},{'name':_0x2e7f('0x75'),'value':_0x4b2205[_0x2e7f('0x75')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x1]?_0x4b2205[_0x2e7f('0x5d')][0x1][_0x2e7f('0x60')]:undefined)||null},{'name':_0x2e7f('0x76'),'value':_0x4b2205[_0x2e7f('0x76')]||(_0x4b2205['attrs']&&_0x4b2205[_0x2e7f('0x5d')][0x2]?_0x4b2205['attrs'][0x2]['value']:undefined)||null},{'name':_0x2e7f('0x68'),'value':_0x4b2205[_0x2e7f('0x68')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x3]?_0x4b2205[_0x2e7f('0x5d')][0x3][_0x2e7f('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x4b2205[_0x2e7f('0x69')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x4]?_0x4b2205['attrs'][0x4]['value']:undefined)||_0x2e7f('0x6a')},{'name':_0x2e7f('0x6b'),'value':_0x4b2205[_0x2e7f('0x6b')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x5]?_0x4b2205[_0x2e7f('0x5d')][0x5][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x6c'),'value':_0x4b2205[_0x2e7f('0x6c')]||(_0x4b2205['attrs']&&_0x4b2205[_0x2e7f('0x5d')][0x6]?_0x4b2205['attrs'][0x6][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x6d'),'value':_0x4b2205['attrSmsAccounts']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x7]?_0x4b2205['attrs'][0x7][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x6e'),'value':_0x4b2205[_0x2e7f('0x6e')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x8]?_0x4b2205[_0x2e7f('0x5d')][0x8][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x6f'),'value':_0x4b2205[_0x2e7f('0x6f')]||(_0x4b2205['attrs']&&_0x4b2205[_0x2e7f('0x5d')][0x9]?_0x4b2205[_0x2e7f('0x5d')][0x9][_0x2e7f('0x60')]:undefined)||''},{'name':_0x2e7f('0x70'),'value':_0x4b2205[_0x2e7f('0x70')]||(_0x4b2205['attrs']&&_0x4b2205[_0x2e7f('0x5d')][0xa]?_0x4b2205[_0x2e7f('0x5d')][0xa][_0x2e7f('0x60')]:undefined)||''}];case _0x2e7f('0x77'):return[{'name':_0x2e7f('0x78'),'type':_0x4b2205[_0x2e7f('0x79')]||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205[_0x2e7f('0x5d')][0x0][_0x2e7f('0x30')]:undefined)||null,'value':_0x4b2205['attrReport']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x0]?_0x4b2205[_0x2e7f('0x5d')][0x0]['value']:undefined)||null},{'name':_0x2e7f('0x7a'),'value':_0x4b2205['attrRefresh']||(_0x4b2205[_0x2e7f('0x5d')]&&_0x4b2205[_0x2e7f('0x5d')][0x1]?_0x4b2205[_0x2e7f('0x5d')][0x1][_0x2e7f('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x329adf){logger[_0x2e7f('0x2b')]('widgetAttributes:\x20%s',JSON[_0x2e7f('0x7b')](_0x329adf));return[];}}exports[_0x2e7f('0x7c')]=function(_0x2050a6,_0x36763c,_0x3e7d8f){if(_0x2050a6['body']['id']){delete _0x2050a6[_0x2e7f('0x4c')]['id'];}return db['Dashboard'][_0x2e7f('0x56')]({'where':{'id':_0x2050a6[_0x2e7f('0x47')]['id']}})[_0x2e7f('0x28')](handleEntityNotFound(_0x36763c,null))[_0x2e7f('0x28')](function(_0x2529f4){if(_0x2529f4){_0x2050a6['body'][_0x2e7f('0x7d')]=_0x2529f4['id'];_0x2050a6[_0x2e7f('0x4c')]['attrs']=widgetAttributes(_0x2050a6[_0x2e7f('0x4c')]);return db[_0x2e7f('0x7e')][_0x2e7f('0x4b')](_0x2050a6['body']);}})[_0x2e7f('0x28')](respondWithResult(_0x36763c,null))[_0x2e7f('0x45')](handleError(_0x36763c,null));};exports[_0x2e7f('0x7f')]=function(_0x1beb27,_0x295a12,_0x39401d){var _0x1c3f29={};var _0x22f3a0={};var _0x1ce102;var _0x1a4ef0;return db[_0x2e7f('0x41')][_0x2e7f('0x80')]({'where':{'id':_0x1beb27[_0x2e7f('0x47')]['id']}})[_0x2e7f('0x28')](handleEntityNotFound(_0x295a12,null))[_0x2e7f('0x28')](function(_0x1d4f41){if(_0x1d4f41){_0x1ce102=_0x1d4f41;_0x22f3a0[_0x2e7f('0x35')]=_[_0x2e7f('0x33')](db['DashboardItem'][_0x2e7f('0x48')]);_0x22f3a0[_0x2e7f('0x32')]=_[_0x2e7f('0x33')](_0x1beb27[_0x2e7f('0x32')]);_0x22f3a0['filters']=_['intersection'](_0x22f3a0['model'],_0x22f3a0[_0x2e7f('0x32')]);_0x1c3f29[_0x2e7f('0x36')]=_[_0x2e7f('0x34')](_0x22f3a0[_0x2e7f('0x35')],qs[_0x2e7f('0x37')](_0x1beb27[_0x2e7f('0x32')][_0x2e7f('0x37')]));_0x1c3f29[_0x2e7f('0x36')]=_0x1c3f29[_0x2e7f('0x36')]['length']?_0x1c3f29[_0x2e7f('0x36')]:_0x22f3a0['model'];_0x1c3f29[_0x2e7f('0x81')]=qs['sort'](_0x1beb27[_0x2e7f('0x32')][_0x2e7f('0x3b')]);_0x1c3f29['where']=qs['filters'](_[_0x2e7f('0x3e')](_0x1beb27[_0x2e7f('0x32')],_0x22f3a0[_0x2e7f('0x3d')]));if(_0x1beb27[_0x2e7f('0x32')][_0x2e7f('0x3f')]){_0x1c3f29[_0x2e7f('0x3c')]=_[_0x2e7f('0x40')](_0x1c3f29['where'],{'$or':_[_0x2e7f('0x2e')](_0x1c3f29['attributes'],function(_0x2a2fbd){var _0x5d2537={};_0x5d2537[_0x2a2fbd]={'$like':'%'+_0x1beb27[_0x2e7f('0x32')]['filter']+'%'};return _0x5d2537;})});}_0x1c3f29=_[_0x2e7f('0x40')]({},_0x1c3f29,_0x1beb27[_0x2e7f('0x4a')]);return _0x1ce102[_0x2e7f('0x7f')](_0x1c3f29);}})['then'](function(_0x5e6715){if(_0x5e6715){_0x1a4ef0=_0x5e6715[_0x2e7f('0x38')];if(!_0x1beb27['query'][_0x2e7f('0x39')](_0x2e7f('0x3a'))){_0x1c3f29[_0x2e7f('0x22')]=qs['limit'](_0x1beb27[_0x2e7f('0x32')][_0x2e7f('0x22')]);_0x1c3f29[_0x2e7f('0x20')]=qs['offset'](_0x1beb27[_0x2e7f('0x32')]['offset']);}return _0x1ce102[_0x2e7f('0x7f')](_0x1c3f29);}})['then'](function(_0x5e4abb){if(_0x5e4abb){return _0x5e4abb?{'count':_0x1a4ef0,'rows':_0x5e4abb}:null;}})[_0x2e7f('0x28')](respondWithResult(_0x295a12,null))[_0x2e7f('0x45')](handleError(_0x295a12,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1a9f8c2..1b3539e 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 _0x5958=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x4523c7,_0x17ff23){var _0x2eab67=function(_0xcf75b3){while(--_0xcf75b3){_0x4523c7['push'](_0x4523c7['shift']());}};_0x2eab67(++_0x17ff23);}(_0x5958,0x14e));var _0x8595=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x5958[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require(_0x8595('0x0'));var Dashboard=require(_0x8595('0x1'))['db'][_0x8595('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8595('0x3')](0x0);var events={'afterCreate':_0x8595('0x4'),'afterUpdate':_0x8595('0x5'),'afterDestroy':_0x8595('0x6')};function emitEvent(_0x4c99c6){return function(_0x34907c,_0x26d540,_0x55cafd){DashboardEvents[_0x8595('0x7')](_0x4c99c6+':'+_0x34907c['id'],_0x34907c);DashboardEvents[_0x8595('0x7')](_0x4c99c6,_0x34907c);_0x55cafd(null);};}for(var e in events){if(events[_0x8595('0x8')](e)){var event=events[e];Dashboard[_0x8595('0x9')](e,emitEvent(event));}}module[_0x8595('0xa')]=DashboardEvents; \ No newline at end of file +var _0xde36=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2d69f3,_0x3e6500){var _0x22fa14=function(_0x4ead27){while(--_0x4ead27){_0x2d69f3['push'](_0x2d69f3['shift']());}};_0x22fa14(++_0x3e6500);}(_0xde36,0x1a5));var _0x6de3=function(_0x5889c4,_0x2cb921){_0x5889c4=_0x5889c4-0x0;var _0x18cbb8=_0xde36[_0x5889c4];return _0x18cbb8;};'use strict';var EventEmitter=require(_0x6de3('0x0'));var Dashboard=require(_0x6de3('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6de3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6de3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4de47d){return function(_0x3a8eb9,_0x15a010,_0x5731c9){DashboardEvents[_0x6de3('0x4')](_0x4de47d+':'+_0x3a8eb9['id'],_0x3a8eb9);DashboardEvents[_0x6de3('0x4')](_0x4de47d,_0x3a8eb9);_0x5731c9(null);};}for(var e in events){if(events[_0x6de3('0x5')](e)){var event=events[e];Dashboard[_0x6de3('0x6')](e,emitEvent(event));}}module[_0x6de3('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 55219d6..92d33ee 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 _0x7835=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./dashboard.attributes','exports','define'];(function(_0x161e8d,_0x460081){var _0x332bbc=function(_0x3d6a19){while(--_0x3d6a19){_0x161e8d['push'](_0x161e8d['shift']());}};_0x332bbc(++_0x460081);}(_0x7835,0xec));var _0x5783=function(_0x59779a,_0x1b6355){_0x59779a=_0x59779a-0x0;var _0x40e8b4=_0x7835[_0x59779a];return _0x40e8b4;};'use strict';var _=require(_0x5783('0x0'));var util=require(_0x5783('0x1'));var logger=require(_0x5783('0x2'))(_0x5783('0x3'));var moment=require(_0x5783('0x4'));var BPromise=require('bluebird');var rp=require(_0x5783('0x5'));var fs=require('fs');var path=require(_0x5783('0x6'));var rimraf=require(_0x5783('0x7'));var config=require('../../config/environment');var attributes=require(_0x5783('0x8'));module[_0x5783('0x9')]=function(_0x491f31,_0x405da0){return _0x491f31[_0x5783('0xa')](_0x5783('0xb'),attributes,{'tableName':_0x5783('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6c7=['request-promise','rimraf','../../config/environment','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird'];(function(_0x446ad0,_0x29f51e){var _0x4a3478=function(_0x2d15c8){while(--_0x2d15c8){_0x446ad0['push'](_0x446ad0['shift']());}};_0x4a3478(++_0x29f51e);}(_0xe6c7,0x159));var _0x7e6c=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xe6c7[_0x48b810];return _0x23c17d;};'use strict';var _=require('lodash');var util=require(_0x7e6c('0x0'));var logger=require(_0x7e6c('0x1'))(_0x7e6c('0x2'));var moment=require(_0x7e6c('0x3'));var BPromise=require(_0x7e6c('0x4'));var rp=require(_0x7e6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6c('0x6'));var config=require(_0x7e6c('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x550d80,_0x268982){return _0x550d80['define'](_0x7e6c('0x8'),attributes,{'tableName':_0x7e6c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ca42b86..ea427cb 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 _0xb2bf=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x591f83,_0xbeec15){var _0x104cb7=function(_0x18420c){while(--_0x18420c){_0x591f83['push'](_0x591f83['shift']());}};_0x104cb7(++_0xbeec15);}(_0xb2bf,0xb5));var _0xfb2b=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xb2bf[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0xfb2b('0x0'));var util=require(_0xfb2b('0x1'));var moment=require(_0xfb2b('0x2'));var BPromise=require(_0xfb2b('0x3'));var rs=require(_0xfb2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb2b('0x6'))(_0xfb2b('0x7'));var config=require(_0xfb2b('0x8'));var jayson=require(_0xfb2b('0x9'));var client=jayson[_0xfb2b('0xa')]['http']({'port':0x232a});config[_0xfb2b('0xb')]=_['defaults'](config[_0xfb2b('0xb')],{'host':_0xfb2b('0xc'),'port':0x18eb});var socket=require(_0xfb2b('0xd'))(new Redis(config[_0xfb2b('0xb')]));require(_0xfb2b('0xe'))['register'](socket);function respondWithRpcPromise(_0x126ff0,_0x3484b5,_0x573ca1){return new BPromise(function(_0x33a4ee,_0x3bc3bc){return client[_0xfb2b('0xf')](_0x126ff0,_0x573ca1)[_0xfb2b('0x10')](function(_0x274da0){logger[_0xfb2b('0x11')](_0xfb2b('0x12'),_0x3484b5,_0xfb2b('0x13'));logger[_0xfb2b('0x14')](_0xfb2b('0x15'),_0x3484b5,_0xfb2b('0x13'),JSON[_0xfb2b('0x16')](_0x274da0));if(_0x274da0[_0xfb2b('0x17')]){if(_0x274da0['error'][_0xfb2b('0x18')]===0x1f4){logger[_0xfb2b('0x17')](_0xfb2b('0x12'),_0x3484b5,_0x274da0[_0xfb2b('0x17')]['message']);return _0x3bc3bc(_0x274da0[_0xfb2b('0x17')][_0xfb2b('0x19')]);}logger[_0xfb2b('0x17')]('Dashboard,\x20%s,\x20%s',_0x3484b5,_0x274da0['error'][_0xfb2b('0x19')]);return _0x33a4ee(_0x274da0[_0xfb2b('0x17')]['message']);}else{logger[_0xfb2b('0x11')](_0xfb2b('0x12'),_0x3484b5,_0xfb2b('0x13'));_0x33a4ee(_0x274da0[_0xfb2b('0x1a')]['message']);}})[_0xfb2b('0x1b')](function(_0x13f174){logger[_0xfb2b('0x17')](_0xfb2b('0x12'),_0x3484b5,_0x13f174);_0x3bc3bc(_0x13f174);});});} \ No newline at end of file +var _0x5f4f=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3ecfbd,_0x3ba03f){var _0x21d01c=function(_0xb48535){while(--_0xb48535){_0x3ecfbd['push'](_0x3ecfbd['shift']());}};_0x21d01c(++_0x3ba03f);}(_0x5f4f,0x125));var _0xf5f4=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x5f4f[_0x3d5351];return _0x1db4db;};'use strict';var _=require(_0xf5f4('0x0'));var util=require(_0xf5f4('0x1'));var moment=require(_0xf5f4('0x2'));var BPromise=require(_0xf5f4('0x3'));var rs=require(_0xf5f4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf5f4('0x5'));var logger=require(_0xf5f4('0x6'))(_0xf5f4('0x7'));var config=require(_0xf5f4('0x8'));var jayson=require(_0xf5f4('0x9'));var client=jayson[_0xf5f4('0xa')][_0xf5f4('0xb')]({'port':0x232a});config[_0xf5f4('0xc')]=_[_0xf5f4('0xd')](config[_0xf5f4('0xc')],{'host':_0xf5f4('0xe'),'port':0x18eb});var socket=require(_0xf5f4('0xf'))(new Redis(config['redis']));require(_0xf5f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x22793a,_0x278f2f,_0x1bb62b){return new BPromise(function(_0x168153,_0x1e9ff6){return client[_0xf5f4('0x11')](_0x22793a,_0x1bb62b)[_0xf5f4('0x12')](function(_0x87dd66){logger[_0xf5f4('0x13')](_0xf5f4('0x14'),_0x278f2f,_0xf5f4('0x15'));logger[_0xf5f4('0x16')](_0xf5f4('0x17'),_0x278f2f,_0xf5f4('0x15'),JSON['stringify'](_0x87dd66));if(_0x87dd66['error']){if(_0x87dd66[_0xf5f4('0x18')][_0xf5f4('0x19')]===0x1f4){logger[_0xf5f4('0x18')](_0xf5f4('0x14'),_0x278f2f,_0x87dd66['error']['message']);return _0x1e9ff6(_0x87dd66['error'][_0xf5f4('0x1a')]);}logger[_0xf5f4('0x18')](_0xf5f4('0x14'),_0x278f2f,_0x87dd66[_0xf5f4('0x18')][_0xf5f4('0x1a')]);return _0x168153(_0x87dd66[_0xf5f4('0x18')][_0xf5f4('0x1a')]);}else{logger[_0xf5f4('0x13')]('Dashboard,\x20%s,\x20%s',_0x278f2f,_0xf5f4('0x15'));_0x168153(_0x87dd66[_0xf5f4('0x1b')][_0xf5f4('0x1a')]);}})[_0xf5f4('0x1c')](function(_0x1f28ca){logger[_0xf5f4('0x18')](_0xf5f4('0x14'),_0x278f2f,_0x1f28ca);_0x1e9ff6(_0x1f28ca);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 848c319..6d6e137 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 _0x3aea=['save','remove','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x3ef7e4,_0x1e13a6){var _0x54299d=function(_0x499869){while(--_0x499869){_0x3ef7e4['push'](_0x3ef7e4['shift']());}};_0x54299d(++_0x1e13a6);}(_0x3aea,0x109));var _0xa3ae=function(_0x2d58ef,_0x26f7b1){_0x2d58ef=_0x2d58ef-0x0;var _0x3091e5=_0x3aea[_0x2d58ef];return _0x3091e5;};'use strict';var DashboardEvents=require(_0xa3ae('0x0'));var events=[_0xa3ae('0x1'),_0xa3ae('0x2'),'update'];function createListener(_0x3098f0,_0x4b7910){return function(_0x4d03c7){_0x4b7910['emit'](_0x3098f0,_0x4d03c7);};}function removeListener(_0x415365,_0x446783){return function(){DashboardEvents[_0xa3ae('0x3')](_0x415365,_0x446783);};}exports[_0xa3ae('0x4')]=function(_0x1966f0){for(var _0x330009=0x0,_0x3f032d=events[_0xa3ae('0x5')];_0x330009<_0x3f032d;_0x330009++){var _0x86ba3=events[_0x330009];var _0x54a3c6=createListener(_0xa3ae('0x6')+_0x86ba3,_0x1966f0);DashboardEvents['on'](_0x86ba3,_0x54a3c6);}}; \ No newline at end of file +var _0xc7fe=['save','remove','removeListener','register','length','dashboard:'];(function(_0x1d4c74,_0x3657c6){var _0x477a02=function(_0x4f8e43){while(--_0x4f8e43){_0x1d4c74['push'](_0x1d4c74['shift']());}};_0x477a02(++_0x3657c6);}(_0xc7fe,0x1b6));var _0xec7f=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xc7fe[_0x5c3ae9];return _0x3f5950;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xec7f('0x0'),_0xec7f('0x1'),'update'];function createListener(_0x4bc1fc,_0x59be54){return function(_0x34cfc4){_0x59be54['emit'](_0x4bc1fc,_0x34cfc4);};}function removeListener(_0xee7a99,_0xc5ecb4){return function(){DashboardEvents[_0xec7f('0x2')](_0xee7a99,_0xc5ecb4);};}exports[_0xec7f('0x3')]=function(_0x16e863){for(var _0x526743=0x0,_0x3ffa26=events[_0xec7f('0x4')];_0x526743<_0x3ffa26;_0x526743++){var _0x449735=events[_0x526743];var _0x3dc354=createListener(_0xec7f('0x5')+_0x449735,_0x16e863);DashboardEvents['on'](_0x449735,_0x3dc354);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2792419..d9af2d4 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 _0xe75f=['addItem','put','update','delete','exports','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x2442a1,_0x59355c){var _0x40f7ad=function(_0x279ff5){while(--_0x279ff5){_0x2442a1['push'](_0x2442a1['shift']());}};_0x40f7ad(++_0x59355c);}(_0xe75f,0x64));var _0xfe75=function(_0xf9fa33,_0xed0f87){_0xf9fa33=_0xf9fa33-0x0;var _0x4d3e56=_0xe75f[_0xf9fa33];return _0x4d3e56;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfe75('0x0'));var router=express[_0xfe75('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe75('0x2'));var config=require(_0xfe75('0x3'));var controller=require('./dashboard.controller');router[_0xfe75('0x4')]('/',auth[_0xfe75('0x5')](),controller[_0xfe75('0x6')]);router['get'](_0xfe75('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xfe75('0x4')](_0xfe75('0x8'),auth[_0xfe75('0x5')](),controller[_0xfe75('0x9')]);router[_0xfe75('0xa')]('/',auth[_0xfe75('0x5')](),controller[_0xfe75('0xb')]);router[_0xfe75('0xa')](_0xfe75('0xc'),auth['isAuthenticated'](),controller[_0xfe75('0xd')]);router[_0xfe75('0xa')](_0xfe75('0x8'),auth[_0xfe75('0x5')](),controller[_0xfe75('0xe')]);router[_0xfe75('0xf')](_0xfe75('0x7'),auth['isAuthenticated'](),controller[_0xfe75('0x10')]);router[_0xfe75('0x11')](_0xfe75('0x7'),auth[_0xfe75('0x5')](),controller['destroy']);module[_0xfe75('0x12')]=router; \ No newline at end of file +var _0xdb51=['../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','get','/:id','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13e24e,_0x2aaae5){var _0x35ac3d=function(_0x3ab55d){while(--_0x3ab55d){_0x13e24e['push'](_0x13e24e['shift']());}};_0x35ac3d(++_0x2aaae5);}(_0xdb51,0x191));var _0x1db5=function(_0x3a25e8,_0x84dc5c){_0x3a25e8=_0x3a25e8-0x0;var _0x55b8f3=_0xdb51[_0x3a25e8];return _0x55b8f3;};'use strict';var multer=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var path=require(_0x1db5('0x2'));var timeout=require(_0x1db5('0x3'));var express=require(_0x1db5('0x4'));var router=express[_0x1db5('0x5')]();var fs_extra=require(_0x1db5('0x6'));var auth=require(_0x1db5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1db5('0x8'));var controller=require(_0x1db5('0x9'));router['get']('/',auth[_0x1db5('0xa')](),controller['index']);router[_0x1db5('0xb')](_0x1db5('0xc'),auth[_0x1db5('0xa')](),controller['show']);router[_0x1db5('0xb')](_0x1db5('0xd'),auth[_0x1db5('0xa')](),controller[_0x1db5('0xe')]);router[_0x1db5('0xf')]('/',auth[_0x1db5('0xa')](),controller[_0x1db5('0x10')]);router[_0x1db5('0xf')](_0x1db5('0x11'),auth[_0x1db5('0xa')](),controller['clone']);router['post']('/:id/items',auth[_0x1db5('0xa')](),controller[_0x1db5('0x12')]);router[_0x1db5('0x13')](_0x1db5('0xc'),auth['isAuthenticated'](),controller[_0x1db5('0x14')]);router[_0x1db5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1db5('0x16')]);module[_0x1db5('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a09e2e3..2d652ca 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 _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x11500b,_0x8c789a){var _0x57a4e0=function(_0x2ef44e){while(--_0x2ef44e){_0x11500b['push'](_0x11500b['shift']());}};_0x57a4e0(++_0x8c789a);}(_0xeff8,0x186));var _0x8eff=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xeff8[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x1637ba,_0x29ad25){var _0x761eb6=function(_0x2caa3e){while(--_0x2caa3e){_0x1637ba['push'](_0x1637ba['shift']());}};_0x761eb6(++_0x29ad25);}(_0xeda8,0x104));var _0x8eda=function(_0x176f75,_0x4fdffb){_0x176f75=_0x176f75-0x0;var _0x2e9f75=_0xeda8[_0x176f75];return _0x2e9f75;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 674aa6b..e76abf1 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 _0xb5f3=['attrVoiceQueues','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','DashboardItem','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb5f3,0x137));var _0x3b5f=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xb5f3[_0x10f68e];return _0x4c8372;};'use strict';var emlformat=require(_0x3b5f('0x0'));var rimraf=require(_0x3b5f('0x1'));var zipdir=require(_0x3b5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b5f('0x3'));var moment=require(_0x3b5f('0x4'));var BPromise=require(_0x3b5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b5f('0x6'));var sox=require(_0x3b5f('0x7'));var csv=require(_0x3b5f('0x8'));var ejs=require(_0x3b5f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b5f('0xa'));var squel=require(_0x3b5f('0xb'));var crypto=require('crypto');var jsforce=require(_0x3b5f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3b5f('0x8'));var querystring=require(_0x3b5f('0xd'));var Papa=require(_0x3b5f('0xe'));var Redis=require(_0x3b5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3b5f('0x10'));var as=require(_0x3b5f('0x11'));var hardwareService=require(_0x3b5f('0x12'));var logger=require(_0x3b5f('0x13'))(_0x3b5f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b5f('0x15'))['db'];config[_0x3b5f('0x16')]=_[_0x3b5f('0x17')](config[_0x3b5f('0x16')],{'host':_0x3b5f('0x18'),'port':0x18eb});var socket=require(_0x3b5f('0x19'))(new Redis(config[_0x3b5f('0x16')]));require(_0x3b5f('0x1a'))['register'](socket);function respondWithStatusCode(_0x3d960d,_0x2c4277){_0x2c4277=_0x2c4277||0xcc;return function(_0x2009a8){if(_0x2009a8){return _0x3d960d['sendStatus'](_0x2c4277);}return _0x3d960d[_0x3b5f('0x1b')](_0x2c4277)['end']();};}function respondWithResult(_0x5df2e7,_0x2c6aaa){_0x2c6aaa=_0x2c6aaa||0xc8;return function(_0x53fc3f){if(_0x53fc3f){return _0x5df2e7[_0x3b5f('0x1b')](_0x2c6aaa)[_0x3b5f('0x1c')](_0x53fc3f);}};}function respondWithFilteredResult(_0xa9a9eb,_0x15c66c){return function(_0x5ed046){if(_0x5ed046){var _0x2db25f=typeof _0x15c66c['offset']===_0x3b5f('0x1d')&&typeof _0x15c66c[_0x3b5f('0x1e')]===_0x3b5f('0x1d');var _0x5711ff=_0x5ed046['count'];var _0x2f84de=_0x2db25f?0x0:_0x15c66c[_0x3b5f('0x1f')];var _0x30bfe7=_0x2db25f?_0x5ed046[_0x3b5f('0x20')]:_0x15c66c['offset']+_0x15c66c[_0x3b5f('0x1e')];var _0xfcc090;if(_0x30bfe7>=_0x5711ff){_0x30bfe7=_0x5711ff;_0xfcc090=0xc8;}else{_0xfcc090=0xce;}_0xa9a9eb[_0x3b5f('0x1b')](_0xfcc090);return _0xa9a9eb[_0x3b5f('0x21')](_0x3b5f('0x22'),_0x2f84de+'-'+_0x30bfe7+'/'+_0x5711ff)[_0x3b5f('0x1c')](_0x5ed046);}return null;};}function patchUpdates(_0x56a1d0){return function(_0x5e6d68){try{jsonpatch[_0x3b5f('0x23')](_0x5e6d68,_0x56a1d0,!![]);}catch(_0x1e1df6){return BPromise[_0x3b5f('0x24')](_0x1e1df6);}return _0x5e6d68[_0x3b5f('0x25')]();};}function saveUpdates(_0x469b92,_0x2309ce){return function(_0xd50bf){if(_0xd50bf){return _0xd50bf[_0x3b5f('0x26')](_0x469b92)[_0x3b5f('0x27')](function(_0x3267b8){return _0x3267b8;});}return null;};}function removeEntity(_0x52be62,_0x55fb32){return function(_0x15e63e){if(_0x15e63e){return _0x15e63e[_0x3b5f('0x28')]()[_0x3b5f('0x27')](function(){_0x52be62[_0x3b5f('0x1b')](0xcc)[_0x3b5f('0x29')]();});}};}function handleEntityNotFound(_0x5302f9,_0x13a54a){return function(_0x2d5ba1){if(!_0x2d5ba1){_0x5302f9[_0x3b5f('0x2a')](0x194);}return _0x2d5ba1;};}function handleError(_0x3cf7c3,_0x58321f){_0x58321f=_0x58321f||0x1f4;return function(_0x4f023c){logger[_0x3b5f('0x2b')](_0x4f023c[_0x3b5f('0x2c')]);if(_0x4f023c[_0x3b5f('0x2d')]){delete _0x4f023c['name'];}_0x3cf7c3['status'](_0x58321f)[_0x3b5f('0x2e')](_0x4f023c);};}exports[_0x3b5f('0x2f')]=function(_0x5f171d,_0xbb62dc){var _0x562f95={'raw':![],'where':{'id':_0x5f171d[_0x3b5f('0x30')]['id']}},_0xa10ddb={};_0xa10ddb['model']=_['keys'](db[_0x3b5f('0x31')][_0x3b5f('0x32')]);_0xa10ddb[_0x3b5f('0x33')]=_[_0x3b5f('0x34')](_0x5f171d[_0x3b5f('0x33')]);_0xa10ddb[_0x3b5f('0x35')]=_[_0x3b5f('0x36')](_0xa10ddb[_0x3b5f('0x37')],_0xa10ddb['query']);_0x562f95[_0x3b5f('0x38')]=_[_0x3b5f('0x36')](_0xa10ddb[_0x3b5f('0x37')],qs['fields'](_0x5f171d[_0x3b5f('0x33')][_0x3b5f('0x39')]));_0x562f95[_0x3b5f('0x38')]=_0x562f95[_0x3b5f('0x38')][_0x3b5f('0x3a')]?_0x562f95['attributes']:_0xa10ddb['model'];if(_0x5f171d['query'][_0x3b5f('0x3b')]){_0x562f95[_0x3b5f('0x3c')]=[{'all':!![]}];}_0x562f95=_[_0x3b5f('0x3d')]({},_0x562f95,_0x5f171d[_0x3b5f('0x3e')]);return db[_0x3b5f('0x31')][_0x3b5f('0x3f')](_0x562f95)['then'](handleEntityNotFound(_0xbb62dc,null))[_0x3b5f('0x27')](respondWithResult(_0xbb62dc,null))[_0x3b5f('0x40')](handleError(_0xbb62dc,null));};exports[_0x3b5f('0x28')]=function(_0x5352c7,_0x511671){return db[_0x3b5f('0x31')]['find']({'where':{'id':_0x5352c7['params']['id']}})['then'](handleEntityNotFound(_0x511671,null))[_0x3b5f('0x27')](removeEntity(_0x511671,null))['catch'](handleError(_0x511671,null));};function widgetAttributes(_0x2a4356){try{switch(_0x2a4356[_0x3b5f('0x41')]){case _0x3b5f('0x42'):return[{'name':'attrUrl','value':_0x2a4356[_0x3b5f('0x43')]||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0x0]?_0x2a4356[_0x3b5f('0x44')][0x0][_0x3b5f('0x45')]:undefined)||_0x3b5f('0x46')}];case _0x3b5f('0x47'):return[{'name':'attrPath','value':_0x2a4356[_0x3b5f('0x48')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x0]?_0x2a4356[_0x3b5f('0x44')][0x0][_0x3b5f('0x45')]:undefined)||''}];case _0x3b5f('0x49'):return[{'name':_0x3b5f('0x4a'),'value':_0x2a4356[_0x3b5f('0x4a')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x0]?_0x2a4356['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x3b5f('0x4b'),'value':_0x2a4356[_0x3b5f('0x4b')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x1]?_0x2a4356['attrs'][0x1][_0x3b5f('0x45')]:undefined)||_0x3b5f('0x4c')},{'name':_0x3b5f('0x4d'),'value':_0x2a4356['attrFontSize']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x2]?_0x2a4356[_0x3b5f('0x44')][0x2]['value']:undefined)||0xc}];case _0x3b5f('0x4e'):return[{'name':'attrMetric','value':_0x2a4356[_0x3b5f('0x4f')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x0]?_0x2a4356[_0x3b5f('0x44')][0x0][_0x3b5f('0x45')]:undefined)||_0x3b5f('0x50')},{'name':'attrVoiceQueues','value':_0x2a4356['attrVoiceQueues']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x1]?_0x2a4356['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x2a4356['attrFontSize']||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0x2]?_0x2a4356[_0x3b5f('0x44')][0x2][_0x3b5f('0x45')]:undefined)||0x14},{'name':'attrChannel','value':_0x2a4356[_0x3b5f('0x51')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x3]?_0x2a4356[_0x3b5f('0x44')][0x3][_0x3b5f('0x45')]:undefined)||_0x3b5f('0x52')},{'name':'attrEmailAccounts','value':_0x2a4356[_0x3b5f('0x53')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x4]?_0x2a4356[_0x3b5f('0x44')][0x4][_0x3b5f('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2a4356[_0x3b5f('0x54')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x5]?_0x2a4356[_0x3b5f('0x44')][0x5]['value']:undefined)||''},{'name':_0x3b5f('0x55'),'value':_0x2a4356[_0x3b5f('0x55')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x6]?_0x2a4356[_0x3b5f('0x44')][0x6][_0x3b5f('0x45')]:undefined)||''},{'name':_0x3b5f('0x56'),'value':_0x2a4356[_0x3b5f('0x56')]||(_0x2a4356['attrs']&&_0x2a4356['attrs'][0x7]?_0x2a4356[_0x3b5f('0x44')][0x7][_0x3b5f('0x45')]:undefined)||''},{'name':_0x3b5f('0x57'),'value':_0x2a4356[_0x3b5f('0x57')]||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0x8]?_0x2a4356['attrs'][0x8][_0x3b5f('0x45')]:undefined)||''},{'name':_0x3b5f('0x58'),'value':_0x2a4356[_0x3b5f('0x58')]||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0x9]?_0x2a4356[_0x3b5f('0x44')][0x9]['value']:undefined)||''}];case _0x3b5f('0x59'):case _0x3b5f('0x5a'):return[{'name':'attrSerie1','value':_0x2a4356['attrSerie1']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x0]?_0x2a4356[_0x3b5f('0x44')][0x0][_0x3b5f('0x45')]:undefined)||_0x3b5f('0x50')},{'name':'attrSerie2','value':_0x2a4356[_0x3b5f('0x5b')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x1]?_0x2a4356[_0x3b5f('0x44')][0x1]['value']:undefined)||null},{'name':_0x3b5f('0x5c'),'value':_0x2a4356['attrSerie3']||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0x2]?_0x2a4356[_0x3b5f('0x44')][0x2][_0x3b5f('0x45')]:undefined)||null},{'name':_0x3b5f('0x5d'),'value':_0x2a4356['attrVoiceQueues']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x3]?_0x2a4356[_0x3b5f('0x44')][0x3]['value']:undefined)||[]},{'name':_0x3b5f('0x51'),'value':_0x2a4356['attrChannel']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x4]?_0x2a4356[_0x3b5f('0x44')][0x4][_0x3b5f('0x45')]:undefined)||'voice'},{'name':_0x3b5f('0x53'),'value':_0x2a4356[_0x3b5f('0x53')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x5]?_0x2a4356['attrs'][0x5][_0x3b5f('0x45')]:undefined)||''},{'name':_0x3b5f('0x54'),'value':_0x2a4356['attrFaxAccounts']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x6]?_0x2a4356[_0x3b5f('0x44')][0x6]['value']:undefined)||''},{'name':_0x3b5f('0x55'),'value':_0x2a4356[_0x3b5f('0x55')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x7]?_0x2a4356[_0x3b5f('0x44')][0x7]['value']:undefined)||''},{'name':_0x3b5f('0x56'),'value':_0x2a4356[_0x3b5f('0x56')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x8]?_0x2a4356[_0x3b5f('0x44')][0x8][_0x3b5f('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2a4356[_0x3b5f('0x57')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x9]?_0x2a4356['attrs'][0x9]['value']:undefined)||''},{'name':_0x3b5f('0x58'),'value':_0x2a4356[_0x3b5f('0x58')]||(_0x2a4356['attrs']&&_0x2a4356[_0x3b5f('0x44')][0xa]?_0x2a4356[_0x3b5f('0x44')][0xa][_0x3b5f('0x45')]:undefined)||''}];case _0x3b5f('0x5e'):return[{'name':'attrReport','type':_0x2a4356['reportType']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356['attrs'][0x0]?_0x2a4356['attrs'][0x0][_0x3b5f('0x41')]:undefined)||null,'value':_0x2a4356[_0x3b5f('0x5f')]||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x0]?_0x2a4356[_0x3b5f('0x44')][0x0]['value']:undefined)||null},{'name':_0x3b5f('0x60'),'value':_0x2a4356['attrRefresh']||(_0x2a4356[_0x3b5f('0x44')]&&_0x2a4356[_0x3b5f('0x44')][0x1]?_0x2a4356[_0x3b5f('0x44')][0x1][_0x3b5f('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x275f83){logger[_0x3b5f('0x2b')](_0x3b5f('0x61'),JSON[_0x3b5f('0x62')](_0x275f83));return[];}}exports[_0x3b5f('0x63')]=function(_0x273f6f,_0x2bdbb5){if(_0x273f6f[_0x3b5f('0x64')]){_0x273f6f['body'][_0x3b5f('0x44')]=widgetAttributes(_0x273f6f['body']);}return db['DashboardItem']['create'](_0x273f6f[_0x3b5f('0x64')],{})[_0x3b5f('0x27')](respondWithResult(_0x2bdbb5,0xc9))[_0x3b5f('0x40')](handleError(_0x2bdbb5,null));};exports[_0x3b5f('0x26')]=function(_0x1153f2,_0x2867e4){if(_0x1153f2[_0x3b5f('0x64')]['id']){delete _0x1153f2[_0x3b5f('0x64')]['id'];}_0x1153f2['body'][_0x3b5f('0x44')]=widgetAttributes(_0x1153f2[_0x3b5f('0x64')]);return db[_0x3b5f('0x31')][_0x3b5f('0x3f')]({'where':{'id':_0x1153f2[_0x3b5f('0x30')]['id']}})['then'](handleEntityNotFound(_0x2867e4,null))[_0x3b5f('0x27')](saveUpdates(_0x1153f2['body'],null))[_0x3b5f('0x27')](respondWithResult(_0x2867e4,null))[_0x3b5f('0x40')](handleError(_0x2867e4,null));}; \ No newline at end of file +var _0xb931=['then','destroy','sendStatus','error','stack','send','show','params','model','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','DashboardItem','find','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','widgetAttributes:\x20%s','stringify','create','body','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update'];(function(_0x355d56,_0x402690){var _0x110878=function(_0x2c5527){while(--_0x2c5527){_0x355d56['push'](_0x355d56['shift']());}};_0x110878(++_0x402690);}(_0xb931,0x155));var _0x1b93=function(_0x5cb2d5,_0x20e92a){_0x5cb2d5=_0x5cb2d5-0x0;var _0x2518cf=_0xb931[_0x5cb2d5];return _0x2518cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b93('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b93('0x1'));var BPromise=require(_0x1b93('0x2'));var Mustache=require(_0x1b93('0x3'));var util=require(_0x1b93('0x4'));var path=require(_0x1b93('0x5'));var sox=require(_0x1b93('0x6'));var csv=require(_0x1b93('0x7'));var ejs=require(_0x1b93('0x8'));var fs=require('fs');var fs_extra=require(_0x1b93('0x9'));var _=require(_0x1b93('0xa'));var squel=require(_0x1b93('0xb'));var crypto=require(_0x1b93('0xc'));var jsforce=require(_0x1b93('0xd'));var deskjs=require(_0x1b93('0xe'));var toCsv=require(_0x1b93('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b93('0xf'));var authService=require(_0x1b93('0x10'));var qs=require(_0x1b93('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b93('0x12'));var logger=require('../../config/logger')(_0x1b93('0x13'));var utils=require(_0x1b93('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b93('0x15'))['db'];config[_0x1b93('0x16')]=_[_0x1b93('0x17')](config['redis'],{'host':_0x1b93('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b93('0x16')]));require(_0x1b93('0x19'))[_0x1b93('0x1a')](socket);function respondWithStatusCode(_0x1ea97a,_0xe5a8ab){_0xe5a8ab=_0xe5a8ab||0xcc;return function(_0x1512fd){if(_0x1512fd){return _0x1ea97a['sendStatus'](_0xe5a8ab);}return _0x1ea97a[_0x1b93('0x1b')](_0xe5a8ab)[_0x1b93('0x1c')]();};}function respondWithResult(_0x240b8f,_0x23d687){_0x23d687=_0x23d687||0xc8;return function(_0x4d4c47){if(_0x4d4c47){return _0x240b8f[_0x1b93('0x1b')](_0x23d687)[_0x1b93('0x1d')](_0x4d4c47);}};}function respondWithFilteredResult(_0x4f7199,_0x446cc2){return function(_0x339c5b){if(_0x339c5b){var _0x4ed0d5=typeof _0x446cc2['offset']===_0x1b93('0x1e')&&typeof _0x446cc2[_0x1b93('0x1f')]===_0x1b93('0x1e');var _0x4156d9=_0x339c5b[_0x1b93('0x20')];var _0x4c3a25=_0x4ed0d5?0x0:_0x446cc2[_0x1b93('0x21')];var _0x23428d=_0x4ed0d5?_0x339c5b['count']:_0x446cc2['offset']+_0x446cc2[_0x1b93('0x1f')];var _0x116775;if(_0x23428d>=_0x4156d9){_0x23428d=_0x4156d9;_0x116775=0xc8;}else{_0x116775=0xce;}_0x4f7199[_0x1b93('0x1b')](_0x116775);return _0x4f7199[_0x1b93('0x22')](_0x1b93('0x23'),_0x4c3a25+'-'+_0x23428d+'/'+_0x4156d9)[_0x1b93('0x1d')](_0x339c5b);}return null;};}function patchUpdates(_0x577a22){return function(_0x43e492){try{jsonpatch[_0x1b93('0x24')](_0x43e492,_0x577a22,!![]);}catch(_0x208217){return BPromise['reject'](_0x208217);}return _0x43e492[_0x1b93('0x25')]();};}function saveUpdates(_0x41f219,_0xa6ea){return function(_0x20ce59){if(_0x20ce59){return _0x20ce59[_0x1b93('0x26')](_0x41f219)[_0x1b93('0x27')](function(_0x13cddc){return _0x13cddc;});}return null;};}function removeEntity(_0x309ac5,_0x14626a){return function(_0x24f04e){if(_0x24f04e){return _0x24f04e[_0x1b93('0x28')]()[_0x1b93('0x27')](function(){_0x309ac5[_0x1b93('0x1b')](0xcc)[_0x1b93('0x1c')]();});}};}function handleEntityNotFound(_0x2f92a0,_0x5ce57b){return function(_0x56e2d3){if(!_0x56e2d3){_0x2f92a0[_0x1b93('0x29')](0x194);}return _0x56e2d3;};}function handleError(_0x195c77,_0x28c014){_0x28c014=_0x28c014||0x1f4;return function(_0x2501ee){logger[_0x1b93('0x2a')](_0x2501ee[_0x1b93('0x2b')]);if(_0x2501ee['name']){delete _0x2501ee['name'];}_0x195c77[_0x1b93('0x1b')](_0x28c014)[_0x1b93('0x2c')](_0x2501ee);};}exports[_0x1b93('0x2d')]=function(_0x4d504c,_0x3dc539){var _0x49873d={'raw':![],'where':{'id':_0x4d504c[_0x1b93('0x2e')]['id']}},_0x758971={};_0x758971[_0x1b93('0x2f')]=_['keys'](db['DashboardItem'][_0x1b93('0x30')]);_0x758971['query']=_[_0x1b93('0x31')](_0x4d504c[_0x1b93('0x32')]);_0x758971[_0x1b93('0x33')]=_['intersection'](_0x758971[_0x1b93('0x2f')],_0x758971[_0x1b93('0x32')]);_0x49873d[_0x1b93('0x34')]=_[_0x1b93('0x35')](_0x758971[_0x1b93('0x2f')],qs[_0x1b93('0x36')](_0x4d504c[_0x1b93('0x32')][_0x1b93('0x36')]));_0x49873d[_0x1b93('0x34')]=_0x49873d[_0x1b93('0x34')][_0x1b93('0x37')]?_0x49873d['attributes']:_0x758971['model'];if(_0x4d504c[_0x1b93('0x32')][_0x1b93('0x38')]){_0x49873d[_0x1b93('0x39')]=[{'all':!![]}];}_0x49873d=_[_0x1b93('0x3a')]({},_0x49873d,_0x4d504c[_0x1b93('0x3b')]);return db[_0x1b93('0x3c')][_0x1b93('0x3d')](_0x49873d)['then'](handleEntityNotFound(_0x3dc539,null))['then'](respondWithResult(_0x3dc539,null))['catch'](handleError(_0x3dc539,null));};exports[_0x1b93('0x28')]=function(_0x457674,_0x55d921){return db['DashboardItem'][_0x1b93('0x3d')]({'where':{'id':_0x457674[_0x1b93('0x2e')]['id']}})['then'](handleEntityNotFound(_0x55d921,null))[_0x1b93('0x27')](removeEntity(_0x55d921,null))['catch'](handleError(_0x55d921,null));};function widgetAttributes(_0x413013){try{switch(_0x413013[_0x1b93('0x3e')]){case _0x1b93('0x3f'):return[{'name':_0x1b93('0x40'),'value':_0x413013[_0x1b93('0x40')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x0]?_0x413013[_0x1b93('0x41')][0x0]['value']:undefined)||_0x1b93('0x42')}];case'custom':return[{'name':_0x1b93('0x43'),'value':_0x413013[_0x1b93('0x43')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x0]?_0x413013[_0x1b93('0x41')][0x0][_0x1b93('0x44')]:undefined)||''}];case _0x1b93('0x45'):return[{'name':_0x1b93('0x46'),'value':_0x413013[_0x1b93('0x46')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x0]?_0x413013[_0x1b93('0x41')][0x0][_0x1b93('0x44')]:undefined)||_0x1b93('0x47')},{'name':'attrTimezone','value':_0x413013[_0x1b93('0x48')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x1]?_0x413013['attrs'][0x1][_0x1b93('0x44')]:undefined)||_0x1b93('0x49')},{'name':_0x1b93('0x4a'),'value':_0x413013[_0x1b93('0x4a')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x2]?_0x413013['attrs'][0x2]['value']:undefined)||0xc}];case _0x1b93('0x4b'):return[{'name':'attrMetric','value':_0x413013['attrMetric']||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x0]?_0x413013[_0x1b93('0x41')][0x0][_0x1b93('0x44')]:undefined)||_0x1b93('0x4c')},{'name':_0x1b93('0x4d'),'value':_0x413013[_0x1b93('0x4d')]||(_0x413013['attrs']&&_0x413013['attrs'][0x1]?_0x413013[_0x1b93('0x41')][0x1][_0x1b93('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x413013[_0x1b93('0x4a')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x2]?_0x413013[_0x1b93('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x1b93('0x4e'),'value':_0x413013[_0x1b93('0x4e')]||(_0x413013['attrs']&&_0x413013[_0x1b93('0x41')][0x3]?_0x413013[_0x1b93('0x41')][0x3][_0x1b93('0x44')]:undefined)||_0x1b93('0x4f')},{'name':'attrEmailAccounts','value':_0x413013[_0x1b93('0x50')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x4]?_0x413013[_0x1b93('0x41')][0x4]['value']:undefined)||''},{'name':_0x1b93('0x51'),'value':_0x413013[_0x1b93('0x51')]||(_0x413013['attrs']&&_0x413013[_0x1b93('0x41')][0x5]?_0x413013['attrs'][0x5][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x52'),'value':_0x413013[_0x1b93('0x52')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x6]?_0x413013[_0x1b93('0x41')][0x6][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x53'),'value':_0x413013[_0x1b93('0x53')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x7]?_0x413013[_0x1b93('0x41')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x413013[_0x1b93('0x54')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x8]?_0x413013[_0x1b93('0x41')][0x8][_0x1b93('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x413013[_0x1b93('0x55')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x9]?_0x413013[_0x1b93('0x41')][0x9][_0x1b93('0x44')]:undefined)||''}];case'multibar-chart':case _0x1b93('0x56'):return[{'name':'attrSerie1','value':_0x413013[_0x1b93('0x57')]||(_0x413013['attrs']&&_0x413013['attrs'][0x0]?_0x413013[_0x1b93('0x41')][0x0]['value']:undefined)||_0x1b93('0x4c')},{'name':'attrSerie2','value':_0x413013['attrSerie2']||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x1]?_0x413013['attrs'][0x1][_0x1b93('0x44')]:undefined)||null},{'name':_0x1b93('0x58'),'value':_0x413013[_0x1b93('0x58')]||(_0x413013['attrs']&&_0x413013[_0x1b93('0x41')][0x2]?_0x413013[_0x1b93('0x41')][0x2]['value']:undefined)||null},{'name':_0x1b93('0x4d'),'value':_0x413013[_0x1b93('0x4d')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x3]?_0x413013['attrs'][0x3][_0x1b93('0x44')]:undefined)||[]},{'name':_0x1b93('0x4e'),'value':_0x413013[_0x1b93('0x4e')]||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x4]?_0x413013[_0x1b93('0x41')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x413013[_0x1b93('0x50')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x5]?_0x413013[_0x1b93('0x41')][0x5][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x51'),'value':_0x413013[_0x1b93('0x51')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x6]?_0x413013['attrs'][0x6][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x52'),'value':_0x413013['attrSmsAccounts']||(_0x413013['attrs']&&_0x413013[_0x1b93('0x41')][0x7]?_0x413013[_0x1b93('0x41')][0x7][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x53'),'value':_0x413013[_0x1b93('0x53')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x8]?_0x413013[_0x1b93('0x41')][0x8]['value']:undefined)||''},{'name':_0x1b93('0x54'),'value':_0x413013[_0x1b93('0x54')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x9]?_0x413013[_0x1b93('0x41')][0x9][_0x1b93('0x44')]:undefined)||''},{'name':_0x1b93('0x55'),'value':_0x413013[_0x1b93('0x55')]||(_0x413013['attrs']&&_0x413013[_0x1b93('0x41')][0xa]?_0x413013[_0x1b93('0x41')][0xa][_0x1b93('0x44')]:undefined)||''}];case _0x1b93('0x59'):return[{'name':_0x1b93('0x5a'),'type':_0x413013['reportType']||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x0]?_0x413013['attrs'][0x0][_0x1b93('0x3e')]:undefined)||null,'value':_0x413013[_0x1b93('0x5a')]||(_0x413013[_0x1b93('0x41')]&&_0x413013[_0x1b93('0x41')][0x0]?_0x413013['attrs'][0x0][_0x1b93('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x413013['attrRefresh']||(_0x413013[_0x1b93('0x41')]&&_0x413013['attrs'][0x1]?_0x413013[_0x1b93('0x41')][0x1][_0x1b93('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x37e5e6){logger[_0x1b93('0x2a')](_0x1b93('0x5b'),JSON[_0x1b93('0x5c')](_0x37e5e6));return[];}}exports[_0x1b93('0x5d')]=function(_0x12e5d5,_0x58d3f0){if(_0x12e5d5[_0x1b93('0x5e')]){_0x12e5d5[_0x1b93('0x5e')][_0x1b93('0x41')]=widgetAttributes(_0x12e5d5[_0x1b93('0x5e')]);}return db[_0x1b93('0x3c')][_0x1b93('0x5d')](_0x12e5d5[_0x1b93('0x5e')],{})[_0x1b93('0x27')](respondWithResult(_0x58d3f0,0xc9))['catch'](handleError(_0x58d3f0,null));};exports[_0x1b93('0x26')]=function(_0x40aa45,_0x550568){if(_0x40aa45[_0x1b93('0x5e')]['id']){delete _0x40aa45[_0x1b93('0x5e')]['id'];}_0x40aa45['body']['attrs']=widgetAttributes(_0x40aa45['body']);return db[_0x1b93('0x3c')][_0x1b93('0x3d')]({'where':{'id':_0x40aa45['params']['id']}})[_0x1b93('0x27')](handleEntityNotFound(_0x550568,null))[_0x1b93('0x27')](saveUpdates(_0x40aa45[_0x1b93('0x5e')],null))[_0x1b93('0x27')](respondWithResult(_0x550568,null))['catch'](handleError(_0x550568,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9d78f97..f57430c 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 _0x43b7=['hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x43b7,0x1df));var _0x743b=function(_0x4dceac,_0x71f1a3){_0x4dceac=_0x4dceac-0x0;var _0x4022fd=_0x43b7[_0x4dceac];return _0x4022fd;};'use strict';var EventEmitter=require(_0x743b('0x0'));var DashboardItem=require(_0x743b('0x1'))['db'][_0x743b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x743b('0x3')](0x0);var events={'afterCreate':_0x743b('0x4'),'afterUpdate':'update','afterDestroy':_0x743b('0x5')};function emitEvent(_0x97de33){return function(_0x9011fe,_0x347c69,_0x5d8940){DashboardItemEvents[_0x743b('0x6')](_0x97de33+':'+_0x9011fe['id'],_0x9011fe);DashboardItemEvents['emit'](_0x97de33,_0x9011fe);_0x5d8940(null);};}for(var e in events){if(events[_0x743b('0x7')](e)){var event=events[e];DashboardItem[_0x743b('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xed1c=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x15d215,_0x1ce028){var _0x16c5f6=function(_0x17716a){while(--_0x17716a){_0x15d215['push'](_0x15d215['shift']());}};_0x16c5f6(++_0x1ce028);}(_0xed1c,0x1bd));var _0xced1=function(_0x4d9f8f,_0x406149){_0x4d9f8f=_0x4d9f8f-0x0;var _0x5ad538=_0xed1c[_0x4d9f8f];return _0x5ad538;};'use strict';var EventEmitter=require(_0xced1('0x0'));var DashboardItem=require(_0xced1('0x1'))['db'][_0xced1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xced1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xced1('0x4')};function emitEvent(_0x52d2e0){return function(_0x214c9e,_0x4c43bb,_0x334199){DashboardItemEvents[_0xced1('0x5')](_0x52d2e0+':'+_0x214c9e['id'],_0x214c9e);DashboardItemEvents[_0xced1('0x5')](_0x52d2e0,_0x214c9e);_0x334199(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xced1('0x6')](e,emitEvent(event));}}module[_0xced1('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 72ce697..9b22aa5 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 _0x17ba=['define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x1b58a3,_0x5de88a){var _0x5459fa=function(_0x3ace8b){while(--_0x3ace8b){_0x1b58a3['push'](_0x1b58a3['shift']());}};_0x5459fa(++_0x5de88a);}(_0x17ba,0xab));var _0xa17b=function(_0x13e4f9,_0x6c3414){_0x13e4f9=_0x13e4f9-0x0;var _0x51bed9=_0x17ba[_0x13e4f9];return _0x51bed9;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var logger=require('../../config/logger')(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var BPromise=require(_0xa17b('0x4'));var rp=require(_0xa17b('0x5'));var fs=require('fs');var path=require(_0xa17b('0x6'));var rimraf=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var attributes=require(_0xa17b('0x9'));module[_0xa17b('0xa')]=function(_0x3cced2,_0xf72ed4){return _0x3cced2[_0xa17b('0xb')](_0xa17b('0xc'),attributes,{'tableName':_0xa17b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1395=['api','moment','bluebird','request-promise','path','../../config/environment','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x695d9d,_0x15397c){var _0x27ddb3=function(_0x4b6536){while(--_0x4b6536){_0x695d9d['push'](_0x695d9d['shift']());}};_0x27ddb3(++_0x15397c);}(_0x1395,0x105));var _0x5139=function(_0x2a2ff4,_0x42ea25){_0x2a2ff4=_0x2a2ff4-0x0;var _0x9873c4=_0x1395[_0x2a2ff4];return _0x9873c4;};'use strict';var _=require(_0x5139('0x0'));var util=require(_0x5139('0x1'));var logger=require(_0x5139('0x2'))(_0x5139('0x3'));var moment=require(_0x5139('0x4'));var BPromise=require(_0x5139('0x5'));var rp=require(_0x5139('0x6'));var fs=require('fs');var path=require(_0x5139('0x7'));var rimraf=require('rimraf');var config=require(_0x5139('0x8'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x2ef957,_0x52051f){return _0x2ef957[_0x5139('0x9')](_0x5139('0xa'),attributes,{'tableName':_0x5139('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 8be4bbb..24d366b 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 _0x21ec=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x566c8e,_0x10d230){var _0xe02f1e=function(_0x15568b){while(--_0x15568b){_0x566c8e['push'](_0x566c8e['shift']());}};_0xe02f1e(++_0x10d230);}(_0x21ec,0x1ab));var _0xc21e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x21ec[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xc21e('0x0'));var util=require(_0xc21e('0x1'));var moment=require(_0xc21e('0x2'));var BPromise=require(_0xc21e('0x3'));var rs=require(_0xc21e('0x4'));var fs=require('fs');var Redis=require(_0xc21e('0x5'));var db=require(_0xc21e('0x6'))['db'];var utils=require(_0xc21e('0x7'));var logger=require(_0xc21e('0x8'))(_0xc21e('0x9'));var config=require('../../config/environment');var jayson=require(_0xc21e('0xa'));var client=jayson[_0xc21e('0xb')][_0xc21e('0xc')]({'port':0x232a});config[_0xc21e('0xd')]=_[_0xc21e('0xe')](config['redis'],{'host':_0xc21e('0xf'),'port':0x18eb});var socket=require(_0xc21e('0x10'))(new Redis(config[_0xc21e('0xd')]));require('./dashboardItem.socket')[_0xc21e('0x11')](socket);function respondWithRpcPromise(_0x2b5336,_0x4a4e6e,_0x719759){return new BPromise(function(_0xee7fa9,_0x165eac){return client[_0xc21e('0x12')](_0x2b5336,_0x719759)[_0xc21e('0x13')](function(_0x5c5f2a){logger[_0xc21e('0x14')]('DashboardItem,\x20%s,\x20%s',_0x4a4e6e,_0xc21e('0x15'));logger[_0xc21e('0x16')](_0xc21e('0x17'),_0x4a4e6e,_0xc21e('0x15'),JSON[_0xc21e('0x18')](_0x5c5f2a));if(_0x5c5f2a[_0xc21e('0x19')]){if(_0x5c5f2a[_0xc21e('0x19')]['code']===0x1f4){logger['error'](_0xc21e('0x1a'),_0x4a4e6e,_0x5c5f2a['error'][_0xc21e('0x1b')]);return _0x165eac(_0x5c5f2a[_0xc21e('0x19')][_0xc21e('0x1b')]);}logger[_0xc21e('0x19')](_0xc21e('0x1a'),_0x4a4e6e,_0x5c5f2a[_0xc21e('0x19')][_0xc21e('0x1b')]);return _0xee7fa9(_0x5c5f2a[_0xc21e('0x19')][_0xc21e('0x1b')]);}else{logger['info'](_0xc21e('0x1a'),_0x4a4e6e,_0xc21e('0x15'));_0xee7fa9(_0x5c5f2a[_0xc21e('0x1c')][_0xc21e('0x1b')]);}})['catch'](function(_0x2691f6){logger[_0xc21e('0x19')]('DashboardItem,\x20%s,\x20%s',_0x4a4e6e,_0x2691f6);_0x165eac(_0x2691f6);});});} \ No newline at end of file +var _0x2d4d=['DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x2d4d,0x1f2));var _0xd2d4=function(_0x4b0010,_0x5660a3){_0x4b0010=_0x4b0010-0x0;var _0x3beadc=_0x2d4d[_0x4b0010];return _0x3beadc;};'use strict';var _=require(_0xd2d4('0x0'));var util=require(_0xd2d4('0x1'));var moment=require('moment');var BPromise=require(_0xd2d4('0x2'));var rs=require(_0xd2d4('0x3'));var fs=require('fs');var Redis=require(_0xd2d4('0x4'));var db=require(_0xd2d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2d4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd2d4('0x7'));var client=jayson[_0xd2d4('0x8')][_0xd2d4('0x9')]({'port':0x232a});config[_0xd2d4('0xa')]=_[_0xd2d4('0xb')](config['redis'],{'host':_0xd2d4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2d4('0xa')]));require(_0xd2d4('0xd'))[_0xd2d4('0xe')](socket);function respondWithRpcPromise(_0xe269b0,_0x528961,_0x531d18){return new BPromise(function(_0x3895a2,_0x2145f8){return client[_0xd2d4('0xf')](_0xe269b0,_0x531d18)['then'](function(_0x34c592){logger[_0xd2d4('0x10')]('DashboardItem,\x20%s,\x20%s',_0x528961,_0xd2d4('0x11'));logger[_0xd2d4('0x12')](_0xd2d4('0x13'),_0x528961,_0xd2d4('0x11'),JSON[_0xd2d4('0x14')](_0x34c592));if(_0x34c592[_0xd2d4('0x15')]){if(_0x34c592[_0xd2d4('0x15')]['code']===0x1f4){logger[_0xd2d4('0x15')](_0xd2d4('0x16'),_0x528961,_0x34c592[_0xd2d4('0x15')][_0xd2d4('0x17')]);return _0x2145f8(_0x34c592[_0xd2d4('0x15')][_0xd2d4('0x17')]);}logger[_0xd2d4('0x15')](_0xd2d4('0x16'),_0x528961,_0x34c592[_0xd2d4('0x15')]['message']);return _0x3895a2(_0x34c592[_0xd2d4('0x15')][_0xd2d4('0x17')]);}else{logger[_0xd2d4('0x10')](_0xd2d4('0x16'),_0x528961,_0xd2d4('0x11'));_0x3895a2(_0x34c592[_0xd2d4('0x18')]['message']);}})[_0xd2d4('0x19')](function(_0x427026){logger['error'](_0xd2d4('0x16'),_0x528961,_0x427026);_0x2145f8(_0x427026);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 71c324b..1d8f8fc 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 _0xd9d1=['dashboardItem:','remove','update','emit','removeListener','length'];(function(_0x716fcd,_0x37a900){var _0x24a255=function(_0x36cb12){while(--_0x36cb12){_0x716fcd['push'](_0x716fcd['shift']());}};_0x24a255(++_0x37a900);}(_0xd9d1,0x1b7));var _0x1d9d=function(_0x196e11,_0x339eaa){_0x196e11=_0x196e11-0x0;var _0x3da5f9=_0xd9d1[_0x196e11];return _0x3da5f9;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x1d9d('0x0'),_0x1d9d('0x1')];function createListener(_0x784837,_0x15c680){return function(_0x36eb47){_0x15c680[_0x1d9d('0x2')](_0x784837,_0x36eb47);};}function removeListener(_0x49f6d5,_0xab9c98){return function(){DashboardItemEvents[_0x1d9d('0x3')](_0x49f6d5,_0xab9c98);};}exports['register']=function(_0x19b1de){for(var _0x21b301=0x0,_0x4f171f=events[_0x1d9d('0x4')];_0x21b301<_0x4f171f;_0x21b301++){var _0x9cde8e=events[_0x21b301];var _0x154bbc=createListener(_0x1d9d('0x5')+_0x9cde8e,_0x19b1de);DashboardItemEvents['on'](_0x9cde8e,_0x154bbc);}}; \ No newline at end of file +var _0xb6fb=['save','remove','emit','removeListener','register','length','./dashboardItem.events'];(function(_0x3f7ebc,_0x291344){var _0x319c10=function(_0x1227ad){while(--_0x1227ad){_0x3f7ebc['push'](_0x3f7ebc['shift']());}};_0x319c10(++_0x291344);}(_0xb6fb,0x15d));var _0xbb6f=function(_0x2bc5f2,_0x409451){_0x2bc5f2=_0x2bc5f2-0x0;var _0x4108b0=_0xb6fb[_0x2bc5f2];return _0x4108b0;};'use strict';var DashboardItemEvents=require(_0xbb6f('0x0'));var events=[_0xbb6f('0x1'),_0xbb6f('0x2'),'update'];function createListener(_0x4b0cc8,_0x1c9b05){return function(_0x215cda){_0x1c9b05[_0xbb6f('0x3')](_0x4b0cc8,_0x215cda);};}function removeListener(_0x209362,_0x1e59c8){return function(){DashboardItemEvents[_0xbb6f('0x4')](_0x209362,_0x1e59c8);};}exports[_0xbb6f('0x5')]=function(_0x2eb9d3){for(var _0x110a45=0x0,_0x2cdf4e=events[_0xbb6f('0x6')];_0x110a45<_0x2cdf4e;_0x110a45++){var _0x22646d=events[_0x110a45];var _0x287192=createListener('dashboardItem:'+_0x22646d,_0x2eb9d3);DashboardItemEvents['on'](_0x22646d,_0x287192);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index bd17e14..c00155c 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 _0xb53f=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0xb53f,0x98));var _0xfb53=function(_0x169401,_0x43d39e){_0x169401=_0x169401-0x0;var _0x4a8801=_0xb53f[_0x169401];return _0x4a8801;};'use strict';var multer=require(_0xfb53('0x0'));var util=require(_0xfb53('0x1'));var path=require(_0xfb53('0x2'));var timeout=require(_0xfb53('0x3'));var express=require('express');var router=express[_0xfb53('0x4')]();var fs_extra=require(_0xfb53('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb53('0x6'));var config=require(_0xfb53('0x7'));var controller=require(_0xfb53('0x8'));router['get'](_0xfb53('0x9'),auth[_0xfb53('0xa')](),controller[_0xfb53('0xb')]);router[_0xfb53('0xc')]('/',auth[_0xfb53('0xa')](),controller[_0xfb53('0xd')]);router[_0xfb53('0xe')](_0xfb53('0x9'),auth[_0xfb53('0xa')](),controller[_0xfb53('0xf')]);router[_0xfb53('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfb53('0x11')]);module[_0xfb53('0x12')]=router; \ No newline at end of file +var _0x1ed4=['update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1ed4,0x1ac));var _0x41ed=function(_0x2678d7,_0x183a22){_0x2678d7=_0x2678d7-0x0;var _0x28b82e=_0x1ed4[_0x2678d7];return _0x28b82e;};'use strict';var multer=require(_0x41ed('0x0'));var util=require('util');var path=require(_0x41ed('0x1'));var timeout=require('connect-timeout');var express=require(_0x41ed('0x2'));var router=express[_0x41ed('0x3')]();var fs_extra=require(_0x41ed('0x4'));var auth=require(_0x41ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41ed('0x6'));var controller=require(_0x41ed('0x7'));router['get'](_0x41ed('0x8'),auth[_0x41ed('0x9')](),controller[_0x41ed('0xa')]);router[_0x41ed('0xb')]('/',auth['isAuthenticated'](),controller[_0x41ed('0xc')]);router[_0x41ed('0xd')](_0x41ed('0x8'),auth['isAuthenticated'](),controller[_0x41ed('0xe')]);router['delete']('/:id',auth[_0x41ed('0x9')](),controller[_0x41ed('0xf')]);module[_0x41ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index fb9b229..9dcfbe2 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 _0xbb43=['sequelize','exports','STRING','ENUM','first','third'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbb43,0x72));var _0x3bb4=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0xbb43[_0x9a7ea6];return _0x1c2040;};'use strict';var Sequelize=require(_0x3bb4('0x0'));module[_0x3bb4('0x1')]={'name':{'type':Sequelize[_0x3bb4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3bb4('0x3')](_0x3bb4('0x4'),'second',_0x3bb4('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3bb4('0x2')]}}; \ No newline at end of file +var _0x5fae=['sequelize','exports','STRING','ENUM','first','second','third'];(function(_0x496e30,_0x4c67d9){var _0x106e04=function(_0x42077c){while(--_0x42077c){_0x496e30['push'](_0x496e30['shift']());}};_0x106e04(++_0x4c67d9);}(_0x5fae,0xee));var _0xe5fa=function(_0x19d3d4,_0x288267){_0x19d3d4=_0x19d3d4-0x0;var _0x14984e=_0x5fae[_0x19d3d4];return _0x14984e;};'use strict';var Sequelize=require(_0xe5fa('0x0'));module[_0xe5fa('0x1')]={'name':{'type':Sequelize[_0xe5fa('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe5fa('0x3')](_0xe5fa('0x4'),_0xe5fa('0x5'),_0xe5fa('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 4504d87..b33b000 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 _0xf163=['end','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','Dispositions','UserProfileResource','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x372e78,_0xa4b08a){var _0x8f8851=function(_0x2694ce){while(--_0x2694ce){_0x372e78['push'](_0x372e78['shift']());}};_0x8f8851(++_0xa4b08a);}(_0xf163,0x129));var _0x3f16=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xf163[_0x36940e];return _0x3283f2;};'use strict';var emlformat=require(_0x3f16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f16('0x1'));var jsonpatch=require(_0x3f16('0x2'));var rp=require(_0x3f16('0x3'));var moment=require(_0x3f16('0x4'));var BPromise=require(_0x3f16('0x5'));var Mustache=require('mustache');var util=require(_0x3f16('0x6'));var path=require(_0x3f16('0x7'));var sox=require('sox');var csv=require(_0x3f16('0x8'));var ejs=require(_0x3f16('0x9'));var fs=require('fs');var fs_extra=require(_0x3f16('0xa'));var _=require(_0x3f16('0xb'));var squel=require(_0x3f16('0xc'));var crypto=require(_0x3f16('0xd'));var jsforce=require(_0x3f16('0xe'));var deskjs=require(_0x3f16('0xf'));var toCsv=require(_0x3f16('0x8'));var querystring=require(_0x3f16('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f16('0x11'));var authService=require(_0x3f16('0x12'));var qs=require(_0x3f16('0x13'));var as=require(_0x3f16('0x14'));var hardwareService=require(_0x3f16('0x15'));var logger=require(_0x3f16('0x16'))('api');var utils=require(_0x3f16('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3f16('0x18'));var db=require(_0x3f16('0x19'))['db'];function respondWithStatusCode(_0xd36fd0,_0x101158){_0x101158=_0x101158||0xcc;return function(_0x1e7330){if(_0x1e7330){return _0xd36fd0[_0x3f16('0x1a')](_0x101158);}return _0xd36fd0['status'](_0x101158)[_0x3f16('0x1b')]();};}function respondWithResult(_0x36a20b,_0x8a24e6){_0x8a24e6=_0x8a24e6||0xc8;return function(_0x1c83c7){if(_0x1c83c7){return _0x36a20b[_0x3f16('0x1c')](_0x8a24e6)['json'](_0x1c83c7);}};}function respondWithFilteredResult(_0x461d4e,_0x5b0b3f){return function(_0x23e0e4){if(_0x23e0e4){var _0x24c077=typeof _0x5b0b3f[_0x3f16('0x1d')]===_0x3f16('0x1e')&&typeof _0x5b0b3f[_0x3f16('0x1f')]===_0x3f16('0x1e');var _0x10769=_0x23e0e4[_0x3f16('0x20')];var _0x2fae0f=_0x24c077?0x0:_0x5b0b3f[_0x3f16('0x1d')];var _0x12691c=_0x24c077?_0x23e0e4[_0x3f16('0x20')]:_0x5b0b3f[_0x3f16('0x1d')]+_0x5b0b3f[_0x3f16('0x1f')];var _0x198372;if(_0x12691c>=_0x10769){_0x12691c=_0x10769;_0x198372=0xc8;}else{_0x198372=0xce;}_0x461d4e[_0x3f16('0x1c')](_0x198372);return _0x461d4e['set'](_0x3f16('0x21'),_0x2fae0f+'-'+_0x12691c+'/'+_0x10769)['json'](_0x23e0e4);}return null;};}function patchUpdates(_0x27166c){return function(_0x35a067){try{jsonpatch[_0x3f16('0x22')](_0x35a067,_0x27166c,!![]);}catch(_0x1f7020){return BPromise['reject'](_0x1f7020);}return _0x35a067[_0x3f16('0x23')]();};}function saveUpdates(_0xd451c6,_0x24a5e5){return function(_0x2cbc6f){if(_0x2cbc6f){return _0x2cbc6f[_0x3f16('0x24')](_0xd451c6)[_0x3f16('0x25')](function(_0xa2a3b7){return _0xa2a3b7;});}return null;};}function removeEntity(_0x559a78,_0x289bb8){return function(_0x5c4fe4){if(_0x5c4fe4){return _0x5c4fe4['destroy']()[_0x3f16('0x25')](function(){var _0x4a9766=_0x5c4fe4[_0x3f16('0x26')]({'plain':!![]});var _0x42c8c4=_0x3f16('0x27');return db[_0x3f16('0x28')]['destroy']({'where':{'type':_0x42c8c4,'resourceId':_0x4a9766['id']}})['then'](function(){return _0x5c4fe4;});})[_0x3f16('0x25')](function(){_0x559a78[_0x3f16('0x1c')](0xcc)[_0x3f16('0x1b')]();});}};}function handleEntityNotFound(_0xfe2506,_0xf3636a){return function(_0x3d6ddd){if(!_0x3d6ddd){_0xfe2506[_0x3f16('0x1a')](0x194);}return _0x3d6ddd;};}function handleError(_0x5c93c6,_0x6f8eb){_0x6f8eb=_0x6f8eb||0x1f4;return function(_0xb90034){logger['error'](_0xb90034['stack']);if(_0xb90034[_0x3f16('0x29')]){delete _0xb90034[_0x3f16('0x29')];}_0x5c93c6['status'](_0x6f8eb)['send'](_0xb90034);};}exports[_0x3f16('0x2a')]=function(_0x3048d4,_0x52a045){var _0x52fcbd={},_0x478696={},_0x3df48e={'count':0x0,'rows':[]};var _0xf1c937=_[_0x3f16('0x2b')](db[_0x3f16('0x2c')][_0x3f16('0x2d')],function(_0x5ad909){return{'name':_0x5ad909[_0x3f16('0x2e')],'type':_0x5ad909[_0x3f16('0x2f')][_0x3f16('0x30')]};});_0x478696[_0x3f16('0x31')]=_[_0x3f16('0x2b')](_0xf1c937,_0x3f16('0x29'));_0x478696[_0x3f16('0x32')]=_[_0x3f16('0x33')](_0x3048d4[_0x3f16('0x32')]);_0x478696['filters']=_['intersection'](_0x478696[_0x3f16('0x31')],_0x478696[_0x3f16('0x32')]);_0x52fcbd['attributes']=_[_0x3f16('0x34')](_0x478696[_0x3f16('0x31')],qs[_0x3f16('0x35')](_0x3048d4[_0x3f16('0x32')][_0x3f16('0x35')]));_0x52fcbd[_0x3f16('0x36')]=_0x52fcbd['attributes'][_0x3f16('0x37')]?_0x52fcbd[_0x3f16('0x36')]:_0x478696[_0x3f16('0x31')];if(!_0x3048d4[_0x3f16('0x32')][_0x3f16('0x38')](_0x3f16('0x39'))){_0x52fcbd[_0x3f16('0x1f')]=qs[_0x3f16('0x1f')](_0x3048d4[_0x3f16('0x32')][_0x3f16('0x1f')]);_0x52fcbd[_0x3f16('0x1d')]=qs[_0x3f16('0x1d')](_0x3048d4['query'][_0x3f16('0x1d')]);}_0x52fcbd[_0x3f16('0x3a')]=qs[_0x3f16('0x3b')](_0x3048d4[_0x3f16('0x32')][_0x3f16('0x3b')]);_0x52fcbd[_0x3f16('0x3c')]=qs[_0x3f16('0x3d')](_[_0x3f16('0x3e')](_0x3048d4['query'],_0x478696[_0x3f16('0x3d')]),_0xf1c937);if(_0x3048d4[_0x3f16('0x32')][_0x3f16('0x3f')]){_0x52fcbd[_0x3f16('0x3c')]=_[_0x3f16('0x40')](_0x52fcbd['where'],{'$or':_[_0x3f16('0x2b')](_0xf1c937,function(_0x3c20c3){if(_0x3c20c3[_0x3f16('0x2f')]!==_0x3f16('0x41')){var _0x5876e7={};_0x5876e7[_0x3c20c3[_0x3f16('0x29')]]={'$like':'%'+_0x3048d4[_0x3f16('0x32')][_0x3f16('0x3f')]+'%'};return _0x5876e7;}})});}_0x52fcbd=_[_0x3f16('0x40')]({},_0x52fcbd,_0x3048d4['options']);var _0x4ad275={'where':_0x52fcbd[_0x3f16('0x3c')]};return db[_0x3f16('0x2c')][_0x3f16('0x20')](_0x4ad275)[_0x3f16('0x25')](function(_0x37c5d8){_0x3df48e[_0x3f16('0x20')]=_0x37c5d8;if(_0x3048d4[_0x3f16('0x32')]['includeAll']){_0x52fcbd[_0x3f16('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x3f16('0x43')](_0x52fcbd);})[_0x3f16('0x25')](function(_0x3d1403){_0x3df48e[_0x3f16('0x44')]=_0x3d1403;return _0x3df48e;})[_0x3f16('0x25')](respondWithFilteredResult(_0x52a045,_0x52fcbd))['catch'](handleError(_0x52a045,null));};exports[_0x3f16('0x45')]=function(_0x3a65bc,_0x18bf96){var _0x198c68={'raw':!![],'where':{'id':_0x3a65bc['params']['id']}},_0x2c2909={};_0x2c2909[_0x3f16('0x31')]=_[_0x3f16('0x33')](db[_0x3f16('0x2c')]['rawAttributes']);_0x2c2909['query']=_[_0x3f16('0x33')](_0x3a65bc['query']);_0x2c2909[_0x3f16('0x3d')]=_[_0x3f16('0x34')](_0x2c2909[_0x3f16('0x31')],_0x2c2909[_0x3f16('0x32')]);_0x198c68['attributes']=_[_0x3f16('0x34')](_0x2c2909['model'],qs[_0x3f16('0x35')](_0x3a65bc['query'][_0x3f16('0x35')]));_0x198c68[_0x3f16('0x36')]=_0x198c68['attributes']['length']?_0x198c68[_0x3f16('0x36')]:_0x2c2909[_0x3f16('0x31')];if(_0x3a65bc[_0x3f16('0x32')]['includeAll']){_0x198c68[_0x3f16('0x42')]=[{'all':!![]}];}_0x198c68=_[_0x3f16('0x40')]({},_0x198c68,_0x3a65bc[_0x3f16('0x46')]);return db[_0x3f16('0x2c')][_0x3f16('0x47')](_0x198c68)['then'](handleEntityNotFound(_0x18bf96,null))[_0x3f16('0x25')](respondWithResult(_0x18bf96,null))['catch'](handleError(_0x18bf96,null));};exports['create']=function(_0x59d583,_0x4970a7){return db[_0x3f16('0x2c')][_0x3f16('0x48')](_0x59d583['body'],{})['then'](function(_0x1bafd5){var _0x2f9e3e=_0x59d583[_0x3f16('0x49')][_0x3f16('0x26')]({'plain':!![]});if(!_0x2f9e3e)throw new Error(_0x3f16('0x4a'));if(_0x2f9e3e['role']===_0x3f16('0x49')){var _0x316c1d=_0x1bafd5[_0x3f16('0x26')]({'plain':!![]});var _0x4c9d6e=_0x3f16('0x27');return db[_0x3f16('0x4b')][_0x3f16('0x47')]({'where':{'name':_0x4c9d6e,'userProfileId':_0x2f9e3e['userProfileId']},'raw':!![]})[_0x3f16('0x25')](function(_0x439da3){if(_0x439da3&&_0x439da3[_0x3f16('0x4c')]===0x0){return db[_0x3f16('0x28')][_0x3f16('0x48')]({'name':_0x316c1d[_0x3f16('0x29')],'resourceId':_0x316c1d['id'],'type':_0x439da3['name'],'sectionId':_0x439da3['id']},{})[_0x3f16('0x25')](function(){return _0x1bafd5;});}else{return _0x1bafd5;}})[_0x3f16('0x4d')](function(_0xcd59ad){logger['error'](_0x3f16('0x4e'),_0xcd59ad);throw _0xcd59ad;});}return _0x1bafd5;})[_0x3f16('0x25')](respondWithResult(_0x4970a7,0xc9))['catch'](handleError(_0x4970a7,null));};exports['update']=function(_0x403307,_0x2991ab){if(_0x403307[_0x3f16('0x4f')]['id']){delete _0x403307[_0x3f16('0x4f')]['id'];}return db['Disposition'][_0x3f16('0x47')]({'where':{'id':_0x403307[_0x3f16('0x50')]['id']}})[_0x3f16('0x25')](handleEntityNotFound(_0x2991ab,null))[_0x3f16('0x25')](saveUpdates(_0x403307[_0x3f16('0x4f')],null))[_0x3f16('0x25')](respondWithResult(_0x2991ab,null))[_0x3f16('0x4d')](handleError(_0x2991ab,null));};exports['destroy']=function(_0x3e0f0c,_0x8ff73b){return db['Disposition'][_0x3f16('0x47')]({'where':{'id':_0x3e0f0c[_0x3f16('0x50')]['id']}})['then'](handleEntityNotFound(_0x8ff73b,null))['then'](removeEntity(_0x8ff73b,null))['catch'](handleError(_0x8ff73b,null));}; \ No newline at end of file +var _0xc809=['offset','limit','undefined','count','Content-Range','apply','save','then','destroy','get','Dispositions','error','name','index','map','Disposition','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x2d3a4d,_0x47561e){var _0x3a94a3=function(_0x2f48da){while(--_0x2f48da){_0x2d3a4d['push'](_0x2d3a4d['shift']());}};_0x3a94a3(++_0x47561e);}(_0xc809,0x1b8));var _0x9c80=function(_0x30c6f0,_0x30c578){_0x30c6f0=_0x30c6f0-0x0;var _0x564257=_0xc809[_0x30c6f0];return _0x564257;};'use strict';var emlformat=require(_0x9c80('0x0'));var rimraf=require(_0x9c80('0x1'));var zipdir=require(_0x9c80('0x2'));var jsonpatch=require(_0x9c80('0x3'));var rp=require(_0x9c80('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c80('0x5'));var util=require(_0x9c80('0x6'));var path=require(_0x9c80('0x7'));var sox=require(_0x9c80('0x8'));var csv=require(_0x9c80('0x9'));var ejs=require(_0x9c80('0xa'));var fs=require('fs');var fs_extra=require(_0x9c80('0xb'));var _=require(_0x9c80('0xc'));var squel=require('squel');var crypto=require(_0x9c80('0xd'));var jsforce=require(_0x9c80('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c80('0x9'));var querystring=require('querystring');var Papa=require(_0x9c80('0xf'));var Redis=require(_0x9c80('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9c80('0x11'));var as=require(_0x9c80('0x12'));var hardwareService=require(_0x9c80('0x13'));var logger=require(_0x9c80('0x14'))('api');var utils=require(_0x9c80('0x15'));var config=require(_0x9c80('0x16'));var licenseUtil=require(_0x9c80('0x17'));var db=require(_0x9c80('0x18'))['db'];function respondWithStatusCode(_0x4ac5c6,_0x4c5535){_0x4c5535=_0x4c5535||0xcc;return function(_0x3e102c){if(_0x3e102c){return _0x4ac5c6[_0x9c80('0x19')](_0x4c5535);}return _0x4ac5c6[_0x9c80('0x1a')](_0x4c5535)['end']();};}function respondWithResult(_0x1d671d,_0x415bfc){_0x415bfc=_0x415bfc||0xc8;return function(_0x40d8a4){if(_0x40d8a4){return _0x1d671d['status'](_0x415bfc)[_0x9c80('0x1b')](_0x40d8a4);}};}function respondWithFilteredResult(_0x37bf4b,_0x4b1e96){return function(_0xb9463){if(_0xb9463){var _0xb844df=typeof _0x4b1e96[_0x9c80('0x1c')]==='undefined'&&typeof _0x4b1e96[_0x9c80('0x1d')]===_0x9c80('0x1e');var _0x2fd1e7=_0xb9463[_0x9c80('0x1f')];var _0x13b6e2=_0xb844df?0x0:_0x4b1e96[_0x9c80('0x1c')];var _0x47888f=_0xb844df?_0xb9463[_0x9c80('0x1f')]:_0x4b1e96[_0x9c80('0x1c')]+_0x4b1e96[_0x9c80('0x1d')];var _0x548882;if(_0x47888f>=_0x2fd1e7){_0x47888f=_0x2fd1e7;_0x548882=0xc8;}else{_0x548882=0xce;}_0x37bf4b['status'](_0x548882);return _0x37bf4b['set'](_0x9c80('0x20'),_0x13b6e2+'-'+_0x47888f+'/'+_0x2fd1e7)[_0x9c80('0x1b')](_0xb9463);}return null;};}function patchUpdates(_0x343e3f){return function(_0x34564f){try{jsonpatch[_0x9c80('0x21')](_0x34564f,_0x343e3f,!![]);}catch(_0x2ed5f8){return BPromise['reject'](_0x2ed5f8);}return _0x34564f[_0x9c80('0x22')]();};}function saveUpdates(_0x48fdf1,_0x496c7e){return function(_0x2b6e3a){if(_0x2b6e3a){return _0x2b6e3a['update'](_0x48fdf1)[_0x9c80('0x23')](function(_0x19b898){return _0x19b898;});}return null;};}function removeEntity(_0x73df74,_0x545c36){return function(_0x185b65){if(_0x185b65){return _0x185b65[_0x9c80('0x24')]()['then'](function(){var _0x439b35=_0x185b65[_0x9c80('0x25')]({'plain':!![]});var _0x4df3bb=_0x9c80('0x26');return db['UserProfileResource'][_0x9c80('0x24')]({'where':{'type':_0x4df3bb,'resourceId':_0x439b35['id']}})[_0x9c80('0x23')](function(){return _0x185b65;});})['then'](function(){_0x73df74[_0x9c80('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341b56,_0x2b03f4){return function(_0xd002d3){if(!_0xd002d3){_0x341b56[_0x9c80('0x19')](0x194);}return _0xd002d3;};}function handleError(_0x3e790b,_0x478e91){_0x478e91=_0x478e91||0x1f4;return function(_0x582dd3){logger[_0x9c80('0x27')](_0x582dd3['stack']);if(_0x582dd3[_0x9c80('0x28')]){delete _0x582dd3[_0x9c80('0x28')];}_0x3e790b[_0x9c80('0x1a')](_0x478e91)['send'](_0x582dd3);};}exports[_0x9c80('0x29')]=function(_0x19190c,_0x54d5de){var _0x282c8c={},_0x356c88={},_0x230afa={'count':0x0,'rows':[]};var _0x4a7135=_[_0x9c80('0x2a')](db[_0x9c80('0x2b')]['rawAttributes'],function(_0x2c8fd7){return{'name':_0x2c8fd7[_0x9c80('0x2c')],'type':_0x2c8fd7['type']['key']};});_0x356c88[_0x9c80('0x2d')]=_[_0x9c80('0x2a')](_0x4a7135,_0x9c80('0x28'));_0x356c88[_0x9c80('0x2e')]=_[_0x9c80('0x2f')](_0x19190c['query']);_0x356c88[_0x9c80('0x30')]=_['intersection'](_0x356c88[_0x9c80('0x2d')],_0x356c88[_0x9c80('0x2e')]);_0x282c8c[_0x9c80('0x31')]=_[_0x9c80('0x32')](_0x356c88[_0x9c80('0x2d')],qs[_0x9c80('0x33')](_0x19190c[_0x9c80('0x2e')][_0x9c80('0x33')]));_0x282c8c['attributes']=_0x282c8c[_0x9c80('0x31')][_0x9c80('0x34')]?_0x282c8c[_0x9c80('0x31')]:_0x356c88[_0x9c80('0x2d')];if(!_0x19190c['query'][_0x9c80('0x35')](_0x9c80('0x36'))){_0x282c8c[_0x9c80('0x1d')]=qs['limit'](_0x19190c['query'][_0x9c80('0x1d')]);_0x282c8c[_0x9c80('0x1c')]=qs[_0x9c80('0x1c')](_0x19190c['query'][_0x9c80('0x1c')]);}_0x282c8c[_0x9c80('0x37')]=qs['sort'](_0x19190c[_0x9c80('0x2e')]['sort']);_0x282c8c['where']=qs['filters'](_[_0x9c80('0x38')](_0x19190c['query'],_0x356c88['filters']),_0x4a7135);if(_0x19190c[_0x9c80('0x2e')][_0x9c80('0x39')]){_0x282c8c['where']=_[_0x9c80('0x3a')](_0x282c8c[_0x9c80('0x3b')],{'$or':_['map'](_0x4a7135,function(_0x306b83){if(_0x306b83['type']!==_0x9c80('0x3c')){var _0x45f1ec={};_0x45f1ec[_0x306b83[_0x9c80('0x28')]]={'$like':'%'+_0x19190c[_0x9c80('0x2e')][_0x9c80('0x39')]+'%'};return _0x45f1ec;}})});}_0x282c8c=_[_0x9c80('0x3a')]({},_0x282c8c,_0x19190c['options']);var _0x2c89e2={'where':_0x282c8c['where']};return db[_0x9c80('0x2b')][_0x9c80('0x1f')](_0x2c89e2)[_0x9c80('0x23')](function(_0x5b3502){_0x230afa[_0x9c80('0x1f')]=_0x5b3502;if(_0x19190c[_0x9c80('0x2e')][_0x9c80('0x3d')]){_0x282c8c[_0x9c80('0x3e')]=[{'all':!![]}];}return db[_0x9c80('0x2b')][_0x9c80('0x3f')](_0x282c8c);})[_0x9c80('0x23')](function(_0x1ede57){_0x230afa[_0x9c80('0x40')]=_0x1ede57;return _0x230afa;})[_0x9c80('0x23')](respondWithFilteredResult(_0x54d5de,_0x282c8c))[_0x9c80('0x41')](handleError(_0x54d5de,null));};exports[_0x9c80('0x42')]=function(_0xc16085,_0x17cb51){var _0x365294={'raw':!![],'where':{'id':_0xc16085['params']['id']}},_0x47ba82={};_0x47ba82['model']=_[_0x9c80('0x2f')](db['Disposition']['rawAttributes']);_0x47ba82[_0x9c80('0x2e')]=_[_0x9c80('0x2f')](_0xc16085['query']);_0x47ba82[_0x9c80('0x30')]=_['intersection'](_0x47ba82['model'],_0x47ba82[_0x9c80('0x2e')]);_0x365294[_0x9c80('0x31')]=_[_0x9c80('0x32')](_0x47ba82['model'],qs[_0x9c80('0x33')](_0xc16085[_0x9c80('0x2e')][_0x9c80('0x33')]));_0x365294[_0x9c80('0x31')]=_0x365294[_0x9c80('0x31')][_0x9c80('0x34')]?_0x365294[_0x9c80('0x31')]:_0x47ba82[_0x9c80('0x2d')];if(_0xc16085[_0x9c80('0x2e')][_0x9c80('0x3d')]){_0x365294[_0x9c80('0x3e')]=[{'all':!![]}];}_0x365294=_[_0x9c80('0x3a')]({},_0x365294,_0xc16085[_0x9c80('0x43')]);return db[_0x9c80('0x2b')][_0x9c80('0x44')](_0x365294)[_0x9c80('0x23')](handleEntityNotFound(_0x17cb51,null))[_0x9c80('0x23')](respondWithResult(_0x17cb51,null))['catch'](handleError(_0x17cb51,null));};exports['create']=function(_0x465c41,_0x514cf1){return db[_0x9c80('0x2b')][_0x9c80('0x45')](_0x465c41[_0x9c80('0x46')],{})[_0x9c80('0x23')](function(_0x122625){var _0x288db5=_0x465c41[_0x9c80('0x47')]['get']({'plain':!![]});if(!_0x288db5)throw new Error(_0x9c80('0x48'));if(_0x288db5[_0x9c80('0x49')]===_0x9c80('0x47')){var _0x369aa4=_0x122625[_0x9c80('0x25')]({'plain':!![]});var _0x22fd9e=_0x9c80('0x26');return db[_0x9c80('0x4a')]['find']({'where':{'name':_0x22fd9e,'userProfileId':_0x288db5[_0x9c80('0x4b')]},'raw':!![]})['then'](function(_0x4afbd7){if(_0x4afbd7&&_0x4afbd7[_0x9c80('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x369aa4[_0x9c80('0x28')],'resourceId':_0x369aa4['id'],'type':_0x4afbd7[_0x9c80('0x28')],'sectionId':_0x4afbd7['id']},{})[_0x9c80('0x23')](function(){return _0x122625;});}else{return _0x122625;}})['catch'](function(_0x2e9181){logger[_0x9c80('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e9181);throw _0x2e9181;});}return _0x122625;})['then'](respondWithResult(_0x514cf1,0xc9))[_0x9c80('0x41')](handleError(_0x514cf1,null));};exports['update']=function(_0x309117,_0x2a85d9){if(_0x309117[_0x9c80('0x46')]['id']){delete _0x309117[_0x9c80('0x46')]['id'];}return db[_0x9c80('0x2b')][_0x9c80('0x44')]({'where':{'id':_0x309117[_0x9c80('0x4d')]['id']}})[_0x9c80('0x23')](handleEntityNotFound(_0x2a85d9,null))['then'](saveUpdates(_0x309117[_0x9c80('0x46')],null))['then'](respondWithResult(_0x2a85d9,null))[_0x9c80('0x41')](handleError(_0x2a85d9,null));};exports[_0x9c80('0x24')]=function(_0x50bf66,_0x1daf56){return db['Disposition'][_0x9c80('0x44')]({'where':{'id':_0x50bf66[_0x9c80('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1daf56,null))[_0x9c80('0x23')](removeEntity(_0x1daf56,null))[_0x9c80('0x41')](handleError(_0x1daf56,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 9d42d9e..f394642 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 _0x9e09=['name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions'];(function(_0x5c1763,_0x58f55a){var _0x539e73=function(_0x5e22ad){while(--_0x5e22ad){_0x5c1763['push'](_0x5c1763['shift']());}};_0x539e73(++_0x58f55a);}(_0x9e09,0xa4));var _0x99e0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9e09[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x99e0('0x0'));var util=require(_0x99e0('0x1'));var logger=require('../../config/logger')(_0x99e0('0x2'));var moment=require(_0x99e0('0x3'));var BPromise=require(_0x99e0('0x4'));var rp=require(_0x99e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x99e0('0x6'));var attributes=require(_0x99e0('0x7'));module[_0x99e0('0x8')]=function(_0x4bc958,_0x40c9b2){return _0x4bc958[_0x99e0('0x9')](_0x99e0('0xa'),attributes,{'tableName':_0x99e0('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x99e0('0xc'),'fields':[_0x99e0('0xd'),_0x99e0('0xe')]},{'unique':!![],'name':_0x99e0('0xf'),'fields':['name',_0x99e0('0x10')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':_0x99e0('0x11'),'fields':[_0x99e0('0xd'),_0x99e0('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x99e0('0xd'),_0x99e0('0x13')]},{'unique':!![],'name':_0x99e0('0x14'),'fields':[_0x99e0('0xd'),_0x99e0('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe863=['../../config/environment','exports','define','tools_dispositions','name_voice','name','name_chat','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','util','../../config/logger','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe863,0x1e9));var _0x3e86=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0xe863[_0xda6d0f];return _0x244540;};'use strict';var _=require('lodash');var util=require(_0x3e86('0x0'));var logger=require(_0x3e86('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e86('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e86('0x3'));var config=require(_0x3e86('0x4'));var attributes=require('./disposition.attributes');module[_0x3e86('0x5')]=function(_0x40e09b,_0x12697f){return _0x40e09b[_0x3e86('0x6')]('Disposition',attributes,{'tableName':_0x3e86('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3e86('0x8'),'fields':[_0x3e86('0x9'),'ListId']},{'unique':!![],'name':_0x3e86('0xa'),'fields':[_0x3e86('0x9'),'ChatWebsiteId']},{'unique':!![],'name':_0x3e86('0xb'),'fields':['name',_0x3e86('0xc')]},{'unique':!![],'name':_0x3e86('0xd'),'fields':[_0x3e86('0x9'),'SmsAccountId']},{'unique':!![],'name':_0x3e86('0xe'),'fields':['name',_0x3e86('0xf')]},{'unique':!![],'name':_0x3e86('0x10'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x3e86('0x9'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 75bd500..b7bbdd8 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2688ea,_0x38cf77){var _0xd92357=function(_0x412d62){while(--_0x412d62){_0x2688ea['push'](_0x2688ea['shift']());}};_0xd92357(++_0x38cf77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc7b5c1,_0x19bc52){var _0x514fb6=function(_0x30cae9){while(--_0x30cae9){_0xc7b5c1['push'](_0xc7b5c1['shift']());}};_0x514fb6(++_0x19bc52);}(_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/disposition/index.js b/server/api/disposition/index.js index 169ab58..88ca08e 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 _0xe318=['post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show'];(function(_0x5061a9,_0x41a3f2){var _0x351bf3=function(_0x208378){while(--_0x208378){_0x5061a9['push'](_0x5061a9['shift']());}};_0x351bf3(++_0x41a3f2);}(_0xe318,0x181));var _0x8e31=function(_0x34a3fe,_0x5350b7){_0x34a3fe=_0x34a3fe-0x0;var _0x293a42=_0xe318[_0x34a3fe];return _0x293a42;};'use strict';var multer=require(_0x8e31('0x0'));var util=require(_0x8e31('0x1'));var path=require(_0x8e31('0x2'));var timeout=require(_0x8e31('0x3'));var express=require(_0x8e31('0x4'));var router=express[_0x8e31('0x5')]();var fs_extra=require(_0x8e31('0x6'));var auth=require(_0x8e31('0x7'));var interaction=require(_0x8e31('0x8'));var config=require(_0x8e31('0x9'));var controller=require('./disposition.controller');router['get']('/',auth[_0x8e31('0xa')](),controller[_0x8e31('0xb')]);router[_0x8e31('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8e31('0xd')]);router[_0x8e31('0xe')]('/',auth[_0x8e31('0xa')](),controller[_0x8e31('0xf')]);router[_0x8e31('0x10')](_0x8e31('0x11'),auth[_0x8e31('0xa')](),controller[_0x8e31('0x12')]);router[_0x8e31('0x13')]('/:id',auth[_0x8e31('0xa')](),controller[_0x8e31('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf935=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index'];(function(_0x594a87,_0xb4b59c){var _0x59e5fd=function(_0x55e19d){while(--_0x55e19d){_0x594a87['push'](_0x594a87['shift']());}};_0x59e5fd(++_0xb4b59c);}(_0xf935,0xbc));var _0x5f93=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf935[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5f93('0x0'));var util=require(_0x5f93('0x1'));var path=require(_0x5f93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f93('0x3')]();var fs_extra=require(_0x5f93('0x4'));var auth=require(_0x5f93('0x5'));var interaction=require(_0x5f93('0x6'));var config=require(_0x5f93('0x7'));var controller=require(_0x5f93('0x8'));router[_0x5f93('0x9')]('/',auth[_0x5f93('0xa')](),controller[_0x5f93('0xb')]);router['get'](_0x5f93('0xc'),auth[_0x5f93('0xa')](),controller[_0x5f93('0xd')]);router[_0x5f93('0xe')]('/',auth[_0x5f93('0xa')](),controller[_0x5f93('0xf')]);router[_0x5f93('0x10')](_0x5f93('0xc'),auth[_0x5f93('0xa')](),controller['update']);router[_0x5f93('0x11')](_0x5f93('0xc'),auth[_0x5f93('0xa')](),controller[_0x5f93('0x12')]);module[_0x5f93('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ad61401..b2320d8 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 _0xc501=['DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xc501,0x85));var _0x1c50=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xc501[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require('sequelize');module[_0x1c50('0x0')]={'name':{'type':Sequelize[_0x1c50('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1c50('0x1')]},'ecm':{'type':Sequelize[_0x1c50('0x2')](_0x1c50('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x1c50('0x1')],'defaultValue':_0x1c50('0x4')},'localstationid':{'type':Sequelize[_0x1c50('0x1')],'unique':_0x1c50('0x5')},'minrate':{'type':Sequelize[_0x1c50('0x2')](_0x1c50('0x6'),'4800',_0x1c50('0x7'),_0x1c50('0x8'),_0x1c50('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x1c50('0x6'),'4800',_0x1c50('0x7'),_0x1c50('0x8'),'12000',_0x1c50('0xa')),'defaultValue':_0x1c50('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x1c50('0xb')},'gateway':{'type':Sequelize[_0x1c50('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1c50('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1c50('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1c50('0x2')](_0x1c50('0xd'),'IAX',_0x1c50('0xe'),_0x1c50('0xf')),'defaultValue':_0x1c50('0xd')},'key':{'type':Sequelize[_0x1c50('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1c50('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1c50('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1c50('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1c50('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1c50('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1c50('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1c50('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1c50('0x11')],'defaultValue':![],'comment':_0x1c50('0x12'),'set':function(_0x40484c){if(!_0x40484c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x1c50('0x13')](_0x1c50('0x14'),_0x40484c);}}}; \ No newline at end of file +var _0x2d44=['mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','12000','2400','4800','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','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(_0x21d201,_0x43a013){var _0x211b88=function(_0x2621f9){while(--_0x2621f9){_0x21d201['push'](_0x21d201['shift']());}};_0x211b88(++_0x43a013);}(_0x2d44,0x91));var _0x42d4=function(_0x851680,_0x59984a){_0x851680=_0x851680-0x0;var _0x18ed25=_0x2d44[_0x851680];return _0x18ed25;};'use strict';var Sequelize=require(_0x42d4('0x0'));module[_0x42d4('0x1')]={'name':{'type':Sequelize[_0x42d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x42d4('0x2')]},'ecm':{'type':Sequelize[_0x42d4('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x42d4('0x2')],'defaultValue':_0x42d4('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x42d4('0x5')},'minrate':{'type':Sequelize[_0x42d4('0x3')]('2400','4800',_0x42d4('0x6'),_0x42d4('0x7'),_0x42d4('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x42d4('0x9'),_0x42d4('0xa'),'7200',_0x42d4('0x7'),'12000',_0x42d4('0xb')),'defaultValue':_0x42d4('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x42d4('0xc')},'gateway':{'type':Sequelize[_0x42d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x42d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x42d4('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x42d4('0x3')](_0x42d4('0xe'),_0x42d4('0xf'),'DADHI',_0x42d4('0x10')),'defaultValue':_0x42d4('0xe')},'key':{'type':Sequelize[_0x42d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x42d4('0x11');}},'notificationSound':{'type':Sequelize[_0x42d4('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x42d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x42d4('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x42d4('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x42d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x42d4('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x42d4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x42d4('0x12')],'defaultValue':![],'comment':_0x42d4('0x14'),'set':function(_0x3c6942){if(!_0x3c6942)this[_0x42d4('0x15')](_0x42d4('0x16'),null);this['setDataValue'](_0x42d4('0x17'),_0x3c6942);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 80adf63..6f57bea 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 _0xc40e=['Fax\x20Extension','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','addAccountApplications','transaction','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','hasOwnProperty','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description'];(function(_0x2dc83e,_0x575fb1){var _0x45a774=function(_0x4ffac7){while(--_0x4ffac7){_0x2dc83e['push'](_0x2dc83e['shift']());}};_0x45a774(++_0x575fb1);}(_0xc40e,0x1c0));var _0xec40=function(_0x53d499,_0x11475c){_0x53d499=_0x53d499-0x0;var _0xd1ec36=_0xc40e[_0x53d499];return _0xd1ec36;};'use strict';var emlformat=require(_0xec40('0x0'));var rimraf=require(_0xec40('0x1'));var zipdir=require(_0xec40('0x2'));var jsonpatch=require(_0xec40('0x3'));var rp=require(_0xec40('0x4'));var moment=require(_0xec40('0x5'));var BPromise=require(_0xec40('0x6'));var Mustache=require(_0xec40('0x7'));var util=require('util');var path=require(_0xec40('0x8'));var sox=require(_0xec40('0x9'));var csv=require(_0xec40('0xa'));var ejs=require(_0xec40('0xb'));var fs=require('fs');var fs_extra=require(_0xec40('0xc'));var _=require(_0xec40('0xd'));var squel=require('squel');var crypto=require(_0xec40('0xe'));var jsforce=require(_0xec40('0xf'));var deskjs=require(_0xec40('0x10'));var toCsv=require(_0xec40('0xa'));var querystring=require(_0xec40('0x11'));var Papa=require(_0xec40('0x12'));var Redis=require(_0xec40('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec40('0x14'))(_0xec40('0x15'));var utils=require(_0xec40('0x16'));var config=require(_0xec40('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xec40('0x18')](config[_0xec40('0x19')],{'host':_0xec40('0x1a'),'port':0x18eb});var socket=require(_0xec40('0x1b'))(new Redis(config['redis']));require(_0xec40('0x1c'))[_0xec40('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xec40('0x1e')][_0xec40('0x1f')]({'port':0x232c});var client9002=jayson[_0xec40('0x1e')][_0xec40('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x13b1ba,_0x2e97ac,_0x5081b9,_0x2687c5){return new BPromise(function(_0x124b67,_0x405931){var _0x562a0b=_0x2687c5||client;return _0x562a0b[_0xec40('0x20')](_0x13b1ba,_0x5081b9)['then'](function(_0x4e1241){logger[_0xec40('0x21')](_0xec40('0x22'),_0x2e97ac,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2e97ac,_0xec40('0x23'),JSON[_0xec40('0x24')](_0x4e1241));if(_0x4e1241['error']){if(_0x4e1241[_0xec40('0x25')][_0xec40('0x26')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2e97ac,_0x4e1241[_0xec40('0x25')][_0xec40('0x27')]);return _0x405931(_0x4e1241[_0xec40('0x25')][_0xec40('0x27')]);}logger[_0xec40('0x25')]('FaxAccount,\x20%s,\x20%s',_0x2e97ac,_0x4e1241[_0xec40('0x25')][_0xec40('0x27')]);return _0x124b67(_0x4e1241[_0xec40('0x25')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x2e97ac,'request\x20sent');_0x124b67(_0x4e1241[_0xec40('0x28')][_0xec40('0x27')]);}})[_0xec40('0x29')](function(_0x252f41){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2e97ac,_0x252f41);_0x405931(_0x252f41);});});}function respondWithStatusCode(_0x1d286f,_0x1e3b81){_0x1e3b81=_0x1e3b81||0xcc;return function(_0x2eaf26){if(_0x2eaf26){return _0x1d286f[_0xec40('0x2a')](_0x1e3b81);}return _0x1d286f[_0xec40('0x2b')](_0x1e3b81)['end']();};}function respondWithResult(_0x268c36,_0x264a35){_0x264a35=_0x264a35||0xc8;return function(_0xc14fa1){if(_0xc14fa1){return _0x268c36[_0xec40('0x2b')](_0x264a35)[_0xec40('0x2c')](_0xc14fa1);}};}function respondWithFilteredResult(_0x45be48,_0x8532a9){return function(_0x18a6c6){if(_0x18a6c6){var _0x55f748=typeof _0x8532a9[_0xec40('0x2d')]===_0xec40('0x2e')&&typeof _0x8532a9['limit']==='undefined';var _0x2c778c=_0x18a6c6[_0xec40('0x2f')];var _0x4ce39e=_0x55f748?0x0:_0x8532a9[_0xec40('0x2d')];var _0x45f9b6=_0x55f748?_0x18a6c6[_0xec40('0x2f')]:_0x8532a9['offset']+_0x8532a9['limit'];var _0x2f387f;if(_0x45f9b6>=_0x2c778c){_0x45f9b6=_0x2c778c;_0x2f387f=0xc8;}else{_0x2f387f=0xce;}_0x45be48[_0xec40('0x2b')](_0x2f387f);return _0x45be48[_0xec40('0x30')](_0xec40('0x31'),_0x4ce39e+'-'+_0x45f9b6+'/'+_0x2c778c)[_0xec40('0x2c')](_0x18a6c6);}return null;};}function patchUpdates(_0x38a943){return function(_0x331976){try{jsonpatch[_0xec40('0x32')](_0x331976,_0x38a943,!![]);}catch(_0x22bfba){return BPromise[_0xec40('0x33')](_0x22bfba);}return _0x331976['save']();};}function saveUpdates(_0x567d57,_0x159b7e){return function(_0x4b55a1){if(_0x4b55a1){return _0x4b55a1[_0xec40('0x34')](_0x567d57)['then'](function(_0x4596b4){return _0x4596b4;});}return null;};}function removeEntity(_0x254586,_0x167232){return function(_0x2d1ff9){if(_0x2d1ff9){return _0x2d1ff9['destroy']()[_0xec40('0x35')](function(){var _0x5c8433=_0x2d1ff9[_0xec40('0x36')]({'plain':!![]});var _0xbd412=_0xec40('0x37');return db[_0xec40('0x38')][_0xec40('0x39')]({'where':{'type':_0xbd412,'resourceId':_0x5c8433['id']}})[_0xec40('0x35')](function(){return _0x2d1ff9;});})[_0xec40('0x35')](function(){_0x254586[_0xec40('0x2b')](0xcc)[_0xec40('0x3a')]();});}};}function handleEntityNotFound(_0x25ec76,_0x5ca674){return function(_0x5981eb){if(!_0x5981eb){_0x25ec76[_0xec40('0x2a')](0x194);}return _0x5981eb;};}function handleError(_0x1cd034,_0x35b93a){_0x35b93a=_0x35b93a||0x1f4;return function(_0x20ef81){logger[_0xec40('0x25')](_0x20ef81[_0xec40('0x3b')]);if(_0x20ef81[_0xec40('0x3c')]){delete _0x20ef81[_0xec40('0x3c')];}_0x1cd034[_0xec40('0x2b')](_0x35b93a)[_0xec40('0x3d')](_0x20ef81);};}exports[_0xec40('0x3e')]=function(_0x41a8ab,_0x2c1e7e){var _0x21d9d9={'include':[{'model':db[_0xec40('0x3f')],'as':_0xec40('0x40')}]},_0x3775b6={},_0x106877={'count':0x0,'rows':[]};var _0x26b3f6=_[_0xec40('0x41')](db[_0xec40('0x42')][_0xec40('0x43')],function(_0x1c54d1){return{'name':_0x1c54d1['fieldName'],'type':_0x1c54d1[_0xec40('0x44')][_0xec40('0x45')]};});_0x3775b6[_0xec40('0x46')]=_[_0xec40('0x41')](_0x26b3f6,_0xec40('0x3c'));_0x3775b6['query']=_[_0xec40('0x47')](_0x41a8ab[_0xec40('0x48')]);_0x3775b6[_0xec40('0x49')]=_['intersection'](_0x3775b6[_0xec40('0x46')],_0x3775b6[_0xec40('0x48')]);_0x21d9d9[_0xec40('0x4a')]=_[_0xec40('0x4b')](_0x3775b6[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x41a8ab[_0xec40('0x48')][_0xec40('0x4c')]));_0x21d9d9[_0xec40('0x4a')]=_0x21d9d9['attributes'][_0xec40('0x4d')]?_0x21d9d9[_0xec40('0x4a')]:_0x3775b6['model'];if(!_0x41a8ab[_0xec40('0x48')]['hasOwnProperty'](_0xec40('0x4e'))){_0x21d9d9['limit']=qs[_0xec40('0x4f')](_0x41a8ab[_0xec40('0x48')][_0xec40('0x4f')]);_0x21d9d9[_0xec40('0x2d')]=qs[_0xec40('0x2d')](_0x41a8ab[_0xec40('0x48')][_0xec40('0x2d')]);}_0x21d9d9[_0xec40('0x50')]=qs[_0xec40('0x51')](_0x41a8ab[_0xec40('0x48')][_0xec40('0x51')]);_0x21d9d9['where']=qs[_0xec40('0x49')](_[_0xec40('0x52')](_0x41a8ab['query'],_0x3775b6[_0xec40('0x49')]),_0x26b3f6);if(_0x41a8ab['query'][_0xec40('0x53')]){_0x21d9d9[_0xec40('0x54')]=_[_0xec40('0x55')](_0x21d9d9[_0xec40('0x54')],{'$or':_['map'](_0x26b3f6,function(_0x181338){if(_0x181338['type']!==_0xec40('0x56')){var _0xf4326f={};_0xf4326f[_0x181338[_0xec40('0x3c')]]={'$like':'%'+_0x41a8ab[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0xf4326f;}})});}_0x21d9d9=_[_0xec40('0x55')]({},_0x21d9d9,_0x41a8ab[_0xec40('0x57')]);var _0xd3cacb={'where':_0x21d9d9[_0xec40('0x54')]};return db[_0xec40('0x42')][_0xec40('0x2f')](_0xd3cacb)[_0xec40('0x35')](function(_0x205534){_0x106877[_0xec40('0x2f')]=_0x205534;if(_0x41a8ab['query'][_0xec40('0x58')]){_0x21d9d9['include']=[{'all':!![]}];}return db[_0xec40('0x42')][_0xec40('0x59')](_0x21d9d9);})[_0xec40('0x35')](function(_0x525cca){_0x106877[_0xec40('0x5a')]=_0x525cca;return _0x106877;})[_0xec40('0x35')](respondWithFilteredResult(_0x2c1e7e,_0x21d9d9))[_0xec40('0x29')](handleError(_0x2c1e7e,null));};exports['show']=function(_0x563313,_0x5726cc){var _0x14e12f={'raw':![],'where':{'id':_0x563313[_0xec40('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x598f1b={};_0x598f1b[_0xec40('0x46')]=_['keys'](db['FaxAccount']['rawAttributes']);_0x598f1b[_0xec40('0x48')]=_[_0xec40('0x47')](_0x563313[_0xec40('0x48')]);_0x598f1b['filters']=_[_0xec40('0x4b')](_0x598f1b[_0xec40('0x46')],_0x598f1b['query']);_0x14e12f[_0xec40('0x4a')]=_[_0xec40('0x4b')](_0x598f1b[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x563313[_0xec40('0x48')][_0xec40('0x4c')]));_0x14e12f[_0xec40('0x4a')]=_0x14e12f[_0xec40('0x4a')][_0xec40('0x4d')]?_0x14e12f['attributes']:_0x598f1b[_0xec40('0x46')];if(_0x563313[_0xec40('0x48')][_0xec40('0x58')]){_0x14e12f[_0xec40('0x5c')]=[{'all':!![]}];}_0x14e12f=_[_0xec40('0x55')]({},_0x14e12f,_0x563313['options']);return db[_0xec40('0x42')]['find'](_0x14e12f)['then'](handleEntityNotFound(_0x5726cc,null))[_0xec40('0x35')](respondWithResult(_0x5726cc,null))['catch'](handleError(_0x5726cc,null));};exports[_0xec40('0x5d')]=function(_0x4fd526,_0x3f7379){return db['FaxAccount'][_0xec40('0x5d')](_0x4fd526[_0xec40('0x5e')],{})['then'](function(_0x2fd55f){var _0x37e618=_0x4fd526[_0xec40('0x5f')][_0xec40('0x36')]({'plain':!![]});if(!_0x37e618)throw new Error(_0xec40('0x60'));if(_0x37e618['role']===_0xec40('0x5f')){var _0x43bd6a=_0x2fd55f[_0xec40('0x36')]({'plain':!![]});var _0x520421=_0xec40('0x37');return db[_0xec40('0x61')][_0xec40('0x62')]({'where':{'name':_0x520421,'userProfileId':_0x37e618[_0xec40('0x63')]},'raw':!![]})[_0xec40('0x35')](function(_0x49b170){if(_0x49b170&&_0x49b170[_0xec40('0x64')]===0x0){return db[_0xec40('0x38')][_0xec40('0x5d')]({'name':_0x43bd6a[_0xec40('0x3c')],'resourceId':_0x43bd6a['id'],'type':_0x49b170[_0xec40('0x3c')],'sectionId':_0x49b170['id']},{})['then'](function(){return _0x2fd55f;});}else{return _0x2fd55f;}})[_0xec40('0x29')](function(_0x5b681a){logger[_0xec40('0x25')](_0xec40('0x65'),_0x5b681a);throw _0x5b681a;});}return _0x2fd55f;})[_0xec40('0x35')](respondWithResult(_0x3f7379,0xc9))[_0xec40('0x29')](handleError(_0x3f7379,null));};exports[_0xec40('0x34')]=function(_0x1add65,_0x27a118){if(_0x1add65[_0xec40('0x5e')]['id']){delete _0x1add65[_0xec40('0x5e')]['id'];}return db['FaxAccount'][_0xec40('0x62')]({'where':{'id':_0x1add65[_0xec40('0x5b')]['id']},'include':[{'model':db[_0xec40('0x3f')],'as':_0xec40('0x40')}]})[_0xec40('0x35')](handleEntityNotFound(_0x27a118,null))[_0xec40('0x35')](saveUpdates(_0x1add65[_0xec40('0x5e')],null))['then'](respondWithResult(_0x27a118,null))[_0xec40('0x29')](handleError(_0x27a118,null));};exports[_0xec40('0x39')]=function(_0x16b7c0,_0x3c8edb){return db[_0xec40('0x42')][_0xec40('0x62')]({'where':{'id':_0x16b7c0['params']['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x3c8edb,null))['then'](removeEntity(_0x3c8edb,null))['catch'](handleError(_0x3c8edb,null));};exports[_0xec40('0x66')]=function(_0xde0f71,_0x53e5c9){return db[_0xec40('0x42')][_0xec40('0x66')]()[_0xec40('0x35')](respondWithResult(_0x53e5c9,null))[_0xec40('0x29')](handleError(_0x53e5c9,null));};exports['addDisposition']=function(_0x45d79c,_0x1ce707,_0x32720a){if(_0x45d79c[_0xec40('0x5e')]['id']){delete _0x45d79c[_0xec40('0x5e')]['id'];}return db[_0xec40('0x42')][_0xec40('0x62')]({'where':{'id':_0x45d79c['params']['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x1ce707,null))[_0xec40('0x35')](function(_0x282eaa){if(_0x282eaa){_0x45d79c[_0xec40('0x5e')]['FaxAccountId']=_0x282eaa['id'];return db[_0xec40('0x67')][_0xec40('0x5d')](_0x45d79c['body']);}})[_0xec40('0x35')](respondWithResult(_0x1ce707,null))[_0xec40('0x29')](handleError(_0x1ce707,null));};exports[_0xec40('0x68')]=function(_0x1d7c58,_0x1164f5,_0xe68fe0){var _0x13bda3={'raw':![],'where':{}};var _0x4a9e6a={};var _0x5b7c1c={'count':0x0,'rows':[]};return db[_0xec40('0x42')][_0xec40('0x69')]({'where':{'id':_0x1d7c58[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x1164f5,null))['then'](function(_0xe4d4fa){if(_0xe4d4fa){_0x4a9e6a[_0xec40('0x46')]=_[_0xec40('0x47')](db['Disposition']['rawAttributes']);_0x4a9e6a['query']=_[_0xec40('0x47')](_0x1d7c58[_0xec40('0x48')]);_0x4a9e6a['filters']=_[_0xec40('0x4b')](_0x4a9e6a[_0xec40('0x46')],_0x4a9e6a[_0xec40('0x48')]);_0x13bda3[_0xec40('0x4a')]=_[_0xec40('0x4b')](_0x4a9e6a[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x1d7c58[_0xec40('0x48')][_0xec40('0x4c')]));_0x13bda3[_0xec40('0x4a')]=_0x13bda3[_0xec40('0x4a')][_0xec40('0x4d')]?_0x13bda3['attributes']:_0x4a9e6a['model'];if(!_0x1d7c58[_0xec40('0x48')][_0xec40('0x6a')](_0xec40('0x4e'))){_0x13bda3['limit']=qs[_0xec40('0x4f')](_0x1d7c58[_0xec40('0x48')][_0xec40('0x4f')]);_0x13bda3[_0xec40('0x2d')]=qs[_0xec40('0x2d')](_0x1d7c58[_0xec40('0x48')][_0xec40('0x2d')]);}_0x13bda3[_0xec40('0x50')]=qs['sort'](_0x1d7c58[_0xec40('0x48')][_0xec40('0x51')]);_0x13bda3[_0xec40('0x54')]=qs[_0xec40('0x49')](_[_0xec40('0x52')](_0x1d7c58[_0xec40('0x48')],_0x4a9e6a[_0xec40('0x49')]));_0x13bda3['where'][_0xec40('0x6b')]=_0xe4d4fa['id'];if(_0x1d7c58[_0xec40('0x48')][_0xec40('0x53')]){_0x13bda3[_0xec40('0x54')]=_[_0xec40('0x55')](_0x13bda3[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x13bda3[_0xec40('0x4a')],function(_0x41cc62){var _0x4d16ba={};_0x4d16ba[_0x41cc62]={'$like':'%'+_0x1d7c58[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0x4d16ba;})});}_0x13bda3=_[_0xec40('0x55')]({},_0x13bda3,_0x1d7c58['options']);return db['Disposition'][_0xec40('0x2f')]({'where':_0x13bda3[_0xec40('0x54')]})['then'](function(_0x17625e){_0x5b7c1c[_0xec40('0x2f')]=_0x17625e;if(_0x1d7c58[_0xec40('0x48')][_0xec40('0x58')]){_0x13bda3[_0xec40('0x5c')]=[{'all':!![]}];}return db[_0xec40('0x67')]['findAll'](_0x13bda3);})['then'](function(_0x100fe7){_0x5b7c1c[_0xec40('0x5a')]=_0x100fe7;return _0x5b7c1c;});}})[_0xec40('0x35')](respondWithFilteredResult(_0x1164f5,_0x13bda3))[_0xec40('0x29')](handleError(_0x1164f5,null));};exports[_0xec40('0x6c')]=function(_0x187c53,_0x3d5ffd,_0x5b2c66){return db[_0xec40('0x42')][_0xec40('0x62')]({'where':{'id':_0x187c53[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x3d5ffd,null))['then'](function(_0x2924e6){if(_0x2924e6){return _0x2924e6[_0xec40('0x6c')](_0x187c53[_0xec40('0x48')][_0xec40('0x6d')]);}})[_0xec40('0x35')](respondWithStatusCode(_0x3d5ffd,null))['catch'](handleError(_0x3d5ffd,null));};exports['addAnswer']=function(_0x35305f,_0x1d2b9f,_0x1e15ec){if(_0x35305f[_0xec40('0x5e')]['id']){delete _0x35305f[_0xec40('0x5e')]['id'];}return db[_0xec40('0x42')][_0xec40('0x62')]({'where':{'id':_0x35305f[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x1d2b9f,null))[_0xec40('0x35')](function(_0x4721ad){if(_0x4721ad){_0x35305f[_0xec40('0x5e')][_0xec40('0x6b')]=_0x4721ad['id'];return db[_0xec40('0x6e')]['create'](_0x35305f[_0xec40('0x5e')]);}})[_0xec40('0x35')](respondWithResult(_0x1d2b9f,null))[_0xec40('0x29')](handleError(_0x1d2b9f,null));};exports[_0xec40('0x6f')]=function(_0x70782,_0x4c143c,_0x3b9b51){var _0x2827f2={'raw':![],'where':{}};var _0x583c8a={};var _0x386c51={'count':0x0,'rows':[]};return db[_0xec40('0x42')]['findOne']({'where':{'id':_0x70782['params']['id']}})['then'](handleEntityNotFound(_0x4c143c,null))[_0xec40('0x35')](function(_0x5bee19){if(_0x5bee19){_0x583c8a[_0xec40('0x46')]=_[_0xec40('0x47')](db[_0xec40('0x6e')][_0xec40('0x43')]);_0x583c8a['query']=_[_0xec40('0x47')](_0x70782[_0xec40('0x48')]);_0x583c8a[_0xec40('0x49')]=_[_0xec40('0x4b')](_0x583c8a['model'],_0x583c8a['query']);_0x2827f2[_0xec40('0x4a')]=_[_0xec40('0x4b')](_0x583c8a[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x70782[_0xec40('0x48')][_0xec40('0x4c')]));_0x2827f2[_0xec40('0x4a')]=_0x2827f2[_0xec40('0x4a')][_0xec40('0x4d')]?_0x2827f2['attributes']:_0x583c8a[_0xec40('0x46')];if(!_0x70782['query'][_0xec40('0x6a')](_0xec40('0x4e'))){_0x2827f2[_0xec40('0x4f')]=qs[_0xec40('0x4f')](_0x70782['query']['limit']);_0x2827f2['offset']=qs['offset'](_0x70782['query']['offset']);}_0x2827f2[_0xec40('0x50')]=qs[_0xec40('0x51')](_0x70782[_0xec40('0x48')][_0xec40('0x51')]);_0x2827f2[_0xec40('0x54')]=qs[_0xec40('0x49')](_['pick'](_0x70782['query'],_0x583c8a[_0xec40('0x49')]));_0x2827f2[_0xec40('0x54')]['FaxAccountId']=_0x5bee19['id'];if(_0x70782[_0xec40('0x48')][_0xec40('0x53')]){_0x2827f2[_0xec40('0x54')]=_[_0xec40('0x55')](_0x2827f2[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x2827f2[_0xec40('0x4a')],function(_0x2afa6d){var _0x3b8779={};_0x3b8779[_0x2afa6d]={'$like':'%'+_0x70782[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0x3b8779;})});}_0x2827f2=_[_0xec40('0x55')]({},_0x2827f2,_0x70782[_0xec40('0x57')]);return db[_0xec40('0x6e')][_0xec40('0x2f')]({'where':_0x2827f2[_0xec40('0x54')]})[_0xec40('0x35')](function(_0x4238dd){_0x386c51['count']=_0x4238dd;if(_0x70782[_0xec40('0x48')][_0xec40('0x58')]){_0x2827f2[_0xec40('0x5c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2827f2);})[_0xec40('0x35')](function(_0x1e3918){_0x386c51[_0xec40('0x5a')]=_0x1e3918;return _0x386c51;});}})[_0xec40('0x35')](respondWithFilteredResult(_0x4c143c,_0x2827f2))['catch'](handleError(_0x4c143c,null));};exports['removeAnswers']=function(_0xd2c851,_0x28aefd,_0x3e7bd6){return db[_0xec40('0x42')][_0xec40('0x62')]({'where':{'id':_0xd2c851['params']['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x28aefd,null))['then'](function(_0x51d84a){if(_0x51d84a){return _0x51d84a[_0xec40('0x70')](_0xd2c851['query'][_0xec40('0x6d')]);}})[_0xec40('0x35')](respondWithStatusCode(_0x28aefd,null))['catch'](handleError(_0x28aefd,null));};exports[_0xec40('0x71')]=function(_0x31f28d,_0x5b8e5e,_0x3c3d71){return db[_0xec40('0x72')][_0xec40('0x62')]({'where':{'id':_0x31f28d['params']['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x5b8e5e,null))[_0xec40('0x35')](function(_0x2721b5){if(_0x2721b5){return _0x2721b5['addInteraction'](_0x31f28d[_0xec40('0x5e')][_0xec40('0x6d')],_[_0xec40('0x73')](_0x31f28d[_0xec40('0x5e')],[_0xec40('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x5b8e5e,null))['catch'](handleError(_0x5b8e5e,null));};exports[_0xec40('0x74')]=function(_0x291d96,_0x4158a3,_0x15ac28){var _0x52b933={'raw':![],'where':{}};var _0x3e2939={};var _0x3415cd={'count':0x0,'rows':[]};return db['FaxAccount'][_0xec40('0x69')]({'where':{'id':_0x291d96[_0xec40('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4158a3,null))['then'](function(_0x504d45){if(_0x504d45){_0x3e2939['model']=_['keys'](db[_0xec40('0x72')]['rawAttributes']);_0x3e2939[_0xec40('0x48')]=_[_0xec40('0x47')](_0x291d96[_0xec40('0x48')]);_0x3e2939[_0xec40('0x49')]=_['intersection'](_0x3e2939[_0xec40('0x46')],_0x3e2939[_0xec40('0x48')]);_0x52b933['attributes']=_[_0xec40('0x4b')](_0x3e2939[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x291d96['query'][_0xec40('0x4c')]));_0x52b933['attributes']=_0x52b933[_0xec40('0x4a')][_0xec40('0x4d')]?_0x52b933[_0xec40('0x4a')]:_0x3e2939[_0xec40('0x46')];if(!_0x291d96[_0xec40('0x48')]['hasOwnProperty'](_0xec40('0x4e'))){_0x52b933[_0xec40('0x4f')]=qs[_0xec40('0x4f')](_0x291d96['query']['limit']);_0x52b933['offset']=qs['offset'](_0x291d96[_0xec40('0x48')][_0xec40('0x2d')]);}_0x52b933[_0xec40('0x50')]=qs[_0xec40('0x51')](_0x291d96[_0xec40('0x48')]['sort']);_0x52b933[_0xec40('0x54')]=qs[_0xec40('0x49')](_[_0xec40('0x52')](_0x291d96['query'],_0x3e2939[_0xec40('0x49')]));_0x52b933[_0xec40('0x54')][_0xec40('0x6b')]=_0x504d45['id'];if(_0x291d96[_0xec40('0x48')]['filter']){_0x52b933[_0xec40('0x54')]=_['merge'](_0x52b933[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x52b933[_0xec40('0x4a')],function(_0xa319e3){var _0xd790ce={};_0xd790ce[_0xa319e3]={'$like':'%'+_0x291d96[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0xd790ce;})});}_0x52b933=_[_0xec40('0x55')]({},_0x52b933,_0x291d96[_0xec40('0x57')]);return db[_0xec40('0x72')][_0xec40('0x2f')]({'where':_0x52b933[_0xec40('0x54')]})[_0xec40('0x35')](function(_0x582db7){_0x3415cd['count']=_0x582db7;if(_0x291d96[_0xec40('0x48')]['includeAll']){_0x52b933[_0xec40('0x5c')]=[{'model':db[_0xec40('0x75')],'as':_0xec40('0x76'),'required':![]},{'model':db[_0xec40('0x77')],'as':_0xec40('0x78'),'attributes':[_0xec40('0x3c'),_0xec40('0x79'),'internal'],'required':![]},{'model':db[_0xec40('0x7a')],'as':'Tags','attributes':['id',_0xec40('0x3c'),_0xec40('0x7b')],'where':_0x291d96[_0xec40('0x48')]['tag']?{'id':_0x291d96[_0xec40('0x48')][_0xec40('0x7c')]}:undefined,'required':_0x291d96[_0xec40('0x48')]['tag']?!![]:![]}];}return db[_0xec40('0x72')][_0xec40('0x59')](_0x52b933);})[_0xec40('0x35')](function(_0x2a4c7e){_0x3415cd[_0xec40('0x5a')]=_0x2a4c7e;return _0x3415cd;});}})[_0xec40('0x35')](respondWithFilteredResult(_0x4158a3,_0x52b933))[_0xec40('0x29')](handleError(_0x4158a3,null));};exports[_0xec40('0x7d')]=function(_0x5b052d,_0x1d5c91){var _0x53b53f=_0x5b052d[_0xec40('0x5b')]['id'];var _0xbe0c34=_0x5b052d[_0xec40('0x5e')];var _0x3738bb=0xc8;var _0xaffd92=null;return db[_0xec40('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0xec40('0x7f')][_0xec40('0x80')][_0xec40('0x81')]},function(_0x36199d){return db[_0xec40('0x42')][_0xec40('0x69')]({'where':{'id':_0x53b53f},'transaction':_0x36199d})[_0xec40('0x35')](function(_0x35aa9d){if(_0x35aa9d){return db[_0xec40('0x82')][_0xec40('0x39')]({'where':{'FaxAccountId':_0x53b53f},'transaction':_0x36199d})[_0xec40('0x35')](function(){var _0x287813=_[_0xec40('0x41')](_0xbe0c34,function(_0x42d2db){_0x42d2db[_0xec40('0x6b')]=_0x53b53f;return _0x42d2db;});return db[_0xec40('0x82')][_0xec40('0x83')](_0x287813,{'transaction':_0x36199d});});}else{_0x3738bb=0x194;_0xaffd92=[];}});})['then'](function(){if(_0x3738bb!==0x194){return db[_0xec40('0x82')][_0xec40('0x84')]({'where':{'FaxAccountId':_0x53b53f},'order':_0xec40('0x85')})[_0xec40('0x35')](function(_0xaa8638){_0xaffd92=_0xaa8638;});}})['catch'](function(_0x3b296c){_0x3738bb=0x1f4;logger['error'](_0x3b296c[_0xec40('0x3b')]);if(_0x3b296c[_0xec40('0x3c')]){delete _0x3b296c[_0xec40('0x3c')];}_0xaffd92=_0x3b296c;})[_0xec40('0x86')](function(){if(_0xaffd92===null){_0x1d5c91['sendStatus'](_0x3738bb);}else{if(_0x3738bb===0x1f4){_0x1d5c91[_0xec40('0x2b')](_0x3738bb)['send'](_0xaffd92);}else{_0x1d5c91[_0xec40('0x2b')](_0x3738bb)[_0xec40('0x2c')](_0xaffd92);}}});};exports[_0xec40('0x87')]=function(_0x386c0d,_0x5a5305,_0x9a85fc){var _0x5c46f5={};var _0x2c4cbd={};var _0x3569f3;var _0x4bb8fa;return db[_0xec40('0x42')][_0xec40('0x69')]({'where':{'id':_0x386c0d['params']['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x5a5305,null))[_0xec40('0x35')](function(_0x243a36){if(_0x243a36){_0x3569f3=_0x243a36;_0x2c4cbd[_0xec40('0x46')]=_[_0xec40('0x47')](db[_0xec40('0x82')][_0xec40('0x43')]);_0x2c4cbd[_0xec40('0x48')]=_['keys'](_0x386c0d[_0xec40('0x48')]);_0x2c4cbd[_0xec40('0x49')]=_[_0xec40('0x4b')](_0x2c4cbd[_0xec40('0x46')],_0x2c4cbd[_0xec40('0x48')]);_0x5c46f5['attributes']=_[_0xec40('0x4b')](_0x2c4cbd[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x386c0d[_0xec40('0x48')][_0xec40('0x4c')]));_0x5c46f5[_0xec40('0x4a')]=_0x5c46f5[_0xec40('0x4a')][_0xec40('0x4d')]?_0x5c46f5[_0xec40('0x4a')]:_0x2c4cbd[_0xec40('0x46')];_0x5c46f5[_0xec40('0x50')]=qs[_0xec40('0x51')](_0x386c0d[_0xec40('0x48')]['sort']);_0x5c46f5[_0xec40('0x54')]=qs[_0xec40('0x49')](_[_0xec40('0x52')](_0x386c0d[_0xec40('0x48')],_0x2c4cbd[_0xec40('0x49')]));if(_0x386c0d[_0xec40('0x48')][_0xec40('0x53')]){_0x5c46f5['where']=_[_0xec40('0x55')](_0x5c46f5[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x5c46f5[_0xec40('0x4a')],function(_0x29c28d){var _0x254d76={};_0x254d76[_0x29c28d]={'$like':'%'+_0x386c0d['query'][_0xec40('0x53')]+'%'};return _0x254d76;})});}_0x5c46f5=_['merge']({},_0x5c46f5,_0x386c0d[_0xec40('0x57')]);return _0x3569f3[_0xec40('0x87')](_0x5c46f5);}})[_0xec40('0x35')](function(_0x3e7c9a){if(_0x3e7c9a){_0x4bb8fa=_0x3e7c9a[_0xec40('0x4d')];if(!_0x386c0d[_0xec40('0x48')][_0xec40('0x6a')](_0xec40('0x4e'))){_0x5c46f5[_0xec40('0x4f')]=qs[_0xec40('0x4f')](_0x386c0d[_0xec40('0x48')][_0xec40('0x4f')]);_0x5c46f5[_0xec40('0x2d')]=qs['offset'](_0x386c0d[_0xec40('0x48')][_0xec40('0x2d')]);}return _0x3569f3[_0xec40('0x87')](_0x5c46f5);}})[_0xec40('0x35')](function(_0x25a5f7){if(_0x25a5f7){return _0x25a5f7?{'count':_0x4bb8fa,'rows':_0x25a5f7}:null;}})[_0xec40('0x35')](respondWithResult(_0x5a5305,null))[_0xec40('0x29')](handleError(_0x5a5305,null));};function Extension(_0x3dd919,_0xb29b69,_0x23a1e6,_0x5bc50a){this[_0xec40('0x88')]=_0xec40('0x89');this[_0xec40('0x8a')]=_0x3dd919[_0xec40('0x8b')];this[_0xec40('0x8c')]=_0x5bc50a;this[_0xec40('0x44')]=_0xec40('0x8d');this[_0xec40('0x8e')]=_0xec40('0x8f');this[_0xec40('0x6b')]=_0x3dd919['id'];this[_0xec40('0x85')]=_0xb29b69;this[_0xec40('0x90')]=_0x23a1e6;}function createExtensionsReciveFax(_0x3afba9){var _0x43d143=0x1;var _0xb12bbc=[];_0xb12bbc[_0xec40('0x91')](new Extension(_0x3afba9,_0x43d143,'',_0xec40('0x92')));_0x43d143+=0x1;_0xb12bbc[_0xec40('0x91')](new Extension(_0x3afba9,_0x43d143,'CDR(type)=inbound-fax',_0xec40('0x93')));_0x43d143+=0x1;for(var _0x897605 in _0x3afba9){if(_0x3afba9['hasOwnProperty'](_0x897605)&&(_0x897605===_0xec40('0x94')||_0x897605===_0xec40('0x8b')||_0x897605==='gateway'||_0x897605===_0xec40('0x95')||_0x897605===_0xec40('0x96')||_0x897605===_0xec40('0x97')||_0x897605===_0xec40('0x98')||_0x897605===_0xec40('0x99')||_0x897605===_0xec40('0x9a'))){_0xb12bbc['push'](new Extension(_0x3afba9,_0x43d143,'FAXOPT('+_0x897605+')='+_0x3afba9[_0x897605],_0xec40('0x93')));_0x43d143+=0x1;}}_0xb12bbc[_0xec40('0x91')](new Extension(_0x3afba9,_0x43d143,'6',_0xec40('0x9b')));_0x43d143+=0x1;_0xb12bbc['push'](new Extension(_0x3afba9,_0x43d143,'/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'));_0x43d143=0x0;return _0xb12bbc;}exports[_0xec40('0x9c')]=function(_0x10f85a,_0x531591,_0x1d8a1c){var _0x44aa6c;return db[_0xec40('0x7e')][_0xec40('0x9d')](function(_0x222839){return db['FaxAccount'][_0xec40('0x5d')](_0x10f85a[_0xec40('0x5e')],{'transaction':_0x222839})[_0xec40('0x35')](function(_0x17972d){_0x44aa6c=_0x17972d[_0xec40('0x36')]({'plain':!![]});return db[_0xec40('0x9e')][_0xec40('0x83')](createExtensionsReciveFax(_0x44aa6c),{'transaction':_0x222839});});})[_0xec40('0x35')](function(){return _0x44aa6c;})[_0xec40('0x35')](respondWithResult(_0x531591,null))[_0xec40('0x29')](handleError(_0x531591,null));};exports['updateAccountApplications']=function(_0x519d36,_0x39e544,_0x7a60b0){var _0x4530da;return db[_0xec40('0x7e')][_0xec40('0x9d')](function(_0x38d93a){return db[_0xec40('0x42')][_0xec40('0x34')](_0x519d36[_0xec40('0x5e')],{'where':{'id':_0x519d36[_0xec40('0x5e')]['id']},'transaction':_0x38d93a})[_0xec40('0x35')](function(_0x8c747){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x519d36[_0xec40('0x5e')]['id']},'transaction':_0x38d93a})['then'](function(_0x2a8d4b){return db[_0xec40('0x9e')][_0xec40('0x83')](createExtensionsReciveFax(_[_0xec40('0x73')](_0x519d36[_0xec40('0x5e')],[_0xec40('0x9f'),_0xec40('0x45'),_0xec40('0xa0'),_0xec40('0xa1'),_0xec40('0xa2'),_0xec40('0xa3')])),{'transaction':_0x38d93a});});});})[_0xec40('0x35')](function(){return db[_0xec40('0x42')]['findById'](_0x519d36[_0xec40('0x5e')]['id']);})[_0xec40('0x35')](respondWithResult(_0x39e544,null))[_0xec40('0x29')](handleError(_0x39e544,null));};exports[_0xec40('0xa4')]=function(_0x1aba5a,_0x5f55fa,_0xf0aac4){var _0x52f720={'raw':!![],'where':{}};var _0x4fc226={};var _0x236422={'count':0x0,'rows':[]};return db[_0xec40('0x42')][_0xec40('0x69')]({'where':{'id':_0x1aba5a[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x5f55fa,null))[_0xec40('0x35')](function(_0x4c220f){if(_0x4c220f){_0x4fc226[_0xec40('0x46')]=_[_0xec40('0x47')](db[_0xec40('0xa5')][_0xec40('0x43')]);_0x4fc226['query']=_[_0xec40('0x47')](_0x1aba5a[_0xec40('0x48')]);_0x4fc226[_0xec40('0x49')]=_[_0xec40('0x4b')](_0x4fc226['model'],_0x4fc226[_0xec40('0x48')]);_0x52f720['attributes']=_['intersection'](_0x4fc226[_0xec40('0x46')],qs['fields'](_0x1aba5a[_0xec40('0x48')]['fields']));_0x52f720['attributes']=_0x52f720[_0xec40('0x4a')][_0xec40('0x4d')]?_0x52f720[_0xec40('0x4a')]:_0x4fc226[_0xec40('0x46')];if(!_0x1aba5a['query'][_0xec40('0x6a')](_0xec40('0x4e'))){_0x52f720[_0xec40('0x4f')]=qs[_0xec40('0x4f')](_0x1aba5a[_0xec40('0x48')]['limit']);_0x52f720[_0xec40('0x2d')]=qs['offset'](_0x1aba5a['query'][_0xec40('0x2d')]);}_0x52f720['order']=qs[_0xec40('0x51')](_0x1aba5a[_0xec40('0x48')][_0xec40('0x51')]);_0x52f720[_0xec40('0x54')]=qs[_0xec40('0x49')](_['pick'](_0x1aba5a[_0xec40('0x48')],_0x4fc226['filters']));_0x52f720[_0xec40('0x54')][_0xec40('0x6b')]=_0x4c220f['id'];if(_0x1aba5a[_0xec40('0x48')]['filter']){_0x52f720[_0xec40('0x54')]=_[_0xec40('0x55')](_0x52f720[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x52f720['attributes'],function(_0x1b18be){var _0x54a67a={};_0x54a67a[_0x1b18be]={'$like':'%'+_0x1aba5a[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0x54a67a;})});}if(_0x1aba5a[_0xec40('0x48')][_0xec40('0xa6')]){var _0x4a8a4a=_0x1aba5a['query'][_0xec40('0xa6')][_0xec40('0xa7')](',');var _0x4764ce={};_0x4764ce[_0x4a8a4a[0x0]]={'$gte':moment(_0x4a8a4a[0x1])['format'](_0xec40('0xa8'))};_0x52f720['where']=_[_0xec40('0x55')](_0x52f720[_0xec40('0x54')],_0x4764ce);}_0x52f720=_[_0xec40('0x55')]({},_0x52f720,_0x1aba5a[_0xec40('0x57')]);return db['FaxMessage'][_0xec40('0x2f')]({'where':_0x52f720[_0xec40('0x54')]})['then'](function(_0x5db74){_0x236422['count']=_0x5db74;if(_0x1aba5a[_0xec40('0x48')]['includeAll']){_0x52f720[_0xec40('0x5c')]=[{'all':!![]}];}return db[_0xec40('0xa5')]['findAll'](_0x52f720);})[_0xec40('0x35')](function(_0x967985){_0x236422[_0xec40('0x5a')]=_0x967985;return _0x236422;});}})['then'](respondWithFilteredResult(_0x5f55fa,_0x52f720))[_0xec40('0x29')](handleError(_0x5f55fa,null));};exports[_0xec40('0x3d')]=function(_0x1fa3b5,_0x556efc,_0x28ec4e){var _0x143991,_0x477d79={},_0x3787d2;if(_0x1fa3b5['body']['to']){_0x3787d2=_0x1fa3b5[_0xec40('0x5e')]['to'][0x0];}return db['FaxAccount'][_0xec40('0x62')]({'where':{'id':_0x1fa3b5[_0xec40('0x5b')]['id']},'include':[{'model':db[_0xec40('0xa9')],'as':_0xec40('0xaa'),'include':[{'model':db[_0xec40('0x75')],'as':_0xec40('0xab'),'where':{'fax':_0x3787d2},'limit':0x1,'order':[['updatedAt',_0xec40('0xac')]]}]}]})['then'](handleEntityNotFound(_0x556efc,null))[_0xec40('0x35')](function(_0xcf726){_0x143991=_0xcf726;if(_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')]&&_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][_0xec40('0x4d')]){for(var _0x501519=0x0;_0x501519<_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][_0xec40('0x4d')];_0x501519+=0x1){_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][_0x501519]={'filename':_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][_0x501519][_0xec40('0x3c')],'id':_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][_0x501519]['id'],'path':path['join'](config['root'],_0xec40('0xae'),_0x1fa3b5[_0xec40('0x5e')]['attachments'][_0x501519][_0xec40('0xaf')])};}}return respondWithRpcPromise(_0xec40('0xb0'),_0xec40('0xb0'),{'FaxAccountId':_[_0xec40('0xb1')](_0x1fa3b5['params']['id'])?undefined:_0x1fa3b5[_0xec40('0x5b')]['id'],'path':_[_0xec40('0xb1')](_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][0x0]['path'])?undefined:_0x1fa3b5[_0xec40('0x5e')]['attachments'][0x0]['path'],'fax':_[_0xec40('0xb1')](_0x1fa3b5['body']['to'][0x0])?undefined:_0x1fa3b5[_0xec40('0x5e')]['to'][0x0]},client9002);})[_0xec40('0x35')](function(){if(_0x143991){if(_['isNil'](_0x1fa3b5['body'][_0xec40('0xb2')])){_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xb2')]=util[_0xec40('0xb3')](_0xec40('0xb4'),_0x143991[_0xec40('0x3c')],_0x143991['fax']);}if(_0x143991[_0xec40('0xaa')]){if(_0x143991['List'][_0xec40('0xab')][_0xec40('0x4d')]){return _0x143991[_0xec40('0xaa')][_0xec40('0xab')][0x0];}else{return db['CmContact'][_0xec40('0x5d')](_['defaults'](_0x1fa3b5['body'],{'firstName':_0x1fa3b5['body']['to'][0x0],'phone':_0x1fa3b5[_0xec40('0x5e')]['to'][0x0],'fax':_0x1fa3b5[_0xec40('0x5e')]['to'][0x0],'ListId':_0x143991['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xec40('0xb5'));}})[_0xec40('0x35')](function(_0x217367){if(_0x217367){return db[_0xec40('0x72')][_0xec40('0x62')]({'where':{'ContactId':_0x217367['id'],'closed':![],'FaxAccountId':_0x143991['id']}})[_0xec40('0x35')](function(_0x12d631){if(_0x12d631){return[_0x12d631,![]];}return db[_0xec40('0x72')][_0xec40('0x5d')]({'UserId':_0x1fa3b5[_0xec40('0x5f')]['id'],'ContactId':_0x217367['id'],'FaxAccountId':_0x143991['id'],'fax':_0x1fa3b5[_0xec40('0x5e')]['to'][0x0],'firstMsgDirection':_0xec40('0xb6'),'Messages':[_[_0xec40('0x55')](_0x1fa3b5[_0xec40('0x5e')],{'read':![],'body':_0x1fa3b5['body'][_0xec40('0xad')][0x0]['filename'],'FaxAccountId':_0x143991['id'],'UserId':_0x1fa3b5['user']['id'],'ContactId':_0x217367['id'],'AttachmentId':_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xec40('0xa5')],'as':_0xec40('0xb7')}]})[_0xec40('0x35')](function(_0x4ac9ee){return[_0x4ac9ee,!![]];});});}else{throw new Error(_0xec40('0xb8'));}})[_0xec40('0xb9')](function(_0x3551d4,_0x306e21){if(_0x306e21){return _0x3551d4;}return db['FaxMessage'][_0xec40('0x5d')]({'direction':'out','read':![],'body':_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][0x0][_0xec40('0xba')],'FaxAccountId':_0x143991['id'],'FaxInteractionId':_0x3551d4['id'],'UserId':_0x1fa3b5[_0xec40('0x5f')]['id'],'ContactId':_0x3551d4[_0xec40('0xbb')],'AttachmentId':_0x1fa3b5[_0xec40('0x5e')][_0xec40('0xad')][0x0]['id']})[_0xec40('0x35')](function(_0x137bd9){_0x3551d4[_0xec40('0xbc')][_0xec40('0xb7')]=[];_0x3551d4[_0xec40('0xbc')][_0xec40('0xb7')]['push'](_0x137bd9[_0xec40('0xbc')]);return _0x3551d4;});})[_0xec40('0x35')](function(_0x4905e1){respondWithRpcPromise(_0xec40('0xbd'),_0xec40('0xbd'),{'FaxAccountId':_[_0xec40('0xb1')](_0x1fa3b5[_0xec40('0x5b')]['id'])?undefined:_0x1fa3b5[_0xec40('0x5b')]['id'],'path':_[_0xec40('0xb1')](_0x1fa3b5[_0xec40('0x5e')]['attachments'][0x0][_0xec40('0x8')])?undefined:_0x1fa3b5[_0xec40('0x5e')]['attachments'][0x0][_0xec40('0x8')],'fax':_[_0xec40('0xb1')](_0x1fa3b5[_0xec40('0x5e')]['to'][0x0])?undefined:_0x1fa3b5['body']['to'][0x0],'AttachmentId':_0x1fa3b5['body'][_0xec40('0xad')][0x0]['id']},client9002)[_0xec40('0x35')](function(_0x120109){logger[_0xec40('0x21')](_0xec40('0xbe'),_0x120109);})[_0xec40('0x29')](function(_0x165518){logger[_0xec40('0x21')]('SendFaxRpc,\x20%s',_0x165518);});return _0x4905e1;})[_0xec40('0x35')](respondWithResult(_0x556efc,null))[_0xec40('0x29')](handleError(_0x556efc,null));};exports[_0xec40('0xbf')]=function(_0x113b33,_0x36d4bf,_0x23b538){return db['FaxAccount'][_0xec40('0x62')]({'where':{'id':_0x113b33[_0xec40('0x5b')]['id']}})['then'](handleEntityNotFound(_0x36d4bf,null))['then'](function(_0x5847be){if(_0x5847be){return _0x5847be['addAgents'](_0x113b33['body'][_0xec40('0x6d')],_[_0xec40('0x73')](_0x113b33['body'],[_0xec40('0x6d'),'id'])||{})[_0xec40('0xb9')](function(_0x1c36a8){for(var _0xa7e376=0x0;_0xa7e376<_0x113b33[_0xec40('0x5e')]['ids'][_0xec40('0x4d')];_0xa7e376+=0x1){socket[_0xec40('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x113b33[_0xec40('0x5e')]['ids'][_0xa7e376]),'FaxAccountId':Number(_0x113b33[_0xec40('0x5b')]['id'])});}return _0x1c36a8;});}})['then'](respondWithResult(_0x36d4bf,null))[_0xec40('0x29')](handleError(_0x36d4bf,null));};exports[_0xec40('0xc1')]=function(_0x40ec88,_0x205588,_0xd81d3a){return db[_0xec40('0x42')]['find']({'where':{'id':_0x40ec88[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x205588,null))[_0xec40('0x35')](function(_0x14ad94){if(_0x14ad94){return _0x14ad94[_0xec40('0xc1')](_0x40ec88[_0xec40('0x48')][_0xec40('0x6d')])['then'](function(){if(_[_0xec40('0xc2')](_0x40ec88[_0xec40('0x48')][_0xec40('0x6d')])){for(var _0x4ff952=0x0;_0x4ff952<_0x40ec88['query'][_0xec40('0x6d')][_0xec40('0x4d')];_0x4ff952+=0x1){socket[_0xec40('0xc0')](_0xec40('0xc3'),{'UserId':Number(_0x40ec88[_0xec40('0x48')][_0xec40('0x6d')][_0x4ff952]),'FaxAccountId':Number(_0x40ec88[_0xec40('0x5b')]['id'])});}}else{socket[_0xec40('0xc0')](_0xec40('0xc3'),{'UserId':Number(_0x40ec88[_0xec40('0x48')][_0xec40('0x6d')]),'FaxAccountId':Number(_0x40ec88[_0xec40('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x205588,null))[_0xec40('0x29')](handleError(_0x205588,null));};exports[_0xec40('0xc4')]=function(_0x2ec582,_0x3e96c5,_0x276de5){var _0x5db08c={};var _0xa0020a={};var _0x4827f0;var _0x4bc175;return db[_0xec40('0x42')][_0xec40('0x69')]({'where':{'id':_0x2ec582[_0xec40('0x5b')]['id']}})[_0xec40('0x35')](handleEntityNotFound(_0x3e96c5,null))[_0xec40('0x35')](function(_0x33e0f4){if(_0x33e0f4){_0x4827f0=_0x33e0f4;_0xa0020a['model']=_[_0xec40('0x47')](db[_0xec40('0x77')][_0xec40('0x43')]);_0xa0020a['query']=_[_0xec40('0x47')](_0x2ec582[_0xec40('0x48')]);_0xa0020a[_0xec40('0x49')]=_[_0xec40('0x4b')](_0xa0020a[_0xec40('0x46')],_0xa0020a[_0xec40('0x48')]);_0x5db08c['attributes']=_[_0xec40('0x4b')](_0xa0020a[_0xec40('0x46')],qs[_0xec40('0x4c')](_0x2ec582[_0xec40('0x48')][_0xec40('0x4c')]));_0x5db08c[_0xec40('0x4a')]=_0x5db08c[_0xec40('0x4a')][_0xec40('0x4d')]?_0x5db08c[_0xec40('0x4a')]:_0xa0020a[_0xec40('0x46')];_0x5db08c[_0xec40('0x50')]=qs['sort'](_0x2ec582[_0xec40('0x48')][_0xec40('0x51')]);_0x5db08c[_0xec40('0x54')]=qs[_0xec40('0x49')](_[_0xec40('0x52')](_0x2ec582[_0xec40('0x48')],_0xa0020a['filters']));if(_0x2ec582[_0xec40('0x48')]['filter']){_0x5db08c[_0xec40('0x54')]=_[_0xec40('0x55')](_0x5db08c[_0xec40('0x54')],{'$or':_[_0xec40('0x41')](_0x5db08c['attributes'],function(_0x32f1c6){var _0x2838e3={};_0x2838e3[_0x32f1c6]={'$like':'%'+_0x2ec582[_0xec40('0x48')][_0xec40('0x53')]+'%'};return _0x2838e3;})});}_0x5db08c=_[_0xec40('0x55')]({},_0x5db08c,_0x2ec582[_0xec40('0x57')]);return _0x4827f0['getAgents'](_0x5db08c);}})[_0xec40('0x35')](function(_0x2f2b5f){if(_0x2f2b5f){_0x4bc175=_0x2f2b5f['length'];if(!_0x2ec582['query'][_0xec40('0x6a')]('nolimit')){_0x5db08c[_0xec40('0x4f')]=qs[_0xec40('0x4f')](_0x2ec582[_0xec40('0x48')][_0xec40('0x4f')]);_0x5db08c['offset']=qs['offset'](_0x2ec582[_0xec40('0x48')][_0xec40('0x2d')]);}return _0x4827f0['getAgents'](_0x5db08c);}})[_0xec40('0x35')](function(_0x3f1c6e){if(_0x3f1c6e){return _0x3f1c6e?{'count':_0x4bc175,'rows':_0x3f1c6e}:null;}})[_0xec40('0x35')](respondWithResult(_0x3e96c5,null))[_0xec40('0x29')](handleError(_0x3e96c5,null));}; \ No newline at end of file +var _0x43bd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','./faxAccount.socket','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','then','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','update','body','find','describe','addDisposition','Disposition','getDispositions','FaxAccountId','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','path','from','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x2254f3,_0x36ed5c){var _0x2e3ec5=function(_0x1a2c51){while(--_0x1a2c51){_0x2254f3['push'](_0x2254f3['shift']());}};_0x2e3ec5(++_0x36ed5c);}(_0x43bd,0xb7));var _0xd43b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x43bd[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xd43b('0x0'));var rimraf=require(_0xd43b('0x1'));var zipdir=require(_0xd43b('0x2'));var jsonpatch=require(_0xd43b('0x3'));var rp=require(_0xd43b('0x4'));var moment=require(_0xd43b('0x5'));var BPromise=require(_0xd43b('0x6'));var Mustache=require(_0xd43b('0x7'));var util=require(_0xd43b('0x8'));var path=require('path');var sox=require(_0xd43b('0x9'));var csv=require('to-csv');var ejs=require(_0xd43b('0xa'));var fs=require('fs');var fs_extra=require(_0xd43b('0xb'));var _=require(_0xd43b('0xc'));var squel=require(_0xd43b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd43b('0xe'));var deskjs=require(_0xd43b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd43b('0x10'));var Papa=require(_0xd43b('0x11'));var Redis=require(_0xd43b('0x12'));var authService=require(_0xd43b('0x13'));var qs=require(_0xd43b('0x14'));var as=require(_0xd43b('0x15'));var hardwareService=require(_0xd43b('0x16'));var logger=require(_0xd43b('0x17'))(_0xd43b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd43b('0x19'));var db=require(_0xd43b('0x1a'))['db'];config[_0xd43b('0x1b')]=_[_0xd43b('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd43b('0x1b')]));require(_0xd43b('0x1d'))['register'](socket);var jayson=require(_0xd43b('0x1e'));var client=jayson[_0xd43b('0x1f')][_0xd43b('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xd43b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xbc7755,_0x290cb7,_0x1a3e7d,_0x2fbfc5){return new BPromise(function(_0x29d9a3,_0x41ab71){var _0x2c91d5=_0x2fbfc5||client;return _0x2c91d5[_0xd43b('0x21')](_0xbc7755,_0x1a3e7d)['then'](function(_0x4a79b8){logger['info'](_0xd43b('0x22'),_0x290cb7,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x290cb7,'request\x20sent',JSON[_0xd43b('0x23')](_0x4a79b8));if(_0x4a79b8[_0xd43b('0x24')]){if(_0x4a79b8[_0xd43b('0x24')]['code']===0x1f4){logger[_0xd43b('0x24')]('FaxAccount,\x20%s,\x20%s',_0x290cb7,_0x4a79b8['error'][_0xd43b('0x25')]);return _0x41ab71(_0x4a79b8['error'][_0xd43b('0x25')]);}logger[_0xd43b('0x24')]('FaxAccount,\x20%s,\x20%s',_0x290cb7,_0x4a79b8[_0xd43b('0x24')]['message']);return _0x29d9a3(_0x4a79b8[_0xd43b('0x24')][_0xd43b('0x25')]);}else{logger[_0xd43b('0x26')](_0xd43b('0x22'),_0x290cb7,_0xd43b('0x27'));_0x29d9a3(_0x4a79b8[_0xd43b('0x28')][_0xd43b('0x25')]);}})['catch'](function(_0x13d72f){logger[_0xd43b('0x24')]('FaxAccount,\x20%s,\x20%s',_0x290cb7,_0x13d72f);_0x41ab71(_0x13d72f);});});}function respondWithStatusCode(_0x21fd9e,_0x37fe64){_0x37fe64=_0x37fe64||0xcc;return function(_0x591e6d){if(_0x591e6d){return _0x21fd9e[_0xd43b('0x29')](_0x37fe64);}return _0x21fd9e[_0xd43b('0x2a')](_0x37fe64)['end']();};}function respondWithResult(_0x403b46,_0x3b3bf4){_0x3b3bf4=_0x3b3bf4||0xc8;return function(_0xba0c9f){if(_0xba0c9f){return _0x403b46[_0xd43b('0x2a')](_0x3b3bf4)[_0xd43b('0x2b')](_0xba0c9f);}};}function respondWithFilteredResult(_0xc7db91,_0x219a4d){return function(_0x588836){if(_0x588836){var _0x255449=typeof _0x219a4d[_0xd43b('0x2c')]==='undefined'&&typeof _0x219a4d[_0xd43b('0x2d')]==='undefined';var _0x272cd1=_0x588836[_0xd43b('0x2e')];var _0xb5b2e1=_0x255449?0x0:_0x219a4d[_0xd43b('0x2c')];var _0x7a7baa=_0x255449?_0x588836[_0xd43b('0x2e')]:_0x219a4d[_0xd43b('0x2c')]+_0x219a4d[_0xd43b('0x2d')];var _0x3467ca;if(_0x7a7baa>=_0x272cd1){_0x7a7baa=_0x272cd1;_0x3467ca=0xc8;}else{_0x3467ca=0xce;}_0xc7db91['status'](_0x3467ca);return _0xc7db91[_0xd43b('0x2f')](_0xd43b('0x30'),_0xb5b2e1+'-'+_0x7a7baa+'/'+_0x272cd1)[_0xd43b('0x2b')](_0x588836);}return null;};}function patchUpdates(_0x1e1d45){return function(_0x30abe8){try{jsonpatch[_0xd43b('0x31')](_0x30abe8,_0x1e1d45,!![]);}catch(_0x26ed30){return BPromise['reject'](_0x26ed30);}return _0x30abe8[_0xd43b('0x32')]();};}function saveUpdates(_0x288dc8,_0x505cb1){return function(_0x4dd988){if(_0x4dd988){return _0x4dd988['update'](_0x288dc8)[_0xd43b('0x33')](function(_0x1efb5f){return _0x1efb5f;});}return null;};}function removeEntity(_0x248e07,_0x578abf){return function(_0xfcf585){if(_0xfcf585){return _0xfcf585['destroy']()[_0xd43b('0x33')](function(){var _0x23f360=_0xfcf585['get']({'plain':!![]});var _0x401937=_0xd43b('0x34');return db[_0xd43b('0x35')][_0xd43b('0x36')]({'where':{'type':_0x401937,'resourceId':_0x23f360['id']}})[_0xd43b('0x33')](function(){return _0xfcf585;});})[_0xd43b('0x33')](function(){_0x248e07[_0xd43b('0x2a')](0xcc)[_0xd43b('0x37')]();});}};}function handleEntityNotFound(_0x18ae49,_0x243a24){return function(_0x48187f){if(!_0x48187f){_0x18ae49[_0xd43b('0x29')](0x194);}return _0x48187f;};}function handleError(_0x5a1977,_0x50efa6){_0x50efa6=_0x50efa6||0x1f4;return function(_0x18a4c6){logger['error'](_0x18a4c6[_0xd43b('0x38')]);if(_0x18a4c6['name']){delete _0x18a4c6[_0xd43b('0x39')];}_0x5a1977['status'](_0x50efa6)[_0xd43b('0x3a')](_0x18a4c6);};}exports['index']=function(_0x22e32f,_0x3c292d){var _0x5c0c4a={'include':[{'model':db[_0xd43b('0x3b')],'as':_0xd43b('0x3c')}]},_0x19032e={},_0x48e462={'count':0x0,'rows':[]};var _0x576bfd=_['map'](db[_0xd43b('0x3d')][_0xd43b('0x3e')],function(_0x53d3da){return{'name':_0x53d3da[_0xd43b('0x3f')],'type':_0x53d3da[_0xd43b('0x40')][_0xd43b('0x41')]};});_0x19032e[_0xd43b('0x42')]=_[_0xd43b('0x43')](_0x576bfd,'name');_0x19032e['query']=_[_0xd43b('0x44')](_0x22e32f['query']);_0x19032e[_0xd43b('0x45')]=_['intersection'](_0x19032e['model'],_0x19032e['query']);_0x5c0c4a[_0xd43b('0x46')]=_[_0xd43b('0x47')](_0x19032e['model'],qs[_0xd43b('0x48')](_0x22e32f[_0xd43b('0x49')]['fields']));_0x5c0c4a['attributes']=_0x5c0c4a['attributes'][_0xd43b('0x4a')]?_0x5c0c4a['attributes']:_0x19032e[_0xd43b('0x42')];if(!_0x22e32f[_0xd43b('0x49')][_0xd43b('0x4b')](_0xd43b('0x4c'))){_0x5c0c4a['limit']=qs[_0xd43b('0x2d')](_0x22e32f[_0xd43b('0x49')][_0xd43b('0x2d')]);_0x5c0c4a[_0xd43b('0x2c')]=qs[_0xd43b('0x2c')](_0x22e32f[_0xd43b('0x49')][_0xd43b('0x2c')]);}_0x5c0c4a[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x22e32f[_0xd43b('0x49')][_0xd43b('0x4e')]);_0x5c0c4a[_0xd43b('0x4f')]=qs[_0xd43b('0x45')](_[_0xd43b('0x50')](_0x22e32f[_0xd43b('0x49')],_0x19032e[_0xd43b('0x45')]),_0x576bfd);if(_0x22e32f['query'][_0xd43b('0x51')]){_0x5c0c4a[_0xd43b('0x4f')]=_['merge'](_0x5c0c4a[_0xd43b('0x4f')],{'$or':_['map'](_0x576bfd,function(_0x195af4){if(_0x195af4['type']!==_0xd43b('0x52')){var _0x3e14ab={};_0x3e14ab[_0x195af4['name']]={'$like':'%'+_0x22e32f[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0x3e14ab;}})});}_0x5c0c4a=_['merge']({},_0x5c0c4a,_0x22e32f[_0xd43b('0x53')]);var _0x1f4d22={'where':_0x5c0c4a[_0xd43b('0x4f')]};return db[_0xd43b('0x3d')][_0xd43b('0x2e')](_0x1f4d22)[_0xd43b('0x33')](function(_0x1a48dd){_0x48e462['count']=_0x1a48dd;if(_0x22e32f[_0xd43b('0x49')][_0xd43b('0x54')]){_0x5c0c4a[_0xd43b('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0xd43b('0x56')](_0x5c0c4a);})['then'](function(_0x34b679){_0x48e462[_0xd43b('0x57')]=_0x34b679;return _0x48e462;})[_0xd43b('0x33')](respondWithFilteredResult(_0x3c292d,_0x5c0c4a))[_0xd43b('0x58')](handleError(_0x3c292d,null));};exports[_0xd43b('0x59')]=function(_0x5b385a,_0x57fefb){var _0x13188e={'raw':![],'where':{'id':_0x5b385a[_0xd43b('0x5a')]['id']},'include':[{'model':db[_0xd43b('0x3b')],'as':_0xd43b('0x3c')}]},_0x5ce312={};_0x5ce312[_0xd43b('0x42')]=_[_0xd43b('0x44')](db[_0xd43b('0x3d')][_0xd43b('0x3e')]);_0x5ce312[_0xd43b('0x49')]=_[_0xd43b('0x44')](_0x5b385a[_0xd43b('0x49')]);_0x5ce312[_0xd43b('0x45')]=_[_0xd43b('0x47')](_0x5ce312['model'],_0x5ce312[_0xd43b('0x49')]);_0x13188e[_0xd43b('0x46')]=_[_0xd43b('0x47')](_0x5ce312['model'],qs['fields'](_0x5b385a[_0xd43b('0x49')][_0xd43b('0x48')]));_0x13188e[_0xd43b('0x46')]=_0x13188e[_0xd43b('0x46')][_0xd43b('0x4a')]?_0x13188e['attributes']:_0x5ce312[_0xd43b('0x42')];if(_0x5b385a[_0xd43b('0x49')][_0xd43b('0x54')]){_0x13188e[_0xd43b('0x55')]=[{'all':!![]}];}_0x13188e=_[_0xd43b('0x5b')]({},_0x13188e,_0x5b385a[_0xd43b('0x53')]);return db['FaxAccount']['find'](_0x13188e)['then'](handleEntityNotFound(_0x57fefb,null))[_0xd43b('0x33')](respondWithResult(_0x57fefb,null))[_0xd43b('0x58')](handleError(_0x57fefb,null));};exports['create']=function(_0x2dd310,_0x168b21){return db['FaxAccount'][_0xd43b('0x5c')](_0x2dd310['body'],{})[_0xd43b('0x33')](function(_0x328a25){var _0x432809=_0x2dd310[_0xd43b('0x5d')]['get']({'plain':!![]});if(!_0x432809)throw new Error(_0xd43b('0x5e'));if(_0x432809[_0xd43b('0x5f')]===_0xd43b('0x5d')){var _0x190991=_0x328a25[_0xd43b('0x60')]({'plain':!![]});var _0x313c22=_0xd43b('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x313c22,'userProfileId':_0x432809[_0xd43b('0x61')]},'raw':!![]})['then'](function(_0x307cdf){if(_0x307cdf&&_0x307cdf[_0xd43b('0x62')]===0x0){return db[_0xd43b('0x35')][_0xd43b('0x5c')]({'name':_0x190991[_0xd43b('0x39')],'resourceId':_0x190991['id'],'type':_0x307cdf[_0xd43b('0x39')],'sectionId':_0x307cdf['id']},{})['then'](function(){return _0x328a25;});}else{return _0x328a25;}})[_0xd43b('0x58')](function(_0x37c55e){logger[_0xd43b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37c55e);throw _0x37c55e;});}return _0x328a25;})[_0xd43b('0x33')](respondWithResult(_0x168b21,0xc9))['catch'](handleError(_0x168b21,null));};exports[_0xd43b('0x63')]=function(_0x307564,_0x3ee5d3){if(_0x307564[_0xd43b('0x64')]['id']){delete _0x307564[_0xd43b('0x64')]['id'];}return db[_0xd43b('0x3d')]['find']({'where':{'id':_0x307564['params']['id']},'include':[{'model':db[_0xd43b('0x3b')],'as':_0xd43b('0x3c')}]})[_0xd43b('0x33')](handleEntityNotFound(_0x3ee5d3,null))[_0xd43b('0x33')](saveUpdates(_0x307564[_0xd43b('0x64')],null))[_0xd43b('0x33')](respondWithResult(_0x3ee5d3,null))[_0xd43b('0x58')](handleError(_0x3ee5d3,null));};exports['destroy']=function(_0x48e40f,_0x367860){return db[_0xd43b('0x3d')][_0xd43b('0x65')]({'where':{'id':_0x48e40f[_0xd43b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x367860,null))['then'](removeEntity(_0x367860,null))[_0xd43b('0x58')](handleError(_0x367860,null));};exports['describe']=function(_0x5f84c1,_0x5b3ddf){return db['FaxAccount'][_0xd43b('0x66')]()[_0xd43b('0x33')](respondWithResult(_0x5b3ddf,null))[_0xd43b('0x58')](handleError(_0x5b3ddf,null));};exports[_0xd43b('0x67')]=function(_0x5719e0,_0x160324,_0x59fb34){if(_0x5719e0[_0xd43b('0x64')]['id']){delete _0x5719e0[_0xd43b('0x64')]['id'];}return db['FaxAccount'][_0xd43b('0x65')]({'where':{'id':_0x5719e0[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x160324,null))[_0xd43b('0x33')](function(_0xf9ac75){if(_0xf9ac75){_0x5719e0['body']['FaxAccountId']=_0xf9ac75['id'];return db[_0xd43b('0x68')]['create'](_0x5719e0[_0xd43b('0x64')]);}})['then'](respondWithResult(_0x160324,null))[_0xd43b('0x58')](handleError(_0x160324,null));};exports[_0xd43b('0x69')]=function(_0x203f6b,_0x553995,_0x3086fd){var _0xfdf1fb={'raw':![],'where':{}};var _0x55b9b0={};var _0x238fe8={'count':0x0,'rows':[]};return db[_0xd43b('0x3d')]['findOne']({'where':{'id':_0x203f6b[_0xd43b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x553995,null))[_0xd43b('0x33')](function(_0x580c1b){if(_0x580c1b){_0x55b9b0[_0xd43b('0x42')]=_[_0xd43b('0x44')](db[_0xd43b('0x68')][_0xd43b('0x3e')]);_0x55b9b0['query']=_[_0xd43b('0x44')](_0x203f6b[_0xd43b('0x49')]);_0x55b9b0['filters']=_[_0xd43b('0x47')](_0x55b9b0[_0xd43b('0x42')],_0x55b9b0[_0xd43b('0x49')]);_0xfdf1fb[_0xd43b('0x46')]=_['intersection'](_0x55b9b0[_0xd43b('0x42')],qs[_0xd43b('0x48')](_0x203f6b[_0xd43b('0x49')][_0xd43b('0x48')]));_0xfdf1fb['attributes']=_0xfdf1fb[_0xd43b('0x46')][_0xd43b('0x4a')]?_0xfdf1fb[_0xd43b('0x46')]:_0x55b9b0[_0xd43b('0x42')];if(!_0x203f6b[_0xd43b('0x49')]['hasOwnProperty'](_0xd43b('0x4c'))){_0xfdf1fb['limit']=qs[_0xd43b('0x2d')](_0x203f6b[_0xd43b('0x49')][_0xd43b('0x2d')]);_0xfdf1fb[_0xd43b('0x2c')]=qs[_0xd43b('0x2c')](_0x203f6b[_0xd43b('0x49')][_0xd43b('0x2c')]);}_0xfdf1fb[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x203f6b[_0xd43b('0x49')]['sort']);_0xfdf1fb[_0xd43b('0x4f')]=qs[_0xd43b('0x45')](_[_0xd43b('0x50')](_0x203f6b['query'],_0x55b9b0[_0xd43b('0x45')]));_0xfdf1fb[_0xd43b('0x4f')][_0xd43b('0x6a')]=_0x580c1b['id'];if(_0x203f6b[_0xd43b('0x49')][_0xd43b('0x51')]){_0xfdf1fb[_0xd43b('0x4f')]=_[_0xd43b('0x5b')](_0xfdf1fb[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0xfdf1fb['attributes'],function(_0x497358){var _0x15bbcb={};_0x15bbcb[_0x497358]={'$like':'%'+_0x203f6b[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0x15bbcb;})});}_0xfdf1fb=_[_0xd43b('0x5b')]({},_0xfdf1fb,_0x203f6b['options']);return db[_0xd43b('0x68')][_0xd43b('0x2e')]({'where':_0xfdf1fb[_0xd43b('0x4f')]})[_0xd43b('0x33')](function(_0x4415d8){_0x238fe8[_0xd43b('0x2e')]=_0x4415d8;if(_0x203f6b['query'][_0xd43b('0x54')]){_0xfdf1fb[_0xd43b('0x55')]=[{'all':!![]}];}return db[_0xd43b('0x68')][_0xd43b('0x56')](_0xfdf1fb);})['then'](function(_0x44b15){_0x238fe8[_0xd43b('0x57')]=_0x44b15;return _0x238fe8;});}})['then'](respondWithFilteredResult(_0x553995,_0xfdf1fb))['catch'](handleError(_0x553995,null));};exports[_0xd43b('0x6b')]=function(_0x59ac97,_0x2f5e56,_0x1b2665){return db[_0xd43b('0x3d')][_0xd43b('0x65')]({'where':{'id':_0x59ac97[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x2f5e56,null))['then'](function(_0x53dda7){if(_0x53dda7){return _0x53dda7[_0xd43b('0x6b')](_0x59ac97[_0xd43b('0x49')][_0xd43b('0x6c')]);}})[_0xd43b('0x33')](respondWithStatusCode(_0x2f5e56,null))[_0xd43b('0x58')](handleError(_0x2f5e56,null));};exports[_0xd43b('0x6d')]=function(_0x3fce17,_0x59374c,_0x42d17c){if(_0x3fce17['body']['id']){delete _0x3fce17[_0xd43b('0x64')]['id'];}return db[_0xd43b('0x3d')][_0xd43b('0x65')]({'where':{'id':_0x3fce17[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x59374c,null))[_0xd43b('0x33')](function(_0x25a393){if(_0x25a393){_0x3fce17[_0xd43b('0x64')][_0xd43b('0x6a')]=_0x25a393['id'];return db['CannedAnswer'][_0xd43b('0x5c')](_0x3fce17[_0xd43b('0x64')]);}})['then'](respondWithResult(_0x59374c,null))['catch'](handleError(_0x59374c,null));};exports[_0xd43b('0x6e')]=function(_0x3b8713,_0x5cd3d9,_0x5d1b20){var _0x507966={'raw':![],'where':{}};var _0x5c54c6={};var _0x199da6={'count':0x0,'rows':[]};return db[_0xd43b('0x3d')][_0xd43b('0x6f')]({'where':{'id':_0x3b8713[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x5cd3d9,null))[_0xd43b('0x33')](function(_0x34cc69){if(_0x34cc69){_0x5c54c6[_0xd43b('0x42')]=_[_0xd43b('0x44')](db[_0xd43b('0x70')][_0xd43b('0x3e')]);_0x5c54c6['query']=_[_0xd43b('0x44')](_0x3b8713['query']);_0x5c54c6[_0xd43b('0x45')]=_[_0xd43b('0x47')](_0x5c54c6[_0xd43b('0x42')],_0x5c54c6[_0xd43b('0x49')]);_0x507966['attributes']=_[_0xd43b('0x47')](_0x5c54c6[_0xd43b('0x42')],qs[_0xd43b('0x48')](_0x3b8713[_0xd43b('0x49')][_0xd43b('0x48')]));_0x507966[_0xd43b('0x46')]=_0x507966[_0xd43b('0x46')]['length']?_0x507966[_0xd43b('0x46')]:_0x5c54c6[_0xd43b('0x42')];if(!_0x3b8713['query'][_0xd43b('0x4b')](_0xd43b('0x4c'))){_0x507966[_0xd43b('0x2d')]=qs[_0xd43b('0x2d')](_0x3b8713[_0xd43b('0x49')][_0xd43b('0x2d')]);_0x507966[_0xd43b('0x2c')]=qs[_0xd43b('0x2c')](_0x3b8713['query'][_0xd43b('0x2c')]);}_0x507966[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x3b8713[_0xd43b('0x49')]['sort']);_0x507966[_0xd43b('0x4f')]=qs[_0xd43b('0x45')](_['pick'](_0x3b8713[_0xd43b('0x49')],_0x5c54c6[_0xd43b('0x45')]));_0x507966[_0xd43b('0x4f')][_0xd43b('0x6a')]=_0x34cc69['id'];if(_0x3b8713[_0xd43b('0x49')][_0xd43b('0x51')]){_0x507966[_0xd43b('0x4f')]=_[_0xd43b('0x5b')](_0x507966[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0x507966[_0xd43b('0x46')],function(_0xef91ac){var _0x1fff3c={};_0x1fff3c[_0xef91ac]={'$like':'%'+_0x3b8713[_0xd43b('0x49')]['filter']+'%'};return _0x1fff3c;})});}_0x507966=_[_0xd43b('0x5b')]({},_0x507966,_0x3b8713['options']);return db[_0xd43b('0x70')][_0xd43b('0x2e')]({'where':_0x507966[_0xd43b('0x4f')]})['then'](function(_0x228f75){_0x199da6['count']=_0x228f75;if(_0x3b8713[_0xd43b('0x49')][_0xd43b('0x54')]){_0x507966['include']=[{'all':!![]}];}return db[_0xd43b('0x70')][_0xd43b('0x56')](_0x507966);})[_0xd43b('0x33')](function(_0x55d0fc){_0x199da6[_0xd43b('0x57')]=_0x55d0fc;return _0x199da6;});}})[_0xd43b('0x33')](respondWithFilteredResult(_0x5cd3d9,_0x507966))[_0xd43b('0x58')](handleError(_0x5cd3d9,null));};exports[_0xd43b('0x71')]=function(_0x24b080,_0x3cf404,_0x32462c){return db[_0xd43b('0x3d')]['find']({'where':{'id':_0x24b080['params']['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x3cf404,null))['then'](function(_0x41715e){if(_0x41715e){return _0x41715e[_0xd43b('0x71')](_0x24b080[_0xd43b('0x49')][_0xd43b('0x6c')]);}})[_0xd43b('0x33')](respondWithStatusCode(_0x3cf404,null))[_0xd43b('0x58')](handleError(_0x3cf404,null));};exports[_0xd43b('0x72')]=function(_0x53030c,_0x118ab7,_0x2678f){return db[_0xd43b('0x73')][_0xd43b('0x65')]({'where':{'id':_0x53030c[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x118ab7,null))[_0xd43b('0x33')](function(_0x4c6c2b){if(_0x4c6c2b){return _0x4c6c2b[_0xd43b('0x72')](_0x53030c[_0xd43b('0x64')]['ids'],_[_0xd43b('0x74')](_0x53030c['body'],[_0xd43b('0x6c'),'id'])||{});}})[_0xd43b('0x33')](respondWithResult(_0x118ab7,null))[_0xd43b('0x58')](handleError(_0x118ab7,null));};exports[_0xd43b('0x75')]=function(_0x4cc930,_0x50e805,_0xd2b2a9){var _0x225e81={'raw':![],'where':{}};var _0x1ba05f={};var _0x2de87f={'count':0x0,'rows':[]};return db[_0xd43b('0x3d')]['findOne']({'where':{'id':_0x4cc930[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x50e805,null))[_0xd43b('0x33')](function(_0xf1b19e){if(_0xf1b19e){_0x1ba05f['model']=_[_0xd43b('0x44')](db['FaxInteraction']['rawAttributes']);_0x1ba05f['query']=_[_0xd43b('0x44')](_0x4cc930[_0xd43b('0x49')]);_0x1ba05f[_0xd43b('0x45')]=_['intersection'](_0x1ba05f[_0xd43b('0x42')],_0x1ba05f[_0xd43b('0x49')]);_0x225e81['attributes']=_[_0xd43b('0x47')](_0x1ba05f['model'],qs['fields'](_0x4cc930[_0xd43b('0x49')][_0xd43b('0x48')]));_0x225e81[_0xd43b('0x46')]=_0x225e81[_0xd43b('0x46')][_0xd43b('0x4a')]?_0x225e81[_0xd43b('0x46')]:_0x1ba05f['model'];if(!_0x4cc930[_0xd43b('0x49')]['hasOwnProperty'](_0xd43b('0x4c'))){_0x225e81[_0xd43b('0x2d')]=qs['limit'](_0x4cc930[_0xd43b('0x49')][_0xd43b('0x2d')]);_0x225e81['offset']=qs[_0xd43b('0x2c')](_0x4cc930[_0xd43b('0x49')][_0xd43b('0x2c')]);}_0x225e81[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x4cc930[_0xd43b('0x49')][_0xd43b('0x4e')]);_0x225e81[_0xd43b('0x4f')]=qs['filters'](_[_0xd43b('0x50')](_0x4cc930[_0xd43b('0x49')],_0x1ba05f[_0xd43b('0x45')]));_0x225e81[_0xd43b('0x4f')][_0xd43b('0x6a')]=_0xf1b19e['id'];if(_0x4cc930[_0xd43b('0x49')]['filter']){_0x225e81['where']=_['merge'](_0x225e81[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0x225e81[_0xd43b('0x46')],function(_0x11b468){var _0xcfeb36={};_0xcfeb36[_0x11b468]={'$like':'%'+_0x4cc930[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0xcfeb36;})});}_0x225e81=_[_0xd43b('0x5b')]({},_0x225e81,_0x4cc930[_0xd43b('0x53')]);return db[_0xd43b('0x73')][_0xd43b('0x2e')]({'where':_0x225e81[_0xd43b('0x4f')]})[_0xd43b('0x33')](function(_0x3cc7c6){_0x2de87f[_0xd43b('0x2e')]=_0x3cc7c6;if(_0x4cc930[_0xd43b('0x49')]['includeAll']){_0x225e81[_0xd43b('0x55')]=[{'model':db[_0xd43b('0x76')],'as':_0xd43b('0x77'),'required':![]},{'model':db[_0xd43b('0x78')],'as':_0xd43b('0x79'),'attributes':[_0xd43b('0x39'),'fullname',_0xd43b('0x7a')],'required':![]},{'model':db[_0xd43b('0x7b')],'as':'Tags','attributes':['id',_0xd43b('0x39'),'color'],'where':_0x4cc930[_0xd43b('0x49')][_0xd43b('0x7c')]?{'id':_0x4cc930[_0xd43b('0x49')][_0xd43b('0x7c')]}:undefined,'required':_0x4cc930[_0xd43b('0x49')]['tag']?!![]:![]}];}return db[_0xd43b('0x73')][_0xd43b('0x56')](_0x225e81);})[_0xd43b('0x33')](function(_0x4d9cd8){_0x2de87f[_0xd43b('0x57')]=_0x4d9cd8;return _0x2de87f;});}})[_0xd43b('0x33')](respondWithFilteredResult(_0x50e805,_0x225e81))[_0xd43b('0x58')](handleError(_0x50e805,null));};exports[_0xd43b('0x7d')]=function(_0x4dfc84,_0x45fe3b){var _0x437df1=_0x4dfc84['params']['id'];var _0x3d100e=_0x4dfc84[_0xd43b('0x64')];var _0x37105d=0xc8;var _0x575a11=null;return db['sequelize'][_0xd43b('0x7e')]({'isolationLevel':db[_0xd43b('0x7f')][_0xd43b('0x80')][_0xd43b('0x81')][_0xd43b('0x82')]},function(_0x12810d){return db[_0xd43b('0x3d')]['findOne']({'where':{'id':_0x437df1},'transaction':_0x12810d})[_0xd43b('0x33')](function(_0x560564){if(_0x560564){return db[_0xd43b('0x83')][_0xd43b('0x36')]({'where':{'FaxAccountId':_0x437df1},'transaction':_0x12810d})[_0xd43b('0x33')](function(){var _0xa3f79e=_['map'](_0x3d100e,function(_0x5b55e3){_0x5b55e3[_0xd43b('0x6a')]=_0x437df1;return _0x5b55e3;});return db[_0xd43b('0x83')][_0xd43b('0x84')](_0xa3f79e,{'transaction':_0x12810d});});}else{_0x37105d=0x194;_0x575a11=[];}});})[_0xd43b('0x33')](function(){if(_0x37105d!==0x194){return db[_0xd43b('0x83')][_0xd43b('0x85')]({'where':{'FaxAccountId':_0x437df1},'order':_0xd43b('0x86')})[_0xd43b('0x33')](function(_0x488df9){_0x575a11=_0x488df9;});}})[_0xd43b('0x58')](function(_0x232718){_0x37105d=0x1f4;logger[_0xd43b('0x24')](_0x232718[_0xd43b('0x38')]);if(_0x232718['name']){delete _0x232718[_0xd43b('0x39')];}_0x575a11=_0x232718;})['finally'](function(){if(_0x575a11===null){_0x45fe3b[_0xd43b('0x29')](_0x37105d);}else{if(_0x37105d===0x1f4){_0x45fe3b[_0xd43b('0x2a')](_0x37105d)['send'](_0x575a11);}else{_0x45fe3b['status'](_0x37105d)[_0xd43b('0x2b')](_0x575a11);}}});};exports['getApplications']=function(_0x12e27a,_0x34fa9b,_0x2e7781){var _0x1f8085={};var _0x6a6f7e={};var _0x3d9128;var _0x3d917f;return db['FaxAccount'][_0xd43b('0x6f')]({'where':{'id':_0x12e27a[_0xd43b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x34fa9b,null))[_0xd43b('0x33')](function(_0x6eca12){if(_0x6eca12){_0x3d9128=_0x6eca12;_0x6a6f7e[_0xd43b('0x42')]=_[_0xd43b('0x44')](db[_0xd43b('0x83')][_0xd43b('0x3e')]);_0x6a6f7e[_0xd43b('0x49')]=_[_0xd43b('0x44')](_0x12e27a['query']);_0x6a6f7e[_0xd43b('0x45')]=_[_0xd43b('0x47')](_0x6a6f7e[_0xd43b('0x42')],_0x6a6f7e[_0xd43b('0x49')]);_0x1f8085[_0xd43b('0x46')]=_[_0xd43b('0x47')](_0x6a6f7e[_0xd43b('0x42')],qs[_0xd43b('0x48')](_0x12e27a[_0xd43b('0x49')][_0xd43b('0x48')]));_0x1f8085['attributes']=_0x1f8085[_0xd43b('0x46')][_0xd43b('0x4a')]?_0x1f8085[_0xd43b('0x46')]:_0x6a6f7e[_0xd43b('0x42')];_0x1f8085[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x12e27a['query'][_0xd43b('0x4e')]);_0x1f8085[_0xd43b('0x4f')]=qs[_0xd43b('0x45')](_[_0xd43b('0x50')](_0x12e27a[_0xd43b('0x49')],_0x6a6f7e[_0xd43b('0x45')]));if(_0x12e27a[_0xd43b('0x49')][_0xd43b('0x51')]){_0x1f8085[_0xd43b('0x4f')]=_[_0xd43b('0x5b')](_0x1f8085[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0x1f8085[_0xd43b('0x46')],function(_0x56f20a){var _0x28f2e4={};_0x28f2e4[_0x56f20a]={'$like':'%'+_0x12e27a[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0x28f2e4;})});}_0x1f8085=_[_0xd43b('0x5b')]({},_0x1f8085,_0x12e27a['options']);return _0x3d9128[_0xd43b('0x87')](_0x1f8085);}})[_0xd43b('0x33')](function(_0x1f7366){if(_0x1f7366){_0x3d917f=_0x1f7366[_0xd43b('0x4a')];if(!_0x12e27a[_0xd43b('0x49')][_0xd43b('0x4b')](_0xd43b('0x4c'))){_0x1f8085['limit']=qs['limit'](_0x12e27a[_0xd43b('0x49')][_0xd43b('0x2d')]);_0x1f8085[_0xd43b('0x2c')]=qs[_0xd43b('0x2c')](_0x12e27a[_0xd43b('0x49')][_0xd43b('0x2c')]);}return _0x3d9128[_0xd43b('0x87')](_0x1f8085);}})[_0xd43b('0x33')](function(_0x2d266c){if(_0x2d266c){return _0x2d266c?{'count':_0x3d917f,'rows':_0x2d266c}:null;}})[_0xd43b('0x33')](respondWithResult(_0x34fa9b,null))[_0xd43b('0x58')](handleError(_0x34fa9b,null));};function Extension(_0x3f3cd7,_0x151148,_0x33ae93,_0x2c546f){this[_0xd43b('0x88')]='from-voip-provider';this[_0xd43b('0x89')]=_0x3f3cd7[_0xd43b('0x8a')];this['app']=_0x2c546f;this[_0xd43b('0x40')]=_0xd43b('0x8b');this[_0xd43b('0x8c')]=_0xd43b('0x8d');this['FaxAccountId']=_0x3f3cd7['id'];this[_0xd43b('0x86')]=_0x151148;this[_0xd43b('0x8e')]=_0x33ae93;}function createExtensionsReciveFax(_0xa86fbb){var _0xf0249d=0x1;var _0x1be7f2=[];_0x1be7f2[_0xd43b('0x8f')](new Extension(_0xa86fbb,_0xf0249d,'',_0xd43b('0x90')));_0xf0249d+=0x1;_0x1be7f2['push'](new Extension(_0xa86fbb,_0xf0249d,_0xd43b('0x91'),'Set'));_0xf0249d+=0x1;for(var _0x22dcf0 in _0xa86fbb){if(_0xa86fbb[_0xd43b('0x4b')](_0x22dcf0)&&(_0x22dcf0==='ecm'||_0x22dcf0===_0xd43b('0x8a')||_0x22dcf0==='gateway'||_0x22dcf0===_0xd43b('0x92')||_0x22dcf0==='headerinfo'||_0x22dcf0===_0xd43b('0x93')||_0x22dcf0===_0xd43b('0x94')||_0x22dcf0==='modem'||_0x22dcf0===_0xd43b('0x95'))){_0x1be7f2[_0xd43b('0x8f')](new Extension(_0xa86fbb,_0xf0249d,_0xd43b('0x96')+_0x22dcf0+')='+_0xa86fbb[_0x22dcf0],_0xd43b('0x97')));_0xf0249d+=0x1;}}_0x1be7f2[_0xd43b('0x8f')](new Extension(_0xa86fbb,_0xf0249d,'6',_0xd43b('0x98')));_0xf0249d+=0x1;_0x1be7f2[_0xd43b('0x8f')](new Extension(_0xa86fbb,_0xf0249d,_0xd43b('0x99'),_0xd43b('0x9a')));_0xf0249d=0x0;return _0x1be7f2;}exports['addAccountApplications']=function(_0x3acc8d,_0x984619,_0x2f8c96){var _0x128628;return db[_0xd43b('0x7f')][_0xd43b('0x7e')](function(_0x438635){return db[_0xd43b('0x3d')][_0xd43b('0x5c')](_0x3acc8d[_0xd43b('0x64')],{'transaction':_0x438635})[_0xd43b('0x33')](function(_0x515ecc){_0x128628=_0x515ecc[_0xd43b('0x60')]({'plain':!![]});return db[_0xd43b('0x9b')][_0xd43b('0x84')](createExtensionsReciveFax(_0x128628),{'transaction':_0x438635});});})[_0xd43b('0x33')](function(){return _0x128628;})[_0xd43b('0x33')](respondWithResult(_0x984619,null))[_0xd43b('0x58')](handleError(_0x984619,null));};exports[_0xd43b('0x9c')]=function(_0x3b680b,_0xccad96,_0x11f05){var _0x47f3a1;return db[_0xd43b('0x7f')][_0xd43b('0x7e')](function(_0x4ba792){return db[_0xd43b('0x3d')][_0xd43b('0x63')](_0x3b680b['body'],{'where':{'id':_0x3b680b[_0xd43b('0x64')]['id']},'transaction':_0x4ba792})[_0xd43b('0x33')](function(_0x31cd66){return db[_0xd43b('0x9b')][_0xd43b('0x36')]({'where':{'FaxAccountId':_0x3b680b['body']['id']},'transaction':_0x4ba792})['then'](function(_0x311be4){return db[_0xd43b('0x9b')][_0xd43b('0x84')](createExtensionsReciveFax(_[_0xd43b('0x74')](_0x3b680b[_0xd43b('0x64')],['tech',_0xd43b('0x41'),_0xd43b('0x9d'),'updatedAt',_0xd43b('0x9e'),_0xd43b('0x9f')])),{'transaction':_0x4ba792});});});})[_0xd43b('0x33')](function(){return db[_0xd43b('0x3d')][_0xd43b('0xa0')](_0x3b680b[_0xd43b('0x64')]['id']);})['then'](respondWithResult(_0xccad96,null))[_0xd43b('0x58')](handleError(_0xccad96,null));};exports[_0xd43b('0xa1')]=function(_0x43a96f,_0x125d7c,_0x56557a){var _0x31c87c={'raw':!![],'where':{}};var _0x5bb626={};var _0x14e174={'count':0x0,'rows':[]};return db[_0xd43b('0x3d')][_0xd43b('0x6f')]({'where':{'id':_0x43a96f['params']['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x125d7c,null))[_0xd43b('0x33')](function(_0x5997df){if(_0x5997df){_0x5bb626[_0xd43b('0x42')]=_[_0xd43b('0x44')](db[_0xd43b('0xa2')]['rawAttributes']);_0x5bb626['query']=_[_0xd43b('0x44')](_0x43a96f[_0xd43b('0x49')]);_0x5bb626[_0xd43b('0x45')]=_[_0xd43b('0x47')](_0x5bb626[_0xd43b('0x42')],_0x5bb626[_0xd43b('0x49')]);_0x31c87c[_0xd43b('0x46')]=_[_0xd43b('0x47')](_0x5bb626['model'],qs[_0xd43b('0x48')](_0x43a96f[_0xd43b('0x49')][_0xd43b('0x48')]));_0x31c87c[_0xd43b('0x46')]=_0x31c87c[_0xd43b('0x46')][_0xd43b('0x4a')]?_0x31c87c['attributes']:_0x5bb626['model'];if(!_0x43a96f[_0xd43b('0x49')][_0xd43b('0x4b')]('nolimit')){_0x31c87c[_0xd43b('0x2d')]=qs[_0xd43b('0x2d')](_0x43a96f[_0xd43b('0x49')]['limit']);_0x31c87c[_0xd43b('0x2c')]=qs[_0xd43b('0x2c')](_0x43a96f[_0xd43b('0x49')][_0xd43b('0x2c')]);}_0x31c87c[_0xd43b('0x4d')]=qs[_0xd43b('0x4e')](_0x43a96f[_0xd43b('0x49')][_0xd43b('0x4e')]);_0x31c87c[_0xd43b('0x4f')]=qs[_0xd43b('0x45')](_[_0xd43b('0x50')](_0x43a96f[_0xd43b('0x49')],_0x5bb626[_0xd43b('0x45')]));_0x31c87c[_0xd43b('0x4f')][_0xd43b('0x6a')]=_0x5997df['id'];if(_0x43a96f[_0xd43b('0x49')]['filter']){_0x31c87c['where']=_['merge'](_0x31c87c[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0x31c87c['attributes'],function(_0xd6541e){var _0x5b13ea={};_0x5b13ea[_0xd6541e]={'$like':'%'+_0x43a96f[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0x5b13ea;})});}if(_0x43a96f['query']['$gte']){var _0x25dc82=_0x43a96f['query'][_0xd43b('0xa3')][_0xd43b('0xa4')](',');var _0x4b5909={};_0x4b5909[_0x25dc82[0x0]]={'$gte':moment(_0x25dc82[0x1])[_0xd43b('0xa5')](_0xd43b('0xa6'))};_0x31c87c[_0xd43b('0x4f')]=_[_0xd43b('0x5b')](_0x31c87c['where'],_0x4b5909);}_0x31c87c=_['merge']({},_0x31c87c,_0x43a96f[_0xd43b('0x53')]);return db['FaxMessage']['count']({'where':_0x31c87c[_0xd43b('0x4f')]})[_0xd43b('0x33')](function(_0xe6c9f4){_0x14e174[_0xd43b('0x2e')]=_0xe6c9f4;if(_0x43a96f['query'][_0xd43b('0x54')]){_0x31c87c[_0xd43b('0x55')]=[{'all':!![]}];}return db[_0xd43b('0xa2')]['findAll'](_0x31c87c);})['then'](function(_0x2c429f){_0x14e174[_0xd43b('0x57')]=_0x2c429f;return _0x14e174;});}})[_0xd43b('0x33')](respondWithFilteredResult(_0x125d7c,_0x31c87c))['catch'](handleError(_0x125d7c,null));};exports[_0xd43b('0x3a')]=function(_0x560a24,_0x3ce81e,_0x3cfaf9){var _0x1dbd4d,_0x49f6fe={},_0x4909fa;if(_0x560a24[_0xd43b('0x64')]['to']){_0x4909fa=_0x560a24[_0xd43b('0x64')]['to'][0x0];}return db[_0xd43b('0x3d')][_0xd43b('0x65')]({'where':{'id':_0x560a24[_0xd43b('0x5a')]['id']},'include':[{'model':db[_0xd43b('0xa7')],'as':'List','include':[{'model':db[_0xd43b('0x76')],'as':_0xd43b('0xa8'),'where':{'fax':_0x4909fa},'limit':0x1,'order':[[_0xd43b('0xa9'),_0xd43b('0xaa')]]}]}]})[_0xd43b('0x33')](handleEntityNotFound(_0x3ce81e,null))[_0xd43b('0x33')](function(_0x3edc3c){_0x1dbd4d=_0x3edc3c;if(_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')]&&_0x560a24['body'][_0xd43b('0xab')]['length']){for(var _0xbf29a2=0x0;_0xbf29a2<_0x560a24['body']['attachments'][_0xd43b('0x4a')];_0xbf29a2+=0x1){_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][_0xbf29a2]={'filename':_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][_0xbf29a2][_0xd43b('0x39')],'id':_0x560a24[_0xd43b('0x64')]['attachments'][_0xbf29a2]['id'],'path':path[_0xd43b('0xac')](config[_0xd43b('0xad')],'server/files/attachments',_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][_0xbf29a2][_0xd43b('0xae')])};}}return respondWithRpcPromise(_0xd43b('0xaf'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x560a24[_0xd43b('0x5a')]['id'])?undefined:_0x560a24[_0xd43b('0x5a')]['id'],'path':_[_0xd43b('0xb0')](_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][0x0][_0xd43b('0xb1')])?undefined:_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][0x0][_0xd43b('0xb1')],'fax':_['isNil'](_0x560a24[_0xd43b('0x64')]['to'][0x0])?undefined:_0x560a24[_0xd43b('0x64')]['to'][0x0]},client9002);})[_0xd43b('0x33')](function(){if(_0x1dbd4d){if(_[_0xd43b('0xb0')](_0x560a24[_0xd43b('0x64')][_0xd43b('0xb2')])){_0x560a24[_0xd43b('0x64')][_0xd43b('0xb2')]=util[_0xd43b('0xa5')]('\x22%s\x22\x20<%s>',_0x1dbd4d[_0xd43b('0x39')],_0x1dbd4d['fax']);}if(_0x1dbd4d[_0xd43b('0xb3')]){if(_0x1dbd4d[_0xd43b('0xb3')][_0xd43b('0xa8')][_0xd43b('0x4a')]){return _0x1dbd4d['List'][_0xd43b('0xa8')][0x0];}else{return db['CmContact'][_0xd43b('0x5c')](_[_0xd43b('0x1c')](_0x560a24[_0xd43b('0x64')],{'firstName':_0x560a24[_0xd43b('0x64')]['to'][0x0],'phone':_0x560a24[_0xd43b('0x64')]['to'][0x0],'fax':_0x560a24[_0xd43b('0x64')]['to'][0x0],'ListId':_0x1dbd4d[_0xd43b('0x9f')]}));}}else{throw new Error(_0xd43b('0xb4'));}}else{throw new Error(_0xd43b('0xb5'));}})[_0xd43b('0x33')](function(_0x4fd7e3){if(_0x4fd7e3){return db[_0xd43b('0x73')][_0xd43b('0x65')]({'where':{'ContactId':_0x4fd7e3['id'],'closed':![],'FaxAccountId':_0x1dbd4d['id']}})[_0xd43b('0x33')](function(_0x3ee541){if(_0x3ee541){return[_0x3ee541,![]];}return db['FaxInteraction'][_0xd43b('0x5c')]({'UserId':_0x560a24['user']['id'],'ContactId':_0x4fd7e3['id'],'FaxAccountId':_0x1dbd4d['id'],'fax':_0x560a24[_0xd43b('0x64')]['to'][0x0],'firstMsgDirection':_0xd43b('0xb6'),'Messages':[_[_0xd43b('0x5b')](_0x560a24[_0xd43b('0x64')],{'read':![],'body':_0x560a24['body'][_0xd43b('0xab')][0x0][_0xd43b('0xb7')],'FaxAccountId':_0x1dbd4d['id'],'UserId':_0x560a24[_0xd43b('0x5d')]['id'],'ContactId':_0x4fd7e3['id'],'AttachmentId':_0x560a24['body'][_0xd43b('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xd43b('0xa2')],'as':_0xd43b('0xb8')}]})[_0xd43b('0x33')](function(_0x373f58){return[_0x373f58,!![]];});});}else{throw new Error(_0xd43b('0xb9'));}})[_0xd43b('0xba')](function(_0x2ac6a0,_0x1ca378){if(_0x1ca378){return _0x2ac6a0;}return db[_0xd43b('0xa2')]['create']({'direction':_0xd43b('0xb6'),'read':![],'body':_0x560a24['body']['attachments'][0x0][_0xd43b('0xb7')],'FaxAccountId':_0x1dbd4d['id'],'FaxInteractionId':_0x2ac6a0['id'],'UserId':_0x560a24['user']['id'],'ContactId':_0x2ac6a0[_0xd43b('0xbb')],'AttachmentId':_0x560a24['body'][_0xd43b('0xab')][0x0]['id']})[_0xd43b('0x33')](function(_0x321d9e){_0x2ac6a0[_0xd43b('0xbc')][_0xd43b('0xb8')]=[];_0x2ac6a0[_0xd43b('0xbc')][_0xd43b('0xb8')][_0xd43b('0x8f')](_0x321d9e[_0xd43b('0xbc')]);return _0x2ac6a0;});})[_0xd43b('0x33')](function(_0x3eb8f5){respondWithRpcPromise(_0xd43b('0xbd'),'SendFax',{'FaxAccountId':_[_0xd43b('0xb0')](_0x560a24[_0xd43b('0x5a')]['id'])?undefined:_0x560a24[_0xd43b('0x5a')]['id'],'path':_['isNil'](_0x560a24['body']['attachments'][0x0][_0xd43b('0xb1')])?undefined:_0x560a24['body']['attachments'][0x0][_0xd43b('0xb1')],'fax':_['isNil'](_0x560a24['body']['to'][0x0])?undefined:_0x560a24[_0xd43b('0x64')]['to'][0x0],'AttachmentId':_0x560a24[_0xd43b('0x64')][_0xd43b('0xab')][0x0]['id']},client9002)[_0xd43b('0x33')](function(_0x2bfb68){logger[_0xd43b('0x26')](_0xd43b('0xbe'),_0x2bfb68);})[_0xd43b('0x58')](function(_0x189b84){logger[_0xd43b('0x26')](_0xd43b('0xbe'),_0x189b84);});return _0x3eb8f5;})[_0xd43b('0x33')](respondWithResult(_0x3ce81e,null))[_0xd43b('0x58')](handleError(_0x3ce81e,null));};exports[_0xd43b('0xbf')]=function(_0x2f0201,_0x513f87,_0x4a2ec7){return db['FaxAccount'][_0xd43b('0x65')]({'where':{'id':_0x2f0201[_0xd43b('0x5a')]['id']}})[_0xd43b('0x33')](handleEntityNotFound(_0x513f87,null))['then'](function(_0x580d9f){if(_0x580d9f){return _0x580d9f[_0xd43b('0xbf')](_0x2f0201[_0xd43b('0x64')][_0xd43b('0x6c')],_[_0xd43b('0x74')](_0x2f0201[_0xd43b('0x64')],['ids','id'])||{})[_0xd43b('0xba')](function(_0x2dbc43){for(var _0x58c2a8=0x0;_0x58c2a8<_0x2f0201[_0xd43b('0x64')][_0xd43b('0x6c')]['length'];_0x58c2a8+=0x1){socket[_0xd43b('0xc0')](_0xd43b('0xc1'),{'UserId':Number(_0x2f0201['body'][_0xd43b('0x6c')][_0x58c2a8]),'FaxAccountId':Number(_0x2f0201['params']['id'])});}return _0x2dbc43;});}})[_0xd43b('0x33')](respondWithResult(_0x513f87,null))['catch'](handleError(_0x513f87,null));};exports[_0xd43b('0xc2')]=function(_0x55672c,_0x395462,_0x5e3162){return db[_0xd43b('0x3d')][_0xd43b('0x65')]({'where':{'id':_0x55672c[_0xd43b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x395462,null))['then'](function(_0x790779){if(_0x790779){return _0x790779[_0xd43b('0xc2')](_0x55672c[_0xd43b('0x49')][_0xd43b('0x6c')])['then'](function(){if(_[_0xd43b('0xc3')](_0x55672c[_0xd43b('0x49')][_0xd43b('0x6c')])){for(var _0x1b6415=0x0;_0x1b6415<_0x55672c['query'][_0xd43b('0x6c')][_0xd43b('0x4a')];_0x1b6415+=0x1){socket[_0xd43b('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x55672c[_0xd43b('0x49')][_0xd43b('0x6c')][_0x1b6415]),'FaxAccountId':Number(_0x55672c[_0xd43b('0x5a')]['id'])});}}else{socket[_0xd43b('0xc0')](_0xd43b('0xc4'),{'UserId':Number(_0x55672c[_0xd43b('0x49')]['ids']),'FaxAccountId':Number(_0x55672c[_0xd43b('0x5a')]['id'])});}});}})[_0xd43b('0x33')](respondWithStatusCode(_0x395462,null))[_0xd43b('0x58')](handleError(_0x395462,null));};exports['getAgents']=function(_0x2a35cb,_0x2ff905,_0x113623){var _0x1a8963={};var _0x449890={};var _0x37d05a;var _0x33ba55;return db[_0xd43b('0x3d')][_0xd43b('0x6f')]({'where':{'id':_0x2a35cb[_0xd43b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ff905,null))[_0xd43b('0x33')](function(_0x492e8c){if(_0x492e8c){_0x37d05a=_0x492e8c;_0x449890[_0xd43b('0x42')]=_['keys'](db[_0xd43b('0x78')]['rawAttributes']);_0x449890[_0xd43b('0x49')]=_[_0xd43b('0x44')](_0x2a35cb[_0xd43b('0x49')]);_0x449890['filters']=_[_0xd43b('0x47')](_0x449890['model'],_0x449890[_0xd43b('0x49')]);_0x1a8963[_0xd43b('0x46')]=_[_0xd43b('0x47')](_0x449890[_0xd43b('0x42')],qs[_0xd43b('0x48')](_0x2a35cb[_0xd43b('0x49')]['fields']));_0x1a8963[_0xd43b('0x46')]=_0x1a8963[_0xd43b('0x46')][_0xd43b('0x4a')]?_0x1a8963[_0xd43b('0x46')]:_0x449890[_0xd43b('0x42')];_0x1a8963['order']=qs[_0xd43b('0x4e')](_0x2a35cb[_0xd43b('0x49')][_0xd43b('0x4e')]);_0x1a8963['where']=qs[_0xd43b('0x45')](_[_0xd43b('0x50')](_0x2a35cb[_0xd43b('0x49')],_0x449890[_0xd43b('0x45')]));if(_0x2a35cb[_0xd43b('0x49')][_0xd43b('0x51')]){_0x1a8963[_0xd43b('0x4f')]=_[_0xd43b('0x5b')](_0x1a8963[_0xd43b('0x4f')],{'$or':_[_0xd43b('0x43')](_0x1a8963[_0xd43b('0x46')],function(_0xbcb85a){var _0x406db3={};_0x406db3[_0xbcb85a]={'$like':'%'+_0x2a35cb[_0xd43b('0x49')][_0xd43b('0x51')]+'%'};return _0x406db3;})});}_0x1a8963=_[_0xd43b('0x5b')]({},_0x1a8963,_0x2a35cb['options']);return _0x37d05a[_0xd43b('0xc5')](_0x1a8963);}})[_0xd43b('0x33')](function(_0x305c74){if(_0x305c74){_0x33ba55=_0x305c74[_0xd43b('0x4a')];if(!_0x2a35cb[_0xd43b('0x49')][_0xd43b('0x4b')](_0xd43b('0x4c'))){_0x1a8963[_0xd43b('0x2d')]=qs['limit'](_0x2a35cb[_0xd43b('0x49')]['limit']);_0x1a8963['offset']=qs[_0xd43b('0x2c')](_0x2a35cb['query'][_0xd43b('0x2c')]);}return _0x37d05a[_0xd43b('0xc5')](_0x1a8963);}})['then'](function(_0x5cfd99){if(_0x5cfd99){return _0x5cfd99?{'count':_0x33ba55,'rows':_0x5cfd99}:null;}})['then'](respondWithResult(_0x2ff905,null))[_0xd43b('0x58')](handleError(_0x2ff905,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a24eaa3..d8dac77 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 _0x4407=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x4407,0x12e));var _0x7440=function(_0x55f59e,_0x966db7){_0x55f59e=_0x55f59e-0x0;var _0x272cd3=_0x4407[_0x55f59e];return _0x272cd3;};'use strict';var EventEmitter=require(_0x7440('0x0'));var FaxAccount=require(_0x7440('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7440('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7440('0x3')};function emitEvent(_0x2bac76){return function(_0x45f059,_0x688b3e,_0x5df893){FaxAccountEvents[_0x7440('0x4')](_0x2bac76+':'+_0x45f059['id'],_0x45f059);FaxAccountEvents['emit'](_0x2bac76,_0x45f059);_0x5df893(null);};}for(var e in events){if(events[_0x7440('0x5')](e)){var event=events[e];FaxAccount[_0x7440('0x6')](e,emitEvent(event));}}module[_0x7440('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x368a=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x37a694,_0x5afe80){var _0x139848=function(_0x443114){while(--_0x443114){_0x37a694['push'](_0x37a694['shift']());}};_0x139848(++_0x5afe80);}(_0x368a,0x1a9));var _0xa368=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x368a[_0x4e9d3c];return _0x2d0825;};'use strict';var EventEmitter=require(_0xa368('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa368('0x1')](0x0);var events={'afterCreate':_0xa368('0x2'),'afterUpdate':_0xa368('0x3'),'afterDestroy':_0xa368('0x4')};function emitEvent(_0x3badd3){return function(_0x27f5a0,_0x267ff7,_0x5580d7){FaxAccountEvents['emit'](_0x3badd3+':'+_0x27f5a0['id'],_0x27f5a0);FaxAccountEvents[_0xa368('0x5')](_0x3badd3,_0x27f5a0);_0x5580d7(null);};}for(var e in events){if(events[_0xa368('0x6')](e)){var event=events[e];FaxAccount[_0xa368('0x7')](e,emitEvent(event));}}module[_0xa368('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 7b851a7..b1a3d44 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 _0x043d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x043d,0x9c));var _0xd043=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x043d[_0x408d22];return _0x58effd;};'use strict';var _=require('lodash');var util=require(_0xd043('0x0'));var logger=require(_0xd043('0x1'))(_0xd043('0x2'));var moment=require(_0xd043('0x3'));var BPromise=require(_0xd043('0x4'));var rp=require(_0xd043('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd043('0x6'));var config=require(_0xd043('0x7'));var attributes=require(_0xd043('0x8'));module[_0xd043('0x9')]=function(_0x561154,_0x1e6ab5){return _0x561154[_0xd043('0xa')](_0xd043('0xb'),attributes,{'tableName':_0xd043('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d98=['lodash','../../config/logger','api','moment','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d98,0x181));var _0x80d9=function(_0x1ee4bb,_0x5daed8){_0x1ee4bb=_0x1ee4bb-0x0;var _0x511b52=_0x0d98[_0x1ee4bb];return _0x511b52;};'use strict';var _=require(_0x80d9('0x0'));var util=require('util');var logger=require(_0x80d9('0x1'))(_0x80d9('0x2'));var moment=require(_0x80d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d9('0x4'));var rimraf=require('rimraf');var config=require(_0x80d9('0x5'));var attributes=require(_0x80d9('0x6'));module[_0x80d9('0x7')]=function(_0x256c60,_0x3242f3){return _0x256c60[_0x80d9('0x8')](_0x80d9('0x9'),attributes,{'tableName':_0x80d9('0xa'),'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 faa3d1b..0bda210 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 _0xb0f8=['GetFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','Contacts','updatedAt','DESC','FaxApplication','Applications','applications','list','List','priority','length','defaults','contact','FaxInteraction','create','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','raw','options','where','attributes','include','map','model'];(function(_0x411888,_0x21e751){var _0x186805=function(_0x105881){while(--_0x105881){_0x411888['push'](_0x411888['shift']());}};_0x186805(++_0x21e751);}(_0xb0f8,0xd6));var _0x8b0f=function(_0x3b806f,_0x4deb45){_0x3b806f=_0x3b806f-0x0;var _0x1c5af9=_0xb0f8[_0x3b806f];return _0x1c5af9;};'use strict';var _=require(_0x8b0f('0x0'));var util=require('util');var moment=require(_0x8b0f('0x1'));var BPromise=require(_0x8b0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b0f('0x4'))(_0x8b0f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b0f('0x6')][_0x8b0f('0x7')]({'port':0x232c});config['redis']=_['defaults'](config[_0x8b0f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b0f('0x9'))(new Redis(config[_0x8b0f('0x8')]));require(_0x8b0f('0xa'))[_0x8b0f('0xb')](socket);function respondWithRpcPromise(_0x3b6297,_0x508db7,_0x417db0){return new BPromise(function(_0x5551f3,_0x5b18c4){return client[_0x8b0f('0xc')](_0x3b6297,_0x417db0)[_0x8b0f('0xd')](function(_0x4ea557){logger[_0x8b0f('0xe')](_0x8b0f('0xf'),_0x508db7,_0x8b0f('0x10'));logger[_0x8b0f('0x11')](_0x8b0f('0x12'),_0x508db7,'request\x20sent',JSON[_0x8b0f('0x13')](_0x4ea557));if(_0x4ea557[_0x8b0f('0x14')]){if(_0x4ea557[_0x8b0f('0x14')][_0x8b0f('0x15')]===0x1f4){logger[_0x8b0f('0x14')](_0x8b0f('0xf'),_0x508db7,_0x4ea557[_0x8b0f('0x14')][_0x8b0f('0x16')]);return _0x5b18c4(_0x4ea557[_0x8b0f('0x14')]['message']);}logger[_0x8b0f('0x14')]('FaxAccount,\x20%s,\x20%s',_0x508db7,_0x4ea557['error']['message']);return _0x5551f3(_0x4ea557[_0x8b0f('0x14')][_0x8b0f('0x16')]);}else{logger[_0x8b0f('0xe')]('FaxAccount,\x20%s,\x20%s',_0x508db7,_0x8b0f('0x10'));_0x5551f3(_0x4ea557['result'][_0x8b0f('0x16')]);}})[_0x8b0f('0x17')](function(_0x13c21c){logger[_0x8b0f('0x14')](_0x8b0f('0xf'),_0x508db7,_0x13c21c);_0x5b18c4(_0x13c21c);});});}exports['GetFaxAccount']=function(_0x48e820){var _0x42425c=this;return new Promise(function(_0x4d86e6,_0x590be2){return db['FaxAccount'][_0x8b0f('0x18')]({'raw':_0x48e820['options']?_0x48e820['options'][_0x8b0f('0x19')]===undefined?!![]:![]:!![],'where':_0x48e820[_0x8b0f('0x1a')]?_0x48e820[_0x8b0f('0x1a')][_0x8b0f('0x1b')]||null:null,'attributes':_0x48e820[_0x8b0f('0x1a')]?_0x48e820['options'][_0x8b0f('0x1c')]||null:null,'limit':_0x48e820['options']?_0x48e820[_0x8b0f('0x1a')]['limit']||null:null,'include':_0x48e820[_0x8b0f('0x1a')]?_0x48e820[_0x8b0f('0x1a')][_0x8b0f('0x1d')]?_[_0x8b0f('0x1e')](_0x48e820[_0x8b0f('0x1a')]['include'],function(_0x50c627){return{'model':db[_0x50c627[_0x8b0f('0x1f')]],'as':_0x50c627['as'],'attributes':_0x50c627[_0x8b0f('0x1c')],'include':_0x50c627[_0x8b0f('0x1d')]?_['map'](_0x50c627['include'],function(_0x3a88f6){return{'model':db[_0x3a88f6[_0x8b0f('0x1f')]],'as':_0x3a88f6['as'],'attributes':_0x3a88f6[_0x8b0f('0x1c')],'include':_0x3a88f6[_0x8b0f('0x1d')]?_[_0x8b0f('0x1e')](_0x3a88f6['include'],function(_0x10abc1){return{'model':db[_0x10abc1[_0x8b0f('0x1f')]],'as':_0x10abc1['as'],'attributes':_0x10abc1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b0f('0xd')](function(_0x54c26f){logger[_0x8b0f('0xe')]('GetFaxAccount',_0x48e820);logger['debug'](_0x8b0f('0x20'),_0x48e820,JSON[_0x8b0f('0x13')](_0x54c26f));_0x4d86e6(_0x54c26f);})['catch'](function(_0x80fbf3){logger[_0x8b0f('0x14')](_0x8b0f('0x20'),_0x80fbf3['message'],_0x48e820);_0x590be2(_0x42425c['error'](0x1f4,_0x80fbf3[_0x8b0f('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x27b757,_0x4df730,_0x47856a){var _0x33ef4e=this;return new Promise(function(_0x1f84b2,_0x1d5731){var _0x1ca786={'body':_0x27b757[_0x8b0f('0x21')],'channel':'fax'};var _0x242a23=[];var _0x26a3ed=[];var _0x3558c3={};return db[_0x8b0f('0x22')][_0x8b0f('0x23')]()[_0x8b0f('0xd')](function(_0x4ee80c){if(!_0x4ee80c){throw new db[(_0x8b0f('0x24'))]['ValidationError'](_0x8b0f('0x25'));}_0x242a23=_[_0x8b0f('0x26')](_[_0x8b0f('0x27')](_0x4ee80c),[_0x8b0f('0x28'),'updatedAt']);_0x26a3ed=_[_0x8b0f('0x26')](_['keys'](_0x4ee80c),['createdAt','updatedAt',_0x8b0f('0x29'),_0x8b0f('0x2a')]);if(_0x27b757['body']['id']){delete _0x27b757['body']['id'];}if(_[_0x8b0f('0x2b')](_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x2c')])){throw new db['Sequelize'][(_0x8b0f('0x2d'))](_0x8b0f('0x2e'));}if(_[_0x8b0f('0x2b')](_0x27b757['body'][_0x8b0f('0x21')])||_0x27b757[_0x8b0f('0x21')]['body']===''){throw new db[(_0x8b0f('0x24'))][(_0x8b0f('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8b0f('0x2b')](_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x2f')])){throw new db['Sequelize'][(_0x8b0f('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26a3ed);}if(!_[_0x8b0f('0x30')](_0x26a3ed,_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x2f')])){throw new db['Sequelize'][(_0x8b0f('0x2d'))](_0x8b0f('0x31')+_0x26a3ed);}_0x3558c3[_0x27b757[_0x8b0f('0x21')]['mapKey']]=_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x2c')];})[_0x8b0f('0xd')](function(){return db[_0x8b0f('0x32')][_0x8b0f('0x33')]({'where':{'id':_0x27b757[_0x8b0f('0x34')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8b0f('0x22')],'as':_0x8b0f('0x35'),'where':_0x3558c3,'limit':0x1,'order':[[_0x8b0f('0x36'),_0x8b0f('0x37')]]}]},{'model':db[_0x8b0f('0x38')],'as':_0x8b0f('0x39')}]});})[_0x8b0f('0xd')](function(_0x4b164e){if(_0x4b164e&&_0x4b164e['List']){var _0x291a26=_0x4b164e['get']({'plain':!![]});_0x1ca786[_0x8b0f('0x34')]=_0x291a26;_0x1ca786[_0x8b0f('0x3a')]=_0x291a26['Applications'];_0x1ca786[_0x8b0f('0x3b')]=_0x291a26[_0x8b0f('0x3c')];_0x1ca786['applications']=_['orderBy'](_0x1ca786[_0x8b0f('0x3a')],[_0x8b0f('0x3d')],['asc']);if(_0x1ca786[_0x8b0f('0x34')]['Applications']){delete _0x1ca786['account']['Applications'];}if(_0x1ca786[_0x8b0f('0x34')][_0x8b0f('0x3c')]&&_0x1ca786['account'][_0x8b0f('0x3c')]['Contacts'][_0x8b0f('0x3e')]){return _0x1ca786[_0x8b0f('0x34')]['List']['Contacts'][0x0];}var _0x4789ed=_[_0x8b0f('0x3f')](_0x27b757[_0x8b0f('0x21')],{'firstName':_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x2c')],'ListId':_0x291a26[_0x8b0f('0x2a')]});_0x4789ed[_0x27b757['body'][_0x8b0f('0x2f')]]=_0x27b757['body'][_0x8b0f('0x2c')];return db[_0x8b0f('0x22')]['create'](_0x4789ed,{'fields':_0x242a23,'raw':!![]});}})[_0x8b0f('0xd')](function(_0x51fadf){_0x1ca786[_0x8b0f('0x40')]=_0x51fadf;if(_0x51fadf){var _0x3229f5={'ContactId':_0x51fadf['id'],'FaxAccountId':_0x27b757[_0x8b0f('0x34')]['id'],'fax':_0x51fadf['fax']};return db[_0x8b0f('0x41')][_0x8b0f('0x33')]({'where':{'ContactId':_0x51fadf['id'],'closed':![],'FaxAccountId':_0x27b757[_0x8b0f('0x34')]['id']}})[_0x8b0f('0xd')](function(_0x4e15e5){if(_0x4e15e5){return[_0x4e15e5,![]];}return db[_0x8b0f('0x41')][_0x8b0f('0x42')](_0x3229f5)[_0x8b0f('0xd')](function(_0x3ed3ad){return[_0x3ed3ad,!![]];});});}else{throw new Error(_0x8b0f('0x43'));}})[_0x8b0f('0x44')](function(_0x56813,_0x55a11c){var _0x4087cb=_0x56813['get']({'plain':!![]});if(_0x55a11c){if(_0x1ca786[_0x8b0f('0x34')]['autoclose']){_0x1ca786['applications'][_0x8b0f('0x45')]({'id':0x0,'priority':_0x1ca786[_0x8b0f('0x3a')]['length']+0x1,'app':'close','appdata':_0x8b0f('0x46'),'interval':_0x8b0f('0x47')});}_0x4087cb[_0x8b0f('0x48')]=!![];}else{_0x4087cb['created']=![];}_0x1ca786[_0x8b0f('0x49')]=_0x4087cb;return db['FaxMessage']['create']({'body':_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x21')],'FaxAccountId':_0x27b757['account']['id'],'FaxInteractionId':_0x56813['id'],'direction':'in','ContactId':_0x56813[_0x8b0f('0x4a')],'AttachmentId':_0x27b757[_0x8b0f('0x21')][_0x8b0f('0x4b')]});})[_0x8b0f('0xd')](function(_0x39dcae){_0x1ca786[_0x8b0f('0x16')]=_0x39dcae;if(_0x1ca786[_0x8b0f('0x49')][_0x8b0f('0x4c')]){return db['User'][_0x8b0f('0x33')]({'attributes':['id',_0x8b0f('0x4d')],'where':{'id':_0x1ca786[_0x8b0f('0x49')]['UserId']}})[_0x8b0f('0xd')](function(_0x3b8c91){if(_0x3b8c91){_0x1ca786['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x8b0f('0x4e'),'appdata':_0x3b8c91[_0x8b0f('0x4d')]+','+(_0x1ca786['account'][_0x8b0f('0x4f')]||0xa),'interval':_0x8b0f('0x47')});}return respondWithRpcPromise(_0x8b0f('0x50'),'startRouting',_0x1ca786);});}return respondWithRpcPromise(_0x8b0f('0x50'),_0x8b0f('0x51'),_0x1ca786);})[_0x8b0f('0xd')](function(_0x2958fb){_0x1f84b2(_0x2958fb);})[_0x8b0f('0x17')](function(_0x3c3175){_0x1d5731(_0x33ef4e[_0x8b0f('0x14')](0x1f4,_0x3c3175[_0x8b0f('0x16')]));});});}; \ No newline at end of file +var _0xf0f4=['FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','debug','catch','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Contacts','get','account','applications','Applications','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxAccount.socket','request','then','info'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xf0f4,0x19d));var _0x4f0f=function(_0x584ba3,_0x227b35){_0x584ba3=_0x584ba3-0x0;var _0xc2211f=_0xf0f4[_0x584ba3];return _0xc2211f;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require(_0x4f0f('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f0f('0x2'));var fs=require('fs');var Redis=require(_0x4f0f('0x3'));var db=require(_0x4f0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f0f('0x5'))(_0x4f0f('0x6'));var config=require(_0x4f0f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232c});config[_0x4f0f('0xa')]=_[_0x4f0f('0xb')](config[_0x4f0f('0xa')],{'host':_0x4f0f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f0f('0xa')]));require(_0x4f0f('0xd'))['register'](socket);function respondWithRpcPromise(_0x42f2b5,_0x52e262,_0x33ef9f){return new BPromise(function(_0x497f5c,_0x5cb2e3){return client[_0x4f0f('0xe')](_0x42f2b5,_0x33ef9f)[_0x4f0f('0xf')](function(_0x3e2e08){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x52e262,'request\x20sent');logger['debug'](_0x4f0f('0x12'),_0x52e262,_0x4f0f('0x13'),JSON[_0x4f0f('0x14')](_0x3e2e08));if(_0x3e2e08[_0x4f0f('0x15')]){if(_0x3e2e08[_0x4f0f('0x15')][_0x4f0f('0x16')]===0x1f4){logger[_0x4f0f('0x15')]('FaxAccount,\x20%s,\x20%s',_0x52e262,_0x3e2e08['error']['message']);return _0x5cb2e3(_0x3e2e08['error'][_0x4f0f('0x17')]);}logger[_0x4f0f('0x15')]('FaxAccount,\x20%s,\x20%s',_0x52e262,_0x3e2e08[_0x4f0f('0x15')][_0x4f0f('0x17')]);return _0x497f5c(_0x3e2e08[_0x4f0f('0x15')][_0x4f0f('0x17')]);}else{logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x52e262,_0x4f0f('0x13'));_0x497f5c(_0x3e2e08[_0x4f0f('0x18')][_0x4f0f('0x17')]);}})['catch'](function(_0x7c8a8d){logger[_0x4f0f('0x15')](_0x4f0f('0x11'),_0x52e262,_0x7c8a8d);_0x5cb2e3(_0x7c8a8d);});});}exports['GetFaxAccount']=function(_0x2b7561){var _0x1d186a=this;return new Promise(function(_0xdde64b,_0xd7c9fa){return db[_0x4f0f('0x19')][_0x4f0f('0x1a')]({'raw':_0x2b7561[_0x4f0f('0x1b')]?_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b7561[_0x4f0f('0x1b')]?_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x1d')]||null:null,'attributes':_0x2b7561[_0x4f0f('0x1b')]?_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x1e')]||null:null,'limit':_0x2b7561[_0x4f0f('0x1b')]?_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x1f')]||null:null,'include':_0x2b7561[_0x4f0f('0x1b')]?_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x20')]?_[_0x4f0f('0x21')](_0x2b7561[_0x4f0f('0x1b')][_0x4f0f('0x20')],function(_0x33d4e6){return{'model':db[_0x33d4e6[_0x4f0f('0x22')]],'as':_0x33d4e6['as'],'attributes':_0x33d4e6[_0x4f0f('0x1e')],'include':_0x33d4e6[_0x4f0f('0x20')]?_[_0x4f0f('0x21')](_0x33d4e6[_0x4f0f('0x20')],function(_0x52ebc3){return{'model':db[_0x52ebc3['model']],'as':_0x52ebc3['as'],'attributes':_0x52ebc3[_0x4f0f('0x1e')],'include':_0x52ebc3['include']?_[_0x4f0f('0x21')](_0x52ebc3[_0x4f0f('0x20')],function(_0x4e0072){return{'model':db[_0x4e0072[_0x4f0f('0x22')]],'as':_0x4e0072['as'],'attributes':_0x4e0072[_0x4f0f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11da57){logger['info'](_0x4f0f('0x23'),_0x2b7561);logger[_0x4f0f('0x24')](_0x4f0f('0x23'),_0x2b7561,JSON[_0x4f0f('0x14')](_0x11da57));_0xdde64b(_0x11da57);})[_0x4f0f('0x25')](function(_0x4f4536){logger[_0x4f0f('0x15')](_0x4f0f('0x23'),_0x4f4536['message'],_0x2b7561);_0xd7c9fa(_0x1d186a[_0x4f0f('0x15')](0x1f4,_0x4f4536[_0x4f0f('0x17')]));});});};exports[_0x4f0f('0x26')]=function(_0x4cd026,_0x3bd947,_0x5c1fb8){var _0x480626=this;return new Promise(function(_0x2487c0,_0x3be713){var _0x285081={'body':_0x4cd026[_0x4f0f('0x27')],'channel':'fax'};var _0x49b1c1=[];var _0x35112b=[];var _0x53b417={};return db[_0x4f0f('0x28')][_0x4f0f('0x29')]()[_0x4f0f('0xf')](function(_0x4b9586){if(!_0x4b9586){throw new db[(_0x4f0f('0x2a'))]['ValidationError'](_0x4f0f('0x2b'));}_0x49b1c1=_[_0x4f0f('0x2c')](_[_0x4f0f('0x2d')](_0x4b9586),[_0x4f0f('0x2e'),_0x4f0f('0x2f')]);_0x35112b=_['difference'](_[_0x4f0f('0x2d')](_0x4b9586),[_0x4f0f('0x2e'),_0x4f0f('0x2f'),_0x4f0f('0x30'),_0x4f0f('0x31')]);if(_0x4cd026['body']['id']){delete _0x4cd026[_0x4f0f('0x27')]['id'];}if(_[_0x4f0f('0x32')](_0x4cd026['body'][_0x4f0f('0x33')])){throw new db[(_0x4f0f('0x2a'))][(_0x4f0f('0x34'))](_0x4f0f('0x35'));}if(_[_0x4f0f('0x32')](_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x27')])||_0x4cd026['body']['body']===''){throw new db[(_0x4f0f('0x2a'))][(_0x4f0f('0x34'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x36')])){throw new db[(_0x4f0f('0x2a'))][(_0x4f0f('0x34'))](_0x4f0f('0x37')+_0x35112b);}if(!_[_0x4f0f('0x38')](_0x35112b,_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x36')])){throw new db[(_0x4f0f('0x2a'))][(_0x4f0f('0x34'))](_0x4f0f('0x39')+_0x35112b);}_0x53b417[_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x36')]]=_0x4cd026['body'][_0x4f0f('0x33')];})[_0x4f0f('0xf')](function(){return db[_0x4f0f('0x19')][_0x4f0f('0x3a')]({'where':{'id':_0x4cd026['account']['id']},'include':[{'model':db['CmList'],'as':_0x4f0f('0x3b'),'include':[{'model':db['CmContact'],'as':_0x4f0f('0x3c'),'where':_0x53b417,'limit':0x1,'order':[[_0x4f0f('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x4f0f('0xf')](function(_0x366a59){if(_0x366a59&&_0x366a59[_0x4f0f('0x3b')]){var _0x4bfb2b=_0x366a59[_0x4f0f('0x3d')]({'plain':!![]});_0x285081[_0x4f0f('0x3e')]=_0x4bfb2b;_0x285081[_0x4f0f('0x3f')]=_0x4bfb2b[_0x4f0f('0x40')];_0x285081['list']=_0x4bfb2b[_0x4f0f('0x3b')];_0x285081[_0x4f0f('0x3f')]=_[_0x4f0f('0x41')](_0x285081[_0x4f0f('0x3f')],['priority'],[_0x4f0f('0x42')]);if(_0x285081[_0x4f0f('0x3e')][_0x4f0f('0x40')]){delete _0x285081['account'][_0x4f0f('0x40')];}if(_0x285081[_0x4f0f('0x3e')][_0x4f0f('0x3b')]&&_0x285081['account']['List'][_0x4f0f('0x3c')][_0x4f0f('0x43')]){return _0x285081[_0x4f0f('0x3e')]['List']['Contacts'][0x0];}var _0x154357=_[_0x4f0f('0xb')](_0x4cd026[_0x4f0f('0x27')],{'firstName':_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x33')],'ListId':_0x4bfb2b[_0x4f0f('0x31')]});_0x154357[_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x36')]]=_0x4cd026[_0x4f0f('0x27')]['from'];return db[_0x4f0f('0x28')][_0x4f0f('0x44')](_0x154357,{'fields':_0x49b1c1,'raw':!![]});}})[_0x4f0f('0xf')](function(_0x21c93b){_0x285081[_0x4f0f('0x45')]=_0x21c93b;if(_0x21c93b){var _0x16f221={'ContactId':_0x21c93b['id'],'FaxAccountId':_0x4cd026[_0x4f0f('0x3e')]['id'],'fax':_0x21c93b['fax']};return db[_0x4f0f('0x46')][_0x4f0f('0x3a')]({'where':{'ContactId':_0x21c93b['id'],'closed':![],'FaxAccountId':_0x4cd026[_0x4f0f('0x3e')]['id']}})[_0x4f0f('0xf')](function(_0x51b302){if(_0x51b302){return[_0x51b302,![]];}return db[_0x4f0f('0x46')][_0x4f0f('0x44')](_0x16f221)[_0x4f0f('0xf')](function(_0xb4b7e8){return[_0xb4b7e8,!![]];});});}else{throw new Error(_0x4f0f('0x47'));}})['spread'](function(_0x1432dd,_0x3a02d3){var _0x14d0e2=_0x1432dd[_0x4f0f('0x3d')]({'plain':!![]});if(_0x3a02d3){if(_0x285081[_0x4f0f('0x3e')][_0x4f0f('0x48')]){_0x285081[_0x4f0f('0x3f')]['push']({'id':0x0,'priority':_0x285081[_0x4f0f('0x3f')]['length']+0x1,'app':_0x4f0f('0x49'),'appdata':_0x4f0f('0x4a'),'interval':'*,*,*,*'});}_0x14d0e2[_0x4f0f('0x4b')]=!![];}else{_0x14d0e2['created']=![];}_0x285081[_0x4f0f('0x4c')]=_0x14d0e2;return db['FaxMessage'][_0x4f0f('0x44')]({'body':_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x27')],'FaxAccountId':_0x4cd026[_0x4f0f('0x3e')]['id'],'FaxInteractionId':_0x1432dd['id'],'direction':'in','ContactId':_0x1432dd[_0x4f0f('0x4d')],'AttachmentId':_0x4cd026[_0x4f0f('0x27')][_0x4f0f('0x4e')]});})[_0x4f0f('0xf')](function(_0xc446de){_0x285081[_0x4f0f('0x17')]=_0xc446de;if(_0x285081[_0x4f0f('0x4c')][_0x4f0f('0x4f')]){return db['User'][_0x4f0f('0x3a')]({'attributes':['id',_0x4f0f('0x50')],'where':{'id':_0x285081[_0x4f0f('0x4c')][_0x4f0f('0x4f')]}})[_0x4f0f('0xf')](function(_0x56a362){if(_0x56a362){_0x285081['applications'][_0x4f0f('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x56a362[_0x4f0f('0x50')]+','+(_0x285081[_0x4f0f('0x3e')][_0x4f0f('0x52')]||0xa),'interval':_0x4f0f('0x53')});}return respondWithRpcPromise(_0x4f0f('0x54'),_0x4f0f('0x55'),_0x285081);});}return respondWithRpcPromise(_0x4f0f('0x54'),_0x4f0f('0x55'),_0x285081);})[_0x4f0f('0xf')](function(_0x539791){_0x2487c0(_0x539791);})[_0x4f0f('0x25')](function(_0x41bf2a){_0x3be713(_0x480626[_0x4f0f('0x15')](0x1f4,_0x41bf2a[_0x4f0f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6b8ece5..6f9e28a 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 _0x4ef0=['emit','faxAccount:','update'];(function(_0x4fc970,_0x56064c){var _0x169140=function(_0x1d4c8e){while(--_0x1d4c8e){_0x4fc970['push'](_0x4fc970['shift']());}};_0x169140(++_0x56064c);}(_0x4ef0,0xda));var _0x04ef=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x4ef0[_0x245afe];return _0x4eefde;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0x04ef('0x0')];function createListener(_0x83c748,_0xf7cdc3){return function(_0x4e7107){_0xf7cdc3[_0x04ef('0x1')](_0x83c748,_0x4e7107);};}function removeListener(_0x5e416c,_0x436d6e){return function(){FaxAccountEvents['removeListener'](_0x5e416c,_0x436d6e);};}exports['register']=function(_0x33c74a){for(var _0x30bb8c=0x0,_0x24f09f=events['length'];_0x30bb8c<_0x24f09f;_0x30bb8c++){var _0x3bc711=events[_0x30bb8c];var _0x2501f9=createListener(_0x04ef('0x2')+_0x3bc711,_0x33c74a);FaxAccountEvents['on'](_0x3bc711,_0x2501f9);}}; \ No newline at end of file +var _0xae4e=['faxAccount:','./faxAccount.events','save','remove','emit','removeListener','length'];(function(_0x5489ef,_0x400603){var _0x460e84=function(_0x247716){while(--_0x247716){_0x5489ef['push'](_0x5489ef['shift']());}};_0x460e84(++_0x400603);}(_0xae4e,0x10b));var _0xeae4=function(_0x35720c,_0x6a0cba){_0x35720c=_0x35720c-0x0;var _0xbf3d07=_0xae4e[_0x35720c];return _0xbf3d07;};'use strict';var FaxAccountEvents=require(_0xeae4('0x0'));var events=[_0xeae4('0x1'),_0xeae4('0x2'),'update'];function createListener(_0x31da4c,_0x23e115){return function(_0x1dbbfc){_0x23e115[_0xeae4('0x3')](_0x31da4c,_0x1dbbfc);};}function removeListener(_0x415eb5,_0x33fdb7){return function(){FaxAccountEvents[_0xeae4('0x4')](_0x415eb5,_0x33fdb7);};}exports['register']=function(_0x1d86f2){for(var _0x33cc3e=0x0,_0x5e01fc=events[_0xeae4('0x5')];_0x33cc3e<_0x5e01fc;_0x33cc3e++){var _0x5e0df8=events[_0x33cc3e];var _0x2292ed=createListener(_0xeae4('0x6')+_0x5e0df8,_0x1d86f2);FaxAccountEvents['on'](_0x5e0df8,_0x2292ed);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7112950..947a273 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x1a5a59,_0x1fa824){var _0x40491d=function(_0x4024e5){while(--_0x4024e5){_0x1a5a59['push'](_0x1a5a59['shift']());}};_0x40491d(++_0x1fa824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x134a1c,_0x23a135){var _0x3eb660=function(_0x2b76c3){while(--_0x2b76c3){_0x134a1c['push'](_0x134a1c['shift']());}};_0x3eb660(++_0x23a135);}(_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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c3c42e0..e5ca95a 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 _0xb647=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xe10904,_0x3d51c7){var _0x2d96d6=function(_0x57b888){while(--_0x57b888){_0xe10904['push'](_0xe10904['shift']());}};_0x2d96d6(++_0x3d51c7);}(_0xb647,0x15a));var _0x7b64=function(_0x272224,_0x56bf40){_0x272224=_0x272224-0x0;var _0x564eab=_0xb647[_0x272224];return _0x564eab;};'use strict';var Sequelize=require(_0x7b64('0x0'));module[_0x7b64('0x1')]={'priority':{'type':Sequelize[_0x7b64('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7b64('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7b64('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7b64('0x4')}}; \ No newline at end of file +var _0x79bd=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x79bd,0x80));var _0xd79b=function(_0x442bb6,_0x5ab3aa){_0x442bb6=_0x442bb6-0x0;var _0x5ea01e=_0x79bd[_0x442bb6];return _0x5ea01e;};'use strict';var Sequelize=require(_0xd79b('0x0'));module[_0xd79b('0x1')]={'priority':{'type':Sequelize[_0xd79b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd79b('0x3')],'allowNull':![],'defaultValue':_0xd79b('0x4')},'appdata':{'type':Sequelize[_0xd79b('0x5')]()},'description':{'type':Sequelize[_0xd79b('0x3')]},'interval':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':_0xd79b('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 06d4236..c887f7d 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 _0x16c5=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','find','catch','body','params','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0x16c5,0x10d));var _0x516c=function(_0xdf4bae,_0xa499bb){_0xdf4bae=_0xdf4bae-0x0;var _0x1e7337=_0x16c5[_0xdf4bae];return _0x1e7337;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x516c('0x0'));var zipdir=require(_0x516c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x516c('0x2'));var moment=require(_0x516c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x516c('0x4'));var util=require('util');var path=require(_0x516c('0x5'));var sox=require(_0x516c('0x6'));var csv=require(_0x516c('0x7'));var ejs=require(_0x516c('0x8'));var fs=require('fs');var fs_extra=require(_0x516c('0x9'));var _=require(_0x516c('0xa'));var squel=require(_0x516c('0xb'));var crypto=require('crypto');var jsforce=require(_0x516c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x516c('0xd'));var Papa=require('papaparse');var Redis=require(_0x516c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x516c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x516c('0x10'));var logger=require(_0x516c('0x11'))(_0x516c('0x12'));var utils=require(_0x516c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x516c('0x14'));var db=require(_0x516c('0x15'))['db'];function respondWithStatusCode(_0x2b56a1,_0x192a96){_0x192a96=_0x192a96||0xcc;return function(_0x33b0c6){if(_0x33b0c6){return _0x2b56a1[_0x516c('0x16')](_0x192a96);}return _0x2b56a1[_0x516c('0x17')](_0x192a96)[_0x516c('0x18')]();};}function respondWithResult(_0x56fac5,_0x3ac8ae){_0x3ac8ae=_0x3ac8ae||0xc8;return function(_0xb8348b){if(_0xb8348b){return _0x56fac5[_0x516c('0x17')](_0x3ac8ae)[_0x516c('0x19')](_0xb8348b);}};}function respondWithFilteredResult(_0x357847,_0x23f327){return function(_0x24c78c){if(_0x24c78c){var _0x166fb2=typeof _0x23f327[_0x516c('0x1a')]===_0x516c('0x1b')&&typeof _0x23f327[_0x516c('0x1c')]===_0x516c('0x1b');var _0x4a823e=_0x24c78c['count'];var _0xe3316=_0x166fb2?0x0:_0x23f327[_0x516c('0x1a')];var _0x11fe32=_0x166fb2?_0x24c78c[_0x516c('0x1d')]:_0x23f327[_0x516c('0x1a')]+_0x23f327['limit'];var _0x315cc8;if(_0x11fe32>=_0x4a823e){_0x11fe32=_0x4a823e;_0x315cc8=0xc8;}else{_0x315cc8=0xce;}_0x357847[_0x516c('0x17')](_0x315cc8);return _0x357847[_0x516c('0x1e')](_0x516c('0x1f'),_0xe3316+'-'+_0x11fe32+'/'+_0x4a823e)[_0x516c('0x19')](_0x24c78c);}return null;};}function patchUpdates(_0x53ef46){return function(_0xba7395){try{jsonpatch['apply'](_0xba7395,_0x53ef46,!![]);}catch(_0x918e1f){return BPromise[_0x516c('0x20')](_0x918e1f);}return _0xba7395[_0x516c('0x21')]();};}function saveUpdates(_0x114131,_0xfd4d6f){return function(_0x392f81){if(_0x392f81){return _0x392f81[_0x516c('0x22')](_0x114131)[_0x516c('0x23')](function(_0x46fbba){return _0x46fbba;});}return null;};}function removeEntity(_0x572b1a,_0x2f4002){return function(_0x1f6ba4){if(_0x1f6ba4){return _0x1f6ba4[_0x516c('0x24')]()[_0x516c('0x23')](function(){_0x572b1a['status'](0xcc)[_0x516c('0x18')]();});}};}function handleEntityNotFound(_0x4d8ee3,_0x2ad2d3){return function(_0x26cca9){if(!_0x26cca9){_0x4d8ee3['sendStatus'](0x194);}return _0x26cca9;};}function handleError(_0x429c3b,_0x418a98){_0x418a98=_0x418a98||0x1f4;return function(_0x258eb2){logger[_0x516c('0x25')](_0x258eb2[_0x516c('0x26')]);if(_0x258eb2[_0x516c('0x27')]){delete _0x258eb2['name'];}_0x429c3b[_0x516c('0x17')](_0x418a98)[_0x516c('0x28')](_0x258eb2);};}exports['index']=function(_0x29a9ad,_0x173638){var _0x1e5154={},_0x48d347={},_0x1937b8={'count':0x0,'rows':[]};var _0xbcec01=_[_0x516c('0x29')](db[_0x516c('0x2a')][_0x516c('0x2b')],function(_0x54aaef){return{'name':_0x54aaef[_0x516c('0x2c')],'type':_0x54aaef[_0x516c('0x2d')][_0x516c('0x2e')]};});_0x48d347['model']=_['map'](_0xbcec01,_0x516c('0x27'));_0x48d347[_0x516c('0x2f')]=_[_0x516c('0x30')](_0x29a9ad['query']);_0x48d347[_0x516c('0x31')]=_[_0x516c('0x32')](_0x48d347[_0x516c('0x33')],_0x48d347[_0x516c('0x2f')]);_0x1e5154[_0x516c('0x34')]=_[_0x516c('0x32')](_0x48d347[_0x516c('0x33')],qs['fields'](_0x29a9ad[_0x516c('0x2f')][_0x516c('0x35')]));_0x1e5154['attributes']=_0x1e5154[_0x516c('0x34')][_0x516c('0x36')]?_0x1e5154[_0x516c('0x34')]:_0x48d347[_0x516c('0x33')];if(!_0x29a9ad[_0x516c('0x2f')][_0x516c('0x37')](_0x516c('0x38'))){_0x1e5154['limit']=qs[_0x516c('0x1c')](_0x29a9ad['query'][_0x516c('0x1c')]);_0x1e5154[_0x516c('0x1a')]=qs[_0x516c('0x1a')](_0x29a9ad['query']['offset']);}_0x1e5154[_0x516c('0x39')]=qs[_0x516c('0x3a')](_0x29a9ad[_0x516c('0x2f')][_0x516c('0x3a')]);_0x1e5154[_0x516c('0x3b')]=qs['filters'](_[_0x516c('0x3c')](_0x29a9ad[_0x516c('0x2f')],_0x48d347[_0x516c('0x31')]),_0xbcec01);if(_0x29a9ad[_0x516c('0x2f')][_0x516c('0x3d')]){_0x1e5154[_0x516c('0x3b')]=_[_0x516c('0x3e')](_0x1e5154[_0x516c('0x3b')],{'$or':_[_0x516c('0x29')](_0xbcec01,function(_0x9ec3c3){if(_0x9ec3c3['type']!==_0x516c('0x3f')){var _0x2eac3e={};_0x2eac3e[_0x9ec3c3[_0x516c('0x27')]]={'$like':'%'+_0x29a9ad['query'][_0x516c('0x3d')]+'%'};return _0x2eac3e;}})});}_0x1e5154=_[_0x516c('0x3e')]({},_0x1e5154,_0x29a9ad[_0x516c('0x40')]);var _0x119b6={'where':_0x1e5154[_0x516c('0x3b')]};return db['FaxApplication'][_0x516c('0x1d')](_0x119b6)[_0x516c('0x23')](function(_0x481a45){_0x1937b8[_0x516c('0x1d')]=_0x481a45;if(_0x29a9ad[_0x516c('0x2f')]['includeAll']){_0x1e5154[_0x516c('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0x516c('0x42')](_0x1e5154);})[_0x516c('0x23')](function(_0x4cc784){_0x1937b8[_0x516c('0x43')]=_0x4cc784;return _0x1937b8;})[_0x516c('0x23')](respondWithFilteredResult(_0x173638,_0x1e5154))['catch'](handleError(_0x173638,null));};exports[_0x516c('0x44')]=function(_0x276cbc,_0x325b7e){var _0x1bc2a2={'raw':!![],'where':{'id':_0x276cbc['params']['id']}},_0x505321={};_0x505321[_0x516c('0x33')]=_[_0x516c('0x30')](db[_0x516c('0x2a')][_0x516c('0x2b')]);_0x505321[_0x516c('0x2f')]=_['keys'](_0x276cbc[_0x516c('0x2f')]);_0x505321[_0x516c('0x31')]=_[_0x516c('0x32')](_0x505321[_0x516c('0x33')],_0x505321[_0x516c('0x2f')]);_0x1bc2a2[_0x516c('0x34')]=_[_0x516c('0x32')](_0x505321[_0x516c('0x33')],qs['fields'](_0x276cbc['query'][_0x516c('0x35')]));_0x1bc2a2['attributes']=_0x1bc2a2[_0x516c('0x34')][_0x516c('0x36')]?_0x1bc2a2['attributes']:_0x505321[_0x516c('0x33')];if(_0x276cbc[_0x516c('0x2f')]['includeAll']){_0x1bc2a2[_0x516c('0x41')]=[{'all':!![]}];}_0x1bc2a2=_[_0x516c('0x3e')]({},_0x1bc2a2,_0x276cbc[_0x516c('0x40')]);return db[_0x516c('0x2a')][_0x516c('0x45')](_0x1bc2a2)['then'](handleEntityNotFound(_0x325b7e,null))['then'](respondWithResult(_0x325b7e,null))[_0x516c('0x46')](handleError(_0x325b7e,null));};exports['create']=function(_0x57bff3,_0xf8f3de){return db[_0x516c('0x2a')]['create'](_0x57bff3['body'],{})['then'](respondWithResult(_0xf8f3de,0xc9))[_0x516c('0x46')](handleError(_0xf8f3de,null));};exports[_0x516c('0x22')]=function(_0x261aa0,_0xc85ff8){if(_0x261aa0[_0x516c('0x47')]['id']){delete _0x261aa0[_0x516c('0x47')]['id'];}return db[_0x516c('0x2a')][_0x516c('0x45')]({'where':{'id':_0x261aa0['params']['id']}})[_0x516c('0x23')](handleEntityNotFound(_0xc85ff8,null))[_0x516c('0x23')](saveUpdates(_0x261aa0[_0x516c('0x47')],null))['then'](respondWithResult(_0xc85ff8,null))['catch'](handleError(_0xc85ff8,null));};exports['destroy']=function(_0x435701,_0x1683d4){return db[_0x516c('0x2a')][_0x516c('0x45')]({'where':{'id':_0x435701[_0x516c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1683d4,null))[_0x516c('0x23')](removeEntity(_0x1683d4,null))[_0x516c('0x46')](handleError(_0x1683d4,null));}; \ No newline at end of file +var _0x6e9e=['json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','findAll','rows','catch','show','include','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','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','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x2458e0,_0x2a9234){var _0x3fc9c7=function(_0x4ad98d){while(--_0x4ad98d){_0x2458e0['push'](_0x2458e0['shift']());}};_0x3fc9c7(++_0x2a9234);}(_0x6e9e,0x19d));var _0xe6e9=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x6e9e[_0xe6e78c];return _0x2a09c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6e9('0x0'));var zipdir=require(_0xe6e9('0x1'));var jsonpatch=require(_0xe6e9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6e9('0x3'));var Mustache=require(_0xe6e9('0x4'));var util=require('util');var path=require(_0xe6e9('0x5'));var sox=require(_0xe6e9('0x6'));var csv=require(_0xe6e9('0x7'));var ejs=require(_0xe6e9('0x8'));var fs=require('fs');var fs_extra=require(_0xe6e9('0x9'));var _=require(_0xe6e9('0xa'));var squel=require(_0xe6e9('0xb'));var crypto=require('crypto');var jsforce=require(_0xe6e9('0xc'));var deskjs=require(_0xe6e9('0xd'));var toCsv=require(_0xe6e9('0x7'));var querystring=require(_0xe6e9('0xe'));var Papa=require(_0xe6e9('0xf'));var Redis=require('ioredis');var authService=require(_0xe6e9('0x10'));var qs=require(_0xe6e9('0x11'));var as=require(_0xe6e9('0x12'));var hardwareService=require(_0xe6e9('0x13'));var logger=require('../../config/logger')(_0xe6e9('0x14'));var utils=require(_0xe6e9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe6e9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x433bc4,_0x20fb05){_0x20fb05=_0x20fb05||0xcc;return function(_0x2a0100){if(_0x2a0100){return _0x433bc4[_0xe6e9('0x17')](_0x20fb05);}return _0x433bc4['status'](_0x20fb05)['end']();};}function respondWithResult(_0x257994,_0x1cd01f){_0x1cd01f=_0x1cd01f||0xc8;return function(_0x441842){if(_0x441842){return _0x257994[_0xe6e9('0x18')](_0x1cd01f)[_0xe6e9('0x19')](_0x441842);}};}function respondWithFilteredResult(_0x52ada0,_0x2fc440){return function(_0xeed2fd){if(_0xeed2fd){var _0x144a47=typeof _0x2fc440[_0xe6e9('0x1a')]===_0xe6e9('0x1b')&&typeof _0x2fc440[_0xe6e9('0x1c')]==='undefined';var _0x556183=_0xeed2fd[_0xe6e9('0x1d')];var _0x33e116=_0x144a47?0x0:_0x2fc440['offset'];var _0x43cd61=_0x144a47?_0xeed2fd['count']:_0x2fc440[_0xe6e9('0x1a')]+_0x2fc440['limit'];var _0x4dfd31;if(_0x43cd61>=_0x556183){_0x43cd61=_0x556183;_0x4dfd31=0xc8;}else{_0x4dfd31=0xce;}_0x52ada0[_0xe6e9('0x18')](_0x4dfd31);return _0x52ada0[_0xe6e9('0x1e')](_0xe6e9('0x1f'),_0x33e116+'-'+_0x43cd61+'/'+_0x556183)[_0xe6e9('0x19')](_0xeed2fd);}return null;};}function patchUpdates(_0x88cdba){return function(_0x57000b){try{jsonpatch[_0xe6e9('0x20')](_0x57000b,_0x88cdba,!![]);}catch(_0x49691b){return BPromise['reject'](_0x49691b);}return _0x57000b[_0xe6e9('0x21')]();};}function saveUpdates(_0x4624cf,_0x1f9bed){return function(_0x4393a1){if(_0x4393a1){return _0x4393a1['update'](_0x4624cf)[_0xe6e9('0x22')](function(_0x38ccba){return _0x38ccba;});}return null;};}function removeEntity(_0x340df4,_0x533432){return function(_0x4833d1){if(_0x4833d1){return _0x4833d1[_0xe6e9('0x23')]()[_0xe6e9('0x22')](function(){_0x340df4['status'](0xcc)[_0xe6e9('0x24')]();});}};}function handleEntityNotFound(_0x3aacc4,_0x22e485){return function(_0x7956db){if(!_0x7956db){_0x3aacc4['sendStatus'](0x194);}return _0x7956db;};}function handleError(_0x1fd26e,_0xfad4d8){_0xfad4d8=_0xfad4d8||0x1f4;return function(_0x5520bb){logger[_0xe6e9('0x25')](_0x5520bb[_0xe6e9('0x26')]);if(_0x5520bb[_0xe6e9('0x27')]){delete _0x5520bb[_0xe6e9('0x27')];}_0x1fd26e[_0xe6e9('0x18')](_0xfad4d8)[_0xe6e9('0x28')](_0x5520bb);};}exports[_0xe6e9('0x29')]=function(_0x14f9ab,_0x2c488d){var _0x5e679a={},_0x1affc6={},_0x5a6806={'count':0x0,'rows':[]};var _0x4ed14d=_[_0xe6e9('0x2a')](db['FaxApplication'][_0xe6e9('0x2b')],function(_0x559b49){return{'name':_0x559b49[_0xe6e9('0x2c')],'type':_0x559b49[_0xe6e9('0x2d')][_0xe6e9('0x2e')]};});_0x1affc6[_0xe6e9('0x2f')]=_['map'](_0x4ed14d,_0xe6e9('0x27'));_0x1affc6[_0xe6e9('0x30')]=_[_0xe6e9('0x31')](_0x14f9ab[_0xe6e9('0x30')]);_0x1affc6[_0xe6e9('0x32')]=_['intersection'](_0x1affc6[_0xe6e9('0x2f')],_0x1affc6[_0xe6e9('0x30')]);_0x5e679a['attributes']=_[_0xe6e9('0x33')](_0x1affc6[_0xe6e9('0x2f')],qs[_0xe6e9('0x34')](_0x14f9ab[_0xe6e9('0x30')][_0xe6e9('0x34')]));_0x5e679a[_0xe6e9('0x35')]=_0x5e679a[_0xe6e9('0x35')]['length']?_0x5e679a[_0xe6e9('0x35')]:_0x1affc6[_0xe6e9('0x2f')];if(!_0x14f9ab[_0xe6e9('0x30')][_0xe6e9('0x36')]('nolimit')){_0x5e679a[_0xe6e9('0x1c')]=qs[_0xe6e9('0x1c')](_0x14f9ab[_0xe6e9('0x30')][_0xe6e9('0x1c')]);_0x5e679a[_0xe6e9('0x1a')]=qs['offset'](_0x14f9ab['query']['offset']);}_0x5e679a['order']=qs[_0xe6e9('0x37')](_0x14f9ab['query'][_0xe6e9('0x37')]);_0x5e679a[_0xe6e9('0x38')]=qs[_0xe6e9('0x32')](_[_0xe6e9('0x39')](_0x14f9ab[_0xe6e9('0x30')],_0x1affc6[_0xe6e9('0x32')]),_0x4ed14d);if(_0x14f9ab[_0xe6e9('0x30')][_0xe6e9('0x3a')]){_0x5e679a[_0xe6e9('0x38')]=_[_0xe6e9('0x3b')](_0x5e679a[_0xe6e9('0x38')],{'$or':_[_0xe6e9('0x2a')](_0x4ed14d,function(_0x4883d2){if(_0x4883d2[_0xe6e9('0x2d')]!==_0xe6e9('0x3c')){var _0x4f24eb={};_0x4f24eb[_0x4883d2[_0xe6e9('0x27')]]={'$like':'%'+_0x14f9ab[_0xe6e9('0x30')][_0xe6e9('0x3a')]+'%'};return _0x4f24eb;}})});}_0x5e679a=_['merge']({},_0x5e679a,_0x14f9ab[_0xe6e9('0x3d')]);var _0x3f1196={'where':_0x5e679a[_0xe6e9('0x38')]};return db['FaxApplication'][_0xe6e9('0x1d')](_0x3f1196)[_0xe6e9('0x22')](function(_0x3f5823){_0x5a6806[_0xe6e9('0x1d')]=_0x3f5823;if(_0x14f9ab[_0xe6e9('0x30')]['includeAll']){_0x5e679a['include']=[{'all':!![]}];}return db[_0xe6e9('0x3e')][_0xe6e9('0x3f')](_0x5e679a);})[_0xe6e9('0x22')](function(_0x8baf54){_0x5a6806[_0xe6e9('0x40')]=_0x8baf54;return _0x5a6806;})[_0xe6e9('0x22')](respondWithFilteredResult(_0x2c488d,_0x5e679a))[_0xe6e9('0x41')](handleError(_0x2c488d,null));};exports[_0xe6e9('0x42')]=function(_0x17176d,_0x59eb04){var _0x5e461a={'raw':!![],'where':{'id':_0x17176d['params']['id']}},_0x50be18={};_0x50be18[_0xe6e9('0x2f')]=_['keys'](db[_0xe6e9('0x3e')]['rawAttributes']);_0x50be18['query']=_[_0xe6e9('0x31')](_0x17176d['query']);_0x50be18['filters']=_['intersection'](_0x50be18[_0xe6e9('0x2f')],_0x50be18['query']);_0x5e461a[_0xe6e9('0x35')]=_['intersection'](_0x50be18['model'],qs[_0xe6e9('0x34')](_0x17176d[_0xe6e9('0x30')]['fields']));_0x5e461a[_0xe6e9('0x35')]=_0x5e461a[_0xe6e9('0x35')]['length']?_0x5e461a[_0xe6e9('0x35')]:_0x50be18[_0xe6e9('0x2f')];if(_0x17176d[_0xe6e9('0x30')]['includeAll']){_0x5e461a[_0xe6e9('0x43')]=[{'all':!![]}];}_0x5e461a=_[_0xe6e9('0x3b')]({},_0x5e461a,_0x17176d[_0xe6e9('0x3d')]);return db['FaxApplication'][_0xe6e9('0x44')](_0x5e461a)[_0xe6e9('0x22')](handleEntityNotFound(_0x59eb04,null))[_0xe6e9('0x22')](respondWithResult(_0x59eb04,null))['catch'](handleError(_0x59eb04,null));};exports[_0xe6e9('0x45')]=function(_0x1868da,_0x4b90fb){return db[_0xe6e9('0x3e')][_0xe6e9('0x45')](_0x1868da[_0xe6e9('0x46')],{})['then'](respondWithResult(_0x4b90fb,0xc9))['catch'](handleError(_0x4b90fb,null));};exports[_0xe6e9('0x47')]=function(_0x4d1625,_0x3ed9d1){if(_0x4d1625[_0xe6e9('0x46')]['id']){delete _0x4d1625[_0xe6e9('0x46')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x4d1625[_0xe6e9('0x48')]['id']}})[_0xe6e9('0x22')](handleEntityNotFound(_0x3ed9d1,null))['then'](saveUpdates(_0x4d1625[_0xe6e9('0x46')],null))['then'](respondWithResult(_0x3ed9d1,null))['catch'](handleError(_0x3ed9d1,null));};exports[_0xe6e9('0x23')]=function(_0x481812,_0xf5f312){return db['FaxApplication'][_0xe6e9('0x44')]({'where':{'id':_0x481812[_0xe6e9('0x48')]['id']}})['then'](handleEntityNotFound(_0xf5f312,null))[_0xe6e9('0x22')](removeEntity(_0xf5f312,null))[_0xe6e9('0x41')](handleError(_0xf5f312,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 8b14628..ae0cb9f 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 _0x17b5=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x17b5,0x15a));var _0x517b=function(_0x5cfcef,_0x20d843){_0x5cfcef=_0x5cfcef-0x0;var _0x21df12=_0x17b5[_0x5cfcef];return _0x21df12;};'use strict';var _=require(_0x517b('0x0'));var util=require(_0x517b('0x1'));var logger=require(_0x517b('0x2'))(_0x517b('0x3'));var moment=require(_0x517b('0x4'));var BPromise=require(_0x517b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x517b('0x6'));var rimraf=require('rimraf');var config=require(_0x517b('0x7'));var attributes=require(_0x517b('0x8'));module[_0x517b('0x9')]=function(_0x2e318c,_0x9997b9){return _0x2e318c[_0x517b('0xa')](_0x517b('0xb'),attributes,{'tableName':_0x517b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x517b('0xd'),'collate':_0x517b('0xe')});}; \ No newline at end of file +var _0x45d0=['FaxApplication','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x54c259,_0x2f6813){var _0x2c1e04=function(_0x3f6e5a){while(--_0x3f6e5a){_0x54c259['push'](_0x54c259['shift']());}};_0x2c1e04(++_0x2f6813);}(_0x45d0,0xb8));var _0x045d=function(_0xe7c01e,_0xc06596){_0xe7c01e=_0xe7c01e-0x0;var _0x59095a=_0x45d0[_0xe7c01e];return _0x59095a;};'use strict';var _=require(_0x045d('0x0'));var util=require('util');var logger=require(_0x045d('0x1'))(_0x045d('0x2'));var moment=require(_0x045d('0x3'));var BPromise=require(_0x045d('0x4'));var rp=require(_0x045d('0x5'));var fs=require('fs');var path=require(_0x045d('0x6'));var rimraf=require(_0x045d('0x7'));var config=require(_0x045d('0x8'));var attributes=require(_0x045d('0x9'));module[_0x045d('0xa')]=function(_0x3dd6f2,_0x52bc9e){return _0x3dd6f2[_0x045d('0xb')](_0x045d('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x045d('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 a20b62c..2746845 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 _0xd3ff=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','update','body','options','where','limit','stringify','lodash','util','moment','randomstring','ioredis'];(function(_0x4604fa,_0xa44471){var _0x258783=function(_0x294b2c){while(--_0x294b2c){_0x4604fa['push'](_0x4604fa['shift']());}};_0x258783(++_0xa44471);}(_0xd3ff,0x1ae));var _0xfd3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfd3f('0x0'));var util=require(_0xfd3f('0x1'));var moment=require(_0xfd3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd3f('0x3'));var fs=require('fs');var Redis=require(_0xfd3f('0x4'));var db=require(_0xfd3f('0x5'))['db'];var utils=require(_0xfd3f('0x6'));var logger=require(_0xfd3f('0x7'))(_0xfd3f('0x8'));var config=require(_0xfd3f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41dcb5,_0xdc397c,_0x28d155){return new BPromise(function(_0xae296a,_0x4df669){return client['request'](_0x41dcb5,_0x28d155)[_0xfd3f('0xb')](function(_0x5bacf8){logger[_0xfd3f('0xc')](_0xfd3f('0xd'),_0xdc397c,_0xfd3f('0xe'));logger[_0xfd3f('0xf')](_0xfd3f('0x10'),_0xdc397c,'request\x20sent',JSON['stringify'](_0x5bacf8));if(_0x5bacf8[_0xfd3f('0x11')]){if(_0x5bacf8[_0xfd3f('0x11')][_0xfd3f('0x12')]===0x1f4){logger['error'](_0xfd3f('0xd'),_0xdc397c,_0x5bacf8[_0xfd3f('0x11')]['message']);return _0x4df669(_0x5bacf8['error']['message']);}logger[_0xfd3f('0x11')](_0xfd3f('0xd'),_0xdc397c,_0x5bacf8['error'][_0xfd3f('0x13')]);return _0xae296a(_0x5bacf8[_0xfd3f('0x11')][_0xfd3f('0x13')]);}else{logger[_0xfd3f('0xc')](_0xfd3f('0xd'),_0xdc397c,_0xfd3f('0xe'));_0xae296a(_0x5bacf8[_0xfd3f('0x14')][_0xfd3f('0x13')]);}})[_0xfd3f('0x15')](function(_0x1f08d6){logger[_0xfd3f('0x11')](_0xfd3f('0xd'),_0xdc397c,_0x1f08d6);_0x4df669(_0x1f08d6);});});}exports[_0xfd3f('0x16')]=function(_0x514ea4){var _0x110b7f=this;return new Promise(function(_0x76e0ae,_0xc5c37b){return db['FaxApplication'][_0xfd3f('0x17')](_0x514ea4[_0xfd3f('0x18')],{'raw':_0x514ea4[_0xfd3f('0x19')]?_0x514ea4[_0xfd3f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514ea4['options']?_0x514ea4['options'][_0xfd3f('0x1a')]||null:null,'attributes':_0x514ea4[_0xfd3f('0x19')]?_0x514ea4[_0xfd3f('0x19')]['attributes']||null:null,'limit':_0x514ea4[_0xfd3f('0x19')]?_0x514ea4[_0xfd3f('0x19')][_0xfd3f('0x1b')]||null:null})['then'](function(_0x7f624b){logger['info'](_0xfd3f('0x16'),_0x514ea4);logger[_0xfd3f('0xf')]('UpdateFaxApplication',_0x514ea4,JSON[_0xfd3f('0x1c')](_0x7f624b));_0x76e0ae(_0x7f624b);})[_0xfd3f('0x15')](function(_0xde9d){logger[_0xfd3f('0x11')]('UpdateFaxApplication',_0xde9d[_0xfd3f('0x13')],_0x514ea4);_0xc5c37b(_0x110b7f[_0xfd3f('0x11')](0x1f4,_0xde9d[_0xfd3f('0x13')]));});});}; \ No newline at end of file +var _0x6ba5=['UpdateFaxApplication','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','body','options','attributes','limit'];(function(_0x113374,_0x59e4a6){var _0x1f0036=function(_0x1593da){while(--_0x1593da){_0x113374['push'](_0x113374['shift']());}};_0x1f0036(++_0x59e4a6);}(_0x6ba5,0x1ef));var _0x56ba=function(_0x23f7aa,_0xddb5ef){_0x23f7aa=_0x23f7aa-0x0;var _0x37441b=_0x6ba5[_0x23f7aa];return _0x37441b;};'use strict';var _=require(_0x56ba('0x0'));var util=require(_0x56ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56ba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56ba('0x3'))['db'];var utils=require(_0x56ba('0x4'));var logger=require(_0x56ba('0x5'))(_0x56ba('0x6'));var config=require(_0x56ba('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa6a2f4,_0x393205,_0x465645){return new BPromise(function(_0x1e200b,_0x4f5f10){return client[_0x56ba('0x8')](_0xa6a2f4,_0x465645)['then'](function(_0x4a79f4){logger[_0x56ba('0x9')](_0x56ba('0xa'),_0x393205,'request\x20sent');logger[_0x56ba('0xb')](_0x56ba('0xc'),_0x393205,_0x56ba('0xd'),JSON[_0x56ba('0xe')](_0x4a79f4));if(_0x4a79f4[_0x56ba('0xf')]){if(_0x4a79f4[_0x56ba('0xf')][_0x56ba('0x10')]===0x1f4){logger[_0x56ba('0xf')](_0x56ba('0xa'),_0x393205,_0x4a79f4[_0x56ba('0xf')][_0x56ba('0x11')]);return _0x4f5f10(_0x4a79f4[_0x56ba('0xf')][_0x56ba('0x11')]);}logger[_0x56ba('0xf')](_0x56ba('0xa'),_0x393205,_0x4a79f4['error'][_0x56ba('0x11')]);return _0x1e200b(_0x4a79f4[_0x56ba('0xf')]['message']);}else{logger[_0x56ba('0x9')]('FaxApplication,\x20%s,\x20%s',_0x393205,_0x56ba('0xd'));_0x1e200b(_0x4a79f4[_0x56ba('0x12')][_0x56ba('0x11')]);}})[_0x56ba('0x13')](function(_0x597ad4){logger['error'](_0x56ba('0xa'),_0x393205,_0x597ad4);_0x4f5f10(_0x597ad4);});});}exports['UpdateFaxApplication']=function(_0x162c4c){var _0x56f107=this;return new Promise(function(_0x51652b,_0x430c96){return db['FaxApplication'][_0x56ba('0x14')](_0x162c4c[_0x56ba('0x15')],{'raw':_0x162c4c['options']?_0x162c4c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x162c4c['options']?_0x162c4c[_0x56ba('0x16')]['where']||null:null,'attributes':_0x162c4c[_0x56ba('0x16')]?_0x162c4c['options'][_0x56ba('0x17')]||null:null,'limit':_0x162c4c[_0x56ba('0x16')]?_0x162c4c[_0x56ba('0x16')][_0x56ba('0x18')]||null:null})['then'](function(_0x122352){logger[_0x56ba('0x9')](_0x56ba('0x19'),_0x162c4c);logger[_0x56ba('0xb')](_0x56ba('0x19'),_0x162c4c,JSON[_0x56ba('0xe')](_0x122352));_0x51652b(_0x122352);})['catch'](function(_0x2fa1da){logger[_0x56ba('0xf')](_0x56ba('0x19'),_0x2fa1da[_0x56ba('0x11')],_0x162c4c);_0x430c96(_0x56f107[_0x56ba('0xf')](0x1f4,_0x2fa1da[_0x56ba('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 49bfcd0..505882b 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x1eba[_0xfcbcb8];return _0x1b1f97;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea28,0x13a));var _0x8ea2=function(_0x25a945,_0x45b040){_0x25a945=_0x25a945-0x0;var _0x2ec358=_0xea28[_0x25a945];return _0x2ec358;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index df30184..e3b5d96 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 _0x9929=['sequelize','BOOLEAN','STRING','DATE','out'];(function(_0x342123,_0x388ac8){var _0x18dcef=function(_0x51c70f){while(--_0x51c70f){_0x342123['push'](_0x342123['shift']());}};_0x18dcef(++_0x388ac8);}(_0x9929,0x64));var _0x9992=function(_0x479837,_0x4f2bef){_0x479837=_0x479837-0x0;var _0xc458a3=_0x9929[_0x479837];return _0xc458a3;};'use strict';var Sequelize=require(_0x9992('0x0'));module['exports']={'closed':{'type':Sequelize[_0x9992('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9992('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9992('0x2')]},'read1stAt':{'type':Sequelize[_0x9992('0x3')]},'fax':{'type':Sequelize[_0x9992('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9992('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9992('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9992('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3b2b=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x3b2b,0x70));var _0xb3b2=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x3b2b[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0xb3b2('0x0'));module[_0xb3b2('0x1')]={'closed':{'type':Sequelize[_0xb3b2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb3b2('0x3')]},'disposition':{'type':Sequelize[_0xb3b2('0x4')]},'secondDisposition':{'type':Sequelize[_0xb3b2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb3b2('0x4')]},'note':{'type':Sequelize[_0xb3b2('0x4')]},'read1stAt':{'type':Sequelize[_0xb3b2('0x3')]},'fax':{'type':Sequelize[_0xb3b2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb3b2('0x5')]('in',_0xb3b2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb3b2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb3b2('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 09f4ba5..5954fd9 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 _0xf50a=['nolimit','sort','where','FaxInteractionId','map','filter','$gte','split','format','options','includeAll','rows','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','root','files','server','attachments','join','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','status','end','undefined','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','show','model','keys','filters','intersection','attributes','length','include','merge','find','catch','create','body','params','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage'];(function(_0x5572fe,_0x3d439c){var _0x4b6196=function(_0x12dc77){while(--_0x12dc77){_0x5572fe['push'](_0x5572fe['shift']());}};_0x4b6196(++_0x3d439c);}(_0xf50a,0x87));var _0xaf50=function(_0x544f46,_0x168b65){_0x544f46=_0x544f46-0x0;var _0x21e7f2=_0xf50a[_0x544f46];return _0x21e7f2;};'use strict';var rimraf=require(_0xaf50('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xaf50('0x1'));var util=require(_0xaf50('0x2'));var path=require(_0xaf50('0x3'));var fs=require('fs');var _=require(_0xaf50('0x4'));var Redis=require('ioredis');var interaction=require(_0xaf50('0x5'));var qs=require(_0xaf50('0x6'));var logger=require('../../config/logger')(_0xaf50('0x7'));var config=require(_0xaf50('0x8'));var db=require(_0xaf50('0x9'))['db'];config[_0xaf50('0xa')]=_[_0xaf50('0xb')](config[_0xaf50('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf50('0xc'))(new Redis(config[_0xaf50('0xa')]));require(_0xaf50('0xd'))['register'](socket);function respondWithStatusCode(_0x975e35,_0x51b899){_0x51b899=_0x51b899||0xcc;return function(_0x3ed8c5){if(_0x3ed8c5){return _0x975e35['sendStatus'](_0x51b899);}return _0x975e35[_0xaf50('0xe')](_0x51b899)[_0xaf50('0xf')]();};}function respondWithResult(_0x24dcb0,_0x702c6f){_0x702c6f=_0x702c6f||0xc8;return function(_0x168db7){if(_0x168db7){return _0x24dcb0[_0xaf50('0xe')](_0x702c6f)['json'](_0x168db7);}};}function respondWithFilteredResult(_0x4c6528,_0x107807){return function(_0x4f1048){if(_0x4f1048){var _0x2f4820=typeof _0x107807['offset']===_0xaf50('0x10')&&typeof _0x107807['limit']==='undefined';var _0xa44131=_0x4f1048[_0xaf50('0x11')];var _0x2d6678=_0x2f4820?0x0:_0x107807[_0xaf50('0x12')];var _0x5064c8=_0x2f4820?_0x4f1048[_0xaf50('0x11')]:_0x107807['offset']+_0x107807[_0xaf50('0x13')];var _0x2f1576;if(_0x5064c8>=_0xa44131){_0x5064c8=_0xa44131;_0x2f1576=0xc8;}else{_0x2f1576=0xce;}_0x4c6528[_0xaf50('0xe')](_0x2f1576);return _0x4c6528[_0xaf50('0x14')](_0xaf50('0x15'),_0x2d6678+'-'+_0x5064c8+'/'+_0xa44131)['json'](_0x4f1048);}return null;};}function saveUpdates(_0xdc526e){return function(_0x457aea){if(_0x457aea){return _0x457aea[_0xaf50('0x16')](_0xdc526e)[_0xaf50('0x17')](function(_0x2c2c05){return _0x2c2c05;});}return null;};}function removeEntity(_0x539eb7){return function(_0x562d6c){if(_0x562d6c){return _0x562d6c[_0xaf50('0x18')]()[_0xaf50('0x17')](function(){_0x539eb7[_0xaf50('0xe')](0xcc)[_0xaf50('0xf')]();});}};}function handleEntityNotFound(_0x9afe2a){return function(_0x524c85){if(!_0x524c85){_0x9afe2a[_0xaf50('0x19')](0x194);}return _0x524c85;};}function handleError(_0x51cf99,_0x299929){_0x299929=_0x299929||0x1f4;return function(_0x41f308){logger['error'](_0x41f308[_0xaf50('0x1a')]);if(_0x41f308['name']){delete _0x41f308[_0xaf50('0x1b')];}_0x51cf99[_0xaf50('0xe')](_0x299929)[_0xaf50('0x1c')](_0x41f308);};}exports[_0xaf50('0x1d')]=function(_0x5332e4,_0x49e768){var _0x4a0307={};var _0x320314=_['map'](db[_0xaf50('0x1e')][_0xaf50('0x1f')],function(_0x23b327){return{'name':_0x23b327[_0xaf50('0x20')],'type':_0x23b327[_0xaf50('0x21')][_0xaf50('0x22')]};});_0x4a0307=qs[_0xaf50('0x23')](_0x320314,_0x5332e4);return interaction[_0xaf50('0x24')](_0xaf50('0x25'),_0x5332e4[_0xaf50('0x26')],_0x5332e4[_0xaf50('0x27')],_0x4a0307,_0x320314)['then'](respondWithFilteredResult(_0x49e768,_0x4a0307))['catch'](handleError(_0x49e768,null));};exports[_0xaf50('0x28')]=function(_0x14c7b5,_0x35dbe7){var _0x580d42={'raw':![],'where':{'id':_0x14c7b5['params']['id']}},_0x3f61ff={};_0x3f61ff[_0xaf50('0x29')]=_[_0xaf50('0x2a')](db['FaxInteraction'][_0xaf50('0x1f')]);_0x3f61ff[_0xaf50('0x26')]=_['keys'](_0x14c7b5[_0xaf50('0x26')]);_0x3f61ff[_0xaf50('0x2b')]=_[_0xaf50('0x2c')](_0x3f61ff['model'],_0x3f61ff[_0xaf50('0x26')]);_0x580d42[_0xaf50('0x2d')]=_[_0xaf50('0x2c')](_0x3f61ff[_0xaf50('0x29')],qs['fields'](_0x14c7b5[_0xaf50('0x26')]['fields']));_0x580d42[_0xaf50('0x2d')]=_0x580d42[_0xaf50('0x2d')][_0xaf50('0x2e')]?_0x580d42['attributes']:_0x3f61ff[_0xaf50('0x29')];if(_0x14c7b5[_0xaf50('0x26')]['includeAll']){_0x580d42[_0xaf50('0x2f')]=[{'all':!![]}];}_0x580d42=_[_0xaf50('0x30')]({},_0x580d42,_0x14c7b5['options']);return db[_0xaf50('0x1e')][_0xaf50('0x31')](_0x580d42)[_0xaf50('0x17')](handleEntityNotFound(_0x35dbe7,null))['then'](respondWithResult(_0x35dbe7,null))[_0xaf50('0x32')](handleError(_0x35dbe7,null));};exports[_0xaf50('0x33')]=function(_0x28e6f2,_0x1f5034){return db[_0xaf50('0x1e')][_0xaf50('0x33')](_0x28e6f2[_0xaf50('0x34')],{})[_0xaf50('0x17')](respondWithResult(_0x1f5034,0xc9))[_0xaf50('0x32')](handleError(_0x1f5034,null));};exports[_0xaf50('0x16')]=function(_0x4270fe,_0xa874fa){if(_0x4270fe[_0xaf50('0x34')]['id']){delete _0x4270fe[_0xaf50('0x34')]['id'];}return db[_0xaf50('0x1e')]['find']({'where':{'id':_0x4270fe['params']['id']}})[_0xaf50('0x17')](handleEntityNotFound(_0xa874fa,null))[_0xaf50('0x17')](saveUpdates(_0x4270fe[_0xaf50('0x34')],null))[_0xaf50('0x17')](respondWithResult(_0xa874fa,null))[_0xaf50('0x32')](handleError(_0xa874fa,null));};exports[_0xaf50('0x18')]=function(_0xe55ad,_0x340eb0){return db[_0xaf50('0x1e')][_0xaf50('0x31')]({'where':{'id':_0xe55ad[_0xaf50('0x35')]['id']}})[_0xaf50('0x17')](handleEntityNotFound(_0x340eb0,null))[_0xaf50('0x17')](removeEntity(_0x340eb0,null))[_0xaf50('0x32')](handleError(_0x340eb0,null));};exports[_0xaf50('0x36')]=function(_0x52d8d5,_0x1f4264){return db[_0xaf50('0x1e')]['describe']()['then'](respondWithResult(_0x1f4264,null))[_0xaf50('0x32')](handleError(_0x1f4264,null));};exports[_0xaf50('0x37')]=function(_0x50a3c1,_0x77a04a){return db['FaxMessage'][_0xaf50('0x31')]({'where':{'id':_0x50a3c1[_0xaf50('0x35')]['id']}})['then'](handleEntityNotFound(_0x77a04a,null))[_0xaf50('0x17')](function(_0x116ec3){if(_0x116ec3){return _0x116ec3[_0xaf50('0x37')](_0x50a3c1[_0xaf50('0x34')]['ids'],_[_0xaf50('0x38')](_0x50a3c1['body'],[_0xaf50('0x39'),'id'])||{});}})[_0xaf50('0x17')](respondWithResult(_0x77a04a,null))['catch'](handleError(_0x77a04a,null));};exports[_0xaf50('0x3a')]=function(_0x422735,_0x8afd1c){var _0x15dc11={'raw':![],'where':{}};var _0x2d9ed3={};var _0x1cce5b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xaf50('0x3b')]({'where':{'id':_0x422735[_0xaf50('0x35')]['id']}})[_0xaf50('0x17')](handleEntityNotFound(_0x8afd1c,null))[_0xaf50('0x17')](function(_0x526ead){if(_0x526ead){_0x2d9ed3[_0xaf50('0x29')]=_['keys'](db[_0xaf50('0x3c')][_0xaf50('0x1f')]);_0x2d9ed3[_0xaf50('0x26')]=_[_0xaf50('0x2a')](_0x422735[_0xaf50('0x26')]);_0x2d9ed3[_0xaf50('0x2b')]=_[_0xaf50('0x2c')](_0x2d9ed3[_0xaf50('0x29')],_0x2d9ed3[_0xaf50('0x26')]);_0x15dc11['attributes']=_[_0xaf50('0x2c')](_0x2d9ed3[_0xaf50('0x29')],qs['fields'](_0x422735[_0xaf50('0x26')]['fields']));_0x15dc11['attributes']=_0x15dc11[_0xaf50('0x2d')]['length']?_0x15dc11[_0xaf50('0x2d')]:_0x2d9ed3[_0xaf50('0x29')];if(!_0x422735[_0xaf50('0x26')]['hasOwnProperty'](_0xaf50('0x3d'))){_0x15dc11[_0xaf50('0x13')]=qs['limit'](_0x422735['query'][_0xaf50('0x13')]);_0x15dc11['offset']=qs['offset'](_0x422735[_0xaf50('0x26')]['offset']);}_0x15dc11['order']=qs['sort'](_0x422735[_0xaf50('0x26')][_0xaf50('0x3e')]);_0x15dc11[_0xaf50('0x3f')]=qs[_0xaf50('0x2b')](_['pick'](_0x422735['query'],_0x2d9ed3[_0xaf50('0x2b')]));_0x15dc11['where'][_0xaf50('0x40')]=_0x526ead['id'];if(_0x422735[_0xaf50('0x26')]['filter']){_0x15dc11[_0xaf50('0x3f')]=_[_0xaf50('0x30')](_0x15dc11[_0xaf50('0x3f')],{'$or':_[_0xaf50('0x41')](_0x15dc11[_0xaf50('0x2d')],function(_0x488714){var _0x357778={};_0x357778[_0x488714]={'$like':'%'+_0x422735[_0xaf50('0x26')][_0xaf50('0x42')]+'%'};return _0x357778;})});}if(_0x422735[_0xaf50('0x26')][_0xaf50('0x43')]){var _0x4c2000=_0x422735[_0xaf50('0x26')]['$gte'][_0xaf50('0x44')](',');var _0xedbbfb={};_0xedbbfb[_0x4c2000[0x0]]={'$gte':moment(_0x4c2000[0x1])[_0xaf50('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15dc11[_0xaf50('0x3f')]=_[_0xaf50('0x30')](_0x15dc11[_0xaf50('0x3f')],_0xedbbfb);}_0x15dc11=_[_0xaf50('0x30')]({},_0x15dc11,_0x422735[_0xaf50('0x46')]);return db[_0xaf50('0x3c')][_0xaf50('0x11')]({'where':_0x15dc11[_0xaf50('0x3f')]})[_0xaf50('0x17')](function(_0x4532aa){_0x1cce5b[_0xaf50('0x11')]=_0x4532aa;if(_0x422735['query'][_0xaf50('0x47')]){_0x15dc11['include']=[{'all':!![]}];}return db[_0xaf50('0x3c')]['findAll'](_0x15dc11);})['then'](function(_0x215491){_0x1cce5b[_0xaf50('0x48')]=_0x215491;return _0x1cce5b;});}})[_0xaf50('0x17')](respondWithFilteredResult(_0x8afd1c,_0x15dc11))[_0xaf50('0x32')](handleError(_0x8afd1c,null));};exports['addTags']=function(_0x38a14d,_0x37ba54){return db[_0xaf50('0x1e')][_0xaf50('0x31')]({'where':{'id':_0x38a14d[_0xaf50('0x35')]['id']}})[_0xaf50('0x17')](handleEntityNotFound(_0x37ba54,null))[_0xaf50('0x17')](function(_0x129a2b){if(_0x129a2b){return _0x129a2b['setTags'](_0x38a14d[_0xaf50('0x34')][_0xaf50('0x39')],_[_0xaf50('0x38')](_0x38a14d[_0xaf50('0x34')],['ids','id'])||{})['spread'](function(){return db[_0xaf50('0x49')][_0xaf50('0x24')]({'attributes':['id',_0xaf50('0x1b'),_0xaf50('0x4a')],'where':{'id':_0x38a14d[_0xaf50('0x34')][_0xaf50('0x39')]}});})[_0xaf50('0x17')](function(_0x2129ba){socket[_0xaf50('0x4b')](_0xaf50('0x4c'),{'id':Number(_0x38a14d[_0xaf50('0x35')]['id']),'tags':_0x2129ba||[]});return{'id':Number(_0x38a14d['params']['id']),'tags':_0x2129ba||[]};});}})['then'](respondWithResult(_0x37ba54,null))['catch'](handleError(_0x37ba54,null));};exports[_0xaf50('0x4d')]=function(_0x33013f,_0x39d777){return db[_0xaf50('0x1e')][_0xaf50('0x31')]({'where':{'id':_0x33013f['params']['id']}})[_0xaf50('0x17')](handleEntityNotFound(_0x39d777,null))['then'](function(_0x24e932){if(_0x24e932){return _0x24e932[_0xaf50('0x4d')](_0x33013f[_0xaf50('0x26')][_0xaf50('0x39')]);}})[_0xaf50('0x17')](respondWithStatusCode(_0x39d777,null))[_0xaf50('0x32')](handleError(_0x39d777,null));};exports[_0xaf50('0x4e')]=function(_0x40c40b,_0x5d2db2){var _0x109a6c=moment()[_0xaf50('0x4f')]()['toString']();var _0x38cf50=path['join'](config[_0xaf50('0x50')],'server',_0xaf50('0x51'),'tmp');var _0x154116=path['join'](config['root'],_0xaf50('0x52'),_0xaf50('0x51'),_0xaf50('0x53'));var _0x5d350a=path[_0xaf50('0x54')](_0x38cf50,_0x109a6c);var _0x1729c6=util[_0xaf50('0x45')](_0xaf50('0x55'),_0x40c40b[_0xaf50('0x35')]['id'],_0x109a6c);var _0x3f837c=path[_0xaf50('0x54')](_0x38cf50,_0x1729c6);var _0x375f4b=[];_0x375f4b['push']({'model':db['Attachment'],'as':_0xaf50('0x56'),'raw':!![]});var _0xbed70c=[{'model':db[_0xaf50('0x3c')],'as':'Messages','attributes':['id','body',_0xaf50('0x57')],'include':_0x375f4b}];return db[_0xaf50('0x1e')][_0xaf50('0x31')]({'where':{'id':_0x40c40b[_0xaf50('0x35')]['id']},'include':_0xbed70c})[_0xaf50('0x17')](handleEntityNotFound(_0x5d2db2,null))['then'](function(_0x2a7e1d){if(_0x2a7e1d&&_0x2a7e1d[_0xaf50('0x58')]){var _0x1486a4=_0x2a7e1d[_0xaf50('0x59')]({'plain':!![]});fs[_0xaf50('0x5a')](_0x5d350a);for(var _0x519e10=0x0;_0x519e10<_0x1486a4[_0xaf50('0x58')][_0xaf50('0x2e')];_0x519e10++){var _0x48a873=_0x1486a4['Messages'][_0x519e10][_0xaf50('0x56')];if(_0x48a873){var _0x1ba75b=path['join'](_0x154116,_0x48a873['basename']);if(fs['existsSync'](_0x1ba75b)){fs[_0xaf50('0x5b')](_0x1ba75b)[_0xaf50('0x5c')](fs[_0xaf50('0x5d')](path[_0xaf50('0x54')](_0x5d350a,_0x48a873['basename'])));}}}return BPromise[_0xaf50('0x5e')]()[_0xaf50('0x17')](function(){return new BPromise(function(_0x4d2b54,_0x2315e7){zipdir(_0x5d350a,{'saveTo':_0x3f837c},function(_0x3b3663,_0x38faf2){if(_0x3b3663)return _0x2315e7(_0x3b3663);return _0x4d2b54(_0x38faf2);});})[_0xaf50('0x17')](function(){return new BPromise(function(_0x326ad5,_0x266275){rimraf(_0x5d350a,function(_0xb793c9){if(_0xb793c9)_0x266275(_0xb793c9);return _0x326ad5();});});})['then'](function(){return _0x5d2db2[_0xaf50('0x4e')](_0x3f837c,_0x1729c6,function(_0x4bd7ad){if(_0x4bd7ad){console[_0xaf50('0x5f')](_0xaf50('0x60'),_0x4bd7ad);}else{fs[_0xaf50('0x61')](_0x3f837c);}});});});}else{return _0x5d2db2[_0xaf50('0x19')](0xc8);}})[_0xaf50('0x32')](handleError(_0x5d2db2,null));}; \ No newline at end of file +var _0xb225=['filter','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','color','emit','removeTags','download','toString','join','root','server','files','attachments','push','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','rawAttributes','type','key','getOptions','findAll','fax','model','keys','query','filters','intersection','attributes','fields','length','include','merge','options','FaxInteraction','find','catch','create','body','params','describe','FaxMessage','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','pick'];(function(_0x58e62f,_0x38ea46){var _0x7ed624=function(_0x1a95a3){while(--_0x1a95a3){_0x58e62f['push'](_0x58e62f['shift']());}};_0x7ed624(++_0x38ea46);}(_0xb225,0x153));var _0x5b22=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0xb225[_0x383627];return _0x2c16a0;};'use strict';var rimraf=require(_0x5b22('0x0'));var zipdir=require(_0x5b22('0x1'));var moment=require(_0x5b22('0x2'));var BPromise=require(_0x5b22('0x3'));var util=require(_0x5b22('0x4'));var path=require(_0x5b22('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x5b22('0x6'));var interaction=require(_0x5b22('0x7'));var qs=require(_0x5b22('0x8'));var logger=require(_0x5b22('0x9'))(_0x5b22('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5b22('0xb')]=_[_0x5b22('0xc')](config[_0x5b22('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b22('0xd'))(new Redis(config['redis']));require(_0x5b22('0xe'))[_0x5b22('0xf')](socket);function respondWithStatusCode(_0x21e374,_0x27b514){_0x27b514=_0x27b514||0xcc;return function(_0x5eda1b){if(_0x5eda1b){return _0x21e374[_0x5b22('0x10')](_0x27b514);}return _0x21e374[_0x5b22('0x11')](_0x27b514)[_0x5b22('0x12')]();};}function respondWithResult(_0xc1a15a,_0x52ea7d){_0x52ea7d=_0x52ea7d||0xc8;return function(_0x8ab472){if(_0x8ab472){return _0xc1a15a['status'](_0x52ea7d)[_0x5b22('0x13')](_0x8ab472);}};}function respondWithFilteredResult(_0x5a63be,_0x39ec01){return function(_0x27c586){if(_0x27c586){var _0x27ea4c=typeof _0x39ec01[_0x5b22('0x14')]===_0x5b22('0x15')&&typeof _0x39ec01['limit']===_0x5b22('0x15');var _0x187fe4=_0x27c586[_0x5b22('0x16')];var _0x43a1f9=_0x27ea4c?0x0:_0x39ec01[_0x5b22('0x14')];var _0x5ec0af=_0x27ea4c?_0x27c586[_0x5b22('0x16')]:_0x39ec01[_0x5b22('0x14')]+_0x39ec01[_0x5b22('0x17')];var _0xed225e;if(_0x5ec0af>=_0x187fe4){_0x5ec0af=_0x187fe4;_0xed225e=0xc8;}else{_0xed225e=0xce;}_0x5a63be[_0x5b22('0x11')](_0xed225e);return _0x5a63be['set'](_0x5b22('0x18'),_0x43a1f9+'-'+_0x5ec0af+'/'+_0x187fe4)[_0x5b22('0x13')](_0x27c586);}return null;};}function saveUpdates(_0x2506c7){return function(_0x4f4dc3){if(_0x4f4dc3){return _0x4f4dc3[_0x5b22('0x19')](_0x2506c7)[_0x5b22('0x1a')](function(_0xf49db8){return _0xf49db8;});}return null;};}function removeEntity(_0x26df64){return function(_0x1743b0){if(_0x1743b0){return _0x1743b0[_0x5b22('0x1b')]()[_0x5b22('0x1a')](function(){_0x26df64[_0x5b22('0x11')](0xcc)[_0x5b22('0x12')]();});}};}function handleEntityNotFound(_0x33821d){return function(_0x17ec31){if(!_0x17ec31){_0x33821d[_0x5b22('0x10')](0x194);}return _0x17ec31;};}function handleError(_0x4a37ea,_0xafdaed){_0xafdaed=_0xafdaed||0x1f4;return function(_0x4b5162){logger[_0x5b22('0x1c')](_0x4b5162[_0x5b22('0x1d')]);if(_0x4b5162[_0x5b22('0x1e')]){delete _0x4b5162[_0x5b22('0x1e')];}_0x4a37ea[_0x5b22('0x11')](_0xafdaed)[_0x5b22('0x1f')](_0x4b5162);};}exports['index']=function(_0x246838,_0x4ee13e){var _0x2f4cce={};var _0x2359af=_['map'](db['FaxInteraction'][_0x5b22('0x20')],function(_0x1ef20a){return{'name':_0x1ef20a['fieldName'],'type':_0x1ef20a[_0x5b22('0x21')][_0x5b22('0x22')]};});_0x2f4cce=qs[_0x5b22('0x23')](_0x2359af,_0x246838);return interaction[_0x5b22('0x24')](_0x5b22('0x25'),_0x246838['query'],_0x246838['user'],_0x2f4cce,_0x2359af)['then'](respondWithFilteredResult(_0x4ee13e,_0x2f4cce))['catch'](handleError(_0x4ee13e,null));};exports['show']=function(_0x5291c7,_0x153270){var _0x351b1d={'raw':![],'where':{'id':_0x5291c7['params']['id']}},_0x18d23f={};_0x18d23f[_0x5b22('0x26')]=_[_0x5b22('0x27')](db['FaxInteraction']['rawAttributes']);_0x18d23f['query']=_[_0x5b22('0x27')](_0x5291c7[_0x5b22('0x28')]);_0x18d23f[_0x5b22('0x29')]=_[_0x5b22('0x2a')](_0x18d23f[_0x5b22('0x26')],_0x18d23f[_0x5b22('0x28')]);_0x351b1d[_0x5b22('0x2b')]=_['intersection'](_0x18d23f[_0x5b22('0x26')],qs[_0x5b22('0x2c')](_0x5291c7['query'][_0x5b22('0x2c')]));_0x351b1d[_0x5b22('0x2b')]=_0x351b1d[_0x5b22('0x2b')][_0x5b22('0x2d')]?_0x351b1d[_0x5b22('0x2b')]:_0x18d23f[_0x5b22('0x26')];if(_0x5291c7['query']['includeAll']){_0x351b1d[_0x5b22('0x2e')]=[{'all':!![]}];}_0x351b1d=_[_0x5b22('0x2f')]({},_0x351b1d,_0x5291c7[_0x5b22('0x30')]);return db[_0x5b22('0x31')][_0x5b22('0x32')](_0x351b1d)['then'](handleEntityNotFound(_0x153270,null))['then'](respondWithResult(_0x153270,null))[_0x5b22('0x33')](handleError(_0x153270,null));};exports[_0x5b22('0x34')]=function(_0x46a99a,_0x133492){return db[_0x5b22('0x31')][_0x5b22('0x34')](_0x46a99a[_0x5b22('0x35')],{})[_0x5b22('0x1a')](respondWithResult(_0x133492,0xc9))[_0x5b22('0x33')](handleError(_0x133492,null));};exports[_0x5b22('0x19')]=function(_0x163460,_0x2870bd){if(_0x163460[_0x5b22('0x35')]['id']){delete _0x163460[_0x5b22('0x35')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x163460[_0x5b22('0x36')]['id']}})[_0x5b22('0x1a')](handleEntityNotFound(_0x2870bd,null))['then'](saveUpdates(_0x163460[_0x5b22('0x35')],null))[_0x5b22('0x1a')](respondWithResult(_0x2870bd,null))[_0x5b22('0x33')](handleError(_0x2870bd,null));};exports[_0x5b22('0x1b')]=function(_0x10e703,_0x4c1bf6){return db[_0x5b22('0x31')][_0x5b22('0x32')]({'where':{'id':_0x10e703[_0x5b22('0x36')]['id']}})[_0x5b22('0x1a')](handleEntityNotFound(_0x4c1bf6,null))['then'](removeEntity(_0x4c1bf6,null))[_0x5b22('0x33')](handleError(_0x4c1bf6,null));};exports[_0x5b22('0x37')]=function(_0xedfdaa,_0x33bb11){return db[_0x5b22('0x31')][_0x5b22('0x37')]()[_0x5b22('0x1a')](respondWithResult(_0x33bb11,null))[_0x5b22('0x33')](handleError(_0x33bb11,null));};exports['addMessage']=function(_0x58cb8b,_0x374ad2){return db[_0x5b22('0x38')]['find']({'where':{'id':_0x58cb8b[_0x5b22('0x36')]['id']}})[_0x5b22('0x1a')](handleEntityNotFound(_0x374ad2,null))['then'](function(_0x14fe93){if(_0x14fe93){return _0x14fe93[_0x5b22('0x39')](_0x58cb8b['body'][_0x5b22('0x3a')],_[_0x5b22('0x3b')](_0x58cb8b[_0x5b22('0x35')],['ids','id'])||{});}})[_0x5b22('0x1a')](respondWithResult(_0x374ad2,null))['catch'](handleError(_0x374ad2,null));};exports[_0x5b22('0x3c')]=function(_0x507bd9,_0x38533a){var _0x200a78={'raw':![],'where':{}};var _0x52988b={};var _0x4a71ac={'count':0x0,'rows':[]};return db[_0x5b22('0x31')]['findOne']({'where':{'id':_0x507bd9[_0x5b22('0x36')]['id']}})['then'](handleEntityNotFound(_0x38533a,null))['then'](function(_0x182d53){if(_0x182d53){_0x52988b[_0x5b22('0x26')]=_[_0x5b22('0x27')](db[_0x5b22('0x38')][_0x5b22('0x20')]);_0x52988b[_0x5b22('0x28')]=_[_0x5b22('0x27')](_0x507bd9[_0x5b22('0x28')]);_0x52988b[_0x5b22('0x29')]=_[_0x5b22('0x2a')](_0x52988b[_0x5b22('0x26')],_0x52988b[_0x5b22('0x28')]);_0x200a78[_0x5b22('0x2b')]=_[_0x5b22('0x2a')](_0x52988b[_0x5b22('0x26')],qs[_0x5b22('0x2c')](_0x507bd9[_0x5b22('0x28')][_0x5b22('0x2c')]));_0x200a78[_0x5b22('0x2b')]=_0x200a78[_0x5b22('0x2b')]['length']?_0x200a78['attributes']:_0x52988b[_0x5b22('0x26')];if(!_0x507bd9[_0x5b22('0x28')][_0x5b22('0x3d')]('nolimit')){_0x200a78[_0x5b22('0x17')]=qs[_0x5b22('0x17')](_0x507bd9[_0x5b22('0x28')][_0x5b22('0x17')]);_0x200a78[_0x5b22('0x14')]=qs[_0x5b22('0x14')](_0x507bd9[_0x5b22('0x28')][_0x5b22('0x14')]);}_0x200a78[_0x5b22('0x3e')]=qs[_0x5b22('0x3f')](_0x507bd9[_0x5b22('0x28')]['sort']);_0x200a78['where']=qs['filters'](_[_0x5b22('0x40')](_0x507bd9[_0x5b22('0x28')],_0x52988b[_0x5b22('0x29')]));_0x200a78['where']['FaxInteractionId']=_0x182d53['id'];if(_0x507bd9[_0x5b22('0x28')][_0x5b22('0x41')]){_0x200a78['where']=_[_0x5b22('0x2f')](_0x200a78[_0x5b22('0x42')],{'$or':_[_0x5b22('0x43')](_0x200a78[_0x5b22('0x2b')],function(_0x292e01){var _0x214126={};_0x214126[_0x292e01]={'$like':'%'+_0x507bd9[_0x5b22('0x28')][_0x5b22('0x41')]+'%'};return _0x214126;})});}if(_0x507bd9[_0x5b22('0x28')][_0x5b22('0x44')]){var _0x44c960=_0x507bd9[_0x5b22('0x28')]['$gte'][_0x5b22('0x45')](',');var _0xdc16a={};_0xdc16a[_0x44c960[0x0]]={'$gte':moment(_0x44c960[0x1])[_0x5b22('0x46')](_0x5b22('0x47'))};_0x200a78['where']=_['merge'](_0x200a78[_0x5b22('0x42')],_0xdc16a);}_0x200a78=_[_0x5b22('0x2f')]({},_0x200a78,_0x507bd9['options']);return db[_0x5b22('0x38')][_0x5b22('0x16')]({'where':_0x200a78[_0x5b22('0x42')]})[_0x5b22('0x1a')](function(_0x280e71){_0x4a71ac[_0x5b22('0x16')]=_0x280e71;if(_0x507bd9[_0x5b22('0x28')][_0x5b22('0x48')]){_0x200a78[_0x5b22('0x2e')]=[{'all':!![]}];}return db[_0x5b22('0x38')][_0x5b22('0x24')](_0x200a78);})[_0x5b22('0x1a')](function(_0x3273db){_0x4a71ac[_0x5b22('0x49')]=_0x3273db;return _0x4a71ac;});}})['then'](respondWithFilteredResult(_0x38533a,_0x200a78))[_0x5b22('0x33')](handleError(_0x38533a,null));};exports[_0x5b22('0x4a')]=function(_0x53e08a,_0x5e769a){return db['FaxInteraction']['find']({'where':{'id':_0x53e08a[_0x5b22('0x36')]['id']}})[_0x5b22('0x1a')](handleEntityNotFound(_0x5e769a,null))[_0x5b22('0x1a')](function(_0x203fcc){if(_0x203fcc){return _0x203fcc['setTags'](_0x53e08a[_0x5b22('0x35')][_0x5b22('0x3a')],_[_0x5b22('0x3b')](_0x53e08a[_0x5b22('0x35')],[_0x5b22('0x3a'),'id'])||{})[_0x5b22('0x4b')](function(){return db[_0x5b22('0x4c')][_0x5b22('0x24')]({'attributes':['id',_0x5b22('0x1e'),_0x5b22('0x4d')],'where':{'id':_0x53e08a[_0x5b22('0x35')][_0x5b22('0x3a')]}});})[_0x5b22('0x1a')](function(_0x1f37c5){socket[_0x5b22('0x4e')]('faxInteractionTags:save',{'id':Number(_0x53e08a[_0x5b22('0x36')]['id']),'tags':_0x1f37c5||[]});return{'id':Number(_0x53e08a[_0x5b22('0x36')]['id']),'tags':_0x1f37c5||[]};});}})['then'](respondWithResult(_0x5e769a,null))[_0x5b22('0x33')](handleError(_0x5e769a,null));};exports[_0x5b22('0x4f')]=function(_0x282df9,_0x720181){return db[_0x5b22('0x31')][_0x5b22('0x32')]({'where':{'id':_0x282df9[_0x5b22('0x36')]['id']}})[_0x5b22('0x1a')](handleEntityNotFound(_0x720181,null))[_0x5b22('0x1a')](function(_0x526234){if(_0x526234){return _0x526234['removeTags'](_0x282df9['query'][_0x5b22('0x3a')]);}})['then'](respondWithStatusCode(_0x720181,null))[_0x5b22('0x33')](handleError(_0x720181,null));};exports[_0x5b22('0x50')]=function(_0x398b1c,_0xb636c8){var _0x4c2bf6=moment()['unix']()[_0x5b22('0x51')]();var _0x453fc4=path[_0x5b22('0x52')](config[_0x5b22('0x53')],_0x5b22('0x54'),_0x5b22('0x55'),'tmp');var _0x3a6f77=path['join'](config['root'],'server',_0x5b22('0x55'),_0x5b22('0x56'));var _0x70397=path['join'](_0x453fc4,_0x4c2bf6);var _0x29b886=util['format']('transcript-%d-%s.zip',_0x398b1c[_0x5b22('0x36')]['id'],_0x4c2bf6);var _0x4e2c62=path['join'](_0x453fc4,_0x29b886);var _0x23782c=[];_0x23782c[_0x5b22('0x57')]({'model':db[_0x5b22('0x58')],'as':_0x5b22('0x58'),'raw':!![]});var _0x90ac34=[{'model':db[_0x5b22('0x38')],'as':'Messages','attributes':['id',_0x5b22('0x35'),_0x5b22('0x59')],'include':_0x23782c}];return db['FaxInteraction']['find']({'where':{'id':_0x398b1c['params']['id']},'include':_0x90ac34})[_0x5b22('0x1a')](handleEntityNotFound(_0xb636c8,null))[_0x5b22('0x1a')](function(_0x5d2ecc){if(_0x5d2ecc&&_0x5d2ecc[_0x5b22('0x5a')]){var _0x190171=_0x5d2ecc[_0x5b22('0x5b')]({'plain':!![]});fs[_0x5b22('0x5c')](_0x70397);for(var _0x3e94a9=0x0;_0x3e94a9<_0x190171[_0x5b22('0x5a')]['length'];_0x3e94a9++){var _0x343867=_0x190171[_0x5b22('0x5a')][_0x3e94a9]['Attachment'];if(_0x343867){var _0x2f8353=path[_0x5b22('0x52')](_0x3a6f77,_0x343867[_0x5b22('0x5d')]);if(fs[_0x5b22('0x5e')](_0x2f8353)){fs[_0x5b22('0x5f')](_0x2f8353)[_0x5b22('0x60')](fs[_0x5b22('0x61')](path[_0x5b22('0x52')](_0x70397,_0x343867[_0x5b22('0x5d')])));}}}return BPromise[_0x5b22('0x62')]()['then'](function(){return new BPromise(function(_0x18fe82,_0x207e60){zipdir(_0x70397,{'saveTo':_0x4e2c62},function(_0x211fb6,_0x29bec7){if(_0x211fb6)return _0x207e60(_0x211fb6);return _0x18fe82(_0x29bec7);});})['then'](function(){return new BPromise(function(_0x502c3f,_0x102d1b){rimraf(_0x70397,function(_0x354670){if(_0x354670)_0x102d1b(_0x354670);return _0x502c3f();});});})[_0x5b22('0x1a')](function(){return _0xb636c8['download'](_0x4e2c62,_0x29b886,function(_0x2ff715){if(_0x2ff715){console['log'](_0x5b22('0x63'),_0x2ff715);}else{fs[_0x5b22('0x64')](_0x4e2c62);}});});});}else{return _0xb636c8['sendStatus'](0xc8);}})['catch'](handleError(_0xb636c8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2d6628a..4bda1df 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 _0xe4b5=['unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x2840a9,_0x25276d){var _0xe08e42=function(_0x53c379){while(--_0x53c379){_0x2840a9['push'](_0x2840a9['shift']());}};_0xe08e42(++_0x25276d);}(_0xe4b5,0x19e));var _0x5e4b=function(_0x4c6aa1,_0x152e16){_0x4c6aa1=_0x4c6aa1-0x0;var _0x4cac5d=_0xe4b5[_0x4c6aa1];return _0x4cac5d;};'use strict';var EventEmitter=require(_0x5e4b('0x0'));var FaxInteraction=require(_0x5e4b('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x5e4b('0x1'))['db'][_0x5e4b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e4b('0x3'),'afterUpdate':_0x5e4b('0x4'),'afterDestroy':_0x5e4b('0x5')};function emitEvent(_0x5d213b){return function(_0x4bc8b0,_0x867355,_0x25c863){_0x4bc8b0['getUsers']({'attributes':['id'],'raw':!![]})[_0x5e4b('0x6')](function(_0x5c0a6b){_0x4bc8b0[_0x5e4b('0x7')](_0x5e4b('0x8'),_0x5c0a6b[_0x5e4b('0x9')](function(_0x1ecfbc){return{'id':_0x1ecfbc['id']};}));return FaxMessage[_0x5e4b('0xa')]({'where':{'FaxInteractionId':_0x4bc8b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5e4b('0x6')](function(_0x3a4870){_0x4bc8b0[_0x5e4b('0x7')](_0x5e4b('0xb'),_0x3a4870[_0x5e4b('0xc')]);FaxInteractionEvents['emit'](_0x5d213b+':'+_0x4bc8b0['id'],_0x4bc8b0);FaxInteractionEvents['emit'](_0x5d213b,_0x4bc8b0);_0x25c863(null);})[_0x5e4b('0xd')](_0x25c863(null));};}for(var e in events){if(events[_0x5e4b('0xe')](e)){var event=events[e];FaxInteraction[_0x5e4b('0xf')](e,emitEvent(event));}}module[_0x5e4b('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xabfe=['FaxMessage','setMaxListeners','save','remove','then','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x151f00,_0x4ca3a1){var _0x418d9b=function(_0x5c37c7){while(--_0x5c37c7){_0x151f00['push'](_0x151f00['shift']());}};_0x418d9b(++_0x4ca3a1);}(_0xabfe,0x86));var _0xeabf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabfe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xeabf('0x0'));var FaxInteraction=require(_0xeabf('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xeabf('0x1'))['db'][_0xeabf('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xeabf('0x3')](0x0);var events={'afterCreate':_0xeabf('0x4'),'afterUpdate':'update','afterDestroy':_0xeabf('0x5')};function emitEvent(_0x10de96){return function(_0x2879e5,_0x872a30,_0x39ca90){_0x2879e5['getUsers']({'attributes':['id'],'raw':!![]})[_0xeabf('0x6')](function(_0x5ac2b7){_0x2879e5['setDataValue'](_0xeabf('0x7'),_0x5ac2b7[_0xeabf('0x8')](function(_0x182c15){return{'id':_0x182c15['id']};}));return FaxMessage[_0xeabf('0x9')]({'where':{'FaxInteractionId':_0x2879e5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeabf('0x6')](function(_0x36edba){_0x2879e5['setDataValue'](_0xeabf('0xa'),_0x36edba[_0xeabf('0xb')]);FaxInteractionEvents[_0xeabf('0xc')](_0x10de96+':'+_0x2879e5['id'],_0x2879e5);FaxInteractionEvents[_0xeabf('0xc')](_0x10de96,_0x2879e5);_0x39ca90(null);})[_0xeabf('0xd')](_0x39ca90(null));};}for(var e in events){if(events[_0xeabf('0xe')](e)){var event=events[e];FaxInteraction[_0xeabf('0xf')](e,emitEvent(event));}}module[_0xeabf('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 920c8a5..d5280f4 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 _0x065d=['request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','changed','closed','closedAt','util','../../config/logger','api','bluebird'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x065d,0x1d8));var _0xd065=function(_0x5e6c68,_0x48bf5c){_0x5e6c68=_0x5e6c68-0x0;var _0x1f3d18=_0x065d[_0x5e6c68];return _0x1f3d18;};'use strict';var _=require('lodash');var util=require(_0xd065('0x0'));var logger=require(_0xd065('0x1'))(_0xd065('0x2'));var moment=require('moment');var BPromise=require(_0xd065('0x3'));var rp=require(_0xd065('0x4'));var fs=require('fs');var path=require(_0xd065('0x5'));var rimraf=require(_0xd065('0x6'));var config=require(_0xd065('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xd065('0x8')]=function(_0x758260,_0x2c85b1){return _0x758260[_0xd065('0x9')](_0xd065('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x524754,_0x36ab99,_0x274a14){if(_0x524754[_0xd065('0xb')](_0xd065('0xc'))){_0x524754[_0xd065('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x274a14(null,_0x524754);}}});}; \ No newline at end of file +var _0xe586=['format','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed'];(function(_0x5d8d70,_0x48e642){var _0x4d0778=function(_0x2dca0b){while(--_0x2dca0b){_0x5d8d70['push'](_0x5d8d70['shift']());}};_0x4d0778(++_0x48e642);}(_0xe586,0x151));var _0x6e58=function(_0xe6a5db,_0x41f427){_0xe6a5db=_0xe6a5db-0x0;var _0x57a033=_0xe586[_0xe6a5db];return _0x57a033;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e58('0x0'))(_0x6e58('0x1'));var moment=require('moment');var BPromise=require(_0x6e58('0x2'));var rp=require(_0x6e58('0x3'));var fs=require('fs');var path=require(_0x6e58('0x4'));var rimraf=require(_0x6e58('0x5'));var config=require(_0x6e58('0x6'));var attributes=require(_0x6e58('0x7'));module['exports']=function(_0x555753,_0x3006bb){return _0x555753[_0x6e58('0x8')](_0x6e58('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xac70b8,_0x4b43fb,_0x1d0701){if(_0xac70b8[_0x6e58('0xa')]('closed')){_0xac70b8['closedAt']=moment()[_0x6e58('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1d0701(null,_0xac70b8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a782697..b91b9ad 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 _0x2edf=['limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw'];(function(_0xadb3d8,_0x38cfde){var _0x12d6a0=function(_0xbb1924){while(--_0xbb1924){_0xadb3d8['push'](_0xadb3d8['shift']());}};_0x12d6a0(++_0x38cfde);}(_0x2edf,0x10b));var _0xf2ed=function(_0x1fb6e2,_0x3a22ce){_0x1fb6e2=_0x1fb6e2-0x0;var _0x354690=_0x2edf[_0x1fb6e2];return _0x354690;};'use strict';var _=require(_0xf2ed('0x0'));var util=require(_0xf2ed('0x1'));var moment=require(_0xf2ed('0x2'));var BPromise=require(_0xf2ed('0x3'));var rs=require(_0xf2ed('0x4'));var fs=require('fs');var Redis=require(_0xf2ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2ed('0x6'));var logger=require('../../config/logger')(_0xf2ed('0x7'));var config=require(_0xf2ed('0x8'));var jayson=require(_0xf2ed('0x9'));var client=jayson[_0xf2ed('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf2ed('0xb')](config[_0xf2ed('0xc')],{'host':_0xf2ed('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2ed('0xc')]));require(_0xf2ed('0xe'))['register'](socket);function respondWithRpcPromise(_0x384087,_0x35a5c5,_0x58f0ed){return new BPromise(function(_0x1ab6d3,_0x5574c9){return client[_0xf2ed('0xf')](_0x384087,_0x58f0ed)[_0xf2ed('0x10')](function(_0x3fded8){logger[_0xf2ed('0x11')](_0xf2ed('0x12'),_0x35a5c5,_0xf2ed('0x13'));logger[_0xf2ed('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x35a5c5,'request\x20sent',JSON['stringify'](_0x3fded8));if(_0x3fded8[_0xf2ed('0x15')]){if(_0x3fded8['error']['code']===0x1f4){logger['error'](_0xf2ed('0x12'),_0x35a5c5,_0x3fded8['error'][_0xf2ed('0x16')]);return _0x5574c9(_0x3fded8['error'][_0xf2ed('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x35a5c5,_0x3fded8['error'][_0xf2ed('0x16')]);return _0x1ab6d3(_0x3fded8['error'][_0xf2ed('0x16')]);}else{logger[_0xf2ed('0x11')](_0xf2ed('0x12'),_0x35a5c5,_0xf2ed('0x13'));_0x1ab6d3(_0x3fded8[_0xf2ed('0x17')][_0xf2ed('0x16')]);}})[_0xf2ed('0x18')](function(_0x47bb8e){logger[_0xf2ed('0x15')](_0xf2ed('0x12'),_0x35a5c5,_0x47bb8e);_0x5574c9(_0x47bb8e);});});}exports[_0xf2ed('0x19')]=function(_0x4e7d75){var _0x5933f0=this;return new Promise(function(_0x57a9a9,_0x3fceea){return db[_0xf2ed('0x1a')]['update'](_0x4e7d75['body'],{'raw':_0x4e7d75[_0xf2ed('0x1b')]?_0x4e7d75[_0xf2ed('0x1b')][_0xf2ed('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7d75[_0xf2ed('0x1b')]?_0x4e7d75[_0xf2ed('0x1b')]['where']||null:null,'attributes':_0x4e7d75[_0xf2ed('0x1b')]?_0x4e7d75['options']['attributes']||null:null,'limit':_0x4e7d75['options']?_0x4e7d75[_0xf2ed('0x1b')][_0xf2ed('0x1d')]||null:null})['then'](function(_0x10a3e4){logger[_0xf2ed('0x11')](_0xf2ed('0x19'),_0x4e7d75);logger['debug'](_0xf2ed('0x19'),_0x4e7d75,JSON[_0xf2ed('0x1e')](_0x10a3e4));_0x57a9a9(_0x10a3e4);})[_0xf2ed('0x18')](function(_0x2d61ef){logger[_0xf2ed('0x15')](_0xf2ed('0x19'),_0x2d61ef[_0xf2ed('0x16')],_0x4e7d75);_0x3fceea(_0x5933f0[_0xf2ed('0x15')](0x1f4,_0x2d61ef[_0xf2ed('0x16')]));});});};exports[_0xf2ed('0x1f')]=function(_0x4e6703){return new Promise(function(_0x3f3ab5,_0x3d4924){return db['FaxInteraction'][_0xf2ed('0x20')]({'where':_0x4e6703[_0xf2ed('0x1b')]?_0x4e6703[_0xf2ed('0x1b')]['where']||null:null})[_0xf2ed('0x10')](function(_0x2922f7){if(_0x2922f7){return _0x2922f7[_0xf2ed('0x21')](_0x4e6703['body'][_0xf2ed('0x22')],_[_0xf2ed('0x23')](_0x4e6703['body'],[_0xf2ed('0x22'),'id'])||{});}})['spread'](function(_0x198233){logger[_0xf2ed('0x11')](_0xf2ed('0x24'),_0x4e6703);logger[_0xf2ed('0x14')](_0xf2ed('0x24'),_0x4e6703,JSON[_0xf2ed('0x1e')](_0x198233));_0x3f3ab5(_0x198233);})[_0xf2ed('0x18')](function(_0x4a1bf9){logger[_0xf2ed('0x15')](_0xf2ed('0x24'),_0x4a1bf9[_0xf2ed('0x16')],_0x4e6703);_0x3d4924(_this[_0xf2ed('0x15')](0x1f4,_0x4a1bf9[_0xf2ed('0x16')]));});});}; \ No newline at end of file +var _0xcd0c=['http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xcd0c,0x1ee));var _0xccd0=function(_0x33b43b,_0x24e1dc){_0x33b43b=_0x33b43b-0x0;var _0x355e5f=_0xcd0c[_0x33b43b];return _0x355e5f;};'use strict';var _=require(_0xccd0('0x0'));var util=require(_0xccd0('0x1'));var moment=require(_0xccd0('0x2'));var BPromise=require('bluebird');var rs=require(_0xccd0('0x3'));var fs=require('fs');var Redis=require(_0xccd0('0x4'));var db=require(_0xccd0('0x5'))['db'];var utils=require(_0xccd0('0x6'));var logger=require(_0xccd0('0x7'))(_0xccd0('0x8'));var config=require(_0xccd0('0x9'));var jayson=require(_0xccd0('0xa'));var client=jayson[_0xccd0('0xb')][_0xccd0('0xc')]({'port':0x232a});config[_0xccd0('0xd')]=_['defaults'](config[_0xccd0('0xd')],{'host':_0xccd0('0xe'),'port':0x18eb});var socket=require(_0xccd0('0xf'))(new Redis(config[_0xccd0('0xd')]));require('./faxInteraction.socket')[_0xccd0('0x10')](socket);function respondWithRpcPromise(_0x1bb894,_0x18c104,_0x535fec){return new BPromise(function(_0x1178e4,_0x3194d3){return client[_0xccd0('0x11')](_0x1bb894,_0x535fec)[_0xccd0('0x12')](function(_0x3184b5){logger[_0xccd0('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x18c104,_0xccd0('0x14'));logger[_0xccd0('0x15')](_0xccd0('0x16'),_0x18c104,'request\x20sent',JSON['stringify'](_0x3184b5));if(_0x3184b5['error']){if(_0x3184b5[_0xccd0('0x17')][_0xccd0('0x18')]===0x1f4){logger['error'](_0xccd0('0x19'),_0x18c104,_0x3184b5['error'][_0xccd0('0x1a')]);return _0x3194d3(_0x3184b5[_0xccd0('0x17')][_0xccd0('0x1a')]);}logger[_0xccd0('0x17')](_0xccd0('0x19'),_0x18c104,_0x3184b5[_0xccd0('0x17')][_0xccd0('0x1a')]);return _0x1178e4(_0x3184b5[_0xccd0('0x17')][_0xccd0('0x1a')]);}else{logger[_0xccd0('0x13')](_0xccd0('0x19'),_0x18c104,_0xccd0('0x14'));_0x1178e4(_0x3184b5[_0xccd0('0x1b')]['message']);}})[_0xccd0('0x1c')](function(_0x5355bc){logger[_0xccd0('0x17')](_0xccd0('0x19'),_0x18c104,_0x5355bc);_0x3194d3(_0x5355bc);});});}exports[_0xccd0('0x1d')]=function(_0xa5eba6){var _0x4266e8=this;return new Promise(function(_0x2078b7,_0xe11104){return db[_0xccd0('0x1e')][_0xccd0('0x1f')](_0xa5eba6[_0xccd0('0x20')],{'raw':_0xa5eba6[_0xccd0('0x21')]?_0xa5eba6[_0xccd0('0x21')][_0xccd0('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa5eba6[_0xccd0('0x21')]?_0xa5eba6[_0xccd0('0x21')][_0xccd0('0x23')]||null:null,'attributes':_0xa5eba6[_0xccd0('0x21')]?_0xa5eba6[_0xccd0('0x21')][_0xccd0('0x24')]||null:null,'limit':_0xa5eba6['options']?_0xa5eba6[_0xccd0('0x21')][_0xccd0('0x25')]||null:null})[_0xccd0('0x12')](function(_0x16bf0a){logger['info']('UpdateFaxInteraction',_0xa5eba6);logger['debug'](_0xccd0('0x1d'),_0xa5eba6,JSON[_0xccd0('0x26')](_0x16bf0a));_0x2078b7(_0x16bf0a);})[_0xccd0('0x1c')](function(_0x39fe8a){logger[_0xccd0('0x17')]('UpdateFaxInteraction',_0x39fe8a[_0xccd0('0x1a')],_0xa5eba6);_0xe11104(_0x4266e8[_0xccd0('0x17')](0x1f4,_0x39fe8a[_0xccd0('0x1a')]));});});};exports[_0xccd0('0x27')]=function(_0x190818){return new Promise(function(_0x4798cd,_0x90932){return db['FaxInteraction'][_0xccd0('0x28')]({'where':_0x190818[_0xccd0('0x21')]?_0x190818[_0xccd0('0x21')][_0xccd0('0x23')]||null:null})['then'](function(_0x353916){if(_0x353916){return _0x353916[_0xccd0('0x29')](_0x190818['body'][_0xccd0('0x2a')],_[_0xccd0('0x2b')](_0x190818['body'],['ids','id'])||{});}})[_0xccd0('0x2c')](function(_0x50f225){logger[_0xccd0('0x13')](_0xccd0('0x2d'),_0x190818);logger['debug'](_0xccd0('0x2d'),_0x190818,JSON[_0xccd0('0x26')](_0x50f225));_0x4798cd(_0x50f225);})[_0xccd0('0x1c')](function(_0x560961){logger['error'](_0xccd0('0x2d'),_0x560961[_0xccd0('0x1a')],_0x190818);_0x90932(_this['error'](0x1f4,_0x560961[_0xccd0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bc816a8..6d99e8b 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 _0x9b1c=['length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register'];(function(_0x283cd1,_0x1bb686){var _0xecf7b2=function(_0x27cc0b){while(--_0x27cc0b){_0x283cd1['push'](_0x283cd1['shift']());}};_0xecf7b2(++_0x1bb686);}(_0x9b1c,0x16a));var _0xc9b1=function(_0x5a04ef,_0x38da7a){_0x5a04ef=_0x5a04ef-0x0;var _0xd92f45=_0x9b1c[_0x5a04ef];return _0xd92f45;};'use strict';var FaxInteractionEvents=require(_0xc9b1('0x0'));var events=[_0xc9b1('0x1'),_0xc9b1('0x2'),_0xc9b1('0x3')];function createListener(_0x1167a3,_0x26e0af){return function(_0xdfe543){_0x26e0af['emit'](_0x1167a3,_0xdfe543);};}function removeListener(_0xdbe170,_0x588621){return function(){FaxInteractionEvents[_0xc9b1('0x4')](_0xdbe170,_0x588621);};}exports[_0xc9b1('0x5')]=function(_0x284b26){for(var _0x424ae0=0x0,_0x1a83b4=events[_0xc9b1('0x6')];_0x424ae0<_0x1a83b4;_0x424ae0++){var _0x2d5550=events[_0x424ae0];var _0x4ce6af=createListener(_0xc9b1('0x7')+_0x2d5550,_0x284b26);FaxInteractionEvents['on'](_0x2d5550,_0x4ce6af);}}; \ No newline at end of file +var _0x66c5=['remove','update','removeListener','length','./faxInteraction.events','save'];(function(_0x41a3cd,_0x261b16){var _0x37ac53=function(_0x99ed34){while(--_0x99ed34){_0x41a3cd['push'](_0x41a3cd['shift']());}};_0x37ac53(++_0x261b16);}(_0x66c5,0x82));var _0x566c=function(_0xbca5f7,_0x7f833a){_0xbca5f7=_0xbca5f7-0x0;var _0x2eb4c0=_0x66c5[_0xbca5f7];return _0x2eb4c0;};'use strict';var FaxInteractionEvents=require(_0x566c('0x0'));var events=[_0x566c('0x1'),_0x566c('0x2'),_0x566c('0x3')];function createListener(_0x198d0f,_0xd7d468){return function(_0x30a507){_0xd7d468['emit'](_0x198d0f,_0x30a507);};}function removeListener(_0x23059f,_0x233c8c){return function(){FaxInteractionEvents[_0x566c('0x4')](_0x23059f,_0x233c8c);};}exports['register']=function(_0x13b398){for(var _0x5367a8=0x0,_0x1b4019=events[_0x566c('0x5')];_0x5367a8<_0x1b4019;_0x5367a8++){var _0x2252eb=events[_0x5367a8];var _0x5309ba=createListener('faxInteraction:'+_0x2252eb,_0x13b398);FaxInteractionEvents['on'](_0x2252eb,_0x5309ba);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7aaf0b6..3698c15 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 _0x370d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x370d,0xc6));var _0xd370=function(_0x38358a,_0x864f16){_0x38358a=_0x38358a-0x0;var _0x1a0c18=_0x370d[_0x38358a];return _0x1a0c18;};'use strict';var multer=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var path=require('path');var timeout=require(_0xd370('0x2'));var express=require(_0xd370('0x3'));var router=express[_0xd370('0x4')]();var fs_extra=require(_0xd370('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd370('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd370('0x7')]);router[_0xd370('0x8')](_0xd370('0x9'),auth[_0xd370('0xa')](),controller[_0xd370('0xb')]);router[_0xd370('0x8')](_0xd370('0xc'),auth[_0xd370('0xa')](),controller['show']);router[_0xd370('0x8')](_0xd370('0xd'),auth[_0xd370('0xa')](),controller[_0xd370('0xe')]);router[_0xd370('0x8')](_0xd370('0xf'),auth['isAuthenticated'](),controller[_0xd370('0x10')]);router[_0xd370('0x11')]('/',auth['isAuthenticated'](),controller[_0xd370('0x12')]);router['post'](_0xd370('0xd'),auth[_0xd370('0xa')](),controller[_0xd370('0x13')]);router[_0xd370('0x11')](_0xd370('0x14'),auth[_0xd370('0xa')](),interaction['tracked']('fax',_0xd370('0x15')),controller[_0xd370('0x16')]);router[_0xd370('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xd370('0x18')](_0xd370('0x19'),_0xd370('0x1a')),controller[_0xd370('0x1b')]);router[_0xd370('0x1c')](_0xd370('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xd370('0x19'),_0xd370('0x1d')),controller[_0xd370('0x1e')]);router[_0xd370('0x1c')](_0xd370('0x14'),auth[_0xd370('0xa')](),controller[_0xd370('0x1f')]);module[_0xd370('0x20')]=router; \ No newline at end of file +var _0x4aaf=['/:id','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','describe'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4aaf,0x10a));var _0xf4aa=function(_0x388550,_0x3fd74b){_0x388550=_0x388550-0x0;var _0x735860=_0x4aaf[_0x388550];return _0x735860;};'use strict';var multer=require(_0xf4aa('0x0'));var util=require(_0xf4aa('0x1'));var path=require('path');var timeout=require(_0xf4aa('0x2'));var express=require(_0xf4aa('0x3'));var router=express[_0xf4aa('0x4')]();var fs_extra=require(_0xf4aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf4aa('0x6'));var config=require(_0xf4aa('0x7'));var controller=require(_0xf4aa('0x8'));router['get']('/',auth[_0xf4aa('0x9')](),controller['index']);router[_0xf4aa('0xa')](_0xf4aa('0xb'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0xc')]);router['get'](_0xf4aa('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf4aa('0xa')](_0xf4aa('0xe'),auth[_0xf4aa('0x9')](),controller['getMessages']);router[_0xf4aa('0xa')](_0xf4aa('0xf'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf4aa('0x11')]);router[_0xf4aa('0x12')](_0xf4aa('0xe'),auth[_0xf4aa('0x9')](),controller['addMessage']);router['post'](_0xf4aa('0x13'),auth[_0xf4aa('0x9')](),interaction[_0xf4aa('0x14')](_0xf4aa('0x15'),_0xf4aa('0x16')),controller['addTags']);router[_0xf4aa('0x17')](_0xf4aa('0xd'),auth[_0xf4aa('0x9')](),interaction[_0xf4aa('0x14')](_0xf4aa('0x15'),_0xf4aa('0x18')),controller[_0xf4aa('0x19')]);router['delete'](_0xf4aa('0xd'),auth[_0xf4aa('0x9')](),interaction[_0xf4aa('0x14')]('fax',_0xf4aa('0x1a')),controller[_0xf4aa('0x1b')]);router[_0xf4aa('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf4aa('0x1d')]);module[_0xf4aa('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index efa8ebb..38886e6 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 _0x12c9=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x57883f,_0x201cb4){var _0x14ed92=function(_0x5689c7){while(--_0x5689c7){_0x57883f['push'](_0x57883f['shift']());}};_0x14ed92(++_0x201cb4);}(_0x12c9,0x1c9));var _0x912c=function(_0x77ce99,_0x505a17){_0x77ce99=_0x77ce99-0x0;var _0x1fe52d=_0x12c9[_0x77ce99];return _0x1fe52d;};'use strict';var Sequelize=require(_0x912c('0x0'));module[_0x912c('0x1')]={'body':{'type':Sequelize[_0x912c('0x2')](_0x912c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x912c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x912c('0x5')),'defaultValue':_0x912c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x912c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x912c('0x6')]}}; \ No newline at end of file +var _0xd66c=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x5c2dc3,_0x4d6309){var _0x2779c8=function(_0x221051){while(--_0x221051){_0x5c2dc3['push'](_0x5c2dc3['shift']());}};_0x2779c8(++_0x4d6309);}(_0xd66c,0x106));var _0xcd66=function(_0x20f62b,_0x2e1045){_0x20f62b=_0x20f62b-0x0;var _0x1b52c4=_0xd66c[_0x20f62b];return _0x1b52c4;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd66('0x1')](_0xcd66('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd66('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd66('0x4')]('in','out'),'defaultValue':_0xcd66('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xcd66('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xcd66('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8c5b2b6..bcd8a1e 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 _0x7248=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','merge','where','VIRTUAL','options','include','findAll','show','params','keys','find','body','describe','fax-interactions','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','User','interface','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','attachments','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0x7248,0x78));var _0x8724=function(_0x43f8cc,_0x592b95){_0x43f8cc=_0x43f8cc-0x0;var _0x1c8808=_0x7248[_0x43f8cc];return _0x1c8808;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8724('0x0'));var zipdir=require(_0x8724('0x1'));var jsonpatch=require(_0x8724('0x2'));var rp=require(_0x8724('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8724('0x4'));var util=require(_0x8724('0x5'));var path=require(_0x8724('0x6'));var sox=require(_0x8724('0x7'));var csv=require(_0x8724('0x8'));var ejs=require(_0x8724('0x9'));var fs=require('fs');var fs_extra=require(_0x8724('0xa'));var _=require(_0x8724('0xb'));var squel=require(_0x8724('0xc'));var crypto=require(_0x8724('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8724('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8724('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8724('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8724('0x11'));var logger=require(_0x8724('0x12'))('api');var utils=require(_0x8724('0x13'));var config=require(_0x8724('0x14'));var licenseUtil=require(_0x8724('0x15'));var db=require(_0x8724('0x16'))['db'];config['redis']=_['defaults'](config[_0x8724('0x17')],{'host':_0x8724('0x18'),'port':0x18eb});var socket=require(_0x8724('0x19'))(new Redis(config[_0x8724('0x17')]));require(_0x8724('0x1a'))[_0x8724('0x1b')](socket);var jayson=require(_0x8724('0x1c'));var client=jayson[_0x8724('0x1d')][_0x8724('0x1e')]({'port':0x232c});var client9002=jayson[_0x8724('0x1d')][_0x8724('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x390b83,_0x575209,_0x3d57b9,_0x3ab531){return new BPromise(function(_0x50d993,_0xea63ab){var _0x11d312=_0x3ab531||client;return _0x11d312[_0x8724('0x1f')](_0x390b83,_0x3d57b9)[_0x8724('0x20')](function(_0x42197a){logger[_0x8724('0x21')](_0x8724('0x22'),_0x575209,_0x8724('0x23'));logger[_0x8724('0x24')](_0x8724('0x25'),_0x575209,_0x8724('0x23'),JSON[_0x8724('0x26')](_0x42197a));if(_0x42197a['error']){if(_0x42197a[_0x8724('0x27')][_0x8724('0x28')]===0x1f4){logger[_0x8724('0x27')]('FaxMessage,\x20%s,\x20%s',_0x575209,_0x42197a['error']['message']);return _0xea63ab(_0x42197a[_0x8724('0x27')][_0x8724('0x29')]);}logger[_0x8724('0x27')](_0x8724('0x22'),_0x575209,_0x42197a[_0x8724('0x27')][_0x8724('0x29')]);return _0x50d993(_0x42197a[_0x8724('0x27')][_0x8724('0x29')]);}else{logger[_0x8724('0x21')](_0x8724('0x22'),_0x575209,'request\x20sent');_0x50d993(_0x42197a['result'][_0x8724('0x29')]);}})[_0x8724('0x2a')](function(_0xc7b46a){logger['error'](_0x8724('0x22'),_0x575209,_0xc7b46a);_0xea63ab(_0xc7b46a);});});}function respondWithStatusCode(_0x56d137,_0x3bb050){_0x3bb050=_0x3bb050||0xcc;return function(_0x3c5a96){if(_0x3c5a96){return _0x56d137[_0x8724('0x2b')](_0x3bb050);}return _0x56d137[_0x8724('0x2c')](_0x3bb050)[_0x8724('0x2d')]();};}function respondWithResult(_0x19beaf,_0x578773){_0x578773=_0x578773||0xc8;return function(_0xb38bb){if(_0xb38bb){return _0x19beaf[_0x8724('0x2c')](_0x578773)['json'](_0xb38bb);}};}function respondWithFilteredResult(_0x2d5cfb,_0x44fab8){return function(_0x1da31b){if(_0x1da31b){var _0x25afee=typeof _0x44fab8[_0x8724('0x2e')]===_0x8724('0x2f')&&typeof _0x44fab8[_0x8724('0x30')]===_0x8724('0x2f');var _0x52dbfb=_0x1da31b[_0x8724('0x31')];var _0x5bbd98=_0x25afee?0x0:_0x44fab8[_0x8724('0x2e')];var _0x5979fd=_0x25afee?_0x1da31b[_0x8724('0x31')]:_0x44fab8[_0x8724('0x2e')]+_0x44fab8[_0x8724('0x30')];var _0x3c53ea;if(_0x5979fd>=_0x52dbfb){_0x5979fd=_0x52dbfb;_0x3c53ea=0xc8;}else{_0x3c53ea=0xce;}_0x2d5cfb[_0x8724('0x2c')](_0x3c53ea);return _0x2d5cfb['set']('Content-Range',_0x5bbd98+'-'+_0x5979fd+'/'+_0x52dbfb)[_0x8724('0x32')](_0x1da31b);}return null;};}function patchUpdates(_0x540708){return function(_0x3b1ca8){try{jsonpatch[_0x8724('0x33')](_0x3b1ca8,_0x540708,!![]);}catch(_0x2ccd07){return BPromise[_0x8724('0x34')](_0x2ccd07);}return _0x3b1ca8[_0x8724('0x35')]();};}function saveUpdates(_0x415269,_0x1060a3){return function(_0x2d8a03){if(_0x2d8a03){return _0x2d8a03[_0x8724('0x36')](_0x415269)[_0x8724('0x20')](function(_0x3cf105){return _0x3cf105;});}return null;};}function removeEntity(_0x424c11,_0x1ecb28){return function(_0x29e0af){if(_0x29e0af){return _0x29e0af[_0x8724('0x37')]()[_0x8724('0x20')](function(){_0x424c11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x333993,_0x501946){return function(_0x4712e0){if(!_0x4712e0){_0x333993[_0x8724('0x2b')](0x194);}return _0x4712e0;};}function handleError(_0x5e6538,_0x5cd340){_0x5cd340=_0x5cd340||0x1f4;return function(_0x408720){logger[_0x8724('0x27')](_0x408720[_0x8724('0x38')]);if(_0x408720[_0x8724('0x39')]){delete _0x408720['name'];}_0x5e6538[_0x8724('0x2c')](_0x5cd340)[_0x8724('0x3a')](_0x408720);};}exports[_0x8724('0x3b')]=function(_0x3f2061,_0x1b1a77){var _0x29df00={},_0x2939cf={},_0x5251c9={'count':0x0,'rows':[]};var _0x4ee56=_[_0x8724('0x3c')](db[_0x8724('0x3d')][_0x8724('0x3e')],function(_0x5b26a9){return{'name':_0x5b26a9[_0x8724('0x3f')],'type':_0x5b26a9[_0x8724('0x40')][_0x8724('0x41')]};});_0x2939cf['model']=_['map'](_0x4ee56,_0x8724('0x39'));_0x2939cf[_0x8724('0x42')]=_['keys'](_0x3f2061[_0x8724('0x42')]);_0x2939cf[_0x8724('0x43')]=_[_0x8724('0x44')](_0x2939cf[_0x8724('0x45')],_0x2939cf[_0x8724('0x42')]);_0x29df00[_0x8724('0x46')]=_[_0x8724('0x44')](_0x2939cf[_0x8724('0x45')],qs[_0x8724('0x47')](_0x3f2061[_0x8724('0x42')][_0x8724('0x47')]));_0x29df00[_0x8724('0x46')]=_0x29df00[_0x8724('0x46')][_0x8724('0x48')]?_0x29df00[_0x8724('0x46')]:_0x2939cf[_0x8724('0x45')];if(!_0x3f2061[_0x8724('0x42')]['hasOwnProperty'](_0x8724('0x49'))){_0x29df00[_0x8724('0x30')]=qs['limit'](_0x3f2061[_0x8724('0x42')][_0x8724('0x30')]);_0x29df00[_0x8724('0x2e')]=qs['offset'](_0x3f2061[_0x8724('0x42')][_0x8724('0x2e')]);}_0x29df00[_0x8724('0x4a')]=qs['sort'](_0x3f2061[_0x8724('0x42')][_0x8724('0x4b')]);_0x29df00['where']=qs[_0x8724('0x43')](_['pick'](_0x3f2061['query'],_0x2939cf[_0x8724('0x43')]),_0x4ee56);if(_0x3f2061[_0x8724('0x42')]['filter']){_0x29df00['where']=_[_0x8724('0x4c')](_0x29df00[_0x8724('0x4d')],{'$or':_[_0x8724('0x3c')](_0x4ee56,function(_0x46a01d){if(_0x46a01d['type']!==_0x8724('0x4e')){var _0x288f36={};_0x288f36[_0x46a01d[_0x8724('0x39')]]={'$like':'%'+_0x3f2061[_0x8724('0x42')]['filter']+'%'};return _0x288f36;}})});}_0x29df00=_[_0x8724('0x4c')]({},_0x29df00,_0x3f2061[_0x8724('0x4f')]);var _0x4a675f={'where':_0x29df00[_0x8724('0x4d')]};return db[_0x8724('0x3d')][_0x8724('0x31')](_0x4a675f)[_0x8724('0x20')](function(_0xb172a6){_0x5251c9['count']=_0xb172a6;if(_0x3f2061['query']['includeAll']){_0x29df00[_0x8724('0x50')]=[{'all':!![]}];}return db[_0x8724('0x3d')][_0x8724('0x51')](_0x29df00);})[_0x8724('0x20')](function(_0x5259dd){_0x5251c9['rows']=_0x5259dd;return _0x5251c9;})[_0x8724('0x20')](respondWithFilteredResult(_0x1b1a77,_0x29df00))['catch'](handleError(_0x1b1a77,null));};exports[_0x8724('0x52')]=function(_0x3c74ae,_0x4b374e){var _0x574c4f={'raw':!![],'where':{'id':_0x3c74ae[_0x8724('0x53')]['id']}},_0x10e33c={};_0x10e33c['model']=_[_0x8724('0x54')](db[_0x8724('0x3d')][_0x8724('0x3e')]);_0x10e33c[_0x8724('0x42')]=_[_0x8724('0x54')](_0x3c74ae[_0x8724('0x42')]);_0x10e33c[_0x8724('0x43')]=_['intersection'](_0x10e33c['model'],_0x10e33c[_0x8724('0x42')]);_0x574c4f[_0x8724('0x46')]=_['intersection'](_0x10e33c[_0x8724('0x45')],qs['fields'](_0x3c74ae[_0x8724('0x42')][_0x8724('0x47')]));_0x574c4f['attributes']=_0x574c4f[_0x8724('0x46')][_0x8724('0x48')]?_0x574c4f[_0x8724('0x46')]:_0x10e33c[_0x8724('0x45')];if(_0x3c74ae['query']['includeAll']){_0x574c4f[_0x8724('0x50')]=[{'all':!![]}];}_0x574c4f=_[_0x8724('0x4c')]({},_0x574c4f,_0x3c74ae[_0x8724('0x4f')]);return db[_0x8724('0x3d')][_0x8724('0x55')](_0x574c4f)[_0x8724('0x20')](handleEntityNotFound(_0x4b374e,null))['then'](respondWithResult(_0x4b374e,null))[_0x8724('0x2a')](handleError(_0x4b374e,null));};exports[_0x8724('0x36')]=function(_0x4e73a3,_0x462dd2){if(_0x4e73a3[_0x8724('0x56')]['id']){delete _0x4e73a3[_0x8724('0x56')]['id'];}return db[_0x8724('0x3d')]['find']({'where':{'id':_0x4e73a3[_0x8724('0x53')]['id']}})['then'](handleEntityNotFound(_0x462dd2,null))[_0x8724('0x20')](saveUpdates(_0x4e73a3[_0x8724('0x56')],null))['then'](respondWithResult(_0x462dd2,null))['catch'](handleError(_0x462dd2,null));};exports[_0x8724('0x37')]=function(_0x5140c6,_0x152957){return db['FaxMessage']['find']({'where':{'id':_0x5140c6[_0x8724('0x53')]['id']}})[_0x8724('0x20')](handleEntityNotFound(_0x152957,null))['then'](removeEntity(_0x152957,null))[_0x8724('0x2a')](handleError(_0x152957,null));};exports[_0x8724('0x57')]=function(_0x526363,_0x50a96e){return db[_0x8724('0x3d')]['describe']()[_0x8724('0x20')](respondWithResult(_0x50a96e,null))['catch'](handleError(_0x50a96e,null));};var interaction_log=require('../../config/logger')(_0x8724('0x58'));exports['accept']=function(_0x4c19f4,_0x3cf2d,_0x4c5c13){var _0x178d0e={'agent':{},'channel':_0x8724('0x59')};if(_0x4c19f4[_0x8724('0x56')]['id']){delete _0x4c19f4[_0x8724('0x56')]['id'];}_0x4c19f4[_0x8724('0x56')][_0x8724('0x5a')]=!![];_0x4c19f4[_0x8724('0x56')]['readAt']=moment()['format'](_0x8724('0x5b'));_0x4c19f4['body'][_0x8724('0x5c')]=_0x4c19f4[_0x8724('0x56')][_0x8724('0x5c')]||_0x4c19f4['user']['id'];_0x178d0e['agent']['id']=_0x4c19f4[_0x8724('0x56')][_0x8724('0x5c')];return db[_0x8724('0x3d')][_0x8724('0x55')]({'where':{'id':_0x4c19f4[_0x8724('0x53')]['id'],'UserId':null}})[_0x8724('0x20')](handleEntityNotFound(_0x3cf2d,null))['then'](saveUpdates(_0x4c19f4[_0x8724('0x56')],null))[_0x8724('0x20')](function(_0x4b1a91){if(_0x4b1a91){_0x178d0e[_0x8724('0x29')]=_0x4b1a91[_0x8724('0x5d')]({'plain':!![]});return db[_0x8724('0x5e')][_0x8724('0x55')]({'where':{'id':_0x4b1a91[_0x8724('0x5f')]}});}return null;})[_0x8724('0x20')](handleEntityNotFound(_0x3cf2d,null))[_0x8724('0x20')](function(_0x2838f7){if(_0x2838f7){return _0x2838f7['update']({'UserId':_0x4c19f4[_0x8724('0x56')][_0x8724('0x5c')],'read1stAt':_['isNil'](_0x2838f7['read1stAt'])?moment()[_0x8724('0x60')](_0x8724('0x5b')):undefined});}return null;})[_0x8724('0x20')](function(_0x5859e9){if(_0x5859e9){_0x178d0e['interaction']=_0x5859e9['get']({'plain':!![]});interaction_log[_0x8724('0x21')](_0x8724('0x61'),_0x4c19f4[_0x8724('0x62')]['id'],_0x4c19f4[_0x8724('0x62')][_0x8724('0x39')],_0x4c19f4[_0x8724('0x62')][_0x8724('0x63')],_0x178d0e[_0x8724('0x64')]['id'],_0x4c19f4['body']?JSON['stringify'](_0x4c19f4[_0x8724('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8724('0x65'),_0x178d0e);}return null;})[_0x8724('0x20')](function(_0x1407b4){var _0x48f30b=_0x8724('0x66')+_0x1407b4['message'][_0x8724('0x67')];return db[_0x8724('0x68')][_0x8724('0x42')](_0x48f30b,{'type':db[_0x8724('0x69')][_0x8724('0x6a')][_0x8724('0x6b')],'raw':!![]})[_0x8724('0x20')](function(_0x403336){return _0x403336;});})[_0x8724('0x20')](function(_0x5bc414){if(_0x5bc414){_0x178d0e[_0x8724('0x29')][_0x8724('0x6c')]=_0x5bc414[0x0];if(!_0x4c19f4['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x4c19f4[_0x8724('0x56')][_0x8724('0x5c')],'role':_0x8724('0x6d')},'attributes':['id',_0x8724('0x39'),'fullname',_0x8724('0x6e'),_0x8724('0x6f')],'raw':!![]});}return null;})['then'](function(_0x2ab2d6){if(!_0x2ab2d6)return null;_0x178d0e[_0x8724('0x29')][_0x8724('0x6d')]=_0x2ab2d6;return _0x178d0e;})[_0x8724('0x20')](function(_0x184644){if(_0x184644){if(_0x4c19f4[_0x8724('0x56')][_0x8724('0x70')]){_0x178d0e[_0x8724('0x29')]['interface']=util[_0x8724('0x60')](_0x8724('0x71'),_0x4c19f4['user'][_0x8724('0x39')]);_0x178d0e['message']['channel']=_0x178d0e[_0x8724('0x72')];_0x178d0e[_0x8724('0x29')][_0x8724('0x73')]=_0x178d0e[_0x8724('0x72')];_0x178d0e[_0x8724('0x29')][_0x8724('0x74')]=_0x8724('0x75');return respondWithRpcPromise(_0x8724('0x76'),'EventManager',{'event':_0x8724('0x77'),'message':_0x178d0e['message']},client9002)[_0x8724('0x20')](function(){return _0x178d0e;});}return _0x178d0e;}return null;})[_0x8724('0x20')](respondWithResult(_0x3cf2d,null))[_0x8724('0x2a')](handleError(_0x3cf2d,null));};var interaction_log=require(_0x8724('0x12'))(_0x8724('0x58'));exports['reject']=function(_0x261278,_0x4f3e2d,_0x5b6bd6){var _0x486a52={'agent':{},'channel':'fax'};if(_0x261278[_0x8724('0x56')]['id']){delete _0x261278['body']['id'];}_0x261278[_0x8724('0x56')]['UserId']=_0x261278['body']['UserId']||_0x261278['user']['id'];_0x486a52[_0x8724('0x6d')]['id']=_0x261278[_0x8724('0x56')][_0x8724('0x5c')];return db[_0x8724('0x3d')][_0x8724('0x55')]({'where':{'id':_0x261278['params']['id'],'UserId':null}})[_0x8724('0x20')](handleEntityNotFound(_0x4f3e2d,null))['then'](function(_0x3b647f){if(_0x3b647f){_0x486a52[_0x8724('0x29')]=_0x3b647f[_0x8724('0x5d')]({'plain':!![]});return db[_0x8724('0x5e')][_0x8724('0x55')]({'where':{'id':_0x3b647f[_0x8724('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x4f3e2d,null))['then'](function(_0x35cff8){if(_0x35cff8){_0x486a52['interaction']=_0x35cff8[_0x8724('0x5d')]({'plain':!![]});interaction_log[_0x8724('0x21')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x261278[_0x8724('0x62')]['id'],_0x261278['user'][_0x8724('0x39')],_0x261278[_0x8724('0x62')][_0x8724('0x63')],_0x486a52[_0x8724('0x64')]['id'],_0x261278[_0x8724('0x56')]?JSON['stringify'](_0x261278[_0x8724('0x56')]):'null');return respondWithRpcPromise(_0x8724('0x78'),_0x8724('0x79'),_0x486a52);}return null;})[_0x8724('0x20')](function(_0x37fa7e){var _0x50db09='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37fa7e[_0x8724('0x29')][_0x8724('0x67')];return db[_0x8724('0x68')][_0x8724('0x42')](_0x50db09,{'type':db[_0x8724('0x69')][_0x8724('0x6a')][_0x8724('0x6b')],'raw':!![]})['then'](function(_0xe9ecc9){return _0xe9ecc9;});})[_0x8724('0x20')](function(_0x543f80){if(_0x543f80){_0x486a52['message'][_0x8724('0x6c')]=_0x543f80[0x0];if(!_0x261278['body'][_0x8724('0x5c')])return;return db[_0x8724('0x7a')][_0x8724('0x55')]({'where':{'id':_0x261278['body'][_0x8724('0x5c')],'role':_0x8724('0x6d')},'attributes':['id',_0x8724('0x39'),'fullname',_0x8724('0x6e'),_0x8724('0x6f')],'raw':!![]});}return null;})[_0x8724('0x20')](function(_0x1668c5){if(!_0x1668c5)return null;_0x486a52[_0x8724('0x29')]['agent']=_0x1668c5;return _0x486a52;})[_0x8724('0x20')](function(_0x5196ee){if(_0x5196ee){_0x5196ee['message'][_0x8724('0x7b')]=util[_0x8724('0x60')](_0x8724('0x71'),_0x261278[_0x8724('0x62')]['name']);_0x5196ee['message'][_0x8724('0x72')]=_0x486a52[_0x8724('0x72')];_0x5196ee[_0x8724('0x29')][_0x8724('0x73')]=_0x486a52[_0x8724('0x72')];_0x5196ee['message'][_0x8724('0x74')]=_0x8724('0x34');respondWithRpcPromise(_0x8724('0x76'),_0x8724('0x76'),{'event':_0x8724('0x7c'),'message':_0x5196ee[_0x8724('0x29')]},client9002);return _0x486a52;}return null;})[_0x8724('0x20')](respondWithResult(_0x4f3e2d,null))[_0x8724('0x2a')](handleError(_0x4f3e2d,null));};exports['create']=function(_0x3cb120,_0x3dcf1f){var _0x8e43ac;return db['FaxMessage'][_0x8724('0x7d')](_0x3cb120[_0x8724('0x56')],{})[_0x8724('0x20')](function(_0x54a2c9){_0x8e43ac=_0x54a2c9;return db['CmContact']['findOne']({'where':{'id':_0x8e43ac[_0x8724('0x67')]}});})[_0x8724('0x20')](function(_0x22df29){if(_['isNil'](_0x22df29)){return;}else{_0x8e43ac[_0x8724('0x59')]=_0x22df29[_0x8724('0x59')];return db[_0x8724('0x7e')][_0x8724('0x7f')]({'where':{'id':_0x8e43ac[_0x8724('0x80')]}});}})[_0x8724('0x20')](function(_0x2c66c2){return respondWithRpcPromise(_0x8724('0x81'),'SendFax',{'FaxAccountId':_[_0x8724('0x82')](_0x3cb120['body'])?undefined:_0x3cb120[_0x8724('0x56')][_0x8724('0x83')],'path':_['isNil'](_0x2c66c2)?undefined:util[_0x8724('0x60')](_0x8724('0x84'),_0x2c66c2[_0x8724('0x85')]),'fax':_[_0x8724('0x82')](_0x8e43ac['fax'])?undefined:_0x8e43ac['fax'],'AttachmentId':_0x8e43ac[_0x8724('0x80')]},client9002);})[_0x8724('0x20')](respondWithResult(_0x3dcf1f,0xc9))[_0x8724('0x2a')](handleError(_0x3dcf1f,null));};exports[_0x8724('0x86')]=function(_0x2f78d8,_0x2e7288){var _0x473295=path[_0x8724('0x87')](config['root'],_0x8724('0x88'),'files',_0x8724('0x89'));return db['FaxMessage'][_0x8724('0x55')]({'where':{'id':_0x2f78d8[_0x8724('0x53')]['id']},'include':[{'model':db[_0x8724('0x7e')],'as':_0x8724('0x7e')}]})[_0x8724('0x20')](handleEntityNotFound(_0x2e7288,null))[_0x8724('0x20')](function(_0x746efd){if(_0x746efd){return _0x2e7288[_0x8724('0x86')](path[_0x8724('0x87')](_0x473295,_0x746efd['Attachment'][_0x8724('0x85')]));}})[_0x8724('0x2a')](handleError(_0x2e7288,null));}; \ No newline at end of file +var _0x91d1=['nolimit','order','sort','filters','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','find','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT','fullname','interface','event','create','CmContact','Attachment','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x1454e1,_0x3b2847){var _0x3739e5=function(_0x5ac32b){while(--_0x5ac32b){_0x1454e1['push'](_0x1454e1['shift']());}};_0x3739e5(++_0x3b2847);}(_0x91d1,0xd1));var _0x191d=function(_0x1a478f,_0x388e9c){_0x1a478f=_0x1a478f-0x0;var _0xbe294a=_0x91d1[_0x1a478f];return _0xbe294a;};'use strict';var emlformat=require(_0x191d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x191d('0x1'));var jsonpatch=require(_0x191d('0x2'));var rp=require(_0x191d('0x3'));var moment=require(_0x191d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x191d('0x5'));var path=require(_0x191d('0x6'));var sox=require(_0x191d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x191d('0x8'));var _=require(_0x191d('0x9'));var squel=require(_0x191d('0xa'));var crypto=require(_0x191d('0xb'));var jsforce=require(_0x191d('0xc'));var deskjs=require(_0x191d('0xd'));var toCsv=require(_0x191d('0xe'));var querystring=require('querystring');var Papa=require(_0x191d('0xf'));var Redis=require(_0x191d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x191d('0x11'));var as=require(_0x191d('0x12'));var hardwareService=require(_0x191d('0x13'));var logger=require(_0x191d('0x14'))('api');var utils=require(_0x191d('0x15'));var config=require(_0x191d('0x16'));var licenseUtil=require(_0x191d('0x17'));var db=require('../../mysqldb')['db'];config[_0x191d('0x18')]=_['defaults'](config[_0x191d('0x18')],{'host':_0x191d('0x19'),'port':0x18eb});var socket=require(_0x191d('0x1a'))(new Redis(config[_0x191d('0x18')]));require(_0x191d('0x1b'))[_0x191d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x191d('0x1d')][_0x191d('0x1e')]({'port':0x232c});var client9002=jayson[_0x191d('0x1d')][_0x191d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x552c21,_0x3f9ec3,_0x31af2d,_0x3a83fd){return new BPromise(function(_0x1dd9b9,_0x15483a){var _0x15200d=_0x3a83fd||client;return _0x15200d[_0x191d('0x1f')](_0x552c21,_0x31af2d)[_0x191d('0x20')](function(_0x3ee01a){logger['info'](_0x191d('0x21'),_0x3f9ec3,_0x191d('0x22'));logger[_0x191d('0x23')](_0x191d('0x24'),_0x3f9ec3,_0x191d('0x22'),JSON[_0x191d('0x25')](_0x3ee01a));if(_0x3ee01a['error']){if(_0x3ee01a[_0x191d('0x26')][_0x191d('0x27')]===0x1f4){logger[_0x191d('0x26')]('FaxMessage,\x20%s,\x20%s',_0x3f9ec3,_0x3ee01a[_0x191d('0x26')]['message']);return _0x15483a(_0x3ee01a[_0x191d('0x26')][_0x191d('0x28')]);}logger[_0x191d('0x26')](_0x191d('0x21'),_0x3f9ec3,_0x3ee01a[_0x191d('0x26')][_0x191d('0x28')]);return _0x1dd9b9(_0x3ee01a['error'][_0x191d('0x28')]);}else{logger[_0x191d('0x29')]('FaxMessage,\x20%s,\x20%s',_0x3f9ec3,_0x191d('0x22'));_0x1dd9b9(_0x3ee01a['result'][_0x191d('0x28')]);}})[_0x191d('0x2a')](function(_0xcba2ba){logger[_0x191d('0x26')](_0x191d('0x21'),_0x3f9ec3,_0xcba2ba);_0x15483a(_0xcba2ba);});});}function respondWithStatusCode(_0x45d05b,_0x5719bf){_0x5719bf=_0x5719bf||0xcc;return function(_0x96c90d){if(_0x96c90d){return _0x45d05b[_0x191d('0x2b')](_0x5719bf);}return _0x45d05b[_0x191d('0x2c')](_0x5719bf)[_0x191d('0x2d')]();};}function respondWithResult(_0x1c44fb,_0x5e7b75){_0x5e7b75=_0x5e7b75||0xc8;return function(_0x30d3ee){if(_0x30d3ee){return _0x1c44fb['status'](_0x5e7b75)['json'](_0x30d3ee);}};}function respondWithFilteredResult(_0x14d867,_0x511e23){return function(_0x9623b9){if(_0x9623b9){var _0x3f2ed5=typeof _0x511e23[_0x191d('0x2e')]==='undefined'&&typeof _0x511e23[_0x191d('0x2f')]===_0x191d('0x30');var _0x5c5201=_0x9623b9[_0x191d('0x31')];var _0x4a4142=_0x3f2ed5?0x0:_0x511e23['offset'];var _0x2521fd=_0x3f2ed5?_0x9623b9[_0x191d('0x31')]:_0x511e23[_0x191d('0x2e')]+_0x511e23[_0x191d('0x2f')];var _0x4db170;if(_0x2521fd>=_0x5c5201){_0x2521fd=_0x5c5201;_0x4db170=0xc8;}else{_0x4db170=0xce;}_0x14d867[_0x191d('0x2c')](_0x4db170);return _0x14d867['set']('Content-Range',_0x4a4142+'-'+_0x2521fd+'/'+_0x5c5201)[_0x191d('0x32')](_0x9623b9);}return null;};}function patchUpdates(_0xb54185){return function(_0x1d83be){try{jsonpatch[_0x191d('0x33')](_0x1d83be,_0xb54185,!![]);}catch(_0x27794d){return BPromise[_0x191d('0x34')](_0x27794d);}return _0x1d83be['save']();};}function saveUpdates(_0x33dd13,_0x26846b){return function(_0x438577){if(_0x438577){return _0x438577[_0x191d('0x35')](_0x33dd13)[_0x191d('0x20')](function(_0x27885c){return _0x27885c;});}return null;};}function removeEntity(_0x5864f4,_0x4486fe){return function(_0x2e6463){if(_0x2e6463){return _0x2e6463[_0x191d('0x36')]()[_0x191d('0x20')](function(){_0x5864f4[_0x191d('0x2c')](0xcc)[_0x191d('0x2d')]();});}};}function handleEntityNotFound(_0x552021,_0x15b114){return function(_0x2cef70){if(!_0x2cef70){_0x552021['sendStatus'](0x194);}return _0x2cef70;};}function handleError(_0x31541a,_0x8eff6b){_0x8eff6b=_0x8eff6b||0x1f4;return function(_0x2176d9){logger[_0x191d('0x26')](_0x2176d9[_0x191d('0x37')]);if(_0x2176d9[_0x191d('0x38')]){delete _0x2176d9['name'];}_0x31541a[_0x191d('0x2c')](_0x8eff6b)[_0x191d('0x39')](_0x2176d9);};}exports[_0x191d('0x3a')]=function(_0x30608a,_0x533738){var _0x5809cc={},_0x3c802b={},_0x2a8470={'count':0x0,'rows':[]};var _0x4dbb62=_[_0x191d('0x3b')](db[_0x191d('0x3c')][_0x191d('0x3d')],function(_0x1e7fce){return{'name':_0x1e7fce[_0x191d('0x3e')],'type':_0x1e7fce[_0x191d('0x3f')][_0x191d('0x40')]};});_0x3c802b[_0x191d('0x41')]=_[_0x191d('0x3b')](_0x4dbb62,'name');_0x3c802b[_0x191d('0x42')]=_[_0x191d('0x43')](_0x30608a[_0x191d('0x42')]);_0x3c802b['filters']=_['intersection'](_0x3c802b['model'],_0x3c802b[_0x191d('0x42')]);_0x5809cc[_0x191d('0x44')]=_[_0x191d('0x45')](_0x3c802b[_0x191d('0x41')],qs[_0x191d('0x46')](_0x30608a[_0x191d('0x42')]['fields']));_0x5809cc[_0x191d('0x44')]=_0x5809cc[_0x191d('0x44')][_0x191d('0x47')]?_0x5809cc[_0x191d('0x44')]:_0x3c802b[_0x191d('0x41')];if(!_0x30608a[_0x191d('0x42')][_0x191d('0x48')](_0x191d('0x49'))){_0x5809cc[_0x191d('0x2f')]=qs['limit'](_0x30608a[_0x191d('0x42')]['limit']);_0x5809cc[_0x191d('0x2e')]=qs[_0x191d('0x2e')](_0x30608a[_0x191d('0x42')]['offset']);}_0x5809cc[_0x191d('0x4a')]=qs['sort'](_0x30608a[_0x191d('0x42')][_0x191d('0x4b')]);_0x5809cc['where']=qs[_0x191d('0x4c')](_['pick'](_0x30608a[_0x191d('0x42')],_0x3c802b[_0x191d('0x4c')]),_0x4dbb62);if(_0x30608a[_0x191d('0x42')]['filter']){_0x5809cc[_0x191d('0x4d')]=_[_0x191d('0x4e')](_0x5809cc[_0x191d('0x4d')],{'$or':_['map'](_0x4dbb62,function(_0x20a23c){if(_0x20a23c[_0x191d('0x3f')]!==_0x191d('0x4f')){var _0x7539a4={};_0x7539a4[_0x20a23c[_0x191d('0x38')]]={'$like':'%'+_0x30608a[_0x191d('0x42')]['filter']+'%'};return _0x7539a4;}})});}_0x5809cc=_[_0x191d('0x4e')]({},_0x5809cc,_0x30608a[_0x191d('0x50')]);var _0x2423c0={'where':_0x5809cc[_0x191d('0x4d')]};return db[_0x191d('0x3c')][_0x191d('0x31')](_0x2423c0)[_0x191d('0x20')](function(_0x371281){_0x2a8470[_0x191d('0x31')]=_0x371281;if(_0x30608a[_0x191d('0x42')][_0x191d('0x51')]){_0x5809cc[_0x191d('0x52')]=[{'all':!![]}];}return db[_0x191d('0x3c')]['findAll'](_0x5809cc);})['then'](function(_0x20d64f){_0x2a8470[_0x191d('0x53')]=_0x20d64f;return _0x2a8470;})[_0x191d('0x20')](respondWithFilteredResult(_0x533738,_0x5809cc))[_0x191d('0x2a')](handleError(_0x533738,null));};exports[_0x191d('0x54')]=function(_0x327346,_0x149db1){var _0x5a6d5c={'raw':!![],'where':{'id':_0x327346[_0x191d('0x55')]['id']}},_0x2a1fc3={};_0x2a1fc3['model']=_[_0x191d('0x43')](db['FaxMessage'][_0x191d('0x3d')]);_0x2a1fc3[_0x191d('0x42')]=_[_0x191d('0x43')](_0x327346[_0x191d('0x42')]);_0x2a1fc3[_0x191d('0x4c')]=_[_0x191d('0x45')](_0x2a1fc3['model'],_0x2a1fc3[_0x191d('0x42')]);_0x5a6d5c[_0x191d('0x44')]=_[_0x191d('0x45')](_0x2a1fc3[_0x191d('0x41')],qs[_0x191d('0x46')](_0x327346[_0x191d('0x42')][_0x191d('0x46')]));_0x5a6d5c[_0x191d('0x44')]=_0x5a6d5c['attributes'][_0x191d('0x47')]?_0x5a6d5c[_0x191d('0x44')]:_0x2a1fc3[_0x191d('0x41')];if(_0x327346[_0x191d('0x42')][_0x191d('0x51')]){_0x5a6d5c[_0x191d('0x52')]=[{'all':!![]}];}_0x5a6d5c=_[_0x191d('0x4e')]({},_0x5a6d5c,_0x327346[_0x191d('0x50')]);return db[_0x191d('0x3c')]['find'](_0x5a6d5c)[_0x191d('0x20')](handleEntityNotFound(_0x149db1,null))[_0x191d('0x20')](respondWithResult(_0x149db1,null))[_0x191d('0x2a')](handleError(_0x149db1,null));};exports[_0x191d('0x35')]=function(_0x24daa2,_0x260c6e){if(_0x24daa2[_0x191d('0x56')]['id']){delete _0x24daa2[_0x191d('0x56')]['id'];}return db[_0x191d('0x3c')][_0x191d('0x57')]({'where':{'id':_0x24daa2[_0x191d('0x55')]['id']}})[_0x191d('0x20')](handleEntityNotFound(_0x260c6e,null))[_0x191d('0x20')](saveUpdates(_0x24daa2[_0x191d('0x56')],null))[_0x191d('0x20')](respondWithResult(_0x260c6e,null))[_0x191d('0x2a')](handleError(_0x260c6e,null));};exports[_0x191d('0x36')]=function(_0x3a9982,_0x3012f0){return db[_0x191d('0x3c')][_0x191d('0x57')]({'where':{'id':_0x3a9982['params']['id']}})['then'](handleEntityNotFound(_0x3012f0,null))[_0x191d('0x20')](removeEntity(_0x3012f0,null))['catch'](handleError(_0x3012f0,null));};exports[_0x191d('0x58')]=function(_0x230759,_0x5841e2){return db[_0x191d('0x3c')][_0x191d('0x58')]()['then'](respondWithResult(_0x5841e2,null))[_0x191d('0x2a')](handleError(_0x5841e2,null));};var interaction_log=require(_0x191d('0x14'))(_0x191d('0x59'));exports[_0x191d('0x5a')]=function(_0x296b67,_0x5e5710,_0x57f175){var _0x16a4f4={'agent':{},'channel':_0x191d('0x5b')};if(_0x296b67[_0x191d('0x56')]['id']){delete _0x296b67[_0x191d('0x56')]['id'];}_0x296b67[_0x191d('0x56')][_0x191d('0x5c')]=!![];_0x296b67['body']['readAt']=moment()[_0x191d('0x5d')](_0x191d('0x5e'));_0x296b67[_0x191d('0x56')][_0x191d('0x5f')]=_0x296b67[_0x191d('0x56')]['UserId']||_0x296b67[_0x191d('0x60')]['id'];_0x16a4f4[_0x191d('0x61')]['id']=_0x296b67[_0x191d('0x56')][_0x191d('0x5f')];return db['FaxMessage'][_0x191d('0x57')]({'where':{'id':_0x296b67[_0x191d('0x55')]['id'],'UserId':null}})[_0x191d('0x20')](handleEntityNotFound(_0x5e5710,null))[_0x191d('0x20')](saveUpdates(_0x296b67['body'],null))[_0x191d('0x20')](function(_0x364778){if(_0x364778){_0x16a4f4[_0x191d('0x28')]=_0x364778[_0x191d('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x191d('0x57')]({'where':{'id':_0x364778[_0x191d('0x63')]}});}return null;})[_0x191d('0x20')](handleEntityNotFound(_0x5e5710,null))['then'](function(_0x5051b8){if(_0x5051b8){return _0x5051b8[_0x191d('0x35')]({'UserId':_0x296b67[_0x191d('0x56')][_0x191d('0x5f')],'read1stAt':_['isNil'](_0x5051b8[_0x191d('0x64')])?moment()[_0x191d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x191d('0x20')](function(_0x2a36c1){if(_0x2a36c1){_0x16a4f4[_0x191d('0x65')]=_0x2a36c1[_0x191d('0x62')]({'plain':!![]});interaction_log[_0x191d('0x29')](_0x191d('0x66'),_0x296b67[_0x191d('0x60')]['id'],_0x296b67['user'][_0x191d('0x38')],_0x296b67[_0x191d('0x60')]['role'],_0x16a4f4[_0x191d('0x65')]['id'],_0x296b67[_0x191d('0x56')]?JSON['stringify'](_0x296b67['body']):_0x191d('0x67'));return respondWithRpcPromise(_0x191d('0x68'),_0x191d('0x69'),_0x16a4f4);}return null;})[_0x191d('0x20')](function(_0x2afd07){var _0x19b979=_0x191d('0x6a')+_0x2afd07[_0x191d('0x28')][_0x191d('0x6b')];return db[_0x191d('0x6c')][_0x191d('0x42')](_0x19b979,{'type':db[_0x191d('0x6d')][_0x191d('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x5cd69e){return _0x5cd69e;});})[_0x191d('0x20')](function(_0x17e437){if(_0x17e437){_0x16a4f4[_0x191d('0x28')][_0x191d('0x6f')]=_0x17e437[0x0];if(!_0x296b67['body']['UserId'])return;return db['User'][_0x191d('0x57')]({'where':{'id':_0x296b67[_0x191d('0x56')][_0x191d('0x5f')],'role':_0x191d('0x61')},'attributes':['id',_0x191d('0x38'),'fullname',_0x191d('0x70'),'internal'],'raw':!![]});}return null;})[_0x191d('0x20')](function(_0x2b1ec0){if(!_0x2b1ec0)return null;_0x16a4f4['message']['agent']=_0x2b1ec0;return _0x16a4f4;})[_0x191d('0x20')](function(_0x368f99){if(_0x368f99){if(_0x296b67[_0x191d('0x56')][_0x191d('0x71')]){_0x16a4f4[_0x191d('0x28')]['interface']=util[_0x191d('0x5d')](_0x191d('0x72'),_0x296b67[_0x191d('0x60')][_0x191d('0x38')]);_0x16a4f4[_0x191d('0x28')]['channel']=_0x16a4f4[_0x191d('0x73')];_0x16a4f4[_0x191d('0x28')][_0x191d('0x74')]=_0x16a4f4[_0x191d('0x73')];_0x16a4f4['message']['event']=_0x191d('0x5a');return respondWithRpcPromise(_0x191d('0x75'),_0x191d('0x75'),{'event':_0x191d('0x76'),'message':_0x16a4f4[_0x191d('0x28')]},client9002)[_0x191d('0x20')](function(){return _0x16a4f4;});}return _0x16a4f4;}return null;})['then'](respondWithResult(_0x5e5710,null))[_0x191d('0x2a')](handleError(_0x5e5710,null));};var interaction_log=require('../../config/logger')(_0x191d('0x59'));exports[_0x191d('0x34')]=function(_0x559abd,_0x409801,_0x41ed0c){var _0x1fef3f={'agent':{},'channel':_0x191d('0x5b')};if(_0x559abd[_0x191d('0x56')]['id']){delete _0x559abd[_0x191d('0x56')]['id'];}_0x559abd[_0x191d('0x56')][_0x191d('0x5f')]=_0x559abd[_0x191d('0x56')]['UserId']||_0x559abd[_0x191d('0x60')]['id'];_0x1fef3f['agent']['id']=_0x559abd[_0x191d('0x56')]['UserId'];return db[_0x191d('0x3c')][_0x191d('0x57')]({'where':{'id':_0x559abd[_0x191d('0x55')]['id'],'UserId':null}})[_0x191d('0x20')](handleEntityNotFound(_0x409801,null))[_0x191d('0x20')](function(_0x3ed7db){if(_0x3ed7db){_0x1fef3f[_0x191d('0x28')]=_0x3ed7db[_0x191d('0x62')]({'plain':!![]});return db[_0x191d('0x77')][_0x191d('0x57')]({'where':{'id':_0x3ed7db['FaxInteractionId']}});}return null;})[_0x191d('0x20')](handleEntityNotFound(_0x409801,null))['then'](function(_0x3dd16b){if(_0x3dd16b){_0x1fef3f[_0x191d('0x65')]=_0x3dd16b[_0x191d('0x62')]({'plain':!![]});interaction_log[_0x191d('0x29')](_0x191d('0x78'),_0x559abd[_0x191d('0x60')]['id'],_0x559abd[_0x191d('0x60')][_0x191d('0x38')],_0x559abd[_0x191d('0x60')][_0x191d('0x79')],_0x1fef3f[_0x191d('0x65')]['id'],_0x559abd[_0x191d('0x56')]?JSON[_0x191d('0x25')](_0x559abd[_0x191d('0x56')]):_0x191d('0x67'));return respondWithRpcPromise('RejectMessage',_0x191d('0x7a'),_0x1fef3f);}return null;})['then'](function(_0x544c40){var _0x5ab238=_0x191d('0x6a')+_0x544c40['message']['ContactId'];return db[_0x191d('0x6c')]['query'](_0x5ab238,{'type':db[_0x191d('0x6d')][_0x191d('0x6e')][_0x191d('0x7b')],'raw':!![]})[_0x191d('0x20')](function(_0x57366f){return _0x57366f;});})[_0x191d('0x20')](function(_0x27429c){if(_0x27429c){_0x1fef3f[_0x191d('0x28')][_0x191d('0x6f')]=_0x27429c[0x0];if(!_0x559abd['body'][_0x191d('0x5f')])return;return db['User']['find']({'where':{'id':_0x559abd[_0x191d('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x191d('0x38'),_0x191d('0x7c'),_0x191d('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5ca8c6){if(!_0x5ca8c6)return null;_0x1fef3f[_0x191d('0x28')][_0x191d('0x61')]=_0x5ca8c6;return _0x1fef3f;})[_0x191d('0x20')](function(_0x33c509){if(_0x33c509){_0x33c509['message'][_0x191d('0x7d')]=util[_0x191d('0x5d')]('SIP/%s',_0x559abd['user'][_0x191d('0x38')]);_0x33c509['message'][_0x191d('0x73')]=_0x1fef3f[_0x191d('0x73')];_0x33c509[_0x191d('0x28')][_0x191d('0x74')]=_0x1fef3f['channel'];_0x33c509[_0x191d('0x28')][_0x191d('0x7e')]=_0x191d('0x34');respondWithRpcPromise(_0x191d('0x75'),'EventManager',{'event':'rejectmessage','message':_0x33c509[_0x191d('0x28')]},client9002);return _0x1fef3f;}return null;})[_0x191d('0x20')](respondWithResult(_0x409801,null))[_0x191d('0x2a')](handleError(_0x409801,null));};exports[_0x191d('0x7f')]=function(_0x166594,_0x3cac48){var _0x453cf1;return db['FaxMessage'][_0x191d('0x7f')](_0x166594[_0x191d('0x56')],{})['then'](function(_0x1682cc){_0x453cf1=_0x1682cc;return db[_0x191d('0x80')]['findOne']({'where':{'id':_0x453cf1[_0x191d('0x6b')]}});})[_0x191d('0x20')](function(_0x5c328f){if(_['isNil'](_0x5c328f)){return;}else{_0x453cf1['fax']=_0x5c328f[_0x191d('0x5b')];return db[_0x191d('0x81')][_0x191d('0x82')]({'where':{'id':_0x453cf1[_0x191d('0x83')]}});}})[_0x191d('0x20')](function(_0x1749cd){return respondWithRpcPromise(_0x191d('0x84'),_0x191d('0x84'),{'FaxAccountId':_[_0x191d('0x85')](_0x166594[_0x191d('0x56')])?undefined:_0x166594[_0x191d('0x56')][_0x191d('0x86')],'path':_['isNil'](_0x1749cd)?undefined:util['format'](_0x191d('0x87'),_0x1749cd[_0x191d('0x88')]),'fax':_['isNil'](_0x453cf1[_0x191d('0x5b')])?undefined:_0x453cf1[_0x191d('0x5b')],'AttachmentId':_0x453cf1[_0x191d('0x83')]},client9002);})[_0x191d('0x20')](respondWithResult(_0x3cac48,0xc9))[_0x191d('0x2a')](handleError(_0x3cac48,null));};exports[_0x191d('0x89')]=function(_0x519300,_0x5579eb){var _0x112d08=path[_0x191d('0x8a')](config[_0x191d('0x8b')],'server','files',_0x191d('0x8c'));return db[_0x191d('0x3c')][_0x191d('0x57')]({'where':{'id':_0x519300[_0x191d('0x55')]['id']},'include':[{'model':db[_0x191d('0x81')],'as':_0x191d('0x81')}]})[_0x191d('0x20')](handleEntityNotFound(_0x5579eb,null))[_0x191d('0x20')](function(_0x5ec6be){if(_0x5ec6be){return _0x5579eb[_0x191d('0x89')](path[_0x191d('0x8a')](_0x112d08,_0x5ec6be['Attachment']['basename']));}})[_0x191d('0x2a')](handleError(_0x5579eb,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b088a25..543b5cc 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 _0x6657=['FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x581ae2,_0xfc6a3f){var _0x322552=function(_0x59b98e){while(--_0x59b98e){_0x581ae2['push'](_0x581ae2['shift']());}};_0x322552(++_0xfc6a3f);}(_0x6657,0x17f));var _0x7665=function(_0x3d1969,_0x57745e){_0x3d1969=_0x3d1969-0x0;var _0x5da1f2=_0x6657[_0x3d1969];return _0x5da1f2;};'use strict';var EventEmitter=require(_0x7665('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7665('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7665('0x2')](0x0);var events={'afterCreate':_0x7665('0x3'),'afterUpdate':_0x7665('0x4'),'afterDestroy':'remove'};function emitEvent(_0x386ca9){return function(_0x2ed8cb,_0x26acc4,_0x1c33b1){FaxMessageEvents[_0x7665('0x5')](_0x386ca9+':'+_0x2ed8cb['id'],_0x2ed8cb);FaxMessageEvents[_0x7665('0x5')](_0x386ca9,_0x2ed8cb);_0x1c33b1(null);};}for(var e in events){if(events[_0x7665('0x6')](e)){var event=events[e];FaxMessage[_0x7665('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xeae8=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','remove','emit'];(function(_0x8968a5,_0x3e4578){var _0x192952=function(_0x50216e){while(--_0x50216e){_0x8968a5['push'](_0x8968a5['shift']());}};_0x192952(++_0x3e4578);}(_0xeae8,0x66));var _0x8eae=function(_0x1c3a05,_0x2993e5){_0x1c3a05=_0x1c3a05-0x0;var _0x3158ee=_0xeae8[_0x1c3a05];return _0x3158ee;};'use strict';var EventEmitter=require(_0x8eae('0x0'));var FaxMessage=require(_0x8eae('0x1'))['db'][_0x8eae('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8eae('0x3'),'afterUpdate':'update','afterDestroy':_0x8eae('0x4')};function emitEvent(_0x5f311f){return function(_0x355d48,_0x18cccf,_0x30e4cc){FaxMessageEvents[_0x8eae('0x5')](_0x5f311f+':'+_0x355d48['id'],_0x355d48);FaxMessageEvents[_0x8eae('0x5')](_0x5f311f,_0x355d48);_0x30e4cc(null);};}for(var e in events){if(events[_0x8eae('0x6')](e)){var event=events[e];FaxMessage[_0x8eae('0x7')](e,emitEvent(event));}}module[_0x8eae('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 1c20258..9a14a5a 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 _0xc05d=['toLowerCase','secret','isNil','UserId','FaxInteraction','then','createdAt','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xc05d,0x8b));var _0xdc05=function(_0xffa8a,_0x27e454){_0xffa8a=_0xffa8a-0x0;var _0x3c7626=_0xc05d[_0xffa8a];return _0x3c7626;};'use strict';var _=require(_0xdc05('0x0'));var util=require('util');var logger=require(_0xdc05('0x1'))(_0xdc05('0x2'));var moment=require(_0xdc05('0x3'));var BPromise=require(_0xdc05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc05('0x5'));var rimraf=require(_0xdc05('0x6'));var config=require(_0xdc05('0x7'));var attributes=require(_0xdc05('0x8'));module['exports']=function(_0x3508e3,_0x41607e){return _0x3508e3[_0xdc05('0x9')](_0xdc05('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xdc05('0xb'),'fields':[_0xdc05('0xc')],'type':_0xdc05('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9b1acd,_0x1503d2,_0xb321a7){var _0x13d5b2=_0x3508e3[_0xdc05('0xe')];var _0x47fb00=_0x9b1acd[_0xdc05('0xf')]({'plain':!![]});if(_0x47fb00[_0xdc05('0x10')]['toLowerCase']()==='in'||_0x47fb00[_0xdc05('0x10')][_0xdc05('0x11')]()==='out'&&!_0x47fb00[_0xdc05('0x12')]&&!_[_0xdc05('0x13')](_0x47fb00[_0xdc05('0x14')])){_0x13d5b2[_0xdc05('0x15')]['findOne']({'where':{'id':_0x47fb00['FaxInteractionId']}})[_0xdc05('0x16')](function(_0x5beb63){if(_0x5beb63){_0x5beb63['update']({'lastMsgAt':_0x47fb00[_0xdc05('0x17')],'lastMsgDirection':_0x47fb00[_0xdc05('0x10')][_0xdc05('0x11')]()});}})['catch'](function(_0x112a96){console[_0xdc05('0x18')](_0x112a96);});}_0xb321a7();}},'charset':_0xdc05('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae32=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','then','update','catch','error'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xae32,0x12a));var _0x2ae3=function(_0x106696,_0xe64257){_0x106696=_0x106696-0x0;var _0x13fc73=_0xae32[_0x106696];return _0x13fc73;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ae3('0x0'))('api');var moment=require(_0x2ae3('0x1'));var BPromise=require(_0x2ae3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ae3('0x3'));var rimraf=require(_0x2ae3('0x4'));var config=require(_0x2ae3('0x5'));var attributes=require(_0x2ae3('0x6'));module[_0x2ae3('0x7')]=function(_0x14aedc,_0x20f646){return _0x14aedc[_0x2ae3('0x8')](_0x2ae3('0x9'),attributes,{'tableName':_0x2ae3('0xa'),'paranoid':![],'indexes':[{'name':_0x2ae3('0xb'),'fields':[_0x2ae3('0xc')],'type':_0x2ae3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b58ab,_0x312756,_0x2c054a){var _0x534fbc=_0x14aedc['models'];var _0x449858=_0x1b58ab[_0x2ae3('0xe')]({'plain':!![]});if(_0x449858['direction'][_0x2ae3('0xf')]()==='in'||_0x449858[_0x2ae3('0x10')]['toLowerCase']()==='out'&&!_0x449858[_0x2ae3('0x11')]&&!_[_0x2ae3('0x12')](_0x449858[_0x2ae3('0x13')])){_0x534fbc[_0x2ae3('0x14')][_0x2ae3('0x15')]({'where':{'id':_0x449858['FaxInteractionId']}})[_0x2ae3('0x16')](function(_0xde5c83){if(_0xde5c83){_0xde5c83[_0x2ae3('0x17')]({'lastMsgAt':_0x449858['createdAt'],'lastMsgDirection':_0x449858['direction'][_0x2ae3('0xf')]()});}})[_0x2ae3('0x18')](function(_0x3c9900){console[_0x2ae3('0x19')](_0x3c9900);});}_0x2c054a();}},'charset':'utf8mb4','collate':_0x2ae3('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5c25b78..d033660 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x4a5cee,_0x26fd45){var _0x14fb71=function(_0x90215){while(--_0x90215){_0x4a5cee['push'](_0x4a5cee['shift']());}};_0x14fb71(++_0x26fd45);}(_0xac9d,0x14d));var _0xdac9=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0xac9d[_0x19c5f2];return _0xb94caf;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x3cff12,_0x22745d){var _0x4bb6c3=function(_0x2d6607){while(--_0x2d6607){_0x3cff12['push'](_0x3cff12['shift']());}};_0x4bb6c3(++_0x22745d);}(_0x032e,0x124));var _0xe032=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x032e[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b06f1d2..063b635 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 _0xc782=['remove','update','emit','removeListener','register','length','save'];(function(_0x954c59,_0x4ccf4c){var _0x358bb2=function(_0x4ef8f9){while(--_0x4ef8f9){_0x954c59['push'](_0x954c59['shift']());}};_0x358bb2(++_0x4ccf4c);}(_0xc782,0x12c));var _0x2c78=function(_0x5499ab,_0x4c1128){_0x5499ab=_0x5499ab-0x0;var _0x344478=_0xc782[_0x5499ab];return _0x344478;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x2c78('0x0'),_0x2c78('0x1'),_0x2c78('0x2')];function createListener(_0x12d9a9,_0x3d0fb1){return function(_0x5b45b5){_0x3d0fb1[_0x2c78('0x3')](_0x12d9a9,_0x5b45b5);};}function removeListener(_0x3b72f6,_0x324d2e){return function(){FaxMessageEvents[_0x2c78('0x4')](_0x3b72f6,_0x324d2e);};}exports[_0x2c78('0x5')]=function(_0x2a79f5){for(var _0x3f2f32=0x0,_0xb072c2=events[_0x2c78('0x6')];_0x3f2f32<_0xb072c2;_0x3f2f32++){var _0x4e8048=events[_0x3f2f32];var _0x50dd40=createListener('faxMessage:'+_0x4e8048,_0x2a79f5);FaxMessageEvents['on'](_0x4e8048,_0x50dd40);}}; \ No newline at end of file +var _0x02bf=['length','faxMessage:','./faxMessage.events','save','remove','update','emit','register'];(function(_0x4ce5ac,_0x3b6a03){var _0x2a8193=function(_0x53b32a){while(--_0x53b32a){_0x4ce5ac['push'](_0x4ce5ac['shift']());}};_0x2a8193(++_0x3b6a03);}(_0x02bf,0x92));var _0xf02b=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x02bf[_0x2f6541];return _0x4d76d8;};'use strict';var FaxMessageEvents=require(_0xf02b('0x0'));var events=[_0xf02b('0x1'),_0xf02b('0x2'),_0xf02b('0x3')];function createListener(_0x1de6f2,_0x3d5244){return function(_0x48e671){_0x3d5244[_0xf02b('0x4')](_0x1de6f2,_0x48e671);};}function removeListener(_0x251156,_0x2d5d3c){return function(){FaxMessageEvents['removeListener'](_0x251156,_0x2d5d3c);};}exports[_0xf02b('0x5')]=function(_0x306390){for(var _0x30d3dc=0x0,_0x4522d8=events[_0xf02b('0x6')];_0x30d3dc<_0x4522d8;_0x30d3dc++){var _0x3bfa3d=events[_0x30d3dc];var _0x258d5e=createListener(_0xf02b('0x7')+_0x3bfa3d,_0x306390);FaxMessageEvents['on'](_0x3bfa3d,_0x258d5e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 965d0a6..82b2b47 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 _0x2547=['/:id/download','download','post','tracked','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x2547,0x1cd));var _0x7254=function(_0x276467,_0x237a3b){_0x276467=_0x276467-0x0;var _0x4c7f18=_0x2547[_0x276467];return _0x4c7f18;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),interaction[_0x7254('0x12')]('fax',_0x7254('0x13')),controller['create']);router[_0x7254('0x14')]('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0x15')]);router[_0x7254('0x14')](_0x7254('0x16'),auth[_0x7254('0xa')](),controller[_0x7254('0x17')]);router[_0x7254('0x14')](_0x7254('0x18'),auth[_0x7254('0xa')](),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),controller['destroy']);module[_0x7254('0x1b')]=router; \ No newline at end of file +var _0xde2c=['/describe','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x42a9c0,_0x50a236){var _0x298db3=function(_0x2bbe32){while(--_0x2bbe32){_0x42a9c0['push'](_0x42a9c0['shift']());}};_0x298db3(++_0x50a236);}(_0xde2c,0x7f));var _0xcde2=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xde2c[_0x35f7f5];return _0x5567a4;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xcde2('0x13'),_0xcde2('0x14')),controller[_0xcde2('0x15')]);router[_0xcde2('0x16')](_0xcde2('0x17'),auth[_0xcde2('0xb')](),controller['update']);router[_0xcde2('0x16')]('/:id/accept',auth[_0xcde2('0xb')](),controller['accept']);router['put'](_0xcde2('0x18'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x19')]);router[_0xcde2('0x1a')](_0xcde2('0x17'),auth['isAuthenticated'](),controller[_0xcde2('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e70f602..8973ba3 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 _0x7874=['beepall','roundrobin','STRING','name','INTEGER','rrmemory'];(function(_0x3a730e,_0x59a269){var _0x2d8bad=function(_0x411fca){while(--_0x411fca){_0x3a730e['push'](_0x3a730e['shift']());}};_0x2d8bad(++_0x59a269);}(_0x7874,0x152));var _0x4787=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7874[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4787('0x0')],'unique':_0x4787('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4787('0x0')]},'timeout':{'type':Sequelize[_0x4787('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4787('0x3'),_0x4787('0x4'),_0x4787('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4787('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09db=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x419a0b,_0x5f5440){var _0x373162=function(_0x46bb12){while(--_0x46bb12){_0x419a0b['push'](_0x419a0b['shift']());}};_0x373162(++_0x5f5440);}(_0x09db,0x6c));var _0xb09d=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x09db[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0xb09d('0x0'));module[_0xb09d('0x1')]={'name':{'type':Sequelize[_0xb09d('0x2')],'unique':_0xb09d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb09d('0x2')]},'timeout':{'type':Sequelize[_0xb09d('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb09d('0x5')](_0xb09d('0x6'),_0xb09d('0x7'),'roundrobin'),'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 c03a695..4ea8ff0 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 _0x18d6=['describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','ids','User','Agents','online','voicePause','interface','addTeams','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','sequelize','transaction','removeTeams','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params'];(function(_0x1b99dc,_0x24a858){var _0x4c7fb3=function(_0x19ef02){while(--_0x19ef02){_0x1b99dc['push'](_0x1b99dc['shift']());}};_0x4c7fb3(++_0x24a858);}(_0x18d6,0xca));var _0x618d=function(_0x4a2176,_0x176e35){_0x4a2176=_0x4a2176-0x0;var _0x29e2c7=_0x18d6[_0x4a2176];return _0x29e2c7;};'use strict';var emlformat=require(_0x618d('0x0'));var rimraf=require(_0x618d('0x1'));var zipdir=require(_0x618d('0x2'));var jsonpatch=require(_0x618d('0x3'));var rp=require(_0x618d('0x4'));var moment=require(_0x618d('0x5'));var BPromise=require(_0x618d('0x6'));var Mustache=require(_0x618d('0x7'));var util=require(_0x618d('0x8'));var path=require(_0x618d('0x9'));var sox=require(_0x618d('0xa'));var csv=require(_0x618d('0xb'));var ejs=require(_0x618d('0xc'));var fs=require('fs');var fs_extra=require(_0x618d('0xd'));var _=require(_0x618d('0xe'));var squel=require(_0x618d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x618d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x618d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x618d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x618d('0x13'));var hardwareService=require(_0x618d('0x14'));var logger=require(_0x618d('0x15'))(_0x618d('0x16'));var utils=require(_0x618d('0x17'));var config=require(_0x618d('0x18'));var licenseUtil=require(_0x618d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x618d('0x1a')](config['redis'],{'host':_0x618d('0x1b'),'port':0x18eb});var socket=require(_0x618d('0x1c'))(new Redis(config[_0x618d('0x1d')]));require(_0x618d('0x1e'))[_0x618d('0x1f')](socket);function respondWithStatusCode(_0x29dcf7,_0x5e5469){_0x5e5469=_0x5e5469||0xcc;return function(_0x7d7d92){if(_0x7d7d92){return _0x29dcf7['sendStatus'](_0x5e5469);}return _0x29dcf7['status'](_0x5e5469)[_0x618d('0x20')]();};}function respondWithResult(_0x3a6d7d,_0x120552){_0x120552=_0x120552||0xc8;return function(_0x50726b){if(_0x50726b){return _0x3a6d7d['status'](_0x120552)[_0x618d('0x21')](_0x50726b);}};}function respondWithFilteredResult(_0x1a765f,_0x4f89e1){return function(_0xda5d0){if(_0xda5d0){var _0x3b942b=typeof _0x4f89e1[_0x618d('0x22')]==='undefined'&&typeof _0x4f89e1['limit']===_0x618d('0x23');var _0x17ce07=_0xda5d0['count'];var _0x50a8a1=_0x3b942b?0x0:_0x4f89e1['offset'];var _0x27af37=_0x3b942b?_0xda5d0['count']:_0x4f89e1['offset']+_0x4f89e1[_0x618d('0x24')];var _0x21163c;if(_0x27af37>=_0x17ce07){_0x27af37=_0x17ce07;_0x21163c=0xc8;}else{_0x21163c=0xce;}_0x1a765f[_0x618d('0x25')](_0x21163c);return _0x1a765f[_0x618d('0x26')](_0x618d('0x27'),_0x50a8a1+'-'+_0x27af37+'/'+_0x17ce07)[_0x618d('0x21')](_0xda5d0);}return null;};}function patchUpdates(_0x5a1ae4){return function(_0x44d93e){try{jsonpatch[_0x618d('0x28')](_0x44d93e,_0x5a1ae4,!![]);}catch(_0x5ac372){return BPromise[_0x618d('0x29')](_0x5ac372);}return _0x44d93e[_0x618d('0x2a')]();};}function saveUpdates(_0x29a534,_0x5b2399){return function(_0x5c169e){if(_0x5c169e){return _0x5c169e['update'](_0x29a534)[_0x618d('0x2b')](function(_0x5b9952){return _0x5b9952;});}return null;};}function removeEntity(_0x57125a,_0x31ee40){return function(_0xae069a){if(_0xae069a){return _0xae069a[_0x618d('0x2c')]()['then'](function(){var _0x4202a6=_0xae069a[_0x618d('0x2d')]({'plain':!![]});var _0x21564f='FaxQueues';return db['UserProfileResource'][_0x618d('0x2c')]({'where':{'type':_0x21564f,'resourceId':_0x4202a6['id']}})[_0x618d('0x2b')](function(){return _0xae069a;});})[_0x618d('0x2b')](function(){_0x57125a[_0x618d('0x25')](0xcc)[_0x618d('0x20')]();});}};}function handleEntityNotFound(_0x185f41,_0xfebfa2){return function(_0x5b1a9b){if(!_0x5b1a9b){_0x185f41[_0x618d('0x2e')](0x194);}return _0x5b1a9b;};}function handleError(_0x515c8c,_0x5926e6){_0x5926e6=_0x5926e6||0x1f4;return function(_0xde0251){logger[_0x618d('0x2f')](_0xde0251[_0x618d('0x30')]);if(_0xde0251[_0x618d('0x31')]){delete _0xde0251[_0x618d('0x31')];}_0x515c8c[_0x618d('0x25')](_0x5926e6)[_0x618d('0x32')](_0xde0251);};}exports[_0x618d('0x33')]=function(_0x3e64c1,_0x44491e){var _0x126876={},_0x4f93d7={},_0x2cea31={'count':0x0,'rows':[]};var _0x3c879b=_[_0x618d('0x34')](db[_0x618d('0x35')][_0x618d('0x36')],function(_0x391497){return{'name':_0x391497[_0x618d('0x37')],'type':_0x391497[_0x618d('0x38')][_0x618d('0x39')]};});_0x4f93d7['model']=_[_0x618d('0x34')](_0x3c879b,'name');_0x4f93d7[_0x618d('0x3a')]=_['keys'](_0x3e64c1[_0x618d('0x3a')]);_0x4f93d7[_0x618d('0x3b')]=_['intersection'](_0x4f93d7[_0x618d('0x3c')],_0x4f93d7[_0x618d('0x3a')]);_0x126876[_0x618d('0x3d')]=_[_0x618d('0x3e')](_0x4f93d7[_0x618d('0x3c')],qs['fields'](_0x3e64c1[_0x618d('0x3a')][_0x618d('0x3f')]));_0x126876['attributes']=_0x126876['attributes'][_0x618d('0x40')]?_0x126876[_0x618d('0x3d')]:_0x4f93d7[_0x618d('0x3c')];if(!_0x3e64c1[_0x618d('0x3a')][_0x618d('0x41')](_0x618d('0x42'))){_0x126876[_0x618d('0x24')]=qs['limit'](_0x3e64c1[_0x618d('0x3a')][_0x618d('0x24')]);_0x126876[_0x618d('0x22')]=qs[_0x618d('0x22')](_0x3e64c1[_0x618d('0x3a')]['offset']);}_0x126876['order']=qs[_0x618d('0x43')](_0x3e64c1[_0x618d('0x3a')][_0x618d('0x43')]);_0x126876['where']=qs[_0x618d('0x3b')](_[_0x618d('0x44')](_0x3e64c1['query'],_0x4f93d7[_0x618d('0x3b')]),_0x3c879b);if(_0x3e64c1[_0x618d('0x3a')][_0x618d('0x45')]){_0x126876['where']=_[_0x618d('0x46')](_0x126876[_0x618d('0x47')],{'$or':_['map'](_0x3c879b,function(_0x20c093){if(_0x20c093[_0x618d('0x38')]!==_0x618d('0x48')){var _0x30ffce={};_0x30ffce[_0x20c093['name']]={'$like':'%'+_0x3e64c1[_0x618d('0x3a')]['filter']+'%'};return _0x30ffce;}})});}_0x126876=_[_0x618d('0x46')]({},_0x126876,_0x3e64c1['options']);var _0x5da865={'where':_0x126876['where']};return db[_0x618d('0x35')]['count'](_0x5da865)[_0x618d('0x2b')](function(_0x231bae){_0x2cea31[_0x618d('0x49')]=_0x231bae;if(_0x3e64c1[_0x618d('0x3a')]['includeAll']){_0x126876[_0x618d('0x4a')]=[{'all':!![]}];}return db[_0x618d('0x35')][_0x618d('0x4b')](_0x126876);})[_0x618d('0x2b')](function(_0xe46896){_0x2cea31[_0x618d('0x4c')]=_0xe46896;return _0x2cea31;})[_0x618d('0x2b')](respondWithFilteredResult(_0x44491e,_0x126876))[_0x618d('0x4d')](handleError(_0x44491e,null));};exports[_0x618d('0x4e')]=function(_0x1e3239,_0x29e025){var _0x32b9dc={'raw':!![],'where':{'id':_0x1e3239['params']['id']}},_0x5e0e1f={};_0x5e0e1f['model']=_[_0x618d('0x4f')](db['FaxQueue'][_0x618d('0x36')]);_0x5e0e1f[_0x618d('0x3a')]=_['keys'](_0x1e3239[_0x618d('0x3a')]);_0x5e0e1f[_0x618d('0x3b')]=_[_0x618d('0x3e')](_0x5e0e1f[_0x618d('0x3c')],_0x5e0e1f[_0x618d('0x3a')]);_0x32b9dc[_0x618d('0x3d')]=_[_0x618d('0x3e')](_0x5e0e1f[_0x618d('0x3c')],qs['fields'](_0x1e3239[_0x618d('0x3a')][_0x618d('0x3f')]));_0x32b9dc[_0x618d('0x3d')]=_0x32b9dc[_0x618d('0x3d')]['length']?_0x32b9dc['attributes']:_0x5e0e1f[_0x618d('0x3c')];if(_0x1e3239[_0x618d('0x3a')][_0x618d('0x50')]){_0x32b9dc[_0x618d('0x4a')]=[{'all':!![]}];}_0x32b9dc=_[_0x618d('0x46')]({},_0x32b9dc,_0x1e3239[_0x618d('0x51')]);return db[_0x618d('0x35')][_0x618d('0x52')](_0x32b9dc)[_0x618d('0x2b')](handleEntityNotFound(_0x29e025,null))[_0x618d('0x2b')](respondWithResult(_0x29e025,null))[_0x618d('0x4d')](handleError(_0x29e025,null));};exports[_0x618d('0x53')]=function(_0x3386bb,_0x41539a){return db['FaxQueue'][_0x618d('0x53')](_0x3386bb[_0x618d('0x54')],{})[_0x618d('0x2b')](function(_0x3c8e39){var _0x572c63=_0x3386bb[_0x618d('0x55')]['get']({'plain':!![]});if(!_0x572c63)throw new Error(_0x618d('0x56'));if(_0x572c63[_0x618d('0x57')]===_0x618d('0x55')){var _0x324fa0=_0x3c8e39[_0x618d('0x2d')]({'plain':!![]});var _0x58ba8b=_0x618d('0x58');return db[_0x618d('0x59')][_0x618d('0x52')]({'where':{'name':_0x58ba8b,'userProfileId':_0x572c63[_0x618d('0x5a')]},'raw':!![]})[_0x618d('0x2b')](function(_0x50d4bd){if(_0x50d4bd&&_0x50d4bd[_0x618d('0x5b')]===0x0){return db[_0x618d('0x5c')][_0x618d('0x53')]({'name':_0x324fa0[_0x618d('0x31')],'resourceId':_0x324fa0['id'],'type':_0x50d4bd[_0x618d('0x31')],'sectionId':_0x50d4bd['id']},{})[_0x618d('0x2b')](function(){return _0x3c8e39;});}else{return _0x3c8e39;}})['catch'](function(_0x57fbcb){logger[_0x618d('0x2f')](_0x618d('0x5d'),_0x57fbcb);throw _0x57fbcb;});}return _0x3c8e39;})[_0x618d('0x2b')](respondWithResult(_0x41539a,0xc9))[_0x618d('0x4d')](handleError(_0x41539a,null));};exports[_0x618d('0x5e')]=function(_0xe12899,_0xf9bbb){if(_0xe12899[_0x618d('0x54')]['id']){delete _0xe12899[_0x618d('0x54')]['id'];}return db[_0x618d('0x35')][_0x618d('0x52')]({'where':{'id':_0xe12899[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0xf9bbb,null))[_0x618d('0x2b')](saveUpdates(_0xe12899[_0x618d('0x54')],null))[_0x618d('0x2b')](respondWithResult(_0xf9bbb,null))['catch'](handleError(_0xf9bbb,null));};exports[_0x618d('0x2c')]=function(_0x5eed3c,_0x4952aa){return db['FaxQueue'][_0x618d('0x52')]({'where':{'id':_0x5eed3c[_0x618d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4952aa,null))['then'](removeEntity(_0x4952aa,null))[_0x618d('0x4d')](handleError(_0x4952aa,null));};exports[_0x618d('0x60')]=function(_0x1e207d,_0xc8b668){return db[_0x618d('0x35')][_0x618d('0x60')]()[_0x618d('0x2b')](respondWithResult(_0xc8b668,null))[_0x618d('0x4d')](handleError(_0xc8b668,null));};exports[_0x618d('0x61')]=function(_0xccaddc,_0x1d8039,_0x3aac40){var _0x43d347={'raw':!![],'where':{}},_0x1f7823={},_0x9ffa88;return db[_0x618d('0x35')][_0x618d('0x62')]({'where':{'id':_0xccaddc[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0x1d8039,null))[_0x618d('0x2b')](function(_0x1bf5cc){if(_0x1bf5cc){_0x9ffa88=_0x1bf5cc[_0x618d('0x2d')]({'plain':!![]});_0x1f7823[_0x618d('0x3c')]=_[_0x618d('0x4f')](db[_0x618d('0x63')][_0x618d('0x36')]);_0x1f7823[_0x618d('0x3a')]=_[_0x618d('0x4f')](_0xccaddc['query']);_0x1f7823[_0x618d('0x3b')]=_[_0x618d('0x3e')](_0x1f7823['model'],_0x1f7823['query']);_0x43d347[_0x618d('0x3d')]=_[_0x618d('0x3e')](_0x1f7823[_0x618d('0x3c')],qs[_0x618d('0x3f')](_0xccaddc['query'][_0x618d('0x3f')]));_0x43d347[_0x618d('0x3d')]=_0x43d347[_0x618d('0x3d')]['length']?_0x43d347[_0x618d('0x3d')]:_0x1f7823['model'];if(!_0xccaddc[_0x618d('0x3a')][_0x618d('0x41')]('nolimit')){_0x43d347[_0x618d('0x24')]=qs['limit'](_0xccaddc[_0x618d('0x3a')]['limit']);_0x43d347['offset']=qs[_0x618d('0x22')](_0xccaddc[_0x618d('0x3a')][_0x618d('0x22')]);}_0x43d347[_0x618d('0x64')]=qs[_0x618d('0x43')](_0xccaddc['query']['sort']);_0x43d347[_0x618d('0x47')]=qs[_0x618d('0x3b')](_['pick'](_0xccaddc[_0x618d('0x3a')],_0x1f7823[_0x618d('0x3b')]));_0x43d347[_0x618d('0x47')][_0x618d('0x65')]=_0x1bf5cc['id'];if(_0xccaddc[_0x618d('0x3a')][_0x618d('0x45')]){_0x43d347[_0x618d('0x47')]=_[_0x618d('0x46')](_0x43d347[_0x618d('0x47')],{'$or':_[_0x618d('0x34')](_0x43d347[_0x618d('0x3d')],function(_0x4ab85f){var _0x1bf5c5={};_0x1bf5c5[_0x4ab85f]={'$like':'%'+_0xccaddc[_0x618d('0x3a')][_0x618d('0x45')]+'%'};return _0x1bf5c5;})});}_0x43d347=_[_0x618d('0x46')]({},_0x43d347,_0xccaddc[_0x618d('0x51')]);return db[_0x618d('0x63')][_0x618d('0x4b')](_0x43d347);}})[_0x618d('0x2b')](function(_0x389870){if(_0x389870){return db['User']['findAndCountAll']({'where':{'id':_[_0x618d('0x34')](_0x389870,_0x618d('0x66')),'role':_0x618d('0x67')},'attributes':['id',_0x618d('0x31'),_0x618d('0x68'),_0x618d('0x69'),'createdAt']});}})['then'](function(_0x44b6a5){if(_0x44b6a5){return{'count':_0x44b6a5[_0x618d('0x49')],'rows':_['map'](_0x44b6a5[_0x618d('0x4c')],function(_0x5e3cd6){return{'membername':_0x5e3cd6['name'],'UserId':_0x5e3cd6['id'],'queue_name':_0x9ffa88[_0x618d('0x31')],'FaxQueueId':_0x9ffa88['id'],'interface':util[_0x618d('0x6a')](_0x618d('0x6b'),_0x618d('0x6c'),_0x5e3cd6[_0x618d('0x31')]),'penalty':0x0,'paused':_0x5e3cd6[_0x618d('0x68')],'createdAt':_0x5e3cd6[_0x618d('0x6d')],'updatedAt':_0x5e3cd6[_0x618d('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x618d('0x2b')](respondWithFilteredResult(_0x1d8039,_0x43d347))[_0x618d('0x4d')](handleError(_0x1d8039,null));};exports['getTeams']=function(_0x19d5f2,_0x9e59ad,_0x2a6489){var _0xee4464={};var _0x325069={};var _0x55174c;var _0x5b3187;return db[_0x618d('0x35')][_0x618d('0x62')]({'where':{'id':_0x19d5f2[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0x9e59ad,null))['then'](function(_0x19978a){if(_0x19978a){_0x55174c=_0x19978a;_0x325069[_0x618d('0x3c')]=_[_0x618d('0x4f')](db[_0x618d('0x6e')][_0x618d('0x36')]);_0x325069['query']=_[_0x618d('0x4f')](_0x19d5f2[_0x618d('0x3a')]);_0x325069[_0x618d('0x3b')]=_['intersection'](_0x325069[_0x618d('0x3c')],_0x325069['query']);_0xee4464[_0x618d('0x3d')]=_[_0x618d('0x3e')](_0x325069[_0x618d('0x3c')],qs[_0x618d('0x3f')](_0x19d5f2['query'][_0x618d('0x3f')]));_0xee4464[_0x618d('0x3d')]=_0xee4464[_0x618d('0x3d')][_0x618d('0x40')]?_0xee4464[_0x618d('0x3d')]:_0x325069['model'];_0xee4464['order']=qs[_0x618d('0x43')](_0x19d5f2['query'][_0x618d('0x43')]);_0xee4464['where']=qs[_0x618d('0x3b')](_[_0x618d('0x44')](_0x19d5f2[_0x618d('0x3a')],_0x325069['filters']));if(_0x19d5f2[_0x618d('0x3a')][_0x618d('0x45')]){_0xee4464[_0x618d('0x47')]=_[_0x618d('0x46')](_0xee4464[_0x618d('0x47')],{'$or':_[_0x618d('0x34')](_0xee4464[_0x618d('0x3d')],function(_0x223637){var _0x25cd37={};_0x25cd37[_0x223637]={'$like':'%'+_0x19d5f2[_0x618d('0x3a')][_0x618d('0x45')]+'%'};return _0x25cd37;})});}_0xee4464=_[_0x618d('0x46')]({},_0xee4464,_0x19d5f2['options']);return _0x55174c[_0x618d('0x6f')](_0xee4464);}})['then'](function(_0x2bb1){if(_0x2bb1){_0x5b3187=_0x2bb1['length'];if(!_0x19d5f2[_0x618d('0x3a')][_0x618d('0x41')]('nolimit')){_0xee4464[_0x618d('0x24')]=qs[_0x618d('0x24')](_0x19d5f2[_0x618d('0x3a')][_0x618d('0x24')]);_0xee4464['offset']=qs[_0x618d('0x22')](_0x19d5f2[_0x618d('0x3a')][_0x618d('0x22')]);}return _0x55174c[_0x618d('0x6f')](_0xee4464);}})[_0x618d('0x2b')](function(_0x4f2002){if(_0x4f2002){return _0x4f2002?{'count':_0x5b3187,'rows':_0x4f2002}:null;}})[_0x618d('0x2b')](respondWithResult(_0x9e59ad,null))[_0x618d('0x4d')](handleError(_0x9e59ad,null));};exports['addTeams']=function(_0x9780ac,_0x843f2,_0x34601e){var _0x19665e=_0x9780ac[_0x618d('0x54')][_0x618d('0x70')];return db[_0x618d('0x6e')][_0x618d('0x4b')]({'where':{'id':_0x19665e},'attributes':['id'],'include':[{'model':db[_0x618d('0x71')],'as':_0x618d('0x72'),'attributes':['id',_0x618d('0x31'),_0x618d('0x73'),_0x618d('0x74'),_0x618d('0x75')],'raw':!![]}]})[_0x618d('0x2b')](function(_0x5752a8){if(_0x5752a8){var _0x1c6dc6=_['flatMap'](_0x5752a8,function(_0xfa6e30){var _0x516bea=_0xfa6e30['get']({'plain':!![]});return _0x516bea[_0x618d('0x72')];});return db[_0x618d('0x35')][_0x618d('0x52')]({'where':{'id':_0x9780ac[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](function(_0x2d3083){return db['sequelize']['transaction'](function(_0x2ce868){return _0x2d3083[_0x618d('0x76')](_0x19665e,{'transaction':_0x2ce868})[_0x618d('0x2b')](function(){return BPromise['each'](_0x1c6dc6,function(_0x75ffb0){return db[_0x618d('0x63')][_0x618d('0x77')]({'where':{'UserId':_0x75ffb0['id'],'FaxQueueId':_0x9780ac[_0x618d('0x5f')]['id']},'transaction':_0x2ce868});});})[_0x618d('0x2b')](function(){_0x1c6dc6[_0x618d('0x78')](function(_0x3681fa){socket['emit'](_0x618d('0x79'),{'UserId':_0x3681fa['id'],'FaxQueueId':_0x2d3083['id']});});});});});}})[_0x618d('0x2b')](respondWithStatusCode(_0x843f2,null))[_0x618d('0x4d')](handleError(_0x843f2,null));};exports['removeTeams']=function(_0x44933a,_0x239209,_0x4c604){return db[_0x618d('0x6e')][_0x618d('0x4b')]({'where':{'id':_0x44933a['query'][_0x618d('0x70')]},'attributes':['id'],'include':[{'model':db[_0x618d('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x618d('0x2b')](handleEntityNotFound(_0x239209,null))[_0x618d('0x2b')](function(_0x2570aa){var _0x441882=_[_0x618d('0x34')](_0x2570aa,'id');var _0x1ce775=[];var _0x23fe2d=[];var _0xba3ebc=squel[_0x618d('0x7a')]();_0xba3ebc[_0x618d('0x7b')](_0x618d('0x7c'))[_0x618d('0x7d')]('team_has_fax_queues','tq')[_0x618d('0x7e')](_0x618d('0x7f'),'ut',_0x618d('0x80'))[_0x618d('0x47')](_0x618d('0x81'),_0x44933a[_0x618d('0x5f')]['id']);for(var _0x799d8c=0x0;_0x799d8c<_0x2570aa[_0x618d('0x40')];_0x799d8c+=0x1){let _0x52a8c3=_0x2570aa[_0x799d8c];for(var _0x55b7aa=0x0;_0x55b7aa<_0x52a8c3['Agents'][_0x618d('0x40')];_0x55b7aa+=0x1){let _0x48d32e=_0x52a8c3[_0x618d('0x72')][_0x55b7aa];var _0x221768=_0xba3ebc[_0x618d('0x82')]();_0x221768[_0x618d('0x47')](_0x618d('0x83'),_0x48d32e['id']);_0x23fe2d['push'](db['sequelize'][_0x618d('0x3a')](_0x221768[_0x618d('0x84')](),{'type':db['sequelize'][_0x618d('0x85')][_0x618d('0x86')]})[_0x618d('0x2b')](function(_0x5ba7af){if(_0x5ba7af[_0x618d('0x40')]===0x1){return _0x48d32e['id'];}else{var _0x480153=_[_0x618d('0x87')](_[_0x618d('0x34')](_0x5ba7af,'TeamId'),function(_0x52991d){return _[_0x618d('0x88')](_0x441882,_0x52991d);});if(_0x480153){return _0x48d32e['id'];}}}));}}return BPromise['all'](_0x23fe2d)[_0x618d('0x2b')](function(_0x2fc0f0){_0x1ce775=_(_0x1ce775)[_0x618d('0x89')](_0x2fc0f0)['compact']()['value']();return db[_0x618d('0x35')][_0x618d('0x52')]({'where':{'id':_0x44933a[_0x618d('0x5f')]['id']}})['then'](function(_0x15c010){return db[_0x618d('0x8a')][_0x618d('0x8b')](function(_0x471556){return _0x15c010[_0x618d('0x8c')](_0x44933a[_0x618d('0x3a')][_0x618d('0x70')],{'transaction':_0x471556})['then'](function(){if(!_['isEmpty'](_0x1ce775)){return _0x15c010[_0x618d('0x8d')](_0x1ce775,{'transaction':_0x471556});}})[_0x618d('0x2b')](function(){_0x1ce775[_0x618d('0x78')](function(_0x4ffb8b){socket[_0x618d('0x8e')](_0x618d('0x8f'),{'UserId':_0x4ffb8b,'FaxQueueId':_0x15c010['id']});});});});});});})[_0x618d('0x2b')](respondWithStatusCode(_0x239209,null))[_0x618d('0x4d')](handleError(_0x239209,null));};exports[_0x618d('0x90')]=function(_0x5af1c7,_0x400163,_0x316379){return db['FaxQueue'][_0x618d('0x52')]({'where':{'id':_0x5af1c7[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0x400163,null))[_0x618d('0x2b')](function(_0x198515){if(_0x198515){return _0x198515[_0x618d('0x90')](_0x5af1c7[_0x618d('0x54')][_0x618d('0x70')],_[_0x618d('0x91')](_0x5af1c7['body'],[_0x618d('0x70'),'id'])||{})[_0x618d('0x92')](function(_0x441aca){for(var _0x34bf59=0x0;_0x34bf59<_0x5af1c7[_0x618d('0x54')][_0x618d('0x70')]['length'];_0x34bf59+=0x1){socket[_0x618d('0x8e')]('userFaxQueue:save',{'UserId':Number(_0x5af1c7[_0x618d('0x54')]['ids'][_0x34bf59]),'FaxQueueId':Number(_0x5af1c7[_0x618d('0x5f')]['id'])});}return _0x441aca;});}})[_0x618d('0x2b')](respondWithResult(_0x400163,null))['catch'](handleError(_0x400163,null));};exports[_0x618d('0x8d')]=function(_0x5335af,_0x5c5a4a,_0x33e4d1){return db[_0x618d('0x35')]['find']({'where':{'id':_0x5335af['params']['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0x5c5a4a,null))['then'](function(_0x554355){if(_0x554355){return _0x554355[_0x618d('0x8d')](_0x5335af['query'][_0x618d('0x70')])[_0x618d('0x2b')](function(){if(_[_0x618d('0x93')](_0x5335af['query'][_0x618d('0x70')])){for(var _0x348d3c=0x0;_0x348d3c<_0x5335af[_0x618d('0x3a')]['ids'][_0x618d('0x40')];_0x348d3c+=0x1){socket[_0x618d('0x8e')]('userFaxQueue:remove',{'UserId':Number(_0x5335af[_0x618d('0x3a')][_0x618d('0x70')][_0x348d3c]),'FaxQueueId':Number(_0x5335af['params']['id'])});}}else{socket['emit'](_0x618d('0x8f'),{'UserId':Number(_0x5335af['query'][_0x618d('0x70')]),'FaxQueueId':Number(_0x5335af['params']['id'])});}});}})[_0x618d('0x2b')](respondWithStatusCode(_0x5c5a4a,null))[_0x618d('0x4d')](handleError(_0x5c5a4a,null));};exports[_0x618d('0x94')]=function(_0x11c603,_0x2918fc,_0x31b9bc){var _0x317618={};var _0x215cae={};var _0x29f8d8;var _0x539a4d;return db[_0x618d('0x35')]['findOne']({'where':{'id':_0x11c603[_0x618d('0x5f')]['id']}})[_0x618d('0x2b')](handleEntityNotFound(_0x2918fc,null))[_0x618d('0x2b')](function(_0x1bf01b){if(_0x1bf01b){_0x29f8d8=_0x1bf01b;_0x215cae[_0x618d('0x3c')]=_[_0x618d('0x4f')](db[_0x618d('0x71')][_0x618d('0x36')]);_0x215cae[_0x618d('0x3a')]=_[_0x618d('0x4f')](_0x11c603['query']);_0x215cae[_0x618d('0x3b')]=_[_0x618d('0x3e')](_0x215cae[_0x618d('0x3c')],_0x215cae[_0x618d('0x3a')]);_0x317618['attributes']=_['intersection'](_0x215cae['model'],qs[_0x618d('0x3f')](_0x11c603[_0x618d('0x3a')]['fields']));_0x317618[_0x618d('0x3d')]=_0x317618['attributes']['length']?_0x317618[_0x618d('0x3d')]:_0x215cae[_0x618d('0x3c')];_0x317618[_0x618d('0x64')]=qs[_0x618d('0x43')](_0x11c603[_0x618d('0x3a')][_0x618d('0x43')]);_0x317618[_0x618d('0x47')]=qs[_0x618d('0x3b')](_[_0x618d('0x44')](_0x11c603['query'],_0x215cae[_0x618d('0x3b')]));if(_0x11c603[_0x618d('0x3a')]['filter']){_0x317618[_0x618d('0x47')]=_[_0x618d('0x46')](_0x317618[_0x618d('0x47')],{'$or':_[_0x618d('0x34')](_0x317618['attributes'],function(_0x16981b){var _0x4b1b62={};_0x4b1b62[_0x16981b]={'$like':'%'+_0x11c603['query']['filter']+'%'};return _0x4b1b62;})});}_0x317618=_[_0x618d('0x46')]({},_0x317618,_0x11c603['options']);return _0x29f8d8[_0x618d('0x94')](_0x317618);}})[_0x618d('0x2b')](function(_0x344470){if(_0x344470){_0x539a4d=_0x344470['length'];if(!_0x11c603[_0x618d('0x3a')][_0x618d('0x41')](_0x618d('0x42'))){_0x317618['limit']=qs[_0x618d('0x24')](_0x11c603[_0x618d('0x3a')][_0x618d('0x24')]);_0x317618[_0x618d('0x22')]=qs['offset'](_0x11c603[_0x618d('0x3a')][_0x618d('0x22')]);}return _0x29f8d8[_0x618d('0x94')](_0x317618);}})['then'](function(_0x2ea878){if(_0x2ea878){return _0x2ea878?{'count':_0x539a4d,'rows':_0x2ea878}:null;}})[_0x618d('0x2b')](respondWithResult(_0x2918fc,null))[_0x618d('0x4d')](handleError(_0x2918fc,null));}; \ No newline at end of file +var _0x1ad9=['merge','type','VIRTUAL','include','catch','show','params','fields','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','ids','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','addAgents','isArray','userFaxQueue:remove','getAgents','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3ef8a9,_0x59a7c2){var _0x424f63=function(_0x7c1873){while(--_0x7c1873){_0x3ef8a9['push'](_0x3ef8a9['shift']());}};_0x424f63(++_0x59a7c2);}(_0x1ad9,0xdb));var _0x91ad=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x1ad9[_0xf71120];return _0xbe2fd3;};'use strict';var emlformat=require(_0x91ad('0x0'));var rimraf=require(_0x91ad('0x1'));var zipdir=require(_0x91ad('0x2'));var jsonpatch=require(_0x91ad('0x3'));var rp=require(_0x91ad('0x4'));var moment=require(_0x91ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91ad('0x6'));var util=require(_0x91ad('0x7'));var path=require(_0x91ad('0x8'));var sox=require(_0x91ad('0x9'));var csv=require(_0x91ad('0xa'));var ejs=require(_0x91ad('0xb'));var fs=require('fs');var fs_extra=require(_0x91ad('0xc'));var _=require(_0x91ad('0xd'));var squel=require('squel');var crypto=require(_0x91ad('0xe'));var jsforce=require(_0x91ad('0xf'));var deskjs=require(_0x91ad('0x10'));var toCsv=require(_0x91ad('0xa'));var querystring=require(_0x91ad('0x11'));var Papa=require(_0x91ad('0x12'));var Redis=require(_0x91ad('0x13'));var authService=require(_0x91ad('0x14'));var qs=require(_0x91ad('0x15'));var as=require(_0x91ad('0x16'));var hardwareService=require(_0x91ad('0x17'));var logger=require('../../config/logger')(_0x91ad('0x18'));var utils=require(_0x91ad('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x91ad('0x1a'));var db=require(_0x91ad('0x1b'))['db'];config[_0x91ad('0x1c')]=_[_0x91ad('0x1d')](config[_0x91ad('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91ad('0x1c')]));require(_0x91ad('0x1e'))[_0x91ad('0x1f')](socket);function respondWithStatusCode(_0x305a11,_0x3c7bef){_0x3c7bef=_0x3c7bef||0xcc;return function(_0x57b15e){if(_0x57b15e){return _0x305a11[_0x91ad('0x20')](_0x3c7bef);}return _0x305a11[_0x91ad('0x21')](_0x3c7bef)['end']();};}function respondWithResult(_0x48cbfa,_0x469673){_0x469673=_0x469673||0xc8;return function(_0x2b86bd){if(_0x2b86bd){return _0x48cbfa['status'](_0x469673)[_0x91ad('0x22')](_0x2b86bd);}};}function respondWithFilteredResult(_0x13cc19,_0x2f6108){return function(_0x171559){if(_0x171559){var _0x1247f2=typeof _0x2f6108[_0x91ad('0x23')]===_0x91ad('0x24')&&typeof _0x2f6108[_0x91ad('0x25')]==='undefined';var _0x269501=_0x171559[_0x91ad('0x26')];var _0x56e2af=_0x1247f2?0x0:_0x2f6108[_0x91ad('0x23')];var _0x29fa18=_0x1247f2?_0x171559[_0x91ad('0x26')]:_0x2f6108[_0x91ad('0x23')]+_0x2f6108[_0x91ad('0x25')];var _0x48cb71;if(_0x29fa18>=_0x269501){_0x29fa18=_0x269501;_0x48cb71=0xc8;}else{_0x48cb71=0xce;}_0x13cc19[_0x91ad('0x21')](_0x48cb71);return _0x13cc19[_0x91ad('0x27')](_0x91ad('0x28'),_0x56e2af+'-'+_0x29fa18+'/'+_0x269501)[_0x91ad('0x22')](_0x171559);}return null;};}function patchUpdates(_0x1779e4){return function(_0x2f7e04){try{jsonpatch[_0x91ad('0x29')](_0x2f7e04,_0x1779e4,!![]);}catch(_0x293b00){return BPromise[_0x91ad('0x2a')](_0x293b00);}return _0x2f7e04[_0x91ad('0x2b')]();};}function saveUpdates(_0x3e966f,_0x22040d){return function(_0x1965ff){if(_0x1965ff){return _0x1965ff[_0x91ad('0x2c')](_0x3e966f)[_0x91ad('0x2d')](function(_0x1d4617){return _0x1d4617;});}return null;};}function removeEntity(_0x384fc2,_0x1d1123){return function(_0x307422){if(_0x307422){return _0x307422[_0x91ad('0x2e')]()['then'](function(){var _0x119931=_0x307422['get']({'plain':!![]});var _0x11ea09='FaxQueues';return db['UserProfileResource'][_0x91ad('0x2e')]({'where':{'type':_0x11ea09,'resourceId':_0x119931['id']}})[_0x91ad('0x2d')](function(){return _0x307422;});})[_0x91ad('0x2d')](function(){_0x384fc2[_0x91ad('0x21')](0xcc)[_0x91ad('0x2f')]();});}};}function handleEntityNotFound(_0x2b2565,_0x1393e2){return function(_0x687737){if(!_0x687737){_0x2b2565['sendStatus'](0x194);}return _0x687737;};}function handleError(_0x2cb5e5,_0x53ba77){_0x53ba77=_0x53ba77||0x1f4;return function(_0x119f18){logger[_0x91ad('0x30')](_0x119f18[_0x91ad('0x31')]);if(_0x119f18[_0x91ad('0x32')]){delete _0x119f18[_0x91ad('0x32')];}_0x2cb5e5[_0x91ad('0x21')](_0x53ba77)[_0x91ad('0x33')](_0x119f18);};}exports[_0x91ad('0x34')]=function(_0x550734,_0x4e2a82){var _0x3fde16={},_0x33b16c={},_0x35e488={'count':0x0,'rows':[]};var _0x2c3e1f=_[_0x91ad('0x35')](db[_0x91ad('0x36')][_0x91ad('0x37')],function(_0x566865){return{'name':_0x566865['fieldName'],'type':_0x566865['type'][_0x91ad('0x38')]};});_0x33b16c[_0x91ad('0x39')]=_[_0x91ad('0x35')](_0x2c3e1f,_0x91ad('0x32'));_0x33b16c[_0x91ad('0x3a')]=_[_0x91ad('0x3b')](_0x550734[_0x91ad('0x3a')]);_0x33b16c[_0x91ad('0x3c')]=_['intersection'](_0x33b16c['model'],_0x33b16c[_0x91ad('0x3a')]);_0x3fde16['attributes']=_[_0x91ad('0x3d')](_0x33b16c['model'],qs['fields'](_0x550734[_0x91ad('0x3a')]['fields']));_0x3fde16['attributes']=_0x3fde16[_0x91ad('0x3e')][_0x91ad('0x3f')]?_0x3fde16['attributes']:_0x33b16c['model'];if(!_0x550734[_0x91ad('0x3a')][_0x91ad('0x40')](_0x91ad('0x41'))){_0x3fde16[_0x91ad('0x25')]=qs[_0x91ad('0x25')](_0x550734[_0x91ad('0x3a')][_0x91ad('0x25')]);_0x3fde16['offset']=qs[_0x91ad('0x23')](_0x550734[_0x91ad('0x3a')][_0x91ad('0x23')]);}_0x3fde16[_0x91ad('0x42')]=qs[_0x91ad('0x43')](_0x550734[_0x91ad('0x3a')][_0x91ad('0x43')]);_0x3fde16[_0x91ad('0x44')]=qs[_0x91ad('0x3c')](_[_0x91ad('0x45')](_0x550734[_0x91ad('0x3a')],_0x33b16c[_0x91ad('0x3c')]),_0x2c3e1f);if(_0x550734[_0x91ad('0x3a')][_0x91ad('0x46')]){_0x3fde16[_0x91ad('0x44')]=_[_0x91ad('0x47')](_0x3fde16['where'],{'$or':_['map'](_0x2c3e1f,function(_0x1d977e){if(_0x1d977e[_0x91ad('0x48')]!==_0x91ad('0x49')){var _0x55fda8={};_0x55fda8[_0x1d977e[_0x91ad('0x32')]]={'$like':'%'+_0x550734[_0x91ad('0x3a')][_0x91ad('0x46')]+'%'};return _0x55fda8;}})});}_0x3fde16=_[_0x91ad('0x47')]({},_0x3fde16,_0x550734['options']);var _0x1e826d={'where':_0x3fde16['where']};return db['FaxQueue'][_0x91ad('0x26')](_0x1e826d)[_0x91ad('0x2d')](function(_0x9bca9c){_0x35e488['count']=_0x9bca9c;if(_0x550734[_0x91ad('0x3a')]['includeAll']){_0x3fde16[_0x91ad('0x4a')]=[{'all':!![]}];}return db[_0x91ad('0x36')]['findAll'](_0x3fde16);})[_0x91ad('0x2d')](function(_0x498c36){_0x35e488['rows']=_0x498c36;return _0x35e488;})[_0x91ad('0x2d')](respondWithFilteredResult(_0x4e2a82,_0x3fde16))[_0x91ad('0x4b')](handleError(_0x4e2a82,null));};exports[_0x91ad('0x4c')]=function(_0x4fbe58,_0x406b75){var _0xfae35={'raw':!![],'where':{'id':_0x4fbe58[_0x91ad('0x4d')]['id']}},_0x507084={};_0x507084['model']=_[_0x91ad('0x3b')](db[_0x91ad('0x36')][_0x91ad('0x37')]);_0x507084[_0x91ad('0x3a')]=_[_0x91ad('0x3b')](_0x4fbe58[_0x91ad('0x3a')]);_0x507084[_0x91ad('0x3c')]=_[_0x91ad('0x3d')](_0x507084['model'],_0x507084[_0x91ad('0x3a')]);_0xfae35[_0x91ad('0x3e')]=_['intersection'](_0x507084['model'],qs[_0x91ad('0x4e')](_0x4fbe58['query'][_0x91ad('0x4e')]));_0xfae35[_0x91ad('0x3e')]=_0xfae35[_0x91ad('0x3e')][_0x91ad('0x3f')]?_0xfae35[_0x91ad('0x3e')]:_0x507084['model'];if(_0x4fbe58[_0x91ad('0x3a')]['includeAll']){_0xfae35[_0x91ad('0x4a')]=[{'all':!![]}];}_0xfae35=_[_0x91ad('0x47')]({},_0xfae35,_0x4fbe58[_0x91ad('0x4f')]);return db[_0x91ad('0x36')][_0x91ad('0x50')](_0xfae35)[_0x91ad('0x2d')](handleEntityNotFound(_0x406b75,null))[_0x91ad('0x2d')](respondWithResult(_0x406b75,null))['catch'](handleError(_0x406b75,null));};exports[_0x91ad('0x51')]=function(_0x1f3224,_0x2102e1){return db[_0x91ad('0x36')][_0x91ad('0x51')](_0x1f3224[_0x91ad('0x52')],{})[_0x91ad('0x2d')](function(_0x4876d8){var _0x154af3=_0x1f3224[_0x91ad('0x53')][_0x91ad('0x54')]({'plain':!![]});if(!_0x154af3)throw new Error(_0x91ad('0x55'));if(_0x154af3[_0x91ad('0x56')]===_0x91ad('0x53')){var _0x50cfbb=_0x4876d8['get']({'plain':!![]});var _0x212fe9=_0x91ad('0x57');return db[_0x91ad('0x58')][_0x91ad('0x50')]({'where':{'name':_0x212fe9,'userProfileId':_0x154af3[_0x91ad('0x59')]},'raw':!![]})[_0x91ad('0x2d')](function(_0x19fc5d){if(_0x19fc5d&&_0x19fc5d[_0x91ad('0x5a')]===0x0){return db[_0x91ad('0x5b')][_0x91ad('0x51')]({'name':_0x50cfbb[_0x91ad('0x32')],'resourceId':_0x50cfbb['id'],'type':_0x19fc5d[_0x91ad('0x32')],'sectionId':_0x19fc5d['id']},{})[_0x91ad('0x2d')](function(){return _0x4876d8;});}else{return _0x4876d8;}})[_0x91ad('0x4b')](function(_0x97dfb6){logger[_0x91ad('0x30')](_0x91ad('0x5c'),_0x97dfb6);throw _0x97dfb6;});}return _0x4876d8;})[_0x91ad('0x2d')](respondWithResult(_0x2102e1,0xc9))[_0x91ad('0x4b')](handleError(_0x2102e1,null));};exports[_0x91ad('0x2c')]=function(_0x5dbdaa,_0x4a9234){if(_0x5dbdaa['body']['id']){delete _0x5dbdaa[_0x91ad('0x52')]['id'];}return db['FaxQueue'][_0x91ad('0x50')]({'where':{'id':_0x5dbdaa[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x4a9234,null))[_0x91ad('0x2d')](saveUpdates(_0x5dbdaa[_0x91ad('0x52')],null))[_0x91ad('0x2d')](respondWithResult(_0x4a9234,null))[_0x91ad('0x4b')](handleError(_0x4a9234,null));};exports[_0x91ad('0x2e')]=function(_0x332ea6,_0x5da01f){return db['FaxQueue'][_0x91ad('0x50')]({'where':{'id':_0x332ea6['params']['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x5da01f,null))[_0x91ad('0x2d')](removeEntity(_0x5da01f,null))[_0x91ad('0x4b')](handleError(_0x5da01f,null));};exports[_0x91ad('0x5d')]=function(_0x4bf99e,_0x2e5614){return db[_0x91ad('0x36')][_0x91ad('0x5d')]()[_0x91ad('0x2d')](respondWithResult(_0x2e5614,null))[_0x91ad('0x4b')](handleError(_0x2e5614,null));};exports['getMembers']=function(_0x4cdcce,_0x34abe7,_0x1c9558){var _0x581b9={'raw':!![],'where':{}},_0x47f4d0={},_0x47fc03;return db[_0x91ad('0x36')][_0x91ad('0x5e')]({'where':{'id':_0x4cdcce[_0x91ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34abe7,null))['then'](function(_0x3aa4b5){if(_0x3aa4b5){_0x47fc03=_0x3aa4b5[_0x91ad('0x54')]({'plain':!![]});_0x47f4d0[_0x91ad('0x39')]=_[_0x91ad('0x3b')](db[_0x91ad('0x5f')]['rawAttributes']);_0x47f4d0[_0x91ad('0x3a')]=_[_0x91ad('0x3b')](_0x4cdcce[_0x91ad('0x3a')]);_0x47f4d0[_0x91ad('0x3c')]=_['intersection'](_0x47f4d0[_0x91ad('0x39')],_0x47f4d0[_0x91ad('0x3a')]);_0x581b9[_0x91ad('0x3e')]=_[_0x91ad('0x3d')](_0x47f4d0['model'],qs[_0x91ad('0x4e')](_0x4cdcce[_0x91ad('0x3a')][_0x91ad('0x4e')]));_0x581b9[_0x91ad('0x3e')]=_0x581b9[_0x91ad('0x3e')][_0x91ad('0x3f')]?_0x581b9['attributes']:_0x47f4d0[_0x91ad('0x39')];if(!_0x4cdcce[_0x91ad('0x3a')][_0x91ad('0x40')](_0x91ad('0x41'))){_0x581b9[_0x91ad('0x25')]=qs['limit'](_0x4cdcce[_0x91ad('0x3a')][_0x91ad('0x25')]);_0x581b9[_0x91ad('0x23')]=qs[_0x91ad('0x23')](_0x4cdcce[_0x91ad('0x3a')][_0x91ad('0x23')]);}_0x581b9['order']=qs[_0x91ad('0x43')](_0x4cdcce[_0x91ad('0x3a')]['sort']);_0x581b9[_0x91ad('0x44')]=qs['filters'](_[_0x91ad('0x45')](_0x4cdcce[_0x91ad('0x3a')],_0x47f4d0[_0x91ad('0x3c')]));_0x581b9[_0x91ad('0x44')][_0x91ad('0x60')]=_0x3aa4b5['id'];if(_0x4cdcce[_0x91ad('0x3a')][_0x91ad('0x46')]){_0x581b9[_0x91ad('0x44')]=_[_0x91ad('0x47')](_0x581b9[_0x91ad('0x44')],{'$or':_[_0x91ad('0x35')](_0x581b9[_0x91ad('0x3e')],function(_0x2ec493){var _0x2c36b8={};_0x2c36b8[_0x2ec493]={'$like':'%'+_0x4cdcce[_0x91ad('0x3a')]['filter']+'%'};return _0x2c36b8;})});}_0x581b9=_[_0x91ad('0x47')]({},_0x581b9,_0x4cdcce['options']);return db[_0x91ad('0x5f')][_0x91ad('0x61')](_0x581b9);}})['then'](function(_0x17ffe3){if(_0x17ffe3){return db[_0x91ad('0x62')][_0x91ad('0x63')]({'where':{'id':_['map'](_0x17ffe3,_0x91ad('0x64')),'role':_0x91ad('0x65')},'attributes':['id',_0x91ad('0x32'),_0x91ad('0x66'),_0x91ad('0x67'),_0x91ad('0x68')]});}})[_0x91ad('0x2d')](function(_0x2629d7){if(_0x2629d7){return{'count':_0x2629d7[_0x91ad('0x26')],'rows':_[_0x91ad('0x35')](_0x2629d7[_0x91ad('0x69')],function(_0x20f03b){return{'membername':_0x20f03b['name'],'UserId':_0x20f03b['id'],'queue_name':_0x47fc03[_0x91ad('0x32')],'FaxQueueId':_0x47fc03['id'],'interface':util[_0x91ad('0x6a')](_0x91ad('0x6b'),_0x91ad('0x6c'),_0x20f03b[_0x91ad('0x32')]),'penalty':0x0,'paused':_0x20f03b[_0x91ad('0x66')],'createdAt':_0x20f03b['createdAt'],'updatedAt':_0x20f03b[_0x91ad('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x91ad('0x2d')](respondWithFilteredResult(_0x34abe7,_0x581b9))[_0x91ad('0x4b')](handleError(_0x34abe7,null));};exports['getTeams']=function(_0x5e3e38,_0x49513c,_0x18f700){var _0x56320d={};var _0x17a066={};var _0x277ac4;var _0x4a9e27;return db['FaxQueue'][_0x91ad('0x5e')]({'where':{'id':_0x5e3e38[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x49513c,null))['then'](function(_0x2df1b1){if(_0x2df1b1){_0x277ac4=_0x2df1b1;_0x17a066[_0x91ad('0x39')]=_[_0x91ad('0x3b')](db[_0x91ad('0x6d')][_0x91ad('0x37')]);_0x17a066[_0x91ad('0x3a')]=_[_0x91ad('0x3b')](_0x5e3e38[_0x91ad('0x3a')]);_0x17a066[_0x91ad('0x3c')]=_[_0x91ad('0x3d')](_0x17a066[_0x91ad('0x39')],_0x17a066[_0x91ad('0x3a')]);_0x56320d['attributes']=_['intersection'](_0x17a066[_0x91ad('0x39')],qs[_0x91ad('0x4e')](_0x5e3e38['query'][_0x91ad('0x4e')]));_0x56320d['attributes']=_0x56320d['attributes'][_0x91ad('0x3f')]?_0x56320d[_0x91ad('0x3e')]:_0x17a066[_0x91ad('0x39')];_0x56320d['order']=qs[_0x91ad('0x43')](_0x5e3e38[_0x91ad('0x3a')][_0x91ad('0x43')]);_0x56320d[_0x91ad('0x44')]=qs[_0x91ad('0x3c')](_[_0x91ad('0x45')](_0x5e3e38[_0x91ad('0x3a')],_0x17a066[_0x91ad('0x3c')]));if(_0x5e3e38[_0x91ad('0x3a')][_0x91ad('0x46')]){_0x56320d[_0x91ad('0x44')]=_['merge'](_0x56320d[_0x91ad('0x44')],{'$or':_[_0x91ad('0x35')](_0x56320d['attributes'],function(_0x1c5ecd){var _0x39ac7a={};_0x39ac7a[_0x1c5ecd]={'$like':'%'+_0x5e3e38[_0x91ad('0x3a')][_0x91ad('0x46')]+'%'};return _0x39ac7a;})});}_0x56320d=_[_0x91ad('0x47')]({},_0x56320d,_0x5e3e38[_0x91ad('0x4f')]);return _0x277ac4['getTeams'](_0x56320d);}})[_0x91ad('0x2d')](function(_0x21d9c9){if(_0x21d9c9){_0x4a9e27=_0x21d9c9['length'];if(!_0x5e3e38['query'][_0x91ad('0x40')](_0x91ad('0x41'))){_0x56320d[_0x91ad('0x25')]=qs[_0x91ad('0x25')](_0x5e3e38[_0x91ad('0x3a')]['limit']);_0x56320d[_0x91ad('0x23')]=qs['offset'](_0x5e3e38[_0x91ad('0x3a')]['offset']);}return _0x277ac4[_0x91ad('0x6e')](_0x56320d);}})[_0x91ad('0x2d')](function(_0x354197){if(_0x354197){return _0x354197?{'count':_0x4a9e27,'rows':_0x354197}:null;}})[_0x91ad('0x2d')](respondWithResult(_0x49513c,null))[_0x91ad('0x4b')](handleError(_0x49513c,null));};exports['addTeams']=function(_0x4ea324,_0x3cde1b,_0x4d48f8){var _0x419050=_0x4ea324['body'][_0x91ad('0x6f')];return db[_0x91ad('0x6d')][_0x91ad('0x61')]({'where':{'id':_0x419050},'attributes':['id'],'include':[{'model':db[_0x91ad('0x62')],'as':_0x91ad('0x70'),'attributes':['id',_0x91ad('0x32'),'online','voicePause',_0x91ad('0x71')],'raw':!![]}]})[_0x91ad('0x2d')](function(_0x5c3922){if(_0x5c3922){var _0x518fbf=_[_0x91ad('0x72')](_0x5c3922,function(_0xf5b587){var _0x37c005=_0xf5b587[_0x91ad('0x54')]({'plain':!![]});return _0x37c005[_0x91ad('0x70')];});return db['FaxQueue'][_0x91ad('0x50')]({'where':{'id':_0x4ea324[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](function(_0x5aeb89){return db[_0x91ad('0x73')][_0x91ad('0x74')](function(_0x880714){return _0x5aeb89['addTeams'](_0x419050,{'transaction':_0x880714})['then'](function(){return BPromise[_0x91ad('0x75')](_0x518fbf,function(_0x427dae){return db[_0x91ad('0x5f')][_0x91ad('0x76')]({'where':{'UserId':_0x427dae['id'],'FaxQueueId':_0x4ea324[_0x91ad('0x4d')]['id']},'transaction':_0x880714});});})[_0x91ad('0x2d')](function(){_0x518fbf[_0x91ad('0x77')](function(_0x2adb31){socket[_0x91ad('0x78')](_0x91ad('0x79'),{'UserId':_0x2adb31['id'],'FaxQueueId':_0x5aeb89['id']});});});});});}})[_0x91ad('0x2d')](respondWithStatusCode(_0x3cde1b,null))[_0x91ad('0x4b')](handleError(_0x3cde1b,null));};exports[_0x91ad('0x7a')]=function(_0x147f58,_0x1c78ae,_0x2e57bf){return db[_0x91ad('0x6d')][_0x91ad('0x61')]({'where':{'id':_0x147f58[_0x91ad('0x3a')][_0x91ad('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x91ad('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c78ae,null))['then'](function(_0x3e4b7f){var _0x468e5c=_[_0x91ad('0x35')](_0x3e4b7f,'id');var _0x25c084=[];var _0x3b2edd=[];var _0x5ab161=squel[_0x91ad('0x7b')]();_0x5ab161[_0x91ad('0x7c')](_0x91ad('0x7d'))['from']('team_has_fax_queues','tq')[_0x91ad('0x7e')](_0x91ad('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91ad('0x44')](_0x91ad('0x80'),_0x147f58[_0x91ad('0x4d')]['id']);for(var _0xa25118=0x0;_0xa25118<_0x3e4b7f[_0x91ad('0x3f')];_0xa25118+=0x1){let _0x4f65cf=_0x3e4b7f[_0xa25118];for(var _0x33c6ce=0x0;_0x33c6ce<_0x4f65cf[_0x91ad('0x70')][_0x91ad('0x3f')];_0x33c6ce+=0x1){let _0x86576d=_0x4f65cf[_0x91ad('0x70')][_0x33c6ce];var _0x1b0b66=_0x5ab161[_0x91ad('0x81')]();_0x1b0b66[_0x91ad('0x44')]('ut.UserId\x20=\x20?',_0x86576d['id']);_0x3b2edd[_0x91ad('0x82')](db[_0x91ad('0x73')]['query'](_0x1b0b66[_0x91ad('0x83')](),{'type':db[_0x91ad('0x73')][_0x91ad('0x84')][_0x91ad('0x85')]})[_0x91ad('0x2d')](function(_0x4d58d0){if(_0x4d58d0[_0x91ad('0x3f')]===0x1){return _0x86576d['id'];}else{var _0xcf33be=_[_0x91ad('0x86')](_['map'](_0x4d58d0,_0x91ad('0x87')),function(_0x1a79d7){return _['includes'](_0x468e5c,_0x1a79d7);});if(_0xcf33be){return _0x86576d['id'];}}}));}}return BPromise['all'](_0x3b2edd)[_0x91ad('0x2d')](function(_0x36d32e){_0x25c084=_(_0x25c084)[_0x91ad('0x88')](_0x36d32e)[_0x91ad('0x89')]()[_0x91ad('0x8a')]();return db['FaxQueue'][_0x91ad('0x50')]({'where':{'id':_0x147f58[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](function(_0x42478c){return db[_0x91ad('0x73')][_0x91ad('0x74')](function(_0x262855){return _0x42478c[_0x91ad('0x7a')](_0x147f58[_0x91ad('0x3a')][_0x91ad('0x6f')],{'transaction':_0x262855})['then'](function(){if(!_[_0x91ad('0x8b')](_0x25c084)){return _0x42478c[_0x91ad('0x8c')](_0x25c084,{'transaction':_0x262855});}})['then'](function(){_0x25c084['forEach'](function(_0x344b74){socket[_0x91ad('0x78')]('userFaxQueue:remove',{'UserId':_0x344b74,'FaxQueueId':_0x42478c['id']});});});});});});})[_0x91ad('0x2d')](respondWithStatusCode(_0x1c78ae,null))[_0x91ad('0x4b')](handleError(_0x1c78ae,null));};exports[_0x91ad('0x8d')]=function(_0x5a904f,_0x1d666f,_0x3dec17){return db[_0x91ad('0x36')][_0x91ad('0x50')]({'where':{'id':_0x5a904f[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x1d666f,null))[_0x91ad('0x2d')](function(_0x12c0b2){if(_0x12c0b2){return _0x12c0b2['addAgents'](_0x5a904f['body'][_0x91ad('0x6f')],_['omit'](_0x5a904f[_0x91ad('0x52')],[_0x91ad('0x6f'),'id'])||{})['spread'](function(_0x40737e){for(var _0xecc12b=0x0;_0xecc12b<_0x5a904f[_0x91ad('0x52')][_0x91ad('0x6f')][_0x91ad('0x3f')];_0xecc12b+=0x1){socket[_0x91ad('0x78')]('userFaxQueue:save',{'UserId':Number(_0x5a904f['body'][_0x91ad('0x6f')][_0xecc12b]),'FaxQueueId':Number(_0x5a904f[_0x91ad('0x4d')]['id'])});}return _0x40737e;});}})[_0x91ad('0x2d')](respondWithResult(_0x1d666f,null))[_0x91ad('0x4b')](handleError(_0x1d666f,null));};exports['removeAgents']=function(_0x41ef09,_0x527746,_0x2eab79){return db[_0x91ad('0x36')][_0x91ad('0x50')]({'where':{'id':_0x41ef09[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x527746,null))[_0x91ad('0x2d')](function(_0x1f4038){if(_0x1f4038){return _0x1f4038[_0x91ad('0x8c')](_0x41ef09[_0x91ad('0x3a')]['ids'])[_0x91ad('0x2d')](function(){if(_[_0x91ad('0x8e')](_0x41ef09['query'][_0x91ad('0x6f')])){for(var _0x2d8789=0x0;_0x2d8789<_0x41ef09[_0x91ad('0x3a')]['ids'][_0x91ad('0x3f')];_0x2d8789+=0x1){socket[_0x91ad('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x41ef09[_0x91ad('0x3a')][_0x91ad('0x6f')][_0x2d8789]),'FaxQueueId':Number(_0x41ef09[_0x91ad('0x4d')]['id'])});}}else{socket[_0x91ad('0x78')](_0x91ad('0x8f'),{'UserId':Number(_0x41ef09[_0x91ad('0x3a')]['ids']),'FaxQueueId':Number(_0x41ef09['params']['id'])});}});}})[_0x91ad('0x2d')](respondWithStatusCode(_0x527746,null))[_0x91ad('0x4b')](handleError(_0x527746,null));};exports[_0x91ad('0x90')]=function(_0x49206d,_0x3b3016,_0x214d48){var _0x3b4215={};var _0x433472={};var _0x4f64d8;var _0x5ee30d;return db[_0x91ad('0x36')]['findOne']({'where':{'id':_0x49206d[_0x91ad('0x4d')]['id']}})[_0x91ad('0x2d')](handleEntityNotFound(_0x3b3016,null))[_0x91ad('0x2d')](function(_0x1a1e54){if(_0x1a1e54){_0x4f64d8=_0x1a1e54;_0x433472[_0x91ad('0x39')]=_[_0x91ad('0x3b')](db[_0x91ad('0x62')][_0x91ad('0x37')]);_0x433472[_0x91ad('0x3a')]=_[_0x91ad('0x3b')](_0x49206d[_0x91ad('0x3a')]);_0x433472[_0x91ad('0x3c')]=_[_0x91ad('0x3d')](_0x433472[_0x91ad('0x39')],_0x433472[_0x91ad('0x3a')]);_0x3b4215[_0x91ad('0x3e')]=_[_0x91ad('0x3d')](_0x433472[_0x91ad('0x39')],qs[_0x91ad('0x4e')](_0x49206d[_0x91ad('0x3a')]['fields']));_0x3b4215[_0x91ad('0x3e')]=_0x3b4215[_0x91ad('0x3e')]['length']?_0x3b4215[_0x91ad('0x3e')]:_0x433472[_0x91ad('0x39')];_0x3b4215[_0x91ad('0x42')]=qs['sort'](_0x49206d[_0x91ad('0x3a')]['sort']);_0x3b4215[_0x91ad('0x44')]=qs[_0x91ad('0x3c')](_[_0x91ad('0x45')](_0x49206d[_0x91ad('0x3a')],_0x433472['filters']));if(_0x49206d[_0x91ad('0x3a')][_0x91ad('0x46')]){_0x3b4215[_0x91ad('0x44')]=_[_0x91ad('0x47')](_0x3b4215[_0x91ad('0x44')],{'$or':_['map'](_0x3b4215[_0x91ad('0x3e')],function(_0x537870){var _0xb1fde={};_0xb1fde[_0x537870]={'$like':'%'+_0x49206d[_0x91ad('0x3a')][_0x91ad('0x46')]+'%'};return _0xb1fde;})});}_0x3b4215=_[_0x91ad('0x47')]({},_0x3b4215,_0x49206d['options']);return _0x4f64d8['getAgents'](_0x3b4215);}})[_0x91ad('0x2d')](function(_0x1f0d68){if(_0x1f0d68){_0x5ee30d=_0x1f0d68[_0x91ad('0x3f')];if(!_0x49206d[_0x91ad('0x3a')][_0x91ad('0x40')](_0x91ad('0x41'))){_0x3b4215[_0x91ad('0x25')]=qs[_0x91ad('0x25')](_0x49206d[_0x91ad('0x3a')][_0x91ad('0x25')]);_0x3b4215[_0x91ad('0x23')]=qs[_0x91ad('0x23')](_0x49206d[_0x91ad('0x3a')][_0x91ad('0x23')]);}return _0x4f64d8['getAgents'](_0x3b4215);}})[_0x91ad('0x2d')](function(_0x487192){if(_0x487192){return _0x487192?{'count':_0x5ee30d,'rows':_0x487192}:null;}})[_0x91ad('0x2d')](respondWithResult(_0x3b3016,null))[_0x91ad('0x4b')](handleError(_0x3b3016,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 710a0e6..692399a 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 _0x5ab9=['emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','update','remove'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x5ab9,0x8b));var _0x95ab=function(_0xde0a7f,_0x33437f){_0xde0a7f=_0xde0a7f-0x0;var _0x1b5b69=_0x5ab9[_0xde0a7f];return _0x1b5b69;};'use strict';var EventEmitter=require(_0x95ab('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x95ab('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x95ab('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95ab('0x3'),'afterDestroy':_0x95ab('0x4')};function emitEvent(_0x526f56){return function(_0x19b406,_0x280b73,_0x1f4260){FaxQueueEvents[_0x95ab('0x5')](_0x526f56+':'+_0x19b406['id'],_0x19b406);FaxQueueEvents[_0x95ab('0x5')](_0x526f56,_0x19b406);_0x1f4260(null);};}for(var e in events){if(events[_0x95ab('0x6')](e)){var event=events[e];FaxQueue[_0x95ab('0x7')](e,emitEvent(event));}}module[_0x95ab('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x63bb=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','save','update'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x63bb,0x1ab));var _0xb63b=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x63bb[_0x44bcb0];return _0xfaf881;};'use strict';var EventEmitter=require(_0xb63b('0x0'));var FaxQueue=require(_0xb63b('0x1'))['db'][_0xb63b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb63b('0x3'),'afterUpdate':_0xb63b('0x4'),'afterDestroy':_0xb63b('0x5')};function emitEvent(_0x4cf560){return function(_0x3b92be,_0x246b86,_0x32b28c){FaxQueueEvents[_0xb63b('0x6')](_0x4cf560+':'+_0x3b92be['id'],_0x3b92be);FaxQueueEvents[_0xb63b('0x6')](_0x4cf560,_0x3b92be);_0x32b28c(null);};}for(var e in events){if(events[_0xb63b('0x7')](e)){var event=events[e];FaxQueue[_0xb63b('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 37a7d6c..729c817 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 _0x3d9e=['../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x92979e,_0xc9d8f1){var _0x10a6f6=function(_0x45e5ae){while(--_0x45e5ae){_0x92979e['push'](_0x92979e['shift']());}};_0x10a6f6(++_0xc9d8f1);}(_0x3d9e,0xe5));var _0xe3d9=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x3d9e[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0xe3d9('0x0'));var util=require(_0xe3d9('0x1'));var logger=require(_0xe3d9('0x2'))(_0xe3d9('0x3'));var moment=require(_0xe3d9('0x4'));var BPromise=require(_0xe3d9('0x5'));var rp=require(_0xe3d9('0x6'));var fs=require('fs');var path=require(_0xe3d9('0x7'));var rimraf=require(_0xe3d9('0x8'));var config=require(_0xe3d9('0x9'));var attributes=require(_0xe3d9('0xa'));module[_0xe3d9('0xb')]=function(_0x2e27f2,_0x5d2565){return _0x2e27f2[_0xe3d9('0xc')]('FaxQueue',attributes,{'tableName':_0xe3d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44fb=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x44fb,0xad));var _0xb44f=function(_0x3dae09,_0x1cc0be){_0x3dae09=_0x3dae09-0x0;var _0x586f75=_0x44fb[_0x3dae09];return _0x586f75;};'use strict';var _=require(_0xb44f('0x0'));var util=require(_0xb44f('0x1'));var logger=require(_0xb44f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb44f('0x3'));var rp=require(_0xb44f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb44f('0x5'));var config=require(_0xb44f('0x6'));var attributes=require(_0xb44f('0x7'));module[_0xb44f('0x8')]=function(_0x2fdd65,_0x54a577){return _0x2fdd65[_0xb44f('0x9')](_0xb44f('0xa'),attributes,{'tableName':_0xb44f('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 ea987f4..c554ccb 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 _0xb2fc=['register','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetFaxQueue','FaxQueue','findAll','options','raw','include','map','model','attributes','then','debug','catch','where','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket'];(function(_0x13c440,_0xa53eb6){var _0x116c16=function(_0x48fc69){while(--_0x48fc69){_0x13c440['push'](_0x13c440['shift']());}};_0x116c16(++_0xa53eb6);}(_0xb2fc,0x136));var _0xcb2f=function(_0x22cf1d,_0x2e4fc0){_0x22cf1d=_0x22cf1d-0x0;var _0x5f431f=_0xb2fc[_0x22cf1d];return _0x5f431f;};'use strict';var _=require(_0xcb2f('0x0'));var util=require(_0xcb2f('0x1'));var moment=require(_0xcb2f('0x2'));var BPromise=require(_0xcb2f('0x3'));var rs=require(_0xcb2f('0x4'));var fs=require('fs');var Redis=require(_0xcb2f('0x5'));var db=require(_0xcb2f('0x6'))['db'];var utils=require(_0xcb2f('0x7'));var logger=require(_0xcb2f('0x8'))(_0xcb2f('0x9'));var config=require(_0xcb2f('0xa'));var jayson=require(_0xcb2f('0xb'));var client=jayson[_0xcb2f('0xc')][_0xcb2f('0xd')]({'port':0x232a});config[_0xcb2f('0xe')]=_[_0xcb2f('0xf')](config[_0xcb2f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xcb2f('0x10'))(new Redis(config[_0xcb2f('0xe')]));require(_0xcb2f('0x11'))[_0xcb2f('0x12')](socket);function respondWithRpcPromise(_0x23de99,_0x237a70,_0x5174c2){return new BPromise(function(_0x2b2b71,_0x2eb531){return client['request'](_0x23de99,_0x5174c2)['then'](function(_0x1f0d3f){logger[_0xcb2f('0x13')](_0xcb2f('0x14'),_0x237a70,'request\x20sent');logger['debug'](_0xcb2f('0x15'),_0x237a70,'request\x20sent',JSON[_0xcb2f('0x16')](_0x1f0d3f));if(_0x1f0d3f['error']){if(_0x1f0d3f[_0xcb2f('0x17')]['code']===0x1f4){logger[_0xcb2f('0x17')](_0xcb2f('0x14'),_0x237a70,_0x1f0d3f[_0xcb2f('0x17')]['message']);return _0x2eb531(_0x1f0d3f[_0xcb2f('0x17')]['message']);}logger['error'](_0xcb2f('0x14'),_0x237a70,_0x1f0d3f[_0xcb2f('0x17')][_0xcb2f('0x18')]);return _0x2b2b71(_0x1f0d3f[_0xcb2f('0x17')][_0xcb2f('0x18')]);}else{logger[_0xcb2f('0x13')]('FaxQueue,\x20%s,\x20%s',_0x237a70,_0xcb2f('0x19'));_0x2b2b71(_0x1f0d3f[_0xcb2f('0x1a')][_0xcb2f('0x18')]);}})['catch'](function(_0x226b26){logger['error'](_0xcb2f('0x14'),_0x237a70,_0x226b26);_0x2eb531(_0x226b26);});});}exports[_0xcb2f('0x1b')]=function(_0x470035){var _0x3bdeab=this;return new Promise(function(_0x18cc52,_0x481ae8){return db[_0xcb2f('0x1c')][_0xcb2f('0x1d')]({'raw':_0x470035['options']?_0x470035[_0xcb2f('0x1e')][_0xcb2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x470035[_0xcb2f('0x1e')]?_0x470035[_0xcb2f('0x1e')]['where']||null:null,'attributes':_0x470035[_0xcb2f('0x1e')]?_0x470035['options']['attributes']||null:null,'limit':_0x470035[_0xcb2f('0x1e')]?_0x470035['options']['limit']||null:null,'include':_0x470035[_0xcb2f('0x1e')]?_0x470035['options'][_0xcb2f('0x20')]?_['map'](_0x470035['options'][_0xcb2f('0x20')],function(_0x44c910){return{'model':db[_0x44c910['model']],'as':_0x44c910['as'],'attributes':_0x44c910['attributes'],'include':_0x44c910[_0xcb2f('0x20')]?_[_0xcb2f('0x21')](_0x44c910[_0xcb2f('0x20')],function(_0xbf4fd6){return{'model':db[_0xbf4fd6[_0xcb2f('0x22')]],'as':_0xbf4fd6['as'],'attributes':_0xbf4fd6[_0xcb2f('0x23')],'include':_0xbf4fd6[_0xcb2f('0x20')]?_[_0xcb2f('0x21')](_0xbf4fd6[_0xcb2f('0x20')],function(_0x36f381){return{'model':db[_0x36f381['model']],'as':_0x36f381['as'],'attributes':_0x36f381[_0xcb2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcb2f('0x24')](function(_0x5be69a){logger[_0xcb2f('0x13')](_0xcb2f('0x1b'),_0x470035);logger[_0xcb2f('0x25')]('GetFaxQueue',_0x470035,JSON[_0xcb2f('0x16')](_0x5be69a));_0x18cc52(_0x5be69a);})[_0xcb2f('0x26')](function(_0x15b7c5){logger[_0xcb2f('0x17')](_0xcb2f('0x1b'),_0x15b7c5['message'],_0x470035);_0x481ae8(_0x3bdeab[_0xcb2f('0x17')](0x1f4,_0x15b7c5[_0xcb2f('0x18')]));});});};exports['ShowFaxQueue']=function(_0x4db63e){var _0x1cfe17=this;return new Promise(function(_0x2575e4,_0x2f0a8b){return db['FaxQueue']['find']({'raw':_0x4db63e[_0xcb2f('0x1e')]?_0x4db63e['options'][_0xcb2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4db63e[_0xcb2f('0x1e')]?_0x4db63e['options'][_0xcb2f('0x27')]||null:null,'attributes':_0x4db63e[_0xcb2f('0x1e')]?_0x4db63e[_0xcb2f('0x1e')][_0xcb2f('0x23')]||null:null,'include':_0x4db63e[_0xcb2f('0x1e')]?_0x4db63e[_0xcb2f('0x1e')][_0xcb2f('0x20')]?_['map'](_0x4db63e[_0xcb2f('0x1e')][_0xcb2f('0x20')],function(_0x1ab621){return{'model':db[_0x1ab621['model']],'as':_0x1ab621['as'],'attributes':_0x1ab621['attributes'],'include':_0x1ab621['include']?_[_0xcb2f('0x21')](_0x1ab621['include'],function(_0x150959){return{'model':db[_0x150959['model']],'as':_0x150959['as'],'attributes':_0x150959[_0xcb2f('0x23')],'include':_0x150959[_0xcb2f('0x20')]?_[_0xcb2f('0x21')](_0x150959[_0xcb2f('0x20')],function(_0x2d759d){return{'model':db[_0x2d759d['model']],'as':_0x2d759d['as'],'attributes':_0x2d759d[_0xcb2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcb2f('0x24')](function(_0x5f4ea1){logger['info'](_0xcb2f('0x28'),_0x4db63e);logger[_0xcb2f('0x25')](_0xcb2f('0x28'),_0x4db63e,JSON[_0xcb2f('0x16')](_0x5f4ea1));_0x2575e4(_0x5f4ea1);})['catch'](function(_0xaefa11){logger[_0xcb2f('0x17')]('ShowFaxQueue',_0xaefa11[_0xcb2f('0x18')],_0x4db63e);_0x2f0a8b(_0x1cfe17[_0xcb2f('0x17')](0x1f4,_0xaefa11[_0xcb2f('0x18')]));});});}; \ No newline at end of file +var _0xa9a2=['stringify','ShowFaxQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xa9a2,0x77));var _0x2a9a=function(_0x288e34,_0x102f3a){_0x288e34=_0x288e34-0x0;var _0xa96660=_0xa9a2[_0x288e34];return _0xa96660;};'use strict';var _=require('lodash');var util=require(_0x2a9a('0x0'));var moment=require('moment');var BPromise=require(_0x2a9a('0x1'));var rs=require(_0x2a9a('0x2'));var fs=require('fs');var Redis=require(_0x2a9a('0x3'));var db=require(_0x2a9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a9a('0x5'))(_0x2a9a('0x6'));var config=require(_0x2a9a('0x7'));var jayson=require(_0x2a9a('0x8'));var client=jayson[_0x2a9a('0x9')]['http']({'port':0x232a});config[_0x2a9a('0xa')]=_[_0x2a9a('0xb')](config[_0x2a9a('0xa')],{'host':_0x2a9a('0xc'),'port':0x18eb});var socket=require(_0x2a9a('0xd'))(new Redis(config[_0x2a9a('0xa')]));require(_0x2a9a('0xe'))[_0x2a9a('0xf')](socket);function respondWithRpcPromise(_0x298696,_0x5f16c2,_0x4b1696){return new BPromise(function(_0xd84ad0,_0x3cecc4){return client['request'](_0x298696,_0x4b1696)['then'](function(_0x35a9a3){logger[_0x2a9a('0x10')]('FaxQueue,\x20%s,\x20%s',_0x5f16c2,_0x2a9a('0x11'));logger[_0x2a9a('0x12')](_0x2a9a('0x13'),_0x5f16c2,_0x2a9a('0x11'),JSON['stringify'](_0x35a9a3));if(_0x35a9a3[_0x2a9a('0x14')]){if(_0x35a9a3[_0x2a9a('0x14')][_0x2a9a('0x15')]===0x1f4){logger[_0x2a9a('0x14')](_0x2a9a('0x16'),_0x5f16c2,_0x35a9a3[_0x2a9a('0x14')][_0x2a9a('0x17')]);return _0x3cecc4(_0x35a9a3['error'][_0x2a9a('0x17')]);}logger[_0x2a9a('0x14')](_0x2a9a('0x16'),_0x5f16c2,_0x35a9a3[_0x2a9a('0x14')]['message']);return _0xd84ad0(_0x35a9a3[_0x2a9a('0x14')]['message']);}else{logger[_0x2a9a('0x10')](_0x2a9a('0x16'),_0x5f16c2,_0x2a9a('0x11'));_0xd84ad0(_0x35a9a3[_0x2a9a('0x18')]['message']);}})[_0x2a9a('0x19')](function(_0x18cb63){logger[_0x2a9a('0x14')](_0x2a9a('0x16'),_0x5f16c2,_0x18cb63);_0x3cecc4(_0x18cb63);});});}exports['GetFaxQueue']=function(_0x31d86a){var _0x46b375=this;return new Promise(function(_0x592146,_0xbcb5ec){return db[_0x2a9a('0x1a')]['findAll']({'raw':_0x31d86a[_0x2a9a('0x1b')]?_0x31d86a['options'][_0x2a9a('0x1c')]===undefined?!![]:![]:!![],'where':_0x31d86a[_0x2a9a('0x1b')]?_0x31d86a['options'][_0x2a9a('0x1d')]||null:null,'attributes':_0x31d86a[_0x2a9a('0x1b')]?_0x31d86a[_0x2a9a('0x1b')][_0x2a9a('0x1e')]||null:null,'limit':_0x31d86a[_0x2a9a('0x1b')]?_0x31d86a[_0x2a9a('0x1b')][_0x2a9a('0x1f')]||null:null,'include':_0x31d86a[_0x2a9a('0x1b')]?_0x31d86a[_0x2a9a('0x1b')][_0x2a9a('0x20')]?_[_0x2a9a('0x21')](_0x31d86a[_0x2a9a('0x1b')]['include'],function(_0x1d1e82){return{'model':db[_0x1d1e82[_0x2a9a('0x22')]],'as':_0x1d1e82['as'],'attributes':_0x1d1e82[_0x2a9a('0x1e')],'include':_0x1d1e82['include']?_['map'](_0x1d1e82[_0x2a9a('0x20')],function(_0x686d77){return{'model':db[_0x686d77[_0x2a9a('0x22')]],'as':_0x686d77['as'],'attributes':_0x686d77['attributes'],'include':_0x686d77[_0x2a9a('0x20')]?_[_0x2a9a('0x21')](_0x686d77[_0x2a9a('0x20')],function(_0x1c00a9){return{'model':db[_0x1c00a9['model']],'as':_0x1c00a9['as'],'attributes':_0x1c00a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a9a('0x23')](function(_0x2d72d5){logger[_0x2a9a('0x10')](_0x2a9a('0x24'),_0x31d86a);logger['debug'](_0x2a9a('0x24'),_0x31d86a,JSON[_0x2a9a('0x25')](_0x2d72d5));_0x592146(_0x2d72d5);})['catch'](function(_0x36de87){logger['error'](_0x2a9a('0x24'),_0x36de87['message'],_0x31d86a);_0xbcb5ec(_0x46b375['error'](0x1f4,_0x36de87[_0x2a9a('0x17')]));});});};exports['ShowFaxQueue']=function(_0x5cb8d3){var _0x444e80=this;return new Promise(function(_0x54f56c,_0x40f1da){return db[_0x2a9a('0x1a')]['find']({'raw':_0x5cb8d3[_0x2a9a('0x1b')]?_0x5cb8d3[_0x2a9a('0x1b')][_0x2a9a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cb8d3['options']?_0x5cb8d3['options'][_0x2a9a('0x1d')]||null:null,'attributes':_0x5cb8d3['options']?_0x5cb8d3[_0x2a9a('0x1b')]['attributes']||null:null,'include':_0x5cb8d3[_0x2a9a('0x1b')]?_0x5cb8d3[_0x2a9a('0x1b')][_0x2a9a('0x20')]?_[_0x2a9a('0x21')](_0x5cb8d3[_0x2a9a('0x1b')][_0x2a9a('0x20')],function(_0x489fad){return{'model':db[_0x489fad[_0x2a9a('0x22')]],'as':_0x489fad['as'],'attributes':_0x489fad[_0x2a9a('0x1e')],'include':_0x489fad[_0x2a9a('0x20')]?_[_0x2a9a('0x21')](_0x489fad['include'],function(_0x2afe5e){return{'model':db[_0x2afe5e['model']],'as':_0x2afe5e['as'],'attributes':_0x2afe5e[_0x2a9a('0x1e')],'include':_0x2afe5e[_0x2a9a('0x20')]?_[_0x2a9a('0x21')](_0x2afe5e[_0x2a9a('0x20')],function(_0x5a8a9a){return{'model':db[_0x5a8a9a['model']],'as':_0x5a8a9a['as'],'attributes':_0x5a8a9a[_0x2a9a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2a9a('0x23')](function(_0x23f711){logger[_0x2a9a('0x10')]('ShowFaxQueue',_0x5cb8d3);logger[_0x2a9a('0x12')](_0x2a9a('0x26'),_0x5cb8d3,JSON[_0x2a9a('0x25')](_0x23f711));_0x54f56c(_0x23f711);})[_0x2a9a('0x19')](function(_0x1a6c1f){logger[_0x2a9a('0x14')](_0x2a9a('0x26'),_0x1a6c1f[_0x2a9a('0x17')],_0x5cb8d3);_0x40f1da(_0x444e80[_0x2a9a('0x14')](0x1f4,_0x1a6c1f[_0x2a9a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ca9976e..b4767ca 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 _0x6f58=['register','length','./faxQueue.events','save','remove','update'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x6f58,0xaa));var _0x86f5=function(_0x2d67bd,_0x4a9301){_0x2d67bd=_0x2d67bd-0x0;var _0x397280=_0x6f58[_0x2d67bd];return _0x397280;};'use strict';var FaxQueueEvents=require(_0x86f5('0x0'));var events=[_0x86f5('0x1'),_0x86f5('0x2'),_0x86f5('0x3')];function createListener(_0x332121,_0x5ab0e7){return function(_0x5e2c22){_0x5ab0e7['emit'](_0x332121,_0x5e2c22);};}function removeListener(_0x31e6f7,_0x27ac98){return function(){FaxQueueEvents['removeListener'](_0x31e6f7,_0x27ac98);};}exports[_0x86f5('0x4')]=function(_0xbf28d0){for(var _0x3bba85=0x0,_0x5149ad=events[_0x86f5('0x5')];_0x3bba85<_0x5149ad;_0x3bba85++){var _0x11933e=events[_0x3bba85];var _0x56910b=createListener('faxQueue:'+_0x11933e,_0xbf28d0);FaxQueueEvents['on'](_0x11933e,_0x56910b);}}; \ No newline at end of file +var _0xd8ca=['./faxQueue.events','save','remove','update','emit','removeListener','register','faxQueue:'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xd8ca,0x178));var _0xad8c=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xd8ca[_0x378b4];return _0x11d07b;};'use strict';var FaxQueueEvents=require(_0xad8c('0x0'));var events=[_0xad8c('0x1'),_0xad8c('0x2'),_0xad8c('0x3')];function createListener(_0x4037fd,_0x4ff226){return function(_0x3dca89){_0x4ff226[_0xad8c('0x4')](_0x4037fd,_0x3dca89);};}function removeListener(_0x1ab60b,_0x541d0c){return function(){FaxQueueEvents[_0xad8c('0x5')](_0x1ab60b,_0x541d0c);};}exports[_0xad8c('0x6')]=function(_0x1657ae){for(var _0x1c8353=0x0,_0xabc45c=events['length'];_0x1c8353<_0xabc45c;_0x1c8353++){var _0x1dc270=events[_0x1c8353];var _0x5d84d7=createListener(_0xad8c('0x7')+_0x1dc270,_0x1657ae);FaxQueueEvents['on'](_0x1dc270,_0x5d84d7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d866516..d84e77f 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 _0x2c8f=['isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','delete','destroy','removeTeams','exports','util','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get'];(function(_0x5c3cbd,_0x5ddfcd){var _0xdf0617=function(_0x493009){while(--_0x493009){_0x5c3cbd['push'](_0x5c3cbd['shift']());}};_0xdf0617(++_0x5ddfcd);}(_0x2c8f,0x192));var _0xf2c8=function(_0x2d7089,_0x213af9){_0x2d7089=_0x2d7089-0x0;var _0x20ee25=_0x2c8f[_0x2d7089];return _0x20ee25;};'use strict';var multer=require('multer');var util=require(_0xf2c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2c8('0x1')]();var fs_extra=require(_0xf2c8('0x2'));var auth=require(_0xf2c8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2c8('0x4'));router[_0xf2c8('0x5')]('/',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x7')]);router[_0xf2c8('0x5')]('/describe',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x8')]);router[_0xf2c8('0x5')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xa')]);router['get'](_0xf2c8('0xb'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xc')]);router[_0xf2c8('0x5')](_0xf2c8('0xd'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xe')]);router[_0xf2c8('0x5')]('/:id/users',auth[_0xf2c8('0x6')](),controller['getAgents']);router[_0xf2c8('0xf')]('/',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x10')]);router[_0xf2c8('0xf')](_0xf2c8('0xd'),auth[_0xf2c8('0x6')](),controller['addTeams']);router[_0xf2c8('0xf')](_0xf2c8('0x11'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x12')]);router[_0xf2c8('0x13')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller['update']);router[_0xf2c8('0x14')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x15')]);router[_0xf2c8('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf2c8('0x16')]);router[_0xf2c8('0x14')](_0xf2c8('0x11'),auth[_0xf2c8('0x6')](),controller['removeAgents']);module[_0xf2c8('0x17')]=router; \ No newline at end of file +var _0xadb5=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x603c9e,_0x203942){var _0x3af2f2=function(_0x1f2177){while(--_0x1f2177){_0x603c9e['push'](_0x603c9e['shift']());}};_0x3af2f2(++_0x203942);}(_0xadb5,0xad));var _0x5adb=function(_0x57fee2,_0x5be509){_0x57fee2=_0x57fee2-0x0;var _0x1cb649=_0xadb5[_0x57fee2];return _0x1cb649;};'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('./faxQueue.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getMembers']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')]('/:id/users',auth[_0x5adb('0x8')](),controller['addAgents']);router[_0x5adb('0x16')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x18')]('/:id/teams',auth[_0x5adb('0x8')](),controller['removeTeams']);router[_0x5adb('0x18')]('/:id/users',auth[_0x5adb('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 31d8228..1687da0 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 _0x39e0=['exports','STRING','DATE'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x39e0,0x1c5));var _0x039e=function(_0x4552ae,_0x4783e3){_0x4552ae=_0x4552ae-0x0;var _0x4af521=_0x39e0[_0x4552ae];return _0x4af521;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x039e('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x039e('0x1')]},'joinAt':{'type':Sequelize[_0x039e('0x2')]},'leaveAt':{'type':Sequelize[_0x039e('0x2')]},'acceptAt':{'type':Sequelize[_0x039e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x039e('0x1')]}}; \ No newline at end of file +var _0xe6ec=['moment','sequelize','exports','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe6ec,0x1cc));var _0xce6e=function(_0x4cc19b,_0x1a2a73){_0x4cc19b=_0x4cc19b-0x0;var _0x439243=_0xe6ec[_0x4cc19b];return _0x439243;};'use strict';var moment=require(_0xce6e('0x0'));var Sequelize=require(_0xce6e('0x1'));module[_0xce6e('0x2')]={'uniqueid':{'type':Sequelize[_0xce6e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xce6e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xce6e('0x4')]},'acceptAt':{'type':Sequelize[_0xce6e('0x4')]},'exitAt':{'type':Sequelize[_0xce6e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7f782d0..40963d6 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 _0x0439=['intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x1c3578,_0x1b1406){var _0x17b17a=function(_0x34e46f){while(--_0x34e46f){_0x1c3578['push'](_0x1c3578['shift']());}};_0x17b17a(++_0x1b1406);}(_0x0439,0xdd));var _0x9043=function(_0x29aca7,_0x21c650){_0x29aca7=_0x29aca7-0x0;var _0x1db0a0=_0x0439[_0x29aca7];return _0x1db0a0;};'use strict';var emlformat=require(_0x9043('0x0'));var rimraf=require(_0x9043('0x1'));var zipdir=require(_0x9043('0x2'));var jsonpatch=require(_0x9043('0x3'));var rp=require(_0x9043('0x4'));var moment=require(_0x9043('0x5'));var BPromise=require(_0x9043('0x6'));var Mustache=require('mustache');var util=require(_0x9043('0x7'));var path=require(_0x9043('0x8'));var sox=require(_0x9043('0x9'));var csv=require('to-csv');var ejs=require(_0x9043('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9043('0xb'));var crypto=require(_0x9043('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9043('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9043('0xe'));var Papa=require(_0x9043('0xf'));var Redis=require('ioredis');var authService=require(_0x9043('0x10'));var qs=require(_0x9043('0x11'));var as=require(_0x9043('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9043('0x13'));var utils=require(_0x9043('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9043('0x15'));var db=require(_0x9043('0x16'))['db'];function respondWithStatusCode(_0x3d8d67,_0x2bf58d){_0x2bf58d=_0x2bf58d||0xcc;return function(_0xcd2bf1){if(_0xcd2bf1){return _0x3d8d67[_0x9043('0x17')](_0x2bf58d);}return _0x3d8d67['status'](_0x2bf58d)[_0x9043('0x18')]();};}function respondWithResult(_0xf3f958,_0x48b142){_0x48b142=_0x48b142||0xc8;return function(_0x18f916){if(_0x18f916){return _0xf3f958[_0x9043('0x19')](_0x48b142)['json'](_0x18f916);}};}function respondWithFilteredResult(_0x37eca8,_0x1c2473){return function(_0x3aaee1){if(_0x3aaee1){var _0x2b3c2d=typeof _0x1c2473[_0x9043('0x1a')]===_0x9043('0x1b')&&typeof _0x1c2473[_0x9043('0x1c')]===_0x9043('0x1b');var _0x21f330=_0x3aaee1[_0x9043('0x1d')];var _0x51823a=_0x2b3c2d?0x0:_0x1c2473['offset'];var _0x47fbdc=_0x2b3c2d?_0x3aaee1[_0x9043('0x1d')]:_0x1c2473[_0x9043('0x1a')]+_0x1c2473[_0x9043('0x1c')];var _0x43bbd4;if(_0x47fbdc>=_0x21f330){_0x47fbdc=_0x21f330;_0x43bbd4=0xc8;}else{_0x43bbd4=0xce;}_0x37eca8['status'](_0x43bbd4);return _0x37eca8[_0x9043('0x1e')]('Content-Range',_0x51823a+'-'+_0x47fbdc+'/'+_0x21f330)['json'](_0x3aaee1);}return null;};}function patchUpdates(_0x161511){return function(_0x3572d5){try{jsonpatch[_0x9043('0x1f')](_0x3572d5,_0x161511,!![]);}catch(_0x820f8c){return BPromise[_0x9043('0x20')](_0x820f8c);}return _0x3572d5[_0x9043('0x21')]();};}function saveUpdates(_0x3a82b4,_0x366695){return function(_0x5a3f7a){if(_0x5a3f7a){return _0x5a3f7a[_0x9043('0x22')](_0x3a82b4)[_0x9043('0x23')](function(_0x30930c){return _0x30930c;});}return null;};}function removeEntity(_0x5506bf,_0x18727f){return function(_0x3c4fa4){if(_0x3c4fa4){return _0x3c4fa4[_0x9043('0x24')]()[_0x9043('0x23')](function(){_0x5506bf[_0x9043('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16caf2,_0xca0bb1){return function(_0x6d23af){if(!_0x6d23af){_0x16caf2[_0x9043('0x17')](0x194);}return _0x6d23af;};}function handleError(_0x2003c3,_0x13e8dd){_0x13e8dd=_0x13e8dd||0x1f4;return function(_0x5f4975){logger[_0x9043('0x25')](_0x5f4975['stack']);if(_0x5f4975[_0x9043('0x26')]){delete _0x5f4975[_0x9043('0x26')];}_0x2003c3[_0x9043('0x19')](_0x13e8dd)[_0x9043('0x27')](_0x5f4975);};}exports['index']=function(_0xc92d75,_0x2e12b1){var _0x14cf80={},_0x228d7f={},_0x37ecc2={'count':0x0,'rows':[]};var _0x590357=_[_0x9043('0x28')](db[_0x9043('0x29')][_0x9043('0x2a')],function(_0x4e4363){return{'name':_0x4e4363[_0x9043('0x2b')],'type':_0x4e4363[_0x9043('0x2c')]['key']};});_0x228d7f[_0x9043('0x2d')]=_[_0x9043('0x28')](_0x590357,'name');_0x228d7f[_0x9043('0x2e')]=_[_0x9043('0x2f')](_0xc92d75[_0x9043('0x2e')]);_0x228d7f[_0x9043('0x30')]=_['intersection'](_0x228d7f[_0x9043('0x2d')],_0x228d7f[_0x9043('0x2e')]);_0x14cf80['attributes']=_['intersection'](_0x228d7f[_0x9043('0x2d')],qs[_0x9043('0x31')](_0xc92d75[_0x9043('0x2e')][_0x9043('0x31')]));_0x14cf80[_0x9043('0x32')]=_0x14cf80[_0x9043('0x32')]['length']?_0x14cf80['attributes']:_0x228d7f[_0x9043('0x2d')];if(!_0xc92d75[_0x9043('0x2e')][_0x9043('0x33')](_0x9043('0x34'))){_0x14cf80[_0x9043('0x1c')]=qs[_0x9043('0x1c')](_0xc92d75[_0x9043('0x2e')]['limit']);_0x14cf80[_0x9043('0x1a')]=qs['offset'](_0xc92d75[_0x9043('0x2e')]['offset']);}_0x14cf80[_0x9043('0x35')]=qs[_0x9043('0x36')](_0xc92d75['query']['sort']);_0x14cf80[_0x9043('0x37')]=qs[_0x9043('0x30')](_[_0x9043('0x38')](_0xc92d75[_0x9043('0x2e')],_0x228d7f[_0x9043('0x30')]),_0x590357);if(_0xc92d75[_0x9043('0x2e')][_0x9043('0x39')]){_0x14cf80[_0x9043('0x37')]=_[_0x9043('0x3a')](_0x14cf80[_0x9043('0x37')],{'$or':_[_0x9043('0x28')](_0x590357,function(_0x19b858){if(_0x19b858['type']!==_0x9043('0x3b')){var _0x5187bf={};_0x5187bf[_0x19b858[_0x9043('0x26')]]={'$like':'%'+_0xc92d75[_0x9043('0x2e')]['filter']+'%'};return _0x5187bf;}})});}_0x14cf80=_[_0x9043('0x3a')]({},_0x14cf80,_0xc92d75[_0x9043('0x3c')]);var _0x1dc9cf={'where':_0x14cf80['where']};return db[_0x9043('0x29')][_0x9043('0x1d')](_0x1dc9cf)[_0x9043('0x23')](function(_0x3cdaf9){_0x37ecc2[_0x9043('0x1d')]=_0x3cdaf9;if(_0xc92d75[_0x9043('0x2e')][_0x9043('0x3d')]){_0x14cf80[_0x9043('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x9043('0x3f')](_0x14cf80);})['then'](function(_0x56a084){_0x37ecc2[_0x9043('0x40')]=_0x56a084;return _0x37ecc2;})['then'](respondWithFilteredResult(_0x2e12b1,_0x14cf80))[_0x9043('0x41')](handleError(_0x2e12b1,null));};exports['show']=function(_0x392551,_0x3a75e0){var _0x2c479d={'raw':!![],'where':{'id':_0x392551[_0x9043('0x42')]['id']}},_0x38028b={};_0x38028b[_0x9043('0x2d')]=_['keys'](db[_0x9043('0x29')][_0x9043('0x2a')]);_0x38028b[_0x9043('0x2e')]=_['keys'](_0x392551[_0x9043('0x2e')]);_0x38028b[_0x9043('0x30')]=_['intersection'](_0x38028b[_0x9043('0x2d')],_0x38028b['query']);_0x2c479d[_0x9043('0x32')]=_[_0x9043('0x43')](_0x38028b['model'],qs['fields'](_0x392551[_0x9043('0x2e')][_0x9043('0x31')]));_0x2c479d[_0x9043('0x32')]=_0x2c479d[_0x9043('0x32')]['length']?_0x2c479d[_0x9043('0x32')]:_0x38028b[_0x9043('0x2d')];if(_0x392551['query']['includeAll']){_0x2c479d[_0x9043('0x3e')]=[{'all':!![]}];}_0x2c479d=_[_0x9043('0x3a')]({},_0x2c479d,_0x392551['options']);return db[_0x9043('0x29')][_0x9043('0x44')](_0x2c479d)[_0x9043('0x23')](handleEntityNotFound(_0x3a75e0,null))[_0x9043('0x23')](respondWithResult(_0x3a75e0,null))['catch'](handleError(_0x3a75e0,null));};exports[_0x9043('0x45')]=function(_0x172872,_0x5d7e24){return db[_0x9043('0x29')][_0x9043('0x45')](_0x172872[_0x9043('0x46')],{})[_0x9043('0x23')](respondWithResult(_0x5d7e24,0xc9))[_0x9043('0x41')](handleError(_0x5d7e24,null));};exports[_0x9043('0x22')]=function(_0x6f909a,_0x370821){if(_0x6f909a[_0x9043('0x46')]['id']){delete _0x6f909a[_0x9043('0x46')]['id'];}return db[_0x9043('0x29')][_0x9043('0x44')]({'where':{'id':_0x6f909a[_0x9043('0x42')]['id']}})[_0x9043('0x23')](handleEntityNotFound(_0x370821,null))['then'](saveUpdates(_0x6f909a[_0x9043('0x46')],null))[_0x9043('0x23')](respondWithResult(_0x370821,null))['catch'](handleError(_0x370821,null));};exports[_0x9043('0x24')]=function(_0x188695,_0x385fb6){return db['FaxQueueReport']['find']({'where':{'id':_0x188695[_0x9043('0x42')]['id']}})[_0x9043('0x23')](handleEntityNotFound(_0x385fb6,null))[_0x9043('0x23')](removeEntity(_0x385fb6,null))[_0x9043('0x41')](handleError(_0x385fb6,null));};exports['describe']=function(_0x13127e,_0x425205){return db[_0x9043('0x29')][_0x9043('0x47')]()['then'](respondWithResult(_0x425205,null))[_0x9043('0x41')](handleError(_0x425205,null));}; \ No newline at end of file +var _0x1da1=['sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','rawAttributes','length','options','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x58689e,_0x5d8ad3){var _0x330363=function(_0x3c805b){while(--_0x3c805b){_0x58689e['push'](_0x58689e['shift']());}};_0x330363(++_0x5d8ad3);}(_0x1da1,0x1a4));var _0x11da=function(_0x106464,_0x34e5d1){_0x106464=_0x106464-0x0;var _0x3fa260=_0x1da1[_0x106464];return _0x3fa260;};'use strict';var emlformat=require(_0x11da('0x0'));var rimraf=require(_0x11da('0x1'));var zipdir=require(_0x11da('0x2'));var jsonpatch=require(_0x11da('0x3'));var rp=require(_0x11da('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11da('0x5'));var util=require(_0x11da('0x6'));var path=require(_0x11da('0x7'));var sox=require('sox');var csv=require(_0x11da('0x8'));var ejs=require(_0x11da('0x9'));var fs=require('fs');var fs_extra=require(_0x11da('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x11da('0xb'));var jsforce=require(_0x11da('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x11da('0x8'));var querystring=require(_0x11da('0xd'));var Papa=require('papaparse');var Redis=require(_0x11da('0xe'));var authService=require(_0x11da('0xf'));var qs=require(_0x11da('0x10'));var as=require(_0x11da('0x11'));var hardwareService=require(_0x11da('0x12'));var logger=require(_0x11da('0x13'))(_0x11da('0x14'));var utils=require(_0x11da('0x15'));var config=require(_0x11da('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x11da('0x17'))['db'];function respondWithStatusCode(_0x22b3a4,_0x37a467){_0x37a467=_0x37a467||0xcc;return function(_0x35c329){if(_0x35c329){return _0x22b3a4[_0x11da('0x18')](_0x37a467);}return _0x22b3a4['status'](_0x37a467)[_0x11da('0x19')]();};}function respondWithResult(_0x2e274f,_0x2ee64d){_0x2ee64d=_0x2ee64d||0xc8;return function(_0x1af139){if(_0x1af139){return _0x2e274f[_0x11da('0x1a')](_0x2ee64d)['json'](_0x1af139);}};}function respondWithFilteredResult(_0x1a0f47,_0x529f70){return function(_0x3634d4){if(_0x3634d4){var _0x741933=typeof _0x529f70[_0x11da('0x1b')]===_0x11da('0x1c')&&typeof _0x529f70[_0x11da('0x1d')]===_0x11da('0x1c');var _0x9a4aa0=_0x3634d4[_0x11da('0x1e')];var _0x3c3392=_0x741933?0x0:_0x529f70[_0x11da('0x1b')];var _0x463c3d=_0x741933?_0x3634d4[_0x11da('0x1e')]:_0x529f70['offset']+_0x529f70[_0x11da('0x1d')];var _0x2e2ae0;if(_0x463c3d>=_0x9a4aa0){_0x463c3d=_0x9a4aa0;_0x2e2ae0=0xc8;}else{_0x2e2ae0=0xce;}_0x1a0f47[_0x11da('0x1a')](_0x2e2ae0);return _0x1a0f47[_0x11da('0x1f')](_0x11da('0x20'),_0x3c3392+'-'+_0x463c3d+'/'+_0x9a4aa0)['json'](_0x3634d4);}return null;};}function patchUpdates(_0x2c0d4a){return function(_0x41bdb7){try{jsonpatch[_0x11da('0x21')](_0x41bdb7,_0x2c0d4a,!![]);}catch(_0x481dd4){return BPromise['reject'](_0x481dd4);}return _0x41bdb7[_0x11da('0x22')]();};}function saveUpdates(_0x1f10d1,_0x275400){return function(_0x514fc4){if(_0x514fc4){return _0x514fc4[_0x11da('0x23')](_0x1f10d1)['then'](function(_0x1e963e){return _0x1e963e;});}return null;};}function removeEntity(_0x3a90db,_0x3b179c){return function(_0x16ebc7){if(_0x16ebc7){return _0x16ebc7[_0x11da('0x24')]()[_0x11da('0x25')](function(){_0x3a90db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9dc,_0x3ad7b7){return function(_0x48908f){if(!_0x48908f){_0x15a9dc[_0x11da('0x18')](0x194);}return _0x48908f;};}function handleError(_0x28adc7,_0x52bdb0){_0x52bdb0=_0x52bdb0||0x1f4;return function(_0x28f7a4){logger[_0x11da('0x26')](_0x28f7a4[_0x11da('0x27')]);if(_0x28f7a4[_0x11da('0x28')]){delete _0x28f7a4[_0x11da('0x28')];}_0x28adc7[_0x11da('0x1a')](_0x52bdb0)[_0x11da('0x29')](_0x28f7a4);};}exports[_0x11da('0x2a')]=function(_0x219ac0,_0x47aab1){var _0x1b5b92={},_0x558267={},_0x55d339={'count':0x0,'rows':[]};var _0x315488=_[_0x11da('0x2b')](db[_0x11da('0x2c')]['rawAttributes'],function(_0x553814){return{'name':_0x553814[_0x11da('0x2d')],'type':_0x553814[_0x11da('0x2e')][_0x11da('0x2f')]};});_0x558267[_0x11da('0x30')]=_[_0x11da('0x2b')](_0x315488,_0x11da('0x28'));_0x558267['query']=_[_0x11da('0x31')](_0x219ac0['query']);_0x558267['filters']=_[_0x11da('0x32')](_0x558267[_0x11da('0x30')],_0x558267[_0x11da('0x33')]);_0x1b5b92[_0x11da('0x34')]=_[_0x11da('0x32')](_0x558267[_0x11da('0x30')],qs[_0x11da('0x35')](_0x219ac0['query'][_0x11da('0x35')]));_0x1b5b92['attributes']=_0x1b5b92[_0x11da('0x34')]['length']?_0x1b5b92[_0x11da('0x34')]:_0x558267['model'];if(!_0x219ac0['query'][_0x11da('0x36')](_0x11da('0x37'))){_0x1b5b92[_0x11da('0x1d')]=qs[_0x11da('0x1d')](_0x219ac0[_0x11da('0x33')][_0x11da('0x1d')]);_0x1b5b92['offset']=qs['offset'](_0x219ac0[_0x11da('0x33')][_0x11da('0x1b')]);}_0x1b5b92[_0x11da('0x38')]=qs['sort'](_0x219ac0[_0x11da('0x33')][_0x11da('0x39')]);_0x1b5b92[_0x11da('0x3a')]=qs[_0x11da('0x3b')](_[_0x11da('0x3c')](_0x219ac0[_0x11da('0x33')],_0x558267[_0x11da('0x3b')]),_0x315488);if(_0x219ac0[_0x11da('0x33')][_0x11da('0x3d')]){_0x1b5b92[_0x11da('0x3a')]=_[_0x11da('0x3e')](_0x1b5b92[_0x11da('0x3a')],{'$or':_[_0x11da('0x2b')](_0x315488,function(_0x1af1ac){if(_0x1af1ac[_0x11da('0x2e')]!==_0x11da('0x3f')){var _0x4b4891={};_0x4b4891[_0x1af1ac[_0x11da('0x28')]]={'$like':'%'+_0x219ac0[_0x11da('0x33')]['filter']+'%'};return _0x4b4891;}})});}_0x1b5b92=_[_0x11da('0x3e')]({},_0x1b5b92,_0x219ac0['options']);var _0x42d36c={'where':_0x1b5b92[_0x11da('0x3a')]};return db[_0x11da('0x2c')]['count'](_0x42d36c)[_0x11da('0x25')](function(_0x56068d){_0x55d339[_0x11da('0x1e')]=_0x56068d;if(_0x219ac0[_0x11da('0x33')][_0x11da('0x40')]){_0x1b5b92[_0x11da('0x41')]=[{'all':!![]}];}return db[_0x11da('0x2c')]['findAll'](_0x1b5b92);})[_0x11da('0x25')](function(_0x8384e1){_0x55d339[_0x11da('0x42')]=_0x8384e1;return _0x55d339;})[_0x11da('0x25')](respondWithFilteredResult(_0x47aab1,_0x1b5b92))[_0x11da('0x43')](handleError(_0x47aab1,null));};exports['show']=function(_0x129fd8,_0x9262b6){var _0x503129={'raw':!![],'where':{'id':_0x129fd8['params']['id']}},_0x5165e5={};_0x5165e5[_0x11da('0x30')]=_[_0x11da('0x31')](db['FaxQueueReport'][_0x11da('0x44')]);_0x5165e5[_0x11da('0x33')]=_[_0x11da('0x31')](_0x129fd8['query']);_0x5165e5[_0x11da('0x3b')]=_[_0x11da('0x32')](_0x5165e5[_0x11da('0x30')],_0x5165e5[_0x11da('0x33')]);_0x503129[_0x11da('0x34')]=_[_0x11da('0x32')](_0x5165e5[_0x11da('0x30')],qs[_0x11da('0x35')](_0x129fd8[_0x11da('0x33')]['fields']));_0x503129[_0x11da('0x34')]=_0x503129[_0x11da('0x34')][_0x11da('0x45')]?_0x503129[_0x11da('0x34')]:_0x5165e5[_0x11da('0x30')];if(_0x129fd8[_0x11da('0x33')][_0x11da('0x40')]){_0x503129[_0x11da('0x41')]=[{'all':!![]}];}_0x503129=_[_0x11da('0x3e')]({},_0x503129,_0x129fd8[_0x11da('0x46')]);return db[_0x11da('0x2c')]['find'](_0x503129)[_0x11da('0x25')](handleEntityNotFound(_0x9262b6,null))[_0x11da('0x25')](respondWithResult(_0x9262b6,null))[_0x11da('0x43')](handleError(_0x9262b6,null));};exports['create']=function(_0x4ec77b,_0x4981e0){return db[_0x11da('0x2c')]['create'](_0x4ec77b['body'],{})[_0x11da('0x25')](respondWithResult(_0x4981e0,0xc9))[_0x11da('0x43')](handleError(_0x4981e0,null));};exports[_0x11da('0x23')]=function(_0x5b9117,_0x24013d){if(_0x5b9117[_0x11da('0x47')]['id']){delete _0x5b9117['body']['id'];}return db[_0x11da('0x2c')][_0x11da('0x48')]({'where':{'id':_0x5b9117['params']['id']}})[_0x11da('0x25')](handleEntityNotFound(_0x24013d,null))[_0x11da('0x25')](saveUpdates(_0x5b9117[_0x11da('0x47')],null))[_0x11da('0x25')](respondWithResult(_0x24013d,null))['catch'](handleError(_0x24013d,null));};exports[_0x11da('0x24')]=function(_0x4a9fcf,_0x4af8ca){return db['FaxQueueReport']['find']({'where':{'id':_0x4a9fcf['params']['id']}})[_0x11da('0x25')](handleEntityNotFound(_0x4af8ca,null))[_0x11da('0x25')](removeEntity(_0x4af8ca,null))[_0x11da('0x43')](handleError(_0x4af8ca,null));};exports['describe']=function(_0x105bbe,_0x44bd87){return db[_0x11da('0x2c')][_0x11da('0x49')]()['then'](respondWithResult(_0x44bd87,null))[_0x11da('0x43')](handleError(_0x44bd87,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 685071c..2cde8f1 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x3c358c,_0x226141){var _0x2fb4dd=function(_0x288100){while(--_0x288100){_0x3c358c['push'](_0x3c358c['shift']());}};_0x2fb4dd(++_0x226141);}(_0x1261,0x144));var _0x1126=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x1261[_0x3a7e01];return _0x5b8398;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x1cb9,0x14e));var _0x91cb=function(_0x394c97,_0x3aad5d){_0x394c97=_0x394c97-0x0;var _0x6f7abc=_0x1cb9[_0x394c97];return _0x6f7abc;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e772951..c721b8c 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 _0xfa76=['catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','update','body','where','attributes','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x204db8,_0x2d2d6d){var _0x30a01e=function(_0x159c71){while(--_0x159c71){_0x204db8['push'](_0x204db8['shift']());}};_0x30a01e(++_0x2d2d6d);}(_0xfa76,0x1d2));var _0x6fa7=function(_0xc0d6bb,_0xa8ddaa){_0xc0d6bb=_0xc0d6bb-0x0;var _0x2eb24e=_0xfa76[_0xc0d6bb];return _0x2eb24e;};'use strict';var _=require(_0x6fa7('0x0'));var util=require('util');var moment=require(_0x6fa7('0x1'));var BPromise=require(_0x6fa7('0x2'));var rs=require(_0x6fa7('0x3'));var fs=require('fs');var Redis=require(_0x6fa7('0x4'));var db=require(_0x6fa7('0x5'))['db'];var utils=require(_0x6fa7('0x6'));var logger=require(_0x6fa7('0x7'))(_0x6fa7('0x8'));var config=require(_0x6fa7('0x9'));var jayson=require(_0x6fa7('0xa'));var client=jayson[_0x6fa7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43424b,_0x217771,_0x3e3f08){return new BPromise(function(_0xf5a70e,_0x3bb73a){return client[_0x6fa7('0xc')](_0x43424b,_0x3e3f08)[_0x6fa7('0xd')](function(_0x2adf1c){logger[_0x6fa7('0xe')](_0x6fa7('0xf'),_0x217771,_0x6fa7('0x10'));logger[_0x6fa7('0x11')](_0x6fa7('0x12'),_0x217771,_0x6fa7('0x10'),JSON[_0x6fa7('0x13')](_0x2adf1c));if(_0x2adf1c[_0x6fa7('0x14')]){if(_0x2adf1c[_0x6fa7('0x14')][_0x6fa7('0x15')]===0x1f4){logger[_0x6fa7('0x14')](_0x6fa7('0xf'),_0x217771,_0x2adf1c[_0x6fa7('0x14')]['message']);return _0x3bb73a(_0x2adf1c[_0x6fa7('0x14')][_0x6fa7('0x16')]);}logger[_0x6fa7('0x14')](_0x6fa7('0xf'),_0x217771,_0x2adf1c[_0x6fa7('0x14')][_0x6fa7('0x16')]);return _0xf5a70e(_0x2adf1c['error'][_0x6fa7('0x16')]);}else{logger[_0x6fa7('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x217771,_0x6fa7('0x10'));_0xf5a70e(_0x2adf1c[_0x6fa7('0x17')][_0x6fa7('0x16')]);}})[_0x6fa7('0x18')](function(_0x31e7fc){logger[_0x6fa7('0x14')](_0x6fa7('0xf'),_0x217771,_0x31e7fc);_0x3bb73a(_0x31e7fc);});});}exports['CreateFaxQueueReport']=function(_0x550c67){var _0x23e0e1=this;return new Promise(function(_0x3260e7,_0x11ad03){return db[_0x6fa7('0x19')][_0x6fa7('0x1a')](_0x550c67['body'],{'raw':_0x550c67[_0x6fa7('0x1b')]?_0x550c67['options'][_0x6fa7('0x1c')]===undefined?!![]:![]:!![]})[_0x6fa7('0xd')](function(_0x189853){logger['info'](_0x6fa7('0x1d'),_0x550c67);logger['debug'](_0x6fa7('0x1d'),_0x550c67,JSON[_0x6fa7('0x13')](_0x189853));_0x3260e7(_0x189853);})[_0x6fa7('0x18')](function(_0x2145fe){logger[_0x6fa7('0x14')]('CreateFaxQueueReport',_0x2145fe[_0x6fa7('0x16')],_0x550c67);_0x11ad03(_0x23e0e1[_0x6fa7('0x14')](0x1f4,_0x2145fe[_0x6fa7('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x59b4e8){var _0x307119=this;return new Promise(function(_0x106fa8,_0x27ddf){return db[_0x6fa7('0x19')][_0x6fa7('0x1e')](_0x59b4e8[_0x6fa7('0x1f')],{'raw':_0x59b4e8[_0x6fa7('0x1b')]?_0x59b4e8['options'][_0x6fa7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b4e8[_0x6fa7('0x1b')]?_0x59b4e8[_0x6fa7('0x1b')][_0x6fa7('0x20')]||null:null,'attributes':_0x59b4e8[_0x6fa7('0x1b')]?_0x59b4e8['options'][_0x6fa7('0x21')]||null:null,'limit':_0x59b4e8[_0x6fa7('0x1b')]?_0x59b4e8[_0x6fa7('0x1b')]['limit']||null:null})[_0x6fa7('0xd')](function(_0x3a6d8d){logger[_0x6fa7('0xe')]('UpdateFaxQueueReport',_0x59b4e8);logger[_0x6fa7('0x11')](_0x6fa7('0x22'),_0x59b4e8,JSON[_0x6fa7('0x13')](_0x3a6d8d));_0x106fa8(_0x3a6d8d);})['catch'](function(_0x260773){logger[_0x6fa7('0x14')](_0x6fa7('0x22'),_0x260773['message'],_0x59b4e8);_0x27ddf(_0x307119[_0x6fa7('0x14')](0x1f4,_0x260773['message']));});});}; \ No newline at end of file +var _0x2921=['request\x20sent','error','code','message','result','catch','FaxQueueReport','body','raw','debug','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x30977e,_0x1d0cb5){var _0x22f2a8=function(_0x2781ee){while(--_0x2781ee){_0x30977e['push'](_0x30977e['shift']());}};_0x22f2a8(++_0x1d0cb5);}(_0x2921,0x1df));var _0x1292=function(_0x501a87,_0x198eae){_0x501a87=_0x501a87-0x0;var _0x49f17f=_0x2921[_0x501a87];return _0x49f17f;};'use strict';var _=require(_0x1292('0x0'));var util=require(_0x1292('0x1'));var moment=require('moment');var BPromise=require(_0x1292('0x2'));var rs=require(_0x1292('0x3'));var fs=require('fs');var Redis=require(_0x1292('0x4'));var db=require(_0x1292('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1292('0x6'))(_0x1292('0x7'));var config=require(_0x1292('0x8'));var jayson=require(_0x1292('0x9'));var client=jayson['client'][_0x1292('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51ae6a,_0x29843d,_0xd81edf){return new BPromise(function(_0xc54457,_0x153902){return client[_0x1292('0xb')](_0x51ae6a,_0xd81edf)[_0x1292('0xc')](function(_0x5da85e){logger[_0x1292('0xd')](_0x1292('0xe'),_0x29843d,'request\x20sent');logger['debug'](_0x1292('0xf'),_0x29843d,_0x1292('0x10'),JSON['stringify'](_0x5da85e));if(_0x5da85e[_0x1292('0x11')]){if(_0x5da85e['error'][_0x1292('0x12')]===0x1f4){logger[_0x1292('0x11')](_0x1292('0xe'),_0x29843d,_0x5da85e[_0x1292('0x11')][_0x1292('0x13')]);return _0x153902(_0x5da85e[_0x1292('0x11')][_0x1292('0x13')]);}logger[_0x1292('0x11')](_0x1292('0xe'),_0x29843d,_0x5da85e[_0x1292('0x11')][_0x1292('0x13')]);return _0xc54457(_0x5da85e['error'][_0x1292('0x13')]);}else{logger[_0x1292('0xd')](_0x1292('0xe'),_0x29843d,_0x1292('0x10'));_0xc54457(_0x5da85e[_0x1292('0x14')]['message']);}})[_0x1292('0x15')](function(_0x11c485){logger[_0x1292('0x11')](_0x1292('0xe'),_0x29843d,_0x11c485);_0x153902(_0x11c485);});});}exports['CreateFaxQueueReport']=function(_0x1fa1b1){var _0x500564=this;return new Promise(function(_0x46bbcd,_0x2601b0){return db[_0x1292('0x16')]['create'](_0x1fa1b1[_0x1292('0x17')],{'raw':_0x1fa1b1['options']?_0x1fa1b1['options'][_0x1292('0x18')]===undefined?!![]:![]:!![]})[_0x1292('0xc')](function(_0x32bbc2){logger[_0x1292('0xd')]('CreateFaxQueueReport',_0x1fa1b1);logger[_0x1292('0x19')](_0x1292('0x1a'),_0x1fa1b1,JSON[_0x1292('0x1b')](_0x32bbc2));_0x46bbcd(_0x32bbc2);})[_0x1292('0x15')](function(_0x1d9edf){logger[_0x1292('0x11')](_0x1292('0x1a'),_0x1d9edf[_0x1292('0x13')],_0x1fa1b1);_0x2601b0(_0x500564['error'](0x1f4,_0x1d9edf[_0x1292('0x13')]));});});};exports[_0x1292('0x1c')]=function(_0x4ad6b2){var _0x3190f0=this;return new Promise(function(_0x3288c7,_0x4e68a3){return db['FaxQueueReport']['update'](_0x4ad6b2[_0x1292('0x17')],{'raw':_0x4ad6b2['options']?_0x4ad6b2[_0x1292('0x1d')][_0x1292('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad6b2[_0x1292('0x1d')]?_0x4ad6b2[_0x1292('0x1d')][_0x1292('0x1e')]||null:null,'attributes':_0x4ad6b2['options']?_0x4ad6b2[_0x1292('0x1d')][_0x1292('0x1f')]||null:null,'limit':_0x4ad6b2[_0x1292('0x1d')]?_0x4ad6b2[_0x1292('0x1d')][_0x1292('0x20')]||null:null})[_0x1292('0xc')](function(_0x3554ea){logger[_0x1292('0xd')]('UpdateFaxQueueReport',_0x4ad6b2);logger['debug']('UpdateFaxQueueReport',_0x4ad6b2,JSON[_0x1292('0x1b')](_0x3554ea));_0x3288c7(_0x3554ea);})['catch'](function(_0x27c415){logger['error'](_0x1292('0x1c'),_0x27c415[_0x1292('0x13')],_0x4ad6b2);_0x4e68a3(_0x3190f0[_0x1292('0x11')](0x1f4,_0x27c415[_0x1292('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ad14ee8..ccbe430 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 _0xdb48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x294c42,_0xbd23ad){var _0x4c73d9=function(_0x4f140e){while(--_0x4f140e){_0x294c42['push'](_0x294c42['shift']());}};_0x4c73d9(++_0xbd23ad);}(_0xdb48,0xb8));var _0x8db4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xdb48[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x8db4('0x0'));var util=require(_0x8db4('0x1'));var path=require('path');var timeout=require(_0x8db4('0x2'));var express=require(_0x8db4('0x3'));var router=express[_0x8db4('0x4')]();var fs_extra=require(_0x8db4('0x5'));var auth=require(_0x8db4('0x6'));var interaction=require(_0x8db4('0x7'));var config=require(_0x8db4('0x8'));var controller=require(_0x8db4('0x9'));router[_0x8db4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8db4('0xa')]('/describe',auth[_0x8db4('0xb')](),controller[_0x8db4('0xc')]);router['get']('/:id',auth[_0x8db4('0xb')](),controller[_0x8db4('0xd')]);router[_0x8db4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8db4('0xf')]('/:id',auth[_0x8db4('0xb')](),controller[_0x8db4('0x10')]);router[_0x8db4('0x11')](_0x8db4('0x12'),auth['isAuthenticated'](),controller[_0x8db4('0x13')]);module[_0x8db4('0x14')]=router; \ No newline at end of file +var _0x8578=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','/:id','create'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x8578,0x1a6));var _0x8857=function(_0x367e56,_0x123193){_0x367e56=_0x367e56-0x0;var _0xc7f4dd=_0x8578[_0x367e56];return _0xc7f4dd;};'use strict';var multer=require(_0x8857('0x0'));var util=require(_0x8857('0x1'));var path=require(_0x8857('0x2'));var timeout=require(_0x8857('0x3'));var express=require(_0x8857('0x4'));var router=express[_0x8857('0x5')]();var fs_extra=require(_0x8857('0x6'));var auth=require(_0x8857('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8857('0x8'));var controller=require(_0x8857('0x9'));router[_0x8857('0xa')]('/',auth['isAuthenticated'](),controller[_0x8857('0xb')]);router[_0x8857('0xa')]('/describe',auth[_0x8857('0xc')](),controller['describe']);router[_0x8857('0xa')](_0x8857('0xd'),auth[_0x8857('0xc')](),controller['show']);router['post']('/',auth[_0x8857('0xc')](),controller[_0x8857('0xe')]);router[_0x8857('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8857('0x10')](_0x8857('0xd'),auth[_0x8857('0xc')](),controller[_0x8857('0x11')]);module[_0x8857('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 c136a7c..4dc3922 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x271dc9,_0x5c1711){var _0x4019de=function(_0x142a25){while(--_0x142a25){_0x271dc9['push'](_0x271dc9['shift']());}};_0x4019de(++_0x5c1711);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2efdf2,_0x486861){var _0x390270=function(_0x1d7d1f){while(--_0x1d7d1f){_0x2efdf2['push'](_0x2efdf2['shift']());}};_0x390270(++_0x486861);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xcb91[_0xc0d9bc];return _0x32ff73;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4f59919..dba0641 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 _0x9a59=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','length','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9a59,0x1c8));var _0x99a5=function(_0x5137ef,_0x24fa4f){_0x5137ef=_0x5137ef-0x0;var _0x1c41f0=_0x9a59[_0x5137ef];return _0x1c41f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a5('0x0'));var zipdir=require(_0x99a5('0x1'));var jsonpatch=require(_0x99a5('0x2'));var rp=require(_0x99a5('0x3'));var moment=require(_0x99a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x99a5('0x5'));var util=require(_0x99a5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x99a5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99a5('0x8'));var _=require(_0x99a5('0x9'));var squel=require(_0x99a5('0xa'));var crypto=require(_0x99a5('0xb'));var jsforce=require(_0x99a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x99a5('0x7'));var querystring=require(_0x99a5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99a5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x99a5('0xf'));var hardwareService=require(_0x99a5('0x10'));var logger=require(_0x99a5('0x11'))(_0x99a5('0x12'));var utils=require(_0x99a5('0x13'));var config=require(_0x99a5('0x14'));var licenseUtil=require(_0x99a5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5612a0,_0xf46eb8){_0xf46eb8=_0xf46eb8||0xcc;return function(_0x4c3682){if(_0x4c3682){return _0x5612a0['sendStatus'](_0xf46eb8);}return _0x5612a0[_0x99a5('0x16')](_0xf46eb8)[_0x99a5('0x17')]();};}function respondWithResult(_0x68dfce,_0x336640){_0x336640=_0x336640||0xc8;return function(_0x1e2174){if(_0x1e2174){return _0x68dfce[_0x99a5('0x16')](_0x336640)['json'](_0x1e2174);}};}function respondWithFilteredResult(_0x83068d,_0x1983f4){return function(_0x2cc949){if(_0x2cc949){var _0x137e60=typeof _0x1983f4[_0x99a5('0x18')]===_0x99a5('0x19')&&typeof _0x1983f4['limit']===_0x99a5('0x19');var _0x25227a=_0x2cc949[_0x99a5('0x1a')];var _0x1acdac=_0x137e60?0x0:_0x1983f4[_0x99a5('0x18')];var _0x107794=_0x137e60?_0x2cc949[_0x99a5('0x1a')]:_0x1983f4[_0x99a5('0x18')]+_0x1983f4[_0x99a5('0x1b')];var _0x2baa21;if(_0x107794>=_0x25227a){_0x107794=_0x25227a;_0x2baa21=0xc8;}else{_0x2baa21=0xce;}_0x83068d[_0x99a5('0x16')](_0x2baa21);return _0x83068d[_0x99a5('0x1c')]('Content-Range',_0x1acdac+'-'+_0x107794+'/'+_0x25227a)[_0x99a5('0x1d')](_0x2cc949);}return null;};}function patchUpdates(_0x3f162e){return function(_0x5b038c){try{jsonpatch[_0x99a5('0x1e')](_0x5b038c,_0x3f162e,!![]);}catch(_0x126dc4){return BPromise[_0x99a5('0x1f')](_0x126dc4);}return _0x5b038c[_0x99a5('0x20')]();};}function saveUpdates(_0x2d6515,_0x310bcc){return function(_0x1c2698){if(_0x1c2698){return _0x1c2698[_0x99a5('0x21')](_0x2d6515)[_0x99a5('0x22')](function(_0x11c032){return _0x11c032;});}return null;};}function removeEntity(_0x317894,_0x285f07){return function(_0x26766d){if(_0x26766d){return _0x26766d[_0x99a5('0x23')]()[_0x99a5('0x22')](function(){_0x317894['status'](0xcc)[_0x99a5('0x17')]();});}};}function handleEntityNotFound(_0x1cbdff,_0x23e762){return function(_0x55152d){if(!_0x55152d){_0x1cbdff['sendStatus'](0x194);}return _0x55152d;};}function handleError(_0x5f4e31,_0x476098){_0x476098=_0x476098||0x1f4;return function(_0x5138e2){logger['error'](_0x5138e2[_0x99a5('0x24')]);if(_0x5138e2[_0x99a5('0x25')]){delete _0x5138e2[_0x99a5('0x25')];}_0x5f4e31['status'](_0x476098)['send'](_0x5138e2);};}exports[_0x99a5('0x26')]=function(_0x5763cf,_0x4fe5a8){var _0x202760={},_0x2baa25={},_0x254a57={'count':0x0,'rows':[]};var _0x500bfa=_[_0x99a5('0x27')](db[_0x99a5('0x28')][_0x99a5('0x29')],function(_0x47280f){return{'name':_0x47280f[_0x99a5('0x2a')],'type':_0x47280f[_0x99a5('0x2b')][_0x99a5('0x2c')]};});_0x2baa25['model']=_[_0x99a5('0x27')](_0x500bfa,_0x99a5('0x25'));_0x2baa25[_0x99a5('0x2d')]=_[_0x99a5('0x2e')](_0x5763cf[_0x99a5('0x2d')]);_0x2baa25[_0x99a5('0x2f')]=_['intersection'](_0x2baa25[_0x99a5('0x30')],_0x2baa25['query']);_0x202760[_0x99a5('0x31')]=_['intersection'](_0x2baa25[_0x99a5('0x30')],qs[_0x99a5('0x32')](_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x32')]));_0x202760[_0x99a5('0x31')]=_0x202760[_0x99a5('0x31')]['length']?_0x202760[_0x99a5('0x31')]:_0x2baa25[_0x99a5('0x30')];if(!_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x33')](_0x99a5('0x34'))){_0x202760[_0x99a5('0x1b')]=qs[_0x99a5('0x1b')](_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x1b')]);_0x202760[_0x99a5('0x18')]=qs[_0x99a5('0x18')](_0x5763cf[_0x99a5('0x2d')]['offset']);}_0x202760[_0x99a5('0x35')]=qs['sort'](_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x36')]);_0x202760[_0x99a5('0x37')]=qs[_0x99a5('0x2f')](_[_0x99a5('0x38')](_0x5763cf['query'],_0x2baa25['filters']),_0x500bfa);if(_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x39')]){_0x202760['where']=_[_0x99a5('0x3a')](_0x202760[_0x99a5('0x37')],{'$or':_['map'](_0x500bfa,function(_0x1c58cf){if(_0x1c58cf['type']!==_0x99a5('0x3b')){var _0x2f6060={};_0x2f6060[_0x1c58cf[_0x99a5('0x25')]]={'$like':'%'+_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x39')]+'%'};return _0x2f6060;}})});}_0x202760=_[_0x99a5('0x3a')]({},_0x202760,_0x5763cf[_0x99a5('0x3c')]);var _0x318ac3={'where':_0x202760[_0x99a5('0x37')]};return db[_0x99a5('0x28')]['count'](_0x318ac3)['then'](function(_0x18dd8c){_0x254a57[_0x99a5('0x1a')]=_0x18dd8c;if(_0x5763cf[_0x99a5('0x2d')][_0x99a5('0x3d')]){_0x202760[_0x99a5('0x3e')]=[{'all':!![]}];}return db[_0x99a5('0x28')]['findAll'](_0x202760);})[_0x99a5('0x22')](function(_0x4940ff){_0x254a57[_0x99a5('0x3f')]=_0x4940ff;return _0x254a57;})[_0x99a5('0x22')](respondWithFilteredResult(_0x4fe5a8,_0x202760))['catch'](handleError(_0x4fe5a8,null));};exports[_0x99a5('0x40')]=function(_0x3d1087,_0x39a061){var _0x4704c4={'raw':!![],'where':{'id':_0x3d1087[_0x99a5('0x41')]['id']}},_0x5605c8={};_0x5605c8['model']=_[_0x99a5('0x2e')](db[_0x99a5('0x28')][_0x99a5('0x29')]);_0x5605c8[_0x99a5('0x2d')]=_[_0x99a5('0x2e')](_0x3d1087[_0x99a5('0x2d')]);_0x5605c8[_0x99a5('0x2f')]=_[_0x99a5('0x42')](_0x5605c8[_0x99a5('0x30')],_0x5605c8[_0x99a5('0x2d')]);_0x4704c4[_0x99a5('0x31')]=_['intersection'](_0x5605c8['model'],qs['fields'](_0x3d1087[_0x99a5('0x2d')]['fields']));_0x4704c4[_0x99a5('0x31')]=_0x4704c4[_0x99a5('0x31')][_0x99a5('0x43')]?_0x4704c4[_0x99a5('0x31')]:_0x5605c8[_0x99a5('0x30')];if(_0x3d1087[_0x99a5('0x2d')][_0x99a5('0x3d')]){_0x4704c4[_0x99a5('0x3e')]=[{'all':!![]}];}_0x4704c4=_[_0x99a5('0x3a')]({},_0x4704c4,_0x3d1087[_0x99a5('0x3c')]);return db[_0x99a5('0x28')][_0x99a5('0x44')](_0x4704c4)[_0x99a5('0x22')](handleEntityNotFound(_0x39a061,null))[_0x99a5('0x22')](respondWithResult(_0x39a061,null))['catch'](handleError(_0x39a061,null));};exports[_0x99a5('0x45')]=function(_0x305989,_0xe77a59){return db[_0x99a5('0x28')][_0x99a5('0x45')](_0x305989[_0x99a5('0x46')],{})[_0x99a5('0x22')](respondWithResult(_0xe77a59,0xc9))[_0x99a5('0x47')](handleError(_0xe77a59,null));};exports[_0x99a5('0x21')]=function(_0x434389,_0x1c14f0){if(_0x434389['body']['id']){delete _0x434389[_0x99a5('0x46')]['id'];}return db[_0x99a5('0x28')]['find']({'where':{'id':_0x434389[_0x99a5('0x41')]['id']}})[_0x99a5('0x22')](handleEntityNotFound(_0x1c14f0,null))[_0x99a5('0x22')](saveUpdates(_0x434389[_0x99a5('0x46')],null))['then'](respondWithResult(_0x1c14f0,null))[_0x99a5('0x47')](handleError(_0x1c14f0,null));};exports[_0x99a5('0x23')]=function(_0x3fd932,_0x29eb08){return db[_0x99a5('0x28')][_0x99a5('0x44')]({'where':{'id':_0x3fd932[_0x99a5('0x41')]['id']}})['then'](handleEntityNotFound(_0x29eb08,null))[_0x99a5('0x22')](removeEntity(_0x29eb08,null))['catch'](handleError(_0x29eb08,null));};exports['describe']=function(_0x398aca,_0x1daddc){return db[_0x99a5('0x28')][_0x99a5('0x48')]()['then'](respondWithResult(_0x1daddc,null))[_0x99a5('0x47')](handleError(_0x1daddc,null));}; \ No newline at end of file +var _0xd4a8=['update','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save'];(function(_0x4ddcdd,_0xaf62b8){var _0x1d0a37=function(_0x26de8f){while(--_0x26de8f){_0x4ddcdd['push'](_0x4ddcdd['shift']());}};_0x1d0a37(++_0xaf62b8);}(_0xd4a8,0x13e));var _0x8d4a=function(_0x51a939,_0xb2755){_0x51a939=_0x51a939-0x0;var _0xbe0988=_0xd4a8[_0x51a939];return _0xbe0988;};'use strict';var emlformat=require(_0x8d4a('0x0'));var rimraf=require(_0x8d4a('0x1'));var zipdir=require(_0x8d4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d4a('0x3'));var moment=require(_0x8d4a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d4a('0x5'));var util=require(_0x8d4a('0x6'));var path=require('path');var sox=require(_0x8d4a('0x7'));var csv=require(_0x8d4a('0x8'));var ejs=require(_0x8d4a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d4a('0xa'));var squel=require('squel');var crypto=require(_0x8d4a('0xb'));var jsforce=require(_0x8d4a('0xc'));var deskjs=require(_0x8d4a('0xd'));var toCsv=require(_0x8d4a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d4a('0xe'));var authService=require(_0x8d4a('0xf'));var qs=require(_0x8d4a('0x10'));var as=require(_0x8d4a('0x11'));var hardwareService=require(_0x8d4a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8d4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58371b,_0x3d78bf){_0x3d78bf=_0x3d78bf||0xcc;return function(_0x28357f){if(_0x28357f){return _0x58371b[_0x8d4a('0x14')](_0x3d78bf);}return _0x58371b[_0x8d4a('0x15')](_0x3d78bf)[_0x8d4a('0x16')]();};}function respondWithResult(_0x105090,_0x54b4dc){_0x54b4dc=_0x54b4dc||0xc8;return function(_0x26cf00){if(_0x26cf00){return _0x105090[_0x8d4a('0x15')](_0x54b4dc)['json'](_0x26cf00);}};}function respondWithFilteredResult(_0x2f9369,_0x39ba40){return function(_0x297647){if(_0x297647){var _0x5c9bc3=typeof _0x39ba40['offset']===_0x8d4a('0x17')&&typeof _0x39ba40[_0x8d4a('0x18')]==='undefined';var _0x38d122=_0x297647[_0x8d4a('0x19')];var _0x144dd5=_0x5c9bc3?0x0:_0x39ba40[_0x8d4a('0x1a')];var _0x194469=_0x5c9bc3?_0x297647[_0x8d4a('0x19')]:_0x39ba40[_0x8d4a('0x1a')]+_0x39ba40[_0x8d4a('0x18')];var _0x478869;if(_0x194469>=_0x38d122){_0x194469=_0x38d122;_0x478869=0xc8;}else{_0x478869=0xce;}_0x2f9369[_0x8d4a('0x15')](_0x478869);return _0x2f9369[_0x8d4a('0x1b')]('Content-Range',_0x144dd5+'-'+_0x194469+'/'+_0x38d122)[_0x8d4a('0x1c')](_0x297647);}return null;};}function patchUpdates(_0x33ffe8){return function(_0x330417){try{jsonpatch[_0x8d4a('0x1d')](_0x330417,_0x33ffe8,!![]);}catch(_0x4038c3){return BPromise[_0x8d4a('0x1e')](_0x4038c3);}return _0x330417[_0x8d4a('0x1f')]();};}function saveUpdates(_0x1c1899,_0x1dbdfe){return function(_0x495e61){if(_0x495e61){return _0x495e61[_0x8d4a('0x20')](_0x1c1899)['then'](function(_0x4ea8e6){return _0x4ea8e6;});}return null;};}function removeEntity(_0x4ae412,_0x4afadd){return function(_0x10b42b){if(_0x10b42b){return _0x10b42b['destroy']()[_0x8d4a('0x21')](function(){_0x4ae412[_0x8d4a('0x15')](0xcc)[_0x8d4a('0x16')]();});}};}function handleEntityNotFound(_0x9b79bb,_0x1c2154){return function(_0x4feb1e){if(!_0x4feb1e){_0x9b79bb[_0x8d4a('0x14')](0x194);}return _0x4feb1e;};}function handleError(_0x1bf8a1,_0xdfe150){_0xdfe150=_0xdfe150||0x1f4;return function(_0x100538){logger[_0x8d4a('0x22')](_0x100538[_0x8d4a('0x23')]);if(_0x100538[_0x8d4a('0x24')]){delete _0x100538[_0x8d4a('0x24')];}_0x1bf8a1[_0x8d4a('0x15')](_0xdfe150)[_0x8d4a('0x25')](_0x100538);};}exports['index']=function(_0x3e6bcc,_0x4317d0){var _0x2d306c={},_0x2ca90e={},_0x27f3e0={'count':0x0,'rows':[]};var _0x5cdae7=_[_0x8d4a('0x26')](db[_0x8d4a('0x27')][_0x8d4a('0x28')],function(_0x27aa4f){return{'name':_0x27aa4f[_0x8d4a('0x29')],'type':_0x27aa4f[_0x8d4a('0x2a')]['key']};});_0x2ca90e[_0x8d4a('0x2b')]=_[_0x8d4a('0x26')](_0x5cdae7,'name');_0x2ca90e[_0x8d4a('0x2c')]=_[_0x8d4a('0x2d')](_0x3e6bcc[_0x8d4a('0x2c')]);_0x2ca90e[_0x8d4a('0x2e')]=_[_0x8d4a('0x2f')](_0x2ca90e[_0x8d4a('0x2b')],_0x2ca90e[_0x8d4a('0x2c')]);_0x2d306c[_0x8d4a('0x30')]=_[_0x8d4a('0x2f')](_0x2ca90e['model'],qs[_0x8d4a('0x31')](_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x31')]));_0x2d306c[_0x8d4a('0x30')]=_0x2d306c['attributes'][_0x8d4a('0x32')]?_0x2d306c['attributes']:_0x2ca90e[_0x8d4a('0x2b')];if(!_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x33')](_0x8d4a('0x34'))){_0x2d306c[_0x8d4a('0x18')]=qs[_0x8d4a('0x18')](_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x18')]);_0x2d306c[_0x8d4a('0x1a')]=qs[_0x8d4a('0x1a')](_0x3e6bcc['query'][_0x8d4a('0x1a')]);}_0x2d306c[_0x8d4a('0x35')]=qs[_0x8d4a('0x36')](_0x3e6bcc['query'][_0x8d4a('0x36')]);_0x2d306c[_0x8d4a('0x37')]=qs[_0x8d4a('0x2e')](_[_0x8d4a('0x38')](_0x3e6bcc['query'],_0x2ca90e[_0x8d4a('0x2e')]),_0x5cdae7);if(_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x39')]){_0x2d306c['where']=_[_0x8d4a('0x3a')](_0x2d306c['where'],{'$or':_[_0x8d4a('0x26')](_0x5cdae7,function(_0xa99158){if(_0xa99158['type']!=='VIRTUAL'){var _0x5e0f1a={};_0x5e0f1a[_0xa99158['name']]={'$like':'%'+_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x39')]+'%'};return _0x5e0f1a;}})});}_0x2d306c=_[_0x8d4a('0x3a')]({},_0x2d306c,_0x3e6bcc[_0x8d4a('0x3b')]);var _0x545f7d={'where':_0x2d306c['where']};return db['FaxTransferReport'][_0x8d4a('0x19')](_0x545f7d)[_0x8d4a('0x21')](function(_0x3c232b){_0x27f3e0[_0x8d4a('0x19')]=_0x3c232b;if(_0x3e6bcc[_0x8d4a('0x2c')][_0x8d4a('0x3c')]){_0x2d306c[_0x8d4a('0x3d')]=[{'all':!![]}];}return db[_0x8d4a('0x27')][_0x8d4a('0x3e')](_0x2d306c);})[_0x8d4a('0x21')](function(_0x57f608){_0x27f3e0['rows']=_0x57f608;return _0x27f3e0;})['then'](respondWithFilteredResult(_0x4317d0,_0x2d306c))[_0x8d4a('0x3f')](handleError(_0x4317d0,null));};exports['show']=function(_0x3f24fb,_0x19b562){var _0x109a04={'raw':!![],'where':{'id':_0x3f24fb[_0x8d4a('0x40')]['id']}},_0x3d78b9={};_0x3d78b9[_0x8d4a('0x2b')]=_[_0x8d4a('0x2d')](db[_0x8d4a('0x27')][_0x8d4a('0x28')]);_0x3d78b9[_0x8d4a('0x2c')]=_[_0x8d4a('0x2d')](_0x3f24fb['query']);_0x3d78b9['filters']=_[_0x8d4a('0x2f')](_0x3d78b9[_0x8d4a('0x2b')],_0x3d78b9[_0x8d4a('0x2c')]);_0x109a04[_0x8d4a('0x30')]=_['intersection'](_0x3d78b9[_0x8d4a('0x2b')],qs[_0x8d4a('0x31')](_0x3f24fb[_0x8d4a('0x2c')]['fields']));_0x109a04[_0x8d4a('0x30')]=_0x109a04['attributes']['length']?_0x109a04[_0x8d4a('0x30')]:_0x3d78b9[_0x8d4a('0x2b')];if(_0x3f24fb[_0x8d4a('0x2c')]['includeAll']){_0x109a04[_0x8d4a('0x3d')]=[{'all':!![]}];}_0x109a04=_[_0x8d4a('0x3a')]({},_0x109a04,_0x3f24fb['options']);return db[_0x8d4a('0x27')][_0x8d4a('0x41')](_0x109a04)[_0x8d4a('0x21')](handleEntityNotFound(_0x19b562,null))[_0x8d4a('0x21')](respondWithResult(_0x19b562,null))[_0x8d4a('0x3f')](handleError(_0x19b562,null));};exports[_0x8d4a('0x42')]=function(_0x468a9d,_0xabb666){return db[_0x8d4a('0x27')][_0x8d4a('0x42')](_0x468a9d[_0x8d4a('0x43')],{})[_0x8d4a('0x21')](respondWithResult(_0xabb666,0xc9))[_0x8d4a('0x3f')](handleError(_0xabb666,null));};exports[_0x8d4a('0x20')]=function(_0x361a57,_0x322422){if(_0x361a57['body']['id']){delete _0x361a57[_0x8d4a('0x43')]['id'];}return db[_0x8d4a('0x27')][_0x8d4a('0x41')]({'where':{'id':_0x361a57['params']['id']}})['then'](handleEntityNotFound(_0x322422,null))[_0x8d4a('0x21')](saveUpdates(_0x361a57[_0x8d4a('0x43')],null))[_0x8d4a('0x21')](respondWithResult(_0x322422,null))[_0x8d4a('0x3f')](handleError(_0x322422,null));};exports[_0x8d4a('0x44')]=function(_0x3538cb,_0x58940b){return db[_0x8d4a('0x27')][_0x8d4a('0x41')]({'where':{'id':_0x3538cb[_0x8d4a('0x40')]['id']}})[_0x8d4a('0x21')](handleEntityNotFound(_0x58940b,null))[_0x8d4a('0x21')](removeEntity(_0x58940b,null))[_0x8d4a('0x3f')](handleError(_0x58940b,null));};exports[_0x8d4a('0x45')]=function(_0x215aeb,_0x1d2e4e){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0x1d2e4e,null))[_0x8d4a('0x3f')](handleError(_0x1d2e4e,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a534681..9ebb766 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 _0xc23d=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer'];(function(_0x28c5c8,_0x361bf0){var _0x295f37=function(_0x42d67c){while(--_0x42d67c){_0x28c5c8['push'](_0x28c5c8['shift']());}};_0x295f37(++_0x361bf0);}(_0xc23d,0x7f));var _0xdc23=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0xc23d[_0x1d2bc8];return _0x1857e1;};'use strict';var _=require(_0xdc23('0x0'));var util=require(_0xdc23('0x1'));var logger=require(_0xdc23('0x2'))(_0xdc23('0x3'));var moment=require(_0xdc23('0x4'));var BPromise=require(_0xdc23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc23('0x6'));var rimraf=require(_0xdc23('0x7'));var config=require(_0xdc23('0x8'));var attributes=require(_0xdc23('0x9'));module[_0xdc23('0xa')]=function(_0x5b6bec,_0x4a153f){return _0x5b6bec[_0xdc23('0xb')]('FaxTransferReport',attributes,{'tableName':_0xdc23('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdc23('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbd5=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4333d9,_0x19ed89){var _0x212cfb=function(_0x5a2bfb){while(--_0x5a2bfb){_0x4333d9['push'](_0x4333d9['shift']());}};_0x212cfb(++_0x19ed89);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x157f32,_0x385930){_0x157f32=_0x157f32-0x0;var _0x29021c=_0xfbd5[_0x157f32];return _0x29021c;};'use strict';var _=require('lodash');var util=require(_0x5fbd('0x0'));var logger=require('../../config/logger')(_0x5fbd('0x1'));var moment=require('moment');var BPromise=require(_0x5fbd('0x2'));var rp=require(_0x5fbd('0x3'));var fs=require('fs');var path=require(_0x5fbd('0x4'));var rimraf=require(_0x5fbd('0x5'));var config=require(_0x5fbd('0x6'));var attributes=require(_0x5fbd('0x7'));module[_0x5fbd('0x8')]=function(_0x882036,_0x56fdaa){return _0x882036[_0x5fbd('0x9')](_0x5fbd('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5fbd('0xb'),'fields':[_0x5fbd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5223bbb..25d21cf 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 _0x5cb5=['message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2b50ea,_0x4cb59b){var _0x2568b2=function(_0x290d2b){while(--_0x290d2b){_0x2b50ea['push'](_0x2b50ea['shift']());}};_0x2568b2(++_0x4cb59b);}(_0x5cb5,0xd2));var _0x55cb=function(_0x265e2a,_0x1782b6){_0x265e2a=_0x265e2a-0x0;var _0x47b038=_0x5cb5[_0x265e2a];return _0x47b038;};'use strict';var _=require('lodash');var util=require(_0x55cb('0x0'));var moment=require(_0x55cb('0x1'));var BPromise=require(_0x55cb('0x2'));var rs=require(_0x55cb('0x3'));var fs=require('fs');var Redis=require(_0x55cb('0x4'));var db=require(_0x55cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x55cb('0x6'));var config=require(_0x55cb('0x7'));var jayson=require(_0x55cb('0x8'));var client=jayson[_0x55cb('0x9')][_0x55cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359395,_0x3abb6a,_0x6149f0){return new BPromise(function(_0x547002,_0x339b09){return client[_0x55cb('0xb')](_0x359395,_0x6149f0)[_0x55cb('0xc')](function(_0xb2a344){logger[_0x55cb('0xd')](_0x55cb('0xe'),_0x3abb6a,'request\x20sent');logger[_0x55cb('0xf')](_0x55cb('0x10'),_0x3abb6a,'request\x20sent',JSON[_0x55cb('0x11')](_0xb2a344));if(_0xb2a344['error']){if(_0xb2a344['error'][_0x55cb('0x12')]===0x1f4){logger[_0x55cb('0x13')](_0x55cb('0xe'),_0x3abb6a,_0xb2a344[_0x55cb('0x13')]['message']);return _0x339b09(_0xb2a344[_0x55cb('0x13')][_0x55cb('0x14')]);}logger[_0x55cb('0x13')](_0x55cb('0xe'),_0x3abb6a,_0xb2a344[_0x55cb('0x13')][_0x55cb('0x14')]);return _0x547002(_0xb2a344[_0x55cb('0x13')][_0x55cb('0x14')]);}else{logger[_0x55cb('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x3abb6a,_0x55cb('0x15'));_0x547002(_0xb2a344[_0x55cb('0x16')][_0x55cb('0x14')]);}})['catch'](function(_0x4aa3cd){logger['error'](_0x55cb('0xe'),_0x3abb6a,_0x4aa3cd);_0x339b09(_0x4aa3cd);});});} \ No newline at end of file +var _0xc80f=['request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5eeb43,_0x5b900c){var _0x54aa94=function(_0x1d09b0){while(--_0x1d09b0){_0x5eeb43['push'](_0x5eeb43['shift']());}};_0x54aa94(++_0x5b900c);}(_0xc80f,0x102));var _0xfc80=function(_0x46ae40,_0x3f37bc){_0x46ae40=_0x46ae40-0x0;var _0x33785c=_0xc80f[_0x46ae40];return _0x33785c;};'use strict';var _=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var moment=require(_0xfc80('0x2'));var BPromise=require(_0xfc80('0x3'));var rs=require(_0xfc80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc80('0x6'))('rpc');var config=require(_0xfc80('0x7'));var jayson=require(_0xfc80('0x8'));var client=jayson[_0xfc80('0x9')][_0xfc80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dfc24,_0x5b416f,_0x1fb974){return new BPromise(function(_0x24c973,_0x2679bb){return client[_0xfc80('0xb')](_0x2dfc24,_0x1fb974)['then'](function(_0x571b12){logger['info'](_0xfc80('0xc'),_0x5b416f,'request\x20sent');logger[_0xfc80('0xd')](_0xfc80('0xe'),_0x5b416f,_0xfc80('0xf'),JSON[_0xfc80('0x10')](_0x571b12));if(_0x571b12[_0xfc80('0x11')]){if(_0x571b12[_0xfc80('0x11')]['code']===0x1f4){logger[_0xfc80('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5b416f,_0x571b12[_0xfc80('0x11')][_0xfc80('0x12')]);return _0x2679bb(_0x571b12[_0xfc80('0x11')][_0xfc80('0x12')]);}logger['error'](_0xfc80('0xc'),_0x5b416f,_0x571b12['error'][_0xfc80('0x12')]);return _0x24c973(_0x571b12[_0xfc80('0x11')]['message']);}else{logger[_0xfc80('0x13')](_0xfc80('0xc'),_0x5b416f,_0xfc80('0xf'));_0x24c973(_0x571b12['result'][_0xfc80('0x12')]);}})[_0xfc80('0x14')](function(_0x3dba24){logger[_0xfc80('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5b416f,_0x3dba24);_0x2679bb(_0x3dba24);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 39ab393..e1e979e 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 _0x216f=['put','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x216f,0x135));var _0xf216=function(_0x879445,_0x14e128){_0x879445=_0x879445-0x0;var _0x414628=_0x216f[_0x879445];return _0x414628;};'use strict';var multer=require(_0xf216('0x0'));var util=require(_0xf216('0x1'));var path=require(_0xf216('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf216('0x3')]();var fs_extra=require(_0xf216('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf216('0x5'));var config=require(_0xf216('0x6'));var controller=require(_0xf216('0x7'));router[_0xf216('0x8')]('/',auth[_0xf216('0x9')](),controller[_0xf216('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf216('0xb')]);router[_0xf216('0x8')](_0xf216('0xc'),auth[_0xf216('0x9')](),controller['show']);router[_0xf216('0xd')]('/',auth['isAuthenticated'](),controller[_0xf216('0xe')]);router[_0xf216('0xf')]('/:id',auth[_0xf216('0x9')](),controller['update']);router[_0xf216('0x10')](_0xf216('0xc'),auth[_0xf216('0x9')](),controller['destroy']);module[_0xf216('0x11')]=router; \ No newline at end of file +var _0x12a8=['destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','delete'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x12a8,0xce));var _0x812a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x12a8[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x812a('0x0'));var express=require(_0x812a('0x1'));var router=express[_0x812a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x812a('0x3'));var config=require(_0x812a('0x4'));var controller=require(_0x812a('0x5'));router[_0x812a('0x6')]('/',auth['isAuthenticated'](),controller[_0x812a('0x7')]);router[_0x812a('0x6')](_0x812a('0x8'),auth[_0x812a('0x9')](),controller[_0x812a('0xa')]);router['get'](_0x812a('0xb'),auth[_0x812a('0x9')](),controller[_0x812a('0xc')]);router['post']('/',auth[_0x812a('0x9')](),controller['create']);router[_0x812a('0xd')](_0x812a('0xb'),auth[_0x812a('0x9')](),controller['update']);router[_0x812a('0xe')](_0x812a('0xb'),auth[_0x812a('0x9')](),controller[_0x812a('0xf')]);module[_0x812a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6432080..c5e73d5 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 _0x143b=['./intDeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','post','create','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x143b,0xf6));var _0xb143=function(_0x3839a8,_0xef990d){_0x3839a8=_0x3839a8-0x0;var _0x41d155=_0x143b[_0x3839a8];return _0x41d155;};'use strict';var multer=require(_0xb143('0x0'));var util=require('util');var path=require(_0xb143('0x1'));var timeout=require('connect-timeout');var express=require(_0xb143('0x2'));var router=express[_0xb143('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb143('0x4'));var config=require(_0xb143('0x5'));var controller=require(_0xb143('0x6'));router['get']('/',auth[_0xb143('0x7')](),controller[_0xb143('0x8')]);router['get'](_0xb143('0x9'),auth[_0xb143('0x7')](),controller[_0xb143('0xa')]);router[_0xb143('0xb')](_0xb143('0xc'),auth['isAuthenticated'](),controller[_0xb143('0xd')]);router[_0xb143('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xb143('0xe')]('/',auth[_0xb143('0x7')](),controller[_0xb143('0xf')]);router['post'](_0xb143('0xc'),auth[_0xb143('0x7')](),controller['addConfiguration']);router['put'](_0xb143('0x9'),auth['isAuthenticated'](),controller[_0xb143('0x10')]);router['delete'](_0xb143('0x9'),auth[_0xb143('0x7')](),controller['destroy']);module[_0xb143('0x11')]=router; \ No newline at end of file +var _0x46e5=['Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xa9f756,_0x48c454){var _0x10fcdb=function(_0x4c291f){while(--_0x4c291f){_0xa9f756['push'](_0xa9f756['shift']());}};_0x10fcdb(++_0x48c454);}(_0x46e5,0x11c));var _0x546e=function(_0x521b12,_0x1a0f54){_0x521b12=_0x521b12-0x0;var _0x41b937=_0x46e5[_0x521b12];return _0x41b937;};'use strict';var multer=require(_0x546e('0x0'));var util=require(_0x546e('0x1'));var path=require(_0x546e('0x2'));var timeout=require(_0x546e('0x3'));var express=require('express');var router=express[_0x546e('0x4')]();var fs_extra=require(_0x546e('0x5'));var auth=require(_0x546e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x546e('0x7'));var controller=require('./intDeskAccount.controller');router[_0x546e('0x8')]('/',auth['isAuthenticated'](),controller[_0x546e('0x9')]);router[_0x546e('0x8')](_0x546e('0xa'),auth[_0x546e('0xb')](),controller[_0x546e('0xc')]);router[_0x546e('0x8')](_0x546e('0xd'),auth[_0x546e('0xb')](),controller[_0x546e('0xe')]);router[_0x546e('0x8')](_0x546e('0xf'),auth[_0x546e('0xb')](),controller[_0x546e('0x10')]);router[_0x546e('0x11')]('/',auth['isAuthenticated'](),controller[_0x546e('0x12')]);router[_0x546e('0x11')]('/:id/configurations',auth[_0x546e('0xb')](),controller[_0x546e('0x13')]);router[_0x546e('0x14')](_0x546e('0xa'),auth[_0x546e('0xb')](),controller[_0x546e('0x15')]);router[_0x546e('0x16')](_0x546e('0xa'),auth[_0x546e('0xb')](),controller[_0x546e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2cc9e4c..0dc5a44 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 _0xc2c3=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x23b3de,_0x51fb7e){var _0xe9c52a=function(_0x230412){while(--_0x230412){_0x23b3de['push'](_0x23b3de['shift']());}};_0xe9c52a(++_0x51fb7e);}(_0xc2c3,0x11a));var _0x3c2c=function(_0x2a6f0b,_0xed2ec){_0x2a6f0b=_0x2a6f0b-0x0;var _0x4bf4c6=_0xc2c3[_0x2a6f0b];return _0x4bf4c6;};'use strict';var Sequelize=require(_0x3c2c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c2c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3c2c('0x1')]},'authType':{'type':Sequelize[_0x3c2c('0x2')](_0x3c2c('0x3')),'defaultValue':_0x3c2c('0x3')},'password':{'type':Sequelize[_0x3c2c('0x1')]},'consumerKey':{'type':Sequelize[_0x3c2c('0x1')]},'consumerSecret':{'type':Sequelize[_0x3c2c('0x1')]},'token':{'type':Sequelize[_0x3c2c('0x1')]},'tokenSecret':{'type':Sequelize[_0x3c2c('0x1')]},'serverUrl':{'type':Sequelize[_0x3c2c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3c2c('0x2')](_0x3c2c('0x4'),_0x3c2c('0x5')),'defaultValue':_0x3c2c('0x4')}}; \ No newline at end of file +var _0x79a5=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x79a5,0x176));var _0x579a=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x79a5[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require('sequelize');module[_0x579a('0x0')]={'name':{'type':Sequelize[_0x579a('0x1')]},'description':{'type':Sequelize[_0x579a('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x579a('0x1')]},'authType':{'type':Sequelize[_0x579a('0x2')](_0x579a('0x3')),'defaultValue':_0x579a('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x579a('0x1')]},'consumerSecret':{'type':Sequelize[_0x579a('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x579a('0x1')]},'serverUrl':{'type':Sequelize[_0x579a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x579a('0x4'),_0x579a('0x5')),'defaultValue':_0x579a('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7ad9947..4065189 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 _0x8c9d=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','DeskAccount','then','includeAll','include','catch','show','params','rawAttributes','intersection','length','find','create','body','getConfigurations','findOne','DeskConfiguration','sort','AccountId','getSubjects','channel','Subjects','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','%s/custom_fields','application/json','basic','format','toString','base64','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x3be1a0,_0x4e785c){var _0x16d727=function(_0x2c2c78){while(--_0x2c2c78){_0x3be1a0['push'](_0x3be1a0['shift']());}};_0x16d727(++_0x4e785c);}(_0x8c9d,0xce));var _0xd8c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8c9d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xd8c9('0x0'));var rimraf=require(_0xd8c9('0x1'));var zipdir=require(_0xd8c9('0x2'));var jsonpatch=require(_0xd8c9('0x3'));var rp=require(_0xd8c9('0x4'));var moment=require(_0xd8c9('0x5'));var BPromise=require(_0xd8c9('0x6'));var Mustache=require('mustache');var util=require(_0xd8c9('0x7'));var path=require(_0xd8c9('0x8'));var sox=require('sox');var csv=require(_0xd8c9('0x9'));var ejs=require(_0xd8c9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8c9('0xb'));var squel=require(_0xd8c9('0xc'));var crypto=require(_0xd8c9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd8c9('0x9'));var querystring=require(_0xd8c9('0xe'));var Papa=require(_0xd8c9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8c9('0x10'));var as=require(_0xd8c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8c9('0x12'))(_0xd8c9('0x13'));var utils=require(_0xd8c9('0x14'));var config=require(_0xd8c9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8c9('0x16'))['db'];var integrations=require(_0xd8c9('0x17'));function respondWithStatusCode(_0x5231d4,_0x2af7cd){_0x2af7cd=_0x2af7cd||0xcc;return function(_0x236f32){if(_0x236f32){return _0x5231d4['sendStatus'](_0x2af7cd);}return _0x5231d4[_0xd8c9('0x18')](_0x2af7cd)[_0xd8c9('0x19')]();};}function respondWithResult(_0x2bc86c,_0x3649db){_0x3649db=_0x3649db||0xc8;return function(_0x2f7003){if(_0x2f7003){return _0x2bc86c['status'](_0x3649db)['json'](_0x2f7003);}};}function respondWithFilteredResult(_0xba0538,_0x4a2664){return function(_0x263827){if(_0x263827){var _0x3fa29c=typeof _0x4a2664[_0xd8c9('0x1a')]==='undefined'&&typeof _0x4a2664['limit']===_0xd8c9('0x1b');var _0x5e6ff1=_0x263827[_0xd8c9('0x1c')];var _0x224da5=_0x3fa29c?0x0:_0x4a2664[_0xd8c9('0x1a')];var _0x414f76=_0x3fa29c?_0x263827['count']:_0x4a2664[_0xd8c9('0x1a')]+_0x4a2664['limit'];var _0x34b571;if(_0x414f76>=_0x5e6ff1){_0x414f76=_0x5e6ff1;_0x34b571=0xc8;}else{_0x34b571=0xce;}_0xba0538[_0xd8c9('0x18')](_0x34b571);return _0xba0538[_0xd8c9('0x1d')](_0xd8c9('0x1e'),_0x224da5+'-'+_0x414f76+'/'+_0x5e6ff1)['json'](_0x263827);}return null;};}function patchUpdates(_0x3afa37){return function(_0x20eced){try{jsonpatch[_0xd8c9('0x1f')](_0x20eced,_0x3afa37,!![]);}catch(_0x5822a4){return BPromise[_0xd8c9('0x20')](_0x5822a4);}return _0x20eced['save']();};}function saveUpdates(_0x24f7f5,_0x136988){return function(_0x50abb1){if(_0x50abb1){return _0x50abb1[_0xd8c9('0x21')](_0x24f7f5)['then'](function(_0x5184c5){return _0x5184c5;});}return null;};}function removeEntity(_0xfb5b35,_0x34867a){return function(_0x5e4438){if(_0x5e4438){return _0x5e4438[_0xd8c9('0x22')]()['then'](function(){_0xfb5b35[_0xd8c9('0x18')](0xcc)[_0xd8c9('0x19')]();});}};}function handleEntityNotFound(_0x1692eb,_0x427aee){return function(_0x2701ae){if(!_0x2701ae){_0x1692eb[_0xd8c9('0x23')](0x194);}return _0x2701ae;};}function handleError(_0x12f6c1,_0x2155a1){_0x2155a1=_0x2155a1||0x1f4;return function(_0x4eb9f6){logger[_0xd8c9('0x24')](_0x4eb9f6[_0xd8c9('0x25')]);if(_0x4eb9f6[_0xd8c9('0x26')]){delete _0x4eb9f6[_0xd8c9('0x26')];}_0x12f6c1[_0xd8c9('0x18')](_0x2155a1)[_0xd8c9('0x27')](_0x4eb9f6);};}exports[_0xd8c9('0x28')]=function(_0x435aff,_0x200bc3){var _0x2ea4e8={},_0x3b7ae9={},_0x49363a={'count':0x0,'rows':[]};var _0x14a819=_['map'](db['DeskAccount']['rawAttributes'],function(_0x45a140){return{'name':_0x45a140[_0xd8c9('0x29')],'type':_0x45a140[_0xd8c9('0x2a')][_0xd8c9('0x2b')]};});_0x3b7ae9[_0xd8c9('0x2c')]=_[_0xd8c9('0x2d')](_0x14a819,_0xd8c9('0x26'));_0x3b7ae9[_0xd8c9('0x2e')]=_[_0xd8c9('0x2f')](_0x435aff[_0xd8c9('0x2e')]);_0x3b7ae9[_0xd8c9('0x30')]=_['intersection'](_0x3b7ae9[_0xd8c9('0x2c')],_0x3b7ae9['query']);_0x2ea4e8[_0xd8c9('0x31')]=_['intersection'](_0x3b7ae9[_0xd8c9('0x2c')],qs[_0xd8c9('0x32')](_0x435aff['query'][_0xd8c9('0x32')]));_0x2ea4e8[_0xd8c9('0x31')]=_0x2ea4e8[_0xd8c9('0x31')]['length']?_0x2ea4e8[_0xd8c9('0x31')]:_0x3b7ae9['model'];if(!_0x435aff[_0xd8c9('0x2e')][_0xd8c9('0x33')](_0xd8c9('0x34'))){_0x2ea4e8[_0xd8c9('0x35')]=qs['limit'](_0x435aff[_0xd8c9('0x2e')][_0xd8c9('0x35')]);_0x2ea4e8[_0xd8c9('0x1a')]=qs[_0xd8c9('0x1a')](_0x435aff['query']['offset']);}_0x2ea4e8[_0xd8c9('0x36')]=qs['sort'](_0x435aff[_0xd8c9('0x2e')]['sort']);_0x2ea4e8[_0xd8c9('0x37')]=qs[_0xd8c9('0x30')](_[_0xd8c9('0x38')](_0x435aff[_0xd8c9('0x2e')],_0x3b7ae9[_0xd8c9('0x30')]),_0x14a819);if(_0x435aff['query']['filter']){_0x2ea4e8[_0xd8c9('0x37')]=_[_0xd8c9('0x39')](_0x2ea4e8[_0xd8c9('0x37')],{'$or':_[_0xd8c9('0x2d')](_0x14a819,function(_0x5082d6){if(_0x5082d6[_0xd8c9('0x2a')]!==_0xd8c9('0x3a')){var _0x90d6ff={};_0x90d6ff[_0x5082d6[_0xd8c9('0x26')]]={'$like':'%'+_0x435aff[_0xd8c9('0x2e')][_0xd8c9('0x3b')]+'%'};return _0x90d6ff;}})});}_0x2ea4e8=_[_0xd8c9('0x39')]({},_0x2ea4e8,_0x435aff[_0xd8c9('0x3c')]);var _0x2022aa={'where':_0x2ea4e8['where']};return db[_0xd8c9('0x3d')][_0xd8c9('0x1c')](_0x2022aa)[_0xd8c9('0x3e')](function(_0x4c3253){_0x49363a['count']=_0x4c3253;if(_0x435aff[_0xd8c9('0x2e')][_0xd8c9('0x3f')]){_0x2ea4e8[_0xd8c9('0x40')]=[{'all':!![]}];}return db[_0xd8c9('0x3d')]['findAll'](_0x2ea4e8);})[_0xd8c9('0x3e')](function(_0x38b376){_0x49363a['rows']=_0x38b376;return _0x49363a;})[_0xd8c9('0x3e')](respondWithFilteredResult(_0x200bc3,_0x2ea4e8))[_0xd8c9('0x41')](handleError(_0x200bc3,null));};exports[_0xd8c9('0x42')]=function(_0x1b7df6,_0x1bee32){var _0x2e48af={'raw':![],'where':{'id':_0x1b7df6[_0xd8c9('0x43')]['id']}},_0xaeed51={};_0xaeed51[_0xd8c9('0x2c')]=_['keys'](db[_0xd8c9('0x3d')][_0xd8c9('0x44')]);_0xaeed51[_0xd8c9('0x2e')]=_[_0xd8c9('0x2f')](_0x1b7df6[_0xd8c9('0x2e')]);_0xaeed51[_0xd8c9('0x30')]=_[_0xd8c9('0x45')](_0xaeed51[_0xd8c9('0x2c')],_0xaeed51[_0xd8c9('0x2e')]);_0x2e48af[_0xd8c9('0x31')]=_['intersection'](_0xaeed51[_0xd8c9('0x2c')],qs[_0xd8c9('0x32')](_0x1b7df6[_0xd8c9('0x2e')][_0xd8c9('0x32')]));_0x2e48af[_0xd8c9('0x31')]=_0x2e48af[_0xd8c9('0x31')][_0xd8c9('0x46')]?_0x2e48af['attributes']:_0xaeed51[_0xd8c9('0x2c')];if(_0x1b7df6[_0xd8c9('0x2e')][_0xd8c9('0x3f')]){_0x2e48af[_0xd8c9('0x40')]=[{'all':!![]}];}_0x2e48af=_[_0xd8c9('0x39')]({},_0x2e48af,_0x1b7df6[_0xd8c9('0x3c')]);return db['DeskAccount'][_0xd8c9('0x47')](_0x2e48af)[_0xd8c9('0x3e')](handleEntityNotFound(_0x1bee32,null))[_0xd8c9('0x3e')](respondWithResult(_0x1bee32,null))[_0xd8c9('0x41')](handleError(_0x1bee32,null));};exports[_0xd8c9('0x48')]=function(_0x8a4606,_0x42faca){return db[_0xd8c9('0x3d')][_0xd8c9('0x48')](_0x8a4606['body'],{})[_0xd8c9('0x3e')](respondWithResult(_0x42faca,0xc9))[_0xd8c9('0x41')](handleError(_0x42faca,null));};exports[_0xd8c9('0x21')]=function(_0x1cf7d2,_0x2e01c0){if(_0x1cf7d2[_0xd8c9('0x49')]['id']){delete _0x1cf7d2['body']['id'];}return db[_0xd8c9('0x3d')][_0xd8c9('0x47')]({'where':{'id':_0x1cf7d2[_0xd8c9('0x43')]['id']}})[_0xd8c9('0x3e')](handleEntityNotFound(_0x2e01c0,null))['then'](saveUpdates(_0x1cf7d2[_0xd8c9('0x49')],null))[_0xd8c9('0x3e')](respondWithResult(_0x2e01c0,null))[_0xd8c9('0x41')](handleError(_0x2e01c0,null));};exports[_0xd8c9('0x22')]=function(_0x1c3078,_0x2762ad){return db[_0xd8c9('0x3d')][_0xd8c9('0x47')]({'where':{'id':_0x1c3078[_0xd8c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2762ad,null))[_0xd8c9('0x3e')](removeEntity(_0x2762ad,null))['catch'](handleError(_0x2762ad,null));};exports[_0xd8c9('0x4a')]=function(_0xac0f93,_0x31621b,_0x49cdcb){var _0x1d1145={};var _0x252902={};var _0x58711a;var _0x485381;return db['DeskAccount'][_0xd8c9('0x4b')]({'where':{'id':_0xac0f93['params']['id']}})[_0xd8c9('0x3e')](handleEntityNotFound(_0x31621b,null))[_0xd8c9('0x3e')](function(_0x5ed5cd){if(_0x5ed5cd){_0x58711a=_0x5ed5cd;_0x252902[_0xd8c9('0x2c')]=_[_0xd8c9('0x2f')](db[_0xd8c9('0x4c')][_0xd8c9('0x44')]);_0x252902[_0xd8c9('0x2e')]=_[_0xd8c9('0x2f')](_0xac0f93['query']);_0x252902['filters']=_[_0xd8c9('0x45')](_0x252902[_0xd8c9('0x2c')],_0x252902['query']);_0x1d1145[_0xd8c9('0x31')]=_[_0xd8c9('0x45')](_0x252902[_0xd8c9('0x2c')],qs[_0xd8c9('0x32')](_0xac0f93['query'][_0xd8c9('0x32')]));_0x1d1145[_0xd8c9('0x31')]=_0x1d1145[_0xd8c9('0x31')][_0xd8c9('0x46')]?_0x1d1145[_0xd8c9('0x31')]:_0x252902[_0xd8c9('0x2c')];_0x1d1145[_0xd8c9('0x36')]=qs[_0xd8c9('0x4d')](_0xac0f93[_0xd8c9('0x2e')][_0xd8c9('0x4d')]);_0x1d1145[_0xd8c9('0x37')]=qs['filters'](_[_0xd8c9('0x38')](_0xac0f93[_0xd8c9('0x2e')],_0x252902['filters']));if(_0xac0f93[_0xd8c9('0x2e')][_0xd8c9('0x3b')]){_0x1d1145[_0xd8c9('0x37')]=_[_0xd8c9('0x39')](_0x1d1145['where'],{'$or':_[_0xd8c9('0x2d')](_0x1d1145['attributes'],function(_0x10fdb1){var _0x432b4c={};_0x432b4c[_0x10fdb1]={'$like':'%'+_0xac0f93[_0xd8c9('0x2e')][_0xd8c9('0x3b')]+'%'};return _0x432b4c;})});}_0x1d1145=_[_0xd8c9('0x39')]({},_0x1d1145,_0xac0f93[_0xd8c9('0x3c')]);return _0x58711a[_0xd8c9('0x4a')](_0x1d1145);}})[_0xd8c9('0x3e')](function(_0x17bb97){if(_0x17bb97){_0x485381=_0x17bb97[_0xd8c9('0x46')];if(!_0xac0f93['query']['hasOwnProperty'](_0xd8c9('0x34'))){_0x1d1145[_0xd8c9('0x35')]=qs['limit'](_0xac0f93['query'][_0xd8c9('0x35')]);_0x1d1145[_0xd8c9('0x1a')]=qs[_0xd8c9('0x1a')](_0xac0f93[_0xd8c9('0x2e')][_0xd8c9('0x1a')]);}return _0x58711a['getConfigurations'](_0x1d1145);}})['then'](function(_0x9a3747){if(_0x9a3747){return _0x9a3747?{'count':_0x485381,'rows':_0x9a3747}:null;}})[_0xd8c9('0x3e')](respondWithResult(_0x31621b,null))['catch'](handleError(_0x31621b,null));};exports['addConfiguration']=function(_0x29ff68,_0x548217,_0x2ef7aa){if(_0x29ff68['body']['id']){delete _0x29ff68[_0xd8c9('0x49')]['id'];}return db['DeskAccount'][_0xd8c9('0x4b')]({'where':{'id':_0x29ff68[_0xd8c9('0x43')]['id']}})[_0xd8c9('0x3e')](handleEntityNotFound(_0x548217,null))[_0xd8c9('0x3e')](function(_0x431d65){if(_0x431d65){_0x29ff68[_0xd8c9('0x49')][_0xd8c9('0x4e')]=_0x431d65['id'];_0x29ff68['body']['Subjects']=integrations[_0xd8c9('0x4f')](_0x29ff68['body'][_0xd8c9('0x50')],_0x29ff68[_0xd8c9('0x49')][_0xd8c9('0x2a')]);_0x29ff68[_0xd8c9('0x49')]['Descriptions']=integrations['getDescriptions'](_0x29ff68[_0xd8c9('0x49')][_0xd8c9('0x50')],_0x29ff68[_0xd8c9('0x49')][_0xd8c9('0x2a')]);return db[_0xd8c9('0x4c')][_0xd8c9('0x48')](_0x29ff68[_0xd8c9('0x49')],{'include':[{'model':db['DeskField'],'as':_0xd8c9('0x51')},{'model':db[_0xd8c9('0x52')],'as':_0xd8c9('0x53')}]});}return null;})[_0xd8c9('0x3e')](respondWithResult(_0x548217,null))[_0xd8c9('0x41')](handleError(_0x548217,null));};exports['getFields']=function(_0x41c155,_0x5c3dbe,_0x526f5c){var _0x230224=[{'name':_0xd8c9('0x54'),'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 _0x54aeb2='';return db[_0xd8c9('0x3d')][_0xd8c9('0x4b')]({'where':{'id':_0x41c155['params']['id']},'attributes':['id',_0xd8c9('0x55'),_0xd8c9('0x56'),_0xd8c9('0x57'),_0xd8c9('0x58'),_0xd8c9('0x59'),_0xd8c9('0x5a'),'token',_0xd8c9('0x5b')]})[_0xd8c9('0x3e')](handleEntityNotFound(_0x5c3dbe,null))[_0xd8c9('0x3e')](function(_0x4f29fd){if(_0x4f29fd){_0x54aeb2=_0x4f29fd[_0xd8c9('0x55')];var _0x249e60=_0x54aeb2[_0xd8c9('0x5c')](-0x1);if(_0x249e60==='/'){_0x54aeb2=_0x54aeb2[_0xd8c9('0x5d')](0x0,_0x54aeb2[_0xd8c9('0x5e')](_0x249e60));}var _0x169881={'method':'GET','uri':util['format'](_0xd8c9('0x5f'),_0x54aeb2),'headers':{'Content-Type':_0xd8c9('0x60'),'Accept':_0xd8c9('0x60')},'json':!![]};if(_0x4f29fd['authType']===_0xd8c9('0x61')){_0x169881['headers']['Authorization']=util[_0xd8c9('0x62')]('Basic\x20%s',new Buffer(util[_0xd8c9('0x62')]('%s:%s',_0x4f29fd[_0xd8c9('0x57')],_0x4f29fd[_0xd8c9('0x58')]))[_0xd8c9('0x63')](_0xd8c9('0x64')));}return rp(_0x169881)[_0xd8c9('0x3e')](function(_0x3992eb){return _0x230224[_0xd8c9('0x65')](_[_0xd8c9('0x2d')](_0x3992eb[_0xd8c9('0x66')]['entries'],function(_0x4ee72c){return{'id':_0x4ee72c[_0xd8c9('0x26')],'name':_0x4ee72c[_0xd8c9('0x26')],'type':_0x4ee72c[_0xd8c9('0x2a')],'active':_0x4ee72c[_0xd8c9('0x67')],'label':_0x4ee72c['label'],'custom':!![]};}));});}})[_0xd8c9('0x3e')](function(_0xdf35ea){return{'count':_0xdf35ea[_0xd8c9('0x46')],'rows':_0xdf35ea};})[_0xd8c9('0x3e')](respondWithResult(_0x5c3dbe,null))[_0xd8c9('0x41')](function(_0xf7d6a5){var _0x2ec80c=_0x41c155[_0xd8c9('0x2e')][_0xd8c9('0x68')]?0x1f4:_0xf7d6a5[_0xd8c9('0x69')]||0x1f4;logger['error'](_0xd8c9('0x6a'),_0xd8c9('0x6b'),_0x2ec80c,JSON[_0xd8c9('0x6c')](_0xf7d6a5));delete _0xf7d6a5['name'];if(_0x2ec80c===0x191){_0x2ec80c=0x190;}_0x5c3dbe[_0xd8c9('0x18')](_0x2ec80c)[_0xd8c9('0x27')](_0x41c155[_0xd8c9('0x2e')]['test']?{'message':_0xd8c9('0x6d'),'statusCode':_0xf7d6a5[_0xd8c9('0x69')]}:_0xf7d6a5);});}; \ No newline at end of file +var _0x7f8f=['getSubjects','Descriptions','getDescriptions','channel','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','substring','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','DeskAccount','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','AccountId'];(function(_0x3c8609,_0x23a747){var _0x4b2e40=function(_0x1297ed){while(--_0x1297ed){_0x3c8609['push'](_0x3c8609['shift']());}};_0x4b2e40(++_0x23a747);}(_0x7f8f,0xff));var _0xf7f8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f8f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7f8('0x0'));var zipdir=require(_0xf7f8('0x1'));var jsonpatch=require(_0xf7f8('0x2'));var rp=require(_0xf7f8('0x3'));var moment=require(_0xf7f8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7f8('0x5'));var util=require(_0xf7f8('0x6'));var path=require(_0xf7f8('0x7'));var sox=require('sox');var csv=require(_0xf7f8('0x8'));var ejs=require(_0xf7f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7f8('0xa'));var squel=require(_0xf7f8('0xb'));var crypto=require(_0xf7f8('0xc'));var jsforce=require(_0xf7f8('0xd'));var deskjs=require(_0xf7f8('0xe'));var toCsv=require(_0xf7f8('0x8'));var querystring=require('querystring');var Papa=require(_0xf7f8('0xf'));var Redis=require(_0xf7f8('0x10'));var authService=require(_0xf7f8('0x11'));var qs=require(_0xf7f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf7f8('0x13'));var config=require(_0xf7f8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7f8('0x15'))['db'];var integrations=require(_0xf7f8('0x16'));function respondWithStatusCode(_0x62643c,_0x3bdc9d){_0x3bdc9d=_0x3bdc9d||0xcc;return function(_0x141868){if(_0x141868){return _0x62643c[_0xf7f8('0x17')](_0x3bdc9d);}return _0x62643c[_0xf7f8('0x18')](_0x3bdc9d)['end']();};}function respondWithResult(_0x2d9142,_0x4b12a1){_0x4b12a1=_0x4b12a1||0xc8;return function(_0x533161){if(_0x533161){return _0x2d9142['status'](_0x4b12a1)[_0xf7f8('0x19')](_0x533161);}};}function respondWithFilteredResult(_0x5a61c1,_0x399e1e){return function(_0xa801c3){if(_0xa801c3){var _0xea821d=typeof _0x399e1e[_0xf7f8('0x1a')]===_0xf7f8('0x1b')&&typeof _0x399e1e[_0xf7f8('0x1c')]==='undefined';var _0x3f6c76=_0xa801c3[_0xf7f8('0x1d')];var _0x2aca2b=_0xea821d?0x0:_0x399e1e[_0xf7f8('0x1a')];var _0x47a789=_0xea821d?_0xa801c3[_0xf7f8('0x1d')]:_0x399e1e[_0xf7f8('0x1a')]+_0x399e1e[_0xf7f8('0x1c')];var _0x14ca29;if(_0x47a789>=_0x3f6c76){_0x47a789=_0x3f6c76;_0x14ca29=0xc8;}else{_0x14ca29=0xce;}_0x5a61c1[_0xf7f8('0x18')](_0x14ca29);return _0x5a61c1[_0xf7f8('0x1e')](_0xf7f8('0x1f'),_0x2aca2b+'-'+_0x47a789+'/'+_0x3f6c76)['json'](_0xa801c3);}return null;};}function patchUpdates(_0x558834){return function(_0x517731){try{jsonpatch[_0xf7f8('0x20')](_0x517731,_0x558834,!![]);}catch(_0xc26f90){return BPromise[_0xf7f8('0x21')](_0xc26f90);}return _0x517731[_0xf7f8('0x22')]();};}function saveUpdates(_0x2f80b3,_0x32a051){return function(_0x241717){if(_0x241717){return _0x241717[_0xf7f8('0x23')](_0x2f80b3)[_0xf7f8('0x24')](function(_0x469125){return _0x469125;});}return null;};}function removeEntity(_0x41abef,_0x46e233){return function(_0x330c70){if(_0x330c70){return _0x330c70['destroy']()[_0xf7f8('0x24')](function(){_0x41abef[_0xf7f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95ab84,_0xbdbca3){return function(_0x4e33b0){if(!_0x4e33b0){_0x95ab84[_0xf7f8('0x17')](0x194);}return _0x4e33b0;};}function handleError(_0x53d4a1,_0x4103e1){_0x4103e1=_0x4103e1||0x1f4;return function(_0x3fb8ef){logger[_0xf7f8('0x25')](_0x3fb8ef[_0xf7f8('0x26')]);if(_0x3fb8ef['name']){delete _0x3fb8ef[_0xf7f8('0x27')];}_0x53d4a1[_0xf7f8('0x18')](_0x4103e1)['send'](_0x3fb8ef);};}exports[_0xf7f8('0x28')]=function(_0x154b14,_0x301f8f){var _0x20669f={},_0x55be1d={},_0x5a96a4={'count':0x0,'rows':[]};var _0x3c8282=_[_0xf7f8('0x29')](db[_0xf7f8('0x2a')]['rawAttributes'],function(_0x1e9b7b){return{'name':_0x1e9b7b[_0xf7f8('0x2b')],'type':_0x1e9b7b[_0xf7f8('0x2c')][_0xf7f8('0x2d')]};});_0x55be1d[_0xf7f8('0x2e')]=_[_0xf7f8('0x29')](_0x3c8282,_0xf7f8('0x27'));_0x55be1d['query']=_[_0xf7f8('0x2f')](_0x154b14[_0xf7f8('0x30')]);_0x55be1d[_0xf7f8('0x31')]=_[_0xf7f8('0x32')](_0x55be1d[_0xf7f8('0x2e')],_0x55be1d['query']);_0x20669f['attributes']=_['intersection'](_0x55be1d[_0xf7f8('0x2e')],qs[_0xf7f8('0x33')](_0x154b14['query'][_0xf7f8('0x33')]));_0x20669f[_0xf7f8('0x34')]=_0x20669f[_0xf7f8('0x34')][_0xf7f8('0x35')]?_0x20669f[_0xf7f8('0x34')]:_0x55be1d[_0xf7f8('0x2e')];if(!_0x154b14[_0xf7f8('0x30')][_0xf7f8('0x36')](_0xf7f8('0x37'))){_0x20669f['limit']=qs[_0xf7f8('0x1c')](_0x154b14[_0xf7f8('0x30')][_0xf7f8('0x1c')]);_0x20669f[_0xf7f8('0x1a')]=qs['offset'](_0x154b14[_0xf7f8('0x30')][_0xf7f8('0x1a')]);}_0x20669f[_0xf7f8('0x38')]=qs[_0xf7f8('0x39')](_0x154b14[_0xf7f8('0x30')][_0xf7f8('0x39')]);_0x20669f['where']=qs[_0xf7f8('0x31')](_['pick'](_0x154b14['query'],_0x55be1d[_0xf7f8('0x31')]),_0x3c8282);if(_0x154b14['query'][_0xf7f8('0x3a')]){_0x20669f[_0xf7f8('0x3b')]=_['merge'](_0x20669f[_0xf7f8('0x3b')],{'$or':_[_0xf7f8('0x29')](_0x3c8282,function(_0x1b5107){if(_0x1b5107['type']!==_0xf7f8('0x3c')){var _0x2334a6={};_0x2334a6[_0x1b5107[_0xf7f8('0x27')]]={'$like':'%'+_0x154b14[_0xf7f8('0x30')]['filter']+'%'};return _0x2334a6;}})});}_0x20669f=_[_0xf7f8('0x3d')]({},_0x20669f,_0x154b14['options']);var _0xd70ac5={'where':_0x20669f[_0xf7f8('0x3b')]};return db[_0xf7f8('0x2a')][_0xf7f8('0x1d')](_0xd70ac5)[_0xf7f8('0x24')](function(_0x54dd3b){_0x5a96a4['count']=_0x54dd3b;if(_0x154b14[_0xf7f8('0x30')][_0xf7f8('0x3e')]){_0x20669f['include']=[{'all':!![]}];}return db[_0xf7f8('0x2a')][_0xf7f8('0x3f')](_0x20669f);})[_0xf7f8('0x24')](function(_0x366a21){_0x5a96a4[_0xf7f8('0x40')]=_0x366a21;return _0x5a96a4;})[_0xf7f8('0x24')](respondWithFilteredResult(_0x301f8f,_0x20669f))[_0xf7f8('0x41')](handleError(_0x301f8f,null));};exports[_0xf7f8('0x42')]=function(_0x2ba1ce,_0x397b30){var _0x38e313={'raw':![],'where':{'id':_0x2ba1ce[_0xf7f8('0x43')]['id']}},_0x5f477c={};_0x5f477c['model']=_[_0xf7f8('0x2f')](db['DeskAccount'][_0xf7f8('0x44')]);_0x5f477c[_0xf7f8('0x30')]=_['keys'](_0x2ba1ce[_0xf7f8('0x30')]);_0x5f477c[_0xf7f8('0x31')]=_[_0xf7f8('0x32')](_0x5f477c[_0xf7f8('0x2e')],_0x5f477c[_0xf7f8('0x30')]);_0x38e313[_0xf7f8('0x34')]=_[_0xf7f8('0x32')](_0x5f477c['model'],qs['fields'](_0x2ba1ce[_0xf7f8('0x30')][_0xf7f8('0x33')]));_0x38e313[_0xf7f8('0x34')]=_0x38e313[_0xf7f8('0x34')][_0xf7f8('0x35')]?_0x38e313[_0xf7f8('0x34')]:_0x5f477c[_0xf7f8('0x2e')];if(_0x2ba1ce[_0xf7f8('0x30')][_0xf7f8('0x3e')]){_0x38e313[_0xf7f8('0x45')]=[{'all':!![]}];}_0x38e313=_[_0xf7f8('0x3d')]({},_0x38e313,_0x2ba1ce['options']);return db[_0xf7f8('0x2a')][_0xf7f8('0x46')](_0x38e313)[_0xf7f8('0x24')](handleEntityNotFound(_0x397b30,null))['then'](respondWithResult(_0x397b30,null))[_0xf7f8('0x41')](handleError(_0x397b30,null));};exports[_0xf7f8('0x47')]=function(_0x4da91a,_0x4fbeaf){return db[_0xf7f8('0x2a')]['create'](_0x4da91a[_0xf7f8('0x48')],{})[_0xf7f8('0x24')](respondWithResult(_0x4fbeaf,0xc9))[_0xf7f8('0x41')](handleError(_0x4fbeaf,null));};exports[_0xf7f8('0x23')]=function(_0x37f459,_0x2785cd){if(_0x37f459[_0xf7f8('0x48')]['id']){delete _0x37f459[_0xf7f8('0x48')]['id'];}return db[_0xf7f8('0x2a')]['find']({'where':{'id':_0x37f459[_0xf7f8('0x43')]['id']}})[_0xf7f8('0x24')](handleEntityNotFound(_0x2785cd,null))[_0xf7f8('0x24')](saveUpdates(_0x37f459[_0xf7f8('0x48')],null))[_0xf7f8('0x24')](respondWithResult(_0x2785cd,null))['catch'](handleError(_0x2785cd,null));};exports['destroy']=function(_0x2b94c1,_0x89f09f){return db['DeskAccount'][_0xf7f8('0x46')]({'where':{'id':_0x2b94c1[_0xf7f8('0x43')]['id']}})[_0xf7f8('0x24')](handleEntityNotFound(_0x89f09f,null))['then'](removeEntity(_0x89f09f,null))[_0xf7f8('0x41')](handleError(_0x89f09f,null));};exports[_0xf7f8('0x49')]=function(_0x2bc67,_0x16d07e,_0x1f196d){var _0x2f23fd={};var _0x363575={};var _0x24143b;var _0x417480;return db['DeskAccount'][_0xf7f8('0x4a')]({'where':{'id':_0x2bc67[_0xf7f8('0x43')]['id']}})[_0xf7f8('0x24')](handleEntityNotFound(_0x16d07e,null))[_0xf7f8('0x24')](function(_0xf35f41){if(_0xf35f41){_0x24143b=_0xf35f41;_0x363575[_0xf7f8('0x2e')]=_[_0xf7f8('0x2f')](db[_0xf7f8('0x4b')][_0xf7f8('0x44')]);_0x363575[_0xf7f8('0x30')]=_[_0xf7f8('0x2f')](_0x2bc67[_0xf7f8('0x30')]);_0x363575['filters']=_[_0xf7f8('0x32')](_0x363575['model'],_0x363575[_0xf7f8('0x30')]);_0x2f23fd[_0xf7f8('0x34')]=_[_0xf7f8('0x32')](_0x363575[_0xf7f8('0x2e')],qs[_0xf7f8('0x33')](_0x2bc67[_0xf7f8('0x30')][_0xf7f8('0x33')]));_0x2f23fd[_0xf7f8('0x34')]=_0x2f23fd['attributes'][_0xf7f8('0x35')]?_0x2f23fd['attributes']:_0x363575[_0xf7f8('0x2e')];_0x2f23fd['order']=qs[_0xf7f8('0x39')](_0x2bc67[_0xf7f8('0x30')][_0xf7f8('0x39')]);_0x2f23fd[_0xf7f8('0x3b')]=qs['filters'](_[_0xf7f8('0x4c')](_0x2bc67[_0xf7f8('0x30')],_0x363575[_0xf7f8('0x31')]));if(_0x2bc67[_0xf7f8('0x30')][_0xf7f8('0x3a')]){_0x2f23fd[_0xf7f8('0x3b')]=_['merge'](_0x2f23fd[_0xf7f8('0x3b')],{'$or':_[_0xf7f8('0x29')](_0x2f23fd[_0xf7f8('0x34')],function(_0x4d0d69){var _0x9f3e6a={};_0x9f3e6a[_0x4d0d69]={'$like':'%'+_0x2bc67[_0xf7f8('0x30')]['filter']+'%'};return _0x9f3e6a;})});}_0x2f23fd=_[_0xf7f8('0x3d')]({},_0x2f23fd,_0x2bc67['options']);return _0x24143b[_0xf7f8('0x49')](_0x2f23fd);}})[_0xf7f8('0x24')](function(_0x3175e5){if(_0x3175e5){_0x417480=_0x3175e5[_0xf7f8('0x35')];if(!_0x2bc67[_0xf7f8('0x30')][_0xf7f8('0x36')](_0xf7f8('0x37'))){_0x2f23fd[_0xf7f8('0x1c')]=qs[_0xf7f8('0x1c')](_0x2bc67['query'][_0xf7f8('0x1c')]);_0x2f23fd[_0xf7f8('0x1a')]=qs['offset'](_0x2bc67[_0xf7f8('0x30')][_0xf7f8('0x1a')]);}return _0x24143b[_0xf7f8('0x49')](_0x2f23fd);}})['then'](function(_0x21f439){if(_0x21f439){return _0x21f439?{'count':_0x417480,'rows':_0x21f439}:null;}})[_0xf7f8('0x24')](respondWithResult(_0x16d07e,null))[_0xf7f8('0x41')](handleError(_0x16d07e,null));};exports['addConfiguration']=function(_0x3739f9,_0x34e79e,_0x1eac8b){if(_0x3739f9[_0xf7f8('0x48')]['id']){delete _0x3739f9[_0xf7f8('0x48')]['id'];}return db['DeskAccount'][_0xf7f8('0x4a')]({'where':{'id':_0x3739f9[_0xf7f8('0x43')]['id']}})['then'](handleEntityNotFound(_0x34e79e,null))[_0xf7f8('0x24')](function(_0x5bbd79){if(_0x5bbd79){_0x3739f9[_0xf7f8('0x48')][_0xf7f8('0x4d')]=_0x5bbd79['id'];_0x3739f9[_0xf7f8('0x48')]['Subjects']=integrations[_0xf7f8('0x4e')](_0x3739f9[_0xf7f8('0x48')]['channel'],_0x3739f9[_0xf7f8('0x48')][_0xf7f8('0x2c')]);_0x3739f9[_0xf7f8('0x48')][_0xf7f8('0x4f')]=integrations[_0xf7f8('0x50')](_0x3739f9[_0xf7f8('0x48')][_0xf7f8('0x51')],_0x3739f9[_0xf7f8('0x48')]['type']);return db[_0xf7f8('0x4b')][_0xf7f8('0x47')](_0x3739f9[_0xf7f8('0x48')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0xf7f8('0x4f')}]});}return null;})[_0xf7f8('0x24')](respondWithResult(_0x34e79e,null))[_0xf7f8('0x41')](handleError(_0x34e79e,null));};exports[_0xf7f8('0x52')]=function(_0xcca410,_0x25eb1e,_0x5cf255){var _0x28ce49=[{'name':_0xf7f8('0x53'),'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 _0x3aa613='';return db[_0xf7f8('0x2a')]['findOne']({'where':{'id':_0xcca410['params']['id']},'attributes':['id',_0xf7f8('0x54'),_0xf7f8('0x55'),_0xf7f8('0x56'),_0xf7f8('0x57'),_0xf7f8('0x58'),_0xf7f8('0x59'),'token',_0xf7f8('0x5a')]})[_0xf7f8('0x24')](handleEntityNotFound(_0x25eb1e,null))[_0xf7f8('0x24')](function(_0x3c49fc){if(_0x3c49fc){_0x3aa613=_0x3c49fc[_0xf7f8('0x54')];var _0x30f8d5=_0x3aa613['slice'](-0x1);if(_0x30f8d5==='/'){_0x3aa613=_0x3aa613[_0xf7f8('0x5b')](0x0,_0x3aa613['lastIndexOf'](_0x30f8d5));}var _0x1947e3={'method':'GET','uri':util[_0xf7f8('0x5c')](_0xf7f8('0x5d'),_0x3aa613),'headers':{'Content-Type':_0xf7f8('0x5e'),'Accept':_0xf7f8('0x5e')},'json':!![]};if(_0x3c49fc['authType']==='basic'){_0x1947e3[_0xf7f8('0x5f')][_0xf7f8('0x60')]=util[_0xf7f8('0x5c')](_0xf7f8('0x61'),new Buffer(util[_0xf7f8('0x5c')](_0xf7f8('0x62'),_0x3c49fc['username'],_0x3c49fc[_0xf7f8('0x57')]))[_0xf7f8('0x63')](_0xf7f8('0x64')));}return rp(_0x1947e3)[_0xf7f8('0x24')](function(_0x3b7345){return _0x28ce49[_0xf7f8('0x65')](_['map'](_0x3b7345[_0xf7f8('0x66')][_0xf7f8('0x67')],function(_0x1cb903){return{'id':_0x1cb903[_0xf7f8('0x27')],'name':_0x1cb903[_0xf7f8('0x27')],'type':_0x1cb903['type'],'active':_0x1cb903[_0xf7f8('0x68')],'label':_0x1cb903['label'],'custom':!![]};}));});}})[_0xf7f8('0x24')](function(_0x1725ab){return{'count':_0x1725ab[_0xf7f8('0x35')],'rows':_0x1725ab};})[_0xf7f8('0x24')](respondWithResult(_0x25eb1e,null))[_0xf7f8('0x41')](function(_0x141c2b){var _0x5d2615=_0xcca410[_0xf7f8('0x30')][_0xf7f8('0x69')]?0x1f4:_0x141c2b[_0xf7f8('0x6a')]||0x1f4;logger['error'](_0xf7f8('0x6b'),_0xf7f8('0x52'),_0x5d2615,JSON[_0xf7f8('0x6c')](_0x141c2b));delete _0x141c2b[_0xf7f8('0x27')];if(_0x5d2615===0x191){_0x5d2615=0x190;}_0x25eb1e[_0xf7f8('0x18')](_0x5d2615)[_0xf7f8('0x6d')](_0xcca410[_0xf7f8('0x30')][_0xf7f8('0x69')]?{'message':_0xf7f8('0x6e'),'statusCode':_0x141c2b[_0xf7f8('0x6a')]}:_0x141c2b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index bb6162d..93d12c6 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 _0x596f=['rimraf','../../config/environment','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger','api','request-promise','path'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x596f,0x18b));var _0xf596=function(_0x526623,_0x5b5bd7){_0x526623=_0x526623-0x0;var _0x555f18=_0x596f[_0x526623];return _0x555f18;};'use strict';var _=require('lodash');var util=require(_0xf596('0x0'));var logger=require(_0xf596('0x1'))(_0xf596('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf596('0x3'));var fs=require('fs');var path=require(_0xf596('0x4'));var rimraf=require(_0xf596('0x5'));var config=require(_0xf596('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xf596('0x7'));module['exports']=function(_0x51907b,_0x234494){return _0x51907b[_0xf596('0x8')]('DeskAccount',attributes,{'tableName':_0xf596('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5686=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3b6e28,_0x1526b9){var _0x50677a=function(_0x1d24ff){while(--_0x1d24ff){_0x3b6e28['push'](_0x3b6e28['shift']());}};_0x50677a(++_0x1526b9);}(_0x5686,0xf3));var _0x6568=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x5686[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x6568('0x0'));var util=require(_0x6568('0x1'));var logger=require(_0x6568('0x2'))(_0x6568('0x3'));var moment=require(_0x6568('0x4'));var BPromise=require(_0x6568('0x5'));var rp=require(_0x6568('0x6'));var fs=require('fs');var path=require(_0x6568('0x7'));var rimraf=require(_0x6568('0x8'));var config=require(_0x6568('0x9'));var attributes=require(_0x6568('0xa'));var integrations=require(_0x6568('0xb'));module['exports']=function(_0x327aa3,_0x1487d){return _0x327aa3[_0x6568('0xc')](_0x6568('0xd'),attributes,{'tableName':_0x6568('0xe'),'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 0d64572..2dc1881 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 _0xa867=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowDeskAccount','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x2bc61d,_0x11d00a){var _0x1a2c54=function(_0x2a0d89){while(--_0x2a0d89){_0x2bc61d['push'](_0x2bc61d['shift']());}};_0x1a2c54(++_0x11d00a);}(_0xa867,0x12d));var _0x7a86=function(_0x1a4b24,_0x455ac1){_0x1a4b24=_0x1a4b24-0x0;var _0x1b33b4=_0xa867[_0x1a4b24];return _0x1b33b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7a86('0x0'));var fs=require('fs');var Redis=require(_0x7a86('0x1'));var db=require(_0x7a86('0x2'))['db'];var utils=require(_0x7a86('0x3'));var logger=require(_0x7a86('0x4'))(_0x7a86('0x5'));var config=require('../../config/environment');var jayson=require(_0x7a86('0x6'));var client=jayson[_0x7a86('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9f8e,_0x4e41e3,_0x3aec3f){return new BPromise(function(_0x2c87bc,_0x5ec534){return client['request'](_0x1b9f8e,_0x3aec3f)[_0x7a86('0x8')](function(_0x164cef){logger[_0x7a86('0x9')](_0x7a86('0xa'),_0x4e41e3,_0x7a86('0xb'));logger[_0x7a86('0xc')](_0x7a86('0xd'),_0x4e41e3,_0x7a86('0xb'),JSON['stringify'](_0x164cef));if(_0x164cef['error']){if(_0x164cef[_0x7a86('0xe')][_0x7a86('0xf')]===0x1f4){logger['error'](_0x7a86('0xa'),_0x4e41e3,_0x164cef[_0x7a86('0xe')][_0x7a86('0x10')]);return _0x5ec534(_0x164cef['error'][_0x7a86('0x10')]);}logger[_0x7a86('0xe')]('DeskAccount,\x20%s,\x20%s',_0x4e41e3,_0x164cef[_0x7a86('0xe')][_0x7a86('0x10')]);return _0x2c87bc(_0x164cef[_0x7a86('0xe')][_0x7a86('0x10')]);}else{logger[_0x7a86('0x9')](_0x7a86('0xa'),_0x4e41e3,'request\x20sent');_0x2c87bc(_0x164cef[_0x7a86('0x11')][_0x7a86('0x10')]);}})[_0x7a86('0x12')](function(_0x34dcd1){logger['error'](_0x7a86('0xa'),_0x4e41e3,_0x34dcd1);_0x5ec534(_0x34dcd1);});});}exports[_0x7a86('0x13')]=function(_0x27fd07){var _0x2c10b5=this;return new Promise(function(_0x4dba0c,_0x414819){return db[_0x7a86('0x14')]['findAll']({'raw':_0x27fd07[_0x7a86('0x15')]?_0x27fd07[_0x7a86('0x15')][_0x7a86('0x16')]===undefined?!![]:![]:!![],'where':_0x27fd07['options']?_0x27fd07[_0x7a86('0x15')][_0x7a86('0x17')]||null:null,'attributes':_0x27fd07['options']?_0x27fd07[_0x7a86('0x15')][_0x7a86('0x18')]||null:null,'limit':_0x27fd07[_0x7a86('0x15')]?_0x27fd07[_0x7a86('0x15')][_0x7a86('0x19')]||null:null,'include':_0x27fd07[_0x7a86('0x15')]?_0x27fd07[_0x7a86('0x15')][_0x7a86('0x1a')]?_[_0x7a86('0x1b')](_0x27fd07[_0x7a86('0x15')][_0x7a86('0x1a')],function(_0x3f065c){return{'model':db[_0x3f065c['model']],'as':_0x3f065c['as'],'attributes':_0x3f065c['attributes'],'include':_0x3f065c[_0x7a86('0x1a')]?_[_0x7a86('0x1b')](_0x3f065c['include'],function(_0x13a961){return{'model':db[_0x13a961[_0x7a86('0x1c')]],'as':_0x13a961['as'],'attributes':_0x13a961['attributes'],'include':_0x13a961[_0x7a86('0x1a')]?_['map'](_0x13a961[_0x7a86('0x1a')],function(_0x59abf0){return{'model':db[_0x59abf0[_0x7a86('0x1c')]],'as':_0x59abf0['as'],'attributes':_0x59abf0[_0x7a86('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7a86('0x8')](function(_0x29c4c8){logger['info']('GetDeskAccount',_0x27fd07);logger[_0x7a86('0xc')](_0x7a86('0x13'),_0x27fd07,JSON[_0x7a86('0x1d')](_0x29c4c8));_0x4dba0c(_0x29c4c8);})[_0x7a86('0x12')](function(_0x4f6b64){logger[_0x7a86('0xe')](_0x7a86('0x13'),_0x4f6b64[_0x7a86('0x10')],_0x27fd07);_0x414819(_0x2c10b5[_0x7a86('0xe')](0x1f4,_0x4f6b64[_0x7a86('0x10')]));});});};exports[_0x7a86('0x1e')]=function(_0x1d0d22){var _0x215920=this;return new Promise(function(_0x247b66,_0x549e1e){return db[_0x7a86('0x14')]['find']({'raw':_0x1d0d22['options']?_0x1d0d22[_0x7a86('0x15')][_0x7a86('0x16')]===undefined?!![]:![]:!![],'where':_0x1d0d22[_0x7a86('0x15')]?_0x1d0d22[_0x7a86('0x15')][_0x7a86('0x17')]||null:null,'attributes':_0x1d0d22[_0x7a86('0x15')]?_0x1d0d22[_0x7a86('0x15')]['attributes']||null:null,'include':_0x1d0d22['options']?_0x1d0d22['options'][_0x7a86('0x1a')]?_['map'](_0x1d0d22[_0x7a86('0x15')][_0x7a86('0x1a')],function(_0x4bec27){return{'model':db[_0x4bec27['model']],'as':_0x4bec27['as'],'attributes':_0x4bec27['attributes'],'include':_0x4bec27[_0x7a86('0x1a')]?_[_0x7a86('0x1b')](_0x4bec27[_0x7a86('0x1a')],function(_0x52217f){return{'model':db[_0x52217f[_0x7a86('0x1c')]],'as':_0x52217f['as'],'attributes':_0x52217f[_0x7a86('0x18')],'include':_0x52217f[_0x7a86('0x1a')]?_[_0x7a86('0x1b')](_0x52217f[_0x7a86('0x1a')],function(_0x3ff4af){return{'model':db[_0x3ff4af[_0x7a86('0x1c')]],'as':_0x3ff4af['as'],'attributes':_0x3ff4af[_0x7a86('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7a86('0x8')](function(_0x175a76){logger[_0x7a86('0x9')](_0x7a86('0x1e'),_0x1d0d22);logger['debug']('ShowDeskAccount',_0x1d0d22,JSON[_0x7a86('0x1d')](_0x175a76));_0x247b66(_0x175a76);})['catch'](function(_0x5a4d29){logger[_0x7a86('0xe')](_0x7a86('0x1e'),_0x5a4d29[_0x7a86('0x10')],_0x1d0d22);_0x549e1e(_0x215920[_0x7a86('0xe')](0x1f4,_0x5a4d29[_0x7a86('0x10')]));});});}; \ No newline at end of file +var _0x0eb6=['request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x447855,_0x1143bd){var _0x1946e5=function(_0x2fd3eb){while(--_0x2fd3eb){_0x447855['push'](_0x447855['shift']());}};_0x1946e5(++_0x1143bd);}(_0x0eb6,0x1c9));var _0x60eb=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x0eb6[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0x60eb('0x0'));var util=require(_0x60eb('0x1'));var moment=require(_0x60eb('0x2'));var BPromise=require(_0x60eb('0x3'));var rs=require(_0x60eb('0x4'));var fs=require('fs');var Redis=require(_0x60eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60eb('0x6'));var config=require(_0x60eb('0x7'));var jayson=require(_0x60eb('0x8'));var client=jayson[_0x60eb('0x9')][_0x60eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4a63,_0x135cac,_0x3abad6){return new BPromise(function(_0x35a654,_0x951acc){return client[_0x60eb('0xb')](_0x4c4a63,_0x3abad6)[_0x60eb('0xc')](function(_0x12b550){logger[_0x60eb('0xd')](_0x60eb('0xe'),_0x135cac,_0x60eb('0xf'));logger[_0x60eb('0x10')](_0x60eb('0x11'),_0x135cac,_0x60eb('0xf'),JSON[_0x60eb('0x12')](_0x12b550));if(_0x12b550[_0x60eb('0x13')]){if(_0x12b550[_0x60eb('0x13')][_0x60eb('0x14')]===0x1f4){logger[_0x60eb('0x13')]('DeskAccount,\x20%s,\x20%s',_0x135cac,_0x12b550[_0x60eb('0x13')]['message']);return _0x951acc(_0x12b550[_0x60eb('0x13')][_0x60eb('0x15')]);}logger['error'](_0x60eb('0xe'),_0x135cac,_0x12b550[_0x60eb('0x13')][_0x60eb('0x15')]);return _0x35a654(_0x12b550[_0x60eb('0x13')][_0x60eb('0x15')]);}else{logger[_0x60eb('0xd')](_0x60eb('0xe'),_0x135cac,_0x60eb('0xf'));_0x35a654(_0x12b550['result'][_0x60eb('0x15')]);}})[_0x60eb('0x16')](function(_0x4c4385){logger[_0x60eb('0x13')](_0x60eb('0xe'),_0x135cac,_0x4c4385);_0x951acc(_0x4c4385);});});}exports[_0x60eb('0x17')]=function(_0x18fa1b){var _0x24194e=this;return new Promise(function(_0x834281,_0x20a57f){return db['DeskAccount'][_0x60eb('0x18')]({'raw':_0x18fa1b[_0x60eb('0x19')]?_0x18fa1b[_0x60eb('0x19')][_0x60eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x18fa1b['options']?_0x18fa1b['options'][_0x60eb('0x1b')]||null:null,'attributes':_0x18fa1b['options']?_0x18fa1b[_0x60eb('0x19')][_0x60eb('0x1c')]||null:null,'limit':_0x18fa1b[_0x60eb('0x19')]?_0x18fa1b['options'][_0x60eb('0x1d')]||null:null,'include':_0x18fa1b[_0x60eb('0x19')]?_0x18fa1b[_0x60eb('0x19')][_0x60eb('0x1e')]?_[_0x60eb('0x1f')](_0x18fa1b[_0x60eb('0x19')][_0x60eb('0x1e')],function(_0x25278d){return{'model':db[_0x25278d['model']],'as':_0x25278d['as'],'attributes':_0x25278d[_0x60eb('0x1c')],'include':_0x25278d[_0x60eb('0x1e')]?_[_0x60eb('0x1f')](_0x25278d[_0x60eb('0x1e')],function(_0x836a6d){return{'model':db[_0x836a6d[_0x60eb('0x20')]],'as':_0x836a6d['as'],'attributes':_0x836a6d[_0x60eb('0x1c')],'include':_0x836a6d[_0x60eb('0x1e')]?_[_0x60eb('0x1f')](_0x836a6d['include'],function(_0x39e7e7){return{'model':db[_0x39e7e7['model']],'as':_0x39e7e7['as'],'attributes':_0x39e7e7[_0x60eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60eb('0xc')](function(_0x53ddaf){logger[_0x60eb('0xd')](_0x60eb('0x17'),_0x18fa1b);logger[_0x60eb('0x10')]('GetDeskAccount',_0x18fa1b,JSON[_0x60eb('0x12')](_0x53ddaf));_0x834281(_0x53ddaf);})[_0x60eb('0x16')](function(_0x1c4c6d){logger[_0x60eb('0x13')]('GetDeskAccount',_0x1c4c6d[_0x60eb('0x15')],_0x18fa1b);_0x20a57f(_0x24194e['error'](0x1f4,_0x1c4c6d[_0x60eb('0x15')]));});});};exports[_0x60eb('0x21')]=function(_0x36b2ed){var _0x1abe74=this;return new Promise(function(_0x4af8c0,_0x44aef0){return db[_0x60eb('0x22')][_0x60eb('0x23')]({'raw':_0x36b2ed[_0x60eb('0x19')]?_0x36b2ed[_0x60eb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36b2ed['options']?_0x36b2ed[_0x60eb('0x19')]['where']||null:null,'attributes':_0x36b2ed[_0x60eb('0x19')]?_0x36b2ed['options'][_0x60eb('0x1c')]||null:null,'include':_0x36b2ed[_0x60eb('0x19')]?_0x36b2ed['options']['include']?_[_0x60eb('0x1f')](_0x36b2ed[_0x60eb('0x19')][_0x60eb('0x1e')],function(_0xab4e80){return{'model':db[_0xab4e80['model']],'as':_0xab4e80['as'],'attributes':_0xab4e80[_0x60eb('0x1c')],'include':_0xab4e80[_0x60eb('0x1e')]?_[_0x60eb('0x1f')](_0xab4e80[_0x60eb('0x1e')],function(_0x4f25df){return{'model':db[_0x4f25df[_0x60eb('0x20')]],'as':_0x4f25df['as'],'attributes':_0x4f25df[_0x60eb('0x1c')],'include':_0x4f25df['include']?_[_0x60eb('0x1f')](_0x4f25df[_0x60eb('0x1e')],function(_0x21d0c6){return{'model':db[_0x21d0c6[_0x60eb('0x20')]],'as':_0x21d0c6['as'],'attributes':_0x21d0c6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x167188){logger[_0x60eb('0xd')](_0x60eb('0x21'),_0x36b2ed);logger['debug'](_0x60eb('0x21'),_0x36b2ed,JSON[_0x60eb('0x12')](_0x167188));_0x4af8c0(_0x167188);})[_0x60eb('0x16')](function(_0x29f32a){logger['error']('ShowDeskAccount',_0x29f32a[_0x60eb('0x15')],_0x36b2ed);_0x44aef0(_0x1abe74['error'](0x1f4,_0x29f32a[_0x60eb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f12ec9e..bf48ac0 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2cab2b,_0x463cfd){var _0x348185=function(_0x1dcc15){while(--_0x1dcc15){_0x2cab2b['push'](_0x2cab2b['shift']());}};_0x348185(++_0x463cfd);}(_0x3e74,0x175));var _0x43e7=function(_0x19c0f1,_0x65c5d0){_0x19c0f1=_0x19c0f1-0x0;var _0x7122d1=_0x3e74[_0x19c0f1];return _0x7122d1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5bcf33,_0x548451){var _0x5d5abe=function(_0x4d4457){while(--_0x4d4457){_0x5bcf33['push'](_0x5bcf33['shift']());}};_0x5d5abe(++_0x548451);}(_0x34e8,0x12c));var _0x834e=function(_0x5a465a,_0x4f83eb){_0x5a465a=_0x5a465a-0x0;var _0x3bb21f=_0x34e8[_0x5a465a];return _0x3bb21f;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7be0be3..620f922 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 _0xa9d7=['sequelize','STRING'];(function(_0x5220fc,_0x5dbbfb){var _0x2f50c0=function(_0x4e457e){while(--_0x4e457e){_0x5220fc['push'](_0x5220fc['shift']());}};_0x2f50c0(++_0x5dbbfb);}(_0xa9d7,0x11c));var _0x7a9d=function(_0x28a0e1,_0x38ecdb){_0x28a0e1=_0x28a0e1-0x0;var _0x2cfa79=_0xa9d7[_0x28a0e1];return _0x2cfa79;};'use strict';var Sequelize=require(_0x7a9d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a9d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc98e=['STRING','exports'];(function(_0x364a18,_0x1ee061){var _0x48c703=function(_0x3bd6c3){while(--_0x3bd6c3){_0x364a18['push'](_0x364a18['shift']());}};_0x48c703(++_0x1ee061);}(_0xc98e,0x197));var _0xec98=function(_0x15677c,_0x4b3cc5){_0x15677c=_0x15677c-0x0;var _0x5e7541=_0xc98e[_0x15677c];return _0x5e7541;};'use strict';var Sequelize=require('sequelize');module[_0xec98('0x0')]={'name':{'type':Sequelize[_0xec98('0x1')]},'description':{'type':Sequelize[_0xec98('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6299552..8b0c26b 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 _0x7b4e=['map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','findOne','params','DeskField','getFields','getSubjects','getDescriptions','order','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x4a020b,_0x2d784b){var _0x12d5b2=function(_0x53c036){while(--_0x53c036){_0x4a020b['push'](_0x4a020b['shift']());}};_0x12d5b2(++_0x2d784b);}(_0x7b4e,0x185));var _0xe7b4=function(_0x263152,_0x45ee79){_0x263152=_0x263152-0x0;var _0x225f0c=_0x7b4e[_0x263152];return _0x225f0c;};'use strict';var emlformat=require(_0xe7b4('0x0'));var rimraf=require(_0xe7b4('0x1'));var zipdir=require(_0xe7b4('0x2'));var jsonpatch=require(_0xe7b4('0x3'));var rp=require(_0xe7b4('0x4'));var moment=require(_0xe7b4('0x5'));var BPromise=require(_0xe7b4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe7b4('0x7'));var csv=require(_0xe7b4('0x8'));var ejs=require(_0xe7b4('0x9'));var fs=require('fs');var fs_extra=require(_0xe7b4('0xa'));var _=require(_0xe7b4('0xb'));var squel=require(_0xe7b4('0xc'));var crypto=require(_0xe7b4('0xd'));var jsforce=require(_0xe7b4('0xe'));var deskjs=require(_0xe7b4('0xf'));var toCsv=require(_0xe7b4('0x8'));var querystring=require(_0xe7b4('0x10'));var Papa=require('papaparse');var Redis=require(_0xe7b4('0x11'));var authService=require(_0xe7b4('0x12'));var qs=require(_0xe7b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7b4('0x14'));var logger=require(_0xe7b4('0x15'))(_0xe7b4('0x16'));var utils=require(_0xe7b4('0x17'));var config=require(_0xe7b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7b4('0x19'))['db'];function respondWithStatusCode(_0x1f325,_0x292463){_0x292463=_0x292463||0xcc;return function(_0x4b75ae){if(_0x4b75ae){return _0x1f325['sendStatus'](_0x292463);}return _0x1f325['status'](_0x292463)[_0xe7b4('0x1a')]();};}function respondWithResult(_0x345175,_0x26933e){_0x26933e=_0x26933e||0xc8;return function(_0x18113a){if(_0x18113a){return _0x345175[_0xe7b4('0x1b')](_0x26933e)['json'](_0x18113a);}};}function respondWithFilteredResult(_0x45302e,_0x24919c){return function(_0x458c33){if(_0x458c33){var _0x4259c2=typeof _0x24919c[_0xe7b4('0x1c')]===_0xe7b4('0x1d')&&typeof _0x24919c[_0xe7b4('0x1e')]===_0xe7b4('0x1d');var _0x3ebc1d=_0x458c33['count'];var _0x3e4852=_0x4259c2?0x0:_0x24919c['offset'];var _0x2f0555=_0x4259c2?_0x458c33[_0xe7b4('0x1f')]:_0x24919c[_0xe7b4('0x1c')]+_0x24919c[_0xe7b4('0x1e')];var _0x5894e5;if(_0x2f0555>=_0x3ebc1d){_0x2f0555=_0x3ebc1d;_0x5894e5=0xc8;}else{_0x5894e5=0xce;}_0x45302e[_0xe7b4('0x1b')](_0x5894e5);return _0x45302e[_0xe7b4('0x20')]('Content-Range',_0x3e4852+'-'+_0x2f0555+'/'+_0x3ebc1d)[_0xe7b4('0x21')](_0x458c33);}return null;};}function patchUpdates(_0xdfec17){return function(_0x241b35){try{jsonpatch[_0xe7b4('0x22')](_0x241b35,_0xdfec17,!![]);}catch(_0x1ff0f7){return BPromise[_0xe7b4('0x23')](_0x1ff0f7);}return _0x241b35[_0xe7b4('0x24')]();};}function saveUpdates(_0x1306ce,_0x5b6c4e){return function(_0x3dd7c4){if(_0x3dd7c4){return _0x3dd7c4[_0xe7b4('0x25')](_0x1306ce)[_0xe7b4('0x26')](function(_0x2e97d5){return _0x2e97d5;});}return null;};}function removeEntity(_0x8b93e8,_0x203e61){return function(_0x490cb8){if(_0x490cb8){return _0x490cb8[_0xe7b4('0x27')]()[_0xe7b4('0x26')](function(){_0x8b93e8[_0xe7b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26dc28,_0x199a98){return function(_0x56a6ed){if(!_0x56a6ed){_0x26dc28[_0xe7b4('0x28')](0x194);}return _0x56a6ed;};}function handleError(_0x5ae7ca,_0x125ae8){_0x125ae8=_0x125ae8||0x1f4;return function(_0x5b1056){logger[_0xe7b4('0x29')](_0x5b1056[_0xe7b4('0x2a')]);if(_0x5b1056[_0xe7b4('0x2b')]){delete _0x5b1056[_0xe7b4('0x2b')];}_0x5ae7ca['status'](_0x125ae8)[_0xe7b4('0x2c')](_0x5b1056);};}exports[_0xe7b4('0x2d')]=function(_0x145a01,_0x5e2172){var _0x7ed309={},_0x18f1fe={},_0x1b8a5d={'count':0x0,'rows':[]};var _0x19ab54=_[_0xe7b4('0x2e')](db[_0xe7b4('0x2f')][_0xe7b4('0x30')],function(_0x3be29b){return{'name':_0x3be29b[_0xe7b4('0x31')],'type':_0x3be29b[_0xe7b4('0x32')][_0xe7b4('0x33')]};});_0x18f1fe[_0xe7b4('0x34')]=_['map'](_0x19ab54,'name');_0x18f1fe[_0xe7b4('0x35')]=_[_0xe7b4('0x36')](_0x145a01[_0xe7b4('0x35')]);_0x18f1fe[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x18f1fe['model'],_0x18f1fe['query']);_0x7ed309['attributes']=_['intersection'](_0x18f1fe['model'],qs[_0xe7b4('0x39')](_0x145a01[_0xe7b4('0x35')][_0xe7b4('0x39')]));_0x7ed309[_0xe7b4('0x3a')]=_0x7ed309[_0xe7b4('0x3a')]['length']?_0x7ed309[_0xe7b4('0x3a')]:_0x18f1fe[_0xe7b4('0x34')];if(!_0x145a01[_0xe7b4('0x35')][_0xe7b4('0x3b')](_0xe7b4('0x3c'))){_0x7ed309[_0xe7b4('0x1e')]=qs[_0xe7b4('0x1e')](_0x145a01['query'][_0xe7b4('0x1e')]);_0x7ed309[_0xe7b4('0x1c')]=qs[_0xe7b4('0x1c')](_0x145a01[_0xe7b4('0x35')][_0xe7b4('0x1c')]);}_0x7ed309['order']=qs['sort'](_0x145a01[_0xe7b4('0x35')][_0xe7b4('0x3d')]);_0x7ed309[_0xe7b4('0x3e')]=qs[_0xe7b4('0x37')](_[_0xe7b4('0x3f')](_0x145a01[_0xe7b4('0x35')],_0x18f1fe[_0xe7b4('0x37')]),_0x19ab54);if(_0x145a01[_0xe7b4('0x35')][_0xe7b4('0x40')]){_0x7ed309['where']=_[_0xe7b4('0x41')](_0x7ed309[_0xe7b4('0x3e')],{'$or':_['map'](_0x19ab54,function(_0x3ec4db){if(_0x3ec4db[_0xe7b4('0x32')]!==_0xe7b4('0x42')){var _0x470aa4={};_0x470aa4[_0x3ec4db[_0xe7b4('0x2b')]]={'$like':'%'+_0x145a01[_0xe7b4('0x35')]['filter']+'%'};return _0x470aa4;}})});}_0x7ed309=_['merge']({},_0x7ed309,_0x145a01[_0xe7b4('0x43')]);var _0x25b166={'where':_0x7ed309[_0xe7b4('0x3e')]};return db[_0xe7b4('0x2f')][_0xe7b4('0x1f')](_0x25b166)[_0xe7b4('0x26')](function(_0xe8b64a){_0x1b8a5d[_0xe7b4('0x1f')]=_0xe8b64a;if(_0x145a01['query'][_0xe7b4('0x44')]){_0x7ed309[_0xe7b4('0x45')]=[{'all':!![]}];}return db[_0xe7b4('0x2f')][_0xe7b4('0x46')](_0x7ed309);})['then'](function(_0x48fb22){_0x1b8a5d['rows']=_0x48fb22;return _0x1b8a5d;})[_0xe7b4('0x26')](respondWithFilteredResult(_0x5e2172,_0x7ed309))[_0xe7b4('0x47')](handleError(_0x5e2172,null));};exports[_0xe7b4('0x48')]=function(_0x5afd02,_0x2a1947){var _0x305138={'raw':![],'where':{'id':_0x5afd02['params']['id']}},_0x556a46={};_0x556a46['model']=_[_0xe7b4('0x36')](db[_0xe7b4('0x2f')]['rawAttributes']);_0x556a46[_0xe7b4('0x35')]=_['keys'](_0x5afd02[_0xe7b4('0x35')]);_0x556a46[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x556a46[_0xe7b4('0x34')],_0x556a46['query']);_0x305138[_0xe7b4('0x3a')]=_['intersection'](_0x556a46[_0xe7b4('0x34')],qs[_0xe7b4('0x39')](_0x5afd02[_0xe7b4('0x35')][_0xe7b4('0x39')]));_0x305138[_0xe7b4('0x3a')]=_0x305138['attributes'][_0xe7b4('0x49')]?_0x305138[_0xe7b4('0x3a')]:_0x556a46[_0xe7b4('0x34')];if(_0x5afd02[_0xe7b4('0x35')]['includeAll']){_0x305138['include']=[{'all':!![]}];}_0x305138=_[_0xe7b4('0x41')]({},_0x305138,_0x5afd02[_0xe7b4('0x43')]);return db[_0xe7b4('0x2f')][_0xe7b4('0x4a')](_0x305138)[_0xe7b4('0x26')](handleEntityNotFound(_0x2a1947,null))[_0xe7b4('0x26')](respondWithResult(_0x2a1947,null))[_0xe7b4('0x47')](handleError(_0x2a1947,null));};exports[_0xe7b4('0x4b')]=function(_0x5e9b0c,_0x2b7430){return db[_0xe7b4('0x2f')][_0xe7b4('0x4b')](_0x5e9b0c[_0xe7b4('0x4c')],{})[_0xe7b4('0x26')](respondWithResult(_0x2b7430,0xc9))[_0xe7b4('0x47')](handleError(_0x2b7430,null));};exports[_0xe7b4('0x25')]=function(_0x8e6b58,_0x1f0947){if(_0x8e6b58[_0xe7b4('0x4c')]['id']){delete _0x8e6b58[_0xe7b4('0x4c')]['id'];}return db[_0xe7b4('0x2f')][_0xe7b4('0x4a')]({'where':{'id':_0x8e6b58['params']['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x1f0947,null))[_0xe7b4('0x26')](saveUpdates(_0x8e6b58[_0xe7b4('0x4c')],null))[_0xe7b4('0x26')](respondWithResult(_0x1f0947,null))[_0xe7b4('0x47')](handleError(_0x1f0947,null));};exports[_0xe7b4('0x27')]=function(_0x42b622,_0x2ae2fd){return db[_0xe7b4('0x2f')][_0xe7b4('0x4a')]({'where':{'id':_0x42b622['params']['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x2ae2fd,null))[_0xe7b4('0x26')](removeEntity(_0x2ae2fd,null))[_0xe7b4('0x47')](handleError(_0x2ae2fd,null));};exports['getFields']=function(_0x365b3c,_0x37f83d,_0x43fce7){var _0x18dacf={};var _0x474f18={};var _0x3e3863;var _0x53136e;return db[_0xe7b4('0x2f')][_0xe7b4('0x4d')]({'where':{'id':_0x365b3c[_0xe7b4('0x4e')]['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x37f83d,null))[_0xe7b4('0x26')](function(_0x3dd438){if(_0x3dd438){_0x3e3863=_0x3dd438;_0x474f18['model']=_[_0xe7b4('0x36')](db[_0xe7b4('0x4f')]['rawAttributes']);_0x474f18[_0xe7b4('0x35')]=_[_0xe7b4('0x36')](_0x365b3c['query']);_0x474f18[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x474f18[_0xe7b4('0x34')],_0x474f18[_0xe7b4('0x35')]);_0x18dacf['attributes']=_['intersection'](_0x474f18[_0xe7b4('0x34')],qs[_0xe7b4('0x39')](_0x365b3c[_0xe7b4('0x35')][_0xe7b4('0x39')]));_0x18dacf['attributes']=_0x18dacf[_0xe7b4('0x3a')][_0xe7b4('0x49')]?_0x18dacf[_0xe7b4('0x3a')]:_0x474f18[_0xe7b4('0x34')];_0x18dacf['order']=qs['sort'](_0x365b3c['query'][_0xe7b4('0x3d')]);_0x18dacf[_0xe7b4('0x3e')]=qs['filters'](_[_0xe7b4('0x3f')](_0x365b3c[_0xe7b4('0x35')],_0x474f18['filters']));if(_0x365b3c['query'][_0xe7b4('0x40')]){_0x18dacf[_0xe7b4('0x3e')]=_[_0xe7b4('0x41')](_0x18dacf[_0xe7b4('0x3e')],{'$or':_[_0xe7b4('0x2e')](_0x18dacf[_0xe7b4('0x3a')],function(_0x3e6c29){var _0x4edbcc={};_0x4edbcc[_0x3e6c29]={'$like':'%'+_0x365b3c[_0xe7b4('0x35')][_0xe7b4('0x40')]+'%'};return _0x4edbcc;})});}_0x18dacf=_[_0xe7b4('0x41')]({},_0x18dacf,_0x365b3c[_0xe7b4('0x43')]);return _0x3e3863['getFields'](_0x18dacf);}})['then'](function(_0xedda00){if(_0xedda00){_0x53136e=_0xedda00['length'];if(!_0x365b3c[_0xe7b4('0x35')][_0xe7b4('0x3b')](_0xe7b4('0x3c'))){_0x18dacf[_0xe7b4('0x1e')]=qs[_0xe7b4('0x1e')](_0x365b3c[_0xe7b4('0x35')]['limit']);_0x18dacf[_0xe7b4('0x1c')]=qs[_0xe7b4('0x1c')](_0x365b3c[_0xe7b4('0x35')][_0xe7b4('0x1c')]);}return _0x3e3863[_0xe7b4('0x50')](_0x18dacf);}})[_0xe7b4('0x26')](function(_0x38ac8e){if(_0x38ac8e){return _0x38ac8e?{'count':_0x53136e,'rows':_0x38ac8e}:null;}})[_0xe7b4('0x26')](respondWithResult(_0x37f83d,null))['catch'](handleError(_0x37f83d,null));};exports[_0xe7b4('0x51')]=function(_0x53f870,_0x5c8a52,_0x204f62){var _0x2396af={};var _0x4842e4={};var _0x4968ca;var _0x41eb58;return db[_0xe7b4('0x2f')][_0xe7b4('0x4d')]({'where':{'id':_0x53f870[_0xe7b4('0x4e')]['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x5c8a52,null))[_0xe7b4('0x26')](function(_0x20fe5f){if(_0x20fe5f){_0x4968ca=_0x20fe5f;_0x4842e4[_0xe7b4('0x34')]=_[_0xe7b4('0x36')](db[_0xe7b4('0x4f')]['rawAttributes']);_0x4842e4[_0xe7b4('0x35')]=_['keys'](_0x53f870[_0xe7b4('0x35')]);_0x4842e4[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x4842e4[_0xe7b4('0x34')],_0x4842e4[_0xe7b4('0x35')]);_0x2396af[_0xe7b4('0x3a')]=_['intersection'](_0x4842e4[_0xe7b4('0x34')],qs[_0xe7b4('0x39')](_0x53f870[_0xe7b4('0x35')][_0xe7b4('0x39')]));_0x2396af['attributes']=_0x2396af[_0xe7b4('0x3a')][_0xe7b4('0x49')]?_0x2396af[_0xe7b4('0x3a')]:_0x4842e4['model'];_0x2396af['order']=qs['sort'](_0x53f870[_0xe7b4('0x35')]['sort']);_0x2396af['where']=qs[_0xe7b4('0x37')](_[_0xe7b4('0x3f')](_0x53f870[_0xe7b4('0x35')],_0x4842e4['filters']));if(_0x53f870[_0xe7b4('0x35')][_0xe7b4('0x40')]){_0x2396af[_0xe7b4('0x3e')]=_['merge'](_0x2396af['where'],{'$or':_[_0xe7b4('0x2e')](_0x2396af['attributes'],function(_0x2d553f){var _0xa402fa={};_0xa402fa[_0x2d553f]={'$like':'%'+_0x53f870[_0xe7b4('0x35')][_0xe7b4('0x40')]+'%'};return _0xa402fa;})});}_0x2396af=_[_0xe7b4('0x41')]({},_0x2396af,_0x53f870['options']);return _0x4968ca[_0xe7b4('0x51')](_0x2396af);}})[_0xe7b4('0x26')](function(_0x4c9462){if(_0x4c9462){_0x41eb58=_0x4c9462[_0xe7b4('0x49')];if(!_0x53f870[_0xe7b4('0x35')][_0xe7b4('0x3b')](_0xe7b4('0x3c'))){_0x2396af[_0xe7b4('0x1e')]=qs[_0xe7b4('0x1e')](_0x53f870[_0xe7b4('0x35')][_0xe7b4('0x1e')]);_0x2396af[_0xe7b4('0x1c')]=qs[_0xe7b4('0x1c')](_0x53f870[_0xe7b4('0x35')]['offset']);}return _0x4968ca[_0xe7b4('0x51')](_0x2396af);}})['then'](function(_0x54c8ca){if(_0x54c8ca){return _0x54c8ca?{'count':_0x41eb58,'rows':_0x54c8ca}:null;}})['then'](respondWithResult(_0x5c8a52,null))['catch'](handleError(_0x5c8a52,null));};exports[_0xe7b4('0x52')]=function(_0xb29cd7,_0x136c7e,_0x440dda){var _0x2ef65d={};var _0x94c4ff={};var _0x578f52;var _0x1ff7bc;return db[_0xe7b4('0x2f')][_0xe7b4('0x4d')]({'where':{'id':_0xb29cd7[_0xe7b4('0x4e')]['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x136c7e,null))[_0xe7b4('0x26')](function(_0x518f4a){if(_0x518f4a){_0x578f52=_0x518f4a;_0x94c4ff[_0xe7b4('0x34')]=_[_0xe7b4('0x36')](db[_0xe7b4('0x4f')][_0xe7b4('0x30')]);_0x94c4ff[_0xe7b4('0x35')]=_[_0xe7b4('0x36')](_0xb29cd7['query']);_0x94c4ff[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x94c4ff[_0xe7b4('0x34')],_0x94c4ff[_0xe7b4('0x35')]);_0x2ef65d[_0xe7b4('0x3a')]=_['intersection'](_0x94c4ff[_0xe7b4('0x34')],qs[_0xe7b4('0x39')](_0xb29cd7[_0xe7b4('0x35')][_0xe7b4('0x39')]));_0x2ef65d[_0xe7b4('0x3a')]=_0x2ef65d['attributes'][_0xe7b4('0x49')]?_0x2ef65d[_0xe7b4('0x3a')]:_0x94c4ff[_0xe7b4('0x34')];_0x2ef65d[_0xe7b4('0x53')]=qs[_0xe7b4('0x3d')](_0xb29cd7[_0xe7b4('0x35')]['sort']);_0x2ef65d['where']=qs[_0xe7b4('0x37')](_[_0xe7b4('0x3f')](_0xb29cd7['query'],_0x94c4ff['filters']));if(_0xb29cd7[_0xe7b4('0x35')]['filter']){_0x2ef65d[_0xe7b4('0x3e')]=_[_0xe7b4('0x41')](_0x2ef65d['where'],{'$or':_[_0xe7b4('0x2e')](_0x2ef65d[_0xe7b4('0x3a')],function(_0xb07815){var _0x4293b7={};_0x4293b7[_0xb07815]={'$like':'%'+_0xb29cd7['query'][_0xe7b4('0x40')]+'%'};return _0x4293b7;})});}_0x2ef65d=_[_0xe7b4('0x41')]({},_0x2ef65d,_0xb29cd7[_0xe7b4('0x43')]);return _0x578f52[_0xe7b4('0x52')](_0x2ef65d);}})['then'](function(_0x5b3d28){if(_0x5b3d28){_0x1ff7bc=_0x5b3d28[_0xe7b4('0x49')];if(!_0xb29cd7['query'][_0xe7b4('0x3b')](_0xe7b4('0x3c'))){_0x2ef65d[_0xe7b4('0x1e')]=qs['limit'](_0xb29cd7['query']['limit']);_0x2ef65d['offset']=qs[_0xe7b4('0x1c')](_0xb29cd7[_0xe7b4('0x35')]['offset']);}return _0x578f52[_0xe7b4('0x52')](_0x2ef65d);}})[_0xe7b4('0x26')](function(_0x370c50){if(_0x370c50){return _0x370c50?{'count':_0x1ff7bc,'rows':_0x370c50}:null;}})['then'](respondWithResult(_0x136c7e,null))[_0xe7b4('0x47')](handleError(_0x136c7e,null));};exports[_0xe7b4('0x54')]=function(_0x913dc2,_0x214d90,_0x5e9a21){var _0x55781a={};var _0x5bfa30={};var _0x4be5c1;var _0x228b9e;return db[_0xe7b4('0x2f')][_0xe7b4('0x4d')]({'where':{'id':_0x913dc2[_0xe7b4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x214d90,null))[_0xe7b4('0x26')](function(_0x4a9c0e){if(_0x4a9c0e){_0x4be5c1=_0x4a9c0e;_0x5bfa30['model']=_[_0xe7b4('0x36')](db[_0xe7b4('0x55')]['rawAttributes']);_0x5bfa30['query']=_[_0xe7b4('0x36')](_0x913dc2[_0xe7b4('0x35')]);_0x5bfa30[_0xe7b4('0x37')]=_[_0xe7b4('0x38')](_0x5bfa30['model'],_0x5bfa30[_0xe7b4('0x35')]);_0x55781a[_0xe7b4('0x3a')]=_[_0xe7b4('0x38')](_0x5bfa30[_0xe7b4('0x34')],qs[_0xe7b4('0x39')](_0x913dc2['query'][_0xe7b4('0x39')]));_0x55781a[_0xe7b4('0x3a')]=_0x55781a['attributes'][_0xe7b4('0x49')]?_0x55781a['attributes']:_0x5bfa30[_0xe7b4('0x34')];_0x55781a[_0xe7b4('0x53')]=qs[_0xe7b4('0x3d')](_0x913dc2[_0xe7b4('0x35')][_0xe7b4('0x3d')]);_0x55781a[_0xe7b4('0x3e')]=qs[_0xe7b4('0x37')](_[_0xe7b4('0x3f')](_0x913dc2[_0xe7b4('0x35')],_0x5bfa30[_0xe7b4('0x37')]));if(_0x913dc2[_0xe7b4('0x35')][_0xe7b4('0x40')]){_0x55781a[_0xe7b4('0x3e')]=_[_0xe7b4('0x41')](_0x55781a[_0xe7b4('0x3e')],{'$or':_[_0xe7b4('0x2e')](_0x55781a['attributes'],function(_0x165908){var _0x1e0471={};_0x1e0471[_0x165908]={'$like':'%'+_0x913dc2[_0xe7b4('0x35')][_0xe7b4('0x40')]+'%'};return _0x1e0471;})});}_0x55781a=_[_0xe7b4('0x41')]({},_0x55781a,_0x913dc2[_0xe7b4('0x43')]);return _0x4be5c1[_0xe7b4('0x54')](_0x55781a);}})[_0xe7b4('0x26')](function(_0x18dcf5){if(_0x18dcf5){_0x228b9e=_0x18dcf5[_0xe7b4('0x49')];if(!_0x913dc2['query'][_0xe7b4('0x3b')]('nolimit')){_0x55781a[_0xe7b4('0x1e')]=qs[_0xe7b4('0x1e')](_0x913dc2[_0xe7b4('0x35')][_0xe7b4('0x1e')]);_0x55781a[_0xe7b4('0x1c')]=qs[_0xe7b4('0x1c')](_0x913dc2['query'][_0xe7b4('0x1c')]);}return _0x4be5c1['getTags'](_0x55781a);}})[_0xe7b4('0x26')](function(_0x36d112){if(_0x36d112){return _0x36d112?{'count':_0x228b9e,'rows':_0x36d112}:null;}})['then'](respondWithResult(_0x214d90,null))[_0xe7b4('0x47')](handleError(_0x214d90,null));};exports['setTags']=function(_0x30bd05,_0x3dbbb5,_0x33a4e1){if(_0x30bd05[_0xe7b4('0x4c')]['id']){delete _0x30bd05[_0xe7b4('0x4c')]['id'];}return db[_0xe7b4('0x2f')][_0xe7b4('0x4d')]({'where':{'id':_0x30bd05[_0xe7b4('0x4e')]['id']}})[_0xe7b4('0x26')](handleEntityNotFound(_0x3dbbb5,null))['then'](function(_0x1f2d12){if(_0x1f2d12){return _0x1f2d12[_0xe7b4('0x56')](_0x30bd05['body']['ids']||[]);}return null;})[_0xe7b4('0x26')](respondWithResult(_0x3dbbb5,null))['catch'](handleError(_0x3dbbb5,null));}; \ No newline at end of file +var _0x00f7=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','catch','params','DeskConfiguration','include','find','create','body','getFields','findOne','DeskField','getSubjects','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5d88ff,_0x50313d){var _0x3db12d=function(_0x12b3cb){while(--_0x12b3cb){_0x5d88ff['push'](_0x5d88ff['shift']());}};_0x3db12d(++_0x50313d);}(_0x00f7,0x1bb));var _0x700f=function(_0xb28729,_0x54f9ed){_0xb28729=_0xb28729-0x0;var _0x51ea35=_0x00f7[_0xb28729];return _0x51ea35;};'use strict';var emlformat=require(_0x700f('0x0'));var rimraf=require(_0x700f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x700f('0x2'));var rp=require(_0x700f('0x3'));var moment=require(_0x700f('0x4'));var BPromise=require(_0x700f('0x5'));var Mustache=require(_0x700f('0x6'));var util=require(_0x700f('0x7'));var path=require(_0x700f('0x8'));var sox=require('sox');var csv=require(_0x700f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x700f('0xa'));var crypto=require('crypto');var jsforce=require(_0x700f('0xb'));var deskjs=require(_0x700f('0xc'));var toCsv=require(_0x700f('0x9'));var querystring=require('querystring');var Papa=require(_0x700f('0xd'));var Redis=require(_0x700f('0xe'));var authService=require(_0x700f('0xf'));var qs=require(_0x700f('0x10'));var as=require(_0x700f('0x11'));var hardwareService=require(_0x700f('0x12'));var logger=require('../../config/logger')(_0x700f('0x13'));var utils=require(_0x700f('0x14'));var config=require(_0x700f('0x15'));var licenseUtil=require(_0x700f('0x16'));var db=require(_0x700f('0x17'))['db'];function respondWithStatusCode(_0xb83b47,_0x34d7b7){_0x34d7b7=_0x34d7b7||0xcc;return function(_0x1aa944){if(_0x1aa944){return _0xb83b47['sendStatus'](_0x34d7b7);}return _0xb83b47[_0x700f('0x18')](_0x34d7b7)[_0x700f('0x19')]();};}function respondWithResult(_0x332687,_0x381a2b){_0x381a2b=_0x381a2b||0xc8;return function(_0xb471ea){if(_0xb471ea){return _0x332687['status'](_0x381a2b)[_0x700f('0x1a')](_0xb471ea);}};}function respondWithFilteredResult(_0x2e4032,_0x339463){return function(_0x47cde1){if(_0x47cde1){var _0x1fd299=typeof _0x339463[_0x700f('0x1b')]===_0x700f('0x1c')&&typeof _0x339463[_0x700f('0x1d')]===_0x700f('0x1c');var _0x1398db=_0x47cde1[_0x700f('0x1e')];var _0x3a92f9=_0x1fd299?0x0:_0x339463[_0x700f('0x1b')];var _0x996e0d=_0x1fd299?_0x47cde1[_0x700f('0x1e')]:_0x339463[_0x700f('0x1b')]+_0x339463['limit'];var _0x20ffed;if(_0x996e0d>=_0x1398db){_0x996e0d=_0x1398db;_0x20ffed=0xc8;}else{_0x20ffed=0xce;}_0x2e4032['status'](_0x20ffed);return _0x2e4032[_0x700f('0x1f')]('Content-Range',_0x3a92f9+'-'+_0x996e0d+'/'+_0x1398db)[_0x700f('0x1a')](_0x47cde1);}return null;};}function patchUpdates(_0x4cf91e){return function(_0x5e3b57){try{jsonpatch[_0x700f('0x20')](_0x5e3b57,_0x4cf91e,!![]);}catch(_0x358115){return BPromise[_0x700f('0x21')](_0x358115);}return _0x5e3b57[_0x700f('0x22')]();};}function saveUpdates(_0x16f091,_0x39ca07){return function(_0x3ab340){if(_0x3ab340){return _0x3ab340[_0x700f('0x23')](_0x16f091)[_0x700f('0x24')](function(_0x95c037){return _0x95c037;});}return null;};}function removeEntity(_0x13f2ee,_0x1caee9){return function(_0x2b6dab){if(_0x2b6dab){return _0x2b6dab[_0x700f('0x25')]()[_0x700f('0x24')](function(){_0x13f2ee['status'](0xcc)[_0x700f('0x19')]();});}};}function handleEntityNotFound(_0x3539a3,_0x47ad29){return function(_0x42d34e){if(!_0x42d34e){_0x3539a3[_0x700f('0x26')](0x194);}return _0x42d34e;};}function handleError(_0x43c2be,_0x6ff204){_0x6ff204=_0x6ff204||0x1f4;return function(_0x5dc2ae){logger['error'](_0x5dc2ae['stack']);if(_0x5dc2ae[_0x700f('0x27')]){delete _0x5dc2ae[_0x700f('0x27')];}_0x43c2be[_0x700f('0x18')](_0x6ff204)[_0x700f('0x28')](_0x5dc2ae);};}exports[_0x700f('0x29')]=function(_0x27dc18,_0x3b96f4){var _0x628846={},_0x1380a4={},_0x4de1f7={'count':0x0,'rows':[]};var _0x5cfe3b=_[_0x700f('0x2a')](db['DeskConfiguration'][_0x700f('0x2b')],function(_0x523458){return{'name':_0x523458['fieldName'],'type':_0x523458[_0x700f('0x2c')]['key']};});_0x1380a4[_0x700f('0x2d')]=_[_0x700f('0x2a')](_0x5cfe3b,_0x700f('0x27'));_0x1380a4['query']=_[_0x700f('0x2e')](_0x27dc18[_0x700f('0x2f')]);_0x1380a4[_0x700f('0x30')]=_[_0x700f('0x31')](_0x1380a4['model'],_0x1380a4[_0x700f('0x2f')]);_0x628846[_0x700f('0x32')]=_['intersection'](_0x1380a4['model'],qs['fields'](_0x27dc18[_0x700f('0x2f')][_0x700f('0x33')]));_0x628846['attributes']=_0x628846[_0x700f('0x32')][_0x700f('0x34')]?_0x628846[_0x700f('0x32')]:_0x1380a4['model'];if(!_0x27dc18[_0x700f('0x2f')][_0x700f('0x35')](_0x700f('0x36'))){_0x628846[_0x700f('0x1d')]=qs[_0x700f('0x1d')](_0x27dc18[_0x700f('0x2f')][_0x700f('0x1d')]);_0x628846[_0x700f('0x1b')]=qs['offset'](_0x27dc18[_0x700f('0x2f')]['offset']);}_0x628846[_0x700f('0x37')]=qs[_0x700f('0x38')](_0x27dc18[_0x700f('0x2f')][_0x700f('0x38')]);_0x628846[_0x700f('0x39')]=qs[_0x700f('0x30')](_[_0x700f('0x3a')](_0x27dc18[_0x700f('0x2f')],_0x1380a4[_0x700f('0x30')]),_0x5cfe3b);if(_0x27dc18['query']['filter']){_0x628846[_0x700f('0x39')]=_[_0x700f('0x3b')](_0x628846['where'],{'$or':_[_0x700f('0x2a')](_0x5cfe3b,function(_0x278b6b){if(_0x278b6b[_0x700f('0x2c')]!=='VIRTUAL'){var _0x4565bf={};_0x4565bf[_0x278b6b['name']]={'$like':'%'+_0x27dc18['query'][_0x700f('0x3c')]+'%'};return _0x4565bf;}})});}_0x628846=_[_0x700f('0x3b')]({},_0x628846,_0x27dc18[_0x700f('0x3d')]);var _0x2937e0={'where':_0x628846[_0x700f('0x39')]};return db['DeskConfiguration'][_0x700f('0x1e')](_0x2937e0)[_0x700f('0x24')](function(_0x4ba84e){_0x4de1f7['count']=_0x4ba84e;if(_0x27dc18[_0x700f('0x2f')][_0x700f('0x3e')]){_0x628846['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x628846);})[_0x700f('0x24')](function(_0x49089e){_0x4de1f7['rows']=_0x49089e;return _0x4de1f7;})[_0x700f('0x24')](respondWithFilteredResult(_0x3b96f4,_0x628846))[_0x700f('0x3f')](handleError(_0x3b96f4,null));};exports['show']=function(_0x56e6fd,_0x158b76){var _0x3b886f={'raw':![],'where':{'id':_0x56e6fd[_0x700f('0x40')]['id']}},_0x1f971f={};_0x1f971f['model']=_[_0x700f('0x2e')](db[_0x700f('0x41')][_0x700f('0x2b')]);_0x1f971f[_0x700f('0x2f')]=_[_0x700f('0x2e')](_0x56e6fd[_0x700f('0x2f')]);_0x1f971f[_0x700f('0x30')]=_[_0x700f('0x31')](_0x1f971f[_0x700f('0x2d')],_0x1f971f[_0x700f('0x2f')]);_0x3b886f[_0x700f('0x32')]=_[_0x700f('0x31')](_0x1f971f[_0x700f('0x2d')],qs[_0x700f('0x33')](_0x56e6fd[_0x700f('0x2f')]['fields']));_0x3b886f[_0x700f('0x32')]=_0x3b886f[_0x700f('0x32')][_0x700f('0x34')]?_0x3b886f['attributes']:_0x1f971f[_0x700f('0x2d')];if(_0x56e6fd[_0x700f('0x2f')][_0x700f('0x3e')]){_0x3b886f[_0x700f('0x42')]=[{'all':!![]}];}_0x3b886f=_[_0x700f('0x3b')]({},_0x3b886f,_0x56e6fd[_0x700f('0x3d')]);return db['DeskConfiguration'][_0x700f('0x43')](_0x3b886f)['then'](handleEntityNotFound(_0x158b76,null))[_0x700f('0x24')](respondWithResult(_0x158b76,null))[_0x700f('0x3f')](handleError(_0x158b76,null));};exports[_0x700f('0x44')]=function(_0x2b7aed,_0x1db7a1){return db['DeskConfiguration']['create'](_0x2b7aed[_0x700f('0x45')],{})[_0x700f('0x24')](respondWithResult(_0x1db7a1,0xc9))[_0x700f('0x3f')](handleError(_0x1db7a1,null));};exports[_0x700f('0x23')]=function(_0x3dfbdb,_0x1be1d1){if(_0x3dfbdb[_0x700f('0x45')]['id']){delete _0x3dfbdb[_0x700f('0x45')]['id'];}return db[_0x700f('0x41')][_0x700f('0x43')]({'where':{'id':_0x3dfbdb[_0x700f('0x40')]['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x1be1d1,null))[_0x700f('0x24')](saveUpdates(_0x3dfbdb[_0x700f('0x45')],null))[_0x700f('0x24')](respondWithResult(_0x1be1d1,null))['catch'](handleError(_0x1be1d1,null));};exports[_0x700f('0x25')]=function(_0xba8966,_0x3bb197){return db[_0x700f('0x41')][_0x700f('0x43')]({'where':{'id':_0xba8966['params']['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x3bb197,null))[_0x700f('0x24')](removeEntity(_0x3bb197,null))[_0x700f('0x3f')](handleError(_0x3bb197,null));};exports[_0x700f('0x46')]=function(_0x21ffdb,_0x3bd44e,_0x1d2629){var _0x39ee78={};var _0xfddc63={};var _0x4cb88e;var _0x5b0fc8;return db[_0x700f('0x41')][_0x700f('0x47')]({'where':{'id':_0x21ffdb[_0x700f('0x40')]['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x3bd44e,null))[_0x700f('0x24')](function(_0x311737){if(_0x311737){_0x4cb88e=_0x311737;_0xfddc63['model']=_['keys'](db[_0x700f('0x48')][_0x700f('0x2b')]);_0xfddc63[_0x700f('0x2f')]=_['keys'](_0x21ffdb[_0x700f('0x2f')]);_0xfddc63[_0x700f('0x30')]=_[_0x700f('0x31')](_0xfddc63[_0x700f('0x2d')],_0xfddc63['query']);_0x39ee78[_0x700f('0x32')]=_[_0x700f('0x31')](_0xfddc63[_0x700f('0x2d')],qs[_0x700f('0x33')](_0x21ffdb[_0x700f('0x2f')][_0x700f('0x33')]));_0x39ee78[_0x700f('0x32')]=_0x39ee78[_0x700f('0x32')][_0x700f('0x34')]?_0x39ee78[_0x700f('0x32')]:_0xfddc63[_0x700f('0x2d')];_0x39ee78['order']=qs[_0x700f('0x38')](_0x21ffdb[_0x700f('0x2f')][_0x700f('0x38')]);_0x39ee78[_0x700f('0x39')]=qs[_0x700f('0x30')](_[_0x700f('0x3a')](_0x21ffdb[_0x700f('0x2f')],_0xfddc63[_0x700f('0x30')]));if(_0x21ffdb[_0x700f('0x2f')][_0x700f('0x3c')]){_0x39ee78['where']=_[_0x700f('0x3b')](_0x39ee78[_0x700f('0x39')],{'$or':_[_0x700f('0x2a')](_0x39ee78[_0x700f('0x32')],function(_0x5530a4){var _0x459d4b={};_0x459d4b[_0x5530a4]={'$like':'%'+_0x21ffdb[_0x700f('0x2f')]['filter']+'%'};return _0x459d4b;})});}_0x39ee78=_['merge']({},_0x39ee78,_0x21ffdb[_0x700f('0x3d')]);return _0x4cb88e[_0x700f('0x46')](_0x39ee78);}})[_0x700f('0x24')](function(_0x2dd91c){if(_0x2dd91c){_0x5b0fc8=_0x2dd91c['length'];if(!_0x21ffdb[_0x700f('0x2f')][_0x700f('0x35')](_0x700f('0x36'))){_0x39ee78[_0x700f('0x1d')]=qs['limit'](_0x21ffdb[_0x700f('0x2f')]['limit']);_0x39ee78[_0x700f('0x1b')]=qs[_0x700f('0x1b')](_0x21ffdb[_0x700f('0x2f')][_0x700f('0x1b')]);}return _0x4cb88e[_0x700f('0x46')](_0x39ee78);}})[_0x700f('0x24')](function(_0x1abd3c){if(_0x1abd3c){return _0x1abd3c?{'count':_0x5b0fc8,'rows':_0x1abd3c}:null;}})[_0x700f('0x24')](respondWithResult(_0x3bd44e,null))[_0x700f('0x3f')](handleError(_0x3bd44e,null));};exports[_0x700f('0x49')]=function(_0x23261c,_0x392f4a,_0x49dd9a){var _0x47b2c3={};var _0x17f478={};var _0x3e5dcf;var _0x5dd51c;return db[_0x700f('0x41')][_0x700f('0x47')]({'where':{'id':_0x23261c['params']['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x392f4a,null))['then'](function(_0x5296fd){if(_0x5296fd){_0x3e5dcf=_0x5296fd;_0x17f478[_0x700f('0x2d')]=_[_0x700f('0x2e')](db['DeskField'][_0x700f('0x2b')]);_0x17f478[_0x700f('0x2f')]=_[_0x700f('0x2e')](_0x23261c[_0x700f('0x2f')]);_0x17f478[_0x700f('0x30')]=_[_0x700f('0x31')](_0x17f478['model'],_0x17f478[_0x700f('0x2f')]);_0x47b2c3[_0x700f('0x32')]=_[_0x700f('0x31')](_0x17f478['model'],qs[_0x700f('0x33')](_0x23261c[_0x700f('0x2f')][_0x700f('0x33')]));_0x47b2c3['attributes']=_0x47b2c3[_0x700f('0x32')]['length']?_0x47b2c3['attributes']:_0x17f478[_0x700f('0x2d')];_0x47b2c3[_0x700f('0x37')]=qs[_0x700f('0x38')](_0x23261c[_0x700f('0x2f')]['sort']);_0x47b2c3[_0x700f('0x39')]=qs['filters'](_['pick'](_0x23261c[_0x700f('0x2f')],_0x17f478[_0x700f('0x30')]));if(_0x23261c[_0x700f('0x2f')][_0x700f('0x3c')]){_0x47b2c3['where']=_[_0x700f('0x3b')](_0x47b2c3['where'],{'$or':_[_0x700f('0x2a')](_0x47b2c3[_0x700f('0x32')],function(_0x11d6ba){var _0x296e82={};_0x296e82[_0x11d6ba]={'$like':'%'+_0x23261c[_0x700f('0x2f')][_0x700f('0x3c')]+'%'};return _0x296e82;})});}_0x47b2c3=_[_0x700f('0x3b')]({},_0x47b2c3,_0x23261c[_0x700f('0x3d')]);return _0x3e5dcf['getSubjects'](_0x47b2c3);}})['then'](function(_0x1ed713){if(_0x1ed713){_0x5dd51c=_0x1ed713['length'];if(!_0x23261c['query'][_0x700f('0x35')](_0x700f('0x36'))){_0x47b2c3[_0x700f('0x1d')]=qs[_0x700f('0x1d')](_0x23261c[_0x700f('0x2f')][_0x700f('0x1d')]);_0x47b2c3[_0x700f('0x1b')]=qs[_0x700f('0x1b')](_0x23261c[_0x700f('0x2f')][_0x700f('0x1b')]);}return _0x3e5dcf[_0x700f('0x49')](_0x47b2c3);}})[_0x700f('0x24')](function(_0x332de6){if(_0x332de6){return _0x332de6?{'count':_0x5dd51c,'rows':_0x332de6}:null;}})[_0x700f('0x24')](respondWithResult(_0x392f4a,null))[_0x700f('0x3f')](handleError(_0x392f4a,null));};exports['getDescriptions']=function(_0x14dc44,_0x5709b3,_0x470242){var _0x3d1d57={};var _0x2eb0fe={};var _0x19eb15;var _0xa23a35;return db[_0x700f('0x41')][_0x700f('0x47')]({'where':{'id':_0x14dc44[_0x700f('0x40')]['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x5709b3,null))[_0x700f('0x24')](function(_0x2e2284){if(_0x2e2284){_0x19eb15=_0x2e2284;_0x2eb0fe['model']=_[_0x700f('0x2e')](db['DeskField']['rawAttributes']);_0x2eb0fe[_0x700f('0x2f')]=_[_0x700f('0x2e')](_0x14dc44['query']);_0x2eb0fe[_0x700f('0x30')]=_[_0x700f('0x31')](_0x2eb0fe[_0x700f('0x2d')],_0x2eb0fe[_0x700f('0x2f')]);_0x3d1d57[_0x700f('0x32')]=_[_0x700f('0x31')](_0x2eb0fe[_0x700f('0x2d')],qs['fields'](_0x14dc44[_0x700f('0x2f')][_0x700f('0x33')]));_0x3d1d57[_0x700f('0x32')]=_0x3d1d57[_0x700f('0x32')][_0x700f('0x34')]?_0x3d1d57[_0x700f('0x32')]:_0x2eb0fe[_0x700f('0x2d')];_0x3d1d57[_0x700f('0x37')]=qs[_0x700f('0x38')](_0x14dc44[_0x700f('0x2f')]['sort']);_0x3d1d57[_0x700f('0x39')]=qs[_0x700f('0x30')](_['pick'](_0x14dc44[_0x700f('0x2f')],_0x2eb0fe[_0x700f('0x30')]));if(_0x14dc44[_0x700f('0x2f')][_0x700f('0x3c')]){_0x3d1d57[_0x700f('0x39')]=_[_0x700f('0x3b')](_0x3d1d57[_0x700f('0x39')],{'$or':_['map'](_0x3d1d57[_0x700f('0x32')],function(_0x3a9ffb){var _0x4e2a40={};_0x4e2a40[_0x3a9ffb]={'$like':'%'+_0x14dc44[_0x700f('0x2f')][_0x700f('0x3c')]+'%'};return _0x4e2a40;})});}_0x3d1d57=_[_0x700f('0x3b')]({},_0x3d1d57,_0x14dc44['options']);return _0x19eb15['getDescriptions'](_0x3d1d57);}})[_0x700f('0x24')](function(_0x57760b){if(_0x57760b){_0xa23a35=_0x57760b[_0x700f('0x34')];if(!_0x14dc44['query'][_0x700f('0x35')](_0x700f('0x36'))){_0x3d1d57['limit']=qs[_0x700f('0x1d')](_0x14dc44[_0x700f('0x2f')][_0x700f('0x1d')]);_0x3d1d57[_0x700f('0x1b')]=qs['offset'](_0x14dc44['query'][_0x700f('0x1b')]);}return _0x19eb15['getDescriptions'](_0x3d1d57);}})[_0x700f('0x24')](function(_0x4eb788){if(_0x4eb788){return _0x4eb788?{'count':_0xa23a35,'rows':_0x4eb788}:null;}})[_0x700f('0x24')](respondWithResult(_0x5709b3,null))[_0x700f('0x3f')](handleError(_0x5709b3,null));};exports[_0x700f('0x4a')]=function(_0x5af567,_0x4c50a9,_0x224638){var _0xb5b528={};var _0x2dbdff={};var _0x5086fa;var _0x272efc;return db[_0x700f('0x41')][_0x700f('0x47')]({'where':{'id':_0x5af567['params']['id']}})['then'](handleEntityNotFound(_0x4c50a9,null))[_0x700f('0x24')](function(_0xe4444b){if(_0xe4444b){_0x5086fa=_0xe4444b;_0x2dbdff['model']=_[_0x700f('0x2e')](db[_0x700f('0x4b')][_0x700f('0x2b')]);_0x2dbdff[_0x700f('0x2f')]=_['keys'](_0x5af567['query']);_0x2dbdff[_0x700f('0x30')]=_[_0x700f('0x31')](_0x2dbdff[_0x700f('0x2d')],_0x2dbdff[_0x700f('0x2f')]);_0xb5b528[_0x700f('0x32')]=_[_0x700f('0x31')](_0x2dbdff[_0x700f('0x2d')],qs['fields'](_0x5af567[_0x700f('0x2f')]['fields']));_0xb5b528[_0x700f('0x32')]=_0xb5b528[_0x700f('0x32')][_0x700f('0x34')]?_0xb5b528[_0x700f('0x32')]:_0x2dbdff[_0x700f('0x2d')];_0xb5b528[_0x700f('0x37')]=qs[_0x700f('0x38')](_0x5af567[_0x700f('0x2f')][_0x700f('0x38')]);_0xb5b528[_0x700f('0x39')]=qs[_0x700f('0x30')](_[_0x700f('0x3a')](_0x5af567[_0x700f('0x2f')],_0x2dbdff[_0x700f('0x30')]));if(_0x5af567[_0x700f('0x2f')][_0x700f('0x3c')]){_0xb5b528[_0x700f('0x39')]=_[_0x700f('0x3b')](_0xb5b528[_0x700f('0x39')],{'$or':_['map'](_0xb5b528[_0x700f('0x32')],function(_0x326d02){var _0x3619aa={};_0x3619aa[_0x326d02]={'$like':'%'+_0x5af567[_0x700f('0x2f')][_0x700f('0x3c')]+'%'};return _0x3619aa;})});}_0xb5b528=_['merge']({},_0xb5b528,_0x5af567[_0x700f('0x3d')]);return _0x5086fa['getTags'](_0xb5b528);}})[_0x700f('0x24')](function(_0x3adfa9){if(_0x3adfa9){_0x272efc=_0x3adfa9['length'];if(!_0x5af567[_0x700f('0x2f')][_0x700f('0x35')](_0x700f('0x36'))){_0xb5b528[_0x700f('0x1d')]=qs['limit'](_0x5af567[_0x700f('0x2f')][_0x700f('0x1d')]);_0xb5b528[_0x700f('0x1b')]=qs[_0x700f('0x1b')](_0x5af567[_0x700f('0x2f')][_0x700f('0x1b')]);}return _0x5086fa[_0x700f('0x4a')](_0xb5b528);}})['then'](function(_0x27864e){if(_0x27864e){return _0x27864e?{'count':_0x272efc,'rows':_0x27864e}:null;}})[_0x700f('0x24')](respondWithResult(_0x4c50a9,null))['catch'](handleError(_0x4c50a9,null));};exports[_0x700f('0x4c')]=function(_0x46643d,_0x41ad15,_0x13fa3){if(_0x46643d[_0x700f('0x45')]['id']){delete _0x46643d['body']['id'];}return db[_0x700f('0x41')]['findOne']({'where':{'id':_0x46643d[_0x700f('0x40')]['id']}})[_0x700f('0x24')](handleEntityNotFound(_0x41ad15,null))[_0x700f('0x24')](function(_0x49a2b4){if(_0x49a2b4){return _0x49a2b4[_0x700f('0x4c')](_0x46643d[_0x700f('0x45')][_0x700f('0x4d')]||[]);}return null;})[_0x700f('0x24')](respondWithResult(_0x41ad15,null))[_0x700f('0x3f')](handleError(_0x41ad15,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d5da313..141dc0e 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 _0xc799=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc799,0x1a6));var _0x9c79=function(_0x2a4e4a,_0x5417d2){_0x2a4e4a=_0x2a4e4a-0x0;var _0x120bab=_0xc799[_0x2a4e4a];return _0x120bab;};'use strict';var _=require(_0x9c79('0x0'));var util=require(_0x9c79('0x1'));var logger=require(_0x9c79('0x2'))(_0x9c79('0x3'));var moment=require(_0x9c79('0x4'));var BPromise=require(_0x9c79('0x5'));var rp=require(_0x9c79('0x6'));var fs=require('fs');var path=require(_0x9c79('0x7'));var rimraf=require(_0x9c79('0x8'));var config=require('../../config/environment');var attributes=require(_0x9c79('0x9'));module[_0x9c79('0xa')]=function(_0x419a7f,_0x157883){return _0x419a7f[_0x9c79('0xb')](_0x9c79('0xc'),attributes,{'tableName':_0x9c79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc551=['define','int_desk_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xc551,0xbd));var _0x1c55=function(_0x545151,_0x47b5df){_0x545151=_0x545151-0x0;var _0x39c992=_0xc551[_0x545151];return _0x39c992;};'use strict';var _=require(_0x1c55('0x0'));var util=require('util');var logger=require(_0x1c55('0x1'))('api');var moment=require(_0x1c55('0x2'));var BPromise=require('bluebird');var rp=require(_0x1c55('0x3'));var fs=require('fs');var path=require(_0x1c55('0x4'));var rimraf=require(_0x1c55('0x5'));var config=require(_0x1c55('0x6'));var attributes=require(_0x1c55('0x7'));module[_0x1c55('0x8')]=function(_0x1c28ba,_0x4fdfbc){return _0x1c28ba[_0x1c55('0x9')]('DeskConfiguration',attributes,{'tableName':_0x1c55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index ebeac95..aea5805 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 _0xcdf0=['request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xcdf0,0xa8));var _0x0cdf=function(_0x28700d,_0x214447){_0x28700d=_0x28700d-0x0;var _0x185156=_0xcdf0[_0x28700d];return _0x185156;};'use strict';var _=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var moment=require(_0x0cdf('0x2'));var BPromise=require(_0x0cdf('0x3'));var rs=require(_0x0cdf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cdf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0cdf('0x7'));var client=jayson[_0x0cdf('0x8')][_0x0cdf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x658ceb,_0x45b4d9,_0x5415ef){return new BPromise(function(_0x47f3ea,_0x238a0b){return client['request'](_0x658ceb,_0x5415ef)[_0x0cdf('0xa')](function(_0x275bc9){logger['info'](_0x0cdf('0xb'),_0x45b4d9,_0x0cdf('0xc'));logger[_0x0cdf('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x45b4d9,_0x0cdf('0xc'),JSON[_0x0cdf('0xe')](_0x275bc9));if(_0x275bc9[_0x0cdf('0xf')]){if(_0x275bc9[_0x0cdf('0xf')]['code']===0x1f4){logger[_0x0cdf('0xf')](_0x0cdf('0xb'),_0x45b4d9,_0x275bc9['error'][_0x0cdf('0x10')]);return _0x238a0b(_0x275bc9[_0x0cdf('0xf')][_0x0cdf('0x10')]);}logger[_0x0cdf('0xf')](_0x0cdf('0xb'),_0x45b4d9,_0x275bc9[_0x0cdf('0xf')]['message']);return _0x47f3ea(_0x275bc9[_0x0cdf('0xf')][_0x0cdf('0x10')]);}else{logger['info'](_0x0cdf('0xb'),_0x45b4d9,_0x0cdf('0xc'));_0x47f3ea(_0x275bc9[_0x0cdf('0x11')][_0x0cdf('0x10')]);}})['catch'](function(_0x5b1261){logger[_0x0cdf('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x45b4d9,_0x5b1261);_0x238a0b(_0x5b1261);});});} \ No newline at end of file +var _0x6426=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x50c96f,_0x2ee009){var _0x38fcf2=function(_0x299a4d){while(--_0x299a4d){_0x50c96f['push'](_0x50c96f['shift']());}};_0x38fcf2(++_0x2ee009);}(_0x6426,0x15b));var _0x6642=function(_0x4f1ee6,_0x16e924){_0x4f1ee6=_0x4f1ee6-0x0;var _0x10aabf=_0x6426[_0x4f1ee6];return _0x10aabf;};'use strict';var _=require(_0x6642('0x0'));var util=require(_0x6642('0x1'));var moment=require(_0x6642('0x2'));var BPromise=require(_0x6642('0x3'));var rs=require(_0x6642('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6642('0x5'))['db'];var utils=require(_0x6642('0x6'));var logger=require('../../config/logger')(_0x6642('0x7'));var config=require(_0x6642('0x8'));var jayson=require(_0x6642('0x9'));var client=jayson[_0x6642('0xa')][_0x6642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6b1ef0,_0x5d149a,_0x1f9b53){return new BPromise(function(_0x1cf31a,_0x30746e){return client[_0x6642('0xc')](_0x6b1ef0,_0x1f9b53)[_0x6642('0xd')](function(_0x10606c){logger[_0x6642('0xe')](_0x6642('0xf'),_0x5d149a,_0x6642('0x10'));logger[_0x6642('0x11')](_0x6642('0x12'),_0x5d149a,_0x6642('0x10'),JSON[_0x6642('0x13')](_0x10606c));if(_0x10606c['error']){if(_0x10606c[_0x6642('0x14')][_0x6642('0x15')]===0x1f4){logger[_0x6642('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x5d149a,_0x10606c['error'][_0x6642('0x16')]);return _0x30746e(_0x10606c[_0x6642('0x14')][_0x6642('0x16')]);}logger[_0x6642('0x14')](_0x6642('0xf'),_0x5d149a,_0x10606c[_0x6642('0x14')]['message']);return _0x1cf31a(_0x10606c[_0x6642('0x14')][_0x6642('0x16')]);}else{logger[_0x6642('0xe')](_0x6642('0xf'),_0x5d149a,_0x6642('0x10'));_0x1cf31a(_0x10606c[_0x6642('0x17')]['message']);}})[_0x6642('0x18')](function(_0x1fba71){logger[_0x6642('0x14')](_0x6642('0xf'),_0x5d149a,_0x1fba71);_0x30746e(_0x1fba71);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index fbf7354..d471634 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 _0x8507=['./intDeskField.controller','get','isAuthenticated','index','/:id','post','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31a639,_0x392cf8){var _0x4a8300=function(_0x449727){while(--_0x449727){_0x31a639['push'](_0x31a639['shift']());}};_0x4a8300(++_0x392cf8);}(_0x8507,0x14c));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7850('0x0'));var util=require('util');var path=require(_0x7850('0x1'));var timeout=require('connect-timeout');var express=require(_0x7850('0x2'));var router=express[_0x7850('0x3')]();var fs_extra=require(_0x7850('0x4'));var auth=require(_0x7850('0x5'));var interaction=require(_0x7850('0x6'));var config=require(_0x7850('0x7'));var controller=require(_0x7850('0x8'));router[_0x7850('0x9')]('/',auth[_0x7850('0xa')](),controller[_0x7850('0xb')]);router['get'](_0x7850('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7850('0xd')]('/',auth[_0x7850('0xa')](),controller['create']);router[_0x7850('0xe')](_0x7850('0xc'),auth[_0x7850('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7850('0xf')]);module[_0x7850('0x10')]=router; \ No newline at end of file +var _0x287f=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x41256f,_0x418ae6){var _0x572145=function(_0x59ca9a){while(--_0x59ca9a){_0x41256f['push'](_0x41256f['shift']());}};_0x572145(++_0x418ae6);}(_0x287f,0x150));var _0xf287=function(_0x243f29,_0x2ad99c){_0x243f29=_0x243f29-0x0;var _0x1474e=_0x287f[_0x243f29];return _0x1474e;};'use strict';var multer=require(_0xf287('0x0'));var util=require('util');var path=require(_0xf287('0x1'));var timeout=require(_0xf287('0x2'));var express=require(_0xf287('0x3'));var router=express[_0xf287('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf287('0x5'));var interaction=require(_0xf287('0x6'));var config=require(_0xf287('0x7'));var controller=require(_0xf287('0x8'));router[_0xf287('0x9')]('/',auth['isAuthenticated'](),controller[_0xf287('0xa')]);router[_0xf287('0x9')](_0xf287('0xb'),auth[_0xf287('0xc')](),controller[_0xf287('0xd')]);router[_0xf287('0xe')]('/',auth[_0xf287('0xc')](),controller[_0xf287('0xf')]);router['put'](_0xf287('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf287('0x10')](_0xf287('0xb'),auth[_0xf287('0xc')](),controller[_0xf287('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2320928..6497f00 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 _0x7ee8=['customVariable','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x7b3220,_0x36f056){var _0x1c8884=function(_0x23f8da){while(--_0x23f8da){_0x7b3220['push'](_0x7b3220['shift']());}};_0x1c8884(++_0x36f056);}(_0x7ee8,0xbb));var _0x87ee=function(_0x558222,_0x105cdb){_0x558222=_0x558222-0x0;var _0x4e1044=_0x7ee8[_0x558222];return _0x4e1044;};'use strict';var Sequelize=require(_0x87ee('0x0'));module[_0x87ee('0x1')]={'type':{'type':Sequelize[_0x87ee('0x2')](_0x87ee('0x3'),_0x87ee('0x4'),_0x87ee('0x5'),'keyValue',_0x87ee('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x87ee('0x7')]},'key':{'type':Sequelize[_0x87ee('0x7')]},'keyType':{'type':Sequelize[_0x87ee('0x2')](_0x87ee('0x3'),_0x87ee('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x87ee('0x7')]},'idField':{'type':Sequelize[_0x87ee('0x7')]},'nameField':{'type':Sequelize[_0x87ee('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x87ee('0x7')]}}; \ No newline at end of file +var _0x2219=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x2219,0x18f));var _0x9221=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2219[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x9221('0x0'));module[_0x9221('0x1')]={'type':{'type':Sequelize[_0x9221('0x2')](_0x9221('0x3'),_0x9221('0x4'),_0x9221('0x5'),_0x9221('0x6'),_0x9221('0x7')),'defaultValue':_0x9221('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9221('0x8')]},'keyType':{'type':Sequelize[_0x9221('0x2')](_0x9221('0x3'),'variable',_0x9221('0x5'))},'keyContent':{'type':Sequelize[_0x9221('0x8')]},'idField':{'type':Sequelize[_0x9221('0x8')]},'nameField':{'type':Sequelize[_0x9221('0x8')]},'customField':{'type':Sequelize[_0x9221('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 5f5c1d2..ec98057 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 _0xbff5=['bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','DeskField','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4546f0,_0x58f091){var _0x1b883e=function(_0x34851b){while(--_0x34851b){_0x4546f0['push'](_0x4546f0['shift']());}};_0x1b883e(++_0x58f091);}(_0xbff5,0x1bc));var _0x5bff=function(_0x141f90,_0x34fbbb){_0x141f90=_0x141f90-0x0;var _0x69d843=_0xbff5[_0x141f90];return _0x69d843;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=typeof _0x4d883e[_0x5bff('0x1b')]==='undefined'&&typeof _0x4d883e[_0x5bff('0x1c')]===_0x5bff('0x1d');var _0x38daa0=_0x2d22ab['count'];var _0xc9fbc3=_0x4612ec?0x0:_0x4d883e[_0x5bff('0x1b')];var _0x36653b=_0x4612ec?_0x2d22ab[_0x5bff('0x1e')]:_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1c')];var _0x5357d4;if(_0x36653b>=_0x38daa0){_0x36653b=_0x38daa0;_0x5357d4=0xc8;}else{_0x5357d4=0xce;}_0x3a507c[_0x5bff('0x19')](_0x5357d4);return _0x3a507c['set'](_0x5bff('0x1f'),_0xc9fbc3+'-'+_0x36653b+'/'+_0x38daa0)[_0x5bff('0x1a')](_0x2d22ab);}return null;};}function patchUpdates(_0x2a83ce){return function(_0x6cbfa){try{jsonpatch[_0x5bff('0x20')](_0x6cbfa,_0x2a83ce,!![]);}catch(_0x2012e4){return BPromise[_0x5bff('0x21')](_0x2012e4);}return _0x6cbfa[_0x5bff('0x22')]();};}function saveUpdates(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x23')](_0x155e16)[_0x5bff('0x24')](function(_0x1e7f8a){return _0x1e7f8a;});}return null;};}function removeEntity(_0x352b1f,_0x31d26b){return function(_0x3913fd){if(_0x3913fd){return _0x3913fd[_0x5bff('0x25')]()['then'](function(){_0x352b1f['status'](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x53bd97,_0x220c8f){return function(_0xcc091d){if(!_0xcc091d){_0x53bd97[_0x5bff('0x17')](0x194);}return _0xcc091d;};}function handleError(_0x6f18f1,_0xfa361d){_0xfa361d=_0xfa361d||0x1f4;return function(_0x1140eb){logger[_0x5bff('0x26')](_0x1140eb[_0x5bff('0x27')]);if(_0x1140eb['name']){delete _0x1140eb['name'];}_0x6f18f1[_0x5bff('0x19')](_0xfa361d)[_0x5bff('0x28')](_0x1140eb);};}exports['index']=function(_0x36a7d2,_0x588078){var _0x5470cb={},_0x3eda3a={},_0x5cf207={'count':0x0,'rows':[]};var _0x3ed23b=_[_0x5bff('0x29')](db[_0x5bff('0x2a')][_0x5bff('0x2b')],function(_0x48aee1){return{'name':_0x48aee1[_0x5bff('0x2c')],'type':_0x48aee1['type'][_0x5bff('0x2d')]};});_0x3eda3a['model']=_[_0x5bff('0x29')](_0x3ed23b,_0x5bff('0x2e'));_0x3eda3a[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x36a7d2[_0x5bff('0x2f')]);_0x3eda3a[_0x5bff('0x31')]=_['intersection'](_0x3eda3a[_0x5bff('0x32')],_0x3eda3a[_0x5bff('0x2f')]);_0x5470cb[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x3eda3a[_0x5bff('0x32')],qs[_0x5bff('0x35')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x35')]));_0x5470cb['attributes']=_0x5470cb[_0x5bff('0x33')][_0x5bff('0x36')]?_0x5470cb[_0x5bff('0x33')]:_0x3eda3a[_0x5bff('0x32')];if(!_0x36a7d2['query'][_0x5bff('0x37')](_0x5bff('0x38'))){_0x5470cb['limit']=qs[_0x5bff('0x1c')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1c')]);_0x5470cb[_0x5bff('0x1b')]=qs['offset'](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1b')]);}_0x5470cb[_0x5bff('0x39')]=qs['sort'](_0x36a7d2[_0x5bff('0x2f')]['sort']);_0x5470cb[_0x5bff('0x3a')]=qs[_0x5bff('0x31')](_[_0x5bff('0x3b')](_0x36a7d2['query'],_0x3eda3a[_0x5bff('0x31')]),_0x3ed23b);if(_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x3c')]){_0x5470cb['where']=_[_0x5bff('0x3d')](_0x5470cb[_0x5bff('0x3a')],{'$or':_['map'](_0x3ed23b,function(_0x265cdb){if(_0x265cdb[_0x5bff('0x3e')]!==_0x5bff('0x3f')){var _0x77a071={};_0x77a071[_0x265cdb[_0x5bff('0x2e')]]={'$like':'%'+_0x36a7d2['query'][_0x5bff('0x3c')]+'%'};return _0x77a071;}})});}_0x5470cb=_['merge']({},_0x5470cb,_0x36a7d2[_0x5bff('0x40')]);var _0x2fecb9={'where':_0x5470cb[_0x5bff('0x3a')]};return db[_0x5bff('0x2a')][_0x5bff('0x1e')](_0x2fecb9)[_0x5bff('0x24')](function(_0x1d0346){_0x5cf207['count']=_0x1d0346;if(_0x36a7d2['query'][_0x5bff('0x41')]){_0x5470cb[_0x5bff('0x42')]=[{'all':!![]}];}return db[_0x5bff('0x2a')][_0x5bff('0x43')](_0x5470cb);})[_0x5bff('0x24')](function(_0xb7b82a){_0x5cf207[_0x5bff('0x44')]=_0xb7b82a;return _0x5cf207;})[_0x5bff('0x24')](respondWithFilteredResult(_0x588078,_0x5470cb))['catch'](handleError(_0x588078,null));};exports[_0x5bff('0x45')]=function(_0x49676f,_0x3dc13f){var _0x1b8c7f={'raw':!![],'where':{'id':_0x49676f[_0x5bff('0x46')]['id']}},_0x543517={};_0x543517[_0x5bff('0x32')]=_['keys'](db[_0x5bff('0x2a')][_0x5bff('0x2b')]);_0x543517[_0x5bff('0x2f')]=_['keys'](_0x49676f[_0x5bff('0x2f')]);_0x543517[_0x5bff('0x31')]=_[_0x5bff('0x34')](_0x543517['model'],_0x543517[_0x5bff('0x2f')]);_0x1b8c7f[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x543517[_0x5bff('0x32')],qs['fields'](_0x49676f[_0x5bff('0x2f')]['fields']));_0x1b8c7f['attributes']=_0x1b8c7f[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b8c7f['attributes']:_0x543517[_0x5bff('0x32')];if(_0x49676f[_0x5bff('0x2f')]['includeAll']){_0x1b8c7f[_0x5bff('0x42')]=[{'all':!![]}];}_0x1b8c7f=_[_0x5bff('0x3d')]({},_0x1b8c7f,_0x49676f[_0x5bff('0x40')]);return db[_0x5bff('0x2a')]['find'](_0x1b8c7f)[_0x5bff('0x24')](handleEntityNotFound(_0x3dc13f,null))[_0x5bff('0x24')](respondWithResult(_0x3dc13f,null))[_0x5bff('0x47')](handleError(_0x3dc13f,null));};exports[_0x5bff('0x48')]=function(_0x1e94c5,_0x2588b8){return db['DeskField'][_0x5bff('0x48')](_0x1e94c5[_0x5bff('0x49')],{})['then'](respondWithResult(_0x2588b8,0xc9))[_0x5bff('0x47')](handleError(_0x2588b8,null));};exports['update']=function(_0x47fc14,_0x4ff13a){if(_0x47fc14[_0x5bff('0x49')]['id']){delete _0x47fc14[_0x5bff('0x49')]['id'];}return db['DeskField'][_0x5bff('0x4a')]({'where':{'id':_0x47fc14[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x4ff13a,null))[_0x5bff('0x24')](saveUpdates(_0x47fc14[_0x5bff('0x49')],null))['then'](respondWithResult(_0x4ff13a,null))[_0x5bff('0x47')](handleError(_0x4ff13a,null));};exports[_0x5bff('0x25')]=function(_0x5e99f5,_0x16c61e){return db['DeskField'][_0x5bff('0x4a')]({'where':{'id':_0x5e99f5[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x16c61e,null))[_0x5bff('0x24')](removeEntity(_0x16c61e,null))[_0x5bff('0x47')](handleError(_0x16c61e,null));}; \ No newline at end of file +var _0x8c97=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','DeskField','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x154385,_0x4b7a00){var _0x2b5ffb=function(_0x200ac2){while(--_0x200ac2){_0x154385['push'](_0x154385['shift']());}};_0x2b5ffb(++_0x4b7a00);}(_0x8c97,0x194));var _0x78c9=function(_0x27ecb1,_0x5f29a8){_0x27ecb1=_0x27ecb1-0x0;var _0x1b02ca=_0x8c97[_0x27ecb1];return _0x1b02ca;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require(_0x78c9('0x1'));var zipdir=require(_0x78c9('0x2'));var jsonpatch=require(_0x78c9('0x3'));var rp=require('request-promise');var moment=require(_0x78c9('0x4'));var BPromise=require(_0x78c9('0x5'));var Mustache=require('mustache');var util=require(_0x78c9('0x6'));var path=require(_0x78c9('0x7'));var sox=require(_0x78c9('0x8'));var csv=require(_0x78c9('0x9'));var ejs=require(_0x78c9('0xa'));var fs=require('fs');var fs_extra=require(_0x78c9('0xb'));var _=require(_0x78c9('0xc'));var squel=require(_0x78c9('0xd'));var crypto=require(_0x78c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78c9('0xf'));var toCsv=require(_0x78c9('0x9'));var querystring=require(_0x78c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x78c9('0x11'));var authService=require(_0x78c9('0x12'));var qs=require(_0x78c9('0x13'));var as=require(_0x78c9('0x14'));var hardwareService=require(_0x78c9('0x15'));var logger=require(_0x78c9('0x16'))(_0x78c9('0x17'));var utils=require('../../config/utils');var config=require(_0x78c9('0x18'));var licenseUtil=require(_0x78c9('0x19'));var db=require(_0x78c9('0x1a'))['db'];function respondWithStatusCode(_0x5e515e,_0x3f21a6){_0x3f21a6=_0x3f21a6||0xcc;return function(_0x5e450d){if(_0x5e450d){return _0x5e515e['sendStatus'](_0x3f21a6);}return _0x5e515e[_0x78c9('0x1b')](_0x3f21a6)[_0x78c9('0x1c')]();};}function respondWithResult(_0x4e051a,_0x58be8c){_0x58be8c=_0x58be8c||0xc8;return function(_0x3010d3){if(_0x3010d3){return _0x4e051a[_0x78c9('0x1b')](_0x58be8c)[_0x78c9('0x1d')](_0x3010d3);}};}function respondWithFilteredResult(_0x3ad95d,_0x34a7b2){return function(_0x2d440d){if(_0x2d440d){var _0x5b6476=typeof _0x34a7b2[_0x78c9('0x1e')]===_0x78c9('0x1f')&&typeof _0x34a7b2[_0x78c9('0x20')]===_0x78c9('0x1f');var _0x41ad55=_0x2d440d[_0x78c9('0x21')];var _0x11ae39=_0x5b6476?0x0:_0x34a7b2['offset'];var _0x5b8633=_0x5b6476?_0x2d440d[_0x78c9('0x21')]:_0x34a7b2[_0x78c9('0x1e')]+_0x34a7b2[_0x78c9('0x20')];var _0x33d630;if(_0x5b8633>=_0x41ad55){_0x5b8633=_0x41ad55;_0x33d630=0xc8;}else{_0x33d630=0xce;}_0x3ad95d[_0x78c9('0x1b')](_0x33d630);return _0x3ad95d['set']('Content-Range',_0x11ae39+'-'+_0x5b8633+'/'+_0x41ad55)[_0x78c9('0x1d')](_0x2d440d);}return null;};}function patchUpdates(_0x3c4143){return function(_0x39f180){try{jsonpatch['apply'](_0x39f180,_0x3c4143,!![]);}catch(_0x3ab4e9){return BPromise[_0x78c9('0x22')](_0x3ab4e9);}return _0x39f180[_0x78c9('0x23')]();};}function saveUpdates(_0x23d34c,_0x4d4563){return function(_0x2a0892){if(_0x2a0892){return _0x2a0892[_0x78c9('0x24')](_0x23d34c)[_0x78c9('0x25')](function(_0x4e41d3){return _0x4e41d3;});}return null;};}function removeEntity(_0x3c8adb,_0x45069d){return function(_0xcfa065){if(_0xcfa065){return _0xcfa065['destroy']()[_0x78c9('0x25')](function(){_0x3c8adb['status'](0xcc)[_0x78c9('0x1c')]();});}};}function handleEntityNotFound(_0x4ffae8,_0x426088){return function(_0x32684b){if(!_0x32684b){_0x4ffae8['sendStatus'](0x194);}return _0x32684b;};}function handleError(_0x58036f,_0x31b38b){_0x31b38b=_0x31b38b||0x1f4;return function(_0x3e313a){logger[_0x78c9('0x26')](_0x3e313a[_0x78c9('0x27')]);if(_0x3e313a[_0x78c9('0x28')]){delete _0x3e313a[_0x78c9('0x28')];}_0x58036f['status'](_0x31b38b)[_0x78c9('0x29')](_0x3e313a);};}exports[_0x78c9('0x2a')]=function(_0x949c5d,_0x125a3b){var _0x1298db={},_0x500b0c={},_0x12cbc0={'count':0x0,'rows':[]};var _0x3617b6=_['map'](db['DeskField'][_0x78c9('0x2b')],function(_0x5e02f9){return{'name':_0x5e02f9[_0x78c9('0x2c')],'type':_0x5e02f9[_0x78c9('0x2d')][_0x78c9('0x2e')]};});_0x500b0c[_0x78c9('0x2f')]=_[_0x78c9('0x30')](_0x3617b6,_0x78c9('0x28'));_0x500b0c[_0x78c9('0x31')]=_[_0x78c9('0x32')](_0x949c5d[_0x78c9('0x31')]);_0x500b0c['filters']=_['intersection'](_0x500b0c['model'],_0x500b0c[_0x78c9('0x31')]);_0x1298db['attributes']=_[_0x78c9('0x33')](_0x500b0c['model'],qs[_0x78c9('0x34')](_0x949c5d[_0x78c9('0x31')][_0x78c9('0x34')]));_0x1298db['attributes']=_0x1298db[_0x78c9('0x35')][_0x78c9('0x36')]?_0x1298db['attributes']:_0x500b0c[_0x78c9('0x2f')];if(!_0x949c5d[_0x78c9('0x31')][_0x78c9('0x37')](_0x78c9('0x38'))){_0x1298db[_0x78c9('0x20')]=qs[_0x78c9('0x20')](_0x949c5d['query']['limit']);_0x1298db['offset']=qs['offset'](_0x949c5d[_0x78c9('0x31')]['offset']);}_0x1298db[_0x78c9('0x39')]=qs[_0x78c9('0x3a')](_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3a')]);_0x1298db[_0x78c9('0x3b')]=qs['filters'](_[_0x78c9('0x3c')](_0x949c5d[_0x78c9('0x31')],_0x500b0c[_0x78c9('0x3d')]),_0x3617b6);if(_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3e')]){_0x1298db[_0x78c9('0x3b')]=_['merge'](_0x1298db[_0x78c9('0x3b')],{'$or':_[_0x78c9('0x30')](_0x3617b6,function(_0x20e36b){if(_0x20e36b[_0x78c9('0x2d')]!=='VIRTUAL'){var _0x2f1e33={};_0x2f1e33[_0x20e36b['name']]={'$like':'%'+_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3e')]+'%'};return _0x2f1e33;}})});}_0x1298db=_[_0x78c9('0x3f')]({},_0x1298db,_0x949c5d['options']);var _0xd6deaa={'where':_0x1298db['where']};return db[_0x78c9('0x40')][_0x78c9('0x21')](_0xd6deaa)['then'](function(_0x225bcf){_0x12cbc0[_0x78c9('0x21')]=_0x225bcf;if(_0x949c5d[_0x78c9('0x31')][_0x78c9('0x41')]){_0x1298db[_0x78c9('0x42')]=[{'all':!![]}];}return db[_0x78c9('0x40')][_0x78c9('0x43')](_0x1298db);})[_0x78c9('0x25')](function(_0xf528b1){_0x12cbc0['rows']=_0xf528b1;return _0x12cbc0;})[_0x78c9('0x25')](respondWithFilteredResult(_0x125a3b,_0x1298db))[_0x78c9('0x44')](handleError(_0x125a3b,null));};exports[_0x78c9('0x45')]=function(_0x2a4f2b,_0x41bbd0){var _0x2b1132={'raw':!![],'where':{'id':_0x2a4f2b[_0x78c9('0x46')]['id']}},_0x4541b2={};_0x4541b2[_0x78c9('0x2f')]=_['keys'](db[_0x78c9('0x40')][_0x78c9('0x2b')]);_0x4541b2['query']=_[_0x78c9('0x32')](_0x2a4f2b[_0x78c9('0x31')]);_0x4541b2[_0x78c9('0x3d')]=_['intersection'](_0x4541b2['model'],_0x4541b2[_0x78c9('0x31')]);_0x2b1132[_0x78c9('0x35')]=_['intersection'](_0x4541b2[_0x78c9('0x2f')],qs[_0x78c9('0x34')](_0x2a4f2b[_0x78c9('0x31')][_0x78c9('0x34')]));_0x2b1132['attributes']=_0x2b1132[_0x78c9('0x35')][_0x78c9('0x36')]?_0x2b1132[_0x78c9('0x35')]:_0x4541b2[_0x78c9('0x2f')];if(_0x2a4f2b[_0x78c9('0x31')]['includeAll']){_0x2b1132[_0x78c9('0x42')]=[{'all':!![]}];}_0x2b1132=_['merge']({},_0x2b1132,_0x2a4f2b[_0x78c9('0x47')]);return db['DeskField']['find'](_0x2b1132)[_0x78c9('0x25')](handleEntityNotFound(_0x41bbd0,null))[_0x78c9('0x25')](respondWithResult(_0x41bbd0,null))[_0x78c9('0x44')](handleError(_0x41bbd0,null));};exports[_0x78c9('0x48')]=function(_0x32fe08,_0x50481a){return db['DeskField'][_0x78c9('0x48')](_0x32fe08['body'],{})[_0x78c9('0x25')](respondWithResult(_0x50481a,0xc9))[_0x78c9('0x44')](handleError(_0x50481a,null));};exports[_0x78c9('0x24')]=function(_0x307405,_0x2ae60b){if(_0x307405['body']['id']){delete _0x307405[_0x78c9('0x49')]['id'];}return db[_0x78c9('0x40')][_0x78c9('0x4a')]({'where':{'id':_0x307405[_0x78c9('0x46')]['id']}})[_0x78c9('0x25')](handleEntityNotFound(_0x2ae60b,null))[_0x78c9('0x25')](saveUpdates(_0x307405[_0x78c9('0x49')],null))[_0x78c9('0x25')](respondWithResult(_0x2ae60b,null))[_0x78c9('0x44')](handleError(_0x2ae60b,null));};exports[_0x78c9('0x4b')]=function(_0x2a46ff,_0x57305d){return db[_0x78c9('0x40')][_0x78c9('0x4a')]({'where':{'id':_0x2a46ff[_0x78c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x57305d,null))[_0x78c9('0x25')](removeEntity(_0x57305d,null))[_0x78c9('0x44')](handleError(_0x57305d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 30e3b03..543f86c 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 _0x2521=['idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x2521,0x84));var _0x1252=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x2521[_0x3bef2c];return _0x331503;};'use strict';var _=require('lodash');var util=require(_0x1252('0x0'));var logger=require(_0x1252('0x1'))(_0x1252('0x2'));var moment=require(_0x1252('0x3'));var BPromise=require('bluebird');var rp=require(_0x1252('0x4'));var fs=require('fs');var path=require(_0x1252('0x5'));var rimraf=require(_0x1252('0x6'));var config=require(_0x1252('0x7'));var attributes=require(_0x1252('0x8'));module[_0x1252('0x9')]=function(_0x22b878,_0x4cf800){return _0x22b878['define']('DeskField',attributes,{'tableName':_0x1252('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x1252('0xb'),_0x1252('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b4=['./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0xc8b4,0x14a));var _0x4c8b=function(_0x48d619,_0x4d2c68){_0x48d619=_0x48d619-0x0;var _0x190c7f=_0xc8b4[_0x48d619];return _0x190c7f;};'use strict';var _=require(_0x4c8b('0x0'));var util=require(_0x4c8b('0x1'));var logger=require(_0x4c8b('0x2'))('api');var moment=require(_0x4c8b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c8b('0x4'));var rimraf=require(_0x4c8b('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c8b('0x6'));module['exports']=function(_0x21fd05,_0x3f045e){return _0x21fd05[_0x4c8b('0x7')](_0x4c8b('0x8'),attributes,{'tableName':_0x4c8b('0x9'),'paranoid':![],'indexes':[{'name':_0x4c8b('0xa'),'fields':[_0x4c8b('0xb'),'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 6d69f7b..cb4e5c7 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 _0x8802=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5373f7,_0x13ec9b){var _0x17a3ae=function(_0x43ce31){while(--_0x43ce31){_0x5373f7['push'](_0x5373f7['shift']());}};_0x17a3ae(++_0x13ec9b);}(_0x8802,0x184));var _0x2880=function(_0x4fb789,_0x6b8092){_0x4fb789=_0x4fb789-0x0;var _0x49b5e4=_0x8802[_0x4fb789];return _0x49b5e4;};'use strict';var _=require('lodash');var util=require(_0x2880('0x0'));var moment=require(_0x2880('0x1'));var BPromise=require(_0x2880('0x2'));var rs=require(_0x2880('0x3'));var fs=require('fs');var Redis=require(_0x2880('0x4'));var db=require(_0x2880('0x5'))['db'];var utils=require(_0x2880('0x6'));var logger=require(_0x2880('0x7'))(_0x2880('0x8'));var config=require(_0x2880('0x9'));var jayson=require(_0x2880('0xa'));var client=jayson['client'][_0x2880('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3151ed,_0x232d7b,_0x1e6b98){return new BPromise(function(_0x10d987,_0x504210){return client[_0x2880('0xc')](_0x3151ed,_0x1e6b98)[_0x2880('0xd')](function(_0x57c284){logger[_0x2880('0xe')](_0x2880('0xf'),_0x232d7b,_0x2880('0x10'));logger[_0x2880('0x11')](_0x2880('0x12'),_0x232d7b,_0x2880('0x10'),JSON[_0x2880('0x13')](_0x57c284));if(_0x57c284[_0x2880('0x14')]){if(_0x57c284['error'][_0x2880('0x15')]===0x1f4){logger[_0x2880('0x14')](_0x2880('0xf'),_0x232d7b,_0x57c284[_0x2880('0x14')][_0x2880('0x16')]);return _0x504210(_0x57c284[_0x2880('0x14')][_0x2880('0x16')]);}logger[_0x2880('0x14')](_0x2880('0xf'),_0x232d7b,_0x57c284[_0x2880('0x14')]['message']);return _0x10d987(_0x57c284[_0x2880('0x14')][_0x2880('0x16')]);}else{logger['info'](_0x2880('0xf'),_0x232d7b,_0x2880('0x10'));_0x10d987(_0x57c284[_0x2880('0x17')][_0x2880('0x16')]);}})[_0x2880('0x18')](function(_0x5d1074){logger[_0x2880('0x14')](_0x2880('0xf'),_0x232d7b,_0x5d1074);_0x504210(_0x5d1074);});});} \ No newline at end of file +var _0xf9d6=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x224d78,_0xac1d29){var _0x52d48a=function(_0x5774a6){while(--_0x5774a6){_0x224d78['push'](_0x224d78['shift']());}};_0x52d48a(++_0xac1d29);}(_0xf9d6,0x144));var _0x6f9d=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0xf9d6[_0x9307ea];return _0x295554;};'use strict';var _=require(_0x6f9d('0x0'));var util=require(_0x6f9d('0x1'));var moment=require(_0x6f9d('0x2'));var BPromise=require(_0x6f9d('0x3'));var rs=require(_0x6f9d('0x4'));var fs=require('fs');var Redis=require(_0x6f9d('0x5'));var db=require(_0x6f9d('0x6'))['db'];var utils=require(_0x6f9d('0x7'));var logger=require('../../config/logger')(_0x6f9d('0x8'));var config=require('../../config/environment');var jayson=require(_0x6f9d('0x9'));var client=jayson[_0x6f9d('0xa')][_0x6f9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc4b5a3,_0x1e1f89,_0x54499a){return new BPromise(function(_0x567208,_0x32dab3){return client[_0x6f9d('0xc')](_0xc4b5a3,_0x54499a)[_0x6f9d('0xd')](function(_0x25af0d){logger[_0x6f9d('0xe')](_0x6f9d('0xf'),_0x1e1f89,_0x6f9d('0x10'));logger[_0x6f9d('0x11')](_0x6f9d('0x12'),_0x1e1f89,_0x6f9d('0x10'),JSON[_0x6f9d('0x13')](_0x25af0d));if(_0x25af0d['error']){if(_0x25af0d[_0x6f9d('0x14')][_0x6f9d('0x15')]===0x1f4){logger[_0x6f9d('0x14')]('DeskField,\x20%s,\x20%s',_0x1e1f89,_0x25af0d['error'][_0x6f9d('0x16')]);return _0x32dab3(_0x25af0d[_0x6f9d('0x14')][_0x6f9d('0x16')]);}logger[_0x6f9d('0x14')](_0x6f9d('0xf'),_0x1e1f89,_0x25af0d['error'][_0x6f9d('0x16')]);return _0x567208(_0x25af0d[_0x6f9d('0x14')][_0x6f9d('0x16')]);}else{logger[_0x6f9d('0xe')]('DeskField,\x20%s,\x20%s',_0x1e1f89,'request\x20sent');_0x567208(_0x25af0d['result'][_0x6f9d('0x16')]);}})['catch'](function(_0x219ac5){logger[_0x6f9d('0x14')](_0x6f9d('0xf'),_0x1e1f89,_0x219ac5);_0x32dab3(_0x219ac5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 38f6335..ac332a6 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 _0x98e9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','create','post','addConfiguration','/:id','update','delete','path','connect-timeout','express','Router','fs-extra'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x98e9,0xd7));var _0x998e=function(_0x4b1e86,_0x360dfa){_0x4b1e86=_0x4b1e86-0x0;var _0x107417=_0x98e9[_0x4b1e86];return _0x107417;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x998e('0x0'));var timeout=require(_0x998e('0x1'));var express=require(_0x998e('0x2'));var router=express[_0x998e('0x3')]();var fs_extra=require(_0x998e('0x4'));var auth=require(_0x998e('0x5'));var interaction=require(_0x998e('0x6'));var config=require(_0x998e('0x7'));var controller=require(_0x998e('0x8'));router['get']('/',auth[_0x998e('0x9')](),controller[_0x998e('0xa')]);router[_0x998e('0xb')]('/:id',auth[_0x998e('0x9')](),controller['show']);router[_0x998e('0xb')](_0x998e('0xc'),auth[_0x998e('0x9')](),controller[_0x998e('0xd')]);router[_0x998e('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x998e('0x9')](),controller[_0x998e('0xe')]);router[_0x998e('0xf')](_0x998e('0xc'),auth[_0x998e('0x9')](),controller[_0x998e('0x10')]);router['put'](_0x998e('0x11'),auth[_0x998e('0x9')](),controller[_0x998e('0x12')]);router[_0x998e('0x13')](_0x998e('0x11'),auth[_0x998e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5918=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x41aaa1,_0x413ddc){var _0x367de3=function(_0x266772){while(--_0x266772){_0x41aaa1['push'](_0x41aaa1['shift']());}};_0x367de3(++_0x413ddc);}(_0x5918,0x18b));var _0x8591=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5918[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8591('0x0'));var util=require(_0x8591('0x1'));var path=require(_0x8591('0x2'));var timeout=require('connect-timeout');var express=require(_0x8591('0x3'));var router=express[_0x8591('0x4')]();var fs_extra=require(_0x8591('0x5'));var auth=require(_0x8591('0x6'));var interaction=require(_0x8591('0x7'));var config=require(_0x8591('0x8'));var controller=require(_0x8591('0x9'));router[_0x8591('0xa')]('/',auth[_0x8591('0xb')](),controller['index']);router[_0x8591('0xa')](_0x8591('0xc'),auth['isAuthenticated'](),controller[_0x8591('0xd')]);router[_0x8591('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8591('0xe')]);router[_0x8591('0xa')](_0x8591('0xf'),auth[_0x8591('0xb')](),controller[_0x8591('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8591('0x11')]);router[_0x8591('0x12')](_0x8591('0x13'),auth['isAuthenticated'](),controller[_0x8591('0x14')]);router['put']('/:id',auth[_0x8591('0xb')](),controller[_0x8591('0x15')]);router[_0x8591('0x16')](_0x8591('0xc'),auth['isAuthenticated'](),controller[_0x8591('0x17')]);module[_0x8591('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 695758e..b549756 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 _0x5581=['STRING','sequelize'];(function(_0x6f62f4,_0x4e7215){var _0x3a0240=function(_0x3707e3){while(--_0x3707e3){_0x6f62f4['push'](_0x6f62f4['shift']());}};_0x3a0240(++_0x4e7215);}(_0x5581,0x115));var _0x1558=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x5581[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x1558('0x0'));module['exports']={'name':{'type':Sequelize[_0x1558('0x1')]},'username':{'type':Sequelize[_0x1558('0x1')]},'password':{'type':Sequelize[_0x1558('0x1')]},'remoteUri':{'type':Sequelize[_0x1558('0x1')]},'tenantId':{'type':Sequelize[_0x1558('0x1')]},'clientId':{'type':Sequelize[_0x1558('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1558('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1558('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3714=['BOOLEAN','sequelize','exports','STRING'];(function(_0x48126a,_0x306a2c){var _0x3ff786=function(_0x4fd24c){while(--_0x4fd24c){_0x48126a['push'](_0x48126a['shift']());}};_0x3ff786(++_0x306a2c);}(_0x3714,0x95));var _0x4371=function(_0x2bed0a,_0x32619b){_0x2bed0a=_0x2bed0a-0x0;var _0x350b0a=_0x3714[_0x2bed0a];return _0x350b0a;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4371('0x2')]},'password':{'type':Sequelize[_0x4371('0x2')]},'remoteUri':{'type':Sequelize[_0x4371('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4371('0x2')]},'clientSecret':{'type':Sequelize[_0x4371('0x2')]},'serverUrl':{'type':Sequelize[_0x4371('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4371('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3cfbd93..e6af27e 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 _0xc366=['primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','/oauth2/token','clientId','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','Value','LogicalName','OptionSet','TrueOption','UserLocalizedLabel','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','api','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','update','find','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname'];(function(_0x1c64b4,_0x2eb6f2){var _0xf63baa=function(_0x26e704){while(--_0x26e704){_0x1c64b4['push'](_0x1c64b4['shift']());}};_0xf63baa(++_0x2eb6f2);}(_0xc366,0x1c5));var _0x6c36=function(_0x47cd8c,_0x482199){_0x47cd8c=_0x47cd8c-0x0;var _0x375a6=_0xc366[_0x47cd8c];return _0x375a6;};'use strict';var rp=require(_0x6c36('0x0'));var util=require(_0x6c36('0x1'));var _=require(_0x6c36('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6c36('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x259073,_0x46de14){_0x46de14=_0x46de14||0xc8;return function(_0x2d28af){if(_0x2d28af){return _0x259073['status'](_0x46de14)[_0x6c36('0x4')](_0x2d28af);}};}function respondWithFilteredResult(_0x5d1d5e,_0x55591f){return function(_0x1e99a1){if(_0x1e99a1){var _0x422d5d=typeof _0x55591f[_0x6c36('0x5')]===_0x6c36('0x6')&&typeof _0x55591f[_0x6c36('0x7')]==='undefined';var _0xf9076b=_0x1e99a1[_0x6c36('0x8')];var _0x38d21d=_0x422d5d?0x0:_0x55591f[_0x6c36('0x5')];var _0x11de0e=_0x422d5d?_0x1e99a1[_0x6c36('0x8')]:_0x55591f[_0x6c36('0x5')]+_0x55591f[_0x6c36('0x7')];var _0x20486f;if(_0x11de0e>=_0xf9076b){_0x11de0e=_0xf9076b;_0x20486f=0xc8;}else{_0x20486f=0xce;}_0x5d1d5e[_0x6c36('0x9')](_0x20486f);return _0x5d1d5e[_0x6c36('0xa')](_0x6c36('0xb'),_0x38d21d+'-'+_0x11de0e+'/'+_0xf9076b)['json'](_0x1e99a1);}return null;};}function saveUpdates(_0x2cebf9){return function(_0x20b8ef){if(_0x20b8ef){return _0x20b8ef['update'](_0x2cebf9)[_0x6c36('0xc')](function(_0x104d19){return _0x104d19;});}return null;};}function removeEntity(_0x2c9c5a){return function(_0x3ccd4a){if(_0x3ccd4a){return _0x3ccd4a[_0x6c36('0xd')]()[_0x6c36('0xc')](function(){_0x2c9c5a['status'](0xcc)[_0x6c36('0xe')]();});}};}function handleEntityNotFound(_0x16d8ff){return function(_0x166a4d){if(!_0x166a4d){_0x16d8ff[_0x6c36('0xf')](0x194);}return _0x166a4d;};}function handleError(_0x3fdf58,_0x5bf446){_0x5bf446=_0x5bf446||0x1f4;return function(_0x1e5837){logger[_0x6c36('0x10')](_0x1e5837[_0x6c36('0x11')]);if(_0x1e5837[_0x6c36('0x12')]){delete _0x1e5837[_0x6c36('0x12')];}_0x3fdf58['status'](_0x5bf446)['send'](_0x1e5837);};}exports['index']=function(_0x1187fc,_0x332f63){var _0x522970={},_0x204852={},_0x4763be={'count':0x0,'rows':[]};var _0x1840a0=_[_0x6c36('0x13')](db[_0x6c36('0x14')][_0x6c36('0x15')],function(_0x152072){return{'name':_0x152072['fieldName'],'type':_0x152072['type'][_0x6c36('0x16')]};});_0x204852['model']=_[_0x6c36('0x13')](_0x1840a0,_0x6c36('0x12'));_0x204852['query']=_[_0x6c36('0x17')](_0x1187fc['query']);_0x204852[_0x6c36('0x18')]=_[_0x6c36('0x19')](_0x204852[_0x6c36('0x1a')],_0x204852[_0x6c36('0x1b')]);_0x522970[_0x6c36('0x1c')]=_[_0x6c36('0x19')](_0x204852[_0x6c36('0x1a')],qs[_0x6c36('0x1d')](_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x1d')]));_0x522970['attributes']=_0x522970[_0x6c36('0x1c')]['length']?_0x522970[_0x6c36('0x1c')]:_0x204852[_0x6c36('0x1a')];if(!_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x1e')](_0x6c36('0x1f'))){_0x522970[_0x6c36('0x7')]=qs[_0x6c36('0x7')](_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x7')]);_0x522970['offset']=qs[_0x6c36('0x5')](_0x1187fc[_0x6c36('0x1b')]['offset']);}_0x522970['order']=qs[_0x6c36('0x20')](_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x20')]);_0x522970[_0x6c36('0x21')]=qs[_0x6c36('0x18')](_[_0x6c36('0x22')](_0x1187fc['query'],_0x204852[_0x6c36('0x18')]),_0x1840a0);if(_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x23')]){_0x522970[_0x6c36('0x21')]=_[_0x6c36('0x24')](_0x522970[_0x6c36('0x21')],{'$or':_['map'](_0x1840a0,function(_0x49418f){if(_0x49418f[_0x6c36('0x25')]!==_0x6c36('0x26')){var _0x236954={};_0x236954[_0x49418f[_0x6c36('0x12')]]={'$like':'%'+_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x23')]+'%'};return _0x236954;}})});}_0x522970=_['merge']({},_0x522970,_0x1187fc[_0x6c36('0x27')]);var _0xa0f335={'where':_0x522970[_0x6c36('0x21')]};return db[_0x6c36('0x14')]['count'](_0xa0f335)['then'](function(_0x55b795){_0x4763be[_0x6c36('0x8')]=_0x55b795;if(_0x1187fc[_0x6c36('0x1b')][_0x6c36('0x28')]){_0x522970[_0x6c36('0x29')]=[{'all':!![]}];}return db[_0x6c36('0x14')][_0x6c36('0x2a')](_0x522970);})['then'](function(_0x2563d9){_0x4763be[_0x6c36('0x2b')]=_0x2563d9;return _0x4763be;})[_0x6c36('0xc')](respondWithFilteredResult(_0x332f63,_0x522970))[_0x6c36('0x2c')](handleError(_0x332f63,null));};exports['show']=function(_0x5e77a5,_0x51abb6){var _0x37e565={'raw':![],'where':{'id':_0x5e77a5[_0x6c36('0x2d')]['id']}},_0x10297b={};_0x10297b['model']=_[_0x6c36('0x17')](db[_0x6c36('0x14')][_0x6c36('0x15')]);_0x10297b[_0x6c36('0x1b')]=_[_0x6c36('0x17')](_0x5e77a5[_0x6c36('0x1b')]);_0x10297b[_0x6c36('0x18')]=_['intersection'](_0x10297b[_0x6c36('0x1a')],_0x10297b[_0x6c36('0x1b')]);_0x37e565[_0x6c36('0x1c')]=_['intersection'](_0x10297b['model'],qs['fields'](_0x5e77a5[_0x6c36('0x1b')][_0x6c36('0x1d')]));_0x37e565['attributes']=_0x37e565['attributes'][_0x6c36('0x2e')]?_0x37e565['attributes']:_0x10297b[_0x6c36('0x1a')];if(_0x5e77a5['query'][_0x6c36('0x28')]){_0x37e565[_0x6c36('0x29')]=[{'all':!![]}];}_0x37e565=_['merge']({},_0x37e565,_0x5e77a5[_0x6c36('0x27')]);return db['Dynamics365Account']['find'](_0x37e565)['then'](handleEntityNotFound(_0x51abb6,null))[_0x6c36('0xc')](respondWithResult(_0x51abb6,null))[_0x6c36('0x2c')](handleError(_0x51abb6,null));};exports[_0x6c36('0x2f')]=function(_0x1a1578,_0x5e1825){return db['Dynamics365Account']['create'](_0x1a1578[_0x6c36('0x30')],{})[_0x6c36('0xc')](respondWithResult(_0x5e1825,0xc9))['catch'](handleError(_0x5e1825,null));};exports[_0x6c36('0x31')]=function(_0xb5fa11,_0xa5f35c){if(_0xb5fa11[_0x6c36('0x30')]['id']){delete _0xb5fa11[_0x6c36('0x30')]['id'];}return db['Dynamics365Account'][_0x6c36('0x32')]({'where':{'id':_0xb5fa11['params']['id']}})['then'](handleEntityNotFound(_0xa5f35c,null))[_0x6c36('0xc')](saveUpdates(_0xb5fa11['body'],null))[_0x6c36('0xc')](respondWithResult(_0xa5f35c,null))['catch'](handleError(_0xa5f35c,null));};exports[_0x6c36('0xd')]=function(_0x2e1462,_0xe4e401){return db[_0x6c36('0x14')][_0x6c36('0x32')]({'where':{'id':_0x2e1462[_0x6c36('0x2d')]['id']}})[_0x6c36('0xc')](handleEntityNotFound(_0xe4e401,null))['then'](removeEntity(_0xe4e401,null))[_0x6c36('0x2c')](handleError(_0xe4e401,null));};exports['getConfigurations']=function(_0x2a44e3,_0x2d2082){var _0x4ee511={};var _0x97c328={};var _0x2b1d34;var _0x168a46;return db[_0x6c36('0x14')]['findOne']({'where':{'id':_0x2a44e3[_0x6c36('0x2d')]['id']}})[_0x6c36('0xc')](handleEntityNotFound(_0x2d2082,null))[_0x6c36('0xc')](function(_0x56295f){if(_0x56295f){_0x2b1d34=_0x56295f;_0x97c328[_0x6c36('0x1a')]=_['keys'](db[_0x6c36('0x33')][_0x6c36('0x15')]);_0x97c328[_0x6c36('0x1b')]=_[_0x6c36('0x17')](_0x2a44e3[_0x6c36('0x1b')]);_0x97c328[_0x6c36('0x18')]=_[_0x6c36('0x19')](_0x97c328[_0x6c36('0x1a')],_0x97c328[_0x6c36('0x1b')]);_0x4ee511['attributes']=_[_0x6c36('0x19')](_0x97c328[_0x6c36('0x1a')],qs[_0x6c36('0x1d')](_0x2a44e3[_0x6c36('0x1b')][_0x6c36('0x1d')]));_0x4ee511[_0x6c36('0x1c')]=_0x4ee511['attributes'][_0x6c36('0x2e')]?_0x4ee511['attributes']:_0x97c328[_0x6c36('0x1a')];_0x4ee511['order']=qs[_0x6c36('0x20')](_0x2a44e3[_0x6c36('0x1b')]['sort']);_0x4ee511['where']=qs[_0x6c36('0x18')](_[_0x6c36('0x22')](_0x2a44e3[_0x6c36('0x1b')],_0x97c328[_0x6c36('0x18')]));if(_0x2a44e3[_0x6c36('0x1b')]['filter']){_0x4ee511[_0x6c36('0x21')]=_[_0x6c36('0x24')](_0x4ee511[_0x6c36('0x21')],{'$or':_['map'](_0x4ee511[_0x6c36('0x1c')],function(_0x32869a){var _0x45dde1={};_0x45dde1[_0x32869a]={'$like':'%'+_0x2a44e3[_0x6c36('0x1b')][_0x6c36('0x23')]+'%'};return _0x45dde1;})});}_0x4ee511=_[_0x6c36('0x24')]({},_0x4ee511,_0x2a44e3['options']);return _0x2b1d34['getConfigurations'](_0x4ee511);}})[_0x6c36('0xc')](function(_0x2827e0){if(_0x2827e0){_0x168a46=_0x2827e0[_0x6c36('0x2e')];if(!_0x2a44e3[_0x6c36('0x1b')][_0x6c36('0x1e')](_0x6c36('0x1f'))){_0x4ee511[_0x6c36('0x7')]=qs[_0x6c36('0x7')](_0x2a44e3['query'][_0x6c36('0x7')]);_0x4ee511[_0x6c36('0x5')]=qs['offset'](_0x2a44e3['query'][_0x6c36('0x5')]);}return _0x2b1d34['getConfigurations'](_0x4ee511);}})[_0x6c36('0xc')](function(_0x41ba26){if(_0x41ba26){return _0x41ba26?{'count':_0x168a46,'rows':_0x41ba26}:null;}})[_0x6c36('0xc')](respondWithResult(_0x2d2082,null))[_0x6c36('0x2c')](handleError(_0x2d2082,null));};exports['addConfiguration']=function(_0xdf3008,_0x2cdbc7){if(_0xdf3008[_0x6c36('0x30')]['id']){delete _0xdf3008[_0x6c36('0x30')]['id'];}return db['Dynamics365Account'][_0x6c36('0x34')]({'where':{'id':_0xdf3008['params']['id']}})['then'](handleEntityNotFound(_0x2cdbc7,null))[_0x6c36('0xc')](function(_0x4972cb){if(_0x4972cb){_0xdf3008['body'][_0x6c36('0x35')]=_0x4972cb['id'];_0xdf3008['body'][_0x6c36('0x36')]=integrations[_0x6c36('0x37')](_0xdf3008['body']['channel'],_0xdf3008[_0x6c36('0x30')][_0x6c36('0x25')]);_0xdf3008[_0x6c36('0x30')][_0x6c36('0x38')]=integrations[_0x6c36('0x39')](_0xdf3008['body'][_0x6c36('0x3a')],_0xdf3008['body']['type']);return db[_0x6c36('0x33')]['create'](_0xdf3008['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x6c36('0x36')},{'model':db[_0x6c36('0x3b')],'as':_0x6c36('0x38')}]});}return null;})['then'](respondWithResult(_0x2cdbc7,null))[_0x6c36('0x2c')](handleError(_0x2cdbc7,null));};function sanitizeRemoteUri(_0x1b7a90){var _0x3a2797=_0x1b7a90[_0x6c36('0x3c')](-0x1);if(_0x3a2797==='/')return _0x1b7a90['substring'](0x0,_0x1b7a90['lastIndexOf'](_0x3a2797));return _0x1b7a90;}function getWebApiUrl(_0xc2533a){return util[_0x6c36('0x3d')](_0x6c36('0x3e'),_0xc2533a);}exports[_0x6c36('0x3f')]=function(_0x2455ca,_0x34afd5){var _0x17fbdd=_0x2455ca[_0x6c36('0x1b')][_0x6c36('0x40')];var _0xb4344a=_0x17fbdd==='incident'?_0x6c36('0x41'):_0x6c36('0x42');var _0x2ea7e7='';var _0x4e0dd6='';var _0x3edf44='';var _0x4a5766='';var _0xdf95a0='';var _0x2ccb1a='';var _0x183adc='';var _0x13fc8e='';var _0x18e21e=['title',_0x6c36('0x43'),_0x6c36('0x44'),_0x6c36('0x45'),_0x6c36('0x46'),'subject',_0x6c36('0x47'),_0x6c36('0x48'),_0x6c36('0x49'),'phonecall_activity_parties'];var _0x774d7=[_0x6c36('0x4a'),'accountidyominame',_0x6c36('0x4b'),'billedserviceunits',_0x6c36('0x4c'),_0x6c36('0x4d'),'contractdetailidname',_0x6c36('0x4e'),_0x6c36('0x4f'),_0x6c36('0x50'),_0x6c36('0x51'),_0x6c36('0x52'),_0x6c36('0x53'),_0x6c36('0x54'),_0x6c36('0x55'),_0x6c36('0x56'),'customeridtype',_0x6c36('0x57'),_0x6c36('0x58'),_0x6c36('0x59'),_0x6c36('0x5a'),_0x6c36('0x5b'),_0x6c36('0x5c'),_0x6c36('0x5d'),_0x6c36('0x5e'),_0x6c36('0x5f'),_0x6c36('0x60'),_0x6c36('0x61'),_0x6c36('0x62'),_0x6c36('0x63'),_0x6c36('0x64'),_0x6c36('0x65'),'modifiedbyexternalpartyyominame',_0x6c36('0x66'),_0x6c36('0x67'),_0x6c36('0x68'),'modifiedonbehalfbyname',_0x6c36('0x69'),_0x6c36('0x6a'),_0x6c36('0x6b'),_0x6c36('0x6c'),_0x6c36('0x6d'),_0x6c36('0x6e'),_0x6c36('0x6f'),'owneridtype','owneridyominame',_0x6c36('0x70'),_0x6c36('0x71'),_0x6c36('0x72'),_0x6c36('0x73'),_0x6c36('0x74'),'productserialnumber',_0x6c36('0x75'),_0x6c36('0x76'),_0x6c36('0x77'),_0x6c36('0x78'),_0x6c36('0x79'),_0x6c36('0x7a'),_0x6c36('0x7b'),'slaname',_0x6c36('0x7c'),_0x6c36('0x7d'),_0x6c36('0x7e'),'subjectidname',_0x6c36('0x7f'),_0x6c36('0x80'),'transactioncurrencyidname',_0x6c36('0x81'),_0x6c36('0x82'),_0x6c36('0x83')];var _0x46a501=_0x18e21e[_0x6c36('0x84')](_0x774d7);return db[_0x6c36('0x14')]['findOne']({'where':{'id':_0x2455ca[_0x6c36('0x2d')]['id']},'attributes':['id','username','password',_0x6c36('0x85'),_0x6c36('0x86'),'clientId',_0x6c36('0x87'),_0x6c36('0x88')],'include':[{'model':db[_0x6c36('0x89')],'as':_0x6c36('0x89'),'attributes':['id','data5',_0x6c36('0x8a')]}]})[_0x6c36('0xc')](handleEntityNotFound(_0x34afd5,null))['then'](function(_0x53cce7){if(_0x53cce7){if(_0x53cce7['modernAuthentication']){_0x53cce7[_0x6c36('0x8b')]=_0x53cce7['CloudProvider'][_0x6c36('0x8c')];_0x13fc8e=sanitizeRemoteUri(_0x53cce7[_0x6c36('0x89')][_0x6c36('0x8a')]);_0x183adc=getWebApiUrl(_0x13fc8e);return _0x53cce7;}_0x13fc8e=sanitizeRemoteUri(_0x53cce7[_0x6c36('0x85')]);_0x183adc=getWebApiUrl(_0x13fc8e);var _0x1d13a2={'method':_0x6c36('0x8d'),'uri':'https://login.microsoftonline.com/'+_0x53cce7[_0x6c36('0x86')]+_0x6c36('0x8e'),'form':{'client_id':_0x53cce7[_0x6c36('0x8f')],'resource':_0x13fc8e,'username':_0x53cce7[_0x6c36('0x90')],'password':_0x53cce7[_0x6c36('0x91')],'grant_type':'password','client_secret':_0x53cce7['clientSecret']},'json':!![]};return rp(_0x1d13a2);}})['then'](function(_0x11ab04){_0x2ccb1a=_0x11ab04['access_token'];var _0x25e7a9={'method':_0x6c36('0x92'),'uri':encodeURI(_0x183adc+_0x6c36('0x93')+_0xb4344a+'\x27'),'headers':{'Authorization':_0x6c36('0x94')+_0x2ccb1a,'If-None-Match':null,'OData-Version':_0x6c36('0x95')},'json':!![]};return rp(_0x25e7a9);})[_0x6c36('0xc')](function(_0x523cee){var _0xf4db6c=_0x523cee['value'][0x0];var _0x3833d0=_0xf4db6c[_0x6c36('0x96')];var _0xc21040={'method':_0x6c36('0x92'),'uri':_0x183adc+_0x6c36('0x97')+_0x3833d0+_0x6c36('0x98'),'headers':{'Authorization':_0x6c36('0x94')+_0x2ccb1a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xc21040);})[_0x6c36('0xc')](function(_0x55f40a){_0x2ea7e7=_0x55f40a;_0x4e0dd6=_0x2ea7e7[_0x6c36('0x99')];_0x4e0dd6=_[_0x6c36('0x9a')](_0x4e0dd6,function(_0x1e61b7){return!_0x46a501[_0x6c36('0x9b')](_0x1e61b7['LogicalName']);});var _0x4c5100=[];var _0x125d5c=[];_0x4e0dd6[_0x6c36('0x9c')](function(_0x2c27a2){if(_0x2c27a2['@odata.type']){var _0x1e01e7=_0x2c27a2[_0x6c36('0x9d')]['substring'](_0x2c27a2[_0x6c36('0x9d')][_0x6c36('0x9e')]('.')+0x1);if(_0x1e01e7===_0x6c36('0x9f')){_0x4c5100[_0x6c36('0xa0')](getSelectList(_0x183adc,_0x17fbdd,_0x125d5c,_0x2ea7e7[_0x6c36('0x96')],_0x2c27a2[_0x6c36('0x96')],_0x2ccb1a));}}});return Promise[_0x6c36('0xa1')](_0x4c5100);})[_0x6c36('0xc')](function(_0x5132c8){_0x3edf44=_0x5132c8[0x0];var _0x372f8d=[];var _0x1af3b1=[];_0x4e0dd6[_0x6c36('0x9c')](function(_0x9e3d93){if(!_[_0x6c36('0xa2')](_0x9e3d93[_0x6c36('0x9d')])){var _0x9af491=_0x9e3d93[_0x6c36('0x9d')][_0x6c36('0xa3')](_0x9e3d93[_0x6c36('0x9d')]['lastIndexOf']('.')+0x1);if(_0x9af491===_0x6c36('0xa4')){_0x372f8d[_0x6c36('0xa0')](getBooleanList(_0x183adc,_0x17fbdd,_0x1af3b1,_0x2ea7e7[_0x6c36('0x96')],_0x9e3d93[_0x6c36('0x96')],_0x2ccb1a));}}});return Promise[_0x6c36('0xa1')](_0x372f8d);})[_0x6c36('0xc')](function(_0x16b001){_0x4a5766=_0x16b001[0x0];var _0x7a06d8=[];var _0x139958=[];_0x4e0dd6[_0x6c36('0x9c')](function(_0x36a6c9){if(_0x36a6c9[_0x6c36('0x9d')]){var _0x528b63=_0x36a6c9[_0x6c36('0x9d')][_0x6c36('0xa3')](_0x36a6c9[_0x6c36('0x9d')][_0x6c36('0x9e')]('.')+0x1);if(_0x528b63==='StringAttributeMetadata'||_0x528b63==='DoubleAttributeMetadata'||_0x528b63===_0x6c36('0xa5')||_0x528b63===_0x6c36('0xa6')||_0x528b63==='MemoAttributeMetadata'||_0x528b63===_0x6c36('0xa7')||_0x528b63===_0x6c36('0xa8')||_0x528b63===_0x6c36('0xa9')||_0x528b63===_0x6c36('0xaa')||_0x528b63===_0x6c36('0xab')){_0x7a06d8[_0x6c36('0xa0')](getInputList(_0x183adc,_0x17fbdd,_0x528b63,_0x139958,_0x2ea7e7['MetadataId'],_0x36a6c9[_0x6c36('0x96')],_0x2ccb1a));}}});return Promise['all'](_0x7a06d8);})['then'](function(_0x208760){_0xdf95a0=_0x208760[0x0];var _0x25df0e=_0x3edf44[_0x6c36('0x84')](_0x4a5766)[_0x6c36('0x84')](_0xdf95a0);var _0x44a866={'count':_0x25df0e['length'],'rows':_0x25df0e};return _0x44a866;})[_0x6c36('0xc')](respondWithResult(_0x34afd5,null))[_0x6c36('0x2c')](function(_0x4996a2){var _0x281f12=_0x2455ca['query'][_0x6c36('0xac')]?0x1f4:_0x4996a2[_0x6c36('0xad')]||0x1f4;logger[_0x6c36('0x10')](_0x4996a2[_0x6c36('0x11')]);delete _0x4996a2[_0x6c36('0x12')];if(_0x281f12===0x191){_0x281f12=0x190;}_0x34afd5[_0x6c36('0x9')](_0x281f12)[_0x6c36('0xae')](_0x2455ca[_0x6c36('0x1b')][_0x6c36('0xac')]?{'message':_0x6c36('0xaf'),'statusCode':_0x4996a2['statusCode']}:_0x4996a2);});};function getSelectList(_0x11ba80,_0x2cbdc9,_0x230580,_0x58c6cf,_0x329163,_0x2cf8f7){var _0x2e555e={'method':_0x6c36('0x92'),'uri':_0x11ba80+'EntityDefinitions('+_0x58c6cf+_0x6c36('0xb0')+_0x329163+_0x6c36('0xb1')+_0x6c36('0xb2'),'headers':{'Authorization':_0x6c36('0x94')+_0x2cf8f7,'If-None-Match':null,'OData-Version':_0x6c36('0x95')},'json':!![]};return rp(_0x2e555e)[_0x6c36('0xc')](function(_0x1da728){var _0x555db9=[];var _0xc27364=_0x1da728['OptionSet']['Options'];_0xc27364['forEach'](function(_0x202b3a){_0x555db9['push']({'name':_0x202b3a['Label']['UserLocalizedLabel'][_0x6c36('0xb3')],'value':String(_0x202b3a[_0x6c36('0xb4')])});});var _0x1aebe5={'id':_0x2cbdc9+'_'+_0x1da728[_0x6c36('0xb5')],'name':_0x1da728['DisplayName']['UserLocalizedLabel'][_0x6c36('0xb3')],'custom':![],'options':_0x555db9};_0x230580[_0x6c36('0xa0')](_0x1aebe5);return _0x230580;});}function getBooleanList(_0x5837b4,_0xa79d02,_0x5e5995,_0x555ee0,_0xf0ca26,_0x241ba7){var _0x26db87={'method':_0x6c36('0x92'),'uri':_0x5837b4+'EntityDefinitions('+_0x555ee0+_0x6c36('0xb0')+_0xf0ca26+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x6c36('0x94')+_0x241ba7,'If-None-Match':null,'OData-Version':_0x6c36('0x95')},'json':!![]};return rp(_0x26db87)[_0x6c36('0xc')](function(_0x411c5d){var _0x4777ff=[];_0x4777ff[_0x6c36('0xa0')]({'name':_0x411c5d[_0x6c36('0xb6')][_0x6c36('0xb7')][_0x6c36('0xb3')][_0x6c36('0xb8')][_0x6c36('0xb3')],'value':'true'},{'name':_0x411c5d[_0x6c36('0xb6')]['FalseOption'][_0x6c36('0xb3')][_0x6c36('0xb8')][_0x6c36('0xb3')],'value':_0x6c36('0xb9')});var _0x3f923={'id':_0xa79d02+'_'+_0x411c5d[_0x6c36('0xb5')],'name':_0x411c5d[_0x6c36('0xba')][_0x6c36('0xb8')][_0x6c36('0xb3')],'custom':![],'options':_0x4777ff};_0x5e5995[_0x6c36('0xa0')](_0x3f923);return _0x5e5995;});}function getInputList(_0x5f14ca,_0x320d4d,_0x43ce5d,_0x3fc899,_0x37b6b5,_0x40699a,_0x48c08f){var _0xc42739={'method':_0x6c36('0x92'),'uri':_0x5f14ca+'EntityDefinitions('+_0x37b6b5+_0x6c36('0xb0')+_0x40699a+_0x6c36('0xbb')+_0x43ce5d+_0x6c36('0xbc'),'headers':{'Authorization':_0x6c36('0x94')+_0x48c08f,'If-None-Match':null,'OData-Version':_0x6c36('0x95')},'json':!![]};return rp(_0xc42739)[_0x6c36('0xc')](function(_0xcd6e05){var _0x5684a1={'id':_0x320d4d+'_'+_0xcd6e05[_0x6c36('0xb5')],'name':_0xcd6e05['DisplayName']['UserLocalizedLabel']?_0xcd6e05[_0x6c36('0xba')][_0x6c36('0xb8')]['Label']:_0xcd6e05['LogicalName'],'custom':![],'options':[]};_0x3fc899[_0x6c36('0xa0')](_0x5684a1);return _0x3fc899;});} \ No newline at end of file +var _0x96ca=['versionnumber','concat','username','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Options','UserLocalizedLabel','Label','DisplayName','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getConfigurations','order','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','subject','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode'];(function(_0x132659,_0x486e0c){var _0x215fc3=function(_0x3a14e8){while(--_0x3a14e8){_0x132659['push'](_0x132659['shift']());}};_0x215fc3(++_0x486e0c);}(_0x96ca,0xf1));var _0xa96c=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0x96ca[_0xafceaf];return _0x3684e4;};'use strict';var rp=require(_0xa96c('0x0'));var util=require(_0xa96c('0x1'));var _=require(_0xa96c('0x2'));var qs=require(_0xa96c('0x3'));var logger=require(_0xa96c('0x4'))(_0xa96c('0x5'));var db=require(_0xa96c('0x6'))['db'];var integrations=require(_0xa96c('0x7'));function respondWithResult(_0x569883,_0x5e0a72){_0x5e0a72=_0x5e0a72||0xc8;return function(_0x455e82){if(_0x455e82){return _0x569883['status'](_0x5e0a72)[_0xa96c('0x8')](_0x455e82);}};}function respondWithFilteredResult(_0x3d8e18,_0x2b0ae5){return function(_0xe6f02c){if(_0xe6f02c){var _0x550dac=typeof _0x2b0ae5[_0xa96c('0x9')]===_0xa96c('0xa')&&typeof _0x2b0ae5[_0xa96c('0xb')]===_0xa96c('0xa');var _0x320273=_0xe6f02c[_0xa96c('0xc')];var _0x173c6c=_0x550dac?0x0:_0x2b0ae5[_0xa96c('0x9')];var _0x1b891f=_0x550dac?_0xe6f02c[_0xa96c('0xc')]:_0x2b0ae5[_0xa96c('0x9')]+_0x2b0ae5['limit'];var _0x555d88;if(_0x1b891f>=_0x320273){_0x1b891f=_0x320273;_0x555d88=0xc8;}else{_0x555d88=0xce;}_0x3d8e18[_0xa96c('0xd')](_0x555d88);return _0x3d8e18[_0xa96c('0xe')](_0xa96c('0xf'),_0x173c6c+'-'+_0x1b891f+'/'+_0x320273)['json'](_0xe6f02c);}return null;};}function saveUpdates(_0x3e0245){return function(_0x7ea15c){if(_0x7ea15c){return _0x7ea15c[_0xa96c('0x10')](_0x3e0245)['then'](function(_0x41e21b){return _0x41e21b;});}return null;};}function removeEntity(_0x25c4d4){return function(_0x24ec21){if(_0x24ec21){return _0x24ec21[_0xa96c('0x11')]()[_0xa96c('0x12')](function(){_0x25c4d4['status'](0xcc)[_0xa96c('0x13')]();});}};}function handleEntityNotFound(_0x1eedb9){return function(_0x3dd0d9){if(!_0x3dd0d9){_0x1eedb9[_0xa96c('0x14')](0x194);}return _0x3dd0d9;};}function handleError(_0x5e6809,_0x4820cd){_0x4820cd=_0x4820cd||0x1f4;return function(_0x510098){logger[_0xa96c('0x15')](_0x510098[_0xa96c('0x16')]);if(_0x510098[_0xa96c('0x17')]){delete _0x510098[_0xa96c('0x17')];}_0x5e6809[_0xa96c('0xd')](_0x4820cd)[_0xa96c('0x18')](_0x510098);};}exports[_0xa96c('0x19')]=function(_0x42fc8d,_0x26c45b){var _0x4c1914={},_0x188727={},_0xcbce78={'count':0x0,'rows':[]};var _0x5b6085=_[_0xa96c('0x1a')](db[_0xa96c('0x1b')]['rawAttributes'],function(_0x4acf7f){return{'name':_0x4acf7f[_0xa96c('0x1c')],'type':_0x4acf7f[_0xa96c('0x1d')][_0xa96c('0x1e')]};});_0x188727[_0xa96c('0x1f')]=_[_0xa96c('0x1a')](_0x5b6085,'name');_0x188727[_0xa96c('0x20')]=_[_0xa96c('0x21')](_0x42fc8d[_0xa96c('0x20')]);_0x188727[_0xa96c('0x22')]=_[_0xa96c('0x23')](_0x188727[_0xa96c('0x1f')],_0x188727['query']);_0x4c1914[_0xa96c('0x24')]=_[_0xa96c('0x23')](_0x188727[_0xa96c('0x1f')],qs[_0xa96c('0x25')](_0x42fc8d[_0xa96c('0x20')][_0xa96c('0x25')]));_0x4c1914[_0xa96c('0x24')]=_0x4c1914[_0xa96c('0x24')][_0xa96c('0x26')]?_0x4c1914[_0xa96c('0x24')]:_0x188727['model'];if(!_0x42fc8d[_0xa96c('0x20')]['hasOwnProperty'](_0xa96c('0x27'))){_0x4c1914[_0xa96c('0xb')]=qs['limit'](_0x42fc8d['query'][_0xa96c('0xb')]);_0x4c1914[_0xa96c('0x9')]=qs[_0xa96c('0x9')](_0x42fc8d[_0xa96c('0x20')][_0xa96c('0x9')]);}_0x4c1914['order']=qs[_0xa96c('0x28')](_0x42fc8d[_0xa96c('0x20')][_0xa96c('0x28')]);_0x4c1914[_0xa96c('0x29')]=qs[_0xa96c('0x22')](_[_0xa96c('0x2a')](_0x42fc8d[_0xa96c('0x20')],_0x188727[_0xa96c('0x22')]),_0x5b6085);if(_0x42fc8d[_0xa96c('0x20')][_0xa96c('0x2b')]){_0x4c1914[_0xa96c('0x29')]=_[_0xa96c('0x2c')](_0x4c1914[_0xa96c('0x29')],{'$or':_[_0xa96c('0x1a')](_0x5b6085,function(_0x4e4dde){if(_0x4e4dde[_0xa96c('0x1d')]!=='VIRTUAL'){var _0x36224f={};_0x36224f[_0x4e4dde['name']]={'$like':'%'+_0x42fc8d[_0xa96c('0x20')]['filter']+'%'};return _0x36224f;}})});}_0x4c1914=_[_0xa96c('0x2c')]({},_0x4c1914,_0x42fc8d[_0xa96c('0x2d')]);var _0x5dfce1={'where':_0x4c1914[_0xa96c('0x29')]};return db[_0xa96c('0x1b')][_0xa96c('0xc')](_0x5dfce1)[_0xa96c('0x12')](function(_0xc22684){_0xcbce78[_0xa96c('0xc')]=_0xc22684;if(_0x42fc8d[_0xa96c('0x20')][_0xa96c('0x2e')]){_0x4c1914['include']=[{'all':!![]}];}return db[_0xa96c('0x1b')][_0xa96c('0x2f')](_0x4c1914);})[_0xa96c('0x12')](function(_0x1f239f){_0xcbce78[_0xa96c('0x30')]=_0x1f239f;return _0xcbce78;})[_0xa96c('0x12')](respondWithFilteredResult(_0x26c45b,_0x4c1914))[_0xa96c('0x31')](handleError(_0x26c45b,null));};exports[_0xa96c('0x32')]=function(_0x4ca725,_0x14ecad){var _0x2fb8d0={'raw':![],'where':{'id':_0x4ca725['params']['id']}},_0x20af54={};_0x20af54['model']=_[_0xa96c('0x21')](db[_0xa96c('0x1b')][_0xa96c('0x33')]);_0x20af54['query']=_[_0xa96c('0x21')](_0x4ca725[_0xa96c('0x20')]);_0x20af54[_0xa96c('0x22')]=_[_0xa96c('0x23')](_0x20af54[_0xa96c('0x1f')],_0x20af54[_0xa96c('0x20')]);_0x2fb8d0[_0xa96c('0x24')]=_['intersection'](_0x20af54['model'],qs[_0xa96c('0x25')](_0x4ca725[_0xa96c('0x20')][_0xa96c('0x25')]));_0x2fb8d0[_0xa96c('0x24')]=_0x2fb8d0[_0xa96c('0x24')][_0xa96c('0x26')]?_0x2fb8d0[_0xa96c('0x24')]:_0x20af54['model'];if(_0x4ca725['query'][_0xa96c('0x2e')]){_0x2fb8d0[_0xa96c('0x34')]=[{'all':!![]}];}_0x2fb8d0=_['merge']({},_0x2fb8d0,_0x4ca725['options']);return db['Dynamics365Account'][_0xa96c('0x35')](_0x2fb8d0)[_0xa96c('0x12')](handleEntityNotFound(_0x14ecad,null))[_0xa96c('0x12')](respondWithResult(_0x14ecad,null))[_0xa96c('0x31')](handleError(_0x14ecad,null));};exports[_0xa96c('0x36')]=function(_0x5921be,_0x14f02d){return db[_0xa96c('0x1b')][_0xa96c('0x36')](_0x5921be[_0xa96c('0x37')],{})[_0xa96c('0x12')](respondWithResult(_0x14f02d,0xc9))[_0xa96c('0x31')](handleError(_0x14f02d,null));};exports[_0xa96c('0x10')]=function(_0x418963,_0x5e4dcf){if(_0x418963[_0xa96c('0x37')]['id']){delete _0x418963[_0xa96c('0x37')]['id'];}return db[_0xa96c('0x1b')][_0xa96c('0x35')]({'where':{'id':_0x418963[_0xa96c('0x38')]['id']}})['then'](handleEntityNotFound(_0x5e4dcf,null))[_0xa96c('0x12')](saveUpdates(_0x418963['body'],null))[_0xa96c('0x12')](respondWithResult(_0x5e4dcf,null))['catch'](handleError(_0x5e4dcf,null));};exports[_0xa96c('0x11')]=function(_0xaf87f6,_0x1acf61){return db[_0xa96c('0x1b')]['find']({'where':{'id':_0xaf87f6[_0xa96c('0x38')]['id']}})[_0xa96c('0x12')](handleEntityNotFound(_0x1acf61,null))[_0xa96c('0x12')](removeEntity(_0x1acf61,null))[_0xa96c('0x31')](handleError(_0x1acf61,null));};exports[_0xa96c('0x39')]=function(_0x2ea9ee,_0x39e6c2){var _0x573562={};var _0x370396={};var _0x82b0cb;var _0xccd3fa;return db[_0xa96c('0x1b')]['findOne']({'where':{'id':_0x2ea9ee['params']['id']}})[_0xa96c('0x12')](handleEntityNotFound(_0x39e6c2,null))[_0xa96c('0x12')](function(_0x4e578c){if(_0x4e578c){_0x82b0cb=_0x4e578c;_0x370396[_0xa96c('0x1f')]=_[_0xa96c('0x21')](db['Dynamics365Configuration'][_0xa96c('0x33')]);_0x370396['query']=_[_0xa96c('0x21')](_0x2ea9ee['query']);_0x370396['filters']=_[_0xa96c('0x23')](_0x370396[_0xa96c('0x1f')],_0x370396[_0xa96c('0x20')]);_0x573562[_0xa96c('0x24')]=_[_0xa96c('0x23')](_0x370396[_0xa96c('0x1f')],qs[_0xa96c('0x25')](_0x2ea9ee['query']['fields']));_0x573562['attributes']=_0x573562['attributes'][_0xa96c('0x26')]?_0x573562[_0xa96c('0x24')]:_0x370396[_0xa96c('0x1f')];_0x573562[_0xa96c('0x3a')]=qs[_0xa96c('0x28')](_0x2ea9ee['query']['sort']);_0x573562[_0xa96c('0x29')]=qs[_0xa96c('0x22')](_['pick'](_0x2ea9ee[_0xa96c('0x20')],_0x370396[_0xa96c('0x22')]));if(_0x2ea9ee[_0xa96c('0x20')][_0xa96c('0x2b')]){_0x573562['where']=_['merge'](_0x573562[_0xa96c('0x29')],{'$or':_[_0xa96c('0x1a')](_0x573562[_0xa96c('0x24')],function(_0x36d535){var _0x48b6fc={};_0x48b6fc[_0x36d535]={'$like':'%'+_0x2ea9ee[_0xa96c('0x20')]['filter']+'%'};return _0x48b6fc;})});}_0x573562=_[_0xa96c('0x2c')]({},_0x573562,_0x2ea9ee[_0xa96c('0x2d')]);return _0x82b0cb['getConfigurations'](_0x573562);}})[_0xa96c('0x12')](function(_0x55ba35){if(_0x55ba35){_0xccd3fa=_0x55ba35[_0xa96c('0x26')];if(!_0x2ea9ee['query'][_0xa96c('0x3b')](_0xa96c('0x27'))){_0x573562[_0xa96c('0xb')]=qs['limit'](_0x2ea9ee[_0xa96c('0x20')][_0xa96c('0xb')]);_0x573562[_0xa96c('0x9')]=qs[_0xa96c('0x9')](_0x2ea9ee[_0xa96c('0x20')][_0xa96c('0x9')]);}return _0x82b0cb['getConfigurations'](_0x573562);}})[_0xa96c('0x12')](function(_0xd9eaba){if(_0xd9eaba){return _0xd9eaba?{'count':_0xccd3fa,'rows':_0xd9eaba}:null;}})[_0xa96c('0x12')](respondWithResult(_0x39e6c2,null))[_0xa96c('0x31')](handleError(_0x39e6c2,null));};exports[_0xa96c('0x3c')]=function(_0x1ef810,_0x41f515){if(_0x1ef810[_0xa96c('0x37')]['id']){delete _0x1ef810[_0xa96c('0x37')]['id'];}return db[_0xa96c('0x1b')][_0xa96c('0x3d')]({'where':{'id':_0x1ef810[_0xa96c('0x38')]['id']}})[_0xa96c('0x12')](handleEntityNotFound(_0x41f515,null))[_0xa96c('0x12')](function(_0x3cf7f9){if(_0x3cf7f9){_0x1ef810[_0xa96c('0x37')][_0xa96c('0x3e')]=_0x3cf7f9['id'];_0x1ef810[_0xa96c('0x37')][_0xa96c('0x3f')]=integrations[_0xa96c('0x40')](_0x1ef810[_0xa96c('0x37')][_0xa96c('0x41')],_0x1ef810['body']['type']);_0x1ef810[_0xa96c('0x37')][_0xa96c('0x42')]=integrations[_0xa96c('0x43')](_0x1ef810[_0xa96c('0x37')]['channel'],_0x1ef810['body'][_0xa96c('0x1d')]);return db[_0xa96c('0x44')]['create'](_0x1ef810[_0xa96c('0x37')],{'include':[{'model':db[_0xa96c('0x45')],'as':'Subjects'},{'model':db[_0xa96c('0x45')],'as':_0xa96c('0x42')}]});}return null;})[_0xa96c('0x12')](respondWithResult(_0x41f515,null))[_0xa96c('0x31')](handleError(_0x41f515,null));};function sanitizeRemoteUri(_0x23e1ea){var _0x8ab919=_0x23e1ea['slice'](-0x1);if(_0x8ab919==='/')return _0x23e1ea[_0xa96c('0x46')](0x0,_0x23e1ea[_0xa96c('0x47')](_0x8ab919));return _0x23e1ea;}function getWebApiUrl(_0x1509d3){return util[_0xa96c('0x48')](_0xa96c('0x49'),_0x1509d3);}exports[_0xa96c('0x4a')]=function(_0x4a86b5,_0x48f522){var _0x18ce1f=_0x4a86b5[_0xa96c('0x20')][_0xa96c('0x4b')];var _0x27a6b2=_0x18ce1f===_0xa96c('0x4c')?_0xa96c('0x4d'):_0xa96c('0x4e');var _0x3e548f='';var _0x41e093='';var _0x5b88b3='';var _0x6983cc='';var _0x58f84e='';var _0x4e46bf='';var _0x542a78='';var _0x51c894='';var _0xa458f1=['title',_0xa96c('0x4f'),_0xa96c('0x50'),_0xa96c('0x51'),'caseorigincode',_0xa96c('0x52'),'phonenumber',_0xa96c('0x53'),'directioncode','phonecall_activity_parties'];var _0x533e59=[_0xa96c('0x54'),_0xa96c('0x55'),_0xa96c('0x56'),_0xa96c('0x57'),'contactidname',_0xa96c('0x58'),_0xa96c('0x59'),_0xa96c('0x5a'),'createdbyexternalpartyname',_0xa96c('0x5b'),'createdbyname','createdbyyominame',_0xa96c('0x5c'),_0xa96c('0x5d'),'createdonbehalfbyyominame','customeridname',_0xa96c('0x5e'),_0xa96c('0x5f'),'emailaddress','entitlementidname',_0xa96c('0x60'),_0xa96c('0x61'),_0xa96c('0x62'),_0xa96c('0x63'),_0xa96c('0x64'),_0xa96c('0x65'),'importsequencenumber',_0xa96c('0x66'),_0xa96c('0x67'),_0xa96c('0x68'),'masteridname',_0xa96c('0x69'),_0xa96c('0x6a'),_0xa96c('0x6b'),_0xa96c('0x6c'),'modifiedon',_0xa96c('0x6d'),_0xa96c('0x6e'),_0xa96c('0x6f'),'msdyn_iotalertname',_0xa96c('0x70'),_0xa96c('0x71'),_0xa96c('0x72'),_0xa96c('0x73'),_0xa96c('0x74'),_0xa96c('0x75'),_0xa96c('0x76'),_0xa96c('0x77'),'primarycontactidyominame',_0xa96c('0x78'),'productidname','productserialnumber',_0xa96c('0x79'),_0xa96c('0x7a'),_0xa96c('0x7b'),_0xa96c('0x7c'),'responsiblecontactidyominame',_0xa96c('0x7d'),_0xa96c('0x7e'),_0xa96c('0x7f'),'socialprofileidname',_0xa96c('0x80'),_0xa96c('0x81'),_0xa96c('0x82'),_0xa96c('0x83'),_0xa96c('0x84'),_0xa96c('0x85'),'traversedpath',_0xa96c('0x86'),_0xa96c('0x87')];var _0x208bcf=_0xa458f1[_0xa96c('0x88')](_0x533e59);return db[_0xa96c('0x1b')][_0xa96c('0x3d')]({'where':{'id':_0x4a86b5[_0xa96c('0x38')]['id']},'attributes':['id',_0xa96c('0x89'),'password',_0xa96c('0x8a'),_0xa96c('0x8b'),'clientId','clientSecret',_0xa96c('0x8c')],'include':[{'model':db[_0xa96c('0x8d')],'as':_0xa96c('0x8d'),'attributes':['id',_0xa96c('0x8e'),_0xa96c('0x8f')]}]})[_0xa96c('0x12')](handleEntityNotFound(_0x48f522,null))[_0xa96c('0x12')](function(_0x32b954){if(_0x32b954){if(_0x32b954['modernAuthentication']){_0x32b954[_0xa96c('0x90')]=_0x32b954['CloudProvider']['data5'];_0x51c894=sanitizeRemoteUri(_0x32b954[_0xa96c('0x8d')]['data7']);_0x542a78=getWebApiUrl(_0x51c894);return _0x32b954;}_0x51c894=sanitizeRemoteUri(_0x32b954['remoteUri']);_0x542a78=getWebApiUrl(_0x51c894);var _0x9192ec={'method':_0xa96c('0x91'),'uri':_0xa96c('0x92')+_0x32b954[_0xa96c('0x8b')]+_0xa96c('0x93'),'form':{'client_id':_0x32b954['clientId'],'resource':_0x51c894,'username':_0x32b954['username'],'password':_0x32b954[_0xa96c('0x94')],'grant_type':_0xa96c('0x94'),'client_secret':_0x32b954[_0xa96c('0x95')]},'json':!![]};return rp(_0x9192ec);}})[_0xa96c('0x12')](function(_0x197d88){_0x4e46bf=_0x197d88[_0xa96c('0x90')];var _0x365b09={'method':_0xa96c('0x96'),'uri':encodeURI(_0x542a78+_0xa96c('0x97')+_0x27a6b2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4e46bf,'If-None-Match':null,'OData-Version':_0xa96c('0x98')},'json':!![]};return rp(_0x365b09);})['then'](function(_0x5a3a48){var _0x268d96=_0x5a3a48[_0xa96c('0x99')][0x0];var _0x37d80f=_0x268d96[_0xa96c('0x9a')];var _0x309d49={'method':'GET','uri':_0x542a78+'EntityDefinitions('+_0x37d80f+_0xa96c('0x9b'),'headers':{'Authorization':_0xa96c('0x9c')+_0x4e46bf,'If-None-Match':null,'OData-Version':_0xa96c('0x98')},'json':!![]};return rp(_0x309d49);})[_0xa96c('0x12')](function(_0x3c445c){_0x3e548f=_0x3c445c;_0x41e093=_0x3e548f[_0xa96c('0x9d')];_0x41e093=_[_0xa96c('0x9e')](_0x41e093,function(_0x550963){return!_0x208bcf[_0xa96c('0x9f')](_0x550963[_0xa96c('0xa0')]);});var _0x326340=[];var _0x53920f=[];_0x41e093[_0xa96c('0xa1')](function(_0x556a17){if(_0x556a17[_0xa96c('0xa2')]){var _0x548466=_0x556a17[_0xa96c('0xa2')][_0xa96c('0x46')](_0x556a17['@odata.type'][_0xa96c('0x47')]('.')+0x1);if(_0x548466==='PicklistAttributeMetadata'){_0x326340[_0xa96c('0xa3')](getSelectList(_0x542a78,_0x18ce1f,_0x53920f,_0x3e548f[_0xa96c('0x9a')],_0x556a17['MetadataId'],_0x4e46bf));}}});return Promise[_0xa96c('0xa4')](_0x326340);})[_0xa96c('0x12')](function(_0x38ad4c){_0x5b88b3=_0x38ad4c[0x0];var _0x2ba059=[];var _0x449e90=[];_0x41e093['forEach'](function(_0x26cb0e){if(!_[_0xa96c('0xa5')](_0x26cb0e[_0xa96c('0xa2')])){var _0x314ad2=_0x26cb0e[_0xa96c('0xa2')][_0xa96c('0x46')](_0x26cb0e['@odata.type'][_0xa96c('0x47')]('.')+0x1);if(_0x314ad2==='BooleanAttributeMetadata'){_0x2ba059['push'](getBooleanList(_0x542a78,_0x18ce1f,_0x449e90,_0x3e548f[_0xa96c('0x9a')],_0x26cb0e[_0xa96c('0x9a')],_0x4e46bf));}}});return Promise[_0xa96c('0xa4')](_0x2ba059);})[_0xa96c('0x12')](function(_0x4c6695){_0x6983cc=_0x4c6695[0x0];var _0x3437b0=[];var _0x3a3107=[];_0x41e093[_0xa96c('0xa1')](function(_0x48ad3e){if(_0x48ad3e[_0xa96c('0xa2')]){var _0x5ac14a=_0x48ad3e[_0xa96c('0xa2')][_0xa96c('0x46')](_0x48ad3e[_0xa96c('0xa2')][_0xa96c('0x47')]('.')+0x1);if(_0x5ac14a===_0xa96c('0xa6')||_0x5ac14a==='DoubleAttributeMetadata'||_0x5ac14a===_0xa96c('0xa7')||_0x5ac14a===_0xa96c('0xa8')||_0x5ac14a==='MemoAttributeMetadata'||_0x5ac14a===_0xa96c('0xa9')||_0x5ac14a==='StatusAttributeMetadata'||_0x5ac14a===_0xa96c('0xaa')||_0x5ac14a===_0xa96c('0xab')||_0x5ac14a===_0xa96c('0xac')){_0x3437b0[_0xa96c('0xa3')](getInputList(_0x542a78,_0x18ce1f,_0x5ac14a,_0x3a3107,_0x3e548f[_0xa96c('0x9a')],_0x48ad3e[_0xa96c('0x9a')],_0x4e46bf));}}});return Promise['all'](_0x3437b0);})[_0xa96c('0x12')](function(_0x19dee0){_0x58f84e=_0x19dee0[0x0];var _0x5596e0=_0x5b88b3[_0xa96c('0x88')](_0x6983cc)[_0xa96c('0x88')](_0x58f84e);var _0x4af0a2={'count':_0x5596e0[_0xa96c('0x26')],'rows':_0x5596e0};return _0x4af0a2;})['then'](respondWithResult(_0x48f522,null))[_0xa96c('0x31')](function(_0x427993){var _0x3752d4=_0x4a86b5[_0xa96c('0x20')][_0xa96c('0xad')]?0x1f4:_0x427993[_0xa96c('0xae')]||0x1f4;logger[_0xa96c('0x15')](_0x427993[_0xa96c('0x16')]);delete _0x427993[_0xa96c('0x17')];if(_0x3752d4===0x191){_0x3752d4=0x190;}_0x48f522['status'](_0x3752d4)[_0xa96c('0x18')](_0x4a86b5[_0xa96c('0x20')]['test']?{'message':_0xa96c('0xaf'),'statusCode':_0x427993[_0xa96c('0xae')]}:_0x427993);});};function getSelectList(_0x3429d4,_0xf9e4b1,_0x301f9a,_0x394ca7,_0xdaa531,_0x2dd6c4){var _0x5d45cb={'method':'GET','uri':_0x3429d4+_0xa96c('0xb0')+_0x394ca7+_0xa96c('0xb1')+_0xdaa531+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xa96c('0x9c')+_0x2dd6c4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5d45cb)[_0xa96c('0x12')](function(_0xad44c5){var _0x33ea3a=[];var _0x55527c=_0xad44c5[_0xa96c('0xb2')][_0xa96c('0xb3')];_0x55527c['forEach'](function(_0xbaee3d){_0x33ea3a[_0xa96c('0xa3')]({'name':_0xbaee3d['Label'][_0xa96c('0xb4')][_0xa96c('0xb5')],'value':String(_0xbaee3d['Value'])});});var _0x480e5c={'id':_0xf9e4b1+'_'+_0xad44c5[_0xa96c('0xa0')],'name':_0xad44c5[_0xa96c('0xb6')]['UserLocalizedLabel'][_0xa96c('0xb5')],'custom':![],'options':_0x33ea3a};_0x301f9a[_0xa96c('0xa3')](_0x480e5c);return _0x301f9a;});}function getBooleanList(_0x31a31e,_0x5164be,_0x577158,_0x660064,_0x3b0909,_0x46571e){var _0x34819f={'method':_0xa96c('0x96'),'uri':_0x31a31e+_0xa96c('0xb0')+_0x660064+_0xa96c('0xb1')+_0x3b0909+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xa96c('0x9c')+_0x46571e,'If-None-Match':null,'OData-Version':_0xa96c('0x98')},'json':!![]};return rp(_0x34819f)['then'](function(_0x238968){var _0x14d66a=[];_0x14d66a['push']({'name':_0x238968[_0xa96c('0xb2')][_0xa96c('0xb7')][_0xa96c('0xb5')][_0xa96c('0xb4')][_0xa96c('0xb5')],'value':_0xa96c('0xb8')},{'name':_0x238968[_0xa96c('0xb2')][_0xa96c('0xb9')][_0xa96c('0xb5')][_0xa96c('0xb4')][_0xa96c('0xb5')],'value':'false'});var _0x5cd386={'id':_0x5164be+'_'+_0x238968[_0xa96c('0xa0')],'name':_0x238968[_0xa96c('0xb6')]['UserLocalizedLabel'][_0xa96c('0xb5')],'custom':![],'options':_0x14d66a};_0x577158[_0xa96c('0xa3')](_0x5cd386);return _0x577158;});}function getInputList(_0x968dd4,_0x973421,_0x425561,_0x165a4f,_0x4d3685,_0x5e1d3b,_0x5c4710){var _0x2c6779={'method':'GET','uri':_0x968dd4+_0xa96c('0xb0')+_0x4d3685+_0xa96c('0xb1')+_0x5e1d3b+_0xa96c('0xba')+_0x425561+_0xa96c('0xbb'),'headers':{'Authorization':_0xa96c('0x9c')+_0x5c4710,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c6779)[_0xa96c('0x12')](function(_0x35d66c){var _0x1fd3df={'id':_0x973421+'_'+_0x35d66c['LogicalName'],'name':_0x35d66c[_0xa96c('0xb6')][_0xa96c('0xb4')]?_0x35d66c[_0xa96c('0xb6')][_0xa96c('0xb4')][_0xa96c('0xb5')]:_0x35d66c[_0xa96c('0xa0')],'custom':![],'options':[]};_0x165a4f['push'](_0x1fd3df);return _0x165a4f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 628a5ed..5f73c15 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3b15dc,_0x182f4d){var _0x5c10e0=function(_0x3b78d8){while(--_0x3b78d8){_0x3b15dc['push'](_0x3b15dc['shift']());}};_0x5c10e0(++_0x182f4d);}(_0x757a,0xde));var _0xa757=function(_0x30d869,_0x64d644){_0x30d869=_0x30d869-0x0;var _0x2ba187=_0x757a[_0x30d869];return _0x2ba187;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 5596f9b..201e952 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 _0x3047=['raw','where','limit','map','include','model','GetDynamics365Account','ShowDynamics365Account','find','attributes','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options'];(function(_0x333cd5,_0x571d86){var _0x2a2ece=function(_0x1e3c7e){while(--_0x1e3c7e){_0x333cd5['push'](_0x333cd5['shift']());}};_0x2a2ece(++_0x571d86);}(_0x3047,0x197));var _0x7304=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3047[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7304('0x0'));var util=require('util');var moment=require(_0x7304('0x1'));var BPromise=require('bluebird');var rs=require(_0x7304('0x2'));var fs=require('fs');var Redis=require(_0x7304('0x3'));var db=require(_0x7304('0x4'))['db'];var utils=require(_0x7304('0x5'));var logger=require('../../config/logger')(_0x7304('0x6'));var config=require(_0x7304('0x7'));var jayson=require(_0x7304('0x8'));var client=jayson[_0x7304('0x9')][_0x7304('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16355a,_0x466bbe,_0xf94e8f){return new BPromise(function(_0x47ac76,_0x479af7){return client[_0x7304('0xb')](_0x16355a,_0xf94e8f)[_0x7304('0xc')](function(_0x1cea2a){logger[_0x7304('0xd')](_0x7304('0xe'),_0x466bbe,_0x7304('0xf'));logger[_0x7304('0x10')](_0x7304('0x11'),_0x466bbe,'request\x20sent',JSON['stringify'](_0x1cea2a));if(_0x1cea2a[_0x7304('0x12')]){if(_0x1cea2a[_0x7304('0x12')]['code']===0x1f4){logger[_0x7304('0x12')](_0x7304('0xe'),_0x466bbe,_0x1cea2a[_0x7304('0x12')][_0x7304('0x13')]);return _0x479af7(_0x1cea2a[_0x7304('0x12')]['message']);}logger[_0x7304('0x12')](_0x7304('0xe'),_0x466bbe,_0x1cea2a['error'][_0x7304('0x13')]);return _0x47ac76(_0x1cea2a[_0x7304('0x12')][_0x7304('0x13')]);}else{logger[_0x7304('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x466bbe,_0x7304('0xf'));_0x47ac76(_0x1cea2a[_0x7304('0x14')][_0x7304('0x13')]);}})[_0x7304('0x15')](function(_0x4f8076){logger['error'](_0x7304('0xe'),_0x466bbe,_0x4f8076);_0x479af7(_0x4f8076);});});}exports['GetDynamics365Account']=function(_0x522b95){var _0x226c90=this;return new Promise(function(_0x55b457,_0x499fba){return db[_0x7304('0x16')][_0x7304('0x17')]({'raw':_0x522b95[_0x7304('0x18')]?_0x522b95['options'][_0x7304('0x19')]===undefined?!![]:![]:!![],'where':_0x522b95[_0x7304('0x18')]?_0x522b95[_0x7304('0x18')][_0x7304('0x1a')]||null:null,'attributes':_0x522b95[_0x7304('0x18')]?_0x522b95[_0x7304('0x18')]['attributes']||null:null,'limit':_0x522b95['options']?_0x522b95['options'][_0x7304('0x1b')]||null:null,'include':_0x522b95['options']?_0x522b95[_0x7304('0x18')]['include']?_[_0x7304('0x1c')](_0x522b95[_0x7304('0x18')][_0x7304('0x1d')],function(_0x35032f){return{'model':db[_0x35032f[_0x7304('0x1e')]],'as':_0x35032f['as'],'attributes':_0x35032f['attributes'],'include':_0x35032f[_0x7304('0x1d')]?_[_0x7304('0x1c')](_0x35032f[_0x7304('0x1d')],function(_0x361ec3){return{'model':db[_0x361ec3[_0x7304('0x1e')]],'as':_0x361ec3['as'],'attributes':_0x361ec3['attributes'],'include':_0x361ec3['include']?_['map'](_0x361ec3[_0x7304('0x1d')],function(_0x5243fa){return{'model':db[_0x5243fa[_0x7304('0x1e')]],'as':_0x5243fa['as'],'attributes':_0x5243fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x7304('0xc')](function(_0x43bacb){logger['info'](_0x7304('0x1f'),_0x522b95);logger['debug'](_0x7304('0x1f'),_0x522b95,JSON['stringify'](_0x43bacb));_0x55b457(_0x43bacb);})['catch'](function(_0x227aca){logger[_0x7304('0x12')](_0x7304('0x1f'),_0x227aca['message'],_0x522b95);_0x499fba(_0x226c90[_0x7304('0x12')](0x1f4,_0x227aca[_0x7304('0x13')]));});});};exports[_0x7304('0x20')]=function(_0x4ca137){var _0x3ba62d=this;return new Promise(function(_0x26f21e,_0x33959b){return db['Dynamics365Account'][_0x7304('0x21')]({'raw':_0x4ca137[_0x7304('0x18')]?_0x4ca137[_0x7304('0x18')][_0x7304('0x19')]===undefined?!![]:![]:!![],'where':_0x4ca137[_0x7304('0x18')]?_0x4ca137[_0x7304('0x18')][_0x7304('0x1a')]||null:null,'attributes':_0x4ca137[_0x7304('0x18')]?_0x4ca137[_0x7304('0x18')]['attributes']||null:null,'include':_0x4ca137[_0x7304('0x18')]?_0x4ca137['options'][_0x7304('0x1d')]?_[_0x7304('0x1c')](_0x4ca137[_0x7304('0x18')][_0x7304('0x1d')],function(_0x1ac645){return{'model':db[_0x1ac645[_0x7304('0x1e')]],'as':_0x1ac645['as'],'attributes':_0x1ac645['attributes'],'include':_0x1ac645[_0x7304('0x1d')]?_['map'](_0x1ac645[_0x7304('0x1d')],function(_0x2a2864){return{'model':db[_0x2a2864['model']],'as':_0x2a2864['as'],'attributes':_0x2a2864[_0x7304('0x22')],'include':_0x2a2864['include']?_[_0x7304('0x1c')](_0x2a2864[_0x7304('0x1d')],function(_0xbfa7cd){return{'model':db[_0xbfa7cd['model']],'as':_0xbfa7cd['as'],'attributes':_0xbfa7cd[_0x7304('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x469262){logger[_0x7304('0xd')]('ShowDynamics365Account',_0x4ca137);logger['debug'](_0x7304('0x20'),_0x4ca137,JSON[_0x7304('0x23')](_0x469262));_0x26f21e(_0x469262);})['catch'](function(_0x5b1c65){logger[_0x7304('0x12')](_0x7304('0x20'),_0x5b1c65[_0x7304('0x13')],_0x4ca137);_0x33959b(_0x3ba62d['error'](0x1f4,_0x5b1c65[_0x7304('0x13')]));});});}; \ No newline at end of file +var _0xd06a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','options','raw','where','limit','include','map','model','attributes','ShowDynamics365Account','find','util','moment'];(function(_0x299ad6,_0x5e46f1){var _0x318fcb=function(_0x25007c){while(--_0x25007c){_0x299ad6['push'](_0x299ad6['shift']());}};_0x318fcb(++_0x5e46f1);}(_0xd06a,0xd6));var _0xad06=function(_0x17e1f7,_0x2894ad){_0x17e1f7=_0x17e1f7-0x0;var _0x1ac7ea=_0xd06a[_0x17e1f7];return _0x1ac7ea;};'use strict';var _=require('lodash');var util=require(_0xad06('0x0'));var moment=require(_0xad06('0x1'));var BPromise=require(_0xad06('0x2'));var rs=require(_0xad06('0x3'));var fs=require('fs');var Redis=require(_0xad06('0x4'));var db=require(_0xad06('0x5'))['db'];var utils=require(_0xad06('0x6'));var logger=require(_0xad06('0x7'))(_0xad06('0x8'));var config=require(_0xad06('0x9'));var jayson=require(_0xad06('0xa'));var client=jayson[_0xad06('0xb')][_0xad06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28105e,_0x55d6e5,_0x228044){return new BPromise(function(_0x9b0d96,_0x14d5e3){return client[_0xad06('0xd')](_0x28105e,_0x228044)[_0xad06('0xe')](function(_0x5b4c7e){logger[_0xad06('0xf')](_0xad06('0x10'),_0x55d6e5,_0xad06('0x11'));logger[_0xad06('0x12')](_0xad06('0x13'),_0x55d6e5,'request\x20sent',JSON[_0xad06('0x14')](_0x5b4c7e));if(_0x5b4c7e[_0xad06('0x15')]){if(_0x5b4c7e['error']['code']===0x1f4){logger[_0xad06('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x55d6e5,_0x5b4c7e[_0xad06('0x15')][_0xad06('0x16')]);return _0x14d5e3(_0x5b4c7e[_0xad06('0x15')][_0xad06('0x16')]);}logger[_0xad06('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x55d6e5,_0x5b4c7e[_0xad06('0x15')][_0xad06('0x16')]);return _0x9b0d96(_0x5b4c7e[_0xad06('0x15')][_0xad06('0x16')]);}else{logger[_0xad06('0xf')](_0xad06('0x10'),_0x55d6e5,_0xad06('0x11'));_0x9b0d96(_0x5b4c7e[_0xad06('0x17')][_0xad06('0x16')]);}})[_0xad06('0x18')](function(_0x13a4b1){logger[_0xad06('0x15')](_0xad06('0x10'),_0x55d6e5,_0x13a4b1);_0x14d5e3(_0x13a4b1);});});}exports[_0xad06('0x19')]=function(_0xc368ea){var _0x4adcf6=this;return new Promise(function(_0x1332ed,_0x188ddb){return db['Dynamics365Account']['findAll']({'raw':_0xc368ea['options']?_0xc368ea[_0xad06('0x1a')][_0xad06('0x1b')]===undefined?!![]:![]:!![],'where':_0xc368ea[_0xad06('0x1a')]?_0xc368ea['options'][_0xad06('0x1c')]||null:null,'attributes':_0xc368ea[_0xad06('0x1a')]?_0xc368ea[_0xad06('0x1a')]['attributes']||null:null,'limit':_0xc368ea[_0xad06('0x1a')]?_0xc368ea[_0xad06('0x1a')][_0xad06('0x1d')]||null:null,'include':_0xc368ea[_0xad06('0x1a')]?_0xc368ea[_0xad06('0x1a')][_0xad06('0x1e')]?_[_0xad06('0x1f')](_0xc368ea['options']['include'],function(_0x2e2b86){return{'model':db[_0x2e2b86[_0xad06('0x20')]],'as':_0x2e2b86['as'],'attributes':_0x2e2b86[_0xad06('0x21')],'include':_0x2e2b86[_0xad06('0x1e')]?_['map'](_0x2e2b86[_0xad06('0x1e')],function(_0x21ab1b){return{'model':db[_0x21ab1b[_0xad06('0x20')]],'as':_0x21ab1b['as'],'attributes':_0x21ab1b[_0xad06('0x21')],'include':_0x21ab1b[_0xad06('0x1e')]?_['map'](_0x21ab1b[_0xad06('0x1e')],function(_0x5a24e9){return{'model':db[_0x5a24e9[_0xad06('0x20')]],'as':_0x5a24e9['as'],'attributes':_0x5a24e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xad06('0xe')](function(_0x4c73a8){logger['info'](_0xad06('0x19'),_0xc368ea);logger[_0xad06('0x12')](_0xad06('0x19'),_0xc368ea,JSON[_0xad06('0x14')](_0x4c73a8));_0x1332ed(_0x4c73a8);})[_0xad06('0x18')](function(_0x4976f8){logger['error'](_0xad06('0x19'),_0x4976f8['message'],_0xc368ea);_0x188ddb(_0x4adcf6['error'](0x1f4,_0x4976f8['message']));});});};exports[_0xad06('0x22')]=function(_0x10e1ca){var _0x3085b5=this;return new Promise(function(_0x2c9d19,_0x43bd41){return db['Dynamics365Account'][_0xad06('0x23')]({'raw':_0x10e1ca[_0xad06('0x1a')]?_0x10e1ca[_0xad06('0x1a')][_0xad06('0x1b')]===undefined?!![]:![]:!![],'where':_0x10e1ca['options']?_0x10e1ca[_0xad06('0x1a')][_0xad06('0x1c')]||null:null,'attributes':_0x10e1ca[_0xad06('0x1a')]?_0x10e1ca[_0xad06('0x1a')][_0xad06('0x21')]||null:null,'include':_0x10e1ca['options']?_0x10e1ca[_0xad06('0x1a')][_0xad06('0x1e')]?_['map'](_0x10e1ca[_0xad06('0x1a')][_0xad06('0x1e')],function(_0x33d2eb){return{'model':db[_0x33d2eb['model']],'as':_0x33d2eb['as'],'attributes':_0x33d2eb[_0xad06('0x21')],'include':_0x33d2eb['include']?_[_0xad06('0x1f')](_0x33d2eb[_0xad06('0x1e')],function(_0x2e675f){return{'model':db[_0x2e675f['model']],'as':_0x2e675f['as'],'attributes':_0x2e675f[_0xad06('0x21')],'include':_0x2e675f[_0xad06('0x1e')]?_[_0xad06('0x1f')](_0x2e675f['include'],function(_0x10d1a4){return{'model':db[_0x10d1a4[_0xad06('0x20')]],'as':_0x10d1a4['as'],'attributes':_0x10d1a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xad06('0xe')](function(_0x234650){logger[_0xad06('0xf')](_0xad06('0x22'),_0x10e1ca);logger[_0xad06('0x12')](_0xad06('0x22'),_0x10e1ca,JSON['stringify'](_0x234650));_0x2c9d19(_0x234650);})[_0xad06('0x18')](function(_0x1c8e72){logger[_0xad06('0x15')](_0xad06('0x22'),_0x1c8e72['message'],_0x10e1ca);_0x43bd41(_0x3085b5[_0xad06('0x15')](0x1f4,_0x1c8e72[_0xad06('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index bba9eaf..5480673 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 _0x7b08=['put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x7b08,0x163));var _0x87b0=function(_0x56ec9b,_0x429455){_0x56ec9b=_0x56ec9b-0x0;var _0x3c8e0f=_0x7b08[_0x56ec9b];return _0x3c8e0f;};'use strict';var multer=require(_0x87b0('0x0'));var util=require('util');var path=require(_0x87b0('0x1'));var timeout=require(_0x87b0('0x2'));var express=require(_0x87b0('0x3'));var router=express['Router']();var fs_extra=require(_0x87b0('0x4'));var auth=require(_0x87b0('0x5'));var interaction=require(_0x87b0('0x6'));var config=require(_0x87b0('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x87b0('0x8')]('/',auth[_0x87b0('0x9')](),controller[_0x87b0('0xa')]);router[_0x87b0('0x8')](_0x87b0('0xb'),auth[_0x87b0('0x9')](),controller[_0x87b0('0xc')]);router[_0x87b0('0x8')](_0x87b0('0xd'),auth[_0x87b0('0x9')](),controller['getFields']);router[_0x87b0('0x8')](_0x87b0('0xe'),auth[_0x87b0('0x9')](),controller[_0x87b0('0xf')]);router[_0x87b0('0x8')](_0x87b0('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x87b0('0x11')]('/',auth[_0x87b0('0x9')](),controller[_0x87b0('0x12')]);router[_0x87b0('0x13')](_0x87b0('0xb'),auth[_0x87b0('0x9')](),controller['update']);router[_0x87b0('0x14')](_0x87b0('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x87b0('0x15')]=router; \ No newline at end of file +var _0xdc9b=['update','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x2b23dd,_0x21647d){var _0x52ab2c=function(_0x357aca){while(--_0x357aca){_0x2b23dd['push'](_0x2b23dd['shift']());}};_0x52ab2c(++_0x21647d);}(_0xdc9b,0x70));var _0xbdc9=function(_0x29c54b,_0x2f9c0a){_0x29c54b=_0x29c54b-0x0;var _0x13636b=_0xdc9b[_0x29c54b];return _0x13636b;};'use strict';var multer=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var path=require(_0xbdc9('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdc9('0x3'));var router=express[_0xbdc9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbdc9('0x5'));var config=require(_0xbdc9('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xbdc9('0x7')]('/',auth[_0xbdc9('0x8')](),controller['index']);router[_0xbdc9('0x7')]('/:id',auth[_0xbdc9('0x8')](),controller[_0xbdc9('0x9')]);router[_0xbdc9('0x7')](_0xbdc9('0xa'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0xb')]);router[_0xbdc9('0x7')](_0xbdc9('0xc'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0xd')]);router[_0xbdc9('0x7')](_0xbdc9('0xe'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0xf')]);router[_0xbdc9('0x10')]('/',auth[_0xbdc9('0x8')](),controller[_0xbdc9('0x11')]);router[_0xbdc9('0x12')](_0xbdc9('0x13'),auth[_0xbdc9('0x8')](),controller[_0xbdc9('0x14')]);router['delete'](_0xbdc9('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xbdc9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6c12a72..4ff34e2 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 _0xac29=['incident','phonecall','nothing','sequelize','STRING','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac29,0xed));var _0x9ac2=function(_0x2af0e9,_0x5d13d8){_0x2af0e9=_0x2af0e9-0x0;var _0x5aaa1b=_0xac29[_0x2af0e9];return _0x5aaa1b;};'use strict';var Sequelize=require(_0x9ac2('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ac2('0x1')]},'description':{'type':Sequelize[_0x9ac2('0x1')]},'ticketType':{'type':Sequelize[_0x9ac2('0x2')](_0x9ac2('0x3'),_0x9ac2('0x4')),'defaultValue':_0x9ac2('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x9ac2('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9ac2('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9900=['incident','ENUM','contact','nothing','sequelize','STRING'];(function(_0xa8d61c,_0x285f7a){var _0x98c03f=function(_0x47fc85){while(--_0x47fc85){_0xa8d61c['push'](_0xa8d61c['shift']());}};_0x98c03f(++_0x285f7a);}(_0x9900,0x12a));var _0x0990=function(_0x406f7f,_0x505b6a){_0x406f7f=_0x406f7f-0x0;var _0x470b06=_0x9900[_0x406f7f];return _0x470b06;};'use strict';var Sequelize=require(_0x0990('0x0'));module['exports']={'name':{'type':Sequelize[_0x0990('0x1')]},'description':{'type':Sequelize[_0x0990('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x0990('0x2'),'phonecall'),'defaultValue':_0x0990('0x2')},'moduleCreate':{'type':Sequelize[_0x0990('0x3')](_0x0990('0x4'),_0x0990('0x5')),'defaultValue':_0x0990('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 93446ac..89b12b5 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 _0x8d0f=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','Dynamics365Configuration','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','findOne','Dynamics365Field','pick','getFields','getSubjects','getDescriptions','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/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','keys','query'];(function(_0x1a5b15,_0x4fb894){var _0x2c25a3=function(_0x51e30a){while(--_0x51e30a){_0x1a5b15['push'](_0x1a5b15['shift']());}};_0x2c25a3(++_0x4fb894);}(_0x8d0f,0x117));var _0xf8d0=function(_0xa5febd,_0x43ac20){_0xa5febd=_0xa5febd-0x0;var _0xcd46a8=_0x8d0f[_0xa5febd];return _0xcd46a8;};'use strict';var emlformat=require(_0xf8d0('0x0'));var rimraf=require(_0xf8d0('0x1'));var zipdir=require(_0xf8d0('0x2'));var jsonpatch=require(_0xf8d0('0x3'));var rp=require(_0xf8d0('0x4'));var moment=require(_0xf8d0('0x5'));var BPromise=require(_0xf8d0('0x6'));var Mustache=require(_0xf8d0('0x7'));var util=require(_0xf8d0('0x8'));var path=require(_0xf8d0('0x9'));var sox=require(_0xf8d0('0xa'));var csv=require(_0xf8d0('0xb'));var ejs=require(_0xf8d0('0xc'));var fs=require('fs');var fs_extra=require(_0xf8d0('0xd'));var _=require('lodash');var squel=require(_0xf8d0('0xe'));var crypto=require(_0xf8d0('0xf'));var jsforce=require(_0xf8d0('0x10'));var deskjs=require(_0xf8d0('0x11'));var toCsv=require(_0xf8d0('0xb'));var querystring=require(_0xf8d0('0x12'));var Papa=require(_0xf8d0('0x13'));var Redis=require(_0xf8d0('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf8d0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8d0('0x16'));var logger=require(_0xf8d0('0x17'))('api');var utils=require(_0xf8d0('0x18'));var config=require(_0xf8d0('0x19'));var licenseUtil=require(_0xf8d0('0x1a'));var db=require(_0xf8d0('0x1b'))['db'];function respondWithStatusCode(_0x5b7287,_0x4f1a08){_0x4f1a08=_0x4f1a08||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x5b7287['sendStatus'](_0x4f1a08);}return _0x5b7287['status'](_0x4f1a08)[_0xf8d0('0x1c')]();};}function respondWithResult(_0x51b5a4,_0x409acf){_0x409acf=_0x409acf||0xc8;return function(_0x513588){if(_0x513588){return _0x51b5a4['status'](_0x409acf)[_0xf8d0('0x1d')](_0x513588);}};}function respondWithFilteredResult(_0x55091f,_0x1d90cb){return function(_0x127fd1){if(_0x127fd1){var _0x4e9f25=typeof _0x1d90cb['offset']===_0xf8d0('0x1e')&&typeof _0x1d90cb[_0xf8d0('0x1f')]==='undefined';var _0x7ea4b=_0x127fd1[_0xf8d0('0x20')];var _0x5f3e67=_0x4e9f25?0x0:_0x1d90cb[_0xf8d0('0x21')];var _0x3a9859=_0x4e9f25?_0x127fd1['count']:_0x1d90cb[_0xf8d0('0x21')]+_0x1d90cb['limit'];var _0x53ff5f;if(_0x3a9859>=_0x7ea4b){_0x3a9859=_0x7ea4b;_0x53ff5f=0xc8;}else{_0x53ff5f=0xce;}_0x55091f[_0xf8d0('0x22')](_0x53ff5f);return _0x55091f[_0xf8d0('0x23')](_0xf8d0('0x24'),_0x5f3e67+'-'+_0x3a9859+'/'+_0x7ea4b)[_0xf8d0('0x1d')](_0x127fd1);}return null;};}function patchUpdates(_0x521cfa){return function(_0x367de6){try{jsonpatch['apply'](_0x367de6,_0x521cfa,!![]);}catch(_0x2d969c){return BPromise[_0xf8d0('0x25')](_0x2d969c);}return _0x367de6['save']();};}function saveUpdates(_0x1d0df0,_0x4749be){return function(_0x4595c8){if(_0x4595c8){return _0x4595c8[_0xf8d0('0x26')](_0x1d0df0)[_0xf8d0('0x27')](function(_0x40082b){return _0x40082b;});}return null;};}function removeEntity(_0x1aa880,_0x3c3d6c){return function(_0x304796){if(_0x304796){return _0x304796[_0xf8d0('0x28')]()[_0xf8d0('0x27')](function(){_0x1aa880['status'](0xcc)[_0xf8d0('0x1c')]();});}};}function handleEntityNotFound(_0x5228b3,_0x4976d1){return function(_0x31e7f3){if(!_0x31e7f3){_0x5228b3[_0xf8d0('0x29')](0x194);}return _0x31e7f3;};}function handleError(_0x283b8b,_0x37e1f9){_0x37e1f9=_0x37e1f9||0x1f4;return function(_0x22873f){logger[_0xf8d0('0x2a')](_0x22873f['stack']);if(_0x22873f[_0xf8d0('0x2b')]){delete _0x22873f['name'];}_0x283b8b[_0xf8d0('0x22')](_0x37e1f9)[_0xf8d0('0x2c')](_0x22873f);};}exports[_0xf8d0('0x2d')]=function(_0x48aa18,_0x8fe337){var _0x301fc={},_0x22aaf0={},_0x476abb={'count':0x0,'rows':[]};var _0x4c1a49=_[_0xf8d0('0x2e')](db['Dynamics365Configuration'][_0xf8d0('0x2f')],function(_0x5e26f9){return{'name':_0x5e26f9['fieldName'],'type':_0x5e26f9[_0xf8d0('0x30')][_0xf8d0('0x31')]};});_0x22aaf0[_0xf8d0('0x32')]=_[_0xf8d0('0x2e')](_0x4c1a49,_0xf8d0('0x2b'));_0x22aaf0['query']=_[_0xf8d0('0x33')](_0x48aa18[_0xf8d0('0x34')]);_0x22aaf0['filters']=_[_0xf8d0('0x35')](_0x22aaf0[_0xf8d0('0x32')],_0x22aaf0[_0xf8d0('0x34')]);_0x301fc[_0xf8d0('0x36')]=_['intersection'](_0x22aaf0[_0xf8d0('0x32')],qs[_0xf8d0('0x37')](_0x48aa18[_0xf8d0('0x34')]['fields']));_0x301fc[_0xf8d0('0x36')]=_0x301fc['attributes']['length']?_0x301fc[_0xf8d0('0x36')]:_0x22aaf0[_0xf8d0('0x32')];if(!_0x48aa18[_0xf8d0('0x34')][_0xf8d0('0x38')](_0xf8d0('0x39'))){_0x301fc[_0xf8d0('0x1f')]=qs[_0xf8d0('0x1f')](_0x48aa18[_0xf8d0('0x34')][_0xf8d0('0x1f')]);_0x301fc[_0xf8d0('0x21')]=qs[_0xf8d0('0x21')](_0x48aa18[_0xf8d0('0x34')][_0xf8d0('0x21')]);}_0x301fc[_0xf8d0('0x3a')]=qs[_0xf8d0('0x3b')](_0x48aa18[_0xf8d0('0x34')]['sort']);_0x301fc[_0xf8d0('0x3c')]=qs[_0xf8d0('0x3d')](_['pick'](_0x48aa18[_0xf8d0('0x34')],_0x22aaf0[_0xf8d0('0x3d')]),_0x4c1a49);if(_0x48aa18[_0xf8d0('0x34')]['filter']){_0x301fc['where']=_[_0xf8d0('0x3e')](_0x301fc[_0xf8d0('0x3c')],{'$or':_['map'](_0x4c1a49,function(_0x3168a6){if(_0x3168a6['type']!=='VIRTUAL'){var _0x311e3d={};_0x311e3d[_0x3168a6[_0xf8d0('0x2b')]]={'$like':'%'+_0x48aa18[_0xf8d0('0x34')][_0xf8d0('0x3f')]+'%'};return _0x311e3d;}})});}_0x301fc=_['merge']({},_0x301fc,_0x48aa18[_0xf8d0('0x40')]);var _0x114269={'where':_0x301fc[_0xf8d0('0x3c')]};return db[_0xf8d0('0x41')][_0xf8d0('0x20')](_0x114269)[_0xf8d0('0x27')](function(_0x2114ae){_0x476abb[_0xf8d0('0x20')]=_0x2114ae;if(_0x48aa18['query'][_0xf8d0('0x42')]){_0x301fc['include']=[{'all':!![]}];}return db[_0xf8d0('0x41')][_0xf8d0('0x43')](_0x301fc);})[_0xf8d0('0x27')](function(_0x66119f){_0x476abb[_0xf8d0('0x44')]=_0x66119f;return _0x476abb;})[_0xf8d0('0x27')](respondWithFilteredResult(_0x8fe337,_0x301fc))[_0xf8d0('0x45')](handleError(_0x8fe337,null));};exports[_0xf8d0('0x46')]=function(_0x13f330,_0x1451d){var _0x45658e={'raw':![],'where':{'id':_0x13f330[_0xf8d0('0x47')]['id']}},_0x5c106f={};_0x5c106f[_0xf8d0('0x32')]=_[_0xf8d0('0x33')](db[_0xf8d0('0x41')]['rawAttributes']);_0x5c106f[_0xf8d0('0x34')]=_[_0xf8d0('0x33')](_0x13f330[_0xf8d0('0x34')]);_0x5c106f[_0xf8d0('0x3d')]=_[_0xf8d0('0x35')](_0x5c106f[_0xf8d0('0x32')],_0x5c106f[_0xf8d0('0x34')]);_0x45658e[_0xf8d0('0x36')]=_[_0xf8d0('0x35')](_0x5c106f[_0xf8d0('0x32')],qs['fields'](_0x13f330[_0xf8d0('0x34')][_0xf8d0('0x37')]));_0x45658e[_0xf8d0('0x36')]=_0x45658e[_0xf8d0('0x36')][_0xf8d0('0x48')]?_0x45658e[_0xf8d0('0x36')]:_0x5c106f[_0xf8d0('0x32')];if(_0x13f330[_0xf8d0('0x34')][_0xf8d0('0x42')]){_0x45658e[_0xf8d0('0x49')]=[{'all':!![]}];}_0x45658e=_[_0xf8d0('0x3e')]({},_0x45658e,_0x13f330[_0xf8d0('0x40')]);return db['Dynamics365Configuration'][_0xf8d0('0x4a')](_0x45658e)[_0xf8d0('0x27')](handleEntityNotFound(_0x1451d,null))['then'](respondWithResult(_0x1451d,null))[_0xf8d0('0x45')](handleError(_0x1451d,null));};exports[_0xf8d0('0x4b')]=function(_0x526111,_0x431e0f){return db['Dynamics365Configuration']['create'](_0x526111[_0xf8d0('0x4c')],{})[_0xf8d0('0x27')](respondWithResult(_0x431e0f,0xc9))[_0xf8d0('0x45')](handleError(_0x431e0f,null));};exports[_0xf8d0('0x26')]=function(_0x569fcb,_0x422bde){if(_0x569fcb[_0xf8d0('0x4c')]['id']){delete _0x569fcb[_0xf8d0('0x4c')]['id'];}return db['Dynamics365Configuration'][_0xf8d0('0x4a')]({'where':{'id':_0x569fcb[_0xf8d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x422bde,null))[_0xf8d0('0x27')](saveUpdates(_0x569fcb['body'],null))[_0xf8d0('0x27')](respondWithResult(_0x422bde,null))[_0xf8d0('0x45')](handleError(_0x422bde,null));};exports[_0xf8d0('0x28')]=function(_0x51d199,_0x45ec87){return db[_0xf8d0('0x41')][_0xf8d0('0x4a')]({'where':{'id':_0x51d199[_0xf8d0('0x47')]['id']}})[_0xf8d0('0x27')](handleEntityNotFound(_0x45ec87,null))[_0xf8d0('0x27')](removeEntity(_0x45ec87,null))[_0xf8d0('0x45')](handleError(_0x45ec87,null));};exports['getFields']=function(_0x2e6ec9,_0x250ecc,_0x3e9334){var _0x697638={};var _0x1261d7={};var _0x1e981e;var _0x2d174a;return db['Dynamics365Configuration'][_0xf8d0('0x4d')]({'where':{'id':_0x2e6ec9['params']['id']}})[_0xf8d0('0x27')](handleEntityNotFound(_0x250ecc,null))['then'](function(_0x2387ff){if(_0x2387ff){_0x1e981e=_0x2387ff;_0x1261d7[_0xf8d0('0x32')]=_[_0xf8d0('0x33')](db[_0xf8d0('0x4e')][_0xf8d0('0x2f')]);_0x1261d7[_0xf8d0('0x34')]=_[_0xf8d0('0x33')](_0x2e6ec9[_0xf8d0('0x34')]);_0x1261d7[_0xf8d0('0x3d')]=_[_0xf8d0('0x35')](_0x1261d7[_0xf8d0('0x32')],_0x1261d7[_0xf8d0('0x34')]);_0x697638['attributes']=_['intersection'](_0x1261d7['model'],qs[_0xf8d0('0x37')](_0x2e6ec9[_0xf8d0('0x34')]['fields']));_0x697638[_0xf8d0('0x36')]=_0x697638[_0xf8d0('0x36')][_0xf8d0('0x48')]?_0x697638[_0xf8d0('0x36')]:_0x1261d7[_0xf8d0('0x32')];_0x697638[_0xf8d0('0x3a')]=qs[_0xf8d0('0x3b')](_0x2e6ec9[_0xf8d0('0x34')][_0xf8d0('0x3b')]);_0x697638[_0xf8d0('0x3c')]=qs['filters'](_[_0xf8d0('0x4f')](_0x2e6ec9['query'],_0x1261d7[_0xf8d0('0x3d')]));if(_0x2e6ec9[_0xf8d0('0x34')][_0xf8d0('0x3f')]){_0x697638['where']=_[_0xf8d0('0x3e')](_0x697638[_0xf8d0('0x3c')],{'$or':_[_0xf8d0('0x2e')](_0x697638[_0xf8d0('0x36')],function(_0x1a3d05){var _0x4aacab={};_0x4aacab[_0x1a3d05]={'$like':'%'+_0x2e6ec9[_0xf8d0('0x34')][_0xf8d0('0x3f')]+'%'};return _0x4aacab;})});}_0x697638=_['merge']({},_0x697638,_0x2e6ec9[_0xf8d0('0x40')]);return _0x1e981e[_0xf8d0('0x50')](_0x697638);}})[_0xf8d0('0x27')](function(_0x28a270){if(_0x28a270){_0x2d174a=_0x28a270[_0xf8d0('0x48')];if(!_0x2e6ec9['query'][_0xf8d0('0x38')](_0xf8d0('0x39'))){_0x697638['limit']=qs[_0xf8d0('0x1f')](_0x2e6ec9[_0xf8d0('0x34')][_0xf8d0('0x1f')]);_0x697638[_0xf8d0('0x21')]=qs['offset'](_0x2e6ec9[_0xf8d0('0x34')][_0xf8d0('0x21')]);}return _0x1e981e[_0xf8d0('0x50')](_0x697638);}})['then'](function(_0x55100a){if(_0x55100a){return _0x55100a?{'count':_0x2d174a,'rows':_0x55100a}:null;}})['then'](respondWithResult(_0x250ecc,null))[_0xf8d0('0x45')](handleError(_0x250ecc,null));};exports[_0xf8d0('0x51')]=function(_0x45d714,_0x1cf04a,_0x1493df){var _0x3d05d6={};var _0x22c3a8={};var _0x57a3c1;var _0x299396;return db[_0xf8d0('0x41')][_0xf8d0('0x4d')]({'where':{'id':_0x45d714[_0xf8d0('0x47')]['id']}})[_0xf8d0('0x27')](handleEntityNotFound(_0x1cf04a,null))[_0xf8d0('0x27')](function(_0x2fcaf8){if(_0x2fcaf8){_0x57a3c1=_0x2fcaf8;_0x22c3a8['model']=_['keys'](db[_0xf8d0('0x4e')][_0xf8d0('0x2f')]);_0x22c3a8[_0xf8d0('0x34')]=_[_0xf8d0('0x33')](_0x45d714[_0xf8d0('0x34')]);_0x22c3a8[_0xf8d0('0x3d')]=_[_0xf8d0('0x35')](_0x22c3a8[_0xf8d0('0x32')],_0x22c3a8[_0xf8d0('0x34')]);_0x3d05d6['attributes']=_[_0xf8d0('0x35')](_0x22c3a8[_0xf8d0('0x32')],qs[_0xf8d0('0x37')](_0x45d714[_0xf8d0('0x34')][_0xf8d0('0x37')]));_0x3d05d6['attributes']=_0x3d05d6['attributes'][_0xf8d0('0x48')]?_0x3d05d6[_0xf8d0('0x36')]:_0x22c3a8[_0xf8d0('0x32')];_0x3d05d6['order']=qs[_0xf8d0('0x3b')](_0x45d714[_0xf8d0('0x34')][_0xf8d0('0x3b')]);_0x3d05d6[_0xf8d0('0x3c')]=qs[_0xf8d0('0x3d')](_[_0xf8d0('0x4f')](_0x45d714['query'],_0x22c3a8[_0xf8d0('0x3d')]));if(_0x45d714[_0xf8d0('0x34')]['filter']){_0x3d05d6[_0xf8d0('0x3c')]=_[_0xf8d0('0x3e')](_0x3d05d6['where'],{'$or':_['map'](_0x3d05d6['attributes'],function(_0x2525ca){var _0x3c226f={};_0x3c226f[_0x2525ca]={'$like':'%'+_0x45d714[_0xf8d0('0x34')][_0xf8d0('0x3f')]+'%'};return _0x3c226f;})});}_0x3d05d6=_[_0xf8d0('0x3e')]({},_0x3d05d6,_0x45d714[_0xf8d0('0x40')]);return _0x57a3c1['getSubjects'](_0x3d05d6);}})[_0xf8d0('0x27')](function(_0x396243){if(_0x396243){_0x299396=_0x396243[_0xf8d0('0x48')];if(!_0x45d714[_0xf8d0('0x34')][_0xf8d0('0x38')](_0xf8d0('0x39'))){_0x3d05d6[_0xf8d0('0x1f')]=qs[_0xf8d0('0x1f')](_0x45d714[_0xf8d0('0x34')][_0xf8d0('0x1f')]);_0x3d05d6[_0xf8d0('0x21')]=qs['offset'](_0x45d714['query'][_0xf8d0('0x21')]);}return _0x57a3c1[_0xf8d0('0x51')](_0x3d05d6);}})[_0xf8d0('0x27')](function(_0x3edd8c){if(_0x3edd8c){return _0x3edd8c?{'count':_0x299396,'rows':_0x3edd8c}:null;}})['then'](respondWithResult(_0x1cf04a,null))[_0xf8d0('0x45')](handleError(_0x1cf04a,null));};exports[_0xf8d0('0x52')]=function(_0x5b94d0,_0x52bcb3,_0x361a9a){var _0x47e608={};var _0x11211b={};var _0xc0a5ac;var _0x3436ee;return db['Dynamics365Configuration'][_0xf8d0('0x4d')]({'where':{'id':_0x5b94d0['params']['id']}})[_0xf8d0('0x27')](handleEntityNotFound(_0x52bcb3,null))[_0xf8d0('0x27')](function(_0x3156ef){if(_0x3156ef){_0xc0a5ac=_0x3156ef;_0x11211b[_0xf8d0('0x32')]=_[_0xf8d0('0x33')](db['Dynamics365Field']['rawAttributes']);_0x11211b[_0xf8d0('0x34')]=_[_0xf8d0('0x33')](_0x5b94d0[_0xf8d0('0x34')]);_0x11211b['filters']=_[_0xf8d0('0x35')](_0x11211b['model'],_0x11211b[_0xf8d0('0x34')]);_0x47e608[_0xf8d0('0x36')]=_[_0xf8d0('0x35')](_0x11211b[_0xf8d0('0x32')],qs[_0xf8d0('0x37')](_0x5b94d0[_0xf8d0('0x34')]['fields']));_0x47e608[_0xf8d0('0x36')]=_0x47e608[_0xf8d0('0x36')]['length']?_0x47e608['attributes']:_0x11211b[_0xf8d0('0x32')];_0x47e608[_0xf8d0('0x3a')]=qs[_0xf8d0('0x3b')](_0x5b94d0[_0xf8d0('0x34')][_0xf8d0('0x3b')]);_0x47e608[_0xf8d0('0x3c')]=qs[_0xf8d0('0x3d')](_[_0xf8d0('0x4f')](_0x5b94d0[_0xf8d0('0x34')],_0x11211b[_0xf8d0('0x3d')]));if(_0x5b94d0[_0xf8d0('0x34')]['filter']){_0x47e608[_0xf8d0('0x3c')]=_[_0xf8d0('0x3e')](_0x47e608[_0xf8d0('0x3c')],{'$or':_[_0xf8d0('0x2e')](_0x47e608[_0xf8d0('0x36')],function(_0x210fd3){var _0x447c97={};_0x447c97[_0x210fd3]={'$like':'%'+_0x5b94d0['query'][_0xf8d0('0x3f')]+'%'};return _0x447c97;})});}_0x47e608=_[_0xf8d0('0x3e')]({},_0x47e608,_0x5b94d0[_0xf8d0('0x40')]);return _0xc0a5ac['getDescriptions'](_0x47e608);}})['then'](function(_0x4c990f){if(_0x4c990f){_0x3436ee=_0x4c990f[_0xf8d0('0x48')];if(!_0x5b94d0['query']['hasOwnProperty'](_0xf8d0('0x39'))){_0x47e608[_0xf8d0('0x1f')]=qs[_0xf8d0('0x1f')](_0x5b94d0[_0xf8d0('0x34')]['limit']);_0x47e608[_0xf8d0('0x21')]=qs[_0xf8d0('0x21')](_0x5b94d0[_0xf8d0('0x34')][_0xf8d0('0x21')]);}return _0xc0a5ac[_0xf8d0('0x52')](_0x47e608);}})[_0xf8d0('0x27')](function(_0x37c7e5){if(_0x37c7e5){return _0x37c7e5?{'count':_0x3436ee,'rows':_0x37c7e5}:null;}})[_0xf8d0('0x27')](respondWithResult(_0x52bcb3,null))[_0xf8d0('0x45')](handleError(_0x52bcb3,null));}; \ No newline at end of file +var _0xa87d=['nolimit','order','sort','pick','filter','where','merge','options','Dynamics365Configuration','includeAll','include','findAll','catch','create','body','find','params','findOne','Dynamics365Field','getFields','rawAttributes','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa87d,0x68));var _0xda87=function(_0x27b536,_0xf5051c){_0x27b536=_0x27b536-0x0;var _0x4e8700=_0xa87d[_0x27b536];return _0x4e8700;};'use strict';var emlformat=require(_0xda87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda87('0x1'));var jsonpatch=require(_0xda87('0x2'));var rp=require('request-promise');var moment=require(_0xda87('0x3'));var BPromise=require(_0xda87('0x4'));var Mustache=require('mustache');var util=require(_0xda87('0x5'));var path=require(_0xda87('0x6'));var sox=require(_0xda87('0x7'));var csv=require('to-csv');var ejs=require(_0xda87('0x8'));var fs=require('fs');var fs_extra=require(_0xda87('0x9'));var _=require(_0xda87('0xa'));var squel=require(_0xda87('0xb'));var crypto=require(_0xda87('0xc'));var jsforce=require(_0xda87('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda87('0xe'));var querystring=require(_0xda87('0xf'));var Papa=require(_0xda87('0x10'));var Redis=require(_0xda87('0x11'));var authService=require(_0xda87('0x12'));var qs=require(_0xda87('0x13'));var as=require(_0xda87('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda87('0x15'))('api');var utils=require(_0xda87('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda87('0x17'));var db=require(_0xda87('0x18'))['db'];function respondWithStatusCode(_0x5d192e,_0x26a08d){_0x26a08d=_0x26a08d||0xcc;return function(_0x2989ca){if(_0x2989ca){return _0x5d192e[_0xda87('0x19')](_0x26a08d);}return _0x5d192e['status'](_0x26a08d)['end']();};}function respondWithResult(_0x1b317d,_0x24068f){_0x24068f=_0x24068f||0xc8;return function(_0x2334f0){if(_0x2334f0){return _0x1b317d[_0xda87('0x1a')](_0x24068f)[_0xda87('0x1b')](_0x2334f0);}};}function respondWithFilteredResult(_0x53a1a4,_0xf407fe){return function(_0x213898){if(_0x213898){var _0x15fd0f=typeof _0xf407fe[_0xda87('0x1c')]===_0xda87('0x1d')&&typeof _0xf407fe[_0xda87('0x1e')]===_0xda87('0x1d');var _0x5051cc=_0x213898[_0xda87('0x1f')];var _0x4d0623=_0x15fd0f?0x0:_0xf407fe[_0xda87('0x1c')];var _0x11af6c=_0x15fd0f?_0x213898['count']:_0xf407fe[_0xda87('0x1c')]+_0xf407fe[_0xda87('0x1e')];var _0x53b996;if(_0x11af6c>=_0x5051cc){_0x11af6c=_0x5051cc;_0x53b996=0xc8;}else{_0x53b996=0xce;}_0x53a1a4['status'](_0x53b996);return _0x53a1a4[_0xda87('0x20')](_0xda87('0x21'),_0x4d0623+'-'+_0x11af6c+'/'+_0x5051cc)[_0xda87('0x1b')](_0x213898);}return null;};}function patchUpdates(_0x154557){return function(_0x59878b){try{jsonpatch[_0xda87('0x22')](_0x59878b,_0x154557,!![]);}catch(_0x10cb51){return BPromise[_0xda87('0x23')](_0x10cb51);}return _0x59878b['save']();};}function saveUpdates(_0x514c56,_0x149533){return function(_0x498e47){if(_0x498e47){return _0x498e47[_0xda87('0x24')](_0x514c56)[_0xda87('0x25')](function(_0x13de05){return _0x13de05;});}return null;};}function removeEntity(_0x2cfb3d,_0x1bc0df){return function(_0x411fad){if(_0x411fad){return _0x411fad[_0xda87('0x26')]()[_0xda87('0x25')](function(){_0x2cfb3d[_0xda87('0x1a')](0xcc)[_0xda87('0x27')]();});}};}function handleEntityNotFound(_0x5249bd,_0x38c5d5){return function(_0x4ad67d){if(!_0x4ad67d){_0x5249bd[_0xda87('0x19')](0x194);}return _0x4ad67d;};}function handleError(_0x65640a,_0x5d4cf0){_0x5d4cf0=_0x5d4cf0||0x1f4;return function(_0x3ee0eb){logger[_0xda87('0x28')](_0x3ee0eb[_0xda87('0x29')]);if(_0x3ee0eb[_0xda87('0x2a')]){delete _0x3ee0eb[_0xda87('0x2a')];}_0x65640a[_0xda87('0x1a')](_0x5d4cf0)[_0xda87('0x2b')](_0x3ee0eb);};}exports[_0xda87('0x2c')]=function(_0x4fffce,_0x1858dd){var _0xf191c3={},_0xe462be={},_0x2d1bb2={'count':0x0,'rows':[]};var _0x16be8f=_[_0xda87('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0x1c91f6){return{'name':_0x1c91f6[_0xda87('0x2e')],'type':_0x1c91f6[_0xda87('0x2f')][_0xda87('0x30')]};});_0xe462be['model']=_['map'](_0x16be8f,_0xda87('0x2a'));_0xe462be[_0xda87('0x31')]=_[_0xda87('0x32')](_0x4fffce[_0xda87('0x31')]);_0xe462be[_0xda87('0x33')]=_['intersection'](_0xe462be[_0xda87('0x34')],_0xe462be[_0xda87('0x31')]);_0xf191c3[_0xda87('0x35')]=_[_0xda87('0x36')](_0xe462be[_0xda87('0x34')],qs[_0xda87('0x37')](_0x4fffce[_0xda87('0x31')][_0xda87('0x37')]));_0xf191c3[_0xda87('0x35')]=_0xf191c3[_0xda87('0x35')][_0xda87('0x38')]?_0xf191c3[_0xda87('0x35')]:_0xe462be[_0xda87('0x34')];if(!_0x4fffce[_0xda87('0x31')][_0xda87('0x39')](_0xda87('0x3a'))){_0xf191c3[_0xda87('0x1e')]=qs[_0xda87('0x1e')](_0x4fffce[_0xda87('0x31')][_0xda87('0x1e')]);_0xf191c3[_0xda87('0x1c')]=qs[_0xda87('0x1c')](_0x4fffce['query'][_0xda87('0x1c')]);}_0xf191c3[_0xda87('0x3b')]=qs[_0xda87('0x3c')](_0x4fffce['query']['sort']);_0xf191c3['where']=qs[_0xda87('0x33')](_[_0xda87('0x3d')](_0x4fffce[_0xda87('0x31')],_0xe462be[_0xda87('0x33')]),_0x16be8f);if(_0x4fffce[_0xda87('0x31')][_0xda87('0x3e')]){_0xf191c3[_0xda87('0x3f')]=_[_0xda87('0x40')](_0xf191c3['where'],{'$or':_[_0xda87('0x2d')](_0x16be8f,function(_0x19b996){if(_0x19b996['type']!=='VIRTUAL'){var _0x277244={};_0x277244[_0x19b996['name']]={'$like':'%'+_0x4fffce[_0xda87('0x31')]['filter']+'%'};return _0x277244;}})});}_0xf191c3=_[_0xda87('0x40')]({},_0xf191c3,_0x4fffce[_0xda87('0x41')]);var _0x3bcbc7={'where':_0xf191c3[_0xda87('0x3f')]};return db[_0xda87('0x42')][_0xda87('0x1f')](_0x3bcbc7)[_0xda87('0x25')](function(_0x2b16c5){_0x2d1bb2[_0xda87('0x1f')]=_0x2b16c5;if(_0x4fffce[_0xda87('0x31')][_0xda87('0x43')]){_0xf191c3[_0xda87('0x44')]=[{'all':!![]}];}return db[_0xda87('0x42')][_0xda87('0x45')](_0xf191c3);})[_0xda87('0x25')](function(_0x3bec6b){_0x2d1bb2['rows']=_0x3bec6b;return _0x2d1bb2;})[_0xda87('0x25')](respondWithFilteredResult(_0x1858dd,_0xf191c3))[_0xda87('0x46')](handleError(_0x1858dd,null));};exports['show']=function(_0xa5ddfd,_0x5580ba){var _0x20dca5={'raw':![],'where':{'id':_0xa5ddfd['params']['id']}},_0x5ddd9b={};_0x5ddd9b[_0xda87('0x34')]=_[_0xda87('0x32')](db[_0xda87('0x42')]['rawAttributes']);_0x5ddd9b[_0xda87('0x31')]=_[_0xda87('0x32')](_0xa5ddfd[_0xda87('0x31')]);_0x5ddd9b['filters']=_[_0xda87('0x36')](_0x5ddd9b[_0xda87('0x34')],_0x5ddd9b['query']);_0x20dca5['attributes']=_[_0xda87('0x36')](_0x5ddd9b[_0xda87('0x34')],qs[_0xda87('0x37')](_0xa5ddfd[_0xda87('0x31')][_0xda87('0x37')]));_0x20dca5[_0xda87('0x35')]=_0x20dca5[_0xda87('0x35')]['length']?_0x20dca5[_0xda87('0x35')]:_0x5ddd9b[_0xda87('0x34')];if(_0xa5ddfd[_0xda87('0x31')][_0xda87('0x43')]){_0x20dca5['include']=[{'all':!![]}];}_0x20dca5=_[_0xda87('0x40')]({},_0x20dca5,_0xa5ddfd[_0xda87('0x41')]);return db[_0xda87('0x42')]['find'](_0x20dca5)[_0xda87('0x25')](handleEntityNotFound(_0x5580ba,null))['then'](respondWithResult(_0x5580ba,null))[_0xda87('0x46')](handleError(_0x5580ba,null));};exports[_0xda87('0x47')]=function(_0xc62aab,_0x5bcddd){return db['Dynamics365Configuration'][_0xda87('0x47')](_0xc62aab['body'],{})[_0xda87('0x25')](respondWithResult(_0x5bcddd,0xc9))['catch'](handleError(_0x5bcddd,null));};exports[_0xda87('0x24')]=function(_0x42d4f2,_0x3471cc){if(_0x42d4f2[_0xda87('0x48')]['id']){delete _0x42d4f2[_0xda87('0x48')]['id'];}return db['Dynamics365Configuration'][_0xda87('0x49')]({'where':{'id':_0x42d4f2[_0xda87('0x4a')]['id']}})[_0xda87('0x25')](handleEntityNotFound(_0x3471cc,null))[_0xda87('0x25')](saveUpdates(_0x42d4f2[_0xda87('0x48')],null))['then'](respondWithResult(_0x3471cc,null))['catch'](handleError(_0x3471cc,null));};exports['destroy']=function(_0x56b94d,_0x3204cc){return db['Dynamics365Configuration'][_0xda87('0x49')]({'where':{'id':_0x56b94d[_0xda87('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3204cc,null))['then'](removeEntity(_0x3204cc,null))[_0xda87('0x46')](handleError(_0x3204cc,null));};exports['getFields']=function(_0xb4c796,_0x4f2a90,_0x510985){var _0x40f656={};var _0x3f5a5c={};var _0x38a835;var _0x485449;return db['Dynamics365Configuration'][_0xda87('0x4b')]({'where':{'id':_0xb4c796['params']['id']}})[_0xda87('0x25')](handleEntityNotFound(_0x4f2a90,null))[_0xda87('0x25')](function(_0x1d86f8){if(_0x1d86f8){_0x38a835=_0x1d86f8;_0x3f5a5c[_0xda87('0x34')]=_[_0xda87('0x32')](db[_0xda87('0x4c')]['rawAttributes']);_0x3f5a5c[_0xda87('0x31')]=_[_0xda87('0x32')](_0xb4c796[_0xda87('0x31')]);_0x3f5a5c[_0xda87('0x33')]=_['intersection'](_0x3f5a5c['model'],_0x3f5a5c['query']);_0x40f656[_0xda87('0x35')]=_[_0xda87('0x36')](_0x3f5a5c[_0xda87('0x34')],qs['fields'](_0xb4c796['query'][_0xda87('0x37')]));_0x40f656[_0xda87('0x35')]=_0x40f656[_0xda87('0x35')][_0xda87('0x38')]?_0x40f656[_0xda87('0x35')]:_0x3f5a5c[_0xda87('0x34')];_0x40f656[_0xda87('0x3b')]=qs[_0xda87('0x3c')](_0xb4c796[_0xda87('0x31')]['sort']);_0x40f656[_0xda87('0x3f')]=qs[_0xda87('0x33')](_[_0xda87('0x3d')](_0xb4c796[_0xda87('0x31')],_0x3f5a5c[_0xda87('0x33')]));if(_0xb4c796['query'][_0xda87('0x3e')]){_0x40f656[_0xda87('0x3f')]=_[_0xda87('0x40')](_0x40f656['where'],{'$or':_[_0xda87('0x2d')](_0x40f656['attributes'],function(_0x5b6357){var _0x1b4f27={};_0x1b4f27[_0x5b6357]={'$like':'%'+_0xb4c796[_0xda87('0x31')][_0xda87('0x3e')]+'%'};return _0x1b4f27;})});}_0x40f656=_[_0xda87('0x40')]({},_0x40f656,_0xb4c796[_0xda87('0x41')]);return _0x38a835[_0xda87('0x4d')](_0x40f656);}})[_0xda87('0x25')](function(_0x33eabe){if(_0x33eabe){_0x485449=_0x33eabe['length'];if(!_0xb4c796[_0xda87('0x31')][_0xda87('0x39')](_0xda87('0x3a'))){_0x40f656[_0xda87('0x1e')]=qs[_0xda87('0x1e')](_0xb4c796[_0xda87('0x31')]['limit']);_0x40f656[_0xda87('0x1c')]=qs['offset'](_0xb4c796['query']['offset']);}return _0x38a835[_0xda87('0x4d')](_0x40f656);}})[_0xda87('0x25')](function(_0x2cfe02){if(_0x2cfe02){return _0x2cfe02?{'count':_0x485449,'rows':_0x2cfe02}:null;}})[_0xda87('0x25')](respondWithResult(_0x4f2a90,null))['catch'](handleError(_0x4f2a90,null));};exports['getSubjects']=function(_0x142f6f,_0xd0e76b,_0x4a7e1c){var _0x4ea1c4={};var _0x5a7e4f={};var _0x5352a5;var _0x2eebc5;return db['Dynamics365Configuration'][_0xda87('0x4b')]({'where':{'id':_0x142f6f[_0xda87('0x4a')]['id']}})[_0xda87('0x25')](handleEntityNotFound(_0xd0e76b,null))['then'](function(_0x138d00){if(_0x138d00){_0x5352a5=_0x138d00;_0x5a7e4f[_0xda87('0x34')]=_[_0xda87('0x32')](db['Dynamics365Field'][_0xda87('0x4e')]);_0x5a7e4f[_0xda87('0x31')]=_[_0xda87('0x32')](_0x142f6f[_0xda87('0x31')]);_0x5a7e4f['filters']=_[_0xda87('0x36')](_0x5a7e4f[_0xda87('0x34')],_0x5a7e4f[_0xda87('0x31')]);_0x4ea1c4[_0xda87('0x35')]=_[_0xda87('0x36')](_0x5a7e4f[_0xda87('0x34')],qs['fields'](_0x142f6f[_0xda87('0x31')][_0xda87('0x37')]));_0x4ea1c4['attributes']=_0x4ea1c4[_0xda87('0x35')][_0xda87('0x38')]?_0x4ea1c4[_0xda87('0x35')]:_0x5a7e4f['model'];_0x4ea1c4['order']=qs[_0xda87('0x3c')](_0x142f6f[_0xda87('0x31')][_0xda87('0x3c')]);_0x4ea1c4[_0xda87('0x3f')]=qs[_0xda87('0x33')](_['pick'](_0x142f6f[_0xda87('0x31')],_0x5a7e4f[_0xda87('0x33')]));if(_0x142f6f[_0xda87('0x31')][_0xda87('0x3e')]){_0x4ea1c4[_0xda87('0x3f')]=_[_0xda87('0x40')](_0x4ea1c4[_0xda87('0x3f')],{'$or':_[_0xda87('0x2d')](_0x4ea1c4[_0xda87('0x35')],function(_0x4fdf27){var _0x304469={};_0x304469[_0x4fdf27]={'$like':'%'+_0x142f6f[_0xda87('0x31')][_0xda87('0x3e')]+'%'};return _0x304469;})});}_0x4ea1c4=_[_0xda87('0x40')]({},_0x4ea1c4,_0x142f6f[_0xda87('0x41')]);return _0x5352a5[_0xda87('0x4f')](_0x4ea1c4);}})[_0xda87('0x25')](function(_0x1616b5){if(_0x1616b5){_0x2eebc5=_0x1616b5[_0xda87('0x38')];if(!_0x142f6f[_0xda87('0x31')][_0xda87('0x39')](_0xda87('0x3a'))){_0x4ea1c4[_0xda87('0x1e')]=qs[_0xda87('0x1e')](_0x142f6f[_0xda87('0x31')][_0xda87('0x1e')]);_0x4ea1c4[_0xda87('0x1c')]=qs[_0xda87('0x1c')](_0x142f6f[_0xda87('0x31')]['offset']);}return _0x5352a5['getSubjects'](_0x4ea1c4);}})[_0xda87('0x25')](function(_0x4fb228){if(_0x4fb228){return _0x4fb228?{'count':_0x2eebc5,'rows':_0x4fb228}:null;}})[_0xda87('0x25')](respondWithResult(_0xd0e76b,null))[_0xda87('0x46')](handleError(_0xd0e76b,null));};exports[_0xda87('0x50')]=function(_0x37d789,_0x10b263,_0x8429dd){var _0x3daa27={};var _0x37bc61={};var _0xf4c20b;var _0x11c88d;return db[_0xda87('0x42')][_0xda87('0x4b')]({'where':{'id':_0x37d789[_0xda87('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10b263,null))[_0xda87('0x25')](function(_0x53ea2e){if(_0x53ea2e){_0xf4c20b=_0x53ea2e;_0x37bc61['model']=_[_0xda87('0x32')](db[_0xda87('0x4c')][_0xda87('0x4e')]);_0x37bc61[_0xda87('0x31')]=_[_0xda87('0x32')](_0x37d789[_0xda87('0x31')]);_0x37bc61[_0xda87('0x33')]=_['intersection'](_0x37bc61[_0xda87('0x34')],_0x37bc61[_0xda87('0x31')]);_0x3daa27[_0xda87('0x35')]=_[_0xda87('0x36')](_0x37bc61['model'],qs[_0xda87('0x37')](_0x37d789[_0xda87('0x31')][_0xda87('0x37')]));_0x3daa27['attributes']=_0x3daa27[_0xda87('0x35')][_0xda87('0x38')]?_0x3daa27['attributes']:_0x37bc61['model'];_0x3daa27[_0xda87('0x3b')]=qs[_0xda87('0x3c')](_0x37d789[_0xda87('0x31')][_0xda87('0x3c')]);_0x3daa27[_0xda87('0x3f')]=qs[_0xda87('0x33')](_['pick'](_0x37d789[_0xda87('0x31')],_0x37bc61[_0xda87('0x33')]));if(_0x37d789[_0xda87('0x31')][_0xda87('0x3e')]){_0x3daa27[_0xda87('0x3f')]=_[_0xda87('0x40')](_0x3daa27[_0xda87('0x3f')],{'$or':_['map'](_0x3daa27[_0xda87('0x35')],function(_0x179285){var _0x4205af={};_0x4205af[_0x179285]={'$like':'%'+_0x37d789[_0xda87('0x31')]['filter']+'%'};return _0x4205af;})});}_0x3daa27=_[_0xda87('0x40')]({},_0x3daa27,_0x37d789[_0xda87('0x41')]);return _0xf4c20b[_0xda87('0x50')](_0x3daa27);}})[_0xda87('0x25')](function(_0x5ec1a7){if(_0x5ec1a7){_0x11c88d=_0x5ec1a7[_0xda87('0x38')];if(!_0x37d789[_0xda87('0x31')][_0xda87('0x39')](_0xda87('0x3a'))){_0x3daa27[_0xda87('0x1e')]=qs['limit'](_0x37d789[_0xda87('0x31')][_0xda87('0x1e')]);_0x3daa27[_0xda87('0x1c')]=qs[_0xda87('0x1c')](_0x37d789['query'][_0xda87('0x1c')]);}return _0xf4c20b['getDescriptions'](_0x3daa27);}})['then'](function(_0x20110c){if(_0x20110c){return _0x20110c?{'count':_0x11c88d,'rows':_0x20110c}:null;}})['then'](respondWithResult(_0x10b263,null))[_0xda87('0x46')](handleError(_0x10b263,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fc562c3..5a7b628 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x8c6164,_0x1dc7db){var _0x1ca172=function(_0x1c8d48){while(--_0x1c8d48){_0x8c6164['push'](_0x8c6164['shift']());}};_0x1ca172(++_0x1dc7db);}(_0x3e74,0x175));var _0x43e7=function(_0x472f64,_0x4a29d){_0x472f64=_0x472f64-0x0;var _0x37168c=_0x3e74[_0x472f64];return _0x37168c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x3bcd69,_0x41165e){var _0x1a6825=function(_0x569e95){while(--_0x569e95){_0x3bcd69['push'](_0x3bcd69['shift']());}};_0x1a6825(++_0x41165e);}(_0xa41a,0x6b));var _0xaa41=function(_0x33144c,_0x12b640){_0x33144c=_0x33144c-0x0;var _0x425ee8=_0xa41a[_0x33144c];return _0x425ee8;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4ef51b9..2d8c719 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 _0x4e28=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request','info','request\x20sent','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch'];(function(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0x4e28,0x1ed));var _0x84e2=function(_0x16a5c9,_0x43e7eb){_0x16a5c9=_0x16a5c9-0x0;var _0x3a1ed6=_0x4e28[_0x16a5c9];return _0x3a1ed6;};'use strict';var _=require(_0x84e2('0x0'));var util=require(_0x84e2('0x1'));var moment=require(_0x84e2('0x2'));var BPromise=require(_0x84e2('0x3'));var rs=require(_0x84e2('0x4'));var fs=require('fs');var Redis=require(_0x84e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84e2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x84e2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16cec4,_0x115efc,_0x49f92a){return new BPromise(function(_0x5275a9,_0x26dc4c){return client[_0x84e2('0x9')](_0x16cec4,_0x49f92a)['then'](function(_0x586f9){logger[_0x84e2('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x115efc,_0x84e2('0xb'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x115efc,_0x84e2('0xb'),JSON['stringify'](_0x586f9));if(_0x586f9[_0x84e2('0xc')]){if(_0x586f9['error']['code']===0x1f4){logger[_0x84e2('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x115efc,_0x586f9[_0x84e2('0xc')][_0x84e2('0xd')]);return _0x26dc4c(_0x586f9['error']['message']);}logger['error'](_0x84e2('0xe'),_0x115efc,_0x586f9['error'][_0x84e2('0xd')]);return _0x5275a9(_0x586f9[_0x84e2('0xc')][_0x84e2('0xd')]);}else{logger[_0x84e2('0xa')](_0x84e2('0xe'),_0x115efc,_0x84e2('0xb'));_0x5275a9(_0x586f9[_0x84e2('0xf')][_0x84e2('0xd')]);}})[_0x84e2('0x10')](function(_0x3ac883){logger[_0x84e2('0xc')](_0x84e2('0xe'),_0x115efc,_0x3ac883);_0x26dc4c(_0x3ac883);});});} \ No newline at end of file +var _0x67ad=['../../config/environment','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa7d678,_0x3dfdff){var _0x5cc539=function(_0x4393d7){while(--_0x4393d7){_0xa7d678['push'](_0xa7d678['shift']());}};_0x5cc539(++_0x3dfdff);}(_0x67ad,0xdc));var _0xd67a=function(_0xc1b041,_0x2d2362){_0xc1b041=_0xc1b041-0x0;var _0x2e2060=_0x67ad[_0xc1b041];return _0x2e2060;};'use strict';var _=require(_0xd67a('0x0'));var util=require(_0xd67a('0x1'));var moment=require(_0xd67a('0x2'));var BPromise=require(_0xd67a('0x3'));var rs=require(_0xd67a('0x4'));var fs=require('fs');var Redis=require(_0xd67a('0x5'));var db=require(_0xd67a('0x6'))['db'];var utils=require(_0xd67a('0x7'));var logger=require(_0xd67a('0x8'))(_0xd67a('0x9'));var config=require(_0xd67a('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd67a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36ab47,_0x46f9fe,_0x192184){return new BPromise(function(_0x592b9d,_0x2ff670){return client[_0xd67a('0xc')](_0x36ab47,_0x192184)['then'](function(_0x34f0c6){logger[_0xd67a('0xd')](_0xd67a('0xe'),_0x46f9fe,_0xd67a('0xf'));logger[_0xd67a('0x10')](_0xd67a('0x11'),_0x46f9fe,_0xd67a('0xf'),JSON[_0xd67a('0x12')](_0x34f0c6));if(_0x34f0c6[_0xd67a('0x13')]){if(_0x34f0c6[_0xd67a('0x13')][_0xd67a('0x14')]===0x1f4){logger[_0xd67a('0x13')](_0xd67a('0xe'),_0x46f9fe,_0x34f0c6[_0xd67a('0x13')][_0xd67a('0x15')]);return _0x2ff670(_0x34f0c6[_0xd67a('0x13')][_0xd67a('0x15')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x46f9fe,_0x34f0c6[_0xd67a('0x13')][_0xd67a('0x15')]);return _0x592b9d(_0x34f0c6['error'][_0xd67a('0x15')]);}else{logger[_0xd67a('0xd')](_0xd67a('0xe'),_0x46f9fe,_0xd67a('0xf'));_0x592b9d(_0x34f0c6['result'][_0xd67a('0x15')]);}})[_0xd67a('0x16')](function(_0x5554f3){logger[_0xd67a('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46f9fe,_0x5554f3);_0x2ff670(_0x5554f3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 98d04d1..ab99fba 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 _0x764c=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x764c,0x143));var _0xc764=function(_0x3aa903,_0x4261c2){_0x3aa903=_0x3aa903-0x0;var _0x43dcb0=_0x764c[_0x3aa903];return _0x43dcb0;};'use strict';var multer=require(_0xc764('0x0'));var util=require(_0xc764('0x1'));var path=require(_0xc764('0x2'));var timeout=require(_0xc764('0x3'));var express=require('express');var router=express[_0xc764('0x4')]();var fs_extra=require(_0xc764('0x5'));var auth=require(_0xc764('0x6'));var interaction=require(_0xc764('0x7'));var config=require(_0xc764('0x8'));var controller=require(_0xc764('0x9'));router[_0xc764('0xa')]('/',auth[_0xc764('0xb')](),controller['index']);router['get'](_0xc764('0xc'),auth[_0xc764('0xb')](),controller[_0xc764('0xd')]);router[_0xc764('0xe')]('/',auth[_0xc764('0xb')](),controller[_0xc764('0xf')]);router[_0xc764('0x10')](_0xc764('0xc'),auth[_0xc764('0xb')](),controller[_0xc764('0x11')]);router[_0xc764('0x12')]('/:id',auth[_0xc764('0xb')](),controller['destroy']);module[_0xc764('0x13')]=router; \ No newline at end of file +var _0xd9e2=['index','/:id','post','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9e2,0x1aa));var _0x2d9e=function(_0x5bd7a3,_0x5899b1){_0x5bd7a3=_0x5bd7a3-0x0;var _0x29e95b=_0xd9e2[_0x5bd7a3];return _0x29e95b;};'use strict';var multer=require(_0x2d9e('0x0'));var util=require('util');var path=require(_0x2d9e('0x1'));var timeout=require(_0x2d9e('0x2'));var express=require('express');var router=express[_0x2d9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2d9e('0x4'));var interaction=require(_0x2d9e('0x5'));var config=require(_0x2d9e('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x2d9e('0x7')]('/',auth[_0x2d9e('0x8')](),controller[_0x2d9e('0x9')]);router[_0x2d9e('0x7')](_0x2d9e('0xa'),auth[_0x2d9e('0x8')](),controller['show']);router[_0x2d9e('0xb')]('/',auth[_0x2d9e('0x8')](),controller['create']);router[_0x2d9e('0xc')]('/:id',auth[_0x2d9e('0x8')](),controller['update']);router[_0x2d9e('0xd')](_0x2d9e('0xa'),auth[_0x2d9e('0x8')](),controller['destroy']);module[_0x2d9e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b9f832c..dfde27a 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 _0x9eeb=['customVariable','picklist','STRING','BOOLEAN','sequelize','string','variable'];(function(_0x5a2bc0,_0x23152a){var _0x2c29db=function(_0x2b6893){while(--_0x2b6893){_0x5a2bc0['push'](_0x5a2bc0['shift']());}};_0x2c29db(++_0x23152a);}(_0x9eeb,0x6d));var _0xb9ee=function(_0x38911d,_0x75f88c){_0x38911d=_0x38911d-0x0;var _0x43c233=_0x9eeb[_0x38911d];return _0x43c233;};'use strict';var Sequelize=require(_0xb9ee('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb9ee('0x1'),_0xb9ee('0x2'),_0xb9ee('0x3'),'keyValue',_0xb9ee('0x4')),'defaultValue':_0xb9ee('0x1')},'content':{'type':Sequelize[_0xb9ee('0x5')]},'key':{'type':Sequelize[_0xb9ee('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb9ee('0x1'),_0xb9ee('0x2'),_0xb9ee('0x3'))},'keyContent':{'type':Sequelize[_0xb9ee('0x5')]},'idField':{'type':Sequelize[_0xb9ee('0x5')]},'nameField':{'type':Sequelize[_0xb9ee('0x5')]},'customField':{'type':Sequelize[_0xb9ee('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa27=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa27,0xe3));var _0x7fa2=function(_0x11aa88,_0x1ebdc0){_0x11aa88=_0x11aa88-0x0;var _0x20bcd2=_0xfa27[_0x11aa88];return _0x20bcd2;};'use strict';var Sequelize=require(_0x7fa2('0x0'));module[_0x7fa2('0x1')]={'type':{'type':Sequelize[_0x7fa2('0x2')](_0x7fa2('0x3'),'variable',_0x7fa2('0x4'),_0x7fa2('0x5'),_0x7fa2('0x6')),'defaultValue':_0x7fa2('0x3')},'content':{'type':Sequelize[_0x7fa2('0x7')]},'key':{'type':Sequelize[_0x7fa2('0x7')]},'keyType':{'type':Sequelize[_0x7fa2('0x2')](_0x7fa2('0x3'),_0x7fa2('0x8'),_0x7fa2('0x4'))},'keyContent':{'type':Sequelize[_0x7fa2('0x7')]},'idField':{'type':Sequelize[_0x7fa2('0x7')]},'nameField':{'type':Sequelize[_0x7fa2('0x7')]},'customField':{'type':Sequelize[_0x7fa2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7fa2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1963361..93b7f11 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 _0xe846=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','end','error','stack','name','send','index','Dynamics365Field','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe846,0x170));var _0x6e84=function(_0x328a34,_0x38ac22){_0x328a34=_0x328a34-0x0;var _0x574c0b=_0xe846[_0x328a34];return _0x574c0b;};'use strict';var emlformat=require(_0x6e84('0x0'));var rimraf=require(_0x6e84('0x1'));var zipdir=require(_0x6e84('0x2'));var jsonpatch=require(_0x6e84('0x3'));var rp=require(_0x6e84('0x4'));var moment=require(_0x6e84('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6e84('0x6'));var csv=require('to-csv');var ejs=require(_0x6e84('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6e84('0x8'));var crypto=require(_0x6e84('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e84('0xa'));var Papa=require('papaparse');var Redis=require(_0x6e84('0xb'));var authService=require(_0x6e84('0xc'));var qs=require(_0x6e84('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e84('0xe'));var logger=require('../../config/logger')(_0x6e84('0xf'));var utils=require(_0x6e84('0x10'));var config=require(_0x6e84('0x11'));var licenseUtil=require(_0x6e84('0x12'));var db=require(_0x6e84('0x13'))['db'];function respondWithStatusCode(_0xaa8563,_0x44c261){_0x44c261=_0x44c261||0xcc;return function(_0x4e01b5){if(_0x4e01b5){return _0xaa8563[_0x6e84('0x14')](_0x44c261);}return _0xaa8563[_0x6e84('0x15')](_0x44c261)['end']();};}function respondWithResult(_0x52c23c,_0x552eb8){_0x552eb8=_0x552eb8||0xc8;return function(_0x42ac00){if(_0x42ac00){return _0x52c23c[_0x6e84('0x15')](_0x552eb8)[_0x6e84('0x16')](_0x42ac00);}};}function respondWithFilteredResult(_0x83134e,_0x3dc889){return function(_0x708703){if(_0x708703){var _0x22afc9=typeof _0x3dc889[_0x6e84('0x17')]===_0x6e84('0x18')&&typeof _0x3dc889[_0x6e84('0x19')]===_0x6e84('0x18');var _0x25335a=_0x708703[_0x6e84('0x1a')];var _0x129067=_0x22afc9?0x0:_0x3dc889[_0x6e84('0x17')];var _0x140c21=_0x22afc9?_0x708703[_0x6e84('0x1a')]:_0x3dc889[_0x6e84('0x17')]+_0x3dc889[_0x6e84('0x19')];var _0x5affc5;if(_0x140c21>=_0x25335a){_0x140c21=_0x25335a;_0x5affc5=0xc8;}else{_0x5affc5=0xce;}_0x83134e['status'](_0x5affc5);return _0x83134e['set']('Content-Range',_0x129067+'-'+_0x140c21+'/'+_0x25335a)[_0x6e84('0x16')](_0x708703);}return null;};}function patchUpdates(_0x1bab8c){return function(_0x7d1ed8){try{jsonpatch[_0x6e84('0x1b')](_0x7d1ed8,_0x1bab8c,!![]);}catch(_0x4a405b){return BPromise[_0x6e84('0x1c')](_0x4a405b);}return _0x7d1ed8[_0x6e84('0x1d')]();};}function saveUpdates(_0x4b1871,_0x575c1e){return function(_0x5b1a86){if(_0x5b1a86){return _0x5b1a86['update'](_0x4b1871)[_0x6e84('0x1e')](function(_0x49e010){return _0x49e010;});}return null;};}function removeEntity(_0x50d7de,_0x564f2f){return function(_0x46e863){if(_0x46e863){return _0x46e863['destroy']()['then'](function(){_0x50d7de['status'](0xcc)[_0x6e84('0x1f')]();});}};}function handleEntityNotFound(_0x503ab4,_0x5470be){return function(_0x380d0d){if(!_0x380d0d){_0x503ab4[_0x6e84('0x14')](0x194);}return _0x380d0d;};}function handleError(_0xa58f33,_0x29653f){_0x29653f=_0x29653f||0x1f4;return function(_0x42fe52){logger[_0x6e84('0x20')](_0x42fe52[_0x6e84('0x21')]);if(_0x42fe52[_0x6e84('0x22')]){delete _0x42fe52[_0x6e84('0x22')];}_0xa58f33[_0x6e84('0x15')](_0x29653f)[_0x6e84('0x23')](_0x42fe52);};}exports[_0x6e84('0x24')]=function(_0x2e642a,_0xa2a0db){var _0x1f8675={},_0x588907={},_0x15c966={'count':0x0,'rows':[]};var _0x39116f=_['map'](db[_0x6e84('0x25')]['rawAttributes'],function(_0x51a26f){return{'name':_0x51a26f[_0x6e84('0x26')],'type':_0x51a26f[_0x6e84('0x27')]['key']};});_0x588907[_0x6e84('0x28')]=_['map'](_0x39116f,'name');_0x588907[_0x6e84('0x29')]=_[_0x6e84('0x2a')](_0x2e642a['query']);_0x588907[_0x6e84('0x2b')]=_['intersection'](_0x588907['model'],_0x588907['query']);_0x1f8675[_0x6e84('0x2c')]=_[_0x6e84('0x2d')](_0x588907['model'],qs['fields'](_0x2e642a['query'][_0x6e84('0x2e')]));_0x1f8675[_0x6e84('0x2c')]=_0x1f8675[_0x6e84('0x2c')][_0x6e84('0x2f')]?_0x1f8675[_0x6e84('0x2c')]:_0x588907['model'];if(!_0x2e642a['query'][_0x6e84('0x30')]('nolimit')){_0x1f8675['limit']=qs[_0x6e84('0x19')](_0x2e642a[_0x6e84('0x29')][_0x6e84('0x19')]);_0x1f8675[_0x6e84('0x17')]=qs[_0x6e84('0x17')](_0x2e642a[_0x6e84('0x29')][_0x6e84('0x17')]);}_0x1f8675[_0x6e84('0x31')]=qs['sort'](_0x2e642a[_0x6e84('0x29')][_0x6e84('0x32')]);_0x1f8675[_0x6e84('0x33')]=qs[_0x6e84('0x2b')](_[_0x6e84('0x34')](_0x2e642a['query'],_0x588907[_0x6e84('0x2b')]),_0x39116f);if(_0x2e642a[_0x6e84('0x29')][_0x6e84('0x35')]){_0x1f8675[_0x6e84('0x33')]=_[_0x6e84('0x36')](_0x1f8675[_0x6e84('0x33')],{'$or':_[_0x6e84('0x37')](_0x39116f,function(_0x4edd4a){if(_0x4edd4a[_0x6e84('0x27')]!==_0x6e84('0x38')){var _0x4ba6a3={};_0x4ba6a3[_0x4edd4a[_0x6e84('0x22')]]={'$like':'%'+_0x2e642a[_0x6e84('0x29')][_0x6e84('0x35')]+'%'};return _0x4ba6a3;}})});}_0x1f8675=_['merge']({},_0x1f8675,_0x2e642a[_0x6e84('0x39')]);var _0x506a9d={'where':_0x1f8675[_0x6e84('0x33')]};return db[_0x6e84('0x25')]['count'](_0x506a9d)[_0x6e84('0x1e')](function(_0x15f93d){_0x15c966[_0x6e84('0x1a')]=_0x15f93d;if(_0x2e642a['query']['includeAll']){_0x1f8675[_0x6e84('0x3a')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x1f8675);})[_0x6e84('0x1e')](function(_0x2056b2){_0x15c966[_0x6e84('0x3b')]=_0x2056b2;return _0x15c966;})['then'](respondWithFilteredResult(_0xa2a0db,_0x1f8675))[_0x6e84('0x3c')](handleError(_0xa2a0db,null));};exports[_0x6e84('0x3d')]=function(_0xc5fd8,_0x1703db){var _0x3f9849={'raw':!![],'where':{'id':_0xc5fd8[_0x6e84('0x3e')]['id']}},_0x180f52={};_0x180f52[_0x6e84('0x28')]=_[_0x6e84('0x2a')](db['Dynamics365Field'][_0x6e84('0x3f')]);_0x180f52[_0x6e84('0x29')]=_['keys'](_0xc5fd8[_0x6e84('0x29')]);_0x180f52['filters']=_['intersection'](_0x180f52['model'],_0x180f52[_0x6e84('0x29')]);_0x3f9849['attributes']=_[_0x6e84('0x2d')](_0x180f52[_0x6e84('0x28')],qs['fields'](_0xc5fd8['query'][_0x6e84('0x2e')]));_0x3f9849[_0x6e84('0x2c')]=_0x3f9849[_0x6e84('0x2c')][_0x6e84('0x2f')]?_0x3f9849['attributes']:_0x180f52[_0x6e84('0x28')];if(_0xc5fd8[_0x6e84('0x29')]['includeAll']){_0x3f9849[_0x6e84('0x3a')]=[{'all':!![]}];}_0x3f9849=_[_0x6e84('0x36')]({},_0x3f9849,_0xc5fd8['options']);return db[_0x6e84('0x25')][_0x6e84('0x40')](_0x3f9849)[_0x6e84('0x1e')](handleEntityNotFound(_0x1703db,null))['then'](respondWithResult(_0x1703db,null))[_0x6e84('0x3c')](handleError(_0x1703db,null));};exports[_0x6e84('0x41')]=function(_0x2ed844,_0x31ba70){return db['Dynamics365Field'][_0x6e84('0x41')](_0x2ed844['body'],{})[_0x6e84('0x1e')](respondWithResult(_0x31ba70,0xc9))[_0x6e84('0x3c')](handleError(_0x31ba70,null));};exports['update']=function(_0x47381f,_0x147463){if(_0x47381f[_0x6e84('0x42')]['id']){delete _0x47381f['body']['id'];}return db[_0x6e84('0x25')][_0x6e84('0x40')]({'where':{'id':_0x47381f[_0x6e84('0x3e')]['id']}})[_0x6e84('0x1e')](handleEntityNotFound(_0x147463,null))['then'](saveUpdates(_0x47381f[_0x6e84('0x42')],null))[_0x6e84('0x1e')](respondWithResult(_0x147463,null))['catch'](handleError(_0x147463,null));};exports[_0x6e84('0x43')]=function(_0x1bca60,_0x27377b){return db['Dynamics365Field']['find']({'where':{'id':_0x1bca60['params']['id']}})[_0x6e84('0x1e')](handleEntityNotFound(_0x27377b,null))[_0x6e84('0x1e')](removeEntity(_0x27377b,null))[_0x6e84('0x3c')](handleError(_0x27377b,null));}; \ No newline at end of file +var _0xe5e9=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xe5e9,0x89));var _0x9e5e=function(_0x114749,_0x9b572a){_0x114749=_0x114749-0x0;var _0x499080=_0xe5e9[_0x114749];return _0x499080;};'use strict';var emlformat=require(_0x9e5e('0x0'));var rimraf=require(_0x9e5e('0x1'));var zipdir=require(_0x9e5e('0x2'));var jsonpatch=require(_0x9e5e('0x3'));var rp=require(_0x9e5e('0x4'));var moment=require(_0x9e5e('0x5'));var BPromise=require(_0x9e5e('0x6'));var Mustache=require(_0x9e5e('0x7'));var util=require('util');var path=require(_0x9e5e('0x8'));var sox=require(_0x9e5e('0x9'));var csv=require(_0x9e5e('0xa'));var ejs=require(_0x9e5e('0xb'));var fs=require('fs');var fs_extra=require(_0x9e5e('0xc'));var _=require(_0x9e5e('0xd'));var squel=require(_0x9e5e('0xe'));var crypto=require(_0x9e5e('0xf'));var jsforce=require(_0x9e5e('0x10'));var deskjs=require(_0x9e5e('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e5e('0x12'));var Redis=require(_0x9e5e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9e5e('0x14'));var as=require(_0x9e5e('0x15'));var hardwareService=require(_0x9e5e('0x16'));var logger=require(_0x9e5e('0x17'))(_0x9e5e('0x18'));var utils=require(_0x9e5e('0x19'));var config=require(_0x9e5e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e5e('0x1b'))['db'];function respondWithStatusCode(_0x331321,_0x45dc){_0x45dc=_0x45dc||0xcc;return function(_0x4a7c38){if(_0x4a7c38){return _0x331321['sendStatus'](_0x45dc);}return _0x331321[_0x9e5e('0x1c')](_0x45dc)[_0x9e5e('0x1d')]();};}function respondWithResult(_0x32049c,_0x11eab0){_0x11eab0=_0x11eab0||0xc8;return function(_0x5a481b){if(_0x5a481b){return _0x32049c[_0x9e5e('0x1c')](_0x11eab0)['json'](_0x5a481b);}};}function respondWithFilteredResult(_0x22aad4,_0x1b63bc){return function(_0xef2575){if(_0xef2575){var _0x528609=typeof _0x1b63bc[_0x9e5e('0x1e')]===_0x9e5e('0x1f')&&typeof _0x1b63bc[_0x9e5e('0x20')]===_0x9e5e('0x1f');var _0x21e26b=_0xef2575[_0x9e5e('0x21')];var _0x2c3411=_0x528609?0x0:_0x1b63bc['offset'];var _0x3af807=_0x528609?_0xef2575[_0x9e5e('0x21')]:_0x1b63bc['offset']+_0x1b63bc[_0x9e5e('0x20')];var _0x5d201f;if(_0x3af807>=_0x21e26b){_0x3af807=_0x21e26b;_0x5d201f=0xc8;}else{_0x5d201f=0xce;}_0x22aad4[_0x9e5e('0x1c')](_0x5d201f);return _0x22aad4[_0x9e5e('0x22')](_0x9e5e('0x23'),_0x2c3411+'-'+_0x3af807+'/'+_0x21e26b)[_0x9e5e('0x24')](_0xef2575);}return null;};}function patchUpdates(_0x5b7500){return function(_0x1d7bc6){try{jsonpatch[_0x9e5e('0x25')](_0x1d7bc6,_0x5b7500,!![]);}catch(_0xd5a7fc){return BPromise[_0x9e5e('0x26')](_0xd5a7fc);}return _0x1d7bc6['save']();};}function saveUpdates(_0x4366ec,_0x2dba34){return function(_0x26eef4){if(_0x26eef4){return _0x26eef4[_0x9e5e('0x27')](_0x4366ec)[_0x9e5e('0x28')](function(_0x1f38dd){return _0x1f38dd;});}return null;};}function removeEntity(_0x1dfd0b,_0x3b6dc6){return function(_0x313c03){if(_0x313c03){return _0x313c03[_0x9e5e('0x29')]()[_0x9e5e('0x28')](function(){_0x1dfd0b[_0x9e5e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d64b,_0xb0ffa0){return function(_0xa27b18){if(!_0xa27b18){_0x13d64b['sendStatus'](0x194);}return _0xa27b18;};}function handleError(_0x389a92,_0x1c864e){_0x1c864e=_0x1c864e||0x1f4;return function(_0x2dd7b7){logger[_0x9e5e('0x2a')](_0x2dd7b7[_0x9e5e('0x2b')]);if(_0x2dd7b7['name']){delete _0x2dd7b7[_0x9e5e('0x2c')];}_0x389a92['status'](_0x1c864e)[_0x9e5e('0x2d')](_0x2dd7b7);};}exports['index']=function(_0x39b634,_0x3da473){var _0x333fdf={},_0x2ae8e4={},_0x321f20={'count':0x0,'rows':[]};var _0x35991e=_[_0x9e5e('0x2e')](db[_0x9e5e('0x2f')][_0x9e5e('0x30')],function(_0x49e257){return{'name':_0x49e257[_0x9e5e('0x31')],'type':_0x49e257[_0x9e5e('0x32')][_0x9e5e('0x33')]};});_0x2ae8e4[_0x9e5e('0x34')]=_['map'](_0x35991e,_0x9e5e('0x2c'));_0x2ae8e4[_0x9e5e('0x35')]=_[_0x9e5e('0x36')](_0x39b634['query']);_0x2ae8e4[_0x9e5e('0x37')]=_[_0x9e5e('0x38')](_0x2ae8e4['model'],_0x2ae8e4[_0x9e5e('0x35')]);_0x333fdf[_0x9e5e('0x39')]=_[_0x9e5e('0x38')](_0x2ae8e4[_0x9e5e('0x34')],qs[_0x9e5e('0x3a')](_0x39b634[_0x9e5e('0x35')][_0x9e5e('0x3a')]));_0x333fdf[_0x9e5e('0x39')]=_0x333fdf[_0x9e5e('0x39')]['length']?_0x333fdf[_0x9e5e('0x39')]:_0x2ae8e4['model'];if(!_0x39b634['query'][_0x9e5e('0x3b')](_0x9e5e('0x3c'))){_0x333fdf[_0x9e5e('0x20')]=qs[_0x9e5e('0x20')](_0x39b634[_0x9e5e('0x35')][_0x9e5e('0x20')]);_0x333fdf['offset']=qs[_0x9e5e('0x1e')](_0x39b634[_0x9e5e('0x35')][_0x9e5e('0x1e')]);}_0x333fdf[_0x9e5e('0x3d')]=qs[_0x9e5e('0x3e')](_0x39b634[_0x9e5e('0x35')]['sort']);_0x333fdf[_0x9e5e('0x3f')]=qs[_0x9e5e('0x37')](_[_0x9e5e('0x40')](_0x39b634[_0x9e5e('0x35')],_0x2ae8e4[_0x9e5e('0x37')]),_0x35991e);if(_0x39b634[_0x9e5e('0x35')]['filter']){_0x333fdf[_0x9e5e('0x3f')]=_['merge'](_0x333fdf[_0x9e5e('0x3f')],{'$or':_[_0x9e5e('0x2e')](_0x35991e,function(_0x4afd59){if(_0x4afd59[_0x9e5e('0x32')]!=='VIRTUAL'){var _0x55015a={};_0x55015a[_0x4afd59[_0x9e5e('0x2c')]]={'$like':'%'+_0x39b634[_0x9e5e('0x35')]['filter']+'%'};return _0x55015a;}})});}_0x333fdf=_[_0x9e5e('0x41')]({},_0x333fdf,_0x39b634[_0x9e5e('0x42')]);var _0x17002c={'where':_0x333fdf[_0x9e5e('0x3f')]};return db['Dynamics365Field']['count'](_0x17002c)['then'](function(_0x3770d2){_0x321f20[_0x9e5e('0x21')]=_0x3770d2;if(_0x39b634['query'][_0x9e5e('0x43')]){_0x333fdf[_0x9e5e('0x44')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x9e5e('0x45')](_0x333fdf);})['then'](function(_0x9a337f){_0x321f20['rows']=_0x9a337f;return _0x321f20;})['then'](respondWithFilteredResult(_0x3da473,_0x333fdf))[_0x9e5e('0x46')](handleError(_0x3da473,null));};exports['show']=function(_0x59bb2a,_0xb21dc5){var _0x31f384={'raw':!![],'where':{'id':_0x59bb2a[_0x9e5e('0x47')]['id']}},_0x381720={};_0x381720[_0x9e5e('0x34')]=_[_0x9e5e('0x36')](db[_0x9e5e('0x2f')][_0x9e5e('0x30')]);_0x381720['query']=_[_0x9e5e('0x36')](_0x59bb2a['query']);_0x381720[_0x9e5e('0x37')]=_[_0x9e5e('0x38')](_0x381720[_0x9e5e('0x34')],_0x381720[_0x9e5e('0x35')]);_0x31f384['attributes']=_[_0x9e5e('0x38')](_0x381720['model'],qs[_0x9e5e('0x3a')](_0x59bb2a[_0x9e5e('0x35')][_0x9e5e('0x3a')]));_0x31f384['attributes']=_0x31f384[_0x9e5e('0x39')][_0x9e5e('0x48')]?_0x31f384[_0x9e5e('0x39')]:_0x381720['model'];if(_0x59bb2a[_0x9e5e('0x35')][_0x9e5e('0x43')]){_0x31f384['include']=[{'all':!![]}];}_0x31f384=_[_0x9e5e('0x41')]({},_0x31f384,_0x59bb2a[_0x9e5e('0x42')]);return db[_0x9e5e('0x2f')][_0x9e5e('0x49')](_0x31f384)[_0x9e5e('0x28')](handleEntityNotFound(_0xb21dc5,null))['then'](respondWithResult(_0xb21dc5,null))[_0x9e5e('0x46')](handleError(_0xb21dc5,null));};exports['create']=function(_0x19c6dc,_0xc891c7){return db[_0x9e5e('0x2f')][_0x9e5e('0x4a')](_0x19c6dc[_0x9e5e('0x4b')],{})['then'](respondWithResult(_0xc891c7,0xc9))[_0x9e5e('0x46')](handleError(_0xc891c7,null));};exports['update']=function(_0x1ac3ad,_0x8ffa9a){if(_0x1ac3ad[_0x9e5e('0x4b')]['id']){delete _0x1ac3ad[_0x9e5e('0x4b')]['id'];}return db['Dynamics365Field'][_0x9e5e('0x49')]({'where':{'id':_0x1ac3ad[_0x9e5e('0x47')]['id']}})[_0x9e5e('0x28')](handleEntityNotFound(_0x8ffa9a,null))[_0x9e5e('0x28')](saveUpdates(_0x1ac3ad[_0x9e5e('0x4b')],null))[_0x9e5e('0x28')](respondWithResult(_0x8ffa9a,null))[_0x9e5e('0x46')](handleError(_0x8ffa9a,null));};exports[_0x9e5e('0x29')]=function(_0x11cd21,_0x1d6afa){return db[_0x9e5e('0x2f')][_0x9e5e('0x49')]({'where':{'id':_0x11cd21['params']['id']}})[_0x9e5e('0x28')](handleEntityNotFound(_0x1d6afa,null))[_0x9e5e('0x28')](removeEntity(_0x1d6afa,null))[_0x9e5e('0x46')](handleError(_0x1d6afa,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 970938d..c6c828e 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 _0xba85=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','util','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xba85,0x18c));var _0x5ba8=function(_0x3f4039,_0x4d3d02){_0x3f4039=_0x3f4039-0x0;var _0x4b9cb4=_0xba85[_0x3f4039];return _0x4b9cb4;};'use strict';var _=require('lodash');var util=require(_0x5ba8('0x0'));var logger=require('../../config/logger')(_0x5ba8('0x1'));var moment=require(_0x5ba8('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ba8('0x3'));var fs=require('fs');var path=require(_0x5ba8('0x4'));var rimraf=require('rimraf');var config=require(_0x5ba8('0x5'));var attributes=require(_0x5ba8('0x6'));module[_0x5ba8('0x7')]=function(_0xf07979,_0x597f1a){return _0xf07979[_0x5ba8('0x8')](_0x5ba8('0x9'),attributes,{'tableName':_0x5ba8('0xa'),'paranoid':![],'indexes':[{'name':_0x5ba8('0xb'),'fields':[_0x5ba8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d63=['request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cfa93,_0x105f7a){var _0x3f707e=function(_0x47700e){while(--_0x47700e){_0x4cfa93['push'](_0x4cfa93['shift']());}};_0x3f707e(++_0x105f7a);}(_0x7d63,0x1da));var _0x37d6=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0x7d63[_0x32a767];return _0x2b4e6d;};'use strict';var _=require(_0x37d6('0x0'));var util=require(_0x37d6('0x1'));var logger=require(_0x37d6('0x2'))(_0x37d6('0x3'));var moment=require(_0x37d6('0x4'));var BPromise=require(_0x37d6('0x5'));var rp=require(_0x37d6('0x6'));var fs=require('fs');var path=require(_0x37d6('0x7'));var rimraf=require('rimraf');var config=require(_0x37d6('0x8'));var attributes=require(_0x37d6('0x9'));module[_0x37d6('0xa')]=function(_0x53c565,_0x1209b0){return _0x53c565['define'](_0x37d6('0xb'),attributes,{'tableName':_0x37d6('0xc'),'paranoid':![],'indexes':[{'name':_0x37d6('0xd'),'fields':['idField',_0x37d6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2d21558..4d15b54 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 _0x2186=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x468bf8,_0x60fddf){var _0xb54fb6=function(_0x10e2c3){while(--_0x10e2c3){_0x468bf8['push'](_0x468bf8['shift']());}};_0xb54fb6(++_0x60fddf);}(_0x2186,0x184));var _0x6218=function(_0x46e6fb,_0x3bc554){_0x46e6fb=_0x46e6fb-0x0;var _0x4c2a0b=_0x2186[_0x46e6fb];return _0x4c2a0b;};'use strict';var _=require('lodash');var util=require(_0x6218('0x0'));var moment=require(_0x6218('0x1'));var BPromise=require('bluebird');var rs=require(_0x6218('0x2'));var fs=require('fs');var Redis=require(_0x6218('0x3'));var db=require(_0x6218('0x4'))['db'];var utils=require(_0x6218('0x5'));var logger=require(_0x6218('0x6'))(_0x6218('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6218('0x8')][_0x6218('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ad411,_0xf11167,_0x1f9f07){return new BPromise(function(_0x3390c0,_0xb1e880){return client[_0x6218('0xa')](_0x1ad411,_0x1f9f07)[_0x6218('0xb')](function(_0x59de7e){logger[_0x6218('0xc')](_0x6218('0xd'),_0xf11167,'request\x20sent');logger[_0x6218('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xf11167,_0x6218('0xf'),JSON[_0x6218('0x10')](_0x59de7e));if(_0x59de7e[_0x6218('0x11')]){if(_0x59de7e[_0x6218('0x11')][_0x6218('0x12')]===0x1f4){logger[_0x6218('0x11')](_0x6218('0xd'),_0xf11167,_0x59de7e[_0x6218('0x11')]['message']);return _0xb1e880(_0x59de7e[_0x6218('0x11')]['message']);}logger[_0x6218('0x11')](_0x6218('0xd'),_0xf11167,_0x59de7e[_0x6218('0x11')]['message']);return _0x3390c0(_0x59de7e[_0x6218('0x11')][_0x6218('0x13')]);}else{logger[_0x6218('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0xf11167,_0x6218('0xf'));_0x3390c0(_0x59de7e[_0x6218('0x14')][_0x6218('0x13')]);}})[_0x6218('0x15')](function(_0x2ad257){logger['error'](_0x6218('0xd'),_0xf11167,_0x2ad257);_0xb1e880(_0x2ad257);});});} \ No newline at end of file +var _0x87bb=['../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x87bb,0x1c8));var _0xb87b=function(_0x3e2ce6,_0x1e055c){_0x3e2ce6=_0x3e2ce6-0x0;var _0x4ccc1b=_0x87bb[_0x3e2ce6];return _0x4ccc1b;};'use strict';var _=require('lodash');var util=require(_0xb87b('0x0'));var moment=require(_0xb87b('0x1'));var BPromise=require(_0xb87b('0x2'));var rs=require(_0xb87b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb87b('0x4'));var logger=require(_0xb87b('0x5'))('rpc');var config=require(_0xb87b('0x6'));var jayson=require(_0xb87b('0x7'));var client=jayson[_0xb87b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e6f1,_0x38fed0,_0x150476){return new BPromise(function(_0x2b4a9f,_0x30404f){return client[_0xb87b('0x9')](_0x13e6f1,_0x150476)[_0xb87b('0xa')](function(_0x3dc7fd){logger[_0xb87b('0xb')](_0xb87b('0xc'),_0x38fed0,'request\x20sent');logger[_0xb87b('0xd')](_0xb87b('0xe'),_0x38fed0,_0xb87b('0xf'),JSON[_0xb87b('0x10')](_0x3dc7fd));if(_0x3dc7fd['error']){if(_0x3dc7fd[_0xb87b('0x11')][_0xb87b('0x12')]===0x1f4){logger['error'](_0xb87b('0xc'),_0x38fed0,_0x3dc7fd[_0xb87b('0x11')][_0xb87b('0x13')]);return _0x30404f(_0x3dc7fd[_0xb87b('0x11')][_0xb87b('0x13')]);}logger[_0xb87b('0x11')](_0xb87b('0xc'),_0x38fed0,_0x3dc7fd['error'][_0xb87b('0x13')]);return _0x2b4a9f(_0x3dc7fd[_0xb87b('0x11')]['message']);}else{logger[_0xb87b('0xb')](_0xb87b('0xc'),_0x38fed0,_0xb87b('0xf'));_0x2b4a9f(_0x3dc7fd[_0xb87b('0x14')][_0xb87b('0x13')]);}})[_0xb87b('0x15')](function(_0xcaccca){logger['error'](_0xb87b('0xc'),_0x38fed0,_0xcaccca);_0x30404f(_0xcaccca);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2fce934..41220ad 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 _0x8157=['getConfigurations','/:id/fields','create','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations'];(function(_0x30e8a1,_0x55fa82){var _0x37c6f1=function(_0x377105){while(--_0x377105){_0x30e8a1['push'](_0x30e8a1['shift']());}};_0x37c6f1(++_0x55fa82);}(_0x8157,0x1d7));var _0x7815=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x8157[_0x3b19ea];return _0x40ece9;};'use strict';var multer=require(_0x7815('0x0'));var util=require(_0x7815('0x1'));var path=require(_0x7815('0x2'));var timeout=require(_0x7815('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7815('0x4'));var interaction=require(_0x7815('0x5'));var config=require(_0x7815('0x6'));var controller=require(_0x7815('0x7'));router[_0x7815('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x7815('0x9')](),controller[_0x7815('0xa')]);router['get'](_0x7815('0xb'),auth[_0x7815('0x9')](),controller[_0x7815('0xc')]);router[_0x7815('0x8')](_0x7815('0xd'),auth[_0x7815('0x9')](),controller['getFields']);router['post']('/',auth[_0x7815('0x9')](),controller[_0x7815('0xe')]);router[_0x7815('0xf')](_0x7815('0xb'),auth['isAuthenticated'](),controller[_0x7815('0x10')]);router[_0x7815('0x11')](_0x7815('0x12'),auth[_0x7815('0x9')](),controller[_0x7815('0x13')]);router[_0x7815('0x14')]('/:id',auth[_0x7815('0x9')](),controller[_0x7815('0x15')]);module[_0x7815('0x16')]=router; \ No newline at end of file +var _0xfd36=['put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x1e579f,_0x5e40cb){var _0x5caf1c=function(_0x555d1d){while(--_0x555d1d){_0x1e579f['push'](_0x1e579f['shift']());}};_0x5caf1c(++_0x5e40cb);}(_0xfd36,0x117));var _0x6fd3=function(_0x563ba6,_0x5173e4){_0x563ba6=_0x563ba6-0x0;var _0x2b9e70=_0xfd36[_0x563ba6];return _0x2b9e70;};'use strict';var multer=require(_0x6fd3('0x0'));var util=require(_0x6fd3('0x1'));var path=require(_0x6fd3('0x2'));var timeout=require(_0x6fd3('0x3'));var express=require(_0x6fd3('0x4'));var router=express['Router']();var fs_extra=require(_0x6fd3('0x5'));var auth=require(_0x6fd3('0x6'));var interaction=require(_0x6fd3('0x7'));var config=require(_0x6fd3('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x6fd3('0x9')]('/',auth[_0x6fd3('0xa')](),controller[_0x6fd3('0xb')]);router[_0x6fd3('0x9')](_0x6fd3('0xc'),auth[_0x6fd3('0xa')](),controller['show']);router['get'](_0x6fd3('0xd'),auth['isAuthenticated'](),controller[_0x6fd3('0xe')]);router[_0x6fd3('0x9')](_0x6fd3('0xf'),auth[_0x6fd3('0xa')](),controller[_0x6fd3('0x10')]);router[_0x6fd3('0x11')]('/',auth[_0x6fd3('0xa')](),controller[_0x6fd3('0x12')]);router[_0x6fd3('0x11')](_0x6fd3('0xd'),auth[_0x6fd3('0xa')](),controller[_0x6fd3('0x13')]);router[_0x6fd3('0x14')](_0x6fd3('0xc'),auth[_0x6fd3('0xa')](),controller['update']);router[_0x6fd3('0x15')](_0x6fd3('0xc'),auth[_0x6fd3('0xa')](),controller[_0x6fd3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 973446e..6bf23e3 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 _0xb016=['remoteUri','sequelize','exports','STRING'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0xb016,0x159));var _0x6b01=function(_0x54c0d2,_0x508f9b){_0x54c0d2=_0x54c0d2-0x0;var _0x1c0891=_0xb016[_0x54c0d2];return _0x1c0891;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'serverUrl':{'type':Sequelize[_0x6b01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0xaece68,_0x2d3fa0){var _0x56bc89=function(_0x32efad){while(--_0x32efad){_0xaece68['push'](_0xaece68['shift']());}};_0x56bc89(++_0x2d3fa0);}(_0x8603,0x190));var _0x3860=function(_0x4b8609,_0x45bfdc){_0x4b8609=_0x4b8609-0x0;var _0x1f2269=_0x8603[_0x4b8609];return _0x1f2269;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e9679cd..9d9d530 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 _0x6594=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','FreshdeskAccount','rawAttributes','options','find','create','body','update','params','findOne','FreshdeskConfiguration','length','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','Basic\x20%s','format','%s:X','requester','subject','ticket_type','group','company','remove','includes','default','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6594,0xcb));var _0x4659=function(_0x239a99,_0x2eea66){_0x239a99=_0x239a99-0x0;var _0x5e65dc=_0x6594[_0x239a99];return _0x5e65dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4659('0x0'));var moment=require(_0x4659('0x1'));var BPromise=require(_0x4659('0x2'));var Mustache=require(_0x4659('0x3'));var util=require(_0x4659('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4659('0x5'));var ejs=require(_0x4659('0x6'));var fs=require('fs');var fs_extra=require(_0x4659('0x7'));var _=require(_0x4659('0x8'));var squel=require('squel');var crypto=require(_0x4659('0x9'));var jsforce=require(_0x4659('0xa'));var deskjs=require(_0x4659('0xb'));var toCsv=require(_0x4659('0x5'));var querystring=require(_0x4659('0xc'));var Papa=require(_0x4659('0xd'));var Redis=require('ioredis');var authService=require(_0x4659('0xe'));var qs=require(_0x4659('0xf'));var as=require(_0x4659('0x10'));var hardwareService=require(_0x4659('0x11'));var logger=require(_0x4659('0x12'))(_0x4659('0x13'));var utils=require(_0x4659('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4659('0x15'))['db'];var integrations=require(_0x4659('0x16'));function respondWithStatusCode(_0x1f89cf,_0x5389a0){_0x5389a0=_0x5389a0||0xcc;return function(_0x40f043){if(_0x40f043){return _0x1f89cf[_0x4659('0x17')](_0x5389a0);}return _0x1f89cf['status'](_0x5389a0)['end']();};}function respondWithResult(_0x1a9e9c,_0x4c3c05){_0x4c3c05=_0x4c3c05||0xc8;return function(_0x39d8ba){if(_0x39d8ba){return _0x1a9e9c[_0x4659('0x18')](_0x4c3c05)[_0x4659('0x19')](_0x39d8ba);}};}function respondWithFilteredResult(_0x5c099c,_0x3d9a17){return function(_0x429b72){if(_0x429b72){var _0x1d78a5=typeof _0x3d9a17[_0x4659('0x1a')]==='undefined'&&typeof _0x3d9a17[_0x4659('0x1b')]===_0x4659('0x1c');var _0x73f3f5=_0x429b72[_0x4659('0x1d')];var _0x4c8820=_0x1d78a5?0x0:_0x3d9a17[_0x4659('0x1a')];var _0x3049ba=_0x1d78a5?_0x429b72['count']:_0x3d9a17[_0x4659('0x1a')]+_0x3d9a17[_0x4659('0x1b')];var _0x6b8d07;if(_0x3049ba>=_0x73f3f5){_0x3049ba=_0x73f3f5;_0x6b8d07=0xc8;}else{_0x6b8d07=0xce;}_0x5c099c[_0x4659('0x18')](_0x6b8d07);return _0x5c099c['set']('Content-Range',_0x4c8820+'-'+_0x3049ba+'/'+_0x73f3f5)[_0x4659('0x19')](_0x429b72);}return null;};}function patchUpdates(_0x157f1a){return function(_0x1fce1d){try{jsonpatch[_0x4659('0x1e')](_0x1fce1d,_0x157f1a,!![]);}catch(_0x288cdf){return BPromise[_0x4659('0x1f')](_0x288cdf);}return _0x1fce1d[_0x4659('0x20')]();};}function saveUpdates(_0x2e773b,_0x1a016e){return function(_0x494631){if(_0x494631){return _0x494631['update'](_0x2e773b)[_0x4659('0x21')](function(_0x4c40b3){return _0x4c40b3;});}return null;};}function removeEntity(_0x1e9c93,_0x47c73d){return function(_0x1715ba){if(_0x1715ba){return _0x1715ba[_0x4659('0x22')]()[_0x4659('0x21')](function(){_0x1e9c93[_0x4659('0x18')](0xcc)[_0x4659('0x23')]();});}};}function handleEntityNotFound(_0x1fe661,_0x2b4ad8){return function(_0x1d1cba){if(!_0x1d1cba){_0x1fe661[_0x4659('0x17')](0x194);}return _0x1d1cba;};}function handleError(_0x507598,_0x428dd5){_0x428dd5=_0x428dd5||0x1f4;return function(_0x1bd579){logger[_0x4659('0x24')](_0x1bd579[_0x4659('0x25')]);if(_0x1bd579[_0x4659('0x26')]){delete _0x1bd579[_0x4659('0x26')];}_0x507598[_0x4659('0x18')](_0x428dd5)[_0x4659('0x27')](_0x1bd579);};}exports[_0x4659('0x28')]=function(_0x479a2e,_0x5d0c89){var _0xde3c49={},_0x26d67f={},_0x5c5a31={'count':0x0,'rows':[]};var _0x507fc1=_[_0x4659('0x29')](db['FreshdeskAccount']['rawAttributes'],function(_0x34d817){return{'name':_0x34d817[_0x4659('0x2a')],'type':_0x34d817['type'][_0x4659('0x2b')]};});_0x26d67f[_0x4659('0x2c')]=_[_0x4659('0x29')](_0x507fc1,_0x4659('0x26'));_0x26d67f[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x479a2e[_0x4659('0x2d')]);_0x26d67f['filters']=_[_0x4659('0x2f')](_0x26d67f[_0x4659('0x2c')],_0x26d67f[_0x4659('0x2d')]);_0xde3c49[_0x4659('0x30')]=_['intersection'](_0x26d67f[_0x4659('0x2c')],qs[_0x4659('0x31')](_0x479a2e[_0x4659('0x2d')][_0x4659('0x31')]));_0xde3c49[_0x4659('0x30')]=_0xde3c49[_0x4659('0x30')]['length']?_0xde3c49['attributes']:_0x26d67f['model'];if(!_0x479a2e[_0x4659('0x2d')][_0x4659('0x32')]('nolimit')){_0xde3c49[_0x4659('0x1b')]=qs[_0x4659('0x1b')](_0x479a2e['query'][_0x4659('0x1b')]);_0xde3c49[_0x4659('0x1a')]=qs['offset'](_0x479a2e['query'][_0x4659('0x1a')]);}_0xde3c49[_0x4659('0x33')]=qs[_0x4659('0x34')](_0x479a2e[_0x4659('0x2d')][_0x4659('0x34')]);_0xde3c49[_0x4659('0x35')]=qs[_0x4659('0x36')](_[_0x4659('0x37')](_0x479a2e[_0x4659('0x2d')],_0x26d67f['filters']),_0x507fc1);if(_0x479a2e[_0x4659('0x2d')][_0x4659('0x38')]){_0xde3c49['where']=_['merge'](_0xde3c49['where'],{'$or':_['map'](_0x507fc1,function(_0xb4a62d){if(_0xb4a62d[_0x4659('0x39')]!==_0x4659('0x3a')){var _0x5406ae={};_0x5406ae[_0xb4a62d[_0x4659('0x26')]]={'$like':'%'+_0x479a2e[_0x4659('0x2d')]['filter']+'%'};return _0x5406ae;}})});}_0xde3c49=_[_0x4659('0x3b')]({},_0xde3c49,_0x479a2e['options']);var _0x1f5298={'where':_0xde3c49[_0x4659('0x35')]};return db['FreshdeskAccount']['count'](_0x1f5298)[_0x4659('0x21')](function(_0x391879){_0x5c5a31[_0x4659('0x1d')]=_0x391879;if(_0x479a2e['query'][_0x4659('0x3c')]){_0xde3c49[_0x4659('0x3d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x4659('0x3e')](_0xde3c49);})[_0x4659('0x21')](function(_0xd78633){_0x5c5a31[_0x4659('0x3f')]=_0xd78633;return _0x5c5a31;})[_0x4659('0x21')](respondWithFilteredResult(_0x5d0c89,_0xde3c49))[_0x4659('0x40')](handleError(_0x5d0c89,null));};exports['show']=function(_0x11e413,_0x22e2bb){var _0xd38f94={'raw':![],'where':{'id':_0x11e413['params']['id']}},_0x9f120a={};_0x9f120a['model']=_[_0x4659('0x2e')](db[_0x4659('0x41')][_0x4659('0x42')]);_0x9f120a[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x11e413[_0x4659('0x2d')]);_0x9f120a[_0x4659('0x36')]=_['intersection'](_0x9f120a[_0x4659('0x2c')],_0x9f120a[_0x4659('0x2d')]);_0xd38f94[_0x4659('0x30')]=_[_0x4659('0x2f')](_0x9f120a['model'],qs[_0x4659('0x31')](_0x11e413['query']['fields']));_0xd38f94['attributes']=_0xd38f94['attributes']['length']?_0xd38f94[_0x4659('0x30')]:_0x9f120a[_0x4659('0x2c')];if(_0x11e413[_0x4659('0x2d')][_0x4659('0x3c')]){_0xd38f94[_0x4659('0x3d')]=[{'all':!![]}];}_0xd38f94=_['merge']({},_0xd38f94,_0x11e413[_0x4659('0x43')]);return db[_0x4659('0x41')][_0x4659('0x44')](_0xd38f94)[_0x4659('0x21')](handleEntityNotFound(_0x22e2bb,null))['then'](respondWithResult(_0x22e2bb,null))[_0x4659('0x40')](handleError(_0x22e2bb,null));};exports[_0x4659('0x45')]=function(_0x374df3,_0x1d3876){return db[_0x4659('0x41')]['create'](_0x374df3[_0x4659('0x46')],{})[_0x4659('0x21')](respondWithResult(_0x1d3876,0xc9))['catch'](handleError(_0x1d3876,null));};exports[_0x4659('0x47')]=function(_0x51e4ad,_0x452154){if(_0x51e4ad['body']['id']){delete _0x51e4ad[_0x4659('0x46')]['id'];}return db['FreshdeskAccount'][_0x4659('0x44')]({'where':{'id':_0x51e4ad[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x452154,null))[_0x4659('0x21')](saveUpdates(_0x51e4ad[_0x4659('0x46')],null))[_0x4659('0x21')](respondWithResult(_0x452154,null))[_0x4659('0x40')](handleError(_0x452154,null));};exports[_0x4659('0x22')]=function(_0x722dea,_0x4a39a2){return db[_0x4659('0x41')][_0x4659('0x44')]({'where':{'id':_0x722dea[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x4a39a2,null))['then'](removeEntity(_0x4a39a2,null))[_0x4659('0x40')](handleError(_0x4a39a2,null));};exports['getConfigurations']=function(_0x1d8b61,_0x105369,_0x3dbb46){var _0x42bd7e={};var _0x4f62ac={};var _0xc62155;var _0x225f98;return db[_0x4659('0x41')][_0x4659('0x49')]({'where':{'id':_0x1d8b61['params']['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x105369,null))[_0x4659('0x21')](function(_0x9df1b2){if(_0x9df1b2){_0xc62155=_0x9df1b2;_0x4f62ac[_0x4659('0x2c')]=_[_0x4659('0x2e')](db[_0x4659('0x4a')][_0x4659('0x42')]);_0x4f62ac[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x1d8b61[_0x4659('0x2d')]);_0x4f62ac[_0x4659('0x36')]=_[_0x4659('0x2f')](_0x4f62ac[_0x4659('0x2c')],_0x4f62ac[_0x4659('0x2d')]);_0x42bd7e['attributes']=_[_0x4659('0x2f')](_0x4f62ac[_0x4659('0x2c')],qs['fields'](_0x1d8b61[_0x4659('0x2d')][_0x4659('0x31')]));_0x42bd7e[_0x4659('0x30')]=_0x42bd7e[_0x4659('0x30')][_0x4659('0x4b')]?_0x42bd7e[_0x4659('0x30')]:_0x4f62ac[_0x4659('0x2c')];_0x42bd7e['order']=qs[_0x4659('0x34')](_0x1d8b61[_0x4659('0x2d')][_0x4659('0x34')]);_0x42bd7e[_0x4659('0x35')]=qs[_0x4659('0x36')](_[_0x4659('0x37')](_0x1d8b61[_0x4659('0x2d')],_0x4f62ac['filters']));if(_0x1d8b61[_0x4659('0x2d')][_0x4659('0x38')]){_0x42bd7e['where']=_[_0x4659('0x3b')](_0x42bd7e[_0x4659('0x35')],{'$or':_[_0x4659('0x29')](_0x42bd7e['attributes'],function(_0x36d2cc){var _0x20f7ec={};_0x20f7ec[_0x36d2cc]={'$like':'%'+_0x1d8b61['query'][_0x4659('0x38')]+'%'};return _0x20f7ec;})});}_0x42bd7e=_['merge']({},_0x42bd7e,_0x1d8b61[_0x4659('0x43')]);return _0xc62155[_0x4659('0x4c')](_0x42bd7e);}})[_0x4659('0x21')](function(_0x517921){if(_0x517921){_0x225f98=_0x517921['length'];if(!_0x1d8b61[_0x4659('0x2d')]['hasOwnProperty'](_0x4659('0x4d'))){_0x42bd7e[_0x4659('0x1b')]=qs[_0x4659('0x1b')](_0x1d8b61['query']['limit']);_0x42bd7e[_0x4659('0x1a')]=qs[_0x4659('0x1a')](_0x1d8b61[_0x4659('0x2d')]['offset']);}return _0xc62155['getConfigurations'](_0x42bd7e);}})[_0x4659('0x21')](function(_0x41785f){if(_0x41785f){return _0x41785f?{'count':_0x225f98,'rows':_0x41785f}:null;}})[_0x4659('0x21')](respondWithResult(_0x105369,null))[_0x4659('0x40')](handleError(_0x105369,null));};exports[_0x4659('0x4e')]=function(_0x2746dc,_0x1b874d,_0x4dd4a8){if(_0x2746dc[_0x4659('0x46')]['id']){delete _0x2746dc['body']['id'];}return db[_0x4659('0x41')]['findOne']({'where':{'id':_0x2746dc[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x1b874d,null))[_0x4659('0x21')](function(_0x57343a){if(_0x57343a){_0x2746dc['body'][_0x4659('0x4f')]=_0x57343a['id'];_0x2746dc[_0x4659('0x46')][_0x4659('0x50')]=integrations[_0x4659('0x51')](_0x2746dc[_0x4659('0x46')][_0x4659('0x52')],_0x2746dc[_0x4659('0x46')][_0x4659('0x39')]);_0x2746dc[_0x4659('0x46')][_0x4659('0x53')]=integrations[_0x4659('0x54')](_0x2746dc[_0x4659('0x46')]['channel'],_0x2746dc[_0x4659('0x46')]['type']);return db[_0x4659('0x4a')][_0x4659('0x45')](_0x2746dc['body'],{'include':[{'model':db[_0x4659('0x55')],'as':_0x4659('0x50')},{'model':db[_0x4659('0x55')],'as':'Descriptions'}]});}return null;})[_0x4659('0x21')](respondWithResult(_0x1b874d,null))[_0x4659('0x40')](handleError(_0x1b874d,null));};exports[_0x4659('0x56')]=function(_0x5e840f,_0x28bb1b,_0x4825a4){var _0x332658='';return db[_0x4659('0x41')]['findOne']({'where':{'id':_0x5e840f[_0x4659('0x48')]['id']},'attributes':['id',_0x4659('0x57'),_0x4659('0x58')]})[_0x4659('0x21')](handleEntityNotFound(_0x28bb1b,null))[_0x4659('0x21')](function(_0x482dc9){if(_0x482dc9){_0x332658=_0x482dc9[_0x4659('0x57')];var _0x249eb1=_0x332658[_0x4659('0x59')](-0x1);if(_0x249eb1==='/'){_0x332658=_0x332658[_0x4659('0x5a')](0x0,_0x332658[_0x4659('0x5b')](_0x249eb1));}return rp({'method':_0x4659('0x5c'),'uri':util['format']('%s/%s',_0x332658,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x4659('0x5d'),new Buffer(util[_0x4659('0x5e')](_0x4659('0x5f'),_0x482dc9['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x4659('0x21')](function(_0x2cef6b){if(_0x2cef6b){var _0x15d709=[_0x4659('0x60'),_0x4659('0x61'),'agent','description','status','priority','group','source',_0x4659('0x62'),_0x4659('0x63'),_0x4659('0x64')];_[_0x4659('0x65')](_0x2cef6b,function(_0x35ce47){return _0x15d709[_0x4659('0x66')](_0x35ce47['name'])||!_0x35ce47[_0x4659('0x67')]&&_0x35ce47[_0x4659('0x39')]!=='custom_text'&&_0x35ce47[_0x4659('0x39')]!==_0x4659('0x68');});return{'count':_0x2cef6b['length'],'rows':_[_0x4659('0x29')](_0x2cef6b,function(_0x56d500){return{'id':_0x56d500[_0x4659('0x26')],'name':_0x56d500['label'],'custom':!_0x56d500[_0x4659('0x67')],'options':_0x56d500[_0x4659('0x69')]?_[_0x4659('0x29')](_0x56d500[_0x4659('0x69')],function(_0x59d3be){return{'name':_['capitalize'](_0x59d3be),'value':_0x59d3be};}):[]};})};}})[_0x4659('0x21')](respondWithResult(_0x28bb1b,null))[_0x4659('0x40')](function(_0x320028){var _0x95642f=_0x5e840f[_0x4659('0x2d')][_0x4659('0x6a')]?0x1f4:_0x320028[_0x4659('0x6b')]||0x1f4;logger[_0x4659('0x24')](_0x4659('0x6c'),'getFields',_0x95642f,JSON[_0x4659('0x6d')](_0x320028));delete _0x320028[_0x4659('0x26')];if(_0x95642f===0x191){_0x95642f=0x190;}_0x28bb1b['status'](_0x95642f)[_0x4659('0x27')](_0x5e840f[_0x4659('0x2d')][_0x4659('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x320028[_0x4659('0x6b')]}:_0x320028);});}; \ No newline at end of file +var _0x8164=['substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','error','stringify','test','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','destroy','getConfigurations','FreshdeskConfiguration','order','sort','pick','addConfiguration','findOne','AccountId','Subjects','getDescriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice'];(function(_0x2d2d62,_0x10b23f){var _0xb7d7d6=function(_0x2fb215){while(--_0x2fb215){_0x2d2d62['push'](_0x2d2d62['shift']());}};_0xb7d7d6(++_0x10b23f);}(_0x8164,0x170));var _0x4816=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x8164[_0x7185f7];return _0x182e45;};'use strict';var emlformat=require(_0x4816('0x0'));var rimraf=require(_0x4816('0x1'));var zipdir=require(_0x4816('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4816('0x3'));var moment=require(_0x4816('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4816('0x5'));var util=require('util');var path=require(_0x4816('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4816('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4816('0x8'));var crypto=require(_0x4816('0x9'));var jsforce=require(_0x4816('0xa'));var deskjs=require(_0x4816('0xb'));var toCsv=require(_0x4816('0xc'));var querystring=require(_0x4816('0xd'));var Papa=require(_0x4816('0xe'));var Redis=require(_0x4816('0xf'));var authService=require(_0x4816('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4816('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4816('0x12'))(_0x4816('0x13'));var utils=require('../../config/utils');var config=require(_0x4816('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4816('0x15'));function respondWithStatusCode(_0x51a5f8,_0x5c4d42){_0x5c4d42=_0x5c4d42||0xcc;return function(_0x45a360){if(_0x45a360){return _0x51a5f8['sendStatus'](_0x5c4d42);}return _0x51a5f8[_0x4816('0x16')](_0x5c4d42)[_0x4816('0x17')]();};}function respondWithResult(_0x13a685,_0x316f36){_0x316f36=_0x316f36||0xc8;return function(_0x42fc52){if(_0x42fc52){return _0x13a685[_0x4816('0x16')](_0x316f36)[_0x4816('0x18')](_0x42fc52);}};}function respondWithFilteredResult(_0x2a58b7,_0x45c006){return function(_0x21354c){if(_0x21354c){var _0x1ce1fb=typeof _0x45c006[_0x4816('0x19')]===_0x4816('0x1a')&&typeof _0x45c006[_0x4816('0x1b')]===_0x4816('0x1a');var _0x5c446b=_0x21354c['count'];var _0x5b54d4=_0x1ce1fb?0x0:_0x45c006[_0x4816('0x19')];var _0x354fdd=_0x1ce1fb?_0x21354c[_0x4816('0x1c')]:_0x45c006[_0x4816('0x19')]+_0x45c006[_0x4816('0x1b')];var _0x37effd;if(_0x354fdd>=_0x5c446b){_0x354fdd=_0x5c446b;_0x37effd=0xc8;}else{_0x37effd=0xce;}_0x2a58b7[_0x4816('0x16')](_0x37effd);return _0x2a58b7[_0x4816('0x1d')](_0x4816('0x1e'),_0x5b54d4+'-'+_0x354fdd+'/'+_0x5c446b)['json'](_0x21354c);}return null;};}function patchUpdates(_0x1ab50d){return function(_0x583a99){try{jsonpatch['apply'](_0x583a99,_0x1ab50d,!![]);}catch(_0x233902){return BPromise[_0x4816('0x1f')](_0x233902);}return _0x583a99['save']();};}function saveUpdates(_0x2bbaf4,_0x576221){return function(_0x46eb06){if(_0x46eb06){return _0x46eb06[_0x4816('0x20')](_0x2bbaf4)['then'](function(_0x504851){return _0x504851;});}return null;};}function removeEntity(_0xe484b2,_0x2c8dc4){return function(_0x394ecd){if(_0x394ecd){return _0x394ecd['destroy']()[_0x4816('0x21')](function(){_0xe484b2[_0x4816('0x16')](0xcc)[_0x4816('0x17')]();});}};}function handleEntityNotFound(_0x3f07f1,_0x571a05){return function(_0x565651){if(!_0x565651){_0x3f07f1[_0x4816('0x22')](0x194);}return _0x565651;};}function handleError(_0x47701a,_0x590349){_0x590349=_0x590349||0x1f4;return function(_0x3c96ce){logger['error'](_0x3c96ce['stack']);if(_0x3c96ce[_0x4816('0x23')]){delete _0x3c96ce[_0x4816('0x23')];}_0x47701a[_0x4816('0x16')](_0x590349)['send'](_0x3c96ce);};}exports[_0x4816('0x24')]=function(_0x521259,_0x39ddbd){var _0x229086={},_0x49c337={},_0x8ca388={'count':0x0,'rows':[]};var _0x34ba85=_[_0x4816('0x25')](db[_0x4816('0x26')][_0x4816('0x27')],function(_0x332af7){return{'name':_0x332af7[_0x4816('0x28')],'type':_0x332af7[_0x4816('0x29')][_0x4816('0x2a')]};});_0x49c337['model']=_[_0x4816('0x25')](_0x34ba85,_0x4816('0x23'));_0x49c337['query']=_['keys'](_0x521259[_0x4816('0x2b')]);_0x49c337[_0x4816('0x2c')]=_[_0x4816('0x2d')](_0x49c337[_0x4816('0x2e')],_0x49c337[_0x4816('0x2b')]);_0x229086['attributes']=_['intersection'](_0x49c337['model'],qs[_0x4816('0x2f')](_0x521259[_0x4816('0x2b')][_0x4816('0x2f')]));_0x229086[_0x4816('0x30')]=_0x229086[_0x4816('0x30')][_0x4816('0x31')]?_0x229086['attributes']:_0x49c337[_0x4816('0x2e')];if(!_0x521259['query'][_0x4816('0x32')](_0x4816('0x33'))){_0x229086[_0x4816('0x1b')]=qs[_0x4816('0x1b')](_0x521259[_0x4816('0x2b')]['limit']);_0x229086[_0x4816('0x19')]=qs['offset'](_0x521259['query'][_0x4816('0x19')]);}_0x229086['order']=qs['sort'](_0x521259['query']['sort']);_0x229086[_0x4816('0x34')]=qs[_0x4816('0x2c')](_['pick'](_0x521259[_0x4816('0x2b')],_0x49c337[_0x4816('0x2c')]),_0x34ba85);if(_0x521259['query'][_0x4816('0x35')]){_0x229086[_0x4816('0x34')]=_[_0x4816('0x36')](_0x229086[_0x4816('0x34')],{'$or':_['map'](_0x34ba85,function(_0x30ed56){if(_0x30ed56[_0x4816('0x29')]!==_0x4816('0x37')){var _0x442a63={};_0x442a63[_0x30ed56[_0x4816('0x23')]]={'$like':'%'+_0x521259[_0x4816('0x2b')][_0x4816('0x35')]+'%'};return _0x442a63;}})});}_0x229086=_[_0x4816('0x36')]({},_0x229086,_0x521259[_0x4816('0x38')]);var _0x2d5752={'where':_0x229086[_0x4816('0x34')]};return db[_0x4816('0x26')][_0x4816('0x1c')](_0x2d5752)['then'](function(_0x3fa20c){_0x8ca388[_0x4816('0x1c')]=_0x3fa20c;if(_0x521259[_0x4816('0x2b')][_0x4816('0x39')]){_0x229086[_0x4816('0x3a')]=[{'all':!![]}];}return db[_0x4816('0x26')][_0x4816('0x3b')](_0x229086);})['then'](function(_0x39b205){_0x8ca388['rows']=_0x39b205;return _0x8ca388;})['then'](respondWithFilteredResult(_0x39ddbd,_0x229086))[_0x4816('0x3c')](handleError(_0x39ddbd,null));};exports[_0x4816('0x3d')]=function(_0x560170,_0x23d3a1){var _0x432bce={'raw':![],'where':{'id':_0x560170['params']['id']}},_0x476765={};_0x476765[_0x4816('0x2e')]=_[_0x4816('0x3e')](db[_0x4816('0x26')][_0x4816('0x27')]);_0x476765[_0x4816('0x2b')]=_[_0x4816('0x3e')](_0x560170['query']);_0x476765[_0x4816('0x2c')]=_['intersection'](_0x476765['model'],_0x476765['query']);_0x432bce[_0x4816('0x30')]=_[_0x4816('0x2d')](_0x476765[_0x4816('0x2e')],qs[_0x4816('0x2f')](_0x560170[_0x4816('0x2b')][_0x4816('0x2f')]));_0x432bce[_0x4816('0x30')]=_0x432bce[_0x4816('0x30')][_0x4816('0x31')]?_0x432bce[_0x4816('0x30')]:_0x476765['model'];if(_0x560170['query'][_0x4816('0x39')]){_0x432bce[_0x4816('0x3a')]=[{'all':!![]}];}_0x432bce=_[_0x4816('0x36')]({},_0x432bce,_0x560170[_0x4816('0x38')]);return db[_0x4816('0x26')][_0x4816('0x3f')](_0x432bce)[_0x4816('0x21')](handleEntityNotFound(_0x23d3a1,null))[_0x4816('0x21')](respondWithResult(_0x23d3a1,null))['catch'](handleError(_0x23d3a1,null));};exports[_0x4816('0x40')]=function(_0x1ea828,_0x31993a){return db['FreshdeskAccount']['create'](_0x1ea828[_0x4816('0x41')],{})[_0x4816('0x21')](respondWithResult(_0x31993a,0xc9))[_0x4816('0x3c')](handleError(_0x31993a,null));};exports['update']=function(_0x247adb,_0x41ce8f){if(_0x247adb[_0x4816('0x41')]['id']){delete _0x247adb[_0x4816('0x41')]['id'];}return db[_0x4816('0x26')][_0x4816('0x3f')]({'where':{'id':_0x247adb[_0x4816('0x42')]['id']}})['then'](handleEntityNotFound(_0x41ce8f,null))[_0x4816('0x21')](saveUpdates(_0x247adb[_0x4816('0x41')],null))[_0x4816('0x21')](respondWithResult(_0x41ce8f,null))[_0x4816('0x3c')](handleError(_0x41ce8f,null));};exports[_0x4816('0x43')]=function(_0x47112a,_0x309778){return db[_0x4816('0x26')][_0x4816('0x3f')]({'where':{'id':_0x47112a[_0x4816('0x42')]['id']}})[_0x4816('0x21')](handleEntityNotFound(_0x309778,null))[_0x4816('0x21')](removeEntity(_0x309778,null))[_0x4816('0x3c')](handleError(_0x309778,null));};exports[_0x4816('0x44')]=function(_0x2930f4,_0x433ac5,_0x306e86){var _0x11272b={};var _0x2e619f={};var _0x56321c;var _0x1702bf;return db[_0x4816('0x26')]['findOne']({'where':{'id':_0x2930f4[_0x4816('0x42')]['id']}})[_0x4816('0x21')](handleEntityNotFound(_0x433ac5,null))['then'](function(_0x3604e6){if(_0x3604e6){_0x56321c=_0x3604e6;_0x2e619f[_0x4816('0x2e')]=_[_0x4816('0x3e')](db[_0x4816('0x45')][_0x4816('0x27')]);_0x2e619f[_0x4816('0x2b')]=_[_0x4816('0x3e')](_0x2930f4[_0x4816('0x2b')]);_0x2e619f[_0x4816('0x2c')]=_[_0x4816('0x2d')](_0x2e619f['model'],_0x2e619f[_0x4816('0x2b')]);_0x11272b['attributes']=_[_0x4816('0x2d')](_0x2e619f[_0x4816('0x2e')],qs['fields'](_0x2930f4[_0x4816('0x2b')][_0x4816('0x2f')]));_0x11272b[_0x4816('0x30')]=_0x11272b[_0x4816('0x30')][_0x4816('0x31')]?_0x11272b['attributes']:_0x2e619f[_0x4816('0x2e')];_0x11272b[_0x4816('0x46')]=qs[_0x4816('0x47')](_0x2930f4[_0x4816('0x2b')][_0x4816('0x47')]);_0x11272b[_0x4816('0x34')]=qs['filters'](_[_0x4816('0x48')](_0x2930f4[_0x4816('0x2b')],_0x2e619f[_0x4816('0x2c')]));if(_0x2930f4['query'][_0x4816('0x35')]){_0x11272b[_0x4816('0x34')]=_[_0x4816('0x36')](_0x11272b['where'],{'$or':_[_0x4816('0x25')](_0x11272b[_0x4816('0x30')],function(_0xa67f45){var _0xfb9e4a={};_0xfb9e4a[_0xa67f45]={'$like':'%'+_0x2930f4['query'][_0x4816('0x35')]+'%'};return _0xfb9e4a;})});}_0x11272b=_[_0x4816('0x36')]({},_0x11272b,_0x2930f4[_0x4816('0x38')]);return _0x56321c['getConfigurations'](_0x11272b);}})['then'](function(_0x2a9d8b){if(_0x2a9d8b){_0x1702bf=_0x2a9d8b[_0x4816('0x31')];if(!_0x2930f4[_0x4816('0x2b')][_0x4816('0x32')](_0x4816('0x33'))){_0x11272b[_0x4816('0x1b')]=qs[_0x4816('0x1b')](_0x2930f4['query'][_0x4816('0x1b')]);_0x11272b[_0x4816('0x19')]=qs[_0x4816('0x19')](_0x2930f4['query'][_0x4816('0x19')]);}return _0x56321c[_0x4816('0x44')](_0x11272b);}})[_0x4816('0x21')](function(_0x2c2a8c){if(_0x2c2a8c){return _0x2c2a8c?{'count':_0x1702bf,'rows':_0x2c2a8c}:null;}})[_0x4816('0x21')](respondWithResult(_0x433ac5,null))[_0x4816('0x3c')](handleError(_0x433ac5,null));};exports[_0x4816('0x49')]=function(_0x52cf85,_0x171c2b,_0x11e6f9){if(_0x52cf85[_0x4816('0x41')]['id']){delete _0x52cf85['body']['id'];}return db[_0x4816('0x26')][_0x4816('0x4a')]({'where':{'id':_0x52cf85['params']['id']}})[_0x4816('0x21')](handleEntityNotFound(_0x171c2b,null))[_0x4816('0x21')](function(_0x211a2b){if(_0x211a2b){_0x52cf85[_0x4816('0x41')][_0x4816('0x4b')]=_0x211a2b['id'];_0x52cf85[_0x4816('0x41')][_0x4816('0x4c')]=integrations['getSubjects'](_0x52cf85[_0x4816('0x41')]['channel'],_0x52cf85['body']['type']);_0x52cf85['body']['Descriptions']=integrations[_0x4816('0x4d')](_0x52cf85[_0x4816('0x41')][_0x4816('0x4e')],_0x52cf85['body'][_0x4816('0x29')]);return db[_0x4816('0x45')][_0x4816('0x40')](_0x52cf85[_0x4816('0x41')],{'include':[{'model':db[_0x4816('0x4f')],'as':_0x4816('0x4c')},{'model':db[_0x4816('0x4f')],'as':'Descriptions'}]});}return null;})[_0x4816('0x21')](respondWithResult(_0x171c2b,null))['catch'](handleError(_0x171c2b,null));};exports[_0x4816('0x50')]=function(_0x2cbc59,_0x5277dc,_0x3002b7){var _0x9165c8='';return db[_0x4816('0x26')]['findOne']({'where':{'id':_0x2cbc59[_0x4816('0x42')]['id']},'attributes':['id',_0x4816('0x51'),_0x4816('0x52')]})['then'](handleEntityNotFound(_0x5277dc,null))[_0x4816('0x21')](function(_0x1540cf){if(_0x1540cf){_0x9165c8=_0x1540cf[_0x4816('0x51')];var _0x5742fa=_0x9165c8[_0x4816('0x53')](-0x1);if(_0x5742fa==='/'){_0x9165c8=_0x9165c8[_0x4816('0x54')](0x0,_0x9165c8[_0x4816('0x55')](_0x5742fa));}return rp({'method':_0x4816('0x56'),'uri':util[_0x4816('0x57')](_0x4816('0x58'),_0x9165c8,_0x4816('0x59')),'headers':{'Authorization':util['format'](_0x4816('0x5a'),new Buffer(util[_0x4816('0x57')](_0x4816('0x5b'),_0x1540cf[_0x4816('0x52')]))[_0x4816('0x5c')](_0x4816('0x5d')))},'json':!![]});}})[_0x4816('0x21')](function(_0x4abba0){if(_0x4abba0){var _0x1d41a3=[_0x4816('0x5e'),_0x4816('0x5f'),_0x4816('0x60'),'description',_0x4816('0x16'),_0x4816('0x61'),_0x4816('0x62'),_0x4816('0x63'),_0x4816('0x64'),_0x4816('0x62'),_0x4816('0x65')];_[_0x4816('0x66')](_0x4abba0,function(_0x28419c){return _0x1d41a3[_0x4816('0x67')](_0x28419c[_0x4816('0x23')])||!_0x28419c[_0x4816('0x68')]&&_0x28419c[_0x4816('0x29')]!=='custom_text'&&_0x28419c[_0x4816('0x29')]!==_0x4816('0x69');});return{'count':_0x4abba0[_0x4816('0x31')],'rows':_[_0x4816('0x25')](_0x4abba0,function(_0x21fe50){return{'id':_0x21fe50[_0x4816('0x23')],'name':_0x21fe50[_0x4816('0x6a')],'custom':!_0x21fe50[_0x4816('0x68')],'options':_0x21fe50[_0x4816('0x6b')]?_[_0x4816('0x25')](_0x21fe50[_0x4816('0x6b')],function(_0x2bf3aa){return{'name':_[_0x4816('0x6c')](_0x2bf3aa),'value':_0x2bf3aa};}):[]};})};}})['then'](respondWithResult(_0x5277dc,null))[_0x4816('0x3c')](function(_0x2dca54){var _0xad3f8e=_0x2cbc59['query']['test']?0x1f4:_0x2dca54[_0x4816('0x6d')]||0x1f4;logger[_0x4816('0x6e')]('getFields,\x20%s,\x20%s,\x20%s',_0x4816('0x50'),_0xad3f8e,JSON[_0x4816('0x6f')](_0x2dca54));delete _0x2dca54[_0x4816('0x23')];if(_0xad3f8e===0x191){_0xad3f8e=0x190;}_0x5277dc[_0x4816('0x16')](_0xad3f8e)['send'](_0x2cbc59[_0x4816('0x2b')][_0x4816('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2dca54[_0x4816('0x6d')]}:_0x2dca54);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5fd7aea..8c5b7e6 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 _0x334e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','exports'];(function(_0x37fa67,_0x16bdac){var _0x2952fc=function(_0x42c481){while(--_0x42c481){_0x37fa67['push'](_0x37fa67['shift']());}};_0x2952fc(++_0x16bdac);}(_0x334e,0x1cb));var _0xe334=function(_0x37b5d3,_0x5b10fd){_0x37b5d3=_0x37b5d3-0x0;var _0x51c3e5=_0x334e[_0x37b5d3];return _0x51c3e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe334('0x0'))(_0xe334('0x1'));var moment=require(_0xe334('0x2'));var BPromise=require(_0xe334('0x3'));var rp=require(_0xe334('0x4'));var fs=require('fs');var path=require(_0xe334('0x5'));var rimraf=require(_0xe334('0x6'));var config=require('../../config/environment');var attributes=require(_0xe334('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe334('0x8')]=function(_0x454ae4,_0x521237){return _0x454ae4['define']('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea8=['bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','int_freshdesk_accounts','lodash','util','api','moment'];(function(_0x2ee01a,_0x3d7312){var _0x361c32=function(_0x5d434f){while(--_0x5d434f){_0x2ee01a['push'](_0x2ee01a['shift']());}};_0x361c32(++_0x3d7312);}(_0x3ea8,0x74));var _0x83ea=function(_0x49419d,_0x178785){_0x49419d=_0x49419d-0x0;var _0x124964=_0x3ea8[_0x49419d];return _0x124964;};'use strict';var _=require(_0x83ea('0x0'));var util=require(_0x83ea('0x1'));var logger=require('../../config/logger')(_0x83ea('0x2'));var moment=require(_0x83ea('0x3'));var BPromise=require(_0x83ea('0x4'));var rp=require(_0x83ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83ea('0x6'));var config=require('../../config/environment');var attributes=require(_0x83ea('0x7'));var integrations=require(_0x83ea('0x8'));module['exports']=function(_0x5949c5,_0x42f7ea){return _0x5949c5['define']('FreshdeskAccount',attributes,{'tableName':_0x83ea('0x9'),'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 51ae79e..229ae5e 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 _0xbf39=['include','model','map','stringify','ShowFreshdeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xbf39,0xc5));var _0x9bf3=function(_0x45c0c1,_0x52e01e){_0x45c0c1=_0x45c0c1-0x0;var _0x207f7b=_0xbf39[_0x45c0c1];return _0x207f7b;};'use strict';var _=require('lodash');var util=require(_0x9bf3('0x0'));var moment=require(_0x9bf3('0x1'));var BPromise=require(_0x9bf3('0x2'));var rs=require(_0x9bf3('0x3'));var fs=require('fs');var Redis=require(_0x9bf3('0x4'));var db=require(_0x9bf3('0x5'))['db'];var utils=require(_0x9bf3('0x6'));var logger=require('../../config/logger')(_0x9bf3('0x7'));var config=require(_0x9bf3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9bf3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c1869,_0x462469,_0x481930){return new BPromise(function(_0x45e042,_0x154844){return client['request'](_0x2c1869,_0x481930)[_0x9bf3('0xa')](function(_0x449dc7){logger[_0x9bf3('0xb')](_0x9bf3('0xc'),_0x462469,'request\x20sent');logger[_0x9bf3('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x462469,_0x9bf3('0xe'),JSON['stringify'](_0x449dc7));if(_0x449dc7[_0x9bf3('0xf')]){if(_0x449dc7[_0x9bf3('0xf')][_0x9bf3('0x10')]===0x1f4){logger['error'](_0x9bf3('0xc'),_0x462469,_0x449dc7[_0x9bf3('0xf')]['message']);return _0x154844(_0x449dc7[_0x9bf3('0xf')]['message']);}logger[_0x9bf3('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x462469,_0x449dc7[_0x9bf3('0xf')][_0x9bf3('0x11')]);return _0x45e042(_0x449dc7[_0x9bf3('0xf')]['message']);}else{logger[_0x9bf3('0xb')](_0x9bf3('0xc'),_0x462469,_0x9bf3('0xe'));_0x45e042(_0x449dc7[_0x9bf3('0x12')][_0x9bf3('0x11')]);}})[_0x9bf3('0x13')](function(_0x18509b){logger[_0x9bf3('0xf')](_0x9bf3('0xc'),_0x462469,_0x18509b);_0x154844(_0x18509b);});});}exports[_0x9bf3('0x14')]=function(_0x2912d5){var _0x19ec90=this;return new Promise(function(_0x21f9e1,_0x297f9a){return db['FreshdeskAccount'][_0x9bf3('0x15')]({'raw':_0x2912d5[_0x9bf3('0x16')]?_0x2912d5['options'][_0x9bf3('0x17')]===undefined?!![]:![]:!![],'where':_0x2912d5[_0x9bf3('0x16')]?_0x2912d5[_0x9bf3('0x16')][_0x9bf3('0x18')]||null:null,'attributes':_0x2912d5[_0x9bf3('0x16')]?_0x2912d5[_0x9bf3('0x16')][_0x9bf3('0x19')]||null:null,'limit':_0x2912d5['options']?_0x2912d5['options'][_0x9bf3('0x1a')]||null:null,'include':_0x2912d5[_0x9bf3('0x16')]?_0x2912d5[_0x9bf3('0x16')][_0x9bf3('0x1b')]?_['map'](_0x2912d5['options']['include'],function(_0x507683){return{'model':db[_0x507683[_0x9bf3('0x1c')]],'as':_0x507683['as'],'attributes':_0x507683[_0x9bf3('0x19')],'include':_0x507683[_0x9bf3('0x1b')]?_[_0x9bf3('0x1d')](_0x507683[_0x9bf3('0x1b')],function(_0x54f098){return{'model':db[_0x54f098[_0x9bf3('0x1c')]],'as':_0x54f098['as'],'attributes':_0x54f098[_0x9bf3('0x19')],'include':_0x54f098[_0x9bf3('0x1b')]?_['map'](_0x54f098[_0x9bf3('0x1b')],function(_0x2baa10){return{'model':db[_0x2baa10[_0x9bf3('0x1c')]],'as':_0x2baa10['as'],'attributes':_0x2baa10[_0x9bf3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9bf3('0xa')](function(_0x2860b9){logger[_0x9bf3('0xb')](_0x9bf3('0x14'),_0x2912d5);logger[_0x9bf3('0xd')](_0x9bf3('0x14'),_0x2912d5,JSON[_0x9bf3('0x1e')](_0x2860b9));_0x21f9e1(_0x2860b9);})[_0x9bf3('0x13')](function(_0x5b8624){logger[_0x9bf3('0xf')](_0x9bf3('0x14'),_0x5b8624[_0x9bf3('0x11')],_0x2912d5);_0x297f9a(_0x19ec90[_0x9bf3('0xf')](0x1f4,_0x5b8624[_0x9bf3('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x5003b2){var _0x521c11=this;return new Promise(function(_0x4ef289,_0x10ce5b){return db['FreshdeskAccount']['find']({'raw':_0x5003b2[_0x9bf3('0x16')]?_0x5003b2[_0x9bf3('0x16')][_0x9bf3('0x17')]===undefined?!![]:![]:!![],'where':_0x5003b2[_0x9bf3('0x16')]?_0x5003b2['options'][_0x9bf3('0x18')]||null:null,'attributes':_0x5003b2[_0x9bf3('0x16')]?_0x5003b2['options']['attributes']||null:null,'include':_0x5003b2[_0x9bf3('0x16')]?_0x5003b2['options']['include']?_[_0x9bf3('0x1d')](_0x5003b2[_0x9bf3('0x16')]['include'],function(_0x50d5f9){return{'model':db[_0x50d5f9[_0x9bf3('0x1c')]],'as':_0x50d5f9['as'],'attributes':_0x50d5f9[_0x9bf3('0x19')],'include':_0x50d5f9[_0x9bf3('0x1b')]?_['map'](_0x50d5f9['include'],function(_0x372381){return{'model':db[_0x372381[_0x9bf3('0x1c')]],'as':_0x372381['as'],'attributes':_0x372381[_0x9bf3('0x19')],'include':_0x372381['include']?_[_0x9bf3('0x1d')](_0x372381[_0x9bf3('0x1b')],function(_0x29dbbb){return{'model':db[_0x29dbbb[_0x9bf3('0x1c')]],'as':_0x29dbbb['as'],'attributes':_0x29dbbb[_0x9bf3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9bf3('0xa')](function(_0x5a371e){logger[_0x9bf3('0xb')](_0x9bf3('0x1f'),_0x5003b2);logger[_0x9bf3('0xd')](_0x9bf3('0x1f'),_0x5003b2,JSON[_0x9bf3('0x1e')](_0x5a371e));_0x4ef289(_0x5a371e);})['catch'](function(_0x42c85f){logger[_0x9bf3('0xf')](_0x9bf3('0x1f'),_0x42c85f[_0x9bf3('0x11')],_0x5003b2);_0x10ce5b(_0x521c11[_0x9bf3('0xf')](0x1f4,_0x42c85f['message']));});});}; \ No newline at end of file +var _0xd6d9=['raw','where','attributes','include','map','model','info','stringify','ShowFreshdeskAccount','find','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options'];(function(_0x30ad27,_0x750e0f){var _0x42242a=function(_0x352f81){while(--_0x352f81){_0x30ad27['push'](_0x30ad27['shift']());}};_0x42242a(++_0x750e0f);}(_0xd6d9,0x16a));var _0x9d6d=function(_0x2e0938,_0x2e20f0){_0x2e0938=_0x2e0938-0x0;var _0x1691d3=_0xd6d9[_0x2e0938];return _0x1691d3;};'use strict';var _=require('lodash');var util=require(_0x9d6d('0x0'));var moment=require(_0x9d6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d6d('0x3'))['db'];var utils=require(_0x9d6d('0x4'));var logger=require(_0x9d6d('0x5'))(_0x9d6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d6d('0x7'));var client=jayson[_0x9d6d('0x8')][_0x9d6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2713fd,_0x498bdc,_0x4d271c){return new BPromise(function(_0x41e27a,_0x472196){return client[_0x9d6d('0xa')](_0x2713fd,_0x4d271c)[_0x9d6d('0xb')](function(_0x519c85){logger['info'](_0x9d6d('0xc'),_0x498bdc,_0x9d6d('0xd'));logger[_0x9d6d('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x498bdc,_0x9d6d('0xd'),JSON['stringify'](_0x519c85));if(_0x519c85['error']){if(_0x519c85[_0x9d6d('0xf')]['code']===0x1f4){logger[_0x9d6d('0xf')](_0x9d6d('0xc'),_0x498bdc,_0x519c85['error'][_0x9d6d('0x10')]);return _0x472196(_0x519c85[_0x9d6d('0xf')][_0x9d6d('0x10')]);}logger[_0x9d6d('0xf')](_0x9d6d('0xc'),_0x498bdc,_0x519c85[_0x9d6d('0xf')]['message']);return _0x41e27a(_0x519c85[_0x9d6d('0xf')][_0x9d6d('0x10')]);}else{logger['info'](_0x9d6d('0xc'),_0x498bdc,_0x9d6d('0xd'));_0x41e27a(_0x519c85['result']['message']);}})[_0x9d6d('0x11')](function(_0x59eb55){logger[_0x9d6d('0xf')](_0x9d6d('0xc'),_0x498bdc,_0x59eb55);_0x472196(_0x59eb55);});});}exports[_0x9d6d('0x12')]=function(_0x53dac2){var _0x1c12ba=this;return new Promise(function(_0x208d71,_0x57b477){return db[_0x9d6d('0x13')][_0x9d6d('0x14')]({'raw':_0x53dac2[_0x9d6d('0x15')]?_0x53dac2[_0x9d6d('0x15')][_0x9d6d('0x16')]===undefined?!![]:![]:!![],'where':_0x53dac2[_0x9d6d('0x15')]?_0x53dac2['options'][_0x9d6d('0x17')]||null:null,'attributes':_0x53dac2[_0x9d6d('0x15')]?_0x53dac2[_0x9d6d('0x15')][_0x9d6d('0x18')]||null:null,'limit':_0x53dac2['options']?_0x53dac2[_0x9d6d('0x15')]['limit']||null:null,'include':_0x53dac2[_0x9d6d('0x15')]?_0x53dac2[_0x9d6d('0x15')][_0x9d6d('0x19')]?_[_0x9d6d('0x1a')](_0x53dac2['options'][_0x9d6d('0x19')],function(_0x28461c){return{'model':db[_0x28461c['model']],'as':_0x28461c['as'],'attributes':_0x28461c[_0x9d6d('0x18')],'include':_0x28461c[_0x9d6d('0x19')]?_[_0x9d6d('0x1a')](_0x28461c[_0x9d6d('0x19')],function(_0x144245){return{'model':db[_0x144245[_0x9d6d('0x1b')]],'as':_0x144245['as'],'attributes':_0x144245[_0x9d6d('0x18')],'include':_0x144245['include']?_[_0x9d6d('0x1a')](_0x144245['include'],function(_0x1a97ec){return{'model':db[_0x1a97ec['model']],'as':_0x1a97ec['as'],'attributes':_0x1a97ec[_0x9d6d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9d6d('0xb')](function(_0x259467){logger[_0x9d6d('0x1c')](_0x9d6d('0x12'),_0x53dac2);logger[_0x9d6d('0xe')]('GetFreshdeskAccount',_0x53dac2,JSON[_0x9d6d('0x1d')](_0x259467));_0x208d71(_0x259467);})['catch'](function(_0x2eae56){logger[_0x9d6d('0xf')]('GetFreshdeskAccount',_0x2eae56[_0x9d6d('0x10')],_0x53dac2);_0x57b477(_0x1c12ba[_0x9d6d('0xf')](0x1f4,_0x2eae56[_0x9d6d('0x10')]));});});};exports[_0x9d6d('0x1e')]=function(_0x1a8c90){var _0x3e789e=this;return new Promise(function(_0x4d8880,_0x595f63){return db[_0x9d6d('0x13')][_0x9d6d('0x1f')]({'raw':_0x1a8c90[_0x9d6d('0x15')]?_0x1a8c90['options'][_0x9d6d('0x16')]===undefined?!![]:![]:!![],'where':_0x1a8c90[_0x9d6d('0x15')]?_0x1a8c90[_0x9d6d('0x15')][_0x9d6d('0x17')]||null:null,'attributes':_0x1a8c90['options']?_0x1a8c90[_0x9d6d('0x15')][_0x9d6d('0x18')]||null:null,'include':_0x1a8c90[_0x9d6d('0x15')]?_0x1a8c90['options']['include']?_[_0x9d6d('0x1a')](_0x1a8c90[_0x9d6d('0x15')][_0x9d6d('0x19')],function(_0x12f78e){return{'model':db[_0x12f78e[_0x9d6d('0x1b')]],'as':_0x12f78e['as'],'attributes':_0x12f78e[_0x9d6d('0x18')],'include':_0x12f78e[_0x9d6d('0x19')]?_[_0x9d6d('0x1a')](_0x12f78e[_0x9d6d('0x19')],function(_0xdfdcd2){return{'model':db[_0xdfdcd2['model']],'as':_0xdfdcd2['as'],'attributes':_0xdfdcd2['attributes'],'include':_0xdfdcd2[_0x9d6d('0x19')]?_[_0x9d6d('0x1a')](_0xdfdcd2[_0x9d6d('0x19')],function(_0x561dc9){return{'model':db[_0x561dc9[_0x9d6d('0x1b')]],'as':_0x561dc9['as'],'attributes':_0x561dc9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53be93){logger['info']('ShowFreshdeskAccount',_0x1a8c90);logger[_0x9d6d('0xe')]('ShowFreshdeskAccount',_0x1a8c90,JSON[_0x9d6d('0x1d')](_0x53be93));_0x4d8880(_0x53be93);})[_0x9d6d('0x11')](function(_0x447fed){logger[_0x9d6d('0xf')](_0x9d6d('0x1e'),_0x447fed['message'],_0x1a8c90);_0x595f63(_0x3e789e[_0x9d6d('0xf')](0x1f4,_0x447fed[_0x9d6d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 392a9fc..c370268 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 _0xd0b9=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd0b9,0xeb));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9d0b('0x0'));var util=require(_0x9d0b('0x1'));var path=require('path');var timeout=require(_0x9d0b('0x2'));var express=require(_0x9d0b('0x3'));var router=express[_0x9d0b('0x4')]();var fs_extra=require(_0x9d0b('0x5'));var auth=require(_0x9d0b('0x6'));var interaction=require(_0x9d0b('0x7'));var config=require(_0x9d0b('0x8'));var controller=require(_0x9d0b('0x9'));router[_0x9d0b('0xa')]('/',auth[_0x9d0b('0xb')](),controller['index']);router[_0x9d0b('0xa')](_0x9d0b('0xc'),auth[_0x9d0b('0xb')](),controller['show']);router[_0x9d0b('0xa')](_0x9d0b('0xd'),auth[_0x9d0b('0xb')](),controller[_0x9d0b('0xe')]);router[_0x9d0b('0xa')](_0x9d0b('0xf'),auth['isAuthenticated'](),controller[_0x9d0b('0x10')]);router['get'](_0x9d0b('0x11'),auth[_0x9d0b('0xb')](),controller[_0x9d0b('0x12')]);router['get'](_0x9d0b('0x13'),auth[_0x9d0b('0xb')](),controller[_0x9d0b('0x14')]);router[_0x9d0b('0x15')]('/',auth[_0x9d0b('0xb')](),controller['create']);router[_0x9d0b('0x15')]('/:id/tags',auth[_0x9d0b('0xb')](),controller[_0x9d0b('0x16')]);router[_0x9d0b('0x17')](_0x9d0b('0xc'),auth[_0x9d0b('0xb')](),controller[_0x9d0b('0x18')]);router[_0x9d0b('0x19')](_0x9d0b('0xc'),auth[_0x9d0b('0xb')](),controller[_0x9d0b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9917=['post','/:id/tags','setTags','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x48c8a9,_0x1cc168){var _0x42c713=function(_0x5d5948){while(--_0x5d5948){_0x48c8a9['push'](_0x48c8a9['shift']());}};_0x42c713(++_0x1cc168);}(_0x9917,0x1da));var _0x7991=function(_0x2175b8,_0x1cdaba){_0x2175b8=_0x2175b8-0x0;var _0x500c61=_0x9917[_0x2175b8];return _0x500c61;};'use strict';var multer=require(_0x7991('0x0'));var util=require(_0x7991('0x1'));var path=require(_0x7991('0x2'));var timeout=require(_0x7991('0x3'));var express=require(_0x7991('0x4'));var router=express[_0x7991('0x5')]();var fs_extra=require(_0x7991('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7991('0x7'));var config=require(_0x7991('0x8'));var controller=require(_0x7991('0x9'));router[_0x7991('0xa')]('/',auth[_0x7991('0xb')](),controller[_0x7991('0xc')]);router['get'](_0x7991('0xd'),auth[_0x7991('0xb')](),controller[_0x7991('0xe')]);router['get']('/:id/fields',auth[_0x7991('0xb')](),controller[_0x7991('0xf')]);router[_0x7991('0xa')](_0x7991('0x10'),auth[_0x7991('0xb')](),controller[_0x7991('0x11')]);router[_0x7991('0xa')](_0x7991('0x12'),auth[_0x7991('0xb')](),controller[_0x7991('0x13')]);router[_0x7991('0xa')]('/:id/tags',auth[_0x7991('0xb')](),controller['getTags']);router[_0x7991('0x14')]('/',auth[_0x7991('0xb')](),controller['create']);router['post'](_0x7991('0x15'),auth[_0x7991('0xb')](),controller[_0x7991('0x16')]);router['put'](_0x7991('0xd'),auth['isAuthenticated'](),controller[_0x7991('0x17')]);router[_0x7991('0x18')](_0x7991('0xd'),auth[_0x7991('0xb')](),controller['destroy']);module[_0x7991('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8d95d7c..b94ffb0 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 _0x8abc=['exports','STRING','sequelize'];(function(_0x53ed59,_0x4beb34){var _0x5834ca=function(_0x5f51f0){while(--_0x5f51f0){_0x53ed59['push'](_0x53ed59['shift']());}};_0x5834ca(++_0x4beb34);}(_0x8abc,0xc2));var _0xc8ab=function(_0x41cb4b,_0x200468){_0x41cb4b=_0x41cb4b-0x0;var _0x1719c1=_0x8abc[_0x41cb4b];return _0x1719c1;};'use strict';var Sequelize=require(_0xc8ab('0x0'));module[_0xc8ab('0x1')]={'name':{'type':Sequelize[_0xc8ab('0x2')]},'description':{'type':Sequelize[_0xc8ab('0x2')]}}; \ No newline at end of file +var _0x87a1=['exports','STRING','sequelize'];(function(_0x512612,_0x56f14f){var _0x58e826=function(_0x18f3ec){while(--_0x18f3ec){_0x512612['push'](_0x512612['shift']());}};_0x58e826(++_0x56f14f);}(_0x87a1,0x1be));var _0x187a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x87a1[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x187a('0x0'));module[_0x187a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x187a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f11e252..a785e2c 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 _0x05c9=['options','find','create','body','findOne','FreshdeskField','pick','getFields','getSubjects','nolimit','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','intersection','include'];(function(_0x8e4931,_0x10fb37){var _0x312141=function(_0x2f3ece){while(--_0x2f3ece){_0x8e4931['push'](_0x8e4931['shift']());}};_0x312141(++_0x10fb37);}(_0x05c9,0xb8));var _0x905c=function(_0x593241,_0x1e1e53){_0x593241=_0x593241-0x0;var _0x7dd43b=_0x05c9[_0x593241];return _0x7dd43b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x905c('0x0'));var zipdir=require(_0x905c('0x1'));var jsonpatch=require(_0x905c('0x2'));var rp=require(_0x905c('0x3'));var moment=require(_0x905c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x905c('0x5'));var util=require(_0x905c('0x6'));var path=require(_0x905c('0x7'));var sox=require(_0x905c('0x8'));var csv=require(_0x905c('0x9'));var ejs=require(_0x905c('0xa'));var fs=require('fs');var fs_extra=require(_0x905c('0xb'));var _=require('lodash');var squel=require(_0x905c('0xc'));var crypto=require(_0x905c('0xd'));var jsforce=require(_0x905c('0xe'));var deskjs=require(_0x905c('0xf'));var toCsv=require(_0x905c('0x9'));var querystring=require(_0x905c('0x10'));var Papa=require('papaparse');var Redis=require(_0x905c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x905c('0x12'));var as=require(_0x905c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x905c('0x14'))(_0x905c('0x15'));var utils=require('../../config/utils');var config=require(_0x905c('0x16'));var licenseUtil=require(_0x905c('0x17'));var db=require(_0x905c('0x18'))['db'];function respondWithStatusCode(_0x172df0,_0x2196fe){_0x2196fe=_0x2196fe||0xcc;return function(_0x452c04){if(_0x452c04){return _0x172df0[_0x905c('0x19')](_0x2196fe);}return _0x172df0[_0x905c('0x1a')](_0x2196fe)['end']();};}function respondWithResult(_0x45baa5,_0x1c48dd){_0x1c48dd=_0x1c48dd||0xc8;return function(_0x435dd1){if(_0x435dd1){return _0x45baa5[_0x905c('0x1a')](_0x1c48dd)[_0x905c('0x1b')](_0x435dd1);}};}function respondWithFilteredResult(_0x1182fe,_0x3d530b){return function(_0x39ee49){if(_0x39ee49){var _0x2ab0a6=typeof _0x3d530b['offset']===_0x905c('0x1c')&&typeof _0x3d530b[_0x905c('0x1d')]==='undefined';var _0x484376=_0x39ee49[_0x905c('0x1e')];var _0x1e868e=_0x2ab0a6?0x0:_0x3d530b[_0x905c('0x1f')];var _0xbc5a8d=_0x2ab0a6?_0x39ee49[_0x905c('0x1e')]:_0x3d530b[_0x905c('0x1f')]+_0x3d530b[_0x905c('0x1d')];var _0xd90fc8;if(_0xbc5a8d>=_0x484376){_0xbc5a8d=_0x484376;_0xd90fc8=0xc8;}else{_0xd90fc8=0xce;}_0x1182fe[_0x905c('0x1a')](_0xd90fc8);return _0x1182fe[_0x905c('0x20')](_0x905c('0x21'),_0x1e868e+'-'+_0xbc5a8d+'/'+_0x484376)[_0x905c('0x1b')](_0x39ee49);}return null;};}function patchUpdates(_0x52ff9e){return function(_0x2ecf69){try{jsonpatch[_0x905c('0x22')](_0x2ecf69,_0x52ff9e,!![]);}catch(_0x3ad3a7){return BPromise[_0x905c('0x23')](_0x3ad3a7);}return _0x2ecf69['save']();};}function saveUpdates(_0x4e06d0,_0x2fd629){return function(_0x94bb63){if(_0x94bb63){return _0x94bb63[_0x905c('0x24')](_0x4e06d0)['then'](function(_0x43d6f9){return _0x43d6f9;});}return null;};}function removeEntity(_0x253ae2,_0x348817){return function(_0x543463){if(_0x543463){return _0x543463[_0x905c('0x25')]()[_0x905c('0x26')](function(){_0x253ae2[_0x905c('0x1a')](0xcc)[_0x905c('0x27')]();});}};}function handleEntityNotFound(_0x1771e0,_0x2f91d1){return function(_0x44650b){if(!_0x44650b){_0x1771e0[_0x905c('0x19')](0x194);}return _0x44650b;};}function handleError(_0x3245f9,_0x2aa5ea){_0x2aa5ea=_0x2aa5ea||0x1f4;return function(_0x41d79e){logger['error'](_0x41d79e[_0x905c('0x28')]);if(_0x41d79e['name']){delete _0x41d79e[_0x905c('0x29')];}_0x3245f9[_0x905c('0x1a')](_0x2aa5ea)['send'](_0x41d79e);};}exports[_0x905c('0x2a')]=function(_0x224a01,_0x3ee95c){var _0x168845={},_0x37500a={},_0x1b6063={'count':0x0,'rows':[]};var _0x130158=_[_0x905c('0x2b')](db[_0x905c('0x2c')]['rawAttributes'],function(_0x5c5aef){return{'name':_0x5c5aef[_0x905c('0x2d')],'type':_0x5c5aef[_0x905c('0x2e')][_0x905c('0x2f')]};});_0x37500a[_0x905c('0x30')]=_[_0x905c('0x2b')](_0x130158,_0x905c('0x29'));_0x37500a['query']=_['keys'](_0x224a01[_0x905c('0x31')]);_0x37500a['filters']=_['intersection'](_0x37500a[_0x905c('0x30')],_0x37500a[_0x905c('0x31')]);_0x168845[_0x905c('0x32')]=_['intersection'](_0x37500a[_0x905c('0x30')],qs[_0x905c('0x33')](_0x224a01[_0x905c('0x31')][_0x905c('0x33')]));_0x168845[_0x905c('0x32')]=_0x168845['attributes'][_0x905c('0x34')]?_0x168845['attributes']:_0x37500a[_0x905c('0x30')];if(!_0x224a01['query'][_0x905c('0x35')]('nolimit')){_0x168845[_0x905c('0x1d')]=qs[_0x905c('0x1d')](_0x224a01[_0x905c('0x31')][_0x905c('0x1d')]);_0x168845[_0x905c('0x1f')]=qs[_0x905c('0x1f')](_0x224a01[_0x905c('0x31')][_0x905c('0x1f')]);}_0x168845[_0x905c('0x36')]=qs[_0x905c('0x37')](_0x224a01['query'][_0x905c('0x37')]);_0x168845[_0x905c('0x38')]=qs['filters'](_['pick'](_0x224a01[_0x905c('0x31')],_0x37500a[_0x905c('0x39')]),_0x130158);if(_0x224a01[_0x905c('0x31')][_0x905c('0x3a')]){_0x168845[_0x905c('0x38')]=_[_0x905c('0x3b')](_0x168845[_0x905c('0x38')],{'$or':_[_0x905c('0x2b')](_0x130158,function(_0x56dc32){if(_0x56dc32[_0x905c('0x2e')]!==_0x905c('0x3c')){var _0x444cc1={};_0x444cc1[_0x56dc32[_0x905c('0x29')]]={'$like':'%'+_0x224a01[_0x905c('0x31')][_0x905c('0x3a')]+'%'};return _0x444cc1;}})});}_0x168845=_[_0x905c('0x3b')]({},_0x168845,_0x224a01['options']);var _0x2fc24c={'where':_0x168845[_0x905c('0x38')]};return db[_0x905c('0x2c')][_0x905c('0x1e')](_0x2fc24c)[_0x905c('0x26')](function(_0x4fdcfb){_0x1b6063['count']=_0x4fdcfb;if(_0x224a01[_0x905c('0x31')][_0x905c('0x3d')]){_0x168845['include']=[{'all':!![]}];}return db[_0x905c('0x2c')][_0x905c('0x3e')](_0x168845);})[_0x905c('0x26')](function(_0x326b63){_0x1b6063[_0x905c('0x3f')]=_0x326b63;return _0x1b6063;})[_0x905c('0x26')](respondWithFilteredResult(_0x3ee95c,_0x168845))[_0x905c('0x40')](handleError(_0x3ee95c,null));};exports[_0x905c('0x41')]=function(_0x5980d6,_0x4df70e){var _0x1aab5a={'raw':![],'where':{'id':_0x5980d6[_0x905c('0x42')]['id']}},_0x3d5320={};_0x3d5320['model']=_['keys'](db[_0x905c('0x2c')][_0x905c('0x43')]);_0x3d5320[_0x905c('0x31')]=_[_0x905c('0x44')](_0x5980d6[_0x905c('0x31')]);_0x3d5320[_0x905c('0x39')]=_[_0x905c('0x45')](_0x3d5320[_0x905c('0x30')],_0x3d5320['query']);_0x1aab5a[_0x905c('0x32')]=_[_0x905c('0x45')](_0x3d5320[_0x905c('0x30')],qs[_0x905c('0x33')](_0x5980d6['query'][_0x905c('0x33')]));_0x1aab5a[_0x905c('0x32')]=_0x1aab5a[_0x905c('0x32')]['length']?_0x1aab5a[_0x905c('0x32')]:_0x3d5320[_0x905c('0x30')];if(_0x5980d6[_0x905c('0x31')][_0x905c('0x3d')]){_0x1aab5a[_0x905c('0x46')]=[{'all':!![]}];}_0x1aab5a=_['merge']({},_0x1aab5a,_0x5980d6[_0x905c('0x47')]);return db[_0x905c('0x2c')][_0x905c('0x48')](_0x1aab5a)[_0x905c('0x26')](handleEntityNotFound(_0x4df70e,null))[_0x905c('0x26')](respondWithResult(_0x4df70e,null))[_0x905c('0x40')](handleError(_0x4df70e,null));};exports[_0x905c('0x49')]=function(_0x1de443,_0x209dbe){return db[_0x905c('0x2c')][_0x905c('0x49')](_0x1de443[_0x905c('0x4a')],{})['then'](respondWithResult(_0x209dbe,0xc9))[_0x905c('0x40')](handleError(_0x209dbe,null));};exports[_0x905c('0x24')]=function(_0x418604,_0x337a3b){if(_0x418604[_0x905c('0x4a')]['id']){delete _0x418604[_0x905c('0x4a')]['id'];}return db[_0x905c('0x2c')][_0x905c('0x48')]({'where':{'id':_0x418604['params']['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x337a3b,null))[_0x905c('0x26')](saveUpdates(_0x418604[_0x905c('0x4a')],null))[_0x905c('0x26')](respondWithResult(_0x337a3b,null))[_0x905c('0x40')](handleError(_0x337a3b,null));};exports[_0x905c('0x25')]=function(_0x4d5675,_0x54fbf1){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4d5675[_0x905c('0x42')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x54fbf1,null))['then'](removeEntity(_0x54fbf1,null))[_0x905c('0x40')](handleError(_0x54fbf1,null));};exports['getFields']=function(_0x2a4bd4,_0x2d6ea5,_0x5a2441){var _0x2b5235={};var _0x4cb198={};var _0x339047;var _0x1088dd;return db['FreshdeskConfiguration'][_0x905c('0x4b')]({'where':{'id':_0x2a4bd4[_0x905c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ea5,null))['then'](function(_0x5cbe48){if(_0x5cbe48){_0x339047=_0x5cbe48;_0x4cb198[_0x905c('0x30')]=_[_0x905c('0x44')](db[_0x905c('0x4c')]['rawAttributes']);_0x4cb198[_0x905c('0x31')]=_[_0x905c('0x44')](_0x2a4bd4['query']);_0x4cb198[_0x905c('0x39')]=_[_0x905c('0x45')](_0x4cb198['model'],_0x4cb198['query']);_0x2b5235[_0x905c('0x32')]=_[_0x905c('0x45')](_0x4cb198['model'],qs[_0x905c('0x33')](_0x2a4bd4['query']['fields']));_0x2b5235[_0x905c('0x32')]=_0x2b5235[_0x905c('0x32')][_0x905c('0x34')]?_0x2b5235[_0x905c('0x32')]:_0x4cb198[_0x905c('0x30')];_0x2b5235[_0x905c('0x36')]=qs[_0x905c('0x37')](_0x2a4bd4['query']['sort']);_0x2b5235['where']=qs['filters'](_[_0x905c('0x4d')](_0x2a4bd4[_0x905c('0x31')],_0x4cb198['filters']));if(_0x2a4bd4['query'][_0x905c('0x3a')]){_0x2b5235[_0x905c('0x38')]=_[_0x905c('0x3b')](_0x2b5235[_0x905c('0x38')],{'$or':_[_0x905c('0x2b')](_0x2b5235[_0x905c('0x32')],function(_0x2038cb){var _0x2411ca={};_0x2411ca[_0x2038cb]={'$like':'%'+_0x2a4bd4['query'][_0x905c('0x3a')]+'%'};return _0x2411ca;})});}_0x2b5235=_['merge']({},_0x2b5235,_0x2a4bd4[_0x905c('0x47')]);return _0x339047[_0x905c('0x4e')](_0x2b5235);}})[_0x905c('0x26')](function(_0x312097){if(_0x312097){_0x1088dd=_0x312097[_0x905c('0x34')];if(!_0x2a4bd4[_0x905c('0x31')][_0x905c('0x35')]('nolimit')){_0x2b5235[_0x905c('0x1d')]=qs[_0x905c('0x1d')](_0x2a4bd4[_0x905c('0x31')]['limit']);_0x2b5235[_0x905c('0x1f')]=qs[_0x905c('0x1f')](_0x2a4bd4[_0x905c('0x31')][_0x905c('0x1f')]);}return _0x339047[_0x905c('0x4e')](_0x2b5235);}})[_0x905c('0x26')](function(_0x1e1d6e){if(_0x1e1d6e){return _0x1e1d6e?{'count':_0x1088dd,'rows':_0x1e1d6e}:null;}})[_0x905c('0x26')](respondWithResult(_0x2d6ea5,null))[_0x905c('0x40')](handleError(_0x2d6ea5,null));};exports[_0x905c('0x4f')]=function(_0x1dc86b,_0x597d4b,_0x454c0e){var _0x12dc13={};var _0x2c2e68={};var _0x13d31c;var _0x3bc4db;return db[_0x905c('0x2c')][_0x905c('0x4b')]({'where':{'id':_0x1dc86b[_0x905c('0x42')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x597d4b,null))[_0x905c('0x26')](function(_0x583c6){if(_0x583c6){_0x13d31c=_0x583c6;_0x2c2e68[_0x905c('0x30')]=_[_0x905c('0x44')](db['FreshdeskField'][_0x905c('0x43')]);_0x2c2e68[_0x905c('0x31')]=_[_0x905c('0x44')](_0x1dc86b[_0x905c('0x31')]);_0x2c2e68[_0x905c('0x39')]=_[_0x905c('0x45')](_0x2c2e68['model'],_0x2c2e68['query']);_0x12dc13['attributes']=_[_0x905c('0x45')](_0x2c2e68['model'],qs[_0x905c('0x33')](_0x1dc86b['query']['fields']));_0x12dc13[_0x905c('0x32')]=_0x12dc13['attributes']['length']?_0x12dc13[_0x905c('0x32')]:_0x2c2e68[_0x905c('0x30')];_0x12dc13['order']=qs[_0x905c('0x37')](_0x1dc86b[_0x905c('0x31')]['sort']);_0x12dc13[_0x905c('0x38')]=qs[_0x905c('0x39')](_[_0x905c('0x4d')](_0x1dc86b[_0x905c('0x31')],_0x2c2e68[_0x905c('0x39')]));if(_0x1dc86b[_0x905c('0x31')][_0x905c('0x3a')]){_0x12dc13[_0x905c('0x38')]=_[_0x905c('0x3b')](_0x12dc13[_0x905c('0x38')],{'$or':_[_0x905c('0x2b')](_0x12dc13[_0x905c('0x32')],function(_0x27e531){var _0x2bdd34={};_0x2bdd34[_0x27e531]={'$like':'%'+_0x1dc86b[_0x905c('0x31')][_0x905c('0x3a')]+'%'};return _0x2bdd34;})});}_0x12dc13=_[_0x905c('0x3b')]({},_0x12dc13,_0x1dc86b[_0x905c('0x47')]);return _0x13d31c[_0x905c('0x4f')](_0x12dc13);}})[_0x905c('0x26')](function(_0x1a36c4){if(_0x1a36c4){_0x3bc4db=_0x1a36c4['length'];if(!_0x1dc86b[_0x905c('0x31')][_0x905c('0x35')](_0x905c('0x50'))){_0x12dc13[_0x905c('0x1d')]=qs[_0x905c('0x1d')](_0x1dc86b[_0x905c('0x31')][_0x905c('0x1d')]);_0x12dc13['offset']=qs['offset'](_0x1dc86b[_0x905c('0x31')][_0x905c('0x1f')]);}return _0x13d31c[_0x905c('0x4f')](_0x12dc13);}})[_0x905c('0x26')](function(_0x4df790){if(_0x4df790){return _0x4df790?{'count':_0x3bc4db,'rows':_0x4df790}:null;}})[_0x905c('0x26')](respondWithResult(_0x597d4b,null))[_0x905c('0x40')](handleError(_0x597d4b,null));};exports['getDescriptions']=function(_0x58d667,_0x3fda53,_0x115f99){var _0x4cebb0={};var _0x229384={};var _0x21af6a;var _0x55c5a5;return db['FreshdeskConfiguration'][_0x905c('0x4b')]({'where':{'id':_0x58d667[_0x905c('0x42')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x3fda53,null))[_0x905c('0x26')](function(_0x1c3e27){if(_0x1c3e27){_0x21af6a=_0x1c3e27;_0x229384[_0x905c('0x30')]=_[_0x905c('0x44')](db[_0x905c('0x4c')][_0x905c('0x43')]);_0x229384['query']=_[_0x905c('0x44')](_0x58d667[_0x905c('0x31')]);_0x229384[_0x905c('0x39')]=_[_0x905c('0x45')](_0x229384[_0x905c('0x30')],_0x229384[_0x905c('0x31')]);_0x4cebb0['attributes']=_[_0x905c('0x45')](_0x229384[_0x905c('0x30')],qs['fields'](_0x58d667[_0x905c('0x31')]['fields']));_0x4cebb0[_0x905c('0x32')]=_0x4cebb0[_0x905c('0x32')]['length']?_0x4cebb0[_0x905c('0x32')]:_0x229384[_0x905c('0x30')];_0x4cebb0['order']=qs[_0x905c('0x37')](_0x58d667['query']['sort']);_0x4cebb0['where']=qs[_0x905c('0x39')](_['pick'](_0x58d667[_0x905c('0x31')],_0x229384[_0x905c('0x39')]));if(_0x58d667[_0x905c('0x31')]['filter']){_0x4cebb0[_0x905c('0x38')]=_[_0x905c('0x3b')](_0x4cebb0['where'],{'$or':_['map'](_0x4cebb0['attributes'],function(_0x578650){var _0x20739a={};_0x20739a[_0x578650]={'$like':'%'+_0x58d667[_0x905c('0x31')]['filter']+'%'};return _0x20739a;})});}_0x4cebb0=_[_0x905c('0x3b')]({},_0x4cebb0,_0x58d667[_0x905c('0x47')]);return _0x21af6a['getDescriptions'](_0x4cebb0);}})[_0x905c('0x26')](function(_0x50d083){if(_0x50d083){_0x55c5a5=_0x50d083['length'];if(!_0x58d667[_0x905c('0x31')][_0x905c('0x35')](_0x905c('0x50'))){_0x4cebb0['limit']=qs[_0x905c('0x1d')](_0x58d667['query'][_0x905c('0x1d')]);_0x4cebb0[_0x905c('0x1f')]=qs[_0x905c('0x1f')](_0x58d667[_0x905c('0x31')][_0x905c('0x1f')]);}return _0x21af6a[_0x905c('0x51')](_0x4cebb0);}})[_0x905c('0x26')](function(_0x727764){if(_0x727764){return _0x727764?{'count':_0x55c5a5,'rows':_0x727764}:null;}})[_0x905c('0x26')](respondWithResult(_0x3fda53,null))[_0x905c('0x40')](handleError(_0x3fda53,null));};exports['getTags']=function(_0x20fb35,_0x21e592,_0x12d422){var _0x5a9827={};var _0x3aa1c2={};var _0x56900c;var _0x1aa001;return db[_0x905c('0x2c')][_0x905c('0x4b')]({'where':{'id':_0x20fb35['params']['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x21e592,null))[_0x905c('0x26')](function(_0x40b917){if(_0x40b917){_0x56900c=_0x40b917;_0x3aa1c2['model']=_[_0x905c('0x44')](db['Tag'][_0x905c('0x43')]);_0x3aa1c2['query']=_[_0x905c('0x44')](_0x20fb35[_0x905c('0x31')]);_0x3aa1c2['filters']=_['intersection'](_0x3aa1c2['model'],_0x3aa1c2['query']);_0x5a9827['attributes']=_[_0x905c('0x45')](_0x3aa1c2[_0x905c('0x30')],qs[_0x905c('0x33')](_0x20fb35[_0x905c('0x31')][_0x905c('0x33')]));_0x5a9827[_0x905c('0x32')]=_0x5a9827[_0x905c('0x32')]['length']?_0x5a9827[_0x905c('0x32')]:_0x3aa1c2[_0x905c('0x30')];_0x5a9827[_0x905c('0x36')]=qs[_0x905c('0x37')](_0x20fb35['query'][_0x905c('0x37')]);_0x5a9827[_0x905c('0x38')]=qs[_0x905c('0x39')](_[_0x905c('0x4d')](_0x20fb35[_0x905c('0x31')],_0x3aa1c2[_0x905c('0x39')]));if(_0x20fb35[_0x905c('0x31')][_0x905c('0x3a')]){_0x5a9827['where']=_[_0x905c('0x3b')](_0x5a9827[_0x905c('0x38')],{'$or':_[_0x905c('0x2b')](_0x5a9827[_0x905c('0x32')],function(_0x1885dc){var _0x43c4a5={};_0x43c4a5[_0x1885dc]={'$like':'%'+_0x20fb35[_0x905c('0x31')]['filter']+'%'};return _0x43c4a5;})});}_0x5a9827=_[_0x905c('0x3b')]({},_0x5a9827,_0x20fb35['options']);return _0x56900c['getTags'](_0x5a9827);}})['then'](function(_0x434136){if(_0x434136){_0x1aa001=_0x434136[_0x905c('0x34')];if(!_0x20fb35[_0x905c('0x31')][_0x905c('0x35')](_0x905c('0x50'))){_0x5a9827[_0x905c('0x1d')]=qs[_0x905c('0x1d')](_0x20fb35[_0x905c('0x31')][_0x905c('0x1d')]);_0x5a9827[_0x905c('0x1f')]=qs[_0x905c('0x1f')](_0x20fb35[_0x905c('0x31')][_0x905c('0x1f')]);}return _0x56900c[_0x905c('0x52')](_0x5a9827);}})[_0x905c('0x26')](function(_0x6739c7){if(_0x6739c7){return _0x6739c7?{'count':_0x1aa001,'rows':_0x6739c7}:null;}})[_0x905c('0x26')](respondWithResult(_0x21e592,null))[_0x905c('0x40')](handleError(_0x21e592,null));};exports[_0x905c('0x53')]=function(_0x1495e0,_0x1afb61,_0x6c1cfd){if(_0x1495e0['body']['id']){delete _0x1495e0[_0x905c('0x4a')]['id'];}return db[_0x905c('0x2c')][_0x905c('0x4b')]({'where':{'id':_0x1495e0[_0x905c('0x42')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x1afb61,null))[_0x905c('0x26')](function(_0x6ad722){if(_0x6ad722){return _0x6ad722[_0x905c('0x53')](_0x1495e0[_0x905c('0x4a')][_0x905c('0x54')]||[]);}return null;})[_0x905c('0x26')](respondWithResult(_0x1afb61,null))[_0x905c('0x40')](handleError(_0x1afb61,null));}; \ No newline at end of file +var _0xe267=['options','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','order','sort','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge'];(function(_0x4184cc,_0x558a31){var _0x32bc14=function(_0x4454fb){while(--_0x4454fb){_0x4184cc['push'](_0x4184cc['shift']());}};_0x32bc14(++_0x558a31);}(_0xe267,0x1ac));var _0x7e26=function(_0x55e4e1,_0x352a79){_0x55e4e1=_0x55e4e1-0x0;var _0x1644e8=_0xe267[_0x55e4e1];return _0x1644e8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e26('0x0'));var jsonpatch=require(_0x7e26('0x1'));var rp=require('request-promise');var moment=require(_0x7e26('0x2'));var BPromise=require(_0x7e26('0x3'));var Mustache=require(_0x7e26('0x4'));var util=require(_0x7e26('0x5'));var path=require('path');var sox=require(_0x7e26('0x6'));var csv=require(_0x7e26('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e26('0x8'));var squel=require('squel');var crypto=require(_0x7e26('0x9'));var jsforce=require(_0x7e26('0xa'));var deskjs=require(_0x7e26('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7e26('0xc'));var Papa=require(_0x7e26('0xd'));var Redis=require(_0x7e26('0xe'));var authService=require(_0x7e26('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7e26('0x10'));var hardwareService=require(_0x7e26('0x11'));var logger=require('../../config/logger')(_0x7e26('0x12'));var utils=require(_0x7e26('0x13'));var config=require(_0x7e26('0x14'));var licenseUtil=require(_0x7e26('0x15'));var db=require(_0x7e26('0x16'))['db'];function respondWithStatusCode(_0xda476e,_0xa93295){_0xa93295=_0xa93295||0xcc;return function(_0x2acdea){if(_0x2acdea){return _0xda476e[_0x7e26('0x17')](_0xa93295);}return _0xda476e['status'](_0xa93295)[_0x7e26('0x18')]();};}function respondWithResult(_0x1a314a,_0x48d64b){_0x48d64b=_0x48d64b||0xc8;return function(_0x454fcc){if(_0x454fcc){return _0x1a314a[_0x7e26('0x19')](_0x48d64b)[_0x7e26('0x1a')](_0x454fcc);}};}function respondWithFilteredResult(_0x46d7e0,_0x1bc5ff){return function(_0x40c91e){if(_0x40c91e){var _0x3d3b79=typeof _0x1bc5ff[_0x7e26('0x1b')]===_0x7e26('0x1c')&&typeof _0x1bc5ff['limit']===_0x7e26('0x1c');var _0x23337c=_0x40c91e[_0x7e26('0x1d')];var _0x3683e6=_0x3d3b79?0x0:_0x1bc5ff[_0x7e26('0x1b')];var _0xc4d771=_0x3d3b79?_0x40c91e['count']:_0x1bc5ff['offset']+_0x1bc5ff[_0x7e26('0x1e')];var _0x814615;if(_0xc4d771>=_0x23337c){_0xc4d771=_0x23337c;_0x814615=0xc8;}else{_0x814615=0xce;}_0x46d7e0[_0x7e26('0x19')](_0x814615);return _0x46d7e0['set'](_0x7e26('0x1f'),_0x3683e6+'-'+_0xc4d771+'/'+_0x23337c)[_0x7e26('0x1a')](_0x40c91e);}return null;};}function patchUpdates(_0xdda445){return function(_0x4ae829){try{jsonpatch['apply'](_0x4ae829,_0xdda445,!![]);}catch(_0x4e64e6){return BPromise[_0x7e26('0x20')](_0x4e64e6);}return _0x4ae829[_0x7e26('0x21')]();};}function saveUpdates(_0x3045ed,_0x1bc435){return function(_0x41d8ce){if(_0x41d8ce){return _0x41d8ce[_0x7e26('0x22')](_0x3045ed)['then'](function(_0x4c8126){return _0x4c8126;});}return null;};}function removeEntity(_0xf2f9f8,_0x4f99e2){return function(_0x1a6952){if(_0x1a6952){return _0x1a6952['destroy']()['then'](function(){_0xf2f9f8['status'](0xcc)[_0x7e26('0x18')]();});}};}function handleEntityNotFound(_0x2ac6ea,_0x32dc7f){return function(_0x4c7281){if(!_0x4c7281){_0x2ac6ea[_0x7e26('0x17')](0x194);}return _0x4c7281;};}function handleError(_0x3c93aa,_0x509392){_0x509392=_0x509392||0x1f4;return function(_0x4701dc){logger[_0x7e26('0x23')](_0x4701dc[_0x7e26('0x24')]);if(_0x4701dc[_0x7e26('0x25')]){delete _0x4701dc[_0x7e26('0x25')];}_0x3c93aa[_0x7e26('0x19')](_0x509392)['send'](_0x4701dc);};}exports[_0x7e26('0x26')]=function(_0x38e2f2,_0x3bfa24){var _0x173b12={},_0x3cfdfe={},_0x5618b8={'count':0x0,'rows':[]};var _0x115051=_[_0x7e26('0x27')](db[_0x7e26('0x28')][_0x7e26('0x29')],function(_0x3e6320){return{'name':_0x3e6320['fieldName'],'type':_0x3e6320[_0x7e26('0x2a')][_0x7e26('0x2b')]};});_0x3cfdfe['model']=_[_0x7e26('0x27')](_0x115051,_0x7e26('0x25'));_0x3cfdfe[_0x7e26('0x2c')]=_[_0x7e26('0x2d')](_0x38e2f2[_0x7e26('0x2c')]);_0x3cfdfe[_0x7e26('0x2e')]=_[_0x7e26('0x2f')](_0x3cfdfe[_0x7e26('0x30')],_0x3cfdfe[_0x7e26('0x2c')]);_0x173b12[_0x7e26('0x31')]=_['intersection'](_0x3cfdfe[_0x7e26('0x30')],qs['fields'](_0x38e2f2[_0x7e26('0x2c')][_0x7e26('0x32')]));_0x173b12[_0x7e26('0x31')]=_0x173b12[_0x7e26('0x31')][_0x7e26('0x33')]?_0x173b12['attributes']:_0x3cfdfe[_0x7e26('0x30')];if(!_0x38e2f2[_0x7e26('0x2c')][_0x7e26('0x34')](_0x7e26('0x35'))){_0x173b12[_0x7e26('0x1e')]=qs[_0x7e26('0x1e')](_0x38e2f2['query'][_0x7e26('0x1e')]);_0x173b12['offset']=qs['offset'](_0x38e2f2['query'][_0x7e26('0x1b')]);}_0x173b12['order']=qs['sort'](_0x38e2f2[_0x7e26('0x2c')]['sort']);_0x173b12[_0x7e26('0x36')]=qs[_0x7e26('0x2e')](_[_0x7e26('0x37')](_0x38e2f2[_0x7e26('0x2c')],_0x3cfdfe[_0x7e26('0x2e')]),_0x115051);if(_0x38e2f2[_0x7e26('0x2c')][_0x7e26('0x38')]){_0x173b12[_0x7e26('0x36')]=_[_0x7e26('0x39')](_0x173b12[_0x7e26('0x36')],{'$or':_['map'](_0x115051,function(_0x514ec2){if(_0x514ec2[_0x7e26('0x2a')]!=='VIRTUAL'){var _0x490c35={};_0x490c35[_0x514ec2[_0x7e26('0x25')]]={'$like':'%'+_0x38e2f2[_0x7e26('0x2c')]['filter']+'%'};return _0x490c35;}})});}_0x173b12=_['merge']({},_0x173b12,_0x38e2f2[_0x7e26('0x3a')]);var _0x4cc97e={'where':_0x173b12[_0x7e26('0x36')]};return db[_0x7e26('0x28')][_0x7e26('0x1d')](_0x4cc97e)[_0x7e26('0x3b')](function(_0x3ad628){_0x5618b8['count']=_0x3ad628;if(_0x38e2f2[_0x7e26('0x2c')][_0x7e26('0x3c')]){_0x173b12[_0x7e26('0x3d')]=[{'all':!![]}];}return db[_0x7e26('0x28')][_0x7e26('0x3e')](_0x173b12);})[_0x7e26('0x3b')](function(_0x3a21f5){_0x5618b8[_0x7e26('0x3f')]=_0x3a21f5;return _0x5618b8;})[_0x7e26('0x3b')](respondWithFilteredResult(_0x3bfa24,_0x173b12))[_0x7e26('0x40')](handleError(_0x3bfa24,null));};exports[_0x7e26('0x41')]=function(_0xc649e,_0x431895){var _0x53cefe={'raw':![],'where':{'id':_0xc649e['params']['id']}},_0x2e1c3a={};_0x2e1c3a[_0x7e26('0x30')]=_[_0x7e26('0x2d')](db[_0x7e26('0x28')][_0x7e26('0x29')]);_0x2e1c3a['query']=_[_0x7e26('0x2d')](_0xc649e[_0x7e26('0x2c')]);_0x2e1c3a['filters']=_['intersection'](_0x2e1c3a[_0x7e26('0x30')],_0x2e1c3a[_0x7e26('0x2c')]);_0x53cefe[_0x7e26('0x31')]=_['intersection'](_0x2e1c3a[_0x7e26('0x30')],qs[_0x7e26('0x32')](_0xc649e['query'][_0x7e26('0x32')]));_0x53cefe[_0x7e26('0x31')]=_0x53cefe[_0x7e26('0x31')][_0x7e26('0x33')]?_0x53cefe[_0x7e26('0x31')]:_0x2e1c3a[_0x7e26('0x30')];if(_0xc649e[_0x7e26('0x2c')][_0x7e26('0x3c')]){_0x53cefe[_0x7e26('0x3d')]=[{'all':!![]}];}_0x53cefe=_[_0x7e26('0x39')]({},_0x53cefe,_0xc649e[_0x7e26('0x3a')]);return db[_0x7e26('0x28')][_0x7e26('0x42')](_0x53cefe)[_0x7e26('0x3b')](handleEntityNotFound(_0x431895,null))[_0x7e26('0x3b')](respondWithResult(_0x431895,null))['catch'](handleError(_0x431895,null));};exports[_0x7e26('0x43')]=function(_0x173ef7,_0x4e2f45){return db[_0x7e26('0x28')][_0x7e26('0x43')](_0x173ef7['body'],{})['then'](respondWithResult(_0x4e2f45,0xc9))[_0x7e26('0x40')](handleError(_0x4e2f45,null));};exports[_0x7e26('0x22')]=function(_0x13e0dc,_0x4036c2){if(_0x13e0dc[_0x7e26('0x44')]['id']){delete _0x13e0dc[_0x7e26('0x44')]['id'];}return db[_0x7e26('0x28')]['find']({'where':{'id':_0x13e0dc[_0x7e26('0x45')]['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x4036c2,null))[_0x7e26('0x3b')](saveUpdates(_0x13e0dc[_0x7e26('0x44')],null))[_0x7e26('0x3b')](respondWithResult(_0x4036c2,null))['catch'](handleError(_0x4036c2,null));};exports['destroy']=function(_0x214290,_0x271ef0){return db['FreshdeskConfiguration'][_0x7e26('0x42')]({'where':{'id':_0x214290['params']['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x271ef0,null))['then'](removeEntity(_0x271ef0,null))[_0x7e26('0x40')](handleError(_0x271ef0,null));};exports[_0x7e26('0x46')]=function(_0x10d18f,_0x1ac64f,_0x2ed867){var _0x28d415={};var _0x267a0d={};var _0x55d7fa;var _0x718e9e;return db[_0x7e26('0x28')][_0x7e26('0x47')]({'where':{'id':_0x10d18f[_0x7e26('0x45')]['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x1ac64f,null))[_0x7e26('0x3b')](function(_0x16d1b1){if(_0x16d1b1){_0x55d7fa=_0x16d1b1;_0x267a0d[_0x7e26('0x30')]=_[_0x7e26('0x2d')](db['FreshdeskField'][_0x7e26('0x29')]);_0x267a0d[_0x7e26('0x2c')]=_[_0x7e26('0x2d')](_0x10d18f[_0x7e26('0x2c')]);_0x267a0d[_0x7e26('0x2e')]=_['intersection'](_0x267a0d[_0x7e26('0x30')],_0x267a0d['query']);_0x28d415[_0x7e26('0x31')]=_['intersection'](_0x267a0d[_0x7e26('0x30')],qs[_0x7e26('0x32')](_0x10d18f[_0x7e26('0x2c')][_0x7e26('0x32')]));_0x28d415[_0x7e26('0x31')]=_0x28d415[_0x7e26('0x31')][_0x7e26('0x33')]?_0x28d415[_0x7e26('0x31')]:_0x267a0d[_0x7e26('0x30')];_0x28d415[_0x7e26('0x48')]=qs[_0x7e26('0x49')](_0x10d18f[_0x7e26('0x2c')][_0x7e26('0x49')]);_0x28d415['where']=qs[_0x7e26('0x2e')](_['pick'](_0x10d18f['query'],_0x267a0d[_0x7e26('0x2e')]));if(_0x10d18f[_0x7e26('0x2c')][_0x7e26('0x38')]){_0x28d415[_0x7e26('0x36')]=_['merge'](_0x28d415['where'],{'$or':_['map'](_0x28d415['attributes'],function(_0x15e40f){var _0x47e378={};_0x47e378[_0x15e40f]={'$like':'%'+_0x10d18f[_0x7e26('0x2c')][_0x7e26('0x38')]+'%'};return _0x47e378;})});}_0x28d415=_['merge']({},_0x28d415,_0x10d18f[_0x7e26('0x3a')]);return _0x55d7fa[_0x7e26('0x46')](_0x28d415);}})[_0x7e26('0x3b')](function(_0x501ca7){if(_0x501ca7){_0x718e9e=_0x501ca7[_0x7e26('0x33')];if(!_0x10d18f['query'][_0x7e26('0x34')]('nolimit')){_0x28d415['limit']=qs[_0x7e26('0x1e')](_0x10d18f[_0x7e26('0x2c')][_0x7e26('0x1e')]);_0x28d415[_0x7e26('0x1b')]=qs[_0x7e26('0x1b')](_0x10d18f['query']['offset']);}return _0x55d7fa['getFields'](_0x28d415);}})[_0x7e26('0x3b')](function(_0x5273ca){if(_0x5273ca){return _0x5273ca?{'count':_0x718e9e,'rows':_0x5273ca}:null;}})[_0x7e26('0x3b')](respondWithResult(_0x1ac64f,null))[_0x7e26('0x40')](handleError(_0x1ac64f,null));};exports['getSubjects']=function(_0x1b612b,_0x138aec,_0x478a47){var _0x31ebfc={};var _0x2c19e6={};var _0x338f07;var _0x34b177;return db['FreshdeskConfiguration'][_0x7e26('0x47')]({'where':{'id':_0x1b612b[_0x7e26('0x45')]['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x138aec,null))['then'](function(_0x10ccd6){if(_0x10ccd6){_0x338f07=_0x10ccd6;_0x2c19e6['model']=_[_0x7e26('0x2d')](db[_0x7e26('0x4a')]['rawAttributes']);_0x2c19e6[_0x7e26('0x2c')]=_[_0x7e26('0x2d')](_0x1b612b['query']);_0x2c19e6[_0x7e26('0x2e')]=_[_0x7e26('0x2f')](_0x2c19e6[_0x7e26('0x30')],_0x2c19e6['query']);_0x31ebfc['attributes']=_[_0x7e26('0x2f')](_0x2c19e6[_0x7e26('0x30')],qs[_0x7e26('0x32')](_0x1b612b[_0x7e26('0x2c')][_0x7e26('0x32')]));_0x31ebfc['attributes']=_0x31ebfc[_0x7e26('0x31')][_0x7e26('0x33')]?_0x31ebfc[_0x7e26('0x31')]:_0x2c19e6['model'];_0x31ebfc['order']=qs[_0x7e26('0x49')](_0x1b612b[_0x7e26('0x2c')][_0x7e26('0x49')]);_0x31ebfc['where']=qs[_0x7e26('0x2e')](_[_0x7e26('0x37')](_0x1b612b[_0x7e26('0x2c')],_0x2c19e6[_0x7e26('0x2e')]));if(_0x1b612b[_0x7e26('0x2c')]['filter']){_0x31ebfc['where']=_[_0x7e26('0x39')](_0x31ebfc['where'],{'$or':_[_0x7e26('0x27')](_0x31ebfc['attributes'],function(_0x52b1fe){var _0x28152d={};_0x28152d[_0x52b1fe]={'$like':'%'+_0x1b612b['query']['filter']+'%'};return _0x28152d;})});}_0x31ebfc=_['merge']({},_0x31ebfc,_0x1b612b[_0x7e26('0x3a')]);return _0x338f07[_0x7e26('0x4b')](_0x31ebfc);}})[_0x7e26('0x3b')](function(_0x2dfbb8){if(_0x2dfbb8){_0x34b177=_0x2dfbb8[_0x7e26('0x33')];if(!_0x1b612b['query'][_0x7e26('0x34')](_0x7e26('0x35'))){_0x31ebfc[_0x7e26('0x1e')]=qs['limit'](_0x1b612b[_0x7e26('0x2c')][_0x7e26('0x1e')]);_0x31ebfc['offset']=qs[_0x7e26('0x1b')](_0x1b612b[_0x7e26('0x2c')][_0x7e26('0x1b')]);}return _0x338f07[_0x7e26('0x4b')](_0x31ebfc);}})[_0x7e26('0x3b')](function(_0x3190a2){if(_0x3190a2){return _0x3190a2?{'count':_0x34b177,'rows':_0x3190a2}:null;}})['then'](respondWithResult(_0x138aec,null))[_0x7e26('0x40')](handleError(_0x138aec,null));};exports[_0x7e26('0x4c')]=function(_0x37e6b3,_0x10c6a9,_0x59e3be){var _0x52ee56={};var _0x254437={};var _0x3c6087;var _0x329712;return db[_0x7e26('0x28')][_0x7e26('0x47')]({'where':{'id':_0x37e6b3[_0x7e26('0x45')]['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x10c6a9,null))[_0x7e26('0x3b')](function(_0x36302c){if(_0x36302c){_0x3c6087=_0x36302c;_0x254437[_0x7e26('0x30')]=_[_0x7e26('0x2d')](db[_0x7e26('0x4a')]['rawAttributes']);_0x254437[_0x7e26('0x2c')]=_[_0x7e26('0x2d')](_0x37e6b3[_0x7e26('0x2c')]);_0x254437['filters']=_['intersection'](_0x254437['model'],_0x254437[_0x7e26('0x2c')]);_0x52ee56[_0x7e26('0x31')]=_[_0x7e26('0x2f')](_0x254437[_0x7e26('0x30')],qs[_0x7e26('0x32')](_0x37e6b3[_0x7e26('0x2c')]['fields']));_0x52ee56[_0x7e26('0x31')]=_0x52ee56['attributes'][_0x7e26('0x33')]?_0x52ee56[_0x7e26('0x31')]:_0x254437[_0x7e26('0x30')];_0x52ee56[_0x7e26('0x48')]=qs[_0x7e26('0x49')](_0x37e6b3['query'][_0x7e26('0x49')]);_0x52ee56[_0x7e26('0x36')]=qs[_0x7e26('0x2e')](_[_0x7e26('0x37')](_0x37e6b3[_0x7e26('0x2c')],_0x254437[_0x7e26('0x2e')]));if(_0x37e6b3[_0x7e26('0x2c')][_0x7e26('0x38')]){_0x52ee56['where']=_[_0x7e26('0x39')](_0x52ee56[_0x7e26('0x36')],{'$or':_[_0x7e26('0x27')](_0x52ee56[_0x7e26('0x31')],function(_0x231bdb){var _0x1f61a6={};_0x1f61a6[_0x231bdb]={'$like':'%'+_0x37e6b3[_0x7e26('0x2c')][_0x7e26('0x38')]+'%'};return _0x1f61a6;})});}_0x52ee56=_['merge']({},_0x52ee56,_0x37e6b3[_0x7e26('0x3a')]);return _0x3c6087['getDescriptions'](_0x52ee56);}})['then'](function(_0xab5c62){if(_0xab5c62){_0x329712=_0xab5c62[_0x7e26('0x33')];if(!_0x37e6b3[_0x7e26('0x2c')][_0x7e26('0x34')](_0x7e26('0x35'))){_0x52ee56[_0x7e26('0x1e')]=qs[_0x7e26('0x1e')](_0x37e6b3[_0x7e26('0x2c')][_0x7e26('0x1e')]);_0x52ee56[_0x7e26('0x1b')]=qs['offset'](_0x37e6b3[_0x7e26('0x2c')][_0x7e26('0x1b')]);}return _0x3c6087[_0x7e26('0x4c')](_0x52ee56);}})['then'](function(_0x164c5b){if(_0x164c5b){return _0x164c5b?{'count':_0x329712,'rows':_0x164c5b}:null;}})['then'](respondWithResult(_0x10c6a9,null))[_0x7e26('0x40')](handleError(_0x10c6a9,null));};exports[_0x7e26('0x4d')]=function(_0x1b8690,_0x9c3e44,_0x3f53c8){var _0x57c3d9={};var _0x1dd1a5={};var _0x5b92ef;var _0x2ce8e6;return db[_0x7e26('0x28')][_0x7e26('0x47')]({'where':{'id':_0x1b8690[_0x7e26('0x45')]['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x9c3e44,null))[_0x7e26('0x3b')](function(_0x2d2347){if(_0x2d2347){_0x5b92ef=_0x2d2347;_0x1dd1a5['model']=_[_0x7e26('0x2d')](db[_0x7e26('0x4e')]['rawAttributes']);_0x1dd1a5[_0x7e26('0x2c')]=_[_0x7e26('0x2d')](_0x1b8690[_0x7e26('0x2c')]);_0x1dd1a5['filters']=_[_0x7e26('0x2f')](_0x1dd1a5['model'],_0x1dd1a5[_0x7e26('0x2c')]);_0x57c3d9['attributes']=_[_0x7e26('0x2f')](_0x1dd1a5[_0x7e26('0x30')],qs[_0x7e26('0x32')](_0x1b8690[_0x7e26('0x2c')]['fields']));_0x57c3d9['attributes']=_0x57c3d9[_0x7e26('0x31')][_0x7e26('0x33')]?_0x57c3d9[_0x7e26('0x31')]:_0x1dd1a5[_0x7e26('0x30')];_0x57c3d9[_0x7e26('0x48')]=qs[_0x7e26('0x49')](_0x1b8690[_0x7e26('0x2c')][_0x7e26('0x49')]);_0x57c3d9['where']=qs[_0x7e26('0x2e')](_[_0x7e26('0x37')](_0x1b8690[_0x7e26('0x2c')],_0x1dd1a5[_0x7e26('0x2e')]));if(_0x1b8690['query'][_0x7e26('0x38')]){_0x57c3d9[_0x7e26('0x36')]=_[_0x7e26('0x39')](_0x57c3d9['where'],{'$or':_['map'](_0x57c3d9['attributes'],function(_0x48ef45){var _0x37c137={};_0x37c137[_0x48ef45]={'$like':'%'+_0x1b8690['query'][_0x7e26('0x38')]+'%'};return _0x37c137;})});}_0x57c3d9=_['merge']({},_0x57c3d9,_0x1b8690['options']);return _0x5b92ef[_0x7e26('0x4d')](_0x57c3d9);}})['then'](function(_0x3d728b){if(_0x3d728b){_0x2ce8e6=_0x3d728b[_0x7e26('0x33')];if(!_0x1b8690['query']['hasOwnProperty']('nolimit')){_0x57c3d9['limit']=qs[_0x7e26('0x1e')](_0x1b8690['query'][_0x7e26('0x1e')]);_0x57c3d9['offset']=qs[_0x7e26('0x1b')](_0x1b8690[_0x7e26('0x2c')][_0x7e26('0x1b')]);}return _0x5b92ef[_0x7e26('0x4d')](_0x57c3d9);}})[_0x7e26('0x3b')](function(_0x2db75d){if(_0x2db75d){return _0x2db75d?{'count':_0x2ce8e6,'rows':_0x2db75d}:null;}})[_0x7e26('0x3b')](respondWithResult(_0x9c3e44,null))[_0x7e26('0x40')](handleError(_0x9c3e44,null));};exports[_0x7e26('0x4f')]=function(_0x4aec16,_0x14159b,_0x91f569){if(_0x4aec16[_0x7e26('0x44')]['id']){delete _0x4aec16[_0x7e26('0x44')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4aec16['params']['id']}})[_0x7e26('0x3b')](handleEntityNotFound(_0x14159b,null))[_0x7e26('0x3b')](function(_0x4bd8f9){if(_0x4bd8f9){return _0x4bd8f9[_0x7e26('0x4f')](_0x4aec16[_0x7e26('0x44')][_0x7e26('0x50')]||[]);}return null;})[_0x7e26('0x3b')](respondWithResult(_0x14159b,null))[_0x7e26('0x40')](handleError(_0x14159b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4786a0b..01b4d0f 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 _0xc80e=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2aedd3,_0x1aff78){var _0x39bf3c=function(_0x19ed60){while(--_0x19ed60){_0x2aedd3['push'](_0x2aedd3['shift']());}};_0x39bf3c(++_0x1aff78);}(_0xc80e,0x19b));var _0xec80=function(_0x51cabf,_0x2828db){_0x51cabf=_0x51cabf-0x0;var _0x517538=_0xc80e[_0x51cabf];return _0x517538;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var logger=require(_0xec80('0x2'))(_0xec80('0x3'));var moment=require('moment');var BPromise=require(_0xec80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec80('0x5'));var rimraf=require(_0xec80('0x6'));var config=require(_0xec80('0x7'));var attributes=require(_0xec80('0x8'));module['exports']=function(_0x1c9573,_0x585cb7){return _0x1c9573[_0xec80('0x9')](_0xec80('0xa'),attributes,{'tableName':_0xec80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefd4=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x1a46fa,_0x44876e){var _0x492be8=function(_0x2dba34){while(--_0x2dba34){_0x1a46fa['push'](_0x1a46fa['shift']());}};_0x492be8(++_0x44876e);}(_0xefd4,0x184));var _0x4efd=function(_0x418c4e,_0x6095cd){_0x418c4e=_0x418c4e-0x0;var _0x5126ac=_0xefd4[_0x418c4e];return _0x5126ac;};'use strict';var _=require(_0x4efd('0x0'));var util=require(_0x4efd('0x1'));var logger=require('../../config/logger')(_0x4efd('0x2'));var moment=require('moment');var BPromise=require(_0x4efd('0x3'));var rp=require(_0x4efd('0x4'));var fs=require('fs');var path=require(_0x4efd('0x5'));var rimraf=require('rimraf');var config=require(_0x4efd('0x6'));var attributes=require(_0x4efd('0x7'));module['exports']=function(_0x53d3d5,_0x64987c){return _0x53d3d5[_0x4efd('0x8')](_0x4efd('0x9'),attributes,{'tableName':_0x4efd('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 697df7a..4afd87e 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 _0xa6d2=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2821a9,_0x54d53f){var _0x30bf24=function(_0x4ed1f5){while(--_0x4ed1f5){_0x2821a9['push'](_0x2821a9['shift']());}};_0x30bf24(++_0x54d53f);}(_0xa6d2,0xd7));var _0x2a6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6d2[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x2a6d('0x0'));var moment=require(_0x2a6d('0x1'));var BPromise=require(_0x2a6d('0x2'));var rs=require(_0x2a6d('0x3'));var fs=require('fs');var Redis=require(_0x2a6d('0x4'));var db=require(_0x2a6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a6d('0x6'))(_0x2a6d('0x7'));var config=require(_0x2a6d('0x8'));var jayson=require(_0x2a6d('0x9'));var client=jayson[_0x2a6d('0xa')][_0x2a6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a6af0,_0x1047f2,_0x53a24d){return new BPromise(function(_0x5c453b,_0x2bf9de){return client[_0x2a6d('0xc')](_0x5a6af0,_0x53a24d)['then'](function(_0x30e444){logger[_0x2a6d('0xd')](_0x2a6d('0xe'),_0x1047f2,_0x2a6d('0xf'));logger['debug'](_0x2a6d('0x10'),_0x1047f2,_0x2a6d('0xf'),JSON[_0x2a6d('0x11')](_0x30e444));if(_0x30e444[_0x2a6d('0x12')]){if(_0x30e444[_0x2a6d('0x12')]['code']===0x1f4){logger['error'](_0x2a6d('0xe'),_0x1047f2,_0x30e444[_0x2a6d('0x12')][_0x2a6d('0x13')]);return _0x2bf9de(_0x30e444[_0x2a6d('0x12')][_0x2a6d('0x13')]);}logger[_0x2a6d('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1047f2,_0x30e444['error']['message']);return _0x5c453b(_0x30e444['error'][_0x2a6d('0x13')]);}else{logger[_0x2a6d('0xd')](_0x2a6d('0xe'),_0x1047f2,_0x2a6d('0xf'));_0x5c453b(_0x30e444['result']['message']);}})[_0x2a6d('0x14')](function(_0x40ea23){logger[_0x2a6d('0x12')](_0x2a6d('0xe'),_0x1047f2,_0x40ea23);_0x2bf9de(_0x40ea23);});});} \ No newline at end of file +var _0xab3e=['../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x318acd,_0x249413){var _0x214bb4=function(_0x30a1c0){while(--_0x30a1c0){_0x318acd['push'](_0x318acd['shift']());}};_0x214bb4(++_0x249413);}(_0xab3e,0xff));var _0xeab3=function(_0x150322,_0x2199fb){_0x150322=_0x150322-0x0;var _0x606a08=_0xab3e[_0x150322];return _0x606a08;};'use strict';var _=require('lodash');var util=require(_0xeab3('0x0'));var moment=require(_0xeab3('0x1'));var BPromise=require(_0xeab3('0x2'));var rs=require(_0xeab3('0x3'));var fs=require('fs');var Redis=require(_0xeab3('0x4'));var db=require(_0xeab3('0x5'))['db'];var utils=require(_0xeab3('0x6'));var logger=require(_0xeab3('0x7'))(_0xeab3('0x8'));var config=require(_0xeab3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeab3('0xa')][_0xeab3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6d04c4,_0xc4db8,_0x4bd0b9){return new BPromise(function(_0x415008,_0x395099){return client[_0xeab3('0xc')](_0x6d04c4,_0x4bd0b9)[_0xeab3('0xd')](function(_0x6399db){logger[_0xeab3('0xe')](_0xeab3('0xf'),_0xc4db8,_0xeab3('0x10'));logger[_0xeab3('0x11')](_0xeab3('0x12'),_0xc4db8,_0xeab3('0x10'),JSON[_0xeab3('0x13')](_0x6399db));if(_0x6399db[_0xeab3('0x14')]){if(_0x6399db[_0xeab3('0x14')]['code']===0x1f4){logger[_0xeab3('0x14')](_0xeab3('0xf'),_0xc4db8,_0x6399db[_0xeab3('0x14')][_0xeab3('0x15')]);return _0x395099(_0x6399db[_0xeab3('0x14')][_0xeab3('0x15')]);}logger[_0xeab3('0x14')](_0xeab3('0xf'),_0xc4db8,_0x6399db[_0xeab3('0x14')]['message']);return _0x415008(_0x6399db[_0xeab3('0x14')]['message']);}else{logger[_0xeab3('0xe')](_0xeab3('0xf'),_0xc4db8,_0xeab3('0x10'));_0x415008(_0x6399db[_0xeab3('0x16')]['message']);}})[_0xeab3('0x17')](function(_0x507e71){logger[_0xeab3('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xc4db8,_0x507e71);_0x395099(_0x507e71);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 71a9d15..1fe062c 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 _0xd350=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','get','/:id','show','delete','exports'];(function(_0x314323,_0x2b5ce9){var _0x56925=function(_0x325f6a){while(--_0x325f6a){_0x314323['push'](_0x314323['shift']());}};_0x56925(++_0x2b5ce9);}(_0xd350,0x9a));var _0x0d35=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xd350[_0x1fa381];return _0x47eefe;};'use strict';var multer=require(_0x0d35('0x0'));var util=require(_0x0d35('0x1'));var path=require(_0x0d35('0x2'));var timeout=require(_0x0d35('0x3'));var express=require('express');var router=express[_0x0d35('0x4')]();var fs_extra=require(_0x0d35('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0d35('0x6'));var config=require('../../config/environment');var controller=require(_0x0d35('0x7'));router['get']('/',auth[_0x0d35('0x8')](),controller['index']);router[_0x0d35('0x9')](_0x0d35('0xa'),auth['isAuthenticated'](),controller[_0x0d35('0xb')]);router['post']('/',auth[_0x0d35('0x8')](),controller['create']);router['put'](_0x0d35('0xa'),auth[_0x0d35('0x8')](),controller['update']);router[_0x0d35('0xc')](_0x0d35('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d35('0xd')]=router; \ No newline at end of file +var _0x08cf=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','get'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0x08cf,0xbd));var _0xf08c=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x08cf[_0x37a7c6];return _0x539905;};'use strict';var multer=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var path=require(_0xf08c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf08c('0x3'));var interaction=require(_0xf08c('0x4'));var config=require(_0xf08c('0x5'));var controller=require(_0xf08c('0x6'));router['get']('/',auth[_0xf08c('0x7')](),controller['index']);router[_0xf08c('0x8')](_0xf08c('0x9'),auth['isAuthenticated'](),controller[_0xf08c('0xa')]);router[_0xf08c('0xb')]('/',auth[_0xf08c('0x7')](),controller[_0xf08c('0xc')]);router[_0xf08c('0xd')](_0xf08c('0x9'),auth[_0xf08c('0x7')](),controller[_0xf08c('0xe')]);router[_0xf08c('0xf')](_0xf08c('0x9'),auth[_0xf08c('0x7')](),controller[_0xf08c('0x10')]);module[_0xf08c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 035a0cb..1c9dfa4 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 _0xd858=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x57a2c9,_0x1b48b4){var _0x29b1ed=function(_0x13fcd5){while(--_0x13fcd5){_0x57a2c9['push'](_0x57a2c9['shift']());}};_0x29b1ed(++_0x1b48b4);}(_0xd858,0xc8));var _0x8d85=function(_0x4cd065,_0x18d8b9){_0x4cd065=_0x4cd065-0x0;var _0x189891=_0xd858[_0x4cd065];return _0x189891;};'use strict';var Sequelize=require(_0x8d85('0x0'));module[_0x8d85('0x1')]={'type':{'type':Sequelize[_0x8d85('0x2')](_0x8d85('0x3'),_0x8d85('0x4'),_0x8d85('0x5'),_0x8d85('0x6'),_0x8d85('0x7')),'defaultValue':_0x8d85('0x3')},'content':{'type':Sequelize[_0x8d85('0x8')]},'key':{'type':Sequelize[_0x8d85('0x8')]},'keyType':{'type':Sequelize[_0x8d85('0x2')](_0x8d85('0x3'),'variable',_0x8d85('0x5'))},'keyContent':{'type':Sequelize[_0x8d85('0x8')]},'idField':{'type':Sequelize[_0x8d85('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8d85('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8d85('0x8')]}}; \ No newline at end of file +var _0x5867=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0xbe59fa,_0x530be0){var _0x135e7e=function(_0x42b33e){while(--_0x42b33e){_0xbe59fa['push'](_0xbe59fa['shift']());}};_0x135e7e(++_0x530be0);}(_0x5867,0xa9));var _0x7586=function(_0x4ce84c,_0x56b698){_0x4ce84c=_0x4ce84c-0x0;var _0x3a4601=_0x5867[_0x4ce84c];return _0x3a4601;};'use strict';var Sequelize=require(_0x7586('0x0'));module[_0x7586('0x1')]={'type':{'type':Sequelize[_0x7586('0x2')](_0x7586('0x3'),_0x7586('0x4'),_0x7586('0x5'),_0x7586('0x6'),_0x7586('0x7')),'defaultValue':_0x7586('0x3')},'content':{'type':Sequelize[_0x7586('0x8')]},'key':{'type':Sequelize[_0x7586('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x7586('0x3'),_0x7586('0x4'),_0x7586('0x5'))},'keyContent':{'type':Sequelize[_0x7586('0x8')]},'idField':{'type':Sequelize[_0x7586('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7586('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 6ce1a37..223b999 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 _0xc901=['save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x325736,_0x5a310c){var _0x4d7e25=function(_0x1e41fd){while(--_0x1e41fd){_0x325736['push'](_0x325736['shift']());}};_0x4d7e25(++_0x5a310c);}(_0xc901,0x142));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={},_0x35c843={},_0x52c308={'count':0x0,'rows':[]};var _0xc1a571=_[_0x1c90('0x2a')](db[_0x1c90('0x2b')][_0x1c90('0x2c')],function(_0x1979de){return{'name':_0x1979de[_0x1c90('0x2d')],'type':_0x1979de[_0x1c90('0x2e')][_0x1c90('0x2f')]};});_0x35c843[_0x1c90('0x30')]=_[_0x1c90('0x2a')](_0xc1a571,_0x1c90('0x27'));_0x35c843['query']=_[_0x1c90('0x31')](_0x395edb[_0x1c90('0x32')]);_0x35c843['filters']=_[_0x1c90('0x33')](_0x35c843['model'],_0x35c843[_0x1c90('0x32')]);_0xd0a607['attributes']=_[_0x1c90('0x33')](_0x35c843['model'],qs[_0x1c90('0x34')](_0x395edb[_0x1c90('0x32')]['fields']));_0xd0a607[_0x1c90('0x35')]=_0xd0a607[_0x1c90('0x35')]['length']?_0xd0a607[_0x1c90('0x35')]:_0x35c843[_0x1c90('0x30')];if(!_0x395edb[_0x1c90('0x32')][_0x1c90('0x36')](_0x1c90('0x37'))){_0xd0a607['limit']=qs['limit'](_0x395edb['query']['limit']);_0xd0a607['offset']=qs[_0x1c90('0x1a')](_0x395edb[_0x1c90('0x32')][_0x1c90('0x1a')]);}_0xd0a607['order']=qs[_0x1c90('0x38')](_0x395edb['query'][_0x1c90('0x38')]);_0xd0a607[_0x1c90('0x39')]=qs['filters'](_['pick'](_0x395edb[_0x1c90('0x32')],_0x35c843[_0x1c90('0x3a')]),_0xc1a571);if(_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]){_0xd0a607[_0x1c90('0x39')]=_[_0x1c90('0x3c')](_0xd0a607[_0x1c90('0x39')],{'$or':_['map'](_0xc1a571,function(_0x508025){if(_0x508025[_0x1c90('0x2e')]!==_0x1c90('0x3d')){var _0x134501={};_0x134501[_0x508025[_0x1c90('0x27')]]={'$like':'%'+_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]+'%'};return _0x134501;}})});}_0xd0a607=_[_0x1c90('0x3c')]({},_0xd0a607,_0x395edb[_0x1c90('0x3e')]);var _0x398ee9={'where':_0xd0a607[_0x1c90('0x39')]};return db['FreshdeskField'][_0x1c90('0x1d')](_0x398ee9)['then'](function(_0x5a8eea){_0x52c308[_0x1c90('0x1d')]=_0x5a8eea;if(_0x395edb['query']['includeAll']){_0xd0a607[_0x1c90('0x3f')]=[{'all':!![]}];}return db[_0x1c90('0x2b')]['findAll'](_0xd0a607);})[_0x1c90('0x24')](function(_0x3271ea){_0x52c308[_0x1c90('0x40')]=_0x3271ea;return _0x52c308;})[_0x1c90('0x24')](respondWithFilteredResult(_0x111e20,_0xd0a607))['catch'](handleError(_0x111e20,null));};exports['show']=function(_0x19e689,_0x171ca0){var _0x5680fe={'raw':!![],'where':{'id':_0x19e689['params']['id']}},_0x35952a={};_0x35952a[_0x1c90('0x30')]=_[_0x1c90('0x31')](db['FreshdeskField'][_0x1c90('0x2c')]);_0x35952a[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x19e689[_0x1c90('0x32')]);_0x35952a[_0x1c90('0x3a')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],_0x35952a[_0x1c90('0x32')]);_0x5680fe[_0x1c90('0x35')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],qs['fields'](_0x19e689[_0x1c90('0x32')]['fields']));_0x5680fe[_0x1c90('0x35')]=_0x5680fe['attributes']['length']?_0x5680fe[_0x1c90('0x35')]:_0x35952a[_0x1c90('0x30')];if(_0x19e689[_0x1c90('0x32')][_0x1c90('0x41')]){_0x5680fe[_0x1c90('0x3f')]=[{'all':!![]}];}_0x5680fe=_[_0x1c90('0x3c')]({},_0x5680fe,_0x19e689[_0x1c90('0x3e')]);return db[_0x1c90('0x2b')][_0x1c90('0x42')](_0x5680fe)['then'](handleEntityNotFound(_0x171ca0,null))['then'](respondWithResult(_0x171ca0,null))[_0x1c90('0x43')](handleError(_0x171ca0,null));};exports[_0x1c90('0x44')]=function(_0x68fac8,_0x2d30f5){return db[_0x1c90('0x2b')][_0x1c90('0x44')](_0x68fac8[_0x1c90('0x45')],{})[_0x1c90('0x24')](respondWithResult(_0x2d30f5,0xc9))['catch'](handleError(_0x2d30f5,null));};exports[_0x1c90('0x22')]=function(_0x24016a,_0x9524b6){if(_0x24016a['body']['id']){delete _0x24016a['body']['id'];}return db[_0x1c90('0x2b')]['find']({'where':{'id':_0x24016a[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x9524b6,null))['then'](saveUpdates(_0x24016a[_0x1c90('0x45')],null))[_0x1c90('0x24')](respondWithResult(_0x9524b6,null))['catch'](handleError(_0x9524b6,null));};exports['destroy']=function(_0x394177,_0x53f158){return db[_0x1c90('0x2b')][_0x1c90('0x42')]({'where':{'id':_0x394177[_0x1c90('0x46')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x53f158,null))['then'](removeEntity(_0x53f158,null))['catch'](handleError(_0x53f158,null));}; \ No newline at end of file +var _0x5db8=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','map','FreshdeskField','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x5db8,0xbb));var _0x85db=function(_0x1e5b8b,_0x4937be){_0x1e5b8b=_0x1e5b8b-0x0;var _0x59393f=_0x5db8[_0x1e5b8b];return _0x59393f;};'use strict';var emlformat=require(_0x85db('0x0'));var rimraf=require(_0x85db('0x1'));var zipdir=require(_0x85db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85db('0x3'));var moment=require(_0x85db('0x4'));var BPromise=require(_0x85db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x85db('0x6'));var sox=require(_0x85db('0x7'));var csv=require(_0x85db('0x8'));var ejs=require(_0x85db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85db('0x15'))['db'];function respondWithStatusCode(_0x541f2f,_0x437f7a){_0x437f7a=_0x437f7a||0xcc;return function(_0x35f8c6){if(_0x35f8c6){return _0x541f2f[_0x85db('0x16')](_0x437f7a);}return _0x541f2f[_0x85db('0x17')](_0x437f7a)[_0x85db('0x18')]();};}function respondWithResult(_0xb7ea66,_0x2b7507){_0x2b7507=_0x2b7507||0xc8;return function(_0x25ec64){if(_0x25ec64){return _0xb7ea66[_0x85db('0x17')](_0x2b7507)[_0x85db('0x19')](_0x25ec64);}};}function respondWithFilteredResult(_0x1e9dec,_0x270fd7){return function(_0x2be61d){if(_0x2be61d){var _0x5ccfef=typeof _0x270fd7[_0x85db('0x1a')]===_0x85db('0x1b')&&typeof _0x270fd7[_0x85db('0x1c')]===_0x85db('0x1b');var _0x2ecd71=_0x2be61d[_0x85db('0x1d')];var _0x3209b3=_0x5ccfef?0x0:_0x270fd7['offset'];var _0x37ac04=_0x5ccfef?_0x2be61d[_0x85db('0x1d')]:_0x270fd7[_0x85db('0x1a')]+_0x270fd7[_0x85db('0x1c')];var _0x4d976d;if(_0x37ac04>=_0x2ecd71){_0x37ac04=_0x2ecd71;_0x4d976d=0xc8;}else{_0x4d976d=0xce;}_0x1e9dec[_0x85db('0x17')](_0x4d976d);return _0x1e9dec[_0x85db('0x1e')](_0x85db('0x1f'),_0x3209b3+'-'+_0x37ac04+'/'+_0x2ecd71)[_0x85db('0x19')](_0x2be61d);}return null;};}function patchUpdates(_0x107c10){return function(_0x5c37d7){try{jsonpatch[_0x85db('0x20')](_0x5c37d7,_0x107c10,!![]);}catch(_0x398aa2){return BPromise[_0x85db('0x21')](_0x398aa2);}return _0x5c37d7[_0x85db('0x22')]();};}function saveUpdates(_0x44c122,_0x3842d7){return function(_0x3a7148){if(_0x3a7148){return _0x3a7148[_0x85db('0x23')](_0x44c122)['then'](function(_0xfffea2){return _0xfffea2;});}return null;};}function removeEntity(_0x2534bc,_0x57fe5b){return function(_0x3381ec){if(_0x3381ec){return _0x3381ec[_0x85db('0x24')]()[_0x85db('0x25')](function(){_0x2534bc['status'](0xcc)[_0x85db('0x18')]();});}};}function handleEntityNotFound(_0x46f428,_0x1b1980){return function(_0x54ba03){if(!_0x54ba03){_0x46f428['sendStatus'](0x194);}return _0x54ba03;};}function handleError(_0x50ea52,_0x1e4ddb){_0x1e4ddb=_0x1e4ddb||0x1f4;return function(_0x105bb9){logger[_0x85db('0x26')](_0x105bb9['stack']);if(_0x105bb9[_0x85db('0x27')]){delete _0x105bb9[_0x85db('0x27')];}_0x50ea52[_0x85db('0x17')](_0x1e4ddb)['send'](_0x105bb9);};}exports['index']=function(_0x299013,_0x137e42){var _0x18963a={},_0x226540={},_0x397afc={'count':0x0,'rows':[]};var _0x16ee2a=_[_0x85db('0x28')](db[_0x85db('0x29')][_0x85db('0x2a')],function(_0x1edc8d){return{'name':_0x1edc8d['fieldName'],'type':_0x1edc8d['type'][_0x85db('0x2b')]};});_0x226540['model']=_[_0x85db('0x28')](_0x16ee2a,_0x85db('0x27'));_0x226540['query']=_[_0x85db('0x2c')](_0x299013[_0x85db('0x2d')]);_0x226540[_0x85db('0x2e')]=_[_0x85db('0x2f')](_0x226540['model'],_0x226540[_0x85db('0x2d')]);_0x18963a[_0x85db('0x30')]=_[_0x85db('0x2f')](_0x226540[_0x85db('0x31')],qs[_0x85db('0x32')](_0x299013['query'][_0x85db('0x32')]));_0x18963a[_0x85db('0x30')]=_0x18963a[_0x85db('0x30')][_0x85db('0x33')]?_0x18963a['attributes']:_0x226540[_0x85db('0x31')];if(!_0x299013[_0x85db('0x2d')][_0x85db('0x34')]('nolimit')){_0x18963a['limit']=qs[_0x85db('0x1c')](_0x299013[_0x85db('0x2d')]['limit']);_0x18963a[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x299013[_0x85db('0x2d')][_0x85db('0x1a')]);}_0x18963a[_0x85db('0x35')]=qs[_0x85db('0x36')](_0x299013[_0x85db('0x2d')][_0x85db('0x36')]);_0x18963a[_0x85db('0x37')]=qs[_0x85db('0x2e')](_[_0x85db('0x38')](_0x299013[_0x85db('0x2d')],_0x226540['filters']),_0x16ee2a);if(_0x299013[_0x85db('0x2d')][_0x85db('0x39')]){_0x18963a[_0x85db('0x37')]=_[_0x85db('0x3a')](_0x18963a['where'],{'$or':_[_0x85db('0x28')](_0x16ee2a,function(_0x31d169){if(_0x31d169[_0x85db('0x3b')]!==_0x85db('0x3c')){var _0x5a759d={};_0x5a759d[_0x31d169['name']]={'$like':'%'+_0x299013['query']['filter']+'%'};return _0x5a759d;}})});}_0x18963a=_['merge']({},_0x18963a,_0x299013[_0x85db('0x3d')]);var _0x164f0d={'where':_0x18963a[_0x85db('0x37')]};return db[_0x85db('0x29')][_0x85db('0x1d')](_0x164f0d)['then'](function(_0x524d37){_0x397afc[_0x85db('0x1d')]=_0x524d37;if(_0x299013['query'][_0x85db('0x3e')]){_0x18963a[_0x85db('0x3f')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x18963a);})[_0x85db('0x25')](function(_0x928808){_0x397afc[_0x85db('0x40')]=_0x928808;return _0x397afc;})[_0x85db('0x25')](respondWithFilteredResult(_0x137e42,_0x18963a))[_0x85db('0x41')](handleError(_0x137e42,null));};exports['show']=function(_0x2ea6f5,_0x1eda71){var _0x115720={'raw':!![],'where':{'id':_0x2ea6f5['params']['id']}},_0x5be721={};_0x5be721['model']=_[_0x85db('0x2c')](db[_0x85db('0x29')][_0x85db('0x2a')]);_0x5be721['query']=_['keys'](_0x2ea6f5[_0x85db('0x2d')]);_0x5be721['filters']=_[_0x85db('0x2f')](_0x5be721[_0x85db('0x31')],_0x5be721[_0x85db('0x2d')]);_0x115720['attributes']=_[_0x85db('0x2f')](_0x5be721[_0x85db('0x31')],qs[_0x85db('0x32')](_0x2ea6f5[_0x85db('0x2d')][_0x85db('0x32')]));_0x115720[_0x85db('0x30')]=_0x115720[_0x85db('0x30')][_0x85db('0x33')]?_0x115720[_0x85db('0x30')]:_0x5be721['model'];if(_0x2ea6f5[_0x85db('0x2d')][_0x85db('0x3e')]){_0x115720[_0x85db('0x3f')]=[{'all':!![]}];}_0x115720=_[_0x85db('0x3a')]({},_0x115720,_0x2ea6f5[_0x85db('0x3d')]);return db[_0x85db('0x29')]['find'](_0x115720)[_0x85db('0x25')](handleEntityNotFound(_0x1eda71,null))[_0x85db('0x25')](respondWithResult(_0x1eda71,null))[_0x85db('0x41')](handleError(_0x1eda71,null));};exports['create']=function(_0x5ed8c8,_0x1350ae){return db['FreshdeskField'][_0x85db('0x42')](_0x5ed8c8[_0x85db('0x43')],{})[_0x85db('0x25')](respondWithResult(_0x1350ae,0xc9))[_0x85db('0x41')](handleError(_0x1350ae,null));};exports[_0x85db('0x23')]=function(_0x5e1455,_0x5d44ef){if(_0x5e1455[_0x85db('0x43')]['id']){delete _0x5e1455[_0x85db('0x43')]['id'];}return db[_0x85db('0x29')][_0x85db('0x44')]({'where':{'id':_0x5e1455[_0x85db('0x45')]['id']}})[_0x85db('0x25')](handleEntityNotFound(_0x5d44ef,null))[_0x85db('0x25')](saveUpdates(_0x5e1455[_0x85db('0x43')],null))[_0x85db('0x25')](respondWithResult(_0x5d44ef,null))[_0x85db('0x41')](handleError(_0x5d44ef,null));};exports['destroy']=function(_0x69c505,_0x2c4ae4){return db['FreshdeskField']['find']({'where':{'id':_0x69c505[_0x85db('0x45')]['id']}})[_0x85db('0x25')](handleEntityNotFound(_0x2c4ae4,null))['then'](removeEntity(_0x2c4ae4,null))['catch'](handleError(_0x2c4ae4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c0acbc5..c430106 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 _0x3228=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise'];(function(_0x3bf605,_0xfda59f){var _0x592e91=function(_0x4730fb){while(--_0x4730fb){_0x3bf605['push'](_0x3bf605['shift']());}};_0x592e91(++_0xfda59f);}(_0x3228,0x181));var _0x8322=function(_0x2f4e6a,_0x235880){_0x2f4e6a=_0x2f4e6a-0x0;var _0x37bacf=_0x3228[_0x2f4e6a];return _0x37bacf;};'use strict';var _=require(_0x8322('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8322('0x1'));var moment=require(_0x8322('0x2'));var BPromise=require(_0x8322('0x3'));var rp=require(_0x8322('0x4'));var fs=require('fs');var path=require(_0x8322('0x5'));var rimraf=require(_0x8322('0x6'));var config=require(_0x8322('0x7'));var attributes=require(_0x8322('0x8'));module[_0x8322('0x9')]=function(_0x4979e7,_0x2d3f72){return _0x4979e7[_0x8322('0xa')]('FreshdeskField',attributes,{'tableName':_0x8322('0xb'),'paranoid':![],'indexes':[{'name':_0x8322('0xc'),'fields':[_0x8322('0xd'),_0x8322('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4aa=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird'];(function(_0x5ac5c7,_0x3e5ecd){var _0x1eede1=function(_0x128357){while(--_0x128357){_0x5ac5c7['push'](_0x5ac5c7['shift']());}};_0x1eede1(++_0x3e5ecd);}(_0xb4aa,0xdd));var _0xab4a=function(_0x32ca43,_0x3ccdb6){_0x32ca43=_0x32ca43-0x0;var _0x562297=_0xb4aa[_0x32ca43];return _0x562297;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab4a('0x0'))(_0xab4a('0x1'));var moment=require(_0xab4a('0x2'));var BPromise=require(_0xab4a('0x3'));var rp=require(_0xab4a('0x4'));var fs=require('fs');var path=require(_0xab4a('0x5'));var rimraf=require(_0xab4a('0x6'));var config=require(_0xab4a('0x7'));var attributes=require(_0xab4a('0x8'));module['exports']=function(_0x4d67bb,_0x3a0292){return _0x4d67bb[_0xab4a('0x9')](_0xab4a('0xa'),attributes,{'tableName':_0xab4a('0xb'),'paranoid':![],'indexes':[{'name':_0xab4a('0xc'),'fields':[_0xab4a('0xd'),_0xab4a('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 3b920e9..27c7975 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 _0x949d=['then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x949d,0xe7));var _0xd949=function(_0x49c1ca,_0x2764f2){_0x49c1ca=_0x49c1ca-0x0;var _0x15379e=_0x949d[_0x49c1ca];return _0x15379e;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var moment=require('moment');var BPromise=require(_0xd949('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd949('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd949('0x4'));var logger=require(_0xd949('0x5'))(_0xd949('0x6'));var config=require(_0xd949('0x7'));var jayson=require(_0xd949('0x8'));var client=jayson[_0xd949('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x208cf7,_0x59eed6,_0xc094f1){return new BPromise(function(_0x365378,_0x312cd8){return client[_0xd949('0xa')](_0x208cf7,_0xc094f1)[_0xd949('0xb')](function(_0x35d67c){logger['info'](_0xd949('0xc'),_0x59eed6,_0xd949('0xd'));logger[_0xd949('0xe')](_0xd949('0xf'),_0x59eed6,'request\x20sent',JSON['stringify'](_0x35d67c));if(_0x35d67c[_0xd949('0x10')]){if(_0x35d67c['error'][_0xd949('0x11')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x59eed6,_0x35d67c[_0xd949('0x10')]['message']);return _0x312cd8(_0x35d67c[_0xd949('0x10')][_0xd949('0x12')]);}logger['error'](_0xd949('0xc'),_0x59eed6,_0x35d67c['error'][_0xd949('0x12')]);return _0x365378(_0x35d67c['error'][_0xd949('0x12')]);}else{logger[_0xd949('0x13')](_0xd949('0xc'),_0x59eed6,_0xd949('0xd'));_0x365378(_0x35d67c[_0xd949('0x14')]['message']);}})[_0xd949('0x15')](function(_0x4635ba){logger[_0xd949('0x10')](_0xd949('0xc'),_0x59eed6,_0x4635ba);_0x312cd8(_0x4635ba);});});} \ No newline at end of file +var _0x5800=['../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x5ea81f,_0x465b4e){var _0x38fbcc=function(_0x4e14c9){while(--_0x4e14c9){_0x5ea81f['push'](_0x5ea81f['shift']());}};_0x38fbcc(++_0x465b4e);}(_0x5800,0x165));var _0x0580=function(_0x5d7d6b,_0x3e1cde){_0x5d7d6b=_0x5d7d6b-0x0;var _0x2e5b64=_0x5800[_0x5d7d6b];return _0x2e5b64;};'use strict';var _=require(_0x0580('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0580('0x1'));var fs=require('fs');var Redis=require(_0x0580('0x2'));var db=require(_0x0580('0x3'))['db'];var utils=require(_0x0580('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0580('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0580('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2678,_0x590196,_0x561f17){return new BPromise(function(_0x4eb4a9,_0x22124a){return client[_0x0580('0x7')](_0x1e2678,_0x561f17)[_0x0580('0x8')](function(_0x41b9ec){logger[_0x0580('0x9')](_0x0580('0xa'),_0x590196,'request\x20sent');logger[_0x0580('0xb')](_0x0580('0xc'),_0x590196,_0x0580('0xd'),JSON[_0x0580('0xe')](_0x41b9ec));if(_0x41b9ec[_0x0580('0xf')]){if(_0x41b9ec['error'][_0x0580('0x10')]===0x1f4){logger[_0x0580('0xf')](_0x0580('0xa'),_0x590196,_0x41b9ec[_0x0580('0xf')][_0x0580('0x11')]);return _0x22124a(_0x41b9ec[_0x0580('0xf')][_0x0580('0x11')]);}logger[_0x0580('0xf')](_0x0580('0xa'),_0x590196,_0x41b9ec[_0x0580('0xf')]['message']);return _0x4eb4a9(_0x41b9ec['error'][_0x0580('0x11')]);}else{logger['info'](_0x0580('0xa'),_0x590196,_0x0580('0xd'));_0x4eb4a9(_0x41b9ec[_0x0580('0x12')][_0x0580('0x11')]);}})[_0x0580('0x13')](function(_0xfc84cb){logger[_0x0580('0xf')](_0x0580('0xa'),_0x590196,_0xfc84cb);_0x22124a(_0xfc84cb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 97c3fcf..f8e0306 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 _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x41c673,_0x397d52){var _0x429cd9=function(_0x39084e){while(--_0x39084e){_0x41c673['push'](_0x41c673['shift']());}};_0x429cd9(++_0x397d52);}(_0xdb94,0xab));var _0x4db9=function(_0x125816,_0x4db4f6){_0x125816=_0x125816-0x0;var _0x45ff99=_0xdb94[_0x125816];return _0x45ff99;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('0x16')]=router; \ No newline at end of file +var _0xe511=['get','index','show','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x214c12,_0xbe93fe){var _0x38906c=function(_0x241f60){while(--_0x241f60){_0x214c12['push'](_0x214c12['shift']());}};_0x38906c(++_0xbe93fe);}(_0xe511,0x16f));var _0x1e51=function(_0x66dd2a,_0x3a7420){_0x66dd2a=_0x66dd2a-0x0;var _0x3924ec=_0xe511[_0x66dd2a];return _0x3924ec;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0xf')](_0x1e51('0x11'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x13')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x14')]);router[_0x1e51('0x15')](_0x1e51('0x16'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x17')]);module[_0x1e51('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b92cb46..b305ef7 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 _0x8603=['remoteUri','exports','STRING'];(function(_0x55a03a,_0x194806){var _0x3ae934=function(_0x4a46cf){while(--_0x4a46cf){_0x55a03a['push'](_0x55a03a['shift']());}};_0x3ae934(++_0x194806);}(_0x8603,0x190));var _0x3860=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x8603[_0x128450];return _0x4d80ed;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1e050a,_0x126b0c){var _0xe09172=function(_0x1b6b6f){while(--_0x1b6b6f){_0x1e050a['push'](_0x1e050a['shift']());}};_0xe09172(++_0x126b0c);}(_0x4213,0x77));var _0x3421=function(_0x77daf8,_0x370634){_0x77daf8=_0x77daf8-0x0;var _0x1a6b62=_0x4213[_0x77daf8];return _0x1a6b62;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e9e9291..ceea421 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 _0x8e15=['email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','params','keys','merge','find','create','body','catch','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','Subjects','channel','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','slice','substring','GET','format','%s%s','Token\x20token=','users'];(function(_0x163b4a,_0x355bc0){var _0x2446c4=function(_0x536a25){while(--_0x536a25){_0x163b4a['push'](_0x163b4a['shift']());}};_0x2446c4(++_0x355bc0);}(_0x8e15,0x69));var _0x58e1=function(_0x4b6f5c,_0x56f7ce){_0x4b6f5c=_0x4b6f5c-0x0;var _0x55548b=_0x8e15[_0x4b6f5c];return _0x55548b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58e1('0x0'));var zipdir=require(_0x58e1('0x1'));var jsonpatch=require(_0x58e1('0x2'));var rp=require(_0x58e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x58e1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x58e1('0x5'));var csv=require('to-csv');var ejs=require(_0x58e1('0x6'));var fs=require('fs');var fs_extra=require(_0x58e1('0x7'));var _=require(_0x58e1('0x8'));var squel=require('squel');var crypto=require(_0x58e1('0x9'));var jsforce=require(_0x58e1('0xa'));var deskjs=require(_0x58e1('0xb'));var toCsv=require(_0x58e1('0xc'));var querystring=require('querystring');var Papa=require(_0x58e1('0xd'));var Redis=require('ioredis');var authService=require(_0x58e1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x58e1('0xf'));var hardwareService=require(_0x58e1('0x10'));var logger=require('../../config/logger')(_0x58e1('0x11'));var utils=require(_0x58e1('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x58e1('0x13'))['db'];var integrations=require(_0x58e1('0x14'));function respondWithStatusCode(_0x1558a7,_0x49a5fe){_0x49a5fe=_0x49a5fe||0xcc;return function(_0xd4ffda){if(_0xd4ffda){return _0x1558a7[_0x58e1('0x15')](_0x49a5fe);}return _0x1558a7[_0x58e1('0x16')](_0x49a5fe)['end']();};}function respondWithResult(_0xf60a13,_0x4360fe){_0x4360fe=_0x4360fe||0xc8;return function(_0x5951b5){if(_0x5951b5){return _0xf60a13['status'](_0x4360fe)[_0x58e1('0x17')](_0x5951b5);}};}function respondWithFilteredResult(_0x5782d0,_0x452b81){return function(_0x236ed9){if(_0x236ed9){var _0x4a40c6=typeof _0x452b81[_0x58e1('0x18')]===_0x58e1('0x19')&&typeof _0x452b81[_0x58e1('0x1a')]===_0x58e1('0x19');var _0x472bc6=_0x236ed9[_0x58e1('0x1b')];var _0x1789ae=_0x4a40c6?0x0:_0x452b81[_0x58e1('0x18')];var _0x47a421=_0x4a40c6?_0x236ed9[_0x58e1('0x1b')]:_0x452b81[_0x58e1('0x18')]+_0x452b81[_0x58e1('0x1a')];var _0x3fe23a;if(_0x47a421>=_0x472bc6){_0x47a421=_0x472bc6;_0x3fe23a=0xc8;}else{_0x3fe23a=0xce;}_0x5782d0[_0x58e1('0x16')](_0x3fe23a);return _0x5782d0['set']('Content-Range',_0x1789ae+'-'+_0x47a421+'/'+_0x472bc6)[_0x58e1('0x17')](_0x236ed9);}return null;};}function patchUpdates(_0x33a9ab){return function(_0x16eb99){try{jsonpatch['apply'](_0x16eb99,_0x33a9ab,!![]);}catch(_0x5f2b4e){return BPromise[_0x58e1('0x1c')](_0x5f2b4e);}return _0x16eb99[_0x58e1('0x1d')]();};}function saveUpdates(_0x523c90,_0x458c64){return function(_0x4f3237){if(_0x4f3237){return _0x4f3237[_0x58e1('0x1e')](_0x523c90)['then'](function(_0x568715){return _0x568715;});}return null;};}function removeEntity(_0x35b091,_0x10f2f6){return function(_0x5a14c9){if(_0x5a14c9){return _0x5a14c9[_0x58e1('0x1f')]()[_0x58e1('0x20')](function(){_0x35b091[_0x58e1('0x16')](0xcc)[_0x58e1('0x21')]();});}};}function handleEntityNotFound(_0x55f56a,_0x17c579){return function(_0x4b1ee6){if(!_0x4b1ee6){_0x55f56a[_0x58e1('0x15')](0x194);}return _0x4b1ee6;};}function handleError(_0x5c41a3,_0x41b357){_0x41b357=_0x41b357||0x1f4;return function(_0x54d598){logger[_0x58e1('0x22')](_0x54d598['stack']);if(_0x54d598[_0x58e1('0x23')]){delete _0x54d598[_0x58e1('0x23')];}_0x5c41a3[_0x58e1('0x16')](_0x41b357)[_0x58e1('0x24')](_0x54d598);};}exports[_0x58e1('0x25')]=function(_0x221594,_0xc3c7f1){var _0x1948e1={},_0x223be1={},_0x570376={'count':0x0,'rows':[]};var _0x4205b2=_[_0x58e1('0x26')](db['FreshsalesAccount'][_0x58e1('0x27')],function(_0x5f271b){return{'name':_0x5f271b[_0x58e1('0x28')],'type':_0x5f271b[_0x58e1('0x29')][_0x58e1('0x2a')]};});_0x223be1[_0x58e1('0x2b')]=_['map'](_0x4205b2,_0x58e1('0x23'));_0x223be1[_0x58e1('0x2c')]=_['keys'](_0x221594[_0x58e1('0x2c')]);_0x223be1[_0x58e1('0x2d')]=_[_0x58e1('0x2e')](_0x223be1[_0x58e1('0x2b')],_0x223be1[_0x58e1('0x2c')]);_0x1948e1[_0x58e1('0x2f')]=_[_0x58e1('0x2e')](_0x223be1[_0x58e1('0x2b')],qs[_0x58e1('0x30')](_0x221594['query'][_0x58e1('0x30')]));_0x1948e1['attributes']=_0x1948e1[_0x58e1('0x2f')][_0x58e1('0x31')]?_0x1948e1[_0x58e1('0x2f')]:_0x223be1['model'];if(!_0x221594[_0x58e1('0x2c')][_0x58e1('0x32')](_0x58e1('0x33'))){_0x1948e1['limit']=qs[_0x58e1('0x1a')](_0x221594[_0x58e1('0x2c')][_0x58e1('0x1a')]);_0x1948e1[_0x58e1('0x18')]=qs[_0x58e1('0x18')](_0x221594[_0x58e1('0x2c')][_0x58e1('0x18')]);}_0x1948e1[_0x58e1('0x34')]=qs['sort'](_0x221594[_0x58e1('0x2c')][_0x58e1('0x35')]);_0x1948e1[_0x58e1('0x36')]=qs[_0x58e1('0x2d')](_[_0x58e1('0x37')](_0x221594[_0x58e1('0x2c')],_0x223be1[_0x58e1('0x2d')]),_0x4205b2);if(_0x221594[_0x58e1('0x2c')][_0x58e1('0x38')]){_0x1948e1[_0x58e1('0x36')]=_['merge'](_0x1948e1[_0x58e1('0x36')],{'$or':_[_0x58e1('0x26')](_0x4205b2,function(_0x2f3df3){if(_0x2f3df3[_0x58e1('0x29')]!==_0x58e1('0x39')){var _0x4b0751={};_0x4b0751[_0x2f3df3[_0x58e1('0x23')]]={'$like':'%'+_0x221594['query'][_0x58e1('0x38')]+'%'};return _0x4b0751;}})});}_0x1948e1=_['merge']({},_0x1948e1,_0x221594[_0x58e1('0x3a')]);var _0xdf2b55={'where':_0x1948e1[_0x58e1('0x36')]};return db[_0x58e1('0x3b')][_0x58e1('0x1b')](_0xdf2b55)['then'](function(_0x43158d){_0x570376['count']=_0x43158d;if(_0x221594[_0x58e1('0x2c')][_0x58e1('0x3c')]){_0x1948e1[_0x58e1('0x3d')]=[{'all':!![]}];}return db[_0x58e1('0x3b')][_0x58e1('0x3e')](_0x1948e1);})[_0x58e1('0x20')](function(_0xa09de1){_0x570376[_0x58e1('0x3f')]=_0xa09de1;return _0x570376;})[_0x58e1('0x20')](respondWithFilteredResult(_0xc3c7f1,_0x1948e1))['catch'](handleError(_0xc3c7f1,null));};exports[_0x58e1('0x40')]=function(_0x7c37ad,_0x29b860){var _0x5cfee1={'raw':![],'where':{'id':_0x7c37ad[_0x58e1('0x41')]['id']}},_0x30bc88={};_0x30bc88[_0x58e1('0x2b')]=_[_0x58e1('0x42')](db['FreshsalesAccount'][_0x58e1('0x27')]);_0x30bc88[_0x58e1('0x2c')]=_['keys'](_0x7c37ad[_0x58e1('0x2c')]);_0x30bc88[_0x58e1('0x2d')]=_[_0x58e1('0x2e')](_0x30bc88['model'],_0x30bc88[_0x58e1('0x2c')]);_0x5cfee1[_0x58e1('0x2f')]=_[_0x58e1('0x2e')](_0x30bc88['model'],qs[_0x58e1('0x30')](_0x7c37ad['query'][_0x58e1('0x30')]));_0x5cfee1[_0x58e1('0x2f')]=_0x5cfee1[_0x58e1('0x2f')]['length']?_0x5cfee1[_0x58e1('0x2f')]:_0x30bc88[_0x58e1('0x2b')];if(_0x7c37ad[_0x58e1('0x2c')][_0x58e1('0x3c')]){_0x5cfee1[_0x58e1('0x3d')]=[{'all':!![]}];}_0x5cfee1=_[_0x58e1('0x43')]({},_0x5cfee1,_0x7c37ad[_0x58e1('0x3a')]);return db[_0x58e1('0x3b')][_0x58e1('0x44')](_0x5cfee1)[_0x58e1('0x20')](handleEntityNotFound(_0x29b860,null))['then'](respondWithResult(_0x29b860,null))['catch'](handleError(_0x29b860,null));};exports[_0x58e1('0x45')]=function(_0x5274d2,_0x5305a1){return db['FreshsalesAccount'][_0x58e1('0x45')](_0x5274d2[_0x58e1('0x46')],{})['then'](respondWithResult(_0x5305a1,0xc9))[_0x58e1('0x47')](handleError(_0x5305a1,null));};exports[_0x58e1('0x1e')]=function(_0x13cd24,_0x392f76){if(_0x13cd24[_0x58e1('0x46')]['id']){delete _0x13cd24[_0x58e1('0x46')]['id'];}return db['FreshsalesAccount'][_0x58e1('0x44')]({'where':{'id':_0x13cd24[_0x58e1('0x41')]['id']}})[_0x58e1('0x20')](handleEntityNotFound(_0x392f76,null))[_0x58e1('0x20')](saveUpdates(_0x13cd24[_0x58e1('0x46')],null))['then'](respondWithResult(_0x392f76,null))[_0x58e1('0x47')](handleError(_0x392f76,null));};exports['destroy']=function(_0x2e1ad1,_0x3906b5){return db[_0x58e1('0x3b')][_0x58e1('0x44')]({'where':{'id':_0x2e1ad1['params']['id']}})['then'](handleEntityNotFound(_0x3906b5,null))[_0x58e1('0x20')](removeEntity(_0x3906b5,null))[_0x58e1('0x47')](handleError(_0x3906b5,null));};exports[_0x58e1('0x48')]=function(_0x336ef1,_0xa930a4,_0x352657){var _0xd484ec={};var _0x589932={};var _0x230fce;var _0x23891f;return db['FreshsalesAccount'][_0x58e1('0x49')]({'where':{'id':_0x336ef1['params']['id']}})[_0x58e1('0x20')](handleEntityNotFound(_0xa930a4,null))[_0x58e1('0x20')](function(_0x41a528){if(_0x41a528){_0x230fce=_0x41a528;_0x589932[_0x58e1('0x2b')]=_[_0x58e1('0x42')](db[_0x58e1('0x4a')]['rawAttributes']);_0x589932['query']=_['keys'](_0x336ef1[_0x58e1('0x2c')]);_0x589932[_0x58e1('0x2d')]=_[_0x58e1('0x2e')](_0x589932[_0x58e1('0x2b')],_0x589932['query']);_0xd484ec[_0x58e1('0x2f')]=_['intersection'](_0x589932[_0x58e1('0x2b')],qs['fields'](_0x336ef1[_0x58e1('0x2c')][_0x58e1('0x30')]));_0xd484ec[_0x58e1('0x2f')]=_0xd484ec[_0x58e1('0x2f')][_0x58e1('0x31')]?_0xd484ec[_0x58e1('0x2f')]:_0x589932['model'];_0xd484ec[_0x58e1('0x34')]=qs[_0x58e1('0x35')](_0x336ef1[_0x58e1('0x2c')][_0x58e1('0x35')]);_0xd484ec['where']=qs['filters'](_[_0x58e1('0x37')](_0x336ef1[_0x58e1('0x2c')],_0x589932[_0x58e1('0x2d')]));if(_0x336ef1[_0x58e1('0x2c')][_0x58e1('0x38')]){_0xd484ec[_0x58e1('0x36')]=_[_0x58e1('0x43')](_0xd484ec[_0x58e1('0x36')],{'$or':_['map'](_0xd484ec[_0x58e1('0x2f')],function(_0x22e23b){var _0x35064e={};_0x35064e[_0x22e23b]={'$like':'%'+_0x336ef1['query'][_0x58e1('0x38')]+'%'};return _0x35064e;})});}_0xd484ec=_[_0x58e1('0x43')]({},_0xd484ec,_0x336ef1[_0x58e1('0x3a')]);return _0x230fce[_0x58e1('0x48')](_0xd484ec);}})[_0x58e1('0x20')](function(_0x3b7c22){if(_0x3b7c22){_0x23891f=_0x3b7c22[_0x58e1('0x31')];if(!_0x336ef1[_0x58e1('0x2c')][_0x58e1('0x32')](_0x58e1('0x33'))){_0xd484ec['limit']=qs['limit'](_0x336ef1[_0x58e1('0x2c')][_0x58e1('0x1a')]);_0xd484ec[_0x58e1('0x18')]=qs[_0x58e1('0x18')](_0x336ef1['query'][_0x58e1('0x18')]);}return _0x230fce[_0x58e1('0x48')](_0xd484ec);}})[_0x58e1('0x20')](function(_0x2e97d9){if(_0x2e97d9){return _0x2e97d9?{'count':_0x23891f,'rows':_0x2e97d9}:null;}})['then'](respondWithResult(_0xa930a4,null))[_0x58e1('0x47')](handleError(_0xa930a4,null));};exports[_0x58e1('0x4b')]=function(_0x589dfb,_0x42437b,_0x387f81){if(_0x589dfb[_0x58e1('0x46')]['id']){delete _0x589dfb['body']['id'];}return db[_0x58e1('0x3b')][_0x58e1('0x49')]({'where':{'id':_0x589dfb['params']['id']}})[_0x58e1('0x20')](handleEntityNotFound(_0x42437b,null))[_0x58e1('0x20')](function(_0x21aaf2){if(_0x21aaf2){_0x589dfb[_0x58e1('0x46')]['AccountId']=_0x21aaf2['id'];_0x589dfb['body'][_0x58e1('0x4c')]=integrations['getSubjects'](_0x589dfb[_0x58e1('0x46')][_0x58e1('0x4d')],_0x589dfb[_0x58e1('0x46')][_0x58e1('0x29')]);_0x589dfb[_0x58e1('0x46')]['Descriptions']=integrations['getDescriptions'](_0x589dfb['body'][_0x58e1('0x4d')],_0x589dfb[_0x58e1('0x46')][_0x58e1('0x29')]);return db[_0x58e1('0x4a')][_0x58e1('0x45')](_0x589dfb['body'],{'include':[{'model':db[_0x58e1('0x4e')],'as':_0x58e1('0x4c')},{'model':db['FreshsalesField'],'as':_0x58e1('0x4f')}]});}return null;})[_0x58e1('0x20')](respondWithResult(_0x42437b,null))[_0x58e1('0x47')](handleError(_0x42437b,null));};exports[_0x58e1('0x50')]=function(_0x41d749,_0x48406f,_0x4d5359){var _0x10e05b='';var _0x20db23='';return db[_0x58e1('0x3b')]['findOne']({'where':{'id':_0x41d749[_0x58e1('0x41')]['id']},'attributes':['id',_0x58e1('0x51'),'remoteUri',_0x58e1('0x52')]})[_0x58e1('0x20')](handleEntityNotFound(_0x48406f,null))['then'](function(_0x4da4fe){if(_0x4da4fe){_0x20db23=_0x4da4fe[_0x58e1('0x51')];_0x10e05b=_0x4da4fe['remoteUri'];var _0x3f0b04=_0x4da4fe[_0x58e1('0x53')][_0x58e1('0x54')](-0x1);if(_0x3f0b04==='/'){_0x10e05b=_0x10e05b[_0x58e1('0x55')](0x0,_0x10e05b['lastIndexOf'](_0x3f0b04));}return rp({'method':_0x58e1('0x56'),'uri':util[_0x58e1('0x57')](_0x58e1('0x58'),_0x10e05b,'/api/selector/owners'),'headers':{'Authorization':_0x58e1('0x59')+_0x4da4fe[_0x58e1('0x52')]},'json':!![]});}})[_0x58e1('0x20')](function(_0x271cce){if(_0x271cce){var _0x1c3c85=_0x271cce[_0x58e1('0x5a')];var _0x35b589=![];var _0x181a35=null;for(_0x181a35=0x0;_0x181a35<_0x1c3c85['length'];_0x181a35++){if(_0x1c3c85[_0x181a35][_0x58e1('0x5b')]===_0x20db23){_0x35b589=!![];}}if(_0x35b589){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x58e1('0x5c')});}}})[_0x58e1('0x20')](respondWithResult(_0x48406f,null))[_0x58e1('0x47')](function(_0x1cb2cb){var _0x4e24a5=_0x41d749[_0x58e1('0x2c')][_0x58e1('0x5d')]?0x1f4:_0x1cb2cb[_0x58e1('0x5e')]||0x1f4;logger[_0x58e1('0x22')](_0x58e1('0x5f'),_0x58e1('0x50'),_0x4e24a5,JSON[_0x58e1('0x60')](_0x1cb2cb));delete _0x1cb2cb[_0x58e1('0x23')];if(_0x4e24a5===0x191){_0x4e24a5=0x190;}_0x48406f['status'](_0x4e24a5)[_0x58e1('0x24')](_0x41d749['query'][_0x58e1('0x5d')]?{'message':_0x58e1('0x61'),'statusCode':_0x1cb2cb['statusCode']}:_0x1cb2cb);});}; \ No newline at end of file +var _0xd0b4=['update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','order','sort','where','filter','merge','options','FreshsalesAccount','includeAll','include','show','fields','find','catch','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','nolimit','addConfiguration','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd0b4,0xa5));var _0x4d0b=function(_0x5c1029,_0x3c228e){_0x5c1029=_0x5c1029-0x0;var _0xb948ce=_0xd0b4[_0x5c1029];return _0xb948ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d0b('0x0'));var zipdir=require(_0x4d0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d0b('0x2'));var moment=require(_0x4d0b('0x3'));var BPromise=require(_0x4d0b('0x4'));var Mustache=require(_0x4d0b('0x5'));var util=require('util');var path=require(_0x4d0b('0x6'));var sox=require(_0x4d0b('0x7'));var csv=require(_0x4d0b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d0b('0x9'));var squel=require(_0x4d0b('0xa'));var crypto=require(_0x4d0b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d0b('0xc'));var toCsv=require(_0x4d0b('0x8'));var querystring=require(_0x4d0b('0xd'));var Papa=require(_0x4d0b('0xe'));var Redis=require(_0x4d0b('0xf'));var authService=require(_0x4d0b('0x10'));var qs=require(_0x4d0b('0x11'));var as=require(_0x4d0b('0x12'));var hardwareService=require(_0x4d0b('0x13'));var logger=require(_0x4d0b('0x14'))(_0x4d0b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d0b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3630d8,_0x46505c){_0x46505c=_0x46505c||0xcc;return function(_0x516146){if(_0x516146){return _0x3630d8['sendStatus'](_0x46505c);}return _0x3630d8['status'](_0x46505c)[_0x4d0b('0x17')]();};}function respondWithResult(_0x2a6454,_0x55c61b){_0x55c61b=_0x55c61b||0xc8;return function(_0x3d1b35){if(_0x3d1b35){return _0x2a6454[_0x4d0b('0x18')](_0x55c61b)[_0x4d0b('0x19')](_0x3d1b35);}};}function respondWithFilteredResult(_0x438274,_0x1765de){return function(_0x18144f){if(_0x18144f){var _0x14aa02=typeof _0x1765de['offset']===_0x4d0b('0x1a')&&typeof _0x1765de[_0x4d0b('0x1b')]==='undefined';var _0x14689e=_0x18144f[_0x4d0b('0x1c')];var _0x54e766=_0x14aa02?0x0:_0x1765de[_0x4d0b('0x1d')];var _0x576780=_0x14aa02?_0x18144f[_0x4d0b('0x1c')]:_0x1765de[_0x4d0b('0x1d')]+_0x1765de[_0x4d0b('0x1b')];var _0x68ebf2;if(_0x576780>=_0x14689e){_0x576780=_0x14689e;_0x68ebf2=0xc8;}else{_0x68ebf2=0xce;}_0x438274[_0x4d0b('0x18')](_0x68ebf2);return _0x438274[_0x4d0b('0x1e')](_0x4d0b('0x1f'),_0x54e766+'-'+_0x576780+'/'+_0x14689e)['json'](_0x18144f);}return null;};}function patchUpdates(_0x435f27){return function(_0x38b895){try{jsonpatch[_0x4d0b('0x20')](_0x38b895,_0x435f27,!![]);}catch(_0x1281c0){return BPromise[_0x4d0b('0x21')](_0x1281c0);}return _0x38b895[_0x4d0b('0x22')]();};}function saveUpdates(_0x1fafe4,_0xf975df){return function(_0x1d3f11){if(_0x1d3f11){return _0x1d3f11[_0x4d0b('0x23')](_0x1fafe4)[_0x4d0b('0x24')](function(_0x2baebc){return _0x2baebc;});}return null;};}function removeEntity(_0x252e0f,_0x3c76dd){return function(_0x276a10){if(_0x276a10){return _0x276a10[_0x4d0b('0x25')]()[_0x4d0b('0x24')](function(){_0x252e0f[_0x4d0b('0x18')](0xcc)[_0x4d0b('0x17')]();});}};}function handleEntityNotFound(_0x1d2180,_0x4cefb9){return function(_0x11f937){if(!_0x11f937){_0x1d2180[_0x4d0b('0x26')](0x194);}return _0x11f937;};}function handleError(_0x41e2cd,_0x4a63e9){_0x4a63e9=_0x4a63e9||0x1f4;return function(_0x221d18){logger[_0x4d0b('0x27')](_0x221d18[_0x4d0b('0x28')]);if(_0x221d18['name']){delete _0x221d18[_0x4d0b('0x29')];}_0x41e2cd[_0x4d0b('0x18')](_0x4a63e9)[_0x4d0b('0x2a')](_0x221d18);};}exports[_0x4d0b('0x2b')]=function(_0x2393e7,_0x414e48){var _0x320cc5={},_0x51fe89={},_0x4a9a91={'count':0x0,'rows':[]};var _0x214d76=_[_0x4d0b('0x2c')](db['FreshsalesAccount'][_0x4d0b('0x2d')],function(_0x4076b6){return{'name':_0x4076b6[_0x4d0b('0x2e')],'type':_0x4076b6[_0x4d0b('0x2f')][_0x4d0b('0x30')]};});_0x51fe89[_0x4d0b('0x31')]=_['map'](_0x214d76,_0x4d0b('0x29'));_0x51fe89['query']=_[_0x4d0b('0x32')](_0x2393e7[_0x4d0b('0x33')]);_0x51fe89[_0x4d0b('0x34')]=_[_0x4d0b('0x35')](_0x51fe89['model'],_0x51fe89[_0x4d0b('0x33')]);_0x320cc5['attributes']=_['intersection'](_0x51fe89[_0x4d0b('0x31')],qs['fields'](_0x2393e7['query']['fields']));_0x320cc5[_0x4d0b('0x36')]=_0x320cc5['attributes'][_0x4d0b('0x37')]?_0x320cc5[_0x4d0b('0x36')]:_0x51fe89[_0x4d0b('0x31')];if(!_0x2393e7[_0x4d0b('0x33')]['hasOwnProperty']('nolimit')){_0x320cc5['limit']=qs[_0x4d0b('0x1b')](_0x2393e7[_0x4d0b('0x33')][_0x4d0b('0x1b')]);_0x320cc5[_0x4d0b('0x1d')]=qs[_0x4d0b('0x1d')](_0x2393e7[_0x4d0b('0x33')][_0x4d0b('0x1d')]);}_0x320cc5[_0x4d0b('0x38')]=qs[_0x4d0b('0x39')](_0x2393e7[_0x4d0b('0x33')][_0x4d0b('0x39')]);_0x320cc5[_0x4d0b('0x3a')]=qs['filters'](_['pick'](_0x2393e7[_0x4d0b('0x33')],_0x51fe89[_0x4d0b('0x34')]),_0x214d76);if(_0x2393e7[_0x4d0b('0x33')][_0x4d0b('0x3b')]){_0x320cc5['where']=_[_0x4d0b('0x3c')](_0x320cc5[_0x4d0b('0x3a')],{'$or':_[_0x4d0b('0x2c')](_0x214d76,function(_0x37a5a2){if(_0x37a5a2[_0x4d0b('0x2f')]!=='VIRTUAL'){var _0x49ea83={};_0x49ea83[_0x37a5a2[_0x4d0b('0x29')]]={'$like':'%'+_0x2393e7[_0x4d0b('0x33')]['filter']+'%'};return _0x49ea83;}})});}_0x320cc5=_[_0x4d0b('0x3c')]({},_0x320cc5,_0x2393e7[_0x4d0b('0x3d')]);var _0x2a5fb4={'where':_0x320cc5[_0x4d0b('0x3a')]};return db[_0x4d0b('0x3e')][_0x4d0b('0x1c')](_0x2a5fb4)['then'](function(_0x4f26e2){_0x4a9a91[_0x4d0b('0x1c')]=_0x4f26e2;if(_0x2393e7[_0x4d0b('0x33')][_0x4d0b('0x3f')]){_0x320cc5[_0x4d0b('0x40')]=[{'all':!![]}];}return db[_0x4d0b('0x3e')]['findAll'](_0x320cc5);})[_0x4d0b('0x24')](function(_0x3023cb){_0x4a9a91['rows']=_0x3023cb;return _0x4a9a91;})['then'](respondWithFilteredResult(_0x414e48,_0x320cc5))['catch'](handleError(_0x414e48,null));};exports[_0x4d0b('0x41')]=function(_0x2f5426,_0xad1e50){var _0x55ccb9={'raw':![],'where':{'id':_0x2f5426['params']['id']}},_0x465a7a={};_0x465a7a[_0x4d0b('0x31')]=_['keys'](db[_0x4d0b('0x3e')][_0x4d0b('0x2d')]);_0x465a7a[_0x4d0b('0x33')]=_[_0x4d0b('0x32')](_0x2f5426[_0x4d0b('0x33')]);_0x465a7a['filters']=_[_0x4d0b('0x35')](_0x465a7a[_0x4d0b('0x31')],_0x465a7a['query']);_0x55ccb9['attributes']=_[_0x4d0b('0x35')](_0x465a7a[_0x4d0b('0x31')],qs[_0x4d0b('0x42')](_0x2f5426[_0x4d0b('0x33')][_0x4d0b('0x42')]));_0x55ccb9[_0x4d0b('0x36')]=_0x55ccb9['attributes']['length']?_0x55ccb9[_0x4d0b('0x36')]:_0x465a7a[_0x4d0b('0x31')];if(_0x2f5426[_0x4d0b('0x33')][_0x4d0b('0x3f')]){_0x55ccb9['include']=[{'all':!![]}];}_0x55ccb9=_[_0x4d0b('0x3c')]({},_0x55ccb9,_0x2f5426[_0x4d0b('0x3d')]);return db[_0x4d0b('0x3e')][_0x4d0b('0x43')](_0x55ccb9)['then'](handleEntityNotFound(_0xad1e50,null))['then'](respondWithResult(_0xad1e50,null))[_0x4d0b('0x44')](handleError(_0xad1e50,null));};exports[_0x4d0b('0x45')]=function(_0x4b3bfe,_0x4ab81d){return db[_0x4d0b('0x3e')][_0x4d0b('0x45')](_0x4b3bfe[_0x4d0b('0x46')],{})[_0x4d0b('0x24')](respondWithResult(_0x4ab81d,0xc9))[_0x4d0b('0x44')](handleError(_0x4ab81d,null));};exports[_0x4d0b('0x23')]=function(_0x15c424,_0x5ede54){if(_0x15c424[_0x4d0b('0x46')]['id']){delete _0x15c424['body']['id'];}return db[_0x4d0b('0x3e')][_0x4d0b('0x43')]({'where':{'id':_0x15c424[_0x4d0b('0x47')]['id']}})[_0x4d0b('0x24')](handleEntityNotFound(_0x5ede54,null))['then'](saveUpdates(_0x15c424[_0x4d0b('0x46')],null))[_0x4d0b('0x24')](respondWithResult(_0x5ede54,null))[_0x4d0b('0x44')](handleError(_0x5ede54,null));};exports[_0x4d0b('0x25')]=function(_0x38c21c,_0x34e535){return db[_0x4d0b('0x3e')][_0x4d0b('0x43')]({'where':{'id':_0x38c21c['params']['id']}})[_0x4d0b('0x24')](handleEntityNotFound(_0x34e535,null))[_0x4d0b('0x24')](removeEntity(_0x34e535,null))[_0x4d0b('0x44')](handleError(_0x34e535,null));};exports[_0x4d0b('0x48')]=function(_0x341f72,_0x2f8608,_0x13ba3d){var _0x24df32={};var _0x376332={};var _0x45c5da;var _0x2cae2d;return db[_0x4d0b('0x3e')][_0x4d0b('0x49')]({'where':{'id':_0x341f72[_0x4d0b('0x47')]['id']}})[_0x4d0b('0x24')](handleEntityNotFound(_0x2f8608,null))['then'](function(_0x1dc93e){if(_0x1dc93e){_0x45c5da=_0x1dc93e;_0x376332['model']=_[_0x4d0b('0x32')](db[_0x4d0b('0x4a')]['rawAttributes']);_0x376332[_0x4d0b('0x33')]=_['keys'](_0x341f72[_0x4d0b('0x33')]);_0x376332[_0x4d0b('0x34')]=_[_0x4d0b('0x35')](_0x376332[_0x4d0b('0x31')],_0x376332[_0x4d0b('0x33')]);_0x24df32[_0x4d0b('0x36')]=_[_0x4d0b('0x35')](_0x376332[_0x4d0b('0x31')],qs[_0x4d0b('0x42')](_0x341f72[_0x4d0b('0x33')]['fields']));_0x24df32['attributes']=_0x24df32[_0x4d0b('0x36')][_0x4d0b('0x37')]?_0x24df32[_0x4d0b('0x36')]:_0x376332[_0x4d0b('0x31')];_0x24df32[_0x4d0b('0x38')]=qs['sort'](_0x341f72[_0x4d0b('0x33')][_0x4d0b('0x39')]);_0x24df32[_0x4d0b('0x3a')]=qs[_0x4d0b('0x34')](_['pick'](_0x341f72[_0x4d0b('0x33')],_0x376332[_0x4d0b('0x34')]));if(_0x341f72[_0x4d0b('0x33')][_0x4d0b('0x3b')]){_0x24df32['where']=_[_0x4d0b('0x3c')](_0x24df32['where'],{'$or':_[_0x4d0b('0x2c')](_0x24df32[_0x4d0b('0x36')],function(_0x4b26fa){var _0x382424={};_0x382424[_0x4b26fa]={'$like':'%'+_0x341f72['query'][_0x4d0b('0x3b')]+'%'};return _0x382424;})});}_0x24df32=_[_0x4d0b('0x3c')]({},_0x24df32,_0x341f72['options']);return _0x45c5da[_0x4d0b('0x48')](_0x24df32);}})[_0x4d0b('0x24')](function(_0x5ca308){if(_0x5ca308){_0x2cae2d=_0x5ca308[_0x4d0b('0x37')];if(!_0x341f72[_0x4d0b('0x33')][_0x4d0b('0x4b')](_0x4d0b('0x4c'))){_0x24df32[_0x4d0b('0x1b')]=qs[_0x4d0b('0x1b')](_0x341f72[_0x4d0b('0x33')][_0x4d0b('0x1b')]);_0x24df32['offset']=qs['offset'](_0x341f72['query'][_0x4d0b('0x1d')]);}return _0x45c5da[_0x4d0b('0x48')](_0x24df32);}})[_0x4d0b('0x24')](function(_0x288c90){if(_0x288c90){return _0x288c90?{'count':_0x2cae2d,'rows':_0x288c90}:null;}})[_0x4d0b('0x24')](respondWithResult(_0x2f8608,null))[_0x4d0b('0x44')](handleError(_0x2f8608,null));};exports[_0x4d0b('0x4d')]=function(_0x489524,_0xc968d8,_0x588231){if(_0x489524[_0x4d0b('0x46')]['id']){delete _0x489524[_0x4d0b('0x46')]['id'];}return db['FreshsalesAccount'][_0x4d0b('0x49')]({'where':{'id':_0x489524[_0x4d0b('0x47')]['id']}})['then'](handleEntityNotFound(_0xc968d8,null))['then'](function(_0x1b16d4){if(_0x1b16d4){_0x489524[_0x4d0b('0x46')]['AccountId']=_0x1b16d4['id'];_0x489524[_0x4d0b('0x46')]['Subjects']=integrations[_0x4d0b('0x4e')](_0x489524[_0x4d0b('0x46')][_0x4d0b('0x4f')],_0x489524['body'][_0x4d0b('0x2f')]);_0x489524['body'][_0x4d0b('0x50')]=integrations['getDescriptions'](_0x489524[_0x4d0b('0x46')][_0x4d0b('0x4f')],_0x489524[_0x4d0b('0x46')][_0x4d0b('0x2f')]);return db[_0x4d0b('0x4a')]['create'](_0x489524['body'],{'include':[{'model':db[_0x4d0b('0x51')],'as':_0x4d0b('0x52')},{'model':db['FreshsalesField'],'as':_0x4d0b('0x50')}]});}return null;})[_0x4d0b('0x24')](respondWithResult(_0xc968d8,null))[_0x4d0b('0x44')](handleError(_0xc968d8,null));};exports[_0x4d0b('0x53')]=function(_0x4d0166,_0x243c80,_0x42af73){var _0x3af7b0='';var _0xd7b5d4='';return db[_0x4d0b('0x3e')][_0x4d0b('0x49')]({'where':{'id':_0x4d0166[_0x4d0b('0x47')]['id']},'attributes':['id',_0x4d0b('0x54'),'remoteUri',_0x4d0b('0x55')]})['then'](handleEntityNotFound(_0x243c80,null))[_0x4d0b('0x24')](function(_0x595150){if(_0x595150){_0xd7b5d4=_0x595150[_0x4d0b('0x54')];_0x3af7b0=_0x595150[_0x4d0b('0x56')];var _0x1785f5=_0x595150[_0x4d0b('0x56')][_0x4d0b('0x57')](-0x1);if(_0x1785f5==='/'){_0x3af7b0=_0x3af7b0[_0x4d0b('0x58')](0x0,_0x3af7b0[_0x4d0b('0x59')](_0x1785f5));}return rp({'method':'GET','uri':util[_0x4d0b('0x5a')](_0x4d0b('0x5b'),_0x3af7b0,_0x4d0b('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x595150[_0x4d0b('0x55')]},'json':!![]});}})[_0x4d0b('0x24')](function(_0x105abe){if(_0x105abe){var _0x47fb29=_0x105abe[_0x4d0b('0x5d')];var _0x4122d5=![];var _0xe339ab=null;for(_0xe339ab=0x0;_0xe339ab<_0x47fb29['length'];_0xe339ab++){if(_0x47fb29[_0xe339ab][_0x4d0b('0x5e')]===_0xd7b5d4){_0x4122d5=!![];}}if(_0x4122d5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4d0b('0x5f')});}}})[_0x4d0b('0x24')](respondWithResult(_0x243c80,null))[_0x4d0b('0x44')](function(_0x1925be){var _0x21e366=_0x4d0166[_0x4d0b('0x33')]['test']?0x1f4:_0x1925be[_0x4d0b('0x60')]||0x1f4;logger[_0x4d0b('0x27')](_0x4d0b('0x61'),'getFields',_0x21e366,JSON['stringify'](_0x1925be));delete _0x1925be['name'];if(_0x21e366===0x191){_0x21e366=0x190;}_0x243c80[_0x4d0b('0x18')](_0x21e366)[_0x4d0b('0x2a')](_0x4d0166['query'][_0x4d0b('0x62')]?{'message':_0x4d0b('0x63'),'statusCode':_0x1925be[_0x4d0b('0x60')]}:_0x1925be);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ee132ec..a92e880 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 _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x571c83,_0x4c97dc){var _0x2b8bd2=function(_0x1401a1){while(--_0x1401a1){_0x571c83['push'](_0x571c83['shift']());}};_0x2b8bd2(++_0x4c97dc);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('FreshsalesAccount',attributes,{'tableName':_0xae3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1b010d,_0x269e85){var _0x592866=function(_0x4b6008){while(--_0x4b6008){_0x1b010d['push'](_0x1b010d['shift']());}};_0x592866(++_0x269e85);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x5d1de4,_0x4f8af9){_0x5d1de4=_0x5d1de4-0x0;var _0x3eede3=_0xa6b0[_0x5d1de4];return _0x3eede3;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));var integrations=require(_0x0a6b('0x8'));module[_0x0a6b('0x9')]=function(_0x3b6967,_0x1b5fb5){return _0x3b6967[_0x0a6b('0xa')](_0x0a6b('0xb'),attributes,{'tableName':_0x0a6b('0xc'),'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 c6e5e89..ebe05fc 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 _0xf2e3=['FreshsalesAccount','findAll','options','where','attributes','model','include','map','ShowFreshsalesAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xf2e3[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});}exports[_0x3f2e('0x18')]=function(_0xc00add){var _0x107876=this;return new Promise(function(_0x5b9989,_0x40e28f){return db[_0x3f2e('0x19')][_0x3f2e('0x1a')]({'raw':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc00add['options']?_0xc00add[_0x3f2e('0x1b')][_0x3f2e('0x1c')]||null:null,'attributes':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')][_0x3f2e('0x1d')]||null:null,'limit':_0xc00add[_0x3f2e('0x1b')]?_0xc00add['options']['limit']||null:null,'include':_0xc00add[_0x3f2e('0x1b')]?_0xc00add[_0x3f2e('0x1b')]['include']?_['map'](_0xc00add[_0x3f2e('0x1b')]['include'],function(_0x1b8c67){return{'model':db[_0x1b8c67[_0x3f2e('0x1e')]],'as':_0x1b8c67['as'],'attributes':_0x1b8c67['attributes'],'include':_0x1b8c67['include']?_['map'](_0x1b8c67[_0x3f2e('0x1f')],function(_0x3d7631){return{'model':db[_0x3d7631['model']],'as':_0x3d7631['as'],'attributes':_0x3d7631[_0x3f2e('0x1d')],'include':_0x3d7631['include']?_[_0x3f2e('0x20')](_0x3d7631['include'],function(_0x2806d0){return{'model':db[_0x2806d0[_0x3f2e('0x1e')]],'as':_0x2806d0['as'],'attributes':_0x2806d0[_0x3f2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f2e('0xd')](function(_0x11bad1){logger['info'](_0x3f2e('0x18'),_0xc00add);logger[_0x3f2e('0x11')]('GetFreshsalesAccount',_0xc00add,JSON['stringify'](_0x11bad1));_0x5b9989(_0x11bad1);})[_0x3f2e('0x17')](function(_0x1e5db4){logger[_0x3f2e('0x14')](_0x3f2e('0x18'),_0x1e5db4['message'],_0xc00add);_0x40e28f(_0x107876[_0x3f2e('0x14')](0x1f4,_0x1e5db4[_0x3f2e('0x15')]));});});};exports[_0x3f2e('0x21')]=function(_0x4d9b8c){var _0x349ed4=this;return new Promise(function(_0x2741d0,_0xa6a8ab){return db['FreshsalesAccount'][_0x3f2e('0x22')]({'raw':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x23')]===undefined?!![]:![]:!![],'where':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')]['where']||null:null,'attributes':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x1d')]||null:null,'include':_0x4d9b8c[_0x3f2e('0x1b')]?_0x4d9b8c[_0x3f2e('0x1b')][_0x3f2e('0x1f')]?_[_0x3f2e('0x20')](_0x4d9b8c['options'][_0x3f2e('0x1f')],function(_0x1e4866){return{'model':db[_0x1e4866[_0x3f2e('0x1e')]],'as':_0x1e4866['as'],'attributes':_0x1e4866[_0x3f2e('0x1d')],'include':_0x1e4866['include']?_['map'](_0x1e4866[_0x3f2e('0x1f')],function(_0x35ead3){return{'model':db[_0x35ead3[_0x3f2e('0x1e')]],'as':_0x35ead3['as'],'attributes':_0x35ead3[_0x3f2e('0x1d')],'include':_0x35ead3[_0x3f2e('0x1f')]?_[_0x3f2e('0x20')](_0x35ead3[_0x3f2e('0x1f')],function(_0x35937a){return{'model':db[_0x35937a[_0x3f2e('0x1e')]],'as':_0x35937a['as'],'attributes':_0x35937a[_0x3f2e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff764){logger[_0x3f2e('0xe')](_0x3f2e('0x21'),_0x4d9b8c);logger[_0x3f2e('0x11')]('ShowFreshsalesAccount',_0x4d9b8c,JSON[_0x3f2e('0x13')](_0x1ff764));_0x2741d0(_0x1ff764);})[_0x3f2e('0x17')](function(_0x3f41af){logger[_0x3f2e('0x14')](_0x3f2e('0x21'),_0x3f41af[_0x3f2e('0x15')],_0x4d9b8c);_0xa6a8ab(_0x349ed4[_0x3f2e('0x14')](0x1f4,_0x3f41af[_0x3f2e('0x15')]));});});}; \ No newline at end of file +var _0x0adf=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','find','raw','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x27431c,_0x5d28a1){var _0x4bd29b=function(_0x3c1685){while(--_0x3c1685){_0x27431c['push'](_0x27431c['shift']());}};_0x4bd29b(++_0x5d28a1);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x1a3914,_0x4ef4a3){_0x1a3914=_0x1a3914-0x0;var _0x42c036=_0x0adf[_0x1a3914];return _0x42c036;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['GetFreshsalesAccount']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')]({'raw':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1b')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'limit':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970['options'][_0xf0ad('0x1d')]||null:null,'include':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')],function(_0x276322){return{'model':db[_0x276322[_0xf0ad('0x20')]],'as':_0x276322['as'],'attributes':_0x276322[_0xf0ad('0x1c')],'include':_0x276322[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x276322[_0xf0ad('0x1e')],function(_0x456f81){return{'model':db[_0x456f81[_0xf0ad('0x20')]],'as':_0x456f81['as'],'attributes':_0x456f81['attributes'],'include':_0x456f81[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x456f81[_0xf0ad('0x1e')],function(_0x7377d7){return{'model':db[_0x7377d7[_0xf0ad('0x20')]],'as':_0x7377d7['as'],'attributes':_0x7377d7[_0xf0ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbe00){logger[_0xf0ad('0xd')](_0xf0ad('0x21'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x21'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x2cbe00));_0x46fb20(_0x2cbe00);})[_0xf0ad('0x17')](function(_0x1bee71){logger[_0xf0ad('0x13')](_0xf0ad('0x21'),_0x1bee71[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8['error'](0x1f4,_0x1bee71[_0xf0ad('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x83f211){var _0x57a1f3=this;return new Promise(function(_0x25ed0b,_0x320174){return db[_0xf0ad('0x18')][_0xf0ad('0x22')]({'raw':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x23')]===undefined?!![]:![]:!![],'where':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options']['where']||null:null,'attributes':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'include':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options'][_0xf0ad('0x1e')]?_['map'](_0x83f211[_0xf0ad('0x1a')]['include'],function(_0x4136b9){return{'model':db[_0x4136b9['model']],'as':_0x4136b9['as'],'attributes':_0x4136b9[_0xf0ad('0x1c')],'include':_0x4136b9[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4136b9[_0xf0ad('0x1e')],function(_0x42f87f){return{'model':db[_0x42f87f[_0xf0ad('0x20')]],'as':_0x42f87f['as'],'attributes':_0x42f87f[_0xf0ad('0x1c')],'include':_0x42f87f[_0xf0ad('0x1e')]?_['map'](_0x42f87f[_0xf0ad('0x1e')],function(_0x54b59d){return{'model':db[_0x54b59d[_0xf0ad('0x20')]],'as':_0x54b59d['as'],'attributes':_0x54b59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0ad('0xc')](function(_0x25246b){logger[_0xf0ad('0xd')](_0xf0ad('0x24'),_0x83f211);logger[_0xf0ad('0xf')]('ShowFreshsalesAccount',_0x83f211,JSON[_0xf0ad('0x11')](_0x25246b));_0x25ed0b(_0x25246b);})[_0xf0ad('0x17')](function(_0x1d57d1){logger[_0xf0ad('0x13')](_0xf0ad('0x24'),_0x1d57d1[_0xf0ad('0x15')],_0x83f211);_0x320174(_0x57a1f3[_0xf0ad('0x13')](0x1f4,_0x1d57d1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1701621..507b0c0 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 _0x4378=['get','isAuthenticated','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x36617e,_0x57e535){var _0x45c976=function(_0x212aa2){while(--_0x212aa2){_0x36617e['push'](_0x36617e['shift']());}};_0x45c976(++_0x57e535);}(_0x4378,0x16d));var _0x8437=function(_0x211c7d,_0x1e9c66){_0x211c7d=_0x211c7d-0x0;var _0x500ae3=_0x4378[_0x211c7d];return _0x500ae3;};'use strict';var multer=require(_0x8437('0x0'));var util=require(_0x8437('0x1'));var path=require(_0x8437('0x2'));var timeout=require(_0x8437('0x3'));var express=require(_0x8437('0x4'));var router=express[_0x8437('0x5')]();var fs_extra=require(_0x8437('0x6'));var auth=require(_0x8437('0x7'));var interaction=require(_0x8437('0x8'));var config=require('../../config/environment');var controller=require(_0x8437('0x9'));router[_0x8437('0xa')]('/',auth[_0x8437('0xb')](),controller['index']);router[_0x8437('0xa')](_0x8437('0xc'),auth[_0x8437('0xb')](),controller[_0x8437('0xd')]);router[_0x8437('0xa')]('/:id/subjects',auth[_0x8437('0xb')](),controller['getSubjects']);router[_0x8437('0xa')](_0x8437('0xe'),auth['isAuthenticated'](),controller[_0x8437('0xf')]);router['get'](_0x8437('0x10'),auth['isAuthenticated'](),controller[_0x8437('0x11')]);router[_0x8437('0x12')]('/',auth[_0x8437('0xb')](),controller[_0x8437('0x13')]);router[_0x8437('0x14')](_0x8437('0xc'),auth[_0x8437('0xb')](),controller[_0x8437('0x15')]);router[_0x8437('0x16')](_0x8437('0xc'),auth['isAuthenticated'](),controller[_0x8437('0x17')]);module[_0x8437('0x18')]=router; \ No newline at end of file +var _0x0fdd=['isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x184aaf,_0x428d34){var _0x40ca04=function(_0xc035d7){while(--_0xc035d7){_0x184aaf['push'](_0x184aaf['shift']());}};_0x40ca04(++_0x428d34);}(_0x0fdd,0x150));var _0xd0fd=function(_0x4c636b,_0x15b6ea){_0x4c636b=_0x4c636b-0x0;var _0x207e67=_0x0fdd[_0x4c636b];return _0x207e67;};'use strict';var multer=require(_0xd0fd('0x0'));var util=require(_0xd0fd('0x1'));var path=require(_0xd0fd('0x2'));var timeout=require(_0xd0fd('0x3'));var express=require('express');var router=express[_0xd0fd('0x4')]();var fs_extra=require(_0xd0fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0fd('0x6'));var config=require(_0xd0fd('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xd0fd('0x8')]('/',auth[_0xd0fd('0x9')](),controller[_0xd0fd('0xa')]);router[_0xd0fd('0x8')](_0xd0fd('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd0fd('0x8')](_0xd0fd('0xc'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0xd')]);router[_0xd0fd('0x8')](_0xd0fd('0xe'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0xf')]);router[_0xd0fd('0x8')](_0xd0fd('0x10'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0x11')]);router[_0xd0fd('0x12')]('/',auth[_0xd0fd('0x9')](),controller['create']);router[_0xd0fd('0x13')](_0xd0fd('0xb'),auth[_0xd0fd('0x9')](),controller['update']);router[_0xd0fd('0x14')](_0xd0fd('0xb'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0x15')]);module[_0xd0fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index f7b4209..ddeb106 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 _0xc5ab=['sequelize','STRING'];(function(_0x8ea103,_0x2ec4e8){var _0x43721c=function(_0x4c51f1){while(--_0x4c51f1){_0x8ea103['push'](_0x8ea103['shift']());}};_0x43721c(++_0x2ec4e8);}(_0xc5ab,0x146));var _0xbc5a=function(_0x2ee2b8,_0x295110){_0x2ee2b8=_0x2ee2b8-0x0;var _0x3e05b9=_0xc5ab[_0x2ee2b8];return _0x3e05b9;};'use strict';var Sequelize=require(_0xbc5a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc5a('0x1')]},'description':{'type':Sequelize[_0xbc5a('0x1')]}}; \ No newline at end of file +var _0x905f=['sequelize','STRING'];(function(_0x4e1dd8,_0x4425ae){var _0x1aa2f5=function(_0x5b67ac){while(--_0x5b67ac){_0x4e1dd8['push'](_0x4e1dd8['shift']());}};_0x1aa2f5(++_0x4425ae);}(_0x905f,0x9c));var _0xf905=function(_0x3438fb,_0xde4967){_0x3438fb=_0x3438fb-0x0;var _0x2606b1=_0x905f[_0x3438fb];return _0x2606b1;};'use strict';var Sequelize=require(_0xf905('0x0'));module['exports']={'name':{'type':Sequelize[_0xf905('0x1')]},'description':{'type':Sequelize[_0xf905('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0bf89bf..0bbe980 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 _0xf496=['create','body','destroy','find','rawAttributes','order','filter','getSubjects','hasOwnProperty','getDescriptions','findOne','FreshsalesField','pick','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','map','FreshsalesConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','sort','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','include'];(function(_0x211036,_0x1fb51c){var _0x20332e=function(_0x53c57e){while(--_0x53c57e){_0x211036['push'](_0x211036['shift']());}};_0x20332e(++_0x1fb51c);}(_0xf496,0x18a));var _0x6f49=function(_0x10e508,_0xdec8c9){_0x10e508=_0x10e508-0x0;var _0x11792b=_0xf496[_0x10e508];return _0x11792b;};'use strict';var emlformat=require(_0x6f49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f49('0x1'));var jsonpatch=require(_0x6f49('0x2'));var rp=require(_0x6f49('0x3'));var moment=require(_0x6f49('0x4'));var BPromise=require(_0x6f49('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f49('0x6'));var sox=require(_0x6f49('0x7'));var csv=require(_0x6f49('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f49('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f49('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f49('0x8'));var querystring=require(_0x6f49('0xb'));var Papa=require(_0x6f49('0xc'));var Redis=require(_0x6f49('0xd'));var authService=require(_0x6f49('0xe'));var qs=require(_0x6f49('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f49('0x10'))(_0x6f49('0x11'));var utils=require('../../config/utils');var config=require(_0x6f49('0x12'));var licenseUtil=require(_0x6f49('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29820a,_0x146c1f){_0x146c1f=_0x146c1f||0xcc;return function(_0x2c2906){if(_0x2c2906){return _0x29820a[_0x6f49('0x14')](_0x146c1f);}return _0x29820a[_0x6f49('0x15')](_0x146c1f)['end']();};}function respondWithResult(_0x3444ff,_0x52d7ae){_0x52d7ae=_0x52d7ae||0xc8;return function(_0x39d4aa){if(_0x39d4aa){return _0x3444ff[_0x6f49('0x15')](_0x52d7ae)[_0x6f49('0x16')](_0x39d4aa);}};}function respondWithFilteredResult(_0x3de1d3,_0x1faf7f){return function(_0x1700a8){if(_0x1700a8){var _0x15c166=typeof _0x1faf7f[_0x6f49('0x17')]===_0x6f49('0x18')&&typeof _0x1faf7f[_0x6f49('0x19')]===_0x6f49('0x18');var _0x306918=_0x1700a8[_0x6f49('0x1a')];var _0x253f50=_0x15c166?0x0:_0x1faf7f[_0x6f49('0x17')];var _0x3814b8=_0x15c166?_0x1700a8[_0x6f49('0x1a')]:_0x1faf7f['offset']+_0x1faf7f['limit'];var _0x4031df;if(_0x3814b8>=_0x306918){_0x3814b8=_0x306918;_0x4031df=0xc8;}else{_0x4031df=0xce;}_0x3de1d3['status'](_0x4031df);return _0x3de1d3[_0x6f49('0x1b')](_0x6f49('0x1c'),_0x253f50+'-'+_0x3814b8+'/'+_0x306918)[_0x6f49('0x16')](_0x1700a8);}return null;};}function patchUpdates(_0x21b748){return function(_0x1af4c0){try{jsonpatch[_0x6f49('0x1d')](_0x1af4c0,_0x21b748,!![]);}catch(_0x4b0767){return BPromise[_0x6f49('0x1e')](_0x4b0767);}return _0x1af4c0[_0x6f49('0x1f')]();};}function saveUpdates(_0x5126b9,_0x27cb3f){return function(_0xb85dc7){if(_0xb85dc7){return _0xb85dc7[_0x6f49('0x20')](_0x5126b9)['then'](function(_0x4ddb59){return _0x4ddb59;});}return null;};}function removeEntity(_0xaf0e99,_0x53ad15){return function(_0x4c4b85){if(_0x4c4b85){return _0x4c4b85['destroy']()[_0x6f49('0x21')](function(){_0xaf0e99[_0x6f49('0x15')](0xcc)[_0x6f49('0x22')]();});}};}function handleEntityNotFound(_0x25b750,_0x21019d){return function(_0x582b34){if(!_0x582b34){_0x25b750['sendStatus'](0x194);}return _0x582b34;};}function handleError(_0x2275a8,_0x48b2f1){_0x48b2f1=_0x48b2f1||0x1f4;return function(_0x236eb7){logger['error'](_0x236eb7[_0x6f49('0x23')]);if(_0x236eb7['name']){delete _0x236eb7[_0x6f49('0x24')];}_0x2275a8[_0x6f49('0x15')](_0x48b2f1)['send'](_0x236eb7);};}exports['index']=function(_0x4c8a44,_0x4032ce){var _0xd3218f={},_0x5292a9={},_0x5db1af={'count':0x0,'rows':[]};var _0x7f9f8=_[_0x6f49('0x25')](db[_0x6f49('0x26')]['rawAttributes'],function(_0x269e5f){return{'name':_0x269e5f[_0x6f49('0x27')],'type':_0x269e5f[_0x6f49('0x28')][_0x6f49('0x29')]};});_0x5292a9[_0x6f49('0x2a')]=_[_0x6f49('0x25')](_0x7f9f8,_0x6f49('0x24'));_0x5292a9['query']=_[_0x6f49('0x2b')](_0x4c8a44[_0x6f49('0x2c')]);_0x5292a9[_0x6f49('0x2d')]=_[_0x6f49('0x2e')](_0x5292a9[_0x6f49('0x2a')],_0x5292a9['query']);_0xd3218f[_0x6f49('0x2f')]=_[_0x6f49('0x2e')](_0x5292a9[_0x6f49('0x2a')],qs['fields'](_0x4c8a44[_0x6f49('0x2c')]['fields']));_0xd3218f['attributes']=_0xd3218f[_0x6f49('0x2f')][_0x6f49('0x30')]?_0xd3218f[_0x6f49('0x2f')]:_0x5292a9[_0x6f49('0x2a')];if(!_0x4c8a44[_0x6f49('0x2c')]['hasOwnProperty'](_0x6f49('0x31'))){_0xd3218f['limit']=qs[_0x6f49('0x19')](_0x4c8a44['query'][_0x6f49('0x19')]);_0xd3218f['offset']=qs['offset'](_0x4c8a44[_0x6f49('0x2c')][_0x6f49('0x17')]);}_0xd3218f['order']=qs[_0x6f49('0x32')](_0x4c8a44[_0x6f49('0x2c')][_0x6f49('0x32')]);_0xd3218f['where']=qs['filters'](_['pick'](_0x4c8a44[_0x6f49('0x2c')],_0x5292a9['filters']),_0x7f9f8);if(_0x4c8a44[_0x6f49('0x2c')]['filter']){_0xd3218f['where']=_[_0x6f49('0x33')](_0xd3218f[_0x6f49('0x34')],{'$or':_['map'](_0x7f9f8,function(_0x5327a8){if(_0x5327a8['type']!==_0x6f49('0x35')){var _0x140e1b={};_0x140e1b[_0x5327a8['name']]={'$like':'%'+_0x4c8a44[_0x6f49('0x2c')]['filter']+'%'};return _0x140e1b;}})});}_0xd3218f=_['merge']({},_0xd3218f,_0x4c8a44[_0x6f49('0x36')]);var _0x82fc93={'where':_0xd3218f['where']};return db['FreshsalesConfiguration'][_0x6f49('0x1a')](_0x82fc93)[_0x6f49('0x21')](function(_0x57ab03){_0x5db1af[_0x6f49('0x1a')]=_0x57ab03;if(_0x4c8a44['query'][_0x6f49('0x37')]){_0xd3218f['include']=[{'all':!![]}];}return db[_0x6f49('0x26')][_0x6f49('0x38')](_0xd3218f);})[_0x6f49('0x21')](function(_0xaa5f21){_0x5db1af[_0x6f49('0x39')]=_0xaa5f21;return _0x5db1af;})[_0x6f49('0x21')](respondWithFilteredResult(_0x4032ce,_0xd3218f))[_0x6f49('0x3a')](handleError(_0x4032ce,null));};exports['show']=function(_0x26301e,_0x760ca8){var _0x205231={'raw':![],'where':{'id':_0x26301e[_0x6f49('0x3b')]['id']}},_0x572e57={};_0x572e57[_0x6f49('0x2a')]=_[_0x6f49('0x2b')](db[_0x6f49('0x26')]['rawAttributes']);_0x572e57['query']=_[_0x6f49('0x2b')](_0x26301e[_0x6f49('0x2c')]);_0x572e57[_0x6f49('0x2d')]=_[_0x6f49('0x2e')](_0x572e57['model'],_0x572e57[_0x6f49('0x2c')]);_0x205231[_0x6f49('0x2f')]=_[_0x6f49('0x2e')](_0x572e57[_0x6f49('0x2a')],qs[_0x6f49('0x3c')](_0x26301e[_0x6f49('0x2c')][_0x6f49('0x3c')]));_0x205231[_0x6f49('0x2f')]=_0x205231[_0x6f49('0x2f')]['length']?_0x205231['attributes']:_0x572e57[_0x6f49('0x2a')];if(_0x26301e['query'][_0x6f49('0x37')]){_0x205231[_0x6f49('0x3d')]=[{'all':!![]}];}_0x205231=_[_0x6f49('0x33')]({},_0x205231,_0x26301e[_0x6f49('0x36')]);return db[_0x6f49('0x26')]['find'](_0x205231)[_0x6f49('0x21')](handleEntityNotFound(_0x760ca8,null))[_0x6f49('0x21')](respondWithResult(_0x760ca8,null))[_0x6f49('0x3a')](handleError(_0x760ca8,null));};exports[_0x6f49('0x3e')]=function(_0x566c14,_0x37e9d3){return db[_0x6f49('0x26')][_0x6f49('0x3e')](_0x566c14[_0x6f49('0x3f')],{})[_0x6f49('0x21')](respondWithResult(_0x37e9d3,0xc9))[_0x6f49('0x3a')](handleError(_0x37e9d3,null));};exports[_0x6f49('0x20')]=function(_0x21bdf5,_0x44fdbd){if(_0x21bdf5[_0x6f49('0x3f')]['id']){delete _0x21bdf5[_0x6f49('0x3f')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x21bdf5[_0x6f49('0x3b')]['id']}})[_0x6f49('0x21')](handleEntityNotFound(_0x44fdbd,null))['then'](saveUpdates(_0x21bdf5['body'],null))[_0x6f49('0x21')](respondWithResult(_0x44fdbd,null))[_0x6f49('0x3a')](handleError(_0x44fdbd,null));};exports[_0x6f49('0x40')]=function(_0x427a92,_0x5e7ad6){return db[_0x6f49('0x26')][_0x6f49('0x41')]({'where':{'id':_0x427a92['params']['id']}})['then'](handleEntityNotFound(_0x5e7ad6,null))['then'](removeEntity(_0x5e7ad6,null))['catch'](handleError(_0x5e7ad6,null));};exports['getSubjects']=function(_0x381e83,_0x5dca69,_0x50c750){var _0x34581e={};var _0x25fd12={};var _0x463106;var _0x2d197c;return db[_0x6f49('0x26')]['findOne']({'where':{'id':_0x381e83['params']['id']}})[_0x6f49('0x21')](handleEntityNotFound(_0x5dca69,null))['then'](function(_0x18d87d){if(_0x18d87d){_0x463106=_0x18d87d;_0x25fd12[_0x6f49('0x2a')]=_['keys'](db['FreshsalesField'][_0x6f49('0x42')]);_0x25fd12[_0x6f49('0x2c')]=_[_0x6f49('0x2b')](_0x381e83[_0x6f49('0x2c')]);_0x25fd12[_0x6f49('0x2d')]=_[_0x6f49('0x2e')](_0x25fd12[_0x6f49('0x2a')],_0x25fd12['query']);_0x34581e[_0x6f49('0x2f')]=_[_0x6f49('0x2e')](_0x25fd12[_0x6f49('0x2a')],qs['fields'](_0x381e83[_0x6f49('0x2c')][_0x6f49('0x3c')]));_0x34581e[_0x6f49('0x2f')]=_0x34581e[_0x6f49('0x2f')][_0x6f49('0x30')]?_0x34581e[_0x6f49('0x2f')]:_0x25fd12[_0x6f49('0x2a')];_0x34581e[_0x6f49('0x43')]=qs[_0x6f49('0x32')](_0x381e83[_0x6f49('0x2c')]['sort']);_0x34581e['where']=qs[_0x6f49('0x2d')](_['pick'](_0x381e83[_0x6f49('0x2c')],_0x25fd12['filters']));if(_0x381e83[_0x6f49('0x2c')]['filter']){_0x34581e['where']=_[_0x6f49('0x33')](_0x34581e[_0x6f49('0x34')],{'$or':_[_0x6f49('0x25')](_0x34581e[_0x6f49('0x2f')],function(_0x336494){var _0x74df1e={};_0x74df1e[_0x336494]={'$like':'%'+_0x381e83[_0x6f49('0x2c')][_0x6f49('0x44')]+'%'};return _0x74df1e;})});}_0x34581e=_[_0x6f49('0x33')]({},_0x34581e,_0x381e83[_0x6f49('0x36')]);return _0x463106[_0x6f49('0x45')](_0x34581e);}})['then'](function(_0xd73b9c){if(_0xd73b9c){_0x2d197c=_0xd73b9c[_0x6f49('0x30')];if(!_0x381e83[_0x6f49('0x2c')][_0x6f49('0x46')](_0x6f49('0x31'))){_0x34581e[_0x6f49('0x19')]=qs[_0x6f49('0x19')](_0x381e83[_0x6f49('0x2c')][_0x6f49('0x19')]);_0x34581e[_0x6f49('0x17')]=qs['offset'](_0x381e83[_0x6f49('0x2c')]['offset']);}return _0x463106['getSubjects'](_0x34581e);}})['then'](function(_0x31c748){if(_0x31c748){return _0x31c748?{'count':_0x2d197c,'rows':_0x31c748}:null;}})[_0x6f49('0x21')](respondWithResult(_0x5dca69,null))['catch'](handleError(_0x5dca69,null));};exports[_0x6f49('0x47')]=function(_0x4784fe,_0x4bb57e,_0x5dd24a){var _0x2e759a={};var _0x3aec49={};var _0x4452a6;var _0x1e2e3e;return db[_0x6f49('0x26')][_0x6f49('0x48')]({'where':{'id':_0x4784fe[_0x6f49('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4bb57e,null))[_0x6f49('0x21')](function(_0x1b5f61){if(_0x1b5f61){_0x4452a6=_0x1b5f61;_0x3aec49[_0x6f49('0x2a')]=_[_0x6f49('0x2b')](db[_0x6f49('0x49')][_0x6f49('0x42')]);_0x3aec49[_0x6f49('0x2c')]=_['keys'](_0x4784fe[_0x6f49('0x2c')]);_0x3aec49[_0x6f49('0x2d')]=_[_0x6f49('0x2e')](_0x3aec49['model'],_0x3aec49[_0x6f49('0x2c')]);_0x2e759a[_0x6f49('0x2f')]=_[_0x6f49('0x2e')](_0x3aec49['model'],qs[_0x6f49('0x3c')](_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x3c')]));_0x2e759a[_0x6f49('0x2f')]=_0x2e759a[_0x6f49('0x2f')][_0x6f49('0x30')]?_0x2e759a['attributes']:_0x3aec49[_0x6f49('0x2a')];_0x2e759a[_0x6f49('0x43')]=qs['sort'](_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x32')]);_0x2e759a[_0x6f49('0x34')]=qs['filters'](_['pick'](_0x4784fe[_0x6f49('0x2c')],_0x3aec49[_0x6f49('0x2d')]));if(_0x4784fe['query'][_0x6f49('0x44')]){_0x2e759a[_0x6f49('0x34')]=_[_0x6f49('0x33')](_0x2e759a[_0x6f49('0x34')],{'$or':_[_0x6f49('0x25')](_0x2e759a[_0x6f49('0x2f')],function(_0x50d40d){var _0x4a4340={};_0x4a4340[_0x50d40d]={'$like':'%'+_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x44')]+'%'};return _0x4a4340;})});}_0x2e759a=_[_0x6f49('0x33')]({},_0x2e759a,_0x4784fe[_0x6f49('0x36')]);return _0x4452a6[_0x6f49('0x47')](_0x2e759a);}})['then'](function(_0x33e00b){if(_0x33e00b){_0x1e2e3e=_0x33e00b[_0x6f49('0x30')];if(!_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x46')](_0x6f49('0x31'))){_0x2e759a[_0x6f49('0x19')]=qs[_0x6f49('0x19')](_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x19')]);_0x2e759a[_0x6f49('0x17')]=qs['offset'](_0x4784fe[_0x6f49('0x2c')][_0x6f49('0x17')]);}return _0x4452a6[_0x6f49('0x47')](_0x2e759a);}})[_0x6f49('0x21')](function(_0x2e2ebd){if(_0x2e2ebd){return _0x2e2ebd?{'count':_0x1e2e3e,'rows':_0x2e2ebd}:null;}})['then'](respondWithResult(_0x4bb57e,null))[_0x6f49('0x3a')](handleError(_0x4bb57e,null));};exports['getFields']=function(_0x135cfa,_0x2364c9,_0x2ac77c){var _0x4e9c59={};var _0x1dffd6={};var _0x557ebf;var _0x7df3b9;return db['FreshsalesConfiguration'][_0x6f49('0x48')]({'where':{'id':_0x135cfa[_0x6f49('0x3b')]['id']}})[_0x6f49('0x21')](handleEntityNotFound(_0x2364c9,null))[_0x6f49('0x21')](function(_0x28878d){if(_0x28878d){_0x557ebf=_0x28878d;_0x1dffd6['model']=_[_0x6f49('0x2b')](db[_0x6f49('0x49')][_0x6f49('0x42')]);_0x1dffd6[_0x6f49('0x2c')]=_[_0x6f49('0x2b')](_0x135cfa[_0x6f49('0x2c')]);_0x1dffd6[_0x6f49('0x2d')]=_[_0x6f49('0x2e')](_0x1dffd6[_0x6f49('0x2a')],_0x1dffd6[_0x6f49('0x2c')]);_0x4e9c59[_0x6f49('0x2f')]=_[_0x6f49('0x2e')](_0x1dffd6[_0x6f49('0x2a')],qs[_0x6f49('0x3c')](_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x3c')]));_0x4e9c59['attributes']=_0x4e9c59[_0x6f49('0x2f')][_0x6f49('0x30')]?_0x4e9c59[_0x6f49('0x2f')]:_0x1dffd6[_0x6f49('0x2a')];_0x4e9c59['order']=qs[_0x6f49('0x32')](_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x32')]);_0x4e9c59['where']=qs['filters'](_[_0x6f49('0x4a')](_0x135cfa[_0x6f49('0x2c')],_0x1dffd6[_0x6f49('0x2d')]));if(_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x44')]){_0x4e9c59[_0x6f49('0x34')]=_[_0x6f49('0x33')](_0x4e9c59[_0x6f49('0x34')],{'$or':_[_0x6f49('0x25')](_0x4e9c59[_0x6f49('0x2f')],function(_0x3388ad){var _0x396e23={};_0x396e23[_0x3388ad]={'$like':'%'+_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x44')]+'%'};return _0x396e23;})});}_0x4e9c59=_[_0x6f49('0x33')]({},_0x4e9c59,_0x135cfa[_0x6f49('0x36')]);return _0x557ebf[_0x6f49('0x4b')](_0x4e9c59);}})['then'](function(_0x50e82e){if(_0x50e82e){_0x7df3b9=_0x50e82e['length'];if(!_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x46')](_0x6f49('0x31'))){_0x4e9c59[_0x6f49('0x19')]=qs['limit'](_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x19')]);_0x4e9c59[_0x6f49('0x17')]=qs['offset'](_0x135cfa[_0x6f49('0x2c')][_0x6f49('0x17')]);}return _0x557ebf[_0x6f49('0x4b')](_0x4e9c59);}})['then'](function(_0x1d95aa){if(_0x1d95aa){return _0x1d95aa?{'count':_0x7df3b9,'rows':_0x1d95aa}:null;}})['then'](respondWithResult(_0x2364c9,null))[_0x6f49('0x3a')](handleError(_0x2364c9,null));}; \ No newline at end of file +var _0x1239=['find','create','update','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','pick','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','intersection','include'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x1239,0xad));var _0x9123=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1239[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9123('0x0'));var rimraf=require(_0x9123('0x1'));var zipdir=require(_0x9123('0x2'));var jsonpatch=require(_0x9123('0x3'));var rp=require('request-promise');var moment=require(_0x9123('0x4'));var BPromise=require(_0x9123('0x5'));var Mustache=require(_0x9123('0x6'));var util=require(_0x9123('0x7'));var path=require(_0x9123('0x8'));var sox=require('sox');var csv=require(_0x9123('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9123('0xa'));var _=require(_0x9123('0xb'));var squel=require(_0x9123('0xc'));var crypto=require(_0x9123('0xd'));var jsforce=require(_0x9123('0xe'));var deskjs=require(_0x9123('0xf'));var toCsv=require(_0x9123('0x9'));var querystring=require(_0x9123('0x10'));var Papa=require(_0x9123('0x11'));var Redis=require('ioredis');var authService=require(_0x9123('0x12'));var qs=require(_0x9123('0x13'));var as=require(_0x9123('0x14'));var hardwareService=require(_0x9123('0x15'));var logger=require('../../config/logger')(_0x9123('0x16'));var utils=require(_0x9123('0x17'));var config=require(_0x9123('0x18'));var licenseUtil=require(_0x9123('0x19'));var db=require(_0x9123('0x1a'))['db'];function respondWithStatusCode(_0x1e8ebd,_0x219fb3){_0x219fb3=_0x219fb3||0xcc;return function(_0x440292){if(_0x440292){return _0x1e8ebd[_0x9123('0x1b')](_0x219fb3);}return _0x1e8ebd[_0x9123('0x1c')](_0x219fb3)[_0x9123('0x1d')]();};}function respondWithResult(_0x3b5613,_0x522a3d){_0x522a3d=_0x522a3d||0xc8;return function(_0x29b781){if(_0x29b781){return _0x3b5613[_0x9123('0x1c')](_0x522a3d)['json'](_0x29b781);}};}function respondWithFilteredResult(_0x3ce565,_0x5ebac6){return function(_0xa28836){if(_0xa28836){var _0x288c7d=typeof _0x5ebac6[_0x9123('0x1e')]===_0x9123('0x1f')&&typeof _0x5ebac6[_0x9123('0x20')]===_0x9123('0x1f');var _0x29f25a=_0xa28836['count'];var _0x1fd2d3=_0x288c7d?0x0:_0x5ebac6[_0x9123('0x1e')];var _0x2ac0e1=_0x288c7d?_0xa28836[_0x9123('0x21')]:_0x5ebac6[_0x9123('0x1e')]+_0x5ebac6[_0x9123('0x20')];var _0x487cfc;if(_0x2ac0e1>=_0x29f25a){_0x2ac0e1=_0x29f25a;_0x487cfc=0xc8;}else{_0x487cfc=0xce;}_0x3ce565[_0x9123('0x1c')](_0x487cfc);return _0x3ce565[_0x9123('0x22')]('Content-Range',_0x1fd2d3+'-'+_0x2ac0e1+'/'+_0x29f25a)['json'](_0xa28836);}return null;};}function patchUpdates(_0x41aa4c){return function(_0x1e8b1a){try{jsonpatch[_0x9123('0x23')](_0x1e8b1a,_0x41aa4c,!![]);}catch(_0x33fefe){return BPromise[_0x9123('0x24')](_0x33fefe);}return _0x1e8b1a['save']();};}function saveUpdates(_0x4dce78,_0x5311a3){return function(_0x31390c){if(_0x31390c){return _0x31390c['update'](_0x4dce78)[_0x9123('0x25')](function(_0x3adc76){return _0x3adc76;});}return null;};}function removeEntity(_0x16742,_0x19bcf3){return function(_0x95ab80){if(_0x95ab80){return _0x95ab80[_0x9123('0x26')]()[_0x9123('0x25')](function(){_0x16742['status'](0xcc)[_0x9123('0x1d')]();});}};}function handleEntityNotFound(_0x2b8cb4,_0x15e56d){return function(_0x235efe){if(!_0x235efe){_0x2b8cb4['sendStatus'](0x194);}return _0x235efe;};}function handleError(_0xa0b4aa,_0x3e9519){_0x3e9519=_0x3e9519||0x1f4;return function(_0x3c58db){logger[_0x9123('0x27')](_0x3c58db['stack']);if(_0x3c58db[_0x9123('0x28')]){delete _0x3c58db[_0x9123('0x28')];}_0xa0b4aa['status'](_0x3e9519)[_0x9123('0x29')](_0x3c58db);};}exports[_0x9123('0x2a')]=function(_0x498894,_0x59718a){var _0x4bb5c6={},_0x147bec={},_0x48d7ae={'count':0x0,'rows':[]};var _0x5a5b78=_[_0x9123('0x2b')](db[_0x9123('0x2c')][_0x9123('0x2d')],function(_0x43a8d4){return{'name':_0x43a8d4[_0x9123('0x2e')],'type':_0x43a8d4[_0x9123('0x2f')]['key']};});_0x147bec[_0x9123('0x30')]=_['map'](_0x5a5b78,_0x9123('0x28'));_0x147bec[_0x9123('0x31')]=_[_0x9123('0x32')](_0x498894[_0x9123('0x31')]);_0x147bec[_0x9123('0x33')]=_['intersection'](_0x147bec['model'],_0x147bec[_0x9123('0x31')]);_0x4bb5c6[_0x9123('0x34')]=_['intersection'](_0x147bec['model'],qs[_0x9123('0x35')](_0x498894[_0x9123('0x31')]['fields']));_0x4bb5c6[_0x9123('0x34')]=_0x4bb5c6['attributes'][_0x9123('0x36')]?_0x4bb5c6[_0x9123('0x34')]:_0x147bec['model'];if(!_0x498894[_0x9123('0x31')][_0x9123('0x37')](_0x9123('0x38'))){_0x4bb5c6['limit']=qs[_0x9123('0x20')](_0x498894[_0x9123('0x31')][_0x9123('0x20')]);_0x4bb5c6[_0x9123('0x1e')]=qs['offset'](_0x498894[_0x9123('0x31')][_0x9123('0x1e')]);}_0x4bb5c6['order']=qs[_0x9123('0x39')](_0x498894[_0x9123('0x31')]['sort']);_0x4bb5c6[_0x9123('0x3a')]=qs[_0x9123('0x33')](_['pick'](_0x498894[_0x9123('0x31')],_0x147bec['filters']),_0x5a5b78);if(_0x498894['query'][_0x9123('0x3b')]){_0x4bb5c6[_0x9123('0x3a')]=_[_0x9123('0x3c')](_0x4bb5c6[_0x9123('0x3a')],{'$or':_[_0x9123('0x2b')](_0x5a5b78,function(_0x58039e){if(_0x58039e['type']!==_0x9123('0x3d')){var _0xcb50c6={};_0xcb50c6[_0x58039e['name']]={'$like':'%'+_0x498894[_0x9123('0x31')][_0x9123('0x3b')]+'%'};return _0xcb50c6;}})});}_0x4bb5c6=_[_0x9123('0x3c')]({},_0x4bb5c6,_0x498894[_0x9123('0x3e')]);var _0x52ff12={'where':_0x4bb5c6[_0x9123('0x3a')]};return db[_0x9123('0x2c')][_0x9123('0x21')](_0x52ff12)[_0x9123('0x25')](function(_0x310b4){_0x48d7ae['count']=_0x310b4;if(_0x498894['query'][_0x9123('0x3f')]){_0x4bb5c6['include']=[{'all':!![]}];}return db[_0x9123('0x2c')][_0x9123('0x40')](_0x4bb5c6);})[_0x9123('0x25')](function(_0x14b2e3){_0x48d7ae['rows']=_0x14b2e3;return _0x48d7ae;})[_0x9123('0x25')](respondWithFilteredResult(_0x59718a,_0x4bb5c6))[_0x9123('0x41')](handleError(_0x59718a,null));};exports[_0x9123('0x42')]=function(_0x4ce394,_0x67b00c){var _0x23571b={'raw':![],'where':{'id':_0x4ce394[_0x9123('0x43')]['id']}},_0x2c119f={};_0x2c119f[_0x9123('0x30')]=_[_0x9123('0x32')](db['FreshsalesConfiguration']['rawAttributes']);_0x2c119f[_0x9123('0x31')]=_[_0x9123('0x32')](_0x4ce394[_0x9123('0x31')]);_0x2c119f[_0x9123('0x33')]=_['intersection'](_0x2c119f[_0x9123('0x30')],_0x2c119f['query']);_0x23571b[_0x9123('0x34')]=_[_0x9123('0x44')](_0x2c119f[_0x9123('0x30')],qs['fields'](_0x4ce394[_0x9123('0x31')][_0x9123('0x35')]));_0x23571b['attributes']=_0x23571b['attributes'][_0x9123('0x36')]?_0x23571b['attributes']:_0x2c119f[_0x9123('0x30')];if(_0x4ce394[_0x9123('0x31')][_0x9123('0x3f')]){_0x23571b[_0x9123('0x45')]=[{'all':!![]}];}_0x23571b=_[_0x9123('0x3c')]({},_0x23571b,_0x4ce394[_0x9123('0x3e')]);return db[_0x9123('0x2c')][_0x9123('0x46')](_0x23571b)['then'](handleEntityNotFound(_0x67b00c,null))['then'](respondWithResult(_0x67b00c,null))[_0x9123('0x41')](handleError(_0x67b00c,null));};exports[_0x9123('0x47')]=function(_0x5a988d,_0x1f15b6){return db[_0x9123('0x2c')][_0x9123('0x47')](_0x5a988d['body'],{})[_0x9123('0x25')](respondWithResult(_0x1f15b6,0xc9))['catch'](handleError(_0x1f15b6,null));};exports[_0x9123('0x48')]=function(_0x25e8f5,_0x2c78b9){if(_0x25e8f5[_0x9123('0x49')]['id']){delete _0x25e8f5['body']['id'];}return db[_0x9123('0x2c')][_0x9123('0x46')]({'where':{'id':_0x25e8f5[_0x9123('0x43')]['id']}})[_0x9123('0x25')](handleEntityNotFound(_0x2c78b9,null))[_0x9123('0x25')](saveUpdates(_0x25e8f5['body'],null))[_0x9123('0x25')](respondWithResult(_0x2c78b9,null))[_0x9123('0x41')](handleError(_0x2c78b9,null));};exports['destroy']=function(_0x1f7dec,_0x4bb40a){return db[_0x9123('0x2c')][_0x9123('0x46')]({'where':{'id':_0x1f7dec['params']['id']}})[_0x9123('0x25')](handleEntityNotFound(_0x4bb40a,null))[_0x9123('0x25')](removeEntity(_0x4bb40a,null))[_0x9123('0x41')](handleError(_0x4bb40a,null));};exports[_0x9123('0x4a')]=function(_0xf48677,_0x308e9b,_0x57ef76){var _0x44c6e4={};var _0x5beb88={};var _0x4af1f1;var _0x435a7b;return db['FreshsalesConfiguration'][_0x9123('0x4b')]({'where':{'id':_0xf48677[_0x9123('0x43')]['id']}})['then'](handleEntityNotFound(_0x308e9b,null))[_0x9123('0x25')](function(_0x98c4d8){if(_0x98c4d8){_0x4af1f1=_0x98c4d8;_0x5beb88['model']=_[_0x9123('0x32')](db[_0x9123('0x4c')]['rawAttributes']);_0x5beb88[_0x9123('0x31')]=_['keys'](_0xf48677['query']);_0x5beb88['filters']=_['intersection'](_0x5beb88[_0x9123('0x30')],_0x5beb88[_0x9123('0x31')]);_0x44c6e4[_0x9123('0x34')]=_[_0x9123('0x44')](_0x5beb88['model'],qs['fields'](_0xf48677[_0x9123('0x31')][_0x9123('0x35')]));_0x44c6e4['attributes']=_0x44c6e4['attributes']['length']?_0x44c6e4[_0x9123('0x34')]:_0x5beb88[_0x9123('0x30')];_0x44c6e4[_0x9123('0x4d')]=qs[_0x9123('0x39')](_0xf48677[_0x9123('0x31')][_0x9123('0x39')]);_0x44c6e4[_0x9123('0x3a')]=qs[_0x9123('0x33')](_['pick'](_0xf48677[_0x9123('0x31')],_0x5beb88[_0x9123('0x33')]));if(_0xf48677[_0x9123('0x31')][_0x9123('0x3b')]){_0x44c6e4[_0x9123('0x3a')]=_['merge'](_0x44c6e4[_0x9123('0x3a')],{'$or':_[_0x9123('0x2b')](_0x44c6e4['attributes'],function(_0x2dd18e){var _0x30d17f={};_0x30d17f[_0x2dd18e]={'$like':'%'+_0xf48677[_0x9123('0x31')][_0x9123('0x3b')]+'%'};return _0x30d17f;})});}_0x44c6e4=_['merge']({},_0x44c6e4,_0xf48677[_0x9123('0x3e')]);return _0x4af1f1['getSubjects'](_0x44c6e4);}})[_0x9123('0x25')](function(_0x22a6c2){if(_0x22a6c2){_0x435a7b=_0x22a6c2['length'];if(!_0xf48677['query']['hasOwnProperty'](_0x9123('0x38'))){_0x44c6e4['limit']=qs[_0x9123('0x20')](_0xf48677[_0x9123('0x31')][_0x9123('0x20')]);_0x44c6e4['offset']=qs['offset'](_0xf48677['query'][_0x9123('0x1e')]);}return _0x4af1f1[_0x9123('0x4a')](_0x44c6e4);}})['then'](function(_0x486668){if(_0x486668){return _0x486668?{'count':_0x435a7b,'rows':_0x486668}:null;}})[_0x9123('0x25')](respondWithResult(_0x308e9b,null))[_0x9123('0x41')](handleError(_0x308e9b,null));};exports[_0x9123('0x4e')]=function(_0xfa7f3b,_0x8d7ca4,_0x3c0386){var _0x440174={};var _0xf0533c={};var _0x51dfce;var _0x4bcca9;return db[_0x9123('0x2c')][_0x9123('0x4b')]({'where':{'id':_0xfa7f3b[_0x9123('0x43')]['id']}})[_0x9123('0x25')](handleEntityNotFound(_0x8d7ca4,null))[_0x9123('0x25')](function(_0x465cd7){if(_0x465cd7){_0x51dfce=_0x465cd7;_0xf0533c[_0x9123('0x30')]=_['keys'](db[_0x9123('0x4c')][_0x9123('0x2d')]);_0xf0533c['query']=_['keys'](_0xfa7f3b[_0x9123('0x31')]);_0xf0533c[_0x9123('0x33')]=_[_0x9123('0x44')](_0xf0533c[_0x9123('0x30')],_0xf0533c[_0x9123('0x31')]);_0x440174['attributes']=_['intersection'](_0xf0533c['model'],qs[_0x9123('0x35')](_0xfa7f3b[_0x9123('0x31')][_0x9123('0x35')]));_0x440174[_0x9123('0x34')]=_0x440174['attributes'][_0x9123('0x36')]?_0x440174[_0x9123('0x34')]:_0xf0533c['model'];_0x440174[_0x9123('0x4d')]=qs['sort'](_0xfa7f3b[_0x9123('0x31')][_0x9123('0x39')]);_0x440174[_0x9123('0x3a')]=qs[_0x9123('0x33')](_[_0x9123('0x4f')](_0xfa7f3b[_0x9123('0x31')],_0xf0533c[_0x9123('0x33')]));if(_0xfa7f3b['query'][_0x9123('0x3b')]){_0x440174[_0x9123('0x3a')]=_[_0x9123('0x3c')](_0x440174['where'],{'$or':_[_0x9123('0x2b')](_0x440174[_0x9123('0x34')],function(_0xdbbad1){var _0x10a8e7={};_0x10a8e7[_0xdbbad1]={'$like':'%'+_0xfa7f3b['query'][_0x9123('0x3b')]+'%'};return _0x10a8e7;})});}_0x440174=_[_0x9123('0x3c')]({},_0x440174,_0xfa7f3b['options']);return _0x51dfce[_0x9123('0x4e')](_0x440174);}})[_0x9123('0x25')](function(_0x1586ee){if(_0x1586ee){_0x4bcca9=_0x1586ee['length'];if(!_0xfa7f3b[_0x9123('0x31')][_0x9123('0x37')]('nolimit')){_0x440174['limit']=qs[_0x9123('0x20')](_0xfa7f3b['query']['limit']);_0x440174['offset']=qs[_0x9123('0x1e')](_0xfa7f3b[_0x9123('0x31')][_0x9123('0x1e')]);}return _0x51dfce[_0x9123('0x4e')](_0x440174);}})['then'](function(_0x38b9d2){if(_0x38b9d2){return _0x38b9d2?{'count':_0x4bcca9,'rows':_0x38b9d2}:null;}})[_0x9123('0x25')](respondWithResult(_0x8d7ca4,null))[_0x9123('0x41')](handleError(_0x8d7ca4,null));};exports[_0x9123('0x50')]=function(_0x4060ba,_0x26655d,_0x37ff6b){var _0x3279ee={};var _0x11c30c={};var _0x536818;var _0x458219;return db[_0x9123('0x2c')][_0x9123('0x4b')]({'where':{'id':_0x4060ba[_0x9123('0x43')]['id']}})[_0x9123('0x25')](handleEntityNotFound(_0x26655d,null))[_0x9123('0x25')](function(_0x5e98bd){if(_0x5e98bd){_0x536818=_0x5e98bd;_0x11c30c[_0x9123('0x30')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x11c30c[_0x9123('0x31')]=_[_0x9123('0x32')](_0x4060ba[_0x9123('0x31')]);_0x11c30c[_0x9123('0x33')]=_['intersection'](_0x11c30c[_0x9123('0x30')],_0x11c30c[_0x9123('0x31')]);_0x3279ee[_0x9123('0x34')]=_['intersection'](_0x11c30c[_0x9123('0x30')],qs[_0x9123('0x35')](_0x4060ba[_0x9123('0x31')]['fields']));_0x3279ee[_0x9123('0x34')]=_0x3279ee[_0x9123('0x34')][_0x9123('0x36')]?_0x3279ee['attributes']:_0x11c30c[_0x9123('0x30')];_0x3279ee[_0x9123('0x4d')]=qs[_0x9123('0x39')](_0x4060ba[_0x9123('0x31')][_0x9123('0x39')]);_0x3279ee['where']=qs[_0x9123('0x33')](_[_0x9123('0x4f')](_0x4060ba[_0x9123('0x31')],_0x11c30c[_0x9123('0x33')]));if(_0x4060ba[_0x9123('0x31')][_0x9123('0x3b')]){_0x3279ee[_0x9123('0x3a')]=_['merge'](_0x3279ee[_0x9123('0x3a')],{'$or':_[_0x9123('0x2b')](_0x3279ee[_0x9123('0x34')],function(_0x425ff3){var _0xfe385b={};_0xfe385b[_0x425ff3]={'$like':'%'+_0x4060ba['query'][_0x9123('0x3b')]+'%'};return _0xfe385b;})});}_0x3279ee=_['merge']({},_0x3279ee,_0x4060ba[_0x9123('0x3e')]);return _0x536818[_0x9123('0x50')](_0x3279ee);}})[_0x9123('0x25')](function(_0x400e06){if(_0x400e06){_0x458219=_0x400e06[_0x9123('0x36')];if(!_0x4060ba[_0x9123('0x31')][_0x9123('0x37')]('nolimit')){_0x3279ee['limit']=qs[_0x9123('0x20')](_0x4060ba[_0x9123('0x31')][_0x9123('0x20')]);_0x3279ee[_0x9123('0x1e')]=qs[_0x9123('0x1e')](_0x4060ba[_0x9123('0x31')][_0x9123('0x1e')]);}return _0x536818[_0x9123('0x50')](_0x3279ee);}})[_0x9123('0x25')](function(_0x2c7de3){if(_0x2c7de3){return _0x2c7de3?{'count':_0x458219,'rows':_0x2c7de3}:null;}})[_0x9123('0x25')](respondWithResult(_0x26655d,null))[_0x9123('0x41')](handleError(_0x26655d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 42ba999..c748f03 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 _0xc541=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util'];(function(_0x25cb72,_0x4c06ae){var _0x2165ae=function(_0x57ea51){while(--_0x57ea51){_0x25cb72['push'](_0x25cb72['shift']());}};_0x2165ae(++_0x4c06ae);}(_0xc541,0xdb));var _0x1c54=function(_0xb4947e,_0x39de27){_0xb4947e=_0xb4947e-0x0;var _0x2af6df=_0xc541[_0xb4947e];return _0x2af6df;};'use strict';var _=require(_0x1c54('0x0'));var util=require(_0x1c54('0x1'));var logger=require(_0x1c54('0x2'))(_0x1c54('0x3'));var moment=require(_0x1c54('0x4'));var BPromise=require(_0x1c54('0x5'));var rp=require(_0x1c54('0x6'));var fs=require('fs');var path=require(_0x1c54('0x7'));var rimraf=require(_0x1c54('0x8'));var config=require(_0x1c54('0x9'));var attributes=require(_0x1c54('0xa'));module[_0x1c54('0xb')]=function(_0xb5d20e,_0x227121){return _0xb5d20e['define'](_0x1c54('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ec=['../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46fe0c,_0x3ed0be){var _0x2c2b58=function(_0x1e4f5b){while(--_0x1e4f5b){_0x46fe0c['push'](_0x46fe0c['shift']());}};_0x2c2b58(++_0x3ed0be);}(_0xf9ec,0xd4));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcf9e('0x0'));var util=require(_0xcf9e('0x1'));var logger=require(_0xcf9e('0x2'))(_0xcf9e('0x3'));var moment=require(_0xcf9e('0x4'));var BPromise=require(_0xcf9e('0x5'));var rp=require(_0xcf9e('0x6'));var fs=require('fs');var path=require(_0xcf9e('0x7'));var rimraf=require(_0xcf9e('0x8'));var config=require(_0xcf9e('0x9'));var attributes=require(_0xcf9e('0xa'));module['exports']=function(_0xa46ccf,_0x403e32){return _0xa46ccf['define'](_0xcf9e('0xb'),attributes,{'tableName':_0xcf9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6e2495a..f5ccb00 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 _0xcc84=['code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0xf5444f,_0x486085){var _0x3fd533=function(_0x3f4ca6){while(--_0x3f4ca6){_0xf5444f['push'](_0xf5444f['shift']());}};_0x3fd533(++_0x486085);}(_0xcc84,0x1cf));var _0x4cc8=function(_0x4f38f7,_0x2346a7){_0x4f38f7=_0x4f38f7-0x0;var _0x3e7649=_0xcc84[_0x4f38f7];return _0x3e7649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4cc8('0x0'));var BPromise=require(_0x4cc8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cc8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cc8('0x3'));var logger=require(_0x4cc8('0x4'))(_0x4cc8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4cc8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x8a6679,_0x1875c1,_0x2240e9){return new BPromise(function(_0x32068e,_0x5ed0ea){return client['request'](_0x8a6679,_0x2240e9)[_0x4cc8('0x7')](function(_0x28d809){logger[_0x4cc8('0x8')](_0x4cc8('0x9'),_0x1875c1,_0x4cc8('0xa'));logger['debug'](_0x4cc8('0xb'),_0x1875c1,_0x4cc8('0xa'),JSON['stringify'](_0x28d809));if(_0x28d809[_0x4cc8('0xc')]){if(_0x28d809[_0x4cc8('0xc')][_0x4cc8('0xd')]===0x1f4){logger['error'](_0x4cc8('0x9'),_0x1875c1,_0x28d809[_0x4cc8('0xc')]['message']);return _0x5ed0ea(_0x28d809[_0x4cc8('0xc')]['message']);}logger[_0x4cc8('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1875c1,_0x28d809['error'][_0x4cc8('0xe')]);return _0x32068e(_0x28d809[_0x4cc8('0xc')][_0x4cc8('0xe')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1875c1,'request\x20sent');_0x32068e(_0x28d809[_0x4cc8('0xf')][_0x4cc8('0xe')]);}})[_0x4cc8('0x10')](function(_0x1d6196){logger[_0x4cc8('0xc')](_0x4cc8('0x9'),_0x1875c1,_0x1d6196);_0x5ed0ea(_0x1d6196);});});} \ No newline at end of file +var _0x2915=['jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment'];(function(_0xeb26d1,_0x301de1){var _0x4a4e2e=function(_0xa3dad1){while(--_0xa3dad1){_0xeb26d1['push'](_0xeb26d1['shift']());}};_0x4a4e2e(++_0x301de1);}(_0x2915,0xe0));var _0x5291=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x2915[_0x378720];return _0x47920a;};'use strict';var _=require(_0x5291('0x0'));var util=require(_0x5291('0x1'));var moment=require(_0x5291('0x2'));var BPromise=require(_0x5291('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5291('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5291('0x5'));var config=require(_0x5291('0x6'));var jayson=require(_0x5291('0x7'));var client=jayson[_0x5291('0x8')][_0x5291('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13a358,_0x36b08f,_0x282e12){return new BPromise(function(_0xd75ca6,_0xc4a5){return client['request'](_0x13a358,_0x282e12)[_0x5291('0xa')](function(_0x218514){logger['info'](_0x5291('0xb'),_0x36b08f,'request\x20sent');logger[_0x5291('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x36b08f,'request\x20sent',JSON[_0x5291('0xd')](_0x218514));if(_0x218514[_0x5291('0xe')]){if(_0x218514[_0x5291('0xe')][_0x5291('0xf')]===0x1f4){logger['error'](_0x5291('0xb'),_0x36b08f,_0x218514[_0x5291('0xe')]['message']);return _0xc4a5(_0x218514[_0x5291('0xe')][_0x5291('0x10')]);}logger[_0x5291('0xe')](_0x5291('0xb'),_0x36b08f,_0x218514['error'][_0x5291('0x10')]);return _0xd75ca6(_0x218514[_0x5291('0xe')][_0x5291('0x10')]);}else{logger[_0x5291('0x11')](_0x5291('0xb'),_0x36b08f,_0x5291('0x12'));_0xd75ca6(_0x218514[_0x5291('0x13')]['message']);}})[_0x5291('0x14')](function(_0x4fcf2a){logger[_0x5291('0xe')](_0x5291('0xb'),_0x36b08f,_0x4fcf2a);_0xc4a5(_0x4fcf2a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ee7ca0e..24473d7 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 _0x3d9c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d9c,0x134));var _0xc3d9=function(_0x17a376,_0x591732){_0x17a376=_0x17a376-0x0;var _0x39e454=_0x3d9c[_0x17a376];return _0x39e454;};'use strict';var multer=require(_0xc3d9('0x0'));var util=require('util');var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express['Router']();var fs_extra=require(_0xc3d9('0x4'));var auth=require(_0xc3d9('0x5'));var interaction=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var controller=require(_0xc3d9('0x8'));router[_0xc3d9('0x9')]('/',auth[_0xc3d9('0xa')](),controller['index']);router[_0xc3d9('0x9')](_0xc3d9('0xb'),auth['isAuthenticated'](),controller[_0xc3d9('0xc')]);router['post']('/',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xd')]);router[_0xc3d9('0xe')]('/:id',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xf')]);router['delete'](_0xc3d9('0xb'),auth[_0xc3d9('0xa')](),controller[_0xc3d9('0x10')]);module[_0xc3d9('0x11')]=router; \ No newline at end of file +var _0xbf6e=['/:id','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0xea7045,_0x33d66c){var _0x446f64=function(_0x527dc5){while(--_0x527dc5){_0xea7045['push'](_0xea7045['shift']());}};_0x446f64(++_0x33d66c);}(_0xbf6e,0x149));var _0xebf6=function(_0x2a1eb9,_0x2c6329){_0x2a1eb9=_0x2a1eb9-0x0;var _0x4b5310=_0xbf6e[_0x2a1eb9];return _0x4b5310;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0xc')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xd')]);router['put'](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['update']);router[_0xebf6('0xe')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller[_0xebf6('0xf')]);module[_0xebf6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c0a6684..9ac164a 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 _0x2714=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2714,0x1c2));var _0x4271=function(_0x4e1859,_0x2f8bb4){_0x4e1859=_0x4e1859-0x0;var _0x3217d0=_0x2714[_0x4e1859];return _0x3217d0;};'use strict';var Sequelize=require(_0x4271('0x0'));module[_0x4271('0x1')]={'type':{'type':Sequelize[_0x4271('0x2')](_0x4271('0x3'),'variable',_0x4271('0x4'),_0x4271('0x5'),_0x4271('0x6')),'defaultValue':_0x4271('0x3')},'content':{'type':Sequelize[_0x4271('0x7')]},'key':{'type':Sequelize[_0x4271('0x7')]},'keyType':{'type':Sequelize[_0x4271('0x2')]('string',_0x4271('0x8'),_0x4271('0x4'))},'keyContent':{'type':Sequelize[_0x4271('0x7')]},'idField':{'type':Sequelize[_0x4271('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4271('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0fc3=['ENUM','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0xca5315,_0x46f4f1){var _0x195a8a=function(_0x4cea70){while(--_0x4cea70){_0xca5315['push'](_0xca5315['shift']());}};_0x195a8a(++_0x46f4f1);}(_0x0fc3,0x1be));var _0x30fc=function(_0x5c7a2a,_0x3194ba){_0x5c7a2a=_0x5c7a2a-0x0;var _0x5c78ed=_0x0fc3[_0x5c7a2a];return _0x5c78ed;};'use strict';var Sequelize=require(_0x30fc('0x0'));module[_0x30fc('0x1')]={'type':{'type':Sequelize[_0x30fc('0x2')]('string',_0x30fc('0x3'),_0x30fc('0x4'),_0x30fc('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x30fc('0x6')]},'keyType':{'type':Sequelize[_0x30fc('0x2')]('string',_0x30fc('0x3'),_0x30fc('0x4'))},'keyContent':{'type':Sequelize[_0x30fc('0x6')]},'idField':{'type':Sequelize[_0x30fc('0x6')]},'nameField':{'type':Sequelize[_0x30fc('0x6')]},'customField':{'type':Sequelize[_0x30fc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 97fbb11..57ee7ef 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 _0x9094=['show','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9094,0x90));var _0x4909=function(_0xedef82,_0x2a5230){_0xedef82=_0xedef82-0x0;var _0x5c1f65=_0x9094[_0xedef82];return _0x5c1f65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4909('0x0'));var zipdir=require(_0x4909('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4909('0x2'));var moment=require(_0x4909('0x3'));var BPromise=require(_0x4909('0x4'));var Mustache=require(_0x4909('0x5'));var util=require(_0x4909('0x6'));var path=require('path');var sox=require(_0x4909('0x7'));var csv=require(_0x4909('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4909('0x9'));var _=require(_0x4909('0xa'));var squel=require(_0x4909('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4909('0x8'));var querystring=require(_0x4909('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4909('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4909('0xe'));var logger=require(_0x4909('0xf'))(_0x4909('0x10'));var utils=require(_0x4909('0x11'));var config=require(_0x4909('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e5b31,_0x3fd8dc){_0x3fd8dc=_0x3fd8dc||0xcc;return function(_0x8a2ef9){if(_0x8a2ef9){return _0x3e5b31[_0x4909('0x13')](_0x3fd8dc);}return _0x3e5b31[_0x4909('0x14')](_0x3fd8dc)[_0x4909('0x15')]();};}function respondWithResult(_0x5b5902,_0x1c7df5){_0x1c7df5=_0x1c7df5||0xc8;return function(_0x4a2b0e){if(_0x4a2b0e){return _0x5b5902[_0x4909('0x14')](_0x1c7df5)['json'](_0x4a2b0e);}};}function respondWithFilteredResult(_0x50b82d,_0x456bfc){return function(_0x36d2b1){if(_0x36d2b1){var _0x248bd9=typeof _0x456bfc[_0x4909('0x16')]===_0x4909('0x17')&&typeof _0x456bfc[_0x4909('0x18')]===_0x4909('0x17');var _0x23ea4b=_0x36d2b1[_0x4909('0x19')];var _0x47dd29=_0x248bd9?0x0:_0x456bfc['offset'];var _0x287fe5=_0x248bd9?_0x36d2b1[_0x4909('0x19')]:_0x456bfc['offset']+_0x456bfc['limit'];var _0x16077b;if(_0x287fe5>=_0x23ea4b){_0x287fe5=_0x23ea4b;_0x16077b=0xc8;}else{_0x16077b=0xce;}_0x50b82d[_0x4909('0x14')](_0x16077b);return _0x50b82d[_0x4909('0x1a')](_0x4909('0x1b'),_0x47dd29+'-'+_0x287fe5+'/'+_0x23ea4b)['json'](_0x36d2b1);}return null;};}function patchUpdates(_0x41db76){return function(_0x1249a2){try{jsonpatch[_0x4909('0x1c')](_0x1249a2,_0x41db76,!![]);}catch(_0x93df50){return BPromise['reject'](_0x93df50);}return _0x1249a2[_0x4909('0x1d')]();};}function saveUpdates(_0x495554,_0x1c9da3){return function(_0x1cbce6){if(_0x1cbce6){return _0x1cbce6[_0x4909('0x1e')](_0x495554)[_0x4909('0x1f')](function(_0xe3a1fe){return _0xe3a1fe;});}return null;};}function removeEntity(_0x3ed6cd,_0x38cc1b){return function(_0x99bf34){if(_0x99bf34){return _0x99bf34[_0x4909('0x20')]()[_0x4909('0x1f')](function(){_0x3ed6cd[_0x4909('0x14')](0xcc)[_0x4909('0x15')]();});}};}function handleEntityNotFound(_0x54b46b,_0x3af69d){return function(_0x280f68){if(!_0x280f68){_0x54b46b[_0x4909('0x13')](0x194);}return _0x280f68;};}function handleError(_0x20374a,_0x1fee76){_0x1fee76=_0x1fee76||0x1f4;return function(_0x5b2fe1){logger[_0x4909('0x21')](_0x5b2fe1['stack']);if(_0x5b2fe1['name']){delete _0x5b2fe1['name'];}_0x20374a['status'](_0x1fee76)[_0x4909('0x22')](_0x5b2fe1);};}exports[_0x4909('0x23')]=function(_0x3af7bd,_0x49e25f){var _0x4cecf1={},_0x251b0a={},_0x2eaa5e={'count':0x0,'rows':[]};var _0x383dd8=_[_0x4909('0x24')](db['FreshsalesField'][_0x4909('0x25')],function(_0x96aa55){return{'name':_0x96aa55[_0x4909('0x26')],'type':_0x96aa55[_0x4909('0x27')][_0x4909('0x28')]};});_0x251b0a['model']=_[_0x4909('0x24')](_0x383dd8,_0x4909('0x29'));_0x251b0a[_0x4909('0x2a')]=_['keys'](_0x3af7bd[_0x4909('0x2a')]);_0x251b0a[_0x4909('0x2b')]=_[_0x4909('0x2c')](_0x251b0a[_0x4909('0x2d')],_0x251b0a['query']);_0x4cecf1[_0x4909('0x2e')]=_[_0x4909('0x2c')](_0x251b0a[_0x4909('0x2d')],qs[_0x4909('0x2f')](_0x3af7bd[_0x4909('0x2a')][_0x4909('0x2f')]));_0x4cecf1['attributes']=_0x4cecf1[_0x4909('0x2e')][_0x4909('0x30')]?_0x4cecf1[_0x4909('0x2e')]:_0x251b0a[_0x4909('0x2d')];if(!_0x3af7bd['query'][_0x4909('0x31')]('nolimit')){_0x4cecf1[_0x4909('0x18')]=qs[_0x4909('0x18')](_0x3af7bd[_0x4909('0x2a')][_0x4909('0x18')]);_0x4cecf1[_0x4909('0x16')]=qs['offset'](_0x3af7bd[_0x4909('0x2a')][_0x4909('0x16')]);}_0x4cecf1[_0x4909('0x32')]=qs[_0x4909('0x33')](_0x3af7bd[_0x4909('0x2a')][_0x4909('0x33')]);_0x4cecf1[_0x4909('0x34')]=qs[_0x4909('0x2b')](_[_0x4909('0x35')](_0x3af7bd['query'],_0x251b0a[_0x4909('0x2b')]),_0x383dd8);if(_0x3af7bd['query'][_0x4909('0x36')]){_0x4cecf1[_0x4909('0x34')]=_[_0x4909('0x37')](_0x4cecf1['where'],{'$or':_['map'](_0x383dd8,function(_0x1b937c){if(_0x1b937c[_0x4909('0x27')]!=='VIRTUAL'){var _0x1e6f50={};_0x1e6f50[_0x1b937c['name']]={'$like':'%'+_0x3af7bd[_0x4909('0x2a')][_0x4909('0x36')]+'%'};return _0x1e6f50;}})});}_0x4cecf1=_[_0x4909('0x37')]({},_0x4cecf1,_0x3af7bd[_0x4909('0x38')]);var _0xb27ac1={'where':_0x4cecf1['where']};return db[_0x4909('0x39')][_0x4909('0x19')](_0xb27ac1)['then'](function(_0x2861a8){_0x2eaa5e[_0x4909('0x19')]=_0x2861a8;if(_0x3af7bd[_0x4909('0x2a')][_0x4909('0x3a')]){_0x4cecf1[_0x4909('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0x4909('0x3c')](_0x4cecf1);})[_0x4909('0x1f')](function(_0x466cb0){_0x2eaa5e[_0x4909('0x3d')]=_0x466cb0;return _0x2eaa5e;})[_0x4909('0x1f')](respondWithFilteredResult(_0x49e25f,_0x4cecf1))[_0x4909('0x3e')](handleError(_0x49e25f,null));};exports[_0x4909('0x3f')]=function(_0x5b30af,_0x15f688){var _0x419c1b={'raw':!![],'where':{'id':_0x5b30af[_0x4909('0x40')]['id']}},_0x7be539={};_0x7be539[_0x4909('0x2d')]=_['keys'](db[_0x4909('0x39')]['rawAttributes']);_0x7be539[_0x4909('0x2a')]=_[_0x4909('0x41')](_0x5b30af[_0x4909('0x2a')]);_0x7be539['filters']=_[_0x4909('0x2c')](_0x7be539[_0x4909('0x2d')],_0x7be539['query']);_0x419c1b[_0x4909('0x2e')]=_['intersection'](_0x7be539[_0x4909('0x2d')],qs[_0x4909('0x2f')](_0x5b30af[_0x4909('0x2a')][_0x4909('0x2f')]));_0x419c1b['attributes']=_0x419c1b[_0x4909('0x2e')][_0x4909('0x30')]?_0x419c1b[_0x4909('0x2e')]:_0x7be539['model'];if(_0x5b30af[_0x4909('0x2a')]['includeAll']){_0x419c1b[_0x4909('0x3b')]=[{'all':!![]}];}_0x419c1b=_['merge']({},_0x419c1b,_0x5b30af['options']);return db[_0x4909('0x39')][_0x4909('0x42')](_0x419c1b)['then'](handleEntityNotFound(_0x15f688,null))['then'](respondWithResult(_0x15f688,null))[_0x4909('0x3e')](handleError(_0x15f688,null));};exports[_0x4909('0x43')]=function(_0x19c6e2,_0x104781){return db[_0x4909('0x39')][_0x4909('0x43')](_0x19c6e2[_0x4909('0x44')],{})[_0x4909('0x1f')](respondWithResult(_0x104781,0xc9))['catch'](handleError(_0x104781,null));};exports[_0x4909('0x1e')]=function(_0x3c5ae4,_0x4dcd25){if(_0x3c5ae4[_0x4909('0x44')]['id']){delete _0x3c5ae4[_0x4909('0x44')]['id'];}return db[_0x4909('0x39')][_0x4909('0x42')]({'where':{'id':_0x3c5ae4[_0x4909('0x40')]['id']}})[_0x4909('0x1f')](handleEntityNotFound(_0x4dcd25,null))[_0x4909('0x1f')](saveUpdates(_0x3c5ae4[_0x4909('0x44')],null))['then'](respondWithResult(_0x4dcd25,null))[_0x4909('0x3e')](handleError(_0x4dcd25,null));};exports[_0x4909('0x20')]=function(_0x44f210,_0x5a7d03){return db[_0x4909('0x39')][_0x4909('0x42')]({'where':{'id':_0x44f210[_0x4909('0x40')]['id']}})[_0x4909('0x1f')](handleEntityNotFound(_0x5a7d03,null))[_0x4909('0x1f')](removeEntity(_0x5a7d03,null))[_0x4909('0x3e')](handleError(_0x5a7d03,null));}; \ No newline at end of file +var _0x9b0b=['include','then','rows','catch','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','destroy','name','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll'];(function(_0x11efe8,_0xe6ad7e){var _0x5954b8=function(_0x48bc36){while(--_0x48bc36){_0x11efe8['push'](_0x11efe8['shift']());}};_0x5954b8(++_0xe6ad7e);}(_0x9b0b,0x15d));var _0xb9b0=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x9b0b[_0x553a87];return _0x12d1e6;};'use strict';var emlformat=require(_0xb9b0('0x0'));var rimraf=require(_0xb9b0('0x1'));var zipdir=require(_0xb9b0('0x2'));var jsonpatch=require(_0xb9b0('0x3'));var rp=require(_0xb9b0('0x4'));var moment=require('moment');var BPromise=require(_0xb9b0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb9b0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9b0('0x7'));var _=require(_0xb9b0('0x8'));var squel=require(_0xb9b0('0x9'));var crypto=require(_0xb9b0('0xa'));var jsforce=require(_0xb9b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb9b0('0xc'));var querystring=require(_0xb9b0('0xd'));var Papa=require('papaparse');var Redis=require(_0xb9b0('0xe'));var authService=require(_0xb9b0('0xf'));var qs=require(_0xb9b0('0x10'));var as=require(_0xb9b0('0x11'));var hardwareService=require(_0xb9b0('0x12'));var logger=require(_0xb9b0('0x13'))(_0xb9b0('0x14'));var utils=require('../../config/utils');var config=require(_0xb9b0('0x15'));var licenseUtil=require(_0xb9b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4041c9,_0x6ad913){_0x6ad913=_0x6ad913||0xcc;return function(_0x15be3e){if(_0x15be3e){return _0x4041c9[_0xb9b0('0x17')](_0x6ad913);}return _0x4041c9[_0xb9b0('0x18')](_0x6ad913)[_0xb9b0('0x19')]();};}function respondWithResult(_0x205f40,_0x32de90){_0x32de90=_0x32de90||0xc8;return function(_0x432870){if(_0x432870){return _0x205f40[_0xb9b0('0x18')](_0x32de90)[_0xb9b0('0x1a')](_0x432870);}};}function respondWithFilteredResult(_0x4e53dc,_0x18c5cf){return function(_0x5ec74f){if(_0x5ec74f){var _0x4b44d3=typeof _0x18c5cf[_0xb9b0('0x1b')]===_0xb9b0('0x1c')&&typeof _0x18c5cf['limit']===_0xb9b0('0x1c');var _0x91b551=_0x5ec74f[_0xb9b0('0x1d')];var _0x5e984e=_0x4b44d3?0x0:_0x18c5cf[_0xb9b0('0x1b')];var _0x16124f=_0x4b44d3?_0x5ec74f[_0xb9b0('0x1d')]:_0x18c5cf['offset']+_0x18c5cf['limit'];var _0x1ecaa7;if(_0x16124f>=_0x91b551){_0x16124f=_0x91b551;_0x1ecaa7=0xc8;}else{_0x1ecaa7=0xce;}_0x4e53dc[_0xb9b0('0x18')](_0x1ecaa7);return _0x4e53dc['set'](_0xb9b0('0x1e'),_0x5e984e+'-'+_0x16124f+'/'+_0x91b551)['json'](_0x5ec74f);}return null;};}function patchUpdates(_0xd465d5){return function(_0x23df92){try{jsonpatch['apply'](_0x23df92,_0xd465d5,!![]);}catch(_0x2f4be5){return BPromise[_0xb9b0('0x1f')](_0x2f4be5);}return _0x23df92[_0xb9b0('0x20')]();};}function saveUpdates(_0x527e61,_0x3aa9eb){return function(_0x4100df){if(_0x4100df){return _0x4100df[_0xb9b0('0x21')](_0x527e61)['then'](function(_0xa5bec2){return _0xa5bec2;});}return null;};}function removeEntity(_0x2409eb,_0x5c2b6e){return function(_0x3ff6c7){if(_0x3ff6c7){return _0x3ff6c7[_0xb9b0('0x22')]()['then'](function(){_0x2409eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x676f41,_0x1698e3){return function(_0x33fa5c){if(!_0x33fa5c){_0x676f41[_0xb9b0('0x17')](0x194);}return _0x33fa5c;};}function handleError(_0x250e27,_0x14367e){_0x14367e=_0x14367e||0x1f4;return function(_0x1e617c){logger['error'](_0x1e617c['stack']);if(_0x1e617c[_0xb9b0('0x23')]){delete _0x1e617c[_0xb9b0('0x23')];}_0x250e27['status'](_0x14367e)['send'](_0x1e617c);};}exports[_0xb9b0('0x24')]=function(_0x3225cc,_0x2ed445){var _0x1c0895={},_0x143ab7={},_0x40c41d={'count':0x0,'rows':[]};var _0x1fec83=_['map'](db['FreshsalesField'][_0xb9b0('0x25')],function(_0x2d01a7){return{'name':_0x2d01a7['fieldName'],'type':_0x2d01a7[_0xb9b0('0x26')][_0xb9b0('0x27')]};});_0x143ab7[_0xb9b0('0x28')]=_[_0xb9b0('0x29')](_0x1fec83,_0xb9b0('0x23'));_0x143ab7[_0xb9b0('0x2a')]=_['keys'](_0x3225cc['query']);_0x143ab7[_0xb9b0('0x2b')]=_[_0xb9b0('0x2c')](_0x143ab7[_0xb9b0('0x28')],_0x143ab7['query']);_0x1c0895[_0xb9b0('0x2d')]=_[_0xb9b0('0x2c')](_0x143ab7['model'],qs['fields'](_0x3225cc['query'][_0xb9b0('0x2e')]));_0x1c0895[_0xb9b0('0x2d')]=_0x1c0895[_0xb9b0('0x2d')]['length']?_0x1c0895[_0xb9b0('0x2d')]:_0x143ab7[_0xb9b0('0x28')];if(!_0x3225cc['query'][_0xb9b0('0x2f')](_0xb9b0('0x30'))){_0x1c0895[_0xb9b0('0x31')]=qs[_0xb9b0('0x31')](_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x31')]);_0x1c0895['offset']=qs['offset'](_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x1b')]);}_0x1c0895[_0xb9b0('0x32')]=qs['sort'](_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x33')]);_0x1c0895[_0xb9b0('0x34')]=qs['filters'](_[_0xb9b0('0x35')](_0x3225cc[_0xb9b0('0x2a')],_0x143ab7[_0xb9b0('0x2b')]),_0x1fec83);if(_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x36')]){_0x1c0895[_0xb9b0('0x34')]=_[_0xb9b0('0x37')](_0x1c0895['where'],{'$or':_[_0xb9b0('0x29')](_0x1fec83,function(_0x1db04b){if(_0x1db04b[_0xb9b0('0x26')]!=='VIRTUAL'){var _0x5c4270={};_0x5c4270[_0x1db04b[_0xb9b0('0x23')]]={'$like':'%'+_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x36')]+'%'};return _0x5c4270;}})});}_0x1c0895=_[_0xb9b0('0x37')]({},_0x1c0895,_0x3225cc[_0xb9b0('0x38')]);var _0x21dcce={'where':_0x1c0895[_0xb9b0('0x34')]};return db[_0xb9b0('0x39')][_0xb9b0('0x1d')](_0x21dcce)['then'](function(_0x1928d2){_0x40c41d[_0xb9b0('0x1d')]=_0x1928d2;if(_0x3225cc[_0xb9b0('0x2a')][_0xb9b0('0x3a')]){_0x1c0895[_0xb9b0('0x3b')]=[{'all':!![]}];}return db[_0xb9b0('0x39')]['findAll'](_0x1c0895);})[_0xb9b0('0x3c')](function(_0x427370){_0x40c41d[_0xb9b0('0x3d')]=_0x427370;return _0x40c41d;})[_0xb9b0('0x3c')](respondWithFilteredResult(_0x2ed445,_0x1c0895))[_0xb9b0('0x3e')](handleError(_0x2ed445,null));};exports['show']=function(_0x15e82d,_0x1c2296){var _0x79eb41={'raw':!![],'where':{'id':_0x15e82d['params']['id']}},_0xd70220={};_0xd70220[_0xb9b0('0x28')]=_['keys'](db[_0xb9b0('0x39')][_0xb9b0('0x25')]);_0xd70220['query']=_[_0xb9b0('0x3f')](_0x15e82d['query']);_0xd70220[_0xb9b0('0x2b')]=_[_0xb9b0('0x2c')](_0xd70220[_0xb9b0('0x28')],_0xd70220['query']);_0x79eb41[_0xb9b0('0x2d')]=_[_0xb9b0('0x2c')](_0xd70220[_0xb9b0('0x28')],qs[_0xb9b0('0x2e')](_0x15e82d['query'][_0xb9b0('0x2e')]));_0x79eb41[_0xb9b0('0x2d')]=_0x79eb41['attributes'][_0xb9b0('0x40')]?_0x79eb41['attributes']:_0xd70220['model'];if(_0x15e82d[_0xb9b0('0x2a')]['includeAll']){_0x79eb41['include']=[{'all':!![]}];}_0x79eb41=_[_0xb9b0('0x37')]({},_0x79eb41,_0x15e82d['options']);return db[_0xb9b0('0x39')][_0xb9b0('0x41')](_0x79eb41)[_0xb9b0('0x3c')](handleEntityNotFound(_0x1c2296,null))['then'](respondWithResult(_0x1c2296,null))[_0xb9b0('0x3e')](handleError(_0x1c2296,null));};exports[_0xb9b0('0x42')]=function(_0x508260,_0x7ac6d0){return db[_0xb9b0('0x39')][_0xb9b0('0x42')](_0x508260['body'],{})[_0xb9b0('0x3c')](respondWithResult(_0x7ac6d0,0xc9))[_0xb9b0('0x3e')](handleError(_0x7ac6d0,null));};exports[_0xb9b0('0x21')]=function(_0x12e761,_0x2b32cf){if(_0x12e761[_0xb9b0('0x43')]['id']){delete _0x12e761[_0xb9b0('0x43')]['id'];}return db[_0xb9b0('0x39')]['find']({'where':{'id':_0x12e761['params']['id']}})[_0xb9b0('0x3c')](handleEntityNotFound(_0x2b32cf,null))['then'](saveUpdates(_0x12e761[_0xb9b0('0x43')],null))['then'](respondWithResult(_0x2b32cf,null))[_0xb9b0('0x3e')](handleError(_0x2b32cf,null));};exports[_0xb9b0('0x22')]=function(_0x148980,_0x5db6e8){return db[_0xb9b0('0x39')][_0xb9b0('0x41')]({'where':{'id':_0x148980['params']['id']}})[_0xb9b0('0x3c')](handleEntityNotFound(_0x5db6e8,null))[_0xb9b0('0x3c')](removeEntity(_0x5db6e8,null))[_0xb9b0('0x3e')](handleError(_0x5db6e8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1b6192a..4e58c9a 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 _0xa064=['path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3b629c,_0x52a4b7){var _0x9dc71b=function(_0x549101){while(--_0x549101){_0x3b629c['push'](_0x3b629c['shift']());}};_0x9dc71b(++_0x52a4b7);}(_0xa064,0x192));var _0x4a06=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xa064[_0x2c3a8f];return _0x189412;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x4a06('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd786=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xd786,0x1dc));var _0x6d78=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd786[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var logger=require(_0x6d78('0x2'))(_0x6d78('0x3'));var moment=require('moment');var BPromise=require(_0x6d78('0x4'));var rp=require(_0x6d78('0x5'));var fs=require('fs');var path=require(_0x6d78('0x6'));var rimraf=require(_0x6d78('0x7'));var config=require(_0x6d78('0x8'));var attributes=require(_0x6d78('0x9'));module[_0x6d78('0xa')]=function(_0x55ea32,_0x18c038){return _0x55ea32[_0x6d78('0xb')]('FreshsalesField',attributes,{'tableName':_0x6d78('0xc'),'paranoid':![],'indexes':[{'name':_0x6d78('0xd'),'fields':[_0x6d78('0xe'),_0x6d78('0xf')],'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 8ba57f2..b3a6515 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x524e,0x15e));var _0xe524=function(_0x1dda75,_0x4936ab){_0x1dda75=_0x1dda75-0x0;var _0xd9f07b=_0x524e[_0x1dda75];return _0xd9f07b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x2be2c7,_0x32900e){var _0x4cc9a7=function(_0x2a3c37){while(--_0x2a3c37){_0x2be2c7['push'](_0x2be2c7['shift']());}};_0x4cc9a7(++_0x32900e);}(_0x7c09,0x102));var _0x97c0=function(_0x14d485,_0x1c717d){_0x14d485=_0x14d485-0x0;var _0x14484a=_0x7c09[_0x14d485];return _0x14484a;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index df4c941..5da7c2e 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36c1df,_0x3dec7d){var _0x17b291=function(_0x584d4b){while(--_0x584d4b){_0x36c1df['push'](_0x36c1df['shift']());}};_0x17b291(++_0x3dec7d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x49809a,_0x5c32f0){var _0x44a13a=function(_0x24d72a){while(--_0x24d72a){_0x49809a['push'](_0x49809a['shift']());}};_0x44a13a(++_0x5c32f0);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7cb86b2..8103b87 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 _0x6426=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x6426,0x15b));var _0x6642=function(_0x52cd46,_0x487e80){_0x52cd46=_0x52cd46-0x0;var _0x134204=_0x6426[_0x52cd46];return _0x134204;};'use strict';var Sequelize=require(_0x6642('0x0'));module[_0x6642('0x1')]={'name':{'type':Sequelize[_0x6642('0x2')]},'description':{'type':Sequelize[_0x6642('0x2')]},'username':{'type':Sequelize[_0x6642('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x6642('0x2')]},'password':{'type':Sequelize[_0x6642('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x6642('0x2')]},'securityToken':{'type':Sequelize[_0x6642('0x2')]},'serverUrl':{'type':Sequelize[_0x6642('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6642('0x3')](_0x6642('0x4'),_0x6642('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x26c2=['exports','STRING','ENUM','integrationTab','newTab'];(function(_0x455838,_0x2092c7){var _0x25aba1=function(_0x4d5c01){while(--_0x4d5c01){_0x455838['push'](_0x455838['shift']());}};_0x25aba1(++_0x2092c7);}(_0x26c2,0x1d6));var _0x226c=function(_0x499c01,_0x5b0704){_0x499c01=_0x499c01-0x0;var _0x39673b=_0x26c2[_0x499c01];return _0x39673b;};'use strict';var Sequelize=require('sequelize');module[_0x226c('0x0')]={'name':{'type':Sequelize[_0x226c('0x1')]},'description':{'type':Sequelize[_0x226c('0x1')]},'username':{'type':Sequelize[_0x226c('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x226c('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x226c('0x1')]},'clientSecret':{'type':Sequelize[_0x226c('0x1')]},'securityToken':{'type':Sequelize[_0x226c('0x1')]},'serverUrl':{'type':Sequelize[_0x226c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x226c('0x2')](_0x226c('0x3'),_0x226c('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f18af84..951c7ff 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 _0x84c2=['send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Task','remoteUri','clientSecret','username','password','slice','substring','lastIndexOf','Connection','clientId','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','textarea','phone','remove','includes','custom','picklistValues','label','value','boolean','True','true','False','false','test','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','limit','undefined','count','offset','set','Content-Range','json','save','then','destroy','sendStatus','error','stack','name'];(function(_0x59f3d7,_0x189bb6){var _0x3d072d=function(_0x5d5f7f){while(--_0x5d5f7f){_0x59f3d7['push'](_0x59f3d7['shift']());}};_0x3d072d(++_0x189bb6);}(_0x84c2,0x14f));var _0x284c=function(_0x322718,_0x228645){_0x322718=_0x322718-0x0;var _0x5f43d1=_0x84c2[_0x322718];return _0x5f43d1;};'use strict';var emlformat=require(_0x284c('0x0'));var rimraf=require(_0x284c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x284c('0x2'));var rp=require(_0x284c('0x3'));var moment=require('moment');var BPromise=require(_0x284c('0x4'));var Mustache=require(_0x284c('0x5'));var util=require('util');var path=require(_0x284c('0x6'));var sox=require('sox');var csv=require(_0x284c('0x7'));var ejs=require(_0x284c('0x8'));var fs=require('fs');var fs_extra=require(_0x284c('0x9'));var _=require('lodash');var squel=require(_0x284c('0xa'));var crypto=require(_0x284c('0xb'));var jsforce=require(_0x284c('0xc'));var deskjs=require(_0x284c('0xd'));var toCsv=require(_0x284c('0x7'));var querystring=require(_0x284c('0xe'));var Papa=require(_0x284c('0xf'));var Redis=require(_0x284c('0x10'));var authService=require(_0x284c('0x11'));var qs=require(_0x284c('0x12'));var as=require(_0x284c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x284c('0x14'));var utils=require(_0x284c('0x15'));var config=require(_0x284c('0x16'));var licenseUtil=require(_0x284c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xd2fb14,_0x509041){_0x509041=_0x509041||0xcc;return function(_0x7e862a){if(_0x7e862a){return _0xd2fb14['sendStatus'](_0x509041);}return _0xd2fb14[_0x284c('0x18')](_0x509041)[_0x284c('0x19')]();};}function respondWithResult(_0x5583f2,_0x3697d1){_0x3697d1=_0x3697d1||0xc8;return function(_0x1930a9){if(_0x1930a9){return _0x5583f2[_0x284c('0x18')](_0x3697d1)['json'](_0x1930a9);}};}function respondWithFilteredResult(_0x5e79e7,_0x3201ab){return function(_0x26a7ce){if(_0x26a7ce){var _0x6b8930=typeof _0x3201ab['offset']==='undefined'&&typeof _0x3201ab[_0x284c('0x1a')]===_0x284c('0x1b');var _0x38ed71=_0x26a7ce[_0x284c('0x1c')];var _0x44542f=_0x6b8930?0x0:_0x3201ab['offset'];var _0x5c5eac=_0x6b8930?_0x26a7ce[_0x284c('0x1c')]:_0x3201ab[_0x284c('0x1d')]+_0x3201ab['limit'];var _0x519935;if(_0x5c5eac>=_0x38ed71){_0x5c5eac=_0x38ed71;_0x519935=0xc8;}else{_0x519935=0xce;}_0x5e79e7[_0x284c('0x18')](_0x519935);return _0x5e79e7[_0x284c('0x1e')](_0x284c('0x1f'),_0x44542f+'-'+_0x5c5eac+'/'+_0x38ed71)[_0x284c('0x20')](_0x26a7ce);}return null;};}function patchUpdates(_0x330d1b){return function(_0x5f11f6){try{jsonpatch['apply'](_0x5f11f6,_0x330d1b,!![]);}catch(_0x16559e){return BPromise['reject'](_0x16559e);}return _0x5f11f6[_0x284c('0x21')]();};}function saveUpdates(_0x117594,_0x386bf3){return function(_0x3d3a6d){if(_0x3d3a6d){return _0x3d3a6d['update'](_0x117594)[_0x284c('0x22')](function(_0x1d2ec0){return _0x1d2ec0;});}return null;};}function removeEntity(_0x2c94c2,_0xf5841a){return function(_0xac8f0f){if(_0xac8f0f){return _0xac8f0f[_0x284c('0x23')]()[_0x284c('0x22')](function(){_0x2c94c2[_0x284c('0x18')](0xcc)[_0x284c('0x19')]();});}};}function handleEntityNotFound(_0x106571,_0x28df0f){return function(_0x129c1f){if(!_0x129c1f){_0x106571[_0x284c('0x24')](0x194);}return _0x129c1f;};}function handleError(_0x7380b2,_0xb1a43){_0xb1a43=_0xb1a43||0x1f4;return function(_0xfea43d){logger[_0x284c('0x25')](_0xfea43d[_0x284c('0x26')]);if(_0xfea43d[_0x284c('0x27')]){delete _0xfea43d[_0x284c('0x27')];}_0x7380b2[_0x284c('0x18')](_0xb1a43)[_0x284c('0x28')](_0xfea43d);};}exports[_0x284c('0x29')]=function(_0x4055dc,_0x3e9e9b){var _0x46b7b4={},_0x3eaf78={},_0x3c9294={'count':0x0,'rows':[]};var _0x4ae7e9=_[_0x284c('0x2a')](db[_0x284c('0x2b')][_0x284c('0x2c')],function(_0x38b15a){return{'name':_0x38b15a[_0x284c('0x2d')],'type':_0x38b15a[_0x284c('0x2e')][_0x284c('0x2f')]};});_0x3eaf78['model']=_[_0x284c('0x2a')](_0x4ae7e9,_0x284c('0x27'));_0x3eaf78[_0x284c('0x30')]=_['keys'](_0x4055dc[_0x284c('0x30')]);_0x3eaf78[_0x284c('0x31')]=_[_0x284c('0x32')](_0x3eaf78[_0x284c('0x33')],_0x3eaf78[_0x284c('0x30')]);_0x46b7b4[_0x284c('0x34')]=_['intersection'](_0x3eaf78[_0x284c('0x33')],qs[_0x284c('0x35')](_0x4055dc[_0x284c('0x30')][_0x284c('0x35')]));_0x46b7b4[_0x284c('0x34')]=_0x46b7b4[_0x284c('0x34')][_0x284c('0x36')]?_0x46b7b4['attributes']:_0x3eaf78[_0x284c('0x33')];if(!_0x4055dc[_0x284c('0x30')][_0x284c('0x37')](_0x284c('0x38'))){_0x46b7b4['limit']=qs[_0x284c('0x1a')](_0x4055dc[_0x284c('0x30')][_0x284c('0x1a')]);_0x46b7b4[_0x284c('0x1d')]=qs[_0x284c('0x1d')](_0x4055dc[_0x284c('0x30')]['offset']);}_0x46b7b4[_0x284c('0x39')]=qs['sort'](_0x4055dc[_0x284c('0x30')][_0x284c('0x3a')]);_0x46b7b4[_0x284c('0x3b')]=qs[_0x284c('0x31')](_[_0x284c('0x3c')](_0x4055dc[_0x284c('0x30')],_0x3eaf78[_0x284c('0x31')]),_0x4ae7e9);if(_0x4055dc[_0x284c('0x30')][_0x284c('0x3d')]){_0x46b7b4[_0x284c('0x3b')]=_[_0x284c('0x3e')](_0x46b7b4[_0x284c('0x3b')],{'$or':_[_0x284c('0x2a')](_0x4ae7e9,function(_0x528952){if(_0x528952[_0x284c('0x2e')]!==_0x284c('0x3f')){var _0x30241e={};_0x30241e[_0x528952[_0x284c('0x27')]]={'$like':'%'+_0x4055dc[_0x284c('0x30')][_0x284c('0x3d')]+'%'};return _0x30241e;}})});}_0x46b7b4=_[_0x284c('0x3e')]({},_0x46b7b4,_0x4055dc[_0x284c('0x40')]);var _0x3283b0={'where':_0x46b7b4[_0x284c('0x3b')]};return db['SalesforceAccount'][_0x284c('0x1c')](_0x3283b0)[_0x284c('0x22')](function(_0x2e0f8e){_0x3c9294['count']=_0x2e0f8e;if(_0x4055dc[_0x284c('0x30')][_0x284c('0x41')]){_0x46b7b4[_0x284c('0x42')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x284c('0x43')](_0x46b7b4);})[_0x284c('0x22')](function(_0x186516){_0x3c9294[_0x284c('0x44')]=_0x186516;return _0x3c9294;})[_0x284c('0x22')](respondWithFilteredResult(_0x3e9e9b,_0x46b7b4))['catch'](handleError(_0x3e9e9b,null));};exports[_0x284c('0x45')]=function(_0x2655e4,_0xb8c729){var _0x4f3a5c={'raw':![],'where':{'id':_0x2655e4[_0x284c('0x46')]['id']}},_0x1b28d9={};_0x1b28d9[_0x284c('0x33')]=_[_0x284c('0x47')](db[_0x284c('0x2b')][_0x284c('0x2c')]);_0x1b28d9['query']=_[_0x284c('0x47')](_0x2655e4[_0x284c('0x30')]);_0x1b28d9['filters']=_['intersection'](_0x1b28d9['model'],_0x1b28d9[_0x284c('0x30')]);_0x4f3a5c[_0x284c('0x34')]=_[_0x284c('0x32')](_0x1b28d9[_0x284c('0x33')],qs['fields'](_0x2655e4[_0x284c('0x30')]['fields']));_0x4f3a5c[_0x284c('0x34')]=_0x4f3a5c[_0x284c('0x34')]['length']?_0x4f3a5c['attributes']:_0x1b28d9[_0x284c('0x33')];if(_0x2655e4['query']['includeAll']){_0x4f3a5c[_0x284c('0x42')]=[{'all':!![]}];}_0x4f3a5c=_[_0x284c('0x3e')]({},_0x4f3a5c,_0x2655e4[_0x284c('0x40')]);return db['SalesforceAccount'][_0x284c('0x48')](_0x4f3a5c)[_0x284c('0x22')](handleEntityNotFound(_0xb8c729,null))[_0x284c('0x22')](respondWithResult(_0xb8c729,null))[_0x284c('0x49')](handleError(_0xb8c729,null));};exports[_0x284c('0x4a')]=function(_0x2a5e66,_0x18125b){return db[_0x284c('0x2b')][_0x284c('0x4a')](_0x2a5e66['body'],{})[_0x284c('0x22')](respondWithResult(_0x18125b,0xc9))['catch'](handleError(_0x18125b,null));};exports['update']=function(_0x546eda,_0x3ea357){if(_0x546eda[_0x284c('0x4b')]['id']){delete _0x546eda['body']['id'];}return db[_0x284c('0x2b')][_0x284c('0x48')]({'where':{'id':_0x546eda[_0x284c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ea357,null))[_0x284c('0x22')](saveUpdates(_0x546eda[_0x284c('0x4b')],null))[_0x284c('0x22')](respondWithResult(_0x3ea357,null))[_0x284c('0x49')](handleError(_0x3ea357,null));};exports[_0x284c('0x23')]=function(_0x1e9c1e,_0x43dc2b){return db['SalesforceAccount'][_0x284c('0x48')]({'where':{'id':_0x1e9c1e['params']['id']}})['then'](handleEntityNotFound(_0x43dc2b,null))['then'](removeEntity(_0x43dc2b,null))[_0x284c('0x49')](handleError(_0x43dc2b,null));};exports['getConfigurations']=function(_0x48c41f,_0x4ff5b4,_0x5598c7){var _0x5ebdfa={};var _0x90250b={};var _0x55952e;var _0xe9d2c3;return db[_0x284c('0x2b')][_0x284c('0x4c')]({'where':{'id':_0x48c41f[_0x284c('0x46')]['id']}})[_0x284c('0x22')](handleEntityNotFound(_0x4ff5b4,null))['then'](function(_0x1c6a2d){if(_0x1c6a2d){_0x55952e=_0x1c6a2d;_0x90250b[_0x284c('0x33')]=_[_0x284c('0x47')](db[_0x284c('0x4d')][_0x284c('0x2c')]);_0x90250b['query']=_[_0x284c('0x47')](_0x48c41f[_0x284c('0x30')]);_0x90250b['filters']=_[_0x284c('0x32')](_0x90250b[_0x284c('0x33')],_0x90250b[_0x284c('0x30')]);_0x5ebdfa[_0x284c('0x34')]=_[_0x284c('0x32')](_0x90250b['model'],qs['fields'](_0x48c41f[_0x284c('0x30')][_0x284c('0x35')]));_0x5ebdfa[_0x284c('0x34')]=_0x5ebdfa[_0x284c('0x34')][_0x284c('0x36')]?_0x5ebdfa['attributes']:_0x90250b[_0x284c('0x33')];_0x5ebdfa[_0x284c('0x39')]=qs[_0x284c('0x3a')](_0x48c41f[_0x284c('0x30')][_0x284c('0x3a')]);_0x5ebdfa[_0x284c('0x3b')]=qs[_0x284c('0x31')](_[_0x284c('0x3c')](_0x48c41f['query'],_0x90250b[_0x284c('0x31')]));if(_0x48c41f[_0x284c('0x30')][_0x284c('0x3d')]){_0x5ebdfa[_0x284c('0x3b')]=_['merge'](_0x5ebdfa[_0x284c('0x3b')],{'$or':_[_0x284c('0x2a')](_0x5ebdfa[_0x284c('0x34')],function(_0x36c855){var _0x4edc62={};_0x4edc62[_0x36c855]={'$like':'%'+_0x48c41f[_0x284c('0x30')][_0x284c('0x3d')]+'%'};return _0x4edc62;})});}_0x5ebdfa=_['merge']({},_0x5ebdfa,_0x48c41f[_0x284c('0x40')]);return _0x55952e[_0x284c('0x4e')](_0x5ebdfa);}})['then'](function(_0x553993){if(_0x553993){_0xe9d2c3=_0x553993['length'];if(!_0x48c41f['query'][_0x284c('0x37')](_0x284c('0x38'))){_0x5ebdfa[_0x284c('0x1a')]=qs['limit'](_0x48c41f[_0x284c('0x30')][_0x284c('0x1a')]);_0x5ebdfa[_0x284c('0x1d')]=qs[_0x284c('0x1d')](_0x48c41f[_0x284c('0x30')][_0x284c('0x1d')]);}return _0x55952e[_0x284c('0x4e')](_0x5ebdfa);}})[_0x284c('0x22')](function(_0x20e4e2){if(_0x20e4e2){return _0x20e4e2?{'count':_0xe9d2c3,'rows':_0x20e4e2}:null;}})[_0x284c('0x22')](respondWithResult(_0x4ff5b4,null))[_0x284c('0x49')](handleError(_0x4ff5b4,null));};exports[_0x284c('0x4f')]=function(_0x54a00f,_0x4747da,_0x46db56){if(_0x54a00f['body']['id']){delete _0x54a00f[_0x284c('0x4b')]['id'];}return db[_0x284c('0x2b')][_0x284c('0x4c')]({'where':{'id':_0x54a00f['params']['id']}})['then'](handleEntityNotFound(_0x4747da,null))[_0x284c('0x22')](function(_0x43c8a9){if(_0x43c8a9){_0x54a00f[_0x284c('0x4b')][_0x284c('0x50')]=_0x43c8a9['id'];_0x54a00f[_0x284c('0x4b')][_0x284c('0x51')]=integrations['getSubjects'](_0x54a00f[_0x284c('0x4b')][_0x284c('0x52')],_0x54a00f[_0x284c('0x4b')][_0x284c('0x2e')]);_0x54a00f['body'][_0x284c('0x53')]=integrations[_0x284c('0x54')](_0x54a00f[_0x284c('0x4b')]['channel'],_0x54a00f[_0x284c('0x4b')][_0x284c('0x2e')]);return db['SalesforceConfiguration'][_0x284c('0x4a')](_0x54a00f['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4747da,null))[_0x284c('0x49')](handleError(_0x4747da,null));};exports['getFields']=function(_0x6676d7,_0x3c4b1d,_0xf8eace){var _0x12c712;var _0x576ffb='';var _0x540ac5=_0x284c('0x55');return db[_0x284c('0x2b')][_0x284c('0x4c')]({'where':{'id':_0x6676d7[_0x284c('0x46')]['id']},'attributes':['id',_0x284c('0x56'),'clientId',_0x284c('0x57'),_0x284c('0x58'),_0x284c('0x59'),'securityToken']})[_0x284c('0x22')](handleEntityNotFound(_0x3c4b1d,null))['then'](function(_0xd6b5ec){if(_0xd6b5ec){_0x576ffb=_0xd6b5ec[_0x284c('0x56')];var _0x5656aa=_0x576ffb[_0x284c('0x5a')](-0x1);if(_0x5656aa==='/'){_0x576ffb=_0x576ffb[_0x284c('0x5b')](0x0,_0x576ffb[_0x284c('0x5c')](_0x5656aa));}_0x12c712=new jsforce[(_0x284c('0x5d'))]({'oauth2':{'loginUrl':_0x576ffb,'clientId':_0xd6b5ec[_0x284c('0x5e')],'clientSecret':_0xd6b5ec[_0x284c('0x57')]}});return _0x12c712['login'](_0xd6b5ec[_0x284c('0x58')],_0xd6b5ec[_0x284c('0x59')][_0x284c('0x5f')](_0xd6b5ec['securityToken']));}})[_0x284c('0x22')](function(_0x3320bc){if(_0x3320bc){if(!_[_0x284c('0x60')](_0x6676d7[_0x284c('0x30')][_0x284c('0x61')])){_0x540ac5=_0x6676d7['query'][_0x284c('0x61')];}return _0x12c712['sobject'](_0x540ac5)[_0x284c('0x62')]();}})[_0x284c('0x22')](function(_0x37e1c0){var _0x1928a2=[_0x284c('0x63'),_0x284c('0x64'),_0x284c('0x65'),'IsRecurrence',_0x284c('0x66'),_0x284c('0x67')];var _0x49ec0b=[_0x284c('0x68'),_0x284c('0x69'),_0x284c('0x6a'),'boolean','email',_0x284c('0x6b'),_0x284c('0x6c')];if(_0x37e1c0){_[_0x284c('0x6d')](_0x37e1c0[_0x284c('0x35')],function(_0x276eaa){return _0x1928a2[_0x284c('0x6e')](_0x276eaa[_0x284c('0x27')])||!_0x49ec0b[_0x284c('0x6e')](_0x276eaa['type']);});return{'count':_0x37e1c0['fields'][_0x284c('0x36')],'rows':_['map'](_0x37e1c0[_0x284c('0x35')],function(_0x5700e5){return{'id':_0x5700e5[_0x284c('0x27')],'name':_0x5700e5['label'],'custom':_0x5700e5[_0x284c('0x6f')],'options':_0x5700e5[_0x284c('0x70')][_0x284c('0x36')]>0x0?_[_0x284c('0x2a')](_0x5700e5[_0x284c('0x70')],function(_0x5166ff){return{'name':_0x5166ff[_0x284c('0x71')],'value':_0x5166ff[_0x284c('0x72')]};}):_0x5700e5['type']==_0x284c('0x73')?[{'name':_0x284c('0x74'),'value':_0x284c('0x75')},{'name':_0x284c('0x76'),'value':_0x284c('0x77')}]:[]};})};}})[_0x284c('0x22')](respondWithResult(_0x3c4b1d,null))[_0x284c('0x49')](function(_0x4925a0){var _0x318c9a=_0x6676d7['query'][_0x284c('0x78')]?0x1f4:_0x4925a0['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x284c('0x79'),_0x318c9a,JSON[_0x284c('0x7a')](_0x4925a0));delete _0x4925a0[_0x284c('0x27')];if(_0x318c9a===0x191){_0x318c9a=0x190;}_0x3c4b1d[_0x284c('0x18')](_0x318c9a)[_0x284c('0x28')](_0x6676d7['query'][_0x284c('0x78')]?{'message':_0x284c('0x7b'),'statusCode':_0x4925a0[_0x284c('0x7c')]}:_0x4925a0);});}; \ No newline at end of file +var _0x7754=['Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','username','password','slice','substring','lastIndexOf','Connection','clientSecret','login','securityToken','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','phone','includes','label','picklistValues','True','true','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','stack','name','map','SalesforceAccount','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','options','then','findAll','catch','show','include','create','body','find','params','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects'];(function(_0x1bfec9,_0x2a863a){var _0x35cb18=function(_0x257a02){while(--_0x257a02){_0x1bfec9['push'](_0x1bfec9['shift']());}};_0x35cb18(++_0x2a863a);}(_0x7754,0x186));var _0x4775=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x7754[_0x510c60];return _0x49c4aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4775('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4775('0x1'));var rp=require('request-promise');var moment=require(_0x4775('0x2'));var BPromise=require(_0x4775('0x3'));var Mustache=require(_0x4775('0x4'));var util=require(_0x4775('0x5'));var path=require(_0x4775('0x6'));var sox=require(_0x4775('0x7'));var csv=require(_0x4775('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4775('0x9'));var _=require(_0x4775('0xa'));var squel=require(_0x4775('0xb'));var crypto=require(_0x4775('0xc'));var jsforce=require(_0x4775('0xd'));var deskjs=require(_0x4775('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4775('0xf'));var Papa=require('papaparse');var Redis=require(_0x4775('0x10'));var authService=require(_0x4775('0x11'));var qs=require(_0x4775('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4775('0x13'));var logger=require('../../config/logger')(_0x4775('0x14'));var utils=require(_0x4775('0x15'));var config=require(_0x4775('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4775('0x17'))['db'];var integrations=require(_0x4775('0x18'));function respondWithStatusCode(_0x34f582,_0xbc5f9c){_0xbc5f9c=_0xbc5f9c||0xcc;return function(_0x6d616f){if(_0x6d616f){return _0x34f582[_0x4775('0x19')](_0xbc5f9c);}return _0x34f582[_0x4775('0x1a')](_0xbc5f9c)[_0x4775('0x1b')]();};}function respondWithResult(_0x199f93,_0x7332f5){_0x7332f5=_0x7332f5||0xc8;return function(_0x14fa4e){if(_0x14fa4e){return _0x199f93[_0x4775('0x1a')](_0x7332f5)[_0x4775('0x1c')](_0x14fa4e);}};}function respondWithFilteredResult(_0x22df83,_0x40d1b5){return function(_0x4cea0b){if(_0x4cea0b){var _0x4843cc=typeof _0x40d1b5[_0x4775('0x1d')]===_0x4775('0x1e')&&typeof _0x40d1b5['limit']===_0x4775('0x1e');var _0x3e6f08=_0x4cea0b[_0x4775('0x1f')];var _0x4b0791=_0x4843cc?0x0:_0x40d1b5['offset'];var _0x70fcc0=_0x4843cc?_0x4cea0b[_0x4775('0x1f')]:_0x40d1b5[_0x4775('0x1d')]+_0x40d1b5[_0x4775('0x20')];var _0x3ff1da;if(_0x70fcc0>=_0x3e6f08){_0x70fcc0=_0x3e6f08;_0x3ff1da=0xc8;}else{_0x3ff1da=0xce;}_0x22df83['status'](_0x3ff1da);return _0x22df83[_0x4775('0x21')](_0x4775('0x22'),_0x4b0791+'-'+_0x70fcc0+'/'+_0x3e6f08)['json'](_0x4cea0b);}return null;};}function patchUpdates(_0x2534d1){return function(_0x4214e7){try{jsonpatch[_0x4775('0x23')](_0x4214e7,_0x2534d1,!![]);}catch(_0x3cbd4a){return BPromise[_0x4775('0x24')](_0x3cbd4a);}return _0x4214e7[_0x4775('0x25')]();};}function saveUpdates(_0x14d246,_0x24dc3d){return function(_0x5bc010){if(_0x5bc010){return _0x5bc010[_0x4775('0x26')](_0x14d246)['then'](function(_0x58c6c6){return _0x58c6c6;});}return null;};}function removeEntity(_0x4c3b1e,_0x238fe2){return function(_0x553c4b){if(_0x553c4b){return _0x553c4b['destroy']()['then'](function(){_0x4c3b1e[_0x4775('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44569e,_0x18b555){return function(_0x362953){if(!_0x362953){_0x44569e[_0x4775('0x19')](0x194);}return _0x362953;};}function handleError(_0x132683,_0x262946){_0x262946=_0x262946||0x1f4;return function(_0x3d2390){logger['error'](_0x3d2390[_0x4775('0x27')]);if(_0x3d2390[_0x4775('0x28')]){delete _0x3d2390['name'];}_0x132683['status'](_0x262946)['send'](_0x3d2390);};}exports['index']=function(_0x4d8f5e,_0x4af8f6){var _0x129ad1={},_0x7e34f4={},_0x545bc8={'count':0x0,'rows':[]};var _0x380202=_[_0x4775('0x29')](db[_0x4775('0x2a')][_0x4775('0x2b')],function(_0x2e9cce){return{'name':_0x2e9cce['fieldName'],'type':_0x2e9cce[_0x4775('0x2c')][_0x4775('0x2d')]};});_0x7e34f4['model']=_[_0x4775('0x29')](_0x380202,_0x4775('0x28'));_0x7e34f4[_0x4775('0x2e')]=_[_0x4775('0x2f')](_0x4d8f5e[_0x4775('0x2e')]);_0x7e34f4['filters']=_['intersection'](_0x7e34f4[_0x4775('0x30')],_0x7e34f4[_0x4775('0x2e')]);_0x129ad1[_0x4775('0x31')]=_[_0x4775('0x32')](_0x7e34f4[_0x4775('0x30')],qs[_0x4775('0x33')](_0x4d8f5e[_0x4775('0x2e')][_0x4775('0x33')]));_0x129ad1[_0x4775('0x31')]=_0x129ad1['attributes'][_0x4775('0x34')]?_0x129ad1[_0x4775('0x31')]:_0x7e34f4[_0x4775('0x30')];if(!_0x4d8f5e[_0x4775('0x2e')]['hasOwnProperty'](_0x4775('0x35'))){_0x129ad1[_0x4775('0x20')]=qs[_0x4775('0x20')](_0x4d8f5e[_0x4775('0x2e')][_0x4775('0x20')]);_0x129ad1['offset']=qs[_0x4775('0x1d')](_0x4d8f5e[_0x4775('0x2e')][_0x4775('0x1d')]);}_0x129ad1[_0x4775('0x36')]=qs['sort'](_0x4d8f5e['query'][_0x4775('0x37')]);_0x129ad1[_0x4775('0x38')]=qs[_0x4775('0x39')](_['pick'](_0x4d8f5e[_0x4775('0x2e')],_0x7e34f4['filters']),_0x380202);if(_0x4d8f5e[_0x4775('0x2e')][_0x4775('0x3a')]){_0x129ad1['where']=_['merge'](_0x129ad1[_0x4775('0x38')],{'$or':_[_0x4775('0x29')](_0x380202,function(_0x2449b0){if(_0x2449b0[_0x4775('0x2c')]!=='VIRTUAL'){var _0x234857={};_0x234857[_0x2449b0[_0x4775('0x28')]]={'$like':'%'+_0x4d8f5e['query'][_0x4775('0x3a')]+'%'};return _0x234857;}})});}_0x129ad1=_[_0x4775('0x3b')]({},_0x129ad1,_0x4d8f5e[_0x4775('0x3c')]);var _0x56fcf8={'where':_0x129ad1[_0x4775('0x38')]};return db[_0x4775('0x2a')][_0x4775('0x1f')](_0x56fcf8)[_0x4775('0x3d')](function(_0xcd95aa){_0x545bc8[_0x4775('0x1f')]=_0xcd95aa;if(_0x4d8f5e['query']['includeAll']){_0x129ad1['include']=[{'all':!![]}];}return db[_0x4775('0x2a')][_0x4775('0x3e')](_0x129ad1);})[_0x4775('0x3d')](function(_0x3809f6){_0x545bc8['rows']=_0x3809f6;return _0x545bc8;})[_0x4775('0x3d')](respondWithFilteredResult(_0x4af8f6,_0x129ad1))[_0x4775('0x3f')](handleError(_0x4af8f6,null));};exports[_0x4775('0x40')]=function(_0x2f305d,_0x388cb2){var _0xcbcdce={'raw':![],'where':{'id':_0x2f305d['params']['id']}},_0x5f4901={};_0x5f4901[_0x4775('0x30')]=_[_0x4775('0x2f')](db['SalesforceAccount'][_0x4775('0x2b')]);_0x5f4901[_0x4775('0x2e')]=_[_0x4775('0x2f')](_0x2f305d[_0x4775('0x2e')]);_0x5f4901[_0x4775('0x39')]=_[_0x4775('0x32')](_0x5f4901[_0x4775('0x30')],_0x5f4901[_0x4775('0x2e')]);_0xcbcdce['attributes']=_['intersection'](_0x5f4901['model'],qs[_0x4775('0x33')](_0x2f305d[_0x4775('0x2e')][_0x4775('0x33')]));_0xcbcdce[_0x4775('0x31')]=_0xcbcdce[_0x4775('0x31')][_0x4775('0x34')]?_0xcbcdce[_0x4775('0x31')]:_0x5f4901[_0x4775('0x30')];if(_0x2f305d[_0x4775('0x2e')]['includeAll']){_0xcbcdce[_0x4775('0x41')]=[{'all':!![]}];}_0xcbcdce=_['merge']({},_0xcbcdce,_0x2f305d[_0x4775('0x3c')]);return db[_0x4775('0x2a')]['find'](_0xcbcdce)[_0x4775('0x3d')](handleEntityNotFound(_0x388cb2,null))['then'](respondWithResult(_0x388cb2,null))['catch'](handleError(_0x388cb2,null));};exports[_0x4775('0x42')]=function(_0x168026,_0x1f21a1){return db[_0x4775('0x2a')][_0x4775('0x42')](_0x168026[_0x4775('0x43')],{})[_0x4775('0x3d')](respondWithResult(_0x1f21a1,0xc9))['catch'](handleError(_0x1f21a1,null));};exports['update']=function(_0x3eee97,_0x381e85){if(_0x3eee97['body']['id']){delete _0x3eee97[_0x4775('0x43')]['id'];}return db['SalesforceAccount'][_0x4775('0x44')]({'where':{'id':_0x3eee97[_0x4775('0x45')]['id']}})['then'](handleEntityNotFound(_0x381e85,null))[_0x4775('0x3d')](saveUpdates(_0x3eee97['body'],null))['then'](respondWithResult(_0x381e85,null))[_0x4775('0x3f')](handleError(_0x381e85,null));};exports['destroy']=function(_0x4402a9,_0x228f15){return db[_0x4775('0x2a')][_0x4775('0x44')]({'where':{'id':_0x4402a9['params']['id']}})['then'](handleEntityNotFound(_0x228f15,null))['then'](removeEntity(_0x228f15,null))[_0x4775('0x3f')](handleError(_0x228f15,null));};exports[_0x4775('0x46')]=function(_0x496313,_0x11305d,_0x25b61f){var _0x494515={};var _0x4591de={};var _0x5c50a6;var _0x264ee8;return db[_0x4775('0x2a')]['findOne']({'where':{'id':_0x496313[_0x4775('0x45')]['id']}})[_0x4775('0x3d')](handleEntityNotFound(_0x11305d,null))['then'](function(_0x1476b4){if(_0x1476b4){_0x5c50a6=_0x1476b4;_0x4591de['model']=_['keys'](db[_0x4775('0x47')]['rawAttributes']);_0x4591de[_0x4775('0x2e')]=_[_0x4775('0x2f')](_0x496313[_0x4775('0x2e')]);_0x4591de[_0x4775('0x39')]=_['intersection'](_0x4591de['model'],_0x4591de['query']);_0x494515[_0x4775('0x31')]=_['intersection'](_0x4591de['model'],qs[_0x4775('0x33')](_0x496313['query']['fields']));_0x494515[_0x4775('0x31')]=_0x494515[_0x4775('0x31')][_0x4775('0x34')]?_0x494515[_0x4775('0x31')]:_0x4591de[_0x4775('0x30')];_0x494515[_0x4775('0x36')]=qs[_0x4775('0x37')](_0x496313[_0x4775('0x2e')][_0x4775('0x37')]);_0x494515[_0x4775('0x38')]=qs['filters'](_['pick'](_0x496313[_0x4775('0x2e')],_0x4591de['filters']));if(_0x496313[_0x4775('0x2e')][_0x4775('0x3a')]){_0x494515['where']=_[_0x4775('0x3b')](_0x494515['where'],{'$or':_[_0x4775('0x29')](_0x494515[_0x4775('0x31')],function(_0x3de5bb){var _0xe0cb47={};_0xe0cb47[_0x3de5bb]={'$like':'%'+_0x496313[_0x4775('0x2e')][_0x4775('0x3a')]+'%'};return _0xe0cb47;})});}_0x494515=_[_0x4775('0x3b')]({},_0x494515,_0x496313['options']);return _0x5c50a6[_0x4775('0x46')](_0x494515);}})[_0x4775('0x3d')](function(_0x1a3950){if(_0x1a3950){_0x264ee8=_0x1a3950[_0x4775('0x34')];if(!_0x496313[_0x4775('0x2e')][_0x4775('0x48')](_0x4775('0x35'))){_0x494515[_0x4775('0x20')]=qs['limit'](_0x496313[_0x4775('0x2e')][_0x4775('0x20')]);_0x494515[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x496313['query'][_0x4775('0x1d')]);}return _0x5c50a6[_0x4775('0x46')](_0x494515);}})[_0x4775('0x3d')](function(_0x5ae5d8){if(_0x5ae5d8){return _0x5ae5d8?{'count':_0x264ee8,'rows':_0x5ae5d8}:null;}})['then'](respondWithResult(_0x11305d,null))[_0x4775('0x3f')](handleError(_0x11305d,null));};exports[_0x4775('0x49')]=function(_0x56a0a5,_0x5cfee5,_0x518d00){if(_0x56a0a5['body']['id']){delete _0x56a0a5['body']['id'];}return db[_0x4775('0x2a')][_0x4775('0x4a')]({'where':{'id':_0x56a0a5[_0x4775('0x45')]['id']}})[_0x4775('0x3d')](handleEntityNotFound(_0x5cfee5,null))[_0x4775('0x3d')](function(_0xe657a1){if(_0xe657a1){_0x56a0a5[_0x4775('0x43')][_0x4775('0x4b')]=_0xe657a1['id'];_0x56a0a5[_0x4775('0x43')][_0x4775('0x4c')]=integrations[_0x4775('0x4d')](_0x56a0a5['body']['channel'],_0x56a0a5[_0x4775('0x43')][_0x4775('0x2c')]);_0x56a0a5[_0x4775('0x43')][_0x4775('0x4e')]=integrations[_0x4775('0x4f')](_0x56a0a5[_0x4775('0x43')]['channel'],_0x56a0a5[_0x4775('0x43')]['type']);return db[_0x4775('0x47')][_0x4775('0x42')](_0x56a0a5['body'],{'include':[{'model':db[_0x4775('0x50')],'as':_0x4775('0x4c')},{'model':db[_0x4775('0x50')],'as':'Descriptions'}]});}return null;})[_0x4775('0x3d')](respondWithResult(_0x5cfee5,null))['catch'](handleError(_0x5cfee5,null));};exports[_0x4775('0x51')]=function(_0xc7f748,_0x4de2fe,_0x2eb60a){var _0x29825a;var _0x36d35b='';var _0x5b48d6='Task';return db['SalesforceAccount'][_0x4775('0x4a')]({'where':{'id':_0xc7f748[_0x4775('0x45')]['id']},'attributes':['id',_0x4775('0x52'),_0x4775('0x53'),'clientSecret',_0x4775('0x54'),_0x4775('0x55'),'securityToken']})[_0x4775('0x3d')](handleEntityNotFound(_0x4de2fe,null))[_0x4775('0x3d')](function(_0x2ab93c){if(_0x2ab93c){_0x36d35b=_0x2ab93c[_0x4775('0x52')];var _0x2a89bc=_0x36d35b[_0x4775('0x56')](-0x1);if(_0x2a89bc==='/'){_0x36d35b=_0x36d35b[_0x4775('0x57')](0x0,_0x36d35b[_0x4775('0x58')](_0x2a89bc));}_0x29825a=new jsforce[(_0x4775('0x59'))]({'oauth2':{'loginUrl':_0x36d35b,'clientId':_0x2ab93c[_0x4775('0x53')],'clientSecret':_0x2ab93c[_0x4775('0x5a')]}});return _0x29825a[_0x4775('0x5b')](_0x2ab93c[_0x4775('0x54')],_0x2ab93c[_0x4775('0x55')]['concat'](_0x2ab93c[_0x4775('0x5c')]));}})[_0x4775('0x3d')](function(_0x2fc54d){if(_0x2fc54d){if(!_['isNil'](_0xc7f748[_0x4775('0x2e')][_0x4775('0x5d')])){_0x5b48d6=_0xc7f748[_0x4775('0x2e')][_0x4775('0x5d')];}return _0x29825a[_0x4775('0x5e')](_0x5b48d6)['describe']();}})[_0x4775('0x3d')](function(_0x581a66){var _0x31077c=['OwnerId',_0x4775('0x5f'),_0x4775('0x60'),_0x4775('0x61'),_0x4775('0x62'),_0x4775('0x63')];var _0x4d695d=['string',_0x4775('0x64'),_0x4775('0x65'),_0x4775('0x66'),'email','textarea',_0x4775('0x67')];if(_0x581a66){_['remove'](_0x581a66[_0x4775('0x33')],function(_0x2dab03){return _0x31077c['includes'](_0x2dab03['name'])||!_0x4d695d[_0x4775('0x68')](_0x2dab03[_0x4775('0x2c')]);});return{'count':_0x581a66['fields'][_0x4775('0x34')],'rows':_[_0x4775('0x29')](_0x581a66['fields'],function(_0xe2c0dd){return{'id':_0xe2c0dd[_0x4775('0x28')],'name':_0xe2c0dd[_0x4775('0x69')],'custom':_0xe2c0dd['custom'],'options':_0xe2c0dd['picklistValues'][_0x4775('0x34')]>0x0?_[_0x4775('0x29')](_0xe2c0dd[_0x4775('0x6a')],function(_0x4eb390){return{'name':_0x4eb390[_0x4775('0x69')],'value':_0x4eb390['value']};}):_0xe2c0dd[_0x4775('0x2c')]==_0x4775('0x66')?[{'name':_0x4775('0x6b'),'value':_0x4775('0x6c')},{'name':_0x4775('0x6d'),'value':'false'}]:[]};})};}})[_0x4775('0x3d')](respondWithResult(_0x4de2fe,null))[_0x4775('0x3f')](function(_0x447e3a){var _0x32d3bf=_0xc7f748[_0x4775('0x2e')][_0x4775('0x6e')]?0x1f4:_0x447e3a[_0x4775('0x6f')]||0x1f4;logger[_0x4775('0x70')](_0x4775('0x71'),'getFields',_0x32d3bf,JSON[_0x4775('0x72')](_0x447e3a));delete _0x447e3a[_0x4775('0x28')];if(_0x32d3bf===0x191){_0x32d3bf=0x190;}_0x4de2fe[_0x4775('0x1a')](_0x32d3bf)[_0x4775('0x73')](_0xc7f748[_0x4775('0x2e')][_0x4775('0x6e')]?{'message':_0x4775('0x74'),'statusCode':_0x447e3a['statusCode']}:_0x447e3a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 69ba1c8..a8f8ee1 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 _0x1542=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x588335,_0x35a72b){var _0x2ccfde=function(_0x21fa3b){while(--_0x21fa3b){_0x588335['push'](_0x588335['shift']());}};_0x2ccfde(++_0x35a72b);}(_0x1542,0x116));var _0x2154=function(_0x4e1386,_0x2bc8a0){_0x4e1386=_0x4e1386-0x0;var _0x240049=_0x1542[_0x4e1386];return _0x240049;};'use strict';var _=require(_0x2154('0x0'));var util=require(_0x2154('0x1'));var logger=require(_0x2154('0x2'))(_0x2154('0x3'));var moment=require(_0x2154('0x4'));var BPromise=require('bluebird');var rp=require(_0x2154('0x5'));var fs=require('fs');var path=require(_0x2154('0x6'));var rimraf=require(_0x2154('0x7'));var config=require('../../config/environment');var attributes=require(_0x2154('0x8'));var integrations=require(_0x2154('0x9'));module['exports']=function(_0x13d9c2,_0x23abb5){return _0x13d9c2[_0x2154('0xa')](_0x2154('0xb'),attributes,{'tableName':_0x2154('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa71e=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x29e79b,_0x4a3649){var _0x6bc2b5=function(_0x57b630){while(--_0x57b630){_0x29e79b['push'](_0x29e79b['shift']());}};_0x6bc2b5(++_0x4a3649);}(_0xa71e,0x7b));var _0xea71=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xa71e[_0x49052b];return _0x48c045;};'use strict';var _=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var logger=require('../../config/logger')(_0xea71('0x2'));var moment=require('moment');var BPromise=require(_0xea71('0x3'));var rp=require(_0xea71('0x4'));var fs=require('fs');var path=require(_0xea71('0x5'));var rimraf=require(_0xea71('0x6'));var config=require(_0xea71('0x7'));var attributes=require(_0xea71('0x8'));var integrations=require(_0xea71('0x9'));module[_0xea71('0xa')]=function(_0x387227,_0x5c5a81){return _0x387227[_0xea71('0xb')](_0xea71('0xc'),attributes,{'tableName':_0xea71('0xd'),'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 59e76ea..1654aae 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 _0x62c9=['../../config/environment','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','map','attributes','model','debug','ShowSalesforceAccount','find','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52de47,_0xe29fb8){var _0x1a6a3f=function(_0x3f3d19){while(--_0x3f3d19){_0x52de47['push'](_0x52de47['shift']());}};_0x1a6a3f(++_0xe29fb8);}(_0x62c9,0x133));var _0x962c=function(_0x3dea54,_0x27386b){_0x3dea54=_0x3dea54-0x0;var _0x12dd89=_0x62c9[_0x3dea54];return _0x12dd89;};'use strict';var _=require('lodash');var util=require(_0x962c('0x0'));var moment=require(_0x962c('0x1'));var BPromise=require(_0x962c('0x2'));var rs=require(_0x962c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x962c('0x4'))['db'];var utils=require(_0x962c('0x5'));var logger=require(_0x962c('0x6'))(_0x962c('0x7'));var config=require(_0x962c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x962c('0x9')][_0x962c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4afe38,_0x2debfb,_0x20fb9e){return new BPromise(function(_0x3f90b8,_0x4b4a4f){return client[_0x962c('0xb')](_0x4afe38,_0x20fb9e)[_0x962c('0xc')](function(_0x376355){logger['info'](_0x962c('0xd'),_0x2debfb,_0x962c('0xe'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2debfb,_0x962c('0xe'),JSON[_0x962c('0xf')](_0x376355));if(_0x376355[_0x962c('0x10')]){if(_0x376355[_0x962c('0x10')]['code']===0x1f4){logger[_0x962c('0x10')](_0x962c('0xd'),_0x2debfb,_0x376355[_0x962c('0x10')][_0x962c('0x11')]);return _0x4b4a4f(_0x376355['error'][_0x962c('0x11')]);}logger['error'](_0x962c('0xd'),_0x2debfb,_0x376355['error'][_0x962c('0x11')]);return _0x3f90b8(_0x376355[_0x962c('0x10')][_0x962c('0x11')]);}else{logger[_0x962c('0x12')](_0x962c('0xd'),_0x2debfb,_0x962c('0xe'));_0x3f90b8(_0x376355[_0x962c('0x13')]['message']);}})[_0x962c('0x14')](function(_0x41da1e){logger[_0x962c('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2debfb,_0x41da1e);_0x4b4a4f(_0x41da1e);});});}exports[_0x962c('0x15')]=function(_0x2c456a){var _0x41bc75=this;return new Promise(function(_0x222844,_0xef9738){return db[_0x962c('0x16')][_0x962c('0x17')]({'raw':_0x2c456a[_0x962c('0x18')]?_0x2c456a[_0x962c('0x18')][_0x962c('0x19')]===undefined?!![]:![]:!![],'where':_0x2c456a['options']?_0x2c456a[_0x962c('0x18')]['where']||null:null,'attributes':_0x2c456a[_0x962c('0x18')]?_0x2c456a[_0x962c('0x18')]['attributes']||null:null,'limit':_0x2c456a[_0x962c('0x18')]?_0x2c456a[_0x962c('0x18')][_0x962c('0x1a')]||null:null,'include':_0x2c456a[_0x962c('0x18')]?_0x2c456a[_0x962c('0x18')][_0x962c('0x1b')]?_[_0x962c('0x1c')](_0x2c456a[_0x962c('0x18')][_0x962c('0x1b')],function(_0x2a3517){return{'model':db[_0x2a3517['model']],'as':_0x2a3517['as'],'attributes':_0x2a3517[_0x962c('0x1d')],'include':_0x2a3517[_0x962c('0x1b')]?_[_0x962c('0x1c')](_0x2a3517['include'],function(_0x2bc1d2){return{'model':db[_0x2bc1d2[_0x962c('0x1e')]],'as':_0x2bc1d2['as'],'attributes':_0x2bc1d2[_0x962c('0x1d')],'include':_0x2bc1d2['include']?_[_0x962c('0x1c')](_0x2bc1d2['include'],function(_0x214826){return{'model':db[_0x214826[_0x962c('0x1e')]],'as':_0x214826['as'],'attributes':_0x214826[_0x962c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xed744e){logger['info'](_0x962c('0x15'),_0x2c456a);logger[_0x962c('0x1f')]('GetSalesforceAccount',_0x2c456a,JSON['stringify'](_0xed744e));_0x222844(_0xed744e);})['catch'](function(_0x2d218b){logger['error'](_0x962c('0x15'),_0x2d218b[_0x962c('0x11')],_0x2c456a);_0xef9738(_0x41bc75['error'](0x1f4,_0x2d218b[_0x962c('0x11')]));});});};exports[_0x962c('0x20')]=function(_0x515e98){var _0x5d2571=this;return new Promise(function(_0x4304a7,_0x5b40d7){return db[_0x962c('0x16')][_0x962c('0x21')]({'raw':_0x515e98[_0x962c('0x18')]?_0x515e98['options'][_0x962c('0x19')]===undefined?!![]:![]:!![],'where':_0x515e98[_0x962c('0x18')]?_0x515e98[_0x962c('0x18')][_0x962c('0x22')]||null:null,'attributes':_0x515e98[_0x962c('0x18')]?_0x515e98[_0x962c('0x18')][_0x962c('0x1d')]||null:null,'include':_0x515e98[_0x962c('0x18')]?_0x515e98[_0x962c('0x18')]['include']?_['map'](_0x515e98[_0x962c('0x18')][_0x962c('0x1b')],function(_0x1a6fc3){return{'model':db[_0x1a6fc3[_0x962c('0x1e')]],'as':_0x1a6fc3['as'],'attributes':_0x1a6fc3[_0x962c('0x1d')],'include':_0x1a6fc3[_0x962c('0x1b')]?_[_0x962c('0x1c')](_0x1a6fc3['include'],function(_0x3e5a57){return{'model':db[_0x3e5a57[_0x962c('0x1e')]],'as':_0x3e5a57['as'],'attributes':_0x3e5a57[_0x962c('0x1d')],'include':_0x3e5a57[_0x962c('0x1b')]?_[_0x962c('0x1c')](_0x3e5a57[_0x962c('0x1b')],function(_0x3f8edf){return{'model':db[_0x3f8edf[_0x962c('0x1e')]],'as':_0x3f8edf['as'],'attributes':_0x3f8edf[_0x962c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x962c('0xc')](function(_0x45bf31){logger[_0x962c('0x12')](_0x962c('0x20'),_0x515e98);logger[_0x962c('0x1f')](_0x962c('0x20'),_0x515e98,JSON['stringify'](_0x45bf31));_0x4304a7(_0x45bf31);})['catch'](function(_0x17063f){logger[_0x962c('0x10')](_0x962c('0x20'),_0x17063f[_0x962c('0x11')],_0x515e98);_0x5b40d7(_0x5d2571[_0x962c('0x10')](0x1f4,_0x17063f['message']));});});}; \ No newline at end of file +var _0x02bb=['SalesforceAccount','findAll','options','where','limit','map','model','include','attributes','ShowSalesforceAccount','find','raw','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x02bb,0xec));var _0xb02b=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x02bb[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0xb02b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb02b('0x1'));var logger=require(_0xb02b('0x2'))(_0xb02b('0x3'));var config=require(_0xb02b('0x4'));var jayson=require(_0xb02b('0x5'));var client=jayson[_0xb02b('0x6')][_0xb02b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x419b23,_0x5c8253,_0xa1d08e){return new BPromise(function(_0xebc47b,_0x408b98){return client['request'](_0x419b23,_0xa1d08e)[_0xb02b('0x8')](function(_0x424516){logger[_0xb02b('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x5c8253,_0xb02b('0xa'));logger[_0xb02b('0xb')](_0xb02b('0xc'),_0x5c8253,_0xb02b('0xa'),JSON[_0xb02b('0xd')](_0x424516));if(_0x424516[_0xb02b('0xe')]){if(_0x424516[_0xb02b('0xe')][_0xb02b('0xf')]===0x1f4){logger[_0xb02b('0xe')](_0xb02b('0x10'),_0x5c8253,_0x424516[_0xb02b('0xe')][_0xb02b('0x11')]);return _0x408b98(_0x424516[_0xb02b('0xe')][_0xb02b('0x11')]);}logger[_0xb02b('0xe')](_0xb02b('0x10'),_0x5c8253,_0x424516[_0xb02b('0xe')][_0xb02b('0x11')]);return _0xebc47b(_0x424516[_0xb02b('0xe')]['message']);}else{logger[_0xb02b('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x5c8253,_0xb02b('0xa'));_0xebc47b(_0x424516['result'][_0xb02b('0x11')]);}})[_0xb02b('0x12')](function(_0x2e6553){logger['error'](_0xb02b('0x10'),_0x5c8253,_0x2e6553);_0x408b98(_0x2e6553);});});}exports[_0xb02b('0x13')]=function(_0x5bad72){var _0x28fb71=this;return new Promise(function(_0x5443fe,_0x40dcc0){return db[_0xb02b('0x14')][_0xb02b('0x15')]({'raw':_0x5bad72[_0xb02b('0x16')]?_0x5bad72[_0xb02b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5bad72[_0xb02b('0x16')]?_0x5bad72['options'][_0xb02b('0x17')]||null:null,'attributes':_0x5bad72[_0xb02b('0x16')]?_0x5bad72[_0xb02b('0x16')]['attributes']||null:null,'limit':_0x5bad72[_0xb02b('0x16')]?_0x5bad72[_0xb02b('0x16')][_0xb02b('0x18')]||null:null,'include':_0x5bad72[_0xb02b('0x16')]?_0x5bad72[_0xb02b('0x16')]['include']?_[_0xb02b('0x19')](_0x5bad72['options']['include'],function(_0x3229bd){return{'model':db[_0x3229bd[_0xb02b('0x1a')]],'as':_0x3229bd['as'],'attributes':_0x3229bd['attributes'],'include':_0x3229bd[_0xb02b('0x1b')]?_['map'](_0x3229bd['include'],function(_0x4f53cf){return{'model':db[_0x4f53cf[_0xb02b('0x1a')]],'as':_0x4f53cf['as'],'attributes':_0x4f53cf[_0xb02b('0x1c')],'include':_0x4f53cf['include']?_[_0xb02b('0x19')](_0x4f53cf[_0xb02b('0x1b')],function(_0x3da7b5){return{'model':db[_0x3da7b5['model']],'as':_0x3da7b5['as'],'attributes':_0x3da7b5[_0xb02b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb02b('0x8')](function(_0xeb92c5){logger[_0xb02b('0x9')](_0xb02b('0x13'),_0x5bad72);logger['debug'](_0xb02b('0x13'),_0x5bad72,JSON['stringify'](_0xeb92c5));_0x5443fe(_0xeb92c5);})[_0xb02b('0x12')](function(_0x557229){logger[_0xb02b('0xe')](_0xb02b('0x13'),_0x557229[_0xb02b('0x11')],_0x5bad72);_0x40dcc0(_0x28fb71['error'](0x1f4,_0x557229[_0xb02b('0x11')]));});});};exports[_0xb02b('0x1d')]=function(_0x43b297){var _0x594b19=this;return new Promise(function(_0x2d2a44,_0x1e7abf){return db[_0xb02b('0x14')][_0xb02b('0x1e')]({'raw':_0x43b297['options']?_0x43b297[_0xb02b('0x16')][_0xb02b('0x1f')]===undefined?!![]:![]:!![],'where':_0x43b297[_0xb02b('0x16')]?_0x43b297[_0xb02b('0x16')]['where']||null:null,'attributes':_0x43b297[_0xb02b('0x16')]?_0x43b297[_0xb02b('0x16')][_0xb02b('0x1c')]||null:null,'include':_0x43b297[_0xb02b('0x16')]?_0x43b297['options'][_0xb02b('0x1b')]?_[_0xb02b('0x19')](_0x43b297[_0xb02b('0x16')][_0xb02b('0x1b')],function(_0x3a75ce){return{'model':db[_0x3a75ce[_0xb02b('0x1a')]],'as':_0x3a75ce['as'],'attributes':_0x3a75ce[_0xb02b('0x1c')],'include':_0x3a75ce[_0xb02b('0x1b')]?_['map'](_0x3a75ce[_0xb02b('0x1b')],function(_0x348217){return{'model':db[_0x348217[_0xb02b('0x1a')]],'as':_0x348217['as'],'attributes':_0x348217[_0xb02b('0x1c')],'include':_0x348217['include']?_[_0xb02b('0x19')](_0x348217[_0xb02b('0x1b')],function(_0x164bdf){return{'model':db[_0x164bdf[_0xb02b('0x1a')]],'as':_0x164bdf['as'],'attributes':_0x164bdf[_0xb02b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb02b('0x8')](function(_0x145990){logger['info'](_0xb02b('0x1d'),_0x43b297);logger[_0xb02b('0xb')](_0xb02b('0x1d'),_0x43b297,JSON['stringify'](_0x145990));_0x2d2a44(_0x145990);})[_0xb02b('0x12')](function(_0xb78cd9){logger[_0xb02b('0xe')](_0xb02b('0x1d'),_0xb78cd9[_0xb02b('0x11')],_0x43b297);_0x1e7abf(_0x594b19[_0xb02b('0xe')](0x1f4,_0xb78cd9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 88fcbf4..362fb10 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x0b0e[_0x23c73d];return _0x36ba47;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x53f3ae,_0x1fadeb){var _0x1a8011=function(_0x215bc5){while(--_0x215bc5){_0x53f3ae['push'](_0x53f3ae['shift']());}};_0x1a8011(++_0x1fadeb);}(_0x7a54,0x106));var _0x47a5=function(_0x5b9a3e,_0x36fd2e){_0x5b9a3e=_0x5b9a3e-0x0;var _0x210a30=_0x7a54[_0x5b9a3e];return _0x210a30;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ec5b0f7..d67d73f 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 _0xac49=['Task','contact_lead','contact','lead','account','nothing','exports','STRING','ENUM'];(function(_0x22744c,_0x269583){var _0x29c07f=function(_0x5bd3bc){while(--_0x5bd3bc){_0x22744c['push'](_0x22744c['shift']());}};_0x29c07f(++_0x269583);}(_0xac49,0x126));var _0x9ac4=function(_0x58595d,_0x4fa6c7){_0x58595d=_0x58595d-0x0;var _0xaa0273=_0xac49[_0x58595d];return _0xaa0273;};'use strict';var Sequelize=require('sequelize');module[_0x9ac4('0x0')]={'name':{'type':Sequelize[_0x9ac4('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x3'),'Case'),'defaultValue':_0x9ac4('0x3')},'moduleSearch':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x4'),_0x9ac4('0x5'),_0x9ac4('0x6'),'account_contact_lead',_0x9ac4('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x8'),_0x9ac4('0x5'),'lead',_0x9ac4('0x7')),'defaultValue':_0x9ac4('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9ac4('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x9ac4('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa227=['ENUM','Task','contact','lead','account_contact_lead','account','contact_lead','exports','STRING'];(function(_0x501239,_0x569942){var _0x272c00=function(_0x540ef2){while(--_0x540ef2){_0x501239['push'](_0x501239['shift']());}};_0x272c00(++_0x569942);}(_0xa227,0x16f));var _0x7a22=function(_0x5e27a5,_0x30dd3a){_0x5e27a5=_0x5e27a5-0x0;var _0x263a08=_0xa227[_0x5e27a5];return _0x263a08;};'use strict';var Sequelize=require('sequelize');module[_0x7a22('0x0')]={'name':{'type':Sequelize[_0x7a22('0x1')]},'description':{'type':Sequelize[_0x7a22('0x1')]},'ticketType':{'type':Sequelize[_0x7a22('0x2')](_0x7a22('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x7a22('0x4'),_0x7a22('0x5'),_0x7a22('0x6'),_0x7a22('0x7')),'defaultValue':_0x7a22('0x8')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x7a22('0x4'),_0x7a22('0x5'),_0x7a22('0x7')),'defaultValue':_0x7a22('0x5')},'leadId':{'type':Sequelize[_0x7a22('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x7a22('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x7a22('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x7a22('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 73248ce..6a6be2f 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 _0xcfab=['include','findAll','rows','catch','show','params','keys','intersection','find','create','body','update','getFields','findOne','SalesforceField','length','rawAttributes','getDescriptions','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x24aae5,_0x2a718c){_0x24aae5=_0x24aae5-0x0;var _0xd5d26b=_0xcfab[_0x24aae5];return _0xd5d26b;};'use strict';var emlformat=require(_0xbcfa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcfa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcfa('0x2'));var moment=require('moment');var BPromise=require(_0xbcfa('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbcfa('0x4'));var sox=require(_0xbcfa('0x5'));var csv=require(_0xbcfa('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcfa('0x7'));var _=require(_0xbcfa('0x8'));var squel=require(_0xbcfa('0x9'));var crypto=require(_0xbcfa('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbcfa('0x6'));var querystring=require(_0xbcfa('0xb'));var Papa=require('papaparse');var Redis=require(_0xbcfa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbcfa('0xd'));var as=require(_0xbcfa('0xe'));var hardwareService=require(_0xbcfa('0xf'));var logger=require('../../config/logger')(_0xbcfa('0x10'));var utils=require(_0xbcfa('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbcfa('0x12'));var db=require(_0xbcfa('0x13'))['db'];function respondWithStatusCode(_0x59518c,_0x22b679){_0x22b679=_0x22b679||0xcc;return function(_0x53bd3d){if(_0x53bd3d){return _0x59518c[_0xbcfa('0x14')](_0x22b679);}return _0x59518c[_0xbcfa('0x15')](_0x22b679)[_0xbcfa('0x16')]();};}function respondWithResult(_0xdba47d,_0x398351){_0x398351=_0x398351||0xc8;return function(_0x3c9217){if(_0x3c9217){return _0xdba47d[_0xbcfa('0x15')](_0x398351)[_0xbcfa('0x17')](_0x3c9217);}};}function respondWithFilteredResult(_0x4a8336,_0x30888b){return function(_0x503a6b){if(_0x503a6b){var _0x4609b0=typeof _0x30888b['offset']===_0xbcfa('0x18')&&typeof _0x30888b[_0xbcfa('0x19')]===_0xbcfa('0x18');var _0x10c09c=_0x503a6b['count'];var _0x4643ae=_0x4609b0?0x0:_0x30888b[_0xbcfa('0x1a')];var _0x326625=_0x4609b0?_0x503a6b[_0xbcfa('0x1b')]:_0x30888b[_0xbcfa('0x1a')]+_0x30888b[_0xbcfa('0x19')];var _0x432b06;if(_0x326625>=_0x10c09c){_0x326625=_0x10c09c;_0x432b06=0xc8;}else{_0x432b06=0xce;}_0x4a8336['status'](_0x432b06);return _0x4a8336[_0xbcfa('0x1c')](_0xbcfa('0x1d'),_0x4643ae+'-'+_0x326625+'/'+_0x10c09c)[_0xbcfa('0x17')](_0x503a6b);}return null;};}function patchUpdates(_0x4433ef){return function(_0x20727c){try{jsonpatch[_0xbcfa('0x1e')](_0x20727c,_0x4433ef,!![]);}catch(_0x5d9e04){return BPromise[_0xbcfa('0x1f')](_0x5d9e04);}return _0x20727c[_0xbcfa('0x20')]();};}function saveUpdates(_0x20d3fa,_0x39d9ed){return function(_0x43fb22){if(_0x43fb22){return _0x43fb22['update'](_0x20d3fa)[_0xbcfa('0x21')](function(_0x7d5ba1){return _0x7d5ba1;});}return null;};}function removeEntity(_0x5e4c06,_0x53e866){return function(_0x4a9a10){if(_0x4a9a10){return _0x4a9a10[_0xbcfa('0x22')]()[_0xbcfa('0x21')](function(){_0x5e4c06[_0xbcfa('0x15')](0xcc)[_0xbcfa('0x16')]();});}};}function handleEntityNotFound(_0x58043d,_0xd2ad52){return function(_0x8549af){if(!_0x8549af){_0x58043d[_0xbcfa('0x14')](0x194);}return _0x8549af;};}function handleError(_0x576f2b,_0x252257){_0x252257=_0x252257||0x1f4;return function(_0x375123){logger['error'](_0x375123[_0xbcfa('0x23')]);if(_0x375123[_0xbcfa('0x24')]){delete _0x375123[_0xbcfa('0x24')];}_0x576f2b[_0xbcfa('0x15')](_0x252257)[_0xbcfa('0x25')](_0x375123);};}exports[_0xbcfa('0x26')]=function(_0x3e12f7,_0x4e84c3){var _0x5398fb={},_0x4a8eec={},_0x39777c={'count':0x0,'rows':[]};var _0x25fbd9=_[_0xbcfa('0x27')](db[_0xbcfa('0x28')]['rawAttributes'],function(_0x503a81){return{'name':_0x503a81[_0xbcfa('0x29')],'type':_0x503a81[_0xbcfa('0x2a')]['key']};});_0x4a8eec['model']=_[_0xbcfa('0x27')](_0x25fbd9,_0xbcfa('0x24'));_0x4a8eec['query']=_['keys'](_0x3e12f7[_0xbcfa('0x2b')]);_0x4a8eec[_0xbcfa('0x2c')]=_['intersection'](_0x4a8eec[_0xbcfa('0x2d')],_0x4a8eec[_0xbcfa('0x2b')]);_0x5398fb['attributes']=_['intersection'](_0x4a8eec[_0xbcfa('0x2d')],qs[_0xbcfa('0x2e')](_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x2e')]));_0x5398fb[_0xbcfa('0x2f')]=_0x5398fb[_0xbcfa('0x2f')]['length']?_0x5398fb[_0xbcfa('0x2f')]:_0x4a8eec['model'];if(!_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x30')](_0xbcfa('0x31'))){_0x5398fb[_0xbcfa('0x19')]=qs['limit'](_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x19')]);_0x5398fb[_0xbcfa('0x1a')]=qs['offset'](_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x1a')]);}_0x5398fb[_0xbcfa('0x32')]=qs[_0xbcfa('0x33')](_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x33')]);_0x5398fb[_0xbcfa('0x34')]=qs['filters'](_[_0xbcfa('0x35')](_0x3e12f7[_0xbcfa('0x2b')],_0x4a8eec[_0xbcfa('0x2c')]),_0x25fbd9);if(_0x3e12f7[_0xbcfa('0x2b')]['filter']){_0x5398fb['where']=_[_0xbcfa('0x36')](_0x5398fb['where'],{'$or':_[_0xbcfa('0x27')](_0x25fbd9,function(_0x4f45a9){if(_0x4f45a9['type']!==_0xbcfa('0x37')){var _0x536e6e={};_0x536e6e[_0x4f45a9[_0xbcfa('0x24')]]={'$like':'%'+_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x38')]+'%'};return _0x536e6e;}})});}_0x5398fb=_[_0xbcfa('0x36')]({},_0x5398fb,_0x3e12f7[_0xbcfa('0x39')]);var _0x4e0fc2={'where':_0x5398fb[_0xbcfa('0x34')]};return db[_0xbcfa('0x28')][_0xbcfa('0x1b')](_0x4e0fc2)[_0xbcfa('0x21')](function(_0x4a602c){_0x39777c['count']=_0x4a602c;if(_0x3e12f7[_0xbcfa('0x2b')][_0xbcfa('0x3a')]){_0x5398fb[_0xbcfa('0x3b')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xbcfa('0x3c')](_0x5398fb);})[_0xbcfa('0x21')](function(_0x32450e){_0x39777c[_0xbcfa('0x3d')]=_0x32450e;return _0x39777c;})[_0xbcfa('0x21')](respondWithFilteredResult(_0x4e84c3,_0x5398fb))[_0xbcfa('0x3e')](handleError(_0x4e84c3,null));};exports[_0xbcfa('0x3f')]=function(_0xe9722f,_0x5a54ff){var _0x48f68d={'raw':![],'where':{'id':_0xe9722f[_0xbcfa('0x40')]['id']}},_0x145c75={};_0x145c75[_0xbcfa('0x2d')]=_[_0xbcfa('0x41')](db[_0xbcfa('0x28')]['rawAttributes']);_0x145c75['query']=_[_0xbcfa('0x41')](_0xe9722f[_0xbcfa('0x2b')]);_0x145c75['filters']=_[_0xbcfa('0x42')](_0x145c75[_0xbcfa('0x2d')],_0x145c75['query']);_0x48f68d['attributes']=_[_0xbcfa('0x42')](_0x145c75[_0xbcfa('0x2d')],qs[_0xbcfa('0x2e')](_0xe9722f[_0xbcfa('0x2b')][_0xbcfa('0x2e')]));_0x48f68d[_0xbcfa('0x2f')]=_0x48f68d[_0xbcfa('0x2f')]['length']?_0x48f68d[_0xbcfa('0x2f')]:_0x145c75[_0xbcfa('0x2d')];if(_0xe9722f['query']['includeAll']){_0x48f68d[_0xbcfa('0x3b')]=[{'all':!![]}];}_0x48f68d=_[_0xbcfa('0x36')]({},_0x48f68d,_0xe9722f[_0xbcfa('0x39')]);return db['SalesforceConfiguration'][_0xbcfa('0x43')](_0x48f68d)['then'](handleEntityNotFound(_0x5a54ff,null))['then'](respondWithResult(_0x5a54ff,null))[_0xbcfa('0x3e')](handleError(_0x5a54ff,null));};exports[_0xbcfa('0x44')]=function(_0x12b2b2,_0x966468){return db[_0xbcfa('0x28')][_0xbcfa('0x44')](_0x12b2b2[_0xbcfa('0x45')],{})[_0xbcfa('0x21')](respondWithResult(_0x966468,0xc9))['catch'](handleError(_0x966468,null));};exports[_0xbcfa('0x46')]=function(_0x646c67,_0x3d5159){if(_0x646c67[_0xbcfa('0x45')]['id']){delete _0x646c67[_0xbcfa('0x45')]['id'];}return db['SalesforceConfiguration'][_0xbcfa('0x43')]({'where':{'id':_0x646c67['params']['id']}})[_0xbcfa('0x21')](handleEntityNotFound(_0x3d5159,null))[_0xbcfa('0x21')](saveUpdates(_0x646c67[_0xbcfa('0x45')],null))[_0xbcfa('0x21')](respondWithResult(_0x3d5159,null))[_0xbcfa('0x3e')](handleError(_0x3d5159,null));};exports[_0xbcfa('0x22')]=function(_0x107748,_0x95e037){return db[_0xbcfa('0x28')][_0xbcfa('0x43')]({'where':{'id':_0x107748[_0xbcfa('0x40')]['id']}})['then'](handleEntityNotFound(_0x95e037,null))[_0xbcfa('0x21')](removeEntity(_0x95e037,null))['catch'](handleError(_0x95e037,null));};exports[_0xbcfa('0x47')]=function(_0x449227,_0x4116fb,_0x292ec4){var _0xff744d={};var _0x463d60={};var _0x4bf07c;var _0x3eb370;return db['SalesforceConfiguration'][_0xbcfa('0x48')]({'where':{'id':_0x449227[_0xbcfa('0x40')]['id']}})[_0xbcfa('0x21')](handleEntityNotFound(_0x4116fb,null))[_0xbcfa('0x21')](function(_0x1080a7){if(_0x1080a7){_0x4bf07c=_0x1080a7;_0x463d60['model']=_['keys'](db[_0xbcfa('0x49')]['rawAttributes']);_0x463d60[_0xbcfa('0x2b')]=_[_0xbcfa('0x41')](_0x449227[_0xbcfa('0x2b')]);_0x463d60[_0xbcfa('0x2c')]=_[_0xbcfa('0x42')](_0x463d60[_0xbcfa('0x2d')],_0x463d60['query']);_0xff744d[_0xbcfa('0x2f')]=_[_0xbcfa('0x42')](_0x463d60[_0xbcfa('0x2d')],qs[_0xbcfa('0x2e')](_0x449227['query'][_0xbcfa('0x2e')]));_0xff744d[_0xbcfa('0x2f')]=_0xff744d[_0xbcfa('0x2f')][_0xbcfa('0x4a')]?_0xff744d[_0xbcfa('0x2f')]:_0x463d60[_0xbcfa('0x2d')];_0xff744d[_0xbcfa('0x32')]=qs[_0xbcfa('0x33')](_0x449227[_0xbcfa('0x2b')]['sort']);_0xff744d[_0xbcfa('0x34')]=qs[_0xbcfa('0x2c')](_[_0xbcfa('0x35')](_0x449227[_0xbcfa('0x2b')],_0x463d60[_0xbcfa('0x2c')]));if(_0x449227[_0xbcfa('0x2b')][_0xbcfa('0x38')]){_0xff744d[_0xbcfa('0x34')]=_[_0xbcfa('0x36')](_0xff744d[_0xbcfa('0x34')],{'$or':_[_0xbcfa('0x27')](_0xff744d[_0xbcfa('0x2f')],function(_0x294899){var _0x2866ca={};_0x2866ca[_0x294899]={'$like':'%'+_0x449227[_0xbcfa('0x2b')][_0xbcfa('0x38')]+'%'};return _0x2866ca;})});}_0xff744d=_[_0xbcfa('0x36')]({},_0xff744d,_0x449227[_0xbcfa('0x39')]);return _0x4bf07c[_0xbcfa('0x47')](_0xff744d);}})['then'](function(_0x285cfc){if(_0x285cfc){_0x3eb370=_0x285cfc[_0xbcfa('0x4a')];if(!_0x449227[_0xbcfa('0x2b')][_0xbcfa('0x30')](_0xbcfa('0x31'))){_0xff744d[_0xbcfa('0x19')]=qs[_0xbcfa('0x19')](_0x449227['query']['limit']);_0xff744d[_0xbcfa('0x1a')]=qs[_0xbcfa('0x1a')](_0x449227[_0xbcfa('0x2b')][_0xbcfa('0x1a')]);}return _0x4bf07c[_0xbcfa('0x47')](_0xff744d);}})[_0xbcfa('0x21')](function(_0x533230){if(_0x533230){return _0x533230?{'count':_0x3eb370,'rows':_0x533230}:null;}})[_0xbcfa('0x21')](respondWithResult(_0x4116fb,null))[_0xbcfa('0x3e')](handleError(_0x4116fb,null));};exports['getSubjects']=function(_0x4c78d8,_0xad2fd4,_0x4d5532){var _0x41de31={};var _0x56c7c3={};var _0x504598;var _0x24076c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4c78d8[_0xbcfa('0x40')]['id']}})[_0xbcfa('0x21')](handleEntityNotFound(_0xad2fd4,null))['then'](function(_0x21acd2){if(_0x21acd2){_0x504598=_0x21acd2;_0x56c7c3[_0xbcfa('0x2d')]=_[_0xbcfa('0x41')](db[_0xbcfa('0x49')][_0xbcfa('0x4b')]);_0x56c7c3['query']=_['keys'](_0x4c78d8['query']);_0x56c7c3[_0xbcfa('0x2c')]=_[_0xbcfa('0x42')](_0x56c7c3[_0xbcfa('0x2d')],_0x56c7c3[_0xbcfa('0x2b')]);_0x41de31[_0xbcfa('0x2f')]=_[_0xbcfa('0x42')](_0x56c7c3[_0xbcfa('0x2d')],qs[_0xbcfa('0x2e')](_0x4c78d8['query'][_0xbcfa('0x2e')]));_0x41de31[_0xbcfa('0x2f')]=_0x41de31[_0xbcfa('0x2f')]['length']?_0x41de31[_0xbcfa('0x2f')]:_0x56c7c3['model'];_0x41de31['order']=qs[_0xbcfa('0x33')](_0x4c78d8[_0xbcfa('0x2b')]['sort']);_0x41de31[_0xbcfa('0x34')]=qs['filters'](_[_0xbcfa('0x35')](_0x4c78d8[_0xbcfa('0x2b')],_0x56c7c3[_0xbcfa('0x2c')]));if(_0x4c78d8[_0xbcfa('0x2b')]['filter']){_0x41de31['where']=_[_0xbcfa('0x36')](_0x41de31[_0xbcfa('0x34')],{'$or':_[_0xbcfa('0x27')](_0x41de31[_0xbcfa('0x2f')],function(_0x5a02f4){var _0x53a2fb={};_0x53a2fb[_0x5a02f4]={'$like':'%'+_0x4c78d8[_0xbcfa('0x2b')][_0xbcfa('0x38')]+'%'};return _0x53a2fb;})});}_0x41de31=_[_0xbcfa('0x36')]({},_0x41de31,_0x4c78d8[_0xbcfa('0x39')]);return _0x504598['getSubjects'](_0x41de31);}})['then'](function(_0x30a579){if(_0x30a579){_0x24076c=_0x30a579[_0xbcfa('0x4a')];if(!_0x4c78d8['query']['hasOwnProperty'](_0xbcfa('0x31'))){_0x41de31['limit']=qs[_0xbcfa('0x19')](_0x4c78d8[_0xbcfa('0x2b')][_0xbcfa('0x19')]);_0x41de31[_0xbcfa('0x1a')]=qs[_0xbcfa('0x1a')](_0x4c78d8['query'][_0xbcfa('0x1a')]);}return _0x504598['getSubjects'](_0x41de31);}})['then'](function(_0xca0067){if(_0xca0067){return _0xca0067?{'count':_0x24076c,'rows':_0xca0067}:null;}})[_0xbcfa('0x21')](respondWithResult(_0xad2fd4,null))['catch'](handleError(_0xad2fd4,null));};exports[_0xbcfa('0x4c')]=function(_0xa46af2,_0x2f723d,_0x138eac){var _0x2d9e67={};var _0x5d9911={};var _0x2ab9d9;var _0x552a41;return db[_0xbcfa('0x28')]['findOne']({'where':{'id':_0xa46af2[_0xbcfa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f723d,null))[_0xbcfa('0x21')](function(_0x3102c1){if(_0x3102c1){_0x2ab9d9=_0x3102c1;_0x5d9911[_0xbcfa('0x2d')]=_[_0xbcfa('0x41')](db['SalesforceField'][_0xbcfa('0x4b')]);_0x5d9911['query']=_['keys'](_0xa46af2['query']);_0x5d9911[_0xbcfa('0x2c')]=_['intersection'](_0x5d9911[_0xbcfa('0x2d')],_0x5d9911[_0xbcfa('0x2b')]);_0x2d9e67['attributes']=_[_0xbcfa('0x42')](_0x5d9911[_0xbcfa('0x2d')],qs[_0xbcfa('0x2e')](_0xa46af2['query'][_0xbcfa('0x2e')]));_0x2d9e67[_0xbcfa('0x2f')]=_0x2d9e67[_0xbcfa('0x2f')][_0xbcfa('0x4a')]?_0x2d9e67['attributes']:_0x5d9911[_0xbcfa('0x2d')];_0x2d9e67['order']=qs[_0xbcfa('0x33')](_0xa46af2[_0xbcfa('0x2b')][_0xbcfa('0x33')]);_0x2d9e67[_0xbcfa('0x34')]=qs['filters'](_['pick'](_0xa46af2[_0xbcfa('0x2b')],_0x5d9911[_0xbcfa('0x2c')]));if(_0xa46af2[_0xbcfa('0x2b')][_0xbcfa('0x38')]){_0x2d9e67[_0xbcfa('0x34')]=_[_0xbcfa('0x36')](_0x2d9e67[_0xbcfa('0x34')],{'$or':_[_0xbcfa('0x27')](_0x2d9e67['attributes'],function(_0x4534cd){var _0x29534f={};_0x29534f[_0x4534cd]={'$like':'%'+_0xa46af2[_0xbcfa('0x2b')]['filter']+'%'};return _0x29534f;})});}_0x2d9e67=_['merge']({},_0x2d9e67,_0xa46af2[_0xbcfa('0x39')]);return _0x2ab9d9[_0xbcfa('0x4c')](_0x2d9e67);}})[_0xbcfa('0x21')](function(_0x2fad3b){if(_0x2fad3b){_0x552a41=_0x2fad3b[_0xbcfa('0x4a')];if(!_0xa46af2[_0xbcfa('0x2b')]['hasOwnProperty'](_0xbcfa('0x31'))){_0x2d9e67[_0xbcfa('0x19')]=qs[_0xbcfa('0x19')](_0xa46af2[_0xbcfa('0x2b')][_0xbcfa('0x19')]);_0x2d9e67['offset']=qs[_0xbcfa('0x1a')](_0xa46af2[_0xbcfa('0x2b')]['offset']);}return _0x2ab9d9[_0xbcfa('0x4c')](_0x2d9e67);}})[_0xbcfa('0x21')](function(_0x229fbe){if(_0x229fbe){return _0x229fbe?{'count':_0x552a41,'rows':_0x229fbe}:null;}})['then'](respondWithResult(_0x2f723d,null))['catch'](handleError(_0x2f723d,null));}; \ No newline at end of file +var _0x1744=['create','body','findOne','SalesforceField','order','sort','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','SalesforceConfiguration','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x4bd97b,_0x4f80f3){var _0x4e2871=function(_0x4b8fa4){while(--_0x4b8fa4){_0x4bd97b['push'](_0x4bd97b['shift']());}};_0x4e2871(++_0x4f80f3);}(_0x1744,0xa1));var _0x4174=function(_0x243f2c,_0x1a8bcf){_0x243f2c=_0x243f2c-0x0;var _0x1a2ae7=_0x1744[_0x243f2c];return _0x1a2ae7;};'use strict';var emlformat=require(_0x4174('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4174('0x1'));var jsonpatch=require(_0x4174('0x2'));var rp=require(_0x4174('0x3'));var moment=require('moment');var BPromise=require(_0x4174('0x4'));var Mustache=require(_0x4174('0x5'));var util=require('util');var path=require(_0x4174('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4174('0x7'));var fs=require('fs');var fs_extra=require(_0x4174('0x8'));var _=require(_0x4174('0x9'));var squel=require(_0x4174('0xa'));var crypto=require(_0x4174('0xb'));var jsforce=require(_0x4174('0xc'));var deskjs=require(_0x4174('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4174('0xe'));var Papa=require(_0x4174('0xf'));var Redis=require(_0x4174('0x10'));var authService=require(_0x4174('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4174('0x12'));var logger=require('../../config/logger')(_0x4174('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4174('0x14'));var db=require(_0x4174('0x15'))['db'];function respondWithStatusCode(_0x1f4b8f,_0x276c3c){_0x276c3c=_0x276c3c||0xcc;return function(_0x5b0474){if(_0x5b0474){return _0x1f4b8f['sendStatus'](_0x276c3c);}return _0x1f4b8f[_0x4174('0x16')](_0x276c3c)[_0x4174('0x17')]();};}function respondWithResult(_0x3fcb92,_0x5a2cf){_0x5a2cf=_0x5a2cf||0xc8;return function(_0x352df3){if(_0x352df3){return _0x3fcb92[_0x4174('0x16')](_0x5a2cf)[_0x4174('0x18')](_0x352df3);}};}function respondWithFilteredResult(_0x2fc857,_0xc40296){return function(_0x41cda1){if(_0x41cda1){var _0x4d24af=typeof _0xc40296[_0x4174('0x19')]===_0x4174('0x1a')&&typeof _0xc40296[_0x4174('0x1b')]==='undefined';var _0x364727=_0x41cda1[_0x4174('0x1c')];var _0x10aa5e=_0x4d24af?0x0:_0xc40296[_0x4174('0x19')];var _0x291538=_0x4d24af?_0x41cda1[_0x4174('0x1c')]:_0xc40296[_0x4174('0x19')]+_0xc40296[_0x4174('0x1b')];var _0x1ab20d;if(_0x291538>=_0x364727){_0x291538=_0x364727;_0x1ab20d=0xc8;}else{_0x1ab20d=0xce;}_0x2fc857[_0x4174('0x16')](_0x1ab20d);return _0x2fc857['set'](_0x4174('0x1d'),_0x10aa5e+'-'+_0x291538+'/'+_0x364727)[_0x4174('0x18')](_0x41cda1);}return null;};}function patchUpdates(_0x5428a1){return function(_0x2abc14){try{jsonpatch[_0x4174('0x1e')](_0x2abc14,_0x5428a1,!![]);}catch(_0x5e19bf){return BPromise[_0x4174('0x1f')](_0x5e19bf);}return _0x2abc14[_0x4174('0x20')]();};}function saveUpdates(_0x12d53f,_0x42752f){return function(_0x19d8e3){if(_0x19d8e3){return _0x19d8e3[_0x4174('0x21')](_0x12d53f)[_0x4174('0x22')](function(_0x1f73ca){return _0x1f73ca;});}return null;};}function removeEntity(_0x51c610,_0xfa6930){return function(_0xbe9df6){if(_0xbe9df6){return _0xbe9df6[_0x4174('0x23')]()[_0x4174('0x22')](function(){_0x51c610[_0x4174('0x16')](0xcc)[_0x4174('0x17')]();});}};}function handleEntityNotFound(_0x260697,_0x262806){return function(_0xcd2dd9){if(!_0xcd2dd9){_0x260697['sendStatus'](0x194);}return _0xcd2dd9;};}function handleError(_0x38338b,_0x3fb6f8){_0x3fb6f8=_0x3fb6f8||0x1f4;return function(_0x1201c3){logger[_0x4174('0x24')](_0x1201c3['stack']);if(_0x1201c3[_0x4174('0x25')]){delete _0x1201c3[_0x4174('0x25')];}_0x38338b['status'](_0x3fb6f8)[_0x4174('0x26')](_0x1201c3);};}exports['index']=function(_0x3148b3,_0x322ce8){var _0x300d54={},_0x5d0d28={},_0x38411f={'count':0x0,'rows':[]};var _0x3663b6=_[_0x4174('0x27')](db[_0x4174('0x28')][_0x4174('0x29')],function(_0x4812f8){return{'name':_0x4812f8['fieldName'],'type':_0x4812f8[_0x4174('0x2a')]['key']};});_0x5d0d28[_0x4174('0x2b')]=_[_0x4174('0x27')](_0x3663b6,_0x4174('0x25'));_0x5d0d28[_0x4174('0x2c')]=_['keys'](_0x3148b3[_0x4174('0x2c')]);_0x5d0d28['filters']=_['intersection'](_0x5d0d28[_0x4174('0x2b')],_0x5d0d28[_0x4174('0x2c')]);_0x300d54[_0x4174('0x2d')]=_[_0x4174('0x2e')](_0x5d0d28[_0x4174('0x2b')],qs[_0x4174('0x2f')](_0x3148b3[_0x4174('0x2c')][_0x4174('0x2f')]));_0x300d54[_0x4174('0x2d')]=_0x300d54['attributes'][_0x4174('0x30')]?_0x300d54[_0x4174('0x2d')]:_0x5d0d28['model'];if(!_0x3148b3[_0x4174('0x2c')][_0x4174('0x31')](_0x4174('0x32'))){_0x300d54[_0x4174('0x1b')]=qs[_0x4174('0x1b')](_0x3148b3['query'][_0x4174('0x1b')]);_0x300d54['offset']=qs[_0x4174('0x19')](_0x3148b3[_0x4174('0x2c')][_0x4174('0x19')]);}_0x300d54['order']=qs['sort'](_0x3148b3[_0x4174('0x2c')]['sort']);_0x300d54[_0x4174('0x33')]=qs[_0x4174('0x34')](_[_0x4174('0x35')](_0x3148b3[_0x4174('0x2c')],_0x5d0d28[_0x4174('0x34')]),_0x3663b6);if(_0x3148b3['query']['filter']){_0x300d54[_0x4174('0x33')]=_[_0x4174('0x36')](_0x300d54['where'],{'$or':_[_0x4174('0x27')](_0x3663b6,function(_0x446903){if(_0x446903[_0x4174('0x2a')]!==_0x4174('0x37')){var _0x4ef96e={};_0x4ef96e[_0x446903['name']]={'$like':'%'+_0x3148b3['query'][_0x4174('0x38')]+'%'};return _0x4ef96e;}})});}_0x300d54=_[_0x4174('0x36')]({},_0x300d54,_0x3148b3[_0x4174('0x39')]);var _0x558acb={'where':_0x300d54[_0x4174('0x33')]};return db[_0x4174('0x28')][_0x4174('0x1c')](_0x558acb)[_0x4174('0x22')](function(_0x48c3be){_0x38411f[_0x4174('0x1c')]=_0x48c3be;if(_0x3148b3[_0x4174('0x2c')][_0x4174('0x3a')]){_0x300d54[_0x4174('0x3b')]=[{'all':!![]}];}return db[_0x4174('0x28')][_0x4174('0x3c')](_0x300d54);})['then'](function(_0xe1d0a1){_0x38411f[_0x4174('0x3d')]=_0xe1d0a1;return _0x38411f;})[_0x4174('0x22')](respondWithFilteredResult(_0x322ce8,_0x300d54))[_0x4174('0x3e')](handleError(_0x322ce8,null));};exports[_0x4174('0x3f')]=function(_0x31c220,_0x5f071a){var _0x867d6a={'raw':![],'where':{'id':_0x31c220[_0x4174('0x40')]['id']}},_0x262879={};_0x262879[_0x4174('0x2b')]=_[_0x4174('0x41')](db[_0x4174('0x28')][_0x4174('0x29')]);_0x262879[_0x4174('0x2c')]=_['keys'](_0x31c220[_0x4174('0x2c')]);_0x262879[_0x4174('0x34')]=_[_0x4174('0x2e')](_0x262879[_0x4174('0x2b')],_0x262879[_0x4174('0x2c')]);_0x867d6a[_0x4174('0x2d')]=_[_0x4174('0x2e')](_0x262879[_0x4174('0x2b')],qs['fields'](_0x31c220['query'][_0x4174('0x2f')]));_0x867d6a['attributes']=_0x867d6a['attributes'][_0x4174('0x30')]?_0x867d6a[_0x4174('0x2d')]:_0x262879[_0x4174('0x2b')];if(_0x31c220[_0x4174('0x2c')][_0x4174('0x3a')]){_0x867d6a[_0x4174('0x3b')]=[{'all':!![]}];}_0x867d6a=_[_0x4174('0x36')]({},_0x867d6a,_0x31c220['options']);return db[_0x4174('0x28')][_0x4174('0x42')](_0x867d6a)['then'](handleEntityNotFound(_0x5f071a,null))[_0x4174('0x22')](respondWithResult(_0x5f071a,null))[_0x4174('0x3e')](handleError(_0x5f071a,null));};exports[_0x4174('0x43')]=function(_0x52ac47,_0x293e68){return db[_0x4174('0x28')][_0x4174('0x43')](_0x52ac47[_0x4174('0x44')],{})['then'](respondWithResult(_0x293e68,0xc9))['catch'](handleError(_0x293e68,null));};exports[_0x4174('0x21')]=function(_0x1b329e,_0x3b57ba){if(_0x1b329e[_0x4174('0x44')]['id']){delete _0x1b329e[_0x4174('0x44')]['id'];}return db['SalesforceConfiguration'][_0x4174('0x42')]({'where':{'id':_0x1b329e[_0x4174('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b57ba,null))['then'](saveUpdates(_0x1b329e['body'],null))[_0x4174('0x22')](respondWithResult(_0x3b57ba,null))[_0x4174('0x3e')](handleError(_0x3b57ba,null));};exports[_0x4174('0x23')]=function(_0x3edbe3,_0x260a72){return db[_0x4174('0x28')][_0x4174('0x42')]({'where':{'id':_0x3edbe3[_0x4174('0x40')]['id']}})[_0x4174('0x22')](handleEntityNotFound(_0x260a72,null))['then'](removeEntity(_0x260a72,null))[_0x4174('0x3e')](handleError(_0x260a72,null));};exports['getFields']=function(_0x4711c2,_0xab200f,_0x1cae0e){var _0x22eade={};var _0x37598c={};var _0x20c723;var _0x54b2fe;return db[_0x4174('0x28')][_0x4174('0x45')]({'where':{'id':_0x4711c2[_0x4174('0x40')]['id']}})[_0x4174('0x22')](handleEntityNotFound(_0xab200f,null))[_0x4174('0x22')](function(_0x1b7d08){if(_0x1b7d08){_0x20c723=_0x1b7d08;_0x37598c[_0x4174('0x2b')]=_[_0x4174('0x41')](db[_0x4174('0x46')]['rawAttributes']);_0x37598c[_0x4174('0x2c')]=_[_0x4174('0x41')](_0x4711c2['query']);_0x37598c['filters']=_['intersection'](_0x37598c[_0x4174('0x2b')],_0x37598c[_0x4174('0x2c')]);_0x22eade['attributes']=_[_0x4174('0x2e')](_0x37598c[_0x4174('0x2b')],qs['fields'](_0x4711c2[_0x4174('0x2c')][_0x4174('0x2f')]));_0x22eade[_0x4174('0x2d')]=_0x22eade[_0x4174('0x2d')]['length']?_0x22eade[_0x4174('0x2d')]:_0x37598c[_0x4174('0x2b')];_0x22eade[_0x4174('0x47')]=qs[_0x4174('0x48')](_0x4711c2[_0x4174('0x2c')][_0x4174('0x48')]);_0x22eade['where']=qs[_0x4174('0x34')](_[_0x4174('0x35')](_0x4711c2[_0x4174('0x2c')],_0x37598c[_0x4174('0x34')]));if(_0x4711c2[_0x4174('0x2c')]['filter']){_0x22eade[_0x4174('0x33')]=_['merge'](_0x22eade['where'],{'$or':_['map'](_0x22eade['attributes'],function(_0x4eacb4){var _0x53fec6={};_0x53fec6[_0x4eacb4]={'$like':'%'+_0x4711c2[_0x4174('0x2c')][_0x4174('0x38')]+'%'};return _0x53fec6;})});}_0x22eade=_[_0x4174('0x36')]({},_0x22eade,_0x4711c2[_0x4174('0x39')]);return _0x20c723[_0x4174('0x49')](_0x22eade);}})[_0x4174('0x22')](function(_0x4c4eea){if(_0x4c4eea){_0x54b2fe=_0x4c4eea[_0x4174('0x30')];if(!_0x4711c2[_0x4174('0x2c')][_0x4174('0x31')]('nolimit')){_0x22eade[_0x4174('0x1b')]=qs[_0x4174('0x1b')](_0x4711c2[_0x4174('0x2c')][_0x4174('0x1b')]);_0x22eade['offset']=qs[_0x4174('0x19')](_0x4711c2[_0x4174('0x2c')][_0x4174('0x19')]);}return _0x20c723[_0x4174('0x49')](_0x22eade);}})[_0x4174('0x22')](function(_0x2f710f){if(_0x2f710f){return _0x2f710f?{'count':_0x54b2fe,'rows':_0x2f710f}:null;}})[_0x4174('0x22')](respondWithResult(_0xab200f,null))[_0x4174('0x3e')](handleError(_0xab200f,null));};exports[_0x4174('0x4a')]=function(_0x13b34d,_0x2f1543,_0xce63c9){var _0x44e5a2={};var _0x5f4043={};var _0x91f579;var _0x57dcbf;return db['SalesforceConfiguration'][_0x4174('0x45')]({'where':{'id':_0x13b34d[_0x4174('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f1543,null))[_0x4174('0x22')](function(_0x437f29){if(_0x437f29){_0x91f579=_0x437f29;_0x5f4043[_0x4174('0x2b')]=_['keys'](db[_0x4174('0x46')][_0x4174('0x29')]);_0x5f4043[_0x4174('0x2c')]=_[_0x4174('0x41')](_0x13b34d[_0x4174('0x2c')]);_0x5f4043['filters']=_['intersection'](_0x5f4043[_0x4174('0x2b')],_0x5f4043[_0x4174('0x2c')]);_0x44e5a2[_0x4174('0x2d')]=_[_0x4174('0x2e')](_0x5f4043[_0x4174('0x2b')],qs[_0x4174('0x2f')](_0x13b34d['query']['fields']));_0x44e5a2[_0x4174('0x2d')]=_0x44e5a2['attributes']['length']?_0x44e5a2[_0x4174('0x2d')]:_0x5f4043[_0x4174('0x2b')];_0x44e5a2[_0x4174('0x47')]=qs['sort'](_0x13b34d[_0x4174('0x2c')][_0x4174('0x48')]);_0x44e5a2[_0x4174('0x33')]=qs[_0x4174('0x34')](_[_0x4174('0x35')](_0x13b34d['query'],_0x5f4043[_0x4174('0x34')]));if(_0x13b34d[_0x4174('0x2c')][_0x4174('0x38')]){_0x44e5a2[_0x4174('0x33')]=_['merge'](_0x44e5a2[_0x4174('0x33')],{'$or':_['map'](_0x44e5a2[_0x4174('0x2d')],function(_0x31a701){var _0x1b5836={};_0x1b5836[_0x31a701]={'$like':'%'+_0x13b34d[_0x4174('0x2c')]['filter']+'%'};return _0x1b5836;})});}_0x44e5a2=_[_0x4174('0x36')]({},_0x44e5a2,_0x13b34d['options']);return _0x91f579[_0x4174('0x4a')](_0x44e5a2);}})['then'](function(_0x4bc227){if(_0x4bc227){_0x57dcbf=_0x4bc227[_0x4174('0x30')];if(!_0x13b34d[_0x4174('0x2c')][_0x4174('0x31')]('nolimit')){_0x44e5a2[_0x4174('0x1b')]=qs[_0x4174('0x1b')](_0x13b34d[_0x4174('0x2c')][_0x4174('0x1b')]);_0x44e5a2[_0x4174('0x19')]=qs[_0x4174('0x19')](_0x13b34d['query']['offset']);}return _0x91f579['getSubjects'](_0x44e5a2);}})[_0x4174('0x22')](function(_0x185de3){if(_0x185de3){return _0x185de3?{'count':_0x57dcbf,'rows':_0x185de3}:null;}})[_0x4174('0x22')](respondWithResult(_0x2f1543,null))[_0x4174('0x3e')](handleError(_0x2f1543,null));};exports[_0x4174('0x4b')]=function(_0x2ccdde,_0x55a50d,_0xbd2f51){var _0x4e7224={};var _0x2d2243={};var _0x2d85db;var _0xfbccea;return db[_0x4174('0x28')][_0x4174('0x45')]({'where':{'id':_0x2ccdde['params']['id']}})[_0x4174('0x22')](handleEntityNotFound(_0x55a50d,null))['then'](function(_0x1588aa){if(_0x1588aa){_0x2d85db=_0x1588aa;_0x2d2243['model']=_[_0x4174('0x41')](db[_0x4174('0x46')][_0x4174('0x29')]);_0x2d2243['query']=_['keys'](_0x2ccdde[_0x4174('0x2c')]);_0x2d2243[_0x4174('0x34')]=_['intersection'](_0x2d2243[_0x4174('0x2b')],_0x2d2243[_0x4174('0x2c')]);_0x4e7224[_0x4174('0x2d')]=_['intersection'](_0x2d2243[_0x4174('0x2b')],qs[_0x4174('0x2f')](_0x2ccdde['query'][_0x4174('0x2f')]));_0x4e7224[_0x4174('0x2d')]=_0x4e7224['attributes']['length']?_0x4e7224[_0x4174('0x2d')]:_0x2d2243[_0x4174('0x2b')];_0x4e7224[_0x4174('0x47')]=qs[_0x4174('0x48')](_0x2ccdde['query'][_0x4174('0x48')]);_0x4e7224[_0x4174('0x33')]=qs['filters'](_[_0x4174('0x35')](_0x2ccdde[_0x4174('0x2c')],_0x2d2243[_0x4174('0x34')]));if(_0x2ccdde['query'][_0x4174('0x38')]){_0x4e7224['where']=_[_0x4174('0x36')](_0x4e7224[_0x4174('0x33')],{'$or':_['map'](_0x4e7224['attributes'],function(_0x48e196){var _0x41fc0c={};_0x41fc0c[_0x48e196]={'$like':'%'+_0x2ccdde[_0x4174('0x2c')][_0x4174('0x38')]+'%'};return _0x41fc0c;})});}_0x4e7224=_[_0x4174('0x36')]({},_0x4e7224,_0x2ccdde[_0x4174('0x39')]);return _0x2d85db[_0x4174('0x4b')](_0x4e7224);}})[_0x4174('0x22')](function(_0x2a6bea){if(_0x2a6bea){_0xfbccea=_0x2a6bea['length'];if(!_0x2ccdde['query']['hasOwnProperty'](_0x4174('0x32'))){_0x4e7224[_0x4174('0x1b')]=qs[_0x4174('0x1b')](_0x2ccdde[_0x4174('0x2c')][_0x4174('0x1b')]);_0x4e7224[_0x4174('0x19')]=qs[_0x4174('0x19')](_0x2ccdde['query'][_0x4174('0x19')]);}return _0x2d85db[_0x4174('0x4b')](_0x4e7224);}})[_0x4174('0x22')](function(_0x52efea){if(_0x52efea){return _0x52efea?{'count':_0xfbccea,'rows':_0x52efea}:null;}})['then'](respondWithResult(_0x55a50d,null))['catch'](handleError(_0x55a50d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3dd4d2f..57bd635 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 _0x1db5=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x1db5,0x1f0));var _0x51db=function(_0x4042d6,_0x558a2e){_0x4042d6=_0x4042d6-0x0;var _0x58548a=_0x1db5[_0x4042d6];return _0x58548a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51db('0x0'))(_0x51db('0x1'));var moment=require(_0x51db('0x2'));var BPromise=require(_0x51db('0x3'));var rp=require(_0x51db('0x4'));var fs=require('fs');var path=require(_0x51db('0x5'));var rimraf=require(_0x51db('0x6'));var config=require(_0x51db('0x7'));var attributes=require(_0x51db('0x8'));module[_0x51db('0x9')]=function(_0x4d0eba,_0x26fcd9){return _0x4d0eba[_0x51db('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x51db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e3a=['rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1fdce6,_0x4412d9){var _0x36b546=function(_0x1bf3bb){while(--_0x1bf3bb){_0x1fdce6['push'](_0x1fdce6['shift']());}};_0x36b546(++_0x4412d9);}(_0x1e3a,0x10a));var _0xa1e3=function(_0x3dcf8a,_0x36426f){_0x3dcf8a=_0x3dcf8a-0x0;var _0x42d57e=_0x1e3a[_0x3dcf8a];return _0x42d57e;};'use strict';var _=require(_0xa1e3('0x0'));var util=require(_0xa1e3('0x1'));var logger=require(_0xa1e3('0x2'))('api');var moment=require(_0xa1e3('0x3'));var BPromise=require(_0xa1e3('0x4'));var rp=require(_0xa1e3('0x5'));var fs=require('fs');var path=require(_0xa1e3('0x6'));var rimraf=require(_0xa1e3('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1e3('0x8'));module[_0xa1e3('0x9')]=function(_0x16bda1,_0x12f693){return _0x16bda1[_0xa1e3('0xa')](_0xa1e3('0xb'),attributes,{'tableName':_0xa1e3('0xc'),'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 797355d..8d5ec44 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 _0x0ee0=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x0ee0,0xa0));var _0x00ee=function(_0x3c3584,_0x4b4c59){_0x3c3584=_0x3c3584-0x0;var _0x4dc3d6=_0x0ee0[_0x3c3584];return _0x4dc3d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x00ee('0x0'));var BPromise=require('bluebird');var rs=require(_0x00ee('0x1'));var fs=require('fs');var Redis=require(_0x00ee('0x2'));var db=require(_0x00ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x00ee('0x4'))(_0x00ee('0x5'));var config=require(_0x00ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x00ee('0x7')][_0x00ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562c96,_0x280365,_0x48580e){return new BPromise(function(_0x47916c,_0x258e20){return client[_0x00ee('0x9')](_0x562c96,_0x48580e)['then'](function(_0x5a1aed){logger[_0x00ee('0xa')](_0x00ee('0xb'),_0x280365,_0x00ee('0xc'));logger[_0x00ee('0xd')](_0x00ee('0xe'),_0x280365,_0x00ee('0xc'),JSON['stringify'](_0x5a1aed));if(_0x5a1aed[_0x00ee('0xf')]){if(_0x5a1aed[_0x00ee('0xf')][_0x00ee('0x10')]===0x1f4){logger['error'](_0x00ee('0xb'),_0x280365,_0x5a1aed[_0x00ee('0xf')][_0x00ee('0x11')]);return _0x258e20(_0x5a1aed[_0x00ee('0xf')]['message']);}logger[_0x00ee('0xf')](_0x00ee('0xb'),_0x280365,_0x5a1aed[_0x00ee('0xf')][_0x00ee('0x11')]);return _0x47916c(_0x5a1aed[_0x00ee('0xf')][_0x00ee('0x11')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x280365,_0x00ee('0xc'));_0x47916c(_0x5a1aed[_0x00ee('0x12')][_0x00ee('0x11')]);}})[_0x00ee('0x13')](function(_0x2e992f){logger[_0x00ee('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x280365,_0x2e992f);_0x258e20(_0x2e992f);});});} \ No newline at end of file +var _0x94be=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x17d84a,_0x443385){var _0xf52969=function(_0xc53a90){while(--_0xc53a90){_0x17d84a['push'](_0x17d84a['shift']());}};_0xf52969(++_0x443385);}(_0x94be,0xf7));var _0xe94b=function(_0x27c0fb,_0x3e64e2){_0x27c0fb=_0x27c0fb-0x0;var _0x1e845b=_0x94be[_0x27c0fb];return _0x1e845b;};'use strict';var _=require(_0xe94b('0x0'));var util=require('util');var moment=require(_0xe94b('0x1'));var BPromise=require(_0xe94b('0x2'));var rs=require(_0xe94b('0x3'));var fs=require('fs');var Redis=require(_0xe94b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe94b('0x5'));var logger=require(_0xe94b('0x6'))(_0xe94b('0x7'));var config=require(_0xe94b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe94b('0x9')][_0xe94b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a274a,_0x210bf8,_0x3607c4){return new BPromise(function(_0x4e5444,_0x25fe16){return client[_0xe94b('0xb')](_0x3a274a,_0x3607c4)[_0xe94b('0xc')](function(_0x5c6558){logger[_0xe94b('0xd')](_0xe94b('0xe'),_0x210bf8,_0xe94b('0xf'));logger['debug'](_0xe94b('0x10'),_0x210bf8,_0xe94b('0xf'),JSON[_0xe94b('0x11')](_0x5c6558));if(_0x5c6558['error']){if(_0x5c6558['error']['code']===0x1f4){logger[_0xe94b('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x210bf8,_0x5c6558[_0xe94b('0x12')][_0xe94b('0x13')]);return _0x25fe16(_0x5c6558['error'][_0xe94b('0x13')]);}logger[_0xe94b('0x12')](_0xe94b('0xe'),_0x210bf8,_0x5c6558[_0xe94b('0x12')]['message']);return _0x4e5444(_0x5c6558[_0xe94b('0x12')][_0xe94b('0x13')]);}else{logger['info'](_0xe94b('0xe'),_0x210bf8,_0xe94b('0xf'));_0x4e5444(_0x5c6558[_0xe94b('0x14')][_0xe94b('0x13')]);}})[_0xe94b('0x15')](function(_0x45e4b8){logger[_0xe94b('0x12')](_0xe94b('0xe'),_0x210bf8,_0x45e4b8);_0x25fe16(_0x45e4b8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b5600f0..3ec4a95 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 _0x416c=['path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x416c,0x164));var _0xc416=function(_0x12f29c,_0x591a84){_0x12f29c=_0x12f29c-0x0;var _0x4b10c7=_0x416c[_0x12f29c];return _0x4b10c7;};'use strict';var multer=require(_0xc416('0x0'));var util=require('util');var path=require(_0xc416('0x1'));var timeout=require(_0xc416('0x2'));var express=require(_0xc416('0x3'));var router=express[_0xc416('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc416('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xc416('0x6')]('/',auth[_0xc416('0x7')](),controller[_0xc416('0x8')]);router[_0xc416('0x6')](_0xc416('0x9'),auth['isAuthenticated'](),controller[_0xc416('0xa')]);router[_0xc416('0xb')]('/',auth['isAuthenticated'](),controller[_0xc416('0xc')]);router[_0xc416('0xd')](_0xc416('0x9'),auth[_0xc416('0x7')](),controller['update']);router[_0xc416('0xe')](_0xc416('0x9'),auth[_0xc416('0x7')](),controller[_0xc416('0xf')]);module[_0xc416('0x10')]=router; \ No newline at end of file +var _0xa5dc=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0xa5dc,0xc9));var _0xca5d=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0xa5dc[_0x11d95f];return _0x2b1a14;};'use strict';var multer=require(_0xca5d('0x0'));var util=require(_0xca5d('0x1'));var path=require(_0xca5d('0x2'));var timeout=require(_0xca5d('0x3'));var express=require(_0xca5d('0x4'));var router=express[_0xca5d('0x5')]();var fs_extra=require(_0xca5d('0x6'));var auth=require(_0xca5d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xca5d('0x8'));var controller=require(_0xca5d('0x9'));router[_0xca5d('0xa')]('/',auth[_0xca5d('0xb')](),controller[_0xca5d('0xc')]);router[_0xca5d('0xa')](_0xca5d('0xd'),auth['isAuthenticated'](),controller[_0xca5d('0xe')]);router[_0xca5d('0xf')]('/',auth[_0xca5d('0xb')](),controller[_0xca5d('0x10')]);router[_0xca5d('0x11')]('/:id',auth[_0xca5d('0xb')](),controller[_0xca5d('0x12')]);router[_0xca5d('0x13')](_0xca5d('0xd'),auth[_0xca5d('0xb')](),controller[_0xca5d('0x14')]);module[_0xca5d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e559159..8b970a8 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 _0x6e79=['picklist','STRING','ENUM','sequelize','exports','string','variable','customVariable'];(function(_0x14359e,_0x22f998){var _0x38585c=function(_0x1bcae1){while(--_0x1bcae1){_0x14359e['push'](_0x14359e['shift']());}};_0x38585c(++_0x22f998);}(_0x6e79,0x193));var _0x96e7=function(_0xd24405,_0x5cb1f7){_0xd24405=_0xd24405-0x0;var _0xbab586=_0x6e79[_0xd24405];return _0xbab586;};'use strict';var Sequelize=require(_0x96e7('0x0'));module[_0x96e7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x96e7('0x2'),_0x96e7('0x3'),_0x96e7('0x4'),'keyValue',_0x96e7('0x5')),'defaultValue':_0x96e7('0x2')},'content':{'type':Sequelize[_0x96e7('0x6')]},'key':{'type':Sequelize[_0x96e7('0x6')]},'keyType':{'type':Sequelize[_0x96e7('0x7')](_0x96e7('0x2'),'variable',_0x96e7('0x4'))},'keyContent':{'type':Sequelize[_0x96e7('0x6')]},'idField':{'type':Sequelize[_0x96e7('0x6')]},'variableName':{'type':Sequelize[_0x96e7('0x6')]}}; \ No newline at end of file +var _0xe3f0=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xe3f0,0xf8));var _0x0e3f=function(_0x1101e2,_0x2bed37){_0x1101e2=_0x1101e2-0x0;var _0xdb5f33=_0xe3f0[_0x1101e2];return _0xdb5f33;};'use strict';var Sequelize=require('sequelize');module[_0x0e3f('0x0')]={'type':{'type':Sequelize[_0x0e3f('0x1')](_0x0e3f('0x2'),_0x0e3f('0x3'),_0x0e3f('0x4'),_0x0e3f('0x5'),_0x0e3f('0x6')),'defaultValue':_0x0e3f('0x2')},'content':{'type':Sequelize[_0x0e3f('0x7')]},'key':{'type':Sequelize[_0x0e3f('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0e3f('0x3'),_0x0e3f('0x4'))},'keyContent':{'type':Sequelize[_0x0e3f('0x7')]},'idField':{'type':Sequelize[_0x0e3f('0x7')]},'variableName':{'type':Sequelize[_0x0e3f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 59ac9ac..6531be8 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 _0xa572=['intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','SalesforceField','fieldName','key','model','map','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa572,0x14d));var _0x2a57=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xa572[_0x4bacb6];return _0x58c029;};'use strict';var emlformat=require(_0x2a57('0x0'));var rimraf=require(_0x2a57('0x1'));var zipdir=require(_0x2a57('0x2'));var jsonpatch=require(_0x2a57('0x3'));var rp=require(_0x2a57('0x4'));var moment=require(_0x2a57('0x5'));var BPromise=require(_0x2a57('0x6'));var Mustache=require(_0x2a57('0x7'));var util=require(_0x2a57('0x8'));var path=require(_0x2a57('0x9'));var sox=require(_0x2a57('0xa'));var csv=require(_0x2a57('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a57('0xc'));var _=require(_0x2a57('0xd'));var squel=require(_0x2a57('0xe'));var crypto=require(_0x2a57('0xf'));var jsforce=require(_0x2a57('0x10'));var deskjs=require(_0x2a57('0x11'));var toCsv=require(_0x2a57('0xb'));var querystring=require(_0x2a57('0x12'));var Papa=require(_0x2a57('0x13'));var Redis=require(_0x2a57('0x14'));var authService=require(_0x2a57('0x15'));var qs=require(_0x2a57('0x16'));var as=require(_0x2a57('0x17'));var hardwareService=require(_0x2a57('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x2a57('0x19'));var config=require(_0x2a57('0x1a'));var licenseUtil=require(_0x2a57('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fc2c,_0x5e2c06){_0x5e2c06=_0x5e2c06||0xcc;return function(_0x420f19){if(_0x420f19){return _0x32fc2c[_0x2a57('0x1c')](_0x5e2c06);}return _0x32fc2c[_0x2a57('0x1d')](_0x5e2c06)[_0x2a57('0x1e')]();};}function respondWithResult(_0xdc51da,_0x504deb){_0x504deb=_0x504deb||0xc8;return function(_0x3e3c16){if(_0x3e3c16){return _0xdc51da[_0x2a57('0x1d')](_0x504deb)[_0x2a57('0x1f')](_0x3e3c16);}};}function respondWithFilteredResult(_0x4cc859,_0x2572a9){return function(_0x192d6e){if(_0x192d6e){var _0x198f10=typeof _0x2572a9[_0x2a57('0x20')]===_0x2a57('0x21')&&typeof _0x2572a9[_0x2a57('0x22')]===_0x2a57('0x21');var _0x4c8c9a=_0x192d6e['count'];var _0x1c0be3=_0x198f10?0x0:_0x2572a9['offset'];var _0x2ea626=_0x198f10?_0x192d6e[_0x2a57('0x23')]:_0x2572a9[_0x2a57('0x20')]+_0x2572a9[_0x2a57('0x22')];var _0x6ed76d;if(_0x2ea626>=_0x4c8c9a){_0x2ea626=_0x4c8c9a;_0x6ed76d=0xc8;}else{_0x6ed76d=0xce;}_0x4cc859['status'](_0x6ed76d);return _0x4cc859['set'](_0x2a57('0x24'),_0x1c0be3+'-'+_0x2ea626+'/'+_0x4c8c9a)['json'](_0x192d6e);}return null;};}function patchUpdates(_0x5020d3){return function(_0x18c857){try{jsonpatch[_0x2a57('0x25')](_0x18c857,_0x5020d3,!![]);}catch(_0x479906){return BPromise[_0x2a57('0x26')](_0x479906);}return _0x18c857[_0x2a57('0x27')]();};}function saveUpdates(_0x455d48,_0x3f8d25){return function(_0x403f4d){if(_0x403f4d){return _0x403f4d['update'](_0x455d48)['then'](function(_0x2d4ebe){return _0x2d4ebe;});}return null;};}function removeEntity(_0xb5c24e,_0x2bc16a){return function(_0x244953){if(_0x244953){return _0x244953[_0x2a57('0x28')]()[_0x2a57('0x29')](function(){_0xb5c24e[_0x2a57('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x538011,_0x3f4565){return function(_0x42f6ed){if(!_0x42f6ed){_0x538011[_0x2a57('0x1c')](0x194);}return _0x42f6ed;};}function handleError(_0x2a9ed1,_0xc327f1){_0xc327f1=_0xc327f1||0x1f4;return function(_0x40a7ea){logger['error'](_0x40a7ea[_0x2a57('0x2a')]);if(_0x40a7ea[_0x2a57('0x2b')]){delete _0x40a7ea[_0x2a57('0x2b')];}_0x2a9ed1[_0x2a57('0x1d')](_0xc327f1)[_0x2a57('0x2c')](_0x40a7ea);};}exports[_0x2a57('0x2d')]=function(_0x2d8a82,_0x2cbe1e){var _0x5129f3={},_0x39e132={},_0x5f20cf={'count':0x0,'rows':[]};var _0x249d1a=_['map'](db[_0x2a57('0x2e')]['rawAttributes'],function(_0x58d6d0){return{'name':_0x58d6d0[_0x2a57('0x2f')],'type':_0x58d6d0['type'][_0x2a57('0x30')]};});_0x39e132[_0x2a57('0x31')]=_[_0x2a57('0x32')](_0x249d1a,_0x2a57('0x2b'));_0x39e132[_0x2a57('0x33')]=_['keys'](_0x2d8a82[_0x2a57('0x33')]);_0x39e132['filters']=_[_0x2a57('0x34')](_0x39e132['model'],_0x39e132[_0x2a57('0x33')]);_0x5129f3['attributes']=_['intersection'](_0x39e132[_0x2a57('0x31')],qs[_0x2a57('0x35')](_0x2d8a82[_0x2a57('0x33')]['fields']));_0x5129f3['attributes']=_0x5129f3[_0x2a57('0x36')][_0x2a57('0x37')]?_0x5129f3['attributes']:_0x39e132[_0x2a57('0x31')];if(!_0x2d8a82[_0x2a57('0x33')]['hasOwnProperty'](_0x2a57('0x38'))){_0x5129f3[_0x2a57('0x22')]=qs[_0x2a57('0x22')](_0x2d8a82[_0x2a57('0x33')][_0x2a57('0x22')]);_0x5129f3[_0x2a57('0x20')]=qs['offset'](_0x2d8a82[_0x2a57('0x33')][_0x2a57('0x20')]);}_0x5129f3[_0x2a57('0x39')]=qs[_0x2a57('0x3a')](_0x2d8a82['query']['sort']);_0x5129f3['where']=qs[_0x2a57('0x3b')](_['pick'](_0x2d8a82['query'],_0x39e132[_0x2a57('0x3b')]),_0x249d1a);if(_0x2d8a82[_0x2a57('0x33')][_0x2a57('0x3c')]){_0x5129f3[_0x2a57('0x3d')]=_[_0x2a57('0x3e')](_0x5129f3[_0x2a57('0x3d')],{'$or':_[_0x2a57('0x32')](_0x249d1a,function(_0x51f628){if(_0x51f628['type']!=='VIRTUAL'){var _0x5d9de8={};_0x5d9de8[_0x51f628[_0x2a57('0x2b')]]={'$like':'%'+_0x2d8a82[_0x2a57('0x33')]['filter']+'%'};return _0x5d9de8;}})});}_0x5129f3=_[_0x2a57('0x3e')]({},_0x5129f3,_0x2d8a82[_0x2a57('0x3f')]);var _0x286cec={'where':_0x5129f3['where']};return db[_0x2a57('0x2e')][_0x2a57('0x23')](_0x286cec)[_0x2a57('0x29')](function(_0x23fe85){_0x5f20cf['count']=_0x23fe85;if(_0x2d8a82[_0x2a57('0x33')][_0x2a57('0x40')]){_0x5129f3[_0x2a57('0x41')]=[{'all':!![]}];}return db[_0x2a57('0x2e')][_0x2a57('0x42')](_0x5129f3);})[_0x2a57('0x29')](function(_0x5c0503){_0x5f20cf[_0x2a57('0x43')]=_0x5c0503;return _0x5f20cf;})[_0x2a57('0x29')](respondWithFilteredResult(_0x2cbe1e,_0x5129f3))[_0x2a57('0x44')](handleError(_0x2cbe1e,null));};exports[_0x2a57('0x45')]=function(_0x434a5b,_0x38b4ce){var _0x5c6102={'raw':!![],'where':{'id':_0x434a5b[_0x2a57('0x46')]['id']}},_0x24cb1d={};_0x24cb1d['model']=_[_0x2a57('0x47')](db[_0x2a57('0x2e')][_0x2a57('0x48')]);_0x24cb1d[_0x2a57('0x33')]=_[_0x2a57('0x47')](_0x434a5b[_0x2a57('0x33')]);_0x24cb1d['filters']=_['intersection'](_0x24cb1d['model'],_0x24cb1d['query']);_0x5c6102[_0x2a57('0x36')]=_[_0x2a57('0x34')](_0x24cb1d[_0x2a57('0x31')],qs['fields'](_0x434a5b['query'][_0x2a57('0x35')]));_0x5c6102[_0x2a57('0x36')]=_0x5c6102['attributes'][_0x2a57('0x37')]?_0x5c6102[_0x2a57('0x36')]:_0x24cb1d[_0x2a57('0x31')];if(_0x434a5b[_0x2a57('0x33')]['includeAll']){_0x5c6102['include']=[{'all':!![]}];}_0x5c6102=_[_0x2a57('0x3e')]({},_0x5c6102,_0x434a5b['options']);return db['SalesforceField'][_0x2a57('0x49')](_0x5c6102)[_0x2a57('0x29')](handleEntityNotFound(_0x38b4ce,null))['then'](respondWithResult(_0x38b4ce,null))[_0x2a57('0x44')](handleError(_0x38b4ce,null));};exports[_0x2a57('0x4a')]=function(_0x5ab5d4,_0x36fbef){return db[_0x2a57('0x2e')][_0x2a57('0x4a')](_0x5ab5d4[_0x2a57('0x4b')],{})['then'](respondWithResult(_0x36fbef,0xc9))[_0x2a57('0x44')](handleError(_0x36fbef,null));};exports[_0x2a57('0x4c')]=function(_0xddcbee,_0x345006){if(_0xddcbee[_0x2a57('0x4b')]['id']){delete _0xddcbee[_0x2a57('0x4b')]['id'];}return db[_0x2a57('0x2e')][_0x2a57('0x49')]({'where':{'id':_0xddcbee[_0x2a57('0x46')]['id']}})[_0x2a57('0x29')](handleEntityNotFound(_0x345006,null))[_0x2a57('0x29')](saveUpdates(_0xddcbee[_0x2a57('0x4b')],null))[_0x2a57('0x29')](respondWithResult(_0x345006,null))[_0x2a57('0x44')](handleError(_0x345006,null));};exports['destroy']=function(_0x137da6,_0x2bdcc6){return db[_0x2a57('0x2e')][_0x2a57('0x49')]({'where':{'id':_0x137da6[_0x2a57('0x46')]['id']}})['then'](handleEntityNotFound(_0x2bdcc6,null))[_0x2a57('0x29')](removeEntity(_0x2bdcc6,null))[_0x2a57('0x44')](handleError(_0x2bdcc6,null));}; \ No newline at end of file +var _0x5a9d=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','nolimit','limit','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','length','find','create','body','params','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x191919,_0x1c1b70){var _0x390cd6=function(_0x2f9b96){while(--_0x2f9b96){_0x191919['push'](_0x191919['shift']());}};_0x390cd6(++_0x1c1b70);}(_0x5a9d,0xd0));var _0xd5a9=function(_0x182757,_0x31991a){_0x182757=_0x182757-0x0;var _0x57c714=_0x5a9d[_0x182757];return _0x57c714;};'use strict';var emlformat=require(_0xd5a9('0x0'));var rimraf=require(_0xd5a9('0x1'));var zipdir=require(_0xd5a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5a9('0x3'));var Mustache=require(_0xd5a9('0x4'));var util=require(_0xd5a9('0x5'));var path=require(_0xd5a9('0x6'));var sox=require(_0xd5a9('0x7'));var csv=require(_0xd5a9('0x8'));var ejs=require(_0xd5a9('0x9'));var fs=require('fs');var fs_extra=require(_0xd5a9('0xa'));var _=require(_0xd5a9('0xb'));var squel=require(_0xd5a9('0xc'));var crypto=require(_0xd5a9('0xd'));var jsforce=require(_0xd5a9('0xe'));var deskjs=require(_0xd5a9('0xf'));var toCsv=require(_0xd5a9('0x8'));var querystring=require(_0xd5a9('0x10'));var Papa=require(_0xd5a9('0x11'));var Redis=require(_0xd5a9('0x12'));var authService=require(_0xd5a9('0x13'));var qs=require(_0xd5a9('0x14'));var as=require(_0xd5a9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5a9('0x16'))(_0xd5a9('0x17'));var utils=require(_0xd5a9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd5a9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126a76,_0x473cc9){_0x473cc9=_0x473cc9||0xcc;return function(_0x1758eb){if(_0x1758eb){return _0x126a76[_0xd5a9('0x1a')](_0x473cc9);}return _0x126a76['status'](_0x473cc9)['end']();};}function respondWithResult(_0x3ac05f,_0x12a2a5){_0x12a2a5=_0x12a2a5||0xc8;return function(_0x1cd7b1){if(_0x1cd7b1){return _0x3ac05f[_0xd5a9('0x1b')](_0x12a2a5)['json'](_0x1cd7b1);}};}function respondWithFilteredResult(_0x26916f,_0x1c6449){return function(_0x1f047e){if(_0x1f047e){var _0x4be074=typeof _0x1c6449[_0xd5a9('0x1c')]===_0xd5a9('0x1d')&&typeof _0x1c6449['limit']==='undefined';var _0x515bb1=_0x1f047e['count'];var _0x3a8b30=_0x4be074?0x0:_0x1c6449['offset'];var _0x261714=_0x4be074?_0x1f047e[_0xd5a9('0x1e')]:_0x1c6449[_0xd5a9('0x1c')]+_0x1c6449['limit'];var _0x347c39;if(_0x261714>=_0x515bb1){_0x261714=_0x515bb1;_0x347c39=0xc8;}else{_0x347c39=0xce;}_0x26916f[_0xd5a9('0x1b')](_0x347c39);return _0x26916f[_0xd5a9('0x1f')](_0xd5a9('0x20'),_0x3a8b30+'-'+_0x261714+'/'+_0x515bb1)['json'](_0x1f047e);}return null;};}function patchUpdates(_0x48e52c){return function(_0x437f41){try{jsonpatch[_0xd5a9('0x21')](_0x437f41,_0x48e52c,!![]);}catch(_0x1f951c){return BPromise[_0xd5a9('0x22')](_0x1f951c);}return _0x437f41[_0xd5a9('0x23')]();};}function saveUpdates(_0x3c9124,_0x4d32a2){return function(_0x2a8529){if(_0x2a8529){return _0x2a8529[_0xd5a9('0x24')](_0x3c9124)[_0xd5a9('0x25')](function(_0x2c8bac){return _0x2c8bac;});}return null;};}function removeEntity(_0x32c304,_0x4a1971){return function(_0xab243f){if(_0xab243f){return _0xab243f[_0xd5a9('0x26')]()[_0xd5a9('0x25')](function(){_0x32c304[_0xd5a9('0x1b')](0xcc)[_0xd5a9('0x27')]();});}};}function handleEntityNotFound(_0x1c7ad0,_0x310ae9){return function(_0x1a5fcf){if(!_0x1a5fcf){_0x1c7ad0[_0xd5a9('0x1a')](0x194);}return _0x1a5fcf;};}function handleError(_0x2cb94f,_0x33f7fd){_0x33f7fd=_0x33f7fd||0x1f4;return function(_0x26e37d){logger[_0xd5a9('0x28')](_0x26e37d[_0xd5a9('0x29')]);if(_0x26e37d['name']){delete _0x26e37d[_0xd5a9('0x2a')];}_0x2cb94f[_0xd5a9('0x1b')](_0x33f7fd)[_0xd5a9('0x2b')](_0x26e37d);};}exports['index']=function(_0x703043,_0x4be9f3){var _0xf8e2ed={},_0x13f375={},_0x1757db={'count':0x0,'rows':[]};var _0x8d7438=_[_0xd5a9('0x2c')](db[_0xd5a9('0x2d')][_0xd5a9('0x2e')],function(_0x551e9c){return{'name':_0x551e9c[_0xd5a9('0x2f')],'type':_0x551e9c[_0xd5a9('0x30')][_0xd5a9('0x31')]};});_0x13f375[_0xd5a9('0x32')]=_[_0xd5a9('0x2c')](_0x8d7438,_0xd5a9('0x2a'));_0x13f375[_0xd5a9('0x33')]=_['keys'](_0x703043[_0xd5a9('0x33')]);_0x13f375['filters']=_['intersection'](_0x13f375['model'],_0x13f375['query']);_0xf8e2ed[_0xd5a9('0x34')]=_[_0xd5a9('0x35')](_0x13f375[_0xd5a9('0x32')],qs[_0xd5a9('0x36')](_0x703043[_0xd5a9('0x33')][_0xd5a9('0x36')]));_0xf8e2ed[_0xd5a9('0x34')]=_0xf8e2ed[_0xd5a9('0x34')]['length']?_0xf8e2ed['attributes']:_0x13f375['model'];if(!_0x703043[_0xd5a9('0x33')]['hasOwnProperty'](_0xd5a9('0x37'))){_0xf8e2ed[_0xd5a9('0x38')]=qs['limit'](_0x703043[_0xd5a9('0x33')]['limit']);_0xf8e2ed[_0xd5a9('0x1c')]=qs[_0xd5a9('0x1c')](_0x703043[_0xd5a9('0x33')][_0xd5a9('0x1c')]);}_0xf8e2ed[_0xd5a9('0x39')]=qs['sort'](_0x703043[_0xd5a9('0x33')]['sort']);_0xf8e2ed[_0xd5a9('0x3a')]=qs[_0xd5a9('0x3b')](_['pick'](_0x703043[_0xd5a9('0x33')],_0x13f375['filters']),_0x8d7438);if(_0x703043[_0xd5a9('0x33')][_0xd5a9('0x3c')]){_0xf8e2ed[_0xd5a9('0x3a')]=_[_0xd5a9('0x3d')](_0xf8e2ed[_0xd5a9('0x3a')],{'$or':_[_0xd5a9('0x2c')](_0x8d7438,function(_0x548099){if(_0x548099['type']!==_0xd5a9('0x3e')){var _0x387e8c={};_0x387e8c[_0x548099[_0xd5a9('0x2a')]]={'$like':'%'+_0x703043[_0xd5a9('0x33')][_0xd5a9('0x3c')]+'%'};return _0x387e8c;}})});}_0xf8e2ed=_[_0xd5a9('0x3d')]({},_0xf8e2ed,_0x703043[_0xd5a9('0x3f')]);var _0xd8b241={'where':_0xf8e2ed[_0xd5a9('0x3a')]};return db[_0xd5a9('0x2d')][_0xd5a9('0x1e')](_0xd8b241)[_0xd5a9('0x25')](function(_0xe260ba){_0x1757db[_0xd5a9('0x1e')]=_0xe260ba;if(_0x703043[_0xd5a9('0x33')]['includeAll']){_0xf8e2ed[_0xd5a9('0x40')]=[{'all':!![]}];}return db[_0xd5a9('0x2d')][_0xd5a9('0x41')](_0xf8e2ed);})[_0xd5a9('0x25')](function(_0x46bf6d){_0x1757db['rows']=_0x46bf6d;return _0x1757db;})[_0xd5a9('0x25')](respondWithFilteredResult(_0x4be9f3,_0xf8e2ed))[_0xd5a9('0x42')](handleError(_0x4be9f3,null));};exports[_0xd5a9('0x43')]=function(_0x1b7940,_0x5153aa){var _0x2b9847={'raw':!![],'where':{'id':_0x1b7940['params']['id']}},_0x16c7d0={};_0x16c7d0['model']=_['keys'](db[_0xd5a9('0x2d')][_0xd5a9('0x2e')]);_0x16c7d0['query']=_[_0xd5a9('0x44')](_0x1b7940[_0xd5a9('0x33')]);_0x16c7d0[_0xd5a9('0x3b')]=_[_0xd5a9('0x35')](_0x16c7d0[_0xd5a9('0x32')],_0x16c7d0[_0xd5a9('0x33')]);_0x2b9847[_0xd5a9('0x34')]=_[_0xd5a9('0x35')](_0x16c7d0[_0xd5a9('0x32')],qs[_0xd5a9('0x36')](_0x1b7940['query'][_0xd5a9('0x36')]));_0x2b9847[_0xd5a9('0x34')]=_0x2b9847['attributes'][_0xd5a9('0x45')]?_0x2b9847[_0xd5a9('0x34')]:_0x16c7d0['model'];if(_0x1b7940['query']['includeAll']){_0x2b9847[_0xd5a9('0x40')]=[{'all':!![]}];}_0x2b9847=_[_0xd5a9('0x3d')]({},_0x2b9847,_0x1b7940[_0xd5a9('0x3f')]);return db[_0xd5a9('0x2d')][_0xd5a9('0x46')](_0x2b9847)[_0xd5a9('0x25')](handleEntityNotFound(_0x5153aa,null))[_0xd5a9('0x25')](respondWithResult(_0x5153aa,null))[_0xd5a9('0x42')](handleError(_0x5153aa,null));};exports[_0xd5a9('0x47')]=function(_0x3a1151,_0x61f9a6){return db['SalesforceField'][_0xd5a9('0x47')](_0x3a1151[_0xd5a9('0x48')],{})[_0xd5a9('0x25')](respondWithResult(_0x61f9a6,0xc9))[_0xd5a9('0x42')](handleError(_0x61f9a6,null));};exports['update']=function(_0x7cbf60,_0x49c8aa){if(_0x7cbf60['body']['id']){delete _0x7cbf60[_0xd5a9('0x48')]['id'];}return db[_0xd5a9('0x2d')][_0xd5a9('0x46')]({'where':{'id':_0x7cbf60[_0xd5a9('0x49')]['id']}})[_0xd5a9('0x25')](handleEntityNotFound(_0x49c8aa,null))[_0xd5a9('0x25')](saveUpdates(_0x7cbf60[_0xd5a9('0x48')],null))[_0xd5a9('0x25')](respondWithResult(_0x49c8aa,null))['catch'](handleError(_0x49c8aa,null));};exports[_0xd5a9('0x26')]=function(_0x37c2b1,_0x4e6808){return db[_0xd5a9('0x2d')]['find']({'where':{'id':_0x37c2b1[_0xd5a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e6808,null))[_0xd5a9('0x25')](removeEntity(_0x4e6808,null))[_0xd5a9('0x42')](handleError(_0x4e6808,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6214d9e..5efa3ad 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 _0x7084=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fee03,_0x251295){var _0x90a85=function(_0x16a1c2){while(--_0x16a1c2){_0x2fee03['push'](_0x2fee03['shift']());}};_0x90a85(++_0x251295);}(_0x7084,0xfa));var _0x4708=function(_0x2c3f35,_0x57221b){_0x2c3f35=_0x2c3f35-0x0;var _0xf9105e=_0x7084[_0x2c3f35];return _0xf9105e;};'use strict';var _=require(_0x4708('0x0'));var util=require(_0x4708('0x1'));var logger=require(_0x4708('0x2'))(_0x4708('0x3'));var moment=require(_0x4708('0x4'));var BPromise=require(_0x4708('0x5'));var rp=require(_0x4708('0x6'));var fs=require('fs');var path=require(_0x4708('0x7'));var rimraf=require(_0x4708('0x8'));var config=require(_0x4708('0x9'));var attributes=require(_0x4708('0xa'));module[_0x4708('0xb')]=function(_0xbaddc9,_0x5a73cd){return _0xbaddc9['define'](_0x4708('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4708('0xd'),'fields':[_0x4708('0xe'),_0x4708('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f80=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0xf30e92,_0x1dc9e9){var _0x3feb7c=function(_0x2cbbb0){while(--_0x2cbbb0){_0xf30e92['push'](_0xf30e92['shift']());}};_0x3feb7c(++_0x1dc9e9);}(_0x9f80,0xe6));var _0x09f8=function(_0x22f862,_0x127fac){_0x22f862=_0x22f862-0x0;var _0x104abc=_0x9f80[_0x22f862];return _0x104abc;};'use strict';var _=require(_0x09f8('0x0'));var util=require(_0x09f8('0x1'));var logger=require(_0x09f8('0x2'))('api');var moment=require(_0x09f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x09f8('0x4'));var fs=require('fs');var path=require(_0x09f8('0x5'));var rimraf=require(_0x09f8('0x6'));var config=require(_0x09f8('0x7'));var attributes=require(_0x09f8('0x8'));module[_0x09f8('0x9')]=function(_0x31cd9e,_0x1c8fb9){return _0x31cd9e[_0x09f8('0xa')](_0x09f8('0xb'),attributes,{'tableName':_0x09f8('0xc'),'paranoid':![],'indexes':[{'name':_0x09f8('0xd'),'fields':[_0x09f8('0xe'),_0x09f8('0xf')],'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 9c1cd83..62a8a1b 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 _0xa703=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x483709,_0x37708e){var _0x43b326=function(_0x42744f){while(--_0x42744f){_0x483709['push'](_0x483709['shift']());}};_0x43b326(++_0x37708e);}(_0xa703,0x94));var _0x3a70=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa703[_0x411add];return _0x238242;};'use strict';var _=require(_0x3a70('0x0'));var util=require(_0x3a70('0x1'));var moment=require(_0x3a70('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a70('0x3'));var fs=require('fs');var Redis=require(_0x3a70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a70('0x5'));var logger=require(_0x3a70('0x6'))(_0x3a70('0x7'));var config=require(_0x3a70('0x8'));var jayson=require(_0x3a70('0x9'));var client=jayson[_0x3a70('0xa')][_0x3a70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x135453,_0x398a23,_0x457888){return new BPromise(function(_0x21b0dc,_0x3adc73){return client[_0x3a70('0xc')](_0x135453,_0x457888)['then'](function(_0x4997bf){logger[_0x3a70('0xd')]('SalesforceField,\x20%s,\x20%s',_0x398a23,_0x3a70('0xe'));logger[_0x3a70('0xf')](_0x3a70('0x10'),_0x398a23,_0x3a70('0xe'),JSON[_0x3a70('0x11')](_0x4997bf));if(_0x4997bf[_0x3a70('0x12')]){if(_0x4997bf[_0x3a70('0x12')][_0x3a70('0x13')]===0x1f4){logger[_0x3a70('0x12')](_0x3a70('0x14'),_0x398a23,_0x4997bf[_0x3a70('0x12')][_0x3a70('0x15')]);return _0x3adc73(_0x4997bf[_0x3a70('0x12')][_0x3a70('0x15')]);}logger[_0x3a70('0x12')](_0x3a70('0x14'),_0x398a23,_0x4997bf[_0x3a70('0x12')][_0x3a70('0x15')]);return _0x21b0dc(_0x4997bf['error'][_0x3a70('0x15')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x398a23,_0x3a70('0xe'));_0x21b0dc(_0x4997bf[_0x3a70('0x16')][_0x3a70('0x15')]);}})[_0x3a70('0x17')](function(_0x5047d2){logger['error'](_0x3a70('0x14'),_0x398a23,_0x5047d2);_0x3adc73(_0x5047d2);});});} \ No newline at end of file +var _0xda2a=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x2bb44f,_0x4d786a){var _0xf4c54b=function(_0x518ed1){while(--_0x518ed1){_0x2bb44f['push'](_0x2bb44f['shift']());}};_0xf4c54b(++_0x4d786a);}(_0xda2a,0x1c0));var _0xada2=function(_0x33ba11,_0x1e030d){_0x33ba11=_0x33ba11-0x0;var _0x9b197e=_0xda2a[_0x33ba11];return _0x9b197e;};'use strict';var _=require(_0xada2('0x0'));var util=require(_0xada2('0x1'));var moment=require('moment');var BPromise=require(_0xada2('0x2'));var rs=require(_0xada2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xada2('0x4'));var logger=require('../../config/logger')(_0xada2('0x5'));var config=require(_0xada2('0x6'));var jayson=require(_0xada2('0x7'));var client=jayson['client'][_0xada2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff6,_0x2c9e8e,_0x2087c7){return new BPromise(function(_0x3d46f1,_0x39bda9){return client['request'](_0x4e8ff6,_0x2087c7)[_0xada2('0x9')](function(_0x938158){logger[_0xada2('0xa')](_0xada2('0xb'),_0x2c9e8e,_0xada2('0xc'));logger['debug'](_0xada2('0xd'),_0x2c9e8e,_0xada2('0xc'),JSON['stringify'](_0x938158));if(_0x938158[_0xada2('0xe')]){if(_0x938158[_0xada2('0xe')][_0xada2('0xf')]===0x1f4){logger[_0xada2('0xe')](_0xada2('0xb'),_0x2c9e8e,_0x938158[_0xada2('0xe')][_0xada2('0x10')]);return _0x39bda9(_0x938158['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x2c9e8e,_0x938158[_0xada2('0xe')][_0xada2('0x10')]);return _0x3d46f1(_0x938158[_0xada2('0xe')]['message']);}else{logger[_0xada2('0xa')]('SalesforceField,\x20%s,\x20%s',_0x2c9e8e,_0xada2('0xc'));_0x3d46f1(_0x938158['result'][_0xada2('0x10')]);}})[_0xada2('0x11')](function(_0x17680e){logger[_0xada2('0xe')](_0xada2('0xb'),_0x2c9e8e,_0x17680e);_0x39bda9(_0x17680e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ea4537d..b8fbc35 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 _0x4058=['isAuthenticated','index','get','/:id','/:id/configurations','getFields','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x360739,_0x2ec1b2){var _0x3e23a1=function(_0x105b37){while(--_0x105b37){_0x360739['push'](_0x360739['shift']());}};_0x3e23a1(++_0x2ec1b2);}(_0x4058,0x129));var _0x8405=function(_0x5c5faf,_0x18e0ac){_0x5c5faf=_0x5c5faf-0x0;var _0x5ef14d=_0x4058[_0x5c5faf];return _0x5ef14d;};'use strict';var multer=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var path=require(_0x8405('0x2'));var timeout=require(_0x8405('0x3'));var express=require(_0x8405('0x4'));var router=express[_0x8405('0x5')]();var fs_extra=require(_0x8405('0x6'));var auth=require(_0x8405('0x7'));var interaction=require(_0x8405('0x8'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x8405('0x9')](),controller[_0x8405('0xa')]);router[_0x8405('0xb')](_0x8405('0xc'),auth[_0x8405('0x9')](),controller['show']);router[_0x8405('0xb')](_0x8405('0xd'),auth[_0x8405('0x9')](),controller['getConfigurations']);router[_0x8405('0xb')]('/:id/fields',auth[_0x8405('0x9')](),controller[_0x8405('0xe')]);router['post']('/',auth[_0x8405('0x9')](),controller[_0x8405('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8405('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8405('0x9')](),controller[_0x8405('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc86a=['/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index'];(function(_0x2b974c,_0x3714ee){var _0x21da1d=function(_0x91b353){while(--_0x91b353){_0x2b974c['push'](_0x2b974c['shift']());}};_0x21da1d(++_0x3714ee);}(_0xc86a,0x1f0));var _0xac86=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xc86a[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0xac86('0x0'));var util=require(_0xac86('0x1'));var path=require('path');var timeout=require(_0xac86('0x2'));var express=require(_0xac86('0x3'));var router=express['Router']();var fs_extra=require(_0xac86('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xac86('0x5'));var config=require(_0xac86('0x6'));var controller=require(_0xac86('0x7'));router[_0xac86('0x8')]('/',auth['isAuthenticated'](),controller[_0xac86('0x9')]);router[_0xac86('0x8')](_0xac86('0xa'),auth[_0xac86('0xb')](),controller[_0xac86('0xc')]);router[_0xac86('0x8')]('/:id/configurations',auth[_0xac86('0xb')](),controller[_0xac86('0xd')]);router[_0xac86('0x8')](_0xac86('0xe'),auth[_0xac86('0xb')](),controller[_0xac86('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac86('0x10')]);router[_0xac86('0x11')](_0xac86('0x12'),auth[_0xac86('0xb')](),controller['addConfiguration']);router[_0xac86('0x13')](_0xac86('0xa'),auth[_0xac86('0xb')](),controller['update']);router[_0xac86('0x14')]('/:id',auth[_0xac86('0xb')](),controller[_0xac86('0x15')]);module[_0xac86('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b36126f..eece4af 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 _0x8aaa=['STRING','sequelize','exports'];(function(_0x398acc,_0x21f70b){var _0x6a9478=function(_0x57591d){while(--_0x57591d){_0x398acc['push'](_0x398acc['shift']());}};_0x6a9478(++_0x21f70b);}(_0x8aaa,0x14b));var _0xa8aa=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x8aaa[_0x107f10];return _0x811cab;};'use strict';var Sequelize=require(_0xa8aa('0x0'));module[_0xa8aa('0x1')]={'name':{'type':Sequelize[_0xa8aa('0x2')]},'description':{'type':Sequelize[_0xa8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa8aa('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa8aa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x64b8=['exports','STRING','username','remoteUri'];(function(_0x3699b0,_0x25fc8b){var _0x510f09=function(_0x39b409){while(--_0x39b409){_0x3699b0['push'](_0x3699b0['shift']());}};_0x510f09(++_0x25fc8b);}(_0x64b8,0x108));var _0x864b=function(_0x445d6e,_0x1dbe43){_0x445d6e=_0x445d6e-0x0;var _0x6b970=_0x64b8[_0x445d6e];return _0x6b970;};'use strict';var Sequelize=require('sequelize');module[_0x864b('0x0')]={'name':{'type':Sequelize[_0x864b('0x1')]},'description':{'type':Sequelize[_0x864b('0x1')]},'username':{'type':Sequelize[_0x864b('0x1')],'unique':_0x864b('0x2')},'password':{'type':Sequelize[_0x864b('0x1')]},'email':{'type':Sequelize[_0x864b('0x1')]},'remoteUri':{'type':Sequelize[_0x864b('0x1')],'unique':_0x864b('0x3')},'serverUrl':{'type':Sequelize[_0x864b('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 28fed02..f930d1f 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 _0x5bb8=['index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','findOne','ServicenowConfiguration','nolimit','getConfigurations','addConfiguration','AccountId','channel','type','Descriptions','ServicenowField','Subjects','getFields','hold_reason','subcategory','close_code','parent','made_sla','caused_by','upon_reject','approval_history','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','knowledge','calendar_stc','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','activity_due','assigned_to','severity','comments','sla_due','approval','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','all','concat','ServiceNow\x20error:\x20','statusCode','error','test','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','stack','name'];(function(_0x456fc1,_0x191e3d){var _0x84fab3=function(_0x22fd2b){while(--_0x22fd2b){_0x456fc1['push'](_0x456fc1['shift']());}};_0x84fab3(++_0x191e3d);}(_0x5bb8,0x8b));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x85bb('0x0'));var rimraf=require(_0x85bb('0x1'));var zipdir=require(_0x85bb('0x2'));var jsonpatch=require(_0x85bb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x85bb('0x4'));var Mustache=require(_0x85bb('0x5'));var util=require(_0x85bb('0x6'));var path=require(_0x85bb('0x7'));var sox=require(_0x85bb('0x8'));var csv=require(_0x85bb('0x9'));var ejs=require(_0x85bb('0xa'));var fs=require('fs');var fs_extra=require(_0x85bb('0xb'));var _=require('lodash');var squel=require(_0x85bb('0xc'));var crypto=require(_0x85bb('0xd'));var jsforce=require(_0x85bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85bb('0x9'));var querystring=require(_0x85bb('0xf'));var Papa=require('papaparse');var Redis=require(_0x85bb('0x10'));var authService=require(_0x85bb('0x11'));var qs=require(_0x85bb('0x12'));var as=require(_0x85bb('0x13'));var hardwareService=require(_0x85bb('0x14'));var logger=require('../../config/logger')(_0x85bb('0x15'));var utils=require(_0x85bb('0x16'));var config=require(_0x85bb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85bb('0x18'))['db'];var integrations=require(_0x85bb('0x19'));function respondWithStatusCode(_0x5a5c80,_0x1cf49a){_0x1cf49a=_0x1cf49a||0xcc;return function(_0x2a3eef){if(_0x2a3eef){return _0x5a5c80['sendStatus'](_0x1cf49a);}return _0x5a5c80[_0x85bb('0x1a')](_0x1cf49a)[_0x85bb('0x1b')]();};}function respondWithResult(_0x7a7fb0,_0x2f9b1a){_0x2f9b1a=_0x2f9b1a||0xc8;return function(_0x4df02c){if(_0x4df02c){return _0x7a7fb0[_0x85bb('0x1a')](_0x2f9b1a)['json'](_0x4df02c);}};}function respondWithFilteredResult(_0x45e4af,_0x3ded28){return function(_0x36c335){if(_0x36c335){var _0x431f18=typeof _0x3ded28['offset']===_0x85bb('0x1c')&&typeof _0x3ded28[_0x85bb('0x1d')]===_0x85bb('0x1c');var _0x43713e=_0x36c335[_0x85bb('0x1e')];var _0x77a93=_0x431f18?0x0:_0x3ded28['offset'];var _0x56ba6a=_0x431f18?_0x36c335[_0x85bb('0x1e')]:_0x3ded28[_0x85bb('0x1f')]+_0x3ded28[_0x85bb('0x1d')];var _0xcbf472;if(_0x56ba6a>=_0x43713e){_0x56ba6a=_0x43713e;_0xcbf472=0xc8;}else{_0xcbf472=0xce;}_0x45e4af[_0x85bb('0x1a')](_0xcbf472);return _0x45e4af[_0x85bb('0x20')](_0x85bb('0x21'),_0x77a93+'-'+_0x56ba6a+'/'+_0x43713e)[_0x85bb('0x22')](_0x36c335);}return null;};}function patchUpdates(_0x519d96){return function(_0x392e1f){try{jsonpatch['apply'](_0x392e1f,_0x519d96,!![]);}catch(_0xfb1641){return BPromise[_0x85bb('0x23')](_0xfb1641);}return _0x392e1f['save']();};}function saveUpdates(_0x11537c,_0x436699){return function(_0x203820){if(_0x203820){return _0x203820[_0x85bb('0x24')](_0x11537c)[_0x85bb('0x25')](function(_0x12b46a){return _0x12b46a;});}return null;};}function removeEntity(_0x3cbdc9,_0xac8c3){return function(_0x237128){if(_0x237128){return _0x237128['destroy']()['then'](function(){_0x3cbdc9[_0x85bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1be,_0x11e5fd){return function(_0x81567c){if(!_0x81567c){_0x45a1be['sendStatus'](0x194);}return _0x81567c;};}function handleError(_0x4aa6c9,_0x43e4c6){_0x43e4c6=_0x43e4c6||0x1f4;return function(_0x196ecc){logger['error'](_0x196ecc[_0x85bb('0x26')]);if(_0x196ecc[_0x85bb('0x27')]){delete _0x196ecc[_0x85bb('0x27')];}_0x4aa6c9['status'](_0x43e4c6)['send'](_0x196ecc);};}exports[_0x85bb('0x28')]=function(_0x15c21b,_0x1daed2){var _0xca4b8={},_0x506d82={},_0x488797={'count':0x0,'rows':[]};var _0x36a56f=_[_0x85bb('0x29')](db[_0x85bb('0x2a')][_0x85bb('0x2b')],function(_0xd1f76a){return{'name':_0xd1f76a[_0x85bb('0x2c')],'type':_0xd1f76a['type'][_0x85bb('0x2d')]};});_0x506d82[_0x85bb('0x2e')]=_['map'](_0x36a56f,'name');_0x506d82[_0x85bb('0x2f')]=_['keys'](_0x15c21b[_0x85bb('0x2f')]);_0x506d82['filters']=_[_0x85bb('0x30')](_0x506d82[_0x85bb('0x2e')],_0x506d82[_0x85bb('0x2f')]);_0xca4b8[_0x85bb('0x31')]=_[_0x85bb('0x30')](_0x506d82['model'],qs[_0x85bb('0x32')](_0x15c21b[_0x85bb('0x2f')]['fields']));_0xca4b8[_0x85bb('0x31')]=_0xca4b8[_0x85bb('0x31')][_0x85bb('0x33')]?_0xca4b8[_0x85bb('0x31')]:_0x506d82['model'];if(!_0x15c21b[_0x85bb('0x2f')][_0x85bb('0x34')]('nolimit')){_0xca4b8[_0x85bb('0x1d')]=qs['limit'](_0x15c21b['query']['limit']);_0xca4b8['offset']=qs[_0x85bb('0x1f')](_0x15c21b[_0x85bb('0x2f')]['offset']);}_0xca4b8[_0x85bb('0x35')]=qs[_0x85bb('0x36')](_0x15c21b[_0x85bb('0x2f')][_0x85bb('0x36')]);_0xca4b8[_0x85bb('0x37')]=qs[_0x85bb('0x38')](_[_0x85bb('0x39')](_0x15c21b[_0x85bb('0x2f')],_0x506d82[_0x85bb('0x38')]),_0x36a56f);if(_0x15c21b[_0x85bb('0x2f')][_0x85bb('0x3a')]){_0xca4b8[_0x85bb('0x37')]=_['merge'](_0xca4b8[_0x85bb('0x37')],{'$or':_['map'](_0x36a56f,function(_0x3680b5){if(_0x3680b5['type']!=='VIRTUAL'){var _0x1b7980={};_0x1b7980[_0x3680b5['name']]={'$like':'%'+_0x15c21b[_0x85bb('0x2f')][_0x85bb('0x3a')]+'%'};return _0x1b7980;}})});}_0xca4b8=_[_0x85bb('0x3b')]({},_0xca4b8,_0x15c21b[_0x85bb('0x3c')]);var _0x4ab1d4={'where':_0xca4b8['where']};return db['ServicenowAccount']['count'](_0x4ab1d4)['then'](function(_0x2d34a8){_0x488797[_0x85bb('0x1e')]=_0x2d34a8;if(_0x15c21b[_0x85bb('0x2f')][_0x85bb('0x3d')]){_0xca4b8[_0x85bb('0x3e')]=[{'all':!![]}];}return db[_0x85bb('0x2a')][_0x85bb('0x3f')](_0xca4b8);})[_0x85bb('0x25')](function(_0x291e15){_0x488797['rows']=_0x291e15;return _0x488797;})[_0x85bb('0x25')](respondWithFilteredResult(_0x1daed2,_0xca4b8))[_0x85bb('0x40')](handleError(_0x1daed2,null));};exports[_0x85bb('0x41')]=function(_0x2dd8c7,_0xc4dad6){var _0x28d184={'raw':![],'where':{'id':_0x2dd8c7['params']['id']}},_0x38766f={};_0x38766f[_0x85bb('0x2e')]=_[_0x85bb('0x42')](db['ServicenowAccount'][_0x85bb('0x2b')]);_0x38766f[_0x85bb('0x2f')]=_[_0x85bb('0x42')](_0x2dd8c7[_0x85bb('0x2f')]);_0x38766f[_0x85bb('0x38')]=_[_0x85bb('0x30')](_0x38766f[_0x85bb('0x2e')],_0x38766f[_0x85bb('0x2f')]);_0x28d184[_0x85bb('0x31')]=_[_0x85bb('0x30')](_0x38766f[_0x85bb('0x2e')],qs[_0x85bb('0x32')](_0x2dd8c7[_0x85bb('0x2f')][_0x85bb('0x32')]));_0x28d184['attributes']=_0x28d184[_0x85bb('0x31')][_0x85bb('0x33')]?_0x28d184[_0x85bb('0x31')]:_0x38766f[_0x85bb('0x2e')];if(_0x2dd8c7[_0x85bb('0x2f')][_0x85bb('0x3d')]){_0x28d184['include']=[{'all':!![]}];}_0x28d184=_[_0x85bb('0x3b')]({},_0x28d184,_0x2dd8c7[_0x85bb('0x3c')]);return db[_0x85bb('0x2a')][_0x85bb('0x43')](_0x28d184)[_0x85bb('0x25')](handleEntityNotFound(_0xc4dad6,null))['then'](respondWithResult(_0xc4dad6,null))[_0x85bb('0x40')](handleError(_0xc4dad6,null));};exports['create']=function(_0x28076b,_0x2a7676){return db[_0x85bb('0x2a')][_0x85bb('0x44')](_0x28076b[_0x85bb('0x45')],{})[_0x85bb('0x25')](respondWithResult(_0x2a7676,0xc9))['catch'](handleError(_0x2a7676,null));};exports[_0x85bb('0x24')]=function(_0x58cc1b,_0x2653e5){if(_0x58cc1b[_0x85bb('0x45')]['id']){delete _0x58cc1b[_0x85bb('0x45')]['id'];}return db[_0x85bb('0x2a')][_0x85bb('0x43')]({'where':{'id':_0x58cc1b[_0x85bb('0x46')]['id']}})[_0x85bb('0x25')](handleEntityNotFound(_0x2653e5,null))['then'](saveUpdates(_0x58cc1b['body'],null))[_0x85bb('0x25')](respondWithResult(_0x2653e5,null))['catch'](handleError(_0x2653e5,null));};exports['destroy']=function(_0x52d3e5,_0x49dbd8){return db[_0x85bb('0x2a')][_0x85bb('0x43')]({'where':{'id':_0x52d3e5[_0x85bb('0x46')]['id']}})[_0x85bb('0x25')](handleEntityNotFound(_0x49dbd8,null))[_0x85bb('0x25')](removeEntity(_0x49dbd8,null))['catch'](handleError(_0x49dbd8,null));};exports['getConfigurations']=function(_0x52e059,_0x1e750b,_0x5e5ac8){var _0x1dc228={};var _0xb693d0={};var _0x23fe03;var _0x30b4a2;return db[_0x85bb('0x2a')][_0x85bb('0x47')]({'where':{'id':_0x52e059[_0x85bb('0x46')]['id']}})[_0x85bb('0x25')](handleEntityNotFound(_0x1e750b,null))[_0x85bb('0x25')](function(_0x309e7f){if(_0x309e7f){_0x23fe03=_0x309e7f;_0xb693d0[_0x85bb('0x2e')]=_[_0x85bb('0x42')](db[_0x85bb('0x48')][_0x85bb('0x2b')]);_0xb693d0[_0x85bb('0x2f')]=_[_0x85bb('0x42')](_0x52e059['query']);_0xb693d0[_0x85bb('0x38')]=_['intersection'](_0xb693d0[_0x85bb('0x2e')],_0xb693d0[_0x85bb('0x2f')]);_0x1dc228[_0x85bb('0x31')]=_['intersection'](_0xb693d0[_0x85bb('0x2e')],qs['fields'](_0x52e059['query'][_0x85bb('0x32')]));_0x1dc228[_0x85bb('0x31')]=_0x1dc228[_0x85bb('0x31')]['length']?_0x1dc228[_0x85bb('0x31')]:_0xb693d0[_0x85bb('0x2e')];_0x1dc228[_0x85bb('0x35')]=qs[_0x85bb('0x36')](_0x52e059['query'][_0x85bb('0x36')]);_0x1dc228[_0x85bb('0x37')]=qs[_0x85bb('0x38')](_[_0x85bb('0x39')](_0x52e059[_0x85bb('0x2f')],_0xb693d0['filters']));if(_0x52e059['query'][_0x85bb('0x3a')]){_0x1dc228['where']=_['merge'](_0x1dc228[_0x85bb('0x37')],{'$or':_['map'](_0x1dc228[_0x85bb('0x31')],function(_0x3b3e9a){var _0x2a5e32={};_0x2a5e32[_0x3b3e9a]={'$like':'%'+_0x52e059[_0x85bb('0x2f')]['filter']+'%'};return _0x2a5e32;})});}_0x1dc228=_[_0x85bb('0x3b')]({},_0x1dc228,_0x52e059['options']);return _0x23fe03['getConfigurations'](_0x1dc228);}})[_0x85bb('0x25')](function(_0x57e307){if(_0x57e307){_0x30b4a2=_0x57e307[_0x85bb('0x33')];if(!_0x52e059[_0x85bb('0x2f')][_0x85bb('0x34')](_0x85bb('0x49'))){_0x1dc228[_0x85bb('0x1d')]=qs[_0x85bb('0x1d')](_0x52e059[_0x85bb('0x2f')][_0x85bb('0x1d')]);_0x1dc228['offset']=qs[_0x85bb('0x1f')](_0x52e059[_0x85bb('0x2f')][_0x85bb('0x1f')]);}return _0x23fe03[_0x85bb('0x4a')](_0x1dc228);}})[_0x85bb('0x25')](function(_0x28154b){if(_0x28154b){return _0x28154b?{'count':_0x30b4a2,'rows':_0x28154b}:null;}})[_0x85bb('0x25')](respondWithResult(_0x1e750b,null))['catch'](handleError(_0x1e750b,null));};exports[_0x85bb('0x4b')]=function(_0x2ea019,_0x49b739,_0x27f699){if(_0x2ea019['body']['id']){delete _0x2ea019[_0x85bb('0x45')]['id'];}return db[_0x85bb('0x2a')][_0x85bb('0x47')]({'where':{'id':_0x2ea019[_0x85bb('0x46')]['id']}})[_0x85bb('0x25')](handleEntityNotFound(_0x49b739,null))[_0x85bb('0x25')](function(_0x435021){if(_0x435021){_0x2ea019[_0x85bb('0x45')][_0x85bb('0x4c')]=_0x435021['id'];_0x2ea019[_0x85bb('0x45')]['Subjects']=integrations['getSubjects'](_0x2ea019[_0x85bb('0x45')][_0x85bb('0x4d')],_0x2ea019['body'][_0x85bb('0x4e')]);_0x2ea019[_0x85bb('0x45')][_0x85bb('0x4f')]=integrations['getDescriptions'](_0x2ea019[_0x85bb('0x45')][_0x85bb('0x4d')],_0x2ea019['body']['type']);return db['ServicenowConfiguration'][_0x85bb('0x44')](_0x2ea019[_0x85bb('0x45')],{'include':[{'model':db[_0x85bb('0x50')],'as':_0x85bb('0x51')},{'model':db[_0x85bb('0x50')],'as':_0x85bb('0x4f')}]});}return null;})[_0x85bb('0x25')](respondWithResult(_0x49b739,null))[_0x85bb('0x40')](handleError(_0x49b739,null));};exports[_0x85bb('0x52')]=function(_0x3b91b2,_0x301e51,_0x12ef86){var _0x3258b2=['made_sla',_0x85bb('0x53'),'knowledge',_0x85bb('0x54'),_0x85bb('0x55'),'notify','incident_state','severity','category'];var _0x280939=[_0x85bb('0x56'),_0x85bb('0x57'),_0x85bb('0x58'),'watch_list',_0x85bb('0x59'),'sys_updated_on','child_incidents',_0x85bb('0x53'),_0x85bb('0x5a'),'number','resolved_by',_0x85bb('0x5b'),_0x85bb('0x5c'),_0x85bb('0x5d'),'sys_created_on',_0x85bb('0x5e'),'state',_0x85bb('0x5f'),_0x85bb('0x60'),'order',_0x85bb('0x61'),'closed_at','cmdb_ci',_0x85bb('0x62'),_0x85bb('0x63'),_0x85bb('0x64'),_0x85bb('0x65'),'business_service',_0x85bb('0x66'),_0x85bb('0x67'),_0x85bb('0x68'),'time_worked',_0x85bb('0x69'),_0x85bb('0x6a'),_0x85bb('0x6b'),_0x85bb('0x6c'),_0x85bb('0x6d'),'reopened_time',_0x85bb('0x6e'),_0x85bb('0x6f'),_0x85bb('0x70'),_0x85bb('0x54'),'work_notes',_0x85bb('0x71'),_0x85bb('0x55'),_0x85bb('0x72'),_0x85bb('0x73'),_0x85bb('0x74'),_0x85bb('0x75'),_0x85bb('0x76'),_0x85bb('0x77'),_0x85bb('0x78'),_0x85bb('0x79'),_0x85bb('0x7a'),'sys_class_name',_0x85bb('0x7b'),'closed_by','follow_up',_0x85bb('0x7c'),_0x85bb('0x7d'),_0x85bb('0x7e'),_0x85bb('0x7f'),_0x85bb('0x80'),_0x85bb('0x81'),'problem_id','company','reassignment_count',_0x85bb('0x82'),_0x85bb('0x83'),_0x85bb('0x84'),_0x85bb('0x85'),_0x85bb('0x86'),_0x85bb('0x87'),'comments_and_work_notes','due_date',_0x85bb('0x88'),'reopen_count',_0x85bb('0x89'),'escalation',_0x85bb('0x8a'),_0x85bb('0x8b'),_0x85bb('0x8c'),'category'];var _0x5d02a4='';var _0x25855d='';var _0x58000f=[];var _0x6ce08b='';var _0x18f005='';var _0x38f5e1=[];var _0x237e9f='';var _0x7d825d='';var _0x3c75ad={};var _0x5d82ea='';return db[_0x85bb('0x2a')]['findOne']({'where':{'id':_0x3b91b2['params']['id']},'attributes':['id',_0x85bb('0x8d'),'password',_0x85bb('0x8e'),_0x85bb('0x8f'),_0x85bb('0x90')]})['then'](handleEntityNotFound(_0x301e51,null))[_0x85bb('0x25')](function(_0x424f1c){if(_0x424f1c){_0x5d82ea=_0x424f1c[_0x85bb('0x8f')];var _0x338dc6=_0x5d82ea[_0x85bb('0x91')](-0x1);if(_0x338dc6==='/'){_0x5d82ea=_0x5d82ea[_0x85bb('0x92')](0x0,_0x5d82ea[_0x85bb('0x93')](_0x338dc6));}_0x7d825d=util[_0x85bb('0x94')](_0x85bb('0x95'),_0x5d82ea);_0x237e9f=util[_0x85bb('0x94')](_0x85bb('0x96'),_0x5d82ea);_0x3c75ad={'user':_0x424f1c[_0x85bb('0x8d')],'pass':_0x424f1c[_0x85bb('0x97')]};var _0x5ec4bd={'method':_0x85bb('0x98'),'uri':_0x7d825d+'incident?sysparm_display_value=all','auth':_0x3c75ad,'json':!![]};return rp(_0x5ec4bd);}})[_0x85bb('0x25')](function(_0x24cb88){if(_0x24cb88['result'][_0x85bb('0x33')]>0x0){_0x5d02a4=_0x24cb88[_0x85bb('0x99')];}console[_0x85bb('0x9a')](_0x85bb('0x9b'),_0x5d02a4);_0x38f5e1=[];_0x25855d=Object[_0x85bb('0x9c')]([],_0x5d02a4);_[_0x85bb('0x9d')](_0x25855d,function(_0x1bfb46){return!_0x3258b2['includes'](_0x1bfb46['name']);});_0x25855d[_0x85bb('0x9e')](function(_0x54a1e8){var _0x22058c=createFieldObject(_0x237e9f,_0x3c75ad,_0x54a1e8[_0x85bb('0x9f')],_0x54a1e8[_0x85bb('0x27')],_0x54a1e8[_0x85bb('0xa0')],![]);_0x38f5e1['push'](_0x22058c);});return Promise['all'](_0x38f5e1);})[_0x85bb('0x25')](function(_0x3d4a5c){_0x58000f=_0x3d4a5c;_0x6ce08b=Object[_0x85bb('0x9c')]([],_0x5d02a4);console[_0x85bb('0x9a')](_0x85bb('0xa1'),_0x5d02a4);_[_0x85bb('0x9d')](_0x6ce08b,function(_0x2b5713){return _0x280939[_0x85bb('0xa2')](_0x2b5713[_0x85bb('0x27')]);});console['log'](_0x85bb('0xa3'),_0x6ce08b);_0x38f5e1=[];_0x6ce08b['forEach'](function(_0x29bca1){var _0x3f43b2=createFieldObject(_0x237e9f,_0x3c75ad,_0x29bca1['internalType'],_0x29bca1['name'],_0x29bca1[_0x85bb('0xa0')],!![]);_0x38f5e1[_0x85bb('0xa4')](_0x3f43b2);});return Promise[_0x85bb('0xa5')](_0x38f5e1);})['then'](function(_0x149363){_0x18f005=_0x149363;var _0x1b060c=_0x58000f[_0x85bb('0xa6')](_0x18f005);return{'count':_0x1b060c['length'],'rows':_0x1b060c};})[_0x85bb('0x25')](respondWithResult(_0x301e51,null))[_0x85bb('0x40')](function(_0x453d6b){console[_0x85bb('0x9a')](_0x85bb('0xa7')+_0x453d6b);var _0x31fec7=_0x3b91b2['query']['test']?0x1f4:_0x453d6b[_0x85bb('0xa8')]||0x1f4;logger[_0x85bb('0xa9')](_0x453d6b[_0x85bb('0x26')]);delete _0x453d6b[_0x85bb('0x27')];if(_0x31fec7===0x191){_0x31fec7=0x190;}_0x301e51[_0x85bb('0x1a')](_0x31fec7)['send'](_0x3b91b2[_0x85bb('0x2f')][_0x85bb('0xaa')]?{'message':_0x85bb('0xab'),'statusCode':_0x453d6b[_0x85bb('0xa8')]}:_0x453d6b);});};function createFieldObject(_0x1d1840,_0x4cf90d,_0x1e55b6,_0x3500fc,_0x57fd5c,_0x4973fe){return new Promise(function(_0x531f74,_0x4e8d17){var _0x3f041={'id':_0x3500fc,'name':_0x57fd5c,'custom':_0x4973fe};if(_0x1e55b6===_0x85bb('0xac')){_0x3f041[_0x85bb('0x3c')]=[{'name':_0x85bb('0xad'),'value':_0x85bb('0xae')},{'name':'False','value':_0x85bb('0xaf')}];_0x531f74(_0x3f041);}else{var _0x5e54af={'method':_0x85bb('0x98'),'uri':_0x1d1840+_0x85bb('0xb0')+_0x3500fc,'auth':_0x4cf90d,'json':!![]};return rp(_0x5e54af)['then'](function(_0x185360){var _0x44ff21=[];if(_0x185360['result'][_0x85bb('0x33')]>0x0){_0x185360[_0x85bb('0x99')][_0x85bb('0x9e')](function(_0xff34c2){if(_0xff34c2[_0x85bb('0xb1')]===_0x85bb('0xaf')){var _0x340ed5={'name':_0xff34c2[_0x85bb('0xa0')],'value':_0xff34c2[_0x85bb('0xb2')]};_0x44ff21[_0x85bb('0xa4')](_0x340ed5);}});}_0x3f041[_0x85bb('0x3c')]=_0x44ff21;if(_0x3f041['options'][_0x85bb('0x33')]>0x0){_0x531f74(_0x3f041);}else{if(_0x4973fe==![]){_0x531f74();}else{_0x531f74(_0x3f041);}}});}});} \ No newline at end of file +var _0x640a=['lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','internalType','label','assign','TCL:\x20_object','remove','push','all','log','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','error','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','attributes','fields','length','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','filters','intersection','options','create','body','update','find','destroy','getConfigurations','ServicenowConfiguration','order','pick','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','email','remoteUri','slice','substring'];(function(_0x6282d1,_0x483c53){var _0xc01486=function(_0x4413f9){while(--_0x4413f9){_0x6282d1['push'](_0x6282d1['shift']());}};_0xc01486(++_0x483c53);}(_0x640a,0xd7));var _0xa640=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x640a[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xa640('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa640('0x1'));var jsonpatch=require(_0xa640('0x2'));var rp=require(_0xa640('0x3'));var moment=require('moment');var BPromise=require(_0xa640('0x4'));var Mustache=require('mustache');var util=require(_0xa640('0x5'));var path=require(_0xa640('0x6'));var sox=require('sox');var csv=require(_0xa640('0x7'));var ejs=require(_0xa640('0x8'));var fs=require('fs');var fs_extra=require(_0xa640('0x9'));var _=require('lodash');var squel=require(_0xa640('0xa'));var crypto=require(_0xa640('0xb'));var jsforce=require(_0xa640('0xc'));var deskjs=require(_0xa640('0xd'));var toCsv=require(_0xa640('0x7'));var querystring=require(_0xa640('0xe'));var Papa=require(_0xa640('0xf'));var Redis=require(_0xa640('0x10'));var authService=require(_0xa640('0x11'));var qs=require(_0xa640('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa640('0x13'))(_0xa640('0x14'));var utils=require(_0xa640('0x15'));var config=require(_0xa640('0x16'));var licenseUtil=require(_0xa640('0x17'));var db=require(_0xa640('0x18'))['db'];var integrations=require(_0xa640('0x19'));function respondWithStatusCode(_0x274add,_0x19fd0c){_0x19fd0c=_0x19fd0c||0xcc;return function(_0x753ec5){if(_0x753ec5){return _0x274add[_0xa640('0x1a')](_0x19fd0c);}return _0x274add[_0xa640('0x1b')](_0x19fd0c)[_0xa640('0x1c')]();};}function respondWithResult(_0x116dcf,_0x350e4e){_0x350e4e=_0x350e4e||0xc8;return function(_0x85683e){if(_0x85683e){return _0x116dcf[_0xa640('0x1b')](_0x350e4e)[_0xa640('0x1d')](_0x85683e);}};}function respondWithFilteredResult(_0x1dcfc7,_0x2a7e7e){return function(_0x3b5ad3){if(_0x3b5ad3){var _0x4522d7=typeof _0x2a7e7e['offset']===_0xa640('0x1e')&&typeof _0x2a7e7e[_0xa640('0x1f')]===_0xa640('0x1e');var _0x3ec303=_0x3b5ad3[_0xa640('0x20')];var _0x443a40=_0x4522d7?0x0:_0x2a7e7e[_0xa640('0x21')];var _0x4fec84=_0x4522d7?_0x3b5ad3['count']:_0x2a7e7e[_0xa640('0x21')]+_0x2a7e7e[_0xa640('0x1f')];var _0x22af90;if(_0x4fec84>=_0x3ec303){_0x4fec84=_0x3ec303;_0x22af90=0xc8;}else{_0x22af90=0xce;}_0x1dcfc7[_0xa640('0x1b')](_0x22af90);return _0x1dcfc7[_0xa640('0x22')]('Content-Range',_0x443a40+'-'+_0x4fec84+'/'+_0x3ec303)[_0xa640('0x1d')](_0x3b5ad3);}return null;};}function patchUpdates(_0x4e42e6){return function(_0x327258){try{jsonpatch[_0xa640('0x23')](_0x327258,_0x4e42e6,!![]);}catch(_0x58d87b){return BPromise[_0xa640('0x24')](_0x58d87b);}return _0x327258[_0xa640('0x25')]();};}function saveUpdates(_0xb9bafc,_0x41c229){return function(_0x29e514){if(_0x29e514){return _0x29e514['update'](_0xb9bafc)[_0xa640('0x26')](function(_0x533781){return _0x533781;});}return null;};}function removeEntity(_0x2cbb4a,_0xb3e5d0){return function(_0x46f4d8){if(_0x46f4d8){return _0x46f4d8['destroy']()[_0xa640('0x26')](function(){_0x2cbb4a[_0xa640('0x1b')](0xcc)[_0xa640('0x1c')]();});}};}function handleEntityNotFound(_0x3f293f,_0x45c16c){return function(_0x19d910){if(!_0x19d910){_0x3f293f[_0xa640('0x1a')](0x194);}return _0x19d910;};}function handleError(_0x248d38,_0x19da60){_0x19da60=_0x19da60||0x1f4;return function(_0x553b55){logger[_0xa640('0x27')](_0x553b55['stack']);if(_0x553b55[_0xa640('0x28')]){delete _0x553b55[_0xa640('0x28')];}_0x248d38[_0xa640('0x1b')](_0x19da60)[_0xa640('0x29')](_0x553b55);};}exports[_0xa640('0x2a')]=function(_0x114f86,_0x3979f5){var _0x391dec={},_0x3ad857={},_0x4901d3={'count':0x0,'rows':[]};var _0x30da01=_[_0xa640('0x2b')](db[_0xa640('0x2c')]['rawAttributes'],function(_0x3450e0){return{'name':_0x3450e0[_0xa640('0x2d')],'type':_0x3450e0[_0xa640('0x2e')][_0xa640('0x2f')]};});_0x3ad857[_0xa640('0x30')]=_[_0xa640('0x2b')](_0x30da01,_0xa640('0x28'));_0x3ad857[_0xa640('0x31')]=_[_0xa640('0x32')](_0x114f86[_0xa640('0x31')]);_0x3ad857['filters']=_['intersection'](_0x3ad857[_0xa640('0x30')],_0x3ad857[_0xa640('0x31')]);_0x391dec[_0xa640('0x33')]=_['intersection'](_0x3ad857[_0xa640('0x30')],qs[_0xa640('0x34')](_0x114f86[_0xa640('0x31')][_0xa640('0x34')]));_0x391dec[_0xa640('0x33')]=_0x391dec[_0xa640('0x33')][_0xa640('0x35')]?_0x391dec[_0xa640('0x33')]:_0x3ad857['model'];if(!_0x114f86['query']['hasOwnProperty']('nolimit')){_0x391dec[_0xa640('0x1f')]=qs[_0xa640('0x1f')](_0x114f86['query'][_0xa640('0x1f')]);_0x391dec['offset']=qs[_0xa640('0x21')](_0x114f86['query'][_0xa640('0x21')]);}_0x391dec['order']=qs[_0xa640('0x36')](_0x114f86[_0xa640('0x31')]['sort']);_0x391dec[_0xa640('0x37')]=qs['filters'](_['pick'](_0x114f86[_0xa640('0x31')],_0x3ad857['filters']),_0x30da01);if(_0x114f86[_0xa640('0x31')][_0xa640('0x38')]){_0x391dec[_0xa640('0x37')]=_[_0xa640('0x39')](_0x391dec[_0xa640('0x37')],{'$or':_['map'](_0x30da01,function(_0x31783d){if(_0x31783d[_0xa640('0x2e')]!=='VIRTUAL'){var _0x17bdee={};_0x17bdee[_0x31783d[_0xa640('0x28')]]={'$like':'%'+_0x114f86[_0xa640('0x31')][_0xa640('0x38')]+'%'};return _0x17bdee;}})});}_0x391dec=_['merge']({},_0x391dec,_0x114f86['options']);var _0x381756={'where':_0x391dec['where']};return db[_0xa640('0x2c')][_0xa640('0x20')](_0x381756)[_0xa640('0x26')](function(_0x3a335e){_0x4901d3[_0xa640('0x20')]=_0x3a335e;if(_0x114f86['query'][_0xa640('0x3a')]){_0x391dec[_0xa640('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa640('0x3c')](_0x391dec);})['then'](function(_0x23efed){_0x4901d3['rows']=_0x23efed;return _0x4901d3;})[_0xa640('0x26')](respondWithFilteredResult(_0x3979f5,_0x391dec))[_0xa640('0x3d')](handleError(_0x3979f5,null));};exports[_0xa640('0x3e')]=function(_0x9d83de,_0x2e4f16){var _0x6e91a6={'raw':![],'where':{'id':_0x9d83de[_0xa640('0x3f')]['id']}},_0x267d39={};_0x267d39[_0xa640('0x30')]=_['keys'](db[_0xa640('0x2c')][_0xa640('0x40')]);_0x267d39[_0xa640('0x31')]=_[_0xa640('0x32')](_0x9d83de['query']);_0x267d39[_0xa640('0x41')]=_[_0xa640('0x42')](_0x267d39[_0xa640('0x30')],_0x267d39[_0xa640('0x31')]);_0x6e91a6[_0xa640('0x33')]=_[_0xa640('0x42')](_0x267d39['model'],qs[_0xa640('0x34')](_0x9d83de[_0xa640('0x31')]['fields']));_0x6e91a6[_0xa640('0x33')]=_0x6e91a6[_0xa640('0x33')][_0xa640('0x35')]?_0x6e91a6[_0xa640('0x33')]:_0x267d39[_0xa640('0x30')];if(_0x9d83de['query'][_0xa640('0x3a')]){_0x6e91a6[_0xa640('0x3b')]=[{'all':!![]}];}_0x6e91a6=_['merge']({},_0x6e91a6,_0x9d83de[_0xa640('0x43')]);return db[_0xa640('0x2c')]['find'](_0x6e91a6)['then'](handleEntityNotFound(_0x2e4f16,null))[_0xa640('0x26')](respondWithResult(_0x2e4f16,null))[_0xa640('0x3d')](handleError(_0x2e4f16,null));};exports[_0xa640('0x44')]=function(_0x5ab6fd,_0xfe5a4){return db['ServicenowAccount'][_0xa640('0x44')](_0x5ab6fd[_0xa640('0x45')],{})[_0xa640('0x26')](respondWithResult(_0xfe5a4,0xc9))[_0xa640('0x3d')](handleError(_0xfe5a4,null));};exports[_0xa640('0x46')]=function(_0x89c548,_0x54181f){if(_0x89c548[_0xa640('0x45')]['id']){delete _0x89c548[_0xa640('0x45')]['id'];}return db[_0xa640('0x2c')][_0xa640('0x47')]({'where':{'id':_0x89c548[_0xa640('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54181f,null))[_0xa640('0x26')](saveUpdates(_0x89c548['body'],null))[_0xa640('0x26')](respondWithResult(_0x54181f,null))[_0xa640('0x3d')](handleError(_0x54181f,null));};exports[_0xa640('0x48')]=function(_0x165ea0,_0x2481a8){return db[_0xa640('0x2c')]['find']({'where':{'id':_0x165ea0[_0xa640('0x3f')]['id']}})[_0xa640('0x26')](handleEntityNotFound(_0x2481a8,null))['then'](removeEntity(_0x2481a8,null))[_0xa640('0x3d')](handleError(_0x2481a8,null));};exports[_0xa640('0x49')]=function(_0x1ca80f,_0x49e4eb,_0x2ca415){var _0x139c26={};var _0x2e7d3f={};var _0x4d3045;var _0x484f74;return db['ServicenowAccount']['findOne']({'where':{'id':_0x1ca80f[_0xa640('0x3f')]['id']}})['then'](handleEntityNotFound(_0x49e4eb,null))[_0xa640('0x26')](function(_0x5dab2d){if(_0x5dab2d){_0x4d3045=_0x5dab2d;_0x2e7d3f[_0xa640('0x30')]=_[_0xa640('0x32')](db[_0xa640('0x4a')][_0xa640('0x40')]);_0x2e7d3f[_0xa640('0x31')]=_[_0xa640('0x32')](_0x1ca80f['query']);_0x2e7d3f[_0xa640('0x41')]=_[_0xa640('0x42')](_0x2e7d3f[_0xa640('0x30')],_0x2e7d3f[_0xa640('0x31')]);_0x139c26[_0xa640('0x33')]=_[_0xa640('0x42')](_0x2e7d3f[_0xa640('0x30')],qs[_0xa640('0x34')](_0x1ca80f[_0xa640('0x31')][_0xa640('0x34')]));_0x139c26[_0xa640('0x33')]=_0x139c26[_0xa640('0x33')][_0xa640('0x35')]?_0x139c26[_0xa640('0x33')]:_0x2e7d3f[_0xa640('0x30')];_0x139c26[_0xa640('0x4b')]=qs[_0xa640('0x36')](_0x1ca80f[_0xa640('0x31')][_0xa640('0x36')]);_0x139c26['where']=qs[_0xa640('0x41')](_[_0xa640('0x4c')](_0x1ca80f[_0xa640('0x31')],_0x2e7d3f[_0xa640('0x41')]));if(_0x1ca80f[_0xa640('0x31')][_0xa640('0x38')]){_0x139c26[_0xa640('0x37')]=_[_0xa640('0x39')](_0x139c26['where'],{'$or':_[_0xa640('0x2b')](_0x139c26[_0xa640('0x33')],function(_0x53a751){var _0x5a55e1={};_0x5a55e1[_0x53a751]={'$like':'%'+_0x1ca80f['query'][_0xa640('0x38')]+'%'};return _0x5a55e1;})});}_0x139c26=_['merge']({},_0x139c26,_0x1ca80f[_0xa640('0x43')]);return _0x4d3045[_0xa640('0x49')](_0x139c26);}})[_0xa640('0x26')](function(_0x31cc2f){if(_0x31cc2f){_0x484f74=_0x31cc2f[_0xa640('0x35')];if(!_0x1ca80f[_0xa640('0x31')][_0xa640('0x4d')](_0xa640('0x4e'))){_0x139c26[_0xa640('0x1f')]=qs[_0xa640('0x1f')](_0x1ca80f[_0xa640('0x31')][_0xa640('0x1f')]);_0x139c26['offset']=qs[_0xa640('0x21')](_0x1ca80f['query']['offset']);}return _0x4d3045['getConfigurations'](_0x139c26);}})[_0xa640('0x26')](function(_0x3893a7){if(_0x3893a7){return _0x3893a7?{'count':_0x484f74,'rows':_0x3893a7}:null;}})[_0xa640('0x26')](respondWithResult(_0x49e4eb,null))[_0xa640('0x3d')](handleError(_0x49e4eb,null));};exports['addConfiguration']=function(_0x32f607,_0x4d7d4a,_0x2c215f){if(_0x32f607[_0xa640('0x45')]['id']){delete _0x32f607['body']['id'];}return db['ServicenowAccount'][_0xa640('0x4f')]({'where':{'id':_0x32f607['params']['id']}})[_0xa640('0x26')](handleEntityNotFound(_0x4d7d4a,null))[_0xa640('0x26')](function(_0x5b158b){if(_0x5b158b){_0x32f607[_0xa640('0x45')][_0xa640('0x50')]=_0x5b158b['id'];_0x32f607['body'][_0xa640('0x51')]=integrations[_0xa640('0x52')](_0x32f607['body']['channel'],_0x32f607[_0xa640('0x45')][_0xa640('0x2e')]);_0x32f607[_0xa640('0x45')][_0xa640('0x53')]=integrations[_0xa640('0x54')](_0x32f607[_0xa640('0x45')][_0xa640('0x55')],_0x32f607[_0xa640('0x45')]['type']);return db[_0xa640('0x4a')]['create'](_0x32f607[_0xa640('0x45')],{'include':[{'model':db[_0xa640('0x56')],'as':_0xa640('0x51')},{'model':db[_0xa640('0x56')],'as':_0xa640('0x53')}]});}return null;})[_0xa640('0x26')](respondWithResult(_0x4d7d4a,null))[_0xa640('0x3d')](handleError(_0x4d7d4a,null));};exports['getFields']=function(_0x57c10c,_0x45f71d,_0x4dcdff){var _0xfec0c3=[_0xa640('0x57'),_0xa640('0x58'),_0xa640('0x59'),_0xa640('0x5a'),'close_code',_0xa640('0x5b'),_0xa640('0x5c'),_0xa640('0x5d'),_0xa640('0x5e')];var _0x272524=['parent',_0xa640('0x57'),'caused_by','watch_list',_0xa640('0x5f'),_0xa640('0x60'),'child_incidents',_0xa640('0x58'),_0xa640('0x61'),_0xa640('0x62'),'resolved_by',_0xa640('0x63'),_0xa640('0x64'),_0xa640('0x65'),'sys_created_on','sys_domain','state',_0xa640('0x66'),_0xa640('0x59'),'order',_0xa640('0x67'),'closed_at','cmdb_ci',_0xa640('0x68'),_0xa640('0x69'),_0xa640('0x6a'),_0xa640('0x6b'),'business_service',_0xa640('0x6c'),_0xa640('0x6d'),'rfc',_0xa640('0x6e'),_0xa640('0x6f'),'opened_at','business_duration',_0xa640('0x70'),_0xa640('0x71'),_0xa640('0x72'),_0xa640('0x73'),_0xa640('0x74'),_0xa640('0x75'),'subcategory',_0xa640('0x76'),_0xa640('0x77'),_0xa640('0x78'),_0xa640('0x79'),_0xa640('0x7a'),_0xa640('0x7b'),'assignment_group',_0xa640('0x7c'),_0xa640('0x7d'),_0xa640('0x7e'),'calendar_duration',_0xa640('0x5b'),_0xa640('0x7f'),_0xa640('0x80'),_0xa640('0x81'),_0xa640('0x82'),_0xa640('0x83'),_0xa640('0x84'),_0xa640('0x85'),_0xa640('0x86'),_0xa640('0x5c'),_0xa640('0x87'),'problem_id',_0xa640('0x88'),'reassignment_count','activity_due',_0xa640('0x89'),_0xa640('0x5d'),_0xa640('0x8a'),_0xa640('0x8b'),_0xa640('0x8c'),'comments_and_work_notes',_0xa640('0x8d'),_0xa640('0x8e'),_0xa640('0x8f'),_0xa640('0x90'),_0xa640('0x91'),'upon_approval',_0xa640('0x92'),_0xa640('0x93'),_0xa640('0x5e')];var _0x51a811='';var _0x46aa6='';var _0x49e3a5=[];var _0x759da9='';var _0x483d01='';var _0x56c3b3=[];var _0x4161f0='';var _0x5059c7='';var _0x56f925={};var _0x3c3fad='';return db['ServicenowAccount'][_0xa640('0x4f')]({'where':{'id':_0x57c10c[_0xa640('0x3f')]['id']},'attributes':['id','username',_0xa640('0x94'),_0xa640('0x95'),_0xa640('0x96'),'serverUrl']})[_0xa640('0x26')](handleEntityNotFound(_0x45f71d,null))[_0xa640('0x26')](function(_0x3eebbc){if(_0x3eebbc){_0x3c3fad=_0x3eebbc[_0xa640('0x96')];var _0x65fad6=_0x3c3fad[_0xa640('0x97')](-0x1);if(_0x65fad6==='/'){_0x3c3fad=_0x3c3fad[_0xa640('0x98')](0x0,_0x3c3fad[_0xa640('0x99')](_0x65fad6));}_0x5059c7=util['format'](_0xa640('0x9a'),_0x3c3fad);_0x4161f0=util[_0xa640('0x9b')](_0xa640('0x9c'),_0x3c3fad);_0x56f925={'user':_0x3eebbc[_0xa640('0x9d')],'pass':_0x3eebbc[_0xa640('0x94')]};var _0xdc32c6={'method':_0xa640('0x9e'),'uri':_0x5059c7+_0xa640('0x9f'),'auth':_0x56f925,'json':!![]};return rp(_0xdc32c6);}})[_0xa640('0x26')](function(_0x362c35){if(_0x362c35[_0xa640('0xa0')][_0xa640('0x35')]>0x0){_0x51a811=_0x362c35[_0xa640('0xa0')];}console['log'](_0xa640('0xa1'),_0x51a811);_0x56c3b3=[];_0x46aa6=Object['assign']([],_0x51a811);_['remove'](_0x46aa6,function(_0x5ef5f4){return!_0xfec0c3[_0xa640('0xa2')](_0x5ef5f4[_0xa640('0x28')]);});_0x46aa6[_0xa640('0xa3')](function(_0x135f9e){var _0xf452d6=createFieldObject(_0x4161f0,_0x56f925,_0x135f9e[_0xa640('0xa4')],_0x135f9e[_0xa640('0x28')],_0x135f9e[_0xa640('0xa5')],![]);_0x56c3b3['push'](_0xf452d6);});return Promise['all'](_0x56c3b3);})['then'](function(_0x4e0a13){_0x49e3a5=_0x4e0a13;_0x759da9=Object[_0xa640('0xa6')]([],_0x51a811);console['log'](_0xa640('0xa7'),_0x51a811);_[_0xa640('0xa8')](_0x759da9,function(_0x4cb50b){return _0x272524['includes'](_0x4cb50b['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x759da9);_0x56c3b3=[];_0x759da9['forEach'](function(_0xb684eb){var _0x514811=createFieldObject(_0x4161f0,_0x56f925,_0xb684eb[_0xa640('0xa4')],_0xb684eb['name'],_0xb684eb['label'],!![]);_0x56c3b3[_0xa640('0xa9')](_0x514811);});return Promise[_0xa640('0xaa')](_0x56c3b3);})[_0xa640('0x26')](function(_0x20ffc8){_0x483d01=_0x20ffc8;var _0x3315e9=_0x49e3a5['concat'](_0x483d01);return{'count':_0x3315e9[_0xa640('0x35')],'rows':_0x3315e9};})[_0xa640('0x26')](respondWithResult(_0x45f71d,null))['catch'](function(_0x3b3579){console[_0xa640('0xab')]('ServiceNow\x20error:\x20'+_0x3b3579);var _0x5ed7d1=_0x57c10c[_0xa640('0x31')][_0xa640('0xac')]?0x1f4:_0x3b3579[_0xa640('0xad')]||0x1f4;logger[_0xa640('0x27')](_0x3b3579[_0xa640('0xae')]);delete _0x3b3579['name'];if(_0x5ed7d1===0x191){_0x5ed7d1=0x190;}_0x45f71d['status'](_0x5ed7d1)['send'](_0x57c10c[_0xa640('0x31')][_0xa640('0xac')]?{'message':_0xa640('0xaf'),'statusCode':_0x3b3579[_0xa640('0xad')]}:_0x3b3579);});};function createFieldObject(_0x59d39,_0x316e82,_0x3ebb05,_0x5d763e,_0x9640dd,_0x4c7fcb){return new Promise(function(_0x57985b,_0x17f5e3){var _0xc4b22={'id':_0x5d763e,'name':_0x9640dd,'custom':_0x4c7fcb};if(_0x3ebb05===_0xa640('0xb0')){_0xc4b22[_0xa640('0x43')]=[{'name':_0xa640('0xb1'),'value':_0xa640('0xb2')},{'name':_0xa640('0xb3'),'value':_0xa640('0xb4')}];_0x57985b(_0xc4b22);}else{var _0x529619={'method':_0xa640('0x9e'),'uri':_0x59d39+_0xa640('0xb5')+_0x5d763e,'auth':_0x316e82,'json':!![]};return rp(_0x529619)['then'](function(_0x7061f0){var _0x595371=[];if(_0x7061f0[_0xa640('0xa0')][_0xa640('0x35')]>0x0){_0x7061f0[_0xa640('0xa0')][_0xa640('0xa3')](function(_0x36c0d9){if(_0x36c0d9[_0xa640('0xb6')]===_0xa640('0xb4')){var _0x55db3b={'name':_0x36c0d9['label'],'value':_0x36c0d9[_0xa640('0xb7')]};_0x595371['push'](_0x55db3b);}});}_0xc4b22[_0xa640('0x43')]=_0x595371;if(_0xc4b22[_0xa640('0x43')][_0xa640('0x35')]>0x0){_0x57985b(_0xc4b22);}else{if(_0x4c7fcb==![]){_0x57985b();}else{_0x57985b(_0xc4b22);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f898391..abed48b 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x326f,0xd1));var _0xf326=function(_0x4d7f44,_0x1a160c){_0x4d7f44=_0x4d7f44-0x0;var _0x3596ad=_0x326f[_0x4d7f44];return _0x3596ad;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));var integrations=require(_0xf326('0x9'));module[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return _0x4c2249[_0xf326('0xb')](_0xf326('0xc'),attributes,{'tableName':_0xf326('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x519d77,_0x4e758e){var _0x56e79d=function(_0x10744e){while(--_0x10744e){_0x519d77['push'](_0x519d77['shift']());}};_0x56e79d(++_0x4e758e);}(_0x1883,0xab));var _0x3188=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0x1883[_0x380016];return _0x5c7ac0;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 1577db4..32f6e43 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 _0x54ce=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','find','ShowServicenowAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s'];(function(_0x140577,_0x470b73){var _0x1fee74=function(_0xb5d45d){while(--_0xb5d45d){_0x140577['push'](_0x140577['shift']());}};_0x1fee74(++_0x470b73);}(_0x54ce,0xd4));var _0xe54c=function(_0x5c1ba1,_0x39847c){_0x5c1ba1=_0x5c1ba1-0x0;var _0xaa7b9=_0x54ce[_0x5c1ba1];return _0xaa7b9;};'use strict';var _=require(_0xe54c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe54c('0x1'));var rs=require(_0xe54c('0x2'));var fs=require('fs');var Redis=require(_0xe54c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe54c('0x4'));var logger=require('../../config/logger')(_0xe54c('0x5'));var config=require(_0xe54c('0x6'));var jayson=require(_0xe54c('0x7'));var client=jayson[_0xe54c('0x8')][_0xe54c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3debf6,_0x4ba21e,_0x2c7260){return new BPromise(function(_0x1db404,_0x1987b7){return client['request'](_0x3debf6,_0x2c7260)[_0xe54c('0xa')](function(_0x1884fd){logger['info'](_0xe54c('0xb'),_0x4ba21e,_0xe54c('0xc'));logger[_0xe54c('0xd')](_0xe54c('0xe'),_0x4ba21e,_0xe54c('0xc'),JSON['stringify'](_0x1884fd));if(_0x1884fd[_0xe54c('0xf')]){if(_0x1884fd[_0xe54c('0xf')]['code']===0x1f4){logger[_0xe54c('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x4ba21e,_0x1884fd[_0xe54c('0xf')]['message']);return _0x1987b7(_0x1884fd[_0xe54c('0xf')][_0xe54c('0x10')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4ba21e,_0x1884fd['error'][_0xe54c('0x10')]);return _0x1db404(_0x1884fd[_0xe54c('0xf')]['message']);}else{logger[_0xe54c('0x11')](_0xe54c('0xb'),_0x4ba21e,_0xe54c('0xc'));_0x1db404(_0x1884fd['result']['message']);}})[_0xe54c('0x12')](function(_0x268291){logger[_0xe54c('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x4ba21e,_0x268291);_0x1987b7(_0x268291);});});}exports[_0xe54c('0x13')]=function(_0x581009){var _0x41703d=this;return new Promise(function(_0xe3f570,_0x3d1602){return db[_0xe54c('0x14')][_0xe54c('0x15')]({'raw':_0x581009[_0xe54c('0x16')]?_0x581009[_0xe54c('0x16')][_0xe54c('0x17')]===undefined?!![]:![]:!![],'where':_0x581009[_0xe54c('0x16')]?_0x581009[_0xe54c('0x16')]['where']||null:null,'attributes':_0x581009[_0xe54c('0x16')]?_0x581009[_0xe54c('0x16')][_0xe54c('0x18')]||null:null,'limit':_0x581009[_0xe54c('0x16')]?_0x581009[_0xe54c('0x16')][_0xe54c('0x19')]||null:null,'include':_0x581009[_0xe54c('0x16')]?_0x581009['options']['include']?_[_0xe54c('0x1a')](_0x581009[_0xe54c('0x16')][_0xe54c('0x1b')],function(_0x67246){return{'model':db[_0x67246[_0xe54c('0x1c')]],'as':_0x67246['as'],'attributes':_0x67246['attributes'],'include':_0x67246[_0xe54c('0x1b')]?_[_0xe54c('0x1a')](_0x67246['include'],function(_0x4ba067){return{'model':db[_0x4ba067[_0xe54c('0x1c')]],'as':_0x4ba067['as'],'attributes':_0x4ba067['attributes'],'include':_0x4ba067['include']?_[_0xe54c('0x1a')](_0x4ba067[_0xe54c('0x1b')],function(_0x6dde38){return{'model':db[_0x6dde38['model']],'as':_0x6dde38['as'],'attributes':_0x6dde38[_0xe54c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47103f){logger['info'](_0xe54c('0x13'),_0x581009);logger[_0xe54c('0xd')](_0xe54c('0x13'),_0x581009,JSON[_0xe54c('0x1d')](_0x47103f));_0xe3f570(_0x47103f);})[_0xe54c('0x12')](function(_0xaebd20){logger[_0xe54c('0xf')]('GetServicenowAccount',_0xaebd20[_0xe54c('0x10')],_0x581009);_0x3d1602(_0x41703d['error'](0x1f4,_0xaebd20['message']));});});};exports['ShowServicenowAccount']=function(_0xee278d){var _0x32ffe8=this;return new Promise(function(_0xff48b,_0x532ff6){return db[_0xe54c('0x14')][_0xe54c('0x1e')]({'raw':_0xee278d[_0xe54c('0x16')]?_0xee278d['options'][_0xe54c('0x17')]===undefined?!![]:![]:!![],'where':_0xee278d[_0xe54c('0x16')]?_0xee278d[_0xe54c('0x16')]['where']||null:null,'attributes':_0xee278d['options']?_0xee278d[_0xe54c('0x16')]['attributes']||null:null,'include':_0xee278d['options']?_0xee278d[_0xe54c('0x16')][_0xe54c('0x1b')]?_[_0xe54c('0x1a')](_0xee278d[_0xe54c('0x16')][_0xe54c('0x1b')],function(_0x1bab47){return{'model':db[_0x1bab47[_0xe54c('0x1c')]],'as':_0x1bab47['as'],'attributes':_0x1bab47[_0xe54c('0x18')],'include':_0x1bab47[_0xe54c('0x1b')]?_[_0xe54c('0x1a')](_0x1bab47[_0xe54c('0x1b')],function(_0x2fcb16){return{'model':db[_0x2fcb16[_0xe54c('0x1c')]],'as':_0x2fcb16['as'],'attributes':_0x2fcb16[_0xe54c('0x18')],'include':_0x2fcb16[_0xe54c('0x1b')]?_[_0xe54c('0x1a')](_0x2fcb16[_0xe54c('0x1b')],function(_0x1bed2c){return{'model':db[_0x1bed2c[_0xe54c('0x1c')]],'as':_0x1bed2c['as'],'attributes':_0x1bed2c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe54c('0xa')](function(_0xd7cbad){logger[_0xe54c('0x11')](_0xe54c('0x1f'),_0xee278d);logger[_0xe54c('0xd')]('ShowServicenowAccount',_0xee278d,JSON[_0xe54c('0x1d')](_0xd7cbad));_0xff48b(_0xd7cbad);})[_0xe54c('0x12')](function(_0x4b1636){logger[_0xe54c('0xf')](_0xe54c('0x1f'),_0x4b1636[_0xe54c('0x10')],_0xee278d);_0x532ff6(_0x32ffe8[_0xe54c('0xf')](0x1f4,_0x4b1636['message']));});});}; \ No newline at end of file +var _0x2484=['model','attributes','ShowServicenowAccount','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x2484,0x6e));var _0x4248=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x2484[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0x4248('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4248('0x1'));var rs=require(_0x4248('0x2'));var fs=require('fs');var Redis=require(_0x4248('0x3'));var db=require(_0x4248('0x4'))['db'];var utils=require(_0x4248('0x5'));var logger=require('../../config/logger')(_0x4248('0x6'));var config=require(_0x4248('0x7'));var jayson=require(_0x4248('0x8'));var client=jayson[_0x4248('0x9')][_0x4248('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c701,_0x468682,_0x4fa55b){return new BPromise(function(_0x21d87d,_0x1fe3f6){return client['request'](_0x51c701,_0x4fa55b)[_0x4248('0xb')](function(_0x5c7406){logger[_0x4248('0xc')](_0x4248('0xd'),_0x468682,'request\x20sent');logger[_0x4248('0xe')](_0x4248('0xf'),_0x468682,'request\x20sent',JSON[_0x4248('0x10')](_0x5c7406));if(_0x5c7406[_0x4248('0x11')]){if(_0x5c7406[_0x4248('0x11')]['code']===0x1f4){logger['error'](_0x4248('0xd'),_0x468682,_0x5c7406['error'][_0x4248('0x12')]);return _0x1fe3f6(_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);}logger[_0x4248('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x468682,_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);return _0x21d87d(_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);}else{logger[_0x4248('0xc')](_0x4248('0xd'),_0x468682,_0x4248('0x13'));_0x21d87d(_0x5c7406[_0x4248('0x14')]['message']);}})[_0x4248('0x15')](function(_0x25bbef){logger[_0x4248('0x11')](_0x4248('0xd'),_0x468682,_0x25bbef);_0x1fe3f6(_0x25bbef);});});}exports[_0x4248('0x16')]=function(_0x3a2b72){var _0x351051=this;return new Promise(function(_0x35bb0d,_0x31b10e){return db[_0x4248('0x17')][_0x4248('0x18')]({'raw':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72['options']['where']||null:null,'attributes':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72['options']['attributes']||null:null,'limit':_0x3a2b72['options']?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1b')]||null:null,'include':_0x3a2b72['options']?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1c')]?_[_0x4248('0x1d')](_0x3a2b72[_0x4248('0x19')]['include'],function(_0x43aa1f){return{'model':db[_0x43aa1f['model']],'as':_0x43aa1f['as'],'attributes':_0x43aa1f['attributes'],'include':_0x43aa1f[_0x4248('0x1c')]?_['map'](_0x43aa1f[_0x4248('0x1c')],function(_0x1072af){return{'model':db[_0x1072af[_0x4248('0x1e')]],'as':_0x1072af['as'],'attributes':_0x1072af[_0x4248('0x1f')],'include':_0x1072af[_0x4248('0x1c')]?_['map'](_0x1072af[_0x4248('0x1c')],function(_0x1ada15){return{'model':db[_0x1ada15[_0x4248('0x1e')]],'as':_0x1ada15['as'],'attributes':_0x1ada15[_0x4248('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4248('0xb')](function(_0x50d6cf){logger[_0x4248('0xc')](_0x4248('0x16'),_0x3a2b72);logger[_0x4248('0xe')]('GetServicenowAccount',_0x3a2b72,JSON['stringify'](_0x50d6cf));_0x35bb0d(_0x50d6cf);})['catch'](function(_0x190b68){logger[_0x4248('0x11')]('GetServicenowAccount',_0x190b68['message'],_0x3a2b72);_0x31b10e(_0x351051[_0x4248('0x11')](0x1f4,_0x190b68[_0x4248('0x12')]));});});};exports[_0x4248('0x20')]=function(_0x3df4b6){var _0x3700eb=this;return new Promise(function(_0x2c1233,_0x5e5bb4){return db[_0x4248('0x17')][_0x4248('0x21')]({'raw':_0x3df4b6['options']?_0x3df4b6['options'][_0x4248('0x1a')]===undefined?!![]:![]:!![],'where':_0x3df4b6['options']?_0x3df4b6[_0x4248('0x19')][_0x4248('0x22')]||null:null,'attributes':_0x3df4b6['options']?_0x3df4b6['options'][_0x4248('0x1f')]||null:null,'include':_0x3df4b6[_0x4248('0x19')]?_0x3df4b6['options'][_0x4248('0x1c')]?_['map'](_0x3df4b6[_0x4248('0x19')][_0x4248('0x1c')],function(_0x4b7a74){return{'model':db[_0x4b7a74[_0x4248('0x1e')]],'as':_0x4b7a74['as'],'attributes':_0x4b7a74[_0x4248('0x1f')],'include':_0x4b7a74[_0x4248('0x1c')]?_[_0x4248('0x1d')](_0x4b7a74[_0x4248('0x1c')],function(_0x10a5d3){return{'model':db[_0x10a5d3[_0x4248('0x1e')]],'as':_0x10a5d3['as'],'attributes':_0x10a5d3[_0x4248('0x1f')],'include':_0x10a5d3[_0x4248('0x1c')]?_[_0x4248('0x1d')](_0x10a5d3['include'],function(_0x35dac2){return{'model':db[_0x35dac2['model']],'as':_0x35dac2['as'],'attributes':_0x35dac2[_0x4248('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4248('0xb')](function(_0x4795b7){logger[_0x4248('0xc')](_0x4248('0x20'),_0x3df4b6);logger[_0x4248('0xe')](_0x4248('0x20'),_0x3df4b6,JSON[_0x4248('0x10')](_0x4795b7));_0x2c1233(_0x4795b7);})[_0x4248('0x15')](function(_0x415e48){logger[_0x4248('0x11')](_0x4248('0x20'),_0x415e48[_0x4248('0x12')],_0x3df4b6);_0x5e5bb4(_0x3700eb[_0x4248('0x11')](0x1f4,_0x415e48[_0x4248('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b32d3a6..e3cfcd2 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 _0x30be=['update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','post','create','put'];(function(_0x512978,_0xf18ee){var _0x28b88b=function(_0x342b9f){while(--_0x342b9f){_0x512978['push'](_0x512978['shift']());}};_0x28b88b(++_0xf18ee);}(_0x30be,0x1bb));var _0xe30b=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x30be[_0x553502];return _0x246c37;};'use strict';var multer=require(_0xe30b('0x0'));var util=require(_0xe30b('0x1'));var path=require('path');var timeout=require(_0xe30b('0x2'));var express=require(_0xe30b('0x3'));var router=express['Router']();var fs_extra=require(_0xe30b('0x4'));var auth=require(_0xe30b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe30b('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xe30b('0x7')](),controller[_0xe30b('0x8')]);router[_0xe30b('0x9')](_0xe30b('0xa'),auth[_0xe30b('0x7')](),controller['show']);router[_0xe30b('0x9')](_0xe30b('0xb'),auth[_0xe30b('0x7')](),controller[_0xe30b('0xc')]);router['get'](_0xe30b('0xd'),auth[_0xe30b('0x7')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xe30b('0x7')](),controller['getDescriptions']);router[_0xe30b('0xe')]('/',auth[_0xe30b('0x7')](),controller[_0xe30b('0xf')]);router[_0xe30b('0x10')](_0xe30b('0xa'),auth[_0xe30b('0x7')](),controller[_0xe30b('0x11')]);router['delete'](_0xe30b('0xa'),auth['isAuthenticated'](),controller[_0xe30b('0x12')]);module[_0xe30b('0x13')]=router; \ No newline at end of file +var _0x00cd=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','exports'];(function(_0x2f6fd8,_0x1f019d){var _0x60d49c=function(_0x183f5b){while(--_0x183f5b){_0x2f6fd8['push'](_0x2f6fd8['shift']());}};_0x60d49c(++_0x1f019d);}(_0x00cd,0x8a));var _0xd00c=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x00cd[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0xd00c('0x0'));var util=require('util');var path=require(_0xd00c('0x1'));var timeout=require(_0xd00c('0x2'));var express=require(_0xd00c('0x3'));var router=express[_0xd00c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd00c('0x5'));var interaction=require(_0xd00c('0x6'));var config=require(_0xd00c('0x7'));var controller=require(_0xd00c('0x8'));router[_0xd00c('0x9')]('/',auth[_0xd00c('0xa')](),controller[_0xd00c('0xb')]);router[_0xd00c('0x9')](_0xd00c('0xc'),auth['isAuthenticated'](),controller[_0xd00c('0xd')]);router['get']('/:id/fields',auth[_0xd00c('0xa')](),controller[_0xd00c('0xe')]);router[_0xd00c('0x9')](_0xd00c('0xf'),auth[_0xd00c('0xa')](),controller['getSubjects']);router['get'](_0xd00c('0x10'),auth['isAuthenticated'](),controller[_0xd00c('0x11')]);router[_0xd00c('0x12')]('/',auth[_0xd00c('0xa')](),controller[_0xd00c('0x13')]);router[_0xd00c('0x14')]('/:id',auth[_0xd00c('0xa')](),controller[_0xd00c('0x15')]);router['delete'](_0xd00c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd00c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ab0a765..5a3967c 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 _0x593e=['STRING','sequelize','exports'];(function(_0x3d73bd,_0xf47cb6){var _0x364402=function(_0x3a6e6d){while(--_0x3a6e6d){_0x3d73bd['push'](_0x3d73bd['shift']());}};_0x364402(++_0xf47cb6);}(_0x593e,0x97));var _0xe593=function(_0x385271,_0x76d053){_0x385271=_0x385271-0x0;var _0x4e8507=_0x593e[_0x385271];return _0x4e8507;};'use strict';var Sequelize=require(_0xe593('0x0'));module[_0xe593('0x1')]={'name':{'type':Sequelize[_0xe593('0x2')]},'description':{'type':Sequelize[_0xe593('0x2')]}}; \ No newline at end of file +var _0xb4f1=['exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4f1,0x1f0));var _0x1b4f=function(_0x2a18d9,_0x421a90){_0x2a18d9=_0x2a18d9-0x0;var _0x31b144=_0xb4f1[_0x2a18d9];return _0x31b144;};'use strict';var Sequelize=require('sequelize');module[_0x1b4f('0x0')]={'name':{'type':Sequelize[_0x1b4f('0x1')]},'description':{'type':Sequelize[_0x1b4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7e13dd0..b9831b3 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 _0x5ceb=['path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','map','options','ServicenowConfiguration','findAll','rows','catch','params','intersection','include','create','body','find','getFields','ServicenowField','pick','nolimit','getSubjects','findOne','getDescriptions','order','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x155b14,_0x1fcfa9){var _0x135ccb=function(_0x2a5e77){while(--_0x2a5e77){_0x155b14['push'](_0x155b14['shift']());}};_0x135ccb(++_0x1fcfa9);}(_0x5ceb,0x18e));var _0xb5ce=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x5ceb[_0x2d89ce];return _0x3fad10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5ce('0x0'));var zipdir=require(_0xb5ce('0x1'));var jsonpatch=require(_0xb5ce('0x2'));var rp=require('request-promise');var moment=require(_0xb5ce('0x3'));var BPromise=require(_0xb5ce('0x4'));var Mustache=require(_0xb5ce('0x5'));var util=require(_0xb5ce('0x6'));var path=require(_0xb5ce('0x7'));var sox=require(_0xb5ce('0x8'));var csv=require(_0xb5ce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5ce('0xa'));var _=require(_0xb5ce('0xb'));var squel=require('squel');var crypto=require(_0xb5ce('0xc'));var jsforce=require(_0xb5ce('0xd'));var deskjs=require(_0xb5ce('0xe'));var toCsv=require(_0xb5ce('0x9'));var querystring=require(_0xb5ce('0xf'));var Papa=require(_0xb5ce('0x10'));var Redis=require('ioredis');var authService=require(_0xb5ce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb5ce('0x12'));var hardwareService=require(_0xb5ce('0x13'));var logger=require(_0xb5ce('0x14'))(_0xb5ce('0x15'));var utils=require(_0xb5ce('0x16'));var config=require(_0xb5ce('0x17'));var licenseUtil=require(_0xb5ce('0x18'));var db=require(_0xb5ce('0x19'))['db'];function respondWithStatusCode(_0x4b035a,_0x35f473){_0x35f473=_0x35f473||0xcc;return function(_0x54c6fb){if(_0x54c6fb){return _0x4b035a['sendStatus'](_0x35f473);}return _0x4b035a[_0xb5ce('0x1a')](_0x35f473)[_0xb5ce('0x1b')]();};}function respondWithResult(_0x2ddccf,_0x522b8d){_0x522b8d=_0x522b8d||0xc8;return function(_0x47bdd3){if(_0x47bdd3){return _0x2ddccf[_0xb5ce('0x1a')](_0x522b8d)['json'](_0x47bdd3);}};}function respondWithFilteredResult(_0x1d8d6b,_0x5c7183){return function(_0x452575){if(_0x452575){var _0x216ea7=typeof _0x5c7183[_0xb5ce('0x1c')]===_0xb5ce('0x1d')&&typeof _0x5c7183[_0xb5ce('0x1e')]===_0xb5ce('0x1d');var _0x55d3aa=_0x452575[_0xb5ce('0x1f')];var _0x966474=_0x216ea7?0x0:_0x5c7183['offset'];var _0x401637=_0x216ea7?_0x452575[_0xb5ce('0x1f')]:_0x5c7183[_0xb5ce('0x1c')]+_0x5c7183[_0xb5ce('0x1e')];var _0x2ae6f3;if(_0x401637>=_0x55d3aa){_0x401637=_0x55d3aa;_0x2ae6f3=0xc8;}else{_0x2ae6f3=0xce;}_0x1d8d6b[_0xb5ce('0x1a')](_0x2ae6f3);return _0x1d8d6b[_0xb5ce('0x20')](_0xb5ce('0x21'),_0x966474+'-'+_0x401637+'/'+_0x55d3aa)[_0xb5ce('0x22')](_0x452575);}return null;};}function patchUpdates(_0x1f8ed1){return function(_0xf51bb5){try{jsonpatch['apply'](_0xf51bb5,_0x1f8ed1,!![]);}catch(_0x33e567){return BPromise[_0xb5ce('0x23')](_0x33e567);}return _0xf51bb5[_0xb5ce('0x24')]();};}function saveUpdates(_0x450912,_0x2dd94b){return function(_0x5a6cfc){if(_0x5a6cfc){return _0x5a6cfc[_0xb5ce('0x25')](_0x450912)['then'](function(_0x1d4d0a){return _0x1d4d0a;});}return null;};}function removeEntity(_0x342eb7,_0xc4e923){return function(_0x49255f){if(_0x49255f){return _0x49255f[_0xb5ce('0x26')]()[_0xb5ce('0x27')](function(){_0x342eb7[_0xb5ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9635b5,_0x505e27){return function(_0x23fd23){if(!_0x23fd23){_0x9635b5[_0xb5ce('0x28')](0x194);}return _0x23fd23;};}function handleError(_0x349634,_0x2e2bde){_0x2e2bde=_0x2e2bde||0x1f4;return function(_0x3748f3){logger[_0xb5ce('0x29')](_0x3748f3[_0xb5ce('0x2a')]);if(_0x3748f3[_0xb5ce('0x2b')]){delete _0x3748f3[_0xb5ce('0x2b')];}_0x349634['status'](_0x2e2bde)['send'](_0x3748f3);};}exports[_0xb5ce('0x2c')]=function(_0x299a67,_0x167d75){var _0x1b9a16={},_0x32bf72={},_0x3fe3f8={'count':0x0,'rows':[]};var _0x5764d4=_['map'](db['ServicenowConfiguration'][_0xb5ce('0x2d')],function(_0x162646){return{'name':_0x162646[_0xb5ce('0x2e')],'type':_0x162646[_0xb5ce('0x2f')][_0xb5ce('0x30')]};});_0x32bf72['model']=_['map'](_0x5764d4,_0xb5ce('0x2b'));_0x32bf72[_0xb5ce('0x31')]=_[_0xb5ce('0x32')](_0x299a67[_0xb5ce('0x31')]);_0x32bf72[_0xb5ce('0x33')]=_['intersection'](_0x32bf72[_0xb5ce('0x34')],_0x32bf72['query']);_0x1b9a16['attributes']=_['intersection'](_0x32bf72['model'],qs[_0xb5ce('0x35')](_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x35')]));_0x1b9a16[_0xb5ce('0x36')]=_0x1b9a16[_0xb5ce('0x36')][_0xb5ce('0x37')]?_0x1b9a16[_0xb5ce('0x36')]:_0x32bf72[_0xb5ce('0x34')];if(!_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x38')]('nolimit')){_0x1b9a16['limit']=qs[_0xb5ce('0x1e')](_0x299a67[_0xb5ce('0x31')]['limit']);_0x1b9a16['offset']=qs['offset'](_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x1c')]);}_0x1b9a16['order']=qs[_0xb5ce('0x39')](_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x39')]);_0x1b9a16[_0xb5ce('0x3a')]=qs[_0xb5ce('0x33')](_['pick'](_0x299a67[_0xb5ce('0x31')],_0x32bf72[_0xb5ce('0x33')]),_0x5764d4);if(_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x3b')]){_0x1b9a16[_0xb5ce('0x3a')]=_[_0xb5ce('0x3c')](_0x1b9a16[_0xb5ce('0x3a')],{'$or':_[_0xb5ce('0x3d')](_0x5764d4,function(_0x52bd48){if(_0x52bd48[_0xb5ce('0x2f')]!=='VIRTUAL'){var _0x5041f1={};_0x5041f1[_0x52bd48[_0xb5ce('0x2b')]]={'$like':'%'+_0x299a67[_0xb5ce('0x31')][_0xb5ce('0x3b')]+'%'};return _0x5041f1;}})});}_0x1b9a16=_[_0xb5ce('0x3c')]({},_0x1b9a16,_0x299a67[_0xb5ce('0x3e')]);var _0x402a8f={'where':_0x1b9a16[_0xb5ce('0x3a')]};return db['ServicenowConfiguration'][_0xb5ce('0x1f')](_0x402a8f)[_0xb5ce('0x27')](function(_0x15b3fc){_0x3fe3f8[_0xb5ce('0x1f')]=_0x15b3fc;if(_0x299a67[_0xb5ce('0x31')]['includeAll']){_0x1b9a16['include']=[{'all':!![]}];}return db[_0xb5ce('0x3f')][_0xb5ce('0x40')](_0x1b9a16);})[_0xb5ce('0x27')](function(_0x5a2e81){_0x3fe3f8[_0xb5ce('0x41')]=_0x5a2e81;return _0x3fe3f8;})['then'](respondWithFilteredResult(_0x167d75,_0x1b9a16))[_0xb5ce('0x42')](handleError(_0x167d75,null));};exports['show']=function(_0x3fb20b,_0x3ab8cc){var _0x347689={'raw':![],'where':{'id':_0x3fb20b[_0xb5ce('0x43')]['id']}},_0x5b326e={};_0x5b326e['model']=_['keys'](db['ServicenowConfiguration'][_0xb5ce('0x2d')]);_0x5b326e[_0xb5ce('0x31')]=_[_0xb5ce('0x32')](_0x3fb20b[_0xb5ce('0x31')]);_0x5b326e[_0xb5ce('0x33')]=_[_0xb5ce('0x44')](_0x5b326e[_0xb5ce('0x34')],_0x5b326e[_0xb5ce('0x31')]);_0x347689[_0xb5ce('0x36')]=_[_0xb5ce('0x44')](_0x5b326e['model'],qs[_0xb5ce('0x35')](_0x3fb20b[_0xb5ce('0x31')][_0xb5ce('0x35')]));_0x347689['attributes']=_0x347689[_0xb5ce('0x36')][_0xb5ce('0x37')]?_0x347689['attributes']:_0x5b326e[_0xb5ce('0x34')];if(_0x3fb20b[_0xb5ce('0x31')]['includeAll']){_0x347689[_0xb5ce('0x45')]=[{'all':!![]}];}_0x347689=_[_0xb5ce('0x3c')]({},_0x347689,_0x3fb20b[_0xb5ce('0x3e')]);return db[_0xb5ce('0x3f')]['find'](_0x347689)[_0xb5ce('0x27')](handleEntityNotFound(_0x3ab8cc,null))[_0xb5ce('0x27')](respondWithResult(_0x3ab8cc,null))[_0xb5ce('0x42')](handleError(_0x3ab8cc,null));};exports[_0xb5ce('0x46')]=function(_0x4c668e,_0x2fcba1){return db[_0xb5ce('0x3f')]['create'](_0x4c668e[_0xb5ce('0x47')],{})[_0xb5ce('0x27')](respondWithResult(_0x2fcba1,0xc9))[_0xb5ce('0x42')](handleError(_0x2fcba1,null));};exports[_0xb5ce('0x25')]=function(_0x1bcd72,_0x5a12ff){if(_0x1bcd72[_0xb5ce('0x47')]['id']){delete _0x1bcd72['body']['id'];}return db[_0xb5ce('0x3f')][_0xb5ce('0x48')]({'where':{'id':_0x1bcd72['params']['id']}})[_0xb5ce('0x27')](handleEntityNotFound(_0x5a12ff,null))['then'](saveUpdates(_0x1bcd72[_0xb5ce('0x47')],null))['then'](respondWithResult(_0x5a12ff,null))['catch'](handleError(_0x5a12ff,null));};exports[_0xb5ce('0x26')]=function(_0x5a8ab8,_0x15d81a){return db[_0xb5ce('0x3f')][_0xb5ce('0x48')]({'where':{'id':_0x5a8ab8[_0xb5ce('0x43')]['id']}})[_0xb5ce('0x27')](handleEntityNotFound(_0x15d81a,null))['then'](removeEntity(_0x15d81a,null))[_0xb5ce('0x42')](handleError(_0x15d81a,null));};exports[_0xb5ce('0x49')]=function(_0x45a68b,_0x26d37a,_0xed9726){var _0x3f82a={};var _0x142c06={};var _0x2119fb;var _0x4153ee;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x45a68b[_0xb5ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x26d37a,null))[_0xb5ce('0x27')](function(_0x20e647){if(_0x20e647){_0x2119fb=_0x20e647;_0x142c06[_0xb5ce('0x34')]=_[_0xb5ce('0x32')](db[_0xb5ce('0x4a')][_0xb5ce('0x2d')]);_0x142c06[_0xb5ce('0x31')]=_[_0xb5ce('0x32')](_0x45a68b[_0xb5ce('0x31')]);_0x142c06['filters']=_['intersection'](_0x142c06['model'],_0x142c06[_0xb5ce('0x31')]);_0x3f82a[_0xb5ce('0x36')]=_[_0xb5ce('0x44')](_0x142c06[_0xb5ce('0x34')],qs['fields'](_0x45a68b[_0xb5ce('0x31')][_0xb5ce('0x35')]));_0x3f82a[_0xb5ce('0x36')]=_0x3f82a['attributes']['length']?_0x3f82a[_0xb5ce('0x36')]:_0x142c06[_0xb5ce('0x34')];_0x3f82a['order']=qs[_0xb5ce('0x39')](_0x45a68b[_0xb5ce('0x31')]['sort']);_0x3f82a[_0xb5ce('0x3a')]=qs[_0xb5ce('0x33')](_[_0xb5ce('0x4b')](_0x45a68b[_0xb5ce('0x31')],_0x142c06[_0xb5ce('0x33')]));if(_0x45a68b[_0xb5ce('0x31')][_0xb5ce('0x3b')]){_0x3f82a[_0xb5ce('0x3a')]=_[_0xb5ce('0x3c')](_0x3f82a[_0xb5ce('0x3a')],{'$or':_[_0xb5ce('0x3d')](_0x3f82a[_0xb5ce('0x36')],function(_0x20567d){var _0x3c9f07={};_0x3c9f07[_0x20567d]={'$like':'%'+_0x45a68b['query']['filter']+'%'};return _0x3c9f07;})});}_0x3f82a=_[_0xb5ce('0x3c')]({},_0x3f82a,_0x45a68b[_0xb5ce('0x3e')]);return _0x2119fb[_0xb5ce('0x49')](_0x3f82a);}})[_0xb5ce('0x27')](function(_0x5df886){if(_0x5df886){_0x4153ee=_0x5df886[_0xb5ce('0x37')];if(!_0x45a68b[_0xb5ce('0x31')][_0xb5ce('0x38')](_0xb5ce('0x4c'))){_0x3f82a['limit']=qs[_0xb5ce('0x1e')](_0x45a68b[_0xb5ce('0x31')][_0xb5ce('0x1e')]);_0x3f82a[_0xb5ce('0x1c')]=qs[_0xb5ce('0x1c')](_0x45a68b['query'][_0xb5ce('0x1c')]);}return _0x2119fb[_0xb5ce('0x49')](_0x3f82a);}})['then'](function(_0x3e494e){if(_0x3e494e){return _0x3e494e?{'count':_0x4153ee,'rows':_0x3e494e}:null;}})['then'](respondWithResult(_0x26d37a,null))[_0xb5ce('0x42')](handleError(_0x26d37a,null));};exports[_0xb5ce('0x4d')]=function(_0x212fc5,_0x57c8e8,_0x1a8eef){var _0x514387={};var _0x591eda={};var _0x1e637b;var _0x1d74e2;return db[_0xb5ce('0x3f')][_0xb5ce('0x4e')]({'where':{'id':_0x212fc5[_0xb5ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x57c8e8,null))['then'](function(_0x1397e1){if(_0x1397e1){_0x1e637b=_0x1397e1;_0x591eda['model']=_['keys'](db[_0xb5ce('0x4a')][_0xb5ce('0x2d')]);_0x591eda['query']=_[_0xb5ce('0x32')](_0x212fc5[_0xb5ce('0x31')]);_0x591eda[_0xb5ce('0x33')]=_[_0xb5ce('0x44')](_0x591eda['model'],_0x591eda[_0xb5ce('0x31')]);_0x514387[_0xb5ce('0x36')]=_[_0xb5ce('0x44')](_0x591eda[_0xb5ce('0x34')],qs[_0xb5ce('0x35')](_0x212fc5[_0xb5ce('0x31')]['fields']));_0x514387['attributes']=_0x514387['attributes'][_0xb5ce('0x37')]?_0x514387['attributes']:_0x591eda[_0xb5ce('0x34')];_0x514387['order']=qs['sort'](_0x212fc5[_0xb5ce('0x31')]['sort']);_0x514387[_0xb5ce('0x3a')]=qs['filters'](_[_0xb5ce('0x4b')](_0x212fc5[_0xb5ce('0x31')],_0x591eda['filters']));if(_0x212fc5[_0xb5ce('0x31')][_0xb5ce('0x3b')]){_0x514387['where']=_[_0xb5ce('0x3c')](_0x514387[_0xb5ce('0x3a')],{'$or':_[_0xb5ce('0x3d')](_0x514387[_0xb5ce('0x36')],function(_0x263142){var _0x146a67={};_0x146a67[_0x263142]={'$like':'%'+_0x212fc5[_0xb5ce('0x31')][_0xb5ce('0x3b')]+'%'};return _0x146a67;})});}_0x514387=_[_0xb5ce('0x3c')]({},_0x514387,_0x212fc5[_0xb5ce('0x3e')]);return _0x1e637b[_0xb5ce('0x4d')](_0x514387);}})[_0xb5ce('0x27')](function(_0x41bbf4){if(_0x41bbf4){_0x1d74e2=_0x41bbf4[_0xb5ce('0x37')];if(!_0x212fc5[_0xb5ce('0x31')][_0xb5ce('0x38')](_0xb5ce('0x4c'))){_0x514387[_0xb5ce('0x1e')]=qs[_0xb5ce('0x1e')](_0x212fc5['query']['limit']);_0x514387[_0xb5ce('0x1c')]=qs[_0xb5ce('0x1c')](_0x212fc5[_0xb5ce('0x31')][_0xb5ce('0x1c')]);}return _0x1e637b[_0xb5ce('0x4d')](_0x514387);}})[_0xb5ce('0x27')](function(_0x16f4ab){if(_0x16f4ab){return _0x16f4ab?{'count':_0x1d74e2,'rows':_0x16f4ab}:null;}})[_0xb5ce('0x27')](respondWithResult(_0x57c8e8,null))[_0xb5ce('0x42')](handleError(_0x57c8e8,null));};exports[_0xb5ce('0x4f')]=function(_0x1c9e2b,_0x4a0c8f,_0x135b7f){var _0x523b5c={};var _0x294f67={};var _0xe00c2b;var _0x9f270b;return db[_0xb5ce('0x3f')][_0xb5ce('0x4e')]({'where':{'id':_0x1c9e2b[_0xb5ce('0x43')]['id']}})[_0xb5ce('0x27')](handleEntityNotFound(_0x4a0c8f,null))['then'](function(_0x5aac17){if(_0x5aac17){_0xe00c2b=_0x5aac17;_0x294f67[_0xb5ce('0x34')]=_[_0xb5ce('0x32')](db[_0xb5ce('0x4a')][_0xb5ce('0x2d')]);_0x294f67[_0xb5ce('0x31')]=_[_0xb5ce('0x32')](_0x1c9e2b['query']);_0x294f67[_0xb5ce('0x33')]=_[_0xb5ce('0x44')](_0x294f67[_0xb5ce('0x34')],_0x294f67[_0xb5ce('0x31')]);_0x523b5c[_0xb5ce('0x36')]=_[_0xb5ce('0x44')](_0x294f67[_0xb5ce('0x34')],qs[_0xb5ce('0x35')](_0x1c9e2b[_0xb5ce('0x31')]['fields']));_0x523b5c[_0xb5ce('0x36')]=_0x523b5c[_0xb5ce('0x36')][_0xb5ce('0x37')]?_0x523b5c[_0xb5ce('0x36')]:_0x294f67['model'];_0x523b5c[_0xb5ce('0x50')]=qs['sort'](_0x1c9e2b[_0xb5ce('0x31')]['sort']);_0x523b5c[_0xb5ce('0x3a')]=qs['filters'](_['pick'](_0x1c9e2b['query'],_0x294f67[_0xb5ce('0x33')]));if(_0x1c9e2b[_0xb5ce('0x31')]['filter']){_0x523b5c[_0xb5ce('0x3a')]=_['merge'](_0x523b5c['where'],{'$or':_[_0xb5ce('0x3d')](_0x523b5c[_0xb5ce('0x36')],function(_0x1c8b31){var _0x1440cf={};_0x1440cf[_0x1c8b31]={'$like':'%'+_0x1c9e2b[_0xb5ce('0x31')][_0xb5ce('0x3b')]+'%'};return _0x1440cf;})});}_0x523b5c=_['merge']({},_0x523b5c,_0x1c9e2b[_0xb5ce('0x3e')]);return _0xe00c2b[_0xb5ce('0x4f')](_0x523b5c);}})[_0xb5ce('0x27')](function(_0x43c936){if(_0x43c936){_0x9f270b=_0x43c936[_0xb5ce('0x37')];if(!_0x1c9e2b[_0xb5ce('0x31')][_0xb5ce('0x38')](_0xb5ce('0x4c'))){_0x523b5c[_0xb5ce('0x1e')]=qs[_0xb5ce('0x1e')](_0x1c9e2b[_0xb5ce('0x31')][_0xb5ce('0x1e')]);_0x523b5c[_0xb5ce('0x1c')]=qs['offset'](_0x1c9e2b[_0xb5ce('0x31')][_0xb5ce('0x1c')]);}return _0xe00c2b[_0xb5ce('0x4f')](_0x523b5c);}})[_0xb5ce('0x27')](function(_0x211a61){if(_0x211a61){return _0x211a61?{'count':_0x9f270b,'rows':_0x211a61}:null;}})['then'](respondWithResult(_0x4a0c8f,null))[_0xb5ce('0x42')](handleError(_0x4a0c8f,null));}; \ No newline at end of file +var _0x750a=['findAll','rows','catch','show','params','filters','length','options','find','create','body','getFields','ServicenowField','getSubjects','getDescriptions','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x750a,0x1bf));var _0xa750=function(_0x62a56f,_0x4cedeb){_0x62a56f=_0x62a56f-0x0;var _0x156be0=_0x750a[_0x62a56f];return _0x156be0;};'use strict';var emlformat=require(_0xa750('0x0'));var rimraf=require(_0xa750('0x1'));var zipdir=require(_0xa750('0x2'));var jsonpatch=require(_0xa750('0x3'));var rp=require(_0xa750('0x4'));var moment=require(_0xa750('0x5'));var BPromise=require(_0xa750('0x6'));var Mustache=require(_0xa750('0x7'));var util=require(_0xa750('0x8'));var path=require(_0xa750('0x9'));var sox=require(_0xa750('0xa'));var csv=require('to-csv');var ejs=require(_0xa750('0xb'));var fs=require('fs');var fs_extra=require(_0xa750('0xc'));var _=require(_0xa750('0xd'));var squel=require('squel');var crypto=require(_0xa750('0xe'));var jsforce=require(_0xa750('0xf'));var deskjs=require(_0xa750('0x10'));var toCsv=require(_0xa750('0x11'));var querystring=require(_0xa750('0x12'));var Papa=require(_0xa750('0x13'));var Redis=require(_0xa750('0x14'));var authService=require(_0xa750('0x15'));var qs=require(_0xa750('0x16'));var as=require(_0xa750('0x17'));var hardwareService=require(_0xa750('0x18'));var logger=require(_0xa750('0x19'))(_0xa750('0x1a'));var utils=require(_0xa750('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa750('0x1c'))['db'];function respondWithStatusCode(_0x1ab78a,_0x4fe535){_0x4fe535=_0x4fe535||0xcc;return function(_0x504ceb){if(_0x504ceb){return _0x1ab78a[_0xa750('0x1d')](_0x4fe535);}return _0x1ab78a[_0xa750('0x1e')](_0x4fe535)['end']();};}function respondWithResult(_0x532abb,_0x4ea928){_0x4ea928=_0x4ea928||0xc8;return function(_0x4c9430){if(_0x4c9430){return _0x532abb[_0xa750('0x1e')](_0x4ea928)[_0xa750('0x1f')](_0x4c9430);}};}function respondWithFilteredResult(_0x3ce51c,_0x88bcc8){return function(_0x32d893){if(_0x32d893){var _0x200860=typeof _0x88bcc8[_0xa750('0x20')]===_0xa750('0x21')&&typeof _0x88bcc8['limit']===_0xa750('0x21');var _0x4c72cb=_0x32d893[_0xa750('0x22')];var _0x5b0a38=_0x200860?0x0:_0x88bcc8[_0xa750('0x20')];var _0x543f62=_0x200860?_0x32d893[_0xa750('0x22')]:_0x88bcc8[_0xa750('0x20')]+_0x88bcc8[_0xa750('0x23')];var _0x3b0416;if(_0x543f62>=_0x4c72cb){_0x543f62=_0x4c72cb;_0x3b0416=0xc8;}else{_0x3b0416=0xce;}_0x3ce51c[_0xa750('0x1e')](_0x3b0416);return _0x3ce51c[_0xa750('0x24')](_0xa750('0x25'),_0x5b0a38+'-'+_0x543f62+'/'+_0x4c72cb)['json'](_0x32d893);}return null;};}function patchUpdates(_0x46f92d){return function(_0x74a97f){try{jsonpatch[_0xa750('0x26')](_0x74a97f,_0x46f92d,!![]);}catch(_0x1b026c){return BPromise[_0xa750('0x27')](_0x1b026c);}return _0x74a97f[_0xa750('0x28')]();};}function saveUpdates(_0x20f64,_0x3bad14){return function(_0xbd3c4b){if(_0xbd3c4b){return _0xbd3c4b[_0xa750('0x29')](_0x20f64)[_0xa750('0x2a')](function(_0x327f35){return _0x327f35;});}return null;};}function removeEntity(_0x325f73,_0x28588f){return function(_0x29b18a){if(_0x29b18a){return _0x29b18a[_0xa750('0x2b')]()[_0xa750('0x2a')](function(){_0x325f73[_0xa750('0x1e')](0xcc)[_0xa750('0x2c')]();});}};}function handleEntityNotFound(_0x2b254d,_0x59a6a3){return function(_0x4b9ccb){if(!_0x4b9ccb){_0x2b254d[_0xa750('0x1d')](0x194);}return _0x4b9ccb;};}function handleError(_0x8463bc,_0x1815f8){_0x1815f8=_0x1815f8||0x1f4;return function(_0x4e4c9a){logger[_0xa750('0x2d')](_0x4e4c9a[_0xa750('0x2e')]);if(_0x4e4c9a[_0xa750('0x2f')]){delete _0x4e4c9a[_0xa750('0x2f')];}_0x8463bc[_0xa750('0x1e')](_0x1815f8)['send'](_0x4e4c9a);};}exports[_0xa750('0x30')]=function(_0x5a7708,_0x25c449){var _0x135153={},_0x447376={},_0xdbd8ca={'count':0x0,'rows':[]};var _0x482fb4=_['map'](db[_0xa750('0x31')][_0xa750('0x32')],function(_0x10c615){return{'name':_0x10c615[_0xa750('0x33')],'type':_0x10c615[_0xa750('0x34')]['key']};});_0x447376[_0xa750('0x35')]=_[_0xa750('0x36')](_0x482fb4,_0xa750('0x2f'));_0x447376[_0xa750('0x37')]=_[_0xa750('0x38')](_0x5a7708['query']);_0x447376['filters']=_[_0xa750('0x39')](_0x447376[_0xa750('0x35')],_0x447376['query']);_0x135153[_0xa750('0x3a')]=_[_0xa750('0x39')](_0x447376['model'],qs[_0xa750('0x3b')](_0x5a7708[_0xa750('0x37')][_0xa750('0x3b')]));_0x135153[_0xa750('0x3a')]=_0x135153['attributes']['length']?_0x135153[_0xa750('0x3a')]:_0x447376[_0xa750('0x35')];if(!_0x5a7708[_0xa750('0x37')]['hasOwnProperty'](_0xa750('0x3c'))){_0x135153['limit']=qs['limit'](_0x5a7708['query'][_0xa750('0x23')]);_0x135153[_0xa750('0x20')]=qs[_0xa750('0x20')](_0x5a7708[_0xa750('0x37')][_0xa750('0x20')]);}_0x135153[_0xa750('0x3d')]=qs[_0xa750('0x3e')](_0x5a7708[_0xa750('0x37')][_0xa750('0x3e')]);_0x135153['where']=qs['filters'](_[_0xa750('0x3f')](_0x5a7708[_0xa750('0x37')],_0x447376['filters']),_0x482fb4);if(_0x5a7708[_0xa750('0x37')][_0xa750('0x40')]){_0x135153[_0xa750('0x41')]=_['merge'](_0x135153[_0xa750('0x41')],{'$or':_[_0xa750('0x36')](_0x482fb4,function(_0x1c53e2){if(_0x1c53e2['type']!=='VIRTUAL'){var _0x918c06={};_0x918c06[_0x1c53e2[_0xa750('0x2f')]]={'$like':'%'+_0x5a7708[_0xa750('0x37')][_0xa750('0x40')]+'%'};return _0x918c06;}})});}_0x135153=_[_0xa750('0x42')]({},_0x135153,_0x5a7708['options']);var _0x429a50={'where':_0x135153[_0xa750('0x41')]};return db[_0xa750('0x31')][_0xa750('0x22')](_0x429a50)[_0xa750('0x2a')](function(_0x56aafd){_0xdbd8ca['count']=_0x56aafd;if(_0x5a7708['query'][_0xa750('0x43')]){_0x135153[_0xa750('0x44')]=[{'all':!![]}];}return db[_0xa750('0x31')][_0xa750('0x45')](_0x135153);})[_0xa750('0x2a')](function(_0x5e9832){_0xdbd8ca[_0xa750('0x46')]=_0x5e9832;return _0xdbd8ca;})[_0xa750('0x2a')](respondWithFilteredResult(_0x25c449,_0x135153))[_0xa750('0x47')](handleError(_0x25c449,null));};exports[_0xa750('0x48')]=function(_0x55c7e1,_0xb821ab){var _0x27a18c={'raw':![],'where':{'id':_0x55c7e1[_0xa750('0x49')]['id']}},_0x2b8f70={};_0x2b8f70[_0xa750('0x35')]=_['keys'](db[_0xa750('0x31')]['rawAttributes']);_0x2b8f70[_0xa750('0x37')]=_[_0xa750('0x38')](_0x55c7e1[_0xa750('0x37')]);_0x2b8f70[_0xa750('0x4a')]=_[_0xa750('0x39')](_0x2b8f70[_0xa750('0x35')],_0x2b8f70['query']);_0x27a18c[_0xa750('0x3a')]=_[_0xa750('0x39')](_0x2b8f70[_0xa750('0x35')],qs[_0xa750('0x3b')](_0x55c7e1[_0xa750('0x37')][_0xa750('0x3b')]));_0x27a18c[_0xa750('0x3a')]=_0x27a18c[_0xa750('0x3a')][_0xa750('0x4b')]?_0x27a18c[_0xa750('0x3a')]:_0x2b8f70[_0xa750('0x35')];if(_0x55c7e1[_0xa750('0x37')]['includeAll']){_0x27a18c['include']=[{'all':!![]}];}_0x27a18c=_[_0xa750('0x42')]({},_0x27a18c,_0x55c7e1[_0xa750('0x4c')]);return db[_0xa750('0x31')][_0xa750('0x4d')](_0x27a18c)[_0xa750('0x2a')](handleEntityNotFound(_0xb821ab,null))[_0xa750('0x2a')](respondWithResult(_0xb821ab,null))[_0xa750('0x47')](handleError(_0xb821ab,null));};exports[_0xa750('0x4e')]=function(_0x4aae68,_0x338475){return db[_0xa750('0x31')][_0xa750('0x4e')](_0x4aae68['body'],{})['then'](respondWithResult(_0x338475,0xc9))[_0xa750('0x47')](handleError(_0x338475,null));};exports[_0xa750('0x29')]=function(_0x4f45a8,_0x4637f7){if(_0x4f45a8['body']['id']){delete _0x4f45a8[_0xa750('0x4f')]['id'];}return db[_0xa750('0x31')][_0xa750('0x4d')]({'where':{'id':_0x4f45a8[_0xa750('0x49')]['id']}})[_0xa750('0x2a')](handleEntityNotFound(_0x4637f7,null))[_0xa750('0x2a')](saveUpdates(_0x4f45a8[_0xa750('0x4f')],null))['then'](respondWithResult(_0x4637f7,null))['catch'](handleError(_0x4637f7,null));};exports[_0xa750('0x2b')]=function(_0x1d5a12,_0xfba583){return db[_0xa750('0x31')]['find']({'where':{'id':_0x1d5a12[_0xa750('0x49')]['id']}})[_0xa750('0x2a')](handleEntityNotFound(_0xfba583,null))['then'](removeEntity(_0xfba583,null))['catch'](handleError(_0xfba583,null));};exports[_0xa750('0x50')]=function(_0x2663a1,_0x46e254,_0x3aaa30){var _0x86eaa={};var _0x373255={};var _0x532f22;var _0x12469b;return db[_0xa750('0x31')]['findOne']({'where':{'id':_0x2663a1[_0xa750('0x49')]['id']}})[_0xa750('0x2a')](handleEntityNotFound(_0x46e254,null))['then'](function(_0x45cbaf){if(_0x45cbaf){_0x532f22=_0x45cbaf;_0x373255[_0xa750('0x35')]=_[_0xa750('0x38')](db[_0xa750('0x51')][_0xa750('0x32')]);_0x373255['query']=_[_0xa750('0x38')](_0x2663a1[_0xa750('0x37')]);_0x373255[_0xa750('0x4a')]=_['intersection'](_0x373255[_0xa750('0x35')],_0x373255[_0xa750('0x37')]);_0x86eaa[_0xa750('0x3a')]=_[_0xa750('0x39')](_0x373255[_0xa750('0x35')],qs[_0xa750('0x3b')](_0x2663a1[_0xa750('0x37')][_0xa750('0x3b')]));_0x86eaa['attributes']=_0x86eaa['attributes'][_0xa750('0x4b')]?_0x86eaa[_0xa750('0x3a')]:_0x373255[_0xa750('0x35')];_0x86eaa[_0xa750('0x3d')]=qs[_0xa750('0x3e')](_0x2663a1[_0xa750('0x37')]['sort']);_0x86eaa['where']=qs[_0xa750('0x4a')](_[_0xa750('0x3f')](_0x2663a1[_0xa750('0x37')],_0x373255['filters']));if(_0x2663a1[_0xa750('0x37')][_0xa750('0x40')]){_0x86eaa[_0xa750('0x41')]=_[_0xa750('0x42')](_0x86eaa[_0xa750('0x41')],{'$or':_[_0xa750('0x36')](_0x86eaa['attributes'],function(_0x31c53c){var _0x29a95c={};_0x29a95c[_0x31c53c]={'$like':'%'+_0x2663a1[_0xa750('0x37')]['filter']+'%'};return _0x29a95c;})});}_0x86eaa=_[_0xa750('0x42')]({},_0x86eaa,_0x2663a1[_0xa750('0x4c')]);return _0x532f22[_0xa750('0x50')](_0x86eaa);}})['then'](function(_0x122dc8){if(_0x122dc8){_0x12469b=_0x122dc8['length'];if(!_0x2663a1[_0xa750('0x37')]['hasOwnProperty']('nolimit')){_0x86eaa[_0xa750('0x23')]=qs[_0xa750('0x23')](_0x2663a1['query'][_0xa750('0x23')]);_0x86eaa['offset']=qs['offset'](_0x2663a1['query'][_0xa750('0x20')]);}return _0x532f22['getFields'](_0x86eaa);}})['then'](function(_0x3a11d9){if(_0x3a11d9){return _0x3a11d9?{'count':_0x12469b,'rows':_0x3a11d9}:null;}})[_0xa750('0x2a')](respondWithResult(_0x46e254,null))[_0xa750('0x47')](handleError(_0x46e254,null));};exports[_0xa750('0x52')]=function(_0x195cf9,_0x29b871,_0x8000c1){var _0x5080e0={};var _0x3eaae2={};var _0x4dd48c;var _0x58d11b;return db[_0xa750('0x31')]['findOne']({'where':{'id':_0x195cf9[_0xa750('0x49')]['id']}})[_0xa750('0x2a')](handleEntityNotFound(_0x29b871,null))[_0xa750('0x2a')](function(_0x78ffc2){if(_0x78ffc2){_0x4dd48c=_0x78ffc2;_0x3eaae2['model']=_[_0xa750('0x38')](db[_0xa750('0x51')][_0xa750('0x32')]);_0x3eaae2['query']=_[_0xa750('0x38')](_0x195cf9['query']);_0x3eaae2['filters']=_[_0xa750('0x39')](_0x3eaae2[_0xa750('0x35')],_0x3eaae2['query']);_0x5080e0[_0xa750('0x3a')]=_[_0xa750('0x39')](_0x3eaae2[_0xa750('0x35')],qs[_0xa750('0x3b')](_0x195cf9[_0xa750('0x37')]['fields']));_0x5080e0[_0xa750('0x3a')]=_0x5080e0['attributes'][_0xa750('0x4b')]?_0x5080e0[_0xa750('0x3a')]:_0x3eaae2[_0xa750('0x35')];_0x5080e0[_0xa750('0x3d')]=qs['sort'](_0x195cf9[_0xa750('0x37')][_0xa750('0x3e')]);_0x5080e0[_0xa750('0x41')]=qs['filters'](_[_0xa750('0x3f')](_0x195cf9[_0xa750('0x37')],_0x3eaae2[_0xa750('0x4a')]));if(_0x195cf9['query'][_0xa750('0x40')]){_0x5080e0[_0xa750('0x41')]=_[_0xa750('0x42')](_0x5080e0['where'],{'$or':_[_0xa750('0x36')](_0x5080e0[_0xa750('0x3a')],function(_0x3ad08c){var _0x5ddeb2={};_0x5ddeb2[_0x3ad08c]={'$like':'%'+_0x195cf9['query']['filter']+'%'};return _0x5ddeb2;})});}_0x5080e0=_['merge']({},_0x5080e0,_0x195cf9['options']);return _0x4dd48c[_0xa750('0x52')](_0x5080e0);}})[_0xa750('0x2a')](function(_0x6ba70){if(_0x6ba70){_0x58d11b=_0x6ba70[_0xa750('0x4b')];if(!_0x195cf9[_0xa750('0x37')]['hasOwnProperty'](_0xa750('0x3c'))){_0x5080e0[_0xa750('0x23')]=qs[_0xa750('0x23')](_0x195cf9[_0xa750('0x37')][_0xa750('0x23')]);_0x5080e0[_0xa750('0x20')]=qs[_0xa750('0x20')](_0x195cf9[_0xa750('0x37')][_0xa750('0x20')]);}return _0x4dd48c[_0xa750('0x52')](_0x5080e0);}})[_0xa750('0x2a')](function(_0x315109){if(_0x315109){return _0x315109?{'count':_0x58d11b,'rows':_0x315109}:null;}})[_0xa750('0x2a')](respondWithResult(_0x29b871,null))[_0xa750('0x47')](handleError(_0x29b871,null));};exports[_0xa750('0x53')]=function(_0x33d5e3,_0x40c558,_0x5628af){var _0x4be4f5={};var _0x2b648f={};var _0x57e86c;var _0x1e6e1c;return db[_0xa750('0x31')][_0xa750('0x54')]({'where':{'id':_0x33d5e3[_0xa750('0x49')]['id']}})[_0xa750('0x2a')](handleEntityNotFound(_0x40c558,null))[_0xa750('0x2a')](function(_0x5b762e){if(_0x5b762e){_0x57e86c=_0x5b762e;_0x2b648f[_0xa750('0x35')]=_[_0xa750('0x38')](db['ServicenowField']['rawAttributes']);_0x2b648f[_0xa750('0x37')]=_[_0xa750('0x38')](_0x33d5e3[_0xa750('0x37')]);_0x2b648f[_0xa750('0x4a')]=_[_0xa750('0x39')](_0x2b648f[_0xa750('0x35')],_0x2b648f[_0xa750('0x37')]);_0x4be4f5[_0xa750('0x3a')]=_[_0xa750('0x39')](_0x2b648f['model'],qs[_0xa750('0x3b')](_0x33d5e3[_0xa750('0x37')][_0xa750('0x3b')]));_0x4be4f5[_0xa750('0x3a')]=_0x4be4f5[_0xa750('0x3a')]['length']?_0x4be4f5[_0xa750('0x3a')]:_0x2b648f[_0xa750('0x35')];_0x4be4f5[_0xa750('0x3d')]=qs[_0xa750('0x3e')](_0x33d5e3[_0xa750('0x37')][_0xa750('0x3e')]);_0x4be4f5[_0xa750('0x41')]=qs[_0xa750('0x4a')](_['pick'](_0x33d5e3[_0xa750('0x37')],_0x2b648f[_0xa750('0x4a')]));if(_0x33d5e3[_0xa750('0x37')][_0xa750('0x40')]){_0x4be4f5['where']=_[_0xa750('0x42')](_0x4be4f5[_0xa750('0x41')],{'$or':_[_0xa750('0x36')](_0x4be4f5['attributes'],function(_0x4c8cbe){var _0x56e216={};_0x56e216[_0x4c8cbe]={'$like':'%'+_0x33d5e3['query'][_0xa750('0x40')]+'%'};return _0x56e216;})});}_0x4be4f5=_[_0xa750('0x42')]({},_0x4be4f5,_0x33d5e3[_0xa750('0x4c')]);return _0x57e86c[_0xa750('0x53')](_0x4be4f5);}})['then'](function(_0x532490){if(_0x532490){_0x1e6e1c=_0x532490[_0xa750('0x4b')];if(!_0x33d5e3[_0xa750('0x37')][_0xa750('0x55')]('nolimit')){_0x4be4f5['limit']=qs[_0xa750('0x23')](_0x33d5e3['query'][_0xa750('0x23')]);_0x4be4f5[_0xa750('0x20')]=qs[_0xa750('0x20')](_0x33d5e3['query'][_0xa750('0x20')]);}return _0x57e86c[_0xa750('0x53')](_0x4be4f5);}})[_0xa750('0x2a')](function(_0x3e125e){if(_0x3e125e){return _0x3e125e?{'count':_0x1e6e1c,'rows':_0x3e125e}:null;}})[_0xa750('0x2a')](respondWithResult(_0x40c558,null))[_0xa750('0x47')](handleError(_0x40c558,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d5cc7f0..84f3cc6 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 _0x9efc=['../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','path'];(function(_0x11a05f,_0x35d167){var _0x5019dd=function(_0x2ba7b4){while(--_0x2ba7b4){_0x11a05f['push'](_0x11a05f['shift']());}};_0x5019dd(++_0x35d167);}(_0x9efc,0x19c));var _0xc9ef=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x9efc[_0x289a67];return _0x572b49;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var logger=require(_0xc9ef('0x2'))(_0xc9ef('0x3'));var moment=require(_0xc9ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9ef('0x5'));var rimraf=require('rimraf');var config=require(_0xc9ef('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xc9ef('0x7')]=function(_0x5eae9a,_0x40bed3){return _0x5eae9a[_0xc9ef('0x8')](_0xc9ef('0x9'),attributes,{'tableName':_0xc9ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51c5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x3c1d4a,_0x64ed3b){var _0x3b1c3c=function(_0x3a4767){while(--_0x3a4767){_0x3c1d4a['push'](_0x3c1d4a['shift']());}};_0x3b1c3c(++_0x64ed3b);}(_0x51c5,0x8f));var _0x551c=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x51c5[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var logger=require(_0x551c('0x2'))(_0x551c('0x3'));var moment=require(_0x551c('0x4'));var BPromise=require(_0x551c('0x5'));var rp=require(_0x551c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x551c('0x7'));var config=require(_0x551c('0x8'));var attributes=require(_0x551c('0x9'));module[_0x551c('0xa')]=function(_0xe0272c,_0x1aa8df){return _0xe0272c[_0x551c('0xb')](_0x551c('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 84711ed..3285ee4 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 _0xf31b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1d4233,_0x564968){var _0x302b73=function(_0x262183){while(--_0x262183){_0x1d4233['push'](_0x1d4233['shift']());}};_0x302b73(++_0x564968);}(_0xf31b,0x1a0));var _0xbf31=function(_0x3eb484,_0x524fe0){_0x3eb484=_0x3eb484-0x0;var _0x123e70=_0xf31b[_0x3eb484];return _0x123e70;};'use strict';var _=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var moment=require(_0xbf31('0x2'));var BPromise=require(_0xbf31('0x3'));var rs=require(_0xbf31('0x4'));var fs=require('fs');var Redis=require(_0xbf31('0x5'));var db=require(_0xbf31('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf31('0x7'))(_0xbf31('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf31('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcf6c0f,_0xde14a4,_0x547919){return new BPromise(function(_0x4d02dd,_0x3da1a2){return client['request'](_0xcf6c0f,_0x547919)[_0xbf31('0xa')](function(_0x23d576){logger[_0xbf31('0xb')](_0xbf31('0xc'),_0xde14a4,_0xbf31('0xd'));logger[_0xbf31('0xe')](_0xbf31('0xf'),_0xde14a4,_0xbf31('0xd'),JSON[_0xbf31('0x10')](_0x23d576));if(_0x23d576[_0xbf31('0x11')]){if(_0x23d576[_0xbf31('0x11')][_0xbf31('0x12')]===0x1f4){logger[_0xbf31('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xde14a4,_0x23d576['error']['message']);return _0x3da1a2(_0x23d576['error'][_0xbf31('0x13')]);}logger[_0xbf31('0x11')](_0xbf31('0xc'),_0xde14a4,_0x23d576[_0xbf31('0x11')]['message']);return _0x4d02dd(_0x23d576['error'][_0xbf31('0x13')]);}else{logger[_0xbf31('0xb')](_0xbf31('0xc'),_0xde14a4,_0xbf31('0xd'));_0x4d02dd(_0x23d576[_0xbf31('0x14')]['message']);}})[_0xbf31('0x15')](function(_0x5e9b58){logger['error'](_0xbf31('0xc'),_0xde14a4,_0x5e9b58);_0x3da1a2(_0x5e9b58);});});} \ No newline at end of file +var _0x8a62=['message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x449baa,_0x27b696){var _0x3d7043=function(_0x5e7449){while(--_0x5e7449){_0x449baa['push'](_0x449baa['shift']());}};_0x3d7043(++_0x27b696);}(_0x8a62,0x18f));var _0x28a6=function(_0x3a228e,_0x3b4898){_0x3a228e=_0x3a228e-0x0;var _0x294c40=_0x8a62[_0x3a228e];return _0x294c40;};'use strict';var _=require(_0x28a6('0x0'));var util=require('util');var moment=require(_0x28a6('0x1'));var BPromise=require(_0x28a6('0x2'));var rs=require(_0x28a6('0x3'));var fs=require('fs');var Redis=require(_0x28a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28a6('0x5'));var logger=require(_0x28a6('0x6'))(_0x28a6('0x7'));var config=require(_0x28a6('0x8'));var jayson=require(_0x28a6('0x9'));var client=jayson[_0x28a6('0xa')][_0x28a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x97d860,_0x5ae651,_0x38bbb0){return new BPromise(function(_0x1e8c79,_0x2bef20){return client['request'](_0x97d860,_0x38bbb0)[_0x28a6('0xc')](function(_0x5accd2){logger[_0x28a6('0xd')](_0x28a6('0xe'),_0x5ae651,'request\x20sent');logger['debug'](_0x28a6('0xf'),_0x5ae651,'request\x20sent',JSON[_0x28a6('0x10')](_0x5accd2));if(_0x5accd2['error']){if(_0x5accd2[_0x28a6('0x11')][_0x28a6('0x12')]===0x1f4){logger['error'](_0x28a6('0xe'),_0x5ae651,_0x5accd2[_0x28a6('0x11')][_0x28a6('0x13')]);return _0x2bef20(_0x5accd2[_0x28a6('0x11')]['message']);}logger[_0x28a6('0x11')](_0x28a6('0xe'),_0x5ae651,_0x5accd2['error']['message']);return _0x1e8c79(_0x5accd2[_0x28a6('0x11')][_0x28a6('0x13')]);}else{logger[_0x28a6('0xd')](_0x28a6('0xe'),_0x5ae651,_0x28a6('0x14'));_0x1e8c79(_0x5accd2['result'][_0x28a6('0x13')]);}})[_0x28a6('0x15')](function(_0x2cc484){logger[_0x28a6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5ae651,_0x2cc484);_0x2bef20(_0x2cc484);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 729d82a..4649565 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 _0x04ba=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04ba,0x198));var _0xa04b=function(_0x581eb3,_0x113874){_0x581eb3=_0x581eb3-0x0;var _0x326ed3=_0x04ba[_0x581eb3];return _0x326ed3;};'use strict';var multer=require(_0xa04b('0x0'));var util=require(_0xa04b('0x1'));var path=require(_0xa04b('0x2'));var timeout=require(_0xa04b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa04b('0x4'));var auth=require(_0xa04b('0x5'));var interaction=require(_0xa04b('0x6'));var config=require(_0xa04b('0x7'));var controller=require(_0xa04b('0x8'));router[_0xa04b('0x9')]('/',auth[_0xa04b('0xa')](),controller[_0xa04b('0xb')]);router[_0xa04b('0x9')]('/:id',auth[_0xa04b('0xa')](),controller[_0xa04b('0xc')]);router['post']('/',auth[_0xa04b('0xa')](),controller['create']);router['put'](_0xa04b('0xd'),auth['isAuthenticated'](),controller[_0xa04b('0xe')]);router[_0xa04b('0xf')](_0xa04b('0xd'),auth[_0xa04b('0xa')](),controller[_0xa04b('0x10')]);module[_0xa04b('0x11')]=router; \ No newline at end of file +var _0xfade=['../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfade,0xf0));var _0xefad=function(_0x4a6489,_0x2eff77){_0x4a6489=_0x4a6489-0x0;var _0x2d54b8=_0xfade[_0x4a6489];return _0x2d54b8;};'use strict';var multer=require(_0xefad('0x0'));var util=require(_0xefad('0x1'));var path=require(_0xefad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xefad('0x3')]();var fs_extra=require(_0xefad('0x4'));var auth=require(_0xefad('0x5'));var interaction=require(_0xefad('0x6'));var config=require(_0xefad('0x7'));var controller=require(_0xefad('0x8'));router[_0xefad('0x9')]('/',auth['isAuthenticated'](),controller[_0xefad('0xa')]);router['get'](_0xefad('0xb'),auth[_0xefad('0xc')](),controller['show']);router[_0xefad('0xd')]('/',auth[_0xefad('0xc')](),controller['create']);router[_0xefad('0xe')](_0xefad('0xb'),auth[_0xefad('0xc')](),controller[_0xefad('0xf')]);router[_0xefad('0x10')](_0xefad('0xb'),auth[_0xefad('0xc')](),controller[_0xefad('0x11')]);module[_0xefad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2e3071b..794ddc7 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 _0x975d=['variable','BOOLEAN','exports','ENUM','customVariable','keyValue','STRING'];(function(_0x64f29e,_0x4b5843){var _0x54a094=function(_0x5356e5){while(--_0x5356e5){_0x64f29e['push'](_0x64f29e['shift']());}};_0x54a094(++_0x4b5843);}(_0x975d,0xb1));var _0xd975=function(_0x59749e,_0x624afc){_0x59749e=_0x59749e-0x0;var _0x17c576=_0x975d[_0x59749e];return _0x17c576;};'use strict';var Sequelize=require('sequelize');module[_0xd975('0x0')]={'type':{'type':Sequelize[_0xd975('0x1')]('string','variable',_0xd975('0x2'),_0xd975('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd975('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd975('0x1')]('string',_0xd975('0x5'),_0xd975('0x2'))},'keyContent':{'type':Sequelize[_0xd975('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd975('0x4')]},'customField':{'type':Sequelize[_0xd975('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd975('0x4')]}}; \ No newline at end of file +var _0x5597=['picklist','STRING','ENUM','customVariable','sequelize','string','variable','keyValue'];(function(_0x176749,_0x3d05b6){var _0x49f8d8=function(_0x1ad1be){while(--_0x1ad1be){_0x176749['push'](_0x176749['shift']());}};_0x49f8d8(++_0x3d05b6);}(_0x5597,0x11c));var _0x7559=function(_0x155057,_0x42889a){_0x155057=_0x155057-0x0;var _0x244ec0=_0x5597[_0x155057];return _0x244ec0;};'use strict';var Sequelize=require(_0x7559('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7559('0x1'),_0x7559('0x2'),'customVariable',_0x7559('0x3'),_0x7559('0x4')),'defaultValue':_0x7559('0x1')},'content':{'type':Sequelize[_0x7559('0x5')]},'key':{'type':Sequelize[_0x7559('0x5')]},'keyType':{'type':Sequelize[_0x7559('0x6')](_0x7559('0x1'),_0x7559('0x2'),_0x7559('0x7'))},'keyContent':{'type':Sequelize[_0x7559('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7559('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7559('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3576d6c..975c01a 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 _0xbc56=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','include','ServicenowField','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x4c5f11,_0x28dd13){var _0x5aaebe=function(_0x83e09c){while(--_0x83e09c){_0x4c5f11['push'](_0x4c5f11['shift']());}};_0x5aaebe(++_0x28dd13);}(_0xbc56,0x13d));var _0x6bc5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbc56[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6bc5('0x0'));var rimraf=require(_0x6bc5('0x1'));var zipdir=require(_0x6bc5('0x2'));var jsonpatch=require(_0x6bc5('0x3'));var rp=require(_0x6bc5('0x4'));var moment=require(_0x6bc5('0x5'));var BPromise=require(_0x6bc5('0x6'));var Mustache=require(_0x6bc5('0x7'));var util=require('util');var path=require(_0x6bc5('0x8'));var sox=require('sox');var csv=require(_0x6bc5('0x9'));var ejs=require(_0x6bc5('0xa'));var fs=require('fs');var fs_extra=require(_0x6bc5('0xb'));var _=require(_0x6bc5('0xc'));var squel=require(_0x6bc5('0xd'));var crypto=require(_0x6bc5('0xe'));var jsforce=require(_0x6bc5('0xf'));var deskjs=require(_0x6bc5('0x10'));var toCsv=require(_0x6bc5('0x9'));var querystring=require(_0x6bc5('0x11'));var Papa=require(_0x6bc5('0x12'));var Redis=require(_0x6bc5('0x13'));var authService=require(_0x6bc5('0x14'));var qs=require(_0x6bc5('0x15'));var as=require(_0x6bc5('0x16'));var hardwareService=require(_0x6bc5('0x17'));var logger=require(_0x6bc5('0x18'))(_0x6bc5('0x19'));var utils=require(_0x6bc5('0x1a'));var config=require(_0x6bc5('0x1b'));var licenseUtil=require(_0x6bc5('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x178da6,_0x516ef2){_0x516ef2=_0x516ef2||0xcc;return function(_0x2c66f9){if(_0x2c66f9){return _0x178da6[_0x6bc5('0x1d')](_0x516ef2);}return _0x178da6[_0x6bc5('0x1e')](_0x516ef2)[_0x6bc5('0x1f')]();};}function respondWithResult(_0x483d1c,_0x31ecab){_0x31ecab=_0x31ecab||0xc8;return function(_0x52b54e){if(_0x52b54e){return _0x483d1c['status'](_0x31ecab)[_0x6bc5('0x20')](_0x52b54e);}};}function respondWithFilteredResult(_0x16465a,_0x5f2348){return function(_0x185566){if(_0x185566){var _0x191b52=typeof _0x5f2348[_0x6bc5('0x21')]===_0x6bc5('0x22')&&typeof _0x5f2348[_0x6bc5('0x23')]===_0x6bc5('0x22');var _0x4e82a8=_0x185566[_0x6bc5('0x24')];var _0x14eab1=_0x191b52?0x0:_0x5f2348[_0x6bc5('0x21')];var _0x30cb5e=_0x191b52?_0x185566['count']:_0x5f2348['offset']+_0x5f2348[_0x6bc5('0x23')];var _0x3a2d57;if(_0x30cb5e>=_0x4e82a8){_0x30cb5e=_0x4e82a8;_0x3a2d57=0xc8;}else{_0x3a2d57=0xce;}_0x16465a['status'](_0x3a2d57);return _0x16465a[_0x6bc5('0x25')]('Content-Range',_0x14eab1+'-'+_0x30cb5e+'/'+_0x4e82a8)[_0x6bc5('0x20')](_0x185566);}return null;};}function patchUpdates(_0x3782da){return function(_0x32570f){try{jsonpatch[_0x6bc5('0x26')](_0x32570f,_0x3782da,!![]);}catch(_0x49d76d){return BPromise[_0x6bc5('0x27')](_0x49d76d);}return _0x32570f[_0x6bc5('0x28')]();};}function saveUpdates(_0x4b61f7,_0x45d3b4){return function(_0x5f039e){if(_0x5f039e){return _0x5f039e[_0x6bc5('0x29')](_0x4b61f7)['then'](function(_0x597177){return _0x597177;});}return null;};}function removeEntity(_0x11d6c8,_0x23a0c3){return function(_0xbc7c4){if(_0xbc7c4){return _0xbc7c4[_0x6bc5('0x2a')]()[_0x6bc5('0x2b')](function(){_0x11d6c8[_0x6bc5('0x1e')](0xcc)[_0x6bc5('0x1f')]();});}};}function handleEntityNotFound(_0xf429d,_0x25c216){return function(_0x43827e){if(!_0x43827e){_0xf429d[_0x6bc5('0x1d')](0x194);}return _0x43827e;};}function handleError(_0x2ff5b0,_0x1e0285){_0x1e0285=_0x1e0285||0x1f4;return function(_0x3c4b88){logger[_0x6bc5('0x2c')](_0x3c4b88[_0x6bc5('0x2d')]);if(_0x3c4b88[_0x6bc5('0x2e')]){delete _0x3c4b88[_0x6bc5('0x2e')];}_0x2ff5b0[_0x6bc5('0x1e')](_0x1e0285)[_0x6bc5('0x2f')](_0x3c4b88);};}exports[_0x6bc5('0x30')]=function(_0xe98841,_0x1aa5fe){var _0x521dd4={},_0x2d89d3={},_0x8f6464={'count':0x0,'rows':[]};var _0x55d736=_[_0x6bc5('0x31')](db['ServicenowField'][_0x6bc5('0x32')],function(_0x14fb9b){return{'name':_0x14fb9b[_0x6bc5('0x33')],'type':_0x14fb9b[_0x6bc5('0x34')][_0x6bc5('0x35')]};});_0x2d89d3[_0x6bc5('0x36')]=_[_0x6bc5('0x31')](_0x55d736,_0x6bc5('0x2e'));_0x2d89d3['query']=_[_0x6bc5('0x37')](_0xe98841[_0x6bc5('0x38')]);_0x2d89d3[_0x6bc5('0x39')]=_[_0x6bc5('0x3a')](_0x2d89d3[_0x6bc5('0x36')],_0x2d89d3['query']);_0x521dd4[_0x6bc5('0x3b')]=_[_0x6bc5('0x3a')](_0x2d89d3[_0x6bc5('0x36')],qs[_0x6bc5('0x3c')](_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x3c')]));_0x521dd4[_0x6bc5('0x3b')]=_0x521dd4[_0x6bc5('0x3b')]['length']?_0x521dd4['attributes']:_0x2d89d3[_0x6bc5('0x36')];if(!_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x3d')]('nolimit')){_0x521dd4[_0x6bc5('0x23')]=qs['limit'](_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x23')]);_0x521dd4[_0x6bc5('0x21')]=qs['offset'](_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x21')]);}_0x521dd4[_0x6bc5('0x3e')]=qs[_0x6bc5('0x3f')](_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x3f')]);_0x521dd4[_0x6bc5('0x40')]=qs[_0x6bc5('0x39')](_['pick'](_0xe98841[_0x6bc5('0x38')],_0x2d89d3[_0x6bc5('0x39')]),_0x55d736);if(_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x41')]){_0x521dd4[_0x6bc5('0x40')]=_['merge'](_0x521dd4[_0x6bc5('0x40')],{'$or':_['map'](_0x55d736,function(_0x4882cc){if(_0x4882cc[_0x6bc5('0x34')]!==_0x6bc5('0x42')){var _0x276c12={};_0x276c12[_0x4882cc['name']]={'$like':'%'+_0xe98841[_0x6bc5('0x38')][_0x6bc5('0x41')]+'%'};return _0x276c12;}})});}_0x521dd4=_[_0x6bc5('0x43')]({},_0x521dd4,_0xe98841[_0x6bc5('0x44')]);var _0x5a753b={'where':_0x521dd4[_0x6bc5('0x40')]};return db['ServicenowField'][_0x6bc5('0x24')](_0x5a753b)[_0x6bc5('0x2b')](function(_0x13ee71){_0x8f6464['count']=_0x13ee71;if(_0xe98841['query']['includeAll']){_0x521dd4[_0x6bc5('0x45')]=[{'all':!![]}];}return db[_0x6bc5('0x46')][_0x6bc5('0x47')](_0x521dd4);})[_0x6bc5('0x2b')](function(_0x1c51cf){_0x8f6464[_0x6bc5('0x48')]=_0x1c51cf;return _0x8f6464;})[_0x6bc5('0x2b')](respondWithFilteredResult(_0x1aa5fe,_0x521dd4))[_0x6bc5('0x49')](handleError(_0x1aa5fe,null));};exports[_0x6bc5('0x4a')]=function(_0x3e778b,_0x313dec){var _0x2e1fe7={'raw':!![],'where':{'id':_0x3e778b[_0x6bc5('0x4b')]['id']}},_0x33f84f={};_0x33f84f['model']=_[_0x6bc5('0x37')](db[_0x6bc5('0x46')][_0x6bc5('0x32')]);_0x33f84f['query']=_['keys'](_0x3e778b['query']);_0x33f84f[_0x6bc5('0x39')]=_[_0x6bc5('0x3a')](_0x33f84f[_0x6bc5('0x36')],_0x33f84f[_0x6bc5('0x38')]);_0x2e1fe7[_0x6bc5('0x3b')]=_['intersection'](_0x33f84f[_0x6bc5('0x36')],qs['fields'](_0x3e778b[_0x6bc5('0x38')][_0x6bc5('0x3c')]));_0x2e1fe7[_0x6bc5('0x3b')]=_0x2e1fe7['attributes']['length']?_0x2e1fe7[_0x6bc5('0x3b')]:_0x33f84f[_0x6bc5('0x36')];if(_0x3e778b[_0x6bc5('0x38')][_0x6bc5('0x4c')]){_0x2e1fe7[_0x6bc5('0x45')]=[{'all':!![]}];}_0x2e1fe7=_[_0x6bc5('0x43')]({},_0x2e1fe7,_0x3e778b['options']);return db[_0x6bc5('0x46')][_0x6bc5('0x4d')](_0x2e1fe7)[_0x6bc5('0x2b')](handleEntityNotFound(_0x313dec,null))['then'](respondWithResult(_0x313dec,null))[_0x6bc5('0x49')](handleError(_0x313dec,null));};exports[_0x6bc5('0x4e')]=function(_0x18e534,_0xffdcce){return db[_0x6bc5('0x46')]['create'](_0x18e534['body'],{})['then'](respondWithResult(_0xffdcce,0xc9))[_0x6bc5('0x49')](handleError(_0xffdcce,null));};exports[_0x6bc5('0x29')]=function(_0x574a4d,_0x305dd3){if(_0x574a4d['body']['id']){delete _0x574a4d[_0x6bc5('0x4f')]['id'];}return db[_0x6bc5('0x46')][_0x6bc5('0x4d')]({'where':{'id':_0x574a4d['params']['id']}})['then'](handleEntityNotFound(_0x305dd3,null))[_0x6bc5('0x2b')](saveUpdates(_0x574a4d[_0x6bc5('0x4f')],null))[_0x6bc5('0x2b')](respondWithResult(_0x305dd3,null))[_0x6bc5('0x49')](handleError(_0x305dd3,null));};exports[_0x6bc5('0x2a')]=function(_0x51f510,_0x4a8675){return db['ServicenowField'][_0x6bc5('0x4d')]({'where':{'id':_0x51f510[_0x6bc5('0x4b')]['id']}})[_0x6bc5('0x2b')](handleEntityNotFound(_0x4a8675,null))[_0x6bc5('0x2b')](removeEntity(_0x4a8675,null))['catch'](handleError(_0x4a8675,null));}; \ No newline at end of file +var _0x6608=['bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6608,0x168));var _0x8660=function(_0x45a57e,_0x1ec3c0){_0x45a57e=_0x45a57e-0x0;var _0x33d76e=_0x6608[_0x45a57e];return _0x33d76e;};'use strict';var emlformat=require(_0x8660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8660('0x1'));var jsonpatch=require(_0x8660('0x2'));var rp=require(_0x8660('0x3'));var moment=require(_0x8660('0x4'));var BPromise=require(_0x8660('0x5'));var Mustache=require(_0x8660('0x6'));var util=require(_0x8660('0x7'));var path=require(_0x8660('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8660('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8660('0xa'));var squel=require(_0x8660('0xb'));var crypto=require(_0x8660('0xc'));var jsforce=require(_0x8660('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8660('0xe'));var querystring=require(_0x8660('0xf'));var Papa=require(_0x8660('0x10'));var Redis=require(_0x8660('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8660('0x12'));var as=require(_0x8660('0x13'));var hardwareService=require(_0x8660('0x14'));var logger=require('../../config/logger')(_0x8660('0x15'));var utils=require('../../config/utils');var config=require(_0x8660('0x16'));var licenseUtil=require(_0x8660('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe14ebe,_0x49f23e){_0x49f23e=_0x49f23e||0xcc;return function(_0x3c6f3d){if(_0x3c6f3d){return _0xe14ebe[_0x8660('0x18')](_0x49f23e);}return _0xe14ebe[_0x8660('0x19')](_0x49f23e)[_0x8660('0x1a')]();};}function respondWithResult(_0x191c44,_0x27aa40){_0x27aa40=_0x27aa40||0xc8;return function(_0x4248fb){if(_0x4248fb){return _0x191c44[_0x8660('0x19')](_0x27aa40)[_0x8660('0x1b')](_0x4248fb);}};}function respondWithFilteredResult(_0x14cd3f,_0x13e71a){return function(_0x246228){if(_0x246228){var _0x2306d8=typeof _0x13e71a[_0x8660('0x1c')]===_0x8660('0x1d')&&typeof _0x13e71a[_0x8660('0x1e')]==='undefined';var _0x1a7476=_0x246228['count'];var _0x553818=_0x2306d8?0x0:_0x13e71a['offset'];var _0x14fb4b=_0x2306d8?_0x246228[_0x8660('0x1f')]:_0x13e71a[_0x8660('0x1c')]+_0x13e71a['limit'];var _0x15d10d;if(_0x14fb4b>=_0x1a7476){_0x14fb4b=_0x1a7476;_0x15d10d=0xc8;}else{_0x15d10d=0xce;}_0x14cd3f[_0x8660('0x19')](_0x15d10d);return _0x14cd3f['set']('Content-Range',_0x553818+'-'+_0x14fb4b+'/'+_0x1a7476)['json'](_0x246228);}return null;};}function patchUpdates(_0x55ce5e){return function(_0xb5be36){try{jsonpatch[_0x8660('0x20')](_0xb5be36,_0x55ce5e,!![]);}catch(_0x178a49){return BPromise[_0x8660('0x21')](_0x178a49);}return _0xb5be36[_0x8660('0x22')]();};}function saveUpdates(_0x5a1854,_0x2420d1){return function(_0x43eeb9){if(_0x43eeb9){return _0x43eeb9[_0x8660('0x23')](_0x5a1854)[_0x8660('0x24')](function(_0x51415e){return _0x51415e;});}return null;};}function removeEntity(_0x2c9bdf,_0x3af49a){return function(_0x1e99c2){if(_0x1e99c2){return _0x1e99c2[_0x8660('0x25')]()[_0x8660('0x24')](function(){_0x2c9bdf[_0x8660('0x19')](0xcc)[_0x8660('0x1a')]();});}};}function handleEntityNotFound(_0x26df70,_0x1dedc0){return function(_0x2fad62){if(!_0x2fad62){_0x26df70[_0x8660('0x18')](0x194);}return _0x2fad62;};}function handleError(_0x7ff72a,_0x43b1e8){_0x43b1e8=_0x43b1e8||0x1f4;return function(_0x361fab){logger[_0x8660('0x26')](_0x361fab[_0x8660('0x27')]);if(_0x361fab[_0x8660('0x28')]){delete _0x361fab[_0x8660('0x28')];}_0x7ff72a[_0x8660('0x19')](_0x43b1e8)[_0x8660('0x29')](_0x361fab);};}exports['index']=function(_0x4dd4e9,_0x46da28){var _0x3ae847={},_0x23d8cf={},_0x35a7d1={'count':0x0,'rows':[]};var _0x5153b3=_[_0x8660('0x2a')](db[_0x8660('0x2b')][_0x8660('0x2c')],function(_0x28dc39){return{'name':_0x28dc39['fieldName'],'type':_0x28dc39[_0x8660('0x2d')][_0x8660('0x2e')]};});_0x23d8cf[_0x8660('0x2f')]=_[_0x8660('0x2a')](_0x5153b3,_0x8660('0x28'));_0x23d8cf[_0x8660('0x30')]=_['keys'](_0x4dd4e9[_0x8660('0x30')]);_0x23d8cf[_0x8660('0x31')]=_[_0x8660('0x32')](_0x23d8cf[_0x8660('0x2f')],_0x23d8cf['query']);_0x3ae847['attributes']=_[_0x8660('0x32')](_0x23d8cf['model'],qs[_0x8660('0x33')](_0x4dd4e9[_0x8660('0x30')]['fields']));_0x3ae847[_0x8660('0x34')]=_0x3ae847['attributes'][_0x8660('0x35')]?_0x3ae847[_0x8660('0x34')]:_0x23d8cf['model'];if(!_0x4dd4e9[_0x8660('0x30')][_0x8660('0x36')](_0x8660('0x37'))){_0x3ae847[_0x8660('0x1e')]=qs[_0x8660('0x1e')](_0x4dd4e9[_0x8660('0x30')][_0x8660('0x1e')]);_0x3ae847[_0x8660('0x1c')]=qs[_0x8660('0x1c')](_0x4dd4e9[_0x8660('0x30')][_0x8660('0x1c')]);}_0x3ae847[_0x8660('0x38')]=qs['sort'](_0x4dd4e9['query'][_0x8660('0x39')]);_0x3ae847[_0x8660('0x3a')]=qs[_0x8660('0x31')](_[_0x8660('0x3b')](_0x4dd4e9[_0x8660('0x30')],_0x23d8cf[_0x8660('0x31')]),_0x5153b3);if(_0x4dd4e9[_0x8660('0x30')][_0x8660('0x3c')]){_0x3ae847[_0x8660('0x3a')]=_[_0x8660('0x3d')](_0x3ae847[_0x8660('0x3a')],{'$or':_[_0x8660('0x2a')](_0x5153b3,function(_0x50fdae){if(_0x50fdae[_0x8660('0x2d')]!==_0x8660('0x3e')){var _0xe08dd5={};_0xe08dd5[_0x50fdae[_0x8660('0x28')]]={'$like':'%'+_0x4dd4e9[_0x8660('0x30')]['filter']+'%'};return _0xe08dd5;}})});}_0x3ae847=_[_0x8660('0x3d')]({},_0x3ae847,_0x4dd4e9[_0x8660('0x3f')]);var _0x49a3cc={'where':_0x3ae847[_0x8660('0x3a')]};return db[_0x8660('0x2b')][_0x8660('0x1f')](_0x49a3cc)[_0x8660('0x24')](function(_0x5c6fd6){_0x35a7d1['count']=_0x5c6fd6;if(_0x4dd4e9['query'][_0x8660('0x40')]){_0x3ae847[_0x8660('0x41')]=[{'all':!![]}];}return db[_0x8660('0x2b')]['findAll'](_0x3ae847);})[_0x8660('0x24')](function(_0x4c726f){_0x35a7d1[_0x8660('0x42')]=_0x4c726f;return _0x35a7d1;})[_0x8660('0x24')](respondWithFilteredResult(_0x46da28,_0x3ae847))[_0x8660('0x43')](handleError(_0x46da28,null));};exports[_0x8660('0x44')]=function(_0x518818,_0x27f33f){var _0x5ede90={'raw':!![],'where':{'id':_0x518818[_0x8660('0x45')]['id']}},_0x39e5e4={};_0x39e5e4[_0x8660('0x2f')]=_['keys'](db['ServicenowField'][_0x8660('0x2c')]);_0x39e5e4[_0x8660('0x30')]=_['keys'](_0x518818[_0x8660('0x30')]);_0x39e5e4[_0x8660('0x31')]=_[_0x8660('0x32')](_0x39e5e4[_0x8660('0x2f')],_0x39e5e4[_0x8660('0x30')]);_0x5ede90[_0x8660('0x34')]=_['intersection'](_0x39e5e4['model'],qs[_0x8660('0x33')](_0x518818[_0x8660('0x30')]['fields']));_0x5ede90[_0x8660('0x34')]=_0x5ede90[_0x8660('0x34')][_0x8660('0x35')]?_0x5ede90['attributes']:_0x39e5e4['model'];if(_0x518818['query'][_0x8660('0x40')]){_0x5ede90[_0x8660('0x41')]=[{'all':!![]}];}_0x5ede90=_[_0x8660('0x3d')]({},_0x5ede90,_0x518818[_0x8660('0x3f')]);return db[_0x8660('0x2b')][_0x8660('0x46')](_0x5ede90)[_0x8660('0x24')](handleEntityNotFound(_0x27f33f,null))[_0x8660('0x24')](respondWithResult(_0x27f33f,null))[_0x8660('0x43')](handleError(_0x27f33f,null));};exports[_0x8660('0x47')]=function(_0x4b1285,_0x1637de){return db[_0x8660('0x2b')][_0x8660('0x47')](_0x4b1285[_0x8660('0x48')],{})[_0x8660('0x24')](respondWithResult(_0x1637de,0xc9))['catch'](handleError(_0x1637de,null));};exports[_0x8660('0x23')]=function(_0x8f5f59,_0x456e4e){if(_0x8f5f59[_0x8660('0x48')]['id']){delete _0x8f5f59[_0x8660('0x48')]['id'];}return db[_0x8660('0x2b')][_0x8660('0x46')]({'where':{'id':_0x8f5f59[_0x8660('0x45')]['id']}})[_0x8660('0x24')](handleEntityNotFound(_0x456e4e,null))[_0x8660('0x24')](saveUpdates(_0x8f5f59[_0x8660('0x48')],null))[_0x8660('0x24')](respondWithResult(_0x456e4e,null))[_0x8660('0x43')](handleError(_0x456e4e,null));};exports['destroy']=function(_0x419963,_0x6bbfef){return db[_0x8660('0x2b')]['find']({'where':{'id':_0x419963[_0x8660('0x45')]['id']}})[_0x8660('0x24')](handleEntityNotFound(_0x6bbfef,null))['then'](removeEntity(_0x6bbfef,null))['catch'](handleError(_0x6bbfef,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 17c2b5b..506899e 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 _0x6735=['int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','ServicenowField'];(function(_0x188035,_0x187149){var _0x2dd828=function(_0x4b408a){while(--_0x4b408a){_0x188035['push'](_0x188035['shift']());}};_0x2dd828(++_0x187149);}(_0x6735,0x18f));var _0x5673=function(_0x47d348,_0x7066d9){_0x47d348=_0x47d348-0x0;var _0x1769ad=_0x6735[_0x47d348];return _0x1769ad;};'use strict';var _=require(_0x5673('0x0'));var util=require(_0x5673('0x1'));var logger=require(_0x5673('0x2'))('api');var moment=require(_0x5673('0x3'));var BPromise=require(_0x5673('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5673('0x5'));var config=require(_0x5673('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x59fe9d,_0x278ac6){return _0x59fe9d[_0x5673('0x7')](_0x5673('0x8'),attributes,{'tableName':_0x5673('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x5673('0xa'),_0x5673('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29c3=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x689740,_0x15278f){var _0x413ae1=function(_0x2582e5){while(--_0x2582e5){_0x689740['push'](_0x689740['shift']());}};_0x413ae1(++_0x15278f);}(_0x29c3,0x13d));var _0x329c=function(_0x153837,_0x93cc15){_0x153837=_0x153837-0x0;var _0x4830e1=_0x29c3[_0x153837];return _0x4830e1;};'use strict';var _=require(_0x329c('0x0'));var util=require(_0x329c('0x1'));var logger=require(_0x329c('0x2'))(_0x329c('0x3'));var moment=require('moment');var BPromise=require(_0x329c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x329c('0x5'));var rimraf=require(_0x329c('0x6'));var config=require(_0x329c('0x7'));var attributes=require(_0x329c('0x8'));module[_0x329c('0x9')]=function(_0x5d6841,_0x505ede){return _0x5d6841[_0x329c('0xa')](_0x329c('0xb'),attributes,{'tableName':_0x329c('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x329c('0xd'),_0x329c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index a677fb2..1d35238 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x5c69d6,_0x3ef3ba){_0x5c69d6=_0x5c69d6-0x0;var _0x1dd929=_0xac4a[_0x5c69d6];return _0x1dd929;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x10ef5d,_0x203094){var _0x104260=function(_0x30d491){while(--_0x30d491){_0x10ef5d['push'](_0x10ef5d['shift']());}};_0x104260(++_0x203094);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5e6c3ac..341c0c7 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x54b72e,_0x4d3c59){var _0x49096a=function(_0xf8b66a){while(--_0xf8b66a){_0x54b72e['push'](_0x54b72e['shift']());}};_0x49096a(++_0x4d3c59);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4448e4,_0x8483fe){var _0x14658a=function(_0x2c799f){while(--_0x2c799f){_0x4448e4['push'](_0x4448e4['shift']());}};_0x14658a(++_0x8483fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4a5afec..9039212 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x162774,_0x3c11ab){var _0x5cc297=function(_0x48ba64){while(--_0x48ba64){_0x162774['push'](_0x162774['shift']());}};_0x5cc297(++_0x3c11ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4acf55,_0x433577){var _0x4cfe7b=function(_0x2efda8){while(--_0x2efda8){_0x4acf55['push'](_0x4acf55['shift']());}};_0x4cfe7b(++_0x433577);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index a7d0c06..13a648a 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 _0x1762=['label','endsWith','options','values','value','test','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','stack','name','send','index','SugarcrmAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','created_by','description','date_start','duration_hours','parent_id','parent_type','direction','username','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','password','Invalid\x20Login','format','get_module_fields','Calls','module_fields','includes'];(function(_0x5b463d,_0x4c0149){var _0x342661=function(_0x2ad2de){while(--_0x2ad2de){_0x5b463d['push'](_0x5b463d['shift']());}};_0x342661(++_0x4c0149);}(_0x1762,0xed));var _0x2176=function(_0x316bcd,_0x560e96){_0x316bcd=_0x316bcd-0x0;var _0x2dce07=_0x1762[_0x316bcd];return _0x2dce07;};'use strict';var emlformat=require(_0x2176('0x0'));var rimraf=require(_0x2176('0x1'));var zipdir=require(_0x2176('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2176('0x3'));var moment=require(_0x2176('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2176('0x5'));var util=require(_0x2176('0x6'));var path=require(_0x2176('0x7'));var sox=require(_0x2176('0x8'));var csv=require(_0x2176('0x9'));var ejs=require(_0x2176('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2176('0xb'));var squel=require(_0x2176('0xc'));var crypto=require(_0x2176('0xd'));var jsforce=require(_0x2176('0xe'));var deskjs=require(_0x2176('0xf'));var toCsv=require(_0x2176('0x9'));var querystring=require('querystring');var Papa=require(_0x2176('0x10'));var Redis=require(_0x2176('0x11'));var authService=require(_0x2176('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2176('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2176('0x14'));var utils=require(_0x2176('0x15'));var config=require(_0x2176('0x16'));var licenseUtil=require(_0x2176('0x17'));var db=require(_0x2176('0x18'))['db'];var integrations=require(_0x2176('0x19'));function respondWithStatusCode(_0x365c5e,_0x19a797){_0x19a797=_0x19a797||0xcc;return function(_0x4c8443){if(_0x4c8443){return _0x365c5e[_0x2176('0x1a')](_0x19a797);}return _0x365c5e[_0x2176('0x1b')](_0x19a797)[_0x2176('0x1c')]();};}function respondWithResult(_0x334b7b,_0x122045){_0x122045=_0x122045||0xc8;return function(_0x4b7fab){if(_0x4b7fab){return _0x334b7b['status'](_0x122045)[_0x2176('0x1d')](_0x4b7fab);}};}function respondWithFilteredResult(_0x52d4ff,_0x21148a){return function(_0x11304e){if(_0x11304e){var _0x212ce7=typeof _0x21148a[_0x2176('0x1e')]===_0x2176('0x1f')&&typeof _0x21148a[_0x2176('0x20')]===_0x2176('0x1f');var _0x2b39a6=_0x11304e[_0x2176('0x21')];var _0x1e1408=_0x212ce7?0x0:_0x21148a[_0x2176('0x1e')];var _0x37f124=_0x212ce7?_0x11304e[_0x2176('0x21')]:_0x21148a[_0x2176('0x1e')]+_0x21148a[_0x2176('0x20')];var _0x1568e8;if(_0x37f124>=_0x2b39a6){_0x37f124=_0x2b39a6;_0x1568e8=0xc8;}else{_0x1568e8=0xce;}_0x52d4ff['status'](_0x1568e8);return _0x52d4ff['set']('Content-Range',_0x1e1408+'-'+_0x37f124+'/'+_0x2b39a6)[_0x2176('0x1d')](_0x11304e);}return null;};}function patchUpdates(_0x2f2671){return function(_0xaea0dc){try{jsonpatch[_0x2176('0x22')](_0xaea0dc,_0x2f2671,!![]);}catch(_0x3b79ea){return BPromise[_0x2176('0x23')](_0x3b79ea);}return _0xaea0dc[_0x2176('0x24')]();};}function saveUpdates(_0x54ed1b,_0x3e03e2){return function(_0x146f27){if(_0x146f27){return _0x146f27[_0x2176('0x25')](_0x54ed1b)[_0x2176('0x26')](function(_0xe35b8){return _0xe35b8;});}return null;};}function removeEntity(_0x36d511,_0x455d49){return function(_0x40af74){if(_0x40af74){return _0x40af74['destroy']()['then'](function(){_0x36d511[_0x2176('0x1b')](0xcc)[_0x2176('0x1c')]();});}};}function handleEntityNotFound(_0x43f6f0,_0x5c900c){return function(_0x20a5d1){if(!_0x20a5d1){_0x43f6f0[_0x2176('0x1a')](0x194);}return _0x20a5d1;};}function handleError(_0x103d05,_0x17ae6a){_0x17ae6a=_0x17ae6a||0x1f4;return function(_0x104922){logger['error'](_0x104922[_0x2176('0x27')]);if(_0x104922[_0x2176('0x28')]){delete _0x104922[_0x2176('0x28')];}_0x103d05[_0x2176('0x1b')](_0x17ae6a)[_0x2176('0x29')](_0x104922);};}exports[_0x2176('0x2a')]=function(_0x416d8e,_0x496121){var _0x20d2b0={},_0x2477d3={},_0x132207={'count':0x0,'rows':[]};var _0x479f85=_['map'](db[_0x2176('0x2b')]['rawAttributes'],function(_0x30b025){return{'name':_0x30b025[_0x2176('0x2c')],'type':_0x30b025[_0x2176('0x2d')]['key']};});_0x2477d3[_0x2176('0x2e')]=_[_0x2176('0x2f')](_0x479f85,_0x2176('0x28'));_0x2477d3[_0x2176('0x30')]=_[_0x2176('0x31')](_0x416d8e[_0x2176('0x30')]);_0x2477d3[_0x2176('0x32')]=_[_0x2176('0x33')](_0x2477d3[_0x2176('0x2e')],_0x2477d3[_0x2176('0x30')]);_0x20d2b0[_0x2176('0x34')]=_[_0x2176('0x33')](_0x2477d3[_0x2176('0x2e')],qs[_0x2176('0x35')](_0x416d8e[_0x2176('0x30')]['fields']));_0x20d2b0[_0x2176('0x34')]=_0x20d2b0[_0x2176('0x34')]['length']?_0x20d2b0[_0x2176('0x34')]:_0x2477d3[_0x2176('0x2e')];if(!_0x416d8e[_0x2176('0x30')][_0x2176('0x36')](_0x2176('0x37'))){_0x20d2b0['limit']=qs[_0x2176('0x20')](_0x416d8e['query'][_0x2176('0x20')]);_0x20d2b0['offset']=qs[_0x2176('0x1e')](_0x416d8e['query'][_0x2176('0x1e')]);}_0x20d2b0[_0x2176('0x38')]=qs[_0x2176('0x39')](_0x416d8e[_0x2176('0x30')][_0x2176('0x39')]);_0x20d2b0['where']=qs[_0x2176('0x32')](_[_0x2176('0x3a')](_0x416d8e['query'],_0x2477d3[_0x2176('0x32')]),_0x479f85);if(_0x416d8e[_0x2176('0x30')][_0x2176('0x3b')]){_0x20d2b0[_0x2176('0x3c')]=_[_0x2176('0x3d')](_0x20d2b0['where'],{'$or':_[_0x2176('0x2f')](_0x479f85,function(_0x399659){if(_0x399659['type']!==_0x2176('0x3e')){var _0xa48978={};_0xa48978[_0x399659['name']]={'$like':'%'+_0x416d8e['query'][_0x2176('0x3b')]+'%'};return _0xa48978;}})});}_0x20d2b0=_[_0x2176('0x3d')]({},_0x20d2b0,_0x416d8e['options']);var _0x2ba0f5={'where':_0x20d2b0[_0x2176('0x3c')]};return db[_0x2176('0x2b')][_0x2176('0x21')](_0x2ba0f5)['then'](function(_0x5f0490){_0x132207[_0x2176('0x21')]=_0x5f0490;if(_0x416d8e[_0x2176('0x30')][_0x2176('0x3f')]){_0x20d2b0[_0x2176('0x40')]=[{'all':!![]}];}return db[_0x2176('0x2b')][_0x2176('0x41')](_0x20d2b0);})['then'](function(_0x28b537){_0x132207['rows']=_0x28b537;return _0x132207;})[_0x2176('0x26')](respondWithFilteredResult(_0x496121,_0x20d2b0))[_0x2176('0x42')](handleError(_0x496121,null));};exports[_0x2176('0x43')]=function(_0x4dee51,_0xd82007){var _0x589dfb={'raw':![],'where':{'id':_0x4dee51[_0x2176('0x44')]['id']}},_0xfbc855={};_0xfbc855[_0x2176('0x2e')]=_['keys'](db[_0x2176('0x2b')]['rawAttributes']);_0xfbc855[_0x2176('0x30')]=_[_0x2176('0x31')](_0x4dee51[_0x2176('0x30')]);_0xfbc855['filters']=_[_0x2176('0x33')](_0xfbc855[_0x2176('0x2e')],_0xfbc855['query']);_0x589dfb[_0x2176('0x34')]=_[_0x2176('0x33')](_0xfbc855[_0x2176('0x2e')],qs[_0x2176('0x35')](_0x4dee51[_0x2176('0x30')]['fields']));_0x589dfb[_0x2176('0x34')]=_0x589dfb['attributes'][_0x2176('0x45')]?_0x589dfb[_0x2176('0x34')]:_0xfbc855[_0x2176('0x2e')];if(_0x4dee51[_0x2176('0x30')]['includeAll']){_0x589dfb[_0x2176('0x40')]=[{'all':!![]}];}_0x589dfb=_['merge']({},_0x589dfb,_0x4dee51['options']);return db[_0x2176('0x2b')][_0x2176('0x46')](_0x589dfb)['then'](handleEntityNotFound(_0xd82007,null))[_0x2176('0x26')](respondWithResult(_0xd82007,null))[_0x2176('0x42')](handleError(_0xd82007,null));};exports['create']=function(_0x3effb8,_0x1c0e9a){return db['SugarcrmAccount'][_0x2176('0x47')](_0x3effb8[_0x2176('0x48')],{})['then'](respondWithResult(_0x1c0e9a,0xc9))['catch'](handleError(_0x1c0e9a,null));};exports[_0x2176('0x25')]=function(_0x373b93,_0x3f80c2){if(_0x373b93['body']['id']){delete _0x373b93[_0x2176('0x48')]['id'];}return db[_0x2176('0x2b')][_0x2176('0x46')]({'where':{'id':_0x373b93[_0x2176('0x44')]['id']}})[_0x2176('0x26')](handleEntityNotFound(_0x3f80c2,null))[_0x2176('0x26')](saveUpdates(_0x373b93['body'],null))[_0x2176('0x26')](respondWithResult(_0x3f80c2,null))[_0x2176('0x42')](handleError(_0x3f80c2,null));};exports['destroy']=function(_0x40ac6e,_0x1e31ed){return db[_0x2176('0x2b')]['find']({'where':{'id':_0x40ac6e['params']['id']}})[_0x2176('0x26')](handleEntityNotFound(_0x1e31ed,null))[_0x2176('0x26')](removeEntity(_0x1e31ed,null))[_0x2176('0x42')](handleError(_0x1e31ed,null));};exports[_0x2176('0x49')]=function(_0x4ebcbf,_0x4ce573,_0x702814){var _0x3f3ef6={};var _0xb9ccc8={};var _0x50543b;var _0x5576cc;return db['SugarcrmAccount'][_0x2176('0x4a')]({'where':{'id':_0x4ebcbf[_0x2176('0x44')]['id']}})[_0x2176('0x26')](handleEntityNotFound(_0x4ce573,null))[_0x2176('0x26')](function(_0xa1454c){if(_0xa1454c){_0x50543b=_0xa1454c;_0xb9ccc8[_0x2176('0x2e')]=_[_0x2176('0x31')](db[_0x2176('0x4b')][_0x2176('0x4c')]);_0xb9ccc8['query']=_[_0x2176('0x31')](_0x4ebcbf[_0x2176('0x30')]);_0xb9ccc8[_0x2176('0x32')]=_['intersection'](_0xb9ccc8[_0x2176('0x2e')],_0xb9ccc8[_0x2176('0x30')]);_0x3f3ef6[_0x2176('0x34')]=_[_0x2176('0x33')](_0xb9ccc8['model'],qs['fields'](_0x4ebcbf[_0x2176('0x30')]['fields']));_0x3f3ef6[_0x2176('0x34')]=_0x3f3ef6[_0x2176('0x34')][_0x2176('0x45')]?_0x3f3ef6['attributes']:_0xb9ccc8[_0x2176('0x2e')];_0x3f3ef6[_0x2176('0x38')]=qs[_0x2176('0x39')](_0x4ebcbf[_0x2176('0x30')][_0x2176('0x39')]);_0x3f3ef6['where']=qs[_0x2176('0x32')](_[_0x2176('0x3a')](_0x4ebcbf[_0x2176('0x30')],_0xb9ccc8[_0x2176('0x32')]));if(_0x4ebcbf[_0x2176('0x30')]['filter']){_0x3f3ef6['where']=_[_0x2176('0x3d')](_0x3f3ef6['where'],{'$or':_['map'](_0x3f3ef6[_0x2176('0x34')],function(_0x58ec9c){var _0x183324={};_0x183324[_0x58ec9c]={'$like':'%'+_0x4ebcbf[_0x2176('0x30')]['filter']+'%'};return _0x183324;})});}_0x3f3ef6=_[_0x2176('0x3d')]({},_0x3f3ef6,_0x4ebcbf['options']);return _0x50543b[_0x2176('0x49')](_0x3f3ef6);}})['then'](function(_0x52822a){if(_0x52822a){_0x5576cc=_0x52822a['length'];if(!_0x4ebcbf[_0x2176('0x30')][_0x2176('0x36')](_0x2176('0x37'))){_0x3f3ef6[_0x2176('0x20')]=qs[_0x2176('0x20')](_0x4ebcbf['query'][_0x2176('0x20')]);_0x3f3ef6['offset']=qs[_0x2176('0x1e')](_0x4ebcbf[_0x2176('0x30')][_0x2176('0x1e')]);}return _0x50543b[_0x2176('0x49')](_0x3f3ef6);}})[_0x2176('0x26')](function(_0xffb8ed){if(_0xffb8ed){return _0xffb8ed?{'count':_0x5576cc,'rows':_0xffb8ed}:null;}})[_0x2176('0x26')](respondWithResult(_0x4ce573,null))['catch'](handleError(_0x4ce573,null));};exports['addConfiguration']=function(_0x2e9761,_0x59c2e4,_0xab59a2){if(_0x2e9761[_0x2176('0x48')]['id']){delete _0x2e9761[_0x2176('0x48')]['id'];}return db[_0x2176('0x2b')][_0x2176('0x4a')]({'where':{'id':_0x2e9761[_0x2176('0x44')]['id']}})['then'](handleEntityNotFound(_0x59c2e4,null))['then'](function(_0x1533d0){if(_0x1533d0){_0x2e9761[_0x2176('0x48')][_0x2176('0x4d')]=_0x1533d0['id'];_0x2e9761[_0x2176('0x48')]['Subjects']=integrations[_0x2176('0x4e')](_0x2e9761[_0x2176('0x48')][_0x2176('0x4f')],_0x2e9761['body']['type']);_0x2e9761['body'][_0x2176('0x50')]=integrations[_0x2176('0x51')](_0x2e9761['body'][_0x2176('0x4f')],_0x2e9761['body'][_0x2176('0x2d')]);return db[_0x2176('0x4b')][_0x2176('0x47')](_0x2e9761[_0x2176('0x48')],{'include':[{'model':db[_0x2176('0x52')],'as':_0x2176('0x53')},{'model':db[_0x2176('0x52')],'as':_0x2176('0x50')}]});}return null;})['then'](respondWithResult(_0x59c2e4,null))[_0x2176('0x42')](handleError(_0x59c2e4,null));};exports[_0x2176('0x54')]=function(_0x34e163,_0x1cde63,_0x468c0f){var _0x360a0c='';var _0x164c5e=['id',_0x2176('0x28'),'assigned_user_id',_0x2176('0x55'),_0x2176('0x56'),_0x2176('0x57'),_0x2176('0x58'),'duration_minutes',_0x2176('0x59'),_0x2176('0x5a'),'parent_name',_0x2176('0x5b')];return db[_0x2176('0x2b')][_0x2176('0x4a')]({'where':{'id':_0x34e163[_0x2176('0x44')]['id']},'attributes':['id',_0x2176('0x5c'),'password','remoteUri']})[_0x2176('0x26')](handleEntityNotFound(_0x1cde63,null))[_0x2176('0x26')](function(_0x3877de){if(_0x3877de){_0x360a0c=_0x3877de['remoteUri'];var _0x2a0b90=_0x360a0c[_0x2176('0x5d')](-0x1);if(_0x2a0b90==='/'){_0x360a0c=_0x360a0c[_0x2176('0x5e')](0x0,_0x360a0c[_0x2176('0x5f')](_0x2a0b90));}return rp({'method':_0x2176('0x60'),'uri':util['format'](_0x2176('0x61'),_0x360a0c,_0x2176('0x62')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x2176('0x63'),'rest_data':JSON[_0x2176('0x64')]({'user_auth':{'user_name':_0x3877de['username'],'password':_0x3877de[_0x2176('0x65')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2176('0x26')](function(_0x43d2d8){if(_0x43d2d8&&_0x43d2d8[_0x2176('0x28')]!==_0x2176('0x66')&&_0x43d2d8[_0x2176('0x28')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x2176('0x67')](_0x2176('0x61'),_0x360a0c,_0x2176('0x62')),'json':!![],'form':{'method':_0x2176('0x68'),'input_type':_0x2176('0x63'),'response_type':'JSON','rest_data':JSON[_0x2176('0x64')]({'session':_0x43d2d8['id'],'module_name':_0x2176('0x69')})}})[_0x2176('0x26')](function(_0x234c82){if(_0x234c82){var _0xbfe494=_['values'](_0x234c82[_0x2176('0x6a')]);_['remove'](_0xbfe494,function(_0x1600e8){return _0x164c5e[_0x2176('0x6b')](_0x1600e8[_0x2176('0x28')]);});return{'count':_0xbfe494[_0x2176('0x45')],'rows':_[_0x2176('0x2f')](_0xbfe494,function(_0x48231c){return{'id':_0x48231c[_0x2176('0x28')],'name':_0x48231c[_0x2176('0x6c')],'custom':_[_0x2176('0x6d')](_0x48231c[_0x2176('0x28')],'_c')?!![]:![],'options':_0x48231c[_0x2176('0x6e')]?_[_0x2176('0x2f')](_[_0x2176('0x6f')](_0x48231c['options']),function(_0x518df0){return{'name':_0x518df0[_0x2176('0x70')],'value':_0x518df0[_0x2176('0x28')]};}):[]};})};}})[_0x2176('0x26')](respondWithResult(_0x1cde63,null))[_0x2176('0x42')](function(_0x3fc950){var _0x299540=_0x34e163['query'][_0x2176('0x71')]?0x1f4:_0x3fc950['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2176('0x54'),_0x299540,JSON['stringify'](_0x3fc950));delete _0x3fc950[_0x2176('0x28')];if(_0x299540===0x191){_0x299540=0x190;}_0x1cde63[_0x2176('0x1b')](_0x299540)[_0x2176('0x29')](_0x34e163[_0x2176('0x30')][_0x2176('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x3fc950[_0x2176('0x72')]}:_0x3fc950);});}else{var _0x2a022e=0x1f4;_0x1cde63[_0x2176('0x1b')](_0x2a022e)[_0x2176('0x29')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x02c5=['SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','values','module_fields','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SugarcrmAccount','rows','catch','params','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x02c5,0x178));var _0x502c=function(_0x86ba06,_0x2e50d9){_0x86ba06=_0x86ba06-0x0;var _0xafb44a=_0x02c5[_0x86ba06];return _0xafb44a;};'use strict';var emlformat=require(_0x502c('0x0'));var rimraf=require(_0x502c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x502c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x502c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x502c('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x502c('0x5'));var crypto=require(_0x502c('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x502c('0x7'));var toCsv=require(_0x502c('0x8'));var querystring=require(_0x502c('0x9'));var Papa=require(_0x502c('0xa'));var Redis=require(_0x502c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x502c('0xc'));var as=require(_0x502c('0xd'));var hardwareService=require(_0x502c('0xe'));var logger=require(_0x502c('0xf'))(_0x502c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x502c('0x11'))['db'];var integrations=require(_0x502c('0x12'));function respondWithStatusCode(_0x13fc9d,_0x433411){_0x433411=_0x433411||0xcc;return function(_0x21b64c){if(_0x21b64c){return _0x13fc9d[_0x502c('0x13')](_0x433411);}return _0x13fc9d[_0x502c('0x14')](_0x433411)[_0x502c('0x15')]();};}function respondWithResult(_0x5ccd04,_0x596d18){_0x596d18=_0x596d18||0xc8;return function(_0x4a7709){if(_0x4a7709){return _0x5ccd04[_0x502c('0x14')](_0x596d18)[_0x502c('0x16')](_0x4a7709);}};}function respondWithFilteredResult(_0x4243c3,_0x4c1e54){return function(_0x5957bc){if(_0x5957bc){var _0x29247f=typeof _0x4c1e54[_0x502c('0x17')]===_0x502c('0x18')&&typeof _0x4c1e54[_0x502c('0x19')]===_0x502c('0x18');var _0x5479cc=_0x5957bc[_0x502c('0x1a')];var _0x11162e=_0x29247f?0x0:_0x4c1e54[_0x502c('0x17')];var _0x26d071=_0x29247f?_0x5957bc[_0x502c('0x1a')]:_0x4c1e54[_0x502c('0x17')]+_0x4c1e54[_0x502c('0x19')];var _0x3aa2ea;if(_0x26d071>=_0x5479cc){_0x26d071=_0x5479cc;_0x3aa2ea=0xc8;}else{_0x3aa2ea=0xce;}_0x4243c3[_0x502c('0x14')](_0x3aa2ea);return _0x4243c3['set'](_0x502c('0x1b'),_0x11162e+'-'+_0x26d071+'/'+_0x5479cc)['json'](_0x5957bc);}return null;};}function patchUpdates(_0x5060d3){return function(_0x4566ca){try{jsonpatch['apply'](_0x4566ca,_0x5060d3,!![]);}catch(_0x5480b0){return BPromise[_0x502c('0x1c')](_0x5480b0);}return _0x4566ca['save']();};}function saveUpdates(_0x2e02d6,_0xc85299){return function(_0x2ed355){if(_0x2ed355){return _0x2ed355[_0x502c('0x1d')](_0x2e02d6)[_0x502c('0x1e')](function(_0x2a1d4b){return _0x2a1d4b;});}return null;};}function removeEntity(_0x99aafa,_0x4e6e71){return function(_0x442bc8){if(_0x442bc8){return _0x442bc8[_0x502c('0x1f')]()[_0x502c('0x1e')](function(){_0x99aafa[_0x502c('0x14')](0xcc)[_0x502c('0x15')]();});}};}function handleEntityNotFound(_0x526ccf,_0x3ac457){return function(_0xcfdac2){if(!_0xcfdac2){_0x526ccf[_0x502c('0x13')](0x194);}return _0xcfdac2;};}function handleError(_0x28e679,_0x1f63a7){_0x1f63a7=_0x1f63a7||0x1f4;return function(_0x45b3d4){logger[_0x502c('0x20')](_0x45b3d4[_0x502c('0x21')]);if(_0x45b3d4['name']){delete _0x45b3d4[_0x502c('0x22')];}_0x28e679[_0x502c('0x14')](_0x1f63a7)['send'](_0x45b3d4);};}exports[_0x502c('0x23')]=function(_0x512b87,_0x48ac49){var _0x20879d={},_0x14a22c={},_0x31cf73={'count':0x0,'rows':[]};var _0x5d776f=_[_0x502c('0x24')](db['SugarcrmAccount'][_0x502c('0x25')],function(_0x1d2395){return{'name':_0x1d2395['fieldName'],'type':_0x1d2395[_0x502c('0x26')][_0x502c('0x27')]};});_0x14a22c[_0x502c('0x28')]=_[_0x502c('0x24')](_0x5d776f,_0x502c('0x22'));_0x14a22c[_0x502c('0x29')]=_[_0x502c('0x2a')](_0x512b87[_0x502c('0x29')]);_0x14a22c[_0x502c('0x2b')]=_['intersection'](_0x14a22c[_0x502c('0x28')],_0x14a22c[_0x502c('0x29')]);_0x20879d[_0x502c('0x2c')]=_[_0x502c('0x2d')](_0x14a22c[_0x502c('0x28')],qs[_0x502c('0x2e')](_0x512b87['query']['fields']));_0x20879d[_0x502c('0x2c')]=_0x20879d[_0x502c('0x2c')][_0x502c('0x2f')]?_0x20879d[_0x502c('0x2c')]:_0x14a22c[_0x502c('0x28')];if(!_0x512b87[_0x502c('0x29')][_0x502c('0x30')](_0x502c('0x31'))){_0x20879d['limit']=qs[_0x502c('0x19')](_0x512b87['query']['limit']);_0x20879d['offset']=qs['offset'](_0x512b87['query'][_0x502c('0x17')]);}_0x20879d[_0x502c('0x32')]=qs[_0x502c('0x33')](_0x512b87[_0x502c('0x29')][_0x502c('0x33')]);_0x20879d[_0x502c('0x34')]=qs[_0x502c('0x2b')](_[_0x502c('0x35')](_0x512b87[_0x502c('0x29')],_0x14a22c[_0x502c('0x2b')]),_0x5d776f);if(_0x512b87[_0x502c('0x29')][_0x502c('0x36')]){_0x20879d[_0x502c('0x34')]=_[_0x502c('0x37')](_0x20879d[_0x502c('0x34')],{'$or':_[_0x502c('0x24')](_0x5d776f,function(_0x8414ba){if(_0x8414ba[_0x502c('0x26')]!=='VIRTUAL'){var _0x16b79b={};_0x16b79b[_0x8414ba[_0x502c('0x22')]]={'$like':'%'+_0x512b87[_0x502c('0x29')][_0x502c('0x36')]+'%'};return _0x16b79b;}})});}_0x20879d=_['merge']({},_0x20879d,_0x512b87[_0x502c('0x38')]);var _0x4182a6={'where':_0x20879d['where']};return db['SugarcrmAccount'][_0x502c('0x1a')](_0x4182a6)['then'](function(_0x40b911){_0x31cf73[_0x502c('0x1a')]=_0x40b911;if(_0x512b87['query'][_0x502c('0x39')]){_0x20879d[_0x502c('0x3a')]=[{'all':!![]}];}return db[_0x502c('0x3b')]['findAll'](_0x20879d);})[_0x502c('0x1e')](function(_0x13f452){_0x31cf73[_0x502c('0x3c')]=_0x13f452;return _0x31cf73;})[_0x502c('0x1e')](respondWithFilteredResult(_0x48ac49,_0x20879d))[_0x502c('0x3d')](handleError(_0x48ac49,null));};exports['show']=function(_0x54d0bd,_0x2b47a3){var _0x2edf1a={'raw':![],'where':{'id':_0x54d0bd[_0x502c('0x3e')]['id']}},_0x2cbe8c={};_0x2cbe8c[_0x502c('0x28')]=_['keys'](db[_0x502c('0x3b')][_0x502c('0x25')]);_0x2cbe8c[_0x502c('0x29')]=_['keys'](_0x54d0bd[_0x502c('0x29')]);_0x2cbe8c[_0x502c('0x2b')]=_['intersection'](_0x2cbe8c[_0x502c('0x28')],_0x2cbe8c['query']);_0x2edf1a[_0x502c('0x2c')]=_[_0x502c('0x2d')](_0x2cbe8c['model'],qs[_0x502c('0x2e')](_0x54d0bd[_0x502c('0x29')][_0x502c('0x2e')]));_0x2edf1a[_0x502c('0x2c')]=_0x2edf1a[_0x502c('0x2c')][_0x502c('0x2f')]?_0x2edf1a[_0x502c('0x2c')]:_0x2cbe8c[_0x502c('0x28')];if(_0x54d0bd[_0x502c('0x29')][_0x502c('0x39')]){_0x2edf1a[_0x502c('0x3a')]=[{'all':!![]}];}_0x2edf1a=_[_0x502c('0x37')]({},_0x2edf1a,_0x54d0bd[_0x502c('0x38')]);return db['SugarcrmAccount']['find'](_0x2edf1a)[_0x502c('0x1e')](handleEntityNotFound(_0x2b47a3,null))[_0x502c('0x1e')](respondWithResult(_0x2b47a3,null))[_0x502c('0x3d')](handleError(_0x2b47a3,null));};exports[_0x502c('0x3f')]=function(_0x49147e,_0x478245){return db[_0x502c('0x3b')][_0x502c('0x3f')](_0x49147e[_0x502c('0x40')],{})[_0x502c('0x1e')](respondWithResult(_0x478245,0xc9))[_0x502c('0x3d')](handleError(_0x478245,null));};exports['update']=function(_0x2cd8c1,_0x5ad994){if(_0x2cd8c1[_0x502c('0x40')]['id']){delete _0x2cd8c1[_0x502c('0x40')]['id'];}return db[_0x502c('0x3b')][_0x502c('0x41')]({'where':{'id':_0x2cd8c1[_0x502c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ad994,null))[_0x502c('0x1e')](saveUpdates(_0x2cd8c1[_0x502c('0x40')],null))[_0x502c('0x1e')](respondWithResult(_0x5ad994,null))[_0x502c('0x3d')](handleError(_0x5ad994,null));};exports[_0x502c('0x1f')]=function(_0x4ac16e,_0x1f0b56){return db['SugarcrmAccount'][_0x502c('0x41')]({'where':{'id':_0x4ac16e[_0x502c('0x3e')]['id']}})[_0x502c('0x1e')](handleEntityNotFound(_0x1f0b56,null))['then'](removeEntity(_0x1f0b56,null))[_0x502c('0x3d')](handleError(_0x1f0b56,null));};exports[_0x502c('0x42')]=function(_0x3cac50,_0x28fcc5,_0x37bab2){var _0x1ae4c9={};var _0x4de0a5={};var _0x49f545;var _0x420095;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3cac50[_0x502c('0x3e')]['id']}})[_0x502c('0x1e')](handleEntityNotFound(_0x28fcc5,null))['then'](function(_0x44ee78){if(_0x44ee78){_0x49f545=_0x44ee78;_0x4de0a5[_0x502c('0x28')]=_[_0x502c('0x2a')](db['SugarcrmConfiguration']['rawAttributes']);_0x4de0a5[_0x502c('0x29')]=_['keys'](_0x3cac50['query']);_0x4de0a5[_0x502c('0x2b')]=_[_0x502c('0x2d')](_0x4de0a5[_0x502c('0x28')],_0x4de0a5[_0x502c('0x29')]);_0x1ae4c9[_0x502c('0x2c')]=_[_0x502c('0x2d')](_0x4de0a5[_0x502c('0x28')],qs[_0x502c('0x2e')](_0x3cac50[_0x502c('0x29')][_0x502c('0x2e')]));_0x1ae4c9[_0x502c('0x2c')]=_0x1ae4c9[_0x502c('0x2c')][_0x502c('0x2f')]?_0x1ae4c9[_0x502c('0x2c')]:_0x4de0a5[_0x502c('0x28')];_0x1ae4c9[_0x502c('0x32')]=qs[_0x502c('0x33')](_0x3cac50['query']['sort']);_0x1ae4c9[_0x502c('0x34')]=qs[_0x502c('0x2b')](_[_0x502c('0x35')](_0x3cac50[_0x502c('0x29')],_0x4de0a5[_0x502c('0x2b')]));if(_0x3cac50[_0x502c('0x29')][_0x502c('0x36')]){_0x1ae4c9[_0x502c('0x34')]=_[_0x502c('0x37')](_0x1ae4c9[_0x502c('0x34')],{'$or':_['map'](_0x1ae4c9[_0x502c('0x2c')],function(_0xbbc1f2){var _0x3a93ee={};_0x3a93ee[_0xbbc1f2]={'$like':'%'+_0x3cac50[_0x502c('0x29')][_0x502c('0x36')]+'%'};return _0x3a93ee;})});}_0x1ae4c9=_[_0x502c('0x37')]({},_0x1ae4c9,_0x3cac50['options']);return _0x49f545[_0x502c('0x42')](_0x1ae4c9);}})[_0x502c('0x1e')](function(_0x1982b9){if(_0x1982b9){_0x420095=_0x1982b9[_0x502c('0x2f')];if(!_0x3cac50['query'][_0x502c('0x30')](_0x502c('0x31'))){_0x1ae4c9[_0x502c('0x19')]=qs[_0x502c('0x19')](_0x3cac50['query'][_0x502c('0x19')]);_0x1ae4c9[_0x502c('0x17')]=qs['offset'](_0x3cac50[_0x502c('0x29')][_0x502c('0x17')]);}return _0x49f545[_0x502c('0x42')](_0x1ae4c9);}})[_0x502c('0x1e')](function(_0x59112b){if(_0x59112b){return _0x59112b?{'count':_0x420095,'rows':_0x59112b}:null;}})[_0x502c('0x1e')](respondWithResult(_0x28fcc5,null))[_0x502c('0x3d')](handleError(_0x28fcc5,null));};exports[_0x502c('0x43')]=function(_0x58c128,_0x31456f,_0x4fd740){if(_0x58c128[_0x502c('0x40')]['id']){delete _0x58c128['body']['id'];}return db['SugarcrmAccount'][_0x502c('0x44')]({'where':{'id':_0x58c128[_0x502c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x31456f,null))[_0x502c('0x1e')](function(_0x3da432){if(_0x3da432){_0x58c128[_0x502c('0x40')][_0x502c('0x45')]=_0x3da432['id'];_0x58c128[_0x502c('0x40')][_0x502c('0x46')]=integrations[_0x502c('0x47')](_0x58c128[_0x502c('0x40')][_0x502c('0x48')],_0x58c128['body']['type']);_0x58c128['body'][_0x502c('0x49')]=integrations[_0x502c('0x4a')](_0x58c128[_0x502c('0x40')][_0x502c('0x48')],_0x58c128[_0x502c('0x40')][_0x502c('0x26')]);return db[_0x502c('0x4b')][_0x502c('0x3f')](_0x58c128[_0x502c('0x40')],{'include':[{'model':db['SugarcrmField'],'as':_0x502c('0x46')},{'model':db[_0x502c('0x4c')],'as':_0x502c('0x49')}]});}return null;})['then'](respondWithResult(_0x31456f,null))[_0x502c('0x3d')](handleError(_0x31456f,null));};exports['getFields']=function(_0x59e9f6,_0x165894,_0x21305d){var _0x13f0db='';var _0x331a59=['id','name',_0x502c('0x4d'),_0x502c('0x4e'),_0x502c('0x4f'),_0x502c('0x50'),_0x502c('0x51'),'duration_minutes',_0x502c('0x52'),_0x502c('0x53'),_0x502c('0x54'),_0x502c('0x55')];return db[_0x502c('0x3b')]['findOne']({'where':{'id':_0x59e9f6[_0x502c('0x3e')]['id']},'attributes':['id',_0x502c('0x56'),_0x502c('0x57'),_0x502c('0x58')]})[_0x502c('0x1e')](handleEntityNotFound(_0x165894,null))[_0x502c('0x1e')](function(_0x2ac822){if(_0x2ac822){_0x13f0db=_0x2ac822[_0x502c('0x58')];var _0x498bd3=_0x13f0db[_0x502c('0x59')](-0x1);if(_0x498bd3==='/'){_0x13f0db=_0x13f0db[_0x502c('0x5a')](0x0,_0x13f0db[_0x502c('0x5b')](_0x498bd3));}return rp({'method':_0x502c('0x5c'),'uri':util[_0x502c('0x5d')](_0x502c('0x5e'),_0x13f0db,_0x502c('0x5f')),'json':!![],'form':{'method':'login','input_type':_0x502c('0x60'),'response_type':_0x502c('0x60'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2ac822[_0x502c('0x56')],'password':_0x2ac822[_0x502c('0x57')],'encryption':'PLAIN'},'application':_0x502c('0x61')})}});}})[_0x502c('0x1e')](function(_0x9f0e){if(_0x9f0e&&_0x9f0e[_0x502c('0x22')]!==_0x502c('0x62')&&_0x9f0e[_0x502c('0x22')]!==_0x502c('0x63')){return rp({'method':_0x502c('0x5c'),'uri':util[_0x502c('0x5d')]('%s%s',_0x13f0db,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x502c('0x64'),'input_type':_0x502c('0x60'),'response_type':_0x502c('0x60'),'rest_data':JSON[_0x502c('0x65')]({'session':_0x9f0e['id'],'module_name':_0x502c('0x66')})}})[_0x502c('0x1e')](function(_0x864636){if(_0x864636){var _0x3647df=_[_0x502c('0x67')](_0x864636[_0x502c('0x68')]);_['remove'](_0x3647df,function(_0x1ff020){return _0x331a59['includes'](_0x1ff020[_0x502c('0x22')]);});return{'count':_0x3647df['length'],'rows':_[_0x502c('0x24')](_0x3647df,function(_0x3aa0d8){return{'id':_0x3aa0d8[_0x502c('0x22')],'name':_0x3aa0d8['label'],'custom':_[_0x502c('0x69')](_0x3aa0d8[_0x502c('0x22')],'_c')?!![]:![],'options':_0x3aa0d8[_0x502c('0x38')]?_[_0x502c('0x24')](_[_0x502c('0x67')](_0x3aa0d8[_0x502c('0x38')]),function(_0x5a519b){return{'name':_0x5a519b[_0x502c('0x6a')],'value':_0x5a519b[_0x502c('0x22')]};}):[]};})};}})[_0x502c('0x1e')](respondWithResult(_0x165894,null))[_0x502c('0x3d')](function(_0x157227){var _0x9c7bd5=_0x59e9f6['query'][_0x502c('0x6b')]?0x1f4:_0x157227[_0x502c('0x6c')]||0x1f4;logger[_0x502c('0x20')](_0x502c('0x6d'),_0x502c('0x6e'),_0x9c7bd5,JSON[_0x502c('0x65')](_0x157227));delete _0x157227['name'];if(_0x9c7bd5===0x191){_0x9c7bd5=0x190;}_0x165894[_0x502c('0x14')](_0x9c7bd5)[_0x502c('0x6f')](_0x59e9f6[_0x502c('0x29')][_0x502c('0x6b')]?{'message':_0x502c('0x70'),'statusCode':_0x157227[_0x502c('0x6c')]}:_0x157227);});}else{var _0x254720=0x1f4;_0x165894['status'](_0x254720)[_0x502c('0x6f')]({'message':_0x502c('0x70'),'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 2e45b53..977c230 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 _0xc8f2=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x183aea,_0x2a88b5){var _0x1ea092=function(_0x126028){while(--_0x126028){_0x183aea['push'](_0x183aea['shift']());}};_0x1ea092(++_0x2a88b5);}(_0xc8f2,0x120));var _0x2c8f=function(_0x594ce8,_0x5a5931){_0x594ce8=_0x594ce8-0x0;var _0x565556=_0xc8f2[_0x594ce8];return _0x565556;};'use strict';var _=require(_0x2c8f('0x0'));var util=require('util');var logger=require(_0x2c8f('0x1'))(_0x2c8f('0x2'));var moment=require(_0x2c8f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c8f('0x4'));var rimraf=require(_0x2c8f('0x5'));var config=require(_0x2c8f('0x6'));var attributes=require(_0x2c8f('0x7'));var integrations=require(_0x2c8f('0x8'));module[_0x2c8f('0x9')]=function(_0x3be988,_0x5c547c){return _0x3be988[_0x2c8f('0xa')](_0x2c8f('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaef=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','lodash'];(function(_0x25df99,_0x4c4480){var _0x35b6a6=function(_0x5a14ec){while(--_0x5a14ec){_0x25df99['push'](_0x25df99['shift']());}};_0x35b6a6(++_0x4c4480);}(_0xeaef,0xfb));var _0xfeae=function(_0x3b30ea,_0x28812f){_0x3b30ea=_0x3b30ea-0x0;var _0x2046b2=_0xeaef[_0x3b30ea];return _0x2046b2;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var logger=require(_0xfeae('0x2'))(_0xfeae('0x3'));var moment=require(_0xfeae('0x4'));var BPromise=require(_0xfeae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfeae('0x6'));var rimraf=require(_0xfeae('0x7'));var config=require(_0xfeae('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xfeae('0x9'));module[_0xfeae('0xa')]=function(_0x2ac280,_0x4571f8){return _0x2ac280[_0xfeae('0xb')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1a2777b..7890f3c 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 _0x812b=['limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','SugarcrmAccount','options','where','attributes'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x812b,0x1cf));var _0xb812=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x812b[_0x4c8a8f];return _0x404500;};'use strict';var _=require(_0xb812('0x0'));var util=require(_0xb812('0x1'));var moment=require(_0xb812('0x2'));var BPromise=require(_0xb812('0x3'));var rs=require(_0xb812('0x4'));var fs=require('fs');var Redis=require(_0xb812('0x5'));var db=require(_0xb812('0x6'))['db'];var utils=require(_0xb812('0x7'));var logger=require(_0xb812('0x8'))(_0xb812('0x9'));var config=require('../../config/environment');var jayson=require(_0xb812('0xa'));var client=jayson['client'][_0xb812('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5783b6,_0x4b4f9e,_0x505d16){return new BPromise(function(_0x576520,_0x1d36df){return client[_0xb812('0xc')](_0x5783b6,_0x505d16)[_0xb812('0xd')](function(_0x21416a){logger[_0xb812('0xe')](_0xb812('0xf'),_0x4b4f9e,'request\x20sent');logger[_0xb812('0x10')](_0xb812('0x11'),_0x4b4f9e,_0xb812('0x12'),JSON[_0xb812('0x13')](_0x21416a));if(_0x21416a[_0xb812('0x14')]){if(_0x21416a['error']['code']===0x1f4){logger[_0xb812('0x14')](_0xb812('0xf'),_0x4b4f9e,_0x21416a['error']['message']);return _0x1d36df(_0x21416a[_0xb812('0x14')][_0xb812('0x15')]);}logger[_0xb812('0x14')](_0xb812('0xf'),_0x4b4f9e,_0x21416a[_0xb812('0x14')]['message']);return _0x576520(_0x21416a['error'][_0xb812('0x15')]);}else{logger[_0xb812('0xe')](_0xb812('0xf'),_0x4b4f9e,_0xb812('0x12'));_0x576520(_0x21416a[_0xb812('0x16')][_0xb812('0x15')]);}})['catch'](function(_0x18d90e){logger[_0xb812('0x14')](_0xb812('0xf'),_0x4b4f9e,_0x18d90e);_0x1d36df(_0x18d90e);});});}exports['GetSugarcrmAccount']=function(_0x33a3ca){var _0x573a57=this;return new Promise(function(_0x278a43,_0x1b32f6){return db[_0xb812('0x17')]['findAll']({'raw':_0x33a3ca[_0xb812('0x18')]?_0x33a3ca[_0xb812('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x33a3ca[_0xb812('0x18')]?_0x33a3ca[_0xb812('0x18')][_0xb812('0x19')]||null:null,'attributes':_0x33a3ca[_0xb812('0x18')]?_0x33a3ca[_0xb812('0x18')][_0xb812('0x1a')]||null:null,'limit':_0x33a3ca[_0xb812('0x18')]?_0x33a3ca['options'][_0xb812('0x1b')]||null:null,'include':_0x33a3ca[_0xb812('0x18')]?_0x33a3ca[_0xb812('0x18')][_0xb812('0x1c')]?_[_0xb812('0x1d')](_0x33a3ca[_0xb812('0x18')]['include'],function(_0x50b519){return{'model':db[_0x50b519[_0xb812('0x1e')]],'as':_0x50b519['as'],'attributes':_0x50b519[_0xb812('0x1a')],'include':_0x50b519[_0xb812('0x1c')]?_[_0xb812('0x1d')](_0x50b519[_0xb812('0x1c')],function(_0x390cf6){return{'model':db[_0x390cf6[_0xb812('0x1e')]],'as':_0x390cf6['as'],'attributes':_0x390cf6[_0xb812('0x1a')],'include':_0x390cf6['include']?_[_0xb812('0x1d')](_0x390cf6['include'],function(_0x2dc068){return{'model':db[_0x2dc068[_0xb812('0x1e')]],'as':_0x2dc068['as'],'attributes':_0x2dc068[_0xb812('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb812('0xd')](function(_0x3cc3cf){logger[_0xb812('0xe')](_0xb812('0x1f'),_0x33a3ca);logger[_0xb812('0x10')](_0xb812('0x1f'),_0x33a3ca,JSON[_0xb812('0x13')](_0x3cc3cf));_0x278a43(_0x3cc3cf);})['catch'](function(_0x2dbf41){logger['error']('GetSugarcrmAccount',_0x2dbf41[_0xb812('0x15')],_0x33a3ca);_0x1b32f6(_0x573a57[_0xb812('0x14')](0x1f4,_0x2dbf41[_0xb812('0x15')]));});});};exports[_0xb812('0x20')]=function(_0xd6f117){var _0x2e6ef6=this;return new Promise(function(_0x17b497,_0x3541c8){return db[_0xb812('0x17')][_0xb812('0x21')]({'raw':_0xd6f117['options']?_0xd6f117[_0xb812('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd6f117[_0xb812('0x18')]?_0xd6f117[_0xb812('0x18')][_0xb812('0x19')]||null:null,'attributes':_0xd6f117[_0xb812('0x18')]?_0xd6f117['options'][_0xb812('0x1a')]||null:null,'include':_0xd6f117[_0xb812('0x18')]?_0xd6f117['options'][_0xb812('0x1c')]?_[_0xb812('0x1d')](_0xd6f117['options'][_0xb812('0x1c')],function(_0x312d69){return{'model':db[_0x312d69[_0xb812('0x1e')]],'as':_0x312d69['as'],'attributes':_0x312d69[_0xb812('0x1a')],'include':_0x312d69['include']?_[_0xb812('0x1d')](_0x312d69[_0xb812('0x1c')],function(_0x2bfd8d){return{'model':db[_0x2bfd8d[_0xb812('0x1e')]],'as':_0x2bfd8d['as'],'attributes':_0x2bfd8d[_0xb812('0x1a')],'include':_0x2bfd8d['include']?_[_0xb812('0x1d')](_0x2bfd8d['include'],function(_0x1a01c3){return{'model':db[_0x1a01c3[_0xb812('0x1e')]],'as':_0x1a01c3['as'],'attributes':_0x1a01c3[_0xb812('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb812('0xd')](function(_0x4b1ae0){logger[_0xb812('0xe')]('ShowSugarcrmAccount',_0xd6f117);logger[_0xb812('0x10')](_0xb812('0x20'),_0xd6f117,JSON[_0xb812('0x13')](_0x4b1ae0));_0x17b497(_0x4b1ae0);})[_0xb812('0x22')](function(_0x1c00d6){logger['error'](_0xb812('0x20'),_0x1c00d6['message'],_0xd6f117);_0x3541c8(_0x2e6ef6[_0xb812('0x14')](0x1f4,_0x1c00d6[_0xb812('0x15')]));});});}; \ No newline at end of file +var _0x24b1=['error','code','message','result','SugarcrmAccount','findAll','options','raw','attributes','include','map','model','then','GetSugarcrmAccount','debug','catch','ShowSugarcrmAccount','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3ae482,_0xd0ed4f){var _0x10debf=function(_0x417aef){while(--_0x417aef){_0x3ae482['push'](_0x3ae482['shift']());}};_0x10debf(++_0xd0ed4f);}(_0x24b1,0x1ee));var _0x124b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x24b1[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x124b('0x0'));var util=require(_0x124b('0x1'));var moment=require('moment');var BPromise=require(_0x124b('0x2'));var rs=require(_0x124b('0x3'));var fs=require('fs');var Redis=require(_0x124b('0x4'));var db=require(_0x124b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x124b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x124b('0x7'));var client=jayson[_0x124b('0x8')][_0x124b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15e9e8,_0x253ef7,_0x2c86f0){return new BPromise(function(_0x1a432e,_0x2243c9){return client[_0x124b('0xa')](_0x15e9e8,_0x2c86f0)['then'](function(_0x30cb3e){logger[_0x124b('0xb')](_0x124b('0xc'),_0x253ef7,'request\x20sent');logger['debug'](_0x124b('0xd'),_0x253ef7,_0x124b('0xe'),JSON[_0x124b('0xf')](_0x30cb3e));if(_0x30cb3e[_0x124b('0x10')]){if(_0x30cb3e[_0x124b('0x10')][_0x124b('0x11')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x253ef7,_0x30cb3e[_0x124b('0x10')][_0x124b('0x12')]);return _0x2243c9(_0x30cb3e[_0x124b('0x10')][_0x124b('0x12')]);}logger[_0x124b('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x253ef7,_0x30cb3e[_0x124b('0x10')][_0x124b('0x12')]);return _0x1a432e(_0x30cb3e[_0x124b('0x10')]['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x253ef7,_0x124b('0xe'));_0x1a432e(_0x30cb3e[_0x124b('0x13')][_0x124b('0x12')]);}})['catch'](function(_0x5eb4b8){logger[_0x124b('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x253ef7,_0x5eb4b8);_0x2243c9(_0x5eb4b8);});});}exports['GetSugarcrmAccount']=function(_0x205238){var _0x39d33e=this;return new Promise(function(_0x12e423,_0x57d20f){return db[_0x124b('0x14')][_0x124b('0x15')]({'raw':_0x205238[_0x124b('0x16')]?_0x205238[_0x124b('0x16')][_0x124b('0x17')]===undefined?!![]:![]:!![],'where':_0x205238[_0x124b('0x16')]?_0x205238[_0x124b('0x16')]['where']||null:null,'attributes':_0x205238['options']?_0x205238['options'][_0x124b('0x18')]||null:null,'limit':_0x205238[_0x124b('0x16')]?_0x205238['options']['limit']||null:null,'include':_0x205238[_0x124b('0x16')]?_0x205238[_0x124b('0x16')][_0x124b('0x19')]?_[_0x124b('0x1a')](_0x205238['options'][_0x124b('0x19')],function(_0x1ffbbe){return{'model':db[_0x1ffbbe[_0x124b('0x1b')]],'as':_0x1ffbbe['as'],'attributes':_0x1ffbbe[_0x124b('0x18')],'include':_0x1ffbbe[_0x124b('0x19')]?_[_0x124b('0x1a')](_0x1ffbbe[_0x124b('0x19')],function(_0x55a12f){return{'model':db[_0x55a12f[_0x124b('0x1b')]],'as':_0x55a12f['as'],'attributes':_0x55a12f['attributes'],'include':_0x55a12f[_0x124b('0x19')]?_[_0x124b('0x1a')](_0x55a12f[_0x124b('0x19')],function(_0x416112){return{'model':db[_0x416112[_0x124b('0x1b')]],'as':_0x416112['as'],'attributes':_0x416112[_0x124b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x124b('0x1c')](function(_0x3a2b32){logger[_0x124b('0xb')](_0x124b('0x1d'),_0x205238);logger[_0x124b('0x1e')]('GetSugarcrmAccount',_0x205238,JSON[_0x124b('0xf')](_0x3a2b32));_0x12e423(_0x3a2b32);})[_0x124b('0x1f')](function(_0x45b05c){logger[_0x124b('0x10')]('GetSugarcrmAccount',_0x45b05c[_0x124b('0x12')],_0x205238);_0x57d20f(_0x39d33e[_0x124b('0x10')](0x1f4,_0x45b05c[_0x124b('0x12')]));});});};exports[_0x124b('0x20')]=function(_0x3eed32){var _0x260da3=this;return new Promise(function(_0xea4638,_0x1c2756){return db[_0x124b('0x14')]['find']({'raw':_0x3eed32['options']?_0x3eed32[_0x124b('0x16')][_0x124b('0x17')]===undefined?!![]:![]:!![],'where':_0x3eed32[_0x124b('0x16')]?_0x3eed32[_0x124b('0x16')][_0x124b('0x21')]||null:null,'attributes':_0x3eed32[_0x124b('0x16')]?_0x3eed32[_0x124b('0x16')][_0x124b('0x18')]||null:null,'include':_0x3eed32[_0x124b('0x16')]?_0x3eed32[_0x124b('0x16')][_0x124b('0x19')]?_[_0x124b('0x1a')](_0x3eed32[_0x124b('0x16')][_0x124b('0x19')],function(_0x119149){return{'model':db[_0x119149['model']],'as':_0x119149['as'],'attributes':_0x119149[_0x124b('0x18')],'include':_0x119149['include']?_[_0x124b('0x1a')](_0x119149[_0x124b('0x19')],function(_0x28ca4b){return{'model':db[_0x28ca4b[_0x124b('0x1b')]],'as':_0x28ca4b['as'],'attributes':_0x28ca4b['attributes'],'include':_0x28ca4b[_0x124b('0x19')]?_[_0x124b('0x1a')](_0x28ca4b[_0x124b('0x19')],function(_0x438a87){return{'model':db[_0x438a87[_0x124b('0x1b')]],'as':_0x438a87['as'],'attributes':_0x438a87[_0x124b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x124b('0x1c')](function(_0x3910f9){logger[_0x124b('0xb')]('ShowSugarcrmAccount',_0x3eed32);logger[_0x124b('0x1e')](_0x124b('0x20'),_0x3eed32,JSON[_0x124b('0xf')](_0x3910f9));_0xea4638(_0x3910f9);})[_0x124b('0x1f')](function(_0x161635){logger[_0x124b('0x10')](_0x124b('0x20'),_0x161635[_0x124b('0x12')],_0x3eed32);_0x1c2756(_0x260da3['error'](0x1f4,_0x161635['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 097b344..4191e8d 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 _0x378c=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x378c,0x137));var _0xc378=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x378c[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xc378('0x0'));var util=require(_0xc378('0x1'));var path=require('path');var timeout=require(_0xc378('0x2'));var express=require(_0xc378('0x3'));var router=express[_0xc378('0x4')]();var fs_extra=require(_0xc378('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc378('0x6'));var controller=require(_0xc378('0x7'));router[_0xc378('0x8')]('/',auth[_0xc378('0x9')](),controller[_0xc378('0xa')]);router[_0xc378('0x8')](_0xc378('0xb'),auth[_0xc378('0x9')](),controller[_0xc378('0xc')]);router['get'](_0xc378('0xd'),auth[_0xc378('0x9')](),controller[_0xc378('0xe')]);router[_0xc378('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xc378('0xf')]);router[_0xc378('0x8')](_0xc378('0x10'),auth[_0xc378('0x9')](),controller['getDescriptions']);router[_0xc378('0x11')]('/',auth[_0xc378('0x9')](),controller[_0xc378('0x12')]);router[_0xc378('0x13')](_0xc378('0xb'),auth[_0xc378('0x9')](),controller[_0xc378('0x14')]);router[_0xc378('0x15')]('/:id',auth[_0xc378('0x9')](),controller[_0xc378('0x16')]);module['exports']=router; \ No newline at end of file +var _0x384b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/descriptions','post','put','update','delete','destroy','exports'];(function(_0x4ac2ce,_0x55d1ec){var _0x3d10e1=function(_0x413aca){while(--_0x413aca){_0x4ac2ce['push'](_0x4ac2ce['shift']());}};_0x3d10e1(++_0x55d1ec);}(_0x384b,0x108));var _0xb384=function(_0x2d2672,_0x446e75){_0x2d2672=_0x2d2672-0x0;var _0x51f3ad=_0x384b[_0x2d2672];return _0x51f3ad;};'use strict';var multer=require(_0xb384('0x0'));var util=require(_0xb384('0x1'));var path=require(_0xb384('0x2'));var timeout=require(_0xb384('0x3'));var express=require(_0xb384('0x4'));var router=express[_0xb384('0x5')]();var fs_extra=require(_0xb384('0x6'));var auth=require(_0xb384('0x7'));var interaction=require(_0xb384('0x8'));var config=require(_0xb384('0x9'));var controller=require(_0xb384('0xa'));router['get']('/',auth[_0xb384('0xb')](),controller[_0xb384('0xc')]);router[_0xb384('0xd')](_0xb384('0xe'),auth[_0xb384('0xb')](),controller[_0xb384('0xf')]);router['get']('/:id/fields',auth[_0xb384('0xb')](),controller[_0xb384('0x10')]);router[_0xb384('0xd')]('/:id/subjects',auth[_0xb384('0xb')](),controller['getSubjects']);router[_0xb384('0xd')](_0xb384('0x11'),auth[_0xb384('0xb')](),controller['getDescriptions']);router[_0xb384('0x12')]('/',auth[_0xb384('0xb')](),controller['create']);router[_0xb384('0x13')](_0xb384('0xe'),auth[_0xb384('0xb')](),controller[_0xb384('0x14')]);router[_0xb384('0x15')]('/:id',auth[_0xb384('0xb')](),controller[_0xb384('0x16')]);module[_0xb384('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fc73115..0f3bd27 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 _0x315a=['STRING','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x315a,0xc3));var _0xa315=function(_0x546539,_0x44e2b2){_0x546539=_0x546539-0x0;var _0x3b2235=_0x315a[_0x546539];return _0x3b2235;};'use strict';var Sequelize=require('sequelize');module[_0xa315('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa315('0x1')]}}; \ No newline at end of file +var _0xf764=['sequelize','STRING'];(function(_0x4d37da,_0x27e2fc){var _0x8441b6=function(_0x31418a){while(--_0x31418a){_0x4d37da['push'](_0x4d37da['shift']());}};_0x8441b6(++_0x27e2fc);}(_0xf764,0xbc));var _0x4f76=function(_0x39395d,_0x2fb2cb){_0x39395d=_0x39395d-0x0;var _0x56e629=_0xf764[_0x39395d];return _0x56e629;};'use strict';var Sequelize=require(_0x4f76('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f76('0x1')]},'description':{'type':Sequelize[_0x4f76('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 40cfe19..1cf6534 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 _0xa289=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x199ece,_0x4821c9){var _0xdce235=function(_0x1ed922){while(--_0x1ed922){_0x199ece['push'](_0x199ece['shift']());}};_0xdce235(++_0x4821c9);}(_0xa289,0x1e9));var _0x9a28=function(_0x5c47de,_0xc8cf92){_0x5c47de=_0x5c47de-0x0;var _0x49f279=_0xa289[_0x5c47de];return _0x49f279;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a28('0x0'));var zipdir=require(_0x9a28('0x1'));var jsonpatch=require(_0x9a28('0x2'));var rp=require(_0x9a28('0x3'));var moment=require(_0x9a28('0x4'));var BPromise=require(_0x9a28('0x5'));var Mustache=require('mustache');var util=require(_0x9a28('0x6'));var path=require(_0x9a28('0x7'));var sox=require(_0x9a28('0x8'));var csv=require(_0x9a28('0x9'));var ejs=require(_0x9a28('0xa'));var fs=require('fs');var fs_extra=require(_0x9a28('0xb'));var _=require(_0x9a28('0xc'));var squel=require(_0x9a28('0xd'));var crypto=require(_0x9a28('0xe'));var jsforce=require(_0x9a28('0xf'));var deskjs=require(_0x9a28('0x10'));var toCsv=require(_0x9a28('0x9'));var querystring=require(_0x9a28('0x11'));var Papa=require(_0x9a28('0x12'));var Redis=require(_0x9a28('0x13'));var authService=require(_0x9a28('0x14'));var qs=require(_0x9a28('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a28('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9a28('0x17'));var db=require(_0x9a28('0x18'))['db'];function respondWithStatusCode(_0x1ccad7,_0x309afb){_0x309afb=_0x309afb||0xcc;return function(_0x484aa7){if(_0x484aa7){return _0x1ccad7[_0x9a28('0x19')](_0x309afb);}return _0x1ccad7[_0x9a28('0x1a')](_0x309afb)[_0x9a28('0x1b')]();};}function respondWithResult(_0x507da9,_0x1f06c9){_0x1f06c9=_0x1f06c9||0xc8;return function(_0x20aaed){if(_0x20aaed){return _0x507da9[_0x9a28('0x1a')](_0x1f06c9)[_0x9a28('0x1c')](_0x20aaed);}};}function respondWithFilteredResult(_0x3fc3fb,_0x185a01){return function(_0x30bf77){if(_0x30bf77){var _0x3d6dd3=typeof _0x185a01[_0x9a28('0x1d')]===_0x9a28('0x1e')&&typeof _0x185a01[_0x9a28('0x1f')]===_0x9a28('0x1e');var _0x3002d9=_0x30bf77['count'];var _0x168147=_0x3d6dd3?0x0:_0x185a01[_0x9a28('0x1d')];var _0x55e60b=_0x3d6dd3?_0x30bf77[_0x9a28('0x20')]:_0x185a01[_0x9a28('0x1d')]+_0x185a01[_0x9a28('0x1f')];var _0x449927;if(_0x55e60b>=_0x3002d9){_0x55e60b=_0x3002d9;_0x449927=0xc8;}else{_0x449927=0xce;}_0x3fc3fb[_0x9a28('0x1a')](_0x449927);return _0x3fc3fb[_0x9a28('0x21')](_0x9a28('0x22'),_0x168147+'-'+_0x55e60b+'/'+_0x3002d9)[_0x9a28('0x1c')](_0x30bf77);}return null;};}function patchUpdates(_0x5d7b51){return function(_0x2ee944){try{jsonpatch[_0x9a28('0x23')](_0x2ee944,_0x5d7b51,!![]);}catch(_0x481e17){return BPromise[_0x9a28('0x24')](_0x481e17);}return _0x2ee944[_0x9a28('0x25')]();};}function saveUpdates(_0x14d4bf,_0x364724){return function(_0x4f60bb){if(_0x4f60bb){return _0x4f60bb[_0x9a28('0x26')](_0x14d4bf)[_0x9a28('0x27')](function(_0x2a5ff6){return _0x2a5ff6;});}return null;};}function removeEntity(_0x29f97e,_0x48c8e4){return function(_0x4959bf){if(_0x4959bf){return _0x4959bf[_0x9a28('0x28')]()[_0x9a28('0x27')](function(){_0x29f97e[_0x9a28('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6117,_0x38eedc){return function(_0x398d9d){if(!_0x398d9d){_0x2b6117[_0x9a28('0x19')](0x194);}return _0x398d9d;};}function handleError(_0x257554,_0x41e059){_0x41e059=_0x41e059||0x1f4;return function(_0x1750c3){logger[_0x9a28('0x29')](_0x1750c3[_0x9a28('0x2a')]);if(_0x1750c3[_0x9a28('0x2b')]){delete _0x1750c3[_0x9a28('0x2b')];}_0x257554[_0x9a28('0x1a')](_0x41e059)[_0x9a28('0x2c')](_0x1750c3);};}exports['index']=function(_0x59b8bc,_0x1032b8){var _0xf6872a={},_0x2e7473={},_0x293c50={'count':0x0,'rows':[]};var _0x41ec4c=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x2b2a43){return{'name':_0x2b2a43[_0x9a28('0x2d')],'type':_0x2b2a43[_0x9a28('0x2e')][_0x9a28('0x2f')]};});_0x2e7473[_0x9a28('0x30')]=_[_0x9a28('0x31')](_0x41ec4c,'name');_0x2e7473[_0x9a28('0x32')]=_[_0x9a28('0x33')](_0x59b8bc[_0x9a28('0x32')]);_0x2e7473[_0x9a28('0x34')]=_[_0x9a28('0x35')](_0x2e7473[_0x9a28('0x30')],_0x2e7473['query']);_0xf6872a[_0x9a28('0x36')]=_[_0x9a28('0x35')](_0x2e7473[_0x9a28('0x30')],qs['fields'](_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x37')]));_0xf6872a[_0x9a28('0x36')]=_0xf6872a[_0x9a28('0x36')][_0x9a28('0x38')]?_0xf6872a[_0x9a28('0x36')]:_0x2e7473[_0x9a28('0x30')];if(!_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x39')](_0x9a28('0x3a'))){_0xf6872a['limit']=qs[_0x9a28('0x1f')](_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x1f')]);_0xf6872a[_0x9a28('0x1d')]=qs[_0x9a28('0x1d')](_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x1d')]);}_0xf6872a[_0x9a28('0x3b')]=qs[_0x9a28('0x3c')](_0x59b8bc['query'][_0x9a28('0x3c')]);_0xf6872a[_0x9a28('0x3d')]=qs['filters'](_[_0x9a28('0x3e')](_0x59b8bc['query'],_0x2e7473[_0x9a28('0x34')]),_0x41ec4c);if(_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x3f')]){_0xf6872a[_0x9a28('0x3d')]=_[_0x9a28('0x40')](_0xf6872a[_0x9a28('0x3d')],{'$or':_['map'](_0x41ec4c,function(_0x54bc7a){if(_0x54bc7a[_0x9a28('0x2e')]!==_0x9a28('0x41')){var _0x3db4fc={};_0x3db4fc[_0x54bc7a['name']]={'$like':'%'+_0x59b8bc[_0x9a28('0x32')][_0x9a28('0x3f')]+'%'};return _0x3db4fc;}})});}_0xf6872a=_[_0x9a28('0x40')]({},_0xf6872a,_0x59b8bc[_0x9a28('0x42')]);var _0x3120b8={'where':_0xf6872a['where']};return db[_0x9a28('0x43')][_0x9a28('0x20')](_0x3120b8)[_0x9a28('0x27')](function(_0x5a00e0){_0x293c50[_0x9a28('0x20')]=_0x5a00e0;if(_0x59b8bc[_0x9a28('0x32')]['includeAll']){_0xf6872a[_0x9a28('0x44')]=[{'all':!![]}];}return db[_0x9a28('0x43')][_0x9a28('0x45')](_0xf6872a);})[_0x9a28('0x27')](function(_0x8fefde){_0x293c50[_0x9a28('0x46')]=_0x8fefde;return _0x293c50;})[_0x9a28('0x27')](respondWithFilteredResult(_0x1032b8,_0xf6872a))[_0x9a28('0x47')](handleError(_0x1032b8,null));};exports[_0x9a28('0x48')]=function(_0x1a3cb1,_0xbe34e5){var _0x58d8bc={'raw':![],'where':{'id':_0x1a3cb1[_0x9a28('0x49')]['id']}},_0x3e97ec={};_0x3e97ec[_0x9a28('0x30')]=_['keys'](db[_0x9a28('0x43')][_0x9a28('0x4a')]);_0x3e97ec[_0x9a28('0x32')]=_['keys'](_0x1a3cb1[_0x9a28('0x32')]);_0x3e97ec[_0x9a28('0x34')]=_['intersection'](_0x3e97ec[_0x9a28('0x30')],_0x3e97ec[_0x9a28('0x32')]);_0x58d8bc['attributes']=_[_0x9a28('0x35')](_0x3e97ec[_0x9a28('0x30')],qs[_0x9a28('0x37')](_0x1a3cb1['query'][_0x9a28('0x37')]));_0x58d8bc[_0x9a28('0x36')]=_0x58d8bc['attributes']['length']?_0x58d8bc['attributes']:_0x3e97ec[_0x9a28('0x30')];if(_0x1a3cb1[_0x9a28('0x32')][_0x9a28('0x4b')]){_0x58d8bc[_0x9a28('0x44')]=[{'all':!![]}];}_0x58d8bc=_[_0x9a28('0x40')]({},_0x58d8bc,_0x1a3cb1[_0x9a28('0x42')]);return db[_0x9a28('0x43')][_0x9a28('0x4c')](_0x58d8bc)[_0x9a28('0x27')](handleEntityNotFound(_0xbe34e5,null))[_0x9a28('0x27')](respondWithResult(_0xbe34e5,null))[_0x9a28('0x47')](handleError(_0xbe34e5,null));};exports[_0x9a28('0x4d')]=function(_0x3e783d,_0x3488e3){return db[_0x9a28('0x43')][_0x9a28('0x4d')](_0x3e783d[_0x9a28('0x4e')],{})[_0x9a28('0x27')](respondWithResult(_0x3488e3,0xc9))['catch'](handleError(_0x3488e3,null));};exports[_0x9a28('0x26')]=function(_0x387be4,_0x58d68a){if(_0x387be4[_0x9a28('0x4e')]['id']){delete _0x387be4['body']['id'];}return db[_0x9a28('0x43')][_0x9a28('0x4c')]({'where':{'id':_0x387be4[_0x9a28('0x49')]['id']}})[_0x9a28('0x27')](handleEntityNotFound(_0x58d68a,null))[_0x9a28('0x27')](saveUpdates(_0x387be4[_0x9a28('0x4e')],null))['then'](respondWithResult(_0x58d68a,null))[_0x9a28('0x47')](handleError(_0x58d68a,null));};exports['destroy']=function(_0x2aa278,_0x1ce0fc){return db[_0x9a28('0x43')][_0x9a28('0x4c')]({'where':{'id':_0x2aa278['params']['id']}})[_0x9a28('0x27')](handleEntityNotFound(_0x1ce0fc,null))[_0x9a28('0x27')](removeEntity(_0x1ce0fc,null))[_0x9a28('0x47')](handleError(_0x1ce0fc,null));};exports[_0x9a28('0x4f')]=function(_0x51e6b9,_0x74f3f,_0x58b058){var _0x3d6a80={};var _0x4abab2={};var _0x471dee;var _0x7e37c4;return db[_0x9a28('0x43')][_0x9a28('0x50')]({'where':{'id':_0x51e6b9[_0x9a28('0x49')]['id']}})['then'](handleEntityNotFound(_0x74f3f,null))[_0x9a28('0x27')](function(_0x9b99d4){if(_0x9b99d4){_0x471dee=_0x9b99d4;_0x4abab2['model']=_[_0x9a28('0x33')](db['SugarcrmField'][_0x9a28('0x4a')]);_0x4abab2['query']=_['keys'](_0x51e6b9[_0x9a28('0x32')]);_0x4abab2[_0x9a28('0x34')]=_[_0x9a28('0x35')](_0x4abab2[_0x9a28('0x30')],_0x4abab2[_0x9a28('0x32')]);_0x3d6a80[_0x9a28('0x36')]=_[_0x9a28('0x35')](_0x4abab2[_0x9a28('0x30')],qs['fields'](_0x51e6b9[_0x9a28('0x32')][_0x9a28('0x37')]));_0x3d6a80[_0x9a28('0x36')]=_0x3d6a80['attributes'][_0x9a28('0x38')]?_0x3d6a80[_0x9a28('0x36')]:_0x4abab2[_0x9a28('0x30')];_0x3d6a80[_0x9a28('0x3b')]=qs['sort'](_0x51e6b9[_0x9a28('0x32')]['sort']);_0x3d6a80['where']=qs['filters'](_[_0x9a28('0x3e')](_0x51e6b9[_0x9a28('0x32')],_0x4abab2[_0x9a28('0x34')]));if(_0x51e6b9[_0x9a28('0x32')][_0x9a28('0x3f')]){_0x3d6a80[_0x9a28('0x3d')]=_['merge'](_0x3d6a80[_0x9a28('0x3d')],{'$or':_[_0x9a28('0x31')](_0x3d6a80[_0x9a28('0x36')],function(_0x4167f1){var _0x33fc46={};_0x33fc46[_0x4167f1]={'$like':'%'+_0x51e6b9[_0x9a28('0x32')][_0x9a28('0x3f')]+'%'};return _0x33fc46;})});}_0x3d6a80=_[_0x9a28('0x40')]({},_0x3d6a80,_0x51e6b9['options']);return _0x471dee['getFields'](_0x3d6a80);}})['then'](function(_0x303a55){if(_0x303a55){_0x7e37c4=_0x303a55[_0x9a28('0x38')];if(!_0x51e6b9[_0x9a28('0x32')]['hasOwnProperty'](_0x9a28('0x3a'))){_0x3d6a80[_0x9a28('0x1f')]=qs[_0x9a28('0x1f')](_0x51e6b9['query'][_0x9a28('0x1f')]);_0x3d6a80['offset']=qs['offset'](_0x51e6b9[_0x9a28('0x32')][_0x9a28('0x1d')]);}return _0x471dee[_0x9a28('0x4f')](_0x3d6a80);}})['then'](function(_0xe9cd2b){if(_0xe9cd2b){return _0xe9cd2b?{'count':_0x7e37c4,'rows':_0xe9cd2b}:null;}})[_0x9a28('0x27')](respondWithResult(_0x74f3f,null))[_0x9a28('0x47')](handleError(_0x74f3f,null));};exports['getSubjects']=function(_0x3c9b9c,_0xc2c404,_0x176604){var _0x4f0b1a={};var _0x25f212={};var _0x126506;var _0x52cc03;return db[_0x9a28('0x43')][_0x9a28('0x50')]({'where':{'id':_0x3c9b9c['params']['id']}})[_0x9a28('0x27')](handleEntityNotFound(_0xc2c404,null))['then'](function(_0x12bf2a){if(_0x12bf2a){_0x126506=_0x12bf2a;_0x25f212[_0x9a28('0x30')]=_['keys'](db[_0x9a28('0x51')][_0x9a28('0x4a')]);_0x25f212[_0x9a28('0x32')]=_['keys'](_0x3c9b9c['query']);_0x25f212[_0x9a28('0x34')]=_[_0x9a28('0x35')](_0x25f212[_0x9a28('0x30')],_0x25f212[_0x9a28('0x32')]);_0x4f0b1a['attributes']=_[_0x9a28('0x35')](_0x25f212[_0x9a28('0x30')],qs[_0x9a28('0x37')](_0x3c9b9c[_0x9a28('0x32')][_0x9a28('0x37')]));_0x4f0b1a[_0x9a28('0x36')]=_0x4f0b1a[_0x9a28('0x36')][_0x9a28('0x38')]?_0x4f0b1a['attributes']:_0x25f212[_0x9a28('0x30')];_0x4f0b1a[_0x9a28('0x3b')]=qs[_0x9a28('0x3c')](_0x3c9b9c[_0x9a28('0x32')][_0x9a28('0x3c')]);_0x4f0b1a[_0x9a28('0x3d')]=qs[_0x9a28('0x34')](_[_0x9a28('0x3e')](_0x3c9b9c[_0x9a28('0x32')],_0x25f212[_0x9a28('0x34')]));if(_0x3c9b9c[_0x9a28('0x32')]['filter']){_0x4f0b1a[_0x9a28('0x3d')]=_[_0x9a28('0x40')](_0x4f0b1a['where'],{'$or':_[_0x9a28('0x31')](_0x4f0b1a[_0x9a28('0x36')],function(_0x5023e0){var _0x44fc01={};_0x44fc01[_0x5023e0]={'$like':'%'+_0x3c9b9c[_0x9a28('0x32')][_0x9a28('0x3f')]+'%'};return _0x44fc01;})});}_0x4f0b1a=_[_0x9a28('0x40')]({},_0x4f0b1a,_0x3c9b9c[_0x9a28('0x42')]);return _0x126506[_0x9a28('0x52')](_0x4f0b1a);}})[_0x9a28('0x27')](function(_0x818753){if(_0x818753){_0x52cc03=_0x818753[_0x9a28('0x38')];if(!_0x3c9b9c['query'][_0x9a28('0x39')](_0x9a28('0x3a'))){_0x4f0b1a[_0x9a28('0x1f')]=qs[_0x9a28('0x1f')](_0x3c9b9c['query'][_0x9a28('0x1f')]);_0x4f0b1a['offset']=qs[_0x9a28('0x1d')](_0x3c9b9c[_0x9a28('0x32')][_0x9a28('0x1d')]);}return _0x126506[_0x9a28('0x52')](_0x4f0b1a);}})[_0x9a28('0x27')](function(_0x386928){if(_0x386928){return _0x386928?{'count':_0x52cc03,'rows':_0x386928}:null;}})[_0x9a28('0x27')](respondWithResult(_0xc2c404,null))[_0x9a28('0x47')](handleError(_0xc2c404,null));};exports[_0x9a28('0x53')]=function(_0x324ce1,_0x139180,_0x39747d){var _0x1b9077={};var _0x406d33={};var _0x5df3ff;var _0x2808bc;return db[_0x9a28('0x43')]['findOne']({'where':{'id':_0x324ce1[_0x9a28('0x49')]['id']}})[_0x9a28('0x27')](handleEntityNotFound(_0x139180,null))[_0x9a28('0x27')](function(_0xd4bab1){if(_0xd4bab1){_0x5df3ff=_0xd4bab1;_0x406d33[_0x9a28('0x30')]=_[_0x9a28('0x33')](db['SugarcrmField'][_0x9a28('0x4a')]);_0x406d33[_0x9a28('0x32')]=_['keys'](_0x324ce1[_0x9a28('0x32')]);_0x406d33[_0x9a28('0x34')]=_['intersection'](_0x406d33[_0x9a28('0x30')],_0x406d33[_0x9a28('0x32')]);_0x1b9077[_0x9a28('0x36')]=_[_0x9a28('0x35')](_0x406d33['model'],qs[_0x9a28('0x37')](_0x324ce1[_0x9a28('0x32')][_0x9a28('0x37')]));_0x1b9077[_0x9a28('0x36')]=_0x1b9077[_0x9a28('0x36')]['length']?_0x1b9077['attributes']:_0x406d33['model'];_0x1b9077[_0x9a28('0x3b')]=qs[_0x9a28('0x3c')](_0x324ce1[_0x9a28('0x32')][_0x9a28('0x3c')]);_0x1b9077[_0x9a28('0x3d')]=qs['filters'](_[_0x9a28('0x3e')](_0x324ce1[_0x9a28('0x32')],_0x406d33[_0x9a28('0x34')]));if(_0x324ce1[_0x9a28('0x32')][_0x9a28('0x3f')]){_0x1b9077[_0x9a28('0x3d')]=_[_0x9a28('0x40')](_0x1b9077[_0x9a28('0x3d')],{'$or':_[_0x9a28('0x31')](_0x1b9077['attributes'],function(_0xb21673){var _0xb2c7fa={};_0xb2c7fa[_0xb21673]={'$like':'%'+_0x324ce1[_0x9a28('0x32')][_0x9a28('0x3f')]+'%'};return _0xb2c7fa;})});}_0x1b9077=_[_0x9a28('0x40')]({},_0x1b9077,_0x324ce1[_0x9a28('0x42')]);return _0x5df3ff[_0x9a28('0x53')](_0x1b9077);}})[_0x9a28('0x27')](function(_0x440faa){if(_0x440faa){_0x2808bc=_0x440faa['length'];if(!_0x324ce1[_0x9a28('0x32')]['hasOwnProperty'](_0x9a28('0x3a'))){_0x1b9077[_0x9a28('0x1f')]=qs['limit'](_0x324ce1['query'][_0x9a28('0x1f')]);_0x1b9077[_0x9a28('0x1d')]=qs['offset'](_0x324ce1['query'][_0x9a28('0x1d')]);}return _0x5df3ff[_0x9a28('0x53')](_0x1b9077);}})[_0x9a28('0x27')](function(_0x4fe6b1){if(_0x4fe6b1){return _0x4fe6b1?{'count':_0x2808bc,'rows':_0x4fe6b1}:null;}})['then'](respondWithResult(_0x139180,null))[_0x9a28('0x47')](handleError(_0x139180,null));}; \ No newline at end of file +var _0xfabe=['limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','SugarcrmConfiguration','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','find','findOne','SugarcrmField','order','pick','options','getFields','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count'];(function(_0x19a421,_0x3804d6){var _0x1b93f1=function(_0x55ea46){while(--_0x55ea46){_0x19a421['push'](_0x19a421['shift']());}};_0x1b93f1(++_0x3804d6);}(_0xfabe,0x12a));var _0xefab=function(_0xb73b18,_0x35a457){_0xb73b18=_0xb73b18-0x0;var _0x2fe43b=_0xfabe[_0xb73b18];return _0x2fe43b;};'use strict';var emlformat=require(_0xefab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var Mustache=require('mustache');var util=require(_0xefab('0x4'));var path=require(_0xefab('0x5'));var sox=require(_0xefab('0x6'));var csv=require(_0xefab('0x7'));var ejs=require(_0xefab('0x8'));var fs=require('fs');var fs_extra=require(_0xefab('0x9'));var _=require(_0xefab('0xa'));var squel=require('squel');var crypto=require(_0xefab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xefab('0xc'));var toCsv=require(_0xefab('0x7'));var querystring=require(_0xefab('0xd'));var Papa=require(_0xefab('0xe'));var Redis=require(_0xefab('0xf'));var authService=require(_0xefab('0x10'));var qs=require(_0xefab('0x11'));var as=require(_0xefab('0x12'));var hardwareService=require(_0xefab('0x13'));var logger=require(_0xefab('0x14'))(_0xefab('0x15'));var utils=require('../../config/utils');var config=require(_0xefab('0x16'));var licenseUtil=require(_0xefab('0x17'));var db=require(_0xefab('0x18'))['db'];function respondWithStatusCode(_0x12b4bc,_0x291057){_0x291057=_0x291057||0xcc;return function(_0x5d3660){if(_0x5d3660){return _0x12b4bc[_0xefab('0x19')](_0x291057);}return _0x12b4bc[_0xefab('0x1a')](_0x291057)['end']();};}function respondWithResult(_0xfb4cc5,_0x111037){_0x111037=_0x111037||0xc8;return function(_0xdeadc){if(_0xdeadc){return _0xfb4cc5[_0xefab('0x1a')](_0x111037)['json'](_0xdeadc);}};}function respondWithFilteredResult(_0x19357a,_0x5878f3){return function(_0x466c83){if(_0x466c83){var _0x447af0=typeof _0x5878f3[_0xefab('0x1b')]===_0xefab('0x1c')&&typeof _0x5878f3['limit']===_0xefab('0x1c');var _0x1ec7c3=_0x466c83[_0xefab('0x1d')];var _0x515968=_0x447af0?0x0:_0x5878f3[_0xefab('0x1b')];var _0x4693d0=_0x447af0?_0x466c83[_0xefab('0x1d')]:_0x5878f3[_0xefab('0x1b')]+_0x5878f3[_0xefab('0x1e')];var _0x1f3cc6;if(_0x4693d0>=_0x1ec7c3){_0x4693d0=_0x1ec7c3;_0x1f3cc6=0xc8;}else{_0x1f3cc6=0xce;}_0x19357a[_0xefab('0x1a')](_0x1f3cc6);return _0x19357a[_0xefab('0x1f')](_0xefab('0x20'),_0x515968+'-'+_0x4693d0+'/'+_0x1ec7c3)[_0xefab('0x21')](_0x466c83);}return null;};}function patchUpdates(_0x18f97d){return function(_0x495764){try{jsonpatch[_0xefab('0x22')](_0x495764,_0x18f97d,!![]);}catch(_0x129aaa){return BPromise[_0xefab('0x23')](_0x129aaa);}return _0x495764[_0xefab('0x24')]();};}function saveUpdates(_0x48af42,_0x4e87b7){return function(_0x4750fd){if(_0x4750fd){return _0x4750fd[_0xefab('0x25')](_0x48af42)['then'](function(_0xbdc84f){return _0xbdc84f;});}return null;};}function removeEntity(_0x401a83,_0x2337aa){return function(_0x294790){if(_0x294790){return _0x294790[_0xefab('0x26')]()[_0xefab('0x27')](function(){_0x401a83[_0xefab('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb2b7,_0x2d1570){return function(_0x2e6077){if(!_0x2e6077){_0x1fb2b7[_0xefab('0x19')](0x194);}return _0x2e6077;};}function handleError(_0x14b37f,_0x5f4a9d){_0x5f4a9d=_0x5f4a9d||0x1f4;return function(_0x2a085b){logger[_0xefab('0x28')](_0x2a085b[_0xefab('0x29')]);if(_0x2a085b[_0xefab('0x2a')]){delete _0x2a085b[_0xefab('0x2a')];}_0x14b37f[_0xefab('0x1a')](_0x5f4a9d)['send'](_0x2a085b);};}exports[_0xefab('0x2b')]=function(_0x9c217b,_0x3b7158){var _0x5b56cd={},_0x5c89fd={},_0x43b268={'count':0x0,'rows':[]};var _0x1f8940=_['map'](db[_0xefab('0x2c')]['rawAttributes'],function(_0x33cf05){return{'name':_0x33cf05[_0xefab('0x2d')],'type':_0x33cf05['type'][_0xefab('0x2e')]};});_0x5c89fd[_0xefab('0x2f')]=_[_0xefab('0x30')](_0x1f8940,_0xefab('0x2a'));_0x5c89fd[_0xefab('0x31')]=_['keys'](_0x9c217b[_0xefab('0x31')]);_0x5c89fd['filters']=_[_0xefab('0x32')](_0x5c89fd[_0xefab('0x2f')],_0x5c89fd[_0xefab('0x31')]);_0x5b56cd[_0xefab('0x33')]=_[_0xefab('0x32')](_0x5c89fd[_0xefab('0x2f')],qs[_0xefab('0x34')](_0x9c217b['query'][_0xefab('0x34')]));_0x5b56cd[_0xefab('0x33')]=_0x5b56cd['attributes'][_0xefab('0x35')]?_0x5b56cd[_0xefab('0x33')]:_0x5c89fd['model'];if(!_0x9c217b[_0xefab('0x31')][_0xefab('0x36')](_0xefab('0x37'))){_0x5b56cd['limit']=qs['limit'](_0x9c217b[_0xefab('0x31')][_0xefab('0x1e')]);_0x5b56cd[_0xefab('0x1b')]=qs[_0xefab('0x1b')](_0x9c217b[_0xefab('0x31')]['offset']);}_0x5b56cd['order']=qs[_0xefab('0x38')](_0x9c217b[_0xefab('0x31')][_0xefab('0x38')]);_0x5b56cd[_0xefab('0x39')]=qs['filters'](_['pick'](_0x9c217b[_0xefab('0x31')],_0x5c89fd[_0xefab('0x3a')]),_0x1f8940);if(_0x9c217b['query'][_0xefab('0x3b')]){_0x5b56cd[_0xefab('0x39')]=_['merge'](_0x5b56cd[_0xefab('0x39')],{'$or':_[_0xefab('0x30')](_0x1f8940,function(_0x2a50d6){if(_0x2a50d6[_0xefab('0x3c')]!==_0xefab('0x3d')){var _0x56e9be={};_0x56e9be[_0x2a50d6[_0xefab('0x2a')]]={'$like':'%'+_0x9c217b['query'][_0xefab('0x3b')]+'%'};return _0x56e9be;}})});}_0x5b56cd=_[_0xefab('0x3e')]({},_0x5b56cd,_0x9c217b['options']);var _0x3acfcd={'where':_0x5b56cd[_0xefab('0x39')]};return db['SugarcrmConfiguration']['count'](_0x3acfcd)[_0xefab('0x27')](function(_0x49a700){_0x43b268['count']=_0x49a700;if(_0x9c217b[_0xefab('0x31')]['includeAll']){_0x5b56cd['include']=[{'all':!![]}];}return db[_0xefab('0x2c')][_0xefab('0x3f')](_0x5b56cd);})['then'](function(_0x3747d0){_0x43b268[_0xefab('0x40')]=_0x3747d0;return _0x43b268;})[_0xefab('0x27')](respondWithFilteredResult(_0x3b7158,_0x5b56cd))[_0xefab('0x41')](handleError(_0x3b7158,null));};exports[_0xefab('0x42')]=function(_0x3a780e,_0x4bb020){var _0xc55a4={'raw':![],'where':{'id':_0x3a780e[_0xefab('0x43')]['id']}},_0x19e6bf={};_0x19e6bf[_0xefab('0x2f')]=_[_0xefab('0x44')](db['SugarcrmConfiguration'][_0xefab('0x45')]);_0x19e6bf[_0xefab('0x31')]=_[_0xefab('0x44')](_0x3a780e[_0xefab('0x31')]);_0x19e6bf[_0xefab('0x3a')]=_[_0xefab('0x32')](_0x19e6bf[_0xefab('0x2f')],_0x19e6bf[_0xefab('0x31')]);_0xc55a4[_0xefab('0x33')]=_[_0xefab('0x32')](_0x19e6bf[_0xefab('0x2f')],qs[_0xefab('0x34')](_0x3a780e[_0xefab('0x31')][_0xefab('0x34')]));_0xc55a4['attributes']=_0xc55a4[_0xefab('0x33')][_0xefab('0x35')]?_0xc55a4[_0xefab('0x33')]:_0x19e6bf['model'];if(_0x3a780e['query']['includeAll']){_0xc55a4[_0xefab('0x46')]=[{'all':!![]}];}_0xc55a4=_[_0xefab('0x3e')]({},_0xc55a4,_0x3a780e['options']);return db[_0xefab('0x2c')]['find'](_0xc55a4)[_0xefab('0x27')](handleEntityNotFound(_0x4bb020,null))[_0xefab('0x27')](respondWithResult(_0x4bb020,null))[_0xefab('0x41')](handleError(_0x4bb020,null));};exports[_0xefab('0x47')]=function(_0x1d2071,_0x332772){return db[_0xefab('0x2c')][_0xefab('0x47')](_0x1d2071[_0xefab('0x48')],{})[_0xefab('0x27')](respondWithResult(_0x332772,0xc9))['catch'](handleError(_0x332772,null));};exports[_0xefab('0x25')]=function(_0x5eda35,_0x39ff77){if(_0x5eda35[_0xefab('0x48')]['id']){delete _0x5eda35[_0xefab('0x48')]['id'];}return db[_0xefab('0x2c')][_0xefab('0x49')]({'where':{'id':_0x5eda35[_0xefab('0x43')]['id']}})[_0xefab('0x27')](handleEntityNotFound(_0x39ff77,null))[_0xefab('0x27')](saveUpdates(_0x5eda35[_0xefab('0x48')],null))['then'](respondWithResult(_0x39ff77,null))[_0xefab('0x41')](handleError(_0x39ff77,null));};exports[_0xefab('0x26')]=function(_0x2f7a52,_0x3d1fb0){return db[_0xefab('0x2c')]['find']({'where':{'id':_0x2f7a52['params']['id']}})['then'](handleEntityNotFound(_0x3d1fb0,null))['then'](removeEntity(_0x3d1fb0,null))['catch'](handleError(_0x3d1fb0,null));};exports['getFields']=function(_0x4eac8,_0x2e2b9d,_0x527bc0){var _0x335607={};var _0x33d8db={};var _0xda664e;var _0x512ed0;return db[_0xefab('0x2c')][_0xefab('0x4a')]({'where':{'id':_0x4eac8[_0xefab('0x43')]['id']}})[_0xefab('0x27')](handleEntityNotFound(_0x2e2b9d,null))[_0xefab('0x27')](function(_0x3d9db1){if(_0x3d9db1){_0xda664e=_0x3d9db1;_0x33d8db[_0xefab('0x2f')]=_[_0xefab('0x44')](db[_0xefab('0x4b')][_0xefab('0x45')]);_0x33d8db[_0xefab('0x31')]=_[_0xefab('0x44')](_0x4eac8[_0xefab('0x31')]);_0x33d8db[_0xefab('0x3a')]=_['intersection'](_0x33d8db[_0xefab('0x2f')],_0x33d8db[_0xefab('0x31')]);_0x335607[_0xefab('0x33')]=_['intersection'](_0x33d8db['model'],qs[_0xefab('0x34')](_0x4eac8[_0xefab('0x31')]['fields']));_0x335607[_0xefab('0x33')]=_0x335607['attributes'][_0xefab('0x35')]?_0x335607[_0xefab('0x33')]:_0x33d8db['model'];_0x335607[_0xefab('0x4c')]=qs[_0xefab('0x38')](_0x4eac8['query'][_0xefab('0x38')]);_0x335607[_0xefab('0x39')]=qs[_0xefab('0x3a')](_[_0xefab('0x4d')](_0x4eac8['query'],_0x33d8db[_0xefab('0x3a')]));if(_0x4eac8[_0xefab('0x31')]['filter']){_0x335607[_0xefab('0x39')]=_[_0xefab('0x3e')](_0x335607[_0xefab('0x39')],{'$or':_[_0xefab('0x30')](_0x335607[_0xefab('0x33')],function(_0x3f96a5){var _0x5b3011={};_0x5b3011[_0x3f96a5]={'$like':'%'+_0x4eac8['query'][_0xefab('0x3b')]+'%'};return _0x5b3011;})});}_0x335607=_[_0xefab('0x3e')]({},_0x335607,_0x4eac8[_0xefab('0x4e')]);return _0xda664e[_0xefab('0x4f')](_0x335607);}})[_0xefab('0x27')](function(_0x5f07c6){if(_0x5f07c6){_0x512ed0=_0x5f07c6[_0xefab('0x35')];if(!_0x4eac8[_0xefab('0x31')][_0xefab('0x36')](_0xefab('0x37'))){_0x335607['limit']=qs[_0xefab('0x1e')](_0x4eac8['query'][_0xefab('0x1e')]);_0x335607[_0xefab('0x1b')]=qs['offset'](_0x4eac8[_0xefab('0x31')][_0xefab('0x1b')]);}return _0xda664e['getFields'](_0x335607);}})['then'](function(_0x2edf48){if(_0x2edf48){return _0x2edf48?{'count':_0x512ed0,'rows':_0x2edf48}:null;}})['then'](respondWithResult(_0x2e2b9d,null))[_0xefab('0x41')](handleError(_0x2e2b9d,null));};exports[_0xefab('0x50')]=function(_0x36e45d,_0x4367e8,_0x53507e){var _0x1fa33e={};var _0x486dc9={};var _0x5941df;var _0x129efc;return db['SugarcrmConfiguration'][_0xefab('0x4a')]({'where':{'id':_0x36e45d[_0xefab('0x43')]['id']}})[_0xefab('0x27')](handleEntityNotFound(_0x4367e8,null))[_0xefab('0x27')](function(_0x5b1bfd){if(_0x5b1bfd){_0x5941df=_0x5b1bfd;_0x486dc9[_0xefab('0x2f')]=_['keys'](db[_0xefab('0x4b')][_0xefab('0x45')]);_0x486dc9[_0xefab('0x31')]=_[_0xefab('0x44')](_0x36e45d[_0xefab('0x31')]);_0x486dc9['filters']=_[_0xefab('0x32')](_0x486dc9[_0xefab('0x2f')],_0x486dc9[_0xefab('0x31')]);_0x1fa33e[_0xefab('0x33')]=_['intersection'](_0x486dc9[_0xefab('0x2f')],qs[_0xefab('0x34')](_0x36e45d[_0xefab('0x31')]['fields']));_0x1fa33e[_0xefab('0x33')]=_0x1fa33e[_0xefab('0x33')][_0xefab('0x35')]?_0x1fa33e[_0xefab('0x33')]:_0x486dc9[_0xefab('0x2f')];_0x1fa33e[_0xefab('0x4c')]=qs[_0xefab('0x38')](_0x36e45d['query']['sort']);_0x1fa33e[_0xefab('0x39')]=qs[_0xefab('0x3a')](_[_0xefab('0x4d')](_0x36e45d[_0xefab('0x31')],_0x486dc9[_0xefab('0x3a')]));if(_0x36e45d['query'][_0xefab('0x3b')]){_0x1fa33e[_0xefab('0x39')]=_[_0xefab('0x3e')](_0x1fa33e[_0xefab('0x39')],{'$or':_['map'](_0x1fa33e['attributes'],function(_0x6d2e35){var _0x4a6077={};_0x4a6077[_0x6d2e35]={'$like':'%'+_0x36e45d['query'][_0xefab('0x3b')]+'%'};return _0x4a6077;})});}_0x1fa33e=_[_0xefab('0x3e')]({},_0x1fa33e,_0x36e45d[_0xefab('0x4e')]);return _0x5941df[_0xefab('0x50')](_0x1fa33e);}})['then'](function(_0x5f4f54){if(_0x5f4f54){_0x129efc=_0x5f4f54[_0xefab('0x35')];if(!_0x36e45d['query'][_0xefab('0x36')](_0xefab('0x37'))){_0x1fa33e[_0xefab('0x1e')]=qs[_0xefab('0x1e')](_0x36e45d[_0xefab('0x31')]['limit']);_0x1fa33e[_0xefab('0x1b')]=qs[_0xefab('0x1b')](_0x36e45d[_0xefab('0x31')][_0xefab('0x1b')]);}return _0x5941df[_0xefab('0x50')](_0x1fa33e);}})[_0xefab('0x27')](function(_0x4739b2){if(_0x4739b2){return _0x4739b2?{'count':_0x129efc,'rows':_0x4739b2}:null;}})[_0xefab('0x27')](respondWithResult(_0x4367e8,null))[_0xefab('0x41')](handleError(_0x4367e8,null));};exports['getDescriptions']=function(_0xb523fa,_0x11266c,_0x1f9370){var _0x486fae={};var _0x443822={};var _0x202a19;var _0x4ab634;return db['SugarcrmConfiguration'][_0xefab('0x4a')]({'where':{'id':_0xb523fa[_0xefab('0x43')]['id']}})[_0xefab('0x27')](handleEntityNotFound(_0x11266c,null))[_0xefab('0x27')](function(_0x4e503c){if(_0x4e503c){_0x202a19=_0x4e503c;_0x443822['model']=_[_0xefab('0x44')](db[_0xefab('0x4b')][_0xefab('0x45')]);_0x443822[_0xefab('0x31')]=_[_0xefab('0x44')](_0xb523fa[_0xefab('0x31')]);_0x443822[_0xefab('0x3a')]=_['intersection'](_0x443822[_0xefab('0x2f')],_0x443822[_0xefab('0x31')]);_0x486fae[_0xefab('0x33')]=_[_0xefab('0x32')](_0x443822[_0xefab('0x2f')],qs[_0xefab('0x34')](_0xb523fa['query'][_0xefab('0x34')]));_0x486fae[_0xefab('0x33')]=_0x486fae['attributes'][_0xefab('0x35')]?_0x486fae[_0xefab('0x33')]:_0x443822[_0xefab('0x2f')];_0x486fae[_0xefab('0x4c')]=qs[_0xefab('0x38')](_0xb523fa[_0xefab('0x31')][_0xefab('0x38')]);_0x486fae[_0xefab('0x39')]=qs['filters'](_['pick'](_0xb523fa[_0xefab('0x31')],_0x443822[_0xefab('0x3a')]));if(_0xb523fa['query']['filter']){_0x486fae[_0xefab('0x39')]=_[_0xefab('0x3e')](_0x486fae['where'],{'$or':_[_0xefab('0x30')](_0x486fae['attributes'],function(_0x502e57){var _0x5d209c={};_0x5d209c[_0x502e57]={'$like':'%'+_0xb523fa['query'][_0xefab('0x3b')]+'%'};return _0x5d209c;})});}_0x486fae=_[_0xefab('0x3e')]({},_0x486fae,_0xb523fa[_0xefab('0x4e')]);return _0x202a19[_0xefab('0x51')](_0x486fae);}})[_0xefab('0x27')](function(_0x27bdfe){if(_0x27bdfe){_0x4ab634=_0x27bdfe[_0xefab('0x35')];if(!_0xb523fa['query'][_0xefab('0x36')](_0xefab('0x37'))){_0x486fae[_0xefab('0x1e')]=qs[_0xefab('0x1e')](_0xb523fa[_0xefab('0x31')][_0xefab('0x1e')]);_0x486fae[_0xefab('0x1b')]=qs[_0xefab('0x1b')](_0xb523fa[_0xefab('0x31')][_0xefab('0x1b')]);}return _0x202a19['getDescriptions'](_0x486fae);}})[_0xefab('0x27')](function(_0x31dfb7){if(_0x31dfb7){return _0x31dfb7?{'count':_0x4ab634,'rows':_0x31dfb7}:null;}})[_0xefab('0x27')](respondWithResult(_0x11266c,null))[_0xefab('0x41')](handleError(_0x11266c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 458b9dd..443920e 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 _0xdd19=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api'];(function(_0x59cea3,_0xba8b5d){var _0x1ea4c0=function(_0x2f2fb2){while(--_0x2f2fb2){_0x59cea3['push'](_0x59cea3['shift']());}};_0x1ea4c0(++_0xba8b5d);}(_0xdd19,0x107));var _0x9dd1=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xdd19[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x9dd1('0x0'));var logger=require(_0x9dd1('0x1'))(_0x9dd1('0x2'));var moment=require(_0x9dd1('0x3'));var BPromise=require(_0x9dd1('0x4'));var rp=require(_0x9dd1('0x5'));var fs=require('fs');var path=require(_0x9dd1('0x6'));var rimraf=require(_0x9dd1('0x7'));var config=require(_0x9dd1('0x8'));var attributes=require(_0x9dd1('0x9'));module[_0x9dd1('0xa')]=function(_0x21b496,_0x11f949){return _0x21b496[_0x9dd1('0xb')](_0x9dd1('0xc'),attributes,{'tableName':_0x9dd1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7f6=['moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xf7f6,0x1b7));var _0x6f7f=function(_0x129de5,_0xe971cd){_0x129de5=_0x129de5-0x0;var _0x310691=_0xf7f6[_0x129de5];return _0x310691;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f7f('0x0'))('api');var moment=require(_0x6f7f('0x1'));var BPromise=require(_0x6f7f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f7f('0x3'));var config=require(_0x6f7f('0x4'));var attributes=require(_0x6f7f('0x5'));module[_0x6f7f('0x6')]=function(_0x17a176,_0x105630){return _0x17a176[_0x6f7f('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 46ddd7e..18c2ad9 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 _0x94eb=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x257896,_0x8de612){var _0x1ff242=function(_0x8ea06a){while(--_0x8ea06a){_0x257896['push'](_0x257896['shift']());}};_0x1ff242(++_0x8de612);}(_0x94eb,0x8c));var _0xb94e=function(_0x2dcbf8,_0x371e68){_0x2dcbf8=_0x2dcbf8-0x0;var _0x3d09f3=_0x94eb[_0x2dcbf8];return _0x3d09f3;};'use strict';var _=require(_0xb94e('0x0'));var util=require(_0xb94e('0x1'));var moment=require(_0xb94e('0x2'));var BPromise=require(_0xb94e('0x3'));var rs=require(_0xb94e('0x4'));var fs=require('fs');var Redis=require(_0xb94e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb94e('0x6'));var logger=require(_0xb94e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb94e('0x8'));var client=jayson['client'][_0xb94e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x80d0f9,_0x433034,_0x4de3fa){return new BPromise(function(_0x2bba42,_0x4b756e){return client['request'](_0x80d0f9,_0x4de3fa)[_0xb94e('0xa')](function(_0x1af8a1){logger['info'](_0xb94e('0xb'),_0x433034,_0xb94e('0xc'));logger['debug'](_0xb94e('0xd'),_0x433034,_0xb94e('0xc'),JSON[_0xb94e('0xe')](_0x1af8a1));if(_0x1af8a1['error']){if(_0x1af8a1[_0xb94e('0xf')]['code']===0x1f4){logger['error'](_0xb94e('0xb'),_0x433034,_0x1af8a1[_0xb94e('0xf')][_0xb94e('0x10')]);return _0x4b756e(_0x1af8a1[_0xb94e('0xf')][_0xb94e('0x10')]);}logger['error'](_0xb94e('0xb'),_0x433034,_0x1af8a1[_0xb94e('0xf')][_0xb94e('0x10')]);return _0x2bba42(_0x1af8a1['error'][_0xb94e('0x10')]);}else{logger[_0xb94e('0x11')](_0xb94e('0xb'),_0x433034,_0xb94e('0xc'));_0x2bba42(_0x1af8a1[_0xb94e('0x12')][_0xb94e('0x10')]);}})[_0xb94e('0x13')](function(_0x56b444){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x433034,_0x56b444);_0x4b756e(_0x56b444);});});} \ No newline at end of file +var _0xb726=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x1d1cb7,_0x1d6e13){var _0x331a83=function(_0x21d339){while(--_0x21d339){_0x1d1cb7['push'](_0x1d1cb7['shift']());}};_0x331a83(++_0x1d6e13);}(_0xb726,0x1c6));var _0x6b72=function(_0x372b60,_0x20946a){_0x372b60=_0x372b60-0x0;var _0x8c6c1f=_0xb726[_0x372b60];return _0x8c6c1f;};'use strict';var _=require(_0x6b72('0x0'));var util=require(_0x6b72('0x1'));var moment=require(_0x6b72('0x2'));var BPromise=require(_0x6b72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b72('0x4'));var db=require(_0x6b72('0x5'))['db'];var utils=require(_0x6b72('0x6'));var logger=require('../../config/logger')(_0x6b72('0x7'));var config=require(_0x6b72('0x8'));var jayson=require(_0x6b72('0x9'));var client=jayson[_0x6b72('0xa')][_0x6b72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13522a,_0x1115f5,_0x4873c4){return new BPromise(function(_0x272e50,_0x1ad134){return client[_0x6b72('0xc')](_0x13522a,_0x4873c4)[_0x6b72('0xd')](function(_0x1c2589){logger[_0x6b72('0xe')](_0x6b72('0xf'),_0x1115f5,_0x6b72('0x10'));logger[_0x6b72('0x11')](_0x6b72('0x12'),_0x1115f5,_0x6b72('0x10'),JSON['stringify'](_0x1c2589));if(_0x1c2589['error']){if(_0x1c2589[_0x6b72('0x13')][_0x6b72('0x14')]===0x1f4){logger[_0x6b72('0x13')](_0x6b72('0xf'),_0x1115f5,_0x1c2589[_0x6b72('0x13')]['message']);return _0x1ad134(_0x1c2589['error']['message']);}logger[_0x6b72('0x13')](_0x6b72('0xf'),_0x1115f5,_0x1c2589[_0x6b72('0x13')][_0x6b72('0x15')]);return _0x272e50(_0x1c2589[_0x6b72('0x13')][_0x6b72('0x15')]);}else{logger[_0x6b72('0xe')](_0x6b72('0xf'),_0x1115f5,_0x6b72('0x10'));_0x272e50(_0x1c2589[_0x6b72('0x16')][_0x6b72('0x15')]);}})[_0x6b72('0x17')](function(_0x50cba3){logger[_0x6b72('0x13')](_0x6b72('0xf'),_0x1115f5,_0x50cba3);_0x1ad134(_0x50cba3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b58fd4d..0504c89 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 _0xaed9=['connect-timeout','Router','fs-extra','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x3302a6,_0x4d7c36){var _0x5433dd=function(_0x2fb83b){while(--_0x2fb83b){_0x3302a6['push'](_0x3302a6['shift']());}};_0x5433dd(++_0x4d7c36);}(_0xaed9,0x1eb));var _0x9aed=function(_0x54783e,_0xe85a52){_0x54783e=_0x54783e-0x0;var _0x4b03f4=_0xaed9[_0x54783e];return _0x4b03f4;};'use strict';var multer=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var path=require('path');var timeout=require(_0x9aed('0x2'));var express=require('express');var router=express[_0x9aed('0x3')]();var fs_extra=require(_0x9aed('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9aed('0x5'));router[_0x9aed('0x6')]('/',auth[_0x9aed('0x7')](),controller[_0x9aed('0x8')]);router['get'](_0x9aed('0x9'),auth[_0x9aed('0x7')](),controller[_0x9aed('0xa')]);router[_0x9aed('0xb')]('/',auth[_0x9aed('0x7')](),controller[_0x9aed('0xc')]);router['put'](_0x9aed('0x9'),auth[_0x9aed('0x7')](),controller[_0x9aed('0xd')]);router[_0x9aed('0xe')](_0x9aed('0x9'),auth['isAuthenticated'](),controller[_0x9aed('0xf')]);module[_0x9aed('0x10')]=router; \ No newline at end of file +var _0xed6f=['get','index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xed6f,0x64));var _0xfed6=function(_0x1b8d1c,_0x395b3b){_0x1b8d1c=_0x1b8d1c-0x0;var _0x159a0b=_0xed6f[_0x1b8d1c];return _0x159a0b;};'use strict';var multer=require(_0xfed6('0x0'));var util=require(_0xfed6('0x1'));var path=require(_0xfed6('0x2'));var timeout=require(_0xfed6('0x3'));var express=require('express');var router=express[_0xfed6('0x4')]();var fs_extra=require(_0xfed6('0x5'));var auth=require(_0xfed6('0x6'));var interaction=require(_0xfed6('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xfed6('0x8')]('/',auth['isAuthenticated'](),controller[_0xfed6('0x9')]);router['get'](_0xfed6('0xa'),auth[_0xfed6('0xb')](),controller[_0xfed6('0xc')]);router['post']('/',auth[_0xfed6('0xb')](),controller[_0xfed6('0xd')]);router[_0xfed6('0xe')](_0xfed6('0xa'),auth[_0xfed6('0xb')](),controller['update']);router[_0xfed6('0xf')](_0xfed6('0xa'),auth['isAuthenticated'](),controller[_0xfed6('0x10')]);module[_0xfed6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 40f624a..69e0f7b 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 _0x88e5=['string','customVariable','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x3de59f,_0x38ee89){var _0x1363fc=function(_0x2fb89c){while(--_0x2fb89c){_0x3de59f['push'](_0x3de59f['shift']());}};_0x1363fc(++_0x38ee89);}(_0x88e5,0xf6));var _0x588e=function(_0x38218d,_0x487a3d){_0x38218d=_0x38218d-0x0;var _0x273c9c=_0x88e5[_0x38218d];return _0x273c9c;};'use strict';var Sequelize=require('sequelize');module[_0x588e('0x0')]={'type':{'type':Sequelize[_0x588e('0x1')](_0x588e('0x2'),'variable',_0x588e('0x3'),'keyValue',_0x588e('0x4')),'defaultValue':_0x588e('0x2')},'content':{'type':Sequelize[_0x588e('0x5')]},'key':{'type':Sequelize[_0x588e('0x5')]},'keyType':{'type':Sequelize[_0x588e('0x1')](_0x588e('0x2'),_0x588e('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x588e('0x5')]},'idField':{'type':Sequelize[_0x588e('0x5')]},'nameField':{'type':Sequelize[_0x588e('0x5')]},'customField':{'type':Sequelize[_0x588e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x588e('0x5')]}}; \ No newline at end of file +var _0x5221=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3fabf9,_0x77efd7){var _0x5ad4d9=function(_0x8515c7){while(--_0x8515c7){_0x3fabf9['push'](_0x3fabf9['shift']());}};_0x5ad4d9(++_0x77efd7);}(_0x5221,0xdc));var _0x1522=function(_0x34a00f,_0x42f887){_0x34a00f=_0x34a00f-0x0;var _0x501cf4=_0x5221[_0x34a00f];return _0x501cf4;};'use strict';var Sequelize=require('sequelize');module[_0x1522('0x0')]={'type':{'type':Sequelize[_0x1522('0x1')](_0x1522('0x2'),_0x1522('0x3'),'customVariable',_0x1522('0x4'),_0x1522('0x5')),'defaultValue':_0x1522('0x2')},'content':{'type':Sequelize[_0x1522('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1522('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x1522('0x6')]},'idField':{'type':Sequelize[_0x1522('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1522('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1522('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index abccd86..d2ce5e9 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 _0xa066=['set','apply','reject','save','then','destroy','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x145a69,_0x243b63){var _0x34ebfb=function(_0x29bfca){while(--_0x29bfca){_0x145a69['push'](_0x145a69['shift']());}};_0x34ebfb(++_0x243b63);}(_0xa066,0xc1));var _0x6a06=function(_0x223af8,_0x58016f){_0x223af8=_0x223af8-0x0;var _0x4699f=_0xa066[_0x223af8];return _0x4699f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a06('0x0'));var zipdir=require(_0x6a06('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a06('0x2'));var BPromise=require(_0x6a06('0x3'));var Mustache=require(_0x6a06('0x4'));var util=require(_0x6a06('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6a06('0x6'));var ejs=require(_0x6a06('0x7'));var fs=require('fs');var fs_extra=require(_0x6a06('0x8'));var _=require(_0x6a06('0x9'));var squel=require(_0x6a06('0xa'));var crypto=require(_0x6a06('0xb'));var jsforce=require(_0x6a06('0xc'));var deskjs=require(_0x6a06('0xd'));var toCsv=require(_0x6a06('0x6'));var querystring=require('querystring');var Papa=require(_0x6a06('0xe'));var Redis=require(_0x6a06('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6a06('0x10'));var as=require(_0x6a06('0x11'));var hardwareService=require(_0x6a06('0x12'));var logger=require(_0x6a06('0x13'))(_0x6a06('0x14'));var utils=require(_0x6a06('0x15'));var config=require(_0x6a06('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a06('0x17'))['db'];function respondWithStatusCode(_0x5dc120,_0x2133cf){_0x2133cf=_0x2133cf||0xcc;return function(_0x3dd7ec){if(_0x3dd7ec){return _0x5dc120[_0x6a06('0x18')](_0x2133cf);}return _0x5dc120['status'](_0x2133cf)[_0x6a06('0x19')]();};}function respondWithResult(_0x1b1c02,_0x105535){_0x105535=_0x105535||0xc8;return function(_0x353202){if(_0x353202){return _0x1b1c02[_0x6a06('0x1a')](_0x105535)[_0x6a06('0x1b')](_0x353202);}};}function respondWithFilteredResult(_0x58deda,_0xad3996){return function(_0x3151e4){if(_0x3151e4){var _0x3332cd=typeof _0xad3996[_0x6a06('0x1c')]===_0x6a06('0x1d')&&typeof _0xad3996[_0x6a06('0x1e')]===_0x6a06('0x1d');var _0x27be96=_0x3151e4[_0x6a06('0x1f')];var _0x35a521=_0x3332cd?0x0:_0xad3996[_0x6a06('0x1c')];var _0x5bd3b8=_0x3332cd?_0x3151e4['count']:_0xad3996[_0x6a06('0x1c')]+_0xad3996[_0x6a06('0x1e')];var _0x2a893e;if(_0x5bd3b8>=_0x27be96){_0x5bd3b8=_0x27be96;_0x2a893e=0xc8;}else{_0x2a893e=0xce;}_0x58deda[_0x6a06('0x1a')](_0x2a893e);return _0x58deda[_0x6a06('0x20')]('Content-Range',_0x35a521+'-'+_0x5bd3b8+'/'+_0x27be96)[_0x6a06('0x1b')](_0x3151e4);}return null;};}function patchUpdates(_0x23bb86){return function(_0x4d6113){try{jsonpatch[_0x6a06('0x21')](_0x4d6113,_0x23bb86,!![]);}catch(_0x241b3e){return BPromise[_0x6a06('0x22')](_0x241b3e);}return _0x4d6113[_0x6a06('0x23')]();};}function saveUpdates(_0x284b8a,_0x5a04ff){return function(_0x36a892){if(_0x36a892){return _0x36a892['update'](_0x284b8a)[_0x6a06('0x24')](function(_0x494350){return _0x494350;});}return null;};}function removeEntity(_0x57efce,_0x49f4bb){return function(_0x1c3fc7){if(_0x1c3fc7){return _0x1c3fc7[_0x6a06('0x25')]()[_0x6a06('0x24')](function(){_0x57efce[_0x6a06('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a70fc,_0x234f73){return function(_0x1d3386){if(!_0x1d3386){_0x5a70fc[_0x6a06('0x18')](0x194);}return _0x1d3386;};}function handleError(_0x5705a1,_0x39733f){_0x39733f=_0x39733f||0x1f4;return function(_0x25301c){logger['error'](_0x25301c[_0x6a06('0x26')]);if(_0x25301c[_0x6a06('0x27')]){delete _0x25301c['name'];}_0x5705a1[_0x6a06('0x1a')](_0x39733f)[_0x6a06('0x28')](_0x25301c);};}exports[_0x6a06('0x29')]=function(_0x12043e,_0x5dc1d9){var _0x453207={},_0x3bc266={},_0x5a47fd={'count':0x0,'rows':[]};var _0x38b494=_['map'](db[_0x6a06('0x2a')][_0x6a06('0x2b')],function(_0x1417d9){return{'name':_0x1417d9[_0x6a06('0x2c')],'type':_0x1417d9[_0x6a06('0x2d')]['key']};});_0x3bc266[_0x6a06('0x2e')]=_['map'](_0x38b494,'name');_0x3bc266[_0x6a06('0x2f')]=_[_0x6a06('0x30')](_0x12043e[_0x6a06('0x2f')]);_0x3bc266['filters']=_[_0x6a06('0x31')](_0x3bc266['model'],_0x3bc266['query']);_0x453207['attributes']=_[_0x6a06('0x31')](_0x3bc266[_0x6a06('0x2e')],qs['fields'](_0x12043e['query'][_0x6a06('0x32')]));_0x453207[_0x6a06('0x33')]=_0x453207[_0x6a06('0x33')]['length']?_0x453207['attributes']:_0x3bc266[_0x6a06('0x2e')];if(!_0x12043e[_0x6a06('0x2f')][_0x6a06('0x34')](_0x6a06('0x35'))){_0x453207[_0x6a06('0x1e')]=qs[_0x6a06('0x1e')](_0x12043e['query'][_0x6a06('0x1e')]);_0x453207[_0x6a06('0x1c')]=qs[_0x6a06('0x1c')](_0x12043e[_0x6a06('0x2f')][_0x6a06('0x1c')]);}_0x453207[_0x6a06('0x36')]=qs[_0x6a06('0x37')](_0x12043e[_0x6a06('0x2f')][_0x6a06('0x37')]);_0x453207[_0x6a06('0x38')]=qs[_0x6a06('0x39')](_[_0x6a06('0x3a')](_0x12043e[_0x6a06('0x2f')],_0x3bc266[_0x6a06('0x39')]),_0x38b494);if(_0x12043e['query']['filter']){_0x453207[_0x6a06('0x38')]=_[_0x6a06('0x3b')](_0x453207['where'],{'$or':_[_0x6a06('0x3c')](_0x38b494,function(_0x1a08c1){if(_0x1a08c1[_0x6a06('0x2d')]!==_0x6a06('0x3d')){var _0x44f31e={};_0x44f31e[_0x1a08c1['name']]={'$like':'%'+_0x12043e[_0x6a06('0x2f')][_0x6a06('0x3e')]+'%'};return _0x44f31e;}})});}_0x453207=_[_0x6a06('0x3b')]({},_0x453207,_0x12043e[_0x6a06('0x3f')]);var _0x50658f={'where':_0x453207[_0x6a06('0x38')]};return db[_0x6a06('0x2a')]['count'](_0x50658f)[_0x6a06('0x24')](function(_0x37e254){_0x5a47fd[_0x6a06('0x1f')]=_0x37e254;if(_0x12043e[_0x6a06('0x2f')][_0x6a06('0x40')]){_0x453207[_0x6a06('0x41')]=[{'all':!![]}];}return db[_0x6a06('0x2a')][_0x6a06('0x42')](_0x453207);})[_0x6a06('0x24')](function(_0x24737d){_0x5a47fd[_0x6a06('0x43')]=_0x24737d;return _0x5a47fd;})[_0x6a06('0x24')](respondWithFilteredResult(_0x5dc1d9,_0x453207))['catch'](handleError(_0x5dc1d9,null));};exports[_0x6a06('0x44')]=function(_0x4b0067,_0x1ebe07){var _0xb2a27b={'raw':!![],'where':{'id':_0x4b0067[_0x6a06('0x45')]['id']}},_0x304d57={};_0x304d57[_0x6a06('0x2e')]=_[_0x6a06('0x30')](db[_0x6a06('0x2a')][_0x6a06('0x2b')]);_0x304d57[_0x6a06('0x2f')]=_[_0x6a06('0x30')](_0x4b0067[_0x6a06('0x2f')]);_0x304d57[_0x6a06('0x39')]=_[_0x6a06('0x31')](_0x304d57[_0x6a06('0x2e')],_0x304d57[_0x6a06('0x2f')]);_0xb2a27b[_0x6a06('0x33')]=_['intersection'](_0x304d57[_0x6a06('0x2e')],qs[_0x6a06('0x32')](_0x4b0067[_0x6a06('0x2f')]['fields']));_0xb2a27b[_0x6a06('0x33')]=_0xb2a27b[_0x6a06('0x33')]['length']?_0xb2a27b[_0x6a06('0x33')]:_0x304d57[_0x6a06('0x2e')];if(_0x4b0067['query'][_0x6a06('0x40')]){_0xb2a27b[_0x6a06('0x41')]=[{'all':!![]}];}_0xb2a27b=_[_0x6a06('0x3b')]({},_0xb2a27b,_0x4b0067[_0x6a06('0x3f')]);return db[_0x6a06('0x2a')][_0x6a06('0x46')](_0xb2a27b)['then'](handleEntityNotFound(_0x1ebe07,null))[_0x6a06('0x24')](respondWithResult(_0x1ebe07,null))[_0x6a06('0x47')](handleError(_0x1ebe07,null));};exports[_0x6a06('0x48')]=function(_0x28376a,_0x5140b6){return db[_0x6a06('0x2a')][_0x6a06('0x48')](_0x28376a[_0x6a06('0x49')],{})[_0x6a06('0x24')](respondWithResult(_0x5140b6,0xc9))[_0x6a06('0x47')](handleError(_0x5140b6,null));};exports[_0x6a06('0x4a')]=function(_0x172020,_0x2e69c9){if(_0x172020[_0x6a06('0x49')]['id']){delete _0x172020[_0x6a06('0x49')]['id'];}return db[_0x6a06('0x2a')][_0x6a06('0x46')]({'where':{'id':_0x172020['params']['id']}})['then'](handleEntityNotFound(_0x2e69c9,null))[_0x6a06('0x24')](saveUpdates(_0x172020['body'],null))[_0x6a06('0x24')](respondWithResult(_0x2e69c9,null))['catch'](handleError(_0x2e69c9,null));};exports[_0x6a06('0x25')]=function(_0x26ff57,_0x313a4c){return db['SugarcrmField'][_0x6a06('0x46')]({'where':{'id':_0x26ff57[_0x6a06('0x45')]['id']}})['then'](handleEntityNotFound(_0x313a4c,null))[_0x6a06('0x24')](removeEntity(_0x313a4c,null))[_0x6a06('0x47')](handleError(_0x313a4c,null));}; \ No newline at end of file +var _0x3789=['destroy','sendStatus','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3789,0x15e));var _0x9378=function(_0x2561dd,_0x2fc0b0){_0x2561dd=_0x2561dd-0x0;var _0x4173c7=_0x3789[_0x2561dd];return _0x4173c7;};'use strict';var emlformat=require(_0x9378('0x0'));var rimraf=require(_0x9378('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9378('0x2'));var rp=require('request-promise');var moment=require(_0x9378('0x3'));var BPromise=require(_0x9378('0x4'));var Mustache=require(_0x9378('0x5'));var util=require(_0x9378('0x6'));var path=require(_0x9378('0x7'));var sox=require(_0x9378('0x8'));var csv=require(_0x9378('0x9'));var ejs=require(_0x9378('0xa'));var fs=require('fs');var fs_extra=require(_0x9378('0xb'));var _=require(_0x9378('0xc'));var squel=require('squel');var crypto=require(_0x9378('0xd'));var jsforce=require(_0x9378('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9378('0x9'));var querystring=require('querystring');var Papa=require(_0x9378('0xf'));var Redis=require(_0x9378('0x10'));var authService=require(_0x9378('0x11'));var qs=require(_0x9378('0x12'));var as=require(_0x9378('0x13'));var hardwareService=require(_0x9378('0x14'));var logger=require(_0x9378('0x15'))(_0x9378('0x16'));var utils=require(_0x9378('0x17'));var config=require(_0x9378('0x18'));var licenseUtil=require(_0x9378('0x19'));var db=require(_0x9378('0x1a'))['db'];function respondWithStatusCode(_0x143274,_0x479947){_0x479947=_0x479947||0xcc;return function(_0x3472bc){if(_0x3472bc){return _0x143274['sendStatus'](_0x479947);}return _0x143274[_0x9378('0x1b')](_0x479947)[_0x9378('0x1c')]();};}function respondWithResult(_0x5a78af,_0x1e9b9a){_0x1e9b9a=_0x1e9b9a||0xc8;return function(_0x4a80d5){if(_0x4a80d5){return _0x5a78af[_0x9378('0x1b')](_0x1e9b9a)[_0x9378('0x1d')](_0x4a80d5);}};}function respondWithFilteredResult(_0x5bf889,_0x3be7bc){return function(_0xafb5fb){if(_0xafb5fb){var _0x4bd50f=typeof _0x3be7bc['offset']===_0x9378('0x1e')&&typeof _0x3be7bc[_0x9378('0x1f')]===_0x9378('0x1e');var _0x71edcc=_0xafb5fb['count'];var _0x36581e=_0x4bd50f?0x0:_0x3be7bc[_0x9378('0x20')];var _0x523aa2=_0x4bd50f?_0xafb5fb[_0x9378('0x21')]:_0x3be7bc['offset']+_0x3be7bc[_0x9378('0x1f')];var _0x41340f;if(_0x523aa2>=_0x71edcc){_0x523aa2=_0x71edcc;_0x41340f=0xc8;}else{_0x41340f=0xce;}_0x5bf889[_0x9378('0x1b')](_0x41340f);return _0x5bf889[_0x9378('0x22')](_0x9378('0x23'),_0x36581e+'-'+_0x523aa2+'/'+_0x71edcc)[_0x9378('0x1d')](_0xafb5fb);}return null;};}function patchUpdates(_0x3ffa7f){return function(_0xbdde31){try{jsonpatch[_0x9378('0x24')](_0xbdde31,_0x3ffa7f,!![]);}catch(_0x1a9d23){return BPromise[_0x9378('0x25')](_0x1a9d23);}return _0xbdde31['save']();};}function saveUpdates(_0x51a9a7,_0x111f74){return function(_0x9a4cc7){if(_0x9a4cc7){return _0x9a4cc7[_0x9378('0x26')](_0x51a9a7)[_0x9378('0x27')](function(_0x4257d5){return _0x4257d5;});}return null;};}function removeEntity(_0x40cd22,_0x4fc191){return function(_0x123962){if(_0x123962){return _0x123962[_0x9378('0x28')]()[_0x9378('0x27')](function(){_0x40cd22[_0x9378('0x1b')](0xcc)[_0x9378('0x1c')]();});}};}function handleEntityNotFound(_0x464fc0,_0x54d1b9){return function(_0x1507d6){if(!_0x1507d6){_0x464fc0[_0x9378('0x29')](0x194);}return _0x1507d6;};}function handleError(_0x165b1f,_0x743dd9){_0x743dd9=_0x743dd9||0x1f4;return function(_0xb9fd7f){logger['error'](_0xb9fd7f[_0x9378('0x2a')]);if(_0xb9fd7f[_0x9378('0x2b')]){delete _0xb9fd7f[_0x9378('0x2b')];}_0x165b1f[_0x9378('0x1b')](_0x743dd9)[_0x9378('0x2c')](_0xb9fd7f);};}exports[_0x9378('0x2d')]=function(_0x15346d,_0x3cadd0){var _0x2271b1={},_0xcf3aca={},_0x28dd61={'count':0x0,'rows':[]};var _0x5094d3=_[_0x9378('0x2e')](db[_0x9378('0x2f')][_0x9378('0x30')],function(_0x4b2cff){return{'name':_0x4b2cff[_0x9378('0x31')],'type':_0x4b2cff['type'][_0x9378('0x32')]};});_0xcf3aca[_0x9378('0x33')]=_[_0x9378('0x2e')](_0x5094d3,_0x9378('0x2b'));_0xcf3aca['query']=_[_0x9378('0x34')](_0x15346d[_0x9378('0x35')]);_0xcf3aca['filters']=_[_0x9378('0x36')](_0xcf3aca[_0x9378('0x33')],_0xcf3aca[_0x9378('0x35')]);_0x2271b1['attributes']=_[_0x9378('0x36')](_0xcf3aca[_0x9378('0x33')],qs['fields'](_0x15346d['query'][_0x9378('0x37')]));_0x2271b1[_0x9378('0x38')]=_0x2271b1[_0x9378('0x38')]['length']?_0x2271b1[_0x9378('0x38')]:_0xcf3aca[_0x9378('0x33')];if(!_0x15346d[_0x9378('0x35')]['hasOwnProperty'](_0x9378('0x39'))){_0x2271b1[_0x9378('0x1f')]=qs[_0x9378('0x1f')](_0x15346d[_0x9378('0x35')]['limit']);_0x2271b1[_0x9378('0x20')]=qs[_0x9378('0x20')](_0x15346d[_0x9378('0x35')]['offset']);}_0x2271b1[_0x9378('0x3a')]=qs[_0x9378('0x3b')](_0x15346d['query'][_0x9378('0x3b')]);_0x2271b1[_0x9378('0x3c')]=qs[_0x9378('0x3d')](_[_0x9378('0x3e')](_0x15346d[_0x9378('0x35')],_0xcf3aca[_0x9378('0x3d')]),_0x5094d3);if(_0x15346d[_0x9378('0x35')][_0x9378('0x3f')]){_0x2271b1['where']=_[_0x9378('0x40')](_0x2271b1[_0x9378('0x3c')],{'$or':_['map'](_0x5094d3,function(_0x3bb7f6){if(_0x3bb7f6[_0x9378('0x41')]!=='VIRTUAL'){var _0x148945={};_0x148945[_0x3bb7f6[_0x9378('0x2b')]]={'$like':'%'+_0x15346d['query'][_0x9378('0x3f')]+'%'};return _0x148945;}})});}_0x2271b1=_[_0x9378('0x40')]({},_0x2271b1,_0x15346d[_0x9378('0x42')]);var _0x21dae7={'where':_0x2271b1[_0x9378('0x3c')]};return db[_0x9378('0x2f')][_0x9378('0x21')](_0x21dae7)[_0x9378('0x27')](function(_0x1a8ca5){_0x28dd61['count']=_0x1a8ca5;if(_0x15346d[_0x9378('0x35')][_0x9378('0x43')]){_0x2271b1[_0x9378('0x44')]=[{'all':!![]}];}return db[_0x9378('0x2f')][_0x9378('0x45')](_0x2271b1);})[_0x9378('0x27')](function(_0x55c272){_0x28dd61[_0x9378('0x46')]=_0x55c272;return _0x28dd61;})[_0x9378('0x27')](respondWithFilteredResult(_0x3cadd0,_0x2271b1))[_0x9378('0x47')](handleError(_0x3cadd0,null));};exports[_0x9378('0x48')]=function(_0x3874b8,_0x1a4a41){var _0x189dc6={'raw':!![],'where':{'id':_0x3874b8[_0x9378('0x49')]['id']}},_0xc423ef={};_0xc423ef[_0x9378('0x33')]=_[_0x9378('0x34')](db[_0x9378('0x2f')][_0x9378('0x30')]);_0xc423ef[_0x9378('0x35')]=_['keys'](_0x3874b8[_0x9378('0x35')]);_0xc423ef['filters']=_[_0x9378('0x36')](_0xc423ef[_0x9378('0x33')],_0xc423ef['query']);_0x189dc6[_0x9378('0x38')]=_[_0x9378('0x36')](_0xc423ef[_0x9378('0x33')],qs[_0x9378('0x37')](_0x3874b8[_0x9378('0x35')][_0x9378('0x37')]));_0x189dc6[_0x9378('0x38')]=_0x189dc6[_0x9378('0x38')][_0x9378('0x4a')]?_0x189dc6['attributes']:_0xc423ef[_0x9378('0x33')];if(_0x3874b8[_0x9378('0x35')]['includeAll']){_0x189dc6['include']=[{'all':!![]}];}_0x189dc6=_[_0x9378('0x40')]({},_0x189dc6,_0x3874b8[_0x9378('0x42')]);return db[_0x9378('0x2f')]['find'](_0x189dc6)[_0x9378('0x27')](handleEntityNotFound(_0x1a4a41,null))[_0x9378('0x27')](respondWithResult(_0x1a4a41,null))[_0x9378('0x47')](handleError(_0x1a4a41,null));};exports[_0x9378('0x4b')]=function(_0x50d559,_0x38ad47){return db[_0x9378('0x2f')]['create'](_0x50d559['body'],{})['then'](respondWithResult(_0x38ad47,0xc9))[_0x9378('0x47')](handleError(_0x38ad47,null));};exports[_0x9378('0x26')]=function(_0x479c1b,_0x5c80e5){if(_0x479c1b[_0x9378('0x4c')]['id']){delete _0x479c1b[_0x9378('0x4c')]['id'];}return db[_0x9378('0x2f')][_0x9378('0x4d')]({'where':{'id':_0x479c1b[_0x9378('0x49')]['id']}})[_0x9378('0x27')](handleEntityNotFound(_0x5c80e5,null))['then'](saveUpdates(_0x479c1b[_0x9378('0x4c')],null))['then'](respondWithResult(_0x5c80e5,null))[_0x9378('0x47')](handleError(_0x5c80e5,null));};exports[_0x9378('0x28')]=function(_0x5b5f09,_0x86b12){return db['SugarcrmField'][_0x9378('0x4d')]({'where':{'id':_0x5b5f09[_0x9378('0x49')]['id']}})[_0x9378('0x27')](handleEntityNotFound(_0x86b12,null))[_0x9378('0x27')](removeEntity(_0x86b12,null))['catch'](handleError(_0x86b12,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index de0c8da..2359c39 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 _0xbb54=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x287528,_0x2fbba7){var _0xc05e28=function(_0x264866){while(--_0x264866){_0x287528['push'](_0x287528['shift']());}};_0xc05e28(++_0x2fbba7);}(_0xbb54,0x1f4));var _0x4bb5=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xbb54[_0x2eec1f];return _0x543075;};'use strict';var _=require(_0x4bb5('0x0'));var util=require(_0x4bb5('0x1'));var logger=require(_0x4bb5('0x2'))('api');var moment=require(_0x4bb5('0x3'));var BPromise=require('bluebird');var rp=require(_0x4bb5('0x4'));var fs=require('fs');var path=require(_0x4bb5('0x5'));var rimraf=require(_0x4bb5('0x6'));var config=require(_0x4bb5('0x7'));var attributes=require(_0x4bb5('0x8'));module[_0x4bb5('0x9')]=function(_0x1f5982,_0x324164){return _0x1f5982[_0x4bb5('0xa')](_0x4bb5('0xb'),attributes,{'tableName':_0x4bb5('0xc'),'paranoid':![],'indexes':[{'name':_0x4bb5('0xd'),'fields':[_0x4bb5('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06fb=['util','api','bluebird','request-promise','path','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x19d7da,_0x4fdc7d){var _0x28b3b9=function(_0x150339){while(--_0x150339){_0x19d7da['push'](_0x19d7da['shift']());}};_0x28b3b9(++_0x4fdc7d);}(_0x06fb,0x17f));var _0xb06f=function(_0x406639,_0x229acf){_0x406639=_0x406639-0x0;var _0x53a354=_0x06fb[_0x406639];return _0x53a354;};'use strict';var _=require(_0xb06f('0x0'));var util=require(_0xb06f('0x1'));var logger=require('../../config/logger')(_0xb06f('0x2'));var moment=require('moment');var BPromise=require(_0xb06f('0x3'));var rp=require(_0xb06f('0x4'));var fs=require('fs');var path=require(_0xb06f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x5b4e77,_0x541fd6){return _0x5b4e77[_0xb06f('0x6')](_0xb06f('0x7'),attributes,{'tableName':_0xb06f('0x8'),'paranoid':![],'indexes':[{'name':_0xb06f('0x9'),'fields':[_0xb06f('0xa'),_0xb06f('0xb')],'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 2b642b1..17a3152 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 _0x4487=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x91ac07,_0x19410e){var _0x40e947=function(_0x4d9555){while(--_0x4d9555){_0x91ac07['push'](_0x91ac07['shift']());}};_0x40e947(++_0x19410e);}(_0x4487,0x1e9));var _0x7448=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4487[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x7448('0x0'));var util=require(_0x7448('0x1'));var moment=require(_0x7448('0x2'));var BPromise=require(_0x7448('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7448('0x4'))['db'];var utils=require(_0x7448('0x5'));var logger=require(_0x7448('0x6'))(_0x7448('0x7'));var config=require(_0x7448('0x8'));var jayson=require(_0x7448('0x9'));var client=jayson[_0x7448('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x315000,_0x2d1da9,_0x410781){return new BPromise(function(_0x46e501,_0x299670){return client[_0x7448('0xb')](_0x315000,_0x410781)[_0x7448('0xc')](function(_0x13e3bb){logger[_0x7448('0xd')](_0x7448('0xe'),_0x2d1da9,'request\x20sent');logger[_0x7448('0xf')](_0x7448('0x10'),_0x2d1da9,_0x7448('0x11'),JSON[_0x7448('0x12')](_0x13e3bb));if(_0x13e3bb[_0x7448('0x13')]){if(_0x13e3bb['error'][_0x7448('0x14')]===0x1f4){logger['error'](_0x7448('0xe'),_0x2d1da9,_0x13e3bb[_0x7448('0x13')][_0x7448('0x15')]);return _0x299670(_0x13e3bb[_0x7448('0x13')][_0x7448('0x15')]);}logger[_0x7448('0x13')](_0x7448('0xe'),_0x2d1da9,_0x13e3bb[_0x7448('0x13')]['message']);return _0x46e501(_0x13e3bb[_0x7448('0x13')][_0x7448('0x15')]);}else{logger['info'](_0x7448('0xe'),_0x2d1da9,_0x7448('0x11'));_0x46e501(_0x13e3bb[_0x7448('0x16')]['message']);}})[_0x7448('0x17')](function(_0x3f65eb){logger[_0x7448('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2d1da9,_0x3f65eb);_0x299670(_0x3f65eb);});});} \ No newline at end of file +var _0x4b23=['client','http','request','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x430a54,_0x1912b){var _0x50e04f=function(_0x88ae65){while(--_0x88ae65){_0x430a54['push'](_0x430a54['shift']());}};_0x50e04f(++_0x1912b);}(_0x4b23,0x1e3));var _0x34b2=function(_0x5efb3c,_0x852a5a){_0x5efb3c=_0x5efb3c-0x0;var _0x349be3=_0x4b23[_0x5efb3c];return _0x349be3;};'use strict';var _=require(_0x34b2('0x0'));var util=require(_0x34b2('0x1'));var moment=require('moment');var BPromise=require(_0x34b2('0x2'));var rs=require(_0x34b2('0x3'));var fs=require('fs');var Redis=require(_0x34b2('0x4'));var db=require(_0x34b2('0x5'))['db'];var utils=require(_0x34b2('0x6'));var logger=require(_0x34b2('0x7'))(_0x34b2('0x8'));var config=require(_0x34b2('0x9'));var jayson=require(_0x34b2('0xa'));var client=jayson[_0x34b2('0xb')][_0x34b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13e0f8,_0x4f64a1,_0x5b9c05){return new BPromise(function(_0x25252d,_0x26ab1f){return client[_0x34b2('0xd')](_0x13e0f8,_0x5b9c05)[_0x34b2('0xe')](function(_0x181e6c){logger[_0x34b2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4f64a1,'request\x20sent');logger[_0x34b2('0x10')](_0x34b2('0x11'),_0x4f64a1,_0x34b2('0x12'),JSON[_0x34b2('0x13')](_0x181e6c));if(_0x181e6c['error']){if(_0x181e6c[_0x34b2('0x14')][_0x34b2('0x15')]===0x1f4){logger['error'](_0x34b2('0x16'),_0x4f64a1,_0x181e6c[_0x34b2('0x14')][_0x34b2('0x17')]);return _0x26ab1f(_0x181e6c[_0x34b2('0x14')][_0x34b2('0x17')]);}logger[_0x34b2('0x14')](_0x34b2('0x16'),_0x4f64a1,_0x181e6c['error']['message']);return _0x25252d(_0x181e6c[_0x34b2('0x14')][_0x34b2('0x17')]);}else{logger[_0x34b2('0xf')](_0x34b2('0x16'),_0x4f64a1,'request\x20sent');_0x25252d(_0x181e6c[_0x34b2('0x18')][_0x34b2('0x17')]);}})[_0x34b2('0x19')](function(_0x32731a){logger[_0x34b2('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x4f64a1,_0x32731a);_0x26ab1f(_0x32731a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 26e6123..2b0de83 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 _0xf2c7=['isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0xf2c7[_0x3a3758];return _0x1a9234;};'use strict';var multer=require(_0x7f2c('0x0'));var util=require(_0x7f2c('0x1'));var path=require(_0x7f2c('0x2'));var timeout=require(_0x7f2c('0x3'));var express=require('express');var router=express[_0x7f2c('0x4')]();var fs_extra=require(_0x7f2c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f2c('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x7f2c('0x7')]('/',auth[_0x7f2c('0x8')](),controller['index']);router[_0x7f2c('0x7')](_0x7f2c('0x9'),auth[_0x7f2c('0x8')](),controller['show']);router[_0x7f2c('0x7')](_0x7f2c('0xa'),auth[_0x7f2c('0x8')](),controller[_0x7f2c('0xb')]);router[_0x7f2c('0x7')](_0x7f2c('0xc'),auth['isAuthenticated'](),controller[_0x7f2c('0xd')]);router[_0x7f2c('0xe')]('/',auth[_0x7f2c('0x8')](),controller[_0x7f2c('0xf')]);router[_0x7f2c('0xe')](_0x7f2c('0xa'),auth[_0x7f2c('0x8')](),controller[_0x7f2c('0x10')]);router[_0x7f2c('0x11')]('/:id',auth[_0x7f2c('0x8')](),controller['update']);router[_0x7f2c('0x12')](_0x7f2c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7f2c('0x13')]=router; \ No newline at end of file +var _0x3613=['/:id/configurations','getConfigurations','create','post','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index'];(function(_0x301914,_0x13d31d){var _0x3f3a15=function(_0x21a56a){while(--_0x21a56a){_0x301914['push'](_0x301914['shift']());}};_0x3f3a15(++_0x13d31d);}(_0x3613,0x198));var _0x3361=function(_0x2f1272,_0x5593ac){_0x2f1272=_0x2f1272-0x0;var _0x4df7e7=_0x3613[_0x2f1272];return _0x4df7e7;};'use strict';var multer=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var path=require(_0x3361('0x2'));var timeout=require(_0x3361('0x3'));var express=require(_0x3361('0x4'));var router=express[_0x3361('0x5')]();var fs_extra=require(_0x3361('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3361('0x7'));var config=require('../../config/environment');var controller=require(_0x3361('0x8'));router[_0x3361('0x9')]('/',auth[_0x3361('0xa')](),controller[_0x3361('0xb')]);router[_0x3361('0x9')]('/:id',auth[_0x3361('0xa')](),controller['show']);router[_0x3361('0x9')](_0x3361('0xc'),auth[_0x3361('0xa')](),controller[_0x3361('0xd')]);router[_0x3361('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x3361('0xe')]);router[_0x3361('0xf')](_0x3361('0xc'),auth[_0x3361('0xa')](),controller[_0x3361('0x10')]);router['put'](_0x3361('0x11'),auth[_0x3361('0xa')](),controller[_0x3361('0x12')]);router['delete'](_0x3361('0x11'),auth[_0x3361('0xa')](),controller[_0x3361('0x13')]);module[_0x3361('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0c33279..53df1b1 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 _0xc550=['STRING','HelpDesk','sequelize','exports'];(function(_0x20a811,_0x27aae2){var _0x3f1ace=function(_0x2e4f55){while(--_0x2e4f55){_0x20a811['push'](_0x20a811['shift']());}};_0x3f1ace(++_0x27aae2);}(_0xc550,0x172));var _0x0c55=function(_0x6923ea,_0x4b5785){_0x6923ea=_0x6923ea-0x0;var _0x37b5d1=_0xc550[_0x6923ea];return _0x37b5d1;};'use strict';var Sequelize=require(_0x0c55('0x0'));module[_0x0c55('0x1')]={'name':{'type':Sequelize[_0x0c55('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0c55('0x2')]},'username':{'type':Sequelize[_0x0c55('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0c55('0x3')},'remoteUri':{'type':Sequelize[_0x0c55('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0c55('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x108a=['HelpDesk','sequelize','exports','STRING'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x108a,0x155));var _0xa108=function(_0x3be6de,_0x44c0fd){_0x3be6de=_0x3be6de-0x0;var _0x548195=_0x108a[_0x3be6de];return _0x548195;};'use strict';var Sequelize=require(_0xa108('0x0'));module[_0xa108('0x1')]={'name':{'type':Sequelize[_0xa108('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa108('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa108('0x3')},'remoteUri':{'type':Sequelize[_0xa108('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa108('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa108('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index eead29b..cc8a0ba 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 _0x89d9=['create','body','getConfigurations','findOne','VtigerConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','GET','getchallenge','success','login','token','result','sessionName','autogenerated','reference','owner','includes','remove','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','rows','catch','show','params','rawAttributes','includeAll','include','find'];(function(_0x25bb6b,_0x544cab){var _0x23163f=function(_0x1920f8){while(--_0x1920f8){_0x25bb6b['push'](_0x25bb6b['shift']());}};_0x23163f(++_0x544cab);}(_0x89d9,0x124));var _0x989d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x89d9[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x989d('0x0'));var rimraf=require(_0x989d('0x1'));var zipdir=require(_0x989d('0x2'));var jsonpatch=require(_0x989d('0x3'));var rp=require(_0x989d('0x4'));var moment=require(_0x989d('0x5'));var BPromise=require(_0x989d('0x6'));var Mustache=require('mustache');var util=require(_0x989d('0x7'));var path=require('path');var sox=require(_0x989d('0x8'));var csv=require(_0x989d('0x9'));var ejs=require(_0x989d('0xa'));var fs=require('fs');var fs_extra=require(_0x989d('0xb'));var _=require('lodash');var squel=require(_0x989d('0xc'));var crypto=require(_0x989d('0xd'));var jsforce=require(_0x989d('0xe'));var deskjs=require(_0x989d('0xf'));var toCsv=require(_0x989d('0x9'));var querystring=require(_0x989d('0x10'));var Papa=require(_0x989d('0x11'));var Redis=require(_0x989d('0x12'));var authService=require(_0x989d('0x13'));var qs=require(_0x989d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x989d('0x15'));var logger=require(_0x989d('0x16'))(_0x989d('0x17'));var utils=require(_0x989d('0x18'));var config=require(_0x989d('0x19'));var licenseUtil=require(_0x989d('0x1a'));var db=require(_0x989d('0x1b'))['db'];var integrations=require(_0x989d('0x1c'));function respondWithStatusCode(_0x4f5a78,_0x14896f){_0x14896f=_0x14896f||0xcc;return function(_0x2b32a2){if(_0x2b32a2){return _0x4f5a78[_0x989d('0x1d')](_0x14896f);}return _0x4f5a78[_0x989d('0x1e')](_0x14896f)[_0x989d('0x1f')]();};}function respondWithResult(_0x449c93,_0x2cf361){_0x2cf361=_0x2cf361||0xc8;return function(_0x2ebe47){if(_0x2ebe47){return _0x449c93[_0x989d('0x1e')](_0x2cf361)[_0x989d('0x20')](_0x2ebe47);}};}function respondWithFilteredResult(_0x55b937,_0x454971){return function(_0x18967b){if(_0x18967b){var _0x461d1b=typeof _0x454971[_0x989d('0x21')]===_0x989d('0x22')&&typeof _0x454971['limit']===_0x989d('0x22');var _0x45338c=_0x18967b[_0x989d('0x23')];var _0x4aea91=_0x461d1b?0x0:_0x454971[_0x989d('0x21')];var _0x494004=_0x461d1b?_0x18967b[_0x989d('0x23')]:_0x454971['offset']+_0x454971[_0x989d('0x24')];var _0xecae62;if(_0x494004>=_0x45338c){_0x494004=_0x45338c;_0xecae62=0xc8;}else{_0xecae62=0xce;}_0x55b937[_0x989d('0x1e')](_0xecae62);return _0x55b937[_0x989d('0x25')](_0x989d('0x26'),_0x4aea91+'-'+_0x494004+'/'+_0x45338c)['json'](_0x18967b);}return null;};}function patchUpdates(_0x35a9b8){return function(_0x2d1d32){try{jsonpatch[_0x989d('0x27')](_0x2d1d32,_0x35a9b8,!![]);}catch(_0x3fd85f){return BPromise[_0x989d('0x28')](_0x3fd85f);}return _0x2d1d32[_0x989d('0x29')]();};}function saveUpdates(_0x4979c9,_0x5ce917){return function(_0x477f42){if(_0x477f42){return _0x477f42[_0x989d('0x2a')](_0x4979c9)[_0x989d('0x2b')](function(_0x25f61a){return _0x25f61a;});}return null;};}function removeEntity(_0x1ef4df,_0x25c9e8){return function(_0x5666ea){if(_0x5666ea){return _0x5666ea[_0x989d('0x2c')]()[_0x989d('0x2b')](function(){_0x1ef4df[_0x989d('0x1e')](0xcc)[_0x989d('0x1f')]();});}};}function handleEntityNotFound(_0x15dca5,_0x6b9af1){return function(_0x26d802){if(!_0x26d802){_0x15dca5['sendStatus'](0x194);}return _0x26d802;};}function handleError(_0x4ecfc9,_0x5d1151){_0x5d1151=_0x5d1151||0x1f4;return function(_0x98e5e6){logger['error'](_0x98e5e6[_0x989d('0x2d')]);if(_0x98e5e6[_0x989d('0x2e')]){delete _0x98e5e6[_0x989d('0x2e')];}_0x4ecfc9['status'](_0x5d1151)[_0x989d('0x2f')](_0x98e5e6);};}exports[_0x989d('0x30')]=function(_0x869978,_0x3f1ba0){var _0x22e6e4={},_0xe3a1e5={},_0x33b77a={'count':0x0,'rows':[]};var _0x3fa234=_[_0x989d('0x31')](db[_0x989d('0x32')]['rawAttributes'],function(_0x18c867){return{'name':_0x18c867[_0x989d('0x33')],'type':_0x18c867[_0x989d('0x34')][_0x989d('0x35')]};});_0xe3a1e5['model']=_[_0x989d('0x31')](_0x3fa234,'name');_0xe3a1e5['query']=_[_0x989d('0x36')](_0x869978['query']);_0xe3a1e5[_0x989d('0x37')]=_[_0x989d('0x38')](_0xe3a1e5['model'],_0xe3a1e5[_0x989d('0x39')]);_0x22e6e4[_0x989d('0x3a')]=_[_0x989d('0x38')](_0xe3a1e5[_0x989d('0x3b')],qs[_0x989d('0x3c')](_0x869978[_0x989d('0x39')][_0x989d('0x3c')]));_0x22e6e4[_0x989d('0x3a')]=_0x22e6e4[_0x989d('0x3a')][_0x989d('0x3d')]?_0x22e6e4[_0x989d('0x3a')]:_0xe3a1e5[_0x989d('0x3b')];if(!_0x869978['query'][_0x989d('0x3e')]('nolimit')){_0x22e6e4['limit']=qs[_0x989d('0x24')](_0x869978[_0x989d('0x39')][_0x989d('0x24')]);_0x22e6e4[_0x989d('0x21')]=qs['offset'](_0x869978[_0x989d('0x39')]['offset']);}_0x22e6e4[_0x989d('0x3f')]=qs[_0x989d('0x40')](_0x869978[_0x989d('0x39')][_0x989d('0x40')]);_0x22e6e4[_0x989d('0x41')]=qs[_0x989d('0x37')](_['pick'](_0x869978[_0x989d('0x39')],_0xe3a1e5[_0x989d('0x37')]),_0x3fa234);if(_0x869978['query'][_0x989d('0x42')]){_0x22e6e4[_0x989d('0x41')]=_[_0x989d('0x43')](_0x22e6e4[_0x989d('0x41')],{'$or':_[_0x989d('0x31')](_0x3fa234,function(_0x46c82e){if(_0x46c82e[_0x989d('0x34')]!=='VIRTUAL'){var _0x260023={};_0x260023[_0x46c82e[_0x989d('0x2e')]]={'$like':'%'+_0x869978[_0x989d('0x39')]['filter']+'%'};return _0x260023;}})});}_0x22e6e4=_[_0x989d('0x43')]({},_0x22e6e4,_0x869978[_0x989d('0x44')]);var _0x21785c={'where':_0x22e6e4[_0x989d('0x41')]};return db['VtigerAccount'][_0x989d('0x23')](_0x21785c)['then'](function(_0x57058a){_0x33b77a[_0x989d('0x23')]=_0x57058a;if(_0x869978[_0x989d('0x39')]['includeAll']){_0x22e6e4['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x22e6e4);})[_0x989d('0x2b')](function(_0x35d1fb){_0x33b77a[_0x989d('0x45')]=_0x35d1fb;return _0x33b77a;})['then'](respondWithFilteredResult(_0x3f1ba0,_0x22e6e4))[_0x989d('0x46')](handleError(_0x3f1ba0,null));};exports[_0x989d('0x47')]=function(_0x1330b2,_0x438acc){var _0x16cdcc={'raw':![],'where':{'id':_0x1330b2[_0x989d('0x48')]['id']}},_0x5ab19b={};_0x5ab19b[_0x989d('0x3b')]=_[_0x989d('0x36')](db['VtigerAccount'][_0x989d('0x49')]);_0x5ab19b['query']=_[_0x989d('0x36')](_0x1330b2['query']);_0x5ab19b[_0x989d('0x37')]=_[_0x989d('0x38')](_0x5ab19b['model'],_0x5ab19b[_0x989d('0x39')]);_0x16cdcc['attributes']=_['intersection'](_0x5ab19b[_0x989d('0x3b')],qs['fields'](_0x1330b2[_0x989d('0x39')][_0x989d('0x3c')]));_0x16cdcc[_0x989d('0x3a')]=_0x16cdcc['attributes'][_0x989d('0x3d')]?_0x16cdcc['attributes']:_0x5ab19b[_0x989d('0x3b')];if(_0x1330b2[_0x989d('0x39')][_0x989d('0x4a')]){_0x16cdcc[_0x989d('0x4b')]=[{'all':!![]}];}_0x16cdcc=_[_0x989d('0x43')]({},_0x16cdcc,_0x1330b2[_0x989d('0x44')]);return db['VtigerAccount'][_0x989d('0x4c')](_0x16cdcc)['then'](handleEntityNotFound(_0x438acc,null))[_0x989d('0x2b')](respondWithResult(_0x438acc,null))[_0x989d('0x46')](handleError(_0x438acc,null));};exports[_0x989d('0x4d')]=function(_0x47a8bb,_0x320bf2){return db['VtigerAccount'][_0x989d('0x4d')](_0x47a8bb['body'],{})['then'](respondWithResult(_0x320bf2,0xc9))[_0x989d('0x46')](handleError(_0x320bf2,null));};exports[_0x989d('0x2a')]=function(_0x34370b,_0x5ae521){if(_0x34370b['body']['id']){delete _0x34370b[_0x989d('0x4e')]['id'];}return db[_0x989d('0x32')]['find']({'where':{'id':_0x34370b['params']['id']}})[_0x989d('0x2b')](handleEntityNotFound(_0x5ae521,null))[_0x989d('0x2b')](saveUpdates(_0x34370b['body'],null))['then'](respondWithResult(_0x5ae521,null))['catch'](handleError(_0x5ae521,null));};exports[_0x989d('0x2c')]=function(_0x1d4cd9,_0x34bf45){return db[_0x989d('0x32')][_0x989d('0x4c')]({'where':{'id':_0x1d4cd9['params']['id']}})[_0x989d('0x2b')](handleEntityNotFound(_0x34bf45,null))[_0x989d('0x2b')](removeEntity(_0x34bf45,null))['catch'](handleError(_0x34bf45,null));};exports[_0x989d('0x4f')]=function(_0x14bdda,_0x1b9e6b,_0x1940cc){var _0x13d751={};var _0x1e8671={};var _0x2fb735;var _0xab5f7c;return db['VtigerAccount'][_0x989d('0x50')]({'where':{'id':_0x14bdda[_0x989d('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b9e6b,null))[_0x989d('0x2b')](function(_0xf7540c){if(_0xf7540c){_0x2fb735=_0xf7540c;_0x1e8671[_0x989d('0x3b')]=_['keys'](db[_0x989d('0x51')][_0x989d('0x49')]);_0x1e8671[_0x989d('0x39')]=_[_0x989d('0x36')](_0x14bdda[_0x989d('0x39')]);_0x1e8671[_0x989d('0x37')]=_[_0x989d('0x38')](_0x1e8671['model'],_0x1e8671[_0x989d('0x39')]);_0x13d751['attributes']=_[_0x989d('0x38')](_0x1e8671[_0x989d('0x3b')],qs['fields'](_0x14bdda[_0x989d('0x39')]['fields']));_0x13d751[_0x989d('0x3a')]=_0x13d751['attributes'][_0x989d('0x3d')]?_0x13d751[_0x989d('0x3a')]:_0x1e8671[_0x989d('0x3b')];_0x13d751['order']=qs['sort'](_0x14bdda[_0x989d('0x39')]['sort']);_0x13d751[_0x989d('0x41')]=qs[_0x989d('0x37')](_[_0x989d('0x52')](_0x14bdda[_0x989d('0x39')],_0x1e8671[_0x989d('0x37')]));if(_0x14bdda[_0x989d('0x39')]['filter']){_0x13d751[_0x989d('0x41')]=_['merge'](_0x13d751[_0x989d('0x41')],{'$or':_[_0x989d('0x31')](_0x13d751[_0x989d('0x3a')],function(_0x5b8ed4){var _0x260282={};_0x260282[_0x5b8ed4]={'$like':'%'+_0x14bdda['query']['filter']+'%'};return _0x260282;})});}_0x13d751=_[_0x989d('0x43')]({},_0x13d751,_0x14bdda[_0x989d('0x44')]);return _0x2fb735[_0x989d('0x4f')](_0x13d751);}})[_0x989d('0x2b')](function(_0x7e1ce6){if(_0x7e1ce6){_0xab5f7c=_0x7e1ce6['length'];if(!_0x14bdda[_0x989d('0x39')][_0x989d('0x3e')](_0x989d('0x53'))){_0x13d751[_0x989d('0x24')]=qs[_0x989d('0x24')](_0x14bdda['query'][_0x989d('0x24')]);_0x13d751[_0x989d('0x21')]=qs[_0x989d('0x21')](_0x14bdda[_0x989d('0x39')][_0x989d('0x21')]);}return _0x2fb735['getConfigurations'](_0x13d751);}})[_0x989d('0x2b')](function(_0x29de0b){if(_0x29de0b){return _0x29de0b?{'count':_0xab5f7c,'rows':_0x29de0b}:null;}})[_0x989d('0x2b')](respondWithResult(_0x1b9e6b,null))[_0x989d('0x46')](handleError(_0x1b9e6b,null));};exports[_0x989d('0x54')]=function(_0x349a0d,_0xceafc1,_0x4fcd15){if(_0x349a0d[_0x989d('0x4e')]['id']){delete _0x349a0d['body']['id'];}return db[_0x989d('0x32')][_0x989d('0x50')]({'where':{'id':_0x349a0d[_0x989d('0x48')]['id']}})[_0x989d('0x2b')](handleEntityNotFound(_0xceafc1,null))['then'](function(_0x32e238){if(_0x32e238){_0x349a0d[_0x989d('0x4e')][_0x989d('0x55')]=_0x32e238['id'];_0x349a0d['body'][_0x989d('0x56')]=integrations[_0x989d('0x57')](_0x349a0d[_0x989d('0x4e')][_0x989d('0x58')],_0x349a0d[_0x989d('0x4e')][_0x989d('0x34')]);_0x349a0d[_0x989d('0x4e')][_0x989d('0x59')]=integrations[_0x989d('0x5a')](_0x349a0d[_0x989d('0x4e')][_0x989d('0x58')],_0x349a0d[_0x989d('0x4e')]['type']);return db['VtigerConfiguration']['create'](_0x349a0d[_0x989d('0x4e')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xceafc1,null))[_0x989d('0x46')](handleError(_0xceafc1,null));};var md5=require(_0x989d('0x5b'));exports[_0x989d('0x5c')]=function(_0x291225,_0x103b82,_0x133432){var _0x4c6c9e=null;var _0x2a4aa8=null;var _0x411ccd=null;var _0x411f55=null;var _0x153b54='';return db[_0x989d('0x32')][_0x989d('0x50')]({'where':{'id':_0x291225['params']['id']},'attributes':['id',_0x989d('0x2e'),_0x989d('0x5d'),'description',_0x989d('0x5e'),_0x989d('0x5f'),_0x989d('0x60'),_0x989d('0x61')]})[_0x989d('0x2b')](handleEntityNotFound(_0x103b82,null))[_0x989d('0x2b')](function(_0x441e15){if(_0x441e15){_0x4c6c9e=_0x441e15[_0x989d('0x5d')];_0x2a4aa8=_0x441e15[_0x989d('0x61')];_0x411ccd=_0x441e15[_0x989d('0x5e')];_0x153b54=_0x441e15[_0x989d('0x5f')];var _0x3ecee9=_0x153b54['slice'](-0x1);if(_0x3ecee9==='/'){_0x153b54=_0x153b54[_0x989d('0x62')](0x0,_0x153b54[_0x989d('0x63')](_0x3ecee9));}_0x411f55=util['format']('%s/webservice.php',_0x153b54);var _0x2c9010={'method':_0x989d('0x64'),'uri':_0x411f55,'qs':{'operation':_0x989d('0x65'),'username':_0x441e15[_0x989d('0x5d')]},'json':!![]};return rp(_0x2c9010);}})[_0x989d('0x2b')](function(_0x475d07){if(_0x475d07[_0x989d('0x66')]){var _0xc79781={'method':'POST','uri':_0x411f55,'form':{'operation':_0x989d('0x67'),'username':_0x4c6c9e,'accessKey':md5(_0x475d07['result'][_0x989d('0x68')]+_0x2a4aa8)},'json':!![]};return rp(_0xc79781);}})[_0x989d('0x2b')](function(_0x37971a){if(_0x37971a[_0x989d('0x66')]){var _0x42fe6e={'method':_0x989d('0x64'),'uri':_0x411f55,'qs':{'operation':'describe','username':_0x4c6c9e,'sessionName':_0x37971a[_0x989d('0x69')][_0x989d('0x6a')],'elementType':_0x411ccd},'json':!![]};return rp(_0x42fe6e);}})[_0x989d('0x2b')](function(_0x533499){if(_0x533499[_0x989d('0x66')]){var _0x4b42d9=[_0x989d('0x6b'),_0x989d('0x6c'),_0x989d('0x6d')];_['remove'](_0x533499[_0x989d('0x69')][_0x989d('0x3c')],function(_0x226d3a){return _0x4b42d9[_0x989d('0x6e')](_0x226d3a['type'][_0x989d('0x2e')]);});_[_0x989d('0x6f')](_0x533499['result'][_0x989d('0x3c')],function(_0x40907f){return _0x40907f['editable']===_0x989d('0x70');});return{'count':_0x533499[_0x989d('0x69')][_0x989d('0x3c')]['length'],'rows':_[_0x989d('0x31')](_0x533499[_0x989d('0x69')][_0x989d('0x3c')],function(_0x1e974d){return{'id':_0x1e974d['name'],'name':_0x1e974d[_0x989d('0x71')],'custom':_[_0x989d('0x72')](_0x1e974d[_0x989d('0x2e')],'cf_')?!![]:![],'options':_0x1e974d[_0x989d('0x34')][_0x989d('0x2e')]===_0x989d('0x73')&&_0x1e974d[_0x989d('0x34')][_0x989d('0x74')][_0x989d('0x3d')]>0x0?_[_0x989d('0x31')](_0x1e974d[_0x989d('0x34')][_0x989d('0x74')],function(_0x3ec47e){return{'name':_0x3ec47e['label'],'value':_0x3ec47e['value']};}):[]};})};}})[_0x989d('0x2b')](respondWithResult(_0x103b82,null))[_0x989d('0x46')](function(_0x7fa1bd){console[_0x989d('0x75')](_0x989d('0x76')+_0x7fa1bd);var _0x4c82d9=_0x291225[_0x989d('0x39')][_0x989d('0x77')]?0x1f4:_0x7fa1bd[_0x989d('0x78')]||0x1f4;logger[_0x989d('0x79')](_0x989d('0x7a'),_0x989d('0x5c'),_0x4c82d9,JSON['stringify'](_0x7fa1bd));delete _0x7fa1bd[_0x989d('0x2e')];if(_0x4c82d9===0x191){_0x4c82d9=0x190;}_0x103b82[_0x989d('0x1e')](_0x4c82d9)[_0x989d('0x2f')](_0x291225[_0x989d('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x7fa1bd[_0x989d('0x78')]}:_0x7fa1bd);});}; \ No newline at end of file +var _0x0fe3=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Subjects','Descriptions','md5','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','getchallenge','success','POST','login','result','GET','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x258f9f,_0x10c626){var _0x29488b=function(_0x176199){while(--_0x176199){_0x258f9f['push'](_0x258f9f['shift']());}};_0x29488b(++_0x10c626);}(_0x0fe3,0xc1));var _0x30fe=function(_0x167102,_0x530317){_0x167102=_0x167102-0x0;var _0x1f93e0=_0x0fe3[_0x167102];return _0x1f93e0;};'use strict';var emlformat=require(_0x30fe('0x0'));var rimraf=require(_0x30fe('0x1'));var zipdir=require(_0x30fe('0x2'));var jsonpatch=require(_0x30fe('0x3'));var rp=require(_0x30fe('0x4'));var moment=require(_0x30fe('0x5'));var BPromise=require(_0x30fe('0x6'));var Mustache=require('mustache');var util=require(_0x30fe('0x7'));var path=require(_0x30fe('0x8'));var sox=require(_0x30fe('0x9'));var csv=require(_0x30fe('0xa'));var ejs=require(_0x30fe('0xb'));var fs=require('fs');var fs_extra=require(_0x30fe('0xc'));var _=require(_0x30fe('0xd'));var squel=require(_0x30fe('0xe'));var crypto=require(_0x30fe('0xf'));var jsforce=require(_0x30fe('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x30fe('0xa'));var querystring=require('querystring');var Papa=require(_0x30fe('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x30fe('0x12'));var as=require(_0x30fe('0x13'));var hardwareService=require(_0x30fe('0x14'));var logger=require(_0x30fe('0x15'))(_0x30fe('0x16'));var utils=require(_0x30fe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x30fe('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x37003b,_0x30067e){_0x30067e=_0x30067e||0xcc;return function(_0x5bb78c){if(_0x5bb78c){return _0x37003b[_0x30fe('0x19')](_0x30067e);}return _0x37003b['status'](_0x30067e)[_0x30fe('0x1a')]();};}function respondWithResult(_0x54445a,_0x36294b){_0x36294b=_0x36294b||0xc8;return function(_0x467a99){if(_0x467a99){return _0x54445a['status'](_0x36294b)[_0x30fe('0x1b')](_0x467a99);}};}function respondWithFilteredResult(_0x7ac859,_0x1da37d){return function(_0x480275){if(_0x480275){var _0x4fba0c=typeof _0x1da37d[_0x30fe('0x1c')]==='undefined'&&typeof _0x1da37d[_0x30fe('0x1d')]===_0x30fe('0x1e');var _0x2a5fd3=_0x480275[_0x30fe('0x1f')];var _0xe7f0d0=_0x4fba0c?0x0:_0x1da37d[_0x30fe('0x1c')];var _0x5832cc=_0x4fba0c?_0x480275[_0x30fe('0x1f')]:_0x1da37d[_0x30fe('0x1c')]+_0x1da37d[_0x30fe('0x1d')];var _0x506151;if(_0x5832cc>=_0x2a5fd3){_0x5832cc=_0x2a5fd3;_0x506151=0xc8;}else{_0x506151=0xce;}_0x7ac859[_0x30fe('0x20')](_0x506151);return _0x7ac859[_0x30fe('0x21')]('Content-Range',_0xe7f0d0+'-'+_0x5832cc+'/'+_0x2a5fd3)[_0x30fe('0x1b')](_0x480275);}return null;};}function patchUpdates(_0x4ade8f){return function(_0x13cbb7){try{jsonpatch['apply'](_0x13cbb7,_0x4ade8f,!![]);}catch(_0x3df199){return BPromise['reject'](_0x3df199);}return _0x13cbb7[_0x30fe('0x22')]();};}function saveUpdates(_0x4ea7e9,_0xe219b4){return function(_0x2d43ce){if(_0x2d43ce){return _0x2d43ce[_0x30fe('0x23')](_0x4ea7e9)[_0x30fe('0x24')](function(_0x38aef1){return _0x38aef1;});}return null;};}function removeEntity(_0x2599ba,_0x34a814){return function(_0x166603){if(_0x166603){return _0x166603[_0x30fe('0x25')]()[_0x30fe('0x24')](function(){_0x2599ba['status'](0xcc)[_0x30fe('0x1a')]();});}};}function handleEntityNotFound(_0x275942,_0x4d46ac){return function(_0x255a98){if(!_0x255a98){_0x275942[_0x30fe('0x19')](0x194);}return _0x255a98;};}function handleError(_0x165317,_0x51eed7){_0x51eed7=_0x51eed7||0x1f4;return function(_0x455e1e){logger[_0x30fe('0x26')](_0x455e1e['stack']);if(_0x455e1e[_0x30fe('0x27')]){delete _0x455e1e[_0x30fe('0x27')];}_0x165317[_0x30fe('0x20')](_0x51eed7)[_0x30fe('0x28')](_0x455e1e);};}exports[_0x30fe('0x29')]=function(_0x5cca77,_0x316829){var _0x2ee736={},_0x5eea57={},_0x417e22={'count':0x0,'rows':[]};var _0x3f4537=_[_0x30fe('0x2a')](db['VtigerAccount'][_0x30fe('0x2b')],function(_0x10ad05){return{'name':_0x10ad05[_0x30fe('0x2c')],'type':_0x10ad05[_0x30fe('0x2d')][_0x30fe('0x2e')]};});_0x5eea57['model']=_['map'](_0x3f4537,_0x30fe('0x27'));_0x5eea57[_0x30fe('0x2f')]=_[_0x30fe('0x30')](_0x5cca77[_0x30fe('0x2f')]);_0x5eea57[_0x30fe('0x31')]=_[_0x30fe('0x32')](_0x5eea57[_0x30fe('0x33')],_0x5eea57[_0x30fe('0x2f')]);_0x2ee736[_0x30fe('0x34')]=_[_0x30fe('0x32')](_0x5eea57[_0x30fe('0x33')],qs[_0x30fe('0x35')](_0x5cca77['query'][_0x30fe('0x35')]));_0x2ee736[_0x30fe('0x34')]=_0x2ee736[_0x30fe('0x34')][_0x30fe('0x36')]?_0x2ee736['attributes']:_0x5eea57[_0x30fe('0x33')];if(!_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x37')](_0x30fe('0x38'))){_0x2ee736[_0x30fe('0x1d')]=qs[_0x30fe('0x1d')](_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x1d')]);_0x2ee736['offset']=qs[_0x30fe('0x1c')](_0x5cca77['query']['offset']);}_0x2ee736[_0x30fe('0x39')]=qs['sort'](_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x3a')]);_0x2ee736[_0x30fe('0x3b')]=qs[_0x30fe('0x31')](_[_0x30fe('0x3c')](_0x5cca77[_0x30fe('0x2f')],_0x5eea57[_0x30fe('0x31')]),_0x3f4537);if(_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x3d')]){_0x2ee736['where']=_[_0x30fe('0x3e')](_0x2ee736[_0x30fe('0x3b')],{'$or':_[_0x30fe('0x2a')](_0x3f4537,function(_0x54ba3a){if(_0x54ba3a[_0x30fe('0x2d')]!==_0x30fe('0x3f')){var _0x2fc553={};_0x2fc553[_0x54ba3a[_0x30fe('0x27')]]={'$like':'%'+_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x3d')]+'%'};return _0x2fc553;}})});}_0x2ee736=_['merge']({},_0x2ee736,_0x5cca77['options']);var _0x3f208e={'where':_0x2ee736[_0x30fe('0x3b')]};return db[_0x30fe('0x40')][_0x30fe('0x1f')](_0x3f208e)['then'](function(_0x23065a){_0x417e22[_0x30fe('0x1f')]=_0x23065a;if(_0x5cca77[_0x30fe('0x2f')][_0x30fe('0x41')]){_0x2ee736[_0x30fe('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0x30fe('0x43')](_0x2ee736);})[_0x30fe('0x24')](function(_0x17aa53){_0x417e22[_0x30fe('0x44')]=_0x17aa53;return _0x417e22;})['then'](respondWithFilteredResult(_0x316829,_0x2ee736))[_0x30fe('0x45')](handleError(_0x316829,null));};exports[_0x30fe('0x46')]=function(_0x26e7d5,_0x7db5ee){var _0x124e3b={'raw':![],'where':{'id':_0x26e7d5[_0x30fe('0x47')]['id']}},_0x2de6c0={};_0x2de6c0['model']=_['keys'](db[_0x30fe('0x40')][_0x30fe('0x2b')]);_0x2de6c0[_0x30fe('0x2f')]=_[_0x30fe('0x30')](_0x26e7d5[_0x30fe('0x2f')]);_0x2de6c0[_0x30fe('0x31')]=_[_0x30fe('0x32')](_0x2de6c0[_0x30fe('0x33')],_0x2de6c0[_0x30fe('0x2f')]);_0x124e3b[_0x30fe('0x34')]=_[_0x30fe('0x32')](_0x2de6c0[_0x30fe('0x33')],qs[_0x30fe('0x35')](_0x26e7d5[_0x30fe('0x2f')]['fields']));_0x124e3b[_0x30fe('0x34')]=_0x124e3b['attributes'][_0x30fe('0x36')]?_0x124e3b[_0x30fe('0x34')]:_0x2de6c0[_0x30fe('0x33')];if(_0x26e7d5['query']['includeAll']){_0x124e3b[_0x30fe('0x42')]=[{'all':!![]}];}_0x124e3b=_['merge']({},_0x124e3b,_0x26e7d5[_0x30fe('0x48')]);return db[_0x30fe('0x40')][_0x30fe('0x49')](_0x124e3b)[_0x30fe('0x24')](handleEntityNotFound(_0x7db5ee,null))[_0x30fe('0x24')](respondWithResult(_0x7db5ee,null))[_0x30fe('0x45')](handleError(_0x7db5ee,null));};exports['create']=function(_0x26af1f,_0x3855f5){return db[_0x30fe('0x40')][_0x30fe('0x4a')](_0x26af1f[_0x30fe('0x4b')],{})[_0x30fe('0x24')](respondWithResult(_0x3855f5,0xc9))[_0x30fe('0x45')](handleError(_0x3855f5,null));};exports[_0x30fe('0x23')]=function(_0x4c699d,_0x52c35d){if(_0x4c699d['body']['id']){delete _0x4c699d[_0x30fe('0x4b')]['id'];}return db[_0x30fe('0x40')]['find']({'where':{'id':_0x4c699d['params']['id']}})[_0x30fe('0x24')](handleEntityNotFound(_0x52c35d,null))['then'](saveUpdates(_0x4c699d[_0x30fe('0x4b')],null))[_0x30fe('0x24')](respondWithResult(_0x52c35d,null))[_0x30fe('0x45')](handleError(_0x52c35d,null));};exports[_0x30fe('0x25')]=function(_0x1fc23b,_0x1201ac){return db[_0x30fe('0x40')]['find']({'where':{'id':_0x1fc23b[_0x30fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x1201ac,null))[_0x30fe('0x24')](removeEntity(_0x1201ac,null))[_0x30fe('0x45')](handleError(_0x1201ac,null));};exports[_0x30fe('0x4c')]=function(_0x2d9eb2,_0x5e8be1,_0x482b0){var _0x82792c={};var _0x27b99f={};var _0x1c6ec1;var _0x3894f6;return db[_0x30fe('0x40')]['findOne']({'where':{'id':_0x2d9eb2[_0x30fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e8be1,null))[_0x30fe('0x24')](function(_0x19db12){if(_0x19db12){_0x1c6ec1=_0x19db12;_0x27b99f[_0x30fe('0x33')]=_[_0x30fe('0x30')](db['VtigerConfiguration'][_0x30fe('0x2b')]);_0x27b99f[_0x30fe('0x2f')]=_[_0x30fe('0x30')](_0x2d9eb2['query']);_0x27b99f[_0x30fe('0x31')]=_[_0x30fe('0x32')](_0x27b99f[_0x30fe('0x33')],_0x27b99f['query']);_0x82792c[_0x30fe('0x34')]=_[_0x30fe('0x32')](_0x27b99f[_0x30fe('0x33')],qs[_0x30fe('0x35')](_0x2d9eb2[_0x30fe('0x2f')][_0x30fe('0x35')]));_0x82792c['attributes']=_0x82792c['attributes'][_0x30fe('0x36')]?_0x82792c[_0x30fe('0x34')]:_0x27b99f[_0x30fe('0x33')];_0x82792c[_0x30fe('0x39')]=qs[_0x30fe('0x3a')](_0x2d9eb2[_0x30fe('0x2f')][_0x30fe('0x3a')]);_0x82792c['where']=qs['filters'](_[_0x30fe('0x3c')](_0x2d9eb2[_0x30fe('0x2f')],_0x27b99f[_0x30fe('0x31')]));if(_0x2d9eb2[_0x30fe('0x2f')]['filter']){_0x82792c['where']=_[_0x30fe('0x3e')](_0x82792c['where'],{'$or':_[_0x30fe('0x2a')](_0x82792c['attributes'],function(_0x11ed2f){var _0x19d6e1={};_0x19d6e1[_0x11ed2f]={'$like':'%'+_0x2d9eb2[_0x30fe('0x2f')][_0x30fe('0x3d')]+'%'};return _0x19d6e1;})});}_0x82792c=_[_0x30fe('0x3e')]({},_0x82792c,_0x2d9eb2[_0x30fe('0x48')]);return _0x1c6ec1[_0x30fe('0x4c')](_0x82792c);}})[_0x30fe('0x24')](function(_0x9ab81b){if(_0x9ab81b){_0x3894f6=_0x9ab81b[_0x30fe('0x36')];if(!_0x2d9eb2[_0x30fe('0x2f')]['hasOwnProperty'](_0x30fe('0x38'))){_0x82792c[_0x30fe('0x1d')]=qs['limit'](_0x2d9eb2[_0x30fe('0x2f')][_0x30fe('0x1d')]);_0x82792c['offset']=qs['offset'](_0x2d9eb2[_0x30fe('0x2f')][_0x30fe('0x1c')]);}return _0x1c6ec1[_0x30fe('0x4c')](_0x82792c);}})[_0x30fe('0x24')](function(_0x2e1311){if(_0x2e1311){return _0x2e1311?{'count':_0x3894f6,'rows':_0x2e1311}:null;}})[_0x30fe('0x24')](respondWithResult(_0x5e8be1,null))[_0x30fe('0x45')](handleError(_0x5e8be1,null));};exports[_0x30fe('0x4d')]=function(_0x944657,_0x551c25,_0x596a6b){if(_0x944657[_0x30fe('0x4b')]['id']){delete _0x944657['body']['id'];}return db[_0x30fe('0x40')]['findOne']({'where':{'id':_0x944657[_0x30fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x551c25,null))[_0x30fe('0x24')](function(_0x131ee1){if(_0x131ee1){_0x944657[_0x30fe('0x4b')]['AccountId']=_0x131ee1['id'];_0x944657[_0x30fe('0x4b')]['Subjects']=integrations[_0x30fe('0x4e')](_0x944657[_0x30fe('0x4b')][_0x30fe('0x4f')],_0x944657[_0x30fe('0x4b')][_0x30fe('0x2d')]);_0x944657[_0x30fe('0x4b')]['Descriptions']=integrations[_0x30fe('0x50')](_0x944657[_0x30fe('0x4b')][_0x30fe('0x4f')],_0x944657[_0x30fe('0x4b')]['type']);return db[_0x30fe('0x51')][_0x30fe('0x4a')](_0x944657[_0x30fe('0x4b')],{'include':[{'model':db[_0x30fe('0x52')],'as':_0x30fe('0x53')},{'model':db[_0x30fe('0x52')],'as':_0x30fe('0x54')}]});}return null;})[_0x30fe('0x24')](respondWithResult(_0x551c25,null))[_0x30fe('0x45')](handleError(_0x551c25,null));};var md5=require(_0x30fe('0x55'));exports['getFields']=function(_0x3617c4,_0x53a5a6,_0xbebf0b){var _0x4091fe=null;var _0x24d808=null;var _0x149aba=null;var _0x33c7fe=null;var _0x32eae1='';return db[_0x30fe('0x40')][_0x30fe('0x56')]({'where':{'id':_0x3617c4[_0x30fe('0x47')]['id']},'attributes':['id',_0x30fe('0x27'),_0x30fe('0x57'),_0x30fe('0x58'),_0x30fe('0x59'),_0x30fe('0x5a'),_0x30fe('0x5b'),_0x30fe('0x5c')]})['then'](handleEntityNotFound(_0x53a5a6,null))['then'](function(_0x492131){if(_0x492131){_0x4091fe=_0x492131['username'];_0x24d808=_0x492131[_0x30fe('0x5c')];_0x149aba=_0x492131['moduleName'];_0x32eae1=_0x492131[_0x30fe('0x5a')];var _0x40ac3c=_0x32eae1[_0x30fe('0x5d')](-0x1);if(_0x40ac3c==='/'){_0x32eae1=_0x32eae1['substring'](0x0,_0x32eae1['lastIndexOf'](_0x40ac3c));}_0x33c7fe=util[_0x30fe('0x5e')]('%s/webservice.php',_0x32eae1);var _0x5701da={'method':'GET','uri':_0x33c7fe,'qs':{'operation':_0x30fe('0x5f'),'username':_0x492131[_0x30fe('0x57')]},'json':!![]};return rp(_0x5701da);}})[_0x30fe('0x24')](function(_0xe128fd){if(_0xe128fd[_0x30fe('0x60')]){var _0x2e9b33={'method':_0x30fe('0x61'),'uri':_0x33c7fe,'form':{'operation':_0x30fe('0x62'),'username':_0x4091fe,'accessKey':md5(_0xe128fd[_0x30fe('0x63')]['token']+_0x24d808)},'json':!![]};return rp(_0x2e9b33);}})['then'](function(_0x1a7bd9){if(_0x1a7bd9['success']){var _0x446571={'method':_0x30fe('0x64'),'uri':_0x33c7fe,'qs':{'operation':'describe','username':_0x4091fe,'sessionName':_0x1a7bd9[_0x30fe('0x63')][_0x30fe('0x65')],'elementType':_0x149aba},'json':!![]};return rp(_0x446571);}})[_0x30fe('0x24')](function(_0x396489){if(_0x396489['success']){var _0x1bbd5e=[_0x30fe('0x66'),_0x30fe('0x67'),_0x30fe('0x68')];_[_0x30fe('0x69')](_0x396489[_0x30fe('0x63')][_0x30fe('0x35')],function(_0x2d0bf2){return _0x1bbd5e[_0x30fe('0x6a')](_0x2d0bf2[_0x30fe('0x2d')][_0x30fe('0x27')]);});_[_0x30fe('0x69')](_0x396489['result']['fields'],function(_0x3c8665){return _0x3c8665[_0x30fe('0x6b')]===_0x30fe('0x6c');});return{'count':_0x396489['result']['fields'][_0x30fe('0x36')],'rows':_[_0x30fe('0x2a')](_0x396489['result'][_0x30fe('0x35')],function(_0x56cac0){return{'id':_0x56cac0[_0x30fe('0x27')],'name':_0x56cac0[_0x30fe('0x6d')],'custom':_[_0x30fe('0x6e')](_0x56cac0['name'],_0x30fe('0x6f'))?!![]:![],'options':_0x56cac0[_0x30fe('0x2d')][_0x30fe('0x27')]===_0x30fe('0x70')&&_0x56cac0[_0x30fe('0x2d')][_0x30fe('0x71')]['length']>0x0?_[_0x30fe('0x2a')](_0x56cac0['type']['picklistValues'],function(_0xbe038f){return{'name':_0xbe038f[_0x30fe('0x6d')],'value':_0xbe038f[_0x30fe('0x72')]};}):[]};})};}})[_0x30fe('0x24')](respondWithResult(_0x53a5a6,null))[_0x30fe('0x45')](function(_0x5494c2){console[_0x30fe('0x73')](_0x30fe('0x74')+_0x5494c2);var _0x5c7789=_0x3617c4[_0x30fe('0x2f')]['test']?0x1f4:_0x5494c2[_0x30fe('0x75')]||0x1f4;logger['error'](_0x30fe('0x76'),'getFields',_0x5c7789,JSON[_0x30fe('0x77')](_0x5494c2));delete _0x5494c2[_0x30fe('0x27')];if(_0x5c7789===0x191){_0x5c7789=0x190;}_0x53a5a6[_0x30fe('0x20')](_0x5c7789)[_0x30fe('0x28')](_0x3617c4[_0x30fe('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5494c2[_0x30fe('0x75')]}:_0x5494c2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f2c5247..d4e2990 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 _0x2df7=['path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5462c6,_0x30efa7){var _0x1fc3ca=function(_0x241620){while(--_0x241620){_0x5462c6['push'](_0x5462c6['shift']());}};_0x1fc3ca(++_0x30efa7);}(_0x2df7,0x1f4));var _0x72df=function(_0x53e96a,_0x298bc3){_0x53e96a=_0x53e96a-0x0;var _0x643b1a=_0x2df7[_0x53e96a];return _0x643b1a;};'use strict';var _=require(_0x72df('0x0'));var util=require('util');var logger=require(_0x72df('0x1'))(_0x72df('0x2'));var moment=require(_0x72df('0x3'));var BPromise=require(_0x72df('0x4'));var rp=require(_0x72df('0x5'));var fs=require('fs');var path=require(_0x72df('0x6'));var rimraf=require('rimraf');var config=require(_0x72df('0x7'));var attributes=require(_0x72df('0x8'));var integrations=require(_0x72df('0x9'));module['exports']=function(_0x16b1ea,_0x3c0c59){return _0x16b1ea['define']('VtigerAccount',attributes,{'tableName':_0x72df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4de7=['define','VtigerAccount','util','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports'];(function(_0x18242c,_0x17ef5f){var _0x47f808=function(_0x52f764){while(--_0x52f764){_0x18242c['push'](_0x18242c['shift']());}};_0x47f808(++_0x17ef5f);}(_0x4de7,0xfc));var _0x74de=function(_0x16baad,_0x29e2d2){_0x16baad=_0x16baad-0x0;var _0x308caf=_0x4de7[_0x16baad];return _0x308caf;};'use strict';var _=require('lodash');var util=require(_0x74de('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x74de('0x1'));var BPromise=require(_0x74de('0x2'));var rp=require(_0x74de('0x3'));var fs=require('fs');var path=require(_0x74de('0x4'));var rimraf=require(_0x74de('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x74de('0x6'));module[_0x74de('0x7')]=function(_0x5ed758,_0x185f78){return _0x5ed758[_0x74de('0x8')](_0x74de('0x9'),attributes,{'tableName':'int_vtiger_accounts','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 d7b0daa..3700420 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 _0xe5b5=['GetVtigerAccount','VtigerAccount','options','where','attributes','include','map','model','debug','ShowVtigerAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x5bc158,_0x20ba90){var _0x288d43=function(_0x4e1c7f){while(--_0x4e1c7f){_0x5bc158['push'](_0x5bc158['shift']());}};_0x288d43(++_0x20ba90);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe5b5[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowVtigerAccount',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file +var _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3e7a9c,_0xcdc5ee){var _0x57c470=function(_0x1c7dee){while(--_0x1c7dee){_0x3e7a9c['push'](_0x3e7a9c['shift']());}};_0x57c470(++_0xcdc5ee);}(_0x41bb,0xc5));var _0xb41b=function(_0x3d9164,_0x33d55a){_0x3d9164=_0x3d9164-0x0;var _0x5ae074=_0x41bb[_0x3d9164];return _0x5ae074;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['VtigerAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetVtigerAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowVtigerAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c3b2ba0..a206895 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 _0x7022=['./intVtigerConfiguration.controller','get','isAuthenticated','index','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5e5750,_0xcb55a7){var _0x7a6ea5=function(_0x2aea6d){while(--_0x2aea6d){_0x5e5750['push'](_0x5e5750['shift']());}};_0x7a6ea5(++_0xcb55a7);}(_0x7022,0x78));var _0x2702=function(_0x3de187,_0x1c2750){_0x3de187=_0x3de187-0x0;var _0x298599=_0x7022[_0x3de187];return _0x298599;};'use strict';var multer=require('multer');var util=require(_0x2702('0x0'));var path=require(_0x2702('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2702('0x2')]();var fs_extra=require(_0x2702('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2702('0x4'));var config=require(_0x2702('0x5'));var controller=require(_0x2702('0x6'));router[_0x2702('0x7')]('/',auth[_0x2702('0x8')](),controller[_0x2702('0x9')]);router['get']('/:id',auth[_0x2702('0x8')](),controller['show']);router[_0x2702('0x7')]('/:id/fields',auth[_0x2702('0x8')](),controller['getFields']);router[_0x2702('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2702('0xa')]);router[_0x2702('0x7')](_0x2702('0xb'),auth[_0x2702('0x8')](),controller[_0x2702('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2702('0xd')]);router[_0x2702('0xe')](_0x2702('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x2702('0x10')](_0x2702('0xf'),auth[_0x2702('0x8')](),controller[_0x2702('0x11')]);module['exports']=router; \ No newline at end of file +var _0x87e2=['get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x87e2,0x1d8));var _0x287e=function(_0x38f6bc,_0x10832a){_0x38f6bc=_0x38f6bc-0x0;var _0x209b27=_0x87e2[_0x38f6bc];return _0x209b27;};'use strict';var multer=require(_0x287e('0x0'));var util=require(_0x287e('0x1'));var path=require('path');var timeout=require(_0x287e('0x2'));var express=require(_0x287e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x287e('0x4'));var config=require(_0x287e('0x5'));var controller=require(_0x287e('0x6'));router['get']('/',auth[_0x287e('0x7')](),controller['index']);router[_0x287e('0x8')](_0x287e('0x9'),auth[_0x287e('0x7')](),controller[_0x287e('0xa')]);router['get'](_0x287e('0xb'),auth['isAuthenticated'](),controller[_0x287e('0xc')]);router[_0x287e('0x8')](_0x287e('0xd'),auth[_0x287e('0x7')](),controller['getSubjects']);router[_0x287e('0x8')](_0x287e('0xe'),auth['isAuthenticated'](),controller[_0x287e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x287e('0x10')]);router[_0x287e('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x287e('0x9'),auth['isAuthenticated'](),controller[_0x287e('0x12')]);module[_0x287e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3a6939d..c7a725c 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 _0x23da=['STRING','exports'];(function(_0x8cea57,_0x290172){var _0x25ce1d=function(_0x152c9a){while(--_0x152c9a){_0x8cea57['push'](_0x8cea57['shift']());}};_0x25ce1d(++_0x290172);}(_0x23da,0xe7));var _0xa23d=function(_0x1fb3f4,_0x191a2c){_0x1fb3f4=_0x1fb3f4-0x0;var _0x19f230=_0x23da[_0x1fb3f4];return _0x19f230;};'use strict';var Sequelize=require('sequelize');module[_0xa23d('0x0')]={'name':{'type':Sequelize[_0xa23d('0x1')]},'description':{'type':Sequelize[_0xa23d('0x1')]}}; \ No newline at end of file +var _0x400d=['sequelize'];(function(_0x5c720d,_0x547595){var _0x41971a=function(_0x337407){while(--_0x337407){_0x5c720d['push'](_0x5c720d['shift']());}};_0x41971a(++_0x547595);}(_0x400d,0xd3));var _0xd400=function(_0x1c4831,_0x3ff74a){_0x1c4831=_0x1c4831-0x0;var _0x1e6a6d=_0x400d[_0x1c4831];return _0x1e6a6d;};'use strict';var Sequelize=require(_0xd400('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fe974f4..619d15d 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 _0xe7be=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','error','name','send','map','VtigerConfiguration','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','merge','where','options','includeAll','include','catch','params','rawAttributes','find','create','body','getFields','findOne','VtigerField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0x3cfa6f,_0x56f736){var _0xf3c1c4=function(_0x188701){while(--_0x188701){_0x3cfa6f['push'](_0x3cfa6f['shift']());}};_0xf3c1c4(++_0x56f736);}(_0xe7be,0x16a));var _0xee7b=function(_0x3a0f28,_0x29376){_0x3a0f28=_0x3a0f28-0x0;var _0x17110a=_0xe7be[_0x3a0f28];return _0x17110a;};'use strict';var emlformat=require(_0xee7b('0x0'));var rimraf=require(_0xee7b('0x1'));var zipdir=require(_0xee7b('0x2'));var jsonpatch=require(_0xee7b('0x3'));var rp=require('request-promise');var moment=require(_0xee7b('0x4'));var BPromise=require(_0xee7b('0x5'));var Mustache=require(_0xee7b('0x6'));var util=require(_0xee7b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xee7b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee7b('0x9'));var _=require(_0xee7b('0xa'));var squel=require(_0xee7b('0xb'));var crypto=require('crypto');var jsforce=require(_0xee7b('0xc'));var deskjs=require(_0xee7b('0xd'));var toCsv=require(_0xee7b('0x8'));var querystring=require(_0xee7b('0xe'));var Papa=require(_0xee7b('0xf'));var Redis=require('ioredis');var authService=require(_0xee7b('0x10'));var qs=require(_0xee7b('0x11'));var as=require(_0xee7b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7b('0x13'))(_0xee7b('0x14'));var utils=require(_0xee7b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee7b('0x16'));var db=require(_0xee7b('0x17'))['db'];function respondWithStatusCode(_0x1c19c8,_0x562dee){_0x562dee=_0x562dee||0xcc;return function(_0x535e0d){if(_0x535e0d){return _0x1c19c8[_0xee7b('0x18')](_0x562dee);}return _0x1c19c8['status'](_0x562dee)[_0xee7b('0x19')]();};}function respondWithResult(_0x231f8d,_0xb82a8b){_0xb82a8b=_0xb82a8b||0xc8;return function(_0x1ee8e7){if(_0x1ee8e7){return _0x231f8d['status'](_0xb82a8b)[_0xee7b('0x1a')](_0x1ee8e7);}};}function respondWithFilteredResult(_0x8806e1,_0x12515b){return function(_0x427650){if(_0x427650){var _0x4093ef=typeof _0x12515b[_0xee7b('0x1b')]==='undefined'&&typeof _0x12515b['limit']===_0xee7b('0x1c');var _0x4ab366=_0x427650['count'];var _0x430dd2=_0x4093ef?0x0:_0x12515b[_0xee7b('0x1b')];var _0x1e8c9b=_0x4093ef?_0x427650[_0xee7b('0x1d')]:_0x12515b[_0xee7b('0x1b')]+_0x12515b['limit'];var _0x532447;if(_0x1e8c9b>=_0x4ab366){_0x1e8c9b=_0x4ab366;_0x532447=0xc8;}else{_0x532447=0xce;}_0x8806e1['status'](_0x532447);return _0x8806e1[_0xee7b('0x1e')]('Content-Range',_0x430dd2+'-'+_0x1e8c9b+'/'+_0x4ab366)[_0xee7b('0x1a')](_0x427650);}return null;};}function patchUpdates(_0x574a77){return function(_0x5d0104){try{jsonpatch[_0xee7b('0x1f')](_0x5d0104,_0x574a77,!![]);}catch(_0xbcd573){return BPromise[_0xee7b('0x20')](_0xbcd573);}return _0x5d0104[_0xee7b('0x21')]();};}function saveUpdates(_0x33b5a7,_0x223040){return function(_0x5e7c8f){if(_0x5e7c8f){return _0x5e7c8f[_0xee7b('0x22')](_0x33b5a7)['then'](function(_0x3effc7){return _0x3effc7;});}return null;};}function removeEntity(_0x1dd22b,_0x2ecab2){return function(_0x17cbd1){if(_0x17cbd1){return _0x17cbd1[_0xee7b('0x23')]()[_0xee7b('0x24')](function(){_0x1dd22b['status'](0xcc)[_0xee7b('0x19')]();});}};}function handleEntityNotFound(_0x1464c3,_0x163339){return function(_0x3575b4){if(!_0x3575b4){_0x1464c3['sendStatus'](0x194);}return _0x3575b4;};}function handleError(_0x40904c,_0x241b11){_0x241b11=_0x241b11||0x1f4;return function(_0x360160){logger[_0xee7b('0x25')](_0x360160['stack']);if(_0x360160[_0xee7b('0x26')]){delete _0x360160[_0xee7b('0x26')];}_0x40904c['status'](_0x241b11)[_0xee7b('0x27')](_0x360160);};}exports['index']=function(_0x12e347,_0x3a5216){var _0x4fda5d={},_0x1ed251={},_0x333909={'count':0x0,'rows':[]};var _0x44c040=_[_0xee7b('0x28')](db[_0xee7b('0x29')]['rawAttributes'],function(_0x178615){return{'name':_0x178615[_0xee7b('0x2a')],'type':_0x178615[_0xee7b('0x2b')]['key']};});_0x1ed251[_0xee7b('0x2c')]=_[_0xee7b('0x28')](_0x44c040,'name');_0x1ed251[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x12e347[_0xee7b('0x2d')]);_0x1ed251['filters']=_['intersection'](_0x1ed251[_0xee7b('0x2c')],_0x1ed251['query']);_0x4fda5d[_0xee7b('0x2f')]=_[_0xee7b('0x30')](_0x1ed251[_0xee7b('0x2c')],qs[_0xee7b('0x31')](_0x12e347[_0xee7b('0x2d')][_0xee7b('0x31')]));_0x4fda5d['attributes']=_0x4fda5d[_0xee7b('0x2f')][_0xee7b('0x32')]?_0x4fda5d['attributes']:_0x1ed251[_0xee7b('0x2c')];if(!_0x12e347[_0xee7b('0x2d')][_0xee7b('0x33')](_0xee7b('0x34'))){_0x4fda5d[_0xee7b('0x35')]=qs['limit'](_0x12e347[_0xee7b('0x2d')]['limit']);_0x4fda5d[_0xee7b('0x1b')]=qs[_0xee7b('0x1b')](_0x12e347['query']['offset']);}_0x4fda5d[_0xee7b('0x36')]=qs[_0xee7b('0x37')](_0x12e347[_0xee7b('0x2d')][_0xee7b('0x37')]);_0x4fda5d['where']=qs[_0xee7b('0x38')](_[_0xee7b('0x39')](_0x12e347[_0xee7b('0x2d')],_0x1ed251[_0xee7b('0x38')]),_0x44c040);if(_0x12e347[_0xee7b('0x2d')]['filter']){_0x4fda5d['where']=_[_0xee7b('0x3a')](_0x4fda5d[_0xee7b('0x3b')],{'$or':_[_0xee7b('0x28')](_0x44c040,function(_0x1059db){if(_0x1059db['type']!=='VIRTUAL'){var _0x3b99a3={};_0x3b99a3[_0x1059db[_0xee7b('0x26')]]={'$like':'%'+_0x12e347[_0xee7b('0x2d')]['filter']+'%'};return _0x3b99a3;}})});}_0x4fda5d=_[_0xee7b('0x3a')]({},_0x4fda5d,_0x12e347[_0xee7b('0x3c')]);var _0x38f132={'where':_0x4fda5d['where']};return db['VtigerConfiguration'][_0xee7b('0x1d')](_0x38f132)['then'](function(_0x4e6e97){_0x333909['count']=_0x4e6e97;if(_0x12e347['query'][_0xee7b('0x3d')]){_0x4fda5d[_0xee7b('0x3e')]=[{'all':!![]}];}return db[_0xee7b('0x29')]['findAll'](_0x4fda5d);})[_0xee7b('0x24')](function(_0x52f564){_0x333909['rows']=_0x52f564;return _0x333909;})[_0xee7b('0x24')](respondWithFilteredResult(_0x3a5216,_0x4fda5d))[_0xee7b('0x3f')](handleError(_0x3a5216,null));};exports['show']=function(_0x514464,_0x3e4b2e){var _0x5cb4ee={'raw':![],'where':{'id':_0x514464[_0xee7b('0x40')]['id']}},_0x22f6be={};_0x22f6be['model']=_['keys'](db[_0xee7b('0x29')][_0xee7b('0x41')]);_0x22f6be[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x514464[_0xee7b('0x2d')]);_0x22f6be['filters']=_[_0xee7b('0x30')](_0x22f6be[_0xee7b('0x2c')],_0x22f6be[_0xee7b('0x2d')]);_0x5cb4ee[_0xee7b('0x2f')]=_['intersection'](_0x22f6be['model'],qs[_0xee7b('0x31')](_0x514464[_0xee7b('0x2d')][_0xee7b('0x31')]));_0x5cb4ee[_0xee7b('0x2f')]=_0x5cb4ee[_0xee7b('0x2f')]['length']?_0x5cb4ee[_0xee7b('0x2f')]:_0x22f6be[_0xee7b('0x2c')];if(_0x514464[_0xee7b('0x2d')]['includeAll']){_0x5cb4ee[_0xee7b('0x3e')]=[{'all':!![]}];}_0x5cb4ee=_['merge']({},_0x5cb4ee,_0x514464[_0xee7b('0x3c')]);return db[_0xee7b('0x29')][_0xee7b('0x42')](_0x5cb4ee)['then'](handleEntityNotFound(_0x3e4b2e,null))[_0xee7b('0x24')](respondWithResult(_0x3e4b2e,null))['catch'](handleError(_0x3e4b2e,null));};exports[_0xee7b('0x43')]=function(_0x4d583c,_0xfa0247){return db[_0xee7b('0x29')]['create'](_0x4d583c[_0xee7b('0x44')],{})['then'](respondWithResult(_0xfa0247,0xc9))[_0xee7b('0x3f')](handleError(_0xfa0247,null));};exports['update']=function(_0x4d93d5,_0x3f9607){if(_0x4d93d5[_0xee7b('0x44')]['id']){delete _0x4d93d5['body']['id'];}return db[_0xee7b('0x29')][_0xee7b('0x42')]({'where':{'id':_0x4d93d5[_0xee7b('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f9607,null))[_0xee7b('0x24')](saveUpdates(_0x4d93d5[_0xee7b('0x44')],null))[_0xee7b('0x24')](respondWithResult(_0x3f9607,null))['catch'](handleError(_0x3f9607,null));};exports[_0xee7b('0x23')]=function(_0xd9a19f,_0x3eac6e){return db[_0xee7b('0x29')][_0xee7b('0x42')]({'where':{'id':_0xd9a19f[_0xee7b('0x40')]['id']}})[_0xee7b('0x24')](handleEntityNotFound(_0x3eac6e,null))[_0xee7b('0x24')](removeEntity(_0x3eac6e,null))['catch'](handleError(_0x3eac6e,null));};exports[_0xee7b('0x45')]=function(_0x2f800e,_0x32e877,_0x4e3cc1){var _0x494ef5={};var _0x5d8f05={};var _0x5d8b71;var _0x2072a4;return db[_0xee7b('0x29')][_0xee7b('0x46')]({'where':{'id':_0x2f800e[_0xee7b('0x40')]['id']}})['then'](handleEntityNotFound(_0x32e877,null))[_0xee7b('0x24')](function(_0x37ea68){if(_0x37ea68){_0x5d8b71=_0x37ea68;_0x5d8f05['model']=_[_0xee7b('0x2e')](db[_0xee7b('0x47')][_0xee7b('0x41')]);_0x5d8f05[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x2f800e[_0xee7b('0x2d')]);_0x5d8f05[_0xee7b('0x38')]=_[_0xee7b('0x30')](_0x5d8f05[_0xee7b('0x2c')],_0x5d8f05[_0xee7b('0x2d')]);_0x494ef5[_0xee7b('0x2f')]=_['intersection'](_0x5d8f05[_0xee7b('0x2c')],qs[_0xee7b('0x31')](_0x2f800e[_0xee7b('0x2d')][_0xee7b('0x31')]));_0x494ef5[_0xee7b('0x2f')]=_0x494ef5[_0xee7b('0x2f')][_0xee7b('0x32')]?_0x494ef5[_0xee7b('0x2f')]:_0x5d8f05[_0xee7b('0x2c')];_0x494ef5[_0xee7b('0x36')]=qs[_0xee7b('0x37')](_0x2f800e[_0xee7b('0x2d')]['sort']);_0x494ef5[_0xee7b('0x3b')]=qs[_0xee7b('0x38')](_[_0xee7b('0x39')](_0x2f800e[_0xee7b('0x2d')],_0x5d8f05[_0xee7b('0x38')]));if(_0x2f800e[_0xee7b('0x2d')][_0xee7b('0x48')]){_0x494ef5['where']=_[_0xee7b('0x3a')](_0x494ef5[_0xee7b('0x3b')],{'$or':_[_0xee7b('0x28')](_0x494ef5[_0xee7b('0x2f')],function(_0x48dcca){var _0x59a8dd={};_0x59a8dd[_0x48dcca]={'$like':'%'+_0x2f800e[_0xee7b('0x2d')]['filter']+'%'};return _0x59a8dd;})});}_0x494ef5=_[_0xee7b('0x3a')]({},_0x494ef5,_0x2f800e[_0xee7b('0x3c')]);return _0x5d8b71[_0xee7b('0x45')](_0x494ef5);}})['then'](function(_0x5efc5f){if(_0x5efc5f){_0x2072a4=_0x5efc5f['length'];if(!_0x2f800e[_0xee7b('0x2d')][_0xee7b('0x33')]('nolimit')){_0x494ef5[_0xee7b('0x35')]=qs[_0xee7b('0x35')](_0x2f800e['query']['limit']);_0x494ef5[_0xee7b('0x1b')]=qs['offset'](_0x2f800e['query'][_0xee7b('0x1b')]);}return _0x5d8b71[_0xee7b('0x45')](_0x494ef5);}})[_0xee7b('0x24')](function(_0x4f9b2a){if(_0x4f9b2a){return _0x4f9b2a?{'count':_0x2072a4,'rows':_0x4f9b2a}:null;}})[_0xee7b('0x24')](respondWithResult(_0x32e877,null))[_0xee7b('0x3f')](handleError(_0x32e877,null));};exports[_0xee7b('0x49')]=function(_0x4bd604,_0x893955,_0x254fe3){var _0x4b2555={};var _0x49fa7f={};var _0x41090e;var _0x5ad3ad;return db[_0xee7b('0x29')][_0xee7b('0x46')]({'where':{'id':_0x4bd604[_0xee7b('0x40')]['id']}})[_0xee7b('0x24')](handleEntityNotFound(_0x893955,null))[_0xee7b('0x24')](function(_0x1694f9){if(_0x1694f9){_0x41090e=_0x1694f9;_0x49fa7f[_0xee7b('0x2c')]=_[_0xee7b('0x2e')](db[_0xee7b('0x47')][_0xee7b('0x41')]);_0x49fa7f[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x4bd604[_0xee7b('0x2d')]);_0x49fa7f[_0xee7b('0x38')]=_[_0xee7b('0x30')](_0x49fa7f[_0xee7b('0x2c')],_0x49fa7f[_0xee7b('0x2d')]);_0x4b2555[_0xee7b('0x2f')]=_[_0xee7b('0x30')](_0x49fa7f[_0xee7b('0x2c')],qs[_0xee7b('0x31')](_0x4bd604[_0xee7b('0x2d')]['fields']));_0x4b2555[_0xee7b('0x2f')]=_0x4b2555[_0xee7b('0x2f')]['length']?_0x4b2555[_0xee7b('0x2f')]:_0x49fa7f['model'];_0x4b2555[_0xee7b('0x36')]=qs[_0xee7b('0x37')](_0x4bd604['query']['sort']);_0x4b2555[_0xee7b('0x3b')]=qs['filters'](_['pick'](_0x4bd604[_0xee7b('0x2d')],_0x49fa7f[_0xee7b('0x38')]));if(_0x4bd604['query'][_0xee7b('0x48')]){_0x4b2555[_0xee7b('0x3b')]=_['merge'](_0x4b2555['where'],{'$or':_['map'](_0x4b2555['attributes'],function(_0xfcbad){var _0x5aeb52={};_0x5aeb52[_0xfcbad]={'$like':'%'+_0x4bd604[_0xee7b('0x2d')][_0xee7b('0x48')]+'%'};return _0x5aeb52;})});}_0x4b2555=_['merge']({},_0x4b2555,_0x4bd604[_0xee7b('0x3c')]);return _0x41090e[_0xee7b('0x49')](_0x4b2555);}})[_0xee7b('0x24')](function(_0x42147b){if(_0x42147b){_0x5ad3ad=_0x42147b['length'];if(!_0x4bd604[_0xee7b('0x2d')][_0xee7b('0x33')](_0xee7b('0x34'))){_0x4b2555[_0xee7b('0x35')]=qs[_0xee7b('0x35')](_0x4bd604[_0xee7b('0x2d')][_0xee7b('0x35')]);_0x4b2555[_0xee7b('0x1b')]=qs[_0xee7b('0x1b')](_0x4bd604[_0xee7b('0x2d')]['offset']);}return _0x41090e['getSubjects'](_0x4b2555);}})[_0xee7b('0x24')](function(_0x14e3c1){if(_0x14e3c1){return _0x14e3c1?{'count':_0x5ad3ad,'rows':_0x14e3c1}:null;}})['then'](respondWithResult(_0x893955,null))['catch'](handleError(_0x893955,null));};exports[_0xee7b('0x4a')]=function(_0x13a231,_0x3f8b64,_0x2b9918){var _0x2f33a8={};var _0x3b96f1={};var _0x4880e1;var _0x9f844e;return db[_0xee7b('0x29')][_0xee7b('0x46')]({'where':{'id':_0x13a231['params']['id']}})[_0xee7b('0x24')](handleEntityNotFound(_0x3f8b64,null))[_0xee7b('0x24')](function(_0x5f21d4){if(_0x5f21d4){_0x4880e1=_0x5f21d4;_0x3b96f1[_0xee7b('0x2c')]=_[_0xee7b('0x2e')](db['VtigerField']['rawAttributes']);_0x3b96f1[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x13a231[_0xee7b('0x2d')]);_0x3b96f1['filters']=_[_0xee7b('0x30')](_0x3b96f1[_0xee7b('0x2c')],_0x3b96f1['query']);_0x2f33a8['attributes']=_[_0xee7b('0x30')](_0x3b96f1[_0xee7b('0x2c')],qs['fields'](_0x13a231[_0xee7b('0x2d')][_0xee7b('0x31')]));_0x2f33a8['attributes']=_0x2f33a8[_0xee7b('0x2f')][_0xee7b('0x32')]?_0x2f33a8['attributes']:_0x3b96f1[_0xee7b('0x2c')];_0x2f33a8['order']=qs[_0xee7b('0x37')](_0x13a231[_0xee7b('0x2d')]['sort']);_0x2f33a8[_0xee7b('0x3b')]=qs[_0xee7b('0x38')](_['pick'](_0x13a231[_0xee7b('0x2d')],_0x3b96f1[_0xee7b('0x38')]));if(_0x13a231[_0xee7b('0x2d')]['filter']){_0x2f33a8[_0xee7b('0x3b')]=_[_0xee7b('0x3a')](_0x2f33a8[_0xee7b('0x3b')],{'$or':_[_0xee7b('0x28')](_0x2f33a8[_0xee7b('0x2f')],function(_0x2f93dd){var _0x121bda={};_0x121bda[_0x2f93dd]={'$like':'%'+_0x13a231['query'][_0xee7b('0x48')]+'%'};return _0x121bda;})});}_0x2f33a8=_[_0xee7b('0x3a')]({},_0x2f33a8,_0x13a231[_0xee7b('0x3c')]);return _0x4880e1[_0xee7b('0x4a')](_0x2f33a8);}})[_0xee7b('0x24')](function(_0x282441){if(_0x282441){_0x9f844e=_0x282441['length'];if(!_0x13a231['query'][_0xee7b('0x33')](_0xee7b('0x34'))){_0x2f33a8['limit']=qs['limit'](_0x13a231['query']['limit']);_0x2f33a8[_0xee7b('0x1b')]=qs[_0xee7b('0x1b')](_0x13a231['query'][_0xee7b('0x1b')]);}return _0x4880e1[_0xee7b('0x4a')](_0x2f33a8);}})[_0xee7b('0x24')](function(_0x203571){if(_0x203571){return _0x203571?{'count':_0x9f844e,'rows':_0x203571}:null;}})[_0xee7b('0x24')](respondWithResult(_0x3f8b64,null))[_0xee7b('0x3f')](handleError(_0x3f8b64,null));}; \ No newline at end of file +var _0x36b9=['to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','length','include','options','find','catch','create','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x35267a,_0x3f5cf0){var _0x422a50=function(_0x2fa4a6){while(--_0x2fa4a6){_0x35267a['push'](_0x35267a['shift']());}};_0x422a50(++_0x3f5cf0);}(_0x36b9,0xe7));var _0x936b=function(_0x5503eb,_0x3590e2){_0x5503eb=_0x5503eb-0x0;var _0x2679d1=_0x36b9[_0x5503eb];return _0x2679d1;};'use strict';var emlformat=require(_0x936b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x936b('0x1'));var jsonpatch=require(_0x936b('0x2'));var rp=require(_0x936b('0x3'));var moment=require(_0x936b('0x4'));var BPromise=require(_0x936b('0x5'));var Mustache=require('mustache');var util=require(_0x936b('0x6'));var path=require(_0x936b('0x7'));var sox=require(_0x936b('0x8'));var csv=require(_0x936b('0x9'));var ejs=require(_0x936b('0xa'));var fs=require('fs');var fs_extra=require(_0x936b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x936b('0xc'));var deskjs=require(_0x936b('0xd'));var toCsv=require(_0x936b('0x9'));var querystring=require(_0x936b('0xe'));var Papa=require('papaparse');var Redis=require(_0x936b('0xf'));var authService=require(_0x936b('0x10'));var qs=require(_0x936b('0x11'));var as=require(_0x936b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x936b('0x13'))(_0x936b('0x14'));var utils=require(_0x936b('0x15'));var config=require(_0x936b('0x16'));var licenseUtil=require(_0x936b('0x17'));var db=require(_0x936b('0x18'))['db'];function respondWithStatusCode(_0xe85ef6,_0x245ad6){_0x245ad6=_0x245ad6||0xcc;return function(_0x2ff1f5){if(_0x2ff1f5){return _0xe85ef6[_0x936b('0x19')](_0x245ad6);}return _0xe85ef6[_0x936b('0x1a')](_0x245ad6)[_0x936b('0x1b')]();};}function respondWithResult(_0x541595,_0x274a8c){_0x274a8c=_0x274a8c||0xc8;return function(_0xe53a8d){if(_0xe53a8d){return _0x541595[_0x936b('0x1a')](_0x274a8c)[_0x936b('0x1c')](_0xe53a8d);}};}function respondWithFilteredResult(_0xc48807,_0x17db4d){return function(_0x6bd6c9){if(_0x6bd6c9){var _0x35e3f0=typeof _0x17db4d[_0x936b('0x1d')]===_0x936b('0x1e')&&typeof _0x17db4d[_0x936b('0x1f')]===_0x936b('0x1e');var _0x343037=_0x6bd6c9[_0x936b('0x20')];var _0x2af32a=_0x35e3f0?0x0:_0x17db4d[_0x936b('0x1d')];var _0x4ac7a2=_0x35e3f0?_0x6bd6c9[_0x936b('0x20')]:_0x17db4d[_0x936b('0x1d')]+_0x17db4d[_0x936b('0x1f')];var _0x38f3bf;if(_0x4ac7a2>=_0x343037){_0x4ac7a2=_0x343037;_0x38f3bf=0xc8;}else{_0x38f3bf=0xce;}_0xc48807[_0x936b('0x1a')](_0x38f3bf);return _0xc48807[_0x936b('0x21')](_0x936b('0x22'),_0x2af32a+'-'+_0x4ac7a2+'/'+_0x343037)[_0x936b('0x1c')](_0x6bd6c9);}return null;};}function patchUpdates(_0x25cc41){return function(_0xeab486){try{jsonpatch['apply'](_0xeab486,_0x25cc41,!![]);}catch(_0x5e7482){return BPromise['reject'](_0x5e7482);}return _0xeab486[_0x936b('0x23')]();};}function saveUpdates(_0x5cb287,_0x29605d){return function(_0x19320a){if(_0x19320a){return _0x19320a[_0x936b('0x24')](_0x5cb287)[_0x936b('0x25')](function(_0x3527ff){return _0x3527ff;});}return null;};}function removeEntity(_0x697bfb,_0x346621){return function(_0x22b5bd){if(_0x22b5bd){return _0x22b5bd[_0x936b('0x26')]()['then'](function(){_0x697bfb[_0x936b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591094,_0x1f18cf){return function(_0x5d6331){if(!_0x5d6331){_0x591094['sendStatus'](0x194);}return _0x5d6331;};}function handleError(_0x4bd86c,_0x5460f6){_0x5460f6=_0x5460f6||0x1f4;return function(_0x94b80b){logger['error'](_0x94b80b[_0x936b('0x27')]);if(_0x94b80b[_0x936b('0x28')]){delete _0x94b80b[_0x936b('0x28')];}_0x4bd86c[_0x936b('0x1a')](_0x5460f6)[_0x936b('0x29')](_0x94b80b);};}exports[_0x936b('0x2a')]=function(_0xd47295,_0x105c0b){var _0x52e3d8={},_0x13f28f={},_0x3a78ed={'count':0x0,'rows':[]};var _0x3160bf=_[_0x936b('0x2b')](db[_0x936b('0x2c')][_0x936b('0x2d')],function(_0x3c470b){return{'name':_0x3c470b[_0x936b('0x2e')],'type':_0x3c470b[_0x936b('0x2f')][_0x936b('0x30')]};});_0x13f28f[_0x936b('0x31')]=_[_0x936b('0x2b')](_0x3160bf,_0x936b('0x28'));_0x13f28f['query']=_[_0x936b('0x32')](_0xd47295['query']);_0x13f28f[_0x936b('0x33')]=_[_0x936b('0x34')](_0x13f28f['model'],_0x13f28f[_0x936b('0x35')]);_0x52e3d8[_0x936b('0x36')]=_[_0x936b('0x34')](_0x13f28f[_0x936b('0x31')],qs[_0x936b('0x37')](_0xd47295[_0x936b('0x35')][_0x936b('0x37')]));_0x52e3d8['attributes']=_0x52e3d8[_0x936b('0x36')]['length']?_0x52e3d8[_0x936b('0x36')]:_0x13f28f[_0x936b('0x31')];if(!_0xd47295['query'][_0x936b('0x38')](_0x936b('0x39'))){_0x52e3d8[_0x936b('0x1f')]=qs[_0x936b('0x1f')](_0xd47295['query']['limit']);_0x52e3d8['offset']=qs['offset'](_0xd47295[_0x936b('0x35')][_0x936b('0x1d')]);}_0x52e3d8[_0x936b('0x3a')]=qs['sort'](_0xd47295['query'][_0x936b('0x3b')]);_0x52e3d8[_0x936b('0x3c')]=qs['filters'](_[_0x936b('0x3d')](_0xd47295[_0x936b('0x35')],_0x13f28f[_0x936b('0x33')]),_0x3160bf);if(_0xd47295['query']['filter']){_0x52e3d8['where']=_['merge'](_0x52e3d8[_0x936b('0x3c')],{'$or':_[_0x936b('0x2b')](_0x3160bf,function(_0x3f0114){if(_0x3f0114[_0x936b('0x2f')]!=='VIRTUAL'){var _0x14f6f9={};_0x14f6f9[_0x3f0114[_0x936b('0x28')]]={'$like':'%'+_0xd47295['query'][_0x936b('0x3e')]+'%'};return _0x14f6f9;}})});}_0x52e3d8=_[_0x936b('0x3f')]({},_0x52e3d8,_0xd47295['options']);var _0x23e288={'where':_0x52e3d8[_0x936b('0x3c')]};return db[_0x936b('0x2c')][_0x936b('0x20')](_0x23e288)[_0x936b('0x25')](function(_0x217741){_0x3a78ed['count']=_0x217741;if(_0xd47295[_0x936b('0x35')][_0x936b('0x40')]){_0x52e3d8['include']=[{'all':!![]}];}return db[_0x936b('0x2c')][_0x936b('0x41')](_0x52e3d8);})['then'](function(_0x4c2c2d){_0x3a78ed[_0x936b('0x42')]=_0x4c2c2d;return _0x3a78ed;})['then'](respondWithFilteredResult(_0x105c0b,_0x52e3d8))['catch'](handleError(_0x105c0b,null));};exports[_0x936b('0x43')]=function(_0x14dfcf,_0x3072e9){var _0x5b3087={'raw':![],'where':{'id':_0x14dfcf[_0x936b('0x44')]['id']}},_0x1a3d80={};_0x1a3d80[_0x936b('0x31')]=_[_0x936b('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x1a3d80[_0x936b('0x35')]=_['keys'](_0x14dfcf[_0x936b('0x35')]);_0x1a3d80[_0x936b('0x33')]=_[_0x936b('0x34')](_0x1a3d80[_0x936b('0x31')],_0x1a3d80[_0x936b('0x35')]);_0x5b3087[_0x936b('0x36')]=_['intersection'](_0x1a3d80[_0x936b('0x31')],qs['fields'](_0x14dfcf[_0x936b('0x35')][_0x936b('0x37')]));_0x5b3087[_0x936b('0x36')]=_0x5b3087['attributes'][_0x936b('0x45')]?_0x5b3087[_0x936b('0x36')]:_0x1a3d80[_0x936b('0x31')];if(_0x14dfcf[_0x936b('0x35')]['includeAll']){_0x5b3087[_0x936b('0x46')]=[{'all':!![]}];}_0x5b3087=_[_0x936b('0x3f')]({},_0x5b3087,_0x14dfcf[_0x936b('0x47')]);return db[_0x936b('0x2c')][_0x936b('0x48')](_0x5b3087)[_0x936b('0x25')](handleEntityNotFound(_0x3072e9,null))[_0x936b('0x25')](respondWithResult(_0x3072e9,null))[_0x936b('0x49')](handleError(_0x3072e9,null));};exports[_0x936b('0x4a')]=function(_0x2c89be,_0x2b2aff){return db[_0x936b('0x2c')][_0x936b('0x4a')](_0x2c89be['body'],{})[_0x936b('0x25')](respondWithResult(_0x2b2aff,0xc9))[_0x936b('0x49')](handleError(_0x2b2aff,null));};exports['update']=function(_0x38aa08,_0x1351e2){if(_0x38aa08['body']['id']){delete _0x38aa08['body']['id'];}return db[_0x936b('0x2c')][_0x936b('0x48')]({'where':{'id':_0x38aa08[_0x936b('0x44')]['id']}})[_0x936b('0x25')](handleEntityNotFound(_0x1351e2,null))['then'](saveUpdates(_0x38aa08['body'],null))['then'](respondWithResult(_0x1351e2,null))[_0x936b('0x49')](handleError(_0x1351e2,null));};exports['destroy']=function(_0x5a33fb,_0x32ac23){return db[_0x936b('0x2c')]['find']({'where':{'id':_0x5a33fb[_0x936b('0x44')]['id']}})['then'](handleEntityNotFound(_0x32ac23,null))['then'](removeEntity(_0x32ac23,null))[_0x936b('0x49')](handleError(_0x32ac23,null));};exports[_0x936b('0x4b')]=function(_0x53ab67,_0x58785b,_0x2c8ae7){var _0x10d061={};var _0x592d10={};var _0x1dbccf;var _0x28f7f0;return db['VtigerConfiguration'][_0x936b('0x4c')]({'where':{'id':_0x53ab67[_0x936b('0x44')]['id']}})['then'](handleEntityNotFound(_0x58785b,null))[_0x936b('0x25')](function(_0x37f00e){if(_0x37f00e){_0x1dbccf=_0x37f00e;_0x592d10[_0x936b('0x31')]=_['keys'](db[_0x936b('0x4d')][_0x936b('0x2d')]);_0x592d10[_0x936b('0x35')]=_[_0x936b('0x32')](_0x53ab67[_0x936b('0x35')]);_0x592d10['filters']=_[_0x936b('0x34')](_0x592d10['model'],_0x592d10['query']);_0x10d061[_0x936b('0x36')]=_['intersection'](_0x592d10[_0x936b('0x31')],qs[_0x936b('0x37')](_0x53ab67[_0x936b('0x35')][_0x936b('0x37')]));_0x10d061[_0x936b('0x36')]=_0x10d061[_0x936b('0x36')]['length']?_0x10d061['attributes']:_0x592d10[_0x936b('0x31')];_0x10d061[_0x936b('0x3a')]=qs[_0x936b('0x3b')](_0x53ab67[_0x936b('0x35')]['sort']);_0x10d061[_0x936b('0x3c')]=qs[_0x936b('0x33')](_['pick'](_0x53ab67['query'],_0x592d10[_0x936b('0x33')]));if(_0x53ab67[_0x936b('0x35')][_0x936b('0x3e')]){_0x10d061[_0x936b('0x3c')]=_[_0x936b('0x3f')](_0x10d061[_0x936b('0x3c')],{'$or':_[_0x936b('0x2b')](_0x10d061['attributes'],function(_0x2b6c45){var _0x426427={};_0x426427[_0x2b6c45]={'$like':'%'+_0x53ab67['query'][_0x936b('0x3e')]+'%'};return _0x426427;})});}_0x10d061=_[_0x936b('0x3f')]({},_0x10d061,_0x53ab67[_0x936b('0x47')]);return _0x1dbccf['getFields'](_0x10d061);}})[_0x936b('0x25')](function(_0x17df56){if(_0x17df56){_0x28f7f0=_0x17df56['length'];if(!_0x53ab67[_0x936b('0x35')][_0x936b('0x38')](_0x936b('0x39'))){_0x10d061[_0x936b('0x1f')]=qs[_0x936b('0x1f')](_0x53ab67[_0x936b('0x35')][_0x936b('0x1f')]);_0x10d061[_0x936b('0x1d')]=qs['offset'](_0x53ab67[_0x936b('0x35')][_0x936b('0x1d')]);}return _0x1dbccf[_0x936b('0x4b')](_0x10d061);}})['then'](function(_0x178601){if(_0x178601){return _0x178601?{'count':_0x28f7f0,'rows':_0x178601}:null;}})[_0x936b('0x25')](respondWithResult(_0x58785b,null))['catch'](handleError(_0x58785b,null));};exports[_0x936b('0x4e')]=function(_0x12325d,_0x2fd39e,_0x236e46){var _0x378d92={};var _0x5a8392={};var _0x4bcebe;var _0x1baba2;return db[_0x936b('0x2c')][_0x936b('0x4c')]({'where':{'id':_0x12325d[_0x936b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fd39e,null))[_0x936b('0x25')](function(_0x544752){if(_0x544752){_0x4bcebe=_0x544752;_0x5a8392[_0x936b('0x31')]=_[_0x936b('0x32')](db['VtigerField'][_0x936b('0x2d')]);_0x5a8392[_0x936b('0x35')]=_[_0x936b('0x32')](_0x12325d[_0x936b('0x35')]);_0x5a8392[_0x936b('0x33')]=_[_0x936b('0x34')](_0x5a8392[_0x936b('0x31')],_0x5a8392[_0x936b('0x35')]);_0x378d92[_0x936b('0x36')]=_['intersection'](_0x5a8392[_0x936b('0x31')],qs[_0x936b('0x37')](_0x12325d['query'][_0x936b('0x37')]));_0x378d92[_0x936b('0x36')]=_0x378d92[_0x936b('0x36')][_0x936b('0x45')]?_0x378d92[_0x936b('0x36')]:_0x5a8392[_0x936b('0x31')];_0x378d92['order']=qs[_0x936b('0x3b')](_0x12325d[_0x936b('0x35')][_0x936b('0x3b')]);_0x378d92[_0x936b('0x3c')]=qs[_0x936b('0x33')](_[_0x936b('0x3d')](_0x12325d['query'],_0x5a8392['filters']));if(_0x12325d[_0x936b('0x35')][_0x936b('0x3e')]){_0x378d92[_0x936b('0x3c')]=_[_0x936b('0x3f')](_0x378d92[_0x936b('0x3c')],{'$or':_[_0x936b('0x2b')](_0x378d92['attributes'],function(_0x3d4f67){var _0x5e528c={};_0x5e528c[_0x3d4f67]={'$like':'%'+_0x12325d[_0x936b('0x35')][_0x936b('0x3e')]+'%'};return _0x5e528c;})});}_0x378d92=_[_0x936b('0x3f')]({},_0x378d92,_0x12325d['options']);return _0x4bcebe['getSubjects'](_0x378d92);}})[_0x936b('0x25')](function(_0x5b0379){if(_0x5b0379){_0x1baba2=_0x5b0379[_0x936b('0x45')];if(!_0x12325d[_0x936b('0x35')][_0x936b('0x38')](_0x936b('0x39'))){_0x378d92[_0x936b('0x1f')]=qs[_0x936b('0x1f')](_0x12325d[_0x936b('0x35')][_0x936b('0x1f')]);_0x378d92[_0x936b('0x1d')]=qs['offset'](_0x12325d[_0x936b('0x35')]['offset']);}return _0x4bcebe[_0x936b('0x4e')](_0x378d92);}})[_0x936b('0x25')](function(_0x8f7d85){if(_0x8f7d85){return _0x8f7d85?{'count':_0x1baba2,'rows':_0x8f7d85}:null;}})['then'](respondWithResult(_0x2fd39e,null))[_0x936b('0x49')](handleError(_0x2fd39e,null));};exports[_0x936b('0x4f')]=function(_0x47764b,_0x48389c,_0x60b2b){var _0x3411fa={};var _0x24e4a7={};var _0x2d4d58;var _0x41b053;return db[_0x936b('0x2c')][_0x936b('0x4c')]({'where':{'id':_0x47764b[_0x936b('0x44')]['id']}})[_0x936b('0x25')](handleEntityNotFound(_0x48389c,null))[_0x936b('0x25')](function(_0x566567){if(_0x566567){_0x2d4d58=_0x566567;_0x24e4a7['model']=_[_0x936b('0x32')](db[_0x936b('0x4d')][_0x936b('0x2d')]);_0x24e4a7['query']=_[_0x936b('0x32')](_0x47764b[_0x936b('0x35')]);_0x24e4a7[_0x936b('0x33')]=_[_0x936b('0x34')](_0x24e4a7[_0x936b('0x31')],_0x24e4a7[_0x936b('0x35')]);_0x3411fa[_0x936b('0x36')]=_[_0x936b('0x34')](_0x24e4a7[_0x936b('0x31')],qs[_0x936b('0x37')](_0x47764b['query'][_0x936b('0x37')]));_0x3411fa['attributes']=_0x3411fa[_0x936b('0x36')][_0x936b('0x45')]?_0x3411fa[_0x936b('0x36')]:_0x24e4a7[_0x936b('0x31')];_0x3411fa[_0x936b('0x3a')]=qs[_0x936b('0x3b')](_0x47764b['query']['sort']);_0x3411fa['where']=qs[_0x936b('0x33')](_[_0x936b('0x3d')](_0x47764b[_0x936b('0x35')],_0x24e4a7[_0x936b('0x33')]));if(_0x47764b[_0x936b('0x35')][_0x936b('0x3e')]){_0x3411fa[_0x936b('0x3c')]=_['merge'](_0x3411fa['where'],{'$or':_[_0x936b('0x2b')](_0x3411fa[_0x936b('0x36')],function(_0x210575){var _0x150527={};_0x150527[_0x210575]={'$like':'%'+_0x47764b[_0x936b('0x35')][_0x936b('0x3e')]+'%'};return _0x150527;})});}_0x3411fa=_[_0x936b('0x3f')]({},_0x3411fa,_0x47764b['options']);return _0x2d4d58[_0x936b('0x4f')](_0x3411fa);}})['then'](function(_0x1e3449){if(_0x1e3449){_0x41b053=_0x1e3449[_0x936b('0x45')];if(!_0x47764b[_0x936b('0x35')][_0x936b('0x38')](_0x936b('0x39'))){_0x3411fa[_0x936b('0x1f')]=qs[_0x936b('0x1f')](_0x47764b['query'][_0x936b('0x1f')]);_0x3411fa[_0x936b('0x1d')]=qs[_0x936b('0x1d')](_0x47764b[_0x936b('0x35')][_0x936b('0x1d')]);}return _0x2d4d58[_0x936b('0x4f')](_0x3411fa);}})['then'](function(_0x2919eb){if(_0x2919eb){return _0x2919eb?{'count':_0x41b053,'rows':_0x2919eb}:null;}})[_0x936b('0x25')](respondWithResult(_0x48389c,null))[_0x936b('0x49')](handleError(_0x48389c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5bd65cd..675ba60 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 _0x5c4b=['../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','util','api','moment','bluebird','path','rimraf'];(function(_0x573751,_0x2a49d3){var _0x2ced1c=function(_0x3710c8){while(--_0x3710c8){_0x573751['push'](_0x573751['shift']());}};_0x2ced1c(++_0x2a49d3);}(_0x5c4b,0x86));var _0xb5c4=function(_0x2b86d4,_0x45e314){_0x2b86d4=_0x2b86d4-0x0;var _0x141ab1=_0x5c4b[_0x2b86d4];return _0x141ab1;};'use strict';var _=require('lodash');var util=require(_0xb5c4('0x0'));var logger=require('../../config/logger')(_0xb5c4('0x1'));var moment=require(_0xb5c4('0x2'));var BPromise=require(_0xb5c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5c4('0x4'));var rimraf=require(_0xb5c4('0x5'));var config=require(_0xb5c4('0x6'));var attributes=require(_0xb5c4('0x7'));module[_0xb5c4('0x8')]=function(_0x27e2f6,_0x35eebd){return _0x27e2f6['define'](_0xb5c4('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed7d=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0x41de18,_0x5a79d){var _0x557ffb=function(_0x58bddd){while(--_0x58bddd){_0x41de18['push'](_0x41de18['shift']());}};_0x557ffb(++_0x5a79d);}(_0xed7d,0x17b));var _0xded7=function(_0x2f9eeb,_0x53b0b6){_0x2f9eeb=_0x2f9eeb-0x0;var _0xcf83bc=_0xed7d[_0x2f9eeb];return _0xcf83bc;};'use strict';var _=require(_0xded7('0x0'));var util=require(_0xded7('0x1'));var logger=require(_0xded7('0x2'))(_0xded7('0x3'));var moment=require(_0xded7('0x4'));var BPromise=require(_0xded7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xded7('0x6'));var rimraf=require(_0xded7('0x7'));var config=require(_0xded7('0x8'));var attributes=require(_0xded7('0x9'));module[_0xded7('0xa')]=function(_0x287022,_0x3497e6){return _0x287022[_0xded7('0xb')](_0xded7('0xc'),attributes,{'tableName':_0xded7('0xd'),'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 941eb3d..c1f41ef 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 _0xac3a=['client','http','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','info','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x432ec8,_0x99f2a4){var _0x304800=function(_0x52ef5a){while(--_0x52ef5a){_0x432ec8['push'](_0x432ec8['shift']());}};_0x304800(++_0x99f2a4);}(_0xac3a,0xaf));var _0xaac3=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xac3a[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaac3('0x0'));var BPromise=require(_0xaac3('0x1'));var rs=require(_0xaac3('0x2'));var fs=require('fs');var Redis=require(_0xaac3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaac3('0x4'));var logger=require(_0xaac3('0x5'))(_0xaac3('0x6'));var config=require(_0xaac3('0x7'));var jayson=require(_0xaac3('0x8'));var client=jayson[_0xaac3('0x9')][_0xaac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38ba2a,_0x5e6015,_0x236518){return new BPromise(function(_0x1a0ec9,_0x2125c8){return client[_0xaac3('0xb')](_0x38ba2a,_0x236518)[_0xaac3('0xc')](function(_0x1ec4d5){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x5e6015,_0xaac3('0xd'));logger[_0xaac3('0xe')](_0xaac3('0xf'),_0x5e6015,_0xaac3('0xd'),JSON[_0xaac3('0x10')](_0x1ec4d5));if(_0x1ec4d5['error']){if(_0x1ec4d5[_0xaac3('0x11')][_0xaac3('0x12')]===0x1f4){logger[_0xaac3('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5e6015,_0x1ec4d5['error'][_0xaac3('0x13')]);return _0x2125c8(_0x1ec4d5['error'][_0xaac3('0x13')]);}logger[_0xaac3('0x11')](_0xaac3('0x14'),_0x5e6015,_0x1ec4d5[_0xaac3('0x11')][_0xaac3('0x13')]);return _0x1a0ec9(_0x1ec4d5[_0xaac3('0x11')]['message']);}else{logger[_0xaac3('0x15')](_0xaac3('0x14'),_0x5e6015,_0xaac3('0xd'));_0x1a0ec9(_0x1ec4d5[_0xaac3('0x16')]['message']);}})['catch'](function(_0x3fc659){logger['error'](_0xaac3('0x14'),_0x5e6015,_0x3fc659);_0x2125c8(_0x3fc659);});});} \ No newline at end of file +var _0x68ad=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x307d4e,_0x4bbb11){var _0x184d26=function(_0x3ba15d){while(--_0x3ba15d){_0x307d4e['push'](_0x307d4e['shift']());}};_0x184d26(++_0x4bbb11);}(_0x68ad,0x93));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd68a('0x0'));var util=require(_0xd68a('0x1'));var moment=require(_0xd68a('0x2'));var BPromise=require('bluebird');var rs=require(_0xd68a('0x3'));var fs=require('fs');var Redis=require(_0xd68a('0x4'));var db=require(_0xd68a('0x5'))['db'];var utils=require(_0xd68a('0x6'));var logger=require(_0xd68a('0x7'))(_0xd68a('0x8'));var config=require('../../config/environment');var jayson=require(_0xd68a('0x9'));var client=jayson[_0xd68a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34ea62,_0x334e67,_0x22113e){return new BPromise(function(_0x398cc3,_0x28b2af){return client[_0xd68a('0xb')](_0x34ea62,_0x22113e)['then'](function(_0xa5eb72){logger[_0xd68a('0xc')](_0xd68a('0xd'),_0x334e67,_0xd68a('0xe'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x334e67,'request\x20sent',JSON['stringify'](_0xa5eb72));if(_0xa5eb72[_0xd68a('0xf')]){if(_0xa5eb72[_0xd68a('0xf')]['code']===0x1f4){logger[_0xd68a('0xf')](_0xd68a('0xd'),_0x334e67,_0xa5eb72[_0xd68a('0xf')][_0xd68a('0x10')]);return _0x28b2af(_0xa5eb72[_0xd68a('0xf')]['message']);}logger['error'](_0xd68a('0xd'),_0x334e67,_0xa5eb72['error'][_0xd68a('0x10')]);return _0x398cc3(_0xa5eb72['error'][_0xd68a('0x10')]);}else{logger[_0xd68a('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x334e67,'request\x20sent');_0x398cc3(_0xa5eb72[_0xd68a('0x11')][_0xd68a('0x10')]);}})[_0xd68a('0x12')](function(_0x3a6a66){logger[_0xd68a('0xf')](_0xd68a('0xd'),_0x334e67,_0x3a6a66);_0x28b2af(_0x3a6a66);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4abc27a..5202fe8 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 _0x51bd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x51bd,0x73));var _0xd51b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x51bd[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0xd51b('0x0'));var path=require('path');var timeout=require(_0xd51b('0x1'));var express=require(_0xd51b('0x2'));var router=express[_0xd51b('0x3')]();var fs_extra=require(_0xd51b('0x4'));var auth=require(_0xd51b('0x5'));var interaction=require(_0xd51b('0x6'));var config=require(_0xd51b('0x7'));var controller=require(_0xd51b('0x8'));router[_0xd51b('0x9')]('/',auth[_0xd51b('0xa')](),controller[_0xd51b('0xb')]);router[_0xd51b('0x9')]('/:id',auth[_0xd51b('0xa')](),controller[_0xd51b('0xc')]);router[_0xd51b('0xd')]('/',auth[_0xd51b('0xa')](),controller[_0xd51b('0xe')]);router['put']('/:id',auth[_0xd51b('0xa')](),controller[_0xd51b('0xf')]);router[_0xd51b('0x10')](_0xd51b('0x11'),auth[_0xd51b('0xa')](),controller[_0xd51b('0x12')]);module[_0xd51b('0x13')]=router; \ No newline at end of file +var _0xe939=['show','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x347649,_0x635b73){var _0x2eebec=function(_0x29b104){while(--_0x29b104){_0x347649['push'](_0x347649['shift']());}};_0x2eebec(++_0x635b73);}(_0xe939,0x1f3));var _0x9e93=function(_0x5bb1c1,_0x39c8cf){_0x5bb1c1=_0x5bb1c1-0x0;var _0xe8d648=_0xe939[_0x5bb1c1];return _0xe8d648;};'use strict';var multer=require(_0x9e93('0x0'));var util=require(_0x9e93('0x1'));var path=require(_0x9e93('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e93('0x3'));var router=express[_0x9e93('0x4')]();var fs_extra=require(_0x9e93('0x5'));var auth=require(_0x9e93('0x6'));var interaction=require(_0x9e93('0x7'));var config=require(_0x9e93('0x8'));var controller=require(_0x9e93('0x9'));router[_0x9e93('0xa')]('/',auth[_0x9e93('0xb')](),controller[_0x9e93('0xc')]);router[_0x9e93('0xa')](_0x9e93('0xd'),auth['isAuthenticated'](),controller[_0x9e93('0xe')]);router['post']('/',auth[_0x9e93('0xb')](),controller['create']);router['put'](_0x9e93('0xd'),auth[_0x9e93('0xb')](),controller[_0x9e93('0xf')]);router[_0x9e93('0x10')](_0x9e93('0xd'),auth['isAuthenticated'](),controller[_0x9e93('0x11')]);module[_0x9e93('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 85acfc4..b48eb39 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 _0xebe2=['exports','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x7b4399,_0x3927df){var _0x4136b6=function(_0x21a50d){while(--_0x21a50d){_0x7b4399['push'](_0x7b4399['shift']());}};_0x4136b6(++_0x3927df);}(_0xebe2,0xb3));var _0x2ebe=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0xebe2[_0x269c42];return _0x4dad76;};'use strict';var Sequelize=require(_0x2ebe('0x0'));module[_0x2ebe('0x1')]={'type':{'type':Sequelize[_0x2ebe('0x2')](_0x2ebe('0x3'),_0x2ebe('0x4'),'customVariable',_0x2ebe('0x5'),_0x2ebe('0x6')),'defaultValue':_0x2ebe('0x3')},'content':{'type':Sequelize[_0x2ebe('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2ebe('0x3'),_0x2ebe('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2ebe('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2ebe('0x7')]},'customField':{'type':Sequelize[_0x2ebe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x851c=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x4dd8b2,_0x7421f7){var _0x28fb0a=function(_0x3882fd){while(--_0x3882fd){_0x4dd8b2['push'](_0x4dd8b2['shift']());}};_0x28fb0a(++_0x7421f7);}(_0x851c,0x79));var _0xc851=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x851c[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xc851('0x0'));module[_0xc851('0x1')]={'type':{'type':Sequelize[_0xc851('0x2')](_0xc851('0x3'),'variable',_0xc851('0x4'),_0xc851('0x5'),_0xc851('0x6')),'defaultValue':_0xc851('0x3')},'content':{'type':Sequelize[_0xc851('0x7')]},'key':{'type':Sequelize[_0xc851('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc851('0x3'),'variable',_0xc851('0x4'))},'keyContent':{'type':Sequelize[_0xc851('0x7')]},'idField':{'type':Sequelize[_0xc851('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc851('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc851('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3f1cc3c..d08f959 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 _0xaf4e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','count','limit','status','set','json','apply','reject','update','destroy','then','error','stack','name','send','VtigerField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x29dbda,_0x15dc63){var _0x1c7c81=function(_0x2b878d){while(--_0x2b878d){_0x29dbda['push'](_0x29dbda['shift']());}};_0x1c7c81(++_0x15dc63);}(_0xaf4e,0xa8));var _0xeaf4=function(_0xf31e74,_0x27854c){_0xf31e74=_0xf31e74-0x0;var _0x2222b2=_0xaf4e[_0xf31e74];return _0x2222b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeaf4('0x0'));var zipdir=require(_0xeaf4('0x1'));var jsonpatch=require(_0xeaf4('0x2'));var rp=require(_0xeaf4('0x3'));var moment=require('moment');var BPromise=require(_0xeaf4('0x4'));var Mustache=require(_0xeaf4('0x5'));var util=require(_0xeaf4('0x6'));var path=require(_0xeaf4('0x7'));var sox=require(_0xeaf4('0x8'));var csv=require(_0xeaf4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeaf4('0xa'));var _=require(_0xeaf4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeaf4('0xc'));var deskjs=require(_0xeaf4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeaf4('0xe'));var Redis=require(_0xeaf4('0xf'));var authService=require(_0xeaf4('0x10'));var qs=require(_0xeaf4('0x11'));var as=require(_0xeaf4('0x12'));var hardwareService=require(_0xeaf4('0x13'));var logger=require(_0xeaf4('0x14'))('api');var utils=require(_0xeaf4('0x15'));var config=require(_0xeaf4('0x16'));var licenseUtil=require(_0xeaf4('0x17'));var db=require(_0xeaf4('0x18'))['db'];function respondWithStatusCode(_0x22b277,_0x3c9786){_0x3c9786=_0x3c9786||0xcc;return function(_0x380e3a){if(_0x380e3a){return _0x22b277[_0xeaf4('0x19')](_0x3c9786);}return _0x22b277['status'](_0x3c9786)[_0xeaf4('0x1a')]();};}function respondWithResult(_0x5e5a88,_0xe5f014){_0xe5f014=_0xe5f014||0xc8;return function(_0x109214){if(_0x109214){return _0x5e5a88['status'](_0xe5f014)['json'](_0x109214);}};}function respondWithFilteredResult(_0x3c216f,_0x120a9f){return function(_0x498c65){if(_0x498c65){var _0x492f1e=typeof _0x120a9f[_0xeaf4('0x1b')]==='undefined'&&typeof _0x120a9f['limit']==='undefined';var _0x2599ca=_0x498c65[_0xeaf4('0x1c')];var _0x46b765=_0x492f1e?0x0:_0x120a9f[_0xeaf4('0x1b')];var _0x191e68=_0x492f1e?_0x498c65[_0xeaf4('0x1c')]:_0x120a9f[_0xeaf4('0x1b')]+_0x120a9f[_0xeaf4('0x1d')];var _0x21eb15;if(_0x191e68>=_0x2599ca){_0x191e68=_0x2599ca;_0x21eb15=0xc8;}else{_0x21eb15=0xce;}_0x3c216f[_0xeaf4('0x1e')](_0x21eb15);return _0x3c216f[_0xeaf4('0x1f')]('Content-Range',_0x46b765+'-'+_0x191e68+'/'+_0x2599ca)[_0xeaf4('0x20')](_0x498c65);}return null;};}function patchUpdates(_0x6abcf3){return function(_0x540442){try{jsonpatch[_0xeaf4('0x21')](_0x540442,_0x6abcf3,!![]);}catch(_0x5af1bd){return BPromise[_0xeaf4('0x22')](_0x5af1bd);}return _0x540442['save']();};}function saveUpdates(_0x1cf0be,_0x18f0a6){return function(_0x8411e){if(_0x8411e){return _0x8411e[_0xeaf4('0x23')](_0x1cf0be)['then'](function(_0x315435){return _0x315435;});}return null;};}function removeEntity(_0x4db6e9,_0x772139){return function(_0x412643){if(_0x412643){return _0x412643[_0xeaf4('0x24')]()[_0xeaf4('0x25')](function(){_0x4db6e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dac9a,_0x377502){return function(_0x2b30c5){if(!_0x2b30c5){_0x1dac9a['sendStatus'](0x194);}return _0x2b30c5;};}function handleError(_0x142067,_0x228b8f){_0x228b8f=_0x228b8f||0x1f4;return function(_0x2dc5a4){logger[_0xeaf4('0x26')](_0x2dc5a4[_0xeaf4('0x27')]);if(_0x2dc5a4[_0xeaf4('0x28')]){delete _0x2dc5a4[_0xeaf4('0x28')];}_0x142067[_0xeaf4('0x1e')](_0x228b8f)[_0xeaf4('0x29')](_0x2dc5a4);};}exports['index']=function(_0x489e88,_0x40f3b6){var _0x4e1f9d={},_0x215305={},_0x29708e={'count':0x0,'rows':[]};var _0x3348ec=_['map'](db[_0xeaf4('0x2a')]['rawAttributes'],function(_0x2ff51c){return{'name':_0x2ff51c[_0xeaf4('0x2b')],'type':_0x2ff51c[_0xeaf4('0x2c')][_0xeaf4('0x2d')]};});_0x215305[_0xeaf4('0x2e')]=_[_0xeaf4('0x2f')](_0x3348ec,_0xeaf4('0x28'));_0x215305[_0xeaf4('0x30')]=_[_0xeaf4('0x31')](_0x489e88['query']);_0x215305[_0xeaf4('0x32')]=_[_0xeaf4('0x33')](_0x215305[_0xeaf4('0x2e')],_0x215305[_0xeaf4('0x30')]);_0x4e1f9d[_0xeaf4('0x34')]=_[_0xeaf4('0x33')](_0x215305[_0xeaf4('0x2e')],qs[_0xeaf4('0x35')](_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x35')]));_0x4e1f9d['attributes']=_0x4e1f9d[_0xeaf4('0x34')][_0xeaf4('0x36')]?_0x4e1f9d[_0xeaf4('0x34')]:_0x215305[_0xeaf4('0x2e')];if(!_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x37')](_0xeaf4('0x38'))){_0x4e1f9d[_0xeaf4('0x1d')]=qs[_0xeaf4('0x1d')](_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x1d')]);_0x4e1f9d[_0xeaf4('0x1b')]=qs[_0xeaf4('0x1b')](_0x489e88['query']['offset']);}_0x4e1f9d[_0xeaf4('0x39')]=qs[_0xeaf4('0x3a')](_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x3a')]);_0x4e1f9d[_0xeaf4('0x3b')]=qs[_0xeaf4('0x32')](_[_0xeaf4('0x3c')](_0x489e88[_0xeaf4('0x30')],_0x215305[_0xeaf4('0x32')]),_0x3348ec);if(_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x3d')]){_0x4e1f9d[_0xeaf4('0x3b')]=_['merge'](_0x4e1f9d[_0xeaf4('0x3b')],{'$or':_[_0xeaf4('0x2f')](_0x3348ec,function(_0x33e68a){if(_0x33e68a[_0xeaf4('0x2c')]!==_0xeaf4('0x3e')){var _0x41afc3={};_0x41afc3[_0x33e68a['name']]={'$like':'%'+_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x3d')]+'%'};return _0x41afc3;}})});}_0x4e1f9d=_[_0xeaf4('0x3f')]({},_0x4e1f9d,_0x489e88[_0xeaf4('0x40')]);var _0x104487={'where':_0x4e1f9d[_0xeaf4('0x3b')]};return db[_0xeaf4('0x2a')]['count'](_0x104487)[_0xeaf4('0x25')](function(_0x35fd82){_0x29708e[_0xeaf4('0x1c')]=_0x35fd82;if(_0x489e88[_0xeaf4('0x30')][_0xeaf4('0x41')]){_0x4e1f9d[_0xeaf4('0x42')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4e1f9d);})['then'](function(_0x3e5e90){_0x29708e[_0xeaf4('0x43')]=_0x3e5e90;return _0x29708e;})[_0xeaf4('0x25')](respondWithFilteredResult(_0x40f3b6,_0x4e1f9d))[_0xeaf4('0x44')](handleError(_0x40f3b6,null));};exports[_0xeaf4('0x45')]=function(_0x14b61c,_0x46391d){var _0x8c876e={'raw':!![],'where':{'id':_0x14b61c[_0xeaf4('0x46')]['id']}},_0x496092={};_0x496092[_0xeaf4('0x2e')]=_['keys'](db[_0xeaf4('0x2a')][_0xeaf4('0x47')]);_0x496092[_0xeaf4('0x30')]=_[_0xeaf4('0x31')](_0x14b61c[_0xeaf4('0x30')]);_0x496092[_0xeaf4('0x32')]=_[_0xeaf4('0x33')](_0x496092[_0xeaf4('0x2e')],_0x496092[_0xeaf4('0x30')]);_0x8c876e[_0xeaf4('0x34')]=_[_0xeaf4('0x33')](_0x496092[_0xeaf4('0x2e')],qs[_0xeaf4('0x35')](_0x14b61c['query'][_0xeaf4('0x35')]));_0x8c876e[_0xeaf4('0x34')]=_0x8c876e[_0xeaf4('0x34')][_0xeaf4('0x36')]?_0x8c876e[_0xeaf4('0x34')]:_0x496092[_0xeaf4('0x2e')];if(_0x14b61c[_0xeaf4('0x30')]['includeAll']){_0x8c876e[_0xeaf4('0x42')]=[{'all':!![]}];}_0x8c876e=_[_0xeaf4('0x3f')]({},_0x8c876e,_0x14b61c['options']);return db[_0xeaf4('0x2a')][_0xeaf4('0x48')](_0x8c876e)[_0xeaf4('0x25')](handleEntityNotFound(_0x46391d,null))[_0xeaf4('0x25')](respondWithResult(_0x46391d,null))['catch'](handleError(_0x46391d,null));};exports['create']=function(_0x304f19,_0xd7f15b){return db[_0xeaf4('0x2a')]['create'](_0x304f19[_0xeaf4('0x49')],{})[_0xeaf4('0x25')](respondWithResult(_0xd7f15b,0xc9))[_0xeaf4('0x44')](handleError(_0xd7f15b,null));};exports[_0xeaf4('0x23')]=function(_0x5d3d50,_0x1244de){if(_0x5d3d50[_0xeaf4('0x49')]['id']){delete _0x5d3d50[_0xeaf4('0x49')]['id'];}return db[_0xeaf4('0x2a')][_0xeaf4('0x48')]({'where':{'id':_0x5d3d50['params']['id']}})[_0xeaf4('0x25')](handleEntityNotFound(_0x1244de,null))[_0xeaf4('0x25')](saveUpdates(_0x5d3d50[_0xeaf4('0x49')],null))[_0xeaf4('0x25')](respondWithResult(_0x1244de,null))['catch'](handleError(_0x1244de,null));};exports['destroy']=function(_0x129a6a,_0x4f1004){return db['VtigerField'][_0xeaf4('0x48')]({'where':{'id':_0x129a6a['params']['id']}})['then'](handleEntityNotFound(_0x4f1004,null))[_0xeaf4('0x25')](removeEntity(_0x4f1004,null))[_0xeaf4('0x44')](handleError(_0x4f1004,null));}; \ No newline at end of file +var _0xddac=['util','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','VtigerField','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddac,0xd1));var _0xcdda=function(_0x3712ac,_0x399adc){_0x3712ac=_0x3712ac-0x0;var _0x356928=_0xddac[_0x3712ac];return _0x356928;};'use strict';var emlformat=require(_0xcdda('0x0'));var rimraf=require(_0xcdda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdda('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcdda('0x3'));var util=require(_0xcdda('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcdda('0x5'));var ejs=require(_0xcdda('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcdda('0x7'));var crypto=require(_0xcdda('0x8'));var jsforce=require(_0xcdda('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xcdda('0x5'));var querystring=require('querystring');var Papa=require(_0xcdda('0xa'));var Redis=require(_0xcdda('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xcdda('0xc'));var as=require(_0xcdda('0xd'));var hardwareService=require(_0xcdda('0xe'));var logger=require(_0xcdda('0xf'))(_0xcdda('0x10'));var utils=require(_0xcdda('0x11'));var config=require(_0xcdda('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdda('0x13'))['db'];function respondWithStatusCode(_0x374088,_0x508870){_0x508870=_0x508870||0xcc;return function(_0x53d9d4){if(_0x53d9d4){return _0x374088[_0xcdda('0x14')](_0x508870);}return _0x374088[_0xcdda('0x15')](_0x508870)['end']();};}function respondWithResult(_0x4e3583,_0x279117){_0x279117=_0x279117||0xc8;return function(_0x41275c){if(_0x41275c){return _0x4e3583[_0xcdda('0x15')](_0x279117)[_0xcdda('0x16')](_0x41275c);}};}function respondWithFilteredResult(_0x85841f,_0x7fff9d){return function(_0x2895af){if(_0x2895af){var _0x301963=typeof _0x7fff9d[_0xcdda('0x17')]==='undefined'&&typeof _0x7fff9d[_0xcdda('0x18')]===_0xcdda('0x19');var _0x47c74e=_0x2895af[_0xcdda('0x1a')];var _0xfe8193=_0x301963?0x0:_0x7fff9d[_0xcdda('0x17')];var _0x2c59e0=_0x301963?_0x2895af[_0xcdda('0x1a')]:_0x7fff9d[_0xcdda('0x17')]+_0x7fff9d[_0xcdda('0x18')];var _0x8de995;if(_0x2c59e0>=_0x47c74e){_0x2c59e0=_0x47c74e;_0x8de995=0xc8;}else{_0x8de995=0xce;}_0x85841f[_0xcdda('0x15')](_0x8de995);return _0x85841f[_0xcdda('0x1b')](_0xcdda('0x1c'),_0xfe8193+'-'+_0x2c59e0+'/'+_0x47c74e)['json'](_0x2895af);}return null;};}function patchUpdates(_0x3f059a){return function(_0x5785d2){try{jsonpatch[_0xcdda('0x1d')](_0x5785d2,_0x3f059a,!![]);}catch(_0x5590d5){return BPromise[_0xcdda('0x1e')](_0x5590d5);}return _0x5785d2['save']();};}function saveUpdates(_0x376d0c,_0x1c424c){return function(_0x2f9a9a){if(_0x2f9a9a){return _0x2f9a9a[_0xcdda('0x1f')](_0x376d0c)[_0xcdda('0x20')](function(_0x21ec57){return _0x21ec57;});}return null;};}function removeEntity(_0x4413a2,_0x5a6208){return function(_0x216ed0){if(_0x216ed0){return _0x216ed0['destroy']()['then'](function(){_0x4413a2[_0xcdda('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d08e,_0x169fd3){return function(_0x550362){if(!_0x550362){_0x38d08e[_0xcdda('0x14')](0x194);}return _0x550362;};}function handleError(_0x427528,_0x56f51e){_0x56f51e=_0x56f51e||0x1f4;return function(_0x76a7aa){logger[_0xcdda('0x21')](_0x76a7aa['stack']);if(_0x76a7aa['name']){delete _0x76a7aa[_0xcdda('0x22')];}_0x427528['status'](_0x56f51e)[_0xcdda('0x23')](_0x76a7aa);};}exports[_0xcdda('0x24')]=function(_0x37474c,_0x3fa988){var _0x8bdbdd={},_0xffac73={},_0x233959={'count':0x0,'rows':[]};var _0x5ef079=_[_0xcdda('0x25')](db['VtigerField']['rawAttributes'],function(_0x259d36){return{'name':_0x259d36[_0xcdda('0x26')],'type':_0x259d36[_0xcdda('0x27')][_0xcdda('0x28')]};});_0xffac73[_0xcdda('0x29')]=_['map'](_0x5ef079,_0xcdda('0x22'));_0xffac73[_0xcdda('0x2a')]=_[_0xcdda('0x2b')](_0x37474c[_0xcdda('0x2a')]);_0xffac73['filters']=_[_0xcdda('0x2c')](_0xffac73[_0xcdda('0x29')],_0xffac73[_0xcdda('0x2a')]);_0x8bdbdd['attributes']=_[_0xcdda('0x2c')](_0xffac73[_0xcdda('0x29')],qs[_0xcdda('0x2d')](_0x37474c[_0xcdda('0x2a')][_0xcdda('0x2d')]));_0x8bdbdd[_0xcdda('0x2e')]=_0x8bdbdd['attributes'][_0xcdda('0x2f')]?_0x8bdbdd[_0xcdda('0x2e')]:_0xffac73['model'];if(!_0x37474c['query'][_0xcdda('0x30')](_0xcdda('0x31'))){_0x8bdbdd[_0xcdda('0x18')]=qs['limit'](_0x37474c[_0xcdda('0x2a')][_0xcdda('0x18')]);_0x8bdbdd[_0xcdda('0x17')]=qs[_0xcdda('0x17')](_0x37474c[_0xcdda('0x2a')][_0xcdda('0x17')]);}_0x8bdbdd[_0xcdda('0x32')]=qs['sort'](_0x37474c[_0xcdda('0x2a')][_0xcdda('0x33')]);_0x8bdbdd[_0xcdda('0x34')]=qs[_0xcdda('0x35')](_[_0xcdda('0x36')](_0x37474c[_0xcdda('0x2a')],_0xffac73[_0xcdda('0x35')]),_0x5ef079);if(_0x37474c[_0xcdda('0x2a')][_0xcdda('0x37')]){_0x8bdbdd[_0xcdda('0x34')]=_['merge'](_0x8bdbdd[_0xcdda('0x34')],{'$or':_[_0xcdda('0x25')](_0x5ef079,function(_0x3d8010){if(_0x3d8010[_0xcdda('0x27')]!=='VIRTUAL'){var _0x24d18a={};_0x24d18a[_0x3d8010['name']]={'$like':'%'+_0x37474c['query'][_0xcdda('0x37')]+'%'};return _0x24d18a;}})});}_0x8bdbdd=_[_0xcdda('0x38')]({},_0x8bdbdd,_0x37474c[_0xcdda('0x39')]);var _0x3021a5={'where':_0x8bdbdd['where']};return db[_0xcdda('0x3a')][_0xcdda('0x1a')](_0x3021a5)['then'](function(_0x1d0ce1){_0x233959[_0xcdda('0x1a')]=_0x1d0ce1;if(_0x37474c[_0xcdda('0x2a')]['includeAll']){_0x8bdbdd['include']=[{'all':!![]}];}return db[_0xcdda('0x3a')][_0xcdda('0x3b')](_0x8bdbdd);})[_0xcdda('0x20')](function(_0x2d90d1){_0x233959[_0xcdda('0x3c')]=_0x2d90d1;return _0x233959;})[_0xcdda('0x20')](respondWithFilteredResult(_0x3fa988,_0x8bdbdd))[_0xcdda('0x3d')](handleError(_0x3fa988,null));};exports[_0xcdda('0x3e')]=function(_0x3567e6,_0x30980a){var _0x597ddf={'raw':!![],'where':{'id':_0x3567e6[_0xcdda('0x3f')]['id']}},_0x2848e4={};_0x2848e4['model']=_[_0xcdda('0x2b')](db[_0xcdda('0x3a')][_0xcdda('0x40')]);_0x2848e4[_0xcdda('0x2a')]=_[_0xcdda('0x2b')](_0x3567e6[_0xcdda('0x2a')]);_0x2848e4['filters']=_['intersection'](_0x2848e4[_0xcdda('0x29')],_0x2848e4[_0xcdda('0x2a')]);_0x597ddf[_0xcdda('0x2e')]=_[_0xcdda('0x2c')](_0x2848e4['model'],qs[_0xcdda('0x2d')](_0x3567e6[_0xcdda('0x2a')][_0xcdda('0x2d')]));_0x597ddf[_0xcdda('0x2e')]=_0x597ddf[_0xcdda('0x2e')][_0xcdda('0x2f')]?_0x597ddf[_0xcdda('0x2e')]:_0x2848e4['model'];if(_0x3567e6[_0xcdda('0x2a')][_0xcdda('0x41')]){_0x597ddf[_0xcdda('0x42')]=[{'all':!![]}];}_0x597ddf=_[_0xcdda('0x38')]({},_0x597ddf,_0x3567e6['options']);return db['VtigerField'][_0xcdda('0x43')](_0x597ddf)[_0xcdda('0x20')](handleEntityNotFound(_0x30980a,null))[_0xcdda('0x20')](respondWithResult(_0x30980a,null))['catch'](handleError(_0x30980a,null));};exports['create']=function(_0x5baf42,_0x10f7f4){return db[_0xcdda('0x3a')][_0xcdda('0x44')](_0x5baf42[_0xcdda('0x45')],{})['then'](respondWithResult(_0x10f7f4,0xc9))[_0xcdda('0x3d')](handleError(_0x10f7f4,null));};exports[_0xcdda('0x1f')]=function(_0x55aea5,_0x27d495){if(_0x55aea5['body']['id']){delete _0x55aea5['body']['id'];}return db[_0xcdda('0x3a')][_0xcdda('0x43')]({'where':{'id':_0x55aea5[_0xcdda('0x3f')]['id']}})['then'](handleEntityNotFound(_0x27d495,null))['then'](saveUpdates(_0x55aea5['body'],null))['then'](respondWithResult(_0x27d495,null))[_0xcdda('0x3d')](handleError(_0x27d495,null));};exports[_0xcdda('0x46')]=function(_0x514526,_0x51888d){return db[_0xcdda('0x3a')][_0xcdda('0x43')]({'where':{'id':_0x514526[_0xcdda('0x3f')]['id']}})[_0xcdda('0x20')](handleEntityNotFound(_0x51888d,null))[_0xcdda('0x20')](removeEntity(_0x51888d,null))[_0xcdda('0x3d')](handleError(_0x51888d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c608e30..3828887 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 _0xbaca=['FieldId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x4abc43,_0x3eb728){var _0x5c30e4=function(_0x5f223d){while(--_0x5f223d){_0x4abc43['push'](_0x4abc43['shift']());}};_0x5c30e4(++_0x3eb728);}(_0xbaca,0x1eb));var _0xabac=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xbaca[_0x26a906];return _0x495575;};'use strict';var _=require('lodash');var util=require(_0xabac('0x0'));var logger=require('../../config/logger')(_0xabac('0x1'));var moment=require(_0xabac('0x2'));var BPromise=require(_0xabac('0x3'));var rp=require(_0xabac('0x4'));var fs=require('fs');var path=require(_0xabac('0x5'));var rimraf=require(_0xabac('0x6'));var config=require(_0xabac('0x7'));var attributes=require(_0xabac('0x8'));module[_0xabac('0x9')]=function(_0x53c9da,_0x3314bd){return _0x53c9da['define']('VtigerField',attributes,{'tableName':_0xabac('0xa'),'paranoid':![],'indexes':[{'name':_0xabac('0xb'),'fields':[_0xabac('0xc'),_0xabac('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc85c=['exports','define','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x2000d2,_0x3da961){var _0xbe168=function(_0x363f90){while(--_0x363f90){_0x2000d2['push'](_0x2000d2['shift']());}};_0xbe168(++_0x3da961);}(_0xc85c,0x1a8));var _0xcc85=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0xc85c[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0xcc85('0x0'));var util=require(_0xcc85('0x1'));var logger=require(_0xcc85('0x2'))(_0xcc85('0x3'));var moment=require(_0xcc85('0x4'));var BPromise=require('bluebird');var rp=require(_0xcc85('0x5'));var fs=require('fs');var path=require(_0xcc85('0x6'));var rimraf=require(_0xcc85('0x7'));var config=require(_0xcc85('0x8'));var attributes=require(_0xcc85('0x9'));module[_0xcc85('0xa')]=function(_0x3a562e,_0x425baa){return _0x3a562e[_0xcc85('0xb')]('VtigerField',attributes,{'tableName':_0xcc85('0xc'),'paranoid':![],'indexes':[{'name':_0xcc85('0xd'),'fields':['idField','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 47ede4b..a10ebba 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 _0x98ff=['jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5501a0,_0x4a8072){var _0x36cfc3=function(_0x592a1c){while(--_0x592a1c){_0x5501a0['push'](_0x5501a0['shift']());}};_0x36cfc3(++_0x4a8072);}(_0x98ff,0x1d8));var _0xf98f=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x98ff[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xf98f('0x0'));var util=require(_0xf98f('0x1'));var moment=require('moment');var BPromise=require(_0xf98f('0x2'));var rs=require(_0xf98f('0x3'));var fs=require('fs');var Redis=require(_0xf98f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf98f('0x5'));var logger=require('../../config/logger')(_0xf98f('0x6'));var config=require(_0xf98f('0x7'));var jayson=require(_0xf98f('0x8'));var client=jayson['client'][_0xf98f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3960a3,_0x4af698,_0xfc8cb4){return new BPromise(function(_0x577ad0,_0x3d294d){return client['request'](_0x3960a3,_0xfc8cb4)[_0xf98f('0xa')](function(_0x5f2182){logger[_0xf98f('0xb')]('VtigerField,\x20%s,\x20%s',_0x4af698,'request\x20sent');logger['debug'](_0xf98f('0xc'),_0x4af698,_0xf98f('0xd'),JSON[_0xf98f('0xe')](_0x5f2182));if(_0x5f2182[_0xf98f('0xf')]){if(_0x5f2182[_0xf98f('0xf')][_0xf98f('0x10')]===0x1f4){logger[_0xf98f('0xf')](_0xf98f('0x11'),_0x4af698,_0x5f2182[_0xf98f('0xf')][_0xf98f('0x12')]);return _0x3d294d(_0x5f2182[_0xf98f('0xf')][_0xf98f('0x12')]);}logger[_0xf98f('0xf')](_0xf98f('0x11'),_0x4af698,_0x5f2182[_0xf98f('0xf')][_0xf98f('0x12')]);return _0x577ad0(_0x5f2182[_0xf98f('0xf')][_0xf98f('0x12')]);}else{logger['info'](_0xf98f('0x11'),_0x4af698,_0xf98f('0xd'));_0x577ad0(_0x5f2182['result']['message']);}})[_0xf98f('0x13')](function(_0x5e040e){logger[_0xf98f('0xf')]('VtigerField,\x20%s,\x20%s',_0x4af698,_0x5e040e);_0x3d294d(_0x5e040e);});});} \ No newline at end of file +var _0xe348=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x152314,_0x3891bb){var _0x49bac4=function(_0x4dcbc7){while(--_0x4dcbc7){_0x152314['push'](_0x152314['shift']());}};_0x49bac4(++_0x3891bb);}(_0xe348,0x137));var _0x8e34=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xe348[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x8e34('0x0'));var util=require(_0x8e34('0x1'));var moment=require('moment');var BPromise=require(_0x8e34('0x2'));var rs=require(_0x8e34('0x3'));var fs=require('fs');var Redis=require(_0x8e34('0x4'));var db=require(_0x8e34('0x5'))['db'];var utils=require(_0x8e34('0x6'));var logger=require(_0x8e34('0x7'))(_0x8e34('0x8'));var config=require('../../config/environment');var jayson=require(_0x8e34('0x9'));var client=jayson[_0x8e34('0xa')][_0x8e34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8565,_0x1a5573,_0x5b4bbe){return new BPromise(function(_0x161e98,_0x41e8a8){return client['request'](_0x4e8565,_0x5b4bbe)[_0x8e34('0xc')](function(_0x3ee4d8){logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,_0x8e34('0xf'));logger[_0x8e34('0x10')](_0x8e34('0x11'),_0x1a5573,_0x8e34('0xf'),JSON[_0x8e34('0x12')](_0x3ee4d8));if(_0x3ee4d8[_0x8e34('0x13')]){if(_0x3ee4d8['error'][_0x8e34('0x14')]===0x1f4){logger[_0x8e34('0x13')](_0x8e34('0xe'),_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x41e8a8(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x161e98(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}else{logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,'request\x20sent');_0x161e98(_0x3ee4d8[_0x8e34('0x16')]['message']);}})[_0x8e34('0x17')](function(_0x1b8ade){logger['error'](_0x8e34('0xe'),_0x1a5573,_0x1b8ade);_0x41e8a8(_0x1b8ade);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ec558c6..c0b09d2 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 _0xd651=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x41f5a5,_0x472566){var _0x4e5949=function(_0x4dae4b){while(--_0x4dae4b){_0x41f5a5['push'](_0x41f5a5['shift']());}};_0x4e5949(++_0x472566);}(_0xd651,0xad));var _0x1d65=function(_0x22c764,_0xa5260f){_0x22c764=_0x22c764-0x0;var _0x324499=_0xd651[_0x22c764];return _0x324499;};'use strict';var multer=require(_0x1d65('0x0'));var util=require('util');var path=require(_0x1d65('0x1'));var timeout=require(_0x1d65('0x2'));var express=require(_0x1d65('0x3'));var router=express[_0x1d65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d65('0x5'));var interaction=require(_0x1d65('0x6'));var config=require(_0x1d65('0x7'));var controller=require(_0x1d65('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1d65('0x9')](_0x1d65('0xa'),auth[_0x1d65('0xb')](),controller[_0x1d65('0xc')]);router[_0x1d65('0x9')](_0x1d65('0xd'),auth[_0x1d65('0xb')](),controller[_0x1d65('0xe')]);router[_0x1d65('0x9')](_0x1d65('0xf'),auth[_0x1d65('0xb')](),controller['getFields']);router[_0x1d65('0x10')]('/',auth[_0x1d65('0xb')](),controller[_0x1d65('0x11')]);router[_0x1d65('0x10')](_0x1d65('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x1d65('0xa'),auth[_0x1d65('0xb')](),controller[_0x1d65('0x12')]);router[_0x1d65('0x13')](_0x1d65('0xa'),auth[_0x1d65('0xb')](),controller[_0x1d65('0x14')]);module[_0x1d65('0x15')]=router; \ No newline at end of file +var _0xf5c0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','get','getConfigurations','post','addConfiguration','put','update','delete','multer','util','path'];(function(_0x41eb8b,_0x8e630f){var _0x57f6be=function(_0x552d87){while(--_0x552d87){_0x41eb8b['push'](_0x41eb8b['shift']());}};_0x57f6be(++_0x8e630f);}(_0xf5c0,0x9d));var _0x0f5c=function(_0xabe64d,_0x2618da){_0xabe64d=_0xabe64d-0x0;var _0x59af04=_0xf5c0[_0xabe64d];return _0x59af04;};'use strict';var multer=require(_0x0f5c('0x0'));var util=require(_0x0f5c('0x1'));var path=require(_0x0f5c('0x2'));var timeout=require(_0x0f5c('0x3'));var express=require(_0x0f5c('0x4'));var router=express[_0x0f5c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0f5c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0f5c('0x7'));var controller=require(_0x0f5c('0x8'));router['get']('/',auth[_0x0f5c('0x9')](),controller[_0x0f5c('0xa')]);router['get'](_0x0f5c('0xb'),auth[_0x0f5c('0x9')](),controller[_0x0f5c('0xc')]);router[_0x0f5c('0xd')]('/:id/configurations',auth[_0x0f5c('0x9')](),controller[_0x0f5c('0xe')]);router[_0x0f5c('0xd')]('/:id/fields',auth[_0x0f5c('0x9')](),controller['getFields']);router['post']('/',auth[_0x0f5c('0x9')](),controller['create']);router[_0x0f5c('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0f5c('0x10')]);router[_0x0f5c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0f5c('0x12')]);router[_0x0f5c('0x13')](_0x0f5c('0xb'),auth[_0x0f5c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1c601c7..2d22cd9 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 _0x2d0b=['integrationTab','newTab','exports','STRING','username','ENUM','token','password'];(function(_0x406ba5,_0x39fa4b){var _0x557db7=function(_0x40f28b){while(--_0x40f28b){_0x406ba5['push'](_0x406ba5['shift']());}};_0x557db7(++_0x39fa4b);}(_0x2d0b,0x102));var _0xb2d0=function(_0x9fe6f4,_0x51526f){_0x9fe6f4=_0x9fe6f4-0x0;var _0x1415a3=_0x2d0b[_0x9fe6f4];return _0x1415a3;};'use strict';var Sequelize=require('sequelize');module[_0xb2d0('0x0')]={'name':{'type':Sequelize[_0xb2d0('0x1')]},'description':{'type':Sequelize[_0xb2d0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb2d0('0x2')},'password':{'type':Sequelize[_0xb2d0('0x1')]},'token':{'type':Sequelize[_0xb2d0('0x1')]},'remoteUri':{'type':Sequelize[_0xb2d0('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xb2d0('0x3')]('password',_0xb2d0('0x4')),'defaultValue':_0xb2d0('0x5')},'serverUrl':{'type':Sequelize[_0xb2d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb2d0('0x3')](_0xb2d0('0x6'),_0xb2d0('0x7')),'defaultValue':_0xb2d0('0x6')}}; \ No newline at end of file +var _0xba38=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xba38,0x190));var _0x8ba3=function(_0x47a1ad,_0x27c988){_0x47a1ad=_0x47a1ad-0x0;var _0x30b60a=_0xba38[_0x47a1ad];return _0x30b60a;};'use strict';var Sequelize=require('sequelize');module[_0x8ba3('0x0')]={'name':{'type':Sequelize[_0x8ba3('0x1')]},'description':{'type':Sequelize[_0x8ba3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x8ba3('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8ba3('0x1')]},'remoteUri':{'type':Sequelize[_0x8ba3('0x1')],'unique':_0x8ba3('0x3')},'authType':{'type':Sequelize[_0x8ba3('0x4')](_0x8ba3('0x5'),_0x8ba3('0x6')),'defaultValue':_0x8ba3('0x5')},'serverUrl':{'type':Sequelize[_0x8ba3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8ba3('0x4')](_0x8ba3('0x7'),_0x8ba3('0x8')),'defaultValue':_0x8ba3('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c5af43c..61977b6 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 _0x91a7=['includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ZendeskAccount','count','include','rows','params','keys','includeAll','find','catch','create','body','destroy','getConfigurations','ZendeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','findOne','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','headers','toString','base64','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields'];(function(_0x1d0f4a,_0x287d84){var _0x4e8e47=function(_0x145b4b){while(--_0x145b4b){_0x1d0f4a['push'](_0x1d0f4a['shift']());}};_0x4e8e47(++_0x287d84);}(_0x91a7,0xe7));var _0x791a=function(_0x52675c,_0x3b0387){_0x52675c=_0x52675c-0x0;var _0x345227=_0x91a7[_0x52675c];return _0x345227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5daecd,_0xc92016){_0xc92016=_0xc92016||0xcc;return function(_0x2f2d8d){if(_0x2f2d8d){return _0x5daecd['sendStatus'](_0xc92016);}return _0x5daecd[_0x791a('0x16')](_0xc92016)[_0x791a('0x17')]();};}function respondWithResult(_0x5d5b11,_0x2887f0){_0x2887f0=_0x2887f0||0xc8;return function(_0x31b86d){if(_0x31b86d){return _0x5d5b11[_0x791a('0x16')](_0x2887f0)[_0x791a('0x18')](_0x31b86d);}};}function respondWithFilteredResult(_0x55e845,_0x2ce2e0){return function(_0x575d11){if(_0x575d11){var _0x43dea6=typeof _0x2ce2e0[_0x791a('0x19')]==='undefined'&&typeof _0x2ce2e0[_0x791a('0x1a')]==='undefined';var _0x35fe48=_0x575d11['count'];var _0x4a84ee=_0x43dea6?0x0:_0x2ce2e0['offset'];var _0x40f0d3=_0x43dea6?_0x575d11['count']:_0x2ce2e0['offset']+_0x2ce2e0[_0x791a('0x1a')];var _0x5a702e;if(_0x40f0d3>=_0x35fe48){_0x40f0d3=_0x35fe48;_0x5a702e=0xc8;}else{_0x5a702e=0xce;}_0x55e845[_0x791a('0x16')](_0x5a702e);return _0x55e845[_0x791a('0x1b')]('Content-Range',_0x4a84ee+'-'+_0x40f0d3+'/'+_0x35fe48)[_0x791a('0x18')](_0x575d11);}return null;};}function patchUpdates(_0xcb5e66){return function(_0x234514){try{jsonpatch[_0x791a('0x1c')](_0x234514,_0xcb5e66,!![]);}catch(_0x530e32){return BPromise[_0x791a('0x1d')](_0x530e32);}return _0x234514[_0x791a('0x1e')]();};}function saveUpdates(_0x25bae5,_0x9e17b5){return function(_0x3200dd){if(_0x3200dd){return _0x3200dd[_0x791a('0x1f')](_0x25bae5)[_0x791a('0x20')](function(_0x45a67d){return _0x45a67d;});}return null;};}function removeEntity(_0x323c6a,_0xe8e452){return function(_0x137992){if(_0x137992){return _0x137992['destroy']()[_0x791a('0x20')](function(){_0x323c6a[_0x791a('0x16')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x2966b8,_0x4d748a){return function(_0x456480){if(!_0x456480){_0x2966b8[_0x791a('0x21')](0x194);}return _0x456480;};}function handleError(_0x51dcca,_0xdfa84f){_0xdfa84f=_0xdfa84f||0x1f4;return function(_0x1785f5){logger[_0x791a('0x22')](_0x1785f5['stack']);if(_0x1785f5[_0x791a('0x23')]){delete _0x1785f5[_0x791a('0x23')];}_0x51dcca[_0x791a('0x16')](_0xdfa84f)[_0x791a('0x24')](_0x1785f5);};}exports[_0x791a('0x25')]=function(_0x1a9c6b,_0x628816){var _0x889534={},_0x58bbc0={},_0xbc3436={'count':0x0,'rows':[]};var _0x9e9332=_[_0x791a('0x26')](db['ZendeskAccount'][_0x791a('0x27')],function(_0x5df656){return{'name':_0x5df656[_0x791a('0x28')],'type':_0x5df656[_0x791a('0x29')][_0x791a('0x2a')]};});_0x58bbc0[_0x791a('0x2b')]=_[_0x791a('0x26')](_0x9e9332,_0x791a('0x23'));_0x58bbc0[_0x791a('0x2c')]=_['keys'](_0x1a9c6b[_0x791a('0x2c')]);_0x58bbc0[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x58bbc0[_0x791a('0x2b')],_0x58bbc0[_0x791a('0x2c')]);_0x889534['attributes']=_[_0x791a('0x2e')](_0x58bbc0[_0x791a('0x2b')],qs[_0x791a('0x2f')](_0x1a9c6b[_0x791a('0x2c')][_0x791a('0x2f')]));_0x889534['attributes']=_0x889534[_0x791a('0x30')][_0x791a('0x31')]?_0x889534[_0x791a('0x30')]:_0x58bbc0[_0x791a('0x2b')];if(!_0x1a9c6b[_0x791a('0x2c')]['hasOwnProperty'](_0x791a('0x32'))){_0x889534['limit']=qs[_0x791a('0x1a')](_0x1a9c6b['query']['limit']);_0x889534[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x1a9c6b[_0x791a('0x2c')][_0x791a('0x19')]);}_0x889534[_0x791a('0x33')]=qs[_0x791a('0x34')](_0x1a9c6b[_0x791a('0x2c')]['sort']);_0x889534[_0x791a('0x35')]=qs['filters'](_[_0x791a('0x36')](_0x1a9c6b['query'],_0x58bbc0[_0x791a('0x2d')]),_0x9e9332);if(_0x1a9c6b[_0x791a('0x2c')]['filter']){_0x889534[_0x791a('0x35')]=_[_0x791a('0x37')](_0x889534['where'],{'$or':_[_0x791a('0x26')](_0x9e9332,function(_0x165e2b){if(_0x165e2b[_0x791a('0x29')]!==_0x791a('0x38')){var _0x29d267={};_0x29d267[_0x165e2b[_0x791a('0x23')]]={'$like':'%'+_0x1a9c6b[_0x791a('0x2c')][_0x791a('0x39')]+'%'};return _0x29d267;}})});}_0x889534=_[_0x791a('0x37')]({},_0x889534,_0x1a9c6b[_0x791a('0x3a')]);var _0x587481={'where':_0x889534[_0x791a('0x35')]};return db[_0x791a('0x3b')][_0x791a('0x3c')](_0x587481)['then'](function(_0xf4e2fa){_0xbc3436['count']=_0xf4e2fa;if(_0x1a9c6b['query']['includeAll']){_0x889534[_0x791a('0x3d')]=[{'all':!![]}];}return db[_0x791a('0x3b')]['findAll'](_0x889534);})[_0x791a('0x20')](function(_0x2d1692){_0xbc3436[_0x791a('0x3e')]=_0x2d1692;return _0xbc3436;})[_0x791a('0x20')](respondWithFilteredResult(_0x628816,_0x889534))['catch'](handleError(_0x628816,null));};exports['show']=function(_0x57b9ba,_0x2f0395){var _0x216dd3={'raw':![],'where':{'id':_0x57b9ba[_0x791a('0x3f')]['id']}},_0x4e0191={};_0x4e0191[_0x791a('0x2b')]=_[_0x791a('0x40')](db[_0x791a('0x3b')]['rawAttributes']);_0x4e0191[_0x791a('0x2c')]=_['keys'](_0x57b9ba[_0x791a('0x2c')]);_0x4e0191[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x4e0191[_0x791a('0x2b')],_0x4e0191[_0x791a('0x2c')]);_0x216dd3['attributes']=_[_0x791a('0x2e')](_0x4e0191[_0x791a('0x2b')],qs[_0x791a('0x2f')](_0x57b9ba[_0x791a('0x2c')][_0x791a('0x2f')]));_0x216dd3['attributes']=_0x216dd3[_0x791a('0x30')][_0x791a('0x31')]?_0x216dd3['attributes']:_0x4e0191['model'];if(_0x57b9ba[_0x791a('0x2c')][_0x791a('0x41')]){_0x216dd3[_0x791a('0x3d')]=[{'all':!![]}];}_0x216dd3=_['merge']({},_0x216dd3,_0x57b9ba['options']);return db[_0x791a('0x3b')][_0x791a('0x42')](_0x216dd3)['then'](handleEntityNotFound(_0x2f0395,null))[_0x791a('0x20')](respondWithResult(_0x2f0395,null))[_0x791a('0x43')](handleError(_0x2f0395,null));};exports[_0x791a('0x44')]=function(_0x549980,_0x5a30a6){return db[_0x791a('0x3b')][_0x791a('0x44')](_0x549980[_0x791a('0x45')],{})[_0x791a('0x20')](respondWithResult(_0x5a30a6,0xc9))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x1f')]=function(_0x9f768a,_0x4e6d0d){if(_0x9f768a[_0x791a('0x45')]['id']){delete _0x9f768a['body']['id'];}return db[_0x791a('0x3b')][_0x791a('0x42')]({'where':{'id':_0x9f768a[_0x791a('0x3f')]['id']}})[_0x791a('0x20')](handleEntityNotFound(_0x4e6d0d,null))[_0x791a('0x20')](saveUpdates(_0x9f768a[_0x791a('0x45')],null))[_0x791a('0x20')](respondWithResult(_0x4e6d0d,null))['catch'](handleError(_0x4e6d0d,null));};exports[_0x791a('0x46')]=function(_0x1fd826,_0x4bffa6){return db[_0x791a('0x3b')][_0x791a('0x42')]({'where':{'id':_0x1fd826['params']['id']}})[_0x791a('0x20')](handleEntityNotFound(_0x4bffa6,null))[_0x791a('0x20')](removeEntity(_0x4bffa6,null))[_0x791a('0x43')](handleError(_0x4bffa6,null));};exports[_0x791a('0x47')]=function(_0xd5ec90,_0x4d82eb,_0x4ab42f){var _0x5a616f={};var _0x305033={};var _0x51b556;var _0x4c7555;return db[_0x791a('0x3b')]['findOne']({'where':{'id':_0xd5ec90[_0x791a('0x3f')]['id']}})[_0x791a('0x20')](handleEntityNotFound(_0x4d82eb,null))['then'](function(_0x5166b5){if(_0x5166b5){_0x51b556=_0x5166b5;_0x305033[_0x791a('0x2b')]=_['keys'](db[_0x791a('0x48')][_0x791a('0x27')]);_0x305033[_0x791a('0x2c')]=_['keys'](_0xd5ec90[_0x791a('0x2c')]);_0x305033[_0x791a('0x2d')]=_['intersection'](_0x305033[_0x791a('0x2b')],_0x305033[_0x791a('0x2c')]);_0x5a616f[_0x791a('0x30')]=_[_0x791a('0x2e')](_0x305033[_0x791a('0x2b')],qs[_0x791a('0x2f')](_0xd5ec90['query']['fields']));_0x5a616f[_0x791a('0x30')]=_0x5a616f['attributes'][_0x791a('0x31')]?_0x5a616f[_0x791a('0x30')]:_0x305033[_0x791a('0x2b')];_0x5a616f[_0x791a('0x33')]=qs[_0x791a('0x34')](_0xd5ec90[_0x791a('0x2c')][_0x791a('0x34')]);_0x5a616f['where']=qs[_0x791a('0x2d')](_[_0x791a('0x36')](_0xd5ec90[_0x791a('0x2c')],_0x305033[_0x791a('0x2d')]));if(_0xd5ec90[_0x791a('0x2c')][_0x791a('0x39')]){_0x5a616f[_0x791a('0x35')]=_['merge'](_0x5a616f[_0x791a('0x35')],{'$or':_['map'](_0x5a616f['attributes'],function(_0x1cc240){var _0x3c81e2={};_0x3c81e2[_0x1cc240]={'$like':'%'+_0xd5ec90[_0x791a('0x2c')][_0x791a('0x39')]+'%'};return _0x3c81e2;})});}_0x5a616f=_[_0x791a('0x37')]({},_0x5a616f,_0xd5ec90[_0x791a('0x3a')]);return _0x51b556[_0x791a('0x47')](_0x5a616f);}})[_0x791a('0x20')](function(_0x2bfb66){if(_0x2bfb66){_0x4c7555=_0x2bfb66[_0x791a('0x31')];if(!_0xd5ec90[_0x791a('0x2c')][_0x791a('0x49')](_0x791a('0x32'))){_0x5a616f[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0xd5ec90[_0x791a('0x2c')][_0x791a('0x1a')]);_0x5a616f[_0x791a('0x19')]=qs[_0x791a('0x19')](_0xd5ec90[_0x791a('0x2c')]['offset']);}return _0x51b556[_0x791a('0x47')](_0x5a616f);}})[_0x791a('0x20')](function(_0x380087){if(_0x380087){return _0x380087?{'count':_0x4c7555,'rows':_0x380087}:null;}})[_0x791a('0x20')](respondWithResult(_0x4d82eb,null))[_0x791a('0x43')](handleError(_0x4d82eb,null));};exports['addConfiguration']=function(_0x42ce59,_0x3d24bd,_0x277774){if(_0x42ce59[_0x791a('0x45')]['id']){delete _0x42ce59['body']['id'];}return db[_0x791a('0x3b')]['findOne']({'where':{'id':_0x42ce59['params']['id']}})['then'](handleEntityNotFound(_0x3d24bd,null))['then'](function(_0x22aaf2){if(_0x22aaf2){_0x42ce59[_0x791a('0x45')][_0x791a('0x4a')]=_0x22aaf2['id'];_0x42ce59[_0x791a('0x45')][_0x791a('0x4b')]=integrations[_0x791a('0x4c')](_0x42ce59[_0x791a('0x45')]['channel'],_0x42ce59['body'][_0x791a('0x29')]);_0x42ce59[_0x791a('0x45')]['Descriptions']=integrations['getDescriptions'](_0x42ce59[_0x791a('0x45')][_0x791a('0x4d')],_0x42ce59['body'][_0x791a('0x29')]);return db[_0x791a('0x48')][_0x791a('0x44')](_0x42ce59[_0x791a('0x45')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x791a('0x4e')],'as':_0x791a('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d24bd,null))[_0x791a('0x43')](handleError(_0x3d24bd,null));};exports[_0x791a('0x50')]=function(_0x10b51f,_0x3838c4,_0x565c83){var _0x24efc2='';return db[_0x791a('0x3b')][_0x791a('0x51')]({'where':{'id':_0x10b51f[_0x791a('0x3f')]['id']},'attributes':['id',_0x791a('0x52'),_0x791a('0x53'),_0x791a('0x54'),_0x791a('0x55'),'remoteUri']})['then'](handleEntityNotFound(_0x3838c4,null))['then'](function(_0xf8ac72){if(_0xf8ac72){_0x24efc2=_0xf8ac72[_0x791a('0x56')];var _0x1118a8=_0x24efc2[_0x791a('0x57')](-0x1);if(_0x1118a8==='/'){_0x24efc2=_0x24efc2[_0x791a('0x58')](0x0,_0x24efc2[_0x791a('0x59')](_0x1118a8));}var _0x348e54={'method':_0x791a('0x5a'),'uri':util[_0x791a('0x5b')](_0x791a('0x5c'),_0x24efc2,'ticket_fields'),'json':!![]};switch(_0xf8ac72[_0x791a('0x55')]){case _0x791a('0x53'):_0x348e54['headers']={'Authorization':util[_0x791a('0x5b')](_0x791a('0x5d'),new Buffer(util['format']('%s:%s',_0xf8ac72[_0x791a('0x52')],_0xf8ac72[_0x791a('0x53')]))['toString']('base64'))};break;case _0x791a('0x54'):_0x348e54[_0x791a('0x5e')]={'Authorization':util[_0x791a('0x5b')]('Basic\x20%s',new Buffer(util[_0x791a('0x5b')]('%s/token:%s',_0xf8ac72[_0x791a('0x52')],_0xf8ac72[_0x791a('0x54')]))[_0x791a('0x5f')](_0x791a('0x60')))};break;default:throw new db[(_0x791a('0x61'))][(_0x791a('0x62'))]('Unknown\x20authentication\x20type');}return rp(_0x348e54);}})[_0x791a('0x20')](function(_0x2e666e){if(_0x2e666e){var _0x41d1a5=[_0x791a('0x63'),_0x791a('0x64'),_0x791a('0x65'),_0x791a('0x66')];_[_0x791a('0x67')](_0x2e666e[_0x791a('0x68')],function(_0x203fc5){return _0x41d1a5[_0x791a('0x69')](_0x203fc5[_0x791a('0x29')]);});return{'count':_0x2e666e[_0x791a('0x68')][_0x791a('0x31')],'rows':_[_0x791a('0x26')](_0x2e666e[_0x791a('0x68')],function(_0x3272c0){return{'id':_0x3272c0['id'],'name':_0x3272c0[_0x791a('0x6a')]>0x7?_0x3272c0['title']:_0x3272c0[_0x791a('0x29')],'custom':_0x3272c0[_0x791a('0x6a')]>0x7?!![]:![],'options':_0x3272c0[_0x791a('0x6b')]?_0x3272c0[_0x791a('0x6b')]:_0x3272c0[_0x791a('0x6c')]?_0x3272c0['custom_field_options']:[]};})};}})[_0x791a('0x20')](respondWithResult(_0x3838c4,null))['catch'](function(_0x467d65){var _0x48b8dc=_0x10b51f[_0x791a('0x2c')][_0x791a('0x6d')]?0x1f4:_0x467d65['statusCode']||0x1f4;logger[_0x791a('0x22')](_0x791a('0x6e'),_0x791a('0x50'),_0x48b8dc,JSON['stringify'](_0x467d65));delete _0x467d65[_0x791a('0x23')];if(_0x48b8dc===0x191){_0x48b8dc=0x190;}_0x3838c4['status'](_0x48b8dc)[_0x791a('0x24')](_0x10b51f['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x467d65[_0x791a('0x6f')]}:_0x467d65);});}; \ No newline at end of file +var _0x750a=['crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','error','name','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','substring','lastIndexOf','GET','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','token','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','title','position','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x750a,0x140));var _0xa750=function(_0x4fe684,_0x3b6019){_0x4fe684=_0x4fe684-0x0;var _0x2c1667=_0x750a[_0x4fe684];return _0x2c1667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa750('0x15'));function respondWithStatusCode(_0x1c5657,_0x344c67){_0x344c67=_0x344c67||0xcc;return function(_0x567c51){if(_0x567c51){return _0x1c5657[_0xa750('0x16')](_0x344c67);}return _0x1c5657[_0xa750('0x17')](_0x344c67)[_0xa750('0x18')]();};}function respondWithResult(_0x24e48a,_0xa66181){_0xa66181=_0xa66181||0xc8;return function(_0x339329){if(_0x339329){return _0x24e48a['status'](_0xa66181)[_0xa750('0x19')](_0x339329);}};}function respondWithFilteredResult(_0x8488ea,_0x290d46){return function(_0x49fe3b){if(_0x49fe3b){var _0x337095=typeof _0x290d46[_0xa750('0x1a')]==='undefined'&&typeof _0x290d46['limit']===_0xa750('0x1b');var _0x5b1e6b=_0x49fe3b[_0xa750('0x1c')];var _0x1bde87=_0x337095?0x0:_0x290d46['offset'];var _0x36dcca=_0x337095?_0x49fe3b['count']:_0x290d46['offset']+_0x290d46[_0xa750('0x1d')];var _0x5d0935;if(_0x36dcca>=_0x5b1e6b){_0x36dcca=_0x5b1e6b;_0x5d0935=0xc8;}else{_0x5d0935=0xce;}_0x8488ea[_0xa750('0x17')](_0x5d0935);return _0x8488ea['set'](_0xa750('0x1e'),_0x1bde87+'-'+_0x36dcca+'/'+_0x5b1e6b)['json'](_0x49fe3b);}return null;};}function patchUpdates(_0x3dc7f1){return function(_0x500922){try{jsonpatch[_0xa750('0x1f')](_0x500922,_0x3dc7f1,!![]);}catch(_0x4d1939){return BPromise['reject'](_0x4d1939);}return _0x500922[_0xa750('0x20')]();};}function saveUpdates(_0x52da84,_0x216fbf){return function(_0x5a9d96){if(_0x5a9d96){return _0x5a9d96['update'](_0x52da84)['then'](function(_0x5d758e){return _0x5d758e;});}return null;};}function removeEntity(_0x15d72f,_0x2ec6c4){return function(_0x2c43ef){if(_0x2c43ef){return _0x2c43ef[_0xa750('0x21')]()[_0xa750('0x22')](function(){_0x15d72f[_0xa750('0x17')](0xcc)[_0xa750('0x18')]();});}};}function handleEntityNotFound(_0x7e22ad,_0x3d52b3){return function(_0x94697a){if(!_0x94697a){_0x7e22ad[_0xa750('0x16')](0x194);}return _0x94697a;};}function handleError(_0x27a5eb,_0x31ea63){_0x31ea63=_0x31ea63||0x1f4;return function(_0x3f7d6d){logger[_0xa750('0x23')](_0x3f7d6d['stack']);if(_0x3f7d6d[_0xa750('0x24')]){delete _0x3f7d6d[_0xa750('0x24')];}_0x27a5eb[_0xa750('0x17')](_0x31ea63)['send'](_0x3f7d6d);};}exports[_0xa750('0x25')]=function(_0x6ade2b,_0x3270e3){var _0x1223d2={},_0x579f1c={},_0x297eef={'count':0x0,'rows':[]};var _0x34d5e9=_[_0xa750('0x26')](db[_0xa750('0x27')][_0xa750('0x28')],function(_0x59ab33){return{'name':_0x59ab33[_0xa750('0x29')],'type':_0x59ab33['type'][_0xa750('0x2a')]};});_0x579f1c[_0xa750('0x2b')]=_['map'](_0x34d5e9,_0xa750('0x24'));_0x579f1c[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0x6ade2b[_0xa750('0x2c')]);_0x579f1c[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x579f1c[_0xa750('0x2b')],_0x579f1c[_0xa750('0x2c')]);_0x1223d2['attributes']=_[_0xa750('0x2f')](_0x579f1c['model'],qs[_0xa750('0x30')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x30')]));_0x1223d2[_0xa750('0x31')]=_0x1223d2['attributes'][_0xa750('0x32')]?_0x1223d2[_0xa750('0x31')]:_0x579f1c['model'];if(!_0x6ade2b[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x1223d2[_0xa750('0x1d')]=qs['limit'](_0x6ade2b[_0xa750('0x2c')]['limit']);_0x1223d2['offset']=qs[_0xa750('0x1a')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x1a')]);}_0x1223d2['order']=qs[_0xa750('0x35')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x35')]);_0x1223d2['where']=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x6ade2b[_0xa750('0x2c')],_0x579f1c['filters']),_0x34d5e9);if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x37')]){_0x1223d2[_0xa750('0x38')]=_['merge'](_0x1223d2[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x34d5e9,function(_0x1e579b){if(_0x1e579b[_0xa750('0x39')]!=='VIRTUAL'){var _0x4dc0b8={};_0x4dc0b8[_0x1e579b[_0xa750('0x24')]]={'$like':'%'+_0x6ade2b[_0xa750('0x2c')]['filter']+'%'};return _0x4dc0b8;}})});}_0x1223d2=_[_0xa750('0x3a')]({},_0x1223d2,_0x6ade2b[_0xa750('0x3b')]);var _0x15d35a={'where':_0x1223d2[_0xa750('0x38')]};return db[_0xa750('0x27')]['count'](_0x15d35a)[_0xa750('0x22')](function(_0x2b33e0){_0x297eef[_0xa750('0x1c')]=_0x2b33e0;if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x3c')]){_0x1223d2[_0xa750('0x3d')]=[{'all':!![]}];}return db[_0xa750('0x27')]['findAll'](_0x1223d2);})[_0xa750('0x22')](function(_0x5e9ffb){_0x297eef[_0xa750('0x3e')]=_0x5e9ffb;return _0x297eef;})['then'](respondWithFilteredResult(_0x3270e3,_0x1223d2))[_0xa750('0x3f')](handleError(_0x3270e3,null));};exports[_0xa750('0x40')]=function(_0xf9fd5f,_0x1be24e){var _0x430d60={'raw':![],'where':{'id':_0xf9fd5f[_0xa750('0x41')]['id']}},_0xe27272={};_0xe27272[_0xa750('0x2b')]=_[_0xa750('0x2d')](db[_0xa750('0x27')][_0xa750('0x28')]);_0xe27272[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0xf9fd5f[_0xa750('0x2c')]);_0xe27272[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0xe27272[_0xa750('0x2b')],_0xe27272[_0xa750('0x2c')]);_0x430d60[_0xa750('0x31')]=_[_0xa750('0x2f')](_0xe27272['model'],qs[_0xa750('0x30')](_0xf9fd5f[_0xa750('0x2c')][_0xa750('0x30')]));_0x430d60[_0xa750('0x31')]=_0x430d60[_0xa750('0x31')][_0xa750('0x32')]?_0x430d60[_0xa750('0x31')]:_0xe27272[_0xa750('0x2b')];if(_0xf9fd5f[_0xa750('0x2c')]['includeAll']){_0x430d60[_0xa750('0x3d')]=[{'all':!![]}];}_0x430d60=_[_0xa750('0x3a')]({},_0x430d60,_0xf9fd5f['options']);return db[_0xa750('0x27')][_0xa750('0x42')](_0x430d60)[_0xa750('0x22')](handleEntityNotFound(_0x1be24e,null))[_0xa750('0x22')](respondWithResult(_0x1be24e,null))[_0xa750('0x3f')](handleError(_0x1be24e,null));};exports[_0xa750('0x43')]=function(_0x5e7a95,_0x278c22){return db[_0xa750('0x27')][_0xa750('0x43')](_0x5e7a95['body'],{})[_0xa750('0x22')](respondWithResult(_0x278c22,0xc9))[_0xa750('0x3f')](handleError(_0x278c22,null));};exports['update']=function(_0x93e49f,_0x2397e1){if(_0x93e49f[_0xa750('0x44')]['id']){delete _0x93e49f['body']['id'];}return db[_0xa750('0x27')][_0xa750('0x42')]({'where':{'id':_0x93e49f[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0x2397e1,null))['then'](saveUpdates(_0x93e49f[_0xa750('0x44')],null))[_0xa750('0x22')](respondWithResult(_0x2397e1,null))[_0xa750('0x3f')](handleError(_0x2397e1,null));};exports[_0xa750('0x21')]=function(_0x4ce363,_0x203f2a){return db[_0xa750('0x27')]['find']({'where':{'id':_0x4ce363[_0xa750('0x41')]['id']}})['then'](handleEntityNotFound(_0x203f2a,null))[_0xa750('0x22')](removeEntity(_0x203f2a,null))[_0xa750('0x3f')](handleError(_0x203f2a,null));};exports['getConfigurations']=function(_0x47e93c,_0x58eba1,_0x232da4){var _0x401125={};var _0x4ea12b={};var _0xe88dc;var _0x1a79a9;return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x47e93c['params']['id']}})['then'](handleEntityNotFound(_0x58eba1,null))['then'](function(_0x3c34d4){if(_0x3c34d4){_0xe88dc=_0x3c34d4;_0x4ea12b['model']=_[_0xa750('0x2d')](db[_0xa750('0x45')]['rawAttributes']);_0x4ea12b[_0xa750('0x2c')]=_['keys'](_0x47e93c[_0xa750('0x2c')]);_0x4ea12b['filters']=_['intersection'](_0x4ea12b['model'],_0x4ea12b['query']);_0x401125[_0xa750('0x31')]=_[_0xa750('0x2f')](_0x4ea12b['model'],qs['fields'](_0x47e93c['query'][_0xa750('0x30')]));_0x401125[_0xa750('0x31')]=_0x401125[_0xa750('0x31')][_0xa750('0x32')]?_0x401125[_0xa750('0x31')]:_0x4ea12b[_0xa750('0x2b')];_0x401125['order']=qs['sort'](_0x47e93c[_0xa750('0x2c')][_0xa750('0x35')]);_0x401125[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x47e93c['query'],_0x4ea12b[_0xa750('0x2e')]));if(_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]){_0x401125[_0xa750('0x38')]=_[_0xa750('0x3a')](_0x401125[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x401125[_0xa750('0x31')],function(_0x5e78f1){var _0x2aa1d6={};_0x2aa1d6[_0x5e78f1]={'$like':'%'+_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]+'%'};return _0x2aa1d6;})});}_0x401125=_[_0xa750('0x3a')]({},_0x401125,_0x47e93c[_0xa750('0x3b')]);return _0xe88dc['getConfigurations'](_0x401125);}})[_0xa750('0x22')](function(_0x25248f){if(_0x25248f){_0x1a79a9=_0x25248f[_0xa750('0x32')];if(!_0x47e93c[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x401125[_0xa750('0x1d')]=qs[_0xa750('0x1d')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1d')]);_0x401125[_0xa750('0x1a')]=qs[_0xa750('0x1a')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1a')]);}return _0xe88dc[_0xa750('0x46')](_0x401125);}})[_0xa750('0x22')](function(_0x49e132){if(_0x49e132){return _0x49e132?{'count':_0x1a79a9,'rows':_0x49e132}:null;}})[_0xa750('0x22')](respondWithResult(_0x58eba1,null))['catch'](handleError(_0x58eba1,null));};exports[_0xa750('0x47')]=function(_0x2d488d,_0xbe7451,_0x5845c5){if(_0x2d488d[_0xa750('0x44')]['id']){delete _0x2d488d[_0xa750('0x44')]['id'];}return db[_0xa750('0x27')][_0xa750('0x48')]({'where':{'id':_0x2d488d[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0xbe7451,null))['then'](function(_0x3001d7){if(_0x3001d7){_0x2d488d[_0xa750('0x44')]['AccountId']=_0x3001d7['id'];_0x2d488d[_0xa750('0x44')][_0xa750('0x49')]=integrations[_0xa750('0x4a')](_0x2d488d[_0xa750('0x44')][_0xa750('0x4b')],_0x2d488d[_0xa750('0x44')][_0xa750('0x39')]);_0x2d488d[_0xa750('0x44')][_0xa750('0x4c')]=integrations[_0xa750('0x4d')](_0x2d488d[_0xa750('0x44')]['channel'],_0x2d488d['body'][_0xa750('0x39')]);return db[_0xa750('0x45')][_0xa750('0x43')](_0x2d488d[_0xa750('0x44')],{'include':[{'model':db['ZendeskField'],'as':_0xa750('0x49')},{'model':db[_0xa750('0x4e')],'as':_0xa750('0x4c')}]});}return null;})[_0xa750('0x22')](respondWithResult(_0xbe7451,null))[_0xa750('0x3f')](handleError(_0xbe7451,null));};exports[_0xa750('0x4f')]=function(_0x17b25e,_0x5d883d,_0x1dcc15){var _0x2783b9='';return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x17b25e['params']['id']},'attributes':['id',_0xa750('0x50'),'password','token',_0xa750('0x51'),_0xa750('0x52')]})[_0xa750('0x22')](handleEntityNotFound(_0x5d883d,null))[_0xa750('0x22')](function(_0x292dab){if(_0x292dab){_0x2783b9=_0x292dab['remoteUri'];var _0x3ac9a2=_0x2783b9[_0xa750('0x53')](-0x1);if(_0x3ac9a2==='/'){_0x2783b9=_0x2783b9[_0xa750('0x54')](0x0,_0x2783b9[_0xa750('0x55')](_0x3ac9a2));}var _0x439dce={'method':_0xa750('0x56'),'uri':util['format']('%s/%s',_0x2783b9,_0xa750('0x57')),'json':!![]};switch(_0x292dab[_0xa750('0x51')]){case _0xa750('0x58'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util[_0xa750('0x5a')](_0xa750('0x5c'),_0x292dab['username'],_0x292dab[_0xa750('0x58')]))['toString']('base64'))};break;case _0xa750('0x5d'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util['format'](_0xa750('0x5e'),_0x292dab[_0xa750('0x50')],_0x292dab[_0xa750('0x5d')]))[_0xa750('0x5f')]('base64'))};break;default:throw new db[(_0xa750('0x60'))][(_0xa750('0x61'))](_0xa750('0x62'));}return rp(_0x439dce);}})[_0xa750('0x22')](function(_0x332862){if(_0x332862){var _0x14de1b=[_0xa750('0x63'),_0xa750('0x64'),'group','assignee'];_[_0xa750('0x65')](_0x332862['ticket_fields'],function(_0x2c4114){return _0x14de1b[_0xa750('0x66')](_0x2c4114['type']);});return{'count':_0x332862[_0xa750('0x57')]['length'],'rows':_[_0xa750('0x26')](_0x332862[_0xa750('0x57')],function(_0x77110){return{'id':_0x77110['id'],'name':_0x77110['position']>0x7?_0x77110[_0xa750('0x67')]:_0x77110[_0xa750('0x39')],'custom':_0x77110[_0xa750('0x68')]>0x7?!![]:![],'options':_0x77110[_0xa750('0x69')]?_0x77110['system_field_options']:_0x77110['custom_field_options']?_0x77110['custom_field_options']:[]};})};}})[_0xa750('0x22')](respondWithResult(_0x5d883d,null))[_0xa750('0x3f')](function(_0x5387dc){var _0x12cae9=_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?0x1f4:_0x5387dc[_0xa750('0x6b')]||0x1f4;logger[_0xa750('0x23')](_0xa750('0x6c'),'getFields',_0x12cae9,JSON[_0xa750('0x6d')](_0x5387dc));delete _0x5387dc[_0xa750('0x24')];if(_0x12cae9===0x191){_0x12cae9=0x190;}_0x5d883d[_0xa750('0x17')](_0x12cae9)['send'](_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?{'message':_0xa750('0x6e'),'statusCode':_0x5387dc[_0xa750('0x6b')]}:_0x5387dc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 00cdf23..9366f20 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 _0x2802=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x2802,0xd1));var _0x2280=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x2802[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require('lodash');var util=require(_0x2280('0x0'));var logger=require(_0x2280('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2280('0x2'));var rp=require(_0x2280('0x3'));var fs=require('fs');var path=require(_0x2280('0x4'));var rimraf=require(_0x2280('0x5'));var config=require(_0x2280('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x2280('0x7'));module[_0x2280('0x8')]=function(_0x5a783c,_0x3c21e2){return _0x5a783c[_0x2280('0x9')](_0x2280('0xa'),attributes,{'tableName':_0x2280('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd642=['define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x33492e,_0x2960c3){var _0x22450d=function(_0x3113ac){while(--_0x3113ac){_0x33492e['push'](_0x33492e['shift']());}};_0x22450d(++_0x2960c3);}(_0xd642,0xd3));var _0x2d64=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xd642[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x2d64('0x0'));var util=require('util');var logger=require(_0x2d64('0x1'))(_0x2d64('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d64('0x3'));var fs=require('fs');var path=require(_0x2d64('0x4'));var rimraf=require(_0x2d64('0x5'));var config=require(_0x2d64('0x6'));var attributes=require(_0x2d64('0x7'));var integrations=require(_0x2d64('0x8'));module[_0x2d64('0x9')]=function(_0x12ef80,_0x57606d){return _0x12ef80[_0x2d64('0xa')](_0x2d64('0xb'),attributes,{'tableName':_0x2d64('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 1ce820f..05df639 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 _0x627a=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','lodash'];(function(_0x50f395,_0x86f564){var _0x3d6ac6=function(_0x15f91a){while(--_0x15f91a){_0x50f395['push'](_0x50f395['shift']());}};_0x3d6ac6(++_0x86f564);}(_0x627a,0xae));var _0xa627=function(_0x2ac2eb,_0x252bf8){_0x2ac2eb=_0x2ac2eb-0x0;var _0x2383f7=_0x627a[_0x2ac2eb];return _0x2383f7;};'use strict';var _=require(_0xa627('0x0'));var util=require(_0xa627('0x1'));var moment=require('moment');var BPromise=require(_0xa627('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa627('0x3'));var db=require(_0xa627('0x4'))['db'];var utils=require(_0xa627('0x5'));var logger=require(_0xa627('0x6'))(_0xa627('0x7'));var config=require('../../config/environment');var jayson=require(_0xa627('0x8'));var client=jayson['client'][_0xa627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cc8eb,_0xff1f4d,_0x5184fe){return new BPromise(function(_0x1e1fd0,_0x4fad84){return client[_0xa627('0xa')](_0x1cc8eb,_0x5184fe)[_0xa627('0xb')](function(_0x27fdc9){logger[_0xa627('0xc')](_0xa627('0xd'),_0xff1f4d,_0xa627('0xe'));logger[_0xa627('0xf')](_0xa627('0x10'),_0xff1f4d,_0xa627('0xe'),JSON[_0xa627('0x11')](_0x27fdc9));if(_0x27fdc9[_0xa627('0x12')]){if(_0x27fdc9[_0xa627('0x12')]['code']===0x1f4){logger[_0xa627('0x12')](_0xa627('0xd'),_0xff1f4d,_0x27fdc9['error'][_0xa627('0x13')]);return _0x4fad84(_0x27fdc9[_0xa627('0x12')]['message']);}logger[_0xa627('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0xff1f4d,_0x27fdc9[_0xa627('0x12')][_0xa627('0x13')]);return _0x1e1fd0(_0x27fdc9['error'][_0xa627('0x13')]);}else{logger[_0xa627('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0xff1f4d,'request\x20sent');_0x1e1fd0(_0x27fdc9[_0xa627('0x14')][_0xa627('0x13')]);}})[_0xa627('0x15')](function(_0x478483){logger[_0xa627('0x12')](_0xa627('0xd'),_0xff1f4d,_0x478483);_0x4fad84(_0x478483);});});}exports['GetZendeskAccount']=function(_0x191ab9){var _0x123d94=this;return new Promise(function(_0x38797f,_0x3941ab){return db[_0xa627('0x16')][_0xa627('0x17')]({'raw':_0x191ab9[_0xa627('0x18')]?_0x191ab9[_0xa627('0x18')][_0xa627('0x19')]===undefined?!![]:![]:!![],'where':_0x191ab9[_0xa627('0x18')]?_0x191ab9[_0xa627('0x18')][_0xa627('0x1a')]||null:null,'attributes':_0x191ab9[_0xa627('0x18')]?_0x191ab9['options'][_0xa627('0x1b')]||null:null,'limit':_0x191ab9['options']?_0x191ab9[_0xa627('0x18')][_0xa627('0x1c')]||null:null,'include':_0x191ab9[_0xa627('0x18')]?_0x191ab9[_0xa627('0x18')][_0xa627('0x1d')]?_['map'](_0x191ab9['options'][_0xa627('0x1d')],function(_0x1a1f8b){return{'model':db[_0x1a1f8b['model']],'as':_0x1a1f8b['as'],'attributes':_0x1a1f8b[_0xa627('0x1b')],'include':_0x1a1f8b[_0xa627('0x1d')]?_['map'](_0x1a1f8b[_0xa627('0x1d')],function(_0x48a86d){return{'model':db[_0x48a86d['model']],'as':_0x48a86d['as'],'attributes':_0x48a86d[_0xa627('0x1b')],'include':_0x48a86d[_0xa627('0x1d')]?_[_0xa627('0x1e')](_0x48a86d[_0xa627('0x1d')],function(_0x51eb2f){return{'model':db[_0x51eb2f[_0xa627('0x1f')]],'as':_0x51eb2f['as'],'attributes':_0x51eb2f[_0xa627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa627('0xb')](function(_0x1067a4){logger[_0xa627('0xc')](_0xa627('0x20'),_0x191ab9);logger[_0xa627('0xf')]('GetZendeskAccount',_0x191ab9,JSON[_0xa627('0x11')](_0x1067a4));_0x38797f(_0x1067a4);})[_0xa627('0x15')](function(_0x46bb65){logger[_0xa627('0x12')]('GetZendeskAccount',_0x46bb65[_0xa627('0x13')],_0x191ab9);_0x3941ab(_0x123d94[_0xa627('0x12')](0x1f4,_0x46bb65[_0xa627('0x13')]));});});};exports[_0xa627('0x21')]=function(_0x3f7ca3){var _0x239f58=this;return new Promise(function(_0x162eb2,_0x3a2ea3){return db[_0xa627('0x16')][_0xa627('0x22')]({'raw':_0x3f7ca3[_0xa627('0x18')]?_0x3f7ca3[_0xa627('0x18')][_0xa627('0x19')]===undefined?!![]:![]:!![],'where':_0x3f7ca3[_0xa627('0x18')]?_0x3f7ca3['options']['where']||null:null,'attributes':_0x3f7ca3[_0xa627('0x18')]?_0x3f7ca3[_0xa627('0x18')][_0xa627('0x1b')]||null:null,'include':_0x3f7ca3['options']?_0x3f7ca3[_0xa627('0x18')][_0xa627('0x1d')]?_['map'](_0x3f7ca3['options'][_0xa627('0x1d')],function(_0x5e7518){return{'model':db[_0x5e7518['model']],'as':_0x5e7518['as'],'attributes':_0x5e7518[_0xa627('0x1b')],'include':_0x5e7518['include']?_[_0xa627('0x1e')](_0x5e7518[_0xa627('0x1d')],function(_0x22bb29){return{'model':db[_0x22bb29[_0xa627('0x1f')]],'as':_0x22bb29['as'],'attributes':_0x22bb29['attributes'],'include':_0x22bb29['include']?_['map'](_0x22bb29[_0xa627('0x1d')],function(_0x323600){return{'model':db[_0x323600['model']],'as':_0x323600['as'],'attributes':_0x323600[_0xa627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa627('0xb')](function(_0x429179){logger[_0xa627('0xc')](_0xa627('0x21'),_0x3f7ca3);logger[_0xa627('0xf')](_0xa627('0x21'),_0x3f7ca3,JSON[_0xa627('0x11')](_0x429179));_0x162eb2(_0x429179);})[_0xa627('0x15')](function(_0x3da153){logger[_0xa627('0x12')](_0xa627('0x21'),_0x3da153[_0xa627('0x13')],_0x3f7ca3);_0x3a2ea3(_0x239f58[_0xa627('0x12')](0x1f4,_0x3da153[_0xa627('0x13')]));});});}; \ No newline at end of file +var _0x9362=['ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','request\x20sent','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','find','debug'];(function(_0x4c519d,_0x3cad1d){var _0x4479ce=function(_0x1e1ee8){while(--_0x1e1ee8){_0x4c519d['push'](_0x4c519d['shift']());}};_0x4479ce(++_0x3cad1d);}(_0x9362,0x111));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2936('0x0'));var util=require(_0x2936('0x1'));var moment=require(_0x2936('0x2'));var BPromise=require('bluebird');var rs=require(_0x2936('0x3'));var fs=require('fs');var Redis=require(_0x2936('0x4'));var db=require(_0x2936('0x5'))['db'];var utils=require(_0x2936('0x6'));var logger=require(_0x2936('0x7'))('rpc');var config=require(_0x2936('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2936('0x9')][_0x2936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1d50,_0x42154a,_0x2e89e7){return new BPromise(function(_0x83c45f,_0x21dc79){return client['request'](_0x4e1d50,_0x2e89e7)[_0x2936('0xb')](function(_0x4cea48){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x42154a,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x42154a,_0x2936('0xc'),JSON[_0x2936('0xd')](_0x4cea48));if(_0x4cea48[_0x2936('0xe')]){if(_0x4cea48['error'][_0x2936('0xf')]===0x1f4){logger[_0x2936('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x42154a,_0x4cea48['error'][_0x2936('0x10')]);return _0x21dc79(_0x4cea48['error'][_0x2936('0x10')]);}logger[_0x2936('0xe')](_0x2936('0x11'),_0x42154a,_0x4cea48['error'][_0x2936('0x10')]);return _0x83c45f(_0x4cea48[_0x2936('0xe')][_0x2936('0x10')]);}else{logger[_0x2936('0x12')](_0x2936('0x11'),_0x42154a,_0x2936('0xc'));_0x83c45f(_0x4cea48[_0x2936('0x13')][_0x2936('0x10')]);}})[_0x2936('0x14')](function(_0x348520){logger[_0x2936('0xe')](_0x2936('0x11'),_0x42154a,_0x348520);_0x21dc79(_0x348520);});});}exports[_0x2936('0x15')]=function(_0x931847){var _0xd01740=this;return new Promise(function(_0x279441,_0x384ed1){return db[_0x2936('0x16')][_0x2936('0x17')]({'raw':_0x931847['options']?_0x931847[_0x2936('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x931847[_0x2936('0x18')]?_0x931847[_0x2936('0x18')][_0x2936('0x19')]||null:null,'attributes':_0x931847[_0x2936('0x18')]?_0x931847[_0x2936('0x18')]['attributes']||null:null,'limit':_0x931847[_0x2936('0x18')]?_0x931847[_0x2936('0x18')][_0x2936('0x1a')]||null:null,'include':_0x931847[_0x2936('0x18')]?_0x931847[_0x2936('0x18')][_0x2936('0x1b')]?_[_0x2936('0x1c')](_0x931847[_0x2936('0x18')]['include'],function(_0x3c997c){return{'model':db[_0x3c997c[_0x2936('0x1d')]],'as':_0x3c997c['as'],'attributes':_0x3c997c['attributes'],'include':_0x3c997c[_0x2936('0x1b')]?_[_0x2936('0x1c')](_0x3c997c[_0x2936('0x1b')],function(_0x30c024){return{'model':db[_0x30c024[_0x2936('0x1d')]],'as':_0x30c024['as'],'attributes':_0x30c024['attributes'],'include':_0x30c024['include']?_[_0x2936('0x1c')](_0x30c024[_0x2936('0x1b')],function(_0x4151e6){return{'model':db[_0x4151e6[_0x2936('0x1d')]],'as':_0x4151e6['as'],'attributes':_0x4151e6[_0x2936('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2936('0xb')](function(_0x5e5efa){logger[_0x2936('0x12')]('GetZendeskAccount',_0x931847);logger['debug']('GetZendeskAccount',_0x931847,JSON[_0x2936('0xd')](_0x5e5efa));_0x279441(_0x5e5efa);})['catch'](function(_0xa88ed0){logger[_0x2936('0xe')](_0x2936('0x15'),_0xa88ed0[_0x2936('0x10')],_0x931847);_0x384ed1(_0xd01740['error'](0x1f4,_0xa88ed0['message']));});});};exports['ShowZendeskAccount']=function(_0x11e3e2){var _0x3c16eb=this;return new Promise(function(_0xfcd00c,_0x5e1da1){return db[_0x2936('0x16')][_0x2936('0x1f')]({'raw':_0x11e3e2[_0x2936('0x18')]?_0x11e3e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x11e3e2[_0x2936('0x18')]?_0x11e3e2[_0x2936('0x18')][_0x2936('0x19')]||null:null,'attributes':_0x11e3e2['options']?_0x11e3e2['options'][_0x2936('0x1e')]||null:null,'include':_0x11e3e2[_0x2936('0x18')]?_0x11e3e2[_0x2936('0x18')][_0x2936('0x1b')]?_['map'](_0x11e3e2[_0x2936('0x18')][_0x2936('0x1b')],function(_0x28d4ff){return{'model':db[_0x28d4ff[_0x2936('0x1d')]],'as':_0x28d4ff['as'],'attributes':_0x28d4ff[_0x2936('0x1e')],'include':_0x28d4ff[_0x2936('0x1b')]?_[_0x2936('0x1c')](_0x28d4ff['include'],function(_0x1c716c){return{'model':db[_0x1c716c[_0x2936('0x1d')]],'as':_0x1c716c['as'],'attributes':_0x1c716c['attributes'],'include':_0x1c716c['include']?_[_0x2936('0x1c')](_0x1c716c[_0x2936('0x1b')],function(_0xdfca22){return{'model':db[_0xdfca22[_0x2936('0x1d')]],'as':_0xdfca22['as'],'attributes':_0xdfca22[_0x2936('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a9dde){logger[_0x2936('0x12')]('ShowZendeskAccount',_0x11e3e2);logger[_0x2936('0x20')](_0x2936('0x21'),_0x11e3e2,JSON['stringify'](_0x2a9dde));_0xfcd00c(_0x2a9dde);})[_0x2936('0x14')](function(_0x5b54c6){logger[_0x2936('0xe')](_0x2936('0x21'),_0x5b54c6[_0x2936('0x10')],_0x11e3e2);_0x5e1da1(_0x3c16eb[_0x2936('0xe')](0x1f4,_0x5b54c6['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5c0a4a8..d9d01a5 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x32f845,_0x335cb9){var _0x3c0de4=function(_0x44c308){while(--_0x44c308){_0x32f845['push'](_0x32f845['shift']());}};_0x3c0de4(++_0x335cb9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x2e4481,_0xd520da){var _0x2d29c9=function(_0x1012aa){while(--_0x1012aa){_0x2e4481['push'](_0x2e4481['shift']());}};_0x2d29c9(++_0xd520da);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 51115e0..e3117e9 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 _0x7b76=['STRING','sequelize','exports'];(function(_0x5ef75c,_0xf23664){var _0x5c5309=function(_0x4c4229){while(--_0x4c4229){_0x5ef75c['push'](_0x5ef75c['shift']());}};_0x5c5309(++_0xf23664);}(_0x7b76,0x1cf));var _0x67b7=function(_0x54e5b0,_0x2a0cde){_0x54e5b0=_0x54e5b0-0x0;var _0x32761f=_0x7b76[_0x54e5b0];return _0x32761f;};'use strict';var Sequelize=require(_0x67b7('0x0'));module[_0x67b7('0x1')]={'name':{'type':Sequelize[_0x67b7('0x2')]},'description':{'type':Sequelize[_0x67b7('0x2')]}}; \ No newline at end of file +var _0xf9e9=['exports','STRING','sequelize'];(function(_0x271ab7,_0x288a8c){var _0x3049fa=function(_0x545eb6){while(--_0x545eb6){_0x271ab7['push'](_0x271ab7['shift']());}};_0x3049fa(++_0x288a8c);}(_0xf9e9,0x16a));var _0x9f9e=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xf9e9[_0x836465];return _0x2150ea;};'use strict';var Sequelize=require(_0x9f9e('0x0'));module[_0x9f9e('0x1')]={'name':{'type':Sequelize[_0x9f9e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a488e0f..12b915b 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 _0x1d93=['findOne','ZendeskField','pick','merge','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','update','destroy'];(function(_0x3c0c9e,_0x3ecdee){var _0x5ba5fe=function(_0x1f4a60){while(--_0x1f4a60){_0x3c0c9e['push'](_0x3c0c9e['shift']());}};_0x5ba5fe(++_0x3ecdee);}(_0x1d93,0x10b));var _0x31d9=function(_0x38fcbb,_0xd2b478){_0x38fcbb=_0x38fcbb-0x0;var _0x4bbb75=_0x1d93[_0x38fcbb];return _0x4bbb75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31d9('0x0'));var zipdir=require(_0x31d9('0x1'));var jsonpatch=require(_0x31d9('0x2'));var rp=require(_0x31d9('0x3'));var moment=require(_0x31d9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x31d9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x31d9('0x6'));var fs=require('fs');var fs_extra=require(_0x31d9('0x7'));var _=require(_0x31d9('0x8'));var squel=require('squel');var crypto=require(_0x31d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x31d9('0xa'));var toCsv=require(_0x31d9('0xb'));var querystring=require('querystring');var Papa=require(_0x31d9('0xc'));var Redis=require('ioredis');var authService=require(_0x31d9('0xd'));var qs=require(_0x31d9('0xe'));var as=require(_0x31d9('0xf'));var hardwareService=require(_0x31d9('0x10'));var logger=require(_0x31d9('0x11'))(_0x31d9('0x12'));var utils=require(_0x31d9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x31d9('0x14'))['db'];function respondWithStatusCode(_0x241596,_0x3e89ad){_0x3e89ad=_0x3e89ad||0xcc;return function(_0x18b3a2){if(_0x18b3a2){return _0x241596[_0x31d9('0x15')](_0x3e89ad);}return _0x241596[_0x31d9('0x16')](_0x3e89ad)[_0x31d9('0x17')]();};}function respondWithResult(_0x57bcbf,_0x4887e3){_0x4887e3=_0x4887e3||0xc8;return function(_0x3d2a43){if(_0x3d2a43){return _0x57bcbf[_0x31d9('0x16')](_0x4887e3)[_0x31d9('0x18')](_0x3d2a43);}};}function respondWithFilteredResult(_0x2c8562,_0x1bae1d){return function(_0x5c06e9){if(_0x5c06e9){var _0x5e6881=typeof _0x1bae1d[_0x31d9('0x19')]===_0x31d9('0x1a')&&typeof _0x1bae1d[_0x31d9('0x1b')]===_0x31d9('0x1a');var _0xcb9642=_0x5c06e9[_0x31d9('0x1c')];var _0x45457b=_0x5e6881?0x0:_0x1bae1d[_0x31d9('0x19')];var _0x3d8db6=_0x5e6881?_0x5c06e9[_0x31d9('0x1c')]:_0x1bae1d[_0x31d9('0x19')]+_0x1bae1d['limit'];var _0x107bf6;if(_0x3d8db6>=_0xcb9642){_0x3d8db6=_0xcb9642;_0x107bf6=0xc8;}else{_0x107bf6=0xce;}_0x2c8562['status'](_0x107bf6);return _0x2c8562[_0x31d9('0x1d')](_0x31d9('0x1e'),_0x45457b+'-'+_0x3d8db6+'/'+_0xcb9642)['json'](_0x5c06e9);}return null;};}function patchUpdates(_0x3d7c21){return function(_0x121fac){try{jsonpatch[_0x31d9('0x1f')](_0x121fac,_0x3d7c21,!![]);}catch(_0x5d0913){return BPromise[_0x31d9('0x20')](_0x5d0913);}return _0x121fac[_0x31d9('0x21')]();};}function saveUpdates(_0x545c21,_0x578565){return function(_0x480c3d){if(_0x480c3d){return _0x480c3d['update'](_0x545c21)[_0x31d9('0x22')](function(_0x38ea80){return _0x38ea80;});}return null;};}function removeEntity(_0x5b192e,_0x9ffbad){return function(_0x2dd0d1){if(_0x2dd0d1){return _0x2dd0d1['destroy']()[_0x31d9('0x22')](function(){_0x5b192e[_0x31d9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392c79,_0x37a2bb){return function(_0xec5056){if(!_0xec5056){_0x392c79[_0x31d9('0x15')](0x194);}return _0xec5056;};}function handleError(_0x328a34,_0x5646c1){_0x5646c1=_0x5646c1||0x1f4;return function(_0xa98685){logger[_0x31d9('0x23')](_0xa98685[_0x31d9('0x24')]);if(_0xa98685['name']){delete _0xa98685[_0x31d9('0x25')];}_0x328a34[_0x31d9('0x16')](_0x5646c1)[_0x31d9('0x26')](_0xa98685);};}exports[_0x31d9('0x27')]=function(_0x513444,_0x38f978){var _0x1a497b={},_0x57c161={},_0xcc466e={'count':0x0,'rows':[]};var _0x4f798f=_[_0x31d9('0x28')](db[_0x31d9('0x29')]['rawAttributes'],function(_0x5d2a7f){return{'name':_0x5d2a7f[_0x31d9('0x2a')],'type':_0x5d2a7f[_0x31d9('0x2b')][_0x31d9('0x2c')]};});_0x57c161[_0x31d9('0x2d')]=_[_0x31d9('0x28')](_0x4f798f,'name');_0x57c161[_0x31d9('0x2e')]=_[_0x31d9('0x2f')](_0x513444[_0x31d9('0x2e')]);_0x57c161[_0x31d9('0x30')]=_[_0x31d9('0x31')](_0x57c161[_0x31d9('0x2d')],_0x57c161[_0x31d9('0x2e')]);_0x1a497b[_0x31d9('0x32')]=_['intersection'](_0x57c161[_0x31d9('0x2d')],qs[_0x31d9('0x33')](_0x513444[_0x31d9('0x2e')][_0x31d9('0x33')]));_0x1a497b['attributes']=_0x1a497b[_0x31d9('0x32')][_0x31d9('0x34')]?_0x1a497b[_0x31d9('0x32')]:_0x57c161[_0x31d9('0x2d')];if(!_0x513444[_0x31d9('0x2e')]['hasOwnProperty'](_0x31d9('0x35'))){_0x1a497b['limit']=qs[_0x31d9('0x1b')](_0x513444[_0x31d9('0x2e')][_0x31d9('0x1b')]);_0x1a497b[_0x31d9('0x19')]=qs[_0x31d9('0x19')](_0x513444['query']['offset']);}_0x1a497b[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x513444[_0x31d9('0x2e')][_0x31d9('0x37')]);_0x1a497b[_0x31d9('0x38')]=qs[_0x31d9('0x30')](_['pick'](_0x513444[_0x31d9('0x2e')],_0x57c161[_0x31d9('0x30')]),_0x4f798f);if(_0x513444[_0x31d9('0x2e')][_0x31d9('0x39')]){_0x1a497b[_0x31d9('0x38')]=_['merge'](_0x1a497b[_0x31d9('0x38')],{'$or':_[_0x31d9('0x28')](_0x4f798f,function(_0x2ea2e1){if(_0x2ea2e1[_0x31d9('0x2b')]!==_0x31d9('0x3a')){var _0x502b00={};_0x502b00[_0x2ea2e1[_0x31d9('0x25')]]={'$like':'%'+_0x513444['query'][_0x31d9('0x39')]+'%'};return _0x502b00;}})});}_0x1a497b=_['merge']({},_0x1a497b,_0x513444[_0x31d9('0x3b')]);var _0xc8b424={'where':_0x1a497b[_0x31d9('0x38')]};return db['ZendeskConfiguration'][_0x31d9('0x1c')](_0xc8b424)['then'](function(_0x5cbd03){_0xcc466e['count']=_0x5cbd03;if(_0x513444[_0x31d9('0x2e')][_0x31d9('0x3c')]){_0x1a497b[_0x31d9('0x3d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x31d9('0x3e')](_0x1a497b);})[_0x31d9('0x22')](function(_0x5c1e70){_0xcc466e[_0x31d9('0x3f')]=_0x5c1e70;return _0xcc466e;})[_0x31d9('0x22')](respondWithFilteredResult(_0x38f978,_0x1a497b))['catch'](handleError(_0x38f978,null));};exports[_0x31d9('0x40')]=function(_0x3968f8,_0x4c6c6c){var _0x9d6a96={'raw':![],'where':{'id':_0x3968f8[_0x31d9('0x41')]['id']}},_0x54fd7d={};_0x54fd7d['model']=_[_0x31d9('0x2f')](db['ZendeskConfiguration'][_0x31d9('0x42')]);_0x54fd7d[_0x31d9('0x2e')]=_[_0x31d9('0x2f')](_0x3968f8[_0x31d9('0x2e')]);_0x54fd7d['filters']=_[_0x31d9('0x31')](_0x54fd7d[_0x31d9('0x2d')],_0x54fd7d[_0x31d9('0x2e')]);_0x9d6a96[_0x31d9('0x32')]=_[_0x31d9('0x31')](_0x54fd7d[_0x31d9('0x2d')],qs['fields'](_0x3968f8[_0x31d9('0x2e')][_0x31d9('0x33')]));_0x9d6a96['attributes']=_0x9d6a96[_0x31d9('0x32')][_0x31d9('0x34')]?_0x9d6a96['attributes']:_0x54fd7d[_0x31d9('0x2d')];if(_0x3968f8[_0x31d9('0x2e')]['includeAll']){_0x9d6a96[_0x31d9('0x3d')]=[{'all':!![]}];}_0x9d6a96=_['merge']({},_0x9d6a96,_0x3968f8[_0x31d9('0x3b')]);return db[_0x31d9('0x29')][_0x31d9('0x43')](_0x9d6a96)[_0x31d9('0x22')](handleEntityNotFound(_0x4c6c6c,null))['then'](respondWithResult(_0x4c6c6c,null))[_0x31d9('0x44')](handleError(_0x4c6c6c,null));};exports[_0x31d9('0x45')]=function(_0x4d4fdc,_0x470c85){return db[_0x31d9('0x29')][_0x31d9('0x45')](_0x4d4fdc[_0x31d9('0x46')],{})[_0x31d9('0x22')](respondWithResult(_0x470c85,0xc9))[_0x31d9('0x44')](handleError(_0x470c85,null));};exports[_0x31d9('0x47')]=function(_0x518b75,_0x54dbfa){if(_0x518b75[_0x31d9('0x46')]['id']){delete _0x518b75[_0x31d9('0x46')]['id'];}return db[_0x31d9('0x29')]['find']({'where':{'id':_0x518b75[_0x31d9('0x41')]['id']}})[_0x31d9('0x22')](handleEntityNotFound(_0x54dbfa,null))[_0x31d9('0x22')](saveUpdates(_0x518b75[_0x31d9('0x46')],null))[_0x31d9('0x22')](respondWithResult(_0x54dbfa,null))[_0x31d9('0x44')](handleError(_0x54dbfa,null));};exports[_0x31d9('0x48')]=function(_0x33bcbf,_0x1a4fab){return db[_0x31d9('0x29')][_0x31d9('0x43')]({'where':{'id':_0x33bcbf['params']['id']}})['then'](handleEntityNotFound(_0x1a4fab,null))[_0x31d9('0x22')](removeEntity(_0x1a4fab,null))[_0x31d9('0x44')](handleError(_0x1a4fab,null));};exports['getFields']=function(_0x240a49,_0x512c6f,_0x2491c0){var _0x426c05={};var _0x8c16b7={};var _0x52a6f5;var _0x30b5c7;return db[_0x31d9('0x29')][_0x31d9('0x49')]({'where':{'id':_0x240a49['params']['id']}})[_0x31d9('0x22')](handleEntityNotFound(_0x512c6f,null))[_0x31d9('0x22')](function(_0x496669){if(_0x496669){_0x52a6f5=_0x496669;_0x8c16b7['model']=_[_0x31d9('0x2f')](db[_0x31d9('0x4a')][_0x31d9('0x42')]);_0x8c16b7['query']=_['keys'](_0x240a49[_0x31d9('0x2e')]);_0x8c16b7[_0x31d9('0x30')]=_[_0x31d9('0x31')](_0x8c16b7['model'],_0x8c16b7[_0x31d9('0x2e')]);_0x426c05[_0x31d9('0x32')]=_['intersection'](_0x8c16b7[_0x31d9('0x2d')],qs[_0x31d9('0x33')](_0x240a49['query']['fields']));_0x426c05[_0x31d9('0x32')]=_0x426c05[_0x31d9('0x32')][_0x31d9('0x34')]?_0x426c05[_0x31d9('0x32')]:_0x8c16b7['model'];_0x426c05[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x240a49[_0x31d9('0x2e')]['sort']);_0x426c05[_0x31d9('0x38')]=qs[_0x31d9('0x30')](_[_0x31d9('0x4b')](_0x240a49['query'],_0x8c16b7[_0x31d9('0x30')]));if(_0x240a49[_0x31d9('0x2e')]['filter']){_0x426c05[_0x31d9('0x38')]=_['merge'](_0x426c05[_0x31d9('0x38')],{'$or':_[_0x31d9('0x28')](_0x426c05[_0x31d9('0x32')],function(_0x1f69bf){var _0x2ca8f9={};_0x2ca8f9[_0x1f69bf]={'$like':'%'+_0x240a49[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x2ca8f9;})});}_0x426c05=_[_0x31d9('0x4c')]({},_0x426c05,_0x240a49[_0x31d9('0x3b')]);return _0x52a6f5['getFields'](_0x426c05);}})[_0x31d9('0x22')](function(_0x5457b1){if(_0x5457b1){_0x30b5c7=_0x5457b1[_0x31d9('0x34')];if(!_0x240a49[_0x31d9('0x2e')]['hasOwnProperty'](_0x31d9('0x35'))){_0x426c05[_0x31d9('0x1b')]=qs[_0x31d9('0x1b')](_0x240a49[_0x31d9('0x2e')][_0x31d9('0x1b')]);_0x426c05[_0x31d9('0x19')]=qs['offset'](_0x240a49[_0x31d9('0x2e')]['offset']);}return _0x52a6f5[_0x31d9('0x4d')](_0x426c05);}})['then'](function(_0x496a29){if(_0x496a29){return _0x496a29?{'count':_0x30b5c7,'rows':_0x496a29}:null;}})[_0x31d9('0x22')](respondWithResult(_0x512c6f,null))[_0x31d9('0x44')](handleError(_0x512c6f,null));};exports[_0x31d9('0x4e')]=function(_0x396925,_0x40b819,_0x19fafa){var _0x6dc106={};var _0x44a487={};var _0x38c607;var _0x547985;return db['ZendeskConfiguration'][_0x31d9('0x49')]({'where':{'id':_0x396925[_0x31d9('0x41')]['id']}})[_0x31d9('0x22')](handleEntityNotFound(_0x40b819,null))[_0x31d9('0x22')](function(_0x5b802b){if(_0x5b802b){_0x38c607=_0x5b802b;_0x44a487[_0x31d9('0x2d')]=_['keys'](db[_0x31d9('0x4a')][_0x31d9('0x42')]);_0x44a487['query']=_[_0x31d9('0x2f')](_0x396925[_0x31d9('0x2e')]);_0x44a487[_0x31d9('0x30')]=_[_0x31d9('0x31')](_0x44a487[_0x31d9('0x2d')],_0x44a487['query']);_0x6dc106[_0x31d9('0x32')]=_[_0x31d9('0x31')](_0x44a487[_0x31d9('0x2d')],qs[_0x31d9('0x33')](_0x396925['query'][_0x31d9('0x33')]));_0x6dc106[_0x31d9('0x32')]=_0x6dc106['attributes'][_0x31d9('0x34')]?_0x6dc106[_0x31d9('0x32')]:_0x44a487[_0x31d9('0x2d')];_0x6dc106[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x396925[_0x31d9('0x2e')][_0x31d9('0x37')]);_0x6dc106[_0x31d9('0x38')]=qs[_0x31d9('0x30')](_[_0x31d9('0x4b')](_0x396925[_0x31d9('0x2e')],_0x44a487['filters']));if(_0x396925[_0x31d9('0x2e')]['filter']){_0x6dc106[_0x31d9('0x38')]=_[_0x31d9('0x4c')](_0x6dc106[_0x31d9('0x38')],{'$or':_[_0x31d9('0x28')](_0x6dc106[_0x31d9('0x32')],function(_0x329552){var _0x196645={};_0x196645[_0x329552]={'$like':'%'+_0x396925[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x196645;})});}_0x6dc106=_[_0x31d9('0x4c')]({},_0x6dc106,_0x396925[_0x31d9('0x3b')]);return _0x38c607[_0x31d9('0x4e')](_0x6dc106);}})[_0x31d9('0x22')](function(_0x3a8d3c){if(_0x3a8d3c){_0x547985=_0x3a8d3c[_0x31d9('0x34')];if(!_0x396925[_0x31d9('0x2e')][_0x31d9('0x4f')](_0x31d9('0x35'))){_0x6dc106[_0x31d9('0x1b')]=qs[_0x31d9('0x1b')](_0x396925[_0x31d9('0x2e')]['limit']);_0x6dc106[_0x31d9('0x19')]=qs[_0x31d9('0x19')](_0x396925[_0x31d9('0x2e')][_0x31d9('0x19')]);}return _0x38c607[_0x31d9('0x4e')](_0x6dc106);}})[_0x31d9('0x22')](function(_0x49744f){if(_0x49744f){return _0x49744f?{'count':_0x547985,'rows':_0x49744f}:null;}})[_0x31d9('0x22')](respondWithResult(_0x40b819,null))[_0x31d9('0x44')](handleError(_0x40b819,null));};exports['getDescriptions']=function(_0x3f3646,_0x146cc1,_0x54813a){var _0x333f15={};var _0x460eaa={};var _0x4c56bf;var _0x3e3693;return db['ZendeskConfiguration'][_0x31d9('0x49')]({'where':{'id':_0x3f3646[_0x31d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x146cc1,null))[_0x31d9('0x22')](function(_0x3051bf){if(_0x3051bf){_0x4c56bf=_0x3051bf;_0x460eaa['model']=_[_0x31d9('0x2f')](db[_0x31d9('0x4a')]['rawAttributes']);_0x460eaa['query']=_[_0x31d9('0x2f')](_0x3f3646[_0x31d9('0x2e')]);_0x460eaa['filters']=_[_0x31d9('0x31')](_0x460eaa['model'],_0x460eaa[_0x31d9('0x2e')]);_0x333f15[_0x31d9('0x32')]=_['intersection'](_0x460eaa['model'],qs['fields'](_0x3f3646[_0x31d9('0x2e')][_0x31d9('0x33')]));_0x333f15[_0x31d9('0x32')]=_0x333f15[_0x31d9('0x32')][_0x31d9('0x34')]?_0x333f15[_0x31d9('0x32')]:_0x460eaa[_0x31d9('0x2d')];_0x333f15['order']=qs[_0x31d9('0x37')](_0x3f3646[_0x31d9('0x2e')][_0x31d9('0x37')]);_0x333f15[_0x31d9('0x38')]=qs[_0x31d9('0x30')](_[_0x31d9('0x4b')](_0x3f3646[_0x31d9('0x2e')],_0x460eaa[_0x31d9('0x30')]));if(_0x3f3646['query']['filter']){_0x333f15[_0x31d9('0x38')]=_[_0x31d9('0x4c')](_0x333f15['where'],{'$or':_[_0x31d9('0x28')](_0x333f15[_0x31d9('0x32')],function(_0x26f4b9){var _0x2ac15e={};_0x2ac15e[_0x26f4b9]={'$like':'%'+_0x3f3646[_0x31d9('0x2e')]['filter']+'%'};return _0x2ac15e;})});}_0x333f15=_[_0x31d9('0x4c')]({},_0x333f15,_0x3f3646[_0x31d9('0x3b')]);return _0x4c56bf[_0x31d9('0x50')](_0x333f15);}})['then'](function(_0x3432b2){if(_0x3432b2){_0x3e3693=_0x3432b2[_0x31d9('0x34')];if(!_0x3f3646[_0x31d9('0x2e')][_0x31d9('0x4f')](_0x31d9('0x35'))){_0x333f15[_0x31d9('0x1b')]=qs[_0x31d9('0x1b')](_0x3f3646['query']['limit']);_0x333f15[_0x31d9('0x19')]=qs[_0x31d9('0x19')](_0x3f3646[_0x31d9('0x2e')][_0x31d9('0x19')]);}return _0x4c56bf['getDescriptions'](_0x333f15);}})[_0x31d9('0x22')](function(_0x46fae3){if(_0x46fae3){return _0x46fae3?{'count':_0x3e3693,'rows':_0x46fae3}:null;}})['then'](respondWithResult(_0x146cc1,null))[_0x31d9('0x44')](handleError(_0x146cc1,null));};exports[_0x31d9('0x51')]=function(_0x3526a9,_0x161b81,_0x33f4c4){var _0x3c2b6b={};var _0x39a14b={};var _0x672d6c;var _0xfbc451;return db[_0x31d9('0x29')][_0x31d9('0x49')]({'where':{'id':_0x3526a9[_0x31d9('0x41')]['id']}})[_0x31d9('0x22')](handleEntityNotFound(_0x161b81,null))[_0x31d9('0x22')](function(_0x2bd964){if(_0x2bd964){_0x672d6c=_0x2bd964;_0x39a14b[_0x31d9('0x2d')]=_[_0x31d9('0x2f')](db[_0x31d9('0x52')][_0x31d9('0x42')]);_0x39a14b[_0x31d9('0x2e')]=_['keys'](_0x3526a9['query']);_0x39a14b[_0x31d9('0x30')]=_[_0x31d9('0x31')](_0x39a14b[_0x31d9('0x2d')],_0x39a14b[_0x31d9('0x2e')]);_0x3c2b6b['attributes']=_['intersection'](_0x39a14b[_0x31d9('0x2d')],qs[_0x31d9('0x33')](_0x3526a9['query']['fields']));_0x3c2b6b['attributes']=_0x3c2b6b[_0x31d9('0x32')]['length']?_0x3c2b6b['attributes']:_0x39a14b[_0x31d9('0x2d')];_0x3c2b6b[_0x31d9('0x36')]=qs[_0x31d9('0x37')](_0x3526a9[_0x31d9('0x2e')]['sort']);_0x3c2b6b[_0x31d9('0x38')]=qs[_0x31d9('0x30')](_[_0x31d9('0x4b')](_0x3526a9[_0x31d9('0x2e')],_0x39a14b[_0x31d9('0x30')]));if(_0x3526a9['query'][_0x31d9('0x39')]){_0x3c2b6b[_0x31d9('0x38')]=_['merge'](_0x3c2b6b[_0x31d9('0x38')],{'$or':_[_0x31d9('0x28')](_0x3c2b6b['attributes'],function(_0x4c5ac5){var _0x28f5fe={};_0x28f5fe[_0x4c5ac5]={'$like':'%'+_0x3526a9[_0x31d9('0x2e')][_0x31d9('0x39')]+'%'};return _0x28f5fe;})});}_0x3c2b6b=_['merge']({},_0x3c2b6b,_0x3526a9[_0x31d9('0x3b')]);return _0x672d6c[_0x31d9('0x51')](_0x3c2b6b);}})[_0x31d9('0x22')](function(_0x51927b){if(_0x51927b){_0xfbc451=_0x51927b[_0x31d9('0x34')];if(!_0x3526a9['query'][_0x31d9('0x4f')](_0x31d9('0x35'))){_0x3c2b6b['limit']=qs[_0x31d9('0x1b')](_0x3526a9[_0x31d9('0x2e')][_0x31d9('0x1b')]);_0x3c2b6b[_0x31d9('0x19')]=qs[_0x31d9('0x19')](_0x3526a9[_0x31d9('0x2e')]['offset']);}return _0x672d6c[_0x31d9('0x51')](_0x3c2b6b);}})[_0x31d9('0x22')](function(_0x4d3e19){if(_0x4d3e19){return _0x4d3e19?{'count':_0xfbc451,'rows':_0x4d3e19}:null;}})[_0x31d9('0x22')](respondWithResult(_0x161b81,null))['catch'](handleError(_0x161b81,null));};exports[_0x31d9('0x53')]=function(_0x1f1853,_0x731202,_0x2bafaa){if(_0x1f1853[_0x31d9('0x46')]['id']){delete _0x1f1853[_0x31d9('0x46')]['id'];}return db['ZendeskConfiguration'][_0x31d9('0x49')]({'where':{'id':_0x1f1853['params']['id']}})['then'](handleEntityNotFound(_0x731202,null))['then'](function(_0x143dde){if(_0x143dde){return _0x143dde[_0x31d9('0x53')](_0x1f1853[_0x31d9('0x46')][_0x31d9('0x54')]||[]);}return null;})[_0x31d9('0x22')](respondWithResult(_0x731202,null))[_0x31d9('0x44')](handleError(_0x731202,null));}; \ No newline at end of file +var _0xc101=['undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','create','body','find','params','getFields','findOne','ZendeskField','pick','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x8ac7b2,_0xd52277){var _0x555250=function(_0x1789f6){while(--_0x1789f6){_0x8ac7b2['push'](_0x8ac7b2['shift']());}};_0x555250(++_0xd52277);}(_0xc101,0xe3));var _0x1c10=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0xc101[_0x18546c];return _0x46ef43;};'use strict';var emlformat=require(_0x1c10('0x0'));var rimraf=require(_0x1c10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c10('0x2'));var rp=require(_0x1c10('0x3'));var moment=require(_0x1c10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1c10('0x5'));var util=require(_0x1c10('0x6'));var path=require(_0x1c10('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1c10('0x8'));var fs=require('fs');var fs_extra=require(_0x1c10('0x9'));var _=require(_0x1c10('0xa'));var squel=require(_0x1c10('0xb'));var crypto=require(_0x1c10('0xc'));var jsforce=require(_0x1c10('0xd'));var deskjs=require(_0x1c10('0xe'));var toCsv=require(_0x1c10('0xf'));var querystring=require(_0x1c10('0x10'));var Papa=require(_0x1c10('0x11'));var Redis=require(_0x1c10('0x12'));var authService=require(_0x1c10('0x13'));var qs=require(_0x1c10('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c10('0x15'))('api');var utils=require(_0x1c10('0x16'));var config=require(_0x1c10('0x17'));var licenseUtil=require(_0x1c10('0x18'));var db=require(_0x1c10('0x19'))['db'];function respondWithStatusCode(_0xfb478d,_0x1c3654){_0x1c3654=_0x1c3654||0xcc;return function(_0x15a916){if(_0x15a916){return _0xfb478d['sendStatus'](_0x1c3654);}return _0xfb478d[_0x1c10('0x1a')](_0x1c3654)[_0x1c10('0x1b')]();};}function respondWithResult(_0x48494d,_0x51dfda){_0x51dfda=_0x51dfda||0xc8;return function(_0x292d13){if(_0x292d13){return _0x48494d['status'](_0x51dfda)['json'](_0x292d13);}};}function respondWithFilteredResult(_0x38f975,_0x36c21b){return function(_0x4108d8){if(_0x4108d8){var _0x1dc19b=typeof _0x36c21b['offset']===_0x1c10('0x1c')&&typeof _0x36c21b['limit']===_0x1c10('0x1c');var _0x14b484=_0x4108d8[_0x1c10('0x1d')];var _0xc8d6eb=_0x1dc19b?0x0:_0x36c21b[_0x1c10('0x1e')];var _0x95cd9a=_0x1dc19b?_0x4108d8[_0x1c10('0x1d')]:_0x36c21b[_0x1c10('0x1e')]+_0x36c21b[_0x1c10('0x1f')];var _0x2f1fb6;if(_0x95cd9a>=_0x14b484){_0x95cd9a=_0x14b484;_0x2f1fb6=0xc8;}else{_0x2f1fb6=0xce;}_0x38f975['status'](_0x2f1fb6);return _0x38f975['set'](_0x1c10('0x20'),_0xc8d6eb+'-'+_0x95cd9a+'/'+_0x14b484)[_0x1c10('0x21')](_0x4108d8);}return null;};}function patchUpdates(_0x2e688c){return function(_0x129ebf){try{jsonpatch[_0x1c10('0x22')](_0x129ebf,_0x2e688c,!![]);}catch(_0x2ccde9){return BPromise[_0x1c10('0x23')](_0x2ccde9);}return _0x129ebf[_0x1c10('0x24')]();};}function saveUpdates(_0x3bbd1a,_0x586d74){return function(_0x554267){if(_0x554267){return _0x554267[_0x1c10('0x25')](_0x3bbd1a)[_0x1c10('0x26')](function(_0x4dbf17){return _0x4dbf17;});}return null;};}function removeEntity(_0x45f037,_0x455840){return function(_0x2126a0){if(_0x2126a0){return _0x2126a0['destroy']()[_0x1c10('0x26')](function(){_0x45f037[_0x1c10('0x1a')](0xcc)[_0x1c10('0x1b')]();});}};}function handleEntityNotFound(_0x310f10,_0x187044){return function(_0x2128ee){if(!_0x2128ee){_0x310f10[_0x1c10('0x27')](0x194);}return _0x2128ee;};}function handleError(_0x25e281,_0x5b34f8){_0x5b34f8=_0x5b34f8||0x1f4;return function(_0x2978c9){logger[_0x1c10('0x28')](_0x2978c9['stack']);if(_0x2978c9[_0x1c10('0x29')]){delete _0x2978c9['name'];}_0x25e281[_0x1c10('0x1a')](_0x5b34f8)['send'](_0x2978c9);};}exports[_0x1c10('0x2a')]=function(_0x2f639b,_0x2cbe25){var _0x47bc39={},_0x1481a4={},_0x3576e1={'count':0x0,'rows':[]};var _0x2aa844=_[_0x1c10('0x2b')](db[_0x1c10('0x2c')][_0x1c10('0x2d')],function(_0x2dbd33){return{'name':_0x2dbd33[_0x1c10('0x2e')],'type':_0x2dbd33[_0x1c10('0x2f')][_0x1c10('0x30')]};});_0x1481a4[_0x1c10('0x31')]=_['map'](_0x2aa844,_0x1c10('0x29'));_0x1481a4[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x2f639b[_0x1c10('0x32')]);_0x1481a4[_0x1c10('0x34')]=_[_0x1c10('0x35')](_0x1481a4[_0x1c10('0x31')],_0x1481a4[_0x1c10('0x32')]);_0x47bc39[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x1481a4[_0x1c10('0x31')],qs[_0x1c10('0x37')](_0x2f639b[_0x1c10('0x32')][_0x1c10('0x37')]));_0x47bc39[_0x1c10('0x36')]=_0x47bc39[_0x1c10('0x36')]['length']?_0x47bc39['attributes']:_0x1481a4[_0x1c10('0x31')];if(!_0x2f639b[_0x1c10('0x32')][_0x1c10('0x38')](_0x1c10('0x39'))){_0x47bc39[_0x1c10('0x1f')]=qs[_0x1c10('0x1f')](_0x2f639b['query'][_0x1c10('0x1f')]);_0x47bc39[_0x1c10('0x1e')]=qs['offset'](_0x2f639b['query'][_0x1c10('0x1e')]);}_0x47bc39['order']=qs[_0x1c10('0x3a')](_0x2f639b[_0x1c10('0x32')]['sort']);_0x47bc39[_0x1c10('0x3b')]=qs[_0x1c10('0x34')](_['pick'](_0x2f639b[_0x1c10('0x32')],_0x1481a4['filters']),_0x2aa844);if(_0x2f639b['query'][_0x1c10('0x3c')]){_0x47bc39[_0x1c10('0x3b')]=_[_0x1c10('0x3d')](_0x47bc39[_0x1c10('0x3b')],{'$or':_[_0x1c10('0x2b')](_0x2aa844,function(_0x1174af){if(_0x1174af['type']!==_0x1c10('0x3e')){var _0x5c6715={};_0x5c6715[_0x1174af[_0x1c10('0x29')]]={'$like':'%'+_0x2f639b['query'][_0x1c10('0x3c')]+'%'};return _0x5c6715;}})});}_0x47bc39=_[_0x1c10('0x3d')]({},_0x47bc39,_0x2f639b[_0x1c10('0x3f')]);var _0x1b0562={'where':_0x47bc39[_0x1c10('0x3b')]};return db[_0x1c10('0x2c')][_0x1c10('0x1d')](_0x1b0562)[_0x1c10('0x26')](function(_0x31470c){_0x3576e1['count']=_0x31470c;if(_0x2f639b[_0x1c10('0x32')]['includeAll']){_0x47bc39[_0x1c10('0x40')]=[{'all':!![]}];}return db[_0x1c10('0x2c')][_0x1c10('0x41')](_0x47bc39);})[_0x1c10('0x26')](function(_0x1ac5b7){_0x3576e1['rows']=_0x1ac5b7;return _0x3576e1;})[_0x1c10('0x26')](respondWithFilteredResult(_0x2cbe25,_0x47bc39))[_0x1c10('0x42')](handleError(_0x2cbe25,null));};exports[_0x1c10('0x43')]=function(_0x359cf7,_0x22fd52){var _0x501f36={'raw':![],'where':{'id':_0x359cf7['params']['id']}},_0x39c23c={};_0x39c23c[_0x1c10('0x31')]=_[_0x1c10('0x33')](db['ZendeskConfiguration'][_0x1c10('0x2d')]);_0x39c23c[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x359cf7['query']);_0x39c23c[_0x1c10('0x34')]=_[_0x1c10('0x35')](_0x39c23c[_0x1c10('0x31')],_0x39c23c[_0x1c10('0x32')]);_0x501f36[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x39c23c['model'],qs['fields'](_0x359cf7[_0x1c10('0x32')][_0x1c10('0x37')]));_0x501f36[_0x1c10('0x36')]=_0x501f36[_0x1c10('0x36')][_0x1c10('0x44')]?_0x501f36['attributes']:_0x39c23c['model'];if(_0x359cf7[_0x1c10('0x32')][_0x1c10('0x45')]){_0x501f36[_0x1c10('0x40')]=[{'all':!![]}];}_0x501f36=_['merge']({},_0x501f36,_0x359cf7[_0x1c10('0x3f')]);return db[_0x1c10('0x2c')]['find'](_0x501f36)[_0x1c10('0x26')](handleEntityNotFound(_0x22fd52,null))[_0x1c10('0x26')](respondWithResult(_0x22fd52,null))['catch'](handleError(_0x22fd52,null));};exports[_0x1c10('0x46')]=function(_0xef1a6a,_0x5cf4f3){return db[_0x1c10('0x2c')]['create'](_0xef1a6a[_0x1c10('0x47')],{})['then'](respondWithResult(_0x5cf4f3,0xc9))[_0x1c10('0x42')](handleError(_0x5cf4f3,null));};exports['update']=function(_0x58aeef,_0x1abc12){if(_0x58aeef[_0x1c10('0x47')]['id']){delete _0x58aeef[_0x1c10('0x47')]['id'];}return db['ZendeskConfiguration'][_0x1c10('0x48')]({'where':{'id':_0x58aeef[_0x1c10('0x49')]['id']}})[_0x1c10('0x26')](handleEntityNotFound(_0x1abc12,null))['then'](saveUpdates(_0x58aeef[_0x1c10('0x47')],null))['then'](respondWithResult(_0x1abc12,null))['catch'](handleError(_0x1abc12,null));};exports['destroy']=function(_0x4bd765,_0x21f436){return db[_0x1c10('0x2c')][_0x1c10('0x48')]({'where':{'id':_0x4bd765['params']['id']}})[_0x1c10('0x26')](handleEntityNotFound(_0x21f436,null))['then'](removeEntity(_0x21f436,null))[_0x1c10('0x42')](handleError(_0x21f436,null));};exports[_0x1c10('0x4a')]=function(_0x2498cf,_0x40f44,_0x2b07c4){var _0x3086ce={};var _0x4958be={};var _0x56d478;var _0x95a089;return db[_0x1c10('0x2c')][_0x1c10('0x4b')]({'where':{'id':_0x2498cf['params']['id']}})['then'](handleEntityNotFound(_0x40f44,null))[_0x1c10('0x26')](function(_0x3d693b){if(_0x3d693b){_0x56d478=_0x3d693b;_0x4958be[_0x1c10('0x31')]=_[_0x1c10('0x33')](db[_0x1c10('0x4c')][_0x1c10('0x2d')]);_0x4958be[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x2498cf[_0x1c10('0x32')]);_0x4958be[_0x1c10('0x34')]=_[_0x1c10('0x35')](_0x4958be[_0x1c10('0x31')],_0x4958be['query']);_0x3086ce[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x4958be[_0x1c10('0x31')],qs[_0x1c10('0x37')](_0x2498cf[_0x1c10('0x32')][_0x1c10('0x37')]));_0x3086ce[_0x1c10('0x36')]=_0x3086ce[_0x1c10('0x36')][_0x1c10('0x44')]?_0x3086ce[_0x1c10('0x36')]:_0x4958be['model'];_0x3086ce['order']=qs[_0x1c10('0x3a')](_0x2498cf[_0x1c10('0x32')][_0x1c10('0x3a')]);_0x3086ce['where']=qs[_0x1c10('0x34')](_[_0x1c10('0x4d')](_0x2498cf[_0x1c10('0x32')],_0x4958be[_0x1c10('0x34')]));if(_0x2498cf['query']['filter']){_0x3086ce['where']=_[_0x1c10('0x3d')](_0x3086ce[_0x1c10('0x3b')],{'$or':_['map'](_0x3086ce[_0x1c10('0x36')],function(_0x25c644){var _0x1da460={};_0x1da460[_0x25c644]={'$like':'%'+_0x2498cf[_0x1c10('0x32')][_0x1c10('0x3c')]+'%'};return _0x1da460;})});}_0x3086ce=_[_0x1c10('0x3d')]({},_0x3086ce,_0x2498cf[_0x1c10('0x3f')]);return _0x56d478[_0x1c10('0x4a')](_0x3086ce);}})['then'](function(_0x585985){if(_0x585985){_0x95a089=_0x585985[_0x1c10('0x44')];if(!_0x2498cf[_0x1c10('0x32')][_0x1c10('0x38')](_0x1c10('0x39'))){_0x3086ce[_0x1c10('0x1f')]=qs['limit'](_0x2498cf[_0x1c10('0x32')][_0x1c10('0x1f')]);_0x3086ce[_0x1c10('0x1e')]=qs['offset'](_0x2498cf[_0x1c10('0x32')][_0x1c10('0x1e')]);}return _0x56d478[_0x1c10('0x4a')](_0x3086ce);}})[_0x1c10('0x26')](function(_0x5444f4){if(_0x5444f4){return _0x5444f4?{'count':_0x95a089,'rows':_0x5444f4}:null;}})[_0x1c10('0x26')](respondWithResult(_0x40f44,null))[_0x1c10('0x42')](handleError(_0x40f44,null));};exports[_0x1c10('0x4e')]=function(_0x2cd8b2,_0x244162,_0x242a49){var _0x3c49f1={};var _0x389961={};var _0x28abc;var _0x108be2;return db[_0x1c10('0x2c')][_0x1c10('0x4b')]({'where':{'id':_0x2cd8b2[_0x1c10('0x49')]['id']}})[_0x1c10('0x26')](handleEntityNotFound(_0x244162,null))[_0x1c10('0x26')](function(_0x51ddc3){if(_0x51ddc3){_0x28abc=_0x51ddc3;_0x389961['model']=_['keys'](db[_0x1c10('0x4c')][_0x1c10('0x2d')]);_0x389961[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x2cd8b2[_0x1c10('0x32')]);_0x389961[_0x1c10('0x34')]=_[_0x1c10('0x35')](_0x389961['model'],_0x389961[_0x1c10('0x32')]);_0x3c49f1[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x389961[_0x1c10('0x31')],qs[_0x1c10('0x37')](_0x2cd8b2[_0x1c10('0x32')][_0x1c10('0x37')]));_0x3c49f1[_0x1c10('0x36')]=_0x3c49f1[_0x1c10('0x36')]['length']?_0x3c49f1[_0x1c10('0x36')]:_0x389961[_0x1c10('0x31')];_0x3c49f1[_0x1c10('0x4f')]=qs[_0x1c10('0x3a')](_0x2cd8b2[_0x1c10('0x32')]['sort']);_0x3c49f1[_0x1c10('0x3b')]=qs[_0x1c10('0x34')](_[_0x1c10('0x4d')](_0x2cd8b2[_0x1c10('0x32')],_0x389961[_0x1c10('0x34')]));if(_0x2cd8b2[_0x1c10('0x32')]['filter']){_0x3c49f1[_0x1c10('0x3b')]=_['merge'](_0x3c49f1[_0x1c10('0x3b')],{'$or':_[_0x1c10('0x2b')](_0x3c49f1[_0x1c10('0x36')],function(_0x39f077){var _0x239ee5={};_0x239ee5[_0x39f077]={'$like':'%'+_0x2cd8b2[_0x1c10('0x32')][_0x1c10('0x3c')]+'%'};return _0x239ee5;})});}_0x3c49f1=_['merge']({},_0x3c49f1,_0x2cd8b2[_0x1c10('0x3f')]);return _0x28abc[_0x1c10('0x4e')](_0x3c49f1);}})[_0x1c10('0x26')](function(_0xef8d75){if(_0xef8d75){_0x108be2=_0xef8d75[_0x1c10('0x44')];if(!_0x2cd8b2[_0x1c10('0x32')]['hasOwnProperty'](_0x1c10('0x39'))){_0x3c49f1[_0x1c10('0x1f')]=qs['limit'](_0x2cd8b2[_0x1c10('0x32')][_0x1c10('0x1f')]);_0x3c49f1[_0x1c10('0x1e')]=qs[_0x1c10('0x1e')](_0x2cd8b2['query']['offset']);}return _0x28abc[_0x1c10('0x4e')](_0x3c49f1);}})['then'](function(_0x30fb3e){if(_0x30fb3e){return _0x30fb3e?{'count':_0x108be2,'rows':_0x30fb3e}:null;}})[_0x1c10('0x26')](respondWithResult(_0x244162,null))[_0x1c10('0x42')](handleError(_0x244162,null));};exports[_0x1c10('0x50')]=function(_0x4059a3,_0x1b124b,_0x29dacf){var _0x18a977={};var _0x19517b={};var _0x3457e3;var _0x3ce0bb;return db[_0x1c10('0x2c')]['findOne']({'where':{'id':_0x4059a3[_0x1c10('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b124b,null))[_0x1c10('0x26')](function(_0x2d8b1d){if(_0x2d8b1d){_0x3457e3=_0x2d8b1d;_0x19517b[_0x1c10('0x31')]=_[_0x1c10('0x33')](db[_0x1c10('0x4c')][_0x1c10('0x2d')]);_0x19517b[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x4059a3[_0x1c10('0x32')]);_0x19517b['filters']=_[_0x1c10('0x35')](_0x19517b[_0x1c10('0x31')],_0x19517b['query']);_0x18a977[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x19517b[_0x1c10('0x31')],qs[_0x1c10('0x37')](_0x4059a3[_0x1c10('0x32')]['fields']));_0x18a977[_0x1c10('0x36')]=_0x18a977[_0x1c10('0x36')][_0x1c10('0x44')]?_0x18a977[_0x1c10('0x36')]:_0x19517b[_0x1c10('0x31')];_0x18a977[_0x1c10('0x4f')]=qs['sort'](_0x4059a3['query'][_0x1c10('0x3a')]);_0x18a977[_0x1c10('0x3b')]=qs[_0x1c10('0x34')](_[_0x1c10('0x4d')](_0x4059a3[_0x1c10('0x32')],_0x19517b[_0x1c10('0x34')]));if(_0x4059a3['query'][_0x1c10('0x3c')]){_0x18a977[_0x1c10('0x3b')]=_[_0x1c10('0x3d')](_0x18a977['where'],{'$or':_['map'](_0x18a977['attributes'],function(_0x4bdd44){var _0x243de9={};_0x243de9[_0x4bdd44]={'$like':'%'+_0x4059a3[_0x1c10('0x32')][_0x1c10('0x3c')]+'%'};return _0x243de9;})});}_0x18a977=_[_0x1c10('0x3d')]({},_0x18a977,_0x4059a3[_0x1c10('0x3f')]);return _0x3457e3['getDescriptions'](_0x18a977);}})[_0x1c10('0x26')](function(_0x2c7585){if(_0x2c7585){_0x3ce0bb=_0x2c7585[_0x1c10('0x44')];if(!_0x4059a3[_0x1c10('0x32')][_0x1c10('0x38')]('nolimit')){_0x18a977[_0x1c10('0x1f')]=qs[_0x1c10('0x1f')](_0x4059a3['query']['limit']);_0x18a977[_0x1c10('0x1e')]=qs[_0x1c10('0x1e')](_0x4059a3['query'][_0x1c10('0x1e')]);}return _0x3457e3[_0x1c10('0x50')](_0x18a977);}})[_0x1c10('0x26')](function(_0x1350ad){if(_0x1350ad){return _0x1350ad?{'count':_0x3ce0bb,'rows':_0x1350ad}:null;}})['then'](respondWithResult(_0x1b124b,null))[_0x1c10('0x42')](handleError(_0x1b124b,null));};exports[_0x1c10('0x51')]=function(_0x183615,_0x2f22fa,_0x3710af){var _0x4f4290={};var _0x2122e8={};var _0x19e394;var _0x578ee9;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x183615[_0x1c10('0x49')]['id']}})[_0x1c10('0x26')](handleEntityNotFound(_0x2f22fa,null))[_0x1c10('0x26')](function(_0x4c1e19){if(_0x4c1e19){_0x19e394=_0x4c1e19;_0x2122e8[_0x1c10('0x31')]=_[_0x1c10('0x33')](db[_0x1c10('0x52')][_0x1c10('0x2d')]);_0x2122e8[_0x1c10('0x32')]=_[_0x1c10('0x33')](_0x183615[_0x1c10('0x32')]);_0x2122e8[_0x1c10('0x34')]=_[_0x1c10('0x35')](_0x2122e8[_0x1c10('0x31')],_0x2122e8[_0x1c10('0x32')]);_0x4f4290[_0x1c10('0x36')]=_[_0x1c10('0x35')](_0x2122e8[_0x1c10('0x31')],qs[_0x1c10('0x37')](_0x183615['query'][_0x1c10('0x37')]));_0x4f4290[_0x1c10('0x36')]=_0x4f4290[_0x1c10('0x36')][_0x1c10('0x44')]?_0x4f4290['attributes']:_0x2122e8['model'];_0x4f4290[_0x1c10('0x4f')]=qs[_0x1c10('0x3a')](_0x183615['query'][_0x1c10('0x3a')]);_0x4f4290['where']=qs[_0x1c10('0x34')](_['pick'](_0x183615[_0x1c10('0x32')],_0x2122e8[_0x1c10('0x34')]));if(_0x183615[_0x1c10('0x32')][_0x1c10('0x3c')]){_0x4f4290[_0x1c10('0x3b')]=_['merge'](_0x4f4290['where'],{'$or':_[_0x1c10('0x2b')](_0x4f4290[_0x1c10('0x36')],function(_0x53fc89){var _0x5b99fb={};_0x5b99fb[_0x53fc89]={'$like':'%'+_0x183615[_0x1c10('0x32')]['filter']+'%'};return _0x5b99fb;})});}_0x4f4290=_[_0x1c10('0x3d')]({},_0x4f4290,_0x183615[_0x1c10('0x3f')]);return _0x19e394[_0x1c10('0x51')](_0x4f4290);}})[_0x1c10('0x26')](function(_0x4063d4){if(_0x4063d4){_0x578ee9=_0x4063d4[_0x1c10('0x44')];if(!_0x183615[_0x1c10('0x32')][_0x1c10('0x38')](_0x1c10('0x39'))){_0x4f4290[_0x1c10('0x1f')]=qs['limit'](_0x183615['query'][_0x1c10('0x1f')]);_0x4f4290[_0x1c10('0x1e')]=qs[_0x1c10('0x1e')](_0x183615[_0x1c10('0x32')][_0x1c10('0x1e')]);}return _0x19e394['getTags'](_0x4f4290);}})['then'](function(_0x4f4660){if(_0x4f4660){return _0x4f4660?{'count':_0x578ee9,'rows':_0x4f4660}:null;}})['then'](respondWithResult(_0x2f22fa,null))[_0x1c10('0x42')](handleError(_0x2f22fa,null));};exports[_0x1c10('0x53')]=function(_0x33e03b,_0x2b5902,_0x5909ea){if(_0x33e03b[_0x1c10('0x47')]['id']){delete _0x33e03b[_0x1c10('0x47')]['id'];}return db['ZendeskConfiguration'][_0x1c10('0x4b')]({'where':{'id':_0x33e03b['params']['id']}})['then'](handleEntityNotFound(_0x2b5902,null))[_0x1c10('0x26')](function(_0x36552e){if(_0x36552e){return _0x36552e['setTags'](_0x33e03b[_0x1c10('0x47')][_0x1c10('0x54')]||[]);}return null;})[_0x1c10('0x26')](respondWithResult(_0x2b5902,null))['catch'](handleError(_0x2b5902,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8d5fdd0..33a907a 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 _0xa478=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1779d6,_0x1a79ec){var _0x358ade=function(_0x55f1cc){while(--_0x55f1cc){_0x1779d6['push'](_0x1779d6['shift']());}};_0x358ade(++_0x1a79ec);}(_0xa478,0x136));var _0x8a47=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0xa478[_0x5c814d];return _0x89b71;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var logger=require(_0x8a47('0x2'))(_0x8a47('0x3'));var moment=require(_0x8a47('0x4'));var BPromise=require(_0x8a47('0x5'));var rp=require(_0x8a47('0x6'));var fs=require('fs');var path=require(_0x8a47('0x7'));var rimraf=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var attributes=require(_0x8a47('0xa'));module[_0x8a47('0xb')]=function(_0x50226a,_0x413787){return _0x50226a[_0x8a47('0xc')](_0x8a47('0xd'),attributes,{'tableName':_0x8a47('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x119987,_0xff374d){var _0x4aa2ce=function(_0x508b70){while(--_0x508b70){_0x119987['push'](_0x119987['shift']());}};_0x4aa2ce(++_0xff374d);}(_0xea28,0x13a));var _0x8ea2=function(_0x4d3e20,_0x5456e1){_0x4d3e20=_0x4d3e20-0x0;var _0x30cf39=_0xea28[_0x4d3e20];return _0x30cf39;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 8648df2..055c040 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 _0x8bed=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2cf10c,_0x941fc7){var _0x38bd94=function(_0x452de6){while(--_0x452de6){_0x2cf10c['push'](_0x2cf10c['shift']());}};_0x38bd94(++_0x941fc7);}(_0x8bed,0x140));var _0xd8be=function(_0x39c4b6,_0x394a3b){_0x39c4b6=_0x39c4b6-0x0;var _0x2562ba=_0x8bed[_0x39c4b6];return _0x2562ba;};'use strict';var _=require(_0xd8be('0x0'));var util=require(_0xd8be('0x1'));var moment=require('moment');var BPromise=require(_0xd8be('0x2'));var rs=require(_0xd8be('0x3'));var fs=require('fs');var Redis=require(_0xd8be('0x4'));var db=require(_0xd8be('0x5'))['db'];var utils=require(_0xd8be('0x6'));var logger=require(_0xd8be('0x7'))(_0xd8be('0x8'));var config=require(_0xd8be('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8be('0xa')][_0xd8be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26d082,_0x561b34,_0x4ebd30){return new BPromise(function(_0xe05dfd,_0x3e656b){return client['request'](_0x26d082,_0x4ebd30)[_0xd8be('0xc')](function(_0x14e5db){logger[_0xd8be('0xd')](_0xd8be('0xe'),_0x561b34,_0xd8be('0xf'));logger[_0xd8be('0x10')](_0xd8be('0x11'),_0x561b34,_0xd8be('0xf'),JSON[_0xd8be('0x12')](_0x14e5db));if(_0x14e5db[_0xd8be('0x13')]){if(_0x14e5db[_0xd8be('0x13')][_0xd8be('0x14')]===0x1f4){logger[_0xd8be('0x13')](_0xd8be('0xe'),_0x561b34,_0x14e5db['error'][_0xd8be('0x15')]);return _0x3e656b(_0x14e5db['error']['message']);}logger[_0xd8be('0x13')](_0xd8be('0xe'),_0x561b34,_0x14e5db[_0xd8be('0x13')][_0xd8be('0x15')]);return _0xe05dfd(_0x14e5db[_0xd8be('0x13')][_0xd8be('0x15')]);}else{logger[_0xd8be('0xd')](_0xd8be('0xe'),_0x561b34,_0xd8be('0xf'));_0xe05dfd(_0x14e5db[_0xd8be('0x16')][_0xd8be('0x15')]);}})['catch'](function(_0xcbcaad){logger[_0xd8be('0x13')](_0xd8be('0xe'),_0x561b34,_0xcbcaad);_0x3e656b(_0xcbcaad);});});} \ No newline at end of file +var _0x31c8=['client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x385325,_0x480c62){var _0x5b9b93=function(_0x51d974){while(--_0x51d974){_0x385325['push'](_0x385325['shift']());}};_0x5b9b93(++_0x480c62);}(_0x31c8,0x1a5));var _0x831c=function(_0xf54a80,_0x4f0c6a){_0xf54a80=_0xf54a80-0x0;var _0x208e95=_0x31c8[_0xf54a80];return _0x208e95;};'use strict';var _=require(_0x831c('0x0'));var util=require(_0x831c('0x1'));var moment=require(_0x831c('0x2'));var BPromise=require(_0x831c('0x3'));var rs=require(_0x831c('0x4'));var fs=require('fs');var Redis=require(_0x831c('0x5'));var db=require(_0x831c('0x6'))['db'];var utils=require(_0x831c('0x7'));var logger=require('../../config/logger')(_0x831c('0x8'));var config=require(_0x831c('0x9'));var jayson=require(_0x831c('0xa'));var client=jayson[_0x831c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2774f4,_0x4ee0d7,_0x34b6b7){return new BPromise(function(_0x24d70f,_0x59a92a){return client[_0x831c('0xc')](_0x2774f4,_0x34b6b7)[_0x831c('0xd')](function(_0x24d1c0){logger[_0x831c('0xe')](_0x831c('0xf'),_0x4ee0d7,_0x831c('0x10'));logger[_0x831c('0x11')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4ee0d7,_0x831c('0x10'),JSON[_0x831c('0x12')](_0x24d1c0));if(_0x24d1c0[_0x831c('0x13')]){if(_0x24d1c0[_0x831c('0x13')][_0x831c('0x14')]===0x1f4){logger[_0x831c('0x13')](_0x831c('0xf'),_0x4ee0d7,_0x24d1c0[_0x831c('0x13')][_0x831c('0x15')]);return _0x59a92a(_0x24d1c0[_0x831c('0x13')]['message']);}logger[_0x831c('0x13')](_0x831c('0xf'),_0x4ee0d7,_0x24d1c0[_0x831c('0x13')][_0x831c('0x15')]);return _0x24d70f(_0x24d1c0[_0x831c('0x13')]['message']);}else{logger[_0x831c('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ee0d7,_0x831c('0x10'));_0x24d70f(_0x24d1c0[_0x831c('0x16')][_0x831c('0x15')]);}})[_0x831c('0x17')](function(_0x334b70){logger[_0x831c('0x13')](_0x831c('0xf'),_0x4ee0d7,_0x334b70);_0x59a92a(_0x334b70);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 721b0ad..c1157be 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 _0x3329=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x3329,0x197));var _0x9332=function(_0x3233d9,_0x36572a){_0x3233d9=_0x3233d9-0x0;var _0x43ec92=_0x3329[_0x3233d9];return _0x43ec92;};'use strict';var multer=require(_0x9332('0x0'));var util=require(_0x9332('0x1'));var path=require(_0x9332('0x2'));var timeout=require('connect-timeout');var express=require(_0x9332('0x3'));var router=express[_0x9332('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9332('0x5'));var interaction=require(_0x9332('0x6'));var config=require('../../config/environment');var controller=require(_0x9332('0x7'));router[_0x9332('0x8')]('/',auth[_0x9332('0x9')](),controller[_0x9332('0xa')]);router[_0x9332('0x8')](_0x9332('0xb'),auth[_0x9332('0x9')](),controller['show']);router['post']('/',auth[_0x9332('0x9')](),controller[_0x9332('0xc')]);router[_0x9332('0xd')](_0x9332('0xb'),auth['isAuthenticated'](),controller[_0x9332('0xe')]);router[_0x9332('0xf')](_0x9332('0xb'),auth[_0x9332('0x9')](),controller[_0x9332('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf7c0=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x590cc4,_0x5d581b){var _0x5ca730=function(_0x3f3741){while(--_0x3f3741){_0x590cc4['push'](_0x590cc4['shift']());}};_0x5ca730(++_0x5d581b);}(_0xf7c0,0xfa));var _0x0f7c=function(_0x6935ba,_0x1eb4d5){_0x6935ba=_0x6935ba-0x0;var _0x4c844c=_0xf7c0[_0x6935ba];return _0x4c844c;};'use strict';var multer=require('multer');var util=require(_0x0f7c('0x0'));var path=require(_0x0f7c('0x1'));var timeout=require(_0x0f7c('0x2'));var express=require('express');var router=express[_0x0f7c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0f7c('0x4'));var interaction=require(_0x0f7c('0x5'));var config=require(_0x0f7c('0x6'));var controller=require('./intZendeskField.controller');router[_0x0f7c('0x7')]('/',auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x9')]);router[_0x0f7c('0x7')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xb')]);router[_0x0f7c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f7c('0xd')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xe')]);router['delete'](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller['destroy']);module[_0x0f7c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 11a596a..c24cfd7 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 _0x158c=['string','variable','customVariable','STRING','ENUM'];(function(_0x47549b,_0x1b2865){var _0x3cdb1b=function(_0x37f58c){while(--_0x37f58c){_0x47549b['push'](_0x47549b['shift']());}};_0x3cdb1b(++_0x1b2865);}(_0x158c,0x77));var _0xc158=function(_0x21155f,_0x3b4fc8){_0x21155f=_0x21155f-0x0;var _0xd89496=_0x158c[_0x21155f];return _0xd89496;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc158('0x0')](_0xc158('0x1'),_0xc158('0x2'),_0xc158('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc158('0x4')]},'keyType':{'type':Sequelize[_0xc158('0x0')](_0xc158('0x1'),_0xc158('0x2'),_0xc158('0x3'))},'keyContent':{'type':Sequelize[_0xc158('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc158('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc158('0x4')]}}; \ No newline at end of file +var _0xa232=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0x1531e8,_0x3a1b03){var _0x3e058b=function(_0x45125b){while(--_0x45125b){_0x1531e8['push'](_0x1531e8['shift']());}};_0x3e058b(++_0x3a1b03);}(_0xa232,0x19f));var _0x2a23=function(_0x33c3f0,_0x35a6a6){_0x33c3f0=_0x33c3f0-0x0;var _0x2ce021=_0xa232[_0x33c3f0];return _0x2ce021;};'use strict';var Sequelize=require(_0x2a23('0x0'));module['exports']={'type':{'type':Sequelize[_0x2a23('0x1')](_0x2a23('0x2'),_0x2a23('0x3'),'customVariable',_0x2a23('0x4'),_0x2a23('0x5')),'defaultValue':_0x2a23('0x2')},'content':{'type':Sequelize[_0x2a23('0x6')]},'key':{'type':Sequelize[_0x2a23('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2a23('0x3'),_0x2a23('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a23('0x6')]},'nameField':{'type':Sequelize[_0x2a23('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2314b6d..798024c 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 _0x006b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x006b,0x83));var _0xb006=function(_0x5007be,_0x5a8c4b){_0x5007be=_0x5007be-0x0;var _0x22f469=_0x006b[_0x5007be];return _0x22f469;};'use strict';var emlformat=require(_0xb006('0x0'));var rimraf=require(_0xb006('0x1'));var zipdir=require(_0xb006('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb006('0x3'));var moment=require(_0xb006('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb006('0x5'));var util=require(_0xb006('0x6'));var path=require(_0xb006('0x7'));var sox=require(_0xb006('0x8'));var csv=require(_0xb006('0x9'));var ejs=require(_0xb006('0xa'));var fs=require('fs');var fs_extra=require(_0xb006('0xb'));var _=require(_0xb006('0xc'));var squel=require(_0xb006('0xd'));var crypto=require(_0xb006('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb006('0xf'));var Papa=require(_0xb006('0x10'));var Redis=require(_0xb006('0x11'));var authService=require(_0xb006('0x12'));var qs=require(_0xb006('0x13'));var as=require(_0xb006('0x14'));var hardwareService=require(_0xb006('0x15'));var logger=require(_0xb006('0x16'))(_0xb006('0x17'));var utils=require(_0xb006('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb006('0x19'));var db=require(_0xb006('0x1a'))['db'];function respondWithStatusCode(_0x20fde5,_0x2fd557){_0x2fd557=_0x2fd557||0xcc;return function(_0x17b1c6){if(_0x17b1c6){return _0x20fde5[_0xb006('0x1b')](_0x2fd557);}return _0x20fde5['status'](_0x2fd557)[_0xb006('0x1c')]();};}function respondWithResult(_0x272b65,_0x33f1d6){_0x33f1d6=_0x33f1d6||0xc8;return function(_0x5483ca){if(_0x5483ca){return _0x272b65[_0xb006('0x1d')](_0x33f1d6)[_0xb006('0x1e')](_0x5483ca);}};}function respondWithFilteredResult(_0x3aa62f,_0x407f5d){return function(_0x113ab3){if(_0x113ab3){var _0x2f4d1c=typeof _0x407f5d[_0xb006('0x1f')]===_0xb006('0x20')&&typeof _0x407f5d[_0xb006('0x21')]===_0xb006('0x20');var _0x27b4bb=_0x113ab3[_0xb006('0x22')];var _0x517515=_0x2f4d1c?0x0:_0x407f5d[_0xb006('0x1f')];var _0x28283f=_0x2f4d1c?_0x113ab3['count']:_0x407f5d[_0xb006('0x1f')]+_0x407f5d[_0xb006('0x21')];var _0x917713;if(_0x28283f>=_0x27b4bb){_0x28283f=_0x27b4bb;_0x917713=0xc8;}else{_0x917713=0xce;}_0x3aa62f[_0xb006('0x1d')](_0x917713);return _0x3aa62f['set'](_0xb006('0x23'),_0x517515+'-'+_0x28283f+'/'+_0x27b4bb)[_0xb006('0x1e')](_0x113ab3);}return null;};}function patchUpdates(_0x1fe14f){return function(_0x3b15e3){try{jsonpatch[_0xb006('0x24')](_0x3b15e3,_0x1fe14f,!![]);}catch(_0x575378){return BPromise['reject'](_0x575378);}return _0x3b15e3[_0xb006('0x25')]();};}function saveUpdates(_0x248b64,_0x149a82){return function(_0x1dc092){if(_0x1dc092){return _0x1dc092[_0xb006('0x26')](_0x248b64)[_0xb006('0x27')](function(_0x3aed3c){return _0x3aed3c;});}return null;};}function removeEntity(_0x3c6f45,_0x337e19){return function(_0x1841d6){if(_0x1841d6){return _0x1841d6[_0xb006('0x28')]()[_0xb006('0x27')](function(){_0x3c6f45[_0xb006('0x1d')](0xcc)[_0xb006('0x1c')]();});}};}function handleEntityNotFound(_0x394035,_0x27c2f7){return function(_0xf9a6e9){if(!_0xf9a6e9){_0x394035[_0xb006('0x1b')](0x194);}return _0xf9a6e9;};}function handleError(_0x928b4f,_0x528fec){_0x528fec=_0x528fec||0x1f4;return function(_0x287243){logger[_0xb006('0x29')](_0x287243[_0xb006('0x2a')]);if(_0x287243[_0xb006('0x2b')]){delete _0x287243['name'];}_0x928b4f[_0xb006('0x1d')](_0x528fec)[_0xb006('0x2c')](_0x287243);};}exports['index']=function(_0x128878,_0x5d99e7){var _0x1d92f4={},_0x1ded08={},_0x9cc519={'count':0x0,'rows':[]};var _0x7b42e6=_[_0xb006('0x2d')](db[_0xb006('0x2e')][_0xb006('0x2f')],function(_0x2026ef){return{'name':_0x2026ef['fieldName'],'type':_0x2026ef[_0xb006('0x30')]['key']};});_0x1ded08[_0xb006('0x31')]=_[_0xb006('0x2d')](_0x7b42e6,_0xb006('0x2b'));_0x1ded08['query']=_['keys'](_0x128878['query']);_0x1ded08[_0xb006('0x32')]=_[_0xb006('0x33')](_0x1ded08[_0xb006('0x31')],_0x1ded08[_0xb006('0x34')]);_0x1d92f4['attributes']=_[_0xb006('0x33')](_0x1ded08['model'],qs[_0xb006('0x35')](_0x128878[_0xb006('0x34')][_0xb006('0x35')]));_0x1d92f4['attributes']=_0x1d92f4[_0xb006('0x36')][_0xb006('0x37')]?_0x1d92f4['attributes']:_0x1ded08[_0xb006('0x31')];if(!_0x128878[_0xb006('0x34')][_0xb006('0x38')](_0xb006('0x39'))){_0x1d92f4[_0xb006('0x21')]=qs[_0xb006('0x21')](_0x128878[_0xb006('0x34')]['limit']);_0x1d92f4['offset']=qs[_0xb006('0x1f')](_0x128878[_0xb006('0x34')][_0xb006('0x1f')]);}_0x1d92f4[_0xb006('0x3a')]=qs[_0xb006('0x3b')](_0x128878[_0xb006('0x34')][_0xb006('0x3b')]);_0x1d92f4[_0xb006('0x3c')]=qs[_0xb006('0x32')](_['pick'](_0x128878['query'],_0x1ded08[_0xb006('0x32')]),_0x7b42e6);if(_0x128878[_0xb006('0x34')][_0xb006('0x3d')]){_0x1d92f4[_0xb006('0x3c')]=_[_0xb006('0x3e')](_0x1d92f4[_0xb006('0x3c')],{'$or':_[_0xb006('0x2d')](_0x7b42e6,function(_0x501a66){if(_0x501a66[_0xb006('0x30')]!==_0xb006('0x3f')){var _0x191922={};_0x191922[_0x501a66[_0xb006('0x2b')]]={'$like':'%'+_0x128878[_0xb006('0x34')][_0xb006('0x3d')]+'%'};return _0x191922;}})});}_0x1d92f4=_[_0xb006('0x3e')]({},_0x1d92f4,_0x128878[_0xb006('0x40')]);var _0x36fe7a={'where':_0x1d92f4[_0xb006('0x3c')]};return db[_0xb006('0x2e')][_0xb006('0x22')](_0x36fe7a)['then'](function(_0xf84245){_0x9cc519[_0xb006('0x22')]=_0xf84245;if(_0x128878[_0xb006('0x34')][_0xb006('0x41')]){_0x1d92f4['include']=[{'all':!![]}];}return db[_0xb006('0x2e')][_0xb006('0x42')](_0x1d92f4);})['then'](function(_0x556196){_0x9cc519[_0xb006('0x43')]=_0x556196;return _0x9cc519;})[_0xb006('0x27')](respondWithFilteredResult(_0x5d99e7,_0x1d92f4))[_0xb006('0x44')](handleError(_0x5d99e7,null));};exports[_0xb006('0x45')]=function(_0x5d7878,_0x34a421){var _0x535152={'raw':!![],'where':{'id':_0x5d7878['params']['id']}},_0x3daa19={};_0x3daa19[_0xb006('0x31')]=_[_0xb006('0x46')](db['ZendeskField'][_0xb006('0x2f')]);_0x3daa19[_0xb006('0x34')]=_[_0xb006('0x46')](_0x5d7878['query']);_0x3daa19[_0xb006('0x32')]=_[_0xb006('0x33')](_0x3daa19[_0xb006('0x31')],_0x3daa19['query']);_0x535152[_0xb006('0x36')]=_[_0xb006('0x33')](_0x3daa19[_0xb006('0x31')],qs[_0xb006('0x35')](_0x5d7878[_0xb006('0x34')]['fields']));_0x535152[_0xb006('0x36')]=_0x535152['attributes'][_0xb006('0x37')]?_0x535152[_0xb006('0x36')]:_0x3daa19[_0xb006('0x31')];if(_0x5d7878[_0xb006('0x34')]['includeAll']){_0x535152[_0xb006('0x47')]=[{'all':!![]}];}_0x535152=_[_0xb006('0x3e')]({},_0x535152,_0x5d7878[_0xb006('0x40')]);return db[_0xb006('0x2e')][_0xb006('0x48')](_0x535152)[_0xb006('0x27')](handleEntityNotFound(_0x34a421,null))['then'](respondWithResult(_0x34a421,null))['catch'](handleError(_0x34a421,null));};exports[_0xb006('0x49')]=function(_0x4fa57a,_0x5f1515){return db['ZendeskField'][_0xb006('0x49')](_0x4fa57a[_0xb006('0x4a')],{})['then'](respondWithResult(_0x5f1515,0xc9))[_0xb006('0x44')](handleError(_0x5f1515,null));};exports['update']=function(_0xd9bad3,_0x464d9c){if(_0xd9bad3[_0xb006('0x4a')]['id']){delete _0xd9bad3[_0xb006('0x4a')]['id'];}return db[_0xb006('0x2e')]['find']({'where':{'id':_0xd9bad3[_0xb006('0x4b')]['id']}})[_0xb006('0x27')](handleEntityNotFound(_0x464d9c,null))[_0xb006('0x27')](saveUpdates(_0xd9bad3['body'],null))['then'](respondWithResult(_0x464d9c,null))['catch'](handleError(_0x464d9c,null));};exports[_0xb006('0x28')]=function(_0x219df9,_0xdb8bc5){return db['ZendeskField'][_0xb006('0x48')]({'where':{'id':_0x219df9['params']['id']}})[_0xb006('0x27')](handleEntityNotFound(_0xdb8bc5,null))[_0xb006('0x27')](removeEntity(_0xdb8bc5,null))['catch'](handleError(_0xdb8bc5,null));}; \ No newline at end of file +var _0xa671=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','ZendeskField','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x55b296,_0x1d7176){var _0x57c656=function(_0x519951){while(--_0x519951){_0x55b296['push'](_0x55b296['shift']());}};_0x57c656(++_0x1d7176);}(_0xa671,0x1a4));var _0x1a67=function(_0x3c2b2b,_0x5250d9){_0x3c2b2b=_0x3c2b2b-0x0;var _0x1484f5=_0xa671[_0x3c2b2b];return _0x1484f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a67('0x0'));var zipdir=require(_0x1a67('0x1'));var jsonpatch=require(_0x1a67('0x2'));var rp=require(_0x1a67('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x4'));var util=require('util');var path=require(_0x1a67('0x5'));var sox=require(_0x1a67('0x6'));var csv=require(_0x1a67('0x7'));var ejs=require(_0x1a67('0x8'));var fs=require('fs');var fs_extra=require(_0x1a67('0x9'));var _=require('lodash');var squel=require(_0x1a67('0xa'));var crypto=require(_0x1a67('0xb'));var jsforce=require(_0x1a67('0xc'));var deskjs=require(_0x1a67('0xd'));var toCsv=require(_0x1a67('0x7'));var querystring=require(_0x1a67('0xe'));var Papa=require(_0x1a67('0xf'));var Redis=require(_0x1a67('0x10'));var authService=require(_0x1a67('0x11'));var qs=require(_0x1a67('0x12'));var as=require(_0x1a67('0x13'));var hardwareService=require(_0x1a67('0x14'));var logger=require(_0x1a67('0x15'))(_0x1a67('0x16'));var utils=require('../../config/utils');var config=require(_0x1a67('0x17'));var licenseUtil=require(_0x1a67('0x18'));var db=require(_0x1a67('0x19'))['db'];function respondWithStatusCode(_0x56f6d0,_0x48c82c){_0x48c82c=_0x48c82c||0xcc;return function(_0x35ae66){if(_0x35ae66){return _0x56f6d0['sendStatus'](_0x48c82c);}return _0x56f6d0[_0x1a67('0x1a')](_0x48c82c)['end']();};}function respondWithResult(_0x28c5d0,_0x499416){_0x499416=_0x499416||0xc8;return function(_0x1b81d7){if(_0x1b81d7){return _0x28c5d0['status'](_0x499416)[_0x1a67('0x1b')](_0x1b81d7);}};}function respondWithFilteredResult(_0x3fdcf1,_0x592278){return function(_0x53b3cc){if(_0x53b3cc){var _0x534a03=typeof _0x592278[_0x1a67('0x1c')]===_0x1a67('0x1d')&&typeof _0x592278[_0x1a67('0x1e')]===_0x1a67('0x1d');var _0x55d3d9=_0x53b3cc[_0x1a67('0x1f')];var _0x58d74e=_0x534a03?0x0:_0x592278['offset'];var _0x1f6c56=_0x534a03?_0x53b3cc[_0x1a67('0x1f')]:_0x592278[_0x1a67('0x1c')]+_0x592278['limit'];var _0x5db62f;if(_0x1f6c56>=_0x55d3d9){_0x1f6c56=_0x55d3d9;_0x5db62f=0xc8;}else{_0x5db62f=0xce;}_0x3fdcf1[_0x1a67('0x1a')](_0x5db62f);return _0x3fdcf1[_0x1a67('0x20')](_0x1a67('0x21'),_0x58d74e+'-'+_0x1f6c56+'/'+_0x55d3d9)[_0x1a67('0x1b')](_0x53b3cc);}return null;};}function patchUpdates(_0x30ea78){return function(_0x1c1f7b){try{jsonpatch[_0x1a67('0x22')](_0x1c1f7b,_0x30ea78,!![]);}catch(_0x3153a9){return BPromise[_0x1a67('0x23')](_0x3153a9);}return _0x1c1f7b[_0x1a67('0x24')]();};}function saveUpdates(_0x355704,_0x4e2cfe){return function(_0x2ae1d9){if(_0x2ae1d9){return _0x2ae1d9[_0x1a67('0x25')](_0x355704)['then'](function(_0x3cfe34){return _0x3cfe34;});}return null;};}function removeEntity(_0x2ee67b,_0x4d04dd){return function(_0x1addf1){if(_0x1addf1){return _0x1addf1[_0x1a67('0x26')]()[_0x1a67('0x27')](function(){_0x2ee67b[_0x1a67('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501a28,_0x19c8da){return function(_0x39db4d){if(!_0x39db4d){_0x501a28[_0x1a67('0x28')](0x194);}return _0x39db4d;};}function handleError(_0x710e5e,_0x4ae97a){_0x4ae97a=_0x4ae97a||0x1f4;return function(_0x44b19d){logger[_0x1a67('0x29')](_0x44b19d['stack']);if(_0x44b19d[_0x1a67('0x2a')]){delete _0x44b19d[_0x1a67('0x2a')];}_0x710e5e[_0x1a67('0x1a')](_0x4ae97a)[_0x1a67('0x2b')](_0x44b19d);};}exports[_0x1a67('0x2c')]=function(_0x3633fb,_0x5cd798){var _0x6b4816={},_0x5b613e={},_0x4b25b0={'count':0x0,'rows':[]};var _0x333abb=_[_0x1a67('0x2d')](db[_0x1a67('0x2e')][_0x1a67('0x2f')],function(_0x4669e2){return{'name':_0x4669e2['fieldName'],'type':_0x4669e2['type'][_0x1a67('0x30')]};});_0x5b613e[_0x1a67('0x31')]=_['map'](_0x333abb,_0x1a67('0x2a'));_0x5b613e[_0x1a67('0x32')]=_['keys'](_0x3633fb[_0x1a67('0x32')]);_0x5b613e[_0x1a67('0x33')]=_[_0x1a67('0x34')](_0x5b613e[_0x1a67('0x31')],_0x5b613e[_0x1a67('0x32')]);_0x6b4816['attributes']=_[_0x1a67('0x34')](_0x5b613e['model'],qs[_0x1a67('0x35')](_0x3633fb[_0x1a67('0x32')][_0x1a67('0x35')]));_0x6b4816[_0x1a67('0x36')]=_0x6b4816[_0x1a67('0x36')][_0x1a67('0x37')]?_0x6b4816[_0x1a67('0x36')]:_0x5b613e['model'];if(!_0x3633fb[_0x1a67('0x32')][_0x1a67('0x38')]('nolimit')){_0x6b4816[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x3633fb[_0x1a67('0x32')]['limit']);_0x6b4816['offset']=qs[_0x1a67('0x1c')](_0x3633fb['query'][_0x1a67('0x1c')]);}_0x6b4816['order']=qs[_0x1a67('0x39')](_0x3633fb[_0x1a67('0x32')][_0x1a67('0x39')]);_0x6b4816[_0x1a67('0x3a')]=qs[_0x1a67('0x33')](_['pick'](_0x3633fb[_0x1a67('0x32')],_0x5b613e[_0x1a67('0x33')]),_0x333abb);if(_0x3633fb[_0x1a67('0x32')]['filter']){_0x6b4816['where']=_[_0x1a67('0x3b')](_0x6b4816[_0x1a67('0x3a')],{'$or':_['map'](_0x333abb,function(_0x5c1cef){if(_0x5c1cef[_0x1a67('0x3c')]!==_0x1a67('0x3d')){var _0x238374={};_0x238374[_0x5c1cef['name']]={'$like':'%'+_0x3633fb[_0x1a67('0x32')]['filter']+'%'};return _0x238374;}})});}_0x6b4816=_[_0x1a67('0x3b')]({},_0x6b4816,_0x3633fb[_0x1a67('0x3e')]);var _0x38a1bf={'where':_0x6b4816[_0x1a67('0x3a')]};return db['ZendeskField']['count'](_0x38a1bf)[_0x1a67('0x27')](function(_0x260d01){_0x4b25b0[_0x1a67('0x1f')]=_0x260d01;if(_0x3633fb[_0x1a67('0x32')][_0x1a67('0x3f')]){_0x6b4816[_0x1a67('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0x1a67('0x41')](_0x6b4816);})['then'](function(_0x52b0e2){_0x4b25b0['rows']=_0x52b0e2;return _0x4b25b0;})[_0x1a67('0x27')](respondWithFilteredResult(_0x5cd798,_0x6b4816))['catch'](handleError(_0x5cd798,null));};exports[_0x1a67('0x42')]=function(_0x26b0f3,_0x5b2825){var _0x5eed3b={'raw':!![],'where':{'id':_0x26b0f3[_0x1a67('0x43')]['id']}},_0x29cc2b={};_0x29cc2b[_0x1a67('0x31')]=_[_0x1a67('0x44')](db[_0x1a67('0x2e')][_0x1a67('0x2f')]);_0x29cc2b['query']=_[_0x1a67('0x44')](_0x26b0f3['query']);_0x29cc2b[_0x1a67('0x33')]=_[_0x1a67('0x34')](_0x29cc2b['model'],_0x29cc2b[_0x1a67('0x32')]);_0x5eed3b['attributes']=_[_0x1a67('0x34')](_0x29cc2b['model'],qs[_0x1a67('0x35')](_0x26b0f3[_0x1a67('0x32')][_0x1a67('0x35')]));_0x5eed3b['attributes']=_0x5eed3b[_0x1a67('0x36')][_0x1a67('0x37')]?_0x5eed3b[_0x1a67('0x36')]:_0x29cc2b[_0x1a67('0x31')];if(_0x26b0f3['query'][_0x1a67('0x3f')]){_0x5eed3b['include']=[{'all':!![]}];}_0x5eed3b=_[_0x1a67('0x3b')]({},_0x5eed3b,_0x26b0f3[_0x1a67('0x3e')]);return db[_0x1a67('0x2e')][_0x1a67('0x45')](_0x5eed3b)[_0x1a67('0x27')](handleEntityNotFound(_0x5b2825,null))[_0x1a67('0x27')](respondWithResult(_0x5b2825,null))[_0x1a67('0x46')](handleError(_0x5b2825,null));};exports['create']=function(_0x46f13e,_0x44c88e){return db[_0x1a67('0x2e')][_0x1a67('0x47')](_0x46f13e[_0x1a67('0x48')],{})['then'](respondWithResult(_0x44c88e,0xc9))[_0x1a67('0x46')](handleError(_0x44c88e,null));};exports['update']=function(_0x4e7539,_0x2f4f3c){if(_0x4e7539[_0x1a67('0x48')]['id']){delete _0x4e7539[_0x1a67('0x48')]['id'];}return db[_0x1a67('0x2e')][_0x1a67('0x45')]({'where':{'id':_0x4e7539[_0x1a67('0x43')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x2f4f3c,null))[_0x1a67('0x27')](saveUpdates(_0x4e7539[_0x1a67('0x48')],null))[_0x1a67('0x27')](respondWithResult(_0x2f4f3c,null))[_0x1a67('0x46')](handleError(_0x2f4f3c,null));};exports['destroy']=function(_0x56b4a8,_0x21d3c2){return db[_0x1a67('0x2e')][_0x1a67('0x45')]({'where':{'id':_0x56b4a8[_0x1a67('0x43')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x21d3c2,null))[_0x1a67('0x27')](removeEntity(_0x21d3c2,null))[_0x1a67('0x46')](handleError(_0x21d3c2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 788485e..9632ccf 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 _0x1da0=['define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x1da0,0x14a));var _0x01da=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x1da0[_0x5e2862];return _0x8dcad4;};'use strict';var _=require('lodash');var util=require(_0x01da('0x0'));var logger=require('../../config/logger')(_0x01da('0x1'));var moment=require(_0x01da('0x2'));var BPromise=require(_0x01da('0x3'));var rp=require(_0x01da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01da('0x5'));var attributes=require(_0x01da('0x6'));module[_0x01da('0x7')]=function(_0x374a52,_0x29849e){return _0x374a52[_0x01da('0x8')]('ZendeskField',attributes,{'tableName':_0x01da('0x9'),'paranoid':![],'indexes':[{'name':_0x01da('0xa'),'fields':[_0x01da('0xb'),_0x01da('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ab9=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','moment','request-promise','path','rimraf'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x3ab9,0x134));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x93ab('0x0'));var BPromise=require('bluebird');var rp=require(_0x93ab('0x1'));var fs=require('fs');var path=require(_0x93ab('0x2'));var rimraf=require(_0x93ab('0x3'));var config=require('../../config/environment');var attributes=require(_0x93ab('0x4'));module[_0x93ab('0x5')]=function(_0x3455e4,_0x19c081){return _0x3455e4[_0x93ab('0x6')](_0x93ab('0x7'),attributes,{'tableName':_0x93ab('0x8'),'paranoid':![],'indexes':[{'name':_0x93ab('0x9'),'fields':[_0x93ab('0xa'),_0x93ab('0xb')],'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 11b9fe1..da0c9db 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 _0x0dca=['http','info','debug','request\x20sent','stringify','error','message','ZendeskField,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa4b622,_0x4eb352){var _0x2f0c72=function(_0x54ef6a){while(--_0x54ef6a){_0xa4b622['push'](_0xa4b622['shift']());}};_0x2f0c72(++_0x4eb352);}(_0x0dca,0x13a));var _0xa0dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0dca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0dc('0x1'));var fs=require('fs');var Redis=require(_0xa0dc('0x2'));var db=require(_0xa0dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0dc('0x4'))(_0xa0dc('0x5'));var config=require(_0xa0dc('0x6'));var jayson=require(_0xa0dc('0x7'));var client=jayson[_0xa0dc('0x8')][_0xa0dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb980a7,_0x53f968,_0x315e98){return new BPromise(function(_0x259b6b,_0x41f69b){return client['request'](_0xb980a7,_0x315e98)['then'](function(_0x1ac73f){logger[_0xa0dc('0xa')]('ZendeskField,\x20%s,\x20%s',_0x53f968,'request\x20sent');logger[_0xa0dc('0xb')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x53f968,_0xa0dc('0xc'),JSON[_0xa0dc('0xd')](_0x1ac73f));if(_0x1ac73f[_0xa0dc('0xe')]){if(_0x1ac73f[_0xa0dc('0xe')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x53f968,_0x1ac73f[_0xa0dc('0xe')][_0xa0dc('0xf')]);return _0x41f69b(_0x1ac73f[_0xa0dc('0xe')][_0xa0dc('0xf')]);}logger[_0xa0dc('0xe')](_0xa0dc('0x10'),_0x53f968,_0x1ac73f['error'][_0xa0dc('0xf')]);return _0x259b6b(_0x1ac73f[_0xa0dc('0xe')][_0xa0dc('0xf')]);}else{logger[_0xa0dc('0xa')](_0xa0dc('0x10'),_0x53f968,_0xa0dc('0xc'));_0x259b6b(_0x1ac73f[_0xa0dc('0x11')]['message']);}})[_0xa0dc('0x12')](function(_0x24a0df){logger['error']('ZendeskField,\x20%s,\x20%s',_0x53f968,_0x24a0df);_0x41f69b(_0x24a0df);});});} \ No newline at end of file +var _0x4601=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1510e5,_0x3ff2da){var _0x5db94a=function(_0x3a9024){while(--_0x3a9024){_0x1510e5['push'](_0x1510e5['shift']());}};_0x5db94a(++_0x3ff2da);}(_0x4601,0x70));var _0x1460=function(_0x247625,_0x3d964e){_0x247625=_0x247625-0x0;var _0x4a0805=_0x4601[_0x247625];return _0x4a0805;};'use strict';var _=require(_0x1460('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1460('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1460('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1460('0x3'))(_0x1460('0x4'));var config=require(_0x1460('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1460('0x6')][_0x1460('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x501314,_0x14eaf2,_0x12c79c){return new BPromise(function(_0x4d7142,_0x1232c4){return client[_0x1460('0x8')](_0x501314,_0x12c79c)['then'](function(_0x11d337){logger[_0x1460('0x9')](_0x1460('0xa'),_0x14eaf2,_0x1460('0xb'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x14eaf2,_0x1460('0xb'),JSON[_0x1460('0xc')](_0x11d337));if(_0x11d337[_0x1460('0xd')]){if(_0x11d337['error']['code']===0x1f4){logger[_0x1460('0xd')]('ZendeskField,\x20%s,\x20%s',_0x14eaf2,_0x11d337[_0x1460('0xd')]['message']);return _0x1232c4(_0x11d337[_0x1460('0xd')][_0x1460('0xe')]);}logger[_0x1460('0xd')](_0x1460('0xa'),_0x14eaf2,_0x11d337[_0x1460('0xd')][_0x1460('0xe')]);return _0x4d7142(_0x11d337['error'][_0x1460('0xe')]);}else{logger[_0x1460('0x9')](_0x1460('0xa'),_0x14eaf2,_0x1460('0xb'));_0x4d7142(_0x11d337['result']['message']);}})['catch'](function(_0x226f93){logger[_0x1460('0xd')](_0x1460('0xa'),_0x14eaf2,_0x226f93);_0x1232c4(_0x226f93);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9761da8..1ace733 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 _0xde15=['get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index'];(function(_0x5b0a4a,_0x11a985){var _0x2ce5c6=function(_0x4b3a55){while(--_0x4b3a55){_0x5b0a4a['push'](_0x5b0a4a['shift']());}};_0x2ce5c6(++_0x11a985);}(_0xde15,0x12e));var _0x5de1=function(_0x1b3a3d,_0x277f32){_0x1b3a3d=_0x1b3a3d-0x0;var _0x312e4c=_0xde15[_0x1b3a3d];return _0x312e4c;};'use strict';var multer=require(_0x5de1('0x0'));var util=require(_0x5de1('0x1'));var path=require('path');var timeout=require(_0x5de1('0x2'));var express=require(_0x5de1('0x3'));var router=express['Router']();var fs_extra=require(_0x5de1('0x4'));var auth=require(_0x5de1('0x5'));var interaction=require(_0x5de1('0x6'));var config=require('../../config/environment');var controller=require(_0x5de1('0x7'));router['get']('/',auth[_0x5de1('0x8')](),controller[_0x5de1('0x9')]);router[_0x5de1('0xa')](_0x5de1('0xb'),auth[_0x5de1('0x8')](),controller[_0x5de1('0xc')]);router[_0x5de1('0xa')](_0x5de1('0xd'),auth[_0x5de1('0x8')](),controller[_0x5de1('0xe')]);router[_0x5de1('0xa')](_0x5de1('0xf'),auth['isAuthenticated'](),controller[_0x5de1('0x10')]);router[_0x5de1('0x11')]('/',auth[_0x5de1('0x8')](),controller[_0x5de1('0x12')]);router[_0x5de1('0x11')](_0x5de1('0xd'),auth[_0x5de1('0x8')](),controller[_0x5de1('0x13')]);router[_0x5de1('0x14')]('/:id',auth[_0x5de1('0x8')](),controller['update']);router[_0x5de1('0x15')](_0x5de1('0xb'),auth[_0x5de1('0x8')](),controller[_0x5de1('0x16')]);module[_0x5de1('0x17')]=router; \ No newline at end of file +var _0xffe9=['addConfiguration','put','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations'];(function(_0x59cb31,_0x2a63a2){var _0x4dd4ac=function(_0x479e0e){while(--_0x479e0e){_0x59cb31['push'](_0x59cb31['shift']());}};_0x4dd4ac(++_0x2a63a2);}(_0xffe9,0x1d0));var _0x9ffe=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0xffe9[_0x200827];return _0x120047;};'use strict';var multer=require(_0x9ffe('0x0'));var util=require('util');var path=require(_0x9ffe('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ffe('0x2'));var router=express['Router']();var fs_extra=require(_0x9ffe('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9ffe('0x4'));var config=require('../../config/environment');var controller=require(_0x9ffe('0x5'));router[_0x9ffe('0x6')]('/',auth[_0x9ffe('0x7')](),controller[_0x9ffe('0x8')]);router[_0x9ffe('0x6')](_0x9ffe('0x9'),auth[_0x9ffe('0x7')](),controller[_0x9ffe('0xa')]);router[_0x9ffe('0x6')]('/:id/configurations',auth[_0x9ffe('0x7')](),controller[_0x9ffe('0xb')]);router[_0x9ffe('0x6')]('/:id/fields',auth[_0x9ffe('0x7')](),controller[_0x9ffe('0xc')]);router[_0x9ffe('0xd')]('/',auth[_0x9ffe('0x7')](),controller[_0x9ffe('0xe')]);router['post'](_0x9ffe('0xf'),auth[_0x9ffe('0x7')](),controller[_0x9ffe('0x10')]);router[_0x9ffe('0x11')](_0x9ffe('0x9'),auth[_0x9ffe('0x7')](),controller['update']);router[_0x9ffe('0x12')](_0x9ffe('0x9'),auth[_0x9ffe('0x7')](),controller['destroy']);module[_0x9ffe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 35e3cd8..e5eaad0 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 _0xd2ea=['sequelize','exports','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3c5b0b,_0xb23555){_0x3c5b0b=_0x3c5b0b-0x0;var _0x1a986a=_0xd2ea[_0x3c5b0b];return _0x1a986a;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0x750a=['exports','STRING'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x750a,0x140));var _0xa750=function(_0x2093ec,_0x75df91){_0x2093ec=_0x2093ec-0x0;var _0x3fc04f=_0x750a[_0x2093ec];return _0x3fc04f;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa750('0x1')]},'zone':{'type':Sequelize[_0xa750('0x1')]},'clientId':{'type':Sequelize[_0xa750('0x1')]},'clientSecret':{'type':Sequelize[_0xa750('0x1')]},'serverUrl':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa750('0x1')]},'refreshToken':{'type':Sequelize[_0xa750('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d140b0e..22e7d3e 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 _0x07c9=['../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','where','merge','includeAll','findAll','rows','params','include','options','find','catch','create','body','update','getConfigurations','findOne','ZohoConfiguration','length','filter','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientSecret','serverUrl','code','refreshToken','zoho.eu','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2a6604,_0x2682a4){var _0x49068c=function(_0x134826){while(--_0x134826){_0x2a6604['push'](_0x2a6604['shift']());}};_0x49068c(++_0x2682a4);}(_0x07c9,0x6f));var _0x907c=function(_0x1f74e0,_0x350511){_0x1f74e0=_0x1f74e0-0x0;var _0x2606bc=_0x07c9[_0x1f74e0];return _0x2606bc;};'use strict';var emlformat=require(_0x907c('0x0'));var rimraf=require(_0x907c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x907c('0x2'));var rp=require(_0x907c('0x3'));var moment=require(_0x907c('0x4'));var BPromise=require(_0x907c('0x5'));var Mustache=require(_0x907c('0x6'));var util=require(_0x907c('0x7'));var path=require(_0x907c('0x8'));var sox=require(_0x907c('0x9'));var csv=require(_0x907c('0xa'));var ejs=require(_0x907c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x907c('0xc'));var squel=require(_0x907c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x907c('0xe'));var toCsv=require(_0x907c('0xa'));var querystring=require(_0x907c('0xf'));var Papa=require(_0x907c('0x10'));var Redis=require(_0x907c('0x11'));var authService=require(_0x907c('0x12'));var qs=require(_0x907c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x907c('0x14'))('api');var utils=require(_0x907c('0x15'));var config=require(_0x907c('0x16'));var licenseUtil=require(_0x907c('0x17'));var db=require(_0x907c('0x18'))['db'];var integrations=require(_0x907c('0x19'));function respondWithStatusCode(_0x35ba40,_0x4e252d){_0x4e252d=_0x4e252d||0xcc;return function(_0x57e505){if(_0x57e505){return _0x35ba40[_0x907c('0x1a')](_0x4e252d);}return _0x35ba40[_0x907c('0x1b')](_0x4e252d)[_0x907c('0x1c')]();};}function respondWithResult(_0x1a2c47,_0x4f2f69){_0x4f2f69=_0x4f2f69||0xc8;return function(_0x5e151e){if(_0x5e151e){return _0x1a2c47[_0x907c('0x1b')](_0x4f2f69)['json'](_0x5e151e);}};}function respondWithFilteredResult(_0x5da4ec,_0x24beb4){return function(_0x2c6aa9){if(_0x2c6aa9){var _0x49e02c=typeof _0x24beb4['offset']===_0x907c('0x1d')&&typeof _0x24beb4['limit']===_0x907c('0x1d');var _0x3ccc66=_0x2c6aa9[_0x907c('0x1e')];var _0x323414=_0x49e02c?0x0:_0x24beb4[_0x907c('0x1f')];var _0x29db5c=_0x49e02c?_0x2c6aa9[_0x907c('0x1e')]:_0x24beb4[_0x907c('0x1f')]+_0x24beb4[_0x907c('0x20')];var _0x11b6ab;if(_0x29db5c>=_0x3ccc66){_0x29db5c=_0x3ccc66;_0x11b6ab=0xc8;}else{_0x11b6ab=0xce;}_0x5da4ec[_0x907c('0x1b')](_0x11b6ab);return _0x5da4ec['set'](_0x907c('0x21'),_0x323414+'-'+_0x29db5c+'/'+_0x3ccc66)['json'](_0x2c6aa9);}return null;};}function patchUpdates(_0x4dee41){return function(_0x1c9e03){try{jsonpatch[_0x907c('0x22')](_0x1c9e03,_0x4dee41,!![]);}catch(_0x5c9a46){return BPromise[_0x907c('0x23')](_0x5c9a46);}return _0x1c9e03[_0x907c('0x24')]();};}function saveUpdates(_0x4b2d2e,_0x48f82a){return function(_0x58a73d){if(_0x58a73d){return _0x58a73d['update'](_0x4b2d2e)['then'](function(_0x18e8a8){return _0x18e8a8;});}return null;};}function removeEntity(_0xdeecde,_0x3f56ad){return function(_0x29a966){if(_0x29a966){return _0x29a966[_0x907c('0x25')]()[_0x907c('0x26')](function(){_0xdeecde[_0x907c('0x1b')](0xcc)[_0x907c('0x1c')]();});}};}function handleEntityNotFound(_0x38a55b,_0x329895){return function(_0xd6ff59){if(!_0xd6ff59){_0x38a55b[_0x907c('0x1a')](0x194);}return _0xd6ff59;};}function handleError(_0x5c14f4,_0x576304){_0x576304=_0x576304||0x1f4;return function(_0x16bf45){logger[_0x907c('0x27')](_0x16bf45[_0x907c('0x28')]);if(_0x16bf45[_0x907c('0x29')]){delete _0x16bf45['name'];}_0x5c14f4[_0x907c('0x1b')](_0x576304)[_0x907c('0x2a')](_0x16bf45);};}exports[_0x907c('0x2b')]=function(_0x5ee598,_0x5da345){var _0x3171c4={},_0x530a1d={},_0x5b58ee={'count':0x0,'rows':[]};var _0x23f563=_[_0x907c('0x2c')](db[_0x907c('0x2d')][_0x907c('0x2e')],function(_0x1bf0d9){return{'name':_0x1bf0d9[_0x907c('0x2f')],'type':_0x1bf0d9['type'][_0x907c('0x30')]};});_0x530a1d[_0x907c('0x31')]=_[_0x907c('0x2c')](_0x23f563,_0x907c('0x29'));_0x530a1d[_0x907c('0x32')]=_[_0x907c('0x33')](_0x5ee598['query']);_0x530a1d['filters']=_[_0x907c('0x34')](_0x530a1d['model'],_0x530a1d[_0x907c('0x32')]);_0x3171c4[_0x907c('0x35')]=_[_0x907c('0x34')](_0x530a1d[_0x907c('0x31')],qs[_0x907c('0x36')](_0x5ee598[_0x907c('0x32')][_0x907c('0x36')]));_0x3171c4[_0x907c('0x35')]=_0x3171c4[_0x907c('0x35')]['length']?_0x3171c4['attributes']:_0x530a1d[_0x907c('0x31')];if(!_0x5ee598[_0x907c('0x32')]['hasOwnProperty'](_0x907c('0x37'))){_0x3171c4['limit']=qs['limit'](_0x5ee598[_0x907c('0x32')][_0x907c('0x20')]);_0x3171c4['offset']=qs['offset'](_0x5ee598[_0x907c('0x32')]['offset']);}_0x3171c4[_0x907c('0x38')]=qs['sort'](_0x5ee598[_0x907c('0x32')][_0x907c('0x39')]);_0x3171c4['where']=qs[_0x907c('0x3a')](_[_0x907c('0x3b')](_0x5ee598[_0x907c('0x32')],_0x530a1d[_0x907c('0x3a')]),_0x23f563);if(_0x5ee598['query']['filter']){_0x3171c4[_0x907c('0x3c')]=_[_0x907c('0x3d')](_0x3171c4[_0x907c('0x3c')],{'$or':_['map'](_0x23f563,function(_0x47e1b9){if(_0x47e1b9['type']!=='VIRTUAL'){var _0x51d754={};_0x51d754[_0x47e1b9['name']]={'$like':'%'+_0x5ee598[_0x907c('0x32')]['filter']+'%'};return _0x51d754;}})});}_0x3171c4=_[_0x907c('0x3d')]({},_0x3171c4,_0x5ee598['options']);var _0x39b7ed={'where':_0x3171c4[_0x907c('0x3c')]};return db[_0x907c('0x2d')]['count'](_0x39b7ed)[_0x907c('0x26')](function(_0x10b370){_0x5b58ee[_0x907c('0x1e')]=_0x10b370;if(_0x5ee598[_0x907c('0x32')][_0x907c('0x3e')]){_0x3171c4['include']=[{'all':!![]}];}return db[_0x907c('0x2d')][_0x907c('0x3f')](_0x3171c4);})['then'](function(_0x1f6be9){_0x5b58ee[_0x907c('0x40')]=_0x1f6be9;return _0x5b58ee;})[_0x907c('0x26')](respondWithFilteredResult(_0x5da345,_0x3171c4))['catch'](handleError(_0x5da345,null));};exports['show']=function(_0x12c632,_0x3d3bb4){var _0x261610={'raw':![],'where':{'id':_0x12c632[_0x907c('0x41')]['id']}},_0x2477fe={};_0x2477fe[_0x907c('0x31')]=_[_0x907c('0x33')](db[_0x907c('0x2d')][_0x907c('0x2e')]);_0x2477fe[_0x907c('0x32')]=_[_0x907c('0x33')](_0x12c632['query']);_0x2477fe['filters']=_['intersection'](_0x2477fe['model'],_0x2477fe[_0x907c('0x32')]);_0x261610['attributes']=_[_0x907c('0x34')](_0x2477fe[_0x907c('0x31')],qs[_0x907c('0x36')](_0x12c632['query'][_0x907c('0x36')]));_0x261610[_0x907c('0x35')]=_0x261610[_0x907c('0x35')]['length']?_0x261610[_0x907c('0x35')]:_0x2477fe[_0x907c('0x31')];if(_0x12c632[_0x907c('0x32')][_0x907c('0x3e')]){_0x261610[_0x907c('0x42')]=[{'all':!![]}];}_0x261610=_[_0x907c('0x3d')]({},_0x261610,_0x12c632[_0x907c('0x43')]);return db[_0x907c('0x2d')][_0x907c('0x44')](_0x261610)['then'](handleEntityNotFound(_0x3d3bb4,null))['then'](respondWithResult(_0x3d3bb4,null))[_0x907c('0x45')](handleError(_0x3d3bb4,null));};exports[_0x907c('0x46')]=function(_0x55439c,_0x243c55){return db[_0x907c('0x2d')][_0x907c('0x46')](_0x55439c[_0x907c('0x47')],{})[_0x907c('0x26')](respondWithResult(_0x243c55,0xc9))[_0x907c('0x45')](handleError(_0x243c55,null));};exports[_0x907c('0x48')]=function(_0x541a18,_0xe960ae){if(_0x541a18['body']['id']){delete _0x541a18[_0x907c('0x47')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x541a18['params']['id']}})[_0x907c('0x26')](handleEntityNotFound(_0xe960ae,null))[_0x907c('0x26')](saveUpdates(_0x541a18[_0x907c('0x47')],null))[_0x907c('0x26')](respondWithResult(_0xe960ae,null))[_0x907c('0x45')](handleError(_0xe960ae,null));};exports['destroy']=function(_0x26241c,_0x1d30f6){return db[_0x907c('0x2d')][_0x907c('0x44')]({'where':{'id':_0x26241c['params']['id']}})[_0x907c('0x26')](handleEntityNotFound(_0x1d30f6,null))[_0x907c('0x26')](removeEntity(_0x1d30f6,null))[_0x907c('0x45')](handleError(_0x1d30f6,null));};exports[_0x907c('0x49')]=function(_0x2f78ac,_0x4a946a,_0x21f149){var _0x37c9b2={};var _0x49322b={};var _0x26fa64;var _0x4be840;return db[_0x907c('0x2d')][_0x907c('0x4a')]({'where':{'id':_0x2f78ac[_0x907c('0x41')]['id']}})[_0x907c('0x26')](handleEntityNotFound(_0x4a946a,null))[_0x907c('0x26')](function(_0x26dc88){if(_0x26dc88){_0x26fa64=_0x26dc88;_0x49322b['model']=_[_0x907c('0x33')](db[_0x907c('0x4b')][_0x907c('0x2e')]);_0x49322b[_0x907c('0x32')]=_[_0x907c('0x33')](_0x2f78ac[_0x907c('0x32')]);_0x49322b['filters']=_[_0x907c('0x34')](_0x49322b['model'],_0x49322b[_0x907c('0x32')]);_0x37c9b2[_0x907c('0x35')]=_[_0x907c('0x34')](_0x49322b['model'],qs[_0x907c('0x36')](_0x2f78ac['query'][_0x907c('0x36')]));_0x37c9b2[_0x907c('0x35')]=_0x37c9b2[_0x907c('0x35')][_0x907c('0x4c')]?_0x37c9b2[_0x907c('0x35')]:_0x49322b['model'];_0x37c9b2[_0x907c('0x38')]=qs[_0x907c('0x39')](_0x2f78ac[_0x907c('0x32')][_0x907c('0x39')]);_0x37c9b2[_0x907c('0x3c')]=qs['filters'](_[_0x907c('0x3b')](_0x2f78ac[_0x907c('0x32')],_0x49322b['filters']));if(_0x2f78ac['query'][_0x907c('0x4d')]){_0x37c9b2[_0x907c('0x3c')]=_[_0x907c('0x3d')](_0x37c9b2['where'],{'$or':_[_0x907c('0x2c')](_0x37c9b2[_0x907c('0x35')],function(_0x21f00d){var _0x387767={};_0x387767[_0x21f00d]={'$like':'%'+_0x2f78ac['query'][_0x907c('0x4d')]+'%'};return _0x387767;})});}_0x37c9b2=_[_0x907c('0x3d')]({},_0x37c9b2,_0x2f78ac[_0x907c('0x43')]);return _0x26fa64['getConfigurations'](_0x37c9b2);}})[_0x907c('0x26')](function(_0x5488e1){if(_0x5488e1){_0x4be840=_0x5488e1[_0x907c('0x4c')];if(!_0x2f78ac['query']['hasOwnProperty'](_0x907c('0x37'))){_0x37c9b2[_0x907c('0x20')]=qs[_0x907c('0x20')](_0x2f78ac[_0x907c('0x32')][_0x907c('0x20')]);_0x37c9b2[_0x907c('0x1f')]=qs[_0x907c('0x1f')](_0x2f78ac[_0x907c('0x32')][_0x907c('0x1f')]);}return _0x26fa64[_0x907c('0x49')](_0x37c9b2);}})['then'](function(_0xd2f556){if(_0xd2f556){return _0xd2f556?{'count':_0x4be840,'rows':_0xd2f556}:null;}})[_0x907c('0x26')](respondWithResult(_0x4a946a,null))[_0x907c('0x45')](handleError(_0x4a946a,null));};exports['addConfiguration']=function(_0x298924,_0x5d1f23,_0xf23b4f){if(_0x298924[_0x907c('0x47')]['id']){delete _0x298924['body']['id'];}return db[_0x907c('0x2d')][_0x907c('0x4a')]({'where':{'id':_0x298924[_0x907c('0x41')]['id']}})[_0x907c('0x26')](handleEntityNotFound(_0x5d1f23,null))[_0x907c('0x26')](function(_0x54df3f){if(_0x54df3f){_0x298924[_0x907c('0x47')][_0x907c('0x4e')]=_0x54df3f['id'];_0x298924[_0x907c('0x47')][_0x907c('0x4f')]=integrations[_0x907c('0x50')](_0x298924[_0x907c('0x47')][_0x907c('0x51')],_0x298924[_0x907c('0x47')][_0x907c('0x52')]);_0x298924['body'][_0x907c('0x53')]=integrations[_0x907c('0x54')](_0x298924['body'][_0x907c('0x51')],_0x298924[_0x907c('0x47')]['type']);return db[_0x907c('0x4b')][_0x907c('0x46')](_0x298924[_0x907c('0x47')],{'include':[{'model':db[_0x907c('0x55')],'as':_0x907c('0x4f')},{'model':db[_0x907c('0x55')],'as':'Descriptions'}]});}return null;})[_0x907c('0x26')](respondWithResult(_0x5d1f23,null))[_0x907c('0x45')](handleError(_0x5d1f23,null));};function getAccessToken(_0x3db5c7){return new Promise(function(_0x5d89fc,_0x161f73){var _0x15481f;switch(_0x3db5c7['zone']){case'US':_0x15481f=_0x907c('0x56');break;case'AU':_0x15481f=_0x907c('0x57');break;case'EU':_0x15481f=_0x907c('0x58');break;case'IN':_0x15481f=_0x907c('0x59');break;case'CN':_0x15481f=_0x907c('0x5a');break;default:_0x15481f=_0x907c('0x58');break;}var _0x5a8f1d={'method':_0x907c('0x5b'),'uri':_0x15481f+_0x907c('0x5c'),'qs':{'refresh_token':_0x3db5c7['refreshToken'],'client_id':_0x3db5c7[_0x907c('0x5d')],'client_secret':_0x3db5c7['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5a8f1d)[_0x907c('0x26')](function(_0xa735f8){if(_0xa735f8[_0x907c('0x5e')]){_0x5d89fc(_0xa735f8[_0x907c('0x5e')]);}else{_0x161f73(_0x907c('0x5f'));}})['catch'](function(_0x4fcde2){_0x161f73(_0x4fcde2);});});}exports['getFields']=function(_0x5c0b26,_0x4f4240,_0x7b8f0){var _0x181f54,_0x83fe94,_0x2cb283,_0x546dee,_0x2a506e;return db[_0x907c('0x2d')]['findOne']({'where':{'id':_0x5c0b26[_0x907c('0x41')]['id']},'attributes':['id',_0x907c('0x60'),_0x907c('0x61'),_0x907c('0x5d'),_0x907c('0x62'),_0x907c('0x63'),_0x907c('0x64'),_0x907c('0x65')]})[_0x907c('0x26')](handleEntityNotFound(_0x4f4240,null))[_0x907c('0x26')](function(_0x574073){_0x2a506e=_0x574073;_0x181f54=_0x2a506e[_0x907c('0x60')];_0x83fe94=_0x181f54===_0x907c('0x66')?'eu':'com';_0x2cb283=_0x2a506e[_0x907c('0x63')];var _0x267409=_0x2cb283[_0x907c('0x67')](-0x1);if(_0x267409==='/'||_0x267409==='\x5c'||_0x267409===':'){_0x2cb283=_0x2cb283[_0x907c('0x68')](0x0,_0x2cb283[_0x907c('0x69')](_0x267409));}if(!_0x2a506e[_0x907c('0x65')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2a506e);})[_0x907c('0x26')](function(_0x22b5fd){if(_0x22b5fd){return rp({'method':_0x907c('0x6a'),'uri':util['format'](_0x907c('0x6b'),_0x83fe94),'qs':{'module':'Calls'},'headers':{'Authorization':_0x907c('0x6c')+_0x22b5fd},'json':!![]});}})['then'](function(_0x1c7c6e){if(_0x1c7c6e){if(_0x1c7c6e[_0x907c('0x6d')]&&_0x1c7c6e[_0x907c('0x6d')][_0x907c('0x27')]){throw new Error(_0x1c7c6e[_0x907c('0x6d')][_0x907c('0x27')]['message']);}var _0x15e8b8=[];var _0x1edc89=[];var _0x276cab=[_0x907c('0x6e'),_0x907c('0x6f'),_0x907c('0x70'),_0x907c('0x71'),_0x907c('0x72'),_0x907c('0x73'),'Call_Start_Time',_0x907c('0x74')];_0x1edc89=_[_0x907c('0x75')](_0x1c7c6e[_0x907c('0x36')],function(_0x259216){return _0x276cab[_0x907c('0x76')](_0x259216['api_name']);});for(var _0x5dc59d=0x0;_0x5dc59d<_0x1edc89[_0x907c('0x4c')];_0x5dc59d++){if(_0x1edc89[_0x5dc59d][_0x907c('0x77')]===![]){_0x15e8b8[_0x907c('0x78')]({'id':_0x1edc89[_0x5dc59d]['id'],'name':_0x1edc89[_0x5dc59d][_0x907c('0x79')],'custom':_0x1edc89[_0x5dc59d][_0x907c('0x7a')],'options':_0x1edc89[_0x5dc59d][_0x907c('0x7b')]===_0x907c('0x7c')&&_0x1edc89[_0x5dc59d][_0x907c('0x7d')][_0x907c('0x4c')]>-0x1?_[_0x907c('0x2c')](_0x1edc89[_0x5dc59d][_0x907c('0x7d')],function(_0x44bcb6){return{'name':_0x44bcb6,'value':_0x44bcb6};}):[]});}}return{'count':_0x15e8b8[_0x907c('0x4c')],'rows':_0x15e8b8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4f4240,null))[_0x907c('0x45')](function(_0x501be5){var _0x591a04=_0x5c0b26[_0x907c('0x32')][_0x907c('0x7e')]?0x1f4:_0x501be5[_0x907c('0x7f')]||0x1f4;logger[_0x907c('0x27')](_0x907c('0x80'),'getFields',_0x591a04,JSON[_0x907c('0x81')](_0x501be5));delete _0x501be5[_0x907c('0x29')];if(_0x591a04===0x191){_0x591a04=0x190;}_0x4f4240[_0x907c('0x1b')](_0x591a04)[_0x907c('0x2a')](_0x5c0b26[_0x907c('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x501be5[_0x907c('0x7f')]}:_0x501be5);});}; \ No newline at end of file +var _0x849a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','update','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','host','zoho.eu','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','key','model'];(function(_0x113f41,_0x160d27){var _0x3ab6f9=function(_0x91cc89){while(--_0x91cc89){_0x113f41['push'](_0x113f41['shift']());}};_0x3ab6f9(++_0x160d27);}(_0x849a,0x1ba));var _0xa849=function(_0x276ad3,_0xe6addd){_0x276ad3=_0x276ad3-0x0;var _0x1555b0=_0x849a[_0x276ad3];return _0x1555b0;};'use strict';var emlformat=require(_0xa849('0x0'));var rimraf=require(_0xa849('0x1'));var zipdir=require(_0xa849('0x2'));var jsonpatch=require(_0xa849('0x3'));var rp=require(_0xa849('0x4'));var moment=require('moment');var BPromise=require(_0xa849('0x5'));var Mustache=require(_0xa849('0x6'));var util=require(_0xa849('0x7'));var path=require(_0xa849('0x8'));var sox=require(_0xa849('0x9'));var csv=require(_0xa849('0xa'));var ejs=require(_0xa849('0xb'));var fs=require('fs');var fs_extra=require(_0xa849('0xc'));var _=require('lodash');var squel=require(_0xa849('0xd'));var crypto=require('crypto');var jsforce=require(_0xa849('0xe'));var deskjs=require(_0xa849('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa849('0x10'));var Papa=require(_0xa849('0x11'));var Redis=require(_0xa849('0x12'));var authService=require(_0xa849('0x13'));var qs=require(_0xa849('0x14'));var as=require(_0xa849('0x15'));var hardwareService=require(_0xa849('0x16'));var logger=require(_0xa849('0x17'))(_0xa849('0x18'));var utils=require(_0xa849('0x19'));var config=require(_0xa849('0x1a'));var licenseUtil=require(_0xa849('0x1b'));var db=require(_0xa849('0x1c'))['db'];var integrations=require(_0xa849('0x1d'));function respondWithStatusCode(_0x42b68b,_0x4597e5){_0x4597e5=_0x4597e5||0xcc;return function(_0x1c3f9c){if(_0x1c3f9c){return _0x42b68b[_0xa849('0x1e')](_0x4597e5);}return _0x42b68b[_0xa849('0x1f')](_0x4597e5)[_0xa849('0x20')]();};}function respondWithResult(_0x10e8ab,_0xc6a8fd){_0xc6a8fd=_0xc6a8fd||0xc8;return function(_0x4c472d){if(_0x4c472d){return _0x10e8ab[_0xa849('0x1f')](_0xc6a8fd)[_0xa849('0x21')](_0x4c472d);}};}function respondWithFilteredResult(_0x2231bf,_0x55707c){return function(_0x38c319){if(_0x38c319){var _0xe6348f=typeof _0x55707c[_0xa849('0x22')]===_0xa849('0x23')&&typeof _0x55707c[_0xa849('0x24')]===_0xa849('0x23');var _0x215c21=_0x38c319[_0xa849('0x25')];var _0x4aa02d=_0xe6348f?0x0:_0x55707c[_0xa849('0x22')];var _0x34c26d=_0xe6348f?_0x38c319[_0xa849('0x25')]:_0x55707c[_0xa849('0x22')]+_0x55707c[_0xa849('0x24')];var _0xb839f3;if(_0x34c26d>=_0x215c21){_0x34c26d=_0x215c21;_0xb839f3=0xc8;}else{_0xb839f3=0xce;}_0x2231bf['status'](_0xb839f3);return _0x2231bf[_0xa849('0x26')](_0xa849('0x27'),_0x4aa02d+'-'+_0x34c26d+'/'+_0x215c21)[_0xa849('0x21')](_0x38c319);}return null;};}function patchUpdates(_0x255afb){return function(_0x48bd5e){try{jsonpatch[_0xa849('0x28')](_0x48bd5e,_0x255afb,!![]);}catch(_0x547997){return BPromise[_0xa849('0x29')](_0x547997);}return _0x48bd5e['save']();};}function saveUpdates(_0xe41c13,_0x2bec){return function(_0x117c6a){if(_0x117c6a){return _0x117c6a['update'](_0xe41c13)[_0xa849('0x2a')](function(_0x556c93){return _0x556c93;});}return null;};}function removeEntity(_0x4f1a0c,_0x1df158){return function(_0x4e08be){if(_0x4e08be){return _0x4e08be[_0xa849('0x2b')]()['then'](function(){_0x4f1a0c[_0xa849('0x1f')](0xcc)[_0xa849('0x20')]();});}};}function handleEntityNotFound(_0x21231b,_0x3bd2c5){return function(_0x54deae){if(!_0x54deae){_0x21231b[_0xa849('0x1e')](0x194);}return _0x54deae;};}function handleError(_0x2aecf1,_0x4fcb93){_0x4fcb93=_0x4fcb93||0x1f4;return function(_0x241cb4){logger[_0xa849('0x2c')](_0x241cb4[_0xa849('0x2d')]);if(_0x241cb4[_0xa849('0x2e')]){delete _0x241cb4[_0xa849('0x2e')];}_0x2aecf1[_0xa849('0x1f')](_0x4fcb93)[_0xa849('0x2f')](_0x241cb4);};}exports[_0xa849('0x30')]=function(_0x71a6a1,_0xa8aa4f){var _0x1708e3={},_0x5eedd4={},_0x48ec9d={'count':0x0,'rows':[]};var _0x58b8e3=_[_0xa849('0x31')](db[_0xa849('0x32')]['rawAttributes'],function(_0x151c18){return{'name':_0x151c18[_0xa849('0x33')],'type':_0x151c18['type'][_0xa849('0x34')]};});_0x5eedd4[_0xa849('0x35')]=_[_0xa849('0x31')](_0x58b8e3,_0xa849('0x2e'));_0x5eedd4[_0xa849('0x36')]=_[_0xa849('0x37')](_0x71a6a1[_0xa849('0x36')]);_0x5eedd4[_0xa849('0x38')]=_[_0xa849('0x39')](_0x5eedd4[_0xa849('0x35')],_0x5eedd4['query']);_0x1708e3[_0xa849('0x3a')]=_[_0xa849('0x39')](_0x5eedd4[_0xa849('0x35')],qs[_0xa849('0x3b')](_0x71a6a1['query'][_0xa849('0x3b')]));_0x1708e3[_0xa849('0x3a')]=_0x1708e3[_0xa849('0x3a')][_0xa849('0x3c')]?_0x1708e3[_0xa849('0x3a')]:_0x5eedd4['model'];if(!_0x71a6a1[_0xa849('0x36')][_0xa849('0x3d')](_0xa849('0x3e'))){_0x1708e3[_0xa849('0x24')]=qs['limit'](_0x71a6a1[_0xa849('0x36')]['limit']);_0x1708e3[_0xa849('0x22')]=qs[_0xa849('0x22')](_0x71a6a1[_0xa849('0x36')][_0xa849('0x22')]);}_0x1708e3[_0xa849('0x3f')]=qs[_0xa849('0x40')](_0x71a6a1[_0xa849('0x36')][_0xa849('0x40')]);_0x1708e3[_0xa849('0x41')]=qs[_0xa849('0x38')](_[_0xa849('0x42')](_0x71a6a1[_0xa849('0x36')],_0x5eedd4[_0xa849('0x38')]),_0x58b8e3);if(_0x71a6a1[_0xa849('0x36')]['filter']){_0x1708e3[_0xa849('0x41')]=_[_0xa849('0x43')](_0x1708e3[_0xa849('0x41')],{'$or':_[_0xa849('0x31')](_0x58b8e3,function(_0x4c0da2){if(_0x4c0da2[_0xa849('0x44')]!==_0xa849('0x45')){var _0x7fd710={};_0x7fd710[_0x4c0da2[_0xa849('0x2e')]]={'$like':'%'+_0x71a6a1[_0xa849('0x36')][_0xa849('0x46')]+'%'};return _0x7fd710;}})});}_0x1708e3=_[_0xa849('0x43')]({},_0x1708e3,_0x71a6a1[_0xa849('0x47')]);var _0x19bbd4={'where':_0x1708e3['where']};return db[_0xa849('0x32')][_0xa849('0x25')](_0x19bbd4)[_0xa849('0x2a')](function(_0x52b9b3){_0x48ec9d[_0xa849('0x25')]=_0x52b9b3;if(_0x71a6a1['query']['includeAll']){_0x1708e3[_0xa849('0x48')]=[{'all':!![]}];}return db[_0xa849('0x32')][_0xa849('0x49')](_0x1708e3);})[_0xa849('0x2a')](function(_0x1f609f){_0x48ec9d[_0xa849('0x4a')]=_0x1f609f;return _0x48ec9d;})[_0xa849('0x2a')](respondWithFilteredResult(_0xa8aa4f,_0x1708e3))['catch'](handleError(_0xa8aa4f,null));};exports[_0xa849('0x4b')]=function(_0x1be6c3,_0x1f9e6c){var _0x741698={'raw':![],'where':{'id':_0x1be6c3['params']['id']}},_0xe107af={};_0xe107af[_0xa849('0x35')]=_[_0xa849('0x37')](db[_0xa849('0x32')][_0xa849('0x4c')]);_0xe107af['query']=_[_0xa849('0x37')](_0x1be6c3['query']);_0xe107af[_0xa849('0x38')]=_[_0xa849('0x39')](_0xe107af[_0xa849('0x35')],_0xe107af[_0xa849('0x36')]);_0x741698['attributes']=_[_0xa849('0x39')](_0xe107af[_0xa849('0x35')],qs[_0xa849('0x3b')](_0x1be6c3[_0xa849('0x36')][_0xa849('0x3b')]));_0x741698['attributes']=_0x741698[_0xa849('0x3a')][_0xa849('0x3c')]?_0x741698['attributes']:_0xe107af[_0xa849('0x35')];if(_0x1be6c3['query'][_0xa849('0x4d')]){_0x741698[_0xa849('0x48')]=[{'all':!![]}];}_0x741698=_['merge']({},_0x741698,_0x1be6c3[_0xa849('0x47')]);return db[_0xa849('0x32')][_0xa849('0x4e')](_0x741698)['then'](handleEntityNotFound(_0x1f9e6c,null))[_0xa849('0x2a')](respondWithResult(_0x1f9e6c,null))[_0xa849('0x4f')](handleError(_0x1f9e6c,null));};exports[_0xa849('0x50')]=function(_0xfa50d2,_0x2ca0cb){return db['ZohoAccount'][_0xa849('0x50')](_0xfa50d2[_0xa849('0x51')],{})[_0xa849('0x2a')](respondWithResult(_0x2ca0cb,0xc9))['catch'](handleError(_0x2ca0cb,null));};exports[_0xa849('0x52')]=function(_0x3a196f,_0x4ae7e2){if(_0x3a196f['body']['id']){delete _0x3a196f[_0xa849('0x51')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x3a196f[_0xa849('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ae7e2,null))[_0xa849('0x2a')](saveUpdates(_0x3a196f[_0xa849('0x51')],null))[_0xa849('0x2a')](respondWithResult(_0x4ae7e2,null))[_0xa849('0x4f')](handleError(_0x4ae7e2,null));};exports[_0xa849('0x2b')]=function(_0x2314b0,_0x15e3d0){return db[_0xa849('0x32')][_0xa849('0x4e')]({'where':{'id':_0x2314b0['params']['id']}})['then'](handleEntityNotFound(_0x15e3d0,null))[_0xa849('0x2a')](removeEntity(_0x15e3d0,null))[_0xa849('0x4f')](handleError(_0x15e3d0,null));};exports[_0xa849('0x54')]=function(_0xcad211,_0x2ce32a,_0x5a0dbc){var _0x40959f={};var _0x58c33d={};var _0x2fb86f;var _0xdded84;return db[_0xa849('0x32')][_0xa849('0x55')]({'where':{'id':_0xcad211[_0xa849('0x53')]['id']}})[_0xa849('0x2a')](handleEntityNotFound(_0x2ce32a,null))[_0xa849('0x2a')](function(_0x54e685){if(_0x54e685){_0x2fb86f=_0x54e685;_0x58c33d['model']=_['keys'](db[_0xa849('0x56')][_0xa849('0x4c')]);_0x58c33d[_0xa849('0x36')]=_[_0xa849('0x37')](_0xcad211[_0xa849('0x36')]);_0x58c33d[_0xa849('0x38')]=_[_0xa849('0x39')](_0x58c33d[_0xa849('0x35')],_0x58c33d['query']);_0x40959f[_0xa849('0x3a')]=_[_0xa849('0x39')](_0x58c33d[_0xa849('0x35')],qs[_0xa849('0x3b')](_0xcad211['query'][_0xa849('0x3b')]));_0x40959f[_0xa849('0x3a')]=_0x40959f[_0xa849('0x3a')][_0xa849('0x3c')]?_0x40959f[_0xa849('0x3a')]:_0x58c33d['model'];_0x40959f[_0xa849('0x3f')]=qs['sort'](_0xcad211[_0xa849('0x36')][_0xa849('0x40')]);_0x40959f[_0xa849('0x41')]=qs[_0xa849('0x38')](_[_0xa849('0x42')](_0xcad211[_0xa849('0x36')],_0x58c33d[_0xa849('0x38')]));if(_0xcad211[_0xa849('0x36')][_0xa849('0x46')]){_0x40959f[_0xa849('0x41')]=_['merge'](_0x40959f[_0xa849('0x41')],{'$or':_['map'](_0x40959f[_0xa849('0x3a')],function(_0x114136){var _0x1f716f={};_0x1f716f[_0x114136]={'$like':'%'+_0xcad211[_0xa849('0x36')][_0xa849('0x46')]+'%'};return _0x1f716f;})});}_0x40959f=_['merge']({},_0x40959f,_0xcad211['options']);return _0x2fb86f[_0xa849('0x54')](_0x40959f);}})[_0xa849('0x2a')](function(_0x18eff6){if(_0x18eff6){_0xdded84=_0x18eff6[_0xa849('0x3c')];if(!_0xcad211[_0xa849('0x36')][_0xa849('0x3d')](_0xa849('0x3e'))){_0x40959f[_0xa849('0x24')]=qs['limit'](_0xcad211[_0xa849('0x36')]['limit']);_0x40959f[_0xa849('0x22')]=qs[_0xa849('0x22')](_0xcad211[_0xa849('0x36')][_0xa849('0x22')]);}return _0x2fb86f[_0xa849('0x54')](_0x40959f);}})['then'](function(_0x156f35){if(_0x156f35){return _0x156f35?{'count':_0xdded84,'rows':_0x156f35}:null;}})[_0xa849('0x2a')](respondWithResult(_0x2ce32a,null))[_0xa849('0x4f')](handleError(_0x2ce32a,null));};exports[_0xa849('0x57')]=function(_0x2db752,_0x130c71,_0x3c2e85){if(_0x2db752[_0xa849('0x51')]['id']){delete _0x2db752[_0xa849('0x51')]['id'];}return db[_0xa849('0x32')][_0xa849('0x55')]({'where':{'id':_0x2db752[_0xa849('0x53')]['id']}})[_0xa849('0x2a')](handleEntityNotFound(_0x130c71,null))['then'](function(_0x4986da){if(_0x4986da){_0x2db752['body']['AccountId']=_0x4986da['id'];_0x2db752[_0xa849('0x51')][_0xa849('0x58')]=integrations[_0xa849('0x59')](_0x2db752['body'][_0xa849('0x5a')],_0x2db752['body'][_0xa849('0x44')]);_0x2db752[_0xa849('0x51')]['Descriptions']=integrations[_0xa849('0x5b')](_0x2db752[_0xa849('0x51')][_0xa849('0x5a')],_0x2db752[_0xa849('0x51')][_0xa849('0x44')]);return db[_0xa849('0x56')]['create'](_0x2db752[_0xa849('0x51')],{'include':[{'model':db['ZohoField'],'as':_0xa849('0x58')},{'model':db[_0xa849('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x130c71,null))[_0xa849('0x4f')](handleError(_0x130c71,null));};function getAccessToken(_0x145b43){return new Promise(function(_0x21d593,_0x43b710){var _0x32fc88;switch(_0x145b43[_0xa849('0x5d')]){case'US':_0x32fc88='https://accounts.zoho.com';break;case'AU':_0x32fc88=_0xa849('0x5e');break;case'EU':_0x32fc88=_0xa849('0x5f');break;case'IN':_0x32fc88=_0xa849('0x60');break;case'CN':_0x32fc88=_0xa849('0x61');break;default:_0x32fc88='https://accounts.zoho.eu';break;}var _0x1ee13d={'method':_0xa849('0x62'),'uri':_0x32fc88+'/oauth/v2/token','qs':{'refresh_token':_0x145b43[_0xa849('0x63')],'client_id':_0x145b43[_0xa849('0x64')],'client_secret':_0x145b43[_0xa849('0x65')],'grant_type':_0xa849('0x66')},'json':!![]};return rp(_0x1ee13d)[_0xa849('0x2a')](function(_0x305999){if(_0x305999[_0xa849('0x67')]){_0x21d593(_0x305999[_0xa849('0x67')]);}else{_0x43b710('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x36883e){_0x43b710(_0x36883e);});});}exports[_0xa849('0x68')]=function(_0x1e76c3,_0x170962,_0x5556ad){var _0x818629,_0x3e71c2,_0x505f2f,_0x328310,_0x2ee777;return db['ZohoAccount'][_0xa849('0x55')]({'where':{'id':_0x1e76c3[_0xa849('0x53')]['id']},'attributes':['id','host','zone',_0xa849('0x64'),'clientSecret',_0xa849('0x69'),'code',_0xa849('0x63')]})[_0xa849('0x2a')](handleEntityNotFound(_0x170962,null))[_0xa849('0x2a')](function(_0x301dc3){_0x2ee777=_0x301dc3;_0x818629=_0x2ee777[_0xa849('0x6a')];_0x3e71c2=_0x818629===_0xa849('0x6b')?'eu':'com';_0x505f2f=_0x2ee777[_0xa849('0x69')];var _0x560a16=_0x505f2f['slice'](-0x1);if(_0x560a16==='/'||_0x560a16==='\x5c'||_0x560a16===':'){_0x505f2f=_0x505f2f['substring'](0x0,_0x505f2f[_0xa849('0x6c')](_0x560a16));}if(!_0x2ee777[_0xa849('0x63')]){throw new Error(_0xa849('0x6d'));}return getAccessToken(_0x2ee777);})[_0xa849('0x2a')](function(_0x1a21af){if(_0x1a21af){return rp({'method':_0xa849('0x6e'),'uri':util[_0xa849('0x6f')](_0xa849('0x70'),_0x3e71c2),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa849('0x71')+_0x1a21af},'json':!![]});}})[_0xa849('0x2a')](function(_0xe18cb6){if(_0xe18cb6){if(_0xe18cb6['response']&&_0xe18cb6[_0xa849('0x72')][_0xa849('0x2c')]){throw new Error(_0xe18cb6[_0xa849('0x72')][_0xa849('0x2c')]['message']);}var _0x3fc68c=[];var _0x52bee8=[];var _0x549ccf=[_0xa849('0x73'),'Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type'];_0x52bee8=_['remove'](_0xe18cb6['fields'],function(_0x431591){return _0x549ccf['includes'](_0x431591[_0xa849('0x74')]);});for(var _0x4cefbf=0x0;_0x4cefbf<_0x52bee8[_0xa849('0x3c')];_0x4cefbf++){if(_0x52bee8[_0x4cefbf][_0xa849('0x75')]===![]){_0x3fc68c[_0xa849('0x76')]({'id':_0x52bee8[_0x4cefbf]['id'],'name':_0x52bee8[_0x4cefbf]['display_label'],'custom':_0x52bee8[_0x4cefbf]['custom_field'],'options':_0x52bee8[_0x4cefbf]['data_type']===_0xa849('0x77')&&_0x52bee8[_0x4cefbf]['pick_list_values'][_0xa849('0x3c')]>-0x1?_['map'](_0x52bee8[_0x4cefbf][_0xa849('0x78')],function(_0x57991c){return{'name':_0x57991c,'value':_0x57991c};}):[]});}}return{'count':_0x3fc68c[_0xa849('0x3c')],'rows':_0x3fc68c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x170962,null))[_0xa849('0x4f')](function(_0x46cdef){var _0x33d31b=_0x1e76c3[_0xa849('0x36')][_0xa849('0x79')]?0x1f4:_0x46cdef[_0xa849('0x7a')]||0x1f4;logger[_0xa849('0x2c')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x33d31b,JSON['stringify'](_0x46cdef));delete _0x46cdef[_0xa849('0x2e')];if(_0x33d31b===0x191){_0x33d31b=0x190;}_0x170962[_0xa849('0x1f')](_0x33d31b)[_0xa849('0x2f')](_0x1e76c3['query']['test']?{'message':_0xa849('0x7b'),'statusCode':_0x46cdef[_0xa849('0x7a')]}:_0x46cdef);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ba550b5..005b1ca 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 _0x5e9a=['https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','name','format','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intZohoAccount.attributes','define','changed','zone','serverUrl','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5e9a,0x160));var _0xa5e9=function(_0x1e117b,_0x5e0e9e){_0x1e117b=_0x1e117b-0x0;var _0x5ea37e=_0x5e9a[_0x1e117b];return _0x5ea37e;};'use strict';var _=require(_0xa5e9('0x0'));var util=require(_0xa5e9('0x1'));var logger=require(_0xa5e9('0x2'))(_0xa5e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa5e9('0x4'));var fs=require('fs');var path=require(_0xa5e9('0x5'));var rimraf=require(_0xa5e9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5e9('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x126d09,_0x251e1c){return _0x126d09[_0xa5e9('0x8')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b1191,_0x578d49,_0x74fa93){if(_0x5b1191[_0xa5e9('0x9')](_0xa5e9('0xa'))||_0x5b1191['changed'](_0xa5e9('0xb'))||_0x5b1191['changed']('clientId')||_0x5b1191[_0xa5e9('0x9')]('clientSecret')||_0x5b1191[_0xa5e9('0x9')](_0xa5e9('0xc'))||_0x5b1191[_0xa5e9('0x9')](_0xa5e9('0xd'))){var _0x2d30c3,_0x592aad;_0x2d30c3=_0x5b1191[_0xa5e9('0xb')];var _0x4325d8=_0x2d30c3[_0xa5e9('0xe')](-0x1);if(_0x4325d8==='/'||_0x4325d8==='\x5c'||_0x4325d8===':'){_0x2d30c3=_0x2d30c3['substring'](0x0,_0x2d30c3[_0xa5e9('0xf')](_0x4325d8));}switch(_0x5b1191[_0xa5e9('0xa')]){case'US':_0x592aad=_0xa5e9('0x10');break;case'AU':_0x592aad=_0xa5e9('0x11');break;case'IN':_0x592aad=_0xa5e9('0x12');break;case'CN':_0x592aad=_0xa5e9('0x13');break;default:_0x592aad=_0xa5e9('0x14');break;}var _0x4382e1={'method':_0xa5e9('0x15'),'uri':_0x592aad+_0xa5e9('0x16'),'form':{'grant_type':_0xa5e9('0x17'),'client_id':_0x5b1191[_0xa5e9('0x18')],'client_secret':_0x5b1191[_0xa5e9('0x19')],'redirect_uri':_0x5b1191['serverUrl'],'code':_0x5b1191[_0xa5e9('0xc')]},'headers':{'Content-Type':_0xa5e9('0x1a')}};return rp(_0x4382e1)[_0xa5e9('0x1b')](function(_0x55fdfd){var _0x3a95ae=JSON['parse'](_0x55fdfd);if(_0x3a95ae[_0xa5e9('0x1c')]){_0x5b1191[_0xa5e9('0x1d')]=_0x3a95ae[_0xa5e9('0x1c')];logger[_0xa5e9('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5b1191[_0xa5e9('0x1f')],_0x5b1191['id']));}else{logger['error'](util[_0xa5e9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5b1191['name'],_0x5b1191['id']),util[_0xa5e9('0x21')](_0x3a95ae,{'showHidden':![],'depth':null}));}return _0x74fa93(null,_0x578d49);})['catch'](function(_0x4b7f17){logger['error'](util[_0xa5e9('0x20')](_0xa5e9('0x22'),_0x5b1191[_0xa5e9('0x1f')],_0x5b1191['id']),util[_0xa5e9('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x74fa93(_0x4b7f17);});}else{return _0x74fa93(null,_0x578d49);}},'beforeUpdate':function(_0x44fb26,_0x44038b,_0x32ff93){if(_0x44fb26[_0xa5e9('0x9')](_0xa5e9('0xa'))||_0x44fb26['changed']('serverUrl')||_0x44fb26['changed'](_0xa5e9('0x18'))||_0x44fb26[_0xa5e9('0x9')]('clientSecret')||_0x44fb26['changed']('code')||_0x44fb26[_0xa5e9('0x9')](_0xa5e9('0xd'))){var _0x42fa77,_0x2e72ad;_0x42fa77=_0x44fb26[_0xa5e9('0xb')];var _0x28a6e4=_0x42fa77['slice'](-0x1);if(_0x28a6e4==='/'||_0x28a6e4==='\x5c'||_0x28a6e4===':'){_0x42fa77=_0x42fa77['substring'](0x0,_0x42fa77[_0xa5e9('0xf')](_0x28a6e4));}switch(_0x44fb26[_0xa5e9('0xa')]){case'US':_0x2e72ad=_0xa5e9('0x10');break;case'AU':_0x2e72ad='https://accounts.zoho.com.au';break;case'IN':_0x2e72ad=_0xa5e9('0x12');break;case'CN':_0x2e72ad=_0xa5e9('0x13');break;default:_0x2e72ad=_0xa5e9('0x14');break;}var _0x32973e={'method':_0xa5e9('0x15'),'uri':_0x2e72ad+_0xa5e9('0x16'),'form':{'grant_type':_0xa5e9('0x17'),'client_id':_0x44fb26[_0xa5e9('0x18')],'client_secret':_0x44fb26[_0xa5e9('0x19')],'redirect_uri':_0x44fb26[_0xa5e9('0xb')],'code':_0x44fb26['code']},'headers':{'Content-Type':_0xa5e9('0x1a')}};return rp(_0x32973e)[_0xa5e9('0x1b')](function(_0xbb7ab8){var _0x4fa6bf=JSON['parse'](_0xbb7ab8);if(_0x4fa6bf[_0xa5e9('0x1c')]){_0x44fb26[_0xa5e9('0x1d')]=_0x4fa6bf[_0xa5e9('0x1c')];logger[_0xa5e9('0x1e')](util[_0xa5e9('0x20')](_0xa5e9('0x23'),_0x44fb26[_0xa5e9('0x1f')],_0x44fb26['id']));}else{logger[_0xa5e9('0x24')](util[_0xa5e9('0x20')](_0xa5e9('0x22'),_0x44fb26[_0xa5e9('0x1f')],_0x44fb26['id']),util['inspect'](_0x4fa6bf,{'showHidden':![],'depth':null}));}return _0x32ff93(null,_0x44038b);})['catch'](function(_0x49ed9e){logger[_0xa5e9('0x24')](util['format'](_0xa5e9('0x22'),_0x44fb26[_0xa5e9('0x1f')],_0x44fb26['id']),util[_0xa5e9('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x32ff93(_0x49ed9e);});}else{return _0x32ff93(null,_0x44038b);}}}});}; \ No newline at end of file +var _0x75ab=['../../components/integrations/configuration','exports','define','changed','serverUrl','clientId','clientSecret','code','host','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.in','https://accounts.zoho.eu','parse','refresh_token','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes'];(function(_0x89941,_0x3357ef){var _0x11eca3=function(_0x3203e2){while(--_0x3203e2){_0x89941['push'](_0x89941['shift']());}};_0x11eca3(++_0x3357ef);}(_0x75ab,0xed));var _0xb75a=function(_0x1ca42b,_0x47dbbb){_0x1ca42b=_0x1ca42b-0x0;var _0x18b0aa=_0x75ab[_0x1ca42b];return _0x18b0aa;};'use strict';var _=require('lodash');var util=require(_0xb75a('0x0'));var logger=require(_0xb75a('0x1'))(_0xb75a('0x2'));var moment=require(_0xb75a('0x3'));var BPromise=require(_0xb75a('0x4'));var rp=require(_0xb75a('0x5'));var fs=require('fs');var path=require(_0xb75a('0x6'));var rimraf=require('rimraf');var config=require(_0xb75a('0x7'));var attributes=require(_0xb75a('0x8'));var integrations=require(_0xb75a('0x9'));module[_0xb75a('0xa')]=function(_0x34e8a,_0x38c109){return _0x34e8a[_0xb75a('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4684e0,_0x33c5b5,_0x8309a2){if(_0x4684e0[_0xb75a('0xc')]('zone')||_0x4684e0[_0xb75a('0xc')](_0xb75a('0xd'))||_0x4684e0[_0xb75a('0xc')](_0xb75a('0xe'))||_0x4684e0[_0xb75a('0xc')](_0xb75a('0xf'))||_0x4684e0['changed'](_0xb75a('0x10'))||_0x4684e0[_0xb75a('0xc')](_0xb75a('0x11'))){var _0x5c58e9,_0x2ef9bc;_0x5c58e9=_0x4684e0['serverUrl'];var _0xd0056d=_0x5c58e9['slice'](-0x1);if(_0xd0056d==='/'||_0xd0056d==='\x5c'||_0xd0056d===':'){_0x5c58e9=_0x5c58e9[_0xb75a('0x12')](0x0,_0x5c58e9['lastIndexOf'](_0xd0056d));}switch(_0x4684e0[_0xb75a('0x13')]){case'US':_0x2ef9bc=_0xb75a('0x14');break;case'AU':_0x2ef9bc=_0xb75a('0x15');break;case'IN':_0x2ef9bc='https://accounts.zoho.in';break;case'CN':_0x2ef9bc=_0xb75a('0x16');break;default:_0x2ef9bc='https://accounts.zoho.eu';break;}var _0x180d57={'method':_0xb75a('0x17'),'uri':_0x2ef9bc+_0xb75a('0x18'),'form':{'grant_type':_0xb75a('0x19'),'client_id':_0x4684e0['clientId'],'client_secret':_0x4684e0['clientSecret'],'redirect_uri':_0x4684e0[_0xb75a('0xd')],'code':_0x4684e0['code']},'headers':{'Content-Type':_0xb75a('0x1a')}};return rp(_0x180d57)[_0xb75a('0x1b')](function(_0x4a7880){var _0x1395da=JSON['parse'](_0x4a7880);if(_0x1395da['refresh_token']){_0x4684e0[_0xb75a('0x1c')]=_0x1395da['refresh_token'];logger[_0xb75a('0x1d')](util[_0xb75a('0x1e')](_0xb75a('0x1f'),_0x4684e0[_0xb75a('0x20')],_0x4684e0['id']));}else{logger[_0xb75a('0x21')](util[_0xb75a('0x1e')](_0xb75a('0x22'),_0x4684e0[_0xb75a('0x20')],_0x4684e0['id']),util[_0xb75a('0x23')](_0x1395da,{'showHidden':![],'depth':null}));}return _0x8309a2(null,_0x33c5b5);})[_0xb75a('0x24')](function(_0x464beb){logger[_0xb75a('0x21')](util[_0xb75a('0x1e')](_0xb75a('0x22'),_0x4684e0[_0xb75a('0x20')],_0x4684e0['id']),util[_0xb75a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x8309a2(_0x464beb);});}else{return _0x8309a2(null,_0x33c5b5);}},'beforeUpdate':function(_0x84e1b2,_0x2a7876,_0x518f9b){if(_0x84e1b2[_0xb75a('0xc')]('zone')||_0x84e1b2['changed'](_0xb75a('0xd'))||_0x84e1b2['changed'](_0xb75a('0xe'))||_0x84e1b2[_0xb75a('0xc')](_0xb75a('0xf'))||_0x84e1b2['changed'](_0xb75a('0x10'))||_0x84e1b2[_0xb75a('0xc')](_0xb75a('0x11'))){var _0x15f2e3,_0x2bae2c;_0x15f2e3=_0x84e1b2['serverUrl'];var _0x2d6d23=_0x15f2e3['slice'](-0x1);if(_0x2d6d23==='/'||_0x2d6d23==='\x5c'||_0x2d6d23===':'){_0x15f2e3=_0x15f2e3[_0xb75a('0x12')](0x0,_0x15f2e3['lastIndexOf'](_0x2d6d23));}switch(_0x84e1b2[_0xb75a('0x13')]){case'US':_0x2bae2c=_0xb75a('0x14');break;case'AU':_0x2bae2c=_0xb75a('0x15');break;case'IN':_0x2bae2c=_0xb75a('0x25');break;case'CN':_0x2bae2c='https://accounts.zoho.com.cn';break;default:_0x2bae2c=_0xb75a('0x26');break;}var _0x1267ff={'method':_0xb75a('0x17'),'uri':_0x2bae2c+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x84e1b2[_0xb75a('0xe')],'client_secret':_0x84e1b2[_0xb75a('0xf')],'redirect_uri':_0x84e1b2[_0xb75a('0xd')],'code':_0x84e1b2[_0xb75a('0x10')]},'headers':{'Content-Type':_0xb75a('0x1a')}};return rp(_0x1267ff)[_0xb75a('0x1b')](function(_0x252435){var _0x3930b5=JSON[_0xb75a('0x27')](_0x252435);if(_0x3930b5[_0xb75a('0x28')]){_0x84e1b2[_0xb75a('0x1c')]=_0x3930b5[_0xb75a('0x28')];logger['info'](util[_0xb75a('0x1e')](_0xb75a('0x1f'),_0x84e1b2['name'],_0x84e1b2['id']));}else{logger['error'](util['format'](_0xb75a('0x22'),_0x84e1b2[_0xb75a('0x20')],_0x84e1b2['id']),util[_0xb75a('0x23')](_0x3930b5,{'showHidden':![],'depth':null}));}return _0x518f9b(null,_0x2a7876);})[_0xb75a('0x24')](function(_0x3b9564){logger[_0xb75a('0x21')](util['format'](_0xb75a('0x22'),_0x84e1b2[_0xb75a('0x20')],_0x84e1b2['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x518f9b(_0x3b9564);});}else{return _0x518f9b(null,_0x2a7876);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 644b76b..6746754 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 _0x404d=['stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','find','debug','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1b750b,_0x169ef9){var _0xd300b3=function(_0x244e01){while(--_0x244e01){_0x1b750b['push'](_0x1b750b['shift']());}};_0xd300b3(++_0x169ef9);}(_0x404d,0x1e9));var _0xd404=function(_0x1010f0,_0x5b5042){_0x1010f0=_0x1010f0-0x0;var _0x5617a1=_0x404d[_0x1010f0];return _0x5617a1;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7faf39,_0x5da99f,_0x5c335f){return new BPromise(function(_0x10021a,_0x3d7e8a){return client['request'](_0x7faf39,_0x5c335f)['then'](function(_0x3096f0){logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5da99f,_0xd404('0xe'),JSON[_0xd404('0xf')](_0x3096f0));if(_0x3096f0['error']){if(_0x3096f0[_0xd404('0x10')][_0xd404('0x11')]===0x1f4){logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x3d7e8a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x10021a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}else{logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));_0x10021a(_0x3096f0[_0xd404('0x13')][_0xd404('0x12')]);}})[_0xd404('0x14')](function(_0x155186){logger['error'](_0xd404('0xd'),_0x5da99f,_0x155186);_0x3d7e8a(_0x155186);});});}exports[_0xd404('0x15')]=function(_0x5e19e4){var _0x3a5a16=this;return new Promise(function(_0x149fa5,_0x5e15c0){return db[_0xd404('0x16')][_0xd404('0x17')]({'raw':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4['options'][_0xd404('0x19')]===undefined?!![]:![]:!![],'where':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1a')]||null:null,'attributes':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1b')]||null:null,'limit':_0x5e19e4['options']?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1c')]||null:null,'include':_0x5e19e4['options']?_0x5e19e4[_0xd404('0x18')]['include']?_['map'](_0x5e19e4[_0xd404('0x18')][_0xd404('0x1d')],function(_0x133232){return{'model':db[_0x133232[_0xd404('0x1e')]],'as':_0x133232['as'],'attributes':_0x133232['attributes'],'include':_0x133232[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x133232[_0xd404('0x1d')],function(_0x55cfde){return{'model':db[_0x55cfde['model']],'as':_0x55cfde['as'],'attributes':_0x55cfde[_0xd404('0x1b')],'include':_0x55cfde[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x55cfde[_0xd404('0x1d')],function(_0x1ddf0d){return{'model':db[_0x1ddf0d[_0xd404('0x1e')]],'as':_0x1ddf0d['as'],'attributes':_0x1ddf0d[_0xd404('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd404('0x20')](function(_0x586b97){logger['info'](_0xd404('0x15'),_0x5e19e4);logger['debug'](_0xd404('0x15'),_0x5e19e4,JSON['stringify'](_0x586b97));_0x149fa5(_0x586b97);})[_0xd404('0x14')](function(_0x1e6341){logger[_0xd404('0x10')](_0xd404('0x15'),_0x1e6341[_0xd404('0x12')],_0x5e19e4);_0x5e15c0(_0x3a5a16[_0xd404('0x10')](0x1f4,_0x1e6341[_0xd404('0x12')]));});});};exports['ShowZohoAccount']=function(_0x585b67){var _0xc60d87=this;return new Promise(function(_0x541c78,_0x51663f){return db[_0xd404('0x16')][_0xd404('0x21')]({'raw':_0x585b67[_0xd404('0x18')]?_0x585b67['options'][_0xd404('0x19')]===undefined?!![]:![]:!![],'where':_0x585b67['options']?_0x585b67[_0xd404('0x18')][_0xd404('0x1a')]||null:null,'attributes':_0x585b67['options']?_0x585b67[_0xd404('0x18')][_0xd404('0x1b')]||null:null,'include':_0x585b67[_0xd404('0x18')]?_0x585b67[_0xd404('0x18')][_0xd404('0x1d')]?_['map'](_0x585b67[_0xd404('0x18')][_0xd404('0x1d')],function(_0x39a3d0){return{'model':db[_0x39a3d0['model']],'as':_0x39a3d0['as'],'attributes':_0x39a3d0[_0xd404('0x1b')],'include':_0x39a3d0[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x39a3d0[_0xd404('0x1d')],function(_0x5a6389){return{'model':db[_0x5a6389['model']],'as':_0x5a6389['as'],'attributes':_0x5a6389[_0xd404('0x1b')],'include':_0x5a6389[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x5a6389[_0xd404('0x1d')],function(_0x3ad796){return{'model':db[_0x3ad796[_0xd404('0x1e')]],'as':_0x3ad796['as'],'attributes':_0x3ad796['attributes']};}):[]};}):[]};}):[]:[]})[_0xd404('0x20')](function(_0xd143f3){logger[_0xd404('0xc')]('ShowZohoAccount',_0x585b67);logger[_0xd404('0x22')](_0xd404('0x23'),_0x585b67,JSON[_0xd404('0xf')](_0xd143f3));_0x541c78(_0xd143f3);})['catch'](function(_0x32d376){logger[_0xd404('0x10')](_0xd404('0x23'),_0x32d376['message'],_0x585b67);_0x51663f(_0xc60d87[_0xd404('0x10')](0x1f4,_0x32d376[_0xd404('0x12')]));});});}; \ No newline at end of file +var _0x4910=['attributes','include','model','map','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x4910,0x1d9));var _0x0491=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4910[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require('bluebird');var rs=require(_0x0491('0x3'));var fs=require('fs');var Redis=require(_0x0491('0x4'));var db=require(_0x0491('0x5'))['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))('rpc');var config=require(_0x0491('0x8'));var jayson=require(_0x0491('0x9'));var client=jayson[_0x0491('0xa')][_0x0491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27e7d5,_0x4ba9e5,_0x3b7b10){return new BPromise(function(_0x29c0d0,_0xf50a53){return client[_0x0491('0xc')](_0x27e7d5,_0x3b7b10)[_0x0491('0xd')](function(_0x4822d5){logger[_0x0491('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x4ba9e5,_0x0491('0xf'));logger[_0x0491('0x10')](_0x0491('0x11'),_0x4ba9e5,_0x0491('0xf'),JSON[_0x0491('0x12')](_0x4822d5));if(_0x4822d5[_0x0491('0x13')]){if(_0x4822d5[_0x0491('0x13')][_0x0491('0x14')]===0x1f4){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x4822d5['error'][_0x0491('0x16')]);return _0xf50a53(_0x4822d5['error'][_0x0491('0x16')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4ba9e5,_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);return _0x29c0d0(_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);}else{logger[_0x0491('0xe')](_0x0491('0x15'),_0x4ba9e5,_0x0491('0xf'));_0x29c0d0(_0x4822d5[_0x0491('0x17')][_0x0491('0x16')]);}})[_0x0491('0x18')](function(_0x527415){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x527415);_0xf50a53(_0x527415);});});}exports[_0x0491('0x19')]=function(_0x31bc2c){var _0x3b536e=this;return new Promise(function(_0xc02328,_0x4ba009){return db[_0x0491('0x1a')][_0x0491('0x1b')]({'raw':_0x31bc2c['options']?_0x31bc2c['options'][_0x0491('0x1c')]===undefined?!![]:![]:!![],'where':_0x31bc2c['options']?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x1e')]||null:null,'attributes':_0x31bc2c['options']?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x1f')]||null:null,'limit':_0x31bc2c[_0x0491('0x1d')]?_0x31bc2c[_0x0491('0x1d')]['limit']||null:null,'include':_0x31bc2c[_0x0491('0x1d')]?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x20')]?_['map'](_0x31bc2c[_0x0491('0x1d')][_0x0491('0x20')],function(_0x31c4ba){return{'model':db[_0x31c4ba[_0x0491('0x21')]],'as':_0x31c4ba['as'],'attributes':_0x31c4ba[_0x0491('0x1f')],'include':_0x31c4ba[_0x0491('0x20')]?_[_0x0491('0x22')](_0x31c4ba['include'],function(_0x7c03ef){return{'model':db[_0x7c03ef[_0x0491('0x21')]],'as':_0x7c03ef['as'],'attributes':_0x7c03ef[_0x0491('0x1f')],'include':_0x7c03ef[_0x0491('0x20')]?_[_0x0491('0x22')](_0x7c03ef['include'],function(_0x12ebdb){return{'model':db[_0x12ebdb[_0x0491('0x21')]],'as':_0x12ebdb['as'],'attributes':_0x12ebdb[_0x0491('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0491('0xd')](function(_0xe0e31e){logger[_0x0491('0xe')](_0x0491('0x19'),_0x31bc2c);logger[_0x0491('0x10')](_0x0491('0x19'),_0x31bc2c,JSON[_0x0491('0x12')](_0xe0e31e));_0xc02328(_0xe0e31e);})['catch'](function(_0x4fbeb8){logger['error']('GetZohoAccount',_0x4fbeb8[_0x0491('0x16')],_0x31bc2c);_0x4ba009(_0x3b536e['error'](0x1f4,_0x4fbeb8[_0x0491('0x16')]));});});};exports[_0x0491('0x23')]=function(_0x3b66d0){var _0x7d4feb=this;return new Promise(function(_0x2e3223,_0x18278b){return db[_0x0491('0x1a')]['find']({'raw':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0[_0x0491('0x1d')][_0x0491('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0['options']['where']||null:null,'attributes':_0x3b66d0['options']?_0x3b66d0[_0x0491('0x1d')]['attributes']||null:null,'include':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0[_0x0491('0x1d')][_0x0491('0x20')]?_[_0x0491('0x22')](_0x3b66d0[_0x0491('0x1d')][_0x0491('0x20')],function(_0x17b4ee){return{'model':db[_0x17b4ee[_0x0491('0x21')]],'as':_0x17b4ee['as'],'attributes':_0x17b4ee['attributes'],'include':_0x17b4ee[_0x0491('0x20')]?_['map'](_0x17b4ee[_0x0491('0x20')],function(_0x16ef85){return{'model':db[_0x16ef85['model']],'as':_0x16ef85['as'],'attributes':_0x16ef85[_0x0491('0x1f')],'include':_0x16ef85['include']?_[_0x0491('0x22')](_0x16ef85[_0x0491('0x20')],function(_0x404b74){return{'model':db[_0x404b74[_0x0491('0x21')]],'as':_0x404b74['as'],'attributes':_0x404b74['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bff9c){logger[_0x0491('0xe')](_0x0491('0x23'),_0x3b66d0);logger['debug'](_0x0491('0x23'),_0x3b66d0,JSON['stringify'](_0x2bff9c));_0x2e3223(_0x2bff9c);})[_0x0491('0x18')](function(_0x524387){logger[_0x0491('0x13')](_0x0491('0x23'),_0x524387[_0x0491('0x16')],_0x3b66d0);_0x18278b(_0x7d4feb['error'](0x1f4,_0x524387['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ffc8f67..67951a4 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 _0x3ad2=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0xc0a7a6,_0x5cc59c){var _0x3cb01a=function(_0xd35f72){while(--_0xd35f72){_0xc0a7a6['push'](_0xc0a7a6['shift']());}};_0x3cb01a(++_0x5cc59c);}(_0x3ad2,0x1f0));var _0x23ad=function(_0x7b534f,_0x8e91bc){_0x7b534f=_0x7b534f-0x0;var _0x2fae25=_0x3ad2[_0x7b534f];return _0x2fae25;};'use strict';var multer=require(_0x23ad('0x0'));var util=require(_0x23ad('0x1'));var path=require(_0x23ad('0x2'));var timeout=require(_0x23ad('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x23ad('0x5'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x23ad('0x6')]('/',auth[_0x23ad('0x7')](),controller['index']);router['get']('/:id',auth[_0x23ad('0x7')](),controller['show']);router['get'](_0x23ad('0x8'),auth[_0x23ad('0x7')](),controller['getFields']);router[_0x23ad('0x6')](_0x23ad('0x9'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x23ad('0x6')](_0x23ad('0xa'),auth[_0x23ad('0x7')](),controller[_0x23ad('0xb')]);router[_0x23ad('0xc')]('/',auth[_0x23ad('0x7')](),controller[_0x23ad('0xd')]);router[_0x23ad('0xe')]('/:id',auth[_0x23ad('0x7')](),controller['update']);router[_0x23ad('0xf')](_0x23ad('0x10'),auth[_0x23ad('0x7')](),controller[_0x23ad('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf406=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','multer','path','Router','../../components/auth/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x5f438b,_0xf50a97){var _0x2fb15a=function(_0xbab3c0){while(--_0xbab3c0){_0x5f438b['push'](_0x5f438b['shift']());}};_0x2fb15a(++_0xf50a97);}(_0xf406,0x1bf));var _0x6f40=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xf406[_0x2d982d];return _0x4f36b0;};'use strict';var multer=require(_0x6f40('0x0'));var util=require('util');var path=require(_0x6f40('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f40('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f40('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f40('0x4'));router[_0x6f40('0x5')]('/',auth['isAuthenticated'](),controller[_0x6f40('0x6')]);router['get'](_0x6f40('0x7'),auth[_0x6f40('0x8')](),controller[_0x6f40('0x9')]);router[_0x6f40('0x5')](_0x6f40('0xa'),auth[_0x6f40('0x8')](),controller[_0x6f40('0xb')]);router[_0x6f40('0x5')](_0x6f40('0xc'),auth[_0x6f40('0x8')](),controller[_0x6f40('0xd')]);router[_0x6f40('0x5')](_0x6f40('0xe'),auth[_0x6f40('0x8')](),controller[_0x6f40('0xf')]);router[_0x6f40('0x10')]('/',auth[_0x6f40('0x8')](),controller['create']);router[_0x6f40('0x11')](_0x6f40('0x7'),auth[_0x6f40('0x8')](),controller[_0x6f40('0x12')]);router[_0x6f40('0x13')]('/:id',auth[_0x6f40('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index eb4fd8d..4bfb593 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 _0xa33b=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x34eeb0,_0x510b41){var _0x4718b2=function(_0x504694){while(--_0x504694){_0x34eeb0['push'](_0x34eeb0['shift']());}};_0x4718b2(++_0x510b41);}(_0xa33b,0xd2));var _0xba33=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa33b[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xba33('0x0'));module[_0xba33('0x1')]={'name':{'type':Sequelize[_0xba33('0x2')]},'moduleCreate':{'type':Sequelize[_0xba33('0x3')](_0xba33('0x4'),_0xba33('0x5'),_0xba33('0x6')),'defaultValue':_0xba33('0x4')},'moduleSearch':{'type':Sequelize[_0xba33('0x3')](_0xba33('0x7'),'contact',_0xba33('0x4')),'defaultValue':_0xba33('0x7')},'description':{'type':Sequelize[_0xba33('0x2')]}}; \ No newline at end of file +var _0xf5e4=['lead','contact_lead','STRING','exports','ENUM','contact','nothing'];(function(_0x498a98,_0x176d45){var _0x16472e=function(_0x2d0d69){while(--_0x2d0d69){_0x498a98['push'](_0x498a98['shift']());}};_0x16472e(++_0x176d45);}(_0xf5e4,0x8f));var _0x4f5e=function(_0x3102e4,_0x1c7e18){_0x3102e4=_0x3102e4-0x0;var _0x19a056=_0xf5e4[_0x3102e4];return _0x19a056;};'use strict';var Sequelize=require('sequelize');module[_0x4f5e('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4f5e('0x1')]('lead',_0x4f5e('0x2'),_0x4f5e('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x4f5e('0x1')]('contact_lead',_0x4f5e('0x2'),_0x4f5e('0x4')),'defaultValue':_0x4f5e('0x5')},'description':{'type':Sequelize[_0x4f5e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8ab8bfd..28dcbd6 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 _0xde09=['json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','end','error','name','send','map','ZohoConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','update','ZohoField','pick','options','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status'];(function(_0x244d80,_0x372fa3){var _0x1c06ab=function(_0x5cb2d5){while(--_0x5cb2d5){_0x244d80['push'](_0x244d80['shift']());}};_0x1c06ab(++_0x372fa3);}(_0xde09,0x116));var _0x9de0=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xde09[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0x9de0('0x0'));var rimraf=require(_0x9de0('0x1'));var zipdir=require(_0x9de0('0x2'));var jsonpatch=require(_0x9de0('0x3'));var rp=require('request-promise');var moment=require(_0x9de0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9de0('0x5'));var util=require('util');var path=require(_0x9de0('0x6'));var sox=require(_0x9de0('0x7'));var csv=require(_0x9de0('0x8'));var ejs=require(_0x9de0('0x9'));var fs=require('fs');var fs_extra=require(_0x9de0('0xa'));var _=require('lodash');var squel=require(_0x9de0('0xb'));var crypto=require('crypto');var jsforce=require(_0x9de0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9de0('0xd'));var Papa=require(_0x9de0('0xe'));var Redis=require(_0x9de0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9de0('0x10'));var as=require(_0x9de0('0x11'));var hardwareService=require(_0x9de0('0x12'));var logger=require('../../config/logger')(_0x9de0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1809,_0x1281b8){_0x1281b8=_0x1281b8||0xcc;return function(_0x3fb9ee){if(_0x3fb9ee){return _0x5f1809[_0x9de0('0x14')](_0x1281b8);}return _0x5f1809[_0x9de0('0x15')](_0x1281b8)['end']();};}function respondWithResult(_0x31ab16,_0x132773){_0x132773=_0x132773||0xc8;return function(_0x2ad2dc){if(_0x2ad2dc){return _0x31ab16[_0x9de0('0x15')](_0x132773)[_0x9de0('0x16')](_0x2ad2dc);}};}function respondWithFilteredResult(_0x2c31aa,_0x241dcd){return function(_0x248899){if(_0x248899){var _0x591899=typeof _0x241dcd[_0x9de0('0x17')]===_0x9de0('0x18')&&typeof _0x241dcd['limit']===_0x9de0('0x18');var _0x4814e2=_0x248899[_0x9de0('0x19')];var _0x888ad7=_0x591899?0x0:_0x241dcd['offset'];var _0x17ce1c=_0x591899?_0x248899['count']:_0x241dcd[_0x9de0('0x17')]+_0x241dcd[_0x9de0('0x1a')];var _0x5b70d7;if(_0x17ce1c>=_0x4814e2){_0x17ce1c=_0x4814e2;_0x5b70d7=0xc8;}else{_0x5b70d7=0xce;}_0x2c31aa[_0x9de0('0x15')](_0x5b70d7);return _0x2c31aa[_0x9de0('0x1b')](_0x9de0('0x1c'),_0x888ad7+'-'+_0x17ce1c+'/'+_0x4814e2)[_0x9de0('0x16')](_0x248899);}return null;};}function patchUpdates(_0x10a569){return function(_0x30606a){try{jsonpatch['apply'](_0x30606a,_0x10a569,!![]);}catch(_0x220100){return BPromise[_0x9de0('0x1d')](_0x220100);}return _0x30606a['save']();};}function saveUpdates(_0x1d65a7,_0x47dea8){return function(_0x4c6980){if(_0x4c6980){return _0x4c6980['update'](_0x1d65a7)[_0x9de0('0x1e')](function(_0x1297f6){return _0x1297f6;});}return null;};}function removeEntity(_0x4f9d7e,_0x5a3cf0){return function(_0x27995e){if(_0x27995e){return _0x27995e[_0x9de0('0x1f')]()[_0x9de0('0x1e')](function(){_0x4f9d7e['status'](0xcc)[_0x9de0('0x20')]();});}};}function handleEntityNotFound(_0x56b654,_0xaeea50){return function(_0x3a39fd){if(!_0x3a39fd){_0x56b654['sendStatus'](0x194);}return _0x3a39fd;};}function handleError(_0x2bf1c,_0x1a80e6){_0x1a80e6=_0x1a80e6||0x1f4;return function(_0x33d164){logger[_0x9de0('0x21')](_0x33d164['stack']);if(_0x33d164[_0x9de0('0x22')]){delete _0x33d164[_0x9de0('0x22')];}_0x2bf1c[_0x9de0('0x15')](_0x1a80e6)[_0x9de0('0x23')](_0x33d164);};}exports['index']=function(_0x296d08,_0x1a3176){var _0x4a1f53={},_0x79d3d7={},_0x3d5206={'count':0x0,'rows':[]};var _0x1644b8=_[_0x9de0('0x24')](db[_0x9de0('0x25')]['rawAttributes'],function(_0x4e607a){return{'name':_0x4e607a[_0x9de0('0x26')],'type':_0x4e607a[_0x9de0('0x27')][_0x9de0('0x28')]};});_0x79d3d7[_0x9de0('0x29')]=_[_0x9de0('0x24')](_0x1644b8,_0x9de0('0x22'));_0x79d3d7[_0x9de0('0x2a')]=_[_0x9de0('0x2b')](_0x296d08['query']);_0x79d3d7[_0x9de0('0x2c')]=_[_0x9de0('0x2d')](_0x79d3d7[_0x9de0('0x29')],_0x79d3d7[_0x9de0('0x2a')]);_0x4a1f53['attributes']=_['intersection'](_0x79d3d7[_0x9de0('0x29')],qs['fields'](_0x296d08[_0x9de0('0x2a')][_0x9de0('0x2e')]));_0x4a1f53[_0x9de0('0x2f')]=_0x4a1f53['attributes'][_0x9de0('0x30')]?_0x4a1f53[_0x9de0('0x2f')]:_0x79d3d7[_0x9de0('0x29')];if(!_0x296d08['query'][_0x9de0('0x31')](_0x9de0('0x32'))){_0x4a1f53[_0x9de0('0x1a')]=qs['limit'](_0x296d08[_0x9de0('0x2a')]['limit']);_0x4a1f53[_0x9de0('0x17')]=qs[_0x9de0('0x17')](_0x296d08[_0x9de0('0x2a')]['offset']);}_0x4a1f53[_0x9de0('0x33')]=qs[_0x9de0('0x34')](_0x296d08[_0x9de0('0x2a')][_0x9de0('0x34')]);_0x4a1f53['where']=qs[_0x9de0('0x2c')](_['pick'](_0x296d08[_0x9de0('0x2a')],_0x79d3d7['filters']),_0x1644b8);if(_0x296d08[_0x9de0('0x2a')][_0x9de0('0x35')]){_0x4a1f53['where']=_[_0x9de0('0x36')](_0x4a1f53[_0x9de0('0x37')],{'$or':_[_0x9de0('0x24')](_0x1644b8,function(_0x14fded){if(_0x14fded[_0x9de0('0x27')]!==_0x9de0('0x38')){var _0x202583={};_0x202583[_0x14fded[_0x9de0('0x22')]]={'$like':'%'+_0x296d08[_0x9de0('0x2a')][_0x9de0('0x35')]+'%'};return _0x202583;}})});}_0x4a1f53=_[_0x9de0('0x36')]({},_0x4a1f53,_0x296d08['options']);var _0x38eeea={'where':_0x4a1f53['where']};return db[_0x9de0('0x25')][_0x9de0('0x19')](_0x38eeea)[_0x9de0('0x1e')](function(_0x343a5d){_0x3d5206[_0x9de0('0x19')]=_0x343a5d;if(_0x296d08[_0x9de0('0x2a')]['includeAll']){_0x4a1f53[_0x9de0('0x39')]=[{'all':!![]}];}return db[_0x9de0('0x25')][_0x9de0('0x3a')](_0x4a1f53);})[_0x9de0('0x1e')](function(_0xb33149){_0x3d5206['rows']=_0xb33149;return _0x3d5206;})[_0x9de0('0x1e')](respondWithFilteredResult(_0x1a3176,_0x4a1f53))[_0x9de0('0x3b')](handleError(_0x1a3176,null));};exports[_0x9de0('0x3c')]=function(_0x429eee,_0x129ae9){var _0x1f7ebd={'raw':![],'where':{'id':_0x429eee[_0x9de0('0x3d')]['id']}},_0x1538cc={};_0x1538cc[_0x9de0('0x29')]=_[_0x9de0('0x2b')](db[_0x9de0('0x25')][_0x9de0('0x3e')]);_0x1538cc[_0x9de0('0x2a')]=_[_0x9de0('0x2b')](_0x429eee['query']);_0x1538cc[_0x9de0('0x2c')]=_[_0x9de0('0x2d')](_0x1538cc['model'],_0x1538cc[_0x9de0('0x2a')]);_0x1f7ebd[_0x9de0('0x2f')]=_['intersection'](_0x1538cc[_0x9de0('0x29')],qs['fields'](_0x429eee[_0x9de0('0x2a')]['fields']));_0x1f7ebd['attributes']=_0x1f7ebd[_0x9de0('0x2f')][_0x9de0('0x30')]?_0x1f7ebd[_0x9de0('0x2f')]:_0x1538cc[_0x9de0('0x29')];if(_0x429eee[_0x9de0('0x2a')][_0x9de0('0x3f')]){_0x1f7ebd[_0x9de0('0x39')]=[{'all':!![]}];}_0x1f7ebd=_[_0x9de0('0x36')]({},_0x1f7ebd,_0x429eee['options']);return db[_0x9de0('0x25')][_0x9de0('0x40')](_0x1f7ebd)[_0x9de0('0x1e')](handleEntityNotFound(_0x129ae9,null))['then'](respondWithResult(_0x129ae9,null))[_0x9de0('0x3b')](handleError(_0x129ae9,null));};exports[_0x9de0('0x41')]=function(_0x3dcaad,_0x538301){return db[_0x9de0('0x25')][_0x9de0('0x41')](_0x3dcaad[_0x9de0('0x42')],{})['then'](respondWithResult(_0x538301,0xc9))['catch'](handleError(_0x538301,null));};exports[_0x9de0('0x43')]=function(_0x1655cf,_0x2c40e4){if(_0x1655cf[_0x9de0('0x42')]['id']){delete _0x1655cf[_0x9de0('0x42')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x1655cf[_0x9de0('0x3d')]['id']}})[_0x9de0('0x1e')](handleEntityNotFound(_0x2c40e4,null))['then'](saveUpdates(_0x1655cf[_0x9de0('0x42')],null))[_0x9de0('0x1e')](respondWithResult(_0x2c40e4,null))[_0x9de0('0x3b')](handleError(_0x2c40e4,null));};exports['destroy']=function(_0x34dbc1,_0x17701a){return db[_0x9de0('0x25')][_0x9de0('0x40')]({'where':{'id':_0x34dbc1[_0x9de0('0x3d')]['id']}})[_0x9de0('0x1e')](handleEntityNotFound(_0x17701a,null))['then'](removeEntity(_0x17701a,null))['catch'](handleError(_0x17701a,null));};exports['getFields']=function(_0x287b3c,_0x383cd0,_0x4777e6){var _0xc99dac={};var _0x3643a5={};var _0x5abb4f;var _0x2f5b7d;return db[_0x9de0('0x25')]['findOne']({'where':{'id':_0x287b3c[_0x9de0('0x3d')]['id']}})[_0x9de0('0x1e')](handleEntityNotFound(_0x383cd0,null))['then'](function(_0x3c967d){if(_0x3c967d){_0x5abb4f=_0x3c967d;_0x3643a5[_0x9de0('0x29')]=_[_0x9de0('0x2b')](db[_0x9de0('0x44')][_0x9de0('0x3e')]);_0x3643a5[_0x9de0('0x2a')]=_[_0x9de0('0x2b')](_0x287b3c['query']);_0x3643a5['filters']=_[_0x9de0('0x2d')](_0x3643a5[_0x9de0('0x29')],_0x3643a5[_0x9de0('0x2a')]);_0xc99dac[_0x9de0('0x2f')]=_['intersection'](_0x3643a5['model'],qs['fields'](_0x287b3c[_0x9de0('0x2a')][_0x9de0('0x2e')]));_0xc99dac['attributes']=_0xc99dac['attributes']['length']?_0xc99dac[_0x9de0('0x2f')]:_0x3643a5['model'];_0xc99dac[_0x9de0('0x33')]=qs[_0x9de0('0x34')](_0x287b3c['query'][_0x9de0('0x34')]);_0xc99dac[_0x9de0('0x37')]=qs[_0x9de0('0x2c')](_[_0x9de0('0x45')](_0x287b3c[_0x9de0('0x2a')],_0x3643a5[_0x9de0('0x2c')]));if(_0x287b3c[_0x9de0('0x2a')][_0x9de0('0x35')]){_0xc99dac[_0x9de0('0x37')]=_[_0x9de0('0x36')](_0xc99dac[_0x9de0('0x37')],{'$or':_[_0x9de0('0x24')](_0xc99dac[_0x9de0('0x2f')],function(_0x16ab9b){var _0x59dee0={};_0x59dee0[_0x16ab9b]={'$like':'%'+_0x287b3c[_0x9de0('0x2a')]['filter']+'%'};return _0x59dee0;})});}_0xc99dac=_[_0x9de0('0x36')]({},_0xc99dac,_0x287b3c[_0x9de0('0x46')]);return _0x5abb4f[_0x9de0('0x47')](_0xc99dac);}})['then'](function(_0x5f0096){if(_0x5f0096){_0x2f5b7d=_0x5f0096[_0x9de0('0x30')];if(!_0x287b3c['query'][_0x9de0('0x31')]('nolimit')){_0xc99dac['limit']=qs[_0x9de0('0x1a')](_0x287b3c[_0x9de0('0x2a')][_0x9de0('0x1a')]);_0xc99dac[_0x9de0('0x17')]=qs[_0x9de0('0x17')](_0x287b3c[_0x9de0('0x2a')][_0x9de0('0x17')]);}return _0x5abb4f['getFields'](_0xc99dac);}})['then'](function(_0x31d38e){if(_0x31d38e){return _0x31d38e?{'count':_0x2f5b7d,'rows':_0x31d38e}:null;}})['then'](respondWithResult(_0x383cd0,null))['catch'](handleError(_0x383cd0,null));};exports[_0x9de0('0x48')]=function(_0x1865de,_0x407951,_0x246d0c){var _0xd64ef8={};var _0x26e6bb={};var _0x55c5d0;var _0x524079;return db[_0x9de0('0x25')][_0x9de0('0x49')]({'where':{'id':_0x1865de['params']['id']}})[_0x9de0('0x1e')](handleEntityNotFound(_0x407951,null))[_0x9de0('0x1e')](function(_0x2d0271){if(_0x2d0271){_0x55c5d0=_0x2d0271;_0x26e6bb[_0x9de0('0x29')]=_['keys'](db[_0x9de0('0x44')][_0x9de0('0x3e')]);_0x26e6bb[_0x9de0('0x2a')]=_[_0x9de0('0x2b')](_0x1865de[_0x9de0('0x2a')]);_0x26e6bb[_0x9de0('0x2c')]=_['intersection'](_0x26e6bb[_0x9de0('0x29')],_0x26e6bb[_0x9de0('0x2a')]);_0xd64ef8['attributes']=_[_0x9de0('0x2d')](_0x26e6bb[_0x9de0('0x29')],qs[_0x9de0('0x2e')](_0x1865de[_0x9de0('0x2a')][_0x9de0('0x2e')]));_0xd64ef8[_0x9de0('0x2f')]=_0xd64ef8['attributes'][_0x9de0('0x30')]?_0xd64ef8[_0x9de0('0x2f')]:_0x26e6bb[_0x9de0('0x29')];_0xd64ef8[_0x9de0('0x33')]=qs['sort'](_0x1865de[_0x9de0('0x2a')]['sort']);_0xd64ef8[_0x9de0('0x37')]=qs['filters'](_[_0x9de0('0x45')](_0x1865de['query'],_0x26e6bb['filters']));if(_0x1865de['query'][_0x9de0('0x35')]){_0xd64ef8[_0x9de0('0x37')]=_[_0x9de0('0x36')](_0xd64ef8[_0x9de0('0x37')],{'$or':_[_0x9de0('0x24')](_0xd64ef8[_0x9de0('0x2f')],function(_0x3d4623){var _0x1d525d={};_0x1d525d[_0x3d4623]={'$like':'%'+_0x1865de[_0x9de0('0x2a')][_0x9de0('0x35')]+'%'};return _0x1d525d;})});}_0xd64ef8=_['merge']({},_0xd64ef8,_0x1865de[_0x9de0('0x46')]);return _0x55c5d0[_0x9de0('0x48')](_0xd64ef8);}})[_0x9de0('0x1e')](function(_0x44ab15){if(_0x44ab15){_0x524079=_0x44ab15[_0x9de0('0x30')];if(!_0x1865de[_0x9de0('0x2a')][_0x9de0('0x31')](_0x9de0('0x32'))){_0xd64ef8[_0x9de0('0x1a')]=qs[_0x9de0('0x1a')](_0x1865de[_0x9de0('0x2a')][_0x9de0('0x1a')]);_0xd64ef8[_0x9de0('0x17')]=qs[_0x9de0('0x17')](_0x1865de[_0x9de0('0x2a')][_0x9de0('0x17')]);}return _0x55c5d0[_0x9de0('0x48')](_0xd64ef8);}})[_0x9de0('0x1e')](function(_0x554bae){if(_0x554bae){return _0x554bae?{'count':_0x524079,'rows':_0x554bae}:null;}})['then'](respondWithResult(_0x407951,null))[_0x9de0('0x3b')](handleError(_0x407951,null));};exports[_0x9de0('0x4a')]=function(_0x3ef11a,_0x35fd36,_0x1ffd38){var _0x5c4608={};var _0x574d4e={};var _0xbba2a;var _0x2c4dee;return db[_0x9de0('0x25')][_0x9de0('0x49')]({'where':{'id':_0x3ef11a[_0x9de0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x35fd36,null))[_0x9de0('0x1e')](function(_0x2ce398){if(_0x2ce398){_0xbba2a=_0x2ce398;_0x574d4e[_0x9de0('0x29')]=_[_0x9de0('0x2b')](db['ZohoField']['rawAttributes']);_0x574d4e[_0x9de0('0x2a')]=_[_0x9de0('0x2b')](_0x3ef11a['query']);_0x574d4e[_0x9de0('0x2c')]=_[_0x9de0('0x2d')](_0x574d4e['model'],_0x574d4e[_0x9de0('0x2a')]);_0x5c4608[_0x9de0('0x2f')]=_[_0x9de0('0x2d')](_0x574d4e[_0x9de0('0x29')],qs[_0x9de0('0x2e')](_0x3ef11a[_0x9de0('0x2a')][_0x9de0('0x2e')]));_0x5c4608['attributes']=_0x5c4608[_0x9de0('0x2f')]['length']?_0x5c4608[_0x9de0('0x2f')]:_0x574d4e[_0x9de0('0x29')];_0x5c4608[_0x9de0('0x33')]=qs[_0x9de0('0x34')](_0x3ef11a[_0x9de0('0x2a')]['sort']);_0x5c4608[_0x9de0('0x37')]=qs[_0x9de0('0x2c')](_[_0x9de0('0x45')](_0x3ef11a[_0x9de0('0x2a')],_0x574d4e[_0x9de0('0x2c')]));if(_0x3ef11a['query'][_0x9de0('0x35')]){_0x5c4608[_0x9de0('0x37')]=_[_0x9de0('0x36')](_0x5c4608[_0x9de0('0x37')],{'$or':_['map'](_0x5c4608[_0x9de0('0x2f')],function(_0x5ae3d8){var _0x2a1091={};_0x2a1091[_0x5ae3d8]={'$like':'%'+_0x3ef11a[_0x9de0('0x2a')]['filter']+'%'};return _0x2a1091;})});}_0x5c4608=_[_0x9de0('0x36')]({},_0x5c4608,_0x3ef11a[_0x9de0('0x46')]);return _0xbba2a[_0x9de0('0x4a')](_0x5c4608);}})[_0x9de0('0x1e')](function(_0xa9a349){if(_0xa9a349){_0x2c4dee=_0xa9a349['length'];if(!_0x3ef11a[_0x9de0('0x2a')]['hasOwnProperty']('nolimit')){_0x5c4608[_0x9de0('0x1a')]=qs[_0x9de0('0x1a')](_0x3ef11a[_0x9de0('0x2a')]['limit']);_0x5c4608[_0x9de0('0x17')]=qs[_0x9de0('0x17')](_0x3ef11a[_0x9de0('0x2a')][_0x9de0('0x17')]);}return _0xbba2a[_0x9de0('0x4a')](_0x5c4608);}})['then'](function(_0x2fa496){if(_0x2fa496){return _0x2fa496?{'count':_0x2c4dee,'rows':_0x2fa496}:null;}})['then'](respondWithResult(_0x35fd36,null))['catch'](handleError(_0x35fd36,null));}; \ No newline at end of file +var _0x2271=['apply','reject','save','destroy','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','then','include','findAll','rows','catch','show','params','options','create','update','body','find','getFields','ZohoField','nolimit','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x26d859,_0x169d28){var _0x39bb3b=function(_0x3b9a8d){while(--_0x3b9a8d){_0x26d859['push'](_0x26d859['shift']());}};_0x39bb3b(++_0x169d28);}(_0x2271,0x83));var _0x1227=function(_0xb07d4d,_0x1ed5d5){_0xb07d4d=_0xb07d4d-0x0;var _0x4cf453=_0x2271[_0xb07d4d];return _0x4cf453;};'use strict';var emlformat=require(_0x1227('0x0'));var rimraf=require(_0x1227('0x1'));var zipdir=require(_0x1227('0x2'));var jsonpatch=require(_0x1227('0x3'));var rp=require(_0x1227('0x4'));var moment=require(_0x1227('0x5'));var BPromise=require(_0x1227('0x6'));var Mustache=require(_0x1227('0x7'));var util=require(_0x1227('0x8'));var path=require(_0x1227('0x9'));var sox=require(_0x1227('0xa'));var csv=require(_0x1227('0xb'));var ejs=require(_0x1227('0xc'));var fs=require('fs');var fs_extra=require(_0x1227('0xd'));var _=require(_0x1227('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1227('0xf'));var deskjs=require(_0x1227('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1227('0x11'));var Redis=require(_0x1227('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1227('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1227('0x14'))(_0x1227('0x15'));var utils=require(_0x1227('0x16'));var config=require(_0x1227('0x17'));var licenseUtil=require(_0x1227('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f6737,_0x4abd6a){_0x4abd6a=_0x4abd6a||0xcc;return function(_0x3edd53){if(_0x3edd53){return _0x3f6737[_0x1227('0x19')](_0x4abd6a);}return _0x3f6737['status'](_0x4abd6a)[_0x1227('0x1a')]();};}function respondWithResult(_0x10e763,_0x440046){_0x440046=_0x440046||0xc8;return function(_0x35d2c0){if(_0x35d2c0){return _0x10e763[_0x1227('0x1b')](_0x440046)[_0x1227('0x1c')](_0x35d2c0);}};}function respondWithFilteredResult(_0x366fdb,_0x344f9d){return function(_0x2a51a9){if(_0x2a51a9){var _0x40b945=typeof _0x344f9d[_0x1227('0x1d')]===_0x1227('0x1e')&&typeof _0x344f9d[_0x1227('0x1f')]===_0x1227('0x1e');var _0x111a5f=_0x2a51a9[_0x1227('0x20')];var _0x40f4aa=_0x40b945?0x0:_0x344f9d[_0x1227('0x1d')];var _0x17e418=_0x40b945?_0x2a51a9[_0x1227('0x20')]:_0x344f9d[_0x1227('0x1d')]+_0x344f9d[_0x1227('0x1f')];var _0x321a00;if(_0x17e418>=_0x111a5f){_0x17e418=_0x111a5f;_0x321a00=0xc8;}else{_0x321a00=0xce;}_0x366fdb[_0x1227('0x1b')](_0x321a00);return _0x366fdb[_0x1227('0x21')](_0x1227('0x22'),_0x40f4aa+'-'+_0x17e418+'/'+_0x111a5f)[_0x1227('0x1c')](_0x2a51a9);}return null;};}function patchUpdates(_0x3b2a97){return function(_0x27e06e){try{jsonpatch[_0x1227('0x23')](_0x27e06e,_0x3b2a97,!![]);}catch(_0x9d899b){return BPromise[_0x1227('0x24')](_0x9d899b);}return _0x27e06e[_0x1227('0x25')]();};}function saveUpdates(_0x55505c,_0xe30d88){return function(_0x26680c){if(_0x26680c){return _0x26680c['update'](_0x55505c)['then'](function(_0x2b21ba){return _0x2b21ba;});}return null;};}function removeEntity(_0x4fe004,_0x102c36){return function(_0x283c2b){if(_0x283c2b){return _0x283c2b[_0x1227('0x26')]()['then'](function(){_0x4fe004[_0x1227('0x1b')](0xcc)[_0x1227('0x1a')]();});}};}function handleEntityNotFound(_0xa1410f,_0x1ae66e){return function(_0x2daf84){if(!_0x2daf84){_0xa1410f[_0x1227('0x19')](0x194);}return _0x2daf84;};}function handleError(_0x3ec5bb,_0x23b47a){_0x23b47a=_0x23b47a||0x1f4;return function(_0x3c3fff){logger[_0x1227('0x27')](_0x3c3fff[_0x1227('0x28')]);if(_0x3c3fff['name']){delete _0x3c3fff[_0x1227('0x29')];}_0x3ec5bb['status'](_0x23b47a)['send'](_0x3c3fff);};}exports[_0x1227('0x2a')]=function(_0x43221c,_0x19123d){var _0x55ed92={},_0xc5fb40={},_0x44ddd8={'count':0x0,'rows':[]};var _0xdcd440=_[_0x1227('0x2b')](db[_0x1227('0x2c')][_0x1227('0x2d')],function(_0x437f9b){return{'name':_0x437f9b[_0x1227('0x2e')],'type':_0x437f9b[_0x1227('0x2f')][_0x1227('0x30')]};});_0xc5fb40['model']=_[_0x1227('0x2b')](_0xdcd440,_0x1227('0x29'));_0xc5fb40[_0x1227('0x31')]=_[_0x1227('0x32')](_0x43221c[_0x1227('0x31')]);_0xc5fb40[_0x1227('0x33')]=_[_0x1227('0x34')](_0xc5fb40[_0x1227('0x35')],_0xc5fb40[_0x1227('0x31')]);_0x55ed92[_0x1227('0x36')]=_[_0x1227('0x34')](_0xc5fb40[_0x1227('0x35')],qs['fields'](_0x43221c[_0x1227('0x31')][_0x1227('0x37')]));_0x55ed92[_0x1227('0x36')]=_0x55ed92['attributes'][_0x1227('0x38')]?_0x55ed92['attributes']:_0xc5fb40[_0x1227('0x35')];if(!_0x43221c['query'][_0x1227('0x39')]('nolimit')){_0x55ed92[_0x1227('0x1f')]=qs['limit'](_0x43221c['query'][_0x1227('0x1f')]);_0x55ed92[_0x1227('0x1d')]=qs[_0x1227('0x1d')](_0x43221c[_0x1227('0x31')]['offset']);}_0x55ed92[_0x1227('0x3a')]=qs[_0x1227('0x3b')](_0x43221c[_0x1227('0x31')][_0x1227('0x3b')]);_0x55ed92['where']=qs['filters'](_['pick'](_0x43221c[_0x1227('0x31')],_0xc5fb40['filters']),_0xdcd440);if(_0x43221c[_0x1227('0x31')]['filter']){_0x55ed92[_0x1227('0x3c')]=_[_0x1227('0x3d')](_0x55ed92[_0x1227('0x3c')],{'$or':_['map'](_0xdcd440,function(_0x2814d3){if(_0x2814d3[_0x1227('0x2f')]!==_0x1227('0x3e')){var _0x563c65={};_0x563c65[_0x2814d3[_0x1227('0x29')]]={'$like':'%'+_0x43221c[_0x1227('0x31')][_0x1227('0x3f')]+'%'};return _0x563c65;}})});}_0x55ed92=_[_0x1227('0x3d')]({},_0x55ed92,_0x43221c['options']);var _0x43a880={'where':_0x55ed92['where']};return db[_0x1227('0x2c')][_0x1227('0x20')](_0x43a880)[_0x1227('0x40')](function(_0x331389){_0x44ddd8['count']=_0x331389;if(_0x43221c[_0x1227('0x31')]['includeAll']){_0x55ed92[_0x1227('0x41')]=[{'all':!![]}];}return db[_0x1227('0x2c')][_0x1227('0x42')](_0x55ed92);})[_0x1227('0x40')](function(_0x4b38c0){_0x44ddd8[_0x1227('0x43')]=_0x4b38c0;return _0x44ddd8;})[_0x1227('0x40')](respondWithFilteredResult(_0x19123d,_0x55ed92))[_0x1227('0x44')](handleError(_0x19123d,null));};exports[_0x1227('0x45')]=function(_0x5ede31,_0x1a089b){var _0x3054a0={'raw':![],'where':{'id':_0x5ede31[_0x1227('0x46')]['id']}},_0xe6bbf6={};_0xe6bbf6[_0x1227('0x35')]=_['keys'](db[_0x1227('0x2c')]['rawAttributes']);_0xe6bbf6[_0x1227('0x31')]=_[_0x1227('0x32')](_0x5ede31[_0x1227('0x31')]);_0xe6bbf6[_0x1227('0x33')]=_['intersection'](_0xe6bbf6[_0x1227('0x35')],_0xe6bbf6[_0x1227('0x31')]);_0x3054a0['attributes']=_['intersection'](_0xe6bbf6[_0x1227('0x35')],qs[_0x1227('0x37')](_0x5ede31[_0x1227('0x31')][_0x1227('0x37')]));_0x3054a0[_0x1227('0x36')]=_0x3054a0[_0x1227('0x36')]['length']?_0x3054a0[_0x1227('0x36')]:_0xe6bbf6['model'];if(_0x5ede31[_0x1227('0x31')]['includeAll']){_0x3054a0['include']=[{'all':!![]}];}_0x3054a0=_[_0x1227('0x3d')]({},_0x3054a0,_0x5ede31[_0x1227('0x47')]);return db[_0x1227('0x2c')]['find'](_0x3054a0)[_0x1227('0x40')](handleEntityNotFound(_0x1a089b,null))[_0x1227('0x40')](respondWithResult(_0x1a089b,null))[_0x1227('0x44')](handleError(_0x1a089b,null));};exports[_0x1227('0x48')]=function(_0x1db415,_0x1102e2){return db[_0x1227('0x2c')][_0x1227('0x48')](_0x1db415['body'],{})[_0x1227('0x40')](respondWithResult(_0x1102e2,0xc9))['catch'](handleError(_0x1102e2,null));};exports[_0x1227('0x49')]=function(_0x156e3f,_0x2e26de){if(_0x156e3f[_0x1227('0x4a')]['id']){delete _0x156e3f['body']['id'];}return db[_0x1227('0x2c')][_0x1227('0x4b')]({'where':{'id':_0x156e3f[_0x1227('0x46')]['id']}})[_0x1227('0x40')](handleEntityNotFound(_0x2e26de,null))['then'](saveUpdates(_0x156e3f['body'],null))[_0x1227('0x40')](respondWithResult(_0x2e26de,null))[_0x1227('0x44')](handleError(_0x2e26de,null));};exports[_0x1227('0x26')]=function(_0x356d5c,_0xdd819e){return db[_0x1227('0x2c')][_0x1227('0x4b')]({'where':{'id':_0x356d5c[_0x1227('0x46')]['id']}})[_0x1227('0x40')](handleEntityNotFound(_0xdd819e,null))[_0x1227('0x40')](removeEntity(_0xdd819e,null))['catch'](handleError(_0xdd819e,null));};exports[_0x1227('0x4c')]=function(_0x3a8a50,_0x5819c7,_0x44e6fd){var _0x2171b5={};var _0xa988e5={};var _0x48b50d;var _0x1aeca7;return db[_0x1227('0x2c')]['findOne']({'where':{'id':_0x3a8a50[_0x1227('0x46')]['id']}})[_0x1227('0x40')](handleEntityNotFound(_0x5819c7,null))[_0x1227('0x40')](function(_0x33eb21){if(_0x33eb21){_0x48b50d=_0x33eb21;_0xa988e5[_0x1227('0x35')]=_[_0x1227('0x32')](db[_0x1227('0x4d')][_0x1227('0x2d')]);_0xa988e5[_0x1227('0x31')]=_[_0x1227('0x32')](_0x3a8a50[_0x1227('0x31')]);_0xa988e5[_0x1227('0x33')]=_[_0x1227('0x34')](_0xa988e5[_0x1227('0x35')],_0xa988e5[_0x1227('0x31')]);_0x2171b5['attributes']=_[_0x1227('0x34')](_0xa988e5[_0x1227('0x35')],qs[_0x1227('0x37')](_0x3a8a50[_0x1227('0x31')]['fields']));_0x2171b5[_0x1227('0x36')]=_0x2171b5['attributes']['length']?_0x2171b5[_0x1227('0x36')]:_0xa988e5[_0x1227('0x35')];_0x2171b5[_0x1227('0x3a')]=qs[_0x1227('0x3b')](_0x3a8a50[_0x1227('0x31')][_0x1227('0x3b')]);_0x2171b5['where']=qs[_0x1227('0x33')](_['pick'](_0x3a8a50[_0x1227('0x31')],_0xa988e5['filters']));if(_0x3a8a50[_0x1227('0x31')][_0x1227('0x3f')]){_0x2171b5['where']=_[_0x1227('0x3d')](_0x2171b5[_0x1227('0x3c')],{'$or':_[_0x1227('0x2b')](_0x2171b5[_0x1227('0x36')],function(_0x4351ef){var _0xc9f6f5={};_0xc9f6f5[_0x4351ef]={'$like':'%'+_0x3a8a50[_0x1227('0x31')][_0x1227('0x3f')]+'%'};return _0xc9f6f5;})});}_0x2171b5=_[_0x1227('0x3d')]({},_0x2171b5,_0x3a8a50[_0x1227('0x47')]);return _0x48b50d[_0x1227('0x4c')](_0x2171b5);}})[_0x1227('0x40')](function(_0x584dac){if(_0x584dac){_0x1aeca7=_0x584dac[_0x1227('0x38')];if(!_0x3a8a50['query'][_0x1227('0x39')](_0x1227('0x4e'))){_0x2171b5[_0x1227('0x1f')]=qs['limit'](_0x3a8a50[_0x1227('0x31')][_0x1227('0x1f')]);_0x2171b5[_0x1227('0x1d')]=qs['offset'](_0x3a8a50['query'][_0x1227('0x1d')]);}return _0x48b50d[_0x1227('0x4c')](_0x2171b5);}})[_0x1227('0x40')](function(_0x2bc454){if(_0x2bc454){return _0x2bc454?{'count':_0x1aeca7,'rows':_0x2bc454}:null;}})[_0x1227('0x40')](respondWithResult(_0x5819c7,null))[_0x1227('0x44')](handleError(_0x5819c7,null));};exports[_0x1227('0x4f')]=function(_0x2881e5,_0x42b0e8,_0x4107cf){var _0x7dbfcd={};var _0x4a8e79={};var _0x2f93ae;var _0x11ef74;return db[_0x1227('0x2c')][_0x1227('0x50')]({'where':{'id':_0x2881e5[_0x1227('0x46')]['id']}})[_0x1227('0x40')](handleEntityNotFound(_0x42b0e8,null))[_0x1227('0x40')](function(_0x323030){if(_0x323030){_0x2f93ae=_0x323030;_0x4a8e79['model']=_[_0x1227('0x32')](db['ZohoField']['rawAttributes']);_0x4a8e79['query']=_[_0x1227('0x32')](_0x2881e5[_0x1227('0x31')]);_0x4a8e79[_0x1227('0x33')]=_[_0x1227('0x34')](_0x4a8e79['model'],_0x4a8e79[_0x1227('0x31')]);_0x7dbfcd[_0x1227('0x36')]=_[_0x1227('0x34')](_0x4a8e79[_0x1227('0x35')],qs[_0x1227('0x37')](_0x2881e5['query'][_0x1227('0x37')]));_0x7dbfcd[_0x1227('0x36')]=_0x7dbfcd[_0x1227('0x36')]['length']?_0x7dbfcd[_0x1227('0x36')]:_0x4a8e79['model'];_0x7dbfcd['order']=qs[_0x1227('0x3b')](_0x2881e5[_0x1227('0x31')][_0x1227('0x3b')]);_0x7dbfcd[_0x1227('0x3c')]=qs['filters'](_[_0x1227('0x51')](_0x2881e5[_0x1227('0x31')],_0x4a8e79[_0x1227('0x33')]));if(_0x2881e5['query'][_0x1227('0x3f')]){_0x7dbfcd[_0x1227('0x3c')]=_[_0x1227('0x3d')](_0x7dbfcd[_0x1227('0x3c')],{'$or':_[_0x1227('0x2b')](_0x7dbfcd[_0x1227('0x36')],function(_0x1f9662){var _0x380e3d={};_0x380e3d[_0x1f9662]={'$like':'%'+_0x2881e5[_0x1227('0x31')][_0x1227('0x3f')]+'%'};return _0x380e3d;})});}_0x7dbfcd=_[_0x1227('0x3d')]({},_0x7dbfcd,_0x2881e5[_0x1227('0x47')]);return _0x2f93ae[_0x1227('0x4f')](_0x7dbfcd);}})[_0x1227('0x40')](function(_0x24f4bd){if(_0x24f4bd){_0x11ef74=_0x24f4bd['length'];if(!_0x2881e5[_0x1227('0x31')][_0x1227('0x39')](_0x1227('0x4e'))){_0x7dbfcd[_0x1227('0x1f')]=qs[_0x1227('0x1f')](_0x2881e5[_0x1227('0x31')][_0x1227('0x1f')]);_0x7dbfcd['offset']=qs[_0x1227('0x1d')](_0x2881e5[_0x1227('0x31')][_0x1227('0x1d')]);}return _0x2f93ae['getSubjects'](_0x7dbfcd);}})['then'](function(_0x4180e6){if(_0x4180e6){return _0x4180e6?{'count':_0x11ef74,'rows':_0x4180e6}:null;}})[_0x1227('0x40')](respondWithResult(_0x42b0e8,null))[_0x1227('0x44')](handleError(_0x42b0e8,null));};exports[_0x1227('0x52')]=function(_0x4274ea,_0x4bdaeb,_0x36edd4){var _0x1afca0={};var _0x138d0a={};var _0x3f61ba;var _0xcf7083;return db[_0x1227('0x2c')][_0x1227('0x50')]({'where':{'id':_0x4274ea['params']['id']}})['then'](handleEntityNotFound(_0x4bdaeb,null))[_0x1227('0x40')](function(_0x33b6fb){if(_0x33b6fb){_0x3f61ba=_0x33b6fb;_0x138d0a[_0x1227('0x35')]=_[_0x1227('0x32')](db[_0x1227('0x4d')][_0x1227('0x2d')]);_0x138d0a['query']=_['keys'](_0x4274ea[_0x1227('0x31')]);_0x138d0a[_0x1227('0x33')]=_['intersection'](_0x138d0a[_0x1227('0x35')],_0x138d0a['query']);_0x1afca0['attributes']=_[_0x1227('0x34')](_0x138d0a[_0x1227('0x35')],qs[_0x1227('0x37')](_0x4274ea[_0x1227('0x31')][_0x1227('0x37')]));_0x1afca0[_0x1227('0x36')]=_0x1afca0[_0x1227('0x36')][_0x1227('0x38')]?_0x1afca0['attributes']:_0x138d0a[_0x1227('0x35')];_0x1afca0[_0x1227('0x3a')]=qs['sort'](_0x4274ea['query'][_0x1227('0x3b')]);_0x1afca0[_0x1227('0x3c')]=qs[_0x1227('0x33')](_['pick'](_0x4274ea[_0x1227('0x31')],_0x138d0a[_0x1227('0x33')]));if(_0x4274ea['query'][_0x1227('0x3f')]){_0x1afca0[_0x1227('0x3c')]=_['merge'](_0x1afca0[_0x1227('0x3c')],{'$or':_['map'](_0x1afca0[_0x1227('0x36')],function(_0x3147e9){var _0x4f4457={};_0x4f4457[_0x3147e9]={'$like':'%'+_0x4274ea[_0x1227('0x31')][_0x1227('0x3f')]+'%'};return _0x4f4457;})});}_0x1afca0=_[_0x1227('0x3d')]({},_0x1afca0,_0x4274ea[_0x1227('0x47')]);return _0x3f61ba['getDescriptions'](_0x1afca0);}})[_0x1227('0x40')](function(_0x16fd2b){if(_0x16fd2b){_0xcf7083=_0x16fd2b['length'];if(!_0x4274ea[_0x1227('0x31')][_0x1227('0x39')]('nolimit')){_0x1afca0['limit']=qs[_0x1227('0x1f')](_0x4274ea[_0x1227('0x31')][_0x1227('0x1f')]);_0x1afca0[_0x1227('0x1d')]=qs[_0x1227('0x1d')](_0x4274ea['query'][_0x1227('0x1d')]);}return _0x3f61ba[_0x1227('0x52')](_0x1afca0);}})[_0x1227('0x40')](function(_0x48dbe6){if(_0x48dbe6){return _0x48dbe6?{'count':_0xcf7083,'rows':_0x48dbe6}:null;}})[_0x1227('0x40')](respondWithResult(_0x4bdaeb,null))[_0x1227('0x44')](handleError(_0x4bdaeb,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bd001c4..4bdcc6e 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 _0x2c76=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2abd03,_0x15bd78){var _0x397306=function(_0x203b1e){while(--_0x203b1e){_0x2abd03['push'](_0x2abd03['shift']());}};_0x397306(++_0x15bd78);}(_0x2c76,0x158));var _0x62c7=function(_0x2a2a4d,_0x1cd0d1){_0x2a2a4d=_0x2a2a4d-0x0;var _0x2c3e20=_0x2c76[_0x2a2a4d];return _0x2c3e20;};'use strict';var _=require('lodash');var util=require(_0x62c7('0x0'));var logger=require(_0x62c7('0x1'))(_0x62c7('0x2'));var moment=require(_0x62c7('0x3'));var BPromise=require(_0x62c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62c7('0x5'));var rimraf=require(_0x62c7('0x6'));var config=require(_0x62c7('0x7'));var attributes=require(_0x62c7('0x8'));module[_0x62c7('0x9')]=function(_0x14d51c,_0xa076d6){return _0x14d51c[_0x62c7('0xa')](_0x62c7('0xb'),attributes,{'tableName':_0x62c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f4c=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x2c2358,_0x9b0f52){var _0x5b98b2=function(_0x34bb91){while(--_0x34bb91){_0x2c2358['push'](_0x2c2358['shift']());}};_0x5b98b2(++_0x9b0f52);}(_0x3f4c,0x121));var _0xc3f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3f4('0x0'));var util=require(_0xc3f4('0x1'));var logger=require(_0xc3f4('0x2'))(_0xc3f4('0x3'));var moment=require(_0xc3f4('0x4'));var BPromise=require(_0xc3f4('0x5'));var rp=require(_0xc3f4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3f4('0x7'));var config=require(_0xc3f4('0x8'));var attributes=require(_0xc3f4('0x9'));module[_0xc3f4('0xa')]=function(_0x4242e0,_0x53eb45){return _0x4242e0['define']('ZohoConfiguration',attributes,{'tableName':_0xc3f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 2d439a4..8aa7b3e 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 _0x2cbc=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x53e51e,_0x416eaa){var _0x48c2fb=function(_0x461bd1){while(--_0x461bd1){_0x53e51e['push'](_0x53e51e['shift']());}};_0x48c2fb(++_0x416eaa);}(_0x2cbc,0xb0));var _0xc2cb=function(_0x87dd0e,_0x390eec){_0x87dd0e=_0x87dd0e-0x0;var _0x3f6891=_0x2cbc[_0x87dd0e];return _0x3f6891;};'use strict';var _=require(_0xc2cb('0x0'));var util=require(_0xc2cb('0x1'));var moment=require(_0xc2cb('0x2'));var BPromise=require(_0xc2cb('0x3'));var rs=require(_0xc2cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2cb('0x5'))['db'];var utils=require(_0xc2cb('0x6'));var logger=require('../../config/logger')(_0xc2cb('0x7'));var config=require(_0xc2cb('0x8'));var jayson=require(_0xc2cb('0x9'));var client=jayson[_0xc2cb('0xa')][_0xc2cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad2e0,_0x10c9a7,_0x45af25){return new BPromise(function(_0x425eda,_0x582ed1){return client['request'](_0x5ad2e0,_0x45af25)[_0xc2cb('0xc')](function(_0x330c43){logger[_0xc2cb('0xd')](_0xc2cb('0xe'),_0x10c9a7,_0xc2cb('0xf'));logger['debug'](_0xc2cb('0x10'),_0x10c9a7,'request\x20sent',JSON[_0xc2cb('0x11')](_0x330c43));if(_0x330c43[_0xc2cb('0x12')]){if(_0x330c43['error'][_0xc2cb('0x13')]===0x1f4){logger[_0xc2cb('0x12')](_0xc2cb('0xe'),_0x10c9a7,_0x330c43['error'][_0xc2cb('0x14')]);return _0x582ed1(_0x330c43['error'][_0xc2cb('0x14')]);}logger['error'](_0xc2cb('0xe'),_0x10c9a7,_0x330c43[_0xc2cb('0x12')][_0xc2cb('0x14')]);return _0x425eda(_0x330c43[_0xc2cb('0x12')][_0xc2cb('0x14')]);}else{logger[_0xc2cb('0xd')](_0xc2cb('0xe'),_0x10c9a7,_0xc2cb('0xf'));_0x425eda(_0x330c43['result'][_0xc2cb('0x14')]);}})[_0xc2cb('0x15')](function(_0x2263fc){logger[_0xc2cb('0x12')](_0xc2cb('0xe'),_0x10c9a7,_0x2263fc);_0x582ed1(_0x2263fc);});});} \ No newline at end of file +var _0xc86d=['../../config/environment','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4700a1,_0x5c3cf8){var _0x121ab9=function(_0x718dd6){while(--_0x718dd6){_0x4700a1['push'](_0x4700a1['shift']());}};_0x121ab9(++_0x5c3cf8);}(_0xc86d,0x1da));var _0xdc86=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc86d[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var moment=require(_0xdc86('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc86('0x3'));var fs=require('fs');var Redis=require(_0xdc86('0x4'));var db=require(_0xdc86('0x5'))['db'];var utils=require(_0xdc86('0x6'));var logger=require(_0xdc86('0x7'))(_0xdc86('0x8'));var config=require(_0xdc86('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe84faa,_0x1d6f98,_0x119772){return new BPromise(function(_0x2c161c,_0x49f6a2){return client['request'](_0xe84faa,_0x119772)[_0xdc86('0xb')](function(_0x41f158){logger['info'](_0xdc86('0xc'),_0x1d6f98,_0xdc86('0xd'));logger[_0xdc86('0xe')](_0xdc86('0xf'),_0x1d6f98,_0xdc86('0xd'),JSON['stringify'](_0x41f158));if(_0x41f158[_0xdc86('0x10')]){if(_0x41f158['error'][_0xdc86('0x11')]===0x1f4){logger[_0xdc86('0x10')](_0xdc86('0xc'),_0x1d6f98,_0x41f158['error'][_0xdc86('0x12')]);return _0x49f6a2(_0x41f158[_0xdc86('0x10')][_0xdc86('0x12')]);}logger[_0xdc86('0x10')](_0xdc86('0xc'),_0x1d6f98,_0x41f158[_0xdc86('0x10')][_0xdc86('0x12')]);return _0x2c161c(_0x41f158[_0xdc86('0x10')]['message']);}else{logger[_0xdc86('0x13')](_0xdc86('0xc'),_0x1d6f98,_0xdc86('0xd'));_0x2c161c(_0x41f158['result'][_0xdc86('0x12')]);}})[_0xdc86('0x14')](function(_0x2b8662){logger[_0xdc86('0x10')](_0xdc86('0xc'),_0x1d6f98,_0x2b8662);_0x49f6a2(_0x2b8662);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3ad780e..24c7773 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 _0xc139=['isAuthenticated','index','/:id','show','post','put','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x40a9e7,_0x1a57c4){var _0x303082=function(_0x13c3fd){while(--_0x13c3fd){_0x40a9e7['push'](_0x40a9e7['shift']());}};_0x303082(++_0x1a57c4);}(_0xc139,0x16d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9c13('0x0'));var path=require(_0x9c13('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c13('0x2'));var router=express[_0x9c13('0x3')]();var fs_extra=require(_0x9c13('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9c13('0x5'));var config=require(_0x9c13('0x6'));var controller=require(_0x9c13('0x7'));router[_0x9c13('0x8')]('/',auth[_0x9c13('0x9')](),controller[_0x9c13('0xa')]);router[_0x9c13('0x8')](_0x9c13('0xb'),auth[_0x9c13('0x9')](),controller[_0x9c13('0xc')]);router[_0x9c13('0xd')]('/',auth[_0x9c13('0x9')](),controller['create']);router[_0x9c13('0xe')]('/:id',auth[_0x9c13('0x9')](),controller['update']);router[_0x9c13('0xf')](_0x9c13('0xb'),auth[_0x9c13('0x9')](),controller['destroy']);module[_0x9c13('0x10')]=router; \ No newline at end of file +var _0x293d=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ea81d,_0x4c5b1a){var _0x1ed489=function(_0xf4198e){while(--_0xf4198e){_0x3ea81d['push'](_0x3ea81d['shift']());}};_0x1ed489(++_0x4c5b1a);}(_0x293d,0x8c));var _0xd293=function(_0x4fb4ba,_0x1ac856){_0x4fb4ba=_0x4fb4ba-0x0;var _0x5f02c0=_0x293d[_0x4fb4ba];return _0x5f02c0;};'use strict';var multer=require('multer');var util=require(_0xd293('0x0'));var path=require(_0xd293('0x1'));var timeout=require(_0xd293('0x2'));var express=require(_0xd293('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd293('0x4'));var config=require(_0xd293('0x5'));var controller=require(_0xd293('0x6'));router[_0xd293('0x7')]('/',auth[_0xd293('0x8')](),controller['index']);router[_0xd293('0x7')]('/:id',auth[_0xd293('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd293('0x9')]);router[_0xd293('0xa')](_0xd293('0xb'),auth[_0xd293('0x8')](),controller[_0xd293('0xc')]);router[_0xd293('0xd')](_0xd293('0xb'),auth['isAuthenticated'](),controller[_0xd293('0xe')]);module[_0xd293('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 608d91a..ef11d28 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 _0x0be9=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x8d27d6,_0x25cae2){var _0x9634ae=function(_0x4139af){while(--_0x4139af){_0x8d27d6['push'](_0x8d27d6['shift']());}};_0x9634ae(++_0x25cae2);}(_0x0be9,0x1ad));var _0x90be=function(_0x58641f,_0x2622d4){_0x58641f=_0x58641f-0x0;var _0x2505b1=_0x0be9[_0x58641f];return _0x2505b1;};'use strict';var Sequelize=require(_0x90be('0x0'));module[_0x90be('0x1')]={'type':{'type':Sequelize['ENUM'](_0x90be('0x2'),_0x90be('0x3'),_0x90be('0x4'),_0x90be('0x5'),'picklist'),'defaultValue':_0x90be('0x2')},'content':{'type':Sequelize[_0x90be('0x6')]},'key':{'type':Sequelize[_0x90be('0x6')]},'keyType':{'type':Sequelize[_0x90be('0x7')](_0x90be('0x2'),'variable',_0x90be('0x4'))},'keyContent':{'type':Sequelize[_0x90be('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x90be('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x90be('0x6')]}}; \ No newline at end of file +var _0xbbc5=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x39cb93,_0x3e3503){var _0x76b144=function(_0x77f1ef){while(--_0x77f1ef){_0x39cb93['push'](_0x39cb93['shift']());}};_0x76b144(++_0x3e3503);}(_0xbbc5,0xc7));var _0x5bbc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbbc5[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5bbc('0x0')](_0x5bbc('0x1'),_0x5bbc('0x2'),_0x5bbc('0x3'),'keyValue',_0x5bbc('0x4')),'defaultValue':_0x5bbc('0x1')},'content':{'type':Sequelize[_0x5bbc('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5bbc('0x0')](_0x5bbc('0x1'),_0x5bbc('0x2'),_0x5bbc('0x3'))},'keyContent':{'type':Sequelize[_0x5bbc('0x5')]},'idField':{'type':Sequelize[_0x5bbc('0x5')]},'nameField':{'type':Sequelize[_0x5bbc('0x5')]},'customField':{'type':Sequelize[_0x5bbc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4f50b76..3fc4e3d 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 _0x8b75=['fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','sendStatus','stack','name','index','ZohoField'];(function(_0x516ae3,_0x54ae17){var _0x1ea0c4=function(_0xa0d7b){while(--_0xa0d7b){_0x516ae3['push'](_0x516ae3['shift']());}};_0x1ea0c4(++_0x54ae17);}(_0x8b75,0xb7));var _0x58b7=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x8b75[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x58b7('0x0'));var rimraf=require(_0x58b7('0x1'));var zipdir=require(_0x58b7('0x2'));var jsonpatch=require(_0x58b7('0x3'));var rp=require(_0x58b7('0x4'));var moment=require(_0x58b7('0x5'));var BPromise=require(_0x58b7('0x6'));var Mustache=require(_0x58b7('0x7'));var util=require(_0x58b7('0x8'));var path=require('path');var sox=require(_0x58b7('0x9'));var csv=require('to-csv');var ejs=require(_0x58b7('0xa'));var fs=require('fs');var fs_extra=require(_0x58b7('0xb'));var _=require(_0x58b7('0xc'));var squel=require(_0x58b7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58b7('0xe'));var toCsv=require(_0x58b7('0xf'));var querystring=require(_0x58b7('0x10'));var Papa=require(_0x58b7('0x11'));var Redis=require(_0x58b7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58b7('0x13'));var logger=require(_0x58b7('0x14'))(_0x58b7('0x15'));var utils=require(_0x58b7('0x16'));var config=require(_0x58b7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x58b7('0x18'))['db'];function respondWithStatusCode(_0x16b3ad,_0x58353d){_0x58353d=_0x58353d||0xcc;return function(_0x5b6234){if(_0x5b6234){return _0x16b3ad['sendStatus'](_0x58353d);}return _0x16b3ad[_0x58b7('0x19')](_0x58353d)[_0x58b7('0x1a')]();};}function respondWithResult(_0x567c0a,_0x17e2c1){_0x17e2c1=_0x17e2c1||0xc8;return function(_0x59fd56){if(_0x59fd56){return _0x567c0a[_0x58b7('0x19')](_0x17e2c1)[_0x58b7('0x1b')](_0x59fd56);}};}function respondWithFilteredResult(_0x10266f,_0x368ba7){return function(_0x11b1f6){if(_0x11b1f6){var _0x4b6d36=typeof _0x368ba7[_0x58b7('0x1c')]===_0x58b7('0x1d')&&typeof _0x368ba7[_0x58b7('0x1e')]==='undefined';var _0x2bef8b=_0x11b1f6['count'];var _0x238825=_0x4b6d36?0x0:_0x368ba7[_0x58b7('0x1c')];var _0x3440cc=_0x4b6d36?_0x11b1f6[_0x58b7('0x1f')]:_0x368ba7[_0x58b7('0x1c')]+_0x368ba7[_0x58b7('0x1e')];var _0x1e72a2;if(_0x3440cc>=_0x2bef8b){_0x3440cc=_0x2bef8b;_0x1e72a2=0xc8;}else{_0x1e72a2=0xce;}_0x10266f['status'](_0x1e72a2);return _0x10266f['set'](_0x58b7('0x20'),_0x238825+'-'+_0x3440cc+'/'+_0x2bef8b)[_0x58b7('0x1b')](_0x11b1f6);}return null;};}function patchUpdates(_0x3da9c4){return function(_0x15497c){try{jsonpatch[_0x58b7('0x21')](_0x15497c,_0x3da9c4,!![]);}catch(_0x4834da){return BPromise[_0x58b7('0x22')](_0x4834da);}return _0x15497c[_0x58b7('0x23')]();};}function saveUpdates(_0x391b26,_0x323c15){return function(_0x1c995b){if(_0x1c995b){return _0x1c995b['update'](_0x391b26)[_0x58b7('0x24')](function(_0x5344eb){return _0x5344eb;});}return null;};}function removeEntity(_0x10abfd,_0x203ad1){return function(_0x5e22b5){if(_0x5e22b5){return _0x5e22b5['destroy']()[_0x58b7('0x24')](function(){_0x10abfd[_0x58b7('0x19')](0xcc)[_0x58b7('0x1a')]();});}};}function handleEntityNotFound(_0x29490d,_0x392b77){return function(_0x3f1df8){if(!_0x3f1df8){_0x29490d[_0x58b7('0x25')](0x194);}return _0x3f1df8;};}function handleError(_0x2dd553,_0x12dc0f){_0x12dc0f=_0x12dc0f||0x1f4;return function(_0x45d120){logger['error'](_0x45d120[_0x58b7('0x26')]);if(_0x45d120[_0x58b7('0x27')]){delete _0x45d120[_0x58b7('0x27')];}_0x2dd553[_0x58b7('0x19')](_0x12dc0f)['send'](_0x45d120);};}exports[_0x58b7('0x28')]=function(_0x3caed,_0x4b762d){var _0x3dd6d0={},_0x511e52={},_0x19d7e0={'count':0x0,'rows':[]};var _0x1171c6=_['map'](db[_0x58b7('0x29')]['rawAttributes'],function(_0x551a83){return{'name':_0x551a83[_0x58b7('0x2a')],'type':_0x551a83['type']['key']};});_0x511e52[_0x58b7('0x2b')]=_[_0x58b7('0x2c')](_0x1171c6,_0x58b7('0x27'));_0x511e52[_0x58b7('0x2d')]=_[_0x58b7('0x2e')](_0x3caed['query']);_0x511e52[_0x58b7('0x2f')]=_[_0x58b7('0x30')](_0x511e52[_0x58b7('0x2b')],_0x511e52['query']);_0x3dd6d0[_0x58b7('0x31')]=_[_0x58b7('0x30')](_0x511e52['model'],qs[_0x58b7('0x32')](_0x3caed[_0x58b7('0x2d')][_0x58b7('0x32')]));_0x3dd6d0['attributes']=_0x3dd6d0[_0x58b7('0x31')][_0x58b7('0x33')]?_0x3dd6d0[_0x58b7('0x31')]:_0x511e52[_0x58b7('0x2b')];if(!_0x3caed[_0x58b7('0x2d')][_0x58b7('0x34')](_0x58b7('0x35'))){_0x3dd6d0['limit']=qs[_0x58b7('0x1e')](_0x3caed[_0x58b7('0x2d')]['limit']);_0x3dd6d0['offset']=qs[_0x58b7('0x1c')](_0x3caed[_0x58b7('0x2d')][_0x58b7('0x1c')]);}_0x3dd6d0[_0x58b7('0x36')]=qs[_0x58b7('0x37')](_0x3caed[_0x58b7('0x2d')]['sort']);_0x3dd6d0[_0x58b7('0x38')]=qs[_0x58b7('0x2f')](_[_0x58b7('0x39')](_0x3caed['query'],_0x511e52[_0x58b7('0x2f')]),_0x1171c6);if(_0x3caed[_0x58b7('0x2d')]['filter']){_0x3dd6d0[_0x58b7('0x38')]=_[_0x58b7('0x3a')](_0x3dd6d0['where'],{'$or':_[_0x58b7('0x2c')](_0x1171c6,function(_0x1bf342){if(_0x1bf342[_0x58b7('0x3b')]!==_0x58b7('0x3c')){var _0x5cbdc7={};_0x5cbdc7[_0x1bf342['name']]={'$like':'%'+_0x3caed[_0x58b7('0x2d')][_0x58b7('0x3d')]+'%'};return _0x5cbdc7;}})});}_0x3dd6d0=_[_0x58b7('0x3a')]({},_0x3dd6d0,_0x3caed[_0x58b7('0x3e')]);var _0x47cc6f={'where':_0x3dd6d0[_0x58b7('0x38')]};return db[_0x58b7('0x29')][_0x58b7('0x1f')](_0x47cc6f)[_0x58b7('0x24')](function(_0x20a218){_0x19d7e0[_0x58b7('0x1f')]=_0x20a218;if(_0x3caed['query'][_0x58b7('0x3f')]){_0x3dd6d0[_0x58b7('0x40')]=[{'all':!![]}];}return db[_0x58b7('0x29')][_0x58b7('0x41')](_0x3dd6d0);})[_0x58b7('0x24')](function(_0xc63bee){_0x19d7e0[_0x58b7('0x42')]=_0xc63bee;return _0x19d7e0;})['then'](respondWithFilteredResult(_0x4b762d,_0x3dd6d0))[_0x58b7('0x43')](handleError(_0x4b762d,null));};exports[_0x58b7('0x44')]=function(_0x457bae,_0x4cecd5){var _0x567e71={'raw':!![],'where':{'id':_0x457bae[_0x58b7('0x45')]['id']}},_0x2d4727={};_0x2d4727[_0x58b7('0x2b')]=_[_0x58b7('0x2e')](db[_0x58b7('0x29')][_0x58b7('0x46')]);_0x2d4727[_0x58b7('0x2d')]=_[_0x58b7('0x2e')](_0x457bae[_0x58b7('0x2d')]);_0x2d4727[_0x58b7('0x2f')]=_[_0x58b7('0x30')](_0x2d4727[_0x58b7('0x2b')],_0x2d4727[_0x58b7('0x2d')]);_0x567e71[_0x58b7('0x31')]=_[_0x58b7('0x30')](_0x2d4727[_0x58b7('0x2b')],qs['fields'](_0x457bae[_0x58b7('0x2d')][_0x58b7('0x32')]));_0x567e71[_0x58b7('0x31')]=_0x567e71[_0x58b7('0x31')][_0x58b7('0x33')]?_0x567e71['attributes']:_0x2d4727[_0x58b7('0x2b')];if(_0x457bae[_0x58b7('0x2d')][_0x58b7('0x3f')]){_0x567e71[_0x58b7('0x40')]=[{'all':!![]}];}_0x567e71=_['merge']({},_0x567e71,_0x457bae[_0x58b7('0x3e')]);return db[_0x58b7('0x29')][_0x58b7('0x47')](_0x567e71)[_0x58b7('0x24')](handleEntityNotFound(_0x4cecd5,null))['then'](respondWithResult(_0x4cecd5,null))['catch'](handleError(_0x4cecd5,null));};exports['create']=function(_0x15295e,_0x544e5d){return db[_0x58b7('0x29')][_0x58b7('0x48')](_0x15295e[_0x58b7('0x49')],{})[_0x58b7('0x24')](respondWithResult(_0x544e5d,0xc9))[_0x58b7('0x43')](handleError(_0x544e5d,null));};exports['update']=function(_0x6c1433,_0x36de67){if(_0x6c1433[_0x58b7('0x49')]['id']){delete _0x6c1433[_0x58b7('0x49')]['id'];}return db[_0x58b7('0x29')][_0x58b7('0x47')]({'where':{'id':_0x6c1433[_0x58b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x36de67,null))[_0x58b7('0x24')](saveUpdates(_0x6c1433['body'],null))[_0x58b7('0x24')](respondWithResult(_0x36de67,null))[_0x58b7('0x43')](handleError(_0x36de67,null));};exports[_0x58b7('0x4a')]=function(_0x4b472d,_0x458be5){return db[_0x58b7('0x29')][_0x58b7('0x47')]({'where':{'id':_0x4b472d[_0x58b7('0x45')]['id']}})[_0x58b7('0x24')](handleEntityNotFound(_0x458be5,null))['then'](removeEntity(_0x458be5,null))[_0x58b7('0x43')](handleError(_0x458be5,null));}; \ No newline at end of file +var _0x6625=['VIRTUAL','options','where','count','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','end','error','name','send','map','ZohoField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge'];(function(_0xc4f500,_0x5737c0){var _0xf124e5=function(_0x2116c8){while(--_0x2116c8){_0xc4f500['push'](_0xc4f500['shift']());}};_0xf124e5(++_0x5737c0);}(_0x6625,0x141));var _0x5662=function(_0xf85511,_0x546f78){_0xf85511=_0xf85511-0x0;var _0x43acdd=_0x6625[_0xf85511];return _0x43acdd;};'use strict';var emlformat=require(_0x5662('0x0'));var rimraf=require(_0x5662('0x1'));var zipdir=require(_0x5662('0x2'));var jsonpatch=require(_0x5662('0x3'));var rp=require(_0x5662('0x4'));var moment=require(_0x5662('0x5'));var BPromise=require(_0x5662('0x6'));var Mustache=require(_0x5662('0x7'));var util=require(_0x5662('0x8'));var path=require(_0x5662('0x9'));var sox=require(_0x5662('0xa'));var csv=require(_0x5662('0xb'));var ejs=require(_0x5662('0xc'));var fs=require('fs');var fs_extra=require(_0x5662('0xd'));var _=require(_0x5662('0xe'));var squel=require('squel');var crypto=require(_0x5662('0xf'));var jsforce=require(_0x5662('0x10'));var deskjs=require(_0x5662('0x11'));var toCsv=require(_0x5662('0xb'));var querystring=require(_0x5662('0x12'));var Papa=require('papaparse');var Redis=require(_0x5662('0x13'));var authService=require(_0x5662('0x14'));var qs=require(_0x5662('0x15'));var as=require(_0x5662('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5662('0x17'))('api');var utils=require(_0x5662('0x18'));var config=require(_0x5662('0x19'));var licenseUtil=require(_0x5662('0x1a'));var db=require(_0x5662('0x1b'))['db'];function respondWithStatusCode(_0x5eee77,_0x118c34){_0x118c34=_0x118c34||0xcc;return function(_0x571715){if(_0x571715){return _0x5eee77[_0x5662('0x1c')](_0x118c34);}return _0x5eee77[_0x5662('0x1d')](_0x118c34)['end']();};}function respondWithResult(_0x4596e3,_0x3471c7){_0x3471c7=_0x3471c7||0xc8;return function(_0x2627e5){if(_0x2627e5){return _0x4596e3['status'](_0x3471c7)[_0x5662('0x1e')](_0x2627e5);}};}function respondWithFilteredResult(_0x43f1fb,_0x417670){return function(_0x304e5b){if(_0x304e5b){var _0x57e63e=typeof _0x417670[_0x5662('0x1f')]===_0x5662('0x20')&&typeof _0x417670[_0x5662('0x21')]==='undefined';var _0x2830b1=_0x304e5b['count'];var _0x11c222=_0x57e63e?0x0:_0x417670[_0x5662('0x1f')];var _0x5d87d3=_0x57e63e?_0x304e5b['count']:_0x417670[_0x5662('0x1f')]+_0x417670[_0x5662('0x21')];var _0x44850f;if(_0x5d87d3>=_0x2830b1){_0x5d87d3=_0x2830b1;_0x44850f=0xc8;}else{_0x44850f=0xce;}_0x43f1fb[_0x5662('0x1d')](_0x44850f);return _0x43f1fb[_0x5662('0x22')](_0x5662('0x23'),_0x11c222+'-'+_0x5d87d3+'/'+_0x2830b1)[_0x5662('0x1e')](_0x304e5b);}return null;};}function patchUpdates(_0x2a454b){return function(_0x213b11){try{jsonpatch['apply'](_0x213b11,_0x2a454b,!![]);}catch(_0x1b03dd){return BPromise['reject'](_0x1b03dd);}return _0x213b11[_0x5662('0x24')]();};}function saveUpdates(_0x51cfed,_0x22242b){return function(_0x13c684){if(_0x13c684){return _0x13c684[_0x5662('0x25')](_0x51cfed)[_0x5662('0x26')](function(_0x37b8f4){return _0x37b8f4;});}return null;};}function removeEntity(_0x38808f,_0x38ba25){return function(_0x29d309){if(_0x29d309){return _0x29d309[_0x5662('0x27')]()['then'](function(){_0x38808f[_0x5662('0x1d')](0xcc)[_0x5662('0x28')]();});}};}function handleEntityNotFound(_0x5e7974,_0xb30678){return function(_0x225645){if(!_0x225645){_0x5e7974['sendStatus'](0x194);}return _0x225645;};}function handleError(_0x3273df,_0x240a7f){_0x240a7f=_0x240a7f||0x1f4;return function(_0x1abb10){logger[_0x5662('0x29')](_0x1abb10['stack']);if(_0x1abb10[_0x5662('0x2a')]){delete _0x1abb10['name'];}_0x3273df[_0x5662('0x1d')](_0x240a7f)[_0x5662('0x2b')](_0x1abb10);};}exports['index']=function(_0x2383f5,_0x5479f4){var _0x5bb8bb={},_0x3c5e1c={},_0x2693b2={'count':0x0,'rows':[]};var _0x3daed7=_[_0x5662('0x2c')](db[_0x5662('0x2d')][_0x5662('0x2e')],function(_0x16606b){return{'name':_0x16606b['fieldName'],'type':_0x16606b[_0x5662('0x2f')][_0x5662('0x30')]};});_0x3c5e1c[_0x5662('0x31')]=_['map'](_0x3daed7,_0x5662('0x2a'));_0x3c5e1c[_0x5662('0x32')]=_[_0x5662('0x33')](_0x2383f5[_0x5662('0x32')]);_0x3c5e1c['filters']=_[_0x5662('0x34')](_0x3c5e1c[_0x5662('0x31')],_0x3c5e1c['query']);_0x5bb8bb[_0x5662('0x35')]=_[_0x5662('0x34')](_0x3c5e1c[_0x5662('0x31')],qs[_0x5662('0x36')](_0x2383f5[_0x5662('0x32')][_0x5662('0x36')]));_0x5bb8bb[_0x5662('0x35')]=_0x5bb8bb[_0x5662('0x35')][_0x5662('0x37')]?_0x5bb8bb[_0x5662('0x35')]:_0x3c5e1c[_0x5662('0x31')];if(!_0x2383f5[_0x5662('0x32')][_0x5662('0x38')](_0x5662('0x39'))){_0x5bb8bb[_0x5662('0x21')]=qs[_0x5662('0x21')](_0x2383f5['query'][_0x5662('0x21')]);_0x5bb8bb[_0x5662('0x1f')]=qs[_0x5662('0x1f')](_0x2383f5[_0x5662('0x32')]['offset']);}_0x5bb8bb[_0x5662('0x3a')]=qs['sort'](_0x2383f5[_0x5662('0x32')][_0x5662('0x3b')]);_0x5bb8bb['where']=qs[_0x5662('0x3c')](_[_0x5662('0x3d')](_0x2383f5['query'],_0x3c5e1c[_0x5662('0x3c')]),_0x3daed7);if(_0x2383f5[_0x5662('0x32')][_0x5662('0x3e')]){_0x5bb8bb['where']=_[_0x5662('0x3f')](_0x5bb8bb['where'],{'$or':_[_0x5662('0x2c')](_0x3daed7,function(_0x46a4ce){if(_0x46a4ce[_0x5662('0x2f')]!==_0x5662('0x40')){var _0x28a914={};_0x28a914[_0x46a4ce[_0x5662('0x2a')]]={'$like':'%'+_0x2383f5['query'][_0x5662('0x3e')]+'%'};return _0x28a914;}})});}_0x5bb8bb=_[_0x5662('0x3f')]({},_0x5bb8bb,_0x2383f5[_0x5662('0x41')]);var _0x224299={'where':_0x5bb8bb[_0x5662('0x42')]};return db['ZohoField'][_0x5662('0x43')](_0x224299)['then'](function(_0x32a4ba){_0x2693b2[_0x5662('0x43')]=_0x32a4ba;if(_0x2383f5['query'][_0x5662('0x44')]){_0x5bb8bb[_0x5662('0x45')]=[{'all':!![]}];}return db[_0x5662('0x2d')][_0x5662('0x46')](_0x5bb8bb);})[_0x5662('0x26')](function(_0x3a6de7){_0x2693b2[_0x5662('0x47')]=_0x3a6de7;return _0x2693b2;})['then'](respondWithFilteredResult(_0x5479f4,_0x5bb8bb))[_0x5662('0x48')](handleError(_0x5479f4,null));};exports['show']=function(_0x3a0f66,_0x32373a){var _0x688407={'raw':!![],'where':{'id':_0x3a0f66[_0x5662('0x49')]['id']}},_0x14fd03={};_0x14fd03['model']=_['keys'](db[_0x5662('0x2d')]['rawAttributes']);_0x14fd03[_0x5662('0x32')]=_['keys'](_0x3a0f66[_0x5662('0x32')]);_0x14fd03['filters']=_['intersection'](_0x14fd03[_0x5662('0x31')],_0x14fd03['query']);_0x688407[_0x5662('0x35')]=_[_0x5662('0x34')](_0x14fd03[_0x5662('0x31')],qs[_0x5662('0x36')](_0x3a0f66[_0x5662('0x32')][_0x5662('0x36')]));_0x688407[_0x5662('0x35')]=_0x688407['attributes'][_0x5662('0x37')]?_0x688407[_0x5662('0x35')]:_0x14fd03[_0x5662('0x31')];if(_0x3a0f66['query']['includeAll']){_0x688407[_0x5662('0x45')]=[{'all':!![]}];}_0x688407=_[_0x5662('0x3f')]({},_0x688407,_0x3a0f66[_0x5662('0x41')]);return db['ZohoField'][_0x5662('0x4a')](_0x688407)[_0x5662('0x26')](handleEntityNotFound(_0x32373a,null))['then'](respondWithResult(_0x32373a,null))[_0x5662('0x48')](handleError(_0x32373a,null));};exports['create']=function(_0x31369c,_0x3b3578){return db['ZohoField'][_0x5662('0x4b')](_0x31369c[_0x5662('0x4c')],{})[_0x5662('0x26')](respondWithResult(_0x3b3578,0xc9))['catch'](handleError(_0x3b3578,null));};exports[_0x5662('0x25')]=function(_0xb5e717,_0x2370ff){if(_0xb5e717[_0x5662('0x4c')]['id']){delete _0xb5e717['body']['id'];}return db[_0x5662('0x2d')][_0x5662('0x4a')]({'where':{'id':_0xb5e717[_0x5662('0x49')]['id']}})[_0x5662('0x26')](handleEntityNotFound(_0x2370ff,null))[_0x5662('0x26')](saveUpdates(_0xb5e717[_0x5662('0x4c')],null))[_0x5662('0x26')](respondWithResult(_0x2370ff,null))['catch'](handleError(_0x2370ff,null));};exports['destroy']=function(_0x2d2292,_0x30437a){return db[_0x5662('0x2d')][_0x5662('0x4a')]({'where':{'id':_0x2d2292['params']['id']}})[_0x5662('0x26')](handleEntityNotFound(_0x30437a,null))[_0x5662('0x26')](removeEntity(_0x30437a,null))[_0x5662('0x48')](handleError(_0x30437a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e5cf7e1..2f16bc2 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 _0x4325=['../../config/environment','./intZohoField.attributes','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4325,0x1da));var _0x5432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4325[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4325=['../../config/environment','./intZohoField.attributes','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('0xb')],'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 3f3c4b6..4f35202 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 _0x94ff=['rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x94ff,0x6a));var _0xf94f=function(_0x40edd0,_0x5733d3){_0x40edd0=_0x40edd0-0x0;var _0x3e8338=_0x94ff[_0x40edd0];return _0x3e8338;};'use strict';var _=require(_0xf94f('0x0'));var util=require(_0xf94f('0x1'));var moment=require(_0xf94f('0x2'));var BPromise=require(_0xf94f('0x3'));var rs=require(_0xf94f('0x4'));var fs=require('fs');var Redis=require(_0xf94f('0x5'));var db=require(_0xf94f('0x6'))['db'];var utils=require(_0xf94f('0x7'));var logger=require(_0xf94f('0x8'))(_0xf94f('0x9'));var config=require('../../config/environment');var jayson=require(_0xf94f('0xa'));var client=jayson[_0xf94f('0xb')][_0xf94f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47b4b2,_0x4c0a79,_0x1fb9bb){return new BPromise(function(_0x1e996e,_0xc4ec5){return client[_0xf94f('0xd')](_0x47b4b2,_0x1fb9bb)[_0xf94f('0xe')](function(_0x472ef0){logger[_0xf94f('0xf')](_0xf94f('0x10'),_0x4c0a79,_0xf94f('0x11'));logger[_0xf94f('0x12')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4c0a79,'request\x20sent',JSON['stringify'](_0x472ef0));if(_0x472ef0[_0xf94f('0x13')]){if(_0x472ef0[_0xf94f('0x13')][_0xf94f('0x14')]===0x1f4){logger[_0xf94f('0x13')]('ZohoField,\x20%s,\x20%s',_0x4c0a79,_0x472ef0['error']['message']);return _0xc4ec5(_0x472ef0[_0xf94f('0x13')][_0xf94f('0x15')]);}logger[_0xf94f('0x13')]('ZohoField,\x20%s,\x20%s',_0x4c0a79,_0x472ef0[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x1e996e(_0x472ef0[_0xf94f('0x13')]['message']);}else{logger['info'](_0xf94f('0x10'),_0x4c0a79,'request\x20sent');_0x1e996e(_0x472ef0['result'][_0xf94f('0x15')]);}})[_0xf94f('0x16')](function(_0xed5f4f){logger['error'](_0xf94f('0x10'),_0x4c0a79,_0xed5f4f);_0xc4ec5(_0xed5f4f);});});} \ No newline at end of file +var _0x7ba9=['request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xec0fbd,_0x4dbcdb){var _0x24a373=function(_0x4ea092){while(--_0x4ea092){_0xec0fbd['push'](_0xec0fbd['shift']());}};_0x24a373(++_0x4dbcdb);}(_0x7ba9,0x1ef));var _0x97ba=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0x7ba9[_0x30853f];return _0x3c416d;};'use strict';var _=require(_0x97ba('0x0'));var util=require(_0x97ba('0x1'));var moment=require('moment');var BPromise=require(_0x97ba('0x2'));var rs=require(_0x97ba('0x3'));var fs=require('fs');var Redis=require(_0x97ba('0x4'));var db=require(_0x97ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x97ba('0x6'))(_0x97ba('0x7'));var config=require(_0x97ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x97ba('0x9')][_0x97ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x453798,_0x4296fe,_0x2aca27){return new BPromise(function(_0x139631,_0x2f83d8){return client[_0x97ba('0xb')](_0x453798,_0x2aca27)['then'](function(_0x42405b){logger[_0x97ba('0xc')](_0x97ba('0xd'),_0x4296fe,_0x97ba('0xe'));logger[_0x97ba('0xf')](_0x97ba('0x10'),_0x4296fe,'request\x20sent',JSON[_0x97ba('0x11')](_0x42405b));if(_0x42405b[_0x97ba('0x12')]){if(_0x42405b['error'][_0x97ba('0x13')]===0x1f4){logger[_0x97ba('0x12')]('ZohoField,\x20%s,\x20%s',_0x4296fe,_0x42405b['error'][_0x97ba('0x14')]);return _0x2f83d8(_0x42405b[_0x97ba('0x12')]['message']);}logger[_0x97ba('0x12')](_0x97ba('0xd'),_0x4296fe,_0x42405b[_0x97ba('0x12')][_0x97ba('0x14')]);return _0x139631(_0x42405b[_0x97ba('0x12')]['message']);}else{logger[_0x97ba('0xc')](_0x97ba('0xd'),_0x4296fe,_0x97ba('0xe'));_0x139631(_0x42405b[_0x97ba('0x15')][_0x97ba('0x14')]);}})[_0x97ba('0x16')](function(_0x2e5bad){logger[_0x97ba('0x12')](_0x97ba('0xd'),_0x4296fe,_0x2e5bad);_0x2f83d8(_0x2e5bad);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f8afe03..97025cf 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x367cb2,_0x4d422e){var _0x5f505b=function(_0x3463e7){while(--_0x3463e7){_0x367cb2['push'](_0x367cb2['shift']());}};_0x5f505b(++_0x4d422e);}(_0x70e0,0x17b));var _0x070e=function(_0x25ce97,_0x3c3a45){_0x25ce97=_0x25ce97-0x0;var _0x3cee7b=_0x70e0[_0x25ce97];return _0x3cee7b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a2fbf,_0x13c8da){var _0x2c916b=function(_0x1d4888){while(--_0x1d4888){_0x5a2fbf['push'](_0x5a2fbf['shift']());}};_0x2c916b(++_0x13c8da);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b539f55..031cd4d 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 _0x8a1b=['app.js','INTEGER','state','sequelize','exports','unique_name_and_version','STRING'];(function(_0x13ac6c,_0x41abd0){var _0x5331ea=function(_0x12e76a){while(--_0x12e76a){_0x13ac6c['push'](_0x13ac6c['shift']());}};_0x5331ea(++_0x41abd0);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x5124cc,_0x967120){_0x5124cc=_0x5124cc-0x0;var _0x542bdd=_0x8a1b[_0x5124cc];return _0x542bdd;};'use strict';var Sequelize=require(_0xb8a1('0x0'));module[_0xb8a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb8a1('0x2')},'version':{'type':Sequelize[_0xb8a1('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb8a1('0x4')},'filename':{'type':Sequelize[_0xb8a1('0x3')]},'path':{'type':Sequelize[_0xb8a1('0x3')]},'type':{'type':Sequelize[_0xb8a1('0x3')]},'size':{'type':Sequelize[_0xb8a1('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb8a1('0x3')]},'logo':{'type':Sequelize[_0xb8a1('0x3')]},'state':{'type':Sequelize[_0xb8a1('0x3')],'unique':_0xb8a1('0x6')},'description':{'type':Sequelize[_0xb8a1('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb8a1('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x3df4=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x25f1bf,_0x3db86d){var _0x5622cf=function(_0x59d7bd){while(--_0x59d7bd){_0x25f1bf['push'](_0x25f1bf['shift']());}};_0x5622cf(++_0x3db86d);}(_0x3df4,0x173));var _0x43df=function(_0x6674e4,_0x1f1a41){_0x6674e4=_0x6674e4-0x0;var _0x2cfd78=_0x3df4[_0x6674e4];return _0x2cfd78;};'use strict';var Sequelize=require(_0x43df('0x0'));module[_0x43df('0x1')]={'name':{'type':Sequelize[_0x43df('0x2')],'allowNull':![],'unique':_0x43df('0x3')},'version':{'type':Sequelize[_0x43df('0x2')],'allowNull':![],'unique':_0x43df('0x3')},'main':{'type':Sequelize[_0x43df('0x2')],'defaultValue':_0x43df('0x4')},'filename':{'type':Sequelize[_0x43df('0x2')]},'path':{'type':Sequelize[_0x43df('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x43df('0x5')]},'active':{'type':Sequelize[_0x43df('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x43df('0x2')]},'logo':{'type':Sequelize[_0x43df('0x2')]},'state':{'type':Sequelize[_0x43df('0x2')],'unique':_0x43df('0x7')},'description':{'type':Sequelize[_0x43df('0x2')]},'title':{'type':Sequelize[_0x43df('0x2')]},'remoteUri':{'type':Sequelize[_0x43df('0x2')]},'link':{'type':Sequelize[_0x43df('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c593624..49a4ced 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x53ec,0x192));var _0xc53e=function(_0x52f4b8,_0x5eaed9){_0x52f4b8=_0x52f4b8-0x0;var _0x52c0f9=_0x53ec[_0x52f4b8];return _0x52c0f9;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x39f36f,_0x2db91e){var _0x21781f=function(_0x2325b9){while(--_0x2325b9){_0x39f36f['push'](_0x39f36f['shift']());}};_0x21781f(++_0x2db91e);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ebcd2,_0x2d6c36){_0x4ebcd2=_0x4ebcd2-0x0;var _0x102f8f=_0x2ef3[_0x4ebcd2];return _0x102f8f;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 42d5034..a928732 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 _0xa981=['../../config/logger','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa981,0x12a));var _0x1a98=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0xa981[_0x2cacef];return _0x289ba6;};'use strict';var _=require(_0x1a98('0x0'));var util=require(_0x1a98('0x1'));var logger=require(_0x1a98('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a98('0x3'));var rp=require(_0x1a98('0x4'));var fs=require('fs');var path=require(_0x1a98('0x5'));var rimraf=require(_0x1a98('0x6'));var config=require('../../config/environment');var attributes=require(_0x1a98('0x7'));module[_0x1a98('0x8')]=function(_0x1d7192,_0x4d04f1){return _0x1d7192[_0x1a98('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e17=['moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','api'];(function(_0x3466bf,_0x2886dd){var _0x42e29a=function(_0x2fbcee){while(--_0x2fbcee){_0x3466bf['push'](_0x3466bf['shift']());}};_0x42e29a(++_0x2886dd);}(_0x3e17,0x1de));var _0x73e1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3e17[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x73e1('0x0'));var util=require('util');var logger=require(_0x73e1('0x1'))(_0x73e1('0x2'));var moment=require(_0x73e1('0x3'));var BPromise=require(_0x73e1('0x4'));var rp=require(_0x73e1('0x5'));var fs=require('fs');var path=require(_0x73e1('0x6'));var rimraf=require(_0x73e1('0x7'));var config=require('../../config/environment');var attributes=require(_0x73e1('0x8'));module[_0x73e1('0x9')]=function(_0xe21327,_0x5ca0c2){return _0xe21327[_0x73e1('0xa')](_0x73e1('0xb'),attributes,{'tableName':_0x73e1('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 ccff380..be9592a 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x524e,0x15e));var _0xe524=function(_0x4a2ade,_0x32ce71){_0x4a2ade=_0x4a2ade-0x0;var _0x23887d=_0x524e[_0x4a2ade];return _0x23887d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b259a,_0x222250){var _0x39b8b4=function(_0x798bec){while(--_0x798bec){_0x2b259a['push'](_0x2b259a['shift']());}};_0x39b8b4(++_0x222250);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xe8d26a,_0x352036){_0xe8d26a=_0xe8d26a-0x0;var _0x1b5602=_0xc6ac[_0xe8d26a];return _0x1b5602;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 34cc855..e9aea31 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a31e3,_0x3ed43a){var _0x329bd5=function(_0xbd1d6e){while(--_0xbd1d6e){_0x3a31e3['push'](_0x3a31e3['shift']());}};_0x329bd5(++_0x3ed43a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1a1769,_0x1ae48f){_0x1a1769=_0x1a1769-0x0;var _0x506409=_0xc6ac[_0x1a1769];return _0x506409;};'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')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xda2d,0x102));var _0xdda2=function(_0x32681a,_0x38e51f){_0x32681a=_0x32681a-0x0;var _0x377f71=_0xda2d[_0x32681a];return _0x377f71;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 668f834..a5c8f78 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 _0x8da1=['ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8da1,0x88));var _0x18da=function(_0x10d43e,_0x4e5d08){_0x10d43e=_0x10d43e-0x0;var _0xbcf9a5=_0x8da1[_0x10d43e];return _0xbcf9a5;};'use strict';var Sequelize=require(_0x18da('0x0'));module[_0x18da('0x1')]={'integration':{'type':Sequelize[_0x18da('0x2')]},'eventChannel':{'type':Sequelize[_0x18da('0x2')]},'exitStatus':{'type':Sequelize[_0x18da('0x2')]},'ticketId':{'type':Sequelize[_0x18da('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x18da('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x18da('0x2')]},'interface':{'type':Sequelize[_0x18da('0x2')]},'membername':{'type':Sequelize[_0x18da('0x2')]},'agentcalledAt':{'type':Sequelize[_0x18da('0x3')]},'agentconnectAt':{'type':Sequelize[_0x18da('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x18da('0x3')]},'talktime':{'type':Sequelize[_0x18da('0x4')]},'agentacw':{'type':Sequelize[_0x18da('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x18da('0x4')]},'reason':{'type':Sequelize[_0x18da('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x18da('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x18da('0x3')]},'agentdump':{'type':Sequelize[_0x18da('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x18da('0x3')]},'lastevent':{'type':Sequelize[_0x18da('0x2')]},'channel':{'type':Sequelize[_0x18da('0x2')]},'channelstate':{'type':Sequelize[_0x18da('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x18da('0x2')]},'connectedlinename':{'type':Sequelize[_0x18da('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x18da('0x2')]},'context':{'type':Sequelize[_0x18da('0x2')]},'exten':{'type':Sequelize[_0x18da('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x18da('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x18da('0x2')]},'destcalleridnum':{'type':Sequelize[_0x18da('0x2')]},'destcalleridname':{'type':Sequelize[_0x18da('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x18da('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x18da('0x2')]},'destaccountcode':{'type':Sequelize[_0x18da('0x2')]},'destcontext':{'type':Sequelize[_0x18da('0x2')]},'destexten':{'type':Sequelize[_0x18da('0x2')]},'destpriority':{'type':Sequelize[_0x18da('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x18da('0x2')]},'inReplyTo':{'type':Sequelize[_0x18da('0x2')]},'subject':{'type':Sequelize[_0x18da('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x18da('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x18da('0x6')]},'text':{'type':Sequelize[_0x18da('0x6')]},'status':{'type':Sequelize[_0x18da('0x7')](_0x18da('0x8'),_0x18da('0x9'),'RECEIVED',_0x18da('0xa'))},'url':{'type':Sequelize[_0x18da('0x2')]},'app':{'type':Sequelize[_0x18da('0x2')]},'appdata':{'type':Sequelize[_0x18da('0x2')]},'projectId':{'type':Sequelize[_0x18da('0x4')]}}; \ No newline at end of file +var _0x2e60=['TEXT','ENUM','SENT','SENDING','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x567585,_0x41ea71){var _0x2d175e=function(_0xe3c0b3){while(--_0xe3c0b3){_0x567585['push'](_0x567585['shift']());}};_0x2d175e(++_0x41ea71);}(_0x2e60,0x13a));var _0x02e6=function(_0x4008c0,_0x2465aa){_0x4008c0=_0x4008c0-0x0;var _0x1af99f=_0x2e60[_0x4008c0];return _0x1af99f;};'use strict';var Sequelize=require(_0x02e6('0x0'));module[_0x02e6('0x1')]={'integration':{'type':Sequelize[_0x02e6('0x2')]},'eventChannel':{'type':Sequelize[_0x02e6('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x02e6('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x02e6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x02e6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x02e6('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x02e6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x02e6('0x3')]},'holdtime':{'type':Sequelize[_0x02e6('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x02e6('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x02e6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x02e6('0x4')]},'reason':{'type':Sequelize[_0x02e6('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x02e6('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x02e6('0x3')]},'agentdump':{'type':Sequelize[_0x02e6('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x02e6('0x3')]},'lastevent':{'type':Sequelize[_0x02e6('0x2')]},'channel':{'type':Sequelize[_0x02e6('0x2')]},'channelstate':{'type':Sequelize[_0x02e6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x02e6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x02e6('0x2')]},'connectedlinename':{'type':Sequelize[_0x02e6('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x02e6('0x2')]},'context':{'type':Sequelize[_0x02e6('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x02e6('0x2')]},'destchannelstate':{'type':Sequelize[_0x02e6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x02e6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x02e6('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x02e6('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x02e6('0x2')]},'destcontext':{'type':Sequelize[_0x02e6('0x2')]},'destexten':{'type':Sequelize[_0x02e6('0x2')]},'destpriority':{'type':Sequelize[_0x02e6('0x2')]},'destuniqueid':{'type':Sequelize[_0x02e6('0x2')]},'messageId':{'type':Sequelize[_0x02e6('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x02e6('0x2')]},'to':{'type':Sequelize[_0x02e6('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x02e6('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x02e6('0x7')](_0x02e6('0x8'),_0x02e6('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x02e6('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x02e6('0x2')]},'projectId':{'type':Sequelize[_0x02e6('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9c6ed54..c39d35e 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 _0x0fdf=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','error','name','index','IntegrationReport','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','rows','catch','show','params','keys','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service'];(function(_0xd13171,_0xc54453){var _0x452bd0=function(_0x3c0628){while(--_0x3c0628){_0xd13171['push'](_0xd13171['shift']());}};_0x452bd0(++_0xc54453);}(_0x0fdf,0xfd));var _0xf0fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fdf[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0fd('0x0'));var zipdir=require(_0xf0fd('0x1'));var jsonpatch=require(_0xf0fd('0x2'));var rp=require('request-promise');var moment=require(_0xf0fd('0x3'));var BPromise=require(_0xf0fd('0x4'));var Mustache=require(_0xf0fd('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf0fd('0x6'));var csv=require('to-csv');var ejs=require(_0xf0fd('0x7'));var fs=require('fs');var fs_extra=require(_0xf0fd('0x8'));var _=require(_0xf0fd('0x9'));var squel=require(_0xf0fd('0xa'));var crypto=require(_0xf0fd('0xb'));var jsforce=require(_0xf0fd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf0fd('0xd'));var Redis=require('ioredis');var authService=require(_0xf0fd('0xe'));var qs=require(_0xf0fd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0fd('0x10'));var logger=require(_0xf0fd('0x11'))(_0xf0fd('0x12'));var utils=require('../../config/utils');var config=require(_0xf0fd('0x13'));var licenseUtil=require(_0xf0fd('0x14'));var db=require(_0xf0fd('0x15'))['db'];function respondWithStatusCode(_0x39b0b8,_0x47c743){_0x47c743=_0x47c743||0xcc;return function(_0x160666){if(_0x160666){return _0x39b0b8[_0xf0fd('0x16')](_0x47c743);}return _0x39b0b8[_0xf0fd('0x17')](_0x47c743)[_0xf0fd('0x18')]();};}function respondWithResult(_0x502975,_0xaf4d0c){_0xaf4d0c=_0xaf4d0c||0xc8;return function(_0x10c497){if(_0x10c497){return _0x502975[_0xf0fd('0x17')](_0xaf4d0c)['json'](_0x10c497);}};}function respondWithFilteredResult(_0x2779c2,_0xcf960f){return function(_0x220558){if(_0x220558){var _0x2c319a=typeof _0xcf960f[_0xf0fd('0x19')]===_0xf0fd('0x1a')&&typeof _0xcf960f['limit']==='undefined';var _0x3a2cac=_0x220558[_0xf0fd('0x1b')];var _0xdf7d3b=_0x2c319a?0x0:_0xcf960f[_0xf0fd('0x19')];var _0x38fe72=_0x2c319a?_0x220558['count']:_0xcf960f[_0xf0fd('0x19')]+_0xcf960f[_0xf0fd('0x1c')];var _0x2ae536;if(_0x38fe72>=_0x3a2cac){_0x38fe72=_0x3a2cac;_0x2ae536=0xc8;}else{_0x2ae536=0xce;}_0x2779c2['status'](_0x2ae536);return _0x2779c2[_0xf0fd('0x1d')]('Content-Range',_0xdf7d3b+'-'+_0x38fe72+'/'+_0x3a2cac)[_0xf0fd('0x1e')](_0x220558);}return null;};}function patchUpdates(_0x107331){return function(_0x1d9fc0){try{jsonpatch[_0xf0fd('0x1f')](_0x1d9fc0,_0x107331,!![]);}catch(_0x592471){return BPromise['reject'](_0x592471);}return _0x1d9fc0[_0xf0fd('0x20')]();};}function saveUpdates(_0x1e5c06,_0x57b39b){return function(_0x1e5366){if(_0x1e5366){return _0x1e5366[_0xf0fd('0x21')](_0x1e5c06)[_0xf0fd('0x22')](function(_0x286591){return _0x286591;});}return null;};}function removeEntity(_0x5045ed,_0x5ec9fd){return function(_0x4ebc19){if(_0x4ebc19){return _0x4ebc19[_0xf0fd('0x23')]()[_0xf0fd('0x22')](function(){_0x5045ed[_0xf0fd('0x17')](0xcc)[_0xf0fd('0x18')]();});}};}function handleEntityNotFound(_0x25017f,_0x52b3fd){return function(_0x179ef4){if(!_0x179ef4){_0x25017f[_0xf0fd('0x16')](0x194);}return _0x179ef4;};}function handleError(_0x12d821,_0x39b028){_0x39b028=_0x39b028||0x1f4;return function(_0x3056e6){logger[_0xf0fd('0x24')](_0x3056e6['stack']);if(_0x3056e6[_0xf0fd('0x25')]){delete _0x3056e6['name'];}_0x12d821[_0xf0fd('0x17')](_0x39b028)['send'](_0x3056e6);};}exports[_0xf0fd('0x26')]=function(_0xfc8439,_0x408965){var _0x5846f2={},_0x252f4f={},_0x15cb1e={'count':0x0,'rows':[]};var _0x468be0=_['map'](db[_0xf0fd('0x27')][_0xf0fd('0x28')],function(_0x1dae50){return{'name':_0x1dae50['fieldName'],'type':_0x1dae50['type']['key']};});_0x252f4f[_0xf0fd('0x29')]=_['map'](_0x468be0,_0xf0fd('0x25'));_0x252f4f[_0xf0fd('0x2a')]=_['keys'](_0xfc8439[_0xf0fd('0x2a')]);_0x252f4f['filters']=_[_0xf0fd('0x2b')](_0x252f4f[_0xf0fd('0x29')],_0x252f4f[_0xf0fd('0x2a')]);_0x5846f2[_0xf0fd('0x2c')]=_[_0xf0fd('0x2b')](_0x252f4f[_0xf0fd('0x29')],qs[_0xf0fd('0x2d')](_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x2d')]));_0x5846f2[_0xf0fd('0x2c')]=_0x5846f2[_0xf0fd('0x2c')][_0xf0fd('0x2e')]?_0x5846f2['attributes']:_0x252f4f[_0xf0fd('0x29')];if(!_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x2f')](_0xf0fd('0x30'))){_0x5846f2[_0xf0fd('0x1c')]=qs['limit'](_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x1c')]);_0x5846f2['offset']=qs[_0xf0fd('0x19')](_0xfc8439['query']['offset']);}_0x5846f2[_0xf0fd('0x31')]=qs[_0xf0fd('0x32')](_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x32')]);_0x5846f2[_0xf0fd('0x33')]=qs[_0xf0fd('0x34')](_['pick'](_0xfc8439[_0xf0fd('0x2a')],_0x252f4f[_0xf0fd('0x34')]),_0x468be0);if(_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x35')]){_0x5846f2[_0xf0fd('0x33')]=_['merge'](_0x5846f2[_0xf0fd('0x33')],{'$or':_['map'](_0x468be0,function(_0x312f98){if(_0x312f98['type']!==_0xf0fd('0x36')){var _0x53df10={};_0x53df10[_0x312f98[_0xf0fd('0x25')]]={'$like':'%'+_0xfc8439[_0xf0fd('0x2a')]['filter']+'%'};return _0x53df10;}})});}_0x5846f2=_['merge']({},_0x5846f2,_0xfc8439[_0xf0fd('0x37')]);var _0x41cbaa={'where':_0x5846f2[_0xf0fd('0x33')]};return db['IntegrationReport'][_0xf0fd('0x1b')](_0x41cbaa)[_0xf0fd('0x22')](function(_0x140344){_0x15cb1e[_0xf0fd('0x1b')]=_0x140344;if(_0xfc8439[_0xf0fd('0x2a')][_0xf0fd('0x38')]){_0x5846f2['include']=[{'all':!![]}];}return db[_0xf0fd('0x27')]['findAll'](_0x5846f2);})[_0xf0fd('0x22')](function(_0x2c4ca9){_0x15cb1e[_0xf0fd('0x39')]=_0x2c4ca9;return _0x15cb1e;})['then'](respondWithFilteredResult(_0x408965,_0x5846f2))[_0xf0fd('0x3a')](handleError(_0x408965,null));};exports[_0xf0fd('0x3b')]=function(_0x18d003,_0x3a61e6){var _0xe75e19={'raw':![],'where':{'id':_0x18d003[_0xf0fd('0x3c')]['id']}},_0x531f53={};_0x531f53[_0xf0fd('0x29')]=_[_0xf0fd('0x3d')](db[_0xf0fd('0x27')][_0xf0fd('0x28')]);_0x531f53['query']=_[_0xf0fd('0x3d')](_0x18d003[_0xf0fd('0x2a')]);_0x531f53[_0xf0fd('0x34')]=_[_0xf0fd('0x2b')](_0x531f53[_0xf0fd('0x29')],_0x531f53['query']);_0xe75e19['attributes']=_['intersection'](_0x531f53[_0xf0fd('0x29')],qs['fields'](_0x18d003[_0xf0fd('0x2a')][_0xf0fd('0x2d')]));_0xe75e19[_0xf0fd('0x2c')]=_0xe75e19[_0xf0fd('0x2c')]['length']?_0xe75e19[_0xf0fd('0x2c')]:_0x531f53['model'];if(_0x18d003[_0xf0fd('0x2a')][_0xf0fd('0x38')]){_0xe75e19['include']=[{'all':!![]}];}_0xe75e19=_[_0xf0fd('0x3e')]({},_0xe75e19,_0x18d003[_0xf0fd('0x37')]);return db[_0xf0fd('0x27')][_0xf0fd('0x3f')](_0xe75e19)['then'](handleEntityNotFound(_0x3a61e6,null))[_0xf0fd('0x22')](respondWithResult(_0x3a61e6,null))[_0xf0fd('0x3a')](handleError(_0x3a61e6,null));};exports['create']=function(_0x234470,_0x4c95f0){return db[_0xf0fd('0x27')][_0xf0fd('0x40')](_0x234470['body'],{})['then'](respondWithResult(_0x4c95f0,0xc9))['catch'](handleError(_0x4c95f0,null));};exports[_0xf0fd('0x21')]=function(_0x4aae75,_0x399f9b){if(_0x4aae75[_0xf0fd('0x41')]['id']){delete _0x4aae75['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x4aae75[_0xf0fd('0x3c')]['id']}})['then'](handleEntityNotFound(_0x399f9b,null))[_0xf0fd('0x22')](saveUpdates(_0x4aae75[_0xf0fd('0x41')],null))[_0xf0fd('0x22')](respondWithResult(_0x399f9b,null))[_0xf0fd('0x3a')](handleError(_0x399f9b,null));};exports[_0xf0fd('0x23')]=function(_0x5b4926,_0x290099){return db[_0xf0fd('0x27')][_0xf0fd('0x3f')]({'where':{'id':_0x5b4926[_0xf0fd('0x3c')]['id']}})[_0xf0fd('0x22')](handleEntityNotFound(_0x290099,null))['then'](removeEntity(_0x290099,null))[_0xf0fd('0x3a')](handleError(_0x290099,null));};exports[_0xf0fd('0x42')]=function(_0xccc46b,_0x1a6da9){return db[_0xf0fd('0x27')][_0xf0fd('0x42')]()[_0xf0fd('0x22')](respondWithResult(_0x1a6da9,null))[_0xf0fd('0x3a')](handleError(_0x1a6da9,null));}; \ No newline at end of file +var _0x7ee3=['limit','undefined','count','set','Content-Range','json','then','destroy','error','stack','name','index','IntegrationReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset'];(function(_0x556188,_0x1e665a){var _0x5c175d=function(_0x4e222f){while(--_0x4e222f){_0x556188['push'](_0x556188['shift']());}};_0x5c175d(++_0x1e665a);}(_0x7ee3,0xc7));var _0x37ee=function(_0x5e5177,_0x1b728b){_0x5e5177=_0x5e5177-0x0;var _0x2517ab=_0x7ee3[_0x5e5177];return _0x2517ab;};'use strict';var emlformat=require(_0x37ee('0x0'));var rimraf=require(_0x37ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37ee('0x2'));var rp=require(_0x37ee('0x3'));var moment=require(_0x37ee('0x4'));var BPromise=require(_0x37ee('0x5'));var Mustache=require(_0x37ee('0x6'));var util=require(_0x37ee('0x7'));var path=require(_0x37ee('0x8'));var sox=require(_0x37ee('0x9'));var csv=require(_0x37ee('0xa'));var ejs=require(_0x37ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37ee('0xc'));var squel=require(_0x37ee('0xd'));var crypto=require('crypto');var jsforce=require(_0x37ee('0xe'));var deskjs=require(_0x37ee('0xf'));var toCsv=require(_0x37ee('0xa'));var querystring=require(_0x37ee('0x10'));var Papa=require(_0x37ee('0x11'));var Redis=require(_0x37ee('0x12'));var authService=require(_0x37ee('0x13'));var qs=require(_0x37ee('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37ee('0x15'));var logger=require(_0x37ee('0x16'))(_0x37ee('0x17'));var utils=require(_0x37ee('0x18'));var config=require(_0x37ee('0x19'));var licenseUtil=require(_0x37ee('0x1a'));var db=require(_0x37ee('0x1b'))['db'];function respondWithStatusCode(_0x57f7df,_0x237652){_0x237652=_0x237652||0xcc;return function(_0x1d7406){if(_0x1d7406){return _0x57f7df[_0x37ee('0x1c')](_0x237652);}return _0x57f7df['status'](_0x237652)[_0x37ee('0x1d')]();};}function respondWithResult(_0x453f9f,_0x26e6cc){_0x26e6cc=_0x26e6cc||0xc8;return function(_0x56f8e5){if(_0x56f8e5){return _0x453f9f[_0x37ee('0x1e')](_0x26e6cc)['json'](_0x56f8e5);}};}function respondWithFilteredResult(_0xf3e9e,_0x53a0e7){return function(_0x3df933){if(_0x3df933){var _0x128e80=typeof _0x53a0e7[_0x37ee('0x1f')]==='undefined'&&typeof _0x53a0e7[_0x37ee('0x20')]===_0x37ee('0x21');var _0x33117d=_0x3df933[_0x37ee('0x22')];var _0x26c7fb=_0x128e80?0x0:_0x53a0e7['offset'];var _0x26b6f6=_0x128e80?_0x3df933[_0x37ee('0x22')]:_0x53a0e7['offset']+_0x53a0e7[_0x37ee('0x20')];var _0x1859f9;if(_0x26b6f6>=_0x33117d){_0x26b6f6=_0x33117d;_0x1859f9=0xc8;}else{_0x1859f9=0xce;}_0xf3e9e[_0x37ee('0x1e')](_0x1859f9);return _0xf3e9e[_0x37ee('0x23')](_0x37ee('0x24'),_0x26c7fb+'-'+_0x26b6f6+'/'+_0x33117d)[_0x37ee('0x25')](_0x3df933);}return null;};}function patchUpdates(_0x16ec14){return function(_0x9e4174){try{jsonpatch['apply'](_0x9e4174,_0x16ec14,!![]);}catch(_0x2d7032){return BPromise['reject'](_0x2d7032);}return _0x9e4174['save']();};}function saveUpdates(_0x41c1bc,_0x3c1dbc){return function(_0xf96b8d){if(_0xf96b8d){return _0xf96b8d['update'](_0x41c1bc)[_0x37ee('0x26')](function(_0x13004e){return _0x13004e;});}return null;};}function removeEntity(_0x4af700,_0x3a4611){return function(_0x510fea){if(_0x510fea){return _0x510fea[_0x37ee('0x27')]()[_0x37ee('0x26')](function(){_0x4af700[_0x37ee('0x1e')](0xcc)[_0x37ee('0x1d')]();});}};}function handleEntityNotFound(_0xce2463,_0x284d5f){return function(_0x447690){if(!_0x447690){_0xce2463[_0x37ee('0x1c')](0x194);}return _0x447690;};}function handleError(_0x5ad521,_0xd5fb6e){_0xd5fb6e=_0xd5fb6e||0x1f4;return function(_0x25161c){logger[_0x37ee('0x28')](_0x25161c[_0x37ee('0x29')]);if(_0x25161c[_0x37ee('0x2a')]){delete _0x25161c[_0x37ee('0x2a')];}_0x5ad521['status'](_0xd5fb6e)['send'](_0x25161c);};}exports[_0x37ee('0x2b')]=function(_0x352b66,_0x16ce8a){var _0x8595c={},_0x2c01eb={},_0xc22ce9={'count':0x0,'rows':[]};var _0x55c01b=_['map'](db[_0x37ee('0x2c')][_0x37ee('0x2d')],function(_0x3ae7ee){return{'name':_0x3ae7ee[_0x37ee('0x2e')],'type':_0x3ae7ee[_0x37ee('0x2f')]['key']};});_0x2c01eb[_0x37ee('0x30')]=_[_0x37ee('0x31')](_0x55c01b,_0x37ee('0x2a'));_0x2c01eb[_0x37ee('0x32')]=_[_0x37ee('0x33')](_0x352b66[_0x37ee('0x32')]);_0x2c01eb[_0x37ee('0x34')]=_[_0x37ee('0x35')](_0x2c01eb[_0x37ee('0x30')],_0x2c01eb[_0x37ee('0x32')]);_0x8595c[_0x37ee('0x36')]=_[_0x37ee('0x35')](_0x2c01eb[_0x37ee('0x30')],qs['fields'](_0x352b66[_0x37ee('0x32')][_0x37ee('0x37')]));_0x8595c[_0x37ee('0x36')]=_0x8595c[_0x37ee('0x36')][_0x37ee('0x38')]?_0x8595c[_0x37ee('0x36')]:_0x2c01eb[_0x37ee('0x30')];if(!_0x352b66['query'][_0x37ee('0x39')](_0x37ee('0x3a'))){_0x8595c['limit']=qs[_0x37ee('0x20')](_0x352b66[_0x37ee('0x32')][_0x37ee('0x20')]);_0x8595c[_0x37ee('0x1f')]=qs[_0x37ee('0x1f')](_0x352b66['query'][_0x37ee('0x1f')]);}_0x8595c['order']=qs[_0x37ee('0x3b')](_0x352b66[_0x37ee('0x32')]['sort']);_0x8595c[_0x37ee('0x3c')]=qs[_0x37ee('0x34')](_[_0x37ee('0x3d')](_0x352b66['query'],_0x2c01eb[_0x37ee('0x34')]),_0x55c01b);if(_0x352b66['query'][_0x37ee('0x3e')]){_0x8595c['where']=_[_0x37ee('0x3f')](_0x8595c[_0x37ee('0x3c')],{'$or':_[_0x37ee('0x31')](_0x55c01b,function(_0x4fb241){if(_0x4fb241[_0x37ee('0x2f')]!==_0x37ee('0x40')){var _0x549cf1={};_0x549cf1[_0x4fb241[_0x37ee('0x2a')]]={'$like':'%'+_0x352b66[_0x37ee('0x32')][_0x37ee('0x3e')]+'%'};return _0x549cf1;}})});}_0x8595c=_[_0x37ee('0x3f')]({},_0x8595c,_0x352b66[_0x37ee('0x41')]);var _0x242dd5={'where':_0x8595c[_0x37ee('0x3c')]};return db[_0x37ee('0x2c')][_0x37ee('0x22')](_0x242dd5)['then'](function(_0x25c334){_0xc22ce9[_0x37ee('0x22')]=_0x25c334;if(_0x352b66['query'][_0x37ee('0x42')]){_0x8595c['include']=[{'all':!![]}];}return db[_0x37ee('0x2c')][_0x37ee('0x43')](_0x8595c);})[_0x37ee('0x26')](function(_0x2c807f){_0xc22ce9[_0x37ee('0x44')]=_0x2c807f;return _0xc22ce9;})['then'](respondWithFilteredResult(_0x16ce8a,_0x8595c))['catch'](handleError(_0x16ce8a,null));};exports[_0x37ee('0x45')]=function(_0x3ee1bf,_0x4df9ae){var _0x1c685b={'raw':![],'where':{'id':_0x3ee1bf[_0x37ee('0x46')]['id']}},_0xc94da2={};_0xc94da2[_0x37ee('0x30')]=_[_0x37ee('0x33')](db[_0x37ee('0x2c')]['rawAttributes']);_0xc94da2[_0x37ee('0x32')]=_[_0x37ee('0x33')](_0x3ee1bf[_0x37ee('0x32')]);_0xc94da2[_0x37ee('0x34')]=_[_0x37ee('0x35')](_0xc94da2[_0x37ee('0x30')],_0xc94da2[_0x37ee('0x32')]);_0x1c685b[_0x37ee('0x36')]=_[_0x37ee('0x35')](_0xc94da2[_0x37ee('0x30')],qs[_0x37ee('0x37')](_0x3ee1bf['query'][_0x37ee('0x37')]));_0x1c685b['attributes']=_0x1c685b['attributes']['length']?_0x1c685b[_0x37ee('0x36')]:_0xc94da2[_0x37ee('0x30')];if(_0x3ee1bf[_0x37ee('0x32')][_0x37ee('0x42')]){_0x1c685b[_0x37ee('0x47')]=[{'all':!![]}];}_0x1c685b=_[_0x37ee('0x3f')]({},_0x1c685b,_0x3ee1bf[_0x37ee('0x41')]);return db[_0x37ee('0x2c')][_0x37ee('0x48')](_0x1c685b)[_0x37ee('0x26')](handleEntityNotFound(_0x4df9ae,null))[_0x37ee('0x26')](respondWithResult(_0x4df9ae,null))[_0x37ee('0x49')](handleError(_0x4df9ae,null));};exports[_0x37ee('0x4a')]=function(_0x5b6cdc,_0x50e4cc){return db[_0x37ee('0x2c')][_0x37ee('0x4a')](_0x5b6cdc[_0x37ee('0x4b')],{})['then'](respondWithResult(_0x50e4cc,0xc9))[_0x37ee('0x49')](handleError(_0x50e4cc,null));};exports['update']=function(_0x1ed8a1,_0x41ca80){if(_0x1ed8a1[_0x37ee('0x4b')]['id']){delete _0x1ed8a1[_0x37ee('0x4b')]['id'];}return db[_0x37ee('0x2c')][_0x37ee('0x48')]({'where':{'id':_0x1ed8a1[_0x37ee('0x46')]['id']}})[_0x37ee('0x26')](handleEntityNotFound(_0x41ca80,null))['then'](saveUpdates(_0x1ed8a1[_0x37ee('0x4b')],null))[_0x37ee('0x26')](respondWithResult(_0x41ca80,null))[_0x37ee('0x49')](handleError(_0x41ca80,null));};exports[_0x37ee('0x27')]=function(_0x1c669a,_0xbb6466){return db[_0x37ee('0x2c')][_0x37ee('0x48')]({'where':{'id':_0x1c669a[_0x37ee('0x46')]['id']}})[_0x37ee('0x26')](handleEntityNotFound(_0xbb6466,null))['then'](removeEntity(_0xbb6466,null))[_0x37ee('0x49')](handleError(_0xbb6466,null));};exports[_0x37ee('0x4c')]=function(_0x3db7ea,_0x1b5e93){return db['IntegrationReport'][_0x37ee('0x4c')]()[_0x37ee('0x26')](respondWithResult(_0x1b5e93,null))[_0x37ee('0x49')](handleError(_0x1b5e93,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f479277..37b65c4 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 _0xbc75=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x5a8b69,_0x4a5566){var _0x4f18f1=function(_0x2db485){while(--_0x2db485){_0x5a8b69['push'](_0x5a8b69['shift']());}};_0x4f18f1(++_0x4a5566);}(_0xbc75,0x8f));var _0x5bc7=function(_0x3ae555,_0x278d97){_0x3ae555=_0x3ae555-0x0;var _0x465b3e=_0xbc75[_0x3ae555];return _0x465b3e;};'use strict';var _=require('lodash');var util=require(_0x5bc7('0x0'));var logger=require(_0x5bc7('0x1'))(_0x5bc7('0x2'));var moment=require(_0x5bc7('0x3'));var BPromise=require(_0x5bc7('0x4'));var rp=require(_0x5bc7('0x5'));var fs=require('fs');var path=require(_0x5bc7('0x6'));var rimraf=require(_0x5bc7('0x7'));var config=require('../../config/environment');var attributes=require(_0x5bc7('0x8'));module[_0x5bc7('0x9')]=function(_0x567d59,_0x3d25fe){return _0x567d59[_0x5bc7('0xa')](_0x5bc7('0xb'),attributes,{'tableName':_0x5bc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4445=['bluebird','request-promise','path','rimraf','../../config/environment','IntegrationReport','util','api','moment'];(function(_0x4f3a4f,_0x8eba75){var _0x1fae5d=function(_0x1114bd){while(--_0x1114bd){_0x4f3a4f['push'](_0x4f3a4f['shift']());}};_0x1fae5d(++_0x8eba75);}(_0x4445,0xd5));var _0x5444=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0x4445[_0x4996d5];return _0x4793f9;};'use strict';var _=require('lodash');var util=require(_0x5444('0x0'));var logger=require('../../config/logger')(_0x5444('0x1'));var moment=require(_0x5444('0x2'));var BPromise=require(_0x5444('0x3'));var rp=require(_0x5444('0x4'));var fs=require('fs');var path=require(_0x5444('0x5'));var rimraf=require(_0x5444('0x6'));var config=require(_0x5444('0x7'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x20a206,_0xdff2aa){return _0x20a206['define'](_0x5444('0x8'),attributes,{'tableName':'report_integration','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 0ab6992..eb979b0 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x260aa2,_0x6bb7e7){var _0x160e09=function(_0x5a44dd){while(--_0x5a44dd){_0x260aa2['push'](_0x260aa2['shift']());}};_0x160e09(++_0x6bb7e7);}(_0xda19,0xd5));var _0x9da1=function(_0x56d140,_0xc30f69){_0x56d140=_0x56d140-0x0;var _0x27fc08=_0xda19[_0x56d140];return _0x27fc08;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xf39e84,_0x825c93){var _0x58e41f=function(_0x3f2b03){while(--_0x3f2b03){_0xf39e84['push'](_0xf39e84['shift']());}};_0x58e41f(++_0x825c93);}(_0x2ef3,0xba));var _0x32ef=function(_0xd90d0e,_0x2fac7a){_0xd90d0e=_0xd90d0e-0x0;var _0x255f67=_0x2ef3[_0xd90d0e];return _0x255f67;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8b9b10d..a231227 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 _0xea1c=['./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x546177,_0x6e3ac8){var _0x3c8963=function(_0x48704d){while(--_0x48704d){_0x546177['push'](_0x546177['shift']());}};_0x3c8963(++_0x6e3ac8);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcea1('0x0'));var timeout=require(_0xcea1('0x1'));var express=require(_0xcea1('0x2'));var router=express[_0xcea1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcea1('0x4'));var interaction=require(_0xcea1('0x5'));var config=require(_0xcea1('0x6'));var controller=require(_0xcea1('0x7'));router[_0xcea1('0x8')]('/',auth[_0xcea1('0x9')](),controller[_0xcea1('0xa')]);router[_0xcea1('0x8')](_0xcea1('0xb'),auth[_0xcea1('0x9')](),controller[_0xcea1('0xc')]);router['get'](_0xcea1('0xd'),auth[_0xcea1('0x9')](),controller[_0xcea1('0xe')]);router['post']('/',auth[_0xcea1('0x9')](),controller[_0xcea1('0xf')]);router[_0xcea1('0x10')](_0xcea1('0xd'),auth[_0xcea1('0x9')](),controller[_0xcea1('0x11')]);router[_0xcea1('0x10')](_0xcea1('0x12'),auth[_0xcea1('0x9')](),controller[_0xcea1('0x13')]);router[_0xcea1('0x14')]('/:id',auth[_0xcea1('0x9')](),controller['update']);router[_0xcea1('0x15')](_0xcea1('0xb'),auth[_0xcea1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc569=['../../config/environment','get','isAuthenticated','index','show','/:id/sub_intervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x34f565,_0x33a99a){var _0x3b7120=function(_0x4c8776){while(--_0x4c8776){_0x34f565['push'](_0x34f565['shift']());}};_0x3b7120(++_0x33a99a);}(_0xc569,0x159));var _0x9c56=function(_0x1b1a17,_0x1b6ce9){_0x1b1a17=_0x1b1a17-0x0;var _0x46c222=_0xc569[_0x1b1a17];return _0x46c222;};'use strict';var multer=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var path=require(_0x9c56('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c56('0x3'));var router=express[_0x9c56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c56('0x5'));var interaction=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var controller=require('./interval.controller');router[_0x9c56('0x8')]('/',auth[_0x9c56('0x9')](),controller[_0x9c56('0xa')]);router[_0x9c56('0x8')]('/:id',auth[_0x9c56('0x9')](),controller[_0x9c56('0xb')]);router[_0x9c56('0x8')](_0x9c56('0xc'),auth[_0x9c56('0x9')](),controller['getIntervals']);router['post']('/',auth['isAuthenticated'](),controller[_0x9c56('0xd')]);router[_0x9c56('0xe')]('/:id/sub_intervals',auth[_0x9c56('0x9')](),controller['addInterval']);router[_0x9c56('0xe')](_0x9c56('0xf'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x10')]);router[_0x9c56('0x11')](_0x9c56('0x12'),auth[_0x9c56('0x9')](),controller['update']);router[_0x9c56('0x13')](_0x9c56('0x12'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x14')]);module[_0x9c56('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9038675..d74162e 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 _0xbbb6=['STRING','sequelize'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xbbb6,0x159));var _0x6bbb=function(_0x21bb2f,_0x180f19){_0x21bb2f=_0x21bb2f-0x0;var _0x4cd8d1=_0xbbb6[_0x21bb2f];return _0x4cd8d1;};'use strict';var Sequelize=require(_0x6bbb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6bbb('0x1')]},'interval':{'type':Sequelize[_0x6bbb('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xbdeb=['exports','STRING','sequelize'];(function(_0x4a73d9,_0x1e93e0){var _0x23db2f=function(_0x427d17){while(--_0x427d17){_0x4a73d9['push'](_0x4a73d9['shift']());}};_0x23db2f(++_0x1e93e0);}(_0xbdeb,0x1af));var _0xbbde=function(_0xd405fb,_0xaaa0bd){_0xd405fb=_0xd405fb-0x0;var _0x211e1d=_0xbdeb[_0xd405fb];return _0x211e1d;};'use strict';var Sequelize=require(_0xbbde('0x0'));module[_0xbbde('0x1')]={'name':{'type':Sequelize[_0xbbde('0x2')]},'description':{'type':Sequelize[_0xbbde('0x2')]},'interval':{'type':Sequelize[_0xbbde('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 6ca69b8..03022d3 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 _0x95b1=['keys','rawAttributes','sort','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','where','filters','pick','filter','merge','type','VIRTUAL','options','Interval','includeAll','include','findAll','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne'];(function(_0x5553a3,_0x2e737d){var _0x4ce977=function(_0x297ae8){while(--_0x297ae8){_0x5553a3['push'](_0x5553a3['shift']());}};_0x4ce977(++_0x2e737d);}(_0x95b1,0x178));var _0x195b=function(_0x5ced4f,_0x5d2ab7){_0x5ced4f=_0x5ced4f-0x0;var _0x125c1c=_0x95b1[_0x5ced4f];return _0x125c1c;};'use strict';var emlformat=require(_0x195b('0x0'));var rimraf=require(_0x195b('0x1'));var zipdir=require(_0x195b('0x2'));var jsonpatch=require(_0x195b('0x3'));var rp=require('request-promise');var moment=require(_0x195b('0x4'));var BPromise=require(_0x195b('0x5'));var Mustache=require(_0x195b('0x6'));var util=require(_0x195b('0x7'));var path=require(_0x195b('0x8'));var sox=require(_0x195b('0x9'));var csv=require('to-csv');var ejs=require(_0x195b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x195b('0xb'));var squel=require(_0x195b('0xc'));var crypto=require('crypto');var jsforce=require(_0x195b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x195b('0xe'));var Papa=require(_0x195b('0xf'));var Redis=require(_0x195b('0x10'));var authService=require(_0x195b('0x11'));var qs=require(_0x195b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x195b('0x13'))(_0x195b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x195b('0x15'));var db=require(_0x195b('0x16'))['db'];var extensions=require(_0x195b('0x17'));function respondWithStatusCode(_0x399047,_0x46091a){_0x46091a=_0x46091a||0xcc;return function(_0x5467e5){if(_0x5467e5){return _0x399047[_0x195b('0x18')](_0x46091a);}return _0x399047['status'](_0x46091a)[_0x195b('0x19')]();};}function respondWithResult(_0x84fc0a,_0x2f16d5){_0x2f16d5=_0x2f16d5||0xc8;return function(_0x19211b){if(_0x19211b){return _0x84fc0a[_0x195b('0x1a')](_0x2f16d5)[_0x195b('0x1b')](_0x19211b);}};}function respondWithFilteredResult(_0x5a277c,_0x29da54){return function(_0x50bf4e){if(_0x50bf4e){var _0x470876=typeof _0x29da54[_0x195b('0x1c')]===_0x195b('0x1d')&&typeof _0x29da54[_0x195b('0x1e')]===_0x195b('0x1d');var _0xa72597=_0x50bf4e['count'];var _0x5870d4=_0x470876?0x0:_0x29da54[_0x195b('0x1c')];var _0x33eaf9=_0x470876?_0x50bf4e[_0x195b('0x1f')]:_0x29da54[_0x195b('0x1c')]+_0x29da54[_0x195b('0x1e')];var _0x13f51c;if(_0x33eaf9>=_0xa72597){_0x33eaf9=_0xa72597;_0x13f51c=0xc8;}else{_0x13f51c=0xce;}_0x5a277c['status'](_0x13f51c);return _0x5a277c[_0x195b('0x20')](_0x195b('0x21'),_0x5870d4+'-'+_0x33eaf9+'/'+_0xa72597)[_0x195b('0x1b')](_0x50bf4e);}return null;};}function patchUpdates(_0x2a86bd){return function(_0x3cacd6){try{jsonpatch[_0x195b('0x22')](_0x3cacd6,_0x2a86bd,!![]);}catch(_0x47ff59){return BPromise[_0x195b('0x23')](_0x47ff59);}return _0x3cacd6[_0x195b('0x24')]();};}function saveUpdates(_0x106aaa,_0x3acbca){return function(_0x232cd1){if(_0x232cd1){return _0x232cd1[_0x195b('0x25')](_0x106aaa)[_0x195b('0x26')](function(_0x3e4fde){return _0x3e4fde;});}return null;};}function removeEntity(_0xd01ccb,_0x206356){return function(_0x325f64){if(_0x325f64){return _0x325f64[_0x195b('0x27')]()[_0x195b('0x26')](function(){var _0x1fbb36=_0x325f64[_0x195b('0x28')]({'plain':!![]});var _0x360efe='Intervals';return db[_0x195b('0x29')]['destroy']({'where':{'type':_0x360efe,'resourceId':_0x1fbb36['id']}})[_0x195b('0x26')](function(){return _0x325f64;});})[_0x195b('0x26')](function(){_0xd01ccb[_0x195b('0x1a')](0xcc)[_0x195b('0x19')]();});}};}function handleEntityNotFound(_0x538beb,_0xb3f711){return function(_0x3687a2){if(!_0x3687a2){_0x538beb[_0x195b('0x18')](0x194);}return _0x3687a2;};}function handleError(_0x34078d,_0x4b7f63){_0x4b7f63=_0x4b7f63||0x1f4;return function(_0x19c1f6){logger[_0x195b('0x2a')](_0x19c1f6[_0x195b('0x2b')]);if(_0x19c1f6[_0x195b('0x2c')]){delete _0x19c1f6[_0x195b('0x2c')];}_0x34078d[_0x195b('0x1a')](_0x4b7f63)[_0x195b('0x2d')](_0x19c1f6);};}exports['index']=function(_0x3c06c9,_0x2ca6aa){var _0x52f3ed={},_0x19ed0b={},_0x3c1699={'count':0x0,'rows':[]};var _0x193eb1=_['map'](db['Interval']['rawAttributes'],function(_0x2293c5){return{'name':_0x2293c5[_0x195b('0x2e')],'type':_0x2293c5['type'][_0x195b('0x2f')]};});_0x19ed0b[_0x195b('0x30')]=_[_0x195b('0x31')](_0x193eb1,'name');_0x19ed0b[_0x195b('0x32')]=_['keys'](_0x3c06c9[_0x195b('0x32')]);_0x19ed0b['filters']=_[_0x195b('0x33')](_0x19ed0b[_0x195b('0x30')],_0x19ed0b[_0x195b('0x32')]);_0x52f3ed[_0x195b('0x34')]=_[_0x195b('0x33')](_0x19ed0b[_0x195b('0x30')],qs[_0x195b('0x35')](_0x3c06c9[_0x195b('0x32')][_0x195b('0x35')]));_0x52f3ed['attributes']=_0x52f3ed[_0x195b('0x34')]['length']?_0x52f3ed[_0x195b('0x34')]:_0x19ed0b['model'];if(!_0x3c06c9[_0x195b('0x32')][_0x195b('0x36')]('nolimit')){_0x52f3ed['limit']=qs[_0x195b('0x1e')](_0x3c06c9[_0x195b('0x32')]['limit']);_0x52f3ed[_0x195b('0x1c')]=qs['offset'](_0x3c06c9['query']['offset']);}_0x52f3ed[_0x195b('0x37')]=qs['sort'](_0x3c06c9['query']['sort']);_0x52f3ed[_0x195b('0x38')]=qs[_0x195b('0x39')](_[_0x195b('0x3a')](_0x3c06c9[_0x195b('0x32')],_0x19ed0b[_0x195b('0x39')]),_0x193eb1);if(_0x3c06c9[_0x195b('0x32')][_0x195b('0x3b')]){_0x52f3ed[_0x195b('0x38')]=_[_0x195b('0x3c')](_0x52f3ed['where'],{'$or':_[_0x195b('0x31')](_0x193eb1,function(_0x2def7d){if(_0x2def7d[_0x195b('0x3d')]!==_0x195b('0x3e')){var _0x240443={};_0x240443[_0x2def7d[_0x195b('0x2c')]]={'$like':'%'+_0x3c06c9[_0x195b('0x32')][_0x195b('0x3b')]+'%'};return _0x240443;}})});}_0x52f3ed=_[_0x195b('0x3c')]({},_0x52f3ed,_0x3c06c9[_0x195b('0x3f')]);var _0xd998eb={'where':_0x52f3ed[_0x195b('0x38')]};return db[_0x195b('0x40')][_0x195b('0x1f')](_0xd998eb)[_0x195b('0x26')](function(_0x468943){_0x3c1699['count']=_0x468943;if(_0x3c06c9[_0x195b('0x32')][_0x195b('0x41')]){_0x52f3ed[_0x195b('0x42')]=[{'all':!![]}];}return db[_0x195b('0x40')][_0x195b('0x43')](_0x52f3ed);})[_0x195b('0x26')](function(_0x178932){_0x3c1699['rows']=_0x178932;return _0x3c1699;})['then'](respondWithFilteredResult(_0x2ca6aa,_0x52f3ed))[_0x195b('0x44')](handleError(_0x2ca6aa,null));};exports['show']=function(_0x2fd547,_0x5584ae){var _0x15213c={'raw':!![],'where':{'id':_0x2fd547[_0x195b('0x45')]['id']}},_0x4c67fb={};_0x4c67fb[_0x195b('0x30')]=_['keys'](db['Interval']['rawAttributes']);_0x4c67fb[_0x195b('0x32')]=_['keys'](_0x2fd547['query']);_0x4c67fb[_0x195b('0x39')]=_[_0x195b('0x33')](_0x4c67fb[_0x195b('0x30')],_0x4c67fb[_0x195b('0x32')]);_0x15213c['attributes']=_['intersection'](_0x4c67fb[_0x195b('0x30')],qs[_0x195b('0x35')](_0x2fd547['query'][_0x195b('0x35')]));_0x15213c[_0x195b('0x34')]=_0x15213c[_0x195b('0x34')][_0x195b('0x46')]?_0x15213c[_0x195b('0x34')]:_0x4c67fb['model'];if(_0x2fd547['query']['includeAll']){_0x15213c[_0x195b('0x42')]=[{'all':!![]}];}_0x15213c=_[_0x195b('0x3c')]({},_0x15213c,_0x2fd547['options']);return db[_0x195b('0x40')]['find'](_0x15213c)[_0x195b('0x26')](handleEntityNotFound(_0x5584ae,null))[_0x195b('0x26')](respondWithResult(_0x5584ae,null))[_0x195b('0x44')](handleError(_0x5584ae,null));};exports[_0x195b('0x47')]=function(_0x59b426,_0x10cbbf){return db[_0x195b('0x40')][_0x195b('0x47')](_0x59b426[_0x195b('0x48')],{})[_0x195b('0x26')](function(_0x11369e){var _0xc4d769=_0x59b426[_0x195b('0x49')][_0x195b('0x28')]({'plain':!![]});if(!_0xc4d769)throw new Error(_0x195b('0x4a'));if(_0xc4d769['role']==='user'){var _0x22e90d=_0x11369e[_0x195b('0x28')]({'plain':!![]});var _0x4ced9b=_0x195b('0x4b');return db[_0x195b('0x4c')][_0x195b('0x4d')]({'where':{'name':_0x4ced9b,'userProfileId':_0xc4d769[_0x195b('0x4e')]},'raw':!![]})[_0x195b('0x26')](function(_0x11e1d3){if(_0x11e1d3&&_0x11e1d3[_0x195b('0x4f')]===0x0){return db[_0x195b('0x29')][_0x195b('0x47')]({'name':_0x22e90d['name'],'resourceId':_0x22e90d['id'],'type':_0x11e1d3[_0x195b('0x2c')],'sectionId':_0x11e1d3['id']},{})[_0x195b('0x26')](function(){return _0x11369e;});}else{return _0x11369e;}})[_0x195b('0x44')](function(_0x3e3677){logger['error'](_0x195b('0x50'),_0x3e3677);throw _0x3e3677;});}return _0x11369e;})[_0x195b('0x26')](respondWithResult(_0x10cbbf,0xc9))[_0x195b('0x44')](handleError(_0x10cbbf,null));};exports[_0x195b('0x25')]=function(_0x4e628e,_0x16f7d0){if(_0x4e628e[_0x195b('0x48')]['id']){delete _0x4e628e['body']['id'];}return db[_0x195b('0x40')][_0x195b('0x4d')]({'where':{'id':_0x4e628e[_0x195b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16f7d0,null))[_0x195b('0x26')](saveUpdates(_0x4e628e[_0x195b('0x48')],null))['then'](respondWithResult(_0x16f7d0,null))[_0x195b('0x44')](handleError(_0x16f7d0,null));};exports[_0x195b('0x27')]=function(_0x3005c3,_0x2408b1){return db[_0x195b('0x40')][_0x195b('0x4d')]({'where':{'id':_0x3005c3[_0x195b('0x45')]['id']}})[_0x195b('0x26')](handleEntityNotFound(_0x2408b1,null))[_0x195b('0x26')](removeEntity(_0x2408b1,null))['catch'](handleError(_0x2408b1,null));};exports[_0x195b('0x51')]=function(_0xa7dc3d,_0x1a8053,_0x349d9d){if(_0xa7dc3d[_0x195b('0x48')]['id']){delete _0xa7dc3d[_0x195b('0x48')]['id'];}return db[_0x195b('0x40')][_0x195b('0x4d')]({'where':{'id':_0xa7dc3d[_0x195b('0x45')]['id']}})[_0x195b('0x26')](handleEntityNotFound(_0x1a8053,null))[_0x195b('0x26')](function(_0xe63c03){if(_0xe63c03){_0xa7dc3d[_0x195b('0x48')][_0x195b('0x52')]=_0xe63c03['id'];return db['Interval'][_0x195b('0x47')](_0xa7dc3d[_0x195b('0x48')]);}})[_0x195b('0x26')](respondWithResult(_0x1a8053,null))['catch'](handleError(_0x1a8053,null));};exports['getIntervals']=function(_0x54f664,_0x5263a8,_0x1ac3cf){var _0x5bdf8e={};var _0x4d6a78={};var _0x56c65b;var _0x44d2de;return db[_0x195b('0x40')][_0x195b('0x53')]({'where':{'id':_0x54f664[_0x195b('0x45')]['id']}})[_0x195b('0x26')](handleEntityNotFound(_0x5263a8,null))['then'](function(_0x13833b){if(_0x13833b){_0x56c65b=_0x13833b;_0x4d6a78[_0x195b('0x30')]=_[_0x195b('0x54')](db['Interval'][_0x195b('0x55')]);_0x4d6a78['query']=_[_0x195b('0x54')](_0x54f664[_0x195b('0x32')]);_0x4d6a78[_0x195b('0x39')]=_[_0x195b('0x33')](_0x4d6a78['model'],_0x4d6a78[_0x195b('0x32')]);_0x5bdf8e[_0x195b('0x34')]=_[_0x195b('0x33')](_0x4d6a78[_0x195b('0x30')],qs[_0x195b('0x35')](_0x54f664[_0x195b('0x32')]['fields']));_0x5bdf8e[_0x195b('0x34')]=_0x5bdf8e[_0x195b('0x34')][_0x195b('0x46')]?_0x5bdf8e[_0x195b('0x34')]:_0x4d6a78['model'];_0x5bdf8e[_0x195b('0x37')]=qs[_0x195b('0x56')](_0x54f664[_0x195b('0x32')][_0x195b('0x56')]);_0x5bdf8e['where']=qs['filters'](_[_0x195b('0x3a')](_0x54f664[_0x195b('0x32')],_0x4d6a78[_0x195b('0x39')]));if(_0x54f664[_0x195b('0x32')]['filter']){_0x5bdf8e[_0x195b('0x38')]=_[_0x195b('0x3c')](_0x5bdf8e[_0x195b('0x38')],{'$or':_[_0x195b('0x31')](_0x5bdf8e[_0x195b('0x34')],function(_0x55a4d3){var _0x4fc0b7={};_0x4fc0b7[_0x55a4d3]={'$like':'%'+_0x54f664[_0x195b('0x32')][_0x195b('0x3b')]+'%'};return _0x4fc0b7;})});}_0x5bdf8e=_[_0x195b('0x3c')]({},_0x5bdf8e,_0x54f664[_0x195b('0x3f')]);return _0x56c65b[_0x195b('0x57')](_0x5bdf8e);}})[_0x195b('0x26')](function(_0x13022b){if(_0x13022b){_0x44d2de=_0x13022b['length'];if(!_0x54f664[_0x195b('0x32')]['hasOwnProperty']('nolimit')){_0x5bdf8e[_0x195b('0x1e')]=qs[_0x195b('0x1e')](_0x54f664[_0x195b('0x32')][_0x195b('0x1e')]);_0x5bdf8e[_0x195b('0x1c')]=qs[_0x195b('0x1c')](_0x54f664[_0x195b('0x32')]['offset']);}return _0x56c65b[_0x195b('0x57')](_0x5bdf8e);}})[_0x195b('0x26')](function(_0x26cc79){if(_0x26cc79){return _0x26cc79?{'count':_0x44d2de,'rows':_0x26cc79}:null;}})[_0x195b('0x26')](respondWithResult(_0x5263a8,null))[_0x195b('0x44')](handleError(_0x5263a8,null));};exports[_0x195b('0x58')]=function(_0x10bcae,_0x5028fd,_0x57119d){return db['Interval']['findOne']({'where':{'id':_0x10bcae[_0x195b('0x45')]['id']}})[_0x195b('0x26')](handleEntityNotFound(_0x5028fd,null))['then'](function(_0x41f1b5){if(_0x41f1b5){return db[_0x195b('0x59')][_0x195b('0x5a')](function(_0xb34d29){return db[_0x195b('0x40')]['destroy']({'where':{'IntervalId':_0x10bcae[_0x195b('0x45')]['id']},'transaction':_0xb34d29})[_0x195b('0x26')](function(_0x2a57ef){var _0x29845b=_['map'](_0x10bcae[_0x195b('0x48')],function(_0x233786){delete _0x233786['id'];_0x233786[_0x195b('0x52')]=_0x10bcae[_0x195b('0x45')]['id'];return _0x233786;});return db['Interval'][_0x195b('0x5b')](_0x29845b,{'transaction':_0xb34d29});});})['then'](function(){return db[_0x195b('0x40')][_0x195b('0x43')]({'where':{'IntervalId':_0x10bcae[_0x195b('0x45')]['id']}});});}})[_0x195b('0x26')](respondWithResult(_0x5028fd,null))[_0x195b('0x44')](handleError(_0x5028fd,null));}; \ No newline at end of file +var _0xb8a8=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','get','Intervals','error','name','index','Interval','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','nolimit','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xb8a8,0xf0));var _0x8b8a=function(_0x3011e9,_0x73094c){_0x3011e9=_0x3011e9-0x0;var _0x386596=_0xb8a8[_0x3011e9];return _0x386596;};'use strict';var emlformat=require(_0x8b8a('0x0'));var rimraf=require(_0x8b8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b8a('0x2'));var moment=require(_0x8b8a('0x3'));var BPromise=require(_0x8b8a('0x4'));var Mustache=require(_0x8b8a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8b8a('0x6'));var csv=require('to-csv');var ejs=require(_0x8b8a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b8a('0x8'));var squel=require(_0x8b8a('0x9'));var crypto=require(_0x8b8a('0xa'));var jsforce=require(_0x8b8a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8b8a('0xc'));var querystring=require(_0x8b8a('0xd'));var Papa=require(_0x8b8a('0xe'));var Redis=require(_0x8b8a('0xf'));var authService=require(_0x8b8a('0x10'));var qs=require(_0x8b8a('0x11'));var as=require(_0x8b8a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b8a('0x13'))('api');var utils=require(_0x8b8a('0x14'));var config=require(_0x8b8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b8a('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x8f7637,_0x2477fe){_0x2477fe=_0x2477fe||0xcc;return function(_0x2571e7){if(_0x2571e7){return _0x8f7637[_0x8b8a('0x17')](_0x2477fe);}return _0x8f7637[_0x8b8a('0x18')](_0x2477fe)['end']();};}function respondWithResult(_0x52459c,_0x5540f9){_0x5540f9=_0x5540f9||0xc8;return function(_0x94a095){if(_0x94a095){return _0x52459c['status'](_0x5540f9)[_0x8b8a('0x19')](_0x94a095);}};}function respondWithFilteredResult(_0x57caf0,_0x18d7b0){return function(_0x658e38){if(_0x658e38){var _0x3fc243=typeof _0x18d7b0['offset']===_0x8b8a('0x1a')&&typeof _0x18d7b0[_0x8b8a('0x1b')]===_0x8b8a('0x1a');var _0x37f078=_0x658e38['count'];var _0x5db979=_0x3fc243?0x0:_0x18d7b0[_0x8b8a('0x1c')];var _0x4573ca=_0x3fc243?_0x658e38[_0x8b8a('0x1d')]:_0x18d7b0[_0x8b8a('0x1c')]+_0x18d7b0[_0x8b8a('0x1b')];var _0x1dd10b;if(_0x4573ca>=_0x37f078){_0x4573ca=_0x37f078;_0x1dd10b=0xc8;}else{_0x1dd10b=0xce;}_0x57caf0[_0x8b8a('0x18')](_0x1dd10b);return _0x57caf0['set'](_0x8b8a('0x1e'),_0x5db979+'-'+_0x4573ca+'/'+_0x37f078)[_0x8b8a('0x19')](_0x658e38);}return null;};}function patchUpdates(_0x56cdb3){return function(_0x3e9628){try{jsonpatch[_0x8b8a('0x1f')](_0x3e9628,_0x56cdb3,!![]);}catch(_0x4cfc2e){return BPromise['reject'](_0x4cfc2e);}return _0x3e9628[_0x8b8a('0x20')]();};}function saveUpdates(_0xa50d5a,_0x18437b){return function(_0x39aced){if(_0x39aced){return _0x39aced[_0x8b8a('0x21')](_0xa50d5a)[_0x8b8a('0x22')](function(_0x496f02){return _0x496f02;});}return null;};}function removeEntity(_0xd78dfa,_0x5f4e1f){return function(_0x41c80b){if(_0x41c80b){return _0x41c80b[_0x8b8a('0x23')]()[_0x8b8a('0x22')](function(){var _0x4098d6=_0x41c80b[_0x8b8a('0x24')]({'plain':!![]});var _0x4e736c=_0x8b8a('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e736c,'resourceId':_0x4098d6['id']}})[_0x8b8a('0x22')](function(){return _0x41c80b;});})[_0x8b8a('0x22')](function(){_0xd78dfa[_0x8b8a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420521,_0x2de352){return function(_0x5390cd){if(!_0x5390cd){_0x420521[_0x8b8a('0x17')](0x194);}return _0x5390cd;};}function handleError(_0x5deec2,_0x1f6027){_0x1f6027=_0x1f6027||0x1f4;return function(_0x8ef10c){logger[_0x8b8a('0x26')](_0x8ef10c['stack']);if(_0x8ef10c[_0x8b8a('0x27')]){delete _0x8ef10c['name'];}_0x5deec2[_0x8b8a('0x18')](_0x1f6027)['send'](_0x8ef10c);};}exports[_0x8b8a('0x28')]=function(_0x4ae2f8,_0x2425c7){var _0x2bebd0={},_0xe95a06={},_0x164cbd={'count':0x0,'rows':[]};var _0x41ccf0=_['map'](db[_0x8b8a('0x29')][_0x8b8a('0x2a')],function(_0x4b6672){return{'name':_0x4b6672[_0x8b8a('0x2b')],'type':_0x4b6672[_0x8b8a('0x2c')][_0x8b8a('0x2d')]};});_0xe95a06['model']=_[_0x8b8a('0x2e')](_0x41ccf0,'name');_0xe95a06[_0x8b8a('0x2f')]=_[_0x8b8a('0x30')](_0x4ae2f8[_0x8b8a('0x2f')]);_0xe95a06[_0x8b8a('0x31')]=_[_0x8b8a('0x32')](_0xe95a06[_0x8b8a('0x33')],_0xe95a06[_0x8b8a('0x2f')]);_0x2bebd0['attributes']=_['intersection'](_0xe95a06[_0x8b8a('0x33')],qs[_0x8b8a('0x34')](_0x4ae2f8[_0x8b8a('0x2f')]['fields']));_0x2bebd0[_0x8b8a('0x35')]=_0x2bebd0[_0x8b8a('0x35')][_0x8b8a('0x36')]?_0x2bebd0[_0x8b8a('0x35')]:_0xe95a06['model'];if(!_0x4ae2f8[_0x8b8a('0x2f')][_0x8b8a('0x37')]('nolimit')){_0x2bebd0[_0x8b8a('0x1b')]=qs['limit'](_0x4ae2f8['query'][_0x8b8a('0x1b')]);_0x2bebd0['offset']=qs[_0x8b8a('0x1c')](_0x4ae2f8['query']['offset']);}_0x2bebd0['order']=qs[_0x8b8a('0x38')](_0x4ae2f8[_0x8b8a('0x2f')]['sort']);_0x2bebd0[_0x8b8a('0x39')]=qs[_0x8b8a('0x31')](_[_0x8b8a('0x3a')](_0x4ae2f8[_0x8b8a('0x2f')],_0xe95a06['filters']),_0x41ccf0);if(_0x4ae2f8[_0x8b8a('0x2f')][_0x8b8a('0x3b')]){_0x2bebd0[_0x8b8a('0x39')]=_[_0x8b8a('0x3c')](_0x2bebd0[_0x8b8a('0x39')],{'$or':_[_0x8b8a('0x2e')](_0x41ccf0,function(_0x1d26ea){if(_0x1d26ea[_0x8b8a('0x2c')]!==_0x8b8a('0x3d')){var _0x11111b={};_0x11111b[_0x1d26ea[_0x8b8a('0x27')]]={'$like':'%'+_0x4ae2f8['query'][_0x8b8a('0x3b')]+'%'};return _0x11111b;}})});}_0x2bebd0=_[_0x8b8a('0x3c')]({},_0x2bebd0,_0x4ae2f8[_0x8b8a('0x3e')]);var _0x463788={'where':_0x2bebd0[_0x8b8a('0x39')]};return db[_0x8b8a('0x29')][_0x8b8a('0x1d')](_0x463788)[_0x8b8a('0x22')](function(_0x3e809c){_0x164cbd[_0x8b8a('0x1d')]=_0x3e809c;if(_0x4ae2f8[_0x8b8a('0x2f')][_0x8b8a('0x3f')]){_0x2bebd0['include']=[{'all':!![]}];}return db[_0x8b8a('0x29')]['findAll'](_0x2bebd0);})['then'](function(_0x5444c0){_0x164cbd[_0x8b8a('0x40')]=_0x5444c0;return _0x164cbd;})[_0x8b8a('0x22')](respondWithFilteredResult(_0x2425c7,_0x2bebd0))['catch'](handleError(_0x2425c7,null));};exports[_0x8b8a('0x41')]=function(_0x16e860,_0x5c9e80){var _0x381cfc={'raw':!![],'where':{'id':_0x16e860[_0x8b8a('0x42')]['id']}},_0xf6d60d={};_0xf6d60d[_0x8b8a('0x33')]=_[_0x8b8a('0x30')](db[_0x8b8a('0x29')][_0x8b8a('0x2a')]);_0xf6d60d[_0x8b8a('0x2f')]=_['keys'](_0x16e860[_0x8b8a('0x2f')]);_0xf6d60d[_0x8b8a('0x31')]=_[_0x8b8a('0x32')](_0xf6d60d[_0x8b8a('0x33')],_0xf6d60d['query']);_0x381cfc[_0x8b8a('0x35')]=_[_0x8b8a('0x32')](_0xf6d60d['model'],qs[_0x8b8a('0x34')](_0x16e860[_0x8b8a('0x2f')][_0x8b8a('0x34')]));_0x381cfc[_0x8b8a('0x35')]=_0x381cfc[_0x8b8a('0x35')][_0x8b8a('0x36')]?_0x381cfc[_0x8b8a('0x35')]:_0xf6d60d['model'];if(_0x16e860[_0x8b8a('0x2f')][_0x8b8a('0x3f')]){_0x381cfc['include']=[{'all':!![]}];}_0x381cfc=_['merge']({},_0x381cfc,_0x16e860[_0x8b8a('0x3e')]);return db['Interval'][_0x8b8a('0x43')](_0x381cfc)['then'](handleEntityNotFound(_0x5c9e80,null))[_0x8b8a('0x22')](respondWithResult(_0x5c9e80,null))[_0x8b8a('0x44')](handleError(_0x5c9e80,null));};exports['create']=function(_0x1d1570,_0x1aa5bf){return db[_0x8b8a('0x29')][_0x8b8a('0x45')](_0x1d1570[_0x8b8a('0x46')],{})[_0x8b8a('0x22')](function(_0x4263ee){var _0x143929=_0x1d1570[_0x8b8a('0x47')][_0x8b8a('0x24')]({'plain':!![]});if(!_0x143929)throw new Error(_0x8b8a('0x48'));if(_0x143929[_0x8b8a('0x49')]===_0x8b8a('0x47')){var _0x45ad64=_0x4263ee[_0x8b8a('0x24')]({'plain':!![]});var _0x5ee3db=_0x8b8a('0x25');return db[_0x8b8a('0x4a')][_0x8b8a('0x43')]({'where':{'name':_0x5ee3db,'userProfileId':_0x143929['userProfileId']},'raw':!![]})[_0x8b8a('0x22')](function(_0x503ca4){if(_0x503ca4&&_0x503ca4[_0x8b8a('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x45ad64[_0x8b8a('0x27')],'resourceId':_0x45ad64['id'],'type':_0x503ca4[_0x8b8a('0x27')],'sectionId':_0x503ca4['id']},{})[_0x8b8a('0x22')](function(){return _0x4263ee;});}else{return _0x4263ee;}})['catch'](function(_0x3f3fb9){logger[_0x8b8a('0x26')](_0x8b8a('0x4c'),_0x3f3fb9);throw _0x3f3fb9;});}return _0x4263ee;})[_0x8b8a('0x22')](respondWithResult(_0x1aa5bf,0xc9))['catch'](handleError(_0x1aa5bf,null));};exports['update']=function(_0xa01e6d,_0x3d2bf2){if(_0xa01e6d[_0x8b8a('0x46')]['id']){delete _0xa01e6d[_0x8b8a('0x46')]['id'];}return db[_0x8b8a('0x29')][_0x8b8a('0x43')]({'where':{'id':_0xa01e6d[_0x8b8a('0x42')]['id']}})[_0x8b8a('0x22')](handleEntityNotFound(_0x3d2bf2,null))['then'](saveUpdates(_0xa01e6d[_0x8b8a('0x46')],null))[_0x8b8a('0x22')](respondWithResult(_0x3d2bf2,null))[_0x8b8a('0x44')](handleError(_0x3d2bf2,null));};exports[_0x8b8a('0x23')]=function(_0x3e3951,_0x4b7657){return db[_0x8b8a('0x29')]['find']({'where':{'id':_0x3e3951[_0x8b8a('0x42')]['id']}})[_0x8b8a('0x22')](handleEntityNotFound(_0x4b7657,null))['then'](removeEntity(_0x4b7657,null))[_0x8b8a('0x44')](handleError(_0x4b7657,null));};exports[_0x8b8a('0x4d')]=function(_0xc9b146,_0x539ea8,_0x1bc18b){if(_0xc9b146[_0x8b8a('0x46')]['id']){delete _0xc9b146[_0x8b8a('0x46')]['id'];}return db[_0x8b8a('0x29')]['find']({'where':{'id':_0xc9b146[_0x8b8a('0x42')]['id']}})[_0x8b8a('0x22')](handleEntityNotFound(_0x539ea8,null))['then'](function(_0xc30f86){if(_0xc30f86){_0xc9b146['body'][_0x8b8a('0x4e')]=_0xc30f86['id'];return db[_0x8b8a('0x29')][_0x8b8a('0x45')](_0xc9b146[_0x8b8a('0x46')]);}})['then'](respondWithResult(_0x539ea8,null))[_0x8b8a('0x44')](handleError(_0x539ea8,null));};exports['getIntervals']=function(_0x10bce7,_0x49b4a3,_0x11d13e){var _0x493a8d={};var _0x3d25aa={};var _0x37eb53;var _0x2e0817;return db[_0x8b8a('0x29')][_0x8b8a('0x4f')]({'where':{'id':_0x10bce7[_0x8b8a('0x42')]['id']}})[_0x8b8a('0x22')](handleEntityNotFound(_0x49b4a3,null))[_0x8b8a('0x22')](function(_0x6b0997){if(_0x6b0997){_0x37eb53=_0x6b0997;_0x3d25aa['model']=_[_0x8b8a('0x30')](db[_0x8b8a('0x29')][_0x8b8a('0x2a')]);_0x3d25aa[_0x8b8a('0x2f')]=_[_0x8b8a('0x30')](_0x10bce7[_0x8b8a('0x2f')]);_0x3d25aa[_0x8b8a('0x31')]=_[_0x8b8a('0x32')](_0x3d25aa[_0x8b8a('0x33')],_0x3d25aa['query']);_0x493a8d[_0x8b8a('0x35')]=_[_0x8b8a('0x32')](_0x3d25aa['model'],qs[_0x8b8a('0x34')](_0x10bce7['query'][_0x8b8a('0x34')]));_0x493a8d[_0x8b8a('0x35')]=_0x493a8d[_0x8b8a('0x35')]['length']?_0x493a8d[_0x8b8a('0x35')]:_0x3d25aa[_0x8b8a('0x33')];_0x493a8d['order']=qs['sort'](_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x38')]);_0x493a8d['where']=qs['filters'](_['pick'](_0x10bce7[_0x8b8a('0x2f')],_0x3d25aa[_0x8b8a('0x31')]));if(_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x3b')]){_0x493a8d[_0x8b8a('0x39')]=_['merge'](_0x493a8d[_0x8b8a('0x39')],{'$or':_['map'](_0x493a8d[_0x8b8a('0x35')],function(_0x2c4e21){var _0x3712e1={};_0x3712e1[_0x2c4e21]={'$like':'%'+_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x3b')]+'%'};return _0x3712e1;})});}_0x493a8d=_['merge']({},_0x493a8d,_0x10bce7['options']);return _0x37eb53['getIntervals'](_0x493a8d);}})[_0x8b8a('0x22')](function(_0x54fc20){if(_0x54fc20){_0x2e0817=_0x54fc20[_0x8b8a('0x36')];if(!_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x37')](_0x8b8a('0x50'))){_0x493a8d['limit']=qs[_0x8b8a('0x1b')](_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x1b')]);_0x493a8d[_0x8b8a('0x1c')]=qs['offset'](_0x10bce7[_0x8b8a('0x2f')][_0x8b8a('0x1c')]);}return _0x37eb53[_0x8b8a('0x51')](_0x493a8d);}})['then'](function(_0x1d505c){if(_0x1d505c){return _0x1d505c?{'count':_0x2e0817,'rows':_0x1d505c}:null;}})[_0x8b8a('0x22')](respondWithResult(_0x49b4a3,null))[_0x8b8a('0x44')](handleError(_0x49b4a3,null));};exports[_0x8b8a('0x52')]=function(_0x26ad6a,_0x1b83dd,_0x164854){return db['Interval'][_0x8b8a('0x4f')]({'where':{'id':_0x26ad6a[_0x8b8a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b83dd,null))[_0x8b8a('0x22')](function(_0x180dad){if(_0x180dad){return db[_0x8b8a('0x53')][_0x8b8a('0x54')](function(_0x33be6c){return db['Interval'][_0x8b8a('0x23')]({'where':{'IntervalId':_0x26ad6a[_0x8b8a('0x42')]['id']},'transaction':_0x33be6c})[_0x8b8a('0x22')](function(_0xe687b1){var _0x3143c0=_[_0x8b8a('0x2e')](_0x26ad6a[_0x8b8a('0x46')],function(_0x486519){delete _0x486519['id'];_0x486519[_0x8b8a('0x4e')]=_0x26ad6a['params']['id'];return _0x486519;});return db[_0x8b8a('0x29')][_0x8b8a('0x55')](_0x3143c0,{'transaction':_0x33be6c});});})[_0x8b8a('0x22')](function(){return db[_0x8b8a('0x29')]['findAll']({'where':{'IntervalId':_0x26ad6a[_0x8b8a('0x42')]['id']}});});}})[_0x8b8a('0x22')](respondWithResult(_0x1b83dd,null))['catch'](handleError(_0x1b83dd,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4b684f2..3493a6c 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 _0x0725=['all','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','then'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x0725,0xff));var _0x5072=function(_0x4d8e4f,_0x2b2953){_0x4d8e4f=_0x4d8e4f-0x0;var _0x43abd0=_0x0725[_0x4d8e4f];return _0x43abd0;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x5072('0x0'));var iftime=require(_0x5072('0x1'))[_0x5072('0x2')];module[_0x5072('0x3')]=function(_0x9430e5){return _0x9430e5[_0x5072('0x4')](_0x5072('0x5'),attributes,{'tableName':_0x5072('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bf38d){extensions[_0x5072('0x7')](_0x9430e5,_0x3bf38d);},'afterBulkCreate':function(_0xd185f6,_0x86a2fe,_0x153d6b){_0x153d6b();extensions[_0x5072('0x7')](_0x9430e5,_0xd185f6[0x0]);},'afterUpdate':function(_0x2debdb){extensions[_0x5072('0x7')](_0x9430e5,_0x2debdb);},'afterDestroy':function(_0x81fa2c){extensions[_0x5072('0x7')](_0x9430e5,_0x81fa2c);}},'instanceMethods':{'ifTime':function(_0x2d1f57=undefined,_0x1955f5=new Date()){if(typeof this[_0x5072('0x8')]==='string'){return iftime(this[_0x5072('0x8')],_0x2d1f57,_0x1955f5);}else{return this[_0x5072('0x9')]()[_0x5072('0xa')](function(_0x2b528a){return Promise[_0x5072('0xb')](_0x2b528a['map'](function(_0x579112){return _0x579112[_0x5072('0xc')](_0x2d1f57,_0x1955f5);}));})[_0x5072('0xa')](function(_0x192bcd){return _0x192bcd[_0x5072('0xd')](function(_0x539331,_0x55ca17){return _0x539331||_0x55ca17;},![]);});}}}});}; \ No newline at end of file +var _0x6b76=['rewrite','string','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals'];(function(_0x936f1f,_0x2eaf2f){var _0xb36ff7=function(_0x4877ac){while(--_0x4877ac){_0x936f1f['push'](_0x936f1f['shift']());}};_0xb36ff7(++_0x2eaf2f);}(_0x6b76,0xe8));var _0x66b7=function(_0x303b2d,_0xfbade0){_0x303b2d=_0x303b2d-0x0;var _0x13a21f=_0x6b76[_0x303b2d];return _0x13a21f;};'use strict';var attributes=require(_0x66b7('0x0'));var extensions=require(_0x66b7('0x1'));var iftime=require(_0x66b7('0x2'))[_0x66b7('0x3')];module[_0x66b7('0x4')]=function(_0x1b1cf4){return _0x1b1cf4[_0x66b7('0x5')](_0x66b7('0x6'),attributes,{'tableName':_0x66b7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1baae4){extensions[_0x66b7('0x8')](_0x1b1cf4,_0x1baae4);},'afterBulkCreate':function(_0xecb1e1,_0x2e6826,_0x2ea379){_0x2ea379();extensions['rewrite'](_0x1b1cf4,_0xecb1e1[0x0]);},'afterUpdate':function(_0x2a3c31){extensions['rewrite'](_0x1b1cf4,_0x2a3c31);},'afterDestroy':function(_0x2c8ca1){extensions['rewrite'](_0x1b1cf4,_0x2c8ca1);}},'instanceMethods':{'ifTime':function(_0xfe2af=undefined,_0x516ead=new Date()){if(typeof this['interval']===_0x66b7('0x9')){return iftime(this['interval'],_0xfe2af,_0x516ead);}else{return this[_0x66b7('0xa')]()[_0x66b7('0xb')](function(_0x3031ab){return Promise[_0x66b7('0xc')](_0x3031ab[_0x66b7('0xd')](function(_0x2a3ab0){return _0x2a3ab0[_0x66b7('0xe')](_0xfe2af,_0x516ead);}));})['then'](function(_0x3a6ae3){return _0x3a6ae3[_0x66b7('0xf')](function(_0x355814,_0x1cff6c){return _0x355814||_0x1cff6c;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8eb7f9d..8a3d7de 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 _0x6b75=['stringify','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','resolve','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','map','then','info','debug','catch','error','message','ShowInterval','find'];(function(_0x42c9a1,_0x38f036){var _0x51e81a=function(_0x36a3ac){while(--_0x36a3ac){_0x42c9a1['push'](_0x42c9a1['shift']());}};_0x51e81a(++_0x38f036);}(_0x6b75,0x6b));var _0x56b7=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x6b75[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x56b7('0x0'));var util=require(_0x56b7('0x1'));var db=require(_0x56b7('0x2'))['db'];var iftime=require(_0x56b7('0x3'))[_0x56b7('0x4')];var logger=require(_0x56b7('0x5'))(_0x56b7('0x6'));exports[_0x56b7('0x7')]=function(_0x482eac){var _0xd3c6c1=this;return new Promise(function(_0x209ce2,_0x3209ac){return db[_0x56b7('0x8')][_0x56b7('0x9')]({'raw':_0x482eac['options']?_0x482eac[_0x56b7('0xa')][_0x56b7('0xb')]===undefined?!![]:![]:!![],'where':_0x482eac[_0x56b7('0xa')]?_0x482eac['options'][_0x56b7('0xc')]||null:null,'attributes':_0x482eac['options']?_0x482eac[_0x56b7('0xa')][_0x56b7('0xd')]||null:null,'limit':_0x482eac[_0x56b7('0xa')]?_0x482eac['options']['limit']||null:null,'include':_0x482eac[_0x56b7('0xa')]?_0x482eac[_0x56b7('0xa')]['include']?_['map'](_0x482eac['options'][_0x56b7('0xe')],function(_0x2e83e6){return{'model':db[_0x2e83e6[_0x56b7('0xf')]],'as':_0x2e83e6['as'],'attributes':_0x2e83e6[_0x56b7('0xd')],'include':_0x2e83e6['include']?_[_0x56b7('0x10')](_0x2e83e6[_0x56b7('0xe')],function(_0x11d5a8){return{'model':db[_0x11d5a8[_0x56b7('0xf')]],'as':_0x11d5a8['as'],'attributes':_0x11d5a8['attributes'],'include':_0x11d5a8[_0x56b7('0xe')]?_[_0x56b7('0x10')](_0x11d5a8[_0x56b7('0xe')],function(_0x51a564){return{'model':db[_0x51a564['model']],'as':_0x51a564['as'],'attributes':_0x51a564[_0x56b7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x56b7('0x11')](function(_0x46cf7){logger[_0x56b7('0x12')](_0x56b7('0x7'),_0x482eac);logger[_0x56b7('0x13')](_0x56b7('0x7'),_0x482eac,JSON['stringify'](_0x46cf7));_0x209ce2(_0x46cf7);})[_0x56b7('0x14')](function(_0x1343d4){logger[_0x56b7('0x15')](_0x56b7('0x7'),_0x1343d4['message'],_0x482eac);_0x3209ac(_0xd3c6c1['error'](0x1f4,_0x1343d4[_0x56b7('0x16')]));});});};exports[_0x56b7('0x17')]=function(_0x3587c8){var _0x429478=this;return new Promise(function(_0x59151a,_0x487c91){return db['Interval'][_0x56b7('0x18')]({'raw':_0x3587c8[_0x56b7('0xa')]?_0x3587c8[_0x56b7('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x3587c8[_0x56b7('0xa')]?_0x3587c8[_0x56b7('0xa')]['where']||null:null,'attributes':_0x3587c8[_0x56b7('0xa')]?_0x3587c8[_0x56b7('0xa')]['attributes']||null:null,'include':_0x3587c8[_0x56b7('0xa')]?_0x3587c8[_0x56b7('0xa')]['include']?_[_0x56b7('0x10')](_0x3587c8[_0x56b7('0xa')][_0x56b7('0xe')],function(_0x7117f5){return{'model':db[_0x7117f5[_0x56b7('0xf')]],'as':_0x7117f5['as'],'attributes':_0x7117f5[_0x56b7('0xd')],'include':_0x7117f5['include']?_[_0x56b7('0x10')](_0x7117f5['include'],function(_0x4d3f9e){return{'model':db[_0x4d3f9e[_0x56b7('0xf')]],'as':_0x4d3f9e['as'],'attributes':_0x4d3f9e[_0x56b7('0xd')],'include':_0x4d3f9e['include']?_['map'](_0x4d3f9e[_0x56b7('0xe')],function(_0x7c9b3e){return{'model':db[_0x7c9b3e[_0x56b7('0xf')]],'as':_0x7c9b3e['as'],'attributes':_0x7c9b3e[_0x56b7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x56b7('0x11')](function(_0x271871){logger[_0x56b7('0x12')](_0x56b7('0x17'),_0x3587c8);logger[_0x56b7('0x13')](_0x56b7('0x17'),_0x3587c8,JSON[_0x56b7('0x19')](_0x271871));_0x59151a(_0x271871);})['catch'](function(_0x4f68f1){logger[_0x56b7('0x15')]('ShowInterval',_0x4f68f1['message'],_0x3587c8);_0x487c91(_0x429478[_0x56b7('0x15')](0x1f4,_0x4f68f1[_0x56b7('0x16')]));});});};function checkArrayOfIntervals(_0xfd1566,_0x3a3243){var _0x5a290d=[];return db['Interval'][_0x56b7('0x9')]({'where':{'id':_0xfd1566}})[_0x56b7('0x11')](function(_0x1e260e){_0x5a290d=_0x1e260e;return Promise[_0x56b7('0x1a')](_0x5a290d[_0x56b7('0x10')](function(_0x47a78d){return _0x47a78d[_0x56b7('0x1b')](_0x3a3243);}));})['then'](function(_0x3bad77){var _0x159846=_0x3bad77['reduce'](function(_0x53b9e7,_0x176c2c){return _0x53b9e7||_0x176c2c;},![]);logger[_0x56b7('0x12')](util[_0x56b7('0x1c')](_0x56b7('0x1d'),_0x5a290d[_0x56b7('0x10')](function(_0x5ba8f0){return _0x5ba8f0['name'];})[_0x56b7('0x1e')](',\x20'),_0x5a290d[_0x56b7('0x10')](function(_0x446123){return _0x446123['id'];})[_0x56b7('0x1e')](',\x20')));return _0x159846;});}function checkSingleInterval(_0x28aca3,_0x166675){return db[_0x56b7('0x8')][_0x56b7('0x1f')](_0x28aca3)[_0x56b7('0x11')](function(_0xb357f7){if(_0xb357f7){logger['info'](util[_0x56b7('0x1c')](_0x56b7('0x20'),_0xb357f7['name'],_0xb357f7['id']));return _0xb357f7[_0x56b7('0x1b')](_0x166675);}});}exports['IntervalIftime']=function(_0x2b05d9){var _0x5d8e17=_0x2b05d9['intervalIds'];var _0x46d507=Array[_0x56b7('0x21')](_0x2b05d9[_0x56b7('0x22')])?_0x2b05d9['intervals']:typeof _0x2b05d9[_0x56b7('0x22')]===_0x56b7('0x23')?[_0x2b05d9[_0x56b7('0x22')]]:[];var _0x2f7bb0=_0x2b05d9[_0x56b7('0x24')]||undefined;var _0x2037ef=![];if(_0x46d507[_0x56b7('0x25')]){logger[_0x56b7('0x12')](util['format'](_0x56b7('0x26'),_0x46d507['join'](';\x20')));}if(_0x2f7bb0){logger['info'](util['format'](_0x56b7('0x27'),_0x2f7bb0));}logger[_0x56b7('0x13')](_0x56b7('0x28'),_0x2037ef);logger['silly'](_0x56b7('0x29'),_0x2b05d9);return Promise[_0x56b7('0x2a')]()[_0x56b7('0x11')](function(){if(Array[_0x56b7('0x21')](_0x5d8e17)){return checkArrayOfIntervals(_0x5d8e17,_0x2f7bb0);}else if(_0x5d8e17){return checkSingleInterval(_0x5d8e17,_0x2f7bb0);}})[_0x56b7('0x11')](function(_0x2485b5){var _0x143afa=_0x46d507[_0x56b7('0x2b')](function(_0x3b2ac3,_0x33f18c){return _0x3b2ac3||iftime(_0x33f18c,_0x2f7bb0);},![]);_0x2037ef=_0x2485b5||_0x143afa;return _0x2037ef;})[_0x56b7('0x14')](function(_0x153c62){logger[_0x56b7('0x15')](_0x56b7('0x29'),_0x2b05d9,_0x153c62);throw this[_0x56b7('0x15')](0x1f4,_0x153c62[_0x56b7('0x16')]);});}; \ No newline at end of file +var _0x6dd0=['stringify','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','catch','error','message','ShowInterval','find','then'];(function(_0x2c035c,_0xf71ce8){var _0x50dfa2=function(_0x2f4623){while(--_0x2f4623){_0x2c035c['push'](_0x2c035c['shift']());}};_0x50dfa2(++_0xf71ce8);}(_0x6dd0,0xe9));var _0x06dd=function(_0x543b52,_0x1dfd0e){_0x543b52=_0x543b52-0x0;var _0x113df8=_0x6dd0[_0x543b52];return _0x113df8;};'use strict';var _=require(_0x06dd('0x0'));var util=require(_0x06dd('0x1'));var db=require(_0x06dd('0x2'))['db'];var iftime=require(_0x06dd('0x3'))[_0x06dd('0x4')];var logger=require('../../config/logger')(_0x06dd('0x5'));exports[_0x06dd('0x6')]=function(_0x25329e){var _0x561f0b=this;return new Promise(function(_0xcaaaef,_0x51c382){return db[_0x06dd('0x7')][_0x06dd('0x8')]({'raw':_0x25329e[_0x06dd('0x9')]?_0x25329e[_0x06dd('0x9')][_0x06dd('0xa')]===undefined?!![]:![]:!![],'where':_0x25329e[_0x06dd('0x9')]?_0x25329e['options'][_0x06dd('0xb')]||null:null,'attributes':_0x25329e[_0x06dd('0x9')]?_0x25329e[_0x06dd('0x9')][_0x06dd('0xc')]||null:null,'limit':_0x25329e[_0x06dd('0x9')]?_0x25329e['options'][_0x06dd('0xd')]||null:null,'include':_0x25329e['options']?_0x25329e['options']['include']?_['map'](_0x25329e[_0x06dd('0x9')]['include'],function(_0x1991d8){return{'model':db[_0x1991d8['model']],'as':_0x1991d8['as'],'attributes':_0x1991d8[_0x06dd('0xc')],'include':_0x1991d8[_0x06dd('0xe')]?_[_0x06dd('0xf')](_0x1991d8[_0x06dd('0xe')],function(_0x58e3bb){return{'model':db[_0x58e3bb[_0x06dd('0x10')]],'as':_0x58e3bb['as'],'attributes':_0x58e3bb[_0x06dd('0xc')],'include':_0x58e3bb[_0x06dd('0xe')]?_[_0x06dd('0xf')](_0x58e3bb[_0x06dd('0xe')],function(_0x2f7a3f){return{'model':db[_0x2f7a3f[_0x06dd('0x10')]],'as':_0x2f7a3f['as'],'attributes':_0x2f7a3f[_0x06dd('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7065ab){logger[_0x06dd('0x11')](_0x06dd('0x6'),_0x25329e);logger[_0x06dd('0x12')]('GetInterval',_0x25329e,JSON['stringify'](_0x7065ab));_0xcaaaef(_0x7065ab);})[_0x06dd('0x13')](function(_0x186fec){logger[_0x06dd('0x14')]('GetInterval',_0x186fec[_0x06dd('0x15')],_0x25329e);_0x51c382(_0x561f0b[_0x06dd('0x14')](0x1f4,_0x186fec[_0x06dd('0x15')]));});});};exports[_0x06dd('0x16')]=function(_0x50de86){var _0x422347=this;return new Promise(function(_0x463988,_0x10bcfb){return db['Interval'][_0x06dd('0x17')]({'raw':_0x50de86['options']?_0x50de86['options'][_0x06dd('0xa')]===undefined?!![]:![]:!![],'where':_0x50de86['options']?_0x50de86[_0x06dd('0x9')][_0x06dd('0xb')]||null:null,'attributes':_0x50de86[_0x06dd('0x9')]?_0x50de86[_0x06dd('0x9')][_0x06dd('0xc')]||null:null,'include':_0x50de86[_0x06dd('0x9')]?_0x50de86[_0x06dd('0x9')][_0x06dd('0xe')]?_['map'](_0x50de86[_0x06dd('0x9')]['include'],function(_0x4c6459){return{'model':db[_0x4c6459[_0x06dd('0x10')]],'as':_0x4c6459['as'],'attributes':_0x4c6459[_0x06dd('0xc')],'include':_0x4c6459[_0x06dd('0xe')]?_[_0x06dd('0xf')](_0x4c6459[_0x06dd('0xe')],function(_0x285749){return{'model':db[_0x285749[_0x06dd('0x10')]],'as':_0x285749['as'],'attributes':_0x285749[_0x06dd('0xc')],'include':_0x285749[_0x06dd('0xe')]?_[_0x06dd('0xf')](_0x285749[_0x06dd('0xe')],function(_0x5d2ab5){return{'model':db[_0x5d2ab5[_0x06dd('0x10')]],'as':_0x5d2ab5['as'],'attributes':_0x5d2ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0x06dd('0x18')](function(_0x307291){logger[_0x06dd('0x11')](_0x06dd('0x16'),_0x50de86);logger[_0x06dd('0x12')](_0x06dd('0x16'),_0x50de86,JSON[_0x06dd('0x19')](_0x307291));_0x463988(_0x307291);})[_0x06dd('0x13')](function(_0x46387e){logger[_0x06dd('0x14')](_0x06dd('0x16'),_0x46387e[_0x06dd('0x15')],_0x50de86);_0x10bcfb(_0x422347[_0x06dd('0x14')](0x1f4,_0x46387e[_0x06dd('0x15')]));});});};function checkArrayOfIntervals(_0x3420ec,_0x284729){var _0x2e5e33=[];return db['Interval'][_0x06dd('0x8')]({'where':{'id':_0x3420ec}})[_0x06dd('0x18')](function(_0x411b6b){_0x2e5e33=_0x411b6b;return Promise['all'](_0x2e5e33[_0x06dd('0xf')](function(_0xbe8e9c){return _0xbe8e9c[_0x06dd('0x1a')](_0x284729);}));})[_0x06dd('0x18')](function(_0x14fa43){var _0x30e034=_0x14fa43[_0x06dd('0x1b')](function(_0x4f1e4c,_0x55eb25){return _0x4f1e4c||_0x55eb25;},![]);logger[_0x06dd('0x11')](util['format'](_0x06dd('0x1c'),_0x2e5e33[_0x06dd('0xf')](function(_0x469225){return _0x469225[_0x06dd('0x1d')];})['join'](',\x20'),_0x2e5e33[_0x06dd('0xf')](function(_0x39bb27){return _0x39bb27['id'];})[_0x06dd('0x1e')](',\x20')));return _0x30e034;});}function checkSingleInterval(_0x332240,_0x2ccac7){return db['Interval'][_0x06dd('0x1f')](_0x332240)[_0x06dd('0x18')](function(_0x50bddc){if(_0x50bddc){logger[_0x06dd('0x11')](util[_0x06dd('0x20')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x50bddc[_0x06dd('0x1d')],_0x50bddc['id']));return _0x50bddc['ifTime'](_0x2ccac7);}});}exports['IntervalIftime']=function(_0x3b044b){var _0x558124=_0x3b044b['intervalIds'];var _0x2a90a8=Array[_0x06dd('0x21')](_0x3b044b[_0x06dd('0x22')])?_0x3b044b[_0x06dd('0x22')]:typeof _0x3b044b['intervals']===_0x06dd('0x23')?[_0x3b044b['intervals']]:[];var _0x36f229=_0x3b044b[_0x06dd('0x24')]||undefined;var _0x5befab=![];if(_0x2a90a8['length']){logger[_0x06dd('0x11')](util[_0x06dd('0x20')](_0x06dd('0x25'),_0x2a90a8[_0x06dd('0x1e')](';\x20')));}if(_0x36f229){logger[_0x06dd('0x11')](util[_0x06dd('0x20')](_0x06dd('0x26'),_0x36f229));}logger['debug'](_0x06dd('0x27'),_0x5befab);logger[_0x06dd('0x28')](_0x06dd('0x29'),_0x3b044b);return Promise[_0x06dd('0x2a')]()[_0x06dd('0x18')](function(){if(Array[_0x06dd('0x21')](_0x558124)){return checkArrayOfIntervals(_0x558124,_0x36f229);}else if(_0x558124){return checkSingleInterval(_0x558124,_0x36f229);}})['then'](function(_0x204b1b){var _0x4b5796=_0x2a90a8[_0x06dd('0x1b')](function(_0x1914b9,_0x26af5b){return _0x1914b9||iftime(_0x26af5b,_0x36f229);},![]);_0x5befab=_0x204b1b||_0x4b5796;return _0x5befab;})[_0x06dd('0x13')](function(_0x196f22){logger['error'](_0x06dd('0x29'),_0x3b044b,_0x196f22);throw this[_0x06dd('0x14')](0x1f4,_0x196f22[_0x06dd('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9989e71..3a1be86 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x593f2e,_0x1b6d9f){var _0x1004ca=function(_0x104739){while(--_0x104739){_0x593f2e['push'](_0x593f2e['shift']());}};_0x1004ca(++_0x1b6d9f);}(_0x2032,0xd9));var _0x2203=function(_0x272897,_0x180dc7){_0x272897=_0x272897-0x0;var _0x3e2950=_0x2032[_0x272897];return _0x3e2950;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x16fa02,_0x3eaff5){var _0x58fa70=function(_0x18bfc5){while(--_0x18bfc5){_0x16fa02['push'](_0x16fa02['shift']());}};_0x58fa70(++_0x3eaff5);}(_0x5f2f,0x73));var _0xf5f2=function(_0xcd2b47,_0x298e3b){_0xcd2b47=_0xcd2b47-0x0;var _0x3a62dd=_0x5f2f[_0xcd2b47];return _0x3a62dd;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a9762da..3b7f80b 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 _0xc60f=['customfield_11502','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','status','statusCode','error','json','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken'];(function(_0xdc2c8b,_0x2fe46c){var _0x51c24f=function(_0x37793d){while(--_0x37793d){_0xdc2c8b['push'](_0xdc2c8b['shift']());}};_0x51c24f(++_0x2fe46c);}(_0xc60f,0x1c9));var _0xfc60=function(_0x376f36,_0x37b4f7){_0x376f36=_0x376f36-0x0;var _0x57427e=_0xc60f[_0x376f36];return _0x57427e;};'use strict';var BPromise=require('bluebird');var https=require(_0xfc60('0x0'));var logger=require('../../config/logger')(_0xfc60('0x1'));var USERNAME=_0xfc60('0x2');var PASSWORD=_0xfc60('0x3');function openIssue(_0x46e7e6,_0x15a4aa){var _0x4c7b38={'fields':{'project':{'key':_0x46e7e6[_0xfc60('0x4')]||_0xfc60('0x5')},'summary':(_0x46e7e6[_0xfc60('0x6')]||'Report')+_0xfc60('0x7')+_0x46e7e6['ip'],'description':_0x46e7e6[_0xfc60('0x8')]||JSON[_0xfc60('0x9')](_0x46e7e6),'issuetype':{'name':_0x46e7e6['issuetype']||_0xfc60('0xa')}}};_0x4c7b38[_0xfc60('0xb')][_0xfc60('0xc')]=_0x46e7e6[_0xfc60('0xd')];_0x4c7b38[_0xfc60('0xb')][_0xfc60('0xe')]=_0x46e7e6[_0xfc60('0xf')];_0x4c7b38[_0xfc60('0xb')][_0xfc60('0x10')]=_0x46e7e6['newToken'];_0x4c7b38[_0xfc60('0xb')]['customfield_11503']=_0x46e7e6[_0xfc60('0x11')];_0x4c7b38[_0xfc60('0xb')][_0xfc60('0x12')]=_0x46e7e6['reason'];_0x4c7b38[_0xfc60('0xb')]['customfield_10102']=_0x46e7e6['ip'];var _0x488777={'host':_0xfc60('0x13'),'port':0x1bb,'path':_0xfc60('0x14'),'method':_0xfc60('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xfc60('0x16'),'Authorization':_0xfc60('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xfc60('0x18')](_0xfc60('0x19'))}};var _0x3021e4=JSON[_0xfc60('0x9')](_0x4c7b38);var _0x2baeb6=https[_0xfc60('0x1a')](_0x488777,function(_0x17b2d4){_0x17b2d4[_0xfc60('0x1b')](_0xfc60('0x1c'));var _0x5a5933='';_0x17b2d4['on']('data',function(_0x324e01){_0x5a5933+=_0x324e01;});_0x17b2d4['on']('end',function(){if(_0x15a4aa){return _0x15a4aa[_0xfc60('0x1d')](_0x17b2d4[_0xfc60('0x1e')])['json'](JSON['parse'](_0x5a5933));}});});_0x2baeb6['on'](_0xfc60('0x1f'),function(_0x5e0b97){if(_0x15a4aa){return _0x15a4aa[_0xfc60('0x1d')](0x1f4)[_0xfc60('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xfc60('0x21')}]});}});_0x2baeb6[_0xfc60('0x22')](_0x3021e4);_0x2baeb6[_0xfc60('0x23')]();}exports[_0xfc60('0x24')]=openIssue;exports[_0xfc60('0x25')]=function(_0x224777,_0x49aa8b){_0x224777[_0xfc60('0x26')]['ip']=_0x224777['headers'][_0xfc60('0x27')]||_0x224777[_0xfc60('0x28')][_0xfc60('0x29')]||_0x224777[_0xfc60('0x2a')][_0xfc60('0x29')]||_0x224777[_0xfc60('0x28')][_0xfc60('0x2a')][_0xfc60('0x29')];return openIssue(_0x224777[_0xfc60('0x26')],_0x49aa8b);}; \ No newline at end of file +var _0x6837=['api','3eAmWpBVP0','summary','Report','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','json','error','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger'];(function(_0x54412c,_0x127e5b){var _0x538562=function(_0xff72f7){while(--_0xff72f7){_0x54412c['push'](_0x54412c['shift']());}};_0x538562(++_0x127e5b);}(_0x6837,0x11d));var _0x7683=function(_0x42331a,_0x1284ad){_0x42331a=_0x42331a-0x0;var _0x14937d=_0x6837[_0x42331a];return _0x14937d;};'use strict';var BPromise=require(_0x7683('0x0'));var https=require('https');var logger=require(_0x7683('0x1'))(_0x7683('0x2'));var USERNAME='support';var PASSWORD=_0x7683('0x3');function openIssue(_0x41b618,_0x1dcbeb){var _0x5f5c40={'fields':{'project':{'key':_0x41b618['key']||'MOTGUI'},'summary':(_0x41b618[_0x7683('0x4')]||_0x7683('0x5'))+'\x20from\x20'+_0x41b618['ip'],'description':_0x41b618['description']||JSON['stringify'](_0x41b618),'issuetype':{'name':_0x41b618[_0x7683('0x6')]||_0x7683('0x7')}}};_0x5f5c40[_0x7683('0x8')][_0x7683('0x9')]=_0x41b618['email'];_0x5f5c40[_0x7683('0x8')][_0x7683('0xa')]=_0x41b618[_0x7683('0xb')];_0x5f5c40[_0x7683('0x8')][_0x7683('0xc')]=_0x41b618[_0x7683('0xd')];_0x5f5c40[_0x7683('0x8')][_0x7683('0xe')]=_0x41b618['name'];_0x5f5c40['fields'][_0x7683('0xf')]=_0x41b618[_0x7683('0x10')];_0x5f5c40[_0x7683('0x8')][_0x7683('0x11')]=_0x41b618['ip'];var _0x28fd9f={'host':_0x7683('0x12'),'port':0x1bb,'path':_0x7683('0x13'),'method':_0x7683('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x7683('0x15'),'Authorization':_0x7683('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x7683('0x17')](_0x7683('0x18'))}};var _0x2cdeb2=JSON['stringify'](_0x5f5c40);var _0x5e81c0=https['request'](_0x28fd9f,function(_0xbe2468){_0xbe2468[_0x7683('0x19')](_0x7683('0x1a'));var _0x6cc295='';_0xbe2468['on'](_0x7683('0x1b'),function(_0x1f1da1){_0x6cc295+=_0x1f1da1;});_0xbe2468['on'](_0x7683('0x1c'),function(){if(_0x1dcbeb){return _0x1dcbeb[_0x7683('0x1d')](_0xbe2468['statusCode'])[_0x7683('0x1e')](JSON['parse'](_0x6cc295));}});});_0x5e81c0['on'](_0x7683('0x1f'),function(_0x3315b4){if(_0x1dcbeb){return _0x1dcbeb[_0x7683('0x1d')](0x1f4)[_0x7683('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7683('0x20')}]});}});_0x5e81c0[_0x7683('0x21')](_0x2cdeb2);_0x5e81c0[_0x7683('0x1c')]();}exports[_0x7683('0x22')]=openIssue;exports[_0x7683('0x23')]=function(_0x52dcc0,_0x545f99){_0x52dcc0[_0x7683('0x24')]['ip']=_0x52dcc0['headers'][_0x7683('0x25')]||_0x52dcc0[_0x7683('0x26')][_0x7683('0x27')]||_0x52dcc0[_0x7683('0x28')][_0x7683('0x27')]||_0x52dcc0['connection'][_0x7683('0x28')][_0x7683('0x27')];return openIssue(_0x52dcc0[_0x7683('0x24')],_0x545f99);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index bd4f1d0..5352092 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 _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x50a8ab,_0x2525fa){var _0x13f124=function(_0x15c86a){while(--_0x15c86a){_0x50a8ab['push'](_0x50a8ab['shift']());}};_0x13f124(++_0x2525fa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xf3cd[_0x5a4b16];return _0x5236dc;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x2ef445,_0x90a077){var _0x98e4de=function(_0x4f348d){while(--_0x4f348d){_0x2ef445['push'](_0x2ef445['shift']());}};_0x98e4de(++_0x90a077);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xcb91[_0x231b2e];return _0x3feb2a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1ccae89..1d99cdc 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x32540a,_0x133b1c){_0x32540a=_0x32540a-0x0;var _0x324c4e=_0x7a54[_0x32540a];return _0x324c4e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7a54,0x106));var _0x47a5=function(_0x273567,_0x28c4fe){_0x273567=_0x273567-0x0;var _0x56c27e=_0x7a54[_0x273567];return _0x56c27e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 27862df..9d342b4 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 _0xb46f=['JscriptyAnswerReport','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map'];(function(_0x250bf4,_0x5cf7f0){var _0x38936a=function(_0x39e9e9){while(--_0x39e9e9){_0x250bf4['push'](_0x250bf4['shift']());}};_0x38936a(++_0x5cf7f0);}(_0xb46f,0xb6));var _0xfb46=function(_0x502de5,_0x2ea21c){_0x502de5=_0x502de5-0x0;var _0x586926=_0xb46f[_0x502de5];return _0x586926;};'use strict';var emlformat=require(_0xfb46('0x0'));var rimraf=require(_0xfb46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb46('0x2'));var rp=require(_0xfb46('0x3'));var moment=require(_0xfb46('0x4'));var BPromise=require(_0xfb46('0x5'));var Mustache=require(_0xfb46('0x6'));var util=require('util');var path=require(_0xfb46('0x7'));var sox=require('sox');var csv=require(_0xfb46('0x8'));var ejs=require(_0xfb46('0x9'));var fs=require('fs');var fs_extra=require(_0xfb46('0xa'));var _=require(_0xfb46('0xb'));var squel=require(_0xfb46('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb46('0xd'));var deskjs=require(_0xfb46('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfb46('0x10'));var hardwareService=require(_0xfb46('0x11'));var logger=require(_0xfb46('0x12'))(_0xfb46('0x13'));var utils=require(_0xfb46('0x14'));var config=require(_0xfb46('0x15'));var licenseUtil=require(_0xfb46('0x16'));var db=require(_0xfb46('0x17'))['db'];function respondWithStatusCode(_0xa0034b,_0x1527e1){_0x1527e1=_0x1527e1||0xcc;return function(_0x57c68b){if(_0x57c68b){return _0xa0034b['sendStatus'](_0x1527e1);}return _0xa0034b[_0xfb46('0x18')](_0x1527e1)['end']();};}function respondWithResult(_0x41ebd9,_0x47bdf3){_0x47bdf3=_0x47bdf3||0xc8;return function(_0x572e04){if(_0x572e04){return _0x41ebd9[_0xfb46('0x18')](_0x47bdf3)[_0xfb46('0x19')](_0x572e04);}};}function respondWithFilteredResult(_0xf3fdbd,_0x348b3e){return function(_0x4ec418){if(_0x4ec418){var _0x230774=typeof _0x348b3e[_0xfb46('0x1a')]===_0xfb46('0x1b')&&typeof _0x348b3e['limit']===_0xfb46('0x1b');var _0x10fc0c=_0x4ec418['count'];var _0x523d15=_0x230774?0x0:_0x348b3e[_0xfb46('0x1a')];var _0x473136=_0x230774?_0x4ec418[_0xfb46('0x1c')]:_0x348b3e[_0xfb46('0x1a')]+_0x348b3e[_0xfb46('0x1d')];var _0x23c6ee;if(_0x473136>=_0x10fc0c){_0x473136=_0x10fc0c;_0x23c6ee=0xc8;}else{_0x23c6ee=0xce;}_0xf3fdbd[_0xfb46('0x18')](_0x23c6ee);return _0xf3fdbd[_0xfb46('0x1e')](_0xfb46('0x1f'),_0x523d15+'-'+_0x473136+'/'+_0x10fc0c)[_0xfb46('0x19')](_0x4ec418);}return null;};}function patchUpdates(_0x1c820a){return function(_0x2ee6db){try{jsonpatch['apply'](_0x2ee6db,_0x1c820a,!![]);}catch(_0x1b838a){return BPromise[_0xfb46('0x20')](_0x1b838a);}return _0x2ee6db[_0xfb46('0x21')]();};}function saveUpdates(_0x5b19b3,_0x1b05d0){return function(_0x2f8f6f){if(_0x2f8f6f){return _0x2f8f6f[_0xfb46('0x22')](_0x5b19b3)[_0xfb46('0x23')](function(_0x1010e0){return _0x1010e0;});}return null;};}function removeEntity(_0x52f392,_0x36c00a){return function(_0x5a8dde){if(_0x5a8dde){return _0x5a8dde[_0xfb46('0x24')]()[_0xfb46('0x23')](function(){_0x52f392[_0xfb46('0x18')](0xcc)[_0xfb46('0x25')]();});}};}function handleEntityNotFound(_0xf9bbd1,_0x3359fb){return function(_0x254f6c){if(!_0x254f6c){_0xf9bbd1['sendStatus'](0x194);}return _0x254f6c;};}function handleError(_0x1f4dcb,_0x2e354c){_0x2e354c=_0x2e354c||0x1f4;return function(_0x309c7f){logger[_0xfb46('0x26')](_0x309c7f[_0xfb46('0x27')]);if(_0x309c7f[_0xfb46('0x28')]){delete _0x309c7f[_0xfb46('0x28')];}_0x1f4dcb[_0xfb46('0x18')](_0x2e354c)[_0xfb46('0x29')](_0x309c7f);};}exports['index']=function(_0x21da44,_0x3852a0){var _0x1d691e={},_0x1f1f3a={},_0x5f4afa={'count':0x0,'rows':[]};var _0x7b983=_[_0xfb46('0x2a')](db[_0xfb46('0x2b')][_0xfb46('0x2c')],function(_0x846e43){return{'name':_0x846e43['fieldName'],'type':_0x846e43[_0xfb46('0x2d')][_0xfb46('0x2e')]};});_0x1f1f3a['model']=_[_0xfb46('0x2a')](_0x7b983,'name');_0x1f1f3a[_0xfb46('0x2f')]=_['keys'](_0x21da44[_0xfb46('0x2f')]);_0x1f1f3a['filters']=_[_0xfb46('0x30')](_0x1f1f3a[_0xfb46('0x31')],_0x1f1f3a['query']);_0x1d691e[_0xfb46('0x32')]=_[_0xfb46('0x30')](_0x1f1f3a['model'],qs[_0xfb46('0x33')](_0x21da44[_0xfb46('0x2f')]['fields']));_0x1d691e['attributes']=_0x1d691e[_0xfb46('0x32')][_0xfb46('0x34')]?_0x1d691e[_0xfb46('0x32')]:_0x1f1f3a[_0xfb46('0x31')];if(!_0x21da44[_0xfb46('0x2f')][_0xfb46('0x35')](_0xfb46('0x36'))){_0x1d691e[_0xfb46('0x1d')]=qs[_0xfb46('0x1d')](_0x21da44['query'][_0xfb46('0x1d')]);_0x1d691e['offset']=qs['offset'](_0x21da44[_0xfb46('0x2f')][_0xfb46('0x1a')]);}_0x1d691e[_0xfb46('0x37')]=qs[_0xfb46('0x38')](_0x21da44[_0xfb46('0x2f')][_0xfb46('0x38')]);_0x1d691e[_0xfb46('0x39')]=qs[_0xfb46('0x3a')](_['pick'](_0x21da44[_0xfb46('0x2f')],_0x1f1f3a[_0xfb46('0x3a')]),_0x7b983);if(_0x21da44[_0xfb46('0x2f')][_0xfb46('0x3b')]){_0x1d691e['where']=_[_0xfb46('0x3c')](_0x1d691e[_0xfb46('0x39')],{'$or':_[_0xfb46('0x2a')](_0x7b983,function(_0x10d9a4){if(_0x10d9a4[_0xfb46('0x2d')]!==_0xfb46('0x3d')){var _0x34ed65={};_0x34ed65[_0x10d9a4[_0xfb46('0x28')]]={'$like':'%'+_0x21da44['query'][_0xfb46('0x3b')]+'%'};return _0x34ed65;}})});}_0x1d691e=_[_0xfb46('0x3c')]({},_0x1d691e,_0x21da44[_0xfb46('0x3e')]);var _0x4a2366={'where':_0x1d691e[_0xfb46('0x39')]};return db[_0xfb46('0x2b')][_0xfb46('0x1c')](_0x4a2366)['then'](function(_0x2e28a0){_0x5f4afa['count']=_0x2e28a0;if(_0x21da44['query'][_0xfb46('0x3f')]){_0x1d691e[_0xfb46('0x40')]=[{'all':!![]}];}return db[_0xfb46('0x2b')][_0xfb46('0x41')](_0x1d691e);})[_0xfb46('0x23')](function(_0x2979c4){_0x5f4afa[_0xfb46('0x42')]=_0x2979c4;return _0x5f4afa;})[_0xfb46('0x23')](respondWithFilteredResult(_0x3852a0,_0x1d691e))[_0xfb46('0x43')](handleError(_0x3852a0,null));};exports[_0xfb46('0x44')]=function(_0x54014a,_0x1f2b7e){var _0x4482dc={'raw':!![],'where':{'id':_0x54014a[_0xfb46('0x45')]['id']}},_0x2d73c2={};_0x2d73c2[_0xfb46('0x31')]=_[_0xfb46('0x46')](db['JscriptyAnswerReport']['rawAttributes']);_0x2d73c2[_0xfb46('0x2f')]=_[_0xfb46('0x46')](_0x54014a[_0xfb46('0x2f')]);_0x2d73c2[_0xfb46('0x3a')]=_[_0xfb46('0x30')](_0x2d73c2['model'],_0x2d73c2['query']);_0x4482dc['attributes']=_[_0xfb46('0x30')](_0x2d73c2['model'],qs['fields'](_0x54014a[_0xfb46('0x2f')][_0xfb46('0x33')]));_0x4482dc[_0xfb46('0x32')]=_0x4482dc['attributes'][_0xfb46('0x34')]?_0x4482dc['attributes']:_0x2d73c2[_0xfb46('0x31')];if(_0x54014a[_0xfb46('0x2f')][_0xfb46('0x3f')]){_0x4482dc[_0xfb46('0x40')]=[{'all':!![]}];}_0x4482dc=_[_0xfb46('0x3c')]({},_0x4482dc,_0x54014a[_0xfb46('0x3e')]);return db[_0xfb46('0x2b')][_0xfb46('0x47')](_0x4482dc)[_0xfb46('0x23')](handleEntityNotFound(_0x1f2b7e,null))[_0xfb46('0x23')](respondWithResult(_0x1f2b7e,null))[_0xfb46('0x43')](handleError(_0x1f2b7e,null));};exports[_0xfb46('0x48')]=function(_0x32aaed,_0x29e38c){return db[_0xfb46('0x2b')]['create'](_0x32aaed[_0xfb46('0x49')],{})[_0xfb46('0x23')](respondWithResult(_0x29e38c,0xc9))[_0xfb46('0x43')](handleError(_0x29e38c,null));};exports[_0xfb46('0x22')]=function(_0x68bed4,_0x5ca78f){if(_0x68bed4[_0xfb46('0x49')]['id']){delete _0x68bed4[_0xfb46('0x49')]['id'];}return db[_0xfb46('0x2b')][_0xfb46('0x47')]({'where':{'id':_0x68bed4[_0xfb46('0x45')]['id']}})[_0xfb46('0x23')](handleEntityNotFound(_0x5ca78f,null))[_0xfb46('0x23')](saveUpdates(_0x68bed4[_0xfb46('0x49')],null))[_0xfb46('0x23')](respondWithResult(_0x5ca78f,null))[_0xfb46('0x43')](handleError(_0x5ca78f,null));};exports['destroy']=function(_0x50802c,_0x3b4c5c){return db[_0xfb46('0x2b')][_0xfb46('0x47')]({'where':{'id':_0x50802c[_0xfb46('0x45')]['id']}})[_0xfb46('0x23')](handleEntityNotFound(_0x3b4c5c,null))['then'](removeEntity(_0x3b4c5c,null))[_0xfb46('0x43')](handleError(_0x3b4c5c,null));};exports[_0xfb46('0x4a')]=function(_0x530484,_0x467c15){return db['JscriptyAnswerReport'][_0xfb46('0x4a')]()['then'](respondWithResult(_0x467c15,null))['catch'](handleError(_0x467c15,null));}; \ No newline at end of file +var _0x7b27=['rows','catch','show','keys','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2f7290,_0x20a5d2){var _0xeb684f=function(_0x1d4ae4){while(--_0x1d4ae4){_0x2f7290['push'](_0x2f7290['shift']());}};_0xeb684f(++_0x20a5d2);}(_0x7b27,0x186));var _0x77b2=function(_0x458691,_0x2ba030){_0x458691=_0x458691-0x0;var _0x5ce624=_0x7b27[_0x458691];return _0x5ce624;};'use strict';var emlformat=require(_0x77b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77b2('0x1'));var jsonpatch=require(_0x77b2('0x2'));var rp=require(_0x77b2('0x3'));var moment=require(_0x77b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77b2('0x5'));var util=require(_0x77b2('0x6'));var path=require('path');var sox=require(_0x77b2('0x7'));var csv=require(_0x77b2('0x8'));var ejs=require(_0x77b2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77b2('0xa'));var squel=require(_0x77b2('0xb'));var crypto=require(_0x77b2('0xc'));var jsforce=require(_0x77b2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x77b2('0x8'));var querystring=require(_0x77b2('0xe'));var Papa=require(_0x77b2('0xf'));var Redis=require(_0x77b2('0x10'));var authService=require(_0x77b2('0x11'));var qs=require(_0x77b2('0x12'));var as=require(_0x77b2('0x13'));var hardwareService=require(_0x77b2('0x14'));var logger=require('../../config/logger')(_0x77b2('0x15'));var utils=require(_0x77b2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x77b2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82878c,_0x29385b){_0x29385b=_0x29385b||0xcc;return function(_0x4bd51c){if(_0x4bd51c){return _0x82878c[_0x77b2('0x18')](_0x29385b);}return _0x82878c['status'](_0x29385b)[_0x77b2('0x19')]();};}function respondWithResult(_0x14cd9f,_0x129ef1){_0x129ef1=_0x129ef1||0xc8;return function(_0x21ac8e){if(_0x21ac8e){return _0x14cd9f[_0x77b2('0x1a')](_0x129ef1)[_0x77b2('0x1b')](_0x21ac8e);}};}function respondWithFilteredResult(_0x2539d3,_0x284e2c){return function(_0xd7ed8c){if(_0xd7ed8c){var _0x48885e=typeof _0x284e2c['offset']===_0x77b2('0x1c')&&typeof _0x284e2c[_0x77b2('0x1d')]===_0x77b2('0x1c');var _0x68c16e=_0xd7ed8c[_0x77b2('0x1e')];var _0x3a346c=_0x48885e?0x0:_0x284e2c[_0x77b2('0x1f')];var _0x4dc713=_0x48885e?_0xd7ed8c[_0x77b2('0x1e')]:_0x284e2c[_0x77b2('0x1f')]+_0x284e2c[_0x77b2('0x1d')];var _0x25e7fc;if(_0x4dc713>=_0x68c16e){_0x4dc713=_0x68c16e;_0x25e7fc=0xc8;}else{_0x25e7fc=0xce;}_0x2539d3[_0x77b2('0x1a')](_0x25e7fc);return _0x2539d3['set'](_0x77b2('0x20'),_0x3a346c+'-'+_0x4dc713+'/'+_0x68c16e)['json'](_0xd7ed8c);}return null;};}function patchUpdates(_0x298871){return function(_0x1d8132){try{jsonpatch[_0x77b2('0x21')](_0x1d8132,_0x298871,!![]);}catch(_0x28c778){return BPromise[_0x77b2('0x22')](_0x28c778);}return _0x1d8132[_0x77b2('0x23')]();};}function saveUpdates(_0x36dde1,_0x542d76){return function(_0x4d5c66){if(_0x4d5c66){return _0x4d5c66['update'](_0x36dde1)[_0x77b2('0x24')](function(_0x450892){return _0x450892;});}return null;};}function removeEntity(_0x11f7d1,_0x327a8e){return function(_0x93374a){if(_0x93374a){return _0x93374a[_0x77b2('0x25')]()[_0x77b2('0x24')](function(){_0x11f7d1['status'](0xcc)[_0x77b2('0x19')]();});}};}function handleEntityNotFound(_0x3f4068,_0x21b691){return function(_0x283d80){if(!_0x283d80){_0x3f4068[_0x77b2('0x18')](0x194);}return _0x283d80;};}function handleError(_0x3eae04,_0x9995){_0x9995=_0x9995||0x1f4;return function(_0x250202){logger[_0x77b2('0x26')](_0x250202[_0x77b2('0x27')]);if(_0x250202['name']){delete _0x250202[_0x77b2('0x28')];}_0x3eae04[_0x77b2('0x1a')](_0x9995)[_0x77b2('0x29')](_0x250202);};}exports[_0x77b2('0x2a')]=function(_0x21d161,_0x5dc412){var _0x251bf1={},_0x4a53e8={},_0x3b7f85={'count':0x0,'rows':[]};var _0x334366=_[_0x77b2('0x2b')](db[_0x77b2('0x2c')][_0x77b2('0x2d')],function(_0x1e9e01){return{'name':_0x1e9e01[_0x77b2('0x2e')],'type':_0x1e9e01[_0x77b2('0x2f')][_0x77b2('0x30')]};});_0x4a53e8[_0x77b2('0x31')]=_['map'](_0x334366,'name');_0x4a53e8['query']=_['keys'](_0x21d161[_0x77b2('0x32')]);_0x4a53e8[_0x77b2('0x33')]=_['intersection'](_0x4a53e8['model'],_0x4a53e8['query']);_0x251bf1[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x4a53e8[_0x77b2('0x31')],qs[_0x77b2('0x36')](_0x21d161['query'][_0x77b2('0x36')]));_0x251bf1['attributes']=_0x251bf1[_0x77b2('0x34')][_0x77b2('0x37')]?_0x251bf1[_0x77b2('0x34')]:_0x4a53e8[_0x77b2('0x31')];if(!_0x21d161[_0x77b2('0x32')][_0x77b2('0x38')]('nolimit')){_0x251bf1[_0x77b2('0x1d')]=qs[_0x77b2('0x1d')](_0x21d161[_0x77b2('0x32')]['limit']);_0x251bf1[_0x77b2('0x1f')]=qs['offset'](_0x21d161[_0x77b2('0x32')][_0x77b2('0x1f')]);}_0x251bf1[_0x77b2('0x39')]=qs['sort'](_0x21d161['query']['sort']);_0x251bf1['where']=qs[_0x77b2('0x33')](_['pick'](_0x21d161[_0x77b2('0x32')],_0x4a53e8[_0x77b2('0x33')]),_0x334366);if(_0x21d161[_0x77b2('0x32')][_0x77b2('0x3a')]){_0x251bf1[_0x77b2('0x3b')]=_[_0x77b2('0x3c')](_0x251bf1[_0x77b2('0x3b')],{'$or':_['map'](_0x334366,function(_0x4d1035){if(_0x4d1035[_0x77b2('0x2f')]!==_0x77b2('0x3d')){var _0x2b76fb={};_0x2b76fb[_0x4d1035[_0x77b2('0x28')]]={'$like':'%'+_0x21d161['query'][_0x77b2('0x3a')]+'%'};return _0x2b76fb;}})});}_0x251bf1=_[_0x77b2('0x3c')]({},_0x251bf1,_0x21d161[_0x77b2('0x3e')]);var _0x54770d={'where':_0x251bf1['where']};return db[_0x77b2('0x2c')][_0x77b2('0x1e')](_0x54770d)[_0x77b2('0x24')](function(_0x35b418){_0x3b7f85['count']=_0x35b418;if(_0x21d161[_0x77b2('0x32')][_0x77b2('0x3f')]){_0x251bf1[_0x77b2('0x40')]=[{'all':!![]}];}return db[_0x77b2('0x2c')][_0x77b2('0x41')](_0x251bf1);})['then'](function(_0x5a8c43){_0x3b7f85[_0x77b2('0x42')]=_0x5a8c43;return _0x3b7f85;})[_0x77b2('0x24')](respondWithFilteredResult(_0x5dc412,_0x251bf1))[_0x77b2('0x43')](handleError(_0x5dc412,null));};exports[_0x77b2('0x44')]=function(_0x23724a,_0xfda01f){var _0x95ac66={'raw':!![],'where':{'id':_0x23724a['params']['id']}},_0x531e2e={};_0x531e2e[_0x77b2('0x31')]=_[_0x77b2('0x45')](db[_0x77b2('0x2c')][_0x77b2('0x2d')]);_0x531e2e['query']=_['keys'](_0x23724a[_0x77b2('0x32')]);_0x531e2e['filters']=_[_0x77b2('0x35')](_0x531e2e[_0x77b2('0x31')],_0x531e2e[_0x77b2('0x32')]);_0x95ac66['attributes']=_['intersection'](_0x531e2e[_0x77b2('0x31')],qs['fields'](_0x23724a[_0x77b2('0x32')][_0x77b2('0x36')]));_0x95ac66[_0x77b2('0x34')]=_0x95ac66['attributes'][_0x77b2('0x37')]?_0x95ac66[_0x77b2('0x34')]:_0x531e2e[_0x77b2('0x31')];if(_0x23724a[_0x77b2('0x32')][_0x77b2('0x3f')]){_0x95ac66[_0x77b2('0x40')]=[{'all':!![]}];}_0x95ac66=_[_0x77b2('0x3c')]({},_0x95ac66,_0x23724a[_0x77b2('0x3e')]);return db[_0x77b2('0x2c')][_0x77b2('0x46')](_0x95ac66)[_0x77b2('0x24')](handleEntityNotFound(_0xfda01f,null))[_0x77b2('0x24')](respondWithResult(_0xfda01f,null))[_0x77b2('0x43')](handleError(_0xfda01f,null));};exports[_0x77b2('0x47')]=function(_0x213378,_0x3230a1){return db[_0x77b2('0x2c')][_0x77b2('0x47')](_0x213378[_0x77b2('0x48')],{})[_0x77b2('0x24')](respondWithResult(_0x3230a1,0xc9))['catch'](handleError(_0x3230a1,null));};exports[_0x77b2('0x49')]=function(_0x411a12,_0x4388f5){if(_0x411a12[_0x77b2('0x48')]['id']){delete _0x411a12[_0x77b2('0x48')]['id'];}return db[_0x77b2('0x2c')][_0x77b2('0x46')]({'where':{'id':_0x411a12[_0x77b2('0x4a')]['id']}})[_0x77b2('0x24')](handleEntityNotFound(_0x4388f5,null))[_0x77b2('0x24')](saveUpdates(_0x411a12[_0x77b2('0x48')],null))[_0x77b2('0x24')](respondWithResult(_0x4388f5,null))[_0x77b2('0x43')](handleError(_0x4388f5,null));};exports['destroy']=function(_0x26fe61,_0x3d4c49){return db[_0x77b2('0x2c')][_0x77b2('0x46')]({'where':{'id':_0x26fe61['params']['id']}})[_0x77b2('0x24')](handleEntityNotFound(_0x3d4c49,null))[_0x77b2('0x24')](removeEntity(_0x3d4c49,null))['catch'](handleError(_0x3d4c49,null));};exports[_0x77b2('0x4b')]=function(_0x1bac23,_0x3890fb){return db[_0x77b2('0x2c')]['describe']()[_0x77b2('0x24')](respondWithResult(_0x3890fb,null))['catch'](handleError(_0x3890fb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a5ad76c..9007e04 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 _0x8450=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5c0a8a,_0x4358ae){var _0x39cb95=function(_0x383073){while(--_0x383073){_0x5c0a8a['push'](_0x5c0a8a['shift']());}};_0x39cb95(++_0x4358ae);}(_0x8450,0x1c0));var _0x0845=function(_0x282f48,_0x12eeaa){_0x282f48=_0x282f48-0x0;var _0x5e5c9b=_0x8450[_0x282f48];return _0x5e5c9b;};'use strict';var _=require(_0x0845('0x0'));var util=require('util');var logger=require(_0x0845('0x1'))(_0x0845('0x2'));var moment=require(_0x0845('0x3'));var BPromise=require(_0x0845('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0845('0x5'));var rimraf=require(_0x0845('0x6'));var config=require(_0x0845('0x7'));var attributes=require(_0x0845('0x8'));module[_0x0845('0x9')]=function(_0x16b041,_0x52d730){return _0x16b041[_0x0845('0xa')](_0x0845('0xb'),attributes,{'tableName':_0x0845('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b2=['moment','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0xa2b2,0x189));var _0x2a2b=function(_0x4b63a7,_0x594052){_0x4b63a7=_0x4b63a7-0x0;var _0x1e925b=_0xa2b2[_0x4b63a7];return _0x1e925b;};'use strict';var _=require(_0x2a2b('0x0'));var util=require(_0x2a2b('0x1'));var logger=require('../../config/logger')(_0x2a2b('0x2'));var moment=require(_0x2a2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a2b('0x4'));var fs=require('fs');var path=require(_0x2a2b('0x5'));var rimraf=require(_0x2a2b('0x6'));var config=require(_0x2a2b('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x2a2b('0x8')]=function(_0x31634a,_0x3d7d4e){return _0x31634a[_0x2a2b('0x9')](_0x2a2b('0xa'),attributes,{'tableName':_0x2a2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index b38bd2b..9cb9b29 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 _0x8544=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x17f45b,_0x190a68){var _0x9b5759=function(_0x28dfb5){while(--_0x28dfb5){_0x17f45b['push'](_0x17f45b['shift']());}};_0x9b5759(++_0x190a68);}(_0x8544,0x11c));var _0x4854=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x8544[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x4854('0x0'));var util=require(_0x4854('0x1'));var moment=require(_0x4854('0x2'));var BPromise=require(_0x4854('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4854('0x4'));var db=require(_0x4854('0x5'))['db'];var utils=require(_0x4854('0x6'));var logger=require(_0x4854('0x7'))(_0x4854('0x8'));var config=require(_0x4854('0x9'));var jayson=require(_0x4854('0xa'));var client=jayson[_0x4854('0xb')][_0x4854('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xedfab5,_0x3079a8,_0x89c1e4){return new BPromise(function(_0x2265a7,_0x219f1b){return client[_0x4854('0xd')](_0xedfab5,_0x89c1e4)[_0x4854('0xe')](function(_0x5d1d1f){logger[_0x4854('0xf')](_0x4854('0x10'),_0x3079a8,_0x4854('0x11'));logger[_0x4854('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3079a8,_0x4854('0x11'),JSON[_0x4854('0x13')](_0x5d1d1f));if(_0x5d1d1f[_0x4854('0x14')]){if(_0x5d1d1f['error'][_0x4854('0x15')]===0x1f4){logger[_0x4854('0x14')](_0x4854('0x10'),_0x3079a8,_0x5d1d1f[_0x4854('0x14')][_0x4854('0x16')]);return _0x219f1b(_0x5d1d1f[_0x4854('0x14')][_0x4854('0x16')]);}logger[_0x4854('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3079a8,_0x5d1d1f[_0x4854('0x14')][_0x4854('0x16')]);return _0x2265a7(_0x5d1d1f[_0x4854('0x14')]['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3079a8,'request\x20sent');_0x2265a7(_0x5d1d1f[_0x4854('0x17')][_0x4854('0x16')]);}})[_0x4854('0x18')](function(_0x229a86){logger[_0x4854('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3079a8,_0x229a86);_0x219f1b(_0x229a86);});});} \ No newline at end of file +var _0xbf13=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2160b9,_0x538a7d){var _0x249f65=function(_0x28bc18){while(--_0x28bc18){_0x2160b9['push'](_0x2160b9['shift']());}};_0x249f65(++_0x538a7d);}(_0xbf13,0x14b));var _0x3bf1=function(_0x8ec9ec,_0xf95ed2){_0x8ec9ec=_0x8ec9ec-0x0;var _0x5b7366=_0xbf13[_0x8ec9ec];return _0x5b7366;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require(_0x3bf1('0x4'));var fs=require('fs');var Redis=require(_0x3bf1('0x5'));var db=require(_0x3bf1('0x6'))['db'];var utils=require(_0x3bf1('0x7'));var logger=require(_0x3bf1('0x8'))(_0x3bf1('0x9'));var config=require(_0x3bf1('0xa'));var jayson=require(_0x3bf1('0xb'));var client=jayson[_0x3bf1('0xc')][_0x3bf1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21ea89,_0x129baa,_0x3c14b8){return new BPromise(function(_0x56674f,_0x1b51f5){return client['request'](_0x21ea89,_0x3c14b8)[_0x3bf1('0xe')](function(_0x315ee1){logger[_0x3bf1('0xf')](_0x3bf1('0x10'),_0x129baa,'request\x20sent');logger[_0x3bf1('0x11')](_0x3bf1('0x12'),_0x129baa,_0x3bf1('0x13'),JSON[_0x3bf1('0x14')](_0x315ee1));if(_0x315ee1['error']){if(_0x315ee1[_0x3bf1('0x15')][_0x3bf1('0x16')]===0x1f4){logger[_0x3bf1('0x15')](_0x3bf1('0x10'),_0x129baa,_0x315ee1[_0x3bf1('0x15')][_0x3bf1('0x17')]);return _0x1b51f5(_0x315ee1[_0x3bf1('0x15')][_0x3bf1('0x17')]);}logger[_0x3bf1('0x15')](_0x3bf1('0x10'),_0x129baa,_0x315ee1[_0x3bf1('0x15')]['message']);return _0x56674f(_0x315ee1['error'][_0x3bf1('0x17')]);}else{logger[_0x3bf1('0xf')](_0x3bf1('0x10'),_0x129baa,_0x3bf1('0x13'));_0x56674f(_0x315ee1[_0x3bf1('0x18')][_0x3bf1('0x17')]);}})[_0x3bf1('0x19')](function(_0x577cd8){logger['error'](_0x3bf1('0x10'),_0x129baa,_0x577cd8);_0x1b51f5(_0x577cd8);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ce7b20e..b54e9f4 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 _0x503d=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','getSummary','post','create','/:id/clone','clone','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b9948,_0x14f392){var _0x4245fa=function(_0x4b61aa){while(--_0x4b61aa){_0x1b9948['push'](_0x1b9948['shift']());}};_0x4245fa(++_0x14f392);}(_0x503d,0x132));var _0xd503=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x503d[_0x5b13c3];return _0x3d6780;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd503('0x0'));var timeout=require(_0xd503('0x1'));var express=require(_0xd503('0x2'));var router=express[_0xd503('0x3')]();var fs_extra=require(_0xd503('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd503('0x5'));var config=require(_0xd503('0x6'));var controller=require('./jscriptyProject.controller');router[_0xd503('0x7')]('/',auth[_0xd503('0x8')](),controller[_0xd503('0x9')]);router[_0xd503('0x7')](_0xd503('0xa'),auth[_0xd503('0x8')](),controller[_0xd503('0xb')]);router[_0xd503('0x7')](_0xd503('0xc'),auth[_0xd503('0x8')](),controller[_0xd503('0xd')]);router['get'](_0xd503('0xe'),auth[_0xd503('0x8')](),controller['getAnswers']);router[_0xd503('0x7')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xd503('0xf')),controller[_0xd503('0x10')]);router[_0xd503('0x11')]('/',auth[_0xd503('0x8')](),controller[_0xd503('0x12')]);router[_0xd503('0x11')](_0xd503('0x13'),auth[_0xd503('0x8')](),controller[_0xd503('0x14')]);router[_0xd503('0x15')](_0xd503('0xa'),auth[_0xd503('0x8')](),controller['update']);router[_0xd503('0x16')](_0xd503('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd503('0x17')]=router; \ No newline at end of file +var _0x89a4=['../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x571506,_0x132cce){var _0xe2fdfa=function(_0x4e49ac){while(--_0x4e49ac){_0x571506['push'](_0x571506['shift']());}};_0xe2fdfa(++_0x132cce);}(_0x89a4,0x1b4));var _0x489a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x89a4[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x489a('0x0'));var util=require(_0x489a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x489a('0x2'));var router=express[_0x489a('0x3')]();var fs_extra=require(_0x489a('0x4'));var auth=require(_0x489a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x489a('0x6'));var controller=require(_0x489a('0x7'));router[_0x489a('0x8')]('/',auth[_0x489a('0x9')](),controller[_0x489a('0xa')]);router[_0x489a('0x8')](_0x489a('0xb'),auth[_0x489a('0x9')](),controller[_0x489a('0xc')]);router[_0x489a('0x8')](_0x489a('0xd'),auth['isAuthenticated'](),controller['getSessions']);router[_0x489a('0x8')](_0x489a('0xe'),auth['isAuthenticated'](),controller[_0x489a('0xf')]);router[_0x489a('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x489a('0x10')),controller[_0x489a('0x11')]);router[_0x489a('0x12')]('/',auth[_0x489a('0x9')](),controller[_0x489a('0x13')]);router[_0x489a('0x12')](_0x489a('0x14'),auth[_0x489a('0x9')](),controller[_0x489a('0x15')]);router[_0x489a('0x16')](_0x489a('0xb'),auth['isAuthenticated'](),controller[_0x489a('0x17')]);router[_0x489a('0x18')]('/:id',auth[_0x489a('0x9')](),controller[_0x489a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 39e3bd3..0bd3e6a 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 _0xdfc4=['TEXT','isObjectLike','formData','stringify','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','name'];(function(_0x4d6a8d,_0xdc29de){var _0x4c9a03=function(_0x562dd4){while(--_0x562dd4){_0x4d6a8d['push'](_0x4d6a8d['shift']());}};_0x4c9a03(++_0xdc29de);}(_0xdfc4,0xe6));var _0x4dfc=function(_0x11d541,_0xc8fe9){_0x11d541=_0x11d541-0x0;var _0x3e612a=_0xdfc4[_0x11d541];return _0x3e612a;};'use strict';var Sequelize=require(_0x4dfc('0x0'));var _=require(_0x4dfc('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x4dfc('0x2')],'unique':_0x4dfc('0x3')},'description':{'type':Sequelize[_0x4dfc('0x2')]},'formData':{'type':Sequelize[_0x4dfc('0x4')]('long'),'set':function(_0x29fc6a){if(_[_0x4dfc('0x5')](_0x29fc6a)){this['setDataValue'](_0x4dfc('0x6'),JSON[_0x4dfc('0x7')](_0x29fc6a));}else if(_['isString'](_0x29fc6a)){this[_0x4dfc('0x8')](_0x4dfc('0x6'),_0x29fc6a);}else{this[_0x4dfc('0x8')]('formData',util[_0x4dfc('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x4dfc('0x3'))||'',this[_0x4dfc('0xa')](_0x4dfc('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4dfc('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4dfc('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x8a87=['exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util'];(function(_0x2e23ee,_0x12eaec){var _0x5af1a6=function(_0x1e3874){while(--_0x1e3874){_0x2e23ee['push'](_0x2e23ee['shift']());}};_0x5af1a6(++_0x12eaec);}(_0x8a87,0x19d));var _0x78a8=function(_0x47c39a,_0x165a5d){_0x47c39a=_0x47c39a-0x0;var _0x590928=_0x8a87[_0x47c39a];return _0x590928;};'use strict';var Sequelize=require(_0x78a8('0x0'));var _=require(_0x78a8('0x1'));var util=require(_0x78a8('0x2'));module[_0x78a8('0x3')]={'name':{'type':Sequelize[_0x78a8('0x4')],'unique':_0x78a8('0x5')},'description':{'type':Sequelize[_0x78a8('0x4')]},'formData':{'type':Sequelize[_0x78a8('0x6')](_0x78a8('0x7')),'set':function(_0x358f83){if(_[_0x78a8('0x8')](_0x358f83)){this[_0x78a8('0x9')](_0x78a8('0xa'),JSON[_0x78a8('0xb')](_0x358f83));}else if(_[_0x78a8('0xc')](_0x358f83)){this[_0x78a8('0x9')](_0x78a8('0xa'),_0x358f83);}else{this[_0x78a8('0x9')]('formData',util['format'](_0x78a8('0xd'),this[_0x78a8('0xe')]('name')||'',this[_0x78a8('0xe')](_0x78a8('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9813feb..9a70389 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 _0x065e=['update','then','destroy','UserProfileResource','error','name','send','index','map','JscriptyProject','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','parse','startTime','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x065e,0x1a7));var _0xe065=function(_0x2b522e,_0xf42ddc){_0x2b522e=_0x2b522e-0x0;var _0x3ade0e=_0x065e[_0x2b522e];return _0x3ade0e;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Projects';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x4f')]=function(_0x1ea568,_0xe77af6){var _0x2f0ed5={'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}},_0x43480d={};_0x43480d['model']=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x2f0ed5[_0xe065('0x31')]=_['intersection'](_0x43480d[_0xe065('0x30')],qs[_0xe065('0x32')](_0x1ea568[_0xe065('0x2d')][_0xe065('0x32')]));_0x2f0ed5['attributes']=_0x2f0ed5[_0xe065('0x31')][_0xe065('0x33')]?_0x2f0ed5[_0xe065('0x31')]:_0x43480d['model'];if(_0x1ea568[_0xe065('0x2d')][_0xe065('0x3d')]){_0x2f0ed5[_0xe065('0x3e')]=[{'all':!![]}];}_0x2f0ed5=_[_0xe065('0x3b')]({},_0x2f0ed5,_0x1ea568[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x2f0ed5)[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](function(_0x5ec6fe){if(_0x5ec6fe){var _0x2accad=_0x5ec6fe['get']({'plain':!![]});_0x2accad=qs[_0xe065('0x50')](_0x2accad,['id',_0xe065('0x51'),_0xe065('0x52')]);_0x1ea568['body']=_['omit'](_0x1ea568['body'],['id',_0xe065('0x51'),_0xe065('0x52')]);return db[_0xe065('0x2a')][_0xe065('0x46')](_[_0xe065('0x3b')](_0x2accad,_0x1ea568[_0xe065('0x53')]),{'include':_0x1ea568[_0xe065('0x2d')][_0xe065('0x3d')]?[{'all':!![]}]:undefined})[_0xe065('0x22')](function(_0x3169fa){var _0x25ec8a=_0x1ea568['user']['get']({'plain':!![]});if(!_0x25ec8a)throw new Error(_0xe065('0x49'));if(_0x25ec8a[_0xe065('0x4a')]==='user'){var _0x276c17=_0x3169fa['get']({'plain':!![]});var _0x4f4dca=_0xe065('0x4b');return db[_0xe065('0x4c')][_0xe065('0x45')]({'where':{'name':_0x4f4dca,'userProfileId':_0x25ec8a[_0xe065('0x54')]},'raw':!![]})[_0xe065('0x22')](function(_0x817baf){if(_0x817baf&&_0x817baf[_0xe065('0x55')]===0x0){return db['UserProfileResource'][_0xe065('0x46')]({'name':_0x276c17[_0xe065('0x26')],'resourceId':_0x276c17['id'],'type':_0x817baf[_0xe065('0x26')],'sectionId':_0x817baf['id']},{})[_0xe065('0x22')](function(){return _0x3169fa;});}else{return _0x3169fa;}})[_0xe065('0x4d')](function(_0x4f35a6){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x4f35a6);throw _0x4f35a6;});}return _0x3169fa;});}})[_0xe065('0x22')](respondWithResult(_0xe77af6,0xc9))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x21')]=function(_0xfce2e,_0x5af9d5){if(_0xfce2e['body']['id']){delete _0xfce2e['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0xfce2e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x5af9d5,null))[_0xe065('0x22')](saveUpdates(_0xfce2e[_0xe065('0x53')],null))[_0xe065('0x22')](respondWithResult(_0x5af9d5,null))[_0xe065('0x4d')](handleError(_0x5af9d5,null));};exports[_0xe065('0x23')]=function(_0x4084a0,_0x507fd2){return db['JscriptyProject'][_0xe065('0x45')]({'where':{'id':_0x4084a0[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x507fd2,null))['then'](removeEntity(_0x507fd2,null))[_0xe065('0x4d')](handleError(_0x507fd2,null));};exports[_0xe065('0x56')]=function(_0x113a0f,_0x4765a0,_0x136e40){var _0x2c0b2e={'raw':!![],'where':{}};var _0xac5395={};var _0x199ca3={'count':0x0,'rows':[]};return db[_0xe065('0x2a')][_0xe065('0x57')]({'where':{'id':_0x113a0f[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x4765a0,null))[_0xe065('0x22')](function(_0xc0ebe8){if(_0xc0ebe8){_0xac5395[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x58')][_0xe065('0x44')]);_0xac5395['query']=_[_0xe065('0x43')](_0x113a0f[_0xe065('0x2d')]);_0xac5395[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0xac5395[_0xe065('0x30')],_0xac5395[_0xe065('0x2d')]);_0x2c0b2e[_0xe065('0x31')]=_[_0xe065('0x2f')](_0xac5395[_0xe065('0x30')],qs[_0xe065('0x32')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x32')]));_0x2c0b2e[_0xe065('0x31')]=_0x2c0b2e[_0xe065('0x31')][_0xe065('0x33')]?_0x2c0b2e[_0xe065('0x31')]:_0xac5395[_0xe065('0x30')];if(!_0x113a0f['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x2c0b2e[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x1b')]);_0x2c0b2e[_0xe065('0x1a')]=qs[_0xe065('0x1a')](_0x113a0f[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x2c0b2e['order']=qs['sort'](_0x113a0f[_0xe065('0x2d')]['sort']);_0x2c0b2e[_0xe065('0x3a')]=qs['filters'](_[_0xe065('0x38')](_0x113a0f[_0xe065('0x2d')],_0xac5395[_0xe065('0x2e')]));_0x2c0b2e[_0xe065('0x3a')][_0xe065('0x59')]=_0xc0ebe8['id'];if(_0x113a0f[_0xe065('0x2d')][_0xe065('0x39')]){_0x2c0b2e[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x2c0b2e['where'],{'$or':_[_0xe065('0x29')](_0x2c0b2e[_0xe065('0x31')],function(_0x134d0a){var _0x3f8e32={};_0x3f8e32[_0x134d0a]={'$like':'%'+_0x113a0f['query'][_0xe065('0x39')]+'%'};return _0x3f8e32;})});}_0x2c0b2e=_[_0xe065('0x3b')]({},_0x2c0b2e,_0x113a0f[_0xe065('0x3c')]);return db['JscriptySessionReport'][_0xe065('0x1d')]({'where':_0x2c0b2e[_0xe065('0x3a')]})[_0xe065('0x22')](function(_0x52f0ac){_0x199ca3[_0xe065('0x1d')]=_0x52f0ac;if(_0x113a0f[_0xe065('0x2d')]['includeAll']){_0x2c0b2e['include']=[{'all':!![]}];}return db[_0xe065('0x58')][_0xe065('0x3f')](_0x2c0b2e);})[_0xe065('0x22')](function(_0x3f3878){_0x199ca3[_0xe065('0x40')]=_0x3f3878;return _0x199ca3;});}})['then'](respondWithFilteredResult(_0x4765a0,_0x2c0b2e))['catch'](handleError(_0x4765a0,null));};exports[_0xe065('0x5a')]=function(_0x1263f7,_0x4bed1d,_0x13e0ed){var _0xb32a44={'raw':!![],'where':{}};var _0x3d9fe8={};var _0x3251df={'count':0x0,'rows':[]};return db[_0xe065('0x2a')][_0xe065('0x57')]({'where':{'id':_0x1263f7[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x4bed1d,null))[_0xe065('0x22')](function(_0x1ec81f){if(_0x1ec81f){_0x3d9fe8['model']=_['keys'](db[_0xe065('0x5b')][_0xe065('0x44')]);_0x3d9fe8[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x1263f7[_0xe065('0x2d')]);_0x3d9fe8['filters']=_[_0xe065('0x2f')](_0x3d9fe8[_0xe065('0x30')],_0x3d9fe8[_0xe065('0x2d')]);_0xb32a44[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x3d9fe8[_0xe065('0x30')],qs[_0xe065('0x32')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x32')]));_0xb32a44[_0xe065('0x31')]=_0xb32a44[_0xe065('0x31')]['length']?_0xb32a44[_0xe065('0x31')]:_0x3d9fe8[_0xe065('0x30')];if(!_0x1263f7[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0xb32a44[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x1b')]);_0xb32a44[_0xe065('0x1a')]=qs[_0xe065('0x1a')](_0x1263f7[_0xe065('0x2d')]['offset']);}_0xb32a44[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x1263f7[_0xe065('0x2d')][_0xe065('0x37')]);_0xb32a44[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x1263f7[_0xe065('0x2d')],_0x3d9fe8[_0xe065('0x2e')]));_0xb32a44[_0xe065('0x3a')][_0xe065('0x59')]=_0x1ec81f['id'];if(_0x1263f7[_0xe065('0x2d')][_0xe065('0x39')]){_0xb32a44[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0xb32a44[_0xe065('0x3a')],{'$or':_[_0xe065('0x29')](_0xb32a44[_0xe065('0x31')],function(_0x105eaa){var _0x2052fb={};_0x2052fb[_0x105eaa]={'$like':'%'+_0x1263f7[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x2052fb;})});}_0xb32a44=_[_0xe065('0x3b')]({},_0xb32a44,_0x1263f7[_0xe065('0x3c')]);return db[_0xe065('0x5b')][_0xe065('0x1d')]({'where':_0xb32a44[_0xe065('0x3a')]})[_0xe065('0x22')](function(_0x3a53a4){_0x3251df[_0xe065('0x1d')]=_0x3a53a4;if(_0x1263f7[_0xe065('0x2d')][_0xe065('0x3d')]){_0xb32a44[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x5b')][_0xe065('0x3f')](_0xb32a44);})[_0xe065('0x22')](function(_0x23f071){_0x3251df[_0xe065('0x40')]=_0x23f071;return _0x3251df;});}})[_0xe065('0x22')](respondWithFilteredResult(_0x4bed1d,_0xb32a44))[_0xe065('0x4d')](handleError(_0x4bed1d,null));};function char(_0x4da03f){return _0xe065('0x5c')===typeof _0x4da03f?String[_0xe065('0x5d')][_0xe065('0x5e')](null,arguments):_0x4da03f;}function needsEncapsulation(_0xe199d7){return!!_0xe199d7&&(_0xe199d7[_0xe065('0x5f')]()[_0xe065('0x60')](char(0xd))>=0x0||_0xe199d7[_0xe065('0x5f')]()[_0xe065('0x60')](char(0xa))>=0x0||_0xe199d7['toString']()[_0xe065('0x60')](char(0x2c))>=0x0||_0xe199d7['toString']()[_0xe065('0x60')](char(0x22))>=0x0);}function encapsulate(_0x550c0b){var _0x110f5e=char(0x22),_0x1fed2d='\x5c'+char(0x22),_0x19e3cf=_0x550c0b[_0xe065('0x5f')]()['replace'](new RegExp(_0x110f5e,'g'),_0x1fed2d);return _0x110f5e+_0x19e3cf+_0x110f5e;}exports['getSummary']=function(_0x27606f,_0x40431a,_0x40fe42){var _0x47c3f8,_0x2b7964;var _0x32d7af={'where':{'ProjectId':_0x27606f[_0xe065('0x42')]['id']}};if(_0x27606f['query']['startTime']){_0x32d7af['where']['starttime']=JSON[_0xe065('0x61')](_0x27606f[_0xe065('0x2d')][_0xe065('0x62')]);}return db[_0xe065('0x58')][_0xe065('0x3f')](_0x32d7af)['then'](handleEntityNotFound(_0x40431a,null))[_0xe065('0x22')](function(_0xa524d8){if(_0xa524d8){_0x47c3f8=_0xa524d8;return db['JscriptyQuestionReport'][_0xe065('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x47c3f8,'id')},'ProjectId':_0x27606f[_0xe065('0x42')]['id']},'order':'-createdAt'});}})[_0xe065('0x22')](handleEntityNotFound(_0x40431a,null))[_0xe065('0x22')](function(_0xde5ead){if(_0xde5ead){_0x2b7964=_0xde5ead;var _0x2c1d4c={};for(var _0x201009=0x0,_0x24a944=_0x2b7964[_0xe065('0x33')];_0x201009<_0x24a944;_0x201009++){if(!_0x2c1d4c[_0xe065('0x34')](_0x2b7964[_0x201009][_0xe065('0x63')])){_0x2c1d4c[_0x2b7964[_0x201009][_0xe065('0x63')]]=needsEncapsulation(_0x2b7964[_0x201009][_0xe065('0x64')])?encapsulate(_0x2b7964[_0x201009][_0xe065('0x64')]):_0x2b7964[_0x201009][_0xe065('0x64')];}}var _0x168fd8=[],_0x518683={};for(var _0x4e98f8=0x0,_0x3709ea=_0x47c3f8[_0xe065('0x33')];_0x4e98f8<_0x3709ea;_0x4e98f8++){_0x518683={'ProjectId':_0x27606f['params']['id'],'SessionId':_0x47c3f8[_0x4e98f8]['id'],'StartTime':moment(_0x47c3f8[_0x4e98f8][_0xe065('0x65')])[_0xe065('0x66')](_0xe065('0x67'))};for(var _0x18271d=0x0,_0x368b31=_0x2b7964[_0xe065('0x33')];_0x18271d<_0x368b31;_0x18271d++){if(_0x2b7964[_0x18271d][_0xe065('0x68')]==_0x47c3f8[_0x4e98f8]['id']&&_0x2c1d4c['hasOwnProperty'](_0x2b7964[_0x18271d]['questionId'])){_0x518683[_0x2c1d4c[_0x2b7964[_0x18271d][_0xe065('0x63')]]]=_0x2b7964[_0x18271d][_0xe065('0x69')];}}for(var _0x343413 in _0x2c1d4c){if(!_0x518683[_0xe065('0x34')](_0x2c1d4c[_0x343413])){_0x518683[_0x2c1d4c[_0x343413]]=null;}}_0x168fd8['push'](_0x518683);}return _0x168fd8;}})[_0xe065('0x22')](function(_0x33f41c){if(!_[_0xe065('0x6a')](_0x33f41c)){var _0x444ef8=toCsv(_0x33f41c);var _0x30ff95=Date[_0xe065('0x6b')]();fs['writeFileSync'](util[_0xe065('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x27606f['params']['id'],_0x30ff95),_0x444ef8);_0x40431a[_0xe065('0x6c')](_0xe065('0x6d'),_0xe065('0x6e')+util[_0xe065('0x66')]('Jscripty_Project_%d_Summary_%s.csv',_0x27606f[_0xe065('0x42')]['id'],_0x30ff95));_0x40431a[_0xe065('0x6c')]('Content-type',_0xe065('0x6f'));return _0x40431a[_0xe065('0x70')](util[_0xe065('0x66')](_0xe065('0x71'),_0x27606f[_0xe065('0x42')]['id'],_0x30ff95));}else{return _0x40431a['sendStatus'](0xcc);}})[_0xe065('0x4d')](handleError(_0x40431a,null));}; \ No newline at end of file +var _0x97db=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','reject','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','options','JscriptyProject','includeAll','include','findAll','rows','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','params','omit','createdAt','updatedAt','body','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','starttime','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5c3e80,_0x4e6c3a){var _0x2ad8ab=function(_0x52c82c){while(--_0x52c82c){_0x5c3e80['push'](_0x5c3e80['shift']());}};_0x2ad8ab(++_0x4e6c3a);}(_0x97db,0x1b4));var _0xb97d=function(_0x150820,_0x3a6ce5){_0x150820=_0x150820-0x0;var _0x2e21a0=_0x97db[_0x150820];return _0x2e21a0;};'use strict';var emlformat=require(_0xb97d('0x0'));var rimraf=require(_0xb97d('0x1'));var zipdir=require(_0xb97d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb97d('0x3'));var BPromise=require(_0xb97d('0x4'));var Mustache=require(_0xb97d('0x5'));var util=require(_0xb97d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb97d('0x7'));var ejs=require(_0xb97d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb97d('0x9'));var crypto=require('crypto');var jsforce=require(_0xb97d('0xa'));var deskjs=require(_0xb97d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb97d('0xc'));var Papa=require(_0xb97d('0xd'));var Redis=require(_0xb97d('0xe'));var authService=require(_0xb97d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb97d('0x10'));var hardwareService=require(_0xb97d('0x11'));var logger=require(_0xb97d('0x12'))(_0xb97d('0x13'));var utils=require(_0xb97d('0x14'));var config=require(_0xb97d('0x15'));var licenseUtil=require(_0xb97d('0x16'));var db=require(_0xb97d('0x17'))['db'];function respondWithStatusCode(_0xa31bc3,_0x412655){_0x412655=_0x412655||0xcc;return function(_0xb3abc1){if(_0xb3abc1){return _0xa31bc3[_0xb97d('0x18')](_0x412655);}return _0xa31bc3[_0xb97d('0x19')](_0x412655)[_0xb97d('0x1a')]();};}function respondWithResult(_0x1d70f9,_0x2f73ec){_0x2f73ec=_0x2f73ec||0xc8;return function(_0x117bfe){if(_0x117bfe){return _0x1d70f9[_0xb97d('0x19')](_0x2f73ec)['json'](_0x117bfe);}};}function respondWithFilteredResult(_0x41a47c,_0x1a71de){return function(_0x35ea35){if(_0x35ea35){var _0x170a07=typeof _0x1a71de[_0xb97d('0x1b')]==='undefined'&&typeof _0x1a71de[_0xb97d('0x1c')]===_0xb97d('0x1d');var _0xea4e95=_0x35ea35['count'];var _0x50cd63=_0x170a07?0x0:_0x1a71de[_0xb97d('0x1b')];var _0x2285bc=_0x170a07?_0x35ea35[_0xb97d('0x1e')]:_0x1a71de[_0xb97d('0x1b')]+_0x1a71de[_0xb97d('0x1c')];var _0x3cd261;if(_0x2285bc>=_0xea4e95){_0x2285bc=_0xea4e95;_0x3cd261=0xc8;}else{_0x3cd261=0xce;}_0x41a47c[_0xb97d('0x19')](_0x3cd261);return _0x41a47c['set']('Content-Range',_0x50cd63+'-'+_0x2285bc+'/'+_0xea4e95)['json'](_0x35ea35);}return null;};}function patchUpdates(_0x49b857){return function(_0x395e6b){try{jsonpatch['apply'](_0x395e6b,_0x49b857,!![]);}catch(_0x3c0d42){return BPromise[_0xb97d('0x1f')](_0x3c0d42);}return _0x395e6b['save']();};}function saveUpdates(_0x52af79,_0x5b2a19){return function(_0xd77fee){if(_0xd77fee){return _0xd77fee[_0xb97d('0x20')](_0x52af79)[_0xb97d('0x21')](function(_0x453741){return _0x453741;});}return null;};}function removeEntity(_0x20df11,_0x3f7704){return function(_0x270cc5){if(_0x270cc5){return _0x270cc5[_0xb97d('0x22')]()[_0xb97d('0x21')](function(){var _0x207575=_0x270cc5['get']({'plain':!![]});var _0x14a8eb=_0xb97d('0x23');return db[_0xb97d('0x24')][_0xb97d('0x22')]({'where':{'type':_0x14a8eb,'resourceId':_0x207575['id']}})['then'](function(){return _0x270cc5;});})[_0xb97d('0x21')](function(){_0x20df11['status'](0xcc)[_0xb97d('0x1a')]();});}};}function handleEntityNotFound(_0xee6a00,_0x29b7e2){return function(_0x29508a){if(!_0x29508a){_0xee6a00[_0xb97d('0x18')](0x194);}return _0x29508a;};}function handleError(_0x121765,_0xa5fbed){_0xa5fbed=_0xa5fbed||0x1f4;return function(_0x26886a){logger[_0xb97d('0x25')](_0x26886a[_0xb97d('0x26')]);if(_0x26886a['name']){delete _0x26886a[_0xb97d('0x27')];}_0x121765[_0xb97d('0x19')](_0xa5fbed)[_0xb97d('0x28')](_0x26886a);};}exports['index']=function(_0x1a519a,_0x949dd1){var _0x50da08={},_0x499b2c={},_0x5d51bf={'count':0x0,'rows':[]};var _0x2227ed=_[_0xb97d('0x29')](db['JscriptyProject'][_0xb97d('0x2a')],function(_0x577da6){return{'name':_0x577da6['fieldName'],'type':_0x577da6[_0xb97d('0x2b')][_0xb97d('0x2c')]};});_0x499b2c[_0xb97d('0x2d')]=_[_0xb97d('0x29')](_0x2227ed,'name');_0x499b2c[_0xb97d('0x2e')]=_[_0xb97d('0x2f')](_0x1a519a[_0xb97d('0x2e')]);_0x499b2c[_0xb97d('0x30')]=_[_0xb97d('0x31')](_0x499b2c[_0xb97d('0x2d')],_0x499b2c[_0xb97d('0x2e')]);_0x50da08[_0xb97d('0x32')]=_[_0xb97d('0x31')](_0x499b2c['model'],qs[_0xb97d('0x33')](_0x1a519a[_0xb97d('0x2e')][_0xb97d('0x33')]));_0x50da08[_0xb97d('0x32')]=_0x50da08[_0xb97d('0x32')]['length']?_0x50da08[_0xb97d('0x32')]:_0x499b2c[_0xb97d('0x2d')];if(!_0x1a519a['query']['hasOwnProperty'](_0xb97d('0x34'))){_0x50da08['limit']=qs[_0xb97d('0x1c')](_0x1a519a[_0xb97d('0x2e')][_0xb97d('0x1c')]);_0x50da08[_0xb97d('0x1b')]=qs['offset'](_0x1a519a[_0xb97d('0x2e')][_0xb97d('0x1b')]);}_0x50da08['order']=qs[_0xb97d('0x35')](_0x1a519a[_0xb97d('0x2e')]['sort']);_0x50da08[_0xb97d('0x36')]=qs[_0xb97d('0x30')](_['pick'](_0x1a519a[_0xb97d('0x2e')],_0x499b2c[_0xb97d('0x30')]),_0x2227ed);if(_0x1a519a[_0xb97d('0x2e')][_0xb97d('0x37')]){_0x50da08[_0xb97d('0x36')]=_[_0xb97d('0x38')](_0x50da08['where'],{'$or':_[_0xb97d('0x29')](_0x2227ed,function(_0x5b313a){if(_0x5b313a[_0xb97d('0x2b')]!=='VIRTUAL'){var _0xf5a069={};_0xf5a069[_0x5b313a[_0xb97d('0x27')]]={'$like':'%'+_0x1a519a['query'][_0xb97d('0x37')]+'%'};return _0xf5a069;}})});}_0x50da08=_[_0xb97d('0x38')]({},_0x50da08,_0x1a519a[_0xb97d('0x39')]);var _0x118824={'where':_0x50da08['where']};return db[_0xb97d('0x3a')]['count'](_0x118824)[_0xb97d('0x21')](function(_0x5967e4){_0x5d51bf['count']=_0x5967e4;if(_0x1a519a[_0xb97d('0x2e')][_0xb97d('0x3b')]){_0x50da08[_0xb97d('0x3c')]=[{'all':!![]}];}return db[_0xb97d('0x3a')][_0xb97d('0x3d')](_0x50da08);})[_0xb97d('0x21')](function(_0xa3b813){_0x5d51bf[_0xb97d('0x3e')]=_0xa3b813;return _0x5d51bf;})[_0xb97d('0x21')](respondWithFilteredResult(_0x949dd1,_0x50da08))['catch'](handleError(_0x949dd1,null));};exports['show']=function(_0x3d5372,_0x244cb9){var _0x6c07b5={'raw':![],'where':{'id':_0x3d5372['params']['id']}},_0x1e5162={};_0x1e5162[_0xb97d('0x2d')]=_[_0xb97d('0x2f')](db[_0xb97d('0x3a')]['rawAttributes']);_0x1e5162[_0xb97d('0x2e')]=_[_0xb97d('0x2f')](_0x3d5372[_0xb97d('0x2e')]);_0x1e5162[_0xb97d('0x30')]=_[_0xb97d('0x31')](_0x1e5162[_0xb97d('0x2d')],_0x1e5162[_0xb97d('0x2e')]);_0x6c07b5['attributes']=_[_0xb97d('0x31')](_0x1e5162[_0xb97d('0x2d')],qs[_0xb97d('0x33')](_0x3d5372[_0xb97d('0x2e')][_0xb97d('0x33')]));_0x6c07b5[_0xb97d('0x32')]=_0x6c07b5[_0xb97d('0x32')][_0xb97d('0x3f')]?_0x6c07b5[_0xb97d('0x32')]:_0x1e5162[_0xb97d('0x2d')];if(_0x3d5372[_0xb97d('0x2e')][_0xb97d('0x3b')]){_0x6c07b5[_0xb97d('0x3c')]=[{'all':!![]}];}_0x6c07b5=_[_0xb97d('0x38')]({},_0x6c07b5,_0x3d5372['options']);return db[_0xb97d('0x3a')][_0xb97d('0x40')](_0x6c07b5)[_0xb97d('0x21')](handleEntityNotFound(_0x244cb9,null))['then'](respondWithResult(_0x244cb9,null))['catch'](handleError(_0x244cb9,null));};exports[_0xb97d('0x41')]=function(_0x24bddf,_0x481cb4){return db[_0xb97d('0x3a')][_0xb97d('0x41')](_0x24bddf['body'],{})[_0xb97d('0x21')](function(_0x1336d3){var _0x3cfe00=_0x24bddf['user']['get']({'plain':!![]});if(!_0x3cfe00)throw new Error(_0xb97d('0x42'));if(_0x3cfe00[_0xb97d('0x43')]===_0xb97d('0x44')){var _0x4e5ae7=_0x1336d3[_0xb97d('0x45')]({'plain':!![]});var _0x4ca0fe=_0xb97d('0x23');return db[_0xb97d('0x46')]['find']({'where':{'name':_0x4ca0fe,'userProfileId':_0x3cfe00[_0xb97d('0x47')]},'raw':!![]})[_0xb97d('0x21')](function(_0x386b91){if(_0x386b91&&_0x386b91[_0xb97d('0x48')]===0x0){return db['UserProfileResource'][_0xb97d('0x41')]({'name':_0x4e5ae7['name'],'resourceId':_0x4e5ae7['id'],'type':_0x386b91[_0xb97d('0x27')],'sectionId':_0x386b91['id']},{})[_0xb97d('0x21')](function(){return _0x1336d3;});}else{return _0x1336d3;}})['catch'](function(_0x55919f){logger[_0xb97d('0x25')](_0xb97d('0x49'),_0x55919f);throw _0x55919f;});}return _0x1336d3;})[_0xb97d('0x21')](respondWithResult(_0x481cb4,0xc9))[_0xb97d('0x4a')](handleError(_0x481cb4,null));};exports[_0xb97d('0x4b')]=function(_0x5f4e37,_0x3ca690){var _0x298fff={'where':{'id':_0x5f4e37[_0xb97d('0x4c')]['id']}},_0x228209={};_0x228209[_0xb97d('0x2d')]=_[_0xb97d('0x2f')](db[_0xb97d('0x3a')][_0xb97d('0x2a')]);_0x298fff[_0xb97d('0x32')]=_[_0xb97d('0x31')](_0x228209[_0xb97d('0x2d')],qs['fields'](_0x5f4e37[_0xb97d('0x2e')][_0xb97d('0x33')]));_0x298fff[_0xb97d('0x32')]=_0x298fff[_0xb97d('0x32')][_0xb97d('0x3f')]?_0x298fff['attributes']:_0x228209['model'];if(_0x5f4e37[_0xb97d('0x2e')][_0xb97d('0x3b')]){_0x298fff[_0xb97d('0x3c')]=[{'all':!![]}];}_0x298fff=_[_0xb97d('0x38')]({},_0x298fff,_0x5f4e37[_0xb97d('0x39')]);return db[_0xb97d('0x3a')]['find'](_0x298fff)[_0xb97d('0x21')](handleEntityNotFound(_0x3ca690,null))[_0xb97d('0x21')](function(_0x454067){if(_0x454067){var _0x58f8b3=_0x454067[_0xb97d('0x45')]({'plain':!![]});_0x58f8b3=qs[_0xb97d('0x4d')](_0x58f8b3,['id',_0xb97d('0x4e'),_0xb97d('0x4f')]);_0x5f4e37[_0xb97d('0x50')]=_[_0xb97d('0x4d')](_0x5f4e37[_0xb97d('0x50')],['id',_0xb97d('0x4e'),_0xb97d('0x4f')]);return db[_0xb97d('0x3a')]['create'](_[_0xb97d('0x38')](_0x58f8b3,_0x5f4e37[_0xb97d('0x50')]),{'include':_0x5f4e37[_0xb97d('0x2e')][_0xb97d('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0x68ce48){var _0x411744=_0x5f4e37['user'][_0xb97d('0x45')]({'plain':!![]});if(!_0x411744)throw new Error(_0xb97d('0x42'));if(_0x411744['role']==='user'){var _0xa270b5=_0x68ce48['get']({'plain':!![]});var _0x574546=_0xb97d('0x23');return db[_0xb97d('0x46')][_0xb97d('0x40')]({'where':{'name':_0x574546,'userProfileId':_0x411744['userProfileId']},'raw':!![]})[_0xb97d('0x21')](function(_0x653d86){if(_0x653d86&&_0x653d86['autoAssociation']===0x0){return db[_0xb97d('0x24')][_0xb97d('0x41')]({'name':_0xa270b5[_0xb97d('0x27')],'resourceId':_0xa270b5['id'],'type':_0x653d86['name'],'sectionId':_0x653d86['id']},{})[_0xb97d('0x21')](function(){return _0x68ce48;});}else{return _0x68ce48;}})[_0xb97d('0x4a')](function(_0x173da2){logger['error'](_0xb97d('0x49'),_0x173da2);throw _0x173da2;});}return _0x68ce48;});}})[_0xb97d('0x21')](respondWithResult(_0x3ca690,0xc9))[_0xb97d('0x4a')](handleError(_0x3ca690,null));};exports[_0xb97d('0x20')]=function(_0x114c23,_0x30291b){if(_0x114c23['body']['id']){delete _0x114c23[_0xb97d('0x50')]['id'];}return db['JscriptyProject'][_0xb97d('0x40')]({'where':{'id':_0x114c23[_0xb97d('0x4c')]['id']}})[_0xb97d('0x21')](handleEntityNotFound(_0x30291b,null))[_0xb97d('0x21')](saveUpdates(_0x114c23['body'],null))[_0xb97d('0x21')](respondWithResult(_0x30291b,null))[_0xb97d('0x4a')](handleError(_0x30291b,null));};exports[_0xb97d('0x22')]=function(_0x1eed10,_0x21c461){return db[_0xb97d('0x3a')][_0xb97d('0x40')]({'where':{'id':_0x1eed10[_0xb97d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21c461,null))[_0xb97d('0x21')](removeEntity(_0x21c461,null))[_0xb97d('0x4a')](handleError(_0x21c461,null));};exports[_0xb97d('0x51')]=function(_0x4fd322,_0x1a0a11,_0x233ba9){var _0x127f55={'raw':!![],'where':{}};var _0xce0b29={};var _0x40675b={'count':0x0,'rows':[]};return db[_0xb97d('0x3a')][_0xb97d('0x52')]({'where':{'id':_0x4fd322[_0xb97d('0x4c')]['id']}})[_0xb97d('0x21')](handleEntityNotFound(_0x1a0a11,null))[_0xb97d('0x21')](function(_0x5e4376){if(_0x5e4376){_0xce0b29[_0xb97d('0x2d')]=_['keys'](db[_0xb97d('0x53')]['rawAttributes']);_0xce0b29['query']=_[_0xb97d('0x2f')](_0x4fd322[_0xb97d('0x2e')]);_0xce0b29[_0xb97d('0x30')]=_[_0xb97d('0x31')](_0xce0b29[_0xb97d('0x2d')],_0xce0b29['query']);_0x127f55['attributes']=_[_0xb97d('0x31')](_0xce0b29[_0xb97d('0x2d')],qs['fields'](_0x4fd322[_0xb97d('0x2e')][_0xb97d('0x33')]));_0x127f55[_0xb97d('0x32')]=_0x127f55[_0xb97d('0x32')][_0xb97d('0x3f')]?_0x127f55[_0xb97d('0x32')]:_0xce0b29[_0xb97d('0x2d')];if(!_0x4fd322['query'][_0xb97d('0x54')]('nolimit')){_0x127f55[_0xb97d('0x1c')]=qs[_0xb97d('0x1c')](_0x4fd322[_0xb97d('0x2e')][_0xb97d('0x1c')]);_0x127f55[_0xb97d('0x1b')]=qs[_0xb97d('0x1b')](_0x4fd322[_0xb97d('0x2e')][_0xb97d('0x1b')]);}_0x127f55['order']=qs[_0xb97d('0x35')](_0x4fd322['query'][_0xb97d('0x35')]);_0x127f55[_0xb97d('0x36')]=qs[_0xb97d('0x30')](_[_0xb97d('0x55')](_0x4fd322[_0xb97d('0x2e')],_0xce0b29[_0xb97d('0x30')]));_0x127f55[_0xb97d('0x36')][_0xb97d('0x56')]=_0x5e4376['id'];if(_0x4fd322['query']['filter']){_0x127f55['where']=_[_0xb97d('0x38')](_0x127f55['where'],{'$or':_['map'](_0x127f55[_0xb97d('0x32')],function(_0x22262d){var _0x2e70df={};_0x2e70df[_0x22262d]={'$like':'%'+_0x4fd322[_0xb97d('0x2e')][_0xb97d('0x37')]+'%'};return _0x2e70df;})});}_0x127f55=_['merge']({},_0x127f55,_0x4fd322[_0xb97d('0x39')]);return db['JscriptySessionReport'][_0xb97d('0x1e')]({'where':_0x127f55[_0xb97d('0x36')]})[_0xb97d('0x21')](function(_0x5b77d2){_0x40675b['count']=_0x5b77d2;if(_0x4fd322[_0xb97d('0x2e')][_0xb97d('0x3b')]){_0x127f55[_0xb97d('0x3c')]=[{'all':!![]}];}return db[_0xb97d('0x53')][_0xb97d('0x3d')](_0x127f55);})[_0xb97d('0x21')](function(_0x1fa78a){_0x40675b['rows']=_0x1fa78a;return _0x40675b;});}})[_0xb97d('0x21')](respondWithFilteredResult(_0x1a0a11,_0x127f55))['catch'](handleError(_0x1a0a11,null));};exports[_0xb97d('0x57')]=function(_0x25c890,_0x1ff63a,_0x4ee1aa){var _0x536452={'raw':!![],'where':{}};var _0x26ede1={};var _0x1aaba7={'count':0x0,'rows':[]};return db[_0xb97d('0x3a')][_0xb97d('0x52')]({'where':{'id':_0x25c890[_0xb97d('0x4c')]['id']}})[_0xb97d('0x21')](handleEntityNotFound(_0x1ff63a,null))[_0xb97d('0x21')](function(_0x50d5c9){if(_0x50d5c9){_0x26ede1[_0xb97d('0x2d')]=_['keys'](db[_0xb97d('0x58')][_0xb97d('0x2a')]);_0x26ede1['query']=_[_0xb97d('0x2f')](_0x25c890['query']);_0x26ede1['filters']=_['intersection'](_0x26ede1[_0xb97d('0x2d')],_0x26ede1['query']);_0x536452[_0xb97d('0x32')]=_[_0xb97d('0x31')](_0x26ede1['model'],qs['fields'](_0x25c890[_0xb97d('0x2e')][_0xb97d('0x33')]));_0x536452[_0xb97d('0x32')]=_0x536452[_0xb97d('0x32')][_0xb97d('0x3f')]?_0x536452[_0xb97d('0x32')]:_0x26ede1[_0xb97d('0x2d')];if(!_0x25c890[_0xb97d('0x2e')][_0xb97d('0x54')](_0xb97d('0x34'))){_0x536452['limit']=qs[_0xb97d('0x1c')](_0x25c890[_0xb97d('0x2e')][_0xb97d('0x1c')]);_0x536452['offset']=qs['offset'](_0x25c890[_0xb97d('0x2e')][_0xb97d('0x1b')]);}_0x536452['order']=qs[_0xb97d('0x35')](_0x25c890[_0xb97d('0x2e')][_0xb97d('0x35')]);_0x536452[_0xb97d('0x36')]=qs['filters'](_[_0xb97d('0x55')](_0x25c890[_0xb97d('0x2e')],_0x26ede1[_0xb97d('0x30')]));_0x536452['where'][_0xb97d('0x56')]=_0x50d5c9['id'];if(_0x25c890['query']['filter']){_0x536452[_0xb97d('0x36')]=_['merge'](_0x536452[_0xb97d('0x36')],{'$or':_[_0xb97d('0x29')](_0x536452[_0xb97d('0x32')],function(_0x53e142){var _0x4d15ba={};_0x4d15ba[_0x53e142]={'$like':'%'+_0x25c890['query'][_0xb97d('0x37')]+'%'};return _0x4d15ba;})});}_0x536452=_[_0xb97d('0x38')]({},_0x536452,_0x25c890[_0xb97d('0x39')]);return db[_0xb97d('0x58')][_0xb97d('0x1e')]({'where':_0x536452[_0xb97d('0x36')]})['then'](function(_0x3d2f90){_0x1aaba7[_0xb97d('0x1e')]=_0x3d2f90;if(_0x25c890[_0xb97d('0x2e')][_0xb97d('0x3b')]){_0x536452['include']=[{'all':!![]}];}return db[_0xb97d('0x58')]['findAll'](_0x536452);})[_0xb97d('0x21')](function(_0x1b63f4){_0x1aaba7[_0xb97d('0x3e')]=_0x1b63f4;return _0x1aaba7;});}})[_0xb97d('0x21')](respondWithFilteredResult(_0x1ff63a,_0x536452))['catch'](handleError(_0x1ff63a,null));};function char(_0x3dbbf4){return _0xb97d('0x59')===typeof _0x3dbbf4?String[_0xb97d('0x5a')][_0xb97d('0x5b')](null,arguments):_0x3dbbf4;}function needsEncapsulation(_0x3743a0){return!!_0x3743a0&&(_0x3743a0[_0xb97d('0x5c')]()[_0xb97d('0x5d')](char(0xd))>=0x0||_0x3743a0[_0xb97d('0x5c')]()[_0xb97d('0x5d')](char(0xa))>=0x0||_0x3743a0['toString']()[_0xb97d('0x5d')](char(0x2c))>=0x0||_0x3743a0['toString']()[_0xb97d('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x5500e8){var _0x3b7ac7=char(0x22),_0x41cdf9='\x5c'+char(0x22),_0xba43b5=_0x5500e8[_0xb97d('0x5c')]()[_0xb97d('0x5e')](new RegExp(_0x3b7ac7,'g'),_0x41cdf9);return _0x3b7ac7+_0xba43b5+_0x3b7ac7;}exports['getSummary']=function(_0x4d1552,_0x1a5d85,_0x59a518){var _0x4aab4f,_0x57957a;var _0x6f0066={'where':{'ProjectId':_0x4d1552[_0xb97d('0x4c')]['id']}};if(_0x4d1552[_0xb97d('0x2e')]['startTime']){_0x6f0066[_0xb97d('0x36')][_0xb97d('0x5f')]=JSON['parse'](_0x4d1552[_0xb97d('0x2e')][_0xb97d('0x60')]);}return db[_0xb97d('0x53')][_0xb97d('0x3d')](_0x6f0066)[_0xb97d('0x21')](handleEntityNotFound(_0x1a5d85,null))[_0xb97d('0x21')](function(_0x537be3){if(_0x537be3){_0x4aab4f=_0x537be3;return db['JscriptyQuestionReport'][_0xb97d('0x3d')]({'where':{'SessionId':{'$in':_[_0xb97d('0x29')](_0x4aab4f,'id')},'ProjectId':_0x4d1552[_0xb97d('0x4c')]['id']},'order':_0xb97d('0x61')});}})[_0xb97d('0x21')](handleEntityNotFound(_0x1a5d85,null))[_0xb97d('0x21')](function(_0x41d537){if(_0x41d537){_0x57957a=_0x41d537;var _0x489ffa={};for(var _0x34d3d4=0x0,_0x3be837=_0x57957a[_0xb97d('0x3f')];_0x34d3d4<_0x3be837;_0x34d3d4++){if(!_0x489ffa[_0xb97d('0x54')](_0x57957a[_0x34d3d4][_0xb97d('0x62')])){_0x489ffa[_0x57957a[_0x34d3d4]['questionId']]=needsEncapsulation(_0x57957a[_0x34d3d4][_0xb97d('0x63')])?encapsulate(_0x57957a[_0x34d3d4]['question']):_0x57957a[_0x34d3d4][_0xb97d('0x63')];}}var _0x45176a=[],_0xdb6d22={};for(var _0x320a7d=0x0,_0x3876a8=_0x4aab4f[_0xb97d('0x3f')];_0x320a7d<_0x3876a8;_0x320a7d++){_0xdb6d22={'ProjectId':_0x4d1552[_0xb97d('0x4c')]['id'],'SessionId':_0x4aab4f[_0x320a7d]['id'],'StartTime':moment(_0x4aab4f[_0x320a7d][_0xb97d('0x5f')])[_0xb97d('0x64')](_0xb97d('0x65'))};for(var _0xa9f55d=0x0,_0x3d28e9=_0x57957a[_0xb97d('0x3f')];_0xa9f55d<_0x3d28e9;_0xa9f55d++){if(_0x57957a[_0xa9f55d][_0xb97d('0x66')]==_0x4aab4f[_0x320a7d]['id']&&_0x489ffa['hasOwnProperty'](_0x57957a[_0xa9f55d][_0xb97d('0x62')])){_0xdb6d22[_0x489ffa[_0x57957a[_0xa9f55d][_0xb97d('0x62')]]]=_0x57957a[_0xa9f55d][_0xb97d('0x67')];}}for(var _0x1d389c in _0x489ffa){if(!_0xdb6d22['hasOwnProperty'](_0x489ffa[_0x1d389c])){_0xdb6d22[_0x489ffa[_0x1d389c]]=null;}}_0x45176a[_0xb97d('0x68')](_0xdb6d22);}return _0x45176a;}})[_0xb97d('0x21')](function(_0xb74d87){if(!_['isEmpty'](_0xb74d87)){var _0x30fd45=toCsv(_0xb74d87);var _0x3f9fb0=Date[_0xb97d('0x69')]();fs[_0xb97d('0x6a')](util[_0xb97d('0x64')](_0xb97d('0x6b'),_0x4d1552[_0xb97d('0x4c')]['id'],_0x3f9fb0),_0x30fd45);_0x1a5d85[_0xb97d('0x6c')](_0xb97d('0x6d'),_0xb97d('0x6e')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4d1552[_0xb97d('0x4c')]['id'],_0x3f9fb0));_0x1a5d85[_0xb97d('0x6c')](_0xb97d('0x6f'),_0xb97d('0x70'));return _0x1a5d85[_0xb97d('0x71')](util[_0xb97d('0x64')](_0xb97d('0x6b'),_0x4d1552[_0xb97d('0x4c')]['id'],_0x3f9fb0));}else{return _0x1a5d85[_0xb97d('0x18')](0xcc);}})[_0xb97d('0x4a')](handleError(_0x1a5d85,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dd9a3e8..dd21f54 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 _0x23d3=['../../config/environment','exports','define','jscripty_projects','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x23d3,0xe8));var _0x323d=function(_0x45a161,_0x15e34e){_0x45a161=_0x45a161-0x0;var _0x54de39=_0x23d3[_0x45a161];return _0x54de39;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var logger=require(_0x323d('0x2'))('api');var moment=require(_0x323d('0x3'));var BPromise=require(_0x323d('0x4'));var rp=require(_0x323d('0x5'));var fs=require('fs');var path=require(_0x323d('0x6'));var rimraf=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x323d('0x9')]=function(_0x34f513,_0x160a18){return _0x34f513[_0x323d('0xa')]('JscriptyProject',attributes,{'tableName':_0x323d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3645=['JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x5b66f8,_0xabd783){var _0x25e421=function(_0x1ddac0){while(--_0x1ddac0){_0x5b66f8['push'](_0x5b66f8['shift']());}};_0x25e421(++_0xabd783);}(_0x3645,0x154));var _0x5364=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0x3645[_0x1e7345];return _0x33017c;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var logger=require(_0x5364('0x1'))(_0x5364('0x2'));var moment=require(_0x5364('0x3'));var BPromise=require(_0x5364('0x4'));var rp=require(_0x5364('0x5'));var fs=require('fs');var path=require(_0x5364('0x6'));var rimraf=require('rimraf');var config=require(_0x5364('0x7'));var attributes=require(_0x5364('0x8'));module[_0x5364('0x9')]=function(_0x1f9c6b,_0x417c44){return _0x1f9c6b[_0x5364('0xa')](_0x5364('0xb'),attributes,{'tableName':_0x5364('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 866ffc9..eadd645 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x77d513,_0xf0775b){var _0x5a0853=function(_0x445c91){while(--_0x445c91){_0x77d513['push'](_0x77d513['shift']());}};_0x5a0853(++_0xf0775b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0xbdb7[_0x51c39f];return _0x274221;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5856ecd..c07dbb4 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 _0xa443=['index','describe','/:id','show','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x4e2240,_0x47e093){var _0x18a33f=function(_0x27bd55){while(--_0x27bd55){_0x4e2240['push'](_0x4e2240['shift']());}};_0x18a33f(++_0x47e093);}(_0xa443,0xc7));var _0x3a44=function(_0x4e81eb,_0x1a1e7c){_0x4e81eb=_0x4e81eb-0x0;var _0x4f52e3=_0xa443[_0x4e81eb];return _0x4f52e3;};'use strict';var multer=require(_0x3a44('0x0'));var util=require(_0x3a44('0x1'));var path=require(_0x3a44('0x2'));var timeout=require(_0x3a44('0x3'));var express=require(_0x3a44('0x4'));var router=express[_0x3a44('0x5')]();var fs_extra=require(_0x3a44('0x6'));var auth=require(_0x3a44('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3a44('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x3a44('0x9')]('/',auth['isAuthenticated'](),controller[_0x3a44('0xa')]);router[_0x3a44('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3a44('0xb')]);router[_0x3a44('0x9')](_0x3a44('0xc'),auth['isAuthenticated'](),controller[_0x3a44('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3a44('0xe')](_0x3a44('0xc'),auth['isAuthenticated'](),controller[_0x3a44('0xf')]);router[_0x3a44('0x10')](_0x3a44('0xc'),auth[_0x3a44('0x11')](),controller[_0x3a44('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1459=['isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x357d69,_0xf80d4d){var _0x3182e9=function(_0x180ba3){while(--_0x180ba3){_0x357d69['push'](_0x357d69['shift']());}};_0x3182e9(++_0xf80d4d);}(_0x1459,0x135));var _0x9145=function(_0x537e5a,_0xb3ef91){_0x537e5a=_0x537e5a-0x0;var _0x142374=_0x1459[_0x537e5a];return _0x142374;};'use strict';var multer=require(_0x9145('0x0'));var util=require('util');var path=require(_0x9145('0x1'));var timeout=require(_0x9145('0x2'));var express=require('express');var router=express[_0x9145('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9145('0x4'));var interaction=require(_0x9145('0x5'));var config=require(_0x9145('0x6'));var controller=require(_0x9145('0x7'));router[_0x9145('0x8')]('/',auth['isAuthenticated'](),controller[_0x9145('0x9')]);router[_0x9145('0x8')](_0x9145('0xa'),auth[_0x9145('0xb')](),controller[_0x9145('0xc')]);router['get'](_0x9145('0xd'),auth[_0x9145('0xb')](),controller[_0x9145('0xe')]);router[_0x9145('0xf')]('/',auth[_0x9145('0xb')](),controller[_0x9145('0x10')]);router[_0x9145('0x11')](_0x9145('0xd'),auth[_0x9145('0xb')](),controller['update']);router['delete']('/:id',auth[_0x9145('0xb')](),controller[_0x9145('0x12')]);module[_0x9145('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a85410c..567697a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x22e1ec,_0x4b485e){_0x22e1ec=_0x22e1ec-0x0;var _0x3c0217=_0x7a54[_0x22e1ec];return _0x3c0217;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0xce5bc9,_0x588886){_0xce5bc9=_0xce5bc9-0x0;var _0x3196b9=_0x7a54[_0xce5bc9];return _0x3196b9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index dd9a2ed..03df0c6 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 _0x9ae7=['../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','end','sendStatus','error','name','send','JscriptyQuestionReport','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','show','rawAttributes','include','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e343c,_0x5d5c6a){var _0x497243=function(_0x49bcda){while(--_0x49bcda){_0x5e343c['push'](_0x5e343c['shift']());}};_0x497243(++_0x5d5c6a);}(_0x9ae7,0x106));var _0x79ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ae7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x79ae('0x0'));var rimraf=require(_0x79ae('0x1'));var zipdir=require(_0x79ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x79ae('0x3'));var BPromise=require(_0x79ae('0x4'));var Mustache=require(_0x79ae('0x5'));var util=require(_0x79ae('0x6'));var path=require(_0x79ae('0x7'));var sox=require(_0x79ae('0x8'));var csv=require('to-csv');var ejs=require(_0x79ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79ae('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x79ae('0xb'));var deskjs=require(_0x79ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x79ae('0xd'));var Papa=require(_0x79ae('0xe'));var Redis=require(_0x79ae('0xf'));var authService=require(_0x79ae('0x10'));var qs=require(_0x79ae('0x11'));var as=require(_0x79ae('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x79ae('0x13'));var licenseUtil=require(_0x79ae('0x14'));var db=require(_0x79ae('0x15'))['db'];function respondWithStatusCode(_0x5c3b64,_0x2ccd71){_0x2ccd71=_0x2ccd71||0xcc;return function(_0xfbdf7e){if(_0xfbdf7e){return _0x5c3b64['sendStatus'](_0x2ccd71);}return _0x5c3b64['status'](_0x2ccd71)['end']();};}function respondWithResult(_0x3ed94c,_0x963d6e){_0x963d6e=_0x963d6e||0xc8;return function(_0x4bd8e5){if(_0x4bd8e5){return _0x3ed94c[_0x79ae('0x16')](_0x963d6e)[_0x79ae('0x17')](_0x4bd8e5);}};}function respondWithFilteredResult(_0x5aa118,_0x3d6250){return function(_0x352e6e){if(_0x352e6e){var _0x415280=typeof _0x3d6250[_0x79ae('0x18')]===_0x79ae('0x19')&&typeof _0x3d6250[_0x79ae('0x1a')]===_0x79ae('0x19');var _0x960eaa=_0x352e6e[_0x79ae('0x1b')];var _0x49637a=_0x415280?0x0:_0x3d6250[_0x79ae('0x18')];var _0x5c526c=_0x415280?_0x352e6e[_0x79ae('0x1b')]:_0x3d6250[_0x79ae('0x18')]+_0x3d6250['limit'];var _0x288af4;if(_0x5c526c>=_0x960eaa){_0x5c526c=_0x960eaa;_0x288af4=0xc8;}else{_0x288af4=0xce;}_0x5aa118[_0x79ae('0x16')](_0x288af4);return _0x5aa118[_0x79ae('0x1c')](_0x79ae('0x1d'),_0x49637a+'-'+_0x5c526c+'/'+_0x960eaa)['json'](_0x352e6e);}return null;};}function patchUpdates(_0xc15860){return function(_0x372df3){try{jsonpatch[_0x79ae('0x1e')](_0x372df3,_0xc15860,!![]);}catch(_0x258fc8){return BPromise[_0x79ae('0x1f')](_0x258fc8);}return _0x372df3[_0x79ae('0x20')]();};}function saveUpdates(_0x24dbd6,_0x1224f5){return function(_0x44b802){if(_0x44b802){return _0x44b802['update'](_0x24dbd6)['then'](function(_0x30edc7){return _0x30edc7;});}return null;};}function removeEntity(_0x387232,_0x2f1bd4){return function(_0x162503){if(_0x162503){return _0x162503['destroy']()['then'](function(){_0x387232[_0x79ae('0x16')](0xcc)[_0x79ae('0x21')]();});}};}function handleEntityNotFound(_0x2bf217,_0xd70713){return function(_0x55b51b){if(!_0x55b51b){_0x2bf217[_0x79ae('0x22')](0x194);}return _0x55b51b;};}function handleError(_0x345dfa,_0x418352){_0x418352=_0x418352||0x1f4;return function(_0x520b3f){logger[_0x79ae('0x23')](_0x520b3f['stack']);if(_0x520b3f[_0x79ae('0x24')]){delete _0x520b3f[_0x79ae('0x24')];}_0x345dfa['status'](_0x418352)[_0x79ae('0x25')](_0x520b3f);};}exports['index']=function(_0x106205,_0x36da09){var _0x1e93b6={},_0x49be9b={},_0x17da6f={'count':0x0,'rows':[]};var _0x2fdf35=_['map'](db[_0x79ae('0x26')]['rawAttributes'],function(_0x354785){return{'name':_0x354785[_0x79ae('0x27')],'type':_0x354785['type'][_0x79ae('0x28')]};});_0x49be9b['model']=_[_0x79ae('0x29')](_0x2fdf35,'name');_0x49be9b[_0x79ae('0x2a')]=_[_0x79ae('0x2b')](_0x106205[_0x79ae('0x2a')]);_0x49be9b[_0x79ae('0x2c')]=_[_0x79ae('0x2d')](_0x49be9b['model'],_0x49be9b['query']);_0x1e93b6[_0x79ae('0x2e')]=_[_0x79ae('0x2d')](_0x49be9b[_0x79ae('0x2f')],qs[_0x79ae('0x30')](_0x106205[_0x79ae('0x2a')][_0x79ae('0x30')]));_0x1e93b6[_0x79ae('0x2e')]=_0x1e93b6[_0x79ae('0x2e')][_0x79ae('0x31')]?_0x1e93b6['attributes']:_0x49be9b[_0x79ae('0x2f')];if(!_0x106205[_0x79ae('0x2a')][_0x79ae('0x32')]('nolimit')){_0x1e93b6[_0x79ae('0x1a')]=qs[_0x79ae('0x1a')](_0x106205[_0x79ae('0x2a')]['limit']);_0x1e93b6['offset']=qs['offset'](_0x106205[_0x79ae('0x2a')]['offset']);}_0x1e93b6['order']=qs['sort'](_0x106205[_0x79ae('0x2a')][_0x79ae('0x33')]);_0x1e93b6[_0x79ae('0x34')]=qs['filters'](_[_0x79ae('0x35')](_0x106205['query'],_0x49be9b['filters']),_0x2fdf35);if(_0x106205[_0x79ae('0x2a')][_0x79ae('0x36')]){_0x1e93b6[_0x79ae('0x34')]=_[_0x79ae('0x37')](_0x1e93b6[_0x79ae('0x34')],{'$or':_['map'](_0x2fdf35,function(_0x1eeb2b){if(_0x1eeb2b['type']!==_0x79ae('0x38')){var _0x2383a1={};_0x2383a1[_0x1eeb2b['name']]={'$like':'%'+_0x106205[_0x79ae('0x2a')]['filter']+'%'};return _0x2383a1;}})});}_0x1e93b6=_['merge']({},_0x1e93b6,_0x106205[_0x79ae('0x39')]);var _0x3aa4a8={'where':_0x1e93b6[_0x79ae('0x34')]};return db['JscriptyQuestionReport'][_0x79ae('0x1b')](_0x3aa4a8)[_0x79ae('0x3a')](function(_0x1cb1b6){_0x17da6f['count']=_0x1cb1b6;if(_0x106205['query'][_0x79ae('0x3b')]){_0x1e93b6['include']=[{'all':!![]}];}return db[_0x79ae('0x26')]['findAll'](_0x1e93b6);})[_0x79ae('0x3a')](function(_0x52c93a){_0x17da6f[_0x79ae('0x3c')]=_0x52c93a;return _0x17da6f;})[_0x79ae('0x3a')](respondWithFilteredResult(_0x36da09,_0x1e93b6))['catch'](handleError(_0x36da09,null));};exports[_0x79ae('0x3d')]=function(_0x3bbe6b,_0x455f75){var _0x177794={'raw':!![],'where':{'id':_0x3bbe6b['params']['id']}},_0x402a1e={};_0x402a1e[_0x79ae('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x79ae('0x3e')]);_0x402a1e[_0x79ae('0x2a')]=_[_0x79ae('0x2b')](_0x3bbe6b[_0x79ae('0x2a')]);_0x402a1e[_0x79ae('0x2c')]=_[_0x79ae('0x2d')](_0x402a1e['model'],_0x402a1e[_0x79ae('0x2a')]);_0x177794[_0x79ae('0x2e')]=_['intersection'](_0x402a1e[_0x79ae('0x2f')],qs[_0x79ae('0x30')](_0x3bbe6b[_0x79ae('0x2a')]['fields']));_0x177794[_0x79ae('0x2e')]=_0x177794[_0x79ae('0x2e')]['length']?_0x177794[_0x79ae('0x2e')]:_0x402a1e['model'];if(_0x3bbe6b[_0x79ae('0x2a')][_0x79ae('0x3b')]){_0x177794[_0x79ae('0x3f')]=[{'all':!![]}];}_0x177794=_[_0x79ae('0x37')]({},_0x177794,_0x3bbe6b[_0x79ae('0x39')]);return db['JscriptyQuestionReport'][_0x79ae('0x40')](_0x177794)[_0x79ae('0x3a')](handleEntityNotFound(_0x455f75,null))[_0x79ae('0x3a')](respondWithResult(_0x455f75,null))['catch'](handleError(_0x455f75,null));};exports[_0x79ae('0x41')]=function(_0x34235f,_0x25fedf){return db['JscriptyQuestionReport']['create'](_0x34235f['body'],{})['then'](respondWithResult(_0x25fedf,0xc9))[_0x79ae('0x42')](handleError(_0x25fedf,null));};exports[_0x79ae('0x43')]=function(_0x384319,_0x198c46){if(_0x384319[_0x79ae('0x44')]['id']){delete _0x384319[_0x79ae('0x44')]['id'];}return db[_0x79ae('0x26')][_0x79ae('0x40')]({'where':{'id':_0x384319['params']['id']}})[_0x79ae('0x3a')](handleEntityNotFound(_0x198c46,null))[_0x79ae('0x3a')](saveUpdates(_0x384319[_0x79ae('0x44')],null))[_0x79ae('0x3a')](respondWithResult(_0x198c46,null))[_0x79ae('0x42')](handleError(_0x198c46,null));};exports['destroy']=function(_0x79eac3,_0x165864){return db['JscriptyQuestionReport'][_0x79ae('0x40')]({'where':{'id':_0x79eac3['params']['id']}})[_0x79ae('0x3a')](handleEntityNotFound(_0x165864,null))['then'](removeEntity(_0x165864,null))[_0x79ae('0x42')](handleError(_0x165864,null));};exports['describe']=function(_0x56eb7a,_0x4c1885){return db[_0x79ae('0x26')][_0x79ae('0x45')]()['then'](respondWithResult(_0x4c1885,null))[_0x79ae('0x42')](handleError(_0x4c1885,null));}; \ No newline at end of file +var _0x86df=['nolimit','order','sort','pick','filter','merge','where','type','includeAll','include','findAll','rows','catch','params','keys','intersection','options','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','filters','model','fields','attributes','length','hasOwnProperty'];(function(_0x22ed4b,_0x20609c){var _0x4e9cf6=function(_0x3a2de1){while(--_0x3a2de1){_0x22ed4b['push'](_0x22ed4b['shift']());}};_0x4e9cf6(++_0x20609c);}(_0x86df,0x14a));var _0xf86d=function(_0x39eaf1,_0x56f6b9){_0x39eaf1=_0x39eaf1-0x0;var _0x116705=_0x86df[_0x39eaf1];return _0x116705;};'use strict';var emlformat=require(_0xf86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf86d('0x1'));var rp=require(_0xf86d('0x2'));var moment=require(_0xf86d('0x3'));var BPromise=require(_0xf86d('0x4'));var Mustache=require(_0xf86d('0x5'));var util=require(_0xf86d('0x6'));var path=require(_0xf86d('0x7'));var sox=require(_0xf86d('0x8'));var csv=require(_0xf86d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf86d('0xa'));var _=require(_0xf86d('0xb'));var squel=require(_0xf86d('0xc'));var crypto=require(_0xf86d('0xd'));var jsforce=require(_0xf86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf86d('0x9'));var querystring=require(_0xf86d('0xf'));var Papa=require('papaparse');var Redis=require(_0xf86d('0x10'));var authService=require(_0xf86d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf86d('0x12'));var logger=require(_0xf86d('0x13'))('api');var utils=require(_0xf86d('0x14'));var config=require(_0xf86d('0x15'));var licenseUtil=require(_0xf86d('0x16'));var db=require(_0xf86d('0x17'))['db'];function respondWithStatusCode(_0x57a0d2,_0x5f121d){_0x5f121d=_0x5f121d||0xcc;return function(_0x67000a){if(_0x67000a){return _0x57a0d2[_0xf86d('0x18')](_0x5f121d);}return _0x57a0d2['status'](_0x5f121d)[_0xf86d('0x19')]();};}function respondWithResult(_0x5317bc,_0x60a3f8){_0x60a3f8=_0x60a3f8||0xc8;return function(_0x3e1121){if(_0x3e1121){return _0x5317bc[_0xf86d('0x1a')](_0x60a3f8)[_0xf86d('0x1b')](_0x3e1121);}};}function respondWithFilteredResult(_0x26eb63,_0x4aed10){return function(_0x3aedcc){if(_0x3aedcc){var _0x407e06=typeof _0x4aed10[_0xf86d('0x1c')]==='undefined'&&typeof _0x4aed10[_0xf86d('0x1d')]==='undefined';var _0x358729=_0x3aedcc[_0xf86d('0x1e')];var _0x4f09e3=_0x407e06?0x0:_0x4aed10[_0xf86d('0x1c')];var _0x4c12a9=_0x407e06?_0x3aedcc['count']:_0x4aed10[_0xf86d('0x1c')]+_0x4aed10[_0xf86d('0x1d')];var _0x77b40;if(_0x4c12a9>=_0x358729){_0x4c12a9=_0x358729;_0x77b40=0xc8;}else{_0x77b40=0xce;}_0x26eb63['status'](_0x77b40);return _0x26eb63[_0xf86d('0x1f')](_0xf86d('0x20'),_0x4f09e3+'-'+_0x4c12a9+'/'+_0x358729)[_0xf86d('0x1b')](_0x3aedcc);}return null;};}function patchUpdates(_0x3cf37c){return function(_0x249dee){try{jsonpatch[_0xf86d('0x21')](_0x249dee,_0x3cf37c,!![]);}catch(_0x4613e5){return BPromise[_0xf86d('0x22')](_0x4613e5);}return _0x249dee[_0xf86d('0x23')]();};}function saveUpdates(_0x3e36e6,_0x321284){return function(_0xd16cd8){if(_0xd16cd8){return _0xd16cd8['update'](_0x3e36e6)[_0xf86d('0x24')](function(_0x4a37af){return _0x4a37af;});}return null;};}function removeEntity(_0x17561b,_0x1a7652){return function(_0x27d057){if(_0x27d057){return _0x27d057[_0xf86d('0x25')]()[_0xf86d('0x24')](function(){_0x17561b[_0xf86d('0x1a')](0xcc)[_0xf86d('0x19')]();});}};}function handleEntityNotFound(_0x28df8c,_0x3b2451){return function(_0xdd7f20){if(!_0xdd7f20){_0x28df8c['sendStatus'](0x194);}return _0xdd7f20;};}function handleError(_0x216397,_0xad8f58){_0xad8f58=_0xad8f58||0x1f4;return function(_0x5df3fc){logger[_0xf86d('0x26')](_0x5df3fc[_0xf86d('0x27')]);if(_0x5df3fc['name']){delete _0x5df3fc[_0xf86d('0x28')];}_0x216397[_0xf86d('0x1a')](_0xad8f58)[_0xf86d('0x29')](_0x5df3fc);};}exports[_0xf86d('0x2a')]=function(_0x584eb1,_0xb098ed){var _0x4bfdf2={},_0x22a281={},_0x167205={'count':0x0,'rows':[]};var _0xcb3e11=_[_0xf86d('0x2b')](db[_0xf86d('0x2c')][_0xf86d('0x2d')],function(_0x357d6c){return{'name':_0x357d6c[_0xf86d('0x2e')],'type':_0x357d6c['type'][_0xf86d('0x2f')]};});_0x22a281['model']=_['map'](_0xcb3e11,_0xf86d('0x28'));_0x22a281[_0xf86d('0x30')]=_['keys'](_0x584eb1[_0xf86d('0x30')]);_0x22a281[_0xf86d('0x31')]=_['intersection'](_0x22a281[_0xf86d('0x32')],_0x22a281['query']);_0x4bfdf2['attributes']=_['intersection'](_0x22a281['model'],qs[_0xf86d('0x33')](_0x584eb1[_0xf86d('0x30')][_0xf86d('0x33')]));_0x4bfdf2[_0xf86d('0x34')]=_0x4bfdf2['attributes'][_0xf86d('0x35')]?_0x4bfdf2[_0xf86d('0x34')]:_0x22a281[_0xf86d('0x32')];if(!_0x584eb1[_0xf86d('0x30')][_0xf86d('0x36')](_0xf86d('0x37'))){_0x4bfdf2[_0xf86d('0x1d')]=qs[_0xf86d('0x1d')](_0x584eb1[_0xf86d('0x30')][_0xf86d('0x1d')]);_0x4bfdf2['offset']=qs[_0xf86d('0x1c')](_0x584eb1[_0xf86d('0x30')][_0xf86d('0x1c')]);}_0x4bfdf2[_0xf86d('0x38')]=qs[_0xf86d('0x39')](_0x584eb1[_0xf86d('0x30')][_0xf86d('0x39')]);_0x4bfdf2['where']=qs['filters'](_[_0xf86d('0x3a')](_0x584eb1[_0xf86d('0x30')],_0x22a281[_0xf86d('0x31')]),_0xcb3e11);if(_0x584eb1[_0xf86d('0x30')][_0xf86d('0x3b')]){_0x4bfdf2['where']=_[_0xf86d('0x3c')](_0x4bfdf2[_0xf86d('0x3d')],{'$or':_[_0xf86d('0x2b')](_0xcb3e11,function(_0x3d6aad){if(_0x3d6aad[_0xf86d('0x3e')]!=='VIRTUAL'){var _0x47d8e6={};_0x47d8e6[_0x3d6aad[_0xf86d('0x28')]]={'$like':'%'+_0x584eb1[_0xf86d('0x30')][_0xf86d('0x3b')]+'%'};return _0x47d8e6;}})});}_0x4bfdf2=_[_0xf86d('0x3c')]({},_0x4bfdf2,_0x584eb1['options']);var _0x29e4b8={'where':_0x4bfdf2[_0xf86d('0x3d')]};return db['JscriptyQuestionReport']['count'](_0x29e4b8)[_0xf86d('0x24')](function(_0x23cd38){_0x167205['count']=_0x23cd38;if(_0x584eb1['query'][_0xf86d('0x3f')]){_0x4bfdf2[_0xf86d('0x40')]=[{'all':!![]}];}return db[_0xf86d('0x2c')][_0xf86d('0x41')](_0x4bfdf2);})[_0xf86d('0x24')](function(_0x5508b8){_0x167205[_0xf86d('0x42')]=_0x5508b8;return _0x167205;})[_0xf86d('0x24')](respondWithFilteredResult(_0xb098ed,_0x4bfdf2))[_0xf86d('0x43')](handleError(_0xb098ed,null));};exports['show']=function(_0x20d8d4,_0x1fec37){var _0x3b5ea0={'raw':!![],'where':{'id':_0x20d8d4[_0xf86d('0x44')]['id']}},_0x3413e7={};_0x3413e7[_0xf86d('0x32')]=_[_0xf86d('0x45')](db[_0xf86d('0x2c')]['rawAttributes']);_0x3413e7[_0xf86d('0x30')]=_[_0xf86d('0x45')](_0x20d8d4[_0xf86d('0x30')]);_0x3413e7['filters']=_[_0xf86d('0x46')](_0x3413e7[_0xf86d('0x32')],_0x3413e7[_0xf86d('0x30')]);_0x3b5ea0['attributes']=_['intersection'](_0x3413e7[_0xf86d('0x32')],qs['fields'](_0x20d8d4[_0xf86d('0x30')][_0xf86d('0x33')]));_0x3b5ea0[_0xf86d('0x34')]=_0x3b5ea0['attributes']['length']?_0x3b5ea0['attributes']:_0x3413e7[_0xf86d('0x32')];if(_0x20d8d4[_0xf86d('0x30')][_0xf86d('0x3f')]){_0x3b5ea0[_0xf86d('0x40')]=[{'all':!![]}];}_0x3b5ea0=_[_0xf86d('0x3c')]({},_0x3b5ea0,_0x20d8d4[_0xf86d('0x47')]);return db[_0xf86d('0x2c')][_0xf86d('0x48')](_0x3b5ea0)[_0xf86d('0x24')](handleEntityNotFound(_0x1fec37,null))[_0xf86d('0x24')](respondWithResult(_0x1fec37,null))['catch'](handleError(_0x1fec37,null));};exports['create']=function(_0x541d6a,_0x5d5f98){return db[_0xf86d('0x2c')][_0xf86d('0x49')](_0x541d6a[_0xf86d('0x4a')],{})[_0xf86d('0x24')](respondWithResult(_0x5d5f98,0xc9))[_0xf86d('0x43')](handleError(_0x5d5f98,null));};exports[_0xf86d('0x4b')]=function(_0x11064c,_0x2e2844){if(_0x11064c[_0xf86d('0x4a')]['id']){delete _0x11064c[_0xf86d('0x4a')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x11064c[_0xf86d('0x44')]['id']}})[_0xf86d('0x24')](handleEntityNotFound(_0x2e2844,null))[_0xf86d('0x24')](saveUpdates(_0x11064c[_0xf86d('0x4a')],null))['then'](respondWithResult(_0x2e2844,null))['catch'](handleError(_0x2e2844,null));};exports['destroy']=function(_0x199e65,_0x2269f6){return db[_0xf86d('0x2c')][_0xf86d('0x48')]({'where':{'id':_0x199e65[_0xf86d('0x44')]['id']}})[_0xf86d('0x24')](handleEntityNotFound(_0x2269f6,null))['then'](removeEntity(_0x2269f6,null))[_0xf86d('0x43')](handleError(_0x2269f6,null));};exports[_0xf86d('0x4c')]=function(_0x4c50c2,_0x247b71){return db[_0xf86d('0x2c')][_0xf86d('0x4c')]()[_0xf86d('0x24')](respondWithResult(_0x247b71,null))[_0xf86d('0x43')](handleError(_0x247b71,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3b519b0..02f1076 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 _0xa02f=['rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5eb685,_0x22a871){var _0x58de9a=function(_0x119a9b){while(--_0x119a9b){_0x5eb685['push'](_0x5eb685['shift']());}};_0x58de9a(++_0x22a871);}(_0xa02f,0x131));var _0xfa02=function(_0x2d4ebb,_0x507cf4){_0x2d4ebb=_0x2d4ebb-0x0;var _0x31f741=_0xa02f[_0x2d4ebb];return _0x31f741;};'use strict';var _=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var logger=require(_0xfa02('0x2'))(_0xfa02('0x3'));var moment=require(_0xfa02('0x4'));var BPromise=require(_0xfa02('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa02('0x6'));var rimraf=require(_0xfa02('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa02('0x8'));module[_0xfa02('0x9')]=function(_0xa5db51,_0x4dbdd1){return _0xa5db51[_0xfa02('0xa')](_0xfa02('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fa=['request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x72fa,0x19f));var _0xa72f=function(_0x2e5f03,_0x45b348){_0x2e5f03=_0x2e5f03-0x0;var _0x39c200=_0x72fa[_0x2e5f03];return _0x39c200;};'use strict';var _=require(_0xa72f('0x0'));var util=require('util');var logger=require(_0xa72f('0x1'))(_0xa72f('0x2'));var moment=require(_0xa72f('0x3'));var BPromise=require(_0xa72f('0x4'));var rp=require(_0xa72f('0x5'));var fs=require('fs');var path=require(_0xa72f('0x6'));var rimraf=require(_0xa72f('0x7'));var config=require('../../config/environment');var attributes=require(_0xa72f('0x8'));module[_0xa72f('0x9')]=function(_0xde8621,_0x466e41){return _0xde8621[_0xa72f('0xa')](_0xa72f('0xb'),attributes,{'tableName':'report_jscripty_questions','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 1b24ba5..19c6e16 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 _0x9d39=['client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5dd26c,_0x4636f9){var _0x37457e=function(_0x28e497){while(--_0x28e497){_0x5dd26c['push'](_0x5dd26c['shift']());}};_0x37457e(++_0x4636f9);}(_0x9d39,0xf4));var _0x99d3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9d39[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x99d3('0x0'));var util=require('util');var moment=require(_0x99d3('0x1'));var BPromise=require(_0x99d3('0x2'));var rs=require(_0x99d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99d3('0x4'))['db'];var utils=require(_0x99d3('0x5'));var logger=require(_0x99d3('0x6'))('rpc');var config=require(_0x99d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x99d3('0x8')][_0x99d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eb2f9,_0x4d5bb1,_0x550111){return new BPromise(function(_0x35a82b,_0x171ec6){return client[_0x99d3('0xa')](_0x3eb2f9,_0x550111)['then'](function(_0x26f54f){logger[_0x99d3('0xb')](_0x99d3('0xc'),_0x4d5bb1,_0x99d3('0xd'));logger[_0x99d3('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4d5bb1,_0x99d3('0xd'),JSON[_0x99d3('0xf')](_0x26f54f));if(_0x26f54f[_0x99d3('0x10')]){if(_0x26f54f[_0x99d3('0x10')][_0x99d3('0x11')]===0x1f4){logger[_0x99d3('0x10')](_0x99d3('0xc'),_0x4d5bb1,_0x26f54f[_0x99d3('0x10')][_0x99d3('0x12')]);return _0x171ec6(_0x26f54f[_0x99d3('0x10')][_0x99d3('0x12')]);}logger[_0x99d3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d5bb1,_0x26f54f[_0x99d3('0x10')][_0x99d3('0x12')]);return _0x35a82b(_0x26f54f[_0x99d3('0x10')]['message']);}else{logger[_0x99d3('0xb')](_0x99d3('0xc'),_0x4d5bb1,_0x99d3('0xd'));_0x35a82b(_0x26f54f[_0x99d3('0x13')][_0x99d3('0x12')]);}})[_0x99d3('0x14')](function(_0xde34e7){logger[_0x99d3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d5bb1,_0xde34e7);_0x171ec6(_0xde34e7);});});} \ No newline at end of file +var _0xd7e7=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment'];(function(_0x27802c,_0x526f93){var _0x526579=function(_0x57aa88){while(--_0x57aa88){_0x27802c['push'](_0x27802c['shift']());}};_0x526579(++_0x526f93);}(_0xd7e7,0x18e));var _0x7d7e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd7e7[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7d7e('0x0'));var util=require('util');var moment=require(_0x7d7e('0x1'));var BPromise=require(_0x7d7e('0x2'));var rs=require(_0x7d7e('0x3'));var fs=require('fs');var Redis=require(_0x7d7e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d7e('0x5'));var logger=require(_0x7d7e('0x6'))(_0x7d7e('0x7'));var config=require(_0x7d7e('0x8'));var jayson=require(_0x7d7e('0x9'));var client=jayson['client'][_0x7d7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130f32,_0xdba3b5,_0x5d209c){return new BPromise(function(_0x4f501d,_0x4b6ee8){return client[_0x7d7e('0xb')](_0x130f32,_0x5d209c)[_0x7d7e('0xc')](function(_0xfb393b){logger[_0x7d7e('0xd')](_0x7d7e('0xe'),_0xdba3b5,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xdba3b5,_0x7d7e('0xf'),JSON['stringify'](_0xfb393b));if(_0xfb393b[_0x7d7e('0x10')]){if(_0xfb393b[_0x7d7e('0x10')][_0x7d7e('0x11')]===0x1f4){logger[_0x7d7e('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xdba3b5,_0xfb393b[_0x7d7e('0x10')][_0x7d7e('0x12')]);return _0x4b6ee8(_0xfb393b[_0x7d7e('0x10')][_0x7d7e('0x12')]);}logger[_0x7d7e('0x10')](_0x7d7e('0xe'),_0xdba3b5,_0xfb393b[_0x7d7e('0x10')][_0x7d7e('0x12')]);return _0x4f501d(_0xfb393b[_0x7d7e('0x10')][_0x7d7e('0x12')]);}else{logger[_0x7d7e('0xd')](_0x7d7e('0xe'),_0xdba3b5,'request\x20sent');_0x4f501d(_0xfb393b['result']['message']);}})[_0x7d7e('0x13')](function(_0x498181){logger[_0x7d7e('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xdba3b5,_0x498181);_0x4b6ee8(_0x498181);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 90e911b..9888dd9 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 _0x508a=['/:id','show','getQuestions','put','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0x508a,0x1e2));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa508('0x0'));var util=require('util');var path=require(_0xa508('0x1'));var timeout=require('connect-timeout');var express=require(_0xa508('0x2'));var router=express[_0xa508('0x3')]();var fs_extra=require(_0xa508('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa508('0x5'));var config=require(_0xa508('0x6'));var controller=require(_0xa508('0x7'));router[_0xa508('0x8')]('/',auth[_0xa508('0x9')](),controller['index']);router[_0xa508('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa508('0xa')]);router[_0xa508('0x8')](_0xa508('0xb'),auth[_0xa508('0x9')](),controller[_0xa508('0xc')]);router[_0xa508('0x8')]('/:id/questions',auth[_0xa508('0x9')](),controller[_0xa508('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa508('0xe')]('/:id',auth[_0xa508('0x9')](),controller['update']);router[_0xa508('0xf')](_0xa508('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa508('0x10')]=router; \ No newline at end of file +var _0xd121=['getQuestions','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id/questions'];(function(_0x52c3f7,_0x340dbe){var _0x26c539=function(_0x1a4004){while(--_0x1a4004){_0x52c3f7['push'](_0x52c3f7['shift']());}};_0x26c539(++_0x340dbe);}(_0xd121,0x190));var _0x1d12=function(_0x13db41,_0x21e2f2){_0x13db41=_0x13db41-0x0;var _0x590f8e=_0xd121[_0x13db41];return _0x590f8e;};'use strict';var multer=require(_0x1d12('0x0'));var util=require(_0x1d12('0x1'));var path=require(_0x1d12('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d12('0x3'));var router=express[_0x1d12('0x4')]();var fs_extra=require(_0x1d12('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d12('0x6'));var config=require(_0x1d12('0x7'));var controller=require(_0x1d12('0x8'));router[_0x1d12('0x9')]('/',auth[_0x1d12('0xa')](),controller[_0x1d12('0xb')]);router[_0x1d12('0x9')]('/describe',auth[_0x1d12('0xa')](),controller[_0x1d12('0xc')]);router['get']('/:id',auth[_0x1d12('0xa')](),controller['show']);router['get'](_0x1d12('0xd'),auth[_0x1d12('0xa')](),controller[_0x1d12('0xe')]);router[_0x1d12('0xf')]('/',auth[_0x1d12('0xa')](),controller[_0x1d12('0x10')]);router[_0x1d12('0x11')]('/:id',auth[_0x1d12('0xa')](),controller[_0x1d12('0x12')]);router[_0x1d12('0x13')](_0x1d12('0x14'),auth[_0x1d12('0xa')](),controller[_0x1d12('0x15')]);module[_0x1d12('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 727255a..f356d26 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 _0xf1e9=['format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','moment','sequelize','exports','setDataValue','endtime'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf1e9,0x1ea));var _0x9f1e=function(_0x3f0700,_0x19f3ad){_0x3f0700=_0x3f0700-0x0;var _0x1662a9=_0xf1e9[_0x3f0700];return _0x1662a9;};'use strict';var moment=require(_0x9f1e('0x0'));var Sequelize=require(_0x9f1e('0x1'));module[_0x9f1e('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4ade5c){this[_0x9f1e('0x3')]('starttime',_0x4ade5c);this['setDataValue'](_0x9f1e('0x4'),moment()[_0x9f1e('0x5')](_0x9f1e('0x6')));}},'endtime':{'type':Sequelize[_0x9f1e('0x7')]},'membername':{'type':Sequelize[_0x9f1e('0x8')]},'projectname':{'type':Sequelize[_0x9f1e('0x8')]},'queue':{'type':Sequelize[_0x9f1e('0x8')]},'uniqueid':{'type':Sequelize[_0x9f1e('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9f1e('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6dad=['setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment'];(function(_0x59a3e9,_0x27fb38){var _0x5179ac=function(_0x5a9b1c){while(--_0x5a9b1c){_0x59a3e9['push'](_0x59a3e9['shift']());}};_0x5179ac(++_0x27fb38);}(_0x6dad,0x77));var _0xd6da=function(_0x3fdf3c,_0x424ca0){_0x3fdf3c=_0x3fdf3c-0x0;var _0x2118a3=_0x6dad[_0x3fdf3c];return _0x2118a3;};'use strict';var moment=require(_0xd6da('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x698ac0){this[_0xd6da('0x1')](_0xd6da('0x2'),_0x698ac0);this[_0xd6da('0x1')]('endtime',moment()[_0xd6da('0x3')](_0xd6da('0x4')));}},'endtime':{'type':Sequelize[_0xd6da('0x5')]},'membername':{'type':Sequelize[_0xd6da('0x6')]},'projectname':{'type':Sequelize[_0xd6da('0x6')]},'queue':{'type':Sequelize[_0xd6da('0x6')]},'uniqueid':{'type':Sequelize[_0xd6da('0x6')]},'calleridname':{'type':Sequelize[_0xd6da('0x6')]},'calleridnum':{'type':Sequelize[_0xd6da('0x6')]},'completed':{'type':Sequelize[_0xd6da('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 014631f..04c33ab 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 _0x8323=['fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','create','catch','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x8323,0x14d));var _0x3832=function(_0x18b60f,_0x331115){_0x18b60f=_0x18b60f-0x0;var _0x4bc451=_0x8323[_0x18b60f];return _0x4bc451;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3832('0x0'));var zipdir=require(_0x3832('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3832('0x2'));var moment=require(_0x3832('0x3'));var BPromise=require(_0x3832('0x4'));var Mustache=require('mustache');var util=require(_0x3832('0x5'));var path=require(_0x3832('0x6'));var sox=require(_0x3832('0x7'));var csv=require(_0x3832('0x8'));var ejs=require(_0x3832('0x9'));var fs=require('fs');var fs_extra=require(_0x3832('0xa'));var _=require(_0x3832('0xb'));var squel=require(_0x3832('0xc'));var crypto=require(_0x3832('0xd'));var jsforce=require(_0x3832('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3832('0x8'));var querystring=require('querystring');var Papa=require(_0x3832('0xf'));var Redis=require(_0x3832('0x10'));var authService=require(_0x3832('0x11'));var qs=require(_0x3832('0x12'));var as=require(_0x3832('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3832('0x14'));var utils=require('../../config/utils');var config=require(_0x3832('0x15'));var licenseUtil=require(_0x3832('0x16'));var db=require(_0x3832('0x17'))['db'];function respondWithStatusCode(_0x197319,_0x30e0fb){_0x30e0fb=_0x30e0fb||0xcc;return function(_0x180d5d){if(_0x180d5d){return _0x197319['sendStatus'](_0x30e0fb);}return _0x197319['status'](_0x30e0fb)[_0x3832('0x18')]();};}function respondWithResult(_0x1bfc1b,_0x537160){_0x537160=_0x537160||0xc8;return function(_0x14f1a5){if(_0x14f1a5){return _0x1bfc1b[_0x3832('0x19')](_0x537160)['json'](_0x14f1a5);}};}function respondWithFilteredResult(_0x21756d,_0x39fe9f){return function(_0x3b4aba){if(_0x3b4aba){var _0x28e4c7=typeof _0x39fe9f['offset']===_0x3832('0x1a')&&typeof _0x39fe9f[_0x3832('0x1b')]===_0x3832('0x1a');var _0x2a2640=_0x3b4aba[_0x3832('0x1c')];var _0x12436a=_0x28e4c7?0x0:_0x39fe9f['offset'];var _0x1d0836=_0x28e4c7?_0x3b4aba[_0x3832('0x1c')]:_0x39fe9f[_0x3832('0x1d')]+_0x39fe9f[_0x3832('0x1b')];var _0x1eca96;if(_0x1d0836>=_0x2a2640){_0x1d0836=_0x2a2640;_0x1eca96=0xc8;}else{_0x1eca96=0xce;}_0x21756d[_0x3832('0x19')](_0x1eca96);return _0x21756d[_0x3832('0x1e')](_0x3832('0x1f'),_0x12436a+'-'+_0x1d0836+'/'+_0x2a2640)['json'](_0x3b4aba);}return null;};}function patchUpdates(_0x682f54){return function(_0x23083a){try{jsonpatch[_0x3832('0x20')](_0x23083a,_0x682f54,!![]);}catch(_0x509dc3){return BPromise[_0x3832('0x21')](_0x509dc3);}return _0x23083a[_0x3832('0x22')]();};}function saveUpdates(_0x3ea47e,_0x146c5d){return function(_0x2624f5){if(_0x2624f5){return _0x2624f5['update'](_0x3ea47e)[_0x3832('0x23')](function(_0x41eacc){return _0x41eacc;});}return null;};}function removeEntity(_0x3acf88,_0x54a22f){return function(_0x46a9ed){if(_0x46a9ed){return _0x46a9ed[_0x3832('0x24')]()[_0x3832('0x23')](function(){_0x3acf88[_0x3832('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3933a9,_0x4ad19e){return function(_0x80f1d1){if(!_0x80f1d1){_0x3933a9[_0x3832('0x25')](0x194);}return _0x80f1d1;};}function handleError(_0x56c4db,_0x3e16de){_0x3e16de=_0x3e16de||0x1f4;return function(_0x17a3a6){logger[_0x3832('0x26')](_0x17a3a6[_0x3832('0x27')]);if(_0x17a3a6[_0x3832('0x28')]){delete _0x17a3a6[_0x3832('0x28')];}_0x56c4db[_0x3832('0x19')](_0x3e16de)['send'](_0x17a3a6);};}exports['index']=function(_0x400d99,_0xedec1c){var _0x37873c={},_0x3399f9={},_0x462454={'count':0x0,'rows':[]};var _0x5d03ab=_[_0x3832('0x29')](db[_0x3832('0x2a')][_0x3832('0x2b')],function(_0x41ebb5){return{'name':_0x41ebb5[_0x3832('0x2c')],'type':_0x41ebb5[_0x3832('0x2d')][_0x3832('0x2e')]};});_0x3399f9['model']=_[_0x3832('0x29')](_0x5d03ab,'name');_0x3399f9[_0x3832('0x2f')]=_[_0x3832('0x30')](_0x400d99[_0x3832('0x2f')]);_0x3399f9['filters']=_[_0x3832('0x31')](_0x3399f9['model'],_0x3399f9['query']);_0x37873c[_0x3832('0x32')]=_[_0x3832('0x31')](_0x3399f9[_0x3832('0x33')],qs[_0x3832('0x34')](_0x400d99['query'][_0x3832('0x34')]));_0x37873c[_0x3832('0x32')]=_0x37873c[_0x3832('0x32')][_0x3832('0x35')]?_0x37873c[_0x3832('0x32')]:_0x3399f9[_0x3832('0x33')];if(!_0x400d99[_0x3832('0x2f')][_0x3832('0x36')]('nolimit')){_0x37873c['limit']=qs['limit'](_0x400d99[_0x3832('0x2f')]['limit']);_0x37873c[_0x3832('0x1d')]=qs[_0x3832('0x1d')](_0x400d99[_0x3832('0x2f')]['offset']);}_0x37873c[_0x3832('0x37')]=qs[_0x3832('0x38')](_0x400d99['query'][_0x3832('0x38')]);_0x37873c[_0x3832('0x39')]=qs['filters'](_[_0x3832('0x3a')](_0x400d99[_0x3832('0x2f')],_0x3399f9[_0x3832('0x3b')]),_0x5d03ab);if(_0x400d99[_0x3832('0x2f')]['filter']){_0x37873c[_0x3832('0x39')]=_[_0x3832('0x3c')](_0x37873c[_0x3832('0x39')],{'$or':_[_0x3832('0x29')](_0x5d03ab,function(_0x29cb5d){if(_0x29cb5d[_0x3832('0x2d')]!==_0x3832('0x3d')){var _0x512086={};_0x512086[_0x29cb5d[_0x3832('0x28')]]={'$like':'%'+_0x400d99[_0x3832('0x2f')][_0x3832('0x3e')]+'%'};return _0x512086;}})});}_0x37873c=_[_0x3832('0x3c')]({},_0x37873c,_0x400d99[_0x3832('0x3f')]);var _0x3974b8={'where':_0x37873c[_0x3832('0x39')]};return db[_0x3832('0x2a')][_0x3832('0x1c')](_0x3974b8)[_0x3832('0x23')](function(_0x15aea9){_0x462454[_0x3832('0x1c')]=_0x15aea9;if(_0x400d99['query'][_0x3832('0x40')]){_0x37873c[_0x3832('0x41')]=[{'all':!![]}];}return db[_0x3832('0x2a')][_0x3832('0x42')](_0x37873c);})[_0x3832('0x23')](function(_0x536f8f){_0x462454['rows']=_0x536f8f;return _0x462454;})[_0x3832('0x23')](respondWithFilteredResult(_0xedec1c,_0x37873c))['catch'](handleError(_0xedec1c,null));};exports[_0x3832('0x43')]=function(_0x55d988,_0x352171){var _0x3a39a1={'raw':!![],'where':{'id':_0x55d988[_0x3832('0x44')]['id']}},_0x1b3a90={};_0x1b3a90[_0x3832('0x33')]=_[_0x3832('0x30')](db['JscriptySessionReport'][_0x3832('0x2b')]);_0x1b3a90[_0x3832('0x2f')]=_[_0x3832('0x30')](_0x55d988['query']);_0x1b3a90[_0x3832('0x3b')]=_['intersection'](_0x1b3a90[_0x3832('0x33')],_0x1b3a90['query']);_0x3a39a1[_0x3832('0x32')]=_[_0x3832('0x31')](_0x1b3a90['model'],qs[_0x3832('0x34')](_0x55d988[_0x3832('0x2f')][_0x3832('0x34')]));_0x3a39a1['attributes']=_0x3a39a1[_0x3832('0x32')][_0x3832('0x35')]?_0x3a39a1['attributes']:_0x1b3a90[_0x3832('0x33')];if(_0x55d988[_0x3832('0x2f')][_0x3832('0x40')]){_0x3a39a1['include']=[{'all':!![]}];}_0x3a39a1=_[_0x3832('0x3c')]({},_0x3a39a1,_0x55d988[_0x3832('0x3f')]);return db[_0x3832('0x2a')]['find'](_0x3a39a1)[_0x3832('0x23')](handleEntityNotFound(_0x352171,null))[_0x3832('0x23')](respondWithResult(_0x352171,null))['catch'](handleError(_0x352171,null));};exports[_0x3832('0x45')]=function(_0x4197ff,_0x5be694){return db[_0x3832('0x2a')]['create'](_0x4197ff['body'],{})[_0x3832('0x23')](respondWithResult(_0x5be694,0xc9))[_0x3832('0x46')](handleError(_0x5be694,null));};exports['update']=function(_0x2fe612,_0x51ea7f){if(_0x2fe612[_0x3832('0x47')]['id']){delete _0x2fe612[_0x3832('0x47')]['id'];}return db[_0x3832('0x2a')][_0x3832('0x48')]({'where':{'id':_0x2fe612['params']['id']}})[_0x3832('0x23')](handleEntityNotFound(_0x51ea7f,null))[_0x3832('0x23')](saveUpdates(_0x2fe612[_0x3832('0x47')],null))[_0x3832('0x23')](respondWithResult(_0x51ea7f,null))[_0x3832('0x46')](handleError(_0x51ea7f,null));};exports[_0x3832('0x24')]=function(_0x382e82,_0x6bb79f){return db[_0x3832('0x2a')]['find']({'where':{'id':_0x382e82[_0x3832('0x44')]['id']}})[_0x3832('0x23')](handleEntityNotFound(_0x6bb79f,null))[_0x3832('0x23')](removeEntity(_0x6bb79f,null))[_0x3832('0x46')](handleError(_0x6bb79f,null));};exports['describe']=function(_0x60f980,_0x55622c){return db[_0x3832('0x2a')][_0x3832('0x49')]()['then'](respondWithResult(_0x55622c,null))['catch'](handleError(_0x55622c,null));};exports[_0x3832('0x4a')]=function(_0x14049a,_0x47745f,_0x424ccb){var _0x432d23={'raw':!![],'where':{}};var _0x34b0a9={};var _0x51011a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3832('0x4b')]({'where':{'id':_0x14049a['params']['id']}})[_0x3832('0x23')](handleEntityNotFound(_0x47745f,null))[_0x3832('0x23')](function(_0x3185da){if(_0x3185da){_0x34b0a9[_0x3832('0x33')]=_[_0x3832('0x30')](db[_0x3832('0x4c')][_0x3832('0x2b')]);_0x34b0a9[_0x3832('0x2f')]=_[_0x3832('0x30')](_0x14049a[_0x3832('0x2f')]);_0x34b0a9['filters']=_[_0x3832('0x31')](_0x34b0a9[_0x3832('0x33')],_0x34b0a9[_0x3832('0x2f')]);_0x432d23[_0x3832('0x32')]=_[_0x3832('0x31')](_0x34b0a9[_0x3832('0x33')],qs[_0x3832('0x34')](_0x14049a[_0x3832('0x2f')]['fields']));_0x432d23[_0x3832('0x32')]=_0x432d23[_0x3832('0x32')]['length']?_0x432d23[_0x3832('0x32')]:_0x34b0a9[_0x3832('0x33')];if(!_0x14049a[_0x3832('0x2f')][_0x3832('0x36')]('nolimit')){_0x432d23['limit']=qs[_0x3832('0x1b')](_0x14049a['query'][_0x3832('0x1b')]);_0x432d23[_0x3832('0x1d')]=qs[_0x3832('0x1d')](_0x14049a['query']['offset']);}_0x432d23[_0x3832('0x37')]=qs[_0x3832('0x38')](_0x14049a[_0x3832('0x2f')][_0x3832('0x38')]);_0x432d23[_0x3832('0x39')]=qs[_0x3832('0x3b')](_[_0x3832('0x3a')](_0x14049a[_0x3832('0x2f')],_0x34b0a9[_0x3832('0x3b')]));_0x432d23[_0x3832('0x39')]['SessionId']=_0x3185da['id'];if(_0x14049a[_0x3832('0x2f')]['filter']){_0x432d23[_0x3832('0x39')]=_[_0x3832('0x3c')](_0x432d23[_0x3832('0x39')],{'$or':_[_0x3832('0x29')](_0x432d23[_0x3832('0x32')],function(_0x3a4db8){var _0x3880a2={};_0x3880a2[_0x3a4db8]={'$like':'%'+_0x14049a[_0x3832('0x2f')][_0x3832('0x3e')]+'%'};return _0x3880a2;})});}_0x432d23=_[_0x3832('0x3c')]({},_0x432d23,_0x14049a[_0x3832('0x3f')]);return db['JscriptyQuestionReport'][_0x3832('0x1c')]({'where':_0x432d23[_0x3832('0x39')]})[_0x3832('0x23')](function(_0x1c4696){_0x51011a['count']=_0x1c4696;if(_0x14049a[_0x3832('0x2f')]['includeAll']){_0x432d23['include']=[{'all':!![]}];}return db[_0x3832('0x4c')][_0x3832('0x42')](_0x432d23);})[_0x3832('0x23')](function(_0x1f5404){_0x51011a['rows']=_0x1f5404;return _0x51011a;});}})[_0x3832('0x23')](respondWithFilteredResult(_0x47745f,_0x432d23))['catch'](handleError(_0x47745f,null));}; \ No newline at end of file +var _0x9e25=['undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','map','merge','options','include','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9e25,0x17d));var _0x59e2=function(_0x50c0fc,_0x41acff){_0x50c0fc=_0x50c0fc-0x0;var _0x57196c=_0x9e25[_0x50c0fc];return _0x57196c;};'use strict';var emlformat=require(_0x59e2('0x0'));var rimraf=require(_0x59e2('0x1'));var zipdir=require(_0x59e2('0x2'));var jsonpatch=require(_0x59e2('0x3'));var rp=require('request-promise');var moment=require(_0x59e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59e2('0x5'));var util=require(_0x59e2('0x6'));var path=require(_0x59e2('0x7'));var sox=require(_0x59e2('0x8'));var csv=require(_0x59e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x59e2('0xa'));var _=require(_0x59e2('0xb'));var squel=require(_0x59e2('0xc'));var crypto=require(_0x59e2('0xd'));var jsforce=require(_0x59e2('0xe'));var deskjs=require(_0x59e2('0xf'));var toCsv=require(_0x59e2('0x9'));var querystring=require('querystring');var Papa=require(_0x59e2('0x10'));var Redis=require(_0x59e2('0x11'));var authService=require(_0x59e2('0x12'));var qs=require(_0x59e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59e2('0x14'));var logger=require('../../config/logger')(_0x59e2('0x15'));var utils=require(_0x59e2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x59e2('0x17'));var db=require(_0x59e2('0x18'))['db'];function respondWithStatusCode(_0xb7991,_0x387e0c){_0x387e0c=_0x387e0c||0xcc;return function(_0x44c02d){if(_0x44c02d){return _0xb7991[_0x59e2('0x19')](_0x387e0c);}return _0xb7991[_0x59e2('0x1a')](_0x387e0c)['end']();};}function respondWithResult(_0x5c75a0,_0x4ab1f9){_0x4ab1f9=_0x4ab1f9||0xc8;return function(_0x4aa89b){if(_0x4aa89b){return _0x5c75a0[_0x59e2('0x1a')](_0x4ab1f9)[_0x59e2('0x1b')](_0x4aa89b);}};}function respondWithFilteredResult(_0xbe6d7e,_0x581c6d){return function(_0x54ff8d){if(_0x54ff8d){var _0x417ee7=typeof _0x581c6d[_0x59e2('0x1c')]===_0x59e2('0x1d')&&typeof _0x581c6d[_0x59e2('0x1e')]==='undefined';var _0x5256e1=_0x54ff8d[_0x59e2('0x1f')];var _0x545f97=_0x417ee7?0x0:_0x581c6d['offset'];var _0x15f7b6=_0x417ee7?_0x54ff8d[_0x59e2('0x1f')]:_0x581c6d[_0x59e2('0x1c')]+_0x581c6d[_0x59e2('0x1e')];var _0x48a3ab;if(_0x15f7b6>=_0x5256e1){_0x15f7b6=_0x5256e1;_0x48a3ab=0xc8;}else{_0x48a3ab=0xce;}_0xbe6d7e[_0x59e2('0x1a')](_0x48a3ab);return _0xbe6d7e[_0x59e2('0x20')](_0x59e2('0x21'),_0x545f97+'-'+_0x15f7b6+'/'+_0x5256e1)[_0x59e2('0x1b')](_0x54ff8d);}return null;};}function patchUpdates(_0x5cb63f){return function(_0x3fb8ce){try{jsonpatch[_0x59e2('0x22')](_0x3fb8ce,_0x5cb63f,!![]);}catch(_0x598a8b){return BPromise[_0x59e2('0x23')](_0x598a8b);}return _0x3fb8ce[_0x59e2('0x24')]();};}function saveUpdates(_0x1f4e99,_0x1af01a){return function(_0x14bdeb){if(_0x14bdeb){return _0x14bdeb['update'](_0x1f4e99)[_0x59e2('0x25')](function(_0x10ace2){return _0x10ace2;});}return null;};}function removeEntity(_0x343b75,_0xb4ff55){return function(_0xe9f71){if(_0xe9f71){return _0xe9f71[_0x59e2('0x26')]()[_0x59e2('0x25')](function(){_0x343b75[_0x59e2('0x1a')](0xcc)[_0x59e2('0x27')]();});}};}function handleEntityNotFound(_0x77c4bb,_0x3d25d7){return function(_0x23b7a1){if(!_0x23b7a1){_0x77c4bb[_0x59e2('0x19')](0x194);}return _0x23b7a1;};}function handleError(_0x2830dc,_0x3f1277){_0x3f1277=_0x3f1277||0x1f4;return function(_0x16da73){logger['error'](_0x16da73['stack']);if(_0x16da73[_0x59e2('0x28')]){delete _0x16da73[_0x59e2('0x28')];}_0x2830dc[_0x59e2('0x1a')](_0x3f1277)[_0x59e2('0x29')](_0x16da73);};}exports[_0x59e2('0x2a')]=function(_0x56b8f2,_0x46af99){var _0x2a9fe0={},_0x141a8d={},_0x578da4={'count':0x0,'rows':[]};var _0x2286f3=_['map'](db[_0x59e2('0x2b')][_0x59e2('0x2c')],function(_0x2eddec){return{'name':_0x2eddec[_0x59e2('0x2d')],'type':_0x2eddec[_0x59e2('0x2e')][_0x59e2('0x2f')]};});_0x141a8d[_0x59e2('0x30')]=_['map'](_0x2286f3,_0x59e2('0x28'));_0x141a8d[_0x59e2('0x31')]=_['keys'](_0x56b8f2[_0x59e2('0x31')]);_0x141a8d[_0x59e2('0x32')]=_[_0x59e2('0x33')](_0x141a8d[_0x59e2('0x30')],_0x141a8d[_0x59e2('0x31')]);_0x2a9fe0[_0x59e2('0x34')]=_[_0x59e2('0x33')](_0x141a8d[_0x59e2('0x30')],qs[_0x59e2('0x35')](_0x56b8f2[_0x59e2('0x31')][_0x59e2('0x35')]));_0x2a9fe0[_0x59e2('0x34')]=_0x2a9fe0[_0x59e2('0x34')][_0x59e2('0x36')]?_0x2a9fe0[_0x59e2('0x34')]:_0x141a8d['model'];if(!_0x56b8f2[_0x59e2('0x31')][_0x59e2('0x37')]('nolimit')){_0x2a9fe0[_0x59e2('0x1e')]=qs[_0x59e2('0x1e')](_0x56b8f2[_0x59e2('0x31')][_0x59e2('0x1e')]);_0x2a9fe0[_0x59e2('0x1c')]=qs[_0x59e2('0x1c')](_0x56b8f2['query']['offset']);}_0x2a9fe0[_0x59e2('0x38')]=qs[_0x59e2('0x39')](_0x56b8f2[_0x59e2('0x31')]['sort']);_0x2a9fe0['where']=qs[_0x59e2('0x32')](_['pick'](_0x56b8f2['query'],_0x141a8d[_0x59e2('0x32')]),_0x2286f3);if(_0x56b8f2[_0x59e2('0x31')][_0x59e2('0x3a')]){_0x2a9fe0['where']=_['merge'](_0x2a9fe0[_0x59e2('0x3b')],{'$or':_[_0x59e2('0x3c')](_0x2286f3,function(_0x22605d){if(_0x22605d['type']!=='VIRTUAL'){var _0x2f5991={};_0x2f5991[_0x22605d['name']]={'$like':'%'+_0x56b8f2[_0x59e2('0x31')][_0x59e2('0x3a')]+'%'};return _0x2f5991;}})});}_0x2a9fe0=_[_0x59e2('0x3d')]({},_0x2a9fe0,_0x56b8f2[_0x59e2('0x3e')]);var _0x246fbe={'where':_0x2a9fe0[_0x59e2('0x3b')]};return db[_0x59e2('0x2b')][_0x59e2('0x1f')](_0x246fbe)[_0x59e2('0x25')](function(_0x311226){_0x578da4['count']=_0x311226;if(_0x56b8f2[_0x59e2('0x31')]['includeAll']){_0x2a9fe0[_0x59e2('0x3f')]=[{'all':!![]}];}return db[_0x59e2('0x2b')]['findAll'](_0x2a9fe0);})['then'](function(_0x297d68){_0x578da4[_0x59e2('0x40')]=_0x297d68;return _0x578da4;})[_0x59e2('0x25')](respondWithFilteredResult(_0x46af99,_0x2a9fe0))['catch'](handleError(_0x46af99,null));};exports[_0x59e2('0x41')]=function(_0x418ecb,_0x4c859d){var _0x4dc9a6={'raw':!![],'where':{'id':_0x418ecb[_0x59e2('0x42')]['id']}},_0x1eb75b={};_0x1eb75b[_0x59e2('0x30')]=_['keys'](db['JscriptySessionReport'][_0x59e2('0x2c')]);_0x1eb75b[_0x59e2('0x31')]=_[_0x59e2('0x43')](_0x418ecb[_0x59e2('0x31')]);_0x1eb75b[_0x59e2('0x32')]=_[_0x59e2('0x33')](_0x1eb75b[_0x59e2('0x30')],_0x1eb75b[_0x59e2('0x31')]);_0x4dc9a6[_0x59e2('0x34')]=_[_0x59e2('0x33')](_0x1eb75b[_0x59e2('0x30')],qs[_0x59e2('0x35')](_0x418ecb[_0x59e2('0x31')][_0x59e2('0x35')]));_0x4dc9a6[_0x59e2('0x34')]=_0x4dc9a6['attributes'][_0x59e2('0x36')]?_0x4dc9a6[_0x59e2('0x34')]:_0x1eb75b[_0x59e2('0x30')];if(_0x418ecb[_0x59e2('0x31')][_0x59e2('0x44')]){_0x4dc9a6[_0x59e2('0x3f')]=[{'all':!![]}];}_0x4dc9a6=_[_0x59e2('0x3d')]({},_0x4dc9a6,_0x418ecb[_0x59e2('0x3e')]);return db['JscriptySessionReport'][_0x59e2('0x45')](_0x4dc9a6)[_0x59e2('0x25')](handleEntityNotFound(_0x4c859d,null))[_0x59e2('0x25')](respondWithResult(_0x4c859d,null))[_0x59e2('0x46')](handleError(_0x4c859d,null));};exports['create']=function(_0x50b820,_0x2c5a8){return db['JscriptySessionReport'][_0x59e2('0x47')](_0x50b820[_0x59e2('0x48')],{})['then'](respondWithResult(_0x2c5a8,0xc9))['catch'](handleError(_0x2c5a8,null));};exports[_0x59e2('0x49')]=function(_0x1e4878,_0x415c8d){if(_0x1e4878['body']['id']){delete _0x1e4878[_0x59e2('0x48')]['id'];}return db[_0x59e2('0x2b')][_0x59e2('0x45')]({'where':{'id':_0x1e4878[_0x59e2('0x42')]['id']}})[_0x59e2('0x25')](handleEntityNotFound(_0x415c8d,null))[_0x59e2('0x25')](saveUpdates(_0x1e4878[_0x59e2('0x48')],null))['then'](respondWithResult(_0x415c8d,null))[_0x59e2('0x46')](handleError(_0x415c8d,null));};exports[_0x59e2('0x26')]=function(_0x842e92,_0x22593d){return db[_0x59e2('0x2b')]['find']({'where':{'id':_0x842e92[_0x59e2('0x42')]['id']}})[_0x59e2('0x25')](handleEntityNotFound(_0x22593d,null))['then'](removeEntity(_0x22593d,null))['catch'](handleError(_0x22593d,null));};exports[_0x59e2('0x4a')]=function(_0x4b1e21,_0x305a2f){return db['JscriptySessionReport'][_0x59e2('0x4a')]()[_0x59e2('0x25')](respondWithResult(_0x305a2f,null))[_0x59e2('0x46')](handleError(_0x305a2f,null));};exports[_0x59e2('0x4b')]=function(_0x402a04,_0x26f46e,_0x36d477){var _0x5509e7={'raw':!![],'where':{}};var _0x53a657={};var _0x1bfca2={'count':0x0,'rows':[]};return db[_0x59e2('0x2b')][_0x59e2('0x4c')]({'where':{'id':_0x402a04[_0x59e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x26f46e,null))[_0x59e2('0x25')](function(_0x4d4845){if(_0x4d4845){_0x53a657[_0x59e2('0x30')]=_[_0x59e2('0x43')](db[_0x59e2('0x4d')][_0x59e2('0x2c')]);_0x53a657['query']=_[_0x59e2('0x43')](_0x402a04[_0x59e2('0x31')]);_0x53a657[_0x59e2('0x32')]=_[_0x59e2('0x33')](_0x53a657[_0x59e2('0x30')],_0x53a657[_0x59e2('0x31')]);_0x5509e7[_0x59e2('0x34')]=_[_0x59e2('0x33')](_0x53a657[_0x59e2('0x30')],qs[_0x59e2('0x35')](_0x402a04[_0x59e2('0x31')]['fields']));_0x5509e7['attributes']=_0x5509e7[_0x59e2('0x34')]['length']?_0x5509e7[_0x59e2('0x34')]:_0x53a657['model'];if(!_0x402a04[_0x59e2('0x31')][_0x59e2('0x37')](_0x59e2('0x4e'))){_0x5509e7[_0x59e2('0x1e')]=qs[_0x59e2('0x1e')](_0x402a04[_0x59e2('0x31')][_0x59e2('0x1e')]);_0x5509e7[_0x59e2('0x1c')]=qs[_0x59e2('0x1c')](_0x402a04[_0x59e2('0x31')]['offset']);}_0x5509e7[_0x59e2('0x38')]=qs[_0x59e2('0x39')](_0x402a04[_0x59e2('0x31')][_0x59e2('0x39')]);_0x5509e7[_0x59e2('0x3b')]=qs['filters'](_[_0x59e2('0x4f')](_0x402a04[_0x59e2('0x31')],_0x53a657[_0x59e2('0x32')]));_0x5509e7[_0x59e2('0x3b')][_0x59e2('0x50')]=_0x4d4845['id'];if(_0x402a04[_0x59e2('0x31')]['filter']){_0x5509e7[_0x59e2('0x3b')]=_[_0x59e2('0x3d')](_0x5509e7[_0x59e2('0x3b')],{'$or':_[_0x59e2('0x3c')](_0x5509e7[_0x59e2('0x34')],function(_0x267aa9){var _0x12d739={};_0x12d739[_0x267aa9]={'$like':'%'+_0x402a04[_0x59e2('0x31')]['filter']+'%'};return _0x12d739;})});}_0x5509e7=_[_0x59e2('0x3d')]({},_0x5509e7,_0x402a04[_0x59e2('0x3e')]);return db[_0x59e2('0x4d')][_0x59e2('0x1f')]({'where':_0x5509e7[_0x59e2('0x3b')]})[_0x59e2('0x25')](function(_0x37a787){_0x1bfca2['count']=_0x37a787;if(_0x402a04[_0x59e2('0x31')][_0x59e2('0x44')]){_0x5509e7['include']=[{'all':!![]}];}return db[_0x59e2('0x4d')][_0x59e2('0x51')](_0x5509e7);})[_0x59e2('0x25')](function(_0x12a160){_0x1bfca2[_0x59e2('0x40')]=_0x12a160;return _0x1bfca2;});}})[_0x59e2('0x25')](respondWithFilteredResult(_0x26f46e,_0x5509e7))['catch'](handleError(_0x26f46e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f916bfc..80daf7d 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 _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0x5ce419,_0xf05351){var _0x186689=function(_0x3a5cb9){while(--_0x3a5cb9){_0x5ce419['push'](_0x5ce419['shift']());}};_0x186689(++_0xf05351);}(_0xeff8,0x186));var _0x8eff=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xeff8[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xafc4,0x69));var _0x4afc=function(_0x569649,_0x2007c4){_0x569649=_0x569649-0x0;var _0x54b89e=_0xafc4[_0x569649];return _0x54b89e;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index c28eb7d..c715005 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 _0x5464=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x435c1d,_0x4dcf72){var _0x4b17ee=function(_0x569715){while(--_0x569715){_0x435c1d['push'](_0x435c1d['shift']());}};_0x4b17ee(++_0x4dcf72);}(_0x5464,0x15d));var _0x4546=function(_0x25b324,_0x26dc30){_0x25b324=_0x25b324-0x0;var _0x4cfad6=_0x5464[_0x25b324];return _0x4cfad6;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file +var _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x39be20,_0x226232){var _0x392511=function(_0x12a9f9){while(--_0x12a9f9){_0x39be20['push'](_0x39be20['shift']());}};_0x392511(++_0x226232);}(_0x7046,0x144));var _0x6704=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7046[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9135e2a..e1fe210 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 _0x94af=['./license.controller','index','put','/:id','isAuthenticated','get','/download_log_file','downloadLogFile','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x313532,_0x33e75f){var _0x44bc16=function(_0x31ab32){while(--_0x31ab32){_0x313532['push'](_0x313532['shift']());}};_0x44bc16(++_0x33e75f);}(_0x94af,0x18f));var _0xf94a=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x94af[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xf94a('0x0'));var util=require('util');var path=require(_0xf94a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf94a('0x2'));var router=express['Router']();var fs_extra=require(_0xf94a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf94a('0x4'));var config=require(_0xf94a('0x5'));var controller=require(_0xf94a('0x6'));router['get']('/',controller[_0xf94a('0x7')]);router[_0xf94a('0x8')](_0xf94a('0x9'),auth[_0xf94a('0xa')](),controller['update']);router[_0xf94a('0xb')](_0xf94a('0xc'),auth[_0xf94a('0xa')](),controller[_0xf94a('0xd')]);module[_0xf94a('0xe')]=router; \ No newline at end of file +var _0x0257=['./license.controller','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x0257,0x1c3));var _0x7025=function(_0x2d85a5,_0x26861c){_0x2d85a5=_0x2d85a5-0x0;var _0x27d75b=_0x0257[_0x2d85a5];return _0x27d75b;};'use strict';var multer=require(_0x7025('0x0'));var util=require(_0x7025('0x1'));var path=require(_0x7025('0x2'));var timeout=require(_0x7025('0x3'));var express=require('express');var router=express[_0x7025('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7025('0x5'));var interaction=require(_0x7025('0x6'));var config=require(_0x7025('0x7'));var controller=require(_0x7025('0x8'));router[_0x7025('0x9')]('/',controller[_0x7025('0xa')]);router[_0x7025('0xb')]('/:id',auth[_0x7025('0xc')](),controller[_0x7025('0xd')]);router['get'](_0x7025('0xe'),auth[_0x7025('0xc')](),controller[_0x7025('0xf')]);module[_0x7025('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 51b4b31..b92631d 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 _0xc729=['STRING','sequelize','TEXT'];(function(_0x2a30dd,_0x2b6429){var _0xa5b379=function(_0x48e1f0){while(--_0x48e1f0){_0x2a30dd['push'](_0x2a30dd['shift']());}};_0xa5b379(++_0x2b6429);}(_0xc729,0x142));var _0x9c72=function(_0x22a8ff,_0x3cfd02){_0x22a8ff=_0x22a8ff-0x0;var _0x35b165=_0xc729[_0x22a8ff];return _0x35b165;};'use strict';var Sequelize=require(_0x9c72('0x0'));module['exports']={'license':{'type':Sequelize[_0x9c72('0x1')]},'data1':{'type':Sequelize[_0x9c72('0x2')]},'data2':{'type':Sequelize[_0x9c72('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x52e6=['exports','TEXT','STRING','INTEGER'];(function(_0x5b7588,_0x451e71){var _0x4c66bd=function(_0x4d72ce){while(--_0x4d72ce){_0x5b7588['push'](_0x5b7588['shift']());}};_0x4c66bd(++_0x451e71);}(_0x52e6,0x188));var _0x652e=function(_0x5b093b,_0xe4e3a5){_0x5b093b=_0x5b093b-0x0;var _0x2fc71c=_0x52e6[_0x5b093b];return _0x2fc71c;};'use strict';var Sequelize=require('sequelize');module[_0x652e('0x0')]={'license':{'type':Sequelize[_0x652e('0x1')]},'data1':{'type':Sequelize[_0x652e('0x2')]},'data2':{'type':Sequelize[_0x652e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x652e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c2a9046..6c5ade1 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 _0xc765=['util','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','catch','body','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xadb97b,_0x52998d){var _0x762a0f=function(_0x49a5cc){while(--_0x49a5cc){_0xadb97b['push'](_0xadb97b['shift']());}};_0x762a0f(++_0x52998d);}(_0xc765,0x82));var _0x5c76=function(_0x1f993d,_0x579c8f){_0x1f993d=_0x1f993d-0x0;var _0x3c1190=_0xc765[_0x1f993d];return _0x3c1190;};'use strict';var emlformat=require(_0x5c76('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c76('0x1'));var rp=require(_0x5c76('0x2'));var moment=require(_0x5c76('0x3'));var BPromise=require(_0x5c76('0x4'));var Mustache=require(_0x5c76('0x5'));var util=require(_0x5c76('0x6'));var path=require('path');var sox=require(_0x5c76('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c76('0x8'));var _=require('lodash');var squel=require(_0x5c76('0x9'));var crypto=require('crypto');var jsforce=require(_0x5c76('0xa'));var deskjs=require(_0x5c76('0xb'));var toCsv=require(_0x5c76('0xc'));var querystring=require(_0x5c76('0xd'));var Papa=require(_0x5c76('0xe'));var Redis=require(_0x5c76('0xf'));var authService=require(_0x5c76('0x10'));var qs=require(_0x5c76('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c76('0x12'));var logger=require(_0x5c76('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c76('0x14'));var db=require(_0x5c76('0x15'))['db'];function respondWithStatusCode(_0x2723a0,_0xe533c1){_0xe533c1=_0xe533c1||0xcc;return function(_0x3e2b97){if(_0x3e2b97){return _0x2723a0['sendStatus'](_0xe533c1);}return _0x2723a0[_0x5c76('0x16')](_0xe533c1)['end']();};}function respondWithResult(_0x4f7c00,_0x55f210){_0x55f210=_0x55f210||0xc8;return function(_0x11e89d){if(_0x11e89d){return _0x4f7c00[_0x5c76('0x16')](_0x55f210)[_0x5c76('0x17')](_0x11e89d);}};}function respondWithFilteredResult(_0x410d86,_0x345171){return function(_0x2eeec3){if(_0x2eeec3){var _0x10ba44=typeof _0x345171['offset']===_0x5c76('0x18')&&typeof _0x345171['limit']===_0x5c76('0x18');var _0xa61739=_0x2eeec3[_0x5c76('0x19')];var _0x363000=_0x10ba44?0x0:_0x345171[_0x5c76('0x1a')];var _0x466be4=_0x10ba44?_0x2eeec3['count']:_0x345171[_0x5c76('0x1a')]+_0x345171['limit'];var _0x2103bf;if(_0x466be4>=_0xa61739){_0x466be4=_0xa61739;_0x2103bf=0xc8;}else{_0x2103bf=0xce;}_0x410d86[_0x5c76('0x16')](_0x2103bf);return _0x410d86['set'](_0x5c76('0x1b'),_0x363000+'-'+_0x466be4+'/'+_0xa61739)[_0x5c76('0x17')](_0x2eeec3);}return null;};}function patchUpdates(_0x4971c5){return function(_0x5138ba){try{jsonpatch[_0x5c76('0x1c')](_0x5138ba,_0x4971c5,!![]);}catch(_0x488e83){return BPromise[_0x5c76('0x1d')](_0x488e83);}return _0x5138ba[_0x5c76('0x1e')]();};}function saveUpdates(_0x39412f,_0x1096c3){return function(_0x13c701){if(_0x13c701){return _0x13c701[_0x5c76('0x1f')](_0x39412f)[_0x5c76('0x20')](function(_0x4671a0){return _0x4671a0;});}return null;};}function removeEntity(_0x2ef7dd,_0xd87a4c){return function(_0x546d4a){if(_0x546d4a){return _0x546d4a[_0x5c76('0x21')]()[_0x5c76('0x20')](function(){_0x2ef7dd[_0x5c76('0x16')](0xcc)[_0x5c76('0x22')]();});}};}function handleEntityNotFound(_0xd83331,_0x57af12){return function(_0x5c74cb){if(!_0x5c74cb){_0xd83331[_0x5c76('0x23')](0x194);}return _0x5c74cb;};}function handleError(_0xfca3ff,_0xd06642){_0xd06642=_0xd06642||0x1f4;return function(_0x5e9cb5){logger['error'](_0x5e9cb5[_0x5c76('0x24')]);if(_0x5e9cb5[_0x5c76('0x25')]){delete _0x5e9cb5[_0x5c76('0x25')];}_0xfca3ff[_0x5c76('0x16')](_0xd06642)[_0x5c76('0x26')](_0x5e9cb5);};}var utilLicense=require(_0x5c76('0x14'));exports['index']=function(_0x2c2623,_0x60cc4c){var _0x1d006b={'raw':!![],'where':{'id':0x1}},_0x20ec6a={};_0x20ec6a['model']=_[_0x5c76('0x27')](db[_0x5c76('0x28')][_0x5c76('0x29')]);_0x20ec6a[_0x5c76('0x2a')]=_[_0x5c76('0x27')](_0x2c2623[_0x5c76('0x2a')]);_0x20ec6a[_0x5c76('0x2b')]=_[_0x5c76('0x2c')](_0x20ec6a[_0x5c76('0x2d')],_0x20ec6a[_0x5c76('0x2a')]);_0x1d006b[_0x5c76('0x2e')]=_[_0x5c76('0x2c')](_0x20ec6a[_0x5c76('0x2d')],qs[_0x5c76('0x2f')](_0x2c2623[_0x5c76('0x2a')][_0x5c76('0x2f')]));_0x1d006b['attributes']=_0x1d006b['attributes'][_0x5c76('0x30')]?_0x1d006b[_0x5c76('0x2e')]:_0x20ec6a['model'];_0x1d006b=_[_0x5c76('0x31')]({},_0x1d006b,_0x2c2623['options']);return utilLicense['getLicense'](_0x1d006b)['then'](respondWithResult(_0x60cc4c,null))[_0x5c76('0x32')](handleError(_0x60cc4c,null));};exports['update']=function(_0x43cfb7,_0x5b00a8){if(_0x43cfb7[_0x5c76('0x33')]['id']){delete _0x43cfb7[_0x5c76('0x33')]['id'];}return db[_0x5c76('0x28')]['find']({'where':{'id':_0x43cfb7[_0x5c76('0x34')]['id']}})[_0x5c76('0x20')](handleEntityNotFound(_0x5b00a8,null))[_0x5c76('0x20')](function(_0x57e388){var _0x2d739f=_0x57e388['get']({'plain':!![]});return utilLicense[_0x5c76('0x35')](_0x2d739f,_0x43cfb7['body'][_0x5c76('0x36')]);})[_0x5c76('0x20')](function(_0x125948){if(!_0x125948[_0x5c76('0x37')]){return saveUpdates(_0x43cfb7[_0x5c76('0x33')],null);}return _0x125948;})[_0x5c76('0x20')](respondWithResult(_0x5b00a8,null))['catch'](handleError(_0x5b00a8,null));};exports[_0x5c76('0x38')]=function(_0x35cb86,_0x247616){var _0x2e706b=_0x5c76('0x39');var _0xa59a72=path[_0x5c76('0x3a')](_0x5c76('0x3b'),_0x5c76('0x3c'),'xcally',_0x2e706b);_0x247616[_0x5c76('0x3d')](_0x5c76('0x3e'),_0x5c76('0x3f')+_0x2e706b);_0x247616[_0x5c76('0x40')](_0x5c76('0x41'),_0x5c76('0x42'));_0x247616[_0x5c76('0x43')](_0xa59a72);}; \ No newline at end of file +var _0x5430=['intersection','attributes','fields','length','merge','options','catch','update','body','find','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','download','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','../../config/license/util','index','model','License','rawAttributes','query','keys','filters'];(function(_0x3c84cf,_0x46e0e0){var _0x53e552=function(_0x2dfecd){while(--_0x2dfecd){_0x3c84cf['push'](_0x3c84cf['shift']());}};_0x53e552(++_0x46e0e0);}(_0x5430,0xaa));var _0x0543=function(_0x241ab3,_0x39c5b8){_0x241ab3=_0x241ab3-0x0;var _0x31ae76=_0x5430[_0x241ab3];return _0x31ae76;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0543('0x3'));var moment=require('moment');var BPromise=require(_0x0543('0x4'));var Mustache=require('mustache');var util=require(_0x0543('0x5'));var path=require(_0x0543('0x6'));var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var fs_extra=require(_0x0543('0xa'));var _=require(_0x0543('0xb'));var squel=require(_0x0543('0xc'));var crypto=require('crypto');var jsforce=require(_0x0543('0xd'));var deskjs=require(_0x0543('0xe'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xf'));var Papa=require(_0x0543('0x10'));var Redis=require(_0x0543('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x12'));var as=require(_0x0543('0x13'));var hardwareService=require(_0x0543('0x14'));var logger=require(_0x0543('0x15'))(_0x0543('0x16'));var utils=require(_0x0543('0x17'));var config=require(_0x0543('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0543('0x19'))['db'];function respondWithStatusCode(_0x475ed3,_0x457d07){_0x457d07=_0x457d07||0xcc;return function(_0x394d09){if(_0x394d09){return _0x475ed3[_0x0543('0x1a')](_0x457d07);}return _0x475ed3[_0x0543('0x1b')](_0x457d07)[_0x0543('0x1c')]();};}function respondWithResult(_0x53230d,_0xb70926){_0xb70926=_0xb70926||0xc8;return function(_0x46c4f7){if(_0x46c4f7){return _0x53230d[_0x0543('0x1b')](_0xb70926)['json'](_0x46c4f7);}};}function respondWithFilteredResult(_0x1e1b15,_0x2db720){return function(_0x133c66){if(_0x133c66){var _0x103d8b=typeof _0x2db720[_0x0543('0x1d')]===_0x0543('0x1e')&&typeof _0x2db720[_0x0543('0x1f')]==='undefined';var _0x31246c=_0x133c66[_0x0543('0x20')];var _0x2abd59=_0x103d8b?0x0:_0x2db720[_0x0543('0x1d')];var _0x52a492=_0x103d8b?_0x133c66[_0x0543('0x20')]:_0x2db720[_0x0543('0x1d')]+_0x2db720[_0x0543('0x1f')];var _0x54ea26;if(_0x52a492>=_0x31246c){_0x52a492=_0x31246c;_0x54ea26=0xc8;}else{_0x54ea26=0xce;}_0x1e1b15[_0x0543('0x1b')](_0x54ea26);return _0x1e1b15[_0x0543('0x21')](_0x0543('0x22'),_0x2abd59+'-'+_0x52a492+'/'+_0x31246c)[_0x0543('0x23')](_0x133c66);}return null;};}function patchUpdates(_0x44b77b){return function(_0x3ad4fc){try{jsonpatch[_0x0543('0x24')](_0x3ad4fc,_0x44b77b,!![]);}catch(_0x3269c7){return BPromise[_0x0543('0x25')](_0x3269c7);}return _0x3ad4fc['save']();};}function saveUpdates(_0x324027,_0x12e520){return function(_0xf5eace){if(_0xf5eace){return _0xf5eace['update'](_0x324027)[_0x0543('0x26')](function(_0x36f0d4){return _0x36f0d4;});}return null;};}function removeEntity(_0x5e8e05,_0xf9e08e){return function(_0x39f9c0){if(_0x39f9c0){return _0x39f9c0[_0x0543('0x27')]()[_0x0543('0x26')](function(){_0x5e8e05[_0x0543('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b07e3,_0xedbb3){return function(_0x4f8577){if(!_0x4f8577){_0x3b07e3[_0x0543('0x1a')](0x194);}return _0x4f8577;};}function handleError(_0x2dfec8,_0x1f190d){_0x1f190d=_0x1f190d||0x1f4;return function(_0x3c0764){logger[_0x0543('0x28')](_0x3c0764[_0x0543('0x29')]);if(_0x3c0764[_0x0543('0x2a')]){delete _0x3c0764[_0x0543('0x2a')];}_0x2dfec8[_0x0543('0x1b')](_0x1f190d)[_0x0543('0x2b')](_0x3c0764);};}var utilLicense=require(_0x0543('0x2c'));exports[_0x0543('0x2d')]=function(_0x56892b,_0x1317ae){var _0x1fee2a={'raw':!![],'where':{'id':0x1}},_0x235527={};_0x235527[_0x0543('0x2e')]=_['keys'](db[_0x0543('0x2f')][_0x0543('0x30')]);_0x235527[_0x0543('0x31')]=_[_0x0543('0x32')](_0x56892b[_0x0543('0x31')]);_0x235527[_0x0543('0x33')]=_[_0x0543('0x34')](_0x235527['model'],_0x235527[_0x0543('0x31')]);_0x1fee2a[_0x0543('0x35')]=_[_0x0543('0x34')](_0x235527[_0x0543('0x2e')],qs[_0x0543('0x36')](_0x56892b['query']['fields']));_0x1fee2a['attributes']=_0x1fee2a[_0x0543('0x35')][_0x0543('0x37')]?_0x1fee2a['attributes']:_0x235527['model'];_0x1fee2a=_[_0x0543('0x38')]({},_0x1fee2a,_0x56892b[_0x0543('0x39')]);return utilLicense['getLicense'](_0x1fee2a)[_0x0543('0x26')](respondWithResult(_0x1317ae,null))[_0x0543('0x3a')](handleError(_0x1317ae,null));};exports[_0x0543('0x3b')]=function(_0x3f3854,_0xb9263e){if(_0x3f3854[_0x0543('0x3c')]['id']){delete _0x3f3854[_0x0543('0x3c')]['id'];}return db[_0x0543('0x2f')][_0x0543('0x3d')]({'where':{'id':_0x3f3854[_0x0543('0x3e')]['id']}})['then'](handleEntityNotFound(_0xb9263e,null))['then'](function(_0x10a2ee){var _0x12aea1=_0x10a2ee['get']({'plain':!![]});return utilLicense[_0x0543('0x3f')](_0x12aea1,_0x3f3854[_0x0543('0x3c')][_0x0543('0x40')]);})[_0x0543('0x26')](function(_0x4891c9){if(!_0x4891c9[_0x0543('0x41')]){return saveUpdates(_0x3f3854[_0x0543('0x3c')],null);}return _0x4891c9;})[_0x0543('0x26')](respondWithResult(_0xb9263e,null))[_0x0543('0x3a')](handleError(_0xb9263e,null));};exports[_0x0543('0x42')]=function(_0x580486,_0x446d8f){var _0xb7610a=_0x0543('0x43');var _0x2ca012=path[_0x0543('0x44')](_0x0543('0x45'),_0x0543('0x46'),'xcally',_0xb7610a);_0x446d8f[_0x0543('0x47')]('Content-disposition',_0x0543('0x48')+_0xb7610a);_0x446d8f[_0x0543('0x21')]('Content-Type','text/plain');_0x446d8f[_0x0543('0x49')](_0x2ca012);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 62cad58..9cd7b77 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 _0xd010=['path','rimraf','../../config/environment','./license.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e72f4,_0x2d1896){var _0x37db29=function(_0x56b894){while(--_0x56b894){_0x5e72f4['push'](_0x5e72f4['shift']());}};_0x37db29(++_0x2d1896);}(_0xd010,0xd2));var _0x0d01=function(_0x13f11b,_0x57c23b){_0x13f11b=_0x13f11b-0x0;var _0x4d8f1e=_0xd010[_0x13f11b];return _0x4d8f1e;};'use strict';var _=require(_0x0d01('0x0'));var util=require(_0x0d01('0x1'));var logger=require(_0x0d01('0x2'))(_0x0d01('0x3'));var moment=require(_0x0d01('0x4'));var BPromise=require('bluebird');var rp=require(_0x0d01('0x5'));var fs=require('fs');var path=require(_0x0d01('0x6'));var rimraf=require(_0x0d01('0x7'));var config=require(_0x0d01('0x8'));var attributes=require(_0x0d01('0x9'));module[_0x0d01('0xa')]=function(_0x20d179,_0xc1b71b){return _0x20d179[_0x0d01('0xb')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30ec=['../../config/environment','./license.attributes','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2366ac,_0x2fff4c){var _0xf87f9b=function(_0x131ee6){while(--_0x131ee6){_0x2366ac['push'](_0x2366ac['shift']());}};_0xf87f9b(++_0x2fff4c);}(_0x30ec,0xf3));var _0xc30e=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0x30ec[_0x50f9ab];return _0x58dda4;};'use strict';var _=require(_0xc30e('0x0'));var util=require(_0xc30e('0x1'));var logger=require(_0xc30e('0x2'))(_0xc30e('0x3'));var moment=require(_0xc30e('0x4'));var BPromise=require(_0xc30e('0x5'));var rp=require(_0xc30e('0x6'));var fs=require('fs');var path=require(_0xc30e('0x7'));var rimraf=require(_0xc30e('0x8'));var config=require(_0xc30e('0x9'));var attributes=require(_0xc30e('0xa'));module[_0xc30e('0xb')]=function(_0x5909e4,_0x1232ee){return _0x5909e4['define'](_0xc30e('0xc'),attributes,{'tableName':_0xc30e('0xd'),'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 cab22a3..d1de24c 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 _0x4b1f=['error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e16f8,_0x115ca3){var _0xef3db2=function(_0x4549f0){while(--_0x4549f0){_0x4e16f8['push'](_0x4e16f8['shift']());}};_0xef3db2(++_0x115ca3);}(_0x4b1f,0x82));var _0xf4b1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4b1f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require(_0xf4b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b1('0x3'));var db=require(_0xf4b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4b1('0x5'))('rpc');var config=require(_0xf4b1('0x6'));var jayson=require(_0xf4b1('0x7'));var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e44ab,_0x262c45,_0x31cf06){return new BPromise(function(_0x417b84,_0x304001){return client[_0xf4b1('0xa')](_0x3e44ab,_0x31cf06)[_0xf4b1('0xb')](function(_0x1d05d4){logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x262c45,'request\x20sent');logger['debug'](_0xf4b1('0xe'),_0x262c45,_0xf4b1('0xf'),JSON[_0xf4b1('0x10')](_0x1d05d4));if(_0x1d05d4[_0xf4b1('0x11')]){if(_0x1d05d4['error'][_0xf4b1('0x12')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x262c45,_0x1d05d4[_0xf4b1('0x11')][_0xf4b1('0x13')]);return _0x304001(_0x1d05d4['error'][_0xf4b1('0x13')]);}logger[_0xf4b1('0x11')]('License,\x20%s,\x20%s',_0x262c45,_0x1d05d4[_0xf4b1('0x11')][_0xf4b1('0x13')]);return _0x417b84(_0x1d05d4[_0xf4b1('0x11')][_0xf4b1('0x13')]);}else{logger['info'](_0xf4b1('0xd'),_0x262c45,_0xf4b1('0xf'));_0x417b84(_0x1d05d4['result'][_0xf4b1('0x13')]);}})[_0xf4b1('0x14')](function(_0x1bfe2a){logger[_0xf4b1('0x11')](_0xf4b1('0xd'),_0x262c45,_0x1bfe2a);_0x304001(_0x1bfe2a);});});} \ No newline at end of file +var _0x6749=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3c5f20,_0x403b82){var _0x4cc9cf=function(_0x34fddc){while(--_0x34fddc){_0x3c5f20['push'](_0x3c5f20['shift']());}};_0x4cc9cf(++_0x403b82);}(_0x6749,0x6e));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9674('0x0'));var util=require(_0x9674('0x1'));var moment=require(_0x9674('0x2'));var BPromise=require(_0x9674('0x3'));var rs=require(_0x9674('0x4'));var fs=require('fs');var Redis=require(_0x9674('0x5'));var db=require(_0x9674('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9674('0x7'))(_0x9674('0x8'));var config=require(_0x9674('0x9'));var jayson=require(_0x9674('0xa'));var client=jayson['client'][_0x9674('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1518c1,_0x3f9178,_0x1de3ce){return new BPromise(function(_0x4fe1e9,_0x5ad1e7){return client[_0x9674('0xc')](_0x1518c1,_0x1de3ce)['then'](function(_0x4d9686){logger[_0x9674('0xd')](_0x9674('0xe'),_0x3f9178,_0x9674('0xf'));logger[_0x9674('0x10')](_0x9674('0x11'),_0x3f9178,_0x9674('0xf'),JSON[_0x9674('0x12')](_0x4d9686));if(_0x4d9686[_0x9674('0x13')]){if(_0x4d9686['error']['code']===0x1f4){logger[_0x9674('0x13')](_0x9674('0xe'),_0x3f9178,_0x4d9686[_0x9674('0x13')][_0x9674('0x14')]);return _0x5ad1e7(_0x4d9686['error']['message']);}logger[_0x9674('0x13')](_0x9674('0xe'),_0x3f9178,_0x4d9686[_0x9674('0x13')][_0x9674('0x14')]);return _0x4fe1e9(_0x4d9686['error'][_0x9674('0x14')]);}else{logger[_0x9674('0xd')](_0x9674('0xe'),_0x3f9178,_0x9674('0xf'));_0x4fe1e9(_0x4d9686[_0x9674('0x15')][_0x9674('0x14')]);}})[_0x9674('0x16')](function(_0x472b1e){logger['error'](_0x9674('0xe'),_0x3f9178,_0x472b1e);_0x5ad1e7(_0x472b1e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 12d66c4..d4ec45a 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 _0x0a22=['getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','addApplications','send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','/:id','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x0a22,0xcc));var _0x20a2=function(_0x1d0ce7,_0x5938f1){_0x1d0ce7=_0x1d0ce7-0x0;var _0x27d94d=_0x0a22[_0x1d0ce7];return _0x27d94d;};'use strict';var multer=require(_0x20a2('0x0'));var util=require(_0x20a2('0x1'));var path=require(_0x20a2('0x2'));var timeout=require(_0x20a2('0x3'));var express=require('express');var router=express[_0x20a2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x20a2('0x5'));var config=require(_0x20a2('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x20a2('0x7')](),controller['index']);router[_0x20a2('0x8')](_0x20a2('0x9'),auth[_0x20a2('0x7')](),controller[_0x20a2('0xa')]);router[_0x20a2('0x8')]('/:id',auth[_0x20a2('0x7')](),controller[_0x20a2('0xb')]);router[_0x20a2('0x8')]('/:id/dispositions',auth[_0x20a2('0x7')](),controller[_0x20a2('0xc')]);router[_0x20a2('0x8')](_0x20a2('0xd'),auth[_0x20a2('0x7')](),controller[_0x20a2('0xe')]);router['get'](_0x20a2('0xf'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x10')]);router[_0x20a2('0x8')]('/:id/out_servers',auth[_0x20a2('0x7')](),controller[_0x20a2('0x11')]);router['get'](_0x20a2('0x12'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x13')]);router[_0x20a2('0x8')](_0x20a2('0x14'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x15')]);router[_0x20a2('0x8')]('/:id/messages',auth[_0x20a2('0x7')](),controller[_0x20a2('0x16')]);router[_0x20a2('0x8')](_0x20a2('0x17'),auth['isAuthenticated'](),controller[_0x20a2('0x18')]);router[_0x20a2('0x8')](_0x20a2('0x19'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x1a')]);router[_0x20a2('0x1b')](_0x20a2('0x1c'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x1d')]);router[_0x20a2('0x1b')](_0x20a2('0xd'),auth['isAuthenticated'](),controller[_0x20a2('0x1e')]);router['post']('/',auth[_0x20a2('0x7')](),controller[_0x20a2('0x1f')]);router[_0x20a2('0x1b')](_0x20a2('0xf'),auth[_0x20a2('0x7')](),controller['addImap']);router['post'](_0x20a2('0x20'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x21')]);router[_0x20a2('0x1b')](_0x20a2('0x12'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x22')]);router[_0x20a2('0x1b')]('/:id/applications',auth[_0x20a2('0x7')](),controller[_0x20a2('0x23')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x20a2('0x24')]);router[_0x20a2('0x1b')](_0x20a2('0x19'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x25')]);router['put']('/:id',auth[_0x20a2('0x7')](),controller[_0x20a2('0x26')]);router[_0x20a2('0x27')](_0x20a2('0x1c'),auth['isAuthenticated'](),controller[_0x20a2('0x28')]);router[_0x20a2('0x27')](_0x20a2('0xd'),auth[_0x20a2('0x7')](),controller['removeAnswers']);router['delete'](_0x20a2('0xf'),auth['isAuthenticated'](),controller[_0x20a2('0x29')]);router[_0x20a2('0x27')](_0x20a2('0x20'),auth['isAuthenticated'](),controller[_0x20a2('0x2a')]);router['delete'](_0x20a2('0x2b'),auth[_0x20a2('0x7')](),controller[_0x20a2('0x2c')]);router['delete']('/:id/users',auth[_0x20a2('0x7')](),controller[_0x20a2('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x0ff9=['/:id/out_servers','destroy','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','put','delete','removeDispositions','removeImap'];(function(_0x15f523,_0x5d55bf){var _0x30c5e9=function(_0x215633){while(--_0x215633){_0x15f523['push'](_0x15f523['shift']());}};_0x30c5e9(++_0x5d55bf);}(_0x0ff9,0xe4));var _0x90ff=function(_0x590c43,_0x64efa6){_0x590c43=_0x590c43-0x0;var _0xdfffcd=_0x0ff9[_0x590c43];return _0xdfffcd;};'use strict';var multer=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var path=require(_0x90ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x90ff('0x3'));var router=express[_0x90ff('0x4')]();var fs_extra=require(_0x90ff('0x5'));var auth=require(_0x90ff('0x6'));var interaction=require(_0x90ff('0x7'));var config=require(_0x90ff('0x8'));var controller=require(_0x90ff('0x9'));router[_0x90ff('0xa')]('/',auth[_0x90ff('0xb')](),controller[_0x90ff('0xc')]);router['get'](_0x90ff('0xd'),auth[_0x90ff('0xb')](),controller[_0x90ff('0xe')]);router[_0x90ff('0xa')](_0x90ff('0xf'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x10')]);router[_0x90ff('0xa')](_0x90ff('0x11'),auth[_0x90ff('0xb')](),controller['getDispositions']);router[_0x90ff('0xa')](_0x90ff('0x12'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x13')]);router[_0x90ff('0xa')](_0x90ff('0x14'),auth['isAuthenticated'](),controller[_0x90ff('0x15')]);router['get']('/:id/out_servers',auth[_0x90ff('0xb')](),controller[_0x90ff('0x16')]);router[_0x90ff('0xa')](_0x90ff('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x90ff('0xa')](_0x90ff('0x18'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x19')]);router[_0x90ff('0xa')](_0x90ff('0x1a'),auth['isAuthenticated'](),controller[_0x90ff('0x1b')]);router[_0x90ff('0xa')](_0x90ff('0x1c'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x1d')]);router[_0x90ff('0xa')]('/:id/users',auth[_0x90ff('0xb')](),controller[_0x90ff('0x1e')]);router[_0x90ff('0x1f')](_0x90ff('0x11'),auth[_0x90ff('0xb')](),controller['addDisposition']);router[_0x90ff('0x1f')](_0x90ff('0x12'),auth[_0x90ff('0xb')](),controller['addAnswer']);router[_0x90ff('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x90ff('0x1f')](_0x90ff('0x14'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x20')]);router[_0x90ff('0x1f')]('/:id/out_servers',auth[_0x90ff('0xb')](),controller[_0x90ff('0x21')]);router[_0x90ff('0x1f')](_0x90ff('0x17'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x22')]);router[_0x90ff('0x1f')]('/:id/applications',auth[_0x90ff('0xb')](),controller[_0x90ff('0x23')]);router[_0x90ff('0x1f')](_0x90ff('0x24'),auth[_0x90ff('0xb')](),controller['send']);router[_0x90ff('0x1f')](_0x90ff('0x25'),auth[_0x90ff('0xb')](),controller['addAgents']);router[_0x90ff('0x26')]('/:id',auth[_0x90ff('0xb')](),controller['update']);router[_0x90ff('0x27')](_0x90ff('0x11'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x28')]);router[_0x90ff('0x27')](_0x90ff('0x12'),auth[_0x90ff('0xb')](),controller['removeAnswers']);router[_0x90ff('0x27')]('/:id/in_servers',auth[_0x90ff('0xb')](),controller[_0x90ff('0x29')]);router[_0x90ff('0x27')](_0x90ff('0x2a'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x90ff('0x27')](_0x90ff('0xf'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x2b')]);router[_0x90ff('0x27')](_0x90ff('0x25'),auth[_0x90ff('0xb')](),controller[_0x90ff('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ab2ed3f..619505c 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 _0xc38d=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','sequelize','exports'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xc38d,0x11e));var _0xdc38=function(_0x360f68,_0x2f686c){_0x360f68=_0x360f68-0x0;var _0x29a1a1=_0xc38d[_0x360f68];return _0x29a1a1;};'use strict';var Sequelize=require(_0xdc38('0x0'));module[_0xdc38('0x1')]={'description':{'type':Sequelize[_0xdc38('0x2')]},'name':{'type':Sequelize[_0xdc38('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdc38('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdc38('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdc38('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xdc38('0x4')](0x2)[_0xdc38('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdc38('0x6')],'defaultValue':function(){return _0xdc38('0x7');}},'notificationSound':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc38('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc38('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc38('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdc38('0x8'),'set':function(_0x4fa971){if(!_0x4fa971)this[_0xdc38('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xdc38('0xa'),_0x4fa971);}},'provider':{'type':Sequelize[_0xdc38('0xb')](_0xdc38('0xc'),_0xdc38('0xd'),_0xdc38('0xe'),_0xdc38('0xf')),'defaultValue':null,'get':function(){if(!this[_0xdc38('0x10')](_0xdc38('0x11')))return'custom';return this['getDataValue'](_0xdc38('0x11'));},'set':function(_0x239e3b){if(_0x239e3b==='custom')_0x239e3b=null;return this[_0xdc38('0x9')]('provider',_0x239e3b);}}}; \ No newline at end of file +var _0x4d01=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','hotmail','yahoo','custom','getDataValue','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x360f76,_0x2a1361){var _0x4c3d88=function(_0x3e5ab1){while(--_0x3e5ab1){_0x360f76['push'](_0x360f76['shift']());}};_0x4c3d88(++_0x2a1361);}(_0x4d01,0x108));var _0x14d0=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x4d01[_0x37ffea];return _0x2e2615;};'use strict';var Sequelize=require('sequelize');module[_0x14d0('0x0')]={'description':{'type':Sequelize[_0x14d0('0x1')]},'name':{'type':Sequelize[_0x14d0('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x14d0('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x14d0('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x14d0('0x3')]},'markAsUnread':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x14d0('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x14d0('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x14d0('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x14d0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x14d0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x14d0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x14d0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x14d0('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x14d0('0x8'),'set':function(_0x5df389){if(!_0x5df389)this[_0x14d0('0x9')](_0x14d0('0xa'),null);this[_0x14d0('0x9')]('mandatoryDisposition',_0x5df389);}},'provider':{'type':Sequelize[_0x14d0('0xb')]('gmail',_0x14d0('0xc'),_0x14d0('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x14d0('0xe');return this[_0x14d0('0xf')](_0x14d0('0x10'));},'set':function(_0x79d15f){if(_0x79d15f===_0x14d0('0xe'))_0x79d15f=null;return this[_0x14d0('0x9')]('provider',_0x79d15f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b055070..4d7df6f 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 _0xd86c=['VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','code','error','message','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','yahoo','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','Pause','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','body','custom','provider','secure','find','Mail\x20Account\x20not\x20found','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','findOne','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','ListId','isNil','active','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','out','messageId','YYYY-MM-DD\x20HH:mm:ss','Interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd86c,0xc5));var _0xcd86=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xd86c[_0x22b68a];return _0x1ac67a;};'use strict';var moment=require(_0xcd86('0x0'));var BPromise=require(_0xcd86('0x1'));var util=require(_0xcd86('0x2'));var path=require(_0xcd86('0x3'));var _=require(_0xcd86('0x4'));var juice=require(_0xcd86('0x5'));var Redis=require(_0xcd86('0x6'));var qs=require(_0xcd86('0x7'));var logger=require(_0xcd86('0x8'))('api');var config=require(_0xcd86('0x9'));var db=require(_0xcd86('0xa'))['db'];config[_0xcd86('0xb')]=_[_0xcd86('0xc')](config[_0xcd86('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcd86('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcd86('0xe')]({'port':0x232b});function respondWithRpcPromise(_0xb1a3bc,_0x26eb4f,_0x2a4aba,_0x4d970a){return new BPromise(function(_0x464b7c,_0x4f633c){var _0x58df76=_0x4d970a||client;return _0x58df76['request'](_0xb1a3bc,_0x2a4aba)['then'](function(_0x2adf70){logger[_0xcd86('0xf')](_0xcd86('0x10'),_0x26eb4f,_0xcd86('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x26eb4f,_0xcd86('0x11'),JSON['stringify'](_0x2adf70));if(_0x2adf70['error']){if(_0x2adf70['error'][_0xcd86('0x12')]===0x1f4){logger[_0xcd86('0x13')](_0xcd86('0x10'),_0x26eb4f,_0x2adf70['error'][_0xcd86('0x14')]);return _0x4f633c(_0x2adf70[_0xcd86('0x13')][_0xcd86('0x14')]);}logger[_0xcd86('0x13')](_0xcd86('0x10'),_0x26eb4f,_0x2adf70[_0xcd86('0x13')][_0xcd86('0x14')]);return _0x464b7c(_0x2adf70[_0xcd86('0x13')][_0xcd86('0x14')]);}else{logger[_0xcd86('0xf')](_0xcd86('0x10'),_0x26eb4f,_0xcd86('0x11'));_0x464b7c(_0x2adf70['result'][_0xcd86('0x14')]);}})[_0xcd86('0x15')](function(_0x96f8dd){logger[_0xcd86('0x13')](_0xcd86('0x10'),_0x26eb4f,_0x96f8dd);_0x4f633c(_0x96f8dd);});});}function respondWithStatusCode(_0x42ee4f,_0x43fd50){_0x43fd50=_0x43fd50||0xcc;return function(_0x58d091){if(_0x58d091){return _0x42ee4f[_0xcd86('0x16')](_0x43fd50);}return _0x42ee4f[_0xcd86('0x17')](_0x43fd50)['end']();};}function respondWithResult(_0x42d7b2,_0x467b43){_0x467b43=_0x467b43||0xc8;return function(_0x450308){if(_0x450308){return _0x42d7b2[_0xcd86('0x17')](_0x467b43)[_0xcd86('0x18')](_0x450308);}};}function respondWithFilteredResult(_0x599a70,_0xb899e8){return function(_0x5db7c8){if(_0x5db7c8){var _0x44c451=typeof _0xb899e8[_0xcd86('0x19')]==='undefined'&&typeof _0xb899e8[_0xcd86('0x1a')]===_0xcd86('0x1b');var _0x329bab=_0x5db7c8[_0xcd86('0x1c')];var _0x2fbbdf=_0x44c451?0x0:_0xb899e8[_0xcd86('0x19')];var _0x5c100d=_0x44c451?_0x5db7c8[_0xcd86('0x1c')]:_0xb899e8[_0xcd86('0x19')]+_0xb899e8[_0xcd86('0x1a')];var _0x3e58a0;if(_0x5c100d>=_0x329bab){_0x5c100d=_0x329bab;_0x3e58a0=0xc8;}else{_0x3e58a0=0xce;}_0x599a70[_0xcd86('0x17')](_0x3e58a0);return _0x599a70['set'](_0xcd86('0x1d'),_0x2fbbdf+'-'+_0x5c100d+'/'+_0x329bab)['json'](_0x5db7c8);}return null;};}function saveUpdates(_0x29e5f1){return function(_0x2c437a){if(_0x2c437a){return _0x2c437a['update'](_0x29e5f1)[_0xcd86('0x1e')](function(_0x2700b8){return _0x2700b8;});}return null;};}function removeEntity(_0x22ce4c){return function(_0x4f1ae8){if(_0x4f1ae8){return _0x4f1ae8[_0xcd86('0x1f')]()[_0xcd86('0x1e')](function(){var _0x2a5e35=_0x4f1ae8[_0xcd86('0x20')]({'plain':!![]});var _0x153227=_0xcd86('0x21');return db[_0xcd86('0x22')][_0xcd86('0x1f')]({'where':{'type':_0x153227,'resourceId':_0x2a5e35['id']}})[_0xcd86('0x1e')](function(){return _0x4f1ae8;});})[_0xcd86('0x1e')](function(){_0x22ce4c[_0xcd86('0x17')](0xcc)[_0xcd86('0x23')]();});}};}function handleEntityNotFound(_0x2d0f3d){return function(_0x52a889){if(!_0x52a889){_0x2d0f3d['sendStatus'](0x194);}return _0x52a889;};}function handleError(_0x22f34b,_0x470c73){_0x470c73=_0x470c73||0x1f4;return function(_0x5a4a7){logger[_0xcd86('0x13')](_0x5a4a7[_0xcd86('0x24')]);if(_0x5a4a7[_0xcd86('0x25')]){delete _0x5a4a7[_0xcd86('0x25')];}_0x22f34b[_0xcd86('0x17')](_0x470c73)[_0xcd86('0x26')](_0x5a4a7);};}function getImapHost(_0x21c797){switch(_0x21c797){case _0xcd86('0x27'):return _0xcd86('0x28');case'yahoo':return _0xcd86('0x29');case'hotmail':return _0xcd86('0x2a');case _0xcd86('0x2b'):return _0xcd86('0x2c');}throw new Error('Unknown\x20email\x20service\x20provider',_0x21c797);}function getSmtpHost(_0x27fbab){switch(_0x27fbab){case'gmail':return'smtp.gmail.com';case _0xcd86('0x2d'):return _0xcd86('0x2e');case _0xcd86('0x2f'):return _0xcd86('0x30');case _0xcd86('0x2b'):return _0xcd86('0x31');}throw new Error(_0xcd86('0x32'),_0x27fbab);}function getAuthenticationOptions(_0x12dcfa,_0x33efba){var _0x54810f={};var _0x381044={};if(_0x12dcfa){_0x54810f[_0xcd86('0x33')]=_0x381044[_0xcd86('0x33')]=_0x33efba[_0xcd86('0x34')];_0x54810f[_0xcd86('0x35')]=_0x381044[_0xcd86('0x36')]=_0x33efba[_0xcd86('0x35')];if(_0x33efba[_0xcd86('0x37')]){_0x54810f[_0xcd86('0x37')]=_0x381044['modernAuthentication']=!![];_0x54810f[_0xcd86('0x38')]=_0x381044[_0xcd86('0x38')]=_0x33efba[_0xcd86('0x38')];_0x54810f[_0xcd86('0x35')]=_0x381044[_0xcd86('0x36')]=null;}else{_0x54810f[_0xcd86('0x38')]=_0x381044[_0xcd86('0x38')]=null;}_0x54810f[_0xcd86('0x39')]=getImapHost(_0x12dcfa);_0x54810f[_0xcd86('0x3a')]=0x3e1;_0x381044[_0xcd86('0x39')]=getSmtpHost(_0x12dcfa);_0x381044['port']=0x24b;_0x381044['secure']=![];_0x54810f['service']=_0x381044[_0xcd86('0x3b')]=null;}else{if(_0x33efba[_0xcd86('0x3c')]){_0x54810f[_0xcd86('0x33')]=_0x381044[_0xcd86('0x33')]=_0x33efba[_0xcd86('0x34')];_0x54810f[_0xcd86('0x35')]=_0x381044[_0xcd86('0x36')]=_0x33efba['password'];}else{_0x54810f[_0xcd86('0x3c')]=_0x381044[_0xcd86('0x3c')]=![];_0x54810f[_0xcd86('0x33')]=_0x381044[_0xcd86('0x33')]=null;_0x54810f['password']=_0x381044[_0xcd86('0x36')]=null;}_0x54810f[_0xcd86('0x39')]=_0x33efba[_0xcd86('0x3d')][_0xcd86('0x39')];_0x54810f[_0xcd86('0x3a')]=_0x33efba['Imap'][_0xcd86('0x3a')];_0x381044[_0xcd86('0x39')]=_0x33efba[_0xcd86('0x3e')][_0xcd86('0x39')];_0x381044['port']=_0x33efba[_0xcd86('0x3e')]['port'];}return{'Imap':_0x54810f,'Smtp':_0x381044};}exports[_0xcd86('0x3f')]=function(_0x5ed4f4,_0x1283b7){var _0x13b0eb={'include':[{'model':db[_0xcd86('0x40')],'as':_0xcd86('0x3d')},{'model':db['MailServerOut'],'as':_0xcd86('0x3e')},{'model':db[_0xcd86('0x41')],'as':'mandatoryDispositionPause'}]},_0x2341f4={},_0x2da7c3={'count':0x0,'rows':[]};var _0x1e4616=_[_0xcd86('0x42')](db['MailAccount'][_0xcd86('0x43')],function(_0x3e34e3){return{'name':_0x3e34e3[_0xcd86('0x44')],'type':_0x3e34e3[_0xcd86('0x45')][_0xcd86('0x46')]};});_0x2341f4['model']=_[_0xcd86('0x42')](_0x1e4616,_0xcd86('0x25'));_0x2341f4['query']=_[_0xcd86('0x47')](_0x5ed4f4['query']);_0x2341f4[_0xcd86('0x48')]=_[_0xcd86('0x49')](_0x2341f4[_0xcd86('0x4a')],_0x2341f4[_0xcd86('0x4b')]);_0x13b0eb[_0xcd86('0x4c')]=_[_0xcd86('0x49')](_0x2341f4[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x13b0eb[_0xcd86('0x4c')]=_0x13b0eb[_0xcd86('0x4c')][_0xcd86('0x4e')]?_0x13b0eb[_0xcd86('0x4c')]:_0x2341f4[_0xcd86('0x4a')];if(!_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x4f')](_0xcd86('0x50'))){_0x13b0eb['limit']=qs[_0xcd86('0x1a')](_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x1a')]);_0x13b0eb[_0xcd86('0x19')]=qs['offset'](_0x5ed4f4[_0xcd86('0x4b')]['offset']);}_0x13b0eb[_0xcd86('0x51')]=qs['sort'](_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x52')]);_0x13b0eb[_0xcd86('0x53')]=qs[_0xcd86('0x48')](_[_0xcd86('0x54')](_0x5ed4f4[_0xcd86('0x4b')],_0x2341f4[_0xcd86('0x48')]),_0x1e4616);if(_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x13b0eb[_0xcd86('0x53')]=_[_0xcd86('0x56')](_0x13b0eb[_0xcd86('0x53')],{'$or':_[_0xcd86('0x42')](_0x1e4616,function(_0x59be46){if(_0x59be46[_0xcd86('0x45')]!==_0xcd86('0x57')){var _0x13520b={};_0x13520b[_0x59be46[_0xcd86('0x25')]]={'$like':'%'+_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x55')]+'%'};return _0x13520b;}})});}_0x13b0eb=_[_0xcd86('0x56')]({},_0x13b0eb,_0x5ed4f4[_0xcd86('0x58')]);var _0x2f31fc={'where':_0x13b0eb[_0xcd86('0x53')]};return db[_0xcd86('0x59')][_0xcd86('0x1c')](_0x2f31fc)['then'](function(_0xbce39b){_0x2da7c3[_0xcd86('0x1c')]=_0xbce39b;if(_0x5ed4f4[_0xcd86('0x4b')][_0xcd86('0x5a')]){_0x13b0eb[_0xcd86('0x5b')]=[{'all':!![]}];}return db[_0xcd86('0x59')][_0xcd86('0x5c')](_0x13b0eb);})[_0xcd86('0x1e')](function(_0x41f823){_0x2da7c3['rows']=_0x41f823;return _0x2da7c3;})[_0xcd86('0x1e')](respondWithFilteredResult(_0x1283b7,_0x13b0eb))['catch'](handleError(_0x1283b7,null));};exports[_0xcd86('0x5d')]=function(_0x46b62a,_0x38cbea){var _0xab16c5={'raw':![],'where':{'id':_0x46b62a[_0xcd86('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xcd86('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xcd86('0x41')],'as':_0xcd86('0x5f')}]},_0xc13948={};_0xc13948[_0xcd86('0x4a')]=_[_0xcd86('0x47')](db['MailAccount'][_0xcd86('0x43')]);_0xc13948[_0xcd86('0x4b')]=_[_0xcd86('0x47')](_0x46b62a['query']);_0xc13948[_0xcd86('0x48')]=_[_0xcd86('0x49')](_0xc13948[_0xcd86('0x4a')],_0xc13948[_0xcd86('0x4b')]);_0xab16c5[_0xcd86('0x4c')]=_[_0xcd86('0x49')](_0xc13948[_0xcd86('0x4a')],qs['fields'](_0x46b62a[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0xab16c5[_0xcd86('0x4c')]=_0xab16c5[_0xcd86('0x4c')][_0xcd86('0x4e')]?_0xab16c5[_0xcd86('0x4c')]:_0xc13948[_0xcd86('0x4a')];if(_0x46b62a[_0xcd86('0x4b')][_0xcd86('0x5a')]){_0xab16c5[_0xcd86('0x5b')]=[{'all':!![]}];}_0xab16c5=_[_0xcd86('0x56')]({},_0xab16c5,_0x46b62a[_0xcd86('0x58')]);return db[_0xcd86('0x59')]['find'](_0xab16c5)['then'](handleEntityNotFound(_0x38cbea,null))[_0xcd86('0x1e')](respondWithResult(_0x38cbea,null))['catch'](handleError(_0x38cbea,null));};exports['update']=function(_0x5410b5,_0x15a491){if(_0x5410b5[_0xcd86('0x60')]['id']){delete _0x5410b5[_0xcd86('0x60')]['id'];}var _0x164346=_0x5410b5[_0xcd86('0x60')]['provider']===_0xcd86('0x61')?null:_0x5410b5[_0xcd86('0x60')][_0xcd86('0x62')];var _0x862718=_0x5410b5[_0xcd86('0x60')]['Imap']||{};var _0x3b3b6d=_0x5410b5['body'][_0xcd86('0x3e')]||{};if(_0x164346){_0x862718[_0xcd86('0x39')]=getImapHost(_0x164346);_0x862718[_0xcd86('0x3a')]=0x3e1;_0x3b3b6d[_0xcd86('0x39')]=getSmtpHost(_0x164346);_0x3b3b6d['port']=0x24b;_0x3b3b6d[_0xcd86('0x63')]=![];}if(_0x3b3b6d['modernAuthentication']){_0x3b3b6d[_0xcd86('0x63')]=![];}else{_0x3b3b6d['CloudProviderId']=null;}if(!_0x862718[_0xcd86('0x37')])_0x862718[_0xcd86('0x38')]=null;_0x5410b5['body'][_0xcd86('0x3d')]=_0x862718;_0x5410b5['body'][_0xcd86('0x3e')]=_0x3b3b6d;return db['MailAccount'][_0xcd86('0x64')]({'where':{'id':_0x5410b5[_0xcd86('0x5e')]['id']},'include':[{'model':db[_0xcd86('0x40')],'as':_0xcd86('0x3d')},{'model':db['MailServerOut'],'as':_0xcd86('0x3e')},{'model':db[_0xcd86('0x41')],'as':_0xcd86('0x5f')}]})[_0xcd86('0x1e')](handleEntityNotFound(_0x15a491,null))['then'](function(_0x3fc92d){if(!_0x3fc92d)throw new Error(_0xcd86('0x65'));if(_0x3fc92d[_0xcd86('0x3b')])delete _0x5410b5[_0xcd86('0x60')][_0xcd86('0x3d')];return _0x3fc92d;})[_0xcd86('0x1e')](saveUpdates(_0x5410b5['body'],null))[_0xcd86('0x1e')](function(_0x2cbd45){if(!_0x5410b5[_0xcd86('0x60')][_0xcd86('0x3d')])return _0x2cbd45;return db[_0xcd86('0x40')]['update'](_0x5410b5[_0xcd86('0x60')][_0xcd86('0x3d')],{'where':{'MailAccountId':_0x2cbd45['id']}})[_0xcd86('0x1e')](function(){return _0x2cbd45;});})['then'](function(_0x12c20d){if(!_0x5410b5[_0xcd86('0x60')][_0xcd86('0x3e')])return _0x12c20d;return db[_0xcd86('0x66')]['update'](_0x5410b5[_0xcd86('0x60')][_0xcd86('0x3e')],{'where':{'MailAccountId':_0x12c20d['id']}})[_0xcd86('0x1e')](function(){return _0x12c20d;});})['then'](respondWithResult(_0x15a491,null))[_0xcd86('0x15')](handleError(_0x15a491,null));};exports[_0xcd86('0x67')]=function(_0x1b5681,_0x1a477c){return db[_0xcd86('0x59')][_0xcd86('0x67')]()['then'](respondWithResult(_0x1a477c,null))[_0xcd86('0x15')](handleError(_0x1a477c,null));};exports[_0xcd86('0x68')]=function(_0x3eb0d6,_0x5b32c9){if(_0x3eb0d6[_0xcd86('0x60')]['id']){delete _0x3eb0d6['body']['id'];}return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x3eb0d6[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x5b32c9,null))[_0xcd86('0x1e')](function(_0x446990){if(_0x446990){_0x3eb0d6['body'][_0xcd86('0x69')]=_0x446990['id'];return db[_0xcd86('0x6a')][_0xcd86('0x6b')](_0x3eb0d6[_0xcd86('0x60')]);}})['then'](respondWithResult(_0x5b32c9,null))[_0xcd86('0x15')](handleError(_0x5b32c9,null));};exports['getDispositions']=function(_0x427755,_0x51893d){var _0x2dd412={'raw':![],'where':{}};var _0x4490c9={};var _0x488cbc={'count':0x0,'rows':[]};return db[_0xcd86('0x59')][_0xcd86('0x6c')]({'where':{'id':_0x427755[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x51893d,null))[_0xcd86('0x1e')](function(_0x80e46d){if(_0x80e46d){_0x4490c9[_0xcd86('0x4a')]=_[_0xcd86('0x47')](db['Disposition']['rawAttributes']);_0x4490c9[_0xcd86('0x4b')]=_[_0xcd86('0x47')](_0x427755[_0xcd86('0x4b')]);_0x4490c9[_0xcd86('0x48')]=_['intersection'](_0x4490c9['model'],_0x4490c9[_0xcd86('0x4b')]);_0x2dd412['attributes']=_['intersection'](_0x4490c9[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x427755[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x2dd412['attributes']=_0x2dd412['attributes'][_0xcd86('0x4e')]?_0x2dd412[_0xcd86('0x4c')]:_0x4490c9[_0xcd86('0x4a')];if(!_0x427755['query'][_0xcd86('0x4f')](_0xcd86('0x50'))){_0x2dd412[_0xcd86('0x1a')]=qs['limit'](_0x427755[_0xcd86('0x4b')][_0xcd86('0x1a')]);_0x2dd412[_0xcd86('0x19')]=qs['offset'](_0x427755['query'][_0xcd86('0x19')]);}_0x2dd412[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0x427755[_0xcd86('0x4b')][_0xcd86('0x52')]);_0x2dd412['where']=qs[_0xcd86('0x48')](_[_0xcd86('0x54')](_0x427755[_0xcd86('0x4b')],_0x4490c9[_0xcd86('0x48')]));_0x2dd412[_0xcd86('0x53')]['MailAccountId']=_0x80e46d['id'];if(_0x427755[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x2dd412['where']=_['merge'](_0x2dd412[_0xcd86('0x53')],{'$or':_[_0xcd86('0x42')](_0x2dd412[_0xcd86('0x4c')],function(_0x3a708e){var _0x9afb5d={};_0x9afb5d[_0x3a708e]={'$like':'%'+_0x427755[_0xcd86('0x4b')]['filter']+'%'};return _0x9afb5d;})});}_0x2dd412=_[_0xcd86('0x56')]({},_0x2dd412,_0x427755['options']);return db['Disposition']['count']({'where':_0x2dd412[_0xcd86('0x53')]})['then'](function(_0xcaf643){_0x488cbc[_0xcd86('0x1c')]=_0xcaf643;if(_0x427755['query'][_0xcd86('0x5a')]){_0x2dd412[_0xcd86('0x5b')]=[{'all':!![]}];}return db[_0xcd86('0x6a')][_0xcd86('0x5c')](_0x2dd412);})[_0xcd86('0x1e')](function(_0x170a29){_0x488cbc[_0xcd86('0x6d')]=_0x170a29;return _0x488cbc;});}})[_0xcd86('0x1e')](respondWithFilteredResult(_0x51893d,_0x2dd412))[_0xcd86('0x15')](handleError(_0x51893d,null));};exports[_0xcd86('0x6e')]=function(_0x259fb4,_0x52f1a2){return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x259fb4['params']['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x52f1a2,null))[_0xcd86('0x1e')](function(_0x14f7c3){if(_0x14f7c3){return _0x14f7c3[_0xcd86('0x6e')](_0x259fb4[_0xcd86('0x4b')]['ids']);}})[_0xcd86('0x1e')](respondWithStatusCode(_0x52f1a2,null))[_0xcd86('0x15')](handleError(_0x52f1a2,null));};exports[_0xcd86('0x6f')]=function(_0x48a6d6,_0xc3d771){if(_0x48a6d6['body']['id']){delete _0x48a6d6['body']['id'];}return db[_0xcd86('0x59')]['find']({'where':{'id':_0x48a6d6[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0xc3d771,null))[_0xcd86('0x1e')](function(_0x42b81c){if(_0x42b81c){_0x48a6d6[_0xcd86('0x60')][_0xcd86('0x69')]=_0x42b81c['id'];return db[_0xcd86('0x70')][_0xcd86('0x6b')](_0x48a6d6[_0xcd86('0x60')]);}})[_0xcd86('0x1e')](respondWithResult(_0xc3d771,null))[_0xcd86('0x15')](handleError(_0xc3d771,null));};exports[_0xcd86('0x71')]=function(_0x5af30b,_0x575ce9){var _0x426f6a={'raw':![],'where':{}};var _0xf7d4e1={};var _0x4ad530={'count':0x0,'rows':[]};return db[_0xcd86('0x59')]['findOne']({'where':{'id':_0x5af30b['params']['id']}})['then'](handleEntityNotFound(_0x575ce9,null))[_0xcd86('0x1e')](function(_0x2d0735){if(_0x2d0735){_0xf7d4e1[_0xcd86('0x4a')]=_[_0xcd86('0x47')](db[_0xcd86('0x70')][_0xcd86('0x43')]);_0xf7d4e1[_0xcd86('0x4b')]=_[_0xcd86('0x47')](_0x5af30b['query']);_0xf7d4e1['filters']=_[_0xcd86('0x49')](_0xf7d4e1[_0xcd86('0x4a')],_0xf7d4e1[_0xcd86('0x4b')]);_0x426f6a[_0xcd86('0x4c')]=_[_0xcd86('0x49')](_0xf7d4e1[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x5af30b[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x426f6a[_0xcd86('0x4c')]=_0x426f6a[_0xcd86('0x4c')][_0xcd86('0x4e')]?_0x426f6a['attributes']:_0xf7d4e1['model'];if(!_0x5af30b[_0xcd86('0x4b')][_0xcd86('0x4f')](_0xcd86('0x50'))){_0x426f6a[_0xcd86('0x1a')]=qs['limit'](_0x5af30b['query']['limit']);_0x426f6a[_0xcd86('0x19')]=qs[_0xcd86('0x19')](_0x5af30b[_0xcd86('0x4b')][_0xcd86('0x19')]);}_0x426f6a[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0x5af30b[_0xcd86('0x4b')][_0xcd86('0x52')]);_0x426f6a[_0xcd86('0x53')]=qs[_0xcd86('0x48')](_[_0xcd86('0x54')](_0x5af30b[_0xcd86('0x4b')],_0xf7d4e1[_0xcd86('0x48')]));_0x426f6a[_0xcd86('0x53')][_0xcd86('0x69')]=_0x2d0735['id'];if(_0x5af30b[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x426f6a[_0xcd86('0x53')]=_['merge'](_0x426f6a['where'],{'$or':_[_0xcd86('0x42')](_0x426f6a[_0xcd86('0x4c')],function(_0x3f5243){var _0x1be537={};_0x1be537[_0x3f5243]={'$like':'%'+_0x5af30b['query']['filter']+'%'};return _0x1be537;})});}_0x426f6a=_[_0xcd86('0x56')]({},_0x426f6a,_0x5af30b[_0xcd86('0x58')]);return db[_0xcd86('0x70')][_0xcd86('0x1c')]({'where':_0x426f6a[_0xcd86('0x53')]})[_0xcd86('0x1e')](function(_0x2f4e87){_0x4ad530[_0xcd86('0x1c')]=_0x2f4e87;if(_0x5af30b['query'][_0xcd86('0x5a')]){_0x426f6a[_0xcd86('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcd86('0x5c')](_0x426f6a);})[_0xcd86('0x1e')](function(_0x3cd444){_0x4ad530[_0xcd86('0x6d')]=_0x3cd444;return _0x4ad530;});}})['then'](respondWithFilteredResult(_0x575ce9,_0x426f6a))[_0xcd86('0x15')](handleError(_0x575ce9,null));};exports[_0xcd86('0x72')]=function(_0x59d652,_0x316f7d){return db['MailAccount']['find']({'where':{'id':_0x59d652['params']['id']}})['then'](handleEntityNotFound(_0x316f7d,null))[_0xcd86('0x1e')](function(_0x51e541){if(_0x51e541){return _0x51e541['removeAnswers'](_0x59d652[_0xcd86('0x4b')][_0xcd86('0x73')]);}})['then'](respondWithStatusCode(_0x316f7d,null))['catch'](handleError(_0x316f7d,null));};exports[_0xcd86('0x6b')]=function(_0x51d1eb,_0x293a9d){var _0x21f685={'name':_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x25')],'key':_0x51d1eb[_0xcd86('0x60')]['key'],'provider':_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x62')]===_0xcd86('0x61')?null:_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x62')],'email':_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x74')],'ListId':_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x75')],'active':!_[_0xcd86('0x76')](_0x51d1eb[_0xcd86('0x60')][_0xcd86('0x77')])?_0x51d1eb['body'][_0xcd86('0x77')]:!![],'description':_0x51d1eb[_0xcd86('0x60')]['description']||null};var _0x265736=getAuthenticationOptions(_0x21f685[_0xcd86('0x62')],_0x51d1eb['body']);_0x21f685[_0xcd86('0x3d')]=_0x265736[_0xcd86('0x3d')];_0x21f685[_0xcd86('0x3e')]=_0x265736['Smtp'];return db[_0xcd86('0x59')]['create'](_0x21f685,{'include':[{'model':db[_0xcd86('0x66')],'as':_0xcd86('0x3e')},{'model':db[_0xcd86('0x40')],'as':_0xcd86('0x3d')}]})[_0xcd86('0x1e')](function(_0x481c43){var _0x4efb56=_0x51d1eb[_0xcd86('0x33')][_0xcd86('0x20')]({'plain':!![]});if(!_0x4efb56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4efb56[_0xcd86('0x78')]==='user'){var _0x25d6da=_0x481c43[_0xcd86('0x20')]({'plain':!![]});return db[_0xcd86('0x79')][_0xcd86('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x4efb56['userProfileId']},'raw':!![]})['then'](function(_0x3a12f7){if(_0x3a12f7&&_0x3a12f7[_0xcd86('0x7a')]===0x0){return db[_0xcd86('0x22')][_0xcd86('0x6b')]({'name':_0x25d6da['name'],'resourceId':_0x25d6da['id'],'type':_0x3a12f7[_0xcd86('0x25')],'sectionId':_0x3a12f7['id']},{})[_0xcd86('0x1e')](function(){return _0x481c43;});}else{return _0x481c43;}})['catch'](function(_0x236c77){logger[_0xcd86('0x13')](_0xcd86('0x7b'),_0x236c77);throw _0x236c77;});}return _0x481c43;})[_0xcd86('0x1e')](respondWithResult(_0x293a9d,0xc9))[_0xcd86('0x15')](handleError(_0x293a9d,null));};exports[_0xcd86('0x7c')]=function(_0xd6024a,_0x2302a8){return db[_0xcd86('0x59')][_0xcd86('0x6c')]({'where':{'id':_0xd6024a[_0xcd86('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2302a8,null))[_0xcd86('0x1e')](function(_0x5a10b3){if(_0x5a10b3){return _0x5a10b3[_0xcd86('0x7c')]();}return null;})['then'](respondWithResult(_0x2302a8,null))[_0xcd86('0x15')](handleError(_0x2302a8,null));};exports[_0xcd86('0x7d')]=function(_0x42adbd,_0x2b6340){if(_0x42adbd[_0xcd86('0x60')]['id']){delete _0x42adbd[_0xcd86('0x60')]['id'];}return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x42adbd[_0xcd86('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b6340,null))[_0xcd86('0x1e')](function(_0x284414){if(_0x284414){_0x42adbd[_0xcd86('0x60')][_0xcd86('0x69')]=_0x284414['id'];return db[_0xcd86('0x40')][_0xcd86('0x6b')](_0x42adbd['body']);}})[_0xcd86('0x1e')](respondWithResult(_0x2b6340,null))[_0xcd86('0x15')](handleError(_0x2b6340,null));};exports[_0xcd86('0x7e')]=function(_0x251884,_0x3dc33c){return db[_0xcd86('0x59')][_0xcd86('0x6c')]({'where':{'id':_0x251884['params']['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x3dc33c,null))[_0xcd86('0x1e')](function(_0x59f03e){if(_0x59f03e){return _0x59f03e[_0xcd86('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x3dc33c,null))[_0xcd86('0x15')](handleError(_0x3dc33c,null));};exports[_0xcd86('0x80')]=function(_0x12ce96,_0x27245d){return db['MailAccount'][_0xcd86('0x6c')]({'where':{'id':_0x12ce96[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x27245d,null))[_0xcd86('0x1e')](function(_0x4a8cb1){if(_0x4a8cb1){return _0x4a8cb1[_0xcd86('0x80')]();}return null;})[_0xcd86('0x1e')](respondWithResult(_0x27245d,null))[_0xcd86('0x15')](handleError(_0x27245d,null));};exports[_0xcd86('0x81')]=function(_0x443222,_0x263e5c){if(_0x443222[_0xcd86('0x60')]['id']){delete _0x443222[_0xcd86('0x60')]['id'];}return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x443222[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x263e5c,null))[_0xcd86('0x1e')](function(_0xad3c87){if(_0xad3c87){_0x443222[_0xcd86('0x60')][_0xcd86('0x69')]=_0xad3c87['id'];return db[_0xcd86('0x66')]['create'](_0x443222[_0xcd86('0x60')]);}})[_0xcd86('0x1e')](respondWithResult(_0x263e5c,null))[_0xcd86('0x15')](handleError(_0x263e5c,null));};exports[_0xcd86('0x82')]=function(_0x12c09d,_0x5ed694){return db[_0xcd86('0x59')][_0xcd86('0x6c')]({'where':{'id':_0x12c09d[_0xcd86('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ed694,null))[_0xcd86('0x1e')](function(_0xd81db9){if(_0xd81db9){return _0xd81db9['setSmtp'](null);}return null;})[_0xcd86('0x1e')](respondWithStatusCode(_0x5ed694,null))[_0xcd86('0x15')](handleError(_0x5ed694,null));};exports[_0xcd86('0x83')]=function(_0x2ac705,_0xb61a38){return db[_0xcd86('0x84')][_0xcd86('0x64')]({'where':{'id':_0x2ac705['params']['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0xb61a38,null))[_0xcd86('0x1e')](function(_0x45d43d){if(_0x45d43d){return _0x45d43d[_0xcd86('0x83')](_0x2ac705['body'][_0xcd86('0x73')],_[_0xcd86('0x85')](_0x2ac705['body'],[_0xcd86('0x73'),'id'])||{});}})[_0xcd86('0x1e')](respondWithResult(_0xb61a38,null))[_0xcd86('0x15')](handleError(_0xb61a38,null));};exports['getInteractions']=function(_0xdd76c1,_0x28f0bc){var _0x5a9c0e={'raw':![],'where':{}};var _0x3e2f38={};var _0x42fbfe={'count':0x0,'rows':[]};return db[_0xcd86('0x59')]['findOne']({'where':{'id':_0xdd76c1[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x28f0bc,null))[_0xcd86('0x1e')](function(_0x215aae){if(_0x215aae){_0x3e2f38[_0xcd86('0x4a')]=_[_0xcd86('0x47')](db[_0xcd86('0x84')]['rawAttributes']);_0x3e2f38[_0xcd86('0x4b')]=_['keys'](_0xdd76c1[_0xcd86('0x4b')]);_0x3e2f38['filters']=_[_0xcd86('0x49')](_0x3e2f38[_0xcd86('0x4a')],_0x3e2f38[_0xcd86('0x4b')]);_0x5a9c0e['attributes']=_[_0xcd86('0x49')](_0x3e2f38[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x5a9c0e[_0xcd86('0x4c')]=_0x5a9c0e[_0xcd86('0x4c')]['length']?_0x5a9c0e[_0xcd86('0x4c')]:_0x3e2f38['model'];if(!_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x4f')]('nolimit')){_0x5a9c0e['limit']=qs['limit'](_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x1a')]);_0x5a9c0e[_0xcd86('0x19')]=qs['offset'](_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x19')]);}_0x5a9c0e[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x52')]);_0x5a9c0e['where']=qs[_0xcd86('0x48')](_[_0xcd86('0x54')](_0xdd76c1['query'],_0x3e2f38[_0xcd86('0x48')]));_0x5a9c0e[_0xcd86('0x53')]['MailAccountId']=_0x215aae['id'];if(_0xdd76c1['query'][_0xcd86('0x55')]){_0x5a9c0e[_0xcd86('0x53')]=_[_0xcd86('0x56')](_0x5a9c0e['where'],{'$or':_[_0xcd86('0x42')](_0x5a9c0e[_0xcd86('0x4c')],function(_0x13a9ed){var _0x4e2b38={};_0x4e2b38[_0x13a9ed]={'$like':'%'+_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x55')]+'%'};return _0x4e2b38;})});}_0x5a9c0e=_[_0xcd86('0x56')]({},_0x5a9c0e,_0xdd76c1[_0xcd86('0x58')]);return db[_0xcd86('0x84')][_0xcd86('0x1c')]({'where':_0x5a9c0e['where']})['then'](function(_0xcabfca){_0x42fbfe[_0xcd86('0x1c')]=_0xcabfca;if(_0xdd76c1['query'][_0xcd86('0x5a')]){_0x5a9c0e[_0xcd86('0x5b')]=[{'model':db[_0xcd86('0x86')],'as':'Contact','required':![]},{'model':db[_0xcd86('0x87')],'as':'Owner','attributes':[_0xcd86('0x25'),_0xcd86('0x88'),_0xcd86('0x89')],'required':![]},{'model':db[_0xcd86('0x8a')],'as':'Tags','attributes':['id','name',_0xcd86('0x8b')],'where':_0xdd76c1['query'][_0xcd86('0x8c')]?{'id':_0xdd76c1[_0xcd86('0x4b')][_0xcd86('0x8c')]}:undefined,'required':_0xdd76c1[_0xcd86('0x4b')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xcd86('0x5c')](_0x5a9c0e);})['then'](function(_0x3411bc){_0x42fbfe[_0xcd86('0x6d')]=_0x3411bc;return _0x42fbfe;});}})[_0xcd86('0x1e')](respondWithFilteredResult(_0x28f0bc,_0x5a9c0e))[_0xcd86('0x15')](handleError(_0x28f0bc,null));};exports[_0xcd86('0x8d')]=function addApplications(_0x3b8689,_0x5d892b){var _0x2a1e83=_0x3b8689[_0xcd86('0x5e')]['id'];var _0x1dc698=_0x3b8689[_0xcd86('0x60')];var _0x3a690a=0xc8;var _0x4c5707=null;return db[_0xcd86('0x8e')][_0xcd86('0x8f')]({'isolationLevel':db[_0xcd86('0x8e')][_0xcd86('0x90')][_0xcd86('0x91')][_0xcd86('0x92')]},function(_0x3fc9c1){return db[_0xcd86('0x59')][_0xcd86('0x6c')]({'where':{'id':_0x2a1e83},'transaction':_0x3fc9c1})['then'](function(_0xd80841){if(_0xd80841){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x2a1e83},'transaction':_0x3fc9c1})['then'](function(){var _0x1107fd=_[_0xcd86('0x42')](_0x1dc698,function(_0x59e57b){_0x59e57b[_0xcd86('0x69')]=_0x2a1e83;return _0x59e57b;});return db[_0xcd86('0x93')][_0xcd86('0x94')](_0x1107fd,{'transaction':_0x3fc9c1});});}else{_0x3a690a=0x194;_0x4c5707=[];}});})['then'](function(){if(_0x3a690a!==0x194){return db[_0xcd86('0x93')][_0xcd86('0x95')]({'where':{'MailAccountId':_0x2a1e83},'order':_0xcd86('0x96')})['then'](function(_0x471dbe){_0x4c5707=_0x471dbe;});}})[_0xcd86('0x15')](function(_0x51f479){_0x3a690a=0x1f4;logger['error'](_0x51f479[_0xcd86('0x24')]);if(_0x51f479['name']){delete _0x51f479[_0xcd86('0x25')];}_0x4c5707=_0x51f479;})[_0xcd86('0x97')](function(){if(_0x4c5707===null){_0x5d892b['sendStatus'](_0x3a690a);}else{if(_0x3a690a===0x1f4){_0x5d892b[_0xcd86('0x17')](_0x3a690a)[_0xcd86('0x26')](_0x4c5707);}else{_0x5d892b['status'](_0x3a690a)[_0xcd86('0x18')](_0x4c5707);}}});};exports['getApplications']=function(_0x197063,_0x4f2cd9){var _0x2f0f40={};var _0x344205={};var _0x2dddda;var _0x176087;return db[_0xcd86('0x59')]['findOne']({'where':{'id':_0x197063[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x4f2cd9,null))['then'](function(_0x354f8e){if(_0x354f8e){_0x2dddda=_0x354f8e;_0x344205[_0xcd86('0x4a')]=_['keys'](db[_0xcd86('0x93')]['rawAttributes']);_0x344205['query']=_[_0xcd86('0x47')](_0x197063[_0xcd86('0x4b')]);_0x344205[_0xcd86('0x48')]=_[_0xcd86('0x49')](_0x344205[_0xcd86('0x4a')],_0x344205[_0xcd86('0x4b')]);_0x2f0f40['attributes']=_[_0xcd86('0x49')](_0x344205[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x197063[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x2f0f40[_0xcd86('0x4c')]=_0x2f0f40[_0xcd86('0x4c')][_0xcd86('0x4e')]?_0x2f0f40[_0xcd86('0x4c')]:_0x344205[_0xcd86('0x4a')];_0x2f0f40[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0x197063['query'][_0xcd86('0x52')]);_0x2f0f40[_0xcd86('0x53')]=qs['filters'](_[_0xcd86('0x54')](_0x197063[_0xcd86('0x4b')],_0x344205[_0xcd86('0x48')]));if(_0x197063[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x2f0f40[_0xcd86('0x53')]=_[_0xcd86('0x56')](_0x2f0f40['where'],{'$or':_[_0xcd86('0x42')](_0x2f0f40[_0xcd86('0x4c')],function(_0x8c3024){var _0xe69b49={};_0xe69b49[_0x8c3024]={'$like':'%'+_0x197063[_0xcd86('0x4b')][_0xcd86('0x55')]+'%'};return _0xe69b49;})});}_0x2f0f40=_[_0xcd86('0x56')]({},_0x2f0f40,_0x197063['options']);return _0x2dddda[_0xcd86('0x98')](_0x2f0f40);}})[_0xcd86('0x1e')](function(_0x207597){if(_0x207597){_0x176087=_0x207597[_0xcd86('0x4e')];if(!_0x197063[_0xcd86('0x4b')][_0xcd86('0x4f')](_0xcd86('0x50'))){_0x2f0f40[_0xcd86('0x1a')]=qs[_0xcd86('0x1a')](_0x197063[_0xcd86('0x4b')]['limit']);_0x2f0f40[_0xcd86('0x19')]=qs[_0xcd86('0x19')](_0x197063['query'][_0xcd86('0x19')]);}return _0x2dddda[_0xcd86('0x98')](_0x2f0f40);}})[_0xcd86('0x1e')](function(_0x340ee1){if(_0x340ee1){return _0x340ee1?{'count':_0x176087,'rows':_0x340ee1}:null;}})[_0xcd86('0x1e')](respondWithResult(_0x4f2cd9,null))['catch'](handleError(_0x4f2cd9,null));};exports[_0xcd86('0x99')]=function(_0x19ca26,_0x7ba693){var _0x1297ae={'raw':!![],'where':{}};var _0x45a48a={};var _0x4e7485={'count':0x0,'rows':[]};return db['MailAccount'][_0xcd86('0x6c')]({'where':{'id':_0x19ca26[_0xcd86('0x5e')]['id']}})['then'](handleEntityNotFound(_0x7ba693,null))[_0xcd86('0x1e')](function(_0x35ce38){if(_0x35ce38){_0x45a48a['model']=_['keys'](db[_0xcd86('0x9a')][_0xcd86('0x43')]);_0x45a48a[_0xcd86('0x4b')]=_['keys'](_0x19ca26[_0xcd86('0x4b')]);_0x45a48a['filters']=_[_0xcd86('0x49')](_0x45a48a[_0xcd86('0x4a')],_0x45a48a['query']);_0x1297ae[_0xcd86('0x4c')]=_['intersection'](_0x45a48a[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x4d')]));_0x1297ae['attributes']=_0x1297ae['attributes']['length']?_0x1297ae[_0xcd86('0x4c')]:_0x45a48a[_0xcd86('0x4a')];if(!_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x4f')](_0xcd86('0x50'))){_0x1297ae[_0xcd86('0x1a')]=qs[_0xcd86('0x1a')](_0x19ca26[_0xcd86('0x4b')]['limit']);_0x1297ae[_0xcd86('0x19')]=qs[_0xcd86('0x19')](_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x19')]);}_0x1297ae[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x52')]);_0x1297ae[_0xcd86('0x53')]=qs[_0xcd86('0x48')](_['pick'](_0x19ca26['query'],_0x45a48a[_0xcd86('0x48')]));_0x1297ae[_0xcd86('0x53')][_0xcd86('0x69')]=_0x35ce38['id'];if(_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x1297ae[_0xcd86('0x53')]=_[_0xcd86('0x56')](_0x1297ae['where'],{'$or':_[_0xcd86('0x42')](_0x1297ae[_0xcd86('0x4c')],function(_0x4dbf37){var _0x166170={};_0x166170[_0x4dbf37]={'$like':'%'+_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x55')]+'%'};return _0x166170;})});}if(_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x9b')]){var _0xf34796=_0x19ca26[_0xcd86('0x4b')][_0xcd86('0x9b')]['split'](',');var _0x208d92={};_0x208d92[_0xf34796[0x0]]={'$gte':moment(_0xf34796[0x1])[_0xcd86('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1297ae['where']=_[_0xcd86('0x56')](_0x1297ae[_0xcd86('0x53')],_0x208d92);}_0x1297ae=_[_0xcd86('0x56')]({},_0x1297ae,_0x19ca26[_0xcd86('0x58')]);return db[_0xcd86('0x9a')]['count']({'where':_0x1297ae['where']})['then'](function(_0x94cf2e){_0x4e7485[_0xcd86('0x1c')]=_0x94cf2e;if(_0x19ca26[_0xcd86('0x4b')]['includeAll']){_0x1297ae[_0xcd86('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0xcd86('0x5c')](_0x1297ae);})[_0xcd86('0x1e')](function(_0x591b4a){if(_0x19ca26[_0xcd86('0x4b')]['inlineCss']==='true'){for(var _0x514020=0x0;_0x514020<_0x591b4a[_0xcd86('0x4e')];_0x514020++){_0x591b4a[_0x514020][_0xcd86('0x60')]=juice(_0x591b4a[_0x514020][_0xcd86('0x60')]);}}_0x4e7485[_0xcd86('0x6d')]=_0x591b4a;return _0x4e7485;});}})[_0xcd86('0x1e')](respondWithFilteredResult(_0x7ba693,_0x1297ae))[_0xcd86('0x15')](handleError(_0x7ba693,null));};exports[_0xcd86('0x26')]=function(_0x4fcf21,_0x584112){var _0x1ce06d,_0x482781={},_0x4d94c9;if(_0x4fcf21[_0xcd86('0x60')]['to']){_0x4d94c9=_0x4fcf21[_0xcd86('0x60')]['to'][_0xcd86('0x9d')](',')[0x0];}return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x4fcf21['params']['id']},'include':[{'model':db[_0xcd86('0x9e')],'as':_0xcd86('0x9f'),'include':[{'model':db[_0xcd86('0x86')],'as':_0xcd86('0xa0'),'where':{'email':_0x4d94c9},'limit':0x1,'order':[[_0xcd86('0xa1'),_0xcd86('0xa2')]]}]},{'model':db[_0xcd86('0x66')],'as':_0xcd86('0x3e'),'raw':!![],'include':[{'model':db[_0xcd86('0xa3')],'as':_0xcd86('0xa3'),'raw':!![]}]}]})[_0xcd86('0x1e')](handleEntityNotFound(_0x584112,null))['then'](function(_0x53a52d){if(!_0x53a52d)return;_0x1ce06d=_0x53a52d;if(!_0x53a52d[_0xcd86('0x3e')])throw new Error(_0xcd86('0xa4'));if(_[_0xcd86('0x76')](_0x4fcf21[_0xcd86('0x60')][_0xcd86('0xa5')])){_0x4fcf21['body'][_0xcd86('0xa5')]=util[_0xcd86('0x9c')](_0xcd86('0xa6'),_0x53a52d[_0xcd86('0x25')],_0x53a52d[_0xcd86('0x74')]||_0x53a52d[_0xcd86('0x3e')][_0xcd86('0x33')]);}if(_0x4fcf21[_0xcd86('0x60')][_0xcd86('0xa7')]&&_0x4fcf21['body'][_0xcd86('0xa7')]['length']){for(var _0x4c9c0f=0x0;_0x4c9c0f<_0x4fcf21[_0xcd86('0x60')]['attachments'][_0xcd86('0x4e')];_0x4c9c0f+=0x1){_0x4fcf21['body']['attachments'][_0x4c9c0f]={'filename':_0x4fcf21['body'][_0xcd86('0xa7')][_0x4c9c0f][_0xcd86('0x25')],'path':path[_0xcd86('0xa8')](config[_0xcd86('0xa9')],_0xcd86('0xaa'),_0x4fcf21[_0xcd86('0x60')][_0xcd86('0xa7')][_0x4c9c0f][_0xcd86('0xab')])};}}var _0x3c64e3=_0x53a52d['getSmtpOptions']();return respondWithRpcPromise(_0xcd86('0xac'),_0xcd86('0xad'),{'account':_0x3c64e3,'message':_0x4fcf21[_0xcd86('0x60')]});})[_0xcd86('0x1e')](function(_0x4d17b7){if(!_0x4d17b7)return;_0x482781=_0x4d17b7;if(!_0x1ce06d[_0xcd86('0x9f')])throw new Error(_0xcd86('0xae'));if(_0x1ce06d[_0xcd86('0x9f')]['Contacts'][_0xcd86('0x4e')])return _0x1ce06d[_0xcd86('0x9f')][_0xcd86('0xa0')][0x0];return db[_0xcd86('0x86')][_0xcd86('0x6b')](_[_0xcd86('0xc')](_0x4fcf21['body'],{'firstName':_0x4fcf21[_0xcd86('0x60')]['to'],'email':_0x4fcf21[_0xcd86('0x60')]['to'],'phone':_0x4fcf21[_0xcd86('0x60')]['to'],'ListId':_0x1ce06d[_0xcd86('0x75')]}));})[_0xcd86('0x1e')](function(_0x4c95a4){if(!_0x4c95a4)return;var _0x31f010={'UserId':_0x4fcf21[_0xcd86('0x33')]['id'],'ContactId':_0x4c95a4['id'],'MailAccountId':_0x1ce06d['id'],'inReplyTo':_0x482781['messageId'],'to':_0x4fcf21[_0xcd86('0x60')][_0xcd86('0xa5')],'cc':_0x4fcf21[_0xcd86('0x60')]['cc'],'subject':_0x4fcf21[_0xcd86('0x60')]['subject'],'attach':_0x4fcf21[_0xcd86('0x60')]['attach'],'firstMsgDirection':_0xcd86('0xaf'),'lastMsgAt':moment()[_0xcd86('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xcd86('0xaf'),'Messages':[_[_0xcd86('0x56')](_0x4fcf21['body'],{'messageId':_0x482781[_0xcd86('0xb0')],'sentAt':moment()[_0xcd86('0x9c')](_0xcd86('0xb1')),'read':!![],'MailAccountId':_0x1ce06d['id'],'UserId':_0x4fcf21[_0xcd86('0x33')]['id'],'ContactId':_0x4c95a4['id']})]};if(_0x4fcf21[_0xcd86('0x60')][_0xcd86('0xb2')]){_0x31f010=_[_0xcd86('0x56')](_0x31f010,_0x4fcf21[_0xcd86('0x60')]['Interaction']);}return db[_0xcd86('0x84')]['create'](_0x31f010,{'include':[{'model':db[_0xcd86('0x9a')],'as':'Messages'}]});})['then'](respondWithResult(_0x584112,null))['catch'](handleError(_0x584112,null));};exports['verifySmtp']=function(_0x5b56ce,_0x442906){return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x5b56ce['params']['id']},'include':[{'model':db[_0xcd86('0x66')],'as':_0xcd86('0x3e'),'raw':!![],'include':[{'model':db[_0xcd86('0xa3')],'as':_0xcd86('0xa3'),'raw':!![]}]}]})[_0xcd86('0x1e')](handleEntityNotFound(_0x442906,null))[_0xcd86('0x1e')](function(_0x57e295){if(!_0x57e295[_0xcd86('0x3e')])return;var _0x3a82d1=_0x57e295['getSmtpOptions']();return respondWithRpcPromise(_0xcd86('0xb3'),'verifySmtp',{'account':_0x3a82d1});})['then'](respondWithResult(_0x442906,null))[_0xcd86('0x15')](handleError(_0x442906,null));};exports[_0xcd86('0x1f')]=function(_0x7bc960,_0x514786){return db['MailAccount'][_0xcd86('0x64')]({'where':{'id':_0x7bc960['params']['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x514786,null))[_0xcd86('0x1e')](function(_0x1413f0){if(_0x1413f0&&_0x1413f0[_0xcd86('0x3b')]){throw new db['Sequelize'][(_0xcd86('0xb4'))](_0xcd86('0xb5'));}return _0x1413f0;})[_0xcd86('0x1e')](removeEntity(_0x514786,null))['catch'](handleError(_0x514786,null));};exports['addAgents']=function(_0x49a772,_0x57b524){return db[_0xcd86('0x59')]['find']({'where':{'id':_0x49a772[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x57b524,null))['then'](function(_0x2ea559){if(_0x2ea559){return _0x2ea559['addAgents'](_0x49a772[_0xcd86('0x60')][_0xcd86('0x73')],_[_0xcd86('0x85')](_0x49a772[_0xcd86('0x60')],[_0xcd86('0x73'),'id'])||{})[_0xcd86('0xb6')](function(_0x95878a){for(var _0xa4f6d3=0x0;_0xa4f6d3<_0x49a772['body'][_0xcd86('0x73')][_0xcd86('0x4e')];_0xa4f6d3+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x49a772[_0xcd86('0x60')][_0xcd86('0x73')][_0xa4f6d3]),'MailAccountId':Number(_0x49a772[_0xcd86('0x5e')]['id'])});}return _0x95878a;});}})['then'](respondWithResult(_0x57b524,null))['catch'](handleError(_0x57b524,null));};exports[_0xcd86('0xb7')]=function(_0x43bbb7,_0x2f4918){return db[_0xcd86('0x59')][_0xcd86('0x64')]({'where':{'id':_0x43bbb7[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x2f4918,null))[_0xcd86('0x1e')](function(_0x20091a){if(_0x20091a){return _0x20091a[_0xcd86('0xb7')](_0x43bbb7['query']['ids'])[_0xcd86('0x1e')](function(){if(_[_0xcd86('0xb8')](_0x43bbb7['query']['ids'])){for(var _0x538bab=0x0;_0x538bab<_0x43bbb7[_0xcd86('0x4b')]['ids'][_0xcd86('0x4e')];_0x538bab+=0x1){socket[_0xcd86('0xb9')](_0xcd86('0xba'),{'UserId':Number(_0x43bbb7[_0xcd86('0x4b')][_0xcd86('0x73')][_0x538bab]),'MailAccountId':Number(_0x43bbb7[_0xcd86('0x5e')]['id'])});}}else{socket[_0xcd86('0xb9')](_0xcd86('0xba'),{'UserId':Number(_0x43bbb7[_0xcd86('0x4b')][_0xcd86('0x73')]),'MailAccountId':Number(_0x43bbb7[_0xcd86('0x5e')]['id'])});}});}})[_0xcd86('0x1e')](respondWithStatusCode(_0x2f4918,null))[_0xcd86('0x15')](handleError(_0x2f4918,null));};exports[_0xcd86('0xbb')]=function(_0x2d0358,_0x1de0b8){var _0x583102={};var _0x5a2c2e={};var _0x3527a9;var _0x889883;return db[_0xcd86('0x59')]['findOne']({'where':{'id':_0x2d0358[_0xcd86('0x5e')]['id']}})[_0xcd86('0x1e')](handleEntityNotFound(_0x1de0b8,null))['then'](function(_0x42b095){if(_0x42b095){_0x3527a9=_0x42b095;_0x5a2c2e[_0xcd86('0x4a')]=_['keys'](db[_0xcd86('0x87')]['rawAttributes']);_0x5a2c2e[_0xcd86('0x4b')]=_[_0xcd86('0x47')](_0x2d0358['query']);_0x5a2c2e[_0xcd86('0x48')]=_['intersection'](_0x5a2c2e[_0xcd86('0x4a')],_0x5a2c2e['query']);_0x583102[_0xcd86('0x4c')]=_[_0xcd86('0x49')](_0x5a2c2e[_0xcd86('0x4a')],qs[_0xcd86('0x4d')](_0x2d0358[_0xcd86('0x4b')]['fields']));_0x583102['attributes']=_0x583102[_0xcd86('0x4c')][_0xcd86('0x4e')]?_0x583102[_0xcd86('0x4c')]:_0x5a2c2e[_0xcd86('0x4a')];_0x583102[_0xcd86('0x51')]=qs[_0xcd86('0x52')](_0x2d0358['query'][_0xcd86('0x52')]);_0x583102[_0xcd86('0x53')]=qs['filters'](_['pick'](_0x2d0358[_0xcd86('0x4b')],_0x5a2c2e[_0xcd86('0x48')]));if(_0x2d0358[_0xcd86('0x4b')][_0xcd86('0x55')]){_0x583102[_0xcd86('0x53')]=_[_0xcd86('0x56')](_0x583102[_0xcd86('0x53')],{'$or':_['map'](_0x583102[_0xcd86('0x4c')],function(_0x31d3a4){var _0x2e8bba={};_0x2e8bba[_0x31d3a4]={'$like':'%'+_0x2d0358[_0xcd86('0x4b')][_0xcd86('0x55')]+'%'};return _0x2e8bba;})});}_0x583102=_[_0xcd86('0x56')]({},_0x583102,_0x2d0358[_0xcd86('0x58')]);return _0x3527a9['getAgents'](_0x583102);}})[_0xcd86('0x1e')](function(_0x32e22b){if(_0x32e22b){_0x889883=_0x32e22b[_0xcd86('0x4e')];if(!_0x2d0358[_0xcd86('0x4b')][_0xcd86('0x4f')]('nolimit')){_0x583102['limit']=qs[_0xcd86('0x1a')](_0x2d0358[_0xcd86('0x4b')][_0xcd86('0x1a')]);_0x583102[_0xcd86('0x19')]=qs['offset'](_0x2d0358[_0xcd86('0x4b')][_0xcd86('0x19')]);}return _0x3527a9[_0xcd86('0xbb')](_0x583102);}})[_0xcd86('0x1e')](function(_0x12bb9d){if(_0x12bb9d){return _0x12bb9d?{'count':_0x889883,'rows':_0x12bb9d}:null;}})[_0xcd86('0x1e')](respondWithResult(_0x1de0b8,null))[_0xcd86('0x15')](handleError(_0x1de0b8,null));}; \ No newline at end of file +var _0xde64=['ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','removeAgents','emit','userMailAccount:remove','getAgents','moment','util','lodash','../../config/logger','api','../../config/environment','../../mysqldb','localhost','redis','./mailAccount.socket','register','jayson/promise','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','Imap','port','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','show','params','MailServerIn','MailServerOut','includeAll','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','merge','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Messages','verifySmtp','VerifySmtp','Sequelize'];(function(_0x55bd29,_0x246900){var _0x413176=function(_0x53ec79){while(--_0x53ec79){_0x55bd29['push'](_0x55bd29['shift']());}};_0x413176(++_0x246900);}(_0xde64,0x197));var _0x4de6=function(_0x55d794,_0x4fe9d6){_0x55d794=_0x55d794-0x0;var _0x30e751=_0xde64[_0x55d794];return _0x30e751;};'use strict';var moment=require(_0x4de6('0x0'));var BPromise=require('bluebird');var util=require(_0x4de6('0x1'));var path=require('path');var _=require(_0x4de6('0x2'));var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x4de6('0x3'))(_0x4de6('0x4'));var config=require(_0x4de6('0x5'));var db=require(_0x4de6('0x6'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4de6('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4de6('0x8')]));require(_0x4de6('0x9'))[_0x4de6('0xa')](socket);var jayson=require(_0x4de6('0xb'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x488cdb,_0x4cb55d,_0x3633ba,_0x463dfa){return new BPromise(function(_0x267aa1,_0x1cc82a){var _0x3c808e=_0x463dfa||client;return _0x3c808e[_0x4de6('0xc')](_0x488cdb,_0x3633ba)[_0x4de6('0xd')](function(_0x2ff489){logger[_0x4de6('0xe')](_0x4de6('0xf'),_0x4cb55d,_0x4de6('0x10'));logger[_0x4de6('0x11')](_0x4de6('0x12'),_0x4cb55d,_0x4de6('0x10'),JSON[_0x4de6('0x13')](_0x2ff489));if(_0x2ff489[_0x4de6('0x14')]){if(_0x2ff489['error'][_0x4de6('0x15')]===0x1f4){logger[_0x4de6('0x14')](_0x4de6('0xf'),_0x4cb55d,_0x2ff489[_0x4de6('0x14')]['message']);return _0x1cc82a(_0x2ff489['error'][_0x4de6('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4cb55d,_0x2ff489[_0x4de6('0x14')][_0x4de6('0x16')]);return _0x267aa1(_0x2ff489[_0x4de6('0x14')][_0x4de6('0x16')]);}else{logger[_0x4de6('0xe')](_0x4de6('0xf'),_0x4cb55d,_0x4de6('0x10'));_0x267aa1(_0x2ff489[_0x4de6('0x17')][_0x4de6('0x16')]);}})[_0x4de6('0x18')](function(_0x4f9558){logger[_0x4de6('0x14')](_0x4de6('0xf'),_0x4cb55d,_0x4f9558);_0x1cc82a(_0x4f9558);});});}function respondWithStatusCode(_0x3d706b,_0xcb831){_0xcb831=_0xcb831||0xcc;return function(_0x52e145){if(_0x52e145){return _0x3d706b[_0x4de6('0x19')](_0xcb831);}return _0x3d706b[_0x4de6('0x1a')](_0xcb831)[_0x4de6('0x1b')]();};}function respondWithResult(_0x25f267,_0x77ab46){_0x77ab46=_0x77ab46||0xc8;return function(_0x47c757){if(_0x47c757){return _0x25f267[_0x4de6('0x1a')](_0x77ab46)['json'](_0x47c757);}};}function respondWithFilteredResult(_0xfdb169,_0x52b042){return function(_0x1a2797){if(_0x1a2797){var _0x22c257=typeof _0x52b042[_0x4de6('0x1c')]===_0x4de6('0x1d')&&typeof _0x52b042[_0x4de6('0x1e')]===_0x4de6('0x1d');var _0x204526=_0x1a2797[_0x4de6('0x1f')];var _0x21335b=_0x22c257?0x0:_0x52b042[_0x4de6('0x1c')];var _0x5d9315=_0x22c257?_0x1a2797[_0x4de6('0x1f')]:_0x52b042[_0x4de6('0x1c')]+_0x52b042['limit'];var _0x37bd27;if(_0x5d9315>=_0x204526){_0x5d9315=_0x204526;_0x37bd27=0xc8;}else{_0x37bd27=0xce;}_0xfdb169[_0x4de6('0x1a')](_0x37bd27);return _0xfdb169[_0x4de6('0x20')](_0x4de6('0x21'),_0x21335b+'-'+_0x5d9315+'/'+_0x204526)[_0x4de6('0x22')](_0x1a2797);}return null;};}function saveUpdates(_0x208b03){return function(_0x5e0638){if(_0x5e0638){return _0x5e0638[_0x4de6('0x23')](_0x208b03)[_0x4de6('0xd')](function(_0xc76977){return _0xc76977;});}return null;};}function removeEntity(_0xa1f1e0){return function(_0x58d301){if(_0x58d301){return _0x58d301[_0x4de6('0x24')]()['then'](function(){var _0x158ab0=_0x58d301[_0x4de6('0x25')]({'plain':!![]});var _0x37e2ef=_0x4de6('0x26');return db[_0x4de6('0x27')]['destroy']({'where':{'type':_0x37e2ef,'resourceId':_0x158ab0['id']}})[_0x4de6('0xd')](function(){return _0x58d301;});})[_0x4de6('0xd')](function(){_0xa1f1e0['status'](0xcc)[_0x4de6('0x1b')]();});}};}function handleEntityNotFound(_0x1ed6b2){return function(_0x26dcf9){if(!_0x26dcf9){_0x1ed6b2['sendStatus'](0x194);}return _0x26dcf9;};}function handleError(_0x428351,_0x3b0cd2){_0x3b0cd2=_0x3b0cd2||0x1f4;return function(_0x56547b){logger[_0x4de6('0x14')](_0x56547b[_0x4de6('0x28')]);if(_0x56547b[_0x4de6('0x29')]){delete _0x56547b[_0x4de6('0x29')];}_0x428351['status'](_0x3b0cd2)[_0x4de6('0x2a')](_0x56547b);};}function getImapHost(_0x8f95f5){switch(_0x8f95f5){case _0x4de6('0x2b'):return _0x4de6('0x2c');case _0x4de6('0x2d'):return _0x4de6('0x2e');case _0x4de6('0x2f'):return _0x4de6('0x30');case'outlook365':return _0x4de6('0x31');}throw new Error(_0x4de6('0x32'),_0x8f95f5);}function getSmtpHost(_0x5795d2){switch(_0x5795d2){case _0x4de6('0x2b'):return _0x4de6('0x33');case _0x4de6('0x2d'):return'smtp.mail.yahoo.com';case _0x4de6('0x2f'):return'smtp-mail.outlook.com';case _0x4de6('0x34'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x5795d2);}function getAuthenticationOptions(_0x2b5fc7,_0x455c73){var _0x1aa5ce={};var _0x464737={};if(_0x2b5fc7){_0x1aa5ce[_0x4de6('0x35')]=_0x464737[_0x4de6('0x35')]=_0x455c73[_0x4de6('0x36')];_0x1aa5ce[_0x4de6('0x37')]=_0x464737[_0x4de6('0x38')]=_0x455c73[_0x4de6('0x37')];if(_0x455c73[_0x4de6('0x39')]){_0x1aa5ce[_0x4de6('0x39')]=_0x464737['modernAuthentication']=!![];_0x1aa5ce[_0x4de6('0x3a')]=_0x464737[_0x4de6('0x3a')]=_0x455c73[_0x4de6('0x3a')];_0x1aa5ce['password']=_0x464737[_0x4de6('0x38')]=null;}else{_0x1aa5ce[_0x4de6('0x3a')]=_0x464737[_0x4de6('0x3a')]=null;}_0x1aa5ce['host']=getImapHost(_0x2b5fc7);_0x1aa5ce['port']=0x3e1;_0x464737[_0x4de6('0x3b')]=getSmtpHost(_0x2b5fc7);_0x464737['port']=0x24b;_0x464737[_0x4de6('0x3c')]=![];_0x1aa5ce[_0x4de6('0x3d')]=_0x464737[_0x4de6('0x3d')]=null;}else{if(_0x455c73[_0x4de6('0x3e')]){_0x1aa5ce[_0x4de6('0x35')]=_0x464737[_0x4de6('0x35')]=_0x455c73['username'];_0x1aa5ce['password']=_0x464737[_0x4de6('0x38')]=_0x455c73[_0x4de6('0x37')];}else{_0x1aa5ce[_0x4de6('0x3e')]=_0x464737['authentication']=![];_0x1aa5ce[_0x4de6('0x35')]=_0x464737['user']=null;_0x1aa5ce[_0x4de6('0x37')]=_0x464737['pass']=null;}_0x1aa5ce[_0x4de6('0x3b')]=_0x455c73[_0x4de6('0x3f')][_0x4de6('0x3b')];_0x1aa5ce[_0x4de6('0x40')]=_0x455c73[_0x4de6('0x3f')][_0x4de6('0x40')];_0x464737[_0x4de6('0x3b')]=_0x455c73[_0x4de6('0x41')][_0x4de6('0x3b')];_0x464737[_0x4de6('0x40')]=_0x455c73[_0x4de6('0x41')][_0x4de6('0x40')];}return{'Imap':_0x1aa5ce,'Smtp':_0x464737};}exports[_0x4de6('0x42')]=function(_0x237318,_0x4e5517){var _0x5df1fd={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4de6('0x41')},{'model':db[_0x4de6('0x43')],'as':_0x4de6('0x44')}]},_0x31c4f3={},_0x48e092={'count':0x0,'rows':[]};var _0x359974=_[_0x4de6('0x45')](db[_0x4de6('0x46')][_0x4de6('0x47')],function(_0x5142aa){return{'name':_0x5142aa[_0x4de6('0x48')],'type':_0x5142aa[_0x4de6('0x49')]['key']};});_0x31c4f3[_0x4de6('0x4a')]=_[_0x4de6('0x45')](_0x359974,_0x4de6('0x29'));_0x31c4f3['query']=_[_0x4de6('0x4b')](_0x237318['query']);_0x31c4f3[_0x4de6('0x4c')]=_[_0x4de6('0x4d')](_0x31c4f3[_0x4de6('0x4a')],_0x31c4f3['query']);_0x5df1fd[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x31c4f3[_0x4de6('0x4a')],qs[_0x4de6('0x4f')](_0x237318[_0x4de6('0x50')]['fields']));_0x5df1fd[_0x4de6('0x4e')]=_0x5df1fd[_0x4de6('0x4e')][_0x4de6('0x51')]?_0x5df1fd[_0x4de6('0x4e')]:_0x31c4f3[_0x4de6('0x4a')];if(!_0x237318[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0x5df1fd[_0x4de6('0x1e')]=qs['limit'](_0x237318[_0x4de6('0x50')][_0x4de6('0x1e')]);_0x5df1fd['offset']=qs['offset'](_0x237318[_0x4de6('0x50')][_0x4de6('0x1c')]);}_0x5df1fd[_0x4de6('0x54')]=qs[_0x4de6('0x55')](_0x237318['query']['sort']);_0x5df1fd[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_[_0x4de6('0x57')](_0x237318[_0x4de6('0x50')],_0x31c4f3[_0x4de6('0x4c')]),_0x359974);if(_0x237318[_0x4de6('0x50')][_0x4de6('0x58')]){_0x5df1fd[_0x4de6('0x56')]=_['merge'](_0x5df1fd['where'],{'$or':_['map'](_0x359974,function(_0x23e9d9){if(_0x23e9d9[_0x4de6('0x49')]!==_0x4de6('0x59')){var _0x411839={};_0x411839[_0x23e9d9[_0x4de6('0x29')]]={'$like':'%'+_0x237318[_0x4de6('0x50')]['filter']+'%'};return _0x411839;}})});}_0x5df1fd=_['merge']({},_0x5df1fd,_0x237318[_0x4de6('0x5a')]);var _0x44f075={'where':_0x5df1fd[_0x4de6('0x56')]};return db[_0x4de6('0x46')][_0x4de6('0x1f')](_0x44f075)[_0x4de6('0xd')](function(_0x36bc51){_0x48e092[_0x4de6('0x1f')]=_0x36bc51;if(_0x237318[_0x4de6('0x50')]['includeAll']){_0x5df1fd[_0x4de6('0x5b')]=[{'all':!![]}];}return db[_0x4de6('0x46')]['findAll'](_0x5df1fd);})[_0x4de6('0xd')](function(_0x33b1c4){_0x48e092['rows']=_0x33b1c4;return _0x48e092;})[_0x4de6('0xd')](respondWithFilteredResult(_0x4e5517,_0x5df1fd))[_0x4de6('0x18')](handleError(_0x4e5517,null));};exports[_0x4de6('0x5c')]=function(_0x1fb71f,_0x571f30){var _0x4e6d2e={'raw':![],'where':{'id':_0x1fb71f[_0x4de6('0x5d')]['id']},'include':[{'model':db[_0x4de6('0x5e')],'as':_0x4de6('0x3f')},{'model':db[_0x4de6('0x5f')],'as':_0x4de6('0x41')},{'model':db['Pause'],'as':_0x4de6('0x44')}]},_0x35eae8={};_0x35eae8[_0x4de6('0x4a')]=_[_0x4de6('0x4b')](db[_0x4de6('0x46')][_0x4de6('0x47')]);_0x35eae8[_0x4de6('0x50')]=_[_0x4de6('0x4b')](_0x1fb71f[_0x4de6('0x50')]);_0x35eae8[_0x4de6('0x4c')]=_['intersection'](_0x35eae8['model'],_0x35eae8[_0x4de6('0x50')]);_0x4e6d2e[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x35eae8[_0x4de6('0x4a')],qs['fields'](_0x1fb71f[_0x4de6('0x50')][_0x4de6('0x4f')]));_0x4e6d2e[_0x4de6('0x4e')]=_0x4e6d2e[_0x4de6('0x4e')][_0x4de6('0x51')]?_0x4e6d2e[_0x4de6('0x4e')]:_0x35eae8['model'];if(_0x1fb71f[_0x4de6('0x50')][_0x4de6('0x60')]){_0x4e6d2e[_0x4de6('0x5b')]=[{'all':!![]}];}_0x4e6d2e=_['merge']({},_0x4e6d2e,_0x1fb71f[_0x4de6('0x5a')]);return db[_0x4de6('0x46')][_0x4de6('0x61')](_0x4e6d2e)['then'](handleEntityNotFound(_0x571f30,null))[_0x4de6('0xd')](respondWithResult(_0x571f30,null))[_0x4de6('0x18')](handleError(_0x571f30,null));};exports[_0x4de6('0x23')]=function(_0x2c4300,_0x704239){if(_0x2c4300['body']['id']){delete _0x2c4300[_0x4de6('0x62')]['id'];}var _0x116b33=_0x2c4300['body'][_0x4de6('0x63')]===_0x4de6('0x64')?null:_0x2c4300[_0x4de6('0x62')]['provider'];var _0x3dcdbc=_0x2c4300[_0x4de6('0x62')][_0x4de6('0x3f')]||{};var _0x4fa739=_0x2c4300['body'][_0x4de6('0x41')]||{};if(_0x116b33){_0x3dcdbc[_0x4de6('0x3b')]=getImapHost(_0x116b33);_0x3dcdbc[_0x4de6('0x40')]=0x3e1;_0x4fa739[_0x4de6('0x3b')]=getSmtpHost(_0x116b33);_0x4fa739[_0x4de6('0x40')]=0x24b;_0x4fa739[_0x4de6('0x3c')]=![];}if(_0x4fa739[_0x4de6('0x39')]){_0x4fa739['secure']=![];}else{_0x4fa739[_0x4de6('0x3a')]=null;}if(!_0x3dcdbc[_0x4de6('0x39')])_0x3dcdbc['CloudProviderId']=null;_0x2c4300[_0x4de6('0x62')][_0x4de6('0x3f')]=_0x3dcdbc;_0x2c4300['body'][_0x4de6('0x41')]=_0x4fa739;return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x2c4300[_0x4de6('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x4de6('0x5f')],'as':_0x4de6('0x41')},{'model':db[_0x4de6('0x43')],'as':_0x4de6('0x44')}]})['then'](handleEntityNotFound(_0x704239,null))[_0x4de6('0xd')](function(_0x1408a8){if(!_0x1408a8)throw new Error(_0x4de6('0x65'));if(_0x1408a8['service'])delete _0x2c4300[_0x4de6('0x62')][_0x4de6('0x3f')];return _0x1408a8;})['then'](saveUpdates(_0x2c4300[_0x4de6('0x62')],null))['then'](function(_0x25e7b9){if(!_0x2c4300[_0x4de6('0x62')][_0x4de6('0x3f')])return _0x25e7b9;return db[_0x4de6('0x5e')]['update'](_0x2c4300[_0x4de6('0x62')][_0x4de6('0x3f')],{'where':{'MailAccountId':_0x25e7b9['id']}})[_0x4de6('0xd')](function(){return _0x25e7b9;});})[_0x4de6('0xd')](function(_0x3b4b2e){if(!_0x2c4300[_0x4de6('0x62')][_0x4de6('0x41')])return _0x3b4b2e;return db['MailServerOut'][_0x4de6('0x23')](_0x2c4300[_0x4de6('0x62')][_0x4de6('0x41')],{'where':{'MailAccountId':_0x3b4b2e['id']}})[_0x4de6('0xd')](function(){return _0x3b4b2e;});})[_0x4de6('0xd')](respondWithResult(_0x704239,null))['catch'](handleError(_0x704239,null));};exports[_0x4de6('0x66')]=function(_0x1ad0de,_0x1e17f1){return db[_0x4de6('0x46')][_0x4de6('0x66')]()['then'](respondWithResult(_0x1e17f1,null))['catch'](handleError(_0x1e17f1,null));};exports[_0x4de6('0x67')]=function(_0x202035,_0x3205f5){if(_0x202035[_0x4de6('0x62')]['id']){delete _0x202035[_0x4de6('0x62')]['id'];}return db['MailAccount'][_0x4de6('0x61')]({'where':{'id':_0x202035[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x3205f5,null))[_0x4de6('0xd')](function(_0x2dbada){if(_0x2dbada){_0x202035[_0x4de6('0x62')][_0x4de6('0x68')]=_0x2dbada['id'];return db[_0x4de6('0x69')]['create'](_0x202035[_0x4de6('0x62')]);}})[_0x4de6('0xd')](respondWithResult(_0x3205f5,null))['catch'](handleError(_0x3205f5,null));};exports[_0x4de6('0x6a')]=function(_0x4bdd4c,_0x130ce9){var _0xe2d299={'raw':![],'where':{}};var _0x3f64ad={};var _0xfd8062={'count':0x0,'rows':[]};return db[_0x4de6('0x46')][_0x4de6('0x6b')]({'where':{'id':_0x4bdd4c['params']['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x130ce9,null))[_0x4de6('0xd')](function(_0x5b700e){if(_0x5b700e){_0x3f64ad['model']=_['keys'](db[_0x4de6('0x69')][_0x4de6('0x47')]);_0x3f64ad[_0x4de6('0x50')]=_[_0x4de6('0x4b')](_0x4bdd4c['query']);_0x3f64ad[_0x4de6('0x4c')]=_['intersection'](_0x3f64ad[_0x4de6('0x4a')],_0x3f64ad[_0x4de6('0x50')]);_0xe2d299[_0x4de6('0x4e')]=_['intersection'](_0x3f64ad[_0x4de6('0x4a')],qs[_0x4de6('0x4f')](_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x4f')]));_0xe2d299[_0x4de6('0x4e')]=_0xe2d299[_0x4de6('0x4e')]['length']?_0xe2d299[_0x4de6('0x4e')]:_0x3f64ad[_0x4de6('0x4a')];if(!_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0xe2d299[_0x4de6('0x1e')]=qs[_0x4de6('0x1e')](_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x1e')]);_0xe2d299['offset']=qs[_0x4de6('0x1c')](_0x4bdd4c['query'][_0x4de6('0x1c')]);}_0xe2d299[_0x4de6('0x54')]=qs['sort'](_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x55')]);_0xe2d299[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_[_0x4de6('0x57')](_0x4bdd4c[_0x4de6('0x50')],_0x3f64ad['filters']));_0xe2d299['where'][_0x4de6('0x68')]=_0x5b700e['id'];if(_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x58')]){_0xe2d299['where']=_['merge'](_0xe2d299[_0x4de6('0x56')],{'$or':_['map'](_0xe2d299['attributes'],function(_0x384b99){var _0x586f64={};_0x586f64[_0x384b99]={'$like':'%'+_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x58')]+'%'};return _0x586f64;})});}_0xe2d299=_[_0x4de6('0x6c')]({},_0xe2d299,_0x4bdd4c[_0x4de6('0x5a')]);return db[_0x4de6('0x69')][_0x4de6('0x1f')]({'where':_0xe2d299['where']})[_0x4de6('0xd')](function(_0x2ce982){_0xfd8062[_0x4de6('0x1f')]=_0x2ce982;if(_0x4bdd4c[_0x4de6('0x50')][_0x4de6('0x60')]){_0xe2d299[_0x4de6('0x5b')]=[{'all':!![]}];}return db[_0x4de6('0x69')][_0x4de6('0x6d')](_0xe2d299);})['then'](function(_0x51fbf2){_0xfd8062[_0x4de6('0x6e')]=_0x51fbf2;return _0xfd8062;});}})[_0x4de6('0xd')](respondWithFilteredResult(_0x130ce9,_0xe2d299))[_0x4de6('0x18')](handleError(_0x130ce9,null));};exports[_0x4de6('0x6f')]=function(_0x503e12,_0x59ab59){return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x503e12[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x59ab59,null))['then'](function(_0x583e6b){if(_0x583e6b){return _0x583e6b[_0x4de6('0x6f')](_0x503e12[_0x4de6('0x50')][_0x4de6('0x70')]);}})[_0x4de6('0xd')](respondWithStatusCode(_0x59ab59,null))[_0x4de6('0x18')](handleError(_0x59ab59,null));};exports[_0x4de6('0x71')]=function(_0x586f3b,_0x486007){if(_0x586f3b[_0x4de6('0x62')]['id']){delete _0x586f3b[_0x4de6('0x62')]['id'];}return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x586f3b[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x486007,null))[_0x4de6('0xd')](function(_0x2d9269){if(_0x2d9269){_0x586f3b['body']['MailAccountId']=_0x2d9269['id'];return db['CannedAnswer']['create'](_0x586f3b[_0x4de6('0x62')]);}})[_0x4de6('0xd')](respondWithResult(_0x486007,null))[_0x4de6('0x18')](handleError(_0x486007,null));};exports[_0x4de6('0x72')]=function(_0x1bdb39,_0x50b004){var _0x1bd743={'raw':![],'where':{}};var _0x2afadb={};var _0x2c9abb={'count':0x0,'rows':[]};return db['MailAccount'][_0x4de6('0x6b')]({'where':{'id':_0x1bdb39[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x50b004,null))[_0x4de6('0xd')](function(_0x17e073){if(_0x17e073){_0x2afadb['model']=_[_0x4de6('0x4b')](db[_0x4de6('0x73')][_0x4de6('0x47')]);_0x2afadb[_0x4de6('0x50')]=_['keys'](_0x1bdb39[_0x4de6('0x50')]);_0x2afadb[_0x4de6('0x4c')]=_[_0x4de6('0x4d')](_0x2afadb[_0x4de6('0x4a')],_0x2afadb[_0x4de6('0x50')]);_0x1bd743[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x2afadb[_0x4de6('0x4a')],qs['fields'](_0x1bdb39[_0x4de6('0x50')]['fields']));_0x1bd743['attributes']=_0x1bd743['attributes'][_0x4de6('0x51')]?_0x1bd743[_0x4de6('0x4e')]:_0x2afadb[_0x4de6('0x4a')];if(!_0x1bdb39[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0x1bd743[_0x4de6('0x1e')]=qs[_0x4de6('0x1e')](_0x1bdb39[_0x4de6('0x50')][_0x4de6('0x1e')]);_0x1bd743['offset']=qs[_0x4de6('0x1c')](_0x1bdb39['query'][_0x4de6('0x1c')]);}_0x1bd743[_0x4de6('0x54')]=qs[_0x4de6('0x55')](_0x1bdb39['query'][_0x4de6('0x55')]);_0x1bd743[_0x4de6('0x56')]=qs['filters'](_[_0x4de6('0x57')](_0x1bdb39['query'],_0x2afadb[_0x4de6('0x4c')]));_0x1bd743[_0x4de6('0x56')][_0x4de6('0x68')]=_0x17e073['id'];if(_0x1bdb39[_0x4de6('0x50')][_0x4de6('0x58')]){_0x1bd743['where']=_[_0x4de6('0x6c')](_0x1bd743[_0x4de6('0x56')],{'$or':_[_0x4de6('0x45')](_0x1bd743[_0x4de6('0x4e')],function(_0x484cbb){var _0x345472={};_0x345472[_0x484cbb]={'$like':'%'+_0x1bdb39[_0x4de6('0x50')][_0x4de6('0x58')]+'%'};return _0x345472;})});}_0x1bd743=_[_0x4de6('0x6c')]({},_0x1bd743,_0x1bdb39['options']);return db[_0x4de6('0x73')][_0x4de6('0x1f')]({'where':_0x1bd743[_0x4de6('0x56')]})[_0x4de6('0xd')](function(_0xfb3084){_0x2c9abb[_0x4de6('0x1f')]=_0xfb3084;if(_0x1bdb39['query'][_0x4de6('0x60')]){_0x1bd743['include']=[{'all':!![]}];}return db[_0x4de6('0x73')][_0x4de6('0x6d')](_0x1bd743);})[_0x4de6('0xd')](function(_0x2d8cbd){_0x2c9abb[_0x4de6('0x6e')]=_0x2d8cbd;return _0x2c9abb;});}})['then'](respondWithFilteredResult(_0x50b004,_0x1bd743))[_0x4de6('0x18')](handleError(_0x50b004,null));};exports[_0x4de6('0x74')]=function(_0x5e4952,_0x40eda4){return db['MailAccount']['find']({'where':{'id':_0x5e4952[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x40eda4,null))[_0x4de6('0xd')](function(_0x36d750){if(_0x36d750){return _0x36d750[_0x4de6('0x74')](_0x5e4952[_0x4de6('0x50')][_0x4de6('0x70')]);}})[_0x4de6('0xd')](respondWithStatusCode(_0x40eda4,null))[_0x4de6('0x18')](handleError(_0x40eda4,null));};exports[_0x4de6('0x75')]=function(_0x2fdaae,_0x6e3f32){var _0x2ba2f9={'name':_0x2fdaae['body'][_0x4de6('0x29')],'key':_0x2fdaae[_0x4de6('0x62')]['key'],'provider':_0x2fdaae['body'][_0x4de6('0x63')]===_0x4de6('0x64')?null:_0x2fdaae[_0x4de6('0x62')]['provider'],'email':_0x2fdaae[_0x4de6('0x62')][_0x4de6('0x76')],'ListId':_0x2fdaae[_0x4de6('0x62')][_0x4de6('0x77')],'active':!_[_0x4de6('0x78')](_0x2fdaae['body'][_0x4de6('0x79')])?_0x2fdaae[_0x4de6('0x62')][_0x4de6('0x79')]:!![],'description':_0x2fdaae['body'][_0x4de6('0x7a')]||null};var _0x1fc9fd=getAuthenticationOptions(_0x2ba2f9[_0x4de6('0x63')],_0x2fdaae[_0x4de6('0x62')]);_0x2ba2f9[_0x4de6('0x3f')]=_0x1fc9fd[_0x4de6('0x3f')];_0x2ba2f9[_0x4de6('0x41')]=_0x1fc9fd[_0x4de6('0x41')];return db[_0x4de6('0x46')][_0x4de6('0x75')](_0x2ba2f9,{'include':[{'model':db[_0x4de6('0x5f')],'as':'Smtp'},{'model':db[_0x4de6('0x5e')],'as':_0x4de6('0x3f')}]})[_0x4de6('0xd')](function(_0x1c01fa){var _0x5309b=_0x2fdaae[_0x4de6('0x35')][_0x4de6('0x25')]({'plain':!![]});if(!_0x5309b)throw new Error(_0x4de6('0x7b'));if(_0x5309b[_0x4de6('0x7c')]==='user'){var _0x5e9ed5=_0x1c01fa['get']({'plain':!![]});return db[_0x4de6('0x7d')][_0x4de6('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x5309b[_0x4de6('0x7e')]},'raw':!![]})['then'](function(_0x4007c5){if(_0x4007c5&&_0x4007c5[_0x4de6('0x7f')]===0x0){return db[_0x4de6('0x27')][_0x4de6('0x75')]({'name':_0x5e9ed5[_0x4de6('0x29')],'resourceId':_0x5e9ed5['id'],'type':_0x4007c5[_0x4de6('0x29')],'sectionId':_0x4007c5['id']},{})[_0x4de6('0xd')](function(){return _0x1c01fa;});}else{return _0x1c01fa;}})['catch'](function(_0x3c0496){logger['error'](_0x4de6('0x80'),_0x3c0496);throw _0x3c0496;});}return _0x1c01fa;})['then'](respondWithResult(_0x6e3f32,0xc9))['catch'](handleError(_0x6e3f32,null));};exports['getImap']=function(_0x5306d6,_0x18273b){return db['MailAccount'][_0x4de6('0x6b')]({'where':{'id':_0x5306d6[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x18273b,null))[_0x4de6('0xd')](function(_0x1e7a22){if(_0x1e7a22){return _0x1e7a22[_0x4de6('0x81')]();}return null;})[_0x4de6('0xd')](respondWithResult(_0x18273b,null))['catch'](handleError(_0x18273b,null));};exports[_0x4de6('0x82')]=function(_0x3dd1f7,_0x37973f){if(_0x3dd1f7['body']['id']){delete _0x3dd1f7[_0x4de6('0x62')]['id'];}return db['MailAccount'][_0x4de6('0x61')]({'where':{'id':_0x3dd1f7[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x37973f,null))[_0x4de6('0xd')](function(_0x430350){if(_0x430350){_0x3dd1f7[_0x4de6('0x62')][_0x4de6('0x68')]=_0x430350['id'];return db[_0x4de6('0x5e')]['create'](_0x3dd1f7[_0x4de6('0x62')]);}})['then'](respondWithResult(_0x37973f,null))['catch'](handleError(_0x37973f,null));};exports['removeImap']=function(_0x4c4523,_0x465513){return db['MailAccount'][_0x4de6('0x6b')]({'where':{'id':_0x4c4523[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x465513,null))[_0x4de6('0xd')](function(_0x3dd5fc){if(_0x3dd5fc){return _0x3dd5fc[_0x4de6('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x465513,null))[_0x4de6('0x18')](handleError(_0x465513,null));};exports[_0x4de6('0x84')]=function(_0x67414d,_0xb24a21){return db[_0x4de6('0x46')]['findOne']({'where':{'id':_0x67414d['params']['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0xb24a21,null))[_0x4de6('0xd')](function(_0x500c55){if(_0x500c55){return _0x500c55[_0x4de6('0x84')]();}return null;})[_0x4de6('0xd')](respondWithResult(_0xb24a21,null))[_0x4de6('0x18')](handleError(_0xb24a21,null));};exports[_0x4de6('0x85')]=function(_0x311393,_0x34d9f8){if(_0x311393['body']['id']){delete _0x311393[_0x4de6('0x62')]['id'];}return db['MailAccount'][_0x4de6('0x61')]({'where':{'id':_0x311393[_0x4de6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x34d9f8,null))[_0x4de6('0xd')](function(_0x10d8f0){if(_0x10d8f0){_0x311393[_0x4de6('0x62')][_0x4de6('0x68')]=_0x10d8f0['id'];return db[_0x4de6('0x5f')]['create'](_0x311393[_0x4de6('0x62')]);}})[_0x4de6('0xd')](respondWithResult(_0x34d9f8,null))['catch'](handleError(_0x34d9f8,null));};exports[_0x4de6('0x86')]=function(_0x363353,_0x545796){return db['MailAccount'][_0x4de6('0x6b')]({'where':{'id':_0x363353[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x545796,null))[_0x4de6('0xd')](function(_0x214793){if(_0x214793){return _0x214793[_0x4de6('0x87')](null);}return null;})[_0x4de6('0xd')](respondWithStatusCode(_0x545796,null))['catch'](handleError(_0x545796,null));};exports[_0x4de6('0x88')]=function(_0x1bf80b,_0xe3aac4){return db[_0x4de6('0x89')][_0x4de6('0x61')]({'where':{'id':_0x1bf80b['params']['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0xe3aac4,null))[_0x4de6('0xd')](function(_0x2e42c1){if(_0x2e42c1){return _0x2e42c1[_0x4de6('0x88')](_0x1bf80b[_0x4de6('0x62')]['ids'],_['omit'](_0x1bf80b[_0x4de6('0x62')],[_0x4de6('0x70'),'id'])||{});}})[_0x4de6('0xd')](respondWithResult(_0xe3aac4,null))[_0x4de6('0x18')](handleError(_0xe3aac4,null));};exports[_0x4de6('0x8a')]=function(_0x52fceb,_0x44fbdf){var _0x1b1d74={'raw':![],'where':{}};var _0x5c76da={};var _0x56e21d={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x52fceb[_0x4de6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x44fbdf,null))[_0x4de6('0xd')](function(_0x1fdc4d){if(_0x1fdc4d){_0x5c76da['model']=_['keys'](db[_0x4de6('0x89')][_0x4de6('0x47')]);_0x5c76da[_0x4de6('0x50')]=_[_0x4de6('0x4b')](_0x52fceb[_0x4de6('0x50')]);_0x5c76da[_0x4de6('0x4c')]=_[_0x4de6('0x4d')](_0x5c76da[_0x4de6('0x4a')],_0x5c76da[_0x4de6('0x50')]);_0x1b1d74[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x5c76da[_0x4de6('0x4a')],qs[_0x4de6('0x4f')](_0x52fceb['query']['fields']));_0x1b1d74[_0x4de6('0x4e')]=_0x1b1d74[_0x4de6('0x4e')][_0x4de6('0x51')]?_0x1b1d74[_0x4de6('0x4e')]:_0x5c76da[_0x4de6('0x4a')];if(!_0x52fceb[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0x1b1d74[_0x4de6('0x1e')]=qs[_0x4de6('0x1e')](_0x52fceb[_0x4de6('0x50')][_0x4de6('0x1e')]);_0x1b1d74[_0x4de6('0x1c')]=qs['offset'](_0x52fceb[_0x4de6('0x50')][_0x4de6('0x1c')]);}_0x1b1d74['order']=qs['sort'](_0x52fceb[_0x4de6('0x50')]['sort']);_0x1b1d74[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_[_0x4de6('0x57')](_0x52fceb[_0x4de6('0x50')],_0x5c76da[_0x4de6('0x4c')]));_0x1b1d74['where'][_0x4de6('0x68')]=_0x1fdc4d['id'];if(_0x52fceb[_0x4de6('0x50')][_0x4de6('0x58')]){_0x1b1d74[_0x4de6('0x56')]=_[_0x4de6('0x6c')](_0x1b1d74['where'],{'$or':_[_0x4de6('0x45')](_0x1b1d74['attributes'],function(_0x147033){var _0x2731e8={};_0x2731e8[_0x147033]={'$like':'%'+_0x52fceb[_0x4de6('0x50')]['filter']+'%'};return _0x2731e8;})});}_0x1b1d74=_[_0x4de6('0x6c')]({},_0x1b1d74,_0x52fceb[_0x4de6('0x5a')]);return db[_0x4de6('0x89')][_0x4de6('0x1f')]({'where':_0x1b1d74['where']})[_0x4de6('0xd')](function(_0x14acf4){_0x56e21d[_0x4de6('0x1f')]=_0x14acf4;if(_0x52fceb['query'][_0x4de6('0x60')]){_0x1b1d74[_0x4de6('0x5b')]=[{'model':db[_0x4de6('0x8b')],'as':'Contact','required':![]},{'model':db[_0x4de6('0x8c')],'as':_0x4de6('0x8d'),'attributes':[_0x4de6('0x29'),'fullname',_0x4de6('0x8e')],'required':![]},{'model':db[_0x4de6('0x8f')],'as':_0x4de6('0x90'),'attributes':['id','name',_0x4de6('0x91')],'where':_0x52fceb['query'][_0x4de6('0x92')]?{'id':_0x52fceb[_0x4de6('0x50')][_0x4de6('0x92')]}:undefined,'required':_0x52fceb[_0x4de6('0x50')][_0x4de6('0x92')]?!![]:![]}];}return db[_0x4de6('0x89')][_0x4de6('0x6d')](_0x1b1d74);})[_0x4de6('0xd')](function(_0x2381a9){_0x56e21d[_0x4de6('0x6e')]=_0x2381a9;return _0x56e21d;});}})[_0x4de6('0xd')](respondWithFilteredResult(_0x44fbdf,_0x1b1d74))[_0x4de6('0x18')](handleError(_0x44fbdf,null));};exports[_0x4de6('0x93')]=function addApplications(_0x3f96ef,_0x26dafe){var _0x2b221a=_0x3f96ef[_0x4de6('0x5d')]['id'];var _0x53978e=_0x3f96ef[_0x4de6('0x62')];var _0x8388f9=0xc8;var _0x28a3bf=null;return db['sequelize'][_0x4de6('0x94')]({'isolationLevel':db[_0x4de6('0x95')][_0x4de6('0x96')][_0x4de6('0x97')]['READ_COMMITTED']},function(_0x18ca14){return db[_0x4de6('0x46')][_0x4de6('0x6b')]({'where':{'id':_0x2b221a},'transaction':_0x18ca14})[_0x4de6('0xd')](function(_0x5a11c9){if(_0x5a11c9){return db[_0x4de6('0x98')]['destroy']({'where':{'MailAccountId':_0x2b221a},'transaction':_0x18ca14})[_0x4de6('0xd')](function(){var _0x2d2580=_[_0x4de6('0x45')](_0x53978e,function(_0x13fcab){_0x13fcab[_0x4de6('0x68')]=_0x2b221a;return _0x13fcab;});return db[_0x4de6('0x98')][_0x4de6('0x99')](_0x2d2580,{'transaction':_0x18ca14});});}else{_0x8388f9=0x194;_0x28a3bf=[];}});})['then'](function(){if(_0x8388f9!==0x194){return db[_0x4de6('0x98')][_0x4de6('0x9a')]({'where':{'MailAccountId':_0x2b221a},'order':_0x4de6('0x9b')})['then'](function(_0x4c00ef){_0x28a3bf=_0x4c00ef;});}})[_0x4de6('0x18')](function(_0x4d8730){_0x8388f9=0x1f4;logger[_0x4de6('0x14')](_0x4d8730['stack']);if(_0x4d8730[_0x4de6('0x29')]){delete _0x4d8730[_0x4de6('0x29')];}_0x28a3bf=_0x4d8730;})[_0x4de6('0x9c')](function(){if(_0x28a3bf===null){_0x26dafe[_0x4de6('0x19')](_0x8388f9);}else{if(_0x8388f9===0x1f4){_0x26dafe[_0x4de6('0x1a')](_0x8388f9)[_0x4de6('0x2a')](_0x28a3bf);}else{_0x26dafe[_0x4de6('0x1a')](_0x8388f9)['json'](_0x28a3bf);}}});};exports['getApplications']=function(_0x2ab085,_0x1fb102){var _0xddcba1={};var _0x3c1d70={};var _0x54b540;var _0x18f276;return db[_0x4de6('0x46')]['findOne']({'where':{'id':_0x2ab085[_0x4de6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1fb102,null))[_0x4de6('0xd')](function(_0x551521){if(_0x551521){_0x54b540=_0x551521;_0x3c1d70[_0x4de6('0x4a')]=_[_0x4de6('0x4b')](db[_0x4de6('0x98')]['rawAttributes']);_0x3c1d70['query']=_['keys'](_0x2ab085[_0x4de6('0x50')]);_0x3c1d70[_0x4de6('0x4c')]=_[_0x4de6('0x4d')](_0x3c1d70[_0x4de6('0x4a')],_0x3c1d70['query']);_0xddcba1[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x3c1d70[_0x4de6('0x4a')],qs['fields'](_0x2ab085['query'][_0x4de6('0x4f')]));_0xddcba1[_0x4de6('0x4e')]=_0xddcba1['attributes'][_0x4de6('0x51')]?_0xddcba1['attributes']:_0x3c1d70[_0x4de6('0x4a')];_0xddcba1[_0x4de6('0x54')]=qs[_0x4de6('0x55')](_0x2ab085[_0x4de6('0x50')]['sort']);_0xddcba1[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_['pick'](_0x2ab085[_0x4de6('0x50')],_0x3c1d70[_0x4de6('0x4c')]));if(_0x2ab085[_0x4de6('0x50')]['filter']){_0xddcba1[_0x4de6('0x56')]=_[_0x4de6('0x6c')](_0xddcba1[_0x4de6('0x56')],{'$or':_['map'](_0xddcba1[_0x4de6('0x4e')],function(_0x531129){var _0x1d0a09={};_0x1d0a09[_0x531129]={'$like':'%'+_0x2ab085[_0x4de6('0x50')][_0x4de6('0x58')]+'%'};return _0x1d0a09;})});}_0xddcba1=_[_0x4de6('0x6c')]({},_0xddcba1,_0x2ab085['options']);return _0x54b540[_0x4de6('0x9d')](_0xddcba1);}})[_0x4de6('0xd')](function(_0x16ba2f){if(_0x16ba2f){_0x18f276=_0x16ba2f[_0x4de6('0x51')];if(!_0x2ab085[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0xddcba1[_0x4de6('0x1e')]=qs[_0x4de6('0x1e')](_0x2ab085[_0x4de6('0x50')][_0x4de6('0x1e')]);_0xddcba1[_0x4de6('0x1c')]=qs[_0x4de6('0x1c')](_0x2ab085[_0x4de6('0x50')][_0x4de6('0x1c')]);}return _0x54b540[_0x4de6('0x9d')](_0xddcba1);}})[_0x4de6('0xd')](function(_0x21bad4){if(_0x21bad4){return _0x21bad4?{'count':_0x18f276,'rows':_0x21bad4}:null;}})[_0x4de6('0xd')](respondWithResult(_0x1fb102,null))[_0x4de6('0x18')](handleError(_0x1fb102,null));};exports[_0x4de6('0x9e')]=function(_0x265d36,_0x325b5b){var _0x414750={'raw':!![],'where':{}};var _0x25d69b={};var _0xdeacaa={'count':0x0,'rows':[]};return db[_0x4de6('0x46')][_0x4de6('0x6b')]({'where':{'id':_0x265d36[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x325b5b,null))[_0x4de6('0xd')](function(_0x29b7e6){if(_0x29b7e6){_0x25d69b[_0x4de6('0x4a')]=_[_0x4de6('0x4b')](db['MailMessage'][_0x4de6('0x47')]);_0x25d69b['query']=_[_0x4de6('0x4b')](_0x265d36[_0x4de6('0x50')]);_0x25d69b['filters']=_[_0x4de6('0x4d')](_0x25d69b[_0x4de6('0x4a')],_0x25d69b[_0x4de6('0x50')]);_0x414750[_0x4de6('0x4e')]=_[_0x4de6('0x4d')](_0x25d69b[_0x4de6('0x4a')],qs[_0x4de6('0x4f')](_0x265d36[_0x4de6('0x50')]['fields']));_0x414750['attributes']=_0x414750[_0x4de6('0x4e')][_0x4de6('0x51')]?_0x414750['attributes']:_0x25d69b[_0x4de6('0x4a')];if(!_0x265d36[_0x4de6('0x50')][_0x4de6('0x52')](_0x4de6('0x53'))){_0x414750['limit']=qs[_0x4de6('0x1e')](_0x265d36[_0x4de6('0x50')][_0x4de6('0x1e')]);_0x414750[_0x4de6('0x1c')]=qs[_0x4de6('0x1c')](_0x265d36[_0x4de6('0x50')]['offset']);}_0x414750[_0x4de6('0x54')]=qs['sort'](_0x265d36['query'][_0x4de6('0x55')]);_0x414750[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_[_0x4de6('0x57')](_0x265d36[_0x4de6('0x50')],_0x25d69b[_0x4de6('0x4c')]));_0x414750[_0x4de6('0x56')][_0x4de6('0x68')]=_0x29b7e6['id'];if(_0x265d36[_0x4de6('0x50')][_0x4de6('0x58')]){_0x414750[_0x4de6('0x56')]=_['merge'](_0x414750[_0x4de6('0x56')],{'$or':_[_0x4de6('0x45')](_0x414750[_0x4de6('0x4e')],function(_0x508c26){var _0x3839b8={};_0x3839b8[_0x508c26]={'$like':'%'+_0x265d36[_0x4de6('0x50')][_0x4de6('0x58')]+'%'};return _0x3839b8;})});}if(_0x265d36[_0x4de6('0x50')][_0x4de6('0x9f')]){var _0x4cb117=_0x265d36['query']['$gte'][_0x4de6('0xa0')](',');var _0x3aef7b={};_0x3aef7b[_0x4cb117[0x0]]={'$gte':moment(_0x4cb117[0x1])[_0x4de6('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x414750[_0x4de6('0x56')]=_[_0x4de6('0x6c')](_0x414750[_0x4de6('0x56')],_0x3aef7b);}_0x414750=_['merge']({},_0x414750,_0x265d36[_0x4de6('0x5a')]);return db['MailMessage'][_0x4de6('0x1f')]({'where':_0x414750[_0x4de6('0x56')]})[_0x4de6('0xd')](function(_0x35d23b){_0xdeacaa[_0x4de6('0x1f')]=_0x35d23b;if(_0x265d36[_0x4de6('0x50')][_0x4de6('0x60')]){_0x414750[_0x4de6('0x5b')]=[{'all':!![]}];}return db[_0x4de6('0xa2')]['findAll'](_0x414750);})['then'](function(_0x2fc727){if(_0x265d36[_0x4de6('0x50')][_0x4de6('0xa3')]===_0x4de6('0xa4')){for(var _0xdfaed1=0x0;_0xdfaed1<_0x2fc727[_0x4de6('0x51')];_0xdfaed1++){_0x2fc727[_0xdfaed1][_0x4de6('0x62')]=juice(_0x2fc727[_0xdfaed1][_0x4de6('0x62')]);}}_0xdeacaa['rows']=_0x2fc727;return _0xdeacaa;});}})['then'](respondWithFilteredResult(_0x325b5b,_0x414750))[_0x4de6('0x18')](handleError(_0x325b5b,null));};exports[_0x4de6('0x2a')]=function(_0x1c6f46,_0x3adf19){var _0x19efd8,_0x1da795={},_0x5ec8b4;if(_0x1c6f46[_0x4de6('0x62')]['to']){_0x5ec8b4=_0x1c6f46[_0x4de6('0x62')]['to'][_0x4de6('0xa0')](',')[0x0];}return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x1c6f46[_0x4de6('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x4de6('0xa5'),'include':[{'model':db[_0x4de6('0x8b')],'as':_0x4de6('0xa6'),'where':{'email':_0x5ec8b4},'limit':0x1,'order':[[_0x4de6('0xa7'),_0x4de6('0xa8')]]}]},{'model':db[_0x4de6('0x5f')],'as':_0x4de6('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4de6('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3adf19,null))[_0x4de6('0xd')](function(_0x3718eb){if(!_0x3718eb)return;_0x19efd8=_0x3718eb;if(!_0x3718eb['Smtp'])throw new Error(_0x4de6('0xaa'));if(_[_0x4de6('0x78')](_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xab')])){_0x1c6f46['body'][_0x4de6('0xab')]=util[_0x4de6('0xa1')](_0x4de6('0xac'),_0x3718eb[_0x4de6('0x29')],_0x3718eb[_0x4de6('0x76')]||_0x3718eb['Smtp'][_0x4de6('0x35')]);}if(_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xad')]&&_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xad')][_0x4de6('0x51')]){for(var _0x572246=0x0;_0x572246<_0x1c6f46['body']['attachments'][_0x4de6('0x51')];_0x572246+=0x1){_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xad')][_0x572246]={'filename':_0x1c6f46['body'][_0x4de6('0xad')][_0x572246][_0x4de6('0x29')],'path':path[_0x4de6('0xae')](config[_0x4de6('0xaf')],_0x4de6('0xb0'),_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xad')][_0x572246][_0x4de6('0xb1')])};}}var _0x1e1b83=_0x3718eb[_0x4de6('0xb2')]();return respondWithRpcPromise(_0x4de6('0xb3'),_0x4de6('0xb4'),{'account':_0x1e1b83,'message':_0x1c6f46[_0x4de6('0x62')]});})[_0x4de6('0xd')](function(_0x59883c){if(!_0x59883c)return;_0x1da795=_0x59883c;if(!_0x19efd8[_0x4de6('0xa5')])throw new Error('List\x20not\x20found');if(_0x19efd8['List'][_0x4de6('0xa6')]['length'])return _0x19efd8[_0x4de6('0xa5')][_0x4de6('0xa6')][0x0];return db[_0x4de6('0x8b')][_0x4de6('0x75')](_['defaults'](_0x1c6f46[_0x4de6('0x62')],{'firstName':_0x1c6f46[_0x4de6('0x62')]['to'],'email':_0x1c6f46[_0x4de6('0x62')]['to'],'phone':_0x1c6f46[_0x4de6('0x62')]['to'],'ListId':_0x19efd8['ListId']}));})[_0x4de6('0xd')](function(_0x10b28c){if(!_0x10b28c)return;var _0x48a463={'UserId':_0x1c6f46[_0x4de6('0x35')]['id'],'ContactId':_0x10b28c['id'],'MailAccountId':_0x19efd8['id'],'inReplyTo':_0x1da795['messageId'],'to':_0x1c6f46['body'][_0x4de6('0xab')],'cc':_0x1c6f46[_0x4de6('0x62')]['cc'],'subject':_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xb5')],'attach':_0x1c6f46[_0x4de6('0x62')][_0x4de6('0xb6')],'firstMsgDirection':_0x4de6('0xb7'),'lastMsgAt':moment()['format'](_0x4de6('0xb8')),'lastMsgDirection':_0x4de6('0xb7'),'Messages':[_['merge'](_0x1c6f46[_0x4de6('0x62')],{'messageId':_0x1da795[_0x4de6('0xb9')],'sentAt':moment()[_0x4de6('0xa1')](_0x4de6('0xb8')),'read':!![],'MailAccountId':_0x19efd8['id'],'UserId':_0x1c6f46[_0x4de6('0x35')]['id'],'ContactId':_0x10b28c['id']})]};if(_0x1c6f46[_0x4de6('0x62')]['Interaction']){_0x48a463=_[_0x4de6('0x6c')](_0x48a463,_0x1c6f46[_0x4de6('0x62')]['Interaction']);}return db[_0x4de6('0x89')][_0x4de6('0x75')](_0x48a463,{'include':[{'model':db['MailMessage'],'as':_0x4de6('0xba')}]});})['then'](respondWithResult(_0x3adf19,null))[_0x4de6('0x18')](handleError(_0x3adf19,null));};exports[_0x4de6('0xbb')]=function(_0x1fcc8b,_0x2393db){return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x1fcc8b['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x4de6('0x41'),'raw':!![],'include':[{'model':db[_0x4de6('0xa9')],'as':_0x4de6('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2393db,null))[_0x4de6('0xd')](function(_0x2ed50d){if(!_0x2ed50d['Smtp'])return;var _0x1c2798=_0x2ed50d[_0x4de6('0xb2')]();return respondWithRpcPromise(_0x4de6('0xbc'),_0x4de6('0xbb'),{'account':_0x1c2798});})[_0x4de6('0xd')](respondWithResult(_0x2393db,null))[_0x4de6('0x18')](handleError(_0x2393db,null));};exports[_0x4de6('0x24')]=function(_0x40acff,_0x11095a){return db['MailAccount'][_0x4de6('0x61')]({'where':{'id':_0x40acff[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x11095a,null))[_0x4de6('0xd')](function(_0x5fd83a){if(_0x5fd83a&&_0x5fd83a[_0x4de6('0x3d')]){throw new db[(_0x4de6('0xbd'))][(_0x4de6('0xbe'))](_0x4de6('0xbf'));}return _0x5fd83a;})['then'](removeEntity(_0x11095a,null))[_0x4de6('0x18')](handleError(_0x11095a,null));};exports['addAgents']=function(_0x4bb838,_0x470dbf){return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x4bb838[_0x4de6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x470dbf,null))[_0x4de6('0xd')](function(_0x2fc9a6){if(_0x2fc9a6){return _0x2fc9a6[_0x4de6('0xc0')](_0x4bb838[_0x4de6('0x62')][_0x4de6('0x70')],_[_0x4de6('0xc1')](_0x4bb838[_0x4de6('0x62')],['ids','id'])||{})[_0x4de6('0xc2')](function(_0x19691a){for(var _0xe16f1f=0x0;_0xe16f1f<_0x4bb838['body'][_0x4de6('0x70')][_0x4de6('0x51')];_0xe16f1f+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x4bb838[_0x4de6('0x62')][_0x4de6('0x70')][_0xe16f1f]),'MailAccountId':Number(_0x4bb838[_0x4de6('0x5d')]['id'])});}return _0x19691a;});}})['then'](respondWithResult(_0x470dbf,null))[_0x4de6('0x18')](handleError(_0x470dbf,null));};exports[_0x4de6('0xc3')]=function(_0x368af8,_0x41c2ae){return db[_0x4de6('0x46')][_0x4de6('0x61')]({'where':{'id':_0x368af8[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x41c2ae,null))[_0x4de6('0xd')](function(_0x3311e8){if(_0x3311e8){return _0x3311e8[_0x4de6('0xc3')](_0x368af8['query'][_0x4de6('0x70')])[_0x4de6('0xd')](function(){if(_['isArray'](_0x368af8[_0x4de6('0x50')][_0x4de6('0x70')])){for(var _0x2da277=0x0;_0x2da277<_0x368af8['query']['ids'][_0x4de6('0x51')];_0x2da277+=0x1){socket[_0x4de6('0xc4')](_0x4de6('0xc5'),{'UserId':Number(_0x368af8[_0x4de6('0x50')][_0x4de6('0x70')][_0x2da277]),'MailAccountId':Number(_0x368af8[_0x4de6('0x5d')]['id'])});}}else{socket[_0x4de6('0xc4')](_0x4de6('0xc5'),{'UserId':Number(_0x368af8[_0x4de6('0x50')][_0x4de6('0x70')]),'MailAccountId':Number(_0x368af8['params']['id'])});}});}})[_0x4de6('0xd')](respondWithStatusCode(_0x41c2ae,null))['catch'](handleError(_0x41c2ae,null));};exports[_0x4de6('0xc6')]=function(_0x6e7f15,_0x5d2579){var _0x30e7f4={};var _0x53d00={};var _0x5a0ca2;var _0x17e2de;return db[_0x4de6('0x46')][_0x4de6('0x6b')]({'where':{'id':_0x6e7f15[_0x4de6('0x5d')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x5d2579,null))[_0x4de6('0xd')](function(_0x588723){if(_0x588723){_0x5a0ca2=_0x588723;_0x53d00['model']=_['keys'](db[_0x4de6('0x8c')]['rawAttributes']);_0x53d00['query']=_[_0x4de6('0x4b')](_0x6e7f15['query']);_0x53d00[_0x4de6('0x4c')]=_[_0x4de6('0x4d')](_0x53d00[_0x4de6('0x4a')],_0x53d00['query']);_0x30e7f4[_0x4de6('0x4e')]=_['intersection'](_0x53d00['model'],qs['fields'](_0x6e7f15[_0x4de6('0x50')][_0x4de6('0x4f')]));_0x30e7f4[_0x4de6('0x4e')]=_0x30e7f4[_0x4de6('0x4e')]['length']?_0x30e7f4['attributes']:_0x53d00[_0x4de6('0x4a')];_0x30e7f4['order']=qs[_0x4de6('0x55')](_0x6e7f15[_0x4de6('0x50')][_0x4de6('0x55')]);_0x30e7f4[_0x4de6('0x56')]=qs[_0x4de6('0x4c')](_[_0x4de6('0x57')](_0x6e7f15[_0x4de6('0x50')],_0x53d00['filters']));if(_0x6e7f15[_0x4de6('0x50')]['filter']){_0x30e7f4[_0x4de6('0x56')]=_[_0x4de6('0x6c')](_0x30e7f4[_0x4de6('0x56')],{'$or':_['map'](_0x30e7f4[_0x4de6('0x4e')],function(_0x4fd34f){var _0x4311b2={};_0x4311b2[_0x4fd34f]={'$like':'%'+_0x6e7f15[_0x4de6('0x50')][_0x4de6('0x58')]+'%'};return _0x4311b2;})});}_0x30e7f4=_['merge']({},_0x30e7f4,_0x6e7f15[_0x4de6('0x5a')]);return _0x5a0ca2[_0x4de6('0xc6')](_0x30e7f4);}})['then'](function(_0x200679){if(_0x200679){_0x17e2de=_0x200679[_0x4de6('0x51')];if(!_0x6e7f15['query']['hasOwnProperty']('nolimit')){_0x30e7f4[_0x4de6('0x1e')]=qs[_0x4de6('0x1e')](_0x6e7f15[_0x4de6('0x50')][_0x4de6('0x1e')]);_0x30e7f4['offset']=qs[_0x4de6('0x1c')](_0x6e7f15[_0x4de6('0x50')][_0x4de6('0x1c')]);}return _0x5a0ca2[_0x4de6('0xc6')](_0x30e7f4);}})[_0x4de6('0xd')](function(_0x3b04e0){if(_0x3b04e0){return _0x3b04e0?{'count':_0x17e2de,'rows':_0x3b04e0}:null;}})[_0x4de6('0xd')](respondWithResult(_0x5d2579,null))[_0x4de6('0x18')](handleError(_0x5d2579,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6fedb38..603c6f8 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 _0x99fd=['emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners','save','update','remove'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x99fd,0x1e0));var _0xd99f=function(_0x3f74e3,_0x431a36){_0x3f74e3=_0x3f74e3-0x0;var _0x1fe8f3=_0x99fd[_0x3f74e3];return _0x1fe8f3;};'use strict';var EventEmitter=require(_0xd99f('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xd99f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd99f('0x2')](0x0);var events={'afterCreate':_0xd99f('0x3'),'afterUpdate':_0xd99f('0x4'),'afterDestroy':_0xd99f('0x5')};function emitEvent(_0x5813e3){return function(_0x14889c,_0x56745b,_0x58e1e7){MailAccountEvents[_0xd99f('0x6')](_0x5813e3+':'+_0x14889c['id'],_0x14889c);MailAccountEvents[_0xd99f('0x6')](_0x5813e3,_0x14889c);_0x58e1e7(null);};}for(var e in events){if(events[_0xd99f('0x7')](e)){var event=events[e];MailAccount[_0xd99f('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xe225=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','remove'];(function(_0x3cc914,_0x56cbbd){var _0x217fb3=function(_0x256142){while(--_0x256142){_0x3cc914['push'](_0x3cc914['shift']());}};_0x217fb3(++_0x56cbbd);}(_0xe225,0x1bd));var _0x5e22=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xe225[_0x5a4b16];return _0x5236dc;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5e22('0x0'))['db'][_0x5e22('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5e22('0x2')};function emitEvent(_0x5ca6b5){return function(_0x45790b,_0x4e0d42,_0x50df23){MailAccountEvents['emit'](_0x5ca6b5+':'+_0x45790b['id'],_0x45790b);MailAccountEvents[_0x5e22('0x3')](_0x5ca6b5,_0x45790b);_0x50df23(null);};}for(var e in events){if(events[_0x5e22('0x4')](e)){var event=events[e];MailAccount[_0x5e22('0x5')](e,emitEvent(event));}}module[_0x5e22('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c514be2..187a76c 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 _0x840e=['exports','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes'];(function(_0x3ed442,_0x95f9c9){var _0x4b0865=function(_0x54645a){while(--_0x54645a){_0x3ed442['push'](_0x3ed442['shift']());}};_0x4b0865(++_0x95f9c9);}(_0x840e,0x1b7));var _0xe840=function(_0x4ffa03,_0x363a82){_0x4ffa03=_0x4ffa03-0x0;var _0x30d661=_0x840e[_0x4ffa03];return _0x30d661;};'use strict';var attributes=require(_0xe840('0x0'));module[_0xe840('0x1')]=function(_0xc02b1a){return _0xc02b1a['define'](_0xe840('0x2'),attributes,{'tableName':_0xe840('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x27a0df=this;var _0x5c1cd9={'id':_0x27a0df['id'],'tls':{'rejectUnauthorized':![]}};if(_0x27a0df['provider']!==_0xe840('0x4')){_0x5c1cd9[_0xe840('0x5')]=_0x27a0df[_0xe840('0x6')];}else{_0x5c1cd9[_0xe840('0x7')]=_0x27a0df[_0xe840('0x8')][_0xe840('0x7')];_0x5c1cd9[_0xe840('0x9')]=_0x27a0df[_0xe840('0x8')][_0xe840('0x9')];_0x5c1cd9['secure']=_0x27a0df['Smtp'][_0xe840('0xa')];}if(_0x27a0df['Smtp'][_0xe840('0xb')]){if(_0x27a0df[_0xe840('0x8')][_0xe840('0xc')]){if(!_0x27a0df[_0xe840('0x8')][_0xe840('0xd')])throw new Error(_0xe840('0xe'));_0x5c1cd9[_0xe840('0xf')]={'type':_0xe840('0x10'),'user':_0x27a0df[_0xe840('0x8')][_0xe840('0x11')],'accessToken':_0x27a0df[_0xe840('0x8')][_0xe840('0xd')][_0xe840('0x12')]};}else{_0x5c1cd9[_0xe840('0xf')]={'user':_0x27a0df['Smtp'][_0xe840('0x11')],'pass':_0x27a0df['Smtp'][_0xe840('0x13')]};}}return _0x5c1cd9;}}});}; \ No newline at end of file +var _0xd551=['exports','define','MailAccount','provider','custom','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xd551,0x1a1));var _0x1d55=function(_0x3e698a,_0x59967d){_0x3e698a=_0x3e698a-0x0;var _0x2b4996=_0xd551[_0x3e698a];return _0x2b4996;};'use strict';var attributes=require(_0x1d55('0x0'));module[_0x1d55('0x1')]=function(_0xfa2b83){return _0xfa2b83[_0x1d55('0x2')](_0x1d55('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4892d9=this;var _0x278b0a={'id':_0x4892d9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4892d9[_0x1d55('0x4')]!==_0x1d55('0x5')){_0x278b0a['service']=_0x4892d9['provider'];}else{_0x278b0a[_0x1d55('0x6')]=_0x4892d9['Smtp'][_0x1d55('0x6')];_0x278b0a[_0x1d55('0x7')]=_0x4892d9[_0x1d55('0x8')][_0x1d55('0x7')];_0x278b0a['secure']=_0x4892d9[_0x1d55('0x8')][_0x1d55('0x9')];}if(_0x4892d9[_0x1d55('0x8')][_0x1d55('0xa')]){if(_0x4892d9[_0x1d55('0x8')][_0x1d55('0xb')]){if(!_0x4892d9[_0x1d55('0x8')][_0x1d55('0xc')])throw new Error(_0x1d55('0xd'));_0x278b0a[_0x1d55('0xe')]={'type':_0x1d55('0xf'),'user':_0x4892d9['Smtp'][_0x1d55('0x10')],'accessToken':_0x4892d9['Smtp']['CloudProvider'][_0x1d55('0x11')]};}else{_0x278b0a[_0x1d55('0xe')]={'user':_0x4892d9[_0x1d55('0x8')]['user'],'pass':_0x4892d9[_0x1d55('0x8')][_0x1d55('0x12')]};}}return _0x278b0a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 068bb34..4e1a17c 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 _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x13043c,_0x130974){var _0x229d58=function(_0x2ef019){while(--_0x2ef019){_0x13043c['push'](_0x13043c['shift']());}};_0x229d58(++_0x130974);}(_0x2ef3,0xba));var _0x32ef=function(_0x57071b,_0x9b6731){_0x57071b=_0x57071b-0x0;var _0x368819=_0x2ef3[_0x57071b];return _0x368819;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0xef0f=['Applications','MailServerOut','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','asc','autoclose','push','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','originTo','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','find','where','setDataValue','getSmtpOptions','ShowMailAccount','body','mail','difference','keys','rawAttributes','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','MailApplication'];(function(_0x4f2419,_0xb45d3f){var _0x10966a=function(_0x1f44fb){while(--_0x1f44fb){_0x4f2419['push'](_0x4f2419['shift']());}};_0x10966a(++_0xb45d3f);}(_0xef0f,0x168));var _0xfef0=function(_0x3b7034,_0x521ed9){_0x3b7034=_0x3b7034-0x0;var _0x2d300b=_0xef0f[_0x3b7034];return _0x2d300b;};'use strict';var _=require(_0xfef0('0x0'));var moment=require('moment');var BPromise=require(_0xfef0('0x1'));var rs=require(_0xfef0('0x2'));var Redis=require(_0xfef0('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xfef0('0x4'))(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfef0('0x7')][_0xfef0('0x8')]({'port':0x232c});config[_0xfef0('0x9')]=_[_0xfef0('0xa')](config[_0xfef0('0x9')],{'host':_0xfef0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0x9')]));require('./mailAccount.socket')[_0xfef0('0xc')](socket);function respondWithRpcPromise(_0x100e3a,_0x3a81cc,_0x2d42dc){return new BPromise(function(_0x334e74,_0x402dff){return client[_0xfef0('0xd')](_0x100e3a,_0x2d42dc)[_0xfef0('0xe')](function(_0x11bbca){logger[_0xfef0('0xf')](_0xfef0('0x10'),_0x3a81cc,_0xfef0('0x11'));logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x3a81cc,'request\x20sent',JSON[_0xfef0('0x14')](_0x11bbca));if(_0x11bbca[_0xfef0('0x15')]){if(_0x11bbca[_0xfef0('0x15')][_0xfef0('0x16')]===0x1f4){logger[_0xfef0('0x15')](_0xfef0('0x10'),_0x3a81cc,_0x11bbca[_0xfef0('0x15')]['message']);return _0x402dff(_0x11bbca[_0xfef0('0x15')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3a81cc,_0x11bbca[_0xfef0('0x15')][_0xfef0('0x17')]);return _0x334e74(_0x11bbca[_0xfef0('0x15')][_0xfef0('0x17')]);}else{logger[_0xfef0('0xf')](_0xfef0('0x10'),_0x3a81cc,_0xfef0('0x11'));_0x334e74(_0x11bbca[_0xfef0('0x18')]['message']);}})[_0xfef0('0x19')](function(_0x1642cd){logger[_0xfef0('0x15')](_0xfef0('0x10'),_0x3a81cc,_0x1642cd);_0x402dff(_0x1642cd);});});}exports[_0xfef0('0x1a')]=function(_0x55912f){var _0x5283e1=this;return new Promise(function(_0x4e24de,_0x20826b){return db[_0xfef0('0x1b')][_0xfef0('0x1c')]({'raw':_0x55912f['options']?_0x55912f[_0xfef0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x55912f[_0xfef0('0x1d')]?_0x55912f[_0xfef0('0x1d')]['where']||null:null,'attributes':_0x55912f['options']?_0x55912f['options'][_0xfef0('0x1e')]||null:null,'limit':_0x55912f['options']?_0x55912f[_0xfef0('0x1d')][_0xfef0('0x1f')]||null:null,'include':_0x55912f[_0xfef0('0x1d')]?_0x55912f[_0xfef0('0x1d')][_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x55912f['options']['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x22')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1e')],'include':_0x316e20[_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x316e20[_0xfef0('0x20')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x22')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1e')],'include':_0x5df04f['include']?_[_0xfef0('0x21')](_0x5df04f[_0xfef0('0x20')],function(_0xca0cce){return{'model':db[_0xca0cce[_0xfef0('0x22')]],'as':_0xca0cce['as'],'attributes':_0xca0cce[_0xfef0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xe')](function(_0x3e3c4c){logger[_0xfef0('0xf')](_0xfef0('0x1a'),_0x55912f);logger[_0xfef0('0x12')](_0xfef0('0x1a'),_0x55912f,JSON[_0xfef0('0x14')](_0x3e3c4c));_0x4e24de(_0x3e3c4c);})['catch'](function(_0x445625){logger['error']('GetMailAccount',_0x445625[_0xfef0('0x17')],_0x55912f);_0x20826b(_0x5283e1[_0xfef0('0x15')](0x1f4,_0x445625['message']));});});};exports['ShowMailAccount']=function(_0x5cf518){var _0x4f65cd=this;return new Promise(function(_0x4cce8a,_0x417535){return db[_0xfef0('0x1b')][_0xfef0('0x23')]({'raw':_0x5cf518['options']?_0x5cf518['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518['options'][_0xfef0('0x24')]||null:null,'attributes':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518[_0xfef0('0x1d')]['attributes']||null:null,'include':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518['options'][_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x5cf518[_0xfef0('0x1d')][_0xfef0('0x20')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x22')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1e')],'include':_0x3e1a64[_0xfef0('0x20')]?_['map'](_0x3e1a64[_0xfef0('0x20')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x22')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1e')],'include':_0xea09ec[_0xfef0('0x20')]?_[_0xfef0('0x21')](_0xea09ec[_0xfef0('0x20')],function(_0xeb75e2){return{'model':db[_0xeb75e2[_0xfef0('0x22')]],'as':_0xeb75e2['as'],'attributes':_0xeb75e2[_0xfef0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xe')](function(_0x22acf9){if(_0x5cf518[_0xfef0('0x1d')]['smtp']===!![])_0x22acf9[_0xfef0('0x25')]('smtpOptions',_0x22acf9[_0xfef0('0x26')]());logger[_0xfef0('0xf')](_0xfef0('0x27'),_0x5cf518);logger['debug'](_0xfef0('0x27'),_0x5cf518,JSON[_0xfef0('0x14')](_0x22acf9));_0x4cce8a(_0x22acf9);})[_0xfef0('0x19')](function(_0x5537c8){logger[_0xfef0('0x15')](_0xfef0('0x27'),_0x5537c8[_0xfef0('0x17')],_0x5cf518);_0x417535(_0x4f65cd['error'](0x1f4,_0x5537c8[_0xfef0('0x17')]));});});};exports['NotifyMailAccount']=function(_0x49ed48){var _0xf30aff=this;return new Promise(function(_0x547a5d,_0x5c3305){var _0xbf6ddd={'body':_0x49ed48[_0xfef0('0x28')],'channel':_0xfef0('0x29')};var _0x1a6593=_[_0xfef0('0x2a')](_[_0xfef0('0x2b')](db['CmContact'][_0xfef0('0x2c')]),[_0xfef0('0x2d'),'updatedAt','CompanyId',_0xfef0('0x2e')]);var _0x5dc824=![];if(_0x49ed48[_0xfef0('0x28')]['id']){delete _0x49ed48[_0xfef0('0x28')]['id'];}if(_[_0xfef0('0x2f')](_0x49ed48[_0xfef0('0x28')][_0xfef0('0x30')])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x31')));}if(_[_0xfef0('0x2f')](_0x49ed48['body'][_0xfef0('0x28')])||_0x49ed48['body']['body']===''){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x32')));}if(_['isNil'](_0x49ed48[_0xfef0('0x28')]['mapKey'])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x33')+_0x1a6593));}if(!_[_0xfef0('0x34')](_0x1a6593,_0x49ed48[_0xfef0('0x28')]['mapKey'])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x35')+_0x1a6593));}var _0x504967={};_0x504967[_0x49ed48['body'][_0xfef0('0x36')]]=_0x49ed48['body'][_0xfef0('0x30')];return db[_0xfef0('0x1b')][_0xfef0('0x23')]({'where':{'id':_0x49ed48[_0xfef0('0x37')]['id']},'include':[{'model':db[_0xfef0('0x38')],'as':_0xfef0('0x39'),'include':[{'model':db['CmContact'],'as':_0xfef0('0x3a'),'where':_0x504967,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xfef0('0x3b')],'as':_0xfef0('0x3c')},{'model':db[_0xfef0('0x3d')],'as':'Smtp','include':[{'model':db[_0xfef0('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0x51f207){if(_0x51f207&&_0x51f207[_0xfef0('0x39')]){var _0x3d471c=_0x51f207[_0xfef0('0x3f')]({'plain':!![]});_0xbf6ddd[_0xfef0('0x37')]=_[_0xfef0('0x40')](_0x3d471c,[_0xfef0('0x3c'),_0xfef0('0x39')]);_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x41')]=_0x51f207['getSmtpOptions']();_0xbf6ddd['applications']=_0x3d471c[_0xfef0('0x3c')];_0xbf6ddd[_0xfef0('0x42')]=_0x3d471c[_0xfef0('0x39')];_0xbf6ddd[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0xbf6ddd[_0xfef0('0x43')],[_0xfef0('0x45')],[_0xfef0('0x46')]);if(_0xbf6ddd['account']&&_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x47')]){_0xbf6ddd[_0xfef0('0x43')][_0xfef0('0x48')]({'id':0x0,'priority':_0xbf6ddd[_0xfef0('0x43')]['length']+0x1,'app':'close','appdata':'autoclose','interval':_0xfef0('0x49')});}if(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x3c')]){delete _0xbf6ddd[_0xfef0('0x37')]['Applications'];}if(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x39')]){delete _0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x39')];}if(_0x3d471c[_0xfef0('0x39')][_0xfef0('0x3a')][_0xfef0('0x4a')]){return _0x3d471c['List'][_0xfef0('0x3a')][0x0];}var _0x163255=_['defaults'](_0x49ed48[_0xfef0('0x28')],{'firstName':_0x49ed48['body'][_0xfef0('0x30')],'ListId':_0x3d471c[_0xfef0('0x2e')]});_0x163255[_0x49ed48['body'][_0xfef0('0x36')]]=_0x49ed48['body']['from'];return db['CmContact'][_0xfef0('0x4b')](_0x163255);}else{throw new Error(_0xfef0('0x4c'));}})[_0xfef0('0xe')](function(_0x34fda3){_0xbf6ddd[_0xfef0('0x4d')]=_0x34fda3;if(_0x34fda3){if(!_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x4e')]){_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')]=rs[_0xfef0('0x4f')]()+'\x20'+_0x49ed48['body'][_0xfef0('0x17')]['from'];}var _0x135653={'ContactId':_0x34fda3['id'],'MailAccountId':_0x49ed48['account']['id'],'inReplyTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')],'to':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['from'],'cc':_0x49ed48[_0xfef0('0x28')]['message']['cc'],'subject':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['subject'],'attach':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x50')],'lastMsgAt':moment()[_0xfef0('0x51')](_0xfef0('0x52')),'lastMsgDirection':'in'};return db[_0xfef0('0x53')][_0xfef0('0x23')]({'where':{'closed':![],'MailAccountId':_0x49ed48[_0xfef0('0x37')]['id']},'include':[{'model':db[_0xfef0('0x54')],'as':_0xfef0('0x55'),'attributes':[_0xfef0('0x4e')],'where':{'messageId':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x56')]}}]})[_0xfef0('0xe')](function(_0x28cab7){if(_0x28cab7){return[_0x28cab7,![]];}return db[_0xfef0('0x53')][_0xfef0('0x4b')](_0x135653)['then'](function(_0x12e383){return[_0x12e383,!![]];});});}else{throw new Error(_0xfef0('0x57'));}})[_0xfef0('0x58')](function(_0x3c6bb8,_0x176fc7){if(_0x3c6bb8){_0x5dc824=_0x176fc7;if(!_0x176fc7){return _0x3c6bb8[_0xfef0('0x59')]({'inReplyTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')],'to':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x30')],'cc':_0x49ed48['body'][_0xfef0('0x17')]['cc'],'subject':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x5a')],'attach':_0x3c6bb8[_0xfef0('0x50')]?_0x3c6bb8[_0xfef0('0x50')]:_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xfef0('0x51')](_0xfef0('0x52')),'lastMsgAt':moment()[_0xfef0('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x3c6bb8;}}})[_0xfef0('0xe')](function(_0x2ab666){_0xbf6ddd[_0xfef0('0x5b')]=_0x2ab666[_0xfef0('0x3f')]({'plain':!![]});_0xbf6ddd[_0xfef0('0x5b')][_0xfef0('0x5c')]=_0x5dc824;return db[_0xfef0('0x54')]['create']({'body':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x28')],'MailAccountId':_0x49ed48[_0xfef0('0x37')]['id'],'MailInteractionId':_0x2ab666['id'],'direction':'in','ContactId':_0xbf6ddd[_0xfef0('0x4d')]['id'],'messageId':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['messageId'],'from':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x30')],'to':_0x49ed48[_0xfef0('0x28')]['message']['to'],'cc':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['cc'],'subject':_0x49ed48['body'][_0xfef0('0x17')][_0xfef0('0x5a')],'attach':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x50')],'Attachments':_0x49ed48['body']['message']['attachments'],'originTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x5d')],'originCc':_0x49ed48['body'][_0xfef0('0x17')]['originCc'],'bcc':_0x49ed48['body']['message'][_0xfef0('0x5e')],'ChatWebsiteId':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x5f')]||null,'originChannel':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['originChannel']||_0xfef0('0x60'),'ChatOfflineMessageId':_0x49ed48['body']['message'][_0xfef0('0x61')]||null},{'include':[{'model':db[_0xfef0('0x62')],'as':_0xfef0('0x63')}]});})[_0xfef0('0xe')](function(_0x4df63b){_0xbf6ddd['message']=_0x4df63b;if(_0xbf6ddd['interaction'][_0xfef0('0x64')]){return db['User'][_0xfef0('0x23')]({'attributes':['id',_0xfef0('0x65')],'where':{'id':_0xbf6ddd[_0xfef0('0x5b')][_0xfef0('0x64')]}})[_0xfef0('0xe')](function(_0x4be622){if(_0x4be622){_0xbf6ddd[_0xfef0('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4be622[_0xfef0('0x65')]+','+(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x66')]||0xa),'interval':_0xfef0('0x49')});}return respondWithRpcPromise('Start','startRouting',_0xbf6ddd);});}return respondWithRpcPromise(_0xfef0('0x67'),_0xfef0('0x68'),_0xbf6ddd);})['then'](function(_0x872f99){_0x547a5d(_0x872f99);})[_0xfef0('0x19')](function(_0x4690c0){_0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0x4690c0[_0xfef0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7b47f94..f34052e 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 _0x60e0=['update','emit','register','mailAccount:','./mailAccount.events'];(function(_0x416f7d,_0x520481){var _0x2aca73=function(_0x26ef87){while(--_0x26ef87){_0x416f7d['push'](_0x416f7d['shift']());}};_0x2aca73(++_0x520481);}(_0x60e0,0x176));var _0x060e=function(_0x72e232,_0x3baec6){_0x72e232=_0x72e232-0x0;var _0x4f497c=_0x60e0[_0x72e232];return _0x4f497c;};'use strict';var MailAccountEvents=require(_0x060e('0x0'));var events=['save','remove',_0x060e('0x1')];function createListener(_0x5c842d,_0x256ca7){return function(_0x46598a){_0x256ca7[_0x060e('0x2')](_0x5c842d,_0x46598a);};}function removeListener(_0x419c26,_0x2a6e9f){return function(){MailAccountEvents['removeListener'](_0x419c26,_0x2a6e9f);};}exports[_0x060e('0x3')]=function(_0x2b4242){for(var _0x407136=0x0,_0x52c937=events['length'];_0x407136<_0x52c937;_0x407136++){var _0xedfa6c=events[_0x407136];var _0x3e50a2=createListener(_0x060e('0x4')+_0xedfa6c,_0x2b4242);MailAccountEvents['on'](_0xedfa6c,_0x3e50a2);}}; \ No newline at end of file +var _0xe7d6=['register','./mailAccount.events','remove','update'];(function(_0x52ca18,_0x5864d1){var _0x3b04d8=function(_0x19bd2e){while(--_0x19bd2e){_0x52ca18['push'](_0x52ca18['shift']());}};_0x3b04d8(++_0x5864d1);}(_0xe7d6,0x85));var _0x6e7d=function(_0x3ae89c,_0x4bc1d3){_0x3ae89c=_0x3ae89c-0x0;var _0x54df34=_0xe7d6[_0x3ae89c];return _0x54df34;};'use strict';var MailAccountEvents=require(_0x6e7d('0x0'));var events=['save',_0x6e7d('0x1'),_0x6e7d('0x2')];function createListener(_0xf91a1,_0x5ec949){return function(_0x5eea9b){_0x5ec949['emit'](_0xf91a1,_0x5eea9b);};}function removeListener(_0x2ba59f,_0x23b386){return function(){MailAccountEvents['removeListener'](_0x2ba59f,_0x23b386);};}exports[_0x6e7d('0x3')]=function(_0x17339b){for(var _0x41b1db=0x0,_0x1bec54=events['length'];_0x41b1db<_0x1bec54;_0x41b1db++){var _0x4587ee=events[_0x41b1db];var _0x3bdbc7=createListener('mailAccount:'+_0x4587ee,_0x17339b);MailAccountEvents['on'](_0x4587ee,_0x3bdbc7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4b0509a..d41d531 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 _0x8fed=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','put','isAuthenticated','delete','destroy','multer'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8fed,0x18f));var _0xd8fe=function(_0x482833,_0x2b1059){_0x482833=_0x482833-0x0;var _0x26a75a=_0x8fed[_0x482833];return _0x26a75a;};'use strict';var multer=require(_0xd8fe('0x0'));var util=require(_0xd8fe('0x1'));var path=require(_0xd8fe('0x2'));var timeout=require(_0xd8fe('0x3'));var express=require(_0xd8fe('0x4'));var router=express[_0xd8fe('0x5')]();var fs_extra=require(_0xd8fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8fe('0x7'));var config=require(_0xd8fe('0x8'));var controller=require(_0xd8fe('0x9'));router[_0xd8fe('0xa')](_0xd8fe('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd8fe('0xc')]('/:id',auth[_0xd8fe('0xd')](),controller['update']);router[_0xd8fe('0xe')](_0xd8fe('0xb'),auth[_0xd8fe('0xd')](),controller[_0xd8fe('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0d33=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','destroy','exports'];(function(_0x159459,_0x58ee4b){var _0x18c058=function(_0x1dc2bb){while(--_0x1dc2bb){_0x159459['push'](_0x159459['shift']());}};_0x18c058(++_0x58ee4b);}(_0x0d33,0x1b3));var _0x30d3=function(_0x2703b4,_0x327991){_0x2703b4=_0x2703b4-0x0;var _0x394cdf=_0x0d33[_0x2703b4];return _0x394cdf;};'use strict';var multer=require(_0x30d3('0x0'));var util=require(_0x30d3('0x1'));var path=require(_0x30d3('0x2'));var timeout=require(_0x30d3('0x3'));var express=require(_0x30d3('0x4'));var router=express[_0x30d3('0x5')]();var fs_extra=require(_0x30d3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x30d3('0x7'));var controller=require(_0x30d3('0x8'));router[_0x30d3('0x9')](_0x30d3('0xa'),auth[_0x30d3('0xb')](),controller['show']);router[_0x30d3('0xc')](_0x30d3('0xa'),auth[_0x30d3('0xb')](),controller['update']);router['delete'](_0x30d3('0xa'),auth['isAuthenticated'](),controller[_0x30d3('0xd')]);module[_0x30d3('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 268e983..2fe628e 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 _0xb5c7=['sequelize','STRING','noop'];(function(_0x94780e,_0x4b9354){var _0x2bfd86=function(_0x31b474){while(--_0x31b474){_0x94780e['push'](_0x94780e['shift']());}};_0x2bfd86(++_0x4b9354);}(_0xb5c7,0xc3));var _0x7b5c=function(_0x12cf7b,_0x55dbb9){_0x12cf7b=_0x12cf7b-0x0;var _0x90b7b5=_0xb5c7[_0x12cf7b];return _0x90b7b5;};'use strict';var Sequelize=require(_0x7b5c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7b5c('0x1')],'allowNull':![],'defaultValue':_0x7b5c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7b5c('0x1')]},'interval':{'type':Sequelize[_0x7b5c('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x50ea=['*,*,*,*','sequelize','noop','TEXT','STRING'];(function(_0x164d7f,_0x394afe){var _0x134277=function(_0x510565){while(--_0x510565){_0x164d7f['push'](_0x164d7f['shift']());}};_0x134277(++_0x394afe);}(_0x50ea,0xf6));var _0xa50e=function(_0x5c9afe,_0x2d1d03){_0x5c9afe=_0x5c9afe-0x0;var _0xfb727c=_0x50ea[_0x5c9afe];return _0xfb727c;};'use strict';var Sequelize=require(_0xa50e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa50e('0x1')},'appdata':{'type':Sequelize[_0xa50e('0x2')]()},'description':{'type':Sequelize[_0xa50e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa50e('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 31cbc80..a7b4a68 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x1786b8,_0x23061b){var _0x5d9797=function(_0x45b88c){while(--_0x45b88c){_0x1786b8['push'](_0x1786b8['shift']());}};_0x5d9797(++_0x23061b);}(_0xac4a,0x13f));var _0xaac4=function(_0x2951d2,_0x3a969b){_0x2951d2=_0x2951d2-0x0;var _0x123315=_0xac4a[_0x2951d2];return _0x123315;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0xda21e8,_0x19d184){var _0x28904b=function(_0x10c833){while(--_0x10c833){_0xda21e8['push'](_0xda21e8['shift']());}};_0x28904b(++_0x19d184);}(_0xe706,0xa3));var _0x6e70=function(_0x3f3519,_0xd53cae){_0x3f3519=_0x3f3519-0x0;var _0x23b6bf=_0xe706[_0x3f3519];return _0x23b6bf;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 68fb0ea..a387e14 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 _0xcf38=['api','moment','request-promise','path','rimraf','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x28ae95,_0x4536c9){var _0x5d3a74=function(_0x4f3211){while(--_0x4f3211){_0x28ae95['push'](_0x28ae95['shift']());}};_0x5d3a74(++_0x4536c9);}(_0xcf38,0xe7));var _0x8cf3=function(_0x544463,_0x214963){_0x544463=_0x544463-0x0;var _0x1add2a=_0xcf38[_0x544463];return _0x1add2a;};'use strict';var _=require(_0x8cf3('0x0'));var util=require(_0x8cf3('0x1'));var logger=require(_0x8cf3('0x2'))(_0x8cf3('0x3'));var moment=require(_0x8cf3('0x4'));var BPromise=require('bluebird');var rp=require(_0x8cf3('0x5'));var fs=require('fs');var path=require(_0x8cf3('0x6'));var rimraf=require(_0x8cf3('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x8cf3('0x8')]=function(_0xf6c52c,_0x3b37f7){return _0xf6c52c[_0x8cf3('0x9')](_0x8cf3('0xa'),attributes,{'tableName':_0x8cf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8cf3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x51e9=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x395aff,_0x2ab13d){var _0x218774=function(_0x4f874e){while(--_0x4f874e){_0x395aff['push'](_0x395aff['shift']());}};_0x218774(++_0x2ab13d);}(_0x51e9,0x1a1));var _0x951e=function(_0x39529b,_0x3cc044){_0x39529b=_0x39529b-0x0;var _0x26ba43=_0x51e9[_0x39529b];return _0x26ba43;};'use strict';var _=require(_0x951e('0x0'));var util=require(_0x951e('0x1'));var logger=require(_0x951e('0x2'))(_0x951e('0x3'));var moment=require(_0x951e('0x4'));var BPromise=require(_0x951e('0x5'));var rp=require(_0x951e('0x6'));var fs=require('fs');var path=require(_0x951e('0x7'));var rimraf=require(_0x951e('0x8'));var config=require(_0x951e('0x9'));var attributes=require(_0x951e('0xa'));module[_0x951e('0xb')]=function(_0x43a58f,_0x2f1f06){return _0x43a58f[_0x951e('0xc')](_0x951e('0xd'),attributes,{'tableName':_0x951e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x951e('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9ba5efc..db17ad4 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 _0xf6b2=['UpdateMailApplication','MailApplication','options','raw','where','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x30b2c6,_0x1eafe8){var _0x42052d=function(_0xfeb539){while(--_0xfeb539){_0x30b2c6['push'](_0x30b2c6['shift']());}};_0x42052d(++_0x1eafe8);}(_0xf6b2,0x115));var _0x2f6b=function(_0x165e9f,_0x318732){_0x165e9f=_0x165e9f-0x0;var _0x430a9e=_0xf6b2[_0x165e9f];return _0x430a9e;};'use strict';var _=require(_0x2f6b('0x0'));var util=require(_0x2f6b('0x1'));var moment=require(_0x2f6b('0x2'));var BPromise=require(_0x2f6b('0x3'));var rs=require(_0x2f6b('0x4'));var fs=require('fs');var Redis=require(_0x2f6b('0x5'));var db=require(_0x2f6b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f6b('0x7'))(_0x2f6b('0x8'));var config=require(_0x2f6b('0x9'));var jayson=require(_0x2f6b('0xa'));var client=jayson['client'][_0x2f6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dac0d,_0x106ea6,_0x495dbe){return new BPromise(function(_0x3cb513,_0x5b9cc7){return client[_0x2f6b('0xc')](_0x5dac0d,_0x495dbe)['then'](function(_0x3f5d14){logger[_0x2f6b('0xd')](_0x2f6b('0xe'),_0x106ea6,'request\x20sent');logger[_0x2f6b('0xf')](_0x2f6b('0x10'),_0x106ea6,'request\x20sent',JSON[_0x2f6b('0x11')](_0x3f5d14));if(_0x3f5d14['error']){if(_0x3f5d14['error']['code']===0x1f4){logger['error'](_0x2f6b('0xe'),_0x106ea6,_0x3f5d14[_0x2f6b('0x12')][_0x2f6b('0x13')]);return _0x5b9cc7(_0x3f5d14[_0x2f6b('0x12')]['message']);}logger[_0x2f6b('0x12')](_0x2f6b('0xe'),_0x106ea6,_0x3f5d14[_0x2f6b('0x12')][_0x2f6b('0x13')]);return _0x3cb513(_0x3f5d14[_0x2f6b('0x12')]['message']);}else{logger[_0x2f6b('0xd')](_0x2f6b('0xe'),_0x106ea6,_0x2f6b('0x14'));_0x3cb513(_0x3f5d14[_0x2f6b('0x15')][_0x2f6b('0x13')]);}})[_0x2f6b('0x16')](function(_0x2ccf6d){logger[_0x2f6b('0x12')](_0x2f6b('0xe'),_0x106ea6,_0x2ccf6d);_0x5b9cc7(_0x2ccf6d);});});}exports[_0x2f6b('0x17')]=function(_0x187965){var _0x4ad4a7=this;return new Promise(function(_0x555d1d,_0x51d204){return db[_0x2f6b('0x18')]['update'](_0x187965['body'],{'raw':_0x187965['options']?_0x187965[_0x2f6b('0x19')][_0x2f6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187965[_0x2f6b('0x19')]?_0x187965[_0x2f6b('0x19')][_0x2f6b('0x1b')]||null:null,'attributes':_0x187965['options']?_0x187965[_0x2f6b('0x19')]['attributes']||null:null,'limit':_0x187965[_0x2f6b('0x19')]?_0x187965[_0x2f6b('0x19')][_0x2f6b('0x1c')]||null:null})[_0x2f6b('0x1d')](function(_0x492827){logger[_0x2f6b('0xd')](_0x2f6b('0x17'),_0x187965);logger[_0x2f6b('0xf')](_0x2f6b('0x17'),_0x187965,JSON['stringify'](_0x492827));_0x555d1d(_0x492827);})[_0x2f6b('0x16')](function(_0x57b1ee){logger[_0x2f6b('0x12')](_0x2f6b('0x17'),_0x57b1ee[_0x2f6b('0x13')],_0x187965);_0x51d204(_0x4ad4a7['error'](0x1f4,_0x57b1ee[_0x2f6b('0x13')]));});});}; \ No newline at end of file +var _0xabd2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','limit','then','lodash','util'];(function(_0xd66253,_0x28277b){var _0x6cc65f=function(_0x1b6ec4){while(--_0x1b6ec4){_0xd66253['push'](_0xd66253['shift']());}};_0x6cc65f(++_0x28277b);}(_0xabd2,0x10c));var _0x2abd=function(_0xbbaa03,_0x3be846){_0xbbaa03=_0xbbaa03-0x0;var _0x54558c=_0xabd2[_0xbbaa03];return _0x54558c;};'use strict';var _=require(_0x2abd('0x0'));var util=require(_0x2abd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2abd('0x2'))['db'];var utils=require(_0x2abd('0x3'));var logger=require(_0x2abd('0x4'))(_0x2abd('0x5'));var config=require(_0x2abd('0x6'));var jayson=require(_0x2abd('0x7'));var client=jayson[_0x2abd('0x8')][_0x2abd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28f848,_0x488370,_0x866534){return new BPromise(function(_0x40a6d9,_0x504a21){return client[_0x2abd('0xa')](_0x28f848,_0x866534)['then'](function(_0x21b27e){logger[_0x2abd('0xb')](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));logger[_0x2abd('0xe')](_0x2abd('0xf'),_0x488370,_0x2abd('0xd'),JSON[_0x2abd('0x10')](_0x21b27e));if(_0x21b27e[_0x2abd('0x11')]){if(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x12')]===0x1f4){logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x504a21(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x40a6d9(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}else{logger['info'](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));_0x40a6d9(_0x21b27e[_0x2abd('0x14')][_0x2abd('0x13')]);}})[_0x2abd('0x15')](function(_0xe81c78){logger[_0x2abd('0x11')]('MailApplication,\x20%s,\x20%s',_0x488370,_0xe81c78);_0x504a21(_0xe81c78);});});}exports[_0x2abd('0x16')]=function(_0x352122){var _0x59269c=this;return new Promise(function(_0x139edf,_0x435aee){return db[_0x2abd('0x17')][_0x2abd('0x18')](_0x352122[_0x2abd('0x19')],{'raw':_0x352122[_0x2abd('0x1a')]?_0x352122['options'][_0x2abd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x352122['options']?_0x352122[_0x2abd('0x1a')]['where']||null:null,'attributes':_0x352122['options']?_0x352122[_0x2abd('0x1a')]['attributes']||null:null,'limit':_0x352122[_0x2abd('0x1a')]?_0x352122['options'][_0x2abd('0x1c')]||null:null})[_0x2abd('0x1d')](function(_0x2541cc){logger[_0x2abd('0xb')]('UpdateMailApplication',_0x352122);logger[_0x2abd('0xe')](_0x2abd('0x16'),_0x352122,JSON[_0x2abd('0x10')](_0x2541cc));_0x139edf(_0x2541cc);})[_0x2abd('0x15')](function(_0x242e70){logger[_0x2abd('0x11')](_0x2abd('0x16'),_0x242e70[_0x2abd('0x13')],_0x352122);_0x435aee(_0x59269c[_0x2abd('0x11')](0x1f4,_0x242e70[_0x2abd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5dc8a1e..d2ffc03 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 _0xf699=['mail','mailinteraction:destroy','destroy','/:id/tags','removeTags','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','/:id/download','download','post','create','/:id/messages','addMessage','tracked','mailinteraction:addtags','addTags','put','mailinteraction:update','delete'];(function(_0x57dc4b,_0x5b23d3){var _0x1304c1=function(_0x3ccee2){while(--_0x3ccee2){_0x57dc4b['push'](_0x57dc4b['shift']());}};_0x1304c1(++_0x5b23d3);}(_0xf699,0x1c7));var _0x9f69=function(_0x472c85,_0x401195){_0x472c85=_0x472c85-0x0;var _0x5dfe9d=_0xf699[_0x472c85];return _0x5dfe9d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x9f69('0x0'));var interaction=require(_0x9f69('0x1'));var controller=require(_0x9f69('0x2'));router[_0x9f69('0x3')]('/',auth['isAuthenticated'](),controller[_0x9f69('0x4')]);router[_0x9f69('0x3')](_0x9f69('0x5'),auth[_0x9f69('0x6')](),controller['describe']);router[_0x9f69('0x3')](_0x9f69('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x9f69('0x3')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x9f69('0x3')](_0x9f69('0x8'),auth[_0x9f69('0x6')](),controller[_0x9f69('0x9')]);router[_0x9f69('0xa')]('/',auth[_0x9f69('0x6')](),controller[_0x9f69('0xb')]);router[_0x9f69('0xa')](_0x9f69('0xc'),auth[_0x9f69('0x6')](),controller[_0x9f69('0xd')]);router[_0x9f69('0xa')]('/:id/tags',auth[_0x9f69('0x6')](),interaction[_0x9f69('0xe')]('mail',_0x9f69('0xf')),controller[_0x9f69('0x10')]);router[_0x9f69('0x11')]('/:id',auth[_0x9f69('0x6')](),interaction['tracked']('mail',_0x9f69('0x12')),controller['update']);router[_0x9f69('0x13')](_0x9f69('0x7'),auth[_0x9f69('0x6')](),interaction['tracked'](_0x9f69('0x14'),_0x9f69('0x15')),controller[_0x9f69('0x16')]);router[_0x9f69('0x13')](_0x9f69('0x17'),auth[_0x9f69('0x6')](),controller[_0x9f69('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4ace=['delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update'];(function(_0x9e879f,_0x376ad4){var _0x3da06d=function(_0x2ff4ad){while(--_0x2ff4ad){_0x9e879f['push'](_0x9e879f['shift']());}};_0x3da06d(++_0x376ad4);}(_0x4ace,0x160));var _0xe4ac=function(_0x52908f,_0x53a7a3){_0x52908f=_0x52908f-0x0;var _0x1a6af0=_0x4ace[_0x52908f];return _0x1a6af0;};'use strict';var express=require(_0xe4ac('0x0'));var router=express[_0xe4ac('0x1')]();var auth=require(_0xe4ac('0x2'));var interaction=require(_0xe4ac('0x3'));var controller=require(_0xe4ac('0x4'));router[_0xe4ac('0x5')]('/',auth[_0xe4ac('0x6')](),controller[_0xe4ac('0x7')]);router[_0xe4ac('0x5')](_0xe4ac('0x8'),auth[_0xe4ac('0x6')](),controller[_0xe4ac('0x9')]);router[_0xe4ac('0x5')](_0xe4ac('0xa'),auth['isAuthenticated'](),controller[_0xe4ac('0xb')]);router[_0xe4ac('0x5')]('/:id/messages',auth[_0xe4ac('0x6')](),controller['getMessages']);router[_0xe4ac('0x5')](_0xe4ac('0xc'),auth['isAuthenticated'](),controller[_0xe4ac('0xd')]);router[_0xe4ac('0xe')]('/',auth['isAuthenticated'](),controller[_0xe4ac('0xf')]);router[_0xe4ac('0xe')](_0xe4ac('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0xe4ac('0xe')](_0xe4ac('0x11'),auth['isAuthenticated'](),interaction[_0xe4ac('0x12')](_0xe4ac('0x13'),_0xe4ac('0x14')),controller[_0xe4ac('0x15')]);router[_0xe4ac('0x16')](_0xe4ac('0xa'),auth['isAuthenticated'](),interaction[_0xe4ac('0x12')](_0xe4ac('0x13'),_0xe4ac('0x17')),controller[_0xe4ac('0x18')]);router[_0xe4ac('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xe4ac('0x12')](_0xe4ac('0x13'),'mailinteraction:destroy'),controller[_0xe4ac('0x1a')]);router[_0xe4ac('0x19')](_0xe4ac('0x11'),auth[_0xe4ac('0x6')](),controller[_0xe4ac('0x1b')]);module[_0xe4ac('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 303a8b9..d846ccb 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 _0x9b70=['iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize'];(function(_0xcdd786,_0x1ed6d3){var _0x4b6fe0=function(_0x3a3f92){while(--_0x3a3f92){_0xcdd786['push'](_0xcdd786['shift']());}};_0x4b6fe0(++_0x1ed6d3);}(_0x9b70,0x8b));var _0x09b7=function(_0x189dbd,_0x1d3cad){_0x189dbd=_0x189dbd-0x0;var _0x7861fb=_0x9b70[_0x189dbd];return _0x7861fb;};'use strict';var Sequelize=require(_0x09b7('0x0'));var iconv=require(_0x09b7('0x1'));module[_0x09b7('0x2')]={'closed':{'type':Sequelize[_0x09b7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x09b7('0x4')]},'secondDisposition':{'type':Sequelize[_0x09b7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x09b7('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x09b7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x09b7('0x4')]},'cc':{'type':Sequelize[_0x09b7('0x5')](_0x09b7('0x6'))},'subject':{'type':Sequelize[_0x09b7('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x09b7('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x09b7('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x09b7('0x8')]('in',_0x09b7('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x09b7('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x09b7('0x8')]('in',_0x09b7('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x09b7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa6a9=['exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize','iconv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6a9,0x166));var _0x9a6a=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0xa6a9[_0x3d27ba];return _0xf01885;};'use strict';var Sequelize=require(_0x9a6a('0x0'));var iconv=require(_0x9a6a('0x1'));module[_0x9a6a('0x2')]={'closed':{'type':Sequelize[_0x9a6a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9a6a('0x4')]},'secondDisposition':{'type':Sequelize[_0x9a6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9a6a('0x4')]},'note':{'type':Sequelize[_0x9a6a('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9a6a('0x4')]},'cc':{'type':Sequelize[_0x9a6a('0x5')](_0x9a6a('0x6'))},'subject':{'type':Sequelize[_0x9a6a('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9a6a('0x7')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x9a6a('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x9a6a('0x8')]('in',_0x9a6a('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9a6a('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9a6a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b211027..8135e4e 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 _0x0ffd=['MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','unix','toString','join','root','tmp','files','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','missing.recipient@your.company.com','subject','createdAt','headers','bcc','basename','existsSync','build','message%d.eml','download','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','ids','omit','getMessages','MailMessage','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0ffd,0x101));var _0xd0ff=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x0ffd[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0ff('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xd0ff('0x1'));var path=require(_0xd0ff('0x2'));var fs=require('fs');var _=require(_0xd0ff('0x3'));var juice=require('juice');var Redis=require(_0xd0ff('0x4'));var interaction=require(_0xd0ff('0x5'));var qs=require(_0xd0ff('0x6'));var logger=require(_0xd0ff('0x7'))('api');var config=require(_0xd0ff('0x8'));var db=require(_0xd0ff('0x9'))['db'];var htmlEntities=require(_0xd0ff('0xa'));config[_0xd0ff('0xb')]=_[_0xd0ff('0xc')](config[_0xd0ff('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0ff('0xd'))(new Redis(config[_0xd0ff('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x53b244,_0x189e11){_0x189e11=_0x189e11||0xcc;return function(_0x5192f0){if(_0x5192f0){return _0x53b244[_0xd0ff('0xe')](_0x189e11);}return _0x53b244[_0xd0ff('0xf')](_0x189e11)[_0xd0ff('0x10')]();};}function respondWithResult(_0x20ce32,_0x32bdb6){_0x32bdb6=_0x32bdb6||0xc8;return function(_0x3579e4){if(_0x3579e4){return _0x20ce32[_0xd0ff('0xf')](_0x32bdb6)[_0xd0ff('0x11')](_0x3579e4);}};}function respondWithFilteredResult(_0x40cc9b,_0x243b7d){return function(_0x2121e8){if(_0x2121e8){var _0x387ba0=typeof _0x243b7d[_0xd0ff('0x12')]===_0xd0ff('0x13')&&typeof _0x243b7d[_0xd0ff('0x14')]===_0xd0ff('0x13');var _0x3dae60=_0x2121e8[_0xd0ff('0x15')];var _0x543943=_0x387ba0?0x0:_0x243b7d[_0xd0ff('0x12')];var _0x10d173=_0x387ba0?_0x2121e8['count']:_0x243b7d['offset']+_0x243b7d['limit'];var _0x5a3327;if(_0x10d173>=_0x3dae60){_0x10d173=_0x3dae60;_0x5a3327=0xc8;}else{_0x5a3327=0xce;}_0x40cc9b['status'](_0x5a3327);return _0x40cc9b['set'](_0xd0ff('0x16'),_0x543943+'-'+_0x10d173+'/'+_0x3dae60)[_0xd0ff('0x11')](_0x2121e8);}return null;};}function saveUpdates(_0x15b1b5){return function(_0x2609bb){if(_0x2609bb){return _0x2609bb['update'](_0x15b1b5)[_0xd0ff('0x17')](function(_0x5a1884){return _0x5a1884;});}return null;};}function removeEntity(_0x4689fd){return function(_0x4b4abc){if(_0x4b4abc){return _0x4b4abc['destroy']()[_0xd0ff('0x17')](function(){_0x4689fd[_0xd0ff('0xf')](0xcc)[_0xd0ff('0x10')]();});}};}function handleEntityNotFound(_0x3e4ea9){return function(_0x272187){if(!_0x272187){_0x3e4ea9[_0xd0ff('0xe')](0x194);}return _0x272187;};}function handleError(_0x559838,_0xf6078d){_0xf6078d=_0xf6078d||0x1f4;return function(_0x322887){logger[_0xd0ff('0x18')](_0x322887[_0xd0ff('0x19')]);if(_0x322887[_0xd0ff('0x1a')]){delete _0x322887[_0xd0ff('0x1a')];}_0x559838[_0xd0ff('0xf')](_0xf6078d)[_0xd0ff('0x1b')](_0x322887);};}exports[_0xd0ff('0x1c')]=function(_0x46b483,_0x3a932d){var _0x2c7466={};var _0x371333=_[_0xd0ff('0x1d')](db[_0xd0ff('0x1e')][_0xd0ff('0x1f')],function(_0x27c8f2){return{'name':_0x27c8f2[_0xd0ff('0x20')],'type':_0x27c8f2[_0xd0ff('0x21')][_0xd0ff('0x22')]};});_0x2c7466=qs[_0xd0ff('0x23')](_0x371333,_0x46b483);return interaction[_0xd0ff('0x24')](_0xd0ff('0x25'),_0x46b483['query'],_0x46b483[_0xd0ff('0x26')],_0x2c7466,_0x371333)[_0xd0ff('0x17')](respondWithFilteredResult(_0x3a932d,_0x2c7466))[_0xd0ff('0x27')](handleError(_0x3a932d,null));};exports[_0xd0ff('0x28')]=function(_0x382a4,_0x1b0693){var _0xf4af7f={'raw':![],'where':{'id':_0x382a4[_0xd0ff('0x29')]['id']}},_0x53a954={};_0x53a954[_0xd0ff('0x2a')]=_[_0xd0ff('0x2b')](db[_0xd0ff('0x1e')]['rawAttributes']);_0x53a954[_0xd0ff('0x2c')]=_[_0xd0ff('0x2b')](_0x382a4[_0xd0ff('0x2c')]);_0x53a954[_0xd0ff('0x2d')]=_[_0xd0ff('0x2e')](_0x53a954[_0xd0ff('0x2a')],_0x53a954[_0xd0ff('0x2c')]);_0xf4af7f[_0xd0ff('0x2f')]=_[_0xd0ff('0x2e')](_0x53a954['model'],qs[_0xd0ff('0x30')](_0x382a4[_0xd0ff('0x2c')][_0xd0ff('0x30')]));_0xf4af7f[_0xd0ff('0x2f')]=_0xf4af7f[_0xd0ff('0x2f')][_0xd0ff('0x31')]?_0xf4af7f[_0xd0ff('0x2f')]:_0x53a954[_0xd0ff('0x2a')];if(_0x382a4[_0xd0ff('0x2c')][_0xd0ff('0x32')]){_0xf4af7f[_0xd0ff('0x33')]=[{'all':!![]}];}_0xf4af7f=_[_0xd0ff('0x34')]({},_0xf4af7f,_0x382a4[_0xd0ff('0x35')]);return db['MailInteraction'][_0xd0ff('0x36')](_0xf4af7f)[_0xd0ff('0x17')](handleEntityNotFound(_0x1b0693,null))[_0xd0ff('0x17')](respondWithResult(_0x1b0693,null))[_0xd0ff('0x27')](handleError(_0x1b0693,null));};exports[_0xd0ff('0x37')]=function(_0x512ede,_0xf78bfd){return db['MailInteraction']['create'](_0x512ede[_0xd0ff('0x38')],{})[_0xd0ff('0x17')](respondWithResult(_0xf78bfd,0xc9))[_0xd0ff('0x27')](handleError(_0xf78bfd,null));};exports[_0xd0ff('0x39')]=function(_0x2352b3,_0x23a627){if(_0x2352b3[_0xd0ff('0x38')]['id']){delete _0x2352b3[_0xd0ff('0x38')]['id'];}return db[_0xd0ff('0x1e')][_0xd0ff('0x36')]({'where':{'id':_0x2352b3[_0xd0ff('0x29')]['id']}})[_0xd0ff('0x17')](handleEntityNotFound(_0x23a627,null))[_0xd0ff('0x17')](saveUpdates(_0x2352b3['body'],null))[_0xd0ff('0x17')](respondWithResult(_0x23a627,null))[_0xd0ff('0x27')](handleError(_0x23a627,null));};exports[_0xd0ff('0x3a')]=function(_0x5ad800,_0x5582b8){return db[_0xd0ff('0x1e')]['find']({'where':{'id':_0x5ad800['params']['id']}})[_0xd0ff('0x17')](handleEntityNotFound(_0x5582b8,null))[_0xd0ff('0x17')](removeEntity(_0x5582b8,null))[_0xd0ff('0x27')](handleError(_0x5582b8,null));};exports[_0xd0ff('0x3b')]=function(_0x2a4a56,_0xd2776f){return db[_0xd0ff('0x1e')]['describe']()[_0xd0ff('0x17')](respondWithResult(_0xd2776f,null))[_0xd0ff('0x27')](handleError(_0xd2776f,null));};exports[_0xd0ff('0x3c')]=function(_0x29f47b,_0x308336){return db['MailMessage']['find']({'where':{'id':_0x29f47b[_0xd0ff('0x29')]['id']}})['then'](handleEntityNotFound(_0x308336,null))[_0xd0ff('0x17')](function(_0x2394ee){if(_0x2394ee){return _0x2394ee[_0xd0ff('0x3c')](_0x29f47b[_0xd0ff('0x38')][_0xd0ff('0x3d')],_[_0xd0ff('0x3e')](_0x29f47b[_0xd0ff('0x38')],[_0xd0ff('0x3d'),'id'])||{});}})[_0xd0ff('0x17')](respondWithResult(_0x308336,null))[_0xd0ff('0x27')](handleError(_0x308336,null));};exports[_0xd0ff('0x3f')]=function(_0x38e6ac,_0x51c23b){var _0x2887d7={'raw':![],'where':{}};var _0x62251e={};var _0x30e015={'count':0x0,'rows':[]};return db[_0xd0ff('0x1e')]['findOne']({'where':{'id':_0x38e6ac[_0xd0ff('0x29')]['id']}})[_0xd0ff('0x17')](handleEntityNotFound(_0x51c23b,null))[_0xd0ff('0x17')](function(_0xa0b1b){if(_0xa0b1b){_0x62251e['model']=_['keys'](db[_0xd0ff('0x40')][_0xd0ff('0x1f')]);_0x62251e['query']=_['keys'](_0x38e6ac[_0xd0ff('0x2c')]);_0x62251e['filters']=_[_0xd0ff('0x2e')](_0x62251e[_0xd0ff('0x2a')],_0x62251e[_0xd0ff('0x2c')]);_0x2887d7[_0xd0ff('0x2f')]=_[_0xd0ff('0x2e')](_0x62251e['model'],qs[_0xd0ff('0x30')](_0x38e6ac['query']['fields']));_0x2887d7[_0xd0ff('0x2f')]=_0x2887d7['attributes'][_0xd0ff('0x31')]?_0x2887d7[_0xd0ff('0x2f')]:_0x62251e[_0xd0ff('0x2a')];if(!_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x41')](_0xd0ff('0x42'))){_0x2887d7[_0xd0ff('0x14')]=qs[_0xd0ff('0x14')](_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x14')]);_0x2887d7[_0xd0ff('0x12')]=qs[_0xd0ff('0x12')](_0x38e6ac[_0xd0ff('0x2c')]['offset']);}_0x2887d7['order']=qs['sort'](_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x43')]);_0x2887d7[_0xd0ff('0x44')]=qs[_0xd0ff('0x2d')](_[_0xd0ff('0x45')](_0x38e6ac[_0xd0ff('0x2c')],_0x62251e[_0xd0ff('0x2d')]));_0x2887d7[_0xd0ff('0x44')][_0xd0ff('0x46')]=_0xa0b1b['id'];if(_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x47')]){_0x2887d7[_0xd0ff('0x44')]=_[_0xd0ff('0x34')](_0x2887d7[_0xd0ff('0x44')],{'$or':_[_0xd0ff('0x1d')](_0x2887d7['attributes'],function(_0x537f6b){var _0xa013de={};_0xa013de[_0x537f6b]={'$like':'%'+_0x38e6ac['query'][_0xd0ff('0x47')]+'%'};return _0xa013de;})});}if(_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x48')]){var _0x5934d2=_0x38e6ac[_0xd0ff('0x2c')]['$gte'][_0xd0ff('0x49')](',');var _0x4764a8={};_0x4764a8[_0x5934d2[0x0]]={'$gte':moment(_0x5934d2[0x1])[_0xd0ff('0x4a')](_0xd0ff('0x4b'))};_0x2887d7[_0xd0ff('0x44')]=_[_0xd0ff('0x34')](_0x2887d7[_0xd0ff('0x44')],_0x4764a8);}_0x2887d7=_[_0xd0ff('0x34')]({},_0x2887d7,_0x38e6ac[_0xd0ff('0x35')]);return db[_0xd0ff('0x40')][_0xd0ff('0x15')]({'where':_0x2887d7[_0xd0ff('0x44')]})[_0xd0ff('0x17')](function(_0x2e9176){_0x30e015[_0xd0ff('0x15')]=_0x2e9176;if(_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x32')]){_0x2887d7[_0xd0ff('0x33')]=[{'all':!![]}];}return db['MailMessage'][_0xd0ff('0x24')](_0x2887d7);})[_0xd0ff('0x17')](function(_0x3dd846){if(_0x38e6ac[_0xd0ff('0x2c')][_0xd0ff('0x4c')]===_0xd0ff('0x4d')){for(var _0x35619c=0x0;_0x35619c<_0x3dd846[_0xd0ff('0x31')];_0x35619c++){_0x3dd846[_0x35619c][_0xd0ff('0x38')]=juice(_0x3dd846[_0x35619c][_0xd0ff('0x38')]);}}_0x30e015[_0xd0ff('0x4e')]=_0x3dd846;return _0x30e015;});}})[_0xd0ff('0x17')](respondWithFilteredResult(_0x51c23b,_0x2887d7))[_0xd0ff('0x27')](handleError(_0x51c23b,null));};exports[_0xd0ff('0x4f')]=function(_0x2b1759,_0x499993){return db['MailInteraction'][_0xd0ff('0x36')]({'where':{'id':_0x2b1759[_0xd0ff('0x29')]['id']}})[_0xd0ff('0x17')](handleEntityNotFound(_0x499993,null))[_0xd0ff('0x17')](function(_0x305dc0){if(_0x305dc0){return _0x305dc0[_0xd0ff('0x50')](_0x2b1759[_0xd0ff('0x38')]['ids'],_[_0xd0ff('0x3e')](_0x2b1759[_0xd0ff('0x38')],[_0xd0ff('0x3d'),'id'])||{})[_0xd0ff('0x51')](function(){return db[_0xd0ff('0x52')][_0xd0ff('0x24')]({'attributes':['id',_0xd0ff('0x1a'),_0xd0ff('0x53')],'where':{'id':_0x2b1759[_0xd0ff('0x38')][_0xd0ff('0x3d')]}});})['then'](function(_0x2913d1){socket[_0xd0ff('0x54')](_0xd0ff('0x55'),{'id':Number(_0x2b1759[_0xd0ff('0x29')]['id']),'tags':_0x2913d1||[]});return{'id':Number(_0x2b1759[_0xd0ff('0x29')]['id']),'tags':_0x2913d1||[]};});}})[_0xd0ff('0x17')](respondWithResult(_0x499993,null))['catch'](handleError(_0x499993,null));};exports['removeTags']=function(_0x4b125e,_0x3f28d0){return db[_0xd0ff('0x1e')][_0xd0ff('0x36')]({'where':{'id':_0x4b125e[_0xd0ff('0x29')]['id']}})[_0xd0ff('0x17')](handleEntityNotFound(_0x3f28d0,null))[_0xd0ff('0x17')](function(_0x4b8743){if(_0x4b8743){return _0x4b8743['removeTags'](_0x4b125e[_0xd0ff('0x2c')][_0xd0ff('0x3d')]);}})[_0xd0ff('0x17')](respondWithStatusCode(_0x3f28d0,null))['catch'](handleError(_0x3f28d0,null));};exports['download']=function(_0x354e0c,_0x5f4041){var _0x4eb774=moment()[_0xd0ff('0x56')]()[_0xd0ff('0x57')]();var _0x51aafd=path[_0xd0ff('0x58')](config[_0xd0ff('0x59')],'server','files',_0xd0ff('0x5a'));var _0x473ae8=path['join'](config['root'],'server',_0xd0ff('0x5b'),'attachments');var _0x2e5327=path[_0xd0ff('0x58')](_0x51aafd,_0x4eb774);var _0xabd600=util[_0xd0ff('0x4a')](_0xd0ff('0x5c'),_0x354e0c['params']['id'],_0x4eb774);var _0x2a9f7f=path['join'](_0x51aafd,_0xabd600);var _0x11a066=[];if(_0x354e0c[_0xd0ff('0x2c')][_0xd0ff('0x5d')]){_0x11a066[_0xd0ff('0x5e')]({'model':db[_0xd0ff('0x5f')],'as':_0xd0ff('0x60'),'raw':!![]});}var _0xdc5e4d=[{'model':db[_0xd0ff('0x40')],'as':_0xd0ff('0x61'),'attributes':['id','body',_0xd0ff('0x62'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs[_0xd0ff('0x43')]('id'),'include':_0x11a066}];return db[_0xd0ff('0x1e')][_0xd0ff('0x36')]({'where':{'id':_0x354e0c[_0xd0ff('0x29')]['id']},'include':_0xdc5e4d})['then'](handleEntityNotFound(_0x5f4041,null))[_0xd0ff('0x17')](function(_0x155346){if(_0x155346&&_0x155346['Messages']){var _0x401290=_0x155346['get']({'plain':!![]});fs['mkdirSync'](_0x2e5327);return BPromise['each'](_0x401290['Messages'],function(_0x186f23,_0x290cea){var _0x7d33ea={'from':_0x186f23[_0xd0ff('0x62')],'to':_0x186f23['to']||_0xd0ff('0x63'),'subject':_0x186f23[_0xd0ff('0x64')],'html':htmlEntities['decode'](_0x186f23['body']),'headers':{'Date':moment(_0x186f23[_0xd0ff('0x65')])[_0xd0ff('0x4a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x186f23['cc']){_0x7d33ea[_0xd0ff('0x66')]['Cc']=_0x186f23['cc'];}if(_0x186f23[_0xd0ff('0x67')]){_0x7d33ea[_0xd0ff('0x66')]['Bcc']=_0x186f23['bcc'];}return new BPromise(function(_0x4ee32b,_0x1f202e){if(_0x186f23[_0xd0ff('0x60')]){for(var _0x401c45=0x0;_0x401c45<_0x186f23[_0xd0ff('0x60')][_0xd0ff('0x31')];_0x401c45++){var _0xca97a9=_0x186f23['Attachments'][_0x401c45];var _0xc78ca8=path['join'](_0x473ae8,_0xca97a9[_0xd0ff('0x68')]);if(fs[_0xd0ff('0x69')](_0xc78ca8)){_0x7d33ea[_0xd0ff('0x5d')]['push']({'name':_0xca97a9[_0xd0ff('0x1a')],'contentType':_0xca97a9[_0xd0ff('0x21')],'data':fs['readFileSync'](_0xc78ca8)});}}}emlformat[_0xd0ff('0x6a')](_0x7d33ea,function(_0x2b203a,_0x5c04fe){if(_0x2b203a)return _0x1f202e(_0x2b203a);fs['writeFileSync'](path[_0xd0ff('0x58')](_0x2e5327,util[_0xd0ff('0x4a')](_0xd0ff('0x6b'),_0x290cea)),_0x5c04fe);return _0x4ee32b(_0x5c04fe);});});})[_0xd0ff('0x17')](function(){return new BPromise(function(_0x400dbe,_0xfbdfe7){zipdir(_0x2e5327,{'saveTo':_0x2a9f7f},function(_0x5e5b03,_0x2016b6){if(_0x5e5b03)return _0xfbdfe7(_0x5e5b03);return _0x400dbe(_0x2016b6);});})[_0xd0ff('0x17')](function(){return new BPromise(function(_0x3c019e,_0x3c1ab5){rimraf(_0x2e5327,function(_0x414adf){if(_0x414adf)_0x3c1ab5(_0x414adf);return _0x3c019e();});});})[_0xd0ff('0x17')](function(){return _0x5f4041[_0xd0ff('0x6c')](_0x2a9f7f,_0xabd600,function(_0x33c8db){if(!_0x33c8db)fs['unlinkSync'](_0x2a9f7f);});});});}else{return _0x5f4041[_0xd0ff('0xe')](0xc8);}})['catch'](handleError(_0x5f4041,null));}; \ No newline at end of file +var _0x95b9=['query','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','MailMessage','addMessage','ids','findOne','hasOwnProperty','order','sort','pick','filters','where','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','sendStatus','rimraf','zip-dir','moment','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','params','model','keys'];(function(_0x5d761c,_0xed601d){var _0x1381fa=function(_0x28d9d5){while(--_0x28d9d5){_0x5d761c['push'](_0x5d761c['shift']());}};_0x1381fa(++_0xed601d);}(_0x95b9,0x19e));var _0x995b=function(_0x5256f6,_0x5e6284){_0x5256f6=_0x5256f6-0x0;var _0x5ce6a3=_0x95b9[_0x5256f6];return _0x5ce6a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x995b('0x0'));var zipdir=require(_0x995b('0x1'));var moment=require(_0x995b('0x2'));var BPromise=require(_0x995b('0x3'));var util=require('util');var path=require(_0x995b('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x995b('0x5'));var interaction=require(_0x995b('0x6'));var qs=require(_0x995b('0x7'));var logger=require(_0x995b('0x8'))(_0x995b('0x9'));var config=require(_0x995b('0xa'));var db=require(_0x995b('0xb'))['db'];var htmlEntities=require(_0x995b('0xc'));config[_0x995b('0xd')]=_[_0x995b('0xe')](config[_0x995b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x995b('0xd')]));require(_0x995b('0xf'))[_0x995b('0x10')](socket);function respondWithStatusCode(_0x2faaec,_0x75187){_0x75187=_0x75187||0xcc;return function(_0x515583){if(_0x515583){return _0x2faaec['sendStatus'](_0x75187);}return _0x2faaec[_0x995b('0x11')](_0x75187)[_0x995b('0x12')]();};}function respondWithResult(_0x3522a2,_0x21963f){_0x21963f=_0x21963f||0xc8;return function(_0xefc886){if(_0xefc886){return _0x3522a2[_0x995b('0x11')](_0x21963f)[_0x995b('0x13')](_0xefc886);}};}function respondWithFilteredResult(_0x2d00b4,_0x571dd8){return function(_0x1ea50b){if(_0x1ea50b){var _0x5e3aa4=typeof _0x571dd8[_0x995b('0x14')]===_0x995b('0x15')&&typeof _0x571dd8[_0x995b('0x16')]===_0x995b('0x15');var _0x109260=_0x1ea50b[_0x995b('0x17')];var _0x48e277=_0x5e3aa4?0x0:_0x571dd8[_0x995b('0x14')];var _0x426920=_0x5e3aa4?_0x1ea50b[_0x995b('0x17')]:_0x571dd8['offset']+_0x571dd8[_0x995b('0x16')];var _0x3fae96;if(_0x426920>=_0x109260){_0x426920=_0x109260;_0x3fae96=0xc8;}else{_0x3fae96=0xce;}_0x2d00b4[_0x995b('0x11')](_0x3fae96);return _0x2d00b4[_0x995b('0x18')](_0x995b('0x19'),_0x48e277+'-'+_0x426920+'/'+_0x109260)['json'](_0x1ea50b);}return null;};}function saveUpdates(_0x1657f8){return function(_0x29fbbd){if(_0x29fbbd){return _0x29fbbd[_0x995b('0x1a')](_0x1657f8)[_0x995b('0x1b')](function(_0x1051cc){return _0x1051cc;});}return null;};}function removeEntity(_0x344e3e){return function(_0x3f3963){if(_0x3f3963){return _0x3f3963['destroy']()[_0x995b('0x1b')](function(){_0x344e3e[_0x995b('0x11')](0xcc)[_0x995b('0x12')]();});}};}function handleEntityNotFound(_0x401ca0){return function(_0x585700){if(!_0x585700){_0x401ca0['sendStatus'](0x194);}return _0x585700;};}function handleError(_0x437b88,_0x14d0b5){_0x14d0b5=_0x14d0b5||0x1f4;return function(_0x120bc2){logger[_0x995b('0x1c')](_0x120bc2[_0x995b('0x1d')]);if(_0x120bc2[_0x995b('0x1e')]){delete _0x120bc2[_0x995b('0x1e')];}_0x437b88['status'](_0x14d0b5)[_0x995b('0x1f')](_0x120bc2);};}exports[_0x995b('0x20')]=function(_0x24b8bc,_0x880186){var _0x12c7ba={};var _0x253234=_['map'](db[_0x995b('0x21')][_0x995b('0x22')],function(_0xa54603){return{'name':_0xa54603[_0x995b('0x23')],'type':_0xa54603[_0x995b('0x24')][_0x995b('0x25')]};});_0x12c7ba=qs[_0x995b('0x26')](_0x253234,_0x24b8bc);return interaction[_0x995b('0x27')](_0x995b('0x28'),_0x24b8bc['query'],_0x24b8bc[_0x995b('0x29')],_0x12c7ba,_0x253234)[_0x995b('0x1b')](respondWithFilteredResult(_0x880186,_0x12c7ba))[_0x995b('0x2a')](handleError(_0x880186,null));};exports['show']=function(_0x466eb5,_0x22f5a8){var _0x584cd9={'raw':![],'where':{'id':_0x466eb5[_0x995b('0x2b')]['id']}},_0x4a603d={};_0x4a603d[_0x995b('0x2c')]=_[_0x995b('0x2d')](db['MailInteraction']['rawAttributes']);_0x4a603d[_0x995b('0x2e')]=_['keys'](_0x466eb5[_0x995b('0x2e')]);_0x4a603d['filters']=_[_0x995b('0x2f')](_0x4a603d[_0x995b('0x2c')],_0x4a603d[_0x995b('0x2e')]);_0x584cd9[_0x995b('0x30')]=_[_0x995b('0x2f')](_0x4a603d[_0x995b('0x2c')],qs['fields'](_0x466eb5[_0x995b('0x2e')][_0x995b('0x31')]));_0x584cd9['attributes']=_0x584cd9['attributes'][_0x995b('0x32')]?_0x584cd9[_0x995b('0x30')]:_0x4a603d[_0x995b('0x2c')];if(_0x466eb5[_0x995b('0x2e')]['includeAll']){_0x584cd9[_0x995b('0x33')]=[{'all':!![]}];}_0x584cd9=_[_0x995b('0x34')]({},_0x584cd9,_0x466eb5[_0x995b('0x35')]);return db[_0x995b('0x21')][_0x995b('0x36')](_0x584cd9)[_0x995b('0x1b')](handleEntityNotFound(_0x22f5a8,null))['then'](respondWithResult(_0x22f5a8,null))[_0x995b('0x2a')](handleError(_0x22f5a8,null));};exports['create']=function(_0x5d4f16,_0x564cdd){return db[_0x995b('0x21')][_0x995b('0x37')](_0x5d4f16['body'],{})[_0x995b('0x1b')](respondWithResult(_0x564cdd,0xc9))[_0x995b('0x2a')](handleError(_0x564cdd,null));};exports[_0x995b('0x1a')]=function(_0x3dbb18,_0x3b154b){if(_0x3dbb18[_0x995b('0x38')]['id']){delete _0x3dbb18[_0x995b('0x38')]['id'];}return db[_0x995b('0x21')]['find']({'where':{'id':_0x3dbb18[_0x995b('0x2b')]['id']}})[_0x995b('0x1b')](handleEntityNotFound(_0x3b154b,null))[_0x995b('0x1b')](saveUpdates(_0x3dbb18[_0x995b('0x38')],null))[_0x995b('0x1b')](respondWithResult(_0x3b154b,null))[_0x995b('0x2a')](handleError(_0x3b154b,null));};exports['destroy']=function(_0xc6b461,_0x28c602){return db[_0x995b('0x21')][_0x995b('0x36')]({'where':{'id':_0xc6b461[_0x995b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x28c602,null))[_0x995b('0x1b')](removeEntity(_0x28c602,null))[_0x995b('0x2a')](handleError(_0x28c602,null));};exports['describe']=function(_0xa49d10,_0x3da958){return db[_0x995b('0x21')][_0x995b('0x39')]()[_0x995b('0x1b')](respondWithResult(_0x3da958,null))[_0x995b('0x2a')](handleError(_0x3da958,null));};exports['addMessage']=function(_0x5051d1,_0xe7e8d2){return db[_0x995b('0x3a')]['find']({'where':{'id':_0x5051d1['params']['id']}})['then'](handleEntityNotFound(_0xe7e8d2,null))[_0x995b('0x1b')](function(_0x51c8ac){if(_0x51c8ac){return _0x51c8ac[_0x995b('0x3b')](_0x5051d1[_0x995b('0x38')]['ids'],_['omit'](_0x5051d1[_0x995b('0x38')],[_0x995b('0x3c'),'id'])||{});}})[_0x995b('0x1b')](respondWithResult(_0xe7e8d2,null))['catch'](handleError(_0xe7e8d2,null));};exports['getMessages']=function(_0x45b214,_0x590f6e){var _0x314788={'raw':![],'where':{}};var _0x2ba076={};var _0x5f4f7a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x995b('0x3d')]({'where':{'id':_0x45b214[_0x995b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x590f6e,null))[_0x995b('0x1b')](function(_0x5e1fa1){if(_0x5e1fa1){_0x2ba076[_0x995b('0x2c')]=_['keys'](db[_0x995b('0x3a')]['rawAttributes']);_0x2ba076['query']=_[_0x995b('0x2d')](_0x45b214[_0x995b('0x2e')]);_0x2ba076['filters']=_[_0x995b('0x2f')](_0x2ba076[_0x995b('0x2c')],_0x2ba076[_0x995b('0x2e')]);_0x314788[_0x995b('0x30')]=_['intersection'](_0x2ba076['model'],qs['fields'](_0x45b214[_0x995b('0x2e')][_0x995b('0x31')]));_0x314788[_0x995b('0x30')]=_0x314788[_0x995b('0x30')][_0x995b('0x32')]?_0x314788[_0x995b('0x30')]:_0x2ba076[_0x995b('0x2c')];if(!_0x45b214['query'][_0x995b('0x3e')]('nolimit')){_0x314788['limit']=qs[_0x995b('0x16')](_0x45b214[_0x995b('0x2e')]['limit']);_0x314788[_0x995b('0x14')]=qs[_0x995b('0x14')](_0x45b214[_0x995b('0x2e')][_0x995b('0x14')]);}_0x314788[_0x995b('0x3f')]=qs['sort'](_0x45b214[_0x995b('0x2e')][_0x995b('0x40')]);_0x314788['where']=qs['filters'](_[_0x995b('0x41')](_0x45b214[_0x995b('0x2e')],_0x2ba076[_0x995b('0x42')]));_0x314788[_0x995b('0x43')][_0x995b('0x44')]=_0x5e1fa1['id'];if(_0x45b214['query'][_0x995b('0x45')]){_0x314788[_0x995b('0x43')]=_[_0x995b('0x34')](_0x314788[_0x995b('0x43')],{'$or':_['map'](_0x314788['attributes'],function(_0x43bb41){var _0x29f5f3={};_0x29f5f3[_0x43bb41]={'$like':'%'+_0x45b214[_0x995b('0x2e')]['filter']+'%'};return _0x29f5f3;})});}if(_0x45b214[_0x995b('0x2e')]['$gte']){var _0x5d2d1c=_0x45b214[_0x995b('0x2e')][_0x995b('0x46')][_0x995b('0x47')](',');var _0x47ba3c={};_0x47ba3c[_0x5d2d1c[0x0]]={'$gte':moment(_0x5d2d1c[0x1])['format'](_0x995b('0x48'))};_0x314788[_0x995b('0x43')]=_[_0x995b('0x34')](_0x314788['where'],_0x47ba3c);}_0x314788=_[_0x995b('0x34')]({},_0x314788,_0x45b214[_0x995b('0x35')]);return db['MailMessage'][_0x995b('0x17')]({'where':_0x314788[_0x995b('0x43')]})['then'](function(_0xde7d4f){_0x5f4f7a[_0x995b('0x17')]=_0xde7d4f;if(_0x45b214[_0x995b('0x2e')]['includeAll']){_0x314788[_0x995b('0x33')]=[{'all':!![]}];}return db['MailMessage'][_0x995b('0x27')](_0x314788);})[_0x995b('0x1b')](function(_0x3a92b1){if(_0x45b214[_0x995b('0x2e')][_0x995b('0x49')]===_0x995b('0x4a')){for(var _0x34ebe8=0x0;_0x34ebe8<_0x3a92b1[_0x995b('0x32')];_0x34ebe8++){_0x3a92b1[_0x34ebe8][_0x995b('0x38')]=juice(_0x3a92b1[_0x34ebe8][_0x995b('0x38')]);}}_0x5f4f7a[_0x995b('0x4b')]=_0x3a92b1;return _0x5f4f7a;});}})[_0x995b('0x1b')](respondWithFilteredResult(_0x590f6e,_0x314788))['catch'](handleError(_0x590f6e,null));};exports[_0x995b('0x4c')]=function(_0x3691f0,_0x1b632b){return db[_0x995b('0x21')][_0x995b('0x36')]({'where':{'id':_0x3691f0['params']['id']}})['then'](handleEntityNotFound(_0x1b632b,null))[_0x995b('0x1b')](function(_0x14dc45){if(_0x14dc45){return _0x14dc45['setTags'](_0x3691f0['body'][_0x995b('0x3c')],_[_0x995b('0x4d')](_0x3691f0[_0x995b('0x38')],[_0x995b('0x3c'),'id'])||{})[_0x995b('0x4e')](function(){return db[_0x995b('0x4f')][_0x995b('0x27')]({'attributes':['id',_0x995b('0x1e'),_0x995b('0x50')],'where':{'id':_0x3691f0[_0x995b('0x38')][_0x995b('0x3c')]}});})[_0x995b('0x1b')](function(_0x1c4be3){socket['emit'](_0x995b('0x51'),{'id':Number(_0x3691f0[_0x995b('0x2b')]['id']),'tags':_0x1c4be3||[]});return{'id':Number(_0x3691f0[_0x995b('0x2b')]['id']),'tags':_0x1c4be3||[]};});}})[_0x995b('0x1b')](respondWithResult(_0x1b632b,null))['catch'](handleError(_0x1b632b,null));};exports[_0x995b('0x52')]=function(_0x40b7ab,_0x5208c3){return db[_0x995b('0x21')]['find']({'where':{'id':_0x40b7ab[_0x995b('0x2b')]['id']}})[_0x995b('0x1b')](handleEntityNotFound(_0x5208c3,null))['then'](function(_0x4f4669){if(_0x4f4669){return _0x4f4669[_0x995b('0x52')](_0x40b7ab[_0x995b('0x2e')][_0x995b('0x3c')]);}})['then'](respondWithStatusCode(_0x5208c3,null))[_0x995b('0x2a')](handleError(_0x5208c3,null));};exports[_0x995b('0x53')]=function(_0x5418b3,_0x541e88){var _0x95b83c=moment()[_0x995b('0x54')]()[_0x995b('0x55')]();var _0x41b9cc=path['join'](config[_0x995b('0x56')],_0x995b('0x57'),_0x995b('0x58'),_0x995b('0x59'));var _0x54f808=path[_0x995b('0x5a')](config['root'],_0x995b('0x57'),_0x995b('0x58'),'attachments');var _0x513648=path[_0x995b('0x5a')](_0x41b9cc,_0x95b83c);var _0x419165=util['format'](_0x995b('0x5b'),_0x5418b3[_0x995b('0x2b')]['id'],_0x95b83c);var _0x4bdd95=path['join'](_0x41b9cc,_0x419165);var _0x5e45c9=[];if(_0x5418b3[_0x995b('0x2e')]['attachments']){_0x5e45c9[_0x995b('0x5c')]({'model':db[_0x995b('0x5d')],'as':_0x995b('0x5e'),'raw':!![]});}var _0x29e9eb=[{'model':db[_0x995b('0x3a')],'as':_0x995b('0x5f'),'attributes':['id',_0x995b('0x38'),_0x995b('0x60'),'to','cc',_0x995b('0x61'),'subject',_0x995b('0x62')],'where':{'secret':![]},'order':qs[_0x995b('0x40')]('id'),'include':_0x5e45c9}];return db['MailInteraction']['find']({'where':{'id':_0x5418b3['params']['id']},'include':_0x29e9eb})[_0x995b('0x1b')](handleEntityNotFound(_0x541e88,null))['then'](function(_0x36cd95){if(_0x36cd95&&_0x36cd95[_0x995b('0x5f')]){var _0x2cd2b4=_0x36cd95[_0x995b('0x63')]({'plain':!![]});fs[_0x995b('0x64')](_0x513648);return BPromise[_0x995b('0x65')](_0x2cd2b4['Messages'],function(_0x532a62,_0x262d51){var _0x117851={'from':_0x532a62['from'],'to':_0x532a62['to']||_0x995b('0x66'),'subject':_0x532a62[_0x995b('0x67')],'html':htmlEntities[_0x995b('0x68')](_0x532a62[_0x995b('0x38')]),'headers':{'Date':moment(_0x532a62['createdAt'])[_0x995b('0x69')](_0x995b('0x6a'))},'attachments':[]};if(_0x532a62['cc']){_0x117851[_0x995b('0x6b')]['Cc']=_0x532a62['cc'];}if(_0x532a62[_0x995b('0x61')]){_0x117851['headers'][_0x995b('0x6c')]=_0x532a62[_0x995b('0x61')];}return new BPromise(function(_0x23a979,_0x53a2a7){if(_0x532a62[_0x995b('0x5e')]){for(var _0x5eb72d=0x0;_0x5eb72d<_0x532a62[_0x995b('0x5e')][_0x995b('0x32')];_0x5eb72d++){var _0x10d2b5=_0x532a62[_0x995b('0x5e')][_0x5eb72d];var _0x41748c=path[_0x995b('0x5a')](_0x54f808,_0x10d2b5[_0x995b('0x6d')]);if(fs['existsSync'](_0x41748c)){_0x117851['attachments'][_0x995b('0x5c')]({'name':_0x10d2b5[_0x995b('0x1e')],'contentType':_0x10d2b5[_0x995b('0x24')],'data':fs[_0x995b('0x6e')](_0x41748c)});}}}emlformat[_0x995b('0x6f')](_0x117851,function(_0x312c1e,_0x5354d2){if(_0x312c1e)return _0x53a2a7(_0x312c1e);fs[_0x995b('0x70')](path['join'](_0x513648,util[_0x995b('0x69')](_0x995b('0x71'),_0x262d51)),_0x5354d2);return _0x23a979(_0x5354d2);});});})[_0x995b('0x1b')](function(){return new BPromise(function(_0x52bc32,_0x5a70d3){zipdir(_0x513648,{'saveTo':_0x4bdd95},function(_0x3e301d,_0x4d8e7b){if(_0x3e301d)return _0x5a70d3(_0x3e301d);return _0x52bc32(_0x4d8e7b);});})[_0x995b('0x1b')](function(){return new BPromise(function(_0x2d103a,_0x26d675){rimraf(_0x513648,function(_0x3c6eeb){if(_0x3c6eeb)_0x26d675(_0x3c6eeb);return _0x2d103a();});});})[_0x995b('0x1b')](function(){return _0x541e88[_0x995b('0x53')](_0x4bdd95,_0x419165,function(_0x1a8d45){if(!_0x1a8d45)fs['unlinkSync'](_0x4bdd95);});});});}else{return _0x541e88[_0x995b('0x72')](0xc8);}})[_0x995b('0x2a')](handleError(_0x541e88,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e2df367..ce6e056 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 _0x4145=['then','Users','map','setDataValue','emit','catch','hook','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x45493c,_0x39478b){var _0xe89240=function(_0x45dee9){while(--_0x45dee9){_0x45493c['push'](_0x45493c['shift']());}};_0xe89240(++_0x39478b);}(_0x4145,0xbb));var _0x5414=function(_0x184aa5,_0x568b04){_0x184aa5=_0x184aa5-0x0;var _0x31ae0b=_0x4145[_0x184aa5];return _0x31ae0b;};'use strict';var EventEmitter=require(_0x5414('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5414('0x1')];var MailMessage=require(_0x5414('0x2'))['db'][_0x5414('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5414('0x4')](0x0);var events={'afterCreate':_0x5414('0x5'),'afterUpdate':'update','afterDestroy':_0x5414('0x6')};function emitEvent(_0xd33dd4){return function(_0x49785c,_0x5667b8,_0x3d8c81){_0x49785c[_0x5414('0x7')]({'attributes':['id'],'raw':!![]})[_0x5414('0x8')](function(_0x416a28){_0x49785c['setDataValue'](_0x5414('0x9'),_0x416a28[_0x5414('0xa')](function(_0x4a5e96){return{'id':_0x4a5e96['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x49785c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5414('0x8')](function(_0x3a9a0f){_0x49785c[_0x5414('0xb')]('unreadMessages',_0x3a9a0f['length']);MailInteractionEvents['emit'](_0xd33dd4+':'+_0x49785c['id'],_0x49785c);MailInteractionEvents[_0x5414('0xc')](_0xd33dd4,_0x49785c);_0x3d8c81(null);})[_0x5414('0xd')](_0x3d8c81(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x5414('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x80a1=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x8ba2d5,_0x13babf){var _0x55bf92=function(_0x43fd48){while(--_0x43fd48){_0x8ba2d5['push'](_0x8ba2d5['shift']());}};_0x55bf92(++_0x13babf);}(_0x80a1,0x12a));var _0x180a=function(_0x28972d,_0x5cd0ba){_0x28972d=_0x28972d-0x0;var _0x302084=_0x80a1[_0x28972d];return _0x302084;};'use strict';var EventEmitter=require(_0x180a('0x0'));var MailInteraction=require(_0x180a('0x1'))['db'][_0x180a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x180a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x180a('0x4')](0x0);var events={'afterCreate':_0x180a('0x5'),'afterUpdate':_0x180a('0x6'),'afterDestroy':_0x180a('0x7')};function emitEvent(_0x3452a2){return function(_0x363fb3,_0x3c6a75,_0x16ed11){_0x363fb3[_0x180a('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2eb667){_0x363fb3[_0x180a('0x9')](_0x180a('0xa'),_0x2eb667[_0x180a('0xb')](function(_0xe79615){return{'id':_0xe79615['id']};}));return MailMessage[_0x180a('0xc')]({'where':{'MailInteractionId':_0x363fb3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x180a('0xd')](function(_0x580505){_0x363fb3[_0x180a('0x9')](_0x180a('0xe'),_0x580505[_0x180a('0xf')]);MailInteractionEvents[_0x180a('0x10')](_0x3452a2+':'+_0x363fb3['id'],_0x363fb3);MailInteractionEvents[_0x180a('0x10')](_0x3452a2,_0x363fb3);_0x16ed11(null);})[_0x180a('0x11')](_0x16ed11(null));};}for(var e in events){if(events[_0x180a('0x12')](e)){var event=events[e];MailInteraction[_0x180a('0x13')](e,emitEvent(event));}}module[_0x180a('0x14')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 71e10f4..ec90d6b 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 _0x5f48=['format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','../../config/environment','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0x5f48,0xa9));var _0x85f4=function(_0xb9cb64,_0x4feed6){_0xb9cb64=_0xb9cb64-0x0;var _0x4fe3d8=_0x5f48[_0xb9cb64];return _0x4fe3d8;};'use strict';var _=require(_0x85f4('0x0'));var util=require(_0x85f4('0x1'));var logger=require('../../config/logger')(_0x85f4('0x2'));var moment=require('moment');var BPromise=require(_0x85f4('0x3'));var rp=require(_0x85f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85f4('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x85f4('0x6')]=function(_0x56e6e9,_0x2ddf3a){return _0x56e6e9[_0x85f4('0x7')](_0x85f4('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x85f4('0x9'),'fields':[_0x85f4('0xa'),'to'],'type':_0x85f4('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f656f,_0x245bd6,_0x40882c){if(_0x3f656f[_0x85f4('0xc')]){_0x3f656f['substatusAt']=moment()[_0x85f4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3f656f['closed']){_0x3f656f[_0x85f4('0xe')]=moment()[_0x85f4('0xd')](_0x85f4('0xf'));}_0x40882c(null,_0x245bd6);},'beforeUpdate':function(_0x1e8139,_0x2f066d,_0x3b3cfc){if(_0x1e8139[_0x85f4('0x10')]('substatus')){_0x1e8139[_0x85f4('0x11')]=_0x1e8139[_0x85f4('0xc')]?moment()[_0x85f4('0xd')](_0x85f4('0xf')):null;}if(_0x1e8139['changed'](_0x85f4('0x12'))){_0x1e8139[_0x85f4('0xe')]=moment()[_0x85f4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e8139[_0x85f4('0xc')]=null;_0x1e8139[_0x85f4('0x11')]=null;}_0x3b3cfc(null,_0x1e8139);},'afterUpdate':function(_0x281135,_0x55189e,_0x3c9f8b){var _0x20b6ba=_0x56e6e9[_0x85f4('0x13')];var _0x551ca9=_0x281135[_0x85f4('0x14')]({'plain':!![]});if(_0x551ca9[_0x85f4('0x12')]){return _0x20b6ba[_0x85f4('0x15')][_0x85f4('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x551ca9['id']}})[_0x85f4('0x17')](function(){_0x3c9f8b();})['catch'](function(_0x5ad283){_0x3c9f8b(_0x5ad283);});}else{_0x3c9f8b();}}},'charset':_0x85f4('0x18'),'collate':_0x85f4('0x19')});}; \ No newline at end of file +var _0x4b99=['moment','request-promise','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','substatus','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b99,0x1e9));var _0x94b9=function(_0xba645e,_0x1e1b67){_0xba645e=_0xba645e-0x0;var _0x27582a=_0x4b99[_0xba645e];return _0x27582a;};'use strict';var _=require(_0x94b9('0x0'));var util=require(_0x94b9('0x1'));var logger=require(_0x94b9('0x2'))(_0x94b9('0x3'));var moment=require(_0x94b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x94b9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94b9('0x6'));var config=require(_0x94b9('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x94b9('0x8')]=function(_0x3ee555,_0x2097ff){return _0x3ee555[_0x94b9('0x9')](_0x94b9('0xa'),attributes,{'tableName':_0x94b9('0xb'),'paranoid':![],'indexes':[{'name':_0x94b9('0xc'),'fields':[_0x94b9('0xd'),'to'],'type':_0x94b9('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d5ea2,_0x3f9048,_0x1eddf0){if(_0x5d5ea2['substatus']){_0x5d5ea2[_0x94b9('0xf')]=moment()[_0x94b9('0x10')](_0x94b9('0x11'));}if(_0x5d5ea2['closed']){_0x5d5ea2['closedAt']=moment()[_0x94b9('0x10')](_0x94b9('0x11'));}_0x1eddf0(null,_0x3f9048);},'beforeUpdate':function(_0x1f19d8,_0x3e2617,_0x35a83a){if(_0x1f19d8['changed']('substatus')){_0x1f19d8['substatusAt']=_0x1f19d8['substatus']?moment()[_0x94b9('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1f19d8[_0x94b9('0x12')](_0x94b9('0x13'))){_0x1f19d8[_0x94b9('0x14')]=moment()['format'](_0x94b9('0x11'));_0x1f19d8[_0x94b9('0x15')]=null;_0x1f19d8[_0x94b9('0xf')]=null;}_0x35a83a(null,_0x1f19d8);},'afterUpdate':function(_0x36a6a9,_0x59591f,_0x2d1b4d){var _0x59de29=_0x3ee555['models'];var _0x2fa3bb=_0x36a6a9[_0x94b9('0x16')]({'plain':!![]});if(_0x2fa3bb[_0x94b9('0x13')]){return _0x59de29[_0x94b9('0x17')][_0x94b9('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x2fa3bb['id']}})[_0x94b9('0x19')](function(){_0x2d1b4d();})[_0x94b9('0x1a')](function(_0xcc31ff){_0x2d1b4d(_0xcc31ff);});}else{_0x2d1b4d();}}},'charset':_0x94b9('0x1b'),'collate':_0x94b9('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index e3d388a..7f7bdb1 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 _0x1228=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction','addTags','ids','spread','AddTags','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x3fc655,_0x284c1a){var _0x4417f3=function(_0x1dfaa0){while(--_0x1dfaa0){_0x3fc655['push'](_0x3fc655['shift']());}};_0x4417f3(++_0x284c1a);}(_0x1228,0x12f));var _0x8122=function(_0x5d7375,_0x358589){_0x5d7375=_0x5d7375-0x0;var _0x3f0da4=_0x1228[_0x5d7375];return _0x3f0da4;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});}exports[_0x8122('0x18')]=function(_0x5a5a57){var _0x5df55f=this;return new Promise(function(_0x1162a8,_0x174321){return db[_0x8122('0x19')]['update'](_0x5a5a57[_0x8122('0x1a')],{'raw':_0x5a5a57[_0x8122('0x1b')]?_0x5a5a57[_0x8122('0x1b')][_0x8122('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5a57[_0x8122('0x1b')]?_0x5a5a57[_0x8122('0x1b')][_0x8122('0x1d')]||null:null,'attributes':_0x5a5a57[_0x8122('0x1b')]?_0x5a5a57['options'][_0x8122('0x1e')]||null:null,'limit':_0x5a5a57['options']?_0x5a5a57[_0x8122('0x1b')][_0x8122('0x1f')]||null:null})[_0x8122('0xf')](function(_0x2f04d5){logger[_0x8122('0x10')](_0x8122('0x18'),_0x5a5a57);logger[_0x8122('0x20')](_0x8122('0x18'),_0x5a5a57,JSON[_0x8122('0x13')](_0x2f04d5));_0x1162a8(_0x2f04d5);})['catch'](function(_0x1258d7){logger[_0x8122('0x14')](_0x8122('0x18'),_0x1258d7[_0x8122('0x17')],_0x5a5a57);_0x174321(_0x5df55f[_0x8122('0x14')](0x1f4,_0x1258d7[_0x8122('0x17')]));});});};exports[_0x8122('0x21')]=function(_0xf56451){return new Promise(function(_0x45bdaa,_0x4610b1){return db['MailInteraction']['find']({'where':_0xf56451[_0x8122('0x1b')]?_0xf56451[_0x8122('0x1b')]['where']||null:null})['then'](function(_0x12da0c){if(_0x12da0c){return _0x12da0c[_0x8122('0x22')](_0xf56451[_0x8122('0x1a')]['ids'],_['omit'](_0xf56451[_0x8122('0x1a')],[_0x8122('0x23'),'id'])||{});}})[_0x8122('0x24')](function(_0x14d77b){logger[_0x8122('0x10')](_0x8122('0x25'),_0xf56451);logger[_0x8122('0x20')](_0x8122('0x25'),_0xf56451,JSON[_0x8122('0x13')](_0x14d77b));_0x45bdaa(_0x14d77b);})[_0x8122('0x26')](function(_0x51af4d){logger[_0x8122('0x14')](_0x8122('0x25'),_0x51af4d[_0x8122('0x17')],_0xf56451);_0x4610b1(_this[_0x8122('0x14')](0x1f4,_0x51af4d[_0x8122('0x17')]));});});}; \ No newline at end of file +var _0x5322=['body','options','raw','where','AddTagsToMailInteraction','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5322,0xff));var _0x2532=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x5322[_0x43576f];return _0x4d2466;};'use strict';var _=require(_0x2532('0x0'));var util=require(_0x2532('0x1'));var moment=require(_0x2532('0x2'));var BPromise=require('bluebird');var rs=require(_0x2532('0x3'));var fs=require('fs');var Redis=require(_0x2532('0x4'));var db=require(_0x2532('0x5'))['db'];var utils=require(_0x2532('0x6'));var logger=require('../../config/logger')(_0x2532('0x7'));var config=require(_0x2532('0x8'));var jayson=require(_0x2532('0x9'));var client=jayson[_0x2532('0xa')][_0x2532('0xb')]({'port':0x232a});config[_0x2532('0xc')]=_['defaults'](config[_0x2532('0xc')],{'host':_0x2532('0xd'),'port':0x18eb});var socket=require(_0x2532('0xe'))(new Redis(config[_0x2532('0xc')]));require(_0x2532('0xf'))[_0x2532('0x10')](socket);function respondWithRpcPromise(_0x58a034,_0x3f3325,_0x4423ed){return new BPromise(function(_0x18d2e1,_0x5d4577){return client[_0x2532('0x11')](_0x58a034,_0x4423ed)[_0x2532('0x12')](function(_0x3c437c){logger[_0x2532('0x13')](_0x2532('0x14'),_0x3f3325,_0x2532('0x15'));logger[_0x2532('0x16')](_0x2532('0x17'),_0x3f3325,_0x2532('0x15'),JSON[_0x2532('0x18')](_0x3c437c));if(_0x3c437c[_0x2532('0x19')]){if(_0x3c437c[_0x2532('0x19')][_0x2532('0x1a')]===0x1f4){logger[_0x2532('0x19')](_0x2532('0x14'),_0x3f3325,_0x3c437c['error'][_0x2532('0x1b')]);return _0x5d4577(_0x3c437c[_0x2532('0x19')][_0x2532('0x1b')]);}logger['error'](_0x2532('0x14'),_0x3f3325,_0x3c437c[_0x2532('0x19')][_0x2532('0x1b')]);return _0x18d2e1(_0x3c437c[_0x2532('0x19')]['message']);}else{logger[_0x2532('0x13')]('MailInteraction,\x20%s,\x20%s',_0x3f3325,_0x2532('0x15'));_0x18d2e1(_0x3c437c[_0x2532('0x1c')][_0x2532('0x1b')]);}})[_0x2532('0x1d')](function(_0x445cbf){logger[_0x2532('0x19')]('MailInteraction,\x20%s,\x20%s',_0x3f3325,_0x445cbf);_0x5d4577(_0x445cbf);});});}exports[_0x2532('0x1e')]=function(_0x60faf){var _0x122083=this;return new Promise(function(_0x178f50,_0x52d232){return db[_0x2532('0x1f')]['update'](_0x60faf[_0x2532('0x20')],{'raw':_0x60faf['options']?_0x60faf[_0x2532('0x21')][_0x2532('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60faf['options']?_0x60faf[_0x2532('0x21')][_0x2532('0x23')]||null:null,'attributes':_0x60faf[_0x2532('0x21')]?_0x60faf[_0x2532('0x21')]['attributes']||null:null,'limit':_0x60faf[_0x2532('0x21')]?_0x60faf['options']['limit']||null:null})[_0x2532('0x12')](function(_0x264d91){logger[_0x2532('0x13')]('UpdateMailInteraction',_0x60faf);logger[_0x2532('0x16')](_0x2532('0x1e'),_0x60faf,JSON['stringify'](_0x264d91));_0x178f50(_0x264d91);})['catch'](function(_0x232cec){logger[_0x2532('0x19')](_0x2532('0x1e'),_0x232cec['message'],_0x60faf);_0x52d232(_0x122083[_0x2532('0x19')](0x1f4,_0x232cec[_0x2532('0x1b')]));});});};exports[_0x2532('0x24')]=function(_0x39d965){return new Promise(function(_0x2850f1,_0x2f134f){return db[_0x2532('0x1f')]['find']({'where':_0x39d965[_0x2532('0x21')]?_0x39d965[_0x2532('0x21')]['where']||null:null})[_0x2532('0x12')](function(_0x5b2a9c){if(_0x5b2a9c){return _0x5b2a9c['addTags'](_0x39d965[_0x2532('0x20')]['ids'],_[_0x2532('0x25')](_0x39d965[_0x2532('0x20')],[_0x2532('0x26'),'id'])||{});}})[_0x2532('0x27')](function(_0x1fd59d){logger[_0x2532('0x13')](_0x2532('0x28'),_0x39d965);logger[_0x2532('0x16')](_0x2532('0x28'),_0x39d965,JSON[_0x2532('0x18')](_0x1fd59d));_0x2850f1(_0x1fd59d);})[_0x2532('0x1d')](function(_0x5877d4){logger['error'](_0x2532('0x28'),_0x5877d4[_0x2532('0x1b')],_0x39d965);_0x2f134f(_this['error'](0x1f4,_0x5877d4[_0x2532('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 16b56f9..1364daa 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 _0x2742=['removeListener','register','length','mailInteraction:','save','remove','update'];(function(_0x541788,_0x216823){var _0x452aeb=function(_0x585c58){while(--_0x585c58){_0x541788['push'](_0x541788['shift']());}};_0x452aeb(++_0x216823);}(_0x2742,0x6d));var _0x2274=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2742[_0x321bb2];return _0x9c12ed;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x2274('0x0'),_0x2274('0x1'),_0x2274('0x2')];function createListener(_0x36c77d,_0x298d93){return function(_0x6f0dfe){_0x298d93['emit'](_0x36c77d,_0x6f0dfe);};}function removeListener(_0x276ff0,_0x34ede2){return function(){MailInteractionEvents[_0x2274('0x3')](_0x276ff0,_0x34ede2);};}exports[_0x2274('0x4')]=function(_0xfaf36c){for(var _0x52a0c2=0x0,_0x48aea6=events[_0x2274('0x5')];_0x52a0c2<_0x48aea6;_0x52a0c2++){var _0x2e8fbb=events[_0x52a0c2];var _0x289b46=createListener(_0x2274('0x6')+_0x2e8fbb,_0xfaf36c);MailInteractionEvents['on'](_0x2e8fbb,_0x289b46);}}; \ No newline at end of file +var _0x55a6=['remove','update','emit','length','mailInteraction:','save'];(function(_0xdb1ed6,_0x256dd5){var _0x1ef726=function(_0x1230b4){while(--_0x1230b4){_0xdb1ed6['push'](_0xdb1ed6['shift']());}};_0x1ef726(++_0x256dd5);}(_0x55a6,0xb9));var _0x655a=function(_0x7b92d7,_0x37466a){_0x7b92d7=_0x7b92d7-0x0;var _0x132089=_0x55a6[_0x7b92d7];return _0x132089;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x655a('0x0'),_0x655a('0x1'),_0x655a('0x2')];function createListener(_0xaca88,_0x398444){return function(_0x3beb07){_0x398444[_0x655a('0x3')](_0xaca88,_0x3beb07);};}function removeListener(_0x18f370,_0x7a0e11){return function(){MailInteractionEvents['removeListener'](_0x18f370,_0x7a0e11);};}exports['register']=function(_0x428365){for(var _0x22dd44=0x0,_0x48f062=events[_0x655a('0x4')];_0x22dd44<_0x48f062;_0x22dd44++){var _0x5c43f0=events[_0x22dd44];var _0x480454=createListener(_0x655a('0x5')+_0x5c43f0,_0x428365);MailInteractionEvents['on'](_0x5c43f0,_0x480454);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index fae24d5..4c3290b 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 _0x96cc=['/:id/download','post','tracked','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4faa01,_0x549229){var _0x5ed806=function(_0x2bdeb9){while(--_0x2bdeb9){_0x4faa01['push'](_0x4faa01['shift']());}};_0x5ed806(++_0x549229);}(_0x96cc,0x16c));var _0xc96c=function(_0x2503f2,_0x305c53){_0x2503f2=_0x2503f2-0x0;var _0x13ab2c=_0x96cc[_0x2503f2];return _0x13ab2c;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc96c('0x10')]('mail',_0xc96c('0x11')),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0x15'),auth[_0xc96c('0xa')](),controller['accept']);router[_0xc96c('0x13')](_0xc96c('0x16'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x17')]);router[_0xc96c('0x18')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x19')]);module[_0xc96c('0x1a')]=router; \ No newline at end of file +var _0x477a=['/:id','/:id/download','mail','mailmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_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('0x9')](_0xa477('0xc'),auth[_0xa477('0x7')](),controller['show']);router[_0xa477('0x9')](_0xa477('0xd'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xa477('0xe'),_0xa477('0xf')),controller[_0xa477('0x10')]);router['put'](_0xa477('0xc'),auth[_0xa477('0x7')](),controller[_0xa477('0x11')]);router['put'](_0xa477('0x12'),auth[_0xa477('0x7')](),controller[_0xa477('0x13')]);router[_0xa477('0x14')](_0xa477('0x15'),auth['isAuthenticated'](),controller[_0xa477('0x16')]);router[_0xa477('0x17')](_0xa477('0xc'),auth[_0xa477('0x7')](),controller[_0xa477('0x18')]);module[_0xa477('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b97b800..57963d2 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 _0xc05c=['sequelize','lodash','exports','TEXT','long','medium','out','STRING','DATE','INTEGER','BOOLEAN','Email'];(function(_0x285aec,_0x133151){var _0x44a977=function(_0x243a4b){while(--_0x243a4b){_0x285aec['push'](_0x285aec['shift']());}};_0x44a977(++_0x133151);}(_0xc05c,0xc0));var _0xcc05=function(_0x2efc70,_0x53145a){_0x2efc70=_0x2efc70-0x0;var _0x50ed0f=_0xc05c[_0x2efc70];return _0x50ed0f;};'use strict';var Sequelize=require(_0xcc05('0x0'));var _=require(_0xcc05('0x1'));module[_0xcc05('0x2')]={'body':{'type':Sequelize[_0xcc05('0x3')](_0xcc05('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcc05('0x3')](_0xcc05('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xcc05('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcc05('0x7')](0x1fe)},'from':{'type':Sequelize[_0xcc05('0x7')]},'to':{'type':Sequelize[_0xcc05('0x3')](_0xcc05('0x4'))},'cc':{'type':Sequelize[_0xcc05('0x3')](_0xcc05('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xcc05('0x8')]},'attach':{'type':Sequelize[_0xcc05('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcc05('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcc05('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xcc05('0x3')](_0xcc05('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0xcc05('0xb'),'Chat'),'defaultValue':_0xcc05('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xf5d4=['ENUM','out','STRING','long','DATE','INTEGER','Email','sequelize','lodash','TEXT','medium','BOOLEAN'];(function(_0x188199,_0x5c95c3){var _0x35c809=function(_0x39a8ad){while(--_0x39a8ad){_0x188199['push'](_0x188199['shift']());}};_0x35c809(++_0x5c95c3);}(_0xf5d4,0x19f));var _0x4f5d=function(_0x465ad1,_0x3bdd5e){_0x465ad1=_0x465ad1-0x0;var _0x236f7c=_0xf5d4[_0x465ad1];return _0x236f7c;};'use strict';var Sequelize=require(_0x4f5d('0x0'));var _=require(_0x4f5d('0x1'));module['exports']={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4f5d('0x2')](_0x4f5d('0x3'))},'read':{'type':Sequelize[_0x4f5d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f5d('0x5')]('in',_0x4f5d('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4f5d('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4f5d('0x2')]('long')},'cc':{'type':Sequelize[_0x4f5d('0x2')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x4f5d('0x8'))},'subject':{'type':Sequelize[_0x4f5d('0x2')]},'sentAt':{'type':Sequelize[_0x4f5d('0x9')]},'attach':{'type':Sequelize[_0x4f5d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4f5d('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4f5d('0x9')]},'originTo':{'type':Sequelize[_0x4f5d('0x2')](_0x4f5d('0x8'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x4f5d('0x5')](_0x4f5d('0xb'),'Chat'),'defaultValue':_0x4f5d('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index fd8dbe0..5767869 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 _0xa84d=['stack','send','index','MailMessage','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','keys','intersection','includeAll','include','find','update','body','describe','direction','out','secret','MailAccount','findOne','MailAccountId','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List','create','ListId','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','unix','toString','server','tmp','files','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','push','readFileSync','writeFileSync','download','unlinkSync','eml-format','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','offset','undefined','count','limit','status','set','Content-Range','json','destroy','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa84d,0x11b));var _0xda84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa84d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xda84('0x0'));var moment=require('moment');var BPromise=require(_0xda84('0x1'));var util=require('util');var path=require(_0xda84('0x2'));var fs=require('fs');var _=require(_0xda84('0x3'));var Redis=require(_0xda84('0x4'));var htmlToText=require(_0xda84('0x5'));var qs=require(_0xda84('0x6'));var logger=require(_0xda84('0x7'))(_0xda84('0x8'));var interaction_log=require(_0xda84('0x7'))(_0xda84('0x9'));var config=require(_0xda84('0xa'));var db=require(_0xda84('0xb'))['db'];config[_0xda84('0xc')]=_[_0xda84('0xd')](config[_0xda84('0xc')],{'host':_0xda84('0xe'),'port':0x18eb});var socket=require(_0xda84('0xf'))(new Redis(config[_0xda84('0xc')]));var htmlEntities=require(_0xda84('0x10'));require(_0xda84('0x11'))[_0xda84('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xda84('0x13')][_0xda84('0x14')]({'port':0x232c});var client9003=jayson[_0xda84('0x13')][_0xda84('0x14')]({'port':0x232b});var client9002=jayson[_0xda84('0x13')][_0xda84('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xbf9f30,_0x2907a2,_0x2454dc,_0x4b05df){return new BPromise(function(_0x1c5776,_0x27f6ef){var _0x2741cc=_0x4b05df||client;return _0x2741cc[_0xda84('0x15')](_0xbf9f30,_0x2454dc)[_0xda84('0x16')](function(_0x4c608a){logger[_0xda84('0x17')](_0xda84('0x18'),_0x2907a2,_0xda84('0x19'));logger[_0xda84('0x1a')](_0xda84('0x1b'),_0x2907a2,_0xda84('0x19'),JSON[_0xda84('0x1c')](_0x4c608a));if(_0x4c608a[_0xda84('0x1d')]){if(_0x4c608a[_0xda84('0x1d')][_0xda84('0x1e')]===0x1f4){logger['error'](_0xda84('0x18'),_0x2907a2,_0x4c608a[_0xda84('0x1d')]['message']);return _0x27f6ef(_0x4c608a['error'][_0xda84('0x1f')]);}logger[_0xda84('0x1d')](_0xda84('0x18'),_0x2907a2,_0x4c608a[_0xda84('0x1d')]['message']);return _0x1c5776(_0x4c608a[_0xda84('0x1d')][_0xda84('0x1f')]);}else{logger[_0xda84('0x17')](_0xda84('0x18'),_0x2907a2,_0xda84('0x19'));_0x1c5776(_0x4c608a[_0xda84('0x20')]['message']);}})['catch'](function(_0x2e5522){logger[_0xda84('0x1d')]('MailMessage,\x20%s,\x20%s',_0x2907a2,_0x2e5522);_0x27f6ef(_0x2e5522);});});}function respondWithResult(_0x22785e,_0x355f03){_0x355f03=_0x355f03||0xc8;return function(_0x444e8d){if(_0x444e8d){return _0x22785e['status'](_0x355f03)['json'](_0x444e8d);}};}function respondWithFilteredResult(_0x1a23be,_0x31fb6e){return function(_0x86f204){if(_0x86f204){var _0x2a2224=typeof _0x31fb6e[_0xda84('0x21')]===_0xda84('0x22')&&typeof _0x31fb6e['limit']===_0xda84('0x22');var _0xaf567b=_0x86f204[_0xda84('0x23')];var _0x548db7=_0x2a2224?0x0:_0x31fb6e[_0xda84('0x21')];var _0x516d38=_0x2a2224?_0x86f204[_0xda84('0x23')]:_0x31fb6e['offset']+_0x31fb6e[_0xda84('0x24')];var _0x4f1b0e;if(_0x516d38>=_0xaf567b){_0x516d38=_0xaf567b;_0x4f1b0e=0xc8;}else{_0x4f1b0e=0xce;}_0x1a23be[_0xda84('0x25')](_0x4f1b0e);return _0x1a23be[_0xda84('0x26')](_0xda84('0x27'),_0x548db7+'-'+_0x516d38+'/'+_0xaf567b)[_0xda84('0x28')](_0x86f204);}return null;};}function saveUpdates(_0x42d60b){return function(_0x162933){if(_0x162933){return _0x162933['update'](_0x42d60b)[_0xda84('0x16')](function(_0xd9d3c2){return _0xd9d3c2;});}return null;};}function removeEntity(_0x19432c){return function(_0x20f231){if(_0x20f231){return _0x20f231[_0xda84('0x29')]()['then'](function(){_0x19432c[_0xda84('0x25')](0xcc)[_0xda84('0x2a')]();});}};}function handleEntityNotFound(_0x4de297){return function(_0x12bc77){if(!_0x12bc77){_0x4de297['sendStatus'](0x194);}return _0x12bc77;};}function handleError(_0x4cc77f,_0x31bcc9){_0x31bcc9=_0x31bcc9||0x1f4;return function(_0x2cb7fe){logger[_0xda84('0x1d')](_0x2cb7fe[_0xda84('0x2b')]);if(_0x2cb7fe['name']){delete _0x2cb7fe['name'];}_0x4cc77f[_0xda84('0x25')](_0x31bcc9)[_0xda84('0x2c')](_0x2cb7fe);};}exports[_0xda84('0x2d')]=function(_0x46e730,_0x1c1a65){var _0x403555={},_0x40dcfb={},_0x210c05={'count':0x0,'rows':[]};var _0x4d7a25=_['map'](db[_0xda84('0x2e')][_0xda84('0x2f')],function(_0x16d058){return{'name':_0x16d058[_0xda84('0x30')],'type':_0x16d058[_0xda84('0x31')][_0xda84('0x32')]};});_0x40dcfb[_0xda84('0x33')]=_['map'](_0x4d7a25,_0xda84('0x34'));_0x40dcfb[_0xda84('0x35')]=_['keys'](_0x46e730[_0xda84('0x35')]);_0x40dcfb[_0xda84('0x36')]=_['intersection'](_0x40dcfb['model'],_0x40dcfb[_0xda84('0x35')]);_0x403555[_0xda84('0x37')]=_['intersection'](_0x40dcfb[_0xda84('0x33')],qs[_0xda84('0x38')](_0x46e730['query'][_0xda84('0x38')]));_0x403555['attributes']=_0x403555[_0xda84('0x37')][_0xda84('0x39')]?_0x403555[_0xda84('0x37')]:_0x40dcfb[_0xda84('0x33')];if(!_0x46e730[_0xda84('0x35')][_0xda84('0x3a')](_0xda84('0x3b'))){_0x403555[_0xda84('0x24')]=qs['limit'](_0x46e730['query']['limit']);_0x403555['offset']=qs[_0xda84('0x21')](_0x46e730['query'][_0xda84('0x21')]);}_0x403555[_0xda84('0x3c')]=qs['sort'](_0x46e730['query'][_0xda84('0x3d')]);_0x403555[_0xda84('0x3e')]=qs[_0xda84('0x36')](_[_0xda84('0x3f')](_0x46e730['query'],_0x40dcfb[_0xda84('0x36')]),_0x4d7a25);if(_0x46e730['query']['filter']){_0x403555[_0xda84('0x3e')]=_[_0xda84('0x40')](_0x403555['where'],{'$or':_[_0xda84('0x41')](_0x4d7a25,function(_0x38d9df){if(_0x38d9df[_0xda84('0x31')]!==_0xda84('0x42')){var _0x4f4148={};_0x4f4148[_0x38d9df[_0xda84('0x34')]]={'$like':'%'+_0x46e730['query']['filter']+'%'};return _0x4f4148;}})});}_0x403555=_['merge']({},_0x403555,_0x46e730[_0xda84('0x43')]);var _0x2a6981={'where':_0x403555[_0xda84('0x3e')]};return db['MailMessage'][_0xda84('0x23')](_0x2a6981)['then'](function(_0x382fe7){_0x210c05[_0xda84('0x23')]=_0x382fe7;if(_0x46e730[_0xda84('0x35')]['includeAll']){_0x403555['include']=[{'all':!![]}];}return db[_0xda84('0x2e')][_0xda84('0x44')](_0x403555);})[_0xda84('0x16')](function(_0x226e0d){_0x210c05[_0xda84('0x45')]=_0x226e0d;return _0x210c05;})[_0xda84('0x16')](respondWithFilteredResult(_0x1c1a65,_0x403555))[_0xda84('0x46')](handleError(_0x1c1a65,null));};exports[_0xda84('0x47')]=function(_0x2e1629,_0x4475b9){var _0x2b363c={'raw':!![],'where':{'id':_0x2e1629[_0xda84('0x48')]['id']}},_0x27244e={};_0x27244e[_0xda84('0x33')]=_[_0xda84('0x49')](db[_0xda84('0x2e')]['rawAttributes']);_0x27244e[_0xda84('0x35')]=_[_0xda84('0x49')](_0x2e1629[_0xda84('0x35')]);_0x27244e[_0xda84('0x36')]=_[_0xda84('0x4a')](_0x27244e[_0xda84('0x33')],_0x27244e[_0xda84('0x35')]);_0x2b363c[_0xda84('0x37')]=_[_0xda84('0x4a')](_0x27244e['model'],qs[_0xda84('0x38')](_0x2e1629['query'][_0xda84('0x38')]));_0x2b363c[_0xda84('0x37')]=_0x2b363c[_0xda84('0x37')][_0xda84('0x39')]?_0x2b363c['attributes']:_0x27244e[_0xda84('0x33')];if(_0x2e1629[_0xda84('0x35')][_0xda84('0x4b')]){_0x2b363c[_0xda84('0x4c')]=[{'all':!![]}];}_0x2b363c=_[_0xda84('0x40')]({},_0x2b363c,_0x2e1629[_0xda84('0x43')]);return db['MailMessage'][_0xda84('0x4d')](_0x2b363c)['then'](handleEntityNotFound(_0x4475b9,null))[_0xda84('0x16')](respondWithResult(_0x4475b9,null))['catch'](handleError(_0x4475b9,null));};exports[_0xda84('0x4e')]=function(_0x28b2a6,_0xe1a935){if(_0x28b2a6['body']['id']){delete _0x28b2a6[_0xda84('0x4f')]['id'];}return db[_0xda84('0x2e')][_0xda84('0x4d')]({'where':{'id':_0x28b2a6[_0xda84('0x48')]['id']}})['then'](handleEntityNotFound(_0xe1a935,null))[_0xda84('0x16')](saveUpdates(_0x28b2a6[_0xda84('0x4f')],null))[_0xda84('0x16')](respondWithResult(_0xe1a935,null))[_0xda84('0x46')](handleError(_0xe1a935,null));};exports[_0xda84('0x29')]=function(_0x404ef7,_0x3da4c2){return db[_0xda84('0x2e')][_0xda84('0x4d')]({'where':{'id':_0x404ef7[_0xda84('0x48')]['id']}})[_0xda84('0x16')](handleEntityNotFound(_0x3da4c2,null))[_0xda84('0x16')](removeEntity(_0x3da4c2,null))[_0xda84('0x46')](handleError(_0x3da4c2,null));};exports[_0xda84('0x50')]=function(_0x4ddcb2,_0x314faa){return db[_0xda84('0x2e')]['describe']()[_0xda84('0x16')](respondWithResult(_0x314faa,null))[_0xda84('0x46')](handleError(_0x314faa,null));};exports['create']=function(_0x1b1297,_0x4046bb){return db[_0xda84('0x2e')]['create'](_0x1b1297['body'])[_0xda84('0x16')](function(_0x5d73a1){if(_0x5d73a1){if(_0x5d73a1[_0xda84('0x51')]===_0xda84('0x52')&&!_0x5d73a1[_0xda84('0x53')]){var _0x533051,_0x18d2d5,_0x582a19;if(_0x1b1297[_0xda84('0x4f')]['to']){_0x18d2d5=_0x1b1297[_0xda84('0x4f')]['to']['split'](',')[0x0];}return db[_0xda84('0x54')][_0xda84('0x55')]({'where':{'id':_0x5d73a1[_0xda84('0x56')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xda84('0x57')],'as':_0xda84('0x58'),'where':{'email':_0x18d2d5},'limit':0x1,'order':[[_0xda84('0x59'),'DESC']]}]},{'model':db[_0xda84('0x5a')],'as':_0xda84('0x5b'),'raw':!![],'include':[{'model':db[_0xda84('0x5c')],'as':_0xda84('0x5c'),'raw':!![]}]}]})['then'](function(_0x5ac3f6){_0x533051=_0x5ac3f6;if(!_0x533051||!_0x533051[_0xda84('0x5b')])return;var _0x1fa4e9=_0x533051['getSmtpOptions']();if(_0x1b1297[_0xda84('0x4f')]['attachments']&&_0x1b1297[_0xda84('0x4f')][_0xda84('0x5d')][_0xda84('0x39')]){for(var _0x792b5c=0x0;_0x792b5c<_0x1b1297[_0xda84('0x4f')][_0xda84('0x5d')][_0xda84('0x39')];_0x792b5c+=0x1){_0x1b1297[_0xda84('0x4f')]['attachments'][_0x792b5c]={'filename':_0x1b1297[_0xda84('0x4f')][_0xda84('0x5d')][_0x792b5c][_0xda84('0x34')],'path':path[_0xda84('0x5e')](config[_0xda84('0x5f')],_0xda84('0x60'),_0x1b1297['body']['attachments'][_0x792b5c][_0xda84('0x61')])};}}_0x582a19={'account':_0x1fa4e9,'message':_0x1b1297['body']};return;})[_0xda84('0x16')](function(){if(_0x533051[_0xda84('0x62')]){if(_0x533051['List']['Contacts'][_0xda84('0x39')]){return _0x533051[_0xda84('0x62')][_0xda84('0x58')][0x0];}else{return db['CmContact'][_0xda84('0x63')](_[_0xda84('0xd')](_0x1b1297['body'],{'firstName':_0x1b1297[_0xda84('0x4f')]['to'],'email':_0x1b1297[_0xda84('0x4f')]['to'],'phone':_0x1b1297['body']['to'],'ListId':_0x533051[_0xda84('0x64')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xda84('0x16')](function(){if(_0x582a19){return respondWithRpcPromise(_0xda84('0x65'),'sendMail',_0x582a19,client9003)[_0xda84('0x16')](function(_0x3db899){return _0x5d73a1[_0xda84('0x4e')]({'read':!![],'messageId':_0x3db899[_0xda84('0x66')],'sentAt':moment()[_0xda84('0x67')](_0xda84('0x68'))});})['catch'](function(_0x475aad){logger[_0xda84('0x1d')]('%s',JSON[_0xda84('0x1c')](_0x475aad));return _0x5d73a1;});}return _0x5d73a1;});}return _0x5d73a1;}})[_0xda84('0x16')](respondWithResult(_0x4046bb,0xc9))[_0xda84('0x46')](handleError(_0x4046bb,null));};exports[_0xda84('0x69')]=function(_0x1ce529,_0x3cef8a){var _0xa3d8a6={'agent':{},'channel':'mail'};if(_0x1ce529[_0xda84('0x4f')]['id']){delete _0x1ce529['body']['id'];}_0x1ce529[_0xda84('0x4f')]['read']=!![];_0x1ce529['body'][_0xda84('0x6a')]=moment()[_0xda84('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ce529[_0xda84('0x4f')][_0xda84('0x6b')]=_0x1ce529['body'][_0xda84('0x6b')]||_0x1ce529[_0xda84('0x6c')]['id'];_0xa3d8a6[_0xda84('0x6d')]['id']=_0x1ce529['body'][_0xda84('0x6b')];return db[_0xda84('0x2e')][_0xda84('0x4d')]({'where':{'id':_0x1ce529[_0xda84('0x48')]['id'],'UserId':null}})[_0xda84('0x16')](handleEntityNotFound(_0x3cef8a,null))[_0xda84('0x16')](saveUpdates(_0x1ce529['body'],null))[_0xda84('0x16')](function(_0x3f0951){if(_0x3f0951){_0xa3d8a6[_0xda84('0x1f')]=_0x3f0951[_0xda84('0x6e')]({'plain':!![]});return db[_0xda84('0x6f')][_0xda84('0x4d')]({'where':{'id':_0x3f0951['MailInteractionId']}});}return null;})[_0xda84('0x16')](handleEntityNotFound(_0x3cef8a,null))[_0xda84('0x16')](function(_0x16c83e){if(_0x16c83e){return _0x16c83e[_0xda84('0x4e')]({'UserId':_0x1ce529[_0xda84('0x4f')][_0xda84('0x6b')],'read1stAt':_[_0xda84('0x70')](_0x16c83e[_0xda84('0x71')])?moment()[_0xda84('0x67')](_0xda84('0x68')):undefined});}return null;})['then'](function(_0x18e016){if(_0x18e016){_0xa3d8a6[_0xda84('0x72')]=_0x18e016['get']({'plain':!![]});interaction_log[_0xda84('0x17')](_0xda84('0x73'),_0x1ce529[_0xda84('0x6c')]['id'],_0x1ce529[_0xda84('0x6c')][_0xda84('0x34')],_0x1ce529['user'][_0xda84('0x74')],_0xa3d8a6[_0xda84('0x72')]['id'],_0x1ce529[_0xda84('0x4f')]?JSON[_0xda84('0x1c')](_0x1ce529['body']):_0xda84('0x75'));return respondWithRpcPromise('AcceptMessage',_0xda84('0x76'),_0xa3d8a6);}return null;})[_0xda84('0x16')](function(_0x5dcb5c){var _0xa5b321=_0xda84('0x77')+_0x5dcb5c['message'][_0xda84('0x78')];return db[_0xda84('0x79')]['query'](_0xa5b321,{'type':db[_0xda84('0x7a')][_0xda84('0x7b')][_0xda84('0x7c')],'raw':!![]})['then'](function(_0x21b7a4){return _0x21b7a4;});})[_0xda84('0x16')](function(_0x47ec16){if(_0x47ec16){_0xa3d8a6['message'][_0xda84('0x7d')]=_0x47ec16[0x0];if(!_0x1ce529['body'][_0xda84('0x6b')])return;return db[_0xda84('0x7e')]['find']({'where':{'id':_0x1ce529[_0xda84('0x4f')]['UserId'],'role':_0xda84('0x6d')},'attributes':['id','name',_0xda84('0x7f'),_0xda84('0x80'),_0xda84('0x81')],'raw':!![]});}return null;})[_0xda84('0x16')](function(_0x11456c){if(!_0x11456c)return null;_0xa3d8a6[_0xda84('0x1f')][_0xda84('0x6d')]=_0x11456c;return _0xa3d8a6;})[_0xda84('0x16')](function(_0x2131e0){if(_0x2131e0){if(_0x1ce529['body'][_0xda84('0x82')]){_0xa3d8a6['message'][_0xda84('0x83')]=util[_0xda84('0x67')](_0xda84('0x84'),_0x1ce529[_0xda84('0x6c')][_0xda84('0x34')]);_0xa3d8a6[_0xda84('0x1f')][_0xda84('0x85')]=_0xa3d8a6[_0xda84('0x85')];_0xa3d8a6['message'][_0xda84('0x86')]=_0xa3d8a6[_0xda84('0x85')];_0xa3d8a6['message'][_0xda84('0x87')]=_0xda84('0x69');_0xa3d8a6['message'][_0xda84('0x4f')]=htmlToText[_0xda84('0x88')](_0xa3d8a6['message'][_0xda84('0x4f')]);return respondWithRpcPromise(_0xda84('0x89'),'EventManager',{'event':'acceptmessage','message':_0xa3d8a6[_0xda84('0x1f')]},client9002)[_0xda84('0x16')](function(){return _0xa3d8a6;});}return _0xa3d8a6;}return null;})['then'](respondWithResult(_0x3cef8a,null))['catch'](handleError(_0x3cef8a,null));};exports[_0xda84('0x8a')]=function(_0x332385,_0x16bb66){var _0x25778e={'agent':{},'channel':_0xda84('0x8b')};if(_0x332385[_0xda84('0x4f')]['id']){delete _0x332385[_0xda84('0x4f')]['id'];}_0x332385[_0xda84('0x4f')][_0xda84('0x6b')]=_0x332385[_0xda84('0x4f')][_0xda84('0x6b')]||_0x332385[_0xda84('0x6c')]['id'];_0x25778e[_0xda84('0x6d')]['id']=_0x332385[_0xda84('0x4f')][_0xda84('0x6b')];return db[_0xda84('0x2e')][_0xda84('0x4d')]({'where':{'id':_0x332385[_0xda84('0x48')]['id'],'UserId':null}})[_0xda84('0x16')](handleEntityNotFound(_0x16bb66,null))[_0xda84('0x16')](function(_0x149625){if(_0x149625){_0x25778e[_0xda84('0x1f')]=_0x149625[_0xda84('0x6e')]({'plain':!![]});return db['MailInteraction'][_0xda84('0x4d')]({'where':{'id':_0x149625[_0xda84('0x8c')]}});}return null;})['then'](handleEntityNotFound(_0x16bb66,null))[_0xda84('0x16')](function(_0x58d07a){if(_0x58d07a){_0x25778e[_0xda84('0x72')]=_0x58d07a['get']({'plain':!![]});interaction_log['info'](_0xda84('0x8d'),_0x332385[_0xda84('0x6c')]['id'],_0x332385['user'][_0xda84('0x34')],_0x332385[_0xda84('0x6c')][_0xda84('0x74')],_0x25778e[_0xda84('0x72')]['id'],_0x332385[_0xda84('0x4f')]?JSON[_0xda84('0x1c')](_0x332385[_0xda84('0x4f')]):_0xda84('0x75'));return respondWithRpcPromise(_0xda84('0x8e'),_0xda84('0x8f'),_0x25778e);}return null;})[_0xda84('0x16')](function(_0x752393){var _0x164223=_0xda84('0x77')+_0x752393['message']['ContactId'];return db['sequelize'][_0xda84('0x35')](_0x164223,{'type':db[_0xda84('0x7a')][_0xda84('0x7b')]['SELECT'],'raw':!![]})[_0xda84('0x16')](function(_0x9f5a0d){return _0x9f5a0d;});})[_0xda84('0x16')](function(_0x4b7c06){if(_0x4b7c06){_0x25778e['message']['contact']=_0x4b7c06[0x0];if(!_0x332385[_0xda84('0x4f')]['UserId'])return;return db[_0xda84('0x7e')]['find']({'where':{'id':_0x332385[_0xda84('0x4f')][_0xda84('0x6b')],'role':_0xda84('0x6d')},'attributes':['id',_0xda84('0x34'),_0xda84('0x7f'),_0xda84('0x80'),_0xda84('0x81')],'raw':!![]});}return null;})[_0xda84('0x16')](function(_0x3c7a5f){if(!_0x3c7a5f)return null;_0x25778e[_0xda84('0x1f')]['agent']=_0x3c7a5f;return _0x25778e;})[_0xda84('0x16')](function(_0x1dc29e){if(_0x1dc29e){_0x1dc29e[_0xda84('0x1f')][_0xda84('0x83')]=util[_0xda84('0x67')](_0xda84('0x84'),_0x332385[_0xda84('0x6c')][_0xda84('0x34')]);_0x1dc29e[_0xda84('0x1f')][_0xda84('0x85')]=_0x25778e[_0xda84('0x85')];_0x1dc29e['message'][_0xda84('0x86')]=_0x25778e[_0xda84('0x85')];_0x1dc29e[_0xda84('0x1f')][_0xda84('0x87')]=_0xda84('0x8a');_0x1dc29e[_0xda84('0x1f')][_0xda84('0x4f')]=htmlToText[_0xda84('0x88')](_0x25778e['message'][_0xda84('0x4f')]);respondWithRpcPromise(_0xda84('0x89'),_0xda84('0x89'),{'event':_0xda84('0x90'),'message':_0x1dc29e[_0xda84('0x1f')]},client9002);return _0x25778e;}return null;})[_0xda84('0x16')](respondWithResult(_0x16bb66,null))[_0xda84('0x46')](handleError(_0x16bb66,null));};exports['download']=function(_0x632934,_0x4394d5){var _0x1a79f4=moment()[_0xda84('0x91')]()[_0xda84('0x92')]();var _0x174d07=path[_0xda84('0x5e')](config[_0xda84('0x5f')],_0xda84('0x93'),'files',_0xda84('0x94'));var _0x22c8e5=path[_0xda84('0x5e')](config['root'],'server',_0xda84('0x95'),_0xda84('0x5d'));var _0x4d2e3f=util[_0xda84('0x67')]('message-%s.eml',_0x1a79f4);return db[_0xda84('0x2e')][_0xda84('0x4d')]({'where':{'id':_0x632934[_0xda84('0x48')]['id']},'attributes':['id',_0xda84('0x4f'),_0xda84('0x96'),'to','cc',_0xda84('0x97'),_0xda84('0x98'),_0xda84('0x99')],'include':_0x632934[_0xda84('0x35')][_0xda84('0x5d')]?[{'model':db[_0xda84('0x9a')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x4394d5,null))[_0xda84('0x16')](function(_0x174f4c){if(_0x174f4c){var _0x12e101=_0x174f4c;var _0x41cb70={'from':_0x12e101[_0xda84('0x96')],'to':_0x12e101['to'],'subject':_0x12e101[_0xda84('0x98')],'html':htmlEntities['decode'](_0x12e101[_0xda84('0x4f')]),'headers':{'Date':moment(_0x12e101[_0xda84('0x99')])[_0xda84('0x67')](_0xda84('0x9b'))},'attachments':[]};if(_0x174f4c['cc']){_0x41cb70[_0xda84('0x9c')]['Cc']=_0x174f4c['cc'];}if(_0x174f4c['bcc']){_0x41cb70['headers']['Bcc']=_0x174f4c[_0xda84('0x97')];}return new BPromise(function(_0x3c56a2,_0x168d82){if(_0x174f4c[_0xda84('0x9d')]){for(var _0x2d4f2a=0x0;_0x2d4f2a<_0x174f4c[_0xda84('0x9d')][_0xda84('0x39')];_0x2d4f2a++){var _0x70430b=_0x174f4c[_0xda84('0x9d')][_0x2d4f2a];var _0x238032=path['join'](_0x22c8e5,_0x70430b[_0xda84('0x61')]);if(fs['existsSync'](_0x238032)){_0x41cb70[_0xda84('0x5d')][_0xda84('0x9e')]({'name':_0x70430b[_0xda84('0x34')],'contentType':_0x70430b[_0xda84('0x31')],'data':fs[_0xda84('0x9f')](_0x238032)});}}}emlformat['build'](_0x41cb70,function(_0x9f2af1,_0x25b735){if(_0x9f2af1)return _0x168d82(_0x9f2af1);fs[_0xda84('0xa0')](path[_0xda84('0x5e')](_0x174d07,_0x4d2e3f),_0x25b735);return _0x3c56a2(_0x25b735);});});}})[_0xda84('0x16')](function(_0xf1946b){if(_0xf1946b){return _0x4394d5[_0xda84('0xa1')](path['join'](_0x174d07,_0x4d2e3f),_0x4d2e3f,function(_0x1356b1){if(!_0x1356b1)fs[_0xda84('0xa2')](path[_0xda84('0x5e')](_0x174d07,_0x4d2e3f));});}})[_0xda84('0x46')](handleError(_0x4394d5,null));}; \ No newline at end of file +var _0xdf28=['api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','message','MailMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','count','status','set','Content-Range','destroy','stack','index','map','MailMessage','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','update','body','describe','create','direction','out','secret','MailAccount','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','CmContact','List\x20not\x20found','SendMail','messageId','format','stringify','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','read1stAt','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','fullname','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','reject','mail','rejectMessage','sequelize','motionChannel','download','unix','server','files','tmp','join','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xdf28,0x128));var _0x8df2=function(_0x1fe7c3,_0x2f7c6e){_0x1fe7c3=_0x1fe7c3-0x0;var _0x490542=_0xdf28[_0x1fe7c3];return _0x490542;};'use strict';var emlformat=require(_0x8df2('0x0'));var moment=require(_0x8df2('0x1'));var BPromise=require('bluebird');var util=require(_0x8df2('0x2'));var path=require(_0x8df2('0x3'));var fs=require('fs');var _=require(_0x8df2('0x4'));var Redis=require(_0x8df2('0x5'));var htmlToText=require(_0x8df2('0x6'));var qs=require(_0x8df2('0x7'));var logger=require('../../config/logger')(_0x8df2('0x8'));var interaction_log=require(_0x8df2('0x9'))(_0x8df2('0xa'));var config=require(_0x8df2('0xb'));var db=require(_0x8df2('0xc'))['db'];config[_0x8df2('0xd')]=_[_0x8df2('0xe')](config[_0x8df2('0xd')],{'host':_0x8df2('0xf'),'port':0x18eb});var socket=require(_0x8df2('0x10'))(new Redis(config['redis']));var htmlEntities=require(_0x8df2('0x11'));require(_0x8df2('0x12'))[_0x8df2('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8df2('0x14')]({'port':0x232c});var client9003=jayson['client'][_0x8df2('0x14')]({'port':0x232b});var client9002=jayson[_0x8df2('0x15')][_0x8df2('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4d99c8,_0x5744da,_0x503613,_0x11e659){return new BPromise(function(_0x47f03c,_0x56ddcd){var _0x3e96cf=_0x11e659||client;return _0x3e96cf[_0x8df2('0x16')](_0x4d99c8,_0x503613)[_0x8df2('0x17')](function(_0xcc1ed2){logger[_0x8df2('0x18')]('MailMessage,\x20%s,\x20%s',_0x5744da,_0x8df2('0x19'));logger['debug'](_0x8df2('0x1a'),_0x5744da,_0x8df2('0x19'),JSON['stringify'](_0xcc1ed2));if(_0xcc1ed2[_0x8df2('0x1b')]){if(_0xcc1ed2['error']['code']===0x1f4){logger[_0x8df2('0x1b')]('MailMessage,\x20%s,\x20%s',_0x5744da,_0xcc1ed2[_0x8df2('0x1b')]['message']);return _0x56ddcd(_0xcc1ed2[_0x8df2('0x1b')][_0x8df2('0x1c')]);}logger[_0x8df2('0x1b')](_0x8df2('0x1d'),_0x5744da,_0xcc1ed2[_0x8df2('0x1b')][_0x8df2('0x1c')]);return _0x47f03c(_0xcc1ed2[_0x8df2('0x1b')]['message']);}else{logger[_0x8df2('0x18')](_0x8df2('0x1d'),_0x5744da,_0x8df2('0x19'));_0x47f03c(_0xcc1ed2[_0x8df2('0x1e')]['message']);}})[_0x8df2('0x1f')](function(_0x14b3b6){logger[_0x8df2('0x1b')](_0x8df2('0x1d'),_0x5744da,_0x14b3b6);_0x56ddcd(_0x14b3b6);});});}function respondWithResult(_0x4d26b9,_0x170b00){_0x170b00=_0x170b00||0xc8;return function(_0x119295){if(_0x119295){return _0x4d26b9['status'](_0x170b00)[_0x8df2('0x20')](_0x119295);}};}function respondWithFilteredResult(_0x932848,_0x8f6377){return function(_0x23207f){if(_0x23207f){var _0x2ffd44=typeof _0x8f6377[_0x8df2('0x21')]===_0x8df2('0x22')&&typeof _0x8f6377['limit']==='undefined';var _0x50d1e3=_0x23207f[_0x8df2('0x23')];var _0x109404=_0x2ffd44?0x0:_0x8f6377[_0x8df2('0x21')];var _0xb03bbf=_0x2ffd44?_0x23207f[_0x8df2('0x23')]:_0x8f6377[_0x8df2('0x21')]+_0x8f6377['limit'];var _0x83cfbb;if(_0xb03bbf>=_0x50d1e3){_0xb03bbf=_0x50d1e3;_0x83cfbb=0xc8;}else{_0x83cfbb=0xce;}_0x932848[_0x8df2('0x24')](_0x83cfbb);return _0x932848[_0x8df2('0x25')](_0x8df2('0x26'),_0x109404+'-'+_0xb03bbf+'/'+_0x50d1e3)[_0x8df2('0x20')](_0x23207f);}return null;};}function saveUpdates(_0x3d7900){return function(_0x3f6527){if(_0x3f6527){return _0x3f6527['update'](_0x3d7900)[_0x8df2('0x17')](function(_0x54f353){return _0x54f353;});}return null;};}function removeEntity(_0x21599a){return function(_0x4bf5ae){if(_0x4bf5ae){return _0x4bf5ae[_0x8df2('0x27')]()[_0x8df2('0x17')](function(){_0x21599a[_0x8df2('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af740){return function(_0x2013e1){if(!_0x2013e1){_0x3af740['sendStatus'](0x194);}return _0x2013e1;};}function handleError(_0x430331,_0x48f22a){_0x48f22a=_0x48f22a||0x1f4;return function(_0x23a0f6){logger['error'](_0x23a0f6[_0x8df2('0x28')]);if(_0x23a0f6['name']){delete _0x23a0f6['name'];}_0x430331['status'](_0x48f22a)['send'](_0x23a0f6);};}exports[_0x8df2('0x29')]=function(_0x5640b8,_0x15ee46){var _0x5d7a6c={},_0x2a6146={},_0x3c405c={'count':0x0,'rows':[]};var _0x44ebe9=_[_0x8df2('0x2a')](db[_0x8df2('0x2b')]['rawAttributes'],function(_0x4095be){return{'name':_0x4095be[_0x8df2('0x2c')],'type':_0x4095be[_0x8df2('0x2d')][_0x8df2('0x2e')]};});_0x2a6146[_0x8df2('0x2f')]=_[_0x8df2('0x2a')](_0x44ebe9,_0x8df2('0x30'));_0x2a6146[_0x8df2('0x31')]=_[_0x8df2('0x32')](_0x5640b8[_0x8df2('0x31')]);_0x2a6146[_0x8df2('0x33')]=_[_0x8df2('0x34')](_0x2a6146[_0x8df2('0x2f')],_0x2a6146[_0x8df2('0x31')]);_0x5d7a6c['attributes']=_['intersection'](_0x2a6146['model'],qs['fields'](_0x5640b8[_0x8df2('0x31')][_0x8df2('0x35')]));_0x5d7a6c[_0x8df2('0x36')]=_0x5d7a6c['attributes'][_0x8df2('0x37')]?_0x5d7a6c[_0x8df2('0x36')]:_0x2a6146[_0x8df2('0x2f')];if(!_0x5640b8[_0x8df2('0x31')][_0x8df2('0x38')]('nolimit')){_0x5d7a6c['limit']=qs[_0x8df2('0x39')](_0x5640b8[_0x8df2('0x31')]['limit']);_0x5d7a6c[_0x8df2('0x21')]=qs[_0x8df2('0x21')](_0x5640b8[_0x8df2('0x31')]['offset']);}_0x5d7a6c[_0x8df2('0x3a')]=qs[_0x8df2('0x3b')](_0x5640b8[_0x8df2('0x31')][_0x8df2('0x3b')]);_0x5d7a6c[_0x8df2('0x3c')]=qs['filters'](_['pick'](_0x5640b8['query'],_0x2a6146[_0x8df2('0x33')]),_0x44ebe9);if(_0x5640b8[_0x8df2('0x31')][_0x8df2('0x3d')]){_0x5d7a6c[_0x8df2('0x3c')]=_[_0x8df2('0x3e')](_0x5d7a6c[_0x8df2('0x3c')],{'$or':_[_0x8df2('0x2a')](_0x44ebe9,function(_0x190b4f){if(_0x190b4f[_0x8df2('0x2d')]!==_0x8df2('0x3f')){var _0x576df7={};_0x576df7[_0x190b4f['name']]={'$like':'%'+_0x5640b8['query']['filter']+'%'};return _0x576df7;}})});}_0x5d7a6c=_[_0x8df2('0x3e')]({},_0x5d7a6c,_0x5640b8[_0x8df2('0x40')]);var _0x53a7ba={'where':_0x5d7a6c[_0x8df2('0x3c')]};return db[_0x8df2('0x2b')][_0x8df2('0x23')](_0x53a7ba)[_0x8df2('0x17')](function(_0x11be29){_0x3c405c[_0x8df2('0x23')]=_0x11be29;if(_0x5640b8[_0x8df2('0x31')][_0x8df2('0x41')]){_0x5d7a6c[_0x8df2('0x42')]=[{'all':!![]}];}return db[_0x8df2('0x2b')][_0x8df2('0x43')](_0x5d7a6c);})['then'](function(_0x1567c6){_0x3c405c[_0x8df2('0x44')]=_0x1567c6;return _0x3c405c;})[_0x8df2('0x17')](respondWithFilteredResult(_0x15ee46,_0x5d7a6c))[_0x8df2('0x1f')](handleError(_0x15ee46,null));};exports['show']=function(_0x565c66,_0x49ce56){var _0x1f3bf4={'raw':!![],'where':{'id':_0x565c66[_0x8df2('0x45')]['id']}},_0x3b3c21={};_0x3b3c21[_0x8df2('0x2f')]=_[_0x8df2('0x32')](db[_0x8df2('0x2b')][_0x8df2('0x46')]);_0x3b3c21[_0x8df2('0x31')]=_['keys'](_0x565c66[_0x8df2('0x31')]);_0x3b3c21[_0x8df2('0x33')]=_[_0x8df2('0x34')](_0x3b3c21[_0x8df2('0x2f')],_0x3b3c21[_0x8df2('0x31')]);_0x1f3bf4[_0x8df2('0x36')]=_[_0x8df2('0x34')](_0x3b3c21['model'],qs[_0x8df2('0x35')](_0x565c66['query'][_0x8df2('0x35')]));_0x1f3bf4['attributes']=_0x1f3bf4['attributes']['length']?_0x1f3bf4[_0x8df2('0x36')]:_0x3b3c21[_0x8df2('0x2f')];if(_0x565c66[_0x8df2('0x31')][_0x8df2('0x41')]){_0x1f3bf4[_0x8df2('0x42')]=[{'all':!![]}];}_0x1f3bf4=_[_0x8df2('0x3e')]({},_0x1f3bf4,_0x565c66[_0x8df2('0x40')]);return db[_0x8df2('0x2b')][_0x8df2('0x47')](_0x1f3bf4)[_0x8df2('0x17')](handleEntityNotFound(_0x49ce56,null))['then'](respondWithResult(_0x49ce56,null))[_0x8df2('0x1f')](handleError(_0x49ce56,null));};exports[_0x8df2('0x48')]=function(_0x15cf37,_0x888155){if(_0x15cf37[_0x8df2('0x49')]['id']){delete _0x15cf37[_0x8df2('0x49')]['id'];}return db[_0x8df2('0x2b')][_0x8df2('0x47')]({'where':{'id':_0x15cf37[_0x8df2('0x45')]['id']}})[_0x8df2('0x17')](handleEntityNotFound(_0x888155,null))[_0x8df2('0x17')](saveUpdates(_0x15cf37[_0x8df2('0x49')],null))[_0x8df2('0x17')](respondWithResult(_0x888155,null))['catch'](handleError(_0x888155,null));};exports[_0x8df2('0x27')]=function(_0xf0efb3,_0x2d18da){return db[_0x8df2('0x2b')]['find']({'where':{'id':_0xf0efb3[_0x8df2('0x45')]['id']}})[_0x8df2('0x17')](handleEntityNotFound(_0x2d18da,null))[_0x8df2('0x17')](removeEntity(_0x2d18da,null))[_0x8df2('0x1f')](handleError(_0x2d18da,null));};exports[_0x8df2('0x4a')]=function(_0x48d409,_0x16cfd5){return db[_0x8df2('0x2b')][_0x8df2('0x4a')]()[_0x8df2('0x17')](respondWithResult(_0x16cfd5,null))[_0x8df2('0x1f')](handleError(_0x16cfd5,null));};exports[_0x8df2('0x4b')]=function(_0x54842d,_0x21fccb){return db['MailMessage'][_0x8df2('0x4b')](_0x54842d[_0x8df2('0x49')])['then'](function(_0x52985a){if(_0x52985a){if(_0x52985a[_0x8df2('0x4c')]===_0x8df2('0x4d')&&!_0x52985a[_0x8df2('0x4e')]){var _0x30963b,_0x253123,_0x514e47;if(_0x54842d[_0x8df2('0x49')]['to']){_0x253123=_0x54842d[_0x8df2('0x49')]['to']['split'](',')[0x0];}return db[_0x8df2('0x4f')]['findOne']({'where':{'id':_0x52985a['MailAccountId']},'include':[{'model':db[_0x8df2('0x50')],'as':_0x8df2('0x51'),'include':[{'model':db['CmContact'],'as':_0x8df2('0x52'),'where':{'email':_0x253123},'limit':0x1,'order':[[_0x8df2('0x53'),'DESC']]}]},{'model':db[_0x8df2('0x54')],'as':_0x8df2('0x55'),'raw':!![],'include':[{'model':db[_0x8df2('0x56')],'as':'CloudProvider','raw':!![]}]}]})[_0x8df2('0x17')](function(_0x42d1d3){_0x30963b=_0x42d1d3;if(!_0x30963b||!_0x30963b[_0x8df2('0x55')])return;var _0x3f3c5b=_0x30963b[_0x8df2('0x57')]();if(_0x54842d[_0x8df2('0x49')][_0x8df2('0x58')]&&_0x54842d['body'][_0x8df2('0x58')][_0x8df2('0x37')]){for(var _0x50c529=0x0;_0x50c529<_0x54842d['body'][_0x8df2('0x58')][_0x8df2('0x37')];_0x50c529+=0x1){_0x54842d[_0x8df2('0x49')][_0x8df2('0x58')][_0x50c529]={'filename':_0x54842d[_0x8df2('0x49')]['attachments'][_0x50c529]['name'],'path':path['join'](config[_0x8df2('0x59')],_0x8df2('0x5a'),_0x54842d[_0x8df2('0x49')][_0x8df2('0x58')][_0x50c529][_0x8df2('0x5b')])};}}_0x514e47={'account':_0x3f3c5b,'message':_0x54842d[_0x8df2('0x49')]};return;})['then'](function(){if(_0x30963b[_0x8df2('0x51')]){if(_0x30963b[_0x8df2('0x51')]['Contacts']['length']){return _0x30963b['List']['Contacts'][0x0];}else{return db[_0x8df2('0x5c')]['create'](_[_0x8df2('0xe')](_0x54842d['body'],{'firstName':_0x54842d[_0x8df2('0x49')]['to'],'email':_0x54842d[_0x8df2('0x49')]['to'],'phone':_0x54842d['body']['to'],'ListId':_0x30963b['ListId']}));}}else{throw new Error(_0x8df2('0x5d'));}})[_0x8df2('0x17')](function(){if(_0x514e47){return respondWithRpcPromise(_0x8df2('0x5e'),'sendMail',_0x514e47,client9003)['then'](function(_0x397d64){return _0x52985a[_0x8df2('0x48')]({'read':!![],'messageId':_0x397d64[_0x8df2('0x5f')],'sentAt':moment()[_0x8df2('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x567c7f){logger[_0x8df2('0x1b')]('%s',JSON[_0x8df2('0x61')](_0x567c7f));return _0x52985a;});}return _0x52985a;});}return _0x52985a;}})['then'](respondWithResult(_0x21fccb,0xc9))[_0x8df2('0x1f')](handleError(_0x21fccb,null));};exports[_0x8df2('0x62')]=function(_0x5cc347,_0x29caf4){var _0x35c37c={'agent':{},'channel':'mail'};if(_0x5cc347[_0x8df2('0x49')]['id']){delete _0x5cc347['body']['id'];}_0x5cc347['body']['read']=!![];_0x5cc347['body'][_0x8df2('0x63')]=moment()[_0x8df2('0x60')](_0x8df2('0x64'));_0x5cc347[_0x8df2('0x49')][_0x8df2('0x65')]=_0x5cc347['body'][_0x8df2('0x65')]||_0x5cc347['user']['id'];_0x35c37c['agent']['id']=_0x5cc347[_0x8df2('0x49')][_0x8df2('0x65')];return db[_0x8df2('0x2b')][_0x8df2('0x47')]({'where':{'id':_0x5cc347[_0x8df2('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29caf4,null))[_0x8df2('0x17')](saveUpdates(_0x5cc347[_0x8df2('0x49')],null))[_0x8df2('0x17')](function(_0x3413af){if(_0x3413af){_0x35c37c[_0x8df2('0x1c')]=_0x3413af[_0x8df2('0x66')]({'plain':!![]});return db[_0x8df2('0x67')][_0x8df2('0x47')]({'where':{'id':_0x3413af[_0x8df2('0x68')]}});}return null;})[_0x8df2('0x17')](handleEntityNotFound(_0x29caf4,null))[_0x8df2('0x17')](function(_0xdf6734){if(_0xdf6734){return _0xdf6734[_0x8df2('0x48')]({'UserId':_0x5cc347[_0x8df2('0x49')][_0x8df2('0x65')],'read1stAt':_['isNil'](_0xdf6734[_0x8df2('0x69')])?moment()[_0x8df2('0x60')](_0x8df2('0x64')):undefined});}return null;})[_0x8df2('0x17')](function(_0x5aab4e){if(_0x5aab4e){_0x35c37c['interaction']=_0x5aab4e[_0x8df2('0x66')]({'plain':!![]});interaction_log[_0x8df2('0x18')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5cc347['user']['id'],_0x5cc347[_0x8df2('0x6a')][_0x8df2('0x30')],_0x5cc347[_0x8df2('0x6a')][_0x8df2('0x6b')],_0x35c37c[_0x8df2('0x6c')]['id'],_0x5cc347[_0x8df2('0x49')]?JSON[_0x8df2('0x61')](_0x5cc347[_0x8df2('0x49')]):_0x8df2('0x6d'));return respondWithRpcPromise(_0x8df2('0x6e'),_0x8df2('0x6f'),_0x35c37c);}return null;})[_0x8df2('0x17')](function(_0x80ceab){var _0x2bd679=_0x8df2('0x70')+_0x80ceab['message'][_0x8df2('0x71')];return db['sequelize'][_0x8df2('0x31')](_0x2bd679,{'type':db[_0x8df2('0x72')][_0x8df2('0x73')][_0x8df2('0x74')],'raw':!![]})[_0x8df2('0x17')](function(_0x575718){return _0x575718;});})[_0x8df2('0x17')](function(_0x439c11){if(_0x439c11){_0x35c37c['message'][_0x8df2('0x75')]=_0x439c11[0x0];if(!_0x5cc347[_0x8df2('0x49')]['UserId'])return;return db['User'][_0x8df2('0x47')]({'where':{'id':_0x5cc347[_0x8df2('0x49')][_0x8df2('0x65')],'role':_0x8df2('0x76')},'attributes':['id',_0x8df2('0x30'),_0x8df2('0x77'),'email',_0x8df2('0x78')],'raw':!![]});}return null;})[_0x8df2('0x17')](function(_0x25c4b2){if(!_0x25c4b2)return null;_0x35c37c[_0x8df2('0x1c')][_0x8df2('0x76')]=_0x25c4b2;return _0x35c37c;})[_0x8df2('0x17')](function(_0x5088cc){if(_0x5088cc){if(_0x5cc347[_0x8df2('0x49')][_0x8df2('0x79')]){_0x35c37c['message'][_0x8df2('0x7a')]=util[_0x8df2('0x60')](_0x8df2('0x7b'),_0x5cc347[_0x8df2('0x6a')][_0x8df2('0x30')]);_0x35c37c['message'][_0x8df2('0x7c')]=_0x35c37c[_0x8df2('0x7c')];_0x35c37c['message']['motionChannel']=_0x35c37c['channel'];_0x35c37c[_0x8df2('0x1c')][_0x8df2('0x7d')]=_0x8df2('0x62');_0x35c37c[_0x8df2('0x1c')][_0x8df2('0x49')]=htmlToText[_0x8df2('0x7e')](_0x35c37c[_0x8df2('0x1c')][_0x8df2('0x49')]);return respondWithRpcPromise(_0x8df2('0x7f'),_0x8df2('0x7f'),{'event':'acceptmessage','message':_0x35c37c[_0x8df2('0x1c')]},client9002)[_0x8df2('0x17')](function(){return _0x35c37c;});}return _0x35c37c;}return null;})[_0x8df2('0x17')](respondWithResult(_0x29caf4,null))[_0x8df2('0x1f')](handleError(_0x29caf4,null));};exports[_0x8df2('0x80')]=function(_0x52d451,_0x1428ee){var _0x9091af={'agent':{},'channel':_0x8df2('0x81')};if(_0x52d451[_0x8df2('0x49')]['id']){delete _0x52d451[_0x8df2('0x49')]['id'];}_0x52d451[_0x8df2('0x49')][_0x8df2('0x65')]=_0x52d451[_0x8df2('0x49')]['UserId']||_0x52d451[_0x8df2('0x6a')]['id'];_0x9091af[_0x8df2('0x76')]['id']=_0x52d451[_0x8df2('0x49')][_0x8df2('0x65')];return db['MailMessage'][_0x8df2('0x47')]({'where':{'id':_0x52d451['params']['id'],'UserId':null}})[_0x8df2('0x17')](handleEntityNotFound(_0x1428ee,null))['then'](function(_0x13760c){if(_0x13760c){_0x9091af[_0x8df2('0x1c')]=_0x13760c[_0x8df2('0x66')]({'plain':!![]});return db[_0x8df2('0x67')]['find']({'where':{'id':_0x13760c[_0x8df2('0x68')]}});}return null;})[_0x8df2('0x17')](handleEntityNotFound(_0x1428ee,null))[_0x8df2('0x17')](function(_0x51a0ac){if(_0x51a0ac){_0x9091af[_0x8df2('0x6c')]=_0x51a0ac['get']({'plain':!![]});interaction_log[_0x8df2('0x18')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52d451['user']['id'],_0x52d451[_0x8df2('0x6a')][_0x8df2('0x30')],_0x52d451[_0x8df2('0x6a')][_0x8df2('0x6b')],_0x9091af[_0x8df2('0x6c')]['id'],_0x52d451[_0x8df2('0x49')]?JSON[_0x8df2('0x61')](_0x52d451[_0x8df2('0x49')]):_0x8df2('0x6d'));return respondWithRpcPromise('RejectMessage',_0x8df2('0x82'),_0x9091af);}return null;})[_0x8df2('0x17')](function(_0x58f22a){var _0x166e2e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x58f22a['message'][_0x8df2('0x71')];return db[_0x8df2('0x83')][_0x8df2('0x31')](_0x166e2e,{'type':db[_0x8df2('0x72')][_0x8df2('0x73')]['SELECT'],'raw':!![]})[_0x8df2('0x17')](function(_0x4fd146){return _0x4fd146;});})[_0x8df2('0x17')](function(_0x1b582d){if(_0x1b582d){_0x9091af[_0x8df2('0x1c')]['contact']=_0x1b582d[0x0];if(!_0x52d451['body'][_0x8df2('0x65')])return;return db['User'][_0x8df2('0x47')]({'where':{'id':_0x52d451[_0x8df2('0x49')]['UserId'],'role':_0x8df2('0x76')},'attributes':['id',_0x8df2('0x30'),_0x8df2('0x77'),'email',_0x8df2('0x78')],'raw':!![]});}return null;})[_0x8df2('0x17')](function(_0x5020d2){if(!_0x5020d2)return null;_0x9091af[_0x8df2('0x1c')][_0x8df2('0x76')]=_0x5020d2;return _0x9091af;})[_0x8df2('0x17')](function(_0xe1d28){if(_0xe1d28){_0xe1d28['message'][_0x8df2('0x7a')]=util['format'](_0x8df2('0x7b'),_0x52d451['user']['name']);_0xe1d28[_0x8df2('0x1c')][_0x8df2('0x7c')]=_0x9091af['channel'];_0xe1d28[_0x8df2('0x1c')][_0x8df2('0x84')]=_0x9091af[_0x8df2('0x7c')];_0xe1d28[_0x8df2('0x1c')][_0x8df2('0x7d')]=_0x8df2('0x80');_0xe1d28[_0x8df2('0x1c')][_0x8df2('0x49')]=htmlToText[_0x8df2('0x7e')](_0x9091af[_0x8df2('0x1c')][_0x8df2('0x49')]);respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0xe1d28[_0x8df2('0x1c')]},client9002);return _0x9091af;}return null;})[_0x8df2('0x17')](respondWithResult(_0x1428ee,null))[_0x8df2('0x1f')](handleError(_0x1428ee,null));};exports[_0x8df2('0x85')]=function(_0x3bd4a8,_0x3c2522){var _0x100713=moment()[_0x8df2('0x86')]()['toString']();var _0x45cc45=path['join'](config['root'],_0x8df2('0x87'),_0x8df2('0x88'),_0x8df2('0x89'));var _0x20f13b=path[_0x8df2('0x8a')](config[_0x8df2('0x59')],'server',_0x8df2('0x88'),_0x8df2('0x58'));var _0x48cd46=util[_0x8df2('0x60')]('message-%s.eml',_0x100713);return db[_0x8df2('0x2b')][_0x8df2('0x47')]({'where':{'id':_0x3bd4a8[_0x8df2('0x45')]['id']},'attributes':['id',_0x8df2('0x49'),_0x8df2('0x8b'),'to','cc',_0x8df2('0x8c'),_0x8df2('0x8d'),'createdAt'],'include':_0x3bd4a8[_0x8df2('0x31')][_0x8df2('0x58')]?[{'model':db[_0x8df2('0x8e')],'as':_0x8df2('0x8f')}]:undefined})[_0x8df2('0x17')](handleEntityNotFound(_0x3c2522,null))[_0x8df2('0x17')](function(_0x10e47c){if(_0x10e47c){var _0x4e13f2=_0x10e47c;var _0x1ae720={'from':_0x4e13f2['from'],'to':_0x4e13f2['to'],'subject':_0x4e13f2['subject'],'html':htmlEntities['decode'](_0x4e13f2[_0x8df2('0x49')]),'headers':{'Date':moment(_0x4e13f2[_0x8df2('0x90')])[_0x8df2('0x60')](_0x8df2('0x91'))},'attachments':[]};if(_0x10e47c['cc']){_0x1ae720[_0x8df2('0x92')]['Cc']=_0x10e47c['cc'];}if(_0x10e47c[_0x8df2('0x8c')]){_0x1ae720[_0x8df2('0x92')]['Bcc']=_0x10e47c[_0x8df2('0x8c')];}return new BPromise(function(_0xa9534d,_0x59bc8f){if(_0x10e47c[_0x8df2('0x8f')]){for(var _0x4d6492=0x0;_0x4d6492<_0x10e47c[_0x8df2('0x8f')][_0x8df2('0x37')];_0x4d6492++){var _0x525c73=_0x10e47c[_0x8df2('0x8f')][_0x4d6492];var _0x3b8208=path['join'](_0x20f13b,_0x525c73[_0x8df2('0x5b')]);if(fs[_0x8df2('0x93')](_0x3b8208)){_0x1ae720['attachments'][_0x8df2('0x94')]({'name':_0x525c73['name'],'contentType':_0x525c73[_0x8df2('0x2d')],'data':fs['readFileSync'](_0x3b8208)});}}}emlformat[_0x8df2('0x95')](_0x1ae720,function(_0x129e5a,_0x288a80){if(_0x129e5a)return _0x59bc8f(_0x129e5a);fs[_0x8df2('0x96')](path['join'](_0x45cc45,_0x48cd46),_0x288a80);return _0xa9534d(_0x288a80);});});}})['then'](function(_0x113e45){if(_0x113e45){return _0x3c2522[_0x8df2('0x85')](path['join'](_0x45cc45,_0x48cd46),_0x48cd46,function(_0x1fc1e0){if(!_0x1fc1e0)fs[_0x8df2('0x97')](path['join'](_0x45cc45,_0x48cd46));});}})[_0x8df2('0x1f')](handleError(_0x3c2522,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f9a089d..cfb3a1e 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 _0x5e31=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1a5354,_0x31f17a){var _0x85504a=function(_0x2adf97){while(--_0x2adf97){_0x1a5354['push'](_0x1a5354['shift']());}};_0x85504a(++_0x31f17a);}(_0x5e31,0x1da));var _0x15e3=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0x5e31[_0x5341ff];return _0x53be58;};'use strict';var EventEmitter=require(_0x15e3('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x15e3('0x1')](0x0);var events={'afterCreate':_0x15e3('0x2'),'afterUpdate':'update','afterDestroy':_0x15e3('0x3')};function emitEvent(_0xf230b0){return function(_0x265c25,_0x39a9d9,_0x5d5cab){MailMessageEvents[_0x15e3('0x4')](_0xf230b0+':'+_0x265c25['id'],_0x265c25);MailMessageEvents[_0x15e3('0x4')](_0xf230b0,_0x265c25);_0x5d5cab(null);};}for(var e in events){if(events[_0x15e3('0x5')](e)){var event=events[e];MailMessage[_0x15e3('0x6')](e,emitEvent(event));}}module[_0x15e3('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xd995=['hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5bb2b7,_0x33f14b){var _0xa5dbf6=function(_0x5ceed9){while(--_0x5ceed9){_0x5bb2b7['push'](_0x5bb2b7['shift']());}};_0xa5dbf6(++_0x33f14b);}(_0xd995,0x13c));var _0x5d99=function(_0x4d61a1,_0x15694f){_0x4d61a1=_0x4d61a1-0x0;var _0x3a542f=_0xd995[_0x4d61a1];return _0x3a542f;};'use strict';var EventEmitter=require(_0x5d99('0x0'));var MailMessage=require(_0x5d99('0x1'))['db'][_0x5d99('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5d99('0x3')](0x0);var events={'afterCreate':_0x5d99('0x4'),'afterUpdate':_0x5d99('0x5'),'afterDestroy':'remove'};function emitEvent(_0x12a0cc){return function(_0x1a13dc,_0x4f2e30,_0x18efc5){MailMessageEvents['emit'](_0x12a0cc+':'+_0x1a13dc['id'],_0x1a13dc);MailMessageEvents[_0x5d99('0x6')](_0x12a0cc,_0x1a13dc);_0x18efc5(null);};}for(var e in events){if(events[_0x5d99('0x7')](e)){var event=events[e];MailMessage[_0x5d99('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index cb3e442..8fd704f 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 _0x830a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','MailInteraction','findOne','then','update','createdAt','error','utf8mb4'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x830a,0x1e1));var _0xa830=function(_0x1f6bd0,_0x164443){_0x1f6bd0=_0x1f6bd0-0x0;var _0x33e8d1=_0x830a[_0x1f6bd0];return _0x33e8d1;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var logger=require(_0xa830('0x2'))(_0xa830('0x3'));var moment=require(_0xa830('0x4'));var BPromise=require(_0xa830('0x5'));var rp=require(_0xa830('0x6'));var htmlToText=require(_0xa830('0x7'));var fs=require('fs');var path=require(_0xa830('0x8'));var rimraf=require(_0xa830('0x9'));var config=require('../../config/environment');var attributes=require(_0xa830('0xa'));module[_0xa830('0xb')]=function(_0x53a4ad,_0xf8d485){return _0x53a4ad[_0xa830('0xc')](_0xa830('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xa830('0xe'),'subject'],'type':_0xa830('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b94ee,_0x410349,_0x75a89a){if(_0x4b94ee[_0xa830('0x10')]){_0x4b94ee[_0xa830('0xe')]=htmlToText[_0xa830('0x11')](_0x4b94ee['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x75a89a(null,_0x410349);},'afterCreate':function(_0x19c917,_0x449082,_0x526673){var _0x25d3c9=_0x53a4ad[_0xa830('0x12')];var _0x116668=_0x19c917[_0xa830('0x13')]({'plain':!![]});if(_0x116668[_0xa830('0x14')]['toLowerCase']()==='in'||_0x116668['direction'][_0xa830('0x15')]()===_0xa830('0x16')&&!_0x116668['secret']&&!_[_0xa830('0x17')](_0x116668['UserId'])){_0x25d3c9[_0xa830('0x18')][_0xa830('0x19')]({'where':{'id':_0x116668['MailInteractionId']}})[_0xa830('0x1a')](function(_0x10e1c7){if(_0x10e1c7){_0x10e1c7[_0xa830('0x1b')]({'lastMsgAt':_0x116668[_0xa830('0x1c')],'lastMsgDirection':_0x116668['direction'][_0xa830('0x15')]()});}})['catch'](function(_0x3712a6){console[_0xa830('0x1d')](_0x3712a6);});}_0x526673();}},'charset':_0xa830('0x1e'),'collate':_0xa830('0x1f')});}; \ No newline at end of file +var _0x3466=['body','fromString','get','toLowerCase','out','secret','UserId','findOne','MailInteractionId','then','createdAt','direction','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','html-to-text','path','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT'];(function(_0xde80d,_0x312776){var _0x551ba0=function(_0x34d19e){while(--_0x34d19e){_0xde80d['push'](_0xde80d['shift']());}};_0x551ba0(++_0x312776);}(_0x3466,0x126));var _0x6346=function(_0x370c1a,_0x444e6f){_0x370c1a=_0x370c1a-0x0;var _0xb4f5e9=_0x3466[_0x370c1a];return _0xb4f5e9;};'use strict';var _=require(_0x6346('0x0'));var util=require(_0x6346('0x1'));var logger=require(_0x6346('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6346('0x3'));var rp=require(_0x6346('0x4'));var htmlToText=require(_0x6346('0x5'));var fs=require('fs');var path=require(_0x6346('0x6'));var rimraf=require('rimraf');var config=require(_0x6346('0x7'));var attributes=require('./mailMessage.attributes');module[_0x6346('0x8')]=function(_0x340147,_0x17580e){return _0x340147[_0x6346('0x9')]('MailMessage',attributes,{'tableName':_0x6346('0xa'),'paranoid':![],'indexes':[{'name':_0x6346('0xb'),'fields':[_0x6346('0xb')]},{'name':_0x6346('0xc'),'fields':[_0x6346('0xd'),_0x6346('0xe')],'type':_0x6346('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xeaefb8,_0xec5ac1,_0x1b17e1){if(_0xeaefb8[_0x6346('0x10')]){_0xeaefb8[_0x6346('0xd')]=htmlToText[_0x6346('0x11')](_0xeaefb8[_0x6346('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1b17e1(null,_0xec5ac1);},'afterCreate':function(_0x350f5d,_0x38851b,_0xeddf37){var _0x4a398d=_0x340147['models'];var _0x2ae116=_0x350f5d[_0x6346('0x12')]({'plain':!![]});if(_0x2ae116['direction'][_0x6346('0x13')]()==='in'||_0x2ae116['direction'][_0x6346('0x13')]()===_0x6346('0x14')&&!_0x2ae116[_0x6346('0x15')]&&!_['isNil'](_0x2ae116[_0x6346('0x16')])){_0x4a398d['MailInteraction'][_0x6346('0x17')]({'where':{'id':_0x2ae116[_0x6346('0x18')]}})[_0x6346('0x19')](function(_0x5ac65a){if(_0x5ac65a){_0x5ac65a['update']({'lastMsgAt':_0x2ae116[_0x6346('0x1a')],'lastMsgDirection':_0x2ae116[_0x6346('0x1b')]['toLowerCase']()});}})[_0x6346('0x1c')](function(_0x50231f){console[_0x6346('0x1d')](_0x50231f);});}_0xeddf37();}},'charset':'utf8mb4','collate':_0x6346('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4d8fd12..bf82f68 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 _0x8952=['error','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','stringify','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8952,0x17e));var _0x2895=function(_0x510e99,_0x7cebde){_0x510e99=_0x510e99-0x0;var _0x54b6fa=_0x8952[_0x510e99];return _0x54b6fa;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});}exports['CreateMailMessage']=function(_0x493851){var _0x442cfa=this;return new Promise(function(_0x12c2fb,_0x3ec4da){return db['MailMessage'][_0x2895('0x1a')](_0x493851[_0x2895('0x1b')],{'raw':_0x493851[_0x2895('0x1c')]?_0x493851[_0x2895('0x1c')][_0x2895('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x30c6c3){logger[_0x2895('0x10')]('CreateMailMessage',_0x493851);logger[_0x2895('0x12')](_0x2895('0x1e'),_0x493851,JSON[_0x2895('0x13')](_0x30c6c3));_0x12c2fb(_0x30c6c3);})['catch'](function(_0x4e884f){logger[_0x2895('0x15')](_0x2895('0x1e'),_0x4e884f[_0x2895('0x16')],_0x493851);_0x3ec4da(_0x442cfa['error'](0x1f4,_0x4e884f[_0x2895('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0xdb28,0x106));var _0x8db2=function(_0x3cddce,_0x38eb99){_0x3cddce=_0x3cddce-0x0;var _0x21d2f6=_0xdb28[_0x3cddce];return _0x21d2f6;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('MailMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateMailMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateMailMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5435a15..774ed91 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 _0x9ac8=['./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x2d030f,_0x5ca7b6){var _0x53fabd=function(_0x2159b2){while(--_0x2159b2){_0x2d030f['push'](_0x2d030f['shift']());}};_0x53fabd(++_0x5ca7b6);}(_0x9ac8,0x12d));var _0x89ac=function(_0x37cb79,_0x5aba0d){_0x37cb79=_0x37cb79-0x0;var _0x5cca18=_0x9ac8[_0x37cb79];return _0x5cca18;};'use strict';var MailMessageEvents=require(_0x89ac('0x0'));var events=['save',_0x89ac('0x1'),_0x89ac('0x2')];function createListener(_0x5d688b,_0x159f92){return function(_0x58e60f){_0x159f92[_0x89ac('0x3')](_0x5d688b,_0x58e60f);};}function removeListener(_0x37a194,_0x23cea6){return function(){MailMessageEvents[_0x89ac('0x4')](_0x37a194,_0x23cea6);};}exports[_0x89ac('0x5')]=function(_0x3b2e55){for(var _0x3efdb2=0x0,_0xa72062=events[_0x89ac('0x6')];_0x3efdb2<_0xa72062;_0x3efdb2++){var _0x2fb31e=events[_0x3efdb2];var _0x5ab509=createListener('mailMessage:'+_0x2fb31e,_0x3b2e55);MailMessageEvents['on'](_0x2fb31e,_0x5ab509);}}; \ No newline at end of file +var _0xcf33=['emit','register','length','./mailMessage.events','save','remove','update'];(function(_0x37bf8d,_0x43bce8){var _0x580ada=function(_0x43df13){while(--_0x43df13){_0x37bf8d['push'](_0x37bf8d['shift']());}};_0x580ada(++_0x43bce8);}(_0xcf33,0x10d));var _0x3cf3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcf33[_0x502c7d];return _0x30b7ed;};'use strict';var MailMessageEvents=require(_0x3cf3('0x0'));var events=[_0x3cf3('0x1'),_0x3cf3('0x2'),_0x3cf3('0x3')];function createListener(_0x4efc26,_0x3cdbd7){return function(_0x4e9a39){_0x3cdbd7[_0x3cf3('0x4')](_0x4efc26,_0x4e9a39);};}function removeListener(_0x285a6b,_0xedf347){return function(){MailMessageEvents['removeListener'](_0x285a6b,_0xedf347);};}exports[_0x3cf3('0x5')]=function(_0x15fe57){for(var _0x4b03a1=0x0,_0x119edb=events[_0x3cf3('0x6')];_0x4b03a1<_0x119edb;_0x4b03a1++){var _0x508ebc=events[_0x4b03a1];var _0x404308=createListener('mailMessage:'+_0x508ebc,_0x15fe57);MailMessageEvents['on'](_0x508ebc,_0x404308);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 2cfe1aa..c35281f 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 _0x8877=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf45d60,_0x1687dc){var _0x4c8873=function(_0x16b62e){while(--_0x16b62e){_0xf45d60['push'](_0xf45d60['shift']());}};_0x4c8873(++_0x1687dc);}(_0x8877,0x1e8));var _0x7887=function(_0x458cc9,_0x339c9c){_0x458cc9=_0x458cc9-0x0;var _0x2ed851=_0x8877[_0x458cc9];return _0x2ed851;};'use strict';var multer=require('multer');var util=require(_0x7887('0x0'));var path=require('path');var timeout=require(_0x7887('0x1'));var express=require(_0x7887('0x2'));var router=express[_0x7887('0x3')]();var fs_extra=require(_0x7887('0x4'));var auth=require(_0x7887('0x5'));var interaction=require(_0x7887('0x6'));var config=require(_0x7887('0x7'));var controller=require('./mailQueue.controller');router[_0x7887('0x8')]('/',auth[_0x7887('0x9')](),controller[_0x7887('0xa')]);router[_0x7887('0x8')](_0x7887('0xb'),auth[_0x7887('0x9')](),controller[_0x7887('0xc')]);router[_0x7887('0x8')](_0x7887('0xd'),auth[_0x7887('0x9')](),controller[_0x7887('0xe')]);router[_0x7887('0x8')](_0x7887('0xf'),auth[_0x7887('0x9')](),controller['getMembers']);router[_0x7887('0x8')](_0x7887('0x10'),auth[_0x7887('0x9')](),controller[_0x7887('0x11')]);router[_0x7887('0x8')](_0x7887('0x12'),auth['isAuthenticated'](),controller[_0x7887('0x13')]);router[_0x7887('0x14')]('/',auth[_0x7887('0x9')](),controller[_0x7887('0x15')]);router[_0x7887('0x14')](_0x7887('0x10'),auth[_0x7887('0x9')](),controller[_0x7887('0x16')]);router['post'](_0x7887('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x7887('0xd'),auth[_0x7887('0x9')](),controller[_0x7887('0x17')]);router[_0x7887('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7887('0x18')](_0x7887('0x10'),auth[_0x7887('0x9')](),controller['removeTeams']);router[_0x7887('0x18')](_0x7887('0x12'),auth['isAuthenticated'](),controller[_0x7887('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa781=['Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x2b7df8,_0x2f1cd0){var _0x5b8b3d=function(_0xeffb26){while(--_0xeffb26){_0x2b7df8['push'](_0x2b7df8['shift']());}};_0x5b8b3d(++_0x2f1cd0);}(_0xa781,0x1cc));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1a78('0x0'));var util=require(_0x1a78('0x1'));var path=require(_0x1a78('0x2'));var timeout=require(_0x1a78('0x3'));var express=require(_0x1a78('0x4'));var router=express[_0x1a78('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a78('0x6'));var config=require(_0x1a78('0x7'));var controller=require(_0x1a78('0x8'));router[_0x1a78('0x9')]('/',auth[_0x1a78('0xa')](),controller[_0x1a78('0xb')]);router[_0x1a78('0x9')]('/describe',auth[_0x1a78('0xa')](),controller[_0x1a78('0xc')]);router[_0x1a78('0x9')](_0x1a78('0xd'),auth[_0x1a78('0xa')](),controller[_0x1a78('0xe')]);router['get']('/:id/members',auth[_0x1a78('0xa')](),controller[_0x1a78('0xf')]);router[_0x1a78('0x9')]('/:id/teams',auth[_0x1a78('0xa')](),controller[_0x1a78('0x10')]);router[_0x1a78('0x9')](_0x1a78('0x11'),auth[_0x1a78('0xa')](),controller[_0x1a78('0x12')]);router['post']('/',auth[_0x1a78('0xa')](),controller[_0x1a78('0x13')]);router[_0x1a78('0x14')](_0x1a78('0x15'),auth['isAuthenticated'](),controller[_0x1a78('0x16')]);router[_0x1a78('0x14')](_0x1a78('0x11'),auth[_0x1a78('0xa')](),controller[_0x1a78('0x17')]);router[_0x1a78('0x18')](_0x1a78('0xd'),auth[_0x1a78('0xa')](),controller[_0x1a78('0x19')]);router['delete'](_0x1a78('0xd'),auth[_0x1a78('0xa')](),controller[_0x1a78('0x1a')]);router[_0x1a78('0x1b')](_0x1a78('0x15'),auth[_0x1a78('0xa')](),controller[_0x1a78('0x1c')]);router[_0x1a78('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x1a78('0x1d')]);module[_0x1a78('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f64ffa4..9867840 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 _0x7a71=['roundrobin','sequelize','STRING','INTEGER'];(function(_0x2ac25e,_0x564c19){var _0x11ba31=function(_0x293c0d){while(--_0x293c0d){_0x2ac25e['push'](_0x2ac25e['shift']());}};_0x11ba31(++_0x564c19);}(_0x7a71,0x6d));var _0x17a7=function(_0xb99305,_0x1bc9d1){_0xb99305=_0xb99305-0x0;var _0x3cb356=_0x7a71[_0xb99305];return _0x3cb356;};'use strict';var Sequelize=require(_0x17a7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x17a7('0x1')]},'timeout':{'type':Sequelize[_0x17a7('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x17a7('0x3'))}}; \ No newline at end of file +var _0x24da=['rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x12781,_0x5e49b5){var _0x5a88db=function(_0x35f86e){while(--_0x35f86e){_0x12781['push'](_0x12781['shift']());}};_0x5a88db(++_0x5e49b5);}(_0x24da,0x86));var _0xa24d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x24da[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module[_0xa24d('0x0')]={'name':{'type':Sequelize[_0xa24d('0x1')],'unique':_0xa24d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa24d('0x1')]},'timeout':{'type':Sequelize[_0xa24d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa24d('0x4'),_0xa24d('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 395364b..0874fba 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 _0xb48d=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','then','get','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','MailQueue','includeAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','hasOwnProperty','MailQueueId','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','findOne','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x519954,_0x1a47aa){var _0x4e17e0=function(_0x339a40){while(--_0x339a40){_0x519954['push'](_0x519954['shift']());}};_0x4e17e0(++_0x1a47aa);}(_0xb48d,0x194));var _0xdb48=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb48d[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require(_0xdb48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb48('0x2'));var moment=require(_0xdb48('0x3'));var BPromise=require(_0xdb48('0x4'));var Mustache=require(_0xdb48('0x5'));var util=require('util');var path=require(_0xdb48('0x6'));var sox=require('sox');var csv=require(_0xdb48('0x7'));var ejs=require(_0xdb48('0x8'));var fs=require('fs');var fs_extra=require(_0xdb48('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb48('0xa'));var jsforce=require(_0xdb48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb48('0x7'));var querystring=require(_0xdb48('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb48('0xd'));var authService=require(_0xdb48('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb48('0xf'));var logger=require(_0xdb48('0x10'))(_0xdb48('0x11'));var utils=require('../../config/utils');var config=require(_0xdb48('0x12'));var licenseUtil=require(_0xdb48('0x13'));var db=require('../../mysqldb')['db'];config[_0xdb48('0x14')]=_[_0xdb48('0x15')](config[_0xdb48('0x14')],{'host':_0xdb48('0x16'),'port':0x18eb});var socket=require(_0xdb48('0x17'))(new Redis(config[_0xdb48('0x14')]));require('./mailQueue.socket')[_0xdb48('0x18')](socket);function respondWithStatusCode(_0x142eaf,_0x33c327){_0x33c327=_0x33c327||0xcc;return function(_0x4ae67f){if(_0x4ae67f){return _0x142eaf[_0xdb48('0x19')](_0x33c327);}return _0x142eaf['status'](_0x33c327)[_0xdb48('0x1a')]();};}function respondWithResult(_0x3180d7,_0x364e57){_0x364e57=_0x364e57||0xc8;return function(_0x3531cb){if(_0x3531cb){return _0x3180d7[_0xdb48('0x1b')](_0x364e57)['json'](_0x3531cb);}};}function respondWithFilteredResult(_0x488997,_0x3c646f){return function(_0x38099a){if(_0x38099a){var _0x4a2d3f=typeof _0x3c646f[_0xdb48('0x1c')]===_0xdb48('0x1d')&&typeof _0x3c646f['limit']==='undefined';var _0x1432a9=_0x38099a[_0xdb48('0x1e')];var _0x370f5b=_0x4a2d3f?0x0:_0x3c646f['offset'];var _0x287ddd=_0x4a2d3f?_0x38099a[_0xdb48('0x1e')]:_0x3c646f['offset']+_0x3c646f[_0xdb48('0x1f')];var _0x3fb75a;if(_0x287ddd>=_0x1432a9){_0x287ddd=_0x1432a9;_0x3fb75a=0xc8;}else{_0x3fb75a=0xce;}_0x488997[_0xdb48('0x1b')](_0x3fb75a);return _0x488997[_0xdb48('0x20')](_0xdb48('0x21'),_0x370f5b+'-'+_0x287ddd+'/'+_0x1432a9)['json'](_0x38099a);}return null;};}function patchUpdates(_0x2746c4){return function(_0x465d95){try{jsonpatch[_0xdb48('0x22')](_0x465d95,_0x2746c4,!![]);}catch(_0x5a33a0){return BPromise['reject'](_0x5a33a0);}return _0x465d95['save']();};}function saveUpdates(_0x3ad23a,_0x3cdbbd){return function(_0x1b4fc7){if(_0x1b4fc7){return _0x1b4fc7['update'](_0x3ad23a)[_0xdb48('0x23')](function(_0x4d29d1){return _0x4d29d1;});}return null;};}function removeEntity(_0x3b3344,_0x3a5bdd){return function(_0x161e7f){if(_0x161e7f){return _0x161e7f['destroy']()['then'](function(){var _0x139139=_0x161e7f[_0xdb48('0x24')]({'plain':!![]});var _0xf473a0='MailQueues';return db[_0xdb48('0x25')][_0xdb48('0x26')]({'where':{'type':_0xf473a0,'resourceId':_0x139139['id']}})['then'](function(){return _0x161e7f;});})['then'](function(){_0x3b3344[_0xdb48('0x1b')](0xcc)[_0xdb48('0x1a')]();});}};}function handleEntityNotFound(_0x2adb1e,_0x2f55c6){return function(_0x549b18){if(!_0x549b18){_0x2adb1e[_0xdb48('0x19')](0x194);}return _0x549b18;};}function handleError(_0x2b3bb6,_0x25d2c8){_0x25d2c8=_0x25d2c8||0x1f4;return function(_0x560ad6){logger[_0xdb48('0x27')](_0x560ad6[_0xdb48('0x28')]);if(_0x560ad6[_0xdb48('0x29')]){delete _0x560ad6[_0xdb48('0x29')];}_0x2b3bb6[_0xdb48('0x1b')](_0x25d2c8)[_0xdb48('0x2a')](_0x560ad6);};}exports['index']=function(_0x3f0ad1,_0x1fd8a0){var _0x1a9385={},_0x63201d={},_0x27371a={'count':0x0,'rows':[]};var _0x387182=_['map'](db['MailQueue'][_0xdb48('0x2b')],function(_0xc26449){return{'name':_0xc26449[_0xdb48('0x2c')],'type':_0xc26449[_0xdb48('0x2d')][_0xdb48('0x2e')]};});_0x63201d[_0xdb48('0x2f')]=_[_0xdb48('0x30')](_0x387182,_0xdb48('0x29'));_0x63201d[_0xdb48('0x31')]=_['keys'](_0x3f0ad1[_0xdb48('0x31')]);_0x63201d[_0xdb48('0x32')]=_[_0xdb48('0x33')](_0x63201d[_0xdb48('0x2f')],_0x63201d['query']);_0x1a9385['attributes']=_[_0xdb48('0x33')](_0x63201d[_0xdb48('0x2f')],qs[_0xdb48('0x34')](_0x3f0ad1[_0xdb48('0x31')][_0xdb48('0x34')]));_0x1a9385[_0xdb48('0x35')]=_0x1a9385[_0xdb48('0x35')][_0xdb48('0x36')]?_0x1a9385['attributes']:_0x63201d['model'];if(!_0x3f0ad1[_0xdb48('0x31')]['hasOwnProperty'](_0xdb48('0x37'))){_0x1a9385[_0xdb48('0x1f')]=qs[_0xdb48('0x1f')](_0x3f0ad1[_0xdb48('0x31')][_0xdb48('0x1f')]);_0x1a9385[_0xdb48('0x1c')]=qs[_0xdb48('0x1c')](_0x3f0ad1[_0xdb48('0x31')]['offset']);}_0x1a9385[_0xdb48('0x38')]=qs[_0xdb48('0x39')](_0x3f0ad1['query'][_0xdb48('0x39')]);_0x1a9385[_0xdb48('0x3a')]=qs[_0xdb48('0x32')](_[_0xdb48('0x3b')](_0x3f0ad1['query'],_0x63201d['filters']),_0x387182);if(_0x3f0ad1[_0xdb48('0x31')][_0xdb48('0x3c')]){_0x1a9385['where']=_['merge'](_0x1a9385[_0xdb48('0x3a')],{'$or':_[_0xdb48('0x30')](_0x387182,function(_0xb6a8e8){if(_0xb6a8e8[_0xdb48('0x2d')]!=='VIRTUAL'){var _0x4c6916={};_0x4c6916[_0xb6a8e8[_0xdb48('0x29')]]={'$like':'%'+_0x3f0ad1[_0xdb48('0x31')][_0xdb48('0x3c')]+'%'};return _0x4c6916;}})});}_0x1a9385=_[_0xdb48('0x3d')]({},_0x1a9385,_0x3f0ad1[_0xdb48('0x3e')]);var _0x2a6ab0={'where':_0x1a9385[_0xdb48('0x3a')]};return db[_0xdb48('0x3f')][_0xdb48('0x1e')](_0x2a6ab0)['then'](function(_0x3accdb){_0x27371a[_0xdb48('0x1e')]=_0x3accdb;if(_0x3f0ad1['query'][_0xdb48('0x40')]){_0x1a9385['include']=[{'all':!![]}];}return db[_0xdb48('0x3f')]['findAll'](_0x1a9385);})[_0xdb48('0x23')](function(_0x114121){_0x27371a[_0xdb48('0x41')]=_0x114121;return _0x27371a;})[_0xdb48('0x23')](respondWithFilteredResult(_0x1fd8a0,_0x1a9385))[_0xdb48('0x42')](handleError(_0x1fd8a0,null));};exports[_0xdb48('0x43')]=function(_0x28cd41,_0x33f324){var _0x44c22b={'raw':!![],'where':{'id':_0x28cd41[_0xdb48('0x44')]['id']}},_0x282c09={};_0x282c09[_0xdb48('0x2f')]=_[_0xdb48('0x45')](db[_0xdb48('0x3f')][_0xdb48('0x2b')]);_0x282c09[_0xdb48('0x31')]=_[_0xdb48('0x45')](_0x28cd41[_0xdb48('0x31')]);_0x282c09[_0xdb48('0x32')]=_['intersection'](_0x282c09['model'],_0x282c09[_0xdb48('0x31')]);_0x44c22b[_0xdb48('0x35')]=_[_0xdb48('0x33')](_0x282c09['model'],qs[_0xdb48('0x34')](_0x28cd41[_0xdb48('0x31')][_0xdb48('0x34')]));_0x44c22b[_0xdb48('0x35')]=_0x44c22b[_0xdb48('0x35')]['length']?_0x44c22b[_0xdb48('0x35')]:_0x282c09['model'];if(_0x28cd41[_0xdb48('0x31')][_0xdb48('0x40')]){_0x44c22b[_0xdb48('0x46')]=[{'all':!![]}];}_0x44c22b=_[_0xdb48('0x3d')]({},_0x44c22b,_0x28cd41['options']);return db[_0xdb48('0x3f')]['find'](_0x44c22b)[_0xdb48('0x23')](handleEntityNotFound(_0x33f324,null))[_0xdb48('0x23')](respondWithResult(_0x33f324,null))[_0xdb48('0x42')](handleError(_0x33f324,null));};exports[_0xdb48('0x47')]=function(_0x388d5d,_0x40ec47){return db[_0xdb48('0x3f')][_0xdb48('0x47')](_0x388d5d[_0xdb48('0x48')],{})[_0xdb48('0x23')](function(_0x4b5cc7){var _0x4b689a=_0x388d5d[_0xdb48('0x49')][_0xdb48('0x24')]({'plain':!![]});if(!_0x4b689a)throw new Error(_0xdb48('0x4a'));if(_0x4b689a[_0xdb48('0x4b')]==='user'){var _0x5c9b2d=_0x4b5cc7['get']({'plain':!![]});var _0x3d3500=_0xdb48('0x4c');return db[_0xdb48('0x4d')]['find']({'where':{'name':_0x3d3500,'userProfileId':_0x4b689a[_0xdb48('0x4e')]},'raw':!![]})['then'](function(_0x255d47){if(_0x255d47&&_0x255d47[_0xdb48('0x4f')]===0x0){return db[_0xdb48('0x25')]['create']({'name':_0x5c9b2d['name'],'resourceId':_0x5c9b2d['id'],'type':_0x255d47[_0xdb48('0x29')],'sectionId':_0x255d47['id']},{})[_0xdb48('0x23')](function(){return _0x4b5cc7;});}else{return _0x4b5cc7;}})[_0xdb48('0x42')](function(_0xe5c337){logger['error'](_0xdb48('0x50'),_0xe5c337);throw _0xe5c337;});}return _0x4b5cc7;})[_0xdb48('0x23')](respondWithResult(_0x40ec47,0xc9))[_0xdb48('0x42')](handleError(_0x40ec47,null));};exports[_0xdb48('0x51')]=function(_0x1c8bc8,_0x18797c){if(_0x1c8bc8[_0xdb48('0x48')]['id']){delete _0x1c8bc8['body']['id'];}return db['MailQueue'][_0xdb48('0x52')]({'where':{'id':_0x1c8bc8[_0xdb48('0x44')]['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x18797c,null))[_0xdb48('0x23')](saveUpdates(_0x1c8bc8['body'],null))[_0xdb48('0x23')](respondWithResult(_0x18797c,null))[_0xdb48('0x42')](handleError(_0x18797c,null));};exports['destroy']=function(_0x54da00,_0x2a1ca6){return db[_0xdb48('0x3f')]['find']({'where':{'id':_0x54da00['params']['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x2a1ca6,null))[_0xdb48('0x23')](removeEntity(_0x2a1ca6,null))['catch'](handleError(_0x2a1ca6,null));};exports[_0xdb48('0x53')]=function(_0x1e61ca,_0x2def82){return db[_0xdb48('0x3f')][_0xdb48('0x53')]()['then'](respondWithResult(_0x2def82,null))['catch'](handleError(_0x2def82,null));};exports['getMembers']=function(_0x8c092a,_0x3dda78,_0x281792){var _0x57db60={'raw':!![],'where':{}},_0x14790b={},_0x2d9866;return db[_0xdb48('0x3f')]['findOne']({'where':{'id':_0x8c092a[_0xdb48('0x44')]['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x3dda78,null))[_0xdb48('0x23')](function(_0x1fa64a){if(_0x1fa64a){_0x2d9866=_0x1fa64a[_0xdb48('0x24')]({'plain':!![]});_0x14790b[_0xdb48('0x2f')]=_[_0xdb48('0x45')](db['UserMailQueue']['rawAttributes']);_0x14790b['query']=_[_0xdb48('0x45')](_0x8c092a[_0xdb48('0x31')]);_0x14790b[_0xdb48('0x32')]=_['intersection'](_0x14790b[_0xdb48('0x2f')],_0x14790b['query']);_0x57db60[_0xdb48('0x35')]=_['intersection'](_0x14790b[_0xdb48('0x2f')],qs[_0xdb48('0x34')](_0x8c092a['query']['fields']));_0x57db60[_0xdb48('0x35')]=_0x57db60[_0xdb48('0x35')][_0xdb48('0x36')]?_0x57db60[_0xdb48('0x35')]:_0x14790b[_0xdb48('0x2f')];if(!_0x8c092a[_0xdb48('0x31')][_0xdb48('0x54')](_0xdb48('0x37'))){_0x57db60['limit']=qs[_0xdb48('0x1f')](_0x8c092a[_0xdb48('0x31')][_0xdb48('0x1f')]);_0x57db60[_0xdb48('0x1c')]=qs[_0xdb48('0x1c')](_0x8c092a[_0xdb48('0x31')][_0xdb48('0x1c')]);}_0x57db60['order']=qs['sort'](_0x8c092a[_0xdb48('0x31')][_0xdb48('0x39')]);_0x57db60[_0xdb48('0x3a')]=qs[_0xdb48('0x32')](_[_0xdb48('0x3b')](_0x8c092a[_0xdb48('0x31')],_0x14790b[_0xdb48('0x32')]));_0x57db60['where'][_0xdb48('0x55')]=_0x1fa64a['id'];if(_0x8c092a[_0xdb48('0x31')]['filter']){_0x57db60[_0xdb48('0x3a')]=_[_0xdb48('0x3d')](_0x57db60[_0xdb48('0x3a')],{'$or':_[_0xdb48('0x30')](_0x57db60[_0xdb48('0x35')],function(_0x1cbe8d){var _0x52b9af={};_0x52b9af[_0x1cbe8d]={'$like':'%'+_0x8c092a[_0xdb48('0x31')][_0xdb48('0x3c')]+'%'};return _0x52b9af;})});}_0x57db60=_[_0xdb48('0x3d')]({},_0x57db60,_0x8c092a['options']);return db[_0xdb48('0x56')][_0xdb48('0x57')](_0x57db60);}})[_0xdb48('0x23')](function(_0x3b9462){if(_0x3b9462){return db[_0xdb48('0x58')][_0xdb48('0x59')]({'where':{'id':_[_0xdb48('0x30')](_0x3b9462,_0xdb48('0x5a')),'role':_0xdb48('0x5b')},'attributes':['id',_0xdb48('0x29'),_0xdb48('0x5c'),_0xdb48('0x5d'),_0xdb48('0x5e')]});}})[_0xdb48('0x23')](function(_0x4ea810){if(_0x4ea810){return{'count':_0x4ea810[_0xdb48('0x1e')],'rows':_['map'](_0x4ea810[_0xdb48('0x41')],function(_0x40c8be){return{'membername':_0x40c8be['name'],'UserId':_0x40c8be['id'],'queue_name':_0x2d9866[_0xdb48('0x29')],'MailQueueId':_0x2d9866['id'],'interface':util[_0xdb48('0x5f')](_0xdb48('0x60'),_0xdb48('0x61'),_0x40c8be['name']),'penalty':0x0,'paused':_0x40c8be['mailPause'],'createdAt':_0x40c8be[_0xdb48('0x5e')],'updatedAt':_0x40c8be['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdb48('0x23')](respondWithFilteredResult(_0x3dda78,_0x57db60))[_0xdb48('0x42')](handleError(_0x3dda78,null));};exports[_0xdb48('0x62')]=function(_0x2dead5,_0x4d9e43,_0x37574f){var _0x1a434d={};var _0x3b6687={};var _0x57a1e4;var _0x199273;return db[_0xdb48('0x3f')]['findOne']({'where':{'id':_0x2dead5['params']['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x4d9e43,null))[_0xdb48('0x23')](function(_0x33db5f){if(_0x33db5f){_0x57a1e4=_0x33db5f;_0x3b6687[_0xdb48('0x2f')]=_[_0xdb48('0x45')](db[_0xdb48('0x63')][_0xdb48('0x2b')]);_0x3b6687[_0xdb48('0x31')]=_[_0xdb48('0x45')](_0x2dead5[_0xdb48('0x31')]);_0x3b6687['filters']=_[_0xdb48('0x33')](_0x3b6687[_0xdb48('0x2f')],_0x3b6687[_0xdb48('0x31')]);_0x1a434d[_0xdb48('0x35')]=_[_0xdb48('0x33')](_0x3b6687[_0xdb48('0x2f')],qs['fields'](_0x2dead5['query'][_0xdb48('0x34')]));_0x1a434d[_0xdb48('0x35')]=_0x1a434d[_0xdb48('0x35')][_0xdb48('0x36')]?_0x1a434d[_0xdb48('0x35')]:_0x3b6687['model'];_0x1a434d[_0xdb48('0x38')]=qs[_0xdb48('0x39')](_0x2dead5['query']['sort']);_0x1a434d[_0xdb48('0x3a')]=qs[_0xdb48('0x32')](_[_0xdb48('0x3b')](_0x2dead5[_0xdb48('0x31')],_0x3b6687[_0xdb48('0x32')]));if(_0x2dead5['query'][_0xdb48('0x3c')]){_0x1a434d[_0xdb48('0x3a')]=_[_0xdb48('0x3d')](_0x1a434d[_0xdb48('0x3a')],{'$or':_['map'](_0x1a434d[_0xdb48('0x35')],function(_0x15ae08){var _0x364b60={};_0x364b60[_0x15ae08]={'$like':'%'+_0x2dead5[_0xdb48('0x31')][_0xdb48('0x3c')]+'%'};return _0x364b60;})});}_0x1a434d=_['merge']({},_0x1a434d,_0x2dead5[_0xdb48('0x3e')]);return _0x57a1e4[_0xdb48('0x62')](_0x1a434d);}})[_0xdb48('0x23')](function(_0x2c95a2){if(_0x2c95a2){_0x199273=_0x2c95a2[_0xdb48('0x36')];if(!_0x2dead5[_0xdb48('0x31')]['hasOwnProperty'](_0xdb48('0x37'))){_0x1a434d['limit']=qs[_0xdb48('0x1f')](_0x2dead5['query'][_0xdb48('0x1f')]);_0x1a434d[_0xdb48('0x1c')]=qs['offset'](_0x2dead5[_0xdb48('0x31')][_0xdb48('0x1c')]);}return _0x57a1e4[_0xdb48('0x62')](_0x1a434d);}})[_0xdb48('0x23')](function(_0x5dcfd0){if(_0x5dcfd0){return _0x5dcfd0?{'count':_0x199273,'rows':_0x5dcfd0}:null;}})[_0xdb48('0x23')](respondWithResult(_0x4d9e43,null))[_0xdb48('0x42')](handleError(_0x4d9e43,null));};exports[_0xdb48('0x64')]=function(_0x3ca08b,_0x3e04a5,_0x381845){var _0x4136b0=_0x3ca08b[_0xdb48('0x48')]['ids'];return db[_0xdb48('0x63')][_0xdb48('0x57')]({'where':{'id':_0x4136b0},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdb48('0x65'),'attributes':['id',_0xdb48('0x29'),'online','voicePause',_0xdb48('0x66')],'raw':!![]}]})['then'](function(_0xa97d2b){if(_0xa97d2b){var _0x585bc6=_[_0xdb48('0x67')](_0xa97d2b,function(_0x22d66a){var _0x1344e4=_0x22d66a[_0xdb48('0x24')]({'plain':!![]});return _0x1344e4['Agents'];});return db['MailQueue'][_0xdb48('0x52')]({'where':{'id':_0x3ca08b['params']['id']}})[_0xdb48('0x23')](function(_0x337ce7){return db[_0xdb48('0x68')][_0xdb48('0x69')](function(_0x14f634){return _0x337ce7['addTeams'](_0x4136b0,{'transaction':_0x14f634})['then'](function(){return BPromise[_0xdb48('0x6a')](_0x585bc6,function(_0x101615){return db[_0xdb48('0x56')][_0xdb48('0x6b')]({'where':{'UserId':_0x101615['id'],'MailQueueId':_0x3ca08b[_0xdb48('0x44')]['id']},'transaction':_0x14f634});});})['then'](function(){_0x585bc6[_0xdb48('0x6c')](function(_0x1a8f48){socket['emit'](_0xdb48('0x6d'),{'UserId':_0x1a8f48['id'],'MailQueueId':_0x337ce7['id']});});});});});}})[_0xdb48('0x23')](respondWithStatusCode(_0x3e04a5,null))['catch'](handleError(_0x3e04a5,null));};exports[_0xdb48('0x6e')]=function(_0x5ab026,_0x4c393f,_0x3a4252){return db[_0xdb48('0x63')][_0xdb48('0x57')]({'where':{'id':_0x5ab026['query'][_0xdb48('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xdb48('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c393f,null))[_0xdb48('0x23')](function(_0x160f25){var _0x545fdd=_[_0xdb48('0x30')](_0x160f25,'id');var _0x4f414a=[];var _0x68e20f=[];var _0x1e54d5=squel['select']();_0x1e54d5[_0xdb48('0x70')](_0xdb48('0x71'))['from'](_0xdb48('0x72'),'tq')[_0xdb48('0x73')](_0xdb48('0x74'),'ut',_0xdb48('0x75'))['where'](_0xdb48('0x76'),_0x5ab026[_0xdb48('0x44')]['id']);for(var _0x499cf3=0x0;_0x499cf3<_0x160f25[_0xdb48('0x36')];_0x499cf3+=0x1){let _0x3026a0=_0x160f25[_0x499cf3];for(var _0x310810=0x0;_0x310810<_0x3026a0[_0xdb48('0x65')]['length'];_0x310810+=0x1){let _0x517e22=_0x3026a0[_0xdb48('0x65')][_0x310810];var _0x137010=_0x1e54d5[_0xdb48('0x77')]();_0x137010['where'](_0xdb48('0x78'),_0x517e22['id']);_0x68e20f['push'](db['sequelize'][_0xdb48('0x31')](_0x137010['toString'](),{'type':db[_0xdb48('0x68')][_0xdb48('0x79')][_0xdb48('0x7a')]})[_0xdb48('0x23')](function(_0x3d32b6){if(_0x3d32b6[_0xdb48('0x36')]===0x1){return _0x517e22['id'];}else{var _0x17155c=_[_0xdb48('0x7b')](_['map'](_0x3d32b6,_0xdb48('0x7c')),function(_0xc68157){return _[_0xdb48('0x7d')](_0x545fdd,_0xc68157);});if(_0x17155c){return _0x517e22['id'];}}}));}}return BPromise[_0xdb48('0x7e')](_0x68e20f)[_0xdb48('0x23')](function(_0xe68c7f){_0x4f414a=_(_0x4f414a)[_0xdb48('0x7f')](_0xe68c7f)[_0xdb48('0x80')]()[_0xdb48('0x81')]();return db[_0xdb48('0x3f')][_0xdb48('0x52')]({'where':{'id':_0x5ab026[_0xdb48('0x44')]['id']}})[_0xdb48('0x23')](function(_0xbd7f1){return db[_0xdb48('0x68')][_0xdb48('0x69')](function(_0x3a4df0){return _0xbd7f1['removeTeams'](_0x5ab026[_0xdb48('0x31')]['ids'],{'transaction':_0x3a4df0})['then'](function(){if(!_['isEmpty'](_0x4f414a)){return _0xbd7f1[_0xdb48('0x82')](_0x4f414a,{'transaction':_0x3a4df0});}})[_0xdb48('0x23')](function(){_0x4f414a['forEach'](function(_0x38e951){socket[_0xdb48('0x83')](_0xdb48('0x84'),{'UserId':_0x38e951,'MailQueueId':_0xbd7f1['id']});});});});});});})[_0xdb48('0x23')](respondWithStatusCode(_0x4c393f,null))[_0xdb48('0x42')](handleError(_0x4c393f,null));};exports[_0xdb48('0x85')]=function(_0x19f54d,_0x376bc0,_0x4b8527){return db[_0xdb48('0x3f')][_0xdb48('0x52')]({'where':{'id':_0x19f54d[_0xdb48('0x44')]['id']}})['then'](handleEntityNotFound(_0x376bc0,null))[_0xdb48('0x23')](function(_0x597e38){if(_0x597e38){return _0x597e38[_0xdb48('0x85')](_0x19f54d['body']['ids'],_['omit'](_0x19f54d[_0xdb48('0x48')],[_0xdb48('0x6f'),'id'])||{})[_0xdb48('0x86')](function(_0x1d9cbc){for(var _0x21f253=0x0;_0x21f253<_0x19f54d[_0xdb48('0x48')][_0xdb48('0x6f')]['length'];_0x21f253+=0x1){socket[_0xdb48('0x83')](_0xdb48('0x6d'),{'UserId':Number(_0x19f54d[_0xdb48('0x48')][_0xdb48('0x6f')][_0x21f253]),'MailQueueId':Number(_0x19f54d[_0xdb48('0x44')]['id'])});}return _0x1d9cbc;});}})[_0xdb48('0x23')](respondWithResult(_0x376bc0,null))[_0xdb48('0x42')](handleError(_0x376bc0,null));};exports[_0xdb48('0x82')]=function(_0x88b1ed,_0x74036d,_0x12053b){return db[_0xdb48('0x3f')][_0xdb48('0x52')]({'where':{'id':_0x88b1ed[_0xdb48('0x44')]['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x74036d,null))[_0xdb48('0x23')](function(_0x5ac69d){if(_0x5ac69d){return _0x5ac69d[_0xdb48('0x82')](_0x88b1ed[_0xdb48('0x31')]['ids'])[_0xdb48('0x23')](function(){if(_[_0xdb48('0x87')](_0x88b1ed[_0xdb48('0x31')][_0xdb48('0x6f')])){for(var _0x5e6549=0x0;_0x5e6549<_0x88b1ed['query']['ids'][_0xdb48('0x36')];_0x5e6549+=0x1){socket[_0xdb48('0x83')](_0xdb48('0x84'),{'UserId':Number(_0x88b1ed[_0xdb48('0x31')][_0xdb48('0x6f')][_0x5e6549]),'MailQueueId':Number(_0x88b1ed['params']['id'])});}}else{socket['emit'](_0xdb48('0x84'),{'UserId':Number(_0x88b1ed[_0xdb48('0x31')]['ids']),'MailQueueId':Number(_0x88b1ed['params']['id'])});}});}})[_0xdb48('0x23')](respondWithStatusCode(_0x74036d,null))[_0xdb48('0x42')](handleError(_0x74036d,null));};exports['getAgents']=function(_0x436828,_0x27ef67,_0xd188ab){var _0x59f5a9={};var _0x175aa0={};var _0x319c0c;var _0x1d2251;return db[_0xdb48('0x3f')][_0xdb48('0x88')]({'where':{'id':_0x436828[_0xdb48('0x44')]['id']}})[_0xdb48('0x23')](handleEntityNotFound(_0x27ef67,null))[_0xdb48('0x23')](function(_0x19d7d0){if(_0x19d7d0){_0x319c0c=_0x19d7d0;_0x175aa0[_0xdb48('0x2f')]=_[_0xdb48('0x45')](db[_0xdb48('0x58')][_0xdb48('0x2b')]);_0x175aa0[_0xdb48('0x31')]=_[_0xdb48('0x45')](_0x436828[_0xdb48('0x31')]);_0x175aa0[_0xdb48('0x32')]=_[_0xdb48('0x33')](_0x175aa0[_0xdb48('0x2f')],_0x175aa0['query']);_0x59f5a9['attributes']=_['intersection'](_0x175aa0[_0xdb48('0x2f')],qs[_0xdb48('0x34')](_0x436828['query']['fields']));_0x59f5a9[_0xdb48('0x35')]=_0x59f5a9['attributes'][_0xdb48('0x36')]?_0x59f5a9[_0xdb48('0x35')]:_0x175aa0[_0xdb48('0x2f')];_0x59f5a9[_0xdb48('0x38')]=qs[_0xdb48('0x39')](_0x436828[_0xdb48('0x31')]['sort']);_0x59f5a9['where']=qs['filters'](_[_0xdb48('0x3b')](_0x436828[_0xdb48('0x31')],_0x175aa0['filters']));if(_0x436828[_0xdb48('0x31')][_0xdb48('0x3c')]){_0x59f5a9['where']=_[_0xdb48('0x3d')](_0x59f5a9[_0xdb48('0x3a')],{'$or':_[_0xdb48('0x30')](_0x59f5a9[_0xdb48('0x35')],function(_0x4d1f59){var _0x391147={};_0x391147[_0x4d1f59]={'$like':'%'+_0x436828[_0xdb48('0x31')][_0xdb48('0x3c')]+'%'};return _0x391147;})});}_0x59f5a9=_[_0xdb48('0x3d')]({},_0x59f5a9,_0x436828['options']);return _0x319c0c[_0xdb48('0x89')](_0x59f5a9);}})[_0xdb48('0x23')](function(_0x572f8b){if(_0x572f8b){_0x1d2251=_0x572f8b[_0xdb48('0x36')];if(!_0x436828[_0xdb48('0x31')][_0xdb48('0x54')](_0xdb48('0x37'))){_0x59f5a9[_0xdb48('0x1f')]=qs[_0xdb48('0x1f')](_0x436828[_0xdb48('0x31')][_0xdb48('0x1f')]);_0x59f5a9['offset']=qs[_0xdb48('0x1c')](_0x436828['query'][_0xdb48('0x1c')]);}return _0x319c0c[_0xdb48('0x89')](_0x59f5a9);}})[_0xdb48('0x23')](function(_0x5066a8){if(_0x5066a8){return _0x5066a8?{'count':_0x1d2251,'rows':_0x5066a8}:null;}})[_0xdb48('0x23')](respondWithResult(_0x27ef67,null))[_0xdb48('0x42')](handleError(_0x27ef67,null));}; \ No newline at end of file +var _0x5137=['Agents','online','interface','transaction','findOrCreate','forEach','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','value','removeTeams','isEmpty','emit','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','MailQueues','UserProfileResource','stack','name','map','MailQueue','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids'];(function(_0x4da0ed,_0x2f1441){var _0x14cdcc=function(_0x36d5f2){while(--_0x36d5f2){_0x4da0ed['push'](_0x4da0ed['shift']());}};_0x14cdcc(++_0x2f1441);}(_0x5137,0x1c9));var _0x7513=function(_0x3017a1,_0x29c1e4){_0x3017a1=_0x3017a1-0x0;var _0x50c6cf=_0x5137[_0x3017a1];return _0x50c6cf;};'use strict';var emlformat=require(_0x7513('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7513('0x1'));var jsonpatch=require(_0x7513('0x2'));var rp=require('request-promise');var moment=require(_0x7513('0x3'));var BPromise=require(_0x7513('0x4'));var Mustache=require('mustache');var util=require(_0x7513('0x5'));var path=require(_0x7513('0x6'));var sox=require(_0x7513('0x7'));var csv=require(_0x7513('0x8'));var ejs=require(_0x7513('0x9'));var fs=require('fs');var fs_extra=require(_0x7513('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7513('0xb'));var deskjs=require(_0x7513('0xc'));var toCsv=require(_0x7513('0x8'));var querystring=require(_0x7513('0xd'));var Papa=require(_0x7513('0xe'));var Redis=require(_0x7513('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7513('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7513('0x11'));var utils=require(_0x7513('0x12'));var config=require(_0x7513('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7513('0x14'))['db'];config['redis']=_[_0x7513('0x15')](config[_0x7513('0x16')],{'host':_0x7513('0x17'),'port':0x18eb});var socket=require(_0x7513('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x7513('0x19')](socket);function respondWithStatusCode(_0x2c3a05,_0x58e1c4){_0x58e1c4=_0x58e1c4||0xcc;return function(_0x100cc3){if(_0x100cc3){return _0x2c3a05[_0x7513('0x1a')](_0x58e1c4);}return _0x2c3a05['status'](_0x58e1c4)[_0x7513('0x1b')]();};}function respondWithResult(_0x378bed,_0xee245){_0xee245=_0xee245||0xc8;return function(_0x229d3f){if(_0x229d3f){return _0x378bed[_0x7513('0x1c')](_0xee245)[_0x7513('0x1d')](_0x229d3f);}};}function respondWithFilteredResult(_0x2ba981,_0x51b208){return function(_0x53ea5b){if(_0x53ea5b){var _0x3b3eeb=typeof _0x51b208['offset']===_0x7513('0x1e')&&typeof _0x51b208[_0x7513('0x1f')]==='undefined';var _0xe145e1=_0x53ea5b[_0x7513('0x20')];var _0x48c7e9=_0x3b3eeb?0x0:_0x51b208['offset'];var _0x2c791f=_0x3b3eeb?_0x53ea5b[_0x7513('0x20')]:_0x51b208[_0x7513('0x21')]+_0x51b208['limit'];var _0x665a72;if(_0x2c791f>=_0xe145e1){_0x2c791f=_0xe145e1;_0x665a72=0xc8;}else{_0x665a72=0xce;}_0x2ba981[_0x7513('0x1c')](_0x665a72);return _0x2ba981[_0x7513('0x22')](_0x7513('0x23'),_0x48c7e9+'-'+_0x2c791f+'/'+_0xe145e1)[_0x7513('0x1d')](_0x53ea5b);}return null;};}function patchUpdates(_0x1ed012){return function(_0x472557){try{jsonpatch[_0x7513('0x24')](_0x472557,_0x1ed012,!![]);}catch(_0xdb6d87){return BPromise['reject'](_0xdb6d87);}return _0x472557[_0x7513('0x25')]();};}function saveUpdates(_0x30437f,_0x4bfe80){return function(_0x13ee9c){if(_0x13ee9c){return _0x13ee9c[_0x7513('0x26')](_0x30437f)['then'](function(_0x130769){return _0x130769;});}return null;};}function removeEntity(_0x8cb4cc,_0x2cb62d){return function(_0x3e6dca){if(_0x3e6dca){return _0x3e6dca[_0x7513('0x27')]()[_0x7513('0x28')](function(){var _0x200660=_0x3e6dca['get']({'plain':!![]});var _0x2cf5aa=_0x7513('0x29');return db[_0x7513('0x2a')][_0x7513('0x27')]({'where':{'type':_0x2cf5aa,'resourceId':_0x200660['id']}})[_0x7513('0x28')](function(){return _0x3e6dca;});})['then'](function(){_0x8cb4cc['status'](0xcc)[_0x7513('0x1b')]();});}};}function handleEntityNotFound(_0x4cb6f6,_0x1eefc2){return function(_0x2a3950){if(!_0x2a3950){_0x4cb6f6['sendStatus'](0x194);}return _0x2a3950;};}function handleError(_0x594a9d,_0x4b640a){_0x4b640a=_0x4b640a||0x1f4;return function(_0x25d2f4){logger['error'](_0x25d2f4[_0x7513('0x2b')]);if(_0x25d2f4[_0x7513('0x2c')]){delete _0x25d2f4[_0x7513('0x2c')];}_0x594a9d[_0x7513('0x1c')](_0x4b640a)['send'](_0x25d2f4);};}exports['index']=function(_0x50dce2,_0x4b3eb5){var _0x3ecf3e={},_0x1860ce={},_0xc68815={'count':0x0,'rows':[]};var _0x263e1d=_[_0x7513('0x2d')](db[_0x7513('0x2e')]['rawAttributes'],function(_0x929531){return{'name':_0x929531['fieldName'],'type':_0x929531[_0x7513('0x2f')]['key']};});_0x1860ce[_0x7513('0x30')]=_[_0x7513('0x2d')](_0x263e1d,_0x7513('0x2c'));_0x1860ce[_0x7513('0x31')]=_[_0x7513('0x32')](_0x50dce2[_0x7513('0x31')]);_0x1860ce['filters']=_['intersection'](_0x1860ce[_0x7513('0x30')],_0x1860ce[_0x7513('0x31')]);_0x3ecf3e[_0x7513('0x33')]=_[_0x7513('0x34')](_0x1860ce['model'],qs[_0x7513('0x35')](_0x50dce2['query'][_0x7513('0x35')]));_0x3ecf3e[_0x7513('0x33')]=_0x3ecf3e[_0x7513('0x33')][_0x7513('0x36')]?_0x3ecf3e[_0x7513('0x33')]:_0x1860ce[_0x7513('0x30')];if(!_0x50dce2[_0x7513('0x31')][_0x7513('0x37')](_0x7513('0x38'))){_0x3ecf3e[_0x7513('0x1f')]=qs[_0x7513('0x1f')](_0x50dce2[_0x7513('0x31')][_0x7513('0x1f')]);_0x3ecf3e[_0x7513('0x21')]=qs[_0x7513('0x21')](_0x50dce2[_0x7513('0x31')][_0x7513('0x21')]);}_0x3ecf3e[_0x7513('0x39')]=qs['sort'](_0x50dce2[_0x7513('0x31')][_0x7513('0x3a')]);_0x3ecf3e[_0x7513('0x3b')]=qs[_0x7513('0x3c')](_[_0x7513('0x3d')](_0x50dce2['query'],_0x1860ce[_0x7513('0x3c')]),_0x263e1d);if(_0x50dce2[_0x7513('0x31')][_0x7513('0x3e')]){_0x3ecf3e[_0x7513('0x3b')]=_[_0x7513('0x3f')](_0x3ecf3e['where'],{'$or':_[_0x7513('0x2d')](_0x263e1d,function(_0xbc0514){if(_0xbc0514[_0x7513('0x2f')]!==_0x7513('0x40')){var _0x125c0d={};_0x125c0d[_0xbc0514['name']]={'$like':'%'+_0x50dce2[_0x7513('0x31')]['filter']+'%'};return _0x125c0d;}})});}_0x3ecf3e=_[_0x7513('0x3f')]({},_0x3ecf3e,_0x50dce2[_0x7513('0x41')]);var _0x2438e6={'where':_0x3ecf3e[_0x7513('0x3b')]};return db['MailQueue'][_0x7513('0x20')](_0x2438e6)[_0x7513('0x28')](function(_0x1517b5){_0xc68815['count']=_0x1517b5;if(_0x50dce2[_0x7513('0x31')][_0x7513('0x42')]){_0x3ecf3e[_0x7513('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0x7513('0x44')](_0x3ecf3e);})[_0x7513('0x28')](function(_0x12ed9f){_0xc68815[_0x7513('0x45')]=_0x12ed9f;return _0xc68815;})[_0x7513('0x28')](respondWithFilteredResult(_0x4b3eb5,_0x3ecf3e))[_0x7513('0x46')](handleError(_0x4b3eb5,null));};exports[_0x7513('0x47')]=function(_0xe582f0,_0x2ccc3b){var _0x13c58b={'raw':!![],'where':{'id':_0xe582f0[_0x7513('0x48')]['id']}},_0x26f425={};_0x26f425['model']=_[_0x7513('0x32')](db[_0x7513('0x2e')][_0x7513('0x49')]);_0x26f425[_0x7513('0x31')]=_[_0x7513('0x32')](_0xe582f0[_0x7513('0x31')]);_0x26f425[_0x7513('0x3c')]=_[_0x7513('0x34')](_0x26f425['model'],_0x26f425[_0x7513('0x31')]);_0x13c58b[_0x7513('0x33')]=_[_0x7513('0x34')](_0x26f425[_0x7513('0x30')],qs[_0x7513('0x35')](_0xe582f0['query'][_0x7513('0x35')]));_0x13c58b[_0x7513('0x33')]=_0x13c58b[_0x7513('0x33')][_0x7513('0x36')]?_0x13c58b['attributes']:_0x26f425[_0x7513('0x30')];if(_0xe582f0[_0x7513('0x31')][_0x7513('0x42')]){_0x13c58b['include']=[{'all':!![]}];}_0x13c58b=_[_0x7513('0x3f')]({},_0x13c58b,_0xe582f0[_0x7513('0x41')]);return db['MailQueue'][_0x7513('0x4a')](_0x13c58b)[_0x7513('0x28')](handleEntityNotFound(_0x2ccc3b,null))[_0x7513('0x28')](respondWithResult(_0x2ccc3b,null))['catch'](handleError(_0x2ccc3b,null));};exports[_0x7513('0x4b')]=function(_0xaf1d9c,_0x10e2f1){return db['MailQueue']['create'](_0xaf1d9c[_0x7513('0x4c')],{})[_0x7513('0x28')](function(_0x1117b6){var _0x1b3ae3=_0xaf1d9c['user'][_0x7513('0x4d')]({'plain':!![]});if(!_0x1b3ae3)throw new Error(_0x7513('0x4e'));if(_0x1b3ae3['role']===_0x7513('0x4f')){var _0x1e82d3=_0x1117b6[_0x7513('0x4d')]({'plain':!![]});var _0xd66c63='MailQueues';return db[_0x7513('0x50')][_0x7513('0x4a')]({'where':{'name':_0xd66c63,'userProfileId':_0x1b3ae3[_0x7513('0x51')]},'raw':!![]})[_0x7513('0x28')](function(_0x14aa51){if(_0x14aa51&&_0x14aa51[_0x7513('0x52')]===0x0){return db[_0x7513('0x2a')][_0x7513('0x4b')]({'name':_0x1e82d3['name'],'resourceId':_0x1e82d3['id'],'type':_0x14aa51['name'],'sectionId':_0x14aa51['id']},{})['then'](function(){return _0x1117b6;});}else{return _0x1117b6;}})[_0x7513('0x46')](function(_0x271846){logger[_0x7513('0x53')](_0x7513('0x54'),_0x271846);throw _0x271846;});}return _0x1117b6;})[_0x7513('0x28')](respondWithResult(_0x10e2f1,0xc9))[_0x7513('0x46')](handleError(_0x10e2f1,null));};exports[_0x7513('0x26')]=function(_0x27be7b,_0x26d4df){if(_0x27be7b[_0x7513('0x4c')]['id']){delete _0x27be7b['body']['id'];}return db['MailQueue'][_0x7513('0x4a')]({'where':{'id':_0x27be7b[_0x7513('0x48')]['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x26d4df,null))['then'](saveUpdates(_0x27be7b[_0x7513('0x4c')],null))[_0x7513('0x28')](respondWithResult(_0x26d4df,null))['catch'](handleError(_0x26d4df,null));};exports[_0x7513('0x27')]=function(_0x32d76d,_0x31c126){return db['MailQueue'][_0x7513('0x4a')]({'where':{'id':_0x32d76d['params']['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x31c126,null))['then'](removeEntity(_0x31c126,null))[_0x7513('0x46')](handleError(_0x31c126,null));};exports[_0x7513('0x55')]=function(_0x56118a,_0x1c9bf9){return db[_0x7513('0x2e')][_0x7513('0x55')]()[_0x7513('0x28')](respondWithResult(_0x1c9bf9,null))[_0x7513('0x46')](handleError(_0x1c9bf9,null));};exports[_0x7513('0x56')]=function(_0x30465b,_0x1f5b72,_0x2f1776){var _0x469a93={'raw':!![],'where':{}},_0x164896={},_0x4a5209;return db[_0x7513('0x2e')][_0x7513('0x57')]({'where':{'id':_0x30465b[_0x7513('0x48')]['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x1f5b72,null))[_0x7513('0x28')](function(_0x5909e6){if(_0x5909e6){_0x4a5209=_0x5909e6[_0x7513('0x4d')]({'plain':!![]});_0x164896[_0x7513('0x30')]=_[_0x7513('0x32')](db[_0x7513('0x58')][_0x7513('0x49')]);_0x164896[_0x7513('0x31')]=_[_0x7513('0x32')](_0x30465b['query']);_0x164896[_0x7513('0x3c')]=_[_0x7513('0x34')](_0x164896[_0x7513('0x30')],_0x164896['query']);_0x469a93[_0x7513('0x33')]=_['intersection'](_0x164896['model'],qs[_0x7513('0x35')](_0x30465b['query']['fields']));_0x469a93[_0x7513('0x33')]=_0x469a93['attributes'][_0x7513('0x36')]?_0x469a93[_0x7513('0x33')]:_0x164896[_0x7513('0x30')];if(!_0x30465b[_0x7513('0x31')][_0x7513('0x37')]('nolimit')){_0x469a93[_0x7513('0x1f')]=qs[_0x7513('0x1f')](_0x30465b[_0x7513('0x31')][_0x7513('0x1f')]);_0x469a93['offset']=qs[_0x7513('0x21')](_0x30465b['query']['offset']);}_0x469a93[_0x7513('0x39')]=qs[_0x7513('0x3a')](_0x30465b[_0x7513('0x31')][_0x7513('0x3a')]);_0x469a93['where']=qs[_0x7513('0x3c')](_[_0x7513('0x3d')](_0x30465b[_0x7513('0x31')],_0x164896['filters']));_0x469a93['where']['MailQueueId']=_0x5909e6['id'];if(_0x30465b['query'][_0x7513('0x3e')]){_0x469a93['where']=_['merge'](_0x469a93['where'],{'$or':_[_0x7513('0x2d')](_0x469a93[_0x7513('0x33')],function(_0x3a9ba8){var _0x3e0193={};_0x3e0193[_0x3a9ba8]={'$like':'%'+_0x30465b[_0x7513('0x31')][_0x7513('0x3e')]+'%'};return _0x3e0193;})});}_0x469a93=_[_0x7513('0x3f')]({},_0x469a93,_0x30465b['options']);return db[_0x7513('0x58')][_0x7513('0x44')](_0x469a93);}})[_0x7513('0x28')](function(_0x343047){if(_0x343047){return db[_0x7513('0x59')][_0x7513('0x5a')]({'where':{'id':_['map'](_0x343047,_0x7513('0x5b')),'role':_0x7513('0x5c')},'attributes':['id',_0x7513('0x2c'),_0x7513('0x5d'),'updatedAt',_0x7513('0x5e')]});}})['then'](function(_0x31c22d){if(_0x31c22d){return{'count':_0x31c22d['count'],'rows':_['map'](_0x31c22d[_0x7513('0x45')],function(_0x30d796){return{'membername':_0x30d796[_0x7513('0x2c')],'UserId':_0x30d796['id'],'queue_name':_0x4a5209[_0x7513('0x2c')],'MailQueueId':_0x4a5209['id'],'interface':util[_0x7513('0x5f')](_0x7513('0x60'),_0x7513('0x61'),_0x30d796[_0x7513('0x2c')]),'penalty':0x0,'paused':_0x30d796[_0x7513('0x5d')],'createdAt':_0x30d796['createdAt'],'updatedAt':_0x30d796[_0x7513('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f5b72,_0x469a93))[_0x7513('0x46')](handleError(_0x1f5b72,null));};exports[_0x7513('0x63')]=function(_0x1cd90c,_0xc8d961,_0x2225d2){var _0x5857d1={};var _0x3ddee9={};var _0x4fff42;var _0x56747a;return db[_0x7513('0x2e')][_0x7513('0x57')]({'where':{'id':_0x1cd90c[_0x7513('0x48')]['id']}})['then'](handleEntityNotFound(_0xc8d961,null))[_0x7513('0x28')](function(_0x498708){if(_0x498708){_0x4fff42=_0x498708;_0x3ddee9[_0x7513('0x30')]=_['keys'](db[_0x7513('0x64')]['rawAttributes']);_0x3ddee9[_0x7513('0x31')]=_['keys'](_0x1cd90c[_0x7513('0x31')]);_0x3ddee9[_0x7513('0x3c')]=_[_0x7513('0x34')](_0x3ddee9['model'],_0x3ddee9[_0x7513('0x31')]);_0x5857d1[_0x7513('0x33')]=_[_0x7513('0x34')](_0x3ddee9[_0x7513('0x30')],qs['fields'](_0x1cd90c[_0x7513('0x31')][_0x7513('0x35')]));_0x5857d1[_0x7513('0x33')]=_0x5857d1[_0x7513('0x33')][_0x7513('0x36')]?_0x5857d1[_0x7513('0x33')]:_0x3ddee9['model'];_0x5857d1['order']=qs[_0x7513('0x3a')](_0x1cd90c['query'][_0x7513('0x3a')]);_0x5857d1['where']=qs[_0x7513('0x3c')](_[_0x7513('0x3d')](_0x1cd90c[_0x7513('0x31')],_0x3ddee9['filters']));if(_0x1cd90c['query'][_0x7513('0x3e')]){_0x5857d1[_0x7513('0x3b')]=_['merge'](_0x5857d1['where'],{'$or':_[_0x7513('0x2d')](_0x5857d1[_0x7513('0x33')],function(_0x1bcb95){var _0x11a2e9={};_0x11a2e9[_0x1bcb95]={'$like':'%'+_0x1cd90c[_0x7513('0x31')]['filter']+'%'};return _0x11a2e9;})});}_0x5857d1=_['merge']({},_0x5857d1,_0x1cd90c[_0x7513('0x41')]);return _0x4fff42['getTeams'](_0x5857d1);}})['then'](function(_0x15d67b){if(_0x15d67b){_0x56747a=_0x15d67b[_0x7513('0x36')];if(!_0x1cd90c[_0x7513('0x31')][_0x7513('0x37')](_0x7513('0x38'))){_0x5857d1['limit']=qs['limit'](_0x1cd90c[_0x7513('0x31')][_0x7513('0x1f')]);_0x5857d1[_0x7513('0x21')]=qs[_0x7513('0x21')](_0x1cd90c['query'][_0x7513('0x21')]);}return _0x4fff42['getTeams'](_0x5857d1);}})['then'](function(_0x48cc71){if(_0x48cc71){return _0x48cc71?{'count':_0x56747a,'rows':_0x48cc71}:null;}})[_0x7513('0x28')](respondWithResult(_0xc8d961,null))[_0x7513('0x46')](handleError(_0xc8d961,null));};exports[_0x7513('0x65')]=function(_0x7e9321,_0xa8274b,_0x38c370){var _0x38ccde=_0x7e9321[_0x7513('0x4c')][_0x7513('0x66')];return db[_0x7513('0x64')][_0x7513('0x44')]({'where':{'id':_0x38ccde},'attributes':['id'],'include':[{'model':db[_0x7513('0x59')],'as':_0x7513('0x67'),'attributes':['id','name',_0x7513('0x68'),'voicePause',_0x7513('0x69')],'raw':!![]}]})[_0x7513('0x28')](function(_0x4105a7){if(_0x4105a7){var _0x5b723e=_['flatMap'](_0x4105a7,function(_0x23d35a){var _0x1bdb77=_0x23d35a[_0x7513('0x4d')]({'plain':!![]});return _0x1bdb77[_0x7513('0x67')];});return db['MailQueue'][_0x7513('0x4a')]({'where':{'id':_0x7e9321[_0x7513('0x48')]['id']}})[_0x7513('0x28')](function(_0x40f7a1){return db['sequelize'][_0x7513('0x6a')](function(_0x2af668){return _0x40f7a1[_0x7513('0x65')](_0x38ccde,{'transaction':_0x2af668})[_0x7513('0x28')](function(){return BPromise['each'](_0x5b723e,function(_0x54494c){return db[_0x7513('0x58')][_0x7513('0x6b')]({'where':{'UserId':_0x54494c['id'],'MailQueueId':_0x7e9321[_0x7513('0x48')]['id']},'transaction':_0x2af668});});})[_0x7513('0x28')](function(){_0x5b723e[_0x7513('0x6c')](function(_0xa9ad62){socket['emit'](_0x7513('0x6d'),{'UserId':_0xa9ad62['id'],'MailQueueId':_0x40f7a1['id']});});});});});}})['then'](respondWithStatusCode(_0xa8274b,null))[_0x7513('0x46')](handleError(_0xa8274b,null));};exports['removeTeams']=function(_0x115f9e,_0x33bf65,_0x2cfb04){return db[_0x7513('0x64')][_0x7513('0x44')]({'where':{'id':_0x115f9e[_0x7513('0x31')][_0x7513('0x66')]},'attributes':['id'],'include':[{'model':db[_0x7513('0x59')],'as':_0x7513('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7513('0x28')](handleEntityNotFound(_0x33bf65,null))[_0x7513('0x28')](function(_0x2b1110){var _0x56aaef=_[_0x7513('0x2d')](_0x2b1110,'id');var _0x2eac93=[];var _0x57be3d=[];var _0x2b7bc8=squel[_0x7513('0x6e')]();_0x2b7bc8[_0x7513('0x6f')](_0x7513('0x70'))[_0x7513('0x71')](_0x7513('0x72'),'tq')['join'](_0x7513('0x73'),'ut',_0x7513('0x74'))[_0x7513('0x3b')](_0x7513('0x75'),_0x115f9e[_0x7513('0x48')]['id']);for(var _0x446b6e=0x0;_0x446b6e<_0x2b1110[_0x7513('0x36')];_0x446b6e+=0x1){let _0x425304=_0x2b1110[_0x446b6e];for(var _0x29bd44=0x0;_0x29bd44<_0x425304[_0x7513('0x67')]['length'];_0x29bd44+=0x1){let _0x390dea=_0x425304[_0x7513('0x67')][_0x29bd44];var _0x269f93=_0x2b7bc8[_0x7513('0x76')]();_0x269f93['where'](_0x7513('0x77'),_0x390dea['id']);_0x57be3d[_0x7513('0x78')](db[_0x7513('0x79')]['query'](_0x269f93[_0x7513('0x7a')](),{'type':db[_0x7513('0x79')][_0x7513('0x7b')][_0x7513('0x7c')]})[_0x7513('0x28')](function(_0x18ea0a){if(_0x18ea0a[_0x7513('0x36')]===0x1){return _0x390dea['id'];}else{var _0x4866f8=_[_0x7513('0x7d')](_[_0x7513('0x2d')](_0x18ea0a,_0x7513('0x7e')),function(_0x13eafa){return _['includes'](_0x56aaef,_0x13eafa);});if(_0x4866f8){return _0x390dea['id'];}}}));}}return BPromise[_0x7513('0x7f')](_0x57be3d)[_0x7513('0x28')](function(_0x448891){_0x2eac93=_(_0x2eac93)[_0x7513('0x80')](_0x448891)['compact']()[_0x7513('0x81')]();return db[_0x7513('0x2e')]['find']({'where':{'id':_0x115f9e['params']['id']}})[_0x7513('0x28')](function(_0x313b63){return db['sequelize'][_0x7513('0x6a')](function(_0x224578){return _0x313b63[_0x7513('0x82')](_0x115f9e['query']['ids'],{'transaction':_0x224578})[_0x7513('0x28')](function(){if(!_[_0x7513('0x83')](_0x2eac93)){return _0x313b63['removeAgents'](_0x2eac93,{'transaction':_0x224578});}})[_0x7513('0x28')](function(){_0x2eac93[_0x7513('0x6c')](function(_0x336fb2){socket[_0x7513('0x84')](_0x7513('0x85'),{'UserId':_0x336fb2,'MailQueueId':_0x313b63['id']});});});});});});})[_0x7513('0x28')](respondWithStatusCode(_0x33bf65,null))[_0x7513('0x46')](handleError(_0x33bf65,null));};exports['addAgents']=function(_0x4c7ac9,_0x4f410,_0x33f5ae){return db['MailQueue'][_0x7513('0x4a')]({'where':{'id':_0x4c7ac9[_0x7513('0x48')]['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x4f410,null))[_0x7513('0x28')](function(_0x442b03){if(_0x442b03){return _0x442b03[_0x7513('0x86')](_0x4c7ac9[_0x7513('0x4c')][_0x7513('0x66')],_[_0x7513('0x87')](_0x4c7ac9['body'],[_0x7513('0x66'),'id'])||{})[_0x7513('0x88')](function(_0x21288c){for(var _0x407155=0x0;_0x407155<_0x4c7ac9[_0x7513('0x4c')][_0x7513('0x66')]['length'];_0x407155+=0x1){socket[_0x7513('0x84')]('userMailQueue:save',{'UserId':Number(_0x4c7ac9[_0x7513('0x4c')][_0x7513('0x66')][_0x407155]),'MailQueueId':Number(_0x4c7ac9['params']['id'])});}return _0x21288c;});}})['then'](respondWithResult(_0x4f410,null))[_0x7513('0x46')](handleError(_0x4f410,null));};exports[_0x7513('0x89')]=function(_0x28daf7,_0x2fa02c,_0x1bf399){return db[_0x7513('0x2e')][_0x7513('0x4a')]({'where':{'id':_0x28daf7[_0x7513('0x48')]['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x2fa02c,null))[_0x7513('0x28')](function(_0xfa4941){if(_0xfa4941){return _0xfa4941[_0x7513('0x89')](_0x28daf7['query'][_0x7513('0x66')])[_0x7513('0x28')](function(){if(_[_0x7513('0x8a')](_0x28daf7['query'][_0x7513('0x66')])){for(var _0x308157=0x0;_0x308157<_0x28daf7['query'][_0x7513('0x66')]['length'];_0x308157+=0x1){socket[_0x7513('0x84')](_0x7513('0x85'),{'UserId':Number(_0x28daf7[_0x7513('0x31')][_0x7513('0x66')][_0x308157]),'MailQueueId':Number(_0x28daf7[_0x7513('0x48')]['id'])});}}else{socket['emit'](_0x7513('0x85'),{'UserId':Number(_0x28daf7[_0x7513('0x31')][_0x7513('0x66')]),'MailQueueId':Number(_0x28daf7[_0x7513('0x48')]['id'])});}});}})[_0x7513('0x28')](respondWithStatusCode(_0x2fa02c,null))[_0x7513('0x46')](handleError(_0x2fa02c,null));};exports['getAgents']=function(_0x16a358,_0x54be6b,_0x8ccc2d){var _0x4f1f03={};var _0x23c296={};var _0x57118e;var _0x18a53c;return db[_0x7513('0x2e')][_0x7513('0x57')]({'where':{'id':_0x16a358[_0x7513('0x48')]['id']}})[_0x7513('0x28')](handleEntityNotFound(_0x54be6b,null))[_0x7513('0x28')](function(_0x560e40){if(_0x560e40){_0x57118e=_0x560e40;_0x23c296['model']=_['keys'](db[_0x7513('0x59')]['rawAttributes']);_0x23c296[_0x7513('0x31')]=_['keys'](_0x16a358['query']);_0x23c296[_0x7513('0x3c')]=_['intersection'](_0x23c296['model'],_0x23c296[_0x7513('0x31')]);_0x4f1f03['attributes']=_[_0x7513('0x34')](_0x23c296[_0x7513('0x30')],qs[_0x7513('0x35')](_0x16a358[_0x7513('0x31')][_0x7513('0x35')]));_0x4f1f03[_0x7513('0x33')]=_0x4f1f03['attributes'][_0x7513('0x36')]?_0x4f1f03[_0x7513('0x33')]:_0x23c296[_0x7513('0x30')];_0x4f1f03['order']=qs[_0x7513('0x3a')](_0x16a358[_0x7513('0x31')]['sort']);_0x4f1f03[_0x7513('0x3b')]=qs['filters'](_[_0x7513('0x3d')](_0x16a358['query'],_0x23c296[_0x7513('0x3c')]));if(_0x16a358[_0x7513('0x31')][_0x7513('0x3e')]){_0x4f1f03[_0x7513('0x3b')]=_[_0x7513('0x3f')](_0x4f1f03[_0x7513('0x3b')],{'$or':_[_0x7513('0x2d')](_0x4f1f03[_0x7513('0x33')],function(_0x5477aa){var _0x1b1eb6={};_0x1b1eb6[_0x5477aa]={'$like':'%'+_0x16a358['query'][_0x7513('0x3e')]+'%'};return _0x1b1eb6;})});}_0x4f1f03=_['merge']({},_0x4f1f03,_0x16a358[_0x7513('0x41')]);return _0x57118e[_0x7513('0x8b')](_0x4f1f03);}})[_0x7513('0x28')](function(_0x302c08){if(_0x302c08){_0x18a53c=_0x302c08['length'];if(!_0x16a358[_0x7513('0x31')][_0x7513('0x37')]('nolimit')){_0x4f1f03['limit']=qs[_0x7513('0x1f')](_0x16a358['query'][_0x7513('0x1f')]);_0x4f1f03[_0x7513('0x21')]=qs['offset'](_0x16a358[_0x7513('0x31')][_0x7513('0x21')]);}return _0x57118e[_0x7513('0x8b')](_0x4f1f03);}})[_0x7513('0x28')](function(_0xad7a68){if(_0xad7a68){return _0xad7a68?{'count':_0x18a53c,'rows':_0xad7a68}:null;}})[_0x7513('0x28')](respondWithResult(_0x54be6b,null))[_0x7513('0x46')](handleError(_0x54be6b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 696e07f..6ea2cd7 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 _0x5ea2=['../../mysqldb','MailQueue','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x451c3c,_0x4d260d){var _0x195fde=function(_0x443824){while(--_0x443824){_0x451c3c['push'](_0x451c3c['shift']());}};_0x195fde(++_0x4d260d);}(_0x5ea2,0x158));var _0x25ea=function(_0x551c3a,_0x175bc0){_0x551c3a=_0x551c3a-0x0;var _0x30bfe9=_0x5ea2[_0x551c3a];return _0x30bfe9;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x25ea('0x0'))['db'][_0x25ea('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x25ea('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x25ea('0x3'),'afterDestroy':_0x25ea('0x4')};function emitEvent(_0x117d08){return function(_0x491284,_0x9e4dba,_0x1c2a9a){MailQueueEvents[_0x25ea('0x5')](_0x117d08+':'+_0x491284['id'],_0x491284);MailQueueEvents[_0x25ea('0x5')](_0x117d08,_0x491284);_0x1c2a9a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x25ea('0x6')](e,emitEvent(event));}}module[_0x25ea('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x08e1=['../../mysqldb','MailQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x50589c,_0x561045){var _0x25f9c3=function(_0x410531){while(--_0x410531){_0x50589c['push'](_0x50589c['shift']());}};_0x25f9c3(++_0x561045);}(_0x08e1,0xd7));var _0x108e=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x08e1[_0x468a77];return _0x2d1c33;};'use strict';var EventEmitter=require(_0x108e('0x0'));var MailQueue=require(_0x108e('0x1'))['db'][_0x108e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x108e('0x3'),'afterUpdate':_0x108e('0x4'),'afterDestroy':_0x108e('0x5')};function emitEvent(_0x446662){return function(_0x49cb7d,_0x18cf1f,_0x3ae7c1){MailQueueEvents[_0x108e('0x6')](_0x446662+':'+_0x49cb7d['id'],_0x49cb7d);MailQueueEvents[_0x108e('0x6')](_0x446662,_0x49cb7d);_0x3ae7c1(null);};}for(var e in events){if(events[_0x108e('0x7')](e)){var event=events[e];MailQueue[_0x108e('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9551ee0..775ba3c 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 _0xbe0d=['MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x1fba9a,_0x3553e0){var _0x41413d=function(_0x118ca1){while(--_0x118ca1){_0x1fba9a['push'](_0x1fba9a['shift']());}};_0x41413d(++_0x3553e0);}(_0xbe0d,0x79));var _0xdbe0=function(_0x1698f6,_0x441e4b){_0x1698f6=_0x1698f6-0x0;var _0x11d58f=_0xbe0d[_0x1698f6];return _0x11d58f;};'use strict';var _=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var logger=require(_0xdbe0('0x2'))(_0xdbe0('0x3'));var moment=require(_0xdbe0('0x4'));var BPromise=require(_0xdbe0('0x5'));var rp=require(_0xdbe0('0x6'));var fs=require('fs');var path=require(_0xdbe0('0x7'));var rimraf=require('rimraf');var config=require(_0xdbe0('0x8'));var attributes=require('./mailQueue.attributes');module[_0xdbe0('0x9')]=function(_0x19a176,_0xbbd0bb){return _0x19a176[_0xdbe0('0xa')](_0xdbe0('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b51=['../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','util','api','moment','bluebird','path'];(function(_0x258959,_0x4c2abe){var _0x2e49ef=function(_0x2f16a){while(--_0x2f16a){_0x258959['push'](_0x258959['shift']());}};_0x2e49ef(++_0x4c2abe);}(_0x5b51,0xea));var _0x15b5=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x5b51[_0x55ff79];return _0x579067;};'use strict';var _=require(_0x15b5('0x0'));var util=require(_0x15b5('0x1'));var logger=require('../../config/logger')(_0x15b5('0x2'));var moment=require(_0x15b5('0x3'));var BPromise=require(_0x15b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15b5('0x5'));var rimraf=require('rimraf');var config=require(_0x15b5('0x6'));var attributes=require(_0x15b5('0x7'));module['exports']=function(_0x2db494,_0x428c0d){return _0x2db494['define'](_0x15b5('0x8'),attributes,{'tableName':_0x15b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d8d1627..78a9cc1 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 _0x1edd=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowMailQueue','find'];(function(_0x46ae4b,_0x195c41){var _0x8aea66=function(_0x1538cc){while(--_0x1538cc){_0x46ae4b['push'](_0x46ae4b['shift']());}};_0x8aea66(++_0x195c41);}(_0x1edd,0xcd));var _0xd1ed=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0x1edd[_0x3ef45e];return _0x69e7c;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var moment=require(_0xd1ed('0x2'));var BPromise=require(_0xd1ed('0x3'));var rs=require(_0xd1ed('0x4'));var fs=require('fs');var Redis=require(_0xd1ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1ed('0x6'));var logger=require(_0xd1ed('0x7'))('rpc');var config=require(_0xd1ed('0x8'));var jayson=require(_0xd1ed('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd1ed('0xa')]=_[_0xd1ed('0xb')](config[_0xd1ed('0xa')],{'host':_0xd1ed('0xc'),'port':0x18eb});var socket=require(_0xd1ed('0xd'))(new Redis(config['redis']));require(_0xd1ed('0xe'))[_0xd1ed('0xf')](socket);function respondWithRpcPromise(_0x3db2c4,_0x11c73a,_0x24824f){return new BPromise(function(_0x5107a6,_0x5ee467){return client[_0xd1ed('0x10')](_0x3db2c4,_0x24824f)['then'](function(_0x233aba){logger['info'](_0xd1ed('0x11'),_0x11c73a,_0xd1ed('0x12'));logger['debug'](_0xd1ed('0x13'),_0x11c73a,_0xd1ed('0x12'),JSON[_0xd1ed('0x14')](_0x233aba));if(_0x233aba[_0xd1ed('0x15')]){if(_0x233aba[_0xd1ed('0x15')][_0xd1ed('0x16')]===0x1f4){logger['error'](_0xd1ed('0x11'),_0x11c73a,_0x233aba['error'][_0xd1ed('0x17')]);return _0x5ee467(_0x233aba[_0xd1ed('0x15')][_0xd1ed('0x17')]);}logger['error'](_0xd1ed('0x11'),_0x11c73a,_0x233aba[_0xd1ed('0x15')]['message']);return _0x5107a6(_0x233aba[_0xd1ed('0x15')][_0xd1ed('0x17')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x11c73a,_0xd1ed('0x12'));_0x5107a6(_0x233aba[_0xd1ed('0x18')][_0xd1ed('0x17')]);}})[_0xd1ed('0x19')](function(_0x5b30f3){logger[_0xd1ed('0x15')](_0xd1ed('0x11'),_0x11c73a,_0x5b30f3);_0x5ee467(_0x5b30f3);});});}exports[_0xd1ed('0x1a')]=function(_0xfaac7f){var _0x35a50a=this;return new Promise(function(_0x5d0f90,_0x4b5a5e){return db[_0xd1ed('0x1b')][_0xd1ed('0x1c')]({'raw':_0xfaac7f[_0xd1ed('0x1d')]?_0xfaac7f['options'][_0xd1ed('0x1e')]===undefined?!![]:![]:!![],'where':_0xfaac7f[_0xd1ed('0x1d')]?_0xfaac7f[_0xd1ed('0x1d')][_0xd1ed('0x1f')]||null:null,'attributes':_0xfaac7f['options']?_0xfaac7f[_0xd1ed('0x1d')][_0xd1ed('0x20')]||null:null,'limit':_0xfaac7f[_0xd1ed('0x1d')]?_0xfaac7f['options'][_0xd1ed('0x21')]||null:null,'include':_0xfaac7f[_0xd1ed('0x1d')]?_0xfaac7f[_0xd1ed('0x1d')][_0xd1ed('0x22')]?_[_0xd1ed('0x23')](_0xfaac7f[_0xd1ed('0x1d')][_0xd1ed('0x22')],function(_0x1472a8){return{'model':db[_0x1472a8['model']],'as':_0x1472a8['as'],'attributes':_0x1472a8[_0xd1ed('0x20')],'include':_0x1472a8[_0xd1ed('0x22')]?_['map'](_0x1472a8[_0xd1ed('0x22')],function(_0x3b6899){return{'model':db[_0x3b6899[_0xd1ed('0x24')]],'as':_0x3b6899['as'],'attributes':_0x3b6899[_0xd1ed('0x20')],'include':_0x3b6899[_0xd1ed('0x22')]?_['map'](_0x3b6899[_0xd1ed('0x22')],function(_0x6c544d){return{'model':db[_0x6c544d['model']],'as':_0x6c544d['as'],'attributes':_0x6c544d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1ed('0x25')](function(_0x2f6dc1){logger['info'](_0xd1ed('0x1a'),_0xfaac7f);logger[_0xd1ed('0x26')](_0xd1ed('0x1a'),_0xfaac7f,JSON[_0xd1ed('0x14')](_0x2f6dc1));_0x5d0f90(_0x2f6dc1);})[_0xd1ed('0x19')](function(_0x1b4d92){logger[_0xd1ed('0x15')](_0xd1ed('0x1a'),_0x1b4d92[_0xd1ed('0x17')],_0xfaac7f);_0x4b5a5e(_0x35a50a['error'](0x1f4,_0x1b4d92[_0xd1ed('0x17')]));});});};exports[_0xd1ed('0x27')]=function(_0x3ba3b2){var _0x3f7b07=this;return new Promise(function(_0x5cc247,_0x3343f5){return db['MailQueue'][_0xd1ed('0x28')]({'raw':_0x3ba3b2[_0xd1ed('0x1d')]?_0x3ba3b2['options'][_0xd1ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ba3b2['options']?_0x3ba3b2[_0xd1ed('0x1d')][_0xd1ed('0x1f')]||null:null,'attributes':_0x3ba3b2['options']?_0x3ba3b2[_0xd1ed('0x1d')][_0xd1ed('0x20')]||null:null,'include':_0x3ba3b2[_0xd1ed('0x1d')]?_0x3ba3b2[_0xd1ed('0x1d')]['include']?_[_0xd1ed('0x23')](_0x3ba3b2[_0xd1ed('0x1d')][_0xd1ed('0x22')],function(_0x32e53a){return{'model':db[_0x32e53a['model']],'as':_0x32e53a['as'],'attributes':_0x32e53a[_0xd1ed('0x20')],'include':_0x32e53a['include']?_['map'](_0x32e53a[_0xd1ed('0x22')],function(_0x2177bb){return{'model':db[_0x2177bb[_0xd1ed('0x24')]],'as':_0x2177bb['as'],'attributes':_0x2177bb[_0xd1ed('0x20')],'include':_0x2177bb[_0xd1ed('0x22')]?_[_0xd1ed('0x23')](_0x2177bb['include'],function(_0x573e91){return{'model':db[_0x573e91['model']],'as':_0x573e91['as'],'attributes':_0x573e91['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1ed('0x25')](function(_0x2f8dbb){logger['info'](_0xd1ed('0x27'),_0x3ba3b2);logger['debug'](_0xd1ed('0x27'),_0x3ba3b2,JSON[_0xd1ed('0x14')](_0x2f8dbb));_0x5cc247(_0x2f8dbb);})[_0xd1ed('0x19')](function(_0x338ea6){logger[_0xd1ed('0x15')](_0xd1ed('0x27'),_0x338ea6['message'],_0x3ba3b2);_0x3343f5(_0x3f7b07[_0xd1ed('0x15')](0x1f4,_0x338ea6[_0xd1ed('0x17')]));});});}; \ No newline at end of file +var _0x7314=['result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5d5a67,_0x14bb88){var _0x91f724=function(_0x400737){while(--_0x400737){_0x5d5a67['push'](_0x5d5a67['shift']());}};_0x91f724(++_0x14bb88);}(_0x7314,0x100));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var moment=require('moment');var BPromise=require(_0x4731('0x2'));var rs=require(_0x4731('0x3'));var fs=require('fs');var Redis=require(_0x4731('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4731('0x5'));var logger=require(_0x4731('0x6'))(_0x4731('0x7'));var config=require('../../config/environment');var jayson=require(_0x4731('0x8'));var client=jayson[_0x4731('0x9')]['http']({'port':0x232a});config[_0x4731('0xa')]=_[_0x4731('0xb')](config[_0x4731('0xa')],{'host':_0x4731('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4731('0xa')]));require('./mailQueue.socket')[_0x4731('0xd')](socket);function respondWithRpcPromise(_0x232e67,_0x17af9d,_0x4e6811){return new BPromise(function(_0xba853d,_0x24bca8){return client[_0x4731('0xe')](_0x232e67,_0x4e6811)[_0x4731('0xf')](function(_0x2f546b){logger[_0x4731('0x10')](_0x4731('0x11'),_0x17af9d,_0x4731('0x12'));logger[_0x4731('0x13')](_0x4731('0x14'),_0x17af9d,_0x4731('0x12'),JSON['stringify'](_0x2f546b));if(_0x2f546b['error']){if(_0x2f546b[_0x4731('0x15')][_0x4731('0x16')]===0x1f4){logger['error'](_0x4731('0x11'),_0x17af9d,_0x2f546b[_0x4731('0x15')][_0x4731('0x17')]);return _0x24bca8(_0x2f546b[_0x4731('0x15')]['message']);}logger[_0x4731('0x15')](_0x4731('0x11'),_0x17af9d,_0x2f546b['error'][_0x4731('0x17')]);return _0xba853d(_0x2f546b[_0x4731('0x15')]['message']);}else{logger[_0x4731('0x10')](_0x4731('0x11'),_0x17af9d,'request\x20sent');_0xba853d(_0x2f546b[_0x4731('0x18')][_0x4731('0x17')]);}})['catch'](function(_0x4e31c3){logger[_0x4731('0x15')](_0x4731('0x11'),_0x17af9d,_0x4e31c3);_0x24bca8(_0x4e31c3);});});}exports[_0x4731('0x19')]=function(_0x5991e4){var _0x343776=this;return new Promise(function(_0x27e9ca,_0xc6efce){return db[_0x4731('0x1a')][_0x4731('0x1b')]({'raw':_0x5991e4[_0x4731('0x1c')]?_0x5991e4[_0x4731('0x1c')][_0x4731('0x1d')]===undefined?!![]:![]:!![],'where':_0x5991e4[_0x4731('0x1c')]?_0x5991e4[_0x4731('0x1c')][_0x4731('0x1e')]||null:null,'attributes':_0x5991e4[_0x4731('0x1c')]?_0x5991e4[_0x4731('0x1c')][_0x4731('0x1f')]||null:null,'limit':_0x5991e4[_0x4731('0x1c')]?_0x5991e4[_0x4731('0x1c')][_0x4731('0x20')]||null:null,'include':_0x5991e4['options']?_0x5991e4[_0x4731('0x1c')][_0x4731('0x21')]?_[_0x4731('0x22')](_0x5991e4[_0x4731('0x1c')]['include'],function(_0x3c3cd5){return{'model':db[_0x3c3cd5[_0x4731('0x23')]],'as':_0x3c3cd5['as'],'attributes':_0x3c3cd5[_0x4731('0x1f')],'include':_0x3c3cd5[_0x4731('0x21')]?_[_0x4731('0x22')](_0x3c3cd5[_0x4731('0x21')],function(_0x209ee6){return{'model':db[_0x209ee6['model']],'as':_0x209ee6['as'],'attributes':_0x209ee6[_0x4731('0x1f')],'include':_0x209ee6[_0x4731('0x21')]?_[_0x4731('0x22')](_0x209ee6[_0x4731('0x21')],function(_0x25f17d){return{'model':db[_0x25f17d[_0x4731('0x23')]],'as':_0x25f17d['as'],'attributes':_0x25f17d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4731('0xf')](function(_0x5b335a){logger['info'](_0x4731('0x19'),_0x5991e4);logger['debug'](_0x4731('0x19'),_0x5991e4,JSON[_0x4731('0x24')](_0x5b335a));_0x27e9ca(_0x5b335a);})[_0x4731('0x25')](function(_0x2d9a45){logger[_0x4731('0x15')]('GetMailQueue',_0x2d9a45['message'],_0x5991e4);_0xc6efce(_0x343776[_0x4731('0x15')](0x1f4,_0x2d9a45[_0x4731('0x17')]));});});};exports[_0x4731('0x26')]=function(_0x2b6c29){var _0x5cd91e=this;return new Promise(function(_0x5419e5,_0x3f3a79){return db[_0x4731('0x1a')][_0x4731('0x27')]({'raw':_0x2b6c29[_0x4731('0x1c')]?_0x2b6c29['options'][_0x4731('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b6c29['options']?_0x2b6c29[_0x4731('0x1c')]['where']||null:null,'attributes':_0x2b6c29[_0x4731('0x1c')]?_0x2b6c29[_0x4731('0x1c')][_0x4731('0x1f')]||null:null,'include':_0x2b6c29[_0x4731('0x1c')]?_0x2b6c29[_0x4731('0x1c')][_0x4731('0x21')]?_[_0x4731('0x22')](_0x2b6c29[_0x4731('0x1c')][_0x4731('0x21')],function(_0x346e22){return{'model':db[_0x346e22[_0x4731('0x23')]],'as':_0x346e22['as'],'attributes':_0x346e22['attributes'],'include':_0x346e22[_0x4731('0x21')]?_[_0x4731('0x22')](_0x346e22[_0x4731('0x21')],function(_0x3c9b37){return{'model':db[_0x3c9b37[_0x4731('0x23')]],'as':_0x3c9b37['as'],'attributes':_0x3c9b37[_0x4731('0x1f')],'include':_0x3c9b37['include']?_['map'](_0x3c9b37[_0x4731('0x21')],function(_0x4fb932){return{'model':db[_0x4fb932[_0x4731('0x23')]],'as':_0x4fb932['as'],'attributes':_0x4fb932[_0x4731('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4731('0xf')](function(_0x479ba8){logger[_0x4731('0x10')](_0x4731('0x26'),_0x2b6c29);logger[_0x4731('0x13')](_0x4731('0x26'),_0x2b6c29,JSON['stringify'](_0x479ba8));_0x5419e5(_0x479ba8);})[_0x4731('0x25')](function(_0x1049a1){logger[_0x4731('0x15')]('ShowMailQueue',_0x1049a1['message'],_0x2b6c29);_0x3f3a79(_0x5cd91e[_0x4731('0x15')](0x1f4,_0x1049a1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3c28726..cf22e9c 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 _0x6a31=['register','length','mailQueue:','./mailQueue.events','save','update','emit','removeListener'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x6a31,0x73));var _0x16a3=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x6a31[_0x1a8f86];return _0x20d876;};'use strict';var MailQueueEvents=require(_0x16a3('0x0'));var events=[_0x16a3('0x1'),'remove',_0x16a3('0x2')];function createListener(_0x560da4,_0x366c53){return function(_0x31ccc1){_0x366c53[_0x16a3('0x3')](_0x560da4,_0x31ccc1);};}function removeListener(_0x22033f,_0x4fd810){return function(){MailQueueEvents[_0x16a3('0x4')](_0x22033f,_0x4fd810);};}exports[_0x16a3('0x5')]=function(_0x50f272){for(var _0x3efb6=0x0,_0x1e9576=events[_0x16a3('0x6')];_0x3efb6<_0x1e9576;_0x3efb6++){var _0x5677c8=events[_0x3efb6];var _0x22d8dc=createListener(_0x16a3('0x7')+_0x5677c8,_0x50f272);MailQueueEvents['on'](_0x5677c8,_0x22d8dc);}}; \ No newline at end of file +var _0x77b0=['length','mailQueue:','save','remove','emit','removeListener','register'];(function(_0x278e20,_0x2e570d){var _0x2ed7e6=function(_0x4e8b4c){while(--_0x4e8b4c){_0x278e20['push'](_0x278e20['shift']());}};_0x2ed7e6(++_0x2e570d);}(_0x77b0,0xd4));var _0x077b=function(_0x284a9f,_0x4d8dfe){_0x284a9f=_0x284a9f-0x0;var _0x3987a5=_0x77b0[_0x284a9f];return _0x3987a5;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x077b('0x0'),_0x077b('0x1'),'update'];function createListener(_0x10b1e9,_0xc3fc9f){return function(_0x3979cc){_0xc3fc9f[_0x077b('0x2')](_0x10b1e9,_0x3979cc);};}function removeListener(_0x976fa8,_0x4d9096){return function(){MailQueueEvents[_0x077b('0x3')](_0x976fa8,_0x4d9096);};}exports[_0x077b('0x4')]=function(_0x28d2ae){for(var _0x4848ec=0x0,_0x75f4e0=events[_0x077b('0x5')];_0x4848ec<_0x75f4e0;_0x4848ec++){var _0x522f52=events[_0x4848ec];var _0x57843c=createListener(_0x077b('0x6')+_0x522f52,_0x28d2ae);MailQueueEvents['on'](_0x522f52,_0x57843c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d341b68..bb27457 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 _0xc233=['isAuthenticated','index','/describe','describe','post','create','put','delete','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x15fdf2,_0x2373fa){var _0x15d9d7=function(_0x22d3a4){while(--_0x22d3a4){_0x15fdf2['push'](_0x15fdf2['shift']());}};_0x15d9d7(++_0x2373fa);}(_0xc233,0x6a));var _0x3c23=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xc233[_0x53d172];return _0x1bd0a2;};'use strict';var multer=require(_0x3c23('0x0'));var util=require('util');var path=require(_0x3c23('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c23('0x2'));var router=express[_0x3c23('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3c23('0x4'));var interaction=require(_0x3c23('0x5'));var config=require(_0x3c23('0x6'));var controller=require('./mailQueueReport.controller');router[_0x3c23('0x7')]('/',auth[_0x3c23('0x8')](),controller[_0x3c23('0x9')]);router['get'](_0x3c23('0xa'),auth[_0x3c23('0x8')](),controller[_0x3c23('0xb')]);router[_0x3c23('0x7')]('/:id',auth[_0x3c23('0x8')](),controller['show']);router[_0x3c23('0xc')]('/',auth[_0x3c23('0x8')](),controller[_0x3c23('0xd')]);router[_0x3c23('0xe')]('/:id',auth[_0x3c23('0x8')](),controller['update']);router[_0x3c23('0xf')](_0x3c23('0x10'),auth['isAuthenticated'](),controller[_0x3c23('0x11')]);module[_0x3c23('0x12')]=router; \ No newline at end of file +var _0xe739=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0xe739,0xd5));var _0x9e73=function(_0x188620,_0x360c00){_0x188620=_0x188620-0x0;var _0x3c0166=_0xe739[_0x188620];return _0x3c0166;};'use strict';var multer=require(_0x9e73('0x0'));var util=require(_0x9e73('0x1'));var path=require(_0x9e73('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e73('0x3'));var router=express[_0x9e73('0x4')]();var fs_extra=require(_0x9e73('0x5'));var auth=require(_0x9e73('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e73('0x7'));router[_0x9e73('0x8')]('/',auth[_0x9e73('0x9')](),controller[_0x9e73('0xa')]);router['get'](_0x9e73('0xb'),auth[_0x9e73('0x9')](),controller[_0x9e73('0xc')]);router[_0x9e73('0x8')](_0x9e73('0xd'),auth[_0x9e73('0x9')](),controller[_0x9e73('0xe')]);router[_0x9e73('0xf')]('/',auth[_0x9e73('0x9')](),controller[_0x9e73('0x10')]);router[_0x9e73('0x11')](_0x9e73('0xd'),auth['isAuthenticated'](),controller[_0x9e73('0x12')]);router['delete'](_0x9e73('0xd'),auth[_0x9e73('0x9')](),controller[_0x9e73('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3c1fdd3..bf09d3e 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 _0xa48b=['STRING','moment','sequelize','exports','DATE'];(function(_0x28b384,_0x414f5f){var _0x436003=function(_0x138f41){while(--_0x138f41){_0x28b384['push'](_0x28b384['shift']());}};_0x436003(++_0x414f5f);}(_0xa48b,0xc4));var _0xba48=function(_0x1a72de,_0x427b56){_0x1a72de=_0x1a72de-0x0;var _0x34f762=_0xa48b[_0x1a72de];return _0x34f762;};'use strict';var moment=require(_0xba48('0x0'));var Sequelize=require(_0xba48('0x1'));module[_0xba48('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xba48('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xba48('0x3')]},'reason':{'type':Sequelize[_0xba48('0x4')]}}; \ No newline at end of file +var _0xd0ee=['DATE','moment','sequelize','exports','STRING'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xd0ee,0x18c));var _0xed0e=function(_0x5dba3f,_0x2ce6f5){_0x5dba3f=_0x5dba3f-0x0;var _0x37ff5d=_0xd0ee[_0x5dba3f];return _0x37ff5d;};'use strict';var moment=require(_0xed0e('0x0'));var Sequelize=require(_0xed0e('0x1'));module[_0xed0e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xed0e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xed0e('0x4')]},'acceptAt':{'type':Sequelize[_0xed0e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 65f5642..1adad30 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 _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x17ffb7,_0xec2320){var _0x351813=function(_0x1c5d0d){while(--_0x1c5d0d){_0x17ffb7['push'](_0x17ffb7['shift']());}};_0x351813(++_0xec2320);}(_0xb145,0xa3));var _0x5b14=function(_0x4cdb0f,_0x3d1080){_0x4cdb0f=_0x4cdb0f-0x0;var _0x7f81d9=_0xb145[_0x4cdb0f];return _0x7f81d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file +var _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x1893,0xa2));var _0x3189=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x1893[_0x2e50a2];return _0x47e5de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ef213cb..16f8ace 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 _0x6bfc=['bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api'];(function(_0xdeb19d,_0x23a222){var _0x538674=function(_0x2c4cb8){while(--_0x2c4cb8){_0xdeb19d['push'](_0xdeb19d['shift']());}};_0x538674(++_0x23a222);}(_0x6bfc,0x159));var _0xc6bf=function(_0x1cf7bc,_0x5c2a8b){_0x1cf7bc=_0x1cf7bc-0x0;var _0x297670=_0x6bfc[_0x1cf7bc];return _0x297670;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var logger=require(_0xc6bf('0x1'))(_0xc6bf('0x2'));var moment=require('moment');var BPromise=require(_0xc6bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc6bf('0x5'));var attributes=require(_0xc6bf('0x6'));module[_0xc6bf('0x7')]=function(_0x4a999e,_0x27a5d9){return _0x4a999e[_0xc6bf('0x8')](_0xc6bf('0x9'),attributes,{'tableName':_0xc6bf('0xa'),'paranoid':![],'indexes':[{'name':_0xc6bf('0xb'),'fields':[_0xc6bf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbba8=['define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xbba8,0x1da));var _0x8bba=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xbba8[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bba('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8bba('0x1'));var rp=require(_0x8bba('0x2'));var fs=require('fs');var path=require(_0x8bba('0x3'));var rimraf=require(_0x8bba('0x4'));var config=require('../../config/environment');var attributes=require(_0x8bba('0x5'));module['exports']=function(_0x1fd8dc,_0x4e6f1b){return _0x1fd8dc[_0x8bba('0x6')](_0x8bba('0x7'),attributes,{'tableName':_0x8bba('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8bba('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 09c3296..0617c25 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4f4433,_0x20a5c3){var _0x17d83e=function(_0x4b519d){while(--_0x4b519d){_0x4f4433['push'](_0x4f4433['shift']());}};_0x17d83e(++_0x20a5c3);}(_0xadb5,0xad));var _0x5adb=function(_0x49fadd,_0x5c6f85){_0x49fadd=_0x49fadd-0x0;var _0x48eff3=_0xadb5[_0x49fadd];return _0x48eff3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3bbfb4,_0x264af5){var _0x3fb233=function(_0x5e99d7){while(--_0x5e99d7){_0x3bbfb4['push'](_0x3bbfb4['shift']());}};_0x3fb233(++_0x264af5);}(_0x1261,0x144));var _0x1126=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x1261[_0x2bbd2d];return _0x257dc9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a65358e..7892fcb 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xbf6c00,_0x4e6044){var _0xa24b7=function(_0xa76ef5){while(--_0xa76ef5){_0xbf6c00['push'](_0xbf6c00['shift']());}};_0xa24b7(++_0x4e6044);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xcb91[_0xe6e78c];return _0x2a09c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x18c50f,_0x46b88c){var _0x1bdaec=function(_0x54056a){while(--_0x54056a){_0x18c50f['push'](_0x18c50f['shift']());}};_0x1bdaec(++_0x46b88c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5313e0,_0x2dfc0d){_0x5313e0=_0x5313e0-0x0;var _0x49e0f0=_0xedd9[_0x5313e0];return _0x49e0f0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4871697..4b12879 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 _0x618b=['BOOLEAN','STRING','INTEGER','sequelize','exports'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x618b,0x14d));var _0xb618=function(_0x2b829b,_0x1c2d52){_0x2b829b=_0x2b829b-0x0;var _0x3e951f=_0x618b[_0x2b829b];return _0x3e951f;};'use strict';var Sequelize=require(_0xb618('0x0'));module[_0xb618('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb618('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb618('0x3')]},'password':{'type':Sequelize[_0xb618('0x3')]},'port':{'type':Sequelize[_0xb618('0x4')]},'tls':{'type':Sequelize[_0xb618('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb618('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xb618('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd795=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd795,0x1bf));var _0x5d79=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd795[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0x5d79('0x0')]={'description':{'type':Sequelize[_0x5d79('0x1')]},'host':{'type':Sequelize[_0x5d79('0x1')]},'authentication':{'type':Sequelize[_0x5d79('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5d79('0x1')]},'password':{'type':Sequelize[_0x5d79('0x1')]},'port':{'type':Sequelize[_0x5d79('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5d79('0x1')],'defaultValue':_0x5d79('0x4')},'connTimeout':{'type':Sequelize[_0x5d79('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5d79('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5d79('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 84bbf8a..312c64d 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 _0xcf25=['api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x5e10b1,_0x48b784){var _0x5c8830=function(_0x42f942){while(--_0x42f942){_0x5e10b1['push'](_0x5e10b1['shift']());}};_0x5c8830(++_0x48b784);}(_0xcf25,0xb3));var _0x5cf2=function(_0x24f4c4,_0x17e225){_0x24f4c4=_0x24f4c4-0x0;var _0x5f4a99=_0xcf25[_0x24f4c4];return _0x5f4a99;};'use strict';var _=require(_0x5cf2('0x0'));var util=require(_0x5cf2('0x1'));var logger=require(_0x5cf2('0x2'))(_0x5cf2('0x3'));var moment=require(_0x5cf2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cf2('0x5'));var rimraf=require(_0x5cf2('0x6'));var config=require(_0x5cf2('0x7'));var attributes=require(_0x5cf2('0x8'));module[_0x5cf2('0x9')]=function(_0x5cd4a3,_0x10b0ce){return _0x5cd4a3[_0x5cf2('0xa')](_0x5cf2('0xb'),attributes,{'tableName':_0x5cf2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53f7=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x1988fa,_0x26b372){var _0x5d35e1=function(_0x4dff42){while(--_0x4dff42){_0x1988fa['push'](_0x1988fa['shift']());}};_0x5d35e1(++_0x26b372);}(_0x53f7,0x136));var _0x753f=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0x53f7[_0x5ece84];return _0x2a12c4;};'use strict';var _=require(_0x753f('0x0'));var util=require(_0x753f('0x1'));var logger=require(_0x753f('0x2'))(_0x753f('0x3'));var moment=require(_0x753f('0x4'));var BPromise=require(_0x753f('0x5'));var rp=require(_0x753f('0x6'));var fs=require('fs');var path=require(_0x753f('0x7'));var rimraf=require(_0x753f('0x8'));var config=require(_0x753f('0x9'));var attributes=require(_0x753f('0xa'));module[_0x753f('0xb')]=function(_0x5146b1,_0xa7aa3c){return _0x5146b1[_0x753f('0xc')](_0x753f('0xd'),attributes,{'tableName':_0x753f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 71bc8ab..4f4b91d 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 _0x20bc=['catch','GetMailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x52ab84,_0x384d32){var _0x481d6a=function(_0x2dc2cc){while(--_0x2dc2cc){_0x52ab84['push'](_0x52ab84['shift']());}};_0x481d6a(++_0x384d32);}(_0x20bc,0xb5));var _0xc20b=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x20bc[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0xc20b('0x0'));var util=require(_0xc20b('0x1'));var moment=require('moment');var BPromise=require(_0xc20b('0x2'));var rs=require(_0xc20b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc20b('0x4'))['db'];var utils=require(_0xc20b('0x5'));var logger=require(_0xc20b('0x6'))(_0xc20b('0x7'));var config=require(_0xc20b('0x8'));var jayson=require(_0xc20b('0x9'));var client=jayson[_0xc20b('0xa')][_0xc20b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c171b,_0x16db57,_0x30d929){return new BPromise(function(_0x15a272,_0x65d1f8){return client['request'](_0x3c171b,_0x30d929)[_0xc20b('0xc')](function(_0x974295){logger['info'](_0xc20b('0xd'),_0x16db57,_0xc20b('0xe'));logger[_0xc20b('0xf')](_0xc20b('0x10'),_0x16db57,'request\x20sent',JSON[_0xc20b('0x11')](_0x974295));if(_0x974295[_0xc20b('0x12')]){if(_0x974295['error'][_0xc20b('0x13')]===0x1f4){logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x974295[_0xc20b('0x12')][_0xc20b('0x14')]);return _0x65d1f8(_0x974295[_0xc20b('0x12')]['message']);}logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x974295[_0xc20b('0x12')][_0xc20b('0x14')]);return _0x15a272(_0x974295['error']['message']);}else{logger[_0xc20b('0x15')](_0xc20b('0xd'),_0x16db57,_0xc20b('0xe'));_0x15a272(_0x974295[_0xc20b('0x16')]['message']);}})[_0xc20b('0x17')](function(_0x37c42f){logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x37c42f);_0x65d1f8(_0x37c42f);});});}exports[_0xc20b('0x18')]=function(_0x5e349c){var _0x541ebe=this;return new Promise(function(_0x583e3f,_0x3ecba2){return db['MailServerIn'][_0xc20b('0x19')]({'raw':_0x5e349c[_0xc20b('0x1a')]?_0x5e349c[_0xc20b('0x1a')][_0xc20b('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e349c['options']?_0x5e349c[_0xc20b('0x1a')][_0xc20b('0x1c')]||null:null,'attributes':_0x5e349c[_0xc20b('0x1a')]?_0x5e349c['options']['attributes']||null:null,'limit':_0x5e349c[_0xc20b('0x1a')]?_0x5e349c[_0xc20b('0x1a')][_0xc20b('0x1d')]||null:null,'include':_0x5e349c[_0xc20b('0x1a')]?_0x5e349c[_0xc20b('0x1a')][_0xc20b('0x1e')]?_[_0xc20b('0x1f')](_0x5e349c[_0xc20b('0x1a')]['include'],function(_0x324796){return{'model':db[_0x324796[_0xc20b('0x20')]],'as':_0x324796['as'],'attributes':_0x324796[_0xc20b('0x21')],'include':_0x324796[_0xc20b('0x1e')]?_[_0xc20b('0x1f')](_0x324796[_0xc20b('0x1e')],function(_0x1d1704){return{'model':db[_0x1d1704[_0xc20b('0x20')]],'as':_0x1d1704['as'],'attributes':_0x1d1704[_0xc20b('0x21')],'include':_0x1d1704[_0xc20b('0x1e')]?_['map'](_0x1d1704[_0xc20b('0x1e')],function(_0x58881c){return{'model':db[_0x58881c[_0xc20b('0x20')]],'as':_0x58881c['as'],'attributes':_0x58881c[_0xc20b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54aba5){logger[_0xc20b('0x15')](_0xc20b('0x18'),_0x5e349c);logger['debug'](_0xc20b('0x18'),_0x5e349c,JSON[_0xc20b('0x11')](_0x54aba5));_0x583e3f(_0x54aba5);})[_0xc20b('0x17')](function(_0x49af8d){logger[_0xc20b('0x12')]('GetMailServerIn',_0x49af8d[_0xc20b('0x14')],_0x5e349c);_0x3ecba2(_0x541ebe[_0xc20b('0x12')](0x1f4,_0x49af8d['message']));});});}; \ No newline at end of file +var _0x2a31=['catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x157160,_0x443993){var _0x2d96e5=function(_0x55f166){while(--_0x55f166){_0x157160['push'](_0x157160['shift']());}};_0x2d96e5(++_0x443993);}(_0x2a31,0xe4));var _0x12a3=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2a31[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var moment=require(_0x12a3('0x2'));var BPromise=require(_0x12a3('0x3'));var rs=require(_0x12a3('0x4'));var fs=require('fs');var Redis=require(_0x12a3('0x5'));var db=require(_0x12a3('0x6'))['db'];var utils=require(_0x12a3('0x7'));var logger=require(_0x12a3('0x8'))(_0x12a3('0x9'));var config=require(_0x12a3('0xa'));var jayson=require(_0x12a3('0xb'));var client=jayson[_0x12a3('0xc')][_0x12a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5411bc,_0xcf401f,_0x5e24b3){return new BPromise(function(_0x25703e,_0x4d6252){return client[_0x12a3('0xe')](_0x5411bc,_0x5e24b3)['then'](function(_0xc38543){logger['info'](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));logger[_0x12a3('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xcf401f,'request\x20sent',JSON[_0x12a3('0x12')](_0xc38543));if(_0xc38543[_0x12a3('0x13')]){if(_0xc38543[_0x12a3('0x13')][_0x12a3('0x14')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x4d6252(_0xc38543[_0x12a3('0x13')][_0x12a3('0x15')]);}logger['error'](_0x12a3('0xf'),_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x25703e(_0xc38543['error'][_0x12a3('0x15')]);}else{logger[_0x12a3('0x16')](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));_0x25703e(_0xc38543[_0x12a3('0x17')][_0x12a3('0x15')]);}})[_0x12a3('0x18')](function(_0x471db6){logger[_0x12a3('0x13')](_0x12a3('0xf'),_0xcf401f,_0x471db6);_0x4d6252(_0x471db6);});});}exports[_0x12a3('0x19')]=function(_0xa0f618){var _0x1873f6=this;return new Promise(function(_0x3dbbe0,_0x395686){return db[_0x12a3('0x1a')][_0x12a3('0x1b')]({'raw':_0xa0f618[_0x12a3('0x1c')]?_0xa0f618[_0x12a3('0x1c')][_0x12a3('0x1d')]===undefined?!![]:![]:!![],'where':_0xa0f618[_0x12a3('0x1c')]?_0xa0f618[_0x12a3('0x1c')][_0x12a3('0x1e')]||null:null,'attributes':_0xa0f618['options']?_0xa0f618[_0x12a3('0x1c')][_0x12a3('0x1f')]||null:null,'limit':_0xa0f618[_0x12a3('0x1c')]?_0xa0f618[_0x12a3('0x1c')][_0x12a3('0x20')]||null:null,'include':_0xa0f618[_0x12a3('0x1c')]?_0xa0f618['options']['include']?_[_0x12a3('0x21')](_0xa0f618[_0x12a3('0x1c')][_0x12a3('0x22')],function(_0x16e39d){return{'model':db[_0x16e39d[_0x12a3('0x23')]],'as':_0x16e39d['as'],'attributes':_0x16e39d[_0x12a3('0x1f')],'include':_0x16e39d[_0x12a3('0x22')]?_[_0x12a3('0x21')](_0x16e39d[_0x12a3('0x22')],function(_0x53f3cb){return{'model':db[_0x53f3cb[_0x12a3('0x23')]],'as':_0x53f3cb['as'],'attributes':_0x53f3cb['attributes'],'include':_0x53f3cb['include']?_[_0x12a3('0x21')](_0x53f3cb['include'],function(_0x1418d9){return{'model':db[_0x1418d9[_0x12a3('0x23')]],'as':_0x1418d9['as'],'attributes':_0x1418d9[_0x12a3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3365b7){logger['info'](_0x12a3('0x19'),_0xa0f618);logger[_0x12a3('0x11')](_0x12a3('0x19'),_0xa0f618,JSON[_0x12a3('0x12')](_0x3365b7));_0x3dbbe0(_0x3365b7);})[_0x12a3('0x18')](function(_0x7075ab){logger[_0x12a3('0x13')](_0x12a3('0x19'),_0x7075ab['message'],_0xa0f618);_0x395686(_0x1873f6['error'](0x1f4,_0x7075ab['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a3a1605..57311e3 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x272b3a,_0x19d313){_0x272b3a=_0x272b3a-0x0;var _0x502bfd=_0x7a54[_0x272b3a];return _0x502bfd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x9ae911,_0x588dd9){_0x9ae911=_0x9ae911-0x0;var _0x1e1f65=_0x7a54[_0x9ae911];return _0x1e1f65;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 724f9bf..778e19c 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 _0xf45e=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x49b73b,_0x1ad0e7){var _0x4f7344=function(_0x5cb780){while(--_0x5cb780){_0x49b73b['push'](_0x49b73b['shift']());}};_0x4f7344(++_0x1ad0e7);}(_0xf45e,0x115));var _0xef45=function(_0x3637a2,_0x3de087){_0x3637a2=_0x3637a2-0x0;var _0x439550=_0xf45e[_0x3637a2];return _0x439550;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'description':{'type':Sequelize[_0xef45('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xef45('0x1')]},'pass':{'type':Sequelize[_0xef45('0x1')]},'port':{'type':Sequelize[_0xef45('0x2')]},'secure':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xef45('0x1')]},'authentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3266=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x513e5f,_0x3ff078){var _0x5048ca=function(_0x1a6f67){while(--_0x1a6f67){_0x513e5f['push'](_0x513e5f['shift']());}};_0x5048ca(++_0x3ff078);}(_0x3266,0x6a));var _0x6326=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x3266[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'description':{'type':Sequelize[_0x6326('0x2')]},'host':{'type':Sequelize[_0x6326('0x2')]},'user':{'type':Sequelize[_0x6326('0x2')]},'pass':{'type':Sequelize[_0x6326('0x2')]},'port':{'type':Sequelize[_0x6326('0x3')]},'secure':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6326('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6326('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 68747b0..7976145 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 _0x4dde=['desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','params','intersection','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2a83af,_0x4fa9ed){var _0x2e1648=function(_0x59c429){while(--_0x59c429){_0x2a83af['push'](_0x2a83af['shift']());}};_0x2e1648(++_0x4fa9ed);}(_0x4dde,0x1a7));var _0xe4dd=function(_0x5ad64c,_0x10b434){_0x5ad64c=_0x5ad64c-0x0;var _0x45e603=_0x4dde[_0x5ad64c];return _0x45e603;};'use strict';var emlformat=require(_0xe4dd('0x0'));var rimraf=require(_0xe4dd('0x1'));var zipdir=require(_0xe4dd('0x2'));var jsonpatch=require(_0xe4dd('0x3'));var rp=require(_0xe4dd('0x4'));var moment=require(_0xe4dd('0x5'));var BPromise=require(_0xe4dd('0x6'));var Mustache=require('mustache');var util=require(_0xe4dd('0x7'));var path=require(_0xe4dd('0x8'));var sox=require('sox');var csv=require(_0xe4dd('0x9'));var ejs=require(_0xe4dd('0xa'));var fs=require('fs');var fs_extra=require(_0xe4dd('0xb'));var _=require(_0xe4dd('0xc'));var squel=require(_0xe4dd('0xd'));var crypto=require(_0xe4dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe4dd('0xf'));var toCsv=require(_0xe4dd('0x9'));var querystring=require(_0xe4dd('0x10'));var Papa=require(_0xe4dd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4dd('0x12'));var logger=require(_0xe4dd('0x13'))(_0xe4dd('0x14'));var utils=require('../../config/utils');var config=require(_0xe4dd('0x15'));var licenseUtil=require(_0xe4dd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aea4f,_0x2da7b3){_0x2da7b3=_0x2da7b3||0xcc;return function(_0x52c906){if(_0x52c906){return _0x1aea4f[_0xe4dd('0x17')](_0x2da7b3);}return _0x1aea4f['status'](_0x2da7b3)['end']();};}function respondWithResult(_0x513ba2,_0x2cf312){_0x2cf312=_0x2cf312||0xc8;return function(_0x15bc48){if(_0x15bc48){return _0x513ba2['status'](_0x2cf312)[_0xe4dd('0x18')](_0x15bc48);}};}function respondWithFilteredResult(_0xc6e360,_0x132c31){return function(_0x545ada){if(_0x545ada){var _0x5171c2=typeof _0x132c31[_0xe4dd('0x19')]==='undefined'&&typeof _0x132c31[_0xe4dd('0x1a')]===_0xe4dd('0x1b');var _0x3e3169=_0x545ada[_0xe4dd('0x1c')];var _0x3c1211=_0x5171c2?0x0:_0x132c31['offset'];var _0x4831c1=_0x5171c2?_0x545ada[_0xe4dd('0x1c')]:_0x132c31['offset']+_0x132c31[_0xe4dd('0x1a')];var _0x4f38c6;if(_0x4831c1>=_0x3e3169){_0x4831c1=_0x3e3169;_0x4f38c6=0xc8;}else{_0x4f38c6=0xce;}_0xc6e360[_0xe4dd('0x1d')](_0x4f38c6);return _0xc6e360[_0xe4dd('0x1e')](_0xe4dd('0x1f'),_0x3c1211+'-'+_0x4831c1+'/'+_0x3e3169)[_0xe4dd('0x18')](_0x545ada);}return null;};}function patchUpdates(_0x1fade3){return function(_0x43f283){try{jsonpatch['apply'](_0x43f283,_0x1fade3,!![]);}catch(_0x6b83a8){return BPromise[_0xe4dd('0x20')](_0x6b83a8);}return _0x43f283[_0xe4dd('0x21')]();};}function saveUpdates(_0x44ad77,_0x532e44){return function(_0x2d5588){if(_0x2d5588){return _0x2d5588[_0xe4dd('0x22')](_0x44ad77)[_0xe4dd('0x23')](function(_0x40ab2e){return _0x40ab2e;});}return null;};}function removeEntity(_0x114bca,_0x2ae5ce){return function(_0x32ce05){if(_0x32ce05){return _0x32ce05['destroy']()[_0xe4dd('0x23')](function(){_0x114bca[_0xe4dd('0x1d')](0xcc)[_0xe4dd('0x24')]();});}};}function handleEntityNotFound(_0x3298aa,_0x3e3b1d){return function(_0x4b8210){if(!_0x4b8210){_0x3298aa[_0xe4dd('0x17')](0x194);}return _0x4b8210;};}function handleError(_0x3e2087,_0x5146a2){_0x5146a2=_0x5146a2||0x1f4;return function(_0x3c67f4){logger[_0xe4dd('0x25')](_0x3c67f4[_0xe4dd('0x26')]);if(_0x3c67f4[_0xe4dd('0x27')]){delete _0x3c67f4[_0xe4dd('0x27')];}_0x3e2087[_0xe4dd('0x1d')](_0x5146a2)[_0xe4dd('0x28')](_0x3c67f4);};}exports[_0xe4dd('0x29')]=function(_0xc2a464,_0x374dba){var _0x3c4ee9={},_0x238462={},_0x431d3f={'count':0x0,'rows':[]};var _0xf8af67=_[_0xe4dd('0x2a')](db[_0xe4dd('0x2b')][_0xe4dd('0x2c')],function(_0x482c1f){return{'name':_0x482c1f[_0xe4dd('0x2d')],'type':_0x482c1f[_0xe4dd('0x2e')]['key']};});_0x238462[_0xe4dd('0x2f')]=_[_0xe4dd('0x2a')](_0xf8af67,_0xe4dd('0x27'));_0x238462[_0xe4dd('0x30')]=_[_0xe4dd('0x31')](_0xc2a464[_0xe4dd('0x30')]);_0x238462['filters']=_['intersection'](_0x238462[_0xe4dd('0x2f')],_0x238462[_0xe4dd('0x30')]);_0x3c4ee9[_0xe4dd('0x32')]=_['intersection'](_0x238462[_0xe4dd('0x2f')],qs[_0xe4dd('0x33')](_0xc2a464[_0xe4dd('0x30')][_0xe4dd('0x33')]));_0x3c4ee9['attributes']=_0x3c4ee9[_0xe4dd('0x32')][_0xe4dd('0x34')]?_0x3c4ee9[_0xe4dd('0x32')]:_0x238462[_0xe4dd('0x2f')];if(!_0xc2a464[_0xe4dd('0x30')][_0xe4dd('0x35')](_0xe4dd('0x36'))){_0x3c4ee9[_0xe4dd('0x1a')]=qs[_0xe4dd('0x1a')](_0xc2a464[_0xe4dd('0x30')]['limit']);_0x3c4ee9[_0xe4dd('0x19')]=qs[_0xe4dd('0x19')](_0xc2a464['query'][_0xe4dd('0x19')]);}_0x3c4ee9[_0xe4dd('0x37')]=qs[_0xe4dd('0x38')](_0xc2a464['query']['sort']);_0x3c4ee9[_0xe4dd('0x39')]=qs['filters'](_[_0xe4dd('0x3a')](_0xc2a464[_0xe4dd('0x30')],_0x238462[_0xe4dd('0x3b')]),_0xf8af67);if(_0xc2a464[_0xe4dd('0x30')][_0xe4dd('0x3c')]){_0x3c4ee9[_0xe4dd('0x39')]=_[_0xe4dd('0x3d')](_0x3c4ee9['where'],{'$or':_[_0xe4dd('0x2a')](_0xf8af67,function(_0x3b9b03){if(_0x3b9b03['type']!==_0xe4dd('0x3e')){var _0x11ee17={};_0x11ee17[_0x3b9b03[_0xe4dd('0x27')]]={'$like':'%'+_0xc2a464[_0xe4dd('0x30')][_0xe4dd('0x3c')]+'%'};return _0x11ee17;}})});}_0x3c4ee9=_[_0xe4dd('0x3d')]({},_0x3c4ee9,_0xc2a464[_0xe4dd('0x3f')]);var _0x123ce5={'where':_0x3c4ee9[_0xe4dd('0x39')]};return db[_0xe4dd('0x2b')]['count'](_0x123ce5)[_0xe4dd('0x23')](function(_0x1b599e){_0x431d3f[_0xe4dd('0x1c')]=_0x1b599e;if(_0xc2a464[_0xe4dd('0x30')][_0xe4dd('0x40')]){_0x3c4ee9[_0xe4dd('0x41')]=[{'all':!![]}];}return db[_0xe4dd('0x2b')]['findAll'](_0x3c4ee9);})[_0xe4dd('0x23')](function(_0x3de29c){_0x431d3f[_0xe4dd('0x42')]=_0x3de29c;return _0x431d3f;})[_0xe4dd('0x23')](respondWithFilteredResult(_0x374dba,_0x3c4ee9))['catch'](handleError(_0x374dba,null));};exports['show']=function(_0x10a267,_0x169dbb){var _0x3de58d={'raw':!![],'where':{'id':_0x10a267[_0xe4dd('0x43')]['id']}},_0x5bc71f={};_0x5bc71f['model']=_[_0xe4dd('0x31')](db[_0xe4dd('0x2b')][_0xe4dd('0x2c')]);_0x5bc71f['query']=_[_0xe4dd('0x31')](_0x10a267['query']);_0x5bc71f[_0xe4dd('0x3b')]=_[_0xe4dd('0x44')](_0x5bc71f[_0xe4dd('0x2f')],_0x5bc71f[_0xe4dd('0x30')]);_0x3de58d[_0xe4dd('0x32')]=_[_0xe4dd('0x44')](_0x5bc71f[_0xe4dd('0x2f')],qs[_0xe4dd('0x33')](_0x10a267['query'][_0xe4dd('0x33')]));_0x3de58d[_0xe4dd('0x32')]=_0x3de58d['attributes'][_0xe4dd('0x34')]?_0x3de58d[_0xe4dd('0x32')]:_0x5bc71f[_0xe4dd('0x2f')];if(_0x10a267[_0xe4dd('0x30')][_0xe4dd('0x40')]){_0x3de58d[_0xe4dd('0x41')]=[{'all':!![]}];}_0x3de58d=_[_0xe4dd('0x3d')]({},_0x3de58d,_0x10a267[_0xe4dd('0x3f')]);return db['MailServerOut']['find'](_0x3de58d)[_0xe4dd('0x23')](handleEntityNotFound(_0x169dbb,null))[_0xe4dd('0x23')](respondWithResult(_0x169dbb,null))[_0xe4dd('0x45')](handleError(_0x169dbb,null));};exports['create']=function(_0x17ae69,_0x334a71){return db[_0xe4dd('0x2b')][_0xe4dd('0x46')](_0x17ae69[_0xe4dd('0x47')],{})['then'](respondWithResult(_0x334a71,0xc9))['catch'](handleError(_0x334a71,null));};exports[_0xe4dd('0x22')]=function(_0x3abecb,_0x15732d){if(_0x3abecb[_0xe4dd('0x47')]['id']){delete _0x3abecb[_0xe4dd('0x47')]['id'];}return db[_0xe4dd('0x2b')]['find']({'where':{'id':_0x3abecb[_0xe4dd('0x43')]['id']}})[_0xe4dd('0x23')](handleEntityNotFound(_0x15732d,null))[_0xe4dd('0x23')](saveUpdates(_0x3abecb[_0xe4dd('0x47')],null))[_0xe4dd('0x23')](respondWithResult(_0x15732d,null))['catch'](handleError(_0x15732d,null));};exports[_0xe4dd('0x48')]=function(_0x326d67,_0x2cb73b){return db[_0xe4dd('0x2b')]['find']({'where':{'id':_0x326d67['params']['id']}})[_0xe4dd('0x23')](handleEntityNotFound(_0x2cb73b,null))[_0xe4dd('0x23')](removeEntity(_0x2cb73b,null))[_0xe4dd('0x45')](handleError(_0x2cb73b,null));}; \ No newline at end of file +var _0xbefa=['findAll','catch','show','params','intersection','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','MailServerOut','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbefa,0x1e9));var _0xabef=function(_0x3ccee8,_0x25de90){_0x3ccee8=_0x3ccee8-0x0;var _0x370129=_0xbefa[_0x3ccee8];return _0x370129;};'use strict';var emlformat=require(_0xabef('0x0'));var rimraf=require(_0xabef('0x1'));var zipdir=require(_0xabef('0x2'));var jsonpatch=require(_0xabef('0x3'));var rp=require(_0xabef('0x4'));var moment=require(_0xabef('0x5'));var BPromise=require(_0xabef('0x6'));var Mustache=require(_0xabef('0x7'));var util=require(_0xabef('0x8'));var path=require(_0xabef('0x9'));var sox=require(_0xabef('0xa'));var csv=require(_0xabef('0xb'));var ejs=require(_0xabef('0xc'));var fs=require('fs');var fs_extra=require(_0xabef('0xd'));var _=require(_0xabef('0xe'));var squel=require(_0xabef('0xf'));var crypto=require(_0xabef('0x10'));var jsforce=require(_0xabef('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xabef('0xb'));var querystring=require(_0xabef('0x12'));var Papa=require(_0xabef('0x13'));var Redis=require(_0xabef('0x14'));var authService=require(_0xabef('0x15'));var qs=require(_0xabef('0x16'));var as=require(_0xabef('0x17'));var hardwareService=require(_0xabef('0x18'));var logger=require(_0xabef('0x19'))(_0xabef('0x1a'));var utils=require(_0xabef('0x1b'));var config=require(_0xabef('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xabef('0x1d'))['db'];function respondWithStatusCode(_0x54496a,_0x22cdc5){_0x22cdc5=_0x22cdc5||0xcc;return function(_0x251a30){if(_0x251a30){return _0x54496a['sendStatus'](_0x22cdc5);}return _0x54496a[_0xabef('0x1e')](_0x22cdc5)[_0xabef('0x1f')]();};}function respondWithResult(_0x2cc67c,_0x310df3){_0x310df3=_0x310df3||0xc8;return function(_0x4a2a02){if(_0x4a2a02){return _0x2cc67c['status'](_0x310df3)[_0xabef('0x20')](_0x4a2a02);}};}function respondWithFilteredResult(_0x389561,_0x5d7aaf){return function(_0x191da3){if(_0x191da3){var _0x1df90b=typeof _0x5d7aaf['offset']===_0xabef('0x21')&&typeof _0x5d7aaf['limit']===_0xabef('0x21');var _0x197c0f=_0x191da3['count'];var _0x36565c=_0x1df90b?0x0:_0x5d7aaf[_0xabef('0x22')];var _0x36f925=_0x1df90b?_0x191da3[_0xabef('0x23')]:_0x5d7aaf['offset']+_0x5d7aaf[_0xabef('0x24')];var _0x10fffa;if(_0x36f925>=_0x197c0f){_0x36f925=_0x197c0f;_0x10fffa=0xc8;}else{_0x10fffa=0xce;}_0x389561[_0xabef('0x1e')](_0x10fffa);return _0x389561[_0xabef('0x25')](_0xabef('0x26'),_0x36565c+'-'+_0x36f925+'/'+_0x197c0f)[_0xabef('0x20')](_0x191da3);}return null;};}function patchUpdates(_0x4f10d5){return function(_0x14b909){try{jsonpatch[_0xabef('0x27')](_0x14b909,_0x4f10d5,!![]);}catch(_0x19f37d){return BPromise[_0xabef('0x28')](_0x19f37d);}return _0x14b909[_0xabef('0x29')]();};}function saveUpdates(_0x5cc90c,_0x443773){return function(_0x39b1d5){if(_0x39b1d5){return _0x39b1d5[_0xabef('0x2a')](_0x5cc90c)['then'](function(_0x3521aa){return _0x3521aa;});}return null;};}function removeEntity(_0x48535c,_0x4f4158){return function(_0x1dddac){if(_0x1dddac){return _0x1dddac[_0xabef('0x2b')]()[_0xabef('0x2c')](function(){_0x48535c['status'](0xcc)[_0xabef('0x1f')]();});}};}function handleEntityNotFound(_0x4b9b71,_0x4efd14){return function(_0x1f8218){if(!_0x1f8218){_0x4b9b71[_0xabef('0x2d')](0x194);}return _0x1f8218;};}function handleError(_0x3a32e3,_0x420908){_0x420908=_0x420908||0x1f4;return function(_0x115d71){logger['error'](_0x115d71[_0xabef('0x2e')]);if(_0x115d71['name']){delete _0x115d71[_0xabef('0x2f')];}_0x3a32e3[_0xabef('0x1e')](_0x420908)[_0xabef('0x30')](_0x115d71);};}exports[_0xabef('0x31')]=function(_0x2c45bb,_0x2e6b71){var _0x4e7e76={},_0x1afcb2={},_0x5c72ae={'count':0x0,'rows':[]};var _0x2c9238=_['map'](db[_0xabef('0x32')][_0xabef('0x33')],function(_0x477d3c){return{'name':_0x477d3c[_0xabef('0x34')],'type':_0x477d3c['type'][_0xabef('0x35')]};});_0x1afcb2[_0xabef('0x36')]=_[_0xabef('0x37')](_0x2c9238,_0xabef('0x2f'));_0x1afcb2['query']=_[_0xabef('0x38')](_0x2c45bb[_0xabef('0x39')]);_0x1afcb2[_0xabef('0x3a')]=_['intersection'](_0x1afcb2[_0xabef('0x36')],_0x1afcb2[_0xabef('0x39')]);_0x4e7e76[_0xabef('0x3b')]=_['intersection'](_0x1afcb2[_0xabef('0x36')],qs['fields'](_0x2c45bb['query'][_0xabef('0x3c')]));_0x4e7e76[_0xabef('0x3b')]=_0x4e7e76[_0xabef('0x3b')][_0xabef('0x3d')]?_0x4e7e76[_0xabef('0x3b')]:_0x1afcb2[_0xabef('0x36')];if(!_0x2c45bb[_0xabef('0x39')][_0xabef('0x3e')]('nolimit')){_0x4e7e76[_0xabef('0x24')]=qs[_0xabef('0x24')](_0x2c45bb[_0xabef('0x39')][_0xabef('0x24')]);_0x4e7e76['offset']=qs[_0xabef('0x22')](_0x2c45bb[_0xabef('0x39')][_0xabef('0x22')]);}_0x4e7e76[_0xabef('0x3f')]=qs[_0xabef('0x40')](_0x2c45bb['query'][_0xabef('0x40')]);_0x4e7e76[_0xabef('0x41')]=qs[_0xabef('0x3a')](_['pick'](_0x2c45bb[_0xabef('0x39')],_0x1afcb2['filters']),_0x2c9238);if(_0x2c45bb['query']['filter']){_0x4e7e76[_0xabef('0x41')]=_[_0xabef('0x42')](_0x4e7e76[_0xabef('0x41')],{'$or':_[_0xabef('0x37')](_0x2c9238,function(_0x4422bb){if(_0x4422bb['type']!==_0xabef('0x43')){var _0x4b7e0a={};_0x4b7e0a[_0x4422bb[_0xabef('0x2f')]]={'$like':'%'+_0x2c45bb['query'][_0xabef('0x44')]+'%'};return _0x4b7e0a;}})});}_0x4e7e76=_[_0xabef('0x42')]({},_0x4e7e76,_0x2c45bb['options']);var _0x3abff3={'where':_0x4e7e76[_0xabef('0x41')]};return db[_0xabef('0x32')][_0xabef('0x23')](_0x3abff3)['then'](function(_0x4a4a8a){_0x5c72ae['count']=_0x4a4a8a;if(_0x2c45bb['query'][_0xabef('0x45')]){_0x4e7e76[_0xabef('0x46')]=[{'all':!![]}];}return db['MailServerOut'][_0xabef('0x47')](_0x4e7e76);})[_0xabef('0x2c')](function(_0x64d581){_0x5c72ae['rows']=_0x64d581;return _0x5c72ae;})[_0xabef('0x2c')](respondWithFilteredResult(_0x2e6b71,_0x4e7e76))[_0xabef('0x48')](handleError(_0x2e6b71,null));};exports[_0xabef('0x49')]=function(_0x4f879f,_0x131a81){var _0x53c18d={'raw':!![],'where':{'id':_0x4f879f[_0xabef('0x4a')]['id']}},_0x4fab6e={};_0x4fab6e['model']=_[_0xabef('0x38')](db[_0xabef('0x32')][_0xabef('0x33')]);_0x4fab6e['query']=_['keys'](_0x4f879f[_0xabef('0x39')]);_0x4fab6e[_0xabef('0x3a')]=_[_0xabef('0x4b')](_0x4fab6e[_0xabef('0x36')],_0x4fab6e[_0xabef('0x39')]);_0x53c18d[_0xabef('0x3b')]=_[_0xabef('0x4b')](_0x4fab6e[_0xabef('0x36')],qs[_0xabef('0x3c')](_0x4f879f['query']['fields']));_0x53c18d[_0xabef('0x3b')]=_0x53c18d[_0xabef('0x3b')][_0xabef('0x3d')]?_0x53c18d[_0xabef('0x3b')]:_0x4fab6e[_0xabef('0x36')];if(_0x4f879f[_0xabef('0x39')][_0xabef('0x45')]){_0x53c18d[_0xabef('0x46')]=[{'all':!![]}];}_0x53c18d=_['merge']({},_0x53c18d,_0x4f879f[_0xabef('0x4c')]);return db['MailServerOut'][_0xabef('0x4d')](_0x53c18d)[_0xabef('0x2c')](handleEntityNotFound(_0x131a81,null))['then'](respondWithResult(_0x131a81,null))[_0xabef('0x48')](handleError(_0x131a81,null));};exports['create']=function(_0x460539,_0x14d089){return db['MailServerOut'][_0xabef('0x4e')](_0x460539['body'],{})[_0xabef('0x2c')](respondWithResult(_0x14d089,0xc9))[_0xabef('0x48')](handleError(_0x14d089,null));};exports[_0xabef('0x2a')]=function(_0x39af2e,_0x5e5290){if(_0x39af2e['body']['id']){delete _0x39af2e[_0xabef('0x4f')]['id'];}return db[_0xabef('0x32')][_0xabef('0x4d')]({'where':{'id':_0x39af2e[_0xabef('0x4a')]['id']}})[_0xabef('0x2c')](handleEntityNotFound(_0x5e5290,null))[_0xabef('0x2c')](saveUpdates(_0x39af2e[_0xabef('0x4f')],null))[_0xabef('0x2c')](respondWithResult(_0x5e5290,null))[_0xabef('0x48')](handleError(_0x5e5290,null));};exports[_0xabef('0x2b')]=function(_0x43ac5f,_0xd0aec9){return db['MailServerOut'][_0xabef('0x4d')]({'where':{'id':_0x43ac5f[_0xabef('0x4a')]['id']}})[_0xabef('0x2c')](handleEntityNotFound(_0xd0aec9,null))[_0xabef('0x2c')](removeEntity(_0xd0aec9,null))[_0xabef('0x48')](handleError(_0xd0aec9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d7cf614..65d5c83 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 _0x0ce1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x0ce1,0x97));var _0x10ce=function(_0x4e5ca9,_0x23d2cd){_0x4e5ca9=_0x4e5ca9-0x0;var _0x552ad5=_0x0ce1[_0x4e5ca9];return _0x552ad5;};'use strict';var _=require(_0x10ce('0x0'));var util=require(_0x10ce('0x1'));var logger=require(_0x10ce('0x2'))(_0x10ce('0x3'));var moment=require(_0x10ce('0x4'));var BPromise=require(_0x10ce('0x5'));var rp=require(_0x10ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10ce('0x7'));var config=require(_0x10ce('0x8'));var attributes=require(_0x10ce('0x9'));module[_0x10ce('0xa')]=function(_0x4550dd,_0xd020e9){return _0x4550dd[_0x10ce('0xb')](_0x10ce('0xc'),attributes,{'tableName':_0x10ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','util','../../config/logger'];(function(_0x5f55d6,_0x4cdd6f){var _0x3ba746=function(_0x4deaf8){while(--_0x4deaf8){_0x5f55d6['push'](_0x5f55d6['shift']());}};_0x3ba746(++_0x4cdd6f);}(_0x64b9,0x82));var _0x964b=function(_0xcf5917,_0x3b7a91){_0xcf5917=_0xcf5917-0x0;var _0x131466=_0x64b9[_0xcf5917];return _0x131466;};'use strict';var _=require('lodash');var util=require(_0x964b('0x0'));var logger=require(_0x964b('0x1'))(_0x964b('0x2'));var moment=require(_0x964b('0x3'));var BPromise=require(_0x964b('0x4'));var rp=require(_0x964b('0x5'));var fs=require('fs');var path=require(_0x964b('0x6'));var rimraf=require(_0x964b('0x7'));var config=require(_0x964b('0x8'));var attributes=require(_0x964b('0x9'));module[_0x964b('0xa')]=function(_0xafd96d,_0x33e5b0){return _0xafd96d[_0x964b('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 3ad2068..eccd3cf 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x16779c,_0x5502a2){var _0xcf8cb1=function(_0x8cc706){while(--_0x8cc706){_0x16779c['push'](_0x16779c['shift']());}};_0xcf8cb1(++_0x5502a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b0f29,_0x3d6f36){_0x5b0f29=_0x5b0f29-0x0;var _0x27a26a=_0x5f2f[_0x5b0f29];return _0x27a26a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x342548,_0x31c72e){var _0x107140=function(_0x32c2ab){while(--_0x32c2ab){_0x342548['push'](_0x342548['shift']());}};_0x107140(++_0x31c72e);}(_0xadb5,0xad));var _0x5adb=function(_0x3cefd0,_0x1d614a){_0x3cefd0=_0x3cefd0-0x0;var _0x41042b=_0xadb5[_0x3cefd0];return _0x41042b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fd1fae5..a7357d7 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 _0x88c6=['update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x88c6,0x6c));var _0x688c=function(_0x14153a,_0x127448){_0x14153a=_0x14153a-0x0;var _0x3ad489=_0x88c6[_0x14153a];return _0x3ad489;};'use strict';var multer=require(_0x688c('0x0'));var util=require(_0x688c('0x1'));var path=require(_0x688c('0x2'));var timeout=require(_0x688c('0x3'));var express=require('express');var router=express[_0x688c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x688c('0x5'));var interaction=require(_0x688c('0x6'));var config=require(_0x688c('0x7'));var controller=require(_0x688c('0x8'));router[_0x688c('0x9')]('/',auth[_0x688c('0xa')](),controller[_0x688c('0xb')]);router['get'](_0x688c('0xc'),auth[_0x688c('0xa')](),controller[_0x688c('0xd')]);router[_0x688c('0x9')](_0x688c('0xe'),auth[_0x688c('0xa')](),controller['show']);router[_0x688c('0xf')]('/',auth[_0x688c('0xa')](),controller[_0x688c('0x10')]);router[_0x688c('0x11')]('/:id',auth[_0x688c('0xa')](),controller[_0x688c('0x12')]);router[_0x688c('0x13')](_0x688c('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x688c('0x14')]=router; \ No newline at end of file +var _0x35b0=['describe','/:id','show','create','put','update','delete','destroy','exports','util','Router','./mailSubstatus.controller','get','index','isAuthenticated'];(function(_0x140622,_0x4abe75){var _0x48a9d2=function(_0x4b51c0){while(--_0x4b51c0){_0x140622['push'](_0x140622['shift']());}};_0x48a9d2(++_0x4abe75);}(_0x35b0,0x19e));var _0x035b=function(_0x35968c,_0x50c1b6){_0x35968c=_0x35968c-0x0;var _0x15f31c=_0x35b0[_0x35968c];return _0x15f31c;};'use strict';var multer=require('multer');var util=require(_0x035b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x035b('0x1')]();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(_0x035b('0x2'));router[_0x035b('0x3')]('/',auth['isAuthenticated'](),controller[_0x035b('0x4')]);router['get']('/describe',auth[_0x035b('0x5')](),controller[_0x035b('0x6')]);router[_0x035b('0x3')](_0x035b('0x7'),auth[_0x035b('0x5')](),controller[_0x035b('0x8')]);router['post']('/',auth[_0x035b('0x5')](),controller[_0x035b('0x9')]);router[_0x035b('0xa')](_0x035b('0x7'),auth[_0x035b('0x5')](),controller[_0x035b('0xb')]);router[_0x035b('0xc')](_0x035b('0x7'),auth[_0x035b('0x5')](),controller[_0x035b('0xd')]);module[_0x035b('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f3212da..f5ea2ce 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 _0x4300=['sequelize'];(function(_0x146938,_0x55b3ee){var _0x43c72b=function(_0x449f4d){while(--_0x449f4d){_0x146938['push'](_0x146938['shift']());}};_0x43c72b(++_0x55b3ee);}(_0x4300,0x1a6));var _0x0430=function(_0xee684,_0x3656f9){_0xee684=_0xee684-0x0;var _0x12cbe6=_0x4300[_0xee684];return _0x12cbe6;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01d9=['sequelize','exports','STRING','name'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 670c7ee..aad1791 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 _0xdbde=['offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','filters','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0xdbde,0x14c));var _0xedbd=function(_0x44bb12,_0x524525){_0x44bb12=_0x44bb12-0x0;var _0x26f50c=_0xdbde[_0x44bb12];return _0x26f50c;};'use strict';var emlformat=require(_0xedbd('0x0'));var rimraf=require(_0xedbd('0x1'));var zipdir=require(_0xedbd('0x2'));var jsonpatch=require(_0xedbd('0x3'));var rp=require('request-promise');var moment=require(_0xedbd('0x4'));var BPromise=require(_0xedbd('0x5'));var Mustache=require(_0xedbd('0x6'));var util=require('util');var path=require(_0xedbd('0x7'));var sox=require(_0xedbd('0x8'));var csv=require(_0xedbd('0x9'));var ejs=require(_0xedbd('0xa'));var fs=require('fs');var fs_extra=require(_0xedbd('0xb'));var _=require(_0xedbd('0xc'));var squel=require(_0xedbd('0xd'));var crypto=require(_0xedbd('0xe'));var jsforce=require(_0xedbd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xedbd('0x9'));var querystring=require(_0xedbd('0x10'));var Papa=require(_0xedbd('0x11'));var Redis=require('ioredis');var authService=require(_0xedbd('0x12'));var qs=require(_0xedbd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedbd('0x14'));var logger=require('../../config/logger')(_0xedbd('0x15'));var utils=require('../../config/utils');var config=require(_0xedbd('0x16'));var licenseUtil=require(_0xedbd('0x17'));var db=require(_0xedbd('0x18'))['db'];function respondWithStatusCode(_0x2919db,_0x72cf6a){_0x72cf6a=_0x72cf6a||0xcc;return function(_0x28ff0f){if(_0x28ff0f){return _0x2919db[_0xedbd('0x19')](_0x72cf6a);}return _0x2919db[_0xedbd('0x1a')](_0x72cf6a)[_0xedbd('0x1b')]();};}function respondWithResult(_0x18fb20,_0x3c3378){_0x3c3378=_0x3c3378||0xc8;return function(_0x225187){if(_0x225187){return _0x18fb20['status'](_0x3c3378)['json'](_0x225187);}};}function respondWithFilteredResult(_0xdee1bc,_0x28b6f1){return function(_0x5abb26){if(_0x5abb26){var _0xa87d0f=typeof _0x28b6f1[_0xedbd('0x1c')]===_0xedbd('0x1d')&&typeof _0x28b6f1[_0xedbd('0x1e')]===_0xedbd('0x1d');var _0x1dabe4=_0x5abb26[_0xedbd('0x1f')];var _0x37de68=_0xa87d0f?0x0:_0x28b6f1['offset'];var _0x3ca859=_0xa87d0f?_0x5abb26[_0xedbd('0x1f')]:_0x28b6f1[_0xedbd('0x1c')]+_0x28b6f1[_0xedbd('0x1e')];var _0x44d615;if(_0x3ca859>=_0x1dabe4){_0x3ca859=_0x1dabe4;_0x44d615=0xc8;}else{_0x44d615=0xce;}_0xdee1bc[_0xedbd('0x1a')](_0x44d615);return _0xdee1bc['set']('Content-Range',_0x37de68+'-'+_0x3ca859+'/'+_0x1dabe4)['json'](_0x5abb26);}return null;};}function patchUpdates(_0x32c5e8){return function(_0xa84baa){try{jsonpatch[_0xedbd('0x20')](_0xa84baa,_0x32c5e8,!![]);}catch(_0x2f3630){return BPromise[_0xedbd('0x21')](_0x2f3630);}return _0xa84baa['save']();};}function saveUpdates(_0x5e6a3f,_0x200468){return function(_0xdff31c){if(_0xdff31c){return _0xdff31c[_0xedbd('0x22')](_0x5e6a3f)[_0xedbd('0x23')](function(_0x3433c6){return _0x3433c6;});}return null;};}function removeEntity(_0x4117ff,_0x5d2f58){return function(_0x1bedc1){if(_0x1bedc1){return _0x1bedc1[_0xedbd('0x24')]()[_0xedbd('0x23')](function(){_0x4117ff['status'](0xcc)[_0xedbd('0x1b')]();});}};}function handleEntityNotFound(_0xc69519,_0x57e345){return function(_0x53328e){if(!_0x53328e){_0xc69519[_0xedbd('0x19')](0x194);}return _0x53328e;};}function handleError(_0x1e73df,_0x3299a0){_0x3299a0=_0x3299a0||0x1f4;return function(_0x3a823c){logger[_0xedbd('0x25')](_0x3a823c['stack']);if(_0x3a823c[_0xedbd('0x26')]){delete _0x3a823c[_0xedbd('0x26')];}_0x1e73df[_0xedbd('0x1a')](_0x3299a0)[_0xedbd('0x27')](_0x3a823c);};}exports[_0xedbd('0x28')]=function(_0x330ad6,_0x441d7b){var _0x4cd06a={},_0x48c1cb={},_0x1e00c4={'count':0x0,'rows':[]};var _0x488e99=_[_0xedbd('0x29')](db[_0xedbd('0x2a')]['rawAttributes'],function(_0x24c0ea){return{'name':_0x24c0ea[_0xedbd('0x2b')],'type':_0x24c0ea[_0xedbd('0x2c')][_0xedbd('0x2d')]};});_0x48c1cb[_0xedbd('0x2e')]=_[_0xedbd('0x29')](_0x488e99,'name');_0x48c1cb[_0xedbd('0x2f')]=_[_0xedbd('0x30')](_0x330ad6[_0xedbd('0x2f')]);_0x48c1cb['filters']=_[_0xedbd('0x31')](_0x48c1cb[_0xedbd('0x2e')],_0x48c1cb[_0xedbd('0x2f')]);_0x4cd06a['attributes']=_[_0xedbd('0x31')](_0x48c1cb['model'],qs[_0xedbd('0x32')](_0x330ad6['query'][_0xedbd('0x32')]));_0x4cd06a[_0xedbd('0x33')]=_0x4cd06a[_0xedbd('0x33')]['length']?_0x4cd06a[_0xedbd('0x33')]:_0x48c1cb['model'];if(!_0x330ad6[_0xedbd('0x2f')][_0xedbd('0x34')]('nolimit')){_0x4cd06a[_0xedbd('0x1e')]=qs[_0xedbd('0x1e')](_0x330ad6['query'][_0xedbd('0x1e')]);_0x4cd06a['offset']=qs[_0xedbd('0x1c')](_0x330ad6[_0xedbd('0x2f')][_0xedbd('0x1c')]);}_0x4cd06a[_0xedbd('0x35')]=qs['sort'](_0x330ad6[_0xedbd('0x2f')]['sort']);_0x4cd06a[_0xedbd('0x36')]=qs['filters'](_['pick'](_0x330ad6[_0xedbd('0x2f')],_0x48c1cb['filters']),_0x488e99);if(_0x330ad6[_0xedbd('0x2f')][_0xedbd('0x37')]){_0x4cd06a[_0xedbd('0x36')]=_[_0xedbd('0x38')](_0x4cd06a[_0xedbd('0x36')],{'$or':_['map'](_0x488e99,function(_0x5445ff){if(_0x5445ff['type']!==_0xedbd('0x39')){var _0x46eb71={};_0x46eb71[_0x5445ff['name']]={'$like':'%'+_0x330ad6[_0xedbd('0x2f')][_0xedbd('0x37')]+'%'};return _0x46eb71;}})});}_0x4cd06a=_[_0xedbd('0x38')]({},_0x4cd06a,_0x330ad6[_0xedbd('0x3a')]);var _0xc9aeea={'where':_0x4cd06a['where']};return db[_0xedbd('0x2a')][_0xedbd('0x1f')](_0xc9aeea)[_0xedbd('0x23')](function(_0x188a4d){_0x1e00c4[_0xedbd('0x1f')]=_0x188a4d;if(_0x330ad6[_0xedbd('0x2f')][_0xedbd('0x3b')]){_0x4cd06a[_0xedbd('0x3c')]=[{'all':!![]}];}return db[_0xedbd('0x2a')][_0xedbd('0x3d')](_0x4cd06a);})[_0xedbd('0x23')](function(_0xd41e7c){_0x1e00c4[_0xedbd('0x3e')]=_0xd41e7c;return _0x1e00c4;})['then'](respondWithFilteredResult(_0x441d7b,_0x4cd06a))['catch'](handleError(_0x441d7b,null));};exports[_0xedbd('0x3f')]=function(_0x48b15c,_0x4a2484){var _0x370311={'raw':!![],'where':{'id':_0x48b15c[_0xedbd('0x40')]['id']}},_0x3c8c15={};_0x3c8c15[_0xedbd('0x2e')]=_[_0xedbd('0x30')](db[_0xedbd('0x2a')][_0xedbd('0x41')]);_0x3c8c15[_0xedbd('0x2f')]=_[_0xedbd('0x30')](_0x48b15c[_0xedbd('0x2f')]);_0x3c8c15[_0xedbd('0x42')]=_[_0xedbd('0x31')](_0x3c8c15[_0xedbd('0x2e')],_0x3c8c15['query']);_0x370311[_0xedbd('0x33')]=_[_0xedbd('0x31')](_0x3c8c15[_0xedbd('0x2e')],qs[_0xedbd('0x32')](_0x48b15c[_0xedbd('0x2f')][_0xedbd('0x32')]));_0x370311[_0xedbd('0x33')]=_0x370311[_0xedbd('0x33')]['length']?_0x370311[_0xedbd('0x33')]:_0x3c8c15[_0xedbd('0x2e')];if(_0x48b15c['query'][_0xedbd('0x3b')]){_0x370311[_0xedbd('0x3c')]=[{'all':!![]}];}_0x370311=_[_0xedbd('0x38')]({},_0x370311,_0x48b15c[_0xedbd('0x3a')]);return db[_0xedbd('0x2a')]['find'](_0x370311)[_0xedbd('0x23')](handleEntityNotFound(_0x4a2484,null))[_0xedbd('0x23')](respondWithResult(_0x4a2484,null))[_0xedbd('0x43')](handleError(_0x4a2484,null));};exports[_0xedbd('0x44')]=function(_0x3b1c22,_0x49d99e){return db[_0xedbd('0x2a')][_0xedbd('0x44')](_0x3b1c22[_0xedbd('0x45')],{})[_0xedbd('0x23')](respondWithResult(_0x49d99e,0xc9))[_0xedbd('0x43')](handleError(_0x49d99e,null));};exports['update']=function(_0x5151a3,_0xdfad2){if(_0x5151a3[_0xedbd('0x45')]['id']){delete _0x5151a3[_0xedbd('0x45')]['id'];}return db[_0xedbd('0x2a')][_0xedbd('0x46')]({'where':{'id':_0x5151a3['params']['id']}})[_0xedbd('0x23')](handleEntityNotFound(_0xdfad2,null))['then'](saveUpdates(_0x5151a3[_0xedbd('0x45')],null))[_0xedbd('0x23')](respondWithResult(_0xdfad2,null))['catch'](handleError(_0xdfad2,null));};exports[_0xedbd('0x24')]=function(_0x3573e3,_0x3b5878){return db[_0xedbd('0x2a')][_0xedbd('0x46')]({'where':{'id':_0x3573e3[_0xedbd('0x40')]['id']}})[_0xedbd('0x23')](handleEntityNotFound(_0x3b5878,null))[_0xedbd('0x23')](removeEntity(_0x3b5878,null))[_0xedbd('0x43')](handleError(_0x3b5878,null));};exports[_0xedbd('0x47')]=function(_0x3583ad,_0x3fef73){return db[_0xedbd('0x2a')]['describe']()['then'](respondWithResult(_0x3fef73,null))[_0xedbd('0x43')](handleError(_0x3fef73,null));}; \ No newline at end of file +var _0x907c=['params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','include','findAll','rows','catch','show'];(function(_0x1a09a7,_0x308926){var _0xe92e09=function(_0x128b5b){while(--_0x128b5b){_0x1a09a7['push'](_0x1a09a7['shift']());}};_0xe92e09(++_0x308926);}(_0x907c,0x12e));var _0xc907=function(_0x3250a9,_0x5c85a1){_0x3250a9=_0x3250a9-0x0;var _0x2299f2=_0x907c[_0x3250a9];return _0x2299f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc907('0x0'));var jsonpatch=require(_0xc907('0x1'));var rp=require(_0xc907('0x2'));var moment=require(_0xc907('0x3'));var BPromise=require(_0xc907('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc907('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc907('0x6'));var _=require(_0xc907('0x7'));var squel=require('squel');var crypto=require(_0xc907('0x8'));var jsforce=require(_0xc907('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc907('0xa'));var Papa=require(_0xc907('0xb'));var Redis=require('ioredis');var authService=require(_0xc907('0xc'));var qs=require(_0xc907('0xd'));var as=require(_0xc907('0xe'));var hardwareService=require(_0xc907('0xf'));var logger=require(_0xc907('0x10'))('api');var utils=require(_0xc907('0x11'));var config=require(_0xc907('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc907('0x13'))['db'];function respondWithStatusCode(_0x2e74e2,_0x29da7c){_0x29da7c=_0x29da7c||0xcc;return function(_0x5d909b){if(_0x5d909b){return _0x2e74e2['sendStatus'](_0x29da7c);}return _0x2e74e2[_0xc907('0x14')](_0x29da7c)['end']();};}function respondWithResult(_0x2f4f13,_0x586e17){_0x586e17=_0x586e17||0xc8;return function(_0x35987a){if(_0x35987a){return _0x2f4f13[_0xc907('0x14')](_0x586e17)[_0xc907('0x15')](_0x35987a);}};}function respondWithFilteredResult(_0x1fe34a,_0x130ce7){return function(_0x2a1521){if(_0x2a1521){var _0xe162d0=typeof _0x130ce7[_0xc907('0x16')]==='undefined'&&typeof _0x130ce7[_0xc907('0x17')]===_0xc907('0x18');var _0x3655fd=_0x2a1521[_0xc907('0x19')];var _0x49fc05=_0xe162d0?0x0:_0x130ce7[_0xc907('0x16')];var _0x2d47b4=_0xe162d0?_0x2a1521[_0xc907('0x19')]:_0x130ce7[_0xc907('0x16')]+_0x130ce7[_0xc907('0x17')];var _0x1842af;if(_0x2d47b4>=_0x3655fd){_0x2d47b4=_0x3655fd;_0x1842af=0xc8;}else{_0x1842af=0xce;}_0x1fe34a['status'](_0x1842af);return _0x1fe34a[_0xc907('0x1a')](_0xc907('0x1b'),_0x49fc05+'-'+_0x2d47b4+'/'+_0x3655fd)[_0xc907('0x15')](_0x2a1521);}return null;};}function patchUpdates(_0x461543){return function(_0xdf7f77){try{jsonpatch[_0xc907('0x1c')](_0xdf7f77,_0x461543,!![]);}catch(_0xf97ad){return BPromise[_0xc907('0x1d')](_0xf97ad);}return _0xdf7f77[_0xc907('0x1e')]();};}function saveUpdates(_0x4da9b7,_0x3d5012){return function(_0x5cd1e8){if(_0x5cd1e8){return _0x5cd1e8[_0xc907('0x1f')](_0x4da9b7)[_0xc907('0x20')](function(_0x5b1d6d){return _0x5b1d6d;});}return null;};}function removeEntity(_0x79cc94,_0xba1cba){return function(_0xeac1a6){if(_0xeac1a6){return _0xeac1a6[_0xc907('0x21')]()[_0xc907('0x20')](function(){_0x79cc94[_0xc907('0x14')](0xcc)[_0xc907('0x22')]();});}};}function handleEntityNotFound(_0x3ae7d6,_0x2283d5){return function(_0x3570c9){if(!_0x3570c9){_0x3ae7d6[_0xc907('0x23')](0x194);}return _0x3570c9;};}function handleError(_0x34f7f8,_0x1930f9){_0x1930f9=_0x1930f9||0x1f4;return function(_0x54efd2){logger[_0xc907('0x24')](_0x54efd2[_0xc907('0x25')]);if(_0x54efd2[_0xc907('0x26')]){delete _0x54efd2['name'];}_0x34f7f8[_0xc907('0x14')](_0x1930f9)[_0xc907('0x27')](_0x54efd2);};}exports[_0xc907('0x28')]=function(_0x22920b,_0x1bd2f7){var _0x16b0ff={},_0x3d40ed={},_0x2b8246={'count':0x0,'rows':[]};var _0x396531=_[_0xc907('0x29')](db['MailSubstatus'][_0xc907('0x2a')],function(_0x22720d){return{'name':_0x22720d[_0xc907('0x2b')],'type':_0x22720d[_0xc907('0x2c')][_0xc907('0x2d')]};});_0x3d40ed['model']=_['map'](_0x396531,'name');_0x3d40ed['query']=_[_0xc907('0x2e')](_0x22920b[_0xc907('0x2f')]);_0x3d40ed[_0xc907('0x30')]=_[_0xc907('0x31')](_0x3d40ed[_0xc907('0x32')],_0x3d40ed[_0xc907('0x2f')]);_0x16b0ff[_0xc907('0x33')]=_['intersection'](_0x3d40ed[_0xc907('0x32')],qs[_0xc907('0x34')](_0x22920b[_0xc907('0x2f')][_0xc907('0x34')]));_0x16b0ff[_0xc907('0x33')]=_0x16b0ff[_0xc907('0x33')][_0xc907('0x35')]?_0x16b0ff[_0xc907('0x33')]:_0x3d40ed[_0xc907('0x32')];if(!_0x22920b['query']['hasOwnProperty'](_0xc907('0x36'))){_0x16b0ff[_0xc907('0x17')]=qs[_0xc907('0x17')](_0x22920b['query']['limit']);_0x16b0ff['offset']=qs[_0xc907('0x16')](_0x22920b[_0xc907('0x2f')][_0xc907('0x16')]);}_0x16b0ff['order']=qs[_0xc907('0x37')](_0x22920b[_0xc907('0x2f')][_0xc907('0x37')]);_0x16b0ff[_0xc907('0x38')]=qs[_0xc907('0x30')](_[_0xc907('0x39')](_0x22920b[_0xc907('0x2f')],_0x3d40ed[_0xc907('0x30')]),_0x396531);if(_0x22920b['query'][_0xc907('0x3a')]){_0x16b0ff[_0xc907('0x38')]=_[_0xc907('0x3b')](_0x16b0ff[_0xc907('0x38')],{'$or':_[_0xc907('0x29')](_0x396531,function(_0x2dc1fd){if(_0x2dc1fd[_0xc907('0x2c')]!==_0xc907('0x3c')){var _0x1972f4={};_0x1972f4[_0x2dc1fd[_0xc907('0x26')]]={'$like':'%'+_0x22920b['query'][_0xc907('0x3a')]+'%'};return _0x1972f4;}})});}_0x16b0ff=_[_0xc907('0x3b')]({},_0x16b0ff,_0x22920b[_0xc907('0x3d')]);var _0xc85dbe={'where':_0x16b0ff[_0xc907('0x38')]};return db[_0xc907('0x3e')][_0xc907('0x19')](_0xc85dbe)[_0xc907('0x20')](function(_0x56f5e0){_0x2b8246[_0xc907('0x19')]=_0x56f5e0;if(_0x22920b[_0xc907('0x2f')]['includeAll']){_0x16b0ff[_0xc907('0x3f')]=[{'all':!![]}];}return db[_0xc907('0x3e')][_0xc907('0x40')](_0x16b0ff);})[_0xc907('0x20')](function(_0x5347d4){_0x2b8246[_0xc907('0x41')]=_0x5347d4;return _0x2b8246;})[_0xc907('0x20')](respondWithFilteredResult(_0x1bd2f7,_0x16b0ff))[_0xc907('0x42')](handleError(_0x1bd2f7,null));};exports[_0xc907('0x43')]=function(_0x1afce8,_0x2ae267){var _0x433615={'raw':!![],'where':{'id':_0x1afce8[_0xc907('0x44')]['id']}},_0x16c3ba={};_0x16c3ba[_0xc907('0x32')]=_[_0xc907('0x2e')](db[_0xc907('0x3e')][_0xc907('0x2a')]);_0x16c3ba['query']=_['keys'](_0x1afce8[_0xc907('0x2f')]);_0x16c3ba[_0xc907('0x30')]=_[_0xc907('0x31')](_0x16c3ba[_0xc907('0x32')],_0x16c3ba[_0xc907('0x2f')]);_0x433615[_0xc907('0x33')]=_[_0xc907('0x31')](_0x16c3ba[_0xc907('0x32')],qs[_0xc907('0x34')](_0x1afce8[_0xc907('0x2f')]['fields']));_0x433615[_0xc907('0x33')]=_0x433615[_0xc907('0x33')][_0xc907('0x35')]?_0x433615[_0xc907('0x33')]:_0x16c3ba[_0xc907('0x32')];if(_0x1afce8[_0xc907('0x2f')][_0xc907('0x45')]){_0x433615[_0xc907('0x3f')]=[{'all':!![]}];}_0x433615=_[_0xc907('0x3b')]({},_0x433615,_0x1afce8[_0xc907('0x3d')]);return db[_0xc907('0x3e')][_0xc907('0x46')](_0x433615)[_0xc907('0x20')](handleEntityNotFound(_0x2ae267,null))[_0xc907('0x20')](respondWithResult(_0x2ae267,null))[_0xc907('0x42')](handleError(_0x2ae267,null));};exports[_0xc907('0x47')]=function(_0x4a0951,_0x218b0a){return db[_0xc907('0x3e')][_0xc907('0x47')](_0x4a0951[_0xc907('0x48')],{})['then'](respondWithResult(_0x218b0a,0xc9))[_0xc907('0x42')](handleError(_0x218b0a,null));};exports[_0xc907('0x1f')]=function(_0x105d76,_0x15b989){if(_0x105d76[_0xc907('0x48')]['id']){delete _0x105d76[_0xc907('0x48')]['id'];}return db[_0xc907('0x3e')][_0xc907('0x46')]({'where':{'id':_0x105d76[_0xc907('0x44')]['id']}})[_0xc907('0x20')](handleEntityNotFound(_0x15b989,null))[_0xc907('0x20')](saveUpdates(_0x105d76[_0xc907('0x48')],null))[_0xc907('0x20')](respondWithResult(_0x15b989,null))['catch'](handleError(_0x15b989,null));};exports[_0xc907('0x21')]=function(_0x386aa0,_0x3e50a8){return db[_0xc907('0x3e')]['find']({'where':{'id':_0x386aa0[_0xc907('0x44')]['id']}})[_0xc907('0x20')](handleEntityNotFound(_0x3e50a8,null))['then'](removeEntity(_0x3e50a8,null))[_0xc907('0x42')](handleError(_0x3e50a8,null));};exports['describe']=function(_0x2b1679,_0x4106c1){return db[_0xc907('0x3e')][_0xc907('0x49')]()['then'](respondWithResult(_0x4106c1,null))[_0xc907('0x42')](handleError(_0x4106c1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index be03715..cdabd1d 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14b3=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x5a9f75,_0xee4b04){var _0x514e5f=function(_0x5d3104){while(--_0x5d3104){_0x5a9f75['push'](_0x5a9f75['shift']());}};_0x514e5f(++_0xee4b04);}(_0x14b3,0x1d9));var _0x314b=function(_0x493fc9,_0x597cf9){_0x493fc9=_0x493fc9-0x0;var _0x3a90c3=_0x14b3[_0x493fc9];return _0x3a90c3;};'use strict';var EventEmitter=require(_0x314b('0x0'));var MailSubstatus=require(_0x314b('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x314b('0x2')](0x0);var events={'afterUpdate':_0x314b('0x3')};function emitEvent(_0x3b8db6){return function(_0x262ce6,_0x4fd6cd,_0x235b6a){MailSubstatusEvents['emit'](_0x3b8db6+':'+_0x262ce6['id'],_0x262ce6);MailSubstatusEvents[_0x314b('0x4')](_0x3b8db6,_0x262ce6);_0x235b6a(null);};}for(var e in events){if(events[_0x314b('0x5')](e)){var event=events[e];MailSubstatus[_0x314b('0x6')](e,emitEvent(event));}}module[_0x314b('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x42ff=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x36af61,_0x311023){var _0x34a90d=function(_0x478cb0){while(--_0x478cb0){_0x36af61['push'](_0x36af61['shift']());}};_0x34a90d(++_0x311023);}(_0x42ff,0x11e));var _0xf42f=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x42ff[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0xf42f('0x0'));var MailSubstatus=require(_0xf42f('0x1'))['db'][_0xf42f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf42f('0x3')](0x0);var events={'afterUpdate':_0xf42f('0x4')};function emitEvent(_0x4875ac){return function(_0x57c9a0,_0x110d97,_0x206c5c){MailSubstatusEvents[_0xf42f('0x5')](_0x4875ac+':'+_0x57c9a0['id'],_0x57c9a0);MailSubstatusEvents[_0xf42f('0x5')](_0x4875ac,_0x57c9a0);_0x206c5c(null);};}for(var e in events){if(events[_0xf42f('0x6')](e)){var event=events[e];MailSubstatus[_0xf42f('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 22b301c..03c8c01 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 _0xc94b=['./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','then'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc94b,0x17a));var _0xbc94=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xc94b[_0x1ae5ab];return _0x1ce001;};'use strict';var attributes=require(_0xbc94('0x0'));module[_0xbc94('0x1')]=function(_0x380714){var _0x227146=_0x380714[_0xbc94('0x2')];return _0x380714['define'](_0xbc94('0x3'),attributes,{'tableName':_0xbc94('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x36d687,_0x407291,_0x3d9cae){return _0x227146[_0xbc94('0x5')]['update']({'value':_0x36d687[_0xbc94('0x6')]},{'where':{'field':_0xbc94('0x7'),'value':_0x36d687['_previousDataValues']['name']}})[_0xbc94('0x8')](function(){_0x3d9cae();})['catch'](function(_0x1f4ea3){_0x3d9cae(_0x1f4ea3);});}}});}; \ No newline at end of file +var _0x34d1=['MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','exports','models','define'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x34d1,0x189));var _0x134d=function(_0x2ddbc6,_0x60e5a4){_0x2ddbc6=_0x2ddbc6-0x0;var _0x35170d=_0x34d1[_0x2ddbc6];return _0x35170d;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x134d('0x0')]=function(_0x4cb6ca){var _0x38c7e5=_0x4cb6ca[_0x134d('0x1')];return _0x4cb6ca[_0x134d('0x2')](_0x134d('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x12dab7,_0x3be087,_0x5b6b2c){return _0x38c7e5[_0x134d('0x4')][_0x134d('0x5')]({'value':_0x12dab7['name']},{'where':{'field':_0x134d('0x6'),'value':_0x12dab7[_0x134d('0x7')][_0x134d('0x8')]}})[_0x134d('0x9')](function(){_0x5b6b2c();})[_0x134d('0xa')](function(_0x593e54){_0x5b6b2c(_0x593e54);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 064f37a..e593759 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 _0xe3a8=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0xe3a8,0x121));var _0x8e3a=function(_0x5f12a0,_0x52b913){_0x5f12a0=_0x5f12a0-0x0;var _0x5dd3f8=_0xe3a8[_0x5f12a0];return _0x5dd3f8;};'use strict';var _=require(_0x8e3a('0x0'));var util=require(_0x8e3a('0x1'));var moment=require('moment');var BPromise=require(_0x8e3a('0x2'));var rs=require(_0x8e3a('0x3'));var fs=require('fs');var Redis=require(_0x8e3a('0x4'));var db=require(_0x8e3a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e3a('0x6'))(_0x8e3a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e3a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcc540e,_0x162291,_0x2f3282){return new BPromise(function(_0x398880,_0x1f03c7){return client['request'](_0xcc540e,_0x2f3282)[_0x8e3a('0x9')](function(_0x1a765e){logger[_0x8e3a('0xa')](_0x8e3a('0xb'),_0x162291,_0x8e3a('0xc'));logger[_0x8e3a('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x162291,_0x8e3a('0xc'),JSON['stringify'](_0x1a765e));if(_0x1a765e[_0x8e3a('0xe')]){if(_0x1a765e[_0x8e3a('0xe')][_0x8e3a('0xf')]===0x1f4){logger[_0x8e3a('0xe')](_0x8e3a('0xb'),_0x162291,_0x1a765e[_0x8e3a('0xe')][_0x8e3a('0x10')]);return _0x1f03c7(_0x1a765e[_0x8e3a('0xe')]['message']);}logger[_0x8e3a('0xe')](_0x8e3a('0xb'),_0x162291,_0x1a765e[_0x8e3a('0xe')][_0x8e3a('0x10')]);return _0x398880(_0x1a765e[_0x8e3a('0xe')][_0x8e3a('0x10')]);}else{logger[_0x8e3a('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x162291,_0x8e3a('0xc'));_0x398880(_0x1a765e[_0x8e3a('0x11')][_0x8e3a('0x10')]);}})['catch'](function(_0x4c7592){logger[_0x8e3a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x162291,_0x4c7592);_0x1f03c7(_0x4c7592);});});} \ No newline at end of file +var _0x9fe9=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x9fe9,0x1e1));var _0x99fe=function(_0x371360,_0x355110){_0x371360=_0x371360-0x0;var _0x3dc4be=_0x9fe9[_0x371360];return _0x3dc4be;};'use strict';var _=require('lodash');var util=require(_0x99fe('0x0'));var moment=require('moment');var BPromise=require(_0x99fe('0x1'));var rs=require(_0x99fe('0x2'));var fs=require('fs');var Redis=require(_0x99fe('0x3'));var db=require(_0x99fe('0x4'))['db'];var utils=require(_0x99fe('0x5'));var logger=require(_0x99fe('0x6'))(_0x99fe('0x7'));var config=require(_0x99fe('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3904ab,_0x1fc941,_0x3da151){return new BPromise(function(_0x4051c5,_0x48d841){return client[_0x99fe('0x9')](_0x3904ab,_0x3da151)[_0x99fe('0xa')](function(_0xda8ecf){logger[_0x99fe('0xb')](_0x99fe('0xc'),_0x1fc941,'request\x20sent');logger[_0x99fe('0xd')](_0x99fe('0xe'),_0x1fc941,_0x99fe('0xf'),JSON[_0x99fe('0x10')](_0xda8ecf));if(_0xda8ecf[_0x99fe('0x11')]){if(_0xda8ecf[_0x99fe('0x11')]['code']===0x1f4){logger[_0x99fe('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1fc941,_0xda8ecf[_0x99fe('0x11')]['message']);return _0x48d841(_0xda8ecf[_0x99fe('0x11')]['message']);}logger['error'](_0x99fe('0xc'),_0x1fc941,_0xda8ecf[_0x99fe('0x11')][_0x99fe('0x12')]);return _0x4051c5(_0xda8ecf[_0x99fe('0x11')][_0x99fe('0x12')]);}else{logger[_0x99fe('0xb')](_0x99fe('0xc'),_0x1fc941,'request\x20sent');_0x4051c5(_0xda8ecf['result']['message']);}})[_0x99fe('0x13')](function(_0x25e45c){logger[_0x99fe('0x11')](_0x99fe('0xc'),_0x1fc941,_0x25e45c);_0x48d841(_0x25e45c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 48898c7..120b6a6 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 _0xd401=['../../config/environment','get','/describe','describe','show','post','isAuthenticated','create','put','/:id','update','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0xd401,0x13e));var _0x1d40=function(_0x2d2d97,_0x42643e){_0x2d2d97=_0x2d2d97-0x0;var _0x5a7287=_0xd401[_0x2d2d97];return _0x5a7287;};'use strict';var multer=require(_0x1d40('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d40('0x1'));var router=express[_0x1d40('0x2')]();var fs_extra=require(_0x1d40('0x3'));var auth=require(_0x1d40('0x4'));var interaction=require(_0x1d40('0x5'));var config=require(_0x1d40('0x6'));var controller=require('./mailTransferReport.controller');router[_0x1d40('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1d40('0x7')](_0x1d40('0x8'),auth['isAuthenticated'](),controller[_0x1d40('0x9')]);router[_0x1d40('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1d40('0xa')]);router[_0x1d40('0xb')]('/',auth[_0x1d40('0xc')](),controller[_0x1d40('0xd')]);router[_0x1d40('0xe')](_0x1d40('0xf'),auth[_0x1d40('0xc')](),controller[_0x1d40('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1d40('0x11')]=router; \ No newline at end of file +var _0xb65a=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','destroy','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb65a,0xa0));var _0xab65=function(_0x30d6a4,_0x4a2580){_0x30d6a4=_0x30d6a4-0x0;var _0x48665d=_0xb65a[_0x30d6a4];return _0x48665d;};'use strict';var multer=require(_0xab65('0x0'));var util=require('util');var path=require(_0xab65('0x1'));var timeout=require(_0xab65('0x2'));var express=require(_0xab65('0x3'));var router=express[_0xab65('0x4')]();var fs_extra=require(_0xab65('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xab65('0x6'));var config=require(_0xab65('0x7'));var controller=require(_0xab65('0x8'));router[_0xab65('0x9')]('/',auth[_0xab65('0xa')](),controller[_0xab65('0xb')]);router['get'](_0xab65('0xc'),auth[_0xab65('0xa')](),controller['describe']);router['get'](_0xab65('0xd'),auth[_0xab65('0xa')](),controller[_0xab65('0xe')]);router['post']('/',auth[_0xab65('0xa')](),controller[_0xab65('0xf')]);router[_0xab65('0x10')](_0xab65('0xd'),auth[_0xab65('0xa')](),controller['update']);router['delete'](_0xab65('0xd'),auth[_0xab65('0xa')](),controller[_0xab65('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 9eb017d..e414ce7 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1c0a03,_0x456e53){var _0x4154fe=function(_0x59ed53){while(--_0x59ed53){_0x1c0a03['push'](_0x1c0a03['shift']());}};_0x4154fe(++_0x456e53);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b30de,_0x5470ee){_0x5b30de=_0x5b30de-0x0;var _0x3b45d8=_0xedd9[_0x5b30de];return _0x3b45d8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3e9025,_0x550b45){_0x3e9025=_0x3e9025-0x0;var _0x30495f=_0xb43b[_0x3e9025];return _0x30495f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9912c67..ebe78f9 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 _0x0fd0=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','MailTransferReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x519c7f,_0x175403){var _0x1cf34b=function(_0x2d0487){while(--_0x2d0487){_0x519c7f['push'](_0x519c7f['shift']());}};_0x1cf34b(++_0x175403);}(_0x0fd0,0x171));var _0x00fd=function(_0x2c9413,_0x3d42db){_0x2c9413=_0x2c9413-0x0;var _0xc74f50=_0x0fd0[_0x2c9413];return _0xc74f50;};'use strict';var emlformat=require(_0x00fd('0x0'));var rimraf=require(_0x00fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00fd('0x2'));var rp=require('request-promise');var moment=require(_0x00fd('0x3'));var BPromise=require(_0x00fd('0x4'));var Mustache=require(_0x00fd('0x5'));var util=require(_0x00fd('0x6'));var path=require('path');var sox=require(_0x00fd('0x7'));var csv=require(_0x00fd('0x8'));var ejs=require(_0x00fd('0x9'));var fs=require('fs');var fs_extra=require(_0x00fd('0xa'));var _=require(_0x00fd('0xb'));var squel=require(_0x00fd('0xc'));var crypto=require(_0x00fd('0xd'));var jsforce=require(_0x00fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x00fd('0x8'));var querystring=require(_0x00fd('0xf'));var Papa=require(_0x00fd('0x10'));var Redis=require(_0x00fd('0x11'));var authService=require(_0x00fd('0x12'));var qs=require(_0x00fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x00fd('0x14'))('api');var utils=require(_0x00fd('0x15'));var config=require(_0x00fd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x00fd('0x17'))['db'];function respondWithStatusCode(_0x5353a0,_0x12f4fa){_0x12f4fa=_0x12f4fa||0xcc;return function(_0x18dc97){if(_0x18dc97){return _0x5353a0[_0x00fd('0x18')](_0x12f4fa);}return _0x5353a0[_0x00fd('0x19')](_0x12f4fa)[_0x00fd('0x1a')]();};}function respondWithResult(_0x2ba2b4,_0x1f91b3){_0x1f91b3=_0x1f91b3||0xc8;return function(_0x483e01){if(_0x483e01){return _0x2ba2b4[_0x00fd('0x19')](_0x1f91b3)[_0x00fd('0x1b')](_0x483e01);}};}function respondWithFilteredResult(_0x1d7429,_0x2b9ca6){return function(_0x32e37){if(_0x32e37){var _0x3f1f4d=typeof _0x2b9ca6['offset']===_0x00fd('0x1c')&&typeof _0x2b9ca6[_0x00fd('0x1d')]===_0x00fd('0x1c');var _0x2b7348=_0x32e37[_0x00fd('0x1e')];var _0xb785ed=_0x3f1f4d?0x0:_0x2b9ca6[_0x00fd('0x1f')];var _0x5e8d76=_0x3f1f4d?_0x32e37['count']:_0x2b9ca6[_0x00fd('0x1f')]+_0x2b9ca6[_0x00fd('0x1d')];var _0x494f3e;if(_0x5e8d76>=_0x2b7348){_0x5e8d76=_0x2b7348;_0x494f3e=0xc8;}else{_0x494f3e=0xce;}_0x1d7429[_0x00fd('0x19')](_0x494f3e);return _0x1d7429[_0x00fd('0x20')](_0x00fd('0x21'),_0xb785ed+'-'+_0x5e8d76+'/'+_0x2b7348)[_0x00fd('0x1b')](_0x32e37);}return null;};}function patchUpdates(_0x324f85){return function(_0x10da67){try{jsonpatch[_0x00fd('0x22')](_0x10da67,_0x324f85,!![]);}catch(_0x59ba32){return BPromise[_0x00fd('0x23')](_0x59ba32);}return _0x10da67['save']();};}function saveUpdates(_0x4ad4e5,_0x4b36e3){return function(_0x326006){if(_0x326006){return _0x326006[_0x00fd('0x24')](_0x4ad4e5)[_0x00fd('0x25')](function(_0x54c043){return _0x54c043;});}return null;};}function removeEntity(_0x1eede9,_0x394290){return function(_0x1b42e4){if(_0x1b42e4){return _0x1b42e4[_0x00fd('0x26')]()[_0x00fd('0x25')](function(){_0x1eede9[_0x00fd('0x19')](0xcc)[_0x00fd('0x1a')]();});}};}function handleEntityNotFound(_0x2466b8,_0x49a184){return function(_0x5cc4ab){if(!_0x5cc4ab){_0x2466b8['sendStatus'](0x194);}return _0x5cc4ab;};}function handleError(_0x343bf3,_0x4c152e){_0x4c152e=_0x4c152e||0x1f4;return function(_0x2858e9){logger[_0x00fd('0x27')](_0x2858e9[_0x00fd('0x28')]);if(_0x2858e9[_0x00fd('0x29')]){delete _0x2858e9[_0x00fd('0x29')];}_0x343bf3['status'](_0x4c152e)['send'](_0x2858e9);};}exports['index']=function(_0x25a610,_0x5aa311){var _0x412879={},_0x209cb8={},_0x4357cc={'count':0x0,'rows':[]};var _0xc6dd77=_[_0x00fd('0x2a')](db[_0x00fd('0x2b')]['rawAttributes'],function(_0x26553e){return{'name':_0x26553e[_0x00fd('0x2c')],'type':_0x26553e[_0x00fd('0x2d')]['key']};});_0x209cb8['model']=_[_0x00fd('0x2a')](_0xc6dd77,_0x00fd('0x29'));_0x209cb8[_0x00fd('0x2e')]=_[_0x00fd('0x2f')](_0x25a610[_0x00fd('0x2e')]);_0x209cb8[_0x00fd('0x30')]=_[_0x00fd('0x31')](_0x209cb8[_0x00fd('0x32')],_0x209cb8['query']);_0x412879[_0x00fd('0x33')]=_[_0x00fd('0x31')](_0x209cb8[_0x00fd('0x32')],qs[_0x00fd('0x34')](_0x25a610[_0x00fd('0x2e')][_0x00fd('0x34')]));_0x412879[_0x00fd('0x33')]=_0x412879[_0x00fd('0x33')][_0x00fd('0x35')]?_0x412879[_0x00fd('0x33')]:_0x209cb8[_0x00fd('0x32')];if(!_0x25a610[_0x00fd('0x2e')][_0x00fd('0x36')]('nolimit')){_0x412879[_0x00fd('0x1d')]=qs[_0x00fd('0x1d')](_0x25a610[_0x00fd('0x2e')]['limit']);_0x412879[_0x00fd('0x1f')]=qs[_0x00fd('0x1f')](_0x25a610[_0x00fd('0x2e')][_0x00fd('0x1f')]);}_0x412879[_0x00fd('0x37')]=qs[_0x00fd('0x38')](_0x25a610['query']['sort']);_0x412879['where']=qs[_0x00fd('0x30')](_[_0x00fd('0x39')](_0x25a610[_0x00fd('0x2e')],_0x209cb8[_0x00fd('0x30')]),_0xc6dd77);if(_0x25a610[_0x00fd('0x2e')]['filter']){_0x412879[_0x00fd('0x3a')]=_[_0x00fd('0x3b')](_0x412879[_0x00fd('0x3a')],{'$or':_[_0x00fd('0x2a')](_0xc6dd77,function(_0x4c9109){if(_0x4c9109['type']!==_0x00fd('0x3c')){var _0x31dc92={};_0x31dc92[_0x4c9109[_0x00fd('0x29')]]={'$like':'%'+_0x25a610[_0x00fd('0x2e')][_0x00fd('0x3d')]+'%'};return _0x31dc92;}})});}_0x412879=_[_0x00fd('0x3b')]({},_0x412879,_0x25a610[_0x00fd('0x3e')]);var _0x3db76a={'where':_0x412879[_0x00fd('0x3a')]};return db[_0x00fd('0x2b')]['count'](_0x3db76a)[_0x00fd('0x25')](function(_0x338c96){_0x4357cc['count']=_0x338c96;if(_0x25a610['query'][_0x00fd('0x3f')]){_0x412879[_0x00fd('0x40')]=[{'all':!![]}];}return db[_0x00fd('0x2b')][_0x00fd('0x41')](_0x412879);})['then'](function(_0x345a85){_0x4357cc[_0x00fd('0x42')]=_0x345a85;return _0x4357cc;})['then'](respondWithFilteredResult(_0x5aa311,_0x412879))[_0x00fd('0x43')](handleError(_0x5aa311,null));};exports[_0x00fd('0x44')]=function(_0x28b7db,_0x8e8d37){var _0x15ab70={'raw':!![],'where':{'id':_0x28b7db[_0x00fd('0x45')]['id']}},_0x430d25={};_0x430d25[_0x00fd('0x32')]=_[_0x00fd('0x2f')](db['MailTransferReport'][_0x00fd('0x46')]);_0x430d25['query']=_[_0x00fd('0x2f')](_0x28b7db[_0x00fd('0x2e')]);_0x430d25[_0x00fd('0x30')]=_[_0x00fd('0x31')](_0x430d25['model'],_0x430d25[_0x00fd('0x2e')]);_0x15ab70['attributes']=_['intersection'](_0x430d25[_0x00fd('0x32')],qs[_0x00fd('0x34')](_0x28b7db[_0x00fd('0x2e')][_0x00fd('0x34')]));_0x15ab70['attributes']=_0x15ab70['attributes'][_0x00fd('0x35')]?_0x15ab70[_0x00fd('0x33')]:_0x430d25[_0x00fd('0x32')];if(_0x28b7db[_0x00fd('0x2e')]['includeAll']){_0x15ab70[_0x00fd('0x40')]=[{'all':!![]}];}_0x15ab70=_[_0x00fd('0x3b')]({},_0x15ab70,_0x28b7db[_0x00fd('0x3e')]);return db['MailTransferReport'][_0x00fd('0x47')](_0x15ab70)[_0x00fd('0x25')](handleEntityNotFound(_0x8e8d37,null))[_0x00fd('0x25')](respondWithResult(_0x8e8d37,null))[_0x00fd('0x43')](handleError(_0x8e8d37,null));};exports['create']=function(_0x286490,_0x5f0add){return db[_0x00fd('0x2b')][_0x00fd('0x48')](_0x286490['body'],{})[_0x00fd('0x25')](respondWithResult(_0x5f0add,0xc9))[_0x00fd('0x43')](handleError(_0x5f0add,null));};exports[_0x00fd('0x24')]=function(_0x5952c1,_0x4547e8){if(_0x5952c1[_0x00fd('0x49')]['id']){delete _0x5952c1[_0x00fd('0x49')]['id'];}return db['MailTransferReport'][_0x00fd('0x47')]({'where':{'id':_0x5952c1[_0x00fd('0x45')]['id']}})[_0x00fd('0x25')](handleEntityNotFound(_0x4547e8,null))[_0x00fd('0x25')](saveUpdates(_0x5952c1['body'],null))[_0x00fd('0x25')](respondWithResult(_0x4547e8,null))[_0x00fd('0x43')](handleError(_0x4547e8,null));};exports['destroy']=function(_0x26a839,_0xf93b1c){return db[_0x00fd('0x2b')]['find']({'where':{'id':_0x26a839[_0x00fd('0x45')]['id']}})[_0x00fd('0x25')](handleEntityNotFound(_0xf93b1c,null))[_0x00fd('0x25')](removeEntity(_0xf93b1c,null))[_0x00fd('0x43')](handleError(_0xf93b1c,null));};exports['describe']=function(_0x42ac3c,_0x153654){return db[_0x00fd('0x2b')][_0x00fd('0x4a')]()[_0x00fd('0x25')](respondWithResult(_0x153654,null))[_0x00fd('0x43')](handleError(_0x153654,null));}; \ No newline at end of file +var _0x7071=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailTransferReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x7071,0x119));var _0x1707=function(_0x4a7449,_0x29ed36){_0x4a7449=_0x4a7449-0x0;var _0x14d403=_0x7071[_0x4a7449];return _0x14d403;};'use strict';var emlformat=require(_0x1707('0x0'));var rimraf=require(_0x1707('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1707('0x2'));var moment=require(_0x1707('0x3'));var BPromise=require(_0x1707('0x4'));var Mustache=require(_0x1707('0x5'));var util=require(_0x1707('0x6'));var path=require(_0x1707('0x7'));var sox=require(_0x1707('0x8'));var csv=require(_0x1707('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1707('0xa'));var squel=require('squel');var crypto=require(_0x1707('0xb'));var jsforce=require(_0x1707('0xc'));var deskjs=require(_0x1707('0xd'));var toCsv=require(_0x1707('0x9'));var querystring=require(_0x1707('0xe'));var Papa=require('papaparse');var Redis=require(_0x1707('0xf'));var authService=require(_0x1707('0x10'));var qs=require(_0x1707('0x11'));var as=require(_0x1707('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1707('0x13'));var utils=require(_0x1707('0x14'));var config=require(_0x1707('0x15'));var licenseUtil=require(_0x1707('0x16'));var db=require(_0x1707('0x17'))['db'];function respondWithStatusCode(_0x25b59e,_0x5ce7b0){_0x5ce7b0=_0x5ce7b0||0xcc;return function(_0x7c87b0){if(_0x7c87b0){return _0x25b59e[_0x1707('0x18')](_0x5ce7b0);}return _0x25b59e['status'](_0x5ce7b0)[_0x1707('0x19')]();};}function respondWithResult(_0x4d30d6,_0x1cf19c){_0x1cf19c=_0x1cf19c||0xc8;return function(_0x4801cb){if(_0x4801cb){return _0x4d30d6[_0x1707('0x1a')](_0x1cf19c)[_0x1707('0x1b')](_0x4801cb);}};}function respondWithFilteredResult(_0x107668,_0x49d813){return function(_0x2f7480){if(_0x2f7480){var _0x4c1bed=typeof _0x49d813['offset']===_0x1707('0x1c')&&typeof _0x49d813[_0x1707('0x1d')]===_0x1707('0x1c');var _0x2e2ad8=_0x2f7480['count'];var _0x1db320=_0x4c1bed?0x0:_0x49d813['offset'];var _0x4bd9ff=_0x4c1bed?_0x2f7480[_0x1707('0x1e')]:_0x49d813[_0x1707('0x1f')]+_0x49d813[_0x1707('0x1d')];var _0x47d3e1;if(_0x4bd9ff>=_0x2e2ad8){_0x4bd9ff=_0x2e2ad8;_0x47d3e1=0xc8;}else{_0x47d3e1=0xce;}_0x107668[_0x1707('0x1a')](_0x47d3e1);return _0x107668[_0x1707('0x20')]('Content-Range',_0x1db320+'-'+_0x4bd9ff+'/'+_0x2e2ad8)[_0x1707('0x1b')](_0x2f7480);}return null;};}function patchUpdates(_0x545b04){return function(_0x1c2b10){try{jsonpatch[_0x1707('0x21')](_0x1c2b10,_0x545b04,!![]);}catch(_0x314509){return BPromise[_0x1707('0x22')](_0x314509);}return _0x1c2b10[_0x1707('0x23')]();};}function saveUpdates(_0x576dcb,_0x12aaf7){return function(_0x4beaeb){if(_0x4beaeb){return _0x4beaeb[_0x1707('0x24')](_0x576dcb)[_0x1707('0x25')](function(_0x48c2e2){return _0x48c2e2;});}return null;};}function removeEntity(_0x1e9be3,_0x430407){return function(_0x2ad443){if(_0x2ad443){return _0x2ad443[_0x1707('0x26')]()[_0x1707('0x25')](function(){_0x1e9be3[_0x1707('0x1a')](0xcc)[_0x1707('0x19')]();});}};}function handleEntityNotFound(_0x2737c5,_0x35da3e){return function(_0x357e96){if(!_0x357e96){_0x2737c5['sendStatus'](0x194);}return _0x357e96;};}function handleError(_0x2d1152,_0x53bffd){_0x53bffd=_0x53bffd||0x1f4;return function(_0x19204b){logger[_0x1707('0x27')](_0x19204b[_0x1707('0x28')]);if(_0x19204b[_0x1707('0x29')]){delete _0x19204b[_0x1707('0x29')];}_0x2d1152[_0x1707('0x1a')](_0x53bffd)['send'](_0x19204b);};}exports[_0x1707('0x2a')]=function(_0x4aa468,_0x136a10){var _0x528c2e={},_0x3a3e58={},_0x14d36e={'count':0x0,'rows':[]};var _0x3ea9ab=_[_0x1707('0x2b')](db[_0x1707('0x2c')]['rawAttributes'],function(_0x195c9b){return{'name':_0x195c9b['fieldName'],'type':_0x195c9b[_0x1707('0x2d')]['key']};});_0x3a3e58[_0x1707('0x2e')]=_['map'](_0x3ea9ab,'name');_0x3a3e58[_0x1707('0x2f')]=_[_0x1707('0x30')](_0x4aa468[_0x1707('0x2f')]);_0x3a3e58[_0x1707('0x31')]=_[_0x1707('0x32')](_0x3a3e58[_0x1707('0x2e')],_0x3a3e58[_0x1707('0x2f')]);_0x528c2e[_0x1707('0x33')]=_[_0x1707('0x32')](_0x3a3e58[_0x1707('0x2e')],qs['fields'](_0x4aa468[_0x1707('0x2f')][_0x1707('0x34')]));_0x528c2e[_0x1707('0x33')]=_0x528c2e[_0x1707('0x33')][_0x1707('0x35')]?_0x528c2e['attributes']:_0x3a3e58[_0x1707('0x2e')];if(!_0x4aa468[_0x1707('0x2f')][_0x1707('0x36')](_0x1707('0x37'))){_0x528c2e[_0x1707('0x1d')]=qs['limit'](_0x4aa468[_0x1707('0x2f')][_0x1707('0x1d')]);_0x528c2e[_0x1707('0x1f')]=qs['offset'](_0x4aa468['query'][_0x1707('0x1f')]);}_0x528c2e[_0x1707('0x38')]=qs[_0x1707('0x39')](_0x4aa468['query'][_0x1707('0x39')]);_0x528c2e[_0x1707('0x3a')]=qs[_0x1707('0x31')](_[_0x1707('0x3b')](_0x4aa468[_0x1707('0x2f')],_0x3a3e58['filters']),_0x3ea9ab);if(_0x4aa468[_0x1707('0x2f')][_0x1707('0x3c')]){_0x528c2e[_0x1707('0x3a')]=_[_0x1707('0x3d')](_0x528c2e[_0x1707('0x3a')],{'$or':_[_0x1707('0x2b')](_0x3ea9ab,function(_0xc24175){if(_0xc24175['type']!==_0x1707('0x3e')){var _0x19730e={};_0x19730e[_0xc24175[_0x1707('0x29')]]={'$like':'%'+_0x4aa468['query'][_0x1707('0x3c')]+'%'};return _0x19730e;}})});}_0x528c2e=_[_0x1707('0x3d')]({},_0x528c2e,_0x4aa468[_0x1707('0x3f')]);var _0x167249={'where':_0x528c2e[_0x1707('0x3a')]};return db['MailTransferReport'][_0x1707('0x1e')](_0x167249)['then'](function(_0x1e986d){_0x14d36e[_0x1707('0x1e')]=_0x1e986d;if(_0x4aa468[_0x1707('0x2f')][_0x1707('0x40')]){_0x528c2e['include']=[{'all':!![]}];}return db[_0x1707('0x2c')]['findAll'](_0x528c2e);})[_0x1707('0x25')](function(_0x3bff74){_0x14d36e[_0x1707('0x41')]=_0x3bff74;return _0x14d36e;})[_0x1707('0x25')](respondWithFilteredResult(_0x136a10,_0x528c2e))[_0x1707('0x42')](handleError(_0x136a10,null));};exports[_0x1707('0x43')]=function(_0x3d231a,_0x5812a1){var _0x3732de={'raw':!![],'where':{'id':_0x3d231a[_0x1707('0x44')]['id']}},_0x4274d5={};_0x4274d5[_0x1707('0x2e')]=_[_0x1707('0x30')](db[_0x1707('0x2c')][_0x1707('0x45')]);_0x4274d5[_0x1707('0x2f')]=_[_0x1707('0x30')](_0x3d231a[_0x1707('0x2f')]);_0x4274d5[_0x1707('0x31')]=_['intersection'](_0x4274d5[_0x1707('0x2e')],_0x4274d5[_0x1707('0x2f')]);_0x3732de[_0x1707('0x33')]=_[_0x1707('0x32')](_0x4274d5[_0x1707('0x2e')],qs[_0x1707('0x34')](_0x3d231a[_0x1707('0x2f')][_0x1707('0x34')]));_0x3732de['attributes']=_0x3732de[_0x1707('0x33')]['length']?_0x3732de[_0x1707('0x33')]:_0x4274d5[_0x1707('0x2e')];if(_0x3d231a[_0x1707('0x2f')]['includeAll']){_0x3732de[_0x1707('0x46')]=[{'all':!![]}];}_0x3732de=_[_0x1707('0x3d')]({},_0x3732de,_0x3d231a[_0x1707('0x3f')]);return db['MailTransferReport'][_0x1707('0x47')](_0x3732de)[_0x1707('0x25')](handleEntityNotFound(_0x5812a1,null))[_0x1707('0x25')](respondWithResult(_0x5812a1,null))[_0x1707('0x42')](handleError(_0x5812a1,null));};exports[_0x1707('0x48')]=function(_0x165a0d,_0xb87b80){return db[_0x1707('0x2c')]['create'](_0x165a0d[_0x1707('0x49')],{})[_0x1707('0x25')](respondWithResult(_0xb87b80,0xc9))[_0x1707('0x42')](handleError(_0xb87b80,null));};exports[_0x1707('0x24')]=function(_0x351647,_0x2719e3){if(_0x351647[_0x1707('0x49')]['id']){delete _0x351647[_0x1707('0x49')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x351647[_0x1707('0x44')]['id']}})[_0x1707('0x25')](handleEntityNotFound(_0x2719e3,null))[_0x1707('0x25')](saveUpdates(_0x351647[_0x1707('0x49')],null))[_0x1707('0x25')](respondWithResult(_0x2719e3,null))[_0x1707('0x42')](handleError(_0x2719e3,null));};exports['destroy']=function(_0x1d6fb0,_0x23484b){return db[_0x1707('0x2c')][_0x1707('0x47')]({'where':{'id':_0x1d6fb0['params']['id']}})['then'](handleEntityNotFound(_0x23484b,null))[_0x1707('0x25')](removeEntity(_0x23484b,null))[_0x1707('0x42')](handleError(_0x23484b,null));};exports[_0x1707('0x4a')]=function(_0x588d98,_0xb4c604){return db[_0x1707('0x2c')][_0x1707('0x4a')]()['then'](respondWithResult(_0xb4c604,null))['catch'](handleError(_0xb4c604,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 826f89d..62d8148 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 _0xf5a7=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash'];(function(_0x3a9c4e,_0x493850){var _0xc8d93d=function(_0x298aa7){while(--_0x298aa7){_0x3a9c4e['push'](_0x3a9c4e['shift']());}};_0xc8d93d(++_0x493850);}(_0xf5a7,0x133));var _0x7f5a=function(_0x49c510,_0x2f5dff){_0x49c510=_0x49c510-0x0;var _0xa9eec6=_0xf5a7[_0x49c510];return _0xa9eec6;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var logger=require('../../config/logger')(_0x7f5a('0x2'));var moment=require(_0x7f5a('0x3'));var BPromise=require(_0x7f5a('0x4'));var rp=require(_0x7f5a('0x5'));var fs=require('fs');var path=require(_0x7f5a('0x6'));var rimraf=require(_0x7f5a('0x7'));var config=require(_0x7f5a('0x8'));var attributes=require(_0x7f5a('0x9'));module[_0x7f5a('0xa')]=function(_0x520bf9,_0x2808f2){return _0x520bf9[_0x7f5a('0xb')]('MailTransferReport',attributes,{'tableName':_0x7f5a('0xc'),'paranoid':![],'indexes':[{'name':_0x7f5a('0xd'),'fields':[_0x7f5a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aa3=['lodash','util','api','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x4aa3,0x174));var _0x34aa=function(_0x266a3c,_0x59bf4a){_0x266a3c=_0x266a3c-0x0;var _0x5b09a0=_0x4aa3[_0x266a3c];return _0x5b09a0;};'use strict';var _=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var logger=require('../../config/logger')(_0x34aa('0x2'));var moment=require(_0x34aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x34aa('0x4'));var fs=require('fs');var path=require(_0x34aa('0x5'));var rimraf=require('rimraf');var config=require(_0x34aa('0x6'));var attributes=require(_0x34aa('0x7'));module[_0x34aa('0x8')]=function(_0x5a717c,_0x201f69){return _0x5a717c[_0x34aa('0x9')]('MailTransferReport',attributes,{'tableName':_0x34aa('0xa'),'paranoid':![],'indexes':[{'name':_0x34aa('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8334eaf..11f9ada 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 _0xd054=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x509410,_0x5e915a){var _0x49eeae=function(_0x3b11b9){while(--_0x3b11b9){_0x509410['push'](_0x509410['shift']());}};_0x49eeae(++_0x5e915a);}(_0xd054,0x1b2));var _0x4d05=function(_0x3faaf3,_0x4cbb63){_0x3faaf3=_0x3faaf3-0x0;var _0x8b3744=_0xd054[_0x3faaf3];return _0x8b3744;};'use strict';var _=require(_0x4d05('0x0'));var util=require(_0x4d05('0x1'));var moment=require('moment');var BPromise=require(_0x4d05('0x2'));var rs=require(_0x4d05('0x3'));var fs=require('fs');var Redis=require(_0x4d05('0x4'));var db=require(_0x4d05('0x5'))['db'];var utils=require(_0x4d05('0x6'));var logger=require(_0x4d05('0x7'))(_0x4d05('0x8'));var config=require(_0x4d05('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4d05('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23174a,_0x5d6b8c,_0x473a0e){return new BPromise(function(_0x50c06a,_0x5620f2){return client[_0x4d05('0xb')](_0x23174a,_0x473a0e)['then'](function(_0x22a9df){logger[_0x4d05('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x5d6b8c,_0x4d05('0xd'));logger[_0x4d05('0xe')](_0x4d05('0xf'),_0x5d6b8c,'request\x20sent',JSON[_0x4d05('0x10')](_0x22a9df));if(_0x22a9df[_0x4d05('0x11')]){if(_0x22a9df['error']['code']===0x1f4){logger[_0x4d05('0x11')](_0x4d05('0x12'),_0x5d6b8c,_0x22a9df[_0x4d05('0x11')][_0x4d05('0x13')]);return _0x5620f2(_0x22a9df['error'][_0x4d05('0x13')]);}logger[_0x4d05('0x11')](_0x4d05('0x12'),_0x5d6b8c,_0x22a9df[_0x4d05('0x11')]['message']);return _0x50c06a(_0x22a9df[_0x4d05('0x11')]['message']);}else{logger[_0x4d05('0xc')](_0x4d05('0x12'),_0x5d6b8c,_0x4d05('0xd'));_0x50c06a(_0x22a9df[_0x4d05('0x14')][_0x4d05('0x13')]);}})[_0x4d05('0x15')](function(_0x1a9ae5){logger[_0x4d05('0x11')](_0x4d05('0x12'),_0x5d6b8c,_0x1a9ae5);_0x5620f2(_0x1a9ae5);});});} \ No newline at end of file +var _0xeef8=['message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7c596,_0x2bf61f){var _0x427fc0=function(_0x8d811f){while(--_0x8d811f){_0x7c596['push'](_0x7c596['shift']());}};_0x427fc0(++_0x2bf61f);}(_0xeef8,0x1bb));var _0x8eef=function(_0x15e6fa,_0x419f96){_0x15e6fa=_0x15e6fa-0x0;var _0x5138d3=_0xeef8[_0x15e6fa];return _0x5138d3;};'use strict';var _=require(_0x8eef('0x0'));var util=require(_0x8eef('0x1'));var moment=require('moment');var BPromise=require(_0x8eef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8eef('0x3'));var db=require(_0x8eef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eef('0x5'))(_0x8eef('0x6'));var config=require('../../config/environment');var jayson=require(_0x8eef('0x7'));var client=jayson[_0x8eef('0x8')][_0x8eef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3219d3,_0x18d1e5,_0x3e9743){return new BPromise(function(_0x3d3655,_0x4b1781){return client[_0x8eef('0xa')](_0x3219d3,_0x3e9743)[_0x8eef('0xb')](function(_0x1903ec){logger[_0x8eef('0xc')](_0x8eef('0xd'),_0x18d1e5,_0x8eef('0xe'));logger[_0x8eef('0xf')](_0x8eef('0x10'),_0x18d1e5,_0x8eef('0xe'),JSON[_0x8eef('0x11')](_0x1903ec));if(_0x1903ec[_0x8eef('0x12')]){if(_0x1903ec[_0x8eef('0x12')]['code']===0x1f4){logger[_0x8eef('0x12')](_0x8eef('0xd'),_0x18d1e5,_0x1903ec[_0x8eef('0x12')]['message']);return _0x4b1781(_0x1903ec['error']['message']);}logger['error'](_0x8eef('0xd'),_0x18d1e5,_0x1903ec[_0x8eef('0x12')][_0x8eef('0x13')]);return _0x3d3655(_0x1903ec[_0x8eef('0x12')][_0x8eef('0x13')]);}else{logger[_0x8eef('0xc')](_0x8eef('0xd'),_0x18d1e5,_0x8eef('0xe'));_0x3d3655(_0x1903ec['result'][_0x8eef('0x13')]);}})[_0x8eef('0x14')](function(_0x5d11ef){logger[_0x8eef('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x18d1e5,_0x5d11ef);_0x4b1781(_0x5d11ef);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cf9e598..a74a1b6 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 _0x61b6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','path'];(function(_0x566760,_0x1f7104){var _0x30ca6d=function(_0x3aa193){while(--_0x3aa193){_0x566760['push'](_0x566760['shift']());}};_0x30ca6d(++_0x1f7104);}(_0x61b6,0x1a2));var _0x661b=function(_0xfc81ea,_0x360207){_0xfc81ea=_0xfc81ea-0x0;var _0x116727=_0x61b6[_0xfc81ea];return _0x116727;};'use strict';var multer=require(_0x661b('0x0'));var util=require('util');var path=require(_0x661b('0x1'));var timeout=require(_0x661b('0x2'));var express=require(_0x661b('0x3'));var router=express[_0x661b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x661b('0x5'));var interaction=require(_0x661b('0x6'));var config=require('../../config/environment');var controller=require(_0x661b('0x7'));router[_0x661b('0x8')]('/',auth['isAuthenticated'](),controller[_0x661b('0x9')]);router['get'](_0x661b('0xa'),auth[_0x661b('0xb')](),controller[_0x661b('0xc')]);router[_0x661b('0x8')](_0x661b('0xd'),auth[_0x661b('0xb')](),controller[_0x661b('0xe')]);router[_0x661b('0xf')]('/',auth[_0x661b('0xb')](),controller['create']);router[_0x661b('0x10')]('/:id',auth[_0x661b('0xb')](),controller[_0x661b('0x11')]);router[_0x661b('0x12')](_0x661b('0xd'),auth[_0x661b('0xb')](),controller['destroy']);module[_0x661b('0x13')]=router; \ No newline at end of file +var _0xd197=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x52084c,_0x49d2e4){var _0x49f34d=function(_0x14f829){while(--_0x14f829){_0x52084c['push'](_0x52084c['shift']());}};_0x49f34d(++_0x49d2e4);}(_0xd197,0x196));var _0x7d19=function(_0xeaf632,_0x26d325){_0xeaf632=_0xeaf632-0x0;var _0x1134fe=_0xd197[_0xeaf632];return _0x1134fe;};'use strict';var multer=require(_0x7d19('0x0'));var util=require(_0x7d19('0x1'));var path=require(_0x7d19('0x2'));var timeout=require(_0x7d19('0x3'));var express=require('express');var router=express[_0x7d19('0x4')]();var fs_extra=require(_0x7d19('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d19('0x6'));var controller=require(_0x7d19('0x7'));router[_0x7d19('0x8')]('/',auth[_0x7d19('0x9')](),controller[_0x7d19('0xa')]);router[_0x7d19('0x8')](_0x7d19('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7d19('0x8')](_0x7d19('0xc'),auth[_0x7d19('0x9')](),controller[_0x7d19('0xd')]);router[_0x7d19('0xe')]('/',auth[_0x7d19('0x9')](),controller[_0x7d19('0xf')]);router[_0x7d19('0x10')](_0x7d19('0xc'),auth[_0x7d19('0x9')](),controller[_0x7d19('0x11')]);router[_0x7d19('0x12')](_0x7d19('0xc'),auth[_0x7d19('0x9')](),controller[_0x7d19('0x13')]);module[_0x7d19('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9455c29..b9d6d3a 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 _0x21ab=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x51294b,_0x2d01c8){var _0x5e2794=function(_0x5ea6e0){while(--_0x5ea6e0){_0x51294b['push'](_0x51294b['shift']());}};_0x5e2794(++_0x2d01c8);}(_0x21ab,0x8e));var _0xb21a=function(_0x425ecd,_0x1e1bed){_0x425ecd=_0x425ecd-0x0;var _0xddc406=_0x21ab[_0x425ecd];return _0xddc406;};'use strict';var Sequelize=require(_0xb21a('0x0'));var moment=require(_0xb21a('0x1'));module[_0xb21a('0x2')]={'channel':{'type':Sequelize[_0xb21a('0x3')]},'membername':{'type':Sequelize[_0xb21a('0x3')]},'interface':{'type':Sequelize[_0xb21a('0x3')]},'type':{'type':Sequelize[_0xb21a('0x3')],'defaultValue':_0xb21a('0x4'),'comment':_0xb21a('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xb21a('0x6')]},'exitAt':{'type':Sequelize[_0xb21a('0x6')],'set':function(_0x25519a){var _0x5f2dc9=moment(_0x25519a);var _0x58cfd0=moment(this[_0xb21a('0x7')](_0xb21a('0x8')));var _0x1cbd4e=_0x5f2dc9[_0xb21a('0x9')](_0x58cfd0,_0xb21a('0xa'));this[_0xb21a('0xb')]('exitAt',_0x25519a);this[_0xb21a('0xb')](_0xb21a('0xc'),_0x1cbd4e>=0x0?_0x1cbd4e:null);}},'data1':{'type':Sequelize[_0xb21a('0x3')],'comment':_0xb21a('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xb21a('0xe')},'data3':{'type':Sequelize[_0xb21a('0x3')],'comment':_0xb21a('0xf')},'data4':{'type':Sequelize[_0xb21a('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xb21a('0x3')],'comment':_0xb21a('0x10')},'role':{'type':Sequelize[_0xb21a('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ffa=['INTEGER','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9ffa,0x145));var _0xa9ff=function(_0x2c43d4,_0x480f06){_0x2c43d4=_0x2c43d4-0x0;var _0xf7c812=_0x9ffa[_0x2c43d4];return _0xf7c812;};'use strict';var Sequelize=require(_0xa9ff('0x0'));var moment=require(_0xa9ff('0x1'));module[_0xa9ff('0x2')]={'channel':{'type':Sequelize[_0xa9ff('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xa9ff('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa9ff('0x5')]},'exitAt':{'type':Sequelize[_0xa9ff('0x5')],'set':function(_0x491193){var _0x4ade79=moment(_0x491193);var _0x1edbcb=moment(this[_0xa9ff('0x6')]('enterAt'));var _0xa4cf76=_0x4ade79[_0xa9ff('0x7')](_0x1edbcb,_0xa9ff('0x8'));this[_0xa9ff('0x9')](_0xa9ff('0xa'),_0x491193);this['setDataValue'](_0xa9ff('0xb'),_0xa4cf76>=0x0?_0xa4cf76:null);}},'data1':{'type':Sequelize[_0xa9ff('0x3')],'comment':_0xa9ff('0xc')},'data2':{'type':Sequelize[_0xa9ff('0x3')],'comment':_0xa9ff('0xd')},'data3':{'type':Sequelize[_0xa9ff('0x3')],'comment':_0xa9ff('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xa9ff('0xf')},'data5':{'type':Sequelize[_0xa9ff('0x3')],'comment':_0xa9ff('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xa9ff('0x11')]},'uniqueid':{'type':Sequelize[_0xa9ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index bcdec6e..017a66c 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x28c261,_0x4cc3b4){var _0x1983a9=function(_0x552c21){while(--_0x552c21){_0x28c261['push'](_0x28c261['shift']());}};_0x1983a9(++_0x4cc3b4);}(_0x3e74,0x175));var _0x43e7=function(_0x5a0896,_0x52312a){_0x5a0896=_0x5a0896-0x0;var _0x5a58b2=_0x3e74[_0x5a0896];return _0x5a58b2;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xedd9,0xfc));var _0x9edd=function(_0x42eabe,_0x5366ea){_0x42eabe=_0x42eabe-0x0;var _0x45b06e=_0xedd9[_0x42eabe];return _0x45b06e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e668f66..0355b9e 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 _0x96f1=['./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x167ebd,_0x51a9ba){var _0x17af42=function(_0x23c24f){while(--_0x23c24f){_0x167ebd['push'](_0x167ebd['shift']());}};_0x17af42(++_0x51a9ba);}(_0x96f1,0x19c));var _0x196f=function(_0x193551,_0x29ab95){_0x193551=_0x193551-0x0;var _0x188c8f=_0x96f1[_0x193551];return _0x188c8f;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require(_0x196f('0x2'))(_0x196f('0x3'));var moment=require(_0x196f('0x4'));var BPromise=require(_0x196f('0x5'));var rp=require(_0x196f('0x6'));var fs=require('fs');var path=require(_0x196f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196f('0x8'));module[_0x196f('0x9')]=function(_0x267906,_0x1f401c){return _0x267906[_0x196f('0xa')]('MemberReport',attributes,{'tableName':_0x196f('0xb'),'paranoid':![],'indexes':[{'name':_0x196f('0xc'),'fields':[_0x196f('0xd'),_0x196f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x927c=['MemberReport','membername_interface','membername','interface','util','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x946e1b,_0x4f9f57){var _0x4db99b=function(_0x16f0e9){while(--_0x16f0e9){_0x946e1b['push'](_0x946e1b['shift']());}};_0x4db99b(++_0x4f9f57);}(_0x927c,0x190));var _0xc927=function(_0x2192cc,_0xd5dd81){_0x2192cc=_0x2192cc-0x0;var _0x158adc=_0x927c[_0x2192cc];return _0x158adc;};'use strict';var _=require('lodash');var util=require(_0xc927('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc927('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc927('0x2'));var config=require(_0xc927('0x3'));var attributes=require(_0xc927('0x4'));module[_0xc927('0x5')]=function(_0xa9e945,_0x411603){return _0xa9e945[_0xc927('0x6')](_0xc927('0x7'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xc927('0x8'),'fields':[_0xc927('0x9'),_0xc927('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e5d3185..424f4ea 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 _0xc03e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xc03e,0x15a));var _0xec03=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xc03e[_0x16e57d];return _0x40239c;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});}exports[_0xec03('0x17')]=function(_0x5e8ae2){var _0x25292d=this;return new Promise(function(_0x5b3e04,_0x57dc2d){return db[_0xec03('0x18')][_0xec03('0x19')]({'raw':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1b')]||null:null,'attributes':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1d')]||null:null,'include':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1e')],function(_0x33de1e){return{'model':db[_0x33de1e[_0xec03('0x20')]],'as':_0x33de1e['as'],'attributes':_0x33de1e['attributes'],'include':_0x33de1e[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x33de1e['include'],function(_0x2bfcf6){return{'model':db[_0x2bfcf6[_0xec03('0x20')]],'as':_0x2bfcf6['as'],'attributes':_0x2bfcf6[_0xec03('0x1c')],'include':_0x2bfcf6[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x2bfcf6['include'],function(_0x73cc4f){return{'model':db[_0x73cc4f[_0xec03('0x20')]],'as':_0x73cc4f['as'],'attributes':_0x73cc4f[_0xec03('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xec03('0xb')](function(_0x29e904){logger['info'](_0xec03('0x17'),_0x5e8ae2);logger[_0xec03('0xf')]('GetMemberReport',_0x5e8ae2,JSON['stringify'](_0x29e904));_0x5b3e04(_0x29e904);})[_0xec03('0x16')](function(_0x12b5c9){logger[_0xec03('0x12')](_0xec03('0x17'),_0x12b5c9[_0xec03('0x14')],_0x5e8ae2);_0x57dc2d(_0x25292d[_0xec03('0x12')](0x1f4,_0x12b5c9[_0xec03('0x14')]));});});};exports[_0xec03('0x21')]=function(_0x51fad6){var _0x28f60c=this;return new Promise(function(_0x31c08d,_0x2bd889){return db[_0xec03('0x18')][_0xec03('0x22')](_0x51fad6[_0xec03('0x23')],{'raw':_0x51fad6[_0xec03('0x1a')]?_0x51fad6[_0xec03('0x1a')][_0xec03('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5d441b){logger['info'](_0xec03('0x21'),_0x51fad6);logger[_0xec03('0xf')](_0xec03('0x21'),_0x51fad6,JSON[_0xec03('0x11')](_0x5d441b));_0x31c08d(_0x5d441b);})['catch'](function(_0x576d5e){logger['error']('CreateMemberReport',_0x576d5e[_0xec03('0x14')],_0x51fad6);_0x2bd889(_0x28f60c[_0xec03('0x12')](0x1f4,_0x576d5e[_0xec03('0x14')]));});});};exports[_0xec03('0x25')]=function(_0x11c75b){var _0x3d7d98=this;return new Promise(function(_0x23a26b,_0x1cee38){return db[_0xec03('0x18')][_0xec03('0x26')](_0x11c75b[_0xec03('0x23')],{'raw':_0x11c75b[_0xec03('0x1a')]?_0x11c75b['options'][_0xec03('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')]['where']||null:null,'attributes':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1d')]||null:null})[_0xec03('0xb')](function(_0x3c55b7){logger[_0xec03('0xc')](_0xec03('0x25'),_0x11c75b);logger[_0xec03('0xf')]('UpdateMemberReport',_0x11c75b,JSON[_0xec03('0x11')](_0x3c55b7));_0x23a26b(_0x3c55b7);})[_0xec03('0x16')](function(_0x37819a){logger[_0xec03('0x12')](_0xec03('0x25'),_0x37819a[_0xec03('0x14')],_0x11c75b);_0x1cee38(_0x3d7d98[_0xec03('0x12')](0x1f4,_0x37819a[_0xec03('0x14')]));});});}; \ No newline at end of file +var _0x81d4=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','MemberReport','options','raw','where','attributes','limit','map','model','include','GetMemberReport','catch','CreateMemberReport','UpdateMemberReport','update','body','util'];(function(_0x53b6a3,_0x1ff0f7){var _0x1c2199=function(_0x27e1cc){while(--_0x27e1cc){_0x53b6a3['push'](_0x53b6a3['shift']());}};_0x1c2199(++_0x1ff0f7);}(_0x81d4,0x197));var _0x481d=function(_0x56e08e,_0xd2f730){_0x56e08e=_0x56e08e-0x0;var _0x2bfcac=_0x81d4[_0x56e08e];return _0x2bfcac;};'use strict';var _=require('lodash');var util=require(_0x481d('0x0'));var moment=require(_0x481d('0x1'));var BPromise=require('bluebird');var rs=require(_0x481d('0x2'));var fs=require('fs');var Redis=require(_0x481d('0x3'));var db=require(_0x481d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x481d('0x5'));var config=require(_0x481d('0x6'));var jayson=require(_0x481d('0x7'));var client=jayson['client'][_0x481d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d32a,_0x2f91fd,_0x271b33){return new BPromise(function(_0x1d9263,_0x25adbb){return client['request'](_0x17d32a,_0x271b33)[_0x481d('0x9')](function(_0x1cf758){logger[_0x481d('0xa')]('MemberReport,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'));logger[_0x481d('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'),JSON[_0x481d('0xd')](_0x1cf758));if(_0x1cf758[_0x481d('0xe')]){if(_0x1cf758[_0x481d('0xe')][_0x481d('0xf')]===0x1f4){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758['error'][_0x481d('0x11')]);return _0x25adbb(_0x1cf758['error']['message']);}logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758[_0x481d('0xe')]['message']);return _0x1d9263(_0x1cf758[_0x481d('0xe')]['message']);}else{logger[_0x481d('0xa')](_0x481d('0x10'),_0x2f91fd,_0x481d('0xb'));_0x1d9263(_0x1cf758[_0x481d('0x12')][_0x481d('0x11')]);}})['catch'](function(_0x63b8c1){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x63b8c1);_0x25adbb(_0x63b8c1);});});}exports['GetMemberReport']=function(_0x21e2a5){var _0x5056c7=this;return new Promise(function(_0x3ef7c6,_0x534a99){return db[_0x481d('0x13')]['findAll']({'raw':_0x21e2a5[_0x481d('0x14')]?_0x21e2a5['options'][_0x481d('0x15')]===undefined?!![]:![]:!![],'where':_0x21e2a5['options']?_0x21e2a5[_0x481d('0x14')][_0x481d('0x16')]||null:null,'attributes':_0x21e2a5['options']?_0x21e2a5[_0x481d('0x14')][_0x481d('0x17')]||null:null,'limit':_0x21e2a5[_0x481d('0x14')]?_0x21e2a5['options'][_0x481d('0x18')]||null:null,'include':_0x21e2a5['options']?_0x21e2a5['options']['include']?_[_0x481d('0x19')](_0x21e2a5['options']['include'],function(_0x280586){return{'model':db[_0x280586[_0x481d('0x1a')]],'as':_0x280586['as'],'attributes':_0x280586[_0x481d('0x17')],'include':_0x280586['include']?_[_0x481d('0x19')](_0x280586[_0x481d('0x1b')],function(_0x51e3a){return{'model':db[_0x51e3a[_0x481d('0x1a')]],'as':_0x51e3a['as'],'attributes':_0x51e3a['attributes'],'include':_0x51e3a[_0x481d('0x1b')]?_[_0x481d('0x19')](_0x51e3a['include'],function(_0x371cbe){return{'model':db[_0x371cbe[_0x481d('0x1a')]],'as':_0x371cbe['as'],'attributes':_0x371cbe[_0x481d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x599e61){logger[_0x481d('0xa')](_0x481d('0x1c'),_0x21e2a5);logger['debug']('GetMemberReport',_0x21e2a5,JSON[_0x481d('0xd')](_0x599e61));_0x3ef7c6(_0x599e61);})[_0x481d('0x1d')](function(_0x495fbb){logger[_0x481d('0xe')](_0x481d('0x1c'),_0x495fbb[_0x481d('0x11')],_0x21e2a5);_0x534a99(_0x5056c7[_0x481d('0xe')](0x1f4,_0x495fbb[_0x481d('0x11')]));});});};exports[_0x481d('0x1e')]=function(_0x447ac3){var _0x46f01b=this;return new Promise(function(_0x43d417,_0x4791ae){return db[_0x481d('0x13')]['create'](_0x447ac3['body'],{'raw':_0x447ac3['options']?_0x447ac3[_0x481d('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x481d('0x9')](function(_0x5d00fe){logger[_0x481d('0xa')](_0x481d('0x1e'),_0x447ac3);logger[_0x481d('0xc')](_0x481d('0x1e'),_0x447ac3,JSON[_0x481d('0xd')](_0x5d00fe));_0x43d417(_0x5d00fe);})[_0x481d('0x1d')](function(_0x46e60c){logger[_0x481d('0xe')](_0x481d('0x1e'),_0x46e60c[_0x481d('0x11')],_0x447ac3);_0x4791ae(_0x46f01b[_0x481d('0xe')](0x1f4,_0x46e60c[_0x481d('0x11')]));});});};exports[_0x481d('0x1f')]=function(_0x35c4b4){var _0x131961=this;return new Promise(function(_0x5288fe,_0x2143f6){return db[_0x481d('0x13')][_0x481d('0x20')](_0x35c4b4[_0x481d('0x21')],{'raw':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4[_0x481d('0x14')][_0x481d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4['options'][_0x481d('0x16')]||null:null,'attributes':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4[_0x481d('0x14')][_0x481d('0x17')]||null:null,'limit':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4['options']['limit']||null:null})[_0x481d('0x9')](function(_0x5def7f){logger[_0x481d('0xa')](_0x481d('0x1f'),_0x35c4b4);logger[_0x481d('0xc')](_0x481d('0x1f'),_0x35c4b4,JSON[_0x481d('0xd')](_0x5def7f));_0x5288fe(_0x5def7f);})[_0x481d('0x1d')](function(_0x2c251f){logger[_0x481d('0xe')](_0x481d('0x1f'),_0x2c251f['message'],_0x35c4b4);_0x2143f6(_0x131961['error'](0x1f4,_0x2c251f[_0x481d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cd52735..17db4da 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 _0x59b0=['index','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x2baa5d,_0x42a1cb){var _0x88bf18=function(_0x45385f){while(--_0x45385f){_0x2baa5d['push'](_0x2baa5d['shift']());}};_0x88bf18(++_0x42a1cb);}(_0x59b0,0x188));var _0x059b=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0x59b0[_0x87506e];return _0x5496a4;};'use strict';var multer=require(_0x059b('0x0'));var util=require('util');var path=require(_0x059b('0x1'));var timeout=require('connect-timeout');var express=require(_0x059b('0x2'));var router=express[_0x059b('0x3')]();var fs_extra=require(_0x059b('0x4'));var auth=require(_0x059b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x059b('0x6'));var controller=require('./migration.controller');router[_0x059b('0x7')]('/',controller[_0x059b('0x8')]);module[_0x059b('0x9')]=router; \ No newline at end of file +var _0x4a80=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path'];(function(_0x8ade8b,_0x50f50c){var _0x308814=function(_0x205c35){while(--_0x205c35){_0x8ade8b['push'](_0x8ade8b['shift']());}};_0x308814(++_0x50f50c);}(_0x4a80,0xbe));var _0x04a8=function(_0x4dfb08,_0x1650ad){_0x4dfb08=_0x4dfb08-0x0;var _0xf00ce6=_0x4a80[_0x4dfb08];return _0xf00ce6;};'use strict';var multer=require(_0x04a8('0x0'));var util=require('util');var path=require(_0x04a8('0x1'));var timeout=require(_0x04a8('0x2'));var express=require('express');var router=express[_0x04a8('0x3')]();var fs_extra=require(_0x04a8('0x4'));var auth=require(_0x04a8('0x5'));var interaction=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var controller=require(_0x04a8('0x8'));router[_0x04a8('0x9')]('/',controller[_0x04a8('0xa')]);module[_0x04a8('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 84099ec..ac6aed5 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 _0x52cb=['version','sequelize','exports','STRING'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x52cb,0x91));var _0xb52c=function(_0x2d4f98,_0x173ded){_0x2d4f98=_0x2d4f98-0x0;var _0x3b6084=_0x52cb[_0x2d4f98];return _0x3b6084;};'use strict';var Sequelize=require(_0xb52c('0x0'));module[_0xb52c('0x1')]={'version':{'type':Sequelize[_0xb52c('0x2')],'unique':_0xb52c('0x3')}}; \ No newline at end of file +var _0xd66a=['sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd66a,0x111));var _0xad66=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xd66a[_0x3203a1];return _0x24215e;};'use strict';var Sequelize=require(_0xad66('0x0'));module[_0xad66('0x1')]={'version':{'type':Sequelize[_0xad66('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4d1fc9a..216de62 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 _0x78b9=['apply','reject','save','destroy','then','stack','name','send','Migration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','type','options','includeAll','include','findAll','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x5d6cbb,_0x28bd38){var _0x5d0bc9=function(_0x8060fe){while(--_0x8060fe){_0x5d6cbb['push'](_0x5d6cbb['shift']());}};_0x5d0bc9(++_0x28bd38);}(_0x78b9,0x123));var _0x978b=function(_0x46b697,_0xe71b0f){_0x46b697=_0x46b697-0x0;var _0x18fd3e=_0x78b9[_0x46b697];return _0x18fd3e;};'use strict';var emlformat=require(_0x978b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x978b('0x1'));var jsonpatch=require(_0x978b('0x2'));var rp=require(_0x978b('0x3'));var moment=require(_0x978b('0x4'));var BPromise=require(_0x978b('0x5'));var Mustache=require(_0x978b('0x6'));var util=require(_0x978b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x978b('0x8'));var _=require(_0x978b('0x9'));var squel=require(_0x978b('0xa'));var crypto=require(_0x978b('0xb'));var jsforce=require(_0x978b('0xc'));var deskjs=require(_0x978b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x978b('0xe'));var Papa=require(_0x978b('0xf'));var Redis=require(_0x978b('0x10'));var authService=require(_0x978b('0x11'));var qs=require(_0x978b('0x12'));var as=require(_0x978b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x978b('0x14'))(_0x978b('0x15'));var utils=require(_0x978b('0x16'));var config=require(_0x978b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x978b('0x18'))['db'];function respondWithStatusCode(_0x3644b3,_0x21fc33){_0x21fc33=_0x21fc33||0xcc;return function(_0x4dae19){if(_0x4dae19){return _0x3644b3[_0x978b('0x19')](_0x21fc33);}return _0x3644b3[_0x978b('0x1a')](_0x21fc33)[_0x978b('0x1b')]();};}function respondWithResult(_0x10d02c,_0x27ec08){_0x27ec08=_0x27ec08||0xc8;return function(_0x1175df){if(_0x1175df){return _0x10d02c[_0x978b('0x1a')](_0x27ec08)[_0x978b('0x1c')](_0x1175df);}};}function respondWithFilteredResult(_0x4c845b,_0x4068d9){return function(_0x1adb5c){if(_0x1adb5c){var _0x42de73=typeof _0x4068d9[_0x978b('0x1d')]===_0x978b('0x1e')&&typeof _0x4068d9[_0x978b('0x1f')]===_0x978b('0x1e');var _0x2d0b9b=_0x1adb5c['count'];var _0x17641a=_0x42de73?0x0:_0x4068d9[_0x978b('0x1d')];var _0xbe000e=_0x42de73?_0x1adb5c[_0x978b('0x20')]:_0x4068d9[_0x978b('0x1d')]+_0x4068d9['limit'];var _0x281fa1;if(_0xbe000e>=_0x2d0b9b){_0xbe000e=_0x2d0b9b;_0x281fa1=0xc8;}else{_0x281fa1=0xce;}_0x4c845b['status'](_0x281fa1);return _0x4c845b['set'](_0x978b('0x21'),_0x17641a+'-'+_0xbe000e+'/'+_0x2d0b9b)[_0x978b('0x1c')](_0x1adb5c);}return null;};}function patchUpdates(_0x317970){return function(_0x10a184){try{jsonpatch[_0x978b('0x22')](_0x10a184,_0x317970,!![]);}catch(_0x2457ba){return BPromise[_0x978b('0x23')](_0x2457ba);}return _0x10a184[_0x978b('0x24')]();};}function saveUpdates(_0x3c3ce7,_0x36af6b){return function(_0x46b4c1){if(_0x46b4c1){return _0x46b4c1['update'](_0x3c3ce7)['then'](function(_0x25e7a2){return _0x25e7a2;});}return null;};}function removeEntity(_0x283eac,_0x516a09){return function(_0x2e67e8){if(_0x2e67e8){return _0x2e67e8[_0x978b('0x25')]()[_0x978b('0x26')](function(){_0x283eac[_0x978b('0x1a')](0xcc)[_0x978b('0x1b')]();});}};}function handleEntityNotFound(_0x1cab7a,_0x3f404f){return function(_0x32aade){if(!_0x32aade){_0x1cab7a[_0x978b('0x19')](0x194);}return _0x32aade;};}function handleError(_0x69cba,_0x1b28fc){_0x1b28fc=_0x1b28fc||0x1f4;return function(_0x44fc33){logger['error'](_0x44fc33[_0x978b('0x27')]);if(_0x44fc33[_0x978b('0x28')]){delete _0x44fc33[_0x978b('0x28')];}_0x69cba['status'](_0x1b28fc)[_0x978b('0x29')](_0x44fc33);};}exports['index']=function(_0x54e12c,_0x32b776){var _0x47fbbd={},_0x31e323={},_0xbdc3fb={'count':0x0,'rows':[]};var _0x460b3d=_['map'](db[_0x978b('0x2a')][_0x978b('0x2b')],function(_0x580c8e){return{'name':_0x580c8e[_0x978b('0x2c')],'type':_0x580c8e['type'][_0x978b('0x2d')]};});_0x31e323[_0x978b('0x2e')]=_[_0x978b('0x2f')](_0x460b3d,_0x978b('0x28'));_0x31e323[_0x978b('0x30')]=_[_0x978b('0x31')](_0x54e12c[_0x978b('0x30')]);_0x31e323[_0x978b('0x32')]=_[_0x978b('0x33')](_0x31e323[_0x978b('0x2e')],_0x31e323[_0x978b('0x30')]);_0x47fbbd['attributes']=_[_0x978b('0x33')](_0x31e323[_0x978b('0x2e')],qs[_0x978b('0x34')](_0x54e12c[_0x978b('0x30')]['fields']));_0x47fbbd[_0x978b('0x35')]=_0x47fbbd[_0x978b('0x35')][_0x978b('0x36')]?_0x47fbbd[_0x978b('0x35')]:_0x31e323['model'];if(!_0x54e12c['query']['hasOwnProperty'](_0x978b('0x37'))){_0x47fbbd[_0x978b('0x1f')]=qs[_0x978b('0x1f')](_0x54e12c['query']['limit']);_0x47fbbd[_0x978b('0x1d')]=qs[_0x978b('0x1d')](_0x54e12c[_0x978b('0x30')]['offset']);}_0x47fbbd['order']=qs[_0x978b('0x38')](_0x54e12c[_0x978b('0x30')]['sort']);_0x47fbbd[_0x978b('0x39')]=qs[_0x978b('0x32')](_['pick'](_0x54e12c[_0x978b('0x30')],_0x31e323[_0x978b('0x32')]),_0x460b3d);if(_0x54e12c['query'][_0x978b('0x3a')]){_0x47fbbd[_0x978b('0x39')]=_['merge'](_0x47fbbd['where'],{'$or':_[_0x978b('0x2f')](_0x460b3d,function(_0x1acca9){if(_0x1acca9[_0x978b('0x3b')]!=='VIRTUAL'){var _0x3ce807={};_0x3ce807[_0x1acca9[_0x978b('0x28')]]={'$like':'%'+_0x54e12c[_0x978b('0x30')][_0x978b('0x3a')]+'%'};return _0x3ce807;}})});}_0x47fbbd=_['merge']({},_0x47fbbd,_0x54e12c[_0x978b('0x3c')]);var _0x3be7a0={'where':_0x47fbbd[_0x978b('0x39')]};return db[_0x978b('0x2a')][_0x978b('0x20')](_0x3be7a0)[_0x978b('0x26')](function(_0x142b44){_0xbdc3fb[_0x978b('0x20')]=_0x142b44;if(_0x54e12c[_0x978b('0x30')][_0x978b('0x3d')]){_0x47fbbd[_0x978b('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x978b('0x3f')](_0x47fbbd);})['then'](function(_0x201df5){_0xbdc3fb['rows']=_0x201df5;return _0xbdc3fb;})[_0x978b('0x26')](respondWithFilteredResult(_0x32b776,_0x47fbbd))[_0x978b('0x40')](handleError(_0x32b776,null));}; \ No newline at end of file +var _0xc87b=['count','offset','set','Content-Range','save','then','destroy','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc87b,0x1a3));var _0xbc87=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc87b[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0xbc87('0x0'));var rimraf=require(_0xbc87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc87('0x2'));var moment=require(_0xbc87('0x3'));var BPromise=require(_0xbc87('0x4'));var Mustache=require(_0xbc87('0x5'));var util=require(_0xbc87('0x6'));var path=require(_0xbc87('0x7'));var sox=require(_0xbc87('0x8'));var csv=require(_0xbc87('0x9'));var ejs=require(_0xbc87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc87('0xb'));var squel=require('squel');var crypto=require(_0xbc87('0xc'));var jsforce=require(_0xbc87('0xd'));var deskjs=require(_0xbc87('0xe'));var toCsv=require(_0xbc87('0x9'));var querystring=require('querystring');var Papa=require(_0xbc87('0xf'));var Redis=require('ioredis');var authService=require(_0xbc87('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc87('0x11'));var hardwareService=require(_0xbc87('0x12'));var logger=require(_0xbc87('0x13'))(_0xbc87('0x14'));var utils=require(_0xbc87('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbc87('0x16'))['db'];function respondWithStatusCode(_0x588495,_0x4312fc){_0x4312fc=_0x4312fc||0xcc;return function(_0x2ccc3a){if(_0x2ccc3a){return _0x588495[_0xbc87('0x17')](_0x4312fc);}return _0x588495[_0xbc87('0x18')](_0x4312fc)[_0xbc87('0x19')]();};}function respondWithResult(_0x5c243f,_0x3c8338){_0x3c8338=_0x3c8338||0xc8;return function(_0x1e9dca){if(_0x1e9dca){return _0x5c243f['status'](_0x3c8338)[_0xbc87('0x1a')](_0x1e9dca);}};}function respondWithFilteredResult(_0x189701,_0x111bba){return function(_0x2e40b6){if(_0x2e40b6){var _0x3698ce=typeof _0x111bba['offset']===_0xbc87('0x1b')&&typeof _0x111bba[_0xbc87('0x1c')]===_0xbc87('0x1b');var _0x7df5e=_0x2e40b6[_0xbc87('0x1d')];var _0x113f55=_0x3698ce?0x0:_0x111bba[_0xbc87('0x1e')];var _0x4e4ca1=_0x3698ce?_0x2e40b6[_0xbc87('0x1d')]:_0x111bba[_0xbc87('0x1e')]+_0x111bba[_0xbc87('0x1c')];var _0x20c365;if(_0x4e4ca1>=_0x7df5e){_0x4e4ca1=_0x7df5e;_0x20c365=0xc8;}else{_0x20c365=0xce;}_0x189701[_0xbc87('0x18')](_0x20c365);return _0x189701[_0xbc87('0x1f')](_0xbc87('0x20'),_0x113f55+'-'+_0x4e4ca1+'/'+_0x7df5e)[_0xbc87('0x1a')](_0x2e40b6);}return null;};}function patchUpdates(_0x2ce879){return function(_0x172c77){try{jsonpatch['apply'](_0x172c77,_0x2ce879,!![]);}catch(_0x20c4ac){return BPromise['reject'](_0x20c4ac);}return _0x172c77[_0xbc87('0x21')]();};}function saveUpdates(_0x2af8dc,_0x2ec5bb){return function(_0x355c19){if(_0x355c19){return _0x355c19['update'](_0x2af8dc)[_0xbc87('0x22')](function(_0x1e37cd){return _0x1e37cd;});}return null;};}function removeEntity(_0x4f457f,_0x10c1fc){return function(_0x5eaae6){if(_0x5eaae6){return _0x5eaae6[_0xbc87('0x23')]()[_0xbc87('0x22')](function(){_0x4f457f[_0xbc87('0x18')](0xcc)[_0xbc87('0x19')]();});}};}function handleEntityNotFound(_0x2b3133,_0x9768df){return function(_0x18a7ec){if(!_0x18a7ec){_0x2b3133[_0xbc87('0x17')](0x194);}return _0x18a7ec;};}function handleError(_0x44f8b4,_0x23a7b9){_0x23a7b9=_0x23a7b9||0x1f4;return function(_0x347bc8){logger['error'](_0x347bc8['stack']);if(_0x347bc8[_0xbc87('0x24')]){delete _0x347bc8['name'];}_0x44f8b4[_0xbc87('0x18')](_0x23a7b9)[_0xbc87('0x25')](_0x347bc8);};}exports[_0xbc87('0x26')]=function(_0x462ed4,_0x1b0f36){var _0x410bb0={},_0x31c85d={},_0x1ecc3a={'count':0x0,'rows':[]};var _0x8d5338=_[_0xbc87('0x27')](db[_0xbc87('0x28')][_0xbc87('0x29')],function(_0x2e1736){return{'name':_0x2e1736[_0xbc87('0x2a')],'type':_0x2e1736[_0xbc87('0x2b')]['key']};});_0x31c85d[_0xbc87('0x2c')]=_[_0xbc87('0x27')](_0x8d5338,_0xbc87('0x24'));_0x31c85d[_0xbc87('0x2d')]=_[_0xbc87('0x2e')](_0x462ed4['query']);_0x31c85d['filters']=_['intersection'](_0x31c85d[_0xbc87('0x2c')],_0x31c85d[_0xbc87('0x2d')]);_0x410bb0[_0xbc87('0x2f')]=_['intersection'](_0x31c85d[_0xbc87('0x2c')],qs[_0xbc87('0x30')](_0x462ed4['query'][_0xbc87('0x30')]));_0x410bb0[_0xbc87('0x2f')]=_0x410bb0['attributes']['length']?_0x410bb0[_0xbc87('0x2f')]:_0x31c85d[_0xbc87('0x2c')];if(!_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x31')]('nolimit')){_0x410bb0[_0xbc87('0x1c')]=qs[_0xbc87('0x1c')](_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x1c')]);_0x410bb0[_0xbc87('0x1e')]=qs['offset'](_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x1e')]);}_0x410bb0[_0xbc87('0x32')]=qs[_0xbc87('0x33')](_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x33')]);_0x410bb0[_0xbc87('0x34')]=qs[_0xbc87('0x35')](_[_0xbc87('0x36')](_0x462ed4[_0xbc87('0x2d')],_0x31c85d[_0xbc87('0x35')]),_0x8d5338);if(_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x37')]){_0x410bb0[_0xbc87('0x34')]=_[_0xbc87('0x38')](_0x410bb0[_0xbc87('0x34')],{'$or':_[_0xbc87('0x27')](_0x8d5338,function(_0x5df4c8){if(_0x5df4c8[_0xbc87('0x2b')]!==_0xbc87('0x39')){var _0x29de96={};_0x29de96[_0x5df4c8[_0xbc87('0x24')]]={'$like':'%'+_0x462ed4[_0xbc87('0x2d')]['filter']+'%'};return _0x29de96;}})});}_0x410bb0=_[_0xbc87('0x38')]({},_0x410bb0,_0x462ed4[_0xbc87('0x3a')]);var _0x596103={'where':_0x410bb0[_0xbc87('0x34')]};return db['Migration']['count'](_0x596103)[_0xbc87('0x22')](function(_0x34e966){_0x1ecc3a[_0xbc87('0x1d')]=_0x34e966;if(_0x462ed4[_0xbc87('0x2d')][_0xbc87('0x3b')]){_0x410bb0[_0xbc87('0x3c')]=[{'all':!![]}];}return db['Migration'][_0xbc87('0x3d')](_0x410bb0);})[_0xbc87('0x22')](function(_0x2ba186){_0x1ecc3a[_0xbc87('0x3e')]=_0x2ba186;return _0x1ecc3a;})[_0xbc87('0x22')](respondWithFilteredResult(_0x1b0f36,_0x410bb0))[_0xbc87('0x3f')](handleError(_0x1b0f36,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9fdb87d..650e05d 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 _0x3225=['Migration','migrations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3225,0x9e));var _0x5322=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3225[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5322('0x0'));var logger=require(_0x5322('0x1'))(_0x5322('0x2'));var moment=require(_0x5322('0x3'));var BPromise=require(_0x5322('0x4'));var rp=require(_0x5322('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5322('0x6'));var config=require(_0x5322('0x7'));var attributes=require('./migration.attributes');module[_0x5322('0x8')]=function(_0x43deb1,_0x4b7256){return _0x43deb1[_0x5322('0x9')](_0x5322('0xa'),attributes,{'tableName':_0x5322('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b5=['path','rimraf','../../config/environment','./migration.attributes','exports','migrations','bluebird','request-promise'];(function(_0x271df9,_0x1091a9){var _0x10eecf=function(_0xd58db7){while(--_0xd58db7){_0x271df9['push'](_0x271df9['shift']());}};_0x10eecf(++_0x1091a9);}(_0x47b5,0x1c6));var _0x547b=function(_0x28661f,_0x2bfcd6){_0x28661f=_0x28661f-0x0;var _0x1aac56=_0x47b5[_0x28661f];return _0x1aac56;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x547b('0x0'));var rp=require(_0x547b('0x1'));var fs=require('fs');var path=require(_0x547b('0x2'));var rimraf=require(_0x547b('0x3'));var config=require(_0x547b('0x4'));var attributes=require(_0x547b('0x5'));module[_0x547b('0x6')]=function(_0x1f87e6,_0x288092){return _0x1f87e6['define']('Migration',attributes,{'tableName':_0x547b('0x7'),'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 6fdf538..754eff5 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 _0x3a25=['then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x139489,_0x4addf1){var _0xb34a41=function(_0x4a1417){while(--_0x4a1417){_0x139489['push'](_0x139489['shift']());}};_0xb34a41(++_0x4addf1);}(_0x3a25,0x15d));var _0x53a2=function(_0x1ab65a,_0x81de97){_0x1ab65a=_0x1ab65a-0x0;var _0x541211=_0x3a25[_0x1ab65a];return _0x541211;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('Migration,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});} \ No newline at end of file +var _0x0efe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x2c0a29,_0x4f0ed1){var _0x38516a=function(_0x429839){while(--_0x429839){_0x2c0a29['push'](_0x2c0a29['shift']());}};_0x38516a(++_0x4f0ed1);}(_0x0efe,0x110));var _0xe0ef=function(_0x44d9a0,_0x5ce830){_0x44d9a0=_0x44d9a0-0x0;var _0x398cb7=_0x0efe[_0x44d9a0];return _0x398cb7;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var moment=require('moment');var BPromise=require(_0xe0ef('0x2'));var rs=require(_0xe0ef('0x3'));var fs=require('fs');var Redis=require(_0xe0ef('0x4'));var db=require(_0xe0ef('0x5'))['db'];var utils=require(_0xe0ef('0x6'));var logger=require(_0xe0ef('0x7'))(_0xe0ef('0x8'));var config=require(_0xe0ef('0x9'));var jayson=require(_0xe0ef('0xa'));var client=jayson[_0xe0ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49643a,_0x3a6030,_0x1a57fb){return new BPromise(function(_0x161f87,_0xa4f9be){return client[_0xe0ef('0xc')](_0x49643a,_0x1a57fb)[_0xe0ef('0xd')](function(_0x18f982){logger['info']('Migration,\x20%s,\x20%s',_0x3a6030,_0xe0ef('0xe'));logger[_0xe0ef('0xf')](_0xe0ef('0x10'),_0x3a6030,'request\x20sent',JSON[_0xe0ef('0x11')](_0x18f982));if(_0x18f982[_0xe0ef('0x12')]){if(_0x18f982['error'][_0xe0ef('0x13')]===0x1f4){logger['error'](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0xa4f9be(_0x18f982['error']['message']);}logger[_0xe0ef('0x12')](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0x161f87(_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);}else{logger[_0xe0ef('0x16')](_0xe0ef('0x14'),_0x3a6030,'request\x20sent');_0x161f87(_0x18f982[_0xe0ef('0x17')][_0xe0ef('0x15')]);}})[_0xe0ef('0x18')](function(_0xe9b6d4){logger[_0xe0ef('0x12')]('Migration,\x20%s,\x20%s',_0x3a6030,_0xe9b6d4);_0xa4f9be(_0xe9b6d4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 884a7b9..ae6c257 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 _0x2905=['create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','/:id','show'];(function(_0x20933a,_0x3467ca){var _0x2a217a=function(_0x139491){while(--_0x139491){_0x20933a['push'](_0x20933a['shift']());}};_0x2a217a(++_0x3467ca);}(_0x2905,0x19c));var _0x5290=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2905[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5290('0x0'));var util=require(_0x5290('0x1'));var path=require(_0x5290('0x2'));var timeout=require('connect-timeout');var express=require(_0x5290('0x3'));var router=express[_0x5290('0x4')]();var fs_extra=require(_0x5290('0x5'));var auth=require(_0x5290('0x6'));var interaction=require(_0x5290('0x7'));var config=require('../../config/environment');var controller=require(_0x5290('0x8'));router[_0x5290('0x9')]('/',auth[_0x5290('0xa')](),controller['index']);router['get'](_0x5290('0xb'),auth[_0x5290('0xa')](),controller[_0x5290('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5290('0xd')]);router[_0x5290('0xe')](_0x5290('0xb'),auth['isAuthenticated'](),controller[_0x5290('0xf')]);router['delete']('/:id',auth[_0x5290('0xa')](),controller['destroy']);module[_0x5290('0x10')]=router; \ No newline at end of file +var _0x58e6=['./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x58e6,0x1c2));var _0x658e=function(_0x4e076e,_0xa0c117){_0x4e076e=_0x4e076e-0x0;var _0x2d3195=_0x58e6[_0x4e076e];return _0x2d3195;};'use strict';var multer=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x658e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x658e('0x3'));var interaction=require(_0x658e('0x4'));var config=require(_0x658e('0x5'));var controller=require(_0x658e('0x6'));router[_0x658e('0x7')]('/',auth[_0x658e('0x8')](),controller[_0x658e('0x9')]);router['get']('/:id',auth[_0x658e('0x8')](),controller[_0x658e('0xa')]);router[_0x658e('0xb')]('/',auth['isAuthenticated'](),controller[_0x658e('0xc')]);router[_0x658e('0xd')](_0x658e('0xe'),auth[_0x658e('0x8')](),controller[_0x658e('0xf')]);router[_0x658e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x658e('0x11')]);module[_0x658e('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1ac7945..9bf3245 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 _0xf63e=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x2023b8,_0x5092a2){var _0x3dfd32=function(_0x22ae29){while(--_0x22ae29){_0x2023b8['push'](_0x2023b8['shift']());}};_0x3dfd32(++_0x5092a2);}(_0xf63e,0xa0));var _0xef63=function(_0xd7b6db,_0x57d326){_0xd7b6db=_0xd7b6db-0x0;var _0x2381b6=_0xf63e[_0xd7b6db];return _0x2381b6;};'use strict';var Sequelize=require(_0xef63('0x0'));module[_0xef63('0x1')]={'type':{'type':Sequelize[_0xef63('0x2')](_0xef63('0x3'),_0xef63('0x4'),_0xef63('0x5'),'turn')},'value':{'type':Sequelize[_0xef63('0x6')]},'username':{'type':Sequelize[_0xef63('0x6')]},'password':{'type':Sequelize[_0xef63('0x6')]}}; \ No newline at end of file +var _0xf6df=['externip','stun','turn','STRING','sequelize','exports','localnet'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xf6df,0x10e));var _0xff6d=function(_0x573469,_0x3261e4){_0x573469=_0x573469-0x0;var _0x3396bd=_0xf6df[_0x573469];return _0x3396bd;};'use strict';var Sequelize=require(_0xff6d('0x0'));module[_0xff6d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xff6d('0x2'),_0xff6d('0x3'),_0xff6d('0x4'),_0xff6d('0x5'))},'value':{'type':Sequelize[_0xff6d('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xff6d('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fde7fed..44ed85a 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 _0xec90=['then','info','Network,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','offset','undefined','limit','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','Network','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','rawAttributes','length','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','writeFileSync','format','toLowerCase','chan_sip.so','params','res_stun_monitor.so','TURN','/etc/asterisk/sip_xcally_%s.conf','path','ejs','lodash','../../components/parsers/qs','../../mysqldb','jayson/promise','client','http','request'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xec90,0x191));var _0x0ec9=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xec90[_0x39e283];return _0x7de89f;};'use strict';var util=require('util');var path=require(_0x0ec9('0x0'));var ejs=require(_0x0ec9('0x1'));var fs=require('fs');var _=require(_0x0ec9('0x2'));var qs=require(_0x0ec9('0x3'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x0ec9('0x4'))['db'];var jayson=require(_0x0ec9('0x5'));var client=jayson[_0x0ec9('0x6')][_0x0ec9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x62b8c6,_0x16cb91,_0x2c5ff,_0x4eaf72){return new Promise(function(_0x1a2b78,_0x147671){var _0x5d930d=_0x4eaf72||client;return _0x5d930d[_0x0ec9('0x8')](_0x62b8c6,_0x2c5ff)[_0x0ec9('0x9')](function(_0x357ca4){logger[_0x0ec9('0xa')](_0x0ec9('0xb'),_0x16cb91,_0x0ec9('0xc'));logger[_0x0ec9('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x16cb91,_0x0ec9('0xc'),JSON['stringify'](_0x357ca4));if(_0x357ca4['error']){if(_0x357ca4['error'][_0x0ec9('0xe')]===0x1f4){logger[_0x0ec9('0xf')](_0x0ec9('0xb'),_0x16cb91,_0x357ca4[_0x0ec9('0xf')]['message']);return _0x147671(_0x357ca4['error'][_0x0ec9('0x10')]);}logger[_0x0ec9('0xf')](_0x0ec9('0xb'),_0x16cb91,_0x357ca4[_0x0ec9('0xf')][_0x0ec9('0x10')]);return _0x1a2b78(_0x357ca4['error']['message']);}else{logger[_0x0ec9('0xa')](_0x0ec9('0xb'),_0x16cb91,_0x0ec9('0xc'));_0x1a2b78(_0x357ca4['result'][_0x0ec9('0x10')]);}})[_0x0ec9('0x11')](function(_0x5bb374){logger['error'](_0x0ec9('0xb'),_0x16cb91,_0x5bb374);_0x147671(_0x5bb374);});});}function respondWithResult(_0x126a8e,_0x3bcd7d){_0x3bcd7d=_0x3bcd7d||0xc8;return function(_0x4a4f11){if(_0x4a4f11){return _0x126a8e['status'](_0x3bcd7d)['json'](_0x4a4f11);}};}function respondWithFilteredResult(_0x11625f,_0x431f3f){return function(_0x1db421){if(_0x1db421){var _0x3b4bdd=typeof _0x431f3f[_0x0ec9('0x12')]===_0x0ec9('0x13')&&typeof _0x431f3f[_0x0ec9('0x14')]===_0x0ec9('0x13');var _0x5e15ae=_0x1db421['count'];var _0x19e40e=_0x3b4bdd?0x0:_0x431f3f[_0x0ec9('0x12')];var _0x3b0c26=_0x3b4bdd?_0x1db421['count']:_0x431f3f['offset']+_0x431f3f[_0x0ec9('0x14')];var _0x597017;if(_0x3b0c26>=_0x5e15ae){_0x3b0c26=_0x5e15ae;_0x597017=0xc8;}else{_0x597017=0xce;}_0x11625f[_0x0ec9('0x15')](_0x597017);return _0x11625f[_0x0ec9('0x16')](_0x0ec9('0x17'),_0x19e40e+'-'+_0x3b0c26+'/'+_0x5e15ae)['json'](_0x1db421);}return null;};}function saveUpdates(_0x28e84e){return function(_0x1501ac){if(_0x1501ac){return _0x1501ac[_0x0ec9('0x18')](_0x28e84e)['then'](function(_0xc28e9){return _0xc28e9;});}return null;};}function removeEntity(_0x2f171c){return function(_0x2a1a6c){if(_0x2a1a6c){return _0x2a1a6c[_0x0ec9('0x19')]()[_0x0ec9('0x9')](function(){_0x2f171c[_0x0ec9('0x15')](0xcc)[_0x0ec9('0x1a')]();});}};}function handleEntityNotFound(_0x4d9191){return function(_0x2590c0){if(!_0x2590c0){_0x4d9191[_0x0ec9('0x1b')](0x194);}return _0x2590c0;};}function handleError(_0x6486f8,_0x2f8b33){_0x2f8b33=_0x2f8b33||0x1f4;return function(_0x5893af){logger[_0x0ec9('0xf')](_0x5893af[_0x0ec9('0x1c')]);if(_0x5893af[_0x0ec9('0x1d')]){delete _0x5893af['name'];}_0x6486f8['status'](_0x2f8b33)['send'](_0x5893af);};}exports[_0x0ec9('0x1e')]=function(_0x4d8b48,_0x46e92b){var _0x453dd2={},_0x3d9dcc={},_0x7d2de1={'count':0x0,'rows':[]};var _0x50e716=_[_0x0ec9('0x1f')](db[_0x0ec9('0x20')]['rawAttributes'],function(_0x5b4fa5){return{'name':_0x5b4fa5[_0x0ec9('0x21')],'type':_0x5b4fa5[_0x0ec9('0x22')][_0x0ec9('0x23')]};});_0x3d9dcc[_0x0ec9('0x24')]=_[_0x0ec9('0x1f')](_0x50e716,_0x0ec9('0x1d'));_0x3d9dcc[_0x0ec9('0x25')]=_[_0x0ec9('0x26')](_0x4d8b48[_0x0ec9('0x25')]);_0x3d9dcc[_0x0ec9('0x27')]=_[_0x0ec9('0x28')](_0x3d9dcc[_0x0ec9('0x24')],_0x3d9dcc[_0x0ec9('0x25')]);_0x453dd2[_0x0ec9('0x29')]=_[_0x0ec9('0x28')](_0x3d9dcc[_0x0ec9('0x24')],qs[_0x0ec9('0x2a')](_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x2a')]));_0x453dd2[_0x0ec9('0x29')]=_0x453dd2[_0x0ec9('0x29')]['length']?_0x453dd2[_0x0ec9('0x29')]:_0x3d9dcc[_0x0ec9('0x24')];if(!_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x2b')](_0x0ec9('0x2c'))){_0x453dd2[_0x0ec9('0x14')]=qs[_0x0ec9('0x14')](_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x14')]);_0x453dd2['offset']=qs['offset'](_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x12')]);}_0x453dd2['order']=qs['sort'](_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x2d')]);_0x453dd2[_0x0ec9('0x2e')]=qs['filters'](_[_0x0ec9('0x2f')](_0x4d8b48['query'],_0x3d9dcc[_0x0ec9('0x27')]),_0x50e716);if(_0x4d8b48[_0x0ec9('0x25')][_0x0ec9('0x30')]){_0x453dd2[_0x0ec9('0x2e')]=_[_0x0ec9('0x31')](_0x453dd2[_0x0ec9('0x2e')],{'$or':_[_0x0ec9('0x1f')](_0x50e716,function(_0x3b1113){if(_0x3b1113['type']!=='VIRTUAL'){var _0x19f7d6={};_0x19f7d6[_0x3b1113[_0x0ec9('0x1d')]]={'$like':'%'+_0x4d8b48[_0x0ec9('0x25')]['filter']+'%'};return _0x19f7d6;}})});}_0x453dd2=_[_0x0ec9('0x31')]({},_0x453dd2,_0x4d8b48[_0x0ec9('0x32')]);var _0x3eefb9={'where':_0x453dd2[_0x0ec9('0x2e')]};return db[_0x0ec9('0x20')][_0x0ec9('0x33')](_0x3eefb9)[_0x0ec9('0x9')](function(_0x4b53ae){_0x7d2de1[_0x0ec9('0x33')]=_0x4b53ae;if(_0x4d8b48[_0x0ec9('0x25')]['includeAll']){_0x453dd2[_0x0ec9('0x34')]=[{'all':!![]}];}return db[_0x0ec9('0x20')][_0x0ec9('0x35')](_0x453dd2);})[_0x0ec9('0x9')](function(_0x4d3d95){_0x7d2de1[_0x0ec9('0x36')]=_0x4d3d95;return _0x7d2de1;})[_0x0ec9('0x9')](respondWithFilteredResult(_0x46e92b,_0x453dd2))[_0x0ec9('0x11')](handleError(_0x46e92b,null));};exports[_0x0ec9('0x37')]=function(_0x3212cd,_0x57512e){var _0x2aaebd={'raw':!![],'where':{'id':_0x3212cd['params']['id']}},_0x5594dc={};_0x5594dc[_0x0ec9('0x24')]=_['keys'](db[_0x0ec9('0x20')][_0x0ec9('0x38')]);_0x5594dc[_0x0ec9('0x25')]=_['keys'](_0x3212cd['query']);_0x5594dc[_0x0ec9('0x27')]=_[_0x0ec9('0x28')](_0x5594dc[_0x0ec9('0x24')],_0x5594dc[_0x0ec9('0x25')]);_0x2aaebd[_0x0ec9('0x29')]=_['intersection'](_0x5594dc[_0x0ec9('0x24')],qs[_0x0ec9('0x2a')](_0x3212cd[_0x0ec9('0x25')][_0x0ec9('0x2a')]));_0x2aaebd['attributes']=_0x2aaebd['attributes'][_0x0ec9('0x39')]?_0x2aaebd['attributes']:_0x5594dc[_0x0ec9('0x24')];if(_0x3212cd['query']['includeAll']){_0x2aaebd[_0x0ec9('0x34')]=[{'all':!![]}];}_0x2aaebd=_[_0x0ec9('0x31')]({},_0x2aaebd,_0x3212cd[_0x0ec9('0x32')]);return db[_0x0ec9('0x20')][_0x0ec9('0x3a')](_0x2aaebd)[_0x0ec9('0x9')](handleEntityNotFound(_0x57512e,null))['then'](respondWithResult(_0x57512e,null))[_0x0ec9('0x11')](handleError(_0x57512e,null));};exports[_0x0ec9('0x3b')]=function(_0x2378e7,_0xd890c3){var _0x261d6f;return db[_0x0ec9('0x20')][_0x0ec9('0x3b')](_0x2378e7[_0x0ec9('0x3c')],{'raw':!![]})[_0x0ec9('0x9')](function(_0x4bd531){_0x261d6f=_0x4bd531;return db[_0x0ec9('0x20')][_0x0ec9('0x35')]({'where':{'type':_0x2378e7['body'][_0x0ec9('0x22')]},'raw':!![]});})[_0x0ec9('0x9')](function(_0x1da42c){if(_0x261d6f[_0x0ec9('0x22')][_0x0ec9('0x3d')]()==_0x0ec9('0x3e')){var _0x1fd921=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],_0x0ec9('0x42')),_0x0ec9('0x43'));var _0x10a1ca=ejs['render'](_0x1fd921,{'networks':_0x1da42c||[]});fs['writeFileSync'](_0x0ec9('0x44'),_0x10a1ca);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x261d6f[_0x0ec9('0x22')][_0x0ec9('0x3d')]()=='TURN'){var _0x3a2a17=fs['readFileSync'](path['join'](config['root'],_0x0ec9('0x45')),_0x0ec9('0x43'));var _0x885bd7=ejs[_0x0ec9('0x46')](_0x3a2a17,{'networks':_0x1da42c||[]});fs['writeFileSync'](_0x0ec9('0x47'),_0x885bd7);return respondWithRpcPromise(_0x0ec9('0x48'),_0x0ec9('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x8517e2=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],_0x0ec9('0x49')),_0x0ec9('0x43'));var _0x216a0e=ejs[_0x0ec9('0x46')](_0x8517e2,{'networks':_0x1da42c||[]});fs[_0x0ec9('0x4a')](util[_0x0ec9('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x2378e7[_0x0ec9('0x3c')][_0x0ec9('0x22')][_0x0ec9('0x4c')]()),_0x216a0e);return respondWithRpcPromise(_0x0ec9('0x48'),_0x0ec9('0x3b'),{'module':_0x0ec9('0x4d')});}})[_0x0ec9('0x9')](function(){return _0x261d6f;})[_0x0ec9('0x9')](respondWithResult(_0xd890c3,0xc9))['catch'](handleError(_0xd890c3,null));};exports['update']=function(_0x2e8c26,_0x52a8ed){var _0x527eb0;return db[_0x0ec9('0x20')]['find']({'where':{'id':_0x2e8c26[_0x0ec9('0x4e')]['id']}})[_0x0ec9('0x9')](handleEntityNotFound(_0x52a8ed,null))['then'](saveUpdates(_0x2e8c26[_0x0ec9('0x3c')],null))[_0x0ec9('0x9')](function(_0x41ba4c){if(_0x41ba4c){_0x527eb0=_0x41ba4c;return db[_0x0ec9('0x20')][_0x0ec9('0x35')]({'where':{'type':_0x527eb0['type']},'raw':!![]});}return null;})['then'](function(_0x12e304){if(_0x527eb0[_0x0ec9('0x22')]['toUpperCase']()=='STUN'){var _0x2fa422=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config['root'],_0x0ec9('0x42')),_0x0ec9('0x43'));var _0x17d6d0=ejs[_0x0ec9('0x46')](_0x2fa422,{'networks':_0x12e304||[]});fs[_0x0ec9('0x4a')](_0x0ec9('0x44'),_0x17d6d0);return respondWithRpcPromise('Reload','update',{'module':_0x0ec9('0x4f')});}else if(_0x527eb0[_0x0ec9('0x22')][_0x0ec9('0x3d')]()==_0x0ec9('0x50')){var _0x1cc445=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],_0x0ec9('0x45')),_0x0ec9('0x43'));var _0x524700=ejs[_0x0ec9('0x46')](_0x1cc445,{'networks':_0x12e304||[]});fs[_0x0ec9('0x4a')](_0x0ec9('0x47'),_0x524700);return respondWithRpcPromise('Reload',_0x0ec9('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x2007f6=fs[_0x0ec9('0x3f')](path['join'](config[_0x0ec9('0x41')],'server/files/templates/network.ejs'),_0x0ec9('0x43'));var _0x216e88=ejs['render'](_0x2007f6,{'networks':_0x12e304||[]});fs['writeFileSync'](util[_0x0ec9('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x2e8c26[_0x0ec9('0x3c')][_0x0ec9('0x22')]['toLowerCase']()),_0x216e88);return respondWithRpcPromise('Reload',_0x0ec9('0x18'),{'module':'chan_sip.so'});}})[_0x0ec9('0x9')](function(_0x3166ed){if(_0x3166ed){return _0x527eb0;}return null;})['then'](respondWithResult(_0x52a8ed,null))[_0x0ec9('0x11')](handleError(_0x52a8ed,null));};exports[_0x0ec9('0x19')]=function(_0x28ad65,_0x5a1fa7){var _0xbdeb55;return db[_0x0ec9('0x20')][_0x0ec9('0x3a')]({'where':{'id':_0x28ad65[_0x0ec9('0x4e')]['id']}})[_0x0ec9('0x9')](function(_0x4de7e6){_0xbdeb55=_0x4de7e6;return _0x4de7e6;})[_0x0ec9('0x9')](handleEntityNotFound(_0x5a1fa7,null))[_0x0ec9('0x9')](removeEntity(_0x5a1fa7,null))[_0x0ec9('0x9')](function(){if(_0xbdeb55){return db[_0x0ec9('0x20')][_0x0ec9('0x35')]({'where':{'type':_0xbdeb55['type']},'raw':!![]});}})['then'](function(_0x3e334a){if(_0xbdeb55['type']['toUpperCase']()==_0x0ec9('0x3e')){var _0x283e18=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],'server/files/templates/stun_multiple.ejs'),_0x0ec9('0x43'));var _0x26f018=ejs[_0x0ec9('0x46')](_0x283e18,{'networks':_0x3e334a||[]});fs[_0x0ec9('0x4a')](_0x0ec9('0x44'),_0x26f018);return respondWithRpcPromise(_0x0ec9('0x48'),_0x0ec9('0x19'),{'module':_0x0ec9('0x4f')});}else if(_0xbdeb55['type'][_0x0ec9('0x3d')]()==_0x0ec9('0x50')){var _0x1ab7e0=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],_0x0ec9('0x45')),'utf8');var _0x2f7105=ejs[_0x0ec9('0x46')](_0x1ab7e0,{'networks':_0x3e334a||[]});fs[_0x0ec9('0x4a')](_0x0ec9('0x47'),_0x2f7105);return respondWithRpcPromise(_0x0ec9('0x48'),'destroy',{'module':_0x0ec9('0x4f')});}else{var _0x2a4b61=fs[_0x0ec9('0x3f')](path[_0x0ec9('0x40')](config[_0x0ec9('0x41')],'server/files/templates/network.ejs'),_0x0ec9('0x43'));var _0x17fcc4=ejs[_0x0ec9('0x46')](_0x2a4b61,{'networks':_0x3e334a||[]});fs[_0x0ec9('0x4a')](util['format'](_0x0ec9('0x51'),_0xbdeb55['type'][_0x0ec9('0x4c')]()),_0x17fcc4);return respondWithRpcPromise(_0x0ec9('0x48'),_0x0ec9('0x19'),{'module':'chan_sip.so'});}})[_0x0ec9('0x11')](handleError(_0x5a1fa7,null));}; \ No newline at end of file +var _0xe3c9=['name','send','index','map','Network','rawAttributes','type','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','keys','find','create','findAll','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','update','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','TURN','path','ejs','../../components/parsers/qs','../../config/logger','api','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','offset','undefined','limit','count','status','set','Content-Range','json','end','stack'];(function(_0x110cbb,_0x186ee7){var _0x145f91=function(_0x3d2195){while(--_0x3d2195){_0x110cbb['push'](_0x110cbb['shift']());}};_0x145f91(++_0x186ee7);}(_0xe3c9,0x12b));var _0x9e3c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe3c9[_0x5f1391];return _0x50ebe3;};'use strict';var util=require('util');var path=require(_0x9e3c('0x0'));var ejs=require(_0x9e3c('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0x9e3c('0x2'));var logger=require(_0x9e3c('0x3'))(_0x9e3c('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x9e3c('0x5'));var client=jayson['client'][_0x9e3c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45a661,_0x3d87e9,_0x5bab17,_0x49106e){return new Promise(function(_0x2d6ad1,_0x239609){var _0x3f1db3=_0x49106e||client;return _0x3f1db3[_0x9e3c('0x7')](_0x45a661,_0x5bab17)[_0x9e3c('0x8')](function(_0x2f8fee){logger['info'](_0x9e3c('0x9'),_0x3d87e9,_0x9e3c('0xa'));logger[_0x9e3c('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x3d87e9,_0x9e3c('0xa'),JSON[_0x9e3c('0xc')](_0x2f8fee));if(_0x2f8fee['error']){if(_0x2f8fee[_0x9e3c('0xd')][_0x9e3c('0xe')]===0x1f4){logger[_0x9e3c('0xd')](_0x9e3c('0x9'),_0x3d87e9,_0x2f8fee[_0x9e3c('0xd')][_0x9e3c('0xf')]);return _0x239609(_0x2f8fee[_0x9e3c('0xd')][_0x9e3c('0xf')]);}logger[_0x9e3c('0xd')](_0x9e3c('0x9'),_0x3d87e9,_0x2f8fee[_0x9e3c('0xd')][_0x9e3c('0xf')]);return _0x2d6ad1(_0x2f8fee[_0x9e3c('0xd')][_0x9e3c('0xf')]);}else{logger[_0x9e3c('0x10')](_0x9e3c('0x9'),_0x3d87e9,_0x9e3c('0xa'));_0x2d6ad1(_0x2f8fee[_0x9e3c('0x11')][_0x9e3c('0xf')]);}})[_0x9e3c('0x12')](function(_0x542437){logger[_0x9e3c('0xd')](_0x9e3c('0x9'),_0x3d87e9,_0x542437);_0x239609(_0x542437);});});}function respondWithResult(_0x36a678,_0x361f00){_0x361f00=_0x361f00||0xc8;return function(_0x114886){if(_0x114886){return _0x36a678['status'](_0x361f00)['json'](_0x114886);}};}function respondWithFilteredResult(_0x2f54b4,_0x26f432){return function(_0x5dabd3){if(_0x5dabd3){var _0x45e758=typeof _0x26f432[_0x9e3c('0x13')]===_0x9e3c('0x14')&&typeof _0x26f432[_0x9e3c('0x15')]===_0x9e3c('0x14');var _0xe5fc86=_0x5dabd3[_0x9e3c('0x16')];var _0x569e8b=_0x45e758?0x0:_0x26f432['offset'];var _0x3c935b=_0x45e758?_0x5dabd3[_0x9e3c('0x16')]:_0x26f432[_0x9e3c('0x13')]+_0x26f432[_0x9e3c('0x15')];var _0x28f3aa;if(_0x3c935b>=_0xe5fc86){_0x3c935b=_0xe5fc86;_0x28f3aa=0xc8;}else{_0x28f3aa=0xce;}_0x2f54b4[_0x9e3c('0x17')](_0x28f3aa);return _0x2f54b4[_0x9e3c('0x18')](_0x9e3c('0x19'),_0x569e8b+'-'+_0x3c935b+'/'+_0xe5fc86)[_0x9e3c('0x1a')](_0x5dabd3);}return null;};}function saveUpdates(_0x463bae){return function(_0x1a7569){if(_0x1a7569){return _0x1a7569['update'](_0x463bae)[_0x9e3c('0x8')](function(_0x24dd1e){return _0x24dd1e;});}return null;};}function removeEntity(_0x511540){return function(_0x25c164){if(_0x25c164){return _0x25c164['destroy']()[_0x9e3c('0x8')](function(){_0x511540[_0x9e3c('0x17')](0xcc)[_0x9e3c('0x1b')]();});}};}function handleEntityNotFound(_0x4d2b1a){return function(_0x43eaa2){if(!_0x43eaa2){_0x4d2b1a['sendStatus'](0x194);}return _0x43eaa2;};}function handleError(_0x3f8610,_0x5cb91f){_0x5cb91f=_0x5cb91f||0x1f4;return function(_0x1c8182){logger['error'](_0x1c8182[_0x9e3c('0x1c')]);if(_0x1c8182[_0x9e3c('0x1d')]){delete _0x1c8182[_0x9e3c('0x1d')];}_0x3f8610[_0x9e3c('0x17')](_0x5cb91f)[_0x9e3c('0x1e')](_0x1c8182);};}exports[_0x9e3c('0x1f')]=function(_0x92e60f,_0x462c10){var _0x2ea81e={},_0x13b670={},_0x535dce={'count':0x0,'rows':[]};var _0x4c4f03=_[_0x9e3c('0x20')](db[_0x9e3c('0x21')][_0x9e3c('0x22')],function(_0x447cee){return{'name':_0x447cee['fieldName'],'type':_0x447cee[_0x9e3c('0x23')]['key']};});_0x13b670['model']=_[_0x9e3c('0x20')](_0x4c4f03,_0x9e3c('0x1d'));_0x13b670[_0x9e3c('0x24')]=_['keys'](_0x92e60f[_0x9e3c('0x24')]);_0x13b670[_0x9e3c('0x25')]=_['intersection'](_0x13b670[_0x9e3c('0x26')],_0x13b670['query']);_0x2ea81e['attributes']=_[_0x9e3c('0x27')](_0x13b670[_0x9e3c('0x26')],qs['fields'](_0x92e60f['query'][_0x9e3c('0x28')]));_0x2ea81e[_0x9e3c('0x29')]=_0x2ea81e[_0x9e3c('0x29')]['length']?_0x2ea81e['attributes']:_0x13b670[_0x9e3c('0x26')];if(!_0x92e60f[_0x9e3c('0x24')][_0x9e3c('0x2a')](_0x9e3c('0x2b'))){_0x2ea81e[_0x9e3c('0x15')]=qs['limit'](_0x92e60f[_0x9e3c('0x24')]['limit']);_0x2ea81e[_0x9e3c('0x13')]=qs[_0x9e3c('0x13')](_0x92e60f['query'][_0x9e3c('0x13')]);}_0x2ea81e[_0x9e3c('0x2c')]=qs[_0x9e3c('0x2d')](_0x92e60f[_0x9e3c('0x24')][_0x9e3c('0x2d')]);_0x2ea81e[_0x9e3c('0x2e')]=qs['filters'](_['pick'](_0x92e60f['query'],_0x13b670[_0x9e3c('0x25')]),_0x4c4f03);if(_0x92e60f[_0x9e3c('0x24')][_0x9e3c('0x2f')]){_0x2ea81e[_0x9e3c('0x2e')]=_[_0x9e3c('0x30')](_0x2ea81e[_0x9e3c('0x2e')],{'$or':_[_0x9e3c('0x20')](_0x4c4f03,function(_0x3eb044){if(_0x3eb044[_0x9e3c('0x23')]!=='VIRTUAL'){var _0x20c172={};_0x20c172[_0x3eb044[_0x9e3c('0x1d')]]={'$like':'%'+_0x92e60f['query']['filter']+'%'};return _0x20c172;}})});}_0x2ea81e=_[_0x9e3c('0x30')]({},_0x2ea81e,_0x92e60f[_0x9e3c('0x31')]);var _0x450c8a={'where':_0x2ea81e[_0x9e3c('0x2e')]};return db['Network']['count'](_0x450c8a)[_0x9e3c('0x8')](function(_0x765bd6){_0x535dce[_0x9e3c('0x16')]=_0x765bd6;if(_0x92e60f[_0x9e3c('0x24')][_0x9e3c('0x32')]){_0x2ea81e[_0x9e3c('0x33')]=[{'all':!![]}];}return db[_0x9e3c('0x21')]['findAll'](_0x2ea81e);})[_0x9e3c('0x8')](function(_0x1607a9){_0x535dce[_0x9e3c('0x34')]=_0x1607a9;return _0x535dce;})[_0x9e3c('0x8')](respondWithFilteredResult(_0x462c10,_0x2ea81e))[_0x9e3c('0x12')](handleError(_0x462c10,null));};exports[_0x9e3c('0x35')]=function(_0x16a705,_0x56f9fa){var _0x127fb7={'raw':!![],'where':{'id':_0x16a705[_0x9e3c('0x36')]['id']}},_0x55886d={};_0x55886d[_0x9e3c('0x26')]=_['keys'](db[_0x9e3c('0x21')][_0x9e3c('0x22')]);_0x55886d[_0x9e3c('0x24')]=_[_0x9e3c('0x37')](_0x16a705[_0x9e3c('0x24')]);_0x55886d[_0x9e3c('0x25')]=_['intersection'](_0x55886d[_0x9e3c('0x26')],_0x55886d['query']);_0x127fb7[_0x9e3c('0x29')]=_[_0x9e3c('0x27')](_0x55886d[_0x9e3c('0x26')],qs[_0x9e3c('0x28')](_0x16a705['query'][_0x9e3c('0x28')]));_0x127fb7[_0x9e3c('0x29')]=_0x127fb7['attributes']['length']?_0x127fb7[_0x9e3c('0x29')]:_0x55886d[_0x9e3c('0x26')];if(_0x16a705[_0x9e3c('0x24')][_0x9e3c('0x32')]){_0x127fb7[_0x9e3c('0x33')]=[{'all':!![]}];}_0x127fb7=_[_0x9e3c('0x30')]({},_0x127fb7,_0x16a705[_0x9e3c('0x31')]);return db[_0x9e3c('0x21')][_0x9e3c('0x38')](_0x127fb7)[_0x9e3c('0x8')](handleEntityNotFound(_0x56f9fa,null))[_0x9e3c('0x8')](respondWithResult(_0x56f9fa,null))[_0x9e3c('0x12')](handleError(_0x56f9fa,null));};exports[_0x9e3c('0x39')]=function(_0x32367b,_0x5c1beb){var _0xa9fb8c;return db[_0x9e3c('0x21')][_0x9e3c('0x39')](_0x32367b['body'],{'raw':!![]})[_0x9e3c('0x8')](function(_0x4e2243){_0xa9fb8c=_0x4e2243;return db[_0x9e3c('0x21')][_0x9e3c('0x3a')]({'where':{'type':_0x32367b[_0x9e3c('0x3b')]['type']},'raw':!![]});})[_0x9e3c('0x8')](function(_0x36ceff){if(_0xa9fb8c[_0x9e3c('0x23')][_0x9e3c('0x3c')]()==_0x9e3c('0x3d')){var _0x21385a=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],_0x9e3c('0x41')),_0x9e3c('0x42'));var _0x5b900a=ejs[_0x9e3c('0x43')](_0x21385a,{'networks':_0x36ceff||[]});fs[_0x9e3c('0x44')](_0x9e3c('0x45'),_0x5b900a);return respondWithRpcPromise(_0x9e3c('0x46'),'create',{'module':_0x9e3c('0x47')});}else if(_0xa9fb8c[_0x9e3c('0x23')]['toUpperCase']()=='TURN'){var _0x20ed09=fs['readFileSync'](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x15d650=ejs[_0x9e3c('0x43')](_0x20ed09,{'networks':_0x36ceff||[]});fs[_0x9e3c('0x44')](_0x9e3c('0x48'),_0x15d650);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x39'),{'module':_0x9e3c('0x47')});}else{var _0x26577b=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],_0x9e3c('0x49')),'utf8');var _0x5beae2=ejs[_0x9e3c('0x43')](_0x26577b,{'networks':_0x36ceff||[]});fs[_0x9e3c('0x44')](util[_0x9e3c('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x32367b[_0x9e3c('0x3b')]['type']['toLowerCase']()),_0x5beae2);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x39'),{'module':'chan_sip.so'});}})[_0x9e3c('0x8')](function(){return _0xa9fb8c;})[_0x9e3c('0x8')](respondWithResult(_0x5c1beb,0xc9))[_0x9e3c('0x12')](handleError(_0x5c1beb,null));};exports['update']=function(_0x26326f,_0x7214fc){var _0x2d3058;return db[_0x9e3c('0x21')][_0x9e3c('0x38')]({'where':{'id':_0x26326f[_0x9e3c('0x36')]['id']}})[_0x9e3c('0x8')](handleEntityNotFound(_0x7214fc,null))['then'](saveUpdates(_0x26326f[_0x9e3c('0x3b')],null))['then'](function(_0x168ceb){if(_0x168ceb){_0x2d3058=_0x168ceb;return db['Network'][_0x9e3c('0x3a')]({'where':{'type':_0x2d3058[_0x9e3c('0x23')]},'raw':!![]});}return null;})['then'](function(_0x1e70ea){if(_0x2d3058[_0x9e3c('0x23')]['toUpperCase']()=='STUN'){var _0x1be4a7=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],_0x9e3c('0x41')),_0x9e3c('0x42'));var _0xb48eec=ejs[_0x9e3c('0x43')](_0x1be4a7,{'networks':_0x1e70ea||[]});fs[_0x9e3c('0x44')](_0x9e3c('0x45'),_0xb48eec);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x4b'),{'module':_0x9e3c('0x47')});}else if(_0x2d3058[_0x9e3c('0x23')][_0x9e3c('0x3c')]()=='TURN'){var _0x3a952b=fs['readFileSync'](path['join'](config[_0x9e3c('0x40')],_0x9e3c('0x4c')),_0x9e3c('0x42'));var _0x4085de=ejs['render'](_0x3a952b,{'networks':_0x1e70ea||[]});fs['writeFileSync'](_0x9e3c('0x48'),_0x4085de);return respondWithRpcPromise(_0x9e3c('0x46'),'update',{'module':_0x9e3c('0x47')});}else{var _0x289a31=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],_0x9e3c('0x49')),'utf8');var _0x1d3a64=ejs[_0x9e3c('0x43')](_0x289a31,{'networks':_0x1e70ea||[]});fs[_0x9e3c('0x44')](util[_0x9e3c('0x4a')](_0x9e3c('0x4d'),_0x26326f['body']['type'][_0x9e3c('0x4e')]()),_0x1d3a64);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x4b'),{'module':_0x9e3c('0x4f')});}})[_0x9e3c('0x8')](function(_0x424d41){if(_0x424d41){return _0x2d3058;}return null;})[_0x9e3c('0x8')](respondWithResult(_0x7214fc,null))[_0x9e3c('0x12')](handleError(_0x7214fc,null));};exports[_0x9e3c('0x50')]=function(_0x57d88c,_0x1a1f0e){var _0x532685;return db['Network'][_0x9e3c('0x38')]({'where':{'id':_0x57d88c[_0x9e3c('0x36')]['id']}})['then'](function(_0x107c4a){_0x532685=_0x107c4a;return _0x107c4a;})[_0x9e3c('0x8')](handleEntityNotFound(_0x1a1f0e,null))[_0x9e3c('0x8')](removeEntity(_0x1a1f0e,null))[_0x9e3c('0x8')](function(){if(_0x532685){return db[_0x9e3c('0x21')][_0x9e3c('0x3a')]({'where':{'type':_0x532685[_0x9e3c('0x23')]},'raw':!![]});}})[_0x9e3c('0x8')](function(_0x495d34){if(_0x532685['type'][_0x9e3c('0x3c')]()==_0x9e3c('0x3d')){var _0x3b8e6d=fs[_0x9e3c('0x3e')](path['join'](config['root'],_0x9e3c('0x41')),_0x9e3c('0x42'));var _0x3795f9=ejs[_0x9e3c('0x43')](_0x3b8e6d,{'networks':_0x495d34||[]});fs[_0x9e3c('0x44')](_0x9e3c('0x45'),_0x3795f9);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x532685[_0x9e3c('0x23')][_0x9e3c('0x3c')]()==_0x9e3c('0x51')){var _0x4d369f=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config[_0x9e3c('0x40')],_0x9e3c('0x4c')),_0x9e3c('0x42'));var _0x4b8c78=ejs[_0x9e3c('0x43')](_0x4d369f,{'networks':_0x495d34||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4b8c78);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x4185f2=fs[_0x9e3c('0x3e')](path[_0x9e3c('0x3f')](config['root'],'server/files/templates/network.ejs'),_0x9e3c('0x42'));var _0x313e6a=ejs[_0x9e3c('0x43')](_0x4185f2,{'networks':_0x495d34||[]});fs[_0x9e3c('0x44')](util[_0x9e3c('0x4a')](_0x9e3c('0x4d'),_0x532685[_0x9e3c('0x23')][_0x9e3c('0x4e')]()),_0x313e6a);return respondWithRpcPromise(_0x9e3c('0x46'),_0x9e3c('0x50'),{'module':'chan_sip.so'});}})[_0x9e3c('0x12')](handleError(_0x1a1f0e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 369a1ad..e5b077c 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 _0x76dc=['rimraf','exports','network','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2a638f,_0x20db3f){_0x2a638f=_0x2a638f-0x0;var _0x836eff=_0x76dc[_0x2a638f];return _0x836eff;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var logger=require(_0xc76d('0x2'))(_0xc76d('0x3'));var moment=require('moment');var BPromise=require(_0xc76d('0x4'));var rp=require(_0xc76d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc76d('0x6'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xc76d('0x7')]=function(_0x29ab70,_0x1c86fc){return _0x29ab70['define']('Network',attributes,{'tableName':_0xc76d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','define','lodash','util'];(function(_0xb545e0,_0x255020){var _0x5e37c9=function(_0x3b32b2){while(--_0x3b32b2){_0xb545e0['push'](_0xb545e0['shift']());}};_0x5e37c9(++_0x255020);}(_0xe130,0x127));var _0x0e13=function(_0x59fba8,_0x2a727e){_0x59fba8=_0x59fba8-0x0;var _0xc7fef1=_0xe130[_0x59fba8];return _0xc7fef1;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('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 828b1d5..d0b2be4 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7feb45,_0x56dd63){var _0x31650f=function(_0x3754d8){while(--_0x3754d8){_0x7feb45['push'](_0x7feb45['shift']());}};_0x31650f(++_0x56dd63);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x971bf0,_0x12bbfb){var _0x510cd1=function(_0x524548){while(--_0x524548){_0x971bf0['push'](_0x971bf0['shift']());}};_0x510cd1(++_0x12bbfb);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 90d077e..0874a7d 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 _0x2ace=['removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','update','destroy','delete','removeDispositions'];(function(_0x382719,_0x91d5cb){var _0x48cff9=function(_0xf539c3){while(--_0xf539c3){_0x382719['push'](_0x382719['shift']());}};_0x48cff9(++_0x91d5cb);}(_0x2ace,0xaa));var _0xe2ac=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0x2ace[_0x208961];return _0x4236f5;};'use strict';var multer=require(_0xe2ac('0x0'));var util=require(_0xe2ac('0x1'));var path=require(_0xe2ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2ac('0x3'));var router=express[_0xe2ac('0x4')]();var fs_extra=require(_0xe2ac('0x5'));var auth=require(_0xe2ac('0x6'));var interaction=require(_0xe2ac('0x7'));var config=require(_0xe2ac('0x8'));var controller=require(_0xe2ac('0x9'));router[_0xe2ac('0xa')]('/',auth['isAuthenticated'](),controller[_0xe2ac('0xb')]);router[_0xe2ac('0xa')](_0xe2ac('0xc'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0xe')]);router[_0xe2ac('0xa')](_0xe2ac('0xf'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x10')]);router[_0xe2ac('0xa')](_0xe2ac('0x11'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x12')]);router[_0xe2ac('0xa')](_0xe2ac('0x13'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x14')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xe2ac('0x15')]);router[_0xe2ac('0xa')](_0xe2ac('0x16'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x17')]);router[_0xe2ac('0xa')](_0xe2ac('0x18'),auth['isAuthenticated'](),controller[_0xe2ac('0x19')]);router[_0xe2ac('0x1a')]('/',auth[_0xe2ac('0xd')](),controller['create']);router[_0xe2ac('0x1a')]('/:id/dispositions',auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x1b')]);router[_0xe2ac('0x1a')](_0xe2ac('0x13'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x1c')]);router[_0xe2ac('0x1a')](_0xe2ac('0x1d'),controller[_0xe2ac('0x1e')]);router[_0xe2ac('0x1a')](_0xe2ac('0x1f'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x20')]);router[_0xe2ac('0x1a')](_0xe2ac('0x18'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x21')]);router[_0xe2ac('0x1a')](_0xe2ac('0x22'),auth['isAuthenticated'](),controller[_0xe2ac('0x23')]);router['put'](_0xe2ac('0xf'),auth['isAuthenticated'](),controller[_0xe2ac('0x24')]);router['delete'](_0xe2ac('0xf'),auth['isAuthenticated'](),controller[_0xe2ac('0x25')]);router[_0xe2ac('0x26')](_0xe2ac('0x11'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x27')]);router[_0xe2ac('0x26')](_0xe2ac('0x13'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x28')]);router[_0xe2ac('0x26')](_0xe2ac('0x18'),auth[_0xe2ac('0xd')](),controller[_0xe2ac('0x29')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4c9098,_0x15d815){var _0x29be7c=function(_0x16ba37){while(--_0x16ba37){_0x4c9098['push'](_0x4c9098['shift']());}};_0x29be7c(++_0x15d815);}(_0x53ec,0x176));var _0xc53e=function(_0x11c331,_0x523ccf){_0x11c331=_0x11c331-0x0;var _0x1b89e1=_0x53ec[_0x11c331];return _0x1b89e1;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc53e('0x2'));var router=express[_0xc53e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x5'));var controller=require('./openchannelAccount.controller');router[_0xc53e('0x6')]('/',auth[_0xc53e('0x7')](),controller[_0xc53e('0x8')]);router[_0xc53e('0x6')](_0xc53e('0x9'),auth[_0xc53e('0x7')](),controller[_0xc53e('0xa')]);router[_0xc53e('0x6')](_0xc53e('0xb'),auth[_0xc53e('0x7')](),controller['show']);router[_0xc53e('0x6')]('/:id/dispositions',auth[_0xc53e('0x7')](),controller[_0xc53e('0xc')]);router[_0xc53e('0x6')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xc53e('0xe'),auth[_0xc53e('0x7')](),controller[_0xc53e('0xf')]);router['get'](_0xc53e('0x10'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x11')]);router['get'](_0xc53e('0x12'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x13')]);router['post']('/',auth[_0xc53e('0x7')](),controller['create']);router[_0xc53e('0x14')](_0xc53e('0x15'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x16')]);router[_0xc53e('0x14')](_0xc53e('0xd'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x14')](_0xc53e('0x18'),controller[_0xc53e('0x19')]);router[_0xc53e('0x14')](_0xc53e('0xe'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x1a')]);router[_0xc53e('0x14')](_0xc53e('0x12'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x1b')]);router['post'](_0xc53e('0x1c'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x1d')]);router[_0xc53e('0x1e')](_0xc53e('0xb'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x1f')]);router['delete'](_0xc53e('0xb'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x20')]);router['delete']('/:id/dispositions',auth[_0xc53e('0x7')](),controller[_0xc53e('0x21')]);router[_0xc53e('0x22')]('/:id/canned_answers',auth[_0xc53e('0x7')](),controller[_0xc53e('0x23')]);router[_0xc53e('0x22')](_0xc53e('0x12'),auth[_0xc53e('0x7')](),controller[_0xc53e('0x24')]);module[_0xc53e('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0777c30..117d537 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 _0x0328=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x42f56f,_0x42fbc1){var _0x23edca=function(_0x392050){while(--_0x392050){_0x42f56f['push'](_0x42f56f['shift']());}};_0x23edca(++_0x42fbc1);}(_0x0328,0x148));var _0x8032=function(_0x292fda,_0x4cd0b7){_0x292fda=_0x292fda-0x0;var _0x53fd5c=_0x0328[_0x292fda];return _0x53fd5c;};'use strict';var Sequelize=require(_0x8032('0x0'));var rs=require(_0x8032('0x1'));module[_0x8032('0x2')]={'name':{'type':Sequelize[_0x8032('0x3')],'unique':_0x8032('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x8032('0x3')]},'token':{'type':Sequelize[_0x8032('0x3')],'defaultValue':function(){return rs[_0x8032('0x5')]();}},'replyUri':{'type':Sequelize[_0x8032('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8032('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8032('0x6')],'defaultValue':function(){return _0x8032('0x7');}},'notificationSound':{'type':Sequelize[_0x8032('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8032('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8032('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8032('0x3')]},'queueTransfer':{'type':Sequelize[_0x8032('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8032('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8032('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8032('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8032('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8032('0xb'),'set':function(_0x239d74){if(!_0x239d74)this[_0x8032('0xc')]('mandatoryDispositionPauseId',null);this[_0x8032('0xc')](_0x8032('0xd'),_0x239d74);}}}; \ No newline at end of file +var _0x609d=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','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'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x609d,0x106));var _0xd609=function(_0xd91aea,_0x90202d){_0xd91aea=_0xd91aea-0x0;var _0xed7cb0=_0x609d[_0xd91aea];return _0xed7cb0;};'use strict';var Sequelize=require(_0xd609('0x0'));var rs=require(_0xd609('0x1'));module[_0xd609('0x2')]={'name':{'type':Sequelize[_0xd609('0x3')],'unique':_0xd609('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd609('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd609('0x5')],'defaultValue':function(){return _0xd609('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd609('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd609('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xd609('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd609('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd609('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd609('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd609('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xd609('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xd609('0x7')],'defaultValue':![],'comment':_0xd609('0xa'),'set':function(_0x4ab933){if(!_0x4ab933)this[_0xd609('0xb')](_0xd609('0xc'),null);this[_0xd609('0xb')]('mandatoryDisposition',_0x4ab933);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7d6b4f1..4906f20 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 _0x8d37=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelAccounts','stack','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','OpenchannelAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','includes','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','from','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','DESC','out','OpenchannelMessage','Messages','dataValues','eml-format'];(function(_0x23e690,_0x1ed185){var _0xb8768c=function(_0x51ffeb){while(--_0x51ffeb){_0x23e690['push'](_0x23e690['shift']());}};_0xb8768c(++_0x1ed185);}(_0x8d37,0xbc));var _0x78d3=function(_0x1cfe5d,_0x3aa762){_0x1cfe5d=_0x1cfe5d-0x0;var _0x496e7d=_0x8d37[_0x1cfe5d];return _0x496e7d;};'use strict';var emlformat=require(_0x78d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78d3('0x1'));var jsonpatch=require(_0x78d3('0x2'));var rp=require(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require(_0x78d3('0x5'));var Mustache=require(_0x78d3('0x6'));var util=require(_0x78d3('0x7'));var path=require('path');var sox=require(_0x78d3('0x8'));var csv=require(_0x78d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d3('0xa'));var _=require(_0x78d3('0xb'));var squel=require('squel');var crypto=require(_0x78d3('0xc'));var jsforce=require(_0x78d3('0xd'));var deskjs=require(_0x78d3('0xe'));var toCsv=require(_0x78d3('0x9'));var querystring=require(_0x78d3('0xf'));var Papa=require(_0x78d3('0x10'));var Redis=require('ioredis');var authService=require(_0x78d3('0x11'));var qs=require(_0x78d3('0x12'));var as=require(_0x78d3('0x13'));var hardwareService=require(_0x78d3('0x14'));var logger=require(_0x78d3('0x15'))('api');var utils=require(_0x78d3('0x16'));var config=require(_0x78d3('0x17'));var licenseUtil=require(_0x78d3('0x18'));var db=require(_0x78d3('0x19'))['db'];config[_0x78d3('0x1a')]=_[_0x78d3('0x1b')](config[_0x78d3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x78d3('0x1c'))(new Redis(config[_0x78d3('0x1a')]));require(_0x78d3('0x1d'))['register'](socket);var jayson=require(_0x78d3('0x1e'));var client=jayson['client'][_0x78d3('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x78d3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5aa7c9,_0xf0d7fa,_0x37aec9,_0x58a812){return new BPromise(function(_0x55608f,_0x427a87){var _0x9fedb1=_0x58a812||client;return _0x9fedb1[_0x78d3('0x20')](_0x5aa7c9,_0x37aec9)['then'](function(_0x55e489){logger[_0x78d3('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0xf0d7fa,'request\x20sent');logger['debug'](_0x78d3('0x22'),_0xf0d7fa,_0x78d3('0x23'),JSON[_0x78d3('0x24')](_0x55e489));if(_0x55e489['error']){if(_0x55e489[_0x78d3('0x25')][_0x78d3('0x26')]===0x1f4){logger['error'](_0x78d3('0x27'),_0xf0d7fa,_0x55e489[_0x78d3('0x25')][_0x78d3('0x28')]);return _0x427a87(_0x55e489[_0x78d3('0x25')][_0x78d3('0x28')]);}logger[_0x78d3('0x25')](_0x78d3('0x27'),_0xf0d7fa,_0x55e489[_0x78d3('0x25')][_0x78d3('0x28')]);return _0x55608f(_0x55e489[_0x78d3('0x25')]['message']);}else{logger[_0x78d3('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0xf0d7fa,_0x78d3('0x23'));_0x55608f(_0x55e489[_0x78d3('0x29')]['message']);}})['catch'](function(_0x51b236){logger[_0x78d3('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xf0d7fa,_0x51b236);_0x427a87(_0x51b236);});});}function respondWithStatusCode(_0x4cdcf1,_0x1aa479){_0x1aa479=_0x1aa479||0xcc;return function(_0x361803){if(_0x361803){return _0x4cdcf1[_0x78d3('0x2a')](_0x1aa479);}return _0x4cdcf1[_0x78d3('0x2b')](_0x1aa479)[_0x78d3('0x2c')]();};}function respondWithResult(_0x5c0507,_0xfa0a51){_0xfa0a51=_0xfa0a51||0xc8;return function(_0x2f442f){if(_0x2f442f){return _0x5c0507[_0x78d3('0x2b')](_0xfa0a51)[_0x78d3('0x2d')](_0x2f442f);}};}function respondWithFilteredResult(_0x18dcd4,_0x4300ea){return function(_0x291fa8){if(_0x291fa8){var _0x3aa051=typeof _0x4300ea[_0x78d3('0x2e')]===_0x78d3('0x2f')&&typeof _0x4300ea[_0x78d3('0x30')]===_0x78d3('0x2f');var _0x29f3cc=_0x291fa8[_0x78d3('0x31')];var _0x5314c0=_0x3aa051?0x0:_0x4300ea[_0x78d3('0x2e')];var _0x1bf593=_0x3aa051?_0x291fa8[_0x78d3('0x31')]:_0x4300ea[_0x78d3('0x2e')]+_0x4300ea[_0x78d3('0x30')];var _0x663f58;if(_0x1bf593>=_0x29f3cc){_0x1bf593=_0x29f3cc;_0x663f58=0xc8;}else{_0x663f58=0xce;}_0x18dcd4[_0x78d3('0x2b')](_0x663f58);return _0x18dcd4['set'](_0x78d3('0x32'),_0x5314c0+'-'+_0x1bf593+'/'+_0x29f3cc)[_0x78d3('0x2d')](_0x291fa8);}return null;};}function patchUpdates(_0x4c7170){return function(_0x5e219c){try{jsonpatch[_0x78d3('0x33')](_0x5e219c,_0x4c7170,!![]);}catch(_0x4b457a){return BPromise[_0x78d3('0x34')](_0x4b457a);}return _0x5e219c[_0x78d3('0x35')]();};}function saveUpdates(_0xd5d02f,_0x13a162){return function(_0x586754){if(_0x586754){return _0x586754[_0x78d3('0x36')](_0xd5d02f)['then'](function(_0x1e4611){return _0x1e4611;});}return null;};}function removeEntity(_0x565c18,_0x57ca0e){return function(_0x1a1a45){if(_0x1a1a45){return _0x1a1a45[_0x78d3('0x37')]()[_0x78d3('0x38')](function(){var _0x54297a=_0x1a1a45[_0x78d3('0x39')]({'plain':!![]});var _0x57eb33=_0x78d3('0x3a');return db['UserProfileResource'][_0x78d3('0x37')]({'where':{'type':_0x57eb33,'resourceId':_0x54297a['id']}})[_0x78d3('0x38')](function(){return _0x1a1a45;});})[_0x78d3('0x38')](function(){_0x565c18['status'](0xcc)[_0x78d3('0x2c')]();});}};}function handleEntityNotFound(_0x88ae51,_0x2b0ce1){return function(_0x2fd535){if(!_0x2fd535){_0x88ae51[_0x78d3('0x2a')](0x194);}return _0x2fd535;};}function handleError(_0x3c78c9,_0xd77ee6){_0xd77ee6=_0xd77ee6||0x1f4;return function(_0x12b58){logger[_0x78d3('0x25')](_0x12b58[_0x78d3('0x3b')]);if(_0x12b58['name']){delete _0x12b58['name'];}_0x3c78c9[_0x78d3('0x2b')](_0xd77ee6)[_0x78d3('0x3c')](_0x12b58);};}exports[_0x78d3('0x3d')]=function(_0x14aff0,_0x2d8d88){var _0x4d2643={'include':[{'model':db[_0x78d3('0x3e')],'as':_0x78d3('0x3f')}]},_0x1e2015={},_0x47174c={'count':0x0,'rows':[]};var _0x22afab=_[_0x78d3('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x11afbc){return{'name':_0x11afbc[_0x78d3('0x41')],'type':_0x11afbc[_0x78d3('0x42')][_0x78d3('0x43')]};});_0x1e2015[_0x78d3('0x44')]=_[_0x78d3('0x40')](_0x22afab,_0x78d3('0x45'));_0x1e2015['query']=_[_0x78d3('0x46')](_0x14aff0['query']);_0x1e2015['filters']=_[_0x78d3('0x47')](_0x1e2015[_0x78d3('0x44')],_0x1e2015[_0x78d3('0x48')]);_0x4d2643[_0x78d3('0x49')]=_['intersection'](_0x1e2015[_0x78d3('0x44')],qs[_0x78d3('0x4a')](_0x14aff0['query']['fields']));_0x4d2643['attributes']=_0x4d2643[_0x78d3('0x49')]['length']?_0x4d2643[_0x78d3('0x49')]:_0x1e2015[_0x78d3('0x44')];if(!_0x14aff0[_0x78d3('0x48')][_0x78d3('0x4b')](_0x78d3('0x4c'))){_0x4d2643[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0x14aff0[_0x78d3('0x48')][_0x78d3('0x30')]);_0x4d2643[_0x78d3('0x2e')]=qs['offset'](_0x14aff0[_0x78d3('0x48')][_0x78d3('0x2e')]);}_0x4d2643[_0x78d3('0x4d')]=qs[_0x78d3('0x4e')](_0x14aff0[_0x78d3('0x48')][_0x78d3('0x4e')]);_0x4d2643[_0x78d3('0x4f')]=qs['filters'](_[_0x78d3('0x50')](_0x14aff0[_0x78d3('0x48')],_0x1e2015[_0x78d3('0x51')]),_0x22afab);if(_0x14aff0[_0x78d3('0x48')]['filter']){_0x4d2643[_0x78d3('0x4f')]=_['merge'](_0x4d2643[_0x78d3('0x4f')],{'$or':_[_0x78d3('0x40')](_0x22afab,function(_0x359826){if(_0x359826['type']!==_0x78d3('0x52')){var _0x568aa7={};_0x568aa7[_0x359826[_0x78d3('0x45')]]={'$like':'%'+_0x14aff0[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0x568aa7;}})});}_0x4d2643=_[_0x78d3('0x54')]({},_0x4d2643,_0x14aff0['options']);var _0x3537c9={'where':_0x4d2643[_0x78d3('0x4f')]};return db[_0x78d3('0x55')][_0x78d3('0x31')](_0x3537c9)[_0x78d3('0x38')](function(_0x498fe6){_0x47174c[_0x78d3('0x31')]=_0x498fe6;if(_0x14aff0[_0x78d3('0x48')][_0x78d3('0x56')]){_0x4d2643[_0x78d3('0x57')]=[{'all':!![]}];}return db[_0x78d3('0x55')][_0x78d3('0x58')](_0x4d2643);})[_0x78d3('0x38')](function(_0x33cbca){_0x47174c[_0x78d3('0x59')]=_0x33cbca;return _0x47174c;})[_0x78d3('0x38')](respondWithFilteredResult(_0x2d8d88,_0x4d2643))[_0x78d3('0x5a')](handleError(_0x2d8d88,null));};exports[_0x78d3('0x5b')]=function(_0x5a1f02,_0x3eb210){var _0x2d77a4={'raw':![],'where':{'id':_0x5a1f02[_0x78d3('0x5c')]['id']},'include':[{'model':db[_0x78d3('0x3e')],'as':_0x78d3('0x3f')}]},_0x331589={};_0x331589[_0x78d3('0x44')]=_['keys'](db[_0x78d3('0x55')][_0x78d3('0x5d')]);_0x331589[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0x5a1f02[_0x78d3('0x48')]);_0x331589[_0x78d3('0x51')]=_['intersection'](_0x331589[_0x78d3('0x44')],_0x331589[_0x78d3('0x48')]);_0x2d77a4['attributes']=_['intersection'](_0x331589[_0x78d3('0x44')],qs['fields'](_0x5a1f02[_0x78d3('0x48')][_0x78d3('0x4a')]));_0x2d77a4[_0x78d3('0x49')]=_0x2d77a4['attributes'][_0x78d3('0x5e')]?_0x2d77a4[_0x78d3('0x49')]:_0x331589[_0x78d3('0x44')];if(_0x5a1f02[_0x78d3('0x48')][_0x78d3('0x56')]){_0x2d77a4[_0x78d3('0x57')]=[{'all':!![]}];}_0x2d77a4=_['merge']({},_0x2d77a4,_0x5a1f02[_0x78d3('0x5f')]);return db[_0x78d3('0x55')]['find'](_0x2d77a4)['then'](handleEntityNotFound(_0x3eb210,null))[_0x78d3('0x38')](respondWithResult(_0x3eb210,null))[_0x78d3('0x5a')](handleError(_0x3eb210,null));};exports[_0x78d3('0x60')]=function(_0xd5f772,_0x55eada){return db[_0x78d3('0x55')][_0x78d3('0x60')](_0xd5f772[_0x78d3('0x61')],{})[_0x78d3('0x38')](function(_0x398fbe){var _0x4b8843=_0xd5f772[_0x78d3('0x62')][_0x78d3('0x39')]({'plain':!![]});if(!_0x4b8843)throw new Error(_0x78d3('0x63'));if(_0x4b8843[_0x78d3('0x64')]===_0x78d3('0x62')){var _0x175f13=_0x398fbe[_0x78d3('0x39')]({'plain':!![]});var _0x464644=_0x78d3('0x3a');return db[_0x78d3('0x65')]['find']({'where':{'name':_0x464644,'userProfileId':_0x4b8843[_0x78d3('0x66')]},'raw':!![]})[_0x78d3('0x38')](function(_0x172588){if(_0x172588&&_0x172588[_0x78d3('0x67')]===0x0){return db[_0x78d3('0x68')][_0x78d3('0x60')]({'name':_0x175f13[_0x78d3('0x45')],'resourceId':_0x175f13['id'],'type':_0x172588['name'],'sectionId':_0x172588['id']},{})['then'](function(){return _0x398fbe;});}else{return _0x398fbe;}})[_0x78d3('0x5a')](function(_0x3a7744){logger[_0x78d3('0x25')](_0x78d3('0x69'),_0x3a7744);throw _0x3a7744;});}return _0x398fbe;})[_0x78d3('0x38')](respondWithResult(_0x55eada,0xc9))[_0x78d3('0x5a')](handleError(_0x55eada,null));};exports[_0x78d3('0x36')]=function(_0x90b62,_0x32a9c1){if(_0x90b62[_0x78d3('0x61')]['id']){delete _0x90b62[_0x78d3('0x61')]['id'];}return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x90b62[_0x78d3('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x78d3('0x3f')}]})[_0x78d3('0x38')](handleEntityNotFound(_0x32a9c1,null))[_0x78d3('0x38')](saveUpdates(_0x90b62[_0x78d3('0x61')],null))[_0x78d3('0x38')](respondWithResult(_0x32a9c1,null))[_0x78d3('0x5a')](handleError(_0x32a9c1,null));};exports[_0x78d3('0x37')]=function(_0x42b201,_0xe08cd5){return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x42b201[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0xe08cd5,null))[_0x78d3('0x38')](removeEntity(_0xe08cd5,null))['catch'](handleError(_0xe08cd5,null));};exports[_0x78d3('0x6b')]=function(_0x23a179,_0xb7a828){return db[_0x78d3('0x55')][_0x78d3('0x6b')]()[_0x78d3('0x38')](respondWithResult(_0xb7a828,null))[_0x78d3('0x5a')](handleError(_0xb7a828,null));};exports['addDisposition']=function(_0x4c1113,_0x231543,_0x3fed88){if(_0x4c1113[_0x78d3('0x61')]['id']){delete _0x4c1113['body']['id'];}return db['OpenchannelAccount'][_0x78d3('0x6a')]({'where':{'id':_0x4c1113[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x231543,null))['then'](function(_0x4f6de9){if(_0x4f6de9){_0x4c1113[_0x78d3('0x61')][_0x78d3('0x6c')]=_0x4f6de9['id'];return db[_0x78d3('0x6d')]['create'](_0x4c1113[_0x78d3('0x61')]);}})[_0x78d3('0x38')](respondWithResult(_0x231543,null))[_0x78d3('0x5a')](handleError(_0x231543,null));};exports['getDispositions']=function(_0xb803ea,_0x3bbb42,_0x594cd2){var _0x3b6638={'raw':![],'where':{}};var _0x1637eb={};var _0x385dbc={'count':0x0,'rows':[]};return db[_0x78d3('0x55')][_0x78d3('0x6e')]({'where':{'id':_0xb803ea[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x3bbb42,null))[_0x78d3('0x38')](function(_0x28be16){if(_0x28be16){_0x1637eb['model']=_[_0x78d3('0x46')](db[_0x78d3('0x6d')]['rawAttributes']);_0x1637eb[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0xb803ea[_0x78d3('0x48')]);_0x1637eb[_0x78d3('0x51')]=_[_0x78d3('0x47')](_0x1637eb[_0x78d3('0x44')],_0x1637eb[_0x78d3('0x48')]);_0x3b6638[_0x78d3('0x49')]=_[_0x78d3('0x47')](_0x1637eb[_0x78d3('0x44')],qs[_0x78d3('0x4a')](_0xb803ea['query']['fields']));_0x3b6638[_0x78d3('0x49')]=_0x3b6638[_0x78d3('0x49')]['length']?_0x3b6638[_0x78d3('0x49')]:_0x1637eb[_0x78d3('0x44')];if(!_0xb803ea[_0x78d3('0x48')][_0x78d3('0x4b')](_0x78d3('0x4c'))){_0x3b6638[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0xb803ea['query'][_0x78d3('0x30')]);_0x3b6638[_0x78d3('0x2e')]=qs[_0x78d3('0x2e')](_0xb803ea[_0x78d3('0x48')][_0x78d3('0x2e')]);}_0x3b6638['order']=qs['sort'](_0xb803ea['query'][_0x78d3('0x4e')]);_0x3b6638[_0x78d3('0x4f')]=qs[_0x78d3('0x51')](_['pick'](_0xb803ea['query'],_0x1637eb[_0x78d3('0x51')]));_0x3b6638[_0x78d3('0x4f')][_0x78d3('0x6c')]=_0x28be16['id'];if(_0xb803ea[_0x78d3('0x48')][_0x78d3('0x53')]){_0x3b6638['where']=_['merge'](_0x3b6638[_0x78d3('0x4f')],{'$or':_[_0x78d3('0x40')](_0x3b6638[_0x78d3('0x49')],function(_0x8ea725){var _0xa3e56a={};_0xa3e56a[_0x8ea725]={'$like':'%'+_0xb803ea[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0xa3e56a;})});}_0x3b6638=_[_0x78d3('0x54')]({},_0x3b6638,_0xb803ea[_0x78d3('0x5f')]);return db[_0x78d3('0x6d')]['count']({'where':_0x3b6638[_0x78d3('0x4f')]})['then'](function(_0x5b97d0){_0x385dbc[_0x78d3('0x31')]=_0x5b97d0;if(_0xb803ea[_0x78d3('0x48')][_0x78d3('0x56')]){_0x3b6638[_0x78d3('0x57')]=[{'all':!![]}];}return db[_0x78d3('0x6d')][_0x78d3('0x58')](_0x3b6638);})[_0x78d3('0x38')](function(_0x1940b3){_0x385dbc[_0x78d3('0x59')]=_0x1940b3;return _0x385dbc;});}})['then'](respondWithFilteredResult(_0x3bbb42,_0x3b6638))[_0x78d3('0x5a')](handleError(_0x3bbb42,null));};exports[_0x78d3('0x6f')]=function(_0x15e511,_0x4f21a0,_0x55bbac){return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x15e511[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x4f21a0,null))['then'](function(_0x2fd217){if(_0x2fd217){return _0x2fd217['removeDispositions'](_0x15e511[_0x78d3('0x48')][_0x78d3('0x70')]);}})['then'](respondWithStatusCode(_0x4f21a0,null))[_0x78d3('0x5a')](handleError(_0x4f21a0,null));};exports[_0x78d3('0x71')]=function(_0x31af58,_0x225356,_0x128d4b){if(_0x31af58[_0x78d3('0x61')]['id']){delete _0x31af58[_0x78d3('0x61')]['id'];}return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x31af58[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x225356,null))[_0x78d3('0x38')](function(_0x164a60){if(_0x164a60){_0x31af58[_0x78d3('0x61')][_0x78d3('0x6c')]=_0x164a60['id'];return db[_0x78d3('0x72')]['create'](_0x31af58['body']);}})[_0x78d3('0x38')](respondWithResult(_0x225356,null))[_0x78d3('0x5a')](handleError(_0x225356,null));};exports['getAnswers']=function(_0x17843e,_0x503a4c,_0x48a439){var _0x104ce0={'raw':![],'where':{}};var _0x5c21d7={};var _0x3dcf85={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x78d3('0x6e')]({'where':{'id':_0x17843e[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x503a4c,null))[_0x78d3('0x38')](function(_0x475457){if(_0x475457){_0x5c21d7['model']=_[_0x78d3('0x46')](db[_0x78d3('0x72')][_0x78d3('0x5d')]);_0x5c21d7[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0x17843e['query']);_0x5c21d7[_0x78d3('0x51')]=_[_0x78d3('0x47')](_0x5c21d7[_0x78d3('0x44')],_0x5c21d7[_0x78d3('0x48')]);_0x104ce0[_0x78d3('0x49')]=_['intersection'](_0x5c21d7[_0x78d3('0x44')],qs[_0x78d3('0x4a')](_0x17843e[_0x78d3('0x48')][_0x78d3('0x4a')]));_0x104ce0[_0x78d3('0x49')]=_0x104ce0[_0x78d3('0x49')][_0x78d3('0x5e')]?_0x104ce0[_0x78d3('0x49')]:_0x5c21d7[_0x78d3('0x44')];if(!_0x17843e[_0x78d3('0x48')][_0x78d3('0x4b')](_0x78d3('0x4c'))){_0x104ce0[_0x78d3('0x30')]=qs['limit'](_0x17843e[_0x78d3('0x48')][_0x78d3('0x30')]);_0x104ce0[_0x78d3('0x2e')]=qs[_0x78d3('0x2e')](_0x17843e[_0x78d3('0x48')][_0x78d3('0x2e')]);}_0x104ce0[_0x78d3('0x4d')]=qs[_0x78d3('0x4e')](_0x17843e[_0x78d3('0x48')][_0x78d3('0x4e')]);_0x104ce0['where']=qs['filters'](_['pick'](_0x17843e[_0x78d3('0x48')],_0x5c21d7[_0x78d3('0x51')]));_0x104ce0[_0x78d3('0x4f')][_0x78d3('0x6c')]=_0x475457['id'];if(_0x17843e['query']['filter']){_0x104ce0[_0x78d3('0x4f')]=_['merge'](_0x104ce0['where'],{'$or':_['map'](_0x104ce0[_0x78d3('0x49')],function(_0x5a4fa0){var _0x42ad7a={};_0x42ad7a[_0x5a4fa0]={'$like':'%'+_0x17843e[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0x42ad7a;})});}_0x104ce0=_[_0x78d3('0x54')]({},_0x104ce0,_0x17843e[_0x78d3('0x5f')]);return db[_0x78d3('0x72')]['count']({'where':_0x104ce0[_0x78d3('0x4f')]})[_0x78d3('0x38')](function(_0x4ef77c){_0x3dcf85[_0x78d3('0x31')]=_0x4ef77c;if(_0x17843e[_0x78d3('0x48')][_0x78d3('0x56')]){_0x104ce0['include']=[{'all':!![]}];}return db[_0x78d3('0x72')]['findAll'](_0x104ce0);})[_0x78d3('0x38')](function(_0x541c3c){_0x3dcf85[_0x78d3('0x59')]=_0x541c3c;return _0x3dcf85;});}})['then'](respondWithFilteredResult(_0x503a4c,_0x104ce0))['catch'](handleError(_0x503a4c,null));};exports[_0x78d3('0x73')]=function(_0x3fd3a5,_0x9b4415,_0x1c937b){return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x3fd3a5[_0x78d3('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9b4415,null))[_0x78d3('0x38')](function(_0x417869){if(_0x417869){return _0x417869[_0x78d3('0x73')](_0x3fd3a5[_0x78d3('0x48')][_0x78d3('0x70')]);}})[_0x78d3('0x38')](respondWithStatusCode(_0x9b4415,null))[_0x78d3('0x5a')](handleError(_0x9b4415,null));};exports[_0x78d3('0x74')]=function(_0x3f6f5b,_0x380d2a,_0x5591f3){var _0x2deb14={'body':_0x3f6f5b[_0x78d3('0x61')],'channel':'openchannel'};var _0x1f945a=[];var _0x2a21c2=[];var _0x1c7f48={};var _0x56e742=![];return db[_0x78d3('0x75')][_0x78d3('0x6b')]()[_0x78d3('0x38')](function(_0x261e3a){if(!_0x261e3a){throw new db[(_0x78d3('0x76'))][(_0x78d3('0x77'))](_0x78d3('0x78'));}_0x1f945a=_[_0x78d3('0x79')](_[_0x78d3('0x46')](_0x261e3a),[_0x78d3('0x7a'),'updatedAt']);_0x2a21c2=_[_0x78d3('0x79')](_[_0x78d3('0x46')](_0x261e3a),[_0x78d3('0x7a'),_0x78d3('0x7b'),_0x78d3('0x7c'),_0x78d3('0x7d')]);if(_0x3f6f5b[_0x78d3('0x61')]['id']){delete _0x3f6f5b['body']['id'];}if(_[_0x78d3('0x7e')](_0x3f6f5b[_0x78d3('0x61')]['from'])){throw new db[(_0x78d3('0x76'))][(_0x78d3('0x77'))]('from\x20is\x20mandatory');}if(_[_0x78d3('0x7e')](_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x61')])||_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x61')]===''){throw new db[(_0x78d3('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x7f')])){throw new db[(_0x78d3('0x76'))][(_0x78d3('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a21c2);}if(!_[_0x78d3('0x80')](_0x2a21c2,_0x3f6f5b[_0x78d3('0x61')]['mapKey'])){throw new db[(_0x78d3('0x76'))][(_0x78d3('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a21c2);}_0x1c7f48[_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x7f')]]=_0x3f6f5b[_0x78d3('0x61')]['from'];})[_0x78d3('0x38')](function(){return db[_0x78d3('0x55')][_0x78d3('0x6a')]({'where':{'id':_0x3f6f5b['params']['id']},'include':[{'model':db['CmList'],'as':_0x78d3('0x81'),'include':[{'model':db[_0x78d3('0x75')],'as':_0x78d3('0x82'),'where':_0x1c7f48,'limit':0x1,'order':[[_0x78d3('0x7b'),'DESC']]}]},{'model':db[_0x78d3('0x83')],'as':_0x78d3('0x84')}]});})[_0x78d3('0x38')](handleEntityNotFound(_0x380d2a,null))[_0x78d3('0x38')](function(_0x214fee){if(_0x214fee&&_0x214fee[_0x78d3('0x81')]){_0x2deb14[_0x78d3('0x85')]=_0x214fee;_0x2deb14[_0x78d3('0x86')]=_0x214fee[_0x78d3('0x84')];_0x2deb14[_0x78d3('0x87')]=_0x214fee['List'];_0x2deb14[_0x78d3('0x86')]=_[_0x78d3('0x88')](_0x2deb14['applications'],[_0x78d3('0x89')],[_0x78d3('0x8a')]);if(_0x2deb14['account'][_0x78d3('0x84')]){delete _0x2deb14['account'][_0x78d3('0x84')];}if(_0x2deb14['account'][_0x78d3('0x81')]&&_0x2deb14[_0x78d3('0x85')][_0x78d3('0x81')][_0x78d3('0x82')][_0x78d3('0x5e')]){return _0x2deb14['account']['List'][_0x78d3('0x82')][0x0];}var _0x5792c8=_[_0x78d3('0x1b')](_0x3f6f5b[_0x78d3('0x61')],{'firstName':_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8b')],'ListId':_0x214fee['ListId']});_0x5792c8[_0x3f6f5b['body'][_0x78d3('0x7f')]]=_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8b')];return db[_0x78d3('0x75')][_0x78d3('0x60')](_0x5792c8,{'fields':_0x1f945a,'raw':!![]});}})['then'](handleEntityNotFound(_0x380d2a,null))[_0x78d3('0x38')](function(_0x51e760){_0x2deb14['contact']=_0x51e760;if(_0x51e760){var _0x9dd928={'ContactId':_0x51e760['id'],'OpenchannelAccountId':_0x3f6f5b['params']['id'],'from':(_0x51e760['firstName']||'')+'\x20'+(_0x51e760[_0x78d3('0x8c')]||'')};var _0xc03329={'OpenchannelAccountId':_0x3f6f5b[_0x78d3('0x5c')]['id'],'closed':![]};if(_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8d')]){_0xc03329['threadId']=_0x3f6f5b['body']['threadId'];return db[_0x78d3('0x8e')]['find']({'where':_0xc03329})[_0x78d3('0x38')](function(_0xe57d77){if(_0xe57d77){return[_0xe57d77,![]];}_0x9dd928[_0x78d3('0x8d')]=_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8d')];_0x9dd928[_0x78d3('0x8f')]=_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8f')];return db[_0x78d3('0x8e')]['create'](_0x9dd928)['then'](function(_0x12f107){return[_0x12f107,!![]];});});}else{_0xc03329[_0x78d3('0x8d')]=null;}_0xc03329[_0x78d3('0x90')]=_0x51e760['id'];return db[_0x78d3('0x8e')][_0x78d3('0x6a')]({'where':_0xc03329})['then'](function(_0x2f7841){if(_0x2f7841){return[_0x2f7841,![]];}return db[_0x78d3('0x8e')][_0x78d3('0x60')](_0x9dd928)[_0x78d3('0x38')](function(_0x751cf3){return[_0x751cf3,!![]];});});}})[_0x78d3('0x91')](function(_0x315f1c,_0x4bb46b){if(_0x315f1c){_0x56e742=_0x4bb46b;if(!_0x4bb46b){var _0x4c5f05={'from':(_0x2deb14[_0x78d3('0x92')]['firstName']||'')+'\x20'+(_0x2deb14[_0x78d3('0x92')]['lastName']||'')};if(_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x8d')]&&_0x3f6f5b['body']['messageId']&&_0x3f6f5b['body'][_0x78d3('0x8d')]!=_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x93')]){_0x4c5f05[_0x78d3('0x8d')]=_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x93')];}return _0x315f1c[_0x78d3('0x36')](_0x4c5f05);}else{return _0x315f1c;}}})[_0x78d3('0x38')](function(_0x86b57){_0x2deb14[_0x78d3('0x94')]=_0x86b57[_0x78d3('0x39')]({'plain':!![]});_0x2deb14[_0x78d3('0x94')][_0x78d3('0x95')]=_0x56e742;if(_0x2deb14['interaction'][_0x78d3('0x95')]){if(_0x2deb14['account']['autoclose']){_0x2deb14[_0x78d3('0x86')][_0x78d3('0x96')]({'id':0x0,'priority':_0x2deb14['applications'][_0x78d3('0x5e')]+0x1,'app':_0x78d3('0x97'),'appdata':_0x78d3('0x98'),'interval':_0x78d3('0x99')});}}return db['OpenchannelMessage']['create']({'body':_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x61')],'OpenchannelAccountId':_0x3f6f5b[_0x78d3('0x5c')]['id'],'OpenchannelInteractionId':_0x86b57['id'],'direction':'in','ContactId':_0x2deb14['contact']['id'],'AttachmentId':_0x3f6f5b[_0x78d3('0x61')][_0x78d3('0x9a')]});})[_0x78d3('0x38')](function(_0x51fe5c){_0x2deb14[_0x78d3('0x28')]=_0x51fe5c;if(_0x2deb14[_0x78d3('0x94')][_0x78d3('0x9b')]){return db[_0x78d3('0x9c')]['find']({'attributes':['id',_0x78d3('0x45')],'where':{'id':_0x2deb14[_0x78d3('0x94')][_0x78d3('0x9b')]}})[_0x78d3('0x38')](function(_0x1b4f65){if(_0x1b4f65){_0x2deb14['applications'][_0x78d3('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1b4f65['name']+','+(_0x2deb14[_0x78d3('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x78d3('0x99')});_0x2deb14[_0x78d3('0x9e')]=![];}return respondWithRpcPromise(_0x78d3('0x9f'),'startRouting',_0x2deb14);});}return respondWithRpcPromise(_0x78d3('0x9f'),'startRouting',_0x2deb14);})[_0x78d3('0x38')](function(_0x1f7042){respondWithRpcPromise('EventManager',_0x78d3('0xa0'),{'event':_0x78d3('0x74'),'message':_0x1f7042},client9002);return _0x1f7042;})['then'](respondWithResult(_0x380d2a,null))[_0x78d3('0x5a')](handleError(_0x380d2a,null));};exports[_0x78d3('0xa1')]=function(_0x4c7311,_0x245027){var _0x244e1d=_0x4c7311[_0x78d3('0x5c')]['id'];var _0x5e5762=_0x4c7311[_0x78d3('0x61')];var _0x2a4fdc=0xc8;var _0x46113a=null;return db[_0x78d3('0xa2')][_0x78d3('0xa3')]({'isolationLevel':db[_0x78d3('0xa2')]['Transaction'][_0x78d3('0xa4')][_0x78d3('0xa5')]},function(_0x495db6){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x244e1d},'transaction':_0x495db6})[_0x78d3('0x38')](function(_0x4f7daf){if(_0x4f7daf){return db[_0x78d3('0x83')][_0x78d3('0x37')]({'where':{'OpenchannelAccountId':_0x244e1d},'transaction':_0x495db6})[_0x78d3('0x38')](function(){var _0x4ac5d1=_['map'](_0x5e5762,function(_0x1d2250){_0x1d2250['OpenchannelAccountId']=_0x244e1d;return _0x1d2250;});return db[_0x78d3('0x83')]['bulkCreate'](_0x4ac5d1,{'transaction':_0x495db6});});}else{_0x2a4fdc=0x194;_0x46113a=[];}});})[_0x78d3('0x38')](function(){if(_0x2a4fdc!==0x194){return db[_0x78d3('0x83')][_0x78d3('0xa6')]({'where':{'OpenchannelAccountId':_0x244e1d},'order':_0x78d3('0x89')})[_0x78d3('0x38')](function(_0x21dcb8){_0x46113a=_0x21dcb8;});}})[_0x78d3('0x5a')](function(_0x2ff636){_0x2a4fdc=0x1f4;logger[_0x78d3('0x25')](_0x2ff636['stack']);if(_0x2ff636[_0x78d3('0x45')]){delete _0x2ff636[_0x78d3('0x45')];}_0x46113a=_0x2ff636;})['finally'](function(){if(_0x46113a===null){_0x245027['sendStatus'](_0x2a4fdc);}else{if(_0x2a4fdc===0x1f4){_0x245027['status'](_0x2a4fdc)[_0x78d3('0x3c')](_0x46113a);}else{_0x245027[_0x78d3('0x2b')](_0x2a4fdc)[_0x78d3('0x2d')](_0x46113a);}}});};exports['getApplications']=function(_0xa8dfd0,_0x33019e,_0x184ff2){var _0x27ed85={};var _0x4cb028={};var _0x416209;var _0x185b65;return db[_0x78d3('0x55')][_0x78d3('0x6e')]({'where':{'id':_0xa8dfd0['params']['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x33019e,null))['then'](function(_0x5b2240){if(_0x5b2240){_0x416209=_0x5b2240;_0x4cb028[_0x78d3('0x44')]=_['keys'](db[_0x78d3('0x83')][_0x78d3('0x5d')]);_0x4cb028[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0xa8dfd0['query']);_0x4cb028[_0x78d3('0x51')]=_['intersection'](_0x4cb028[_0x78d3('0x44')],_0x4cb028[_0x78d3('0x48')]);_0x27ed85[_0x78d3('0x49')]=_[_0x78d3('0x47')](_0x4cb028[_0x78d3('0x44')],qs[_0x78d3('0x4a')](_0xa8dfd0[_0x78d3('0x48')][_0x78d3('0x4a')]));_0x27ed85['attributes']=_0x27ed85['attributes'][_0x78d3('0x5e')]?_0x27ed85[_0x78d3('0x49')]:_0x4cb028[_0x78d3('0x44')];_0x27ed85[_0x78d3('0x4d')]=qs['sort'](_0xa8dfd0['query']['sort']);_0x27ed85['where']=qs['filters'](_[_0x78d3('0x50')](_0xa8dfd0['query'],_0x4cb028[_0x78d3('0x51')]));if(_0xa8dfd0[_0x78d3('0x48')][_0x78d3('0x53')]){_0x27ed85['where']=_[_0x78d3('0x54')](_0x27ed85[_0x78d3('0x4f')],{'$or':_[_0x78d3('0x40')](_0x27ed85[_0x78d3('0x49')],function(_0x4031b4){var _0x1f5a65={};_0x1f5a65[_0x4031b4]={'$like':'%'+_0xa8dfd0[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0x1f5a65;})});}_0x27ed85=_[_0x78d3('0x54')]({},_0x27ed85,_0xa8dfd0[_0x78d3('0x5f')]);return _0x416209['getApplications'](_0x27ed85);}})[_0x78d3('0x38')](function(_0x1ad93d){if(_0x1ad93d){_0x185b65=_0x1ad93d[_0x78d3('0x5e')];if(!_0xa8dfd0[_0x78d3('0x48')][_0x78d3('0x4b')](_0x78d3('0x4c'))){_0x27ed85[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0xa8dfd0[_0x78d3('0x48')][_0x78d3('0x30')]);_0x27ed85['offset']=qs[_0x78d3('0x2e')](_0xa8dfd0['query'][_0x78d3('0x2e')]);}return _0x416209['getApplications'](_0x27ed85);}})[_0x78d3('0x38')](function(_0x1ac8c7){if(_0x1ac8c7){return _0x1ac8c7?{'count':_0x185b65,'rows':_0x1ac8c7}:null;}})[_0x78d3('0x38')](respondWithResult(_0x33019e,null))[_0x78d3('0x5a')](handleError(_0x33019e,null));};exports[_0x78d3('0xa7')]=function(_0xc93420,_0x3c28f4,_0xb6993a){var _0xc6b9a4={'raw':![],'where':{}};var _0x4ff70d={};var _0x4ecc0b={'count':0x0,'rows':[]};return db[_0x78d3('0x55')][_0x78d3('0x6e')]({'where':{'id':_0xc93420[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x3c28f4,null))['then'](function(_0x55f370){if(_0x55f370){_0x4ff70d[_0x78d3('0x44')]=_['keys'](db[_0x78d3('0x8e')][_0x78d3('0x5d')]);_0x4ff70d[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0xc93420['query']);_0x4ff70d['filters']=_[_0x78d3('0x47')](_0x4ff70d[_0x78d3('0x44')],_0x4ff70d[_0x78d3('0x48')]);_0xc6b9a4['attributes']=_[_0x78d3('0x47')](_0x4ff70d['model'],qs[_0x78d3('0x4a')](_0xc93420[_0x78d3('0x48')][_0x78d3('0x4a')]));_0xc6b9a4['attributes']=_0xc6b9a4[_0x78d3('0x49')]['length']?_0xc6b9a4[_0x78d3('0x49')]:_0x4ff70d[_0x78d3('0x44')];if(!_0xc93420['query'][_0x78d3('0x4b')]('nolimit')){_0xc6b9a4[_0x78d3('0x30')]=qs['limit'](_0xc93420[_0x78d3('0x48')][_0x78d3('0x30')]);_0xc6b9a4['offset']=qs[_0x78d3('0x2e')](_0xc93420['query'][_0x78d3('0x2e')]);}_0xc6b9a4[_0x78d3('0x4d')]=qs[_0x78d3('0x4e')](_0xc93420[_0x78d3('0x48')][_0x78d3('0x4e')]);_0xc6b9a4[_0x78d3('0x4f')]=qs[_0x78d3('0x51')](_[_0x78d3('0x50')](_0xc93420[_0x78d3('0x48')],_0x4ff70d[_0x78d3('0x51')]));_0xc6b9a4['where'][_0x78d3('0x6c')]=_0x55f370['id'];if(_0xc93420[_0x78d3('0x48')][_0x78d3('0x53')]){_0xc6b9a4[_0x78d3('0x4f')]=_[_0x78d3('0x54')](_0xc6b9a4[_0x78d3('0x4f')],{'$or':_[_0x78d3('0x40')](_0xc6b9a4[_0x78d3('0x49')],function(_0x1e15b5){var _0x358885={};_0x358885[_0x1e15b5]={'$like':'%'+_0xc93420[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0x358885;})});}_0xc6b9a4=_[_0x78d3('0x54')]({},_0xc6b9a4,_0xc93420[_0x78d3('0x5f')]);return db['OpenchannelInteraction'][_0x78d3('0x31')]({'where':_0xc6b9a4['where']})['then'](function(_0x590df0){_0x4ecc0b[_0x78d3('0x31')]=_0x590df0;if(_0xc93420[_0x78d3('0x48')][_0x78d3('0x56')]){_0xc6b9a4[_0x78d3('0x57')]=[{'model':db[_0x78d3('0x75')],'as':'Contact','required':![]},{'model':db[_0x78d3('0x9c')],'as':_0x78d3('0xa8'),'attributes':[_0x78d3('0x45'),_0x78d3('0xa9'),_0x78d3('0xaa')],'required':![]},{'model':db[_0x78d3('0xab')],'as':_0x78d3('0xac'),'attributes':['id','name',_0x78d3('0xad')],'where':_0xc93420[_0x78d3('0x48')][_0x78d3('0xae')]?{'id':_0xc93420[_0x78d3('0x48')][_0x78d3('0xae')]}:undefined,'required':_0xc93420['query'][_0x78d3('0xae')]?!![]:![]}];}return db[_0x78d3('0x8e')]['findAll'](_0xc6b9a4);})[_0x78d3('0x38')](function(_0x16e476){_0x4ecc0b[_0x78d3('0x59')]=_0x16e476;return _0x4ecc0b;});}})[_0x78d3('0x38')](respondWithFilteredResult(_0x3c28f4,_0xc6b9a4))['catch'](handleError(_0x3c28f4,null));};exports[_0x78d3('0xaf')]=function(_0x360898,_0x328b7f,_0x46ccd1){return db['OpenchannelAccount'][_0x78d3('0x6a')]({'where':{'id':_0x360898[_0x78d3('0x5c')]['id']}})['then'](handleEntityNotFound(_0x328b7f,null))[_0x78d3('0x38')](function(_0x45c0a2){if(_0x45c0a2){return _0x45c0a2[_0x78d3('0xaf')](_0x360898[_0x78d3('0x61')][_0x78d3('0x70')],_['omit'](_0x360898[_0x78d3('0x61')],[_0x78d3('0x70'),'id'])||{})['spread'](function(_0x5579b5){for(var _0x26c7c3=0x0;_0x26c7c3<_0x360898[_0x78d3('0x61')]['ids']['length'];_0x26c7c3+=0x1){socket[_0x78d3('0xb0')](_0x78d3('0xb1'),{'UserId':Number(_0x360898[_0x78d3('0x61')][_0x78d3('0x70')][_0x26c7c3]),'OpenchannelAccountId':Number(_0x360898['params']['id'])});}return _0x5579b5;});}})[_0x78d3('0x38')](respondWithResult(_0x328b7f,null))[_0x78d3('0x5a')](handleError(_0x328b7f,null));};exports[_0x78d3('0xb2')]=function(_0x4eaa63,_0x42176e,_0x2a757e){return db[_0x78d3('0x55')]['find']({'where':{'id':_0x4eaa63[_0x78d3('0x5c')]['id']}})['then'](handleEntityNotFound(_0x42176e,null))['then'](function(_0x2d9954){if(_0x2d9954){return _0x2d9954[_0x78d3('0xb2')](_0x4eaa63[_0x78d3('0x48')][_0x78d3('0x70')])[_0x78d3('0x38')](function(){if(_[_0x78d3('0xb3')](_0x4eaa63[_0x78d3('0x48')][_0x78d3('0x70')])){for(var _0x19e65a=0x0;_0x19e65a<_0x4eaa63[_0x78d3('0x48')][_0x78d3('0x70')][_0x78d3('0x5e')];_0x19e65a+=0x1){socket['emit'](_0x78d3('0xb4'),{'UserId':Number(_0x4eaa63[_0x78d3('0x48')]['ids'][_0x19e65a]),'OpenchannelAccountId':Number(_0x4eaa63['params']['id'])});}}else{socket[_0x78d3('0xb0')](_0x78d3('0xb4'),{'UserId':Number(_0x4eaa63[_0x78d3('0x48')][_0x78d3('0x70')]),'OpenchannelAccountId':Number(_0x4eaa63[_0x78d3('0x5c')]['id'])});}});}})[_0x78d3('0x38')](respondWithStatusCode(_0x42176e,null))[_0x78d3('0x5a')](handleError(_0x42176e,null));};exports[_0x78d3('0xb5')]=function(_0x2060bf,_0x5cf631,_0x148a32){var _0x20f6a2={};var _0xc26ac2={};var _0x4b8d5d;var _0x590905;return db['OpenchannelAccount'][_0x78d3('0x6e')]({'where':{'id':_0x2060bf[_0x78d3('0x5c')]['id']}})[_0x78d3('0x38')](handleEntityNotFound(_0x5cf631,null))[_0x78d3('0x38')](function(_0x417121){if(_0x417121){_0x4b8d5d=_0x417121;_0xc26ac2[_0x78d3('0x44')]=_[_0x78d3('0x46')](db['User'][_0x78d3('0x5d')]);_0xc26ac2[_0x78d3('0x48')]=_[_0x78d3('0x46')](_0x2060bf[_0x78d3('0x48')]);_0xc26ac2[_0x78d3('0x51')]=_[_0x78d3('0x47')](_0xc26ac2['model'],_0xc26ac2[_0x78d3('0x48')]);_0x20f6a2[_0x78d3('0x49')]=_['intersection'](_0xc26ac2['model'],qs['fields'](_0x2060bf['query'][_0x78d3('0x4a')]));_0x20f6a2[_0x78d3('0x49')]=_0x20f6a2[_0x78d3('0x49')]['length']?_0x20f6a2[_0x78d3('0x49')]:_0xc26ac2[_0x78d3('0x44')];_0x20f6a2[_0x78d3('0x4d')]=qs['sort'](_0x2060bf[_0x78d3('0x48')]['sort']);_0x20f6a2[_0x78d3('0x4f')]=qs[_0x78d3('0x51')](_[_0x78d3('0x50')](_0x2060bf[_0x78d3('0x48')],_0xc26ac2[_0x78d3('0x51')]));if(_0x2060bf['query']['filter']){_0x20f6a2[_0x78d3('0x4f')]=_[_0x78d3('0x54')](_0x20f6a2[_0x78d3('0x4f')],{'$or':_['map'](_0x20f6a2[_0x78d3('0x49')],function(_0x4231b2){var _0x12400b={};_0x12400b[_0x4231b2]={'$like':'%'+_0x2060bf[_0x78d3('0x48')][_0x78d3('0x53')]+'%'};return _0x12400b;})});}_0x20f6a2=_[_0x78d3('0x54')]({},_0x20f6a2,_0x2060bf[_0x78d3('0x5f')]);return _0x4b8d5d['getAgents'](_0x20f6a2);}})['then'](function(_0x394626){if(_0x394626){_0x590905=_0x394626['length'];if(!_0x2060bf[_0x78d3('0x48')]['hasOwnProperty'](_0x78d3('0x4c'))){_0x20f6a2[_0x78d3('0x30')]=qs['limit'](_0x2060bf[_0x78d3('0x48')][_0x78d3('0x30')]);_0x20f6a2[_0x78d3('0x2e')]=qs[_0x78d3('0x2e')](_0x2060bf[_0x78d3('0x48')][_0x78d3('0x2e')]);}return _0x4b8d5d['getAgents'](_0x20f6a2);}})[_0x78d3('0x38')](function(_0x1c7164){if(_0x1c7164){return _0x1c7164?{'count':_0x590905,'rows':_0x1c7164}:null;}})[_0x78d3('0x38')](respondWithResult(_0x5cf631,null))[_0x78d3('0x5a')](handleError(_0x5cf631,null));};exports[_0x78d3('0x3c')]=function(_0x2fe5a2,_0x1cbe62,_0x3f9c5d){var _0x2981f3,_0x2ce67b,_0x2e0c59;if(_[_0x78d3('0x7e')](_0x2fe5a2[_0x78d3('0x61')][_0x78d3('0x61')])||_0x2fe5a2['body'][_0x78d3('0x61')]===''){throw new db[(_0x78d3('0x76'))][(_0x78d3('0x77'))](_0x78d3('0xb6'));}if(_[_0x78d3('0x7e')](_0x2fe5a2[_0x78d3('0x61')]['to'])){}_0x2981f3=_0x2fe5a2[_0x78d3('0x61')]['to'];return db[_0x78d3('0x55')]['findOne']({'where':{'id':_0x2fe5a2[_0x78d3('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1cbe62,null))[_0x78d3('0x38')](function(_0x240cc1){if(_0x240cc1){return db[_0x78d3('0x55')]['find']({'where':{'id':_0x240cc1['id']},'include':[{'model':db[_0x78d3('0xb7')],'as':_0x78d3('0x81'),'include':[{'model':db[_0x78d3('0x75')],'as':_0x78d3('0x82'),'where':{[_0x240cc1[_0x78d3('0x7f')]]:_0x2981f3},'limit':0x1,'order':[[_0x78d3('0x7b'),_0x78d3('0xb8')]]}]}]})[_0x78d3('0x38')](handleEntityNotFound(_0x1cbe62,null))[_0x78d3('0x38')](function(_0x12f3b7){if(_0x12f3b7&&_0x12f3b7['List']){_0x2ce67b=_0x12f3b7[_0x78d3('0x39')]({'plain':!![]});if(_0x2ce67b[_0x78d3('0x81')]&&_0x2ce67b[_0x78d3('0x81')][_0x78d3('0x82')][_0x78d3('0x5e')]){return _0x2ce67b[_0x78d3('0x81')][_0x78d3('0x82')][0x0];}return db[_0x78d3('0x75')][_0x78d3('0x60')](_[_0x78d3('0x1b')](_0x2fe5a2['body'],{'firstName':_0x2981f3,[_0x12f3b7[_0x78d3('0x7f')]]:_0x2981f3,'phone':_0x2981f3,'ListId':_0x2ce67b[_0x78d3('0x7d')]}));}})[_0x78d3('0x38')](handleEntityNotFound(_0x1cbe62,null))[_0x78d3('0x38')](function(_0x5d5379){if(_0x5d5379){_0x2e0c59=_0x5d5379;return db[_0x78d3('0x8e')]['find']({'where':{'ContactId':_0x2e0c59['id'],'closed':![],'OpenchannelAccountId':_0x2ce67b['id']}})[_0x78d3('0x38')](function(_0x2e7dea){if(_0x2e7dea){return[_0x2e7dea,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x2fe5a2['user']['id'],'ContactId':_0x2e0c59['id'],'OpenchannelAccountId':_0x2ce67b['id'],'lastMsgDirection':_0x78d3('0xb9'),'firstMsgDirection':_0x78d3('0xb9'),'Messages':[_[_0x78d3('0x54')](_0x2fe5a2[_0x78d3('0x61')],{'read':![],'body':_0x2fe5a2[_0x78d3('0x61')][_0x78d3('0x61')],'OpenchannelAccountId':_0x2ce67b['id'],'UserId':_0x2fe5a2['user']['id'],'ContactId':_0x2e0c59['id']})]},{'include':[{'model':db[_0x78d3('0xba')],'as':_0x78d3('0xbb')}]})['then'](function(_0xd0fa22){return[_0xd0fa22,!![]];});});}})[_0x78d3('0x91')](function(_0xc16e79,_0xdc7014){if(_0xdc7014){return _0xc16e79;}return db[_0x78d3('0xba')][_0x78d3('0x60')](_[_0x78d3('0x54')](_0x2fe5a2['body'],{'read':![],'body':_0x2fe5a2['body'][_0x78d3('0x61')],'OpenchannelAccountId':_0x2ce67b['id'],'OpenchannelInteractionId':_0xc16e79['id'],'UserId':_0x2fe5a2['user']['id'],'ContactId':_0x2e0c59['id']}))['then'](function(_0x5d6fef){_0xc16e79[_0x78d3('0xbc')]['Messages']=[];_0xc16e79[_0x78d3('0xbc')]['Messages']['push'](_0x5d6fef[_0x78d3('0xbc')]);return _0xc16e79;});});}})[_0x78d3('0x38')](respondWithResult(_0x1cbe62,null))[_0x78d3('0x5a')](handleError(_0x1cbe62,null));}; \ No newline at end of file +var _0xbe02=['catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','show','params','mandatoryDispositionPause','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','rawAttributes','nolimit','pick','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','account','applications','Applications','list','asc','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','EventManager','sequelize','Transaction','OpenchannelApplication','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x44b014,_0x34c218){var _0x1c18c9=function(_0x45bfd3){while(--_0x45bfd3){_0x44b014['push'](_0x44b014['shift']());}};_0x1c18c9(++_0x34c218);}(_0xbe02,0x146));var _0x2be0=function(_0x115c85,_0x1b26de){_0x115c85=_0x115c85-0x0;var _0x569b25=_0xbe02[_0x115c85];return _0x569b25;};'use strict';var emlformat=require(_0x2be0('0x0'));var rimraf=require(_0x2be0('0x1'));var zipdir=require(_0x2be0('0x2'));var jsonpatch=require(_0x2be0('0x3'));var rp=require('request-promise');var moment=require(_0x2be0('0x4'));var BPromise=require(_0x2be0('0x5'));var Mustache=require(_0x2be0('0x6'));var util=require(_0x2be0('0x7'));var path=require(_0x2be0('0x8'));var sox=require(_0x2be0('0x9'));var csv=require(_0x2be0('0xa'));var ejs=require(_0x2be0('0xb'));var fs=require('fs');var fs_extra=require(_0x2be0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2be0('0xd'));var jsforce=require(_0x2be0('0xe'));var deskjs=require(_0x2be0('0xf'));var toCsv=require(_0x2be0('0xa'));var querystring=require(_0x2be0('0x10'));var Papa=require(_0x2be0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2be0('0x12'));var utils=require(_0x2be0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2be0('0x14'));var db=require(_0x2be0('0x15'))['db'];config[_0x2be0('0x16')]=_[_0x2be0('0x17')](config[_0x2be0('0x16')],{'host':_0x2be0('0x18'),'port':0x18eb});var socket=require(_0x2be0('0x19'))(new Redis(config[_0x2be0('0x16')]));require(_0x2be0('0x1a'))[_0x2be0('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2be0('0x1c')][_0x2be0('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x2be0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1e0c27,_0x5bcbc5,_0x334070,_0x30d623){return new BPromise(function(_0x137ce9,_0x1cedaa){var _0x1d4e04=_0x30d623||client;return _0x1d4e04[_0x2be0('0x1e')](_0x1e0c27,_0x334070)[_0x2be0('0x1f')](function(_0x415894){logger[_0x2be0('0x20')](_0x2be0('0x21'),_0x5bcbc5,_0x2be0('0x22'));logger[_0x2be0('0x23')](_0x2be0('0x24'),_0x5bcbc5,_0x2be0('0x22'),JSON[_0x2be0('0x25')](_0x415894));if(_0x415894[_0x2be0('0x26')]){if(_0x415894[_0x2be0('0x26')]['code']===0x1f4){logger['error'](_0x2be0('0x21'),_0x5bcbc5,_0x415894['error']['message']);return _0x1cedaa(_0x415894[_0x2be0('0x26')][_0x2be0('0x27')]);}logger[_0x2be0('0x26')](_0x2be0('0x21'),_0x5bcbc5,_0x415894[_0x2be0('0x26')][_0x2be0('0x27')]);return _0x137ce9(_0x415894[_0x2be0('0x26')][_0x2be0('0x27')]);}else{logger['info'](_0x2be0('0x21'),_0x5bcbc5,'request\x20sent');_0x137ce9(_0x415894['result'][_0x2be0('0x27')]);}})[_0x2be0('0x28')](function(_0x166aa1){logger[_0x2be0('0x26')](_0x2be0('0x21'),_0x5bcbc5,_0x166aa1);_0x1cedaa(_0x166aa1);});});}function respondWithStatusCode(_0x4b5f21,_0x21a62b){_0x21a62b=_0x21a62b||0xcc;return function(_0x50617d){if(_0x50617d){return _0x4b5f21[_0x2be0('0x29')](_0x21a62b);}return _0x4b5f21[_0x2be0('0x2a')](_0x21a62b)['end']();};}function respondWithResult(_0x5260d3,_0x1fd3eb){_0x1fd3eb=_0x1fd3eb||0xc8;return function(_0x20f866){if(_0x20f866){return _0x5260d3['status'](_0x1fd3eb)[_0x2be0('0x2b')](_0x20f866);}};}function respondWithFilteredResult(_0x36b490,_0x3eeb86){return function(_0x439888){if(_0x439888){var _0x3b97c0=typeof _0x3eeb86[_0x2be0('0x2c')]===_0x2be0('0x2d')&&typeof _0x3eeb86['limit']===_0x2be0('0x2d');var _0x4d2ad6=_0x439888[_0x2be0('0x2e')];var _0xa88b4f=_0x3b97c0?0x0:_0x3eeb86[_0x2be0('0x2c')];var _0x493b7c=_0x3b97c0?_0x439888[_0x2be0('0x2e')]:_0x3eeb86[_0x2be0('0x2c')]+_0x3eeb86[_0x2be0('0x2f')];var _0x5191e6;if(_0x493b7c>=_0x4d2ad6){_0x493b7c=_0x4d2ad6;_0x5191e6=0xc8;}else{_0x5191e6=0xce;}_0x36b490[_0x2be0('0x2a')](_0x5191e6);return _0x36b490[_0x2be0('0x30')](_0x2be0('0x31'),_0xa88b4f+'-'+_0x493b7c+'/'+_0x4d2ad6)[_0x2be0('0x2b')](_0x439888);}return null;};}function patchUpdates(_0x101114){return function(_0x4ee731){try{jsonpatch[_0x2be0('0x32')](_0x4ee731,_0x101114,!![]);}catch(_0x1bc509){return BPromise[_0x2be0('0x33')](_0x1bc509);}return _0x4ee731[_0x2be0('0x34')]();};}function saveUpdates(_0x779ef2,_0x554dd4){return function(_0x4c47b4){if(_0x4c47b4){return _0x4c47b4[_0x2be0('0x35')](_0x779ef2)[_0x2be0('0x1f')](function(_0x25c1ea){return _0x25c1ea;});}return null;};}function removeEntity(_0x5a53ac,_0x48b4cd){return function(_0x52f7b6){if(_0x52f7b6){return _0x52f7b6[_0x2be0('0x36')]()[_0x2be0('0x1f')](function(){var _0x11f12b=_0x52f7b6[_0x2be0('0x37')]({'plain':!![]});var _0x3c7227=_0x2be0('0x38');return db[_0x2be0('0x39')][_0x2be0('0x36')]({'where':{'type':_0x3c7227,'resourceId':_0x11f12b['id']}})[_0x2be0('0x1f')](function(){return _0x52f7b6;});})[_0x2be0('0x1f')](function(){_0x5a53ac[_0x2be0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x260003,_0x1fb14e){return function(_0x42edd5){if(!_0x42edd5){_0x260003[_0x2be0('0x29')](0x194);}return _0x42edd5;};}function handleError(_0x1d1a64,_0x565623){_0x565623=_0x565623||0x1f4;return function(_0x27d35e){logger[_0x2be0('0x26')](_0x27d35e[_0x2be0('0x3a')]);if(_0x27d35e['name']){delete _0x27d35e[_0x2be0('0x3b')];}_0x1d1a64['status'](_0x565623)[_0x2be0('0x3c')](_0x27d35e);};}exports['index']=function(_0x4ea299,_0x309e91){var _0x4d6ccf={'include':[{'model':db[_0x2be0('0x3d')],'as':'mandatoryDispositionPause'}]},_0x165f00={},_0x5a24a6={'count':0x0,'rows':[]};var _0x25c858=_[_0x2be0('0x3e')](db[_0x2be0('0x3f')]['rawAttributes'],function(_0x46d474){return{'name':_0x46d474['fieldName'],'type':_0x46d474[_0x2be0('0x40')][_0x2be0('0x41')]};});_0x165f00[_0x2be0('0x42')]=_[_0x2be0('0x3e')](_0x25c858,_0x2be0('0x3b'));_0x165f00[_0x2be0('0x43')]=_[_0x2be0('0x44')](_0x4ea299[_0x2be0('0x43')]);_0x165f00[_0x2be0('0x45')]=_[_0x2be0('0x46')](_0x165f00[_0x2be0('0x42')],_0x165f00[_0x2be0('0x43')]);_0x4d6ccf[_0x2be0('0x47')]=_[_0x2be0('0x46')](_0x165f00[_0x2be0('0x42')],qs['fields'](_0x4ea299[_0x2be0('0x43')]['fields']));_0x4d6ccf[_0x2be0('0x47')]=_0x4d6ccf[_0x2be0('0x47')][_0x2be0('0x48')]?_0x4d6ccf[_0x2be0('0x47')]:_0x165f00[_0x2be0('0x42')];if(!_0x4ea299[_0x2be0('0x43')][_0x2be0('0x49')]('nolimit')){_0x4d6ccf[_0x2be0('0x2f')]=qs[_0x2be0('0x2f')](_0x4ea299[_0x2be0('0x43')][_0x2be0('0x2f')]);_0x4d6ccf[_0x2be0('0x2c')]=qs['offset'](_0x4ea299[_0x2be0('0x43')]['offset']);}_0x4d6ccf[_0x2be0('0x4a')]=qs[_0x2be0('0x4b')](_0x4ea299[_0x2be0('0x43')][_0x2be0('0x4b')]);_0x4d6ccf[_0x2be0('0x4c')]=qs[_0x2be0('0x45')](_['pick'](_0x4ea299[_0x2be0('0x43')],_0x165f00['filters']),_0x25c858);if(_0x4ea299[_0x2be0('0x43')][_0x2be0('0x4d')]){_0x4d6ccf['where']=_[_0x2be0('0x4e')](_0x4d6ccf[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x25c858,function(_0x89817d){if(_0x89817d[_0x2be0('0x40')]!=='VIRTUAL'){var _0x52211f={};_0x52211f[_0x89817d[_0x2be0('0x3b')]]={'$like':'%'+_0x4ea299[_0x2be0('0x43')]['filter']+'%'};return _0x52211f;}})});}_0x4d6ccf=_['merge']({},_0x4d6ccf,_0x4ea299[_0x2be0('0x4f')]);var _0x3e6f94={'where':_0x4d6ccf[_0x2be0('0x4c')]};return db[_0x2be0('0x3f')]['count'](_0x3e6f94)[_0x2be0('0x1f')](function(_0x10fc9a){_0x5a24a6[_0x2be0('0x2e')]=_0x10fc9a;if(_0x4ea299[_0x2be0('0x43')][_0x2be0('0x50')]){_0x4d6ccf[_0x2be0('0x51')]=[{'all':!![]}];}return db[_0x2be0('0x3f')]['findAll'](_0x4d6ccf);})[_0x2be0('0x1f')](function(_0x400f59){_0x5a24a6['rows']=_0x400f59;return _0x5a24a6;})[_0x2be0('0x1f')](respondWithFilteredResult(_0x309e91,_0x4d6ccf))[_0x2be0('0x28')](handleError(_0x309e91,null));};exports[_0x2be0('0x52')]=function(_0x556235,_0x419671){var _0x2c1c6f={'raw':![],'where':{'id':_0x556235[_0x2be0('0x53')]['id']},'include':[{'model':db[_0x2be0('0x3d')],'as':_0x2be0('0x54')}]},_0x1cd530={};_0x1cd530[_0x2be0('0x42')]=_[_0x2be0('0x44')](db[_0x2be0('0x3f')]['rawAttributes']);_0x1cd530[_0x2be0('0x43')]=_[_0x2be0('0x44')](_0x556235[_0x2be0('0x43')]);_0x1cd530[_0x2be0('0x45')]=_['intersection'](_0x1cd530[_0x2be0('0x42')],_0x1cd530['query']);_0x2c1c6f[_0x2be0('0x47')]=_[_0x2be0('0x46')](_0x1cd530['model'],qs[_0x2be0('0x55')](_0x556235['query'][_0x2be0('0x55')]));_0x2c1c6f[_0x2be0('0x47')]=_0x2c1c6f['attributes'][_0x2be0('0x48')]?_0x2c1c6f[_0x2be0('0x47')]:_0x1cd530[_0x2be0('0x42')];if(_0x556235[_0x2be0('0x43')][_0x2be0('0x50')]){_0x2c1c6f[_0x2be0('0x51')]=[{'all':!![]}];}_0x2c1c6f=_[_0x2be0('0x4e')]({},_0x2c1c6f,_0x556235[_0x2be0('0x4f')]);return db[_0x2be0('0x3f')]['find'](_0x2c1c6f)[_0x2be0('0x1f')](handleEntityNotFound(_0x419671,null))[_0x2be0('0x1f')](respondWithResult(_0x419671,null))[_0x2be0('0x28')](handleError(_0x419671,null));};exports['create']=function(_0x38278b,_0x443e5d){return db[_0x2be0('0x3f')][_0x2be0('0x56')](_0x38278b[_0x2be0('0x57')],{})[_0x2be0('0x1f')](function(_0x328a16){var _0x4c3e21=_0x38278b[_0x2be0('0x58')][_0x2be0('0x37')]({'plain':!![]});if(!_0x4c3e21)throw new Error(_0x2be0('0x59'));if(_0x4c3e21[_0x2be0('0x5a')]===_0x2be0('0x58')){var _0x2094b0=_0x328a16['get']({'plain':!![]});var _0xc60d86='OpenchannelAccounts';return db['UserProfileSection'][_0x2be0('0x5b')]({'where':{'name':_0xc60d86,'userProfileId':_0x4c3e21[_0x2be0('0x5c')]},'raw':!![]})[_0x2be0('0x1f')](function(_0x5a0e73){if(_0x5a0e73&&_0x5a0e73[_0x2be0('0x5d')]===0x0){return db[_0x2be0('0x39')][_0x2be0('0x56')]({'name':_0x2094b0[_0x2be0('0x3b')],'resourceId':_0x2094b0['id'],'type':_0x5a0e73[_0x2be0('0x3b')],'sectionId':_0x5a0e73['id']},{})['then'](function(){return _0x328a16;});}else{return _0x328a16;}})[_0x2be0('0x28')](function(_0x2553e0){logger[_0x2be0('0x26')](_0x2be0('0x5e'),_0x2553e0);throw _0x2553e0;});}return _0x328a16;})[_0x2be0('0x1f')](respondWithResult(_0x443e5d,0xc9))[_0x2be0('0x28')](handleError(_0x443e5d,null));};exports[_0x2be0('0x35')]=function(_0x3137ce,_0x1ada0a){if(_0x3137ce[_0x2be0('0x57')]['id']){delete _0x3137ce[_0x2be0('0x57')]['id'];}return db['OpenchannelAccount'][_0x2be0('0x5b')]({'where':{'id':_0x3137ce[_0x2be0('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x2be0('0x54')}]})[_0x2be0('0x1f')](handleEntityNotFound(_0x1ada0a,null))[_0x2be0('0x1f')](saveUpdates(_0x3137ce[_0x2be0('0x57')],null))[_0x2be0('0x1f')](respondWithResult(_0x1ada0a,null))['catch'](handleError(_0x1ada0a,null));};exports['destroy']=function(_0x2e69aa,_0x3a0154){return db[_0x2be0('0x3f')]['find']({'where':{'id':_0x2e69aa[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x3a0154,null))[_0x2be0('0x1f')](removeEntity(_0x3a0154,null))[_0x2be0('0x28')](handleError(_0x3a0154,null));};exports[_0x2be0('0x5f')]=function(_0xaf914d,_0xc10295){return db[_0x2be0('0x3f')][_0x2be0('0x5f')]()[_0x2be0('0x1f')](respondWithResult(_0xc10295,null))[_0x2be0('0x28')](handleError(_0xc10295,null));};exports[_0x2be0('0x60')]=function(_0x320266,_0x10e9a7,_0x598c0e){if(_0x320266[_0x2be0('0x57')]['id']){delete _0x320266[_0x2be0('0x57')]['id'];}return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x320266['params']['id']}})['then'](handleEntityNotFound(_0x10e9a7,null))[_0x2be0('0x1f')](function(_0x15702c){if(_0x15702c){_0x320266[_0x2be0('0x57')][_0x2be0('0x61')]=_0x15702c['id'];return db['Disposition'][_0x2be0('0x56')](_0x320266[_0x2be0('0x57')]);}})['then'](respondWithResult(_0x10e9a7,null))[_0x2be0('0x28')](handleError(_0x10e9a7,null));};exports[_0x2be0('0x62')]=function(_0x201c58,_0x178ae7,_0x2c7c27){var _0x7a2db5={'raw':![],'where':{}};var _0x34acf3={};var _0x5d6659={'count':0x0,'rows':[]};return db[_0x2be0('0x3f')][_0x2be0('0x63')]({'where':{'id':_0x201c58[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x178ae7,null))[_0x2be0('0x1f')](function(_0x3ba859){if(_0x3ba859){_0x34acf3['model']=_['keys'](db['Disposition'][_0x2be0('0x64')]);_0x34acf3['query']=_[_0x2be0('0x44')](_0x201c58[_0x2be0('0x43')]);_0x34acf3['filters']=_[_0x2be0('0x46')](_0x34acf3[_0x2be0('0x42')],_0x34acf3['query']);_0x7a2db5[_0x2be0('0x47')]=_[_0x2be0('0x46')](_0x34acf3[_0x2be0('0x42')],qs[_0x2be0('0x55')](_0x201c58[_0x2be0('0x43')][_0x2be0('0x55')]));_0x7a2db5['attributes']=_0x7a2db5[_0x2be0('0x47')][_0x2be0('0x48')]?_0x7a2db5[_0x2be0('0x47')]:_0x34acf3[_0x2be0('0x42')];if(!_0x201c58[_0x2be0('0x43')][_0x2be0('0x49')](_0x2be0('0x65'))){_0x7a2db5[_0x2be0('0x2f')]=qs[_0x2be0('0x2f')](_0x201c58[_0x2be0('0x43')]['limit']);_0x7a2db5[_0x2be0('0x2c')]=qs[_0x2be0('0x2c')](_0x201c58['query'][_0x2be0('0x2c')]);}_0x7a2db5['order']=qs[_0x2be0('0x4b')](_0x201c58[_0x2be0('0x43')][_0x2be0('0x4b')]);_0x7a2db5[_0x2be0('0x4c')]=qs[_0x2be0('0x45')](_[_0x2be0('0x66')](_0x201c58[_0x2be0('0x43')],_0x34acf3['filters']));_0x7a2db5['where'][_0x2be0('0x61')]=_0x3ba859['id'];if(_0x201c58['query'][_0x2be0('0x4d')]){_0x7a2db5[_0x2be0('0x4c')]=_[_0x2be0('0x4e')](_0x7a2db5[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x7a2db5[_0x2be0('0x47')],function(_0x50880e){var _0x580968={};_0x580968[_0x50880e]={'$like':'%'+_0x201c58['query'][_0x2be0('0x4d')]+'%'};return _0x580968;})});}_0x7a2db5=_[_0x2be0('0x4e')]({},_0x7a2db5,_0x201c58[_0x2be0('0x4f')]);return db[_0x2be0('0x67')][_0x2be0('0x2e')]({'where':_0x7a2db5[_0x2be0('0x4c')]})['then'](function(_0xdb3e27){_0x5d6659['count']=_0xdb3e27;if(_0x201c58[_0x2be0('0x43')][_0x2be0('0x50')]){_0x7a2db5[_0x2be0('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x2be0('0x68')](_0x7a2db5);})['then'](function(_0x1e0916){_0x5d6659[_0x2be0('0x69')]=_0x1e0916;return _0x5d6659;});}})[_0x2be0('0x1f')](respondWithFilteredResult(_0x178ae7,_0x7a2db5))[_0x2be0('0x28')](handleError(_0x178ae7,null));};exports[_0x2be0('0x6a')]=function(_0x4388d4,_0x56db7a,_0xc40b1f){return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x4388d4['params']['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x56db7a,null))[_0x2be0('0x1f')](function(_0x52252d){if(_0x52252d){return _0x52252d['removeDispositions'](_0x4388d4[_0x2be0('0x43')][_0x2be0('0x6b')]);}})[_0x2be0('0x1f')](respondWithStatusCode(_0x56db7a,null))['catch'](handleError(_0x56db7a,null));};exports[_0x2be0('0x6c')]=function(_0x341f41,_0x52c457,_0x15c520){if(_0x341f41[_0x2be0('0x57')]['id']){delete _0x341f41[_0x2be0('0x57')]['id'];}return db[_0x2be0('0x3f')]['find']({'where':{'id':_0x341f41[_0x2be0('0x53')]['id']}})['then'](handleEntityNotFound(_0x52c457,null))[_0x2be0('0x1f')](function(_0x42bc1d){if(_0x42bc1d){_0x341f41[_0x2be0('0x57')]['OpenchannelAccountId']=_0x42bc1d['id'];return db[_0x2be0('0x6d')][_0x2be0('0x56')](_0x341f41['body']);}})[_0x2be0('0x1f')](respondWithResult(_0x52c457,null))[_0x2be0('0x28')](handleError(_0x52c457,null));};exports['getAnswers']=function(_0x38d087,_0x321946,_0x1814e3){var _0x514661={'raw':![],'where':{}};var _0x521317={};var _0x1748ea={'count':0x0,'rows':[]};return db[_0x2be0('0x3f')][_0x2be0('0x63')]({'where':{'id':_0x38d087[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x321946,null))[_0x2be0('0x1f')](function(_0x3f1e37){if(_0x3f1e37){_0x521317['model']=_['keys'](db['CannedAnswer'][_0x2be0('0x64')]);_0x521317[_0x2be0('0x43')]=_['keys'](_0x38d087[_0x2be0('0x43')]);_0x521317[_0x2be0('0x45')]=_['intersection'](_0x521317[_0x2be0('0x42')],_0x521317[_0x2be0('0x43')]);_0x514661[_0x2be0('0x47')]=_['intersection'](_0x521317[_0x2be0('0x42')],qs['fields'](_0x38d087[_0x2be0('0x43')][_0x2be0('0x55')]));_0x514661[_0x2be0('0x47')]=_0x514661[_0x2be0('0x47')][_0x2be0('0x48')]?_0x514661[_0x2be0('0x47')]:_0x521317[_0x2be0('0x42')];if(!_0x38d087[_0x2be0('0x43')]['hasOwnProperty'](_0x2be0('0x65'))){_0x514661[_0x2be0('0x2f')]=qs[_0x2be0('0x2f')](_0x38d087[_0x2be0('0x43')]['limit']);_0x514661[_0x2be0('0x2c')]=qs[_0x2be0('0x2c')](_0x38d087[_0x2be0('0x43')]['offset']);}_0x514661['order']=qs['sort'](_0x38d087[_0x2be0('0x43')][_0x2be0('0x4b')]);_0x514661[_0x2be0('0x4c')]=qs['filters'](_[_0x2be0('0x66')](_0x38d087[_0x2be0('0x43')],_0x521317[_0x2be0('0x45')]));_0x514661[_0x2be0('0x4c')]['OpenchannelAccountId']=_0x3f1e37['id'];if(_0x38d087[_0x2be0('0x43')][_0x2be0('0x4d')]){_0x514661[_0x2be0('0x4c')]=_[_0x2be0('0x4e')](_0x514661[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x514661[_0x2be0('0x47')],function(_0x127c32){var _0x284adf={};_0x284adf[_0x127c32]={'$like':'%'+_0x38d087['query']['filter']+'%'};return _0x284adf;})});}_0x514661=_[_0x2be0('0x4e')]({},_0x514661,_0x38d087['options']);return db[_0x2be0('0x6d')]['count']({'where':_0x514661['where']})['then'](function(_0x5b6c77){_0x1748ea[_0x2be0('0x2e')]=_0x5b6c77;if(_0x38d087[_0x2be0('0x43')][_0x2be0('0x50')]){_0x514661['include']=[{'all':!![]}];}return db[_0x2be0('0x6d')][_0x2be0('0x68')](_0x514661);})['then'](function(_0x5b2ed3){_0x1748ea[_0x2be0('0x69')]=_0x5b2ed3;return _0x1748ea;});}})[_0x2be0('0x1f')](respondWithFilteredResult(_0x321946,_0x514661))['catch'](handleError(_0x321946,null));};exports[_0x2be0('0x6e')]=function(_0x38e0bc,_0x57d8aa,_0xf2a892){return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x38e0bc['params']['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x57d8aa,null))[_0x2be0('0x1f')](function(_0x1a80bb){if(_0x1a80bb){return _0x1a80bb['removeAnswers'](_0x38e0bc[_0x2be0('0x43')]['ids']);}})[_0x2be0('0x1f')](respondWithStatusCode(_0x57d8aa,null))['catch'](handleError(_0x57d8aa,null));};exports[_0x2be0('0x6f')]=function(_0x487e8d,_0xdc6140,_0x1e4208){var _0x4abf29={'body':_0x487e8d[_0x2be0('0x57')],'channel':_0x2be0('0x70')};var _0xfdeac7=[];var _0x3ae40a=[];var _0x222e7f={};var _0x3c3ae9=![];return db[_0x2be0('0x71')][_0x2be0('0x5f')]()[_0x2be0('0x1f')](function(_0x12d2ea){if(!_0x12d2ea){throw new db[(_0x2be0('0x72'))][(_0x2be0('0x73'))](_0x2be0('0x74'));}_0xfdeac7=_[_0x2be0('0x75')](_['keys'](_0x12d2ea),['createdAt',_0x2be0('0x76')]);_0x3ae40a=_['difference'](_[_0x2be0('0x44')](_0x12d2ea),[_0x2be0('0x77'),'updatedAt',_0x2be0('0x78'),_0x2be0('0x79')]);if(_0x487e8d[_0x2be0('0x57')]['id']){delete _0x487e8d['body']['id'];}if(_['isNil'](_0x487e8d[_0x2be0('0x57')][_0x2be0('0x7a')])){throw new db[(_0x2be0('0x72'))][(_0x2be0('0x73'))](_0x2be0('0x7b'));}if(_[_0x2be0('0x7c')](_0x487e8d[_0x2be0('0x57')]['body'])||_0x487e8d[_0x2be0('0x57')][_0x2be0('0x57')]===''){throw new db[(_0x2be0('0x72'))][(_0x2be0('0x73'))](_0x2be0('0x7d'));}if(_[_0x2be0('0x7c')](_0x487e8d[_0x2be0('0x57')][_0x2be0('0x7e')])){throw new db[(_0x2be0('0x72'))][(_0x2be0('0x73'))](_0x2be0('0x7f')+_0x3ae40a);}if(!_[_0x2be0('0x80')](_0x3ae40a,_0x487e8d[_0x2be0('0x57')]['mapKey'])){throw new db[(_0x2be0('0x72'))][(_0x2be0('0x73'))](_0x2be0('0x81')+_0x3ae40a);}_0x222e7f[_0x487e8d['body'][_0x2be0('0x7e')]]=_0x487e8d['body']['from'];})[_0x2be0('0x1f')](function(){return db[_0x2be0('0x3f')]['find']({'where':{'id':_0x487e8d[_0x2be0('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x2be0('0x82'),'include':[{'model':db['CmContact'],'as':_0x2be0('0x83'),'where':_0x222e7f,'limit':0x1,'order':[[_0x2be0('0x76'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xdc6140,null))['then'](function(_0xcf444e){if(_0xcf444e&&_0xcf444e[_0x2be0('0x82')]){_0x4abf29[_0x2be0('0x84')]=_0xcf444e;_0x4abf29[_0x2be0('0x85')]=_0xcf444e[_0x2be0('0x86')];_0x4abf29[_0x2be0('0x87')]=_0xcf444e[_0x2be0('0x82')];_0x4abf29[_0x2be0('0x85')]=_['orderBy'](_0x4abf29[_0x2be0('0x85')],['priority'],[_0x2be0('0x88')]);if(_0x4abf29['account']['Applications']){delete _0x4abf29[_0x2be0('0x84')][_0x2be0('0x86')];}if(_0x4abf29[_0x2be0('0x84')][_0x2be0('0x82')]&&_0x4abf29[_0x2be0('0x84')][_0x2be0('0x82')][_0x2be0('0x83')][_0x2be0('0x48')]){return _0x4abf29[_0x2be0('0x84')][_0x2be0('0x82')][_0x2be0('0x83')][0x0];}var _0x47954f=_[_0x2be0('0x17')](_0x487e8d['body'],{'firstName':_0x487e8d['body']['from'],'ListId':_0xcf444e['ListId']});_0x47954f[_0x487e8d['body'][_0x2be0('0x7e')]]=_0x487e8d[_0x2be0('0x57')]['from'];return db[_0x2be0('0x71')][_0x2be0('0x56')](_0x47954f,{'fields':_0xfdeac7,'raw':!![]});}})[_0x2be0('0x1f')](handleEntityNotFound(_0xdc6140,null))[_0x2be0('0x1f')](function(_0x3e6188){_0x4abf29['contact']=_0x3e6188;if(_0x3e6188){var _0x58393a={'ContactId':_0x3e6188['id'],'OpenchannelAccountId':_0x487e8d[_0x2be0('0x53')]['id'],'from':(_0x3e6188['firstName']||'')+'\x20'+(_0x3e6188[_0x2be0('0x89')]||'')};var _0x4a9c76={'OpenchannelAccountId':_0x487e8d[_0x2be0('0x53')]['id'],'closed':![]};if(_0x487e8d[_0x2be0('0x57')]['threadId']){_0x4a9c76[_0x2be0('0x8a')]=_0x487e8d['body'][_0x2be0('0x8a')];return db[_0x2be0('0x8b')]['find']({'where':_0x4a9c76})[_0x2be0('0x1f')](function(_0x1d9ace){if(_0x1d9ace){return[_0x1d9ace,![]];}_0x58393a[_0x2be0('0x8a')]=_0x487e8d[_0x2be0('0x57')][_0x2be0('0x8a')];_0x58393a[_0x2be0('0x8c')]=_0x487e8d['body']['externalUrl'];return db[_0x2be0('0x8b')][_0x2be0('0x56')](_0x58393a)['then'](function(_0x55c321){return[_0x55c321,!![]];});});}else{_0x4a9c76[_0x2be0('0x8a')]=null;}_0x4a9c76[_0x2be0('0x8d')]=_0x3e6188['id'];return db[_0x2be0('0x8b')]['find']({'where':_0x4a9c76})[_0x2be0('0x1f')](function(_0x4c8538){if(_0x4c8538){return[_0x4c8538,![]];}return db[_0x2be0('0x8b')][_0x2be0('0x56')](_0x58393a)[_0x2be0('0x1f')](function(_0x4e5994){return[_0x4e5994,!![]];});});}})[_0x2be0('0x8e')](function(_0x247ffd,_0x4b65ec){if(_0x247ffd){_0x3c3ae9=_0x4b65ec;if(!_0x4b65ec){var _0x11be59={'from':(_0x4abf29['contact']['firstName']||'')+'\x20'+(_0x4abf29[_0x2be0('0x8f')]['lastName']||'')};if(_0x487e8d[_0x2be0('0x57')][_0x2be0('0x8a')]&&_0x487e8d[_0x2be0('0x57')]['messageId']&&_0x487e8d[_0x2be0('0x57')][_0x2be0('0x8a')]!=_0x487e8d[_0x2be0('0x57')][_0x2be0('0x90')]){_0x11be59[_0x2be0('0x8a')]=_0x487e8d[_0x2be0('0x57')][_0x2be0('0x90')];}return _0x247ffd['update'](_0x11be59);}else{return _0x247ffd;}}})[_0x2be0('0x1f')](function(_0x4ce866){_0x4abf29[_0x2be0('0x91')]=_0x4ce866['get']({'plain':!![]});_0x4abf29[_0x2be0('0x91')][_0x2be0('0x92')]=_0x3c3ae9;if(_0x4abf29[_0x2be0('0x91')]['created']){if(_0x4abf29[_0x2be0('0x84')]['autoclose']){_0x4abf29['applications'][_0x2be0('0x93')]({'id':0x0,'priority':_0x4abf29[_0x2be0('0x85')][_0x2be0('0x48')]+0x1,'app':_0x2be0('0x94'),'appdata':'unmanaged','interval':_0x2be0('0x95')});}}return db[_0x2be0('0x96')]['create']({'body':_0x487e8d[_0x2be0('0x57')][_0x2be0('0x57')],'OpenchannelAccountId':_0x487e8d[_0x2be0('0x53')]['id'],'OpenchannelInteractionId':_0x4ce866['id'],'direction':'in','ContactId':_0x4abf29[_0x2be0('0x8f')]['id'],'AttachmentId':_0x487e8d[_0x2be0('0x57')][_0x2be0('0x97')]});})[_0x2be0('0x1f')](function(_0x555803){_0x4abf29[_0x2be0('0x27')]=_0x555803;if(_0x4abf29[_0x2be0('0x91')][_0x2be0('0x98')]){return db[_0x2be0('0x99')][_0x2be0('0x5b')]({'attributes':['id',_0x2be0('0x3b')],'where':{'id':_0x4abf29[_0x2be0('0x91')][_0x2be0('0x98')]}})[_0x2be0('0x1f')](function(_0x4b69a7){if(_0x4b69a7){_0x4abf29[_0x2be0('0x85')][_0x2be0('0x9a')]({'id':0x0,'priority':0x0,'app':_0x2be0('0x9b'),'appdata':_0x4b69a7[_0x2be0('0x3b')]+','+(_0x4abf29[_0x2be0('0x84')][_0x2be0('0x9c')]||0xa),'interval':_0x2be0('0x95')});_0x4abf29[_0x2be0('0x9d')]=![];}return respondWithRpcPromise('Start','startRouting',_0x4abf29);});}return respondWithRpcPromise('Start','startRouting',_0x4abf29);})['then'](function(_0x3f4c8c){respondWithRpcPromise(_0x2be0('0x9e'),_0x2be0('0x9e'),{'event':_0x2be0('0x6f'),'message':_0x3f4c8c},client9002);return _0x3f4c8c;})['then'](respondWithResult(_0xdc6140,null))[_0x2be0('0x28')](handleError(_0xdc6140,null));};exports['addApplications']=function(_0x410563,_0x1a1a97){var _0x4cf4f0=_0x410563[_0x2be0('0x53')]['id'];var _0x5acddf=_0x410563[_0x2be0('0x57')];var _0x3ec18b=0xc8;var _0x3dde11=null;return db[_0x2be0('0x9f')]['transaction']({'isolationLevel':db[_0x2be0('0x9f')][_0x2be0('0xa0')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x576202){return db[_0x2be0('0x3f')]['findOne']({'where':{'id':_0x4cf4f0},'transaction':_0x576202})['then'](function(_0x3baa84){if(_0x3baa84){return db['OpenchannelApplication'][_0x2be0('0x36')]({'where':{'OpenchannelAccountId':_0x4cf4f0},'transaction':_0x576202})[_0x2be0('0x1f')](function(){var _0xd07556=_['map'](_0x5acddf,function(_0x39220f){_0x39220f[_0x2be0('0x61')]=_0x4cf4f0;return _0x39220f;});return db[_0x2be0('0xa1')]['bulkCreate'](_0xd07556,{'transaction':_0x576202});});}else{_0x3ec18b=0x194;_0x3dde11=[];}});})[_0x2be0('0x1f')](function(){if(_0x3ec18b!==0x194){return db['OpenchannelApplication'][_0x2be0('0xa2')]({'where':{'OpenchannelAccountId':_0x4cf4f0},'order':_0x2be0('0xa3')})[_0x2be0('0x1f')](function(_0x2b911a){_0x3dde11=_0x2b911a;});}})['catch'](function(_0x319276){_0x3ec18b=0x1f4;logger[_0x2be0('0x26')](_0x319276['stack']);if(_0x319276[_0x2be0('0x3b')]){delete _0x319276['name'];}_0x3dde11=_0x319276;})[_0x2be0('0xa4')](function(){if(_0x3dde11===null){_0x1a1a97[_0x2be0('0x29')](_0x3ec18b);}else{if(_0x3ec18b===0x1f4){_0x1a1a97[_0x2be0('0x2a')](_0x3ec18b)[_0x2be0('0x3c')](_0x3dde11);}else{_0x1a1a97[_0x2be0('0x2a')](_0x3ec18b)[_0x2be0('0x2b')](_0x3dde11);}}});};exports['getApplications']=function(_0x5c5c5d,_0x375928,_0x48be43){var _0x5a8148={};var _0x5b8f83={};var _0x52c438;var _0x301dd8;return db[_0x2be0('0x3f')]['findOne']({'where':{'id':_0x5c5c5d[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x375928,null))[_0x2be0('0x1f')](function(_0x294ae9){if(_0x294ae9){_0x52c438=_0x294ae9;_0x5b8f83[_0x2be0('0x42')]=_[_0x2be0('0x44')](db['OpenchannelApplication'][_0x2be0('0x64')]);_0x5b8f83[_0x2be0('0x43')]=_['keys'](_0x5c5c5d['query']);_0x5b8f83['filters']=_[_0x2be0('0x46')](_0x5b8f83[_0x2be0('0x42')],_0x5b8f83['query']);_0x5a8148[_0x2be0('0x47')]=_[_0x2be0('0x46')](_0x5b8f83['model'],qs[_0x2be0('0x55')](_0x5c5c5d[_0x2be0('0x43')][_0x2be0('0x55')]));_0x5a8148[_0x2be0('0x47')]=_0x5a8148['attributes'][_0x2be0('0x48')]?_0x5a8148[_0x2be0('0x47')]:_0x5b8f83[_0x2be0('0x42')];_0x5a8148['order']=qs['sort'](_0x5c5c5d['query'][_0x2be0('0x4b')]);_0x5a8148[_0x2be0('0x4c')]=qs[_0x2be0('0x45')](_[_0x2be0('0x66')](_0x5c5c5d[_0x2be0('0x43')],_0x5b8f83[_0x2be0('0x45')]));if(_0x5c5c5d[_0x2be0('0x43')][_0x2be0('0x4d')]){_0x5a8148[_0x2be0('0x4c')]=_[_0x2be0('0x4e')](_0x5a8148[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x5a8148[_0x2be0('0x47')],function(_0x109265){var _0x554097={};_0x554097[_0x109265]={'$like':'%'+_0x5c5c5d[_0x2be0('0x43')]['filter']+'%'};return _0x554097;})});}_0x5a8148=_[_0x2be0('0x4e')]({},_0x5a8148,_0x5c5c5d[_0x2be0('0x4f')]);return _0x52c438[_0x2be0('0xa5')](_0x5a8148);}})[_0x2be0('0x1f')](function(_0x1ec1be){if(_0x1ec1be){_0x301dd8=_0x1ec1be[_0x2be0('0x48')];if(!_0x5c5c5d[_0x2be0('0x43')]['hasOwnProperty'](_0x2be0('0x65'))){_0x5a8148[_0x2be0('0x2f')]=qs[_0x2be0('0x2f')](_0x5c5c5d['query'][_0x2be0('0x2f')]);_0x5a8148[_0x2be0('0x2c')]=qs[_0x2be0('0x2c')](_0x5c5c5d[_0x2be0('0x43')][_0x2be0('0x2c')]);}return _0x52c438[_0x2be0('0xa5')](_0x5a8148);}})[_0x2be0('0x1f')](function(_0x1cad48){if(_0x1cad48){return _0x1cad48?{'count':_0x301dd8,'rows':_0x1cad48}:null;}})['then'](respondWithResult(_0x375928,null))[_0x2be0('0x28')](handleError(_0x375928,null));};exports[_0x2be0('0xa6')]=function(_0x448292,_0x4b401a,_0x315364){var _0x1ce54f={'raw':![],'where':{}};var _0x100fe1={};var _0x2ba673={'count':0x0,'rows':[]};return db[_0x2be0('0x3f')][_0x2be0('0x63')]({'where':{'id':_0x448292['params']['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x4b401a,null))['then'](function(_0x1c30d6){if(_0x1c30d6){_0x100fe1['model']=_[_0x2be0('0x44')](db[_0x2be0('0x8b')][_0x2be0('0x64')]);_0x100fe1[_0x2be0('0x43')]=_[_0x2be0('0x44')](_0x448292[_0x2be0('0x43')]);_0x100fe1['filters']=_[_0x2be0('0x46')](_0x100fe1[_0x2be0('0x42')],_0x100fe1['query']);_0x1ce54f[_0x2be0('0x47')]=_[_0x2be0('0x46')](_0x100fe1[_0x2be0('0x42')],qs[_0x2be0('0x55')](_0x448292[_0x2be0('0x43')][_0x2be0('0x55')]));_0x1ce54f[_0x2be0('0x47')]=_0x1ce54f['attributes']['length']?_0x1ce54f[_0x2be0('0x47')]:_0x100fe1['model'];if(!_0x448292[_0x2be0('0x43')][_0x2be0('0x49')]('nolimit')){_0x1ce54f['limit']=qs[_0x2be0('0x2f')](_0x448292[_0x2be0('0x43')][_0x2be0('0x2f')]);_0x1ce54f['offset']=qs['offset'](_0x448292['query'][_0x2be0('0x2c')]);}_0x1ce54f[_0x2be0('0x4a')]=qs['sort'](_0x448292[_0x2be0('0x43')]['sort']);_0x1ce54f[_0x2be0('0x4c')]=qs[_0x2be0('0x45')](_[_0x2be0('0x66')](_0x448292[_0x2be0('0x43')],_0x100fe1['filters']));_0x1ce54f[_0x2be0('0x4c')]['OpenchannelAccountId']=_0x1c30d6['id'];if(_0x448292['query'][_0x2be0('0x4d')]){_0x1ce54f[_0x2be0('0x4c')]=_[_0x2be0('0x4e')](_0x1ce54f[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x1ce54f[_0x2be0('0x47')],function(_0x1aae13){var _0x4b538e={};_0x4b538e[_0x1aae13]={'$like':'%'+_0x448292[_0x2be0('0x43')][_0x2be0('0x4d')]+'%'};return _0x4b538e;})});}_0x1ce54f=_[_0x2be0('0x4e')]({},_0x1ce54f,_0x448292[_0x2be0('0x4f')]);return db[_0x2be0('0x8b')][_0x2be0('0x2e')]({'where':_0x1ce54f['where']})['then'](function(_0x253027){_0x2ba673['count']=_0x253027;if(_0x448292[_0x2be0('0x43')][_0x2be0('0x50')]){_0x1ce54f[_0x2be0('0x51')]=[{'model':db[_0x2be0('0x71')],'as':_0x2be0('0xa7'),'required':![]},{'model':db[_0x2be0('0x99')],'as':_0x2be0('0xa8'),'attributes':[_0x2be0('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x2be0('0xa9')],'as':'Tags','attributes':['id',_0x2be0('0x3b'),_0x2be0('0xaa')],'where':_0x448292[_0x2be0('0x43')][_0x2be0('0xab')]?{'id':_0x448292[_0x2be0('0x43')]['tag']}:undefined,'required':_0x448292[_0x2be0('0x43')][_0x2be0('0xab')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x2be0('0x68')](_0x1ce54f);})['then'](function(_0x4ecadf){_0x2ba673['rows']=_0x4ecadf;return _0x2ba673;});}})['then'](respondWithFilteredResult(_0x4b401a,_0x1ce54f))[_0x2be0('0x28')](handleError(_0x4b401a,null));};exports[_0x2be0('0xac')]=function(_0x3207f0,_0x4fa333,_0x19bacb){return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x3207f0[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x4fa333,null))[_0x2be0('0x1f')](function(_0x3c69f4){if(_0x3c69f4){return _0x3c69f4[_0x2be0('0xac')](_0x3207f0['body'][_0x2be0('0x6b')],_['omit'](_0x3207f0[_0x2be0('0x57')],[_0x2be0('0x6b'),'id'])||{})[_0x2be0('0x8e')](function(_0x39ab4c){for(var _0x5c1396=0x0;_0x5c1396<_0x3207f0[_0x2be0('0x57')][_0x2be0('0x6b')][_0x2be0('0x48')];_0x5c1396+=0x1){socket[_0x2be0('0xad')](_0x2be0('0xae'),{'UserId':Number(_0x3207f0[_0x2be0('0x57')][_0x2be0('0x6b')][_0x5c1396]),'OpenchannelAccountId':Number(_0x3207f0[_0x2be0('0x53')]['id'])});}return _0x39ab4c;});}})[_0x2be0('0x1f')](respondWithResult(_0x4fa333,null))['catch'](handleError(_0x4fa333,null));};exports[_0x2be0('0xaf')]=function(_0x4317fd,_0x3dfe66,_0x34a4cf){return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x4317fd[_0x2be0('0x53')]['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x3dfe66,null))[_0x2be0('0x1f')](function(_0x5ecd53){if(_0x5ecd53){return _0x5ecd53['removeAgents'](_0x4317fd[_0x2be0('0x43')][_0x2be0('0x6b')])[_0x2be0('0x1f')](function(){if(_['isArray'](_0x4317fd['query'][_0x2be0('0x6b')])){for(var _0x1465bf=0x0;_0x1465bf<_0x4317fd[_0x2be0('0x43')]['ids'][_0x2be0('0x48')];_0x1465bf+=0x1){socket[_0x2be0('0xad')](_0x2be0('0xb0'),{'UserId':Number(_0x4317fd['query'][_0x2be0('0x6b')][_0x1465bf]),'OpenchannelAccountId':Number(_0x4317fd[_0x2be0('0x53')]['id'])});}}else{socket[_0x2be0('0xad')](_0x2be0('0xb0'),{'UserId':Number(_0x4317fd[_0x2be0('0x43')][_0x2be0('0x6b')]),'OpenchannelAccountId':Number(_0x4317fd[_0x2be0('0x53')]['id'])});}});}})[_0x2be0('0x1f')](respondWithStatusCode(_0x3dfe66,null))[_0x2be0('0x28')](handleError(_0x3dfe66,null));};exports[_0x2be0('0xb1')]=function(_0xde0f89,_0x56ed56,_0x44066e){var _0x1683b9={};var _0x5738c8={};var _0x3a1569;var _0x49fc5f;return db['OpenchannelAccount'][_0x2be0('0x63')]({'where':{'id':_0xde0f89['params']['id']}})['then'](handleEntityNotFound(_0x56ed56,null))[_0x2be0('0x1f')](function(_0x21a0ce){if(_0x21a0ce){_0x3a1569=_0x21a0ce;_0x5738c8[_0x2be0('0x42')]=_[_0x2be0('0x44')](db['User']['rawAttributes']);_0x5738c8[_0x2be0('0x43')]=_[_0x2be0('0x44')](_0xde0f89[_0x2be0('0x43')]);_0x5738c8[_0x2be0('0x45')]=_[_0x2be0('0x46')](_0x5738c8[_0x2be0('0x42')],_0x5738c8[_0x2be0('0x43')]);_0x1683b9['attributes']=_['intersection'](_0x5738c8[_0x2be0('0x42')],qs['fields'](_0xde0f89[_0x2be0('0x43')][_0x2be0('0x55')]));_0x1683b9[_0x2be0('0x47')]=_0x1683b9[_0x2be0('0x47')][_0x2be0('0x48')]?_0x1683b9[_0x2be0('0x47')]:_0x5738c8[_0x2be0('0x42')];_0x1683b9[_0x2be0('0x4a')]=qs['sort'](_0xde0f89[_0x2be0('0x43')][_0x2be0('0x4b')]);_0x1683b9[_0x2be0('0x4c')]=qs[_0x2be0('0x45')](_[_0x2be0('0x66')](_0xde0f89[_0x2be0('0x43')],_0x5738c8[_0x2be0('0x45')]));if(_0xde0f89[_0x2be0('0x43')][_0x2be0('0x4d')]){_0x1683b9[_0x2be0('0x4c')]=_[_0x2be0('0x4e')](_0x1683b9[_0x2be0('0x4c')],{'$or':_[_0x2be0('0x3e')](_0x1683b9[_0x2be0('0x47')],function(_0x21907a){var _0x1b241e={};_0x1b241e[_0x21907a]={'$like':'%'+_0xde0f89[_0x2be0('0x43')]['filter']+'%'};return _0x1b241e;})});}_0x1683b9=_['merge']({},_0x1683b9,_0xde0f89[_0x2be0('0x4f')]);return _0x3a1569[_0x2be0('0xb1')](_0x1683b9);}})['then'](function(_0xdb4f32){if(_0xdb4f32){_0x49fc5f=_0xdb4f32[_0x2be0('0x48')];if(!_0xde0f89['query'][_0x2be0('0x49')](_0x2be0('0x65'))){_0x1683b9['limit']=qs[_0x2be0('0x2f')](_0xde0f89[_0x2be0('0x43')]['limit']);_0x1683b9[_0x2be0('0x2c')]=qs[_0x2be0('0x2c')](_0xde0f89['query'][_0x2be0('0x2c')]);}return _0x3a1569[_0x2be0('0xb1')](_0x1683b9);}})[_0x2be0('0x1f')](function(_0x4e2976){if(_0x4e2976){return _0x4e2976?{'count':_0x49fc5f,'rows':_0x4e2976}:null;}})[_0x2be0('0x1f')](respondWithResult(_0x56ed56,null))[_0x2be0('0x28')](handleError(_0x56ed56,null));};exports[_0x2be0('0x3c')]=function(_0xe4457,_0x4f4f3f,_0x307e1d){var _0x430f32,_0x30c9e3,_0x4e017f;if(_['isNil'](_0xe4457[_0x2be0('0x57')][_0x2be0('0x57')])||_0xe4457[_0x2be0('0x57')][_0x2be0('0x57')]===''){throw new db['Sequelize'][(_0x2be0('0x73'))](_0x2be0('0x7d'));}if(_[_0x2be0('0x7c')](_0xe4457[_0x2be0('0x57')]['to'])){}_0x430f32=_0xe4457[_0x2be0('0x57')]['to'];return db[_0x2be0('0x3f')][_0x2be0('0x63')]({'where':{'id':_0xe4457['params']['id']}})[_0x2be0('0x1f')](handleEntityNotFound(_0x4f4f3f,null))['then'](function(_0x230d74){if(_0x230d74){return db[_0x2be0('0x3f')][_0x2be0('0x5b')]({'where':{'id':_0x230d74['id']},'include':[{'model':db[_0x2be0('0xb2')],'as':_0x2be0('0x82'),'include':[{'model':db[_0x2be0('0x71')],'as':_0x2be0('0x83'),'where':{[_0x230d74[_0x2be0('0x7e')]]:_0x430f32},'limit':0x1,'order':[[_0x2be0('0x76'),_0x2be0('0xb3')]]}]}]})[_0x2be0('0x1f')](handleEntityNotFound(_0x4f4f3f,null))[_0x2be0('0x1f')](function(_0x38012b){if(_0x38012b&&_0x38012b[_0x2be0('0x82')]){_0x30c9e3=_0x38012b[_0x2be0('0x37')]({'plain':!![]});if(_0x30c9e3[_0x2be0('0x82')]&&_0x30c9e3[_0x2be0('0x82')][_0x2be0('0x83')][_0x2be0('0x48')]){return _0x30c9e3[_0x2be0('0x82')]['Contacts'][0x0];}return db[_0x2be0('0x71')][_0x2be0('0x56')](_[_0x2be0('0x17')](_0xe4457['body'],{'firstName':_0x430f32,[_0x38012b[_0x2be0('0x7e')]]:_0x430f32,'phone':_0x430f32,'ListId':_0x30c9e3[_0x2be0('0x79')]}));}})[_0x2be0('0x1f')](handleEntityNotFound(_0x4f4f3f,null))[_0x2be0('0x1f')](function(_0x20c94f){if(_0x20c94f){_0x4e017f=_0x20c94f;return db['OpenchannelInteraction'][_0x2be0('0x5b')]({'where':{'ContactId':_0x4e017f['id'],'closed':![],'OpenchannelAccountId':_0x30c9e3['id']}})[_0x2be0('0x1f')](function(_0x367753){if(_0x367753){return[_0x367753,![]];}return db[_0x2be0('0x8b')]['create']({'UserId':_0xe4457['user']['id'],'ContactId':_0x4e017f['id'],'OpenchannelAccountId':_0x30c9e3['id'],'lastMsgDirection':_0x2be0('0xb4'),'firstMsgDirection':_0x2be0('0xb4'),'Messages':[_[_0x2be0('0x4e')](_0xe4457['body'],{'read':![],'body':_0xe4457['body']['body'],'OpenchannelAccountId':_0x30c9e3['id'],'UserId':_0xe4457[_0x2be0('0x58')]['id'],'ContactId':_0x4e017f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x2be0('0xb5')}]})[_0x2be0('0x1f')](function(_0x52dd9b){return[_0x52dd9b,!![]];});});}})[_0x2be0('0x8e')](function(_0x28a4ce,_0x28754e){if(_0x28754e){return _0x28a4ce;}return db[_0x2be0('0x96')][_0x2be0('0x56')](_[_0x2be0('0x4e')](_0xe4457[_0x2be0('0x57')],{'read':![],'body':_0xe4457[_0x2be0('0x57')][_0x2be0('0x57')],'OpenchannelAccountId':_0x30c9e3['id'],'OpenchannelInteractionId':_0x28a4ce['id'],'UserId':_0xe4457['user']['id'],'ContactId':_0x4e017f['id']}))[_0x2be0('0x1f')](function(_0x3b8f2e){_0x28a4ce[_0x2be0('0xb6')][_0x2be0('0xb5')]=[];_0x28a4ce[_0x2be0('0xb6')][_0x2be0('0xb5')][_0x2be0('0x93')](_0x3b8f2e[_0x2be0('0xb6')]);return _0x28a4ce;});});}})[_0x2be0('0x1f')](respondWithResult(_0x4f4f3f,null))['catch'](handleError(_0x4f4f3f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ae76a37..14e7388 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 _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x171fa7,_0x587eca){var _0xc894e1=function(_0x43d7c7){while(--_0x43d7c7){_0x171fa7['push'](_0x171fa7['shift']());}};_0xc894e1(++_0x587eca);}(_0x2547,0x1cd));var _0x7254=function(_0x20dcb1,_0x587cb1){_0x20dcb1=_0x20dcb1-0x0;var _0x122153=_0x2547[_0x20dcb1];return _0x122153;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2dae=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x219bbc,_0x3687bf){var _0x4a3f02=function(_0x1d0e95){while(--_0x1d0e95){_0x219bbc['push'](_0x219bbc['shift']());}};_0x4a3f02(++_0x3687bf);}(_0x2dae,0xc3));var _0xe2da=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x2dae[_0x33a694];return _0x41ff01;};'use strict';var EventEmitter=require(_0xe2da('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe2da('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe2da('0x2')](0x0);var events={'afterCreate':_0xe2da('0x3'),'afterUpdate':_0xe2da('0x4'),'afterDestroy':_0xe2da('0x5')};function emitEvent(_0x481d97){return function(_0x25b9f2,_0x439b5d,_0x77e45e){OpenchannelAccountEvents[_0xe2da('0x6')](_0x481d97+':'+_0x25b9f2['id'],_0x25b9f2);OpenchannelAccountEvents['emit'](_0x481d97,_0x25b9f2);_0x77e45e(null);};}for(var e in events){if(events[_0xe2da('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe2da('0x8')](e,emitEvent(event));}}module[_0xe2da('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c48f9db..8d260b0 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x56410b,_0x326d05){var _0x3348e7=function(_0x5c5ac3){while(--_0x5c5ac3){_0x56410b['push'](_0x56410b['shift']());}};_0x3348e7(++_0x326d05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3774bb,_0x4914dc){var _0x58fc64=function(_0x173967){while(--_0x173967){_0x3774bb['push'](_0x3774bb['shift']());}};_0x58fc64(++_0x4914dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 26c8d14..489eba3 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 _0xa74f=['info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then'];(function(_0xc6d7ab,_0x40f000){var _0x3b56d5=function(_0x52bc18){while(--_0x52bc18){_0xc6d7ab['push'](_0xc6d7ab['shift']());}};_0x3b56d5(++_0x40f000);}(_0xa74f,0x9a));var _0xfa74=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xa74f[_0x4429e0];return _0x51a5b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});config[_0xfa74('0x7')]=_[_0xfa74('0x8')](config[_0xfa74('0x7')],{'host':_0xfa74('0x9'),'port':0x18eb});var socket=require(_0xfa74('0xa'))(new Redis(config['redis']));require(_0xfa74('0xb'))[_0xfa74('0xc')](socket);function respondWithRpcPromise(_0x355e37,_0x2a405e,_0x4d118c){return new BPromise(function(_0x46117e,_0x4f8891){return client['request'](_0x355e37,_0x4d118c)[_0xfa74('0xd')](function(_0x1d919d){logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x2a405e,_0xfa74('0x12'),JSON[_0xfa74('0x13')](_0x1d919d));if(_0x1d919d['error']){if(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x15')]===0x1f4){logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')]['message']);return _0x4f8891(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);}logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);return _0x46117e(_0x1d919d[_0xfa74('0x14')]['message']);}else{logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');_0x46117e(_0x1d919d['result'][_0xfa74('0x16')]);}})[_0xfa74('0x17')](function(_0xb8fe6b){logger['error'](_0xfa74('0xf'),_0x2a405e,_0xb8fe6b);_0x4f8891(_0xb8fe6b);});});} \ No newline at end of file +var _0x6b20=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x372291,_0x5910a5){var _0x530635=function(_0x1f21dc){while(--_0x1f21dc){_0x372291['push'](_0x372291['shift']());}};_0x530635(++_0x5910a5);}(_0x6b20,0xd1));var _0x06b2=function(_0x546e34,_0x1dbdd6){_0x546e34=_0x546e34-0x0;var _0x2398c6=_0x6b20[_0x546e34];return _0x2398c6;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});config[_0x06b2('0xb')]=_[_0x06b2('0xc')](config['redis'],{'host':_0x06b2('0xd'),'port':0x18eb});var socket=require(_0x06b2('0xe'))(new Redis(config[_0x06b2('0xb')]));require('./openchannelAccount.socket')[_0x06b2('0xf')](socket);function respondWithRpcPromise(_0x57f854,_0x2cc28f,_0x4da705){return new BPromise(function(_0x552cd8,_0x301519){return client[_0x06b2('0x10')](_0x57f854,_0x4da705)['then'](function(_0x182f8f){logger[_0x06b2('0x11')](_0x06b2('0x12'),_0x2cc28f,_0x06b2('0x13'));logger[_0x06b2('0x14')](_0x06b2('0x15'),_0x2cc28f,_0x06b2('0x13'),JSON[_0x06b2('0x16')](_0x182f8f));if(_0x182f8f[_0x06b2('0x17')]){if(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x18')]===0x1f4){logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f['error'][_0x06b2('0x19')]);return _0x301519(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f[_0x06b2('0x17')]['message']);return _0x552cd8(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}else{logger['info'](_0x06b2('0x12'),_0x2cc28f,'request\x20sent');_0x552cd8(_0x182f8f['result'][_0x06b2('0x19')]);}})[_0x06b2('0x1a')](function(_0x27852e){logger[_0x06b2('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cc28f,_0x27852e);_0x301519(_0x27852e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 1628173..1d68113 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 _0x7980=['emit','removeListener','length','./openchannelAccount.events','save','remove','update'];(function(_0x36547c,_0x49f530){var _0x409167=function(_0x4aa4bd){while(--_0x4aa4bd){_0x36547c['push'](_0x36547c['shift']());}};_0x409167(++_0x49f530);}(_0x7980,0xab));var _0x0798=function(_0x4cb771,_0xc51cc1){_0x4cb771=_0x4cb771-0x0;var _0x46a034=_0x7980[_0x4cb771];return _0x46a034;};'use strict';var OpenchannelAccountEvents=require(_0x0798('0x0'));var events=[_0x0798('0x1'),_0x0798('0x2'),_0x0798('0x3')];function createListener(_0x3181e9,_0x48285b){return function(_0x3a9ff7){_0x48285b[_0x0798('0x4')](_0x3181e9,_0x3a9ff7);};}function removeListener(_0xecc24f,_0x1637db){return function(){OpenchannelAccountEvents[_0x0798('0x5')](_0xecc24f,_0x1637db);};}exports['register']=function(_0x22a0f0){for(var _0x557325=0x0,_0x1e534f=events[_0x0798('0x6')];_0x557325<_0x1e534f;_0x557325++){var _0x467859=events[_0x557325];var _0x54da10=createListener('openchannelAccount:'+_0x467859,_0x22a0f0);OpenchannelAccountEvents['on'](_0x467859,_0x54da10);}}; \ No newline at end of file +var _0x0fec=['removeListener','openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x218896,_0x227715){var _0x41547e=function(_0x38d970){while(--_0x38d970){_0x218896['push'](_0x218896['shift']());}};_0x41547e(++_0x227715);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x1c656a,_0x3ebdab){_0x1c656a=_0x1c656a-0x0;var _0x35bee5=_0x0fec[_0x1c656a];return _0x35bee5;};'use strict';var OpenchannelAccountEvents=require(_0xc0fe('0x0'));var events=[_0xc0fe('0x1'),_0xc0fe('0x2'),'update'];function createListener(_0x5b0e31,_0x36377d){return function(_0x53dc4d){_0x36377d[_0xc0fe('0x3')](_0x5b0e31,_0x53dc4d);};}function removeListener(_0x28af46,_0x4d1088){return function(){OpenchannelAccountEvents[_0xc0fe('0x4')](_0x28af46,_0x4d1088);};}exports['register']=function(_0x3fce36){for(var _0x1073f0=0x0,_0x4cc359=events['length'];_0x1073f0<_0x4cc359;_0x1073f0++){var _0x5b3f5a=events[_0x1073f0];var _0x326ab7=createListener(_0xc0fe('0x5')+_0x5b3f5a,_0x3fce36);OpenchannelAccountEvents['on'](_0x5b3f5a,_0x326ab7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d035d81..f0559a0 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 _0x012d=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0xc60f4a,_0x4d710e){var _0x97c8c1=function(_0xa8667a){while(--_0xa8667a){_0xc60f4a['push'](_0xc60f4a['shift']());}};_0x97c8c1(++_0x4d710e);}(_0x012d,0xca));var _0xd012=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0x012d[_0x49d280];return _0x25274a;};'use strict';var multer=require('multer');var util=require(_0xd012('0x0'));var path=require(_0xd012('0x1'));var timeout=require(_0xd012('0x2'));var express=require(_0xd012('0x3'));var router=express['Router']();var fs_extra=require(_0xd012('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd012('0x5'));var config=require('../../config/environment');var controller=require(_0xd012('0x6'));router[_0xd012('0x7')]('/',auth[_0xd012('0x8')](),controller[_0xd012('0x9')]);router[_0xd012('0x7')](_0xd012('0xa'),auth[_0xd012('0x8')](),controller['show']);router[_0xd012('0xb')]('/',auth[_0xd012('0x8')](),controller[_0xd012('0xc')]);router[_0xd012('0xd')](_0xd012('0xa'),auth[_0xd012('0x8')](),controller['update']);router[_0xd012('0xe')](_0xd012('0xa'),auth[_0xd012('0x8')](),controller['destroy']);module[_0xd012('0xf')]=router; \ No newline at end of file +var _0x1139=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','show','post','create','put','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xb953a,_0x3d230e){var _0x27ea69=function(_0x4c9b9e){while(--_0x4c9b9e){_0xb953a['push'](_0xb953a['shift']());}};_0x27ea69(++_0x3d230e);}(_0x1139,0x1e9));var _0x9113=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1139[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x9113('0x0'));var util=require(_0x9113('0x1'));var path=require('path');var timeout=require(_0x9113('0x2'));var express=require(_0x9113('0x3'));var router=express[_0x9113('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9113('0x5'));var config=require(_0x9113('0x6'));var controller=require(_0x9113('0x7'));router[_0x9113('0x8')]('/',auth[_0x9113('0x9')](),controller['index']);router['get']('/:id',auth[_0x9113('0x9')](),controller[_0x9113('0xa')]);router[_0x9113('0xb')]('/',auth['isAuthenticated'](),controller[_0x9113('0xc')]);router[_0x9113('0xd')]('/:id',auth[_0x9113('0x9')](),controller['update']);router['delete']('/:id',auth[_0x9113('0x9')](),controller['destroy']);module[_0x9113('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index bb483bb..e0ee836 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 _0xf811=['INTEGER','STRING','exports'];(function(_0x24a127,_0x485506){var _0x1c130=function(_0x479f83){while(--_0x479f83){_0x24a127['push'](_0x24a127['shift']());}};_0x1c130(++_0x485506);}(_0xf811,0x1bb));var _0x1f81=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf811[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require('sequelize');module[_0x1f81('0x0')]={'priority':{'type':Sequelize[_0x1f81('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1f81('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1f81('0x2')]},'interval':{'type':Sequelize[_0x1f81('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5050=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5050,0xe7));var _0x0505=function(_0x834e47,_0x4ffed4){_0x834e47=_0x834e47-0x0;var _0x2c5ce1=_0x5050[_0x834e47];return _0x2c5ce1;};'use strict';var Sequelize=require('sequelize');module[_0x0505('0x0')]={'priority':{'type':Sequelize[_0x0505('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0505('0x2')],'allowNull':![],'defaultValue':_0x0505('0x3')},'appdata':{'type':Sequelize[_0x0505('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0505('0x2')],'defaultValue':_0x0505('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index fcb0cbc..42bf151 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 _0x0519=['../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0519,0x1bb));var _0x9051=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x0519[_0x3c4dad];return _0x1a4f49;};'use strict';var emlformat=require(_0x9051('0x0'));var rimraf=require(_0x9051('0x1'));var zipdir=require(_0x9051('0x2'));var jsonpatch=require(_0x9051('0x3'));var rp=require(_0x9051('0x4'));var moment=require(_0x9051('0x5'));var BPromise=require(_0x9051('0x6'));var Mustache=require('mustache');var util=require(_0x9051('0x7'));var path=require(_0x9051('0x8'));var sox=require(_0x9051('0x9'));var csv=require(_0x9051('0xa'));var ejs=require(_0x9051('0xb'));var fs=require('fs');var fs_extra=require(_0x9051('0xc'));var _=require('lodash');var squel=require(_0x9051('0xd'));var crypto=require(_0x9051('0xe'));var jsforce=require(_0x9051('0xf'));var deskjs=require(_0x9051('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9051('0x11'));var Papa=require(_0x9051('0x12'));var Redis=require('ioredis');var authService=require(_0x9051('0x13'));var qs=require(_0x9051('0x14'));var as=require(_0x9051('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9051('0x16'));var utils=require(_0x9051('0x17'));var config=require(_0x9051('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9051('0x19'))['db'];function respondWithStatusCode(_0x351184,_0x362de3){_0x362de3=_0x362de3||0xcc;return function(_0x227e42){if(_0x227e42){return _0x351184['sendStatus'](_0x362de3);}return _0x351184['status'](_0x362de3)[_0x9051('0x1a')]();};}function respondWithResult(_0x343725,_0x522712){_0x522712=_0x522712||0xc8;return function(_0x4b7a6d){if(_0x4b7a6d){return _0x343725[_0x9051('0x1b')](_0x522712)[_0x9051('0x1c')](_0x4b7a6d);}};}function respondWithFilteredResult(_0x11dbed,_0x10d052){return function(_0x1a2ab0){if(_0x1a2ab0){var _0x595d44=typeof _0x10d052['offset']==='undefined'&&typeof _0x10d052['limit']===_0x9051('0x1d');var _0x3bb718=_0x1a2ab0[_0x9051('0x1e')];var _0x32beb5=_0x595d44?0x0:_0x10d052['offset'];var _0xd1c44e=_0x595d44?_0x1a2ab0[_0x9051('0x1e')]:_0x10d052[_0x9051('0x1f')]+_0x10d052[_0x9051('0x20')];var _0x273390;if(_0xd1c44e>=_0x3bb718){_0xd1c44e=_0x3bb718;_0x273390=0xc8;}else{_0x273390=0xce;}_0x11dbed[_0x9051('0x1b')](_0x273390);return _0x11dbed[_0x9051('0x21')](_0x9051('0x22'),_0x32beb5+'-'+_0xd1c44e+'/'+_0x3bb718)[_0x9051('0x1c')](_0x1a2ab0);}return null;};}function patchUpdates(_0x57fe84){return function(_0x264164){try{jsonpatch[_0x9051('0x23')](_0x264164,_0x57fe84,!![]);}catch(_0x24ec47){return BPromise[_0x9051('0x24')](_0x24ec47);}return _0x264164[_0x9051('0x25')]();};}function saveUpdates(_0x7dc905,_0x140b0e){return function(_0x306767){if(_0x306767){return _0x306767[_0x9051('0x26')](_0x7dc905)[_0x9051('0x27')](function(_0x416ce4){return _0x416ce4;});}return null;};}function removeEntity(_0x52f60d,_0x14a246){return function(_0x15893c){if(_0x15893c){return _0x15893c[_0x9051('0x28')]()['then'](function(){_0x52f60d[_0x9051('0x1b')](0xcc)[_0x9051('0x1a')]();});}};}function handleEntityNotFound(_0x174245,_0x2ed465){return function(_0x1b0e1a){if(!_0x1b0e1a){_0x174245[_0x9051('0x29')](0x194);}return _0x1b0e1a;};}function handleError(_0x14d1e7,_0x50a447){_0x50a447=_0x50a447||0x1f4;return function(_0x543867){logger[_0x9051('0x2a')](_0x543867[_0x9051('0x2b')]);if(_0x543867[_0x9051('0x2c')]){delete _0x543867['name'];}_0x14d1e7[_0x9051('0x1b')](_0x50a447)['send'](_0x543867);};}exports[_0x9051('0x2d')]=function(_0x87168b,_0x1c2b30){var _0x11e724={},_0x4ec10f={},_0x45990a={'count':0x0,'rows':[]};var _0x59afde=_[_0x9051('0x2e')](db[_0x9051('0x2f')][_0x9051('0x30')],function(_0x15e192){return{'name':_0x15e192[_0x9051('0x31')],'type':_0x15e192['type'][_0x9051('0x32')]};});_0x4ec10f['model']=_[_0x9051('0x2e')](_0x59afde,_0x9051('0x2c'));_0x4ec10f[_0x9051('0x33')]=_[_0x9051('0x34')](_0x87168b['query']);_0x4ec10f[_0x9051('0x35')]=_[_0x9051('0x36')](_0x4ec10f[_0x9051('0x37')],_0x4ec10f[_0x9051('0x33')]);_0x11e724[_0x9051('0x38')]=_[_0x9051('0x36')](_0x4ec10f[_0x9051('0x37')],qs[_0x9051('0x39')](_0x87168b['query'][_0x9051('0x39')]));_0x11e724['attributes']=_0x11e724[_0x9051('0x38')]['length']?_0x11e724[_0x9051('0x38')]:_0x4ec10f['model'];if(!_0x87168b[_0x9051('0x33')]['hasOwnProperty'](_0x9051('0x3a'))){_0x11e724[_0x9051('0x20')]=qs[_0x9051('0x20')](_0x87168b[_0x9051('0x33')]['limit']);_0x11e724[_0x9051('0x1f')]=qs[_0x9051('0x1f')](_0x87168b[_0x9051('0x33')][_0x9051('0x1f')]);}_0x11e724[_0x9051('0x3b')]=qs['sort'](_0x87168b['query'][_0x9051('0x3c')]);_0x11e724[_0x9051('0x3d')]=qs[_0x9051('0x35')](_[_0x9051('0x3e')](_0x87168b[_0x9051('0x33')],_0x4ec10f[_0x9051('0x35')]),_0x59afde);if(_0x87168b[_0x9051('0x33')][_0x9051('0x3f')]){_0x11e724[_0x9051('0x3d')]=_[_0x9051('0x40')](_0x11e724[_0x9051('0x3d')],{'$or':_[_0x9051('0x2e')](_0x59afde,function(_0x564bd7){if(_0x564bd7['type']!==_0x9051('0x41')){var _0x406d3d={};_0x406d3d[_0x564bd7[_0x9051('0x2c')]]={'$like':'%'+_0x87168b[_0x9051('0x33')][_0x9051('0x3f')]+'%'};return _0x406d3d;}})});}_0x11e724=_[_0x9051('0x40')]({},_0x11e724,_0x87168b[_0x9051('0x42')]);var _0x13601c={'where':_0x11e724['where']};return db[_0x9051('0x2f')]['count'](_0x13601c)[_0x9051('0x27')](function(_0x2f4c43){_0x45990a[_0x9051('0x1e')]=_0x2f4c43;if(_0x87168b[_0x9051('0x33')][_0x9051('0x43')]){_0x11e724[_0x9051('0x44')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9051('0x45')](_0x11e724);})['then'](function(_0x2b2d86){_0x45990a[_0x9051('0x46')]=_0x2b2d86;return _0x45990a;})[_0x9051('0x27')](respondWithFilteredResult(_0x1c2b30,_0x11e724))[_0x9051('0x47')](handleError(_0x1c2b30,null));};exports[_0x9051('0x48')]=function(_0x5e6e3d,_0xbf58f7){var _0x3cb6a0={'raw':!![],'where':{'id':_0x5e6e3d[_0x9051('0x49')]['id']}},_0x43132f={};_0x43132f[_0x9051('0x37')]=_[_0x9051('0x34')](db[_0x9051('0x2f')][_0x9051('0x30')]);_0x43132f[_0x9051('0x33')]=_['keys'](_0x5e6e3d['query']);_0x43132f[_0x9051('0x35')]=_['intersection'](_0x43132f[_0x9051('0x37')],_0x43132f[_0x9051('0x33')]);_0x3cb6a0[_0x9051('0x38')]=_[_0x9051('0x36')](_0x43132f[_0x9051('0x37')],qs[_0x9051('0x39')](_0x5e6e3d[_0x9051('0x33')][_0x9051('0x39')]));_0x3cb6a0[_0x9051('0x38')]=_0x3cb6a0[_0x9051('0x38')][_0x9051('0x4a')]?_0x3cb6a0[_0x9051('0x38')]:_0x43132f[_0x9051('0x37')];if(_0x5e6e3d['query']['includeAll']){_0x3cb6a0[_0x9051('0x44')]=[{'all':!![]}];}_0x3cb6a0=_[_0x9051('0x40')]({},_0x3cb6a0,_0x5e6e3d[_0x9051('0x42')]);return db['OpenchannelApplication']['find'](_0x3cb6a0)['then'](handleEntityNotFound(_0xbf58f7,null))[_0x9051('0x27')](respondWithResult(_0xbf58f7,null))[_0x9051('0x47')](handleError(_0xbf58f7,null));};exports[_0x9051('0x4b')]=function(_0x182855,_0x1c4ca6){return db[_0x9051('0x2f')][_0x9051('0x4b')](_0x182855[_0x9051('0x4c')],{})[_0x9051('0x27')](respondWithResult(_0x1c4ca6,0xc9))['catch'](handleError(_0x1c4ca6,null));};exports[_0x9051('0x26')]=function(_0x3e5f57,_0x1c6db3){if(_0x3e5f57['body']['id']){delete _0x3e5f57['body']['id'];}return db[_0x9051('0x2f')][_0x9051('0x4d')]({'where':{'id':_0x3e5f57[_0x9051('0x49')]['id']}})[_0x9051('0x27')](handleEntityNotFound(_0x1c6db3,null))[_0x9051('0x27')](saveUpdates(_0x3e5f57['body'],null))[_0x9051('0x27')](respondWithResult(_0x1c6db3,null))[_0x9051('0x47')](handleError(_0x1c6db3,null));};exports['destroy']=function(_0x4c6e94,_0xd3922e){return db['OpenchannelApplication']['find']({'where':{'id':_0x4c6e94[_0x9051('0x49')]['id']}})[_0x9051('0x27')](handleEntityNotFound(_0xd3922e,null))['then'](removeEntity(_0xd3922e,null))[_0x9051('0x47')](handleError(_0xd3922e,null));}; \ No newline at end of file +var _0x9438=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','filter','findAll','catch','show','keys','include','options','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5ba113,_0x4b990c){var _0x471a04=function(_0x21df6e){while(--_0x21df6e){_0x5ba113['push'](_0x5ba113['shift']());}};_0x471a04(++_0x4b990c);}(_0x9438,0x186));var _0x8943=function(_0x48e53f,_0x9bdd20){_0x48e53f=_0x48e53f-0x0;var _0xd4fa6a=_0x9438[_0x48e53f];return _0xd4fa6a;};'use strict';var emlformat=require(_0x8943('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8943('0x1'));var jsonpatch=require(_0x8943('0x2'));var rp=require(_0x8943('0x3'));var moment=require(_0x8943('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8943('0x5'));var path=require(_0x8943('0x6'));var sox=require(_0x8943('0x7'));var csv=require(_0x8943('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8943('0x9'));var squel=require(_0x8943('0xa'));var crypto=require(_0x8943('0xb'));var jsforce=require(_0x8943('0xc'));var deskjs=require(_0x8943('0xd'));var toCsv=require(_0x8943('0x8'));var querystring=require(_0x8943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8943('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8943('0x10'));var hardwareService=require(_0x8943('0x11'));var logger=require(_0x8943('0x12'))('api');var utils=require(_0x8943('0x13'));var config=require(_0x8943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307c0c,_0x55d971){_0x55d971=_0x55d971||0xcc;return function(_0x33e0ea){if(_0x33e0ea){return _0x307c0c[_0x8943('0x15')](_0x55d971);}return _0x307c0c[_0x8943('0x16')](_0x55d971)[_0x8943('0x17')]();};}function respondWithResult(_0x61f15c,_0x17ac2e){_0x17ac2e=_0x17ac2e||0xc8;return function(_0x1d88b1){if(_0x1d88b1){return _0x61f15c[_0x8943('0x16')](_0x17ac2e)[_0x8943('0x18')](_0x1d88b1);}};}function respondWithFilteredResult(_0x222676,_0x3bf27b){return function(_0x2753e3){if(_0x2753e3){var _0x19f69d=typeof _0x3bf27b[_0x8943('0x19')]===_0x8943('0x1a')&&typeof _0x3bf27b[_0x8943('0x1b')]===_0x8943('0x1a');var _0x249416=_0x2753e3[_0x8943('0x1c')];var _0x26b46d=_0x19f69d?0x0:_0x3bf27b[_0x8943('0x19')];var _0x164cfd=_0x19f69d?_0x2753e3[_0x8943('0x1c')]:_0x3bf27b['offset']+_0x3bf27b[_0x8943('0x1b')];var _0x338824;if(_0x164cfd>=_0x249416){_0x164cfd=_0x249416;_0x338824=0xc8;}else{_0x338824=0xce;}_0x222676[_0x8943('0x16')](_0x338824);return _0x222676['set'](_0x8943('0x1d'),_0x26b46d+'-'+_0x164cfd+'/'+_0x249416)[_0x8943('0x18')](_0x2753e3);}return null;};}function patchUpdates(_0x5e3acf){return function(_0x27b56f){try{jsonpatch['apply'](_0x27b56f,_0x5e3acf,!![]);}catch(_0x510260){return BPromise[_0x8943('0x1e')](_0x510260);}return _0x27b56f[_0x8943('0x1f')]();};}function saveUpdates(_0x216a76,_0x18eb0b){return function(_0x3236b5){if(_0x3236b5){return _0x3236b5[_0x8943('0x20')](_0x216a76)[_0x8943('0x21')](function(_0x371409){return _0x371409;});}return null;};}function removeEntity(_0x59aada,_0x15ef77){return function(_0x34b29c){if(_0x34b29c){return _0x34b29c['destroy']()['then'](function(){_0x59aada[_0x8943('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5f90,_0x48ac8f){return function(_0x164d67){if(!_0x164d67){_0x2f5f90[_0x8943('0x15')](0x194);}return _0x164d67;};}function handleError(_0x1ed91d,_0x254307){_0x254307=_0x254307||0x1f4;return function(_0x4563ad){logger['error'](_0x4563ad[_0x8943('0x22')]);if(_0x4563ad[_0x8943('0x23')]){delete _0x4563ad[_0x8943('0x23')];}_0x1ed91d['status'](_0x254307)[_0x8943('0x24')](_0x4563ad);};}exports[_0x8943('0x25')]=function(_0x39cc9e,_0x184496){var _0x4b34f5={},_0x3915f7={},_0x282418={'count':0x0,'rows':[]};var _0x5d1850=_[_0x8943('0x26')](db[_0x8943('0x27')][_0x8943('0x28')],function(_0x290deb){return{'name':_0x290deb[_0x8943('0x29')],'type':_0x290deb[_0x8943('0x2a')][_0x8943('0x2b')]};});_0x3915f7[_0x8943('0x2c')]=_[_0x8943('0x26')](_0x5d1850,_0x8943('0x23'));_0x3915f7[_0x8943('0x2d')]=_['keys'](_0x39cc9e[_0x8943('0x2d')]);_0x3915f7[_0x8943('0x2e')]=_[_0x8943('0x2f')](_0x3915f7[_0x8943('0x2c')],_0x3915f7['query']);_0x4b34f5['attributes']=_[_0x8943('0x2f')](_0x3915f7[_0x8943('0x2c')],qs['fields'](_0x39cc9e[_0x8943('0x2d')][_0x8943('0x30')]));_0x4b34f5[_0x8943('0x31')]=_0x4b34f5[_0x8943('0x31')][_0x8943('0x32')]?_0x4b34f5[_0x8943('0x31')]:_0x3915f7[_0x8943('0x2c')];if(!_0x39cc9e[_0x8943('0x2d')]['hasOwnProperty'](_0x8943('0x33'))){_0x4b34f5[_0x8943('0x1b')]=qs[_0x8943('0x1b')](_0x39cc9e[_0x8943('0x2d')]['limit']);_0x4b34f5[_0x8943('0x19')]=qs['offset'](_0x39cc9e[_0x8943('0x2d')][_0x8943('0x19')]);}_0x4b34f5[_0x8943('0x34')]=qs['sort'](_0x39cc9e[_0x8943('0x2d')]['sort']);_0x4b34f5[_0x8943('0x35')]=qs[_0x8943('0x2e')](_[_0x8943('0x36')](_0x39cc9e[_0x8943('0x2d')],_0x3915f7[_0x8943('0x2e')]),_0x5d1850);if(_0x39cc9e[_0x8943('0x2d')]['filter']){_0x4b34f5[_0x8943('0x35')]=_[_0x8943('0x37')](_0x4b34f5[_0x8943('0x35')],{'$or':_[_0x8943('0x26')](_0x5d1850,function(_0x4011ec){if(_0x4011ec[_0x8943('0x2a')]!=='VIRTUAL'){var _0x3db658={};_0x3db658[_0x4011ec[_0x8943('0x23')]]={'$like':'%'+_0x39cc9e[_0x8943('0x2d')][_0x8943('0x38')]+'%'};return _0x3db658;}})});}_0x4b34f5=_[_0x8943('0x37')]({},_0x4b34f5,_0x39cc9e['options']);var _0x552a78={'where':_0x4b34f5['where']};return db['OpenchannelApplication']['count'](_0x552a78)[_0x8943('0x21')](function(_0xaa5082){_0x282418[_0x8943('0x1c')]=_0xaa5082;if(_0x39cc9e[_0x8943('0x2d')]['includeAll']){_0x4b34f5['include']=[{'all':!![]}];}return db[_0x8943('0x27')][_0x8943('0x39')](_0x4b34f5);})[_0x8943('0x21')](function(_0x213562){_0x282418['rows']=_0x213562;return _0x282418;})['then'](respondWithFilteredResult(_0x184496,_0x4b34f5))[_0x8943('0x3a')](handleError(_0x184496,null));};exports[_0x8943('0x3b')]=function(_0xcfc5f7,_0x44f58b){var _0xd0a830={'raw':!![],'where':{'id':_0xcfc5f7['params']['id']}},_0x5ab011={};_0x5ab011[_0x8943('0x2c')]=_['keys'](db[_0x8943('0x27')][_0x8943('0x28')]);_0x5ab011[_0x8943('0x2d')]=_[_0x8943('0x3c')](_0xcfc5f7['query']);_0x5ab011[_0x8943('0x2e')]=_['intersection'](_0x5ab011[_0x8943('0x2c')],_0x5ab011[_0x8943('0x2d')]);_0xd0a830[_0x8943('0x31')]=_[_0x8943('0x2f')](_0x5ab011[_0x8943('0x2c')],qs[_0x8943('0x30')](_0xcfc5f7[_0x8943('0x2d')]['fields']));_0xd0a830[_0x8943('0x31')]=_0xd0a830['attributes'][_0x8943('0x32')]?_0xd0a830[_0x8943('0x31')]:_0x5ab011[_0x8943('0x2c')];if(_0xcfc5f7[_0x8943('0x2d')]['includeAll']){_0xd0a830[_0x8943('0x3d')]=[{'all':!![]}];}_0xd0a830=_['merge']({},_0xd0a830,_0xcfc5f7[_0x8943('0x3e')]);return db[_0x8943('0x27')][_0x8943('0x3f')](_0xd0a830)[_0x8943('0x21')](handleEntityNotFound(_0x44f58b,null))[_0x8943('0x21')](respondWithResult(_0x44f58b,null))[_0x8943('0x3a')](handleError(_0x44f58b,null));};exports[_0x8943('0x40')]=function(_0x3591b7,_0x511a6a){return db['OpenchannelApplication'][_0x8943('0x40')](_0x3591b7['body'],{})[_0x8943('0x21')](respondWithResult(_0x511a6a,0xc9))[_0x8943('0x3a')](handleError(_0x511a6a,null));};exports[_0x8943('0x20')]=function(_0x395289,_0xb3b106){if(_0x395289[_0x8943('0x41')]['id']){delete _0x395289[_0x8943('0x41')]['id'];}return db[_0x8943('0x27')][_0x8943('0x3f')]({'where':{'id':_0x395289[_0x8943('0x42')]['id']}})[_0x8943('0x21')](handleEntityNotFound(_0xb3b106,null))[_0x8943('0x21')](saveUpdates(_0x395289[_0x8943('0x41')],null))[_0x8943('0x21')](respondWithResult(_0xb3b106,null))[_0x8943('0x3a')](handleError(_0xb3b106,null));};exports[_0x8943('0x43')]=function(_0x4f6c12,_0x4ed22d){return db[_0x8943('0x27')][_0x8943('0x3f')]({'where':{'id':_0x4f6c12['params']['id']}})[_0x8943('0x21')](handleEntityNotFound(_0x4ed22d,null))[_0x8943('0x21')](removeEntity(_0x4ed22d,null))[_0x8943('0x3a')](handleError(_0x4ed22d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ae37a30..d779a72 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 _0xf391=['bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','util','api','moment'];(function(_0x1cc555,_0x39d154){var _0x442a72=function(_0x156f3a){while(--_0x156f3a){_0x1cc555['push'](_0x1cc555['shift']());}};_0x442a72(++_0x39d154);}(_0xf391,0x1d3));var _0x1f39=function(_0x3e3905,_0x574a7c){_0x3e3905=_0x3e3905-0x0;var _0x6c62e3=_0xf391[_0x3e3905];return _0x6c62e3;};'use strict';var _=require('lodash');var util=require(_0x1f39('0x0'));var logger=require('../../config/logger')(_0x1f39('0x1'));var moment=require(_0x1f39('0x2'));var BPromise=require(_0x1f39('0x3'));var rp=require(_0x1f39('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f39('0x5'));var attributes=require(_0x1f39('0x6'));module[_0x1f39('0x7')]=function(_0x385d0f,_0x339c1a){return _0x385d0f['define']('OpenchannelApplication',attributes,{'tableName':_0x1f39('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f39('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x470b=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','../../config/environment','exports'];(function(_0x4e202d,_0x221567){var _0x24c04f=function(_0x19727f){while(--_0x19727f){_0x4e202d['push'](_0x4e202d['shift']());}};_0x24c04f(++_0x221567);}(_0x470b,0x93));var _0xb470=function(_0x98a1f2,_0x75360f){_0x98a1f2=_0x98a1f2-0x0;var _0x2cfc98=_0x470b[_0x98a1f2];return _0x2cfc98;};'use strict';var _=require(_0xb470('0x0'));var util=require(_0xb470('0x1'));var logger=require('../../config/logger')(_0xb470('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb470('0x3'));var fs=require('fs');var path=require(_0xb470('0x4'));var rimraf=require('rimraf');var config=require(_0xb470('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0xb470('0x6')]=function(_0x576f25,_0x3c5665){return _0x576f25[_0xb470('0x7')](_0xb470('0x8'),attributes,{'tableName':_0xb470('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb470('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 28c0589..ce43dd3 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 _0xe7c6=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','then','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x4d171c,_0x1163b8){var _0x104420=function(_0x454c19){while(--_0x454c19){_0x4d171c['push'](_0x4d171c['shift']());}};_0x104420(++_0x1163b8);}(_0xe7c6,0xa8));var _0x6e7c=function(_0xbf963c,_0xddc291){_0xbf963c=_0xbf963c-0x0;var _0x451c5d=_0xe7c6[_0xbf963c];return _0x451c5d;};'use strict';var _=require('lodash');var util=require(_0x6e7c('0x0'));var moment=require(_0x6e7c('0x1'));var BPromise=require(_0x6e7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e7c('0x3'));var db=require(_0x6e7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e7c('0x5'))(_0x6e7c('0x6'));var config=require(_0x6e7c('0x7'));var jayson=require(_0x6e7c('0x8'));var client=jayson[_0x6e7c('0x9')][_0x6e7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbcba22,_0x20e6a3,_0x175514){return new BPromise(function(_0x1f8530,_0x4ab35e){return client['request'](_0xbcba22,_0x175514)['then'](function(_0x1a99f7){logger[_0x6e7c('0xb')](_0x6e7c('0xc'),_0x20e6a3,_0x6e7c('0xd'));logger['debug'](_0x6e7c('0xe'),_0x20e6a3,'request\x20sent',JSON[_0x6e7c('0xf')](_0x1a99f7));if(_0x1a99f7[_0x6e7c('0x10')]){if(_0x1a99f7[_0x6e7c('0x10')][_0x6e7c('0x11')]===0x1f4){logger['error'](_0x6e7c('0xc'),_0x20e6a3,_0x1a99f7[_0x6e7c('0x10')][_0x6e7c('0x12')]);return _0x4ab35e(_0x1a99f7['error'][_0x6e7c('0x12')]);}logger[_0x6e7c('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x20e6a3,_0x1a99f7[_0x6e7c('0x10')][_0x6e7c('0x12')]);return _0x1f8530(_0x1a99f7[_0x6e7c('0x10')][_0x6e7c('0x12')]);}else{logger['info'](_0x6e7c('0xc'),_0x20e6a3,_0x6e7c('0xd'));_0x1f8530(_0x1a99f7['result']['message']);}})[_0x6e7c('0x13')](function(_0x286a54){logger['error'](_0x6e7c('0xc'),_0x20e6a3,_0x286a54);_0x4ab35e(_0x286a54);});});}exports[_0x6e7c('0x14')]=function(_0x911a4b){var _0x597495=this;return new Promise(function(_0x31c730,_0x4fe0c3){return db[_0x6e7c('0x15')][_0x6e7c('0x16')](_0x911a4b[_0x6e7c('0x17')],{'raw':_0x911a4b[_0x6e7c('0x18')]?_0x911a4b[_0x6e7c('0x18')][_0x6e7c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x911a4b[_0x6e7c('0x18')]?_0x911a4b['options'][_0x6e7c('0x1a')]||null:null,'attributes':_0x911a4b[_0x6e7c('0x18')]?_0x911a4b[_0x6e7c('0x18')]['attributes']||null:null,'limit':_0x911a4b[_0x6e7c('0x18')]?_0x911a4b[_0x6e7c('0x18')][_0x6e7c('0x1b')]||null:null})[_0x6e7c('0x1c')](function(_0x5b9016){logger['info'](_0x6e7c('0x14'),_0x911a4b);logger[_0x6e7c('0x1d')](_0x6e7c('0x14'),_0x911a4b,JSON[_0x6e7c('0xf')](_0x5b9016));_0x31c730(_0x5b9016);})[_0x6e7c('0x13')](function(_0xf0fe0b){logger[_0x6e7c('0x10')]('UpdateOpenchannelApplication',_0xf0fe0b['message'],_0x911a4b);_0x4fe0c3(_0x597495[_0x6e7c('0x10')](0x1f4,_0xf0fe0b[_0x6e7c('0x12')]));});});}; \ No newline at end of file +var _0x0673=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','OpenchannelApplication,\x20%s,\x20%s','debug'];(function(_0x342672,_0x1a07a5){var _0x298483=function(_0x34b164){while(--_0x34b164){_0x342672['push'](_0x342672['shift']());}};_0x298483(++_0x1a07a5);}(_0x0673,0x75));var _0x3067=function(_0x46a42e,_0x2f5779){_0x46a42e=_0x46a42e-0x0;var _0x2a323f=_0x0673[_0x46a42e];return _0x2a323f;};'use strict';var _=require(_0x3067('0x0'));var util=require(_0x3067('0x1'));var moment=require('moment');var BPromise=require(_0x3067('0x2'));var rs=require(_0x3067('0x3'));var fs=require('fs');var Redis=require(_0x3067('0x4'));var db=require(_0x3067('0x5'))['db'];var utils=require(_0x3067('0x6'));var logger=require(_0x3067('0x7'))(_0x3067('0x8'));var config=require(_0x3067('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3067('0xa')][_0x3067('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f653,_0x4cd1e0,_0x11957d){return new BPromise(function(_0x1b895e,_0x27a798){return client['request'](_0x58f653,_0x11957d)[_0x3067('0xc')](function(_0x4fcb6a){logger['info'](_0x3067('0xd'),_0x4cd1e0,'request\x20sent');logger[_0x3067('0xe')](_0x3067('0xf'),_0x4cd1e0,_0x3067('0x10'),JSON[_0x3067('0x11')](_0x4fcb6a));if(_0x4fcb6a[_0x3067('0x12')]){if(_0x4fcb6a['error'][_0x3067('0x13')]===0x1f4){logger[_0x3067('0x12')](_0x3067('0xd'),_0x4cd1e0,_0x4fcb6a[_0x3067('0x12')][_0x3067('0x14')]);return _0x27a798(_0x4fcb6a[_0x3067('0x12')]['message']);}logger[_0x3067('0x12')](_0x3067('0xd'),_0x4cd1e0,_0x4fcb6a[_0x3067('0x12')][_0x3067('0x14')]);return _0x1b895e(_0x4fcb6a[_0x3067('0x12')][_0x3067('0x14')]);}else{logger[_0x3067('0x15')](_0x3067('0xd'),_0x4cd1e0,_0x3067('0x10'));_0x1b895e(_0x4fcb6a[_0x3067('0x16')][_0x3067('0x14')]);}})['catch'](function(_0x321f9c){logger[_0x3067('0x12')](_0x3067('0xd'),_0x4cd1e0,_0x321f9c);_0x27a798(_0x321f9c);});});}exports[_0x3067('0x17')]=function(_0x359722){var _0x11c4f1=this;return new Promise(function(_0xa05eb1,_0x4bf4ec){return db[_0x3067('0x18')][_0x3067('0x19')](_0x359722[_0x3067('0x1a')],{'raw':_0x359722[_0x3067('0x1b')]?_0x359722[_0x3067('0x1b')][_0x3067('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x359722[_0x3067('0x1b')]?_0x359722['options'][_0x3067('0x1d')]||null:null,'attributes':_0x359722[_0x3067('0x1b')]?_0x359722[_0x3067('0x1b')][_0x3067('0x1e')]||null:null,'limit':_0x359722[_0x3067('0x1b')]?_0x359722[_0x3067('0x1b')][_0x3067('0x1f')]||null:null})[_0x3067('0xc')](function(_0x89c6a6){logger[_0x3067('0x15')](_0x3067('0x17'),_0x359722);logger['debug']('UpdateOpenchannelApplication',_0x359722,JSON[_0x3067('0x11')](_0x89c6a6));_0xa05eb1(_0x89c6a6);})[_0x3067('0x20')](function(_0x267df3){logger[_0x3067('0x12')](_0x3067('0x17'),_0x267df3['message'],_0x359722);_0x4bf4ec(_0x11c4f1[_0x3067('0x12')](0x1f4,_0x267df3[_0x3067('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c84f1f2..e7d98d4 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 _0x2f46=['./openchannelInteraction.controller','isAuthenticated','get','describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2f46,0x118));var _0x62f4=function(_0x33c60d,_0x13ebf2){_0x33c60d=_0x33c60d-0x0;var _0x1d852f=_0x2f46[_0x33c60d];return _0x1d852f;};'use strict';var multer=require(_0x62f4('0x0'));var util=require(_0x62f4('0x1'));var path=require(_0x62f4('0x2'));var timeout=require(_0x62f4('0x3'));var express=require(_0x62f4('0x4'));var router=express[_0x62f4('0x5')]();var fs_extra=require(_0x62f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x62f4('0x7'));var config=require('../../config/environment');var controller=require(_0x62f4('0x8'));router['get']('/',auth[_0x62f4('0x9')](),controller['index']);router[_0x62f4('0xa')]('/describe',auth[_0x62f4('0x9')](),controller[_0x62f4('0xb')]);router[_0x62f4('0xa')](_0x62f4('0xc'),auth[_0x62f4('0x9')](),controller['show']);router[_0x62f4('0xa')](_0x62f4('0xd'),auth[_0x62f4('0x9')](),controller['getMessages']);router[_0x62f4('0xa')](_0x62f4('0xe'),auth[_0x62f4('0x9')](),controller[_0x62f4('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62f4('0x10')]);router[_0x62f4('0x11')](_0x62f4('0xd'),auth[_0x62f4('0x9')](),controller[_0x62f4('0x12')]);router[_0x62f4('0x11')](_0x62f4('0x13'),auth['isAuthenticated'](),interaction[_0x62f4('0x14')](_0x62f4('0x15'),_0x62f4('0x16')),controller[_0x62f4('0x17')]);router[_0x62f4('0x18')]('/:id',auth[_0x62f4('0x9')](),interaction[_0x62f4('0x14')]('openchannel',_0x62f4('0x19')),controller[_0x62f4('0x1a')]);router[_0x62f4('0x1b')](_0x62f4('0xc'),auth[_0x62f4('0x9')](),interaction[_0x62f4('0x14')]('openchannel',_0x62f4('0x1c')),controller[_0x62f4('0x1d')]);router['delete']('/:id/tags',auth[_0x62f4('0x9')](),controller[_0x62f4('0x1e')]);module[_0x62f4('0x1f')]=router; \ No newline at end of file +var _0xffd6=['addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/:id','/:id/messages','post'];(function(_0x36eb43,_0x1a5b45){var _0x284448=function(_0x4b25d1){while(--_0x4b25d1){_0x36eb43['push'](_0x36eb43['shift']());}};_0x284448(++_0x1a5b45);}(_0xffd6,0x19b));var _0x6ffd=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0xffd6[_0x12b683];return _0xfb150b;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require(_0x6ffd('0x3'));var express=require('express');var router=express[_0x6ffd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ffd('0x5'));var config=require(_0x6ffd('0x6'));var controller=require(_0x6ffd('0x7'));router[_0x6ffd('0x8')]('/',auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xa')]);router['get']('/describe',auth[_0x6ffd('0x9')](),controller['describe']);router[_0x6ffd('0x8')](_0x6ffd('0xb'),auth[_0x6ffd('0x9')](),controller['show']);router[_0x6ffd('0x8')](_0x6ffd('0xc'),auth[_0x6ffd('0x9')](),controller['getMessages']);router[_0x6ffd('0x8')]('/:id/download',auth[_0x6ffd('0x9')](),controller['download']);router[_0x6ffd('0xd')]('/',auth[_0x6ffd('0x9')](),controller['create']);router['post'](_0x6ffd('0xc'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xe')]);router['post'](_0x6ffd('0xf'),auth['isAuthenticated'](),interaction[_0x6ffd('0x10')](_0x6ffd('0x11'),_0x6ffd('0x12')),controller['addTags']);router[_0x6ffd('0x13')](_0x6ffd('0xb'),auth[_0x6ffd('0x9')](),interaction[_0x6ffd('0x10')](_0x6ffd('0x11'),_0x6ffd('0x14')),controller[_0x6ffd('0x15')]);router[_0x6ffd('0x16')](_0x6ffd('0xb'),auth[_0x6ffd('0x9')](),interaction[_0x6ffd('0x10')](_0x6ffd('0x11'),'openchannelinteraction:destroy'),controller[_0x6ffd('0x17')]);router['delete'](_0x6ffd('0xf'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 77598c4..d66f9f8 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 _0x121d=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x121d,0xea));var _0xd121=function(_0x17de13,_0x5a71a2){_0x17de13=_0x17de13-0x0;var _0x1dc96c=_0x121d[_0x17de13];return _0x1dc96c;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'closed':{'type':Sequelize[_0xd121('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd121('0x3')]},'disposition':{'type':Sequelize[_0xd121('0x4')]},'secondDisposition':{'type':Sequelize[_0xd121('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd121('0x4')]},'note':{'type':Sequelize[_0xd121('0x4')]},'read1stAt':{'type':Sequelize[_0xd121('0x3')]},'threadId':{'type':Sequelize[_0xd121('0x4')]},'externalUrl':{'type':Sequelize[_0xd121('0x4')]},'lastMsgAt':{'type':Sequelize[_0xd121('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd121('0x5')]('in',_0xd121('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd121('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xd121('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d5b=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x289187,_0x5b6795){var _0x5c4db4=function(_0x1e4618){while(--_0x1e4618){_0x289187['push'](_0x289187['shift']());}};_0x5c4db4(++_0x5b6795);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x553157,_0x1a14f2){_0x553157=_0x553157-0x0;var _0x2064e4=_0x1d5b[_0x553157];return _0x2064e4;};'use strict';var Sequelize=require(_0xb1d5('0x0'));module[_0xb1d5('0x1')]={'closed':{'type':Sequelize[_0xb1d5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb1d5('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb1d5('0x3')]},'note':{'type':Sequelize[_0xb1d5('0x3')]},'read1stAt':{'type':Sequelize[_0xb1d5('0x4')]},'threadId':{'type':Sequelize[_0xb1d5('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb1d5('0x5')]('in',_0xb1d5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb1d5('0x5')]('in',_0xb1d5('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb1d5('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xb1d5('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d7642f2..5e603fc 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 _0xeabe=['YYYY-MM-DD\x20HH:mm:ss','count','includeAll','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','closed','closedAt','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','out','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','undefined','limit','offset','set','Content-Range','update','then','destroy','end','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','catch','from','params','keys','filters','intersection','model','attributes','fields','length','include','options','find','create','body','describe','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','merge','filter','$gte','format'];(function(_0x5c85c6,_0xb3300b){var _0x5df35a=function(_0x57c602){while(--_0x57c602){_0x5c85c6['push'](_0x5c85c6['shift']());}};_0x5df35a(++_0xb3300b);}(_0xeabe,0x1c3));var _0xeeab=function(_0x33e62d,_0x1bbdb2){_0x33e62d=_0x33e62d-0x0;var _0x56767c=_0xeabe[_0x33e62d];return _0x56767c;};'use strict';var rimraf=require(_0xeeab('0x0'));var zipdir=require('zip-dir');var moment=require(_0xeeab('0x1'));var util=require(_0xeeab('0x2'));var path=require(_0xeeab('0x3'));var ejs=require(_0xeeab('0x4'));var fs=require('fs');var _=require(_0xeeab('0x5'));var Redis=require(_0xeeab('0x6'));var interaction=require(_0xeeab('0x7'));var qs=require(_0xeeab('0x8'));var pdf=require(_0xeeab('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xeeab('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xeeab('0xb')](config[_0xeeab('0xc')],{'host':_0xeeab('0xd'),'port':0x18eb});var socket=require(_0xeeab('0xe'))(new Redis(config[_0xeeab('0xc')]));require(_0xeeab('0xf'))[_0xeeab('0x10')](socket);function respondWithStatusCode(_0x54c0db,_0x5601a7){_0x5601a7=_0x5601a7||0xcc;return function(_0x2cfac3){if(_0x2cfac3){return _0x54c0db[_0xeeab('0x11')](_0x5601a7);}return _0x54c0db[_0xeeab('0x12')](_0x5601a7)['end']();};}function respondWithResult(_0x579235,_0x455c18){_0x455c18=_0x455c18||0xc8;return function(_0x7eed7c){if(_0x7eed7c){return _0x579235[_0xeeab('0x12')](_0x455c18)[_0xeeab('0x13')](_0x7eed7c);}};}function respondWithFilteredResult(_0x3a703a,_0x2b7329){return function(_0x8f3ece){if(_0x8f3ece){var _0x45dca1=typeof _0x2b7329['offset']===_0xeeab('0x14')&&typeof _0x2b7329[_0xeeab('0x15')]===_0xeeab('0x14');var _0x5a83b4=_0x8f3ece['count'];var _0x23de0e=_0x45dca1?0x0:_0x2b7329[_0xeeab('0x16')];var _0xa33ca8=_0x45dca1?_0x8f3ece['count']:_0x2b7329[_0xeeab('0x16')]+_0x2b7329[_0xeeab('0x15')];var _0x246ac6;if(_0xa33ca8>=_0x5a83b4){_0xa33ca8=_0x5a83b4;_0x246ac6=0xc8;}else{_0x246ac6=0xce;}_0x3a703a['status'](_0x246ac6);return _0x3a703a[_0xeeab('0x17')](_0xeeab('0x18'),_0x23de0e+'-'+_0xa33ca8+'/'+_0x5a83b4)[_0xeeab('0x13')](_0x8f3ece);}return null;};}function saveUpdates(_0x54d5aa){return function(_0x467938){if(_0x467938){return _0x467938[_0xeeab('0x19')](_0x54d5aa)[_0xeeab('0x1a')](function(_0x827383){return _0x827383;});}return null;};}function removeEntity(_0x361166){return function(_0x3c1cd7){if(_0x3c1cd7){return _0x3c1cd7[_0xeeab('0x1b')]()[_0xeeab('0x1a')](function(){_0x361166['status'](0xcc)[_0xeeab('0x1c')]();});}};}function handleEntityNotFound(_0x1fa0ca){return function(_0x24260f){if(!_0x24260f){_0x1fa0ca['sendStatus'](0x194);}return _0x24260f;};}function handleError(_0xb2d492,_0x42809c){_0x42809c=_0x42809c||0x1f4;return function(_0x163c18){logger['error'](_0x163c18['stack']);if(_0x163c18[_0xeeab('0x1d')]){delete _0x163c18[_0xeeab('0x1d')];}_0xb2d492[_0xeeab('0x12')](_0x42809c)[_0xeeab('0x1e')](_0x163c18);};}exports[_0xeeab('0x1f')]=function(_0x450181,_0x492a72){var _0x1334e6={};var _0xe9f01a=_[_0xeeab('0x20')](db[_0xeeab('0x21')][_0xeeab('0x22')],function(_0x3feb8e){return{'name':_0x3feb8e[_0xeeab('0x23')],'type':_0x3feb8e[_0xeeab('0x24')][_0xeeab('0x25')]};});_0x1334e6=qs[_0xeeab('0x26')](_0xe9f01a,_0x450181);return interaction[_0xeeab('0x27')](_0xeeab('0x28'),_0x450181[_0xeeab('0x29')],_0x450181['user'],_0x1334e6,_0xe9f01a)[_0xeeab('0x1a')](respondWithFilteredResult(_0x492a72,_0x1334e6))[_0xeeab('0x2a')](handleError(_0x492a72,null));};exports['show']=function(_0x4d6035,_0x4cad4b){var _0x577c2b={};if(_0x4d6035[_0xeeab('0x29')][_0xeeab('0x24')]&&_0x4d6035['query'][_0xeeab('0x24')]===_0xeeab('0x2b')){_0x577c2b[_0xeeab('0x2b')]=_0x4d6035[_0xeeab('0x2c')]['id'];}else{_0x577c2b['id']=_0x4d6035['params']['id'];}var _0xe9e449={'raw':![],'where':_0x577c2b},_0x51f9c8={};_0x51f9c8['model']=_[_0xeeab('0x2d')](db[_0xeeab('0x21')][_0xeeab('0x22')]);_0x51f9c8['query']=_[_0xeeab('0x2d')](_0x4d6035[_0xeeab('0x29')]);_0x51f9c8[_0xeeab('0x2e')]=_[_0xeeab('0x2f')](_0x51f9c8[_0xeeab('0x30')],_0x51f9c8[_0xeeab('0x29')]);_0xe9e449[_0xeeab('0x31')]=_['intersection'](_0x51f9c8[_0xeeab('0x30')],qs[_0xeeab('0x32')](_0x4d6035[_0xeeab('0x29')]['fields']));_0xe9e449[_0xeeab('0x31')]=_0xe9e449[_0xeeab('0x31')][_0xeeab('0x33')]?_0xe9e449['attributes']:_0x51f9c8[_0xeeab('0x30')];if(_0x4d6035['query']['includeAll']){_0xe9e449[_0xeeab('0x34')]=[{'all':!![]}];}_0xe9e449=_['merge']({},_0xe9e449,_0x4d6035[_0xeeab('0x35')]);return db[_0xeeab('0x21')][_0xeeab('0x36')](_0xe9e449)[_0xeeab('0x1a')](handleEntityNotFound(_0x4cad4b,null))['then'](respondWithResult(_0x4cad4b,null))[_0xeeab('0x2a')](handleError(_0x4cad4b,null));};exports[_0xeeab('0x37')]=function(_0x497bb5,_0x4311e1){return db[_0xeeab('0x21')][_0xeeab('0x37')](_0x497bb5[_0xeeab('0x38')],{})[_0xeeab('0x1a')](respondWithResult(_0x4311e1,0xc9))[_0xeeab('0x2a')](handleError(_0x4311e1,null));};exports[_0xeeab('0x19')]=function(_0x449709,_0x7e2ca){if(_0x449709[_0xeeab('0x38')]['id']){delete _0x449709[_0xeeab('0x38')]['id'];}return db[_0xeeab('0x21')][_0xeeab('0x36')]({'where':{'id':_0x449709[_0xeeab('0x2c')]['id']}})[_0xeeab('0x1a')](handleEntityNotFound(_0x7e2ca,null))[_0xeeab('0x1a')](saveUpdates(_0x449709['body'],null))['then'](respondWithResult(_0x7e2ca,null))[_0xeeab('0x2a')](handleError(_0x7e2ca,null));};exports['destroy']=function(_0x26cdc2,_0x3d56fa){return db['OpenchannelInteraction']['find']({'where':{'id':_0x26cdc2[_0xeeab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3d56fa,null))[_0xeeab('0x1a')](removeEntity(_0x3d56fa,null))[_0xeeab('0x2a')](handleError(_0x3d56fa,null));};exports[_0xeeab('0x39')]=function(_0x4b3c0f,_0x1bea8e){return db[_0xeeab('0x21')][_0xeeab('0x39')]()['then'](respondWithResult(_0x1bea8e,null))['catch'](handleError(_0x1bea8e,null));};exports['addMessage']=function(_0x5c52ec,_0x3e9489){return db[_0xeeab('0x3a')][_0xeeab('0x36')]({'where':{'id':_0x5c52ec[_0xeeab('0x2c')]['id']}})[_0xeeab('0x1a')](handleEntityNotFound(_0x3e9489,null))[_0xeeab('0x1a')](function(_0x512db1){if(_0x512db1){return _0x512db1['addMessage'](_0x5c52ec[_0xeeab('0x38')][_0xeeab('0x3b')],_['omit'](_0x5c52ec[_0xeeab('0x38')],['ids','id'])||{});}})[_0xeeab('0x1a')](respondWithResult(_0x3e9489,null))[_0xeeab('0x2a')](handleError(_0x3e9489,null));};exports[_0xeeab('0x3c')]=function(_0x2bc0ed,_0x3fb389){var _0x4205f7={'raw':![],'where':{}};var _0x4456b3={};var _0x501c4c={'count':0x0,'rows':[]};return db[_0xeeab('0x21')][_0xeeab('0x3d')]({'where':{'id':_0x2bc0ed[_0xeeab('0x2c')]['id']}})[_0xeeab('0x1a')](handleEntityNotFound(_0x3fb389,null))[_0xeeab('0x1a')](function(_0x36b3d1){if(_0x36b3d1){_0x4456b3[_0xeeab('0x30')]=_[_0xeeab('0x2d')](db[_0xeeab('0x3a')][_0xeeab('0x22')]);_0x4456b3[_0xeeab('0x29')]=_['keys'](_0x2bc0ed[_0xeeab('0x29')]);_0x4456b3[_0xeeab('0x2e')]=_[_0xeeab('0x2f')](_0x4456b3[_0xeeab('0x30')],_0x4456b3[_0xeeab('0x29')]);_0x4205f7[_0xeeab('0x31')]=_[_0xeeab('0x2f')](_0x4456b3[_0xeeab('0x30')],qs[_0xeeab('0x32')](_0x2bc0ed[_0xeeab('0x29')][_0xeeab('0x32')]));_0x4205f7[_0xeeab('0x31')]=_0x4205f7['attributes'][_0xeeab('0x33')]?_0x4205f7[_0xeeab('0x31')]:_0x4456b3[_0xeeab('0x30')];if(!_0x2bc0ed[_0xeeab('0x29')][_0xeeab('0x3e')](_0xeeab('0x3f'))){_0x4205f7[_0xeeab('0x15')]=qs[_0xeeab('0x15')](_0x2bc0ed[_0xeeab('0x29')][_0xeeab('0x15')]);_0x4205f7['offset']=qs[_0xeeab('0x16')](_0x2bc0ed['query']['offset']);}_0x4205f7[_0xeeab('0x40')]=qs[_0xeeab('0x41')](_0x2bc0ed[_0xeeab('0x29')]['sort']);_0x4205f7[_0xeeab('0x42')]=qs['filters'](_[_0xeeab('0x43')](_0x2bc0ed[_0xeeab('0x29')],_0x4456b3['filters']));_0x4205f7[_0xeeab('0x42')][_0xeeab('0x44')]=_0x36b3d1['id'];if(_0x2bc0ed[_0xeeab('0x29')]['filter']){_0x4205f7[_0xeeab('0x42')]=_[_0xeeab('0x45')](_0x4205f7[_0xeeab('0x42')],{'$or':_['map'](_0x4205f7[_0xeeab('0x31')],function(_0x433556){var _0x39eb5c={};_0x39eb5c[_0x433556]={'$like':'%'+_0x2bc0ed['query'][_0xeeab('0x46')]+'%'};return _0x39eb5c;})});}if(_0x2bc0ed[_0xeeab('0x29')][_0xeeab('0x47')]){var _0x15157f=_0x2bc0ed[_0xeeab('0x29')][_0xeeab('0x47')]['split'](',');var _0x4ba0e2={};_0x4ba0e2[_0x15157f[0x0]]={'$gte':moment(_0x15157f[0x1])[_0xeeab('0x48')](_0xeeab('0x49'))};_0x4205f7['where']=_[_0xeeab('0x45')](_0x4205f7[_0xeeab('0x42')],_0x4ba0e2);}_0x4205f7=_[_0xeeab('0x45')]({},_0x4205f7,_0x2bc0ed[_0xeeab('0x35')]);return db[_0xeeab('0x3a')][_0xeeab('0x4a')]({'where':_0x4205f7[_0xeeab('0x42')]})[_0xeeab('0x1a')](function(_0x39cc35){_0x501c4c[_0xeeab('0x4a')]=_0x39cc35;if(_0x2bc0ed['query'][_0xeeab('0x4b')]){_0x4205f7[_0xeeab('0x34')]=[{'all':!![]}];}return db[_0xeeab('0x3a')][_0xeeab('0x27')](_0x4205f7);})[_0xeeab('0x1a')](function(_0x5c8518){_0x501c4c[_0xeeab('0x4c')]=_0x5c8518;return _0x501c4c;});}})[_0xeeab('0x1a')](respondWithFilteredResult(_0x3fb389,_0x4205f7))['catch'](handleError(_0x3fb389,null));};exports[_0xeeab('0x4d')]=function(_0x2df58e,_0x3218aa){return db[_0xeeab('0x21')]['find']({'where':{'id':_0x2df58e[_0xeeab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3218aa,null))[_0xeeab('0x1a')](function(_0x363f0f){if(_0x363f0f){return _0x363f0f[_0xeeab('0x4e')](_0x2df58e['body']['ids'],_[_0xeeab('0x4f')](_0x2df58e['body'],['ids','id'])||{})[_0xeeab('0x50')](function(){return db[_0xeeab('0x51')][_0xeeab('0x27')]({'attributes':['id',_0xeeab('0x1d'),_0xeeab('0x52')],'where':{'id':_0x2df58e['body'][_0xeeab('0x3b')]}});})[_0xeeab('0x1a')](function(_0x45ecda){socket[_0xeeab('0x53')]('openchannelInteractionTags:save',{'id':Number(_0x2df58e[_0xeeab('0x2c')]['id']),'tags':_0x45ecda||[]});return{'id':Number(_0x2df58e['params']['id']),'tags':_0x45ecda||[]};});}})['then'](respondWithResult(_0x3218aa,null))[_0xeeab('0x2a')](handleError(_0x3218aa,null));};exports[_0xeeab('0x54')]=function(_0x8a3678,_0x4f4415){return db[_0xeeab('0x21')][_0xeeab('0x36')]({'where':{'id':_0x8a3678['params']['id']}})[_0xeeab('0x1a')](handleEntityNotFound(_0x4f4415,null))[_0xeeab('0x1a')](function(_0x3b8a57){if(_0x3b8a57){return _0x3b8a57['removeTags'](_0x8a3678[_0xeeab('0x29')]['ids']);}})['then'](respondWithStatusCode(_0x4f4415,null))[_0xeeab('0x2a')](handleError(_0x4f4415,null));};exports[_0xeeab('0x55')]=function(_0x3707b7,_0x17358c){var _0x33e20d=moment()[_0xeeab('0x56')]()[_0xeeab('0x57')]();var _0x4c1848=path[_0xeeab('0x58')](config[_0xeeab('0x59')],_0xeeab('0x5a'),'files',_0xeeab('0x5b'));var _0x22e971=path['join'](config['root'],_0xeeab('0x5a'),_0xeeab('0x5c'),_0xeeab('0x5d'));var _0x541189=path['join'](_0x4c1848,_0x33e20d);var _0x1064b4=util[_0xeeab('0x48')](_0xeeab('0x5e'),_0x3707b7[_0xeeab('0x2c')]['id'],_0x33e20d);var _0x29b4a6=path[_0xeeab('0x58')](_0x4c1848,_0x1064b4);var _0x570a07=[];_0x570a07[_0xeeab('0x5f')]({'model':db[_0xeeab('0x60')],'as':_0xeeab('0x60'),'attributes':['id',_0xeeab('0x61')],'raw':!![]});_0x570a07[_0xeeab('0x5f')]({'model':db['CmContact'],'as':_0xeeab('0x62'),'attributes':['id',_0xeeab('0x63'),'lastName'],'raw':!![]});if(_0x3707b7[_0xeeab('0x29')]['attachments']){_0x570a07[_0xeeab('0x5f')]({'model':db[_0xeeab('0x64')],'as':_0xeeab('0x64'),'raw':!![]});}var _0x9f17e5=[{'model':db[_0xeeab('0x3a')],'as':_0xeeab('0x65'),'attributes':['id','body',_0xeeab('0x66'),_0xeeab('0x67'),_0xeeab('0x68'),_0xeeab('0x69')],'include':_0x570a07}];_0x9f17e5[_0xeeab('0x5f')]({'model':db[_0xeeab('0x6a')],'as':'Account','attributes':['id',_0xeeab('0x1d')]});_0x9f17e5[_0xeeab('0x5f')]({'model':db[_0xeeab('0x60')],'as':'Owner','attributes':['id',_0xeeab('0x61')]});return db['OpenchannelInteraction'][_0xeeab('0x36')]({'where':{'id':_0x3707b7[_0xeeab('0x2c')]['id']},'include':_0x9f17e5})[_0xeeab('0x1a')](handleEntityNotFound(_0x17358c,null))['then'](function(_0x2d303a){if(_0x2d303a){var _0x1d75c8=_0x2d303a[_0xeeab('0x6b')]({'plain':!![]});fs[_0xeeab('0x6c')](_0x541189);var _0x6672f9={'channel':_0xeeab('0x6d'),'account':_0x1d75c8[_0xeeab('0x6e')][_0xeeab('0x1d')],'agent':_0x1d75c8[_0xeeab('0x6f')]?_0x1d75c8[_0xeeab('0x6f')][_0xeeab('0x61')]:'N.A.','createdAt':moment(_0x1d75c8[_0xeeab('0x66')])[_0xeeab('0x48')](_0xeeab('0x49'))[_0xeeab('0x57')](),'closedAt':_0x1d75c8[_0xeeab('0x70')]?moment(_0x1d75c8[_0xeeab('0x71')])[_0xeeab('0x48')](_0xeeab('0x49'))[_0xeeab('0x57')]():'','disposition':_0x1d75c8[_0xeeab('0x72')],'visibility':_0x1d75c8[_0xeeab('0x73')]?_0xeeab('0x74'):'Private','messages':_(_0x1d75c8[_0xeeab('0x65')])[_0xeeab('0x46')]({'secret':![]})[_0xeeab('0x20')](function(_0x5d9e4d){if(_0x5d9e4d[_0xeeab('0x64')]){var _0xa9b921=path[_0xeeab('0x58')](_0x22e971,_0x5d9e4d['Attachment'][_0xeeab('0x75')]);if(fs['existsSync'](_0xa9b921)){fs[_0xeeab('0x76')](_0xa9b921)[_0xeeab('0x77')](fs[_0xeeab('0x78')](path[_0xeeab('0x58')](_0x541189,_0x5d9e4d[_0xeeab('0x64')]['basename'])));}}return{'date':moment(_0x5d9e4d[_0xeeab('0x66')])[_0xeeab('0x48')](_0xeeab('0x49'))[_0xeeab('0x57')](),'sender':_0x5d9e4d[_0xeeab('0x67')]===_0xeeab('0x79')?_0x5d9e4d[_0xeeab('0x60')]?_0x5d9e4d[_0xeeab('0x60')][_0xeeab('0x61')]:'System':_0x5d9e4d[_0xeeab('0x62')][_0xeeab('0x63')]+(_0x5d9e4d[_0xeeab('0x62')][_0xeeab('0x7a')]?'\x20'+_0x5d9e4d[_0xeeab('0x62')][_0xeeab('0x7a')]:''),'body':_0x5d9e4d[_0xeeab('0x64')]?_0x5d9e4d[_0xeeab('0x64')][_0xeeab('0x75')]:_0x5d9e4d[_0xeeab('0x38')],'direction':_0x5d9e4d[_0xeeab('0x67')]===_0xeeab('0x79')?'A':'C','secret':_0x5d9e4d[_0xeeab('0x68')],'read':_0x5d9e4d[_0xeeab('0x69')],'attachment':_0x5d9e4d[_0xeeab('0x64')]};})[_0xeeab('0x7b')]()};return ejs[_0xeeab('0x7c')](path[_0xeeab('0x58')](config[_0xeeab('0x59')],'server',_0xeeab('0x7d'),_0xeeab('0x7e')),{'interaction':_0x6672f9})['then'](function(_0x583fa7){var _0x2ec38c=path[_0xeeab('0x58')](_0x541189,_0xeeab('0x7f')+_0x1d75c8['id']+'-'+_0x33e20d+'.pdf');var _0x48429a={'path':_0x2ec38c,'channel':_0xeeab('0x6d'),'interactionId':_0x1d75c8['id']};return pdf['createPdfFromHTML'](_0x583fa7,_0x48429a);})[_0xeeab('0x1a')](function(){return new Promise(function(_0xefa966,_0x4f20fe){zipdir(_0x541189,{'saveTo':_0x29b4a6},function(_0x5bb8fb,_0x45e01e){if(_0x5bb8fb)return _0x4f20fe(_0x5bb8fb);return _0xefa966(_0x45e01e);});})[_0xeeab('0x1a')](function(){return new Promise(function(_0x201ed4,_0x95a8d3){rimraf(_0x541189,function(_0x87f295){if(_0x87f295)_0x95a8d3(_0x87f295);return _0x201ed4();});});})[_0xeeab('0x1a')](function(){return _0x17358c[_0xeeab('0x55')](_0x29b4a6,_0x1064b4,function(_0x5ed3b4){if(_0x5ed3b4){logger[_0xeeab('0x80')](_0xeeab('0x81'),_0x5ed3b4);}else{fs[_0xeeab('0x82')](_0x29b4a6);}});});});}else{return _0x17358c[_0xeeab('0x11')](0xc8);}})['catch'](handleError(_0x17358c,null));}; \ No newline at end of file +var _0x112e=['include','merge','find','create','body','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','nolimit','order','sort','pick','where','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','tmp','join','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','N.A.','closed','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','firstName','value','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','params','keys','rawAttributes','filters','intersection','model','fields','attributes','length','includeAll'];(function(_0x561f36,_0x164a8b){var _0x526261=function(_0xe858db){while(--_0xe858db){_0x561f36['push'](_0x561f36['shift']());}};_0x526261(++_0x164a8b);}(_0x112e,0xca));var _0xe112=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x112e[_0x19b84f];return _0x18067b;};'use strict';var rimraf=require(_0xe112('0x0'));var zipdir=require(_0xe112('0x1'));var moment=require(_0xe112('0x2'));var util=require(_0xe112('0x3'));var path=require(_0xe112('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe112('0x5'));var Redis=require(_0xe112('0x6'));var interaction=require(_0xe112('0x7'));var qs=require(_0xe112('0x8'));var pdf=require(_0xe112('0x9'));var logger=require(_0xe112('0xa'))(_0xe112('0xb'));var config=require(_0xe112('0xc'));var db=require(_0xe112('0xd'))['db'];config[_0xe112('0xe')]=_[_0xe112('0xf')](config['redis'],{'host':_0xe112('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe112('0xe')]));require(_0xe112('0x11'))['register'](socket);function respondWithStatusCode(_0x40eda4,_0x50a794){_0x50a794=_0x50a794||0xcc;return function(_0x770fe7){if(_0x770fe7){return _0x40eda4[_0xe112('0x12')](_0x50a794);}return _0x40eda4[_0xe112('0x13')](_0x50a794)['end']();};}function respondWithResult(_0x369bb3,_0x2e1ed7){_0x2e1ed7=_0x2e1ed7||0xc8;return function(_0x16cf1a){if(_0x16cf1a){return _0x369bb3[_0xe112('0x13')](_0x2e1ed7)[_0xe112('0x14')](_0x16cf1a);}};}function respondWithFilteredResult(_0x3af760,_0x1701c9){return function(_0x25a235){if(_0x25a235){var _0x55638f=typeof _0x1701c9[_0xe112('0x15')]===_0xe112('0x16')&&typeof _0x1701c9['limit']===_0xe112('0x16');var _0x2270bd=_0x25a235[_0xe112('0x17')];var _0x4d437a=_0x55638f?0x0:_0x1701c9['offset'];var _0x5322fa=_0x55638f?_0x25a235[_0xe112('0x17')]:_0x1701c9[_0xe112('0x15')]+_0x1701c9[_0xe112('0x18')];var _0x35b5e4;if(_0x5322fa>=_0x2270bd){_0x5322fa=_0x2270bd;_0x35b5e4=0xc8;}else{_0x35b5e4=0xce;}_0x3af760[_0xe112('0x13')](_0x35b5e4);return _0x3af760[_0xe112('0x19')](_0xe112('0x1a'),_0x4d437a+'-'+_0x5322fa+'/'+_0x2270bd)[_0xe112('0x14')](_0x25a235);}return null;};}function saveUpdates(_0x43c354){return function(_0x47ff0e){if(_0x47ff0e){return _0x47ff0e[_0xe112('0x1b')](_0x43c354)[_0xe112('0x1c')](function(_0x286bb5){return _0x286bb5;});}return null;};}function removeEntity(_0x59b6a3){return function(_0x49408f){if(_0x49408f){return _0x49408f[_0xe112('0x1d')]()['then'](function(){_0x59b6a3['status'](0xcc)[_0xe112('0x1e')]();});}};}function handleEntityNotFound(_0x4ffcc7){return function(_0x2a845c){if(!_0x2a845c){_0x4ffcc7[_0xe112('0x12')](0x194);}return _0x2a845c;};}function handleError(_0x430316,_0xff1907){_0xff1907=_0xff1907||0x1f4;return function(_0x8cd7a9){logger[_0xe112('0x1f')](_0x8cd7a9[_0xe112('0x20')]);if(_0x8cd7a9[_0xe112('0x21')]){delete _0x8cd7a9[_0xe112('0x21')];}_0x430316[_0xe112('0x13')](_0xff1907)[_0xe112('0x22')](_0x8cd7a9);};}exports[_0xe112('0x23')]=function(_0x19e28a,_0x5a4bd9){var _0x4d7e9a={};var _0x2d5ca4=_[_0xe112('0x24')](db[_0xe112('0x25')]['rawAttributes'],function(_0x365241){return{'name':_0x365241[_0xe112('0x26')],'type':_0x365241[_0xe112('0x27')][_0xe112('0x28')]};});_0x4d7e9a=qs[_0xe112('0x29')](_0x2d5ca4,_0x19e28a);return interaction[_0xe112('0x2a')](_0xe112('0x2b'),_0x19e28a[_0xe112('0x2c')],_0x19e28a[_0xe112('0x2d')],_0x4d7e9a,_0x2d5ca4)[_0xe112('0x1c')](respondWithFilteredResult(_0x5a4bd9,_0x4d7e9a))[_0xe112('0x2e')](handleError(_0x5a4bd9,null));};exports[_0xe112('0x2f')]=function(_0x5c981d,_0x4cdcd8){var _0x5894c5={};if(_0x5c981d['query']['type']&&_0x5c981d['query'][_0xe112('0x27')]==='from'){_0x5894c5['from']=_0x5c981d[_0xe112('0x30')]['id'];}else{_0x5894c5['id']=_0x5c981d['params']['id'];}var _0x188653={'raw':![],'where':_0x5894c5},_0x18e067={};_0x18e067['model']=_[_0xe112('0x31')](db[_0xe112('0x25')][_0xe112('0x32')]);_0x18e067[_0xe112('0x2c')]=_['keys'](_0x5c981d[_0xe112('0x2c')]);_0x18e067[_0xe112('0x33')]=_[_0xe112('0x34')](_0x18e067[_0xe112('0x35')],_0x18e067[_0xe112('0x2c')]);_0x188653['attributes']=_['intersection'](_0x18e067[_0xe112('0x35')],qs[_0xe112('0x36')](_0x5c981d[_0xe112('0x2c')][_0xe112('0x36')]));_0x188653[_0xe112('0x37')]=_0x188653['attributes'][_0xe112('0x38')]?_0x188653['attributes']:_0x18e067[_0xe112('0x35')];if(_0x5c981d[_0xe112('0x2c')][_0xe112('0x39')]){_0x188653[_0xe112('0x3a')]=[{'all':!![]}];}_0x188653=_[_0xe112('0x3b')]({},_0x188653,_0x5c981d['options']);return db[_0xe112('0x25')][_0xe112('0x3c')](_0x188653)[_0xe112('0x1c')](handleEntityNotFound(_0x4cdcd8,null))['then'](respondWithResult(_0x4cdcd8,null))[_0xe112('0x2e')](handleError(_0x4cdcd8,null));};exports[_0xe112('0x3d')]=function(_0x43b66f,_0xeccf69){return db[_0xe112('0x25')]['create'](_0x43b66f[_0xe112('0x3e')],{})[_0xe112('0x1c')](respondWithResult(_0xeccf69,0xc9))[_0xe112('0x2e')](handleError(_0xeccf69,null));};exports[_0xe112('0x1b')]=function(_0x4766db,_0x10d3aa){if(_0x4766db['body']['id']){delete _0x4766db[_0xe112('0x3e')]['id'];}return db[_0xe112('0x25')][_0xe112('0x3c')]({'where':{'id':_0x4766db[_0xe112('0x30')]['id']}})['then'](handleEntityNotFound(_0x10d3aa,null))['then'](saveUpdates(_0x4766db[_0xe112('0x3e')],null))['then'](respondWithResult(_0x10d3aa,null))['catch'](handleError(_0x10d3aa,null));};exports[_0xe112('0x1d')]=function(_0xbab77,_0x4e4811){return db[_0xe112('0x25')]['find']({'where':{'id':_0xbab77[_0xe112('0x30')]['id']}})[_0xe112('0x1c')](handleEntityNotFound(_0x4e4811,null))[_0xe112('0x1c')](removeEntity(_0x4e4811,null))['catch'](handleError(_0x4e4811,null));};exports[_0xe112('0x3f')]=function(_0x4123ee,_0x4fbec3){return db[_0xe112('0x25')][_0xe112('0x3f')]()[_0xe112('0x1c')](respondWithResult(_0x4fbec3,null))[_0xe112('0x2e')](handleError(_0x4fbec3,null));};exports['addMessage']=function(_0x1032d4,_0x3c6b16){return db[_0xe112('0x40')][_0xe112('0x3c')]({'where':{'id':_0x1032d4[_0xe112('0x30')]['id']}})[_0xe112('0x1c')](handleEntityNotFound(_0x3c6b16,null))[_0xe112('0x1c')](function(_0x15e113){if(_0x15e113){return _0x15e113[_0xe112('0x41')](_0x1032d4[_0xe112('0x3e')][_0xe112('0x42')],_['omit'](_0x1032d4[_0xe112('0x3e')],[_0xe112('0x42'),'id'])||{});}})[_0xe112('0x1c')](respondWithResult(_0x3c6b16,null))[_0xe112('0x2e')](handleError(_0x3c6b16,null));};exports[_0xe112('0x43')]=function(_0x3a0a2f,_0x33a7b1){var _0x3d6c26={'raw':![],'where':{}};var _0x2051c4={};var _0x1bba4f={'count':0x0,'rows':[]};return db[_0xe112('0x25')][_0xe112('0x44')]({'where':{'id':_0x3a0a2f[_0xe112('0x30')]['id']}})[_0xe112('0x1c')](handleEntityNotFound(_0x33a7b1,null))[_0xe112('0x1c')](function(_0x36302e){if(_0x36302e){_0x2051c4[_0xe112('0x35')]=_[_0xe112('0x31')](db['OpenchannelMessage'][_0xe112('0x32')]);_0x2051c4[_0xe112('0x2c')]=_[_0xe112('0x31')](_0x3a0a2f['query']);_0x2051c4[_0xe112('0x33')]=_[_0xe112('0x34')](_0x2051c4[_0xe112('0x35')],_0x2051c4['query']);_0x3d6c26['attributes']=_[_0xe112('0x34')](_0x2051c4[_0xe112('0x35')],qs[_0xe112('0x36')](_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x36')]));_0x3d6c26[_0xe112('0x37')]=_0x3d6c26[_0xe112('0x37')]['length']?_0x3d6c26[_0xe112('0x37')]:_0x2051c4[_0xe112('0x35')];if(!_0x3a0a2f[_0xe112('0x2c')]['hasOwnProperty'](_0xe112('0x45'))){_0x3d6c26[_0xe112('0x18')]=qs[_0xe112('0x18')](_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x18')]);_0x3d6c26[_0xe112('0x15')]=qs[_0xe112('0x15')](_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x15')]);}_0x3d6c26[_0xe112('0x46')]=qs[_0xe112('0x47')](_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x47')]);_0x3d6c26['where']=qs[_0xe112('0x33')](_[_0xe112('0x48')](_0x3a0a2f['query'],_0x2051c4[_0xe112('0x33')]));_0x3d6c26[_0xe112('0x49')][_0xe112('0x4a')]=_0x36302e['id'];if(_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x4b')]){_0x3d6c26[_0xe112('0x49')]=_[_0xe112('0x3b')](_0x3d6c26['where'],{'$or':_['map'](_0x3d6c26[_0xe112('0x37')],function(_0x22eca0){var _0x3c2ea9={};_0x3c2ea9[_0x22eca0]={'$like':'%'+_0x3a0a2f['query'][_0xe112('0x4b')]+'%'};return _0x3c2ea9;})});}if(_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x4c')]){var _0x8ed265=_0x3a0a2f[_0xe112('0x2c')]['$gte']['split'](',');var _0xbad67={};_0xbad67[_0x8ed265[0x0]]={'$gte':moment(_0x8ed265[0x1])[_0xe112('0x4d')](_0xe112('0x4e'))};_0x3d6c26[_0xe112('0x49')]=_[_0xe112('0x3b')](_0x3d6c26['where'],_0xbad67);}_0x3d6c26=_['merge']({},_0x3d6c26,_0x3a0a2f[_0xe112('0x4f')]);return db[_0xe112('0x40')][_0xe112('0x17')]({'where':_0x3d6c26['where']})['then'](function(_0x263507){_0x1bba4f[_0xe112('0x17')]=_0x263507;if(_0x3a0a2f[_0xe112('0x2c')][_0xe112('0x39')]){_0x3d6c26['include']=[{'all':!![]}];}return db[_0xe112('0x40')][_0xe112('0x2a')](_0x3d6c26);})[_0xe112('0x1c')](function(_0x5c27bf){_0x1bba4f[_0xe112('0x50')]=_0x5c27bf;return _0x1bba4f;});}})['then'](respondWithFilteredResult(_0x33a7b1,_0x3d6c26))[_0xe112('0x2e')](handleError(_0x33a7b1,null));};exports['addTags']=function(_0x259768,_0x57f537){return db['OpenchannelInteraction'][_0xe112('0x3c')]({'where':{'id':_0x259768[_0xe112('0x30')]['id']}})[_0xe112('0x1c')](handleEntityNotFound(_0x57f537,null))[_0xe112('0x1c')](function(_0x3b95c6){if(_0x3b95c6){return _0x3b95c6['setTags'](_0x259768[_0xe112('0x3e')][_0xe112('0x42')],_['omit'](_0x259768[_0xe112('0x3e')],[_0xe112('0x42'),'id'])||{})[_0xe112('0x51')](function(){return db[_0xe112('0x52')][_0xe112('0x2a')]({'attributes':['id',_0xe112('0x21'),_0xe112('0x53')],'where':{'id':_0x259768['body'][_0xe112('0x42')]}});})[_0xe112('0x1c')](function(_0x54900c){socket[_0xe112('0x54')](_0xe112('0x55'),{'id':Number(_0x259768['params']['id']),'tags':_0x54900c||[]});return{'id':Number(_0x259768[_0xe112('0x30')]['id']),'tags':_0x54900c||[]};});}})[_0xe112('0x1c')](respondWithResult(_0x57f537,null))[_0xe112('0x2e')](handleError(_0x57f537,null));};exports[_0xe112('0x56')]=function(_0xe7bd73,_0x13b2d8){return db['OpenchannelInteraction'][_0xe112('0x3c')]({'where':{'id':_0xe7bd73['params']['id']}})[_0xe112('0x1c')](handleEntityNotFound(_0x13b2d8,null))[_0xe112('0x1c')](function(_0x2eb1ae){if(_0x2eb1ae){return _0x2eb1ae[_0xe112('0x56')](_0xe7bd73[_0xe112('0x2c')][_0xe112('0x42')]);}})[_0xe112('0x1c')](respondWithStatusCode(_0x13b2d8,null))[_0xe112('0x2e')](handleError(_0x13b2d8,null));};exports[_0xe112('0x57')]=function(_0x5b9f41,_0x44a602){var _0x259904=moment()[_0xe112('0x58')]()[_0xe112('0x59')]();var _0x4e8a60=path['join'](config[_0xe112('0x5a')],_0xe112('0x5b'),'files',_0xe112('0x5c'));var _0x504e8b=path[_0xe112('0x5d')](config[_0xe112('0x5a')],_0xe112('0x5b'),'files','attachments');var _0xe3d142=path[_0xe112('0x5d')](_0x4e8a60,_0x259904);var _0x25e776=util['format'](_0xe112('0x5e'),_0x5b9f41[_0xe112('0x30')]['id'],_0x259904);var _0x16c462=path[_0xe112('0x5d')](_0x4e8a60,_0x25e776);var _0x49b4bb=[];_0x49b4bb['push']({'model':db[_0xe112('0x5f')],'as':_0xe112('0x5f'),'attributes':['id',_0xe112('0x60')],'raw':!![]});_0x49b4bb[_0xe112('0x61')]({'model':db[_0xe112('0x62')],'as':_0xe112('0x63'),'attributes':['id','firstName',_0xe112('0x64')],'raw':!![]});if(_0x5b9f41['query']['attachments']){_0x49b4bb[_0xe112('0x61')]({'model':db['Attachment'],'as':_0xe112('0x65'),'raw':!![]});}var _0x3becb2=[{'model':db[_0xe112('0x40')],'as':_0xe112('0x66'),'attributes':['id',_0xe112('0x3e'),_0xe112('0x67'),'direction',_0xe112('0x68'),_0xe112('0x69')],'include':_0x49b4bb}];_0x3becb2['push']({'model':db[_0xe112('0x6a')],'as':'Account','attributes':['id','name']});_0x3becb2[_0xe112('0x61')]({'model':db[_0xe112('0x5f')],'as':'Owner','attributes':['id',_0xe112('0x60')]});return db[_0xe112('0x25')][_0xe112('0x3c')]({'where':{'id':_0x5b9f41[_0xe112('0x30')]['id']},'include':_0x3becb2})[_0xe112('0x1c')](handleEntityNotFound(_0x44a602,null))['then'](function(_0x731108){if(_0x731108){var _0x5726f5=_0x731108[_0xe112('0x6b')]({'plain':!![]});fs[_0xe112('0x6c')](_0xe3d142);var _0xab42a3={'channel':_0xe112('0x6d'),'account':_0x5726f5[_0xe112('0x6e')]['name'],'agent':_0x5726f5[_0xe112('0x6f')]?_0x5726f5['Owner'][_0xe112('0x60')]:_0xe112('0x70'),'createdAt':moment(_0x5726f5[_0xe112('0x67')])[_0xe112('0x4d')](_0xe112('0x4e'))[_0xe112('0x59')](),'closedAt':_0x5726f5[_0xe112('0x71')]?moment(_0x5726f5['closedAt'])[_0xe112('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe112('0x59')]():'','disposition':_0x5726f5[_0xe112('0x72')],'visibility':_0x5726f5[_0xe112('0x73')]?_0xe112('0x74'):_0xe112('0x75'),'messages':_(_0x5726f5[_0xe112('0x66')])['filter']({'secret':![]})[_0xe112('0x24')](function(_0x58dcd6){if(_0x58dcd6[_0xe112('0x65')]){var _0x3d934=path[_0xe112('0x5d')](_0x504e8b,_0x58dcd6[_0xe112('0x65')]['basename']);if(fs[_0xe112('0x76')](_0x3d934)){fs[_0xe112('0x77')](_0x3d934)[_0xe112('0x78')](fs[_0xe112('0x79')](path['join'](_0xe3d142,_0x58dcd6[_0xe112('0x65')][_0xe112('0x7a')])));}}return{'date':moment(_0x58dcd6['createdAt'])[_0xe112('0x4d')](_0xe112('0x4e'))[_0xe112('0x59')](),'sender':_0x58dcd6[_0xe112('0x7b')]===_0xe112('0x7c')?_0x58dcd6['User']?_0x58dcd6[_0xe112('0x5f')][_0xe112('0x60')]:'System':_0x58dcd6[_0xe112('0x63')][_0xe112('0x7d')]+(_0x58dcd6['Contact'][_0xe112('0x64')]?'\x20'+_0x58dcd6[_0xe112('0x63')][_0xe112('0x64')]:''),'body':_0x58dcd6['Attachment']?_0x58dcd6[_0xe112('0x65')][_0xe112('0x7a')]:_0x58dcd6['body'],'direction':_0x58dcd6[_0xe112('0x7b')]==='out'?'A':'C','secret':_0x58dcd6[_0xe112('0x68')],'read':_0x58dcd6[_0xe112('0x69')],'attachment':_0x58dcd6[_0xe112('0x65')]};})[_0xe112('0x7e')]()};return ejs['renderFile'](path[_0xe112('0x5d')](config[_0xe112('0x5a')],_0xe112('0x5b'),'views','downloadInteraction.ejs'),{'interaction':_0xab42a3})[_0xe112('0x1c')](function(_0x4c16f9){var _0x2a85eb=path[_0xe112('0x5d')](_0xe3d142,'transcript-'+_0x5726f5['id']+'-'+_0x259904+_0xe112('0x7f'));var _0x58fd4f={'path':_0x2a85eb,'channel':'Openchannel','interactionId':_0x5726f5['id']};return pdf[_0xe112('0x80')](_0x4c16f9,_0x58fd4f);})[_0xe112('0x1c')](function(){return new Promise(function(_0x56bb66,_0x4618cf){zipdir(_0xe3d142,{'saveTo':_0x16c462},function(_0xb01a0c,_0x18d90d){if(_0xb01a0c)return _0x4618cf(_0xb01a0c);return _0x56bb66(_0x18d90d);});})['then'](function(){return new Promise(function(_0x44d65f,_0x17390e){rimraf(_0xe3d142,function(_0x1e3ea3){if(_0x1e3ea3)_0x17390e(_0x1e3ea3);return _0x44d65f();});});})[_0xe112('0x1c')](function(){return _0x44a602[_0xe112('0x57')](_0x16c462,_0x25e776,function(_0x120093){if(_0x120093){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x120093);}else{fs[_0xe112('0x81')](_0x16c462);}});});});}else{return _0x44a602[_0xe112('0x12')](0xc8);}})[_0xe112('0x2e')](handleError(_0x44a602,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b405eae..c189c2a 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 _0xf56c=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0xf56c,0x105));var _0xcf56=function(_0x387442,_0x22cf1c){_0x387442=_0x387442-0x0;var _0x4def6d=_0xf56c[_0x387442];return _0x4def6d;};'use strict';var EventEmitter=require(_0xcf56('0x0'));var OpenchannelInteraction=require(_0xcf56('0x1'))['db'][_0xcf56('0x2')];var OpenchannelMessage=require(_0xcf56('0x1'))['db'][_0xcf56('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcf56('0x4')](0x0);var events={'afterCreate':_0xcf56('0x5'),'afterUpdate':_0xcf56('0x6'),'afterDestroy':_0xcf56('0x7')};function emitEvent(_0x2f11c2){return function(_0x308bb5,_0x15be70,_0xa20f48){_0x308bb5['getUsers']({'attributes':['id'],'raw':!![]})[_0xcf56('0x8')](function(_0x11db7f){_0x308bb5[_0xcf56('0x9')](_0xcf56('0xa'),_0x11db7f['map'](function(_0x5847c3){return{'id':_0x5847c3['id']};}));return OpenchannelMessage[_0xcf56('0xb')]({'where':{'OpenchannelInteractionId':_0x308bb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf56('0x8')](function(_0x78c730){_0x308bb5[_0xcf56('0x9')](_0xcf56('0xc'),_0x78c730['length']);OpenchannelInteractionEvents[_0xcf56('0xd')](_0x2f11c2+':'+_0x308bb5['id'],_0x308bb5);OpenchannelInteractionEvents['emit'](_0x2f11c2,_0x308bb5);_0xa20f48(null);})[_0xcf56('0xe')](_0xa20f48(null));};}for(var e in events){if(events[_0xcf56('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xcf56('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2cf8=['setMaxListeners','save','update','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','OpenchannelMessage'];(function(_0x5de818,_0x7c4485){var _0x345670=function(_0x5e268d){while(--_0x5e268d){_0x5de818['push'](_0x5de818['shift']());}};_0x345670(++_0x7c4485);}(_0x2cf8,0x7f));var _0x82cf=function(_0x272734,_0x5e33e4){_0x272734=_0x272734-0x0;var _0x1f7aa0=_0x2cf8[_0x272734];return _0x1f7aa0;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x82cf('0x0')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x82cf('0x1')](0x0);var events={'afterCreate':_0x82cf('0x2'),'afterUpdate':_0x82cf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x33d65e){return function(_0x2394ca,_0x13f0f3,_0x1f57dd){_0x2394ca[_0x82cf('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x196a7f){_0x2394ca[_0x82cf('0x5')](_0x82cf('0x6'),_0x196a7f['map'](function(_0x23acfa){return{'id':_0x23acfa['id']};}));return OpenchannelMessage[_0x82cf('0x7')]({'where':{'OpenchannelInteractionId':_0x2394ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82cf('0x8')](function(_0x12959a){_0x2394ca[_0x82cf('0x5')](_0x82cf('0x9'),_0x12959a[_0x82cf('0xa')]);OpenchannelInteractionEvents[_0x82cf('0xb')](_0x33d65e+':'+_0x2394ca['id'],_0x2394ca);OpenchannelInteractionEvents[_0x82cf('0xb')](_0x33d65e,_0x2394ca);_0x1f57dd(null);})[_0x82cf('0xc')](_0x1f57dd(null));};}for(var e in events){if(events[_0x82cf('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x82cf('0xe')](e,emitEvent(event));}}module[_0x82cf('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index bf18248..2b2ba46 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 _0xa796=['request-promise','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x2a7095,_0x2cc687){var _0x51d692=function(_0x39e463){while(--_0x39e463){_0x2a7095['push'](_0x2a7095['shift']());}};_0x51d692(++_0x2cc687);}(_0xa796,0x67));var _0x6a79=function(_0x2bdad8,_0x366a23){_0x2bdad8=_0x2bdad8-0x0;var _0x5a5447=_0xa796[_0x2bdad8];return _0x5a5447;};'use strict';var _=require('lodash');var util=require(_0x6a79('0x0'));var logger=require(_0x6a79('0x1'))(_0x6a79('0x2'));var moment=require(_0x6a79('0x3'));var BPromise=require(_0x6a79('0x4'));var rp=require(_0x6a79('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a79('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a79('0x7'));module[_0x6a79('0x8')]=function(_0x417b46,_0x4e05be){return _0x417b46[_0x6a79('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x6a79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a79('0xb'),'collate':_0x6a79('0xc'),'hooks':{'beforeUpdate':function(_0x1f2a9c,_0x3cd443,_0x3de1f9){if(_0x1f2a9c[_0x6a79('0xd')](_0x6a79('0xe'))){_0x1f2a9c[_0x6a79('0xf')]=moment()[_0x6a79('0x10')](_0x6a79('0x11'));}_0x3de1f9(null,_0x1f2a9c);}}});}; \ No newline at end of file +var _0xac03=['api','moment','bluebird','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xac03,0x6e));var _0x3ac0=function(_0x11c06e,_0x1cb9c7){_0x11c06e=_0x11c06e-0x0;var _0x20a7dc=_0xac03[_0x11c06e];return _0x20a7dc;};'use strict';var _=require(_0x3ac0('0x0'));var util=require(_0x3ac0('0x1'));var logger=require('../../config/logger')(_0x3ac0('0x2'));var moment=require(_0x3ac0('0x3'));var BPromise=require(_0x3ac0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3ac0('0x5'));var attributes=require(_0x3ac0('0x6'));module[_0x3ac0('0x7')]=function(_0x1036ec,_0x2e8317){return _0x1036ec[_0x3ac0('0x8')](_0x3ac0('0x9'),attributes,{'tableName':_0x3ac0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3ac0('0xb'),'collate':_0x3ac0('0xc'),'hooks':{'beforeUpdate':function(_0x3afdb1,_0x4f6121,_0xf162d5){if(_0x3afdb1['changed']('closed')){_0x3afdb1[_0x3ac0('0xd')]=moment()[_0x3ac0('0xe')](_0x3ac0('0xf'));}_0xf162d5(null,_0x3afdb1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 075a739..bbaff98 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 _0x7cbe=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','body','options','raw','where','attributes','catch','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7cbe,0xb3));var _0xe7cb=function(_0x4eba6f,_0x242d1e){_0x4eba6f=_0x4eba6f-0x0;var _0x3815e7=_0x7cbe[_0x4eba6f];return _0x3815e7;};'use strict';var _=require(_0xe7cb('0x0'));var util=require('util');var moment=require(_0xe7cb('0x1'));var BPromise=require(_0xe7cb('0x2'));var rs=require(_0xe7cb('0x3'));var fs=require('fs');var Redis=require(_0xe7cb('0x4'));var db=require(_0xe7cb('0x5'))['db'];var utils=require(_0xe7cb('0x6'));var logger=require('../../config/logger')(_0xe7cb('0x7'));var config=require(_0xe7cb('0x8'));var jayson=require(_0xe7cb('0x9'));var client=jayson['client'][_0xe7cb('0xa')]({'port':0x232a});config[_0xe7cb('0xb')]=_[_0xe7cb('0xc')](config[_0xe7cb('0xb')],{'host':_0xe7cb('0xd'),'port':0x18eb});var socket=require(_0xe7cb('0xe'))(new Redis(config[_0xe7cb('0xb')]));require(_0xe7cb('0xf'))[_0xe7cb('0x10')](socket);function respondWithRpcPromise(_0x2e00b4,_0x1bef88,_0x55e178){return new BPromise(function(_0x309f59,_0x5e4880){return client['request'](_0x2e00b4,_0x55e178)[_0xe7cb('0x11')](function(_0x262193){logger[_0xe7cb('0x12')](_0xe7cb('0x13'),_0x1bef88,_0xe7cb('0x14'));logger['debug'](_0xe7cb('0x15'),_0x1bef88,_0xe7cb('0x14'),JSON[_0xe7cb('0x16')](_0x262193));if(_0x262193[_0xe7cb('0x17')]){if(_0x262193['error'][_0xe7cb('0x18')]===0x1f4){logger['error'](_0xe7cb('0x13'),_0x1bef88,_0x262193[_0xe7cb('0x17')][_0xe7cb('0x19')]);return _0x5e4880(_0x262193['error'][_0xe7cb('0x19')]);}logger[_0xe7cb('0x17')](_0xe7cb('0x13'),_0x1bef88,_0x262193[_0xe7cb('0x17')]['message']);return _0x309f59(_0x262193['error'][_0xe7cb('0x19')]);}else{logger[_0xe7cb('0x12')](_0xe7cb('0x13'),_0x1bef88,_0xe7cb('0x14'));_0x309f59(_0x262193[_0xe7cb('0x1a')][_0xe7cb('0x19')]);}})['catch'](function(_0x4e9a3e){logger[_0xe7cb('0x17')](_0xe7cb('0x13'),_0x1bef88,_0x4e9a3e);_0x5e4880(_0x4e9a3e);});});}exports[_0xe7cb('0x1b')]=function(_0x7ae6e8){var _0x4b8c0b=this;return new Promise(function(_0x1b66ca,_0x396fb5){return db['OpenchannelInteraction']['update'](_0x7ae6e8[_0xe7cb('0x1c')],{'raw':_0x7ae6e8[_0xe7cb('0x1d')]?_0x7ae6e8[_0xe7cb('0x1d')][_0xe7cb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ae6e8[_0xe7cb('0x1d')]?_0x7ae6e8['options'][_0xe7cb('0x1f')]||null:null,'attributes':_0x7ae6e8['options']?_0x7ae6e8[_0xe7cb('0x1d')][_0xe7cb('0x20')]||null:null,'limit':_0x7ae6e8[_0xe7cb('0x1d')]?_0x7ae6e8[_0xe7cb('0x1d')]['limit']||null:null})[_0xe7cb('0x11')](function(_0x33ca4a){logger[_0xe7cb('0x12')]('UpdateOpenchannelInteraction',_0x7ae6e8);logger['debug'](_0xe7cb('0x1b'),_0x7ae6e8,JSON['stringify'](_0x33ca4a));_0x1b66ca(_0x33ca4a);})[_0xe7cb('0x21')](function(_0x132f5f){logger[_0xe7cb('0x17')](_0xe7cb('0x1b'),_0x132f5f[_0xe7cb('0x19')],_0x7ae6e8);_0x396fb5(_0x4b8c0b[_0xe7cb('0x17')](0x1f4,_0x132f5f[_0xe7cb('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3f46ec){return new Promise(function(_0x494305,_0x5d7b74){return db['OpenchannelInteraction'][_0xe7cb('0x22')]({'where':_0x3f46ec[_0xe7cb('0x1d')]?_0x3f46ec[_0xe7cb('0x1d')][_0xe7cb('0x1f')]||null:null})[_0xe7cb('0x11')](function(_0x3a5b5c){if(_0x3a5b5c){return _0x3a5b5c[_0xe7cb('0x23')](_0x3f46ec['body'][_0xe7cb('0x24')],_[_0xe7cb('0x25')](_0x3f46ec[_0xe7cb('0x1c')],[_0xe7cb('0x24'),'id'])||{});}})[_0xe7cb('0x26')](function(_0x120fb6){logger['info'](_0xe7cb('0x27'),_0x3f46ec);logger['debug'](_0xe7cb('0x27'),_0x3f46ec,JSON[_0xe7cb('0x16')](_0x120fb6));_0x494305(_0x120fb6);})['catch'](function(_0x1dde1a){logger[_0xe7cb('0x17')](_0xe7cb('0x27'),_0x1dde1a['message'],_0x3f46ec);_0x5d7b74(_this[_0xe7cb('0x17')](0x1f4,_0x1dde1a['message']));});});}; \ No newline at end of file +var _0x0885=['AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','AddTags','stringify','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','info','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0885,0x1dc));var _0x5088=function(_0x53758c,_0x3f5260){_0x53758c=_0x53758c-0x0;var _0x297de2=_0x0885[_0x53758c];return _0x297de2;};'use strict';var _=require(_0x5088('0x0'));var util=require(_0x5088('0x1'));var moment=require(_0x5088('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5088('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5088('0x4'))(_0x5088('0x5'));var config=require(_0x5088('0x6'));var jayson=require(_0x5088('0x7'));var client=jayson[_0x5088('0x8')][_0x5088('0x9')]({'port':0x232a});config[_0x5088('0xa')]=_['defaults'](config[_0x5088('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5088('0xb'))[_0x5088('0xc')](socket);function respondWithRpcPromise(_0x3258ca,_0x3c2dfe,_0x4729c9){return new BPromise(function(_0x547159,_0x514a96){return client[_0x5088('0xd')](_0x3258ca,_0x4729c9)[_0x5088('0xe')](function(_0x5a1cc6){logger['info'](_0x5088('0xf'),_0x3c2dfe,_0x5088('0x10'));logger[_0x5088('0x11')](_0x5088('0x12'),_0x3c2dfe,_0x5088('0x10'),JSON['stringify'](_0x5a1cc6));if(_0x5a1cc6[_0x5088('0x13')]){if(_0x5a1cc6[_0x5088('0x13')]['code']===0x1f4){logger[_0x5088('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c2dfe,_0x5a1cc6[_0x5088('0x13')][_0x5088('0x14')]);return _0x514a96(_0x5a1cc6[_0x5088('0x13')]['message']);}logger[_0x5088('0x13')](_0x5088('0xf'),_0x3c2dfe,_0x5a1cc6[_0x5088('0x13')][_0x5088('0x14')]);return _0x547159(_0x5a1cc6['error'][_0x5088('0x14')]);}else{logger[_0x5088('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c2dfe,_0x5088('0x10'));_0x547159(_0x5a1cc6['result'][_0x5088('0x14')]);}})[_0x5088('0x16')](function(_0x392082){logger[_0x5088('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c2dfe,_0x392082);_0x514a96(_0x392082);});});}exports['UpdateOpenchannelInteraction']=function(_0x1487dd){var _0x474d0d=this;return new Promise(function(_0x49841c,_0x3f9915){return db[_0x5088('0x17')][_0x5088('0x18')](_0x1487dd['body'],{'raw':_0x1487dd[_0x5088('0x19')]?_0x1487dd['options'][_0x5088('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1487dd[_0x5088('0x19')]?_0x1487dd[_0x5088('0x19')][_0x5088('0x1b')]||null:null,'attributes':_0x1487dd[_0x5088('0x19')]?_0x1487dd[_0x5088('0x19')][_0x5088('0x1c')]||null:null,'limit':_0x1487dd[_0x5088('0x19')]?_0x1487dd[_0x5088('0x19')][_0x5088('0x1d')]||null:null})[_0x5088('0xe')](function(_0x137cdd){logger[_0x5088('0x15')](_0x5088('0x1e'),_0x1487dd);logger['debug']('UpdateOpenchannelInteraction',_0x1487dd,JSON['stringify'](_0x137cdd));_0x49841c(_0x137cdd);})[_0x5088('0x16')](function(_0x25d8be){logger[_0x5088('0x13')]('UpdateOpenchannelInteraction',_0x25d8be[_0x5088('0x14')],_0x1487dd);_0x3f9915(_0x474d0d[_0x5088('0x13')](0x1f4,_0x25d8be[_0x5088('0x14')]));});});};exports[_0x5088('0x1f')]=function(_0x6dd271){return new Promise(function(_0x3f1fb1,_0x12d448){return db[_0x5088('0x17')][_0x5088('0x20')]({'where':_0x6dd271[_0x5088('0x19')]?_0x6dd271[_0x5088('0x19')][_0x5088('0x1b')]||null:null})[_0x5088('0xe')](function(_0x4cd7af){if(_0x4cd7af){return _0x4cd7af[_0x5088('0x21')](_0x6dd271[_0x5088('0x22')][_0x5088('0x23')],_[_0x5088('0x24')](_0x6dd271[_0x5088('0x22')],[_0x5088('0x23'),'id'])||{});}})['spread'](function(_0x99ce9f){logger[_0x5088('0x15')](_0x5088('0x25'),_0x6dd271);logger[_0x5088('0x11')](_0x5088('0x25'),_0x6dd271,JSON[_0x5088('0x26')](_0x99ce9f));_0x3f1fb1(_0x99ce9f);})[_0x5088('0x16')](function(_0x4ffa94){logger[_0x5088('0x13')](_0x5088('0x25'),_0x4ffa94[_0x5088('0x14')],_0x6dd271);_0x12d448(_this[_0x5088('0x13')](0x1f4,_0x4ffa94[_0x5088('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c28e372..a6746a9 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 _0xa724=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x5b9770,_0x14df6a){var _0x196a8b=function(_0x28d243){while(--_0x28d243){_0x5b9770['push'](_0x5b9770['shift']());}};_0x196a8b(++_0x14df6a);}(_0xa724,0x1ec));var _0x4a72=function(_0x446ce8,_0x429d42){_0x446ce8=_0x446ce8-0x0;var _0x293492=_0xa724[_0x446ce8];return _0x293492;};'use strict';var OpenchannelInteractionEvents=require(_0x4a72('0x0'));var events=[_0x4a72('0x1'),_0x4a72('0x2'),_0x4a72('0x3')];function createListener(_0x5d1b51,_0x24de37){return function(_0x470cbb){_0x24de37[_0x4a72('0x4')](_0x5d1b51,_0x470cbb);};}function removeListener(_0x3726c6,_0x351b47){return function(){OpenchannelInteractionEvents[_0x4a72('0x5')](_0x3726c6,_0x351b47);};}exports[_0x4a72('0x6')]=function(_0x4be45f){for(var _0x1a3012=0x0,_0x3819bc=events[_0x4a72('0x7')];_0x1a3012<_0x3819bc;_0x1a3012++){var _0x1c33d0=events[_0x1a3012];var _0x3d84a9=createListener(_0x4a72('0x8')+_0x1c33d0,_0x4be45f);OpenchannelInteractionEvents['on'](_0x1c33d0,_0x3d84a9);}}; \ No newline at end of file +var _0x10dd=['update','register','length','./openchannelInteraction.events','save'];(function(_0x3339bd,_0x1ba6a8){var _0x725e64=function(_0x34ce8d){while(--_0x34ce8d){_0x3339bd['push'](_0x3339bd['shift']());}};_0x725e64(++_0x1ba6a8);}(_0x10dd,0xc6));var _0xd10d=function(_0x3db33f,_0x56ce5b){_0x3db33f=_0x3db33f-0x0;var _0xf413f9=_0x10dd[_0x3db33f];return _0xf413f9;};'use strict';var OpenchannelInteractionEvents=require(_0xd10d('0x0'));var events=[_0xd10d('0x1'),'remove',_0xd10d('0x2')];function createListener(_0x58b0e3,_0x281c57){return function(_0x525e9d){_0x281c57['emit'](_0x58b0e3,_0x525e9d);};}function removeListener(_0x30d42b,_0x4966f8){return function(){OpenchannelInteractionEvents['removeListener'](_0x30d42b,_0x4966f8);};}exports[_0xd10d('0x3')]=function(_0x51bec8){for(var _0xc76e8a=0x0,_0x196bde=events[_0xd10d('0x4')];_0xc76e8a<_0x196bde;_0xc76e8a++){var _0x1c6375=events[_0xc76e8a];var _0x539f21=createListener('openchannelInteraction:'+_0x1c6375,_0x51bec8);OpenchannelInteractionEvents['on'](_0x1c6375,_0x539f21);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1bff0bc..a9fb9fc 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3a8049,_0x508772){var _0x27800b=function(_0x59fde1){while(--_0x59fde1){_0x3a8049['push'](_0x3a8049['shift']());}};_0x27800b(++_0x508772);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4985661..9c64221 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 _0xd4a2=['sequelize','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x577f26,_0x3c58c2){_0x577f26=_0x577f26-0x0;var _0x1b1d52=_0xd4a2[_0x577f26];return _0x1b1d52;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d4a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d4a('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2d4a('0x4')]},'providerName':{'type':Sequelize[_0x2d4a('0x5')]},'providerResponse':{'type':Sequelize[_0x2d4a('0x6')]}}; \ No newline at end of file +var _0x47d6=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1d3242,_0x480f2e){var _0x2c1f3f=function(_0x300a0d){while(--_0x300a0d){_0x1d3242['push'](_0x1d3242['shift']());}};_0x2c1f3f(++_0x480f2e);}(_0x47d6,0x13f));var _0x647d=function(_0x1da660,_0x3b8b06){_0x1da660=_0x1da660-0x0;var _0xddf1ab=_0x47d6[_0x1da660];return _0xddf1ab;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'body':{'type':Sequelize[_0x647d('0x2')](_0x647d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x647d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x647d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x647d('0x5')]('in',_0x647d('0x6')),'defaultValue':_0x647d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x647d('0x7')]},'providerName':{'type':Sequelize[_0x647d('0x8')]},'providerResponse':{'type':Sequelize[_0x647d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a5acd3c..8ab0b29 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 _0x142f=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','show','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','internal','manual','SIP/%s','channel','event','EventManager','RejectMessage','sequelize','SELECT','User','email','interface','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','then','destroy','sendStatus','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x52e101,_0x308802){var _0x5ac202=function(_0x2948b2){while(--_0x2948b2){_0x52e101['push'](_0x52e101['shift']());}};_0x5ac202(++_0x308802);}(_0x142f,0x136));var _0xf142=function(_0x313fb7,_0xde30fb){_0x313fb7=_0x313fb7-0x0;var _0x358b83=_0x142f[_0x313fb7];return _0x358b83;};'use strict';var emlformat=require(_0xf142('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf142('0x1'));var rp=require(_0xf142('0x2'));var moment=require(_0xf142('0x3'));var BPromise=require(_0xf142('0x4'));var Mustache=require(_0xf142('0x5'));var util=require(_0xf142('0x6'));var path=require(_0xf142('0x7'));var sox=require(_0xf142('0x8'));var csv=require(_0xf142('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf142('0xa'));var _=require(_0xf142('0xb'));var squel=require(_0xf142('0xc'));var crypto=require('crypto');var jsforce=require(_0xf142('0xd'));var deskjs=require(_0xf142('0xe'));var toCsv=require(_0xf142('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf142('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf142('0x10'));var as=require(_0xf142('0x11'));var hardwareService=require(_0xf142('0x12'));var logger=require(_0xf142('0x13'))(_0xf142('0x14'));var utils=require('../../config/utils');var config=require(_0xf142('0x15'));var licenseUtil=require(_0xf142('0x16'));var db=require(_0xf142('0x17'))['db'];config['redis']=_[_0xf142('0x18')](config['redis'],{'host':_0xf142('0x19'),'port':0x18eb});var socket=require(_0xf142('0x1a'))(new Redis(config[_0xf142('0x1b')]));require(_0xf142('0x1c'))['register'](socket);var jayson=require(_0xf142('0x1d'));var client=jayson[_0xf142('0x1e')][_0xf142('0x1f')]({'port':0x232c});var client9002=jayson[_0xf142('0x1e')][_0xf142('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1bc407,_0x5b907e,_0x23844d,_0x438d9d){return new BPromise(function(_0x57ed2e,_0x133de1){var _0x2b677a=_0x438d9d||client;return _0x2b677a[_0xf142('0x20')](_0x1bc407,_0x23844d)['then'](function(_0x1c02f5){logger[_0xf142('0x21')](_0xf142('0x22'),_0x5b907e,_0xf142('0x23'));logger[_0xf142('0x24')](_0xf142('0x25'),_0x5b907e,_0xf142('0x23'),JSON['stringify'](_0x1c02f5));if(_0x1c02f5[_0xf142('0x26')]){if(_0x1c02f5[_0xf142('0x26')][_0xf142('0x27')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x5b907e,_0x1c02f5[_0xf142('0x26')]['message']);return _0x133de1(_0x1c02f5[_0xf142('0x26')]['message']);}logger[_0xf142('0x26')](_0xf142('0x22'),_0x5b907e,_0x1c02f5[_0xf142('0x26')]['message']);return _0x57ed2e(_0x1c02f5['error']['message']);}else{logger[_0xf142('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b907e,_0xf142('0x23'));_0x57ed2e(_0x1c02f5['result'][_0xf142('0x28')]);}})[_0xf142('0x29')](function(_0x53d75d){logger[_0xf142('0x26')](_0xf142('0x22'),_0x5b907e,_0x53d75d);_0x133de1(_0x53d75d);});});}function respondWithStatusCode(_0x22a39e,_0x68dc73){_0x68dc73=_0x68dc73||0xcc;return function(_0x151ee7){if(_0x151ee7){return _0x22a39e['sendStatus'](_0x68dc73);}return _0x22a39e[_0xf142('0x2a')](_0x68dc73)[_0xf142('0x2b')]();};}function respondWithResult(_0x5b6193,_0x45ad07){_0x45ad07=_0x45ad07||0xc8;return function(_0x3b192a){if(_0x3b192a){return _0x5b6193['status'](_0x45ad07)['json'](_0x3b192a);}};}function respondWithFilteredResult(_0x3da9e9,_0x219e93){return function(_0x481b76){if(_0x481b76){var _0x2dad80=typeof _0x219e93[_0xf142('0x2c')]==='undefined'&&typeof _0x219e93[_0xf142('0x2d')]===_0xf142('0x2e');var _0x3d4a13=_0x481b76['count'];var _0x4500e0=_0x2dad80?0x0:_0x219e93[_0xf142('0x2c')];var _0x193d83=_0x2dad80?_0x481b76[_0xf142('0x2f')]:_0x219e93['offset']+_0x219e93[_0xf142('0x2d')];var _0xbdf83e;if(_0x193d83>=_0x3d4a13){_0x193d83=_0x3d4a13;_0xbdf83e=0xc8;}else{_0xbdf83e=0xce;}_0x3da9e9[_0xf142('0x2a')](_0xbdf83e);return _0x3da9e9[_0xf142('0x30')](_0xf142('0x31'),_0x4500e0+'-'+_0x193d83+'/'+_0x3d4a13)[_0xf142('0x32')](_0x481b76);}return null;};}function patchUpdates(_0x1dd818){return function(_0x3973d0){try{jsonpatch[_0xf142('0x33')](_0x3973d0,_0x1dd818,!![]);}catch(_0x5bf1e9){return BPromise[_0xf142('0x34')](_0x5bf1e9);}return _0x3973d0['save']();};}function saveUpdates(_0x329653,_0x565670){return function(_0x2c41e9){if(_0x2c41e9){return _0x2c41e9['update'](_0x329653)[_0xf142('0x35')](function(_0x4a41f6){return _0x4a41f6;});}return null;};}function removeEntity(_0xe85913,_0x4e5a5e){return function(_0x58d7ad){if(_0x58d7ad){return _0x58d7ad[_0xf142('0x36')]()[_0xf142('0x35')](function(){_0xe85913[_0xf142('0x2a')](0xcc)[_0xf142('0x2b')]();});}};}function handleEntityNotFound(_0x2dbc77,_0x14381e){return function(_0x8cb6cf){if(!_0x8cb6cf){_0x2dbc77[_0xf142('0x37')](0x194);}return _0x8cb6cf;};}function handleError(_0x35f39f,_0x1b3951){_0x1b3951=_0x1b3951||0x1f4;return function(_0x29122b){logger[_0xf142('0x26')](_0x29122b['stack']);if(_0x29122b[_0xf142('0x38')]){delete _0x29122b['name'];}_0x35f39f[_0xf142('0x2a')](_0x1b3951)['send'](_0x29122b);};}exports[_0xf142('0x39')]=function(_0x5aaffe,_0x5f239d){var _0x4fbd8b={},_0x33a4b2={},_0x149d6c={'count':0x0,'rows':[]};var _0x39b228=_['map'](db['OpenchannelMessage'][_0xf142('0x3a')],function(_0x375712){return{'name':_0x375712['fieldName'],'type':_0x375712['type'][_0xf142('0x3b')]};});_0x33a4b2[_0xf142('0x3c')]=_[_0xf142('0x3d')](_0x39b228,_0xf142('0x38'));_0x33a4b2[_0xf142('0x3e')]=_[_0xf142('0x3f')](_0x5aaffe[_0xf142('0x3e')]);_0x33a4b2[_0xf142('0x40')]=_[_0xf142('0x41')](_0x33a4b2['model'],_0x33a4b2[_0xf142('0x3e')]);_0x4fbd8b['attributes']=_['intersection'](_0x33a4b2['model'],qs[_0xf142('0x42')](_0x5aaffe[_0xf142('0x3e')][_0xf142('0x42')]));_0x4fbd8b[_0xf142('0x43')]=_0x4fbd8b['attributes'][_0xf142('0x44')]?_0x4fbd8b[_0xf142('0x43')]:_0x33a4b2[_0xf142('0x3c')];if(!_0x5aaffe['query']['hasOwnProperty'](_0xf142('0x45'))){_0x4fbd8b[_0xf142('0x2d')]=qs[_0xf142('0x2d')](_0x5aaffe['query']['limit']);_0x4fbd8b[_0xf142('0x2c')]=qs[_0xf142('0x2c')](_0x5aaffe[_0xf142('0x3e')][_0xf142('0x2c')]);}_0x4fbd8b[_0xf142('0x46')]=qs[_0xf142('0x47')](_0x5aaffe[_0xf142('0x3e')][_0xf142('0x47')]);_0x4fbd8b[_0xf142('0x48')]=qs[_0xf142('0x40')](_[_0xf142('0x49')](_0x5aaffe['query'],_0x33a4b2[_0xf142('0x40')]),_0x39b228);if(_0x5aaffe['query'][_0xf142('0x4a')]){_0x4fbd8b[_0xf142('0x48')]=_[_0xf142('0x4b')](_0x4fbd8b[_0xf142('0x48')],{'$or':_['map'](_0x39b228,function(_0x7fc38){if(_0x7fc38['type']!==_0xf142('0x4c')){var _0x1d169e={};_0x1d169e[_0x7fc38[_0xf142('0x38')]]={'$like':'%'+_0x5aaffe[_0xf142('0x3e')][_0xf142('0x4a')]+'%'};return _0x1d169e;}})});}_0x4fbd8b=_[_0xf142('0x4b')]({},_0x4fbd8b,_0x5aaffe['options']);var _0x314b10={'where':_0x4fbd8b['where']};return db[_0xf142('0x4d')][_0xf142('0x2f')](_0x314b10)['then'](function(_0xd35afd){_0x149d6c['count']=_0xd35afd;if(_0x5aaffe[_0xf142('0x3e')][_0xf142('0x4e')]){_0x4fbd8b[_0xf142('0x4f')]=[{'all':!![]}];}return db[_0xf142('0x4d')][_0xf142('0x50')](_0x4fbd8b);})[_0xf142('0x35')](function(_0x12997e){_0x149d6c['rows']=_0x12997e;return _0x149d6c;})['then'](respondWithFilteredResult(_0x5f239d,_0x4fbd8b))[_0xf142('0x29')](handleError(_0x5f239d,null));};exports[_0xf142('0x51')]=function(_0x590ec7,_0x134ec1){var _0x27ec71={'raw':!![],'where':{'id':_0x590ec7['params']['id']}},_0x1e1d6d={};_0x1e1d6d[_0xf142('0x3c')]=_[_0xf142('0x3f')](db[_0xf142('0x4d')]['rawAttributes']);_0x1e1d6d['query']=_[_0xf142('0x3f')](_0x590ec7[_0xf142('0x3e')]);_0x1e1d6d[_0xf142('0x40')]=_[_0xf142('0x41')](_0x1e1d6d[_0xf142('0x3c')],_0x1e1d6d[_0xf142('0x3e')]);_0x27ec71[_0xf142('0x43')]=_[_0xf142('0x41')](_0x1e1d6d[_0xf142('0x3c')],qs[_0xf142('0x42')](_0x590ec7[_0xf142('0x3e')][_0xf142('0x42')]));_0x27ec71[_0xf142('0x43')]=_0x27ec71['attributes']['length']?_0x27ec71[_0xf142('0x43')]:_0x1e1d6d[_0xf142('0x3c')];if(_0x590ec7[_0xf142('0x3e')][_0xf142('0x4e')]){_0x27ec71[_0xf142('0x4f')]=[{'all':!![]}];}_0x27ec71=_[_0xf142('0x4b')]({},_0x27ec71,_0x590ec7['options']);return db[_0xf142('0x4d')][_0xf142('0x52')](_0x27ec71)[_0xf142('0x35')](handleEntityNotFound(_0x134ec1,null))[_0xf142('0x35')](respondWithResult(_0x134ec1,null))[_0xf142('0x29')](handleError(_0x134ec1,null));};exports[_0xf142('0x53')]=function(_0x1958ff,_0x3e5695){return db[_0xf142('0x4d')][_0xf142('0x53')](_0x1958ff[_0xf142('0x54')],{})[_0xf142('0x35')](respondWithResult(_0x3e5695,0xc9))[_0xf142('0x29')](handleError(_0x3e5695,null));};exports[_0xf142('0x55')]=function(_0x1a07ff,_0x2c668a){if(_0x1a07ff[_0xf142('0x54')]['id']){delete _0x1a07ff[_0xf142('0x54')]['id'];}return db[_0xf142('0x4d')][_0xf142('0x52')]({'where':{'id':_0x1a07ff['params']['id']}})[_0xf142('0x35')](handleEntityNotFound(_0x2c668a,null))[_0xf142('0x35')](saveUpdates(_0x1a07ff[_0xf142('0x54')],null))[_0xf142('0x35')](respondWithResult(_0x2c668a,null))['catch'](handleError(_0x2c668a,null));};exports[_0xf142('0x36')]=function(_0x5a5867,_0x1112a3){return db['OpenchannelMessage']['find']({'where':{'id':_0x5a5867[_0xf142('0x56')]['id']}})[_0xf142('0x35')](handleEntityNotFound(_0x1112a3,null))['then'](removeEntity(_0x1112a3,null))[_0xf142('0x29')](handleError(_0x1112a3,null));};exports[_0xf142('0x57')]=function(_0x3cc131,_0x402a9a){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x402a9a,null))[_0xf142('0x29')](handleError(_0x402a9a,null));};var interaction_log=require(_0xf142('0x13'))(_0xf142('0x58'));exports[_0xf142('0x59')]=function(_0x2f56db,_0x5c1482,_0x167c70){var _0x3b9ea0={'agent':{},'channel':_0xf142('0x5a')};if(_0x2f56db[_0xf142('0x54')]['id']){delete _0x2f56db[_0xf142('0x54')]['id'];}_0x2f56db[_0xf142('0x54')]['read']=!![];_0x2f56db['body'][_0xf142('0x5b')]=moment()[_0xf142('0x5c')](_0xf142('0x5d'));_0x2f56db[_0xf142('0x54')][_0xf142('0x5e')]=_0x2f56db['body'][_0xf142('0x5e')]||_0x2f56db['user']['id'];_0x3b9ea0[_0xf142('0x5f')]['id']=_0x2f56db[_0xf142('0x54')][_0xf142('0x5e')];return db['OpenchannelMessage'][_0xf142('0x52')]({'where':{'id':_0x2f56db[_0xf142('0x56')]['id'],'UserId':null}})[_0xf142('0x35')](handleEntityNotFound(_0x5c1482,null))['then'](saveUpdates(_0x2f56db[_0xf142('0x54')],null))[_0xf142('0x35')](function(_0x5c0650){if(_0x5c0650){_0x3b9ea0[_0xf142('0x28')]=_0x5c0650[_0xf142('0x60')]({'plain':!![]});return db[_0xf142('0x61')]['find']({'where':{'id':_0x5c0650[_0xf142('0x62')]}});}return null;})[_0xf142('0x35')](handleEntityNotFound(_0x5c1482,null))[_0xf142('0x35')](function(_0x397443){if(_0x397443){return _0x397443['update']({'UserId':_0x2f56db[_0xf142('0x54')][_0xf142('0x5e')],'read1stAt':_[_0xf142('0x63')](_0x397443['read1stAt'])?moment()[_0xf142('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2618b1){if(_0x2618b1){_0x3b9ea0[_0xf142('0x64')]=_0x2618b1[_0xf142('0x60')]({'plain':!![]});interaction_log[_0xf142('0x21')](_0xf142('0x65'),_0x2f56db[_0xf142('0x66')]['id'],_0x2f56db[_0xf142('0x66')][_0xf142('0x38')],_0x2f56db['user'][_0xf142('0x67')],_0x3b9ea0['interaction']['id'],_0x2f56db[_0xf142('0x54')]?JSON[_0xf142('0x68')](_0x2f56db[_0xf142('0x54')]):_0xf142('0x69'));return respondWithRpcPromise(_0xf142('0x6a'),'acceptMessage',_0x3b9ea0);}return null;})[_0xf142('0x35')](function(_0x2b3110){var _0x272b29=_0xf142('0x6b')+_0x2b3110['message'][_0xf142('0x6c')];return db['sequelize']['query'](_0x272b29,{'type':db[_0xf142('0x6d')][_0xf142('0x6e')]['SELECT'],'raw':!![]})[_0xf142('0x35')](function(_0x4cf369){return _0x4cf369;});})[_0xf142('0x35')](function(_0x5dadec){if(_0x5dadec){_0x3b9ea0['message'][_0xf142('0x6f')]=_0x5dadec[0x0];if(!_0x2f56db[_0xf142('0x54')][_0xf142('0x5e')])return;return db['User']['find']({'where':{'id':_0x2f56db['body'][_0xf142('0x5e')],'role':_0xf142('0x5f')},'attributes':['id','name',_0xf142('0x70'),'email',_0xf142('0x71')],'raw':!![]});}return null;})[_0xf142('0x35')](function(_0x261304){if(!_0x261304)return null;_0x3b9ea0[_0xf142('0x28')][_0xf142('0x5f')]=_0x261304;return _0x3b9ea0;})[_0xf142('0x35')](function(_0x22490d){if(_0x22490d){if(_0x2f56db[_0xf142('0x54')][_0xf142('0x72')]){_0x3b9ea0[_0xf142('0x28')]['interface']=util[_0xf142('0x5c')](_0xf142('0x73'),_0x2f56db[_0xf142('0x66')][_0xf142('0x38')]);_0x3b9ea0[_0xf142('0x28')][_0xf142('0x74')]=_0x3b9ea0[_0xf142('0x74')];_0x3b9ea0[_0xf142('0x28')]['motionChannel']=_0x3b9ea0[_0xf142('0x74')];_0x3b9ea0[_0xf142('0x28')][_0xf142('0x75')]=_0xf142('0x59');return respondWithRpcPromise('EventManager',_0xf142('0x76'),{'event':'acceptmessage','message':_0x3b9ea0[_0xf142('0x28')]},client9002)[_0xf142('0x35')](function(){return _0x3b9ea0;});}return _0x3b9ea0;}return null;})[_0xf142('0x35')](respondWithResult(_0x5c1482,null))[_0xf142('0x29')](handleError(_0x5c1482,null));};var interaction_log=require(_0xf142('0x13'))(_0xf142('0x58'));exports[_0xf142('0x34')]=function(_0x15c5e9,_0x1d8289,_0x4bcdd9){var _0xe8bcc3={'agent':{},'channel':_0xf142('0x5a')};if(_0x15c5e9[_0xf142('0x54')]['id']){delete _0x15c5e9['body']['id'];}_0x15c5e9[_0xf142('0x54')]['UserId']=_0x15c5e9[_0xf142('0x54')][_0xf142('0x5e')]||_0x15c5e9[_0xf142('0x66')]['id'];_0xe8bcc3[_0xf142('0x5f')]['id']=_0x15c5e9[_0xf142('0x54')][_0xf142('0x5e')];return db[_0xf142('0x4d')]['find']({'where':{'id':_0x15c5e9[_0xf142('0x56')]['id'],'UserId':null}})[_0xf142('0x35')](handleEntityNotFound(_0x1d8289,null))[_0xf142('0x35')](function(_0x3f7a11){if(_0x3f7a11){_0xe8bcc3[_0xf142('0x28')]=_0x3f7a11[_0xf142('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf142('0x52')]({'where':{'id':_0x3f7a11[_0xf142('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1d8289,null))[_0xf142('0x35')](function(_0x177dce){if(_0x177dce){_0xe8bcc3[_0xf142('0x64')]=_0x177dce['get']({'plain':!![]});interaction_log[_0xf142('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15c5e9['user']['id'],_0x15c5e9[_0xf142('0x66')]['name'],_0x15c5e9[_0xf142('0x66')][_0xf142('0x67')],_0xe8bcc3['interaction']['id'],_0x15c5e9[_0xf142('0x54')]?JSON[_0xf142('0x68')](_0x15c5e9[_0xf142('0x54')]):_0xf142('0x69'));return respondWithRpcPromise(_0xf142('0x77'),'rejectMessage',_0xe8bcc3);}return null;})['then'](function(_0x465a56){var _0x3229c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x465a56[_0xf142('0x28')][_0xf142('0x6c')];return db[_0xf142('0x78')][_0xf142('0x3e')](_0x3229c7,{'type':db[_0xf142('0x6d')][_0xf142('0x6e')][_0xf142('0x79')],'raw':!![]})[_0xf142('0x35')](function(_0x47a03e){return _0x47a03e;});})[_0xf142('0x35')](function(_0x37c2d3){if(_0x37c2d3){_0xe8bcc3[_0xf142('0x28')]['contact']=_0x37c2d3[0x0];if(!_0x15c5e9[_0xf142('0x54')][_0xf142('0x5e')])return;return db[_0xf142('0x7a')]['find']({'where':{'id':_0x15c5e9['body'][_0xf142('0x5e')],'role':'agent'},'attributes':['id',_0xf142('0x38'),_0xf142('0x70'),_0xf142('0x7b'),_0xf142('0x71')],'raw':!![]});}return null;})[_0xf142('0x35')](function(_0x1816b2){if(!_0x1816b2)return null;_0xe8bcc3['message'][_0xf142('0x5f')]=_0x1816b2;return _0xe8bcc3;})[_0xf142('0x35')](function(_0xf3e5d7){if(_0xf3e5d7){_0xf3e5d7['message'][_0xf142('0x7c')]=util[_0xf142('0x5c')](_0xf142('0x73'),_0x15c5e9[_0xf142('0x66')][_0xf142('0x38')]);_0xf3e5d7['message'][_0xf142('0x74')]=_0xe8bcc3[_0xf142('0x74')];_0xf3e5d7[_0xf142('0x28')]['motionChannel']=_0xe8bcc3[_0xf142('0x74')];_0xf3e5d7['message']['event']=_0xf142('0x34');respondWithRpcPromise('EventManager',_0xf142('0x76'),{'event':_0xf142('0x7d'),'message':_0xf3e5d7[_0xf142('0x28')]},client9002);return _0xe8bcc3;}return null;})[_0xf142('0x35')](respondWithResult(_0x1d8289,null))['catch'](handleError(_0x1d8289,null));}; \ No newline at end of file +var _0xb8bc=['OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','include','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','interaction','RejectMessage','rejectMessage','Sequelize','internal','event','rejectmessage','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','register','http','client','request'];(function(_0x3765e2,_0x4e1fba){var _0x144efb=function(_0x1b1ad0){while(--_0x1b1ad0){_0x3765e2['push'](_0x3765e2['shift']());}};_0x144efb(++_0x4e1fba);}(_0xb8bc,0x1d8));var _0xcb8b=function(_0x4070aa,_0x4fec19){_0x4070aa=_0x4070aa-0x0;var _0x1daf4e=_0xb8bc[_0x4070aa];return _0x1daf4e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcb8b('0x0'));var moment=require(_0xcb8b('0x1'));var BPromise=require(_0xcb8b('0x2'));var Mustache=require(_0xcb8b('0x3'));var util=require(_0xcb8b('0x4'));var path=require(_0xcb8b('0x5'));var sox=require(_0xcb8b('0x6'));var csv=require(_0xcb8b('0x7'));var ejs=require(_0xcb8b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb8b('0x9'));var squel=require(_0xcb8b('0xa'));var crypto=require(_0xcb8b('0xb'));var jsforce=require(_0xcb8b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb8b('0x7'));var querystring=require('querystring');var Papa=require(_0xcb8b('0xd'));var Redis=require(_0xcb8b('0xe'));var authService=require(_0xcb8b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb8b('0x10'))(_0xcb8b('0x11'));var utils=require(_0xcb8b('0x12'));var config=require(_0xcb8b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb8b('0x14'))['db'];config['redis']=_[_0xcb8b('0x15')](config['redis'],{'host':_0xcb8b('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb8b('0x17')]));require('./openchannelMessage.socket')[_0xcb8b('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcb8b('0x19')]({'port':0x232c});var client9002=jayson[_0xcb8b('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a8f7,_0x1b63f6,_0x879f5d,_0x363f07){return new BPromise(function(_0xbef607,_0x5a1bbc){var _0x24cb38=_0x363f07||client;return _0x24cb38[_0xcb8b('0x1b')](_0x33a8f7,_0x879f5d)['then'](function(_0x42d7cb){logger['info'](_0xcb8b('0x1c'),_0x1b63f6,_0xcb8b('0x1d'));logger[_0xcb8b('0x1e')](_0xcb8b('0x1f'),_0x1b63f6,'request\x20sent',JSON[_0xcb8b('0x20')](_0x42d7cb));if(_0x42d7cb[_0xcb8b('0x21')]){if(_0x42d7cb[_0xcb8b('0x21')][_0xcb8b('0x22')]===0x1f4){logger[_0xcb8b('0x21')](_0xcb8b('0x1c'),_0x1b63f6,_0x42d7cb[_0xcb8b('0x21')][_0xcb8b('0x23')]);return _0x5a1bbc(_0x42d7cb[_0xcb8b('0x21')][_0xcb8b('0x23')]);}logger['error'](_0xcb8b('0x1c'),_0x1b63f6,_0x42d7cb[_0xcb8b('0x21')]['message']);return _0xbef607(_0x42d7cb[_0xcb8b('0x21')][_0xcb8b('0x23')]);}else{logger['info'](_0xcb8b('0x1c'),_0x1b63f6,_0xcb8b('0x1d'));_0xbef607(_0x42d7cb[_0xcb8b('0x24')][_0xcb8b('0x23')]);}})[_0xcb8b('0x25')](function(_0x3049e3){logger[_0xcb8b('0x21')](_0xcb8b('0x1c'),_0x1b63f6,_0x3049e3);_0x5a1bbc(_0x3049e3);});});}function respondWithStatusCode(_0x2968c0,_0x1aef06){_0x1aef06=_0x1aef06||0xcc;return function(_0x2857c9){if(_0x2857c9){return _0x2968c0[_0xcb8b('0x26')](_0x1aef06);}return _0x2968c0['status'](_0x1aef06)[_0xcb8b('0x27')]();};}function respondWithResult(_0x151fee,_0x3d40cc){_0x3d40cc=_0x3d40cc||0xc8;return function(_0x1f36d9){if(_0x1f36d9){return _0x151fee[_0xcb8b('0x28')](_0x3d40cc)['json'](_0x1f36d9);}};}function respondWithFilteredResult(_0x1cd221,_0x3f4265){return function(_0x4a51c3){if(_0x4a51c3){var _0x5e3564=typeof _0x3f4265[_0xcb8b('0x29')]===_0xcb8b('0x2a')&&typeof _0x3f4265['limit']==='undefined';var _0x218b0e=_0x4a51c3[_0xcb8b('0x2b')];var _0x367fd7=_0x5e3564?0x0:_0x3f4265[_0xcb8b('0x29')];var _0xe7e41=_0x5e3564?_0x4a51c3[_0xcb8b('0x2b')]:_0x3f4265[_0xcb8b('0x29')]+_0x3f4265[_0xcb8b('0x2c')];var _0x23cd40;if(_0xe7e41>=_0x218b0e){_0xe7e41=_0x218b0e;_0x23cd40=0xc8;}else{_0x23cd40=0xce;}_0x1cd221[_0xcb8b('0x28')](_0x23cd40);return _0x1cd221[_0xcb8b('0x2d')](_0xcb8b('0x2e'),_0x367fd7+'-'+_0xe7e41+'/'+_0x218b0e)['json'](_0x4a51c3);}return null;};}function patchUpdates(_0x1d2dd4){return function(_0x1d2ef7){try{jsonpatch[_0xcb8b('0x2f')](_0x1d2ef7,_0x1d2dd4,!![]);}catch(_0x193a37){return BPromise[_0xcb8b('0x30')](_0x193a37);}return _0x1d2ef7[_0xcb8b('0x31')]();};}function saveUpdates(_0x32657c,_0x7b1730){return function(_0x1e649f){if(_0x1e649f){return _0x1e649f[_0xcb8b('0x32')](_0x32657c)[_0xcb8b('0x33')](function(_0x467130){return _0x467130;});}return null;};}function removeEntity(_0x5b9b87,_0x4f0237){return function(_0x1a0399){if(_0x1a0399){return _0x1a0399[_0xcb8b('0x34')]()[_0xcb8b('0x33')](function(){_0x5b9b87[_0xcb8b('0x28')](0xcc)[_0xcb8b('0x27')]();});}};}function handleEntityNotFound(_0x3ac290,_0x4911b0){return function(_0x26faa4){if(!_0x26faa4){_0x3ac290[_0xcb8b('0x26')](0x194);}return _0x26faa4;};}function handleError(_0x69dbd3,_0x8bbe50){_0x8bbe50=_0x8bbe50||0x1f4;return function(_0x1f4e57){logger[_0xcb8b('0x21')](_0x1f4e57[_0xcb8b('0x35')]);if(_0x1f4e57[_0xcb8b('0x36')]){delete _0x1f4e57[_0xcb8b('0x36')];}_0x69dbd3[_0xcb8b('0x28')](_0x8bbe50)[_0xcb8b('0x37')](_0x1f4e57);};}exports['index']=function(_0x4c8c5d,_0xce9de9){var _0x1479ca={},_0x4e386a={},_0x4c1656={'count':0x0,'rows':[]};var _0x54352f=_[_0xcb8b('0x38')](db[_0xcb8b('0x39')][_0xcb8b('0x3a')],function(_0x564b2f){return{'name':_0x564b2f['fieldName'],'type':_0x564b2f[_0xcb8b('0x3b')][_0xcb8b('0x3c')]};});_0x4e386a['model']=_[_0xcb8b('0x38')](_0x54352f,_0xcb8b('0x36'));_0x4e386a[_0xcb8b('0x3d')]=_[_0xcb8b('0x3e')](_0x4c8c5d[_0xcb8b('0x3d')]);_0x4e386a[_0xcb8b('0x3f')]=_[_0xcb8b('0x40')](_0x4e386a[_0xcb8b('0x41')],_0x4e386a['query']);_0x1479ca[_0xcb8b('0x42')]=_[_0xcb8b('0x40')](_0x4e386a['model'],qs[_0xcb8b('0x43')](_0x4c8c5d[_0xcb8b('0x3d')][_0xcb8b('0x43')]));_0x1479ca[_0xcb8b('0x42')]=_0x1479ca[_0xcb8b('0x42')][_0xcb8b('0x44')]?_0x1479ca[_0xcb8b('0x42')]:_0x4e386a[_0xcb8b('0x41')];if(!_0x4c8c5d['query'][_0xcb8b('0x45')]('nolimit')){_0x1479ca['limit']=qs['limit'](_0x4c8c5d['query']['limit']);_0x1479ca[_0xcb8b('0x29')]=qs[_0xcb8b('0x29')](_0x4c8c5d['query'][_0xcb8b('0x29')]);}_0x1479ca[_0xcb8b('0x46')]=qs[_0xcb8b('0x47')](_0x4c8c5d[_0xcb8b('0x3d')][_0xcb8b('0x47')]);_0x1479ca['where']=qs[_0xcb8b('0x3f')](_[_0xcb8b('0x48')](_0x4c8c5d[_0xcb8b('0x3d')],_0x4e386a[_0xcb8b('0x3f')]),_0x54352f);if(_0x4c8c5d[_0xcb8b('0x3d')][_0xcb8b('0x49')]){_0x1479ca['where']=_[_0xcb8b('0x4a')](_0x1479ca[_0xcb8b('0x4b')],{'$or':_[_0xcb8b('0x38')](_0x54352f,function(_0x61a72e){if(_0x61a72e[_0xcb8b('0x3b')]!==_0xcb8b('0x4c')){var _0x3b57b2={};_0x3b57b2[_0x61a72e[_0xcb8b('0x36')]]={'$like':'%'+_0x4c8c5d[_0xcb8b('0x3d')][_0xcb8b('0x49')]+'%'};return _0x3b57b2;}})});}_0x1479ca=_[_0xcb8b('0x4a')]({},_0x1479ca,_0x4c8c5d[_0xcb8b('0x4d')]);var _0x42623a={'where':_0x1479ca[_0xcb8b('0x4b')]};return db['OpenchannelMessage'][_0xcb8b('0x2b')](_0x42623a)[_0xcb8b('0x33')](function(_0x2d84e6){_0x4c1656[_0xcb8b('0x2b')]=_0x2d84e6;if(_0x4c8c5d['query']['includeAll']){_0x1479ca[_0xcb8b('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x1479ca);})[_0xcb8b('0x33')](function(_0xc59261){_0x4c1656['rows']=_0xc59261;return _0x4c1656;})[_0xcb8b('0x33')](respondWithFilteredResult(_0xce9de9,_0x1479ca))[_0xcb8b('0x25')](handleError(_0xce9de9,null));};exports[_0xcb8b('0x4f')]=function(_0x45f9ba,_0x39872a){var _0x1e2a8c={'raw':!![],'where':{'id':_0x45f9ba[_0xcb8b('0x50')]['id']}},_0x4e5fb8={};_0x4e5fb8[_0xcb8b('0x41')]=_[_0xcb8b('0x3e')](db[_0xcb8b('0x39')]['rawAttributes']);_0x4e5fb8[_0xcb8b('0x3d')]=_[_0xcb8b('0x3e')](_0x45f9ba[_0xcb8b('0x3d')]);_0x4e5fb8['filters']=_[_0xcb8b('0x40')](_0x4e5fb8[_0xcb8b('0x41')],_0x4e5fb8[_0xcb8b('0x3d')]);_0x1e2a8c['attributes']=_['intersection'](_0x4e5fb8[_0xcb8b('0x41')],qs['fields'](_0x45f9ba[_0xcb8b('0x3d')]['fields']));_0x1e2a8c[_0xcb8b('0x42')]=_0x1e2a8c[_0xcb8b('0x42')][_0xcb8b('0x44')]?_0x1e2a8c[_0xcb8b('0x42')]:_0x4e5fb8['model'];if(_0x45f9ba[_0xcb8b('0x3d')][_0xcb8b('0x51')]){_0x1e2a8c[_0xcb8b('0x4e')]=[{'all':!![]}];}_0x1e2a8c=_['merge']({},_0x1e2a8c,_0x45f9ba[_0xcb8b('0x4d')]);return db[_0xcb8b('0x39')][_0xcb8b('0x52')](_0x1e2a8c)[_0xcb8b('0x33')](handleEntityNotFound(_0x39872a,null))[_0xcb8b('0x33')](respondWithResult(_0x39872a,null))[_0xcb8b('0x25')](handleError(_0x39872a,null));};exports[_0xcb8b('0x53')]=function(_0x1e5c92,_0x5b399a){return db[_0xcb8b('0x39')][_0xcb8b('0x53')](_0x1e5c92[_0xcb8b('0x54')],{})[_0xcb8b('0x33')](respondWithResult(_0x5b399a,0xc9))[_0xcb8b('0x25')](handleError(_0x5b399a,null));};exports[_0xcb8b('0x32')]=function(_0x169b40,_0x5e0a4c){if(_0x169b40[_0xcb8b('0x54')]['id']){delete _0x169b40[_0xcb8b('0x54')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x169b40[_0xcb8b('0x50')]['id']}})[_0xcb8b('0x33')](handleEntityNotFound(_0x5e0a4c,null))[_0xcb8b('0x33')](saveUpdates(_0x169b40[_0xcb8b('0x54')],null))['then'](respondWithResult(_0x5e0a4c,null))[_0xcb8b('0x25')](handleError(_0x5e0a4c,null));};exports['destroy']=function(_0xe99290,_0x317f09){return db[_0xcb8b('0x39')][_0xcb8b('0x52')]({'where':{'id':_0xe99290[_0xcb8b('0x50')]['id']}})['then'](handleEntityNotFound(_0x317f09,null))['then'](removeEntity(_0x317f09,null))[_0xcb8b('0x25')](handleError(_0x317f09,null));};exports[_0xcb8b('0x55')]=function(_0x33af2a,_0x13f245){return db[_0xcb8b('0x39')][_0xcb8b('0x55')]()[_0xcb8b('0x33')](respondWithResult(_0x13f245,null))[_0xcb8b('0x25')](handleError(_0x13f245,null));};var interaction_log=require(_0xcb8b('0x10'))(_0xcb8b('0x56'));exports[_0xcb8b('0x57')]=function(_0x181b2e,_0x569daa,_0x2ba44a){var _0x139898={'agent':{},'channel':_0xcb8b('0x58')};if(_0x181b2e[_0xcb8b('0x54')]['id']){delete _0x181b2e[_0xcb8b('0x54')]['id'];}_0x181b2e[_0xcb8b('0x54')]['read']=!![];_0x181b2e[_0xcb8b('0x54')]['readAt']=moment()[_0xcb8b('0x59')](_0xcb8b('0x5a'));_0x181b2e[_0xcb8b('0x54')][_0xcb8b('0x5b')]=_0x181b2e[_0xcb8b('0x54')][_0xcb8b('0x5b')]||_0x181b2e['user']['id'];_0x139898[_0xcb8b('0x5c')]['id']=_0x181b2e[_0xcb8b('0x54')][_0xcb8b('0x5b')];return db[_0xcb8b('0x39')][_0xcb8b('0x52')]({'where':{'id':_0x181b2e[_0xcb8b('0x50')]['id'],'UserId':null}})[_0xcb8b('0x33')](handleEntityNotFound(_0x569daa,null))[_0xcb8b('0x33')](saveUpdates(_0x181b2e[_0xcb8b('0x54')],null))['then'](function(_0x1c0b4f){if(_0x1c0b4f){_0x139898['message']=_0x1c0b4f[_0xcb8b('0x5d')]({'plain':!![]});return db[_0xcb8b('0x5e')][_0xcb8b('0x52')]({'where':{'id':_0x1c0b4f[_0xcb8b('0x5f')]}});}return null;})[_0xcb8b('0x33')](handleEntityNotFound(_0x569daa,null))[_0xcb8b('0x33')](function(_0x34fc56){if(_0x34fc56){return _0x34fc56[_0xcb8b('0x32')]({'UserId':_0x181b2e['body']['UserId'],'read1stAt':_[_0xcb8b('0x60')](_0x34fc56[_0xcb8b('0x61')])?moment()[_0xcb8b('0x59')](_0xcb8b('0x5a')):undefined});}return null;})[_0xcb8b('0x33')](function(_0x2bae13){if(_0x2bae13){_0x139898['interaction']=_0x2bae13[_0xcb8b('0x5d')]({'plain':!![]});interaction_log[_0xcb8b('0x62')](_0xcb8b('0x63'),_0x181b2e[_0xcb8b('0x64')]['id'],_0x181b2e['user'][_0xcb8b('0x36')],_0x181b2e[_0xcb8b('0x64')][_0xcb8b('0x65')],_0x139898['interaction']['id'],_0x181b2e[_0xcb8b('0x54')]?JSON['stringify'](_0x181b2e[_0xcb8b('0x54')]):'null');return respondWithRpcPromise(_0xcb8b('0x66'),'acceptMessage',_0x139898);}return null;})[_0xcb8b('0x33')](function(_0x6ab2ff){var _0x1105f1=_0xcb8b('0x67')+_0x6ab2ff[_0xcb8b('0x23')]['ContactId'];return db[_0xcb8b('0x68')][_0xcb8b('0x3d')](_0x1105f1,{'type':db['Sequelize'][_0xcb8b('0x69')][_0xcb8b('0x6a')],'raw':!![]})[_0xcb8b('0x33')](function(_0x10a8bb){return _0x10a8bb;});})[_0xcb8b('0x33')](function(_0x8b31e3){if(_0x8b31e3){_0x139898[_0xcb8b('0x23')][_0xcb8b('0x6b')]=_0x8b31e3[0x0];if(!_0x181b2e['body'][_0xcb8b('0x5b')])return;return db[_0xcb8b('0x6c')][_0xcb8b('0x52')]({'where':{'id':_0x181b2e[_0xcb8b('0x54')][_0xcb8b('0x5b')],'role':_0xcb8b('0x5c')},'attributes':['id',_0xcb8b('0x36'),_0xcb8b('0x6d'),_0xcb8b('0x6e'),'internal'],'raw':!![]});}return null;})[_0xcb8b('0x33')](function(_0x2d1515){if(!_0x2d1515)return null;_0x139898[_0xcb8b('0x23')][_0xcb8b('0x5c')]=_0x2d1515;return _0x139898;})[_0xcb8b('0x33')](function(_0x2ce749){if(_0x2ce749){if(_0x181b2e[_0xcb8b('0x54')][_0xcb8b('0x6f')]){_0x139898[_0xcb8b('0x23')][_0xcb8b('0x70')]=util[_0xcb8b('0x59')](_0xcb8b('0x71'),_0x181b2e[_0xcb8b('0x64')]['name']);_0x139898['message']['channel']=_0x139898[_0xcb8b('0x72')];_0x139898[_0xcb8b('0x23')][_0xcb8b('0x73')]=_0x139898[_0xcb8b('0x72')];_0x139898[_0xcb8b('0x23')]['event']='accept';return respondWithRpcPromise(_0xcb8b('0x74'),_0xcb8b('0x74'),{'event':_0xcb8b('0x75'),'message':_0x139898[_0xcb8b('0x23')]},client9002)[_0xcb8b('0x33')](function(){return _0x139898;});}return _0x139898;}return null;})[_0xcb8b('0x33')](respondWithResult(_0x569daa,null))[_0xcb8b('0x25')](handleError(_0x569daa,null));};var interaction_log=require(_0xcb8b('0x10'))('openchannel-interactions');exports[_0xcb8b('0x30')]=function(_0x55c6b9,_0x156487,_0x11fac2){var _0xe04819={'agent':{},'channel':'openchannel'};if(_0x55c6b9[_0xcb8b('0x54')]['id']){delete _0x55c6b9['body']['id'];}_0x55c6b9[_0xcb8b('0x54')][_0xcb8b('0x5b')]=_0x55c6b9[_0xcb8b('0x54')][_0xcb8b('0x5b')]||_0x55c6b9[_0xcb8b('0x64')]['id'];_0xe04819['agent']['id']=_0x55c6b9['body'][_0xcb8b('0x5b')];return db[_0xcb8b('0x39')]['find']({'where':{'id':_0x55c6b9['params']['id'],'UserId':null}})[_0xcb8b('0x33')](handleEntityNotFound(_0x156487,null))[_0xcb8b('0x33')](function(_0x289404){if(_0x289404){_0xe04819['message']=_0x289404['get']({'plain':!![]});return db[_0xcb8b('0x5e')][_0xcb8b('0x52')]({'where':{'id':_0x289404[_0xcb8b('0x5f')]}});}return null;})[_0xcb8b('0x33')](handleEntityNotFound(_0x156487,null))[_0xcb8b('0x33')](function(_0x346a82){if(_0x346a82){_0xe04819[_0xcb8b('0x76')]=_0x346a82[_0xcb8b('0x5d')]({'plain':!![]});interaction_log[_0xcb8b('0x62')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55c6b9['user']['id'],_0x55c6b9[_0xcb8b('0x64')][_0xcb8b('0x36')],_0x55c6b9[_0xcb8b('0x64')]['role'],_0xe04819[_0xcb8b('0x76')]['id'],_0x55c6b9[_0xcb8b('0x54')]?JSON[_0xcb8b('0x20')](_0x55c6b9['body']):'null');return respondWithRpcPromise(_0xcb8b('0x77'),_0xcb8b('0x78'),_0xe04819);}return null;})['then'](function(_0xf48fd1){var _0x2cb4f9=_0xcb8b('0x67')+_0xf48fd1['message']['ContactId'];return db['sequelize'][_0xcb8b('0x3d')](_0x2cb4f9,{'type':db[_0xcb8b('0x79')][_0xcb8b('0x69')][_0xcb8b('0x6a')],'raw':!![]})[_0xcb8b('0x33')](function(_0x3a0bdf){return _0x3a0bdf;});})[_0xcb8b('0x33')](function(_0x493be4){if(_0x493be4){_0xe04819[_0xcb8b('0x23')][_0xcb8b('0x6b')]=_0x493be4[0x0];if(!_0x55c6b9[_0xcb8b('0x54')]['UserId'])return;return db[_0xcb8b('0x6c')][_0xcb8b('0x52')]({'where':{'id':_0x55c6b9[_0xcb8b('0x54')][_0xcb8b('0x5b')],'role':_0xcb8b('0x5c')},'attributes':['id','name',_0xcb8b('0x6d'),'email',_0xcb8b('0x7a')],'raw':!![]});}return null;})[_0xcb8b('0x33')](function(_0x34a899){if(!_0x34a899)return null;_0xe04819[_0xcb8b('0x23')][_0xcb8b('0x5c')]=_0x34a899;return _0xe04819;})[_0xcb8b('0x33')](function(_0x296ad6){if(_0x296ad6){_0x296ad6[_0xcb8b('0x23')][_0xcb8b('0x70')]=util[_0xcb8b('0x59')](_0xcb8b('0x71'),_0x55c6b9['user'][_0xcb8b('0x36')]);_0x296ad6[_0xcb8b('0x23')][_0xcb8b('0x72')]=_0xe04819[_0xcb8b('0x72')];_0x296ad6[_0xcb8b('0x23')][_0xcb8b('0x73')]=_0xe04819[_0xcb8b('0x72')];_0x296ad6[_0xcb8b('0x23')][_0xcb8b('0x7b')]=_0xcb8b('0x30');respondWithRpcPromise(_0xcb8b('0x74'),_0xcb8b('0x74'),{'event':_0xcb8b('0x7c'),'message':_0x296ad6[_0xcb8b('0x23')]},client9002);return _0xe04819;}return null;})[_0xcb8b('0x33')](respondWithResult(_0x156487,null))[_0xcb8b('0x25')](handleError(_0x156487,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5000091..402879d 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 _0x33bd=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x24a08b,_0x174509){var _0x545301=function(_0x29f771){while(--_0x29f771){_0x24a08b['push'](_0x24a08b['shift']());}};_0x545301(++_0x174509);}(_0x33bd,0x156));var _0xd33b=function(_0x22f004,_0x3968b3){_0x22f004=_0x22f004-0x0;var _0x3c9907=_0x33bd[_0x22f004];return _0x3c9907;};'use strict';var EventEmitter=require(_0xd33b('0x0'));var OpenchannelMessage=require(_0xd33b('0x1'))['db'][_0xd33b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd33b('0x3')](0x0);var events={'afterCreate':_0xd33b('0x4'),'afterUpdate':_0xd33b('0x5'),'afterDestroy':_0xd33b('0x6')};function emitEvent(_0x6cec73){return function(_0x1b62d9,_0x1d39f8,_0x38096e){OpenchannelMessageEvents[_0xd33b('0x7')](_0x6cec73+':'+_0x1b62d9['id'],_0x1b62d9);OpenchannelMessageEvents[_0xd33b('0x7')](_0x6cec73,_0x1b62d9);_0x38096e(null);};}for(var e in events){if(events[_0xd33b('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xd33b('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xdd53=['update','emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xdd53,0xcc));var _0x3dd5=function(_0x520fa2,_0x4ec24e){_0x520fa2=_0x520fa2-0x0;var _0x5921d1=_0xdd53[_0x520fa2];return _0x5921d1;};'use strict';var EventEmitter=require(_0x3dd5('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x3dd5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3dd5('0x2')](0x0);var events={'afterCreate':_0x3dd5('0x3'),'afterUpdate':_0x3dd5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x26ac69){return function(_0x1f21a2,_0x2ee11d,_0x371f14){OpenchannelMessageEvents[_0x3dd5('0x5')](_0x26ac69+':'+_0x1f21a2['id'],_0x1f21a2);OpenchannelMessageEvents['emit'](_0x26ac69,_0x1f21a2);_0x371f14(null);};}for(var e in events){if(events[_0x3dd5('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x3dd5('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 446d269..379cfd2 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 _0x4a58=['out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Contact','keys','replyUri','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','POST','info','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','body','models','get','direction','toLowerCase'];(function(_0x1b8cda,_0x110f20){var _0x3b4a91=function(_0x1fec14){while(--_0x1fec14){_0x1b8cda['push'](_0x1b8cda['shift']());}};_0x3b4a91(++_0x110f20);}(_0x4a58,0x181));var _0x84a5=function(_0xb1c60b,_0x385134){_0xb1c60b=_0xb1c60b-0x0;var _0x4c391d=_0x4a58[_0xb1c60b];return _0x4c391d;};'use strict';var _=require('lodash');var util=require(_0x84a5('0x0'));var logger=require(_0x84a5('0x1'))(_0x84a5('0x2'));var moment=require('moment');var BPromise=require(_0x84a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84a5('0x4'));var rimraf=require(_0x84a5('0x5'));var config=require(_0x84a5('0x6'));var attributes=require(_0x84a5('0x7'));module[_0x84a5('0x8')]=function(_0x2fb8ad,_0x552d84){return _0x2fb8ad['define'](_0x84a5('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x84a5('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51616b,_0x5d0def,_0x56aadd){var _0x1e20f6=_0x2fb8ad[_0x84a5('0xb')];var _0x1d6410=_0x51616b[_0x84a5('0xc')]({'plain':!![]});if(_0x1d6410[_0x84a5('0xd')][_0x84a5('0xe')]()==='in'||_0x1d6410[_0x84a5('0xd')][_0x84a5('0xe')]()===_0x84a5('0xf')&&!_0x1d6410[_0x84a5('0x10')]&&!_['isNil'](_0x1d6410[_0x84a5('0x11')])){_0x1e20f6[_0x84a5('0x12')][_0x84a5('0x13')]({'where':{'id':_0x1d6410[_0x84a5('0x14')]}})[_0x84a5('0x15')](function(_0x4efe7e){if(_0x4efe7e){_0x4efe7e[_0x84a5('0x16')]({'lastMsgAt':_0x1d6410[_0x84a5('0x17')],'lastMsgDirection':_0x1d6410[_0x84a5('0xd')]['toLowerCase']()});}})[_0x84a5('0x18')](function(_0x289746){console[_0x84a5('0x19')](_0x289746);});}if(_0x1d6410[_0x84a5('0xd')]===_0x84a5('0xf')&&!_0x1d6410[_0x84a5('0x10')]){var _0x50e30d;_0x1e20f6[_0x84a5('0x1a')][_0x84a5('0x1b')]()['then'](function(_0x5b8f26){return _0x1e20f6[_0x84a5('0x1c')]['find']({'where':{'id':_0x1d6410[_0x84a5('0x1d')]},'include':[{'model':_0x1e20f6[_0x84a5('0x12')],'as':'Interactions','where':{'id':_0x1d6410[_0x84a5('0x14')]},'limit':0x1,'include':[{'model':_0x1e20f6['CmContact'],'as':_0x84a5('0x1e'),'attributes':_[_0x84a5('0x1f')](_0x5b8f26)}]}]});})[_0x84a5('0x15')](function(_0x2e6665){_0x50e30d=_0x2e6665['get']({'plain':!![]});if(_0x50e30d&&_0x50e30d[_0x84a5('0x20')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x84a5('0x21'),util['format'](_0x84a5('0x22'),_0x1d6410['id'],_0x50e30d['replyUri']));if(_0x50e30d['Interactions']&&_0x50e30d[_0x84a5('0x23')][_0x84a5('0x24')]){_0x1d6410[_0x84a5('0x25')]=_[_0x84a5('0x26')](_0x50e30d[_0x84a5('0x23')][0x0],'Contact');_0x1d6410[_0x84a5('0x1e')]=_0x50e30d['Interactions'][0x0][_0x84a5('0x1e')];}var _0x5d0def={'method':'POST','uri':encodeURI(_0x50e30d['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d0def[_0x84a5('0x27')]){case _0x84a5('0x28'):_0x5d0def['qs']=_0x1d6410;break;case _0x84a5('0x29'):_0x5d0def[_0x84a5('0xa')]=_0x1d6410;break;}return rp(_0x5d0def)[_0x84a5('0x15')](function(_0x36ca98){logger[_0x84a5('0x2a')](_0x84a5('0x2b'),_0x84a5('0x21'),util[_0x84a5('0x2c')](_0x84a5('0x2d'),_0x1d6410['id'],_0x50e30d[_0x84a5('0x20')]));if(_0x36ca98['body'][_0x84a5('0x2e')]&&_0x36ca98[_0x84a5('0xa')][_0x84a5('0x2e')]!=_0x1d6410[_0x84a5('0x25')][_0x84a5('0x2e')]){return _0x1e20f6[_0x84a5('0x12')]['update']({'threadId':_0x36ca98[_0x84a5('0xa')][_0x84a5('0x2e')]},{'where':{'id':_0x1d6410['Interaction']['id']}});}else{return;}})['then'](function(){return _0x51616b[_0x84a5('0x16')]({'read':!![]});})[_0x84a5('0x18')](function(_0x327c4d){logger['error'](_0x84a5('0x2b'),'afterCreate',util[_0x84a5('0x2f')](_0x327c4d,{'showHidden':![],'depth':null}));_0x56aadd();});}else{_0x56aadd();}})[_0x84a5('0x30')](function(){_0x56aadd();});}else{_0x56aadd();}}},'charset':_0x84a5('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdec4=['direction','toLowerCase','out','secret','isNil','UserId','findOne','then','error','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','info','format','threadId','Interaction','update','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get'];(function(_0x27c42a,_0x2c6c0d){var _0x57a504=function(_0x12508d){while(--_0x12508d){_0x27c42a['push'](_0x27c42a['shift']());}};_0x57a504(++_0x2c6c0d);}(_0xdec4,0x146));var _0x4dec=function(_0x513980,_0xdb33f1){_0x513980=_0x513980-0x0;var _0x5cbcfe=_0xdec4[_0x513980];return _0x5cbcfe;};'use strict';var _=require('lodash');var util=require(_0x4dec('0x0'));var logger=require(_0x4dec('0x1'))(_0x4dec('0x2'));var moment=require(_0x4dec('0x3'));var BPromise=require(_0x4dec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dec('0x5'));var rimraf=require(_0x4dec('0x6'));var config=require(_0x4dec('0x7'));var attributes=require(_0x4dec('0x8'));module[_0x4dec('0x9')]=function(_0x3a6547,_0x4a5728){return _0x3a6547['define'](_0x4dec('0xa'),attributes,{'tableName':_0x4dec('0xb'),'paranoid':![],'indexes':[{'name':_0x4dec('0xc'),'fields':[_0x4dec('0xd')],'type':_0x4dec('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44b083,_0x4fe5fb,_0x2d12a0){var _0x2d708b=_0x3a6547[_0x4dec('0xf')];var _0x1e5290=_0x44b083[_0x4dec('0x10')]({'plain':!![]});if(_0x1e5290[_0x4dec('0x11')][_0x4dec('0x12')]()==='in'||_0x1e5290[_0x4dec('0x11')][_0x4dec('0x12')]()===_0x4dec('0x13')&&!_0x1e5290[_0x4dec('0x14')]&&!_[_0x4dec('0x15')](_0x1e5290[_0x4dec('0x16')])){_0x2d708b['OpenchannelInteraction'][_0x4dec('0x17')]({'where':{'id':_0x1e5290['OpenchannelInteractionId']}})[_0x4dec('0x18')](function(_0x409fd9){if(_0x409fd9){_0x409fd9['update']({'lastMsgAt':_0x1e5290['createdAt'],'lastMsgDirection':_0x1e5290['direction']['toLowerCase']()});}})['catch'](function(_0x117aa4){console[_0x4dec('0x19')](_0x117aa4);});}if(_0x1e5290[_0x4dec('0x11')]===_0x4dec('0x13')&&!_0x1e5290[_0x4dec('0x14')]){var _0x20c761;_0x2d708b['CmContact'][_0x4dec('0x1a')]()['then'](function(_0x319fee){return _0x2d708b[_0x4dec('0x1b')][_0x4dec('0x1c')]({'where':{'id':_0x1e5290['OpenchannelAccountId']},'include':[{'model':_0x2d708b[_0x4dec('0x1d')],'as':_0x4dec('0x1e'),'where':{'id':_0x1e5290[_0x4dec('0x1f')]},'limit':0x1,'include':[{'model':_0x2d708b[_0x4dec('0x20')],'as':_0x4dec('0x21'),'attributes':_[_0x4dec('0x22')](_0x319fee)}]}]});})[_0x4dec('0x18')](function(_0x38de13){_0x20c761=_0x38de13['get']({'plain':!![]});if(_0x20c761&&_0x20c761[_0x4dec('0x23')]){logger['info'](_0x4dec('0x24'),_0x4dec('0x25'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1e5290['id'],_0x20c761['replyUri']));if(_0x20c761['Interactions']&&_0x20c761['Interactions'][_0x4dec('0x26')]){_0x1e5290['Interaction']=_[_0x4dec('0x27')](_0x20c761['Interactions'][0x0],_0x4dec('0x21'));_0x1e5290[_0x4dec('0x21')]=_0x20c761[_0x4dec('0x1e')][0x0]['Contact'];}var _0x4fe5fb={'method':_0x4dec('0x28'),'uri':encodeURI(_0x20c761[_0x4dec('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4fe5fb['method']){case'GET':_0x4fe5fb['qs']=_0x1e5290;break;case'POST':_0x4fe5fb[_0x4dec('0xd')]=_0x1e5290;break;}return rp(_0x4fe5fb)[_0x4dec('0x18')](function(_0x38817e){logger[_0x4dec('0x29')](_0x4dec('0x24'),_0x4dec('0x25'),util[_0x4dec('0x2a')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1e5290['id'],_0x20c761[_0x4dec('0x23')]));if(_0x38817e[_0x4dec('0xd')][_0x4dec('0x2b')]&&_0x38817e[_0x4dec('0xd')]['threadId']!=_0x1e5290[_0x4dec('0x2c')][_0x4dec('0x2b')]){return _0x2d708b[_0x4dec('0x1d')][_0x4dec('0x2d')]({'threadId':_0x38817e[_0x4dec('0xd')][_0x4dec('0x2b')]},{'where':{'id':_0x1e5290[_0x4dec('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x44b083['update']({'read':!![]});})['catch'](function(_0x5b48b9){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4dec('0x25'),util['inspect'](_0x5b48b9,{'showHidden':![],'depth':null}));_0x2d12a0();});}else{_0x2d12a0();}})[_0x4dec('0x2e')](function(){_0x2d12a0();});}else{_0x2d12a0();}}},'charset':_0x4dec('0x2f'),'collate':_0x4dec('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a812801..c9be50c 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d80b2,_0x3477b9){var _0x5c334c=function(_0x1dcbdd){while(--_0x1dcbdd){_0x3d80b2['push'](_0x3d80b2['shift']());}};_0x5c334c(++_0x3477b9);}(_0x1261,0x144));var _0x1126=function(_0x4014e5,_0x125e6a){_0x4014e5=_0x4014e5-0x0;var _0x4ee8b7=_0x1261[_0x4014e5];return _0x4ee8b7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x51d625,_0x19c44d){var _0x291e93=function(_0x292869){while(--_0x292869){_0x51d625['push'](_0x51d625['shift']());}};_0x291e93(++_0x19c44d);}(_0xadb5,0xad));var _0x5adb=function(_0x5ab9f9,_0x388022){_0x5ab9f9=_0x5ab9f9-0x0;var _0x4cf527=_0xadb5[_0x5ab9f9];return _0x4cf527;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e060f48..77ba585 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 _0x2718=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x2718,0x18d));var _0x8271=function(_0x14e958,_0x215a08){_0x14e958=_0x14e958-0x0;var _0x30959a=_0x2718[_0x14e958];return _0x30959a;};'use strict';var OpenchannelMessageEvents=require(_0x8271('0x0'));var events=[_0x8271('0x1'),_0x8271('0x2'),_0x8271('0x3')];function createListener(_0x2b2dcb,_0x2ebda6){return function(_0x5d04a1){_0x2ebda6[_0x8271('0x4')](_0x2b2dcb,_0x5d04a1);};}function removeListener(_0x53c2cf,_0x30887d){return function(){OpenchannelMessageEvents[_0x8271('0x5')](_0x53c2cf,_0x30887d);};}exports[_0x8271('0x6')]=function(_0x1b5f5b){for(var _0x46c3ea=0x0,_0x481387=events[_0x8271('0x7')];_0x46c3ea<_0x481387;_0x46c3ea++){var _0x103581=events[_0x46c3ea];var _0x599a2f=createListener(_0x8271('0x8')+_0x103581,_0x1b5f5b);OpenchannelMessageEvents['on'](_0x103581,_0x599a2f);}}; \ No newline at end of file +var _0x5559=['save','emit','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x5559,0x1af));var _0x9555=function(_0x4c7a89,_0x3b5dd5){_0x4c7a89=_0x4c7a89-0x0;var _0x17a564=_0x5559[_0x4c7a89];return _0x17a564;};'use strict';var OpenchannelMessageEvents=require(_0x9555('0x0'));var events=[_0x9555('0x1'),'remove','update'];function createListener(_0x52e3f6,_0x4b624b){return function(_0x4bc1a7){_0x4b624b[_0x9555('0x2')](_0x52e3f6,_0x4bc1a7);};}function removeListener(_0x1d40a9,_0x3bdd89){return function(){OpenchannelMessageEvents['removeListener'](_0x1d40a9,_0x3bdd89);};}exports[_0x9555('0x3')]=function(_0x57cac5){for(var _0x5c9dc7=0x0,_0x20e405=events[_0x9555('0x4')];_0x5c9dc7<_0x20e405;_0x5c9dc7++){var _0xe0be93=events[_0x5c9dc7];var _0x3428ed=createListener(_0x9555('0x5')+_0xe0be93,_0x57cac5);OpenchannelMessageEvents['on'](_0xe0be93,_0x3428ed);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0d9ccbf..c5b3b22 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 _0xdb3b=['addTeams','addAgents','put','update','removeTeams','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/users','create','post','/:id/teams'];(function(_0x67748b,_0x25f304){var _0xdef940=function(_0x343cb3){while(--_0x343cb3){_0x67748b['push'](_0x67748b['shift']());}};_0xdef940(++_0x25f304);}(_0xdb3b,0x1aa));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbdb3('0x0'));var util=require(_0xbdb3('0x1'));var path=require(_0xbdb3('0x2'));var timeout=require(_0xbdb3('0x3'));var express=require('express');var router=express[_0xbdb3('0x4')]();var fs_extra=require(_0xbdb3('0x5'));var auth=require(_0xbdb3('0x6'));var interaction=require(_0xbdb3('0x7'));var config=require(_0xbdb3('0x8'));var controller=require(_0xbdb3('0x9'));router[_0xbdb3('0xa')]('/',auth[_0xbdb3('0xb')](),controller[_0xbdb3('0xc')]);router[_0xbdb3('0xa')](_0xbdb3('0xd'),auth['isAuthenticated'](),controller[_0xbdb3('0xe')]);router[_0xbdb3('0xa')](_0xbdb3('0xf'),auth['isAuthenticated'](),controller[_0xbdb3('0x10')]);router[_0xbdb3('0xa')](_0xbdb3('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbdb3('0xa')]('/:id/teams',auth[_0xbdb3('0xb')](),controller['getTeams']);router[_0xbdb3('0xa')](_0xbdb3('0x12'),auth[_0xbdb3('0xb')](),controller['getAgents']);router['post']('/',auth[_0xbdb3('0xb')](),controller[_0xbdb3('0x13')]);router[_0xbdb3('0x14')](_0xbdb3('0x15'),auth['isAuthenticated'](),controller[_0xbdb3('0x16')]);router[_0xbdb3('0x14')]('/:id/users',auth[_0xbdb3('0xb')](),controller[_0xbdb3('0x17')]);router[_0xbdb3('0x18')](_0xbdb3('0xf'),auth[_0xbdb3('0xb')](),controller[_0xbdb3('0x19')]);router['delete'](_0xbdb3('0xf'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xbdb3('0x15'),auth[_0xbdb3('0xb')](),controller[_0xbdb3('0x1a')]);router[_0xbdb3('0x1b')]('/:id/users',auth[_0xbdb3('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x736b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express'];(function(_0x39eb1e,_0x2925c1){var _0x3b3aaa=function(_0x296e7b){while(--_0x296e7b){_0x39eb1e['push'](_0x39eb1e['shift']());}};_0x3b3aaa(++_0x2925c1);}(_0x736b,0x10a));var _0xb736=function(_0x203a98,_0x5eb746){_0x203a98=_0x203a98-0x0;var _0x12baa7=_0x736b[_0x203a98];return _0x12baa7;};'use strict';var multer=require('multer');var util=require(_0xb736('0x0'));var path=require(_0xb736('0x1'));var timeout=require(_0xb736('0x2'));var express=require(_0xb736('0x3'));var router=express[_0xb736('0x4')]();var fs_extra=require(_0xb736('0x5'));var auth=require(_0xb736('0x6'));var interaction=require(_0xb736('0x7'));var config=require('../../config/environment');var controller=require(_0xb736('0x8'));router[_0xb736('0x9')]('/',auth[_0xb736('0xa')](),controller[_0xb736('0xb')]);router[_0xb736('0x9')](_0xb736('0xc'),auth[_0xb736('0xa')](),controller['describe']);router[_0xb736('0x9')](_0xb736('0xd'),auth['isAuthenticated'](),controller[_0xb736('0xe')]);router['get'](_0xb736('0xf'),auth[_0xb736('0xa')](),controller['getMembers']);router['get'](_0xb736('0x10'),auth['isAuthenticated'](),controller[_0xb736('0x11')]);router[_0xb736('0x9')](_0xb736('0x12'),auth[_0xb736('0xa')](),controller[_0xb736('0x13')]);router[_0xb736('0x14')]('/',auth['isAuthenticated'](),controller[_0xb736('0x15')]);router[_0xb736('0x14')]('/:id/teams',auth[_0xb736('0xa')](),controller[_0xb736('0x16')]);router[_0xb736('0x14')]('/:id/users',auth[_0xb736('0xa')](),controller[_0xb736('0x17')]);router[_0xb736('0x18')]('/:id',auth[_0xb736('0xa')](),controller[_0xb736('0x19')]);router[_0xb736('0x1a')](_0xb736('0xd'),auth['isAuthenticated'](),controller[_0xb736('0x1b')]);router[_0xb736('0x1a')]('/:id/teams',auth[_0xb736('0xa')](),controller[_0xb736('0x1c')]);router[_0xb736('0x1a')](_0xb736('0x12'),auth[_0xb736('0xa')](),controller[_0xb736('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3da6b07..251330a 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 _0x1ca0=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0xa930c1,_0xe1865d){var _0x52ba84=function(_0x58e9ec){while(--_0x58e9ec){_0xa930c1['push'](_0xa930c1['shift']());}};_0x52ba84(++_0xe1865d);}(_0x1ca0,0x16f));var _0x01ca=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x1ca0[_0x4629ee];return _0x47fb5b;};'use strict';var Sequelize=require(_0x01ca('0x0'));module[_0x01ca('0x1')]={'name':{'type':Sequelize[_0x01ca('0x2')],'unique':_0x01ca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x01ca('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01ca('0x4')](_0x01ca('0x5'),_0x01ca('0x6'),_0x01ca('0x7'))}}; \ No newline at end of file +var _0xc574=['STRING','name','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x52a1e3,_0x4788a1){var _0x1b2ce4=function(_0x5a4a36){while(--_0x5a4a36){_0x52a1e3['push'](_0x52a1e3['shift']());}};_0x1b2ce4(++_0x4788a1);}(_0xc574,0x1e8));var _0x4c57=function(_0xbfa157,_0x5d332f){_0xbfa157=_0xbfa157-0x0;var _0x1510c8=_0xc574[_0xbfa157];return _0x1510c8;};'use strict';var Sequelize=require(_0x4c57('0x0'));module[_0x4c57('0x1')]={'name':{'type':Sequelize[_0x4c57('0x2')],'unique':_0x4c57('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4c57('0x2')]},'timeout':{'type':Sequelize[_0x4c57('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c57('0x5')]('rrmemory','beepall',_0x4c57('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e2c2779..857c7b1 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 _0x0e8d=['union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelQueue.socket','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','describe','findOne','UserOpenchannelQueue','length','hasOwnProperty','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','all'];(function(_0x2e17ee,_0x2ca16d){var _0x3155ba=function(_0x3e2f01){while(--_0x3e2f01){_0x2e17ee['push'](_0x2e17ee['shift']());}};_0x3155ba(++_0x2ca16d);}(_0x0e8d,0x117));var _0xd0e8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0e8d[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xd0e8('0x0'));var rimraf=require(_0xd0e8('0x1'));var zipdir=require(_0xd0e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0e8('0x3'));var moment=require(_0xd0e8('0x4'));var BPromise=require(_0xd0e8('0x5'));var Mustache=require(_0xd0e8('0x6'));var util=require(_0xd0e8('0x7'));var path=require(_0xd0e8('0x8'));var sox=require(_0xd0e8('0x9'));var csv=require(_0xd0e8('0xa'));var ejs=require(_0xd0e8('0xb'));var fs=require('fs');var fs_extra=require(_0xd0e8('0xc'));var _=require(_0xd0e8('0xd'));var squel=require('squel');var crypto=require(_0xd0e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd0e8('0xf'));var toCsv=require(_0xd0e8('0xa'));var querystring=require(_0xd0e8('0x10'));var Papa=require(_0xd0e8('0x11'));var Redis=require(_0xd0e8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd0e8('0x13'));var as=require(_0xd0e8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0e8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd0e8('0x16'));var licenseUtil=require(_0xd0e8('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd0e8('0x18')](config[_0xd0e8('0x19')],{'host':_0xd0e8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0e8('0x19')]));require(_0xd0e8('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a499a,_0x3d7f2f){_0x3d7f2f=_0x3d7f2f||0xcc;return function(_0x3769d2){if(_0x3769d2){return _0x1a499a[_0xd0e8('0x1c')](_0x3d7f2f);}return _0x1a499a[_0xd0e8('0x1d')](_0x3d7f2f)[_0xd0e8('0x1e')]();};}function respondWithResult(_0x5ac3df,_0x12fd14){_0x12fd14=_0x12fd14||0xc8;return function(_0xf5f359){if(_0xf5f359){return _0x5ac3df['status'](_0x12fd14)['json'](_0xf5f359);}};}function respondWithFilteredResult(_0x3e4ed1,_0x4332e1){return function(_0x583b35){if(_0x583b35){var _0x5a6bdf=typeof _0x4332e1[_0xd0e8('0x1f')]==='undefined'&&typeof _0x4332e1['limit']===_0xd0e8('0x20');var _0x31b5d6=_0x583b35['count'];var _0x2021e1=_0x5a6bdf?0x0:_0x4332e1['offset'];var _0x3f5112=_0x5a6bdf?_0x583b35['count']:_0x4332e1[_0xd0e8('0x1f')]+_0x4332e1[_0xd0e8('0x21')];var _0x459a7e;if(_0x3f5112>=_0x31b5d6){_0x3f5112=_0x31b5d6;_0x459a7e=0xc8;}else{_0x459a7e=0xce;}_0x3e4ed1[_0xd0e8('0x1d')](_0x459a7e);return _0x3e4ed1[_0xd0e8('0x22')](_0xd0e8('0x23'),_0x2021e1+'-'+_0x3f5112+'/'+_0x31b5d6)[_0xd0e8('0x24')](_0x583b35);}return null;};}function patchUpdates(_0x5f20ee){return function(_0x2cf485){try{jsonpatch[_0xd0e8('0x25')](_0x2cf485,_0x5f20ee,!![]);}catch(_0xbaae27){return BPromise[_0xd0e8('0x26')](_0xbaae27);}return _0x2cf485[_0xd0e8('0x27')]();};}function saveUpdates(_0x1ec48,_0x597cc2){return function(_0x34ae5c){if(_0x34ae5c){return _0x34ae5c['update'](_0x1ec48)['then'](function(_0x329d87){return _0x329d87;});}return null;};}function removeEntity(_0xdb7d60,_0xb6d0df){return function(_0x9526c5){if(_0x9526c5){return _0x9526c5[_0xd0e8('0x28')]()[_0xd0e8('0x29')](function(){var _0x2e9a57=_0x9526c5[_0xd0e8('0x2a')]({'plain':!![]});var _0x46a43=_0xd0e8('0x2b');return db['UserProfileResource'][_0xd0e8('0x28')]({'where':{'type':_0x46a43,'resourceId':_0x2e9a57['id']}})[_0xd0e8('0x29')](function(){return _0x9526c5;});})['then'](function(){_0xdb7d60[_0xd0e8('0x1d')](0xcc)[_0xd0e8('0x1e')]();});}};}function handleEntityNotFound(_0x420363,_0x367e0a){return function(_0x5d9070){if(!_0x5d9070){_0x420363[_0xd0e8('0x1c')](0x194);}return _0x5d9070;};}function handleError(_0x121eaf,_0x485f96){_0x485f96=_0x485f96||0x1f4;return function(_0x54d3fb){logger[_0xd0e8('0x2c')](_0x54d3fb[_0xd0e8('0x2d')]);if(_0x54d3fb[_0xd0e8('0x2e')]){delete _0x54d3fb[_0xd0e8('0x2e')];}_0x121eaf[_0xd0e8('0x1d')](_0x485f96)[_0xd0e8('0x2f')](_0x54d3fb);};}exports[_0xd0e8('0x30')]=function(_0x48499f,_0x44f5e0){var _0x1392b4={},_0x23ef37={},_0x47b22a={'count':0x0,'rows':[]};var _0x5156b5=_[_0xd0e8('0x31')](db[_0xd0e8('0x32')][_0xd0e8('0x33')],function(_0x5c71b9){return{'name':_0x5c71b9[_0xd0e8('0x34')],'type':_0x5c71b9[_0xd0e8('0x35')]['key']};});_0x23ef37[_0xd0e8('0x36')]=_[_0xd0e8('0x31')](_0x5156b5,_0xd0e8('0x2e'));_0x23ef37['query']=_[_0xd0e8('0x37')](_0x48499f[_0xd0e8('0x38')]);_0x23ef37[_0xd0e8('0x39')]=_[_0xd0e8('0x3a')](_0x23ef37[_0xd0e8('0x36')],_0x23ef37[_0xd0e8('0x38')]);_0x1392b4[_0xd0e8('0x3b')]=_[_0xd0e8('0x3a')](_0x23ef37[_0xd0e8('0x36')],qs['fields'](_0x48499f['query'][_0xd0e8('0x3c')]));_0x1392b4[_0xd0e8('0x3b')]=_0x1392b4[_0xd0e8('0x3b')]['length']?_0x1392b4['attributes']:_0x23ef37[_0xd0e8('0x36')];if(!_0x48499f[_0xd0e8('0x38')]['hasOwnProperty'](_0xd0e8('0x3d'))){_0x1392b4[_0xd0e8('0x21')]=qs['limit'](_0x48499f[_0xd0e8('0x38')]['limit']);_0x1392b4[_0xd0e8('0x1f')]=qs[_0xd0e8('0x1f')](_0x48499f[_0xd0e8('0x38')][_0xd0e8('0x1f')]);}_0x1392b4[_0xd0e8('0x3e')]=qs['sort'](_0x48499f[_0xd0e8('0x38')][_0xd0e8('0x3f')]);_0x1392b4[_0xd0e8('0x40')]=qs[_0xd0e8('0x39')](_[_0xd0e8('0x41')](_0x48499f[_0xd0e8('0x38')],_0x23ef37[_0xd0e8('0x39')]),_0x5156b5);if(_0x48499f[_0xd0e8('0x38')][_0xd0e8('0x42')]){_0x1392b4['where']=_[_0xd0e8('0x43')](_0x1392b4[_0xd0e8('0x40')],{'$or':_[_0xd0e8('0x31')](_0x5156b5,function(_0x5a2fff){if(_0x5a2fff[_0xd0e8('0x35')]!==_0xd0e8('0x44')){var _0x47f4d5={};_0x47f4d5[_0x5a2fff[_0xd0e8('0x2e')]]={'$like':'%'+_0x48499f[_0xd0e8('0x38')]['filter']+'%'};return _0x47f4d5;}})});}_0x1392b4=_[_0xd0e8('0x43')]({},_0x1392b4,_0x48499f['options']);var _0x5e6078={'where':_0x1392b4[_0xd0e8('0x40')]};return db['OpenchannelQueue'][_0xd0e8('0x45')](_0x5e6078)[_0xd0e8('0x29')](function(_0x4bd807){_0x47b22a[_0xd0e8('0x45')]=_0x4bd807;if(_0x48499f[_0xd0e8('0x38')][_0xd0e8('0x46')]){_0x1392b4[_0xd0e8('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xd0e8('0x48')](_0x1392b4);})[_0xd0e8('0x29')](function(_0x365b5e){_0x47b22a[_0xd0e8('0x49')]=_0x365b5e;return _0x47b22a;})[_0xd0e8('0x29')](respondWithFilteredResult(_0x44f5e0,_0x1392b4))[_0xd0e8('0x4a')](handleError(_0x44f5e0,null));};exports['show']=function(_0x334072,_0xe5917f){var _0x116cd4={'raw':!![],'where':{'id':_0x334072[_0xd0e8('0x4b')]['id']}},_0xe0736f={};_0xe0736f[_0xd0e8('0x36')]=_[_0xd0e8('0x37')](db['OpenchannelQueue'][_0xd0e8('0x33')]);_0xe0736f[_0xd0e8('0x38')]=_[_0xd0e8('0x37')](_0x334072[_0xd0e8('0x38')]);_0xe0736f[_0xd0e8('0x39')]=_[_0xd0e8('0x3a')](_0xe0736f[_0xd0e8('0x36')],_0xe0736f[_0xd0e8('0x38')]);_0x116cd4[_0xd0e8('0x3b')]=_[_0xd0e8('0x3a')](_0xe0736f[_0xd0e8('0x36')],qs[_0xd0e8('0x3c')](_0x334072[_0xd0e8('0x38')]['fields']));_0x116cd4[_0xd0e8('0x3b')]=_0x116cd4[_0xd0e8('0x3b')]['length']?_0x116cd4['attributes']:_0xe0736f[_0xd0e8('0x36')];if(_0x334072[_0xd0e8('0x38')][_0xd0e8('0x46')]){_0x116cd4[_0xd0e8('0x47')]=[{'all':!![]}];}_0x116cd4=_[_0xd0e8('0x43')]({},_0x116cd4,_0x334072[_0xd0e8('0x4c')]);return db[_0xd0e8('0x32')][_0xd0e8('0x4d')](_0x116cd4)[_0xd0e8('0x29')](handleEntityNotFound(_0xe5917f,null))[_0xd0e8('0x29')](respondWithResult(_0xe5917f,null))[_0xd0e8('0x4a')](handleError(_0xe5917f,null));};exports[_0xd0e8('0x4e')]=function(_0x58d5b0,_0x5fec77){return db[_0xd0e8('0x32')][_0xd0e8('0x4e')](_0x58d5b0[_0xd0e8('0x4f')],{})[_0xd0e8('0x29')](function(_0x48775b){var _0x1d0ab6=_0x58d5b0[_0xd0e8('0x50')][_0xd0e8('0x2a')]({'plain':!![]});if(!_0x1d0ab6)throw new Error(_0xd0e8('0x51'));if(_0x1d0ab6['role']===_0xd0e8('0x50')){var _0x4daad3=_0x48775b[_0xd0e8('0x2a')]({'plain':!![]});var _0x2bd646='OpenchannelQueues';return db[_0xd0e8('0x52')]['find']({'where':{'name':_0x2bd646,'userProfileId':_0x1d0ab6[_0xd0e8('0x53')]},'raw':!![]})['then'](function(_0xad47f3){if(_0xad47f3&&_0xad47f3[_0xd0e8('0x54')]===0x0){return db[_0xd0e8('0x55')][_0xd0e8('0x4e')]({'name':_0x4daad3[_0xd0e8('0x2e')],'resourceId':_0x4daad3['id'],'type':_0xad47f3[_0xd0e8('0x2e')],'sectionId':_0xad47f3['id']},{})[_0xd0e8('0x29')](function(){return _0x48775b;});}else{return _0x48775b;}})['catch'](function(_0x555dd6){logger[_0xd0e8('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x555dd6);throw _0x555dd6;});}return _0x48775b;})[_0xd0e8('0x29')](respondWithResult(_0x5fec77,0xc9))[_0xd0e8('0x4a')](handleError(_0x5fec77,null));};exports[_0xd0e8('0x56')]=function(_0x546656,_0x2d0dd3){if(_0x546656['body']['id']){delete _0x546656[_0xd0e8('0x4f')]['id'];}return db[_0xd0e8('0x32')][_0xd0e8('0x4d')]({'where':{'id':_0x546656[_0xd0e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d0dd3,null))[_0xd0e8('0x29')](saveUpdates(_0x546656['body'],null))[_0xd0e8('0x29')](respondWithResult(_0x2d0dd3,null))[_0xd0e8('0x4a')](handleError(_0x2d0dd3,null));};exports[_0xd0e8('0x28')]=function(_0x13f3f3,_0x2f3a48){return db[_0xd0e8('0x32')][_0xd0e8('0x4d')]({'where':{'id':_0x13f3f3[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0x2f3a48,null))[_0xd0e8('0x29')](removeEntity(_0x2f3a48,null))['catch'](handleError(_0x2f3a48,null));};exports[_0xd0e8('0x57')]=function(_0x2eea8a,_0x4ed6c7){return db['OpenchannelQueue']['describe']()[_0xd0e8('0x29')](respondWithResult(_0x4ed6c7,null))[_0xd0e8('0x4a')](handleError(_0x4ed6c7,null));};exports['getMembers']=function(_0x58bd0b,_0x1049e1,_0x49c4bb){var _0x1ddf55={'raw':!![],'where':{}},_0x58cecd={},_0xac957d;return db['OpenchannelQueue'][_0xd0e8('0x58')]({'where':{'id':_0x58bd0b[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0x1049e1,null))[_0xd0e8('0x29')](function(_0x5da0a3){if(_0x5da0a3){_0xac957d=_0x5da0a3[_0xd0e8('0x2a')]({'plain':!![]});_0x58cecd[_0xd0e8('0x36')]=_[_0xd0e8('0x37')](db[_0xd0e8('0x59')]['rawAttributes']);_0x58cecd[_0xd0e8('0x38')]=_[_0xd0e8('0x37')](_0x58bd0b[_0xd0e8('0x38')]);_0x58cecd[_0xd0e8('0x39')]=_[_0xd0e8('0x3a')](_0x58cecd[_0xd0e8('0x36')],_0x58cecd[_0xd0e8('0x38')]);_0x1ddf55[_0xd0e8('0x3b')]=_['intersection'](_0x58cecd[_0xd0e8('0x36')],qs[_0xd0e8('0x3c')](_0x58bd0b[_0xd0e8('0x38')]['fields']));_0x1ddf55[_0xd0e8('0x3b')]=_0x1ddf55['attributes'][_0xd0e8('0x5a')]?_0x1ddf55[_0xd0e8('0x3b')]:_0x58cecd[_0xd0e8('0x36')];if(!_0x58bd0b['query'][_0xd0e8('0x5b')](_0xd0e8('0x3d'))){_0x1ddf55[_0xd0e8('0x21')]=qs['limit'](_0x58bd0b[_0xd0e8('0x38')][_0xd0e8('0x21')]);_0x1ddf55['offset']=qs[_0xd0e8('0x1f')](_0x58bd0b[_0xd0e8('0x38')][_0xd0e8('0x1f')]);}_0x1ddf55[_0xd0e8('0x3e')]=qs[_0xd0e8('0x3f')](_0x58bd0b[_0xd0e8('0x38')][_0xd0e8('0x3f')]);_0x1ddf55['where']=qs[_0xd0e8('0x39')](_[_0xd0e8('0x41')](_0x58bd0b[_0xd0e8('0x38')],_0x58cecd[_0xd0e8('0x39')]));_0x1ddf55[_0xd0e8('0x40')]['OpenchannelQueueId']=_0x5da0a3['id'];if(_0x58bd0b[_0xd0e8('0x38')]['filter']){_0x1ddf55[_0xd0e8('0x40')]=_['merge'](_0x1ddf55[_0xd0e8('0x40')],{'$or':_['map'](_0x1ddf55[_0xd0e8('0x3b')],function(_0xd5c2a1){var _0x2d4700={};_0x2d4700[_0xd5c2a1]={'$like':'%'+_0x58bd0b[_0xd0e8('0x38')][_0xd0e8('0x42')]+'%'};return _0x2d4700;})});}_0x1ddf55=_[_0xd0e8('0x43')]({},_0x1ddf55,_0x58bd0b[_0xd0e8('0x4c')]);return db['UserOpenchannelQueue'][_0xd0e8('0x48')](_0x1ddf55);}})[_0xd0e8('0x29')](function(_0x10d679){if(_0x10d679){return db[_0xd0e8('0x5c')]['findAndCountAll']({'where':{'id':_[_0xd0e8('0x31')](_0x10d679,_0xd0e8('0x5d')),'role':_0xd0e8('0x5e')},'attributes':['id','name',_0xd0e8('0x5f'),_0xd0e8('0x60'),'createdAt']});}})[_0xd0e8('0x29')](function(_0x2e9904){if(_0x2e9904){return{'count':_0x2e9904[_0xd0e8('0x45')],'rows':_[_0xd0e8('0x31')](_0x2e9904[_0xd0e8('0x49')],function(_0x18db04){return{'membername':_0x18db04[_0xd0e8('0x2e')],'UserId':_0x18db04['id'],'queue_name':_0xac957d[_0xd0e8('0x2e')],'OpenchannelQueueId':_0xac957d['id'],'interface':util[_0xd0e8('0x61')](_0xd0e8('0x62'),'SIP',_0x18db04[_0xd0e8('0x2e')]),'penalty':0x0,'paused':_0x18db04['openchannelPause'],'createdAt':_0x18db04[_0xd0e8('0x63')],'updatedAt':_0x18db04[_0xd0e8('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1049e1,_0x1ddf55))[_0xd0e8('0x4a')](handleError(_0x1049e1,null));};exports[_0xd0e8('0x64')]=function(_0x2bd221,_0xcf548c,_0x4ae9a4){var _0x4cc703={};var _0x59d3ae={};var _0x2744a7;var _0x27d157;return db[_0xd0e8('0x32')][_0xd0e8('0x58')]({'where':{'id':_0x2bd221[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0xcf548c,null))[_0xd0e8('0x29')](function(_0x2307eb){if(_0x2307eb){_0x2744a7=_0x2307eb;_0x59d3ae['model']=_[_0xd0e8('0x37')](db['Team'][_0xd0e8('0x33')]);_0x59d3ae[_0xd0e8('0x38')]=_[_0xd0e8('0x37')](_0x2bd221[_0xd0e8('0x38')]);_0x59d3ae[_0xd0e8('0x39')]=_[_0xd0e8('0x3a')](_0x59d3ae['model'],_0x59d3ae[_0xd0e8('0x38')]);_0x4cc703['attributes']=_[_0xd0e8('0x3a')](_0x59d3ae['model'],qs[_0xd0e8('0x3c')](_0x2bd221['query']['fields']));_0x4cc703[_0xd0e8('0x3b')]=_0x4cc703['attributes'][_0xd0e8('0x5a')]?_0x4cc703['attributes']:_0x59d3ae[_0xd0e8('0x36')];_0x4cc703[_0xd0e8('0x3e')]=qs[_0xd0e8('0x3f')](_0x2bd221[_0xd0e8('0x38')][_0xd0e8('0x3f')]);_0x4cc703[_0xd0e8('0x40')]=qs[_0xd0e8('0x39')](_['pick'](_0x2bd221[_0xd0e8('0x38')],_0x59d3ae[_0xd0e8('0x39')]));if(_0x2bd221[_0xd0e8('0x38')][_0xd0e8('0x42')]){_0x4cc703[_0xd0e8('0x40')]=_[_0xd0e8('0x43')](_0x4cc703[_0xd0e8('0x40')],{'$or':_['map'](_0x4cc703['attributes'],function(_0xfd92a7){var _0x207299={};_0x207299[_0xfd92a7]={'$like':'%'+_0x2bd221[_0xd0e8('0x38')][_0xd0e8('0x42')]+'%'};return _0x207299;})});}_0x4cc703=_[_0xd0e8('0x43')]({},_0x4cc703,_0x2bd221['options']);return _0x2744a7[_0xd0e8('0x64')](_0x4cc703);}})[_0xd0e8('0x29')](function(_0x306768){if(_0x306768){_0x27d157=_0x306768['length'];if(!_0x2bd221[_0xd0e8('0x38')][_0xd0e8('0x5b')](_0xd0e8('0x3d'))){_0x4cc703[_0xd0e8('0x21')]=qs[_0xd0e8('0x21')](_0x2bd221[_0xd0e8('0x38')]['limit']);_0x4cc703[_0xd0e8('0x1f')]=qs[_0xd0e8('0x1f')](_0x2bd221[_0xd0e8('0x38')]['offset']);}return _0x2744a7[_0xd0e8('0x64')](_0x4cc703);}})[_0xd0e8('0x29')](function(_0x24ce19){if(_0x24ce19){return _0x24ce19?{'count':_0x27d157,'rows':_0x24ce19}:null;}})[_0xd0e8('0x29')](respondWithResult(_0xcf548c,null))[_0xd0e8('0x4a')](handleError(_0xcf548c,null));};exports[_0xd0e8('0x65')]=function(_0x5ebf39,_0x2a3bd2,_0x5aacc9){var _0x2fb6d9=_0x5ebf39[_0xd0e8('0x4f')][_0xd0e8('0x66')];return db[_0xd0e8('0x67')][_0xd0e8('0x48')]({'where':{'id':_0x2fb6d9},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd0e8('0x68'),'attributes':['id',_0xd0e8('0x2e'),_0xd0e8('0x69'),_0xd0e8('0x6a'),_0xd0e8('0x6b')],'raw':!![]}]})[_0xd0e8('0x29')](function(_0x321cc9){if(_0x321cc9){var _0x3cb645=_['flatMap'](_0x321cc9,function(_0x23fede){var _0x27faf8=_0x23fede['get']({'plain':!![]});return _0x27faf8['Agents'];});return db[_0xd0e8('0x32')][_0xd0e8('0x4d')]({'where':{'id':_0x5ebf39['params']['id']}})['then'](function(_0x300170){return db[_0xd0e8('0x6c')][_0xd0e8('0x6d')](function(_0x28699e){return _0x300170[_0xd0e8('0x65')](_0x2fb6d9,{'transaction':_0x28699e})['then'](function(){return BPromise['each'](_0x3cb645,function(_0x349779){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x349779['id'],'OpenchannelQueueId':_0x5ebf39['params']['id']},'transaction':_0x28699e});});})[_0xd0e8('0x29')](function(){_0x3cb645[_0xd0e8('0x6e')](function(_0x40aed8){socket[_0xd0e8('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x40aed8['id'],'OpenchannelQueueId':_0x300170['id']});});});});});}})[_0xd0e8('0x29')](respondWithStatusCode(_0x2a3bd2,null))['catch'](handleError(_0x2a3bd2,null));};exports[_0xd0e8('0x70')]=function(_0x4ea949,_0x39bbd1,_0x1748df){return db[_0xd0e8('0x67')][_0xd0e8('0x48')]({'where':{'id':_0x4ea949['query'][_0xd0e8('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd0e8('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd0e8('0x29')](handleEntityNotFound(_0x39bbd1,null))[_0xd0e8('0x29')](function(_0x382ade){var _0x16d958=_[_0xd0e8('0x31')](_0x382ade,'id');var _0x508acf=[];var _0x196ea5=[];var _0x580484=squel[_0xd0e8('0x71')]();_0x580484[_0xd0e8('0x72')](_0xd0e8('0x73'))[_0xd0e8('0x74')](_0xd0e8('0x75'),'tq')['join'](_0xd0e8('0x76'),'ut',_0xd0e8('0x77'))[_0xd0e8('0x40')](_0xd0e8('0x78'),_0x4ea949[_0xd0e8('0x4b')]['id']);for(var _0x2b1050=0x0;_0x2b1050<_0x382ade['length'];_0x2b1050+=0x1){let _0x424496=_0x382ade[_0x2b1050];for(var _0x1be7df=0x0;_0x1be7df<_0x424496[_0xd0e8('0x68')][_0xd0e8('0x5a')];_0x1be7df+=0x1){let _0x350353=_0x424496['Agents'][_0x1be7df];var _0x876764=_0x580484[_0xd0e8('0x79')]();_0x876764['where'](_0xd0e8('0x7a'),_0x350353['id']);_0x196ea5['push'](db[_0xd0e8('0x6c')][_0xd0e8('0x38')](_0x876764[_0xd0e8('0x7b')](),{'type':db[_0xd0e8('0x6c')]['QueryTypes']['SELECT']})[_0xd0e8('0x29')](function(_0x1fe988){if(_0x1fe988[_0xd0e8('0x5a')]===0x1){return _0x350353['id'];}else{var _0x348520=_[_0xd0e8('0x7c')](_['map'](_0x1fe988,'TeamId'),function(_0xec319d){return _['includes'](_0x16d958,_0xec319d);});if(_0x348520){return _0x350353['id'];}}}));}}return BPromise[_0xd0e8('0x7d')](_0x196ea5)[_0xd0e8('0x29')](function(_0x44915f){_0x508acf=_(_0x508acf)[_0xd0e8('0x7e')](_0x44915f)['compact']()[_0xd0e8('0x7f')]();return db[_0xd0e8('0x32')][_0xd0e8('0x4d')]({'where':{'id':_0x4ea949[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](function(_0x4f0097){return db[_0xd0e8('0x6c')][_0xd0e8('0x6d')](function(_0x666d4c){return _0x4f0097[_0xd0e8('0x70')](_0x4ea949[_0xd0e8('0x38')][_0xd0e8('0x66')],{'transaction':_0x666d4c})[_0xd0e8('0x29')](function(){if(!_[_0xd0e8('0x80')](_0x508acf)){return _0x4f0097[_0xd0e8('0x81')](_0x508acf,{'transaction':_0x666d4c});}})[_0xd0e8('0x29')](function(){_0x508acf[_0xd0e8('0x6e')](function(_0x374c13){socket['emit'](_0xd0e8('0x82'),{'UserId':_0x374c13,'OpenchannelQueueId':_0x4f0097['id']});});});});});});})['then'](respondWithStatusCode(_0x39bbd1,null))[_0xd0e8('0x4a')](handleError(_0x39bbd1,null));};exports['addAgents']=function(_0xba1643,_0x4b8a77,_0x1d558a){return db[_0xd0e8('0x32')]['find']({'where':{'id':_0xba1643[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0x4b8a77,null))[_0xd0e8('0x29')](function(_0x49f5e3){if(_0x49f5e3){return _0x49f5e3[_0xd0e8('0x83')](_0xba1643['body'][_0xd0e8('0x66')],_['omit'](_0xba1643['body'],['ids','id'])||{})['spread'](function(_0x42011e){for(var _0x4b81de=0x0;_0x4b81de<_0xba1643[_0xd0e8('0x4f')][_0xd0e8('0x66')][_0xd0e8('0x5a')];_0x4b81de+=0x1){socket[_0xd0e8('0x6f')](_0xd0e8('0x84'),{'UserId':Number(_0xba1643[_0xd0e8('0x4f')][_0xd0e8('0x66')][_0x4b81de]),'OpenchannelQueueId':Number(_0xba1643[_0xd0e8('0x4b')]['id'])});}return _0x42011e;});}})[_0xd0e8('0x29')](respondWithResult(_0x4b8a77,null))['catch'](handleError(_0x4b8a77,null));};exports[_0xd0e8('0x81')]=function(_0x32f2d0,_0x146cb3,_0x106bd3){return db[_0xd0e8('0x32')][_0xd0e8('0x4d')]({'where':{'id':_0x32f2d0[_0xd0e8('0x4b')]['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0x146cb3,null))[_0xd0e8('0x29')](function(_0x2fe256){if(_0x2fe256){return _0x2fe256[_0xd0e8('0x81')](_0x32f2d0[_0xd0e8('0x38')][_0xd0e8('0x66')])[_0xd0e8('0x29')](function(){if(_[_0xd0e8('0x85')](_0x32f2d0[_0xd0e8('0x38')][_0xd0e8('0x66')])){for(var _0x145942=0x0;_0x145942<_0x32f2d0['query']['ids'][_0xd0e8('0x5a')];_0x145942+=0x1){socket[_0xd0e8('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x32f2d0[_0xd0e8('0x38')][_0xd0e8('0x66')][_0x145942]),'OpenchannelQueueId':Number(_0x32f2d0['params']['id'])});}}else{socket[_0xd0e8('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x32f2d0[_0xd0e8('0x38')][_0xd0e8('0x66')]),'OpenchannelQueueId':Number(_0x32f2d0[_0xd0e8('0x4b')]['id'])});}});}})[_0xd0e8('0x29')](respondWithStatusCode(_0x146cb3,null))['catch'](handleError(_0x146cb3,null));};exports[_0xd0e8('0x86')]=function(_0x2efc2d,_0x57f9fe,_0x3ab8cc){var _0x32dc42={};var _0x5653a8={};var _0x298793;var _0x7173a6;return db['OpenchannelQueue'][_0xd0e8('0x58')]({'where':{'id':_0x2efc2d['params']['id']}})[_0xd0e8('0x29')](handleEntityNotFound(_0x57f9fe,null))[_0xd0e8('0x29')](function(_0xe1d0a0){if(_0xe1d0a0){_0x298793=_0xe1d0a0;_0x5653a8[_0xd0e8('0x36')]=_[_0xd0e8('0x37')](db[_0xd0e8('0x5c')]['rawAttributes']);_0x5653a8[_0xd0e8('0x38')]=_[_0xd0e8('0x37')](_0x2efc2d[_0xd0e8('0x38')]);_0x5653a8[_0xd0e8('0x39')]=_[_0xd0e8('0x3a')](_0x5653a8[_0xd0e8('0x36')],_0x5653a8[_0xd0e8('0x38')]);_0x32dc42[_0xd0e8('0x3b')]=_[_0xd0e8('0x3a')](_0x5653a8[_0xd0e8('0x36')],qs[_0xd0e8('0x3c')](_0x2efc2d[_0xd0e8('0x38')]['fields']));_0x32dc42[_0xd0e8('0x3b')]=_0x32dc42['attributes']['length']?_0x32dc42[_0xd0e8('0x3b')]:_0x5653a8[_0xd0e8('0x36')];_0x32dc42['order']=qs[_0xd0e8('0x3f')](_0x2efc2d['query'][_0xd0e8('0x3f')]);_0x32dc42[_0xd0e8('0x40')]=qs[_0xd0e8('0x39')](_[_0xd0e8('0x41')](_0x2efc2d[_0xd0e8('0x38')],_0x5653a8['filters']));if(_0x2efc2d[_0xd0e8('0x38')][_0xd0e8('0x42')]){_0x32dc42[_0xd0e8('0x40')]=_[_0xd0e8('0x43')](_0x32dc42['where'],{'$or':_[_0xd0e8('0x31')](_0x32dc42[_0xd0e8('0x3b')],function(_0x2ad156){var _0x134589={};_0x134589[_0x2ad156]={'$like':'%'+_0x2efc2d[_0xd0e8('0x38')]['filter']+'%'};return _0x134589;})});}_0x32dc42=_[_0xd0e8('0x43')]({},_0x32dc42,_0x2efc2d[_0xd0e8('0x4c')]);return _0x298793['getAgents'](_0x32dc42);}})[_0xd0e8('0x29')](function(_0x38baac){if(_0x38baac){_0x7173a6=_0x38baac['length'];if(!_0x2efc2d[_0xd0e8('0x38')][_0xd0e8('0x5b')](_0xd0e8('0x3d'))){_0x32dc42['limit']=qs[_0xd0e8('0x21')](_0x2efc2d[_0xd0e8('0x38')][_0xd0e8('0x21')]);_0x32dc42[_0xd0e8('0x1f')]=qs['offset'](_0x2efc2d[_0xd0e8('0x38')][_0xd0e8('0x1f')]);}return _0x298793[_0xd0e8('0x86')](_0x32dc42);}})[_0xd0e8('0x29')](function(_0x46c537){if(_0x46c537){return _0x46c537?{'count':_0x7173a6,'rows':_0x46c537}:null;}})[_0xd0e8('0x29')](respondWithResult(_0x57f9fe,null))[_0xd0e8('0x4a')](handleError(_0x57f9fe,null));}; \ No newline at end of file +var _0xb454=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','undefined','count','set','reject','update','then','destroy','get','OpenchannelQueues','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','OpenchannelQueue','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','sequelize','transaction','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs'];(function(_0x396db0,_0x510b7d){var _0x11bc3c=function(_0x1ada79){while(--_0x1ada79){_0x396db0['push'](_0x396db0['shift']());}};_0x11bc3c(++_0x510b7d);}(_0xb454,0x19e));var _0x4b45=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xb454[_0x53c4f8];return _0x416458;};'use strict';var emlformat=require(_0x4b45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b45('0x1'));var jsonpatch=require(_0x4b45('0x2'));var rp=require(_0x4b45('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4b45('0x4'));var path=require(_0x4b45('0x5'));var sox=require(_0x4b45('0x6'));var csv=require(_0x4b45('0x7'));var ejs=require(_0x4b45('0x8'));var fs=require('fs');var fs_extra=require(_0x4b45('0x9'));var _=require(_0x4b45('0xa'));var squel=require(_0x4b45('0xb'));var crypto=require('crypto');var jsforce=require(_0x4b45('0xc'));var deskjs=require(_0x4b45('0xd'));var toCsv=require(_0x4b45('0x7'));var querystring=require(_0x4b45('0xe'));var Papa=require(_0x4b45('0xf'));var Redis=require(_0x4b45('0x10'));var authService=require(_0x4b45('0x11'));var qs=require(_0x4b45('0x12'));var as=require(_0x4b45('0x13'));var hardwareService=require(_0x4b45('0x14'));var logger=require('../../config/logger')(_0x4b45('0x15'));var utils=require(_0x4b45('0x16'));var config=require(_0x4b45('0x17'));var licenseUtil=require(_0x4b45('0x18'));var db=require(_0x4b45('0x19'))['db'];config[_0x4b45('0x1a')]=_[_0x4b45('0x1b')](config[_0x4b45('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b45('0x1c'))(new Redis(config['redis']));require(_0x4b45('0x1d'))[_0x4b45('0x1e')](socket);function respondWithStatusCode(_0x2dfd13,_0x306a68){_0x306a68=_0x306a68||0xcc;return function(_0x58d88c){if(_0x58d88c){return _0x2dfd13['sendStatus'](_0x306a68);}return _0x2dfd13[_0x4b45('0x1f')](_0x306a68)[_0x4b45('0x20')]();};}function respondWithResult(_0x23d866,_0x27b2be){_0x27b2be=_0x27b2be||0xc8;return function(_0x320dfd){if(_0x320dfd){return _0x23d866['status'](_0x27b2be)[_0x4b45('0x21')](_0x320dfd);}};}function respondWithFilteredResult(_0x5ebb4e,_0x357d1f){return function(_0x5963f7){if(_0x5963f7){var _0xd4da7d=typeof _0x357d1f[_0x4b45('0x22')]==='undefined'&&typeof _0x357d1f[_0x4b45('0x23')]===_0x4b45('0x24');var _0x5b4e60=_0x5963f7['count'];var _0x4d2a93=_0xd4da7d?0x0:_0x357d1f[_0x4b45('0x22')];var _0x23ea64=_0xd4da7d?_0x5963f7[_0x4b45('0x25')]:_0x357d1f['offset']+_0x357d1f[_0x4b45('0x23')];var _0x4eaa96;if(_0x23ea64>=_0x5b4e60){_0x23ea64=_0x5b4e60;_0x4eaa96=0xc8;}else{_0x4eaa96=0xce;}_0x5ebb4e[_0x4b45('0x1f')](_0x4eaa96);return _0x5ebb4e[_0x4b45('0x26')]('Content-Range',_0x4d2a93+'-'+_0x23ea64+'/'+_0x5b4e60)['json'](_0x5963f7);}return null;};}function patchUpdates(_0x467f8e){return function(_0x34fab7){try{jsonpatch['apply'](_0x34fab7,_0x467f8e,!![]);}catch(_0x33bccb){return BPromise[_0x4b45('0x27')](_0x33bccb);}return _0x34fab7['save']();};}function saveUpdates(_0x4ce6e0,_0x23dac2){return function(_0x5763d7){if(_0x5763d7){return _0x5763d7[_0x4b45('0x28')](_0x4ce6e0)[_0x4b45('0x29')](function(_0x21ca3e){return _0x21ca3e;});}return null;};}function removeEntity(_0x2becfa,_0x3f2463){return function(_0x54e7f2){if(_0x54e7f2){return _0x54e7f2[_0x4b45('0x2a')]()[_0x4b45('0x29')](function(){var _0x5fb890=_0x54e7f2[_0x4b45('0x2b')]({'plain':!![]});var _0x14926e=_0x4b45('0x2c');return db['UserProfileResource'][_0x4b45('0x2a')]({'where':{'type':_0x14926e,'resourceId':_0x5fb890['id']}})['then'](function(){return _0x54e7f2;});})[_0x4b45('0x29')](function(){_0x2becfa[_0x4b45('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483d93,_0x3a2e23){return function(_0x1f2124){if(!_0x1f2124){_0x483d93['sendStatus'](0x194);}return _0x1f2124;};}function handleError(_0x354cf9,_0x30f06c){_0x30f06c=_0x30f06c||0x1f4;return function(_0x21abc3){logger[_0x4b45('0x2d')](_0x21abc3[_0x4b45('0x2e')]);if(_0x21abc3['name']){delete _0x21abc3[_0x4b45('0x2f')];}_0x354cf9[_0x4b45('0x1f')](_0x30f06c)[_0x4b45('0x30')](_0x21abc3);};}exports['index']=function(_0x37d72d,_0x585c92){var _0x5b2743={},_0x5570b0={},_0x31af18={'count':0x0,'rows':[]};var _0x361788=_[_0x4b45('0x31')](db['OpenchannelQueue'][_0x4b45('0x32')],function(_0x2be150){return{'name':_0x2be150[_0x4b45('0x33')],'type':_0x2be150['type'][_0x4b45('0x34')]};});_0x5570b0['model']=_[_0x4b45('0x31')](_0x361788,'name');_0x5570b0[_0x4b45('0x35')]=_[_0x4b45('0x36')](_0x37d72d[_0x4b45('0x35')]);_0x5570b0[_0x4b45('0x37')]=_[_0x4b45('0x38')](_0x5570b0[_0x4b45('0x39')],_0x5570b0[_0x4b45('0x35')]);_0x5b2743[_0x4b45('0x3a')]=_['intersection'](_0x5570b0['model'],qs[_0x4b45('0x3b')](_0x37d72d[_0x4b45('0x35')]['fields']));_0x5b2743['attributes']=_0x5b2743[_0x4b45('0x3a')][_0x4b45('0x3c')]?_0x5b2743['attributes']:_0x5570b0[_0x4b45('0x39')];if(!_0x37d72d[_0x4b45('0x35')][_0x4b45('0x3d')](_0x4b45('0x3e'))){_0x5b2743[_0x4b45('0x23')]=qs['limit'](_0x37d72d[_0x4b45('0x35')]['limit']);_0x5b2743[_0x4b45('0x22')]=qs[_0x4b45('0x22')](_0x37d72d[_0x4b45('0x35')][_0x4b45('0x22')]);}_0x5b2743[_0x4b45('0x3f')]=qs[_0x4b45('0x40')](_0x37d72d[_0x4b45('0x35')]['sort']);_0x5b2743['where']=qs['filters'](_[_0x4b45('0x41')](_0x37d72d[_0x4b45('0x35')],_0x5570b0['filters']),_0x361788);if(_0x37d72d[_0x4b45('0x35')][_0x4b45('0x42')]){_0x5b2743[_0x4b45('0x43')]=_[_0x4b45('0x44')](_0x5b2743[_0x4b45('0x43')],{'$or':_[_0x4b45('0x31')](_0x361788,function(_0x48909c){if(_0x48909c[_0x4b45('0x45')]!==_0x4b45('0x46')){var _0x388942={};_0x388942[_0x48909c[_0x4b45('0x2f')]]={'$like':'%'+_0x37d72d[_0x4b45('0x35')][_0x4b45('0x42')]+'%'};return _0x388942;}})});}_0x5b2743=_[_0x4b45('0x44')]({},_0x5b2743,_0x37d72d[_0x4b45('0x47')]);var _0x4565b7={'where':_0x5b2743['where']};return db['OpenchannelQueue'][_0x4b45('0x25')](_0x4565b7)[_0x4b45('0x29')](function(_0x392b97){_0x31af18[_0x4b45('0x25')]=_0x392b97;if(_0x37d72d[_0x4b45('0x35')][_0x4b45('0x48')]){_0x5b2743[_0x4b45('0x49')]=[{'all':!![]}];}return db[_0x4b45('0x4a')][_0x4b45('0x4b')](_0x5b2743);})[_0x4b45('0x29')](function(_0x21bdb0){_0x31af18[_0x4b45('0x4c')]=_0x21bdb0;return _0x31af18;})[_0x4b45('0x29')](respondWithFilteredResult(_0x585c92,_0x5b2743))[_0x4b45('0x4d')](handleError(_0x585c92,null));};exports[_0x4b45('0x4e')]=function(_0x4f1a85,_0x96f775){var _0x2a4779={'raw':!![],'where':{'id':_0x4f1a85[_0x4b45('0x4f')]['id']}},_0x589cc7={};_0x589cc7[_0x4b45('0x39')]=_[_0x4b45('0x36')](db['OpenchannelQueue'][_0x4b45('0x32')]);_0x589cc7['query']=_[_0x4b45('0x36')](_0x4f1a85[_0x4b45('0x35')]);_0x589cc7[_0x4b45('0x37')]=_[_0x4b45('0x38')](_0x589cc7[_0x4b45('0x39')],_0x589cc7[_0x4b45('0x35')]);_0x2a4779['attributes']=_[_0x4b45('0x38')](_0x589cc7[_0x4b45('0x39')],qs[_0x4b45('0x3b')](_0x4f1a85[_0x4b45('0x35')][_0x4b45('0x3b')]));_0x2a4779['attributes']=_0x2a4779['attributes'][_0x4b45('0x3c')]?_0x2a4779['attributes']:_0x589cc7[_0x4b45('0x39')];if(_0x4f1a85['query'][_0x4b45('0x48')]){_0x2a4779[_0x4b45('0x49')]=[{'all':!![]}];}_0x2a4779=_['merge']({},_0x2a4779,_0x4f1a85[_0x4b45('0x47')]);return db['OpenchannelQueue'][_0x4b45('0x50')](_0x2a4779)[_0x4b45('0x29')](handleEntityNotFound(_0x96f775,null))['then'](respondWithResult(_0x96f775,null))[_0x4b45('0x4d')](handleError(_0x96f775,null));};exports[_0x4b45('0x51')]=function(_0x45d4f2,_0x4484eb){return db[_0x4b45('0x4a')][_0x4b45('0x51')](_0x45d4f2['body'],{})[_0x4b45('0x29')](function(_0x553312){var _0x58bbf0=_0x45d4f2[_0x4b45('0x52')][_0x4b45('0x2b')]({'plain':!![]});if(!_0x58bbf0)throw new Error(_0x4b45('0x53'));if(_0x58bbf0['role']===_0x4b45('0x52')){var _0x11ee0d=_0x553312[_0x4b45('0x2b')]({'plain':!![]});var _0x5957c4=_0x4b45('0x2c');return db[_0x4b45('0x54')]['find']({'where':{'name':_0x5957c4,'userProfileId':_0x58bbf0[_0x4b45('0x55')]},'raw':!![]})['then'](function(_0x4b7e6e){if(_0x4b7e6e&&_0x4b7e6e[_0x4b45('0x56')]===0x0){return db[_0x4b45('0x57')]['create']({'name':_0x11ee0d[_0x4b45('0x2f')],'resourceId':_0x11ee0d['id'],'type':_0x4b7e6e[_0x4b45('0x2f')],'sectionId':_0x4b7e6e['id']},{})[_0x4b45('0x29')](function(){return _0x553312;});}else{return _0x553312;}})[_0x4b45('0x4d')](function(_0x5b2cc4){logger[_0x4b45('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b2cc4);throw _0x5b2cc4;});}return _0x553312;})[_0x4b45('0x29')](respondWithResult(_0x4484eb,0xc9))[_0x4b45('0x4d')](handleError(_0x4484eb,null));};exports[_0x4b45('0x28')]=function(_0x6f287,_0x46c174){if(_0x6f287[_0x4b45('0x58')]['id']){delete _0x6f287[_0x4b45('0x58')]['id'];}return db[_0x4b45('0x4a')][_0x4b45('0x50')]({'where':{'id':_0x6f287['params']['id']}})['then'](handleEntityNotFound(_0x46c174,null))[_0x4b45('0x29')](saveUpdates(_0x6f287['body'],null))['then'](respondWithResult(_0x46c174,null))[_0x4b45('0x4d')](handleError(_0x46c174,null));};exports[_0x4b45('0x2a')]=function(_0x1578e9,_0x4151de){return db[_0x4b45('0x4a')][_0x4b45('0x50')]({'where':{'id':_0x1578e9[_0x4b45('0x4f')]['id']}})[_0x4b45('0x29')](handleEntityNotFound(_0x4151de,null))[_0x4b45('0x29')](removeEntity(_0x4151de,null))[_0x4b45('0x4d')](handleError(_0x4151de,null));};exports[_0x4b45('0x59')]=function(_0x244f9c,_0x34f51e){return db[_0x4b45('0x4a')][_0x4b45('0x59')]()[_0x4b45('0x29')](respondWithResult(_0x34f51e,null))[_0x4b45('0x4d')](handleError(_0x34f51e,null));};exports[_0x4b45('0x5a')]=function(_0x1ce788,_0x2b60d7,_0x36488b){var _0x57ba38={'raw':!![],'where':{}},_0xdf0063={},_0x29c7d7;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1ce788[_0x4b45('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b60d7,null))[_0x4b45('0x29')](function(_0xf44084){if(_0xf44084){_0x29c7d7=_0xf44084[_0x4b45('0x2b')]({'plain':!![]});_0xdf0063[_0x4b45('0x39')]=_[_0x4b45('0x36')](db[_0x4b45('0x5b')][_0x4b45('0x32')]);_0xdf0063[_0x4b45('0x35')]=_[_0x4b45('0x36')](_0x1ce788['query']);_0xdf0063[_0x4b45('0x37')]=_[_0x4b45('0x38')](_0xdf0063[_0x4b45('0x39')],_0xdf0063[_0x4b45('0x35')]);_0x57ba38['attributes']=_['intersection'](_0xdf0063[_0x4b45('0x39')],qs[_0x4b45('0x3b')](_0x1ce788['query']['fields']));_0x57ba38['attributes']=_0x57ba38['attributes']['length']?_0x57ba38['attributes']:_0xdf0063[_0x4b45('0x39')];if(!_0x1ce788[_0x4b45('0x35')][_0x4b45('0x3d')]('nolimit')){_0x57ba38[_0x4b45('0x23')]=qs[_0x4b45('0x23')](_0x1ce788['query']['limit']);_0x57ba38[_0x4b45('0x22')]=qs[_0x4b45('0x22')](_0x1ce788[_0x4b45('0x35')][_0x4b45('0x22')]);}_0x57ba38[_0x4b45('0x3f')]=qs[_0x4b45('0x40')](_0x1ce788[_0x4b45('0x35')][_0x4b45('0x40')]);_0x57ba38[_0x4b45('0x43')]=qs[_0x4b45('0x37')](_[_0x4b45('0x41')](_0x1ce788[_0x4b45('0x35')],_0xdf0063[_0x4b45('0x37')]));_0x57ba38[_0x4b45('0x43')]['OpenchannelQueueId']=_0xf44084['id'];if(_0x1ce788[_0x4b45('0x35')][_0x4b45('0x42')]){_0x57ba38[_0x4b45('0x43')]=_[_0x4b45('0x44')](_0x57ba38[_0x4b45('0x43')],{'$or':_[_0x4b45('0x31')](_0x57ba38[_0x4b45('0x3a')],function(_0x3cdbea){var _0x354a52={};_0x354a52[_0x3cdbea]={'$like':'%'+_0x1ce788[_0x4b45('0x35')][_0x4b45('0x42')]+'%'};return _0x354a52;})});}_0x57ba38=_[_0x4b45('0x44')]({},_0x57ba38,_0x1ce788[_0x4b45('0x47')]);return db[_0x4b45('0x5b')][_0x4b45('0x4b')](_0x57ba38);}})[_0x4b45('0x29')](function(_0x13ff2c){if(_0x13ff2c){return db[_0x4b45('0x5c')][_0x4b45('0x5d')]({'where':{'id':_[_0x4b45('0x31')](_0x13ff2c,_0x4b45('0x5e')),'role':_0x4b45('0x5f')},'attributes':['id',_0x4b45('0x2f'),_0x4b45('0x60'),_0x4b45('0x61'),_0x4b45('0x62')]});}})[_0x4b45('0x29')](function(_0x431a35){if(_0x431a35){return{'count':_0x431a35[_0x4b45('0x25')],'rows':_[_0x4b45('0x31')](_0x431a35[_0x4b45('0x4c')],function(_0x328940){return{'membername':_0x328940['name'],'UserId':_0x328940['id'],'queue_name':_0x29c7d7[_0x4b45('0x2f')],'OpenchannelQueueId':_0x29c7d7['id'],'interface':util[_0x4b45('0x63')](_0x4b45('0x64'),_0x4b45('0x65'),_0x328940[_0x4b45('0x2f')]),'penalty':0x0,'paused':_0x328940[_0x4b45('0x60')],'createdAt':_0x328940['createdAt'],'updatedAt':_0x328940[_0x4b45('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2b60d7,_0x57ba38))[_0x4b45('0x4d')](handleError(_0x2b60d7,null));};exports[_0x4b45('0x66')]=function(_0x328f7d,_0x50a4d5,_0x40e546){var _0x193fdf={};var _0x217d06={};var _0x451467;var _0x7c9a1d;return db[_0x4b45('0x4a')][_0x4b45('0x67')]({'where':{'id':_0x328f7d['params']['id']}})[_0x4b45('0x29')](handleEntityNotFound(_0x50a4d5,null))['then'](function(_0xdf1cb2){if(_0xdf1cb2){_0x451467=_0xdf1cb2;_0x217d06[_0x4b45('0x39')]=_[_0x4b45('0x36')](db[_0x4b45('0x68')][_0x4b45('0x32')]);_0x217d06['query']=_[_0x4b45('0x36')](_0x328f7d['query']);_0x217d06['filters']=_['intersection'](_0x217d06[_0x4b45('0x39')],_0x217d06[_0x4b45('0x35')]);_0x193fdf['attributes']=_[_0x4b45('0x38')](_0x217d06['model'],qs['fields'](_0x328f7d[_0x4b45('0x35')][_0x4b45('0x3b')]));_0x193fdf['attributes']=_0x193fdf[_0x4b45('0x3a')][_0x4b45('0x3c')]?_0x193fdf['attributes']:_0x217d06['model'];_0x193fdf[_0x4b45('0x3f')]=qs[_0x4b45('0x40')](_0x328f7d[_0x4b45('0x35')][_0x4b45('0x40')]);_0x193fdf[_0x4b45('0x43')]=qs[_0x4b45('0x37')](_[_0x4b45('0x41')](_0x328f7d[_0x4b45('0x35')],_0x217d06[_0x4b45('0x37')]));if(_0x328f7d[_0x4b45('0x35')]['filter']){_0x193fdf[_0x4b45('0x43')]=_['merge'](_0x193fdf[_0x4b45('0x43')],{'$or':_[_0x4b45('0x31')](_0x193fdf[_0x4b45('0x3a')],function(_0x3940c9){var _0x449b09={};_0x449b09[_0x3940c9]={'$like':'%'+_0x328f7d[_0x4b45('0x35')][_0x4b45('0x42')]+'%'};return _0x449b09;})});}_0x193fdf=_[_0x4b45('0x44')]({},_0x193fdf,_0x328f7d[_0x4b45('0x47')]);return _0x451467[_0x4b45('0x66')](_0x193fdf);}})[_0x4b45('0x29')](function(_0x497a09){if(_0x497a09){_0x7c9a1d=_0x497a09['length'];if(!_0x328f7d[_0x4b45('0x35')]['hasOwnProperty'](_0x4b45('0x3e'))){_0x193fdf[_0x4b45('0x23')]=qs[_0x4b45('0x23')](_0x328f7d[_0x4b45('0x35')][_0x4b45('0x23')]);_0x193fdf[_0x4b45('0x22')]=qs[_0x4b45('0x22')](_0x328f7d[_0x4b45('0x35')][_0x4b45('0x22')]);}return _0x451467[_0x4b45('0x66')](_0x193fdf);}})[_0x4b45('0x29')](function(_0x3366db){if(_0x3366db){return _0x3366db?{'count':_0x7c9a1d,'rows':_0x3366db}:null;}})[_0x4b45('0x29')](respondWithResult(_0x50a4d5,null))[_0x4b45('0x4d')](handleError(_0x50a4d5,null));};exports[_0x4b45('0x69')]=function(_0x2e776d,_0x46eea8,_0x1e4dd0){var _0x1d7a46=_0x2e776d[_0x4b45('0x58')][_0x4b45('0x6a')];return db[_0x4b45('0x68')]['findAll']({'where':{'id':_0x1d7a46},'attributes':['id'],'include':[{'model':db[_0x4b45('0x5c')],'as':_0x4b45('0x6b'),'attributes':['id',_0x4b45('0x2f'),_0x4b45('0x6c'),_0x4b45('0x6d'),'interface'],'raw':!![]}]})[_0x4b45('0x29')](function(_0x2cf52e){if(_0x2cf52e){var _0x2a4619=_[_0x4b45('0x6e')](_0x2cf52e,function(_0x5544ce){var _0x4a6627=_0x5544ce['get']({'plain':!![]});return _0x4a6627[_0x4b45('0x6b')];});return db[_0x4b45('0x4a')][_0x4b45('0x50')]({'where':{'id':_0x2e776d[_0x4b45('0x4f')]['id']}})[_0x4b45('0x29')](function(_0x149ec9){return db['sequelize']['transaction'](function(_0x3c805d){return _0x149ec9[_0x4b45('0x69')](_0x1d7a46,{'transaction':_0x3c805d})[_0x4b45('0x29')](function(){return BPromise[_0x4b45('0x6f')](_0x2a4619,function(_0x4a3fad){return db[_0x4b45('0x5b')][_0x4b45('0x70')]({'where':{'UserId':_0x4a3fad['id'],'OpenchannelQueueId':_0x2e776d[_0x4b45('0x4f')]['id']},'transaction':_0x3c805d});});})[_0x4b45('0x29')](function(){_0x2a4619[_0x4b45('0x71')](function(_0x26fd3e){socket['emit'](_0x4b45('0x72'),{'UserId':_0x26fd3e['id'],'OpenchannelQueueId':_0x149ec9['id']});});});});});}})['then'](respondWithStatusCode(_0x46eea8,null))[_0x4b45('0x4d')](handleError(_0x46eea8,null));};exports[_0x4b45('0x73')]=function(_0x3f0b35,_0x36db86,_0x2d3089){return db[_0x4b45('0x68')]['findAll']({'where':{'id':_0x3f0b35[_0x4b45('0x35')][_0x4b45('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b45('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4b45('0x29')](handleEntityNotFound(_0x36db86,null))['then'](function(_0x3c3ce2){var _0x8c582b=_[_0x4b45('0x31')](_0x3c3ce2,'id');var _0x1ac5e8=[];var _0x121a8d=[];var _0x5b4957=squel[_0x4b45('0x74')]();_0x5b4957[_0x4b45('0x75')]('tq.TeamId')[_0x4b45('0x76')](_0x4b45('0x77'),'tq')['join']('user_has_teams','ut',_0x4b45('0x78'))['where'](_0x4b45('0x79'),_0x3f0b35['params']['id']);for(var _0xb7f43d=0x0;_0xb7f43d<_0x3c3ce2[_0x4b45('0x3c')];_0xb7f43d+=0x1){let _0x230500=_0x3c3ce2[_0xb7f43d];for(var _0xaf9680=0x0;_0xaf9680<_0x230500[_0x4b45('0x6b')][_0x4b45('0x3c')];_0xaf9680+=0x1){let _0x46527e=_0x230500[_0x4b45('0x6b')][_0xaf9680];var _0x5a95d8=_0x5b4957['clone']();_0x5a95d8['where'](_0x4b45('0x7a'),_0x46527e['id']);_0x121a8d[_0x4b45('0x7b')](db['sequelize']['query'](_0x5a95d8[_0x4b45('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x4b45('0x7d')]})[_0x4b45('0x29')](function(_0x2f3520){if(_0x2f3520[_0x4b45('0x3c')]===0x1){return _0x46527e['id'];}else{var _0x119c07=_[_0x4b45('0x7e')](_['map'](_0x2f3520,_0x4b45('0x7f')),function(_0x5e283f){return _[_0x4b45('0x80')](_0x8c582b,_0x5e283f);});if(_0x119c07){return _0x46527e['id'];}}}));}}return BPromise[_0x4b45('0x81')](_0x121a8d)[_0x4b45('0x29')](function(_0xc49025){_0x1ac5e8=_(_0x1ac5e8)[_0x4b45('0x82')](_0xc49025)[_0x4b45('0x83')]()['value']();return db[_0x4b45('0x4a')][_0x4b45('0x50')]({'where':{'id':_0x3f0b35[_0x4b45('0x4f')]['id']}})['then'](function(_0x4e7d72){return db[_0x4b45('0x84')][_0x4b45('0x85')](function(_0x53a9d1){return _0x4e7d72[_0x4b45('0x73')](_0x3f0b35[_0x4b45('0x35')]['ids'],{'transaction':_0x53a9d1})[_0x4b45('0x29')](function(){if(!_['isEmpty'](_0x1ac5e8)){return _0x4e7d72[_0x4b45('0x86')](_0x1ac5e8,{'transaction':_0x53a9d1});}})[_0x4b45('0x29')](function(){_0x1ac5e8['forEach'](function(_0x1135c8){socket[_0x4b45('0x87')](_0x4b45('0x88'),{'UserId':_0x1135c8,'OpenchannelQueueId':_0x4e7d72['id']});});});});});});})['then'](respondWithStatusCode(_0x36db86,null))[_0x4b45('0x4d')](handleError(_0x36db86,null));};exports[_0x4b45('0x89')]=function(_0x3937f3,_0x35f8d8,_0x11b1d2){return db[_0x4b45('0x4a')]['find']({'where':{'id':_0x3937f3['params']['id']}})['then'](handleEntityNotFound(_0x35f8d8,null))[_0x4b45('0x29')](function(_0x590681){if(_0x590681){return _0x590681[_0x4b45('0x89')](_0x3937f3[_0x4b45('0x58')][_0x4b45('0x6a')],_[_0x4b45('0x8a')](_0x3937f3['body'],[_0x4b45('0x6a'),'id'])||{})[_0x4b45('0x8b')](function(_0x1366c1){for(var _0x577912=0x0;_0x577912<_0x3937f3[_0x4b45('0x58')][_0x4b45('0x6a')][_0x4b45('0x3c')];_0x577912+=0x1){socket[_0x4b45('0x87')](_0x4b45('0x72'),{'UserId':Number(_0x3937f3[_0x4b45('0x58')]['ids'][_0x577912]),'OpenchannelQueueId':Number(_0x3937f3[_0x4b45('0x4f')]['id'])});}return _0x1366c1;});}})[_0x4b45('0x29')](respondWithResult(_0x35f8d8,null))['catch'](handleError(_0x35f8d8,null));};exports[_0x4b45('0x86')]=function(_0x8aa72,_0xed9846,_0x19cd71){return db['OpenchannelQueue'][_0x4b45('0x50')]({'where':{'id':_0x8aa72[_0x4b45('0x4f')]['id']}})['then'](handleEntityNotFound(_0xed9846,null))[_0x4b45('0x29')](function(_0x4589ae){if(_0x4589ae){return _0x4589ae['removeAgents'](_0x8aa72[_0x4b45('0x35')][_0x4b45('0x6a')])[_0x4b45('0x29')](function(){if(_['isArray'](_0x8aa72[_0x4b45('0x35')][_0x4b45('0x6a')])){for(var _0x24e7f7=0x0;_0x24e7f7<_0x8aa72[_0x4b45('0x35')][_0x4b45('0x6a')][_0x4b45('0x3c')];_0x24e7f7+=0x1){socket[_0x4b45('0x87')](_0x4b45('0x88'),{'UserId':Number(_0x8aa72[_0x4b45('0x35')][_0x4b45('0x6a')][_0x24e7f7]),'OpenchannelQueueId':Number(_0x8aa72[_0x4b45('0x4f')]['id'])});}}else{socket[_0x4b45('0x87')]('userOpenchannelQueue:remove',{'UserId':Number(_0x8aa72['query'][_0x4b45('0x6a')]),'OpenchannelQueueId':Number(_0x8aa72['params']['id'])});}});}})[_0x4b45('0x29')](respondWithStatusCode(_0xed9846,null))['catch'](handleError(_0xed9846,null));};exports[_0x4b45('0x8c')]=function(_0x314864,_0x25b63b,_0x5dcead){var _0x4925c8={};var _0xd182a4={};var _0x29276d;var _0x33cd49;return db[_0x4b45('0x4a')][_0x4b45('0x67')]({'where':{'id':_0x314864[_0x4b45('0x4f')]['id']}})[_0x4b45('0x29')](handleEntityNotFound(_0x25b63b,null))[_0x4b45('0x29')](function(_0x57e292){if(_0x57e292){_0x29276d=_0x57e292;_0xd182a4[_0x4b45('0x39')]=_['keys'](db[_0x4b45('0x5c')]['rawAttributes']);_0xd182a4['query']=_['keys'](_0x314864[_0x4b45('0x35')]);_0xd182a4[_0x4b45('0x37')]=_[_0x4b45('0x38')](_0xd182a4[_0x4b45('0x39')],_0xd182a4['query']);_0x4925c8[_0x4b45('0x3a')]=_[_0x4b45('0x38')](_0xd182a4[_0x4b45('0x39')],qs['fields'](_0x314864['query'][_0x4b45('0x3b')]));_0x4925c8[_0x4b45('0x3a')]=_0x4925c8['attributes']['length']?_0x4925c8[_0x4b45('0x3a')]:_0xd182a4[_0x4b45('0x39')];_0x4925c8[_0x4b45('0x3f')]=qs[_0x4b45('0x40')](_0x314864[_0x4b45('0x35')][_0x4b45('0x40')]);_0x4925c8[_0x4b45('0x43')]=qs[_0x4b45('0x37')](_[_0x4b45('0x41')](_0x314864[_0x4b45('0x35')],_0xd182a4[_0x4b45('0x37')]));if(_0x314864[_0x4b45('0x35')][_0x4b45('0x42')]){_0x4925c8[_0x4b45('0x43')]=_[_0x4b45('0x44')](_0x4925c8[_0x4b45('0x43')],{'$or':_[_0x4b45('0x31')](_0x4925c8[_0x4b45('0x3a')],function(_0x1cea58){var _0x167f5a={};_0x167f5a[_0x1cea58]={'$like':'%'+_0x314864['query'][_0x4b45('0x42')]+'%'};return _0x167f5a;})});}_0x4925c8=_[_0x4b45('0x44')]({},_0x4925c8,_0x314864['options']);return _0x29276d[_0x4b45('0x8c')](_0x4925c8);}})[_0x4b45('0x29')](function(_0x23b407){if(_0x23b407){_0x33cd49=_0x23b407['length'];if(!_0x314864['query'][_0x4b45('0x3d')](_0x4b45('0x3e'))){_0x4925c8[_0x4b45('0x23')]=qs[_0x4b45('0x23')](_0x314864[_0x4b45('0x35')][_0x4b45('0x23')]);_0x4925c8['offset']=qs[_0x4b45('0x22')](_0x314864[_0x4b45('0x35')][_0x4b45('0x22')]);}return _0x29276d['getAgents'](_0x4925c8);}})[_0x4b45('0x29')](function(_0x2cef7a){if(_0x2cef7a){return _0x2cef7a?{'count':_0x33cd49,'rows':_0x2cef7a}:null;}})['then'](respondWithResult(_0x25b63b,null))[_0x4b45('0x4d')](handleError(_0x25b63b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b918bba..8f551f4 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 _0x019d=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0x019d,0x82));var _0xd019=function(_0x52fd18,_0x4aaab8){_0x52fd18=_0x52fd18-0x0;var _0x5b1a30=_0x019d[_0x52fd18];return _0x5b1a30;};'use strict';var EventEmitter=require(_0xd019('0x0'));var OpenchannelQueue=require(_0xd019('0x1'))['db'][_0xd019('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd019('0x3')](0x0);var events={'afterCreate':_0xd019('0x4'),'afterUpdate':'update','afterDestroy':_0xd019('0x5')};function emitEvent(_0x5b0326){return function(_0x5ea7f1,_0x43de42,_0x227aa4){OpenchannelQueueEvents[_0xd019('0x6')](_0x5b0326+':'+_0x5ea7f1['id'],_0x5ea7f1);OpenchannelQueueEvents['emit'](_0x5b0326,_0x5ea7f1);_0x227aa4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd019('0x7')](e,emitEvent(event));}}module[_0xd019('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x253a=['hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0xe6fbee,_0x28fad2){var _0x50505a=function(_0x123810){while(--_0x123810){_0xe6fbee['push'](_0xe6fbee['shift']());}};_0x50505a(++_0x28fad2);}(_0x253a,0x8f));var _0xa253=function(_0x2d470,_0x335d65){_0x2d470=_0x2d470-0x0;var _0x57cec7=_0x253a[_0x2d470];return _0x57cec7;};'use strict';var EventEmitter=require(_0xa253('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xa253('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa253('0x2')](0x0);var events={'afterCreate':_0xa253('0x3'),'afterUpdate':_0xa253('0x4'),'afterDestroy':_0xa253('0x5')};function emitEvent(_0xbde7fe){return function(_0x1ff8e6,_0x58354f,_0x3cc84b){OpenchannelQueueEvents[_0xa253('0x6')](_0xbde7fe+':'+_0x1ff8e6['id'],_0x1ff8e6);OpenchannelQueueEvents[_0xa253('0x6')](_0xbde7fe,_0x1ff8e6);_0x3cc84b(null);};}for(var e in events){if(events[_0xa253('0x7')](e)){var event=events[e];OpenchannelQueue[_0xa253('0x8')](e,emitEvent(event));}}module[_0xa253('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 44cc4ec..022f16b 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 _0xe323=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','api'];(function(_0x4f3359,_0x190803){var _0x36e206=function(_0x110a40){while(--_0x110a40){_0x4f3359['push'](_0x4f3359['shift']());}};_0x36e206(++_0x190803);}(_0xe323,0x11f));var _0x3e32=function(_0x13d8b8,_0x277294){_0x13d8b8=_0x13d8b8-0x0;var _0x549e27=_0xe323[_0x13d8b8];return _0x549e27;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3e32('0x0'));var moment=require(_0x3e32('0x1'));var BPromise=require(_0x3e32('0x2'));var rp=require(_0x3e32('0x3'));var fs=require('fs');var path=require(_0x3e32('0x4'));var rimraf=require(_0x3e32('0x5'));var config=require(_0x3e32('0x6'));var attributes=require(_0x3e32('0x7'));module[_0x3e32('0x8')]=function(_0x33fee7,_0xcc6f84){return _0x33fee7[_0x3e32('0x9')](_0x3e32('0xa'),attributes,{'tableName':_0x3e32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x223a=['bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','api'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x223a,0x1db));var _0xa223=function(_0x167e6a,_0x1cb2f2){_0x167e6a=_0x167e6a-0x0;var _0x2894ad=_0x223a[_0x167e6a];return _0x2894ad;};'use strict';var _=require(_0xa223('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa223('0x1'));var moment=require('moment');var BPromise=require(_0xa223('0x2'));var rp=require(_0xa223('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa223('0x4'));var config=require(_0xa223('0x5'));var attributes=require(_0xa223('0x6'));module['exports']=function(_0x12cd64,_0x37d5ef){return _0x12cd64[_0xa223('0x7')]('OpenchannelQueue',attributes,{'tableName':_0xa223('0x8'),'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 50b4026..01d62a5 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 _0xcdc6=['find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','include','map','model','attributes','then','stringify','ShowOpenchannelQueue'];(function(_0x7f7d62,_0x93eec1){var _0x33939c=function(_0x34d176){while(--_0x34d176){_0x7f7d62['push'](_0x7f7d62['shift']());}};_0x33939c(++_0x93eec1);}(_0xcdc6,0x112));var _0x6cdc=function(_0x39504d,_0x372633){_0x39504d=_0x39504d-0x0;var _0x6c3829=_0xcdc6[_0x39504d];return _0x6c3829;};'use strict';var _=require(_0x6cdc('0x0'));var util=require(_0x6cdc('0x1'));var moment=require(_0x6cdc('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cdc('0x3'));var fs=require('fs');var Redis=require(_0x6cdc('0x4'));var db=require(_0x6cdc('0x5'))['db'];var utils=require(_0x6cdc('0x6'));var logger=require(_0x6cdc('0x7'))(_0x6cdc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cdc('0x9')][_0x6cdc('0xa')]({'port':0x232a});config[_0x6cdc('0xb')]=_[_0x6cdc('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6cdc('0xd'))(new Redis(config['redis']));require(_0x6cdc('0xe'))[_0x6cdc('0xf')](socket);function respondWithRpcPromise(_0x20a2cc,_0x17095b,_0x29fc49){return new BPromise(function(_0x2cb484,_0xb12952){return client[_0x6cdc('0x10')](_0x20a2cc,_0x29fc49)['then'](function(_0xad4d4a){logger[_0x6cdc('0x11')](_0x6cdc('0x12'),_0x17095b,_0x6cdc('0x13'));logger[_0x6cdc('0x14')](_0x6cdc('0x15'),_0x17095b,'request\x20sent',JSON['stringify'](_0xad4d4a));if(_0xad4d4a['error']){if(_0xad4d4a['error']['code']===0x1f4){logger['error'](_0x6cdc('0x12'),_0x17095b,_0xad4d4a[_0x6cdc('0x16')][_0x6cdc('0x17')]);return _0xb12952(_0xad4d4a['error'][_0x6cdc('0x17')]);}logger[_0x6cdc('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x17095b,_0xad4d4a[_0x6cdc('0x16')][_0x6cdc('0x17')]);return _0x2cb484(_0xad4d4a[_0x6cdc('0x16')][_0x6cdc('0x17')]);}else{logger[_0x6cdc('0x11')](_0x6cdc('0x12'),_0x17095b,'request\x20sent');_0x2cb484(_0xad4d4a[_0x6cdc('0x18')][_0x6cdc('0x17')]);}})[_0x6cdc('0x19')](function(_0x149553){logger[_0x6cdc('0x16')](_0x6cdc('0x12'),_0x17095b,_0x149553);_0xb12952(_0x149553);});});}exports[_0x6cdc('0x1a')]=function(_0x496f64){var _0x366ab5=this;return new Promise(function(_0x160acc,_0x33dcd5){return db['OpenchannelQueue'][_0x6cdc('0x1b')]({'raw':_0x496f64[_0x6cdc('0x1c')]?_0x496f64[_0x6cdc('0x1c')][_0x6cdc('0x1d')]===undefined?!![]:![]:!![],'where':_0x496f64[_0x6cdc('0x1c')]?_0x496f64[_0x6cdc('0x1c')][_0x6cdc('0x1e')]||null:null,'attributes':_0x496f64[_0x6cdc('0x1c')]?_0x496f64[_0x6cdc('0x1c')]['attributes']||null:null,'limit':_0x496f64[_0x6cdc('0x1c')]?_0x496f64[_0x6cdc('0x1c')]['limit']||null:null,'include':_0x496f64[_0x6cdc('0x1c')]?_0x496f64[_0x6cdc('0x1c')][_0x6cdc('0x1f')]?_[_0x6cdc('0x20')](_0x496f64[_0x6cdc('0x1c')][_0x6cdc('0x1f')],function(_0x547f80){return{'model':db[_0x547f80['model']],'as':_0x547f80['as'],'attributes':_0x547f80['attributes'],'include':_0x547f80['include']?_[_0x6cdc('0x20')](_0x547f80[_0x6cdc('0x1f')],function(_0x20d1fc){return{'model':db[_0x20d1fc[_0x6cdc('0x21')]],'as':_0x20d1fc['as'],'attributes':_0x20d1fc[_0x6cdc('0x22')],'include':_0x20d1fc['include']?_['map'](_0x20d1fc[_0x6cdc('0x1f')],function(_0x142661){return{'model':db[_0x142661['model']],'as':_0x142661['as'],'attributes':_0x142661[_0x6cdc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6cdc('0x23')](function(_0xc3d4f3){logger[_0x6cdc('0x11')](_0x6cdc('0x1a'),_0x496f64);logger[_0x6cdc('0x14')](_0x6cdc('0x1a'),_0x496f64,JSON[_0x6cdc('0x24')](_0xc3d4f3));_0x160acc(_0xc3d4f3);})[_0x6cdc('0x19')](function(_0x16b5cd){logger['error']('GetOpenchannelQueue',_0x16b5cd[_0x6cdc('0x17')],_0x496f64);_0x33dcd5(_0x366ab5[_0x6cdc('0x16')](0x1f4,_0x16b5cd['message']));});});};exports[_0x6cdc('0x25')]=function(_0x2ba713){var _0x478a14=this;return new Promise(function(_0x47cb3a,_0x37f745){return db['OpenchannelQueue'][_0x6cdc('0x26')]({'raw':_0x2ba713[_0x6cdc('0x1c')]?_0x2ba713[_0x6cdc('0x1c')][_0x6cdc('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ba713['options']?_0x2ba713['options'][_0x6cdc('0x1e')]||null:null,'attributes':_0x2ba713[_0x6cdc('0x1c')]?_0x2ba713[_0x6cdc('0x1c')][_0x6cdc('0x22')]||null:null,'include':_0x2ba713['options']?_0x2ba713['options'][_0x6cdc('0x1f')]?_['map'](_0x2ba713[_0x6cdc('0x1c')][_0x6cdc('0x1f')],function(_0x306165){return{'model':db[_0x306165[_0x6cdc('0x21')]],'as':_0x306165['as'],'attributes':_0x306165[_0x6cdc('0x22')],'include':_0x306165[_0x6cdc('0x1f')]?_[_0x6cdc('0x20')](_0x306165[_0x6cdc('0x1f')],function(_0x521951){return{'model':db[_0x521951[_0x6cdc('0x21')]],'as':_0x521951['as'],'attributes':_0x521951[_0x6cdc('0x22')],'include':_0x521951[_0x6cdc('0x1f')]?_['map'](_0x521951[_0x6cdc('0x1f')],function(_0x46f241){return{'model':db[_0x46f241[_0x6cdc('0x21')]],'as':_0x46f241['as'],'attributes':_0x46f241[_0x6cdc('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e5cda){logger[_0x6cdc('0x11')](_0x6cdc('0x25'),_0x2ba713);logger[_0x6cdc('0x14')](_0x6cdc('0x25'),_0x2ba713,JSON[_0x6cdc('0x24')](_0x5e5cda));_0x47cb3a(_0x5e5cda);})['catch'](function(_0x4f602c){logger[_0x6cdc('0x16')](_0x6cdc('0x25'),_0x4f602c[_0x6cdc('0x17')],_0x2ba713);_0x37f745(_0x478a14[_0x6cdc('0x16')](0x1f4,_0x4f602c['message']));});});}; \ No newline at end of file +var _0x6716=['raw','where','attributes','limit','include','model','map','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options'];(function(_0x2bf6f9,_0x14c39b){var _0xe910af=function(_0x4f7533){while(--_0x4f7533){_0x2bf6f9['push'](_0x2bf6f9['shift']());}};_0xe910af(++_0x14c39b);}(_0x6716,0x151));var _0x6671=function(_0x5b9512,_0x5bec1a){_0x5b9512=_0x5b9512-0x0;var _0x37802f=_0x6716[_0x5b9512];return _0x37802f;};'use strict';var _=require(_0x6671('0x0'));var util=require(_0x6671('0x1'));var moment=require(_0x6671('0x2'));var BPromise=require(_0x6671('0x3'));var rs=require(_0x6671('0x4'));var fs=require('fs');var Redis=require(_0x6671('0x5'));var db=require(_0x6671('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6671('0x7'));var config=require(_0x6671('0x8'));var jayson=require(_0x6671('0x9'));var client=jayson[_0x6671('0xa')][_0x6671('0xb')]({'port':0x232a});config[_0x6671('0xc')]=_['defaults'](config[_0x6671('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6671('0xd'))(new Redis(config[_0x6671('0xc')]));require(_0x6671('0xe'))[_0x6671('0xf')](socket);function respondWithRpcPromise(_0x3d562c,_0x53ddfc,_0xa79d51){return new BPromise(function(_0x209a6a,_0x5556b1){return client[_0x6671('0x10')](_0x3d562c,_0xa79d51)[_0x6671('0x11')](function(_0x8088){logger[_0x6671('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x53ddfc,_0x6671('0x13'));logger[_0x6671('0x14')](_0x6671('0x15'),_0x53ddfc,'request\x20sent',JSON[_0x6671('0x16')](_0x8088));if(_0x8088[_0x6671('0x17')]){if(_0x8088[_0x6671('0x17')][_0x6671('0x18')]===0x1f4){logger[_0x6671('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x53ddfc,_0x8088[_0x6671('0x17')]['message']);return _0x5556b1(_0x8088[_0x6671('0x17')]['message']);}logger['error'](_0x6671('0x19'),_0x53ddfc,_0x8088[_0x6671('0x17')][_0x6671('0x1a')]);return _0x209a6a(_0x8088[_0x6671('0x17')][_0x6671('0x1a')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x53ddfc,_0x6671('0x13'));_0x209a6a(_0x8088[_0x6671('0x1b')][_0x6671('0x1a')]);}})[_0x6671('0x1c')](function(_0x27f216){logger[_0x6671('0x17')](_0x6671('0x19'),_0x53ddfc,_0x27f216);_0x5556b1(_0x27f216);});});}exports[_0x6671('0x1d')]=function(_0xd72b49){var _0x51f13b=this;return new Promise(function(_0x10e4a5,_0x256f87){return db[_0x6671('0x1e')]['findAll']({'raw':_0xd72b49[_0x6671('0x1f')]?_0xd72b49[_0x6671('0x1f')][_0x6671('0x20')]===undefined?!![]:![]:!![],'where':_0xd72b49[_0x6671('0x1f')]?_0xd72b49['options'][_0x6671('0x21')]||null:null,'attributes':_0xd72b49[_0x6671('0x1f')]?_0xd72b49[_0x6671('0x1f')][_0x6671('0x22')]||null:null,'limit':_0xd72b49['options']?_0xd72b49[_0x6671('0x1f')][_0x6671('0x23')]||null:null,'include':_0xd72b49[_0x6671('0x1f')]?_0xd72b49[_0x6671('0x1f')][_0x6671('0x24')]?_['map'](_0xd72b49[_0x6671('0x1f')][_0x6671('0x24')],function(_0x3af8d0){return{'model':db[_0x3af8d0[_0x6671('0x25')]],'as':_0x3af8d0['as'],'attributes':_0x3af8d0[_0x6671('0x22')],'include':_0x3af8d0[_0x6671('0x24')]?_['map'](_0x3af8d0['include'],function(_0x38e884){return{'model':db[_0x38e884['model']],'as':_0x38e884['as'],'attributes':_0x38e884[_0x6671('0x22')],'include':_0x38e884[_0x6671('0x24')]?_[_0x6671('0x26')](_0x38e884[_0x6671('0x24')],function(_0x5d4f04){return{'model':db[_0x5d4f04[_0x6671('0x25')]],'as':_0x5d4f04['as'],'attributes':_0x5d4f04[_0x6671('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6671('0x11')](function(_0xad69ee){logger['info']('GetOpenchannelQueue',_0xd72b49);logger['debug'](_0x6671('0x1d'),_0xd72b49,JSON['stringify'](_0xad69ee));_0x10e4a5(_0xad69ee);})[_0x6671('0x1c')](function(_0x142228){logger['error'](_0x6671('0x1d'),_0x142228[_0x6671('0x1a')],_0xd72b49);_0x256f87(_0x51f13b[_0x6671('0x17')](0x1f4,_0x142228[_0x6671('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x416922){var _0x2aeec9=this;return new Promise(function(_0x234b03,_0x1bc6a9){return db['OpenchannelQueue'][_0x6671('0x27')]({'raw':_0x416922[_0x6671('0x1f')]?_0x416922['options'][_0x6671('0x20')]===undefined?!![]:![]:!![],'where':_0x416922['options']?_0x416922[_0x6671('0x1f')][_0x6671('0x21')]||null:null,'attributes':_0x416922[_0x6671('0x1f')]?_0x416922[_0x6671('0x1f')][_0x6671('0x22')]||null:null,'include':_0x416922[_0x6671('0x1f')]?_0x416922['options'][_0x6671('0x24')]?_[_0x6671('0x26')](_0x416922['options']['include'],function(_0x3f001e){return{'model':db[_0x3f001e['model']],'as':_0x3f001e['as'],'attributes':_0x3f001e[_0x6671('0x22')],'include':_0x3f001e[_0x6671('0x24')]?_[_0x6671('0x26')](_0x3f001e[_0x6671('0x24')],function(_0x9acc61){return{'model':db[_0x9acc61[_0x6671('0x25')]],'as':_0x9acc61['as'],'attributes':_0x9acc61[_0x6671('0x22')],'include':_0x9acc61['include']?_[_0x6671('0x26')](_0x9acc61[_0x6671('0x24')],function(_0x2c3bd4){return{'model':db[_0x2c3bd4['model']],'as':_0x2c3bd4['as'],'attributes':_0x2c3bd4[_0x6671('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6671('0x11')](function(_0x523446){logger[_0x6671('0x12')](_0x6671('0x28'),_0x416922);logger[_0x6671('0x14')]('ShowOpenchannelQueue',_0x416922,JSON[_0x6671('0x16')](_0x523446));_0x234b03(_0x523446);})[_0x6671('0x1c')](function(_0x493c68){logger[_0x6671('0x17')](_0x6671('0x28'),_0x493c68[_0x6671('0x1a')],_0x416922);_0x1bc6a9(_0x2aeec9[_0x6671('0x17')](0x1f4,_0x493c68[_0x6671('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3a520e5..697d09d 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 _0x6725=['remove','update','emit','./openchannelQueue.events','save'];(function(_0x5cb7d6,_0x5485ae){var _0x28171c=function(_0x56718b){while(--_0x56718b){_0x5cb7d6['push'](_0x5cb7d6['shift']());}};_0x28171c(++_0x5485ae);}(_0x6725,0x1a2));var _0x5672=function(_0x1d51b8,_0x4d503){_0x1d51b8=_0x1d51b8-0x0;var _0x3b3a59=_0x6725[_0x1d51b8];return _0x3b3a59;};'use strict';var OpenchannelQueueEvents=require(_0x5672('0x0'));var events=[_0x5672('0x1'),_0x5672('0x2'),_0x5672('0x3')];function createListener(_0x4bc362,_0x28df7d){return function(_0x366435){_0x28df7d[_0x5672('0x4')](_0x4bc362,_0x366435);};}function removeListener(_0x43ca1d,_0x349976){return function(){OpenchannelQueueEvents['removeListener'](_0x43ca1d,_0x349976);};}exports['register']=function(_0x33e21f){for(var _0x3d42cb=0x0,_0x485ee5=events['length'];_0x3d42cb<_0x485ee5;_0x3d42cb++){var _0x5673d6=events[_0x3d42cb];var _0x10fd06=createListener('openchannelQueue:'+_0x5673d6,_0x33e21f);OpenchannelQueueEvents['on'](_0x5673d6,_0x10fd06);}}; \ No newline at end of file +var _0xdccc=['update','emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x9e9ead,_0x1a7ff3){var _0x31ff57=function(_0x22a9da){while(--_0x22a9da){_0x9e9ead['push'](_0x9e9ead['shift']());}};_0x31ff57(++_0x1a7ff3);}(_0xdccc,0x10d));var _0xcdcc=function(_0x13ea28,_0x3c6887){_0x13ea28=_0x13ea28-0x0;var _0x43b351=_0xdccc[_0x13ea28];return _0x43b351;};'use strict';var OpenchannelQueueEvents=require(_0xcdcc('0x0'));var events=[_0xcdcc('0x1'),_0xcdcc('0x2'),_0xcdcc('0x3')];function createListener(_0x1c06c7,_0x3bbdd1){return function(_0x3671c8){_0x3bbdd1[_0xcdcc('0x4')](_0x1c06c7,_0x3671c8);};}function removeListener(_0x2210d4,_0x29c67f){return function(){OpenchannelQueueEvents['removeListener'](_0x2210d4,_0x29c67f);};}exports[_0xcdcc('0x5')]=function(_0x4708fc){for(var _0x1ef13e=0x0,_0x13629e=events[_0xcdcc('0x6')];_0x1ef13e<_0x13629e;_0x1ef13e++){var _0x3e6525=events[_0x1ef13e];var _0x58aee3=createListener(_0xcdcc('0x7')+_0x3e6525,_0x4708fc);OpenchannelQueueEvents['on'](_0x3e6525,_0x58aee3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a104990..09d54a9 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 _0xe4b1=['index','/describe','describe','/:id','show','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0xe7dfa7,_0x3d17ee){var _0x1a9fbf=function(_0x2ef98a){while(--_0x2ef98a){_0xe7dfa7['push'](_0xe7dfa7['shift']());}};_0x1a9fbf(++_0x3d17ee);}(_0xe4b1,0x1b8));var _0x1e4b=function(_0x2cf062,_0x3c15c6){_0x2cf062=_0x2cf062-0x0;var _0x376203=_0xe4b1[_0x2cf062];return _0x376203;};'use strict';var multer=require(_0x1e4b('0x0'));var util=require(_0x1e4b('0x1'));var path=require('path');var timeout=require(_0x1e4b('0x2'));var express=require(_0x1e4b('0x3'));var router=express[_0x1e4b('0x4')]();var fs_extra=require(_0x1e4b('0x5'));var auth=require(_0x1e4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e4b('0x7'));router[_0x1e4b('0x8')]('/',auth[_0x1e4b('0x9')](),controller[_0x1e4b('0xa')]);router[_0x1e4b('0x8')](_0x1e4b('0xb'),auth[_0x1e4b('0x9')](),controller[_0x1e4b('0xc')]);router[_0x1e4b('0x8')](_0x1e4b('0xd'),auth[_0x1e4b('0x9')](),controller[_0x1e4b('0xe')]);router['post']('/',auth[_0x1e4b('0x9')](),controller['create']);router[_0x1e4b('0xf')](_0x1e4b('0xd'),auth[_0x1e4b('0x9')](),controller['update']);router['delete'](_0x1e4b('0xd'),auth['isAuthenticated'](),controller[_0x1e4b('0x10')]);module[_0x1e4b('0x11')]=router; \ No newline at end of file +var _0xf22d=['multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x4a5aaa,_0x358361){var _0x51d89d=function(_0x5ef2ae){while(--_0x5ef2ae){_0x4a5aaa['push'](_0x4a5aaa['shift']());}};_0x51d89d(++_0x358361);}(_0xf22d,0x1c2));var _0xdf22=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xf22d[_0x30f5bb];return _0x1cfc00;};'use strict';var multer=require(_0xdf22('0x0'));var util=require(_0xdf22('0x1'));var path=require(_0xdf22('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdf22('0x3')]();var fs_extra=require(_0xdf22('0x4'));var auth=require(_0xdf22('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdf22('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdf22('0x7')]);router[_0xdf22('0x8')](_0xdf22('0x9'),auth[_0xdf22('0xa')](),controller['describe']);router[_0xdf22('0x8')](_0xdf22('0xb'),auth[_0xdf22('0xa')](),controller[_0xdf22('0xc')]);router['post']('/',auth[_0xdf22('0xa')](),controller[_0xdf22('0xd')]);router[_0xdf22('0xe')]('/:id',auth[_0xdf22('0xa')](),controller[_0xdf22('0xf')]);router[_0xdf22('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdf22('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3def02a..aabc325 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 _0x5704=['exports','STRING','DATE'];(function(_0x2f3aa2,_0x100f54){var _0x4e35d5=function(_0x3b707a){while(--_0x3b707a){_0x2f3aa2['push'](_0x2f3aa2['shift']());}};_0x4e35d5(++_0x100f54);}(_0x5704,0x1e3));var _0x4570=function(_0x163a1c,_0x4f81ea){_0x163a1c=_0x163a1c-0x0;var _0x239113=_0x5704[_0x163a1c];return _0x239113;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4570('0x0')]={'uniqueid':{'type':Sequelize[_0x4570('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4570('0x1')]},'joinAt':{'type':Sequelize[_0x4570('0x2')]},'leaveAt':{'type':Sequelize[_0x4570('0x2')]},'acceptAt':{'type':Sequelize[_0x4570('0x2')]},'exitAt':{'type':Sequelize[_0x4570('0x2')]},'reason':{'type':Sequelize[_0x4570('0x1')]}}; \ No newline at end of file +var _0xb54c=['DATE','moment','sequelize','STRING'];(function(_0x9a7d5b,_0x50327f){var _0xe2a5b3=function(_0x98ad8d){while(--_0x98ad8d){_0x9a7d5b['push'](_0x9a7d5b['shift']());}};_0xe2a5b3(++_0x50327f);}(_0xb54c,0x1d5));var _0xcb54=function(_0x56b4b9,_0x5b0a5c){_0x56b4b9=_0x56b4b9-0x0;var _0xe1b391=_0xb54c[_0x56b4b9];return _0xe1b391;};'use strict';var moment=require(_0xcb54('0x0'));var Sequelize=require(_0xcb54('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcb54('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcb54('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcb54('0x3')]},'exitAt':{'type':Sequelize[_0xcb54('0x3')]},'reason':{'type':Sequelize[_0xcb54('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index aac9b87..e18c8a6 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 _0x67df=['index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','Content-Range','apply','save','update','then','status','error','stack','name'];(function(_0x34a530,_0x30af52){var _0x51e097=function(_0x23b63b){while(--_0x23b63b){_0x34a530['push'](_0x34a530['shift']());}};_0x51e097(++_0x30af52);}(_0x67df,0x193));var _0xf67d=function(_0x30855b,_0x2b1436){_0x30855b=_0x30855b-0x0;var _0x341bfa=_0x67df[_0x30855b];return _0x341bfa;};'use strict';var emlformat=require(_0xf67d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf67d('0x1'));var rp=require(_0xf67d('0x2'));var moment=require(_0xf67d('0x3'));var BPromise=require(_0xf67d('0x4'));var Mustache=require(_0xf67d('0x5'));var util=require(_0xf67d('0x6'));var path=require(_0xf67d('0x7'));var sox=require(_0xf67d('0x8'));var csv=require(_0xf67d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf67d('0xa'));var _=require(_0xf67d('0xb'));var squel=require(_0xf67d('0xc'));var crypto=require(_0xf67d('0xd'));var jsforce=require(_0xf67d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf67d('0x9'));var querystring=require(_0xf67d('0xf'));var Papa=require(_0xf67d('0x10'));var Redis=require(_0xf67d('0x11'));var authService=require(_0xf67d('0x12'));var qs=require(_0xf67d('0x13'));var as=require(_0xf67d('0x14'));var hardwareService=require(_0xf67d('0x15'));var logger=require(_0xf67d('0x16'))('api');var utils=require(_0xf67d('0x17'));var config=require(_0xf67d('0x18'));var licenseUtil=require(_0xf67d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fddc2,_0xb21aa0){_0xb21aa0=_0xb21aa0||0xcc;return function(_0x3cff56){if(_0x3cff56){return _0x1fddc2[_0xf67d('0x1a')](_0xb21aa0);}return _0x1fddc2['status'](_0xb21aa0)[_0xf67d('0x1b')]();};}function respondWithResult(_0x157fc6,_0x454c29){_0x454c29=_0x454c29||0xc8;return function(_0x520460){if(_0x520460){return _0x157fc6['status'](_0x454c29)[_0xf67d('0x1c')](_0x520460);}};}function respondWithFilteredResult(_0x414471,_0x42a9f1){return function(_0x1a39f6){if(_0x1a39f6){var _0x29f57f=typeof _0x42a9f1['offset']===_0xf67d('0x1d')&&typeof _0x42a9f1[_0xf67d('0x1e')]==='undefined';var _0x33c33e=_0x1a39f6[_0xf67d('0x1f')];var _0x5bddc3=_0x29f57f?0x0:_0x42a9f1['offset'];var _0x3c20d1=_0x29f57f?_0x1a39f6[_0xf67d('0x1f')]:_0x42a9f1['offset']+_0x42a9f1[_0xf67d('0x1e')];var _0x202507;if(_0x3c20d1>=_0x33c33e){_0x3c20d1=_0x33c33e;_0x202507=0xc8;}else{_0x202507=0xce;}_0x414471['status'](_0x202507);return _0x414471['set'](_0xf67d('0x20'),_0x5bddc3+'-'+_0x3c20d1+'/'+_0x33c33e)['json'](_0x1a39f6);}return null;};}function patchUpdates(_0x5eee35){return function(_0x1c91bf){try{jsonpatch[_0xf67d('0x21')](_0x1c91bf,_0x5eee35,!![]);}catch(_0x208908){return BPromise['reject'](_0x208908);}return _0x1c91bf[_0xf67d('0x22')]();};}function saveUpdates(_0xe7e85f,_0x578979){return function(_0x3b24b6){if(_0x3b24b6){return _0x3b24b6[_0xf67d('0x23')](_0xe7e85f)[_0xf67d('0x24')](function(_0x149e78){return _0x149e78;});}return null;};}function removeEntity(_0x5ba27b,_0x12abef){return function(_0x4d3d47){if(_0x4d3d47){return _0x4d3d47['destroy']()['then'](function(){_0x5ba27b[_0xf67d('0x25')](0xcc)[_0xf67d('0x1b')]();});}};}function handleEntityNotFound(_0x2d5534,_0x5edc1c){return function(_0x5629c7){if(!_0x5629c7){_0x2d5534[_0xf67d('0x1a')](0x194);}return _0x5629c7;};}function handleError(_0x52d8e6,_0x901fd4){_0x901fd4=_0x901fd4||0x1f4;return function(_0x2bb1e0){logger[_0xf67d('0x26')](_0x2bb1e0[_0xf67d('0x27')]);if(_0x2bb1e0[_0xf67d('0x28')]){delete _0x2bb1e0[_0xf67d('0x28')];}_0x52d8e6[_0xf67d('0x25')](_0x901fd4)['send'](_0x2bb1e0);};}exports[_0xf67d('0x29')]=function(_0x30e5ed,_0x3a22d5){var _0xc33a68={},_0x1ca684={},_0x1b44ce={'count':0x0,'rows':[]};var _0x3f4b85=_[_0xf67d('0x2a')](db[_0xf67d('0x2b')][_0xf67d('0x2c')],function(_0x1c1476){return{'name':_0x1c1476[_0xf67d('0x2d')],'type':_0x1c1476[_0xf67d('0x2e')][_0xf67d('0x2f')]};});_0x1ca684[_0xf67d('0x30')]=_[_0xf67d('0x2a')](_0x3f4b85,_0xf67d('0x28'));_0x1ca684['query']=_[_0xf67d('0x31')](_0x30e5ed['query']);_0x1ca684[_0xf67d('0x32')]=_[_0xf67d('0x33')](_0x1ca684[_0xf67d('0x30')],_0x1ca684[_0xf67d('0x34')]);_0xc33a68[_0xf67d('0x35')]=_['intersection'](_0x1ca684[_0xf67d('0x30')],qs[_0xf67d('0x36')](_0x30e5ed[_0xf67d('0x34')][_0xf67d('0x36')]));_0xc33a68[_0xf67d('0x35')]=_0xc33a68[_0xf67d('0x35')][_0xf67d('0x37')]?_0xc33a68[_0xf67d('0x35')]:_0x1ca684[_0xf67d('0x30')];if(!_0x30e5ed['query']['hasOwnProperty'](_0xf67d('0x38'))){_0xc33a68['limit']=qs[_0xf67d('0x1e')](_0x30e5ed[_0xf67d('0x34')][_0xf67d('0x1e')]);_0xc33a68[_0xf67d('0x39')]=qs[_0xf67d('0x39')](_0x30e5ed[_0xf67d('0x34')][_0xf67d('0x39')]);}_0xc33a68[_0xf67d('0x3a')]=qs[_0xf67d('0x3b')](_0x30e5ed['query'][_0xf67d('0x3b')]);_0xc33a68[_0xf67d('0x3c')]=qs[_0xf67d('0x32')](_['pick'](_0x30e5ed[_0xf67d('0x34')],_0x1ca684[_0xf67d('0x32')]),_0x3f4b85);if(_0x30e5ed['query'][_0xf67d('0x3d')]){_0xc33a68[_0xf67d('0x3c')]=_[_0xf67d('0x3e')](_0xc33a68['where'],{'$or':_[_0xf67d('0x2a')](_0x3f4b85,function(_0x4ac858){if(_0x4ac858[_0xf67d('0x2e')]!==_0xf67d('0x3f')){var _0x22141b={};_0x22141b[_0x4ac858[_0xf67d('0x28')]]={'$like':'%'+_0x30e5ed[_0xf67d('0x34')][_0xf67d('0x3d')]+'%'};return _0x22141b;}})});}_0xc33a68=_['merge']({},_0xc33a68,_0x30e5ed[_0xf67d('0x40')]);var _0x227f9e={'where':_0xc33a68['where']};return db[_0xf67d('0x2b')][_0xf67d('0x1f')](_0x227f9e)[_0xf67d('0x24')](function(_0x31e78c){_0x1b44ce[_0xf67d('0x1f')]=_0x31e78c;if(_0x30e5ed[_0xf67d('0x34')][_0xf67d('0x41')]){_0xc33a68[_0xf67d('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0xc33a68);})['then'](function(_0x2aaf29){_0x1b44ce[_0xf67d('0x43')]=_0x2aaf29;return _0x1b44ce;})[_0xf67d('0x24')](respondWithFilteredResult(_0x3a22d5,_0xc33a68))[_0xf67d('0x44')](handleError(_0x3a22d5,null));};exports['show']=function(_0x46b0a9,_0x5d56c2){var _0x1f4e38={'raw':!![],'where':{'id':_0x46b0a9[_0xf67d('0x45')]['id']}},_0x36b1c2={};_0x36b1c2['model']=_[_0xf67d('0x31')](db[_0xf67d('0x2b')]['rawAttributes']);_0x36b1c2[_0xf67d('0x34')]=_[_0xf67d('0x31')](_0x46b0a9[_0xf67d('0x34')]);_0x36b1c2['filters']=_['intersection'](_0x36b1c2[_0xf67d('0x30')],_0x36b1c2[_0xf67d('0x34')]);_0x1f4e38[_0xf67d('0x35')]=_[_0xf67d('0x33')](_0x36b1c2['model'],qs[_0xf67d('0x36')](_0x46b0a9['query'][_0xf67d('0x36')]));_0x1f4e38[_0xf67d('0x35')]=_0x1f4e38[_0xf67d('0x35')][_0xf67d('0x37')]?_0x1f4e38['attributes']:_0x36b1c2['model'];if(_0x46b0a9[_0xf67d('0x34')]['includeAll']){_0x1f4e38[_0xf67d('0x42')]=[{'all':!![]}];}_0x1f4e38=_[_0xf67d('0x3e')]({},_0x1f4e38,_0x46b0a9['options']);return db[_0xf67d('0x2b')][_0xf67d('0x46')](_0x1f4e38)[_0xf67d('0x24')](handleEntityNotFound(_0x5d56c2,null))['then'](respondWithResult(_0x5d56c2,null))[_0xf67d('0x44')](handleError(_0x5d56c2,null));};exports[_0xf67d('0x47')]=function(_0x196fb1,_0x57293a){return db['OpenchannelQueueReport']['create'](_0x196fb1[_0xf67d('0x48')],{})['then'](respondWithResult(_0x57293a,0xc9))[_0xf67d('0x44')](handleError(_0x57293a,null));};exports['update']=function(_0x57239d,_0x27e16b){if(_0x57239d['body']['id']){delete _0x57239d[_0xf67d('0x48')]['id'];}return db[_0xf67d('0x2b')]['find']({'where':{'id':_0x57239d['params']['id']}})[_0xf67d('0x24')](handleEntityNotFound(_0x27e16b,null))['then'](saveUpdates(_0x57239d[_0xf67d('0x48')],null))[_0xf67d('0x24')](respondWithResult(_0x27e16b,null))[_0xf67d('0x44')](handleError(_0x27e16b,null));};exports['destroy']=function(_0x2b02bf,_0x226a4f){return db['OpenchannelQueueReport'][_0xf67d('0x46')]({'where':{'id':_0x2b02bf[_0xf67d('0x45')]['id']}})[_0xf67d('0x24')](handleEntityNotFound(_0x226a4f,null))[_0xf67d('0x24')](removeEntity(_0x226a4f,null))[_0xf67d('0x44')](handleError(_0x226a4f,null));};exports[_0xf67d('0x49')]=function(_0x853df4,_0x5b709d){return db[_0xf67d('0x2b')][_0xf67d('0x49')]()[_0xf67d('0x24')](respondWithResult(_0x5b709d,null))['catch'](handleError(_0x5b709d,null));}; \ No newline at end of file +var _0x9620=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3e5c33,_0xe6087d){var _0x52817f=function(_0xe8d26c){while(--_0xe8d26c){_0x3e5c33['push'](_0x3e5c33['shift']());}};_0x52817f(++_0xe6087d);}(_0x9620,0x124));var _0x0962=function(_0x3cc30c,_0x415f9c){_0x3cc30c=_0x3cc30c-0x0;var _0x3fd0f7=_0x9620[_0x3cc30c];return _0x3fd0f7;};'use strict';var emlformat=require(_0x0962('0x0'));var rimraf=require(_0x0962('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0962('0x2'));var rp=require('request-promise');var moment=require(_0x0962('0x3'));var BPromise=require(_0x0962('0x4'));var Mustache=require(_0x0962('0x5'));var util=require(_0x0962('0x6'));var path=require(_0x0962('0x7'));var sox=require(_0x0962('0x8'));var csv=require(_0x0962('0x9'));var ejs=require(_0x0962('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0962('0xb'));var squel=require(_0x0962('0xc'));var crypto=require(_0x0962('0xd'));var jsforce=require(_0x0962('0xe'));var deskjs=require(_0x0962('0xf'));var toCsv=require(_0x0962('0x9'));var querystring=require(_0x0962('0x10'));var Papa=require(_0x0962('0x11'));var Redis=require(_0x0962('0x12'));var authService=require(_0x0962('0x13'));var qs=require(_0x0962('0x14'));var as=require(_0x0962('0x15'));var hardwareService=require(_0x0962('0x16'));var logger=require(_0x0962('0x17'))('api');var utils=require(_0x0962('0x18'));var config=require(_0x0962('0x19'));var licenseUtil=require(_0x0962('0x1a'));var db=require(_0x0962('0x1b'))['db'];function respondWithStatusCode(_0x5a6aef,_0x5ed8ca){_0x5ed8ca=_0x5ed8ca||0xcc;return function(_0x265d96){if(_0x265d96){return _0x5a6aef['sendStatus'](_0x5ed8ca);}return _0x5a6aef[_0x0962('0x1c')](_0x5ed8ca)[_0x0962('0x1d')]();};}function respondWithResult(_0x137eda,_0x1a301a){_0x1a301a=_0x1a301a||0xc8;return function(_0x58683c){if(_0x58683c){return _0x137eda['status'](_0x1a301a)[_0x0962('0x1e')](_0x58683c);}};}function respondWithFilteredResult(_0x1206cb,_0x4bf062){return function(_0x3190e3){if(_0x3190e3){var _0x427e2e=typeof _0x4bf062[_0x0962('0x1f')]===_0x0962('0x20')&&typeof _0x4bf062['limit']===_0x0962('0x20');var _0x1719a6=_0x3190e3[_0x0962('0x21')];var _0x1769a1=_0x427e2e?0x0:_0x4bf062[_0x0962('0x1f')];var _0x359b66=_0x427e2e?_0x3190e3[_0x0962('0x21')]:_0x4bf062[_0x0962('0x1f')]+_0x4bf062[_0x0962('0x22')];var _0x49e377;if(_0x359b66>=_0x1719a6){_0x359b66=_0x1719a6;_0x49e377=0xc8;}else{_0x49e377=0xce;}_0x1206cb['status'](_0x49e377);return _0x1206cb['set'](_0x0962('0x23'),_0x1769a1+'-'+_0x359b66+'/'+_0x1719a6)[_0x0962('0x1e')](_0x3190e3);}return null;};}function patchUpdates(_0x2cbf39){return function(_0x2ef2e4){try{jsonpatch[_0x0962('0x24')](_0x2ef2e4,_0x2cbf39,!![]);}catch(_0x37985b){return BPromise['reject'](_0x37985b);}return _0x2ef2e4['save']();};}function saveUpdates(_0x3a7f61,_0x8ec407){return function(_0x192a1c){if(_0x192a1c){return _0x192a1c['update'](_0x3a7f61)[_0x0962('0x25')](function(_0xfd8539){return _0xfd8539;});}return null;};}function removeEntity(_0x479f27,_0x27ced7){return function(_0x13a605){if(_0x13a605){return _0x13a605[_0x0962('0x26')]()[_0x0962('0x25')](function(){_0x479f27[_0x0962('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d716,_0x2e06fa){return function(_0x402d28){if(!_0x402d28){_0x54d716['sendStatus'](0x194);}return _0x402d28;};}function handleError(_0x2b4074,_0x359cb7){_0x359cb7=_0x359cb7||0x1f4;return function(_0x19d041){logger[_0x0962('0x27')](_0x19d041[_0x0962('0x28')]);if(_0x19d041[_0x0962('0x29')]){delete _0x19d041[_0x0962('0x29')];}_0x2b4074[_0x0962('0x1c')](_0x359cb7)[_0x0962('0x2a')](_0x19d041);};}exports[_0x0962('0x2b')]=function(_0x3aceb7,_0x21737a){var _0x576144={},_0xe73765={},_0x4e2fc8={'count':0x0,'rows':[]};var _0x48071d=_[_0x0962('0x2c')](db[_0x0962('0x2d')][_0x0962('0x2e')],function(_0x415567){return{'name':_0x415567[_0x0962('0x2f')],'type':_0x415567[_0x0962('0x30')]['key']};});_0xe73765[_0x0962('0x31')]=_['map'](_0x48071d,'name');_0xe73765['query']=_[_0x0962('0x32')](_0x3aceb7[_0x0962('0x33')]);_0xe73765['filters']=_[_0x0962('0x34')](_0xe73765[_0x0962('0x31')],_0xe73765[_0x0962('0x33')]);_0x576144[_0x0962('0x35')]=_[_0x0962('0x34')](_0xe73765['model'],qs[_0x0962('0x36')](_0x3aceb7[_0x0962('0x33')][_0x0962('0x36')]));_0x576144[_0x0962('0x35')]=_0x576144[_0x0962('0x35')][_0x0962('0x37')]?_0x576144[_0x0962('0x35')]:_0xe73765[_0x0962('0x31')];if(!_0x3aceb7['query'][_0x0962('0x38')](_0x0962('0x39'))){_0x576144['limit']=qs['limit'](_0x3aceb7['query'][_0x0962('0x22')]);_0x576144['offset']=qs[_0x0962('0x1f')](_0x3aceb7[_0x0962('0x33')][_0x0962('0x1f')]);}_0x576144[_0x0962('0x3a')]=qs['sort'](_0x3aceb7[_0x0962('0x33')][_0x0962('0x3b')]);_0x576144[_0x0962('0x3c')]=qs[_0x0962('0x3d')](_['pick'](_0x3aceb7[_0x0962('0x33')],_0xe73765[_0x0962('0x3d')]),_0x48071d);if(_0x3aceb7[_0x0962('0x33')]['filter']){_0x576144[_0x0962('0x3c')]=_[_0x0962('0x3e')](_0x576144[_0x0962('0x3c')],{'$or':_[_0x0962('0x2c')](_0x48071d,function(_0x3fc80a){if(_0x3fc80a[_0x0962('0x30')]!==_0x0962('0x3f')){var _0x58c6de={};_0x58c6de[_0x3fc80a[_0x0962('0x29')]]={'$like':'%'+_0x3aceb7['query'][_0x0962('0x40')]+'%'};return _0x58c6de;}})});}_0x576144=_[_0x0962('0x3e')]({},_0x576144,_0x3aceb7[_0x0962('0x41')]);var _0x1dbfb7={'where':_0x576144[_0x0962('0x3c')]};return db[_0x0962('0x2d')][_0x0962('0x21')](_0x1dbfb7)['then'](function(_0x420137){_0x4e2fc8[_0x0962('0x21')]=_0x420137;if(_0x3aceb7[_0x0962('0x33')]['includeAll']){_0x576144['include']=[{'all':!![]}];}return db[_0x0962('0x2d')][_0x0962('0x42')](_0x576144);})[_0x0962('0x25')](function(_0x3b28d6){_0x4e2fc8[_0x0962('0x43')]=_0x3b28d6;return _0x4e2fc8;})[_0x0962('0x25')](respondWithFilteredResult(_0x21737a,_0x576144))['catch'](handleError(_0x21737a,null));};exports[_0x0962('0x44')]=function(_0x40cf62,_0x16e749){var _0x59a869={'raw':!![],'where':{'id':_0x40cf62[_0x0962('0x45')]['id']}},_0xf484d3={};_0xf484d3[_0x0962('0x31')]=_[_0x0962('0x32')](db[_0x0962('0x2d')]['rawAttributes']);_0xf484d3[_0x0962('0x33')]=_[_0x0962('0x32')](_0x40cf62[_0x0962('0x33')]);_0xf484d3[_0x0962('0x3d')]=_[_0x0962('0x34')](_0xf484d3[_0x0962('0x31')],_0xf484d3[_0x0962('0x33')]);_0x59a869['attributes']=_[_0x0962('0x34')](_0xf484d3['model'],qs[_0x0962('0x36')](_0x40cf62['query']['fields']));_0x59a869[_0x0962('0x35')]=_0x59a869[_0x0962('0x35')]['length']?_0x59a869['attributes']:_0xf484d3[_0x0962('0x31')];if(_0x40cf62['query'][_0x0962('0x46')]){_0x59a869[_0x0962('0x47')]=[{'all':!![]}];}_0x59a869=_['merge']({},_0x59a869,_0x40cf62['options']);return db[_0x0962('0x2d')][_0x0962('0x48')](_0x59a869)[_0x0962('0x25')](handleEntityNotFound(_0x16e749,null))[_0x0962('0x25')](respondWithResult(_0x16e749,null))[_0x0962('0x49')](handleError(_0x16e749,null));};exports[_0x0962('0x4a')]=function(_0x34c38e,_0x128049){return db[_0x0962('0x2d')][_0x0962('0x4a')](_0x34c38e[_0x0962('0x4b')],{})[_0x0962('0x25')](respondWithResult(_0x128049,0xc9))['catch'](handleError(_0x128049,null));};exports[_0x0962('0x4c')]=function(_0x2557dd,_0x1ebe77){if(_0x2557dd[_0x0962('0x4b')]['id']){delete _0x2557dd[_0x0962('0x4b')]['id'];}return db[_0x0962('0x2d')][_0x0962('0x48')]({'where':{'id':_0x2557dd[_0x0962('0x45')]['id']}})[_0x0962('0x25')](handleEntityNotFound(_0x1ebe77,null))[_0x0962('0x25')](saveUpdates(_0x2557dd[_0x0962('0x4b')],null))[_0x0962('0x25')](respondWithResult(_0x1ebe77,null))[_0x0962('0x49')](handleError(_0x1ebe77,null));};exports[_0x0962('0x26')]=function(_0xe70b37,_0x10dc94){return db[_0x0962('0x2d')][_0x0962('0x48')]({'where':{'id':_0xe70b37[_0x0962('0x45')]['id']}})[_0x0962('0x25')](handleEntityNotFound(_0x10dc94,null))[_0x0962('0x25')](removeEntity(_0x10dc94,null))[_0x0962('0x49')](handleError(_0x10dc94,null));};exports[_0x0962('0x4d')]=function(_0x5e2223,_0x2af905){return db['OpenchannelQueueReport']['describe']()[_0x0962('0x25')](respondWithResult(_0x2af905,null))['catch'](handleError(_0x2af905,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6bf6b11..083d3b0 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0xc582b4,_0x3eecca){var _0x386664=function(_0x4a9638){while(--_0x4a9638){_0xc582b4['push'](_0xc582b4['shift']());}};_0x386664(++_0x3eecca);}(_0xe14b,0x93));var _0xbe14=function(_0x4eed89,_0x108efd){_0x4eed89=_0x4eed89-0x0;var _0x1d6ded=_0xe14b[_0x4eed89];return _0x1d6ded;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x33bc9a,_0x838971){var _0x5a6f6a=function(_0x30db4b){while(--_0x30db4b){_0x33bc9a['push'](_0x33bc9a['shift']());}};_0x5a6f6a(++_0x838971);}(_0x7a54,0x106));var _0x47a5=function(_0x30af64,_0x3ab86c){_0x30af64=_0x30af64-0x0;var _0x2a9242=_0x7a54[_0x30af64];return _0x2a9242;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6862216..5d2c75e 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 _0x1a37=['error','message','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d3906,_0x12c2b1){var _0x175d32=function(_0xc3a202){while(--_0xc3a202){_0x3d3906['push'](_0x3d3906['shift']());}};_0x175d32(++_0x12c2b1);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1a37[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45050a,_0x231ea7,_0x2bb6a2){return new BPromise(function(_0x4a9ab2,_0x53b893){return client['request'](_0x45050a,_0x2bb6a2)['then'](function(_0x89da86){logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,_0x71a3('0xe'));logger[_0x71a3('0xf')](_0x71a3('0x10'),_0x231ea7,_0x71a3('0xe'),JSON[_0x71a3('0x11')](_0x89da86));if(_0x89da86['error']){if(_0x89da86['error']['code']===0x1f4){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x53b893(_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);}logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x4a9ab2(_0x89da86[_0x71a3('0x12')]['message']);}else{logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,'request\x20sent');_0x4a9ab2(_0x89da86['result'][_0x71a3('0x13')]);}})[_0x71a3('0x14')](function(_0xee797f){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0xee797f);_0x53b893(_0xee797f);});});}exports[_0x71a3('0x15')]=function(_0x5d4dee){var _0x656cd2=this;return new Promise(function(_0x27bfb4,_0x5b955a){return db['OpenchannelQueueReport'][_0x71a3('0x16')](_0x5d4dee[_0x71a3('0x17')],{'raw':_0x5d4dee[_0x71a3('0x18')]?_0x5d4dee[_0x71a3('0x18')][_0x71a3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1ab947){logger[_0x71a3('0xc')](_0x71a3('0x15'),_0x5d4dee);logger[_0x71a3('0xf')](_0x71a3('0x15'),_0x5d4dee,JSON['stringify'](_0x1ab947));_0x27bfb4(_0x1ab947);})[_0x71a3('0x14')](function(_0x5bbaee){logger[_0x71a3('0x12')](_0x71a3('0x15'),_0x5bbaee[_0x71a3('0x13')],_0x5d4dee);_0x5b955a(_0x656cd2[_0x71a3('0x12')](0x1f4,_0x5bbaee[_0x71a3('0x13')]));});});};exports[_0x71a3('0x1a')]=function(_0x5f33c5){var _0x26e6e7=this;return new Promise(function(_0x299d1d,_0xb9c195){return db[_0x71a3('0x1b')][_0x71a3('0x1c')](_0x5f33c5['body'],{'raw':_0x5f33c5[_0x71a3('0x18')]?_0x5f33c5[_0x71a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f33c5[_0x71a3('0x18')]?_0x5f33c5['options'][_0x71a3('0x1d')]||null:null,'attributes':_0x5f33c5[_0x71a3('0x18')]?_0x5f33c5[_0x71a3('0x18')][_0x71a3('0x1e')]||null:null,'limit':_0x5f33c5[_0x71a3('0x18')]?_0x5f33c5[_0x71a3('0x18')][_0x71a3('0x1f')]||null:null})[_0x71a3('0x20')](function(_0x305eb1){logger[_0x71a3('0xc')](_0x71a3('0x1a'),_0x5f33c5);logger[_0x71a3('0xf')]('UpdateOpenchannelQueueReport',_0x5f33c5,JSON[_0x71a3('0x11')](_0x305eb1));_0x299d1d(_0x305eb1);})[_0x71a3('0x14')](function(_0x334db0){logger[_0x71a3('0x12')]('UpdateOpenchannelQueueReport',_0x334db0[_0x71a3('0x13')],_0x5f33c5);_0xb9c195(_0x26e6e7[_0x71a3('0x12')](0x1f4,_0x334db0[_0x71a3('0x13')]));});});}; \ No newline at end of file +var _0xd070=['catch','create','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xd58fc1,_0x1d931c){var _0xc71c40=function(_0x8f4d82){while(--_0x8f4d82){_0xd58fc1['push'](_0xd58fc1['shift']());}};_0xc71c40(++_0x1d931c);}(_0xd070,0x8e));var _0x0d07=function(_0x232032,_0x1683d1){_0x232032=_0x232032-0x0;var _0x21b8b9=_0xd070[_0x232032];return _0x21b8b9;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['CreateOpenchannelQueueReport']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['OpenchannelQueueReport'][_0x0d07('0x18')](_0x187df2['body'],{'raw':_0x187df2['options']?_0x187df2[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0d07('0xd')](function(_0x54790f){logger[_0x0d07('0xe')]('CreateOpenchannelQueueReport',_0x187df2);logger['debug'](_0x0d07('0x1a'),_0x187df2,JSON[_0x0d07('0x12')](_0x54790f));_0x52cb4b(_0x54790f);})[_0x0d07('0x17')](function(_0x57e997){logger[_0x0d07('0x13')]('CreateOpenchannelQueueReport',_0x57e997['message'],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x57e997[_0x0d07('0x15')]));});});};exports[_0x0d07('0x1b')]=function(_0x19f82f){var _0x4e0c97=this;return new Promise(function(_0x5898db,_0x9d9bfd){return db['OpenchannelQueueReport'][_0x0d07('0x1c')](_0x19f82f[_0x0d07('0x1d')],{'raw':_0x19f82f['options']?_0x19f82f[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19f82f['options']?_0x19f82f['options'][_0x0d07('0x1e')]||null:null,'attributes':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x1f')]||null:null,'limit':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x20')]||null:null})[_0x0d07('0xd')](function(_0x4c68d7){logger['info'](_0x0d07('0x1b'),_0x19f82f);logger[_0x0d07('0x11')](_0x0d07('0x1b'),_0x19f82f,JSON[_0x0d07('0x12')](_0x4c68d7));_0x5898db(_0x4c68d7);})[_0x0d07('0x17')](function(_0xb7d4d){logger[_0x0d07('0x13')](_0x0d07('0x1b'),_0xb7d4d[_0x0d07('0x15')],_0x19f82f);_0x9d9bfd(_0x4e0c97[_0x0d07('0x13')](0x1f4,_0xb7d4d[_0x0d07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8ee008f..ae64df8 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 _0x871a=['destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x871a,0x152));var _0xa871=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x871a[_0x24875d];return _0x181471;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa871('0x0'));var express=require(_0xa871('0x1'));var router=express[_0xa871('0x2')]();var fs_extra=require(_0xa871('0x3'));var auth=require(_0xa871('0x4'));var interaction=require(_0xa871('0x5'));var config=require(_0xa871('0x6'));var controller=require(_0xa871('0x7'));router[_0xa871('0x8')]('/',auth[_0xa871('0x9')](),controller[_0xa871('0xa')]);router[_0xa871('0x8')]('/describe',auth[_0xa871('0x9')](),controller[_0xa871('0xb')]);router[_0xa871('0x8')](_0xa871('0xc'),auth[_0xa871('0x9')](),controller[_0xa871('0xd')]);router[_0xa871('0xe')]('/',auth[_0xa871('0x9')](),controller[_0xa871('0xf')]);router[_0xa871('0x10')](_0xa871('0xc'),auth[_0xa871('0x9')](),controller[_0xa871('0x11')]);router[_0xa871('0x12')](_0xa871('0xc'),auth['isAuthenticated'](),controller[_0xa871('0x13')]);module[_0xa871('0x14')]=router; \ No newline at end of file +var _0x33a1=['post','create','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0x33a1,0x1f3));var _0x133a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x33a1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x133a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x133a('0x1')]();var fs_extra=require(_0x133a('0x2'));var auth=require(_0x133a('0x3'));var interaction=require(_0x133a('0x4'));var config=require(_0x133a('0x5'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x133a('0x6')]);router[_0x133a('0x7')](_0x133a('0x8'),auth[_0x133a('0x9')](),controller['describe']);router[_0x133a('0x7')](_0x133a('0xa'),auth[_0x133a('0x9')](),controller['show']);router[_0x133a('0xb')]('/',auth[_0x133a('0x9')](),controller[_0x133a('0xc')]);router['put'](_0x133a('0xa'),auth['isAuthenticated'](),controller[_0x133a('0xd')]);router[_0x133a('0xe')](_0x133a('0xa'),auth[_0x133a('0x9')](),controller[_0x133a('0xf')]);module[_0x133a('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 43f1d6b..bbd5828 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x32b3cb,_0x3d41aa){var _0x3c8f7c=function(_0x2bf4b1){while(--_0x2bf4b1){_0x32b3cb['push'](_0x32b3cb['shift']());}};_0x3c8f7c(++_0x3d41aa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xcb91[_0x903228];return _0xcec81d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4a743e,_0x2ed02b){var _0x354374=function(_0x4ec1aa){while(--_0x4ec1aa){_0x4a743e['push'](_0x4a743e['shift']());}};_0x354374(++_0x2ed02b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xcb91[_0x4bc4c8];return _0x3bb121;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index cd0a256..bc6480e 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 _0x2cc7=['set','save','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x1623f4,_0x33c897){var _0x52e5cd=function(_0x4dd166){while(--_0x4dd166){_0x1623f4['push'](_0x1623f4['shift']());}};_0x52e5cd(++_0x33c897);}(_0x2cc7,0x70));var _0x72cc=function(_0x1b5171,_0x2cd6e3){_0x1b5171=_0x1b5171-0x0;var _0x2d099f=_0x2cc7[_0x1b5171];return _0x2d099f;};'use strict';var emlformat=require(_0x72cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72cc('0x1'));var jsonpatch=require(_0x72cc('0x2'));var rp=require(_0x72cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x72cc('0x4'));var util=require(_0x72cc('0x5'));var path=require(_0x72cc('0x6'));var sox=require(_0x72cc('0x7'));var csv=require(_0x72cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72cc('0x9'));var squel=require(_0x72cc('0xa'));var crypto=require(_0x72cc('0xb'));var jsforce=require(_0x72cc('0xc'));var deskjs=require(_0x72cc('0xd'));var toCsv=require(_0x72cc('0x8'));var querystring=require(_0x72cc('0xe'));var Papa=require(_0x72cc('0xf'));var Redis=require('ioredis');var authService=require(_0x72cc('0x10'));var qs=require(_0x72cc('0x11'));var as=require(_0x72cc('0x12'));var hardwareService=require(_0x72cc('0x13'));var logger=require(_0x72cc('0x14'))('api');var utils=require(_0x72cc('0x15'));var config=require(_0x72cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x72cc('0x17'))['db'];function respondWithStatusCode(_0x1c4719,_0x16f3ac){_0x16f3ac=_0x16f3ac||0xcc;return function(_0x295ccc){if(_0x295ccc){return _0x1c4719[_0x72cc('0x18')](_0x16f3ac);}return _0x1c4719[_0x72cc('0x19')](_0x16f3ac)[_0x72cc('0x1a')]();};}function respondWithResult(_0x387c4d,_0x5dd7c1){_0x5dd7c1=_0x5dd7c1||0xc8;return function(_0x5edbe1){if(_0x5edbe1){return _0x387c4d[_0x72cc('0x19')](_0x5dd7c1)[_0x72cc('0x1b')](_0x5edbe1);}};}function respondWithFilteredResult(_0x580eac,_0xa351ce){return function(_0x530864){if(_0x530864){var _0x3dc902=typeof _0xa351ce[_0x72cc('0x1c')]===_0x72cc('0x1d')&&typeof _0xa351ce[_0x72cc('0x1e')]==='undefined';var _0x5127d2=_0x530864[_0x72cc('0x1f')];var _0x29faa2=_0x3dc902?0x0:_0xa351ce[_0x72cc('0x1c')];var _0x3b0a04=_0x3dc902?_0x530864[_0x72cc('0x1f')]:_0xa351ce[_0x72cc('0x1c')]+_0xa351ce[_0x72cc('0x1e')];var _0x1b1df8;if(_0x3b0a04>=_0x5127d2){_0x3b0a04=_0x5127d2;_0x1b1df8=0xc8;}else{_0x1b1df8=0xce;}_0x580eac[_0x72cc('0x19')](_0x1b1df8);return _0x580eac[_0x72cc('0x20')]('Content-Range',_0x29faa2+'-'+_0x3b0a04+'/'+_0x5127d2)[_0x72cc('0x1b')](_0x530864);}return null;};}function patchUpdates(_0x346b81){return function(_0x1c28b2){try{jsonpatch['apply'](_0x1c28b2,_0x346b81,!![]);}catch(_0x43520b){return BPromise['reject'](_0x43520b);}return _0x1c28b2[_0x72cc('0x21')]();};}function saveUpdates(_0x21f1e5,_0x22227e){return function(_0x361d3f){if(_0x361d3f){return _0x361d3f['update'](_0x21f1e5)[_0x72cc('0x22')](function(_0x3ec9f5){return _0x3ec9f5;});}return null;};}function removeEntity(_0x497baa,_0x16a076){return function(_0x436985){if(_0x436985){return _0x436985['destroy']()['then'](function(){_0x497baa[_0x72cc('0x19')](0xcc)[_0x72cc('0x1a')]();});}};}function handleEntityNotFound(_0x2654a0,_0x4cc70c){return function(_0x41d453){if(!_0x41d453){_0x2654a0[_0x72cc('0x18')](0x194);}return _0x41d453;};}function handleError(_0x213e64,_0xa4313b){_0xa4313b=_0xa4313b||0x1f4;return function(_0x1b5dfb){logger[_0x72cc('0x23')](_0x1b5dfb[_0x72cc('0x24')]);if(_0x1b5dfb[_0x72cc('0x25')]){delete _0x1b5dfb[_0x72cc('0x25')];}_0x213e64[_0x72cc('0x19')](_0xa4313b)[_0x72cc('0x26')](_0x1b5dfb);};}exports[_0x72cc('0x27')]=function(_0x124811,_0x6412fb){var _0x1fcd9c={},_0x5494bf={},_0x17c301={'count':0x0,'rows':[]};var _0x1e65a5=_[_0x72cc('0x28')](db[_0x72cc('0x29')][_0x72cc('0x2a')],function(_0x2a9c9b){return{'name':_0x2a9c9b['fieldName'],'type':_0x2a9c9b[_0x72cc('0x2b')][_0x72cc('0x2c')]};});_0x5494bf[_0x72cc('0x2d')]=_[_0x72cc('0x28')](_0x1e65a5,_0x72cc('0x25'));_0x5494bf[_0x72cc('0x2e')]=_[_0x72cc('0x2f')](_0x124811[_0x72cc('0x2e')]);_0x5494bf['filters']=_[_0x72cc('0x30')](_0x5494bf[_0x72cc('0x2d')],_0x5494bf[_0x72cc('0x2e')]);_0x1fcd9c['attributes']=_['intersection'](_0x5494bf[_0x72cc('0x2d')],qs['fields'](_0x124811[_0x72cc('0x2e')]['fields']));_0x1fcd9c[_0x72cc('0x31')]=_0x1fcd9c[_0x72cc('0x31')][_0x72cc('0x32')]?_0x1fcd9c['attributes']:_0x5494bf[_0x72cc('0x2d')];if(!_0x124811[_0x72cc('0x2e')][_0x72cc('0x33')](_0x72cc('0x34'))){_0x1fcd9c[_0x72cc('0x1e')]=qs[_0x72cc('0x1e')](_0x124811[_0x72cc('0x2e')]['limit']);_0x1fcd9c['offset']=qs[_0x72cc('0x1c')](_0x124811[_0x72cc('0x2e')][_0x72cc('0x1c')]);}_0x1fcd9c['order']=qs['sort'](_0x124811['query']['sort']);_0x1fcd9c[_0x72cc('0x35')]=qs[_0x72cc('0x36')](_[_0x72cc('0x37')](_0x124811['query'],_0x5494bf[_0x72cc('0x36')]),_0x1e65a5);if(_0x124811[_0x72cc('0x2e')][_0x72cc('0x38')]){_0x1fcd9c[_0x72cc('0x35')]=_[_0x72cc('0x39')](_0x1fcd9c['where'],{'$or':_[_0x72cc('0x28')](_0x1e65a5,function(_0x4c72b5){if(_0x4c72b5[_0x72cc('0x2b')]!==_0x72cc('0x3a')){var _0x3a2ba8={};_0x3a2ba8[_0x4c72b5[_0x72cc('0x25')]]={'$like':'%'+_0x124811['query']['filter']+'%'};return _0x3a2ba8;}})});}_0x1fcd9c=_['merge']({},_0x1fcd9c,_0x124811[_0x72cc('0x3b')]);var _0x8c12b5={'where':_0x1fcd9c[_0x72cc('0x35')]};return db[_0x72cc('0x29')][_0x72cc('0x1f')](_0x8c12b5)[_0x72cc('0x22')](function(_0x17198c){_0x17c301[_0x72cc('0x1f')]=_0x17198c;if(_0x124811[_0x72cc('0x2e')][_0x72cc('0x3c')]){_0x1fcd9c['include']=[{'all':!![]}];}return db[_0x72cc('0x29')][_0x72cc('0x3d')](_0x1fcd9c);})[_0x72cc('0x22')](function(_0x4d4d66){_0x17c301[_0x72cc('0x3e')]=_0x4d4d66;return _0x17c301;})['then'](respondWithFilteredResult(_0x6412fb,_0x1fcd9c))[_0x72cc('0x3f')](handleError(_0x6412fb,null));};exports['show']=function(_0x2ff385,_0x4bb002){var _0x4a0572={'raw':!![],'where':{'id':_0x2ff385[_0x72cc('0x40')]['id']}},_0x187840={};_0x187840[_0x72cc('0x2d')]=_[_0x72cc('0x2f')](db[_0x72cc('0x29')][_0x72cc('0x2a')]);_0x187840['query']=_[_0x72cc('0x2f')](_0x2ff385[_0x72cc('0x2e')]);_0x187840[_0x72cc('0x36')]=_['intersection'](_0x187840[_0x72cc('0x2d')],_0x187840[_0x72cc('0x2e')]);_0x4a0572[_0x72cc('0x31')]=_[_0x72cc('0x30')](_0x187840[_0x72cc('0x2d')],qs[_0x72cc('0x41')](_0x2ff385[_0x72cc('0x2e')][_0x72cc('0x41')]));_0x4a0572[_0x72cc('0x31')]=_0x4a0572[_0x72cc('0x31')][_0x72cc('0x32')]?_0x4a0572[_0x72cc('0x31')]:_0x187840[_0x72cc('0x2d')];if(_0x2ff385['query'][_0x72cc('0x3c')]){_0x4a0572['include']=[{'all':!![]}];}_0x4a0572=_[_0x72cc('0x39')]({},_0x4a0572,_0x2ff385[_0x72cc('0x3b')]);return db[_0x72cc('0x29')][_0x72cc('0x42')](_0x4a0572)[_0x72cc('0x22')](handleEntityNotFound(_0x4bb002,null))[_0x72cc('0x22')](respondWithResult(_0x4bb002,null))['catch'](handleError(_0x4bb002,null));};exports['create']=function(_0x5aa1ba,_0x4d7e7c){return db[_0x72cc('0x29')][_0x72cc('0x43')](_0x5aa1ba[_0x72cc('0x44')],{})[_0x72cc('0x22')](respondWithResult(_0x4d7e7c,0xc9))[_0x72cc('0x3f')](handleError(_0x4d7e7c,null));};exports[_0x72cc('0x45')]=function(_0x3b1e0c,_0xb68da4){if(_0x3b1e0c[_0x72cc('0x44')]['id']){delete _0x3b1e0c['body']['id'];}return db[_0x72cc('0x29')]['find']({'where':{'id':_0x3b1e0c[_0x72cc('0x40')]['id']}})[_0x72cc('0x22')](handleEntityNotFound(_0xb68da4,null))[_0x72cc('0x22')](saveUpdates(_0x3b1e0c['body'],null))[_0x72cc('0x22')](respondWithResult(_0xb68da4,null))[_0x72cc('0x3f')](handleError(_0xb68da4,null));};exports[_0x72cc('0x46')]=function(_0x54f504,_0x50fe8e){return db[_0x72cc('0x29')][_0x72cc('0x42')]({'where':{'id':_0x54f504[_0x72cc('0x40')]['id']}})[_0x72cc('0x22')](handleEntityNotFound(_0x50fe8e,null))['then'](removeEntity(_0x50fe8e,null))['catch'](handleError(_0x50fe8e,null));};exports['describe']=function(_0xfeba43,_0x16ab13){return db[_0x72cc('0x29')][_0x72cc('0x47')]()[_0x72cc('0x22')](respondWithResult(_0x16ab13,null))[_0x72cc('0x3f')](handleError(_0x16ab13,null));}; \ No newline at end of file +var _0xfe7c=['squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','show','length','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash'];(function(_0x4fd8d7,_0x129968){var _0x58d7dc=function(_0x244418){while(--_0x244418){_0x4fd8d7['push'](_0x4fd8d7['shift']());}};_0x58d7dc(++_0x129968);}(_0xfe7c,0x172));var _0xcfe7=function(_0x50403a,_0x5a96c8){_0x50403a=_0x50403a-0x0;var _0x2fad23=_0xfe7c[_0x50403a];return _0x2fad23;};'use strict';var emlformat=require(_0xcfe7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfe7('0x1'));var jsonpatch=require(_0xcfe7('0x2'));var rp=require(_0xcfe7('0x3'));var moment=require(_0xcfe7('0x4'));var BPromise=require(_0xcfe7('0x5'));var Mustache=require(_0xcfe7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcfe7('0x7'));var fs=require('fs');var fs_extra=require(_0xcfe7('0x8'));var _=require(_0xcfe7('0x9'));var squel=require(_0xcfe7('0xa'));var crypto=require(_0xcfe7('0xb'));var jsforce=require(_0xcfe7('0xc'));var deskjs=require(_0xcfe7('0xd'));var toCsv=require(_0xcfe7('0xe'));var querystring=require(_0xcfe7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcfe7('0x10'));var qs=require(_0xcfe7('0x11'));var as=require(_0xcfe7('0x12'));var hardwareService=require(_0xcfe7('0x13'));var logger=require(_0xcfe7('0x14'))(_0xcfe7('0x15'));var utils=require(_0xcfe7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcfe7('0x17'));var db=require(_0xcfe7('0x18'))['db'];function respondWithStatusCode(_0x558f32,_0x4ad43e){_0x4ad43e=_0x4ad43e||0xcc;return function(_0xc2a72a){if(_0xc2a72a){return _0x558f32['sendStatus'](_0x4ad43e);}return _0x558f32[_0xcfe7('0x19')](_0x4ad43e)[_0xcfe7('0x1a')]();};}function respondWithResult(_0x1466ac,_0x58fa34){_0x58fa34=_0x58fa34||0xc8;return function(_0x1f5804){if(_0x1f5804){return _0x1466ac[_0xcfe7('0x19')](_0x58fa34)[_0xcfe7('0x1b')](_0x1f5804);}};}function respondWithFilteredResult(_0x490863,_0x5d0ddf){return function(_0x2b9e89){if(_0x2b9e89){var _0x22b0da=typeof _0x5d0ddf['offset']==='undefined'&&typeof _0x5d0ddf[_0xcfe7('0x1c')]===_0xcfe7('0x1d');var _0x23bb30=_0x2b9e89[_0xcfe7('0x1e')];var _0x295414=_0x22b0da?0x0:_0x5d0ddf[_0xcfe7('0x1f')];var _0x210196=_0x22b0da?_0x2b9e89[_0xcfe7('0x1e')]:_0x5d0ddf['offset']+_0x5d0ddf[_0xcfe7('0x1c')];var _0x2e419a;if(_0x210196>=_0x23bb30){_0x210196=_0x23bb30;_0x2e419a=0xc8;}else{_0x2e419a=0xce;}_0x490863[_0xcfe7('0x19')](_0x2e419a);return _0x490863['set'](_0xcfe7('0x20'),_0x295414+'-'+_0x210196+'/'+_0x23bb30)[_0xcfe7('0x1b')](_0x2b9e89);}return null;};}function patchUpdates(_0x30a729){return function(_0x56004f){try{jsonpatch[_0xcfe7('0x21')](_0x56004f,_0x30a729,!![]);}catch(_0x3de056){return BPromise[_0xcfe7('0x22')](_0x3de056);}return _0x56004f['save']();};}function saveUpdates(_0x4fbe5d,_0x15200c){return function(_0x2c0522){if(_0x2c0522){return _0x2c0522['update'](_0x4fbe5d)[_0xcfe7('0x23')](function(_0x3bce2e){return _0x3bce2e;});}return null;};}function removeEntity(_0x1d34fe,_0x4158c9){return function(_0x4e5ade){if(_0x4e5ade){return _0x4e5ade[_0xcfe7('0x24')]()[_0xcfe7('0x23')](function(){_0x1d34fe['status'](0xcc)[_0xcfe7('0x1a')]();});}};}function handleEntityNotFound(_0x4addc1,_0x4ac893){return function(_0x1fb232){if(!_0x1fb232){_0x4addc1[_0xcfe7('0x25')](0x194);}return _0x1fb232;};}function handleError(_0x3e6776,_0x580061){_0x580061=_0x580061||0x1f4;return function(_0x29a61b){logger[_0xcfe7('0x26')](_0x29a61b[_0xcfe7('0x27')]);if(_0x29a61b[_0xcfe7('0x28')]){delete _0x29a61b['name'];}_0x3e6776[_0xcfe7('0x19')](_0x580061)[_0xcfe7('0x29')](_0x29a61b);};}exports[_0xcfe7('0x2a')]=function(_0x434e21,_0x35a511){var _0x39e2b6={},_0x1692e0={},_0x268ade={'count':0x0,'rows':[]};var _0x34b50b=_[_0xcfe7('0x2b')](db['OpenchannelTransferReport'][_0xcfe7('0x2c')],function(_0x367030){return{'name':_0x367030['fieldName'],'type':_0x367030['type']['key']};});_0x1692e0['model']=_[_0xcfe7('0x2b')](_0x34b50b,_0xcfe7('0x28'));_0x1692e0[_0xcfe7('0x2d')]=_[_0xcfe7('0x2e')](_0x434e21[_0xcfe7('0x2d')]);_0x1692e0[_0xcfe7('0x2f')]=_[_0xcfe7('0x30')](_0x1692e0[_0xcfe7('0x31')],_0x1692e0[_0xcfe7('0x2d')]);_0x39e2b6['attributes']=_['intersection'](_0x1692e0[_0xcfe7('0x31')],qs[_0xcfe7('0x32')](_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x32')]));_0x39e2b6[_0xcfe7('0x33')]=_0x39e2b6[_0xcfe7('0x33')]['length']?_0x39e2b6[_0xcfe7('0x33')]:_0x1692e0[_0xcfe7('0x31')];if(!_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x34')](_0xcfe7('0x35'))){_0x39e2b6[_0xcfe7('0x1c')]=qs['limit'](_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x1c')]);_0x39e2b6[_0xcfe7('0x1f')]=qs[_0xcfe7('0x1f')](_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x1f')]);}_0x39e2b6['order']=qs[_0xcfe7('0x36')](_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x36')]);_0x39e2b6['where']=qs['filters'](_[_0xcfe7('0x37')](_0x434e21[_0xcfe7('0x2d')],_0x1692e0['filters']),_0x34b50b);if(_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x38')]){_0x39e2b6[_0xcfe7('0x39')]=_[_0xcfe7('0x3a')](_0x39e2b6[_0xcfe7('0x39')],{'$or':_['map'](_0x34b50b,function(_0x1255f2){if(_0x1255f2[_0xcfe7('0x3b')]!==_0xcfe7('0x3c')){var _0x142a9f={};_0x142a9f[_0x1255f2[_0xcfe7('0x28')]]={'$like':'%'+_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x38')]+'%'};return _0x142a9f;}})});}_0x39e2b6=_['merge']({},_0x39e2b6,_0x434e21[_0xcfe7('0x3d')]);var _0x37630a={'where':_0x39e2b6[_0xcfe7('0x39')]};return db['OpenchannelTransferReport'][_0xcfe7('0x1e')](_0x37630a)[_0xcfe7('0x23')](function(_0x2951b8){_0x268ade[_0xcfe7('0x1e')]=_0x2951b8;if(_0x434e21[_0xcfe7('0x2d')][_0xcfe7('0x3e')]){_0x39e2b6[_0xcfe7('0x3f')]=[{'all':!![]}];}return db[_0xcfe7('0x40')][_0xcfe7('0x41')](_0x39e2b6);})[_0xcfe7('0x23')](function(_0x597902){_0x268ade[_0xcfe7('0x42')]=_0x597902;return _0x268ade;})[_0xcfe7('0x23')](respondWithFilteredResult(_0x35a511,_0x39e2b6))[_0xcfe7('0x43')](handleError(_0x35a511,null));};exports[_0xcfe7('0x44')]=function(_0xc7a79d,_0x42a12a){var _0x34c2f7={'raw':!![],'where':{'id':_0xc7a79d['params']['id']}},_0x55f3b9={};_0x55f3b9[_0xcfe7('0x31')]=_[_0xcfe7('0x2e')](db['OpenchannelTransferReport'][_0xcfe7('0x2c')]);_0x55f3b9['query']=_[_0xcfe7('0x2e')](_0xc7a79d[_0xcfe7('0x2d')]);_0x55f3b9['filters']=_[_0xcfe7('0x30')](_0x55f3b9[_0xcfe7('0x31')],_0x55f3b9[_0xcfe7('0x2d')]);_0x34c2f7[_0xcfe7('0x33')]=_['intersection'](_0x55f3b9[_0xcfe7('0x31')],qs[_0xcfe7('0x32')](_0xc7a79d[_0xcfe7('0x2d')][_0xcfe7('0x32')]));_0x34c2f7[_0xcfe7('0x33')]=_0x34c2f7[_0xcfe7('0x33')][_0xcfe7('0x45')]?_0x34c2f7[_0xcfe7('0x33')]:_0x55f3b9['model'];if(_0xc7a79d[_0xcfe7('0x2d')]['includeAll']){_0x34c2f7[_0xcfe7('0x3f')]=[{'all':!![]}];}_0x34c2f7=_[_0xcfe7('0x3a')]({},_0x34c2f7,_0xc7a79d[_0xcfe7('0x3d')]);return db[_0xcfe7('0x40')][_0xcfe7('0x46')](_0x34c2f7)['then'](handleEntityNotFound(_0x42a12a,null))[_0xcfe7('0x23')](respondWithResult(_0x42a12a,null))[_0xcfe7('0x43')](handleError(_0x42a12a,null));};exports['create']=function(_0x4cd35d,_0xf35db1){return db[_0xcfe7('0x40')][_0xcfe7('0x47')](_0x4cd35d[_0xcfe7('0x48')],{})[_0xcfe7('0x23')](respondWithResult(_0xf35db1,0xc9))['catch'](handleError(_0xf35db1,null));};exports[_0xcfe7('0x49')]=function(_0x1bac9a,_0x22f2ac){if(_0x1bac9a[_0xcfe7('0x48')]['id']){delete _0x1bac9a[_0xcfe7('0x48')]['id'];}return db[_0xcfe7('0x40')]['find']({'where':{'id':_0x1bac9a[_0xcfe7('0x4a')]['id']}})[_0xcfe7('0x23')](handleEntityNotFound(_0x22f2ac,null))['then'](saveUpdates(_0x1bac9a[_0xcfe7('0x48')],null))['then'](respondWithResult(_0x22f2ac,null))['catch'](handleError(_0x22f2ac,null));};exports[_0xcfe7('0x24')]=function(_0x34fba3,_0x1639c4){return db['OpenchannelTransferReport'][_0xcfe7('0x46')]({'where':{'id':_0x34fba3[_0xcfe7('0x4a')]['id']}})[_0xcfe7('0x23')](handleEntityNotFound(_0x1639c4,null))[_0xcfe7('0x23')](removeEntity(_0x1639c4,null))[_0xcfe7('0x43')](handleError(_0x1639c4,null));};exports[_0xcfe7('0x4b')]=function(_0x4839c7,_0x2e7191){return db['OpenchannelTransferReport'][_0xcfe7('0x4b')]()[_0xcfe7('0x23')](respondWithResult(_0x2e7191,null))[_0xcfe7('0x43')](handleError(_0x2e7191,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8e35a24..4a158b7 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 _0xdf68=['report_openchannel_transfer','uniqueid','moment','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x573325,_0x2f2fa5){var _0x1987bb=function(_0x2dfffa){while(--_0x2dfffa){_0x573325['push'](_0x573325['shift']());}};_0x1987bb(++_0x2f2fa5);}(_0xdf68,0x106));var _0x8df6=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0xdf68[_0x2fb87c];return _0x43038b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8df6('0x0'));var BPromise=require('bluebird');var rp=require(_0x8df6('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8df6('0x2'));var config=require(_0x8df6('0x3'));var attributes=require(_0x8df6('0x4'));module[_0x8df6('0x5')]=function(_0x34af0d,_0x37f6df){return _0x34af0d[_0x8df6('0x6')](_0x8df6('0x7'),attributes,{'tableName':_0x8df6('0x8'),'paranoid':![],'indexes':[{'name':_0x8df6('0x9'),'fields':[_0x8df6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09b9=['api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x4a7362,_0x145e38){var _0x5ce767=function(_0x6010d5){while(--_0x6010d5){_0x4a7362['push'](_0x4a7362['shift']());}};_0x5ce767(++_0x145e38);}(_0x09b9,0x184));var _0x909b=function(_0x38c251,_0x1c9fa5){_0x38c251=_0x38c251-0x0;var _0x19d273=_0x09b9[_0x38c251];return _0x19d273;};'use strict';var _=require(_0x909b('0x0'));var util=require(_0x909b('0x1'));var logger=require('../../config/logger')(_0x909b('0x2'));var moment=require(_0x909b('0x3'));var BPromise=require(_0x909b('0x4'));var rp=require(_0x909b('0x5'));var fs=require('fs');var path=require(_0x909b('0x6'));var rimraf=require(_0x909b('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x909b('0x8')]=function(_0x2e4e5b,_0x2e655a){return _0x2e4e5b[_0x909b('0x9')](_0x909b('0xa'),attributes,{'tableName':_0x909b('0xb'),'paranoid':![],'indexes':[{'name':_0x909b('0xc'),'fields':[_0x909b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 6bfa9c4..bff6991 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 _0x9c5a=['http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xa343c1,_0x2f18b6){var _0x135c86=function(_0x4afa94){while(--_0x4afa94){_0xa343c1['push'](_0xa343c1['shift']());}};_0x135c86(++_0x2f18b6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xff6233,_0x340fc3){_0xff6233=_0xff6233-0x0;var _0x2699a7=_0x9c5a[_0xff6233];return _0x2699a7;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0x26d1=['OpenchannelTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x26d1,0x8e));var _0x126d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x26d1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4dfc,_0x4e5e87,_0x2e668c){return new BPromise(function(_0x25ccc2,_0x7d6e4c){return client[_0x126d('0xa')](_0x2b4dfc,_0x2e668c)[_0x126d('0xb')](function(_0x1cf6fb){logger[_0x126d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x126d('0xd'));logger[_0x126d('0xe')](_0x126d('0xf'),_0x4e5e87,_0x126d('0xd'),JSON[_0x126d('0x10')](_0x1cf6fb));if(_0x1cf6fb['error']){if(_0x1cf6fb[_0x126d('0x11')]['code']===0x1f4){logger[_0x126d('0x11')](_0x126d('0x12'),_0x4e5e87,_0x1cf6fb[_0x126d('0x11')]['message']);return _0x7d6e4c(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}logger[_0x126d('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x1cf6fb['error'][_0x126d('0x13')]);return _0x25ccc2(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}else{logger[_0x126d('0xc')](_0x126d('0x12'),_0x4e5e87,_0x126d('0xd'));_0x25ccc2(_0x1cf6fb['result'][_0x126d('0x13')]);}})['catch'](function(_0x352d72){logger['error'](_0x126d('0x12'),_0x4e5e87,_0x352d72);_0x7d6e4c(_0x352d72);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 2d73fd9..e61b606 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 _0x6504=['isAuthenticated','index','get','/:id','show','create','put','destroy','exports','path','../../components/auth/service','./pause.controller'];(function(_0x346681,_0x53ba33){var _0x5e20cb=function(_0x2644c1){while(--_0x2644c1){_0x346681['push'](_0x346681['shift']());}};_0x5e20cb(++_0x53ba33);}(_0x6504,0xe1));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4650('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4650('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4650('0x2'));router['get']('/',auth[_0x4650('0x3')](),controller[_0x4650('0x4')]);router[_0x4650('0x5')](_0x4650('0x6'),auth[_0x4650('0x3')](),controller[_0x4650('0x7')]);router['post']('/',auth[_0x4650('0x3')](),controller[_0x4650('0x8')]);router[_0x4650('0x9')]('/:id',auth[_0x4650('0x3')](),controller['update']);router['delete']('/:id',auth[_0x4650('0x3')](),controller[_0x4650('0xa')]);module[_0x4650('0xb')]=router; \ No newline at end of file +var _0xf739=['show','post','create','update','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf739,0x18d));var _0x9f73=function(_0x7d7814,_0x224c09){_0x7d7814=_0x7d7814-0x0;var _0x253187=_0xf739[_0x7d7814];return _0x253187;};'use strict';var multer=require(_0x9f73('0x0'));var util=require(_0x9f73('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f73('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f73('0x3'));var interaction=require(_0x9f73('0x4'));var config=require(_0x9f73('0x5'));var controller=require(_0x9f73('0x6'));router[_0x9f73('0x7')]('/',auth[_0x9f73('0x8')](),controller[_0x9f73('0x9')]);router[_0x9f73('0x7')](_0x9f73('0xa'),auth['isAuthenticated'](),controller[_0x9f73('0xb')]);router[_0x9f73('0xc')]('/',auth[_0x9f73('0x8')](),controller[_0x9f73('0xd')]);router['put'](_0x9f73('0xa'),auth['isAuthenticated'](),controller[_0x9f73('0xe')]);router['delete'](_0x9f73('0xa'),auth[_0x9f73('0x8')](),controller[_0x9f73('0xf')]);module[_0x9f73('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 43c2c01..d5c91aa 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 _0x4a0f=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a0f,0x1ba));var _0xf4a0=function(_0x43cf1a,_0x3cc9a3){_0x43cf1a=_0x43cf1a-0x0;var _0x351155=_0x4a0f[_0x43cf1a];return _0x351155;};'use strict';var Sequelize=require(_0xf4a0('0x0'));module[_0xf4a0('0x1')]={'name':{'type':Sequelize[_0xf4a0('0x2')],'unique':_0xf4a0('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c5e=['sequelize','exports','name'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x7c5e,0x129));var _0xe7c5=function(_0x4f990b,_0x48b010){_0x4f990b=_0x4f990b-0x0;var _0x26cc66=_0x7c5e[_0x4f990b];return _0x26cc66;};'use strict';var Sequelize=require(_0xe7c5('0x0'));module[_0xe7c5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe7c5('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index da0b288..4068bdd 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 _0xddb2=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Pauses','UserProfileResource','destroy','sendStatus','error','name','index','map','Pause','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xddb2,0x19f));var _0x2ddb=function(_0x32ee28,_0xaa58d){_0x32ee28=_0x32ee28-0x0;var _0x13048e=_0xddb2[_0x32ee28];return _0x13048e;};'use strict';var emlformat=require(_0x2ddb('0x0'));var rimraf=require(_0x2ddb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ddb('0x2'));var rp=require('request-promise');var moment=require(_0x2ddb('0x3'));var BPromise=require(_0x2ddb('0x4'));var Mustache=require('mustache');var util=require(_0x2ddb('0x5'));var path=require(_0x2ddb('0x6'));var sox=require('sox');var csv=require(_0x2ddb('0x7'));var ejs=require(_0x2ddb('0x8'));var fs=require('fs');var fs_extra=require(_0x2ddb('0x9'));var _=require(_0x2ddb('0xa'));var squel=require(_0x2ddb('0xb'));var crypto=require(_0x2ddb('0xc'));var jsforce=require(_0x2ddb('0xd'));var deskjs=require(_0x2ddb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2ddb('0xf'));var Papa=require('papaparse');var Redis=require(_0x2ddb('0x10'));var authService=require(_0x2ddb('0x11'));var qs=require(_0x2ddb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ddb('0x13'));var logger=require(_0x2ddb('0x14'))(_0x2ddb('0x15'));var utils=require(_0x2ddb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2ddb('0x17'));var db=require(_0x2ddb('0x18'))['db'];function respondWithStatusCode(_0x3d8eca,_0x233dc8){_0x233dc8=_0x233dc8||0xcc;return function(_0x1eee52){if(_0x1eee52){return _0x3d8eca['sendStatus'](_0x233dc8);}return _0x3d8eca[_0x2ddb('0x19')](_0x233dc8)[_0x2ddb('0x1a')]();};}function respondWithResult(_0x4cb498,_0xaebae8){_0xaebae8=_0xaebae8||0xc8;return function(_0x573609){if(_0x573609){return _0x4cb498[_0x2ddb('0x19')](_0xaebae8)[_0x2ddb('0x1b')](_0x573609);}};}function respondWithFilteredResult(_0x49cfdb,_0x29c1e9){return function(_0x5bbff1){if(_0x5bbff1){var _0x3d3d4a=typeof _0x29c1e9[_0x2ddb('0x1c')]===_0x2ddb('0x1d')&&typeof _0x29c1e9[_0x2ddb('0x1e')]===_0x2ddb('0x1d');var _0x1ac7a8=_0x5bbff1[_0x2ddb('0x1f')];var _0x10ec3b=_0x3d3d4a?0x0:_0x29c1e9[_0x2ddb('0x1c')];var _0x19c059=_0x3d3d4a?_0x5bbff1['count']:_0x29c1e9[_0x2ddb('0x1c')]+_0x29c1e9[_0x2ddb('0x1e')];var _0x4aa752;if(_0x19c059>=_0x1ac7a8){_0x19c059=_0x1ac7a8;_0x4aa752=0xc8;}else{_0x4aa752=0xce;}_0x49cfdb['status'](_0x4aa752);return _0x49cfdb[_0x2ddb('0x20')](_0x2ddb('0x21'),_0x10ec3b+'-'+_0x19c059+'/'+_0x1ac7a8)[_0x2ddb('0x1b')](_0x5bbff1);}return null;};}function patchUpdates(_0x22143a){return function(_0x2c84c3){try{jsonpatch['apply'](_0x2c84c3,_0x22143a,!![]);}catch(_0x47fa5c){return BPromise[_0x2ddb('0x22')](_0x47fa5c);}return _0x2c84c3[_0x2ddb('0x23')]();};}function saveUpdates(_0x327ea7,_0x3eb537){return function(_0x88bb5b){if(_0x88bb5b){return _0x88bb5b[_0x2ddb('0x24')](_0x327ea7)[_0x2ddb('0x25')](function(_0x291acd){return _0x291acd;});}return null;};}function removeEntity(_0x2d99f6,_0x1f9b58){return function(_0x516f87){if(_0x516f87){return _0x516f87['destroy']()[_0x2ddb('0x25')](function(){var _0x57d580=_0x516f87[_0x2ddb('0x26')]({'plain':!![]});var _0x1d2992=_0x2ddb('0x27');return db[_0x2ddb('0x28')][_0x2ddb('0x29')]({'where':{'type':_0x1d2992,'resourceId':_0x57d580['id']}})[_0x2ddb('0x25')](function(){return _0x516f87;});})[_0x2ddb('0x25')](function(){_0x2d99f6[_0x2ddb('0x19')](0xcc)[_0x2ddb('0x1a')]();});}};}function handleEntityNotFound(_0x1f7ade,_0x140103){return function(_0x210fda){if(!_0x210fda){_0x1f7ade[_0x2ddb('0x2a')](0x194);}return _0x210fda;};}function handleError(_0xb06ea0,_0x4436ba){_0x4436ba=_0x4436ba||0x1f4;return function(_0x5bfb86){logger[_0x2ddb('0x2b')](_0x5bfb86['stack']);if(_0x5bfb86[_0x2ddb('0x2c')]){delete _0x5bfb86['name'];}_0xb06ea0['status'](_0x4436ba)['send'](_0x5bfb86);};}exports[_0x2ddb('0x2d')]=function(_0x381e4e,_0x4e7010){var _0x413973={},_0x40e6ff={},_0x10eaf0={'count':0x0,'rows':[]};var _0x40557d=_[_0x2ddb('0x2e')](db[_0x2ddb('0x2f')]['rawAttributes'],function(_0x10123a){return{'name':_0x10123a['fieldName'],'type':_0x10123a[_0x2ddb('0x30')][_0x2ddb('0x31')]};});_0x40e6ff[_0x2ddb('0x32')]=_[_0x2ddb('0x2e')](_0x40557d,_0x2ddb('0x2c'));_0x40e6ff['query']=_[_0x2ddb('0x33')](_0x381e4e[_0x2ddb('0x34')]);_0x40e6ff[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x40e6ff[_0x2ddb('0x32')],_0x40e6ff[_0x2ddb('0x34')]);_0x413973[_0x2ddb('0x37')]=_[_0x2ddb('0x36')](_0x40e6ff[_0x2ddb('0x32')],qs[_0x2ddb('0x38')](_0x381e4e['query'][_0x2ddb('0x38')]));_0x413973[_0x2ddb('0x37')]=_0x413973['attributes']['length']?_0x413973[_0x2ddb('0x37')]:_0x40e6ff[_0x2ddb('0x32')];if(!_0x381e4e['query']['hasOwnProperty'](_0x2ddb('0x39'))){_0x413973['limit']=qs[_0x2ddb('0x1e')](_0x381e4e['query'][_0x2ddb('0x1e')]);_0x413973['offset']=qs[_0x2ddb('0x1c')](_0x381e4e[_0x2ddb('0x34')][_0x2ddb('0x1c')]);}_0x413973[_0x2ddb('0x3a')]=qs[_0x2ddb('0x3b')](_0x381e4e[_0x2ddb('0x34')][_0x2ddb('0x3b')]);_0x413973[_0x2ddb('0x3c')]=qs[_0x2ddb('0x35')](_['pick'](_0x381e4e[_0x2ddb('0x34')],_0x40e6ff['filters']),_0x40557d);if(_0x381e4e[_0x2ddb('0x34')]['filter']){_0x413973['where']=_['merge'](_0x413973[_0x2ddb('0x3c')],{'$or':_['map'](_0x40557d,function(_0x159d17){if(_0x159d17[_0x2ddb('0x30')]!=='VIRTUAL'){var _0x1569be={};_0x1569be[_0x159d17['name']]={'$like':'%'+_0x381e4e[_0x2ddb('0x34')][_0x2ddb('0x3d')]+'%'};return _0x1569be;}})});}_0x413973=_[_0x2ddb('0x3e')]({},_0x413973,_0x381e4e[_0x2ddb('0x3f')]);var _0x580a59={'where':_0x413973[_0x2ddb('0x3c')]};return db[_0x2ddb('0x2f')][_0x2ddb('0x1f')](_0x580a59)[_0x2ddb('0x25')](function(_0x2e44df){_0x10eaf0['count']=_0x2e44df;if(_0x381e4e[_0x2ddb('0x34')]['includeAll']){_0x413973[_0x2ddb('0x40')]=[{'all':!![]}];}return db['Pause'][_0x2ddb('0x41')](_0x413973);})[_0x2ddb('0x25')](function(_0x2538ed){_0x10eaf0[_0x2ddb('0x42')]=_0x2538ed;return _0x10eaf0;})[_0x2ddb('0x25')](respondWithFilteredResult(_0x4e7010,_0x413973))[_0x2ddb('0x43')](handleError(_0x4e7010,null));};exports['show']=function(_0x2f7751,_0x3f4c62){var _0x20e4e3={'raw':!![],'where':{'id':_0x2f7751['params']['id']}},_0x315e3f={};_0x315e3f['model']=_[_0x2ddb('0x33')](db['Pause'][_0x2ddb('0x44')]);_0x315e3f[_0x2ddb('0x34')]=_[_0x2ddb('0x33')](_0x2f7751['query']);_0x315e3f[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x315e3f['model'],_0x315e3f[_0x2ddb('0x34')]);_0x20e4e3['attributes']=_[_0x2ddb('0x36')](_0x315e3f[_0x2ddb('0x32')],qs[_0x2ddb('0x38')](_0x2f7751[_0x2ddb('0x34')][_0x2ddb('0x38')]));_0x20e4e3[_0x2ddb('0x37')]=_0x20e4e3[_0x2ddb('0x37')][_0x2ddb('0x45')]?_0x20e4e3[_0x2ddb('0x37')]:_0x315e3f[_0x2ddb('0x32')];if(_0x2f7751[_0x2ddb('0x34')][_0x2ddb('0x46')]){_0x20e4e3['include']=[{'all':!![]}];}_0x20e4e3=_[_0x2ddb('0x3e')]({},_0x20e4e3,_0x2f7751[_0x2ddb('0x3f')]);return db[_0x2ddb('0x2f')][_0x2ddb('0x47')](_0x20e4e3)[_0x2ddb('0x25')](handleEntityNotFound(_0x3f4c62,null))[_0x2ddb('0x25')](respondWithResult(_0x3f4c62,null))[_0x2ddb('0x43')](handleError(_0x3f4c62,null));};exports['create']=function(_0x5d6730,_0x58adbd){return db['Pause'][_0x2ddb('0x48')](_0x5d6730['body'],{})[_0x2ddb('0x25')](function(_0x3543aa){var _0x2cb120=_0x5d6730[_0x2ddb('0x49')]['get']({'plain':!![]});if(!_0x2cb120)throw new Error(_0x2ddb('0x4a'));if(_0x2cb120[_0x2ddb('0x4b')]===_0x2ddb('0x49')){var _0x3851d6=_0x3543aa['get']({'plain':!![]});var _0xba8bab=_0x2ddb('0x27');return db[_0x2ddb('0x4c')][_0x2ddb('0x47')]({'where':{'name':_0xba8bab,'userProfileId':_0x2cb120[_0x2ddb('0x4d')]},'raw':!![]})[_0x2ddb('0x25')](function(_0xf64b09){if(_0xf64b09&&_0xf64b09[_0x2ddb('0x4e')]===0x0){return db[_0x2ddb('0x28')]['create']({'name':_0x3851d6[_0x2ddb('0x2c')],'resourceId':_0x3851d6['id'],'type':_0xf64b09[_0x2ddb('0x2c')],'sectionId':_0xf64b09['id']},{})[_0x2ddb('0x25')](function(){return _0x3543aa;});}else{return _0x3543aa;}})[_0x2ddb('0x43')](function(_0x15169d){logger[_0x2ddb('0x2b')](_0x2ddb('0x4f'),_0x15169d);throw _0x15169d;});}return _0x3543aa;})[_0x2ddb('0x25')](respondWithResult(_0x58adbd,0xc9))[_0x2ddb('0x43')](handleError(_0x58adbd,null));};exports[_0x2ddb('0x24')]=function(_0x3b64ef,_0x4742c8){if(_0x3b64ef[_0x2ddb('0x50')]['id']){delete _0x3b64ef[_0x2ddb('0x50')]['id'];}return db[_0x2ddb('0x2f')][_0x2ddb('0x47')]({'where':{'id':_0x3b64ef[_0x2ddb('0x51')]['id']}})[_0x2ddb('0x25')](handleEntityNotFound(_0x4742c8,null))[_0x2ddb('0x25')](saveUpdates(_0x3b64ef[_0x2ddb('0x50')],null))[_0x2ddb('0x25')](respondWithResult(_0x4742c8,null))[_0x2ddb('0x43')](handleError(_0x4742c8,null));};exports[_0x2ddb('0x29')]=function(_0x5bc45a,_0x2a3633){return db[_0x2ddb('0x2f')][_0x2ddb('0x47')]({'where':{'id':_0x5bc45a[_0x2ddb('0x51')]['id']}})[_0x2ddb('0x25')](handleEntityNotFound(_0x2a3633,null))[_0x2ddb('0x25')](removeEntity(_0x2a3633,null))[_0x2ddb('0x43')](handleError(_0x2a3633,null));}; \ No newline at end of file +var _0xab90=['find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Pauses','UserProfileResource','then','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x3c4f93,_0x24be5c){var _0x56d097=function(_0x30ad6e){while(--_0x30ad6e){_0x3c4f93['push'](_0x3c4f93['shift']());}};_0x56d097(++_0x24be5c);}(_0xab90,0x1b1));var _0x0ab9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xab90[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x0ab9('0x0'));var rimraf=require(_0x0ab9('0x1'));var zipdir=require(_0x0ab9('0x2'));var jsonpatch=require(_0x0ab9('0x3'));var rp=require(_0x0ab9('0x4'));var moment=require(_0x0ab9('0x5'));var BPromise=require(_0x0ab9('0x6'));var Mustache=require(_0x0ab9('0x7'));var util=require(_0x0ab9('0x8'));var path=require(_0x0ab9('0x9'));var sox=require(_0x0ab9('0xa'));var csv=require(_0x0ab9('0xb'));var ejs=require(_0x0ab9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab9('0xd'));var squel=require(_0x0ab9('0xe'));var crypto=require(_0x0ab9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ab9('0xb'));var querystring=require(_0x0ab9('0x10'));var Papa=require(_0x0ab9('0x11'));var Redis=require(_0x0ab9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0ab9('0x13'));var as=require(_0x0ab9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ab9('0x15'))('api');var utils=require(_0x0ab9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0ab9('0x17'));var db=require(_0x0ab9('0x18'))['db'];function respondWithStatusCode(_0x4cf7cd,_0x2c91c6){_0x2c91c6=_0x2c91c6||0xcc;return function(_0x53cade){if(_0x53cade){return _0x4cf7cd['sendStatus'](_0x2c91c6);}return _0x4cf7cd[_0x0ab9('0x19')](_0x2c91c6)['end']();};}function respondWithResult(_0x34bd5c,_0x143bdb){_0x143bdb=_0x143bdb||0xc8;return function(_0x3f5665){if(_0x3f5665){return _0x34bd5c[_0x0ab9('0x19')](_0x143bdb)['json'](_0x3f5665);}};}function respondWithFilteredResult(_0x57bfce,_0x5e952b){return function(_0xfb61ec){if(_0xfb61ec){var _0x254bc2=typeof _0x5e952b['offset']===_0x0ab9('0x1a')&&typeof _0x5e952b[_0x0ab9('0x1b')]===_0x0ab9('0x1a');var _0xf0d9c9=_0xfb61ec['count'];var _0x25d1ba=_0x254bc2?0x0:_0x5e952b['offset'];var _0x4eeebd=_0x254bc2?_0xfb61ec[_0x0ab9('0x1c')]:_0x5e952b[_0x0ab9('0x1d')]+_0x5e952b[_0x0ab9('0x1b')];var _0x250225;if(_0x4eeebd>=_0xf0d9c9){_0x4eeebd=_0xf0d9c9;_0x250225=0xc8;}else{_0x250225=0xce;}_0x57bfce[_0x0ab9('0x19')](_0x250225);return _0x57bfce[_0x0ab9('0x1e')](_0x0ab9('0x1f'),_0x25d1ba+'-'+_0x4eeebd+'/'+_0xf0d9c9)['json'](_0xfb61ec);}return null;};}function patchUpdates(_0x2cf2b3){return function(_0x2d727d){try{jsonpatch[_0x0ab9('0x20')](_0x2d727d,_0x2cf2b3,!![]);}catch(_0xa2c732){return BPromise[_0x0ab9('0x21')](_0xa2c732);}return _0x2d727d[_0x0ab9('0x22')]();};}function saveUpdates(_0x4c6b69,_0x427c86){return function(_0x524a37){if(_0x524a37){return _0x524a37[_0x0ab9('0x23')](_0x4c6b69)['then'](function(_0x22a983){return _0x22a983;});}return null;};}function removeEntity(_0x1c23d1,_0x4347b8){return function(_0x4cc88a){if(_0x4cc88a){return _0x4cc88a[_0x0ab9('0x24')]()['then'](function(){var _0x5840c4=_0x4cc88a[_0x0ab9('0x25')]({'plain':!![]});var _0x35c8bc=_0x0ab9('0x26');return db[_0x0ab9('0x27')][_0x0ab9('0x24')]({'where':{'type':_0x35c8bc,'resourceId':_0x5840c4['id']}})[_0x0ab9('0x28')](function(){return _0x4cc88a;});})['then'](function(){_0x1c23d1[_0x0ab9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b538,_0x58934b){return function(_0x4b8f42){if(!_0x4b8f42){_0x46b538['sendStatus'](0x194);}return _0x4b8f42;};}function handleError(_0x2d6bd3,_0x1c3025){_0x1c3025=_0x1c3025||0x1f4;return function(_0x4374ca){logger[_0x0ab9('0x29')](_0x4374ca[_0x0ab9('0x2a')]);if(_0x4374ca['name']){delete _0x4374ca[_0x0ab9('0x2b')];}_0x2d6bd3[_0x0ab9('0x19')](_0x1c3025)[_0x0ab9('0x2c')](_0x4374ca);};}exports[_0x0ab9('0x2d')]=function(_0x4fbc5a,_0x576759){var _0x2eb5e8={},_0x33c3c6={},_0x207a0e={'count':0x0,'rows':[]};var _0x3a49a7=_[_0x0ab9('0x2e')](db[_0x0ab9('0x2f')][_0x0ab9('0x30')],function(_0x1e232b){return{'name':_0x1e232b[_0x0ab9('0x31')],'type':_0x1e232b[_0x0ab9('0x32')][_0x0ab9('0x33')]};});_0x33c3c6[_0x0ab9('0x34')]=_['map'](_0x3a49a7,_0x0ab9('0x2b'));_0x33c3c6[_0x0ab9('0x35')]=_[_0x0ab9('0x36')](_0x4fbc5a[_0x0ab9('0x35')]);_0x33c3c6['filters']=_[_0x0ab9('0x37')](_0x33c3c6['model'],_0x33c3c6[_0x0ab9('0x35')]);_0x2eb5e8[_0x0ab9('0x38')]=_[_0x0ab9('0x37')](_0x33c3c6[_0x0ab9('0x34')],qs['fields'](_0x4fbc5a[_0x0ab9('0x35')]['fields']));_0x2eb5e8['attributes']=_0x2eb5e8[_0x0ab9('0x38')][_0x0ab9('0x39')]?_0x2eb5e8[_0x0ab9('0x38')]:_0x33c3c6['model'];if(!_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x3a')](_0x0ab9('0x3b'))){_0x2eb5e8[_0x0ab9('0x1b')]=qs[_0x0ab9('0x1b')](_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x1b')]);_0x2eb5e8[_0x0ab9('0x1d')]=qs[_0x0ab9('0x1d')](_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x1d')]);}_0x2eb5e8[_0x0ab9('0x3c')]=qs[_0x0ab9('0x3d')](_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x3d')]);_0x2eb5e8[_0x0ab9('0x3e')]=qs[_0x0ab9('0x3f')](_[_0x0ab9('0x40')](_0x4fbc5a['query'],_0x33c3c6[_0x0ab9('0x3f')]),_0x3a49a7);if(_0x4fbc5a['query'][_0x0ab9('0x41')]){_0x2eb5e8[_0x0ab9('0x3e')]=_[_0x0ab9('0x42')](_0x2eb5e8[_0x0ab9('0x3e')],{'$or':_[_0x0ab9('0x2e')](_0x3a49a7,function(_0x3b168e){if(_0x3b168e[_0x0ab9('0x32')]!==_0x0ab9('0x43')){var _0x33c8cd={};_0x33c8cd[_0x3b168e[_0x0ab9('0x2b')]]={'$like':'%'+_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x41')]+'%'};return _0x33c8cd;}})});}_0x2eb5e8=_[_0x0ab9('0x42')]({},_0x2eb5e8,_0x4fbc5a[_0x0ab9('0x44')]);var _0x24c0f2={'where':_0x2eb5e8[_0x0ab9('0x3e')]};return db['Pause']['count'](_0x24c0f2)[_0x0ab9('0x28')](function(_0x4e9a45){_0x207a0e[_0x0ab9('0x1c')]=_0x4e9a45;if(_0x4fbc5a[_0x0ab9('0x35')][_0x0ab9('0x45')]){_0x2eb5e8[_0x0ab9('0x46')]=[{'all':!![]}];}return db['Pause'][_0x0ab9('0x47')](_0x2eb5e8);})[_0x0ab9('0x28')](function(_0x19e77f){_0x207a0e[_0x0ab9('0x48')]=_0x19e77f;return _0x207a0e;})[_0x0ab9('0x28')](respondWithFilteredResult(_0x576759,_0x2eb5e8))[_0x0ab9('0x49')](handleError(_0x576759,null));};exports[_0x0ab9('0x4a')]=function(_0x11f850,_0x34839b){var _0x44d557={'raw':!![],'where':{'id':_0x11f850[_0x0ab9('0x4b')]['id']}},_0x4636fc={};_0x4636fc[_0x0ab9('0x34')]=_[_0x0ab9('0x36')](db[_0x0ab9('0x2f')][_0x0ab9('0x30')]);_0x4636fc[_0x0ab9('0x35')]=_[_0x0ab9('0x36')](_0x11f850['query']);_0x4636fc[_0x0ab9('0x3f')]=_['intersection'](_0x4636fc[_0x0ab9('0x34')],_0x4636fc[_0x0ab9('0x35')]);_0x44d557['attributes']=_[_0x0ab9('0x37')](_0x4636fc[_0x0ab9('0x34')],qs['fields'](_0x11f850[_0x0ab9('0x35')][_0x0ab9('0x4c')]));_0x44d557[_0x0ab9('0x38')]=_0x44d557['attributes']['length']?_0x44d557[_0x0ab9('0x38')]:_0x4636fc[_0x0ab9('0x34')];if(_0x11f850[_0x0ab9('0x35')][_0x0ab9('0x45')]){_0x44d557['include']=[{'all':!![]}];}_0x44d557=_[_0x0ab9('0x42')]({},_0x44d557,_0x11f850[_0x0ab9('0x44')]);return db[_0x0ab9('0x2f')][_0x0ab9('0x4d')](_0x44d557)[_0x0ab9('0x28')](handleEntityNotFound(_0x34839b,null))[_0x0ab9('0x28')](respondWithResult(_0x34839b,null))['catch'](handleError(_0x34839b,null));};exports['create']=function(_0x4fd518,_0x46457d){return db[_0x0ab9('0x2f')][_0x0ab9('0x4e')](_0x4fd518[_0x0ab9('0x4f')],{})['then'](function(_0x5126b9){var _0x3e96ce=_0x4fd518[_0x0ab9('0x50')][_0x0ab9('0x25')]({'plain':!![]});if(!_0x3e96ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e96ce[_0x0ab9('0x51')]==='user'){var _0x11a12f=_0x5126b9[_0x0ab9('0x25')]({'plain':!![]});var _0x17fe8f=_0x0ab9('0x26');return db['UserProfileSection'][_0x0ab9('0x4d')]({'where':{'name':_0x17fe8f,'userProfileId':_0x3e96ce[_0x0ab9('0x52')]},'raw':!![]})['then'](function(_0x20356a){if(_0x20356a&&_0x20356a[_0x0ab9('0x53')]===0x0){return db[_0x0ab9('0x27')][_0x0ab9('0x4e')]({'name':_0x11a12f[_0x0ab9('0x2b')],'resourceId':_0x11a12f['id'],'type':_0x20356a[_0x0ab9('0x2b')],'sectionId':_0x20356a['id']},{})[_0x0ab9('0x28')](function(){return _0x5126b9;});}else{return _0x5126b9;}})[_0x0ab9('0x49')](function(_0xc70a30){logger['error'](_0x0ab9('0x54'),_0xc70a30);throw _0xc70a30;});}return _0x5126b9;})[_0x0ab9('0x28')](respondWithResult(_0x46457d,0xc9))[_0x0ab9('0x49')](handleError(_0x46457d,null));};exports['update']=function(_0x4244ef,_0x527c49){if(_0x4244ef[_0x0ab9('0x4f')]['id']){delete _0x4244ef[_0x0ab9('0x4f')]['id'];}return db[_0x0ab9('0x2f')][_0x0ab9('0x4d')]({'where':{'id':_0x4244ef[_0x0ab9('0x4b')]['id']}})[_0x0ab9('0x28')](handleEntityNotFound(_0x527c49,null))[_0x0ab9('0x28')](saveUpdates(_0x4244ef[_0x0ab9('0x4f')],null))['then'](respondWithResult(_0x527c49,null))[_0x0ab9('0x49')](handleError(_0x527c49,null));};exports[_0x0ab9('0x24')]=function(_0x1fece6,_0x5556f7){return db['Pause']['find']({'where':{'id':_0x1fece6[_0x0ab9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5556f7,null))[_0x0ab9('0x28')](removeEntity(_0x5556f7,null))[_0x0ab9('0x49')](handleError(_0x5556f7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 27bcfd4..9b68998 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0xba76ce,_0x3c76d5){var _0x5b8dd7=function(_0x4e786b){while(--_0x4e786b){_0xba76ce['push'](_0xba76ce['shift']());}};_0x5b8dd7(++_0x3c76d5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53ffa9,_0x5a3490){_0x53ffa9=_0x53ffa9-0x0;var _0x4ca80b=_0x8ef6[_0x53ffa9];return _0x4ca80b;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5ad0c6,_0x56ee17){_0x5ad0c6=_0x5ad0c6-0x0;var _0x167958=_0x7fbe[_0x5ad0c6];return _0x167958;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 79bc083..27455ad 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x63dbc5,_0x3367c0){var _0x1e4b4c=function(_0xbaf99a){while(--_0xbaf99a){_0x63dbc5['push'](_0x63dbc5['shift']());}};_0x1e4b4c(++_0x3367c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x14562a,_0x4d3bed){_0x14562a=_0x14562a-0x0;var _0x1d1f9a=_0xb10b[_0x14562a];return _0x1d1f9a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x49dff5,_0x5b17d2){var _0x125e04=function(_0x2fe633){while(--_0x2fe633){_0x49dff5['push'](_0x49dff5['shift']());}};_0x125e04(++_0x5b17d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x45521d,_0x169dfe){_0x45521d=_0x45521d-0x0;var _0x24f9ed=_0xb10b[_0x45521d];return _0x24f9ed;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d282900..bde82d1 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 _0x0ba7=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','diskStorage','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x32710e,_0x59a3de){var _0x48f027=function(_0x130aed){while(--_0x130aed){_0x32710e['push'](_0x32710e['shift']());}};_0x48f027(++_0x59a3de);}(_0x0ba7,0x16d));var _0x70ba=function(_0x2d518c,_0x546e89){_0x2d518c=_0x2d518c-0x0;var _0x1989fb=_0x0ba7[_0x2d518c];return _0x1989fb;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),controller[_0x70ba('0xd')]);router[_0x70ba('0x9')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x9')]('/:id/download',auth[_0x70ba('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x70ba('0x10')]({'destination':function(_0x258604,_0xfc4de3,_0x3cf8ab){_0x3cf8ab(null,path['join'](config['root'],_0x70ba('0x11')));},'filename':function(_0x4a2c2e,_0xd6580e,_0x5e94c7){_0xd6580e[_0x70ba('0x12')]=_0xd6580e[_0x70ba('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e94c7(null,util[_0x70ba('0x13')]('%s-%s%s',path[_0x70ba('0x14')](_0xd6580e[_0x70ba('0x12')],path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])),Date[_0x70ba('0x16')](),path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])));}})});router[_0x70ba('0x17')]('/',upload[_0x70ba('0x18')](_0x70ba('0x19')),controller[_0x70ba('0x1a')]);router[_0x70ba('0x17')](_0x70ba('0xc'),controller[_0x70ba('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x1c')]);router[_0x70ba('0x1d')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x1d')]);module[_0x70ba('0x1e')]=router; \ No newline at end of file +var _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x23e121,_0x14580c){var _0x21b1bd=function(_0x13d9e9){while(--_0x13d9e9){_0x23e121['push'](_0x23e121['shift']());}};_0x21b1bd(++_0x14580c);}(_0x9b9b,0x114));var _0xb9b9=function(_0x558eb1,_0x502908){_0x558eb1=_0x558eb1-0x0;var _0x2f0b9e=_0x9b9b[_0x558eb1];return _0x2f0b9e;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3c823b0..f97bfc7 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 _0xa570=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xa570,0xe0));var _0x0a57=function(_0x565e3c,_0xbe61c6){_0x565e3c=_0x565e3c-0x0;var _0x145dd8=_0xa570[_0x565e3c];return _0x145dd8;};'use strict';var Sequelize=require(_0x0a57('0x0'));module[_0x0a57('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0a57('0x2')](_0x0a57('0x3'),_0x0a57('0x4'))},'description':{'type':Sequelize[_0x0a57('0x5')]},'version':{'type':Sequelize[_0x0a57('0x5')]},'path':{'type':Sequelize[_0x0a57('0x6')],'comment':_0x0a57('0x7')},'active':{'type':Sequelize[_0x0a57('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0a57('0x2')](_0x0a57('0x9'),_0x0a57('0xa'),_0x0a57('0xb'),'never'),'defaultValue':_0x0a57('0xb'),'comment':_0x0a57('0xc')},'icon':{'type':Sequelize[_0x0a57('0x6')]},'adminUrl':{'type':Sequelize[_0x0a57('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0a57('0x6')]}}; \ No newline at end of file +var _0x7b03=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x50f338,_0x517f20){var _0x5e9f07=function(_0x2b32b0){while(--_0x2b32b0){_0x50f338['push'](_0x50f338['shift']());}};_0x5e9f07(++_0x517f20);}(_0x7b03,0x18d));var _0x37b0=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x7b03[_0x16cb03];return _0x10944e;};'use strict';var Sequelize=require(_0x37b0('0x0'));module[_0x37b0('0x1')]={'name':{'type':Sequelize[_0x37b0('0x2')]},'type':{'type':Sequelize[_0x37b0('0x3')]('html',_0x37b0('0x4'))},'description':{'type':Sequelize[_0x37b0('0x5')]},'version':{'type':Sequelize[_0x37b0('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x37b0('0x6')},'active':{'type':Sequelize[_0x37b0('0x7')],'defaultValue':0x0,'comment':_0x37b0('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x37b0('0x9'),_0x37b0('0xa'),_0x37b0('0xb'),_0x37b0('0xc')),'defaultValue':'always','comment':_0x37b0('0xd')},'icon':{'type':Sequelize[_0x37b0('0x2')]},'adminUrl':{'type':Sequelize[_0x37b0('0x2')]},'agentUrl':{'type':Sequelize[_0x37b0('0x2')]},'scriptName':{'type':Sequelize[_0x37b0('0x2')]},'scriptPath':{'type':Sequelize[_0x37b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 52c28a6..01b15bc 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 _0xbdbf=['limit','set','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','name','send','index','map','Plugin','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','type','includeAll','findAll','rows','catch','show','length','include','options','find','download','params','join','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','html','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','../../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','./plugin.socket','register','status','end','offset','undefined','count'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xbdbf,0x88));var _0xfbdb=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xbdbf[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbdb('0x0'));var zipdir=require(_0xfbdb('0x1'));var jsonpatch=require(_0xfbdb('0x2'));var rp=require(_0xfbdb('0x3'));var moment=require(_0xfbdb('0x4'));var BPromise=require(_0xfbdb('0x5'));var Mustache=require(_0xfbdb('0x6'));var util=require(_0xfbdb('0x7'));var path=require(_0xfbdb('0x8'));var sox=require(_0xfbdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbdb('0xa'));var _=require(_0xfbdb('0xb'));var squel=require(_0xfbdb('0xc'));var crypto=require(_0xfbdb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfbdb('0xe'));var toCsv=require(_0xfbdb('0xf'));var querystring=require(_0xfbdb('0x10'));var Papa=require(_0xfbdb('0x11'));var extract=require(_0xfbdb('0x12'));var rimraf=require(_0xfbdb('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xfbdb('0x13'));var qs=require(_0xfbdb('0x14'));var as=require(_0xfbdb('0x15'));var hardwareService=require(_0xfbdb('0x16'));var logger=require('../../config/logger')(_0xfbdb('0x17'));var utils=require(_0xfbdb('0x18'));var config=require(_0xfbdb('0x19'));var licenseUtil=require(_0xfbdb('0x1a'));var db=require(_0xfbdb('0x1b'))['db'];config[_0xfbdb('0x1c')]=_[_0xfbdb('0x1d')](config[_0xfbdb('0x1c')],{'host':_0xfbdb('0x1e'),'port':0x18eb});var socket=require(_0xfbdb('0x1f'))(new Redis(config[_0xfbdb('0x1c')]));require(_0xfbdb('0x20'))[_0xfbdb('0x21')](socket);function respondWithStatusCode(_0x59e7bf,_0x40772d){_0x40772d=_0x40772d||0xcc;return function(_0x4681c5){if(_0x4681c5){return _0x59e7bf['sendStatus'](_0x40772d);}return _0x59e7bf[_0xfbdb('0x22')](_0x40772d)[_0xfbdb('0x23')]();};}function respondWithResult(_0x177086,_0x355b58){_0x355b58=_0x355b58||0xc8;return function(_0x22f6c8){if(_0x22f6c8){return _0x177086[_0xfbdb('0x22')](_0x355b58)['json'](_0x22f6c8);}};}function respondWithFilteredResult(_0x1d6800,_0x5048b6){return function(_0x719cea){if(_0x719cea){var _0x58e6f1=typeof _0x5048b6[_0xfbdb('0x24')]===_0xfbdb('0x25')&&typeof _0x5048b6['limit']===_0xfbdb('0x25');var _0x5a852f=_0x719cea[_0xfbdb('0x26')];var _0x22240c=_0x58e6f1?0x0:_0x5048b6[_0xfbdb('0x24')];var _0x3bfeb0=_0x58e6f1?_0x719cea[_0xfbdb('0x26')]:_0x5048b6[_0xfbdb('0x24')]+_0x5048b6[_0xfbdb('0x27')];var _0x27c079;if(_0x3bfeb0>=_0x5a852f){_0x3bfeb0=_0x5a852f;_0x27c079=0xc8;}else{_0x27c079=0xce;}_0x1d6800[_0xfbdb('0x22')](_0x27c079);return _0x1d6800[_0xfbdb('0x28')](_0xfbdb('0x29'),_0x22240c+'-'+_0x3bfeb0+'/'+_0x5a852f)[_0xfbdb('0x2a')](_0x719cea);}return null;};}function patchUpdates(_0x183cbb){return function(_0xfaad69){try{jsonpatch['apply'](_0xfaad69,_0x183cbb,!![]);}catch(_0x1adae9){return BPromise[_0xfbdb('0x2b')](_0x1adae9);}return _0xfaad69[_0xfbdb('0x2c')]();};}function saveUpdates(_0x2e9d8b,_0x58ff31){return function(_0x25b4ea){if(_0x25b4ea){return _0x25b4ea[_0xfbdb('0x2d')](_0x2e9d8b)[_0xfbdb('0x2e')](function(_0x2a38a2){return _0x2a38a2;});}return null;};}function removeEntity(_0x513fbb,_0x266507){return function(_0x41f9f0){if(_0x41f9f0){return _0x41f9f0[_0xfbdb('0x2f')]()[_0xfbdb('0x2e')](function(){var _0x1b118f=_0x41f9f0[_0xfbdb('0x30')]({'plain':!![]});var _0x2b0d72=_0xfbdb('0x31');return db[_0xfbdb('0x32')][_0xfbdb('0x2f')]({'where':{'type':_0x2b0d72,'resourceId':_0x1b118f['id']}})[_0xfbdb('0x2e')](function(){return _0x41f9f0;});})['then'](function(){_0x513fbb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd5af,_0x1d00a9){return function(_0x207255){if(!_0x207255){_0x1bd5af[_0xfbdb('0x33')](0x194);}return _0x207255;};}function handleError(_0x3a20fd,_0x3a8138){_0x3a8138=_0x3a8138||0x1f4;return function(_0x3b9188){logger[_0xfbdb('0x34')](_0x3b9188['stack']);if(_0x3b9188[_0xfbdb('0x35')]){delete _0x3b9188[_0xfbdb('0x35')];}_0x3a20fd['status'](_0x3a8138)[_0xfbdb('0x36')](_0x3b9188);};}exports[_0xfbdb('0x37')]=function(_0x8ee9c,_0x317025){var _0x548996={},_0x373757={},_0x58e246={'count':0x0,'rows':[]};var _0x13dbdc=_[_0xfbdb('0x38')](db[_0xfbdb('0x39')][_0xfbdb('0x3a')],function(_0x5d5292){return{'name':_0x5d5292['fieldName'],'type':_0x5d5292['type'][_0xfbdb('0x3b')]};});_0x373757[_0xfbdb('0x3c')]=_[_0xfbdb('0x38')](_0x13dbdc,'name');_0x373757[_0xfbdb('0x3d')]=_[_0xfbdb('0x3e')](_0x8ee9c['query']);_0x373757[_0xfbdb('0x3f')]=_[_0xfbdb('0x40')](_0x373757['model'],_0x373757[_0xfbdb('0x3d')]);_0x548996['attributes']=_[_0xfbdb('0x40')](_0x373757[_0xfbdb('0x3c')],qs[_0xfbdb('0x41')](_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x41')]));_0x548996[_0xfbdb('0x42')]=_0x548996[_0xfbdb('0x42')]['length']?_0x548996['attributes']:_0x373757['model'];if(!_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x43')]('nolimit')){_0x548996['limit']=qs[_0xfbdb('0x27')](_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x27')]);_0x548996[_0xfbdb('0x24')]=qs[_0xfbdb('0x24')](_0x8ee9c['query'][_0xfbdb('0x24')]);}_0x548996['order']=qs[_0xfbdb('0x44')](_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x44')]);_0x548996[_0xfbdb('0x45')]=qs[_0xfbdb('0x3f')](_['pick'](_0x8ee9c[_0xfbdb('0x3d')],_0x373757['filters']),_0x13dbdc);if(_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x46')]){_0x548996[_0xfbdb('0x45')]=_[_0xfbdb('0x47')](_0x548996[_0xfbdb('0x45')],{'$or':_[_0xfbdb('0x38')](_0x13dbdc,function(_0x5dfcf8){if(_0x5dfcf8[_0xfbdb('0x48')]!=='VIRTUAL'){var _0x162d59={};_0x162d59[_0x5dfcf8[_0xfbdb('0x35')]]={'$like':'%'+_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x46')]+'%'};return _0x162d59;}})});}_0x548996=_[_0xfbdb('0x47')]({},_0x548996,_0x8ee9c['options']);var _0x4a3041={'where':_0x548996[_0xfbdb('0x45')]};return db[_0xfbdb('0x39')][_0xfbdb('0x26')](_0x4a3041)['then'](function(_0x3002cf){_0x58e246[_0xfbdb('0x26')]=_0x3002cf;if(_0x8ee9c[_0xfbdb('0x3d')][_0xfbdb('0x49')]){_0x548996['include']=[{'all':!![]}];}return db[_0xfbdb('0x39')][_0xfbdb('0x4a')](_0x548996);})[_0xfbdb('0x2e')](function(_0x2fe222){_0x58e246[_0xfbdb('0x4b')]=_0x2fe222;return _0x58e246;})[_0xfbdb('0x2e')](respondWithFilteredResult(_0x317025,_0x548996))[_0xfbdb('0x4c')](handleError(_0x317025,null));};exports[_0xfbdb('0x4d')]=function(_0x305930,_0x56fbbd){var _0x1f3174={'raw':!![],'where':{'id':_0x305930['params']['id']}},_0x3534e2={};_0x3534e2[_0xfbdb('0x3c')]=_['keys'](db[_0xfbdb('0x39')]['rawAttributes']);_0x3534e2['query']=_['keys'](_0x305930[_0xfbdb('0x3d')]);_0x3534e2[_0xfbdb('0x3f')]=_[_0xfbdb('0x40')](_0x3534e2[_0xfbdb('0x3c')],_0x3534e2['query']);_0x1f3174[_0xfbdb('0x42')]=_['intersection'](_0x3534e2[_0xfbdb('0x3c')],qs[_0xfbdb('0x41')](_0x305930[_0xfbdb('0x3d')][_0xfbdb('0x41')]));_0x1f3174[_0xfbdb('0x42')]=_0x1f3174[_0xfbdb('0x42')][_0xfbdb('0x4e')]?_0x1f3174[_0xfbdb('0x42')]:_0x3534e2[_0xfbdb('0x3c')];if(_0x305930['query'][_0xfbdb('0x49')]){_0x1f3174[_0xfbdb('0x4f')]=[{'all':!![]}];}_0x1f3174=_['merge']({},_0x1f3174,_0x305930[_0xfbdb('0x50')]);return db[_0xfbdb('0x39')][_0xfbdb('0x51')](_0x1f3174)[_0xfbdb('0x2e')](handleEntityNotFound(_0x56fbbd,null))[_0xfbdb('0x2e')](respondWithResult(_0x56fbbd,null))['catch'](handleError(_0x56fbbd,null));};exports[_0xfbdb('0x52')]=function(_0x3457e8,_0x5334cd,_0x2f5bd4){return db[_0xfbdb('0x39')]['find']({'where':{'id':_0x3457e8[_0xfbdb('0x53')]['id']},'attributes':['name',_0xfbdb('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x5334cd,null))[_0xfbdb('0x2e')](function(_0x1202eb){if(_0x1202eb){var _0x2faed2=path[_0xfbdb('0x54')](config['root'],_0xfbdb('0x55'),util['format'](_0xfbdb('0x56'),path[_0xfbdb('0x57')](_0x1202eb['path'])));var _0x4013a8=fs[_0xfbdb('0x58')](_0x2faed2);var _0x1cf830=archiver(_0xfbdb('0x59'),{'zlib':{'level':0x9}});_0x1cf830['on'](_0xfbdb('0x5a'),function(_0x5454c2){if(_0x5454c2[_0xfbdb('0x5b')]===_0xfbdb('0x5c')){logger[_0xfbdb('0x34')](_0x5454c2);}else{throw new db[(_0xfbdb('0x5d'))]['Error'](_0xfbdb('0x5e'));}});_0x1cf830['on'](_0xfbdb('0x34'),function(_0x47d569){throw new db['Sequelize'][(_0xfbdb('0x5f'))](_0xfbdb('0x5e'));});_0x1cf830['pipe'](_0x4013a8);_0x1cf830[_0xfbdb('0x60')](_0xfbdb('0x61'),{'cwd':path[_0xfbdb('0x54')](config['root'],'server/files/plugins',path[_0xfbdb('0x62')](_0x1202eb[_0xfbdb('0x8')])),'ignore':[path['join'](path['basename'](_0x1202eb[_0xfbdb('0x8')]),_0xfbdb('0x63')),path[_0xfbdb('0x54')](path['basename'](_0x1202eb[_0xfbdb('0x8')]),_0xfbdb('0x64'))],'nodir':!![]})[_0xfbdb('0x65')]();_0x4013a8['on'](_0xfbdb('0x66'),function(){if(!fs[_0xfbdb('0x67')](_0x2faed2)){throw new db[(_0xfbdb('0x5d'))][(_0xfbdb('0x5f'))](_0xfbdb('0x68'));}return _0x5334cd[_0xfbdb('0x52')](_0x2faed2,util['format']('%s.zip',path[_0xfbdb('0x57')](_0x1202eb[_0xfbdb('0x8')])),function(_0x173e06){if(_0x173e06){throw new db['Sequelize'][(_0xfbdb('0x5f'))](_0xfbdb('0x69'));}fs[_0xfbdb('0x6a')](_0x2faed2);logger['info'](_0xfbdb('0x6b'));logger[_0xfbdb('0x6c')](_0xfbdb('0x6d'));});});}return null;})[_0xfbdb('0x4c')](handleError(_0x5334cd,null));};exports[_0xfbdb('0x6e')]=function(_0x5bc5ba,_0x287ce6,_0x454d02){var _0x4a6afb=path[_0xfbdb('0x57')](_0x5bc5ba[_0xfbdb('0x6f')][_0xfbdb('0x70')],path['extname'](_0x5bc5ba[_0xfbdb('0x6f')][_0xfbdb('0x70')]));var _0x29ceac=path[_0xfbdb('0x54')](config[_0xfbdb('0x71')],_0xfbdb('0x55'),_0x5bc5ba[_0xfbdb('0x6f')][_0xfbdb('0x70')]);var _0x1e1b60=path[_0xfbdb('0x54')](config['root'],_0xfbdb('0x55'),_0x4a6afb);logger['info'](_0xfbdb('0x72'),_0x29ceac);logger[_0xfbdb('0x6c')]('Plugin\x20upload\x20destination:\x20%s',_0x1e1b60);try{fs[_0xfbdb('0x73')](_0x29ceac,parseInt('0777',0x8));extract(_0x29ceac,{'dir':_0x1e1b60},function(_0x329d9d){if(_0x329d9d){logger[_0xfbdb('0x34')](_0x329d9d);handleError(_0x329d9d,!![]);};var _0x55e8bf=fs[_0xfbdb('0x74')](_0x1e1b60);if(_0x55e8bf[_0xfbdb('0x4e')]>0x1){removeReferences(_0x29ceac,_0x1e1b60);logger[_0xfbdb('0x34')](_0xfbdb('0x75'));return _0x454d02(new Error('Invalid\x20plugin\x20structure'));}var _0x626df9=fs[_0xfbdb('0x76')](path['join'](_0x1e1b60,_0x55e8bf[0x0]));if(_0x626df9[_0xfbdb('0x77')]()){removeReferences(_0x29ceac,_0x1e1b60);logger[_0xfbdb('0x34')]('Invalid\x20plugin\x20structure');return _0x454d02(new Error(_0xfbdb('0x75')));}if(_0x626df9[_0xfbdb('0x78')]()){var _0x3e48f6=fs[_0xfbdb('0x74')](path[_0xfbdb('0x54')](_0x1e1b60,_0x55e8bf[0x0]));if(_0x3e48f6[_0xfbdb('0x4e')]===0x0){removeReferences(_0x29ceac,_0x1e1b60);logger[_0xfbdb('0x34')](_0xfbdb('0x75'));return _0x454d02(new Error('Invalid\x20plugin\x20structure'));}var _0x4d6f28=_0x3e48f6[_0xfbdb('0x79')](function(_0x18f59c){return _0x18f59c==='manifest.json';});if(!_0x4d6f28){return _0x454d02(new Error('Plugin\x20manifest\x20missing'));}var _0x59f05a=fs['readFileSync'](path[_0xfbdb('0x54')](_0x1e1b60,_0x55e8bf[0x0],_0xfbdb('0x7a')));var _0x11da4e=JSON[_0xfbdb('0x7b')](_0x59f05a);if(_0xfbdb('0x25')==typeof _0x11da4e['name']){return _0x454d02(new Error(_0xfbdb('0x7c')));}if(_0xfbdb('0x25')==typeof _0x11da4e[_0xfbdb('0x48')]){return _0x454d02(new Error(_0xfbdb('0x7d')));}if(_0xfbdb('0x25')==typeof _0x11da4e[_0xfbdb('0x7e')]){return _0x454d02(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfbdb('0x25')==typeof _0x11da4e['parameters']){return _0x454d02(new Error(_0xfbdb('0x7f')));}if(_0x11da4e[_0xfbdb('0x48')]==='html'){if(_0xfbdb('0x25')==typeof _0x11da4e['parameters'][_0xfbdb('0x80')]){return _0x454d02(new Error(_0xfbdb('0x81')));}if('undefined'==typeof _0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')]['admin']&&'undefined'==typeof _0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')][_0xfbdb('0x83')]){return _0x454d02(new Error(_0xfbdb('0x84')));}}else if(_0x11da4e[_0xfbdb('0x48')]===_0xfbdb('0x85')){if(_0xfbdb('0x25')==typeof _0x11da4e[_0xfbdb('0x82')]['scriptName']){return _0x454d02(new Error(_0xfbdb('0x86')));}if(_0xfbdb('0x25')==typeof _0x11da4e['parameters'][_0xfbdb('0x87')]){return _0x454d02(new Error(_0xfbdb('0x88')));}}else{return _0x454d02(new Error(_0xfbdb('0x89')));}var _0x412528=_0x11da4e[_0xfbdb('0x35')];var _0x2d922e=_0x11da4e['description'];var _0x583292=_0x11da4e['type'];var _0x3ddf17=_0x11da4e['sidebar']?_0x11da4e[_0xfbdb('0x8a')]:_0xfbdb('0x8b');var _0x148aca=_0x11da4e[_0xfbdb('0x8c')]?_0x11da4e['icon']:'icon-apps';var _0x3760d7='';var _0x59e7fc='';var _0x2ec548='';var _0x48c803='';var _0x589cce=_0x11da4e[_0xfbdb('0x7e')];if(_0x583292===_0xfbdb('0x8d')){if(_0xfbdb('0x25')!=typeof _0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')]['admin']){var _0x9aa6d7=_0x11da4e[_0xfbdb('0x82')]['views'][_0xfbdb('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xfbdb('0x8f')](_0x9aa6d7)){_0x3760d7=path[_0xfbdb('0x54')]('plugins',_0x4a6afb,_0x55e8bf[0x0],_0x9aa6d7);}else{_0x3760d7=_0x9aa6d7;}}else{logger[_0xfbdb('0x6c')](_0xfbdb('0x90'));}if(_0xfbdb('0x25')!=typeof _0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')]['agent']){var _0x1dccba=_0x11da4e['parameters'][_0xfbdb('0x80')][_0xfbdb('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbdb('0x8f')](_0x1dccba)){_0x59e7fc=path['join'](_0xfbdb('0x91'),_0x4a6afb,_0x55e8bf[0x0],_0x1dccba);}else{_0x59e7fc=_0x1dccba;}}else{logger[_0xfbdb('0x6c')](_0xfbdb('0x92'));}}else if(_0x583292==='script'){_0x2ec548=_0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x93')];_0x48c803=_0x11da4e[_0xfbdb('0x82')]['scriptPath'];if(_0xfbdb('0x25')!=typeof _0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')]){if('undefined'!=typeof _0x11da4e[_0xfbdb('0x82')]['views']['admin']){var _0x9aa6d7=_0x11da4e['parameters'][_0xfbdb('0x80')][_0xfbdb('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xfbdb('0x8f')](_0x9aa6d7)){_0x3760d7=path[_0xfbdb('0x54')]('plugins',_0x4a6afb,_0x55e8bf[0x0],_0x9aa6d7);}else{_0x3760d7=_0x9aa6d7;}}if('undefined'!=typeof _0x11da4e['parameters']['views']['agent']){var _0x1dccba=_0x11da4e[_0xfbdb('0x82')][_0xfbdb('0x80')][_0xfbdb('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbdb('0x8f')](_0x1dccba)){_0x59e7fc=path[_0xfbdb('0x54')](_0xfbdb('0x91'),_0x4a6afb,_0x55e8bf[0x0],_0x1dccba);}else{_0x59e7fc=_0x1dccba;}}}}var _0x4ccb63={'name':_0x412528,'description':_0x2d922e,'path':path[_0xfbdb('0x54')](_0x4a6afb,_0x55e8bf[0x0]),'type':_0x583292,'sidebar':_0x3ddf17,'icon':_0x148aca,'adminUrl':_0x3760d7,'agentUrl':_0x59e7fc,'scriptName':_0x2ec548,'scriptPath':_0x48c803,'version':_0x589cce};removeReferences(_0x29ceac,null);return db[_0xfbdb('0x39')][_0xfbdb('0x94')](_0x4ccb63)[_0xfbdb('0x2e')](function(_0x38357d){var _0x4ee111={'role':_0x5bc5ba[_0xfbdb('0x95')][_0xfbdb('0x96')],'userProfileId':_0x5bc5ba[_0xfbdb('0x95')][_0xfbdb('0x97')]};if(!_0x4ee111)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ee111[_0xfbdb('0x96')]===_0xfbdb('0x98')){var _0x3699c8=_0x38357d['get']({'plain':!![]});return db[_0xfbdb('0x99')][_0xfbdb('0x51')]({'where':{'name':_0xfbdb('0x31'),'userProfileId':_0x4ee111[_0xfbdb('0x97')]},'raw':!![]})[_0xfbdb('0x2e')](function(_0x269192){if(_0x269192&&_0x269192[_0xfbdb('0x9a')]===0x0){return db[_0xfbdb('0x32')]['create']({'name':_0x3699c8[_0xfbdb('0x35')],'resourceId':_0x3699c8['id'],'type':_0x269192['name'],'sectionId':_0x269192['id']},{})['then'](function(){return _0x38357d;});}else{return _0x38357d;}})[_0xfbdb('0x4c')](function(_0x37d9e9){logger[_0xfbdb('0x34')](_0xfbdb('0x9b'),_0x37d9e9);throw _0x37d9e9;});}return _0x38357d;})[_0xfbdb('0x2e')](respondWithResult(_0x287ce6,null))[_0xfbdb('0x4c')](handleError(_0x287ce6,null));}});}catch(_0x393631){_0x287ce6[_0xfbdb('0x22')](0x1f4)[_0xfbdb('0x36')](_0x393631);}};function removeReferences(_0x422b23,_0x1b6702){try{if(_0x422b23){fs[_0xfbdb('0x6a')](_0x422b23);logger['info'](_0xfbdb('0x9c'));}if(_0x1b6702){rimraf(_0x1b6702,function(){});logger[_0xfbdb('0x6c')](_0xfbdb('0x9d'));}}catch(_0x2451b0){logger[_0xfbdb('0x34')](_0x2451b0);}}exports[_0xfbdb('0x2d')]=function(_0x1b1889,_0x5eab5e,_0x26cb08){return db[_0xfbdb('0x39')][_0xfbdb('0x51')]({'where':{'id':_0x1b1889[_0xfbdb('0x53')]['id']}})['then'](handleEntityNotFound(_0x5eab5e,null))[_0xfbdb('0x2e')](saveUpdates(_0x1b1889[_0xfbdb('0x95')],null))[_0xfbdb('0x2e')](respondWithResult(_0x5eab5e,null))[_0xfbdb('0x4c')](handleError(_0x5eab5e,null));};exports['delete']=function(_0x2864bf,_0x530d5d,_0x2bb733){return db[_0xfbdb('0x39')]['find']({'where':{'id':_0x2864bf[_0xfbdb('0x53')]['id']}})['then'](function(_0x55b2b7){if(_0x55b2b7){return _0x55b2b7[_0xfbdb('0x2f')]();}})[_0xfbdb('0x2e')](function(_0x762bc5){rimraf(path[_0xfbdb('0x54')](config[_0xfbdb('0x71')],'server/files/plugins',path[_0xfbdb('0x62')](_0x762bc5[_0xfbdb('0x8')])),function(){});return _0x762bc5;})['then'](handleEntityNotFound(_0x530d5d,null))[_0xfbdb('0x2e')](respondWithStatusCode(_0x530d5d,null))['catch'](handleError(_0x530d5d,null));};exports[_0xfbdb('0x9e')]=function(_0x1f350c,_0x5e07d3,_0x14ffcc){return BPromise[_0xfbdb('0x9f')]()['then'](function(){if(!_0x1f350c[_0xfbdb('0x3d')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1f350c['query'][_0xfbdb('0xa0')]){throw new Error(_0xfbdb('0xa1'));}var _0x469105=_0x1f350c['query'][_0xfbdb('0xa2')]?_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0xa2')]+':'+_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0xa0')]:_0xfbdb('0xa3')+_0x1f350c[_0xfbdb('0x3d')]['port'];var _0x25c465=_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0x2a')]?_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0x2a')]:!![];var _0x4139c5=_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0xa4')]?_0x1f350c['query'][_0xfbdb('0xa4')]:null;var _0x185c70={'method':_0x1f350c[_0xfbdb('0xa5')],'uri':util[_0xfbdb('0xa6')](_0xfbdb('0xa7'),_0x469105,_0x1f350c[_0xfbdb('0x3d')][_0xfbdb('0x8')]),'json':_0x25c465,'resolveWithFullResponse':!![],'encoding':_0x4139c5,'qs':_0x1f350c[_0xfbdb('0x3d')]};if(_0x1f350c[_0xfbdb('0xa8')]){_0x185c70['headers']=_0x1f350c['headers'];if(_0x185c70[_0xfbdb('0xa8')][_0xfbdb('0xa9')]){delete _0x185c70[_0xfbdb('0xa8')][_0xfbdb('0xa9')];}}if(_0x185c70[_0xfbdb('0xa8')]['content-type']){delete _0x185c70['headers']['content-type'];}return rp(_0x185c70);})['then'](function(_0x474b10){if(_0x474b10){_0x5e07d3[_0xfbdb('0x28')](_0x474b10[_0xfbdb('0xa8')]);logger['info'](_0x474b10[_0xfbdb('0x95')]);if(_[_0xfbdb('0xaa')](_0x1f350c['query'][_0xfbdb('0x8')],_0xfbdb('0x52'))&&_0x474b10[_0xfbdb('0xab')]==0x1f4){return _0x5e07d3[_0xfbdb('0x33')](_0x474b10[_0xfbdb('0xab')]);}else{return _0x5e07d3[_0xfbdb('0x22')](_0x474b10['statusCode'])[_0xfbdb('0x36')](_0x474b10['body']);}}else{return _0x5e07d3[_0xfbdb('0x33')](0xc8);}})[_0xfbdb('0x4c')](handleError(_0x5e07d3,null));};exports[_0xfbdb('0xac')]=function(_0xb2205f,_0xfdb8a0,_0x7bb92){return BPromise[_0xfbdb('0x9f')]()[_0xfbdb('0x2e')](function(){if(!_0xb2205f[_0xfbdb('0x3d')][_0xfbdb('0x8')]){throw new Error(_0xfbdb('0xad'));}if(!_0xb2205f[_0xfbdb('0x3d')][_0xfbdb('0xa0')]){throw new Error(_0xfbdb('0xa1'));}var _0x110373=_0xb2205f['query'][_0xfbdb('0xa2')]?_0xb2205f[_0xfbdb('0x3d')]['hostname']+':'+_0xb2205f[_0xfbdb('0x3d')][_0xfbdb('0xa0')]:'http://localhost:'+_0xb2205f[_0xfbdb('0x3d')]['port'];var _0x1d729b=_0xb2205f['query'][_0xfbdb('0x2a')]?_0xb2205f[_0xfbdb('0x3d')]['json']:!![];var _0x2f7a6b=_0xb2205f['query']['encoding']?_0xb2205f['query'][_0xfbdb('0xa4')]:null;var _0x218d44={'method':_0xb2205f['method'],'uri':util[_0xfbdb('0xa6')](_0xfbdb('0xa7'),_0x110373,_0xb2205f[_0xfbdb('0x3d')]['path']),'json':_0x1d729b,'resolveWithFullResponse':!![],'encoding':_0x2f7a6b,'body':_0xb2205f[_0xfbdb('0x95')]};if(_0xb2205f[_0xfbdb('0xa8')]){_0x218d44['headers']=_0xb2205f['headers'];if(_0x218d44[_0xfbdb('0xa8')]['content-length']){delete _0x218d44[_0xfbdb('0xa8')][_0xfbdb('0xa9')];}}if(_0x218d44[_0xfbdb('0xa8')][_0xfbdb('0xae')]){delete _0x218d44[_0xfbdb('0xa8')][_0xfbdb('0xae')];}return rp(_0x218d44);})[_0xfbdb('0x2e')](function(_0x573ec3){if(_0x573ec3){_0xfdb8a0[_0xfbdb('0x28')](_0x573ec3[_0xfbdb('0xa8')]);logger[_0xfbdb('0x6c')](_0x573ec3[_0xfbdb('0x95')]);return _0xfdb8a0[_0xfbdb('0x22')](_0x573ec3[_0xfbdb('0xab')])['send'](_0x573ec3['body']);}else{return _0xfdb8a0['sendStatus'](0xc8);}})[_0xfbdb('0x4c')](handleError(_0xfdb8a0,null));}; \ No newline at end of file +var _0xc69f=['%s.zip','basename','createWriteStream','zip','warning','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Error','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','find','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','rimraf','zip-dir','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','params','path','join','root','server/files/plugins','format'];(function(_0x39dc2b,_0x7d266){var _0x56be71=function(_0x3d08b7){while(--_0x3d08b7){_0x39dc2b['push'](_0x39dc2b['shift']());}};_0x56be71(++_0x7d266);}(_0xc69f,0x104));var _0xfc69=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc69f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc69('0x0'));var zipdir=require(_0xfc69('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc69('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfc69('0x3'));var util=require(_0xfc69('0x4'));var path=require('path');var sox=require(_0xfc69('0x5'));var csv=require('to-csv');var ejs=require(_0xfc69('0x6'));var fs=require('fs');var fs_extra=require(_0xfc69('0x7'));var _=require(_0xfc69('0x8'));var squel=require(_0xfc69('0x9'));var crypto=require(_0xfc69('0xa'));var jsforce=require(_0xfc69('0xb'));var deskjs=require(_0xfc69('0xc'));var toCsv=require(_0xfc69('0xd'));var querystring=require(_0xfc69('0xe'));var Papa=require(_0xfc69('0xf'));var extract=require('extract-zip');var rimraf=require(_0xfc69('0x0'));var archiver=require(_0xfc69('0x10'));var Redis=require(_0xfc69('0x11'));var authService=require(_0xfc69('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc69('0x14'))(_0xfc69('0x15'));var utils=require(_0xfc69('0x16'));var config=require(_0xfc69('0x17'));var licenseUtil=require(_0xfc69('0x18'));var db=require(_0xfc69('0x19'))['db'];config[_0xfc69('0x1a')]=_[_0xfc69('0x1b')](config['redis'],{'host':_0xfc69('0x1c'),'port':0x18eb});var socket=require(_0xfc69('0x1d'))(new Redis(config[_0xfc69('0x1a')]));require(_0xfc69('0x1e'))[_0xfc69('0x1f')](socket);function respondWithStatusCode(_0x2a3742,_0x23bf1e){_0x23bf1e=_0x23bf1e||0xcc;return function(_0x424331){if(_0x424331){return _0x2a3742[_0xfc69('0x20')](_0x23bf1e);}return _0x2a3742[_0xfc69('0x21')](_0x23bf1e)['end']();};}function respondWithResult(_0x975920,_0x2c7164){_0x2c7164=_0x2c7164||0xc8;return function(_0x1e9ae3){if(_0x1e9ae3){return _0x975920[_0xfc69('0x21')](_0x2c7164)[_0xfc69('0x22')](_0x1e9ae3);}};}function respondWithFilteredResult(_0x4ab5ec,_0x589d51){return function(_0x3f66af){if(_0x3f66af){var _0x148aa6=typeof _0x589d51[_0xfc69('0x23')]==='undefined'&&typeof _0x589d51[_0xfc69('0x24')]===_0xfc69('0x25');var _0xe56ea1=_0x3f66af[_0xfc69('0x26')];var _0x523543=_0x148aa6?0x0:_0x589d51['offset'];var _0x4e8255=_0x148aa6?_0x3f66af[_0xfc69('0x26')]:_0x589d51['offset']+_0x589d51[_0xfc69('0x24')];var _0x18eb25;if(_0x4e8255>=_0xe56ea1){_0x4e8255=_0xe56ea1;_0x18eb25=0xc8;}else{_0x18eb25=0xce;}_0x4ab5ec['status'](_0x18eb25);return _0x4ab5ec['set'](_0xfc69('0x27'),_0x523543+'-'+_0x4e8255+'/'+_0xe56ea1)['json'](_0x3f66af);}return null;};}function patchUpdates(_0x308ca2){return function(_0x5dd32f){try{jsonpatch['apply'](_0x5dd32f,_0x308ca2,!![]);}catch(_0x1db57e){return BPromise[_0xfc69('0x28')](_0x1db57e);}return _0x5dd32f[_0xfc69('0x29')]();};}function saveUpdates(_0x4bdc9b,_0x4c03fe){return function(_0x2bc95d){if(_0x2bc95d){return _0x2bc95d[_0xfc69('0x2a')](_0x4bdc9b)[_0xfc69('0x2b')](function(_0x423518){return _0x423518;});}return null;};}function removeEntity(_0x299608,_0x54c044){return function(_0x1f6c4b){if(_0x1f6c4b){return _0x1f6c4b[_0xfc69('0x2c')]()[_0xfc69('0x2b')](function(){var _0x226731=_0x1f6c4b[_0xfc69('0x2d')]({'plain':!![]});var _0xacfeba=_0xfc69('0x2e');return db[_0xfc69('0x2f')][_0xfc69('0x2c')]({'where':{'type':_0xacfeba,'resourceId':_0x226731['id']}})[_0xfc69('0x2b')](function(){return _0x1f6c4b;});})[_0xfc69('0x2b')](function(){_0x299608[_0xfc69('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3980f0,_0x286a08){return function(_0x436039){if(!_0x436039){_0x3980f0[_0xfc69('0x20')](0x194);}return _0x436039;};}function handleError(_0x51af0f,_0x48a707){_0x48a707=_0x48a707||0x1f4;return function(_0x2ac2b1){logger['error'](_0x2ac2b1[_0xfc69('0x30')]);if(_0x2ac2b1[_0xfc69('0x31')]){delete _0x2ac2b1['name'];}_0x51af0f[_0xfc69('0x21')](_0x48a707)[_0xfc69('0x32')](_0x2ac2b1);};}exports[_0xfc69('0x33')]=function(_0x501d3e,_0x41ce5e){var _0x15736e={},_0x4a1378={},_0x8c71fa={'count':0x0,'rows':[]};var _0xd48578=_[_0xfc69('0x34')](db[_0xfc69('0x35')][_0xfc69('0x36')],function(_0x40e3fd){return{'name':_0x40e3fd['fieldName'],'type':_0x40e3fd[_0xfc69('0x37')][_0xfc69('0x38')]};});_0x4a1378[_0xfc69('0x39')]=_[_0xfc69('0x34')](_0xd48578,'name');_0x4a1378['query']=_[_0xfc69('0x3a')](_0x501d3e[_0xfc69('0x3b')]);_0x4a1378[_0xfc69('0x3c')]=_[_0xfc69('0x3d')](_0x4a1378[_0xfc69('0x39')],_0x4a1378[_0xfc69('0x3b')]);_0x15736e['attributes']=_[_0xfc69('0x3d')](_0x4a1378[_0xfc69('0x39')],qs[_0xfc69('0x3e')](_0x501d3e[_0xfc69('0x3b')][_0xfc69('0x3e')]));_0x15736e[_0xfc69('0x3f')]=_0x15736e[_0xfc69('0x3f')][_0xfc69('0x40')]?_0x15736e[_0xfc69('0x3f')]:_0x4a1378[_0xfc69('0x39')];if(!_0x501d3e[_0xfc69('0x3b')][_0xfc69('0x41')](_0xfc69('0x42'))){_0x15736e[_0xfc69('0x24')]=qs[_0xfc69('0x24')](_0x501d3e[_0xfc69('0x3b')][_0xfc69('0x24')]);_0x15736e['offset']=qs[_0xfc69('0x23')](_0x501d3e[_0xfc69('0x3b')][_0xfc69('0x23')]);}_0x15736e[_0xfc69('0x43')]=qs[_0xfc69('0x44')](_0x501d3e['query'][_0xfc69('0x44')]);_0x15736e[_0xfc69('0x45')]=qs['filters'](_[_0xfc69('0x46')](_0x501d3e[_0xfc69('0x3b')],_0x4a1378[_0xfc69('0x3c')]),_0xd48578);if(_0x501d3e[_0xfc69('0x3b')][_0xfc69('0x47')]){_0x15736e[_0xfc69('0x45')]=_[_0xfc69('0x48')](_0x15736e[_0xfc69('0x45')],{'$or':_[_0xfc69('0x34')](_0xd48578,function(_0x404aa8){if(_0x404aa8[_0xfc69('0x37')]!==_0xfc69('0x49')){var _0x2ac4ef={};_0x2ac4ef[_0x404aa8[_0xfc69('0x31')]]={'$like':'%'+_0x501d3e['query'][_0xfc69('0x47')]+'%'};return _0x2ac4ef;}})});}_0x15736e=_[_0xfc69('0x48')]({},_0x15736e,_0x501d3e[_0xfc69('0x4a')]);var _0x481068={'where':_0x15736e['where']};return db[_0xfc69('0x35')][_0xfc69('0x26')](_0x481068)[_0xfc69('0x2b')](function(_0xf6461){_0x8c71fa[_0xfc69('0x26')]=_0xf6461;if(_0x501d3e[_0xfc69('0x3b')]['includeAll']){_0x15736e[_0xfc69('0x4b')]=[{'all':!![]}];}return db[_0xfc69('0x35')]['findAll'](_0x15736e);})[_0xfc69('0x2b')](function(_0x39a42c){_0x8c71fa[_0xfc69('0x4c')]=_0x39a42c;return _0x8c71fa;})[_0xfc69('0x2b')](respondWithFilteredResult(_0x41ce5e,_0x15736e))[_0xfc69('0x4d')](handleError(_0x41ce5e,null));};exports[_0xfc69('0x4e')]=function(_0x2960f0,_0x5052cf){var _0x1f227e={'raw':!![],'where':{'id':_0x2960f0['params']['id']}},_0x4e2f38={};_0x4e2f38['model']=_[_0xfc69('0x3a')](db['Plugin']['rawAttributes']);_0x4e2f38['query']=_['keys'](_0x2960f0['query']);_0x4e2f38[_0xfc69('0x3c')]=_[_0xfc69('0x3d')](_0x4e2f38[_0xfc69('0x39')],_0x4e2f38[_0xfc69('0x3b')]);_0x1f227e['attributes']=_[_0xfc69('0x3d')](_0x4e2f38['model'],qs[_0xfc69('0x3e')](_0x2960f0[_0xfc69('0x3b')][_0xfc69('0x3e')]));_0x1f227e[_0xfc69('0x3f')]=_0x1f227e[_0xfc69('0x3f')]['length']?_0x1f227e[_0xfc69('0x3f')]:_0x4e2f38[_0xfc69('0x39')];if(_0x2960f0['query'][_0xfc69('0x4f')]){_0x1f227e['include']=[{'all':!![]}];}_0x1f227e=_[_0xfc69('0x48')]({},_0x1f227e,_0x2960f0[_0xfc69('0x4a')]);return db[_0xfc69('0x35')]['find'](_0x1f227e)[_0xfc69('0x2b')](handleEntityNotFound(_0x5052cf,null))['then'](respondWithResult(_0x5052cf,null))[_0xfc69('0x4d')](handleError(_0x5052cf,null));};exports['download']=function(_0x95829c,_0x54028f,_0x4cdb25){return db['Plugin']['find']({'where':{'id':_0x95829c[_0xfc69('0x50')]['id']},'attributes':[_0xfc69('0x31'),_0xfc69('0x51')],'raw':!![]})[_0xfc69('0x2b')](handleEntityNotFound(_0x54028f,null))[_0xfc69('0x2b')](function(_0x2df017){if(_0x2df017){var _0x4dfd00=path[_0xfc69('0x52')](config[_0xfc69('0x53')],_0xfc69('0x54'),util[_0xfc69('0x55')](_0xfc69('0x56'),path[_0xfc69('0x57')](_0x2df017['path'])));var _0x2ca874=fs[_0xfc69('0x58')](_0x4dfd00);var _0x1b1f06=archiver(_0xfc69('0x59'),{'zlib':{'level':0x9}});_0x1b1f06['on'](_0xfc69('0x5a'),function(_0x1c9ee7){if(_0x1c9ee7['code']===_0xfc69('0x5b')){logger[_0xfc69('0x5c')](_0x1c9ee7);}else{throw new db[(_0xfc69('0x5d'))]['Error'](_0xfc69('0x5e'));}});_0x1b1f06['on'](_0xfc69('0x5c'),function(_0x44526c){throw new db['Sequelize']['Error'](_0xfc69('0x5e'));});_0x1b1f06[_0xfc69('0x5f')](_0x2ca874);_0x1b1f06[_0xfc69('0x60')](_0xfc69('0x61'),{'cwd':path['join'](config['root'],_0xfc69('0x54'),path['dirname'](_0x2df017['path'])),'ignore':[path[_0xfc69('0x52')](path[_0xfc69('0x57')](_0x2df017[_0xfc69('0x51')]),_0xfc69('0x62')),path[_0xfc69('0x52')](path[_0xfc69('0x57')](_0x2df017[_0xfc69('0x51')]),_0xfc69('0x63'))],'nodir':!![]})[_0xfc69('0x64')]();_0x2ca874['on']('close',function(){if(!fs[_0xfc69('0x65')](_0x4dfd00)){throw new db[(_0xfc69('0x5d'))][(_0xfc69('0x66'))](_0xfc69('0x67'));}return _0x54028f['download'](_0x4dfd00,util[_0xfc69('0x55')](_0xfc69('0x56'),path[_0xfc69('0x57')](_0x2df017[_0xfc69('0x51')])),function(_0x4b0d62){if(_0x4b0d62){throw new db[(_0xfc69('0x5d'))]['Error'](_0xfc69('0x68'));}fs[_0xfc69('0x69')](_0x4dfd00);logger['info'](_0xfc69('0x6a'));logger[_0xfc69('0x6b')](_0xfc69('0x6c'));});});}return null;})['catch'](handleError(_0x54028f,null));};exports[_0xfc69('0x6d')]=function(_0x41a4b0,_0x5c58c9,_0x5d0ee8){var _0x54c20d=path[_0xfc69('0x57')](_0x41a4b0[_0xfc69('0x6e')][_0xfc69('0x6f')],path['extname'](_0x41a4b0[_0xfc69('0x6e')][_0xfc69('0x6f')]));var _0x5c8543=path[_0xfc69('0x52')](config[_0xfc69('0x53')],_0xfc69('0x54'),_0x41a4b0[_0xfc69('0x6e')][_0xfc69('0x6f')]);var _0x12afef=path['join'](config[_0xfc69('0x53')],_0xfc69('0x54'),_0x54c20d);logger['info'](_0xfc69('0x70'),_0x5c8543);logger['info'](_0xfc69('0x71'),_0x12afef);try{fs[_0xfc69('0x72')](_0x5c8543,parseInt('0777',0x8));extract(_0x5c8543,{'dir':_0x12afef},function(_0x39c23a){if(_0x39c23a){logger['error'](_0x39c23a);handleError(_0x39c23a,!![]);};var _0x41c46c=fs[_0xfc69('0x73')](_0x12afef);if(_0x41c46c[_0xfc69('0x40')]>0x1){removeReferences(_0x5c8543,_0x12afef);logger[_0xfc69('0x5c')](_0xfc69('0x74'));return _0x5d0ee8(new Error('Invalid\x20plugin\x20structure'));}var _0x2653f6=fs[_0xfc69('0x75')](path['join'](_0x12afef,_0x41c46c[0x0]));if(_0x2653f6[_0xfc69('0x76')]()){removeReferences(_0x5c8543,_0x12afef);logger[_0xfc69('0x5c')](_0xfc69('0x74'));return _0x5d0ee8(new Error(_0xfc69('0x74')));}if(_0x2653f6[_0xfc69('0x77')]()){var _0x388fb5=fs[_0xfc69('0x73')](path[_0xfc69('0x52')](_0x12afef,_0x41c46c[0x0]));if(_0x388fb5[_0xfc69('0x40')]===0x0){removeReferences(_0x5c8543,_0x12afef);logger[_0xfc69('0x5c')](_0xfc69('0x74'));return _0x5d0ee8(new Error(_0xfc69('0x74')));}var _0xd5ed6b=_0x388fb5[_0xfc69('0x78')](function(_0x8074d7){return _0x8074d7===_0xfc69('0x79');});if(!_0xd5ed6b){return _0x5d0ee8(new Error(_0xfc69('0x7a')));}var _0x2ca501=fs[_0xfc69('0x7b')](path[_0xfc69('0x52')](_0x12afef,_0x41c46c[0x0],_0xfc69('0x79')));var _0x4bc5b6=JSON[_0xfc69('0x7c')](_0x2ca501);if(_0xfc69('0x25')==typeof _0x4bc5b6[_0xfc69('0x31')]){return _0x5d0ee8(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xfc69('0x25')==typeof _0x4bc5b6[_0xfc69('0x37')]){return _0x5d0ee8(new Error(_0xfc69('0x7d')));}if('undefined'==typeof _0x4bc5b6[_0xfc69('0x7e')]){return _0x5d0ee8(new Error(_0xfc69('0x7f')));}if(_0xfc69('0x25')==typeof _0x4bc5b6[_0xfc69('0x80')]){return _0x5d0ee8(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4bc5b6[_0xfc69('0x37')]===_0xfc69('0x81')){if('undefined'==typeof _0x4bc5b6['parameters']['views']){return _0x5d0ee8(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xfc69('0x25')==typeof _0x4bc5b6[_0xfc69('0x80')]['views']['admin']&&_0xfc69('0x25')==typeof _0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x83')]){return _0x5d0ee8(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4bc5b6[_0xfc69('0x37')]===_0xfc69('0x84')){if('undefined'==typeof _0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x85')]){return _0x5d0ee8(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xfc69('0x25')==typeof _0x4bc5b6['parameters'][_0xfc69('0x86')]){return _0x5d0ee8(new Error(_0xfc69('0x87')));}}else{return _0x5d0ee8(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4c01e6=_0x4bc5b6[_0xfc69('0x31')];var _0x1a752b=_0x4bc5b6[_0xfc69('0x88')];var _0x177420=_0x4bc5b6[_0xfc69('0x37')];var _0xbcdea=_0x4bc5b6[_0xfc69('0x89')]?_0x4bc5b6[_0xfc69('0x89')]:_0xfc69('0x8a');var _0x55e4ce=_0x4bc5b6[_0xfc69('0x8b')]?_0x4bc5b6[_0xfc69('0x8b')]:_0xfc69('0x8c');var _0x36d617='';var _0x4cc24f='';var _0x549690='';var _0x1e3c06='';var _0x4ad806=_0x4bc5b6[_0xfc69('0x7e')];if(_0x177420==='html'){if(_0xfc69('0x25')!=typeof _0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x8d')]){var _0x2910e9=_0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xfc69('0x8e')](_0x2910e9)){_0x36d617=path[_0xfc69('0x52')](_0xfc69('0x8f'),_0x54c20d,_0x41c46c[0x0],_0x2910e9);}else{_0x36d617=_0x2910e9;}}else{logger[_0xfc69('0x6b')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xfc69('0x25')!=typeof _0x4bc5b6['parameters'][_0xfc69('0x82')][_0xfc69('0x83')]){var _0x23dcdb=_0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfc69('0x8e')](_0x23dcdb)){_0x4cc24f=path[_0xfc69('0x52')](_0xfc69('0x8f'),_0x54c20d,_0x41c46c[0x0],_0x23dcdb);}else{_0x4cc24f=_0x23dcdb;}}else{logger['info'](_0xfc69('0x90'));}}else if(_0x177420==='script'){_0x549690=_0x4bc5b6['parameters']['scriptName'];_0x1e3c06=_0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x86')];if(_0xfc69('0x25')!=typeof _0x4bc5b6['parameters'][_0xfc69('0x82')]){if(_0xfc69('0x25')!=typeof _0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')]['admin']){var _0x2910e9=_0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xfc69('0x8e')](_0x2910e9)){_0x36d617=path[_0xfc69('0x52')](_0xfc69('0x8f'),_0x54c20d,_0x41c46c[0x0],_0x2910e9);}else{_0x36d617=_0x2910e9;}}if(_0xfc69('0x25')!=typeof _0x4bc5b6[_0xfc69('0x80')][_0xfc69('0x82')][_0xfc69('0x83')]){var _0x23dcdb=_0x4bc5b6[_0xfc69('0x80')]['views'][_0xfc69('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfc69('0x8e')](_0x23dcdb)){_0x4cc24f=path['join']('plugins',_0x54c20d,_0x41c46c[0x0],_0x23dcdb);}else{_0x4cc24f=_0x23dcdb;}}}}var _0x2e48f4={'name':_0x4c01e6,'description':_0x1a752b,'path':path['join'](_0x54c20d,_0x41c46c[0x0]),'type':_0x177420,'sidebar':_0xbcdea,'icon':_0x55e4ce,'adminUrl':_0x36d617,'agentUrl':_0x4cc24f,'scriptName':_0x549690,'scriptPath':_0x1e3c06,'version':_0x4ad806};removeReferences(_0x5c8543,null);return db[_0xfc69('0x35')][_0xfc69('0x91')](_0x2e48f4)[_0xfc69('0x2b')](function(_0x4d7b92){var _0x32e35d={'role':_0x41a4b0['body'][_0xfc69('0x92')],'userProfileId':_0x41a4b0[_0xfc69('0x93')]['userProfileId']};if(!_0x32e35d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32e35d['role']===_0xfc69('0x94')){var _0xf56d64=_0x4d7b92[_0xfc69('0x2d')]({'plain':!![]});return db[_0xfc69('0x95')]['find']({'where':{'name':'Plugins','userProfileId':_0x32e35d[_0xfc69('0x96')]},'raw':!![]})['then'](function(_0x1a8cec){if(_0x1a8cec&&_0x1a8cec[_0xfc69('0x97')]===0x0){return db[_0xfc69('0x2f')]['create']({'name':_0xf56d64[_0xfc69('0x31')],'resourceId':_0xf56d64['id'],'type':_0x1a8cec[_0xfc69('0x31')],'sectionId':_0x1a8cec['id']},{})[_0xfc69('0x2b')](function(){return _0x4d7b92;});}else{return _0x4d7b92;}})['catch'](function(_0x4adc67){logger[_0xfc69('0x5c')](_0xfc69('0x98'),_0x4adc67);throw _0x4adc67;});}return _0x4d7b92;})[_0xfc69('0x2b')](respondWithResult(_0x5c58c9,null))[_0xfc69('0x4d')](handleError(_0x5c58c9,null));}});}catch(_0x141e0f){_0x5c58c9[_0xfc69('0x21')](0x1f4)['send'](_0x141e0f);}};function removeReferences(_0x5f2c0e,_0x18127f){try{if(_0x5f2c0e){fs[_0xfc69('0x69')](_0x5f2c0e);logger[_0xfc69('0x6b')](_0xfc69('0x99'));}if(_0x18127f){rimraf(_0x18127f,function(){});logger[_0xfc69('0x6b')](_0xfc69('0x9a'));}}catch(_0x3ecac3){logger[_0xfc69('0x5c')](_0x3ecac3);}}exports['update']=function(_0x39c110,_0x18fc02,_0x4cceb7){return db[_0xfc69('0x35')][_0xfc69('0x9b')]({'where':{'id':_0x39c110[_0xfc69('0x50')]['id']}})[_0xfc69('0x2b')](handleEntityNotFound(_0x18fc02,null))[_0xfc69('0x2b')](saveUpdates(_0x39c110['body'],null))[_0xfc69('0x2b')](respondWithResult(_0x18fc02,null))[_0xfc69('0x4d')](handleError(_0x18fc02,null));};exports[_0xfc69('0x9c')]=function(_0x2344fd,_0xeb653,_0x48560e){return db['Plugin'][_0xfc69('0x9b')]({'where':{'id':_0x2344fd[_0xfc69('0x50')]['id']}})['then'](function(_0x82a5b0){if(_0x82a5b0){return _0x82a5b0[_0xfc69('0x2c')]();}})['then'](function(_0x59782f){rimraf(path[_0xfc69('0x52')](config['root'],_0xfc69('0x54'),path['dirname'](_0x59782f[_0xfc69('0x51')])),function(){});return _0x59782f;})[_0xfc69('0x2b')](handleEntityNotFound(_0xeb653,null))[_0xfc69('0x2b')](respondWithStatusCode(_0xeb653,null))[_0xfc69('0x4d')](handleError(_0xeb653,null));};exports[_0xfc69('0x9d')]=function(_0x359782,_0x43aaaf,_0x3d3f78){return BPromise[_0xfc69('0x9e')]()[_0xfc69('0x2b')](function(){if(!_0x359782['query'][_0xfc69('0x51')]){throw new Error(_0xfc69('0x9f'));}if(!_0x359782[_0xfc69('0x3b')][_0xfc69('0xa0')]){throw new Error(_0xfc69('0xa1'));}var _0x4bd4af=_0x359782[_0xfc69('0x3b')][_0xfc69('0xa2')]?_0x359782['query']['hostname']+':'+_0x359782[_0xfc69('0x3b')][_0xfc69('0xa0')]:_0xfc69('0xa3')+_0x359782[_0xfc69('0x3b')][_0xfc69('0xa0')];var _0x52ecd0=_0x359782[_0xfc69('0x3b')][_0xfc69('0x22')]?_0x359782[_0xfc69('0x3b')][_0xfc69('0x22')]:!![];var _0x5dc67a=_0x359782[_0xfc69('0x3b')][_0xfc69('0xa4')]?_0x359782[_0xfc69('0x3b')][_0xfc69('0xa4')]:null;var _0x2c588a={'method':_0x359782[_0xfc69('0xa5')],'uri':util['format'](_0xfc69('0xa6'),_0x4bd4af,_0x359782[_0xfc69('0x3b')][_0xfc69('0x51')]),'json':_0x52ecd0,'resolveWithFullResponse':!![],'encoding':_0x5dc67a,'qs':_0x359782[_0xfc69('0x3b')]};if(_0x359782[_0xfc69('0xa7')]){_0x2c588a[_0xfc69('0xa7')]=_0x359782[_0xfc69('0xa7')];if(_0x2c588a[_0xfc69('0xa7')][_0xfc69('0xa8')]){delete _0x2c588a[_0xfc69('0xa7')][_0xfc69('0xa8')];}}if(_0x2c588a[_0xfc69('0xa7')][_0xfc69('0xa9')]){delete _0x2c588a['headers'][_0xfc69('0xa9')];}return rp(_0x2c588a);})[_0xfc69('0x2b')](function(_0x372f43){if(_0x372f43){_0x43aaaf[_0xfc69('0xaa')](_0x372f43['headers']);logger[_0xfc69('0x6b')](_0x372f43['body']);if(_[_0xfc69('0xab')](_0x359782['query']['path'],'download')&&_0x372f43[_0xfc69('0xac')]==0x1f4){return _0x43aaaf[_0xfc69('0x20')](_0x372f43['statusCode']);}else{return _0x43aaaf[_0xfc69('0x21')](_0x372f43[_0xfc69('0xac')])[_0xfc69('0x32')](_0x372f43[_0xfc69('0x93')]);}}else{return _0x43aaaf[_0xfc69('0x20')](0xc8);}})['catch'](handleError(_0x43aaaf,null));};exports['webhookPost']=function(_0x356d41,_0x4254e1,_0x5335b3){return BPromise[_0xfc69('0x9e')]()[_0xfc69('0x2b')](function(){if(!_0x356d41[_0xfc69('0x3b')]['path']){throw new Error(_0xfc69('0x9f'));}if(!_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa0')]){throw new Error(_0xfc69('0xa1'));}var _0x583f72=_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa2')]?_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa2')]+':'+_0x356d41[_0xfc69('0x3b')]['port']:'http://localhost:'+_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa0')];var _0x549642=_0x356d41[_0xfc69('0x3b')]['json']?_0x356d41[_0xfc69('0x3b')]['json']:!![];var _0xd091f8=_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa4')]?_0x356d41[_0xfc69('0x3b')][_0xfc69('0xa4')]:null;var _0x14614f={'method':_0x356d41[_0xfc69('0xa5')],'uri':util[_0xfc69('0x55')]('%s%s',_0x583f72,_0x356d41['query'][_0xfc69('0x51')]),'json':_0x549642,'resolveWithFullResponse':!![],'encoding':_0xd091f8,'body':_0x356d41[_0xfc69('0x93')]};if(_0x356d41[_0xfc69('0xa7')]){_0x14614f[_0xfc69('0xa7')]=_0x356d41['headers'];if(_0x14614f[_0xfc69('0xa7')][_0xfc69('0xa8')]){delete _0x14614f[_0xfc69('0xa7')][_0xfc69('0xa8')];}}if(_0x14614f[_0xfc69('0xa7')][_0xfc69('0xa9')]){delete _0x14614f[_0xfc69('0xa7')][_0xfc69('0xa9')];}return rp(_0x14614f);})[_0xfc69('0x2b')](function(_0xeab58a){if(_0xeab58a){_0x4254e1[_0xfc69('0xaa')](_0xeab58a[_0xfc69('0xa7')]);logger[_0xfc69('0x6b')](_0xeab58a[_0xfc69('0x93')]);return _0x4254e1[_0xfc69('0x21')](_0xeab58a[_0xfc69('0xac')])['send'](_0xeab58a['body']);}else{return _0x4254e1[_0xfc69('0x20')](0xc8);}})[_0xfc69('0x4d')](handleError(_0x4254e1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2062220..b55aa40 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 _0x48e3=['../../mysqldb','setMaxListeners','remove','emit','hook','events'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x48e3,0xe9));var _0x348e=function(_0x227fb1,_0x216662){_0x227fb1=_0x227fb1-0x0;var _0x59081a=_0x48e3[_0x227fb1];return _0x59081a;};'use strict';var EventEmitter=require(_0x348e('0x0'));var Plugin=require(_0x348e('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x348e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x348e('0x3')};function emitEvent(_0x52d228){return function(_0xf98d97,_0x1250c0,_0x580d4d){PluginEvents[_0x348e('0x4')](_0x52d228+':'+_0xf98d97['id'],_0xf98d97);PluginEvents['emit'](_0x52d228,_0xf98d97);_0x580d4d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x348e('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xc21c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4202fd,_0x397387){var _0x37fcac=function(_0x4771ad){while(--_0x4771ad){_0x4202fd['push'](_0x4202fd['shift']());}};_0x37fcac(++_0x397387);}(_0xc21c,0x166));var _0xcc21=function(_0x1ce0ab,_0x5c9a29){_0x1ce0ab=_0x1ce0ab-0x0;var _0x56a956=_0xc21c[_0x1ce0ab];return _0x56a956;};'use strict';var EventEmitter=require(_0xcc21('0x0'));var Plugin=require(_0xcc21('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xcc21('0x2')](0x0);var events={'afterCreate':_0xcc21('0x3'),'afterUpdate':_0xcc21('0x4'),'afterDestroy':_0xcc21('0x5')};function emitEvent(_0x4e17e8){return function(_0x3e29df,_0x31bf8b,_0x18866a){PluginEvents[_0xcc21('0x6')](_0x4e17e8+':'+_0x3e29df['id'],_0x3e29df);PluginEvents[_0xcc21('0x6')](_0x4e17e8,_0x3e29df);_0x18866a(null);};}for(var e in events){if(events[_0xcc21('0x7')](e)){var event=events[e];Plugin[_0xcc21('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index afb650e..83bf88f 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 _0x291b=['../../config/logger','api','moment','bluebird','../../config/environment','exports','define','Plugin','plugins','lodash','util'];(function(_0x1e2372,_0x2ea876){var _0x4cd59b=function(_0x5d85cd){while(--_0x5d85cd){_0x1e2372['push'](_0x1e2372['shift']());}};_0x4cd59b(++_0x2ea876);}(_0x291b,0x98));var _0xb291=function(_0x525e56,_0x1f0f2f){_0x525e56=_0x525e56-0x0;var _0x525252=_0x291b[_0x525e56];return _0x525252;};'use strict';var _=require(_0xb291('0x0'));var util=require(_0xb291('0x1'));var logger=require(_0xb291('0x2'))(_0xb291('0x3'));var moment=require(_0xb291('0x4'));var BPromise=require(_0xb291('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb291('0x6'));var attributes=require('./plugin.attributes');module[_0xb291('0x7')]=function(_0x98637,_0x429a12){return _0x98637[_0xb291('0x8')](_0xb291('0x9'),attributes,{'tableName':_0xb291('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe126=['define','plugins','util','api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports'];(function(_0x47e46b,_0x5f488e){var _0x2a2cc1=function(_0x5343d1){while(--_0x5343d1){_0x47e46b['push'](_0x47e46b['shift']());}};_0x2a2cc1(++_0x5f488e);}(_0xe126,0xf2));var _0x6e12=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xe126[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require('lodash');var util=require(_0x6e12('0x0'));var logger=require('../../config/logger')(_0x6e12('0x1'));var moment=require('moment');var BPromise=require(_0x6e12('0x2'));var rp=require(_0x6e12('0x3'));var fs=require('fs');var path=require(_0x6e12('0x4'));var rimraf=require(_0x6e12('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e12('0x6'));module[_0x6e12('0x7')]=function(_0x332df2,_0x1695d5){return _0x332df2[_0x6e12('0x8')]('Plugin',attributes,{'tableName':_0x6e12('0x9'),'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 af334ea..ed9f7cd 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 _0xcef6=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','then','info','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','Plugin','create','body','options','raw','CreatePlugin','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4611bb,_0x16f2a7){var _0x4ab34a=function(_0x2f28c6){while(--_0x2f28c6){_0x4611bb['push'](_0x4611bb['shift']());}};_0x4ab34a(++_0x16f2a7);}(_0xcef6,0x16e));var _0x6cef=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0xcef6[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x6cef('0x0'));var util=require(_0x6cef('0x1'));var moment=require(_0x6cef('0x2'));var BPromise=require(_0x6cef('0x3'));var rs=require(_0x6cef('0x4'));var fs=require('fs');var Redis=require(_0x6cef('0x5'));var db=require(_0x6cef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6cef('0x7'));var config=require(_0x6cef('0x8'));var jayson=require(_0x6cef('0x9'));var client=jayson[_0x6cef('0xa')][_0x6cef('0xb')]({'port':0x232a});config[_0x6cef('0xc')]=_[_0x6cef('0xd')](config[_0x6cef('0xc')],{'host':_0x6cef('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cef('0xc')]));require(_0x6cef('0xf'))['register'](socket);function respondWithRpcPromise(_0x2b2ef0,_0x1f27b8,_0x4e293a){return new BPromise(function(_0x5723ea,_0x4b813c){return client['request'](_0x2b2ef0,_0x4e293a)[_0x6cef('0x10')](function(_0x55780c){logger[_0x6cef('0x11')]('Plugin,\x20%s,\x20%s',_0x1f27b8,'request\x20sent');logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1f27b8,_0x6cef('0x12'),JSON[_0x6cef('0x13')](_0x55780c));if(_0x55780c[_0x6cef('0x14')]){if(_0x55780c[_0x6cef('0x14')][_0x6cef('0x15')]===0x1f4){logger['error'](_0x6cef('0x16'),_0x1f27b8,_0x55780c['error']['message']);return _0x4b813c(_0x55780c[_0x6cef('0x14')]['message']);}logger['error'](_0x6cef('0x16'),_0x1f27b8,_0x55780c['error'][_0x6cef('0x17')]);return _0x5723ea(_0x55780c[_0x6cef('0x14')][_0x6cef('0x17')]);}else{logger[_0x6cef('0x11')]('Plugin,\x20%s,\x20%s',_0x1f27b8,'request\x20sent');_0x5723ea(_0x55780c['result'][_0x6cef('0x17')]);}})['catch'](function(_0xd7706d){logger[_0x6cef('0x14')]('Plugin,\x20%s,\x20%s',_0x1f27b8,_0xd7706d);_0x4b813c(_0xd7706d);});});}exports['CreatePlugin']=function(_0x12fe9d){var _0x3c587c=this;return new Promise(function(_0x3fdb76,_0x936773){return db[_0x6cef('0x18')][_0x6cef('0x19')](_0x12fe9d[_0x6cef('0x1a')],{'raw':_0x12fe9d[_0x6cef('0x1b')]?_0x12fe9d[_0x6cef('0x1b')][_0x6cef('0x1c')]===undefined?!![]:![]:!![]})[_0x6cef('0x10')](function(_0x13fed5){logger['info'](_0x6cef('0x1d'),_0x12fe9d);logger['debug'](_0x6cef('0x1d'),_0x12fe9d,JSON[_0x6cef('0x13')](_0x13fed5));_0x3fdb76(_0x13fed5);})[_0x6cef('0x1e')](function(_0x2220bc){logger[_0x6cef('0x14')](_0x6cef('0x1d'),_0x2220bc[_0x6cef('0x17')],_0x12fe9d);_0x936773(_0x3c587c[_0x6cef('0x14')](0x1f4,_0x2220bc[_0x6cef('0x17')]));});});}; \ No newline at end of file +var _0x1186=['error','code','message','CreatePlugin','Plugin','create','body','options','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x1186,0x75));var _0x6118=function(_0x52ba12,_0x6fd9cb){_0x52ba12=_0x52ba12-0x0;var _0x1b80ad=_0x1186[_0x52ba12];return _0x1b80ad;};'use strict';var _=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var moment=require('moment');var BPromise=require(_0x6118('0x2'));var rs=require(_0x6118('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6118('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6118('0x5'))('rpc');var config=require(_0x6118('0x6'));var jayson=require(_0x6118('0x7'));var client=jayson[_0x6118('0x8')][_0x6118('0x9')]({'port':0x232a});config['redis']=_[_0x6118('0xa')](config[_0x6118('0xb')],{'host':_0x6118('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6118('0xd'))[_0x6118('0xe')](socket);function respondWithRpcPromise(_0x30e232,_0x327eda,_0xb99464){return new BPromise(function(_0x4c78d0,_0x25ddd3){return client['request'](_0x30e232,_0xb99464)['then'](function(_0x584dec){logger[_0x6118('0xf')](_0x6118('0x10'),_0x327eda,_0x6118('0x11'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x327eda,'request\x20sent',JSON['stringify'](_0x584dec));if(_0x584dec[_0x6118('0x12')]){if(_0x584dec['error'][_0x6118('0x13')]===0x1f4){logger['error'](_0x6118('0x10'),_0x327eda,_0x584dec['error'][_0x6118('0x14')]);return _0x25ddd3(_0x584dec[_0x6118('0x12')][_0x6118('0x14')]);}logger[_0x6118('0x12')](_0x6118('0x10'),_0x327eda,_0x584dec[_0x6118('0x12')][_0x6118('0x14')]);return _0x4c78d0(_0x584dec[_0x6118('0x12')][_0x6118('0x14')]);}else{logger[_0x6118('0xf')](_0x6118('0x10'),_0x327eda,'request\x20sent');_0x4c78d0(_0x584dec['result'][_0x6118('0x14')]);}})['catch'](function(_0x442d8b){logger['error'](_0x6118('0x10'),_0x327eda,_0x442d8b);_0x25ddd3(_0x442d8b);});});}exports[_0x6118('0x15')]=function(_0x446396){var _0x788491=this;return new Promise(function(_0x3ec3fa,_0x18a2c0){return db[_0x6118('0x16')][_0x6118('0x17')](_0x446396[_0x6118('0x18')],{'raw':_0x446396[_0x6118('0x19')]?_0x446396[_0x6118('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x33fc31){logger['info']('CreatePlugin',_0x446396);logger['debug'](_0x6118('0x15'),_0x446396,JSON['stringify'](_0x33fc31));_0x3ec3fa(_0x33fc31);})[_0x6118('0x1a')](function(_0x44bc41){logger[_0x6118('0x12')](_0x6118('0x15'),_0x44bc41['message'],_0x446396);_0x18a2c0(_0x788491[_0x6118('0x12')](0x1f4,_0x44bc41[_0x6118('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bab4c18..6633e55 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 _0xd294=['update','emit','removeListener','length'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd294,0x174));var _0x4d29=function(_0x3a63fd,_0x587403){_0x3a63fd=_0x3a63fd-0x0;var _0x57cae3=_0xd294[_0x3a63fd];return _0x57cae3;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove',_0x4d29('0x0')];function createListener(_0x204ba7,_0x3e336f){return function(_0x15e4e2){_0x3e336f[_0x4d29('0x1')](_0x204ba7,_0x15e4e2);};}function removeListener(_0x1cd9a1,_0x42d4f0){return function(){PluginEvents[_0x4d29('0x2')](_0x1cd9a1,_0x42d4f0);};}exports['register']=function(_0x210005){for(var _0x4c8992=0x0,_0x1740f9=events[_0x4d29('0x3')];_0x4c8992<_0x1740f9;_0x4c8992++){var _0x3768bb=events[_0x4c8992];var _0x2a4dee=createListener('plugin:'+_0x3768bb,_0x210005);PluginEvents['on'](_0x3768bb,_0x2a4dee);}}; \ No newline at end of file +var _0x7038=['register','length','plugin:','save','remove','update','emit','removeListener'];(function(_0x64bec,_0x37225c){var _0x46b9c6=function(_0x4cd9af){while(--_0x4cd9af){_0x64bec['push'](_0x64bec['shift']());}};_0x46b9c6(++_0x37225c);}(_0x7038,0xdb));var _0x8703=function(_0x92c7c4,_0x7ef533){_0x92c7c4=_0x92c7c4-0x0;var _0x598004=_0x7038[_0x92c7c4];return _0x598004;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8703('0x0'),_0x8703('0x1'),_0x8703('0x2')];function createListener(_0x3e7562,_0x571672){return function(_0x286777){_0x571672[_0x8703('0x3')](_0x3e7562,_0x286777);};}function removeListener(_0x1137e7,_0x42318a){return function(){PluginEvents[_0x8703('0x4')](_0x1137e7,_0x42318a);};}exports[_0x8703('0x5')]=function(_0x5c6db0){for(var _0x48cfe5=0x0,_0x45a2e9=events[_0x8703('0x6')];_0x48cfe5<_0x45a2e9;_0x48cfe5++){var _0x71cacc=events[_0x48cfe5];var _0x352d38=createListener(_0x8703('0x7')+_0x71cacc,_0x5c6db0);PluginEvents['on'](_0x71cacc,_0x352d38);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8c41b9b..f211916 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x25fc5f,_0x23a454){var _0x5ebcfa=function(_0x2f0e67){while(--_0x2f0e67){_0x25fc5f['push'](_0x25fc5f['shift']());}};_0x5ebcfa(++_0x23a454);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4646a9,_0x518653){var _0x4afce6=function(_0x58d397){while(--_0x58d397){_0x4646a9['push'](_0x4646a9['shift']());}};_0x4afce6(++_0x518653);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 42a29db..5f504e7 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 _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x591a86,_0x10cabd){var _0x23f775=function(_0x9ca226){while(--_0x9ca226){_0x591a86['push'](_0x591a86['shift']());}};_0x23f775(++_0x10cabd);}(_0xd2ea,0x15f));var _0xad2e=function(_0x33ce55,_0x5141d0){_0x33ce55=_0x33ce55-0x0;var _0x4ee7cb=_0xd2ea[_0x33ce55];return _0x4ee7cb;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x4c7994,_0x1b27fb){var _0x5db2db=function(_0x58e678){while(--_0x58e678){_0x4c7994['push'](_0x4c7994['shift']());}};_0x5db2db(++_0x1b27fb);}(_0x2750,0x13b));var _0x0275=function(_0x4a9076,_0x4758a6){_0x4a9076=_0x4a9076-0x0;var _0x3d4d64=_0x2750[_0x4a9076];return _0x3d4d64;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4b80276..594ff80 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf826=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','express'];(function(_0x1e3334,_0x5cbea4){var _0x3728de=function(_0x367a37){while(--_0x367a37){_0x1e3334['push'](_0x1e3334['shift']());}};_0x3728de(++_0x5cbea4);}(_0xf826,0x11f));var _0x6f82=function(_0x5c9520,_0x2c9380){_0x5c9520=_0x5c9520-0x0;var _0x2dd5ba=_0xf826[_0x5c9520];return _0x2dd5ba;};'use strict';var express=require(_0x6f82('0x0'));var router=express[_0x6f82('0x1')]();var auth=require(_0x6f82('0x2'));var controller=require(_0x6f82('0x3'));router[_0x6f82('0x4')](_0x6f82('0x5'),auth[_0x6f82('0x6')](),controller[_0x6f82('0x7')]);router[_0x6f82('0x4')]('/queues',auth[_0x6f82('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xff7d=['isAuthenticated','exports','express','Router','./realtime.controller','get','/agents','getAgents','/queues'];(function(_0x5172f9,_0x2121ed){var _0x2430bc=function(_0x2c0efd){while(--_0x2c0efd){_0x5172f9['push'](_0x5172f9['shift']());}};_0x2430bc(++_0x2121ed);}(_0xff7d,0x77));var _0xdff7=function(_0x586903,_0x1b8b3e){_0x586903=_0x586903-0x0;var _0x3e1acd=_0xff7d[_0x586903];return _0x3e1acd;};'use strict';var express=require(_0xdff7('0x0'));var router=express[_0xdff7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdff7('0x2'));router[_0xdff7('0x3')](_0xdff7('0x4'),auth['isAuthenticated'](),controller[_0xdff7('0x5')]);router['get'](_0xdff7('0x6'),auth[_0xdff7('0x7')](),controller['getQueues']);module[_0xdff7('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a3a403a..94330aa 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c70=['name','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','getUpdatedSortOptions','fields','join','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','getOptions','push','sequelize','literal','FIELD(id,','order','forEach','*pause','Pause','where','user','userProfileId','Agents','agent','extraQueryConditions','UserProfile','getResources','findAndCountAll','globalStatus','getAgentStatus','Status','split','pick','catch','getQueues','startCase','Queue','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7c70,0xfd));var _0x07c7=function(_0x1aa835,_0x23e8ac){_0x1aa835=_0x1aa835-0x0;var _0x5ad5c7=_0x7c70[_0x1aa835];return _0x5ad5c7;};'use strict';var _=require(_0x07c7('0x0'));var util=require('util');var rta=require(_0x07c7('0x1'));var rtq=require(_0x07c7('0x2'));var qs=require(_0x07c7('0x3'));var utils=require(_0x07c7('0x4'));var db=require(_0x07c7('0x5'))['db'];var APIBadRequestError=require(_0x07c7('0x6'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0x07c7('0x7')];function respondWithFilteredResult(_0xf36f4b,_0x43edb4){return function(_0x2bd8d1){if(_0x2bd8d1){var _0x16495e=typeof _0x43edb4[_0x07c7('0x8')]===_0x07c7('0x9')&&typeof _0x43edb4[_0x07c7('0xa')]===_0x07c7('0x9');var _0x4fd57=_0x2bd8d1[_0x07c7('0xb')];var _0x3d15cd=_0x16495e?0x0:_0x43edb4['offset'];var _0x960d7f=_0x16495e?_0x2bd8d1['count']:_0x43edb4['offset']+_0x43edb4[_0x07c7('0xa')];var _0x493be7;if(_0x960d7f>=_0x4fd57){_0x960d7f=_0x4fd57;_0x493be7=0xc8;}else{_0x493be7=0xce;}_0xf36f4b[_0x07c7('0xc')](_0x493be7);return _0xf36f4b[_0x07c7('0xd')]('Content-Range',_0x3d15cd+'-'+_0x960d7f+'/'+_0x4fd57)[_0x07c7('0xe')](_0x2bd8d1);}return null;};}exports[_0x07c7('0xf')]=function(_0x1fefc5,_0x18f8a7){var _0x3e69a2={'count':0x0,'rows':[]};var _0x479945={};var _0x2bf06a;var _0x44ed29=utils[_0x07c7('0x10')]();var _0x1c6f42;var _0x1d5746;var _0x4db8ad=_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x12')];var _0x2ec345=_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x13')];var _0x2c8d0a=_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x14')];var _0x53864b=_0x2ec345===_0x07c7('0x15')||_0x2ec345==='*pause'?!![]:![];var _0x4a532d=[];var _0x3d1fcf;var _0x11e446;Promise[_0x07c7('0x16')]()[_0x07c7('0x17')](function(){if(_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x18')]){if(!utils[_0x07c7('0x19')](_0x1fefc5['query'][_0x07c7('0x18')])){throw new APIBadRequestError(util[_0x07c7('0x1a')](_0x07c7('0x1b'),_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x18')]));}_0x2bf06a=_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x18')][_0x07c7('0x1c')]();}if(!_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x1d')]||!_0x1fefc5[_0x07c7('0x11')]['sort'][_0x07c7('0x1e')]('globalStatus')){_0x1fefc5[_0x07c7('0x11')]['sort']=rta['validateSortParameter'](_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x1d')]);return;}var _0x1d528d=rta[_0x07c7('0x1f')](_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x1d')]);_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x1d')]=_0x1d528d[_0x07c7('0x20')][_0x07c7('0x21')](',');_0x3d1fcf=_0x1d528d['order'];})['then'](function(){if(!_0x4db8ad){return[];}return rta['getAgentIdsByQueues'](_0x4db8ad,_0x2bf06a);})['then'](function(_0x2ef298){_0x4a532d=_0x2ef298;return rta[_0x07c7('0x22')]();})[_0x07c7('0x17')](function(_0x181cd4){_0x1d5746=_0x181cd4[_0x07c7('0x23')];if((!_0x2ec345||_0x53864b)&&!_0x3d1fcf){return _0x4a532d;}if(_0x3d1fcf&&!_0x2ec345){return rta[_0x07c7('0x24')](_0x1d5746,_0x4a532d,_0x3d1fcf);}else{return rta[_0x07c7('0x25')](_0x1d5746,_0x4a532d,_0x2ec345);}})['then'](function(_0x2d37b7){_0x4a532d=_0x2d37b7;var _0x562971=![];if(_0x4a532d[_0x07c7('0x26')]===0x0){if(_0x4db8ad||_0x2ec345){_0x562971=!![];}if(_0x53864b){_0x562971=![];}}if(_0x562971){return _0x3e69a2;}var _0x10a2a0=_[_0x07c7('0x27')](db[_0x07c7('0x28')][_0x07c7('0x29')],function(_0x55c42b){return{'name':_0x55c42b[_0x07c7('0x2a')],'type':_0x55c42b[_0x07c7('0x2b')][_0x07c7('0x2c')]};});_0x1fefc5['query'][_0x07c7('0x2d')]='agent';_0x1fefc5[_0x07c7('0x11')]['online']=!![];_0x479945=qs[_0x07c7('0x2e')](_0x10a2a0,_0x1fefc5);_0x479945['raw']=!![];var _0x579c3a=[];if(_0x4a532d[_0x07c7('0x26')]>0x0){_0x579c3a[_0x07c7('0x2f')]({'id':{'$in':_0x4a532d}});if(_0x3d1fcf&&!_0x2ec345){_0x11e446=[db[_0x07c7('0x30')][_0x07c7('0x31')](_0x07c7('0x32')+_0x4a532d+')')];_0x479945[_0x07c7('0x33')]=_0x11e446;}}if(_0x53864b){_0x44ed29[_0x07c7('0x34')](function(_0x2b8c60){var _0x1f5247=!![];if(_0x2ec345===_0x07c7('0x35')&&_0x2bf06a!==_0x2b8c60){_0x1f5247=![];}_0x579c3a[_0x07c7('0x2f')]({[_0x2b8c60+_0x07c7('0x36')]:_0x1f5247});});if(_0x2c8d0a){_0x579c3a['push']({'pauseType':_0x2c8d0a});}}else if(_0x2ec345){_0x44ed29['forEach'](function(_0x47fcc8){_0x579c3a['push']({[_0x47fcc8+_0x07c7('0x36')]:![]});});}_0x479945[_0x07c7('0x37')]=_['merge'](_0x479945['where'],{'$and':_0x579c3a});if(_0x1fefc5[_0x07c7('0x38')][_0x07c7('0x2d')]===_0x07c7('0x38')){var _0xfe4696={'params':{'id':_0x1fefc5['user'][_0x07c7('0x39')]},'query':{'section':_0x07c7('0x3a'),'role':_0x07c7('0x3b'),'online':!![],'raw':!![],'ids':_0x4a532d,'customSorting':_0x11e446}};if(_0x53864b){_0xfe4696[_0x07c7('0x11')][_0x07c7('0x3c')]=_0x579c3a;}_0xfe4696[_0x07c7('0x11')]=Object['assign'](_0xfe4696['query'],_0x1fefc5[_0x07c7('0x11')]);delete _0xfe4696[_0x07c7('0x11')]['id'];return db[_0x07c7('0x3d')][_0x07c7('0x3e')](_0xfe4696);}return db[_0x07c7('0x28')][_0x07c7('0x3f')](_0x479945);})[_0x07c7('0x17')](function(_0x5b3553){_0x3e69a2[_0x07c7('0xb')]=_0x5b3553[_0x07c7('0xb')];_0x1c6f42=_0x5b3553[_0x07c7('0x23')];return _0x1c6f42[_0x07c7('0x27')](function(_0x4a5bff){var _0x1614bb=_['find'](_0x1d5746,['id',_0x4a5bff['id']]);if(_0x1614bb){var _0x5930dc=rta['filterAgentAttributes'](_0x1614bb);_['merge'](_0x4a5bff,_0x5930dc);}_0x4a5bff[_0x07c7('0x40')]=rta[_0x07c7('0x41')](_0x4a5bff);if(_0x4a5bff[_0x07c7('0x40')][_0x07c7('0x1e')](_0x07c7('0x15'))){_0x44ed29[_0x07c7('0x34')](function(_0x4dd548){if(_0x4a5bff[_0x4dd548+_0x07c7('0x36')]){_0x4a5bff[_0x4dd548+_0x07c7('0x42')]=_0x07c7('0x15');}});}return _0x4a5bff;});})[_0x07c7('0x17')](function(_0x37d454){if(!_0x3d1fcf||_0x11e446){return _0x37d454;}return rta['sortAgentsByStatus'](_0x37d454,_0x3d1fcf);})[_0x07c7('0x17')](function(_0x17551f){var _0x37431b=null;if(_0x1fefc5[_0x07c7('0x11')][_0x07c7('0x20')]){var _0x3a671f=_0x1fefc5['query'][_0x07c7('0x20')][_0x07c7('0x43')](',');_0x37431b=_0x17551f[_0x07c7('0x27')](function(_0x30dacb){return _[_0x07c7('0x44')](_0x30dacb,_0x3a671f);});}_0x3e69a2[_0x07c7('0x23')]=_0x37431b||_0x17551f;return _0x3e69a2;})[_0x07c7('0x17')](respondWithFilteredResult(_0x18f8a7,_0x479945))[_0x07c7('0x45')](APIHandleError(_0x18f8a7));};exports[_0x07c7('0x46')]=function(_0x395d16,_0x44b3da){var _0x52c23e={'count':0x0,'rows':[]};var _0x5661ca={};var _0x156211;var _0x121f0d;var _0x1ec903;Promise[_0x07c7('0x16')]()[_0x07c7('0x17')](function(){if(_0x395d16[_0x07c7('0x11')][_0x07c7('0x18')]){if(!utils[_0x07c7('0x19')](_0x395d16[_0x07c7('0x11')][_0x07c7('0x18')])){throw new APIBadRequestError(util[_0x07c7('0x1a')](_0x07c7('0x1b'),_0x395d16['query'][_0x07c7('0x18')]));}_0x156211=_0x395d16['query']['channel']['toLowerCase']();}var _0x47a76e=_[_0x07c7('0x47')](_0x156211)+_0x07c7('0x48');var _0x4d85bc=_[_0x07c7('0x27')](db[_0x47a76e][_0x07c7('0x29')],function(_0x4d1cfc){return{'name':_0x4d1cfc[_0x07c7('0x2a')],'type':_0x4d1cfc[_0x07c7('0x2b')][_0x07c7('0x2c')]};});if(!_0x395d16['query'][_0x07c7('0x20')]){var _0x71dd1=['id','name'];if(_0x156211===_0x07c7('0x49')){_0x71dd1['push'](_0x07c7('0x2b'));if(_0x395d16[_0x07c7('0x11')]['type']===_0x07c7('0x4a')){_0x71dd1[_0x07c7('0x2f')]([_0x07c7('0x4b'),_0x07c7('0x4c')]);}}_0x395d16[_0x07c7('0x11')][_0x07c7('0x20')]=_0x71dd1[_0x07c7('0x21')](',');}_0x5661ca=qs['getOptions'](_0x4d85bc,_0x395d16);if(_0x395d16[_0x07c7('0x38')]['role']===_0x07c7('0x38')){var _0x17b52d={'params':{'id':_0x395d16['user'][_0x07c7('0x39')]},'query':{'section':_0x156211===_0x07c7('0x49')&&_0x395d16[_0x07c7('0x11')][_0x07c7('0x2b')]==='outbound'?_0x07c7('0x4d'):_['startCase'](_0x156211)+_0x07c7('0x4e'),'type':_0x395d16[_0x07c7('0x11')][_0x07c7('0x2b')],'nolimit':!![],'sort':_0x07c7('0x4f'),'filter':_0x395d16['query'][_0x07c7('0x50')]}};return db[_0x07c7('0x3d')][_0x07c7('0x3e')](_0x17b52d);}return db[_0x47a76e][_0x07c7('0x3f')](_0x5661ca);})[_0x07c7('0x17')](function(_0x5d1684){_0x52c23e['count']=_0x5d1684[_0x07c7('0xb')];_0x121f0d=_0x5d1684['rows'];return rtq[_0x07c7('0x51')](_0x395d16,_0x156211);})[_0x07c7('0x17')](function(_0x1ddaba){_0x1ec903=_0x1ddaba[_0x07c7('0x23')];return rtq[_0x07c7('0x52')](_0x121f0d,_0x1ec903,_0x156211,_0x395d16[_0x07c7('0x11')]['type']);})['then'](function(_0xad1669){_0x52c23e[_0x07c7('0x23')]=_0xad1669;return _0x52c23e;})[_0x07c7('0x17')](respondWithFilteredResult(_0x44b3da,_0x5661ca))[_0x07c7('0x45')](APIHandleError(_0x44b3da));}; \ No newline at end of file +var _0xebe7=['isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','online','raw','length','sequelize','literal','FIELD(id,','forEach','*pause','push','Pause','where','merge','user','userProfileId','agent','UserProfile','getResources','findAndCountAll','Status','pick','catch','resolve','startCase','Queue','dialMethod','join','voice','outbound','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','then','channel'];(function(_0x3d86f5,_0x257914){var _0x2d6881=function(_0x2d912e){while(--_0x2d912e){_0x3d86f5['push'](_0x3d86f5['shift']());}};_0x2d6881(++_0x257914);}(_0xebe7,0x11d));var _0x7ebe=function(_0x68ca65,_0x3392ec){_0x68ca65=_0x68ca65-0x0;var _0x24f842=_0xebe7[_0x68ca65];return _0x24f842;};'use strict';var _=require('lodash');var util=require(_0x7ebe('0x0'));var rta=require(_0x7ebe('0x1'));var rtq=require(_0x7ebe('0x2'));var qs=require(_0x7ebe('0x3'));var utils=require(_0x7ebe('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x7ebe('0x5'))[_0x7ebe('0x6')];var APIHandleError=require(_0x7ebe('0x5'))[_0x7ebe('0x7')];function respondWithFilteredResult(_0x11ed7e,_0x5cca2b){return function(_0x214037){if(_0x214037){var _0x3bb40e=typeof _0x5cca2b[_0x7ebe('0x8')]===_0x7ebe('0x9')&&typeof _0x5cca2b[_0x7ebe('0xa')]===_0x7ebe('0x9');var _0x32bde9=_0x214037[_0x7ebe('0xb')];var _0x1abf39=_0x3bb40e?0x0:_0x5cca2b[_0x7ebe('0x8')];var _0x22e96e=_0x3bb40e?_0x214037[_0x7ebe('0xb')]:_0x5cca2b['offset']+_0x5cca2b[_0x7ebe('0xa')];var _0x340ebf;if(_0x22e96e>=_0x32bde9){_0x22e96e=_0x32bde9;_0x340ebf=0xc8;}else{_0x340ebf=0xce;}_0x11ed7e[_0x7ebe('0xc')](_0x340ebf);return _0x11ed7e[_0x7ebe('0xd')](_0x7ebe('0xe'),_0x1abf39+'-'+_0x22e96e+'/'+_0x32bde9)[_0x7ebe('0xf')](_0x214037);}return null;};}exports['getAgents']=function(_0x208dda,_0x15438c){var _0x165db4={'count':0x0,'rows':[]};var _0x17cb47={};var _0x148d34;var _0x9ddf6d=utils[_0x7ebe('0x10')]();var _0x4e168f;var _0x432ad7;var _0x7f96d9=_0x208dda[_0x7ebe('0x11')]['globalQueueFilter'];var _0x46a808=_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x12')];var _0x41af9f=_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x13')];var _0x232c3d=_0x46a808===_0x7ebe('0x14')||_0x46a808==='*pause'?!![]:![];var _0x440b75=[];var _0x1c6e9a;var _0x51c372;Promise['resolve']()[_0x7ebe('0x15')](function(){if(_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x16')]){if(!utils[_0x7ebe('0x17')](_0x208dda['query']['channel'])){throw new APIBadRequestError(util[_0x7ebe('0x18')](_0x7ebe('0x19'),_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x16')]));}_0x148d34=_0x208dda['query'][_0x7ebe('0x16')][_0x7ebe('0x1a')]();}if(!_0x208dda[_0x7ebe('0x11')]['sort']||!_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x1b')][_0x7ebe('0x1c')](_0x7ebe('0x1d'))){_0x208dda[_0x7ebe('0x11')]['sort']=rta[_0x7ebe('0x1e')](_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x1b')]);return;}var _0x47f759=rta['getUpdatedSortOptions'](_0x208dda['query'][_0x7ebe('0x1b')]);_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x1b')]=_0x47f759[_0x7ebe('0x1f')]['join'](',');_0x1c6e9a=_0x47f759[_0x7ebe('0x20')];})['then'](function(){if(!_0x7f96d9){return[];}return rta[_0x7ebe('0x21')](_0x7f96d9,_0x148d34);})[_0x7ebe('0x15')](function(_0x22f067){_0x440b75=_0x22f067;return rta['getRealtimeAgents']();})[_0x7ebe('0x15')](function(_0x13d8db){_0x432ad7=_0x13d8db[_0x7ebe('0x22')];if((!_0x46a808||_0x232c3d)&&!_0x1c6e9a){return _0x440b75;}if(_0x1c6e9a&&!_0x46a808){return rta[_0x7ebe('0x23')](_0x432ad7,_0x440b75,_0x1c6e9a);}else{return rta[_0x7ebe('0x24')](_0x432ad7,_0x440b75,_0x46a808);}})['then'](function(_0x5e9ef8){_0x440b75=_0x5e9ef8;var _0x29feec=![];if(_0x440b75['length']===0x0){if(_0x7f96d9||_0x46a808){_0x29feec=!![];}if(_0x232c3d){_0x29feec=![];}}if(_0x29feec){return _0x165db4;}var _0xd9d775=_[_0x7ebe('0x25')](db[_0x7ebe('0x26')][_0x7ebe('0x27')],function(_0x49e646){return{'name':_0x49e646[_0x7ebe('0x28')],'type':_0x49e646[_0x7ebe('0x29')][_0x7ebe('0x2a')]};});_0x208dda[_0x7ebe('0x11')][_0x7ebe('0x2b')]='agent';_0x208dda['query'][_0x7ebe('0x2c')]=!![];_0x17cb47=qs['getOptions'](_0xd9d775,_0x208dda);_0x17cb47[_0x7ebe('0x2d')]=!![];var _0x333da1=[];if(_0x440b75[_0x7ebe('0x2e')]>0x0){_0x333da1['push']({'id':{'$in':_0x440b75}});if(_0x1c6e9a&&!_0x46a808){_0x51c372=[db[_0x7ebe('0x2f')][_0x7ebe('0x30')](_0x7ebe('0x31')+_0x440b75+')')];_0x17cb47[_0x7ebe('0x20')]=_0x51c372;}}if(_0x232c3d){_0x9ddf6d[_0x7ebe('0x32')](function(_0x17cea8){var _0x556c1f=!![];if(_0x46a808===_0x7ebe('0x33')&&_0x148d34!==_0x17cea8){_0x556c1f=![];}_0x333da1[_0x7ebe('0x34')]({[_0x17cea8+_0x7ebe('0x35')]:_0x556c1f});});if(_0x41af9f){_0x333da1[_0x7ebe('0x34')]({'pauseType':_0x41af9f});}}else if(_0x46a808){_0x9ddf6d[_0x7ebe('0x32')](function(_0x4376f7){_0x333da1[_0x7ebe('0x34')]({[_0x4376f7+_0x7ebe('0x35')]:![]});});}_0x17cb47[_0x7ebe('0x36')]=_[_0x7ebe('0x37')](_0x17cb47[_0x7ebe('0x36')],{'$and':_0x333da1});if(_0x208dda[_0x7ebe('0x38')]['role']===_0x7ebe('0x38')){var _0x27d156={'params':{'id':_0x208dda['user'][_0x7ebe('0x39')]},'query':{'section':'Agents','role':_0x7ebe('0x3a'),'online':!![],'raw':!![],'ids':_0x440b75,'customSorting':_0x51c372}};if(_0x232c3d){_0x27d156['query']['extraQueryConditions']=_0x333da1;}_0x27d156[_0x7ebe('0x11')]=Object['assign'](_0x27d156[_0x7ebe('0x11')],_0x208dda['query']);delete _0x27d156[_0x7ebe('0x11')]['id'];return db[_0x7ebe('0x3b')][_0x7ebe('0x3c')](_0x27d156);}return db[_0x7ebe('0x26')][_0x7ebe('0x3d')](_0x17cb47);})[_0x7ebe('0x15')](function(_0x481ad6){_0x165db4[_0x7ebe('0xb')]=_0x481ad6[_0x7ebe('0xb')];_0x4e168f=_0x481ad6['rows'];return _0x4e168f[_0x7ebe('0x25')](function(_0x58fa7f){var _0x515323=_['find'](_0x432ad7,['id',_0x58fa7f['id']]);if(_0x515323){var _0x9fb231=rta['filterAgentAttributes'](_0x515323);_[_0x7ebe('0x37')](_0x58fa7f,_0x9fb231);}_0x58fa7f['globalStatus']=rta['getAgentStatus'](_0x58fa7f);if(_0x58fa7f[_0x7ebe('0x1d')]['includes'](_0x7ebe('0x14'))){_0x9ddf6d[_0x7ebe('0x32')](function(_0x4c8009){if(_0x58fa7f[_0x4c8009+_0x7ebe('0x35')]){_0x58fa7f[_0x4c8009+_0x7ebe('0x3e')]=_0x7ebe('0x14');}});}return _0x58fa7f;});})[_0x7ebe('0x15')](function(_0x1d4bbf){if(!_0x1c6e9a||_0x51c372){return _0x1d4bbf;}return rta['sortAgentsByStatus'](_0x1d4bbf,_0x1c6e9a);})[_0x7ebe('0x15')](function(_0x43c64a){var _0x189c6e=null;if(_0x208dda['query'][_0x7ebe('0x1f')]){var _0x9b7bda=_0x208dda['query'][_0x7ebe('0x1f')]['split'](',');_0x189c6e=_0x43c64a[_0x7ebe('0x25')](function(_0x5f367b){return _[_0x7ebe('0x3f')](_0x5f367b,_0x9b7bda);});}_0x165db4['rows']=_0x189c6e||_0x43c64a;return _0x165db4;})[_0x7ebe('0x15')](respondWithFilteredResult(_0x15438c,_0x17cb47))[_0x7ebe('0x40')](APIHandleError(_0x15438c));};exports['getQueues']=function(_0xb8dbf7,_0x2d6fa8){var _0x2ecf80={'count':0x0,'rows':[]};var _0x59e69d={};var _0x322221;var _0x1b69fa;var _0x4a5e85;Promise[_0x7ebe('0x41')]()['then'](function(){if(_0xb8dbf7['query'][_0x7ebe('0x16')]){if(!utils[_0x7ebe('0x17')](_0xb8dbf7['query'][_0x7ebe('0x16')])){throw new APIBadRequestError(util[_0x7ebe('0x18')](_0x7ebe('0x19'),_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x16')]));}_0x322221=_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x16')][_0x7ebe('0x1a')]();}var _0x14bf4e=_[_0x7ebe('0x42')](_0x322221)+_0x7ebe('0x43');var _0x4e7e1f=_[_0x7ebe('0x25')](db[_0x14bf4e][_0x7ebe('0x27')],function(_0xff1a3a){return{'name':_0xff1a3a['fieldName'],'type':_0xff1a3a[_0x7ebe('0x29')][_0x7ebe('0x2a')]};});if(!_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x1f')]){var _0x402f6d=['id','name'];if(_0x322221==='voice'){_0x402f6d['push']('type');if(_0xb8dbf7['query'][_0x7ebe('0x29')]==='outbound'){_0x402f6d[_0x7ebe('0x34')](['dialActive',_0x7ebe('0x44')]);}}_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x1f')]=_0x402f6d[_0x7ebe('0x45')](',');}_0x59e69d=qs['getOptions'](_0x4e7e1f,_0xb8dbf7);if(_0xb8dbf7[_0x7ebe('0x38')][_0x7ebe('0x2b')]===_0x7ebe('0x38')){var _0x531254={'params':{'id':_0xb8dbf7['user'][_0x7ebe('0x39')]},'query':{'section':_0x322221===_0x7ebe('0x46')&&_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x29')]===_0x7ebe('0x47')?_0x7ebe('0x48'):_[_0x7ebe('0x42')](_0x322221)+_0x7ebe('0x49'),'type':_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x29')],'nolimit':!![],'sort':'name','filter':_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x4a')]}};return db[_0x7ebe('0x3b')][_0x7ebe('0x3c')](_0x531254);}return db[_0x14bf4e]['findAndCountAll'](_0x59e69d);})['then'](function(_0x5f15e1){_0x2ecf80[_0x7ebe('0xb')]=_0x5f15e1[_0x7ebe('0xb')];_0x1b69fa=_0x5f15e1['rows'];return rtq[_0x7ebe('0x4b')](_0xb8dbf7,_0x322221);})[_0x7ebe('0x15')](function(_0x311525){_0x4a5e85=_0x311525[_0x7ebe('0x22')];return rtq[_0x7ebe('0x4c')](_0x1b69fa,_0x4a5e85,_0x322221,_0xb8dbf7[_0x7ebe('0x11')][_0x7ebe('0x29')]);})[_0x7ebe('0x15')](function(_0x390b39){_0x2ecf80[_0x7ebe('0x22')]=_0x390b39;return _0x2ecf80;})[_0x7ebe('0x15')](respondWithFilteredResult(_0x2d6fa8,_0x59e69d))['catch'](APIHandleError(_0x2d6fa8));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7752375..44ff6ba 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 61ef00c..87bfd64 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 _0x99a0=['STRING','sequelize','exports','DATE'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0x99a0,0x121));var _0x099a=function(_0x157fc0,_0xcfef20){_0x157fc0=_0x157fc0-0x0;var _0x4d78f7=_0x99a0[_0x157fc0];return _0x4d78f7;};'use strict';var Sequelize=require(_0x099a('0x0'));module[_0x099a('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x099a('0x2')]},'responsetime':{'type':Sequelize[_0x099a('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x099a('0x3')]},'campaigntype':{'type':Sequelize[_0x099a('0x3')]},'membername':{'type':Sequelize[_0x099a('0x3')]}}; \ No newline at end of file +var _0x5398=['STRING','DATE','exports','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5398,0xe2));var _0x8539=function(_0x2b4f71,_0x5a1fe3){_0x2b4f71=_0x2b4f71-0x0;var _0x40fc89=_0x5398[_0x2b4f71];return _0x40fc89;};'use strict';var Sequelize=require('sequelize');module[_0x8539('0x0')]={'state':{'type':Sequelize[_0x8539('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8539('0x2')]},'scheduledat':{'type':Sequelize[_0x8539('0x3')]},'uniqueid':{'type':Sequelize[_0x8539('0x2')]},'starttime':{'type':Sequelize[_0x8539('0x3')]},'responsetime':{'type':Sequelize[_0x8539('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8539('0x2')]},'membername':{'type':Sequelize[_0x8539('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1326cfa..3a91829 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 _0x5e0d=['ReportAgentPreview','report_agent_preview','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x60dd8d,_0x1e7522){var _0x1a0827=function(_0xc92ed0){while(--_0xc92ed0){_0x60dd8d['push'](_0x60dd8d['shift']());}};_0x1a0827(++_0x1e7522);}(_0x5e0d,0x141));var _0xd5e0=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x5e0d[_0x5d7227];return _0x15ac55;};'use strict';var _=require('lodash');var util=require(_0xd5e0('0x0'));var logger=require('../../config/logger')(_0xd5e0('0x1'));var moment=require('moment');var BPromise=require(_0xd5e0('0x2'));var rp=require(_0xd5e0('0x3'));var fs=require('fs');var path=require(_0xd5e0('0x4'));var rimraf=require(_0xd5e0('0x5'));var config=require(_0xd5e0('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xd5e0('0x7')]=function(_0x5ee0b9,_0x55ded6){return _0x5ee0b9[_0xd5e0('0x8')](_0xd5e0('0x9'),attributes,{'tableName':_0xd5e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e4=['rimraf','./reportAgentPreview.attributes','exports','report_agent_preview','lodash','util','moment','bluebird','request-promise','path'];(function(_0x458c31,_0x5d4ba0){var _0x3937be=function(_0x5539a9){while(--_0x5539a9){_0x458c31['push'](_0x458c31['shift']());}};_0x3937be(++_0x5d4ba0);}(_0x39e4,0x19e));var _0x439e=function(_0x502365,_0x8736e2){_0x502365=_0x502365-0x0;var _0x1f536f=_0x39e4[_0x502365];return _0x1f536f;};'use strict';var _=require(_0x439e('0x0'));var util=require(_0x439e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x439e('0x2'));var BPromise=require(_0x439e('0x3'));var rp=require(_0x439e('0x4'));var fs=require('fs');var path=require(_0x439e('0x5'));var rimraf=require(_0x439e('0x6'));var config=require('../../config/environment');var attributes=require(_0x439e('0x7'));module[_0x439e('0x8')]=function(_0x3bb950,_0x1c8510){return _0x3bb950['define']('ReportAgentPreview',attributes,{'tableName':_0x439e('0x9'),'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 aa6e5bd..c583f1f 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 _0xd5f3=['debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ReportAgentPreview','create','options','CreateReportAgentPreview'];(function(_0xc869e5,_0x348320){var _0x4c7b4b=function(_0x246647){while(--_0x246647){_0xc869e5['push'](_0xc869e5['shift']());}};_0x4c7b4b(++_0x348320);}(_0xd5f3,0xa2));var _0x3d5f=function(_0x1eb7de,_0x45b6f9){_0x1eb7de=_0x1eb7de-0x0;var _0x586ce6=_0xd5f3[_0x1eb7de];return _0x586ce6;};'use strict';var _=require('lodash');var util=require(_0x3d5f('0x0'));var moment=require(_0x3d5f('0x1'));var BPromise=require(_0x3d5f('0x2'));var rs=require(_0x3d5f('0x3'));var fs=require('fs');var Redis=require(_0x3d5f('0x4'));var db=require(_0x3d5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3d5f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e72db,_0x357cd0,_0x5d6948){return new BPromise(function(_0x5750a6,_0x431b7a){return client[_0x3d5f('0x7')](_0x3e72db,_0x5d6948)[_0x3d5f('0x8')](function(_0x3fe936){logger[_0x3d5f('0x9')](_0x3d5f('0xa'),_0x357cd0,_0x3d5f('0xb'));logger['debug'](_0x3d5f('0xc'),_0x357cd0,'request\x20sent',JSON[_0x3d5f('0xd')](_0x3fe936));if(_0x3fe936[_0x3d5f('0xe')]){if(_0x3fe936[_0x3d5f('0xe')][_0x3d5f('0xf')]===0x1f4){logger[_0x3d5f('0xe')](_0x3d5f('0xa'),_0x357cd0,_0x3fe936['error'][_0x3d5f('0x10')]);return _0x431b7a(_0x3fe936[_0x3d5f('0xe')][_0x3d5f('0x10')]);}logger[_0x3d5f('0xe')](_0x3d5f('0xa'),_0x357cd0,_0x3fe936[_0x3d5f('0xe')][_0x3d5f('0x10')]);return _0x5750a6(_0x3fe936['error'][_0x3d5f('0x10')]);}else{logger[_0x3d5f('0x9')](_0x3d5f('0xa'),_0x357cd0,_0x3d5f('0xb'));_0x5750a6(_0x3fe936['result'][_0x3d5f('0x10')]);}})[_0x3d5f('0x11')](function(_0x3f1d87){logger[_0x3d5f('0xe')](_0x3d5f('0xa'),_0x357cd0,_0x3f1d87);_0x431b7a(_0x3f1d87);});});}exports['CreateReportAgentPreview']=function(_0x1d2260){var _0x61a178=this;return new Promise(function(_0x428fac,_0x27873a){return db[_0x3d5f('0x12')][_0x3d5f('0x13')](_0x1d2260['body'],{'raw':_0x1d2260[_0x3d5f('0x14')]?_0x1d2260['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x486427){logger[_0x3d5f('0x9')](_0x3d5f('0x15'),_0x1d2260);logger[_0x3d5f('0x16')]('CreateReportAgentPreview',_0x1d2260,JSON[_0x3d5f('0xd')](_0x486427));_0x428fac(_0x486427);})[_0x3d5f('0x11')](function(_0x195db8){logger[_0x3d5f('0xe')](_0x3d5f('0x15'),_0x195db8[_0x3d5f('0x10')],_0x1d2260);_0x27873a(_0x61a178['error'](0x1f4,_0x195db8[_0x3d5f('0x10')]));});});}; \ No newline at end of file +var _0x06fc=['options','CreateReportAgentPreview','debug','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','create'];(function(_0x520820,_0x38cbec){var _0x28b01d=function(_0x71c8bc){while(--_0x71c8bc){_0x520820['push'](_0x520820['shift']());}};_0x28b01d(++_0x38cbec);}(_0x06fc,0x14d));var _0xc06f=function(_0x2a7996,_0x135a9e){_0x2a7996=_0x2a7996-0x0;var _0xe8b2c9=_0x06fc[_0x2a7996];return _0xe8b2c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc06f('0x0'));var BPromise=require('bluebird');var rs=require(_0xc06f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc06f('0x2'))['db'];var utils=require(_0xc06f('0x3'));var logger=require(_0xc06f('0x4'))(_0xc06f('0x5'));var config=require('../../config/environment');var jayson=require(_0xc06f('0x6'));var client=jayson[_0xc06f('0x7')][_0xc06f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20eb4b,_0x460d86,_0x436ee0){return new BPromise(function(_0x38dbba,_0x35f59d){return client['request'](_0x20eb4b,_0x436ee0)[_0xc06f('0x9')](function(_0x540ff3){logger[_0xc06f('0xa')](_0xc06f('0xb'),_0x460d86,_0xc06f('0xc'));logger['debug'](_0xc06f('0xd'),_0x460d86,_0xc06f('0xc'),JSON[_0xc06f('0xe')](_0x540ff3));if(_0x540ff3['error']){if(_0x540ff3[_0xc06f('0xf')]['code']===0x1f4){logger['error'](_0xc06f('0xb'),_0x460d86,_0x540ff3[_0xc06f('0xf')][_0xc06f('0x10')]);return _0x35f59d(_0x540ff3[_0xc06f('0xf')][_0xc06f('0x10')]);}logger[_0xc06f('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x460d86,_0x540ff3[_0xc06f('0xf')][_0xc06f('0x10')]);return _0x38dbba(_0x540ff3[_0xc06f('0xf')][_0xc06f('0x10')]);}else{logger[_0xc06f('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x460d86,_0xc06f('0xc'));_0x38dbba(_0x540ff3['result'][_0xc06f('0x10')]);}})[_0xc06f('0x11')](function(_0x2dc338){logger[_0xc06f('0xf')](_0xc06f('0xb'),_0x460d86,_0x2dc338);_0x35f59d(_0x2dc338);});});}exports['CreateReportAgentPreview']=function(_0x2cead8){var _0x4f81dd=this;return new Promise(function(_0x231234,_0x344afe){return db['ReportAgentPreview'][_0xc06f('0x12')](_0x2cead8['body'],{'raw':_0x2cead8[_0xc06f('0x13')]?_0x2cead8[_0xc06f('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xc06f('0x9')](function(_0x2df054){logger[_0xc06f('0xa')](_0xc06f('0x14'),_0x2cead8);logger[_0xc06f('0x15')](_0xc06f('0x14'),_0x2cead8,JSON[_0xc06f('0xe')](_0x2df054));_0x231234(_0x2df054);})[_0xc06f('0x11')](function(_0x207e61){logger[_0xc06f('0xf')](_0xc06f('0x14'),_0x207e61[_0xc06f('0x10')],_0x2cead8);_0x344afe(_0x4f81dd[_0xc06f('0xf')](0x1f4,_0x207e61[_0xc06f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 312611d..db241ba 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 _0xfca9=['util','path','express','Router','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports'];(function(_0x42fc5f,_0x32964e){var _0x2b6486=function(_0x20744b){while(--_0x20744b){_0x42fc5f['push'](_0x42fc5f['shift']());}};_0x2b6486(++_0x32964e);}(_0xfca9,0x140));var _0x9fca=function(_0x3eda55,_0x3cd55c){_0x3eda55=_0x3eda55-0x0;var _0x5baf92=_0xfca9[_0x3eda55];return _0x5baf92;};'use strict';var multer=require('multer');var util=require(_0x9fca('0x0'));var path=require(_0x9fca('0x1'));var express=require(_0x9fca('0x2'));var router=express[_0x9fca('0x3')]();var auth=require(_0x9fca('0x4'));var controller=require('./rpc.controller');router[_0x9fca('0x5')]('/voice/channels',auth[_0x9fca('0x6')](),controller[_0x9fca('0x7')]);router['get'](_0x9fca('0x8'),auth[_0x9fca('0x6')](),controller['voiceChannelMixMonitor']);router[_0x9fca('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x9fca('0x6')](),controller[_0x9fca('0x9')]);router[_0x9fca('0x5')]('/voice/queues',auth[_0x9fca('0x6')](),controller[_0x9fca('0xa')]);router[_0x9fca('0x5')](_0x9fca('0xb'),auth[_0x9fca('0x6')](),controller[_0x9fca('0xc')]);router[_0x9fca('0x5')](_0x9fca('0xd'),auth[_0x9fca('0x6')](),controller[_0x9fca('0xe')]);router[_0x9fca('0x5')](_0x9fca('0xf'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x10')]);router['get']('/openchannel/queues',auth[_0x9fca('0x6')](),controller['openchannelQueues']);router[_0x9fca('0x5')](_0x9fca('0x11'),auth[_0x9fca('0x6')](),controller['smsQueues']);router[_0x9fca('0x5')](_0x9fca('0x12'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x13')]);router[_0x9fca('0x5')](_0x9fca('0x14'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x15')]);router[_0x9fca('0x5')](_0x9fca('0x16'),auth['isAuthenticated'](),controller[_0x9fca('0x17')]);router[_0x9fca('0x5')](_0x9fca('0x18'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x19')]);router[_0x9fca('0x5')](_0x9fca('0x1a'),auth['isAuthenticated'](),controller[_0x9fca('0x1b')]);router[_0x9fca('0x5')](_0x9fca('0x1c'),auth[_0x9fca('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x9fca('0x5')](_0x9fca('0x1d'),auth['isAuthenticated'](),controller[_0x9fca('0x1e')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x9fca('0x1f')]);router['put'](_0x9fca('0x20'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x21')]);router[_0x9fca('0x5')](_0x9fca('0x22'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x23')]);router[_0x9fca('0x5')](_0x9fca('0x24'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x25')]);router[_0x9fca('0x5')](_0x9fca('0x26'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x27')]);router[_0x9fca('0x28')](_0x9fca('0x29'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x2a')]);router[_0x9fca('0x5')](_0x9fca('0x2b'),auth[_0x9fca('0x6')](),controller['telephones']);router[_0x9fca('0x5')](_0x9fca('0x2c'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x2d')]);router[_0x9fca('0x5')]('/campaigns',auth[_0x9fca('0x6')](),controller[_0x9fca('0x2e')]);router[_0x9fca('0x5')](_0x9fca('0x2f'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x30')]);router[_0x9fca('0x5')](_0x9fca('0x31'),auth[_0x9fca('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x9fca('0x5')]('/mail/queues/waitinginteractions',auth[_0x9fca('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x9fca('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x9fca('0x6')](),controller[_0x9fca('0x32')]);router[_0x9fca('0x5')](_0x9fca('0x33'),auth[_0x9fca('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x9fca('0x34'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x35')]);router[_0x9fca('0x5')](_0x9fca('0x36'),auth[_0x9fca('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x9fca('0x5')](_0x9fca('0x37'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x38')]);router[_0x9fca('0x39')](_0x9fca('0x3a'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x3b')](_0x9fca('0x3c')));router[_0x9fca('0x5')](_0x9fca('0x3d'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x3e')]);router[_0x9fca('0x39')](_0x9fca('0x3f'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x3b')](_0x9fca('0x40')));router[_0x9fca('0x5')]('/chat/queues/:id',auth[_0x9fca('0x6')](),controller[_0x9fca('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0x9fca('0x6')](),controller['queueNotify'](_0x9fca('0x42')));router[_0x9fca('0x5')](_0x9fca('0x43'),auth['isAuthenticated'](),controller[_0x9fca('0x44')]);router[_0x9fca('0x39')](_0x9fca('0x45'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x3b')](_0x9fca('0x46')));router[_0x9fca('0x5')]('/openchannel/queues/:id',auth[_0x9fca('0x6')](),controller['showOpenchannelQueues']);router[_0x9fca('0x39')](_0x9fca('0x47'),auth[_0x9fca('0x6')](),controller['queueNotify'](_0x9fca('0x48')));router[_0x9fca('0x39')](_0x9fca('0x49'),auth['isAuthenticated'](),controller[_0x9fca('0x3b')](_0x9fca('0x4a')));router[_0x9fca('0x5')]('/sms/queues/:id',auth[_0x9fca('0x6')](),controller[_0x9fca('0x4b')]);router[_0x9fca('0x5')](_0x9fca('0x4c'),auth[_0x9fca('0x6')](),controller[_0x9fca('0x4d')]);router['post']('/agents/:id/notify',auth[_0x9fca('0x6')](),controller[_0x9fca('0x4e')]);module[_0x9fca('0x4f')]=router; \ No newline at end of file +var _0x9771=['whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues'];(function(_0x5b333b,_0x4d1f41){var _0x2f81db=function(_0x30c121){while(--_0x30c121){_0x5b333b['push'](_0x5b333b['shift']());}};_0x2f81db(++_0x4d1f41);}(_0x9771,0x135));var _0x1977=function(_0x1f6ce6,_0x286fd4){_0x1f6ce6=_0x1f6ce6-0x0;var _0x2749f0=_0x9771[_0x1f6ce6];return _0x2749f0;};'use strict';var multer=require(_0x1977('0x0'));var util=require(_0x1977('0x1'));var path=require(_0x1977('0x2'));var express=require(_0x1977('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1977('0x4'));router[_0x1977('0x5')](_0x1977('0x6'),auth[_0x1977('0x7')](),controller[_0x1977('0x8')]);router['get'](_0x1977('0x9'),auth[_0x1977('0x7')](),controller[_0x1977('0xa')]);router[_0x1977('0x5')](_0x1977('0xb'),auth[_0x1977('0x7')](),controller[_0x1977('0xc')]);router[_0x1977('0x5')](_0x1977('0xd'),auth['isAuthenticated'](),controller[_0x1977('0xe')]);router[_0x1977('0x5')](_0x1977('0xf'),auth[_0x1977('0x7')](),controller[_0x1977('0x10')]);router[_0x1977('0x5')]('/mail/queues',auth[_0x1977('0x7')](),controller['mailQueues']);router[_0x1977('0x5')](_0x1977('0x11'),auth[_0x1977('0x7')](),controller[_0x1977('0x12')]);router[_0x1977('0x5')](_0x1977('0x13'),auth[_0x1977('0x7')](),controller['openchannelQueues']);router[_0x1977('0x5')](_0x1977('0x14'),auth[_0x1977('0x7')](),controller[_0x1977('0x15')]);router[_0x1977('0x5')](_0x1977('0x16'),auth[_0x1977('0x7')](),controller[_0x1977('0x17')]);router[_0x1977('0x5')](_0x1977('0x18'),auth[_0x1977('0x7')](),controller[_0x1977('0x19')]);router[_0x1977('0x5')](_0x1977('0x1a'),auth['isAuthenticated'](),controller[_0x1977('0x1b')]);router[_0x1977('0x5')](_0x1977('0x1c'),auth[_0x1977('0x7')](),controller[_0x1977('0x1d')]);router[_0x1977('0x5')](_0x1977('0x1e'),auth[_0x1977('0x7')](),controller[_0x1977('0x1f')]);router['get'](_0x1977('0x20'),auth[_0x1977('0x7')](),controller[_0x1977('0x21')]);router['get'](_0x1977('0x22'),auth['isAuthenticated'](),controller[_0x1977('0x23')]);router[_0x1977('0x5')](_0x1977('0x24'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x1977('0x25')](_0x1977('0x24'),auth[_0x1977('0x7')](),controller['updateVoiceQueue']);router[_0x1977('0x5')](_0x1977('0x26'),auth['isAuthenticated'](),controller[_0x1977('0x27')]);router['get'](_0x1977('0x28'),auth[_0x1977('0x7')](),controller[_0x1977('0x29')]);router[_0x1977('0x5')]('/agents',auth[_0x1977('0x7')](),controller[_0x1977('0x2a')]);router[_0x1977('0x25')](_0x1977('0x2b'),auth[_0x1977('0x7')](),controller[_0x1977('0x2c')]);router[_0x1977('0x5')](_0x1977('0x2d'),auth[_0x1977('0x7')](),controller[_0x1977('0x2e')]);router[_0x1977('0x5')]('/trunks',auth[_0x1977('0x7')](),controller[_0x1977('0x2f')]);router[_0x1977('0x5')](_0x1977('0x30'),auth[_0x1977('0x7')](),controller['campaigns']);router[_0x1977('0x5')](_0x1977('0x31'),auth[_0x1977('0x7')](),controller[_0x1977('0x32')]);router['get'](_0x1977('0x33'),auth[_0x1977('0x7')](),controller[_0x1977('0x34')]);router[_0x1977('0x5')]('/mail/queues/waitinginteractions',auth[_0x1977('0x7')](),controller[_0x1977('0x35')]);router['get'](_0x1977('0x36'),auth[_0x1977('0x7')](),controller[_0x1977('0x37')]);router[_0x1977('0x5')](_0x1977('0x38'),auth[_0x1977('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x1977('0x5')]('/sms/queues/waitinginteractions',auth[_0x1977('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0x1977('0x5')](_0x1977('0x39'),auth[_0x1977('0x7')](),controller[_0x1977('0x3a')]);router[_0x1977('0x5')](_0x1977('0x3b'),auth[_0x1977('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x1977('0x3c'),auth[_0x1977('0x7')](),controller[_0x1977('0x3d')](_0x1977('0x3e')));router[_0x1977('0x5')](_0x1977('0x3f'),auth[_0x1977('0x7')](),controller[_0x1977('0x40')]);router['post'](_0x1977('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0x1977('0x42')));router[_0x1977('0x5')](_0x1977('0x43'),auth[_0x1977('0x7')](),controller[_0x1977('0x44')]);router[_0x1977('0x45')]('/fax/queues/:id/notify',auth[_0x1977('0x7')](),controller['queueNotify']('fax'));router[_0x1977('0x5')](_0x1977('0x46'),auth[_0x1977('0x7')](),controller[_0x1977('0x47')]);router[_0x1977('0x45')](_0x1977('0x48'),auth['isAuthenticated'](),controller[_0x1977('0x3d')](_0x1977('0x49')));router['get'](_0x1977('0x4a'),auth[_0x1977('0x7')](),controller[_0x1977('0x4b')]);router[_0x1977('0x45')](_0x1977('0x4c'),auth[_0x1977('0x7')](),controller[_0x1977('0x3d')]('sms'));router[_0x1977('0x45')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1977('0x3d')]('whatsapp'));router[_0x1977('0x5')](_0x1977('0x4d'),auth[_0x1977('0x7')](),controller[_0x1977('0x4e')]);router[_0x1977('0x5')](_0x1977('0x4f'),auth['isAuthenticated'](),controller[_0x1977('0x50')]);router[_0x1977('0x45')]('/agents/:id/notify',auth[_0x1977('0x7')](),controller[_0x1977('0x51')]);module[_0x1977('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c0879c4..001ba12 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 _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0x482e6a,_0x7f7a4a){var _0x12f8b2=function(_0x48fd8c){while(--_0x48fd8c){_0x482e6a['push'](_0x482e6a['shift']());}};_0x12f8b2(++_0x7f7a4a);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file +var _0xac9d=['SIP/%s','INTERACTION','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','findOrCreate','interface','format'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xac9d,0x14d));var _0xdac9=function(_0x38deb6,_0x587445){_0x38deb6=_0x38deb6-0x0;var _0x3cf12e=_0xac9d[_0x38deb6];return _0x3cf12e;};'use strict';var BPromise=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var _=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var db=require(_0xdac9('0x4'))['db'];var logger=require(_0xdac9('0x5'))(_0xdac9('0x6'));var jayson=require(_0xdac9('0x7'));var amiClient=jayson['client'][_0xdac9('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xdac9('0x8')]({'port':0x232b});var routingClient=jayson[_0xdac9('0x9')][_0xdac9('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){var _0x47d9fd=_0x39f560?_0x39f560:amiClient;return _0x47d9fd[_0xdac9('0xa')](_0x776b6c,_0x1c78c5)[_0xdac9('0xb')](function(_0x39c92c){if(_0x39c92c[_0xdac9('0xc')]){if(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xd')]===0x1f4){return _0x2b1d6f(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xe')]);}return _0x5531af(_0x39c92c[_0xdac9('0xc')]['message']);}else{_0x5531af(_0x39c92c[_0xdac9('0xf')]);}})[_0xdac9('0x10')](function(_0x5a9bde){_0x2b1d6f(_0x5a9bde);});});}function respondWithResult(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xc8;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['status'](_0xeddbc1)[_0xdac9('0x11')](_0xbfe6d8);}return _0x3d8e97[_0xdac9('0x12')](0x194);};}function handleError(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0x1f4;return function(_0x5dd536){logger[_0xdac9('0xc')](_0x5dd536[_0xdac9('0x13')]);if(_0x5dd536['name']){delete _0x5dd536[_0xdac9('0x14')];}_0x9e1bf6[_0xdac9('0x15')](_0x5f0bbd)[_0xdac9('0x16')](_0x5dd536);};}function findById(_0x5b2f1b){return function(_0x2221f8){if(!_[_0xdac9('0x17')](_0x5b2f1b)&&!_[_0xdac9('0x17')](_0x2221f8)&&!_[_0xdac9('0x17')](_0x2221f8['rows'])){return _[_0xdac9('0x18')](_0x2221f8[_0xdac9('0x19')],function(_0x571e07){return _0x571e07['id']==_0x5b2f1b;});}return null;};}exports[_0xdac9('0x1a')]=function(_0xa57f2d,_0x171df1){return respondWithRpcPromise(_0xdac9('0x1b'),_0xa57f2d['query'])['then'](respondWithResult(_0x171df1,null))[_0xdac9('0x10')](handleError(_0x171df1,null));};exports[_0xdac9('0x1c')]=function(_0x2b9d91,_0x395ec7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xdac9('0x1d')](_0x2b9d91[_0xdac9('0x1e')],_0x2b9d91[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x395ec7,null))[_0xdac9('0x10')](handleError(_0x395ec7,null));};exports[_0xdac9('0x20')]=function(_0x41335a,_0xa1f726){return respondWithRpcPromise(_0xdac9('0x21'),_[_0xdac9('0x1d')](_0x41335a['query'],_0x41335a[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0xa1f726,null))[_0xdac9('0x10')](handleError(_0xa1f726,null));};exports[_0xdac9('0x22')]=function(_0x5ca076,_0x1e631a){return respondWithRpcPromise('VoiceQueues',_0x5ca076[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x1e631a,null))['catch'](handleError(_0x1e631a,null));};exports[_0xdac9('0x23')]=function(_0x5105f1,_0x450f91){return respondWithRpcPromise(_0xdac9('0x24'),_0x5105f1[_0xdac9('0x1e')])[_0xdac9('0xb')](findById(_0x5105f1['params']['id']))['then'](respondWithResult(_0x450f91,null))[_0xdac9('0x10')](handleError(_0x450f91,null));};exports[_0xdac9('0x25')]=function(_0x4fe3bd,_0x4c4e21){return respondWithRpcPromise(_0xdac9('0x26'),_[_0xdac9('0x1d')](_0x4fe3bd[_0xdac9('0x27')],_0x4fe3bd[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x4c4e21,null))[_0xdac9('0x10')](handleError(_0x4c4e21,null));};exports[_0xdac9('0x28')]=function(_0x2cda4d,_0x406ed0){return respondWithRpcPromise(_0xdac9('0x29'),_[_0xdac9('0x1d')](_0x2cda4d[_0xdac9('0x1e')],_0x2cda4d[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x406ed0,null))[_0xdac9('0x10')](handleError(_0x406ed0,null));};exports[_0xdac9('0x2a')]=function(_0x372f02,_0x44eff2){return respondWithRpcPromise(_0xdac9('0x2b'),_0x372f02[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x44eff2,null))['catch'](handleError(_0x44eff2,null));};exports['voiceQueuesChannel']=function(_0x1e6832,_0x416501){return respondWithRpcPromise(_0xdac9('0x2c'),_[_0xdac9('0x1d')](_0x1e6832[_0xdac9('0x1e')],_0x1e6832['params']))[_0xdac9('0xb')](respondWithResult(_0x416501,null))['catch'](handleError(_0x416501,null));};exports[_0xdac9('0x2d')]=function(_0x2a611e,_0x5cfebf){return respondWithRpcPromise(_0xdac9('0x2e'),_['merge'](_0x2a611e['query'],_0x2a611e[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x5cfebf,null))[_0xdac9('0x10')](handleError(_0x5cfebf,null));};exports[_0xdac9('0x2f')]=function(_0x3bab10,_0x363d93){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xdac9('0x1d')](_0x3bab10[_0xdac9('0x1e')],_0x3bab10['params']))[_0xdac9('0xb')](respondWithResult(_0x363d93,null))[_0xdac9('0x10')](handleError(_0x363d93,null));};exports[_0xdac9('0x30')]=function(_0x27bdfb,_0x35aa58){return respondWithRpcPromise(_0xdac9('0x31'),_0x27bdfb[_0xdac9('0x1e')])['then'](respondWithResult(_0x35aa58,null))[_0xdac9('0x10')](handleError(_0x35aa58,null));};exports[_0xdac9('0x32')]=function(_0x238769,_0x4b6b09){return respondWithRpcPromise(_0xdac9('0x33'),_0x238769[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4b6b09,null))[_0xdac9('0x10')](handleError(_0x4b6b09,null));};exports['agents']=function(_0x58fd14,_0x1d0243){var _0xe47a3c;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14[_0xdac9('0x1e')])[_0xdac9('0xb')](function(_0x579581){_0xe47a3c=_0x579581;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14['query'],routingClient);})[_0xdac9('0xb')](function(_0xaca43c){return _[_0xdac9('0x1d')]({},_0xaca43c,_0xe47a3c);})[_0xdac9('0xb')](respondWithResult(_0x1d0243,null))[_0xdac9('0x10')](handleError(_0x1d0243,null));};exports[_0xdac9('0x35')]=function(_0x413fb1,_0xb176e0){if(_0x413fb1[_0xdac9('0x27')]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]&&_0x413fb1[_0xdac9('0x37')]&&_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]){for(var _0x5335ae in _0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]){if(_0x413fb1['body'][_0xdac9('0x36')][_0xdac9('0x38')](_0x5335ae)){db[_0xdac9('0x39')][_0xdac9('0x3a')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')]?{'$notIn':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]}:{'$ne':null}}})['then'](function(_0x585f08){var _0xcb7b82=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4159fd=0x0,_0x15c332=_0x585f08['length'];_0x4159fd<_0x15c332;_0x4159fd+=0x1){_0x585f08[_0x4159fd]['updateAttributes']({'exitAt':_0xcb7b82});}});for(var _0x1666c5=0x0;_0x1666c5<_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')];_0x1666c5+=0x1){db[_0xdac9('0x39')][_0xdac9('0x3c')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','uniqueid':_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0x1666c5],'exitAt':null},'defaults':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'interface':_[_0xdac9('0x17')](_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')])?util[_0xdac9('0x3e')](_0xdac9('0x3f'),_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]):_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')],'type':_0xdac9('0x40'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x41')],'uniqueid':_0x413fb1['body'][_0xdac9('0x36')][_0x5335ae][_0x1666c5]}});}}}}return respondWithRpcPromise(_0xdac9('0x42'),{'id':_0x413fb1[_0xdac9('0x1f')]['id'],'capacity':_0x413fb1['body'][_0xdac9('0x43')]},routingClient)[_0xdac9('0xb')](respondWithResult(_0xb176e0,null))['catch'](handleError(_0xb176e0,null));};exports['telephones']=function(_0x46f1c0,_0x4469d8){return respondWithRpcPromise(_0xdac9('0x44'),_0x46f1c0[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4469d8,null))[_0xdac9('0x10')](handleError(_0x4469d8,null));};exports[_0xdac9('0x45')]=function(_0x3a77e3,_0x298c72){return respondWithRpcPromise(_0xdac9('0x46'),_0x3a77e3[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x298c72,null))[_0xdac9('0x10')](handleError(_0x298c72,null));};exports[_0xdac9('0x47')]=function(_0x35a378,_0x5d0b43){return respondWithRpcPromise(_0xdac9('0x48'),_0x35a378[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x5d0b43,null))[_0xdac9('0x10')](handleError(_0x5d0b43,null));};exports[_0xdac9('0x49')]=function(_0x3a391a,_0x4b118e){return respondWithRpcPromise(_0xdac9('0x4a'),_0x3a391a[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x4b118e,null))[_0xdac9('0x10')](handleError(_0x4b118e,null));};exports[_0xdac9('0x4b')]=function(_0x2a5bf9,_0x1eec39){return respondWithRpcPromise(_0xdac9('0x4a'),_0x2a5bf9[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2a5bf9[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x1eec39,null))[_0xdac9('0x10')](handleError(_0x1eec39,null));};exports[_0xdac9('0x4c')]=function(_0x2ca15d,_0x21ab3d){return respondWithRpcPromise('MailQueues',_0x2ca15d['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x21ab3d,null))[_0xdac9('0x10')](handleError(_0x21ab3d,null));};exports[_0xdac9('0x4d')]=function(_0x46017d,_0x1c1f5f){return respondWithRpcPromise(_0xdac9('0x4e'),_0x46017d['query'],routingClient)['then'](findById(_0x46017d['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x1c1f5f,null))[_0xdac9('0x10')](handleError(_0x1c1f5f,null));};exports[_0xdac9('0x4f')]=function(_0x2f581b,_0x52ad7b){return respondWithRpcPromise(_0xdac9('0x50'),_0x2f581b[_0xdac9('0x1e')],mailClient)[_0xdac9('0xb')](respondWithResult(_0x52ad7b,null))[_0xdac9('0x10')](handleError(_0x52ad7b,null));};exports[_0xdac9('0x51')]=function(_0x496d9c,_0x19a46e){return respondWithRpcPromise('OpenchannelQueues',_0x496d9c[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x19a46e,null))[_0xdac9('0x10')](handleError(_0x19a46e,null));};exports[_0xdac9('0x52')]=function(_0x2fd7c8,_0x360499){return respondWithRpcPromise(_0xdac9('0x53'),_0x2fd7c8[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x2fd7c8['params']['id']))['then'](respondWithResult(_0x360499,null))['catch'](handleError(_0x360499,null));};exports[_0xdac9('0x54')]=function(_0x42ba53,_0x830d54){return respondWithRpcPromise(_0xdac9('0x55'),_0x42ba53[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x830d54,null))[_0xdac9('0x10')](handleError(_0x830d54,null));};exports['showSmsQueues']=function(_0x2d81fc,_0x5b63d8){return respondWithRpcPromise('SmsQueues',_0x2d81fc[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2d81fc['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x5b63d8,null))[_0xdac9('0x10')](handleError(_0x5b63d8,null));};exports[_0xdac9('0x56')]=function(_0x55ce14,_0x552cac){return respondWithRpcPromise(_0xdac9('0x57'),_0x55ce14[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x552cac,null))[_0xdac9('0x10')](handleError(_0x552cac,null));};exports[_0xdac9('0x58')]=function(_0x26b9b5,_0x272f14){return respondWithRpcPromise(_0xdac9('0x57'),_0x26b9b5[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x26b9b5[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x272f14,null))[_0xdac9('0x10')](handleError(_0x272f14,null));};exports[_0xdac9('0x59')]=function(_0x1e2e7b,_0x5401e6){return respondWithRpcPromise(_0xdac9('0x5a'),_0x1e2e7b['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x5401e6,null))[_0xdac9('0x10')](handleError(_0x5401e6,null));};exports['showFaxQueues']=function(_0x3a6c78,_0x3bee81){return respondWithRpcPromise(_0xdac9('0x5a'),_0x3a6c78[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x3a6c78[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x3bee81,null))[_0xdac9('0x10')](handleError(_0x3bee81,null));};exports[_0xdac9('0x5b')]=function(_0x45f183,_0x263b84){return respondWithRpcPromise(_0xdac9('0x5c'),_0x45f183[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x263b84,null))[_0xdac9('0x10')](handleError(_0x263b84,null));};exports[_0xdac9('0x5d')]=function(_0x4c4a7b,_0x3a457b){return respondWithRpcPromise(_0xdac9('0x5e'),_0x4c4a7b[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x3a457b,null))['catch'](handleError(_0x3a457b,null));};exports[_0xdac9('0x5f')]=function(_0x31f56e,_0x1b6a68){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x31f56e[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x1b6a68,null))['catch'](handleError(_0x1b6a68,null));};exports[_0xdac9('0x60')]=function(_0x1b8ad9,_0x2a4d12){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1b8ad9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x2a4d12,null))[_0xdac9('0x10')](handleError(_0x2a4d12,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5c39e9,_0x108e03){return respondWithRpcPromise(_0xdac9('0x61'),_0x5c39e9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](function(_0x4110da){if(_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')]!==undefined){var _0x2de535=_(_0x4110da[_0xdac9('0x19')])[_0xdac9('0x63')]([_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')],_0x5c39e9[_0xdac9('0x1f')]['id']])['map']('queue_id')[_0xdac9('0x64')]()['value']();return _0x4110da['rows'][_0xdac9('0x63')](function(_0x199518){return _0x2de535[_0xdac9('0x65')](_0x199518[_0xdac9('0x66')])>-0x1;});}else{return _0x4110da['rows'][_0xdac9('0x63')](function(_0xff5be){return _0xff5be[_0xdac9('0x66')]===parseInt(_0x5c39e9['params']['id']);});}})[_0xdac9('0xb')](respondWithResult(_0x108e03,null))[_0xdac9('0x10')](handleError(_0x108e03,null));};exports['smsQueuesWaitingInteractions']=function(_0x3cc0f9,_0x59b5b2){return respondWithRpcPromise(_0xdac9('0x67'),_0x3cc0f9['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x59b5b2,null))[_0xdac9('0x10')](handleError(_0x59b5b2,null));};exports[_0xdac9('0x68')]=function(_0x251011,_0x9981f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x251011[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x9981f,null))[_0xdac9('0x10')](handleError(_0x9981f,null));};exports[_0xdac9('0x69')]=function(_0x13be64,_0x227857){return respondWithRpcPromise(_0xdac9('0x6a'),_0x13be64[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x227857,null))['catch'](handleError(_0x227857,null));};exports[_0xdac9('0x6b')]=function(_0x300738){return function(_0x12c15b,_0x4f7f63){var _0x571130,_0x5650d1;var _0x5adc83=_['capitalize'](_0x300738);var _0x325407=_0x300738===_0xdac9('0x6c')?_0xdac9('0x6d'):_0xdac9('0x6e');return db[_0x5adc83+'Queue'][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x12c15b['params']['id']}})[_0xdac9('0xb')](function(_0x750de7){if(_[_0xdac9('0x17')](_0x750de7)){throw new Error(_0x5adc83+_0xdac9('0x70'));}_0x571130=_0x750de7;return db[_0x5adc83+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x12c15b[_0xdac9('0x27')][_0xdac9('0x71')]},'include':[{'model':db[_0x5adc83+_0xdac9('0x72')],'as':'Interaction'},{'model':db[_0x5adc83+_0x325407],'as':'Account'}]});})[_0xdac9('0xb')](function(_0x414f8a){if(_[_0xdac9('0x17')](_0x414f8a)){throw new Error(_0x5adc83+'\x20Message\x20not\x20found');}_0x5650d1=_0x414f8a;return _0x414f8a['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x111bff={'uniqueid':_0x300738+'.'+_0x5650d1['id']+'.'+_0x5650d1[_0xdac9('0x72')]['id'],'FromUserId':_0x12c15b[_0xdac9('0x37')]['id'],'type':_0xdac9('0x73')};_0x111bff[_0x5adc83+_0xdac9('0x74')]=_0x5650d1['id'];_0x111bff[_0x5adc83+_0xdac9('0x75')]=_0x5650d1[_0xdac9('0x72')]['id'];_0x111bff[_0xdac9('0x76')+_0x5adc83+_0x325407+'Id']=_0x5650d1[_0xdac9('0x6e')]['id'];_0x111bff['To'+_0x5adc83+_0xdac9('0x77')]=_0x571130['id'];return db[_0x5adc83+_0xdac9('0x78')][_0xdac9('0x79')](_0x111bff);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x300738,'interaction':_0x5650d1[_0xdac9('0x72')],'message':_0x5650d1,'account':_0x5650d1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdac9('0x73'),'appdata':_0x571130['name']+','+(_0x5650d1[_0xdac9('0x6e')][_0xdac9('0x7b')]||0x12c),'interval':_0xdac9('0x7c')}]},routingClient);})[_0xdac9('0xb')](respondWithResult(_0x4f7f63,null))[_0xdac9('0x10')](handleError(_0x4f7f63,null));};};exports[_0xdac9('0x7d')]=function(_0x232876,_0x4463ca){var _0x171d38,_0x328fa2;if(_[_0xdac9('0x17')](_0x232876['body'][_0xdac9('0x7e')])){throw new Error(_0xdac9('0x7f'));}var _0x284247=_0x232876[_0xdac9('0x27')][_0xdac9('0x7e')];var _0x4d7208=_['capitalize'](_0x284247);var _0x363541=_0x284247==='chat'?'Website':_0xdac9('0x6e');return db[_0xdac9('0x80')][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x232876[_0xdac9('0x1f')]['id'],'role':'agent'}})[_0xdac9('0xb')](function(_0x8f37df){if(_[_0xdac9('0x17')](_0x8f37df)){throw new Error('Agent\x20not\x20found');}_0x171d38=_0x8f37df;return db[_0x4d7208+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x232876[_0xdac9('0x27')]['messageId']},'include':[{'model':db[_0x4d7208+'Interaction'],'as':'Interaction'},{'model':db[_0x4d7208+_0x363541],'as':_0xdac9('0x6e')}]});})[_0xdac9('0xb')](function(_0x131c78){if(_['isNil'](_0x131c78)){throw new Error(_0x4d7208+_0xdac9('0x81'));}_0x328fa2=_0x131c78;return _0x131c78[_0xdac9('0x82')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x2ab89f={'uniqueid':_0x284247+'.'+_0x328fa2['id']+'.'+_0x328fa2[_0xdac9('0x72')]['id'],'FromUserId':_0x232876['user']['id'],'type':_0xdac9('0x73'),'ToUserId':_0x171d38['id']};_0x2ab89f[_0x4d7208+_0xdac9('0x74')]=_0x328fa2['id'];_0x2ab89f[_0x4d7208+'InteractionId']=_0x328fa2[_0xdac9('0x72')]['id'];_0x2ab89f[_0xdac9('0x76')+_0x4d7208+_0x363541+'Id']=_0x328fa2[_0xdac9('0x6e')]['id'];return db[_0x4d7208+_0xdac9('0x78')]['create'](_0x2ab89f);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x284247,'interaction':_0x328fa2[_0xdac9('0x72')],'message':_0x328fa2,'account':_0x328fa2['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x171d38[_0xdac9('0x14')]+','+(_0x328fa2['Account'][_0xdac9('0x83')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x4463ca,null))[_0xdac9('0x10')](handleError(_0x4463ca,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b77e5e4..1a94c9e 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 _0xaf0c=['post','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xaf0c,0x100));var _0xcaf0=function(_0xc0be57,_0x2d1e96){_0xc0be57=_0xc0be57-0x0;var _0x2d786d=_0xaf0c[_0xc0be57];return _0x2d786d;};'use strict';var multer=require(_0xcaf0('0x0'));var util=require(_0xcaf0('0x1'));var path=require(_0xcaf0('0x2'));var timeout=require(_0xcaf0('0x3'));var express=require('express');var router=express[_0xcaf0('0x4')]();var fs_extra=require(_0xcaf0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcaf0('0x6'));router[_0xcaf0('0x7')]('/',auth[_0xcaf0('0x8')](),controller[_0xcaf0('0x9')]);router[_0xcaf0('0x7')](_0xcaf0('0xa'),auth[_0xcaf0('0x8')](),controller[_0xcaf0('0xb')]);router['get'](_0xcaf0('0xc'),auth['isAuthenticated'](),controller[_0xcaf0('0xd')]);router[_0xcaf0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcaf0('0xa'),auth[_0xcaf0('0x8')](),controller['update']);router[_0xcaf0('0xf')](_0xcaf0('0xa'),auth[_0xcaf0('0x8')](),controller[_0xcaf0('0x10')]);module[_0xcaf0('0x11')]=router; \ No newline at end of file +var _0x9c4d=['/:id','show','/:id/run','run','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9c4d,0xab));var _0xd9c4=function(_0x1b8755,_0x5b86bb){_0x1b8755=_0x1b8755-0x0;var _0x687dd9=_0x9c4d[_0x1b8755];return _0x687dd9;};'use strict';var multer=require(_0xd9c4('0x0'));var util=require(_0xd9c4('0x1'));var path=require(_0xd9c4('0x2'));var timeout=require(_0xd9c4('0x3'));var express=require(_0xd9c4('0x4'));var router=express[_0xd9c4('0x5')]();var fs_extra=require(_0xd9c4('0x6'));var auth=require(_0xd9c4('0x7'));var interaction=require(_0xd9c4('0x8'));var config=require('../../config/environment');var controller=require(_0xd9c4('0x9'));router[_0xd9c4('0xa')]('/',auth[_0xd9c4('0xb')](),controller[_0xd9c4('0xc')]);router['get'](_0xd9c4('0xd'),auth['isAuthenticated'](),controller[_0xd9c4('0xe')]);router[_0xd9c4('0xa')](_0xd9c4('0xf'),auth[_0xd9c4('0xb')](),controller[_0xd9c4('0x10')]);router[_0xd9c4('0x11')]('/',auth[_0xd9c4('0xb')](),controller[_0xd9c4('0x12')]);router[_0xd9c4('0x13')](_0xd9c4('0xd'),auth['isAuthenticated'](),controller[_0xd9c4('0x14')]);router['delete'](_0xd9c4('0xd'),auth[_0xd9c4('0xb')](),controller[_0xd9c4('0x15')]);module[_0xd9c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 08753c0..39efc12 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 _0x41bf=['quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x5aa243,_0x42f129){var _0x294839=function(_0x3496f6){while(--_0x3496f6){_0x5aa243['push'](_0x5aa243['shift']());}};_0x294839(++_0x42f129);}(_0x41bf,0x1c1));var _0xf41b=function(_0x5822cd,_0x569401){_0x5822cd=_0x5822cd-0x0;var _0x358517=_0x41bf[_0x5822cd];return _0x358517;};'use strict';var Sequelize=require(_0xf41b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf41b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf41b('0x1')]},'active':{'type':Sequelize[_0xf41b('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf41b('0x3')},'startAt':{'type':Sequelize[_0xf41b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf41b('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf41b('0x6')]('years',_0xf41b('0x7'),_0xf41b('0x8'),_0xf41b('0x9'),_0xf41b('0xa'),_0xf41b('0xb'),_0xf41b('0xc')),'allowNull':![],'defaultValue':_0xf41b('0xa')},'output':{'type':Sequelize['ENUM'](_0xf41b('0xd'),_0xf41b('0xe'),_0xf41b('0xf')),'allowNull':![],'defaultValue':_0xf41b('0xd')},'type':{'type':Sequelize[_0xf41b('0x6')](_0xf41b('0x10'),_0xf41b('0x11')),'allowNull':![],'defaultValue':_0xf41b('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf41b('0x1')]},'cc':{'type':Sequelize[_0xf41b('0x12')]},'bcc':{'type':Sequelize[_0xf41b('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xf41b('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb6c8=['minutes','csv','pdf','xlsx','default','custom','BOOLEAN','TEXT','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb6c8,0x194));var _0x8b6c=function(_0x5f19ef,_0x5603f7){_0x5f19ef=_0x5f19ef-0x0;var _0xd740b8=_0xb6c8[_0x5f19ef];return _0xd740b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8b6c('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8b6c('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8b6c('0x0')],'allowNull':![],'defaultValue':_0x8b6c('0x1')},'startAt':{'type':Sequelize[_0x8b6c('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8b6c('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8b6c('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8b6c('0x4')](_0x8b6c('0x5'),_0x8b6c('0x6'),_0x8b6c('0x7'),_0x8b6c('0x8'),_0x8b6c('0x9'),'hours',_0x8b6c('0xa')),'allowNull':![],'defaultValue':_0x8b6c('0x9')},'output':{'type':Sequelize[_0x8b6c('0x4')](_0x8b6c('0xb'),_0x8b6c('0xc'),_0x8b6c('0xd')),'allowNull':![],'defaultValue':_0x8b6c('0xb')},'type':{'type':Sequelize[_0x8b6c('0x4')]('custom',_0x8b6c('0xe')),'allowNull':![],'defaultValue':_0x8b6c('0xf')},'sendMail':{'type':Sequelize[_0x8b6c('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x8b6c('0x0')]},'cc':{'type':Sequelize[_0x8b6c('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x8b6c('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 09e1b80..d93b924 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 _0x1d3b=['update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','merge','VIRTUAL','filter','count','include','findAll','show','params','keys','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','Content-Range','reject','save'];(function(_0x507a18,_0x1323ee){var _0x1e9de4=function(_0x3b0cc2){while(--_0x3b0cc2){_0x507a18['push'](_0x507a18['shift']());}};_0x1e9de4(++_0x1323ee);}(_0x1d3b,0x136));var _0xb1d3=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x1d3b[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require(_0xb1d3('0x0'));var rimraf=require(_0xb1d3('0x1'));var zipdir=require(_0xb1d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1d3('0x3'));var moment=require(_0xb1d3('0x4'));var BPromise=require(_0xb1d3('0x5'));var Mustache=require(_0xb1d3('0x6'));var util=require(_0xb1d3('0x7'));var path=require(_0xb1d3('0x8'));var sox=require(_0xb1d3('0x9'));var csv=require(_0xb1d3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1d3('0xb'));var _=require(_0xb1d3('0xc'));var squel=require(_0xb1d3('0xd'));var crypto=require('crypto');var jsforce=require(_0xb1d3('0xe'));var deskjs=require(_0xb1d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb1d3('0x10'));var Papa=require('papaparse');var Redis=require(_0xb1d3('0x11'));var authService=require(_0xb1d3('0x12'));var qs=require(_0xb1d3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1d3('0x14'));var logger=require(_0xb1d3('0x15'))(_0xb1d3('0x16'));var utils=require('../../config/utils');var config=require(_0xb1d3('0x17'));var licenseUtil=require(_0xb1d3('0x18'));var db=require(_0xb1d3('0x19'))['db'];function respondWithStatusCode(_0x372f9c,_0x308ae0){_0x308ae0=_0x308ae0||0xcc;return function(_0x3af827){if(_0x3af827){return _0x372f9c['sendStatus'](_0x308ae0);}return _0x372f9c[_0xb1d3('0x1a')](_0x308ae0)[_0xb1d3('0x1b')]();};}function respondWithResult(_0x5a6588,_0x30898c){_0x30898c=_0x30898c||0xc8;return function(_0x324891){if(_0x324891){return _0x5a6588[_0xb1d3('0x1a')](_0x30898c)[_0xb1d3('0x1c')](_0x324891);}};}function respondWithFilteredResult(_0x3f241a,_0x48d6a8){return function(_0x4d7751){if(_0x4d7751){var _0x2b5b94=typeof _0x48d6a8['offset']===_0xb1d3('0x1d')&&typeof _0x48d6a8[_0xb1d3('0x1e')]==='undefined';var _0xb421c9=_0x4d7751['count'];var _0x458baf=_0x2b5b94?0x0:_0x48d6a8['offset'];var _0x4bff4b=_0x2b5b94?_0x4d7751['count']:_0x48d6a8['offset']+_0x48d6a8['limit'];var _0x489459;if(_0x4bff4b>=_0xb421c9){_0x4bff4b=_0xb421c9;_0x489459=0xc8;}else{_0x489459=0xce;}_0x3f241a['status'](_0x489459);return _0x3f241a['set'](_0xb1d3('0x1f'),_0x458baf+'-'+_0x4bff4b+'/'+_0xb421c9)[_0xb1d3('0x1c')](_0x4d7751);}return null;};}function patchUpdates(_0x588f90){return function(_0x37e2bd){try{jsonpatch['apply'](_0x37e2bd,_0x588f90,!![]);}catch(_0x5abddc){return BPromise[_0xb1d3('0x20')](_0x5abddc);}return _0x37e2bd[_0xb1d3('0x21')]();};}function saveUpdates(_0x2b7e99,_0x582547){return function(_0x285ca1){if(_0x285ca1){return _0x285ca1[_0xb1d3('0x22')](_0x2b7e99)[_0xb1d3('0x23')](function(_0x1e6b8a){return _0x1e6b8a;});}return null;};}function removeEntity(_0x9a4c00,_0x46e7eb){return function(_0x26d6cc){if(_0x26d6cc){return _0x26d6cc[_0xb1d3('0x24')]()[_0xb1d3('0x23')](function(){var _0x340f3b=_0x26d6cc[_0xb1d3('0x25')]({'plain':!![]});var _0x13183b=_0xb1d3('0x26');return db[_0xb1d3('0x27')][_0xb1d3('0x24')]({'where':{'type':_0x13183b,'resourceId':_0x340f3b['id']}})[_0xb1d3('0x23')](function(){return _0x26d6cc;});})[_0xb1d3('0x23')](function(){_0x9a4c00[_0xb1d3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62e8e7,_0x29762d){return function(_0x479562){if(!_0x479562){_0x62e8e7[_0xb1d3('0x28')](0x194);}return _0x479562;};}function handleError(_0x10ee16,_0x2f60cc){_0x2f60cc=_0x2f60cc||0x1f4;return function(_0x5e1838){logger[_0xb1d3('0x29')](_0x5e1838[_0xb1d3('0x2a')]);if(_0x5e1838[_0xb1d3('0x2b')]){delete _0x5e1838[_0xb1d3('0x2b')];}_0x10ee16['status'](_0x2f60cc)[_0xb1d3('0x2c')](_0x5e1838);};}exports[_0xb1d3('0x2d')]=function(_0x4d7460,_0x3a9617){var _0x17047d={},_0x6ac321={},_0xa507c0={'count':0x0,'rows':[]};var _0x3da909=_[_0xb1d3('0x2e')](db[_0xb1d3('0x2f')][_0xb1d3('0x30')],function(_0xf0b6ff){return{'name':_0xf0b6ff[_0xb1d3('0x31')],'type':_0xf0b6ff[_0xb1d3('0x32')]['key']};});_0x6ac321['model']=_[_0xb1d3('0x2e')](_0x3da909,'name');_0x6ac321[_0xb1d3('0x33')]=_['keys'](_0x4d7460[_0xb1d3('0x33')]);_0x6ac321['filters']=_[_0xb1d3('0x34')](_0x6ac321[_0xb1d3('0x35')],_0x6ac321['query']);_0x17047d[_0xb1d3('0x36')]=_[_0xb1d3('0x34')](_0x6ac321[_0xb1d3('0x35')],qs['fields'](_0x4d7460['query'][_0xb1d3('0x37')]));_0x17047d['attributes']=_0x17047d[_0xb1d3('0x36')][_0xb1d3('0x38')]?_0x17047d[_0xb1d3('0x36')]:_0x6ac321[_0xb1d3('0x35')];if(!_0x4d7460['query'][_0xb1d3('0x39')](_0xb1d3('0x3a'))){_0x17047d[_0xb1d3('0x1e')]=qs[_0xb1d3('0x1e')](_0x4d7460['query']['limit']);_0x17047d[_0xb1d3('0x3b')]=qs[_0xb1d3('0x3b')](_0x4d7460[_0xb1d3('0x33')][_0xb1d3('0x3b')]);}_0x17047d[_0xb1d3('0x3c')]=qs['sort'](_0x4d7460[_0xb1d3('0x33')][_0xb1d3('0x3d')]);_0x17047d[_0xb1d3('0x3e')]=qs[_0xb1d3('0x3f')](_['pick'](_0x4d7460[_0xb1d3('0x33')],_0x6ac321['filters']),_0x3da909);if(_0x4d7460[_0xb1d3('0x33')]['filter']){_0x17047d[_0xb1d3('0x3e')]=_[_0xb1d3('0x40')](_0x17047d['where'],{'$or':_[_0xb1d3('0x2e')](_0x3da909,function(_0x359aeb){if(_0x359aeb['type']!==_0xb1d3('0x41')){var _0x3b894a={};_0x3b894a[_0x359aeb[_0xb1d3('0x2b')]]={'$like':'%'+_0x4d7460[_0xb1d3('0x33')][_0xb1d3('0x42')]+'%'};return _0x3b894a;}})});}_0x17047d=_[_0xb1d3('0x40')]({},_0x17047d,_0x4d7460['options']);var _0x1b5c9c={'where':_0x17047d[_0xb1d3('0x3e')]};return db['Schedule'][_0xb1d3('0x43')](_0x1b5c9c)[_0xb1d3('0x23')](function(_0x433f51){_0xa507c0[_0xb1d3('0x43')]=_0x433f51;if(_0x4d7460[_0xb1d3('0x33')]['includeAll']){_0x17047d[_0xb1d3('0x44')]=[{'all':!![]}];}return db[_0xb1d3('0x2f')][_0xb1d3('0x45')](_0x17047d);})[_0xb1d3('0x23')](function(_0x4e855a){_0xa507c0['rows']=_0x4e855a;return _0xa507c0;})['then'](respondWithFilteredResult(_0x3a9617,_0x17047d))['catch'](handleError(_0x3a9617,null));};exports[_0xb1d3('0x46')]=function(_0x4dec18,_0x2bf3e2){var _0x4561cf={'raw':![],'where':{'id':_0x4dec18[_0xb1d3('0x47')]['id']}},_0x2d3427={};_0x2d3427[_0xb1d3('0x35')]=_[_0xb1d3('0x48')](db[_0xb1d3('0x2f')][_0xb1d3('0x30')]);_0x2d3427[_0xb1d3('0x33')]=_[_0xb1d3('0x48')](_0x4dec18[_0xb1d3('0x33')]);_0x2d3427[_0xb1d3('0x3f')]=_[_0xb1d3('0x34')](_0x2d3427[_0xb1d3('0x35')],_0x2d3427[_0xb1d3('0x33')]);_0x4561cf[_0xb1d3('0x36')]=_[_0xb1d3('0x34')](_0x2d3427[_0xb1d3('0x35')],qs[_0xb1d3('0x37')](_0x4dec18['query'][_0xb1d3('0x37')]));_0x4561cf['attributes']=_0x4561cf[_0xb1d3('0x36')][_0xb1d3('0x38')]?_0x4561cf[_0xb1d3('0x36')]:_0x2d3427[_0xb1d3('0x35')];if(_0x4dec18[_0xb1d3('0x33')]['includeAll']){_0x4561cf[_0xb1d3('0x44')]=[{'all':!![]}];}_0x4561cf=_[_0xb1d3('0x40')]({},_0x4561cf,_0x4dec18[_0xb1d3('0x49')]);return db[_0xb1d3('0x2f')][_0xb1d3('0x4a')](_0x4561cf)[_0xb1d3('0x23')](handleEntityNotFound(_0x2bf3e2,null))[_0xb1d3('0x23')](respondWithResult(_0x2bf3e2,null))[_0xb1d3('0x4b')](handleError(_0x2bf3e2,null));};exports['create']=function(_0xe11260,_0x487d29){return db[_0xb1d3('0x2f')]['create'](_0xe11260[_0xb1d3('0x4c')],{})[_0xb1d3('0x23')](function(_0x4ca563){var _0x5b8d85=_0xe11260[_0xb1d3('0x4d')][_0xb1d3('0x25')]({'plain':!![]});if(!_0x5b8d85)throw new Error(_0xb1d3('0x4e'));if(_0x5b8d85[_0xb1d3('0x4f')]===_0xb1d3('0x4d')){var _0x2171af=_0x4ca563[_0xb1d3('0x25')]({'plain':!![]});var _0x2ed712=_0xb1d3('0x26');return db[_0xb1d3('0x50')][_0xb1d3('0x4a')]({'where':{'name':_0x2ed712,'userProfileId':_0x5b8d85[_0xb1d3('0x51')]},'raw':!![]})[_0xb1d3('0x23')](function(_0x373a53){if(_0x373a53&&_0x373a53[_0xb1d3('0x52')]===0x0){return db[_0xb1d3('0x27')][_0xb1d3('0x53')]({'name':_0x2171af[_0xb1d3('0x2b')],'resourceId':_0x2171af['id'],'type':_0x373a53[_0xb1d3('0x2b')],'sectionId':_0x373a53['id']},{})['then'](function(){return _0x4ca563;});}else{return _0x4ca563;}})['catch'](function(_0x1058ce){logger[_0xb1d3('0x29')](_0xb1d3('0x54'),_0x1058ce);throw _0x1058ce;});}return _0x4ca563;})[_0xb1d3('0x23')](respondWithResult(_0x487d29,0xc9))[_0xb1d3('0x4b')](handleError(_0x487d29,null));};exports[_0xb1d3('0x22')]=function(_0x41f780,_0x52ee73){if(_0x41f780[_0xb1d3('0x4c')]['id']){delete _0x41f780[_0xb1d3('0x4c')]['id'];}return db[_0xb1d3('0x2f')][_0xb1d3('0x4a')]({'where':{'id':_0x41f780[_0xb1d3('0x47')]['id']}})['then'](handleEntityNotFound(_0x52ee73,null))[_0xb1d3('0x23')](saveUpdates(_0x41f780[_0xb1d3('0x4c')],null))[_0xb1d3('0x23')](respondWithResult(_0x52ee73,null))['catch'](handleError(_0x52ee73,null));};exports[_0xb1d3('0x24')]=function(_0x5957c2,_0x30cd96){return db[_0xb1d3('0x2f')][_0xb1d3('0x4a')]({'where':{'id':_0x5957c2[_0xb1d3('0x47')]['id']}})[_0xb1d3('0x23')](handleEntityNotFound(_0x30cd96,null))[_0xb1d3('0x23')](removeEntity(_0x30cd96,null))[_0xb1d3('0x4b')](handleError(_0x30cd96,null));};exports['run']=function(_0x4bade0,_0x1bf283,_0x58ee25){var _0xa4956=require(_0xb1d3('0x55'));return db[_0xb1d3('0x2f')][_0xb1d3('0x4a')]({'where':{'id':_0x4bade0[_0xb1d3('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1bf283,null))['then'](function(){_0xa4956['run'](_0x4bade0['params']['id']);})['then'](respondWithStatusCode(_0x1bf283,null))['catch'](handleError(_0x1bf283,null));}; \ No newline at end of file +var _0x0b85=['nolimit','limit','order','sort','pick','filter','merge','options','where','includeAll','findAll','rows','show','params','find','catch','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','then','destroy','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2de4e6,_0x2dbab4){var _0x156984=function(_0x3c17c4){while(--_0x3c17c4){_0x2de4e6['push'](_0x2de4e6['shift']());}};_0x156984(++_0x2dbab4);}(_0x0b85,0x196));var _0x50b8=function(_0x51394b,_0x228887){_0x51394b=_0x51394b-0x0;var _0x2439b5=_0x0b85[_0x51394b];return _0x2439b5;};'use strict';var emlformat=require(_0x50b8('0x0'));var rimraf=require(_0x50b8('0x1'));var zipdir=require(_0x50b8('0x2'));var jsonpatch=require(_0x50b8('0x3'));var rp=require(_0x50b8('0x4'));var moment=require(_0x50b8('0x5'));var BPromise=require(_0x50b8('0x6'));var Mustache=require('mustache');var util=require(_0x50b8('0x7'));var path=require(_0x50b8('0x8'));var sox=require(_0x50b8('0x9'));var csv=require(_0x50b8('0xa'));var ejs=require(_0x50b8('0xb'));var fs=require('fs');var fs_extra=require(_0x50b8('0xc'));var _=require(_0x50b8('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50b8('0xe'));var toCsv=require(_0x50b8('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50b8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x50b8('0x10'))(_0x50b8('0x11'));var utils=require(_0x50b8('0x12'));var config=require(_0x50b8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x50b8('0x14'))['db'];function respondWithStatusCode(_0x42c864,_0x123fcd){_0x123fcd=_0x123fcd||0xcc;return function(_0x52d2ba){if(_0x52d2ba){return _0x42c864[_0x50b8('0x15')](_0x123fcd);}return _0x42c864[_0x50b8('0x16')](_0x123fcd)[_0x50b8('0x17')]();};}function respondWithResult(_0x5428f8,_0x5f3b90){_0x5f3b90=_0x5f3b90||0xc8;return function(_0x5228e1){if(_0x5228e1){return _0x5428f8['status'](_0x5f3b90)['json'](_0x5228e1);}};}function respondWithFilteredResult(_0x3ccf28,_0x5efe78){return function(_0x3d27f4){if(_0x3d27f4){var _0x73e131=typeof _0x5efe78[_0x50b8('0x18')]===_0x50b8('0x19')&&typeof _0x5efe78['limit']==='undefined';var _0x524d50=_0x3d27f4[_0x50b8('0x1a')];var _0x4818d5=_0x73e131?0x0:_0x5efe78['offset'];var _0x38d821=_0x73e131?_0x3d27f4[_0x50b8('0x1a')]:_0x5efe78[_0x50b8('0x18')]+_0x5efe78['limit'];var _0x254153;if(_0x38d821>=_0x524d50){_0x38d821=_0x524d50;_0x254153=0xc8;}else{_0x254153=0xce;}_0x3ccf28[_0x50b8('0x16')](_0x254153);return _0x3ccf28['set'](_0x50b8('0x1b'),_0x4818d5+'-'+_0x38d821+'/'+_0x524d50)['json'](_0x3d27f4);}return null;};}function patchUpdates(_0x5996da){return function(_0xf5c267){try{jsonpatch[_0x50b8('0x1c')](_0xf5c267,_0x5996da,!![]);}catch(_0x3969b7){return BPromise['reject'](_0x3969b7);}return _0xf5c267['save']();};}function saveUpdates(_0x4e7ddc,_0x375754){return function(_0x5f117c){if(_0x5f117c){return _0x5f117c['update'](_0x4e7ddc)[_0x50b8('0x1d')](function(_0x409582){return _0x409582;});}return null;};}function removeEntity(_0x1d6c01,_0x5c8366){return function(_0x1d4952){if(_0x1d4952){return _0x1d4952[_0x50b8('0x1e')]()[_0x50b8('0x1d')](function(){var _0x121515=_0x1d4952['get']({'plain':!![]});var _0x1f612d='Scheduler';return db['UserProfileResource'][_0x50b8('0x1e')]({'where':{'type':_0x1f612d,'resourceId':_0x121515['id']}})[_0x50b8('0x1d')](function(){return _0x1d4952;});})[_0x50b8('0x1d')](function(){_0x1d6c01[_0x50b8('0x16')](0xcc)[_0x50b8('0x17')]();});}};}function handleEntityNotFound(_0x31278f,_0x257813){return function(_0x14e3b6){if(!_0x14e3b6){_0x31278f['sendStatus'](0x194);}return _0x14e3b6;};}function handleError(_0x2a3713,_0x52ab07){_0x52ab07=_0x52ab07||0x1f4;return function(_0x1b6575){logger[_0x50b8('0x1f')](_0x1b6575[_0x50b8('0x20')]);if(_0x1b6575[_0x50b8('0x21')]){delete _0x1b6575[_0x50b8('0x21')];}_0x2a3713[_0x50b8('0x16')](_0x52ab07)[_0x50b8('0x22')](_0x1b6575);};}exports['index']=function(_0x1a6211,_0x61d4b8){var _0x55893f={},_0x1f52d1={},_0x2bd022={'count':0x0,'rows':[]};var _0x59af15=_[_0x50b8('0x23')](db[_0x50b8('0x24')][_0x50b8('0x25')],function(_0x3d7eb2){return{'name':_0x3d7eb2[_0x50b8('0x26')],'type':_0x3d7eb2[_0x50b8('0x27')][_0x50b8('0x28')]};});_0x1f52d1[_0x50b8('0x29')]=_[_0x50b8('0x23')](_0x59af15,_0x50b8('0x21'));_0x1f52d1[_0x50b8('0x2a')]=_[_0x50b8('0x2b')](_0x1a6211[_0x50b8('0x2a')]);_0x1f52d1[_0x50b8('0x2c')]=_[_0x50b8('0x2d')](_0x1f52d1['model'],_0x1f52d1[_0x50b8('0x2a')]);_0x55893f[_0x50b8('0x2e')]=_[_0x50b8('0x2d')](_0x1f52d1[_0x50b8('0x29')],qs['fields'](_0x1a6211['query'][_0x50b8('0x2f')]));_0x55893f[_0x50b8('0x2e')]=_0x55893f['attributes'][_0x50b8('0x30')]?_0x55893f[_0x50b8('0x2e')]:_0x1f52d1[_0x50b8('0x29')];if(!_0x1a6211['query'][_0x50b8('0x31')](_0x50b8('0x32'))){_0x55893f[_0x50b8('0x33')]=qs[_0x50b8('0x33')](_0x1a6211[_0x50b8('0x2a')][_0x50b8('0x33')]);_0x55893f[_0x50b8('0x18')]=qs['offset'](_0x1a6211['query'][_0x50b8('0x18')]);}_0x55893f[_0x50b8('0x34')]=qs[_0x50b8('0x35')](_0x1a6211['query'][_0x50b8('0x35')]);_0x55893f['where']=qs[_0x50b8('0x2c')](_[_0x50b8('0x36')](_0x1a6211[_0x50b8('0x2a')],_0x1f52d1[_0x50b8('0x2c')]),_0x59af15);if(_0x1a6211[_0x50b8('0x2a')][_0x50b8('0x37')]){_0x55893f['where']=_[_0x50b8('0x38')](_0x55893f['where'],{'$or':_[_0x50b8('0x23')](_0x59af15,function(_0x3728db){if(_0x3728db[_0x50b8('0x27')]!=='VIRTUAL'){var _0x1d4ba4={};_0x1d4ba4[_0x3728db['name']]={'$like':'%'+_0x1a6211[_0x50b8('0x2a')]['filter']+'%'};return _0x1d4ba4;}})});}_0x55893f=_[_0x50b8('0x38')]({},_0x55893f,_0x1a6211[_0x50b8('0x39')]);var _0x42e416={'where':_0x55893f[_0x50b8('0x3a')]};return db['Schedule'][_0x50b8('0x1a')](_0x42e416)[_0x50b8('0x1d')](function(_0x32bc8e){_0x2bd022[_0x50b8('0x1a')]=_0x32bc8e;if(_0x1a6211[_0x50b8('0x2a')][_0x50b8('0x3b')]){_0x55893f['include']=[{'all':!![]}];}return db[_0x50b8('0x24')][_0x50b8('0x3c')](_0x55893f);})['then'](function(_0x4cd0b1){_0x2bd022[_0x50b8('0x3d')]=_0x4cd0b1;return _0x2bd022;})[_0x50b8('0x1d')](respondWithFilteredResult(_0x61d4b8,_0x55893f))['catch'](handleError(_0x61d4b8,null));};exports[_0x50b8('0x3e')]=function(_0x3b13f3,_0x1604c6){var _0x250779={'raw':![],'where':{'id':_0x3b13f3[_0x50b8('0x3f')]['id']}},_0x1bba43={};_0x1bba43[_0x50b8('0x29')]=_[_0x50b8('0x2b')](db['Schedule'][_0x50b8('0x25')]);_0x1bba43['query']=_['keys'](_0x3b13f3[_0x50b8('0x2a')]);_0x1bba43[_0x50b8('0x2c')]=_[_0x50b8('0x2d')](_0x1bba43[_0x50b8('0x29')],_0x1bba43[_0x50b8('0x2a')]);_0x250779[_0x50b8('0x2e')]=_['intersection'](_0x1bba43['model'],qs[_0x50b8('0x2f')](_0x3b13f3[_0x50b8('0x2a')]['fields']));_0x250779[_0x50b8('0x2e')]=_0x250779['attributes'][_0x50b8('0x30')]?_0x250779[_0x50b8('0x2e')]:_0x1bba43[_0x50b8('0x29')];if(_0x3b13f3[_0x50b8('0x2a')][_0x50b8('0x3b')]){_0x250779['include']=[{'all':!![]}];}_0x250779=_[_0x50b8('0x38')]({},_0x250779,_0x3b13f3['options']);return db[_0x50b8('0x24')][_0x50b8('0x40')](_0x250779)['then'](handleEntityNotFound(_0x1604c6,null))['then'](respondWithResult(_0x1604c6,null))[_0x50b8('0x41')](handleError(_0x1604c6,null));};exports[_0x50b8('0x42')]=function(_0x426d0b,_0x3570a6){return db[_0x50b8('0x24')]['create'](_0x426d0b[_0x50b8('0x43')],{})[_0x50b8('0x1d')](function(_0x707ffa){var _0x2a806d=_0x426d0b[_0x50b8('0x44')]['get']({'plain':!![]});if(!_0x2a806d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a806d[_0x50b8('0x45')]===_0x50b8('0x44')){var _0x5b8b1d=_0x707ffa['get']({'plain':!![]});var _0x554bd0=_0x50b8('0x46');return db[_0x50b8('0x47')][_0x50b8('0x40')]({'where':{'name':_0x554bd0,'userProfileId':_0x2a806d[_0x50b8('0x48')]},'raw':!![]})[_0x50b8('0x1d')](function(_0x55e0aa){if(_0x55e0aa&&_0x55e0aa[_0x50b8('0x49')]===0x0){return db['UserProfileResource'][_0x50b8('0x42')]({'name':_0x5b8b1d[_0x50b8('0x21')],'resourceId':_0x5b8b1d['id'],'type':_0x55e0aa['name'],'sectionId':_0x55e0aa['id']},{})['then'](function(){return _0x707ffa;});}else{return _0x707ffa;}})[_0x50b8('0x41')](function(_0x4623b0){logger[_0x50b8('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4623b0);throw _0x4623b0;});}return _0x707ffa;})[_0x50b8('0x1d')](respondWithResult(_0x3570a6,0xc9))['catch'](handleError(_0x3570a6,null));};exports['update']=function(_0x4c07da,_0x5d88f9){if(_0x4c07da[_0x50b8('0x43')]['id']){delete _0x4c07da[_0x50b8('0x43')]['id'];}return db[_0x50b8('0x24')][_0x50b8('0x40')]({'where':{'id':_0x4c07da[_0x50b8('0x3f')]['id']}})[_0x50b8('0x1d')](handleEntityNotFound(_0x5d88f9,null))[_0x50b8('0x1d')](saveUpdates(_0x4c07da[_0x50b8('0x43')],null))[_0x50b8('0x1d')](respondWithResult(_0x5d88f9,null))['catch'](handleError(_0x5d88f9,null));};exports['destroy']=function(_0x14d974,_0x549d03){return db[_0x50b8('0x24')][_0x50b8('0x40')]({'where':{'id':_0x14d974['params']['id']}})[_0x50b8('0x1d')](handleEntityNotFound(_0x549d03,null))['then'](removeEntity(_0x549d03,null))[_0x50b8('0x41')](handleError(_0x549d03,null));};exports['run']=function(_0x3c7f45,_0x2f2945,_0x23b1fc){var _0x213070=require(_0x50b8('0x4a'));return db[_0x50b8('0x24')][_0x50b8('0x40')]({'where':{'id':_0x3c7f45[_0x50b8('0x3f')]['id']},'raw':!![]})[_0x50b8('0x1d')](handleEntityNotFound(_0x2f2945,null))['then'](function(){_0x213070[_0x50b8('0x4b')](_0x3c7f45[_0x50b8('0x3f')]['id']);})[_0x50b8('0x1d')](respondWithStatusCode(_0x2f2945,null))[_0x50b8('0x41')](handleError(_0x2f2945,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7048bc0..7c7dd33 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 _0x4e6f=['path','./schedule.attributes','exports','define','Schedule','lodash','util','api','moment','bluebird','request-promise'];(function(_0x315216,_0x15d0cc){var _0x4dfb84=function(_0x7e1a19){while(--_0x7e1a19){_0x315216['push'](_0x315216['shift']());}};_0x4dfb84(++_0x15d0cc);}(_0x4e6f,0x1b2));var _0xf4e6=function(_0x2ad281,_0x5f26b8){_0x2ad281=_0x2ad281-0x0;var _0x1ee938=_0x4e6f[_0x2ad281];return _0x1ee938;};'use strict';var _=require(_0xf4e6('0x0'));var util=require(_0xf4e6('0x1'));var logger=require('../../config/logger')(_0xf4e6('0x2'));var moment=require(_0xf4e6('0x3'));var BPromise=require(_0xf4e6('0x4'));var rp=require(_0xf4e6('0x5'));var fs=require('fs');var path=require(_0xf4e6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4e6('0x7'));module[_0xf4e6('0x8')]=function(_0x2198bc,_0x1a35eb){return _0x2198bc[_0xf4e6('0x9')](_0xf4e6('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e8=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0xd4e8,0xe2));var _0x8d4e=function(_0x3fd7ab,_0x3dd0bc){_0x3fd7ab=_0x3fd7ab-0x0;var _0x56cb4b=_0xd4e8[_0x3fd7ab];return _0x56cb4b;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var logger=require(_0x8d4e('0x2'))(_0x8d4e('0x3'));var moment=require(_0x8d4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d4e('0x5'));var fs=require('fs');var path=require(_0x8d4e('0x6'));var rimraf=require(_0x8d4e('0x7'));var config=require(_0x8d4e('0x8'));var attributes=require(_0x8d4e('0x9'));module[_0x8d4e('0xa')]=function(_0x5d948f,_0x2765f5){return _0x5d948f[_0x8d4e('0xb')](_0x8d4e('0xc'),attributes,{'tableName':_0x8d4e('0xd'),'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 496830d..7045431 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 _0x7820=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x3d1ec3,_0x1fa038){var _0x3aabcb=function(_0x16af6c){while(--_0x16af6c){_0x3d1ec3['push'](_0x3d1ec3['shift']());}};_0x3aabcb(++_0x1fa038);}(_0x7820,0x1cd));var _0x0782=function(_0x3fce89,_0x295603){_0x3fce89=_0x3fce89-0x0;var _0xd90307=_0x7820[_0x3fce89];return _0xd90307;};'use strict';var _=require(_0x0782('0x0'));var util=require(_0x0782('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0782('0x2'));var fs=require('fs');var Redis=require(_0x0782('0x3'));var db=require(_0x0782('0x4'))['db'];var utils=require(_0x0782('0x5'));var logger=require(_0x0782('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0782('0x7'));var client=jayson[_0x0782('0x8')][_0x0782('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fb4b4,_0x2206d4,_0xd4b579){return new BPromise(function(_0x53096c,_0x3fa11e){return client[_0x0782('0xa')](_0x2fb4b4,_0xd4b579)[_0x0782('0xb')](function(_0x32e0e3){logger[_0x0782('0xc')](_0x0782('0xd'),_0x2206d4,'request\x20sent');logger[_0x0782('0xe')](_0x0782('0xf'),_0x2206d4,_0x0782('0x10'),JSON['stringify'](_0x32e0e3));if(_0x32e0e3[_0x0782('0x11')]){if(_0x32e0e3['error'][_0x0782('0x12')]===0x1f4){logger[_0x0782('0x11')](_0x0782('0xd'),_0x2206d4,_0x32e0e3[_0x0782('0x11')]['message']);return _0x3fa11e(_0x32e0e3['error']['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x2206d4,_0x32e0e3[_0x0782('0x11')]['message']);return _0x53096c(_0x32e0e3[_0x0782('0x11')][_0x0782('0x13')]);}else{logger[_0x0782('0xc')]('Schedule,\x20%s,\x20%s',_0x2206d4,_0x0782('0x10'));_0x53096c(_0x32e0e3['result'][_0x0782('0x13')]);}})[_0x0782('0x14')](function(_0x1aef67){logger[_0x0782('0x11')]('Schedule,\x20%s,\x20%s',_0x2206d4,_0x1aef67);_0x3fa11e(_0x1aef67);});});} \ No newline at end of file +var _0x38f6=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2d33c7,_0x20e736){var _0x3f5a29=function(_0x41f9fb){while(--_0x41f9fb){_0x2d33c7['push'](_0x2d33c7['shift']());}};_0x3f5a29(++_0x20e736);}(_0x38f6,0x182));var _0x638f=function(_0x3a4f91,_0x5146f6){_0x3a4f91=_0x3a4f91-0x0;var _0x251fa2=_0x38f6[_0x3a4f91];return _0x251fa2;};'use strict';var _=require(_0x638f('0x0'));var util=require(_0x638f('0x1'));var moment=require(_0x638f('0x2'));var BPromise=require('bluebird');var rs=require(_0x638f('0x3'));var fs=require('fs');var Redis=require(_0x638f('0x4'));var db=require(_0x638f('0x5'))['db'];var utils=require(_0x638f('0x6'));var logger=require('../../config/logger')(_0x638f('0x7'));var config=require(_0x638f('0x8'));var jayson=require(_0x638f('0x9'));var client=jayson[_0x638f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9f47,_0x4baaeb,_0x3fc389){return new BPromise(function(_0x36391f,_0x581bfc){return client[_0x638f('0xb')](_0x4e9f47,_0x3fc389)[_0x638f('0xc')](function(_0xf66883){logger['info'](_0x638f('0xd'),_0x4baaeb,_0x638f('0xe'));logger[_0x638f('0xf')](_0x638f('0x10'),_0x4baaeb,'request\x20sent',JSON[_0x638f('0x11')](_0xf66883));if(_0xf66883[_0x638f('0x12')]){if(_0xf66883[_0x638f('0x12')][_0x638f('0x13')]===0x1f4){logger[_0x638f('0x12')](_0x638f('0xd'),_0x4baaeb,_0xf66883[_0x638f('0x12')][_0x638f('0x14')]);return _0x581bfc(_0xf66883['error'][_0x638f('0x14')]);}logger[_0x638f('0x12')]('Schedule,\x20%s,\x20%s',_0x4baaeb,_0xf66883[_0x638f('0x12')][_0x638f('0x14')]);return _0x36391f(_0xf66883['error'][_0x638f('0x14')]);}else{logger[_0x638f('0x15')]('Schedule,\x20%s,\x20%s',_0x4baaeb,_0x638f('0xe'));_0x36391f(_0xf66883[_0x638f('0x16')][_0x638f('0x14')]);}})[_0x638f('0x17')](function(_0x2484a4){logger[_0x638f('0x12')](_0x638f('0xd'),_0x4baaeb,_0x2484a4);_0x581bfc(_0x2484a4);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 91d4b2b..8d5b6ce 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 _0x86fc=['show','/:id/download','download','post','create','put','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2976bb,_0x5c5add){var _0x26c340=function(_0x2a3d59){while(--_0x2a3d59){_0x2976bb['push'](_0x2976bb['shift']());}};_0x26c340(++_0x5c5add);}(_0x86fc,0x1c0));var _0xc86f=function(_0x5568e5,_0x32d3ef){_0x5568e5=_0x5568e5-0x0;var _0x3f5bd1=_0x86fc[_0x5568e5];return _0x3f5bd1;};'use strict';var multer=require('multer');var util=require(_0xc86f('0x0'));var path=require('path');var timeout=require(_0xc86f('0x1'));var express=require(_0xc86f('0x2'));var router=express[_0xc86f('0x3')]();var fs_extra=require(_0xc86f('0x4'));var auth=require(_0xc86f('0x5'));var interaction=require(_0xc86f('0x6'));var config=require('../../config/environment');var controller=require(_0xc86f('0x7'));router[_0xc86f('0x8')]('/',auth[_0xc86f('0x9')](),controller[_0xc86f('0xa')]);router[_0xc86f('0x8')](_0xc86f('0xb'),auth[_0xc86f('0x9')](),controller[_0xc86f('0xc')]);router[_0xc86f('0x8')](_0xc86f('0xd'),auth['isAuthenticated'](),controller[_0xc86f('0xe')]);router[_0xc86f('0x8')](_0xc86f('0xf'),auth['isAuthenticated'](),controller[_0xc86f('0x10')]);router[_0xc86f('0x11')]('/',auth[_0xc86f('0x9')](),controller[_0xc86f('0x12')]);router[_0xc86f('0x13')]('/:id',auth[_0xc86f('0x9')](),controller['update']);router['delete'](_0xc86f('0xd'),auth['isAuthenticated'](),controller[_0xc86f('0x14')]);module[_0xc86f('0x15')]=router; \ No newline at end of file +var _0xfd16=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update','exports','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd16,0xfa));var _0x6fd1=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xfd16[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require('multer');var util=require(_0x6fd1('0x0'));var path=require(_0x6fd1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6fd1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6fd1('0x3'));var interaction=require(_0x6fd1('0x4'));var config=require(_0x6fd1('0x5'));var controller=require(_0x6fd1('0x6'));router[_0x6fd1('0x7')]('/',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x9')]);router[_0x6fd1('0x7')]('/describe',auth[_0x6fd1('0x8')](),controller['describe']);router[_0x6fd1('0x7')](_0x6fd1('0xa'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0xb')]);router[_0x6fd1('0x7')](_0x6fd1('0xc'),auth['isAuthenticated'](),controller[_0x6fd1('0xd')]);router['post']('/',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0xe')]);router[_0x6fd1('0xf')](_0x6fd1('0xa'),auth['isAuthenticated'](),controller[_0x6fd1('0x10')]);router['delete'](_0x6fd1('0xa'),auth[_0x6fd1('0x8')](),controller['destroy']);module[_0x6fd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 367d20a..22a85d8 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 _0x47d6=['INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x3ddf26,_0x15c898){var _0x32a6c3=function(_0x32e45f){while(--_0x32e45f){_0x3ddf26['push'](_0x3ddf26['shift']());}};_0x32a6c3(++_0x15c898);}(_0x47d6,0x13f));var _0x647d=function(_0x2a675a,_0x1e54a5){_0x2a675a=_0x2a675a-0x0;var _0xe71a1c=_0x47d6[_0x2a675a];return _0xe71a1c;};'use strict';var Sequelize=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var path=require(_0x647d('0x2'));var config=require(_0x647d('0x3'));module[_0x647d('0x4')]={'format':{'type':Sequelize[_0x647d('0x5')],'get':function(){return this[_0x647d('0x6')](_0x647d('0x7'))?path[_0x647d('0x8')](this[_0x647d('0x6')](_0x647d('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x647d('0x9')]},'channel':{'type':Sequelize[_0x647d('0x9')]},'value':{'type':Sequelize[_0x647d('0x9')],'set':function(_0x1db1db){var _0x1c6a88=_0x1db1db['replace'](/\\/g,'/');this[_0x647d('0xa')](_0x647d('0x7'),_0x1c6a88);}},'rating':{'type':Sequelize[_0x647d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x647d('0xb')],'set':function(_0x414518){this[_0x647d('0xa')](_0x647d('0xc'),moment()[_0x647d('0xd')](_0x414518,'ms'));this[_0x647d('0xa')](_0x647d('0xe'),moment());this[_0x647d('0xa')](_0x647d('0xf'),_0x414518);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x647d('0xc')))[_0x647d('0x10')](_0x647d('0x11'))[_0x647d('0x12')]();}},'closedAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0xe')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}},'createdAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this['getDataValue'](_0x647d('0x14')))[_0x647d('0x10')](_0x647d('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0x15')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}}}; \ No newline at end of file +var _0x1c77=['value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','startedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x37f85a,_0x240e20){var _0x190eeb=function(_0x2ae374){while(--_0x2ae374){_0x37f85a['push'](_0x37f85a['shift']());}};_0x190eeb(++_0x240e20);}(_0x1c77,0xed));var _0x71c7=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x1c77[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x71c7('0x0'));var path=require(_0x71c7('0x1'));var config=require(_0x71c7('0x2'));module[_0x71c7('0x3')]={'format':{'type':Sequelize[_0x71c7('0x4')],'get':function(){return this['getDataValue'](_0x71c7('0x5'))?path[_0x71c7('0x6')](this[_0x71c7('0x7')](_0x71c7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x71c7('0x8')]},'channel':{'type':Sequelize[_0x71c7('0x8')]},'value':{'type':Sequelize[_0x71c7('0x8')],'set':function(_0x57fb10){var _0x57bbb6=_0x57fb10[_0x71c7('0x9')](/\\/g,'/');this[_0x71c7('0xa')](_0x71c7('0x5'),_0x57bbb6);}},'rating':{'type':Sequelize[_0x71c7('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1f5fc9){this['setDataValue']('startedAt',moment()[_0x71c7('0xc')](_0x1f5fc9,'ms'));this[_0x71c7('0xa')](_0x71c7('0xd'),moment());this[_0x71c7('0xa')](_0x71c7('0xe'),_0x1f5fc9);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0xf')))[_0x71c7('0x10')](_0x71c7('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x71c7('0x12')],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0xd')))[_0x71c7('0x10')](_0x71c7('0x11'))[_0x71c7('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x71c7('0x14')))[_0x71c7('0x10')](_0x71c7('0x11'))[_0x71c7('0x13')]();}},'updatedAt':{'type':Sequelize[_0x71c7('0x12')],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0x15')))[_0x71c7('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x71c7('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6fe1074..647bb97 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x211d53,_0x2c56be){var _0x3749c3=function(_0xdb7c){while(--_0xdb7c){_0x211d53['push'](_0x211d53['shift']());}};_0x3749c3(++_0x2c56be);}(_0xee14,0x13a));var _0x4ee1=function(_0x4ef8d9,_0x1ed835){_0x4ef8d9=_0x4ef8d9-0x0;var _0x190c02=_0xee14[_0x4ef8d9];return _0x190c02;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x18fe54,_0xff789){_0x18fe54=_0x18fe54-0x0;var _0xccb1ee=_0xd0bb[_0x18fe54];return _0xccb1ee;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 19370d4..3fc2bce 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 _0x7ff4=['moment','request-promise','path','rimraf','../../config/environment','exports','define','screen_recordings','interactionid','lodash','../../config/logger','api'];(function(_0x37b229,_0x1ff75f){var _0x3162c4=function(_0x2db4f4){while(--_0x2db4f4){_0x37b229['push'](_0x37b229['shift']());}};_0x3162c4(++_0x1ff75f);}(_0x7ff4,0x1c5));var _0x47ff=function(_0x4ba69d,_0x4319c0){_0x4ba69d=_0x4ba69d-0x0;var _0xe9d279=_0x7ff4[_0x4ba69d];return _0xe9d279;};'use strict';var _=require(_0x47ff('0x0'));var util=require('util');var logger=require(_0x47ff('0x1'))(_0x47ff('0x2'));var moment=require(_0x47ff('0x3'));var BPromise=require('bluebird');var rp=require(_0x47ff('0x4'));var fs=require('fs');var path=require(_0x47ff('0x5'));var rimraf=require(_0x47ff('0x6'));var config=require(_0x47ff('0x7'));var attributes=require('./screenRecording.attributes');module[_0x47ff('0x8')]=function(_0x1662a3,_0xde3a5f){return _0x1662a3[_0x47ff('0x9')]('ScreenRecording',attributes,{'tableName':_0x47ff('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x47ff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97b2=['bluebird','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x97b2,0x174));var _0x297b=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x97b2[_0x16ea87];return _0x6e7b1c;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var logger=require(_0x297b('0x2'))(_0x297b('0x3'));var moment=require(_0x297b('0x4'));var BPromise=require(_0x297b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x297b('0x6'));var config=require(_0x297b('0x7'));var attributes=require(_0x297b('0x8'));module['exports']=function(_0x42928a,_0x21158e){return _0x42928a[_0x297b('0x9')](_0x297b('0xa'),attributes,{'tableName':_0x297b('0xb'),'paranoid':![],'indexes':[{'name':_0x297b('0xc'),'fields':[_0x297b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d0ecaca..56acbfa 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 _0xd1e8=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd1e8,0x74));var _0x8d1e=function(_0x1f27b6,_0x251b0a){_0x1f27b6=_0x1f27b6-0x0;var _0x5a71fb=_0xd1e8[_0x1f27b6];return _0x5a71fb;};'use strict';var _=require('lodash');var util=require(_0x8d1e('0x0'));var moment=require(_0x8d1e('0x1'));var BPromise=require(_0x8d1e('0x2'));var rs=require(_0x8d1e('0x3'));var fs=require('fs');var Redis=require(_0x8d1e('0x4'));var db=require(_0x8d1e('0x5'))['db'];var utils=require(_0x8d1e('0x6'));var logger=require(_0x8d1e('0x7'))('rpc');var config=require(_0x8d1e('0x8'));var jayson=require(_0x8d1e('0x9'));var client=jayson[_0x8d1e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf19e,_0x7478fb,_0x4caff5){return new BPromise(function(_0x4c8a8a,_0x383cbf){return client[_0x8d1e('0xb')](_0x1bf19e,_0x4caff5)[_0x8d1e('0xc')](function(_0x2bbd95){logger[_0x8d1e('0xd')](_0x8d1e('0xe'),_0x7478fb,_0x8d1e('0xf'));logger['debug'](_0x8d1e('0x10'),_0x7478fb,_0x8d1e('0xf'),JSON[_0x8d1e('0x11')](_0x2bbd95));if(_0x2bbd95['error']){if(_0x2bbd95[_0x8d1e('0x12')][_0x8d1e('0x13')]===0x1f4){logger[_0x8d1e('0x12')](_0x8d1e('0xe'),_0x7478fb,_0x2bbd95[_0x8d1e('0x12')]['message']);return _0x383cbf(_0x2bbd95['error']['message']);}logger[_0x8d1e('0x12')](_0x8d1e('0xe'),_0x7478fb,_0x2bbd95[_0x8d1e('0x12')][_0x8d1e('0x14')]);return _0x4c8a8a(_0x2bbd95[_0x8d1e('0x12')][_0x8d1e('0x14')]);}else{logger[_0x8d1e('0xd')](_0x8d1e('0xe'),_0x7478fb,_0x8d1e('0xf'));_0x4c8a8a(_0x2bbd95[_0x8d1e('0x15')]['message']);}})[_0x8d1e('0x16')](function(_0x565971){logger[_0x8d1e('0x12')](_0x8d1e('0xe'),_0x7478fb,_0x565971);_0x383cbf(_0x565971);});});} \ No newline at end of file +var _0x0297=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x2f8749,_0x7aa1ee){var _0x552837=function(_0x509a38){while(--_0x509a38){_0x2f8749['push'](_0x2f8749['shift']());}};_0x552837(++_0x7aa1ee);}(_0x0297,0xa5));var _0x7029=function(_0x3abea2,_0x42b714){_0x3abea2=_0x3abea2-0x0;var _0x1522c3=_0x0297[_0x3abea2];return _0x1522c3;};'use strict';var _=require(_0x7029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7029('0x1'));var rs=require(_0x7029('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7029('0x3'));var logger=require(_0x7029('0x4'))(_0x7029('0x5'));var config=require(_0x7029('0x6'));var jayson=require(_0x7029('0x7'));var client=jayson['client'][_0x7029('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4be368,_0x58b953,_0x55a73c){return new BPromise(function(_0xbb437,_0x36cf67){return client[_0x7029('0x9')](_0x4be368,_0x55a73c)[_0x7029('0xa')](function(_0x75136){logger[_0x7029('0xb')](_0x7029('0xc'),_0x58b953,_0x7029('0xd'));logger[_0x7029('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x58b953,'request\x20sent',JSON[_0x7029('0xf')](_0x75136));if(_0x75136[_0x7029('0x10')]){if(_0x75136['error'][_0x7029('0x11')]===0x1f4){logger[_0x7029('0x10')](_0x7029('0xc'),_0x58b953,_0x75136[_0x7029('0x10')][_0x7029('0x12')]);return _0x36cf67(_0x75136[_0x7029('0x10')][_0x7029('0x12')]);}logger[_0x7029('0x10')](_0x7029('0xc'),_0x58b953,_0x75136[_0x7029('0x10')][_0x7029('0x12')]);return _0xbb437(_0x75136[_0x7029('0x10')]['message']);}else{logger[_0x7029('0xb')](_0x7029('0xc'),_0x58b953,_0x7029('0xd'));_0xbb437(_0x75136[_0x7029('0x13')][_0x7029('0x12')]);}})[_0x7029('0x14')](function(_0x5323ea){logger[_0x7029('0x10')](_0x7029('0xc'),_0x58b953,_0x5323ea);_0x36cf67(_0x5323ea);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index eab9739..1ec61a0 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 _0x4488=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','root','format','%s%s','logo','extname','post','/:id/logo','single','diskStorage','join','server/files/images/logos/','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x4488,0x143));var _0x8448=function(_0x3a794d,_0x3896cb){_0x3a794d=_0x3a794d-0x0;var _0x5e46ab=_0x4488[_0x3a794d];return _0x5e46ab;};'use strict';var multer=require(_0x8448('0x0'));var util=require(_0x8448('0x1'));var path=require('path');var timeout=require(_0x8448('0x2'));var express=require(_0x8448('0x3'));var router=express[_0x8448('0x4')]();var fs_extra=require(_0x8448('0x5'));var auth=require(_0x8448('0x6'));var interaction=require(_0x8448('0x7'));var config=require(_0x8448('0x8'));var controller=require(_0x8448('0x9'));router[_0x8448('0xa')]('/',auth[_0x8448('0xb')](),controller[_0x8448('0xc')]);router[_0x8448('0xa')](_0x8448('0xd'),controller['getDate']);router['get'](_0x8448('0xe'),controller[_0x8448('0xf')]);router[_0x8448('0xa')]('/:id/logo',controller[_0x8448('0x10')]);router[_0x8448('0xa')](_0x8448('0x11'),controller[_0x8448('0x12')]);router['get'](_0x8448('0x13'),controller[_0x8448('0x14')]);router[_0x8448('0xa')](_0x8448('0x15'),controller[_0x8448('0x16')]);router[_0x8448('0xa')]('/:id/favicon',controller[_0x8448('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42eb4c,_0x432f40,_0x15ee6d){_0x15ee6d(null,path['join'](config[_0x8448('0x18')],'server/files/images/logos/'));},'filename':function(_0x481313,_0x1ca3a1,_0x167864){_0x167864(null,util[_0x8448('0x19')](_0x8448('0x1a'),_0x8448('0x1b'),path[_0x8448('0x1c')](_0x1ca3a1['originalname'])));}})});router[_0x8448('0x1d')](_0x8448('0x1e'),upload[_0x8448('0x1f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x8448('0x20')]({'destination':function(_0x13ce09,_0x1436af,_0x40f9ad){_0x40f9ad(null,path[_0x8448('0x21')](config[_0x8448('0x18')],_0x8448('0x22')));},'filename':function(_0x4eeae6,_0x285ac9,_0x356d4a){_0x356d4a(null,util[_0x8448('0x19')](_0x8448('0x1a'),_0x8448('0x23'),path[_0x8448('0x1c')](_0x285ac9[_0x8448('0x24')])));}})});router[_0x8448('0x1d')](_0x8448('0x11'),upload[_0x8448('0x1f')](_0x8448('0x25')),controller[_0x8448('0x26')]);var upload=multer({'storage':multer[_0x8448('0x20')]({'destination':function(_0x340fb6,_0x2f9d10,_0x2bdbe5){_0x2bdbe5(null,path[_0x8448('0x21')](config[_0x8448('0x18')],_0x8448('0x22')));},'filename':function(_0x3309bb,_0x3f63d9,_0x617d00){_0x617d00(null,util[_0x8448('0x19')](_0x8448('0x1a'),_0x8448('0x27'),path['extname'](_0x3f63d9[_0x8448('0x24')])));}})});router[_0x8448('0x1d')](_0x8448('0x15'),upload[_0x8448('0x1f')](_0x8448('0x25')),controller[_0x8448('0x28')]);var upload=multer({'storage':multer[_0x8448('0x20')]({'destination':function(_0x32e183,_0x1e7f29,_0x1ee260){_0x1ee260(null,path[_0x8448('0x21')](config[_0x8448('0x18')],_0x8448('0x22')));},'filename':function(_0x288b5f,_0x38c671,_0x16dc88){_0x16dc88(null,util[_0x8448('0x19')](_0x8448('0x1a'),_0x8448('0x29'),path[_0x8448('0x1c')](_0x38c671['originalname'])));}})});router[_0x8448('0x1d')](_0x8448('0x2a'),upload['single'](_0x8448('0x25')),controller[_0x8448('0x2b')]);router[_0x8448('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0x8448('0x2d')]);module[_0x8448('0x2e')]=router; \ No newline at end of file +var _0x53c4=['server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','addLogoLogin','preferred','addPreferred','/:id/favicon','addFavicon','put','/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','diskStorage','join','root'];(function(_0x1678d7,_0x3a36d4){var _0x591741=function(_0x150e20){while(--_0x150e20){_0x1678d7['push'](_0x1678d7['shift']());}};_0x591741(++_0x3a36d4);}(_0x53c4,0xae));var _0x453c=function(_0x4f4934,_0x614c32){_0x4f4934=_0x4f4934-0x0;var _0x48446d=_0x53c4[_0x4f4934];return _0x48446d;};'use strict';var multer=require(_0x453c('0x0'));var util=require(_0x453c('0x1'));var path=require('path');var timeout=require(_0x453c('0x2'));var express=require(_0x453c('0x3'));var router=express['Router']();var fs_extra=require(_0x453c('0x4'));var auth=require(_0x453c('0x5'));var interaction=require(_0x453c('0x6'));var config=require(_0x453c('0x7'));var controller=require('./setting.controller');router[_0x453c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x453c('0x8')](_0x453c('0x9'),controller[_0x453c('0xa')]);router[_0x453c('0x8')]('/:id',controller['show']);router['get'](_0x453c('0xb'),controller[_0x453c('0xc')]);router[_0x453c('0x8')](_0x453c('0xd'),controller[_0x453c('0xe')]);router[_0x453c('0x8')]('/:id/gdpr',controller[_0x453c('0xf')]);router[_0x453c('0x8')](_0x453c('0x10'),controller[_0x453c('0x11')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x453c('0x12')]({'destination':function(_0x464aee,_0x6c35a1,_0xc8fab8){_0xc8fab8(null,path[_0x453c('0x13')](config[_0x453c('0x14')],_0x453c('0x15')));},'filename':function(_0x225740,_0x4ba1f6,_0x32c974){_0x32c974(null,util[_0x453c('0x16')](_0x453c('0x17'),_0x453c('0x18'),path[_0x453c('0x19')](_0x4ba1f6[_0x453c('0x1a')])));}})});router[_0x453c('0x1b')]('/:id/logo',upload[_0x453c('0x1c')](_0x453c('0x1d')),controller[_0x453c('0x1e')]);var upload=multer({'storage':multer[_0x453c('0x12')]({'destination':function(_0x1947cc,_0x1a223f,_0x1f3eec){_0x1f3eec(null,path[_0x453c('0x13')](config['root'],_0x453c('0x15')));},'filename':function(_0x45130c,_0x5af686,_0x2992ec){_0x2992ec(null,util[_0x453c('0x16')](_0x453c('0x17'),'logologin',path['extname'](_0x5af686[_0x453c('0x1a')])));}})});router[_0x453c('0x1b')](_0x453c('0xd'),upload['single'](_0x453c('0x1d')),controller[_0x453c('0x1f')]);var upload=multer({'storage':multer[_0x453c('0x12')]({'destination':function(_0x4678e9,_0x37b6c8,_0x55080e){_0x55080e(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x33819c,_0x5e4d30,_0x4a629b){_0x4a629b(null,util['format'](_0x453c('0x17'),_0x453c('0x20'),path['extname'](_0x5e4d30[_0x453c('0x1a')])));}})});router[_0x453c('0x1b')](_0x453c('0x10'),upload['single']('file'),controller[_0x453c('0x21')]);var upload=multer({'storage':multer[_0x453c('0x12')]({'destination':function(_0x1a0dd9,_0x3e91cb,_0x595f13){_0x595f13(null,path[_0x453c('0x13')](config[_0x453c('0x14')],_0x453c('0x15')));},'filename':function(_0x3e8cfe,_0x5293b8,_0x21d89c){_0x21d89c(null,util[_0x453c('0x16')](_0x453c('0x17'),'favicon',path[_0x453c('0x19')](_0x5293b8[_0x453c('0x1a')])));}})});router[_0x453c('0x1b')](_0x453c('0x22'),upload[_0x453c('0x1c')]('file'),controller[_0x453c('0x23')]);router[_0x453c('0x24')](_0x453c('0x25'),auth['isAuthenticated'](),controller['update']);module[_0x453c('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 4382bf7..7d48921 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3e090d,_0x4e889b){var _0x3372ae=function(_0x45f6b5){while(--_0x45f6b5){_0x3e090d['push'](_0x3e090d['shift']());}};_0x3372ae(++_0x4e889b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xe251e,_0xe81141){var _0x4e1c98=function(_0x20e3f1){while(--_0x20e3f1){_0xe251e['push'](_0xe251e['shift']());}};_0x4e1c98(++_0xe81141);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1d5463e..8e58c58 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 _0x6690=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','defaultPreferred','custom','default_loginLogo.svg','securePassword','getPreferred','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS'];(function(_0x201adb,_0x5c0474){var _0x13e1f7=function(_0x517428){while(--_0x517428){_0x201adb['push'](_0x201adb['shift']());}};_0x13e1f7(++_0x5c0474);}(_0x6690,0x7a));var _0x0669=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6690[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0669('0x0'));var zipdir=require(_0x0669('0x1'));var jsonpatch=require(_0x0669('0x2'));var rp=require(_0x0669('0x3'));var moment=require('moment');var BPromise=require(_0x0669('0x4'));var Mustache=require(_0x0669('0x5'));var util=require(_0x0669('0x6'));var path=require(_0x0669('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0669('0x8'));var _=require(_0x0669('0x9'));var squel=require(_0x0669('0xa'));var crypto=require('crypto');var jsforce=require(_0x0669('0xb'));var deskjs=require(_0x0669('0xc'));var toCsv=require(_0x0669('0xd'));var querystring=require('querystring');var Papa=require(_0x0669('0xe'));var Redis=require('ioredis');var authService=require(_0x0669('0xf'));var qs=require(_0x0669('0x10'));var as=require(_0x0669('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0669('0x12'))('api');var utils=require(_0x0669('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0669('0x14'))['db'];var jayson=require(_0x0669('0x15'));var client=jayson['client'][_0x0669('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xbd356f,_0x181ecb,_0xcbc72f,_0x41fd86){return new BPromise(function(_0x323455,_0x382ad1){var _0x24ee8b=_0x41fd86||client;return _0x24ee8b[_0x0669('0x17')](_0xbd356f,_0xcbc72f)['then'](function(_0x1858ed){logger['info'](_0x0669('0x18'),_0x181ecb,_0x0669('0x19'));logger['debug'](_0x0669('0x1a'),_0x181ecb,_0x0669('0x19'),JSON[_0x0669('0x1b')](_0x1858ed));if(_0x1858ed[_0x0669('0x1c')]){if(_0x1858ed['error'][_0x0669('0x1d')]===0x1f4){logger['error'](_0x0669('0x18'),_0x181ecb,_0x1858ed[_0x0669('0x1c')][_0x0669('0x1e')]);return _0x382ad1(_0x1858ed[_0x0669('0x1c')][_0x0669('0x1e')]);}logger['error']('Setting,\x20%s,\x20%s',_0x181ecb,_0x1858ed[_0x0669('0x1c')]['message']);return _0x323455(_0x1858ed[_0x0669('0x1c')][_0x0669('0x1e')]);}else{logger[_0x0669('0x1f')](_0x0669('0x18'),_0x181ecb,_0x0669('0x19'));_0x323455(_0x1858ed['result']['message']);}})[_0x0669('0x20')](function(_0x312e4a){logger[_0x0669('0x1c')](_0x0669('0x18'),_0x181ecb,_0x312e4a);_0x382ad1(_0x312e4a);});});}function respondWithStatusCode(_0x441aa8,_0x44f84e){_0x44f84e=_0x44f84e||0xcc;return function(_0x557d33){if(_0x557d33){return _0x441aa8[_0x0669('0x21')](_0x44f84e);}return _0x441aa8[_0x0669('0x22')](_0x44f84e)['end']();};}function respondWithResult(_0x154791,_0x184cbf){_0x184cbf=_0x184cbf||0xc8;return function(_0xe21283){if(_0xe21283){return _0x154791['status'](_0x184cbf)['json'](_0xe21283);}};}function respondWithFilteredResult(_0x45efe0,_0xa7f8c){return function(_0x2757f7){if(_0x2757f7){var _0x18323b=typeof _0xa7f8c['offset']===_0x0669('0x23')&&typeof _0xa7f8c[_0x0669('0x24')]===_0x0669('0x23');var _0x1c3c5c=_0x2757f7[_0x0669('0x25')];var _0x51b8f6=_0x18323b?0x0:_0xa7f8c[_0x0669('0x26')];var _0x3a2c24=_0x18323b?_0x2757f7[_0x0669('0x25')]:_0xa7f8c[_0x0669('0x26')]+_0xa7f8c['limit'];var _0x3c3a80;if(_0x3a2c24>=_0x1c3c5c){_0x3a2c24=_0x1c3c5c;_0x3c3a80=0xc8;}else{_0x3c3a80=0xce;}_0x45efe0[_0x0669('0x22')](_0x3c3a80);return _0x45efe0[_0x0669('0x27')](_0x0669('0x28'),_0x51b8f6+'-'+_0x3a2c24+'/'+_0x1c3c5c)['json'](_0x2757f7);}return null;};}function patchUpdates(_0x1c4568){return function(_0x570536){try{jsonpatch[_0x0669('0x29')](_0x570536,_0x1c4568,!![]);}catch(_0x33bc39){return BPromise[_0x0669('0x2a')](_0x33bc39);}return _0x570536['save']();};}function saveUpdates(_0x24787b,_0x39f7af){return function(_0x53b5d1){if(_0x53b5d1){return _0x53b5d1[_0x0669('0x2b')](_0x24787b)[_0x0669('0x2c')](function(_0x189dfa){return _0x189dfa;});}return null;};}function removeEntity(_0xbb8757,_0x44b6a0){return function(_0xc9a34){if(_0xc9a34){return _0xc9a34['destroy']()['then'](function(){_0xbb8757[_0x0669('0x22')](0xcc)[_0x0669('0x2d')]();});}};}function handleEntityNotFound(_0x3c41ab,_0x19f1b7){return function(_0x34f27d){if(!_0x34f27d){_0x3c41ab[_0x0669('0x21')](0x194);}return _0x34f27d;};}function handleError(_0x4e99a8,_0x3b7d29){_0x3b7d29=_0x3b7d29||0x1f4;return function(_0x4b6092){logger['error'](_0x4b6092[_0x0669('0x2e')]);if(_0x4b6092['name']){delete _0x4b6092[_0x0669('0x2f')];}_0x4e99a8['status'](_0x3b7d29)[_0x0669('0x30')](_0x4b6092);};}exports[_0x0669('0x31')]=function(_0x3a191f,_0x395666){var _0x10e326={},_0xb29d8b={},_0x4def23={'count':0x0,'rows':[]};var _0x415d95=_['map'](db[_0x0669('0x32')][_0x0669('0x33')],function(_0x3aef4c){return{'name':_0x3aef4c[_0x0669('0x34')],'type':_0x3aef4c[_0x0669('0x35')][_0x0669('0x36')]};});_0xb29d8b[_0x0669('0x37')]=_[_0x0669('0x38')](_0x415d95,_0x0669('0x2f'));_0xb29d8b['query']=_['keys'](_0x3a191f[_0x0669('0x39')]);_0xb29d8b[_0x0669('0x3a')]=_[_0x0669('0x3b')](_0xb29d8b['model'],_0xb29d8b['query']);_0x10e326['attributes']=_[_0x0669('0x3b')](_0xb29d8b[_0x0669('0x37')],qs[_0x0669('0x3c')](_0x3a191f[_0x0669('0x39')][_0x0669('0x3c')]));_0x10e326[_0x0669('0x3d')]=_0x10e326[_0x0669('0x3d')][_0x0669('0x3e')]?_0x10e326[_0x0669('0x3d')]:_0xb29d8b[_0x0669('0x37')];if(!_0x3a191f[_0x0669('0x39')][_0x0669('0x3f')](_0x0669('0x40'))){_0x10e326[_0x0669('0x24')]=qs['limit'](_0x3a191f[_0x0669('0x39')]['limit']);_0x10e326[_0x0669('0x26')]=qs[_0x0669('0x26')](_0x3a191f[_0x0669('0x39')][_0x0669('0x26')]);}_0x10e326[_0x0669('0x41')]=qs[_0x0669('0x42')](_0x3a191f['query']['sort']);_0x10e326['where']=qs[_0x0669('0x3a')](_[_0x0669('0x43')](_0x3a191f[_0x0669('0x39')],_0xb29d8b[_0x0669('0x3a')]),_0x415d95);if(_0x3a191f[_0x0669('0x39')][_0x0669('0x44')]){_0x10e326[_0x0669('0x45')]=_[_0x0669('0x46')](_0x10e326[_0x0669('0x45')],{'$or':_[_0x0669('0x38')](_0x415d95,function(_0x5d3d38){if(_0x5d3d38['type']!==_0x0669('0x47')){var _0x4245bd={};_0x4245bd[_0x5d3d38['name']]={'$like':'%'+_0x3a191f[_0x0669('0x39')][_0x0669('0x44')]+'%'};return _0x4245bd;}})});}_0x10e326=_[_0x0669('0x46')]({},_0x10e326,_0x3a191f[_0x0669('0x48')]);var _0x3fdee5={'where':_0x10e326[_0x0669('0x45')]};return db[_0x0669('0x32')][_0x0669('0x25')](_0x3fdee5)[_0x0669('0x2c')](function(_0x5edbc6){_0x4def23[_0x0669('0x25')]=_0x5edbc6;if(_0x3a191f[_0x0669('0x39')][_0x0669('0x49')]){_0x10e326[_0x0669('0x4a')]=[{'all':!![]}];}return db[_0x0669('0x32')][_0x0669('0x4b')](_0x10e326);})[_0x0669('0x2c')](function(_0xc83189){_0x4def23[_0x0669('0x4c')]=_0xc83189;return _0x4def23;})[_0x0669('0x2c')](respondWithFilteredResult(_0x395666,_0x10e326))[_0x0669('0x20')](handleError(_0x395666,null));};exports[_0x0669('0x4d')]=function(_0x167cb0,_0x2206f0){var _0x398fa9={'raw':![],'where':{'id':_0x167cb0['params']['id']}},_0x214b94={};_0x214b94[_0x0669('0x37')]=_[_0x0669('0x4e')](db[_0x0669('0x32')][_0x0669('0x33')]);_0x214b94[_0x0669('0x39')]=_['keys'](_0x167cb0['query']);_0x214b94[_0x0669('0x3a')]=_['intersection'](_0x214b94['model'],_0x214b94['query']);_0x398fa9[_0x0669('0x3d')]=_[_0x0669('0x3b')](_0x214b94[_0x0669('0x37')],qs[_0x0669('0x3c')](_0x167cb0[_0x0669('0x39')][_0x0669('0x3c')]));_0x398fa9[_0x0669('0x3d')]=_0x398fa9[_0x0669('0x3d')][_0x0669('0x3e')]?_0x398fa9[_0x0669('0x3d')]:_0x214b94[_0x0669('0x37')];if(_0x167cb0[_0x0669('0x39')][_0x0669('0x49')]){_0x398fa9[_0x0669('0x4a')]=[{'all':!![]}];}_0x398fa9=_[_0x0669('0x46')]({},_0x398fa9,_0x167cb0[_0x0669('0x48')]);return db[_0x0669('0x32')][_0x0669('0x4f')](_0x398fa9)[_0x0669('0x2c')](handleEntityNotFound(_0x2206f0,null))['then'](respondWithResult(_0x2206f0,null))['catch'](handleError(_0x2206f0,null));};exports[_0x0669('0x2b')]=function(_0x4a7b65,_0x2e05dc){if(_0x4a7b65[_0x0669('0x50')]['id']){delete _0x4a7b65['body']['id'];}return db[_0x0669('0x32')]['find']({'where':{'id':_0x4a7b65[_0x0669('0x51')]['id']}})[_0x0669('0x2c')](handleEntityNotFound(_0x2e05dc,null))[_0x0669('0x2c')](saveUpdates(_0x4a7b65[_0x0669('0x50')],null))['then'](respondWithResult(_0x2e05dc,null))[_0x0669('0x20')](handleError(_0x2e05dc,null));};exports[_0x0669('0x52')]=function(_0x3f15c0,_0x337e35,_0x325af6){if(_0x3f15c0[_0x0669('0x53')]&&_0x3f15c0[_0x0669('0x53')][_0x0669('0x54')]){_0x3f15c0[_0x0669('0x50')][_0x0669('0x55')]=_0x3f15c0[_0x0669('0x53')][_0x0669('0x54')];}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x3f15c0['params']['id']}})[_0x0669('0x2c')](handleEntityNotFound(_0x337e35,null))[_0x0669('0x2c')](saveUpdates(_0x3f15c0[_0x0669('0x50')],null))[_0x0669('0x2c')](respondWithResult(_0x337e35,null))[_0x0669('0x20')](handleError(_0x337e35,null));};exports[_0x0669('0x56')]=function(_0x402615,_0x40e8cc,_0x34d8ad){if(_0x402615[_0x0669('0x53')]&&_0x402615['file'][_0x0669('0x54')]){_0x402615[_0x0669('0x50')][_0x0669('0x57')]=_0x402615['file'][_0x0669('0x54')];}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x402615['params']['id']}})[_0x0669('0x2c')](handleEntityNotFound(_0x40e8cc,null))['then'](saveUpdates(_0x402615[_0x0669('0x50')],null))['then'](respondWithResult(_0x40e8cc,null))[_0x0669('0x20')](handleError(_0x40e8cc,null));};var utilLicense=require(_0x0669('0x58'));exports[_0x0669('0x59')]=function(_0x5f46b1,_0x4364cc,_0x8a32e8){var _0x654f46='server/files/images/logos';var _0x24db90={'custom':![]};return utilLicense[_0x0669('0x5a')]()[_0x0669('0x2c')](function(_0x26e5f5){if(_0x26e5f5){_0x24db90=_0x26e5f5;}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x5f46b1[_0x0669('0x51')]['id']},'attributes':[_0x0669('0x55'),_0x0669('0x57'),_0x0669('0x5b'),'favicon',_0x0669('0x5c'),'defaultLoginLogo','defaultPreferred',_0x0669('0x5d')],'raw':!![]});})[_0x0669('0x2c')](handleEntityNotFound(_0x4364cc,null))[_0x0669('0x2c')](function(_0x730015){if(_0x730015){var _0xf6a80e=_0x730015[_0x0669('0x55')]&&fs[_0x0669('0x5e')](path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x654f46,_['toLower'](_0x730015[_0x0669('0x55')])))?path[_0x0669('0x5f')](config['root'],_0x654f46,_['toLower'](_0x730015['logo'])):path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x654f46,_[_0x0669('0x61')]('default_logo.svg'));var _0x935953=_0x0669('0x62')+_[_0x0669('0x63')](_0x0669('0x55'));if(_0x730015[_0x935953]||!_0x24db90['custom']){_0xf6a80e=path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x654f46,_[_0x0669('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0xf6a80e)){throw new db[(_0x0669('0x64'))][(_0x0669('0x65'))](_[_0x0669('0x63')](_0x0669('0x55'))+_0x0669('0x66'));}return _0x4364cc[_0x0669('0x67')](_0xf6a80e);}})[_0x0669('0x20')](handleError(_0x4364cc,null));};var utilLicense=require(_0x0669('0x58'));exports[_0x0669('0x68')]=function(_0x19a807,_0x43de47,_0x41469b){var _0x36d7e4='server/files/images/logos';var _0xf13485={'custom':![]};return utilLicense[_0x0669('0x5a')]()[_0x0669('0x2c')](function(_0x682076){if(_0x682076){_0xf13485=_0x682076;}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x19a807[_0x0669('0x51')]['id']},'attributes':[_0x0669('0x55'),_0x0669('0x57'),_0x0669('0x5b'),_0x0669('0x69'),'defaultLogo',_0x0669('0x6a'),_0x0669('0x6b'),_0x0669('0x5d')],'raw':!![]});})[_0x0669('0x2c')](handleEntityNotFound(_0x43de47,null))[_0x0669('0x2c')](function(_0x192f6c){if(_0x192f6c){var _0x59c5b1=_0x192f6c[_0x0669('0x57')]&&fs[_0x0669('0x5e')](path['join'](config[_0x0669('0x60')],_0x36d7e4,_[_0x0669('0x61')](_0x192f6c['loginLogo'])))?path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x36d7e4,_['toLower'](_0x192f6c['loginLogo'])):path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x36d7e4,_[_0x0669('0x61')]('default_loginLogo.svg'));var _0x3f364e='default'+_['upperFirst'](_0x0669('0x57'));if(_0x192f6c[_0x3f364e]||!_0xf13485[_0x0669('0x6c')]){_0x59c5b1=path['join'](config[_0x0669('0x60')],_0x36d7e4,_[_0x0669('0x61')](_0x0669('0x6d')));}if(!fs[_0x0669('0x5e')](_0x59c5b1)){throw new db[(_0x0669('0x64'))][(_0x0669('0x65'))](_[_0x0669('0x63')](_0x0669('0x57'))+_0x0669('0x66'));}return _0x43de47[_0x0669('0x67')](_0x59c5b1);}})[_0x0669('0x20')](handleError(_0x43de47,null));};exports['gdpr']=function(_0x401c48,_0x20f1f9){return db['Setting'][_0x0669('0x4f')]({'where':{'id':_0x401c48[_0x0669('0x51')]['id']},'attributes':[_0x0669('0x6e')]})[_0x0669('0x2c')](respondWithResult(_0x20f1f9,null))[_0x0669('0x20')](handleError(_0x20f1f9,null));};exports['addPreferred']=function(_0x2292b9,_0x509230,_0x2ad4ab){if(_0x2292b9['file']&&_0x2292b9[_0x0669('0x53')][_0x0669('0x54')]){_0x2292b9['body'][_0x0669('0x5b')]=_0x2292b9[_0x0669('0x53')][_0x0669('0x54')];}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x2292b9[_0x0669('0x51')]['id']}})[_0x0669('0x2c')](handleEntityNotFound(_0x509230,null))[_0x0669('0x2c')](saveUpdates(_0x2292b9[_0x0669('0x50')],null))[_0x0669('0x2c')](respondWithResult(_0x509230,null))[_0x0669('0x20')](handleError(_0x509230,null));};var utilLicense=require('../../config/license/util');exports[_0x0669('0x6f')]=function(_0x71e6f6,_0x289c2b,_0x54e4cb){var _0x10718=_0x0669('0x70');var _0x19efbe={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xafb58d){if(_0xafb58d){_0x19efbe=_0xafb58d;}return db[_0x0669('0x32')][_0x0669('0x4f')]({'where':{'id':_0x71e6f6[_0x0669('0x51')]['id']},'attributes':[_0x0669('0x55'),_0x0669('0x57'),'preferred',_0x0669('0x69'),_0x0669('0x5c'),_0x0669('0x6a'),'defaultPreferred',_0x0669('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x289c2b,null))[_0x0669('0x2c')](function(_0x566e96){if(_0x566e96){var _0x1952b0=_0x566e96[_0x0669('0x5b')]&&fs[_0x0669('0x5e')](path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x10718,_[_0x0669('0x61')](_0x566e96[_0x0669('0x5b')])))?path[_0x0669('0x5f')](config['root'],_0x10718,_[_0x0669('0x61')](_0x566e96[_0x0669('0x5b')])):path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x10718,_[_0x0669('0x61')]('default_preferred.png'));var _0x407470='default'+_[_0x0669('0x63')]('preferred');if(_0x566e96[_0x407470]||!_0x19efbe[_0x0669('0x6c')]||!_0x19efbe[_0x0669('0x5b')]){_0x1952b0=path['join'](config[_0x0669('0x60')],_0x10718,_[_0x0669('0x61')](_0x0669('0x71')));}if(!fs[_0x0669('0x5e')](_0x1952b0)){throw new db[(_0x0669('0x64'))][(_0x0669('0x65'))](_[_0x0669('0x63')]('preferred')+'\x20not\x20found');}return _0x289c2b[_0x0669('0x67')](_0x1952b0);}})[_0x0669('0x20')](handleError(_0x289c2b,null));};exports[_0x0669('0x72')]=function(_0x17d181,_0x224404,_0x4d0e32){if(_0x17d181['file']&&_0x17d181[_0x0669('0x53')][_0x0669('0x54')]){_0x17d181[_0x0669('0x50')]['favicon']=_0x17d181[_0x0669('0x53')]['filename'];}return db['Setting'][_0x0669('0x4f')]({'where':{'id':_0x17d181[_0x0669('0x51')]['id']}})['then'](handleEntityNotFound(_0x224404,null))[_0x0669('0x2c')](saveUpdates(_0x17d181[_0x0669('0x50')],null))[_0x0669('0x2c')](respondWithResult(_0x224404,null))[_0x0669('0x20')](handleError(_0x224404,null));};var utilLicense=require(_0x0669('0x58'));exports[_0x0669('0x73')]=function(_0xcdd208,_0x7a5a19,_0x1c30ed){var _0x663b6e=_0x0669('0x70');var _0x59132b={'custom':![]};return utilLicense[_0x0669('0x5a')]()[_0x0669('0x2c')](function(_0x3cacf2){if(_0x3cacf2){_0x59132b=_0x3cacf2;}return db[_0x0669('0x32')]['find']({'where':{'id':_0xcdd208['params']['id']},'attributes':[_0x0669('0x55'),_0x0669('0x57'),_0x0669('0x5b'),_0x0669('0x69'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x0669('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x7a5a19,null))[_0x0669('0x2c')](function(_0x258999){if(_0x258999){var _0x36f1e5=_0x258999[_0x0669('0x69')]&&fs[_0x0669('0x5e')](path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x663b6e,_['toLower'](_0x258999[_0x0669('0x69')])))?path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x663b6e,_['toLower'](_0x258999['favicon'])):path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x663b6e,_[_0x0669('0x61')](_0x0669('0x74')));var _0x4a4480='default'+_[_0x0669('0x63')](_0x0669('0x69'));if(_0x258999[_0x4a4480]||!_0x59132b[_0x0669('0x6c')]){_0x36f1e5=path[_0x0669('0x5f')](config[_0x0669('0x60')],_0x663b6e,_[_0x0669('0x61')](_0x0669('0x74')));}if(!fs[_0x0669('0x5e')](_0x36f1e5)){throw new db[(_0x0669('0x64'))][(_0x0669('0x65'))](_[_0x0669('0x63')]('favicon')+_0x0669('0x66'));}return _0x7a5a19[_0x0669('0x67')](_0x36f1e5);}})[_0x0669('0x20')](handleError(_0x7a5a19,null));};exports[_0x0669('0x75')]=function(_0x23f540,_0x209b28){var _0x4090df={'offset':moment()[_0x0669('0x76')]()};_0x4090df[_0x0669('0x77')]=moment()['utcOffset'](_0x4090df[_0x0669('0x26')])[_0x0669('0x78')](_0x0669('0x79'));return _0x209b28['status'](0xc8)[_0x0669('0x30')](_0x4090df);}; \ No newline at end of file +var _0x71ec=['count','set','Content-Range','apply','reject','save','update','name','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','length','find','catch','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','download','getLogoLogin','server/files/images/logos','defaultLoginLogo','default_loginLogo.svg','custom','\x20not\x20found','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x1653bb,_0x2575c5){var _0x4f9850=function(_0x1392ce){while(--_0x1392ce){_0x1653bb['push'](_0x1653bb['shift']());}};_0x4f9850(++_0x2575c5);}(_0x71ec,0x13d));var _0xc71e=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0x71ec[_0x3cba1d];return _0x5f192b;};'use strict';var emlformat=require(_0xc71e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc71e('0x1'));var jsonpatch=require(_0xc71e('0x2'));var rp=require(_0xc71e('0x3'));var moment=require(_0xc71e('0x4'));var BPromise=require(_0xc71e('0x5'));var Mustache=require('mustache');var util=require(_0xc71e('0x6'));var path=require(_0xc71e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc71e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc71e('0x9'));var squel=require(_0xc71e('0xa'));var crypto=require(_0xc71e('0xb'));var jsforce=require(_0xc71e('0xc'));var deskjs=require(_0xc71e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc71e('0xe'));var Papa=require(_0xc71e('0xf'));var Redis=require(_0xc71e('0x10'));var authService=require(_0xc71e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc71e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc71e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc71e('0x14'));var db=require(_0xc71e('0x15'))['db'];var jayson=require(_0xc71e('0x16'));var client=jayson[_0xc71e('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48c93c,_0x2b9281,_0x1bb164,_0x4c0914){return new BPromise(function(_0x1394d2,_0x56bf08){var _0x59d45f=_0x4c0914||client;return _0x59d45f[_0xc71e('0x18')](_0x48c93c,_0x1bb164)[_0xc71e('0x19')](function(_0x5d6cbf){logger['info'](_0xc71e('0x1a'),_0x2b9281,_0xc71e('0x1b'));logger[_0xc71e('0x1c')](_0xc71e('0x1d'),_0x2b9281,_0xc71e('0x1b'),JSON[_0xc71e('0x1e')](_0x5d6cbf));if(_0x5d6cbf[_0xc71e('0x1f')]){if(_0x5d6cbf[_0xc71e('0x1f')][_0xc71e('0x20')]===0x1f4){logger[_0xc71e('0x1f')]('Setting,\x20%s,\x20%s',_0x2b9281,_0x5d6cbf['error'][_0xc71e('0x21')]);return _0x56bf08(_0x5d6cbf[_0xc71e('0x1f')][_0xc71e('0x21')]);}logger[_0xc71e('0x1f')]('Setting,\x20%s,\x20%s',_0x2b9281,_0x5d6cbf[_0xc71e('0x1f')]['message']);return _0x1394d2(_0x5d6cbf['error'][_0xc71e('0x21')]);}else{logger[_0xc71e('0x22')](_0xc71e('0x1a'),_0x2b9281,_0xc71e('0x1b'));_0x1394d2(_0x5d6cbf[_0xc71e('0x23')][_0xc71e('0x21')]);}})['catch'](function(_0x1ea7a7){logger['error'](_0xc71e('0x1a'),_0x2b9281,_0x1ea7a7);_0x56bf08(_0x1ea7a7);});});}function respondWithStatusCode(_0x30e291,_0x4eef41){_0x4eef41=_0x4eef41||0xcc;return function(_0x3341ea){if(_0x3341ea){return _0x30e291[_0xc71e('0x24')](_0x4eef41);}return _0x30e291[_0xc71e('0x25')](_0x4eef41)[_0xc71e('0x26')]();};}function respondWithResult(_0x4e309d,_0x340a1e){_0x340a1e=_0x340a1e||0xc8;return function(_0x422f6f){if(_0x422f6f){return _0x4e309d[_0xc71e('0x25')](_0x340a1e)[_0xc71e('0x27')](_0x422f6f);}};}function respondWithFilteredResult(_0x1dd34d,_0x595aba){return function(_0x1b7604){if(_0x1b7604){var _0x1a38ac=typeof _0x595aba[_0xc71e('0x28')]==='undefined'&&typeof _0x595aba[_0xc71e('0x29')]===_0xc71e('0x2a');var _0x52e6d9=_0x1b7604[_0xc71e('0x2b')];var _0x52f712=_0x1a38ac?0x0:_0x595aba[_0xc71e('0x28')];var _0xb3f06a=_0x1a38ac?_0x1b7604['count']:_0x595aba[_0xc71e('0x28')]+_0x595aba['limit'];var _0x20e474;if(_0xb3f06a>=_0x52e6d9){_0xb3f06a=_0x52e6d9;_0x20e474=0xc8;}else{_0x20e474=0xce;}_0x1dd34d[_0xc71e('0x25')](_0x20e474);return _0x1dd34d[_0xc71e('0x2c')](_0xc71e('0x2d'),_0x52f712+'-'+_0xb3f06a+'/'+_0x52e6d9)[_0xc71e('0x27')](_0x1b7604);}return null;};}function patchUpdates(_0x4b2ccf){return function(_0x3bb1d7){try{jsonpatch[_0xc71e('0x2e')](_0x3bb1d7,_0x4b2ccf,!![]);}catch(_0x2cab3a){return BPromise[_0xc71e('0x2f')](_0x2cab3a);}return _0x3bb1d7[_0xc71e('0x30')]();};}function saveUpdates(_0x3d8f7b,_0x464de0){return function(_0x31886e){if(_0x31886e){return _0x31886e[_0xc71e('0x31')](_0x3d8f7b)[_0xc71e('0x19')](function(_0xa8e535){return _0xa8e535;});}return null;};}function removeEntity(_0x50736f,_0x59ce27){return function(_0xdac51e){if(_0xdac51e){return _0xdac51e['destroy']()[_0xc71e('0x19')](function(){_0x50736f['status'](0xcc)[_0xc71e('0x26')]();});}};}function handleEntityNotFound(_0x55969e,_0x31e262){return function(_0x41d012){if(!_0x41d012){_0x55969e[_0xc71e('0x24')](0x194);}return _0x41d012;};}function handleError(_0x385150,_0x113e2e){_0x113e2e=_0x113e2e||0x1f4;return function(_0x512fb2){logger[_0xc71e('0x1f')](_0x512fb2['stack']);if(_0x512fb2['name']){delete _0x512fb2[_0xc71e('0x32')];}_0x385150[_0xc71e('0x25')](_0x113e2e)['send'](_0x512fb2);};}exports['index']=function(_0x2c03a7,_0xad6e7f){var _0x1a795a={},_0x3d543c={},_0xe35b35={'count':0x0,'rows':[]};var _0x2adbf3=_['map'](db[_0xc71e('0x33')]['rawAttributes'],function(_0x51d4b8){return{'name':_0x51d4b8[_0xc71e('0x34')],'type':_0x51d4b8[_0xc71e('0x35')][_0xc71e('0x36')]};});_0x3d543c[_0xc71e('0x37')]=_['map'](_0x2adbf3,'name');_0x3d543c[_0xc71e('0x38')]=_[_0xc71e('0x39')](_0x2c03a7['query']);_0x3d543c['filters']=_[_0xc71e('0x3a')](_0x3d543c[_0xc71e('0x37')],_0x3d543c[_0xc71e('0x38')]);_0x1a795a[_0xc71e('0x3b')]=_[_0xc71e('0x3a')](_0x3d543c[_0xc71e('0x37')],qs['fields'](_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x3c')]));_0x1a795a[_0xc71e('0x3b')]=_0x1a795a[_0xc71e('0x3b')]['length']?_0x1a795a['attributes']:_0x3d543c[_0xc71e('0x37')];if(!_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x3d')](_0xc71e('0x3e'))){_0x1a795a['limit']=qs['limit'](_0x2c03a7['query'][_0xc71e('0x29')]);_0x1a795a['offset']=qs['offset'](_0x2c03a7['query'][_0xc71e('0x28')]);}_0x1a795a[_0xc71e('0x3f')]=qs[_0xc71e('0x40')](_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x40')]);_0x1a795a[_0xc71e('0x41')]=qs[_0xc71e('0x42')](_['pick'](_0x2c03a7[_0xc71e('0x38')],_0x3d543c['filters']),_0x2adbf3);if(_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x43')]){_0x1a795a[_0xc71e('0x41')]=_[_0xc71e('0x44')](_0x1a795a[_0xc71e('0x41')],{'$or':_['map'](_0x2adbf3,function(_0x551a7b){if(_0x551a7b[_0xc71e('0x35')]!==_0xc71e('0x45')){var _0x114d1d={};_0x114d1d[_0x551a7b[_0xc71e('0x32')]]={'$like':'%'+_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x43')]+'%'};return _0x114d1d;}})});}_0x1a795a=_['merge']({},_0x1a795a,_0x2c03a7[_0xc71e('0x46')]);var _0x1524e7={'where':_0x1a795a['where']};return db[_0xc71e('0x33')][_0xc71e('0x2b')](_0x1524e7)['then'](function(_0x41ef9f){_0xe35b35[_0xc71e('0x2b')]=_0x41ef9f;if(_0x2c03a7[_0xc71e('0x38')][_0xc71e('0x47')]){_0x1a795a['include']=[{'all':!![]}];}return db[_0xc71e('0x33')][_0xc71e('0x48')](_0x1a795a);})[_0xc71e('0x19')](function(_0x57a38a){_0xe35b35[_0xc71e('0x49')]=_0x57a38a;return _0xe35b35;})[_0xc71e('0x19')](respondWithFilteredResult(_0xad6e7f,_0x1a795a))['catch'](handleError(_0xad6e7f,null));};exports[_0xc71e('0x4a')]=function(_0xb3ed9d,_0xe216f6){var _0x45baea={'raw':![],'where':{'id':_0xb3ed9d['params']['id']}},_0xf25975={};_0xf25975[_0xc71e('0x37')]=_[_0xc71e('0x39')](db[_0xc71e('0x33')][_0xc71e('0x4b')]);_0xf25975[_0xc71e('0x38')]=_['keys'](_0xb3ed9d[_0xc71e('0x38')]);_0xf25975[_0xc71e('0x42')]=_[_0xc71e('0x3a')](_0xf25975['model'],_0xf25975[_0xc71e('0x38')]);_0x45baea['attributes']=_[_0xc71e('0x3a')](_0xf25975[_0xc71e('0x37')],qs['fields'](_0xb3ed9d[_0xc71e('0x38')][_0xc71e('0x3c')]));_0x45baea[_0xc71e('0x3b')]=_0x45baea[_0xc71e('0x3b')][_0xc71e('0x4c')]?_0x45baea['attributes']:_0xf25975[_0xc71e('0x37')];if(_0xb3ed9d[_0xc71e('0x38')][_0xc71e('0x47')]){_0x45baea['include']=[{'all':!![]}];}_0x45baea=_[_0xc71e('0x44')]({},_0x45baea,_0xb3ed9d[_0xc71e('0x46')]);return db[_0xc71e('0x33')][_0xc71e('0x4d')](_0x45baea)[_0xc71e('0x19')](handleEntityNotFound(_0xe216f6,null))[_0xc71e('0x19')](respondWithResult(_0xe216f6,null))[_0xc71e('0x4e')](handleError(_0xe216f6,null));};exports[_0xc71e('0x31')]=function(_0xd93bbb,_0x115714){if(_0xd93bbb[_0xc71e('0x4f')]['id']){delete _0xd93bbb[_0xc71e('0x4f')]['id'];}return db['Setting'][_0xc71e('0x4d')]({'where':{'id':_0xd93bbb[_0xc71e('0x50')]['id']}})[_0xc71e('0x19')](handleEntityNotFound(_0x115714,null))[_0xc71e('0x19')](saveUpdates(_0xd93bbb['body'],null))['then'](respondWithResult(_0x115714,null))[_0xc71e('0x4e')](handleError(_0x115714,null));};exports[_0xc71e('0x51')]=function(_0x171b89,_0x523030,_0x186a7){if(_0x171b89[_0xc71e('0x52')]&&_0x171b89['file'][_0xc71e('0x53')]){_0x171b89[_0xc71e('0x4f')][_0xc71e('0x54')]=_0x171b89[_0xc71e('0x52')]['filename'];}return db['Setting'][_0xc71e('0x4d')]({'where':{'id':_0x171b89[_0xc71e('0x50')]['id']}})[_0xc71e('0x19')](handleEntityNotFound(_0x523030,null))[_0xc71e('0x19')](saveUpdates(_0x171b89[_0xc71e('0x4f')],null))['then'](respondWithResult(_0x523030,null))[_0xc71e('0x4e')](handleError(_0x523030,null));};exports[_0xc71e('0x55')]=function(_0x368f89,_0x52e18d,_0x3a9c54){if(_0x368f89[_0xc71e('0x52')]&&_0x368f89[_0xc71e('0x52')][_0xc71e('0x53')]){_0x368f89['body'][_0xc71e('0x56')]=_0x368f89['file'][_0xc71e('0x53')];}return db[_0xc71e('0x33')]['find']({'where':{'id':_0x368f89[_0xc71e('0x50')]['id']}})['then'](handleEntityNotFound(_0x52e18d,null))['then'](saveUpdates(_0x368f89[_0xc71e('0x4f')],null))[_0xc71e('0x19')](respondWithResult(_0x52e18d,null))[_0xc71e('0x4e')](handleError(_0x52e18d,null));};var utilLicense=require(_0xc71e('0x14'));exports[_0xc71e('0x57')]=function(_0x5c506d,_0x2d1c8e,_0x47baca){var _0x517f09='server/files/images/logos';var _0xb7a259={'custom':![]};return utilLicense['getLicense']()[_0xc71e('0x19')](function(_0x1c7a91){if(_0x1c7a91){_0xb7a259=_0x1c7a91;}return db['Setting'][_0xc71e('0x4d')]({'where':{'id':_0x5c506d[_0xc71e('0x50')]['id']},'attributes':['logo',_0xc71e('0x56'),_0xc71e('0x58'),_0xc71e('0x59'),_0xc71e('0x5a'),'defaultLoginLogo',_0xc71e('0x5b'),_0xc71e('0x5c')],'raw':!![]});})[_0xc71e('0x19')](handleEntityNotFound(_0x2d1c8e,null))[_0xc71e('0x19')](function(_0x58bd0d){if(_0x58bd0d){var _0x13c5ca=_0x58bd0d[_0xc71e('0x54')]&&fs[_0xc71e('0x5d')](path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x517f09,_[_0xc71e('0x60')](_0x58bd0d['logo'])))?path['join'](config[_0xc71e('0x5f')],_0x517f09,_['toLower'](_0x58bd0d[_0xc71e('0x54')])):path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x517f09,_[_0xc71e('0x60')](_0xc71e('0x61')));var _0x4dd55a=_0xc71e('0x62')+_[_0xc71e('0x63')](_0xc71e('0x54'));if(_0x58bd0d[_0x4dd55a]||!_0xb7a259['custom']){_0x13c5ca=path[_0xc71e('0x5e')](config['root'],_0x517f09,_['toLower'](_0xc71e('0x61')));}if(!fs[_0xc71e('0x5d')](_0x13c5ca)){throw new db[(_0xc71e('0x64'))][(_0xc71e('0x65'))](_[_0xc71e('0x63')](_0xc71e('0x54'))+'\x20not\x20found');}return _0x2d1c8e[_0xc71e('0x66')](_0x13c5ca);}})[_0xc71e('0x4e')](handleError(_0x2d1c8e,null));};var utilLicense=require(_0xc71e('0x14'));exports[_0xc71e('0x67')]=function(_0x3b7195,_0x1f0119,_0x5ddcb9){var _0x21c1d5=_0xc71e('0x68');var _0x1341e5={'custom':![]};return utilLicense['getLicense']()[_0xc71e('0x19')](function(_0x5a4b3b){if(_0x5a4b3b){_0x1341e5=_0x5a4b3b;}return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0x3b7195['params']['id']},'attributes':[_0xc71e('0x54'),_0xc71e('0x56'),'preferred',_0xc71e('0x59'),_0xc71e('0x5a'),_0xc71e('0x69'),'defaultPreferred',_0xc71e('0x5c')],'raw':!![]});})[_0xc71e('0x19')](handleEntityNotFound(_0x1f0119,null))[_0xc71e('0x19')](function(_0x4e3125){if(_0x4e3125){var _0x77c45f=_0x4e3125[_0xc71e('0x56')]&&fs[_0xc71e('0x5d')](path[_0xc71e('0x5e')](config['root'],_0x21c1d5,_[_0xc71e('0x60')](_0x4e3125['loginLogo'])))?path['join'](config[_0xc71e('0x5f')],_0x21c1d5,_[_0xc71e('0x60')](_0x4e3125[_0xc71e('0x56')])):path['join'](config[_0xc71e('0x5f')],_0x21c1d5,_[_0xc71e('0x60')](_0xc71e('0x6a')));var _0xf8c756=_0xc71e('0x62')+_[_0xc71e('0x63')](_0xc71e('0x56'));if(_0x4e3125[_0xf8c756]||!_0x1341e5[_0xc71e('0x6b')]){_0x77c45f=path[_0xc71e('0x5e')](config['root'],_0x21c1d5,_[_0xc71e('0x60')]('default_loginLogo.svg'));}if(!fs[_0xc71e('0x5d')](_0x77c45f)){throw new db[(_0xc71e('0x64'))]['ValidationError'](_[_0xc71e('0x63')](_0xc71e('0x56'))+_0xc71e('0x6c'));}return _0x1f0119[_0xc71e('0x66')](_0x77c45f);}})[_0xc71e('0x4e')](handleError(_0x1f0119,null));};exports['gdpr']=function(_0xc9d87f,_0x4fa9cb){return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0xc9d87f[_0xc71e('0x50')]['id']},'attributes':[_0xc71e('0x6d')]})[_0xc71e('0x19')](respondWithResult(_0x4fa9cb,null))[_0xc71e('0x4e')](handleError(_0x4fa9cb,null));};exports[_0xc71e('0x6e')]=function(_0x49f981,_0x43f586,_0x24616f){if(_0x49f981[_0xc71e('0x52')]&&_0x49f981[_0xc71e('0x52')][_0xc71e('0x53')]){_0x49f981[_0xc71e('0x4f')][_0xc71e('0x58')]=_0x49f981[_0xc71e('0x52')][_0xc71e('0x53')];}return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0x49f981[_0xc71e('0x50')]['id']}})[_0xc71e('0x19')](handleEntityNotFound(_0x43f586,null))[_0xc71e('0x19')](saveUpdates(_0x49f981[_0xc71e('0x4f')],null))[_0xc71e('0x19')](respondWithResult(_0x43f586,null))[_0xc71e('0x4e')](handleError(_0x43f586,null));};var utilLicense=require(_0xc71e('0x14'));exports[_0xc71e('0x6f')]=function(_0x454225,_0x1a263c,_0x7049dc){var _0x5a8b89=_0xc71e('0x68');var _0x5cdfc8={'custom':![]};return utilLicense[_0xc71e('0x70')]()[_0xc71e('0x19')](function(_0x50e8f4){if(_0x50e8f4){_0x5cdfc8=_0x50e8f4;}return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0x454225[_0xc71e('0x50')]['id']},'attributes':['logo',_0xc71e('0x56'),_0xc71e('0x58'),'favicon','defaultLogo',_0xc71e('0x69'),_0xc71e('0x5b'),_0xc71e('0x5c')],'raw':!![]});})[_0xc71e('0x19')](handleEntityNotFound(_0x1a263c,null))[_0xc71e('0x19')](function(_0x4cd9b4){if(_0x4cd9b4){var _0x48153b=_0x4cd9b4['preferred']&&fs['existsSync'](path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x5a8b89,_['toLower'](_0x4cd9b4[_0xc71e('0x58')])))?path[_0xc71e('0x5e')](config['root'],_0x5a8b89,_[_0xc71e('0x60')](_0x4cd9b4['preferred'])):path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x5a8b89,_[_0xc71e('0x60')](_0xc71e('0x71')));var _0xddd6c7=_0xc71e('0x62')+_['upperFirst'](_0xc71e('0x58'));if(_0x4cd9b4[_0xddd6c7]||!_0x5cdfc8['custom']||!_0x5cdfc8[_0xc71e('0x58')]){_0x48153b=path['join'](config['root'],_0x5a8b89,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x48153b)){throw new db[(_0xc71e('0x64'))][(_0xc71e('0x65'))](_[_0xc71e('0x63')]('preferred')+_0xc71e('0x6c'));}return _0x1a263c[_0xc71e('0x66')](_0x48153b);}})[_0xc71e('0x4e')](handleError(_0x1a263c,null));};exports[_0xc71e('0x72')]=function(_0x1b58ea,_0x4d7bc3,_0x582250){if(_0x1b58ea[_0xc71e('0x52')]&&_0x1b58ea[_0xc71e('0x52')]['filename']){_0x1b58ea['body'][_0xc71e('0x59')]=_0x1b58ea['file'][_0xc71e('0x53')];}return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0x1b58ea[_0xc71e('0x50')]['id']}})[_0xc71e('0x19')](handleEntityNotFound(_0x4d7bc3,null))[_0xc71e('0x19')](saveUpdates(_0x1b58ea[_0xc71e('0x4f')],null))['then'](respondWithResult(_0x4d7bc3,null))[_0xc71e('0x4e')](handleError(_0x4d7bc3,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x42967b,_0x50b306,_0x6b2ecf){var _0x509cb8=_0xc71e('0x68');var _0x606e01={'custom':![]};return utilLicense[_0xc71e('0x70')]()[_0xc71e('0x19')](function(_0x3486f3){if(_0x3486f3){_0x606e01=_0x3486f3;}return db[_0xc71e('0x33')][_0xc71e('0x4d')]({'where':{'id':_0x42967b[_0xc71e('0x50')]['id']},'attributes':[_0xc71e('0x54'),_0xc71e('0x56'),_0xc71e('0x58'),_0xc71e('0x59'),_0xc71e('0x5a'),_0xc71e('0x69'),_0xc71e('0x5b'),'defaultFavicon'],'raw':!![]});})[_0xc71e('0x19')](handleEntityNotFound(_0x50b306,null))[_0xc71e('0x19')](function(_0x322447){if(_0x322447){var _0x249bf2=_0x322447['favicon']&&fs['existsSync'](path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x509cb8,_[_0xc71e('0x60')](_0x322447['favicon'])))?path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x509cb8,_[_0xc71e('0x60')](_0x322447['favicon'])):path[_0xc71e('0x5e')](config[_0xc71e('0x5f')],_0x509cb8,_[_0xc71e('0x60')](_0xc71e('0x73')));var _0x2e9b9a=_0xc71e('0x62')+_[_0xc71e('0x63')](_0xc71e('0x59'));if(_0x322447[_0x2e9b9a]||!_0x606e01[_0xc71e('0x6b')]){_0x249bf2=path[_0xc71e('0x5e')](config['root'],_0x509cb8,_[_0xc71e('0x60')](_0xc71e('0x73')));}if(!fs['existsSync'](_0x249bf2)){throw new db['Sequelize'][(_0xc71e('0x65'))](_['upperFirst'](_0xc71e('0x59'))+'\x20not\x20found');}return _0x50b306[_0xc71e('0x66')](_0x249bf2);}})[_0xc71e('0x4e')](handleError(_0x50b306,null));};exports['getDate']=function(_0x55cffc,_0x2677a){var _0x250711={'offset':moment()[_0xc71e('0x74')]()};_0x250711['now']=moment()['utcOffset'](_0x250711[_0xc71e('0x28')])[_0xc71e('0x75')](_0xc71e('0x76'));return _0x2677a[_0xc71e('0x25')](0xc8)[_0xc71e('0x77')](_0x250711);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1acaa97..92c714e 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x317cc5,_0x3b6179){var _0x44fe81=function(_0x3b43b5){while(--_0x3b43b5){_0x317cc5['push'](_0x317cc5['shift']());}};_0x44fe81(++_0x3b6179);}(_0x008c,0x188));var _0xc008=function(_0x4af6a0,_0x522121){_0x4af6a0=_0x4af6a0-0x0;var _0x4c2b23=_0x008c[_0x4af6a0];return _0x4c2b23;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x222529,_0x5f0c50){var _0x4384ab=function(_0x318a68){while(--_0x318a68){_0x222529['push'](_0x222529['shift']());}};_0x4384ab(++_0x5f0c50);}(_0xe14b,0x93));var _0xbe14=function(_0x521140,_0x3e815f){_0x521140=_0x521140-0x0;var _0x542ff0=_0xe14b[_0x521140];return _0x542ff0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c0066b0..39de78d 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 _0xabd8=['code','message','result','catch','ShowSetting','options','raw','where','attributes','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59ed8c,_0x497c0f){var _0x2ae760=function(_0x5e0c08){while(--_0x5e0c08){_0x59ed8c['push'](_0x59ed8c['shift']());}};_0x2ae760(++_0x497c0f);}(_0xabd8,0x84));var _0x8abd=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xabd8[_0x14a0a0];return _0x56b651;};'use strict';var _=require('lodash');var util=require(_0x8abd('0x0'));var moment=require(_0x8abd('0x1'));var BPromise=require('bluebird');var rs=require(_0x8abd('0x2'));var fs=require('fs');var Redis=require(_0x8abd('0x3'));var db=require(_0x8abd('0x4'))['db'];var utils=require(_0x8abd('0x5'));var logger=require(_0x8abd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8abd('0x7'));var client=jayson['client'][_0x8abd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cba1e,_0x139eef,_0xbf7a93){return new BPromise(function(_0x581d00,_0x5f40a2){return client[_0x8abd('0x9')](_0x5cba1e,_0xbf7a93)[_0x8abd('0xa')](function(_0x5d10d3){logger[_0x8abd('0xb')](_0x8abd('0xc'),_0x139eef,_0x8abd('0xd'));logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x139eef,_0x8abd('0xd'),JSON[_0x8abd('0x10')](_0x5d10d3));if(_0x5d10d3[_0x8abd('0x11')]){if(_0x5d10d3[_0x8abd('0x11')][_0x8abd('0x12')]===0x1f4){logger[_0x8abd('0x11')]('Setting,\x20%s,\x20%s',_0x139eef,_0x5d10d3['error'][_0x8abd('0x13')]);return _0x5f40a2(_0x5d10d3[_0x8abd('0x11')][_0x8abd('0x13')]);}logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x139eef,_0x5d10d3['error'][_0x8abd('0x13')]);return _0x581d00(_0x5d10d3['error'][_0x8abd('0x13')]);}else{logger[_0x8abd('0xb')]('Setting,\x20%s,\x20%s',_0x139eef,_0x8abd('0xd'));_0x581d00(_0x5d10d3[_0x8abd('0x14')][_0x8abd('0x13')]);}})[_0x8abd('0x15')](function(_0x3ebb5e){logger[_0x8abd('0x11')](_0x8abd('0xc'),_0x139eef,_0x3ebb5e);_0x5f40a2(_0x3ebb5e);});});}exports[_0x8abd('0x16')]=function(_0x2ec1b8){var _0x311ebe=this;return new Promise(function(_0x20cc40,_0x1c865b){return db['Setting']['find']({'raw':_0x2ec1b8[_0x8abd('0x17')]?_0x2ec1b8[_0x8abd('0x17')][_0x8abd('0x18')]===undefined?!![]:![]:!![],'where':_0x2ec1b8[_0x8abd('0x17')]?_0x2ec1b8[_0x8abd('0x17')][_0x8abd('0x19')]||null:null,'attributes':_0x2ec1b8[_0x8abd('0x17')]?_0x2ec1b8[_0x8abd('0x17')][_0x8abd('0x1a')]||null:null,'include':_0x2ec1b8[_0x8abd('0x17')]?_0x2ec1b8['options']['include']?_[_0x8abd('0x1b')](_0x2ec1b8[_0x8abd('0x17')][_0x8abd('0x1c')],function(_0x3f2629){return{'model':db[_0x3f2629[_0x8abd('0x1d')]],'as':_0x3f2629['as'],'attributes':_0x3f2629[_0x8abd('0x1a')],'include':_0x3f2629[_0x8abd('0x1c')]?_[_0x8abd('0x1b')](_0x3f2629[_0x8abd('0x1c')],function(_0x148a40){return{'model':db[_0x148a40[_0x8abd('0x1d')]],'as':_0x148a40['as'],'attributes':_0x148a40[_0x8abd('0x1a')],'include':_0x148a40[_0x8abd('0x1c')]?_[_0x8abd('0x1b')](_0x148a40[_0x8abd('0x1c')],function(_0x131f2b){return{'model':db[_0x131f2b[_0x8abd('0x1d')]],'as':_0x131f2b['as'],'attributes':_0x131f2b[_0x8abd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ead8){logger[_0x8abd('0xb')](_0x8abd('0x16'),_0x2ec1b8);logger[_0x8abd('0xe')](_0x8abd('0x16'),_0x2ec1b8,JSON[_0x8abd('0x10')](_0x19ead8));_0x20cc40(_0x19ead8);})[_0x8abd('0x15')](function(_0x5ea2be){logger[_0x8abd('0x11')]('ShowSetting',_0x5ea2be[_0x8abd('0x13')],_0x2ec1b8);_0x1c865b(_0x311ebe[_0x8abd('0x11')](0x1f4,_0x5ea2be[_0x8abd('0x13')]));});});}; \ No newline at end of file +var _0xaceb=['stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2af443,_0x5b28b5){var _0x5397a2=function(_0x19d302){while(--_0x19d302){_0x2af443['push'](_0x2af443['shift']());}};_0x5397a2(++_0x5b28b5);}(_0xaceb,0x1c1));var _0xbace=function(_0x2281be,_0x429b4e){_0x2281be=_0x2281be-0x0;var _0xc2c38f=_0xaceb[_0x2281be];return _0xc2c38f;};'use strict';var _=require('lodash');var util=require(_0xbace('0x0'));var moment=require('moment');var BPromise=require(_0xbace('0x1'));var rs=require(_0xbace('0x2'));var fs=require('fs');var Redis=require(_0xbace('0x3'));var db=require(_0xbace('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbace('0x5'))(_0xbace('0x6'));var config=require(_0xbace('0x7'));var jayson=require(_0xbace('0x8'));var client=jayson['client'][_0xbace('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d6b6,_0x3ec774,_0x1260da){return new BPromise(function(_0x4da20f,_0xd57ccd){return client[_0xbace('0xa')](_0x18d6b6,_0x1260da)[_0xbace('0xb')](function(_0x3b83a5){logger[_0xbace('0xc')](_0xbace('0xd'),_0x3ec774,_0xbace('0xe'));logger[_0xbace('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x3ec774,_0xbace('0xe'),JSON[_0xbace('0x10')](_0x3b83a5));if(_0x3b83a5[_0xbace('0x11')]){if(_0x3b83a5[_0xbace('0x11')][_0xbace('0x12')]===0x1f4){logger[_0xbace('0x11')]('Setting,\x20%s,\x20%s',_0x3ec774,_0x3b83a5[_0xbace('0x11')][_0xbace('0x13')]);return _0xd57ccd(_0x3b83a5[_0xbace('0x11')]['message']);}logger[_0xbace('0x11')](_0xbace('0xd'),_0x3ec774,_0x3b83a5['error'][_0xbace('0x13')]);return _0x4da20f(_0x3b83a5[_0xbace('0x11')][_0xbace('0x13')]);}else{logger[_0xbace('0xc')](_0xbace('0xd'),_0x3ec774,'request\x20sent');_0x4da20f(_0x3b83a5['result'][_0xbace('0x13')]);}})[_0xbace('0x14')](function(_0x26e74c){logger[_0xbace('0x11')](_0xbace('0xd'),_0x3ec774,_0x26e74c);_0xd57ccd(_0x26e74c);});});}exports[_0xbace('0x15')]=function(_0x45f8d7){var _0x303f1c=this;return new Promise(function(_0x11846e,_0x4b81e4){return db[_0xbace('0x16')][_0xbace('0x17')]({'raw':_0x45f8d7[_0xbace('0x18')]?_0x45f8d7['options'][_0xbace('0x19')]===undefined?!![]:![]:!![],'where':_0x45f8d7['options']?_0x45f8d7[_0xbace('0x18')][_0xbace('0x1a')]||null:null,'attributes':_0x45f8d7['options']?_0x45f8d7[_0xbace('0x18')][_0xbace('0x1b')]||null:null,'include':_0x45f8d7[_0xbace('0x18')]?_0x45f8d7[_0xbace('0x18')][_0xbace('0x1c')]?_[_0xbace('0x1d')](_0x45f8d7[_0xbace('0x18')][_0xbace('0x1c')],function(_0x516fdf){return{'model':db[_0x516fdf[_0xbace('0x1e')]],'as':_0x516fdf['as'],'attributes':_0x516fdf['attributes'],'include':_0x516fdf[_0xbace('0x1c')]?_[_0xbace('0x1d')](_0x516fdf['include'],function(_0x27ad1b){return{'model':db[_0x27ad1b[_0xbace('0x1e')]],'as':_0x27ad1b['as'],'attributes':_0x27ad1b[_0xbace('0x1b')],'include':_0x27ad1b[_0xbace('0x1c')]?_[_0xbace('0x1d')](_0x27ad1b[_0xbace('0x1c')],function(_0x4b3c85){return{'model':db[_0x4b3c85['model']],'as':_0x4b3c85['as'],'attributes':_0x4b3c85[_0xbace('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbace('0xb')](function(_0x1ff053){logger['info']('ShowSetting',_0x45f8d7);logger['debug']('ShowSetting',_0x45f8d7,JSON[_0xbace('0x10')](_0x1ff053));_0x11846e(_0x1ff053);})['catch'](function(_0xd638c3){logger[_0xbace('0x11')](_0xbace('0x15'),_0xd638c3[_0xbace('0x13')],_0x45f8d7);_0x4b81e4(_0x303f1c[_0xbace('0x11')](0x1f4,_0xd638c3[_0xbace('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c3623fa..4e9397a 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x47cc11,_0x14c5be){var _0x251e57=function(_0x5d51d9){while(--_0x5d51d9){_0x47cc11['push'](_0x47cc11['shift']());}};_0x251e57(++_0x14c5be);}(_0x53ec,0x192));var _0xc53e=function(_0x4a759b,_0x28a0b9){_0x4a759b=_0x4a759b-0x0;var _0x1619f2=_0x53ec[_0x4a759b];return _0x1619f2;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x104993,_0x3f9a6b){var _0x105a96=function(_0x4ad1cb){while(--_0x4ad1cb){_0x104993['push'](_0x104993['shift']());}};_0x105a96(++_0x3f9a6b);}(_0x814b,0x1a2));var _0xb814=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x814b[_0x378891];return _0xfbfda2;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ad4a3a7..6b3852d 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 _0x1d8f=['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','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','twilio','skebby','connectel','clicksend','clickatell','csc'];(function(_0x2c826b,_0xadaf9e){var _0x22603f=function(_0x5c3782){while(--_0x5c3782){_0x2c826b['push'](_0x2c826b['shift']());}};_0x22603f(++_0xadaf9e);}(_0x1d8f,0x1ed));var _0xf1d8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1d8f[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xf1d8('0x0'));var rs=require(_0xf1d8('0x1'));module[_0xf1d8('0x2')]={'name':{'type':Sequelize[_0xf1d8('0x3')],'unique':_0xf1d8('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf1d8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf1d8('0x3')]},'type':{'type':Sequelize['ENUM'](_0xf1d8('0x5'),_0xf1d8('0x6'),_0xf1d8('0x7'),_0xf1d8('0x8'),'plivo',_0xf1d8('0x9'),'bandwidth',_0xf1d8('0xa'),_0xf1d8('0xb'),_0xf1d8('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xf1d8('0x3')]},'authToken':{'type':Sequelize[_0xf1d8('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xf1d8('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf1d8('0x3')]},'applicationId':{'type':Sequelize[_0xf1d8('0x3')]},'accountId':{'type':Sequelize[_0xf1d8('0x3')]},'senderString':{'type':Sequelize[_0xf1d8('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf1d8('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf1d8('0xd')],'defaultValue':function(){return _0xf1d8('0xe');}},'notificationSound':{'type':Sequelize[_0xf1d8('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf1d8('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf1d8('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf1d8('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf1d8('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf1d8('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf1d8('0x10')],'comment':_0xf1d8('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xf1d8('0xf')],'defaultValue':![],'comment':_0xf1d8('0x12'),'set':function(_0x39010f){if(!_0x39010f)this[_0xf1d8('0x13')]('mandatoryDispositionPauseId',null);this[_0xf1d8('0x13')](_0xf1d8('0x14'),_0x39010f);}}}; \ No newline at end of file +var _0x4730=['clickatell','bandwidth','infobip','intelepeer','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','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo'];(function(_0x5b1ef1,_0x487026){var _0x3643f0=function(_0x27045c){while(--_0x27045c){_0x5b1ef1['push'](_0x5b1ef1['shift']());}};_0x3643f0(++_0x487026);}(_0x4730,0xde));var _0x0473=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x4730[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0473('0x0')]={'name':{'type':Sequelize[_0x0473('0x1')],'unique':_0x0473('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0473('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0473('0x1')],'defaultValue':function(){return rs[_0x0473('0x3')]();}},'phone':{'type':Sequelize[_0x0473('0x1')]},'type':{'type':Sequelize[_0x0473('0x4')](_0x0473('0x5'),_0x0473('0x6'),_0x0473('0x7'),'clicksend',_0x0473('0x8'),_0x0473('0x9'),_0x0473('0xa'),'csc',_0x0473('0xb'),_0x0473('0xc'))},'accountSid':{'type':Sequelize[_0x0473('0x1')]},'authId':{'type':Sequelize[_0x0473('0x1')]},'authToken':{'type':Sequelize[_0x0473('0x1')]},'smsMethod':{'type':Sequelize[_0x0473('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0473('0x1')]},'password':{'type':Sequelize[_0x0473('0x1')]},'apiKey':{'type':Sequelize[_0x0473('0x1')]},'applicationId':{'type':Sequelize[_0x0473('0x1')]},'accountId':{'type':Sequelize[_0x0473('0x1')]},'senderString':{'type':Sequelize[_0x0473('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x0473('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0473('0xd')],'defaultValue':function(){return _0x0473('0xe');}},'notificationSound':{'type':Sequelize[_0x0473('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0473('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0473('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0473('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0473('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0473('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0473('0x11'),'set':function(_0x18bee9){if(!_0x18bee9)this[_0x0473('0x12')](_0x0473('0x13'),null);this[_0x0473('0x12')](_0x0473('0x14'),_0x18bee9);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 68a6172..10775e7 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 _0x38fb=['infobip','groupName','DELIVERED','bandwidth','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','csc','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','sender','text','message_id','plivo','Text','results','originatingAddress','segmentedMessage','clickatell','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','SmsApplication','findAndCountAll','stack','finally','getApplications','rawAttributes','Contact','Owner','internal','Tag','tag','to\x20is\x20mandatory','List','user','out','dataValues','Messages','push','skebby','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code'];(function(_0xf61586,_0x56b0c4){var _0x2b6eb3=function(_0x47e12b){while(--_0x47e12b){_0xf61586['push'](_0xf61586['shift']());}};_0x2b6eb3(++_0x56b0c4);}(_0x38fb,0xf5));var _0xb38f=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x38fb[_0x4bbe00];return _0x3999d2;};'use strict';var emlformat=require(_0xb38f('0x0'));var rimraf=require(_0xb38f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb38f('0x2'));var moment=require(_0xb38f('0x3'));var BPromise=require(_0xb38f('0x4'));var Mustache=require(_0xb38f('0x5'));var util=require('util');var path=require(_0xb38f('0x6'));var sox=require(_0xb38f('0x7'));var csv=require(_0xb38f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb38f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb38f('0xa'));var jsforce=require(_0xb38f('0xb'));var deskjs=require(_0xb38f('0xc'));var toCsv=require(_0xb38f('0x8'));var querystring=require('querystring');var Papa=require(_0xb38f('0xd'));var Redis=require(_0xb38f('0xe'));var authService=require(_0xb38f('0xf'));var qs=require(_0xb38f('0x10'));var as=require(_0xb38f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb38f('0x12'))(_0xb38f('0x13'));var utils=require(_0xb38f('0x14'));var config=require(_0xb38f('0x15'));var licenseUtil=require(_0xb38f('0x16'));var db=require(_0xb38f('0x17'))['db'];config[_0xb38f('0x18')]=_[_0xb38f('0x19')](config[_0xb38f('0x18')],{'host':_0xb38f('0x1a'),'port':0x18eb});var socket=require(_0xb38f('0x1b'))(new Redis(config['redis']));require(_0xb38f('0x1c'))[_0xb38f('0x1d')](socket);var jayson=require(_0xb38f('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2dde73,_0x2352fc,_0x242c02,_0x55315b){return new BPromise(function(_0x1e2e5d,_0x359dc0){var _0x5e22a0=_0x55315b||client;return _0x5e22a0[_0xb38f('0x1f')](_0x2dde73,_0x242c02)[_0xb38f('0x20')](function(_0x54ae05){logger[_0xb38f('0x21')](_0xb38f('0x22'),_0x2352fc,'request\x20sent');logger[_0xb38f('0x23')](_0xb38f('0x24'),_0x2352fc,'request\x20sent',JSON[_0xb38f('0x25')](_0x54ae05));if(_0x54ae05[_0xb38f('0x26')]){if(_0x54ae05[_0xb38f('0x26')][_0xb38f('0x27')]===0x1f4){logger[_0xb38f('0x26')](_0xb38f('0x22'),_0x2352fc,_0x54ae05[_0xb38f('0x26')][_0xb38f('0x28')]);return _0x359dc0(_0x54ae05[_0xb38f('0x26')]['message']);}logger[_0xb38f('0x26')](_0xb38f('0x22'),_0x2352fc,_0x54ae05['error'][_0xb38f('0x28')]);return _0x1e2e5d(_0x54ae05['error'][_0xb38f('0x28')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x2352fc,_0xb38f('0x29'));_0x1e2e5d(_0x54ae05['result'][_0xb38f('0x28')]);}})[_0xb38f('0x2a')](function(_0x4b1e4a){logger[_0xb38f('0x26')](_0xb38f('0x22'),_0x2352fc,_0x4b1e4a);_0x359dc0(_0x4b1e4a);});});}function respondWithStatusCode(_0x58fb62,_0x143ca0){_0x143ca0=_0x143ca0||0xcc;return function(_0x41947b){if(_0x41947b){return _0x58fb62[_0xb38f('0x2b')](_0x143ca0);}return _0x58fb62[_0xb38f('0x2c')](_0x143ca0)[_0xb38f('0x2d')]();};}function respondWithResult(_0x2627a4,_0x8b8098){_0x8b8098=_0x8b8098||0xc8;return function(_0x1871c8){if(_0x1871c8){return _0x2627a4['status'](_0x8b8098)['json'](_0x1871c8);}};}function respondWithFilteredResult(_0x44268d,_0x1410e9){return function(_0x23789a){if(_0x23789a){var _0x5b13ed=typeof _0x1410e9['offset']===_0xb38f('0x2e')&&typeof _0x1410e9['limit']===_0xb38f('0x2e');var _0x3b03cb=_0x23789a[_0xb38f('0x2f')];var _0x4cec8b=_0x5b13ed?0x0:_0x1410e9[_0xb38f('0x30')];var _0x976633=_0x5b13ed?_0x23789a['count']:_0x1410e9[_0xb38f('0x30')]+_0x1410e9[_0xb38f('0x31')];var _0x205d38;if(_0x976633>=_0x3b03cb){_0x976633=_0x3b03cb;_0x205d38=0xc8;}else{_0x205d38=0xce;}_0x44268d['status'](_0x205d38);return _0x44268d[_0xb38f('0x32')]('Content-Range',_0x4cec8b+'-'+_0x976633+'/'+_0x3b03cb)[_0xb38f('0x33')](_0x23789a);}return null;};}function patchUpdates(_0x2b930b){return function(_0x548bca){try{jsonpatch[_0xb38f('0x34')](_0x548bca,_0x2b930b,!![]);}catch(_0x44adf5){return BPromise[_0xb38f('0x35')](_0x44adf5);}return _0x548bca['save']();};}function saveUpdates(_0x1bd80d,_0x29a34c){return function(_0x2df253){if(_0x2df253){return _0x2df253[_0xb38f('0x36')](_0x1bd80d)['then'](function(_0x3c0798){return _0x3c0798;});}return null;};}function removeEntity(_0x4f6e1e,_0xe96d2){return function(_0x12006b){if(_0x12006b){return _0x12006b[_0xb38f('0x37')]()[_0xb38f('0x20')](function(){var _0x37f236=_0x12006b[_0xb38f('0x38')]({'plain':!![]});var _0x47bab1=_0xb38f('0x39');return db[_0xb38f('0x3a')][_0xb38f('0x37')]({'where':{'type':_0x47bab1,'resourceId':_0x37f236['id']}})['then'](function(){return _0x12006b;});})[_0xb38f('0x20')](function(){_0x4f6e1e[_0xb38f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa885cf,_0x150765){return function(_0x114e52){if(!_0x114e52){_0xa885cf[_0xb38f('0x2b')](0x194);}return _0x114e52;};}function handleError(_0x2640cf,_0x431174){_0x431174=_0x431174||0x1f4;return function(_0x578353){logger[_0xb38f('0x26')](_0x578353['stack']);if(_0x578353[_0xb38f('0x3b')]){delete _0x578353['name'];}_0x2640cf['status'](_0x431174)[_0xb38f('0x3c')](_0x578353);};}exports['index']=function(_0x740faa,_0x1d54e7){var _0x8eedac={'include':[{'model':db[_0xb38f('0x3d')],'as':_0xb38f('0x3e')}]},_0x41233d={},_0x330e1e={'count':0x0,'rows':[]};var _0x49ea02=_['map'](db['SmsAccount']['rawAttributes'],function(_0x5757c8){return{'name':_0x5757c8['fieldName'],'type':_0x5757c8[_0xb38f('0x3f')]['key']};});_0x41233d[_0xb38f('0x40')]=_[_0xb38f('0x41')](_0x49ea02,_0xb38f('0x3b'));_0x41233d[_0xb38f('0x42')]=_[_0xb38f('0x43')](_0x740faa[_0xb38f('0x42')]);_0x41233d[_0xb38f('0x44')]=_[_0xb38f('0x45')](_0x41233d[_0xb38f('0x40')],_0x41233d['query']);_0x8eedac['attributes']=_[_0xb38f('0x45')](_0x41233d[_0xb38f('0x40')],qs['fields'](_0x740faa[_0xb38f('0x42')][_0xb38f('0x46')]));_0x8eedac[_0xb38f('0x47')]=_0x8eedac[_0xb38f('0x47')][_0xb38f('0x48')]?_0x8eedac[_0xb38f('0x47')]:_0x41233d['model'];if(!_0x740faa[_0xb38f('0x42')]['hasOwnProperty'](_0xb38f('0x49'))){_0x8eedac['limit']=qs['limit'](_0x740faa[_0xb38f('0x42')]['limit']);_0x8eedac[_0xb38f('0x30')]=qs[_0xb38f('0x30')](_0x740faa['query'][_0xb38f('0x30')]);}_0x8eedac[_0xb38f('0x4a')]=qs['sort'](_0x740faa[_0xb38f('0x42')]['sort']);_0x8eedac[_0xb38f('0x4b')]=qs[_0xb38f('0x44')](_[_0xb38f('0x4c')](_0x740faa[_0xb38f('0x42')],_0x41233d['filters']),_0x49ea02);if(_0x740faa['query'][_0xb38f('0x4d')]){_0x8eedac[_0xb38f('0x4b')]=_[_0xb38f('0x4e')](_0x8eedac[_0xb38f('0x4b')],{'$or':_[_0xb38f('0x41')](_0x49ea02,function(_0x2d23be){if(_0x2d23be['type']!==_0xb38f('0x4f')){var _0x11f0dd={};_0x11f0dd[_0x2d23be[_0xb38f('0x3b')]]={'$like':'%'+_0x740faa[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x11f0dd;}})});}_0x8eedac=_[_0xb38f('0x4e')]({},_0x8eedac,_0x740faa[_0xb38f('0x50')]);var _0x1ef920={'where':_0x8eedac[_0xb38f('0x4b')]};return db[_0xb38f('0x51')]['count'](_0x1ef920)[_0xb38f('0x20')](function(_0x484826){_0x330e1e['count']=_0x484826;if(_0x740faa[_0xb38f('0x42')][_0xb38f('0x52')]){_0x8eedac['include']=[{'all':!![]}];}return db[_0xb38f('0x51')]['findAll'](_0x8eedac);})[_0xb38f('0x20')](function(_0x58ae90){_0x330e1e[_0xb38f('0x53')]=_0x58ae90;return _0x330e1e;})['then'](respondWithFilteredResult(_0x1d54e7,_0x8eedac))['catch'](handleError(_0x1d54e7,null));};exports[_0xb38f('0x54')]=function(_0x13399a,_0x31717d){var _0x489da3={'raw':![],'where':{'id':_0x13399a[_0xb38f('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4b0dcf={};_0x4b0dcf['model']=_[_0xb38f('0x43')](db[_0xb38f('0x51')]['rawAttributes']);_0x4b0dcf[_0xb38f('0x42')]=_['keys'](_0x13399a[_0xb38f('0x42')]);_0x4b0dcf[_0xb38f('0x44')]=_[_0xb38f('0x45')](_0x4b0dcf[_0xb38f('0x40')],_0x4b0dcf[_0xb38f('0x42')]);_0x489da3[_0xb38f('0x47')]=_[_0xb38f('0x45')](_0x4b0dcf[_0xb38f('0x40')],qs[_0xb38f('0x46')](_0x13399a[_0xb38f('0x42')][_0xb38f('0x46')]));_0x489da3[_0xb38f('0x47')]=_0x489da3[_0xb38f('0x47')][_0xb38f('0x48')]?_0x489da3[_0xb38f('0x47')]:_0x4b0dcf[_0xb38f('0x40')];if(_0x13399a[_0xb38f('0x42')][_0xb38f('0x52')]){_0x489da3['include']=[{'all':!![]}];}_0x489da3=_[_0xb38f('0x4e')]({},_0x489da3,_0x13399a[_0xb38f('0x50')]);return db[_0xb38f('0x51')][_0xb38f('0x56')](_0x489da3)[_0xb38f('0x20')](handleEntityNotFound(_0x31717d,null))[_0xb38f('0x20')](respondWithResult(_0x31717d,null))['catch'](handleError(_0x31717d,null));};exports[_0xb38f('0x57')]=function(_0xbe56b4,_0x38b285){return db[_0xb38f('0x51')][_0xb38f('0x57')](_0xbe56b4[_0xb38f('0x58')],{})[_0xb38f('0x20')](function(_0x3e8c82){var _0x35e83a=_0xbe56b4['user'][_0xb38f('0x38')]({'plain':!![]});if(!_0x35e83a)throw new Error(_0xb38f('0x59'));if(_0x35e83a[_0xb38f('0x5a')]==='user'){var _0x51a771=_0x3e8c82[_0xb38f('0x38')]({'plain':!![]});var _0x5bdab4='SmsAccounts';return db[_0xb38f('0x5b')]['find']({'where':{'name':_0x5bdab4,'userProfileId':_0x35e83a[_0xb38f('0x5c')]},'raw':!![]})['then'](function(_0xfefd1b){if(_0xfefd1b&&_0xfefd1b[_0xb38f('0x5d')]===0x0){return db['UserProfileResource'][_0xb38f('0x57')]({'name':_0x51a771[_0xb38f('0x3b')],'resourceId':_0x51a771['id'],'type':_0xfefd1b[_0xb38f('0x3b')],'sectionId':_0xfefd1b['id']},{})[_0xb38f('0x20')](function(){return _0x3e8c82;});}else{return _0x3e8c82;}})[_0xb38f('0x2a')](function(_0x425f74){logger[_0xb38f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x425f74);throw _0x425f74;});}return _0x3e8c82;})[_0xb38f('0x20')](respondWithResult(_0x38b285,0xc9))[_0xb38f('0x2a')](handleError(_0x38b285,null));};exports['update']=function(_0x20bac0,_0x1320f1){if(_0x20bac0[_0xb38f('0x58')]['id']){delete _0x20bac0['body']['id'];}return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0x20bac0[_0xb38f('0x55')]['id']},'include':[{'model':db[_0xb38f('0x3d')],'as':_0xb38f('0x3e')}]})[_0xb38f('0x20')](handleEntityNotFound(_0x1320f1,null))[_0xb38f('0x20')](saveUpdates(_0x20bac0[_0xb38f('0x58')],null))['then'](respondWithResult(_0x1320f1,null))['catch'](handleError(_0x1320f1,null));};exports[_0xb38f('0x37')]=function(_0x536e5a,_0x888b91){return db['SmsAccount'][_0xb38f('0x56')]({'where':{'id':_0x536e5a[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x888b91,null))[_0xb38f('0x20')](removeEntity(_0x888b91,null))[_0xb38f('0x2a')](handleError(_0x888b91,null));};exports['describe']=function(_0x30dc8d,_0x4a4e61){return db['SmsAccount'][_0xb38f('0x5e')]()['then'](respondWithResult(_0x4a4e61,null))[_0xb38f('0x2a')](handleError(_0x4a4e61,null));};exports[_0xb38f('0x5f')]=function(_0x14e497,_0xc87761,_0x5d3a93){if(_0x14e497['body']['id']){delete _0x14e497['body']['id'];}return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0x14e497['params']['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0xc87761,null))[_0xb38f('0x20')](function(_0x52bf51){if(_0x52bf51){_0x14e497[_0xb38f('0x58')][_0xb38f('0x60')]=_0x52bf51['id'];return db[_0xb38f('0x61')][_0xb38f('0x57')](_0x14e497[_0xb38f('0x58')]);}})[_0xb38f('0x20')](respondWithResult(_0xc87761,null))['catch'](handleError(_0xc87761,null));};exports[_0xb38f('0x62')]=function(_0x51bec6,_0x42feaa,_0x5d599a){var _0x57c271={'raw':![],'where':{}};var _0xd7d2e2={};var _0x7edb9f={'count':0x0,'rows':[]};return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0x51bec6[_0xb38f('0x55')]['id']}})['then'](handleEntityNotFound(_0x42feaa,null))['then'](function(_0x22680a){if(_0x22680a){_0xd7d2e2[_0xb38f('0x40')]=_[_0xb38f('0x43')](db[_0xb38f('0x61')]['rawAttributes']);_0xd7d2e2['query']=_['keys'](_0x51bec6[_0xb38f('0x42')]);_0xd7d2e2['filters']=_[_0xb38f('0x45')](_0xd7d2e2[_0xb38f('0x40')],_0xd7d2e2[_0xb38f('0x42')]);_0x57c271['attributes']=_[_0xb38f('0x45')](_0xd7d2e2[_0xb38f('0x40')],qs[_0xb38f('0x46')](_0x51bec6[_0xb38f('0x42')][_0xb38f('0x46')]));_0x57c271[_0xb38f('0x47')]=_0x57c271['attributes']['length']?_0x57c271['attributes']:_0xd7d2e2['model'];if(!_0x51bec6[_0xb38f('0x42')]['hasOwnProperty']('nolimit')){_0x57c271['limit']=qs[_0xb38f('0x31')](_0x51bec6[_0xb38f('0x42')]['limit']);_0x57c271['offset']=qs[_0xb38f('0x30')](_0x51bec6['query'][_0xb38f('0x30')]);}_0x57c271['order']=qs[_0xb38f('0x64')](_0x51bec6[_0xb38f('0x42')][_0xb38f('0x64')]);_0x57c271[_0xb38f('0x4b')]=qs[_0xb38f('0x44')](_[_0xb38f('0x4c')](_0x51bec6['query'],_0xd7d2e2[_0xb38f('0x44')]));_0x57c271[_0xb38f('0x4b')][_0xb38f('0x60')]=_0x22680a['id'];if(_0x51bec6['query'][_0xb38f('0x4d')]){_0x57c271[_0xb38f('0x4b')]=_[_0xb38f('0x4e')](_0x57c271[_0xb38f('0x4b')],{'$or':_[_0xb38f('0x41')](_0x57c271[_0xb38f('0x47')],function(_0x3d93d6){var _0x53266b={};_0x53266b[_0x3d93d6]={'$like':'%'+_0x51bec6[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x53266b;})});}_0x57c271=_['merge']({},_0x57c271,_0x51bec6[_0xb38f('0x50')]);return db[_0xb38f('0x61')]['count']({'where':_0x57c271[_0xb38f('0x4b')]})[_0xb38f('0x20')](function(_0x140b85){_0x7edb9f[_0xb38f('0x2f')]=_0x140b85;if(_0x51bec6[_0xb38f('0x42')][_0xb38f('0x52')]){_0x57c271[_0xb38f('0x65')]=[{'all':!![]}];}return db[_0xb38f('0x61')][_0xb38f('0x66')](_0x57c271);})[_0xb38f('0x20')](function(_0x5112f1){_0x7edb9f['rows']=_0x5112f1;return _0x7edb9f;});}})[_0xb38f('0x20')](respondWithFilteredResult(_0x42feaa,_0x57c271))[_0xb38f('0x2a')](handleError(_0x42feaa,null));};exports[_0xb38f('0x67')]=function(_0x3b58e8,_0x53422a,_0x555af1){return db['SmsAccount'][_0xb38f('0x56')]({'where':{'id':_0x3b58e8[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x53422a,null))[_0xb38f('0x20')](function(_0x5708ff){if(_0x5708ff){return _0x5708ff['removeDispositions'](_0x3b58e8[_0xb38f('0x42')][_0xb38f('0x68')]);}})[_0xb38f('0x20')](respondWithStatusCode(_0x53422a,null))[_0xb38f('0x2a')](handleError(_0x53422a,null));};exports[_0xb38f('0x69')]=function(_0x4ece54,_0x1be1ee,_0x3abb58){if(_0x4ece54[_0xb38f('0x58')]['id']){delete _0x4ece54[_0xb38f('0x58')]['id'];}return db['SmsAccount'][_0xb38f('0x56')]({'where':{'id':_0x4ece54['params']['id']}})['then'](handleEntityNotFound(_0x1be1ee,null))[_0xb38f('0x20')](function(_0x20fd1d){if(_0x20fd1d){_0x4ece54[_0xb38f('0x58')][_0xb38f('0x60')]=_0x20fd1d['id'];return db[_0xb38f('0x6a')][_0xb38f('0x57')](_0x4ece54[_0xb38f('0x58')]);}})[_0xb38f('0x20')](respondWithResult(_0x1be1ee,null))[_0xb38f('0x2a')](handleError(_0x1be1ee,null));};exports[_0xb38f('0x6b')]=function(_0x467d52,_0x374804,_0x38b635){var _0x5332ea={'raw':![],'where':{}};var _0x705861={};var _0x571c0e={'count':0x0,'rows':[]};return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0x467d52['params']['id']}})['then'](handleEntityNotFound(_0x374804,null))[_0xb38f('0x20')](function(_0x797b78){if(_0x797b78){_0x705861[_0xb38f('0x40')]=_[_0xb38f('0x43')](db['CannedAnswer']['rawAttributes']);_0x705861['query']=_['keys'](_0x467d52[_0xb38f('0x42')]);_0x705861[_0xb38f('0x44')]=_['intersection'](_0x705861[_0xb38f('0x40')],_0x705861['query']);_0x5332ea['attributes']=_[_0xb38f('0x45')](_0x705861[_0xb38f('0x40')],qs['fields'](_0x467d52[_0xb38f('0x42')]['fields']));_0x5332ea['attributes']=_0x5332ea[_0xb38f('0x47')][_0xb38f('0x48')]?_0x5332ea[_0xb38f('0x47')]:_0x705861[_0xb38f('0x40')];if(!_0x467d52[_0xb38f('0x42')][_0xb38f('0x6c')](_0xb38f('0x49'))){_0x5332ea['limit']=qs[_0xb38f('0x31')](_0x467d52['query']['limit']);_0x5332ea[_0xb38f('0x30')]=qs['offset'](_0x467d52[_0xb38f('0x42')]['offset']);}_0x5332ea[_0xb38f('0x4a')]=qs['sort'](_0x467d52[_0xb38f('0x42')][_0xb38f('0x64')]);_0x5332ea[_0xb38f('0x4b')]=qs[_0xb38f('0x44')](_[_0xb38f('0x4c')](_0x467d52[_0xb38f('0x42')],_0x705861[_0xb38f('0x44')]));_0x5332ea[_0xb38f('0x4b')][_0xb38f('0x60')]=_0x797b78['id'];if(_0x467d52[_0xb38f('0x42')][_0xb38f('0x4d')]){_0x5332ea[_0xb38f('0x4b')]=_[_0xb38f('0x4e')](_0x5332ea['where'],{'$or':_[_0xb38f('0x41')](_0x5332ea[_0xb38f('0x47')],function(_0x4608d7){var _0x4c1364={};_0x4c1364[_0x4608d7]={'$like':'%'+_0x467d52[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x4c1364;})});}_0x5332ea=_[_0xb38f('0x4e')]({},_0x5332ea,_0x467d52[_0xb38f('0x50')]);return db['CannedAnswer'][_0xb38f('0x2f')]({'where':_0x5332ea[_0xb38f('0x4b')]})['then'](function(_0x1123ed){_0x571c0e[_0xb38f('0x2f')]=_0x1123ed;if(_0x467d52[_0xb38f('0x42')]['includeAll']){_0x5332ea[_0xb38f('0x65')]=[{'all':!![]}];}return db[_0xb38f('0x6a')][_0xb38f('0x66')](_0x5332ea);})[_0xb38f('0x20')](function(_0xfc1b11){_0x571c0e['rows']=_0xfc1b11;return _0x571c0e;});}})[_0xb38f('0x20')](respondWithFilteredResult(_0x374804,_0x5332ea))['catch'](handleError(_0x374804,null));};exports[_0xb38f('0x6d')]=function(_0x5a62b0,_0x5c5385,_0x124a19){return db[_0xb38f('0x51')]['find']({'where':{'id':_0x5a62b0[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x5c5385,null))[_0xb38f('0x20')](function(_0x318ea2){if(_0x318ea2){return _0x318ea2[_0xb38f('0x6d')](_0x5a62b0['query'][_0xb38f('0x68')]);}})['then'](respondWithStatusCode(_0x5c5385,null))[_0xb38f('0x2a')](handleError(_0x5c5385,null));};exports[_0xb38f('0x6e')]=function(_0xbd6eef,_0x137827,_0x4a28eb){var _0x5bea4d={'channel':_0xb38f('0x6f')};var _0x21c616=[];var _0x29143b=[];var _0x31a562={};return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0xbd6eef[_0xb38f('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xb38f('0x70')}]})[_0xb38f('0x20')](handleEntityNotFound(_0x137827,null))[_0xb38f('0x20')](function(_0x3a7d98){_0x5bea4d[_0xb38f('0x71')]=_0x3a7d98;_0x5bea4d[_0xb38f('0x72')]=_[_0xb38f('0x73')](_0x3a7d98['Applications'],[_0xb38f('0x74')],[_0xb38f('0x75')]);if(_0x5bea4d[_0xb38f('0x71')][_0xb38f('0x70')]){delete _0x5bea4d[_0xb38f('0x71')]['Applications'];}return db[_0xb38f('0x76')][_0xb38f('0x5e')]();})[_0xb38f('0x20')](function(_0x146481){if(!_0x146481){throw new db[(_0xb38f('0x77'))]['ValidationError'](_0xb38f('0x78'));}_0x21c616=_[_0xb38f('0x79')](_['keys'](_0x146481),[_0xb38f('0x7a'),_0xb38f('0x7b')]);_0x29143b=_[_0xb38f('0x79')](_[_0xb38f('0x43')](_0x146481),[_0xb38f('0x7a'),'updatedAt',_0xb38f('0x7c'),_0xb38f('0x7d')]);_0x5bea4d[_0xb38f('0x58')]={'mapKey':_0xb38f('0x7e')};if(_0x5bea4d[_0xb38f('0x71')][_0xb38f('0x3f')]){switch(_0x5bea4d[_0xb38f('0x71')]['type']){case _0xb38f('0x7f'):_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x81')];_0x5bea4d['body'][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x82')];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x83')]=_0xbd6eef[_0xb38f('0x58')]['MessageSid'];break;case'skebby':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]='+'+_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x84')];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x85')];break;case'connectel':_0x5bea4d[_0xb38f('0x58')]['from']=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x80')];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x28')];break;case'clicksend':_0x5bea4d['body']['from']=_0xbd6eef[_0xb38f('0x58')]['from'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')]['body'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x83')]=_0xbd6eef['body'][_0xb38f('0x86')];break;case _0xb38f('0x87'):_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]=_0xbd6eef[_0xb38f('0x58')]['From'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef['body'][_0xb38f('0x88')];_0x5bea4d[_0xb38f('0x58')]['messageId']=_0xbd6eef[_0xb38f('0x58')]['MessageUUID'];break;case'infobip':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]='+'+_0xbd6eef[_0xb38f('0x58')]['results'][0x0][_0xb38f('0x80')];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x89')][0x0][_0xb38f('0x85')];_0x5bea4d['body'][_0xb38f('0x83')]=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x89')][0x0][_0xb38f('0x83')];break;case'csc':_0x5bea4d['body'][_0xb38f('0x80')]=_0xbd6eef['body'][_0xb38f('0x8a')];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef['body'][_0xb38f('0x8b')][_0xb38f('0x28')];break;case _0xb38f('0x8c'):_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]=_0xbd6eef[_0xb38f('0x58')]['fromNumber'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef['body'][_0xb38f('0x85')];_0x5bea4d[_0xb38f('0x58')]['messageId']=_0xbd6eef[_0xb38f('0x58')]['replyMessageId'];break;case'bandwidth':_0x5bea4d['body'][_0xb38f('0x83')]=_0xbd6eef['body'][0x0][_0xb38f('0x28')]['id'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]=_0xbd6eef[_0xb38f('0x58')][0x0]['message']['from'];_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')]=_0xbd6eef[_0xb38f('0x58')][0x0][_0xb38f('0x28')][_0xb38f('0x85')];break;case _0xb38f('0x8d'):_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')]=_0xbd6eef['body']['from'];_0x5bea4d[_0xb38f('0x58')]['body']=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x28')];_0x5bea4d[_0xb38f('0x58')]['messageId']=_0xbd6eef[_0xb38f('0x58')][_0xb38f('0x8e')];break;}}if(_0x5bea4d[_0xb38f('0x58')]['id']){delete _0x5bea4d[_0xb38f('0x58')]['id'];}if(_[_0xb38f('0x8f')](_0x5bea4d[_0xb38f('0x58')]['from'])){throw new db[(_0xb38f('0x77'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xb38f('0x8f')](_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x58')])||_0x5bea4d[_0xb38f('0x58')]['body']===''){throw new db[(_0xb38f('0x77'))][(_0xb38f('0x90'))](_0xb38f('0x91'));}if(_[_0xb38f('0x8f')](_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x92')])){throw new db[(_0xb38f('0x77'))][(_0xb38f('0x90'))](_0xb38f('0x93')+_0x29143b);}if(!_[_0xb38f('0x94')](_0x29143b,_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x92')])){throw new db[(_0xb38f('0x77'))][(_0xb38f('0x90'))](_0xb38f('0x95')+_0x29143b);}_0x31a562[_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x92')]]=_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')];return db[_0xb38f('0x96')][_0xb38f('0x56')]({'where':{'id':_0x5bea4d[_0xb38f('0x71')]['ListId']},'include':[{'model':db[_0xb38f('0x76')],'as':'Contacts','where':_0x31a562,'limit':0x1,'order':[[_0xb38f('0x7b'),_0xb38f('0x97')]]}]});})[_0xb38f('0x20')](handleEntityNotFound(_0x137827,null))[_0xb38f('0x20')](function(_0x52ad1b){if(_0x52ad1b){_0x5bea4d[_0xb38f('0x98')]=_['omit'](_0x52ad1b,[_0xb38f('0x99')]);if(_0x52ad1b['Contacts']['length']){return _0x52ad1b[_0xb38f('0x99')][0x0];}var _0x4520d4=_[_0xb38f('0x19')](_0x5bea4d[_0xb38f('0x58')],{'firstName':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')],'ListId':_0x52ad1b['id']});_0x4520d4[_0x5bea4d['body'][_0xb38f('0x92')]]=_0x5bea4d['body']['from'];return db[_0xb38f('0x76')]['create'](_0x4520d4,{'fields':_0x21c616,'raw':!![]});}})[_0xb38f('0x20')](handleEntityNotFound(_0x137827,null))[_0xb38f('0x20')](function(_0x3b353f){if(_0x3b353f){_0x5bea4d[_0xb38f('0x9a')]=_0x3b353f;var _0x307fa1={'ContactId':_0x3b353f['id'],'phone':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x80')],'SmsAccountId':_0xbd6eef[_0xb38f('0x55')]['id']};var _0x1aceb4={'ContactId':_0x3b353f['id'],'SmsAccountId':_0xbd6eef['params']['id'],'closed':![]};return db[_0xb38f('0x9b')][_0xb38f('0x56')]({'where':_0x1aceb4})[_0xb38f('0x20')](function(_0x331732){if(_0x331732){return[_0x331732,![]];}return db[_0xb38f('0x9b')][_0xb38f('0x57')](_0x307fa1)['then'](function(_0xab5074){return[_0xab5074,!![]];});});}})[_0xb38f('0x9c')](function(_0x116723,_0x158b89){_0x5bea4d[_0xb38f('0x9d')]=_0x116723['get']({'plain':!![]});_0x5bea4d[_0xb38f('0x9d')][_0xb38f('0x9e')]=![];if(_0x158b89){if(_0x5bea4d[_0xb38f('0x71')][_0xb38f('0x9f')]){_0x5bea4d[_0xb38f('0x72')]['push']({'id':0x0,'priority':_0x5bea4d[_0xb38f('0x72')]['length']+0x1,'app':'close','appdata':_0xb38f('0xa0'),'interval':_0xb38f('0xa1')});}_0x5bea4d[_0xb38f('0x9d')][_0xb38f('0x9e')]=!![];}return db[_0xb38f('0xa2')][_0xb38f('0x57')]({'phone':_0x5bea4d[_0xb38f('0x58')]['from'],'messageId':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0x83')],'body':_0x5bea4d[_0xb38f('0x58')]['body'],'SmsAccountId':_0xbd6eef[_0xb38f('0x55')]['id'],'SmsInteractionId':_0x116723['id'],'direction':'in','ContactId':_0x116723[_0xb38f('0xa3')],'AttachmentId':_0x5bea4d[_0xb38f('0x58')][_0xb38f('0xa4')]});})[_0xb38f('0x20')](function(_0x327f6a){_0x5bea4d['message']=_0x327f6a;if(_0x5bea4d[_0xb38f('0x9d')][_0xb38f('0xa5')]){return db[_0xb38f('0xa6')][_0xb38f('0x56')]({'attributes':['id',_0xb38f('0x3b')],'where':{'id':_0x5bea4d[_0xb38f('0x9d')][_0xb38f('0xa5')]}})['then'](function(_0x24a0e5){if(_0x24a0e5){_0x5bea4d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb38f('0xa7'),'appdata':_0x24a0e5[_0xb38f('0x3b')]+','+(_0x5bea4d[_0xb38f('0x71')][_0xb38f('0xa8')]||0xa),'interval':_0xb38f('0xa1')});}return respondWithRpcPromise(_0xb38f('0xa9'),_0xb38f('0xaa'),_0x5bea4d);});}return respondWithRpcPromise('Start','startRouting',_0x5bea4d);})['then'](function(_0x2d3b88){if(_0x2d3b88){var _0x4428ca=0xc8;var _0x4dbff8='receiveMessage';logger['info'](_0xb38f('0x24'),_0x4dbff8,_0x4428ca,_0xb38f('0xab'));logger[_0xb38f('0x23')](_0xb38f('0xac'),_0x4dbff8,_0x4428ca,_0xb38f('0xab'),JSON[_0xb38f('0x25')](_0x2d3b88));if(_0x5bea4d[_0xb38f('0x71')]['type']===_0xb38f('0x7f')){return _0x137827[_0xb38f('0x2c')](_0x4428ca)['set'](_0xb38f('0xad'),_0xb38f('0xae'))[_0xb38f('0x3c')](_0xb38f('0xaf'));}else{return _0x137827[_0xb38f('0x2c')](_0x4428ca)[_0xb38f('0x33')](_0x2d3b88);}}})['catch'](handleError(_0x137827,null));};exports[_0xb38f('0xb0')]=function(_0x24a002,_0x2615dc){var _0xf9d15a=_0x24a002[_0xb38f('0x55')]['id'];var _0x4226fd=_0x24a002[_0xb38f('0x58')];var _0x2af071=0xc8;var _0x1a0533=null;return db[_0xb38f('0xb1')]['transaction']({'isolationLevel':db['sequelize'][_0xb38f('0xb2')][_0xb38f('0xb3')]['READ_COMMITTED']},function(_0x1359e2){return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0xf9d15a},'transaction':_0x1359e2})[_0xb38f('0x20')](function(_0x1dfe16){if(_0x1dfe16){return db['SmsApplication'][_0xb38f('0x37')]({'where':{'SmsAccountId':_0xf9d15a},'transaction':_0x1359e2})['then'](function(){var _0x1c9a26=_[_0xb38f('0x41')](_0x4226fd,function(_0x3bd567){_0x3bd567[_0xb38f('0x60')]=_0xf9d15a;return _0x3bd567;});return db[_0xb38f('0xb4')]['bulkCreate'](_0x1c9a26,{'transaction':_0x1359e2});});}else{_0x2af071=0x194;_0x1a0533=[];}});})[_0xb38f('0x20')](function(){if(_0x2af071!==0x194){return db['SmsApplication'][_0xb38f('0xb5')]({'where':{'SmsAccountId':_0xf9d15a},'order':'priority'})[_0xb38f('0x20')](function(_0x1e6cb9){_0x1a0533=_0x1e6cb9;});}})[_0xb38f('0x2a')](function(_0x489d74){_0x2af071=0x1f4;logger[_0xb38f('0x26')](_0x489d74[_0xb38f('0xb6')]);if(_0x489d74[_0xb38f('0x3b')]){delete _0x489d74[_0xb38f('0x3b')];}_0x1a0533=_0x489d74;})[_0xb38f('0xb7')](function(){if(_0x1a0533===null){_0x2615dc[_0xb38f('0x2b')](_0x2af071);}else{if(_0x2af071===0x1f4){_0x2615dc[_0xb38f('0x2c')](_0x2af071)['send'](_0x1a0533);}else{_0x2615dc[_0xb38f('0x2c')](_0x2af071)['json'](_0x1a0533);}}});};exports[_0xb38f('0xb8')]=function(_0x377600,_0x3f091e,_0x3ba81a){var _0x3a9fae={};var _0x2cff4a={};var _0x2e12c6;var _0x1d4848;return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0x377600[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x3f091e,null))['then'](function(_0x1d77b6){if(_0x1d77b6){_0x2e12c6=_0x1d77b6;_0x2cff4a[_0xb38f('0x40')]=_[_0xb38f('0x43')](db['SmsApplication'][_0xb38f('0xb9')]);_0x2cff4a[_0xb38f('0x42')]=_[_0xb38f('0x43')](_0x377600[_0xb38f('0x42')]);_0x2cff4a[_0xb38f('0x44')]=_[_0xb38f('0x45')](_0x2cff4a[_0xb38f('0x40')],_0x2cff4a[_0xb38f('0x42')]);_0x3a9fae[_0xb38f('0x47')]=_[_0xb38f('0x45')](_0x2cff4a[_0xb38f('0x40')],qs['fields'](_0x377600[_0xb38f('0x42')]['fields']));_0x3a9fae[_0xb38f('0x47')]=_0x3a9fae[_0xb38f('0x47')][_0xb38f('0x48')]?_0x3a9fae['attributes']:_0x2cff4a[_0xb38f('0x40')];_0x3a9fae[_0xb38f('0x4a')]=qs['sort'](_0x377600[_0xb38f('0x42')]['sort']);_0x3a9fae['where']=qs[_0xb38f('0x44')](_[_0xb38f('0x4c')](_0x377600[_0xb38f('0x42')],_0x2cff4a['filters']));if(_0x377600[_0xb38f('0x42')][_0xb38f('0x4d')]){_0x3a9fae[_0xb38f('0x4b')]=_['merge'](_0x3a9fae[_0xb38f('0x4b')],{'$or':_['map'](_0x3a9fae[_0xb38f('0x47')],function(_0x4ad8b3){var _0x214fa0={};_0x214fa0[_0x4ad8b3]={'$like':'%'+_0x377600[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x214fa0;})});}_0x3a9fae=_[_0xb38f('0x4e')]({},_0x3a9fae,_0x377600['options']);return _0x2e12c6['getApplications'](_0x3a9fae);}})[_0xb38f('0x20')](function(_0x5c597a){if(_0x5c597a){_0x1d4848=_0x5c597a[_0xb38f('0x48')];if(!_0x377600['query'][_0xb38f('0x6c')]('nolimit')){_0x3a9fae[_0xb38f('0x31')]=qs['limit'](_0x377600[_0xb38f('0x42')]['limit']);_0x3a9fae[_0xb38f('0x30')]=qs['offset'](_0x377600[_0xb38f('0x42')][_0xb38f('0x30')]);}return _0x2e12c6['getApplications'](_0x3a9fae);}})[_0xb38f('0x20')](function(_0xa4cd78){if(_0xa4cd78){return _0xa4cd78?{'count':_0x1d4848,'rows':_0xa4cd78}:null;}})[_0xb38f('0x20')](respondWithResult(_0x3f091e,null))[_0xb38f('0x2a')](handleError(_0x3f091e,null));};exports['getInteractions']=function(_0x3bf5a1,_0x54e902,_0xe93f0c){var _0x3ee5b4={'raw':![],'where':{}};var _0x198c86={};var _0xf696cb={'count':0x0,'rows':[]};return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0x3bf5a1[_0xb38f('0x55')]['id']}})['then'](handleEntityNotFound(_0x54e902,null))['then'](function(_0x3db2b7){if(_0x3db2b7){_0x198c86[_0xb38f('0x40')]=_[_0xb38f('0x43')](db[_0xb38f('0x9b')][_0xb38f('0xb9')]);_0x198c86['query']=_[_0xb38f('0x43')](_0x3bf5a1[_0xb38f('0x42')]);_0x198c86[_0xb38f('0x44')]=_[_0xb38f('0x45')](_0x198c86['model'],_0x198c86[_0xb38f('0x42')]);_0x3ee5b4[_0xb38f('0x47')]=_[_0xb38f('0x45')](_0x198c86[_0xb38f('0x40')],qs[_0xb38f('0x46')](_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x46')]));_0x3ee5b4[_0xb38f('0x47')]=_0x3ee5b4['attributes'][_0xb38f('0x48')]?_0x3ee5b4['attributes']:_0x198c86['model'];if(!_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x6c')](_0xb38f('0x49'))){_0x3ee5b4[_0xb38f('0x31')]=qs[_0xb38f('0x31')](_0x3bf5a1['query'][_0xb38f('0x31')]);_0x3ee5b4[_0xb38f('0x30')]=qs[_0xb38f('0x30')](_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x30')]);}_0x3ee5b4[_0xb38f('0x4a')]=qs['sort'](_0x3bf5a1[_0xb38f('0x42')]['sort']);_0x3ee5b4[_0xb38f('0x4b')]=qs[_0xb38f('0x44')](_[_0xb38f('0x4c')](_0x3bf5a1[_0xb38f('0x42')],_0x198c86[_0xb38f('0x44')]));_0x3ee5b4['where']['SmsAccountId']=_0x3db2b7['id'];if(_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x4d')]){_0x3ee5b4[_0xb38f('0x4b')]=_['merge'](_0x3ee5b4['where'],{'$or':_[_0xb38f('0x41')](_0x3ee5b4[_0xb38f('0x47')],function(_0x49e09f){var _0x483761={};_0x483761[_0x49e09f]={'$like':'%'+_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x483761;})});}_0x3ee5b4=_[_0xb38f('0x4e')]({},_0x3ee5b4,_0x3bf5a1['options']);return db['SmsInteraction']['count']({'where':_0x3ee5b4[_0xb38f('0x4b')]})['then'](function(_0x565f2){_0xf696cb[_0xb38f('0x2f')]=_0x565f2;if(_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0x52')]){_0x3ee5b4[_0xb38f('0x65')]=[{'model':db['CmContact'],'as':_0xb38f('0xba'),'required':![]},{'model':db['User'],'as':_0xb38f('0xbb'),'attributes':['name','fullname',_0xb38f('0xbc')],'required':![]},{'model':db[_0xb38f('0xbd')],'as':'Tags','attributes':['id','name','color'],'where':_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0xbe')]?{'id':_0x3bf5a1[_0xb38f('0x42')]['tag']}:undefined,'required':_0x3bf5a1[_0xb38f('0x42')][_0xb38f('0xbe')]?!![]:![]}];}return db[_0xb38f('0x9b')][_0xb38f('0x66')](_0x3ee5b4);})[_0xb38f('0x20')](function(_0x16d91d){_0xf696cb[_0xb38f('0x53')]=_0x16d91d;return _0xf696cb;});}})[_0xb38f('0x20')](respondWithFilteredResult(_0x54e902,_0x3ee5b4))[_0xb38f('0x2a')](handleError(_0x54e902,null));};exports[_0xb38f('0x3c')]=function(_0x108ef6,_0x1ba6da,_0x160dc5){var _0x2ddcca,_0x1b4ddb,_0x69dfca;if(_[_0xb38f('0x8f')](_0x108ef6['body'][_0xb38f('0x58')])||_0x108ef6['body'][_0xb38f('0x58')]===''){throw new db[(_0xb38f('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb38f('0x8f')](_0x108ef6[_0xb38f('0x58')]['to'])){throw new db[(_0xb38f('0x77'))][(_0xb38f('0x90'))](_0xb38f('0xbf'));}_0x2ddcca=_0x108ef6[_0xb38f('0x58')]['to'];return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0x108ef6[_0xb38f('0x55')]['id']},'include':[{'model':db[_0xb38f('0x96')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb38f('0x99'),'where':{'mobile':_0x2ddcca},'limit':0x1,'order':[[_0xb38f('0x7b'),_0xb38f('0x97')]]}]}]})[_0xb38f('0x20')](handleEntityNotFound(_0x1ba6da,null))['then'](function(_0x22969e){if(_0x22969e&&_0x22969e[_0xb38f('0xc0')]){_0x1b4ddb=_0x22969e[_0xb38f('0x38')]({'plain':!![]});if(_0x1b4ddb[_0xb38f('0xc0')]&&_0x1b4ddb[_0xb38f('0xc0')][_0xb38f('0x99')][_0xb38f('0x48')]){return _0x1b4ddb[_0xb38f('0xc0')][_0xb38f('0x99')][0x0];}return db[_0xb38f('0x76')]['create'](_[_0xb38f('0x19')](_0x108ef6[_0xb38f('0x58')],{'firstName':_0x2ddcca,'mobile':_0x2ddcca,'phone':_0x2ddcca,'ListId':_0x1b4ddb['ListId']}));}})[_0xb38f('0x20')](handleEntityNotFound(_0x1ba6da,null))[_0xb38f('0x20')](function(_0x3daf56){if(_0x3daf56){_0x69dfca=_0x3daf56;return db[_0xb38f('0x9b')][_0xb38f('0x56')]({'where':{'ContactId':_0x69dfca['id'],'closed':![],'SmsAccountId':_0x1b4ddb['id']}})[_0xb38f('0x20')](function(_0x386c1b){if(_0x386c1b){return[_0x386c1b,![]];}return db[_0xb38f('0x9b')][_0xb38f('0x57')]({'UserId':_0x108ef6[_0xb38f('0xc1')]['id'],'ContactId':_0x69dfca['id'],'SmsAccountId':_0x1b4ddb['id'],'phone':_0x2ddcca,'firstMsgDirection':_0xb38f('0xc2'),'Messages':[_['merge'](_0x108ef6['body'],{'read':![],'body':_0x108ef6[_0xb38f('0x58')]['body'],'phone':_0x2ddcca,'SmsAccountId':_0x1b4ddb['id'],'UserId':_0x108ef6['user']['id'],'ContactId':_0x69dfca['id']})]},{'include':[{'model':db[_0xb38f('0xa2')],'as':'Messages'}]})['then'](function(_0x423b49){return[_0x423b49,!![]];});});}})[_0xb38f('0x9c')](function(_0x4b2b5f,_0x2628ab){if(_0x2628ab){return _0x4b2b5f;}return db['SmsMessage'][_0xb38f('0x57')](_[_0xb38f('0x4e')](_0x108ef6[_0xb38f('0x58')],{'read':![],'body':_0x108ef6[_0xb38f('0x58')]['body'],'phone':_0x2ddcca,'SmsAccountId':_0x1b4ddb['id'],'SmsInteractionId':_0x4b2b5f['id'],'UserId':_0x108ef6[_0xb38f('0xc1')]['id'],'ContactId':_0x69dfca['id']}))[_0xb38f('0x20')](function(_0x52dd65){_0x4b2b5f[_0xb38f('0xc3')][_0xb38f('0xc4')]=[];_0x4b2b5f['dataValues']['Messages'][_0xb38f('0xc5')](_0x52dd65[_0xb38f('0xc3')]);return _0x4b2b5f;});})[_0xb38f('0x20')](respondWithResult(_0x1ba6da,null))['catch'](handleError(_0x1ba6da,null));};exports[_0xb38f('0x2c')]=function(_0x3ffa48,_0x58da8b,_0x308ead){if(_0x3ffa48['body']['id']){delete _0x3ffa48['body']['id'];}var _0x576f7d,_0x3854db,_0x1288af;return db[_0xb38f('0x51')]['find']({'where':{'id':_0x3ffa48[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x58da8b,null))['then'](function(_0x2d15dd){if(_0x2d15dd){_0x1288af=_0x2d15dd;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb38f('0x2c'),'received\x20delivery\x20report\x20from',_0x2d15dd[_0xb38f('0x3f')],util['inspect'](_0x3ffa48['body'],{'showHidden':![],'depth':null}));switch(_0x2d15dd[_0xb38f('0x3f')]){case _0xb38f('0xc6'):if(_0x3ffa48[_0xb38f('0x58')][_0xb38f('0xc7')]&&_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x2c')]){_0x3854db=_0x3ffa48['body'][_0xb38f('0x2c')];return db['SmsMessage'][_0xb38f('0x56')]({'where':{'messageId':_0x3ffa48[_0xb38f('0x58')][_0xb38f('0xc7')]}});}break;case _0xb38f('0xc8'):if(_0x3ffa48[_0xb38f('0x58')][_0xb38f('0xc9')]&&_0x3ffa48[_0xb38f('0x58')][_0xb38f('0xca')]){_0x3854db=_0x3ffa48['body'][_0xb38f('0xca')];return db[_0xb38f('0xa2')][_0xb38f('0x56')]({'where':{'messageId':_0x3ffa48[_0xb38f('0x58')]['requestid']}});}break;case _0xb38f('0xcb'):if(_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x86')]&&_0x3ffa48[_0xb38f('0x58')][_0xb38f('0xcc')]){_0x3854db=_0x3ffa48[_0xb38f('0x58')]['status_code'];return db[_0xb38f('0xa2')][_0xb38f('0x56')]({'where':{'messageId':_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x86')]}});}break;case _0xb38f('0xcd'):var _0x346deb=_0x3ffa48['body'][_0xb38f('0x89')][0x0];if(_0x346deb['messageId']&&_0x346deb[_0xb38f('0x2c')][_0xb38f('0xce')]===_0xb38f('0xcf')){_0x3854db=_0x346deb[_0xb38f('0x2c')][_0xb38f('0xce')];return db[_0xb38f('0xa2')]['find']({'where':{'messageId':_0x346deb['messageId']}});}break;case'clickatell':if(_0x3ffa48[_0xb38f('0x58')]['messageId']&&_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x2c')]){_0x3854db=_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x2c')];return db[_0xb38f('0xa2')][_0xb38f('0x56')]({'where':{'messageId':_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x83')]}});}break;case _0xb38f('0xd0'):if(_0x3ffa48[_0xb38f('0x58')][0x0][_0xb38f('0x28')]['id']){_0x3854db=_0x3ffa48[_0xb38f('0x58')][0x0][_0xb38f('0x3f')];return db[_0xb38f('0xa2')]['find']({'where':{'messageId':_0x3ffa48[_0xb38f('0x58')][0x0][_0xb38f('0x28')]['id']}});}break;case _0xb38f('0x8d'):if(_0x3ffa48['body'][_0xb38f('0xd1')]&&_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x2c')]){_0x3854db=_0x3ffa48[_0xb38f('0x58')][_0xb38f('0x2c')];return db[_0xb38f('0xa2')]['find']({'where':{'messageId':_0x3ffa48['body'][_0xb38f('0xd1')]}});}break;}}})[_0xb38f('0x20')](handleEntityNotFound(_0x58da8b,null))[_0xb38f('0x20')](function(_0x337510){if(_0x337510){_0x576f7d=_0x337510;switch(_0x1288af[_0xb38f('0x3f')]){case _0xb38f('0xc6'):if(_0x3854db===_0xb38f('0xcf')){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger[_0xb38f('0x26')](_0xb38f('0x24'),'status','skebby',util[_0xb38f('0xd2')](_0x3ffa48['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3854db==='1'){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger[_0xb38f('0x26')](_0xb38f('0x24'),'status',_0xb38f('0xc6'),util['inspect'](_0x3ffa48[_0xb38f('0x58')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3ffa48['body'][_0xb38f('0xd3')]&&_0x3854db>=0xc8&&_0x3854db<=0xce){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger['error'](_0xb38f('0x24'),_0xb38f('0x2c'),'clicksend',util[_0xb38f('0xd2')](_0x3ffa48[_0xb38f('0x58')],{'showHidden':![],'depth':null}));}break;case _0xb38f('0xcd'):var _0x561b26=_0x3ffa48['body'][_0xb38f('0x89')][0x0];if(_0x561b26['status']['groupName']===_0xb38f('0xcf')){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger[_0xb38f('0x26')](_0xb38f('0x24'),_0xb38f('0x2c'),_0xb38f('0xcd'),util[_0xb38f('0xd2')](_0x3ffa48[_0xb38f('0x58')],{'showHidden':![],'depth':null}));}break;case _0xb38f('0x8c'):if(_0x3854db=='DELIVERED_TO_GATEWAY'||_0x3854db==_0xb38f('0xd4')){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger[_0xb38f('0x26')](_0xb38f('0x24'),_0xb38f('0x2c'),_0xb38f('0x8c'),util[_0xb38f('0xd2')](_0x3ffa48[_0xb38f('0x58')],{'showHidden':![],'depth':null}));}break;case _0xb38f('0xd0'):if(_0x3854db=='message-delivered'){return _0x576f7d[_0xb38f('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb38f('0x2c'),_0xb38f('0xd0'),util[_0xb38f('0xd2')](_0x3ffa48['body'],{'showHidden':![],'depth':null}));}break;case _0xb38f('0x8d'):if(_0x3854db===_0xb38f('0xd5')||_0x3854db===_0xb38f('0xd6')){return _0x576f7d['update']({'read':!![]});}else{logger['error'](_0xb38f('0x24'),_0xb38f('0x2c'),_0xb38f('0x8d'),util[_0xb38f('0xd2')](_0x3ffa48[_0xb38f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x576f7d;}})[_0xb38f('0x20')](respondWithResult(_0x58da8b,null))[_0xb38f('0x2a')](handleError(_0x58da8b,null));};exports['statusGet']=function(_0x441a4b,_0x639cc4,_0x32149a){var _0xb43751,_0x11b5e6,_0x422e96;return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0x441a4b[_0xb38f('0x55')]['id']}})['then'](handleEntityNotFound(_0x639cc4,null))[_0xb38f('0x20')](function(_0x323035){if(_0x323035){_0x422e96=_0x323035;logger[_0xb38f('0x23')](_0xb38f('0x24'),_0xb38f('0x2c'),_0xb38f('0xd7'),_0x323035[_0xb38f('0x3f')],util[_0xb38f('0xd2')](_0x441a4b[_0xb38f('0x42')],{'showHidden':![],'depth':null}));switch(_0x323035[_0xb38f('0x3f')]){case'csc':if(_0x441a4b[_0xb38f('0x42')][_0xb38f('0xd8')]&&_0x441a4b['query'][_0xb38f('0xd9')]){_0x11b5e6=_0x441a4b['query'][_0xb38f('0xd9')];return db[_0xb38f('0xa2')][_0xb38f('0x56')]({'where':{'messageId':_0x441a4b['query'][_0xb38f('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x639cc4,null))['then'](function(_0xae53e9){if(_0xae53e9){_0xb43751=_0xae53e9;switch(_0x422e96[_0xb38f('0x3f')]){case _0xb38f('0xda'):if(_0x11b5e6==='2'||_0x11b5e6==='6'){return _0xb43751[_0xb38f('0x36')]({'read':!![]});}else{logger[_0xb38f('0x26')](_0xb38f('0x24'),_0xb38f('0x2c'),_0xb38f('0xda'),util[_0xb38f('0xd2')](_0x441a4b['query'],{'showHidden':![],'depth':null}));};break;}return _0xb43751;}})[_0xb38f('0x20')](respondWithResult(_0x639cc4,null))[_0xb38f('0x2a')](handleError(_0x639cc4,null));};exports[_0xb38f('0xdb')]=function(_0x56860b,_0x353981,_0x2b96cb){return db[_0xb38f('0x51')][_0xb38f('0x56')]({'where':{'id':_0x56860b[_0xb38f('0x55')]['id']}})['then'](handleEntityNotFound(_0x353981,null))[_0xb38f('0x20')](function(_0x1c907a){if(_0x1c907a){return _0x1c907a['addAgents'](_0x56860b['body'][_0xb38f('0x68')],_['omit'](_0x56860b[_0xb38f('0x58')],['ids','id'])||{})[_0xb38f('0x9c')](function(_0x414b2b){for(var _0x4e22db=0x0;_0x4e22db<_0x56860b[_0xb38f('0x58')][_0xb38f('0x68')][_0xb38f('0x48')];_0x4e22db+=0x1){socket[_0xb38f('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x56860b[_0xb38f('0x58')][_0xb38f('0x68')][_0x4e22db]),'SmsAccountId':Number(_0x56860b[_0xb38f('0x55')]['id'])});}return _0x414b2b;});}})[_0xb38f('0x20')](respondWithResult(_0x353981,null))['catch'](handleError(_0x353981,null));};exports[_0xb38f('0xdd')]=function(_0x1c0718,_0x12869d,_0x317b2c){return db['SmsAccount'][_0xb38f('0x56')]({'where':{'id':_0x1c0718['params']['id']}})['then'](handleEntityNotFound(_0x12869d,null))[_0xb38f('0x20')](function(_0x4a0f42){if(_0x4a0f42){return _0x4a0f42['removeAgents'](_0x1c0718[_0xb38f('0x42')][_0xb38f('0x68')])[_0xb38f('0x20')](function(){if(_[_0xb38f('0xde')](_0x1c0718[_0xb38f('0x42')][_0xb38f('0x68')])){for(var _0x1e0c7f=0x0;_0x1e0c7f<_0x1c0718[_0xb38f('0x42')][_0xb38f('0x68')][_0xb38f('0x48')];_0x1e0c7f+=0x1){socket[_0xb38f('0xdc')](_0xb38f('0xdf'),{'UserId':Number(_0x1c0718[_0xb38f('0x42')]['ids'][_0x1e0c7f]),'SmsAccountId':Number(_0x1c0718[_0xb38f('0x55')]['id'])});}}else{socket['emit'](_0xb38f('0xdf'),{'UserId':Number(_0x1c0718['query'][_0xb38f('0x68')]),'SmsAccountId':Number(_0x1c0718[_0xb38f('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x12869d,null))[_0xb38f('0x2a')](handleError(_0x12869d,null));};exports[_0xb38f('0xe0')]=function(_0x3f8525,_0x21fa1d,_0x13f4bf){var _0x8d91c2={};var _0x47f1e4={};var _0x5320f1;var _0x36cf33;return db[_0xb38f('0x51')][_0xb38f('0x63')]({'where':{'id':_0x3f8525[_0xb38f('0x55')]['id']}})[_0xb38f('0x20')](handleEntityNotFound(_0x21fa1d,null))[_0xb38f('0x20')](function(_0x52242e){if(_0x52242e){_0x5320f1=_0x52242e;_0x47f1e4[_0xb38f('0x40')]=_[_0xb38f('0x43')](db['User'][_0xb38f('0xb9')]);_0x47f1e4['query']=_['keys'](_0x3f8525['query']);_0x47f1e4[_0xb38f('0x44')]=_[_0xb38f('0x45')](_0x47f1e4['model'],_0x47f1e4[_0xb38f('0x42')]);_0x8d91c2[_0xb38f('0x47')]=_['intersection'](_0x47f1e4[_0xb38f('0x40')],qs[_0xb38f('0x46')](_0x3f8525[_0xb38f('0x42')]['fields']));_0x8d91c2[_0xb38f('0x47')]=_0x8d91c2[_0xb38f('0x47')][_0xb38f('0x48')]?_0x8d91c2[_0xb38f('0x47')]:_0x47f1e4['model'];_0x8d91c2[_0xb38f('0x4a')]=qs[_0xb38f('0x64')](_0x3f8525[_0xb38f('0x42')][_0xb38f('0x64')]);_0x8d91c2['where']=qs['filters'](_[_0xb38f('0x4c')](_0x3f8525['query'],_0x47f1e4['filters']));if(_0x3f8525[_0xb38f('0x42')][_0xb38f('0x4d')]){_0x8d91c2[_0xb38f('0x4b')]=_['merge'](_0x8d91c2['where'],{'$or':_[_0xb38f('0x41')](_0x8d91c2[_0xb38f('0x47')],function(_0x4e34a0){var _0x344fa0={};_0x344fa0[_0x4e34a0]={'$like':'%'+_0x3f8525[_0xb38f('0x42')][_0xb38f('0x4d')]+'%'};return _0x344fa0;})});}_0x8d91c2=_[_0xb38f('0x4e')]({},_0x8d91c2,_0x3f8525[_0xb38f('0x50')]);return _0x5320f1[_0xb38f('0xe0')](_0x8d91c2);}})[_0xb38f('0x20')](function(_0x26be11){if(_0x26be11){_0x36cf33=_0x26be11[_0xb38f('0x48')];if(!_0x3f8525[_0xb38f('0x42')]['hasOwnProperty'](_0xb38f('0x49'))){_0x8d91c2[_0xb38f('0x31')]=qs['limit'](_0x3f8525[_0xb38f('0x42')]['limit']);_0x8d91c2[_0xb38f('0x30')]=qs[_0xb38f('0x30')](_0x3f8525['query']['offset']);}return _0x5320f1[_0xb38f('0xe0')](_0x8d91c2);}})['then'](function(_0x223d84){if(_0x223d84){return _0x223d84?{'count':_0x36cf33,'rows':_0x223d84}:null;}})['then'](respondWithResult(_0x21fa1d,null))[_0xb38f('0x2a')](handleError(_0x21fa1d,null));}; \ No newline at end of file +var _0x2c20=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addDisposition','SmsAccountId','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','messageId','infobip','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','SmsMessage','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','results','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','received\x20delivery\x20report\x20from','message-id','state','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x575d3d,_0x1b92d7){var _0x49e231=function(_0x524fe4){while(--_0x524fe4){_0x575d3d['push'](_0x575d3d['shift']());}};_0x49e231(++_0x1b92d7);}(_0x2c20,0x1bc));var _0x02c2=function(_0xc56b79,_0x31ff15){_0xc56b79=_0xc56b79-0x0;var _0x4c0536=_0x2c20[_0xc56b79];return _0x4c0536;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02c2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02c2('0x2'));var Mustache=require(_0x02c2('0x3'));var util=require(_0x02c2('0x4'));var path=require(_0x02c2('0x5'));var sox=require(_0x02c2('0x6'));var csv=require(_0x02c2('0x7'));var ejs=require(_0x02c2('0x8'));var fs=require('fs');var fs_extra=require(_0x02c2('0x9'));var _=require(_0x02c2('0xa'));var squel=require(_0x02c2('0xb'));var crypto=require(_0x02c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x02c2('0xd'));var toCsv=require(_0x02c2('0x7'));var querystring=require(_0x02c2('0xe'));var Papa=require(_0x02c2('0xf'));var Redis=require(_0x02c2('0x10'));var authService=require(_0x02c2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x02c2('0x12'));var hardwareService=require(_0x02c2('0x13'));var logger=require(_0x02c2('0x14'))('api');var utils=require(_0x02c2('0x15'));var config=require(_0x02c2('0x16'));var licenseUtil=require(_0x02c2('0x17'));var db=require(_0x02c2('0x18'))['db'];config[_0x02c2('0x19')]=_[_0x02c2('0x1a')](config[_0x02c2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x02c2('0x1b'))(new Redis(config[_0x02c2('0x19')]));require('./smsAccount.socket')[_0x02c2('0x1c')](socket);var jayson=require(_0x02c2('0x1d'));var client=jayson[_0x02c2('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4d2515,_0x16b369,_0x1efeb5,_0x1ff51d){return new BPromise(function(_0x228f8b,_0x48545b){var _0x1ce2fb=_0x1ff51d||client;return _0x1ce2fb[_0x02c2('0x1f')](_0x4d2515,_0x1efeb5)[_0x02c2('0x20')](function(_0x314173){logger[_0x02c2('0x21')](_0x02c2('0x22'),_0x16b369,'request\x20sent');logger[_0x02c2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16b369,'request\x20sent',JSON[_0x02c2('0x24')](_0x314173));if(_0x314173[_0x02c2('0x25')]){if(_0x314173['error'][_0x02c2('0x26')]===0x1f4){logger['error'](_0x02c2('0x22'),_0x16b369,_0x314173[_0x02c2('0x25')][_0x02c2('0x27')]);return _0x48545b(_0x314173[_0x02c2('0x25')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x16b369,_0x314173[_0x02c2('0x25')][_0x02c2('0x27')]);return _0x228f8b(_0x314173['error'][_0x02c2('0x27')]);}else{logger[_0x02c2('0x21')](_0x02c2('0x22'),_0x16b369,'request\x20sent');_0x228f8b(_0x314173[_0x02c2('0x28')][_0x02c2('0x27')]);}})[_0x02c2('0x29')](function(_0x357914){logger[_0x02c2('0x25')](_0x02c2('0x22'),_0x16b369,_0x357914);_0x48545b(_0x357914);});});}function respondWithStatusCode(_0x4bad0f,_0x4ca986){_0x4ca986=_0x4ca986||0xcc;return function(_0x11c240){if(_0x11c240){return _0x4bad0f[_0x02c2('0x2a')](_0x4ca986);}return _0x4bad0f[_0x02c2('0x2b')](_0x4ca986)[_0x02c2('0x2c')]();};}function respondWithResult(_0xe7a550,_0x2ab13e){_0x2ab13e=_0x2ab13e||0xc8;return function(_0x6e5535){if(_0x6e5535){return _0xe7a550['status'](_0x2ab13e)['json'](_0x6e5535);}};}function respondWithFilteredResult(_0x254ab7,_0x27c7d5){return function(_0x5dd80b){if(_0x5dd80b){var _0x424466=typeof _0x27c7d5[_0x02c2('0x2d')]===_0x02c2('0x2e')&&typeof _0x27c7d5[_0x02c2('0x2f')]===_0x02c2('0x2e');var _0x1b14f6=_0x5dd80b['count'];var _0x2aea95=_0x424466?0x0:_0x27c7d5[_0x02c2('0x2d')];var _0x28555d=_0x424466?_0x5dd80b[_0x02c2('0x30')]:_0x27c7d5['offset']+_0x27c7d5[_0x02c2('0x2f')];var _0x25f97f;if(_0x28555d>=_0x1b14f6){_0x28555d=_0x1b14f6;_0x25f97f=0xc8;}else{_0x25f97f=0xce;}_0x254ab7['status'](_0x25f97f);return _0x254ab7['set'](_0x02c2('0x31'),_0x2aea95+'-'+_0x28555d+'/'+_0x1b14f6)[_0x02c2('0x32')](_0x5dd80b);}return null;};}function patchUpdates(_0x57a90d){return function(_0x25d301){try{jsonpatch[_0x02c2('0x33')](_0x25d301,_0x57a90d,!![]);}catch(_0x167f80){return BPromise[_0x02c2('0x34')](_0x167f80);}return _0x25d301[_0x02c2('0x35')]();};}function saveUpdates(_0x5e96fc,_0x483b70){return function(_0xe5832c){if(_0xe5832c){return _0xe5832c['update'](_0x5e96fc)[_0x02c2('0x20')](function(_0x23d0a2){return _0x23d0a2;});}return null;};}function removeEntity(_0xfcde25,_0x29a31c){return function(_0x991939){if(_0x991939){return _0x991939['destroy']()[_0x02c2('0x20')](function(){var _0x4498cb=_0x991939[_0x02c2('0x36')]({'plain':!![]});var _0x4758a8=_0x02c2('0x37');return db[_0x02c2('0x38')]['destroy']({'where':{'type':_0x4758a8,'resourceId':_0x4498cb['id']}})['then'](function(){return _0x991939;});})[_0x02c2('0x20')](function(){_0xfcde25['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc65c,_0x22433b){return function(_0x59ad18){if(!_0x59ad18){_0x1fc65c['sendStatus'](0x194);}return _0x59ad18;};}function handleError(_0x477e4e,_0x12044d){_0x12044d=_0x12044d||0x1f4;return function(_0x489232){logger[_0x02c2('0x25')](_0x489232['stack']);if(_0x489232[_0x02c2('0x39')]){delete _0x489232['name'];}_0x477e4e['status'](_0x12044d)[_0x02c2('0x3a')](_0x489232);};}exports['index']=function(_0x18c6c6,_0x1c7519){var _0x55c902={'include':[{'model':db[_0x02c2('0x3b')],'as':_0x02c2('0x3c')}]},_0xe6e31b={},_0x5f548a={'count':0x0,'rows':[]};var _0x2bc97d=_[_0x02c2('0x3d')](db[_0x02c2('0x3e')][_0x02c2('0x3f')],function(_0x13a29e){return{'name':_0x13a29e['fieldName'],'type':_0x13a29e[_0x02c2('0x40')][_0x02c2('0x41')]};});_0xe6e31b[_0x02c2('0x42')]=_[_0x02c2('0x3d')](_0x2bc97d,_0x02c2('0x39'));_0xe6e31b['query']=_[_0x02c2('0x43')](_0x18c6c6['query']);_0xe6e31b[_0x02c2('0x44')]=_[_0x02c2('0x45')](_0xe6e31b[_0x02c2('0x42')],_0xe6e31b['query']);_0x55c902[_0x02c2('0x46')]=_[_0x02c2('0x45')](_0xe6e31b[_0x02c2('0x42')],qs[_0x02c2('0x47')](_0x18c6c6[_0x02c2('0x48')]['fields']));_0x55c902['attributes']=_0x55c902['attributes']['length']?_0x55c902['attributes']:_0xe6e31b[_0x02c2('0x42')];if(!_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x49')](_0x02c2('0x4a'))){_0x55c902[_0x02c2('0x2f')]=qs['limit'](_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x2f')]);_0x55c902['offset']=qs[_0x02c2('0x2d')](_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x2d')]);}_0x55c902[_0x02c2('0x4b')]=qs[_0x02c2('0x4c')](_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x4c')]);_0x55c902[_0x02c2('0x4d')]=qs[_0x02c2('0x44')](_['pick'](_0x18c6c6[_0x02c2('0x48')],_0xe6e31b[_0x02c2('0x44')]),_0x2bc97d);if(_0x18c6c6[_0x02c2('0x48')]['filter']){_0x55c902[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x55c902[_0x02c2('0x4d')],{'$or':_['map'](_0x2bc97d,function(_0x1f4c7e){if(_0x1f4c7e['type']!==_0x02c2('0x4f')){var _0x777ba2={};_0x777ba2[_0x1f4c7e[_0x02c2('0x39')]]={'$like':'%'+_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x50')]+'%'};return _0x777ba2;}})});}_0x55c902=_[_0x02c2('0x4e')]({},_0x55c902,_0x18c6c6[_0x02c2('0x51')]);var _0x35a7de={'where':_0x55c902[_0x02c2('0x4d')]};return db['SmsAccount'][_0x02c2('0x30')](_0x35a7de)[_0x02c2('0x20')](function(_0x25fea4){_0x5f548a[_0x02c2('0x30')]=_0x25fea4;if(_0x18c6c6[_0x02c2('0x48')][_0x02c2('0x52')]){_0x55c902[_0x02c2('0x53')]=[{'all':!![]}];}return db[_0x02c2('0x3e')][_0x02c2('0x54')](_0x55c902);})[_0x02c2('0x20')](function(_0x464f79){_0x5f548a['rows']=_0x464f79;return _0x5f548a;})[_0x02c2('0x20')](respondWithFilteredResult(_0x1c7519,_0x55c902))['catch'](handleError(_0x1c7519,null));};exports[_0x02c2('0x55')]=function(_0x3c15cc,_0x78c62f){var _0x399537={'raw':![],'where':{'id':_0x3c15cc[_0x02c2('0x56')]['id']},'include':[{'model':db[_0x02c2('0x3b')],'as':_0x02c2('0x3c')}]},_0x75bbf9={};_0x75bbf9[_0x02c2('0x42')]=_[_0x02c2('0x43')](db[_0x02c2('0x3e')][_0x02c2('0x3f')]);_0x75bbf9[_0x02c2('0x48')]=_[_0x02c2('0x43')](_0x3c15cc[_0x02c2('0x48')]);_0x75bbf9[_0x02c2('0x44')]=_[_0x02c2('0x45')](_0x75bbf9['model'],_0x75bbf9[_0x02c2('0x48')]);_0x399537['attributes']=_[_0x02c2('0x45')](_0x75bbf9['model'],qs[_0x02c2('0x47')](_0x3c15cc[_0x02c2('0x48')][_0x02c2('0x47')]));_0x399537[_0x02c2('0x46')]=_0x399537[_0x02c2('0x46')][_0x02c2('0x57')]?_0x399537['attributes']:_0x75bbf9[_0x02c2('0x42')];if(_0x3c15cc['query'][_0x02c2('0x52')]){_0x399537[_0x02c2('0x53')]=[{'all':!![]}];}_0x399537=_[_0x02c2('0x4e')]({},_0x399537,_0x3c15cc['options']);return db[_0x02c2('0x3e')]['find'](_0x399537)[_0x02c2('0x20')](handleEntityNotFound(_0x78c62f,null))[_0x02c2('0x20')](respondWithResult(_0x78c62f,null))['catch'](handleError(_0x78c62f,null));};exports[_0x02c2('0x58')]=function(_0x13a822,_0x5c0110){return db[_0x02c2('0x3e')][_0x02c2('0x58')](_0x13a822['body'],{})[_0x02c2('0x20')](function(_0x567a8f){var _0x24bc16=_0x13a822['user'][_0x02c2('0x36')]({'plain':!![]});if(!_0x24bc16)throw new Error(_0x02c2('0x59'));if(_0x24bc16['role']==='user'){var _0x520441=_0x567a8f[_0x02c2('0x36')]({'plain':!![]});var _0x5df9ab=_0x02c2('0x37');return db[_0x02c2('0x5a')][_0x02c2('0x5b')]({'where':{'name':_0x5df9ab,'userProfileId':_0x24bc16[_0x02c2('0x5c')]},'raw':!![]})[_0x02c2('0x20')](function(_0x5d7583){if(_0x5d7583&&_0x5d7583['autoAssociation']===0x0){return db['UserProfileResource'][_0x02c2('0x58')]({'name':_0x520441[_0x02c2('0x39')],'resourceId':_0x520441['id'],'type':_0x5d7583[_0x02c2('0x39')],'sectionId':_0x5d7583['id']},{})[_0x02c2('0x20')](function(){return _0x567a8f;});}else{return _0x567a8f;}})['catch'](function(_0x2c196a){logger['error'](_0x02c2('0x5d'),_0x2c196a);throw _0x2c196a;});}return _0x567a8f;})[_0x02c2('0x20')](respondWithResult(_0x5c0110,0xc9))[_0x02c2('0x29')](handleError(_0x5c0110,null));};exports[_0x02c2('0x5e')]=function(_0x3e45e5,_0x730584){if(_0x3e45e5['body']['id']){delete _0x3e45e5['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x3e45e5['params']['id']},'include':[{'model':db[_0x02c2('0x3b')],'as':_0x02c2('0x3c')}]})[_0x02c2('0x20')](handleEntityNotFound(_0x730584,null))['then'](saveUpdates(_0x3e45e5[_0x02c2('0x5f')],null))[_0x02c2('0x20')](respondWithResult(_0x730584,null))['catch'](handleError(_0x730584,null));};exports[_0x02c2('0x60')]=function(_0x2b3bb1,_0x50ce3c){return db[_0x02c2('0x3e')]['find']({'where':{'id':_0x2b3bb1[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x50ce3c,null))[_0x02c2('0x20')](removeEntity(_0x50ce3c,null))[_0x02c2('0x29')](handleError(_0x50ce3c,null));};exports['describe']=function(_0x5e8a8d,_0x4d0625){return db[_0x02c2('0x3e')][_0x02c2('0x61')]()[_0x02c2('0x20')](respondWithResult(_0x4d0625,null))['catch'](handleError(_0x4d0625,null));};exports[_0x02c2('0x62')]=function(_0x55fe3f,_0x1639a4,_0x13de03){if(_0x55fe3f[_0x02c2('0x5f')]['id']){delete _0x55fe3f['body']['id'];}return db[_0x02c2('0x3e')]['find']({'where':{'id':_0x55fe3f[_0x02c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1639a4,null))['then'](function(_0x543922){if(_0x543922){_0x55fe3f['body'][_0x02c2('0x63')]=_0x543922['id'];return db['Disposition'][_0x02c2('0x58')](_0x55fe3f[_0x02c2('0x5f')]);}})[_0x02c2('0x20')](respondWithResult(_0x1639a4,null))['catch'](handleError(_0x1639a4,null));};exports['getDispositions']=function(_0x2995e0,_0xea1930,_0x27d357){var _0x30d73b={'raw':![],'where':{}};var _0xcff2e4={};var _0x1a1794={'count':0x0,'rows':[]};return db['SmsAccount'][_0x02c2('0x64')]({'where':{'id':_0x2995e0['params']['id']}})['then'](handleEntityNotFound(_0xea1930,null))[_0x02c2('0x20')](function(_0x16e0f6){if(_0x16e0f6){_0xcff2e4['model']=_['keys'](db[_0x02c2('0x65')][_0x02c2('0x3f')]);_0xcff2e4['query']=_['keys'](_0x2995e0[_0x02c2('0x48')]);_0xcff2e4['filters']=_[_0x02c2('0x45')](_0xcff2e4[_0x02c2('0x42')],_0xcff2e4[_0x02c2('0x48')]);_0x30d73b[_0x02c2('0x46')]=_[_0x02c2('0x45')](_0xcff2e4[_0x02c2('0x42')],qs[_0x02c2('0x47')](_0x2995e0[_0x02c2('0x48')][_0x02c2('0x47')]));_0x30d73b[_0x02c2('0x46')]=_0x30d73b['attributes'][_0x02c2('0x57')]?_0x30d73b[_0x02c2('0x46')]:_0xcff2e4[_0x02c2('0x42')];if(!_0x2995e0[_0x02c2('0x48')]['hasOwnProperty'](_0x02c2('0x4a'))){_0x30d73b['limit']=qs[_0x02c2('0x2f')](_0x2995e0['query'][_0x02c2('0x2f')]);_0x30d73b[_0x02c2('0x2d')]=qs[_0x02c2('0x2d')](_0x2995e0[_0x02c2('0x48')][_0x02c2('0x2d')]);}_0x30d73b[_0x02c2('0x4b')]=qs['sort'](_0x2995e0[_0x02c2('0x48')][_0x02c2('0x4c')]);_0x30d73b[_0x02c2('0x4d')]=qs[_0x02c2('0x44')](_['pick'](_0x2995e0[_0x02c2('0x48')],_0xcff2e4[_0x02c2('0x44')]));_0x30d73b[_0x02c2('0x4d')]['SmsAccountId']=_0x16e0f6['id'];if(_0x2995e0['query']['filter']){_0x30d73b[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x30d73b[_0x02c2('0x4d')],{'$or':_[_0x02c2('0x3d')](_0x30d73b['attributes'],function(_0x266f78){var _0x4053e4={};_0x4053e4[_0x266f78]={'$like':'%'+_0x2995e0[_0x02c2('0x48')][_0x02c2('0x50')]+'%'};return _0x4053e4;})});}_0x30d73b=_[_0x02c2('0x4e')]({},_0x30d73b,_0x2995e0['options']);return db['Disposition'][_0x02c2('0x30')]({'where':_0x30d73b[_0x02c2('0x4d')]})['then'](function(_0x28ee82){_0x1a1794[_0x02c2('0x30')]=_0x28ee82;if(_0x2995e0[_0x02c2('0x48')][_0x02c2('0x52')]){_0x30d73b[_0x02c2('0x53')]=[{'all':!![]}];}return db[_0x02c2('0x65')][_0x02c2('0x54')](_0x30d73b);})['then'](function(_0x2ed284){_0x1a1794[_0x02c2('0x66')]=_0x2ed284;return _0x1a1794;});}})[_0x02c2('0x20')](respondWithFilteredResult(_0xea1930,_0x30d73b))['catch'](handleError(_0xea1930,null));};exports[_0x02c2('0x67')]=function(_0xff57b8,_0x164a30,_0x74a59c){return db['SmsAccount'][_0x02c2('0x5b')]({'where':{'id':_0xff57b8[_0x02c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x164a30,null))[_0x02c2('0x20')](function(_0x45a71e){if(_0x45a71e){return _0x45a71e[_0x02c2('0x67')](_0xff57b8['query'][_0x02c2('0x68')]);}})[_0x02c2('0x20')](respondWithStatusCode(_0x164a30,null))[_0x02c2('0x29')](handleError(_0x164a30,null));};exports[_0x02c2('0x69')]=function(_0x1f6e4b,_0x45697b,_0xab2c50){if(_0x1f6e4b[_0x02c2('0x5f')]['id']){delete _0x1f6e4b[_0x02c2('0x5f')]['id'];}return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x1f6e4b['params']['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x45697b,null))['then'](function(_0x40e92b){if(_0x40e92b){_0x1f6e4b['body'][_0x02c2('0x63')]=_0x40e92b['id'];return db[_0x02c2('0x6a')][_0x02c2('0x58')](_0x1f6e4b[_0x02c2('0x5f')]);}})['then'](respondWithResult(_0x45697b,null))[_0x02c2('0x29')](handleError(_0x45697b,null));};exports['getAnswers']=function(_0x4392e7,_0x1db721,_0xf0b6b9){var _0x260efb={'raw':![],'where':{}};var _0x3e03aa={};var _0x466e2d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x02c2('0x64')]({'where':{'id':_0x4392e7[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x1db721,null))['then'](function(_0x15adf2){if(_0x15adf2){_0x3e03aa['model']=_[_0x02c2('0x43')](db[_0x02c2('0x6a')]['rawAttributes']);_0x3e03aa[_0x02c2('0x48')]=_[_0x02c2('0x43')](_0x4392e7[_0x02c2('0x48')]);_0x3e03aa[_0x02c2('0x44')]=_[_0x02c2('0x45')](_0x3e03aa[_0x02c2('0x42')],_0x3e03aa['query']);_0x260efb['attributes']=_[_0x02c2('0x45')](_0x3e03aa[_0x02c2('0x42')],qs['fields'](_0x4392e7['query'][_0x02c2('0x47')]));_0x260efb[_0x02c2('0x46')]=_0x260efb[_0x02c2('0x46')][_0x02c2('0x57')]?_0x260efb['attributes']:_0x3e03aa['model'];if(!_0x4392e7['query']['hasOwnProperty'](_0x02c2('0x4a'))){_0x260efb['limit']=qs[_0x02c2('0x2f')](_0x4392e7[_0x02c2('0x48')][_0x02c2('0x2f')]);_0x260efb[_0x02c2('0x2d')]=qs[_0x02c2('0x2d')](_0x4392e7[_0x02c2('0x48')][_0x02c2('0x2d')]);}_0x260efb[_0x02c2('0x4b')]=qs[_0x02c2('0x4c')](_0x4392e7[_0x02c2('0x48')]['sort']);_0x260efb[_0x02c2('0x4d')]=qs['filters'](_[_0x02c2('0x6b')](_0x4392e7[_0x02c2('0x48')],_0x3e03aa[_0x02c2('0x44')]));_0x260efb[_0x02c2('0x4d')][_0x02c2('0x63')]=_0x15adf2['id'];if(_0x4392e7['query'][_0x02c2('0x50')]){_0x260efb[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x260efb['where'],{'$or':_['map'](_0x260efb['attributes'],function(_0x4dc8ef){var _0xfcf283={};_0xfcf283[_0x4dc8ef]={'$like':'%'+_0x4392e7[_0x02c2('0x48')]['filter']+'%'};return _0xfcf283;})});}_0x260efb=_[_0x02c2('0x4e')]({},_0x260efb,_0x4392e7[_0x02c2('0x51')]);return db[_0x02c2('0x6a')][_0x02c2('0x30')]({'where':_0x260efb[_0x02c2('0x4d')]})['then'](function(_0x25aaa9){_0x466e2d[_0x02c2('0x30')]=_0x25aaa9;if(_0x4392e7[_0x02c2('0x48')][_0x02c2('0x52')]){_0x260efb[_0x02c2('0x53')]=[{'all':!![]}];}return db[_0x02c2('0x6a')][_0x02c2('0x54')](_0x260efb);})['then'](function(_0x33e5fb){_0x466e2d[_0x02c2('0x66')]=_0x33e5fb;return _0x466e2d;});}})[_0x02c2('0x20')](respondWithFilteredResult(_0x1db721,_0x260efb))[_0x02c2('0x29')](handleError(_0x1db721,null));};exports[_0x02c2('0x6c')]=function(_0x45357a,_0x37941a,_0x1afba5){return db['SmsAccount'][_0x02c2('0x5b')]({'where':{'id':_0x45357a['params']['id']}})['then'](handleEntityNotFound(_0x37941a,null))[_0x02c2('0x20')](function(_0x14f96b){if(_0x14f96b){return _0x14f96b[_0x02c2('0x6c')](_0x45357a[_0x02c2('0x48')][_0x02c2('0x68')]);}})[_0x02c2('0x20')](respondWithStatusCode(_0x37941a,null))[_0x02c2('0x29')](handleError(_0x37941a,null));};exports[_0x02c2('0x6d')]=function(_0x4305f3,_0x43584e,_0x5f0176){var _0x2b469b={'channel':_0x02c2('0x6e')};var _0x30336e=[];var _0x1f8e9a=[];var _0xc6482f={};return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x4305f3[_0x02c2('0x56')]['id']},'include':[{'model':db[_0x02c2('0x6f')],'as':_0x02c2('0x70')}]})[_0x02c2('0x20')](handleEntityNotFound(_0x43584e,null))[_0x02c2('0x20')](function(_0x2202f8){_0x2b469b[_0x02c2('0x71')]=_0x2202f8;_0x2b469b[_0x02c2('0x72')]=_[_0x02c2('0x73')](_0x2202f8['Applications'],[_0x02c2('0x74')],[_0x02c2('0x75')]);if(_0x2b469b[_0x02c2('0x71')][_0x02c2('0x70')]){delete _0x2b469b[_0x02c2('0x71')][_0x02c2('0x70')];}return db[_0x02c2('0x76')][_0x02c2('0x61')]();})[_0x02c2('0x20')](function(_0x4e5139){if(!_0x4e5139){throw new db[(_0x02c2('0x77'))][(_0x02c2('0x78'))]('no\x20available\x20attributes');}_0x30336e=_[_0x02c2('0x79')](_['keys'](_0x4e5139),[_0x02c2('0x7a'),'updatedAt']);_0x1f8e9a=_[_0x02c2('0x79')](_['keys'](_0x4e5139),[_0x02c2('0x7a'),'updatedAt','CompanyId',_0x02c2('0x7b')]);_0x2b469b[_0x02c2('0x5f')]={'mapKey':_0x02c2('0x7c')};if(_0x2b469b[_0x02c2('0x71')][_0x02c2('0x40')]){switch(_0x2b469b[_0x02c2('0x71')][_0x02c2('0x40')]){case _0x02c2('0x7d'):_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x7f')];_0x2b469b['body'][_0x02c2('0x5f')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x80')];_0x2b469b['body']['messageId']=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x81')];break;case _0x02c2('0x82'):_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')]='+'+_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x83')];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x5f')]=_0x4305f3['body']['text'];break;case _0x02c2('0x84'):_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x7e')];_0x2b469b[_0x02c2('0x5f')]['body']=_0x4305f3[_0x02c2('0x5f')]['message'];break;case _0x02c2('0x85'):_0x2b469b['body'][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x7e')];_0x2b469b[_0x02c2('0x5f')]['body']=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x5f')];_0x2b469b['body']['messageId']=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x86')];break;case _0x02c2('0x87'):_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x7f')];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x5f')]=_0x4305f3[_0x02c2('0x5f')]['Text'];_0x2b469b['body'][_0x02c2('0x88')]=_0x4305f3['body']['MessageUUID'];break;case _0x02c2('0x89'):_0x2b469b[_0x02c2('0x5f')]['from']='+'+_0x4305f3[_0x02c2('0x5f')]['results'][0x0][_0x02c2('0x7e')];_0x2b469b['body'][_0x02c2('0x5f')]=_0x4305f3[_0x02c2('0x5f')]['results'][0x0]['text'];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x88')]=_0x4305f3['body']['results'][0x0][_0x02c2('0x88')];break;case _0x02c2('0x8a'):_0x2b469b[_0x02c2('0x5f')]['from']=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x8b')];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x5f')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x8c')][_0x02c2('0x27')];break;case _0x02c2('0x8d'):_0x2b469b[_0x02c2('0x5f')]['from']=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x8e')];_0x2b469b['body'][_0x02c2('0x5f')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x8f')];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x88')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x90')];break;case'bandwidth':_0x2b469b[_0x02c2('0x5f')]['messageId']=_0x4305f3[_0x02c2('0x5f')][0x0]['message']['id'];_0x2b469b['body'][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][0x0]['message'][_0x02c2('0x7e')];_0x2b469b[_0x02c2('0x5f')]['body']=_0x4305f3[_0x02c2('0x5f')][0x0][_0x02c2('0x27')][_0x02c2('0x8f')];break;case _0x02c2('0x91'):_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x7e')];_0x2b469b[_0x02c2('0x5f')]['body']=_0x4305f3[_0x02c2('0x5f')]['message'];_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x88')]=_0x4305f3[_0x02c2('0x5f')][_0x02c2('0x92')];break;}}if(_0x2b469b[_0x02c2('0x5f')]['id']){delete _0x2b469b[_0x02c2('0x5f')]['id'];}if(_[_0x02c2('0x93')](_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x7e')])){throw new db['Sequelize']['ValidationError'](_0x02c2('0x94'));}if(_[_0x02c2('0x93')](_0x2b469b['body'][_0x02c2('0x5f')])||_0x2b469b['body'][_0x02c2('0x5f')]===''){throw new db[(_0x02c2('0x77'))][(_0x02c2('0x78'))](_0x02c2('0x95'));}if(_['isNil'](_0x2b469b['body']['mapKey'])){throw new db[(_0x02c2('0x77'))]['ValidationError'](_0x02c2('0x96')+_0x1f8e9a);}if(!_[_0x02c2('0x97')](_0x1f8e9a,_0x2b469b['body'][_0x02c2('0x98')])){throw new db[(_0x02c2('0x77'))][(_0x02c2('0x78'))](_0x02c2('0x99')+_0x1f8e9a);}_0xc6482f[_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x98')]]=_0x2b469b['body'][_0x02c2('0x7e')];return db[_0x02c2('0x9a')][_0x02c2('0x5b')]({'where':{'id':_0x2b469b[_0x02c2('0x71')]['ListId']},'include':[{'model':db[_0x02c2('0x76')],'as':_0x02c2('0x9b'),'where':_0xc6482f,'limit':0x1,'order':[[_0x02c2('0x9c'),_0x02c2('0x9d')]]}]});})[_0x02c2('0x20')](handleEntityNotFound(_0x43584e,null))['then'](function(_0x1270e3){if(_0x1270e3){_0x2b469b[_0x02c2('0x9e')]=_[_0x02c2('0x9f')](_0x1270e3,[_0x02c2('0x9b')]);if(_0x1270e3['Contacts']['length']){return _0x1270e3[_0x02c2('0x9b')][0x0];}var _0xd01d8a=_[_0x02c2('0x1a')](_0x2b469b[_0x02c2('0x5f')],{'firstName':_0x2b469b[_0x02c2('0x5f')]['from'],'ListId':_0x1270e3['id']});_0xd01d8a[_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x98')]]=_0x2b469b[_0x02c2('0x5f')]['from'];return db[_0x02c2('0x76')]['create'](_0xd01d8a,{'fields':_0x30336e,'raw':!![]});}})[_0x02c2('0x20')](handleEntityNotFound(_0x43584e,null))[_0x02c2('0x20')](function(_0x48d54d){if(_0x48d54d){_0x2b469b[_0x02c2('0xa0')]=_0x48d54d;var _0x17e8cc={'ContactId':_0x48d54d['id'],'phone':_0x2b469b['body'][_0x02c2('0x7e')],'SmsAccountId':_0x4305f3[_0x02c2('0x56')]['id']};var _0x178405={'ContactId':_0x48d54d['id'],'SmsAccountId':_0x4305f3['params']['id'],'closed':![]};return db[_0x02c2('0xa1')][_0x02c2('0x5b')]({'where':_0x178405})[_0x02c2('0x20')](function(_0x27c588){if(_0x27c588){return[_0x27c588,![]];}return db[_0x02c2('0xa1')][_0x02c2('0x58')](_0x17e8cc)[_0x02c2('0x20')](function(_0x343795){return[_0x343795,!![]];});});}})[_0x02c2('0xa2')](function(_0x30fad6,_0x4177f9){_0x2b469b[_0x02c2('0xa3')]=_0x30fad6[_0x02c2('0x36')]({'plain':!![]});_0x2b469b[_0x02c2('0xa3')][_0x02c2('0xa4')]=![];if(_0x4177f9){if(_0x2b469b[_0x02c2('0x71')][_0x02c2('0xa5')]){_0x2b469b['applications'][_0x02c2('0xa6')]({'id':0x0,'priority':_0x2b469b[_0x02c2('0x72')][_0x02c2('0x57')]+0x1,'app':_0x02c2('0xa7'),'appdata':_0x02c2('0xa8'),'interval':_0x02c2('0xa9')});}_0x2b469b[_0x02c2('0xa3')][_0x02c2('0xa4')]=!![];}return db['SmsMessage'][_0x02c2('0x58')]({'phone':_0x2b469b[_0x02c2('0x5f')]['from'],'messageId':_0x2b469b[_0x02c2('0x5f')]['messageId'],'body':_0x2b469b[_0x02c2('0x5f')][_0x02c2('0x5f')],'SmsAccountId':_0x4305f3['params']['id'],'SmsInteractionId':_0x30fad6['id'],'direction':'in','ContactId':_0x30fad6[_0x02c2('0xaa')],'AttachmentId':_0x2b469b[_0x02c2('0x5f')][_0x02c2('0xab')]});})[_0x02c2('0x20')](function(_0x1bc381){_0x2b469b[_0x02c2('0x27')]=_0x1bc381;if(_0x2b469b[_0x02c2('0xa3')][_0x02c2('0xac')]){return db[_0x02c2('0xad')][_0x02c2('0x5b')]({'attributes':['id',_0x02c2('0x39')],'where':{'id':_0x2b469b[_0x02c2('0xa3')][_0x02c2('0xac')]}})[_0x02c2('0x20')](function(_0x214fe8){if(_0x214fe8){_0x2b469b[_0x02c2('0x72')][_0x02c2('0xae')]({'id':0x0,'priority':0x0,'app':_0x02c2('0xaf'),'appdata':_0x214fe8['name']+','+(_0x2b469b['account'][_0x02c2('0xb0')]||0xa),'interval':_0x02c2('0xa9')});}return respondWithRpcPromise(_0x02c2('0xb1'),_0x02c2('0xb2'),_0x2b469b);});}return respondWithRpcPromise(_0x02c2('0xb1'),_0x02c2('0xb2'),_0x2b469b);})['then'](function(_0x406623){if(_0x406623){var _0x22eb84=0xc8;var _0x503e37=_0x02c2('0xb3');logger['info'](_0x02c2('0xb4'),_0x503e37,_0x22eb84,_0x02c2('0xb5'));logger[_0x02c2('0x23')](_0x02c2('0xb6'),_0x503e37,_0x22eb84,'entity\x20found',JSON[_0x02c2('0x24')](_0x406623));if(_0x2b469b[_0x02c2('0x71')][_0x02c2('0x40')]===_0x02c2('0x7d')){return _0x43584e[_0x02c2('0x2b')](_0x22eb84)['set'](_0x02c2('0xb7'),_0x02c2('0xb8'))[_0x02c2('0x3a')](_0x02c2('0xb9'));}else{return _0x43584e[_0x02c2('0x2b')](_0x22eb84)['json'](_0x406623);}}})[_0x02c2('0x29')](handleError(_0x43584e,null));};exports[_0x02c2('0xba')]=function(_0x1795f2,_0xd337fc){var _0x1c7328=_0x1795f2[_0x02c2('0x56')]['id'];var _0x3264f8=_0x1795f2['body'];var _0x192c7b=0xc8;var _0x418944=null;return db[_0x02c2('0xbb')][_0x02c2('0xbc')]({'isolationLevel':db[_0x02c2('0xbb')][_0x02c2('0xbd')][_0x02c2('0xbe')]['READ_COMMITTED']},function(_0x5ec981){return db['SmsAccount'][_0x02c2('0x64')]({'where':{'id':_0x1c7328},'transaction':_0x5ec981})[_0x02c2('0x20')](function(_0x57e7e6){if(_0x57e7e6){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x1c7328},'transaction':_0x5ec981})['then'](function(){var _0x18defe=_[_0x02c2('0x3d')](_0x3264f8,function(_0x128eaf){_0x128eaf[_0x02c2('0x63')]=_0x1c7328;return _0x128eaf;});return db[_0x02c2('0x6f')][_0x02c2('0xbf')](_0x18defe,{'transaction':_0x5ec981});});}else{_0x192c7b=0x194;_0x418944=[];}});})['then'](function(){if(_0x192c7b!==0x194){return db[_0x02c2('0x6f')]['findAndCountAll']({'where':{'SmsAccountId':_0x1c7328},'order':_0x02c2('0x74')})['then'](function(_0x178d10){_0x418944=_0x178d10;});}})[_0x02c2('0x29')](function(_0x2b8563){_0x192c7b=0x1f4;logger['error'](_0x2b8563[_0x02c2('0xc0')]);if(_0x2b8563['name']){delete _0x2b8563[_0x02c2('0x39')];}_0x418944=_0x2b8563;})['finally'](function(){if(_0x418944===null){_0xd337fc[_0x02c2('0x2a')](_0x192c7b);}else{if(_0x192c7b===0x1f4){_0xd337fc['status'](_0x192c7b)['send'](_0x418944);}else{_0xd337fc['status'](_0x192c7b)[_0x02c2('0x32')](_0x418944);}}});};exports['getApplications']=function(_0x5e10cd,_0xbd7d9a,_0x3a08a5){var _0x7f03a1={};var _0x18f330={};var _0x16d19c;var _0x5893d9;return db[_0x02c2('0x3e')][_0x02c2('0x64')]({'where':{'id':_0x5e10cd[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0xbd7d9a,null))[_0x02c2('0x20')](function(_0x538a1b){if(_0x538a1b){_0x16d19c=_0x538a1b;_0x18f330[_0x02c2('0x42')]=_[_0x02c2('0x43')](db[_0x02c2('0x6f')][_0x02c2('0x3f')]);_0x18f330[_0x02c2('0x48')]=_['keys'](_0x5e10cd['query']);_0x18f330[_0x02c2('0x44')]=_[_0x02c2('0x45')](_0x18f330[_0x02c2('0x42')],_0x18f330['query']);_0x7f03a1[_0x02c2('0x46')]=_[_0x02c2('0x45')](_0x18f330[_0x02c2('0x42')],qs['fields'](_0x5e10cd['query'][_0x02c2('0x47')]));_0x7f03a1[_0x02c2('0x46')]=_0x7f03a1[_0x02c2('0x46')][_0x02c2('0x57')]?_0x7f03a1[_0x02c2('0x46')]:_0x18f330[_0x02c2('0x42')];_0x7f03a1['order']=qs['sort'](_0x5e10cd[_0x02c2('0x48')][_0x02c2('0x4c')]);_0x7f03a1['where']=qs[_0x02c2('0x44')](_[_0x02c2('0x6b')](_0x5e10cd[_0x02c2('0x48')],_0x18f330[_0x02c2('0x44')]));if(_0x5e10cd['query'][_0x02c2('0x50')]){_0x7f03a1[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x7f03a1['where'],{'$or':_[_0x02c2('0x3d')](_0x7f03a1['attributes'],function(_0x24328f){var _0xbd85f8={};_0xbd85f8[_0x24328f]={'$like':'%'+_0x5e10cd[_0x02c2('0x48')][_0x02c2('0x50')]+'%'};return _0xbd85f8;})});}_0x7f03a1=_[_0x02c2('0x4e')]({},_0x7f03a1,_0x5e10cd[_0x02c2('0x51')]);return _0x16d19c[_0x02c2('0xc1')](_0x7f03a1);}})[_0x02c2('0x20')](function(_0x3e136c){if(_0x3e136c){_0x5893d9=_0x3e136c[_0x02c2('0x57')];if(!_0x5e10cd[_0x02c2('0x48')][_0x02c2('0x49')](_0x02c2('0x4a'))){_0x7f03a1['limit']=qs[_0x02c2('0x2f')](_0x5e10cd['query']['limit']);_0x7f03a1['offset']=qs[_0x02c2('0x2d')](_0x5e10cd[_0x02c2('0x48')]['offset']);}return _0x16d19c[_0x02c2('0xc1')](_0x7f03a1);}})[_0x02c2('0x20')](function(_0x4bc6c7){if(_0x4bc6c7){return _0x4bc6c7?{'count':_0x5893d9,'rows':_0x4bc6c7}:null;}})[_0x02c2('0x20')](respondWithResult(_0xbd7d9a,null))[_0x02c2('0x29')](handleError(_0xbd7d9a,null));};exports[_0x02c2('0xc2')]=function(_0x85b180,_0x56b57b,_0x6f12cb){var _0x27294c={'raw':![],'where':{}};var _0x39d059={};var _0x4531b6={'count':0x0,'rows':[]};return db[_0x02c2('0x3e')][_0x02c2('0x64')]({'where':{'id':_0x85b180[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x56b57b,null))[_0x02c2('0x20')](function(_0x30af09){if(_0x30af09){_0x39d059[_0x02c2('0x42')]=_[_0x02c2('0x43')](db[_0x02c2('0xa1')][_0x02c2('0x3f')]);_0x39d059[_0x02c2('0x48')]=_['keys'](_0x85b180['query']);_0x39d059['filters']=_[_0x02c2('0x45')](_0x39d059[_0x02c2('0x42')],_0x39d059[_0x02c2('0x48')]);_0x27294c[_0x02c2('0x46')]=_[_0x02c2('0x45')](_0x39d059[_0x02c2('0x42')],qs[_0x02c2('0x47')](_0x85b180[_0x02c2('0x48')][_0x02c2('0x47')]));_0x27294c[_0x02c2('0x46')]=_0x27294c['attributes'][_0x02c2('0x57')]?_0x27294c[_0x02c2('0x46')]:_0x39d059[_0x02c2('0x42')];if(!_0x85b180[_0x02c2('0x48')][_0x02c2('0x49')]('nolimit')){_0x27294c[_0x02c2('0x2f')]=qs[_0x02c2('0x2f')](_0x85b180[_0x02c2('0x48')][_0x02c2('0x2f')]);_0x27294c[_0x02c2('0x2d')]=qs[_0x02c2('0x2d')](_0x85b180['query'][_0x02c2('0x2d')]);}_0x27294c[_0x02c2('0x4b')]=qs[_0x02c2('0x4c')](_0x85b180[_0x02c2('0x48')]['sort']);_0x27294c[_0x02c2('0x4d')]=qs[_0x02c2('0x44')](_[_0x02c2('0x6b')](_0x85b180[_0x02c2('0x48')],_0x39d059[_0x02c2('0x44')]));_0x27294c[_0x02c2('0x4d')]['SmsAccountId']=_0x30af09['id'];if(_0x85b180[_0x02c2('0x48')][_0x02c2('0x50')]){_0x27294c[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x27294c[_0x02c2('0x4d')],{'$or':_[_0x02c2('0x3d')](_0x27294c[_0x02c2('0x46')],function(_0xbea770){var _0x14c223={};_0x14c223[_0xbea770]={'$like':'%'+_0x85b180['query']['filter']+'%'};return _0x14c223;})});}_0x27294c=_['merge']({},_0x27294c,_0x85b180[_0x02c2('0x51')]);return db[_0x02c2('0xa1')]['count']({'where':_0x27294c['where']})['then'](function(_0x2abbf0){_0x4531b6['count']=_0x2abbf0;if(_0x85b180['query'][_0x02c2('0x52')]){_0x27294c['include']=[{'model':db[_0x02c2('0x76')],'as':_0x02c2('0xc3'),'required':![]},{'model':db['User'],'as':_0x02c2('0xc4'),'attributes':[_0x02c2('0x39'),_0x02c2('0xc5'),_0x02c2('0xc6')],'required':![]},{'model':db[_0x02c2('0xc7')],'as':_0x02c2('0xc8'),'attributes':['id','name',_0x02c2('0xc9')],'where':_0x85b180[_0x02c2('0x48')][_0x02c2('0xca')]?{'id':_0x85b180[_0x02c2('0x48')][_0x02c2('0xca')]}:undefined,'required':_0x85b180[_0x02c2('0x48')][_0x02c2('0xca')]?!![]:![]}];}return db[_0x02c2('0xa1')][_0x02c2('0x54')](_0x27294c);})['then'](function(_0x3f2746){_0x4531b6['rows']=_0x3f2746;return _0x4531b6;});}})[_0x02c2('0x20')](respondWithFilteredResult(_0x56b57b,_0x27294c))[_0x02c2('0x29')](handleError(_0x56b57b,null));};exports[_0x02c2('0x3a')]=function(_0x387050,_0x2330f0,_0x39386c){var _0x2375f7,_0x422603,_0x39a7d6;if(_['isNil'](_0x387050['body'][_0x02c2('0x5f')])||_0x387050[_0x02c2('0x5f')]['body']===''){throw new db['Sequelize'][(_0x02c2('0x78'))](_0x02c2('0x95'));}if(_['isNil'](_0x387050[_0x02c2('0x5f')]['to'])){throw new db['Sequelize'][(_0x02c2('0x78'))](_0x02c2('0xcb'));}_0x2375f7=_0x387050['body']['to'];return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x387050[_0x02c2('0x56')]['id']},'include':[{'model':db[_0x02c2('0x9a')],'as':_0x02c2('0xcc'),'include':[{'model':db[_0x02c2('0x76')],'as':_0x02c2('0x9b'),'where':{'mobile':_0x2375f7},'limit':0x1,'order':[[_0x02c2('0x9c'),_0x02c2('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x2330f0,null))[_0x02c2('0x20')](function(_0x4194d3){if(_0x4194d3&&_0x4194d3['List']){_0x422603=_0x4194d3['get']({'plain':!![]});if(_0x422603[_0x02c2('0xcc')]&&_0x422603[_0x02c2('0xcc')]['Contacts'][_0x02c2('0x57')]){return _0x422603[_0x02c2('0xcc')][_0x02c2('0x9b')][0x0];}return db[_0x02c2('0x76')]['create'](_[_0x02c2('0x1a')](_0x387050[_0x02c2('0x5f')],{'firstName':_0x2375f7,'mobile':_0x2375f7,'phone':_0x2375f7,'ListId':_0x422603['ListId']}));}})[_0x02c2('0x20')](handleEntityNotFound(_0x2330f0,null))[_0x02c2('0x20')](function(_0xdeebb5){if(_0xdeebb5){_0x39a7d6=_0xdeebb5;return db[_0x02c2('0xa1')][_0x02c2('0x5b')]({'where':{'ContactId':_0x39a7d6['id'],'closed':![],'SmsAccountId':_0x422603['id']}})[_0x02c2('0x20')](function(_0x270ec2){if(_0x270ec2){return[_0x270ec2,![]];}return db['SmsInteraction'][_0x02c2('0x58')]({'UserId':_0x387050[_0x02c2('0xcd')]['id'],'ContactId':_0x39a7d6['id'],'SmsAccountId':_0x422603['id'],'phone':_0x2375f7,'firstMsgDirection':_0x02c2('0xce'),'Messages':[_['merge'](_0x387050[_0x02c2('0x5f')],{'read':![],'body':_0x387050[_0x02c2('0x5f')][_0x02c2('0x5f')],'phone':_0x2375f7,'SmsAccountId':_0x422603['id'],'UserId':_0x387050[_0x02c2('0xcd')]['id'],'ContactId':_0x39a7d6['id']})]},{'include':[{'model':db[_0x02c2('0xcf')],'as':'Messages'}]})['then'](function(_0x1ffe3e){return[_0x1ffe3e,!![]];});});}})[_0x02c2('0xa2')](function(_0x48370b,_0x19a223){if(_0x19a223){return _0x48370b;}return db[_0x02c2('0xcf')][_0x02c2('0x58')](_[_0x02c2('0x4e')](_0x387050['body'],{'read':![],'body':_0x387050[_0x02c2('0x5f')][_0x02c2('0x5f')],'phone':_0x2375f7,'SmsAccountId':_0x422603['id'],'SmsInteractionId':_0x48370b['id'],'UserId':_0x387050[_0x02c2('0xcd')]['id'],'ContactId':_0x39a7d6['id']}))[_0x02c2('0x20')](function(_0x141425){_0x48370b['dataValues'][_0x02c2('0xd0')]=[];_0x48370b[_0x02c2('0xd1')][_0x02c2('0xd0')][_0x02c2('0xa6')](_0x141425[_0x02c2('0xd1')]);return _0x48370b;});})[_0x02c2('0x20')](respondWithResult(_0x2330f0,null))[_0x02c2('0x29')](handleError(_0x2330f0,null));};exports[_0x02c2('0x2b')]=function(_0x68c07f,_0x10aa0f,_0x43ee03){if(_0x68c07f[_0x02c2('0x5f')]['id']){delete _0x68c07f[_0x02c2('0x5f')]['id'];}var _0x18d2a5,_0x493e37,_0x433c53;return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x68c07f[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x10aa0f,null))['then'](function(_0x25a658){if(_0x25a658){_0x433c53=_0x25a658;logger[_0x02c2('0x23')](_0x02c2('0xb4'),'status','received\x20delivery\x20report\x20from',_0x25a658[_0x02c2('0x40')],util[_0x02c2('0xd2')](_0x68c07f[_0x02c2('0x5f')],{'showHidden':![],'depth':null}));switch(_0x25a658[_0x02c2('0x40')]){case _0x02c2('0x82'):if(_0x68c07f[_0x02c2('0x5f')]['skebby_dispatch_id']&&_0x68c07f[_0x02c2('0x5f')][_0x02c2('0x2b')]){_0x493e37=_0x68c07f['body'][_0x02c2('0x2b')];return db['SmsMessage'][_0x02c2('0x5b')]({'where':{'messageId':_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd3')]}});}break;case _0x02c2('0x84'):if(_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd4')]&&_0x68c07f[_0x02c2('0x5f')]['statusInt']){_0x493e37=_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd5')];return db[_0x02c2('0xcf')][_0x02c2('0x5b')]({'where':{'messageId':_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd4')]}});}break;case _0x02c2('0x85'):if(_0x68c07f['body'][_0x02c2('0x86')]&&_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd6')]){_0x493e37=_0x68c07f['body'][_0x02c2('0xd6')];return db[_0x02c2('0xcf')]['find']({'where':{'messageId':_0x68c07f['body'][_0x02c2('0x86')]}});}break;case _0x02c2('0x89'):var _0x1690e0=_0x68c07f['body'][_0x02c2('0xd7')][0x0];if(_0x1690e0[_0x02c2('0x88')]&&_0x1690e0[_0x02c2('0x2b')][_0x02c2('0xd8')]===_0x02c2('0xd9')){_0x493e37=_0x1690e0[_0x02c2('0x2b')]['groupName'];return db['SmsMessage'][_0x02c2('0x5b')]({'where':{'messageId':_0x1690e0[_0x02c2('0x88')]}});}break;case'clickatell':if(_0x68c07f[_0x02c2('0x5f')][_0x02c2('0x88')]&&_0x68c07f[_0x02c2('0x5f')][_0x02c2('0x2b')]){_0x493e37=_0x68c07f['body'][_0x02c2('0x2b')];return db['SmsMessage'][_0x02c2('0x5b')]({'where':{'messageId':_0x68c07f['body'][_0x02c2('0x88')]}});}break;case _0x02c2('0xda'):if(_0x68c07f[_0x02c2('0x5f')][0x0]['message']['id']){_0x493e37=_0x68c07f[_0x02c2('0x5f')][0x0][_0x02c2('0x40')];return db[_0x02c2('0xcf')][_0x02c2('0x5b')]({'where':{'messageId':_0x68c07f[_0x02c2('0x5f')][0x0]['message']['id']}});}break;case _0x02c2('0x91'):if(_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xdb')]&&_0x68c07f[_0x02c2('0x5f')][_0x02c2('0x2b')]){_0x493e37=_0x68c07f['body']['status'];return db[_0x02c2('0xcf')][_0x02c2('0x5b')]({'where':{'messageId':_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x10aa0f,null))[_0x02c2('0x20')](function(_0x24ae85){if(_0x24ae85){_0x18d2a5=_0x24ae85;switch(_0x433c53[_0x02c2('0x40')]){case _0x02c2('0x82'):if(_0x493e37===_0x02c2('0xd9')){return _0x18d2a5['update']({'read':!![]});}else{logger[_0x02c2('0x25')](_0x02c2('0xb4'),_0x02c2('0x2b'),_0x02c2('0x82'),util['inspect'](_0x68c07f[_0x02c2('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x493e37==='1'){return _0x18d2a5[_0x02c2('0x5e')]({'read':!![]});}else{logger[_0x02c2('0x25')](_0x02c2('0xb4'),_0x02c2('0x2b'),'skebby',util[_0x02c2('0xd2')](_0x68c07f['body'],{'showHidden':![],'depth':null}));}break;case _0x02c2('0x85'):if(!_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xdc')]&&_0x493e37>=0xc8&&_0x493e37<=0xce){return _0x18d2a5[_0x02c2('0x5e')]({'read':!![]});}else{logger[_0x02c2('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x02c2('0x2b'),_0x02c2('0x85'),util[_0x02c2('0xd2')](_0x68c07f['body'],{'showHidden':![],'depth':null}));}break;case _0x02c2('0x89'):var _0x4a84da=_0x68c07f[_0x02c2('0x5f')][_0x02c2('0xd7')][0x0];if(_0x4a84da['status'][_0x02c2('0xd8')]===_0x02c2('0xd9')){return _0x18d2a5['update']({'read':!![]});}else{logger[_0x02c2('0x25')](_0x02c2('0xb4'),_0x02c2('0x2b'),_0x02c2('0x89'),util['inspect'](_0x68c07f[_0x02c2('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x493e37==_0x02c2('0xdd')||_0x493e37==_0x02c2('0xde')){return _0x18d2a5[_0x02c2('0x5e')]({'read':!![]});}else{logger[_0x02c2('0x25')](_0x02c2('0xb4'),_0x02c2('0x2b'),'clickatell',util[_0x02c2('0xd2')](_0x68c07f['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x493e37=='message-delivered'){return _0x18d2a5['update']({'read':!![]});}else{logger[_0x02c2('0x25')](_0x02c2('0xb4'),'status',_0x02c2('0xda'),util['inspect'](_0x68c07f['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x493e37==='DELIVRD'||_0x493e37==='ACCEPTD'){return _0x18d2a5['update']({'read':!![]});}else{logger[_0x02c2('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x02c2('0x2b'),_0x02c2('0x91'),util[_0x02c2('0xd2')](_0x68c07f['body'],{'showHidden':![],'depth':null}));}break;}return _0x18d2a5;}})[_0x02c2('0x20')](respondWithResult(_0x10aa0f,null))[_0x02c2('0x29')](handleError(_0x10aa0f,null));};exports['statusGet']=function(_0xea2ced,_0x5074a3,_0x3ce6eb){var _0x16b44e,_0x20849d,_0x1b368a;return db[_0x02c2('0x3e')]['find']({'where':{'id':_0xea2ced[_0x02c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5074a3,null))[_0x02c2('0x20')](function(_0x3f9a67){if(_0x3f9a67){_0x1b368a=_0x3f9a67;logger[_0x02c2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x02c2('0xdf'),_0x3f9a67[_0x02c2('0x40')],util['inspect'](_0xea2ced[_0x02c2('0x48')],{'showHidden':![],'depth':null}));switch(_0x3f9a67[_0x02c2('0x40')]){case _0x02c2('0x8a'):if(_0xea2ced['query'][_0x02c2('0xe0')]&&_0xea2ced['query'][_0x02c2('0xe1')]){_0x20849d=_0xea2ced[_0x02c2('0x48')][_0x02c2('0xe1')];return db['SmsMessage'][_0x02c2('0x5b')]({'where':{'messageId':_0xea2ced[_0x02c2('0x48')][_0x02c2('0xe0')]}});}break;}}})[_0x02c2('0x20')](handleEntityNotFound(_0x5074a3,null))[_0x02c2('0x20')](function(_0x49ef2b){if(_0x49ef2b){_0x16b44e=_0x49ef2b;switch(_0x1b368a[_0x02c2('0x40')]){case _0x02c2('0x8a'):if(_0x20849d==='2'||_0x20849d==='6'){return _0x16b44e[_0x02c2('0x5e')]({'read':!![]});}else{logger[_0x02c2('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x02c2('0x8a'),util[_0x02c2('0xd2')](_0xea2ced[_0x02c2('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x16b44e;}})[_0x02c2('0x20')](respondWithResult(_0x5074a3,null))[_0x02c2('0x29')](handleError(_0x5074a3,null));};exports['addAgents']=function(_0x2e1ffe,_0x373c3f,_0x54a38a){return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x2e1ffe[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x373c3f,null))[_0x02c2('0x20')](function(_0x33e322){if(_0x33e322){return _0x33e322['addAgents'](_0x2e1ffe[_0x02c2('0x5f')]['ids'],_[_0x02c2('0x9f')](_0x2e1ffe['body'],[_0x02c2('0x68'),'id'])||{})[_0x02c2('0xa2')](function(_0xa7572e){for(var _0x2cb706=0x0;_0x2cb706<_0x2e1ffe[_0x02c2('0x5f')][_0x02c2('0x68')][_0x02c2('0x57')];_0x2cb706+=0x1){socket['emit'](_0x02c2('0xe2'),{'UserId':Number(_0x2e1ffe[_0x02c2('0x5f')][_0x02c2('0x68')][_0x2cb706]),'SmsAccountId':Number(_0x2e1ffe[_0x02c2('0x56')]['id'])});}return _0xa7572e;});}})[_0x02c2('0x20')](respondWithResult(_0x373c3f,null))[_0x02c2('0x29')](handleError(_0x373c3f,null));};exports['removeAgents']=function(_0x570b4f,_0x24f6cb,_0x570f62){return db[_0x02c2('0x3e')][_0x02c2('0x5b')]({'where':{'id':_0x570b4f[_0x02c2('0x56')]['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x24f6cb,null))[_0x02c2('0x20')](function(_0x1175b7){if(_0x1175b7){return _0x1175b7[_0x02c2('0xe3')](_0x570b4f[_0x02c2('0x48')]['ids'])[_0x02c2('0x20')](function(){if(_[_0x02c2('0xe4')](_0x570b4f[_0x02c2('0x48')]['ids'])){for(var _0x1467c1=0x0;_0x1467c1<_0x570b4f[_0x02c2('0x48')][_0x02c2('0x68')][_0x02c2('0x57')];_0x1467c1+=0x1){socket['emit'](_0x02c2('0xe5'),{'UserId':Number(_0x570b4f[_0x02c2('0x48')][_0x02c2('0x68')][_0x1467c1]),'SmsAccountId':Number(_0x570b4f[_0x02c2('0x56')]['id'])});}}else{socket[_0x02c2('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x570b4f[_0x02c2('0x48')]['ids']),'SmsAccountId':Number(_0x570b4f[_0x02c2('0x56')]['id'])});}});}})[_0x02c2('0x20')](respondWithStatusCode(_0x24f6cb,null))['catch'](handleError(_0x24f6cb,null));};exports[_0x02c2('0xe7')]=function(_0x18544e,_0x1c5f85,_0x36d6ef){var _0x5c21a8={};var _0x1a309a={};var _0xe644b3;var _0x38767f;return db['SmsAccount']['findOne']({'where':{'id':_0x18544e['params']['id']}})[_0x02c2('0x20')](handleEntityNotFound(_0x1c5f85,null))[_0x02c2('0x20')](function(_0x34168f){if(_0x34168f){_0xe644b3=_0x34168f;_0x1a309a['model']=_['keys'](db['User'][_0x02c2('0x3f')]);_0x1a309a['query']=_['keys'](_0x18544e[_0x02c2('0x48')]);_0x1a309a['filters']=_[_0x02c2('0x45')](_0x1a309a[_0x02c2('0x42')],_0x1a309a[_0x02c2('0x48')]);_0x5c21a8[_0x02c2('0x46')]=_[_0x02c2('0x45')](_0x1a309a[_0x02c2('0x42')],qs[_0x02c2('0x47')](_0x18544e[_0x02c2('0x48')][_0x02c2('0x47')]));_0x5c21a8[_0x02c2('0x46')]=_0x5c21a8['attributes'][_0x02c2('0x57')]?_0x5c21a8[_0x02c2('0x46')]:_0x1a309a['model'];_0x5c21a8[_0x02c2('0x4b')]=qs[_0x02c2('0x4c')](_0x18544e['query'][_0x02c2('0x4c')]);_0x5c21a8[_0x02c2('0x4d')]=qs[_0x02c2('0x44')](_[_0x02c2('0x6b')](_0x18544e[_0x02c2('0x48')],_0x1a309a[_0x02c2('0x44')]));if(_0x18544e['query']['filter']){_0x5c21a8[_0x02c2('0x4d')]=_[_0x02c2('0x4e')](_0x5c21a8[_0x02c2('0x4d')],{'$or':_[_0x02c2('0x3d')](_0x5c21a8[_0x02c2('0x46')],function(_0x470ad9){var _0x187e14={};_0x187e14[_0x470ad9]={'$like':'%'+_0x18544e[_0x02c2('0x48')][_0x02c2('0x50')]+'%'};return _0x187e14;})});}_0x5c21a8=_[_0x02c2('0x4e')]({},_0x5c21a8,_0x18544e[_0x02c2('0x51')]);return _0xe644b3[_0x02c2('0xe7')](_0x5c21a8);}})[_0x02c2('0x20')](function(_0xf8a553){if(_0xf8a553){_0x38767f=_0xf8a553['length'];if(!_0x18544e[_0x02c2('0x48')][_0x02c2('0x49')](_0x02c2('0x4a'))){_0x5c21a8[_0x02c2('0x2f')]=qs['limit'](_0x18544e[_0x02c2('0x48')][_0x02c2('0x2f')]);_0x5c21a8['offset']=qs[_0x02c2('0x2d')](_0x18544e[_0x02c2('0x48')]['offset']);}return _0xe644b3['getAgents'](_0x5c21a8);}})[_0x02c2('0x20')](function(_0x3378b7){if(_0x3378b7){return _0x3378b7?{'count':_0x38767f,'rows':_0x3378b7}:null;}})[_0x02c2('0x20')](respondWithResult(_0x1c5f85,null))[_0x02c2('0x29')](handleError(_0x1c5f85,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 36fbd77..ae0ac48 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 _0x6328=['../../mysqldb','SmsAccount','setMaxListeners','remove','emit','events'];(function(_0x31db46,_0x3f11c3){var _0x47f4ff=function(_0x2794ae){while(--_0x2794ae){_0x31db46['push'](_0x31db46['shift']());}};_0x47f4ff(++_0x3f11c3);}(_0x6328,0x197));var _0x8632=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x6328[_0x1305e3];return _0x1068e9;};'use strict';var EventEmitter=require(_0x8632('0x0'));var SmsAccount=require(_0x8632('0x1'))['db'][_0x8632('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8632('0x4')};function emitEvent(_0x393733){return function(_0x1c063b,_0x5cb7ed,_0x1412a5){SmsAccountEvents[_0x8632('0x5')](_0x393733+':'+_0x1c063b['id'],_0x1c063b);SmsAccountEvents['emit'](_0x393733,_0x1c063b);_0x1412a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x793d=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x56a7ee,_0x226185){var _0x202b71=function(_0x3e16fb){while(--_0x3e16fb){_0x56a7ee['push'](_0x56a7ee['shift']());}};_0x202b71(++_0x226185);}(_0x793d,0x106));var _0xd793=function(_0x48edc0,_0x2c616b){_0x48edc0=_0x48edc0-0x0;var _0x326b92=_0x793d[_0x48edc0];return _0x326b92;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xd793('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd793('0x1')](0x0);var events={'afterCreate':_0xd793('0x2'),'afterUpdate':'update','afterDestroy':_0xd793('0x3')};function emitEvent(_0x31fc84){return function(_0x1bf5a0,_0x209f5c,_0x459d83){SmsAccountEvents[_0xd793('0x4')](_0x31fc84+':'+_0x1bf5a0['id'],_0x1bf5a0);SmsAccountEvents['emit'](_0x31fc84,_0x1bf5a0);_0x459d83(null);};}for(var e in events){if(events[_0xd793('0x5')](e)){var event=events[e];SmsAccount[_0xd793('0x6')](e,emitEvent(event));}}module[_0xd793('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9633235..0c1a063 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 _0x9874=['rimraf','./smsAccount.attributes','define','sms_accounts','util','../../config/logger','moment','request-promise','path'];(function(_0x396e8c,_0x40b46f){var _0x1415c2=function(_0x4e93ee){while(--_0x4e93ee){_0x396e8c['push'](_0x396e8c['shift']());}};_0x1415c2(++_0x40b46f);}(_0x9874,0x1a2));var _0x4987=function(_0x390392,_0x25e8b7){_0x390392=_0x390392-0x0;var _0xe96e47=_0x9874[_0x390392];return _0xe96e47;};'use strict';var _=require('lodash');var util=require(_0x4987('0x0'));var logger=require(_0x4987('0x1'))('api');var moment=require(_0x4987('0x2'));var BPromise=require('bluebird');var rp=require(_0x4987('0x3'));var fs=require('fs');var path=require(_0x4987('0x4'));var rimraf=require(_0x4987('0x5'));var config=require('../../config/environment');var attributes=require(_0x4987('0x6'));module['exports']=function(_0x27255b,_0x26041b){return _0x27255b[_0x4987('0x7')]('SmsAccount',attributes,{'tableName':_0x4987('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67e3=['path','exports','define','lodash','util','api','moment','request-promise'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x67e3,0x1bb));var _0x367e=function(_0x4718a1,_0x32e00d){_0x4718a1=_0x4718a1-0x0;var _0xf3fd48=_0x67e3[_0x4718a1];return _0xf3fd48;};'use strict';var _=require(_0x367e('0x0'));var util=require(_0x367e('0x1'));var logger=require('../../config/logger')(_0x367e('0x2'));var moment=require(_0x367e('0x3'));var BPromise=require('bluebird');var rp=require(_0x367e('0x4'));var fs=require('fs');var path=require(_0x367e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x367e('0x6')]=function(_0xd2a20d,_0x37fc93){return _0xd2a20d[_0x367e('0x7')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b321850..e077e32 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 _0xe8fa=['SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','include','map','model','attributes','then','debug','stringify','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','info'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xe8fa,0x1f4));var _0xae8f=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xe8fa[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xae8f('0x0'));var BPromise=require(_0xae8f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae8f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae8f('0x3'));var config=require(_0xae8f('0x4'));var jayson=require(_0xae8f('0x5'));var client=jayson['client'][_0xae8f('0x6')]({'port':0x232a});config['redis']=_[_0xae8f('0x7')](config[_0xae8f('0x8')],{'host':_0xae8f('0x9'),'port':0x18eb});var socket=require(_0xae8f('0xa'))(new Redis(config[_0xae8f('0x8')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x430db7,_0x685890,_0x515e23){return new BPromise(function(_0x5af412,_0x5d90c1){return client['request'](_0x430db7,_0x515e23)['then'](function(_0x4760f1){logger[_0xae8f('0xb')](_0xae8f('0xc'),_0x685890,_0xae8f('0xd'));logger['debug'](_0xae8f('0xe'),_0x685890,'request\x20sent',JSON['stringify'](_0x4760f1));if(_0x4760f1['error']){if(_0x4760f1['error'][_0xae8f('0xf')]===0x1f4){logger[_0xae8f('0x10')](_0xae8f('0xc'),_0x685890,_0x4760f1['error'][_0xae8f('0x11')]);return _0x5d90c1(_0x4760f1[_0xae8f('0x10')][_0xae8f('0x11')]);}logger['error'](_0xae8f('0xc'),_0x685890,_0x4760f1[_0xae8f('0x10')][_0xae8f('0x11')]);return _0x5af412(_0x4760f1[_0xae8f('0x10')][_0xae8f('0x11')]);}else{logger[_0xae8f('0xb')](_0xae8f('0xc'),_0x685890,_0xae8f('0xd'));_0x5af412(_0x4760f1[_0xae8f('0x12')][_0xae8f('0x11')]);}})[_0xae8f('0x13')](function(_0x319d10){logger[_0xae8f('0x10')](_0xae8f('0xc'),_0x685890,_0x319d10);_0x5d90c1(_0x319d10);});});}exports[_0xae8f('0x14')]=function(_0x412e3a){var _0x5055d6=this;return new Promise(function(_0x51e2e9,_0x376355){return db[_0xae8f('0x15')][_0xae8f('0x16')]({'raw':_0x412e3a[_0xae8f('0x17')]?_0x412e3a[_0xae8f('0x17')][_0xae8f('0x18')]===undefined?!![]:![]:!![],'where':_0x412e3a[_0xae8f('0x17')]?_0x412e3a[_0xae8f('0x17')]['where']||null:null,'attributes':_0x412e3a[_0xae8f('0x17')]?_0x412e3a[_0xae8f('0x17')]['attributes']||null:null,'include':_0x412e3a[_0xae8f('0x17')]?_0x412e3a[_0xae8f('0x17')][_0xae8f('0x19')]?_[_0xae8f('0x1a')](_0x412e3a[_0xae8f('0x17')]['include'],function(_0x44d8ed){return{'model':db[_0x44d8ed[_0xae8f('0x1b')]],'as':_0x44d8ed['as'],'attributes':_0x44d8ed[_0xae8f('0x1c')],'include':_0x44d8ed[_0xae8f('0x19')]?_[_0xae8f('0x1a')](_0x44d8ed[_0xae8f('0x19')],function(_0x41baa9){return{'model':db[_0x41baa9[_0xae8f('0x1b')]],'as':_0x41baa9['as'],'attributes':_0x41baa9['attributes'],'include':_0x41baa9['include']?_[_0xae8f('0x1a')](_0x41baa9[_0xae8f('0x19')],function(_0x4ee25a){return{'model':db[_0x4ee25a['model']],'as':_0x4ee25a['as'],'attributes':_0x4ee25a['attributes']};}):[]};}):[]};}):[]:[]})[_0xae8f('0x1d')](function(_0xf16a03){logger[_0xae8f('0xb')](_0xae8f('0x14'),_0x412e3a);logger[_0xae8f('0x1e')](_0xae8f('0x14'),_0x412e3a,JSON[_0xae8f('0x1f')](_0xf16a03));_0x51e2e9(_0xf16a03);})[_0xae8f('0x13')](function(_0x54b6c5){logger[_0xae8f('0x10')](_0xae8f('0x14'),_0x54b6c5[_0xae8f('0x11')],_0x412e3a);_0x376355(_0x5055d6[_0xae8f('0x10')](0x1f4,_0x54b6c5[_0xae8f('0x11')]));});});}; \ No newline at end of file +var _0xef1e=['redis','localhost','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','attributes','map','model','include','then','debug','ShowSmsAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x48ad0a,_0x26bb68){var _0xdfc2de=function(_0x49b168){while(--_0x49b168){_0x48ad0a['push'](_0x48ad0a['shift']());}};_0xdfc2de(++_0x26bb68);}(_0xef1e,0x7a));var _0xeef1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xef1e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xeef1('0x0'));var util=require(_0xeef1('0x1'));var moment=require('moment');var BPromise=require(_0xeef1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeef1('0x3'))['db'];var utils=require(_0xeef1('0x4'));var logger=require(_0xeef1('0x5'))(_0xeef1('0x6'));var config=require(_0xeef1('0x7'));var jayson=require(_0xeef1('0x8'));var client=jayson['client'][_0xeef1('0x9')]({'port':0x232a});config[_0xeef1('0xa')]=_['defaults'](config[_0xeef1('0xa')],{'host':_0xeef1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeef1('0xc'))[_0xeef1('0xd')](socket);function respondWithRpcPromise(_0x37d749,_0x4d87b9,_0x473346){return new BPromise(function(_0x834114,_0x4cf804){return client['request'](_0x37d749,_0x473346)['then'](function(_0x2360fa){logger['info'](_0xeef1('0xe'),_0x4d87b9,_0xeef1('0xf'));logger['debug'](_0xeef1('0x10'),_0x4d87b9,_0xeef1('0xf'),JSON[_0xeef1('0x11')](_0x2360fa));if(_0x2360fa[_0xeef1('0x12')]){if(_0x2360fa[_0xeef1('0x12')][_0xeef1('0x13')]===0x1f4){logger[_0xeef1('0x12')](_0xeef1('0xe'),_0x4d87b9,_0x2360fa[_0xeef1('0x12')][_0xeef1('0x14')]);return _0x4cf804(_0x2360fa[_0xeef1('0x12')][_0xeef1('0x14')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4d87b9,_0x2360fa['error'][_0xeef1('0x14')]);return _0x834114(_0x2360fa[_0xeef1('0x12')][_0xeef1('0x14')]);}else{logger['info'](_0xeef1('0xe'),_0x4d87b9,_0xeef1('0xf'));_0x834114(_0x2360fa[_0xeef1('0x15')][_0xeef1('0x14')]);}})[_0xeef1('0x16')](function(_0x48c071){logger['error'](_0xeef1('0xe'),_0x4d87b9,_0x48c071);_0x4cf804(_0x48c071);});});}exports['ShowSmsAccount']=function(_0x5a7400){var _0x3be88d=this;return new Promise(function(_0x270f99,_0x12f4f0){return db[_0xeef1('0x17')][_0xeef1('0x18')]({'raw':_0x5a7400[_0xeef1('0x19')]?_0x5a7400['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a7400[_0xeef1('0x19')]?_0x5a7400[_0xeef1('0x19')]['where']||null:null,'attributes':_0x5a7400[_0xeef1('0x19')]?_0x5a7400[_0xeef1('0x19')][_0xeef1('0x1a')]||null:null,'include':_0x5a7400[_0xeef1('0x19')]?_0x5a7400[_0xeef1('0x19')]['include']?_[_0xeef1('0x1b')](_0x5a7400[_0xeef1('0x19')]['include'],function(_0x2d60ea){return{'model':db[_0x2d60ea[_0xeef1('0x1c')]],'as':_0x2d60ea['as'],'attributes':_0x2d60ea[_0xeef1('0x1a')],'include':_0x2d60ea[_0xeef1('0x1d')]?_[_0xeef1('0x1b')](_0x2d60ea[_0xeef1('0x1d')],function(_0x4f4622){return{'model':db[_0x4f4622[_0xeef1('0x1c')]],'as':_0x4f4622['as'],'attributes':_0x4f4622[_0xeef1('0x1a')],'include':_0x4f4622['include']?_[_0xeef1('0x1b')](_0x4f4622[_0xeef1('0x1d')],function(_0x22c254){return{'model':db[_0x22c254[_0xeef1('0x1c')]],'as':_0x22c254['as'],'attributes':_0x22c254[_0xeef1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeef1('0x1e')](function(_0x154405){logger['info']('ShowSmsAccount',_0x5a7400);logger[_0xeef1('0x1f')](_0xeef1('0x20'),_0x5a7400,JSON[_0xeef1('0x11')](_0x154405));_0x270f99(_0x154405);})[_0xeef1('0x16')](function(_0x130905){logger[_0xeef1('0x12')](_0xeef1('0x20'),_0x130905[_0xeef1('0x14')],_0x5a7400);_0x12f4f0(_0x3be88d[_0xeef1('0x12')](0x1f4,_0x130905[_0xeef1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 703cdf2..cf76e6e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7c2d7a2..87e0601 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x25b444,_0x20da5e){var _0x425f88=function(_0xe4183e){while(--_0xe4183e){_0x25b444['push'](_0x25b444['shift']());}};_0x425f88(++_0x20da5e);}(_0x3e74,0x175));var _0x43e7=function(_0x3f25c7,_0x54dc29){_0x3f25c7=_0x3f25c7-0x0;var _0x5b90ee=_0x3e74[_0x3f25c7];return _0x5b90ee;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0xc489d8,_0x562c9b){var _0x17dc03=function(_0x774be0){while(--_0x774be0){_0xc489d8['push'](_0xc489d8['shift']());}};_0x17dc03(++_0x562c9b);}(_0x3e74,0x175));var _0x43e7=function(_0xfb7086,_0x2ac968){_0xfb7086=_0xfb7086-0x0;var _0x347103=_0x3e74[_0xfb7086];return _0x347103;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e0d8409..0bc9385 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 _0x72a6=['*,*,*,*','exports','noop','TEXT','STRING'];(function(_0x1e93fa,_0x210f48){var _0xd4e1e6=function(_0x3149da){while(--_0x3149da){_0x1e93fa['push'](_0x1e93fa['shift']());}};_0xd4e1e6(++_0x210f48);}(_0x72a6,0x9c));var _0x672a=function(_0x5b652e,_0x4d565f){_0x5b652e=_0x5b652e-0x0;var _0x327110=_0x72a6[_0x5b652e];return _0x327110;};'use strict';var Sequelize=require('sequelize');module[_0x672a('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x672a('0x1')},'appdata':{'type':Sequelize[_0x672a('0x2')]()},'description':{'type':Sequelize[_0x672a('0x3')]},'interval':{'type':Sequelize[_0x672a('0x3')],'defaultValue':_0x672a('0x4')}}; \ No newline at end of file +var _0xcd52=['INTEGER','TEXT','STRING','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcd52,0x1e3));var _0x2cd5=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcd52[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x2cd5('0x0'));module[_0x2cd5('0x1')]={'priority':{'type':Sequelize[_0x2cd5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2cd5('0x3')]()},'description':{'type':Sequelize[_0x2cd5('0x4')]},'interval':{'type':Sequelize[_0x2cd5('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 91925dc..704fec1 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 _0x513a=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','apply','reject','save','update','destroy','then','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','findAll','catch','params','keys','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse'];(function(_0x418b76,_0x2f38c9){var _0xc65645=function(_0x19d658){while(--_0x19d658){_0x418b76['push'](_0x418b76['shift']());}};_0xc65645(++_0x2f38c9);}(_0x513a,0x1da));var _0xa513=function(_0x916690,_0x55c8db){_0x916690=_0x916690-0x0;var _0x278f95=_0x513a[_0x916690];return _0x278f95;};'use strict';var emlformat=require(_0xa513('0x0'));var rimraf=require(_0xa513('0x1'));var zipdir=require(_0xa513('0x2'));var jsonpatch=require(_0xa513('0x3'));var rp=require(_0xa513('0x4'));var moment=require(_0xa513('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa513('0x6'));var util=require(_0xa513('0x7'));var path=require(_0xa513('0x8'));var sox=require(_0xa513('0x9'));var csv=require(_0xa513('0xa'));var ejs=require(_0xa513('0xb'));var fs=require('fs');var fs_extra=require(_0xa513('0xc'));var _=require(_0xa513('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa513('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa513('0xa'));var querystring=require('querystring');var Papa=require(_0xa513('0xf'));var Redis=require('ioredis');var authService=require(_0xa513('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa513('0x11'));var hardwareService=require(_0xa513('0x12'));var logger=require(_0xa513('0x13'))(_0xa513('0x14'));var utils=require(_0xa513('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa513('0x16'));var db=require(_0xa513('0x17'))['db'];function respondWithStatusCode(_0x25334c,_0x128793){_0x128793=_0x128793||0xcc;return function(_0x3dba5b){if(_0x3dba5b){return _0x25334c['sendStatus'](_0x128793);}return _0x25334c['status'](_0x128793)[_0xa513('0x18')]();};}function respondWithResult(_0x205970,_0x36b381){_0x36b381=_0x36b381||0xc8;return function(_0x1bc494){if(_0x1bc494){return _0x205970['status'](_0x36b381)[_0xa513('0x19')](_0x1bc494);}};}function respondWithFilteredResult(_0xb0e7e7,_0x402219){return function(_0x2f78dd){if(_0x2f78dd){var _0x3d6028=typeof _0x402219[_0xa513('0x1a')]===_0xa513('0x1b')&&typeof _0x402219[_0xa513('0x1c')]==='undefined';var _0x3f6ac5=_0x2f78dd['count'];var _0x37ed97=_0x3d6028?0x0:_0x402219[_0xa513('0x1a')];var _0x38b3cb=_0x3d6028?_0x2f78dd[_0xa513('0x1d')]:_0x402219[_0xa513('0x1a')]+_0x402219['limit'];var _0xd573f5;if(_0x38b3cb>=_0x3f6ac5){_0x38b3cb=_0x3f6ac5;_0xd573f5=0xc8;}else{_0xd573f5=0xce;}_0xb0e7e7[_0xa513('0x1e')](_0xd573f5);return _0xb0e7e7['set']('Content-Range',_0x37ed97+'-'+_0x38b3cb+'/'+_0x3f6ac5)['json'](_0x2f78dd);}return null;};}function patchUpdates(_0x34ba0e){return function(_0x57cc05){try{jsonpatch[_0xa513('0x1f')](_0x57cc05,_0x34ba0e,!![]);}catch(_0x57c13b){return BPromise[_0xa513('0x20')](_0x57c13b);}return _0x57cc05[_0xa513('0x21')]();};}function saveUpdates(_0x33fa28,_0x3f20c0){return function(_0x52de81){if(_0x52de81){return _0x52de81[_0xa513('0x22')](_0x33fa28)['then'](function(_0x1f5fe1){return _0x1f5fe1;});}return null;};}function removeEntity(_0x4561c3,_0x47ea0b){return function(_0x5dde7d){if(_0x5dde7d){return _0x5dde7d[_0xa513('0x23')]()[_0xa513('0x24')](function(){_0x4561c3[_0xa513('0x1e')](0xcc)[_0xa513('0x18')]();});}};}function handleEntityNotFound(_0x5edcd4,_0x29ee98){return function(_0x1e30ee){if(!_0x1e30ee){_0x5edcd4['sendStatus'](0x194);}return _0x1e30ee;};}function handleError(_0x1e868f,_0x2d9401){_0x2d9401=_0x2d9401||0x1f4;return function(_0x40380a){logger['error'](_0x40380a[_0xa513('0x25')]);if(_0x40380a[_0xa513('0x26')]){delete _0x40380a['name'];}_0x1e868f['status'](_0x2d9401)[_0xa513('0x27')](_0x40380a);};}exports[_0xa513('0x28')]=function(_0x16c6f0,_0xfbc341){var _0x6f61b={},_0x5733b5={},_0x12a445={'count':0x0,'rows':[]};var _0x1ff70e=_[_0xa513('0x29')](db[_0xa513('0x2a')][_0xa513('0x2b')],function(_0x201344){return{'name':_0x201344[_0xa513('0x2c')],'type':_0x201344['type'][_0xa513('0x2d')]};});_0x5733b5['model']=_[_0xa513('0x29')](_0x1ff70e,_0xa513('0x26'));_0x5733b5[_0xa513('0x2e')]=_['keys'](_0x16c6f0[_0xa513('0x2e')]);_0x5733b5[_0xa513('0x2f')]=_[_0xa513('0x30')](_0x5733b5['model'],_0x5733b5[_0xa513('0x2e')]);_0x6f61b[_0xa513('0x31')]=_[_0xa513('0x30')](_0x5733b5[_0xa513('0x32')],qs[_0xa513('0x33')](_0x16c6f0['query']['fields']));_0x6f61b['attributes']=_0x6f61b[_0xa513('0x31')][_0xa513('0x34')]?_0x6f61b['attributes']:_0x5733b5[_0xa513('0x32')];if(!_0x16c6f0[_0xa513('0x2e')][_0xa513('0x35')](_0xa513('0x36'))){_0x6f61b[_0xa513('0x1c')]=qs[_0xa513('0x1c')](_0x16c6f0[_0xa513('0x2e')][_0xa513('0x1c')]);_0x6f61b[_0xa513('0x1a')]=qs[_0xa513('0x1a')](_0x16c6f0[_0xa513('0x2e')][_0xa513('0x1a')]);}_0x6f61b['order']=qs[_0xa513('0x37')](_0x16c6f0[_0xa513('0x2e')]['sort']);_0x6f61b[_0xa513('0x38')]=qs[_0xa513('0x2f')](_['pick'](_0x16c6f0['query'],_0x5733b5[_0xa513('0x2f')]),_0x1ff70e);if(_0x16c6f0[_0xa513('0x2e')][_0xa513('0x39')]){_0x6f61b[_0xa513('0x38')]=_[_0xa513('0x3a')](_0x6f61b[_0xa513('0x38')],{'$or':_[_0xa513('0x29')](_0x1ff70e,function(_0x197c9f){if(_0x197c9f[_0xa513('0x3b')]!==_0xa513('0x3c')){var _0x867751={};_0x867751[_0x197c9f[_0xa513('0x26')]]={'$like':'%'+_0x16c6f0[_0xa513('0x2e')]['filter']+'%'};return _0x867751;}})});}_0x6f61b=_[_0xa513('0x3a')]({},_0x6f61b,_0x16c6f0[_0xa513('0x3d')]);var _0x53ed5c={'where':_0x6f61b['where']};return db['SmsApplication'][_0xa513('0x1d')](_0x53ed5c)[_0xa513('0x24')](function(_0x429ccf){_0x12a445[_0xa513('0x1d')]=_0x429ccf;if(_0x16c6f0[_0xa513('0x2e')]['includeAll']){_0x6f61b['include']=[{'all':!![]}];}return db[_0xa513('0x2a')][_0xa513('0x3e')](_0x6f61b);})['then'](function(_0x40d1b0){_0x12a445['rows']=_0x40d1b0;return _0x12a445;})[_0xa513('0x24')](respondWithFilteredResult(_0xfbc341,_0x6f61b))[_0xa513('0x3f')](handleError(_0xfbc341,null));};exports['show']=function(_0x435e9a,_0x28346c){var _0x2e7389={'raw':!![],'where':{'id':_0x435e9a[_0xa513('0x40')]['id']}},_0x434554={};_0x434554['model']=_[_0xa513('0x41')](db['SmsApplication'][_0xa513('0x2b')]);_0x434554[_0xa513('0x2e')]=_['keys'](_0x435e9a[_0xa513('0x2e')]);_0x434554[_0xa513('0x2f')]=_['intersection'](_0x434554[_0xa513('0x32')],_0x434554[_0xa513('0x2e')]);_0x2e7389[_0xa513('0x31')]=_['intersection'](_0x434554[_0xa513('0x32')],qs['fields'](_0x435e9a['query'][_0xa513('0x33')]));_0x2e7389['attributes']=_0x2e7389[_0xa513('0x31')]['length']?_0x2e7389[_0xa513('0x31')]:_0x434554[_0xa513('0x32')];if(_0x435e9a[_0xa513('0x2e')]['includeAll']){_0x2e7389[_0xa513('0x42')]=[{'all':!![]}];}_0x2e7389=_[_0xa513('0x3a')]({},_0x2e7389,_0x435e9a[_0xa513('0x3d')]);return db[_0xa513('0x2a')]['find'](_0x2e7389)[_0xa513('0x24')](handleEntityNotFound(_0x28346c,null))[_0xa513('0x24')](respondWithResult(_0x28346c,null))[_0xa513('0x3f')](handleError(_0x28346c,null));};exports['create']=function(_0x46434b,_0x9c4d6d){return db[_0xa513('0x2a')][_0xa513('0x43')](_0x46434b['body'],{})['then'](respondWithResult(_0x9c4d6d,0xc9))[_0xa513('0x3f')](handleError(_0x9c4d6d,null));};exports[_0xa513('0x22')]=function(_0x24878f,_0x851975){if(_0x24878f[_0xa513('0x44')]['id']){delete _0x24878f['body']['id'];}return db['SmsApplication'][_0xa513('0x45')]({'where':{'id':_0x24878f['params']['id']}})[_0xa513('0x24')](handleEntityNotFound(_0x851975,null))['then'](saveUpdates(_0x24878f['body'],null))[_0xa513('0x24')](respondWithResult(_0x851975,null))[_0xa513('0x3f')](handleError(_0x851975,null));};exports[_0xa513('0x23')]=function(_0x580162,_0x39b2de){return db[_0xa513('0x2a')]['find']({'where':{'id':_0x580162[_0xa513('0x40')]['id']}})[_0xa513('0x24')](handleEntityNotFound(_0x39b2de,null))['then'](removeEntity(_0x39b2de,null))[_0xa513('0x3f')](handleError(_0x39b2de,null));}; \ No newline at end of file +var _0x3563=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','reject','update','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','catch','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x37fcda,_0x2f5aa1){var _0xf5ed91=function(_0x3c3241){while(--_0x3c3241){_0x37fcda['push'](_0x37fcda['shift']());}};_0xf5ed91(++_0x2f5aa1);}(_0x3563,0x19d));var _0x3356=function(_0x35ad42,_0x4eb33c){_0x35ad42=_0x35ad42-0x0;var _0x3766f6=_0x3563[_0x35ad42];return _0x3766f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3356('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3356('0x1'));var rp=require(_0x3356('0x2'));var moment=require(_0x3356('0x3'));var BPromise=require(_0x3356('0x4'));var Mustache=require(_0x3356('0x5'));var util=require('util');var path=require(_0x3356('0x6'));var sox=require(_0x3356('0x7'));var csv=require(_0x3356('0x8'));var ejs=require(_0x3356('0x9'));var fs=require('fs');var fs_extra=require(_0x3356('0xa'));var _=require(_0x3356('0xb'));var squel=require(_0x3356('0xc'));var crypto=require(_0x3356('0xd'));var jsforce=require(_0x3356('0xe'));var deskjs=require(_0x3356('0xf'));var toCsv=require(_0x3356('0x8'));var querystring=require(_0x3356('0x10'));var Papa=require(_0x3356('0x11'));var Redis=require('ioredis');var authService=require(_0x3356('0x12'));var qs=require(_0x3356('0x13'));var as=require(_0x3356('0x14'));var hardwareService=require(_0x3356('0x15'));var logger=require(_0x3356('0x16'))('api');var utils=require(_0x3356('0x17'));var config=require(_0x3356('0x18'));var licenseUtil=require(_0x3356('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b016a,_0x453468){_0x453468=_0x453468||0xcc;return function(_0x54a7d3){if(_0x54a7d3){return _0x5b016a['sendStatus'](_0x453468);}return _0x5b016a[_0x3356('0x1a')](_0x453468)[_0x3356('0x1b')]();};}function respondWithResult(_0x59eb72,_0x139d76){_0x139d76=_0x139d76||0xc8;return function(_0x1a9227){if(_0x1a9227){return _0x59eb72[_0x3356('0x1a')](_0x139d76)['json'](_0x1a9227);}};}function respondWithFilteredResult(_0x93432,_0x28390b){return function(_0x13c8a9){if(_0x13c8a9){var _0x590067=typeof _0x28390b[_0x3356('0x1c')]==='undefined'&&typeof _0x28390b['limit']===_0x3356('0x1d');var _0x27f02b=_0x13c8a9['count'];var _0x5cf25b=_0x590067?0x0:_0x28390b['offset'];var _0x528b58=_0x590067?_0x13c8a9[_0x3356('0x1e')]:_0x28390b[_0x3356('0x1c')]+_0x28390b['limit'];var _0x5abfc3;if(_0x528b58>=_0x27f02b){_0x528b58=_0x27f02b;_0x5abfc3=0xc8;}else{_0x5abfc3=0xce;}_0x93432[_0x3356('0x1a')](_0x5abfc3);return _0x93432[_0x3356('0x1f')]('Content-Range',_0x5cf25b+'-'+_0x528b58+'/'+_0x27f02b)[_0x3356('0x20')](_0x13c8a9);}return null;};}function patchUpdates(_0x43489a){return function(_0x2b274e){try{jsonpatch['apply'](_0x2b274e,_0x43489a,!![]);}catch(_0x3e6273){return BPromise[_0x3356('0x21')](_0x3e6273);}return _0x2b274e['save']();};}function saveUpdates(_0x45db61,_0x438f4b){return function(_0x1ea40e){if(_0x1ea40e){return _0x1ea40e[_0x3356('0x22')](_0x45db61)[_0x3356('0x23')](function(_0x22242e){return _0x22242e;});}return null;};}function removeEntity(_0x1ed981,_0x8a6765){return function(_0x2cfee4){if(_0x2cfee4){return _0x2cfee4[_0x3356('0x24')]()[_0x3356('0x23')](function(){_0x1ed981['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eac47,_0x320fe7){return function(_0xca5a7b){if(!_0xca5a7b){_0x5eac47['sendStatus'](0x194);}return _0xca5a7b;};}function handleError(_0x324bf7,_0x109fea){_0x109fea=_0x109fea||0x1f4;return function(_0x2af886){logger[_0x3356('0x25')](_0x2af886[_0x3356('0x26')]);if(_0x2af886[_0x3356('0x27')]){delete _0x2af886['name'];}_0x324bf7[_0x3356('0x1a')](_0x109fea)['send'](_0x2af886);};}exports['index']=function(_0x312b12,_0x146d89){var _0x1ad0cc={},_0x7496e4={},_0x4aa991={'count':0x0,'rows':[]};var _0x3e01d9=_[_0x3356('0x28')](db[_0x3356('0x29')][_0x3356('0x2a')],function(_0x3937dd){return{'name':_0x3937dd['fieldName'],'type':_0x3937dd[_0x3356('0x2b')][_0x3356('0x2c')]};});_0x7496e4[_0x3356('0x2d')]=_[_0x3356('0x28')](_0x3e01d9,_0x3356('0x27'));_0x7496e4['query']=_[_0x3356('0x2e')](_0x312b12[_0x3356('0x2f')]);_0x7496e4[_0x3356('0x30')]=_[_0x3356('0x31')](_0x7496e4[_0x3356('0x2d')],_0x7496e4[_0x3356('0x2f')]);_0x1ad0cc[_0x3356('0x32')]=_[_0x3356('0x31')](_0x7496e4[_0x3356('0x2d')],qs[_0x3356('0x33')](_0x312b12[_0x3356('0x2f')][_0x3356('0x33')]));_0x1ad0cc[_0x3356('0x32')]=_0x1ad0cc[_0x3356('0x32')][_0x3356('0x34')]?_0x1ad0cc[_0x3356('0x32')]:_0x7496e4['model'];if(!_0x312b12[_0x3356('0x2f')]['hasOwnProperty'](_0x3356('0x35'))){_0x1ad0cc[_0x3356('0x36')]=qs[_0x3356('0x36')](_0x312b12[_0x3356('0x2f')][_0x3356('0x36')]);_0x1ad0cc[_0x3356('0x1c')]=qs[_0x3356('0x1c')](_0x312b12[_0x3356('0x2f')][_0x3356('0x1c')]);}_0x1ad0cc[_0x3356('0x37')]=qs[_0x3356('0x38')](_0x312b12['query'][_0x3356('0x38')]);_0x1ad0cc[_0x3356('0x39')]=qs[_0x3356('0x30')](_[_0x3356('0x3a')](_0x312b12['query'],_0x7496e4[_0x3356('0x30')]),_0x3e01d9);if(_0x312b12['query'][_0x3356('0x3b')]){_0x1ad0cc[_0x3356('0x39')]=_[_0x3356('0x3c')](_0x1ad0cc[_0x3356('0x39')],{'$or':_['map'](_0x3e01d9,function(_0x4e167c){if(_0x4e167c['type']!==_0x3356('0x3d')){var _0xf3e5c1={};_0xf3e5c1[_0x4e167c['name']]={'$like':'%'+_0x312b12[_0x3356('0x2f')][_0x3356('0x3b')]+'%'};return _0xf3e5c1;}})});}_0x1ad0cc=_['merge']({},_0x1ad0cc,_0x312b12[_0x3356('0x3e')]);var _0x210126={'where':_0x1ad0cc[_0x3356('0x39')]};return db['SmsApplication'][_0x3356('0x1e')](_0x210126)['then'](function(_0x5e8d1b){_0x4aa991[_0x3356('0x1e')]=_0x5e8d1b;if(_0x312b12[_0x3356('0x2f')][_0x3356('0x3f')]){_0x1ad0cc['include']=[{'all':!![]}];}return db[_0x3356('0x29')][_0x3356('0x40')](_0x1ad0cc);})[_0x3356('0x23')](function(_0x1d0520){_0x4aa991[_0x3356('0x41')]=_0x1d0520;return _0x4aa991;})[_0x3356('0x23')](respondWithFilteredResult(_0x146d89,_0x1ad0cc))['catch'](handleError(_0x146d89,null));};exports['show']=function(_0x517e27,_0x253ac9){var _0x11316f={'raw':!![],'where':{'id':_0x517e27['params']['id']}},_0x3ba9b2={};_0x3ba9b2[_0x3356('0x2d')]=_['keys'](db[_0x3356('0x29')]['rawAttributes']);_0x3ba9b2[_0x3356('0x2f')]=_[_0x3356('0x2e')](_0x517e27[_0x3356('0x2f')]);_0x3ba9b2[_0x3356('0x30')]=_['intersection'](_0x3ba9b2['model'],_0x3ba9b2['query']);_0x11316f[_0x3356('0x32')]=_[_0x3356('0x31')](_0x3ba9b2[_0x3356('0x2d')],qs[_0x3356('0x33')](_0x517e27['query'][_0x3356('0x33')]));_0x11316f[_0x3356('0x32')]=_0x11316f[_0x3356('0x32')][_0x3356('0x34')]?_0x11316f[_0x3356('0x32')]:_0x3ba9b2[_0x3356('0x2d')];if(_0x517e27[_0x3356('0x2f')][_0x3356('0x3f')]){_0x11316f[_0x3356('0x42')]=[{'all':!![]}];}_0x11316f=_[_0x3356('0x3c')]({},_0x11316f,_0x517e27[_0x3356('0x3e')]);return db[_0x3356('0x29')][_0x3356('0x43')](_0x11316f)['then'](handleEntityNotFound(_0x253ac9,null))['then'](respondWithResult(_0x253ac9,null))[_0x3356('0x44')](handleError(_0x253ac9,null));};exports['create']=function(_0x55130c,_0x521687){return db[_0x3356('0x29')][_0x3356('0x45')](_0x55130c[_0x3356('0x46')],{})['then'](respondWithResult(_0x521687,0xc9))['catch'](handleError(_0x521687,null));};exports[_0x3356('0x22')]=function(_0x1ceae0,_0x12bb22){if(_0x1ceae0[_0x3356('0x46')]['id']){delete _0x1ceae0[_0x3356('0x46')]['id'];}return db[_0x3356('0x29')][_0x3356('0x43')]({'where':{'id':_0x1ceae0[_0x3356('0x47')]['id']}})[_0x3356('0x23')](handleEntityNotFound(_0x12bb22,null))[_0x3356('0x23')](saveUpdates(_0x1ceae0[_0x3356('0x46')],null))[_0x3356('0x23')](respondWithResult(_0x12bb22,null))['catch'](handleError(_0x12bb22,null));};exports[_0x3356('0x24')]=function(_0x398064,_0x375052){return db[_0x3356('0x29')]['find']({'where':{'id':_0x398064[_0x3356('0x47')]['id']}})[_0x3356('0x23')](handleEntityNotFound(_0x375052,null))[_0x3356('0x23')](removeEntity(_0x375052,null))['catch'](handleError(_0x375052,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4bda9ee..3f7eab7 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 _0xb92e=['../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0xb92e,0x72));var _0xeb92=function(_0x284609,_0x386b54){_0x284609=_0x284609-0x0;var _0x55116b=_0xb92e[_0x284609];return _0x55116b;};'use strict';var _=require(_0xeb92('0x0'));var util=require('util');var logger=require(_0xeb92('0x1'))(_0xeb92('0x2'));var moment=require(_0xeb92('0x3'));var BPromise=require(_0xeb92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb92('0x5'));var config=require(_0xeb92('0x6'));var attributes=require(_0xeb92('0x7'));module['exports']=function(_0x53dcb0,_0x16e6ae){return _0x53dcb0['define'](_0xeb92('0x8'),attributes,{'tableName':_0xeb92('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb92('0xa'),'collate':_0xeb92('0xb')});}; \ No newline at end of file +var _0xcf66=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1a8667,_0x298734){var _0x453945=function(_0x255356){while(--_0x255356){_0x1a8667['push'](_0x1a8667['shift']());}};_0x453945(++_0x298734);}(_0xcf66,0x185));var _0x6cf6=function(_0x3a5f50,_0x433d31){_0x3a5f50=_0x3a5f50-0x0;var _0x13b76e=_0xcf66[_0x3a5f50];return _0x13b76e;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require(_0x6cf6('0x5'));var rp=require(_0x6cf6('0x6'));var fs=require('fs');var path=require(_0x6cf6('0x7'));var rimraf=require(_0x6cf6('0x8'));var config=require('../../config/environment');var attributes=require(_0x6cf6('0x9'));module['exports']=function(_0x3a6d66,_0x19bef6){return _0x3a6d66[_0x6cf6('0xa')](_0x6cf6('0xb'),attributes,{'tableName':_0x6cf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cf6('0xd'),'collate':_0x6cf6('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fdc37d9..a1fc938 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 _0x731b=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x731b,0xf7));var _0xb731=function(_0x57230f,_0x2a1e1a){_0x57230f=_0x57230f-0x0;var _0x48aca2=_0x731b[_0x57230f];return _0x48aca2;};'use strict';var _=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var moment=require('moment');var BPromise=require(_0xb731('0x2'));var rs=require(_0xb731('0x3'));var fs=require('fs');var Redis=require(_0xb731('0x4'));var db=require(_0xb731('0x5'))['db'];var utils=require(_0xb731('0x6'));var logger=require(_0xb731('0x7'))('rpc');var config=require(_0xb731('0x8'));var jayson=require(_0xb731('0x9'));var client=jayson[_0xb731('0xa')][_0xb731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c59b,_0x2b475d,_0x173768){return new BPromise(function(_0x58b83c,_0x2ab04b){return client[_0xb731('0xc')](_0x12c59b,_0x173768)[_0xb731('0xd')](function(_0x26488c){logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,_0xb731('0x10'));logger[_0xb731('0x11')](_0xb731('0x12'),_0x2b475d,_0xb731('0x10'),JSON[_0xb731('0x13')](_0x26488c));if(_0x26488c[_0xb731('0x14')]){if(_0x26488c[_0xb731('0x14')][_0xb731('0x15')]===0x1f4){logger[_0xb731('0x14')]('SmsApplication,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x2ab04b(_0x26488c[_0xb731('0x14')][_0xb731('0x16')]);}logger[_0xb731('0x14')]('SmsApplication,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x58b83c(_0x26488c['error']['message']);}else{logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,'request\x20sent');_0x58b83c(_0x26488c[_0xb731('0x17')][_0xb731('0x16')]);}})['catch'](function(_0x30da75){logger[_0xb731('0x14')](_0xb731('0xf'),_0x2b475d,_0x30da75);_0x2ab04b(_0x30da75);});});} \ No newline at end of file +var _0x2b29=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2dd993,_0x2fe1ad){var _0x2bf73e=function(_0x163179){while(--_0x163179){_0x2dd993['push'](_0x2dd993['shift']());}};_0x2bf73e(++_0x2fe1ad);}(_0x2b29,0x163));var _0x92b2=function(_0x311e5b,_0x1af6b0){_0x311e5b=_0x311e5b-0x0;var _0x106321=_0x2b29[_0x311e5b];return _0x106321;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536e21,_0x29f183,_0x43a292){return new BPromise(function(_0x5c1d94,_0x3e2204){return client[_0x92b2('0xb')](_0x536e21,_0x43a292)[_0x92b2('0xc')](function(_0x465011){logger['info'](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));logger[_0x92b2('0xf')](_0x92b2('0x10'),_0x29f183,_0x92b2('0xe'),JSON[_0x92b2('0x11')](_0x465011));if(_0x465011[_0x92b2('0x12')]){if(_0x465011['error'][_0x92b2('0x13')]===0x1f4){logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011['error'][_0x92b2('0x14')]);return _0x3e2204(_0x465011[_0x92b2('0x12')][_0x92b2('0x14')]);}logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011[_0x92b2('0x12')]['message']);return _0x5c1d94(_0x465011[_0x92b2('0x12')]['message']);}else{logger[_0x92b2('0x15')](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));_0x5c1d94(_0x465011['result']['message']);}})[_0x92b2('0x16')](function(_0x5a2912){logger[_0x92b2('0x12')]('SmsApplication,\x20%s,\x20%s',_0x29f183,_0x5a2912);_0x3e2204(_0x5a2912);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c28d017..b042ee5 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 _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x496dae,_0x3fa7ce){var _0x50a6f7=function(_0x1bb67f){while(--_0x1bb67f){_0x496dae['push'](_0x496dae['shift']());}};_0x50a6f7(++_0x3fa7ce);}(_0x6cb4,0xff));var _0x46cb=function(_0x5c3f30,_0x45cfc4){_0x5c3f30=_0x5c3f30-0x0;var _0x30c8c1=_0x6cb4[_0x5c3f30];return _0x30c8c1;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file +var _0x0972=['tracked','sms','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x3b11bd,_0xcbe01){var _0x2b1a24=function(_0x33977d){while(--_0x33977d){_0x3b11bd['push'](_0x3b11bd['shift']());}};_0x2b1a24(++_0xcbe01);}(_0x0972,0x64));var _0x2097=function(_0x2ca622,_0x174a18){_0x2ca622=_0x2ca622-0x0;var _0x1dda18=_0x0972[_0x2ca622];return _0x1dda18;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/describe',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['show']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0x7')](_0x2097('0xe'),auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x11')]);router[_0x2097('0x10')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0x12')]);router[_0x2097('0x10')](_0x2097('0x13'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')](_0x2097('0x15'),'smsinteraction:addtags'),controller[_0x2097('0x16')]);router[_0x2097('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2097('0x15'),'smsinteraction:update'),controller[_0x2097('0x18')]);router[_0x2097('0x19')](_0x2097('0xb'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')]('sms',_0x2097('0x1a')),controller[_0x2097('0x1b')]);router[_0x2097('0x19')](_0x2097('0x13'),auth[_0x2097('0x8')](),controller[_0x2097('0x1c')]);module[_0x2097('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1b784d0..3f839e7 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 _0x6753=['out','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0xc49d41,_0x253b45){var _0x5201e6=function(_0x2cc75e){while(--_0x2cc75e){_0xc49d41['push'](_0xc49d41['shift']());}};_0x5201e6(++_0x253b45);}(_0x6753,0xa1));var _0x3675=function(_0x30ee30,_0x298de8){_0x30ee30=_0x30ee30-0x0;var _0x29e87f=_0x6753[_0x30ee30];return _0x29e87f;};'use strict';var Sequelize=require(_0x3675('0x0'));var moment=require(_0x3675('0x1'));module[_0x3675('0x2')]={'closed':{'type':Sequelize[_0x3675('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3675('0x4')]},'secondDisposition':{'type':Sequelize[_0x3675('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3675('0x4')]},'phone':{'type':Sequelize[_0x3675('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3675('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x3675('0x6')]('in',_0x3675('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3675('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6a88=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x6a88,0xa9));var _0x86a8=function(_0x189a66,_0x245d35){_0x189a66=_0x189a66-0x0;var _0x44fb31=_0x6a88[_0x189a66];return _0x44fb31;};'use strict';var Sequelize=require(_0x86a8('0x0'));var moment=require(_0x86a8('0x1'));module[_0x86a8('0x2')]={'closed':{'type':Sequelize[_0x86a8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x86a8('0x4')]},'disposition':{'type':Sequelize[_0x86a8('0x5')]},'secondDisposition':{'type':Sequelize[_0x86a8('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x86a8('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x86a8('0x6')]('in',_0x86a8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x86a8('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9e108c6..e6031e7 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 _0xb2c0=['Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','mkdirSync','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','json','update','destroy','then','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','include','options','find','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','format','includeAll','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname'];(function(_0x33f3f3,_0x4465f8){var _0x208676=function(_0xc12c52){while(--_0xc12c52){_0x33f3f3['push'](_0x33f3f3['shift']());}};_0x208676(++_0x4465f8);}(_0xb2c0,0x110));var _0x0b2c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2c0[_0x3bf83f];return _0x22c4a9;};'use strict';var rimraf=require(_0x0b2c('0x0'));var zipdir=require('zip-dir');var moment=require(_0x0b2c('0x1'));var BPromise=require('bluebird');var util=require(_0x0b2c('0x2'));var path=require(_0x0b2c('0x3'));var ejs=require(_0x0b2c('0x4'));var fs=require('fs');var _=require(_0x0b2c('0x5'));var Redis=require(_0x0b2c('0x6'));var interaction=require(_0x0b2c('0x7'));var qs=require(_0x0b2c('0x8'));var pdf=require(_0x0b2c('0x9'));var logger=require(_0x0b2c('0xa'))(_0x0b2c('0xb'));var config=require(_0x0b2c('0xc'));var db=require(_0x0b2c('0xd'))['db'];config[_0x0b2c('0xe')]=_[_0x0b2c('0xf')](config[_0x0b2c('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b2c('0x10'))(new Redis(config[_0x0b2c('0xe')]));require('./smsInteraction.socket')[_0x0b2c('0x11')](socket);function respondWithStatusCode(_0x1e6e99,_0x3cd775){_0x3cd775=_0x3cd775||0xcc;return function(_0x299fd9){if(_0x299fd9){return _0x1e6e99[_0x0b2c('0x12')](_0x3cd775);}return _0x1e6e99[_0x0b2c('0x13')](_0x3cd775)[_0x0b2c('0x14')]();};}function respondWithResult(_0x274b98,_0x54cb3e){_0x54cb3e=_0x54cb3e||0xc8;return function(_0x36ff68){if(_0x36ff68){return _0x274b98[_0x0b2c('0x13')](_0x54cb3e)['json'](_0x36ff68);}};}function respondWithFilteredResult(_0x2a72b,_0x1596da){return function(_0x6e7bbc){if(_0x6e7bbc){var _0x145179=typeof _0x1596da['offset']===_0x0b2c('0x15')&&typeof _0x1596da[_0x0b2c('0x16')]===_0x0b2c('0x15');var _0x2241e2=_0x6e7bbc[_0x0b2c('0x17')];var _0x57d6ca=_0x145179?0x0:_0x1596da[_0x0b2c('0x18')];var _0x42066d=_0x145179?_0x6e7bbc['count']:_0x1596da[_0x0b2c('0x18')]+_0x1596da['limit'];var _0x409028;if(_0x42066d>=_0x2241e2){_0x42066d=_0x2241e2;_0x409028=0xc8;}else{_0x409028=0xce;}_0x2a72b[_0x0b2c('0x13')](_0x409028);return _0x2a72b[_0x0b2c('0x19')]('Content-Range',_0x57d6ca+'-'+_0x42066d+'/'+_0x2241e2)[_0x0b2c('0x1a')](_0x6e7bbc);}return null;};}function saveUpdates(_0x20708b){return function(_0x4f145d){if(_0x4f145d){return _0x4f145d[_0x0b2c('0x1b')](_0x20708b)['then'](function(_0x2036e2){return _0x2036e2;});}return null;};}function removeEntity(_0xc14533){return function(_0x16f502){if(_0x16f502){return _0x16f502[_0x0b2c('0x1c')]()[_0x0b2c('0x1d')](function(){_0xc14533['status'](0xcc)[_0x0b2c('0x14')]();});}};}function handleEntityNotFound(_0x38dad9){return function(_0x24d653){if(!_0x24d653){_0x38dad9[_0x0b2c('0x12')](0x194);}return _0x24d653;};}function handleError(_0x4065d6,_0xe37d20){_0xe37d20=_0xe37d20||0x1f4;return function(_0x15a67b){logger['error'](_0x15a67b['stack']);if(_0x15a67b[_0x0b2c('0x1e')]){delete _0x15a67b[_0x0b2c('0x1e')];}_0x4065d6[_0x0b2c('0x13')](_0xe37d20)[_0x0b2c('0x1f')](_0x15a67b);};}exports['index']=function(_0x109293,_0xa7dc53){var _0x4d7d74={};var _0x1ddbdb=_[_0x0b2c('0x20')](db[_0x0b2c('0x21')][_0x0b2c('0x22')],function(_0x1511d2){return{'name':_0x1511d2[_0x0b2c('0x23')],'type':_0x1511d2[_0x0b2c('0x24')][_0x0b2c('0x25')]};});_0x4d7d74=qs[_0x0b2c('0x26')](_0x1ddbdb,_0x109293);return interaction[_0x0b2c('0x27')](_0x0b2c('0x28'),_0x109293[_0x0b2c('0x29')],_0x109293[_0x0b2c('0x2a')],_0x4d7d74,_0x1ddbdb)[_0x0b2c('0x1d')](respondWithFilteredResult(_0xa7dc53,_0x4d7d74))[_0x0b2c('0x2b')](handleError(_0xa7dc53,null));};exports[_0x0b2c('0x2c')]=function(_0x3f5601,_0x3acbe5){var _0x263a18={'raw':![],'where':{'id':_0x3f5601[_0x0b2c('0x2d')]['id']}},_0x4cc31f={};_0x4cc31f[_0x0b2c('0x2e')]=_[_0x0b2c('0x2f')](db[_0x0b2c('0x21')][_0x0b2c('0x22')]);_0x4cc31f[_0x0b2c('0x29')]=_[_0x0b2c('0x2f')](_0x3f5601[_0x0b2c('0x29')]);_0x4cc31f[_0x0b2c('0x30')]=_[_0x0b2c('0x31')](_0x4cc31f[_0x0b2c('0x2e')],_0x4cc31f['query']);_0x263a18['attributes']=_[_0x0b2c('0x31')](_0x4cc31f[_0x0b2c('0x2e')],qs[_0x0b2c('0x32')](_0x3f5601['query'][_0x0b2c('0x32')]));_0x263a18[_0x0b2c('0x33')]=_0x263a18[_0x0b2c('0x33')]['length']?_0x263a18[_0x0b2c('0x33')]:_0x4cc31f['model'];if(_0x3f5601['query']['includeAll']){_0x263a18[_0x0b2c('0x34')]=[{'all':!![]}];}_0x263a18=_['merge']({},_0x263a18,_0x3f5601[_0x0b2c('0x35')]);return db[_0x0b2c('0x21')][_0x0b2c('0x36')](_0x263a18)[_0x0b2c('0x1d')](handleEntityNotFound(_0x3acbe5,null))[_0x0b2c('0x1d')](respondWithResult(_0x3acbe5,null))[_0x0b2c('0x2b')](handleError(_0x3acbe5,null));};exports['create']=function(_0x4507c3,_0xb500e2){return db[_0x0b2c('0x21')]['create'](_0x4507c3[_0x0b2c('0x37')],{})[_0x0b2c('0x1d')](respondWithResult(_0xb500e2,0xc9))[_0x0b2c('0x2b')](handleError(_0xb500e2,null));};exports[_0x0b2c('0x1b')]=function(_0x2bf4a2,_0x3690f6){if(_0x2bf4a2[_0x0b2c('0x37')]['id']){delete _0x2bf4a2[_0x0b2c('0x37')]['id'];}return db['SmsInteraction'][_0x0b2c('0x36')]({'where':{'id':_0x2bf4a2[_0x0b2c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3690f6,null))['then'](saveUpdates(_0x2bf4a2['body'],null))[_0x0b2c('0x1d')](respondWithResult(_0x3690f6,null))['catch'](handleError(_0x3690f6,null));};exports[_0x0b2c('0x1c')]=function(_0x138abd,_0xaa1966){return db[_0x0b2c('0x21')]['find']({'where':{'id':_0x138abd[_0x0b2c('0x2d')]['id']}})[_0x0b2c('0x1d')](handleEntityNotFound(_0xaa1966,null))[_0x0b2c('0x1d')](removeEntity(_0xaa1966,null))[_0x0b2c('0x2b')](handleError(_0xaa1966,null));};exports[_0x0b2c('0x38')]=function(_0x90ed97,_0x4f458c){return db['SmsInteraction'][_0x0b2c('0x38')]()[_0x0b2c('0x1d')](respondWithResult(_0x4f458c,null))[_0x0b2c('0x2b')](handleError(_0x4f458c,null));};exports[_0x0b2c('0x39')]=function(_0x349360,_0x1f6ddf){return db[_0x0b2c('0x3a')][_0x0b2c('0x36')]({'where':{'id':_0x349360[_0x0b2c('0x2d')]['id']}})[_0x0b2c('0x1d')](handleEntityNotFound(_0x1f6ddf,null))[_0x0b2c('0x1d')](function(_0x5a23ab){if(_0x5a23ab){return _0x5a23ab[_0x0b2c('0x39')](_0x349360[_0x0b2c('0x37')]['ids'],_[_0x0b2c('0x3b')](_0x349360[_0x0b2c('0x37')],[_0x0b2c('0x3c'),'id'])||{});}})[_0x0b2c('0x1d')](respondWithResult(_0x1f6ddf,null))[_0x0b2c('0x2b')](handleError(_0x1f6ddf,null));};exports[_0x0b2c('0x3d')]=function(_0x58d97e,_0x515035){var _0x7b19f8={'raw':![],'where':{}};var _0x3f2850={};var _0x4720dc={'count':0x0,'rows':[]};return db[_0x0b2c('0x21')][_0x0b2c('0x3e')]({'where':{'id':_0x58d97e[_0x0b2c('0x2d')]['id']}})[_0x0b2c('0x1d')](handleEntityNotFound(_0x515035,null))[_0x0b2c('0x1d')](function(_0x2899f7){if(_0x2899f7){_0x3f2850[_0x0b2c('0x2e')]=_['keys'](db['SmsMessage'][_0x0b2c('0x22')]);_0x3f2850[_0x0b2c('0x29')]=_[_0x0b2c('0x2f')](_0x58d97e[_0x0b2c('0x29')]);_0x3f2850[_0x0b2c('0x30')]=_[_0x0b2c('0x31')](_0x3f2850[_0x0b2c('0x2e')],_0x3f2850['query']);_0x7b19f8[_0x0b2c('0x33')]=_[_0x0b2c('0x31')](_0x3f2850[_0x0b2c('0x2e')],qs[_0x0b2c('0x32')](_0x58d97e[_0x0b2c('0x29')]['fields']));_0x7b19f8[_0x0b2c('0x33')]=_0x7b19f8[_0x0b2c('0x33')][_0x0b2c('0x3f')]?_0x7b19f8[_0x0b2c('0x33')]:_0x3f2850[_0x0b2c('0x2e')];if(!_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x40')]('nolimit')){_0x7b19f8[_0x0b2c('0x16')]=qs[_0x0b2c('0x16')](_0x58d97e['query'][_0x0b2c('0x16')]);_0x7b19f8[_0x0b2c('0x18')]=qs['offset'](_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x18')]);}_0x7b19f8[_0x0b2c('0x41')]=qs[_0x0b2c('0x42')](_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x42')]);_0x7b19f8[_0x0b2c('0x43')]=qs[_0x0b2c('0x30')](_[_0x0b2c('0x44')](_0x58d97e[_0x0b2c('0x29')],_0x3f2850['filters']));_0x7b19f8[_0x0b2c('0x43')][_0x0b2c('0x45')]=_0x2899f7['id'];if(_0x58d97e['query'][_0x0b2c('0x46')]){_0x7b19f8[_0x0b2c('0x43')]=_[_0x0b2c('0x47')](_0x7b19f8['where'],{'$or':_[_0x0b2c('0x20')](_0x7b19f8['attributes'],function(_0x21d4df){var _0x1ae69a={};_0x1ae69a[_0x21d4df]={'$like':'%'+_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x46')]+'%'};return _0x1ae69a;})});}if(_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x48')]){var _0x5b1ca5=_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x48')][_0x0b2c('0x49')](',');var _0x33c2f7={};_0x33c2f7[_0x5b1ca5[0x0]]={'$gte':moment(_0x5b1ca5[0x1])[_0x0b2c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7b19f8[_0x0b2c('0x43')]=_[_0x0b2c('0x47')](_0x7b19f8['where'],_0x33c2f7);}_0x7b19f8=_[_0x0b2c('0x47')]({},_0x7b19f8,_0x58d97e['options']);return db[_0x0b2c('0x3a')][_0x0b2c('0x17')]({'where':_0x7b19f8[_0x0b2c('0x43')]})['then'](function(_0x7ba0da){_0x4720dc[_0x0b2c('0x17')]=_0x7ba0da;if(_0x58d97e[_0x0b2c('0x29')][_0x0b2c('0x4b')]){_0x7b19f8[_0x0b2c('0x34')]=[{'all':!![]}];}return db[_0x0b2c('0x3a')][_0x0b2c('0x27')](_0x7b19f8);})['then'](function(_0x4aebeb){_0x4720dc['rows']=_0x4aebeb;return _0x4720dc;});}})['then'](respondWithFilteredResult(_0x515035,_0x7b19f8))[_0x0b2c('0x2b')](handleError(_0x515035,null));};exports['addTags']=function(_0x28cfaf,_0x570e79){return db[_0x0b2c('0x21')][_0x0b2c('0x36')]({'where':{'id':_0x28cfaf[_0x0b2c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x570e79,null))[_0x0b2c('0x1d')](function(_0x44cdc6){if(_0x44cdc6){return _0x44cdc6[_0x0b2c('0x4c')](_0x28cfaf['body'][_0x0b2c('0x3c')],_['omit'](_0x28cfaf[_0x0b2c('0x37')],[_0x0b2c('0x3c'),'id'])||{})[_0x0b2c('0x4d')](function(){return db[_0x0b2c('0x4e')]['findAll']({'attributes':['id',_0x0b2c('0x1e'),'color'],'where':{'id':_0x28cfaf[_0x0b2c('0x37')][_0x0b2c('0x3c')]}});})[_0x0b2c('0x1d')](function(_0x313e81){socket[_0x0b2c('0x4f')](_0x0b2c('0x50'),{'id':Number(_0x28cfaf[_0x0b2c('0x2d')]['id']),'tags':_0x313e81||[]});return{'id':Number(_0x28cfaf['params']['id']),'tags':_0x313e81||[]};});}})['then'](respondWithResult(_0x570e79,null))[_0x0b2c('0x2b')](handleError(_0x570e79,null));};exports[_0x0b2c('0x51')]=function(_0x2aa175,_0x195bb3){return db['SmsInteraction'][_0x0b2c('0x36')]({'where':{'id':_0x2aa175['params']['id']}})['then'](handleEntityNotFound(_0x195bb3,null))[_0x0b2c('0x1d')](function(_0x2279ed){if(_0x2279ed){return _0x2279ed[_0x0b2c('0x51')](_0x2aa175[_0x0b2c('0x29')][_0x0b2c('0x3c')]);}})[_0x0b2c('0x1d')](respondWithStatusCode(_0x195bb3,null))[_0x0b2c('0x2b')](handleError(_0x195bb3,null));};exports[_0x0b2c('0x52')]=function(_0x3c34b4,_0xd97dc6){var _0x132b80=moment()[_0x0b2c('0x53')]()[_0x0b2c('0x54')]();var _0x83e865=path['join'](config[_0x0b2c('0x55')],_0x0b2c('0x56'),_0x0b2c('0x57'),_0x0b2c('0x58'));var _0x314598=path[_0x0b2c('0x59')](_0x83e865,_0x132b80);var _0x4db5ff=util['format'](_0x0b2c('0x5a'),_0x3c34b4['params']['id'],_0x132b80);var _0x26326b=path[_0x0b2c('0x59')](_0x83e865,_0x4db5ff);var _0x2f9cfd=[];_0x2f9cfd[_0x0b2c('0x5b')]({'model':db[_0x0b2c('0x5c')],'as':_0x0b2c('0x5c'),'attributes':['id',_0x0b2c('0x5d')],'raw':!![]});_0x2f9cfd['push']({'model':db['CmContact'],'as':_0x0b2c('0x5e'),'attributes':['id',_0x0b2c('0x5f'),_0x0b2c('0x60')],'raw':!![]});var _0xc6e36=[{'model':db[_0x0b2c('0x3a')],'as':_0x0b2c('0x61'),'attributes':['id','body',_0x0b2c('0x62'),_0x0b2c('0x63'),_0x0b2c('0x64'),_0x0b2c('0x65')],'include':_0x2f9cfd}];_0xc6e36['push']({'model':db[_0x0b2c('0x66')],'as':_0x0b2c('0x67'),'attributes':['id','name']});_0xc6e36[_0x0b2c('0x5b')]({'model':db[_0x0b2c('0x5c')],'as':'Owner','attributes':['id',_0x0b2c('0x5d')]});return db['SmsInteraction'][_0x0b2c('0x36')]({'where':{'id':_0x3c34b4['params']['id']},'include':_0xc6e36})['then'](handleEntityNotFound(_0xd97dc6,null))[_0x0b2c('0x1d')](function(_0x235f33){if(_0x235f33){var _0x27c84f=_0x235f33['get']({'plain':!![]});fs[_0x0b2c('0x68')](_0x314598);var _0x524003={'channel':'Sms','account':_0x27c84f[_0x0b2c('0x67')]['name'],'agent':_0x27c84f[_0x0b2c('0x69')]?_0x27c84f[_0x0b2c('0x69')]['fullname']:_0x0b2c('0x6a'),'createdAt':moment(_0x27c84f[_0x0b2c('0x62')])[_0x0b2c('0x4a')](_0x0b2c('0x6b'))[_0x0b2c('0x54')](),'closedAt':_0x27c84f['closed']?moment(_0x27c84f[_0x0b2c('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0b2c('0x54')]():'','disposition':_0x27c84f[_0x0b2c('0x6d')],'messages':_(_0x27c84f[_0x0b2c('0x61')])[_0x0b2c('0x46')]({'secret':![]})[_0x0b2c('0x20')](function(_0x5741de){return{'date':moment(_0x5741de[_0x0b2c('0x62')])[_0x0b2c('0x4a')](_0x0b2c('0x6b'))[_0x0b2c('0x54')](),'sender':_0x5741de['direction']===_0x0b2c('0x6e')?_0x5741de[_0x0b2c('0x5c')]?_0x5741de['User']['fullname']:_0x0b2c('0x6f'):_0x5741de[_0x0b2c('0x5e')]['firstName']+(_0x5741de['Contact'][_0x0b2c('0x60')]?'\x20'+_0x5741de['Contact'][_0x0b2c('0x60')]:''),'body':_0x5741de[_0x0b2c('0x37')],'direction':_0x5741de[_0x0b2c('0x63')]==='out'?'A':'C','secret':_0x5741de[_0x0b2c('0x64')],'read':_0x5741de[_0x0b2c('0x65')]};})[_0x0b2c('0x70')]()};return ejs[_0x0b2c('0x71')](path[_0x0b2c('0x59')](config[_0x0b2c('0x55')],_0x0b2c('0x56'),_0x0b2c('0x72'),_0x0b2c('0x73')),{'interaction':_0x524003})[_0x0b2c('0x1d')](function(_0x3fe150){var _0x590609=path[_0x0b2c('0x59')](_0x314598,_0x0b2c('0x74')+_0x27c84f['id']+'-'+_0x132b80+_0x0b2c('0x75'));var _0x3a587c={'path':_0x590609,'channel':_0x0b2c('0x76'),'interactionId':_0x27c84f['id']};return pdf[_0x0b2c('0x77')](_0x3fe150,_0x3a587c);})[_0x0b2c('0x1d')](function(){return new BPromise(function(_0x416675,_0x370f88){zipdir(_0x314598,{'saveTo':_0x26326b},function(_0x47dd8e,_0x1d5fed){if(_0x47dd8e)return _0x370f88(_0x47dd8e);return _0x416675(_0x1d5fed);});})['then'](function(){return new BPromise(function(_0x5c9910,_0x23a6af){rimraf(_0x314598,function(_0x5ef432){if(_0x5ef432)_0x23a6af(_0x5ef432);return _0x5c9910();});});})['then'](function(){return _0xd97dc6['download'](_0x26326b,_0x4db5ff,function(_0x5db651){if(_0x5db651){console[_0x0b2c('0x78')](_0x0b2c('0x79'),_0x5db651);}else{fs['unlinkSync'](_0x26326b);}});});});}else{return _0xd97dc6[_0x0b2c('0x12')](0xc8);}})[_0x0b2c('0x2b')](handleError(_0xd97dc6,null));}; \ No newline at end of file +var _0x0dc1=['Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','log','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','end','status','offset','undefined','count','limit','set','json','update','destroy','then','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','getOptions','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','create','body','find','params','describe','SmsMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','addTags','omit','spread','Tag','color','removeTags','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','disposition','out'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x0dc1,0x175));var _0x10dc=function(_0x705a2b,_0x316574){_0x705a2b=_0x705a2b-0x0;var _0x4394f0=_0x0dc1[_0x705a2b];return _0x4394f0;};'use strict';var rimraf=require(_0x10dc('0x0'));var zipdir=require(_0x10dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x10dc('0x2'));var path=require(_0x10dc('0x3'));var ejs=require(_0x10dc('0x4'));var fs=require('fs');var _=require(_0x10dc('0x5'));var Redis=require(_0x10dc('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x10dc('0x7'));var logger=require(_0x10dc('0x8'))(_0x10dc('0x9'));var config=require('../../config/environment');var db=require(_0x10dc('0xa'))['db'];config['redis']=_[_0x10dc('0xb')](config[_0x10dc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x10dc('0xd'))(new Redis(config[_0x10dc('0xc')]));require(_0x10dc('0xe'))[_0x10dc('0xf')](socket);function respondWithStatusCode(_0x3976b3,_0x2515a2){_0x2515a2=_0x2515a2||0xcc;return function(_0x4b91c5){if(_0x4b91c5){return _0x3976b3['sendStatus'](_0x2515a2);}return _0x3976b3['status'](_0x2515a2)[_0x10dc('0x10')]();};}function respondWithResult(_0x4af55d,_0x4a9eb4){_0x4a9eb4=_0x4a9eb4||0xc8;return function(_0x13aca7){if(_0x13aca7){return _0x4af55d[_0x10dc('0x11')](_0x4a9eb4)['json'](_0x13aca7);}};}function respondWithFilteredResult(_0x28cf06,_0x1b27e4){return function(_0x10c379){if(_0x10c379){var _0x2dee79=typeof _0x1b27e4[_0x10dc('0x12')]===_0x10dc('0x13')&&typeof _0x1b27e4['limit']===_0x10dc('0x13');var _0x116ad1=_0x10c379[_0x10dc('0x14')];var _0x9ad0bf=_0x2dee79?0x0:_0x1b27e4[_0x10dc('0x12')];var _0x442280=_0x2dee79?_0x10c379[_0x10dc('0x14')]:_0x1b27e4[_0x10dc('0x12')]+_0x1b27e4[_0x10dc('0x15')];var _0x358b17;if(_0x442280>=_0x116ad1){_0x442280=_0x116ad1;_0x358b17=0xc8;}else{_0x358b17=0xce;}_0x28cf06['status'](_0x358b17);return _0x28cf06[_0x10dc('0x16')]('Content-Range',_0x9ad0bf+'-'+_0x442280+'/'+_0x116ad1)[_0x10dc('0x17')](_0x10c379);}return null;};}function saveUpdates(_0x4693f6){return function(_0x3cc434){if(_0x3cc434){return _0x3cc434[_0x10dc('0x18')](_0x4693f6)['then'](function(_0x739396){return _0x739396;});}return null;};}function removeEntity(_0x81252d){return function(_0x523dc9){if(_0x523dc9){return _0x523dc9[_0x10dc('0x19')]()[_0x10dc('0x1a')](function(){_0x81252d[_0x10dc('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b56c8){return function(_0x120c73){if(!_0x120c73){_0x8b56c8[_0x10dc('0x1b')](0x194);}return _0x120c73;};}function handleError(_0x444316,_0x531f8e){_0x531f8e=_0x531f8e||0x1f4;return function(_0x3e3f69){logger[_0x10dc('0x1c')](_0x3e3f69[_0x10dc('0x1d')]);if(_0x3e3f69['name']){delete _0x3e3f69[_0x10dc('0x1e')];}_0x444316[_0x10dc('0x11')](_0x531f8e)[_0x10dc('0x1f')](_0x3e3f69);};}exports[_0x10dc('0x20')]=function(_0x14abb3,_0x183058){var _0x1d496b={};var _0x17c6ad=_[_0x10dc('0x21')](db[_0x10dc('0x22')][_0x10dc('0x23')],function(_0x2fd403){return{'name':_0x2fd403[_0x10dc('0x24')],'type':_0x2fd403['type']['key']};});_0x1d496b=qs[_0x10dc('0x25')](_0x17c6ad,_0x14abb3);return interaction['findAll']('sms',_0x14abb3[_0x10dc('0x26')],_0x14abb3[_0x10dc('0x27')],_0x1d496b,_0x17c6ad)[_0x10dc('0x1a')](respondWithFilteredResult(_0x183058,_0x1d496b))[_0x10dc('0x28')](handleError(_0x183058,null));};exports[_0x10dc('0x29')]=function(_0x7ea045,_0x517975){var _0x3ee97a={'raw':![],'where':{'id':_0x7ea045['params']['id']}},_0x56cd9d={};_0x56cd9d[_0x10dc('0x2a')]=_[_0x10dc('0x2b')](db[_0x10dc('0x22')][_0x10dc('0x23')]);_0x56cd9d[_0x10dc('0x26')]=_[_0x10dc('0x2b')](_0x7ea045[_0x10dc('0x26')]);_0x56cd9d[_0x10dc('0x2c')]=_[_0x10dc('0x2d')](_0x56cd9d[_0x10dc('0x2a')],_0x56cd9d['query']);_0x3ee97a[_0x10dc('0x2e')]=_[_0x10dc('0x2d')](_0x56cd9d[_0x10dc('0x2a')],qs[_0x10dc('0x2f')](_0x7ea045['query'][_0x10dc('0x2f')]));_0x3ee97a['attributes']=_0x3ee97a['attributes'][_0x10dc('0x30')]?_0x3ee97a[_0x10dc('0x2e')]:_0x56cd9d[_0x10dc('0x2a')];if(_0x7ea045[_0x10dc('0x26')][_0x10dc('0x31')]){_0x3ee97a[_0x10dc('0x32')]=[{'all':!![]}];}_0x3ee97a=_['merge']({},_0x3ee97a,_0x7ea045[_0x10dc('0x33')]);return db[_0x10dc('0x22')]['find'](_0x3ee97a)[_0x10dc('0x1a')](handleEntityNotFound(_0x517975,null))[_0x10dc('0x1a')](respondWithResult(_0x517975,null))['catch'](handleError(_0x517975,null));};exports[_0x10dc('0x34')]=function(_0x1cd418,_0xa93f09){return db[_0x10dc('0x22')][_0x10dc('0x34')](_0x1cd418['body'],{})[_0x10dc('0x1a')](respondWithResult(_0xa93f09,0xc9))['catch'](handleError(_0xa93f09,null));};exports[_0x10dc('0x18')]=function(_0x4651b0,_0x109f06){if(_0x4651b0[_0x10dc('0x35')]['id']){delete _0x4651b0['body']['id'];}return db[_0x10dc('0x22')][_0x10dc('0x36')]({'where':{'id':_0x4651b0['params']['id']}})['then'](handleEntityNotFound(_0x109f06,null))[_0x10dc('0x1a')](saveUpdates(_0x4651b0['body'],null))[_0x10dc('0x1a')](respondWithResult(_0x109f06,null))[_0x10dc('0x28')](handleError(_0x109f06,null));};exports[_0x10dc('0x19')]=function(_0xc02d33,_0x236e75){return db['SmsInteraction']['find']({'where':{'id':_0xc02d33[_0x10dc('0x37')]['id']}})[_0x10dc('0x1a')](handleEntityNotFound(_0x236e75,null))[_0x10dc('0x1a')](removeEntity(_0x236e75,null))[_0x10dc('0x28')](handleError(_0x236e75,null));};exports[_0x10dc('0x38')]=function(_0x4a4fe9,_0x5aed64){return db[_0x10dc('0x22')][_0x10dc('0x38')]()[_0x10dc('0x1a')](respondWithResult(_0x5aed64,null))[_0x10dc('0x28')](handleError(_0x5aed64,null));};exports['addMessage']=function(_0x47c158,_0x4f9733){return db[_0x10dc('0x39')]['find']({'where':{'id':_0x47c158[_0x10dc('0x37')]['id']}})['then'](handleEntityNotFound(_0x4f9733,null))[_0x10dc('0x1a')](function(_0x19c12d){if(_0x19c12d){return _0x19c12d[_0x10dc('0x3a')](_0x47c158[_0x10dc('0x35')][_0x10dc('0x3b')],_['omit'](_0x47c158[_0x10dc('0x35')],[_0x10dc('0x3b'),'id'])||{});}})[_0x10dc('0x1a')](respondWithResult(_0x4f9733,null))['catch'](handleError(_0x4f9733,null));};exports[_0x10dc('0x3c')]=function(_0x2ae35c,_0xe16009){var _0x12a0fe={'raw':![],'where':{}};var _0x4d1d06={};var _0x58cd3b={'count':0x0,'rows':[]};return db[_0x10dc('0x22')][_0x10dc('0x3d')]({'where':{'id':_0x2ae35c['params']['id']}})[_0x10dc('0x1a')](handleEntityNotFound(_0xe16009,null))[_0x10dc('0x1a')](function(_0x88183b){if(_0x88183b){_0x4d1d06[_0x10dc('0x2a')]=_[_0x10dc('0x2b')](db[_0x10dc('0x39')][_0x10dc('0x23')]);_0x4d1d06[_0x10dc('0x26')]=_['keys'](_0x2ae35c[_0x10dc('0x26')]);_0x4d1d06['filters']=_[_0x10dc('0x2d')](_0x4d1d06[_0x10dc('0x2a')],_0x4d1d06['query']);_0x12a0fe[_0x10dc('0x2e')]=_[_0x10dc('0x2d')](_0x4d1d06[_0x10dc('0x2a')],qs['fields'](_0x2ae35c['query'][_0x10dc('0x2f')]));_0x12a0fe[_0x10dc('0x2e')]=_0x12a0fe['attributes']['length']?_0x12a0fe[_0x10dc('0x2e')]:_0x4d1d06[_0x10dc('0x2a')];if(!_0x2ae35c[_0x10dc('0x26')][_0x10dc('0x3e')](_0x10dc('0x3f'))){_0x12a0fe[_0x10dc('0x15')]=qs[_0x10dc('0x15')](_0x2ae35c[_0x10dc('0x26')]['limit']);_0x12a0fe[_0x10dc('0x12')]=qs[_0x10dc('0x12')](_0x2ae35c['query']['offset']);}_0x12a0fe[_0x10dc('0x40')]=qs[_0x10dc('0x41')](_0x2ae35c['query'][_0x10dc('0x41')]);_0x12a0fe[_0x10dc('0x42')]=qs[_0x10dc('0x2c')](_[_0x10dc('0x43')](_0x2ae35c[_0x10dc('0x26')],_0x4d1d06[_0x10dc('0x2c')]));_0x12a0fe[_0x10dc('0x42')][_0x10dc('0x44')]=_0x88183b['id'];if(_0x2ae35c[_0x10dc('0x26')][_0x10dc('0x45')]){_0x12a0fe['where']=_['merge'](_0x12a0fe[_0x10dc('0x42')],{'$or':_['map'](_0x12a0fe[_0x10dc('0x2e')],function(_0x4099b3){var _0x2d17b7={};_0x2d17b7[_0x4099b3]={'$like':'%'+_0x2ae35c[_0x10dc('0x26')][_0x10dc('0x45')]+'%'};return _0x2d17b7;})});}if(_0x2ae35c[_0x10dc('0x26')]['$gte']){var _0x2107c7=_0x2ae35c['query'][_0x10dc('0x46')][_0x10dc('0x47')](',');var _0x31d56d={};_0x31d56d[_0x2107c7[0x0]]={'$gte':moment(_0x2107c7[0x1])[_0x10dc('0x48')](_0x10dc('0x49'))};_0x12a0fe['where']=_[_0x10dc('0x4a')](_0x12a0fe[_0x10dc('0x42')],_0x31d56d);}_0x12a0fe=_[_0x10dc('0x4a')]({},_0x12a0fe,_0x2ae35c[_0x10dc('0x33')]);return db['SmsMessage'][_0x10dc('0x14')]({'where':_0x12a0fe[_0x10dc('0x42')]})['then'](function(_0xb60a43){_0x58cd3b[_0x10dc('0x14')]=_0xb60a43;if(_0x2ae35c[_0x10dc('0x26')][_0x10dc('0x31')]){_0x12a0fe['include']=[{'all':!![]}];}return db['SmsMessage'][_0x10dc('0x4b')](_0x12a0fe);})[_0x10dc('0x1a')](function(_0x40e477){_0x58cd3b['rows']=_0x40e477;return _0x58cd3b;});}})[_0x10dc('0x1a')](respondWithFilteredResult(_0xe16009,_0x12a0fe))[_0x10dc('0x28')](handleError(_0xe16009,null));};exports[_0x10dc('0x4c')]=function(_0x86265d,_0x243804){return db[_0x10dc('0x22')][_0x10dc('0x36')]({'where':{'id':_0x86265d[_0x10dc('0x37')]['id']}})[_0x10dc('0x1a')](handleEntityNotFound(_0x243804,null))[_0x10dc('0x1a')](function(_0x331f3c){if(_0x331f3c){return _0x331f3c['setTags'](_0x86265d[_0x10dc('0x35')][_0x10dc('0x3b')],_[_0x10dc('0x4d')](_0x86265d['body'],['ids','id'])||{})[_0x10dc('0x4e')](function(){return db[_0x10dc('0x4f')]['findAll']({'attributes':['id','name',_0x10dc('0x50')],'where':{'id':_0x86265d[_0x10dc('0x35')][_0x10dc('0x3b')]}});})[_0x10dc('0x1a')](function(_0x36fb1f){socket['emit']('smsInteractionTags:save',{'id':Number(_0x86265d[_0x10dc('0x37')]['id']),'tags':_0x36fb1f||[]});return{'id':Number(_0x86265d[_0x10dc('0x37')]['id']),'tags':_0x36fb1f||[]};});}})[_0x10dc('0x1a')](respondWithResult(_0x243804,null))['catch'](handleError(_0x243804,null));};exports['removeTags']=function(_0x58643d,_0x936c1d){return db['SmsInteraction']['find']({'where':{'id':_0x58643d[_0x10dc('0x37')]['id']}})[_0x10dc('0x1a')](handleEntityNotFound(_0x936c1d,null))[_0x10dc('0x1a')](function(_0x2e84ba){if(_0x2e84ba){return _0x2e84ba[_0x10dc('0x51')](_0x58643d[_0x10dc('0x26')]['ids']);}})[_0x10dc('0x1a')](respondWithStatusCode(_0x936c1d,null))[_0x10dc('0x28')](handleError(_0x936c1d,null));};exports['download']=function(_0x1b685a,_0x32d0da){var _0x5353c5=moment()[_0x10dc('0x52')]()[_0x10dc('0x53')]();var _0x234a86=path[_0x10dc('0x54')](config[_0x10dc('0x55')],_0x10dc('0x56'),'files',_0x10dc('0x57'));var _0x22f0bf=path[_0x10dc('0x54')](_0x234a86,_0x5353c5);var _0x39d13f=util[_0x10dc('0x48')](_0x10dc('0x58'),_0x1b685a[_0x10dc('0x37')]['id'],_0x5353c5);var _0x211a4f=path[_0x10dc('0x54')](_0x234a86,_0x39d13f);var _0x3e6057=[];_0x3e6057[_0x10dc('0x59')]({'model':db[_0x10dc('0x5a')],'as':_0x10dc('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x3e6057['push']({'model':db[_0x10dc('0x5b')],'as':'Contact','attributes':['id',_0x10dc('0x5c'),_0x10dc('0x5d')],'raw':!![]});var _0x404e82=[{'model':db[_0x10dc('0x39')],'as':_0x10dc('0x5e'),'attributes':['id','body',_0x10dc('0x5f'),_0x10dc('0x60'),_0x10dc('0x61'),_0x10dc('0x62')],'include':_0x3e6057}];_0x404e82[_0x10dc('0x59')]({'model':db[_0x10dc('0x63')],'as':_0x10dc('0x64'),'attributes':['id',_0x10dc('0x1e')]});_0x404e82[_0x10dc('0x59')]({'model':db[_0x10dc('0x5a')],'as':'Owner','attributes':['id',_0x10dc('0x65')]});return db[_0x10dc('0x22')][_0x10dc('0x36')]({'where':{'id':_0x1b685a[_0x10dc('0x37')]['id']},'include':_0x404e82})[_0x10dc('0x1a')](handleEntityNotFound(_0x32d0da,null))[_0x10dc('0x1a')](function(_0x5f38c0){if(_0x5f38c0){var _0x2de60e=_0x5f38c0[_0x10dc('0x66')]({'plain':!![]});fs[_0x10dc('0x67')](_0x22f0bf);var _0x3cd0a0={'channel':_0x10dc('0x68'),'account':_0x2de60e[_0x10dc('0x64')][_0x10dc('0x1e')],'agent':_0x2de60e[_0x10dc('0x69')]?_0x2de60e['Owner']['fullname']:_0x10dc('0x6a'),'createdAt':moment(_0x2de60e[_0x10dc('0x5f')])[_0x10dc('0x48')](_0x10dc('0x49'))['toString'](),'closedAt':_0x2de60e[_0x10dc('0x6b')]?moment(_0x2de60e[_0x10dc('0x6c')])[_0x10dc('0x48')](_0x10dc('0x49'))[_0x10dc('0x53')]():'','disposition':_0x2de60e[_0x10dc('0x6d')],'messages':_(_0x2de60e[_0x10dc('0x5e')])[_0x10dc('0x45')]({'secret':![]})[_0x10dc('0x21')](function(_0x2e5f91){return{'date':moment(_0x2e5f91[_0x10dc('0x5f')])[_0x10dc('0x48')](_0x10dc('0x49'))['toString'](),'sender':_0x2e5f91[_0x10dc('0x60')]===_0x10dc('0x6e')?_0x2e5f91['User']?_0x2e5f91['User'][_0x10dc('0x65')]:'System':_0x2e5f91[_0x10dc('0x6f')]['firstName']+(_0x2e5f91['Contact'][_0x10dc('0x5d')]?'\x20'+_0x2e5f91['Contact'][_0x10dc('0x5d')]:''),'body':_0x2e5f91[_0x10dc('0x35')],'direction':_0x2e5f91[_0x10dc('0x60')]===_0x10dc('0x6e')?'A':'C','secret':_0x2e5f91[_0x10dc('0x61')],'read':_0x2e5f91[_0x10dc('0x62')]};})[_0x10dc('0x70')]()};return ejs[_0x10dc('0x71')](path[_0x10dc('0x54')](config[_0x10dc('0x55')],_0x10dc('0x56'),_0x10dc('0x72'),_0x10dc('0x73')),{'interaction':_0x3cd0a0})[_0x10dc('0x1a')](function(_0x2553e8){var _0x272874=path['join'](_0x22f0bf,_0x10dc('0x74')+_0x2de60e['id']+'-'+_0x5353c5+_0x10dc('0x75'));var _0x5b5e80={'path':_0x272874,'channel':_0x10dc('0x68'),'interactionId':_0x2de60e['id']};return pdf['createPdfFromHTML'](_0x2553e8,_0x5b5e80);})[_0x10dc('0x1a')](function(){return new BPromise(function(_0xee3a8e,_0x5e9d6c){zipdir(_0x22f0bf,{'saveTo':_0x211a4f},function(_0x593279,_0x2c4add){if(_0x593279)return _0x5e9d6c(_0x593279);return _0xee3a8e(_0x2c4add);});})['then'](function(){return new BPromise(function(_0x1e2b5a,_0x2117e0){rimraf(_0x22f0bf,function(_0x19e473){if(_0x19e473)_0x2117e0(_0x19e473);return _0x1e2b5a();});});})[_0x10dc('0x1a')](function(){return _0x32d0da[_0x10dc('0x76')](_0x211a4f,_0x39d13f,function(_0x1c0350){if(_0x1c0350){console[_0x10dc('0x77')]('err',_0x1c0350);}else{fs[_0x10dc('0x78')](_0x211a4f);}});});});}else{return _0x32d0da['sendStatus'](0xc8);}})['catch'](handleError(_0x32d0da,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d3a40cb..13f5986 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 _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2c52dd,_0x503ff5){var _0x4456a8=function(_0x45bdbe){while(--_0x45bdbe){_0x2c52dd['push'](_0x2c52dd['shift']());}};_0x4456a8(++_0x503ff5);}(_0xab40,0xcd));var _0x0ab4=function(_0x40c573,_0x3b48b3){_0x40c573=_0x40c573-0x0;var _0x2c984a=_0xab40[_0x40c573];return _0x2c984a;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x3266=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x1a5528,_0x29743d){var _0x20a24c=function(_0x4b7506){while(--_0x4b7506){_0x1a5528['push'](_0x1a5528['shift']());}};_0x20a24c(++_0x29743d);}(_0x3266,0x6a));var _0x6326=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x3266[_0xd1c39b];return _0x58f5bc;};'use strict';var EventEmitter=require(_0x6326('0x0'));var SmsInteraction=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var SmsMessage=require(_0x6326('0x1'))['db'][_0x6326('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6326('0x4')](0x0);var events={'afterCreate':_0x6326('0x5'),'afterUpdate':_0x6326('0x6'),'afterDestroy':_0x6326('0x7')};function emitEvent(_0x5a6b4d){return function(_0x30b22e,_0x5f38a3,_0x25ecd8){_0x30b22e[_0x6326('0x8')]({'attributes':['id'],'raw':!![]})[_0x6326('0x9')](function(_0x5402e5){_0x30b22e[_0x6326('0xa')]('Users',_0x5402e5[_0x6326('0xb')](function(_0x90c0f){return{'id':_0x90c0f['id']};}));return SmsMessage[_0x6326('0xc')]({'where':{'SmsInteractionId':_0x30b22e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6326('0x9')](function(_0x37a23d){_0x30b22e['setDataValue'](_0x6326('0xd'),_0x37a23d[_0x6326('0xe')]);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d+':'+_0x30b22e['id'],_0x30b22e);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d,_0x30b22e);_0x25ecd8(null);})[_0x6326('0x10')](_0x25ecd8(null));};}for(var e in events){if(events[_0x6326('0x11')](e)){var event=events[e];SmsInteraction[_0x6326('0x12')](e,emitEvent(event));}}module[_0x6326('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index afd9bbf..b9e806a 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 _0x0d1e=['../../config/logger','moment','request-promise','path','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util'];(function(_0x4df2d9,_0x5d6087){var _0x195aad=function(_0x381148){while(--_0x381148){_0x4df2d9['push'](_0x4df2d9['shift']());}};_0x195aad(++_0x5d6087);}(_0x0d1e,0x1ab));var _0xe0d1=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x0d1e[_0x387603];return _0x55ea9e;};'use strict';var _=require(_0xe0d1('0x0'));var util=require(_0xe0d1('0x1'));var logger=require(_0xe0d1('0x2'))('api');var moment=require(_0xe0d1('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0d1('0x4'));var fs=require('fs');var path=require(_0xe0d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xe0d1('0x6')]=function(_0x37935e,_0x542506){return _0x37935e['define'](_0xe0d1('0x7'),attributes,{'tableName':_0xe0d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5edc68,_0x618348,_0x1e9627){if(_0x5edc68[_0xe0d1('0x9')](_0xe0d1('0xa'))){_0x5edc68[_0xe0d1('0xb')]=moment()[_0xe0d1('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1e9627(null,_0x5edc68);}}});}; \ No newline at end of file +var _0x2159=['util','../../config/logger','bluebird','request-promise','rimraf','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x4c8e92,_0x446dd1){var _0x45a7bb=function(_0x5bfba0){while(--_0x5bfba0){_0x4c8e92['push'](_0x4c8e92['shift']());}};_0x45a7bb(++_0x446dd1);}(_0x2159,0x8e));var _0x9215=function(_0x2a46ba,_0x502e08){_0x2a46ba=_0x2a46ba-0x0;var _0x124440=_0x2159[_0x2a46ba];return _0x124440;};'use strict';var _=require(_0x9215('0x0'));var util=require(_0x9215('0x1'));var logger=require(_0x9215('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9215('0x3'));var rp=require(_0x9215('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9215('0x5'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x50f58d,_0x49a362){return _0x50f58d[_0x9215('0x6')](_0x9215('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x447710,_0x4b2764,_0x5122cc){if(_0x447710[_0x9215('0x8')](_0x9215('0x9'))){_0x447710[_0x9215('0xa')]=moment()[_0x9215('0xb')](_0x9215('0xc'));}_0x5122cc(null,_0x447710);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 936217a..98fedec 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 _0xf2cc=['addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','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','raw','where','AddTagsToSmsInteraction','find'];(function(_0xe69d,_0x4b1170){var _0x6078ec=function(_0x584ed0){while(--_0x584ed0){_0xe69d['push'](_0xe69d['shift']());}};_0x6078ec(++_0x4b1170);}(_0xf2cc,0xd7));var _0xcf2c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf2cc[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xcf2c('0x0'));var moment=require(_0xcf2c('0x1'));var BPromise=require(_0xcf2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf2c('0x3'));var db=require(_0xcf2c('0x4'))['db'];var utils=require(_0xcf2c('0x5'));var logger=require(_0xcf2c('0x6'))(_0xcf2c('0x7'));var config=require(_0xcf2c('0x8'));var jayson=require(_0xcf2c('0x9'));var client=jayson['client'][_0xcf2c('0xa')]({'port':0x232a});config[_0xcf2c('0xb')]=_['defaults'](config[_0xcf2c('0xb')],{'host':_0xcf2c('0xc'),'port':0x18eb});var socket=require(_0xcf2c('0xd'))(new Redis(config['redis']));require(_0xcf2c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4325e7,_0x2b3be5,_0x397275){return new BPromise(function(_0x5e6be7,_0x8a0b32){return client[_0xcf2c('0xf')](_0x4325e7,_0x397275)[_0xcf2c('0x10')](function(_0x2ba4c2){logger[_0xcf2c('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x2b3be5,_0xcf2c('0x12'));logger[_0xcf2c('0x13')](_0xcf2c('0x14'),_0x2b3be5,_0xcf2c('0x12'),JSON[_0xcf2c('0x15')](_0x2ba4c2));if(_0x2ba4c2[_0xcf2c('0x16')]){if(_0x2ba4c2[_0xcf2c('0x16')][_0xcf2c('0x17')]===0x1f4){logger[_0xcf2c('0x16')](_0xcf2c('0x18'),_0x2b3be5,_0x2ba4c2['error'][_0xcf2c('0x19')]);return _0x8a0b32(_0x2ba4c2['error'][_0xcf2c('0x19')]);}logger[_0xcf2c('0x16')](_0xcf2c('0x18'),_0x2b3be5,_0x2ba4c2[_0xcf2c('0x16')]['message']);return _0x5e6be7(_0x2ba4c2[_0xcf2c('0x16')]['message']);}else{logger[_0xcf2c('0x11')](_0xcf2c('0x18'),_0x2b3be5,'request\x20sent');_0x5e6be7(_0x2ba4c2[_0xcf2c('0x1a')][_0xcf2c('0x19')]);}})[_0xcf2c('0x1b')](function(_0x209a0b){logger['error'](_0xcf2c('0x18'),_0x2b3be5,_0x209a0b);_0x8a0b32(_0x209a0b);});});}exports[_0xcf2c('0x1c')]=function(_0x14c251){var _0x311c26=this;return new Promise(function(_0x30df16,_0x1da376){return db[_0xcf2c('0x1d')][_0xcf2c('0x1e')](_0x14c251[_0xcf2c('0x1f')],{'raw':_0x14c251[_0xcf2c('0x20')]?_0x14c251['options'][_0xcf2c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14c251[_0xcf2c('0x20')]?_0x14c251[_0xcf2c('0x20')][_0xcf2c('0x22')]||null:null,'attributes':_0x14c251[_0xcf2c('0x20')]?_0x14c251[_0xcf2c('0x20')]['attributes']||null:null,'limit':_0x14c251[_0xcf2c('0x20')]?_0x14c251[_0xcf2c('0x20')]['limit']||null:null})['then'](function(_0x419ab5){logger['info'](_0xcf2c('0x1c'),_0x14c251);logger['debug'](_0xcf2c('0x1c'),_0x14c251,JSON['stringify'](_0x419ab5));_0x30df16(_0x419ab5);})[_0xcf2c('0x1b')](function(_0x4031a1){logger[_0xcf2c('0x16')]('UpdateSmsInteraction',_0x4031a1[_0xcf2c('0x19')],_0x14c251);_0x1da376(_0x311c26[_0xcf2c('0x16')](0x1f4,_0x4031a1[_0xcf2c('0x19')]));});});};exports[_0xcf2c('0x23')]=function(_0x5990d8){return new Promise(function(_0x3e71a9,_0x5bbe8b){return db['SmsInteraction'][_0xcf2c('0x24')]({'where':_0x5990d8[_0xcf2c('0x20')]?_0x5990d8[_0xcf2c('0x20')][_0xcf2c('0x22')]||null:null})[_0xcf2c('0x10')](function(_0x3162a8){if(_0x3162a8){return _0x3162a8[_0xcf2c('0x25')](_0x5990d8[_0xcf2c('0x1f')][_0xcf2c('0x26')],_[_0xcf2c('0x27')](_0x5990d8[_0xcf2c('0x1f')],['ids','id'])||{});}})[_0xcf2c('0x28')](function(_0x43b8ba){logger['info']('AddTags',_0x5990d8);logger['debug'](_0xcf2c('0x29'),_0x5990d8,JSON['stringify'](_0x43b8ba));_0x3e71a9(_0x43b8ba);})[_0xcf2c('0x1b')](function(_0x2fcdbc){logger['error'](_0xcf2c('0x29'),_0x2fcdbc[_0xcf2c('0x19')],_0x5990d8);_0x5bbe8b(_this['error'](0x1f4,_0x2fcdbc[_0xcf2c('0x19')]));});});}; \ No newline at end of file +var _0xa6b7=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','then'];(function(_0x5a05fd,_0x530fca){var _0x4d7b3c=function(_0x5791b0){while(--_0x5791b0){_0x5a05fd['push'](_0x5a05fd['shift']());}};_0x4d7b3c(++_0x530fca);}(_0xa6b7,0x1a8));var _0x7a6b=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xa6b7[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x7a6b('0x0'));var util=require(_0x7a6b('0x1'));var moment=require(_0x7a6b('0x2'));var BPromise=require(_0x7a6b('0x3'));var rs=require(_0x7a6b('0x4'));var fs=require('fs');var Redis=require(_0x7a6b('0x5'));var db=require(_0x7a6b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a6b('0x7'))(_0x7a6b('0x8'));var config=require(_0x7a6b('0x9'));var jayson=require(_0x7a6b('0xa'));var client=jayson['client'][_0x7a6b('0xb')]({'port':0x232a});config[_0x7a6b('0xc')]=_['defaults'](config[_0x7a6b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a6b('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x7a6b('0xe')](socket);function respondWithRpcPromise(_0x19094c,_0x4403eb,_0x4e00dd){return new BPromise(function(_0x5a9350,_0x43c262){return client['request'](_0x19094c,_0x4e00dd)[_0x7a6b('0xf')](function(_0x1e0243){logger[_0x7a6b('0x10')](_0x7a6b('0x11'),_0x4403eb,_0x7a6b('0x12'));logger[_0x7a6b('0x13')](_0x7a6b('0x14'),_0x4403eb,_0x7a6b('0x12'),JSON[_0x7a6b('0x15')](_0x1e0243));if(_0x1e0243[_0x7a6b('0x16')]){if(_0x1e0243[_0x7a6b('0x16')]['code']===0x1f4){logger['error'](_0x7a6b('0x11'),_0x4403eb,_0x1e0243['error'][_0x7a6b('0x17')]);return _0x43c262(_0x1e0243['error']['message']);}logger[_0x7a6b('0x16')](_0x7a6b('0x11'),_0x4403eb,_0x1e0243[_0x7a6b('0x16')][_0x7a6b('0x17')]);return _0x5a9350(_0x1e0243[_0x7a6b('0x16')][_0x7a6b('0x17')]);}else{logger[_0x7a6b('0x10')](_0x7a6b('0x11'),_0x4403eb,'request\x20sent');_0x5a9350(_0x1e0243[_0x7a6b('0x18')][_0x7a6b('0x17')]);}})[_0x7a6b('0x19')](function(_0x5d874c){logger['error'](_0x7a6b('0x11'),_0x4403eb,_0x5d874c);_0x43c262(_0x5d874c);});});}exports[_0x7a6b('0x1a')]=function(_0x2bc475){var _0x3f7688=this;return new Promise(function(_0x5c0c98,_0x3a0376){return db[_0x7a6b('0x1b')][_0x7a6b('0x1c')](_0x2bc475[_0x7a6b('0x1d')],{'raw':_0x2bc475[_0x7a6b('0x1e')]?_0x2bc475[_0x7a6b('0x1e')][_0x7a6b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bc475[_0x7a6b('0x1e')]?_0x2bc475[_0x7a6b('0x1e')][_0x7a6b('0x20')]||null:null,'attributes':_0x2bc475['options']?_0x2bc475['options']['attributes']||null:null,'limit':_0x2bc475[_0x7a6b('0x1e')]?_0x2bc475[_0x7a6b('0x1e')][_0x7a6b('0x21')]||null:null})[_0x7a6b('0xf')](function(_0x4e3e51){logger['info'](_0x7a6b('0x1a'),_0x2bc475);logger['debug'](_0x7a6b('0x1a'),_0x2bc475,JSON[_0x7a6b('0x15')](_0x4e3e51));_0x5c0c98(_0x4e3e51);})[_0x7a6b('0x19')](function(_0x31321e){logger[_0x7a6b('0x16')](_0x7a6b('0x1a'),_0x31321e['message'],_0x2bc475);_0x3a0376(_0x3f7688[_0x7a6b('0x16')](0x1f4,_0x31321e['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x2397af){return new Promise(function(_0x4535c6,_0x441294){return db[_0x7a6b('0x1b')][_0x7a6b('0x22')]({'where':_0x2397af[_0x7a6b('0x1e')]?_0x2397af['options'][_0x7a6b('0x20')]||null:null})['then'](function(_0xc05b94){if(_0xc05b94){return _0xc05b94[_0x7a6b('0x23')](_0x2397af[_0x7a6b('0x1d')][_0x7a6b('0x24')],_[_0x7a6b('0x25')](_0x2397af[_0x7a6b('0x1d')],[_0x7a6b('0x24'),'id'])||{});}})[_0x7a6b('0x26')](function(_0x14988e){logger[_0x7a6b('0x10')]('AddTags',_0x2397af);logger[_0x7a6b('0x13')](_0x7a6b('0x27'),_0x2397af,JSON[_0x7a6b('0x15')](_0x14988e));_0x4535c6(_0x14988e);})[_0x7a6b('0x19')](function(_0x3ae91e){logger[_0x7a6b('0x16')](_0x7a6b('0x27'),_0x3ae91e[_0x7a6b('0x17')],_0x2397af);_0x441294(_this[_0x7a6b('0x16')](0x1f4,_0x3ae91e[_0x7a6b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f377007..141814b 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 _0xd9e0=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x249577,_0x5577da){var _0x11f27b=function(_0x1c6d74){while(--_0x1c6d74){_0x249577['push'](_0x249577['shift']());}};_0x11f27b(++_0x5577da);}(_0xd9e0,0x1e4));var _0x0d9e=function(_0x5b0a11,_0x95e182){_0x5b0a11=_0x5b0a11-0x0;var _0x658208=_0xd9e0[_0x5b0a11];return _0x658208;};'use strict';var SmsInteractionEvents=require(_0x0d9e('0x0'));var events=['save',_0x0d9e('0x1'),_0x0d9e('0x2')];function createListener(_0x317366,_0x56398c){return function(_0xda2c5e){_0x56398c[_0x0d9e('0x3')](_0x317366,_0xda2c5e);};}function removeListener(_0x248c4b,_0x1a495f){return function(){SmsInteractionEvents[_0x0d9e('0x4')](_0x248c4b,_0x1a495f);};}exports[_0x0d9e('0x5')]=function(_0x4b00f2){for(var _0x5b9a1d=0x0,_0x3bcfda=events[_0x0d9e('0x6')];_0x5b9a1d<_0x3bcfda;_0x5b9a1d++){var _0x10804d=events[_0x5b9a1d];var _0x5dc9bd=createListener(_0x0d9e('0x7')+_0x10804d,_0x4b00f2);SmsInteractionEvents['on'](_0x10804d,_0x5dc9bd);}}; \ No newline at end of file +var _0x862a=['save','remove','update','emit','removeListener','smsInteraction:','./smsInteraction.events'];(function(_0x184394,_0x3bf79c){var _0x106c1a=function(_0x257ab8){while(--_0x257ab8){_0x184394['push'](_0x184394['shift']());}};_0x106c1a(++_0x3bf79c);}(_0x862a,0xb5));var _0xa862=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x862a[_0x1c34e7];return _0x378cb1;};'use strict';var SmsInteractionEvents=require(_0xa862('0x0'));var events=[_0xa862('0x1'),_0xa862('0x2'),_0xa862('0x3')];function createListener(_0x3c7b20,_0x2441e4){return function(_0x5c8ed7){_0x2441e4[_0xa862('0x4')](_0x3c7b20,_0x5c8ed7);};}function removeListener(_0x5539f1,_0x1c5853){return function(){SmsInteractionEvents[_0xa862('0x5')](_0x5539f1,_0x1c5853);};}exports['register']=function(_0x2b0f87){for(var _0x1386f4=0x0,_0x13ab6e=events['length'];_0x1386f4<_0x13ab6e;_0x1386f4++){var _0x4c97b0=events[_0x1386f4];var _0x25ed9f=createListener(_0xa862('0x6')+_0x4c97b0,_0x2b0f87);SmsInteractionEvents['on'](_0x4c97b0,_0x25ed9f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 91e2e9c..9cfc290 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 _0x42cf=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','tracked','sms','create','/:id/status','status','/:id','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x42cf,0x123));var _0xf42c=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x42cf[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xf42c('0x0'));var util=require(_0xf42c('0x1'));var path=require('path');var timeout=require(_0xf42c('0x2'));var express=require(_0xf42c('0x3'));var router=express['Router']();var fs_extra=require(_0xf42c('0x4'));var auth=require(_0xf42c('0x5'));var interaction=require(_0xf42c('0x6'));var config=require(_0xf42c('0x7'));var controller=require('./smsMessage.controller');router[_0xf42c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf42c('0x9')]);router[_0xf42c('0x8')](_0xf42c('0xa'),auth[_0xf42c('0xb')](),controller['describe']);router[_0xf42c('0x8')]('/:id',auth[_0xf42c('0xb')](),controller[_0xf42c('0xc')]);router[_0xf42c('0xd')]('/',auth[_0xf42c('0xb')](),interaction[_0xf42c('0xe')](_0xf42c('0xf'),'smsmessage:create'),controller[_0xf42c('0x10')]);router[_0xf42c('0xd')](_0xf42c('0x11'),controller[_0xf42c('0x12')]);router['put'](_0xf42c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xf42c('0x14')]('/:id/accept',auth[_0xf42c('0xb')](),controller[_0xf42c('0x15')]);router[_0xf42c('0x14')](_0xf42c('0x16'),auth['isAuthenticated'](),controller[_0xf42c('0x17')]);router[_0xf42c('0x18')]('/:id',auth[_0xf42c('0xb')](),controller[_0xf42c('0x19')]);module[_0xf42c('0x1a')]=router; \ No newline at end of file +var _0xc493=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','tracked','sms','create','post','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc493,0xba));var _0x3c49=function(_0x40727d,_0x5294a8){_0x40727d=_0x40727d-0x0;var _0x128089=_0xc493[_0x40727d];return _0x128089;};'use strict';var multer=require(_0x3c49('0x0'));var util=require(_0x3c49('0x1'));var path=require('path');var timeout=require(_0x3c49('0x2'));var express=require(_0x3c49('0x3'));var router=express[_0x3c49('0x4')]();var fs_extra=require(_0x3c49('0x5'));var auth=require(_0x3c49('0x6'));var interaction=require(_0x3c49('0x7'));var config=require(_0x3c49('0x8'));var controller=require(_0x3c49('0x9'));router[_0x3c49('0xa')]('/',auth[_0x3c49('0xb')](),controller[_0x3c49('0xc')]);router[_0x3c49('0xa')]('/describe',auth[_0x3c49('0xb')](),controller[_0x3c49('0xd')]);router[_0x3c49('0xa')]('/:id',auth[_0x3c49('0xb')](),controller['show']);router['post']('/',auth[_0x3c49('0xb')](),interaction[_0x3c49('0xe')](_0x3c49('0xf'),'smsmessage:create'),controller[_0x3c49('0x10')]);router[_0x3c49('0x11')]('/:id/status',controller['status']);router[_0x3c49('0x12')](_0x3c49('0x13'),auth[_0x3c49('0xb')](),controller[_0x3c49('0x14')]);router[_0x3c49('0x12')](_0x3c49('0x15'),auth[_0x3c49('0xb')](),controller[_0x3c49('0x16')]);router['put']('/:id/reject',auth[_0x3c49('0xb')](),controller[_0x3c49('0x17')]);router[_0x3c49('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x3c49('0x19')]);module[_0x3c49('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a0de4de..a1e710a 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 _0xed5f=['medium','ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT'];(function(_0x44a4d3,_0x2ec0d4){var _0x61f685=function(_0x5ad4b3){while(--_0x5ad4b3){_0x44a4d3['push'](_0x44a4d3['shift']());}};_0x61f685(++_0x2ec0d4);}(_0xed5f,0x1e6));var _0xfed5=function(_0x1ecacb,_0x562449){_0x1ecacb=_0x1ecacb-0x0;var _0x297ba7=_0xed5f[_0x1ecacb];return _0x297ba7;};'use strict';var Sequelize=require('sequelize');module[_0xfed5('0x0')]={'body':{'type':Sequelize[_0xfed5('0x1')](_0xfed5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfed5('0x3')]('in',_0xfed5('0x4')),'defaultValue':_0xfed5('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfed5('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfed5('0x6')]},'secret':{'type':Sequelize[_0xfed5('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfed5('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x585a=['ENUM','out','STRING','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x2c4a5d,_0x433514){var _0x22f7e9=function(_0x603e97){while(--_0x603e97){_0x2c4a5d['push'](_0x2c4a5d['shift']());}};_0x22f7e9(++_0x433514);}(_0x585a,0xf2));var _0xa585=function(_0x386812,_0x27c823){_0x386812=_0x386812-0x0;var _0x4704d2=_0x585a[_0x386812];return _0x4704d2;};'use strict';var Sequelize=require(_0xa585('0x0'));module['exports']={'body':{'type':Sequelize[_0xa585('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa585('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa585('0x3')]('in',_0xa585('0x4')),'defaultValue':_0xa585('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa585('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa585('0x5')]},'readAt':{'type':Sequelize[_0xa585('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa585('0x5')]},'providerResponse':{'type':Sequelize[_0xa585('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index cced124..cb3c4b2 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 _0x3914=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','acceptmessage','reject','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','contact','motionChannel','event','EventManager','SmsAccount','SmsAccountId','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','infobip','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes'];(function(_0x1f81bc,_0x163f68){var _0x6f1ad4=function(_0x569ed9){while(--_0x569ed9){_0x1f81bc['push'](_0x1f81bc['shift']());}};_0x6f1ad4(++_0x163f68);}(_0x3914,0xeb));var _0x4391=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x3914[_0x349367];return _0x14179b;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4391('0x2'));var rp=require(_0x4391('0x3'));var moment=require('moment');var BPromise=require(_0x4391('0x4'));var Mustache=require(_0x4391('0x5'));var util=require(_0x4391('0x6'));var path=require('path');var sox=require(_0x4391('0x7'));var csv=require(_0x4391('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4391('0x9'));var _=require('lodash');var squel=require(_0x4391('0xa'));var crypto=require('crypto');var jsforce=require(_0x4391('0xb'));var deskjs=require(_0x4391('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4391('0xd'));var Redis=require(_0x4391('0xe'));var authService=require(_0x4391('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4391('0x10'));var hardwareService=require(_0x4391('0x11'));var logger=require(_0x4391('0x12'))(_0x4391('0x13'));var utils=require('../../config/utils');var config=require(_0x4391('0x14'));var licenseUtil=require(_0x4391('0x15'));var db=require(_0x4391('0x16'))['db'];config[_0x4391('0x17')]=_[_0x4391('0x18')](config[_0x4391('0x17')],{'host':_0x4391('0x19'),'port':0x18eb});var socket=require(_0x4391('0x1a'))(new Redis(config['redis']));require(_0x4391('0x1b'))[_0x4391('0x1c')](socket);var jayson=require(_0x4391('0x1d'));var client=jayson[_0x4391('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x4391('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x343203,_0x3a1b80,_0x3e4585,_0x1c2038){return new BPromise(function(_0x2a79a4,_0x15e884){var _0x2b5117=_0x1c2038||client;return _0x2b5117[_0x4391('0x1f')](_0x343203,_0x3e4585)['then'](function(_0x4cfa6b){logger[_0x4391('0x20')]('SmsMessage,\x20%s,\x20%s',_0x3a1b80,_0x4391('0x21'));logger[_0x4391('0x22')](_0x4391('0x23'),_0x3a1b80,_0x4391('0x21'),JSON[_0x4391('0x24')](_0x4cfa6b));if(_0x4cfa6b['error']){if(_0x4cfa6b['error'][_0x4391('0x25')]===0x1f4){logger[_0x4391('0x26')](_0x4391('0x27'),_0x3a1b80,_0x4cfa6b['error'][_0x4391('0x28')]);return _0x15e884(_0x4cfa6b[_0x4391('0x26')][_0x4391('0x28')]);}logger[_0x4391('0x26')]('SmsMessage,\x20%s,\x20%s',_0x3a1b80,_0x4cfa6b[_0x4391('0x26')][_0x4391('0x28')]);return _0x2a79a4(_0x4cfa6b[_0x4391('0x26')][_0x4391('0x28')]);}else{logger[_0x4391('0x20')](_0x4391('0x27'),_0x3a1b80,'request\x20sent');_0x2a79a4(_0x4cfa6b[_0x4391('0x29')][_0x4391('0x28')]);}})[_0x4391('0x2a')](function(_0x333ca6){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3a1b80,_0x333ca6);_0x15e884(_0x333ca6);});});}function respondWithStatusCode(_0x11c859,_0x3aa79f){_0x3aa79f=_0x3aa79f||0xcc;return function(_0x3f2554){if(_0x3f2554){return _0x11c859[_0x4391('0x2b')](_0x3aa79f);}return _0x11c859[_0x4391('0x2c')](_0x3aa79f)['end']();};}function respondWithResult(_0x49860f,_0x4ee253){_0x4ee253=_0x4ee253||0xc8;return function(_0x5a03ee){if(_0x5a03ee){return _0x49860f[_0x4391('0x2c')](_0x4ee253)[_0x4391('0x2d')](_0x5a03ee);}};}function respondWithFilteredResult(_0x471d43,_0x2f7b18){return function(_0x49aa36){if(_0x49aa36){var _0x34059f=typeof _0x2f7b18[_0x4391('0x2e')]===_0x4391('0x2f')&&typeof _0x2f7b18[_0x4391('0x30')]===_0x4391('0x2f');var _0x47b39a=_0x49aa36[_0x4391('0x31')];var _0x3edb24=_0x34059f?0x0:_0x2f7b18[_0x4391('0x2e')];var _0x2b5a06=_0x34059f?_0x49aa36[_0x4391('0x31')]:_0x2f7b18[_0x4391('0x2e')]+_0x2f7b18[_0x4391('0x30')];var _0x1b4f0d;if(_0x2b5a06>=_0x47b39a){_0x2b5a06=_0x47b39a;_0x1b4f0d=0xc8;}else{_0x1b4f0d=0xce;}_0x471d43[_0x4391('0x2c')](_0x1b4f0d);return _0x471d43[_0x4391('0x32')](_0x4391('0x33'),_0x3edb24+'-'+_0x2b5a06+'/'+_0x47b39a)['json'](_0x49aa36);}return null;};}function patchUpdates(_0x46db4c){return function(_0x50bd4c){try{jsonpatch[_0x4391('0x34')](_0x50bd4c,_0x46db4c,!![]);}catch(_0x586940){return BPromise['reject'](_0x586940);}return _0x50bd4c[_0x4391('0x35')]();};}function saveUpdates(_0xf8313b,_0x55eb39){return function(_0x433887){if(_0x433887){return _0x433887[_0x4391('0x36')](_0xf8313b)[_0x4391('0x37')](function(_0x205b8e){return _0x205b8e;});}return null;};}function removeEntity(_0x4afd6c,_0x181a61){return function(_0x48b82f){if(_0x48b82f){return _0x48b82f[_0x4391('0x38')]()['then'](function(){_0x4afd6c[_0x4391('0x2c')](0xcc)[_0x4391('0x39')]();});}};}function handleEntityNotFound(_0x12cea0,_0x3224dc){return function(_0x321aed){if(!_0x321aed){_0x12cea0[_0x4391('0x2b')](0x194);}return _0x321aed;};}function handleError(_0x44f1e2,_0x4235b3){_0x4235b3=_0x4235b3||0x1f4;return function(_0x420fdf){logger[_0x4391('0x26')](_0x420fdf[_0x4391('0x3a')]);if(_0x420fdf[_0x4391('0x3b')]){delete _0x420fdf[_0x4391('0x3b')];}_0x44f1e2[_0x4391('0x2c')](_0x4235b3)[_0x4391('0x3c')](_0x420fdf);};}exports[_0x4391('0x3d')]=function(_0x7f513a,_0x3cac53){var _0x4c2828={},_0x56a914={},_0x7a2723={'count':0x0,'rows':[]};var _0x3c0740=_[_0x4391('0x3e')](db[_0x4391('0x3f')][_0x4391('0x40')],function(_0x1c716c){return{'name':_0x1c716c[_0x4391('0x41')],'type':_0x1c716c[_0x4391('0x42')]['key']};});_0x56a914[_0x4391('0x43')]=_['map'](_0x3c0740,'name');_0x56a914['query']=_['keys'](_0x7f513a[_0x4391('0x44')]);_0x56a914[_0x4391('0x45')]=_[_0x4391('0x46')](_0x56a914[_0x4391('0x43')],_0x56a914['query']);_0x4c2828['attributes']=_[_0x4391('0x46')](_0x56a914['model'],qs[_0x4391('0x47')](_0x7f513a[_0x4391('0x44')][_0x4391('0x47')]));_0x4c2828[_0x4391('0x48')]=_0x4c2828[_0x4391('0x48')][_0x4391('0x49')]?_0x4c2828['attributes']:_0x56a914[_0x4391('0x43')];if(!_0x7f513a[_0x4391('0x44')][_0x4391('0x4a')](_0x4391('0x4b'))){_0x4c2828[_0x4391('0x30')]=qs[_0x4391('0x30')](_0x7f513a[_0x4391('0x44')]['limit']);_0x4c2828[_0x4391('0x2e')]=qs[_0x4391('0x2e')](_0x7f513a[_0x4391('0x44')][_0x4391('0x2e')]);}_0x4c2828[_0x4391('0x4c')]=qs[_0x4391('0x4d')](_0x7f513a[_0x4391('0x44')]['sort']);_0x4c2828[_0x4391('0x4e')]=qs['filters'](_[_0x4391('0x4f')](_0x7f513a[_0x4391('0x44')],_0x56a914[_0x4391('0x45')]),_0x3c0740);if(_0x7f513a[_0x4391('0x44')][_0x4391('0x50')]){_0x4c2828[_0x4391('0x4e')]=_[_0x4391('0x51')](_0x4c2828[_0x4391('0x4e')],{'$or':_[_0x4391('0x3e')](_0x3c0740,function(_0x20859b){if(_0x20859b[_0x4391('0x42')]!==_0x4391('0x52')){var _0x125bd7={};_0x125bd7[_0x20859b['name']]={'$like':'%'+_0x7f513a['query'][_0x4391('0x50')]+'%'};return _0x125bd7;}})});}_0x4c2828=_[_0x4391('0x51')]({},_0x4c2828,_0x7f513a[_0x4391('0x53')]);var _0x3ea728={'where':_0x4c2828[_0x4391('0x4e')]};return db[_0x4391('0x3f')]['count'](_0x3ea728)[_0x4391('0x37')](function(_0x5a47f2){_0x7a2723[_0x4391('0x31')]=_0x5a47f2;if(_0x7f513a['query'][_0x4391('0x54')]){_0x4c2828[_0x4391('0x55')]=[{'all':!![]}];}return db[_0x4391('0x3f')][_0x4391('0x56')](_0x4c2828);})[_0x4391('0x37')](function(_0x3bdeb4){_0x7a2723['rows']=_0x3bdeb4;return _0x7a2723;})[_0x4391('0x37')](respondWithFilteredResult(_0x3cac53,_0x4c2828))[_0x4391('0x2a')](handleError(_0x3cac53,null));};exports[_0x4391('0x57')]=function(_0xf2c6e0,_0x29470e){var _0x118d10={'raw':!![],'where':{'id':_0xf2c6e0[_0x4391('0x58')]['id']}},_0x308b42={};_0x308b42[_0x4391('0x43')]=_[_0x4391('0x59')](db[_0x4391('0x3f')][_0x4391('0x40')]);_0x308b42[_0x4391('0x44')]=_['keys'](_0xf2c6e0[_0x4391('0x44')]);_0x308b42[_0x4391('0x45')]=_[_0x4391('0x46')](_0x308b42['model'],_0x308b42[_0x4391('0x44')]);_0x118d10[_0x4391('0x48')]=_[_0x4391('0x46')](_0x308b42['model'],qs[_0x4391('0x47')](_0xf2c6e0[_0x4391('0x44')]['fields']));_0x118d10[_0x4391('0x48')]=_0x118d10[_0x4391('0x48')][_0x4391('0x49')]?_0x118d10[_0x4391('0x48')]:_0x308b42[_0x4391('0x43')];if(_0xf2c6e0[_0x4391('0x44')][_0x4391('0x54')]){_0x118d10['include']=[{'all':!![]}];}_0x118d10=_[_0x4391('0x51')]({},_0x118d10,_0xf2c6e0[_0x4391('0x53')]);return db[_0x4391('0x3f')][_0x4391('0x5a')](_0x118d10)[_0x4391('0x37')](handleEntityNotFound(_0x29470e,null))['then'](respondWithResult(_0x29470e,null))[_0x4391('0x2a')](handleError(_0x29470e,null));};exports[_0x4391('0x5b')]=function(_0x3edb09,_0x37d701){return db[_0x4391('0x3f')][_0x4391('0x5b')](_0x3edb09['body'],{})[_0x4391('0x37')](respondWithResult(_0x37d701,0xc9))['catch'](handleError(_0x37d701,null));};exports[_0x4391('0x36')]=function(_0x8c206e,_0x51d168){if(_0x8c206e[_0x4391('0x5c')]['id']){delete _0x8c206e[_0x4391('0x5c')]['id'];}return db[_0x4391('0x3f')][_0x4391('0x5a')]({'where':{'id':_0x8c206e[_0x4391('0x58')]['id']}})[_0x4391('0x37')](handleEntityNotFound(_0x51d168,null))[_0x4391('0x37')](saveUpdates(_0x8c206e[_0x4391('0x5c')],null))['then'](respondWithResult(_0x51d168,null))[_0x4391('0x2a')](handleError(_0x51d168,null));};exports[_0x4391('0x38')]=function(_0x258642,_0x2c9025){return db[_0x4391('0x3f')][_0x4391('0x5a')]({'where':{'id':_0x258642[_0x4391('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c9025,null))[_0x4391('0x37')](removeEntity(_0x2c9025,null))[_0x4391('0x2a')](handleError(_0x2c9025,null));};exports[_0x4391('0x5d')]=function(_0x2df7bf,_0x349125){return db[_0x4391('0x3f')]['describe']()[_0x4391('0x37')](respondWithResult(_0x349125,null))[_0x4391('0x2a')](handleError(_0x349125,null));};var interaction_log=require(_0x4391('0x12'))(_0x4391('0x5e'));exports[_0x4391('0x5f')]=function(_0x1fa57e,_0x2cf09b,_0x5801c2){var _0x3f9b7b={'agent':{},'channel':_0x4391('0x60')};if(_0x1fa57e[_0x4391('0x5c')]['id']){delete _0x1fa57e[_0x4391('0x5c')]['id'];}_0x1fa57e[_0x4391('0x5c')][_0x4391('0x61')]=!![];_0x1fa57e[_0x4391('0x5c')][_0x4391('0x62')]=moment()[_0x4391('0x63')](_0x4391('0x64'));_0x1fa57e[_0x4391('0x5c')][_0x4391('0x65')]=_0x1fa57e[_0x4391('0x5c')][_0x4391('0x65')]||_0x1fa57e[_0x4391('0x66')]['id'];_0x3f9b7b['agent']['id']=_0x1fa57e[_0x4391('0x5c')][_0x4391('0x65')];return db[_0x4391('0x3f')][_0x4391('0x5a')]({'where':{'id':_0x1fa57e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2cf09b,null))[_0x4391('0x37')](saveUpdates(_0x1fa57e[_0x4391('0x5c')],null))[_0x4391('0x37')](function(_0x203de3){if(_0x203de3){_0x3f9b7b['message']=_0x203de3[_0x4391('0x67')]({'plain':!![]});return db[_0x4391('0x68')][_0x4391('0x5a')]({'where':{'id':_0x203de3['SmsInteractionId']}});}return null;})[_0x4391('0x37')](handleEntityNotFound(_0x2cf09b,null))[_0x4391('0x37')](function(_0x10bdcf){if(_0x10bdcf){return _0x10bdcf[_0x4391('0x36')]({'UserId':_0x1fa57e['body'][_0x4391('0x65')],'read1stAt':_[_0x4391('0x69')](_0x10bdcf[_0x4391('0x6a')])?moment()[_0x4391('0x63')](_0x4391('0x64')):undefined});}return null;})[_0x4391('0x37')](function(_0x5cd104){if(_0x5cd104){_0x3f9b7b[_0x4391('0x6b')]=_0x5cd104[_0x4391('0x67')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fa57e['user']['id'],_0x1fa57e[_0x4391('0x66')][_0x4391('0x3b')],_0x1fa57e[_0x4391('0x66')][_0x4391('0x6c')],_0x3f9b7b['interaction']['id'],_0x1fa57e[_0x4391('0x5c')]?JSON['stringify'](_0x1fa57e[_0x4391('0x5c')]):'null');return respondWithRpcPromise(_0x4391('0x6d'),_0x4391('0x6e'),_0x3f9b7b);}return null;})[_0x4391('0x37')](function(_0x264751){var _0x1fbf81=_0x4391('0x6f')+_0x264751[_0x4391('0x28')][_0x4391('0x70')];return db['sequelize'][_0x4391('0x44')](_0x1fbf81,{'type':db[_0x4391('0x71')][_0x4391('0x72')][_0x4391('0x73')],'raw':!![]})['then'](function(_0x4b19be){return _0x4b19be;});})[_0x4391('0x37')](function(_0x453a86){if(_0x453a86){_0x3f9b7b[_0x4391('0x28')]['contact']=_0x453a86[0x0];if(!_0x1fa57e[_0x4391('0x5c')][_0x4391('0x65')])return;return db[_0x4391('0x74')][_0x4391('0x5a')]({'where':{'id':_0x1fa57e[_0x4391('0x5c')][_0x4391('0x65')],'role':_0x4391('0x75')},'attributes':['id',_0x4391('0x3b'),_0x4391('0x76'),_0x4391('0x77'),_0x4391('0x78')],'raw':!![]});}return null;})['then'](function(_0x662359){if(!_0x662359)return null;_0x3f9b7b[_0x4391('0x28')][_0x4391('0x75')]=_0x662359;return _0x3f9b7b;})[_0x4391('0x37')](function(_0x1e34e5){if(_0x1e34e5){if(_0x1fa57e[_0x4391('0x5c')][_0x4391('0x79')]){_0x3f9b7b[_0x4391('0x28')][_0x4391('0x7a')]=util[_0x4391('0x63')](_0x4391('0x7b'),_0x1fa57e['user']['name']);_0x3f9b7b[_0x4391('0x28')][_0x4391('0x7c')]=_0x3f9b7b[_0x4391('0x7c')];_0x3f9b7b[_0x4391('0x28')]['motionChannel']=_0x3f9b7b[_0x4391('0x7c')];_0x3f9b7b[_0x4391('0x28')]['event']=_0x4391('0x5f');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x4391('0x7d'),'message':_0x3f9b7b[_0x4391('0x28')]},client9002)[_0x4391('0x37')](function(){return _0x3f9b7b;});}return _0x3f9b7b;}return null;})[_0x4391('0x37')](respondWithResult(_0x2cf09b,null))[_0x4391('0x2a')](handleError(_0x2cf09b,null));};var interaction_log=require(_0x4391('0x12'))('sms-interactions');exports[_0x4391('0x7e')]=function(_0x11cd7a,_0x41c28f,_0x2abade){var _0x1eca50={'agent':{},'channel':_0x4391('0x60')};if(_0x11cd7a[_0x4391('0x5c')]['id']){delete _0x11cd7a[_0x4391('0x5c')]['id'];}_0x11cd7a[_0x4391('0x5c')][_0x4391('0x65')]=_0x11cd7a[_0x4391('0x5c')][_0x4391('0x65')]||_0x11cd7a[_0x4391('0x66')]['id'];_0x1eca50[_0x4391('0x75')]['id']=_0x11cd7a[_0x4391('0x5c')][_0x4391('0x65')];return db[_0x4391('0x3f')][_0x4391('0x5a')]({'where':{'id':_0x11cd7a[_0x4391('0x58')]['id'],'UserId':null}})[_0x4391('0x37')](handleEntityNotFound(_0x41c28f,null))['then'](function(_0x3f2fc8){if(_0x3f2fc8){_0x1eca50['message']=_0x3f2fc8[_0x4391('0x67')]({'plain':!![]});return db[_0x4391('0x68')][_0x4391('0x5a')]({'where':{'id':_0x3f2fc8[_0x4391('0x7f')]}});}return null;})[_0x4391('0x37')](handleEntityNotFound(_0x41c28f,null))[_0x4391('0x37')](function(_0x4d9404){if(_0x4d9404){_0x1eca50[_0x4391('0x6b')]=_0x4d9404[_0x4391('0x67')]({'plain':!![]});interaction_log[_0x4391('0x20')](_0x4391('0x80'),_0x11cd7a['user']['id'],_0x11cd7a[_0x4391('0x66')][_0x4391('0x3b')],_0x11cd7a[_0x4391('0x66')][_0x4391('0x6c')],_0x1eca50[_0x4391('0x6b')]['id'],_0x11cd7a[_0x4391('0x5c')]?JSON[_0x4391('0x24')](_0x11cd7a[_0x4391('0x5c')]):_0x4391('0x81'));return respondWithRpcPromise(_0x4391('0x82'),_0x4391('0x83'),_0x1eca50);}return null;})['then'](function(_0x5a0f79){var _0x3eed4c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a0f79[_0x4391('0x28')][_0x4391('0x70')];return db[_0x4391('0x84')]['query'](_0x3eed4c,{'type':db[_0x4391('0x71')][_0x4391('0x72')][_0x4391('0x73')],'raw':!![]})[_0x4391('0x37')](function(_0xffcefa){return _0xffcefa;});})[_0x4391('0x37')](function(_0x563d9d){if(_0x563d9d){_0x1eca50[_0x4391('0x28')][_0x4391('0x85')]=_0x563d9d[0x0];if(!_0x11cd7a[_0x4391('0x5c')][_0x4391('0x65')])return;return db[_0x4391('0x74')]['find']({'where':{'id':_0x11cd7a[_0x4391('0x5c')]['UserId'],'role':'agent'},'attributes':['id','name',_0x4391('0x76'),_0x4391('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x396574){if(!_0x396574)return null;_0x1eca50[_0x4391('0x28')][_0x4391('0x75')]=_0x396574;return _0x1eca50;})[_0x4391('0x37')](function(_0x12b0fc){if(_0x12b0fc){_0x12b0fc[_0x4391('0x28')]['interface']=util['format'](_0x4391('0x7b'),_0x11cd7a[_0x4391('0x66')][_0x4391('0x3b')]);_0x12b0fc[_0x4391('0x28')][_0x4391('0x7c')]=_0x1eca50[_0x4391('0x7c')];_0x12b0fc[_0x4391('0x28')][_0x4391('0x86')]=_0x1eca50['channel'];_0x12b0fc[_0x4391('0x28')][_0x4391('0x87')]=_0x4391('0x7e');respondWithRpcPromise(_0x4391('0x88'),_0x4391('0x88'),{'event':'rejectmessage','message':_0x12b0fc['message']},client9002);return _0x1eca50;}return null;})[_0x4391('0x37')](respondWithResult(_0x41c28f,null))[_0x4391('0x2a')](handleError(_0x41c28f,null));};exports['status']=function(_0x42ddd4,_0x486dd2,_0x41d7a0){if(_0x42ddd4[_0x4391('0x5c')]['id']){delete _0x42ddd4[_0x4391('0x5c')]['id'];}var _0x4dc403;return db[_0x4391('0x3f')][_0x4391('0x5a')]({'where':{'id':_0x42ddd4[_0x4391('0x58')]['id']}})[_0x4391('0x37')](handleEntityNotFound(_0x486dd2,null))[_0x4391('0x37')](function(_0x19b16a){if(_0x19b16a){_0x4dc403=_0x19b16a;return db[_0x4391('0x89')][_0x4391('0x5a')]({'where':{'id':_0x19b16a[_0x4391('0x8a')]}});}})[_0x4391('0x37')](handleEntityNotFound(_0x486dd2,null))[_0x4391('0x37')](function(_0x5aa2bb){if(_0x5aa2bb){logger[_0x4391('0x22')](_0x4391('0x23'),_0x4391('0x2c'),'received\x20delivery\x20report\x20from',_0x5aa2bb[_0x4391('0x42')],util['inspect'](_0x42ddd4[_0x4391('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5aa2bb['type']){case _0x4391('0x8b'):if(_0x42ddd4['body'][_0x4391('0x8c')]&&_0x42ddd4[_0x4391('0x5c')]['MessageSid']===_0x4dc403[_0x4391('0x8d')]){return _0x4dc403[_0x4391('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4391('0x2c'),_0x4391('0x8b'),util[_0x4391('0x8e')](_0x42ddd4[_0x4391('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4391('0x8f'):if(_0x42ddd4[_0x4391('0x5c')][_0x4391('0x90')]&&_0x42ddd4['body'][_0x4391('0x90')]===_0x4dc403[_0x4391('0x8d')]&&_[_0x4391('0x91')]([_0x4391('0x92'),_0x4391('0x93')],_0x42ddd4[_0x4391('0x5c')][_0x4391('0x94')])>=0x0){return _0x4dc403[_0x4391('0x36')]({'read':!![]});}else{logger[_0x4391('0x26')](_0x4391('0x95'),_0x4391('0x2c'),_0x4391('0x96'),util['inspect'](_0x42ddd4['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4e20d8=_0x42ddd4[_0x4391('0x5c')][_0x4391('0x97')][0x0];if(_0x4e20d8[_0x4391('0x2c')][_0x4391('0x98')]==='DELIVERED'){return _0x4dc403[_0x4391('0x36')]({'read':!![]});}else{logger[_0x4391('0x26')](_0x4391('0x95'),_0x4391('0x2c'),_0x4391('0x99'),util[_0x4391('0x8e')](_0x42ddd4[_0x4391('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4dc403;}})['then'](respondWithResult(_0x486dd2,null))[_0x4391('0x2a')](handleError(_0x486dd2,null));}; \ No newline at end of file +var _0xc177=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','sendStatus','stack','name','send','SmsMessage','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','describe','sms-interactions','accept','sms','read','UserId','user','agent','get','SmsInteraction','SmsInteractionId','update','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','SELECT','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x3975c0,_0x3e8f4c){var _0xe75022=function(_0x3df9f7){while(--_0x3df9f7){_0x3975c0['push'](_0x3975c0['shift']());}};_0xe75022(++_0x3e8f4c);}(_0xc177,0x1b2));var _0x7c17=function(_0x476858,_0x159c4d){_0x476858=_0x476858-0x0;var _0x1109fe=_0xc177[_0x476858];return _0x1109fe;};'use strict';var emlformat=require(_0x7c17('0x0'));var rimraf=require(_0x7c17('0x1'));var zipdir=require(_0x7c17('0x2'));var jsonpatch=require(_0x7c17('0x3'));var rp=require(_0x7c17('0x4'));var moment=require('moment');var BPromise=require(_0x7c17('0x5'));var Mustache=require(_0x7c17('0x6'));var util=require(_0x7c17('0x7'));var path=require(_0x7c17('0x8'));var sox=require('sox');var csv=require(_0x7c17('0x9'));var ejs=require(_0x7c17('0xa'));var fs=require('fs');var fs_extra=require(_0x7c17('0xb'));var _=require('lodash');var squel=require(_0x7c17('0xc'));var crypto=require(_0x7c17('0xd'));var jsforce=require(_0x7c17('0xe'));var deskjs=require(_0x7c17('0xf'));var toCsv=require(_0x7c17('0x9'));var querystring=require(_0x7c17('0x10'));var Papa=require(_0x7c17('0x11'));var Redis=require(_0x7c17('0x12'));var authService=require(_0x7c17('0x13'));var qs=require(_0x7c17('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c17('0x15'));var utils=require(_0x7c17('0x16'));var config=require(_0x7c17('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c17('0x18'))['db'];config[_0x7c17('0x19')]=_[_0x7c17('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7c17('0x1b'))(new Redis(config[_0x7c17('0x19')]));require('./smsMessage.socket')[_0x7c17('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7c17('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x7c17('0x1d')][_0x7c17('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x675894,_0x33f9cc,_0x2f9348,_0x296211){return new BPromise(function(_0x87715a,_0x186812){var _0x37af8c=_0x296211||client;return _0x37af8c[_0x7c17('0x1f')](_0x675894,_0x2f9348)[_0x7c17('0x20')](function(_0x47307a){logger[_0x7c17('0x21')](_0x7c17('0x22'),_0x33f9cc,'request\x20sent');logger[_0x7c17('0x23')](_0x7c17('0x24'),_0x33f9cc,'request\x20sent',JSON[_0x7c17('0x25')](_0x47307a));if(_0x47307a['error']){if(_0x47307a['error'][_0x7c17('0x26')]===0x1f4){logger[_0x7c17('0x27')](_0x7c17('0x22'),_0x33f9cc,_0x47307a['error'][_0x7c17('0x28')]);return _0x186812(_0x47307a[_0x7c17('0x27')]['message']);}logger[_0x7c17('0x27')](_0x7c17('0x22'),_0x33f9cc,_0x47307a[_0x7c17('0x27')]['message']);return _0x87715a(_0x47307a[_0x7c17('0x27')][_0x7c17('0x28')]);}else{logger[_0x7c17('0x21')]('SmsMessage,\x20%s,\x20%s',_0x33f9cc,_0x7c17('0x29'));_0x87715a(_0x47307a[_0x7c17('0x2a')]['message']);}})['catch'](function(_0x42260f){logger[_0x7c17('0x27')](_0x7c17('0x22'),_0x33f9cc,_0x42260f);_0x186812(_0x42260f);});});}function respondWithStatusCode(_0x36b5ed,_0x2b99b3){_0x2b99b3=_0x2b99b3||0xcc;return function(_0x33f63c){if(_0x33f63c){return _0x36b5ed['sendStatus'](_0x2b99b3);}return _0x36b5ed[_0x7c17('0x2b')](_0x2b99b3)[_0x7c17('0x2c')]();};}function respondWithResult(_0x44513e,_0xf2c46c){_0xf2c46c=_0xf2c46c||0xc8;return function(_0x34bd11){if(_0x34bd11){return _0x44513e[_0x7c17('0x2b')](_0xf2c46c)[_0x7c17('0x2d')](_0x34bd11);}};}function respondWithFilteredResult(_0x467bde,_0x3a4a58){return function(_0x3a2e61){if(_0x3a2e61){var _0x4776cc=typeof _0x3a4a58[_0x7c17('0x2e')]===_0x7c17('0x2f')&&typeof _0x3a4a58[_0x7c17('0x30')]===_0x7c17('0x2f');var _0x1caab8=_0x3a2e61['count'];var _0x1378e7=_0x4776cc?0x0:_0x3a4a58[_0x7c17('0x2e')];var _0x4dd018=_0x4776cc?_0x3a2e61[_0x7c17('0x31')]:_0x3a4a58[_0x7c17('0x2e')]+_0x3a4a58[_0x7c17('0x30')];var _0x5760be;if(_0x4dd018>=_0x1caab8){_0x4dd018=_0x1caab8;_0x5760be=0xc8;}else{_0x5760be=0xce;}_0x467bde[_0x7c17('0x2b')](_0x5760be);return _0x467bde['set'](_0x7c17('0x32'),_0x1378e7+'-'+_0x4dd018+'/'+_0x1caab8)[_0x7c17('0x2d')](_0x3a2e61);}return null;};}function patchUpdates(_0x1a1d70){return function(_0x2d982e){try{jsonpatch['apply'](_0x2d982e,_0x1a1d70,!![]);}catch(_0x9d0d1f){return BPromise[_0x7c17('0x33')](_0x9d0d1f);}return _0x2d982e[_0x7c17('0x34')]();};}function saveUpdates(_0xd8eb47,_0x456379){return function(_0x2543d5){if(_0x2543d5){return _0x2543d5['update'](_0xd8eb47)[_0x7c17('0x20')](function(_0xeb50bf){return _0xeb50bf;});}return null;};}function removeEntity(_0x521461,_0x36c445){return function(_0x23beca){if(_0x23beca){return _0x23beca['destroy']()[_0x7c17('0x20')](function(){_0x521461['status'](0xcc)[_0x7c17('0x2c')]();});}};}function handleEntityNotFound(_0x35d249,_0x600877){return function(_0x496c97){if(!_0x496c97){_0x35d249[_0x7c17('0x35')](0x194);}return _0x496c97;};}function handleError(_0x397137,_0x9675fd){_0x9675fd=_0x9675fd||0x1f4;return function(_0x51a040){logger['error'](_0x51a040[_0x7c17('0x36')]);if(_0x51a040['name']){delete _0x51a040[_0x7c17('0x37')];}_0x397137[_0x7c17('0x2b')](_0x9675fd)[_0x7c17('0x38')](_0x51a040);};}exports['index']=function(_0x369c70,_0x124074){var _0xf6cc70={},_0x9cdc10={},_0x40671a={'count':0x0,'rows':[]};var _0x19710c=_['map'](db[_0x7c17('0x39')][_0x7c17('0x3a')],function(_0x328860){return{'name':_0x328860[_0x7c17('0x3b')],'type':_0x328860['type'][_0x7c17('0x3c')]};});_0x9cdc10[_0x7c17('0x3d')]=_['map'](_0x19710c,_0x7c17('0x37'));_0x9cdc10['query']=_['keys'](_0x369c70['query']);_0x9cdc10[_0x7c17('0x3e')]=_[_0x7c17('0x3f')](_0x9cdc10['model'],_0x9cdc10[_0x7c17('0x40')]);_0xf6cc70[_0x7c17('0x41')]=_[_0x7c17('0x3f')](_0x9cdc10[_0x7c17('0x3d')],qs[_0x7c17('0x42')](_0x369c70[_0x7c17('0x40')][_0x7c17('0x42')]));_0xf6cc70['attributes']=_0xf6cc70[_0x7c17('0x41')]['length']?_0xf6cc70[_0x7c17('0x41')]:_0x9cdc10['model'];if(!_0x369c70['query'][_0x7c17('0x43')]('nolimit')){_0xf6cc70[_0x7c17('0x30')]=qs[_0x7c17('0x30')](_0x369c70[_0x7c17('0x40')][_0x7c17('0x30')]);_0xf6cc70[_0x7c17('0x2e')]=qs[_0x7c17('0x2e')](_0x369c70[_0x7c17('0x40')][_0x7c17('0x2e')]);}_0xf6cc70[_0x7c17('0x44')]=qs[_0x7c17('0x45')](_0x369c70[_0x7c17('0x40')][_0x7c17('0x45')]);_0xf6cc70[_0x7c17('0x46')]=qs[_0x7c17('0x3e')](_[_0x7c17('0x47')](_0x369c70['query'],_0x9cdc10[_0x7c17('0x3e')]),_0x19710c);if(_0x369c70['query'][_0x7c17('0x48')]){_0xf6cc70[_0x7c17('0x46')]=_['merge'](_0xf6cc70['where'],{'$or':_['map'](_0x19710c,function(_0x453629){if(_0x453629['type']!=='VIRTUAL'){var _0x32ee4b={};_0x32ee4b[_0x453629[_0x7c17('0x37')]]={'$like':'%'+_0x369c70['query']['filter']+'%'};return _0x32ee4b;}})});}_0xf6cc70=_[_0x7c17('0x49')]({},_0xf6cc70,_0x369c70['options']);var _0x27ae7e={'where':_0xf6cc70[_0x7c17('0x46')]};return db[_0x7c17('0x39')]['count'](_0x27ae7e)[_0x7c17('0x20')](function(_0x2f2b25){_0x40671a[_0x7c17('0x31')]=_0x2f2b25;if(_0x369c70['query'][_0x7c17('0x4a')]){_0xf6cc70[_0x7c17('0x4b')]=[{'all':!![]}];}return db[_0x7c17('0x39')][_0x7c17('0x4c')](_0xf6cc70);})[_0x7c17('0x20')](function(_0x5512e1){_0x40671a[_0x7c17('0x4d')]=_0x5512e1;return _0x40671a;})[_0x7c17('0x20')](respondWithFilteredResult(_0x124074,_0xf6cc70))[_0x7c17('0x4e')](handleError(_0x124074,null));};exports[_0x7c17('0x4f')]=function(_0x644049,_0x3b136f){var _0x471328={'raw':!![],'where':{'id':_0x644049[_0x7c17('0x50')]['id']}},_0x147d4e={};_0x147d4e['model']=_['keys'](db[_0x7c17('0x39')]['rawAttributes']);_0x147d4e[_0x7c17('0x40')]=_['keys'](_0x644049[_0x7c17('0x40')]);_0x147d4e[_0x7c17('0x3e')]=_['intersection'](_0x147d4e['model'],_0x147d4e[_0x7c17('0x40')]);_0x471328[_0x7c17('0x41')]=_[_0x7c17('0x3f')](_0x147d4e['model'],qs[_0x7c17('0x42')](_0x644049[_0x7c17('0x40')][_0x7c17('0x42')]));_0x471328[_0x7c17('0x41')]=_0x471328[_0x7c17('0x41')][_0x7c17('0x51')]?_0x471328['attributes']:_0x147d4e[_0x7c17('0x3d')];if(_0x644049[_0x7c17('0x40')][_0x7c17('0x4a')]){_0x471328[_0x7c17('0x4b')]=[{'all':!![]}];}_0x471328=_[_0x7c17('0x49')]({},_0x471328,_0x644049[_0x7c17('0x52')]);return db[_0x7c17('0x39')]['find'](_0x471328)[_0x7c17('0x20')](handleEntityNotFound(_0x3b136f,null))['then'](respondWithResult(_0x3b136f,null))['catch'](handleError(_0x3b136f,null));};exports[_0x7c17('0x53')]=function(_0x337a28,_0x1b0679){return db[_0x7c17('0x39')][_0x7c17('0x53')](_0x337a28[_0x7c17('0x54')],{})[_0x7c17('0x20')](respondWithResult(_0x1b0679,0xc9))[_0x7c17('0x4e')](handleError(_0x1b0679,null));};exports['update']=function(_0x8d3c79,_0x1090fc){if(_0x8d3c79[_0x7c17('0x54')]['id']){delete _0x8d3c79['body']['id'];}return db[_0x7c17('0x39')][_0x7c17('0x55')]({'where':{'id':_0x8d3c79['params']['id']}})[_0x7c17('0x20')](handleEntityNotFound(_0x1090fc,null))[_0x7c17('0x20')](saveUpdates(_0x8d3c79[_0x7c17('0x54')],null))['then'](respondWithResult(_0x1090fc,null))[_0x7c17('0x4e')](handleError(_0x1090fc,null));};exports[_0x7c17('0x56')]=function(_0x1cedb7,_0xacae9e){return db['SmsMessage'][_0x7c17('0x55')]({'where':{'id':_0x1cedb7[_0x7c17('0x50')]['id']}})[_0x7c17('0x20')](handleEntityNotFound(_0xacae9e,null))[_0x7c17('0x20')](removeEntity(_0xacae9e,null))[_0x7c17('0x4e')](handleError(_0xacae9e,null));};exports[_0x7c17('0x57')]=function(_0x1b3858,_0x2c6bd8){return db[_0x7c17('0x39')][_0x7c17('0x57')]()[_0x7c17('0x20')](respondWithResult(_0x2c6bd8,null))['catch'](handleError(_0x2c6bd8,null));};var interaction_log=require('../../config/logger')(_0x7c17('0x58'));exports[_0x7c17('0x59')]=function(_0x511ffe,_0x373652,_0x26a6d9){var _0x39bfeb={'agent':{},'channel':_0x7c17('0x5a')};if(_0x511ffe['body']['id']){delete _0x511ffe[_0x7c17('0x54')]['id'];}_0x511ffe[_0x7c17('0x54')][_0x7c17('0x5b')]=!![];_0x511ffe[_0x7c17('0x54')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x511ffe['body'][_0x7c17('0x5c')]=_0x511ffe[_0x7c17('0x54')]['UserId']||_0x511ffe[_0x7c17('0x5d')]['id'];_0x39bfeb[_0x7c17('0x5e')]['id']=_0x511ffe['body'][_0x7c17('0x5c')];return db['SmsMessage'][_0x7c17('0x55')]({'where':{'id':_0x511ffe[_0x7c17('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x373652,null))['then'](saveUpdates(_0x511ffe[_0x7c17('0x54')],null))[_0x7c17('0x20')](function(_0x7278ef){if(_0x7278ef){_0x39bfeb[_0x7c17('0x28')]=_0x7278ef[_0x7c17('0x5f')]({'plain':!![]});return db[_0x7c17('0x60')][_0x7c17('0x55')]({'where':{'id':_0x7278ef[_0x7c17('0x61')]}});}return null;})[_0x7c17('0x20')](handleEntityNotFound(_0x373652,null))[_0x7c17('0x20')](function(_0x32af61){if(_0x32af61){return _0x32af61[_0x7c17('0x62')]({'UserId':_0x511ffe[_0x7c17('0x54')][_0x7c17('0x5c')],'read1stAt':_['isNil'](_0x32af61[_0x7c17('0x63')])?moment()['format'](_0x7c17('0x64')):undefined});}return null;})[_0x7c17('0x20')](function(_0x2b6eab){if(_0x2b6eab){_0x39bfeb['interaction']=_0x2b6eab['get']({'plain':!![]});interaction_log[_0x7c17('0x21')](_0x7c17('0x65'),_0x511ffe[_0x7c17('0x5d')]['id'],_0x511ffe[_0x7c17('0x5d')]['name'],_0x511ffe['user'][_0x7c17('0x66')],_0x39bfeb['interaction']['id'],_0x511ffe[_0x7c17('0x54')]?JSON[_0x7c17('0x25')](_0x511ffe['body']):_0x7c17('0x67'));return respondWithRpcPromise(_0x7c17('0x68'),_0x7c17('0x69'),_0x39bfeb);}return null;})[_0x7c17('0x20')](function(_0x1277ca){var _0x5ebd0d=_0x7c17('0x6a')+_0x1277ca[_0x7c17('0x28')][_0x7c17('0x6b')];return db['sequelize'][_0x7c17('0x40')](_0x5ebd0d,{'type':db[_0x7c17('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x7c17('0x20')](function(_0x49b926){return _0x49b926;});})[_0x7c17('0x20')](function(_0x1f84fe){if(_0x1f84fe){_0x39bfeb['message'][_0x7c17('0x6d')]=_0x1f84fe[0x0];if(!_0x511ffe[_0x7c17('0x54')]['UserId'])return;return db[_0x7c17('0x6e')][_0x7c17('0x55')]({'where':{'id':_0x511ffe[_0x7c17('0x54')]['UserId'],'role':_0x7c17('0x5e')},'attributes':['id',_0x7c17('0x37'),_0x7c17('0x6f'),_0x7c17('0x70'),_0x7c17('0x71')],'raw':!![]});}return null;})['then'](function(_0x324e4a){if(!_0x324e4a)return null;_0x39bfeb[_0x7c17('0x28')][_0x7c17('0x5e')]=_0x324e4a;return _0x39bfeb;})[_0x7c17('0x20')](function(_0x345c98){if(_0x345c98){if(_0x511ffe[_0x7c17('0x54')][_0x7c17('0x72')]){_0x39bfeb[_0x7c17('0x28')][_0x7c17('0x73')]=util[_0x7c17('0x74')](_0x7c17('0x75'),_0x511ffe['user'][_0x7c17('0x37')]);_0x39bfeb[_0x7c17('0x28')][_0x7c17('0x76')]=_0x39bfeb['channel'];_0x39bfeb[_0x7c17('0x28')][_0x7c17('0x77')]=_0x39bfeb['channel'];_0x39bfeb[_0x7c17('0x28')][_0x7c17('0x78')]='accept';return respondWithRpcPromise('EventManager',_0x7c17('0x79'),{'event':_0x7c17('0x7a'),'message':_0x39bfeb['message']},client9002)['then'](function(){return _0x39bfeb;});}return _0x39bfeb;}return null;})[_0x7c17('0x20')](respondWithResult(_0x373652,null))['catch'](handleError(_0x373652,null));};var interaction_log=require(_0x7c17('0x7b'))(_0x7c17('0x58'));exports['reject']=function(_0x47dd9b,_0x4027ff,_0x7b24bf){var _0x3208b4={'agent':{},'channel':_0x7c17('0x5a')};if(_0x47dd9b[_0x7c17('0x54')]['id']){delete _0x47dd9b[_0x7c17('0x54')]['id'];}_0x47dd9b[_0x7c17('0x54')][_0x7c17('0x5c')]=_0x47dd9b['body'][_0x7c17('0x5c')]||_0x47dd9b['user']['id'];_0x3208b4[_0x7c17('0x5e')]['id']=_0x47dd9b['body'][_0x7c17('0x5c')];return db[_0x7c17('0x39')][_0x7c17('0x55')]({'where':{'id':_0x47dd9b['params']['id'],'UserId':null}})[_0x7c17('0x20')](handleEntityNotFound(_0x4027ff,null))[_0x7c17('0x20')](function(_0x32dfca){if(_0x32dfca){_0x3208b4[_0x7c17('0x28')]=_0x32dfca[_0x7c17('0x5f')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x32dfca[_0x7c17('0x61')]}});}return null;})[_0x7c17('0x20')](handleEntityNotFound(_0x4027ff,null))[_0x7c17('0x20')](function(_0x3122c6){if(_0x3122c6){_0x3208b4[_0x7c17('0x7c')]=_0x3122c6[_0x7c17('0x5f')]({'plain':!![]});interaction_log[_0x7c17('0x21')](_0x7c17('0x7d'),_0x47dd9b[_0x7c17('0x5d')]['id'],_0x47dd9b[_0x7c17('0x5d')][_0x7c17('0x37')],_0x47dd9b[_0x7c17('0x5d')][_0x7c17('0x66')],_0x3208b4[_0x7c17('0x7c')]['id'],_0x47dd9b[_0x7c17('0x54')]?JSON[_0x7c17('0x25')](_0x47dd9b[_0x7c17('0x54')]):_0x7c17('0x67'));return respondWithRpcPromise('RejectMessage',_0x7c17('0x7e'),_0x3208b4);}return null;})[_0x7c17('0x20')](function(_0x22338b){var _0x2c0a4f=_0x7c17('0x6a')+_0x22338b[_0x7c17('0x28')]['ContactId'];return db[_0x7c17('0x7f')][_0x7c17('0x40')](_0x2c0a4f,{'type':db[_0x7c17('0x6c')]['QueryTypes'][_0x7c17('0x80')],'raw':!![]})[_0x7c17('0x20')](function(_0x25f748){return _0x25f748;});})[_0x7c17('0x20')](function(_0x38676d){if(_0x38676d){_0x3208b4[_0x7c17('0x28')]['contact']=_0x38676d[0x0];if(!_0x47dd9b[_0x7c17('0x54')][_0x7c17('0x5c')])return;return db['User'][_0x7c17('0x55')]({'where':{'id':_0x47dd9b[_0x7c17('0x54')]['UserId'],'role':_0x7c17('0x5e')},'attributes':['id','name',_0x7c17('0x6f'),_0x7c17('0x70'),_0x7c17('0x71')],'raw':!![]});}return null;})['then'](function(_0x5e92d9){if(!_0x5e92d9)return null;_0x3208b4[_0x7c17('0x28')][_0x7c17('0x5e')]=_0x5e92d9;return _0x3208b4;})['then'](function(_0x13f5db){if(_0x13f5db){_0x13f5db[_0x7c17('0x28')][_0x7c17('0x73')]=util[_0x7c17('0x74')](_0x7c17('0x75'),_0x47dd9b['user'][_0x7c17('0x37')]);_0x13f5db[_0x7c17('0x28')][_0x7c17('0x76')]=_0x3208b4[_0x7c17('0x76')];_0x13f5db[_0x7c17('0x28')][_0x7c17('0x77')]=_0x3208b4[_0x7c17('0x76')];_0x13f5db[_0x7c17('0x28')][_0x7c17('0x78')]=_0x7c17('0x33');respondWithRpcPromise(_0x7c17('0x79'),_0x7c17('0x79'),{'event':_0x7c17('0x81'),'message':_0x13f5db[_0x7c17('0x28')]},client9002);return _0x3208b4;}return null;})[_0x7c17('0x20')](respondWithResult(_0x4027ff,null))[_0x7c17('0x4e')](handleError(_0x4027ff,null));};exports[_0x7c17('0x2b')]=function(_0x2d568b,_0x1e1861,_0x250286){if(_0x2d568b[_0x7c17('0x54')]['id']){delete _0x2d568b[_0x7c17('0x54')]['id'];}var _0x430d1a;return db['SmsMessage'][_0x7c17('0x55')]({'where':{'id':_0x2d568b[_0x7c17('0x50')]['id']}})[_0x7c17('0x20')](handleEntityNotFound(_0x1e1861,null))[_0x7c17('0x20')](function(_0x5e7a85){if(_0x5e7a85){_0x430d1a=_0x5e7a85;return db[_0x7c17('0x82')][_0x7c17('0x55')]({'where':{'id':_0x5e7a85[_0x7c17('0x83')]}});}})[_0x7c17('0x20')](handleEntityNotFound(_0x1e1861,null))[_0x7c17('0x20')](function(_0x1c7337){if(_0x1c7337){logger[_0x7c17('0x23')](_0x7c17('0x24'),_0x7c17('0x2b'),_0x7c17('0x84'),_0x1c7337[_0x7c17('0x85')],util[_0x7c17('0x86')](_0x2d568b['body'],{'showHidden':![],'depth':null}));switch(_0x1c7337[_0x7c17('0x85')]){case _0x7c17('0x87'):if(_0x2d568b['body'][_0x7c17('0x88')]&&_0x2d568b[_0x7c17('0x54')][_0x7c17('0x88')]===_0x430d1a[_0x7c17('0x89')]){return _0x430d1a[_0x7c17('0x62')]({'read':!![]});}else{logger[_0x7c17('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c17('0x2b'),_0x7c17('0x87'),util[_0x7c17('0x86')](_0x2d568b['body'],{'showHidden':![],'depth':null}));}break;case _0x7c17('0x8a'):if(_0x2d568b['body'][_0x7c17('0x8b')]&&_0x2d568b[_0x7c17('0x54')][_0x7c17('0x8b')]===_0x430d1a[_0x7c17('0x89')]&&_[_0x7c17('0x8c')]([_0x7c17('0x8d'),_0x7c17('0x8e')],_0x2d568b[_0x7c17('0x54')]['Status'])>=0x0){return _0x430d1a[_0x7c17('0x62')]({'read':!![]});}else{logger['error'](_0x7c17('0x8f'),_0x7c17('0x2b'),_0x7c17('0x90'),util['inspect'](_0x2d568b[_0x7c17('0x54')],{'showHidden':![],'depth':null}));}break;case _0x7c17('0x91'):var _0x5196c3=_0x2d568b[_0x7c17('0x54')][_0x7c17('0x92')][0x0];if(_0x5196c3[_0x7c17('0x2b')]['groupName']===_0x7c17('0x93')){return _0x430d1a[_0x7c17('0x62')]({'read':!![]});}else{logger[_0x7c17('0x27')](_0x7c17('0x8f'),_0x7c17('0x2b'),_0x7c17('0x91'),util['inspect'](_0x2d568b[_0x7c17('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x430d1a;}})[_0x7c17('0x20')](respondWithResult(_0x1e1861,null))['catch'](handleError(_0x1e1861,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e59b51a..682f1ae 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 _0xcbfa=['exports','../../mysqldb','SmsMessage','setMaxListeners','remove','emit'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xcbfa,0x1b1));var _0xacbf=function(_0x19eddf,_0x3b50cf){_0x19eddf=_0x19eddf-0x0;var _0x1c10f6=_0xcbfa[_0x19eddf];return _0x1c10f6;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xacbf('0x0'))['db'][_0xacbf('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xacbf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xacbf('0x3')};function emitEvent(_0x18df72){return function(_0x263902,_0x5b7f90,_0x4ed21c){SmsMessageEvents['emit'](_0x18df72+':'+_0x263902['id'],_0x263902);SmsMessageEvents[_0xacbf('0x4')](_0x18df72,_0x263902);_0x4ed21c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xacbf('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x888d=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x484b38,_0x501278){var _0x1e8a55=function(_0x2a23c1){while(--_0x2a23c1){_0x484b38['push'](_0x484b38['shift']());}};_0x1e8a55(++_0x501278);}(_0x888d,0xf2));var _0xd888=function(_0x2096cd,_0x4fba4d){_0x2096cd=_0x2096cd-0x0;var _0x415d57=_0x888d[_0x2096cd];return _0x415d57;};'use strict';var EventEmitter=require(_0xd888('0x0'));var SmsMessage=require(_0xd888('0x1'))['db'][_0xd888('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd888('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd888('0x4'),'afterDestroy':_0xd888('0x5')};function emitEvent(_0x4c86bd){return function(_0x4f4251,_0x8e7ac3,_0x11d961){SmsMessageEvents[_0xd888('0x6')](_0x4c86bd+':'+_0x4f4251['id'],_0x4f4251);SmsMessageEvents[_0xd888('0x6')](_0x4c86bd,_0x4f4251);_0x11d961(null);};}for(var e in events){if(events[_0xd888('0x7')](e)){var event=events[e];SmsMessage[_0xd888('0x8')](e,emitEvent(event));}}module[_0xd888('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 924bb8a..ba754bd 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 _0xfb43=['accountSid','authToken','phone','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','error','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','split','sms','POST','user_key','session_key','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','keys','sort','createHash','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','find','SmsAccountId','type','twilio'];(function(_0x528a68,_0x23e0ad){var _0x3b81cf=function(_0x29a11d){while(--_0x29a11d){_0x528a68['push'](_0x528a68['shift']());}};_0x3b81cf(++_0x23e0ad);}(_0xfb43,0x145));var _0x3fb4=function(_0x5d6157,_0x1a5557){_0x5d6157=_0x5d6157-0x0;var _0x179133=_0xfb43[_0x5d6157];return _0x179133;};'use strict';var _=require(_0x3fb4('0x0'));var util=require(_0x3fb4('0x1'));var logger=require(_0x3fb4('0x2'))(_0x3fb4('0x3'));var moment=require(_0x3fb4('0x4'));var BPromise=require(_0x3fb4('0x5'));var rp=require(_0x3fb4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fb4('0x7'));var config=require(_0x3fb4('0x8'));var attributes=require(_0x3fb4('0x9'));module[_0x3fb4('0xa')]=function(_0x215d4f,_0x2a83b0){return _0x215d4f[_0x3fb4('0xb')](_0x3fb4('0xc'),attributes,{'tableName':_0x3fb4('0xd'),'paranoid':![],'indexes':[{'name':_0x3fb4('0xe'),'fields':[_0x3fb4('0xe')]},{'name':_0x3fb4('0xf'),'fields':[_0x3fb4('0x10')],'type':_0x3fb4('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28af77,_0x11937f,_0x2da929){var _0x81b06a=_0x215d4f['models'];var _0x1e4dcd=_0x28af77[_0x3fb4('0x12')]({'plain':!![]});if(_0x1e4dcd[_0x3fb4('0x13')]['toLowerCase']()==='in'||_0x1e4dcd[_0x3fb4('0x13')][_0x3fb4('0x14')]()===_0x3fb4('0x15')&&!_0x1e4dcd[_0x3fb4('0x16')]&&!_[_0x3fb4('0x17')](_0x1e4dcd[_0x3fb4('0x18')])&&!_['isNil'](_0x1e4dcd['SmsInteractionId'])){_0x81b06a[_0x3fb4('0x19')][_0x3fb4('0x1a')]({'where':{'id':_0x1e4dcd[_0x3fb4('0x1b')]}})[_0x3fb4('0x1c')](function(_0x506de0){if(_0x506de0){_0x506de0[_0x3fb4('0x1d')]({'lastMsgAt':_0x1e4dcd['createdAt'],'lastMsgDirection':_0x1e4dcd[_0x3fb4('0x13')][_0x3fb4('0x14')]()});}})[_0x3fb4('0x1e')](function(_0x30c266){console['error'](_0x30c266);});}if(_0x1e4dcd['direction']===_0x3fb4('0x15')&&!_0x1e4dcd['secret']){var _0x12e4e4;_0x81b06a['SmsAccount'][_0x3fb4('0x1f')]({'where':{'id':_0x1e4dcd[_0x3fb4('0x20')]},'raw':!![]})[_0x3fb4('0x1c')](function(_0x173fcd){_0x12e4e4=_0x173fcd;if(_0x12e4e4&&_0x12e4e4['type']){switch(_0x12e4e4[_0x3fb4('0x21')]){case _0x3fb4('0x22'):var _0x2235ab=require(_0x3fb4('0x22'));if(_0x12e4e4[_0x3fb4('0x23')]&&_0x12e4e4[_0x3fb4('0x24')]&&_0x12e4e4[_0x3fb4('0x25')]){var _0x479f7b=new _0x2235ab(_0x12e4e4['accountSid'],_0x12e4e4[_0x3fb4('0x24')]);_0x479f7b['messages'][_0x3fb4('0x26')]({'body':_0x1e4dcd[_0x3fb4('0x10')],'to':_0x1e4dcd[_0x3fb4('0x25')],'from':_0x12e4e4[_0x3fb4('0x25')],'statusCallback':_0x12e4e4[_0x3fb4('0x27')]+_0x3fb4('0x28')+_0x1e4dcd['id']+'/status?token='+_0x12e4e4[_0x3fb4('0x29')]})[_0x3fb4('0x1c')](function(_0x37d8f4){if(_0x37d8f4[_0x3fb4('0x2a')]){return _0x28af77[_0x3fb4('0x1d')]({'messageId':_0x37d8f4[_0x3fb4('0x2a')]});}})['catch'](function(_0x33d53f){logger['error'](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x22'),util[_0x3fb4('0x2c')](_0x33d53f,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x22'),_0x3fb4('0x2f'));}break;case _0x3fb4('0x30'):var _0x1b7144=_0x3fb4('0x31');if(_0x12e4e4[_0x3fb4('0x32')]&&_0x12e4e4['password']){var _0x171ed5={'recipient':[_0x1e4dcd[_0x3fb4('0x25')]],'message':_0x1e4dcd[_0x3fb4('0x10')],'message_type':_0x12e4e4[_0x3fb4('0x33')]};if(_0x12e4e4['smsMethod']&&_0x12e4e4[_0x3fb4('0x33')]!=='SI'){_0x171ed5[_0x3fb4('0x34')]=_0x12e4e4[_0x3fb4('0x25')];}var _0x38a6ed={'url':_0x1b7144+_0x3fb4('0x35')+_0x12e4e4[_0x3fb4('0x32')]+_0x3fb4('0x36')+_0x12e4e4[_0x3fb4('0x37')],'method':'GET'};rp(_0x38a6ed)[_0x3fb4('0x1c')](function(_0x563125){var _0x50ffad=_0x563125[_0x3fb4('0x38')](';');var _0x1531be={'user_key':_0x50ffad[0x0],'session_key':_0x50ffad[0x1]};_0x38a6ed={'url':_0x1b7144+_0x3fb4('0x39'),'method':_0x3fb4('0x3a'),'headers':{'user_key':_0x1531be[_0x3fb4('0x3b')],'Session_key':_0x1531be[_0x3fb4('0x3c')]},'json':!![],'body':_0x171ed5};return rp(_0x38a6ed);})['then'](function(_0x394e65){if(_0x394e65['total_sent']>=0x1){var _0x96dffd={'messageId':_0x394e65['internal_order_id']};if(_0x12e4e4[_0x3fb4('0x33')]!=='GP'||!_0x12e4e4[_0x3fb4('0x3d')]){_0x96dffd[_0x3fb4('0x3e')]=!![];}return _0x28af77[_0x3fb4('0x1d')](_0x96dffd);}else{return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),'afterCreate','skebby',util[_0x3fb4('0x2c')](_0x394e65,{'showHidden':![],'depth':null}));}})[_0x3fb4('0x1e')](function(_0x58fdaf){return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x30'),util['inspect'](_0x58fdaf,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x30'),_0x3fb4('0x3f'));}break;case _0x3fb4('0x40'):if(_0x12e4e4['authToken']){var _0x1c60ec={'recipient':_0x1e4dcd[_0x3fb4('0x25')],'message':_0x1e4dcd[_0x3fb4('0x10')],'sender':_0x12e4e4[_0x3fb4('0x41')]||_0x12e4e4[_0x3fb4('0x25')],'authorization':_0x12e4e4[_0x3fb4('0x24')]};var _0x11937f={'method':'POST','uri':_0x3fb4('0x42'),'body':_0x1c60ec,'json':!![]};rp(_0x11937f)[_0x3fb4('0x1c')](function(_0x5d25f8){var _0x34b564={'messageId':_0x5d25f8['requestid']};if(!_0x12e4e4[_0x3fb4('0x3d')]){_0x34b564[_0x3fb4('0x3e')]=!![];}return _0x28af77[_0x3fb4('0x1d')](_0x34b564);})['catch'](function(_0x3b1822){logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),'connectel',util[_0x3fb4('0x2c')](_0x3b1822,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3fb4('0x2b'),_0x3fb4('0x2e'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x12e4e4[_0x3fb4('0x32')]&&_0x12e4e4[_0x3fb4('0x37')]){var _0x1c60ec={'messages':[{'source':_0x3fb4('0x43'),'to':_0x1e4dcd[_0x3fb4('0x25')],'body':_0x1e4dcd[_0x3fb4('0x10')],'from':_0x12e4e4[_0x3fb4('0x41')]||_0x12e4e4['phone']}]};var _0x51abbb=util[_0x3fb4('0x44')](_0x3fb4('0x45'),_0x12e4e4[_0x3fb4('0x32')],_0x12e4e4[_0x3fb4('0x37')]);var _0x11937f={'method':_0x3fb4('0x3a'),'uri':_0x3fb4('0x46'),'body':_0x1c60ec,'headers':{'Authorization':util[_0x3fb4('0x44')](_0x3fb4('0x47'),new Buffer(_0x51abbb)[_0x3fb4('0x48')]('base64'))},'json':!![]};rp(_0x11937f)[_0x3fb4('0x1c')](function(_0x24c243){if(_0x24c243[_0x3fb4('0x49')]>=0xc8&&_0x24c243['http_code']<=0xce){if(_0x24c243[_0x3fb4('0x4a')]&&_0x24c243[_0x3fb4('0x4a')][_0x3fb4('0x4b')]>0x0){var _0x1924d3=_[_0x3fb4('0x4c')](_0x24c243['data'][_0x3fb4('0x4d')]);var _0x1a211e={'messageId':_0x1924d3[_0x3fb4('0x4e')]};if(!_0x12e4e4['deliveryReport']){_0x1a211e[_0x3fb4('0x3e')]=!![];}return _0x28af77[_0x3fb4('0x1d')](_0x1a211e);}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x4f'),util[_0x3fb4('0x2c')](_0x24c243,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fb4('0x2e'),_0x3fb4('0x4f'),util[_0x3fb4('0x2c')](_0x24c243,{'showHidden':![],'depth':null}));}})[_0x3fb4('0x1e')](function(_0xe0e30e){logger[_0x3fb4('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0xe0e30e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x4f'),_0x3fb4('0x3f'));}break;case _0x3fb4('0x50'):if(_0x12e4e4[_0x3fb4('0x51')]&&_0x12e4e4[_0x3fb4('0x24')]){var _0x1c60ec={'dst':_0x1e4dcd[_0x3fb4('0x25')],'text':_0x1e4dcd['body'],'src':_0x12e4e4[_0x3fb4('0x41')]||_0x12e4e4[_0x3fb4('0x25')],'url':_0x12e4e4[_0x3fb4('0x27')]+_0x3fb4('0x28')+_0x1e4dcd['id']+_0x3fb4('0x52')+_0x12e4e4['token']};var _0x51abbb=util[_0x3fb4('0x44')](_0x3fb4('0x45'),_0x12e4e4[_0x3fb4('0x51')],_0x12e4e4[_0x3fb4('0x24')]);var _0x11937f={'method':_0x3fb4('0x3a'),'uri':util[_0x3fb4('0x44')](_0x3fb4('0x53'),_0x12e4e4[_0x3fb4('0x51')]),'body':_0x1c60ec,'headers':{'Authorization':util[_0x3fb4('0x44')](_0x3fb4('0x47'),new Buffer(_0x51abbb)['toString'](_0x3fb4('0x54')))},'json':!![]};rp(_0x11937f)['then'](function(_0xa0ff8b){var _0x34d275={'messageId':_0xa0ff8b['message_uuid'][0x0]};return _0x28af77[_0x3fb4('0x1d')](_0x34d275);})['catch'](function(_0x16f1f1){logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x50'),util[_0x3fb4('0x2c')](_0x16f1f1,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x3fb4('0x55'):if(_0x12e4e4[_0x3fb4('0x32')]&&_0x12e4e4['password']){if(_0x12e4e4[_0x3fb4('0x56')]){var _0x13cfa9={'method':_0x3fb4('0x3a'),'uri':_0x12e4e4['baseUrl']+_0x3fb4('0x57'),'body':{'username':_0x12e4e4[_0x3fb4('0x32')],'password':_0x12e4e4[_0x3fb4('0x37')]},'json':!![]};return rp(_0x13cfa9)[_0x3fb4('0x1c')](function(_0x31467e){var _0x4d29f2={'method':'POST','uri':_0x12e4e4[_0x3fb4('0x56')]+_0x3fb4('0x58'),'body':{'messages':[{'from':_0x12e4e4[_0x3fb4('0x25')],'destinations':[{'to':_0x1e4dcd[_0x3fb4('0x25')]}],'text':_0x1e4dcd[_0x3fb4('0x10')],'notifyUrl':_0x12e4e4[_0x3fb4('0x27')]+_0x3fb4('0x28')+_0x1e4dcd['id']+_0x3fb4('0x52')+_0x12e4e4['token'],'notifyContentType':_0x3fb4('0x59'),'callbackData':_0x12e4e4[_0x3fb4('0x25')]+';'+_0x1e4dcd['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x31467e['token']},'json':!![]};return rp(_0x4d29f2)[_0x3fb4('0x1c')](function(_0x3e6324){if(_0x3e6324[_0x3fb4('0x4d')]){var _0x10d670={'messageId':_0x3e6324[_0x3fb4('0x4d')][0x0][_0x3fb4('0xe')]};if(!_0x12e4e4['deliveryReport']){_0x10d670[_0x3fb4('0x3e')]=!![];}return _0x28af77['update'](_0x10d670);}else{return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x55'),util[_0x3fb4('0x2c')](_0x3e6324,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x28e026){return logger['error'](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x55'),util[_0x3fb4('0x2c')](_0x28e026,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x55'),_0x3fb4('0x5a'));}}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3fb4('0x5b'):var _0x2d3bf3=require(_0x3fb4('0x5c'));if(_0x12e4e4[_0x3fb4('0x5d')]){var _0x5aeca8={};_0x5aeca8['login']=_0x12e4e4[_0x3fb4('0x32')];_0x5aeca8['phone']=_0x1e4dcd[_0x3fb4('0x25')];_0x5aeca8[_0x3fb4('0x34')]=_0x12e4e4[_0x3fb4('0x25')];_0x5aeca8['text']=_0x1e4dcd[_0x3fb4('0x10')];_0x5aeca8[_0x3fb4('0x5e')]=+new Date();var _0x3ba7a6='';var _0x3da4cc='';var _0x2f5f94=Object[_0x3fb4('0x5f')](_0x5aeca8);_0x2f5f94[_0x3fb4('0x60')]();for(var _0x460e63=0x0;_0x460e63<_0x2f5f94['length'];_0x460e63++){if(_0x3ba7a6!=''){_0x3ba7a6+='&';}_0x3ba7a6+=_0x2f5f94[_0x460e63]+'='+encodeURIComponent(_0x5aeca8[_0x2f5f94[_0x460e63]]);_0x3da4cc+=_0x5aeca8[_0x2f5f94[_0x460e63]];}_0x3da4cc+=_0x12e4e4['apiKey'];_0x3da4cc=_0x2d3bf3[_0x3fb4('0x61')]('md5')[_0x3fb4('0x1d')](_0x3da4cc)['digest'](_0x3fb4('0x62'));if(_0x3ba7a6!==''){_0x3ba7a6+='&';}_0x3ba7a6+='signature='+_0x3da4cc;var _0x38a6ed={'method':_0x3fb4('0x63'),'uri':_0x12e4e4[_0x3fb4('0x56')]+_0x3fb4('0x64')+_0x3ba7a6,'json':!![]};return rp(_0x38a6ed)[_0x3fb4('0x1c')](function(_0x524748){var _0x59e4f9=Object[_0x3fb4('0x5f')](_0x524748);if(_0x524748[_0x59e4f9[0x0]][_0x3fb4('0x2d')]&&parseInt(_0x524748[_0x59e4f9[0x0]][_0x3fb4('0x2d')])===0x0){var _0x28936b={'messageId':_0x524748[_0x59e4f9[0x0]][_0x3fb4('0x65')]};if(!_0x12e4e4[_0x3fb4('0x3d')]){_0x28936b[_0x3fb4('0x3e')]=!![];}return _0x28af77[_0x3fb4('0x1d')](_0x28936b);}else{return logger['error'](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x5b'),util[_0x3fb4('0x2c')](_0x524748[_0x3fb4('0x2d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x742067){return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x5b'),util[_0x3fb4('0x2c')](_0x742067,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x5b'),_0x3fb4('0x66'));}break;case _0x3fb4('0x67'):if(_0x12e4e4[_0x3fb4('0x5d')]){var _0x1e3d43={'method':'POST','uri':_0x3fb4('0x68'),'headers':{'Authorization':_0x12e4e4[_0x3fb4('0x5d')]},'body':{'content':_0x1e4dcd[_0x3fb4('0x10')],'to':[_0x1e4dcd[_0x3fb4('0x25')]],'from':_0x12e4e4[_0x3fb4('0x25')],'binary':![],'clientMessageId':_0x3fb4('0x69'),'charset':_0x3fb4('0x6a')},'json':!![]};rp(_0x1e3d43)[_0x3fb4('0x1c')](function(_0x479d84){if(!_0x479d84[_0x3fb4('0x2d')]){var _0xe04692={'messageId':_0x479d84['messages'][0x0][_0x3fb4('0x6b')]};if(!_0x12e4e4[_0x3fb4('0x3d')]){_0xe04692[_0x3fb4('0x3e')]=!![];}return _0x28af77['update'](_0xe04692);}else{return logger['error'](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x67'),util[_0x3fb4('0x2c')](_0x479d84[_0x3fb4('0x2d')],{'showHidden':![],'depth':null}));}})[_0x3fb4('0x1e')](function(_0x47d7a3){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fb4('0x2e'),_0x3fb4('0x67'),util['inspect'](_0x47d7a3,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),'clickatell',_0x3fb4('0x66'));}break;case'bandwidth':if(_0x12e4e4[_0x3fb4('0x32')]&&_0x12e4e4['password']){var _0x51abbb=util[_0x3fb4('0x44')](_0x3fb4('0x45'),_0x12e4e4[_0x3fb4('0x32')],_0x12e4e4[_0x3fb4('0x37')]);var _0x11937f={'method':_0x3fb4('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x12e4e4[_0x3fb4('0x6c')]+_0x3fb4('0x6d'),'body':{'to':[_0x1e4dcd['phone']],'text':_0x1e4dcd['body'],'from':_0x12e4e4[_0x3fb4('0x25')],'applicationId':_0x12e4e4[_0x3fb4('0x6e')]},'headers':{'Authorization':util[_0x3fb4('0x44')]('Basic\x20%s',new Buffer(_0x51abbb)[_0x3fb4('0x48')](_0x3fb4('0x54')))},'json':!![]};rp(_0x11937f)['then'](function(_0x3e59b0){if(_0x3e59b0['id']){var _0x4afc70={'messageId':_0x3e59b0['id']};return _0x28af77[_0x3fb4('0x1d')](_0x4afc70);}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x6f'),util['inspect'](_0x3e59b0,{'showHidden':![],'depth':null}));}})[_0x3fb4('0x1e')](function(_0x1199c9){logger['error'](_0x3fb4('0x2b'),'afterCreate',_0x3fb4('0x6f'),util[_0x3fb4('0x2c')](_0x1199c9,{'showHidden':![],'depth':null}));});}else{logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x6f'),_0x3fb4('0x3f'));}break;case _0x3fb4('0x70'):if(_0x12e4e4['apiKey']){var _0x1dd4c3={};var _0x38a6ed={'method':_0x3fb4('0x3a'),'uri':_0x3fb4('0x71'),'headers':{'Authorization':_0x3fb4('0x72')+_0x12e4e4[_0x3fb4('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x12e4e4['phone'],'to':_0x1e4dcd['phone'],'text':_0x1e4dcd['body']},'json':!![]};return rp(_0x38a6ed)[_0x3fb4('0x1c')](function(_0x59ab59){if(_0x59ab59['code']==0xca){_0x1dd4c3[_0x3fb4('0x73')]=_0x59ab59;var _0x224410={'method':_0x3fb4('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3fb4('0x72')+_0x12e4e4['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x1dd4c3[_0x3fb4('0x73')][_0x3fb4('0x74')]},'json':!![]};return rp(_0x224410)[_0x3fb4('0x1c')](function(_0x22bfd5){_0x1dd4c3[_0x3fb4('0x75')]=_0x22bfd5;var _0x187c51={'messageId':_0x1dd4c3[_0x3fb4('0x73')][_0x3fb4('0x74')],'read':!![]};return _0x28af77[_0x3fb4('0x1d')](_0x187c51);});}else{return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x70'),util[_0x3fb4('0x2c')](_0x59ab59,{'showHidden':![],'depth':null}));}})[_0x3fb4('0x1e')](function(_0x4f7bef){return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x70'),util['inspect'](_0x4f7bef,{'showHidden':![],'depth':null}));});}else{return logger[_0x3fb4('0x2d')](_0x3fb4('0x2b'),_0x3fb4('0x2e'),_0x3fb4('0x70'),'Token\x20not\x20received');}break;}}})[_0x3fb4('0x76')](function(){_0x2da929();});}else{_0x2da929();}}},'charset':'utf8mb4','collate':_0x3fb4('0x77')});}; \ No newline at end of file +var _0x7b72=['code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/status?token=','token','then','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','sender','&password=','GET','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','/api/sms/messages/','message_uuid','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','Bearer\x20'];(function(_0x1d4521,_0x339b0d){var _0x557ff2=function(_0x538e1f){while(--_0x538e1f){_0x1d4521['push'](_0x1d4521['shift']());}};_0x557ff2(++_0x339b0d);}(_0x7b72,0x1ea));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27b7('0x0'))(_0x27b7('0x1'));var moment=require(_0x27b7('0x2'));var BPromise=require(_0x27b7('0x3'));var rp=require(_0x27b7('0x4'));var fs=require('fs');var path=require(_0x27b7('0x5'));var rimraf=require(_0x27b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x27b7('0x7'));module['exports']=function(_0x4cc543,_0x7dd28d){return _0x4cc543[_0x27b7('0x8')](_0x27b7('0x9'),attributes,{'tableName':_0x27b7('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x27b7('0xb'),'fields':['body'],'type':_0x27b7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cfde8,_0x4e495a,_0xd33c4d){var _0x29ad5a=_0x4cc543[_0x27b7('0xd')];var _0x28abfe=_0x5cfde8[_0x27b7('0xe')]({'plain':!![]});if(_0x28abfe[_0x27b7('0xf')][_0x27b7('0x10')]()==='in'||_0x28abfe[_0x27b7('0xf')][_0x27b7('0x10')]()===_0x27b7('0x11')&&!_0x28abfe[_0x27b7('0x12')]&&!_['isNil'](_0x28abfe[_0x27b7('0x13')])&&!_['isNil'](_0x28abfe[_0x27b7('0x14')])){_0x29ad5a[_0x27b7('0x15')][_0x27b7('0x16')]({'where':{'id':_0x28abfe[_0x27b7('0x14')]}})['then'](function(_0x42529d){if(_0x42529d){_0x42529d['update']({'lastMsgAt':_0x28abfe[_0x27b7('0x17')],'lastMsgDirection':_0x28abfe['direction'][_0x27b7('0x10')]()});}})[_0x27b7('0x18')](function(_0x397893){console[_0x27b7('0x19')](_0x397893);});}if(_0x28abfe[_0x27b7('0xf')]===_0x27b7('0x11')&&!_0x28abfe[_0x27b7('0x12')]){var _0x8ba19b;_0x29ad5a[_0x27b7('0x1a')][_0x27b7('0x1b')]({'where':{'id':_0x28abfe[_0x27b7('0x1c')]},'raw':!![]})['then'](function(_0x40281a){_0x8ba19b=_0x40281a;if(_0x8ba19b&&_0x8ba19b[_0x27b7('0x1d')]){switch(_0x8ba19b[_0x27b7('0x1d')]){case'twilio':var _0xc785a9=require(_0x27b7('0x1e'));if(_0x8ba19b[_0x27b7('0x1f')]&&_0x8ba19b[_0x27b7('0x20')]&&_0x8ba19b['phone']){var _0x434d99=new _0xc785a9(_0x8ba19b[_0x27b7('0x1f')],_0x8ba19b[_0x27b7('0x20')]);_0x434d99[_0x27b7('0x21')][_0x27b7('0x22')]({'body':_0x28abfe[_0x27b7('0x23')],'to':_0x28abfe[_0x27b7('0x24')],'from':_0x8ba19b['phone'],'statusCallback':_0x8ba19b[_0x27b7('0x25')]+'/api/sms/messages/'+_0x28abfe['id']+_0x27b7('0x26')+_0x8ba19b[_0x27b7('0x27')]})[_0x27b7('0x28')](function(_0xdf4ca4){if(_0xdf4ca4[_0x27b7('0x29')]){return _0x5cfde8[_0x27b7('0x2a')]({'messageId':_0xdf4ca4[_0x27b7('0x29')]});}})[_0x27b7('0x18')](function(_0x1bf51d){logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),'twilio',util[_0x27b7('0x2d')](_0x1bf51d,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x27b7('0x1e'),_0x27b7('0x2e'));}break;case'skebby':var _0x4bc3df='https://api.skebby.it/API/v1.0/REST/';if(_0x8ba19b[_0x27b7('0x2f')]&&_0x8ba19b['password']){var _0x5751ec={'recipient':[_0x28abfe[_0x27b7('0x24')]],'message':_0x28abfe[_0x27b7('0x23')],'message_type':_0x8ba19b[_0x27b7('0x30')]};if(_0x8ba19b[_0x27b7('0x30')]&&_0x8ba19b['smsMethod']!=='SI'){_0x5751ec[_0x27b7('0x31')]=_0x8ba19b[_0x27b7('0x24')];}var _0x502f0c={'url':_0x4bc3df+'login?username='+_0x8ba19b['username']+_0x27b7('0x32')+_0x8ba19b['password'],'method':_0x27b7('0x33')};rp(_0x502f0c)['then'](function(_0x437d91){var _0x39359c=_0x437d91['split'](';');var _0x509183={'user_key':_0x39359c[0x0],'session_key':_0x39359c[0x1]};_0x502f0c={'url':_0x4bc3df+_0x27b7('0x34'),'method':_0x27b7('0x35'),'headers':{'user_key':_0x509183['user_key'],'Session_key':_0x509183[_0x27b7('0x36')]},'json':!![],'body':_0x5751ec};return rp(_0x502f0c);})[_0x27b7('0x28')](function(_0x368c7f){if(_0x368c7f[_0x27b7('0x37')]>=0x1){var _0x5d4eef={'messageId':_0x368c7f[_0x27b7('0x38')]};if(_0x8ba19b['smsMethod']!=='GP'||!_0x8ba19b[_0x27b7('0x39')]){_0x5d4eef[_0x27b7('0x3a')]=!![];}return _0x5cfde8['update'](_0x5d4eef);}else{return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x3b'),util['inspect'](_0x368c7f,{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x5b1000){return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x3b'),util[_0x27b7('0x2d')](_0x5b1000,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x3b'),_0x27b7('0x3c'));}break;case _0x27b7('0x3d'):if(_0x8ba19b[_0x27b7('0x20')]){var _0x30ef97={'recipient':_0x28abfe[_0x27b7('0x24')],'message':_0x28abfe[_0x27b7('0x23')],'sender':_0x8ba19b[_0x27b7('0x3e')]||_0x8ba19b[_0x27b7('0x24')],'authorization':_0x8ba19b[_0x27b7('0x20')]};var _0x4e495a={'method':_0x27b7('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x30ef97,'json':!![]};rp(_0x4e495a)[_0x27b7('0x28')](function(_0x55b4fb){var _0x1e26de={'messageId':_0x55b4fb[_0x27b7('0x3f')]};if(!_0x8ba19b[_0x27b7('0x39')]){_0x1e26de[_0x27b7('0x3a')]=!![];}return _0x5cfde8['update'](_0x1e26de);})[_0x27b7('0x18')](function(_0x4916aa){logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x3d'),util[_0x27b7('0x2d')](_0x4916aa,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),'afterCreate',_0x27b7('0x3d'),_0x27b7('0x40'));}break;case _0x27b7('0x41'):if(_0x8ba19b[_0x27b7('0x2f')]&&_0x8ba19b[_0x27b7('0x42')]){var _0x30ef97={'messages':[{'source':_0x27b7('0x43'),'to':_0x28abfe[_0x27b7('0x24')],'body':_0x28abfe[_0x27b7('0x23')],'from':_0x8ba19b['senderString']||_0x8ba19b[_0x27b7('0x24')]}]};var _0x53b961=util[_0x27b7('0x44')](_0x27b7('0x45'),_0x8ba19b[_0x27b7('0x2f')],_0x8ba19b[_0x27b7('0x42')]);var _0x4e495a={'method':_0x27b7('0x35'),'uri':_0x27b7('0x46'),'body':_0x30ef97,'headers':{'Authorization':util[_0x27b7('0x44')](_0x27b7('0x47'),new Buffer(_0x53b961)[_0x27b7('0x48')](_0x27b7('0x49')))},'json':!![]};rp(_0x4e495a)[_0x27b7('0x28')](function(_0x46d509){if(_0x46d509[_0x27b7('0x4a')]>=0xc8&&_0x46d509[_0x27b7('0x4a')]<=0xce){if(_0x46d509['data']&&_0x46d509['data']['queued_count']>0x0){var _0x3d6751=_[_0x27b7('0x4b')](_0x46d509[_0x27b7('0x4c')][_0x27b7('0x21')]);var _0xa64ca7={'messageId':_0x3d6751[_0x27b7('0x4d')]};if(!_0x8ba19b[_0x27b7('0x39')]){_0xa64ca7[_0x27b7('0x3a')]=!![];}return _0x5cfde8[_0x27b7('0x2a')](_0xa64ca7);}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x4e'),util['inspect'](_0x46d509,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x4e'),util[_0x27b7('0x2d')](_0x46d509,{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x304e28){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x27b7('0x4e'),util['inspect'](_0x304e28,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x4e'),_0x27b7('0x3c'));}break;case _0x27b7('0x4f'):if(_0x8ba19b[_0x27b7('0x50')]&&_0x8ba19b[_0x27b7('0x20')]){var _0x30ef97={'dst':_0x28abfe[_0x27b7('0x24')],'text':_0x28abfe[_0x27b7('0x23')],'src':_0x8ba19b[_0x27b7('0x3e')]||_0x8ba19b[_0x27b7('0x24')],'url':_0x8ba19b[_0x27b7('0x25')]+_0x27b7('0x51')+_0x28abfe['id']+_0x27b7('0x26')+_0x8ba19b['token']};var _0x53b961=util[_0x27b7('0x44')](_0x27b7('0x45'),_0x8ba19b[_0x27b7('0x50')],_0x8ba19b[_0x27b7('0x20')]);var _0x4e495a={'method':_0x27b7('0x35'),'uri':util[_0x27b7('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x8ba19b[_0x27b7('0x50')]),'body':_0x30ef97,'headers':{'Authorization':util['format'](_0x27b7('0x47'),new Buffer(_0x53b961)[_0x27b7('0x48')](_0x27b7('0x49')))},'json':!![]};rp(_0x4e495a)[_0x27b7('0x28')](function(_0x581660){var _0x2dafb5={'messageId':_0x581660[_0x27b7('0x52')][0x0]};return _0x5cfde8['update'](_0x2dafb5);})[_0x27b7('0x18')](function(_0x135ff6){logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x4f'),util[_0x27b7('0x2d')](_0x135ff6,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x27b7('0x53'):if(_0x8ba19b[_0x27b7('0x2f')]&&_0x8ba19b['password']){if(_0x8ba19b[_0x27b7('0x54')]){var _0x1ed3af={'method':_0x27b7('0x35'),'uri':_0x8ba19b[_0x27b7('0x54')]+'/auth/1/session','body':{'username':_0x8ba19b[_0x27b7('0x2f')],'password':_0x8ba19b['password']},'json':!![]};return rp(_0x1ed3af)['then'](function(_0x415120){var _0x3f17a2={'method':'POST','uri':_0x8ba19b[_0x27b7('0x54')]+_0x27b7('0x55'),'body':{'messages':[{'from':_0x8ba19b[_0x27b7('0x24')],'destinations':[{'to':_0x28abfe[_0x27b7('0x24')]}],'text':_0x28abfe[_0x27b7('0x23')],'notifyUrl':_0x8ba19b[_0x27b7('0x25')]+_0x27b7('0x51')+_0x28abfe['id']+'/status?token='+_0x8ba19b[_0x27b7('0x27')],'notifyContentType':_0x27b7('0x56'),'callbackData':_0x8ba19b['phone']+';'+_0x28abfe[_0x27b7('0x23')]}]},'headers':{'Authorization':_0x27b7('0x57')+_0x415120[_0x27b7('0x27')]},'json':!![]};return rp(_0x3f17a2)[_0x27b7('0x28')](function(_0x3822dc){if(_0x3822dc[_0x27b7('0x21')]){var _0x4aaca2={'messageId':_0x3822dc[_0x27b7('0x21')][0x0]['messageId']};if(!_0x8ba19b[_0x27b7('0x39')]){_0x4aaca2['read']=!![];}return _0x5cfde8[_0x27b7('0x2a')](_0x4aaca2);}else{return logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x53'),util[_0x27b7('0x2d')](_0x3822dc,{'showHidden':![],'depth':null}));}});})[_0x27b7('0x18')](function(_0x3796a0){return logger['error'](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x53'),util[_0x27b7('0x2d')](_0x3796a0,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x53'),_0x27b7('0x58'));}}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x53'),_0x27b7('0x3c'));}break;case _0x27b7('0x59'):var _0x439f00=require(_0x27b7('0x5a'));if(_0x8ba19b[_0x27b7('0x5b')]){var _0x20911c={};_0x20911c[_0x27b7('0x5c')]=_0x8ba19b['username'];_0x20911c[_0x27b7('0x24')]=_0x28abfe['phone'];_0x20911c['sender']=_0x8ba19b[_0x27b7('0x24')];_0x20911c[_0x27b7('0x5d')]=_0x28abfe[_0x27b7('0x23')];_0x20911c[_0x27b7('0x5e')]=+new Date();var _0xacb623='';var _0x27bbea='';var _0x5d3a1f=Object[_0x27b7('0x5f')](_0x20911c);_0x5d3a1f[_0x27b7('0x60')]();for(var _0x43a9c4=0x0;_0x43a9c4<_0x5d3a1f[_0x27b7('0x61')];_0x43a9c4++){if(_0xacb623!=''){_0xacb623+='&';}_0xacb623+=_0x5d3a1f[_0x43a9c4]+'='+encodeURIComponent(_0x20911c[_0x5d3a1f[_0x43a9c4]]);_0x27bbea+=_0x20911c[_0x5d3a1f[_0x43a9c4]];}_0x27bbea+=_0x8ba19b[_0x27b7('0x5b')];_0x27bbea=_0x439f00[_0x27b7('0x62')](_0x27b7('0x63'))[_0x27b7('0x2a')](_0x27bbea)[_0x27b7('0x64')](_0x27b7('0x65'));if(_0xacb623!==''){_0xacb623+='&';}_0xacb623+=_0x27b7('0x66')+_0x27bbea;var _0x502f0c={'method':_0x27b7('0x33'),'uri':_0x8ba19b[_0x27b7('0x54')]+_0x27b7('0x67')+_0xacb623,'json':!![]};return rp(_0x502f0c)[_0x27b7('0x28')](function(_0x5a02c0){var _0x1324c4=Object[_0x27b7('0x5f')](_0x5a02c0);if(_0x5a02c0[_0x1324c4[0x0]]['error']&&parseInt(_0x5a02c0[_0x1324c4[0x0]]['error'])===0x0){var _0x3ca04a={'messageId':_0x5a02c0[_0x1324c4[0x0]][_0x27b7('0x68')]};if(!_0x8ba19b[_0x27b7('0x39')]){_0x3ca04a[_0x27b7('0x3a')]=!![];}return _0x5cfde8[_0x27b7('0x2a')](_0x3ca04a);}else{return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),'csc',util['inspect'](_0x5a02c0[_0x27b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x9d269d){return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x59'),util['inspect'](_0x9d269d,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x27b7('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x27b7('0x69'):if(_0x8ba19b['apiKey']){var _0x4378d5={'method':_0x27b7('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x8ba19b[_0x27b7('0x5b')]},'body':{'content':_0x28abfe['body'],'to':[_0x28abfe[_0x27b7('0x24')]],'from':_0x8ba19b['phone'],'binary':![],'clientMessageId':_0x27b7('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x4378d5)[_0x27b7('0x28')](function(_0x51416c){if(!_0x51416c[_0x27b7('0x19')]){var _0x1dc639={'messageId':_0x51416c[_0x27b7('0x21')][0x0][_0x27b7('0x6b')]};if(!_0x8ba19b[_0x27b7('0x39')]){_0x1dc639['read']=!![];}return _0x5cfde8[_0x27b7('0x2a')](_0x1dc639);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),_0x27b7('0x69'),util[_0x27b7('0x2d')](_0x51416c[_0x27b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x3104da){return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x27b7('0x2d')](_0x3104da,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b7('0x2c'),'clickatell',_0x27b7('0x6c'));}break;case _0x27b7('0x6d'):if(_0x8ba19b[_0x27b7('0x2f')]&&_0x8ba19b[_0x27b7('0x42')]){var _0x53b961=util[_0x27b7('0x44')]('%s:%s',_0x8ba19b[_0x27b7('0x2f')],_0x8ba19b[_0x27b7('0x42')]);var _0x4e495a={'method':'POST','uri':_0x27b7('0x6e')+_0x8ba19b['accountId']+_0x27b7('0x6f'),'body':{'to':[_0x28abfe['phone']],'text':_0x28abfe[_0x27b7('0x23')],'from':_0x8ba19b[_0x27b7('0x24')],'applicationId':_0x8ba19b[_0x27b7('0x70')]},'headers':{'Authorization':util[_0x27b7('0x44')](_0x27b7('0x47'),new Buffer(_0x53b961)[_0x27b7('0x48')]('base64'))},'json':!![]};rp(_0x4e495a)[_0x27b7('0x28')](function(_0x864fb4){if(_0x864fb4['id']){var _0x321c05={'messageId':_0x864fb4['id']};return _0x5cfde8[_0x27b7('0x2a')](_0x321c05);}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x6d'),util[_0x27b7('0x2d')](_0x864fb4,{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x1df71d){logger[_0x27b7('0x19')](_0x27b7('0x2b'),'afterCreate',_0x27b7('0x6d'),util[_0x27b7('0x2d')](_0x1df71d,{'showHidden':![],'depth':null}));});}else{logger[_0x27b7('0x19')](_0x27b7('0x2b'),'afterCreate',_0x27b7('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x27b7('0x71'):if(_0x8ba19b[_0x27b7('0x5b')]){var _0x6d50f3={};var _0x502f0c={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x27b7('0x72')+_0x8ba19b[_0x27b7('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x8ba19b[_0x27b7('0x24')],'to':_0x28abfe[_0x27b7('0x24')],'text':_0x28abfe[_0x27b7('0x23')]},'json':!![]};return rp(_0x502f0c)[_0x27b7('0x28')](function(_0x452486){if(_0x452486[_0x27b7('0x73')]==0xca){_0x6d50f3[_0x27b7('0x74')]=_0x452486;var _0x320c0a={'method':_0x27b7('0x35'),'uri':_0x27b7('0x75'),'headers':{'Authorization':_0x27b7('0x72')+_0x8ba19b[_0x27b7('0x5b')],'Content-Type':_0x27b7('0x56')},'body':{'refid':_0x6d50f3[_0x27b7('0x74')]['refid']},'json':!![]};return rp(_0x320c0a)['then'](function(_0x1df650){_0x6d50f3[_0x27b7('0x76')]=_0x1df650;var _0x23e630={'messageId':_0x6d50f3[_0x27b7('0x74')]['refid'],'read':!![]};return _0x5cfde8['update'](_0x23e630);});}else{return logger[_0x27b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x27b7('0x71'),util[_0x27b7('0x2d')](_0x452486,{'showHidden':![],'depth':null}));}})[_0x27b7('0x18')](function(_0x390583){return logger[_0x27b7('0x19')](_0x27b7('0x2b'),_0x27b7('0x2c'),_0x27b7('0x71'),util[_0x27b7('0x2d')](_0x390583,{'showHidden':![],'depth':null}));});}else{return logger[_0x27b7('0x19')](_0x27b7('0x2b'),'afterCreate',_0x27b7('0x71'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0xd33c4d();});}else{_0xd33c4d();}}},'charset':_0x27b7('0x77'),'collate':_0x27b7('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e10eac8..c719a54 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 _0x7ccd=['message','result','catch','CreateSmsMessage','create','body','options','raw','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7ccd,0x101));var _0xd7cc=function(_0x53d32c,_0x4c5c10){_0x53d32c=_0x53d32c-0x0;var _0x1d5311=_0x7ccd[_0x53d32c];return _0x1d5311;};'use strict';var _=require('lodash');var util=require(_0xd7cc('0x0'));var moment=require('moment');var BPromise=require(_0xd7cc('0x1'));var rs=require(_0xd7cc('0x2'));var fs=require('fs');var Redis=require(_0xd7cc('0x3'));var db=require(_0xd7cc('0x4'))['db'];var utils=require(_0xd7cc('0x5'));var logger=require(_0xd7cc('0x6'))('rpc');var config=require(_0xd7cc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7cc('0x8')]({'port':0x232a});config[_0xd7cc('0x9')]=_[_0xd7cc('0xa')](config['redis'],{'host':_0xd7cc('0xb'),'port':0x18eb});var socket=require(_0xd7cc('0xc'))(new Redis(config['redis']));require(_0xd7cc('0xd'))[_0xd7cc('0xe')](socket);function respondWithRpcPromise(_0x528237,_0x409a5,_0x51f563){return new BPromise(function(_0x1c95a2,_0x350fb9){return client['request'](_0x528237,_0x51f563)[_0xd7cc('0xf')](function(_0x276aec){logger[_0xd7cc('0x10')]('SmsMessage,\x20%s,\x20%s',_0x409a5,_0xd7cc('0x11'));logger['debug'](_0xd7cc('0x12'),_0x409a5,_0xd7cc('0x11'),JSON[_0xd7cc('0x13')](_0x276aec));if(_0x276aec['error']){if(_0x276aec[_0xd7cc('0x14')]['code']===0x1f4){logger[_0xd7cc('0x14')](_0xd7cc('0x15'),_0x409a5,_0x276aec[_0xd7cc('0x14')][_0xd7cc('0x16')]);return _0x350fb9(_0x276aec[_0xd7cc('0x14')]['message']);}logger[_0xd7cc('0x14')](_0xd7cc('0x15'),_0x409a5,_0x276aec['error'][_0xd7cc('0x16')]);return _0x1c95a2(_0x276aec['error'][_0xd7cc('0x16')]);}else{logger['info'](_0xd7cc('0x15'),_0x409a5,'request\x20sent');_0x1c95a2(_0x276aec[_0xd7cc('0x17')][_0xd7cc('0x16')]);}})[_0xd7cc('0x18')](function(_0x22afab){logger[_0xd7cc('0x14')](_0xd7cc('0x15'),_0x409a5,_0x22afab);_0x350fb9(_0x22afab);});});}exports[_0xd7cc('0x19')]=function(_0x32d8fe){var _0x52ff97=this;return new Promise(function(_0xbe2781,_0x552207){return db['SmsMessage'][_0xd7cc('0x1a')](_0x32d8fe[_0xd7cc('0x1b')],{'raw':_0x32d8fe[_0xd7cc('0x1c')]?_0x32d8fe[_0xd7cc('0x1c')][_0xd7cc('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x420b05){logger[_0xd7cc('0x10')]('CreateSmsMessage',_0x32d8fe);logger[_0xd7cc('0x1e')](_0xd7cc('0x19'),_0x32d8fe,JSON[_0xd7cc('0x13')](_0x420b05));_0xbe2781(_0x420b05);})[_0xd7cc('0x18')](function(_0x11501d){logger[_0xd7cc('0x14')]('CreateSmsMessage',_0x11501d[_0xd7cc('0x16')],_0x32d8fe);_0x552207(_0x52ff97[_0xd7cc('0x14')](0x1f4,_0x11501d['message']));});});}; \ No newline at end of file +var _0x94f0=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','create','body','options','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug'];(function(_0x3a8b69,_0x5c9fe2){var _0x17897c=function(_0x3e5b40){while(--_0x3e5b40){_0x3a8b69['push'](_0x3a8b69['shift']());}};_0x17897c(++_0x5c9fe2);}(_0x94f0,0x1a5));var _0x094f=function(_0x35335f,_0x472815){_0x35335f=_0x35335f-0x0;var _0x27068d=_0x94f0[_0x35335f];return _0x27068d;};'use strict';var _=require('lodash');var util=require(_0x094f('0x0'));var moment=require(_0x094f('0x1'));var BPromise=require(_0x094f('0x2'));var rs=require(_0x094f('0x3'));var fs=require('fs');var Redis=require(_0x094f('0x4'));var db=require(_0x094f('0x5'))['db'];var utils=require(_0x094f('0x6'));var logger=require(_0x094f('0x7'))(_0x094f('0x8'));var config=require(_0x094f('0x9'));var jayson=require(_0x094f('0xa'));var client=jayson['client'][_0x094f('0xb')]({'port':0x232a});config[_0x094f('0xc')]=_[_0x094f('0xd')](config[_0x094f('0xc')],{'host':_0x094f('0xe'),'port':0x18eb});var socket=require(_0x094f('0xf'))(new Redis(config[_0x094f('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3132a6,_0x3d7e5d,_0x29805a){return new BPromise(function(_0x5aeacd,_0x9410ed){return client[_0x094f('0x10')](_0x3132a6,_0x29805a)[_0x094f('0x11')](function(_0x30d6ba){logger[_0x094f('0x12')]('SmsMessage,\x20%s,\x20%s',_0x3d7e5d,_0x094f('0x13'));logger[_0x094f('0x14')](_0x094f('0x15'),_0x3d7e5d,_0x094f('0x13'),JSON[_0x094f('0x16')](_0x30d6ba));if(_0x30d6ba[_0x094f('0x17')]){if(_0x30d6ba[_0x094f('0x17')][_0x094f('0x18')]===0x1f4){logger[_0x094f('0x17')](_0x094f('0x19'),_0x3d7e5d,_0x30d6ba[_0x094f('0x17')][_0x094f('0x1a')]);return _0x9410ed(_0x30d6ba[_0x094f('0x17')][_0x094f('0x1a')]);}logger[_0x094f('0x17')](_0x094f('0x19'),_0x3d7e5d,_0x30d6ba[_0x094f('0x17')][_0x094f('0x1a')]);return _0x5aeacd(_0x30d6ba[_0x094f('0x17')][_0x094f('0x1a')]);}else{logger[_0x094f('0x12')]('SmsMessage,\x20%s,\x20%s',_0x3d7e5d,_0x094f('0x13'));_0x5aeacd(_0x30d6ba[_0x094f('0x1b')][_0x094f('0x1a')]);}})['catch'](function(_0x299002){logger[_0x094f('0x17')](_0x094f('0x19'),_0x3d7e5d,_0x299002);_0x9410ed(_0x299002);});});}exports[_0x094f('0x1c')]=function(_0x24c8be){var _0x3e409a=this;return new Promise(function(_0x1deecb,_0x3be334){return db[_0x094f('0x1d')][_0x094f('0x1e')](_0x24c8be[_0x094f('0x1f')],{'raw':_0x24c8be[_0x094f('0x20')]?_0x24c8be['options']['raw']===undefined?!![]:![]:!![]})[_0x094f('0x11')](function(_0x190026){logger['info'](_0x094f('0x1c'),_0x24c8be);logger['debug'](_0x094f('0x1c'),_0x24c8be,JSON[_0x094f('0x16')](_0x190026));_0x1deecb(_0x190026);})[_0x094f('0x21')](function(_0x173441){logger[_0x094f('0x17')](_0x094f('0x1c'),_0x173441[_0x094f('0x1a')],_0x24c8be);_0x3be334(_0x3e409a[_0x094f('0x17')](0x1f4,_0x173441[_0x094f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d985393..179c105 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 _0x904c=['register','length','smsMessage:','save','remove','update','emit','removeListener'];(function(_0x405a55,_0x1c0b7c){var _0x5259cf=function(_0x29bf6d){while(--_0x29bf6d){_0x405a55['push'](_0x405a55['shift']());}};_0x5259cf(++_0x1c0b7c);}(_0x904c,0x15b));var _0xc904=function(_0x290208,_0x5ba234){_0x290208=_0x290208-0x0;var _0x3d7aec=_0x904c[_0x290208];return _0x3d7aec;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xc904('0x0'),_0xc904('0x1'),_0xc904('0x2')];function createListener(_0x223228,_0x47768d){return function(_0x2cb58a){_0x47768d[_0xc904('0x3')](_0x223228,_0x2cb58a);};}function removeListener(_0x203dbd,_0x389276){return function(){SmsMessageEvents[_0xc904('0x4')](_0x203dbd,_0x389276);};}exports[_0xc904('0x5')]=function(_0x4be63d){for(var _0xd7ef93=0x0,_0x14390a=events[_0xc904('0x6')];_0xd7ef93<_0x14390a;_0xd7ef93++){var _0x111ac5=events[_0xd7ef93];var _0x570f9e=createListener(_0xc904('0x7')+_0x111ac5,_0x4be63d);SmsMessageEvents['on'](_0x111ac5,_0x570f9e);}}; \ No newline at end of file +var _0x0573=['removeListener','register','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x0573,0x1db));var _0x3057=function(_0xf0402b,_0x48c1ff){_0xf0402b=_0xf0402b-0x0;var _0x28ea11=_0x0573[_0xf0402b];return _0x28ea11;};'use strict';var SmsMessageEvents=require(_0x3057('0x0'));var events=[_0x3057('0x1'),_0x3057('0x2'),_0x3057('0x3')];function createListener(_0x57ffad,_0x4c09b8){return function(_0x536946){_0x4c09b8[_0x3057('0x4')](_0x57ffad,_0x536946);};}function removeListener(_0x56ab28,_0x1889eb){return function(){SmsMessageEvents[_0x3057('0x5')](_0x56ab28,_0x1889eb);};}exports[_0x3057('0x6')]=function(_0x2dfb8c){for(var _0x27b918=0x0,_0x4c93d3=events['length'];_0x27b918<_0x4c93d3;_0x27b918++){var _0x20bb46=events[_0x27b918];var _0x3320bf=createListener(_0x3057('0x7')+_0x20bb46,_0x2dfb8c);SmsMessageEvents['on'](_0x20bb46,_0x3320bf);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 863881d..b3e6adf 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 _0x8234=['post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents'];(function(_0x4425ed,_0x3f129e){var _0x13005e=function(_0x5d75a0){while(--_0x5d75a0){_0x4425ed['push'](_0x4425ed['shift']());}};_0x13005e(++_0x3f129e);}(_0x8234,0x1ac));var _0x4823=function(_0x493696,_0x1c1d41){_0x493696=_0x493696-0x0;var _0x3c4e2a=_0x8234[_0x493696];return _0x3c4e2a;};'use strict';var multer=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var path=require('path');var timeout=require(_0x4823('0x2'));var express=require(_0x4823('0x3'));var router=express[_0x4823('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4823('0x5'));var interaction=require(_0x4823('0x6'));var config=require(_0x4823('0x7'));var controller=require(_0x4823('0x8'));router[_0x4823('0x9')]('/',auth[_0x4823('0xa')](),controller[_0x4823('0xb')]);router[_0x4823('0x9')](_0x4823('0xc'),auth[_0x4823('0xa')](),controller[_0x4823('0xd')]);router[_0x4823('0x9')](_0x4823('0xe'),auth[_0x4823('0xa')](),controller[_0x4823('0xf')]);router[_0x4823('0x9')](_0x4823('0x10'),auth[_0x4823('0xa')](),controller[_0x4823('0x11')]);router[_0x4823('0x9')]('/:id/teams',auth[_0x4823('0xa')](),controller['getTeams']);router[_0x4823('0x9')](_0x4823('0x12'),auth[_0x4823('0xa')](),controller[_0x4823('0x13')]);router[_0x4823('0x14')]('/',auth['isAuthenticated'](),controller[_0x4823('0x15')]);router[_0x4823('0x14')](_0x4823('0x16'),auth[_0x4823('0xa')](),controller[_0x4823('0x17')]);router['post'](_0x4823('0x12'),auth['isAuthenticated'](),controller[_0x4823('0x18')]);router[_0x4823('0x19')](_0x4823('0xe'),auth[_0x4823('0xa')](),controller[_0x4823('0x1a')]);router[_0x4823('0x1b')](_0x4823('0xe'),auth[_0x4823('0xa')](),controller[_0x4823('0x1c')]);router[_0x4823('0x1b')](_0x4823('0x16'),auth['isAuthenticated'](),controller[_0x4823('0x1d')]);router[_0x4823('0x1b')](_0x4823('0x12'),auth[_0x4823('0xa')](),controller[_0x4823('0x1e')]);module[_0x4823('0x1f')]=router; \ No newline at end of file +var _0xfb33=['../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get','isAuthenticated','describe','show','getMembers','/:id/teams','getTeams','create','addTeams','post','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0xfb33,0x19d));var _0x3fb3=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xfb33[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x3fb3('0x0'));var util=require(_0x3fb3('0x1'));var path=require(_0x3fb3('0x2'));var timeout=require(_0x3fb3('0x3'));var express=require(_0x3fb3('0x4'));var router=express['Router']();var fs_extra=require(_0x3fb3('0x5'));var auth=require(_0x3fb3('0x6'));var interaction=require(_0x3fb3('0x7'));var config=require(_0x3fb3('0x8'));var controller=require(_0x3fb3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3fb3('0xa')]);router[_0x3fb3('0xb')]('/describe',auth[_0x3fb3('0xc')](),controller[_0x3fb3('0xd')]);router[_0x3fb3('0xb')]('/:id',auth[_0x3fb3('0xc')](),controller[_0x3fb3('0xe')]);router[_0x3fb3('0xb')]('/:id/members',auth[_0x3fb3('0xc')](),controller[_0x3fb3('0xf')]);router[_0x3fb3('0xb')](_0x3fb3('0x10'),auth[_0x3fb3('0xc')](),controller[_0x3fb3('0x11')]);router[_0x3fb3('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x3fb3('0xc')](),controller[_0x3fb3('0x12')]);router['post']('/:id/teams',auth[_0x3fb3('0xc')](),controller[_0x3fb3('0x13')]);router[_0x3fb3('0x14')](_0x3fb3('0x15'),auth[_0x3fb3('0xc')](),controller[_0x3fb3('0x16')]);router[_0x3fb3('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x3fb3('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3fb3('0x19')](_0x3fb3('0x10'),auth[_0x3fb3('0xc')](),controller['removeTeams']);router[_0x3fb3('0x19')](_0x3fb3('0x15'),auth['isAuthenticated'](),controller[_0x3fb3('0x1a')]);module[_0x3fb3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 04f57d3..165d2b5 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 _0x9947=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x9947,0xe0));var _0x7994=function(_0x1159f5,_0x4335a0){_0x1159f5=_0x1159f5-0x0;var _0x1ccf27=_0x9947[_0x1159f5];return _0x1ccf27;};'use strict';var Sequelize=require(_0x7994('0x0'));module['exports']={'name':{'type':Sequelize[_0x7994('0x1')],'unique':_0x7994('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7994('0x1')]},'timeout':{'type':Sequelize[_0x7994('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7994('0x4')](_0x7994('0x5'),_0x7994('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x9f85=['exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9f85,0x8a));var _0x59f8=function(_0x142e05,_0x1a871f){_0x142e05=_0x142e05-0x0;var _0x4ba176=_0x9f85[_0x142e05];return _0x4ba176;};'use strict';var Sequelize=require('sequelize');module[_0x59f8('0x0')]={'name':{'type':Sequelize[_0x59f8('0x1')],'unique':_0x59f8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x59f8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x59f8('0x4')](_0x59f8('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c893939..a0fda6e 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 _0x58b8=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','value','transaction','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type'];(function(_0x1635cb,_0x161733){var _0x5d12b8=function(_0x103418){while(--_0x103418){_0x1635cb['push'](_0x1635cb['shift']());}};_0x5d12b8(++_0x161733);}(_0x58b8,0x1eb));var _0x858b=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0x58b8[_0x134448];return _0x2d52a1;};'use strict';var emlformat=require(_0x858b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x858b('0x1'));var jsonpatch=require(_0x858b('0x2'));var rp=require(_0x858b('0x3'));var moment=require('moment');var BPromise=require(_0x858b('0x4'));var Mustache=require(_0x858b('0x5'));var util=require('util');var path=require(_0x858b('0x6'));var sox=require(_0x858b('0x7'));var csv=require(_0x858b('0x8'));var ejs=require(_0x858b('0x9'));var fs=require('fs');var fs_extra=require(_0x858b('0xa'));var _=require(_0x858b('0xb'));var squel=require('squel');var crypto=require(_0x858b('0xc'));var jsforce=require(_0x858b('0xd'));var deskjs=require(_0x858b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x858b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x858b('0x10'));var as=require(_0x858b('0x11'));var hardwareService=require(_0x858b('0x12'));var logger=require('../../config/logger')(_0x858b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x858b('0x14')]=_['defaults'](config[_0x858b('0x14')],{'host':_0x858b('0x15'),'port':0x18eb});var socket=require(_0x858b('0x16'))(new Redis(config[_0x858b('0x14')]));require('./smsQueue.socket')[_0x858b('0x17')](socket);function respondWithStatusCode(_0x451afc,_0x3d7efd){_0x3d7efd=_0x3d7efd||0xcc;return function(_0x1cf7c9){if(_0x1cf7c9){return _0x451afc[_0x858b('0x18')](_0x3d7efd);}return _0x451afc[_0x858b('0x19')](_0x3d7efd)['end']();};}function respondWithResult(_0x509d14,_0x1d0612){_0x1d0612=_0x1d0612||0xc8;return function(_0x342bee){if(_0x342bee){return _0x509d14[_0x858b('0x19')](_0x1d0612)[_0x858b('0x1a')](_0x342bee);}};}function respondWithFilteredResult(_0x2848f3,_0x4b98d6){return function(_0x5015c6){if(_0x5015c6){var _0x5689f0=typeof _0x4b98d6['offset']==='undefined'&&typeof _0x4b98d6['limit']===_0x858b('0x1b');var _0x3db2ee=_0x5015c6[_0x858b('0x1c')];var _0x11e173=_0x5689f0?0x0:_0x4b98d6[_0x858b('0x1d')];var _0x19d0ea=_0x5689f0?_0x5015c6[_0x858b('0x1c')]:_0x4b98d6[_0x858b('0x1d')]+_0x4b98d6[_0x858b('0x1e')];var _0x54814d;if(_0x19d0ea>=_0x3db2ee){_0x19d0ea=_0x3db2ee;_0x54814d=0xc8;}else{_0x54814d=0xce;}_0x2848f3['status'](_0x54814d);return _0x2848f3[_0x858b('0x1f')](_0x858b('0x20'),_0x11e173+'-'+_0x19d0ea+'/'+_0x3db2ee)[_0x858b('0x1a')](_0x5015c6);}return null;};}function patchUpdates(_0x5dbec1){return function(_0x3abca2){try{jsonpatch[_0x858b('0x21')](_0x3abca2,_0x5dbec1,!![]);}catch(_0x324af0){return BPromise['reject'](_0x324af0);}return _0x3abca2[_0x858b('0x22')]();};}function saveUpdates(_0x436a10,_0x1c432b){return function(_0x234c89){if(_0x234c89){return _0x234c89[_0x858b('0x23')](_0x436a10)[_0x858b('0x24')](function(_0x1e24ec){return _0x1e24ec;});}return null;};}function removeEntity(_0x4b57b2,_0xf780a){return function(_0x52dc92){if(_0x52dc92){return _0x52dc92[_0x858b('0x25')]()[_0x858b('0x24')](function(){var _0x4c9695=_0x52dc92[_0x858b('0x26')]({'plain':!![]});var _0x3fc57f='SmsQueues';return db[_0x858b('0x27')][_0x858b('0x25')]({'where':{'type':_0x3fc57f,'resourceId':_0x4c9695['id']}})[_0x858b('0x24')](function(){return _0x52dc92;});})[_0x858b('0x24')](function(){_0x4b57b2[_0x858b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495e8c,_0x333847){return function(_0x59ba4f){if(!_0x59ba4f){_0x495e8c[_0x858b('0x18')](0x194);}return _0x59ba4f;};}function handleError(_0x23c595,_0x48c0e0){_0x48c0e0=_0x48c0e0||0x1f4;return function(_0x5a783c){logger[_0x858b('0x28')](_0x5a783c[_0x858b('0x29')]);if(_0x5a783c[_0x858b('0x2a')]){delete _0x5a783c[_0x858b('0x2a')];}_0x23c595[_0x858b('0x19')](_0x48c0e0)[_0x858b('0x2b')](_0x5a783c);};}exports['index']=function(_0x3fa3a7,_0x4f63e1){var _0x2948b3={},_0x3bc86a={},_0x1504b0={'count':0x0,'rows':[]};var _0x45d594=_[_0x858b('0x2c')](db[_0x858b('0x2d')][_0x858b('0x2e')],function(_0x357851){return{'name':_0x357851[_0x858b('0x2f')],'type':_0x357851[_0x858b('0x30')][_0x858b('0x31')]};});_0x3bc86a[_0x858b('0x32')]=_['map'](_0x45d594,'name');_0x3bc86a[_0x858b('0x33')]=_[_0x858b('0x34')](_0x3fa3a7[_0x858b('0x33')]);_0x3bc86a[_0x858b('0x35')]=_[_0x858b('0x36')](_0x3bc86a[_0x858b('0x32')],_0x3bc86a[_0x858b('0x33')]);_0x2948b3[_0x858b('0x37')]=_[_0x858b('0x36')](_0x3bc86a[_0x858b('0x32')],qs[_0x858b('0x38')](_0x3fa3a7[_0x858b('0x33')][_0x858b('0x38')]));_0x2948b3[_0x858b('0x37')]=_0x2948b3['attributes'][_0x858b('0x39')]?_0x2948b3['attributes']:_0x3bc86a[_0x858b('0x32')];if(!_0x3fa3a7['query'][_0x858b('0x3a')](_0x858b('0x3b'))){_0x2948b3[_0x858b('0x1e')]=qs['limit'](_0x3fa3a7[_0x858b('0x33')][_0x858b('0x1e')]);_0x2948b3[_0x858b('0x1d')]=qs[_0x858b('0x1d')](_0x3fa3a7['query'][_0x858b('0x1d')]);}_0x2948b3[_0x858b('0x3c')]=qs[_0x858b('0x3d')](_0x3fa3a7[_0x858b('0x33')][_0x858b('0x3d')]);_0x2948b3[_0x858b('0x3e')]=qs[_0x858b('0x35')](_['pick'](_0x3fa3a7[_0x858b('0x33')],_0x3bc86a[_0x858b('0x35')]),_0x45d594);if(_0x3fa3a7['query'][_0x858b('0x3f')]){_0x2948b3[_0x858b('0x3e')]=_[_0x858b('0x40')](_0x2948b3['where'],{'$or':_['map'](_0x45d594,function(_0x430750){if(_0x430750['type']!==_0x858b('0x41')){var _0x228e30={};_0x228e30[_0x430750[_0x858b('0x2a')]]={'$like':'%'+_0x3fa3a7[_0x858b('0x33')]['filter']+'%'};return _0x228e30;}})});}_0x2948b3=_[_0x858b('0x40')]({},_0x2948b3,_0x3fa3a7[_0x858b('0x42')]);var _0x1b7467={'where':_0x2948b3[_0x858b('0x3e')]};return db[_0x858b('0x2d')][_0x858b('0x1c')](_0x1b7467)['then'](function(_0x452fcc){_0x1504b0['count']=_0x452fcc;if(_0x3fa3a7[_0x858b('0x33')][_0x858b('0x43')]){_0x2948b3[_0x858b('0x44')]=[{'all':!![]}];}return db[_0x858b('0x2d')][_0x858b('0x45')](_0x2948b3);})[_0x858b('0x24')](function(_0x50a356){_0x1504b0[_0x858b('0x46')]=_0x50a356;return _0x1504b0;})[_0x858b('0x24')](respondWithFilteredResult(_0x4f63e1,_0x2948b3))[_0x858b('0x47')](handleError(_0x4f63e1,null));};exports['show']=function(_0x29e3ac,_0x37c9e4){var _0x3d8a80={'raw':!![],'where':{'id':_0x29e3ac[_0x858b('0x48')]['id']}},_0x330faf={};_0x330faf[_0x858b('0x32')]=_['keys'](db[_0x858b('0x2d')]['rawAttributes']);_0x330faf[_0x858b('0x33')]=_[_0x858b('0x34')](_0x29e3ac['query']);_0x330faf[_0x858b('0x35')]=_['intersection'](_0x330faf[_0x858b('0x32')],_0x330faf['query']);_0x3d8a80[_0x858b('0x37')]=_[_0x858b('0x36')](_0x330faf['model'],qs[_0x858b('0x38')](_0x29e3ac[_0x858b('0x33')][_0x858b('0x38')]));_0x3d8a80[_0x858b('0x37')]=_0x3d8a80[_0x858b('0x37')][_0x858b('0x39')]?_0x3d8a80['attributes']:_0x330faf[_0x858b('0x32')];if(_0x29e3ac[_0x858b('0x33')][_0x858b('0x43')]){_0x3d8a80['include']=[{'all':!![]}];}_0x3d8a80=_[_0x858b('0x40')]({},_0x3d8a80,_0x29e3ac[_0x858b('0x42')]);return db[_0x858b('0x2d')][_0x858b('0x49')](_0x3d8a80)[_0x858b('0x24')](handleEntityNotFound(_0x37c9e4,null))[_0x858b('0x24')](respondWithResult(_0x37c9e4,null))['catch'](handleError(_0x37c9e4,null));};exports[_0x858b('0x4a')]=function(_0x542548,_0x4e1d6b){return db['SmsQueue']['create'](_0x542548[_0x858b('0x4b')],{})[_0x858b('0x24')](function(_0x462128){var _0x15424c=_0x542548[_0x858b('0x4c')]['get']({'plain':!![]});if(!_0x15424c)throw new Error(_0x858b('0x4d'));if(_0x15424c['role']==='user'){var _0x3e108e=_0x462128[_0x858b('0x26')]({'plain':!![]});var _0xca1b7a=_0x858b('0x4e');return db[_0x858b('0x4f')]['find']({'where':{'name':_0xca1b7a,'userProfileId':_0x15424c['userProfileId']},'raw':!![]})[_0x858b('0x24')](function(_0x19cd8f){if(_0x19cd8f&&_0x19cd8f[_0x858b('0x50')]===0x0){return db[_0x858b('0x27')][_0x858b('0x4a')]({'name':_0x3e108e['name'],'resourceId':_0x3e108e['id'],'type':_0x19cd8f[_0x858b('0x2a')],'sectionId':_0x19cd8f['id']},{})[_0x858b('0x24')](function(){return _0x462128;});}else{return _0x462128;}})[_0x858b('0x47')](function(_0x53de0f){logger[_0x858b('0x28')](_0x858b('0x51'),_0x53de0f);throw _0x53de0f;});}return _0x462128;})[_0x858b('0x24')](respondWithResult(_0x4e1d6b,0xc9))[_0x858b('0x47')](handleError(_0x4e1d6b,null));};exports['update']=function(_0x5c04d5,_0x1a299c){if(_0x5c04d5[_0x858b('0x4b')]['id']){delete _0x5c04d5[_0x858b('0x4b')]['id'];}return db[_0x858b('0x2d')]['find']({'where':{'id':_0x5c04d5[_0x858b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a299c,null))[_0x858b('0x24')](saveUpdates(_0x5c04d5[_0x858b('0x4b')],null))[_0x858b('0x24')](respondWithResult(_0x1a299c,null))['catch'](handleError(_0x1a299c,null));};exports[_0x858b('0x25')]=function(_0x344a12,_0x5e973e){return db['SmsQueue'][_0x858b('0x49')]({'where':{'id':_0x344a12[_0x858b('0x48')]['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x5e973e,null))[_0x858b('0x24')](removeEntity(_0x5e973e,null))['catch'](handleError(_0x5e973e,null));};exports['describe']=function(_0x1bdbc7,_0x4496c8){return db[_0x858b('0x2d')][_0x858b('0x52')]()[_0x858b('0x24')](respondWithResult(_0x4496c8,null))[_0x858b('0x47')](handleError(_0x4496c8,null));};exports[_0x858b('0x53')]=function(_0xb3df8a,_0x403917,_0x4f4ee9){var _0x32de8f={'raw':!![],'where':{}},_0xc610fd={},_0x21e64f;return db[_0x858b('0x2d')][_0x858b('0x54')]({'where':{'id':_0xb3df8a[_0x858b('0x48')]['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x403917,null))[_0x858b('0x24')](function(_0x30f865){if(_0x30f865){_0x21e64f=_0x30f865[_0x858b('0x26')]({'plain':!![]});_0xc610fd[_0x858b('0x32')]=_['keys'](db[_0x858b('0x55')][_0x858b('0x2e')]);_0xc610fd[_0x858b('0x33')]=_[_0x858b('0x34')](_0xb3df8a[_0x858b('0x33')]);_0xc610fd[_0x858b('0x35')]=_['intersection'](_0xc610fd[_0x858b('0x32')],_0xc610fd[_0x858b('0x33')]);_0x32de8f[_0x858b('0x37')]=_['intersection'](_0xc610fd[_0x858b('0x32')],qs[_0x858b('0x38')](_0xb3df8a[_0x858b('0x33')][_0x858b('0x38')]));_0x32de8f[_0x858b('0x37')]=_0x32de8f[_0x858b('0x37')][_0x858b('0x39')]?_0x32de8f['attributes']:_0xc610fd['model'];if(!_0xb3df8a[_0x858b('0x33')][_0x858b('0x3a')](_0x858b('0x3b'))){_0x32de8f[_0x858b('0x1e')]=qs[_0x858b('0x1e')](_0xb3df8a[_0x858b('0x33')][_0x858b('0x1e')]);_0x32de8f['offset']=qs[_0x858b('0x1d')](_0xb3df8a[_0x858b('0x33')][_0x858b('0x1d')]);}_0x32de8f[_0x858b('0x3c')]=qs[_0x858b('0x3d')](_0xb3df8a[_0x858b('0x33')][_0x858b('0x3d')]);_0x32de8f['where']=qs[_0x858b('0x35')](_[_0x858b('0x56')](_0xb3df8a[_0x858b('0x33')],_0xc610fd[_0x858b('0x35')]));_0x32de8f[_0x858b('0x3e')][_0x858b('0x57')]=_0x30f865['id'];if(_0xb3df8a[_0x858b('0x33')][_0x858b('0x3f')]){_0x32de8f[_0x858b('0x3e')]=_[_0x858b('0x40')](_0x32de8f[_0x858b('0x3e')],{'$or':_['map'](_0x32de8f['attributes'],function(_0x3b93ac){var _0x43b51b={};_0x43b51b[_0x3b93ac]={'$like':'%'+_0xb3df8a[_0x858b('0x33')][_0x858b('0x3f')]+'%'};return _0x43b51b;})});}_0x32de8f=_[_0x858b('0x40')]({},_0x32de8f,_0xb3df8a[_0x858b('0x42')]);return db['UserSmsQueue'][_0x858b('0x45')](_0x32de8f);}})[_0x858b('0x24')](function(_0x3a2231){if(_0x3a2231){return db[_0x858b('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x3a2231,_0x858b('0x59')),'role':_0x858b('0x5a')},'attributes':['id','name','smsPause',_0x858b('0x5b'),_0x858b('0x5c')]});}})['then'](function(_0x395d73){if(_0x395d73){return{'count':_0x395d73[_0x858b('0x1c')],'rows':_[_0x858b('0x2c')](_0x395d73['rows'],function(_0x131fa8){return{'membername':_0x131fa8['name'],'UserId':_0x131fa8['id'],'queue_name':_0x21e64f[_0x858b('0x2a')],'SmsQueueId':_0x21e64f['id'],'interface':util[_0x858b('0x5d')](_0x858b('0x5e'),_0x858b('0x5f'),_0x131fa8[_0x858b('0x2a')]),'penalty':0x0,'paused':_0x131fa8[_0x858b('0x60')],'createdAt':_0x131fa8['createdAt'],'updatedAt':_0x131fa8[_0x858b('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x858b('0x24')](respondWithFilteredResult(_0x403917,_0x32de8f))['catch'](handleError(_0x403917,null));};exports[_0x858b('0x61')]=function(_0x3a679b,_0x3f4b89,_0x150a2d){var _0x45003e={};var _0x4e296c={};var _0xf2881b;var _0xb2958a;return db[_0x858b('0x2d')]['findOne']({'where':{'id':_0x3a679b[_0x858b('0x48')]['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x3f4b89,null))['then'](function(_0x505378){if(_0x505378){_0xf2881b=_0x505378;_0x4e296c[_0x858b('0x32')]=_[_0x858b('0x34')](db['Team'][_0x858b('0x2e')]);_0x4e296c[_0x858b('0x33')]=_[_0x858b('0x34')](_0x3a679b[_0x858b('0x33')]);_0x4e296c[_0x858b('0x35')]=_[_0x858b('0x36')](_0x4e296c[_0x858b('0x32')],_0x4e296c[_0x858b('0x33')]);_0x45003e[_0x858b('0x37')]=_[_0x858b('0x36')](_0x4e296c['model'],qs[_0x858b('0x38')](_0x3a679b[_0x858b('0x33')][_0x858b('0x38')]));_0x45003e[_0x858b('0x37')]=_0x45003e['attributes'][_0x858b('0x39')]?_0x45003e[_0x858b('0x37')]:_0x4e296c[_0x858b('0x32')];_0x45003e[_0x858b('0x3c')]=qs['sort'](_0x3a679b[_0x858b('0x33')]['sort']);_0x45003e[_0x858b('0x3e')]=qs[_0x858b('0x35')](_[_0x858b('0x56')](_0x3a679b[_0x858b('0x33')],_0x4e296c[_0x858b('0x35')]));if(_0x3a679b[_0x858b('0x33')][_0x858b('0x3f')]){_0x45003e['where']=_['merge'](_0x45003e['where'],{'$or':_[_0x858b('0x2c')](_0x45003e[_0x858b('0x37')],function(_0x58b7ae){var _0x15c27c={};_0x15c27c[_0x58b7ae]={'$like':'%'+_0x3a679b['query'][_0x858b('0x3f')]+'%'};return _0x15c27c;})});}_0x45003e=_[_0x858b('0x40')]({},_0x45003e,_0x3a679b[_0x858b('0x42')]);return _0xf2881b[_0x858b('0x61')](_0x45003e);}})[_0x858b('0x24')](function(_0x3e9544){if(_0x3e9544){_0xb2958a=_0x3e9544['length'];if(!_0x3a679b[_0x858b('0x33')][_0x858b('0x3a')]('nolimit')){_0x45003e[_0x858b('0x1e')]=qs[_0x858b('0x1e')](_0x3a679b['query'][_0x858b('0x1e')]);_0x45003e[_0x858b('0x1d')]=qs['offset'](_0x3a679b[_0x858b('0x33')]['offset']);}return _0xf2881b[_0x858b('0x61')](_0x45003e);}})[_0x858b('0x24')](function(_0x288f93){if(_0x288f93){return _0x288f93?{'count':_0xb2958a,'rows':_0x288f93}:null;}})[_0x858b('0x24')](respondWithResult(_0x3f4b89,null))[_0x858b('0x47')](handleError(_0x3f4b89,null));};exports[_0x858b('0x62')]=function(_0x3907d8,_0x349616,_0x34456c){var _0x4015e0=_0x3907d8['body'][_0x858b('0x63')];return db[_0x858b('0x64')][_0x858b('0x45')]({'where':{'id':_0x4015e0},'attributes':['id'],'include':[{'model':db[_0x858b('0x58')],'as':_0x858b('0x65'),'attributes':['id','name',_0x858b('0x66'),_0x858b('0x67'),_0x858b('0x68')],'raw':!![]}]})[_0x858b('0x24')](function(_0x3556c2){if(_0x3556c2){var _0x133b9b=_[_0x858b('0x69')](_0x3556c2,function(_0x24af63){var _0x5d30df=_0x24af63['get']({'plain':!![]});return _0x5d30df[_0x858b('0x65')];});return db['SmsQueue'][_0x858b('0x49')]({'where':{'id':_0x3907d8['params']['id']}})[_0x858b('0x24')](function(_0x26a4dd){return db[_0x858b('0x6a')]['transaction'](function(_0x344078){return _0x26a4dd[_0x858b('0x62')](_0x4015e0,{'transaction':_0x344078})[_0x858b('0x24')](function(){return BPromise[_0x858b('0x6b')](_0x133b9b,function(_0x2fdee0){return db['UserSmsQueue'][_0x858b('0x6c')]({'where':{'UserId':_0x2fdee0['id'],'SmsQueueId':_0x3907d8[_0x858b('0x48')]['id']},'transaction':_0x344078});});})[_0x858b('0x24')](function(){_0x133b9b[_0x858b('0x6d')](function(_0x4f84f3){socket[_0x858b('0x6e')](_0x858b('0x6f'),{'UserId':_0x4f84f3['id'],'SmsQueueId':_0x26a4dd['id']});});});});});}})['then'](respondWithStatusCode(_0x349616,null))['catch'](handleError(_0x349616,null));};exports[_0x858b('0x70')]=function(_0x4dbbaf,_0x263389,_0x612470){return db[_0x858b('0x64')][_0x858b('0x45')]({'where':{'id':_0x4dbbaf[_0x858b('0x33')][_0x858b('0x63')]},'attributes':['id'],'include':[{'model':db[_0x858b('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x858b('0x24')](handleEntityNotFound(_0x263389,null))['then'](function(_0xd5d19a){var _0xe6ddbc=_[_0x858b('0x2c')](_0xd5d19a,'id');var _0x44003c=[];var _0x4502b4=[];var _0x1bcf23=squel[_0x858b('0x71')]();_0x1bcf23['field'](_0x858b('0x72'))[_0x858b('0x73')](_0x858b('0x74'),'tq')['join'](_0x858b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x858b('0x3e')](_0x858b('0x76'),_0x4dbbaf[_0x858b('0x48')]['id']);for(var _0x5f0949=0x0;_0x5f0949<_0xd5d19a['length'];_0x5f0949+=0x1){let _0x4e194e=_0xd5d19a[_0x5f0949];for(var _0x1102d1=0x0;_0x1102d1<_0x4e194e[_0x858b('0x65')][_0x858b('0x39')];_0x1102d1+=0x1){let _0x31a6c2=_0x4e194e[_0x858b('0x65')][_0x1102d1];var _0x268616=_0x1bcf23[_0x858b('0x77')]();_0x268616[_0x858b('0x3e')](_0x858b('0x78'),_0x31a6c2['id']);_0x4502b4[_0x858b('0x79')](db[_0x858b('0x6a')]['query'](_0x268616['toString'](),{'type':db[_0x858b('0x6a')][_0x858b('0x7a')]['SELECT']})[_0x858b('0x24')](function(_0x16aa3f){if(_0x16aa3f[_0x858b('0x39')]===0x1){return _0x31a6c2['id'];}else{var _0x5c18f7=_[_0x858b('0x7b')](_[_0x858b('0x2c')](_0x16aa3f,_0x858b('0x7c')),function(_0x11c2ff){return _[_0x858b('0x7d')](_0xe6ddbc,_0x11c2ff);});if(_0x5c18f7){return _0x31a6c2['id'];}}}));}}return BPromise[_0x858b('0x7e')](_0x4502b4)['then'](function(_0xe20963){_0x44003c=_(_0x44003c)[_0x858b('0x7f')](_0xe20963)['compact']()[_0x858b('0x80')]();return db[_0x858b('0x2d')][_0x858b('0x49')]({'where':{'id':_0x4dbbaf[_0x858b('0x48')]['id']}})[_0x858b('0x24')](function(_0x13f64a){return db['sequelize'][_0x858b('0x81')](function(_0x5b6f5b){return _0x13f64a[_0x858b('0x70')](_0x4dbbaf['query'][_0x858b('0x63')],{'transaction':_0x5b6f5b})['then'](function(){if(!_['isEmpty'](_0x44003c)){return _0x13f64a[_0x858b('0x82')](_0x44003c,{'transaction':_0x5b6f5b});}})['then'](function(){_0x44003c[_0x858b('0x6d')](function(_0x428cb0){socket[_0x858b('0x6e')](_0x858b('0x83'),{'UserId':_0x428cb0,'SmsQueueId':_0x13f64a['id']});});});});});});})[_0x858b('0x24')](respondWithStatusCode(_0x263389,null))[_0x858b('0x47')](handleError(_0x263389,null));};exports[_0x858b('0x84')]=function(_0x211aec,_0x10b108,_0x2adea5){return db['SmsQueue'][_0x858b('0x49')]({'where':{'id':_0x211aec['params']['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x10b108,null))[_0x858b('0x24')](function(_0x261fd){if(_0x261fd){return _0x261fd['addAgents'](_0x211aec['body']['ids'],_['omit'](_0x211aec[_0x858b('0x4b')],[_0x858b('0x63'),'id'])||{})[_0x858b('0x85')](function(_0x42aae6){for(var _0x9358f=0x0;_0x9358f<_0x211aec['body']['ids']['length'];_0x9358f+=0x1){socket[_0x858b('0x6e')](_0x858b('0x6f'),{'UserId':Number(_0x211aec[_0x858b('0x4b')][_0x858b('0x63')][_0x9358f]),'SmsQueueId':Number(_0x211aec[_0x858b('0x48')]['id'])});}return _0x42aae6;});}})['then'](respondWithResult(_0x10b108,null))['catch'](handleError(_0x10b108,null));};exports['removeAgents']=function(_0x4e9fdb,_0x5449eb,_0xe2a5c7){return db[_0x858b('0x2d')][_0x858b('0x49')]({'where':{'id':_0x4e9fdb[_0x858b('0x48')]['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x5449eb,null))['then'](function(_0x647d59){if(_0x647d59){return _0x647d59[_0x858b('0x82')](_0x4e9fdb['query'][_0x858b('0x63')])[_0x858b('0x24')](function(){if(_['isArray'](_0x4e9fdb[_0x858b('0x33')][_0x858b('0x63')])){for(var _0x57ae2f=0x0;_0x57ae2f<_0x4e9fdb[_0x858b('0x33')][_0x858b('0x63')][_0x858b('0x39')];_0x57ae2f+=0x1){socket[_0x858b('0x6e')](_0x858b('0x83'),{'UserId':Number(_0x4e9fdb[_0x858b('0x33')][_0x858b('0x63')][_0x57ae2f]),'SmsQueueId':Number(_0x4e9fdb[_0x858b('0x48')]['id'])});}}else{socket['emit'](_0x858b('0x83'),{'UserId':Number(_0x4e9fdb[_0x858b('0x33')][_0x858b('0x63')]),'SmsQueueId':Number(_0x4e9fdb[_0x858b('0x48')]['id'])});}});}})[_0x858b('0x24')](respondWithStatusCode(_0x5449eb,null))[_0x858b('0x47')](handleError(_0x5449eb,null));};exports[_0x858b('0x86')]=function(_0x13cafa,_0x335e10,_0x24078a){var _0x23d89b={};var _0x25e5dc={};var _0x57db20;var _0x44b5c5;return db[_0x858b('0x2d')]['findOne']({'where':{'id':_0x13cafa[_0x858b('0x48')]['id']}})[_0x858b('0x24')](handleEntityNotFound(_0x335e10,null))['then'](function(_0x24c9c2){if(_0x24c9c2){_0x57db20=_0x24c9c2;_0x25e5dc[_0x858b('0x32')]=_[_0x858b('0x34')](db[_0x858b('0x58')][_0x858b('0x2e')]);_0x25e5dc[_0x858b('0x33')]=_[_0x858b('0x34')](_0x13cafa[_0x858b('0x33')]);_0x25e5dc[_0x858b('0x35')]=_['intersection'](_0x25e5dc[_0x858b('0x32')],_0x25e5dc[_0x858b('0x33')]);_0x23d89b[_0x858b('0x37')]=_[_0x858b('0x36')](_0x25e5dc[_0x858b('0x32')],qs['fields'](_0x13cafa[_0x858b('0x33')][_0x858b('0x38')]));_0x23d89b[_0x858b('0x37')]=_0x23d89b[_0x858b('0x37')][_0x858b('0x39')]?_0x23d89b[_0x858b('0x37')]:_0x25e5dc[_0x858b('0x32')];_0x23d89b[_0x858b('0x3c')]=qs['sort'](_0x13cafa['query']['sort']);_0x23d89b['where']=qs[_0x858b('0x35')](_[_0x858b('0x56')](_0x13cafa[_0x858b('0x33')],_0x25e5dc[_0x858b('0x35')]));if(_0x13cafa[_0x858b('0x33')][_0x858b('0x3f')]){_0x23d89b[_0x858b('0x3e')]=_['merge'](_0x23d89b[_0x858b('0x3e')],{'$or':_[_0x858b('0x2c')](_0x23d89b[_0x858b('0x37')],function(_0x321510){var _0x4256ba={};_0x4256ba[_0x321510]={'$like':'%'+_0x13cafa[_0x858b('0x33')][_0x858b('0x3f')]+'%'};return _0x4256ba;})});}_0x23d89b=_[_0x858b('0x40')]({},_0x23d89b,_0x13cafa[_0x858b('0x42')]);return _0x57db20[_0x858b('0x86')](_0x23d89b);}})[_0x858b('0x24')](function(_0x26a11e){if(_0x26a11e){_0x44b5c5=_0x26a11e[_0x858b('0x39')];if(!_0x13cafa[_0x858b('0x33')][_0x858b('0x3a')](_0x858b('0x3b'))){_0x23d89b['limit']=qs[_0x858b('0x1e')](_0x13cafa['query'][_0x858b('0x1e')]);_0x23d89b[_0x858b('0x1d')]=qs[_0x858b('0x1d')](_0x13cafa[_0x858b('0x33')][_0x858b('0x1d')]);}return _0x57db20[_0x858b('0x86')](_0x23d89b);}})[_0x858b('0x24')](function(_0x37cc9a){if(_0x37cc9a){return _0x37cc9a?{'count':_0x44b5c5,'rows':_0x37cc9a}:null;}})[_0x858b('0x24')](respondWithResult(_0x335e10,null))['catch'](handleError(_0x335e10,null));}; \ No newline at end of file +var _0x1103=['all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','rawAttributes','findAll','User','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1103,0x97));var _0x3110=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1103[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3110('0x0'));var zipdir=require(_0x3110('0x1'));var jsonpatch=require(_0x3110('0x2'));var rp=require(_0x3110('0x3'));var moment=require(_0x3110('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3110('0x5'));var util=require(_0x3110('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3110('0x7'));var ejs=require(_0x3110('0x8'));var fs=require('fs');var fs_extra=require(_0x3110('0x9'));var _=require(_0x3110('0xa'));var squel=require(_0x3110('0xb'));var crypto=require(_0x3110('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3110('0x7'));var querystring=require('querystring');var Papa=require(_0x3110('0xd'));var Redis=require(_0x3110('0xe'));var authService=require(_0x3110('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3110('0x10'));var hardwareService=require(_0x3110('0x11'));var logger=require(_0x3110('0x12'))('api');var utils=require(_0x3110('0x13'));var config=require(_0x3110('0x14'));var licenseUtil=require(_0x3110('0x15'));var db=require('../../mysqldb')['db'];config[_0x3110('0x16')]=_[_0x3110('0x17')](config[_0x3110('0x16')],{'host':_0x3110('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3110('0x16')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x3c2d82,_0x560483){_0x560483=_0x560483||0xcc;return function(_0x5b3998){if(_0x5b3998){return _0x3c2d82[_0x3110('0x19')](_0x560483);}return _0x3c2d82['status'](_0x560483)[_0x3110('0x1a')]();};}function respondWithResult(_0x1a042e,_0x3651ed){_0x3651ed=_0x3651ed||0xc8;return function(_0x3b6d3f){if(_0x3b6d3f){return _0x1a042e[_0x3110('0x1b')](_0x3651ed)[_0x3110('0x1c')](_0x3b6d3f);}};}function respondWithFilteredResult(_0x648967,_0x34bc26){return function(_0x534c46){if(_0x534c46){var _0x2a583a=typeof _0x34bc26[_0x3110('0x1d')]===_0x3110('0x1e')&&typeof _0x34bc26[_0x3110('0x1f')]===_0x3110('0x1e');var _0x178b37=_0x534c46['count'];var _0x26844a=_0x2a583a?0x0:_0x34bc26[_0x3110('0x1d')];var _0x2b0906=_0x2a583a?_0x534c46['count']:_0x34bc26[_0x3110('0x1d')]+_0x34bc26[_0x3110('0x1f')];var _0x2dac6d;if(_0x2b0906>=_0x178b37){_0x2b0906=_0x178b37;_0x2dac6d=0xc8;}else{_0x2dac6d=0xce;}_0x648967['status'](_0x2dac6d);return _0x648967[_0x3110('0x20')](_0x3110('0x21'),_0x26844a+'-'+_0x2b0906+'/'+_0x178b37)[_0x3110('0x1c')](_0x534c46);}return null;};}function patchUpdates(_0x1c98af){return function(_0xf37b91){try{jsonpatch[_0x3110('0x22')](_0xf37b91,_0x1c98af,!![]);}catch(_0x9ad721){return BPromise['reject'](_0x9ad721);}return _0xf37b91[_0x3110('0x23')]();};}function saveUpdates(_0x284f5c,_0x80132f){return function(_0x2b8b06){if(_0x2b8b06){return _0x2b8b06[_0x3110('0x24')](_0x284f5c)[_0x3110('0x25')](function(_0x4fa2cb){return _0x4fa2cb;});}return null;};}function removeEntity(_0x5f2c68,_0x27f145){return function(_0x2aab25){if(_0x2aab25){return _0x2aab25[_0x3110('0x26')]()['then'](function(){var _0x2f0f6b=_0x2aab25[_0x3110('0x27')]({'plain':!![]});var _0x223f41=_0x3110('0x28');return db[_0x3110('0x29')][_0x3110('0x26')]({'where':{'type':_0x223f41,'resourceId':_0x2f0f6b['id']}})[_0x3110('0x25')](function(){return _0x2aab25;});})[_0x3110('0x25')](function(){_0x5f2c68[_0x3110('0x1b')](0xcc)[_0x3110('0x1a')]();});}};}function handleEntityNotFound(_0x2f4a92,_0x2b6fc1){return function(_0x16e825){if(!_0x16e825){_0x2f4a92[_0x3110('0x19')](0x194);}return _0x16e825;};}function handleError(_0x52b7fa,_0x545072){_0x545072=_0x545072||0x1f4;return function(_0x2c7eb5){logger[_0x3110('0x2a')](_0x2c7eb5[_0x3110('0x2b')]);if(_0x2c7eb5[_0x3110('0x2c')]){delete _0x2c7eb5[_0x3110('0x2c')];}_0x52b7fa['status'](_0x545072)[_0x3110('0x2d')](_0x2c7eb5);};}exports[_0x3110('0x2e')]=function(_0x4a6644,_0x4c65ed){var _0x1d0901={},_0x4461cb={},_0x1e2c8f={'count':0x0,'rows':[]};var _0x5c8e2a=_[_0x3110('0x2f')](db[_0x3110('0x30')]['rawAttributes'],function(_0x248388){return{'name':_0x248388[_0x3110('0x31')],'type':_0x248388[_0x3110('0x32')][_0x3110('0x33')]};});_0x4461cb[_0x3110('0x34')]=_[_0x3110('0x2f')](_0x5c8e2a,_0x3110('0x2c'));_0x4461cb[_0x3110('0x35')]=_[_0x3110('0x36')](_0x4a6644[_0x3110('0x35')]);_0x4461cb[_0x3110('0x37')]=_['intersection'](_0x4461cb[_0x3110('0x34')],_0x4461cb[_0x3110('0x35')]);_0x1d0901[_0x3110('0x38')]=_[_0x3110('0x39')](_0x4461cb[_0x3110('0x34')],qs[_0x3110('0x3a')](_0x4a6644[_0x3110('0x35')][_0x3110('0x3a')]));_0x1d0901[_0x3110('0x38')]=_0x1d0901[_0x3110('0x38')]['length']?_0x1d0901[_0x3110('0x38')]:_0x4461cb[_0x3110('0x34')];if(!_0x4a6644[_0x3110('0x35')][_0x3110('0x3b')](_0x3110('0x3c'))){_0x1d0901[_0x3110('0x1f')]=qs[_0x3110('0x1f')](_0x4a6644['query'][_0x3110('0x1f')]);_0x1d0901[_0x3110('0x1d')]=qs[_0x3110('0x1d')](_0x4a6644[_0x3110('0x35')]['offset']);}_0x1d0901[_0x3110('0x3d')]=qs['sort'](_0x4a6644['query'][_0x3110('0x3e')]);_0x1d0901[_0x3110('0x3f')]=qs[_0x3110('0x37')](_[_0x3110('0x40')](_0x4a6644[_0x3110('0x35')],_0x4461cb[_0x3110('0x37')]),_0x5c8e2a);if(_0x4a6644[_0x3110('0x35')][_0x3110('0x41')]){_0x1d0901['where']=_[_0x3110('0x42')](_0x1d0901['where'],{'$or':_[_0x3110('0x2f')](_0x5c8e2a,function(_0x5ae959){if(_0x5ae959[_0x3110('0x32')]!==_0x3110('0x43')){var _0x388943={};_0x388943[_0x5ae959[_0x3110('0x2c')]]={'$like':'%'+_0x4a6644[_0x3110('0x35')][_0x3110('0x41')]+'%'};return _0x388943;}})});}_0x1d0901=_[_0x3110('0x42')]({},_0x1d0901,_0x4a6644['options']);var _0x43b374={'where':_0x1d0901['where']};return db[_0x3110('0x30')][_0x3110('0x44')](_0x43b374)[_0x3110('0x25')](function(_0x2f2272){_0x1e2c8f[_0x3110('0x44')]=_0x2f2272;if(_0x4a6644[_0x3110('0x35')][_0x3110('0x45')]){_0x1d0901[_0x3110('0x46')]=[{'all':!![]}];}return db[_0x3110('0x30')]['findAll'](_0x1d0901);})['then'](function(_0x4122c2){_0x1e2c8f[_0x3110('0x47')]=_0x4122c2;return _0x1e2c8f;})[_0x3110('0x25')](respondWithFilteredResult(_0x4c65ed,_0x1d0901))[_0x3110('0x48')](handleError(_0x4c65ed,null));};exports[_0x3110('0x49')]=function(_0x11abc1,_0x5662c8){var _0x3031eb={'raw':!![],'where':{'id':_0x11abc1[_0x3110('0x4a')]['id']}},_0x3c3731={};_0x3c3731[_0x3110('0x34')]=_[_0x3110('0x36')](db[_0x3110('0x30')]['rawAttributes']);_0x3c3731[_0x3110('0x35')]=_[_0x3110('0x36')](_0x11abc1[_0x3110('0x35')]);_0x3c3731[_0x3110('0x37')]=_[_0x3110('0x39')](_0x3c3731[_0x3110('0x34')],_0x3c3731[_0x3110('0x35')]);_0x3031eb['attributes']=_[_0x3110('0x39')](_0x3c3731[_0x3110('0x34')],qs['fields'](_0x11abc1[_0x3110('0x35')]['fields']));_0x3031eb[_0x3110('0x38')]=_0x3031eb['attributes'][_0x3110('0x4b')]?_0x3031eb['attributes']:_0x3c3731[_0x3110('0x34')];if(_0x11abc1[_0x3110('0x35')][_0x3110('0x45')]){_0x3031eb[_0x3110('0x46')]=[{'all':!![]}];}_0x3031eb=_['merge']({},_0x3031eb,_0x11abc1[_0x3110('0x4c')]);return db['SmsQueue'][_0x3110('0x4d')](_0x3031eb)['then'](handleEntityNotFound(_0x5662c8,null))[_0x3110('0x25')](respondWithResult(_0x5662c8,null))['catch'](handleError(_0x5662c8,null));};exports[_0x3110('0x4e')]=function(_0x3ec77e,_0x4383c9){return db[_0x3110('0x30')][_0x3110('0x4e')](_0x3ec77e['body'],{})[_0x3110('0x25')](function(_0x572fa7){var _0x15a699=_0x3ec77e[_0x3110('0x4f')][_0x3110('0x27')]({'plain':!![]});if(!_0x15a699)throw new Error(_0x3110('0x50'));if(_0x15a699[_0x3110('0x51')]===_0x3110('0x4f')){var _0x2417db=_0x572fa7[_0x3110('0x27')]({'plain':!![]});var _0x366c97=_0x3110('0x28');return db[_0x3110('0x52')]['find']({'where':{'name':_0x366c97,'userProfileId':_0x15a699[_0x3110('0x53')]},'raw':!![]})[_0x3110('0x25')](function(_0x31e766){if(_0x31e766&&_0x31e766[_0x3110('0x54')]===0x0){return db[_0x3110('0x29')][_0x3110('0x4e')]({'name':_0x2417db[_0x3110('0x2c')],'resourceId':_0x2417db['id'],'type':_0x31e766[_0x3110('0x2c')],'sectionId':_0x31e766['id']},{})[_0x3110('0x25')](function(){return _0x572fa7;});}else{return _0x572fa7;}})[_0x3110('0x48')](function(_0x1dcf46){logger[_0x3110('0x2a')](_0x3110('0x55'),_0x1dcf46);throw _0x1dcf46;});}return _0x572fa7;})['then'](respondWithResult(_0x4383c9,0xc9))[_0x3110('0x48')](handleError(_0x4383c9,null));};exports[_0x3110('0x24')]=function(_0x346752,_0x1b4bbc){if(_0x346752[_0x3110('0x56')]['id']){delete _0x346752['body']['id'];}return db[_0x3110('0x30')][_0x3110('0x4d')]({'where':{'id':_0x346752[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](handleEntityNotFound(_0x1b4bbc,null))[_0x3110('0x25')](saveUpdates(_0x346752[_0x3110('0x56')],null))[_0x3110('0x25')](respondWithResult(_0x1b4bbc,null))['catch'](handleError(_0x1b4bbc,null));};exports[_0x3110('0x26')]=function(_0x40446b,_0xf6b55b){return db[_0x3110('0x30')]['find']({'where':{'id':_0x40446b[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](handleEntityNotFound(_0xf6b55b,null))['then'](removeEntity(_0xf6b55b,null))['catch'](handleError(_0xf6b55b,null));};exports[_0x3110('0x57')]=function(_0x57a98e,_0x28f0d9){return db[_0x3110('0x30')][_0x3110('0x57')]()['then'](respondWithResult(_0x28f0d9,null))['catch'](handleError(_0x28f0d9,null));};exports[_0x3110('0x58')]=function(_0x524cf3,_0x2fbdc4,_0x478670){var _0x4382cc={'raw':!![],'where':{}},_0x409d5a={},_0x136b71;return db[_0x3110('0x30')][_0x3110('0x59')]({'where':{'id':_0x524cf3[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](handleEntityNotFound(_0x2fbdc4,null))[_0x3110('0x25')](function(_0x178ea1){if(_0x178ea1){_0x136b71=_0x178ea1[_0x3110('0x27')]({'plain':!![]});_0x409d5a[_0x3110('0x34')]=_[_0x3110('0x36')](db[_0x3110('0x5a')][_0x3110('0x5b')]);_0x409d5a[_0x3110('0x35')]=_[_0x3110('0x36')](_0x524cf3['query']);_0x409d5a[_0x3110('0x37')]=_[_0x3110('0x39')](_0x409d5a[_0x3110('0x34')],_0x409d5a[_0x3110('0x35')]);_0x4382cc['attributes']=_[_0x3110('0x39')](_0x409d5a[_0x3110('0x34')],qs[_0x3110('0x3a')](_0x524cf3['query']['fields']));_0x4382cc['attributes']=_0x4382cc[_0x3110('0x38')]['length']?_0x4382cc['attributes']:_0x409d5a[_0x3110('0x34')];if(!_0x524cf3['query'][_0x3110('0x3b')](_0x3110('0x3c'))){_0x4382cc[_0x3110('0x1f')]=qs[_0x3110('0x1f')](_0x524cf3[_0x3110('0x35')][_0x3110('0x1f')]);_0x4382cc[_0x3110('0x1d')]=qs[_0x3110('0x1d')](_0x524cf3[_0x3110('0x35')][_0x3110('0x1d')]);}_0x4382cc['order']=qs[_0x3110('0x3e')](_0x524cf3[_0x3110('0x35')][_0x3110('0x3e')]);_0x4382cc[_0x3110('0x3f')]=qs['filters'](_[_0x3110('0x40')](_0x524cf3[_0x3110('0x35')],_0x409d5a[_0x3110('0x37')]));_0x4382cc['where']['SmsQueueId']=_0x178ea1['id'];if(_0x524cf3[_0x3110('0x35')]['filter']){_0x4382cc['where']=_[_0x3110('0x42')](_0x4382cc[_0x3110('0x3f')],{'$or':_[_0x3110('0x2f')](_0x4382cc[_0x3110('0x38')],function(_0x1814ad){var _0x1e585e={};_0x1e585e[_0x1814ad]={'$like':'%'+_0x524cf3[_0x3110('0x35')][_0x3110('0x41')]+'%'};return _0x1e585e;})});}_0x4382cc=_[_0x3110('0x42')]({},_0x4382cc,_0x524cf3[_0x3110('0x4c')]);return db['UserSmsQueue'][_0x3110('0x5c')](_0x4382cc);}})[_0x3110('0x25')](function(_0x212a0e){if(_0x212a0e){return db[_0x3110('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x212a0e,'UserId'),'role':_0x3110('0x5e')},'attributes':['id',_0x3110('0x2c'),_0x3110('0x5f'),_0x3110('0x60'),'createdAt']});}})['then'](function(_0x2dad3f){if(_0x2dad3f){return{'count':_0x2dad3f[_0x3110('0x44')],'rows':_[_0x3110('0x2f')](_0x2dad3f[_0x3110('0x47')],function(_0xd6b5c1){return{'membername':_0xd6b5c1[_0x3110('0x2c')],'UserId':_0xd6b5c1['id'],'queue_name':_0x136b71['name'],'SmsQueueId':_0x136b71['id'],'interface':util[_0x3110('0x61')](_0x3110('0x62'),_0x3110('0x63'),_0xd6b5c1[_0x3110('0x2c')]),'penalty':0x0,'paused':_0xd6b5c1[_0x3110('0x5f')],'createdAt':_0xd6b5c1[_0x3110('0x64')],'updatedAt':_0xd6b5c1[_0x3110('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3110('0x25')](respondWithFilteredResult(_0x2fbdc4,_0x4382cc))[_0x3110('0x48')](handleError(_0x2fbdc4,null));};exports[_0x3110('0x65')]=function(_0x3e2acb,_0x1175e3,_0x2a53c4){var _0x1a269d={};var _0x2375e8={};var _0x5df4b5;var _0x512ac3;return db['SmsQueue']['findOne']({'where':{'id':_0x3e2acb[_0x3110('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1175e3,null))[_0x3110('0x25')](function(_0x4183d4){if(_0x4183d4){_0x5df4b5=_0x4183d4;_0x2375e8[_0x3110('0x34')]=_[_0x3110('0x36')](db[_0x3110('0x66')]['rawAttributes']);_0x2375e8[_0x3110('0x35')]=_[_0x3110('0x36')](_0x3e2acb[_0x3110('0x35')]);_0x2375e8[_0x3110('0x37')]=_['intersection'](_0x2375e8['model'],_0x2375e8[_0x3110('0x35')]);_0x1a269d[_0x3110('0x38')]=_['intersection'](_0x2375e8[_0x3110('0x34')],qs[_0x3110('0x3a')](_0x3e2acb[_0x3110('0x35')][_0x3110('0x3a')]));_0x1a269d[_0x3110('0x38')]=_0x1a269d['attributes'][_0x3110('0x4b')]?_0x1a269d[_0x3110('0x38')]:_0x2375e8['model'];_0x1a269d['order']=qs[_0x3110('0x3e')](_0x3e2acb[_0x3110('0x35')][_0x3110('0x3e')]);_0x1a269d['where']=qs[_0x3110('0x37')](_['pick'](_0x3e2acb[_0x3110('0x35')],_0x2375e8[_0x3110('0x37')]));if(_0x3e2acb['query']['filter']){_0x1a269d[_0x3110('0x3f')]=_[_0x3110('0x42')](_0x1a269d[_0x3110('0x3f')],{'$or':_[_0x3110('0x2f')](_0x1a269d[_0x3110('0x38')],function(_0xdcf20){var _0x4276a5={};_0x4276a5[_0xdcf20]={'$like':'%'+_0x3e2acb[_0x3110('0x35')]['filter']+'%'};return _0x4276a5;})});}_0x1a269d=_[_0x3110('0x42')]({},_0x1a269d,_0x3e2acb['options']);return _0x5df4b5[_0x3110('0x65')](_0x1a269d);}})[_0x3110('0x25')](function(_0x3b9468){if(_0x3b9468){_0x512ac3=_0x3b9468[_0x3110('0x4b')];if(!_0x3e2acb[_0x3110('0x35')]['hasOwnProperty'](_0x3110('0x3c'))){_0x1a269d['limit']=qs[_0x3110('0x1f')](_0x3e2acb[_0x3110('0x35')]['limit']);_0x1a269d['offset']=qs[_0x3110('0x1d')](_0x3e2acb['query'][_0x3110('0x1d')]);}return _0x5df4b5[_0x3110('0x65')](_0x1a269d);}})[_0x3110('0x25')](function(_0x1569dd){if(_0x1569dd){return _0x1569dd?{'count':_0x512ac3,'rows':_0x1569dd}:null;}})['then'](respondWithResult(_0x1175e3,null))[_0x3110('0x48')](handleError(_0x1175e3,null));};exports[_0x3110('0x67')]=function(_0x501785,_0x5c3648,_0x1f355e){var _0x404040=_0x501785[_0x3110('0x56')][_0x3110('0x68')];return db[_0x3110('0x66')]['findAll']({'where':{'id':_0x404040},'attributes':['id'],'include':[{'model':db[_0x3110('0x5d')],'as':_0x3110('0x69'),'attributes':['id',_0x3110('0x2c'),_0x3110('0x6a'),_0x3110('0x6b'),'interface'],'raw':!![]}]})[_0x3110('0x25')](function(_0x47c305){if(_0x47c305){var _0x23bab3=_['flatMap'](_0x47c305,function(_0x493868){var _0x41a022=_0x493868[_0x3110('0x27')]({'plain':!![]});return _0x41a022['Agents'];});return db[_0x3110('0x30')][_0x3110('0x4d')]({'where':{'id':_0x501785[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](function(_0x34d401){return db[_0x3110('0x6c')]['transaction'](function(_0x23ada9){return _0x34d401[_0x3110('0x67')](_0x404040,{'transaction':_0x23ada9})[_0x3110('0x25')](function(){return BPromise[_0x3110('0x6d')](_0x23bab3,function(_0x1f19b9){return db[_0x3110('0x5a')][_0x3110('0x6e')]({'where':{'UserId':_0x1f19b9['id'],'SmsQueueId':_0x501785['params']['id']},'transaction':_0x23ada9});});})[_0x3110('0x25')](function(){_0x23bab3[_0x3110('0x6f')](function(_0x3e2fab){socket[_0x3110('0x70')](_0x3110('0x71'),{'UserId':_0x3e2fab['id'],'SmsQueueId':_0x34d401['id']});});});});});}})['then'](respondWithStatusCode(_0x5c3648,null))['catch'](handleError(_0x5c3648,null));};exports['removeTeams']=function(_0x515b20,_0x2e82b7,_0x569c59){return db[_0x3110('0x66')][_0x3110('0x5c')]({'where':{'id':_0x515b20['query'][_0x3110('0x68')]},'attributes':['id'],'include':[{'model':db[_0x3110('0x5d')],'as':_0x3110('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3110('0x25')](handleEntityNotFound(_0x2e82b7,null))[_0x3110('0x25')](function(_0x490d64){var _0x538b2c=_[_0x3110('0x2f')](_0x490d64,'id');var _0x4484aa=[];var _0x2d8852=[];var _0x4663fd=squel[_0x3110('0x72')]();_0x4663fd[_0x3110('0x73')](_0x3110('0x74'))[_0x3110('0x75')](_0x3110('0x76'),'tq')[_0x3110('0x77')]('user_has_teams','ut',_0x3110('0x78'))[_0x3110('0x3f')]('SmsQueueId\x20=\x20?',_0x515b20['params']['id']);for(var _0x59c24b=0x0;_0x59c24b<_0x490d64['length'];_0x59c24b+=0x1){let _0x26dcdc=_0x490d64[_0x59c24b];for(var _0x27fc78=0x0;_0x27fc78<_0x26dcdc[_0x3110('0x69')][_0x3110('0x4b')];_0x27fc78+=0x1){let _0x2cd22f=_0x26dcdc[_0x3110('0x69')][_0x27fc78];var _0x2c383e=_0x4663fd['clone']();_0x2c383e[_0x3110('0x3f')](_0x3110('0x79'),_0x2cd22f['id']);_0x2d8852[_0x3110('0x7a')](db['sequelize']['query'](_0x2c383e[_0x3110('0x7b')](),{'type':db[_0x3110('0x6c')][_0x3110('0x7c')]['SELECT']})[_0x3110('0x25')](function(_0x231e2b){if(_0x231e2b[_0x3110('0x4b')]===0x1){return _0x2cd22f['id'];}else{var _0x37ccb8=_[_0x3110('0x7d')](_['map'](_0x231e2b,'TeamId'),function(_0x1b4cd4){return _[_0x3110('0x7e')](_0x538b2c,_0x1b4cd4);});if(_0x37ccb8){return _0x2cd22f['id'];}}}));}}return BPromise[_0x3110('0x7f')](_0x2d8852)[_0x3110('0x25')](function(_0x1fe005){_0x4484aa=_(_0x4484aa)[_0x3110('0x80')](_0x1fe005)[_0x3110('0x81')]()[_0x3110('0x82')]();return db[_0x3110('0x30')][_0x3110('0x4d')]({'where':{'id':_0x515b20[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](function(_0x14f859){return db[_0x3110('0x6c')][_0x3110('0x83')](function(_0xa04568){return _0x14f859['removeTeams'](_0x515b20[_0x3110('0x35')]['ids'],{'transaction':_0xa04568})[_0x3110('0x25')](function(){if(!_[_0x3110('0x84')](_0x4484aa)){return _0x14f859[_0x3110('0x85')](_0x4484aa,{'transaction':_0xa04568});}})[_0x3110('0x25')](function(){_0x4484aa['forEach'](function(_0x2937cf){socket['emit'](_0x3110('0x86'),{'UserId':_0x2937cf,'SmsQueueId':_0x14f859['id']});});});});});});})[_0x3110('0x25')](respondWithStatusCode(_0x2e82b7,null))[_0x3110('0x48')](handleError(_0x2e82b7,null));};exports[_0x3110('0x87')]=function(_0x26b3a6,_0x11c06f,_0x3f8ce3){return db[_0x3110('0x30')][_0x3110('0x4d')]({'where':{'id':_0x26b3a6[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](handleEntityNotFound(_0x11c06f,null))[_0x3110('0x25')](function(_0x3ee56a){if(_0x3ee56a){return _0x3ee56a[_0x3110('0x87')](_0x26b3a6[_0x3110('0x56')]['ids'],_[_0x3110('0x88')](_0x26b3a6[_0x3110('0x56')],[_0x3110('0x68'),'id'])||{})[_0x3110('0x89')](function(_0x527f01){for(var _0xda9a44=0x0;_0xda9a44<_0x26b3a6[_0x3110('0x56')]['ids']['length'];_0xda9a44+=0x1){socket[_0x3110('0x70')]('userSmsQueue:save',{'UserId':Number(_0x26b3a6[_0x3110('0x56')]['ids'][_0xda9a44]),'SmsQueueId':Number(_0x26b3a6['params']['id'])});}return _0x527f01;});}})[_0x3110('0x25')](respondWithResult(_0x11c06f,null))[_0x3110('0x48')](handleError(_0x11c06f,null));};exports[_0x3110('0x85')]=function(_0x696a67,_0x38e340,_0x3b08bf){return db[_0x3110('0x30')]['find']({'where':{'id':_0x696a67[_0x3110('0x4a')]['id']}})[_0x3110('0x25')](handleEntityNotFound(_0x38e340,null))[_0x3110('0x25')](function(_0x1fe78f){if(_0x1fe78f){return _0x1fe78f['removeAgents'](_0x696a67[_0x3110('0x35')]['ids'])[_0x3110('0x25')](function(){if(_['isArray'](_0x696a67[_0x3110('0x35')][_0x3110('0x68')])){for(var _0x4e1583=0x0;_0x4e1583<_0x696a67['query'][_0x3110('0x68')][_0x3110('0x4b')];_0x4e1583+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x696a67[_0x3110('0x35')][_0x3110('0x68')][_0x4e1583]),'SmsQueueId':Number(_0x696a67[_0x3110('0x4a')]['id'])});}}else{socket[_0x3110('0x70')](_0x3110('0x86'),{'UserId':Number(_0x696a67[_0x3110('0x35')][_0x3110('0x68')]),'SmsQueueId':Number(_0x696a67[_0x3110('0x4a')]['id'])});}});}})[_0x3110('0x25')](respondWithStatusCode(_0x38e340,null))[_0x3110('0x48')](handleError(_0x38e340,null));};exports['getAgents']=function(_0x2a8cd0,_0x454124,_0x38fc43){var _0x677448={};var _0x187ce0={};var _0x4371bb;var _0x499d09;return db['SmsQueue'][_0x3110('0x59')]({'where':{'id':_0x2a8cd0[_0x3110('0x4a')]['id']}})['then'](handleEntityNotFound(_0x454124,null))['then'](function(_0x4a249b){if(_0x4a249b){_0x4371bb=_0x4a249b;_0x187ce0[_0x3110('0x34')]=_[_0x3110('0x36')](db[_0x3110('0x5d')][_0x3110('0x5b')]);_0x187ce0[_0x3110('0x35')]=_['keys'](_0x2a8cd0['query']);_0x187ce0[_0x3110('0x37')]=_[_0x3110('0x39')](_0x187ce0[_0x3110('0x34')],_0x187ce0[_0x3110('0x35')]);_0x677448[_0x3110('0x38')]=_[_0x3110('0x39')](_0x187ce0[_0x3110('0x34')],qs[_0x3110('0x3a')](_0x2a8cd0[_0x3110('0x35')][_0x3110('0x3a')]));_0x677448[_0x3110('0x38')]=_0x677448[_0x3110('0x38')][_0x3110('0x4b')]?_0x677448['attributes']:_0x187ce0[_0x3110('0x34')];_0x677448[_0x3110('0x3d')]=qs[_0x3110('0x3e')](_0x2a8cd0['query']['sort']);_0x677448[_0x3110('0x3f')]=qs[_0x3110('0x37')](_[_0x3110('0x40')](_0x2a8cd0[_0x3110('0x35')],_0x187ce0[_0x3110('0x37')]));if(_0x2a8cd0[_0x3110('0x35')][_0x3110('0x41')]){_0x677448[_0x3110('0x3f')]=_[_0x3110('0x42')](_0x677448[_0x3110('0x3f')],{'$or':_['map'](_0x677448[_0x3110('0x38')],function(_0x153bc0){var _0xabf29f={};_0xabf29f[_0x153bc0]={'$like':'%'+_0x2a8cd0['query'][_0x3110('0x41')]+'%'};return _0xabf29f;})});}_0x677448=_['merge']({},_0x677448,_0x2a8cd0['options']);return _0x4371bb[_0x3110('0x8a')](_0x677448);}})[_0x3110('0x25')](function(_0x237f4d){if(_0x237f4d){_0x499d09=_0x237f4d['length'];if(!_0x2a8cd0['query']['hasOwnProperty'](_0x3110('0x3c'))){_0x677448['limit']=qs['limit'](_0x2a8cd0[_0x3110('0x35')][_0x3110('0x1f')]);_0x677448['offset']=qs[_0x3110('0x1d')](_0x2a8cd0[_0x3110('0x35')][_0x3110('0x1d')]);}return _0x4371bb[_0x3110('0x8a')](_0x677448);}})[_0x3110('0x25')](function(_0x45c5b5){if(_0x45c5b5){return _0x45c5b5?{'count':_0x499d09,'rows':_0x45c5b5}:null;}})['then'](respondWithResult(_0x454124,null))[_0x3110('0x48')](handleError(_0x454124,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 28a2d4f..73e20ea 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 _0xc9e5=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2e8802,_0x59ad8c){var _0x4617aa=function(_0x4380b4){while(--_0x4380b4){_0x2e8802['push'](_0x2e8802['shift']());}};_0x4617aa(++_0x59ad8c);}(_0xc9e5,0xc6));var _0x5c9e=function(_0x4a4d4b,_0x1011de){_0x4a4d4b=_0x4a4d4b-0x0;var _0x64d754=_0xc9e5[_0x4a4d4b];return _0x64d754;};'use strict';var EventEmitter=require(_0x5c9e('0x0'));var SmsQueue=require(_0x5c9e('0x1'))['db'][_0x5c9e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5c9e('0x3')](0x0);var events={'afterCreate':_0x5c9e('0x4'),'afterUpdate':_0x5c9e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c300d){return function(_0x3b890b,_0x4839a1,_0x43768e){SmsQueueEvents[_0x5c9e('0x6')](_0x1c300d+':'+_0x3b890b['id'],_0x3b890b);SmsQueueEvents[_0x5c9e('0x6')](_0x1c300d,_0x3b890b);_0x43768e(null);};}for(var e in events){if(events[_0x5c9e('0x7')](e)){var event=events[e];SmsQueue[_0x5c9e('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x5ac6=['update','remove','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x587fe7,_0xe4bd7c){var _0x22db15=function(_0x582d10){while(--_0x582d10){_0x587fe7['push'](_0x587fe7['shift']());}};_0x22db15(++_0xe4bd7c);}(_0x5ac6,0x70));var _0x65ac=function(_0x403617,_0x1e1e85){_0x403617=_0x403617-0x0;var _0x4ded50=_0x5ac6[_0x403617];return _0x4ded50;};'use strict';var EventEmitter=require(_0x65ac('0x0'));var SmsQueue=require(_0x65ac('0x1'))['db'][_0x65ac('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x65ac('0x3')](0x0);var events={'afterCreate':_0x65ac('0x4'),'afterUpdate':_0x65ac('0x5'),'afterDestroy':_0x65ac('0x6')};function emitEvent(_0x2bdccf){return function(_0x4ab226,_0x310662,_0x3575e8){SmsQueueEvents['emit'](_0x2bdccf+':'+_0x4ab226['id'],_0x4ab226);SmsQueueEvents['emit'](_0x2bdccf,_0x4ab226);_0x3575e8(null);};}for(var e in events){if(events[_0x65ac('0x7')](e)){var event=events[e];SmsQueue[_0x65ac('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1923ac3..0030939 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 _0x54bf=['../../config/environment','define','SmsQueue','sms_queues','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x11f778,_0x41cae5){var _0x3f3284=function(_0x4c0c4f){while(--_0x4c0c4f){_0x11f778['push'](_0x11f778['shift']());}};_0x3f3284(++_0x41cae5);}(_0x54bf,0xc2));var _0xf54b=function(_0x205a8c,_0x2e367b){_0x205a8c=_0x205a8c-0x0;var _0x4250d5=_0x54bf[_0x205a8c];return _0x4250d5;};'use strict';var _=require(_0xf54b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf54b('0x1'));var moment=require('moment');var BPromise=require(_0xf54b('0x2'));var rp=require(_0xf54b('0x3'));var fs=require('fs');var path=require(_0xf54b('0x4'));var rimraf=require(_0xf54b('0x5'));var config=require(_0xf54b('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x1870bc,_0x436e3a){return _0x1870bc[_0xf54b('0x7')](_0xf54b('0x8'),attributes,{'tableName':_0xf54b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7455=['moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports','define','sms_queues','util','../../config/logger','api'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7455,0x17d));var _0x5745=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7455[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5745('0x0'));var logger=require(_0x5745('0x1'))(_0x5745('0x2'));var moment=require(_0x5745('0x3'));var BPromise=require(_0x5745('0x4'));var rp=require(_0x5745('0x5'));var fs=require('fs');var path=require(_0x5745('0x6'));var rimraf=require(_0x5745('0x7'));var config=require('../../config/environment');var attributes=require(_0x5745('0x8'));module[_0x5745('0x9')]=function(_0x1868cd,_0x3c06e6){return _0x1868cd[_0x5745('0xa')]('SmsQueue',attributes,{'tableName':_0x5745('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 affa652..9a0b2d2 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 _0xad4a=['localhost','socket.io-emitter','./smsQueue.socket','register','request','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result','findAll','options','raw','where','attributes','limit','map','include','model','GetSmsQueue','stringify','ShowSmsQueue','SmsQueue','find','then','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad4a,0x9f));var _0xaad4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xad4a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaad4('0x0'));var util=require('util');var moment=require(_0xaad4('0x1'));var BPromise=require('bluebird');var rs=require(_0xaad4('0x2'));var fs=require('fs');var Redis=require(_0xaad4('0x3'));var db=require(_0xaad4('0x4'))['db'];var utils=require(_0xaad4('0x5'));var logger=require(_0xaad4('0x6'))(_0xaad4('0x7'));var config=require('../../config/environment');var jayson=require(_0xaad4('0x8'));var client=jayson[_0xaad4('0x9')][_0xaad4('0xa')]({'port':0x232a});config[_0xaad4('0xb')]=_[_0xaad4('0xc')](config[_0xaad4('0xb')],{'host':_0xaad4('0xd'),'port':0x18eb});var socket=require(_0xaad4('0xe'))(new Redis(config[_0xaad4('0xb')]));require(_0xaad4('0xf'))[_0xaad4('0x10')](socket);function respondWithRpcPromise(_0x2ac21e,_0x39fee0,_0x46e73e){return new BPromise(function(_0x3b6af5,_0x51d811){return client[_0xaad4('0x11')](_0x2ac21e,_0x46e73e)['then'](function(_0x5c882b){logger[_0xaad4('0x12')]('SmsQueue,\x20%s,\x20%s',_0x39fee0,'request\x20sent');logger[_0xaad4('0x13')](_0xaad4('0x14'),_0x39fee0,'request\x20sent',JSON['stringify'](_0x5c882b));if(_0x5c882b['error']){if(_0x5c882b[_0xaad4('0x15')][_0xaad4('0x16')]===0x1f4){logger[_0xaad4('0x15')](_0xaad4('0x17'),_0x39fee0,_0x5c882b[_0xaad4('0x15')][_0xaad4('0x18')]);return _0x51d811(_0x5c882b['error'][_0xaad4('0x18')]);}logger['error'](_0xaad4('0x17'),_0x39fee0,_0x5c882b[_0xaad4('0x15')][_0xaad4('0x18')]);return _0x3b6af5(_0x5c882b[_0xaad4('0x15')][_0xaad4('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x39fee0,_0xaad4('0x19'));_0x3b6af5(_0x5c882b[_0xaad4('0x1a')]['message']);}})['catch'](function(_0xf7d94e){logger[_0xaad4('0x15')]('SmsQueue,\x20%s,\x20%s',_0x39fee0,_0xf7d94e);_0x51d811(_0xf7d94e);});});}exports['GetSmsQueue']=function(_0x3ede86){var _0x180fc2=this;return new Promise(function(_0x119dda,_0x77fbb){return db['SmsQueue'][_0xaad4('0x1b')]({'raw':_0x3ede86[_0xaad4('0x1c')]?_0x3ede86['options'][_0xaad4('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ede86['options']?_0x3ede86['options'][_0xaad4('0x1e')]||null:null,'attributes':_0x3ede86[_0xaad4('0x1c')]?_0x3ede86[_0xaad4('0x1c')][_0xaad4('0x1f')]||null:null,'limit':_0x3ede86['options']?_0x3ede86[_0xaad4('0x1c')][_0xaad4('0x20')]||null:null,'include':_0x3ede86[_0xaad4('0x1c')]?_0x3ede86[_0xaad4('0x1c')]['include']?_[_0xaad4('0x21')](_0x3ede86[_0xaad4('0x1c')][_0xaad4('0x22')],function(_0x2df26b){return{'model':db[_0x2df26b[_0xaad4('0x23')]],'as':_0x2df26b['as'],'attributes':_0x2df26b['attributes'],'include':_0x2df26b[_0xaad4('0x22')]?_[_0xaad4('0x21')](_0x2df26b[_0xaad4('0x22')],function(_0x14614f){return{'model':db[_0x14614f['model']],'as':_0x14614f['as'],'attributes':_0x14614f[_0xaad4('0x1f')],'include':_0x14614f[_0xaad4('0x22')]?_['map'](_0x14614f[_0xaad4('0x22')],function(_0x1479e8){return{'model':db[_0x1479e8[_0xaad4('0x23')]],'as':_0x1479e8['as'],'attributes':_0x1479e8[_0xaad4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34af77){logger[_0xaad4('0x12')](_0xaad4('0x24'),_0x3ede86);logger[_0xaad4('0x13')](_0xaad4('0x24'),_0x3ede86,JSON[_0xaad4('0x25')](_0x34af77));_0x119dda(_0x34af77);})['catch'](function(_0x4bdc96){logger[_0xaad4('0x15')]('GetSmsQueue',_0x4bdc96[_0xaad4('0x18')],_0x3ede86);_0x77fbb(_0x180fc2[_0xaad4('0x15')](0x1f4,_0x4bdc96['message']));});});};exports[_0xaad4('0x26')]=function(_0x5b6971){var _0x49d6cb=this;return new Promise(function(_0xac921d,_0x1eb2a8){return db[_0xaad4('0x27')][_0xaad4('0x28')]({'raw':_0x5b6971[_0xaad4('0x1c')]?_0x5b6971[_0xaad4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5b6971['options']?_0x5b6971[_0xaad4('0x1c')][_0xaad4('0x1e')]||null:null,'attributes':_0x5b6971[_0xaad4('0x1c')]?_0x5b6971[_0xaad4('0x1c')][_0xaad4('0x1f')]||null:null,'include':_0x5b6971[_0xaad4('0x1c')]?_0x5b6971[_0xaad4('0x1c')][_0xaad4('0x22')]?_[_0xaad4('0x21')](_0x5b6971['options']['include'],function(_0x561cb5){return{'model':db[_0x561cb5[_0xaad4('0x23')]],'as':_0x561cb5['as'],'attributes':_0x561cb5[_0xaad4('0x1f')],'include':_0x561cb5['include']?_['map'](_0x561cb5[_0xaad4('0x22')],function(_0x192c34){return{'model':db[_0x192c34[_0xaad4('0x23')]],'as':_0x192c34['as'],'attributes':_0x192c34['attributes'],'include':_0x192c34[_0xaad4('0x22')]?_[_0xaad4('0x21')](_0x192c34[_0xaad4('0x22')],function(_0xfbef2a){return{'model':db[_0xfbef2a[_0xaad4('0x23')]],'as':_0xfbef2a['as'],'attributes':_0xfbef2a[_0xaad4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaad4('0x29')](function(_0x256f37){logger[_0xaad4('0x12')](_0xaad4('0x26'),_0x5b6971);logger['debug'](_0xaad4('0x26'),_0x5b6971,JSON['stringify'](_0x256f37));_0xac921d(_0x256f37);})[_0xaad4('0x2a')](function(_0x1b9588){logger[_0xaad4('0x15')](_0xaad4('0x26'),_0x1b9588[_0xaad4('0x18')],_0x5b6971);_0x1eb2a8(_0x49d6cb[_0xaad4('0x15')](0x1f4,_0x1b9588[_0xaad4('0x18')]));});});}; \ No newline at end of file +var _0x4d84=['redis','socket.io-emitter','./smsQueue.socket','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowSmsQueue','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x1abb11,_0xd68915){var _0x149a9f=function(_0x5c74d5){while(--_0x5c74d5){_0x1abb11['push'](_0x1abb11['shift']());}};_0x149a9f(++_0xd68915);}(_0x4d84,0x132));var _0x44d8=function(_0x5bbb86,_0x31386a){_0x5bbb86=_0x5bbb86-0x0;var _0x41f61d=_0x4d84[_0x5bbb86];return _0x41f61d;};'use strict';var _=require(_0x44d8('0x0'));var util=require(_0x44d8('0x1'));var moment=require(_0x44d8('0x2'));var BPromise=require(_0x44d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44d8('0x4'));var db=require(_0x44d8('0x5'))['db'];var utils=require(_0x44d8('0x6'));var logger=require(_0x44d8('0x7'))(_0x44d8('0x8'));var config=require(_0x44d8('0x9'));var jayson=require(_0x44d8('0xa'));var client=jayson[_0x44d8('0xb')][_0x44d8('0xc')]({'port':0x232a});config['redis']=_[_0x44d8('0xd')](config[_0x44d8('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x44d8('0xf'))(new Redis(config[_0x44d8('0xe')]));require(_0x44d8('0x10'))['register'](socket);function respondWithRpcPromise(_0x445ed6,_0x581519,_0x2047f4){return new BPromise(function(_0x5b3480,_0x537ca7){return client['request'](_0x445ed6,_0x2047f4)[_0x44d8('0x11')](function(_0x22a9aa){logger[_0x44d8('0x12')](_0x44d8('0x13'),_0x581519,_0x44d8('0x14'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x581519,_0x44d8('0x14'),JSON['stringify'](_0x22a9aa));if(_0x22a9aa[_0x44d8('0x15')]){if(_0x22a9aa[_0x44d8('0x15')][_0x44d8('0x16')]===0x1f4){logger[_0x44d8('0x15')](_0x44d8('0x13'),_0x581519,_0x22a9aa[_0x44d8('0x15')][_0x44d8('0x17')]);return _0x537ca7(_0x22a9aa[_0x44d8('0x15')][_0x44d8('0x17')]);}logger[_0x44d8('0x15')](_0x44d8('0x13'),_0x581519,_0x22a9aa['error'][_0x44d8('0x17')]);return _0x5b3480(_0x22a9aa[_0x44d8('0x15')][_0x44d8('0x17')]);}else{logger[_0x44d8('0x12')](_0x44d8('0x13'),_0x581519,'request\x20sent');_0x5b3480(_0x22a9aa[_0x44d8('0x18')][_0x44d8('0x17')]);}})['catch'](function(_0x52f616){logger[_0x44d8('0x15')](_0x44d8('0x13'),_0x581519,_0x52f616);_0x537ca7(_0x52f616);});});}exports[_0x44d8('0x19')]=function(_0x121a8b){var _0x1e9c7c=this;return new Promise(function(_0x18c70c,_0x4f360a){return db[_0x44d8('0x1a')][_0x44d8('0x1b')]({'raw':_0x121a8b[_0x44d8('0x1c')]?_0x121a8b['options'][_0x44d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x121a8b[_0x44d8('0x1c')]?_0x121a8b['options'][_0x44d8('0x1e')]||null:null,'attributes':_0x121a8b['options']?_0x121a8b[_0x44d8('0x1c')][_0x44d8('0x1f')]||null:null,'limit':_0x121a8b[_0x44d8('0x1c')]?_0x121a8b[_0x44d8('0x1c')][_0x44d8('0x20')]||null:null,'include':_0x121a8b[_0x44d8('0x1c')]?_0x121a8b['options'][_0x44d8('0x21')]?_[_0x44d8('0x22')](_0x121a8b[_0x44d8('0x1c')]['include'],function(_0x25a7cc){return{'model':db[_0x25a7cc['model']],'as':_0x25a7cc['as'],'attributes':_0x25a7cc[_0x44d8('0x1f')],'include':_0x25a7cc[_0x44d8('0x21')]?_['map'](_0x25a7cc['include'],function(_0x240710){return{'model':db[_0x240710[_0x44d8('0x23')]],'as':_0x240710['as'],'attributes':_0x240710['attributes'],'include':_0x240710['include']?_['map'](_0x240710['include'],function(_0x531546){return{'model':db[_0x531546[_0x44d8('0x23')]],'as':_0x531546['as'],'attributes':_0x531546[_0x44d8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd3d1){logger[_0x44d8('0x12')](_0x44d8('0x19'),_0x121a8b);logger['debug']('GetSmsQueue',_0x121a8b,JSON[_0x44d8('0x24')](_0x3cd3d1));_0x18c70c(_0x3cd3d1);})[_0x44d8('0x25')](function(_0xe42665){logger['error']('GetSmsQueue',_0xe42665[_0x44d8('0x17')],_0x121a8b);_0x4f360a(_0x1e9c7c['error'](0x1f4,_0xe42665[_0x44d8('0x17')]));});});};exports[_0x44d8('0x26')]=function(_0x4363b3){var _0x5cc977=this;return new Promise(function(_0x3be457,_0xa78d50){return db[_0x44d8('0x1a')]['find']({'raw':_0x4363b3[_0x44d8('0x1c')]?_0x4363b3[_0x44d8('0x1c')][_0x44d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4363b3['options']?_0x4363b3[_0x44d8('0x1c')][_0x44d8('0x1e')]||null:null,'attributes':_0x4363b3[_0x44d8('0x1c')]?_0x4363b3[_0x44d8('0x1c')]['attributes']||null:null,'include':_0x4363b3[_0x44d8('0x1c')]?_0x4363b3['options'][_0x44d8('0x21')]?_['map'](_0x4363b3[_0x44d8('0x1c')][_0x44d8('0x21')],function(_0x5dc0c3){return{'model':db[_0x5dc0c3['model']],'as':_0x5dc0c3['as'],'attributes':_0x5dc0c3[_0x44d8('0x1f')],'include':_0x5dc0c3[_0x44d8('0x21')]?_[_0x44d8('0x22')](_0x5dc0c3[_0x44d8('0x21')],function(_0x4653e6){return{'model':db[_0x4653e6[_0x44d8('0x23')]],'as':_0x4653e6['as'],'attributes':_0x4653e6[_0x44d8('0x1f')],'include':_0x4653e6['include']?_[_0x44d8('0x22')](_0x4653e6[_0x44d8('0x21')],function(_0x1d77f9){return{'model':db[_0x1d77f9['model']],'as':_0x1d77f9['as'],'attributes':_0x1d77f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x44d8('0x11')](function(_0xcfb466){logger[_0x44d8('0x12')](_0x44d8('0x26'),_0x4363b3);logger[_0x44d8('0x27')](_0x44d8('0x26'),_0x4363b3,JSON[_0x44d8('0x24')](_0xcfb466));_0x3be457(_0xcfb466);})[_0x44d8('0x25')](function(_0x7715c1){logger[_0x44d8('0x15')](_0x44d8('0x26'),_0x7715c1['message'],_0x4363b3);_0xa78d50(_0x5cc977[_0x44d8('0x15')](0x1f4,_0x7715c1[_0x44d8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3b82c94..cba1bf0 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 _0x632d=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x632d,0x174));var _0xd632=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x632d[_0x9cd4c3];return _0x4c9025;};'use strict';var SmsQueueEvents=require(_0xd632('0x0'));var events=[_0xd632('0x1'),_0xd632('0x2'),_0xd632('0x3')];function createListener(_0x304d32,_0x1a11a2){return function(_0x49f3d5){_0x1a11a2['emit'](_0x304d32,_0x49f3d5);};}function removeListener(_0x14718b,_0x26031c){return function(){SmsQueueEvents[_0xd632('0x4')](_0x14718b,_0x26031c);};}exports[_0xd632('0x5')]=function(_0x4dbc45){for(var _0xf8beae=0x0,_0xc2a4d0=events[_0xd632('0x6')];_0xf8beae<_0xc2a4d0;_0xf8beae++){var _0x3c1e3b=events[_0xf8beae];var _0x539e42=createListener(_0xd632('0x7')+_0x3c1e3b,_0x4dbc45);SmsQueueEvents['on'](_0x3c1e3b,_0x539e42);}}; \ No newline at end of file +var _0x3154=['register','length','save','remove','update','removeListener'];(function(_0x5e269a,_0x3c7c20){var _0x4f2acc=function(_0x536d13){while(--_0x536d13){_0x5e269a['push'](_0x5e269a['shift']());}};_0x4f2acc(++_0x3c7c20);}(_0x3154,0x18e));var _0x4315=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3154[_0x5a776b];return _0xbbef59;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x4315('0x0'),_0x4315('0x1'),_0x4315('0x2')];function createListener(_0x36aa25,_0x11885d){return function(_0x8264d1){_0x11885d['emit'](_0x36aa25,_0x8264d1);};}function removeListener(_0xe9fb3b,_0x4bd518){return function(){SmsQueueEvents[_0x4315('0x3')](_0xe9fb3b,_0x4bd518);};}exports[_0x4315('0x4')]=function(_0x283a04){for(var _0x8f9fbc=0x0,_0x4073d9=events[_0x4315('0x5')];_0x8f9fbc<_0x4073d9;_0x8f9fbc++){var _0x43c4b0=events[_0x8f9fbc];var _0x5a8445=createListener('smsQueue:'+_0x43c4b0,_0x283a04);SmsQueueEvents['on'](_0x43c4b0,_0x5a8445);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index fb87a76..7e4904e 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 _0xb4b1=['index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x30ddee,_0x112b31){var _0xd48145=function(_0x4f2253){while(--_0x4f2253){_0x30ddee['push'](_0x30ddee['shift']());}};_0xd48145(++_0x112b31);}(_0xb4b1,0x1d3));var _0x1b4b=function(_0x60f9f,_0x39b2fd){_0x60f9f=_0x60f9f-0x0;var _0x1b1a97=_0xb4b1[_0x60f9f];return _0x1b1a97;};'use strict';var multer=require(_0x1b4b('0x0'));var util=require(_0x1b4b('0x1'));var path=require(_0x1b4b('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b4b('0x3'));var router=express[_0x1b4b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b4b('0x5'));router[_0x1b4b('0x6')]('/',auth[_0x1b4b('0x7')](),controller[_0x1b4b('0x8')]);router[_0x1b4b('0x6')](_0x1b4b('0x9'),auth[_0x1b4b('0x7')](),controller[_0x1b4b('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1b4b('0xb')]('/',auth[_0x1b4b('0x7')](),controller[_0x1b4b('0xc')]);router[_0x1b4b('0xd')](_0x1b4b('0xe'),auth['isAuthenticated'](),controller[_0x1b4b('0xf')]);router[_0x1b4b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1b4b('0x11')]);module[_0x1b4b('0x12')]=router; \ No newline at end of file +var _0x0298=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','update'];(function(_0x5a7cd0,_0x24a81d){var _0x4ab236=function(_0x29c69e){while(--_0x29c69e){_0x5a7cd0['push'](_0x5a7cd0['shift']());}};_0x4ab236(++_0x24a81d);}(_0x0298,0x95));var _0x8029=function(_0xb8f8ba,_0x56a48f){_0xb8f8ba=_0xb8f8ba-0x0;var _0x426419=_0x0298[_0xb8f8ba];return _0x426419;};'use strict';var multer=require(_0x8029('0x0'));var util=require('util');var path=require(_0x8029('0x1'));var timeout=require(_0x8029('0x2'));var express=require(_0x8029('0x3'));var router=express[_0x8029('0x4')]();var fs_extra=require(_0x8029('0x5'));var auth=require(_0x8029('0x6'));var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router['get']('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router['get'](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0xd')]);router[_0x8029('0xe')](_0x8029('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8029('0x10')]('/',auth[_0x8029('0xa')](),controller[_0x8029('0x11')]);router['put']('/:id',auth[_0x8029('0xa')](),controller[_0x8029('0x12')]);router['delete'](_0x8029('0xf'),auth['isAuthenticated'](),controller[_0x8029('0x13')]);module[_0x8029('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ec49da3..6f8bb78 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 _0x31c2=['moment','sequelize','STRING','DATE'];(function(_0x468964,_0x3373eb){var _0x516fad=function(_0x32b669){while(--_0x32b669){_0x468964['push'](_0x468964['shift']());}};_0x516fad(++_0x3373eb);}(_0x31c2,0x70));var _0x231c=function(_0x241960,_0x1cebc7){_0x241960=_0x241960-0x0;var _0x2afd11=_0x31c2[_0x241960];return _0x2afd11;};'use strict';var moment=require(_0x231c('0x0'));var Sequelize=require(_0x231c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x231c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x231c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x231c('0x3')]},'acceptAt':{'type':Sequelize[_0x231c('0x3')]},'exitAt':{'type':Sequelize[_0x231c('0x3')]},'reason':{'type':Sequelize[_0x231c('0x2')]}}; \ No newline at end of file +var _0x8e90=['DATE','sequelize','STRING'];(function(_0x455353,_0x36e376){var _0x18952f=function(_0xbf9937){while(--_0xbf9937){_0x455353['push'](_0x455353['shift']());}};_0x18952f(++_0x36e376);}(_0x8e90,0x11e));var _0x08e9=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x8e90[_0x507597];return _0x110a0f;};'use strict';var moment=require('moment');var Sequelize=require(_0x08e9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x08e9('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x08e9('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x08e9('0x2')]},'acceptAt':{'type':Sequelize[_0x08e9('0x2')]},'exitAt':{'type':Sequelize[_0x08e9('0x2')]},'reason':{'type':Sequelize[_0x08e9('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 51b2828..a78a6a8 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 _0x4d4d=['error','stack','name','index','SmsQueueReport','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','sendStatus'];(function(_0x4e696e,_0x1b98c0){var _0x4fbc29=function(_0x52010f){while(--_0x52010f){_0x4e696e['push'](_0x4e696e['shift']());}};_0x4fbc29(++_0x1b98c0);}(_0x4d4d,0x6a));var _0xd4d4=function(_0x3855bb,_0x4376c6){_0x3855bb=_0x3855bb-0x0;var _0x211cc2=_0x4d4d[_0x3855bb];return _0x211cc2;};'use strict';var emlformat=require(_0xd4d4('0x0'));var rimraf=require(_0xd4d4('0x1'));var zipdir=require(_0xd4d4('0x2'));var jsonpatch=require(_0xd4d4('0x3'));var rp=require('request-promise');var moment=require(_0xd4d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd4d4('0x5'));var util=require(_0xd4d4('0x6'));var path=require(_0xd4d4('0x7'));var sox=require(_0xd4d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd4d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd4d4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4d4('0xb'));var jsforce=require(_0xd4d4('0xc'));var deskjs=require(_0xd4d4('0xd'));var toCsv=require(_0xd4d4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4d4('0xf'));var authService=require(_0xd4d4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4d4('0x11'));var logger=require(_0xd4d4('0x12'))(_0xd4d4('0x13'));var utils=require('../../config/utils');var config=require(_0xd4d4('0x14'));var licenseUtil=require(_0xd4d4('0x15'));var db=require(_0xd4d4('0x16'))['db'];function respondWithStatusCode(_0x53e0ad,_0x5a4f6e){_0x5a4f6e=_0x5a4f6e||0xcc;return function(_0x460272){if(_0x460272){return _0x53e0ad['sendStatus'](_0x5a4f6e);}return _0x53e0ad[_0xd4d4('0x17')](_0x5a4f6e)[_0xd4d4('0x18')]();};}function respondWithResult(_0x15486a,_0x9a76ca){_0x9a76ca=_0x9a76ca||0xc8;return function(_0x41aec1){if(_0x41aec1){return _0x15486a[_0xd4d4('0x17')](_0x9a76ca)[_0xd4d4('0x19')](_0x41aec1);}};}function respondWithFilteredResult(_0x3d9ae7,_0x3f702f){return function(_0x14a007){if(_0x14a007){var _0x219be5=typeof _0x3f702f[_0xd4d4('0x1a')]===_0xd4d4('0x1b')&&typeof _0x3f702f[_0xd4d4('0x1c')]===_0xd4d4('0x1b');var _0x5fc30b=_0x14a007[_0xd4d4('0x1d')];var _0x32b61a=_0x219be5?0x0:_0x3f702f[_0xd4d4('0x1a')];var _0x57b8d9=_0x219be5?_0x14a007[_0xd4d4('0x1d')]:_0x3f702f[_0xd4d4('0x1a')]+_0x3f702f[_0xd4d4('0x1c')];var _0xe44478;if(_0x57b8d9>=_0x5fc30b){_0x57b8d9=_0x5fc30b;_0xe44478=0xc8;}else{_0xe44478=0xce;}_0x3d9ae7[_0xd4d4('0x17')](_0xe44478);return _0x3d9ae7['set'](_0xd4d4('0x1e'),_0x32b61a+'-'+_0x57b8d9+'/'+_0x5fc30b)[_0xd4d4('0x19')](_0x14a007);}return null;};}function patchUpdates(_0x18ebf7){return function(_0x18bc4d){try{jsonpatch[_0xd4d4('0x1f')](_0x18bc4d,_0x18ebf7,!![]);}catch(_0x349a5c){return BPromise[_0xd4d4('0x20')](_0x349a5c);}return _0x18bc4d['save']();};}function saveUpdates(_0x1d6b5a,_0x3717da){return function(_0x55ab17){if(_0x55ab17){return _0x55ab17[_0xd4d4('0x21')](_0x1d6b5a)['then'](function(_0x231b6d){return _0x231b6d;});}return null;};}function removeEntity(_0x2d3ff7,_0x44ad21){return function(_0x295d66){if(_0x295d66){return _0x295d66[_0xd4d4('0x22')]()['then'](function(){_0x2d3ff7['status'](0xcc)[_0xd4d4('0x18')]();});}};}function handleEntityNotFound(_0x54c9fb,_0x4e5195){return function(_0x2dac94){if(!_0x2dac94){_0x54c9fb[_0xd4d4('0x23')](0x194);}return _0x2dac94;};}function handleError(_0x15ac55,_0x187bbb){_0x187bbb=_0x187bbb||0x1f4;return function(_0x44e802){logger[_0xd4d4('0x24')](_0x44e802[_0xd4d4('0x25')]);if(_0x44e802[_0xd4d4('0x26')]){delete _0x44e802[_0xd4d4('0x26')];}_0x15ac55['status'](_0x187bbb)['send'](_0x44e802);};}exports[_0xd4d4('0x27')]=function(_0x3738fa,_0x1b089e){var _0x5ae7f8={},_0x3bfa3d={},_0x17211b={'count':0x0,'rows':[]};var _0x4088f=_['map'](db[_0xd4d4('0x28')]['rawAttributes'],function(_0x325add){return{'name':_0x325add[_0xd4d4('0x29')],'type':_0x325add['type']['key']};});_0x3bfa3d[_0xd4d4('0x2a')]=_[_0xd4d4('0x2b')](_0x4088f,_0xd4d4('0x26'));_0x3bfa3d[_0xd4d4('0x2c')]=_[_0xd4d4('0x2d')](_0x3738fa[_0xd4d4('0x2c')]);_0x3bfa3d[_0xd4d4('0x2e')]=_[_0xd4d4('0x2f')](_0x3bfa3d[_0xd4d4('0x2a')],_0x3bfa3d[_0xd4d4('0x2c')]);_0x5ae7f8[_0xd4d4('0x30')]=_[_0xd4d4('0x2f')](_0x3bfa3d['model'],qs[_0xd4d4('0x31')](_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x31')]));_0x5ae7f8['attributes']=_0x5ae7f8['attributes'][_0xd4d4('0x32')]?_0x5ae7f8[_0xd4d4('0x30')]:_0x3bfa3d['model'];if(!_0x3738fa['query'][_0xd4d4('0x33')](_0xd4d4('0x34'))){_0x5ae7f8[_0xd4d4('0x1c')]=qs[_0xd4d4('0x1c')](_0x3738fa['query'][_0xd4d4('0x1c')]);_0x5ae7f8[_0xd4d4('0x1a')]=qs['offset'](_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x1a')]);}_0x5ae7f8[_0xd4d4('0x35')]=qs[_0xd4d4('0x36')](_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x36')]);_0x5ae7f8['where']=qs[_0xd4d4('0x2e')](_['pick'](_0x3738fa[_0xd4d4('0x2c')],_0x3bfa3d['filters']),_0x4088f);if(_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x37')]){_0x5ae7f8[_0xd4d4('0x38')]=_[_0xd4d4('0x39')](_0x5ae7f8['where'],{'$or':_['map'](_0x4088f,function(_0x383e88){if(_0x383e88['type']!==_0xd4d4('0x3a')){var _0x344b79={};_0x344b79[_0x383e88[_0xd4d4('0x26')]]={'$like':'%'+_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x37')]+'%'};return _0x344b79;}})});}_0x5ae7f8=_[_0xd4d4('0x39')]({},_0x5ae7f8,_0x3738fa[_0xd4d4('0x3b')]);var _0x5607bd={'where':_0x5ae7f8[_0xd4d4('0x38')]};return db[_0xd4d4('0x28')]['count'](_0x5607bd)[_0xd4d4('0x3c')](function(_0x3b3ec0){_0x17211b[_0xd4d4('0x1d')]=_0x3b3ec0;if(_0x3738fa[_0xd4d4('0x2c')][_0xd4d4('0x3d')]){_0x5ae7f8['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xd4d4('0x3e')](_0x5ae7f8);})[_0xd4d4('0x3c')](function(_0x24c88c){_0x17211b[_0xd4d4('0x3f')]=_0x24c88c;return _0x17211b;})[_0xd4d4('0x3c')](respondWithFilteredResult(_0x1b089e,_0x5ae7f8))[_0xd4d4('0x40')](handleError(_0x1b089e,null));};exports[_0xd4d4('0x41')]=function(_0x4ed22a,_0x1756f6){var _0xfaa9a5={'raw':!![],'where':{'id':_0x4ed22a[_0xd4d4('0x42')]['id']}},_0x5486d3={};_0x5486d3[_0xd4d4('0x2a')]=_[_0xd4d4('0x2d')](db[_0xd4d4('0x28')]['rawAttributes']);_0x5486d3[_0xd4d4('0x2c')]=_[_0xd4d4('0x2d')](_0x4ed22a[_0xd4d4('0x2c')]);_0x5486d3[_0xd4d4('0x2e')]=_[_0xd4d4('0x2f')](_0x5486d3['model'],_0x5486d3['query']);_0xfaa9a5[_0xd4d4('0x30')]=_[_0xd4d4('0x2f')](_0x5486d3['model'],qs['fields'](_0x4ed22a['query'][_0xd4d4('0x31')]));_0xfaa9a5[_0xd4d4('0x30')]=_0xfaa9a5[_0xd4d4('0x30')][_0xd4d4('0x32')]?_0xfaa9a5['attributes']:_0x5486d3['model'];if(_0x4ed22a[_0xd4d4('0x2c')][_0xd4d4('0x3d')]){_0xfaa9a5['include']=[{'all':!![]}];}_0xfaa9a5=_[_0xd4d4('0x39')]({},_0xfaa9a5,_0x4ed22a['options']);return db[_0xd4d4('0x28')][_0xd4d4('0x43')](_0xfaa9a5)['then'](handleEntityNotFound(_0x1756f6,null))[_0xd4d4('0x3c')](respondWithResult(_0x1756f6,null))[_0xd4d4('0x40')](handleError(_0x1756f6,null));};exports[_0xd4d4('0x44')]=function(_0x152b79,_0x1d05ba){return db[_0xd4d4('0x28')][_0xd4d4('0x44')](_0x152b79[_0xd4d4('0x45')],{})[_0xd4d4('0x3c')](respondWithResult(_0x1d05ba,0xc9))[_0xd4d4('0x40')](handleError(_0x1d05ba,null));};exports[_0xd4d4('0x21')]=function(_0x337e1f,_0x1c6bee){if(_0x337e1f[_0xd4d4('0x45')]['id']){delete _0x337e1f[_0xd4d4('0x45')]['id'];}return db[_0xd4d4('0x28')]['find']({'where':{'id':_0x337e1f['params']['id']}})[_0xd4d4('0x3c')](handleEntityNotFound(_0x1c6bee,null))[_0xd4d4('0x3c')](saveUpdates(_0x337e1f[_0xd4d4('0x45')],null))[_0xd4d4('0x3c')](respondWithResult(_0x1c6bee,null))[_0xd4d4('0x40')](handleError(_0x1c6bee,null));};exports[_0xd4d4('0x22')]=function(_0x39d9d8,_0x5da461){return db[_0xd4d4('0x28')][_0xd4d4('0x43')]({'where':{'id':_0x39d9d8[_0xd4d4('0x42')]['id']}})[_0xd4d4('0x3c')](handleEntityNotFound(_0x5da461,null))['then'](removeEntity(_0x5da461,null))['catch'](handleError(_0x5da461,null));};exports[_0xd4d4('0x46')]=function(_0x275122,_0x4a7351){return db[_0xd4d4('0x28')][_0xd4d4('0x46')]()['then'](respondWithResult(_0x4a7351,null))[_0xd4d4('0x40')](handleError(_0x4a7351,null));}; \ No newline at end of file +var _0x5b0c=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','SmsQueueReport','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x49b65e,_0x326954){var _0x3a18a5=function(_0x528944){while(--_0x528944){_0x49b65e['push'](_0x49b65e['shift']());}};_0x3a18a5(++_0x326954);}(_0x5b0c,0x88));var _0xc5b0=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x5b0c[_0x33e4a7];return _0x598620;};'use strict';var emlformat=require(_0xc5b0('0x0'));var rimraf=require(_0xc5b0('0x1'));var zipdir=require(_0xc5b0('0x2'));var jsonpatch=require(_0xc5b0('0x3'));var rp=require(_0xc5b0('0x4'));var moment=require(_0xc5b0('0x5'));var BPromise=require(_0xc5b0('0x6'));var Mustache=require(_0xc5b0('0x7'));var util=require('util');var path=require(_0xc5b0('0x8'));var sox=require(_0xc5b0('0x9'));var csv=require(_0xc5b0('0xa'));var ejs=require(_0xc5b0('0xb'));var fs=require('fs');var fs_extra=require(_0xc5b0('0xc'));var _=require(_0xc5b0('0xd'));var squel=require(_0xc5b0('0xe'));var crypto=require(_0xc5b0('0xf'));var jsforce=require(_0xc5b0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc5b0('0xa'));var querystring=require(_0xc5b0('0x11'));var Papa=require('papaparse');var Redis=require(_0xc5b0('0x12'));var authService=require(_0xc5b0('0x13'));var qs=require(_0xc5b0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5b0('0x15'));var logger=require(_0xc5b0('0x16'))(_0xc5b0('0x17'));var utils=require(_0xc5b0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc5b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9bcc5,_0xfcffc1){_0xfcffc1=_0xfcffc1||0xcc;return function(_0x287ada){if(_0x287ada){return _0x9bcc5[_0xc5b0('0x1a')](_0xfcffc1);}return _0x9bcc5['status'](_0xfcffc1)[_0xc5b0('0x1b')]();};}function respondWithResult(_0x428e77,_0x17624f){_0x17624f=_0x17624f||0xc8;return function(_0x4463f6){if(_0x4463f6){return _0x428e77[_0xc5b0('0x1c')](_0x17624f)[_0xc5b0('0x1d')](_0x4463f6);}};}function respondWithFilteredResult(_0x3d79eb,_0x45dd17){return function(_0x1d3a89){if(_0x1d3a89){var _0x98a113=typeof _0x45dd17['offset']===_0xc5b0('0x1e')&&typeof _0x45dd17[_0xc5b0('0x1f')]===_0xc5b0('0x1e');var _0xbe30a2=_0x1d3a89[_0xc5b0('0x20')];var _0xd12d0a=_0x98a113?0x0:_0x45dd17[_0xc5b0('0x21')];var _0x376b6d=_0x98a113?_0x1d3a89[_0xc5b0('0x20')]:_0x45dd17[_0xc5b0('0x21')]+_0x45dd17[_0xc5b0('0x1f')];var _0x584d87;if(_0x376b6d>=_0xbe30a2){_0x376b6d=_0xbe30a2;_0x584d87=0xc8;}else{_0x584d87=0xce;}_0x3d79eb['status'](_0x584d87);return _0x3d79eb[_0xc5b0('0x22')](_0xc5b0('0x23'),_0xd12d0a+'-'+_0x376b6d+'/'+_0xbe30a2)[_0xc5b0('0x1d')](_0x1d3a89);}return null;};}function patchUpdates(_0x3f25ca){return function(_0x45c062){try{jsonpatch[_0xc5b0('0x24')](_0x45c062,_0x3f25ca,!![]);}catch(_0x4b4573){return BPromise[_0xc5b0('0x25')](_0x4b4573);}return _0x45c062['save']();};}function saveUpdates(_0x15310e,_0x142c51){return function(_0x2fc864){if(_0x2fc864){return _0x2fc864[_0xc5b0('0x26')](_0x15310e)[_0xc5b0('0x27')](function(_0x4751f2){return _0x4751f2;});}return null;};}function removeEntity(_0x3b8b62,_0x4db9b8){return function(_0x130573){if(_0x130573){return _0x130573[_0xc5b0('0x28')]()[_0xc5b0('0x27')](function(){_0x3b8b62['status'](0xcc)[_0xc5b0('0x1b')]();});}};}function handleEntityNotFound(_0x12b900,_0x5a673a){return function(_0x311aae){if(!_0x311aae){_0x12b900['sendStatus'](0x194);}return _0x311aae;};}function handleError(_0x56ed9a,_0x3f532e){_0x3f532e=_0x3f532e||0x1f4;return function(_0x3b12c9){logger[_0xc5b0('0x29')](_0x3b12c9[_0xc5b0('0x2a')]);if(_0x3b12c9[_0xc5b0('0x2b')]){delete _0x3b12c9[_0xc5b0('0x2b')];}_0x56ed9a['status'](_0x3f532e)[_0xc5b0('0x2c')](_0x3b12c9);};}exports[_0xc5b0('0x2d')]=function(_0x262236,_0x4120d3){var _0x51847c={},_0x5a83ae={},_0x1014e1={'count':0x0,'rows':[]};var _0x12c0ce=_[_0xc5b0('0x2e')](db['SmsQueueReport'][_0xc5b0('0x2f')],function(_0x67abc9){return{'name':_0x67abc9[_0xc5b0('0x30')],'type':_0x67abc9[_0xc5b0('0x31')][_0xc5b0('0x32')]};});_0x5a83ae[_0xc5b0('0x33')]=_['map'](_0x12c0ce,_0xc5b0('0x2b'));_0x5a83ae[_0xc5b0('0x34')]=_[_0xc5b0('0x35')](_0x262236[_0xc5b0('0x34')]);_0x5a83ae[_0xc5b0('0x36')]=_[_0xc5b0('0x37')](_0x5a83ae[_0xc5b0('0x33')],_0x5a83ae[_0xc5b0('0x34')]);_0x51847c[_0xc5b0('0x38')]=_[_0xc5b0('0x37')](_0x5a83ae[_0xc5b0('0x33')],qs['fields'](_0x262236[_0xc5b0('0x34')][_0xc5b0('0x39')]));_0x51847c['attributes']=_0x51847c['attributes'][_0xc5b0('0x3a')]?_0x51847c['attributes']:_0x5a83ae['model'];if(!_0x262236[_0xc5b0('0x34')][_0xc5b0('0x3b')](_0xc5b0('0x3c'))){_0x51847c[_0xc5b0('0x1f')]=qs[_0xc5b0('0x1f')](_0x262236[_0xc5b0('0x34')][_0xc5b0('0x1f')]);_0x51847c[_0xc5b0('0x21')]=qs[_0xc5b0('0x21')](_0x262236[_0xc5b0('0x34')][_0xc5b0('0x21')]);}_0x51847c[_0xc5b0('0x3d')]=qs[_0xc5b0('0x3e')](_0x262236[_0xc5b0('0x34')][_0xc5b0('0x3e')]);_0x51847c['where']=qs['filters'](_[_0xc5b0('0x3f')](_0x262236[_0xc5b0('0x34')],_0x5a83ae['filters']),_0x12c0ce);if(_0x262236[_0xc5b0('0x34')][_0xc5b0('0x40')]){_0x51847c[_0xc5b0('0x41')]=_[_0xc5b0('0x42')](_0x51847c[_0xc5b0('0x41')],{'$or':_[_0xc5b0('0x2e')](_0x12c0ce,function(_0x253e46){if(_0x253e46[_0xc5b0('0x31')]!=='VIRTUAL'){var _0x4f8f46={};_0x4f8f46[_0x253e46['name']]={'$like':'%'+_0x262236[_0xc5b0('0x34')][_0xc5b0('0x40')]+'%'};return _0x4f8f46;}})});}_0x51847c=_[_0xc5b0('0x42')]({},_0x51847c,_0x262236[_0xc5b0('0x43')]);var _0x2ede20={'where':_0x51847c[_0xc5b0('0x41')]};return db['SmsQueueReport']['count'](_0x2ede20)[_0xc5b0('0x27')](function(_0x3643ee){_0x1014e1[_0xc5b0('0x20')]=_0x3643ee;if(_0x262236['query'][_0xc5b0('0x44')]){_0x51847c['include']=[{'all':!![]}];}return db[_0xc5b0('0x45')][_0xc5b0('0x46')](_0x51847c);})['then'](function(_0x441969){_0x1014e1['rows']=_0x441969;return _0x1014e1;})[_0xc5b0('0x27')](respondWithFilteredResult(_0x4120d3,_0x51847c))[_0xc5b0('0x47')](handleError(_0x4120d3,null));};exports[_0xc5b0('0x48')]=function(_0x30d2b0,_0x14addd){var _0x2dee65={'raw':!![],'where':{'id':_0x30d2b0['params']['id']}},_0x319366={};_0x319366[_0xc5b0('0x33')]=_[_0xc5b0('0x35')](db['SmsQueueReport']['rawAttributes']);_0x319366[_0xc5b0('0x34')]=_['keys'](_0x30d2b0[_0xc5b0('0x34')]);_0x319366[_0xc5b0('0x36')]=_[_0xc5b0('0x37')](_0x319366[_0xc5b0('0x33')],_0x319366['query']);_0x2dee65['attributes']=_['intersection'](_0x319366[_0xc5b0('0x33')],qs[_0xc5b0('0x39')](_0x30d2b0[_0xc5b0('0x34')][_0xc5b0('0x39')]));_0x2dee65[_0xc5b0('0x38')]=_0x2dee65[_0xc5b0('0x38')][_0xc5b0('0x3a')]?_0x2dee65[_0xc5b0('0x38')]:_0x319366[_0xc5b0('0x33')];if(_0x30d2b0['query'][_0xc5b0('0x44')]){_0x2dee65['include']=[{'all':!![]}];}_0x2dee65=_[_0xc5b0('0x42')]({},_0x2dee65,_0x30d2b0['options']);return db[_0xc5b0('0x45')][_0xc5b0('0x49')](_0x2dee65)[_0xc5b0('0x27')](handleEntityNotFound(_0x14addd,null))[_0xc5b0('0x27')](respondWithResult(_0x14addd,null))[_0xc5b0('0x47')](handleError(_0x14addd,null));};exports[_0xc5b0('0x4a')]=function(_0x402554,_0x3ac9aa){return db[_0xc5b0('0x45')][_0xc5b0('0x4a')](_0x402554[_0xc5b0('0x4b')],{})[_0xc5b0('0x27')](respondWithResult(_0x3ac9aa,0xc9))[_0xc5b0('0x47')](handleError(_0x3ac9aa,null));};exports[_0xc5b0('0x26')]=function(_0x10ed2d,_0x190d69){if(_0x10ed2d['body']['id']){delete _0x10ed2d[_0xc5b0('0x4b')]['id'];}return db[_0xc5b0('0x45')][_0xc5b0('0x49')]({'where':{'id':_0x10ed2d[_0xc5b0('0x4c')]['id']}})[_0xc5b0('0x27')](handleEntityNotFound(_0x190d69,null))['then'](saveUpdates(_0x10ed2d['body'],null))[_0xc5b0('0x27')](respondWithResult(_0x190d69,null))[_0xc5b0('0x47')](handleError(_0x190d69,null));};exports[_0xc5b0('0x28')]=function(_0x56c46d,_0x8c1509){return db[_0xc5b0('0x45')][_0xc5b0('0x49')]({'where':{'id':_0x56c46d[_0xc5b0('0x4c')]['id']}})[_0xc5b0('0x27')](handleEntityNotFound(_0x8c1509,null))[_0xc5b0('0x27')](removeEntity(_0x8c1509,null))[_0xc5b0('0x47')](handleError(_0x8c1509,null));};exports[_0xc5b0('0x4d')]=function(_0x2878d,_0x2e0c6c){return db[_0xc5b0('0x45')][_0xc5b0('0x4d')]()[_0xc5b0('0x27')](respondWithResult(_0x2e0c6c,null))[_0xc5b0('0x47')](handleError(_0x2e0c6c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index caf20b6..3b665cc 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x1b4aa0,_0x24f3aa){var _0x24d0b1=function(_0xbcff02){while(--_0xbcff02){_0x1b4aa0['push'](_0x1b4aa0['shift']());}};_0x24d0b1(++_0x24f3aa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 28c57d6..9c0cb62 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 _0x778c=['moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','debug','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','util'];(function(_0x4adf20,_0x41cc23){var _0x5e2b5b=function(_0x44414e){while(--_0x44414e){_0x4adf20['push'](_0x4adf20['shift']());}};_0x5e2b5b(++_0x41cc23);}(_0x778c,0x1b8));var _0xc778=function(_0x5dc2fa,_0x56279d){_0x5dc2fa=_0x5dc2fa-0x0;var _0x16eaf9=_0x778c[_0x5dc2fa];return _0x16eaf9;};'use strict';var _=require(_0xc778('0x0'));var util=require(_0xc778('0x1'));var moment=require(_0xc778('0x2'));var BPromise=require('bluebird');var rs=require(_0xc778('0x3'));var fs=require('fs');var Redis=require(_0xc778('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc778('0x5'))(_0xc778('0x6'));var config=require('../../config/environment');var jayson=require(_0xc778('0x7'));var client=jayson[_0xc778('0x8')][_0xc778('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ed33,_0x2be366,_0x2f9bce){return new BPromise(function(_0x19a1b0,_0x1b154d){return client[_0xc778('0xa')](_0x27ed33,_0x2f9bce)[_0xc778('0xb')](function(_0x4255c4){logger[_0xc778('0xc')](_0xc778('0xd'),_0x2be366,'request\x20sent');logger['debug'](_0xc778('0xe'),_0x2be366,_0xc778('0xf'),JSON[_0xc778('0x10')](_0x4255c4));if(_0x4255c4['error']){if(_0x4255c4[_0xc778('0x11')][_0xc778('0x12')]===0x1f4){logger[_0xc778('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2be366,_0x4255c4[_0xc778('0x11')][_0xc778('0x13')]);return _0x1b154d(_0x4255c4[_0xc778('0x11')][_0xc778('0x13')]);}logger[_0xc778('0x11')](_0xc778('0xd'),_0x2be366,_0x4255c4[_0xc778('0x11')][_0xc778('0x13')]);return _0x19a1b0(_0x4255c4['error'][_0xc778('0x13')]);}else{logger['info'](_0xc778('0xd'),_0x2be366,_0xc778('0xf'));_0x19a1b0(_0x4255c4[_0xc778('0x14')]['message']);}})[_0xc778('0x15')](function(_0x4651aa){logger[_0xc778('0x11')](_0xc778('0xd'),_0x2be366,_0x4651aa);_0x1b154d(_0x4651aa);});});}exports[_0xc778('0x16')]=function(_0x2647b7){var _0x58ab6e=this;return new Promise(function(_0x35cbfb,_0x2418e9){return db[_0xc778('0x17')][_0xc778('0x18')](_0x2647b7[_0xc778('0x19')],{'raw':_0x2647b7[_0xc778('0x1a')]?_0x2647b7[_0xc778('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc778('0xb')](function(_0x39b2d6){logger[_0xc778('0xc')]('CreateSmsQueueReport',_0x2647b7);logger[_0xc778('0x1b')](_0xc778('0x16'),_0x2647b7,JSON[_0xc778('0x10')](_0x39b2d6));_0x35cbfb(_0x39b2d6);})['catch'](function(_0x10a849){logger[_0xc778('0x11')](_0xc778('0x16'),_0x10a849[_0xc778('0x13')],_0x2647b7);_0x2418e9(_0x58ab6e[_0xc778('0x11')](0x1f4,_0x10a849[_0xc778('0x13')]));});});};exports[_0xc778('0x1c')]=function(_0x1cf9ef){var _0x1601e1=this;return new Promise(function(_0x493e2d,_0x26bebc){return db[_0xc778('0x17')][_0xc778('0x1d')](_0x1cf9ef[_0xc778('0x19')],{'raw':_0x1cf9ef['options']?_0x1cf9ef[_0xc778('0x1a')][_0xc778('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cf9ef[_0xc778('0x1a')]?_0x1cf9ef[_0xc778('0x1a')][_0xc778('0x1f')]||null:null,'attributes':_0x1cf9ef['options']?_0x1cf9ef[_0xc778('0x1a')][_0xc778('0x20')]||null:null,'limit':_0x1cf9ef[_0xc778('0x1a')]?_0x1cf9ef[_0xc778('0x1a')][_0xc778('0x21')]||null:null})['then'](function(_0x22ac76){logger['info'](_0xc778('0x1c'),_0x1cf9ef);logger[_0xc778('0x1b')](_0xc778('0x1c'),_0x1cf9ef,JSON['stringify'](_0x22ac76));_0x493e2d(_0x22ac76);})[_0xc778('0x15')](function(_0x2fd897){logger[_0xc778('0x11')](_0xc778('0x1c'),_0x2fd897[_0xc778('0x13')],_0x1cf9ef);_0x26bebc(_0x1601e1['error'](0x1f4,_0x2fd897['message']));});});}; \ No newline at end of file +var _0xf15c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','SmsQueueReport','create','options','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','body','raw','then','lodash','util','moment','bluebird'];(function(_0x4f75a9,_0x3af473){var _0x3dcf80=function(_0x2f583c){while(--_0x2f583c){_0x4f75a9['push'](_0x4f75a9['shift']());}};_0x3dcf80(++_0x3af473);}(_0xf15c,0x10a));var _0xcf15=function(_0x50ec59,_0x55de51){_0x50ec59=_0x50ec59-0x0;var _0x46087f=_0xf15c[_0x50ec59];return _0x46087f;};'use strict';var _=require(_0xcf15('0x0'));var util=require(_0xcf15('0x1'));var moment=require(_0xcf15('0x2'));var BPromise=require(_0xcf15('0x3'));var rs=require(_0xcf15('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf15('0x5'))['db'];var utils=require(_0xcf15('0x6'));var logger=require(_0xcf15('0x7'))('rpc');var config=require(_0xcf15('0x8'));var jayson=require(_0xcf15('0x9'));var client=jayson[_0xcf15('0xa')][_0xcf15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3661f5,_0x4aeb74,_0x18e14f){return new BPromise(function(_0x315b2b,_0x1bb858){return client['request'](_0x3661f5,_0x18e14f)['then'](function(_0x58a5c6){logger[_0xcf15('0xc')](_0xcf15('0xd'),_0x4aeb74,_0xcf15('0xe'));logger[_0xcf15('0xf')](_0xcf15('0x10'),_0x4aeb74,_0xcf15('0xe'),JSON['stringify'](_0x58a5c6));if(_0x58a5c6[_0xcf15('0x11')]){if(_0x58a5c6['error']['code']===0x1f4){logger[_0xcf15('0x11')](_0xcf15('0xd'),_0x4aeb74,_0x58a5c6[_0xcf15('0x11')][_0xcf15('0x12')]);return _0x1bb858(_0x58a5c6[_0xcf15('0x11')][_0xcf15('0x12')]);}logger[_0xcf15('0x11')](_0xcf15('0xd'),_0x4aeb74,_0x58a5c6['error'][_0xcf15('0x12')]);return _0x315b2b(_0x58a5c6[_0xcf15('0x11')][_0xcf15('0x12')]);}else{logger['info'](_0xcf15('0xd'),_0x4aeb74,_0xcf15('0xe'));_0x315b2b(_0x58a5c6['result'][_0xcf15('0x12')]);}})[_0xcf15('0x13')](function(_0x56895d){logger[_0xcf15('0x11')](_0xcf15('0xd'),_0x4aeb74,_0x56895d);_0x1bb858(_0x56895d);});});}exports['CreateSmsQueueReport']=function(_0x343480){var _0x65017b=this;return new Promise(function(_0x2af936,_0x3c83d5){return db[_0xcf15('0x14')][_0xcf15('0x15')](_0x343480['body'],{'raw':_0x343480[_0xcf15('0x16')]?_0x343480[_0xcf15('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4290c1){logger['info'](_0xcf15('0x17'),_0x343480);logger[_0xcf15('0xf')](_0xcf15('0x17'),_0x343480,JSON[_0xcf15('0x18')](_0x4290c1));_0x2af936(_0x4290c1);})[_0xcf15('0x13')](function(_0x45223d){logger[_0xcf15('0x11')](_0xcf15('0x17'),_0x45223d[_0xcf15('0x12')],_0x343480);_0x3c83d5(_0x65017b[_0xcf15('0x11')](0x1f4,_0x45223d['message']));});});};exports[_0xcf15('0x19')]=function(_0x4d8697){var _0x3a0d27=this;return new Promise(function(_0x40c294,_0x7286c){return db[_0xcf15('0x14')][_0xcf15('0x1a')](_0x4d8697[_0xcf15('0x1b')],{'raw':_0x4d8697[_0xcf15('0x16')]?_0x4d8697['options'][_0xcf15('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8697[_0xcf15('0x16')]?_0x4d8697[_0xcf15('0x16')]['where']||null:null,'attributes':_0x4d8697[_0xcf15('0x16')]?_0x4d8697[_0xcf15('0x16')]['attributes']||null:null,'limit':_0x4d8697[_0xcf15('0x16')]?_0x4d8697['options']['limit']||null:null})[_0xcf15('0x1d')](function(_0x1348ca){logger[_0xcf15('0xc')](_0xcf15('0x19'),_0x4d8697);logger['debug'](_0xcf15('0x19'),_0x4d8697,JSON[_0xcf15('0x18')](_0x1348ca));_0x40c294(_0x1348ca);})[_0xcf15('0x13')](function(_0x20445c){logger['error']('UpdateSmsQueueReport',_0x20445c[_0xcf15('0x12')],_0x4d8697);_0x7286c(_0x3a0d27[_0xcf15('0x11')](0x1f4,_0x20445c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 164f6e5..39ac458 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 _0x72b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0xbaff2e,_0x12dd53){var _0x10eeac=function(_0x37e3d0){while(--_0x37e3d0){_0xbaff2e['push'](_0xbaff2e['shift']());}};_0x10eeac(++_0x12dd53);}(_0x72b1,0x16e));var _0x172b=function(_0xa60f4c,_0x3d15d6){_0xa60f4c=_0xa60f4c-0x0;var _0x31b129=_0x72b1[_0xa60f4c];return _0x31b129;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router['get'](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0xf')]);router[_0x172b('0x10')]('/',auth['isAuthenticated'](),controller[_0x172b('0x11')]);router[_0x172b('0x12')](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0x13')]);router[_0x172b('0x14')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0x15')]);module[_0x172b('0x16')]=router; \ No newline at end of file +var _0x1b20=['show','post','create','put','/:id','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x19e278,_0x61439f){var _0x5a4577=function(_0x346ab7){while(--_0x346ab7){_0x19e278['push'](_0x19e278['shift']());}};_0x5a4577(++_0x61439f);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['describe']);router[_0x01b2('0x8')]('/:id',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0xd')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0xf')](_0x01b2('0x10'),auth[_0x01b2('0x9')](),controller['update']);router[_0x01b2('0x11')]('/:id',auth[_0x01b2('0x9')](),controller['destroy']);module[_0x01b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2bf5ff9..a656a46 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x45535d,_0x2960c6){var _0x186e5a=function(_0x8596d5){while(--_0x8596d5){_0x45535d['push'](_0x45535d['shift']());}};_0x186e5a(++_0x2960c6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x4b84[_0x1196b0];return _0x111c52;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x5174f6,_0xd5522){var _0x25b5df=function(_0x7b50c9){while(--_0x7b50c9){_0x5174f6['push'](_0x5174f6['shift']());}};_0x25b5df(++_0xd5522);}(_0xe706,0xa3));var _0x6e70=function(_0x174583,_0x468485){_0x174583=_0x174583-0x0;var _0x14e46f=_0xe706[_0x174583];return _0x14e46f;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index fce14c5..6771669 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 _0xa12a=['order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','SmsTransferReport','rows','catch','show','length','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','limit'];(function(_0x8aadb9,_0x14baa9){var _0x3bbefa=function(_0x405d7e){while(--_0x405d7e){_0x8aadb9['push'](_0x8aadb9['shift']());}};_0x3bbefa(++_0x14baa9);}(_0xa12a,0x187));var _0xaa12=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa12a[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa12('0x0'));var zipdir=require(_0xaa12('0x1'));var jsonpatch=require(_0xaa12('0x2'));var rp=require('request-promise');var moment=require(_0xaa12('0x3'));var BPromise=require(_0xaa12('0x4'));var Mustache=require(_0xaa12('0x5'));var util=require(_0xaa12('0x6'));var path=require(_0xaa12('0x7'));var sox=require(_0xaa12('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa12('0x9'));var _=require(_0xaa12('0xa'));var squel=require('squel');var crypto=require(_0xaa12('0xb'));var jsforce=require(_0xaa12('0xc'));var deskjs=require(_0xaa12('0xd'));var toCsv=require(_0xaa12('0xe'));var querystring=require(_0xaa12('0xf'));var Papa=require(_0xaa12('0x10'));var Redis=require(_0xaa12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa12('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa12('0x13'));var utils=require(_0xaa12('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaa12('0x15'));var db=require(_0xaa12('0x16'))['db'];function respondWithStatusCode(_0x4c998f,_0x39cb21){_0x39cb21=_0x39cb21||0xcc;return function(_0x1b6e31){if(_0x1b6e31){return _0x4c998f[_0xaa12('0x17')](_0x39cb21);}return _0x4c998f[_0xaa12('0x18')](_0x39cb21)[_0xaa12('0x19')]();};}function respondWithResult(_0x52a4de,_0x391b64){_0x391b64=_0x391b64||0xc8;return function(_0x6ff55){if(_0x6ff55){return _0x52a4de[_0xaa12('0x18')](_0x391b64)['json'](_0x6ff55);}};}function respondWithFilteredResult(_0x28126e,_0x5456c3){return function(_0x2444ee){if(_0x2444ee){var _0x3311bf=typeof _0x5456c3[_0xaa12('0x1a')]===_0xaa12('0x1b')&&typeof _0x5456c3['limit']===_0xaa12('0x1b');var _0x43962d=_0x2444ee[_0xaa12('0x1c')];var _0x390902=_0x3311bf?0x0:_0x5456c3[_0xaa12('0x1a')];var _0xd48da9=_0x3311bf?_0x2444ee[_0xaa12('0x1c')]:_0x5456c3[_0xaa12('0x1a')]+_0x5456c3['limit'];var _0x1bdb73;if(_0xd48da9>=_0x43962d){_0xd48da9=_0x43962d;_0x1bdb73=0xc8;}else{_0x1bdb73=0xce;}_0x28126e[_0xaa12('0x18')](_0x1bdb73);return _0x28126e[_0xaa12('0x1d')](_0xaa12('0x1e'),_0x390902+'-'+_0xd48da9+'/'+_0x43962d)[_0xaa12('0x1f')](_0x2444ee);}return null;};}function patchUpdates(_0x5944e7){return function(_0x15ea4d){try{jsonpatch[_0xaa12('0x20')](_0x15ea4d,_0x5944e7,!![]);}catch(_0x308a60){return BPromise[_0xaa12('0x21')](_0x308a60);}return _0x15ea4d[_0xaa12('0x22')]();};}function saveUpdates(_0x5302c9,_0x2d01a8){return function(_0x3b9a67){if(_0x3b9a67){return _0x3b9a67[_0xaa12('0x23')](_0x5302c9)[_0xaa12('0x24')](function(_0x1066df){return _0x1066df;});}return null;};}function removeEntity(_0x4d6825,_0x118408){return function(_0x1a6dd1){if(_0x1a6dd1){return _0x1a6dd1[_0xaa12('0x25')]()[_0xaa12('0x24')](function(){_0x4d6825[_0xaa12('0x18')](0xcc)[_0xaa12('0x19')]();});}};}function handleEntityNotFound(_0x5382f0,_0x501513){return function(_0x12c9c7){if(!_0x12c9c7){_0x5382f0[_0xaa12('0x17')](0x194);}return _0x12c9c7;};}function handleError(_0x23a1e6,_0x3692d9){_0x3692d9=_0x3692d9||0x1f4;return function(_0x25d69b){logger['error'](_0x25d69b[_0xaa12('0x26')]);if(_0x25d69b[_0xaa12('0x27')]){delete _0x25d69b[_0xaa12('0x27')];}_0x23a1e6[_0xaa12('0x18')](_0x3692d9)['send'](_0x25d69b);};}exports[_0xaa12('0x28')]=function(_0x1fb8d6,_0x8d8e76){var _0xf6874f={},_0x422cfa={},_0x43bee2={'count':0x0,'rows':[]};var _0x2c524c=_['map'](db['SmsTransferReport'][_0xaa12('0x29')],function(_0xb0f670){return{'name':_0xb0f670[_0xaa12('0x2a')],'type':_0xb0f670[_0xaa12('0x2b')][_0xaa12('0x2c')]};});_0x422cfa['model']=_['map'](_0x2c524c,_0xaa12('0x27'));_0x422cfa[_0xaa12('0x2d')]=_[_0xaa12('0x2e')](_0x1fb8d6['query']);_0x422cfa['filters']=_[_0xaa12('0x2f')](_0x422cfa[_0xaa12('0x30')],_0x422cfa[_0xaa12('0x2d')]);_0xf6874f[_0xaa12('0x31')]=_[_0xaa12('0x2f')](_0x422cfa[_0xaa12('0x30')],qs[_0xaa12('0x32')](_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x32')]));_0xf6874f[_0xaa12('0x31')]=_0xf6874f[_0xaa12('0x31')]['length']?_0xf6874f[_0xaa12('0x31')]:_0x422cfa[_0xaa12('0x30')];if(!_0x1fb8d6['query']['hasOwnProperty'](_0xaa12('0x33'))){_0xf6874f[_0xaa12('0x34')]=qs[_0xaa12('0x34')](_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x34')]);_0xf6874f[_0xaa12('0x1a')]=qs[_0xaa12('0x1a')](_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x1a')]);}_0xf6874f[_0xaa12('0x35')]=qs[_0xaa12('0x36')](_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x36')]);_0xf6874f[_0xaa12('0x37')]=qs[_0xaa12('0x38')](_[_0xaa12('0x39')](_0x1fb8d6['query'],_0x422cfa[_0xaa12('0x38')]),_0x2c524c);if(_0x1fb8d6['query'][_0xaa12('0x3a')]){_0xf6874f['where']=_[_0xaa12('0x3b')](_0xf6874f[_0xaa12('0x37')],{'$or':_[_0xaa12('0x3c')](_0x2c524c,function(_0x14b7db){if(_0x14b7db[_0xaa12('0x2b')]!=='VIRTUAL'){var _0x40c03d={};_0x40c03d[_0x14b7db[_0xaa12('0x27')]]={'$like':'%'+_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x3a')]+'%'};return _0x40c03d;}})});}_0xf6874f=_[_0xaa12('0x3b')]({},_0xf6874f,_0x1fb8d6[_0xaa12('0x3d')]);var _0x174d16={'where':_0xf6874f[_0xaa12('0x37')]};return db['SmsTransferReport'][_0xaa12('0x1c')](_0x174d16)[_0xaa12('0x24')](function(_0x1e708c){_0x43bee2['count']=_0x1e708c;if(_0x1fb8d6[_0xaa12('0x2d')][_0xaa12('0x3e')]){_0xf6874f[_0xaa12('0x3f')]=[{'all':!![]}];}return db[_0xaa12('0x40')]['findAll'](_0xf6874f);})[_0xaa12('0x24')](function(_0x55680f){_0x43bee2[_0xaa12('0x41')]=_0x55680f;return _0x43bee2;})[_0xaa12('0x24')](respondWithFilteredResult(_0x8d8e76,_0xf6874f))[_0xaa12('0x42')](handleError(_0x8d8e76,null));};exports[_0xaa12('0x43')]=function(_0x11df1c,_0x53fb45){var _0x375b0f={'raw':!![],'where':{'id':_0x11df1c['params']['id']}},_0x4b77a1={};_0x4b77a1[_0xaa12('0x30')]=_[_0xaa12('0x2e')](db[_0xaa12('0x40')][_0xaa12('0x29')]);_0x4b77a1[_0xaa12('0x2d')]=_[_0xaa12('0x2e')](_0x11df1c['query']);_0x4b77a1[_0xaa12('0x38')]=_[_0xaa12('0x2f')](_0x4b77a1[_0xaa12('0x30')],_0x4b77a1[_0xaa12('0x2d')]);_0x375b0f[_0xaa12('0x31')]=_[_0xaa12('0x2f')](_0x4b77a1[_0xaa12('0x30')],qs[_0xaa12('0x32')](_0x11df1c['query']['fields']));_0x375b0f[_0xaa12('0x31')]=_0x375b0f[_0xaa12('0x31')][_0xaa12('0x44')]?_0x375b0f[_0xaa12('0x31')]:_0x4b77a1[_0xaa12('0x30')];if(_0x11df1c[_0xaa12('0x2d')][_0xaa12('0x3e')]){_0x375b0f[_0xaa12('0x3f')]=[{'all':!![]}];}_0x375b0f=_[_0xaa12('0x3b')]({},_0x375b0f,_0x11df1c[_0xaa12('0x3d')]);return db[_0xaa12('0x40')]['find'](_0x375b0f)[_0xaa12('0x24')](handleEntityNotFound(_0x53fb45,null))[_0xaa12('0x24')](respondWithResult(_0x53fb45,null))['catch'](handleError(_0x53fb45,null));};exports[_0xaa12('0x45')]=function(_0x509989,_0x100bf5){return db[_0xaa12('0x40')][_0xaa12('0x45')](_0x509989['body'],{})[_0xaa12('0x24')](respondWithResult(_0x100bf5,0xc9))['catch'](handleError(_0x100bf5,null));};exports['update']=function(_0x3a83e8,_0x3eb9f7){if(_0x3a83e8[_0xaa12('0x46')]['id']){delete _0x3a83e8[_0xaa12('0x46')]['id'];}return db[_0xaa12('0x40')][_0xaa12('0x47')]({'where':{'id':_0x3a83e8[_0xaa12('0x48')]['id']}})['then'](handleEntityNotFound(_0x3eb9f7,null))[_0xaa12('0x24')](saveUpdates(_0x3a83e8[_0xaa12('0x46')],null))[_0xaa12('0x24')](respondWithResult(_0x3eb9f7,null))[_0xaa12('0x42')](handleError(_0x3eb9f7,null));};exports[_0xaa12('0x25')]=function(_0x1a588d,_0x30300e){return db[_0xaa12('0x40')][_0xaa12('0x47')]({'where':{'id':_0x1a588d[_0xaa12('0x48')]['id']}})[_0xaa12('0x24')](handleEntityNotFound(_0x30300e,null))[_0xaa12('0x24')](removeEntity(_0x30300e,null))[_0xaa12('0x42')](handleError(_0x30300e,null));};exports['describe']=function(_0x45b4e7,_0x19a7ed){return db['SmsTransferReport'][_0xaa12('0x49')]()['then'](respondWithResult(_0x19a7ed,null))[_0xaa12('0x42')](handleError(_0x19a7ed,null));}; \ No newline at end of file +var _0x11af=['rimraf','zip-dir','moment','util','path','fs-extra','squel','crypto','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','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','model','keys','query','intersection','attributes','fields','length','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','SmsTransferReport','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','eml-format'];(function(_0x262b0d,_0x106a3a){var _0x407583=function(_0x5e7824){while(--_0x5e7824){_0x262b0d['push'](_0x262b0d['shift']());}};_0x407583(++_0x106a3a);}(_0x11af,0xd7));var _0xf11a=function(_0x5b3d75,_0x560a74){_0x5b3d75=_0x5b3d75-0x0;var _0x10dc8d=_0x11af[_0x5b3d75];return _0x10dc8d;};'use strict';var emlformat=require(_0xf11a('0x0'));var rimraf=require(_0xf11a('0x1'));var zipdir=require(_0xf11a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf11a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf11a('0x4'));var path=require(_0xf11a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf11a('0x6'));var _=require('lodash');var squel=require(_0xf11a('0x7'));var crypto=require(_0xf11a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf11a('0x9'));var toCsv=require(_0xf11a('0xa'));var querystring=require(_0xf11a('0xb'));var Papa=require(_0xf11a('0xc'));var Redis=require(_0xf11a('0xd'));var authService=require(_0xf11a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf11a('0xf'));var hardwareService=require(_0xf11a('0x10'));var logger=require(_0xf11a('0x11'))(_0xf11a('0x12'));var utils=require(_0xf11a('0x13'));var config=require(_0xf11a('0x14'));var licenseUtil=require(_0xf11a('0x15'));var db=require(_0xf11a('0x16'))['db'];function respondWithStatusCode(_0x48523e,_0x536955){_0x536955=_0x536955||0xcc;return function(_0x49bc32){if(_0x49bc32){return _0x48523e['sendStatus'](_0x536955);}return _0x48523e[_0xf11a('0x17')](_0x536955)['end']();};}function respondWithResult(_0x3e1025,_0x1da9b0){_0x1da9b0=_0x1da9b0||0xc8;return function(_0x14cfdb){if(_0x14cfdb){return _0x3e1025[_0xf11a('0x17')](_0x1da9b0)[_0xf11a('0x18')](_0x14cfdb);}};}function respondWithFilteredResult(_0x525769,_0x19a9b7){return function(_0x14e063){if(_0x14e063){var _0x6fbdc2=typeof _0x19a9b7['offset']==='undefined'&&typeof _0x19a9b7['limit']===_0xf11a('0x19');var _0x454724=_0x14e063[_0xf11a('0x1a')];var _0x51f906=_0x6fbdc2?0x0:_0x19a9b7[_0xf11a('0x1b')];var _0x1aafaf=_0x6fbdc2?_0x14e063[_0xf11a('0x1a')]:_0x19a9b7[_0xf11a('0x1b')]+_0x19a9b7['limit'];var _0x5e71c6;if(_0x1aafaf>=_0x454724){_0x1aafaf=_0x454724;_0x5e71c6=0xc8;}else{_0x5e71c6=0xce;}_0x525769[_0xf11a('0x17')](_0x5e71c6);return _0x525769['set'](_0xf11a('0x1c'),_0x51f906+'-'+_0x1aafaf+'/'+_0x454724)[_0xf11a('0x18')](_0x14e063);}return null;};}function patchUpdates(_0x4d4e59){return function(_0x1e70ff){try{jsonpatch[_0xf11a('0x1d')](_0x1e70ff,_0x4d4e59,!![]);}catch(_0x523c9f){return BPromise[_0xf11a('0x1e')](_0x523c9f);}return _0x1e70ff[_0xf11a('0x1f')]();};}function saveUpdates(_0x533f8f,_0x2e0795){return function(_0x4b73bc){if(_0x4b73bc){return _0x4b73bc[_0xf11a('0x20')](_0x533f8f)[_0xf11a('0x21')](function(_0x23d44a){return _0x23d44a;});}return null;};}function removeEntity(_0x291290,_0x8082da){return function(_0x392213){if(_0x392213){return _0x392213[_0xf11a('0x22')]()['then'](function(){_0x291290['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5316,_0x3624d6){return function(_0x3398b3){if(!_0x3398b3){_0x5b5316[_0xf11a('0x23')](0x194);}return _0x3398b3;};}function handleError(_0x254f51,_0x5cc1ad){_0x5cc1ad=_0x5cc1ad||0x1f4;return function(_0x1d4ef6){logger[_0xf11a('0x24')](_0x1d4ef6[_0xf11a('0x25')]);if(_0x1d4ef6[_0xf11a('0x26')]){delete _0x1d4ef6['name'];}_0x254f51[_0xf11a('0x17')](_0x5cc1ad)[_0xf11a('0x27')](_0x1d4ef6);};}exports['index']=function(_0xb1cc6b,_0x4f700b){var _0x1999ee={},_0x281ab3={},_0x51d547={'count':0x0,'rows':[]};var _0x3f28be=_[_0xf11a('0x28')](db['SmsTransferReport']['rawAttributes'],function(_0x452ef6){return{'name':_0x452ef6[_0xf11a('0x29')],'type':_0x452ef6[_0xf11a('0x2a')]['key']};});_0x281ab3[_0xf11a('0x2b')]=_[_0xf11a('0x28')](_0x3f28be,_0xf11a('0x26'));_0x281ab3['query']=_[_0xf11a('0x2c')](_0xb1cc6b[_0xf11a('0x2d')]);_0x281ab3['filters']=_[_0xf11a('0x2e')](_0x281ab3[_0xf11a('0x2b')],_0x281ab3[_0xf11a('0x2d')]);_0x1999ee[_0xf11a('0x2f')]=_['intersection'](_0x281ab3[_0xf11a('0x2b')],qs[_0xf11a('0x30')](_0xb1cc6b[_0xf11a('0x2d')]['fields']));_0x1999ee['attributes']=_0x1999ee[_0xf11a('0x2f')][_0xf11a('0x31')]?_0x1999ee[_0xf11a('0x2f')]:_0x281ab3['model'];if(!_0xb1cc6b['query']['hasOwnProperty']('nolimit')){_0x1999ee[_0xf11a('0x32')]=qs[_0xf11a('0x32')](_0xb1cc6b[_0xf11a('0x2d')][_0xf11a('0x32')]);_0x1999ee['offset']=qs[_0xf11a('0x1b')](_0xb1cc6b[_0xf11a('0x2d')][_0xf11a('0x1b')]);}_0x1999ee[_0xf11a('0x33')]=qs[_0xf11a('0x34')](_0xb1cc6b['query'][_0xf11a('0x34')]);_0x1999ee['where']=qs['filters'](_[_0xf11a('0x35')](_0xb1cc6b[_0xf11a('0x2d')],_0x281ab3[_0xf11a('0x36')]),_0x3f28be);if(_0xb1cc6b[_0xf11a('0x2d')][_0xf11a('0x37')]){_0x1999ee[_0xf11a('0x38')]=_[_0xf11a('0x39')](_0x1999ee['where'],{'$or':_['map'](_0x3f28be,function(_0x32aee7){if(_0x32aee7[_0xf11a('0x2a')]!==_0xf11a('0x3a')){var _0x328e94={};_0x328e94[_0x32aee7[_0xf11a('0x26')]]={'$like':'%'+_0xb1cc6b['query'][_0xf11a('0x37')]+'%'};return _0x328e94;}})});}_0x1999ee=_[_0xf11a('0x39')]({},_0x1999ee,_0xb1cc6b['options']);var _0x705512={'where':_0x1999ee[_0xf11a('0x38')]};return db[_0xf11a('0x3b')][_0xf11a('0x1a')](_0x705512)[_0xf11a('0x21')](function(_0x44bf28){_0x51d547[_0xf11a('0x1a')]=_0x44bf28;if(_0xb1cc6b[_0xf11a('0x2d')]['includeAll']){_0x1999ee[_0xf11a('0x3c')]=[{'all':!![]}];}return db[_0xf11a('0x3b')][_0xf11a('0x3d')](_0x1999ee);})[_0xf11a('0x21')](function(_0x21f2da){_0x51d547['rows']=_0x21f2da;return _0x51d547;})[_0xf11a('0x21')](respondWithFilteredResult(_0x4f700b,_0x1999ee))[_0xf11a('0x3e')](handleError(_0x4f700b,null));};exports[_0xf11a('0x3f')]=function(_0x337618,_0x39d81d){var _0x5490a7={'raw':!![],'where':{'id':_0x337618[_0xf11a('0x40')]['id']}},_0x290003={};_0x290003[_0xf11a('0x2b')]=_[_0xf11a('0x2c')](db[_0xf11a('0x3b')][_0xf11a('0x41')]);_0x290003['query']=_[_0xf11a('0x2c')](_0x337618[_0xf11a('0x2d')]);_0x290003[_0xf11a('0x36')]=_[_0xf11a('0x2e')](_0x290003['model'],_0x290003[_0xf11a('0x2d')]);_0x5490a7[_0xf11a('0x2f')]=_[_0xf11a('0x2e')](_0x290003[_0xf11a('0x2b')],qs['fields'](_0x337618['query']['fields']));_0x5490a7[_0xf11a('0x2f')]=_0x5490a7['attributes'][_0xf11a('0x31')]?_0x5490a7[_0xf11a('0x2f')]:_0x290003[_0xf11a('0x2b')];if(_0x337618[_0xf11a('0x2d')][_0xf11a('0x42')]){_0x5490a7[_0xf11a('0x3c')]=[{'all':!![]}];}_0x5490a7=_['merge']({},_0x5490a7,_0x337618[_0xf11a('0x43')]);return db[_0xf11a('0x3b')][_0xf11a('0x44')](_0x5490a7)[_0xf11a('0x21')](handleEntityNotFound(_0x39d81d,null))[_0xf11a('0x21')](respondWithResult(_0x39d81d,null))[_0xf11a('0x3e')](handleError(_0x39d81d,null));};exports[_0xf11a('0x45')]=function(_0x249789,_0x50a39e){return db['SmsTransferReport'][_0xf11a('0x45')](_0x249789['body'],{})[_0xf11a('0x21')](respondWithResult(_0x50a39e,0xc9))[_0xf11a('0x3e')](handleError(_0x50a39e,null));};exports[_0xf11a('0x20')]=function(_0x429ffa,_0x3773e4){if(_0x429ffa['body']['id']){delete _0x429ffa[_0xf11a('0x46')]['id'];}return db[_0xf11a('0x3b')]['find']({'where':{'id':_0x429ffa[_0xf11a('0x40')]['id']}})[_0xf11a('0x21')](handleEntityNotFound(_0x3773e4,null))[_0xf11a('0x21')](saveUpdates(_0x429ffa[_0xf11a('0x46')],null))[_0xf11a('0x21')](respondWithResult(_0x3773e4,null))[_0xf11a('0x3e')](handleError(_0x3773e4,null));};exports[_0xf11a('0x22')]=function(_0x16ab41,_0x5679d8){return db['SmsTransferReport'][_0xf11a('0x44')]({'where':{'id':_0x16ab41[_0xf11a('0x40')]['id']}})[_0xf11a('0x21')](handleEntityNotFound(_0x5679d8,null))[_0xf11a('0x21')](removeEntity(_0x5679d8,null))['catch'](handleError(_0x5679d8,null));};exports[_0xf11a('0x47')]=function(_0x4319db,_0x8feb4){return db[_0xf11a('0x3b')][_0xf11a('0x47')]()['then'](respondWithResult(_0x8feb4,null))[_0xf11a('0x3e')](handleError(_0x8feb4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a44e74e..4cc6af1 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 _0xc770=['define','report_sms_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x261a4e,_0x210aef){var _0x3c564e=function(_0x3f05d4){while(--_0x3f05d4){_0x261a4e['push'](_0x261a4e['shift']());}};_0x3c564e(++_0x210aef);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('SmsTransferReport',attributes,{'tableName':_0x0c77('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0c77('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0298=['rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b87cc,_0x44ef41){var _0x3808d2=function(_0x5d249c){while(--_0x5d249c){_0x2b87cc['push'](_0x2b87cc['shift']());}};_0x3808d2(++_0x44ef41);}(_0x0298,0x95));var _0x8029=function(_0x1c0d3a,_0x5917c1){_0x1c0d3a=_0x1c0d3a-0x0;var _0x115215=_0x0298[_0x1c0d3a];return _0x115215;};'use strict';var _=require(_0x8029('0x0'));var util=require('util');var logger=require(_0x8029('0x1'))(_0x8029('0x2'));var moment=require(_0x8029('0x3'));var BPromise=require(_0x8029('0x4'));var rp=require(_0x8029('0x5'));var fs=require('fs');var path=require(_0x8029('0x6'));var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module['exports']=function(_0x37b617,_0xeae01){return _0x37b617['define'](_0x8029('0xa'),attributes,{'tableName':_0x8029('0xb'),'paranoid':![],'indexes':[{'name':_0x8029('0xc'),'fields':[_0x8029('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7c3fe6e..517c9f7 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 _0xdf70=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0xf3728d,_0x5ebea1){var _0x5c4c13=function(_0x8d4155){while(--_0x8d4155){_0xf3728d['push'](_0xf3728d['shift']());}};_0x5c4c13(++_0x5ebea1);}(_0xdf70,0x86));var _0x0df7=function(_0x3175f8,_0x27812c){_0x3175f8=_0x3175f8-0x0;var _0x40e76c=_0xdf70[_0x3175f8];return _0x40e76c;};'use strict';var _=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var moment=require(_0x0df7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0df7('0x3'));var fs=require('fs');var Redis=require(_0x0df7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0df7('0x5'));var logger=require('../../config/logger')(_0x0df7('0x6'));var config=require(_0x0df7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0df7('0x8')][_0x0df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42090d,_0x5c1a5b,_0x1f1680){return new BPromise(function(_0x392337,_0x44c4fb){return client[_0x0df7('0xa')](_0x42090d,_0x1f1680)[_0x0df7('0xb')](function(_0x411e73){logger['info'](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));logger[_0x0df7('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5c1a5b,_0x0df7('0xd'),JSON[_0x0df7('0xf')](_0x411e73));if(_0x411e73[_0x0df7('0x10')]){if(_0x411e73['error'][_0x0df7('0x11')]===0x1f4){logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73['error'][_0x0df7('0x12')]);return _0x44c4fb(_0x411e73['error']['message']);}logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73[_0x0df7('0x10')][_0x0df7('0x12')]);return _0x392337(_0x411e73['error'][_0x0df7('0x12')]);}else{logger[_0x0df7('0x13')](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));_0x392337(_0x411e73[_0x0df7('0x14')]['message']);}})[_0x0df7('0x15')](function(_0x4161d1){logger['error'](_0x0df7('0xc'),_0x5c1a5b,_0x4161d1);_0x44c4fb(_0x4161d1);});});} \ No newline at end of file +var _0x3435=['request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x453222,_0xd17a0e){var _0x236ed6=function(_0x35bb82){while(--_0x35bb82){_0x453222['push'](_0x453222['shift']());}};_0x236ed6(++_0xd17a0e);}(_0x3435,0xfa));var _0x5343=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x3435[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544b29,_0x13641f,_0x1e1911){return new BPromise(function(_0x9ea9b6,_0x245034){return client[_0x5343('0xa')](_0x544b29,_0x1e1911)['then'](function(_0x44421c){logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));logger[_0x5343('0xd')](_0x5343('0xe'),_0x13641f,_0x5343('0xc'),JSON['stringify'](_0x44421c));if(_0x44421c[_0x5343('0xf')]){if(_0x44421c[_0x5343('0xf')][_0x5343('0x10')]===0x1f4){logger['error'](_0x5343('0xb'),_0x13641f,_0x44421c['error'][_0x5343('0x11')]);return _0x245034(_0x44421c[_0x5343('0xf')]['message']);}logger[_0x5343('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x13641f,_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);return _0x9ea9b6(_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);}else{logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));_0x9ea9b6(_0x44421c[_0x5343('0x12')][_0x5343('0x11')]);}})[_0x5343('0x13')](function(_0x2913e8){logger[_0x5343('0xf')](_0x5343('0xb'),_0x13641f,_0x2913e8);_0x245034(_0x2913e8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index df886b5..0ca7595 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 _0x0f0f=['download','join','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','single','file','create','put','/:id','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','index','isAuthenticated'];(function(_0xa8bbbf,_0x5c4321){var _0x17d8f5=function(_0x359e39){while(--_0x359e39){_0xa8bbbf['push'](_0xa8bbbf['shift']());}};_0x17d8f5(++_0x5c4321);}(_0x0f0f,0xff));var _0xf0f0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f0f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf0f0('0x0'));var util=require(_0xf0f0('0x1'));var path=require(_0xf0f0('0x2'));var timeout=require(_0xf0f0('0x3'));var express=require(_0xf0f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0f0('0x5'));var config=require(_0xf0f0('0x6'));var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf0f0('0x7')]);router['get']('/:id',auth[_0xf0f0('0x8')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf0f0('0x9')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19099f,_0x2cb471,_0x268a01){_0x268a01(null,path[_0xf0f0('0xa')](config['root'],_0xf0f0('0xb')));},'filename':function(_0x55a9ce,_0x24894c,_0x13ea48){_0x24894c[_0xf0f0('0xc')]=_0x24894c[_0xf0f0('0xc')][_0xf0f0('0xd')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13ea48(null,util['format'](_0xf0f0('0xe'),path[_0xf0f0('0xf')](_0x24894c[_0xf0f0('0xc')],path[_0xf0f0('0x10')](_0x24894c[_0xf0f0('0xc')])),Date['now'](),path['extname'](_0x24894c[_0xf0f0('0xc')])));}})});router['post']('/',upload[_0xf0f0('0x11')](_0xf0f0('0x12')),controller[_0xf0f0('0x13')]);router[_0xf0f0('0x14')](_0xf0f0('0x15'),auth[_0xf0f0('0x8')](),controller['update']);router['delete'](_0xf0f0('0x15'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xcdd2=['extname','post','single','create','/:id','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download','join','root','originalname','replace','format','%s-%s%s','basename','now'];(function(_0x4b8b98,_0x178c88){var _0x1fb023=function(_0x53aa9b){while(--_0x53aa9b){_0x4b8b98['push'](_0x4b8b98['shift']());}};_0x1fb023(++_0x178c88);}(_0xcdd2,0xc5));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2cdd('0x0'));var path=require(_0x2cdd('0x1'));var timeout=require(_0x2cdd('0x2'));var express=require('express');var router=express[_0x2cdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2cdd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2cdd('0x5'));var controller=require(_0x2cdd('0x6'));router[_0x2cdd('0x7')]('/',auth[_0x2cdd('0x8')](),controller[_0x2cdd('0x9')]);router[_0x2cdd('0x7')]('/:id',auth[_0x2cdd('0x8')](),controller['show']);router[_0x2cdd('0x7')](_0x2cdd('0xa'),auth[_0x2cdd('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2404a1,_0x25829b,_0x27680b){_0x27680b(null,path[_0x2cdd('0xb')](config[_0x2cdd('0xc')],'server/files/sounds/original/'));},'filename':function(_0x31089f,_0x34222f,_0x554e64){_0x34222f[_0x2cdd('0xd')]=_0x34222f[_0x2cdd('0xd')][_0x2cdd('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x554e64(null,util[_0x2cdd('0xf')](_0x2cdd('0x10'),path[_0x2cdd('0x11')](_0x34222f[_0x2cdd('0xd')],path['extname'](_0x34222f[_0x2cdd('0xd')])),Date[_0x2cdd('0x12')](),path[_0x2cdd('0x13')](_0x34222f[_0x2cdd('0xd')])));}})});router[_0x2cdd('0x14')]('/',upload[_0x2cdd('0x15')]('file'),controller[_0x2cdd('0x16')]);router['put'](_0x2cdd('0x17'),auth[_0x2cdd('0x8')](),controller[_0x2cdd('0x18')]);router['delete']('/:id',auth[_0x2cdd('0x8')](),controller[_0x2cdd('0x19')]);module[_0x2cdd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index fb046e9..24480a2 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 _0xde7d=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x3698bf,_0x3870cd){var _0x7c16d4=function(_0x1e4e49){while(--_0x1e4e49){_0x3698bf['push'](_0x3698bf['shift']());}};_0x7c16d4(++_0x3870cd);}(_0xde7d,0x10c));var _0xdde7=function(_0x2af615,_0x5b4e50){_0x2af615=_0x2af615-0x0;var _0x30b568=_0xde7d[_0x2af615];return _0x30b568;};'use strict';var Sequelize=require(_0xdde7('0x0'));module[_0xdde7('0x1')]={'name':{'type':Sequelize[_0xdde7('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xdde7('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xdde7('0x2')]},'original_duration':{'type':Sequelize[_0xdde7('0x3')]},'original_sampleCount':{'type':Sequelize[_0xdde7('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xdde7('0x4')]},'original_sampleRate':{'type':Sequelize[_0xdde7('0x5')]},'converted_format':{'type':Sequelize[_0xdde7('0x2')]},'converted_duration':{'type':Sequelize[_0xdde7('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xdde7('0x4')]},'converted_channelCount':{'type':Sequelize[_0xdde7('0x5')]},'converted_bitRate':{'type':Sequelize[_0xdde7('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xdde7('0x5')]}}; \ No newline at end of file +var _0x0dbc=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x1b6293,_0x265c05){var _0x546581=function(_0x2098cb){while(--_0x2098cb){_0x1b6293['push'](_0x1b6293['shift']());}};_0x546581(++_0x265c05);}(_0x0dbc,0x1e8));var _0xc0db=function(_0x2e3e25,_0x4966a1){_0x2e3e25=_0x2e3e25-0x0;var _0x4c3714=_0x0dbc[_0x2e3e25];return _0x4c3714;};'use strict';var Sequelize=require(_0xc0db('0x0'));module[_0xc0db('0x1')]={'name':{'type':Sequelize[_0xc0db('0x2')],'unique':_0xc0db('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc0db('0x2')]},'display_name':{'type':Sequelize[_0xc0db('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xc0db('0x2')]},'original_duration':{'type':Sequelize[_0xc0db('0x4')]},'original_sampleCount':{'type':Sequelize[_0xc0db('0x5')]},'original_channelCount':{'type':Sequelize[_0xc0db('0x6')]},'original_bitRate':{'type':Sequelize[_0xc0db('0x5')]},'original_sampleRate':{'type':Sequelize[_0xc0db('0x6')]},'converted_format':{'type':Sequelize[_0xc0db('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xc0db('0x5')]},'converted_channelCount':{'type':Sequelize[_0xc0db('0x6')]},'converted_bitRate':{'type':Sequelize[_0xc0db('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xc0db('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e34bb30..0c22ed5 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 _0x29db=['original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','start','params','description','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','show','fields','length','include','find','catch','download','converted_format','existsSync','join','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate'];(function(_0xdba444,_0x3e319e){var _0x55967d=function(_0x52bcc3){while(--_0x52bcc3){_0xdba444['push'](_0xdba444['shift']());}};_0x55967d(++_0x3e319e);}(_0x29db,0x17c));var _0xb29d=function(_0x56d472,_0x1d3b03){_0x56d472=_0x56d472-0x0;var _0x29817e=_0x29db[_0x56d472];return _0x29817e;};'use strict';var emlformat=require(_0xb29d('0x0'));var rimraf=require(_0xb29d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb29d('0x2'));var moment=require(_0xb29d('0x3'));var BPromise=require(_0xb29d('0x4'));var Mustache=require('mustache');var util=require(_0xb29d('0x5'));var path=require('path');var sox=require(_0xb29d('0x6'));var csv=require(_0xb29d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb29d('0x8'));var squel=require(_0xb29d('0x9'));var crypto=require(_0xb29d('0xa'));var jsforce=require(_0xb29d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb29d('0x7'));var querystring=require('querystring');var Papa=require(_0xb29d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb29d('0xd'));var as=require(_0xb29d('0xe'));var hardwareService=require(_0xb29d('0xf'));var logger=require(_0xb29d('0x10'))(_0xb29d('0x11'));var utils=require('../../config/utils');var config=require(_0xb29d('0x12'));var licenseUtil=require(_0xb29d('0x13'));var db=require(_0xb29d('0x14'))['db'];function respondWithStatusCode(_0x1cf0a1,_0x72eea0){_0x72eea0=_0x72eea0||0xcc;return function(_0x1cb03b){if(_0x1cb03b){return _0x1cf0a1['sendStatus'](_0x72eea0);}return _0x1cf0a1[_0xb29d('0x15')](_0x72eea0)[_0xb29d('0x16')]();};}function respondWithResult(_0x704da5,_0x133f46){_0x133f46=_0x133f46||0xc8;return function(_0x56c0ae){if(_0x56c0ae){return _0x704da5[_0xb29d('0x15')](_0x133f46)[_0xb29d('0x17')](_0x56c0ae);}};}function respondWithFilteredResult(_0x6cbbb7,_0xe6923b){return function(_0x346d83){if(_0x346d83){var _0x1ad1f7=typeof _0xe6923b[_0xb29d('0x18')]===_0xb29d('0x19')&&typeof _0xe6923b['limit']===_0xb29d('0x19');var _0x3d0549=_0x346d83['count'];var _0x144f3b=_0x1ad1f7?0x0:_0xe6923b[_0xb29d('0x18')];var _0x16ef21=_0x1ad1f7?_0x346d83[_0xb29d('0x1a')]:_0xe6923b[_0xb29d('0x18')]+_0xe6923b[_0xb29d('0x1b')];var _0x40f0b2;if(_0x16ef21>=_0x3d0549){_0x16ef21=_0x3d0549;_0x40f0b2=0xc8;}else{_0x40f0b2=0xce;}_0x6cbbb7[_0xb29d('0x15')](_0x40f0b2);return _0x6cbbb7[_0xb29d('0x1c')](_0xb29d('0x1d'),_0x144f3b+'-'+_0x16ef21+'/'+_0x3d0549)['json'](_0x346d83);}return null;};}function patchUpdates(_0x18ebd6){return function(_0x5d0fa1){try{jsonpatch[_0xb29d('0x1e')](_0x5d0fa1,_0x18ebd6,!![]);}catch(_0x23d125){return BPromise['reject'](_0x23d125);}return _0x5d0fa1[_0xb29d('0x1f')]();};}function saveUpdates(_0x3e0619,_0x485af8){return function(_0x2bc933){if(_0x2bc933){return _0x2bc933[_0xb29d('0x20')](_0x3e0619)['then'](function(_0x3500ef){return _0x3500ef;});}return null;};}function removeEntity(_0x11ef55,_0x50d486){return function(_0x7aead6){if(_0x7aead6){return _0x7aead6['destroy']()[_0xb29d('0x21')](function(){var _0x55c277=_0x7aead6[_0xb29d('0x22')]({'plain':!![]});var _0xa329f9='Sounds';return db[_0xb29d('0x23')][_0xb29d('0x24')]({'where':{'type':_0xa329f9,'resourceId':_0x55c277['id']}})[_0xb29d('0x21')](function(){return _0x7aead6;});})[_0xb29d('0x21')](function(){_0x11ef55[_0xb29d('0x15')](0xcc)[_0xb29d('0x16')]();});}};}function handleEntityNotFound(_0x2c0774,_0x5ec427){return function(_0x38eda7){if(!_0x38eda7){_0x2c0774[_0xb29d('0x25')](0x194);}return _0x38eda7;};}function handleError(_0x30e605,_0x4c5fa4){_0x4c5fa4=_0x4c5fa4||0x1f4;return function(_0x5795f7){logger[_0xb29d('0x26')](_0x5795f7[_0xb29d('0x27')]);if(_0x5795f7['name']){delete _0x5795f7[_0xb29d('0x28')];}_0x30e605['status'](_0x4c5fa4)['send'](_0x5795f7);};}exports[_0xb29d('0x29')]=function(_0x301899,_0x17f802){var _0x3a83fe={},_0x279e4e={},_0x4d9db1={'count':0x0,'rows':[]};var _0x74e06e=_[_0xb29d('0x2a')](db[_0xb29d('0x2b')][_0xb29d('0x2c')],function(_0x1572c2){return{'name':_0x1572c2['fieldName'],'type':_0x1572c2[_0xb29d('0x2d')][_0xb29d('0x2e')]};});_0x279e4e[_0xb29d('0x2f')]=_[_0xb29d('0x2a')](_0x74e06e,_0xb29d('0x28'));_0x279e4e[_0xb29d('0x30')]=_[_0xb29d('0x31')](_0x301899[_0xb29d('0x30')]);_0x279e4e[_0xb29d('0x32')]=_[_0xb29d('0x33')](_0x279e4e[_0xb29d('0x2f')],_0x279e4e[_0xb29d('0x30')]);_0x3a83fe[_0xb29d('0x34')]=_[_0xb29d('0x33')](_0x279e4e['model'],qs['fields'](_0x301899[_0xb29d('0x30')]['fields']));_0x3a83fe[_0xb29d('0x34')]=_0x3a83fe['attributes']['length']?_0x3a83fe[_0xb29d('0x34')]:_0x279e4e[_0xb29d('0x2f')];if(!_0x301899[_0xb29d('0x30')][_0xb29d('0x35')](_0xb29d('0x36'))){_0x3a83fe[_0xb29d('0x1b')]=qs[_0xb29d('0x1b')](_0x301899['query']['limit']);_0x3a83fe[_0xb29d('0x18')]=qs[_0xb29d('0x18')](_0x301899[_0xb29d('0x30')]['offset']);}_0x3a83fe[_0xb29d('0x37')]=qs[_0xb29d('0x38')](_0x301899[_0xb29d('0x30')]['sort']);_0x3a83fe[_0xb29d('0x39')]=qs[_0xb29d('0x32')](_[_0xb29d('0x3a')](_0x301899['query'],_0x279e4e[_0xb29d('0x32')]),_0x74e06e);if(_0x301899['query'][_0xb29d('0x3b')]){_0x3a83fe[_0xb29d('0x39')]=_[_0xb29d('0x3c')](_0x3a83fe[_0xb29d('0x39')],{'$or':_[_0xb29d('0x2a')](_0x74e06e,function(_0x21a508){if(_0x21a508['type']!==_0xb29d('0x3d')){var _0x4fa9a7={};_0x4fa9a7[_0x21a508[_0xb29d('0x28')]]={'$like':'%'+_0x301899['query'][_0xb29d('0x3b')]+'%'};return _0x4fa9a7;}})});}_0x3a83fe=_[_0xb29d('0x3c')]({},_0x3a83fe,_0x301899[_0xb29d('0x3e')]);var _0x8a5131={'where':_0x3a83fe[_0xb29d('0x39')]};return db[_0xb29d('0x2b')][_0xb29d('0x1a')](_0x8a5131)[_0xb29d('0x21')](function(_0x44834d){_0x4d9db1[_0xb29d('0x1a')]=_0x44834d;if(_0x301899[_0xb29d('0x30')]['includeAll']){_0x3a83fe['include']=[{'all':!![]}];}return db[_0xb29d('0x2b')]['findAll'](_0x3a83fe);})[_0xb29d('0x21')](function(_0x43323f){_0x4d9db1['rows']=_0x43323f;return _0x4d9db1;})[_0xb29d('0x21')](respondWithFilteredResult(_0x17f802,_0x3a83fe))['catch'](handleError(_0x17f802,null));};exports[_0xb29d('0x3f')]=function(_0x15da1c,_0x1ae4dd){var _0x257838={'raw':!![],'where':{'id':_0x15da1c['params']['id']}},_0x238037={};_0x238037[_0xb29d('0x2f')]=_[_0xb29d('0x31')](db[_0xb29d('0x2b')][_0xb29d('0x2c')]);_0x238037[_0xb29d('0x30')]=_['keys'](_0x15da1c['query']);_0x238037[_0xb29d('0x32')]=_[_0xb29d('0x33')](_0x238037[_0xb29d('0x2f')],_0x238037[_0xb29d('0x30')]);_0x257838[_0xb29d('0x34')]=_[_0xb29d('0x33')](_0x238037[_0xb29d('0x2f')],qs['fields'](_0x15da1c[_0xb29d('0x30')][_0xb29d('0x40')]));_0x257838[_0xb29d('0x34')]=_0x257838[_0xb29d('0x34')][_0xb29d('0x41')]?_0x257838[_0xb29d('0x34')]:_0x238037[_0xb29d('0x2f')];if(_0x15da1c['query']['includeAll']){_0x257838[_0xb29d('0x42')]=[{'all':!![]}];}_0x257838=_[_0xb29d('0x3c')]({},_0x257838,_0x15da1c[_0xb29d('0x3e')]);return db[_0xb29d('0x2b')][_0xb29d('0x43')](_0x257838)[_0xb29d('0x21')](handleEntityNotFound(_0x1ae4dd,null))[_0xb29d('0x21')](respondWithResult(_0x1ae4dd,null))[_0xb29d('0x44')](handleError(_0x1ae4dd,null));};exports[_0xb29d('0x45')]=function(_0x34640c,_0x5afd06,_0x14ec1b){return db['Sound'][_0xb29d('0x43')]({'where':{'id':_0x34640c['params']['id']},'attributes':[_0xb29d('0x28'),'save_name',_0xb29d('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x5afd06,null))[_0xb29d('0x21')](function(_0x5333b8){if(_0x5333b8){if(!fs[_0xb29d('0x47')](path[_0xb29d('0x48')](config[_0xb29d('0x49')],'server/files/sounds/converted',_0x5333b8[_0xb29d('0x4a')]+'.'+_0x5333b8[_0xb29d('0x46')]))){throw new db[(_0xb29d('0x4b'))][(_0xb29d('0x4c'))](_0xb29d('0x4d'));}return _0x5afd06[_0xb29d('0x45')](path[_0xb29d('0x48')](config['root'],_0xb29d('0x4e'),util[_0xb29d('0x4f')](_0xb29d('0x50'),_0x5333b8['save_name'],_0x5333b8['converted_format'])),util[_0xb29d('0x4f')]('%s.%s',_0x5333b8['name'],_0x5333b8[_0xb29d('0x46')]));}return null;})['catch'](handleError(_0x5afd06,null));};exports[_0xb29d('0x51')]=function(_0x35b852,_0x1bf67f,_0x3b9d58){var _0x4828f6={'name':path[_0xb29d('0x52')](_0x35b852['file'][_0xb29d('0x53')],path[_0xb29d('0x54')](_0x35b852[_0xb29d('0x55')][_0xb29d('0x53')])),'save_name':path[_0xb29d('0x52')](_0x35b852['file'][_0xb29d('0x56')],path['extname'](_0x35b852[_0xb29d('0x55')][_0xb29d('0x56')])),'original_format':path[_0xb29d('0x54')](_0x35b852[_0xb29d('0x55')][_0xb29d('0x53')])[_0xb29d('0x57')](0x1),'converted_format':_0xb29d('0x58')};var _0x1f900a=path['join'](config[_0xb29d('0x49')],_0xb29d('0x59'),_0x35b852[_0xb29d('0x55')][_0xb29d('0x56')]);var _0x1647ad=path['join'](config[_0xb29d('0x49')],_0xb29d('0x4e'),util[_0xb29d('0x4f')](_0xb29d('0x50'),path[_0xb29d('0x52')](_0x35b852[_0xb29d('0x55')][_0xb29d('0x56')],path[_0xb29d('0x54')](_0x35b852[_0xb29d('0x55')][_0xb29d('0x56')])),_0x4828f6[_0xb29d('0x46')]));logger[_0xb29d('0x5a')](_0xb29d('0x5b'),_0x1f900a);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1647ad);try{fs[_0xb29d('0x5c')](_0x1f900a,parseInt(_0xb29d('0x5d'),0x8));var _0x4b6637=sox[_0xb29d('0x5e')](_0x1f900a,_0x1647ad,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b6637['on'](_0xb29d('0x26'),function(_0x1bad33){fs['unlinkSync'](_0x1f900a);_0x1bf67f[_0xb29d('0x15')](0x1f4)[_0xb29d('0x5f')](_0x1bad33);});_0x4b6637['on'](_0xb29d('0x60'),function(_0x2f7897){_0x4828f6[_0xb29d('0x61')]=isNaN(_0x2f7897[_0xb29d('0x62')])?null:_0x2f7897['duration']*0x3e8;_0x4828f6[_0xb29d('0x63')]=isNaN(_0x2f7897[_0xb29d('0x64')])?null:_0x2f7897[_0xb29d('0x64')];_0x4828f6[_0xb29d('0x65')]=isNaN(_0x2f7897['channelCount'])?null:_0x2f7897[_0xb29d('0x66')];_0x4828f6['original_bitRate']=isNaN(_0x2f7897[_0xb29d('0x67')])?null:_0x2f7897[_0xb29d('0x67')];_0x4828f6[_0xb29d('0x68')]=isNaN(_0x2f7897['sampleRate'])?null:_0x2f7897[_0xb29d('0x69')];});_0x4b6637['on'](_0xb29d('0x6a'),function(_0x451c19){_0x4828f6['converted_duration']=isNaN(_0x451c19[_0xb29d('0x62')])?null:_0x451c19[_0xb29d('0x62')]*0x3e8;_0x4828f6[_0xb29d('0x6b')]=isNaN(_0x451c19[_0xb29d('0x64')])?null:_0x451c19[_0xb29d('0x64')];_0x4828f6[_0xb29d('0x6c')]=isNaN(_0x451c19[_0xb29d('0x66')])?null:_0x451c19[_0xb29d('0x66')];_0x4828f6[_0xb29d('0x6d')]=isNaN(_0x451c19[_0xb29d('0x67')])?null:_0x451c19[_0xb29d('0x67')];_0x4828f6['converted_sampleRate']=isNaN(_0x451c19[_0xb29d('0x69')])?null:_0x451c19[_0xb29d('0x69')];});_0x4b6637['on']('end',function(){fs[_0xb29d('0x5c')](_0x1647ad,parseInt(_0xb29d('0x5d'),0x8));return db[_0xb29d('0x2b')][_0xb29d('0x51')](_0x4828f6)[_0xb29d('0x21')](function(_0x34dc7f){var _0x2fcf02={'role':_0x35b852['body'][_0xb29d('0x6e')],'userProfileId':_0x35b852[_0xb29d('0x6f')][_0xb29d('0x70')]};if(!_0x2fcf02)throw new Error(_0xb29d('0x71'));if(_0x2fcf02['role']===_0xb29d('0x72')){var _0x4e1e4b=_0x34dc7f[_0xb29d('0x22')]({'plain':!![]});return db[_0xb29d('0x73')][_0xb29d('0x43')]({'where':{'name':_0xb29d('0x74'),'userProfileId':_0x2fcf02[_0xb29d('0x70')]},'raw':!![]})[_0xb29d('0x21')](function(_0x4db5e0){if(_0x4db5e0&&_0x4db5e0['autoAssociation']===0x0){return db[_0xb29d('0x23')]['create']({'name':_0x4e1e4b['name'],'resourceId':_0x4e1e4b['id'],'type':_0x4db5e0[_0xb29d('0x28')],'sectionId':_0x4db5e0['id']},{})['then'](function(){return _0x34dc7f;});}else{return _0x34dc7f;}})[_0xb29d('0x44')](function(_0x3f0077){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f0077);throw _0x3f0077;});}return _0x34dc7f;})[_0xb29d('0x21')](respondWithResult(_0x1bf67f,null))[_0xb29d('0x44')](handleError(_0x1bf67f,null));});_0x4b6637[_0xb29d('0x75')]();}catch(_0x54fbaf){_0x1bf67f[_0xb29d('0x15')](0x1f4)[_0xb29d('0x5f')](_0x54fbaf);}};exports[_0xb29d('0x20')]=function(_0x986bbb,_0xcbb52d,_0xb3cf60){return db['Sound'][_0xb29d('0x43')]({'where':{'id':_0x986bbb[_0xb29d('0x76')]['id']}})['then'](handleEntityNotFound(_0xcbb52d,null))['then'](saveUpdates(_[_0xb29d('0x3a')](_0x986bbb['body'],[_0xb29d('0x28'),_0xb29d('0x77')]),null))[_0xb29d('0x21')](respondWithResult(_0xcbb52d,null))[_0xb29d('0x44')](handleError(_0xcbb52d,null));};exports['delete']=function(_0x2d02a1,_0x215f3a,_0x4352fb){return db['Sound'][_0xb29d('0x43')]({'where':{'id':_0x2d02a1[_0xb29d('0x76')]['id']}})[_0xb29d('0x21')](function(_0x2865f5){if(_0x2865f5){return _0x2865f5[_0xb29d('0x24')]();}})['then'](function(_0x3c7e1f){var _0x5425bc=path[_0xb29d('0x48')](config[_0xb29d('0x49')],_0xb29d('0x59'),util[_0xb29d('0x4f')]('%s.%s',_0x3c7e1f['save_name'],_0x3c7e1f['original_format']));var _0x155173=path[_0xb29d('0x48')](config['root'],_0xb29d('0x4e'),util[_0xb29d('0x4f')](_0xb29d('0x50'),_0x3c7e1f[_0xb29d('0x4a')],_0x3c7e1f[_0xb29d('0x46')]));fs[_0xb29d('0x78')](_0x5425bc);fs[_0xb29d('0x78')](_0x155173);return _0x3c7e1f;})[_0xb29d('0x21')](function(_0x3c5b4f){if(_0x3c5b4f){return _0x215f3a[_0xb29d('0x15')](0xcc)[_0xb29d('0x16')]();}})[_0xb29d('0x21')](handleEntityNotFound(_0x215f3a,null))[_0xb29d('0x44')](handleError(_0x215f3a,null));}; \ No newline at end of file +var _0xd977=['intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','download','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','create','basename','file','extname','filename','originalname','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','delete','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','get','end','error','name','map','Sound','type','key','model','keys','query','filters'];(function(_0xd92e6f,_0x38d6f5){var _0x70eb4b=function(_0x19c4cb){while(--_0x19c4cb){_0xd92e6f['push'](_0xd92e6f['shift']());}};_0x70eb4b(++_0x38d6f5);}(_0xd977,0xb7));var _0x7d97=function(_0x58af0b,_0x52fbf5){_0x58af0b=_0x58af0b-0x0;var _0x210c68=_0xd977[_0x58af0b];return _0x210c68;};'use strict';var emlformat=require(_0x7d97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d97('0x1'));var jsonpatch=require(_0x7d97('0x2'));var rp=require('request-promise');var moment=require(_0x7d97('0x3'));var BPromise=require(_0x7d97('0x4'));var Mustache=require(_0x7d97('0x5'));var util=require(_0x7d97('0x6'));var path=require(_0x7d97('0x7'));var sox=require(_0x7d97('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d97('0x9'));var _=require(_0x7d97('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d97('0xb'));var deskjs=require(_0x7d97('0xc'));var toCsv=require(_0x7d97('0xd'));var querystring=require('querystring');var Papa=require(_0x7d97('0xe'));var Redis=require('ioredis');var authService=require(_0x7d97('0xf'));var qs=require(_0x7d97('0x10'));var as=require(_0x7d97('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d97('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7d97('0x13'));var licenseUtil=require(_0x7d97('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe706,_0x229494){_0x229494=_0x229494||0xcc;return function(_0x7a135){if(_0x7a135){return _0x3fe706[_0x7d97('0x15')](_0x229494);}return _0x3fe706[_0x7d97('0x16')](_0x229494)['end']();};}function respondWithResult(_0x4f8ad9,_0x182342){_0x182342=_0x182342||0xc8;return function(_0x544e88){if(_0x544e88){return _0x4f8ad9[_0x7d97('0x16')](_0x182342)[_0x7d97('0x17')](_0x544e88);}};}function respondWithFilteredResult(_0x3b5222,_0x2e30fe){return function(_0x586000){if(_0x586000){var _0x45d89a=typeof _0x2e30fe['offset']===_0x7d97('0x18')&&typeof _0x2e30fe[_0x7d97('0x19')]==='undefined';var _0x3d7e4a=_0x586000[_0x7d97('0x1a')];var _0x138eaa=_0x45d89a?0x0:_0x2e30fe[_0x7d97('0x1b')];var _0x23caf4=_0x45d89a?_0x586000['count']:_0x2e30fe[_0x7d97('0x1b')]+_0x2e30fe[_0x7d97('0x19')];var _0x4295c2;if(_0x23caf4>=_0x3d7e4a){_0x23caf4=_0x3d7e4a;_0x4295c2=0xc8;}else{_0x4295c2=0xce;}_0x3b5222[_0x7d97('0x16')](_0x4295c2);return _0x3b5222[_0x7d97('0x1c')]('Content-Range',_0x138eaa+'-'+_0x23caf4+'/'+_0x3d7e4a)[_0x7d97('0x17')](_0x586000);}return null;};}function patchUpdates(_0x170797){return function(_0x1d240b){try{jsonpatch[_0x7d97('0x1d')](_0x1d240b,_0x170797,!![]);}catch(_0x44ce15){return BPromise[_0x7d97('0x1e')](_0x44ce15);}return _0x1d240b[_0x7d97('0x1f')]();};}function saveUpdates(_0x540f95,_0x3a3a51){return function(_0x5d8a09){if(_0x5d8a09){return _0x5d8a09[_0x7d97('0x20')](_0x540f95)['then'](function(_0x340269){return _0x340269;});}return null;};}function removeEntity(_0x384ab1,_0x31f6c9){return function(_0x510627){if(_0x510627){return _0x510627[_0x7d97('0x21')]()[_0x7d97('0x22')](function(){var _0xb26418=_0x510627[_0x7d97('0x23')]({'plain':!![]});var _0x5b908e='Sounds';return db['UserProfileResource'][_0x7d97('0x21')]({'where':{'type':_0x5b908e,'resourceId':_0xb26418['id']}})[_0x7d97('0x22')](function(){return _0x510627;});})['then'](function(){_0x384ab1['status'](0xcc)[_0x7d97('0x24')]();});}};}function handleEntityNotFound(_0x4eee6e,_0x58ab73){return function(_0x2dd6d5){if(!_0x2dd6d5){_0x4eee6e[_0x7d97('0x15')](0x194);}return _0x2dd6d5;};}function handleError(_0x156cec,_0x33fd61){_0x33fd61=_0x33fd61||0x1f4;return function(_0x9a083f){logger[_0x7d97('0x25')](_0x9a083f['stack']);if(_0x9a083f[_0x7d97('0x26')]){delete _0x9a083f[_0x7d97('0x26')];}_0x156cec[_0x7d97('0x16')](_0x33fd61)['send'](_0x9a083f);};}exports['index']=function(_0x4d4b1f,_0x37066c){var _0x1050ad={},_0x20ab00={},_0x38adb8={'count':0x0,'rows':[]};var _0x544818=_[_0x7d97('0x27')](db[_0x7d97('0x28')]['rawAttributes'],function(_0x5e5ea2){return{'name':_0x5e5ea2['fieldName'],'type':_0x5e5ea2[_0x7d97('0x29')][_0x7d97('0x2a')]};});_0x20ab00[_0x7d97('0x2b')]=_[_0x7d97('0x27')](_0x544818,'name');_0x20ab00['query']=_[_0x7d97('0x2c')](_0x4d4b1f[_0x7d97('0x2d')]);_0x20ab00[_0x7d97('0x2e')]=_['intersection'](_0x20ab00[_0x7d97('0x2b')],_0x20ab00[_0x7d97('0x2d')]);_0x1050ad['attributes']=_[_0x7d97('0x2f')](_0x20ab00['model'],qs[_0x7d97('0x30')](_0x4d4b1f[_0x7d97('0x2d')][_0x7d97('0x30')]));_0x1050ad[_0x7d97('0x31')]=_0x1050ad['attributes'][_0x7d97('0x32')]?_0x1050ad[_0x7d97('0x31')]:_0x20ab00[_0x7d97('0x2b')];if(!_0x4d4b1f[_0x7d97('0x2d')]['hasOwnProperty'](_0x7d97('0x33'))){_0x1050ad[_0x7d97('0x19')]=qs[_0x7d97('0x19')](_0x4d4b1f[_0x7d97('0x2d')][_0x7d97('0x19')]);_0x1050ad['offset']=qs[_0x7d97('0x1b')](_0x4d4b1f[_0x7d97('0x2d')][_0x7d97('0x1b')]);}_0x1050ad['order']=qs[_0x7d97('0x34')](_0x4d4b1f[_0x7d97('0x2d')][_0x7d97('0x34')]);_0x1050ad['where']=qs['filters'](_[_0x7d97('0x35')](_0x4d4b1f[_0x7d97('0x2d')],_0x20ab00[_0x7d97('0x2e')]),_0x544818);if(_0x4d4b1f['query'][_0x7d97('0x36')]){_0x1050ad[_0x7d97('0x37')]=_[_0x7d97('0x38')](_0x1050ad[_0x7d97('0x37')],{'$or':_['map'](_0x544818,function(_0x391c24){if(_0x391c24[_0x7d97('0x29')]!==_0x7d97('0x39')){var _0x259423={};_0x259423[_0x391c24[_0x7d97('0x26')]]={'$like':'%'+_0x4d4b1f[_0x7d97('0x2d')]['filter']+'%'};return _0x259423;}})});}_0x1050ad=_[_0x7d97('0x38')]({},_0x1050ad,_0x4d4b1f[_0x7d97('0x3a')]);var _0xff9764={'where':_0x1050ad[_0x7d97('0x37')]};return db[_0x7d97('0x28')][_0x7d97('0x1a')](_0xff9764)['then'](function(_0x3d1358){_0x38adb8['count']=_0x3d1358;if(_0x4d4b1f[_0x7d97('0x2d')][_0x7d97('0x3b')]){_0x1050ad[_0x7d97('0x3c')]=[{'all':!![]}];}return db[_0x7d97('0x28')]['findAll'](_0x1050ad);})[_0x7d97('0x22')](function(_0x5a5c8c){_0x38adb8[_0x7d97('0x3d')]=_0x5a5c8c;return _0x38adb8;})[_0x7d97('0x22')](respondWithFilteredResult(_0x37066c,_0x1050ad))[_0x7d97('0x3e')](handleError(_0x37066c,null));};exports[_0x7d97('0x3f')]=function(_0x2bb45e,_0x4e13c8){var _0x195042={'raw':!![],'where':{'id':_0x2bb45e['params']['id']}},_0x1cfb53={};_0x1cfb53[_0x7d97('0x2b')]=_[_0x7d97('0x2c')](db[_0x7d97('0x28')][_0x7d97('0x40')]);_0x1cfb53[_0x7d97('0x2d')]=_['keys'](_0x2bb45e[_0x7d97('0x2d')]);_0x1cfb53['filters']=_[_0x7d97('0x2f')](_0x1cfb53[_0x7d97('0x2b')],_0x1cfb53['query']);_0x195042['attributes']=_['intersection'](_0x1cfb53[_0x7d97('0x2b')],qs[_0x7d97('0x30')](_0x2bb45e[_0x7d97('0x2d')][_0x7d97('0x30')]));_0x195042[_0x7d97('0x31')]=_0x195042[_0x7d97('0x31')]['length']?_0x195042[_0x7d97('0x31')]:_0x1cfb53[_0x7d97('0x2b')];if(_0x2bb45e[_0x7d97('0x2d')][_0x7d97('0x3b')]){_0x195042['include']=[{'all':!![]}];}_0x195042=_[_0x7d97('0x38')]({},_0x195042,_0x2bb45e[_0x7d97('0x3a')]);return db['Sound']['find'](_0x195042)['then'](handleEntityNotFound(_0x4e13c8,null))[_0x7d97('0x22')](respondWithResult(_0x4e13c8,null))['catch'](handleError(_0x4e13c8,null));};exports[_0x7d97('0x41')]=function(_0x9f8c2d,_0x365d7c,_0x396413){return db[_0x7d97('0x28')][_0x7d97('0x42')]({'where':{'id':_0x9f8c2d[_0x7d97('0x43')]['id']},'attributes':[_0x7d97('0x26'),_0x7d97('0x44'),_0x7d97('0x45')],'raw':!![]})['then'](handleEntityNotFound(_0x365d7c,null))['then'](function(_0x3b6c15){if(_0x3b6c15){if(!fs[_0x7d97('0x46')](path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x49'),_0x3b6c15[_0x7d97('0x44')]+'.'+_0x3b6c15[_0x7d97('0x45')]))){throw new db[(_0x7d97('0x4a'))][(_0x7d97('0x4b'))]('Sound\x20not\x20found');}return _0x365d7c[_0x7d97('0x41')](path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x49'),util['format'](_0x7d97('0x4c'),_0x3b6c15['save_name'],_0x3b6c15[_0x7d97('0x45')])),util['format']('%s.%s',_0x3b6c15['name'],_0x3b6c15['converted_format']));}return null;})['catch'](handleError(_0x365d7c,null));};exports[_0x7d97('0x4d')]=function(_0x2c6eda,_0xa0bb98,_0x557ded){var _0x4d5b3e={'name':path[_0x7d97('0x4e')](_0x2c6eda[_0x7d97('0x4f')]['originalname'],path[_0x7d97('0x50')](_0x2c6eda[_0x7d97('0x4f')]['originalname'])),'save_name':path[_0x7d97('0x4e')](_0x2c6eda[_0x7d97('0x4f')][_0x7d97('0x51')],path[_0x7d97('0x50')](_0x2c6eda['file'][_0x7d97('0x51')])),'original_format':path[_0x7d97('0x50')](_0x2c6eda[_0x7d97('0x4f')][_0x7d97('0x52')])['substring'](0x1),'converted_format':'wav'};var _0x2c05d3=path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x53'),_0x2c6eda[_0x7d97('0x4f')][_0x7d97('0x51')]);var _0x3c86b7=path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x49'),util[_0x7d97('0x54')]('%s.%s',path[_0x7d97('0x4e')](_0x2c6eda[_0x7d97('0x4f')][_0x7d97('0x51')],path['extname'](_0x2c6eda[_0x7d97('0x4f')][_0x7d97('0x51')])),_0x4d5b3e['converted_format']));logger[_0x7d97('0x55')](_0x7d97('0x56'),_0x2c05d3);logger[_0x7d97('0x55')](_0x7d97('0x57'),_0x3c86b7);try{fs['chmodSync'](_0x2c05d3,parseInt(_0x7d97('0x58'),0x8));var _0x6e7aef=sox[_0x7d97('0x59')](_0x2c05d3,_0x3c86b7,{'sampleRate':0x1f40,'format':_0x7d97('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6e7aef['on'](_0x7d97('0x25'),function(_0x416c61){fs[_0x7d97('0x5b')](_0x2c05d3);_0xa0bb98[_0x7d97('0x16')](0x1f4)[_0x7d97('0x5c')](_0x416c61);});_0x6e7aef['on'](_0x7d97('0x5d'),function(_0x58680b){_0x4d5b3e[_0x7d97('0x5e')]=isNaN(_0x58680b[_0x7d97('0x5f')])?null:_0x58680b[_0x7d97('0x5f')]*0x3e8;_0x4d5b3e[_0x7d97('0x60')]=isNaN(_0x58680b[_0x7d97('0x61')])?null:_0x58680b[_0x7d97('0x61')];_0x4d5b3e['original_channelCount']=isNaN(_0x58680b[_0x7d97('0x62')])?null:_0x58680b['channelCount'];_0x4d5b3e['original_bitRate']=isNaN(_0x58680b[_0x7d97('0x63')])?null:_0x58680b[_0x7d97('0x63')];_0x4d5b3e[_0x7d97('0x64')]=isNaN(_0x58680b[_0x7d97('0x65')])?null:_0x58680b[_0x7d97('0x65')];});_0x6e7aef['on'](_0x7d97('0x66'),function(_0x181deb){_0x4d5b3e['converted_duration']=isNaN(_0x181deb[_0x7d97('0x5f')])?null:_0x181deb['duration']*0x3e8;_0x4d5b3e['converted_sampleCount']=isNaN(_0x181deb['sampleCount'])?null:_0x181deb['sampleCount'];_0x4d5b3e[_0x7d97('0x67')]=isNaN(_0x181deb[_0x7d97('0x62')])?null:_0x181deb[_0x7d97('0x62')];_0x4d5b3e[_0x7d97('0x68')]=isNaN(_0x181deb[_0x7d97('0x63')])?null:_0x181deb[_0x7d97('0x63')];_0x4d5b3e[_0x7d97('0x69')]=isNaN(_0x181deb[_0x7d97('0x65')])?null:_0x181deb[_0x7d97('0x65')];});_0x6e7aef['on'](_0x7d97('0x24'),function(){fs['chmodSync'](_0x3c86b7,parseInt('0777',0x8));return db['Sound']['create'](_0x4d5b3e)[_0x7d97('0x22')](function(_0xddb2c3){var _0x166fd1={'role':_0x2c6eda['body'][_0x7d97('0x6a')],'userProfileId':_0x2c6eda[_0x7d97('0x6b')]['userProfileId']};if(!_0x166fd1)throw new Error(_0x7d97('0x6c'));if(_0x166fd1[_0x7d97('0x6a')]===_0x7d97('0x6d')){var _0x236643=_0xddb2c3[_0x7d97('0x23')]({'plain':!![]});return db[_0x7d97('0x6e')]['find']({'where':{'name':'Sounds','userProfileId':_0x166fd1[_0x7d97('0x6f')]},'raw':!![]})['then'](function(_0x404356){if(_0x404356&&_0x404356['autoAssociation']===0x0){return db[_0x7d97('0x70')][_0x7d97('0x4d')]({'name':_0x236643[_0x7d97('0x26')],'resourceId':_0x236643['id'],'type':_0x404356['name'],'sectionId':_0x404356['id']},{})[_0x7d97('0x22')](function(){return _0xddb2c3;});}else{return _0xddb2c3;}})[_0x7d97('0x3e')](function(_0x395048){logger[_0x7d97('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x395048);throw _0x395048;});}return _0xddb2c3;})[_0x7d97('0x22')](respondWithResult(_0xa0bb98,null))[_0x7d97('0x3e')](handleError(_0xa0bb98,null));});_0x6e7aef['start']();}catch(_0x4006c8){_0xa0bb98[_0x7d97('0x16')](0x1f4)[_0x7d97('0x5c')](_0x4006c8);}};exports[_0x7d97('0x20')]=function(_0x43c4ea,_0x5d5a69,_0xb671e2){return db[_0x7d97('0x28')]['find']({'where':{'id':_0x43c4ea[_0x7d97('0x43')]['id']}})[_0x7d97('0x22')](handleEntityNotFound(_0x5d5a69,null))['then'](saveUpdates(_[_0x7d97('0x35')](_0x43c4ea[_0x7d97('0x6b')],[_0x7d97('0x26'),'description']),null))['then'](respondWithResult(_0x5d5a69,null))[_0x7d97('0x3e')](handleError(_0x5d5a69,null));};exports[_0x7d97('0x71')]=function(_0x3a5d2c,_0x1957fd,_0x4e5cee){return db['Sound'][_0x7d97('0x42')]({'where':{'id':_0x3a5d2c[_0x7d97('0x43')]['id']}})[_0x7d97('0x22')](function(_0x4fa7ce){if(_0x4fa7ce){return _0x4fa7ce[_0x7d97('0x21')]();}})[_0x7d97('0x22')](function(_0x4282b5){var _0xdd4b59=path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x53'),util[_0x7d97('0x54')](_0x7d97('0x4c'),_0x4282b5[_0x7d97('0x44')],_0x4282b5[_0x7d97('0x72')]));var _0x4ec068=path[_0x7d97('0x47')](config[_0x7d97('0x48')],_0x7d97('0x49'),util[_0x7d97('0x54')](_0x7d97('0x4c'),_0x4282b5[_0x7d97('0x44')],_0x4282b5[_0x7d97('0x45')]));fs[_0x7d97('0x5b')](_0xdd4b59);fs[_0x7d97('0x5b')](_0x4ec068);return _0x4282b5;})[_0x7d97('0x22')](function(_0x1d64ea){if(_0x1d64ea){return _0x1957fd[_0x7d97('0x16')](0xcc)[_0x7d97('0x24')]();}})[_0x7d97('0x22')](handleEntityNotFound(_0x1957fd,null))['catch'](handleError(_0x1957fd,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e45f821..ce80eae 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 _0x9226=['exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./sound.attributes'];(function(_0x1f2205,_0x45ea06){var _0x21c232=function(_0x506add){while(--_0x506add){_0x1f2205['push'](_0x1f2205['shift']());}};_0x21c232(++_0x45ea06);}(_0x9226,0x1e4));var _0x6922=function(_0x21daf5,_0x2b34fb){_0x21daf5=_0x21daf5-0x0;var _0x7cdfad=_0x9226[_0x21daf5];return _0x7cdfad;};'use strict';var _=require(_0x6922('0x0'));var util=require(_0x6922('0x1'));var logger=require(_0x6922('0x2'))(_0x6922('0x3'));var moment=require(_0x6922('0x4'));var BPromise=require(_0x6922('0x5'));var rp=require(_0x6922('0x6'));var fs=require('fs');var path=require(_0x6922('0x7'));var rimraf=require('rimraf');var config=require(_0x6922('0x8'));var attributes=require(_0x6922('0x9'));module[_0x6922('0xa')]=function(_0x25a7cf,_0x5459b6){return _0x25a7cf[_0x6922('0xb')]('Sound',attributes,{'tableName':_0x6922('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a24=['path','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','api','bluebird','request-promise'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x6a24,0x92));var _0x46a2=function(_0x4496fc,_0x3e4bdb){_0x4496fc=_0x4496fc-0x0;var _0x5dcf3d=_0x6a24[_0x4496fc];return _0x5dcf3d;};'use strict';var _=require('lodash');var util=require(_0x46a2('0x0'));var logger=require('../../config/logger')(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var fs=require('fs');var path=require(_0x46a2('0x4'));var rimraf=require('rimraf');var config=require(_0x46a2('0x5'));var attributes=require(_0x46a2('0x6'));module[_0x46a2('0x7')]=function(_0x402c79,_0x4d3f5c){return _0x402c79[_0x46a2('0x8')]('Sound',attributes,{'tableName':_0x46a2('0x9'),'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 835d487..5565a78 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 _0xc27c=['find','options','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xc27c,0x1e9));var _0xcc27=function(_0x193572,_0x1e36f4){_0x193572=_0x193572-0x0;var _0x31f0b0=_0xc27c[_0x193572];return _0x31f0b0;};'use strict';var _=require(_0xcc27('0x0'));var util=require(_0xcc27('0x1'));var moment=require(_0xcc27('0x2'));var BPromise=require(_0xcc27('0x3'));var rs=require(_0xcc27('0x4'));var fs=require('fs');var Redis=require(_0xcc27('0x5'));var db=require(_0xcc27('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc27('0x7'));var config=require(_0xcc27('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c6fe5,_0x5cbc17,_0x2b469c){return new BPromise(function(_0x4bc5b6,_0x7faf52){return client[_0xcc27('0xa')](_0x1c6fe5,_0x2b469c)['then'](function(_0x372d07){logger[_0xcc27('0xb')](_0xcc27('0xc'),_0x5cbc17,_0xcc27('0xd'));logger['debug'](_0xcc27('0xe'),_0x5cbc17,_0xcc27('0xd'),JSON[_0xcc27('0xf')](_0x372d07));if(_0x372d07[_0xcc27('0x10')]){if(_0x372d07[_0xcc27('0x10')][_0xcc27('0x11')]===0x1f4){logger[_0xcc27('0x10')](_0xcc27('0xc'),_0x5cbc17,_0x372d07['error']['message']);return _0x7faf52(_0x372d07[_0xcc27('0x10')][_0xcc27('0x12')]);}logger[_0xcc27('0x10')]('Sound,\x20%s,\x20%s',_0x5cbc17,_0x372d07['error'][_0xcc27('0x12')]);return _0x4bc5b6(_0x372d07[_0xcc27('0x10')][_0xcc27('0x12')]);}else{logger[_0xcc27('0xb')](_0xcc27('0xc'),_0x5cbc17,'request\x20sent');_0x4bc5b6(_0x372d07[_0xcc27('0x13')]['message']);}})[_0xcc27('0x14')](function(_0x19cc22){logger[_0xcc27('0x10')](_0xcc27('0xc'),_0x5cbc17,_0x19cc22);_0x7faf52(_0x19cc22);});});}exports[_0xcc27('0x15')]=function(_0x24d72d){var _0x296046=this;return new Promise(function(_0x499d93,_0x12336d){return db[_0xcc27('0x16')][_0xcc27('0x17')]({'raw':_0x24d72d[_0xcc27('0x18')]?_0x24d72d[_0xcc27('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x24d72d[_0xcc27('0x18')]?_0x24d72d['options'][_0xcc27('0x19')]||null:null,'attributes':_0x24d72d['options']?_0x24d72d[_0xcc27('0x18')][_0xcc27('0x1a')]||null:null,'include':_0x24d72d[_0xcc27('0x18')]?_0x24d72d['options'][_0xcc27('0x1b')]?_[_0xcc27('0x1c')](_0x24d72d['options']['include'],function(_0x3fb240){return{'model':db[_0x3fb240[_0xcc27('0x1d')]],'as':_0x3fb240['as'],'attributes':_0x3fb240[_0xcc27('0x1a')],'include':_0x3fb240[_0xcc27('0x1b')]?_[_0xcc27('0x1c')](_0x3fb240[_0xcc27('0x1b')],function(_0x206e34){return{'model':db[_0x206e34['model']],'as':_0x206e34['as'],'attributes':_0x206e34[_0xcc27('0x1a')],'include':_0x206e34[_0xcc27('0x1b')]?_[_0xcc27('0x1c')](_0x206e34[_0xcc27('0x1b')],function(_0x373fde){return{'model':db[_0x373fde[_0xcc27('0x1d')]],'as':_0x373fde['as'],'attributes':_0x373fde[_0xcc27('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc27('0x1e')](function(_0x15e28b){logger[_0xcc27('0xb')]('ShowSound',_0x24d72d);logger[_0xcc27('0x1f')](_0xcc27('0x15'),_0x24d72d,JSON[_0xcc27('0xf')](_0x15e28b));_0x499d93(_0x15e28b);})[_0xcc27('0x14')](function(_0x4c3111){logger[_0xcc27('0x10')](_0xcc27('0x15'),_0x4c3111['message'],_0x24d72d);_0x12336d(_0x296046['error'](0x1f4,_0x4c3111[_0xcc27('0x12')]));});});}; \ No newline at end of file +var _0xb934=['model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','find','options','raw','where','attributes','map','include'];(function(_0xb6afda,_0x55854e){var _0x8c25e3=function(_0x550be5){while(--_0x550be5){_0xb6afda['push'](_0xb6afda['shift']());}};_0x8c25e3(++_0x55854e);}(_0xb934,0x111));var _0x4b93=function(_0x1c8d3b,_0x57c66b){_0x1c8d3b=_0x1c8d3b-0x0;var _0x4f1b34=_0xb934[_0x1c8d3b];return _0x4f1b34;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var moment=require(_0x4b93('0x2'));var BPromise=require(_0x4b93('0x3'));var rs=require(_0x4b93('0x4'));var fs=require('fs');var Redis=require(_0x4b93('0x5'));var db=require(_0x4b93('0x6'))['db'];var utils=require(_0x4b93('0x7'));var logger=require(_0x4b93('0x8'))(_0x4b93('0x9'));var config=require(_0x4b93('0xa'));var jayson=require(_0x4b93('0xb'));var client=jayson[_0x4b93('0xc')][_0x4b93('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c45ad,_0xda89f4,_0x2c063c){return new BPromise(function(_0x34caee,_0x289647){return client[_0x4b93('0xe')](_0x4c45ad,_0x2c063c)[_0x4b93('0xf')](function(_0x10418a){logger['info']('Sound,\x20%s,\x20%s',_0xda89f4,_0x4b93('0x10'));logger['debug'](_0x4b93('0x11'),_0xda89f4,_0x4b93('0x10'),JSON[_0x4b93('0x12')](_0x10418a));if(_0x10418a[_0x4b93('0x13')]){if(_0x10418a[_0x4b93('0x13')][_0x4b93('0x14')]===0x1f4){logger[_0x4b93('0x13')](_0x4b93('0x15'),_0xda89f4,_0x10418a['error']['message']);return _0x289647(_0x10418a[_0x4b93('0x13')][_0x4b93('0x16')]);}logger[_0x4b93('0x13')](_0x4b93('0x15'),_0xda89f4,_0x10418a[_0x4b93('0x13')][_0x4b93('0x16')]);return _0x34caee(_0x10418a[_0x4b93('0x13')]['message']);}else{logger[_0x4b93('0x17')](_0x4b93('0x15'),_0xda89f4,_0x4b93('0x10'));_0x34caee(_0x10418a[_0x4b93('0x18')][_0x4b93('0x16')]);}})['catch'](function(_0x14709d){logger['error'](_0x4b93('0x15'),_0xda89f4,_0x14709d);_0x289647(_0x14709d);});});}exports[_0x4b93('0x19')]=function(_0x573aa7){var _0x5d7d8a=this;return new Promise(function(_0x4c814d,_0x1f4c23){return db['Sound'][_0x4b93('0x1a')]({'raw':_0x573aa7['options']?_0x573aa7[_0x4b93('0x1b')][_0x4b93('0x1c')]===undefined?!![]:![]:!![],'where':_0x573aa7['options']?_0x573aa7[_0x4b93('0x1b')][_0x4b93('0x1d')]||null:null,'attributes':_0x573aa7[_0x4b93('0x1b')]?_0x573aa7[_0x4b93('0x1b')][_0x4b93('0x1e')]||null:null,'include':_0x573aa7[_0x4b93('0x1b')]?_0x573aa7['options']['include']?_[_0x4b93('0x1f')](_0x573aa7[_0x4b93('0x1b')][_0x4b93('0x20')],function(_0x4e06b2){return{'model':db[_0x4e06b2[_0x4b93('0x21')]],'as':_0x4e06b2['as'],'attributes':_0x4e06b2['attributes'],'include':_0x4e06b2[_0x4b93('0x20')]?_['map'](_0x4e06b2['include'],function(_0x5c8672){return{'model':db[_0x5c8672[_0x4b93('0x21')]],'as':_0x5c8672['as'],'attributes':_0x5c8672[_0x4b93('0x1e')],'include':_0x5c8672[_0x4b93('0x20')]?_[_0x4b93('0x1f')](_0x5c8672['include'],function(_0x321431){return{'model':db[_0x321431['model']],'as':_0x321431['as'],'attributes':_0x321431[_0x4b93('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4b93('0xf')](function(_0x37cbc3){logger[_0x4b93('0x17')](_0x4b93('0x19'),_0x573aa7);logger['debug'](_0x4b93('0x19'),_0x573aa7,JSON[_0x4b93('0x12')](_0x37cbc3));_0x4c814d(_0x37cbc3);})['catch'](function(_0x404045){logger['error'](_0x4b93('0x19'),_0x404045[_0x4b93('0x16')],_0x573aa7);_0x1f4c23(_0x5d7d8a[_0x4b93('0x13')](0x1f4,_0x404045[_0x4b93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8a2a97a..ac8e0fd 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x5615c4,_0x127d58){var _0x524690=function(_0x4cbf4){while(--_0x4cbf4){_0x5615c4['push'](_0x5615c4['shift']());}};_0x524690(++_0x127d58);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4239bd,_0x1f310b){_0x4239bd=_0x4239bd-0x0;var _0x21f061=_0x5eb8[_0x4239bd];return _0x21f061;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5338fe,_0x5e71d1){var _0xf0a1be=function(_0x306a01){while(--_0x306a01){_0x5338fe['push'](_0x5338fe['shift']());}};_0xf0a1be(++_0x5e71d1);}(_0x4fc2,0x111));var _0x24fc=function(_0x1d4bdb,_0x58f77b){_0x1d4bdb=_0x1d4bdb-0x0;var _0x288bea=_0x4fc2[_0x1d4bdb];return _0x288bea;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 71115c6..375e907 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 _0xf701=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x3c073f,_0x201853){var _0x136bce=function(_0x103d0b){while(--_0x103d0b){_0x3c073f['push'](_0x3c073f['shift']());}};_0x136bce(++_0x201853);}(_0xf701,0xff));var _0x1f70=function(_0x2ef34c,_0x3bd258){_0x2ef34c=_0x2ef34c-0x0;var _0xd01d83=_0xf701[_0x2ef34c];return _0xd01d83;};'use strict';var Sequelize=require(_0x1f70('0x0'));module[_0x1f70('0x1')]={'uniqueid':{'type':Sequelize[_0x1f70('0x2')]},'body':{'type':Sequelize[_0x1f70('0x3')](_0x1f70('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x1f70('0x5')]('in',_0x1f70('0x6')),'defaultValue':_0x1f70('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1f70('0x3')]}}; \ No newline at end of file +var _0x913e=['STRING','TEXT','medium','out','exports'];(function(_0x1418f8,_0xc62d19){var _0x40f59b=function(_0x14736d){while(--_0x14736d){_0x1418f8['push'](_0x1418f8['shift']());}};_0x40f59b(++_0xc62d19);}(_0x913e,0x1d0));var _0xe913=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x913e[_0x3ce2c4];return _0x4047c1;};'use strict';var Sequelize=require('sequelize');module[_0xe913('0x0')]={'uniqueid':{'type':Sequelize[_0xe913('0x1')]},'body':{'type':Sequelize[_0xe913('0x2')](_0xe913('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe913('0x4')),'defaultValue':_0xe913('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe913('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 876cb71..192a4ee 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 _0x7708=['destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','key','model','keys','intersection','query','attributes','fields','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','eml-format','rimraf','fast-json-patch','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then'];(function(_0xb2dd3f,_0x32fb7c){var _0x142cbc=function(_0x2ae596){while(--_0x2ae596){_0xb2dd3f['push'](_0xb2dd3f['shift']());}};_0x142cbc(++_0x32fb7c);}(_0x7708,0x188));var _0x8770=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x7708[_0x50cfc3];return _0x5c11ef;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){_0x468fc0[_0x8770('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b4755,_0x453804){return function(_0x473d31){if(!_0x473d31){_0x7b4755[_0x8770('0x16')](0x194);}return _0x473d31;};}function handleError(_0x1538b2,_0x2cd084){_0x2cd084=_0x2cd084||0x1f4;return function(_0x293f53){logger[_0x8770('0x23')](_0x293f53[_0x8770('0x24')]);if(_0x293f53[_0x8770('0x25')]){delete _0x293f53['name'];}_0x1538b2[_0x8770('0x17')](_0x2cd084)[_0x8770('0x26')](_0x293f53);};}exports[_0x8770('0x27')]=function(_0x5c7bd,_0x246128){var _0x200a82={},_0x5ae7b8={},_0x4b284b={'count':0x0,'rows':[]};var _0x37974d=_[_0x8770('0x28')](db[_0x8770('0x29')][_0x8770('0x2a')],function(_0x23f4b0){return{'name':_0x23f4b0['fieldName'],'type':_0x23f4b0['type'][_0x8770('0x2b')]};});_0x5ae7b8[_0x8770('0x2c')]=_[_0x8770('0x28')](_0x37974d,_0x8770('0x25'));_0x5ae7b8['query']=_[_0x8770('0x2d')](_0x5c7bd['query']);_0x5ae7b8['filters']=_[_0x8770('0x2e')](_0x5ae7b8['model'],_0x5ae7b8[_0x8770('0x2f')]);_0x200a82[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x5ae7b8[_0x8770('0x2c')],qs[_0x8770('0x31')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x31')]));_0x200a82[_0x8770('0x30')]=_0x200a82[_0x8770('0x30')]['length']?_0x200a82[_0x8770('0x30')]:_0x5ae7b8[_0x8770('0x2c')];if(!_0x5c7bd[_0x8770('0x2f')]['hasOwnProperty']('nolimit')){_0x200a82[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x5c7bd[_0x8770('0x2f')]['limit']);_0x200a82[_0x8770('0x1a')]=qs['offset'](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x1a')]);}_0x200a82[_0x8770('0x32')]=qs[_0x8770('0x33')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x33')]);_0x200a82[_0x8770('0x34')]=qs[_0x8770('0x35')](_[_0x8770('0x36')](_0x5c7bd[_0x8770('0x2f')],_0x5ae7b8['filters']),_0x37974d);if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x37')]){_0x200a82[_0x8770('0x34')]=_['merge'](_0x200a82[_0x8770('0x34')],{'$or':_[_0x8770('0x28')](_0x37974d,function(_0x27f91c){if(_0x27f91c[_0x8770('0x38')]!==_0x8770('0x39')){var _0x3a50db={};_0x3a50db[_0x27f91c['name']]={'$like':'%'+_0x5c7bd[_0x8770('0x2f')]['filter']+'%'};return _0x3a50db;}})});}_0x200a82=_[_0x8770('0x3a')]({},_0x200a82,_0x5c7bd['options']);var _0x41134a={'where':_0x200a82[_0x8770('0x34')]};return db[_0x8770('0x29')]['count'](_0x41134a)[_0x8770('0x21')](function(_0x3f35ac){_0x4b284b[_0x8770('0x1b')]=_0x3f35ac;if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x3b')]){_0x200a82[_0x8770('0x3c')]=[{'all':!![]}];}return db['SquareMessage'][_0x8770('0x3d')](_0x200a82);})['then'](function(_0x4bcfc7){_0x4b284b[_0x8770('0x3e')]=_0x4bcfc7;return _0x4b284b;})[_0x8770('0x21')](respondWithFilteredResult(_0x246128,_0x200a82))[_0x8770('0x3f')](handleError(_0x246128,null));};exports[_0x8770('0x40')]=function(_0x3a51b5,_0x4b4477){var _0x35b182={'raw':!![],'where':{'id':_0x3a51b5['params']['id']}},_0x26ae1b={};_0x26ae1b[_0x8770('0x2c')]=_['keys'](db[_0x8770('0x29')][_0x8770('0x2a')]);_0x26ae1b[_0x8770('0x2f')]=_[_0x8770('0x2d')](_0x3a51b5[_0x8770('0x2f')]);_0x26ae1b[_0x8770('0x35')]=_[_0x8770('0x2e')](_0x26ae1b[_0x8770('0x2c')],_0x26ae1b[_0x8770('0x2f')]);_0x35b182[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x26ae1b['model'],qs[_0x8770('0x31')](_0x3a51b5[_0x8770('0x2f')][_0x8770('0x31')]));_0x35b182[_0x8770('0x30')]=_0x35b182[_0x8770('0x30')][_0x8770('0x41')]?_0x35b182['attributes']:_0x26ae1b[_0x8770('0x2c')];if(_0x3a51b5[_0x8770('0x2f')][_0x8770('0x3b')]){_0x35b182[_0x8770('0x3c')]=[{'all':!![]}];}_0x35b182=_[_0x8770('0x3a')]({},_0x35b182,_0x3a51b5[_0x8770('0x42')]);return db[_0x8770('0x29')][_0x8770('0x43')](_0x35b182)['then'](handleEntityNotFound(_0x4b4477,null))[_0x8770('0x21')](respondWithResult(_0x4b4477,null))[_0x8770('0x3f')](handleError(_0x4b4477,null));};exports[_0x8770('0x44')]=function(_0xaeaf3b,_0x454496){return db['SquareMessage']['create'](_0xaeaf3b[_0x8770('0x45')],{})['then'](respondWithResult(_0x454496,0xc9))[_0x8770('0x3f')](handleError(_0x454496,null));};exports['update']=function(_0x4f9e0b,_0x3805d8){if(_0x4f9e0b[_0x8770('0x45')]['id']){delete _0x4f9e0b[_0x8770('0x45')]['id'];}return db[_0x8770('0x29')]['find']({'where':{'id':_0x4f9e0b[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x3805d8,null))['then'](saveUpdates(_0x4f9e0b['body'],null))[_0x8770('0x21')](respondWithResult(_0x3805d8,null))[_0x8770('0x3f')](handleError(_0x3805d8,null));};exports[_0x8770('0x22')]=function(_0x4f5cb8,_0x1584dc){return db['SquareMessage'][_0x8770('0x43')]({'where':{'id':_0x4f5cb8[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x1584dc,null))['then'](removeEntity(_0x1584dc,null))[_0x8770('0x3f')](handleError(_0x1584dc,null));}; \ No newline at end of file +var _0x383b=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','show','params','include','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x43d267,_0x364eec){var _0x3c3882=function(_0x55e3b2){while(--_0x55e3b2){_0x43d267['push'](_0x43d267['shift']());}};_0x3c3882(++_0x364eec);}(_0x383b,0x89));var _0xb383=function(_0x4746ec,_0x2b42d1){_0x4746ec=_0x4746ec-0x0;var _0x13fce3=_0x383b[_0x4746ec];return _0x13fce3;};'use strict';var emlformat=require(_0xb383('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb383('0x1'));var jsonpatch=require(_0xb383('0x2'));var rp=require(_0xb383('0x3'));var moment=require('moment');var BPromise=require(_0xb383('0x4'));var Mustache=require('mustache');var util=require(_0xb383('0x5'));var path=require(_0xb383('0x6'));var sox=require(_0xb383('0x7'));var csv=require(_0xb383('0x8'));var ejs=require(_0xb383('0x9'));var fs=require('fs');var fs_extra=require(_0xb383('0xa'));var _=require('lodash');var squel=require(_0xb383('0xb'));var crypto=require(_0xb383('0xc'));var jsforce=require(_0xb383('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb383('0xe'));var Papa=require(_0xb383('0xf'));var Redis=require(_0xb383('0x10'));var authService=require(_0xb383('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb383('0x12'));var hardwareService=require(_0xb383('0x13'));var logger=require(_0xb383('0x14'))(_0xb383('0x15'));var utils=require(_0xb383('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb383('0x17'));var db=require(_0xb383('0x18'))['db'];function respondWithStatusCode(_0x590783,_0x22001f){_0x22001f=_0x22001f||0xcc;return function(_0x16091f){if(_0x16091f){return _0x590783[_0xb383('0x19')](_0x22001f);}return _0x590783[_0xb383('0x1a')](_0x22001f)[_0xb383('0x1b')]();};}function respondWithResult(_0x1e8107,_0x41f716){_0x41f716=_0x41f716||0xc8;return function(_0x5f1c6e){if(_0x5f1c6e){return _0x1e8107[_0xb383('0x1a')](_0x41f716)[_0xb383('0x1c')](_0x5f1c6e);}};}function respondWithFilteredResult(_0x1cdcb7,_0xfbc68f){return function(_0x4b3cb5){if(_0x4b3cb5){var _0x41cf3f=typeof _0xfbc68f[_0xb383('0x1d')]===_0xb383('0x1e')&&typeof _0xfbc68f['limit']===_0xb383('0x1e');var _0x24a72e=_0x4b3cb5[_0xb383('0x1f')];var _0x11d0ed=_0x41cf3f?0x0:_0xfbc68f[_0xb383('0x1d')];var _0x421a36=_0x41cf3f?_0x4b3cb5['count']:_0xfbc68f[_0xb383('0x1d')]+_0xfbc68f['limit'];var _0x151642;if(_0x421a36>=_0x24a72e){_0x421a36=_0x24a72e;_0x151642=0xc8;}else{_0x151642=0xce;}_0x1cdcb7[_0xb383('0x1a')](_0x151642);return _0x1cdcb7[_0xb383('0x20')](_0xb383('0x21'),_0x11d0ed+'-'+_0x421a36+'/'+_0x24a72e)[_0xb383('0x1c')](_0x4b3cb5);}return null;};}function patchUpdates(_0x58bedb){return function(_0x1c9b4f){try{jsonpatch[_0xb383('0x22')](_0x1c9b4f,_0x58bedb,!![]);}catch(_0x1c0246){return BPromise['reject'](_0x1c0246);}return _0x1c9b4f[_0xb383('0x23')]();};}function saveUpdates(_0x45158e,_0x3c354c){return function(_0x571f83){if(_0x571f83){return _0x571f83['update'](_0x45158e)[_0xb383('0x24')](function(_0x127d1b){return _0x127d1b;});}return null;};}function removeEntity(_0x306dd7,_0x38d029){return function(_0xb0d2a8){if(_0xb0d2a8){return _0xb0d2a8[_0xb383('0x25')]()[_0xb383('0x24')](function(){_0x306dd7[_0xb383('0x1a')](0xcc)[_0xb383('0x1b')]();});}};}function handleEntityNotFound(_0x48ceef,_0x30f704){return function(_0x509ea6){if(!_0x509ea6){_0x48ceef[_0xb383('0x19')](0x194);}return _0x509ea6;};}function handleError(_0xbab0f6,_0xa5c39a){_0xa5c39a=_0xa5c39a||0x1f4;return function(_0x39f1fb){logger[_0xb383('0x26')](_0x39f1fb[_0xb383('0x27')]);if(_0x39f1fb[_0xb383('0x28')]){delete _0x39f1fb['name'];}_0xbab0f6[_0xb383('0x1a')](_0xa5c39a)[_0xb383('0x29')](_0x39f1fb);};}exports[_0xb383('0x2a')]=function(_0x2d304c,_0x4daf45){var _0x3797b7={},_0x10ea31={},_0x4ccb9c={'count':0x0,'rows':[]};var _0x1178db=_[_0xb383('0x2b')](db[_0xb383('0x2c')][_0xb383('0x2d')],function(_0x5d0a58){return{'name':_0x5d0a58[_0xb383('0x2e')],'type':_0x5d0a58[_0xb383('0x2f')]['key']};});_0x10ea31[_0xb383('0x30')]=_[_0xb383('0x2b')](_0x1178db,_0xb383('0x28'));_0x10ea31[_0xb383('0x31')]=_[_0xb383('0x32')](_0x2d304c[_0xb383('0x31')]);_0x10ea31['filters']=_[_0xb383('0x33')](_0x10ea31[_0xb383('0x30')],_0x10ea31[_0xb383('0x31')]);_0x3797b7[_0xb383('0x34')]=_[_0xb383('0x33')](_0x10ea31[_0xb383('0x30')],qs[_0xb383('0x35')](_0x2d304c[_0xb383('0x31')]['fields']));_0x3797b7[_0xb383('0x34')]=_0x3797b7[_0xb383('0x34')][_0xb383('0x36')]?_0x3797b7['attributes']:_0x10ea31[_0xb383('0x30')];if(!_0x2d304c[_0xb383('0x31')]['hasOwnProperty'](_0xb383('0x37'))){_0x3797b7[_0xb383('0x38')]=qs[_0xb383('0x38')](_0x2d304c['query'][_0xb383('0x38')]);_0x3797b7[_0xb383('0x1d')]=qs[_0xb383('0x1d')](_0x2d304c[_0xb383('0x31')][_0xb383('0x1d')]);}_0x3797b7[_0xb383('0x39')]=qs['sort'](_0x2d304c[_0xb383('0x31')][_0xb383('0x3a')]);_0x3797b7[_0xb383('0x3b')]=qs['filters'](_[_0xb383('0x3c')](_0x2d304c[_0xb383('0x31')],_0x10ea31[_0xb383('0x3d')]),_0x1178db);if(_0x2d304c[_0xb383('0x31')][_0xb383('0x3e')]){_0x3797b7[_0xb383('0x3b')]=_[_0xb383('0x3f')](_0x3797b7['where'],{'$or':_['map'](_0x1178db,function(_0x354295){if(_0x354295[_0xb383('0x2f')]!==_0xb383('0x40')){var _0x9fa900={};_0x9fa900[_0x354295[_0xb383('0x28')]]={'$like':'%'+_0x2d304c[_0xb383('0x31')][_0xb383('0x3e')]+'%'};return _0x9fa900;}})});}_0x3797b7=_[_0xb383('0x3f')]({},_0x3797b7,_0x2d304c['options']);var _0x232598={'where':_0x3797b7[_0xb383('0x3b')]};return db[_0xb383('0x2c')][_0xb383('0x1f')](_0x232598)['then'](function(_0x20c0c4){_0x4ccb9c[_0xb383('0x1f')]=_0x20c0c4;if(_0x2d304c['query'][_0xb383('0x41')]){_0x3797b7['include']=[{'all':!![]}];}return db[_0xb383('0x2c')][_0xb383('0x42')](_0x3797b7);})[_0xb383('0x24')](function(_0x1d50ea){_0x4ccb9c['rows']=_0x1d50ea;return _0x4ccb9c;})[_0xb383('0x24')](respondWithFilteredResult(_0x4daf45,_0x3797b7))['catch'](handleError(_0x4daf45,null));};exports[_0xb383('0x43')]=function(_0x4bb0ee,_0x282fd2){var _0x118b25={'raw':!![],'where':{'id':_0x4bb0ee[_0xb383('0x44')]['id']}},_0x272b35={};_0x272b35[_0xb383('0x30')]=_[_0xb383('0x32')](db[_0xb383('0x2c')][_0xb383('0x2d')]);_0x272b35[_0xb383('0x31')]=_[_0xb383('0x32')](_0x4bb0ee[_0xb383('0x31')]);_0x272b35['filters']=_[_0xb383('0x33')](_0x272b35[_0xb383('0x30')],_0x272b35[_0xb383('0x31')]);_0x118b25['attributes']=_[_0xb383('0x33')](_0x272b35[_0xb383('0x30')],qs[_0xb383('0x35')](_0x4bb0ee['query']['fields']));_0x118b25[_0xb383('0x34')]=_0x118b25[_0xb383('0x34')]['length']?_0x118b25[_0xb383('0x34')]:_0x272b35[_0xb383('0x30')];if(_0x4bb0ee[_0xb383('0x31')][_0xb383('0x41')]){_0x118b25[_0xb383('0x45')]=[{'all':!![]}];}_0x118b25=_[_0xb383('0x3f')]({},_0x118b25,_0x4bb0ee['options']);return db[_0xb383('0x2c')][_0xb383('0x46')](_0x118b25)['then'](handleEntityNotFound(_0x282fd2,null))['then'](respondWithResult(_0x282fd2,null))[_0xb383('0x47')](handleError(_0x282fd2,null));};exports['create']=function(_0x43cd23,_0x10d814){return db['SquareMessage'][_0xb383('0x48')](_0x43cd23[_0xb383('0x49')],{})[_0xb383('0x24')](respondWithResult(_0x10d814,0xc9))[_0xb383('0x47')](handleError(_0x10d814,null));};exports[_0xb383('0x4a')]=function(_0x4292c4,_0x4d7ddd){if(_0x4292c4['body']['id']){delete _0x4292c4[_0xb383('0x49')]['id'];}return db['SquareMessage'][_0xb383('0x46')]({'where':{'id':_0x4292c4[_0xb383('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d7ddd,null))[_0xb383('0x24')](saveUpdates(_0x4292c4['body'],null))['then'](respondWithResult(_0x4d7ddd,null))['catch'](handleError(_0x4d7ddd,null));};exports[_0xb383('0x25')]=function(_0x4e2b7c,_0x451947){return db['SquareMessage'][_0xb383('0x46')]({'where':{'id':_0x4e2b7c[_0xb383('0x44')]['id']}})['then'](handleEntityNotFound(_0x451947,null))['then'](removeEntity(_0x451947,null))[_0xb383('0x47')](handleError(_0x451947,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1995de7..b84626d 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 _0x042f=['util','../../config/logger','api','bluebird','path','../../config/environment','SquareMessage'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x042f,0x8c));var _0xf042=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x042f[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0xf042('0x0'));var logger=require(_0xf042('0x1'))(_0xf042('0x2'));var moment=require('moment');var BPromise=require(_0xf042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf042('0x4'));var rimraf=require('rimraf');var config=require(_0xf042('0x5'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1f282b,_0x83173b){return _0x1f282b['define'](_0xf042('0x6'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f7=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','api','moment','bluebird','request-promise'];(function(_0x38c5a9,_0x3db609){var _0x5b7f7d=function(_0x1ecd06){while(--_0x1ecd06){_0x38c5a9['push'](_0x38c5a9['shift']());}};_0x5b7f7d(++_0x3db609);}(_0xa9f7,0x9c));var _0x7a9f=function(_0x44bbdb,_0x4099a2){_0x44bbdb=_0x44bbdb-0x0;var _0x1d4892=_0xa9f7[_0x44bbdb];return _0x1d4892;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7a9f('0x0'));var moment=require(_0x7a9f('0x1'));var BPromise=require(_0x7a9f('0x2'));var rp=require(_0x7a9f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a9f('0x4'));var config=require(_0x7a9f('0x5'));var attributes=require(_0x7a9f('0x6'));module[_0x7a9f('0x7')]=function(_0x17b483,_0x5f00af){return _0x17b483[_0x7a9f('0x8')](_0x7a9f('0x9'),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 b289e76..75d28ff 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 _0xebcd=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash'];(function(_0x1fa97e,_0x5560e3){var _0x26522b=function(_0x21a2ed){while(--_0x21a2ed){_0x1fa97e['push'](_0x1fa97e['shift']());}};_0x26522b(++_0x5560e3);}(_0xebcd,0x1c1));var _0xdebc=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0xebcd[_0x1196bd];return _0x26014f;};'use strict';var _=require(_0xdebc('0x0'));var util=require(_0xdebc('0x1'));var moment=require(_0xdebc('0x2'));var BPromise=require('bluebird');var rs=require(_0xdebc('0x3'));var fs=require('fs');var Redis=require(_0xdebc('0x4'));var db=require(_0xdebc('0x5'))['db'];var utils=require(_0xdebc('0x6'));var logger=require(_0xdebc('0x7'))(_0xdebc('0x8'));var config=require('../../config/environment');var jayson=require(_0xdebc('0x9'));var client=jayson[_0xdebc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b53b0,_0x370b3a,_0x454b5d){return new BPromise(function(_0x473d40,_0x91f1c7){return client[_0xdebc('0xb')](_0x4b53b0,_0x454b5d)[_0xdebc('0xc')](function(_0x4f24b4){logger[_0xdebc('0xd')](_0xdebc('0xe'),_0x370b3a,_0xdebc('0xf'));logger[_0xdebc('0x10')](_0xdebc('0x11'),_0x370b3a,'request\x20sent',JSON[_0xdebc('0x12')](_0x4f24b4));if(_0x4f24b4[_0xdebc('0x13')]){if(_0x4f24b4[_0xdebc('0x13')][_0xdebc('0x14')]===0x1f4){logger[_0xdebc('0x13')](_0xdebc('0xe'),_0x370b3a,_0x4f24b4[_0xdebc('0x13')]['message']);return _0x91f1c7(_0x4f24b4[_0xdebc('0x13')][_0xdebc('0x15')]);}logger[_0xdebc('0x13')](_0xdebc('0xe'),_0x370b3a,_0x4f24b4['error']['message']);return _0x473d40(_0x4f24b4['error'][_0xdebc('0x15')]);}else{logger[_0xdebc('0xd')]('SquareMessage,\x20%s,\x20%s',_0x370b3a,_0xdebc('0xf'));_0x473d40(_0x4f24b4[_0xdebc('0x16')]['message']);}})[_0xdebc('0x17')](function(_0x258441){logger[_0xdebc('0x13')]('SquareMessage,\x20%s,\x20%s',_0x370b3a,_0x258441);_0x91f1c7(_0x258441);});});}exports[_0xdebc('0x18')]=function(_0x599d4f){var _0x6102cb=this;return new Promise(function(_0x48d8e8,_0x4eac4e){return db[_0xdebc('0x19')][_0xdebc('0x1a')](_0x599d4f[_0xdebc('0x1b')],{'raw':_0x599d4f[_0xdebc('0x1c')]?_0x599d4f['options'][_0xdebc('0x1d')]===undefined?!![]:![]:!![]})[_0xdebc('0xc')](function(_0x5073fd){logger[_0xdebc('0xd')](_0xdebc('0x18'),_0x599d4f);logger['debug']('CreateSquareMessage',_0x599d4f,JSON[_0xdebc('0x12')](_0x5073fd));_0x48d8e8(_0x5073fd);})[_0xdebc('0x17')](function(_0x9e981c){logger['error'](_0xdebc('0x18'),_0x9e981c[_0xdebc('0x15')],_0x599d4f);_0x4eac4e(_0x6102cb['error'](0x1f4,_0x9e981c[_0xdebc('0x15')]));});});}; \ No newline at end of file +var _0x4f6a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareMessage','SquareMessage','create','options','catch','util'];(function(_0x3ef815,_0x5c8f74){var _0x4a144f=function(_0x1d92f5){while(--_0x1d92f5){_0x3ef815['push'](_0x3ef815['shift']());}};_0x4a144f(++_0x5c8f74);}(_0x4f6a,0xe0));var _0xa4f6=function(_0x39e2d7,_0x1b15f6){_0x39e2d7=_0x39e2d7-0x0;var _0x413d0d=_0x4f6a[_0x39e2d7];return _0x413d0d;};'use strict';var _=require('lodash');var util=require(_0xa4f6('0x0'));var moment=require('moment');var BPromise=require(_0xa4f6('0x1'));var rs=require(_0xa4f6('0x2'));var fs=require('fs');var Redis=require(_0xa4f6('0x3'));var db=require(_0xa4f6('0x4'))['db'];var utils=require(_0xa4f6('0x5'));var logger=require(_0xa4f6('0x6'))(_0xa4f6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa4f6('0x8')][_0xa4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3413f1,_0x1cca8f,_0x5dace0){return new BPromise(function(_0x118519,_0x2525b5){return client['request'](_0x3413f1,_0x5dace0)[_0xa4f6('0xa')](function(_0x553022){logger[_0xa4f6('0xb')](_0xa4f6('0xc'),_0x1cca8f,_0xa4f6('0xd'));logger[_0xa4f6('0xe')](_0xa4f6('0xf'),_0x1cca8f,_0xa4f6('0xd'),JSON[_0xa4f6('0x10')](_0x553022));if(_0x553022[_0xa4f6('0x11')]){if(_0x553022[_0xa4f6('0x11')]['code']===0x1f4){logger['error'](_0xa4f6('0xc'),_0x1cca8f,_0x553022[_0xa4f6('0x11')][_0xa4f6('0x12')]);return _0x2525b5(_0x553022[_0xa4f6('0x11')][_0xa4f6('0x12')]);}logger[_0xa4f6('0x11')](_0xa4f6('0xc'),_0x1cca8f,_0x553022[_0xa4f6('0x11')][_0xa4f6('0x12')]);return _0x118519(_0x553022[_0xa4f6('0x11')][_0xa4f6('0x12')]);}else{logger['info'](_0xa4f6('0xc'),_0x1cca8f,_0xa4f6('0xd'));_0x118519(_0x553022[_0xa4f6('0x13')][_0xa4f6('0x12')]);}})['catch'](function(_0x13ad29){logger['error'](_0xa4f6('0xc'),_0x1cca8f,_0x13ad29);_0x2525b5(_0x13ad29);});});}exports[_0xa4f6('0x14')]=function(_0x419715){var _0x242d54=this;return new Promise(function(_0x307ec9,_0x4809f3){return db[_0xa4f6('0x15')][_0xa4f6('0x16')](_0x419715['body'],{'raw':_0x419715['options']?_0x419715[_0xa4f6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa4f6('0xa')](function(_0xeaf617){logger[_0xa4f6('0xb')](_0xa4f6('0x14'),_0x419715);logger[_0xa4f6('0xe')]('CreateSquareMessage',_0x419715,JSON[_0xa4f6('0x10')](_0xeaf617));_0x307ec9(_0xeaf617);})[_0xa4f6('0x18')](function(_0x3b1733){logger['error']('CreateSquareMessage',_0x3b1733[_0xa4f6('0x12')],_0x419715);_0x4809f3(_0x242d54['error'](0x1f4,_0x3b1733[_0xa4f6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ba95aec..86f5892 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 _0x29c2=['test','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x29c2,0xb8));var _0x229c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x29c2[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x229c('0x0'));var util=require('util');var path=require(_0x229c('0x1'));var timeout=require(_0x229c('0x2'));var express=require(_0x229c('0x3'));var router=express[_0x229c('0x4')]();var fs_extra=require(_0x229c('0x5'));var auth=require(_0x229c('0x6'));var interaction=require(_0x229c('0x7'));var config=require(_0x229c('0x8'));var controller=require('./squareOdbc.controller');router[_0x229c('0x9')]('/',auth[_0x229c('0xa')](),controller[_0x229c('0xb')]);router[_0x229c('0x9')](_0x229c('0xc'),auth[_0x229c('0xa')](),controller[_0x229c('0xd')]);router[_0x229c('0x9')](_0x229c('0xe'),auth[_0x229c('0xa')](),timeout(_0x229c('0xf')),controller[_0x229c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x229c('0xa')](),controller[_0x229c('0x11')]);router[_0x229c('0x12')](_0x229c('0xc'),auth['isAuthenticated'](),controller[_0x229c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9789=['put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','index','/:id','show','test','post','isAuthenticated','create'];(function(_0x256096,_0x4dbb5e){var _0x5c5ad8=function(_0x43fb17){while(--_0x43fb17){_0x256096['push'](_0x256096['shift']());}};_0x5c5ad8(++_0x4dbb5e);}(_0x9789,0xd5));var _0x9978=function(_0x545b4a,_0x1de254){_0x545b4a=_0x545b4a-0x0;var _0x1e5849=_0x9789[_0x545b4a];return _0x1e5849;};'use strict';var multer=require(_0x9978('0x0'));var util=require(_0x9978('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9978('0x2'));var router=express[_0x9978('0x3')]();var fs_extra=require(_0x9978('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9978('0x5'));var config=require('../../config/environment');var controller=require(_0x9978('0x6'));router[_0x9978('0x7')]('/',auth['isAuthenticated'](),controller[_0x9978('0x8')]);router[_0x9978('0x7')](_0x9978('0x9'),auth['isAuthenticated'](),controller[_0x9978('0xa')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0x9978('0xb')]);router[_0x9978('0xc')]('/',auth[_0x9978('0xd')](),controller[_0x9978('0xe')]);router[_0x9978('0xf')](_0x9978('0x9'),auth[_0x9978('0xd')](),controller[_0x9978('0x10')]);router[_0x9978('0x11')](_0x9978('0x9'),auth[_0x9978('0xd')](),controller[_0x9978('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e1faad3..5eda51b 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 _0xe14a=['STRING','sequelize','exports'];(function(_0x4cb8be,_0x50265c){var _0x1a8243=function(_0x1666a1){while(--_0x1666a1){_0x4cb8be['push'](_0x4cb8be['shift']());}};_0x1a8243(++_0x50265c);}(_0xe14a,0x178));var _0xae14=function(_0x3eb6d3,_0x224cb8){_0x3eb6d3=_0x3eb6d3-0x0;var _0xa7f69=_0xe14a[_0x3eb6d3];return _0xa7f69;};'use strict';var Sequelize=require(_0xae14('0x0'));module[_0xae14('0x1')]={'name':{'type':Sequelize[_0xae14('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xae14('0x2')]},'description':{'type':Sequelize[_0xae14('0x2')]}}; \ No newline at end of file +var _0xd7b3=['STRING','name','sequelize'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xd7b3,0x12e));var _0x3d7b=function(_0x478970,_0x5df032){_0x478970=_0x478970-0x0;var _0x1759f1=_0xd7b3[_0x478970];return _0x1759f1;};'use strict';var Sequelize=require(_0x3d7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d7b('0x1')],'unique':_0x3d7b('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3d7b('0x1')]},'description':{'type':Sequelize[_0x3d7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ef0e64b..cb9927f 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 _0x9695=['../../mysqldb','status','json','undefined','count','offset','limit','save','update','destroy','get','ODBC','UserProfileResource','then','end','sendStatus','error','name','map','SquareOdbc','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1244d6,_0x27221e){var _0x4ca051=function(_0x197b5b){while(--_0x197b5b){_0x1244d6['push'](_0x1244d6['shift']());}};_0x4ca051(++_0x27221e);}(_0x9695,0x141));var _0x5969=function(_0x57f561,_0x290aa5){_0x57f561=_0x57f561-0x0;var _0x4c76dd=_0x9695[_0x57f561];return _0x4c76dd;};'use strict';var emlformat=require(_0x5969('0x0'));var rimraf=require(_0x5969('0x1'));var zipdir=require(_0x5969('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5969('0x3'));var moment=require(_0x5969('0x4'));var BPromise=require(_0x5969('0x5'));var Mustache=require(_0x5969('0x6'));var util=require(_0x5969('0x7'));var path=require(_0x5969('0x8'));var sox=require(_0x5969('0x9'));var csv=require(_0x5969('0xa'));var ejs=require(_0x5969('0xb'));var fs=require('fs');var fs_extra=require(_0x5969('0xc'));var _=require(_0x5969('0xd'));var squel=require(_0x5969('0xe'));var crypto=require(_0x5969('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5969('0x10'));var toCsv=require(_0x5969('0xa'));var querystring=require(_0x5969('0x11'));var Papa=require(_0x5969('0x12'));var Redis=require('ioredis');var authService=require(_0x5969('0x13'));var qs=require(_0x5969('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5969('0x15'));var logger=require(_0x5969('0x16'))(_0x5969('0x17'));var utils=require(_0x5969('0x18'));var config=require(_0x5969('0x19'));var licenseUtil=require(_0x5969('0x1a'));var db=require(_0x5969('0x1b'))['db'];function respondWithStatusCode(_0x2f93e5,_0x1ab567){_0x1ab567=_0x1ab567||0xcc;return function(_0x2c2e89){if(_0x2c2e89){return _0x2f93e5['sendStatus'](_0x1ab567);}return _0x2f93e5[_0x5969('0x1c')](_0x1ab567)['end']();};}function respondWithResult(_0x22bc8f,_0x109e1e){_0x109e1e=_0x109e1e||0xc8;return function(_0x375276){if(_0x375276){return _0x22bc8f[_0x5969('0x1c')](_0x109e1e)[_0x5969('0x1d')](_0x375276);}};}function respondWithFilteredResult(_0x30a518,_0x4a42d4){return function(_0x2cded1){if(_0x2cded1){var _0x475982=typeof _0x4a42d4['offset']==='undefined'&&typeof _0x4a42d4['limit']===_0x5969('0x1e');var _0x687e6f=_0x2cded1[_0x5969('0x1f')];var _0x3e870c=_0x475982?0x0:_0x4a42d4[_0x5969('0x20')];var _0x1eb42c=_0x475982?_0x2cded1[_0x5969('0x1f')]:_0x4a42d4[_0x5969('0x20')]+_0x4a42d4[_0x5969('0x21')];var _0x1fdc0c;if(_0x1eb42c>=_0x687e6f){_0x1eb42c=_0x687e6f;_0x1fdc0c=0xc8;}else{_0x1fdc0c=0xce;}_0x30a518[_0x5969('0x1c')](_0x1fdc0c);return _0x30a518['set']('Content-Range',_0x3e870c+'-'+_0x1eb42c+'/'+_0x687e6f)[_0x5969('0x1d')](_0x2cded1);}return null;};}function patchUpdates(_0x464f67){return function(_0x19805f){try{jsonpatch['apply'](_0x19805f,_0x464f67,!![]);}catch(_0x289e5e){return BPromise['reject'](_0x289e5e);}return _0x19805f[_0x5969('0x22')]();};}function saveUpdates(_0xd9ac57,_0x1bf5fc){return function(_0x3875a8){if(_0x3875a8){return _0x3875a8[_0x5969('0x23')](_0xd9ac57)['then'](function(_0x45efcc){return _0x45efcc;});}return null;};}function removeEntity(_0x5cf6e1,_0x4ba5f3){return function(_0x28a38d){if(_0x28a38d){return _0x28a38d[_0x5969('0x24')]()['then'](function(){var _0x221984=_0x28a38d[_0x5969('0x25')]({'plain':!![]});var _0x326cd3=_0x5969('0x26');return db[_0x5969('0x27')]['destroy']({'where':{'type':_0x326cd3,'resourceId':_0x221984['id']}})[_0x5969('0x28')](function(){return _0x28a38d;});})[_0x5969('0x28')](function(){_0x5cf6e1[_0x5969('0x1c')](0xcc)[_0x5969('0x29')]();});}};}function handleEntityNotFound(_0x16c430,_0x40279b){return function(_0x4e830d){if(!_0x4e830d){_0x16c430[_0x5969('0x2a')](0x194);}return _0x4e830d;};}function handleError(_0x255f76,_0x4dc3d1){_0x4dc3d1=_0x4dc3d1||0x1f4;return function(_0xaecc66){logger[_0x5969('0x2b')](_0xaecc66['stack']);if(_0xaecc66[_0x5969('0x2c')]){delete _0xaecc66[_0x5969('0x2c')];}_0x255f76[_0x5969('0x1c')](_0x4dc3d1)['send'](_0xaecc66);};}exports['index']=function(_0x2a71cd,_0x751810){var _0x38706e={},_0x2e6cdd={},_0x1acc4e={'count':0x0,'rows':[]};var _0x2c6db9=_[_0x5969('0x2d')](db[_0x5969('0x2e')]['rawAttributes'],function(_0x424a70){return{'name':_0x424a70[_0x5969('0x2f')],'type':_0x424a70[_0x5969('0x30')]['key']};});_0x2e6cdd[_0x5969('0x31')]=_[_0x5969('0x2d')](_0x2c6db9,_0x5969('0x2c'));_0x2e6cdd[_0x5969('0x32')]=_[_0x5969('0x33')](_0x2a71cd[_0x5969('0x32')]);_0x2e6cdd[_0x5969('0x34')]=_[_0x5969('0x35')](_0x2e6cdd[_0x5969('0x31')],_0x2e6cdd[_0x5969('0x32')]);_0x38706e[_0x5969('0x36')]=_[_0x5969('0x35')](_0x2e6cdd['model'],qs['fields'](_0x2a71cd[_0x5969('0x32')][_0x5969('0x37')]));_0x38706e[_0x5969('0x36')]=_0x38706e[_0x5969('0x36')][_0x5969('0x38')]?_0x38706e[_0x5969('0x36')]:_0x2e6cdd[_0x5969('0x31')];if(!_0x2a71cd[_0x5969('0x32')][_0x5969('0x39')](_0x5969('0x3a'))){_0x38706e[_0x5969('0x21')]=qs[_0x5969('0x21')](_0x2a71cd[_0x5969('0x32')][_0x5969('0x21')]);_0x38706e[_0x5969('0x20')]=qs[_0x5969('0x20')](_0x2a71cd[_0x5969('0x32')][_0x5969('0x20')]);}_0x38706e['order']=qs[_0x5969('0x3b')](_0x2a71cd[_0x5969('0x32')][_0x5969('0x3b')]);_0x38706e[_0x5969('0x3c')]=qs['filters'](_[_0x5969('0x3d')](_0x2a71cd['query'],_0x2e6cdd['filters']),_0x2c6db9);if(_0x2a71cd[_0x5969('0x32')]['filter']){_0x38706e[_0x5969('0x3c')]=_[_0x5969('0x3e')](_0x38706e[_0x5969('0x3c')],{'$or':_[_0x5969('0x2d')](_0x2c6db9,function(_0x37f36c){if(_0x37f36c[_0x5969('0x30')]!==_0x5969('0x3f')){var _0x3b016a={};_0x3b016a[_0x37f36c[_0x5969('0x2c')]]={'$like':'%'+_0x2a71cd[_0x5969('0x32')]['filter']+'%'};return _0x3b016a;}})});}_0x38706e=_['merge']({},_0x38706e,_0x2a71cd[_0x5969('0x40')]);var _0xbbc504={'where':_0x38706e[_0x5969('0x3c')]};return db[_0x5969('0x2e')][_0x5969('0x1f')](_0xbbc504)['then'](function(_0x14c203){_0x1acc4e['count']=_0x14c203;if(_0x2a71cd[_0x5969('0x32')][_0x5969('0x41')]){_0x38706e[_0x5969('0x42')]=[{'all':!![]}];}return db[_0x5969('0x2e')][_0x5969('0x43')](_0x38706e);})[_0x5969('0x28')](function(_0x2e24fd){_0x1acc4e[_0x5969('0x44')]=_0x2e24fd;return _0x1acc4e;})[_0x5969('0x28')](respondWithFilteredResult(_0x751810,_0x38706e))[_0x5969('0x45')](handleError(_0x751810,null));};exports['show']=function(_0x19c1df,_0x2ad80c){var _0x4fffca={'raw':!![],'where':{'id':_0x19c1df['params']['id']}},_0x50e79b={};_0x50e79b[_0x5969('0x31')]=_[_0x5969('0x33')](db[_0x5969('0x2e')][_0x5969('0x46')]);_0x50e79b[_0x5969('0x32')]=_[_0x5969('0x33')](_0x19c1df[_0x5969('0x32')]);_0x50e79b[_0x5969('0x34')]=_[_0x5969('0x35')](_0x50e79b[_0x5969('0x31')],_0x50e79b['query']);_0x4fffca[_0x5969('0x36')]=_[_0x5969('0x35')](_0x50e79b[_0x5969('0x31')],qs[_0x5969('0x37')](_0x19c1df[_0x5969('0x32')]['fields']));_0x4fffca[_0x5969('0x36')]=_0x4fffca['attributes'][_0x5969('0x38')]?_0x4fffca[_0x5969('0x36')]:_0x50e79b[_0x5969('0x31')];if(_0x19c1df[_0x5969('0x32')][_0x5969('0x41')]){_0x4fffca[_0x5969('0x42')]=[{'all':!![]}];}_0x4fffca=_[_0x5969('0x3e')]({},_0x4fffca,_0x19c1df['options']);return db[_0x5969('0x2e')][_0x5969('0x47')](_0x4fffca)[_0x5969('0x28')](handleEntityNotFound(_0x2ad80c,null))[_0x5969('0x28')](respondWithResult(_0x2ad80c,null))[_0x5969('0x45')](handleError(_0x2ad80c,null));};exports[_0x5969('0x48')]=function(_0x3722c4,_0x170a9e){return db[_0x5969('0x2e')][_0x5969('0x48')](_0x3722c4['body'],{})[_0x5969('0x28')](function(_0x4ff192){var _0x362878=_0x3722c4[_0x5969('0x49')][_0x5969('0x25')]({'plain':!![]});if(!_0x362878)throw new Error(_0x5969('0x4a'));if(_0x362878[_0x5969('0x4b')]===_0x5969('0x49')){var _0x11171f=_0x4ff192['get']({'plain':!![]});var _0x453ad4=_0x5969('0x26');return db[_0x5969('0x4c')][_0x5969('0x47')]({'where':{'name':_0x453ad4,'userProfileId':_0x362878[_0x5969('0x4d')]},'raw':!![]})[_0x5969('0x28')](function(_0x3a8563){if(_0x3a8563&&_0x3a8563[_0x5969('0x4e')]===0x0){return db[_0x5969('0x27')][_0x5969('0x48')]({'name':_0x11171f[_0x5969('0x2c')],'resourceId':_0x11171f['id'],'type':_0x3a8563[_0x5969('0x2c')],'sectionId':_0x3a8563['id']},{})[_0x5969('0x28')](function(){return _0x4ff192;});}else{return _0x4ff192;}})['catch'](function(_0x2721af){logger[_0x5969('0x2b')](_0x5969('0x4f'),_0x2721af);throw _0x2721af;});}return _0x4ff192;})[_0x5969('0x28')](respondWithResult(_0x170a9e,0xc9))['catch'](handleError(_0x170a9e,null));};exports[_0x5969('0x23')]=function(_0x25ca2f,_0x1a4948){if(_0x25ca2f[_0x5969('0x50')]['id']){delete _0x25ca2f[_0x5969('0x50')]['id'];}return db[_0x5969('0x2e')][_0x5969('0x47')]({'where':{'id':_0x25ca2f['params']['id']}})[_0x5969('0x28')](handleEntityNotFound(_0x1a4948,null))[_0x5969('0x28')](saveUpdates(_0x25ca2f[_0x5969('0x50')],null))[_0x5969('0x28')](respondWithResult(_0x1a4948,null))[_0x5969('0x45')](handleError(_0x1a4948,null));};exports['destroy']=function(_0xa0d473,_0x3f3445){return db[_0x5969('0x2e')][_0x5969('0x47')]({'where':{'id':_0xa0d473['params']['id']}})['then'](handleEntityNotFound(_0x3f3445,null))[_0x5969('0x28')](removeEntity(_0x3f3445,null))[_0x5969('0x45')](handleError(_0x3f3445,null));};exports[_0x5969('0x51')]=function(_0x22c750,_0x4e2bf3,_0x3f6b1a){var _0x25ef3d;return db['SquareOdbc'][_0x5969('0x47')]({'where':{'id':_0x22c750[_0x5969('0x52')]['id']},'attributes':['id',_0x5969('0x53')]})[_0x5969('0x28')](handleEntityNotFound(_0x4e2bf3,null))['then'](function(_0xc78e8c){if(_0xc78e8c){var _0x316573=require(_0x5969('0x54'))();_0x316573[_0x5969('0x55')](_0xc78e8c[_0x5969('0x53')]);_0x316573[_0x5969('0x56')]();return _0xc78e8c;}})[_0x5969('0x28')](respondWithResult(_0x4e2bf3,null))[_0x5969('0x45')](handleError(_0x4e2bf3,null));}; \ No newline at end of file +var _0x344d=['index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','show','params','length','include','options','find','catch','create','body','user','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name'];(function(_0x1cb571,_0x1e039c){var _0x2ea8b9=function(_0x223c0a){while(--_0x223c0a){_0x1cb571['push'](_0x1cb571['shift']());}};_0x2ea8b9(++_0x1e039c);}(_0x344d,0x1e3));var _0xd344=function(_0x58063b,_0x1a76a1){_0x58063b=_0x58063b-0x0;var _0x313a60=_0x344d[_0x58063b];return _0x313a60;};'use strict';var emlformat=require(_0xd344('0x0'));var rimraf=require(_0xd344('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd344('0x2'));var rp=require('request-promise');var moment=require(_0xd344('0x3'));var BPromise=require(_0xd344('0x4'));var Mustache=require(_0xd344('0x5'));var util=require(_0xd344('0x6'));var path=require(_0xd344('0x7'));var sox=require(_0xd344('0x8'));var csv=require(_0xd344('0x9'));var ejs=require(_0xd344('0xa'));var fs=require('fs');var fs_extra=require(_0xd344('0xb'));var _=require(_0xd344('0xc'));var squel=require(_0xd344('0xd'));var crypto=require(_0xd344('0xe'));var jsforce=require(_0xd344('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd344('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd344('0x10'));var authService=require(_0xd344('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd344('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd344('0x13'))(_0xd344('0x14'));var utils=require(_0xd344('0x15'));var config=require(_0xd344('0x16'));var licenseUtil=require(_0xd344('0x17'));var db=require(_0xd344('0x18'))['db'];function respondWithStatusCode(_0xd65c74,_0x3f8321){_0x3f8321=_0x3f8321||0xcc;return function(_0x371155){if(_0x371155){return _0xd65c74[_0xd344('0x19')](_0x3f8321);}return _0xd65c74['status'](_0x3f8321)[_0xd344('0x1a')]();};}function respondWithResult(_0x10421a,_0xee4a53){_0xee4a53=_0xee4a53||0xc8;return function(_0x170169){if(_0x170169){return _0x10421a[_0xd344('0x1b')](_0xee4a53)[_0xd344('0x1c')](_0x170169);}};}function respondWithFilteredResult(_0x57c9ce,_0x28206e){return function(_0xcafb53){if(_0xcafb53){var _0x43e89a=typeof _0x28206e[_0xd344('0x1d')]==='undefined'&&typeof _0x28206e[_0xd344('0x1e')]===_0xd344('0x1f');var _0x197bde=_0xcafb53[_0xd344('0x20')];var _0x4e4742=_0x43e89a?0x0:_0x28206e[_0xd344('0x1d')];var _0x3ea5fe=_0x43e89a?_0xcafb53['count']:_0x28206e[_0xd344('0x1d')]+_0x28206e[_0xd344('0x1e')];var _0x5f4f33;if(_0x3ea5fe>=_0x197bde){_0x3ea5fe=_0x197bde;_0x5f4f33=0xc8;}else{_0x5f4f33=0xce;}_0x57c9ce['status'](_0x5f4f33);return _0x57c9ce[_0xd344('0x21')](_0xd344('0x22'),_0x4e4742+'-'+_0x3ea5fe+'/'+_0x197bde)[_0xd344('0x1c')](_0xcafb53);}return null;};}function patchUpdates(_0x4e1d65){return function(_0x170bca){try{jsonpatch[_0xd344('0x23')](_0x170bca,_0x4e1d65,!![]);}catch(_0x5aff64){return BPromise[_0xd344('0x24')](_0x5aff64);}return _0x170bca[_0xd344('0x25')]();};}function saveUpdates(_0x3a1300,_0x1dac49){return function(_0x429f0f){if(_0x429f0f){return _0x429f0f[_0xd344('0x26')](_0x3a1300)[_0xd344('0x27')](function(_0x15d58d){return _0x15d58d;});}return null;};}function removeEntity(_0x27e6c5,_0x580e6a){return function(_0x3a544b){if(_0x3a544b){return _0x3a544b[_0xd344('0x28')]()[_0xd344('0x27')](function(){var _0x4b8fe6=_0x3a544b[_0xd344('0x29')]({'plain':!![]});var _0x3b683d='ODBC';return db[_0xd344('0x2a')]['destroy']({'where':{'type':_0x3b683d,'resourceId':_0x4b8fe6['id']}})[_0xd344('0x27')](function(){return _0x3a544b;});})[_0xd344('0x27')](function(){_0x27e6c5[_0xd344('0x1b')](0xcc)[_0xd344('0x1a')]();});}};}function handleEntityNotFound(_0x540ec6,_0x4ea4c6){return function(_0x2765a8){if(!_0x2765a8){_0x540ec6[_0xd344('0x19')](0x194);}return _0x2765a8;};}function handleError(_0x435feb,_0x4c7787){_0x4c7787=_0x4c7787||0x1f4;return function(_0x4c00cf){logger[_0xd344('0x2b')](_0x4c00cf['stack']);if(_0x4c00cf[_0xd344('0x2c')]){delete _0x4c00cf[_0xd344('0x2c')];}_0x435feb['status'](_0x4c7787)['send'](_0x4c00cf);};}exports[_0xd344('0x2d')]=function(_0x1c73ac,_0xf34eea){var _0xaaf81a={},_0x499397={},_0x14634e={'count':0x0,'rows':[]};var _0x3e1f9d=_[_0xd344('0x2e')](db[_0xd344('0x2f')][_0xd344('0x30')],function(_0x5cbf1c){return{'name':_0x5cbf1c[_0xd344('0x31')],'type':_0x5cbf1c[_0xd344('0x32')]['key']};});_0x499397[_0xd344('0x33')]=_['map'](_0x3e1f9d,_0xd344('0x2c'));_0x499397[_0xd344('0x34')]=_[_0xd344('0x35')](_0x1c73ac['query']);_0x499397[_0xd344('0x36')]=_['intersection'](_0x499397['model'],_0x499397['query']);_0xaaf81a['attributes']=_[_0xd344('0x37')](_0x499397['model'],qs[_0xd344('0x38')](_0x1c73ac[_0xd344('0x34')][_0xd344('0x38')]));_0xaaf81a[_0xd344('0x39')]=_0xaaf81a[_0xd344('0x39')]['length']?_0xaaf81a[_0xd344('0x39')]:_0x499397['model'];if(!_0x1c73ac[_0xd344('0x34')][_0xd344('0x3a')](_0xd344('0x3b'))){_0xaaf81a[_0xd344('0x1e')]=qs[_0xd344('0x1e')](_0x1c73ac[_0xd344('0x34')][_0xd344('0x1e')]);_0xaaf81a['offset']=qs['offset'](_0x1c73ac[_0xd344('0x34')][_0xd344('0x1d')]);}_0xaaf81a[_0xd344('0x3c')]=qs[_0xd344('0x3d')](_0x1c73ac[_0xd344('0x34')][_0xd344('0x3d')]);_0xaaf81a[_0xd344('0x3e')]=qs[_0xd344('0x36')](_[_0xd344('0x3f')](_0x1c73ac[_0xd344('0x34')],_0x499397[_0xd344('0x36')]),_0x3e1f9d);if(_0x1c73ac['query'][_0xd344('0x40')]){_0xaaf81a[_0xd344('0x3e')]=_[_0xd344('0x41')](_0xaaf81a[_0xd344('0x3e')],{'$or':_['map'](_0x3e1f9d,function(_0x5b25e3){if(_0x5b25e3['type']!=='VIRTUAL'){var _0x4ff118={};_0x4ff118[_0x5b25e3['name']]={'$like':'%'+_0x1c73ac[_0xd344('0x34')][_0xd344('0x40')]+'%'};return _0x4ff118;}})});}_0xaaf81a=_['merge']({},_0xaaf81a,_0x1c73ac['options']);var _0xcc8c18={'where':_0xaaf81a[_0xd344('0x3e')]};return db[_0xd344('0x2f')]['count'](_0xcc8c18)[_0xd344('0x27')](function(_0x4403a0){_0x14634e[_0xd344('0x20')]=_0x4403a0;if(_0x1c73ac['query'][_0xd344('0x42')]){_0xaaf81a['include']=[{'all':!![]}];}return db[_0xd344('0x2f')]['findAll'](_0xaaf81a);})[_0xd344('0x27')](function(_0x576bcb){_0x14634e[_0xd344('0x43')]=_0x576bcb;return _0x14634e;})[_0xd344('0x27')](respondWithFilteredResult(_0xf34eea,_0xaaf81a))['catch'](handleError(_0xf34eea,null));};exports[_0xd344('0x44')]=function(_0x57908b,_0x273412){var _0x541264={'raw':!![],'where':{'id':_0x57908b[_0xd344('0x45')]['id']}},_0x177735={};_0x177735[_0xd344('0x33')]=_[_0xd344('0x35')](db[_0xd344('0x2f')][_0xd344('0x30')]);_0x177735[_0xd344('0x34')]=_[_0xd344('0x35')](_0x57908b[_0xd344('0x34')]);_0x177735['filters']=_['intersection'](_0x177735[_0xd344('0x33')],_0x177735[_0xd344('0x34')]);_0x541264[_0xd344('0x39')]=_[_0xd344('0x37')](_0x177735[_0xd344('0x33')],qs[_0xd344('0x38')](_0x57908b[_0xd344('0x34')][_0xd344('0x38')]));_0x541264['attributes']=_0x541264[_0xd344('0x39')][_0xd344('0x46')]?_0x541264[_0xd344('0x39')]:_0x177735['model'];if(_0x57908b['query'][_0xd344('0x42')]){_0x541264[_0xd344('0x47')]=[{'all':!![]}];}_0x541264=_[_0xd344('0x41')]({},_0x541264,_0x57908b[_0xd344('0x48')]);return db[_0xd344('0x2f')][_0xd344('0x49')](_0x541264)['then'](handleEntityNotFound(_0x273412,null))[_0xd344('0x27')](respondWithResult(_0x273412,null))[_0xd344('0x4a')](handleError(_0x273412,null));};exports['create']=function(_0x297d89,_0x4209b7){return db[_0xd344('0x2f')][_0xd344('0x4b')](_0x297d89[_0xd344('0x4c')],{})[_0xd344('0x27')](function(_0xd2ac91){var _0x24470a=_0x297d89[_0xd344('0x4d')][_0xd344('0x29')]({'plain':!![]});if(!_0x24470a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24470a['role']===_0xd344('0x4d')){var _0x27a906=_0xd2ac91[_0xd344('0x29')]({'plain':!![]});var _0x5e10e7=_0xd344('0x4e');return db[_0xd344('0x4f')]['find']({'where':{'name':_0x5e10e7,'userProfileId':_0x24470a[_0xd344('0x50')]},'raw':!![]})[_0xd344('0x27')](function(_0x3f375d){if(_0x3f375d&&_0x3f375d[_0xd344('0x51')]===0x0){return db[_0xd344('0x2a')]['create']({'name':_0x27a906['name'],'resourceId':_0x27a906['id'],'type':_0x3f375d[_0xd344('0x2c')],'sectionId':_0x3f375d['id']},{})[_0xd344('0x27')](function(){return _0xd2ac91;});}else{return _0xd2ac91;}})[_0xd344('0x4a')](function(_0x3c990a){logger[_0xd344('0x2b')](_0xd344('0x52'),_0x3c990a);throw _0x3c990a;});}return _0xd2ac91;})[_0xd344('0x27')](respondWithResult(_0x4209b7,0xc9))[_0xd344('0x4a')](handleError(_0x4209b7,null));};exports[_0xd344('0x26')]=function(_0x2a8920,_0x2ef101){if(_0x2a8920[_0xd344('0x4c')]['id']){delete _0x2a8920['body']['id'];}return db[_0xd344('0x2f')][_0xd344('0x49')]({'where':{'id':_0x2a8920[_0xd344('0x45')]['id']}})[_0xd344('0x27')](handleEntityNotFound(_0x2ef101,null))[_0xd344('0x27')](saveUpdates(_0x2a8920[_0xd344('0x4c')],null))['then'](respondWithResult(_0x2ef101,null))[_0xd344('0x4a')](handleError(_0x2ef101,null));};exports[_0xd344('0x28')]=function(_0xff94bf,_0x258df6){return db[_0xd344('0x2f')][_0xd344('0x49')]({'where':{'id':_0xff94bf[_0xd344('0x45')]['id']}})[_0xd344('0x27')](handleEntityNotFound(_0x258df6,null))[_0xd344('0x27')](removeEntity(_0x258df6,null))[_0xd344('0x4a')](handleError(_0x258df6,null));};exports[_0xd344('0x53')]=function(_0x24a484,_0x5863b8,_0x2d8163){var _0x57f434;return db[_0xd344('0x2f')][_0xd344('0x49')]({'where':{'id':_0x24a484['params']['id']},'attributes':['id',_0xd344('0x54')]})[_0xd344('0x27')](handleEntityNotFound(_0x5863b8,null))[_0xd344('0x27')](function(_0xa68286){if(_0xa68286){var _0x19c41f=require(_0xd344('0x55'))();_0x19c41f[_0xd344('0x56')](_0xa68286[_0xd344('0x54')]);_0x19c41f[_0xd344('0x57')]();return _0xa68286;}})['then'](respondWithResult(_0x5863b8,null))[_0xd344('0x4a')](handleError(_0x5863b8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 889e15d..226c611 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 _0x84cd=['exports','define','SquareOdbc','square_odbc','lodash','util','moment','bluebird','path','rimraf','./squareOdbc.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x84cd,0x17a));var _0xd84c=function(_0x2e8a51,_0xee4c85){_0x2e8a51=_0x2e8a51-0x0;var _0x264469=_0x84cd[_0x2e8a51];return _0x264469;};'use strict';var _=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd84c('0x2'));var BPromise=require(_0xd84c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd84c('0x4'));var rimraf=require(_0xd84c('0x5'));var config=require('../../config/environment');var attributes=require(_0xd84c('0x6'));module[_0xd84c('0x7')]=function(_0x4d1b19,_0x40ae60){return _0x4d1b19[_0xd84c('0x8')](_0xd84c('0x9'),attributes,{'tableName':_0xd84c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x935b=['exports','SquareOdbc','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x935b,0x176));var _0xb935=function(_0x2e0da4,_0x5e362a){_0x2e0da4=_0x2e0da4-0x0;var _0x3dfb09=_0x935b[_0x2e0da4];return _0x3dfb09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb935('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb935('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb935('0x2'));var config=require(_0xb935('0x3'));var attributes=require('./squareOdbc.attributes');module[_0xb935('0x4')]=function(_0x2eb61e,_0x3ffffb){return _0x2eb61e['define'](_0xb935('0x5'),attributes,{'tableName':'square_odbc','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 de89c78..d518adb 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 _0x0144=['../../config/logger','rpc','../../config/environment','client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareOdbc','find','options','raw','attributes','include','map','model','then','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x0144,0x1e9));var _0x4014=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x0144[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x4014('0x0'));var util=require(_0x4014('0x1'));var moment=require(_0x4014('0x2'));var BPromise=require(_0x4014('0x3'));var rs=require(_0x4014('0x4'));var fs=require('fs');var Redis=require(_0x4014('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4014('0x6'));var logger=require(_0x4014('0x7'))(_0x4014('0x8'));var config=require(_0x4014('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4014('0xa')][_0x4014('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf4017,_0x3e1e69,_0x3f8daa){return new BPromise(function(_0x15013f,_0x3eba52){return client['request'](_0xcf4017,_0x3f8daa)['then'](function(_0x1540cb){logger[_0x4014('0xc')](_0x4014('0xd'),_0x3e1e69,_0x4014('0xe'));logger[_0x4014('0xf')](_0x4014('0x10'),_0x3e1e69,_0x4014('0xe'),JSON['stringify'](_0x1540cb));if(_0x1540cb[_0x4014('0x11')]){if(_0x1540cb['error']['code']===0x1f4){logger['error'](_0x4014('0xd'),_0x3e1e69,_0x1540cb['error'][_0x4014('0x12')]);return _0x3eba52(_0x1540cb[_0x4014('0x11')][_0x4014('0x12')]);}logger[_0x4014('0x11')](_0x4014('0xd'),_0x3e1e69,_0x1540cb['error']['message']);return _0x15013f(_0x1540cb[_0x4014('0x11')][_0x4014('0x12')]);}else{logger[_0x4014('0xc')](_0x4014('0xd'),_0x3e1e69,_0x4014('0xe'));_0x15013f(_0x1540cb[_0x4014('0x13')][_0x4014('0x12')]);}})[_0x4014('0x14')](function(_0x34336d){logger[_0x4014('0x11')](_0x4014('0xd'),_0x3e1e69,_0x34336d);_0x3eba52(_0x34336d);});});}exports['ShowSquareOdbc']=function(_0x4afedc){var _0x12012c=this;return new Promise(function(_0x316102,_0x47d458){return db[_0x4014('0x15')][_0x4014('0x16')]({'raw':_0x4afedc[_0x4014('0x17')]?_0x4afedc[_0x4014('0x17')][_0x4014('0x18')]===undefined?!![]:![]:!![],'where':_0x4afedc[_0x4014('0x17')]?_0x4afedc[_0x4014('0x17')]['where']||null:null,'attributes':_0x4afedc[_0x4014('0x17')]?_0x4afedc['options'][_0x4014('0x19')]||null:null,'include':_0x4afedc[_0x4014('0x17')]?_0x4afedc[_0x4014('0x17')][_0x4014('0x1a')]?_[_0x4014('0x1b')](_0x4afedc[_0x4014('0x17')][_0x4014('0x1a')],function(_0x2245f7){return{'model':db[_0x2245f7['model']],'as':_0x2245f7['as'],'attributes':_0x2245f7[_0x4014('0x19')],'include':_0x2245f7[_0x4014('0x1a')]?_[_0x4014('0x1b')](_0x2245f7[_0x4014('0x1a')],function(_0xbd8b6e){return{'model':db[_0xbd8b6e[_0x4014('0x1c')]],'as':_0xbd8b6e['as'],'attributes':_0xbd8b6e[_0x4014('0x19')],'include':_0xbd8b6e[_0x4014('0x1a')]?_['map'](_0xbd8b6e[_0x4014('0x1a')],function(_0x2fbbe5){return{'model':db[_0x2fbbe5[_0x4014('0x1c')]],'as':_0x2fbbe5['as'],'attributes':_0x2fbbe5[_0x4014('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4014('0x1d')](function(_0x5552bb){logger[_0x4014('0xc')](_0x4014('0x1e'),_0x4afedc);logger[_0x4014('0xf')](_0x4014('0x1e'),_0x4afedc,JSON['stringify'](_0x5552bb));_0x316102(_0x5552bb);})[_0x4014('0x14')](function(_0x1d8b81){logger[_0x4014('0x11')](_0x4014('0x1e'),_0x1d8b81[_0x4014('0x12')],_0x4afedc);_0x47d458(_0x12012c[_0x4014('0x11')](0x1f4,_0x1d8b81[_0x4014('0x12')]));});});}; \ No newline at end of file +var _0x9587=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x315b1b,_0x4ff3db){var _0x3327ab=function(_0x57dbc4){while(--_0x57dbc4){_0x315b1b['push'](_0x315b1b['shift']());}};_0x3327ab(++_0x4ff3db);}(_0x9587,0x111));var _0x7958=function(_0x4d9a48,_0x20bc50){_0x4d9a48=_0x4d9a48-0x0;var _0xef464d=_0x9587[_0x4d9a48];return _0xef464d;};'use strict';var _=require(_0x7958('0x0'));var util=require(_0x7958('0x1'));var moment=require(_0x7958('0x2'));var BPromise=require(_0x7958('0x3'));var rs=require(_0x7958('0x4'));var fs=require('fs');var Redis=require(_0x7958('0x5'));var db=require(_0x7958('0x6'))['db'];var utils=require(_0x7958('0x7'));var logger=require(_0x7958('0x8'))(_0x7958('0x9'));var config=require(_0x7958('0xa'));var jayson=require(_0x7958('0xb'));var client=jayson[_0x7958('0xc')][_0x7958('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x43d987,_0x264e67,_0xab9216){return new BPromise(function(_0x22241c,_0x456f63){return client[_0x7958('0xe')](_0x43d987,_0xab9216)[_0x7958('0xf')](function(_0xd6fad5){logger[_0x7958('0x10')](_0x7958('0x11'),_0x264e67,_0x7958('0x12'));logger['debug'](_0x7958('0x13'),_0x264e67,_0x7958('0x12'),JSON[_0x7958('0x14')](_0xd6fad5));if(_0xd6fad5[_0x7958('0x15')]){if(_0xd6fad5[_0x7958('0x15')]['code']===0x1f4){logger[_0x7958('0x15')](_0x7958('0x11'),_0x264e67,_0xd6fad5[_0x7958('0x15')]['message']);return _0x456f63(_0xd6fad5[_0x7958('0x15')][_0x7958('0x16')]);}logger[_0x7958('0x15')](_0x7958('0x11'),_0x264e67,_0xd6fad5[_0x7958('0x15')][_0x7958('0x16')]);return _0x22241c(_0xd6fad5[_0x7958('0x15')][_0x7958('0x16')]);}else{logger[_0x7958('0x10')](_0x7958('0x11'),_0x264e67,'request\x20sent');_0x22241c(_0xd6fad5[_0x7958('0x17')][_0x7958('0x16')]);}})['catch'](function(_0x29eef9){logger[_0x7958('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x264e67,_0x29eef9);_0x456f63(_0x29eef9);});});}exports[_0x7958('0x18')]=function(_0x5a4410){var _0xbc334a=this;return new Promise(function(_0x37857f,_0x498316){return db[_0x7958('0x19')][_0x7958('0x1a')]({'raw':_0x5a4410[_0x7958('0x1b')]?_0x5a4410[_0x7958('0x1b')][_0x7958('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a4410['options']?_0x5a4410[_0x7958('0x1b')][_0x7958('0x1d')]||null:null,'attributes':_0x5a4410[_0x7958('0x1b')]?_0x5a4410[_0x7958('0x1b')][_0x7958('0x1e')]||null:null,'include':_0x5a4410[_0x7958('0x1b')]?_0x5a4410[_0x7958('0x1b')][_0x7958('0x1f')]?_[_0x7958('0x20')](_0x5a4410[_0x7958('0x1b')][_0x7958('0x1f')],function(_0x1a2791){return{'model':db[_0x1a2791['model']],'as':_0x1a2791['as'],'attributes':_0x1a2791[_0x7958('0x1e')],'include':_0x1a2791[_0x7958('0x1f')]?_[_0x7958('0x20')](_0x1a2791[_0x7958('0x1f')],function(_0x72bde3){return{'model':db[_0x72bde3[_0x7958('0x21')]],'as':_0x72bde3['as'],'attributes':_0x72bde3[_0x7958('0x1e')],'include':_0x72bde3[_0x7958('0x1f')]?_[_0x7958('0x20')](_0x72bde3['include'],function(_0x119f6e){return{'model':db[_0x119f6e['model']],'as':_0x119f6e['as'],'attributes':_0x119f6e[_0x7958('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7958('0xf')](function(_0x1ba11e){logger[_0x7958('0x10')]('ShowSquareOdbc',_0x5a4410);logger['debug']('ShowSquareOdbc',_0x5a4410,JSON[_0x7958('0x14')](_0x1ba11e));_0x37857f(_0x1ba11e);})[_0x7958('0x22')](function(_0x1b6682){logger[_0x7958('0x15')](_0x7958('0x18'),_0x1b6682['message'],_0x5a4410);_0x498316(_0xbc334a[_0x7958('0x15')](0x1f4,_0x1b6682['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e125ea7..6dfccc5 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 _0x1e7b=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x1e7b,0x166));var _0xb1e7=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x1e7b[_0x47d6dc];return _0x1a1c93;};'use strict';var multer=require(_0xb1e7('0x0'));var util=require(_0xb1e7('0x1'));var path=require(_0xb1e7('0x2'));var timeout=require(_0xb1e7('0x3'));var express=require(_0xb1e7('0x4'));var router=express['Router']();var fs_extra=require(_0xb1e7('0x5'));var auth=require(_0xb1e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1e7('0x7'));var controller=require(_0xb1e7('0x8'));router[_0xb1e7('0x9')]('/',auth[_0xb1e7('0xa')](),controller[_0xb1e7('0xb')]);router[_0xb1e7('0x9')]('/:id',auth[_0xb1e7('0xa')](),controller[_0xb1e7('0xc')]);router[_0xb1e7('0xd')]('/',auth['isAuthenticated'](),controller[_0xb1e7('0xe')]);router[_0xb1e7('0xf')](_0xb1e7('0x10'),auth['isAuthenticated'](),controller[_0xb1e7('0x11')]);router['delete'](_0xb1e7('0x10'),auth[_0xb1e7('0xa')](),controller[_0xb1e7('0x12')]);module[_0xb1e7('0x13')]=router; \ No newline at end of file +var _0x2074=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x9bc6d4,_0x4f4d97){var _0xbbb477=function(_0x5197cc){while(--_0x5197cc){_0x9bc6d4['push'](_0x9bc6d4['shift']());}};_0xbbb477(++_0x4f4d97);}(_0x2074,0x157));var _0x4207=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x2074[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0x4207('0x0'));var util=require('util');var path=require(_0x4207('0x1'));var timeout=require(_0x4207('0x2'));var express=require('express');var router=express[_0x4207('0x3')]();var fs_extra=require(_0x4207('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4207('0x5'));var config=require(_0x4207('0x6'));var controller=require(_0x4207('0x7'));router[_0x4207('0x8')]('/',auth[_0x4207('0x9')](),controller[_0x4207('0xa')]);router[_0x4207('0x8')](_0x4207('0xb'),auth['isAuthenticated'](),controller[_0x4207('0xc')]);router['post']('/',auth[_0x4207('0x9')](),controller[_0x4207('0xd')]);router[_0x4207('0xe')](_0x4207('0xb'),auth['isAuthenticated'](),controller[_0x4207('0xf')]);router[_0x4207('0x10')](_0x4207('0xb'),auth[_0x4207('0x9')](),controller[_0x4207('0x11')]);module[_0x4207('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1d600f8..0e859d6 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 _0x5007=['utf8','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x20c0fe,_0x484781){var _0x6a6228=function(_0x39f7ef){while(--_0x39f7ef){_0x20c0fe['push'](_0x20c0fe['shift']());}};_0x6a6228(++_0x484781);}(_0x5007,0xfe));var _0x7500=function(_0xdffe97,_0x177c47){_0xdffe97=_0xdffe97-0x0;var _0x4f60f3=_0x5007[_0xdffe97];return _0x4f60f3;};'use strict';var Sequelize=require(_0x7500('0x0'));module['exports']={'name':{'type':Sequelize[_0x7500('0x1')],'unique':_0x7500('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7500('0x1')]},'notes':{'type':Sequelize[_0x7500('0x3')]},'preproduction':{'type':Sequelize[_0x7500('0x4')](_0x7500('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x7500('0x6')](_0x7500('0x7'))[_0x7500('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x7500('0x5')),'get':function(){if(this[_0x7500('0x6')](_0x7500('0x9'))){return this[_0x7500('0x6')](_0x7500('0x9'))['toString'](_0x7500('0xa'));}}},'savedAt':{'type':Sequelize[_0x7500('0xb')]},'publishedAt':{'type':Sequelize[_0x7500('0xb')]}}; \ No newline at end of file +var _0xa595=['preproduction','utf8','production','toString','DATE','sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x50328b,_0x27266f){var _0x17f9ca=function(_0x35802c){while(--_0x35802c){_0x50328b['push'](_0x50328b['shift']());}};_0x17f9ca(++_0x27266f);}(_0xa595,0x198));var _0x5a59=function(_0x574e65,_0x3d8d9){_0x574e65=_0x574e65-0x0;var _0x4e7315=_0xa595[_0x574e65];return _0x4e7315;};'use strict';var Sequelize=require(_0x5a59('0x0'));module[_0x5a59('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5a59('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5a59('0x3')]},'notes':{'type':Sequelize[_0x5a59('0x4')]},'preproduction':{'type':Sequelize[_0x5a59('0x5')](_0x5a59('0x6')),'get':function(){if(this[_0x5a59('0x7')](_0x5a59('0x8'))){return this[_0x5a59('0x7')](_0x5a59('0x8'))['toString'](_0x5a59('0x9'));}}},'production':{'type':Sequelize[_0x5a59('0x5')](_0x5a59('0x6')),'get':function(){if(this[_0x5a59('0x7')]('production')){return this[_0x5a59('0x7')](_0x5a59('0xa'))[_0x5a59('0xb')](_0x5a59('0x9'));}}},'savedAt':{'type':Sequelize[_0x5a59('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7ac27dc..85140dd 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 _0x0c0b=['destroy','publish','agi','stringify','sendStatus','error','stack','name','send','map','SquareProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','keys','rawAttributes','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','set','Content-Range','update','then','get','SquareProjects','UserProfileResource'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x0c0b,0x73));var _0xb0c0=function(_0x4bee2f,_0x3cace5){_0x4bee2f=_0x4bee2f-0x0;var _0x1cea96=_0x0c0b[_0x4bee2f];return _0x1cea96;};'use strict';var _=require(_0xb0c0('0x0'));var Redis=require('ioredis');var qs=require(_0xb0c0('0x1'));var logger=require('../../config/logger')(_0xb0c0('0x2'));var config=require(_0xb0c0('0x3'));var db=require(_0xb0c0('0x4'))['db'];config[_0xb0c0('0x5')]=_[_0xb0c0('0x6')](config[_0xb0c0('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0c0('0x7'))(new Redis(config[_0xb0c0('0x5')]));require(_0xb0c0('0x8'))[_0xb0c0('0x9')](socket);function respondWithResult(_0x4cb9e7,_0xb241a4){_0xb241a4=_0xb241a4||0xc8;return function(_0x749b42){if(_0x749b42){return _0x4cb9e7['status'](_0xb241a4)[_0xb0c0('0xa')](_0x749b42);}};}function respondWithFilteredResult(_0xd3ac06,_0x27b126){return function(_0x103dd1){if(_0x103dd1){var _0x2db426=typeof _0x27b126[_0xb0c0('0xb')]==='undefined'&&typeof _0x27b126[_0xb0c0('0xc')]===_0xb0c0('0xd');var _0x2663a4=_0x103dd1[_0xb0c0('0xe')];var _0x4c4112=_0x2db426?0x0:_0x27b126['offset'];var _0x33cf82=_0x2db426?_0x103dd1[_0xb0c0('0xe')]:_0x27b126[_0xb0c0('0xb')]+_0x27b126[_0xb0c0('0xc')];var _0x28dea5;if(_0x33cf82>=_0x2663a4){_0x33cf82=_0x2663a4;_0x28dea5=0xc8;}else{_0x28dea5=0xce;}_0xd3ac06[_0xb0c0('0xf')](_0x28dea5);return _0xd3ac06[_0xb0c0('0x10')](_0xb0c0('0x11'),_0x4c4112+'-'+_0x33cf82+'/'+_0x2663a4)[_0xb0c0('0xa')](_0x103dd1);}return null;};}function saveUpdates(_0x1455a8){return function(_0x3048ed){if(_0x3048ed){return _0x3048ed[_0xb0c0('0x12')](_0x1455a8)[_0xb0c0('0x13')](function(_0x498b28){return _0x498b28;});}return null;};}function removeEntity(_0x3e58fa){return function(_0x11aeb8){if(_0x11aeb8){return _0x11aeb8['destroy']()[_0xb0c0('0x13')](function(){var _0x620336=_0x11aeb8[_0xb0c0('0x14')]({'plain':!![]});var _0x533930=_0xb0c0('0x15');return db[_0xb0c0('0x16')][_0xb0c0('0x17')]({'where':{'type':_0x533930,'resourceId':_0x620336['id']}})[_0xb0c0('0x13')](function(){return _0x11aeb8;});})[_0xb0c0('0x13')](function(){var _0x1acb8e=new Redis(config['redis']);_0x1acb8e[_0xb0c0('0x18')](_0xb0c0('0x19'),JSON[_0xb0c0('0x1a')]({'id':_0x11aeb8['id'],'deleted':!![]}));})[_0xb0c0('0x13')](function(){_0x3e58fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23b355){return function(_0x185db8){if(!_0x185db8){_0x23b355[_0xb0c0('0x1b')](0x194);}return _0x185db8;};}function handleError(_0x334a95,_0xd9d9dd){_0xd9d9dd=_0xd9d9dd||0x1f4;return function(_0xed1aac){logger[_0xb0c0('0x1c')](_0xed1aac[_0xb0c0('0x1d')]);if(_0xed1aac[_0xb0c0('0x1e')]){delete _0xed1aac[_0xb0c0('0x1e')];}_0x334a95[_0xb0c0('0xf')](_0xd9d9dd)[_0xb0c0('0x1f')](_0xed1aac);};}exports['index']=function(_0x498bfe,_0x71c22c){var _0x533fa5={},_0x3e731f={},_0x2c65ad={'count':0x0,'rows':[]};var _0x4d2654=_[_0xb0c0('0x20')](db[_0xb0c0('0x21')]['rawAttributes'],function(_0x37381d){return{'name':_0x37381d[_0xb0c0('0x22')],'type':_0x37381d[_0xb0c0('0x23')][_0xb0c0('0x24')]};});_0x3e731f[_0xb0c0('0x25')]=_[_0xb0c0('0x20')](_0x4d2654,'name');_0x3e731f[_0xb0c0('0x26')]=_['keys'](_0x498bfe[_0xb0c0('0x26')]);_0x3e731f[_0xb0c0('0x27')]=_[_0xb0c0('0x28')](_0x3e731f[_0xb0c0('0x25')],_0x3e731f[_0xb0c0('0x26')]);_0x533fa5[_0xb0c0('0x29')]=_['intersection'](_0x3e731f[_0xb0c0('0x25')],qs[_0xb0c0('0x2a')](_0x498bfe['query'][_0xb0c0('0x2a')]));_0x533fa5['attributes']=_0x533fa5[_0xb0c0('0x29')][_0xb0c0('0x2b')]?_0x533fa5[_0xb0c0('0x29')]:_0x3e731f[_0xb0c0('0x25')];if(!_0x498bfe[_0xb0c0('0x26')][_0xb0c0('0x2c')](_0xb0c0('0x2d'))){_0x533fa5[_0xb0c0('0xc')]=qs[_0xb0c0('0xc')](_0x498bfe[_0xb0c0('0x26')][_0xb0c0('0xc')]);_0x533fa5[_0xb0c0('0xb')]=qs[_0xb0c0('0xb')](_0x498bfe[_0xb0c0('0x26')][_0xb0c0('0xb')]);}_0x533fa5['order']=qs[_0xb0c0('0x2e')](_0x498bfe[_0xb0c0('0x26')][_0xb0c0('0x2e')]);_0x533fa5[_0xb0c0('0x2f')]=qs[_0xb0c0('0x27')](_[_0xb0c0('0x30')](_0x498bfe[_0xb0c0('0x26')],_0x3e731f[_0xb0c0('0x27')]),_0x4d2654);if(_0x498bfe[_0xb0c0('0x26')]['filter']){_0x533fa5[_0xb0c0('0x2f')]=_[_0xb0c0('0x31')](_0x533fa5[_0xb0c0('0x2f')],{'$or':_[_0xb0c0('0x20')](_0x4d2654,function(_0x551a51){if(_0x551a51[_0xb0c0('0x23')]!==_0xb0c0('0x32')){var _0x43ac01={};_0x43ac01[_0x551a51[_0xb0c0('0x1e')]]={'$like':'%'+_0x498bfe['query'][_0xb0c0('0x33')]+'%'};return _0x43ac01;}})});}_0x533fa5=_[_0xb0c0('0x31')]({},_0x533fa5,_0x498bfe['options']);var _0x218e11={'where':_0x533fa5[_0xb0c0('0x2f')]};return db['SquareProject']['count'](_0x218e11)[_0xb0c0('0x13')](function(_0x40bc7a){_0x2c65ad[_0xb0c0('0xe')]=_0x40bc7a;if(_0x498bfe[_0xb0c0('0x26')][_0xb0c0('0x34')]){_0x533fa5[_0xb0c0('0x35')]=[{'all':!![]}];}return db[_0xb0c0('0x21')][_0xb0c0('0x36')](_0x533fa5);})['then'](function(_0x48a033){_0x2c65ad[_0xb0c0('0x37')]=_0x48a033;return _0x2c65ad;})[_0xb0c0('0x13')](respondWithFilteredResult(_0x71c22c,_0x533fa5))['catch'](handleError(_0x71c22c,null));};exports['show']=function(_0x4fa6d3,_0x4d900c){var _0x5883ba={'raw':![],'where':{'id':_0x4fa6d3[_0xb0c0('0x38')]['id']}},_0x26bd85={};_0x26bd85[_0xb0c0('0x25')]=_[_0xb0c0('0x39')](db['SquareProject'][_0xb0c0('0x3a')]);_0x26bd85[_0xb0c0('0x26')]=_[_0xb0c0('0x39')](_0x4fa6d3[_0xb0c0('0x26')]);_0x26bd85['filters']=_['intersection'](_0x26bd85['model'],_0x26bd85['query']);_0x5883ba[_0xb0c0('0x29')]=_['intersection'](_0x26bd85[_0xb0c0('0x25')],qs['fields'](_0x4fa6d3[_0xb0c0('0x26')]['fields']));_0x5883ba['attributes']=_0x5883ba[_0xb0c0('0x29')][_0xb0c0('0x2b')]?_0x5883ba[_0xb0c0('0x29')]:_0x26bd85[_0xb0c0('0x25')];if(_0x4fa6d3[_0xb0c0('0x26')][_0xb0c0('0x34')]){_0x5883ba['include']=[{'all':!![]}];}_0x5883ba=_[_0xb0c0('0x31')]({},_0x5883ba,_0x4fa6d3['options']);return db['SquareProject'][_0xb0c0('0x3b')](_0x5883ba)['then'](handleEntityNotFound(_0x4d900c,null))[_0xb0c0('0x13')](respondWithResult(_0x4d900c,null))['catch'](handleError(_0x4d900c,null));};exports['create']=function(_0x1121e7,_0x4d052f){return db['SquareProject']['create'](_0x1121e7[_0xb0c0('0x3c')],{})[_0xb0c0('0x13')](function(_0x12cc84){var _0x1e9680=_0x1121e7[_0xb0c0('0x3d')][_0xb0c0('0x14')]({'plain':!![]});if(!_0x1e9680)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e9680[_0xb0c0('0x3e')]===_0xb0c0('0x3d')){var _0x1e663e=_0x12cc84['get']({'plain':!![]});var _0x2f5f10=_0xb0c0('0x15');return db[_0xb0c0('0x3f')][_0xb0c0('0x3b')]({'where':{'name':_0x2f5f10,'userProfileId':_0x1e9680[_0xb0c0('0x40')]},'raw':!![]})[_0xb0c0('0x13')](function(_0x3fbab1){if(_0x3fbab1&&_0x3fbab1[_0xb0c0('0x41')]===0x0){return db[_0xb0c0('0x16')]['create']({'name':_0x1e663e[_0xb0c0('0x1e')],'resourceId':_0x1e663e['id'],'type':_0x3fbab1[_0xb0c0('0x1e')],'sectionId':_0x3fbab1['id']},{})[_0xb0c0('0x13')](function(){return _0x12cc84;});}else{return _0x12cc84;}})[_0xb0c0('0x42')](function(_0x290445){logger[_0xb0c0('0x1c')](_0xb0c0('0x43'),_0x290445);throw _0x290445;});}return _0x12cc84;})[_0xb0c0('0x13')](respondWithResult(_0x4d052f,0xc9))[_0xb0c0('0x42')](handleError(_0x4d052f,null));};exports[_0xb0c0('0x12')]=function(_0x2baa70,_0x3922d3){if(_0x2baa70[_0xb0c0('0x3c')]['id']){delete _0x2baa70[_0xb0c0('0x3c')]['id'];}return db['SquareProject'][_0xb0c0('0x3b')]({'where':{'id':_0x2baa70[_0xb0c0('0x38')]['id']}})['then'](handleEntityNotFound(_0x3922d3,null))[_0xb0c0('0x13')](saveUpdates(_0x2baa70[_0xb0c0('0x3c')],null))[_0xb0c0('0x13')](function(_0x42b553){if(!_0x42b553)return;var _0xdc0ebc=_0x42b553[_0xb0c0('0x14')]({'plain':!![]});return _0xdc0ebc;})[_0xb0c0('0x13')](function(_0x119927){var _0x19dd51=new Redis(config[_0xb0c0('0x5')]);_0x19dd51['publish'](_0xb0c0('0x19'),JSON[_0xb0c0('0x1a')](_['pick'](_0x119927,['id','name',_0xb0c0('0x44')])));return _0x119927;})['then'](respondWithResult(_0x3922d3,null))[_0xb0c0('0x42')](handleError(_0x3922d3,null));};exports['destroy']=function(_0xdd3ab,_0x5867a5){return db[_0xb0c0('0x21')][_0xb0c0('0x3b')]({'where':{'id':_0xdd3ab['params']['id']}})[_0xb0c0('0x13')](handleEntityNotFound(_0x5867a5,null))['then'](removeEntity(_0x5867a5,null))[_0xb0c0('0x42')](handleError(_0x5867a5,null));}; \ No newline at end of file +var _0x8a43=['include','findAll','rows','catch','show','params','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','publish','pick','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','Content-Range','then','destroy','get','SquareProjects','agi','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','merge','options','includeAll'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x8a43,0x147));var _0x38a4=function(_0x16576e,_0x4e7379){_0x16576e=_0x16576e-0x0;var _0x10ba19=_0x8a43[_0x16576e];return _0x10ba19;};'use strict';var _=require('lodash');var Redis=require(_0x38a4('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x38a4('0x1'))(_0x38a4('0x2'));var config=require(_0x38a4('0x3'));var db=require('../../mysqldb')['db'];config[_0x38a4('0x4')]=_['defaults'](config[_0x38a4('0x4')],{'host':_0x38a4('0x5'),'port':0x18eb});var socket=require(_0x38a4('0x6'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x46df03,_0x42bd84){_0x42bd84=_0x42bd84||0xc8;return function(_0x2d26cb){if(_0x2d26cb){return _0x46df03[_0x38a4('0x7')](_0x42bd84)[_0x38a4('0x8')](_0x2d26cb);}};}function respondWithFilteredResult(_0x301664,_0x3a007b){return function(_0x3c8fbe){if(_0x3c8fbe){var _0x10695b=typeof _0x3a007b[_0x38a4('0x9')]===_0x38a4('0xa')&&typeof _0x3a007b[_0x38a4('0xb')]==='undefined';var _0x290104=_0x3c8fbe[_0x38a4('0xc')];var _0x52ec6d=_0x10695b?0x0:_0x3a007b[_0x38a4('0x9')];var _0x4ba7f2=_0x10695b?_0x3c8fbe[_0x38a4('0xc')]:_0x3a007b[_0x38a4('0x9')]+_0x3a007b['limit'];var _0x408865;if(_0x4ba7f2>=_0x290104){_0x4ba7f2=_0x290104;_0x408865=0xc8;}else{_0x408865=0xce;}_0x301664[_0x38a4('0x7')](_0x408865);return _0x301664['set'](_0x38a4('0xd'),_0x52ec6d+'-'+_0x4ba7f2+'/'+_0x290104)['json'](_0x3c8fbe);}return null;};}function saveUpdates(_0x41dac5){return function(_0x306b9f){if(_0x306b9f){return _0x306b9f['update'](_0x41dac5)[_0x38a4('0xe')](function(_0x1c5ff6){return _0x1c5ff6;});}return null;};}function removeEntity(_0x27e69b){return function(_0x27abb8){if(_0x27abb8){return _0x27abb8[_0x38a4('0xf')]()[_0x38a4('0xe')](function(){var _0x5e232e=_0x27abb8[_0x38a4('0x10')]({'plain':!![]});var _0x223b69=_0x38a4('0x11');return db['UserProfileResource'][_0x38a4('0xf')]({'where':{'type':_0x223b69,'resourceId':_0x5e232e['id']}})[_0x38a4('0xe')](function(){return _0x27abb8;});})[_0x38a4('0xe')](function(){var _0x241607=new Redis(config[_0x38a4('0x4')]);_0x241607['publish'](_0x38a4('0x12'),JSON['stringify']({'id':_0x27abb8['id'],'deleted':!![]}));})[_0x38a4('0xe')](function(){_0x27e69b[_0x38a4('0x7')](0xcc)[_0x38a4('0x13')]();});}};}function handleEntityNotFound(_0x4ff89a){return function(_0x3f4497){if(!_0x3f4497){_0x4ff89a[_0x38a4('0x14')](0x194);}return _0x3f4497;};}function handleError(_0x399ad9,_0x55909b){_0x55909b=_0x55909b||0x1f4;return function(_0xd6e381){logger[_0x38a4('0x15')](_0xd6e381[_0x38a4('0x16')]);if(_0xd6e381[_0x38a4('0x17')]){delete _0xd6e381[_0x38a4('0x17')];}_0x399ad9[_0x38a4('0x7')](_0x55909b)[_0x38a4('0x18')](_0xd6e381);};}exports[_0x38a4('0x19')]=function(_0x3ec452,_0x2842ac){var _0x217a05={},_0x556c82={},_0x48be85={'count':0x0,'rows':[]};var _0x5c49fc=_[_0x38a4('0x1a')](db[_0x38a4('0x1b')][_0x38a4('0x1c')],function(_0x18faaf){return{'name':_0x18faaf['fieldName'],'type':_0x18faaf[_0x38a4('0x1d')][_0x38a4('0x1e')]};});_0x556c82[_0x38a4('0x1f')]=_[_0x38a4('0x1a')](_0x5c49fc,_0x38a4('0x17'));_0x556c82[_0x38a4('0x20')]=_[_0x38a4('0x21')](_0x3ec452['query']);_0x556c82[_0x38a4('0x22')]=_['intersection'](_0x556c82[_0x38a4('0x1f')],_0x556c82[_0x38a4('0x20')]);_0x217a05[_0x38a4('0x23')]=_[_0x38a4('0x24')](_0x556c82['model'],qs[_0x38a4('0x25')](_0x3ec452[_0x38a4('0x20')]['fields']));_0x217a05[_0x38a4('0x23')]=_0x217a05[_0x38a4('0x23')][_0x38a4('0x26')]?_0x217a05[_0x38a4('0x23')]:_0x556c82[_0x38a4('0x1f')];if(!_0x3ec452['query']['hasOwnProperty']('nolimit')){_0x217a05[_0x38a4('0xb')]=qs['limit'](_0x3ec452['query'][_0x38a4('0xb')]);_0x217a05[_0x38a4('0x9')]=qs[_0x38a4('0x9')](_0x3ec452['query'][_0x38a4('0x9')]);}_0x217a05[_0x38a4('0x27')]=qs[_0x38a4('0x28')](_0x3ec452[_0x38a4('0x20')][_0x38a4('0x28')]);_0x217a05['where']=qs['filters'](_['pick'](_0x3ec452[_0x38a4('0x20')],_0x556c82['filters']),_0x5c49fc);if(_0x3ec452['query']['filter']){_0x217a05[_0x38a4('0x29')]=_[_0x38a4('0x2a')](_0x217a05[_0x38a4('0x29')],{'$or':_[_0x38a4('0x1a')](_0x5c49fc,function(_0x4faf69){if(_0x4faf69[_0x38a4('0x1d')]!=='VIRTUAL'){var _0x437639={};_0x437639[_0x4faf69[_0x38a4('0x17')]]={'$like':'%'+_0x3ec452[_0x38a4('0x20')]['filter']+'%'};return _0x437639;}})});}_0x217a05=_[_0x38a4('0x2a')]({},_0x217a05,_0x3ec452[_0x38a4('0x2b')]);var _0x101eaa={'where':_0x217a05[_0x38a4('0x29')]};return db[_0x38a4('0x1b')][_0x38a4('0xc')](_0x101eaa)['then'](function(_0x372951){_0x48be85[_0x38a4('0xc')]=_0x372951;if(_0x3ec452[_0x38a4('0x20')][_0x38a4('0x2c')]){_0x217a05[_0x38a4('0x2d')]=[{'all':!![]}];}return db[_0x38a4('0x1b')][_0x38a4('0x2e')](_0x217a05);})[_0x38a4('0xe')](function(_0x4353c2){_0x48be85[_0x38a4('0x2f')]=_0x4353c2;return _0x48be85;})['then'](respondWithFilteredResult(_0x2842ac,_0x217a05))[_0x38a4('0x30')](handleError(_0x2842ac,null));};exports[_0x38a4('0x31')]=function(_0x4f667b,_0x4d1c95){var _0x389d5f={'raw':![],'where':{'id':_0x4f667b[_0x38a4('0x32')]['id']}},_0x502f41={};_0x502f41[_0x38a4('0x1f')]=_[_0x38a4('0x21')](db[_0x38a4('0x1b')][_0x38a4('0x1c')]);_0x502f41[_0x38a4('0x20')]=_[_0x38a4('0x21')](_0x4f667b['query']);_0x502f41[_0x38a4('0x22')]=_[_0x38a4('0x24')](_0x502f41[_0x38a4('0x1f')],_0x502f41[_0x38a4('0x20')]);_0x389d5f['attributes']=_['intersection'](_0x502f41[_0x38a4('0x1f')],qs[_0x38a4('0x25')](_0x4f667b[_0x38a4('0x20')][_0x38a4('0x25')]));_0x389d5f[_0x38a4('0x23')]=_0x389d5f['attributes'][_0x38a4('0x26')]?_0x389d5f[_0x38a4('0x23')]:_0x502f41[_0x38a4('0x1f')];if(_0x4f667b[_0x38a4('0x20')][_0x38a4('0x2c')]){_0x389d5f[_0x38a4('0x2d')]=[{'all':!![]}];}_0x389d5f=_[_0x38a4('0x2a')]({},_0x389d5f,_0x4f667b[_0x38a4('0x2b')]);return db[_0x38a4('0x1b')][_0x38a4('0x33')](_0x389d5f)[_0x38a4('0xe')](handleEntityNotFound(_0x4d1c95,null))[_0x38a4('0xe')](respondWithResult(_0x4d1c95,null))[_0x38a4('0x30')](handleError(_0x4d1c95,null));};exports[_0x38a4('0x34')]=function(_0x469b0f,_0x18ddb1){return db[_0x38a4('0x1b')][_0x38a4('0x34')](_0x469b0f[_0x38a4('0x35')],{})[_0x38a4('0xe')](function(_0x37a7f3){var _0x475ea0=_0x469b0f[_0x38a4('0x36')][_0x38a4('0x10')]({'plain':!![]});if(!_0x475ea0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x475ea0['role']===_0x38a4('0x36')){var _0x164d8b=_0x37a7f3[_0x38a4('0x10')]({'plain':!![]});var _0x22bf4f=_0x38a4('0x11');return db['UserProfileSection'][_0x38a4('0x33')]({'where':{'name':_0x22bf4f,'userProfileId':_0x475ea0[_0x38a4('0x37')]},'raw':!![]})['then'](function(_0x3cdcbc){if(_0x3cdcbc&&_0x3cdcbc[_0x38a4('0x38')]===0x0){return db[_0x38a4('0x39')][_0x38a4('0x34')]({'name':_0x164d8b[_0x38a4('0x17')],'resourceId':_0x164d8b['id'],'type':_0x3cdcbc[_0x38a4('0x17')],'sectionId':_0x3cdcbc['id']},{})[_0x38a4('0xe')](function(){return _0x37a7f3;});}else{return _0x37a7f3;}})[_0x38a4('0x30')](function(_0x368be2){logger[_0x38a4('0x15')](_0x38a4('0x3a'),_0x368be2);throw _0x368be2;});}return _0x37a7f3;})['then'](respondWithResult(_0x18ddb1,0xc9))['catch'](handleError(_0x18ddb1,null));};exports[_0x38a4('0x3b')]=function(_0x15f55f,_0xc6caa4){if(_0x15f55f[_0x38a4('0x35')]['id']){delete _0x15f55f[_0x38a4('0x35')]['id'];}return db[_0x38a4('0x1b')][_0x38a4('0x33')]({'where':{'id':_0x15f55f[_0x38a4('0x32')]['id']}})[_0x38a4('0xe')](handleEntityNotFound(_0xc6caa4,null))['then'](saveUpdates(_0x15f55f[_0x38a4('0x35')],null))[_0x38a4('0xe')](function(_0xf64bbd){if(!_0xf64bbd)return;var _0x4a4620=_0xf64bbd[_0x38a4('0x10')]({'plain':!![]});return _0x4a4620;})[_0x38a4('0xe')](function(_0x27597a){var _0x1e573c=new Redis(config[_0x38a4('0x4')]);_0x1e573c[_0x38a4('0x3c')]('agi',JSON['stringify'](_[_0x38a4('0x3d')](_0x27597a,['id',_0x38a4('0x17'),'production'])));return _0x27597a;})[_0x38a4('0xe')](respondWithResult(_0xc6caa4,null))['catch'](handleError(_0xc6caa4,null));};exports[_0x38a4('0xf')]=function(_0x263c36,_0xa99163){return db[_0x38a4('0x1b')][_0x38a4('0x33')]({'where':{'id':_0x263c36[_0x38a4('0x32')]['id']}})[_0x38a4('0xe')](handleEntityNotFound(_0xa99163,null))[_0x38a4('0xe')](removeEntity(_0xa99163,null))['catch'](handleError(_0xa99163,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3c78e93..9fd7166 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 _0x9aa3=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a6d32,_0x40c317){var _0x356d08=function(_0x29b1f7){while(--_0x29b1f7){_0x2a6d32['push'](_0x2a6d32['shift']());}};_0x356d08(++_0x40c317);}(_0x9aa3,0x156));var _0x39aa=function(_0x2d8e89,_0x1074aa){_0x2d8e89=_0x2d8e89-0x0;var _0x1fb3c2=_0x9aa3[_0x2d8e89];return _0x1fb3c2;};'use strict';var EventEmitter=require(_0x39aa('0x0'));var SquareProject=require(_0x39aa('0x1'))['db'][_0x39aa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x39aa('0x3')](0x0);var events={'afterCreate':_0x39aa('0x4'),'afterUpdate':_0x39aa('0x5'),'afterDestroy':_0x39aa('0x6')};function emitEvent(_0x3a43e4){return function(_0x3bdbff,_0x2eed43,_0x1a217c){SquareProjectEvents[_0x39aa('0x7')](_0x3a43e4+':'+_0x3bdbff['id'],_0x3bdbff);SquareProjectEvents[_0x39aa('0x7')](_0x3a43e4,_0x3bdbff);_0x1a217c(null);};}for(var e in events){if(events[_0x39aa('0x8')](e)){var event=events[e];SquareProject[_0x39aa('0x9')](e,emitEvent(event));}}module[_0x39aa('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x298f=['remove','emit','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x16c824,_0x363c1d){var _0x267974=function(_0x58ab1f){while(--_0x58ab1f){_0x16c824['push'](_0x16c824['shift']());}};_0x267974(++_0x363c1d);}(_0x298f,0x1d8));var _0xf298=function(_0xbbcf16,_0x5a7910){_0xbbcf16=_0xbbcf16-0x0;var _0x5adf6f=_0x298f[_0xbbcf16];return _0x5adf6f;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xf298('0x0'))['db'][_0xf298('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf298('0x2')](0x0);var events={'afterCreate':_0xf298('0x3'),'afterUpdate':_0xf298('0x4'),'afterDestroy':_0xf298('0x5')};function emitEvent(_0x267c4b){return function(_0x4a3b8b,_0x47e1f1,_0x4ce7d2){SquareProjectEvents['emit'](_0x267c4b+':'+_0x4a3b8b['id'],_0x4a3b8b);SquareProjectEvents[_0xf298('0x6')](_0x267c4b,_0x4a3b8b);_0x4ce7d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xf298('0x7')](e,emitEvent(event));}}module[_0xf298('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d9cf32e..2eb2893 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 _0x4f9b=['request-promise','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','changed','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird'];(function(_0x5ae726,_0x573b36){var _0x43d022=function(_0x5d6949){while(--_0x5d6949){_0x5ae726['push'](_0x5ae726['shift']());}};_0x43d022(++_0x573b36);}(_0x4f9b,0x9e));var _0xb4f9=function(_0x53692f,_0x433fb7){_0x53692f=_0x53692f-0x0;var _0x3da192=_0x4f9b[_0x53692f];return _0x3da192;};'use strict';var _=require(_0xb4f9('0x0'));var util=require('util');var logger=require(_0xb4f9('0x1'))(_0xb4f9('0x2'));var moment=require('moment');var BPromise=require(_0xb4f9('0x3'));var rp=require(_0xb4f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb4f9('0x5'));var attributes=require(_0xb4f9('0x6'));module[_0xb4f9('0x7')]=function(_0x3afc91,_0x25eb8a){return _0x3afc91[_0xb4f9('0x8')](_0xb4f9('0x9'),attributes,{'tableName':_0xb4f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x379cef,_0x2b088a,_0x5472b9){if(_0x379cef['changed'](_0xb4f9('0xb'))){_0x379cef[_0xb4f9('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x379cef[_0xb4f9('0xd')](_0xb4f9('0xe'))){_0x379cef[_0xb4f9('0xf')]=moment()[_0xb4f9('0x10')](_0xb4f9('0x11'));}_0x5472b9(null,_0x379cef);}}});}; \ No newline at end of file +var _0x7dff=['savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','api','moment','request-promise','path','rimraf','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7dff,0x1e0));var _0xf7df=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7dff[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xf7df('0x0'));var util=require(_0xf7df('0x1'));var logger=require('../../config/logger')(_0xf7df('0x2'));var moment=require(_0xf7df('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7df('0x4'));var fs=require('fs');var path=require(_0xf7df('0x5'));var rimraf=require(_0xf7df('0x6'));var config=require('../../config/environment');var attributes=require(_0xf7df('0x7'));module[_0xf7df('0x8')]=function(_0x42eb7b,_0x3a60cf){return _0x42eb7b['define'](_0xf7df('0x9'),attributes,{'tableName':_0xf7df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d475b,_0x4170bd,_0x221db5){if(_0x1d475b[_0xf7df('0xb')](_0xf7df('0xc'))){_0x1d475b[_0xf7df('0xd')]=moment()['format'](_0xf7df('0xe'));}if(_0x1d475b[_0xf7df('0xb')](_0xf7df('0xf'))){_0x1d475b['publishedAt']=moment()[_0xf7df('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x221db5(null,_0x1d475b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b595c55..7d8ae36 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 _0x185f=['model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','map','include'];(function(_0x498b22,_0x131b18){var _0x327881=function(_0x4ad7b8){while(--_0x4ad7b8){_0x498b22['push'](_0x498b22['shift']());}};_0x327881(++_0x131b18);}(_0x185f,0x1de));var _0xf185=function(_0x3d1b88,_0x308670){_0x3d1b88=_0x3d1b88-0x0;var _0x302e17=_0x185f[_0x3d1b88];return _0x302e17;};'use strict';var _=require(_0xf185('0x0'));var Redis=require('ioredis');var db=require(_0xf185('0x1'))['db'];var logger=require(_0xf185('0x2'))(_0xf185('0x3'));var config=require('../../config/environment');config[_0xf185('0x4')]=_['defaults'](config[_0xf185('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xf185('0x5'))(new Redis(config[_0xf185('0x4')]));require(_0xf185('0x6'))[_0xf185('0x7')](socket);exports[_0xf185('0x8')]=function(_0x4c241c){var _0x1e94c4=this;return new Promise(function(_0x29f396,_0x4a853d){return db[_0xf185('0x9')][_0xf185('0xa')]({'raw':_0x4c241c[_0xf185('0xb')]?_0x4c241c[_0xf185('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x4c241c[_0xf185('0xb')]?_0x4c241c[_0xf185('0xb')][_0xf185('0xc')]||null:null,'attributes':_0x4c241c[_0xf185('0xb')]?_0x4c241c[_0xf185('0xb')][_0xf185('0xd')]||null:null,'limit':_0x4c241c[_0xf185('0xb')]?_0x4c241c[_0xf185('0xb')]['limit']||null:null,'include':_0x4c241c['options']?_0x4c241c['options']['include']?_[_0xf185('0xe')](_0x4c241c[_0xf185('0xb')][_0xf185('0xf')],function(_0x17a3a3){return{'model':db[_0x17a3a3[_0xf185('0x10')]],'as':_0x17a3a3['as'],'attributes':_0x17a3a3[_0xf185('0xd')],'include':_0x17a3a3[_0xf185('0xf')]?_[_0xf185('0xe')](_0x17a3a3[_0xf185('0xf')],function(_0x5a7858){return{'model':db[_0x5a7858['model']],'as':_0x5a7858['as'],'attributes':_0x5a7858[_0xf185('0xd')],'include':_0x5a7858[_0xf185('0xf')]?_[_0xf185('0xe')](_0x5a7858['include'],function(_0x40d8fb){return{'model':db[_0x40d8fb[_0xf185('0x10')]],'as':_0x40d8fb['as'],'attributes':_0x40d8fb[_0xf185('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf185('0x11')](function(_0x75af96){logger[_0xf185('0x12')]('GetSquareProjects',_0x4c241c);logger[_0xf185('0x13')](_0xf185('0x8'),_0x4c241c,JSON[_0xf185('0x14')](_0x75af96));_0x29f396(_0x75af96);})[_0xf185('0x15')](function(_0x4fc6f2){logger[_0xf185('0x16')](_0xf185('0x8'),_0x4fc6f2['message'],_0x4c241c);_0x4a853d(_0x1e94c4[_0xf185('0x16')](0x1f4,_0x4fc6f2[_0xf185('0x17')]));});});};exports[_0xf185('0x18')]=function(_0xa6337a){var _0x1c0f15=this;return new Promise(function(_0x4a2d7f,_0x3f2029){return db[_0xf185('0x9')][_0xf185('0x19')]({'raw':_0xa6337a[_0xf185('0xb')]?_0xa6337a['options']['raw']===undefined?!![]:![]:!![],'where':_0xa6337a[_0xf185('0xb')]?_0xa6337a[_0xf185('0xb')][_0xf185('0xc')]||null:null,'attributes':_0xa6337a[_0xf185('0xb')]?_0xa6337a[_0xf185('0xb')][_0xf185('0xd')]||null:null,'include':_0xa6337a[_0xf185('0xb')]?_0xa6337a[_0xf185('0xb')]['include']?_[_0xf185('0xe')](_0xa6337a[_0xf185('0xb')][_0xf185('0xf')],function(_0x392b41){return{'model':db[_0x392b41[_0xf185('0x10')]],'as':_0x392b41['as'],'attributes':_0x392b41[_0xf185('0xd')],'include':_0x392b41['include']?_[_0xf185('0xe')](_0x392b41['include'],function(_0x19b044){return{'model':db[_0x19b044[_0xf185('0x10')]],'as':_0x19b044['as'],'attributes':_0x19b044[_0xf185('0xd')],'include':_0x19b044[_0xf185('0xf')]?_[_0xf185('0xe')](_0x19b044[_0xf185('0xf')],function(_0x20a3f4){return{'model':db[_0x20a3f4[_0xf185('0x10')]],'as':_0x20a3f4['as'],'attributes':_0x20a3f4[_0xf185('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf185('0x11')](function(_0x105622){logger[_0xf185('0x12')](_0xf185('0x18'),_0xa6337a);logger['debug']('ShowSquareProject',_0xa6337a,JSON[_0xf185('0x14')](_0x105622));_0x4a2d7f(_0x105622);})[_0xf185('0x15')](function(_0x3de2a8){logger[_0xf185('0x16')](_0xf185('0x18'),_0x3de2a8[_0xf185('0x17')],_0xa6337a);_0x3f2029(_0x1c0f15['error'](0x1f4,_0x3de2a8[_0xf185('0x17')]));});});}; \ No newline at end of file +var _0x7814=['debug','stringify','catch','error','message','find','raw','info','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','map','include','model'];(function(_0x4738b7,_0x9096f0){var _0x47cb9e=function(_0x45ee49){while(--_0x45ee49){_0x4738b7['push'](_0x4738b7['shift']());}};_0x47cb9e(++_0x9096f0);}(_0x7814,0x90));var _0x4781=function(_0x4a5205,_0x58f899){_0x4a5205=_0x4a5205-0x0;var _0x17ec60=_0x7814[_0x4a5205];return _0x17ec60;};'use strict';var _=require('lodash');var Redis=require(_0x4781('0x0'));var db=require(_0x4781('0x1'))['db'];var logger=require(_0x4781('0x2'))('rpc');var config=require('../../config/environment');config[_0x4781('0x3')]=_[_0x4781('0x4')](config[_0x4781('0x3')],{'host':_0x4781('0x5'),'port':0x18eb});var socket=require(_0x4781('0x6'))(new Redis(config[_0x4781('0x3')]));require('./squareProject.socket')[_0x4781('0x7')](socket);exports[_0x4781('0x8')]=function(_0x368f39){var _0x42bb45=this;return new Promise(function(_0x5e1ade,_0x554b97){return db[_0x4781('0x9')][_0x4781('0xa')]({'raw':_0x368f39['options']?_0x368f39[_0x4781('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x368f39[_0x4781('0xb')]?_0x368f39['options'][_0x4781('0xc')]||null:null,'attributes':_0x368f39[_0x4781('0xb')]?_0x368f39[_0x4781('0xb')][_0x4781('0xd')]||null:null,'limit':_0x368f39[_0x4781('0xb')]?_0x368f39[_0x4781('0xb')][_0x4781('0xe')]||null:null,'include':_0x368f39[_0x4781('0xb')]?_0x368f39[_0x4781('0xb')]['include']?_[_0x4781('0xf')](_0x368f39['options'][_0x4781('0x10')],function(_0xe4cfbd){return{'model':db[_0xe4cfbd[_0x4781('0x11')]],'as':_0xe4cfbd['as'],'attributes':_0xe4cfbd[_0x4781('0xd')],'include':_0xe4cfbd[_0x4781('0x10')]?_['map'](_0xe4cfbd[_0x4781('0x10')],function(_0x195447){return{'model':db[_0x195447['model']],'as':_0x195447['as'],'attributes':_0x195447['attributes'],'include':_0x195447[_0x4781('0x10')]?_[_0x4781('0xf')](_0x195447[_0x4781('0x10')],function(_0x4ae399){return{'model':db[_0x4ae399['model']],'as':_0x4ae399['as'],'attributes':_0x4ae399['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x271c4a){logger['info'](_0x4781('0x8'),_0x368f39);logger[_0x4781('0x12')]('GetSquareProjects',_0x368f39,JSON[_0x4781('0x13')](_0x271c4a));_0x5e1ade(_0x271c4a);})[_0x4781('0x14')](function(_0x487004){logger[_0x4781('0x15')](_0x4781('0x8'),_0x487004['message'],_0x368f39);_0x554b97(_0x42bb45[_0x4781('0x15')](0x1f4,_0x487004[_0x4781('0x16')]));});});};exports['ShowSquareProject']=function(_0x5addf1){var _0x55fc74=this;return new Promise(function(_0x50e9ba,_0x441dec){return db[_0x4781('0x9')][_0x4781('0x17')]({'raw':_0x5addf1[_0x4781('0xb')]?_0x5addf1[_0x4781('0xb')][_0x4781('0x18')]===undefined?!![]:![]:!![],'where':_0x5addf1[_0x4781('0xb')]?_0x5addf1['options'][_0x4781('0xc')]||null:null,'attributes':_0x5addf1['options']?_0x5addf1[_0x4781('0xb')]['attributes']||null:null,'include':_0x5addf1[_0x4781('0xb')]?_0x5addf1[_0x4781('0xb')][_0x4781('0x10')]?_[_0x4781('0xf')](_0x5addf1[_0x4781('0xb')][_0x4781('0x10')],function(_0x17e244){return{'model':db[_0x17e244[_0x4781('0x11')]],'as':_0x17e244['as'],'attributes':_0x17e244[_0x4781('0xd')],'include':_0x17e244[_0x4781('0x10')]?_[_0x4781('0xf')](_0x17e244[_0x4781('0x10')],function(_0x5a059a){return{'model':db[_0x5a059a['model']],'as':_0x5a059a['as'],'attributes':_0x5a059a[_0x4781('0xd')],'include':_0x5a059a[_0x4781('0x10')]?_['map'](_0x5a059a[_0x4781('0x10')],function(_0x33e0b9){return{'model':db[_0x33e0b9[_0x4781('0x11')]],'as':_0x33e0b9['as'],'attributes':_0x33e0b9[_0x4781('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52b990){logger[_0x4781('0x19')](_0x4781('0x1a'),_0x5addf1);logger['debug']('ShowSquareProject',_0x5addf1,JSON['stringify'](_0x52b990));_0x50e9ba(_0x52b990);})[_0x4781('0x14')](function(_0x282136){logger[_0x4781('0x15')](_0x4781('0x1a'),_0x282136[_0x4781('0x16')],_0x5addf1);_0x441dec(_0x55fc74[_0x4781('0x15')](0x1f4,_0x282136[_0x4781('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9a00961..772630a 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 _0x8f31=['remove','emit','register','length','squareProject:','./squareProject.events'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x8f31,0x1a9));var _0x18f3=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x8f31[_0x2b2c53];return _0x311ec2;};'use strict';var SquareProjectEvents=require(_0x18f3('0x0'));var events=['save',_0x18f3('0x1'),'update'];function createListener(_0x266d17,_0x49b205){return function(_0x300798){_0x49b205[_0x18f3('0x2')](_0x266d17,_0x300798);};}function removeListener(_0xc9c176,_0x3689bf){return function(){SquareProjectEvents['removeListener'](_0xc9c176,_0x3689bf);};}exports[_0x18f3('0x3')]=function(_0xc58c98){for(var _0x5220f7=0x0,_0x53536b=events[_0x18f3('0x4')];_0x5220f7<_0x53536b;_0x5220f7++){var _0x6398bd=events[_0x5220f7];var _0x397e30=createListener(_0x18f3('0x5')+_0x6398bd,_0xc58c98);SquareProjectEvents['on'](_0x6398bd,_0x397e30);}}; \ No newline at end of file +var _0xb016=['removeListener','register','length','squareProject:','save','update'];(function(_0x49ff38,_0x274be1){var _0xda4c48=function(_0x47b59c){while(--_0x47b59c){_0x49ff38['push'](_0x49ff38['shift']());}};_0xda4c48(++_0x274be1);}(_0xb016,0xee));var _0x6b01=function(_0x469741,_0x28991d){_0x469741=_0x469741-0x0;var _0x47aa01=_0xb016[_0x469741];return _0x47aa01;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6b01('0x0'),'remove',_0x6b01('0x1')];function createListener(_0x450904,_0x4382bb){return function(_0x3d28ec){_0x4382bb['emit'](_0x450904,_0x3d28ec);};}function removeListener(_0x4886c7,_0x3954b8){return function(){SquareProjectEvents[_0x6b01('0x2')](_0x4886c7,_0x3954b8);};}exports[_0x6b01('0x3')]=function(_0x4d574e){for(var _0x41e1a5=0x0,_0x498452=events[_0x6b01('0x4')];_0x41e1a5<_0x498452;_0x41e1a5++){var _0x5bd33d=events[_0x41e1a5];var _0x2f97ae=createListener(_0x6b01('0x5')+_0x5bd33d,_0x4d574e);SquareProjectEvents['on'](_0x5bd33d,_0x2f97ae);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a2c2c97..af392e1 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x2876ef,_0x67a700){var _0x3bce04=function(_0xe41a04){while(--_0xe41a04){_0x2876ef['push'](_0x2876ef['shift']());}};_0x3bce04(++_0x67a700);}(_0x1261,0x144));var _0x1126=function(_0x2d582c,_0x424a15){_0x2d582c=_0x2d582c-0x0;var _0x37e92a=_0x1261[_0x2d582c];return _0x37e92a;};'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']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0xc2dfff,_0x5e5a6f){var _0x52a91d=function(_0x4d7add){while(--_0x4d7add){_0xc2dfff['push'](_0xc2dfff['shift']());}};_0x52a91d(++_0x5e5a6f);}(_0x4975,0x86));var _0x5497=function(_0x30a321,_0x28c260){_0x30a321=_0x30a321-0x0;var _0x237514=_0x4975[_0x30a321];return _0x237514;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 967b9dd..11670ae 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 _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x30ef26,_0x2e16ba){var _0x310412=function(_0x12437e){while(--_0x12437e){_0x30ef26['push'](_0x30ef26['shift']());}};_0x310412(++_0x2e16ba);}(_0x81bd,0x7c));var _0xd81b=function(_0x4684af,_0x34880f){_0x4684af=_0x4684af-0x0;var _0x3bb413=_0x81bd[_0x4684af];return _0x3bb413;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file +var _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x1a16e9,_0x3fb049){var _0x23f010=function(_0x483191){while(--_0x483191){_0x1a16e9['push'](_0x1a16e9['shift']());}};_0x23f010(++_0x3fb049);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a5bfb48..69248cc 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 _0xb4a4=['length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','catch','update','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SquareRecording','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0x36b7e5,_0x4e0910){var _0x495fb7=function(_0x183656){while(--_0x183656){_0x36b7e5['push'](_0x36b7e5['shift']());}};_0x495fb7(++_0x4e0910);}(_0xb4a4,0xec));var _0x4b4a=function(_0x4abc14,_0x88acf7){_0x4abc14=_0x4abc14-0x0;var _0x1d0ad2=_0xb4a4[_0x4abc14];return _0x1d0ad2;};'use strict';var emlformat=require(_0x4b4a('0x0'));var rimraf=require(_0x4b4a('0x1'));var zipdir=require(_0x4b4a('0x2'));var jsonpatch=require(_0x4b4a('0x3'));var rp=require(_0x4b4a('0x4'));var moment=require('moment');var BPromise=require(_0x4b4a('0x5'));var Mustache=require(_0x4b4a('0x6'));var util=require(_0x4b4a('0x7'));var path=require(_0x4b4a('0x8'));var sox=require('sox');var csv=require(_0x4b4a('0x9'));var ejs=require(_0x4b4a('0xa'));var fs=require('fs');var fs_extra=require(_0x4b4a('0xb'));var _=require(_0x4b4a('0xc'));var squel=require('squel');var crypto=require(_0x4b4a('0xd'));var jsforce=require(_0x4b4a('0xe'));var deskjs=require(_0x4b4a('0xf'));var toCsv=require(_0x4b4a('0x9'));var querystring=require(_0x4b4a('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b4a('0x11'));var authService=require(_0x4b4a('0x12'));var qs=require(_0x4b4a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b4a('0x14'));var logger=require(_0x4b4a('0x15'))('api');var utils=require(_0x4b4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4b4a('0x17'));var db=require(_0x4b4a('0x18'))['db'];function respondWithStatusCode(_0x10cefc,_0x1354af){_0x1354af=_0x1354af||0xcc;return function(_0x370f7){if(_0x370f7){return _0x10cefc[_0x4b4a('0x19')](_0x1354af);}return _0x10cefc[_0x4b4a('0x1a')](_0x1354af)[_0x4b4a('0x1b')]();};}function respondWithResult(_0x4b2840,_0x243125){_0x243125=_0x243125||0xc8;return function(_0x172921){if(_0x172921){return _0x4b2840[_0x4b4a('0x1a')](_0x243125)[_0x4b4a('0x1c')](_0x172921);}};}function respondWithFilteredResult(_0x30165e,_0x193032){return function(_0x24157e){if(_0x24157e){var _0xc5d31=typeof _0x193032[_0x4b4a('0x1d')]==='undefined'&&typeof _0x193032['limit']==='undefined';var _0x2e94fa=_0x24157e[_0x4b4a('0x1e')];var _0x703622=_0xc5d31?0x0:_0x193032[_0x4b4a('0x1d')];var _0x1f3e32=_0xc5d31?_0x24157e[_0x4b4a('0x1e')]:_0x193032[_0x4b4a('0x1d')]+_0x193032['limit'];var _0x56eb38;if(_0x1f3e32>=_0x2e94fa){_0x1f3e32=_0x2e94fa;_0x56eb38=0xc8;}else{_0x56eb38=0xce;}_0x30165e['status'](_0x56eb38);return _0x30165e[_0x4b4a('0x1f')](_0x4b4a('0x20'),_0x703622+'-'+_0x1f3e32+'/'+_0x2e94fa)[_0x4b4a('0x1c')](_0x24157e);}return null;};}function patchUpdates(_0x3a0374){return function(_0x597116){try{jsonpatch[_0x4b4a('0x21')](_0x597116,_0x3a0374,!![]);}catch(_0x3392b3){return BPromise[_0x4b4a('0x22')](_0x3392b3);}return _0x597116[_0x4b4a('0x23')]();};}function saveUpdates(_0x4a6054,_0x3d8de9){return function(_0x4dfc5a){if(_0x4dfc5a){return _0x4dfc5a['update'](_0x4a6054)[_0x4b4a('0x24')](function(_0x1d223a){return _0x1d223a;});}return null;};}function removeEntity(_0x3aba26,_0x45544b){return function(_0x22b2a8){if(_0x22b2a8){return _0x22b2a8[_0x4b4a('0x25')]()[_0x4b4a('0x24')](function(){_0x3aba26['status'](0xcc)[_0x4b4a('0x1b')]();});}};}function handleEntityNotFound(_0x2a117e,_0x206d9b){return function(_0x444caf){if(!_0x444caf){_0x2a117e[_0x4b4a('0x19')](0x194);}return _0x444caf;};}function handleError(_0x3ef04d,_0x416388){_0x416388=_0x416388||0x1f4;return function(_0x13fe21){logger[_0x4b4a('0x26')](_0x13fe21['stack']);if(_0x13fe21[_0x4b4a('0x27')]){delete _0x13fe21[_0x4b4a('0x27')];}_0x3ef04d[_0x4b4a('0x1a')](_0x416388)[_0x4b4a('0x28')](_0x13fe21);};}exports[_0x4b4a('0x29')]=function(_0x38cf8d,_0x59d326){var _0x3484fb={},_0x1c248c={},_0xa09a4d={'count':0x0,'rows':[]};var _0x3eb277=_[_0x4b4a('0x2a')](db[_0x4b4a('0x2b')]['rawAttributes'],function(_0x25c657){return{'name':_0x25c657[_0x4b4a('0x2c')],'type':_0x25c657[_0x4b4a('0x2d')]['key']};});_0x1c248c[_0x4b4a('0x2e')]=_[_0x4b4a('0x2a')](_0x3eb277,_0x4b4a('0x27'));_0x1c248c[_0x4b4a('0x2f')]=_['keys'](_0x38cf8d[_0x4b4a('0x2f')]);_0x1c248c[_0x4b4a('0x30')]=_[_0x4b4a('0x31')](_0x1c248c[_0x4b4a('0x2e')],_0x1c248c['query']);_0x3484fb[_0x4b4a('0x32')]=_['intersection'](_0x1c248c[_0x4b4a('0x2e')],qs[_0x4b4a('0x33')](_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x33')]));_0x3484fb[_0x4b4a('0x32')]=_0x3484fb[_0x4b4a('0x32')][_0x4b4a('0x34')]?_0x3484fb['attributes']:_0x1c248c[_0x4b4a('0x2e')];if(!_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x35')](_0x4b4a('0x36'))){_0x3484fb[_0x4b4a('0x37')]=qs[_0x4b4a('0x37')](_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x37')]);_0x3484fb[_0x4b4a('0x1d')]=qs[_0x4b4a('0x1d')](_0x38cf8d[_0x4b4a('0x2f')]['offset']);}_0x3484fb['order']=qs['sort'](_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x38')]);_0x3484fb[_0x4b4a('0x39')]=qs['filters'](_[_0x4b4a('0x3a')](_0x38cf8d[_0x4b4a('0x2f')],_0x1c248c[_0x4b4a('0x30')]),_0x3eb277);if(_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x3b')]){_0x3484fb[_0x4b4a('0x39')]=_[_0x4b4a('0x3c')](_0x3484fb[_0x4b4a('0x39')],{'$or':_['map'](_0x3eb277,function(_0xcd16e6){if(_0xcd16e6[_0x4b4a('0x2d')]!==_0x4b4a('0x3d')){var _0x5baf85={};_0x5baf85[_0xcd16e6[_0x4b4a('0x27')]]={'$like':'%'+_0x38cf8d['query'][_0x4b4a('0x3b')]+'%'};return _0x5baf85;}})});}_0x3484fb=_[_0x4b4a('0x3c')]({},_0x3484fb,_0x38cf8d[_0x4b4a('0x3e')]);var _0x505849={'where':_0x3484fb[_0x4b4a('0x39')]};return db[_0x4b4a('0x2b')][_0x4b4a('0x1e')](_0x505849)[_0x4b4a('0x24')](function(_0x60ce12){_0xa09a4d[_0x4b4a('0x1e')]=_0x60ce12;if(_0x38cf8d[_0x4b4a('0x2f')][_0x4b4a('0x3f')]){_0x3484fb[_0x4b4a('0x40')]=[{'all':!![]}];}return db[_0x4b4a('0x2b')][_0x4b4a('0x41')](_0x3484fb);})[_0x4b4a('0x24')](function(_0x2d2f21){_0xa09a4d['rows']=_0x2d2f21;return _0xa09a4d;})['then'](respondWithFilteredResult(_0x59d326,_0x3484fb))['catch'](handleError(_0x59d326,null));};exports[_0x4b4a('0x42')]=function(_0x508b22,_0x327ba0){var _0x52c5c7={'raw':!![],'where':{'id':_0x508b22[_0x4b4a('0x43')]['id']}},_0x953950={};_0x953950['model']=_['keys'](db[_0x4b4a('0x2b')]['rawAttributes']);_0x953950[_0x4b4a('0x2f')]=_[_0x4b4a('0x44')](_0x508b22[_0x4b4a('0x2f')]);_0x953950[_0x4b4a('0x30')]=_[_0x4b4a('0x31')](_0x953950[_0x4b4a('0x2e')],_0x953950[_0x4b4a('0x2f')]);_0x52c5c7[_0x4b4a('0x32')]=_[_0x4b4a('0x31')](_0x953950['model'],qs[_0x4b4a('0x33')](_0x508b22[_0x4b4a('0x2f')][_0x4b4a('0x33')]));_0x52c5c7[_0x4b4a('0x32')]=_0x52c5c7[_0x4b4a('0x32')]['length']?_0x52c5c7[_0x4b4a('0x32')]:_0x953950['model'];if(_0x508b22['query']['includeAll']){_0x52c5c7[_0x4b4a('0x40')]=[{'all':!![]}];}_0x52c5c7=_['merge']({},_0x52c5c7,_0x508b22['options']);return db[_0x4b4a('0x2b')][_0x4b4a('0x45')](_0x52c5c7)['then'](handleEntityNotFound(_0x327ba0,null))[_0x4b4a('0x24')](respondWithResult(_0x327ba0,null))['catch'](handleError(_0x327ba0,null));};exports[_0x4b4a('0x46')]=function(_0x373d32,_0x5b654e){return db[_0x4b4a('0x2b')][_0x4b4a('0x46')](_0x373d32['body'],{})[_0x4b4a('0x24')](respondWithResult(_0x5b654e,0xc9))[_0x4b4a('0x47')](handleError(_0x5b654e,null));};exports[_0x4b4a('0x48')]=function(_0x4584b0,_0x4d4dc6){if(_0x4584b0[_0x4b4a('0x49')]['id']){delete _0x4584b0['body']['id'];}return db[_0x4b4a('0x2b')][_0x4b4a('0x45')]({'where':{'id':_0x4584b0[_0x4b4a('0x43')]['id']}})[_0x4b4a('0x24')](handleEntityNotFound(_0x4d4dc6,null))[_0x4b4a('0x24')](saveUpdates(_0x4584b0[_0x4b4a('0x49')],null))[_0x4b4a('0x24')](respondWithResult(_0x4d4dc6,null))['catch'](handleError(_0x4d4dc6,null));};exports[_0x4b4a('0x4a')]=function(_0x22278d,_0x150aa3,_0x475498){var _0x25c9c3=require('../../components/encryptor');var _0x4a4690=![];var _0x26ec17={};if(_0x22278d[_0x4b4a('0x2f')][_0x4b4a('0x2d')]&&_0x22278d[_0x4b4a('0x2f')][_0x4b4a('0x2d')]===_0x4b4a('0x4b')){_0x26ec17[_0x4b4a('0x4b')]=_0x22278d['params']['id'];}else{_0x26ec17['id']=_0x22278d[_0x4b4a('0x43')]['id'];}return db[_0x4b4a('0x2b')][_0x4b4a('0x45')]({'where':_0x26ec17,'attributes':['id',_0x4b4a('0x4c'),'filename'],'raw':!![]})[_0x4b4a('0x24')](handleEntityNotFound(_0x150aa3,null))[_0x4b4a('0x24')](function(_0x5b3569){if(_0x5b3569){var _0x4d67f0=_0x5b3569[_0x4b4a('0x4c')];var _0x338390=util[_0x4b4a('0x4d')](_0x4b4a('0x4e'),_0x4d67f0);if(fs[_0x4b4a('0x4f')](_0x338390)){_0x4a4690=!![];return _0x25c9c3[_0x4b4a('0x50')](_0x338390,_0x4d67f0,config[_0x4b4a('0x51')][_0x4b4a('0x52')])['then'](function(){return _0x5b3569;});}return _0x5b3569;}})[_0x4b4a('0x24')](function(_0x5b866a){if(_0x5b866a){var _0x4a9420=_0x5b866a['savePath'];if(!fs[_0x4b4a('0x4f')](_0x4a9420)){throw new db['Sequelize']['ValidationError'](_0x4b4a('0x53'));}if(_0x5b866a[_0x4b4a('0x54')]){return _0x150aa3[_0x4b4a('0x4a')](_0x4a9420,_0x5b866a['filename']+path[_0x4b4a('0x55')](_0x4a9420),function(){if(_0x4a4690){fs[_0x4b4a('0x56')](_0x4a9420);}});}else{return _0x150aa3[_0x4b4a('0x4a')](_0x4a9420,function(_0x2409b7){if(_0x4a4690){fs[_0x4b4a('0x56')](_0x4a9420);}});}}})[_0x4b4a('0x47')](function(_0x13a2d7){if(_0x13a2d7[_0x4b4a('0x57')]==='SquareRecording\x20not\x20found'){_0x150aa3[_0x4b4a('0x1a')](0x194)[_0x4b4a('0x28')](_0x4b4a('0x58'));}else{return handleError(_0x150aa3,null);}});};exports[_0x4b4a('0x25')]=function(_0x339a83,_0x37e1f4){return db[_0x4b4a('0x2b')][_0x4b4a('0x45')]({'where':{'id':_0x339a83[_0x4b4a('0x43')]['id']}})[_0x4b4a('0x24')](function(_0x2f0869){if(_['isNil'](_0x2f0869)){throw new ReferenceError(_0x4b4a('0x59'));}return _0x2f0869;})[_0x4b4a('0x24')](function(_0x11f350){var _0x2a8b47=_0x11f350['savePath'];logger[_0x4b4a('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x2a8b47);if(!_['isNil'](_0x11f350[_0x4b4a('0x4c')])&&fs[_0x4b4a('0x4f')](_0x2a8b47)){logger[_0x4b4a('0x5a')](_0x4b4a('0x5b')+_0x2a8b47+_0x4b4a('0x5c'));fs[_0x4b4a('0x5d')](_0x2a8b47);}_0x2a8b47=_0x2a8b47+_0x4b4a('0x5e');if(!_[_0x4b4a('0x5f')](_0x11f350[_0x4b4a('0x4c')])&&fs[_0x4b4a('0x4f')](_0x2a8b47)){logger[_0x4b4a('0x5a')]('File:\x20\x22'+_0x2a8b47+_0x4b4a('0x5c'));fs['unlinkSync'](_0x2a8b47);}return _0x11f350;})['then'](function(_0x2b1414){if(!_0x2b1414)throw new InternalError();return _0x2b1414['destroy']();})[_0x4b4a('0x24')](function(){_0x37e1f4[_0x4b4a('0x1a')](0xcc)[_0x4b4a('0x1b')]();})[_0x4b4a('0x47')](handleError(_0x37e1f4,null));}; \ No newline at end of file +var _0xe99a=['SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','update','then','sendStatus','stack','name','send','index','map','SquareRecording','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','body','../../components/encryptor','type','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError'];(function(_0x51badd,_0x59b76c){var _0x16e30f=function(_0x457a45){while(--_0x457a45){_0x51badd['push'](_0x51badd['shift']());}};_0x16e30f(++_0x59b76c);}(_0xe99a,0x68));var _0xae99=function(_0x3f9c0a,_0x357d5e){_0x3f9c0a=_0x3f9c0a-0x0;var _0x5df8b2=_0xe99a[_0x3f9c0a];return _0x5df8b2;};'use strict';var emlformat=require(_0xae99('0x0'));var rimraf=require(_0xae99('0x1'));var zipdir=require(_0xae99('0x2'));var jsonpatch=require(_0xae99('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae99('0x4'));var Mustache=require('mustache');var util=require(_0xae99('0x5'));var path=require(_0xae99('0x6'));var sox=require('sox');var csv=require(_0xae99('0x7'));var ejs=require(_0xae99('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae99('0x9'));var squel=require(_0xae99('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xae99('0xb'));var toCsv=require(_0xae99('0x7'));var querystring=require('querystring');var Papa=require(_0xae99('0xc'));var Redis=require(_0xae99('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xae99('0xe'));var as=require(_0xae99('0xf'));var hardwareService=require(_0xae99('0x10'));var logger=require(_0xae99('0x11'))(_0xae99('0x12'));var utils=require('../../config/utils');var config=require(_0xae99('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xae99('0x14'))['db'];function respondWithStatusCode(_0x34b242,_0x3d8727){_0x3d8727=_0x3d8727||0xcc;return function(_0x4b4332){if(_0x4b4332){return _0x34b242['sendStatus'](_0x3d8727);}return _0x34b242['status'](_0x3d8727)[_0xae99('0x15')]();};}function respondWithResult(_0x572900,_0x137778){_0x137778=_0x137778||0xc8;return function(_0x11d8d7){if(_0x11d8d7){return _0x572900[_0xae99('0x16')](_0x137778)[_0xae99('0x17')](_0x11d8d7);}};}function respondWithFilteredResult(_0x146a77,_0x8c59dc){return function(_0x36199e){if(_0x36199e){var _0x3f3068=typeof _0x8c59dc[_0xae99('0x18')]==='undefined'&&typeof _0x8c59dc[_0xae99('0x19')]===_0xae99('0x1a');var _0x183dfb=_0x36199e[_0xae99('0x1b')];var _0x1e7f19=_0x3f3068?0x0:_0x8c59dc['offset'];var _0x29ddf9=_0x3f3068?_0x36199e[_0xae99('0x1b')]:_0x8c59dc[_0xae99('0x18')]+_0x8c59dc['limit'];var _0x2d80e5;if(_0x29ddf9>=_0x183dfb){_0x29ddf9=_0x183dfb;_0x2d80e5=0xc8;}else{_0x2d80e5=0xce;}_0x146a77[_0xae99('0x16')](_0x2d80e5);return _0x146a77['set'](_0xae99('0x1c'),_0x1e7f19+'-'+_0x29ddf9+'/'+_0x183dfb)[_0xae99('0x17')](_0x36199e);}return null;};}function patchUpdates(_0x495ad3){return function(_0x2b5811){try{jsonpatch['apply'](_0x2b5811,_0x495ad3,!![]);}catch(_0x596275){return BPromise['reject'](_0x596275);}return _0x2b5811['save']();};}function saveUpdates(_0xb041af,_0x31e7ac){return function(_0x5ba404){if(_0x5ba404){return _0x5ba404[_0xae99('0x1d')](_0xb041af)[_0xae99('0x1e')](function(_0x2ef1bd){return _0x2ef1bd;});}return null;};}function removeEntity(_0x40c08b,_0x584fb5){return function(_0x25df53){if(_0x25df53){return _0x25df53['destroy']()[_0xae99('0x1e')](function(){_0x40c08b[_0xae99('0x16')](0xcc)[_0xae99('0x15')]();});}};}function handleEntityNotFound(_0xb1766a,_0x2e0e9e){return function(_0x12c2f0){if(!_0x12c2f0){_0xb1766a[_0xae99('0x1f')](0x194);}return _0x12c2f0;};}function handleError(_0x36e80a,_0xbc79de){_0xbc79de=_0xbc79de||0x1f4;return function(_0x10986e){logger['error'](_0x10986e[_0xae99('0x20')]);if(_0x10986e[_0xae99('0x21')]){delete _0x10986e['name'];}_0x36e80a[_0xae99('0x16')](_0xbc79de)[_0xae99('0x22')](_0x10986e);};}exports[_0xae99('0x23')]=function(_0x121979,_0x4c9ca4){var _0x533550={},_0x35b1a1={},_0x5234fd={'count':0x0,'rows':[]};var _0x1c6991=_[_0xae99('0x24')](db[_0xae99('0x25')]['rawAttributes'],function(_0x4144e3){return{'name':_0x4144e3['fieldName'],'type':_0x4144e3['type'][_0xae99('0x26')]};});_0x35b1a1[_0xae99('0x27')]=_[_0xae99('0x24')](_0x1c6991,'name');_0x35b1a1[_0xae99('0x28')]=_['keys'](_0x121979['query']);_0x35b1a1['filters']=_[_0xae99('0x29')](_0x35b1a1[_0xae99('0x27')],_0x35b1a1[_0xae99('0x28')]);_0x533550['attributes']=_[_0xae99('0x29')](_0x35b1a1['model'],qs['fields'](_0x121979[_0xae99('0x28')][_0xae99('0x2a')]));_0x533550['attributes']=_0x533550['attributes'][_0xae99('0x2b')]?_0x533550[_0xae99('0x2c')]:_0x35b1a1[_0xae99('0x27')];if(!_0x121979[_0xae99('0x28')][_0xae99('0x2d')](_0xae99('0x2e'))){_0x533550[_0xae99('0x19')]=qs[_0xae99('0x19')](_0x121979['query'][_0xae99('0x19')]);_0x533550[_0xae99('0x18')]=qs['offset'](_0x121979[_0xae99('0x28')]['offset']);}_0x533550['order']=qs['sort'](_0x121979['query']['sort']);_0x533550['where']=qs[_0xae99('0x2f')](_[_0xae99('0x30')](_0x121979[_0xae99('0x28')],_0x35b1a1[_0xae99('0x2f')]),_0x1c6991);if(_0x121979[_0xae99('0x28')][_0xae99('0x31')]){_0x533550[_0xae99('0x32')]=_[_0xae99('0x33')](_0x533550['where'],{'$or':_[_0xae99('0x24')](_0x1c6991,function(_0x47fc14){if(_0x47fc14['type']!==_0xae99('0x34')){var _0x306b60={};_0x306b60[_0x47fc14[_0xae99('0x21')]]={'$like':'%'+_0x121979['query'][_0xae99('0x31')]+'%'};return _0x306b60;}})});}_0x533550=_[_0xae99('0x33')]({},_0x533550,_0x121979['options']);var _0x210666={'where':_0x533550['where']};return db[_0xae99('0x25')][_0xae99('0x1b')](_0x210666)[_0xae99('0x1e')](function(_0x217243){_0x5234fd['count']=_0x217243;if(_0x121979[_0xae99('0x28')][_0xae99('0x35')]){_0x533550[_0xae99('0x36')]=[{'all':!![]}];}return db[_0xae99('0x25')][_0xae99('0x37')](_0x533550);})[_0xae99('0x1e')](function(_0x345c09){_0x5234fd[_0xae99('0x38')]=_0x345c09;return _0x5234fd;})[_0xae99('0x1e')](respondWithFilteredResult(_0x4c9ca4,_0x533550))['catch'](handleError(_0x4c9ca4,null));};exports[_0xae99('0x39')]=function(_0x50c2bb,_0x2a83e0){var _0x30eed1={'raw':!![],'where':{'id':_0x50c2bb['params']['id']}},_0x2b017={};_0x2b017[_0xae99('0x27')]=_[_0xae99('0x3a')](db[_0xae99('0x25')]['rawAttributes']);_0x2b017[_0xae99('0x28')]=_['keys'](_0x50c2bb[_0xae99('0x28')]);_0x2b017[_0xae99('0x2f')]=_[_0xae99('0x29')](_0x2b017[_0xae99('0x27')],_0x2b017['query']);_0x30eed1[_0xae99('0x2c')]=_[_0xae99('0x29')](_0x2b017[_0xae99('0x27')],qs['fields'](_0x50c2bb[_0xae99('0x28')][_0xae99('0x2a')]));_0x30eed1[_0xae99('0x2c')]=_0x30eed1[_0xae99('0x2c')]['length']?_0x30eed1[_0xae99('0x2c')]:_0x2b017['model'];if(_0x50c2bb['query']['includeAll']){_0x30eed1[_0xae99('0x36')]=[{'all':!![]}];}_0x30eed1=_[_0xae99('0x33')]({},_0x30eed1,_0x50c2bb[_0xae99('0x3b')]);return db['SquareRecording'][_0xae99('0x3c')](_0x30eed1)[_0xae99('0x1e')](handleEntityNotFound(_0x2a83e0,null))[_0xae99('0x1e')](respondWithResult(_0x2a83e0,null))[_0xae99('0x3d')](handleError(_0x2a83e0,null));};exports['create']=function(_0x909c43,_0x2e4b07){return db[_0xae99('0x25')]['create'](_0x909c43[_0xae99('0x3e')],{})[_0xae99('0x1e')](respondWithResult(_0x2e4b07,0xc9))[_0xae99('0x3d')](handleError(_0x2e4b07,null));};exports[_0xae99('0x1d')]=function(_0x270537,_0x1aaa3b){if(_0x270537[_0xae99('0x3e')]['id']){delete _0x270537[_0xae99('0x3e')]['id'];}return db['SquareRecording'][_0xae99('0x3c')]({'where':{'id':_0x270537['params']['id']}})[_0xae99('0x1e')](handleEntityNotFound(_0x1aaa3b,null))[_0xae99('0x1e')](saveUpdates(_0x270537['body'],null))['then'](respondWithResult(_0x1aaa3b,null))[_0xae99('0x3d')](handleError(_0x1aaa3b,null));};exports['download']=function(_0x6d932e,_0x34a106,_0x1f7c5d){var _0x2db5b5=require(_0xae99('0x3f'));var _0x18230d=![];var _0x5b4cdc={};if(_0x6d932e[_0xae99('0x28')]['type']&&_0x6d932e[_0xae99('0x28')][_0xae99('0x40')]===_0xae99('0x41')){_0x5b4cdc['uniqueid']=_0x6d932e[_0xae99('0x42')]['id'];}else{_0x5b4cdc['id']=_0x6d932e[_0xae99('0x42')]['id'];}return db['SquareRecording'][_0xae99('0x3c')]({'where':_0x5b4cdc,'attributes':['id',_0xae99('0x43'),_0xae99('0x44')],'raw':!![]})[_0xae99('0x1e')](handleEntityNotFound(_0x34a106,null))['then'](function(_0x58df2e){if(_0x58df2e){var _0x5b8250=_0x58df2e[_0xae99('0x43')];var _0x317c65=util[_0xae99('0x45')](_0xae99('0x46'),_0x5b8250);if(fs[_0xae99('0x47')](_0x317c65)){_0x18230d=!![];return _0x2db5b5[_0xae99('0x48')](_0x317c65,_0x5b8250,config[_0xae99('0x49')]['recording'])[_0xae99('0x1e')](function(){return _0x58df2e;});}return _0x58df2e;}})[_0xae99('0x1e')](function(_0x29e83c){if(_0x29e83c){var _0x2d82b0=_0x29e83c['savePath'];if(!fs['existsSync'](_0x2d82b0)){throw new db[(_0xae99('0x4a'))][(_0xae99('0x4b'))](_0xae99('0x4c'));}if(_0x29e83c[_0xae99('0x44')]){return _0x34a106[_0xae99('0x4d')](_0x2d82b0,_0x29e83c[_0xae99('0x44')]+path[_0xae99('0x4e')](_0x2d82b0),function(){if(_0x18230d){fs['unlink'](_0x2d82b0);}});}else{return _0x34a106[_0xae99('0x4d')](_0x2d82b0,function(_0x20aa19){if(_0x18230d){fs[_0xae99('0x4f')](_0x2d82b0);}});}}})[_0xae99('0x3d')](function(_0x4907a2){if(_0x4907a2[_0xae99('0x50')]==='SquareRecording\x20not\x20found'){_0x34a106[_0xae99('0x16')](0x194)[_0xae99('0x22')](_0xae99('0x51'));}else{return handleError(_0x34a106,null);}});};exports['destroy']=function(_0x594e55,_0x17e088){return db['SquareRecording']['find']({'where':{'id':_0x594e55[_0xae99('0x42')]['id']}})[_0xae99('0x1e')](function(_0x3f37d8){if(_[_0xae99('0x52')](_0x3f37d8)){throw new ReferenceError(_0xae99('0x53'));}return _0x3f37d8;})[_0xae99('0x1e')](function(_0x5d6f2d){var _0x30901a=_0x5d6f2d[_0xae99('0x43')];logger[_0xae99('0x54')](_0xae99('0x55'),_0x30901a);if(!_[_0xae99('0x52')](_0x5d6f2d[_0xae99('0x43')])&&fs['existsSync'](_0x30901a)){logger[_0xae99('0x54')](_0xae99('0x56')+_0x30901a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x30901a);}_0x30901a=_0x30901a+_0xae99('0x57');if(!_[_0xae99('0x52')](_0x5d6f2d[_0xae99('0x43')])&&fs['existsSync'](_0x30901a)){logger[_0xae99('0x54')](_0xae99('0x56')+_0x30901a+_0xae99('0x58'));fs['unlinkSync'](_0x30901a);}return _0x5d6f2d;})[_0xae99('0x1e')](function(_0x1701d0){if(!_0x1701d0)throw new InternalError();return _0x1701d0[_0xae99('0x59')]();})['then'](function(){_0x17e088[_0xae99('0x16')](0xcc)[_0xae99('0x15')]();})[_0xae99('0x3d')](handleError(_0x17e088,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 580cd30..06a9fab 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 _0x9505=['request-promise','path','./squareRecording.attributes','exports','square_recordings','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9505,0x1e5));var _0x5950=function(_0x272b22,_0x421728){_0x272b22=_0x272b22-0x0;var _0x1b7b09=_0x9505[_0x272b22];return _0x1b7b09;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('SquareRecording',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['define','SquareRecording','util','../../config/logger','api','moment','bluebird','./squareRecording.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27a0,0xbf));var _0x027a=function(_0x432ff5,_0x4b03d1){_0x432ff5=_0x432ff5-0x0;var _0x38d145=_0x27a0[_0x432ff5];return _0x38d145;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index b88aa7a..60f59c7 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 _0xb735=['then','CreateSquareRecording','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','SquareRecording','create','body','options','raw'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb735,0x152));var _0x5b73=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xb735[_0x46428c];return _0x16a677;};'use strict';var _=require('lodash');var util=require(_0x5b73('0x0'));var moment=require(_0x5b73('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b73('0x2'));var fs=require('fs');var Redis=require(_0x5b73('0x3'));var db=require(_0x5b73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b73('0x5'))(_0x5b73('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b73('0x7'));var client=jayson[_0x5b73('0x8')][_0x5b73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45071e,_0x13887e,_0x48ca64){return new BPromise(function(_0x41ae6f,_0x469a29){return client[_0x5b73('0xa')](_0x45071e,_0x48ca64)['then'](function(_0x51c8a8){logger['info'](_0x5b73('0xb'),_0x13887e,'request\x20sent');logger[_0x5b73('0xc')](_0x5b73('0xd'),_0x13887e,_0x5b73('0xe'),JSON[_0x5b73('0xf')](_0x51c8a8));if(_0x51c8a8[_0x5b73('0x10')]){if(_0x51c8a8[_0x5b73('0x10')][_0x5b73('0x11')]===0x1f4){logger[_0x5b73('0x10')](_0x5b73('0xb'),_0x13887e,_0x51c8a8[_0x5b73('0x10')][_0x5b73('0x12')]);return _0x469a29(_0x51c8a8[_0x5b73('0x10')][_0x5b73('0x12')]);}logger[_0x5b73('0x10')](_0x5b73('0xb'),_0x13887e,_0x51c8a8[_0x5b73('0x10')][_0x5b73('0x12')]);return _0x41ae6f(_0x51c8a8[_0x5b73('0x10')]['message']);}else{logger[_0x5b73('0x13')](_0x5b73('0xb'),_0x13887e,'request\x20sent');_0x41ae6f(_0x51c8a8['result'][_0x5b73('0x12')]);}})[_0x5b73('0x14')](function(_0x35bb44){logger[_0x5b73('0x10')]('SquareRecording,\x20%s,\x20%s',_0x13887e,_0x35bb44);_0x469a29(_0x35bb44);});});}exports['CreateSquareRecording']=function(_0x2596f4){var _0x2f1451=this;return new Promise(function(_0x2e9981,_0x474c23){return db[_0x5b73('0x15')][_0x5b73('0x16')](_0x2596f4[_0x5b73('0x17')],{'raw':_0x2596f4['options']?_0x2596f4[_0x5b73('0x18')][_0x5b73('0x19')]===undefined?!![]:![]:!![]})[_0x5b73('0x1a')](function(_0x34b7b2){logger[_0x5b73('0x13')](_0x5b73('0x1b'),_0x2596f4);logger['debug'](_0x5b73('0x1b'),_0x2596f4,JSON[_0x5b73('0xf')](_0x34b7b2));_0x2e9981(_0x34b7b2);})[_0x5b73('0x14')](function(_0x995787){logger[_0x5b73('0x10')]('CreateSquareRecording',_0x995787['message'],_0x2596f4);_0x474c23(_0x2f1451[_0x5b73('0x10')](0x1f4,_0x995787[_0x5b73('0x12')]));});});}; \ No newline at end of file +var _0xe52f=['info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5efb3c,_0x852a5a){var _0x349be3=function(_0x44b9de){while(--_0x44b9de){_0x5efb3c['push'](_0x5efb3c['shift']());}};_0x349be3(++_0x852a5a);}(_0xe52f,0x16c));var _0xfe52=function(_0x1299b1,_0xd402d8){_0x1299b1=_0x1299b1-0x0;var _0x551943=_0xe52f[_0x1299b1];return _0x551943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe52('0x0'));var BPromise=require(_0xfe52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe52('0x2'));var db=require(_0xfe52('0x3'))['db'];var utils=require(_0xfe52('0x4'));var logger=require(_0xfe52('0x5'))(_0xfe52('0x6'));var config=require(_0xfe52('0x7'));var jayson=require(_0xfe52('0x8'));var client=jayson[_0xfe52('0x9')][_0xfe52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc71f4,_0x19e89b,_0x26436a){return new BPromise(function(_0x18dd0d,_0x2f560b){return client[_0xfe52('0xb')](_0xfc71f4,_0x26436a)[_0xfe52('0xc')](function(_0x1771e8){logger[_0xfe52('0xd')](_0xfe52('0xe'),_0x19e89b,_0xfe52('0xf'));logger[_0xfe52('0x10')](_0xfe52('0x11'),_0x19e89b,_0xfe52('0xf'),JSON[_0xfe52('0x12')](_0x1771e8));if(_0x1771e8[_0xfe52('0x13')]){if(_0x1771e8['error'][_0xfe52('0x14')]===0x1f4){logger[_0xfe52('0x13')](_0xfe52('0xe'),_0x19e89b,_0x1771e8[_0xfe52('0x13')][_0xfe52('0x15')]);return _0x2f560b(_0x1771e8[_0xfe52('0x13')][_0xfe52('0x15')]);}logger['error'](_0xfe52('0xe'),_0x19e89b,_0x1771e8[_0xfe52('0x13')][_0xfe52('0x15')]);return _0x18dd0d(_0x1771e8[_0xfe52('0x13')][_0xfe52('0x15')]);}else{logger['info'](_0xfe52('0xe'),_0x19e89b,_0xfe52('0xf'));_0x18dd0d(_0x1771e8['result']['message']);}})[_0xfe52('0x16')](function(_0x5a8cfc){logger['error'](_0xfe52('0xe'),_0x19e89b,_0x5a8cfc);_0x2f560b(_0x5a8cfc);});});}exports[_0xfe52('0x17')]=function(_0x568b56){var _0x18ffcd=this;return new Promise(function(_0x1f4d43,_0x62ab95){return db[_0xfe52('0x18')][_0xfe52('0x19')](_0x568b56[_0xfe52('0x1a')],{'raw':_0x568b56[_0xfe52('0x1b')]?_0x568b56[_0xfe52('0x1b')][_0xfe52('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x40bfea){logger[_0xfe52('0xd')](_0xfe52('0x17'),_0x568b56);logger['debug'](_0xfe52('0x17'),_0x568b56,JSON['stringify'](_0x40bfea));_0x1f4d43(_0x40bfea);})[_0xfe52('0x16')](function(_0x14524b){logger[_0xfe52('0x13')]('CreateSquareRecording',_0x14524b[_0xfe52('0x15')],_0x568b56);_0x62ab95(_0x18ffcd[_0xfe52('0x13')](0x1f4,_0x14524b[_0xfe52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b993dd4..2ba26fd 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b4cf9,_0xed22d){var _0x33041c=function(_0x18c45d){while(--_0x18c45d){_0x2b4cf9['push'](_0x2b4cf9['shift']());}};_0x33041c(++_0xed22d);}(_0xb10b,0x12a));var _0xbb10=function(_0x101383,_0x5bd543){_0x101383=_0x101383-0x0;var _0x46cfe9=_0xb10b[_0x101383];return _0x46cfe9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x366f15,_0x2150d8){var _0x1eee34=function(_0x3c0ae1){while(--_0x3c0ae1){_0x366f15['push'](_0x366f15['shift']());}};_0x1eee34(++_0x2150d8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 9110568..385f770 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 _0xfef9=['exports','STRING','DATE','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfef9,0x9f));var _0x9fef=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0xfef9[_0x121350];return _0x2e21c7;};'use strict';var Sequelize=require(_0x9fef('0x0'));module[_0x9fef('0x1')]={'network':{'type':Sequelize[_0x9fef('0x2')]},'network_script':{'type':Sequelize[_0x9fef('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9fef('0x2')]},'language':{'type':Sequelize[_0x9fef('0x2')]},'type':{'type':Sequelize[_0x9fef('0x2')]},'uniqueid':{'type':Sequelize[_0x9fef('0x2')]},'version':{'type':Sequelize[_0x9fef('0x2')]},'callerid':{'type':Sequelize[_0x9fef('0x2')]},'calleridname':{'type':Sequelize[_0x9fef('0x2')]},'callingpres':{'type':Sequelize[_0x9fef('0x2')]},'callingani2':{'type':Sequelize[_0x9fef('0x2')]},'callington':{'type':Sequelize[_0x9fef('0x2')]},'callingtns':{'type':Sequelize[_0x9fef('0x2')]},'dnid':{'type':Sequelize[_0x9fef('0x2')]},'rdnis':{'type':Sequelize[_0x9fef('0x2')]},'context':{'type':Sequelize[_0x9fef('0x2')]},'extension':{'type':Sequelize[_0x9fef('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9fef('0x2')]},'accountcode':{'type':Sequelize[_0x9fef('0x2')]},'threadid':{'type':Sequelize[_0x9fef('0x2')]},'project_name':{'type':Sequelize[_0x9fef('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9fef('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x011a=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x42b9be,_0x33357d){var _0x4ff1ab=function(_0x5c2fde){while(--_0x5c2fde){_0x42b9be['push'](_0x42b9be['shift']());}};_0x4ff1ab(++_0x33357d);}(_0x011a,0x16d));var _0xa011=function(_0x1a2973,_0x1c87f2){_0x1a2973=_0x1a2973-0x0;var _0x318b2e=_0x011a[_0x1a2973];return _0x318b2e;};'use strict';var Sequelize=require(_0xa011('0x0'));module[_0xa011('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa011('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa011('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa011('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa011('0x2')]},'calleridname':{'type':Sequelize[_0xa011('0x2')]},'callingpres':{'type':Sequelize[_0xa011('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa011('0x2')]},'dnid':{'type':Sequelize[_0xa011('0x2')]},'rdnis':{'type':Sequelize[_0xa011('0x2')]},'context':{'type':Sequelize[_0xa011('0x2')]},'extension':{'type':Sequelize[_0xa011('0x2')]},'priority':{'type':Sequelize[_0xa011('0x2')]},'enhanced':{'type':Sequelize[_0xa011('0x2')]},'accountcode':{'type':Sequelize[_0xa011('0x2')]},'threadid':{'type':Sequelize[_0xa011('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa011('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xa011('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 4abbd0a..d4fb94e 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 _0xef36=['rows','params','length','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x3e8426,_0x49a842){var _0x874e2e=function(_0x3b3699){while(--_0x3b3699){_0x3e8426['push'](_0x3e8426['shift']());}};_0x874e2e(++_0x49a842);}(_0xef36,0x134));var _0x6ef3=function(_0x45cab8,_0x1e77f1){_0x45cab8=_0x45cab8-0x0;var _0x2252c5=_0xef36[_0x45cab8];return _0x2252c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ef3('0x0'));var zipdir=require(_0x6ef3('0x1'));var jsonpatch=require(_0x6ef3('0x2'));var rp=require(_0x6ef3('0x3'));var moment=require(_0x6ef3('0x4'));var BPromise=require(_0x6ef3('0x5'));var Mustache=require('mustache');var util=require(_0x6ef3('0x6'));var path=require('path');var sox=require(_0x6ef3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ef3('0x8'));var _=require(_0x6ef3('0x9'));var squel=require(_0x6ef3('0xa'));var crypto=require(_0x6ef3('0xb'));var jsforce=require(_0x6ef3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ef3('0xd'));var querystring=require(_0x6ef3('0xe'));var Papa=require(_0x6ef3('0xf'));var Redis=require('ioredis');var authService=require(_0x6ef3('0x10'));var qs=require(_0x6ef3('0x11'));var as=require(_0x6ef3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef3('0x13'))(_0x6ef3('0x14'));var utils=require(_0x6ef3('0x15'));var config=require(_0x6ef3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ef3('0x17'))['db'];function respondWithStatusCode(_0x1cd6e6,_0x332b60){_0x332b60=_0x332b60||0xcc;return function(_0x56ce39){if(_0x56ce39){return _0x1cd6e6[_0x6ef3('0x18')](_0x332b60);}return _0x1cd6e6[_0x6ef3('0x19')](_0x332b60)[_0x6ef3('0x1a')]();};}function respondWithResult(_0xe5b390,_0x490372){_0x490372=_0x490372||0xc8;return function(_0x3316c2){if(_0x3316c2){return _0xe5b390[_0x6ef3('0x19')](_0x490372)['json'](_0x3316c2);}};}function respondWithFilteredResult(_0x161189,_0x5457ae){return function(_0x19453d){if(_0x19453d){var _0x55e10d=typeof _0x5457ae[_0x6ef3('0x1b')]===_0x6ef3('0x1c')&&typeof _0x5457ae['limit']==='undefined';var _0x23ab78=_0x19453d[_0x6ef3('0x1d')];var _0x36c99c=_0x55e10d?0x0:_0x5457ae[_0x6ef3('0x1b')];var _0x49e0c9=_0x55e10d?_0x19453d[_0x6ef3('0x1d')]:_0x5457ae[_0x6ef3('0x1b')]+_0x5457ae[_0x6ef3('0x1e')];var _0x2d50d2;if(_0x49e0c9>=_0x23ab78){_0x49e0c9=_0x23ab78;_0x2d50d2=0xc8;}else{_0x2d50d2=0xce;}_0x161189['status'](_0x2d50d2);return _0x161189[_0x6ef3('0x1f')](_0x6ef3('0x20'),_0x36c99c+'-'+_0x49e0c9+'/'+_0x23ab78)[_0x6ef3('0x21')](_0x19453d);}return null;};}function patchUpdates(_0x1f3d2b){return function(_0x1f51ee){try{jsonpatch['apply'](_0x1f51ee,_0x1f3d2b,!![]);}catch(_0x5ad0c4){return BPromise[_0x6ef3('0x22')](_0x5ad0c4);}return _0x1f51ee[_0x6ef3('0x23')]();};}function saveUpdates(_0x2c97e7,_0x17af19){return function(_0x226a20){if(_0x226a20){return _0x226a20[_0x6ef3('0x24')](_0x2c97e7)['then'](function(_0x59abd8){return _0x59abd8;});}return null;};}function removeEntity(_0x646a5d,_0x5139ff){return function(_0x4fea8b){if(_0x4fea8b){return _0x4fea8b['destroy']()[_0x6ef3('0x25')](function(){_0x646a5d[_0x6ef3('0x19')](0xcc)[_0x6ef3('0x1a')]();});}};}function handleEntityNotFound(_0x1c4afc,_0x43beb6){return function(_0x2b8fc8){if(!_0x2b8fc8){_0x1c4afc[_0x6ef3('0x18')](0x194);}return _0x2b8fc8;};}function handleError(_0x1db330,_0x1d46b4){_0x1d46b4=_0x1d46b4||0x1f4;return function(_0x4cbb9c){logger[_0x6ef3('0x26')](_0x4cbb9c[_0x6ef3('0x27')]);if(_0x4cbb9c[_0x6ef3('0x28')]){delete _0x4cbb9c[_0x6ef3('0x28')];}_0x1db330[_0x6ef3('0x19')](_0x1d46b4)[_0x6ef3('0x29')](_0x4cbb9c);};}exports[_0x6ef3('0x2a')]=function(_0x5d87ab,_0x5b0002){var _0x5c1a25={},_0x433d90={},_0x26d5ca={'count':0x0,'rows':[]};var _0x43ef20=_[_0x6ef3('0x2b')](db[_0x6ef3('0x2c')][_0x6ef3('0x2d')],function(_0xabf60b){return{'name':_0xabf60b[_0x6ef3('0x2e')],'type':_0xabf60b[_0x6ef3('0x2f')][_0x6ef3('0x30')]};});_0x433d90[_0x6ef3('0x31')]=_[_0x6ef3('0x2b')](_0x43ef20,_0x6ef3('0x28'));_0x433d90['query']=_[_0x6ef3('0x32')](_0x5d87ab['query']);_0x433d90[_0x6ef3('0x33')]=_['intersection'](_0x433d90['model'],_0x433d90[_0x6ef3('0x34')]);_0x5c1a25[_0x6ef3('0x35')]=_[_0x6ef3('0x36')](_0x433d90[_0x6ef3('0x31')],qs[_0x6ef3('0x37')](_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x37')]));_0x5c1a25['attributes']=_0x5c1a25[_0x6ef3('0x35')]['length']?_0x5c1a25[_0x6ef3('0x35')]:_0x433d90[_0x6ef3('0x31')];if(!_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x38')]('nolimit')){_0x5c1a25['limit']=qs[_0x6ef3('0x1e')](_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x1e')]);_0x5c1a25[_0x6ef3('0x1b')]=qs[_0x6ef3('0x1b')](_0x5d87ab['query'][_0x6ef3('0x1b')]);}_0x5c1a25[_0x6ef3('0x39')]=qs[_0x6ef3('0x3a')](_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x3a')]);_0x5c1a25[_0x6ef3('0x3b')]=qs[_0x6ef3('0x33')](_[_0x6ef3('0x3c')](_0x5d87ab[_0x6ef3('0x34')],_0x433d90[_0x6ef3('0x33')]),_0x43ef20);if(_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x3d')]){_0x5c1a25[_0x6ef3('0x3b')]=_['merge'](_0x5c1a25[_0x6ef3('0x3b')],{'$or':_['map'](_0x43ef20,function(_0x5132ca){if(_0x5132ca['type']!==_0x6ef3('0x3e')){var _0x49d0e3={};_0x49d0e3[_0x5132ca[_0x6ef3('0x28')]]={'$like':'%'+_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x3d')]+'%'};return _0x49d0e3;}})});}_0x5c1a25=_[_0x6ef3('0x3f')]({},_0x5c1a25,_0x5d87ab[_0x6ef3('0x40')]);var _0x4eac86={'where':_0x5c1a25[_0x6ef3('0x3b')]};return db['SquareReport'][_0x6ef3('0x1d')](_0x4eac86)[_0x6ef3('0x25')](function(_0x2554d5){_0x26d5ca[_0x6ef3('0x1d')]=_0x2554d5;if(_0x5d87ab[_0x6ef3('0x34')][_0x6ef3('0x41')]){_0x5c1a25[_0x6ef3('0x42')]=[{'all':!![]}];}return db[_0x6ef3('0x2c')]['findAll'](_0x5c1a25);})['then'](function(_0x582d97){_0x26d5ca[_0x6ef3('0x43')]=_0x582d97;return _0x26d5ca;})[_0x6ef3('0x25')](respondWithFilteredResult(_0x5b0002,_0x5c1a25))['catch'](handleError(_0x5b0002,null));};exports['show']=function(_0x31333a,_0x418840){var _0x10a751={'raw':!![],'where':{'id':_0x31333a[_0x6ef3('0x44')]['id']}},_0x244be6={};_0x244be6['model']=_['keys'](db['SquareReport'][_0x6ef3('0x2d')]);_0x244be6[_0x6ef3('0x34')]=_['keys'](_0x31333a['query']);_0x244be6[_0x6ef3('0x33')]=_[_0x6ef3('0x36')](_0x244be6[_0x6ef3('0x31')],_0x244be6[_0x6ef3('0x34')]);_0x10a751[_0x6ef3('0x35')]=_[_0x6ef3('0x36')](_0x244be6[_0x6ef3('0x31')],qs[_0x6ef3('0x37')](_0x31333a[_0x6ef3('0x34')]['fields']));_0x10a751[_0x6ef3('0x35')]=_0x10a751['attributes'][_0x6ef3('0x45')]?_0x10a751[_0x6ef3('0x35')]:_0x244be6['model'];if(_0x31333a[_0x6ef3('0x34')][_0x6ef3('0x41')]){_0x10a751['include']=[{'all':!![]}];}_0x10a751=_[_0x6ef3('0x3f')]({},_0x10a751,_0x31333a[_0x6ef3('0x40')]);return db[_0x6ef3('0x2c')][_0x6ef3('0x46')](_0x10a751)[_0x6ef3('0x25')](handleEntityNotFound(_0x418840,null))['then'](respondWithResult(_0x418840,null))[_0x6ef3('0x47')](handleError(_0x418840,null));};exports[_0x6ef3('0x48')]=function(_0x22fe52,_0x2a3637){return db['SquareReport'][_0x6ef3('0x48')](_0x22fe52[_0x6ef3('0x49')],{})['then'](respondWithResult(_0x2a3637,0xc9))[_0x6ef3('0x47')](handleError(_0x2a3637,null));};exports[_0x6ef3('0x24')]=function(_0x47777b,_0x147d94){if(_0x47777b[_0x6ef3('0x49')]['id']){delete _0x47777b[_0x6ef3('0x49')]['id'];}return db[_0x6ef3('0x2c')]['find']({'where':{'id':_0x47777b[_0x6ef3('0x44')]['id']}})[_0x6ef3('0x25')](handleEntityNotFound(_0x147d94,null))[_0x6ef3('0x25')](saveUpdates(_0x47777b[_0x6ef3('0x49')],null))['then'](respondWithResult(_0x147d94,null))[_0x6ef3('0x47')](handleError(_0x147d94,null));};exports['destroy']=function(_0x3c4d86,_0x149785){return db[_0x6ef3('0x2c')][_0x6ef3('0x46')]({'where':{'id':_0x3c4d86[_0x6ef3('0x44')]['id']}})[_0x6ef3('0x25')](handleEntityNotFound(_0x149785,null))['then'](removeEntity(_0x149785,null))[_0x6ef3('0x47')](handleError(_0x149785,null));};exports[_0x6ef3('0x4a')]=function(_0x2b553c,_0x18ccd4){return db[_0x6ef3('0x2c')]['describe']()[_0x6ef3('0x25')](respondWithResult(_0x18ccd4,null))[_0x6ef3('0x47')](handleError(_0x18ccd4,null));}; \ No newline at end of file +var _0x413f=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','SquareReport','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','body','describe','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x32083f,_0x3bc091){var _0x34dfa3=function(_0x597e94){while(--_0x597e94){_0x32083f['push'](_0x32083f['shift']());}};_0x34dfa3(++_0x3bc091);}(_0x413f,0x1bc));var _0xf413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x413f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf413('0x0'));var zipdir=require(_0xf413('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf413('0x2'));var BPromise=require(_0xf413('0x3'));var Mustache=require('mustache');var util=require(_0xf413('0x4'));var path=require(_0xf413('0x5'));var sox=require(_0xf413('0x6'));var csv=require(_0xf413('0x7'));var ejs=require(_0xf413('0x8'));var fs=require('fs');var fs_extra=require(_0xf413('0x9'));var _=require(_0xf413('0xa'));var squel=require(_0xf413('0xb'));var crypto=require(_0xf413('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf413('0xd'));var toCsv=require(_0xf413('0x7'));var querystring=require(_0xf413('0xe'));var Papa=require(_0xf413('0xf'));var Redis=require(_0xf413('0x10'));var authService=require(_0xf413('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf413('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf413('0x13'))(_0xf413('0x14'));var utils=require(_0xf413('0x15'));var config=require(_0xf413('0x16'));var licenseUtil=require(_0xf413('0x17'));var db=require(_0xf413('0x18'))['db'];function respondWithStatusCode(_0x2b0788,_0x22b5c7){_0x22b5c7=_0x22b5c7||0xcc;return function(_0xec8e8c){if(_0xec8e8c){return _0x2b0788[_0xf413('0x19')](_0x22b5c7);}return _0x2b0788[_0xf413('0x1a')](_0x22b5c7)[_0xf413('0x1b')]();};}function respondWithResult(_0x4f10c4,_0x3f8efe){_0x3f8efe=_0x3f8efe||0xc8;return function(_0x1e201e){if(_0x1e201e){return _0x4f10c4[_0xf413('0x1a')](_0x3f8efe)['json'](_0x1e201e);}};}function respondWithFilteredResult(_0x5afbcd,_0x321023){return function(_0x104463){if(_0x104463){var _0x56fc9d=typeof _0x321023[_0xf413('0x1c')]===_0xf413('0x1d')&&typeof _0x321023['limit']===_0xf413('0x1d');var _0x47b8df=_0x104463[_0xf413('0x1e')];var _0x4a6aa7=_0x56fc9d?0x0:_0x321023['offset'];var _0x477cf3=_0x56fc9d?_0x104463['count']:_0x321023['offset']+_0x321023[_0xf413('0x1f')];var _0x2ae8c5;if(_0x477cf3>=_0x47b8df){_0x477cf3=_0x47b8df;_0x2ae8c5=0xc8;}else{_0x2ae8c5=0xce;}_0x5afbcd['status'](_0x2ae8c5);return _0x5afbcd['set'](_0xf413('0x20'),_0x4a6aa7+'-'+_0x477cf3+'/'+_0x47b8df)[_0xf413('0x21')](_0x104463);}return null;};}function patchUpdates(_0x18b823){return function(_0x2e328e){try{jsonpatch[_0xf413('0x22')](_0x2e328e,_0x18b823,!![]);}catch(_0xf8e8ef){return BPromise[_0xf413('0x23')](_0xf8e8ef);}return _0x2e328e['save']();};}function saveUpdates(_0x406f3f,_0x288a1d){return function(_0x33c21a){if(_0x33c21a){return _0x33c21a['update'](_0x406f3f)[_0xf413('0x24')](function(_0x19e87f){return _0x19e87f;});}return null;};}function removeEntity(_0x313d29,_0x16ad0b){return function(_0x33570e){if(_0x33570e){return _0x33570e[_0xf413('0x25')]()[_0xf413('0x24')](function(){_0x313d29[_0xf413('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5147b3,_0xd5fdb8){return function(_0x3ad77d){if(!_0x3ad77d){_0x5147b3[_0xf413('0x19')](0x194);}return _0x3ad77d;};}function handleError(_0x5ab40f,_0x28b64a){_0x28b64a=_0x28b64a||0x1f4;return function(_0x3633e8){logger[_0xf413('0x26')](_0x3633e8[_0xf413('0x27')]);if(_0x3633e8[_0xf413('0x28')]){delete _0x3633e8[_0xf413('0x28')];}_0x5ab40f[_0xf413('0x1a')](_0x28b64a)['send'](_0x3633e8);};}exports[_0xf413('0x29')]=function(_0x5ade52,_0x82bf99){var _0x475eee={},_0x2b6d6e={},_0x575b43={'count':0x0,'rows':[]};var _0x33c947=_[_0xf413('0x2a')](db[_0xf413('0x2b')]['rawAttributes'],function(_0x31e4ea){return{'name':_0x31e4ea[_0xf413('0x2c')],'type':_0x31e4ea[_0xf413('0x2d')]['key']};});_0x2b6d6e['model']=_[_0xf413('0x2a')](_0x33c947,_0xf413('0x28'));_0x2b6d6e[_0xf413('0x2e')]=_[_0xf413('0x2f')](_0x5ade52['query']);_0x2b6d6e[_0xf413('0x30')]=_['intersection'](_0x2b6d6e[_0xf413('0x31')],_0x2b6d6e['query']);_0x475eee[_0xf413('0x32')]=_[_0xf413('0x33')](_0x2b6d6e[_0xf413('0x31')],qs[_0xf413('0x34')](_0x5ade52['query']['fields']));_0x475eee[_0xf413('0x32')]=_0x475eee['attributes'][_0xf413('0x35')]?_0x475eee[_0xf413('0x32')]:_0x2b6d6e[_0xf413('0x31')];if(!_0x5ade52[_0xf413('0x2e')][_0xf413('0x36')](_0xf413('0x37'))){_0x475eee[_0xf413('0x1f')]=qs['limit'](_0x5ade52['query'][_0xf413('0x1f')]);_0x475eee[_0xf413('0x1c')]=qs[_0xf413('0x1c')](_0x5ade52[_0xf413('0x2e')][_0xf413('0x1c')]);}_0x475eee[_0xf413('0x38')]=qs['sort'](_0x5ade52[_0xf413('0x2e')][_0xf413('0x39')]);_0x475eee['where']=qs[_0xf413('0x30')](_[_0xf413('0x3a')](_0x5ade52['query'],_0x2b6d6e[_0xf413('0x30')]),_0x33c947);if(_0x5ade52['query']['filter']){_0x475eee[_0xf413('0x3b')]=_[_0xf413('0x3c')](_0x475eee['where'],{'$or':_[_0xf413('0x2a')](_0x33c947,function(_0x4fdb31){if(_0x4fdb31['type']!==_0xf413('0x3d')){var _0x2297e5={};_0x2297e5[_0x4fdb31[_0xf413('0x28')]]={'$like':'%'+_0x5ade52[_0xf413('0x2e')][_0xf413('0x3e')]+'%'};return _0x2297e5;}})});}_0x475eee=_['merge']({},_0x475eee,_0x5ade52['options']);var _0x222803={'where':_0x475eee[_0xf413('0x3b')]};return db[_0xf413('0x2b')][_0xf413('0x1e')](_0x222803)[_0xf413('0x24')](function(_0x13df4c){_0x575b43['count']=_0x13df4c;if(_0x5ade52[_0xf413('0x2e')][_0xf413('0x3f')]){_0x475eee[_0xf413('0x40')]=[{'all':!![]}];}return db[_0xf413('0x2b')][_0xf413('0x41')](_0x475eee);})['then'](function(_0xc0204d){_0x575b43[_0xf413('0x42')]=_0xc0204d;return _0x575b43;})['then'](respondWithFilteredResult(_0x82bf99,_0x475eee))['catch'](handleError(_0x82bf99,null));};exports[_0xf413('0x43')]=function(_0xd4ebdc,_0x15dbe0){var _0x2184b5={'raw':!![],'where':{'id':_0xd4ebdc['params']['id']}},_0x111dc9={};_0x111dc9[_0xf413('0x31')]=_['keys'](db[_0xf413('0x2b')][_0xf413('0x44')]);_0x111dc9[_0xf413('0x2e')]=_[_0xf413('0x2f')](_0xd4ebdc[_0xf413('0x2e')]);_0x111dc9[_0xf413('0x30')]=_[_0xf413('0x33')](_0x111dc9['model'],_0x111dc9[_0xf413('0x2e')]);_0x2184b5[_0xf413('0x32')]=_['intersection'](_0x111dc9[_0xf413('0x31')],qs[_0xf413('0x34')](_0xd4ebdc[_0xf413('0x2e')][_0xf413('0x34')]));_0x2184b5[_0xf413('0x32')]=_0x2184b5['attributes'][_0xf413('0x35')]?_0x2184b5[_0xf413('0x32')]:_0x111dc9['model'];if(_0xd4ebdc[_0xf413('0x2e')][_0xf413('0x3f')]){_0x2184b5['include']=[{'all':!![]}];}_0x2184b5=_[_0xf413('0x3c')]({},_0x2184b5,_0xd4ebdc[_0xf413('0x45')]);return db[_0xf413('0x2b')][_0xf413('0x46')](_0x2184b5)['then'](handleEntityNotFound(_0x15dbe0,null))['then'](respondWithResult(_0x15dbe0,null))[_0xf413('0x47')](handleError(_0x15dbe0,null));};exports[_0xf413('0x48')]=function(_0x41fcb0,_0x4611b0){return db[_0xf413('0x2b')][_0xf413('0x48')](_0x41fcb0[_0xf413('0x49')],{})[_0xf413('0x24')](respondWithResult(_0x4611b0,0xc9))[_0xf413('0x47')](handleError(_0x4611b0,null));};exports['update']=function(_0xcb53c3,_0x536a3c){if(_0xcb53c3[_0xf413('0x49')]['id']){delete _0xcb53c3['body']['id'];}return db[_0xf413('0x2b')][_0xf413('0x46')]({'where':{'id':_0xcb53c3['params']['id']}})[_0xf413('0x24')](handleEntityNotFound(_0x536a3c,null))['then'](saveUpdates(_0xcb53c3[_0xf413('0x49')],null))[_0xf413('0x24')](respondWithResult(_0x536a3c,null))[_0xf413('0x47')](handleError(_0x536a3c,null));};exports[_0xf413('0x25')]=function(_0x223519,_0x469ef0){return db[_0xf413('0x2b')][_0xf413('0x46')]({'where':{'id':_0x223519['params']['id']}})[_0xf413('0x24')](handleEntityNotFound(_0x469ef0,null))[_0xf413('0x24')](removeEntity(_0x469ef0,null))[_0xf413('0x47')](handleError(_0x469ef0,null));};exports[_0xf413('0x4a')]=function(_0x471fd1,_0x2d9218){return db[_0xf413('0x2b')][_0xf413('0x4a')]()['then'](respondWithResult(_0x2d9218,null))['catch'](handleError(_0x2d9218,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b2845f9..c6ed7d9 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 _0xa439=['leaveAt','../../config/logger','api','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x266b26,_0x5722b2){var _0x3e0c64=function(_0x324639){while(--_0x324639){_0x266b26['push'](_0x266b26['shift']());}};_0x3e0c64(++_0x5722b2);}(_0xa439,0x12c));var _0x9a43=function(_0x19b194,_0x553344){_0x19b194=_0x19b194-0x0;var _0x137542=_0xa439[_0x19b194];return _0x137542;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9a43('0x0'))(_0x9a43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a43('0x2'));var fs=require('fs');var path=require(_0x9a43('0x3'));var rimraf=require(_0x9a43('0x4'));var config=require('../../config/environment');var attributes=require(_0x9a43('0x5'));module[_0x9a43('0x6')]=function(_0x737030,_0x40dc3e){return _0x737030['define'](_0x9a43('0x7'),attributes,{'tableName':_0x9a43('0x8'),'paranoid':![],'indexes':[{'name':_0x9a43('0x9'),'fields':[_0x9a43('0xa'),_0x9a43('0xb')]},{'name':_0x9a43('0xc'),'fields':[_0x9a43('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aab=['uid_pname','leaveAt','lodash','util','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','SquareReport','report_square'];(function(_0x1ce3c3,_0x49f216){var _0x11ce12=function(_0x1d545c){while(--_0x1d545c){_0x1ce3c3['push'](_0x1ce3c3['shift']());}};_0x11ce12(++_0x49f216);}(_0x4aab,0x16a));var _0xb4aa=function(_0x4495aa,_0xc50ef9){_0x4495aa=_0x4495aa-0x0;var _0x5cf708=_0x4aab[_0x4495aa];return _0x5cf708;};'use strict';var _=require(_0xb4aa('0x0'));var util=require(_0xb4aa('0x1'));var logger=require('../../config/logger')(_0xb4aa('0x2'));var moment=require('moment');var BPromise=require(_0xb4aa('0x3'));var rp=require(_0xb4aa('0x4'));var fs=require('fs');var path=require(_0xb4aa('0x5'));var rimraf=require(_0xb4aa('0x6'));var config=require('../../config/environment');var attributes=require(_0xb4aa('0x7'));module['exports']=function(_0x15a540,_0x55cd88){return _0x15a540['define'](_0xb4aa('0x8'),attributes,{'tableName':_0xb4aa('0x9'),'paranoid':![],'indexes':[{'name':_0xb4aa('0xa'),'fields':['uniqueid','project_name']},{'name':_0xb4aa('0xb'),'fields':[_0xb4aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 2b0c48a..ae91b8e 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 _0x43d1=['SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareReport'];(function(_0x57969d,_0x1c1dce){var _0x59958e=function(_0x4d3c7f){while(--_0x4d3c7f){_0x57969d['push'](_0x57969d['shift']());}};_0x59958e(++_0x1c1dce);}(_0x43d1,0xe2));var _0x143d=function(_0x1333bb,_0x5385fa){_0x1333bb=_0x1333bb-0x0;var _0x4f7219=_0x43d1[_0x1333bb];return _0x4f7219;};'use strict';var _=require(_0x143d('0x0'));var util=require(_0x143d('0x1'));var moment=require(_0x143d('0x2'));var BPromise=require(_0x143d('0x3'));var rs=require(_0x143d('0x4'));var fs=require('fs');var Redis=require(_0x143d('0x5'));var db=require(_0x143d('0x6'))['db'];var utils=require(_0x143d('0x7'));var logger=require('../../config/logger')(_0x143d('0x8'));var config=require(_0x143d('0x9'));var jayson=require(_0x143d('0xa'));var client=jayson[_0x143d('0xb')][_0x143d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11e74f,_0xebcc76,_0x2be470){return new BPromise(function(_0x4110ed,_0x2b8dca){return client[_0x143d('0xd')](_0x11e74f,_0x2be470)[_0x143d('0xe')](function(_0x51702e){logger['info'](_0x143d('0xf'),_0xebcc76,_0x143d('0x10'));logger[_0x143d('0x11')](_0x143d('0x12'),_0xebcc76,_0x143d('0x10'),JSON[_0x143d('0x13')](_0x51702e));if(_0x51702e['error']){if(_0x51702e[_0x143d('0x14')][_0x143d('0x15')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0xebcc76,_0x51702e[_0x143d('0x14')][_0x143d('0x16')]);return _0x2b8dca(_0x51702e[_0x143d('0x14')][_0x143d('0x16')]);}logger['error'](_0x143d('0xf'),_0xebcc76,_0x51702e['error']['message']);return _0x4110ed(_0x51702e[_0x143d('0x14')]['message']);}else{logger[_0x143d('0x17')](_0x143d('0xf'),_0xebcc76,'request\x20sent');_0x4110ed(_0x51702e[_0x143d('0x18')][_0x143d('0x16')]);}})['catch'](function(_0x1f6995){logger[_0x143d('0x14')](_0x143d('0xf'),_0xebcc76,_0x1f6995);_0x2b8dca(_0x1f6995);});});}exports[_0x143d('0x19')]=function(_0x51aca6){var _0x2d165c=this;return new Promise(function(_0x14fd03,_0x2fbd11){return db[_0x143d('0x1a')][_0x143d('0x1b')](_0x51aca6[_0x143d('0x1c')],{'raw':_0x51aca6['options']?_0x51aca6[_0x143d('0x1d')][_0x143d('0x1e')]===undefined?!![]:![]:!![]})[_0x143d('0xe')](function(_0x481f61){logger[_0x143d('0x17')](_0x143d('0x19'),_0x51aca6);logger['debug'](_0x143d('0x19'),_0x51aca6,JSON[_0x143d('0x13')](_0x481f61));_0x14fd03(_0x481f61);})[_0x143d('0x1f')](function(_0x16a5c6){logger[_0x143d('0x14')]('CreateSquareReport',_0x16a5c6[_0x143d('0x16')],_0x51aca6);_0x2fbd11(_0x2d165c['error'](0x1f4,_0x16a5c6[_0x143d('0x16')]));});});};exports[_0x143d('0x20')]=function(_0x120fed){var _0x11be52=this;return new Promise(function(_0x533afb,_0x1a2b90){return db[_0x143d('0x1a')][_0x143d('0x21')](_0x120fed[_0x143d('0x1c')],{'raw':_0x120fed['options']?_0x120fed[_0x143d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x120fed[_0x143d('0x1d')]?_0x120fed[_0x143d('0x1d')][_0x143d('0x22')]||null:null,'attributes':_0x120fed['options']?_0x120fed[_0x143d('0x1d')][_0x143d('0x23')]||null:null,'limit':_0x120fed[_0x143d('0x1d')]?_0x120fed[_0x143d('0x1d')]['limit']||null:null})[_0x143d('0xe')](function(_0xfbadce){logger['info'](_0x143d('0x20'),_0x120fed);logger[_0x143d('0x11')](_0x143d('0x20'),_0x120fed,JSON[_0x143d('0x13')](_0xfbadce));_0x533afb(_0xfbadce);})[_0x143d('0x1f')](function(_0x315d96){logger[_0x143d('0x14')](_0x143d('0x20'),_0x315d96['message'],_0x120fed);_0x1a2b90(_0x11be52[_0x143d('0x14')](0x1f4,_0x315d96[_0x143d('0x16')]));});});}; \ No newline at end of file +var _0xf1ee=['CreateSquareReport','SquareReport','create','body','options','raw','catch','update','where','UpdateSquareReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0xf1ee,0xdc));var _0xef1e=function(_0x28f91e,_0x5e65eb){_0x28f91e=_0x28f91e-0x0;var _0x5bf631=_0xf1ee[_0x28f91e];return _0x5bf631;};'use strict';var _=require('lodash');var util=require(_0xef1e('0x0'));var moment=require('moment');var BPromise=require(_0xef1e('0x1'));var rs=require(_0xef1e('0x2'));var fs=require('fs');var Redis=require(_0xef1e('0x3'));var db=require(_0xef1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef1e('0x6')][_0xef1e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55e765,_0x124dac,_0x33e28b){return new BPromise(function(_0x44b31e,_0x356a7b){return client[_0xef1e('0x8')](_0x55e765,_0x33e28b)[_0xef1e('0x9')](function(_0x2e603a){logger[_0xef1e('0xa')](_0xef1e('0xb'),_0x124dac,'request\x20sent');logger[_0xef1e('0xc')](_0xef1e('0xd'),_0x124dac,_0xef1e('0xe'),JSON[_0xef1e('0xf')](_0x2e603a));if(_0x2e603a[_0xef1e('0x10')]){if(_0x2e603a[_0xef1e('0x10')][_0xef1e('0x11')]===0x1f4){logger['error'](_0xef1e('0xb'),_0x124dac,_0x2e603a[_0xef1e('0x10')][_0xef1e('0x12')]);return _0x356a7b(_0x2e603a[_0xef1e('0x10')][_0xef1e('0x12')]);}logger[_0xef1e('0x10')](_0xef1e('0xb'),_0x124dac,_0x2e603a['error'][_0xef1e('0x12')]);return _0x44b31e(_0x2e603a[_0xef1e('0x10')][_0xef1e('0x12')]);}else{logger[_0xef1e('0xa')](_0xef1e('0xb'),_0x124dac,_0xef1e('0xe'));_0x44b31e(_0x2e603a[_0xef1e('0x13')][_0xef1e('0x12')]);}})['catch'](function(_0x4626cc){logger[_0xef1e('0x10')]('SquareReport,\x20%s,\x20%s',_0x124dac,_0x4626cc);_0x356a7b(_0x4626cc);});});}exports[_0xef1e('0x14')]=function(_0x5d3812){var _0x47aee6=this;return new Promise(function(_0x4aa5b9,_0x563067){return db[_0xef1e('0x15')][_0xef1e('0x16')](_0x5d3812[_0xef1e('0x17')],{'raw':_0x5d3812[_0xef1e('0x18')]?_0x5d3812[_0xef1e('0x18')][_0xef1e('0x19')]===undefined?!![]:![]:!![]})[_0xef1e('0x9')](function(_0x4f241e){logger['info']('CreateSquareReport',_0x5d3812);logger['debug'](_0xef1e('0x14'),_0x5d3812,JSON['stringify'](_0x4f241e));_0x4aa5b9(_0x4f241e);})[_0xef1e('0x1a')](function(_0x4e5e4a){logger[_0xef1e('0x10')](_0xef1e('0x14'),_0x4e5e4a['message'],_0x5d3812);_0x563067(_0x47aee6[_0xef1e('0x10')](0x1f4,_0x4e5e4a['message']));});});};exports['UpdateSquareReport']=function(_0x5d6168){var _0x3a1760=this;return new Promise(function(_0xeb571e,_0x318a88){return db[_0xef1e('0x15')][_0xef1e('0x1b')](_0x5d6168[_0xef1e('0x17')],{'raw':_0x5d6168['options']?_0x5d6168[_0xef1e('0x18')][_0xef1e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6168[_0xef1e('0x18')]?_0x5d6168[_0xef1e('0x18')][_0xef1e('0x1c')]||null:null,'attributes':_0x5d6168[_0xef1e('0x18')]?_0x5d6168['options']['attributes']||null:null,'limit':_0x5d6168[_0xef1e('0x18')]?_0x5d6168['options']['limit']||null:null})['then'](function(_0x545520){logger['info'](_0xef1e('0x1d'),_0x5d6168);logger[_0xef1e('0xc')](_0xef1e('0x1d'),_0x5d6168,JSON[_0xef1e('0xf')](_0x545520));_0xeb571e(_0x545520);})[_0xef1e('0x1a')](function(_0x30b038){logger[_0xef1e('0x10')](_0xef1e('0x1d'),_0x30b038[_0xef1e('0x12')],_0x5d6168);_0x318a88(_0x3a1760['error'](0x1f4,_0x30b038[_0xef1e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b620ddc..c8a7f5a 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 _0x4ab6=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy'];(function(_0x3435a5,_0x287079){var _0x4a98a0=function(_0x4eb34c){while(--_0x4eb34c){_0x3435a5['push'](_0x3435a5['shift']());}};_0x4a98a0(++_0x287079);}(_0x4ab6,0x7f));var _0x64ab=function(_0x3a2a33,_0x29372a){_0x3a2a33=_0x3a2a33-0x0;var _0x10d6d2=_0x4ab6[_0x3a2a33];return _0x10d6d2;};'use strict';var multer=require(_0x64ab('0x0'));var util=require(_0x64ab('0x1'));var path=require(_0x64ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64ab('0x3')]();var fs_extra=require(_0x64ab('0x4'));var auth=require(_0x64ab('0x5'));var interaction=require(_0x64ab('0x6'));var config=require('../../config/environment');var controller=require(_0x64ab('0x7'));router[_0x64ab('0x8')]('/',auth[_0x64ab('0x9')](),controller[_0x64ab('0xa')]);router[_0x64ab('0x8')](_0x64ab('0xb'),auth[_0x64ab('0x9')](),controller[_0x64ab('0xc')]);router[_0x64ab('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x64ab('0xd')]);router[_0x64ab('0xe')]('/',auth[_0x64ab('0x9')](),controller[_0x64ab('0xf')]);router[_0x64ab('0x10')](_0x64ab('0x11'),auth[_0x64ab('0x9')](),controller[_0x64ab('0x12')]);router['delete']('/:id',auth[_0x64ab('0x9')](),controller[_0x64ab('0x13')]);module[_0x64ab('0x14')]=router; \ No newline at end of file +var _0xc677=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','post','put','exports','multer','util'];(function(_0x3aac86,_0x51b2d2){var _0x1d3986=function(_0x3fa789){while(--_0x3fa789){_0x3aac86['push'](_0x3aac86['shift']());}};_0x1d3986(++_0x51b2d2);}(_0xc677,0x86));var _0x7c67=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc677[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7c67('0x0'));var util=require(_0x7c67('0x1'));var path=require(_0x7c67('0x2'));var timeout=require(_0x7c67('0x3'));var express=require(_0x7c67('0x4'));var router=express['Router']();var fs_extra=require(_0x7c67('0x5'));var auth=require(_0x7c67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c67('0x7'));var controller=require(_0x7c67('0x8'));router[_0x7c67('0x9')]('/',auth[_0x7c67('0xa')](),controller[_0x7c67('0xb')]);router[_0x7c67('0x9')]('/describe',auth[_0x7c67('0xa')](),controller[_0x7c67('0xc')]);router['get'](_0x7c67('0xd'),auth[_0x7c67('0xa')](),controller['show']);router[_0x7c67('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c67('0xf')](_0x7c67('0xd'),auth[_0x7c67('0xa')](),controller['update']);router['delete'](_0x7c67('0xd'),auth[_0x7c67('0xa')](),controller['destroy']);module[_0x7c67('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e7bc9ab..e7134f9 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 _0x398d=['STRING','TEXT','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x398d,0xb6));var _0xd398=function(_0x12f77e,_0x4442f2){_0x12f77e=_0x12f77e-0x0;var _0x4568c0=_0x398d[_0x12f77e];return _0x4568c0;};'use strict';var Sequelize=require('sequelize');module[_0xd398('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xd398('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xd398('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd398('0x1')]}}; \ No newline at end of file +var _0x905d=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x905d,0xf3));var _0xd905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x905d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd905('0x0'));module[_0xd905('0x1')]={'uniqueid':{'type':Sequelize[_0xd905('0x2')]},'node':{'type':Sequelize[_0xd905('0x2')]},'application':{'type':Sequelize[_0xd905('0x2')]},'data':{'type':Sequelize[_0xd905('0x3')]},'project_name':{'type':Sequelize[_0xd905('0x2')]},'callerid':{'type':Sequelize[_0xd905('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a4ed68d..b6f8a52 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 _0x5619=['apply','save','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range'];(function(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0x5619,0x102));var _0x9561=function(_0x1494d1,_0x3f21fb){_0x1494d1=_0x1494d1-0x0;var _0x2cc475=_0x5619[_0x1494d1];return _0x2cc475;};'use strict';var emlformat=require(_0x9561('0x0'));var rimraf=require(_0x9561('0x1'));var zipdir=require(_0x9561('0x2'));var jsonpatch=require(_0x9561('0x3'));var rp=require(_0x9561('0x4'));var moment=require(_0x9561('0x5'));var BPromise=require(_0x9561('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9561('0x7'));var sox=require(_0x9561('0x8'));var csv=require(_0x9561('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9561('0xa'));var squel=require('squel');var crypto=require(_0x9561('0xb'));var jsforce=require(_0x9561('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9561('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9561('0xd'));var authService=require(_0x9561('0xe'));var qs=require(_0x9561('0xf'));var as=require(_0x9561('0x10'));var hardwareService=require(_0x9561('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9561('0x12'));var config=require(_0x9561('0x13'));var licenseUtil=require(_0x9561('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2923a1,_0x2bcfae){_0x2bcfae=_0x2bcfae||0xcc;return function(_0x408fa5){if(_0x408fa5){return _0x2923a1[_0x9561('0x15')](_0x2bcfae);}return _0x2923a1[_0x9561('0x16')](_0x2bcfae)[_0x9561('0x17')]();};}function respondWithResult(_0x39cf17,_0x26edb5){_0x26edb5=_0x26edb5||0xc8;return function(_0x248e9c){if(_0x248e9c){return _0x39cf17[_0x9561('0x16')](_0x26edb5)[_0x9561('0x18')](_0x248e9c);}};}function respondWithFilteredResult(_0x1166b0,_0x5e6973){return function(_0x328c89){if(_0x328c89){var _0x58ae23=typeof _0x5e6973[_0x9561('0x19')]===_0x9561('0x1a')&&typeof _0x5e6973['limit']===_0x9561('0x1a');var _0x513607=_0x328c89[_0x9561('0x1b')];var _0x258746=_0x58ae23?0x0:_0x5e6973[_0x9561('0x19')];var _0x4c47c5=_0x58ae23?_0x328c89[_0x9561('0x1b')]:_0x5e6973[_0x9561('0x19')]+_0x5e6973['limit'];var _0x29b28f;if(_0x4c47c5>=_0x513607){_0x4c47c5=_0x513607;_0x29b28f=0xc8;}else{_0x29b28f=0xce;}_0x1166b0[_0x9561('0x16')](_0x29b28f);return _0x1166b0[_0x9561('0x1c')](_0x9561('0x1d'),_0x258746+'-'+_0x4c47c5+'/'+_0x513607)[_0x9561('0x18')](_0x328c89);}return null;};}function patchUpdates(_0x1b7228){return function(_0x2f73f7){try{jsonpatch[_0x9561('0x1e')](_0x2f73f7,_0x1b7228,!![]);}catch(_0xe5332f){return BPromise['reject'](_0xe5332f);}return _0x2f73f7[_0x9561('0x1f')]();};}function saveUpdates(_0x145540,_0x45156b){return function(_0x3329e2){if(_0x3329e2){return _0x3329e2['update'](_0x145540)[_0x9561('0x20')](function(_0xd4064a){return _0xd4064a;});}return null;};}function removeEntity(_0x2aad1b,_0x1081ad){return function(_0x1ae046){if(_0x1ae046){return _0x1ae046[_0x9561('0x21')]()[_0x9561('0x20')](function(){_0x2aad1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d9d57,_0x198889){return function(_0x1b8fb4){if(!_0x1b8fb4){_0x5d9d57[_0x9561('0x15')](0x194);}return _0x1b8fb4;};}function handleError(_0x1d45f6,_0x5578cf){_0x5578cf=_0x5578cf||0x1f4;return function(_0x288bfc){logger[_0x9561('0x22')](_0x288bfc[_0x9561('0x23')]);if(_0x288bfc[_0x9561('0x24')]){delete _0x288bfc['name'];}_0x1d45f6[_0x9561('0x16')](_0x5578cf)[_0x9561('0x25')](_0x288bfc);};}exports['index']=function(_0x4405cc,_0x2e14f8){var _0x56192a={},_0x1262f8={},_0x958fc2={'count':0x0,'rows':[]};var _0x24084c=_[_0x9561('0x26')](db[_0x9561('0x27')][_0x9561('0x28')],function(_0x453b4b){return{'name':_0x453b4b['fieldName'],'type':_0x453b4b[_0x9561('0x29')][_0x9561('0x2a')]};});_0x1262f8['model']=_[_0x9561('0x26')](_0x24084c,_0x9561('0x24'));_0x1262f8[_0x9561('0x2b')]=_[_0x9561('0x2c')](_0x4405cc['query']);_0x1262f8[_0x9561('0x2d')]=_[_0x9561('0x2e')](_0x1262f8[_0x9561('0x2f')],_0x1262f8[_0x9561('0x2b')]);_0x56192a[_0x9561('0x30')]=_[_0x9561('0x2e')](_0x1262f8[_0x9561('0x2f')],qs[_0x9561('0x31')](_0x4405cc['query'][_0x9561('0x31')]));_0x56192a['attributes']=_0x56192a[_0x9561('0x30')][_0x9561('0x32')]?_0x56192a[_0x9561('0x30')]:_0x1262f8[_0x9561('0x2f')];if(!_0x4405cc[_0x9561('0x2b')]['hasOwnProperty'](_0x9561('0x33'))){_0x56192a[_0x9561('0x34')]=qs['limit'](_0x4405cc[_0x9561('0x2b')][_0x9561('0x34')]);_0x56192a[_0x9561('0x19')]=qs[_0x9561('0x19')](_0x4405cc['query'][_0x9561('0x19')]);}_0x56192a[_0x9561('0x35')]=qs[_0x9561('0x36')](_0x4405cc[_0x9561('0x2b')][_0x9561('0x36')]);_0x56192a[_0x9561('0x37')]=qs[_0x9561('0x2d')](_['pick'](_0x4405cc[_0x9561('0x2b')],_0x1262f8[_0x9561('0x2d')]),_0x24084c);if(_0x4405cc[_0x9561('0x2b')][_0x9561('0x38')]){_0x56192a[_0x9561('0x37')]=_['merge'](_0x56192a[_0x9561('0x37')],{'$or':_[_0x9561('0x26')](_0x24084c,function(_0x45748d){if(_0x45748d[_0x9561('0x29')]!==_0x9561('0x39')){var _0x29403b={};_0x29403b[_0x45748d[_0x9561('0x24')]]={'$like':'%'+_0x4405cc[_0x9561('0x2b')][_0x9561('0x38')]+'%'};return _0x29403b;}})});}_0x56192a=_[_0x9561('0x3a')]({},_0x56192a,_0x4405cc[_0x9561('0x3b')]);var _0x4d156b={'where':_0x56192a[_0x9561('0x37')]};return db[_0x9561('0x27')][_0x9561('0x1b')](_0x4d156b)[_0x9561('0x20')](function(_0xd4c22){_0x958fc2['count']=_0xd4c22;if(_0x4405cc[_0x9561('0x2b')]['includeAll']){_0x56192a[_0x9561('0x3c')]=[{'all':!![]}];}return db[_0x9561('0x27')][_0x9561('0x3d')](_0x56192a);})[_0x9561('0x20')](function(_0xfee3b3){_0x958fc2[_0x9561('0x3e')]=_0xfee3b3;return _0x958fc2;})[_0x9561('0x20')](respondWithFilteredResult(_0x2e14f8,_0x56192a))[_0x9561('0x3f')](handleError(_0x2e14f8,null));};exports[_0x9561('0x40')]=function(_0x1b8338,_0xbb1e9e){var _0x268183={'raw':!![],'where':{'id':_0x1b8338[_0x9561('0x41')]['id']}},_0x2d95ea={};_0x2d95ea[_0x9561('0x2f')]=_['keys'](db[_0x9561('0x27')][_0x9561('0x28')]);_0x2d95ea[_0x9561('0x2b')]=_[_0x9561('0x2c')](_0x1b8338[_0x9561('0x2b')]);_0x2d95ea[_0x9561('0x2d')]=_[_0x9561('0x2e')](_0x2d95ea['model'],_0x2d95ea['query']);_0x268183[_0x9561('0x30')]=_['intersection'](_0x2d95ea[_0x9561('0x2f')],qs[_0x9561('0x31')](_0x1b8338['query'][_0x9561('0x31')]));_0x268183[_0x9561('0x30')]=_0x268183[_0x9561('0x30')][_0x9561('0x32')]?_0x268183[_0x9561('0x30')]:_0x2d95ea[_0x9561('0x2f')];if(_0x1b8338[_0x9561('0x2b')][_0x9561('0x42')]){_0x268183[_0x9561('0x3c')]=[{'all':!![]}];}_0x268183=_['merge']({},_0x268183,_0x1b8338[_0x9561('0x3b')]);return db[_0x9561('0x27')][_0x9561('0x43')](_0x268183)[_0x9561('0x20')](handleEntityNotFound(_0xbb1e9e,null))[_0x9561('0x20')](respondWithResult(_0xbb1e9e,null))[_0x9561('0x3f')](handleError(_0xbb1e9e,null));};exports[_0x9561('0x44')]=function(_0x46d5d3,_0x334805){return db[_0x9561('0x27')][_0x9561('0x44')](_0x46d5d3['body'],{})[_0x9561('0x20')](respondWithResult(_0x334805,0xc9))[_0x9561('0x3f')](handleError(_0x334805,null));};exports[_0x9561('0x45')]=function(_0x40ab5f,_0x154e77){if(_0x40ab5f['body']['id']){delete _0x40ab5f[_0x9561('0x46')]['id'];}return db[_0x9561('0x27')][_0x9561('0x43')]({'where':{'id':_0x40ab5f['params']['id']}})[_0x9561('0x20')](handleEntityNotFound(_0x154e77,null))['then'](saveUpdates(_0x40ab5f[_0x9561('0x46')],null))[_0x9561('0x20')](respondWithResult(_0x154e77,null))[_0x9561('0x3f')](handleError(_0x154e77,null));};exports[_0x9561('0x21')]=function(_0x230c9e,_0x29cdc3){return db[_0x9561('0x27')][_0x9561('0x43')]({'where':{'id':_0x230c9e[_0x9561('0x41')]['id']}})[_0x9561('0x20')](handleEntityNotFound(_0x29cdc3,null))[_0x9561('0x20')](removeEntity(_0x29cdc3,null))['catch'](handleError(_0x29cdc3,null));};exports[_0x9561('0x47')]=function(_0x17545f,_0x2657ae){return db['SquareDetailsReport'][_0x9561('0x47')]()['then'](respondWithResult(_0x2657ae,null))[_0x9561('0x3f')](handleError(_0x2657ae,null));}; \ No newline at end of file +var _0x4a39=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','apply','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x4a39,0x65));var _0x94a3=function(_0x52a445,_0x5de583){_0x52a445=_0x52a445-0x0;var _0x3deea6=_0x4a39[_0x52a445];return _0x3deea6;};'use strict';var emlformat=require(_0x94a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94a3('0x2'));var moment=require(_0x94a3('0x3'));var BPromise=require(_0x94a3('0x4'));var Mustache=require(_0x94a3('0x5'));var util=require(_0x94a3('0x6'));var path=require('path');var sox=require(_0x94a3('0x7'));var csv=require('to-csv');var ejs=require(_0x94a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94a3('0x9'));var squel=require(_0x94a3('0xa'));var crypto=require(_0x94a3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x94a3('0xc'));var toCsv=require(_0x94a3('0xd'));var querystring=require(_0x94a3('0xe'));var Papa=require(_0x94a3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x94a3('0x10'));var as=require(_0x94a3('0x11'));var hardwareService=require(_0x94a3('0x12'));var logger=require(_0x94a3('0x13'))(_0x94a3('0x14'));var utils=require(_0x94a3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x94a3('0x16'))['db'];function respondWithStatusCode(_0x37ab4a,_0x20c0c8){_0x20c0c8=_0x20c0c8||0xcc;return function(_0x3d129c){if(_0x3d129c){return _0x37ab4a[_0x94a3('0x17')](_0x20c0c8);}return _0x37ab4a[_0x94a3('0x18')](_0x20c0c8)[_0x94a3('0x19')]();};}function respondWithResult(_0x53f647,_0x419595){_0x419595=_0x419595||0xc8;return function(_0x540c72){if(_0x540c72){return _0x53f647[_0x94a3('0x18')](_0x419595)['json'](_0x540c72);}};}function respondWithFilteredResult(_0x45889d,_0x584b5a){return function(_0x452679){if(_0x452679){var _0x364cee=typeof _0x584b5a['offset']===_0x94a3('0x1a')&&typeof _0x584b5a['limit']===_0x94a3('0x1a');var _0x536237=_0x452679['count'];var _0x2453b5=_0x364cee?0x0:_0x584b5a[_0x94a3('0x1b')];var _0x1f8701=_0x364cee?_0x452679[_0x94a3('0x1c')]:_0x584b5a[_0x94a3('0x1b')]+_0x584b5a[_0x94a3('0x1d')];var _0x3147eb;if(_0x1f8701>=_0x536237){_0x1f8701=_0x536237;_0x3147eb=0xc8;}else{_0x3147eb=0xce;}_0x45889d['status'](_0x3147eb);return _0x45889d[_0x94a3('0x1e')]('Content-Range',_0x2453b5+'-'+_0x1f8701+'/'+_0x536237)[_0x94a3('0x1f')](_0x452679);}return null;};}function patchUpdates(_0x3aa2b4){return function(_0x1f6b52){try{jsonpatch[_0x94a3('0x20')](_0x1f6b52,_0x3aa2b4,!![]);}catch(_0x564e96){return BPromise['reject'](_0x564e96);}return _0x1f6b52[_0x94a3('0x21')]();};}function saveUpdates(_0x360611,_0x5617b7){return function(_0x4d8209){if(_0x4d8209){return _0x4d8209[_0x94a3('0x22')](_0x360611)[_0x94a3('0x23')](function(_0x5b77ed){return _0x5b77ed;});}return null;};}function removeEntity(_0x3f9724,_0xf08d6){return function(_0x3b6060){if(_0x3b6060){return _0x3b6060[_0x94a3('0x24')]()['then'](function(){_0x3f9724[_0x94a3('0x18')](0xcc)[_0x94a3('0x19')]();});}};}function handleEntityNotFound(_0x1af70d,_0x16fcd9){return function(_0x13f68a){if(!_0x13f68a){_0x1af70d['sendStatus'](0x194);}return _0x13f68a;};}function handleError(_0x56de6f,_0x41f140){_0x41f140=_0x41f140||0x1f4;return function(_0x59e0ef){logger['error'](_0x59e0ef[_0x94a3('0x25')]);if(_0x59e0ef[_0x94a3('0x26')]){delete _0x59e0ef['name'];}_0x56de6f[_0x94a3('0x18')](_0x41f140)[_0x94a3('0x27')](_0x59e0ef);};}exports[_0x94a3('0x28')]=function(_0x4fd2d9,_0x4c132b){var _0x24b4a8={},_0x3f3048={},_0x19ca45={'count':0x0,'rows':[]};var _0x2a169a=_[_0x94a3('0x29')](db[_0x94a3('0x2a')][_0x94a3('0x2b')],function(_0x5d48df){return{'name':_0x5d48df['fieldName'],'type':_0x5d48df[_0x94a3('0x2c')][_0x94a3('0x2d')]};});_0x3f3048[_0x94a3('0x2e')]=_[_0x94a3('0x29')](_0x2a169a,_0x94a3('0x26'));_0x3f3048[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x4fd2d9[_0x94a3('0x2f')]);_0x3f3048[_0x94a3('0x31')]=_['intersection'](_0x3f3048[_0x94a3('0x2e')],_0x3f3048[_0x94a3('0x2f')]);_0x24b4a8['attributes']=_[_0x94a3('0x32')](_0x3f3048[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x4fd2d9['query'][_0x94a3('0x33')]));_0x24b4a8[_0x94a3('0x34')]=_0x24b4a8[_0x94a3('0x34')][_0x94a3('0x35')]?_0x24b4a8[_0x94a3('0x34')]:_0x3f3048[_0x94a3('0x2e')];if(!_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x36')](_0x94a3('0x37'))){_0x24b4a8[_0x94a3('0x1d')]=qs['limit'](_0x4fd2d9[_0x94a3('0x2f')]['limit']);_0x24b4a8['offset']=qs[_0x94a3('0x1b')](_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x1b')]);}_0x24b4a8[_0x94a3('0x38')]=qs[_0x94a3('0x39')](_0x4fd2d9[_0x94a3('0x2f')]['sort']);_0x24b4a8[_0x94a3('0x3a')]=qs[_0x94a3('0x31')](_[_0x94a3('0x3b')](_0x4fd2d9[_0x94a3('0x2f')],_0x3f3048[_0x94a3('0x31')]),_0x2a169a);if(_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]){_0x24b4a8[_0x94a3('0x3a')]=_['merge'](_0x24b4a8[_0x94a3('0x3a')],{'$or':_[_0x94a3('0x29')](_0x2a169a,function(_0xd8082f){if(_0xd8082f[_0x94a3('0x2c')]!==_0x94a3('0x3d')){var _0x10b432={};_0x10b432[_0xd8082f[_0x94a3('0x26')]]={'$like':'%'+_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]+'%'};return _0x10b432;}})});}_0x24b4a8=_[_0x94a3('0x3e')]({},_0x24b4a8,_0x4fd2d9[_0x94a3('0x3f')]);var _0x2dd845={'where':_0x24b4a8['where']};return db['SquareDetailsReport']['count'](_0x2dd845)[_0x94a3('0x23')](function(_0xa91ec3){_0x19ca45['count']=_0xa91ec3;if(_0x4fd2d9['query'][_0x94a3('0x40')]){_0x24b4a8['include']=[{'all':!![]}];}return db[_0x94a3('0x2a')][_0x94a3('0x41')](_0x24b4a8);})[_0x94a3('0x23')](function(_0x3f8bf7){_0x19ca45[_0x94a3('0x42')]=_0x3f8bf7;return _0x19ca45;})[_0x94a3('0x23')](respondWithFilteredResult(_0x4c132b,_0x24b4a8))[_0x94a3('0x43')](handleError(_0x4c132b,null));};exports[_0x94a3('0x44')]=function(_0x5b6af8,_0x50083a){var _0x209147={'raw':!![],'where':{'id':_0x5b6af8[_0x94a3('0x45')]['id']}},_0x1088b1={};_0x1088b1[_0x94a3('0x2e')]=_['keys'](db[_0x94a3('0x2a')][_0x94a3('0x2b')]);_0x1088b1[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x5b6af8['query']);_0x1088b1[_0x94a3('0x31')]=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],_0x1088b1[_0x94a3('0x2f')]);_0x209147['attributes']=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x33')]));_0x209147['attributes']=_0x209147[_0x94a3('0x34')][_0x94a3('0x35')]?_0x209147[_0x94a3('0x34')]:_0x1088b1['model'];if(_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x40')]){_0x209147[_0x94a3('0x46')]=[{'all':!![]}];}_0x209147=_[_0x94a3('0x3e')]({},_0x209147,_0x5b6af8[_0x94a3('0x3f')]);return db['SquareDetailsReport'][_0x94a3('0x47')](_0x209147)['then'](handleEntityNotFound(_0x50083a,null))[_0x94a3('0x23')](respondWithResult(_0x50083a,null))[_0x94a3('0x43')](handleError(_0x50083a,null));};exports[_0x94a3('0x48')]=function(_0x49d80d,_0x4a713e){return db[_0x94a3('0x2a')][_0x94a3('0x48')](_0x49d80d['body'],{})[_0x94a3('0x23')](respondWithResult(_0x4a713e,0xc9))[_0x94a3('0x43')](handleError(_0x4a713e,null));};exports[_0x94a3('0x22')]=function(_0xf0ee6e,_0x48a4dc){if(_0xf0ee6e[_0x94a3('0x49')]['id']){delete _0xf0ee6e['body']['id'];}return db[_0x94a3('0x2a')][_0x94a3('0x47')]({'where':{'id':_0xf0ee6e[_0x94a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x48a4dc,null))[_0x94a3('0x23')](saveUpdates(_0xf0ee6e['body'],null))['then'](respondWithResult(_0x48a4dc,null))[_0x94a3('0x43')](handleError(_0x48a4dc,null));};exports[_0x94a3('0x24')]=function(_0x77ebab,_0x37403f){return db[_0x94a3('0x2a')]['find']({'where':{'id':_0x77ebab[_0x94a3('0x45')]['id']}})[_0x94a3('0x23')](handleEntityNotFound(_0x37403f,null))[_0x94a3('0x23')](removeEntity(_0x37403f,null))[_0x94a3('0x43')](handleError(_0x37403f,null));};exports[_0x94a3('0x4a')]=function(_0x5df1ac,_0xe27b03){return db[_0x94a3('0x2a')][_0x94a3('0x4a')]()['then'](respondWithResult(_0xe27b03,null))[_0x94a3('0x43')](handleError(_0xe27b03,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f66184d..77e1e15 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 _0xa311=['SquareDetailsReport','report_square_details','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x543bc7,_0x25d943){var _0x2654e6=function(_0x58df3f){while(--_0x58df3f){_0x543bc7['push'](_0x543bc7['shift']());}};_0x2654e6(++_0x25d943);}(_0xa311,0x1a6));var _0x1a31=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0xa311[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0x1a31('0x0'));var util=require('util');var logger=require(_0x1a31('0x1'))('api');var moment=require(_0x1a31('0x2'));var BPromise=require(_0x1a31('0x3'));var rp=require(_0x1a31('0x4'));var fs=require('fs');var path=require(_0x1a31('0x5'));var rimraf=require(_0x1a31('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x1a31('0x7')]=function(_0x43e575,_0x4f5450){return _0x43e575['define'](_0x1a31('0x8'),attributes,{'tableName':_0x1a31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d50=['SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','path','./squareReportDetail.attributes','exports'];(function(_0x1d5370,_0x363f29){var _0x24e2e1=function(_0x4c6ce7){while(--_0x4c6ce7){_0x1d5370['push'](_0x1d5370['shift']());}};_0x24e2e1(++_0x363f29);}(_0x3d50,0x19c));var _0x03d5=function(_0x322435,_0x15e952){_0x322435=_0x322435-0x0;var _0xffa769=_0x3d50[_0x322435];return _0xffa769;};'use strict';var _=require(_0x03d5('0x0'));var util=require(_0x03d5('0x1'));var logger=require(_0x03d5('0x2'))(_0x03d5('0x3'));var moment=require(_0x03d5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x03d5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x03d5('0x6'));module[_0x03d5('0x7')]=function(_0xf097e5,_0x1bea03){return _0xf097e5['define'](_0x03d5('0x8'),attributes,{'tableName':_0x03d5('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 f95a4b1..0875cd9 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 _0x6017=['http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x6017,0xae));var _0x7601=function(_0x44a801,_0x5a8595){_0x44a801=_0x44a801-0x0;var _0x3772e1=_0x6017[_0x44a801];return _0x3772e1;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});}exports[_0x7601('0x14')]=function(_0x5c3fb7){var _0x5f530e=this;return new Promise(function(_0x22520e,_0x403e38){return db[_0x7601('0x15')][_0x7601('0x16')](_0x5c3fb7[_0x7601('0x17')],{'raw':_0x5c3fb7[_0x7601('0x18')]?_0x5c3fb7[_0x7601('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7601('0xa')](function(_0x1d58c0){logger['info'](_0x7601('0x14'),_0x5c3fb7);logger[_0x7601('0xd')](_0x7601('0x14'),_0x5c3fb7,JSON[_0x7601('0xe')](_0x1d58c0));_0x22520e(_0x1d58c0);})[_0x7601('0x19')](function(_0x12f3f6){logger['error'](_0x7601('0x14'),_0x12f3f6[_0x7601('0x11')],_0x5c3fb7);_0x403e38(_0x5f530e[_0x7601('0xf')](0x1f4,_0x12f3f6[_0x7601('0x11')]));});});}; \ No newline at end of file +var _0x5c00=['create','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareDetailsReport'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x5c00,0x17e));var _0x05c0=function(_0x172298,_0x542449){_0x172298=_0x172298-0x0;var _0x44856d=_0x5c00[_0x172298];return _0x44856d;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['SquareDetailsReport'][_0x05c0('0x17')](_0x521cbd[_0x05c0('0x18')],{'raw':_0x521cbd[_0x05c0('0x19')]?_0x521cbd[_0x05c0('0x19')][_0x05c0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x407c1f){logger[_0x05c0('0xc')]('CreateSquareDetailsReport',_0x521cbd);logger['debug']('CreateSquareDetailsReport',_0x521cbd,JSON[_0x05c0('0x10')](_0x407c1f));_0x1230e5(_0x407c1f);})[_0x05c0('0x15')](function(_0x83f29){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x83f29[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x83f29['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index fbe837c..11e2e95 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 _0x76d3=['killProcess','exports','express','./system.controller','isAuthenticated','index','get','/process/:pid/kill'];(function(_0xe88157,_0x965589){var _0xa9cf33=function(_0x222d32){while(--_0x222d32){_0xe88157['push'](_0xe88157['shift']());}};_0xa9cf33(++_0x965589);}(_0x76d3,0x1aa));var _0x376d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x76d3[_0x21a9d9];return _0x46adce;};'use strict';var express=require(_0x376d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x376d('0x1'));router['get']('/',auth[_0x376d('0x2')](),controller[_0x376d('0x3')]);router[_0x376d('0x4')](_0x376d('0x5'),auth[_0x376d('0x2')](),controller[_0x376d('0x6')]);module[_0x376d('0x7')]=router; \ No newline at end of file +var _0xa18f=['index','killProcess','express','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x745e75,_0x2bf2a9){var _0x2138af=function(_0x24bba6){while(--_0x24bba6){_0x745e75['push'](_0x745e75['shift']());}};_0x2138af(++_0x2bf2a9);}(_0xa18f,0x152));var _0xfa18=function(_0x16a995,_0x48680b){_0x16a995=_0x16a995-0x0;var _0x59f77a=_0xa18f[_0x16a995];return _0x59f77a;};'use strict';var express=require(_0xfa18('0x0'));var router=express[_0xfa18('0x1')]();var auth=require(_0xfa18('0x2'));var controller=require(_0xfa18('0x3'));router['get']('/',auth[_0xfa18('0x4')](),controller[_0xfa18('0x5')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xfa18('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ec8fb78..f8bedfb 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 _0x62f8=['SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill'];(function(_0x2cfb27,_0x4dccfd){var _0x56be44=function(_0x2940e9){while(--_0x2940e9){_0x2cfb27['push'](_0x2cfb27['shift']());}};_0x56be44(++_0x4dccfd);}(_0x62f8,0x99));var _0x862f=function(_0x225152,_0x403f3a){_0x225152=_0x225152-0x0;var _0x2c9a30=_0x62f8[_0x225152];return _0x2c9a30;};'use strict';var info=require(_0x862f('0x0'));var exec=require(_0x862f('0x1'))['exec'];var logger=require(_0x862f('0x2'))(_0x862f('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x862f('0x4'));function handleError(_0x368e2e,_0x3ed62c,_0x4dac75){_0x3ed62c=_0x3ed62c||0x1f4;return function(_0x538cb2){logger['error'](_0x862f('0x5'),_0x4dac75,_0x3ed62c,util[_0x862f('0x6')](_0x538cb2,{'showHidden':![],'depth':null}));delete _0x538cb2[_0x862f('0x7')];_0x368e2e[_0x862f('0x8')](_0x3ed62c)['send'](_0x538cb2);};}exports[_0x862f('0x9')]=function(_0x4ca5b5,_0x3e60a6){return info['getAllData']()[_0x862f('0xa')](function(_0x206a4a){return _0x3e60a6['status'](0xc8)['json'](_0x206a4a);})[_0x862f('0xb')](function(_0x58ac46){return _0x3e60a6[_0x862f('0x8')](0x1f4)['json'](_0x58ac46);});};exports[_0x862f('0xc')]=function(_0x3ac4df,_0xa8258d){var _0x579a5c=[_0x862f('0xd')];return new BPromise(function(_0x28a7c1,_0x10794a){return exec(util[_0x862f('0xe')](_0x862f('0xf'),_0x3ac4df[_0x862f('0x10')][_0x862f('0x11')]),function(_0x4c9632,_0x4a04ba,_0x30b167){if(_0x4c9632){return _0x10794a(_0x4c9632);}return _0x28a7c1(_0x4a04ba);});})[_0x862f('0xa')](function(_0x3ce171){var _0x2fe72d=![];var _0x23a252=_0x3ce171[_0x862f('0x12')](/\n/);for(var _0x261b7a=0x0,_0x388bea=_0x579a5c[_0x862f('0x13')];_0x261b7a<_0x388bea,_0x2fe72d===![];_0x261b7a+=0x1){if(_0x3ce171[_0x862f('0x14')](_0x579a5c[_0x261b7a])>=0x0){_0x2fe72d=!![];}}if(!_0x2fe72d){throw new Error(util[_0x862f('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3ac4df[_0x862f('0x10')][_0x862f('0x11')]));}process[_0x862f('0x15')](_0x3ac4df[_0x862f('0x10')][_0x862f('0x11')],_0x862f('0x16'));return _0xa8258d['status'](0xc8)[_0x862f('0x17')]({'message':util[_0x862f('0xe')](_0x862f('0x18'),_0x3ac4df[_0x862f('0x10')][_0x862f('0x11')])});})[_0x862f('0xb')](handleError(_0xa8258d,null,_0x862f('0xc')));}; \ No newline at end of file +var _0x9cc4=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','getAllData','then','status','json','catch','killProcess','components/import/cm','format','params','pid','length','indexOf'];(function(_0x336f35,_0xaffa7e){var _0x59cda2=function(_0x197526){while(--_0x197526){_0x336f35['push'](_0x336f35['shift']());}};_0x59cda2(++_0xaffa7e);}(_0x9cc4,0x154));var _0x49cc=function(_0x1a8f46,_0x10eebc){_0x1a8f46=_0x1a8f46-0x0;var _0x296e1d=_0x9cc4[_0x1a8f46];return _0x296e1d;};'use strict';var info=require(_0x49cc('0x0'));var exec=require(_0x49cc('0x1'))[_0x49cc('0x2')];var logger=require(_0x49cc('0x3'))(_0x49cc('0x4'));var util=require('util');var BPromise=require(_0x49cc('0x5'));var _=require(_0x49cc('0x6'));function handleError(_0x564e30,_0x31436e,_0x28ce1c){_0x31436e=_0x31436e||0x1f4;return function(_0x1a1551){logger[_0x49cc('0x7')](_0x49cc('0x8'),_0x28ce1c,_0x31436e,util[_0x49cc('0x9')](_0x1a1551,{'showHidden':![],'depth':null}));delete _0x1a1551[_0x49cc('0xa')];_0x564e30['status'](_0x31436e)[_0x49cc('0xb')](_0x1a1551);};}exports['index']=function(_0x52948a,_0x22265c){return info[_0x49cc('0xc')]()[_0x49cc('0xd')](function(_0x3ad4f3){return _0x22265c[_0x49cc('0xe')](0xc8)[_0x49cc('0xf')](_0x3ad4f3);})[_0x49cc('0x10')](function(_0x66a12f){return _0x22265c[_0x49cc('0xe')](0x1f4)[_0x49cc('0xf')](_0x66a12f);});};exports[_0x49cc('0x11')]=function(_0xf8cac2,_0x213a52){var _0x860c95=[_0x49cc('0x12')];return new BPromise(function(_0x38a84d,_0x373cfb){return exec(util[_0x49cc('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0xf8cac2[_0x49cc('0x14')][_0x49cc('0x15')]),function(_0x30338e,_0x5161fd,_0x495412){if(_0x30338e){return _0x373cfb(_0x30338e);}return _0x38a84d(_0x5161fd);});})[_0x49cc('0xd')](function(_0x294e3a){var _0x544dc=![];var _0x5e33fd=_0x294e3a['split'](/\n/);for(var _0x45f47c=0x0,_0x498385=_0x860c95[_0x49cc('0x16')];_0x45f47c<_0x498385,_0x544dc===![];_0x45f47c+=0x1){if(_0x294e3a[_0x49cc('0x17')](_0x860c95[_0x45f47c])>=0x0){_0x544dc=!![];}}if(!_0x544dc){throw new Error(util[_0x49cc('0x13')](_0x49cc('0x18'),_0xf8cac2['params'][_0x49cc('0x15')]));}process[_0x49cc('0x19')](_0xf8cac2['params'][_0x49cc('0x15')],_0x49cc('0x1a'));return _0x213a52[_0x49cc('0xe')](0xc8)['json']({'message':util[_0x49cc('0x13')](_0x49cc('0x1b'),_0xf8cac2['params'][_0x49cc('0x15')])});})['catch'](handleError(_0x213a52,null,_0x49cc('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 25af659..ca14486 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 _0x15da=['post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show'];(function(_0x28bede,_0x25dc5f){var _0x124dab=function(_0x977ade){while(--_0x977ade){_0x28bede['push'](_0x28bede['shift']());}};_0x124dab(++_0x25dc5f);}(_0x15da,0x98));var _0xa15d=function(_0x54e333,_0x4ba478){_0x54e333=_0x54e333-0x0;var _0x47279e=_0x15da[_0x54e333];return _0x47279e;};'use strict';var multer=require('multer');var util=require(_0xa15d('0x0'));var path=require(_0xa15d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa15d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa15d('0x3'));var config=require(_0xa15d('0x4'));var controller=require(_0xa15d('0x5'));router[_0xa15d('0x6')]('/',auth[_0xa15d('0x7')](),controller[_0xa15d('0x8')]);router[_0xa15d('0x6')]('/:id',auth[_0xa15d('0x7')](),controller[_0xa15d('0x9')]);router[_0xa15d('0xa')]('/',auth[_0xa15d('0x7')](),controller[_0xa15d('0xb')]);router[_0xa15d('0xc')](_0xa15d('0xd'),auth[_0xa15d('0x7')](),controller[_0xa15d('0xe')]);router[_0xa15d('0xf')]('/:id',auth[_0xa15d('0x7')](),controller[_0xa15d('0x10')]);module[_0xa15d('0x11')]=router; \ No newline at end of file +var _0xcd6f=['show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get'];(function(_0x2b8234,_0x32b33a){var _0x5c3001=function(_0x4d527b){while(--_0x4d527b){_0x2b8234['push'](_0x2b8234['shift']());}};_0x5c3001(++_0x32b33a);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x405fe8,_0xa55e2f){_0x405fe8=_0x405fe8-0x0;var _0x50e490=_0xcd6f[_0x405fe8];return _0x50e490;};'use strict';var multer=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var path=require(_0xfcd6('0x2'));var timeout=require(_0xfcd6('0x3'));var express=require(_0xfcd6('0x4'));var router=express[_0xfcd6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfcd6('0x6'));var interaction=require(_0xfcd6('0x7'));var config=require(_0xfcd6('0x8'));var controller=require(_0xfcd6('0x9'));router['get']('/',auth[_0xfcd6('0xa')](),controller['index']);router[_0xfcd6('0xb')]('/:id',auth[_0xfcd6('0xa')](),controller[_0xfcd6('0xc')]);router['post']('/',auth[_0xfcd6('0xa')](),controller['create']);router[_0xfcd6('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfcd6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xfcd6('0xf')]);module[_0xfcd6('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9988540..d42cf1a 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 _0x594d=['STRING','#0091EA','sequelize','name'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x594d,0x92));var _0xd594=function(_0x1c04e6,_0x3946de){_0x1c04e6=_0x1c04e6-0x0;var _0x57d820=_0x594d[_0x1c04e6];return _0x57d820;};'use strict';var Sequelize=require(_0xd594('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd594('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd594('0x2')],'defaultValue':_0xd594('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ffe=['STRING','#0091EA','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4ffe,0x172));var _0xe4ff=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0x4ffe[_0x493df0];return _0x4b6a03;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'name':{'type':Sequelize[_0xe4ff('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe4ff('0x2')],'defaultValue':_0xe4ff('0x3')},'description':{'type':Sequelize[_0xe4ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 85b5487..5a7c5a6 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 _0xf120=['apply','reject','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','Content-Range'];(function(_0x572499,_0x37619d){var _0x5466e3=function(_0x1c78a7){while(--_0x1c78a7){_0x572499['push'](_0x572499['shift']());}};_0x5466e3(++_0x37619d);}(_0xf120,0x179));var _0x0f12=function(_0xf1c43a,_0x35b9af){_0xf1c43a=_0xf1c43a-0x0;var _0x1d422d=_0xf120[_0xf1c43a];return _0x1d422d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f12('0x0'));var zipdir=require(_0x0f12('0x1'));var jsonpatch=require(_0x0f12('0x2'));var rp=require('request-promise');var moment=require(_0x0f12('0x3'));var BPromise=require(_0x0f12('0x4'));var Mustache=require(_0x0f12('0x5'));var util=require('util');var path=require(_0x0f12('0x6'));var sox=require(_0x0f12('0x7'));var csv=require(_0x0f12('0x8'));var ejs=require(_0x0f12('0x9'));var fs=require('fs');var fs_extra=require(_0x0f12('0xa'));var _=require(_0x0f12('0xb'));var squel=require(_0x0f12('0xc'));var crypto=require(_0x0f12('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f12('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f12('0xf'));var Papa=require(_0x0f12('0x10'));var Redis=require(_0x0f12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f12('0x12'));var hardwareService=require(_0x0f12('0x13'));var logger=require(_0x0f12('0x14'))(_0x0f12('0x15'));var utils=require(_0x0f12('0x16'));var config=require(_0x0f12('0x17'));var licenseUtil=require(_0x0f12('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf75042,_0x11a236){_0x11a236=_0x11a236||0xcc;return function(_0xb80905){if(_0xb80905){return _0xf75042[_0x0f12('0x19')](_0x11a236);}return _0xf75042[_0x0f12('0x1a')](_0x11a236)[_0x0f12('0x1b')]();};}function respondWithResult(_0x35ef6f,_0x7f1ae7){_0x7f1ae7=_0x7f1ae7||0xc8;return function(_0x215a7a){if(_0x215a7a){return _0x35ef6f[_0x0f12('0x1a')](_0x7f1ae7)[_0x0f12('0x1c')](_0x215a7a);}};}function respondWithFilteredResult(_0x3f2716,_0xe61624){return function(_0x27addc){if(_0x27addc){var _0xeccb7c=typeof _0xe61624['offset']===_0x0f12('0x1d')&&typeof _0xe61624['limit']===_0x0f12('0x1d');var _0x3a7041=_0x27addc[_0x0f12('0x1e')];var _0x12eb6c=_0xeccb7c?0x0:_0xe61624[_0x0f12('0x1f')];var _0xa2168f=_0xeccb7c?_0x27addc['count']:_0xe61624[_0x0f12('0x1f')]+_0xe61624['limit'];var _0x18d689;if(_0xa2168f>=_0x3a7041){_0xa2168f=_0x3a7041;_0x18d689=0xc8;}else{_0x18d689=0xce;}_0x3f2716['status'](_0x18d689);return _0x3f2716['set'](_0x0f12('0x20'),_0x12eb6c+'-'+_0xa2168f+'/'+_0x3a7041)[_0x0f12('0x1c')](_0x27addc);}return null;};}function patchUpdates(_0x46e682){return function(_0x5e4af9){try{jsonpatch[_0x0f12('0x21')](_0x5e4af9,_0x46e682,!![]);}catch(_0x4bfc5d){return BPromise[_0x0f12('0x22')](_0x4bfc5d);}return _0x5e4af9['save']();};}function saveUpdates(_0x9f283b,_0x379851){return function(_0x4f06bd){if(_0x4f06bd){return _0x4f06bd[_0x0f12('0x23')](_0x9f283b)[_0x0f12('0x24')](function(_0x3a28ae){return _0x3a28ae;});}return null;};}function removeEntity(_0x3821dd,_0x44f3b1){return function(_0x59d65b){if(_0x59d65b){return _0x59d65b[_0x0f12('0x25')]()['then'](function(){var _0x4c3a28=_0x59d65b['get']({'plain':!![]});var _0xee18d0=_0x0f12('0x26');return db[_0x0f12('0x27')][_0x0f12('0x25')]({'where':{'type':_0xee18d0,'resourceId':_0x4c3a28['id']}})['then'](function(){return _0x59d65b;});})[_0x0f12('0x24')](function(){_0x3821dd[_0x0f12('0x1a')](0xcc)[_0x0f12('0x1b')]();});}};}function handleEntityNotFound(_0x5ca297,_0x13baa0){return function(_0x2fdde4){if(!_0x2fdde4){_0x5ca297[_0x0f12('0x19')](0x194);}return _0x2fdde4;};}function handleError(_0x5cb12b,_0xeee65){_0xeee65=_0xeee65||0x1f4;return function(_0x25a5dc){logger[_0x0f12('0x28')](_0x25a5dc[_0x0f12('0x29')]);if(_0x25a5dc[_0x0f12('0x2a')]){delete _0x25a5dc['name'];}_0x5cb12b['status'](_0xeee65)[_0x0f12('0x2b')](_0x25a5dc);};}exports['index']=function(_0x3516f8,_0x3c6ce5){var _0x453f9e={},_0x52fc14={},_0x12a575={'count':0x0,'rows':[]};var _0x45a39a=_[_0x0f12('0x2c')](db[_0x0f12('0x2d')][_0x0f12('0x2e')],function(_0x25d56e){return{'name':_0x25d56e['fieldName'],'type':_0x25d56e[_0x0f12('0x2f')][_0x0f12('0x30')]};});_0x52fc14[_0x0f12('0x31')]=_['map'](_0x45a39a,_0x0f12('0x2a'));_0x52fc14[_0x0f12('0x32')]=_[_0x0f12('0x33')](_0x3516f8[_0x0f12('0x32')]);_0x52fc14['filters']=_[_0x0f12('0x34')](_0x52fc14[_0x0f12('0x31')],_0x52fc14[_0x0f12('0x32')]);_0x453f9e[_0x0f12('0x35')]=_[_0x0f12('0x34')](_0x52fc14[_0x0f12('0x31')],qs[_0x0f12('0x36')](_0x3516f8['query'][_0x0f12('0x36')]));_0x453f9e[_0x0f12('0x35')]=_0x453f9e['attributes'][_0x0f12('0x37')]?_0x453f9e[_0x0f12('0x35')]:_0x52fc14['model'];if(!_0x3516f8[_0x0f12('0x32')][_0x0f12('0x38')]('nolimit')){_0x453f9e[_0x0f12('0x39')]=qs['limit'](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x39')]);_0x453f9e[_0x0f12('0x1f')]=qs[_0x0f12('0x1f')](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x1f')]);}_0x453f9e[_0x0f12('0x3a')]=qs[_0x0f12('0x3b')](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x3b')]);_0x453f9e['where']=qs[_0x0f12('0x3c')](_[_0x0f12('0x3d')](_0x3516f8[_0x0f12('0x32')],_0x52fc14['filters']),_0x45a39a);if(_0x3516f8['query']['filter']){_0x453f9e[_0x0f12('0x3e')]=_[_0x0f12('0x3f')](_0x453f9e['where'],{'$or':_['map'](_0x45a39a,function(_0x21be62){if(_0x21be62[_0x0f12('0x2f')]!==_0x0f12('0x40')){var _0x51b8c8={};_0x51b8c8[_0x21be62[_0x0f12('0x2a')]]={'$like':'%'+_0x3516f8[_0x0f12('0x32')]['filter']+'%'};return _0x51b8c8;}})});}_0x453f9e=_[_0x0f12('0x3f')]({},_0x453f9e,_0x3516f8[_0x0f12('0x41')]);var _0x226be0={'where':_0x453f9e[_0x0f12('0x3e')]};return db[_0x0f12('0x2d')][_0x0f12('0x1e')](_0x226be0)[_0x0f12('0x24')](function(_0x4d9e11){_0x12a575[_0x0f12('0x1e')]=_0x4d9e11;if(_0x3516f8['query'][_0x0f12('0x42')]){_0x453f9e[_0x0f12('0x43')]=[{'all':!![]}];}return db['Tag'][_0x0f12('0x44')](_0x453f9e);})[_0x0f12('0x24')](function(_0x249dd4){_0x12a575['rows']=_0x249dd4;return _0x12a575;})['then'](respondWithFilteredResult(_0x3c6ce5,_0x453f9e))[_0x0f12('0x45')](handleError(_0x3c6ce5,null));};exports[_0x0f12('0x46')]=function(_0x106f93,_0x1637cb){var _0x5061bf={'raw':!![],'where':{'id':_0x106f93[_0x0f12('0x47')]['id']}},_0xbe1aca={};_0xbe1aca[_0x0f12('0x31')]=_[_0x0f12('0x33')](db['Tag'][_0x0f12('0x2e')]);_0xbe1aca[_0x0f12('0x32')]=_['keys'](_0x106f93['query']);_0xbe1aca[_0x0f12('0x3c')]=_[_0x0f12('0x34')](_0xbe1aca[_0x0f12('0x31')],_0xbe1aca['query']);_0x5061bf['attributes']=_[_0x0f12('0x34')](_0xbe1aca[_0x0f12('0x31')],qs['fields'](_0x106f93[_0x0f12('0x32')]['fields']));_0x5061bf[_0x0f12('0x35')]=_0x5061bf[_0x0f12('0x35')]['length']?_0x5061bf['attributes']:_0xbe1aca[_0x0f12('0x31')];if(_0x106f93[_0x0f12('0x32')][_0x0f12('0x42')]){_0x5061bf[_0x0f12('0x43')]=[{'all':!![]}];}_0x5061bf=_[_0x0f12('0x3f')]({},_0x5061bf,_0x106f93[_0x0f12('0x41')]);return db[_0x0f12('0x2d')][_0x0f12('0x48')](_0x5061bf)['then'](handleEntityNotFound(_0x1637cb,null))[_0x0f12('0x24')](respondWithResult(_0x1637cb,null))['catch'](handleError(_0x1637cb,null));};exports[_0x0f12('0x49')]=function(_0x52f1c2,_0x4add76){return db[_0x0f12('0x2d')]['create'](_0x52f1c2[_0x0f12('0x4a')],{})[_0x0f12('0x24')](function(_0x4298c8){var _0x284422=_0x52f1c2['user'][_0x0f12('0x4b')]({'plain':!![]});if(!_0x284422)throw new Error(_0x0f12('0x4c'));if(_0x284422[_0x0f12('0x4d')]===_0x0f12('0x4e')){var _0x48acec=_0x4298c8['get']({'plain':!![]});var _0x122a57=_0x0f12('0x26');return db[_0x0f12('0x4f')][_0x0f12('0x48')]({'where':{'name':_0x122a57,'userProfileId':_0x284422[_0x0f12('0x50')]},'raw':!![]})['then'](function(_0x48b7ec){if(_0x48b7ec&&_0x48b7ec['autoAssociation']===0x0){return db[_0x0f12('0x27')][_0x0f12('0x49')]({'name':_0x48acec[_0x0f12('0x2a')],'resourceId':_0x48acec['id'],'type':_0x48b7ec[_0x0f12('0x2a')],'sectionId':_0x48b7ec['id']},{})[_0x0f12('0x24')](function(){return _0x4298c8;});}else{return _0x4298c8;}})[_0x0f12('0x45')](function(_0x104ced){logger[_0x0f12('0x28')](_0x0f12('0x51'),_0x104ced);throw _0x104ced;});}return _0x4298c8;})[_0x0f12('0x24')](respondWithResult(_0x4add76,0xc9))[_0x0f12('0x45')](handleError(_0x4add76,null));};exports['update']=function(_0x1f05f6,_0x3dff95){if(_0x1f05f6[_0x0f12('0x4a')]['id']){delete _0x1f05f6[_0x0f12('0x4a')]['id'];}return db['Tag']['find']({'where':{'id':_0x1f05f6[_0x0f12('0x47')]['id']}})[_0x0f12('0x24')](handleEntityNotFound(_0x3dff95,null))[_0x0f12('0x24')](saveUpdates(_0x1f05f6[_0x0f12('0x4a')],null))[_0x0f12('0x24')](respondWithResult(_0x3dff95,null))[_0x0f12('0x45')](handleError(_0x3dff95,null));};exports[_0x0f12('0x25')]=function(_0x45da7f,_0x5b2bb1){return db[_0x0f12('0x2d')][_0x0f12('0x48')]({'where':{'id':_0x45da7f['params']['id']}})[_0x0f12('0x24')](handleEntityNotFound(_0x5b2bb1,null))[_0x0f12('0x24')](removeEntity(_0x5b2bb1,null))[_0x0f12('0x45')](handleError(_0x5b2bb1,null));}; \ No newline at end of file +var _0xd0bb=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','params','find','create','body','role','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0xd0bb[_0x41bdd4];return _0x5c03a6;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){var _0x4b0924=_0x58a721[_0xbd0b('0x26')]({'plain':!![]});var _0xfd9f82=_0xbd0b('0x27');return db['UserProfileResource'][_0xbd0b('0x25')]({'where':{'type':_0xfd9f82,'resourceId':_0x4b0924['id']}})[_0xbd0b('0x24')](function(){return _0x58a721;});})[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0x122893,_0x47f6f5){return function(_0x149403){if(!_0x149403){_0x122893[_0xbd0b('0x17')](0x194);}return _0x149403;};}function handleError(_0x82d326,_0x4f877a){_0x4f877a=_0x4f877a||0x1f4;return function(_0x4dfe76){logger[_0xbd0b('0x28')](_0x4dfe76[_0xbd0b('0x29')]);if(_0x4dfe76[_0xbd0b('0x2a')]){delete _0x4dfe76[_0xbd0b('0x2a')];}_0x82d326[_0xbd0b('0x18')](_0x4f877a)[_0xbd0b('0x2b')](_0x4dfe76);};}exports[_0xbd0b('0x2c')]=function(_0x4bc752,_0x45f7d6){var _0x3b70b4={},_0x5e1cb3={},_0x5e5e69={'count':0x0,'rows':[]};var _0x206c6a=_[_0xbd0b('0x2d')](db['Tag'][_0xbd0b('0x2e')],function(_0x2f7d61){return{'name':_0x2f7d61[_0xbd0b('0x2f')],'type':_0x2f7d61[_0xbd0b('0x30')][_0xbd0b('0x31')]};});_0x5e1cb3[_0xbd0b('0x32')]=_['map'](_0x206c6a,_0xbd0b('0x2a'));_0x5e1cb3[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x4bc752[_0xbd0b('0x33')]);_0x5e1cb3[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x5e1cb3[_0xbd0b('0x32')],_0x5e1cb3[_0xbd0b('0x33')]);_0x3b70b4[_0xbd0b('0x37')]=_[_0xbd0b('0x36')](_0x5e1cb3[_0xbd0b('0x32')],qs[_0xbd0b('0x38')](_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x38')]));_0x3b70b4['attributes']=_0x3b70b4[_0xbd0b('0x37')][_0xbd0b('0x39')]?_0x3b70b4['attributes']:_0x5e1cb3[_0xbd0b('0x32')];if(!_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x3a')](_0xbd0b('0x3b'))){_0x3b70b4[_0xbd0b('0x1d')]=qs[_0xbd0b('0x1d')](_0x4bc752['query'][_0xbd0b('0x1d')]);_0x3b70b4[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x1a')]);}_0x3b70b4['order']=qs['sort'](_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x3c')]);_0x3b70b4[_0xbd0b('0x3d')]=qs[_0xbd0b('0x35')](_['pick'](_0x4bc752['query'],_0x5e1cb3[_0xbd0b('0x35')]),_0x206c6a);if(_0x4bc752['query'][_0xbd0b('0x3e')]){_0x3b70b4[_0xbd0b('0x3d')]=_[_0xbd0b('0x3f')](_0x3b70b4[_0xbd0b('0x3d')],{'$or':_[_0xbd0b('0x2d')](_0x206c6a,function(_0x1f48ba){if(_0x1f48ba[_0xbd0b('0x30')]!==_0xbd0b('0x40')){var _0x2acc9f={};_0x2acc9f[_0x1f48ba[_0xbd0b('0x2a')]]={'$like':'%'+_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x3e')]+'%'};return _0x2acc9f;}})});}_0x3b70b4=_[_0xbd0b('0x3f')]({},_0x3b70b4,_0x4bc752[_0xbd0b('0x41')]);var _0x11b1a0={'where':_0x3b70b4[_0xbd0b('0x3d')]};return db[_0xbd0b('0x42')][_0xbd0b('0x1c')](_0x11b1a0)['then'](function(_0x32bde9){_0x5e5e69[_0xbd0b('0x1c')]=_0x32bde9;if(_0x4bc752[_0xbd0b('0x33')][_0xbd0b('0x43')]){_0x3b70b4[_0xbd0b('0x44')]=[{'all':!![]}];}return db[_0xbd0b('0x42')][_0xbd0b('0x45')](_0x3b70b4);})[_0xbd0b('0x24')](function(_0x2a1a1d){_0x5e5e69[_0xbd0b('0x46')]=_0x2a1a1d;return _0x5e5e69;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x45f7d6,_0x3b70b4))[_0xbd0b('0x47')](handleError(_0x45f7d6,null));};exports['show']=function(_0x4023c4,_0x49ad96){var _0x5dc0b3={'raw':!![],'where':{'id':_0x4023c4[_0xbd0b('0x48')]['id']}},_0x1fe06e={};_0x1fe06e[_0xbd0b('0x32')]=_['keys'](db[_0xbd0b('0x42')][_0xbd0b('0x2e')]);_0x1fe06e[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x4023c4[_0xbd0b('0x33')]);_0x1fe06e['filters']=_[_0xbd0b('0x36')](_0x1fe06e[_0xbd0b('0x32')],_0x1fe06e[_0xbd0b('0x33')]);_0x5dc0b3[_0xbd0b('0x37')]=_[_0xbd0b('0x36')](_0x1fe06e[_0xbd0b('0x32')],qs['fields'](_0x4023c4[_0xbd0b('0x33')][_0xbd0b('0x38')]));_0x5dc0b3[_0xbd0b('0x37')]=_0x5dc0b3[_0xbd0b('0x37')][_0xbd0b('0x39')]?_0x5dc0b3[_0xbd0b('0x37')]:_0x1fe06e[_0xbd0b('0x32')];if(_0x4023c4[_0xbd0b('0x33')][_0xbd0b('0x43')]){_0x5dc0b3[_0xbd0b('0x44')]=[{'all':!![]}];}_0x5dc0b3=_[_0xbd0b('0x3f')]({},_0x5dc0b3,_0x4023c4[_0xbd0b('0x41')]);return db[_0xbd0b('0x42')][_0xbd0b('0x49')](_0x5dc0b3)[_0xbd0b('0x24')](handleEntityNotFound(_0x49ad96,null))[_0xbd0b('0x24')](respondWithResult(_0x49ad96,null))[_0xbd0b('0x47')](handleError(_0x49ad96,null));};exports[_0xbd0b('0x4a')]=function(_0x3d40fc,_0x2ed890){return db[_0xbd0b('0x42')][_0xbd0b('0x4a')](_0x3d40fc[_0xbd0b('0x4b')],{})['then'](function(_0x12d3e7){var _0x1c13da=_0x3d40fc['user']['get']({'plain':!![]});if(!_0x1c13da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c13da[_0xbd0b('0x4c')]==='user'){var _0x1b9c00=_0x12d3e7[_0xbd0b('0x26')]({'plain':!![]});var _0xa97987=_0xbd0b('0x27');return db['UserProfileSection'][_0xbd0b('0x49')]({'where':{'name':_0xa97987,'userProfileId':_0x1c13da['userProfileId']},'raw':!![]})[_0xbd0b('0x24')](function(_0x5c5d9d){if(_0x5c5d9d&&_0x5c5d9d['autoAssociation']===0x0){return db[_0xbd0b('0x4d')][_0xbd0b('0x4a')]({'name':_0x1b9c00[_0xbd0b('0x2a')],'resourceId':_0x1b9c00['id'],'type':_0x5c5d9d[_0xbd0b('0x2a')],'sectionId':_0x5c5d9d['id']},{})[_0xbd0b('0x24')](function(){return _0x12d3e7;});}else{return _0x12d3e7;}})[_0xbd0b('0x47')](function(_0x319ace){logger[_0xbd0b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x319ace);throw _0x319ace;});}return _0x12d3e7;})['then'](respondWithResult(_0x2ed890,0xc9))[_0xbd0b('0x47')](handleError(_0x2ed890,null));};exports[_0xbd0b('0x23')]=function(_0x5094bd,_0x514985){if(_0x5094bd[_0xbd0b('0x4b')]['id']){delete _0x5094bd[_0xbd0b('0x4b')]['id'];}return db[_0xbd0b('0x42')][_0xbd0b('0x49')]({'where':{'id':_0x5094bd['params']['id']}})[_0xbd0b('0x24')](handleEntityNotFound(_0x514985,null))[_0xbd0b('0x24')](saveUpdates(_0x5094bd[_0xbd0b('0x4b')],null))[_0xbd0b('0x24')](respondWithResult(_0x514985,null))['catch'](handleError(_0x514985,null));};exports[_0xbd0b('0x25')]=function(_0x3c62c4,_0x4bd549){return db[_0xbd0b('0x42')][_0xbd0b('0x49')]({'where':{'id':_0x3c62c4[_0xbd0b('0x48')]['id']}})[_0xbd0b('0x24')](handleEntityNotFound(_0x4bd549,null))[_0xbd0b('0x24')](removeEntity(_0x4bd549,null))[_0xbd0b('0x47')](handleError(_0x4bd549,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 363b17a..e9aa43a 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 _0x4564=['./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4564,0x86));var _0x4456=function(_0x3edc26,_0x5f2929){_0x3edc26=_0x3edc26-0x0;var _0x4df0b1=_0x4564[_0x3edc26];return _0x4df0b1;};'use strict';var _=require(_0x4456('0x0'));var util=require(_0x4456('0x1'));var logger=require(_0x4456('0x2'))(_0x4456('0x3'));var moment=require(_0x4456('0x4'));var BPromise=require(_0x4456('0x5'));var rp=require(_0x4456('0x6'));var fs=require('fs');var path=require(_0x4456('0x7'));var rimraf=require(_0x4456('0x8'));var config=require('../../config/environment');var attributes=require(_0x4456('0x9'));module[_0x4456('0xa')]=function(_0x5d7319,_0x3ca43a){return _0x5d7319['define'](_0x4456('0xb'),attributes,{'tableName':_0x4456('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0624=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Tag','tools_tags'];(function(_0x3f0553,_0x1ee7d8){var _0x185007=function(_0x47adc1){while(--_0x47adc1){_0x3f0553['push'](_0x3f0553['shift']());}};_0x185007(++_0x1ee7d8);}(_0x0624,0x132));var _0x4062=function(_0xd215b0,_0x209320){_0xd215b0=_0xd215b0-0x0;var _0x35718d=_0x0624[_0xd215b0];return _0x35718d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4062('0x0'));var BPromise=require(_0x4062('0x1'));var rp=require(_0x4062('0x2'));var fs=require('fs');var path=require(_0x4062('0x3'));var rimraf=require(_0x4062('0x4'));var config=require(_0x4062('0x5'));var attributes=require('./tag.attributes');module['exports']=function(_0x353a85,_0x2ec6dd){return _0x353a85[_0x4062('0x6')](_0x4062('0x7'),attributes,{'tableName':_0x4062('0x8'),'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 6bfde78..17cb8ba 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 _0x0c02=['Tag,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3c372b,_0x322351){var _0x3288e9=function(_0x12e58e){while(--_0x12e58e){_0x3c372b['push'](_0x3c372b['shift']());}};_0x3288e9(++_0x322351);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var moment=require(_0x20c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c0('0x2'));var fs=require('fs');var Redis=require(_0x20c0('0x3'));var db=require(_0x20c0('0x4'))['db'];var utils=require(_0x20c0('0x5'));var logger=require(_0x20c0('0x6'))(_0x20c0('0x7'));var config=require(_0x20c0('0x8'));var jayson=require(_0x20c0('0x9'));var client=jayson[_0x20c0('0xa')][_0x20c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6408,_0x4e1dac,_0x5da127){return new BPromise(function(_0x4db532,_0x1e35e2){return client[_0x20c0('0xc')](_0x5d6408,_0x5da127)[_0x20c0('0xd')](function(_0x41a4af){logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x4e1dac,'request\x20sent',JSON['stringify'](_0x41a4af));if(_0x41a4af[_0x20c0('0x10')]){if(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x11')]===0x1f4){logger[_0x20c0('0x10')]('Tag,\x20%s,\x20%s',_0x4e1dac,_0x41a4af[_0x20c0('0x10')]['message']);return _0x1e35e2(_0x41a4af['error'][_0x20c0('0x12')]);}logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);return _0x4db532(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);}else{logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');_0x4db532(_0x41a4af[_0x20c0('0x13')][_0x20c0('0x12')]);}})[_0x20c0('0x14')](function(_0x46b9e5){logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x46b9e5);_0x1e35e2(_0x46b9e5);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3768e8,_0x4dc649){var _0x5e57a4=function(_0x4f8f5a){while(--_0x4f8f5a){_0x3768e8['push'](_0x3768e8['shift']());}};_0x5e57a4(++_0x4dc649);}(_0x6aa7,0x178));var _0x76aa=function(_0x4e1719,_0x2d563b){_0x4e1719=_0x4e1719-0x0;var _0x35b26a=_0x6aa7[_0x4e1719];return _0x35b26a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 358b295..3382739 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index c7a8aa0..7b9d804 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x45ccdb,_0x1d440e){var _0x3fed0e=function(_0x46f134){while(--_0x46f134){_0x45ccdb['push'](_0x45ccdb['shift']());}};_0x3fed0e(++_0x1d440e);}(_0x2032,0xd9));var _0x2203=function(_0x56259c,_0x47d3eb){_0x56259c=_0x56259c-0x0;var _0x5440fb=_0x2032[_0x56259c];return _0x5440fb;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 469d564..0657ca4 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 _0x71b0=['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','defaults','redis','socket.io-emitter','./team.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','Team','include','findAll','rows','catch','show','params','length','includeAll','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','Queues','addQueues','add','removeQueues','findOne','remove','ids','addAgents','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','QueueId','penalty','User','emit','Queue:save','online','upsert','isNil','interface','format','SIP/%s','voicePause','TeamVoiceQueue','all','VoicePrefixId','removeAgents','isArray','Queue:remove','UserVoiceQueueRt','getAgents','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x71b0,0x96));var _0x071b=function(_0x4cfbd8,_0x407c81){_0x4cfbd8=_0x4cfbd8-0x0;var _0x46820f=_0x71b0[_0x4cfbd8];return _0x46820f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x071b('0x0'));var zipdir=require(_0x071b('0x1'));var jsonpatch=require(_0x071b('0x2'));var rp=require('request-promise');var moment=require(_0x071b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x071b('0x4'));var path=require(_0x071b('0x5'));var sox=require('sox');var csv=require(_0x071b('0x6'));var ejs=require(_0x071b('0x7'));var fs=require('fs');var fs_extra=require(_0x071b('0x8'));var _=require('lodash');var squel=require(_0x071b('0x9'));var crypto=require(_0x071b('0xa'));var jsforce=require(_0x071b('0xb'));var deskjs=require(_0x071b('0xc'));var toCsv=require(_0x071b('0x6'));var querystring=require('querystring');var Papa=require(_0x071b('0xd'));var Redis=require(_0x071b('0xe'));var authService=require(_0x071b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x071b('0x10'));var hardwareService=require(_0x071b('0x11'));var logger=require(_0x071b('0x12'))(_0x071b('0x13'));var utils=require(_0x071b('0x14'));var config=require(_0x071b('0x15'));var licenseUtil=require(_0x071b('0x16'));var db=require(_0x071b('0x17'))['db'];config['redis']=_[_0x071b('0x18')](config[_0x071b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x071b('0x1a'))(new Redis(config[_0x071b('0x19')]));require(_0x071b('0x1b'))['register'](socket);function respondWithStatusCode(_0x279de8,_0x6e706f){_0x6e706f=_0x6e706f||0xcc;return function(_0x19cf97){if(_0x19cf97){return _0x279de8[_0x071b('0x1c')](_0x6e706f);}return _0x279de8['status'](_0x6e706f)['end']();};}function respondWithResult(_0x1d6dcb,_0x2240dc){_0x2240dc=_0x2240dc||0xc8;return function(_0x34e7a5){if(_0x34e7a5){return _0x1d6dcb[_0x071b('0x1d')](_0x2240dc)[_0x071b('0x1e')](_0x34e7a5);}};}function respondWithFilteredResult(_0x31288b,_0x29a78e){return function(_0x2c5e4d){if(_0x2c5e4d){var _0x387363=typeof _0x29a78e[_0x071b('0x1f')]==='undefined'&&typeof _0x29a78e['limit']===_0x071b('0x20');var _0x1be3df=_0x2c5e4d[_0x071b('0x21')];var _0x4a7532=_0x387363?0x0:_0x29a78e[_0x071b('0x1f')];var _0x3cac04=_0x387363?_0x2c5e4d[_0x071b('0x21')]:_0x29a78e['offset']+_0x29a78e[_0x071b('0x22')];var _0x378535;if(_0x3cac04>=_0x1be3df){_0x3cac04=_0x1be3df;_0x378535=0xc8;}else{_0x378535=0xce;}_0x31288b['status'](_0x378535);return _0x31288b[_0x071b('0x23')](_0x071b('0x24'),_0x4a7532+'-'+_0x3cac04+'/'+_0x1be3df)[_0x071b('0x1e')](_0x2c5e4d);}return null;};}function patchUpdates(_0x438072){return function(_0x4076d7){try{jsonpatch[_0x071b('0x25')](_0x4076d7,_0x438072,!![]);}catch(_0x3e247a){return BPromise[_0x071b('0x26')](_0x3e247a);}return _0x4076d7[_0x071b('0x27')]();};}function saveUpdates(_0x157693,_0x47b609){return function(_0x7d0da3){if(_0x7d0da3){return _0x7d0da3[_0x071b('0x28')](_0x157693)[_0x071b('0x29')](function(_0x1018f7){return _0x1018f7;});}return null;};}function handleEntityNotFound(_0x31d76b,_0x2f3a0a){return function(_0x20e69a){if(!_0x20e69a){_0x31d76b[_0x071b('0x1c')](0x194);}return _0x20e69a;};}function handleError(_0x556778,_0x24d920){_0x24d920=_0x24d920||0x1f4;return function(_0x25f9bf){logger['error'](_0x25f9bf[_0x071b('0x2a')]);if(_0x25f9bf[_0x071b('0x2b')]){delete _0x25f9bf[_0x071b('0x2b')];}_0x556778[_0x071b('0x1d')](_0x24d920)[_0x071b('0x2c')](_0x25f9bf);};}exports[_0x071b('0x2d')]=function(_0x189d9f,_0x4c6253){var _0xcd32ae={},_0x50ca48={},_0x25bb2e={'count':0x0,'rows':[]};var _0x3c415b=_[_0x071b('0x2e')](db['Team'][_0x071b('0x2f')],function(_0x232621){return{'name':_0x232621[_0x071b('0x30')],'type':_0x232621[_0x071b('0x31')][_0x071b('0x32')]};});_0x50ca48['model']=_[_0x071b('0x2e')](_0x3c415b,'name');_0x50ca48[_0x071b('0x33')]=_[_0x071b('0x34')](_0x189d9f[_0x071b('0x33')]);_0x50ca48[_0x071b('0x35')]=_[_0x071b('0x36')](_0x50ca48['model'],_0x50ca48[_0x071b('0x33')]);_0xcd32ae['attributes']=_[_0x071b('0x36')](_0x50ca48[_0x071b('0x37')],qs[_0x071b('0x38')](_0x189d9f[_0x071b('0x33')]['fields']));_0xcd32ae[_0x071b('0x39')]=_0xcd32ae['attributes']['length']?_0xcd32ae[_0x071b('0x39')]:_0x50ca48[_0x071b('0x37')];if(!_0x189d9f[_0x071b('0x33')][_0x071b('0x3a')](_0x071b('0x3b'))){_0xcd32ae[_0x071b('0x22')]=qs['limit'](_0x189d9f[_0x071b('0x33')]['limit']);_0xcd32ae[_0x071b('0x1f')]=qs[_0x071b('0x1f')](_0x189d9f[_0x071b('0x33')]['offset']);}_0xcd32ae[_0x071b('0x3c')]=qs['sort'](_0x189d9f['query']['sort']);_0xcd32ae[_0x071b('0x3d')]=qs[_0x071b('0x35')](_[_0x071b('0x3e')](_0x189d9f[_0x071b('0x33')],_0x50ca48['filters']),_0x3c415b);if(_0x189d9f[_0x071b('0x33')][_0x071b('0x3f')]){_0xcd32ae[_0x071b('0x3d')]=_['merge'](_0xcd32ae[_0x071b('0x3d')],{'$or':_[_0x071b('0x2e')](_0x3c415b,function(_0x12774e){if(_0x12774e['type']!==_0x071b('0x40')){var _0xf9b9db={};_0xf9b9db[_0x12774e[_0x071b('0x2b')]]={'$like':'%'+_0x189d9f[_0x071b('0x33')][_0x071b('0x3f')]+'%'};return _0xf9b9db;}})});}_0xcd32ae=_[_0x071b('0x41')]({},_0xcd32ae,_0x189d9f['options']);var _0x4af918={'where':_0xcd32ae[_0x071b('0x3d')]};return db[_0x071b('0x42')][_0x071b('0x21')](_0x4af918)[_0x071b('0x29')](function(_0x21146f){_0x25bb2e[_0x071b('0x21')]=_0x21146f;if(_0x189d9f[_0x071b('0x33')]['includeAll']){_0xcd32ae[_0x071b('0x43')]=[{'all':!![]}];}return db[_0x071b('0x42')][_0x071b('0x44')](_0xcd32ae);})[_0x071b('0x29')](function(_0x17b578){_0x25bb2e[_0x071b('0x45')]=_0x17b578;return _0x25bb2e;})['then'](respondWithFilteredResult(_0x4c6253,_0xcd32ae))[_0x071b('0x46')](handleError(_0x4c6253,null));};exports[_0x071b('0x47')]=function(_0x39f58c,_0x37d2c1){var _0xc3f191={'raw':![],'where':{'id':_0x39f58c[_0x071b('0x48')]['id']}},_0x3af6e5={};_0x3af6e5['model']=_[_0x071b('0x34')](db['Team'][_0x071b('0x2f')]);_0x3af6e5[_0x071b('0x33')]=_[_0x071b('0x34')](_0x39f58c[_0x071b('0x33')]);_0x3af6e5[_0x071b('0x35')]=_['intersection'](_0x3af6e5[_0x071b('0x37')],_0x3af6e5[_0x071b('0x33')]);_0xc3f191['attributes']=_[_0x071b('0x36')](_0x3af6e5[_0x071b('0x37')],qs['fields'](_0x39f58c[_0x071b('0x33')][_0x071b('0x38')]));_0xc3f191[_0x071b('0x39')]=_0xc3f191[_0x071b('0x39')][_0x071b('0x49')]?_0xc3f191[_0x071b('0x39')]:_0x3af6e5[_0x071b('0x37')];if(_0x39f58c[_0x071b('0x33')][_0x071b('0x4a')]){_0xc3f191['include']=[{'all':!![]}];}_0xc3f191=_[_0x071b('0x41')]({},_0xc3f191,_0x39f58c[_0x071b('0x4b')]);return db['Team'][_0x071b('0x4c')](_0xc3f191)['then'](handleEntityNotFound(_0x37d2c1,null))[_0x071b('0x29')](respondWithResult(_0x37d2c1,null))['catch'](handleError(_0x37d2c1,null));};exports['create']=function(_0x45b7a2,_0x3890de){return db['Team']['create'](_0x45b7a2[_0x071b('0x4d')],{})[_0x071b('0x29')](function(_0x604ffa){var _0x2f1d2f=_0x45b7a2[_0x071b('0x4e')][_0x071b('0x4f')]({'plain':!![]});if(!_0x2f1d2f)throw new Error(_0x071b('0x50'));if(_0x2f1d2f[_0x071b('0x51')]==='user'){var _0x2a1b4c=_0x604ffa[_0x071b('0x4f')]({'plain':!![]});var _0x5153b9='Teams';return db[_0x071b('0x52')][_0x071b('0x4c')]({'where':{'name':_0x5153b9,'userProfileId':_0x2f1d2f[_0x071b('0x53')]},'raw':!![]})[_0x071b('0x29')](function(_0x20f3a7){if(_0x20f3a7&&_0x20f3a7[_0x071b('0x54')]===0x0){return db[_0x071b('0x55')][_0x071b('0x56')]({'name':_0x2a1b4c[_0x071b('0x2b')],'resourceId':_0x2a1b4c['id'],'type':_0x20f3a7[_0x071b('0x2b')],'sectionId':_0x20f3a7['id']},{})[_0x071b('0x29')](function(){return _0x604ffa;});}else{return _0x604ffa;}})[_0x071b('0x46')](function(_0x229974){logger[_0x071b('0x57')](_0x071b('0x58'),_0x229974);throw _0x229974;});}return _0x604ffa;})[_0x071b('0x29')](respondWithResult(_0x3890de,0xc9))['catch'](handleError(_0x3890de,null));};exports[_0x071b('0x28')]=function(_0x46ed96,_0x3528be){if(_0x46ed96[_0x071b('0x4d')]['id']){delete _0x46ed96['body']['id'];}return db[_0x071b('0x42')][_0x071b('0x4c')]({'where':{'id':_0x46ed96[_0x071b('0x48')]['id']}})[_0x071b('0x29')](handleEntityNotFound(_0x3528be,null))['then'](saveUpdates(_0x46ed96[_0x071b('0x4d')],null))[_0x071b('0x29')](respondWithResult(_0x3528be,null))['catch'](handleError(_0x3528be,null));};exports[_0x071b('0x59')]=function(_0x82d887,_0x3cbb80){var _0x116169=_0x82d887[_0x071b('0x48')]['id'];var _0x22ceca=[];return db['sequelize'][_0x071b('0x5a')](function(_0x47f3f7){var _0x2ba4a5=_0x071b('0x5b')+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0x2ba4a5,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7})[_0x071b('0x29')](function(_0x46ca1c){_0x22ceca=_['map'](_0x46ca1c,function(_0x504189){return Number(_0x504189[_0x071b('0x60')]);});})[_0x071b('0x29')](function(){var _0x39775d=_0x071b('0x61')+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0x39775d,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})['then'](function(_0x5cab07){var _0x22a2cb=_[_0x071b('0x2e')](_0x5cab07,function(_0x5d01c3){return Number(_0x5d01c3[_0x071b('0x62')]);});return db[_0x071b('0x63')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'VoiceQueueId':{'$in':_0x22a2cb}},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){var _0x12148f='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0x12148f,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x24020f){var _0x4ade4f=_[_0x071b('0x2e')](_0x24020f,function(_0x50af7c){return Number(_0x50af7c[_0x071b('0x64')]);});return db[_0x071b('0x65')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'MailQueueId':{'$in':_0x4ade4f}},'transaction':_0x47f3f7});})['then'](function(){var _0x310318=_0x071b('0x66')+_0x116169;return db['sequelize'][_0x071b('0x33')](_0x310318,{'type':db['Sequelize']['QueryTypes'][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x37d281){var _0x19f494=_[_0x071b('0x2e')](_0x37d281,function(_0x524220){return Number(_0x524220[_0x071b('0x67')]);});return db[_0x071b('0x68')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'SmsQueueId':{'$in':_0x19f494}},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){var _0x7f5927=_0x071b('0x69')+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0x7f5927,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x1d28a9){var _0x8c7441=_[_0x071b('0x2e')](_0x1d28a9,function(_0x11a794){return Number(_0x11a794[_0x071b('0x6a')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x22ceca},'ChatQueueId':{'$in':_0x8c7441}},'transaction':_0x47f3f7});})['then'](function(){var _0xda2c1c=_0x071b('0x6b')+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0xda2c1c,{'type':db['Sequelize']['QueryTypes'][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x161cc5){var _0x1025d5=_['map'](_0x161cc5,function(_0x16cedc){return Number(_0x16cedc[_0x071b('0x6c')]);});return db[_0x071b('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x22ceca},'FaxQueueId':{'$in':_0x1025d5}},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){var _0x143325=_0x071b('0x6e')+_0x116169;return db[_0x071b('0x5c')][_0x071b('0x33')](_0x143325,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')][_0x071b('0x5f')],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0xc507ef){var _0x534c54=_[_0x071b('0x2e')](_0xc507ef,function(_0x5b8485){return Number(_0x5b8485['OpenchannelQueueId']);});return db[_0x071b('0x6f')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'OpenchannelQueueId':{'$in':_0x534c54}},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){var _0x300dc2=_0x071b('0x70')+_0x116169;return db['sequelize'][_0x071b('0x33')](_0x300dc2,{'type':db[_0x071b('0x5d')][_0x071b('0x5e')]['SELECT'],'raw':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x1bd2b3){var _0x1b3f23=_['map'](_0x1bd2b3,function(_0x267ed9){return Number(_0x267ed9[_0x071b('0x71')]);});return db[_0x071b('0x72')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'WhatsappQueueId':{'$in':_0x1b3f23}},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){return db[_0x071b('0x73')][_0x071b('0x4c')]({'where':{'TeamId':_0x116169}});})[_0x071b('0x29')](function(_0x2c03c3){if(_0x2c03c3===null){return;}return db[_0x071b('0x74')][_0x071b('0x59')]({'where':{'UserId':{'$in':_0x22ceca},'VoicePrefixId':_0x2c03c3['VoicePrefixId']},'transaction':_0x47f3f7});})[_0x071b('0x29')](function(){return db[_0x071b('0x42')][_0x071b('0x59')]({'where':{'id':_0x116169},'cascade':!![],'transaction':_0x47f3f7});})[_0x071b('0x29')](function(_0x2cad87){if(_0x2cad87===0x0){_0x3cbb80[_0x071b('0x1c')](0x194);}else{return db[_0x071b('0x55')][_0x071b('0x59')]({'where':{'type':'Teams','resourceId':_0x116169},'cascade':!![],'transaction':_0x47f3f7})[_0x071b('0x29')](function(){_0x3cbb80[_0x071b('0x1d')](0xcc)['end']();});}})['catch'](function(_0x11d956){_0x3cbb80['status'](0x1f4)[_0x071b('0x2c')](_0x11d956);});});};exports[_0x071b('0x75')]=function(_0x20dc35,_0xd102e8,_0x534bcd){return db[_0x071b('0x42')]['findOne']({'where':{'id':_0x20dc35['params']['id']}})[_0x071b('0x29')](handleEntityNotFound(_0xd102e8,null))['then'](function(_0x4445ec){if(!_0x20dc35[_0x071b('0x33')][_0x071b('0x76')]||!utils[_0x071b('0x77')](_0x20dc35[_0x071b('0x33')]['channel'])){throw new db[(_0x071b('0x5d'))][(_0x071b('0x78'))](_0x071b('0x79'));}var _0x475306={};var _0xc4e796={};_0xc4e796[_0x071b('0x37')]=_[_0x071b('0x34')](db[_[_0x071b('0x7a')](_0x20dc35[_0x071b('0x33')][_0x071b('0x76')][_0x071b('0x7b')]())+_0x071b('0x7c')][_0x071b('0x2f')]);_0xc4e796['query']=_['keys'](_0x20dc35[_0x071b('0x33')]);_0xc4e796['filters']=_[_0x071b('0x36')](_0xc4e796['model'],_0xc4e796[_0x071b('0x33')]);_0x475306['attributes']=_[_0x071b('0x36')](_0xc4e796[_0x071b('0x37')],qs['fields'](_0x20dc35['query'][_0x071b('0x38')]));_0x475306[_0x071b('0x39')]=_0x475306['attributes'][_0x071b('0x49')]?_0x475306[_0x071b('0x39')]:_0xc4e796['model'];_0x475306[_0x071b('0x22')]=qs[_0x071b('0x22')](_0x20dc35[_0x071b('0x33')][_0x071b('0x22')]);_0x475306[_0x071b('0x1f')]=qs[_0x071b('0x1f')](_0x20dc35[_0x071b('0x33')][_0x071b('0x1f')]);_0x475306[_0x071b('0x3c')]=qs[_0x071b('0x7d')](_0x20dc35[_0x071b('0x33')][_0x071b('0x7d')]);_0x475306[_0x071b('0x3d')]=qs[_0x071b('0x35')](_[_0x071b('0x3e')](_0x20dc35[_0x071b('0x33')],_0xc4e796[_0x071b('0x35')]));_0x475306=_[_0x071b('0x41')]({},_0x475306,_0x20dc35[_0x071b('0x4b')]);return _0x4445ec[_0x071b('0x4f')+_['capitalize'](_0x20dc35[_0x071b('0x33')][_0x071b('0x76')][_0x071b('0x7b')]())+_0x071b('0x7e')](_0x475306);})[_0x071b('0x29')](respondWithResult(_0xd102e8,null))[_0x071b('0x46')](handleError(_0xd102e8,null));};exports[_0x071b('0x7f')]=function(_0x191267,_0xe911f5,_0x286df8){return db[_0x071b('0x42')]['findOne']({'where':{'id':_0x191267[_0x071b('0x48')]['id']}})[_0x071b('0x29')](function(_0x492fc5){if(_0x492fc5){if(!_0x191267['body']['channel']||!utils[_0x071b('0x77')](_0x191267[_0x071b('0x4d')][_0x071b('0x76')])){throw new db[(_0x071b('0x5d'))][(_0x071b('0x78'))](_0x071b('0x79'));}return _0x492fc5[_0x071b('0x80')+_[_0x071b('0x7a')](_0x191267[_0x071b('0x4d')][_0x071b('0x76')][_0x071b('0x7b')]())+_0x071b('0x7e')](_0x191267[_0x071b('0x4d')]['ids']);}return null;})['then'](handleEntityNotFound(_0xe911f5,null))[_0x071b('0x29')](respondWithStatusCode(_0xe911f5,null))['catch'](handleError(_0xe911f5,null));};exports[_0x071b('0x81')]=function(_0x5140dc,_0x15a6f9,_0x348bcc){return db['Team'][_0x071b('0x82')]({'where':{'id':_0x5140dc[_0x071b('0x48')]['id']}})[_0x071b('0x29')](function(_0x184888){if(_0x184888){if(!_0x5140dc['query']['channel']||!utils[_0x071b('0x77')](_0x5140dc[_0x071b('0x33')][_0x071b('0x76')])){throw new db[(_0x071b('0x5d'))]['ValidationError'](_0x071b('0x79'));}return _0x184888[_0x071b('0x83')+_['capitalize'](_0x5140dc[_0x071b('0x33')][_0x071b('0x76')][_0x071b('0x7b')]())+'Queues'](_0x5140dc['query'][_0x071b('0x84')]);}return null;})[_0x071b('0x29')](handleEntityNotFound(_0x15a6f9,null))[_0x071b('0x29')](respondWithStatusCode(_0x15a6f9,null))[_0x071b('0x46')](handleError(_0x15a6f9,null));};exports[_0x071b('0x85')]=function(_0x51a765,_0x5ee135){var _0x5bac96=_['isArray'](_0x51a765[_0x071b('0x4d')][_0x071b('0x84')])?_0x51a765[_0x071b('0x4d')][_0x071b('0x84')]:[_0x51a765[_0x071b('0x4d')][_0x071b('0x84')]];var _0x51b0f9=_0x51a765[_0x071b('0x48')]['id'];return db[_0x071b('0x42')][_0x071b('0x4c')]({'where':{'id':_0x51b0f9}})['then'](handleEntityNotFound(_0x5ee135,null))['then'](function(_0x2fccd0){if(_0x2fccd0){var _0x25d2a9=['Voice',_0x071b('0x86'),_0x071b('0x87'),_0x071b('0x88'),_0x071b('0x89'),_0x071b('0x8a'),_0x071b('0x8b')];return db[_0x071b('0x5c')]['transaction'](function(_0x330a8f){var _0x4b4942=_[_0x071b('0x2e')](_0x25d2a9,function(_0x245b4a){var _0x222337={'attributes':['id',_0x071b('0x2b')]};if(_0x245b4a===_0x071b('0x8c')){_0x222337['through']={'attributes':['penalty']};}return _0x2fccd0[_0x071b('0x4f')+_0x245b4a+_0x071b('0x7e')](_0x222337)[_0x071b('0x29')](function(_0x441aa6){var _0x46b9a7=_[_0x071b('0x2e')](_0x441aa6,function(_0x27ee20){var _0x23524c=_['map'](_0x5bac96,function(_0x3b7c53){var _0x4f5420={'where':{'UserId':_0x3b7c53,[_0x245b4a+_0x071b('0x8d')]:_0x27ee20['id']},'transaction':_0x330a8f};if(_0x245b4a===_0x071b('0x8c')){_0x4f5420[_0x071b('0x18')]={'penalty':_0x27ee20['TeamVoiceQueue'][_0x071b('0x8e')]};}return db[_0x071b('0x8f')+_0x245b4a+_0x071b('0x7c')]['findOrCreate'](_0x4f5420)[_0x071b('0x29')](function(){socket[_0x071b('0x90')](_0x071b('0x4e')+_0x245b4a+_0x071b('0x91'),{'UserId':_0x3b7c53,[_0x245b4a+'QueueId']:_0x27ee20['id']});if(_0x245b4a!==_0x071b('0x8c')){return;}return db[_0x071b('0x8f')][_0x071b('0x44')]({'where':{'id':_0x5bac96,'online':0x1},'attributes':['id',_0x071b('0x2b'),_0x071b('0x92'),'voicePause','interface'],'raw':!![]})[_0x071b('0x29')](function(_0x337731){var _0x566f8d=_[_0x071b('0x2e')](_0x337731,function(_0x4ef9d6){return db['UserVoiceQueueRt'][_0x071b('0x93')]({'membername':_0x4ef9d6['name'],'UserId':_0x4ef9d6['id'],'queue_name':_0x27ee20[_0x071b('0x2b')],'VoiceQueueId':_0x27ee20['id'],'interface':_[_0x071b('0x94')](_0x4ef9d6[_0x071b('0x95')])?util[_0x071b('0x96')](_0x071b('0x97'),_0x4ef9d6[_0x071b('0x2b')]):_0x4ef9d6['interface'],'paused':_0x4ef9d6[_0x071b('0x98')]||![],'penalty':_0x27ee20[_0x071b('0x99')][_0x071b('0x8e')]},{'transaction':_0x330a8f});});return Promise[_0x071b('0x9a')](_0x566f8d);});});});return Promise[_0x071b('0x9a')](_0x23524c);});return Promise['all'](_0x46b9a7);})['then'](function(){return db[_0x071b('0x73')][_0x071b('0x82')]({'where':{'teamId':_0x51b0f9}})[_0x071b('0x29')](function(_0x25342a){if(_0x25342a){var _0x535305=_[_0x071b('0x2e')](_0x5bac96,function(_0x2fada5){db[_0x071b('0x74')]['upsert']({'UserId':_0x2fada5,'VoicePrefixId':_0x25342a[_0x071b('0x9b')]});});return Promise['all'](_0x535305);}});});});return Promise[_0x071b('0x9a')](_0x4b4942)[_0x071b('0x29')](function(){return _0x2fccd0[_0x071b('0x85')](_0x5bac96,{'transaction':_0x330a8f})['spread'](function(_0x28a5ef){return _0x28a5ef;});});});}})[_0x071b('0x29')](respondWithResult(_0x5ee135,null))[_0x071b('0x46')](handleError(_0x5ee135,null));};exports[_0x071b('0x9c')]=function(_0x370640,_0x4ebbc3){var _0x4a6249=_[_0x071b('0x9d')](_0x370640[_0x071b('0x33')][_0x071b('0x84')])?_0x370640[_0x071b('0x33')][_0x071b('0x84')]:[_0x370640['query']['ids']];var _0x1b8501=_0x370640['params']['id'];return db[_0x071b('0x42')][_0x071b('0x4c')]({'where':{'id':_0x1b8501}})[_0x071b('0x29')](handleEntityNotFound(_0x4ebbc3,null))[_0x071b('0x29')](function(_0x48034d){if(_0x48034d){var _0x2520a0=['Voice',_0x071b('0x86'),_0x071b('0x87'),_0x071b('0x88'),_0x071b('0x89'),_0x071b('0x8a'),_0x071b('0x8b')];return db['sequelize'][_0x071b('0x5a')](function(_0x401430){var _0x105b64=_['map'](_0x2520a0,function(_0x568eea){var _0x121e49={'attributes':['id',_0x071b('0x2b')]};return _0x48034d[_0x071b('0x4f')+_0x568eea+_0x071b('0x7e')](_0x121e49)['then'](function(_0x433c05){var _0x548a5e=_['map'](_0x433c05,function(_0x332776){return _0x332776[_0x071b('0x9c')](_0x4a6249,{'transaction':_0x401430})['then'](function(){var _0x4abe06=_['map'](_0x4a6249,function(_0x26bb9c){socket[_0x071b('0x90')](_0x071b('0x4e')+_0x568eea+_0x071b('0x9e'),{'UserId':Number(_0x26bb9c),[_0x568eea+'QueueId']:_0x332776['id']});if(_0x568eea!==_0x071b('0x8c')){return;}return db[_0x071b('0x9f')][_0x071b('0x59')]({'where':{'VoiceQueueId':_0x332776['id'],'UserId':_0x26bb9c},'transaction':_0x401430});});return Promise['all'](_0x4abe06);});});return Promise['all'](_0x548a5e);});});return Promise[_0x071b('0x9a')](_0x105b64)['then'](function(){return _0x48034d[_0x071b('0x9c')](_0x4a6249,{'transaction':_0x401430});})[_0x071b('0x29')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1b8501}})[_0x071b('0x29')](function(_0x1fdcd7){if(_0x1fdcd7){var _0x1a12d1=_[_0x071b('0x2e')](_0x4a6249,function(_0x513773){db[_0x071b('0x74')][_0x071b('0x59')]({'where':{'UserId':_0x513773,'VoicePrefixId':_0x1fdcd7[_0x071b('0x9b')]}});});return Promise[_0x071b('0x9a')](_0x1a12d1);}});});});}})[_0x071b('0x29')](respondWithStatusCode(_0x4ebbc3,null))[_0x071b('0x46')](handleError(_0x4ebbc3,null));};exports[_0x071b('0xa0')]=function(_0x5e033d,_0x1663a5,_0x6632eb){var _0x3891da={};var _0x3b66b9={};var _0x5d55de;var _0x4a6e02;return db[_0x071b('0x42')][_0x071b('0x82')]({'where':{'id':_0x5e033d[_0x071b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1663a5,null))[_0x071b('0x29')](function(_0xebffc){if(_0xebffc){_0x5d55de=_0xebffc;_0x3b66b9[_0x071b('0x37')]=_[_0x071b('0x34')](db['User'][_0x071b('0x2f')]);_0x3b66b9['query']=_[_0x071b('0x34')](_0x5e033d[_0x071b('0x33')]);_0x3b66b9[_0x071b('0x35')]=_['intersection'](_0x3b66b9['model'],_0x3b66b9[_0x071b('0x33')]);_0x3891da['attributes']=_[_0x071b('0x36')](_0x3b66b9[_0x071b('0x37')],qs[_0x071b('0x38')](_0x5e033d['query']['fields']));_0x3891da[_0x071b('0x39')]=_0x3891da[_0x071b('0x39')][_0x071b('0x49')]?_0x3891da['attributes']:_0x3b66b9[_0x071b('0x37')];_0x3891da[_0x071b('0x3c')]=qs[_0x071b('0x7d')](_0x5e033d[_0x071b('0x33')][_0x071b('0x7d')]);_0x3891da['where']=qs[_0x071b('0x35')](_[_0x071b('0x3e')](_0x5e033d['query'],_0x3b66b9[_0x071b('0x35')]));if(_0x5e033d[_0x071b('0x33')][_0x071b('0x3f')]){_0x3891da['where']=_[_0x071b('0x41')](_0x3891da[_0x071b('0x3d')],{'$or':_[_0x071b('0x2e')](_0x3891da['attributes'],function(_0x58db5b){var _0x4d8e0b={};_0x4d8e0b[_0x58db5b]={'$like':'%'+_0x5e033d['query']['filter']+'%'};return _0x4d8e0b;})});}_0x3891da=_['merge']({},_0x3891da,_0x5e033d[_0x071b('0x4b')]);return _0x5d55de['getAgents'](_0x3891da);}})[_0x071b('0x29')](function(_0x312128){if(_0x312128){_0x4a6e02=_0x312128[_0x071b('0x49')];if(!_0x5e033d['query'][_0x071b('0x3a')](_0x071b('0x3b'))){_0x3891da[_0x071b('0x22')]=qs['limit'](_0x5e033d[_0x071b('0x33')]['limit']);_0x3891da[_0x071b('0x1f')]=qs[_0x071b('0x1f')](_0x5e033d[_0x071b('0x33')][_0x071b('0x1f')]);}return _0x5d55de[_0x071b('0xa0')](_0x3891da);}})[_0x071b('0x29')](function(_0x309376){if(_0x309376){return _0x309376?{'count':_0x4a6e02,'rows':_0x309376}:null;}})['then'](respondWithResult(_0x1663a5,null))['catch'](handleError(_0x1663a5,null));}; \ No newline at end of file +var _0x39c6=['Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','isArray','Mail','Sms','Fax','Whatsapp','Voice','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','spread','removeAgents','Chat','UserVoicePrefix','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','save','update','sendStatus','error','stack','name','send','Team','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','rows','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x39c6,0x160));var _0x639c=function(_0x4810e3,_0x23527c){_0x4810e3=_0x4810e3-0x0;var _0x45bfc9=_0x39c6[_0x4810e3];return _0x45bfc9;};'use strict';var emlformat=require(_0x639c('0x0'));var rimraf=require(_0x639c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x639c('0x2'));var rp=require(_0x639c('0x3'));var moment=require(_0x639c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x639c('0x5'));var util=require(_0x639c('0x6'));var path=require(_0x639c('0x7'));var sox=require(_0x639c('0x8'));var csv=require(_0x639c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x639c('0xa'));var _=require(_0x639c('0xb'));var squel=require(_0x639c('0xc'));var crypto=require(_0x639c('0xd'));var jsforce=require(_0x639c('0xe'));var deskjs=require(_0x639c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x639c('0x10'));var Papa=require('papaparse');var Redis=require(_0x639c('0x11'));var authService=require(_0x639c('0x12'));var qs=require(_0x639c('0x13'));var as=require(_0x639c('0x14'));var hardwareService=require(_0x639c('0x15'));var logger=require(_0x639c('0x16'))(_0x639c('0x17'));var utils=require(_0x639c('0x18'));var config=require(_0x639c('0x19'));var licenseUtil=require(_0x639c('0x1a'));var db=require(_0x639c('0x1b'))['db'];config[_0x639c('0x1c')]=_[_0x639c('0x1d')](config[_0x639c('0x1c')],{'host':_0x639c('0x1e'),'port':0x18eb});var socket=require(_0x639c('0x1f'))(new Redis(config[_0x639c('0x1c')]));require(_0x639c('0x20'))[_0x639c('0x21')](socket);function respondWithStatusCode(_0x1157ca,_0x4e3c79){_0x4e3c79=_0x4e3c79||0xcc;return function(_0x53123b){if(_0x53123b){return _0x1157ca['sendStatus'](_0x4e3c79);}return _0x1157ca['status'](_0x4e3c79)['end']();};}function respondWithResult(_0x4da85c,_0x3fcacd){_0x3fcacd=_0x3fcacd||0xc8;return function(_0x135ef0){if(_0x135ef0){return _0x4da85c[_0x639c('0x22')](_0x3fcacd)[_0x639c('0x23')](_0x135ef0);}};}function respondWithFilteredResult(_0x4a750a,_0x13e0ef){return function(_0x1f09be){if(_0x1f09be){var _0x29943a=typeof _0x13e0ef[_0x639c('0x24')]===_0x639c('0x25')&&typeof _0x13e0ef[_0x639c('0x26')]===_0x639c('0x25');var _0x47a09a=_0x1f09be[_0x639c('0x27')];var _0x49cd29=_0x29943a?0x0:_0x13e0ef[_0x639c('0x24')];var _0x2c9f1b=_0x29943a?_0x1f09be[_0x639c('0x27')]:_0x13e0ef['offset']+_0x13e0ef[_0x639c('0x26')];var _0x5466c0;if(_0x2c9f1b>=_0x47a09a){_0x2c9f1b=_0x47a09a;_0x5466c0=0xc8;}else{_0x5466c0=0xce;}_0x4a750a[_0x639c('0x22')](_0x5466c0);return _0x4a750a[_0x639c('0x28')]('Content-Range',_0x49cd29+'-'+_0x2c9f1b+'/'+_0x47a09a)[_0x639c('0x23')](_0x1f09be);}return null;};}function patchUpdates(_0x17af67){return function(_0x4650d4){try{jsonpatch['apply'](_0x4650d4,_0x17af67,!![]);}catch(_0x3fb3be){return BPromise['reject'](_0x3fb3be);}return _0x4650d4[_0x639c('0x29')]();};}function saveUpdates(_0x43ba5c,_0x1b4326){return function(_0x45574e){if(_0x45574e){return _0x45574e[_0x639c('0x2a')](_0x43ba5c)['then'](function(_0x539a66){return _0x539a66;});}return null;};}function handleEntityNotFound(_0x215fa3,_0x56b7fa){return function(_0x1c29f7){if(!_0x1c29f7){_0x215fa3[_0x639c('0x2b')](0x194);}return _0x1c29f7;};}function handleError(_0x16631a,_0x37c1de){_0x37c1de=_0x37c1de||0x1f4;return function(_0x390d9b){logger[_0x639c('0x2c')](_0x390d9b[_0x639c('0x2d')]);if(_0x390d9b[_0x639c('0x2e')]){delete _0x390d9b[_0x639c('0x2e')];}_0x16631a[_0x639c('0x22')](_0x37c1de)[_0x639c('0x2f')](_0x390d9b);};}exports['index']=function(_0x4e0c5b,_0x2c61e6){var _0x1f9bc2={},_0x2fdc14={},_0x2fe151={'count':0x0,'rows':[]};var _0x567fca=_['map'](db[_0x639c('0x30')][_0x639c('0x31')],function(_0x2cdfde){return{'name':_0x2cdfde['fieldName'],'type':_0x2cdfde[_0x639c('0x32')][_0x639c('0x33')]};});_0x2fdc14[_0x639c('0x34')]=_[_0x639c('0x35')](_0x567fca,'name');_0x2fdc14['query']=_[_0x639c('0x36')](_0x4e0c5b[_0x639c('0x37')]);_0x2fdc14[_0x639c('0x38')]=_[_0x639c('0x39')](_0x2fdc14['model'],_0x2fdc14[_0x639c('0x37')]);_0x1f9bc2[_0x639c('0x3a')]=_[_0x639c('0x39')](_0x2fdc14['model'],qs['fields'](_0x4e0c5b[_0x639c('0x37')][_0x639c('0x3b')]));_0x1f9bc2[_0x639c('0x3a')]=_0x1f9bc2[_0x639c('0x3a')][_0x639c('0x3c')]?_0x1f9bc2[_0x639c('0x3a')]:_0x2fdc14['model'];if(!_0x4e0c5b[_0x639c('0x37')][_0x639c('0x3d')](_0x639c('0x3e'))){_0x1f9bc2[_0x639c('0x26')]=qs[_0x639c('0x26')](_0x4e0c5b[_0x639c('0x37')][_0x639c('0x26')]);_0x1f9bc2[_0x639c('0x24')]=qs[_0x639c('0x24')](_0x4e0c5b[_0x639c('0x37')][_0x639c('0x24')]);}_0x1f9bc2['order']=qs[_0x639c('0x3f')](_0x4e0c5b['query'][_0x639c('0x3f')]);_0x1f9bc2['where']=qs[_0x639c('0x38')](_[_0x639c('0x40')](_0x4e0c5b[_0x639c('0x37')],_0x2fdc14[_0x639c('0x38')]),_0x567fca);if(_0x4e0c5b['query'][_0x639c('0x41')]){_0x1f9bc2[_0x639c('0x42')]=_[_0x639c('0x43')](_0x1f9bc2[_0x639c('0x42')],{'$or':_[_0x639c('0x35')](_0x567fca,function(_0xa74343){if(_0xa74343[_0x639c('0x32')]!==_0x639c('0x44')){var _0x3b7f0d={};_0x3b7f0d[_0xa74343[_0x639c('0x2e')]]={'$like':'%'+_0x4e0c5b[_0x639c('0x37')]['filter']+'%'};return _0x3b7f0d;}})});}_0x1f9bc2=_[_0x639c('0x43')]({},_0x1f9bc2,_0x4e0c5b['options']);var _0x5a1a00={'where':_0x1f9bc2[_0x639c('0x42')]};return db[_0x639c('0x30')]['count'](_0x5a1a00)[_0x639c('0x45')](function(_0x58e375){_0x2fe151[_0x639c('0x27')]=_0x58e375;if(_0x4e0c5b['query'][_0x639c('0x46')]){_0x1f9bc2[_0x639c('0x47')]=[{'all':!![]}];}return db[_0x639c('0x30')]['findAll'](_0x1f9bc2);})[_0x639c('0x45')](function(_0x577ce5){_0x2fe151[_0x639c('0x48')]=_0x577ce5;return _0x2fe151;})[_0x639c('0x45')](respondWithFilteredResult(_0x2c61e6,_0x1f9bc2))['catch'](handleError(_0x2c61e6,null));};exports['show']=function(_0x237f33,_0x4366cb){var _0x2bee38={'raw':![],'where':{'id':_0x237f33[_0x639c('0x49')]['id']}},_0x4fd097={};_0x4fd097['model']=_[_0x639c('0x36')](db[_0x639c('0x30')][_0x639c('0x31')]);_0x4fd097['query']=_[_0x639c('0x36')](_0x237f33[_0x639c('0x37')]);_0x4fd097[_0x639c('0x38')]=_[_0x639c('0x39')](_0x4fd097[_0x639c('0x34')],_0x4fd097[_0x639c('0x37')]);_0x2bee38['attributes']=_[_0x639c('0x39')](_0x4fd097[_0x639c('0x34')],qs['fields'](_0x237f33['query']['fields']));_0x2bee38['attributes']=_0x2bee38[_0x639c('0x3a')][_0x639c('0x3c')]?_0x2bee38[_0x639c('0x3a')]:_0x4fd097['model'];if(_0x237f33[_0x639c('0x37')]['includeAll']){_0x2bee38['include']=[{'all':!![]}];}_0x2bee38=_[_0x639c('0x43')]({},_0x2bee38,_0x237f33[_0x639c('0x4a')]);return db[_0x639c('0x30')][_0x639c('0x4b')](_0x2bee38)['then'](handleEntityNotFound(_0x4366cb,null))[_0x639c('0x45')](respondWithResult(_0x4366cb,null))['catch'](handleError(_0x4366cb,null));};exports[_0x639c('0x4c')]=function(_0x2ed926,_0x6f02b){return db[_0x639c('0x30')][_0x639c('0x4c')](_0x2ed926[_0x639c('0x4d')],{})['then'](function(_0x41a2e7){var _0x1ca378=_0x2ed926[_0x639c('0x4e')][_0x639c('0x4f')]({'plain':!![]});if(!_0x1ca378)throw new Error(_0x639c('0x50'));if(_0x1ca378[_0x639c('0x51')]===_0x639c('0x4e')){var _0x43ddb3=_0x41a2e7['get']({'plain':!![]});var _0x56741e=_0x639c('0x52');return db[_0x639c('0x53')][_0x639c('0x4b')]({'where':{'name':_0x56741e,'userProfileId':_0x1ca378[_0x639c('0x54')]},'raw':!![]})[_0x639c('0x45')](function(_0x1cf6b7){if(_0x1cf6b7&&_0x1cf6b7[_0x639c('0x55')]===0x0){return db[_0x639c('0x56')]['create']({'name':_0x43ddb3[_0x639c('0x2e')],'resourceId':_0x43ddb3['id'],'type':_0x1cf6b7[_0x639c('0x2e')],'sectionId':_0x1cf6b7['id']},{})['then'](function(){return _0x41a2e7;});}else{return _0x41a2e7;}})['catch'](function(_0x532fb4){logger[_0x639c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532fb4);throw _0x532fb4;});}return _0x41a2e7;})[_0x639c('0x45')](respondWithResult(_0x6f02b,0xc9))[_0x639c('0x57')](handleError(_0x6f02b,null));};exports['update']=function(_0x20c930,_0x58b02b){if(_0x20c930[_0x639c('0x4d')]['id']){delete _0x20c930['body']['id'];}return db[_0x639c('0x30')][_0x639c('0x4b')]({'where':{'id':_0x20c930['params']['id']}})['then'](handleEntityNotFound(_0x58b02b,null))['then'](saveUpdates(_0x20c930[_0x639c('0x4d')],null))[_0x639c('0x45')](respondWithResult(_0x58b02b,null))[_0x639c('0x57')](handleError(_0x58b02b,null));};exports[_0x639c('0x58')]=function(_0x54015e,_0x3f849d){var _0x24d409=_0x54015e[_0x639c('0x49')]['id'];var _0x31a85c=[];return db[_0x639c('0x59')][_0x639c('0x5a')](function(_0x5bed35){var _0x15c564='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x24d409;return db['sequelize']['query'](_0x15c564,{'type':db[_0x639c('0x5b')][_0x639c('0x5c')][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35})[_0x639c('0x45')](function(_0x3cd99c){_0x31a85c=_[_0x639c('0x35')](_0x3cd99c,function(_0x33dc57){return Number(_0x33dc57[_0x639c('0x5e')]);});})[_0x639c('0x45')](function(){var _0x4952ef='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x24d409;return db[_0x639c('0x59')][_0x639c('0x37')](_0x4952ef,{'type':db[_0x639c('0x5b')]['QueryTypes'][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35});})['then'](function(_0x2495f6){var _0x1ceae0=_[_0x639c('0x35')](_0x2495f6,function(_0x5d7e23){return Number(_0x5d7e23[_0x639c('0x5f')]);});return db[_0x639c('0x60')][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'VoiceQueueId':{'$in':_0x1ceae0}},'transaction':_0x5bed35});})['then'](function(){var _0x302f5f=_0x639c('0x61')+_0x24d409;return db[_0x639c('0x59')][_0x639c('0x37')](_0x302f5f,{'type':db['Sequelize'][_0x639c('0x5c')][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35});})['then'](function(_0x29fb0e){var _0x5202ca=_[_0x639c('0x35')](_0x29fb0e,function(_0x343f75){return Number(_0x343f75[_0x639c('0x62')]);});return db[_0x639c('0x63')]['destroy']({'where':{'UserId':{'$in':_0x31a85c},'MailQueueId':{'$in':_0x5202ca}},'transaction':_0x5bed35});})['then'](function(){var _0x40e9a2=_0x639c('0x64')+_0x24d409;return db['sequelize'][_0x639c('0x37')](_0x40e9a2,{'type':db[_0x639c('0x5b')][_0x639c('0x5c')]['SELECT'],'raw':!![],'transaction':_0x5bed35});})[_0x639c('0x45')](function(_0x52a176){var _0x35bad7=_[_0x639c('0x35')](_0x52a176,function(_0x41a5f2){return Number(_0x41a5f2[_0x639c('0x65')]);});return db[_0x639c('0x66')][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'SmsQueueId':{'$in':_0x35bad7}},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){var _0xe6c1d3='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x24d409;return db[_0x639c('0x59')][_0x639c('0x37')](_0xe6c1d3,{'type':db['Sequelize'][_0x639c('0x5c')]['SELECT'],'raw':!![],'transaction':_0x5bed35});})[_0x639c('0x45')](function(_0x252b3d){var _0x11b3ae=_[_0x639c('0x35')](_0x252b3d,function(_0x48079b){return Number(_0x48079b[_0x639c('0x67')]);});return db[_0x639c('0x68')][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'ChatQueueId':{'$in':_0x11b3ae}},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){var _0x48918f=_0x639c('0x69')+_0x24d409;return db[_0x639c('0x59')][_0x639c('0x37')](_0x48918f,{'type':db[_0x639c('0x5b')][_0x639c('0x5c')][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35});})[_0x639c('0x45')](function(_0x54cc4){var _0x1c8a61=_['map'](_0x54cc4,function(_0x46557d){return Number(_0x46557d[_0x639c('0x6a')]);});return db[_0x639c('0x6b')][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'FaxQueueId':{'$in':_0x1c8a61}},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){var _0x20377d=_0x639c('0x6c')+_0x24d409;return db['sequelize']['query'](_0x20377d,{'type':db['Sequelize']['QueryTypes'][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35});})[_0x639c('0x45')](function(_0x435053){var _0x46bdb7=_[_0x639c('0x35')](_0x435053,function(_0x5d8092){return Number(_0x5d8092[_0x639c('0x6d')]);});return db['UserOpenchannelQueue'][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'OpenchannelQueueId':{'$in':_0x46bdb7}},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){var _0x34a45a=_0x639c('0x6e')+_0x24d409;return db[_0x639c('0x59')][_0x639c('0x37')](_0x34a45a,{'type':db[_0x639c('0x5b')][_0x639c('0x5c')][_0x639c('0x5d')],'raw':!![],'transaction':_0x5bed35});})[_0x639c('0x45')](function(_0x54e920){var _0x1dd703=_[_0x639c('0x35')](_0x54e920,function(_0x11c49b){return Number(_0x11c49b['WhatsappQueueId']);});return db[_0x639c('0x6f')][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'WhatsappQueueId':{'$in':_0x1dd703}},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){return db[_0x639c('0x70')][_0x639c('0x4b')]({'where':{'TeamId':_0x24d409}});})[_0x639c('0x45')](function(_0x5f0a9b){if(_0x5f0a9b===null){return;}return db['UserVoicePrefix'][_0x639c('0x58')]({'where':{'UserId':{'$in':_0x31a85c},'VoicePrefixId':_0x5f0a9b[_0x639c('0x71')]},'transaction':_0x5bed35});})[_0x639c('0x45')](function(){return db[_0x639c('0x30')][_0x639c('0x58')]({'where':{'id':_0x24d409},'cascade':!![],'transaction':_0x5bed35});})['then'](function(_0x1d1a1c){if(_0x1d1a1c===0x0){_0x3f849d['sendStatus'](0x194);}else{return db[_0x639c('0x56')]['destroy']({'where':{'type':_0x639c('0x52'),'resourceId':_0x24d409},'cascade':!![],'transaction':_0x5bed35})[_0x639c('0x45')](function(){_0x3f849d[_0x639c('0x22')](0xcc)[_0x639c('0x72')]();});}})[_0x639c('0x57')](function(_0x13e05f){_0x3f849d[_0x639c('0x22')](0x1f4)[_0x639c('0x2f')](_0x13e05f);});});};exports[_0x639c('0x73')]=function(_0x1bd7a5,_0x3b5150,_0x5b8552){return db[_0x639c('0x30')][_0x639c('0x74')]({'where':{'id':_0x1bd7a5[_0x639c('0x49')]['id']}})[_0x639c('0x45')](handleEntityNotFound(_0x3b5150,null))[_0x639c('0x45')](function(_0x5231c0){if(!_0x1bd7a5[_0x639c('0x37')][_0x639c('0x75')]||!utils[_0x639c('0x76')](_0x1bd7a5[_0x639c('0x37')]['channel'])){throw new db[(_0x639c('0x5b'))]['ValidationError'](_0x639c('0x77'));}var _0xfa9391={};var _0x8af213={};_0x8af213[_0x639c('0x34')]=_[_0x639c('0x36')](db[_[_0x639c('0x78')](_0x1bd7a5['query'][_0x639c('0x75')]['toLowerCase']())+_0x639c('0x79')][_0x639c('0x31')]);_0x8af213['query']=_['keys'](_0x1bd7a5['query']);_0x8af213[_0x639c('0x38')]=_['intersection'](_0x8af213[_0x639c('0x34')],_0x8af213[_0x639c('0x37')]);_0xfa9391[_0x639c('0x3a')]=_['intersection'](_0x8af213[_0x639c('0x34')],qs['fields'](_0x1bd7a5['query']['fields']));_0xfa9391[_0x639c('0x3a')]=_0xfa9391[_0x639c('0x3a')][_0x639c('0x3c')]?_0xfa9391[_0x639c('0x3a')]:_0x8af213[_0x639c('0x34')];_0xfa9391[_0x639c('0x26')]=qs[_0x639c('0x26')](_0x1bd7a5['query'][_0x639c('0x26')]);_0xfa9391[_0x639c('0x24')]=qs[_0x639c('0x24')](_0x1bd7a5[_0x639c('0x37')]['offset']);_0xfa9391[_0x639c('0x7a')]=qs[_0x639c('0x3f')](_0x1bd7a5[_0x639c('0x37')][_0x639c('0x3f')]);_0xfa9391[_0x639c('0x42')]=qs[_0x639c('0x38')](_[_0x639c('0x40')](_0x1bd7a5[_0x639c('0x37')],_0x8af213[_0x639c('0x38')]));_0xfa9391=_[_0x639c('0x43')]({},_0xfa9391,_0x1bd7a5[_0x639c('0x4a')]);return _0x5231c0[_0x639c('0x4f')+_[_0x639c('0x78')](_0x1bd7a5['query'][_0x639c('0x75')][_0x639c('0x7b')]())+_0x639c('0x7c')](_0xfa9391);})[_0x639c('0x45')](respondWithResult(_0x3b5150,null))[_0x639c('0x57')](handleError(_0x3b5150,null));};exports[_0x639c('0x7d')]=function(_0x3d5a1b,_0x534fef,_0x4dccc0){return db[_0x639c('0x30')][_0x639c('0x74')]({'where':{'id':_0x3d5a1b[_0x639c('0x49')]['id']}})[_0x639c('0x45')](function(_0x49db6e){if(_0x49db6e){if(!_0x3d5a1b['body']['channel']||!utils[_0x639c('0x76')](_0x3d5a1b[_0x639c('0x4d')][_0x639c('0x75')])){throw new db[(_0x639c('0x5b'))][(_0x639c('0x7e'))](_0x639c('0x77'));}return _0x49db6e[_0x639c('0x7f')+_['capitalize'](_0x3d5a1b[_0x639c('0x4d')][_0x639c('0x75')]['toLowerCase']())+'Queues'](_0x3d5a1b['body'][_0x639c('0x80')]);}return null;})[_0x639c('0x45')](handleEntityNotFound(_0x534fef,null))[_0x639c('0x45')](respondWithStatusCode(_0x534fef,null))['catch'](handleError(_0x534fef,null));};exports[_0x639c('0x81')]=function(_0x448a51,_0x3a7293,_0x529f73){return db[_0x639c('0x30')]['findOne']({'where':{'id':_0x448a51[_0x639c('0x49')]['id']}})[_0x639c('0x45')](function(_0x4808bb){if(_0x4808bb){if(!_0x448a51[_0x639c('0x37')][_0x639c('0x75')]||!utils['isValidChannel'](_0x448a51['query'][_0x639c('0x75')])){throw new db['Sequelize'][(_0x639c('0x7e'))]('Unknown\x20channel');}return _0x4808bb[_0x639c('0x82')+_[_0x639c('0x78')](_0x448a51['query'][_0x639c('0x75')][_0x639c('0x7b')]())+_0x639c('0x7c')](_0x448a51['query'][_0x639c('0x80')]);}return null;})[_0x639c('0x45')](handleEntityNotFound(_0x3a7293,null))[_0x639c('0x45')](respondWithStatusCode(_0x3a7293,null))[_0x639c('0x57')](handleError(_0x3a7293,null));};exports['addAgents']=function(_0x4b0182,_0x4a3905){var _0x54c52c=_[_0x639c('0x83')](_0x4b0182[_0x639c('0x4d')][_0x639c('0x80')])?_0x4b0182[_0x639c('0x4d')][_0x639c('0x80')]:[_0x4b0182[_0x639c('0x4d')][_0x639c('0x80')]];var _0x5dcef3=_0x4b0182[_0x639c('0x49')]['id'];return db[_0x639c('0x30')]['find']({'where':{'id':_0x5dcef3}})[_0x639c('0x45')](handleEntityNotFound(_0x4a3905,null))[_0x639c('0x45')](function(_0x215d0e){if(_0x215d0e){var _0x39f0fe=['Voice','Chat',_0x639c('0x84'),_0x639c('0x85'),_0x639c('0x86'),'Openchannel',_0x639c('0x87')];return db[_0x639c('0x59')][_0x639c('0x5a')](function(_0x299dfb){var _0x1c188f=_['map'](_0x39f0fe,function(_0x4265bd){var _0x5cc87c={'attributes':['id',_0x639c('0x2e')]};if(_0x4265bd===_0x639c('0x88')){_0x5cc87c['through']={'attributes':['penalty']};}return _0x215d0e[_0x639c('0x4f')+_0x4265bd+'Queues'](_0x5cc87c)[_0x639c('0x45')](function(_0x2db406){var _0x22749d=_['map'](_0x2db406,function(_0x359436){var _0x4ec80b=_[_0x639c('0x35')](_0x54c52c,function(_0x3d99c3){var _0x831a8e={'where':{'UserId':_0x3d99c3,[_0x4265bd+_0x639c('0x89')]:_0x359436['id']},'transaction':_0x299dfb};if(_0x4265bd===_0x639c('0x88')){_0x831a8e['defaults']={'penalty':_0x359436[_0x639c('0x8a')][_0x639c('0x8b')]};}return db[_0x639c('0x8c')+_0x4265bd+'Queue'][_0x639c('0x8d')](_0x831a8e)[_0x639c('0x45')](function(){socket[_0x639c('0x8e')]('user'+_0x4265bd+'Queue:save',{'UserId':_0x3d99c3,[_0x4265bd+_0x639c('0x89')]:_0x359436['id']});if(_0x4265bd!==_0x639c('0x88')){return;}return db[_0x639c('0x8c')][_0x639c('0x8f')]({'where':{'id':_0x54c52c,'online':0x1},'attributes':['id',_0x639c('0x2e'),_0x639c('0x90'),_0x639c('0x91'),_0x639c('0x92')],'raw':!![]})[_0x639c('0x45')](function(_0x384806){var _0x4c3b51=_[_0x639c('0x35')](_0x384806,function(_0x4664c2){return db[_0x639c('0x93')][_0x639c('0x94')]({'membername':_0x4664c2[_0x639c('0x2e')],'UserId':_0x4664c2['id'],'queue_name':_0x359436[_0x639c('0x2e')],'VoiceQueueId':_0x359436['id'],'interface':_[_0x639c('0x95')](_0x4664c2[_0x639c('0x92')])?util['format'](_0x639c('0x96'),_0x4664c2[_0x639c('0x2e')]):_0x4664c2[_0x639c('0x92')],'paused':_0x4664c2[_0x639c('0x91')]||![],'penalty':_0x359436[_0x639c('0x8a')]['penalty']},{'transaction':_0x299dfb});});return Promise['all'](_0x4c3b51);});});});return Promise[_0x639c('0x97')](_0x4ec80b);});return Promise[_0x639c('0x97')](_0x22749d);})[_0x639c('0x45')](function(){return db[_0x639c('0x70')][_0x639c('0x74')]({'where':{'teamId':_0x5dcef3}})['then'](function(_0x4ac631){if(_0x4ac631){var _0x4a3854=_['map'](_0x54c52c,function(_0x44bb3c){db['UserVoicePrefix']['upsert']({'UserId':_0x44bb3c,'VoicePrefixId':_0x4ac631[_0x639c('0x71')]});});return Promise[_0x639c('0x97')](_0x4a3854);}});});});return Promise[_0x639c('0x97')](_0x1c188f)[_0x639c('0x45')](function(){return _0x215d0e['addAgents'](_0x54c52c,{'transaction':_0x299dfb})[_0x639c('0x98')](function(_0x3f09f1){return _0x3f09f1;});});});}})[_0x639c('0x45')](respondWithResult(_0x4a3905,null))['catch'](handleError(_0x4a3905,null));};exports[_0x639c('0x99')]=function(_0x54b55a,_0x432572){var _0x459788=_[_0x639c('0x83')](_0x54b55a[_0x639c('0x37')][_0x639c('0x80')])?_0x54b55a[_0x639c('0x37')][_0x639c('0x80')]:[_0x54b55a['query'][_0x639c('0x80')]];var _0x785c85=_0x54b55a[_0x639c('0x49')]['id'];return db[_0x639c('0x30')]['find']({'where':{'id':_0x785c85}})[_0x639c('0x45')](handleEntityNotFound(_0x432572,null))['then'](function(_0x23f323){if(_0x23f323){var _0x59e6bf=[_0x639c('0x88'),_0x639c('0x9a'),_0x639c('0x84'),'Sms',_0x639c('0x86'),'Openchannel',_0x639c('0x87')];return db[_0x639c('0x59')][_0x639c('0x5a')](function(_0x11da56){var _0x4a98a2=_[_0x639c('0x35')](_0x59e6bf,function(_0x3ec943){var _0xc7d343={'attributes':['id',_0x639c('0x2e')]};return _0x23f323[_0x639c('0x4f')+_0x3ec943+'Queues'](_0xc7d343)['then'](function(_0x550827){var _0x41e6d2=_['map'](_0x550827,function(_0x508b9a){return _0x508b9a[_0x639c('0x99')](_0x459788,{'transaction':_0x11da56})[_0x639c('0x45')](function(){var _0x3ef1c8=_[_0x639c('0x35')](_0x459788,function(_0x3e6d7a){socket[_0x639c('0x8e')]('user'+_0x3ec943+'Queue:remove',{'UserId':Number(_0x3e6d7a),[_0x3ec943+_0x639c('0x89')]:_0x508b9a['id']});if(_0x3ec943!==_0x639c('0x88')){return;}return db[_0x639c('0x93')][_0x639c('0x58')]({'where':{'VoiceQueueId':_0x508b9a['id'],'UserId':_0x3e6d7a},'transaction':_0x11da56});});return Promise[_0x639c('0x97')](_0x3ef1c8);});});return Promise['all'](_0x41e6d2);});});return Promise[_0x639c('0x97')](_0x4a98a2)[_0x639c('0x45')](function(){return _0x23f323['removeAgents'](_0x459788,{'transaction':_0x11da56});})[_0x639c('0x45')](function(){return db[_0x639c('0x70')][_0x639c('0x74')]({'where':{'teamId':_0x785c85}})[_0x639c('0x45')](function(_0x39fffb){if(_0x39fffb){var _0x1712b4=_[_0x639c('0x35')](_0x459788,function(_0x3e0c1e){db[_0x639c('0x9b')][_0x639c('0x58')]({'where':{'UserId':_0x3e0c1e,'VoicePrefixId':_0x39fffb[_0x639c('0x71')]}});});return Promise['all'](_0x1712b4);}});});});}})[_0x639c('0x45')](respondWithStatusCode(_0x432572,null))[_0x639c('0x57')](handleError(_0x432572,null));};exports['getAgents']=function(_0x4d7202,_0x2bed5a,_0x3b20df){var _0x543cdc={};var _0x2f260b={};var _0x1c530a;var _0x2c93de;return db['Team'][_0x639c('0x74')]({'where':{'id':_0x4d7202[_0x639c('0x49')]['id']}})[_0x639c('0x45')](handleEntityNotFound(_0x2bed5a,null))[_0x639c('0x45')](function(_0xd65e93){if(_0xd65e93){_0x1c530a=_0xd65e93;_0x2f260b['model']=_[_0x639c('0x36')](db[_0x639c('0x8c')][_0x639c('0x31')]);_0x2f260b[_0x639c('0x37')]=_['keys'](_0x4d7202['query']);_0x2f260b[_0x639c('0x38')]=_[_0x639c('0x39')](_0x2f260b[_0x639c('0x34')],_0x2f260b[_0x639c('0x37')]);_0x543cdc[_0x639c('0x3a')]=_[_0x639c('0x39')](_0x2f260b[_0x639c('0x34')],qs[_0x639c('0x3b')](_0x4d7202[_0x639c('0x37')][_0x639c('0x3b')]));_0x543cdc[_0x639c('0x3a')]=_0x543cdc[_0x639c('0x3a')]['length']?_0x543cdc[_0x639c('0x3a')]:_0x2f260b[_0x639c('0x34')];_0x543cdc[_0x639c('0x7a')]=qs[_0x639c('0x3f')](_0x4d7202[_0x639c('0x37')][_0x639c('0x3f')]);_0x543cdc['where']=qs[_0x639c('0x38')](_['pick'](_0x4d7202[_0x639c('0x37')],_0x2f260b['filters']));if(_0x4d7202[_0x639c('0x37')][_0x639c('0x41')]){_0x543cdc[_0x639c('0x42')]=_[_0x639c('0x43')](_0x543cdc[_0x639c('0x42')],{'$or':_[_0x639c('0x35')](_0x543cdc['attributes'],function(_0x4a08a5){var _0xd8fd47={};_0xd8fd47[_0x4a08a5]={'$like':'%'+_0x4d7202[_0x639c('0x37')][_0x639c('0x41')]+'%'};return _0xd8fd47;})});}_0x543cdc=_[_0x639c('0x43')]({},_0x543cdc,_0x4d7202[_0x639c('0x4a')]);return _0x1c530a[_0x639c('0x9c')](_0x543cdc);}})['then'](function(_0x23f4bf){if(_0x23f4bf){_0x2c93de=_0x23f4bf[_0x639c('0x3c')];if(!_0x4d7202[_0x639c('0x37')][_0x639c('0x3d')]('nolimit')){_0x543cdc[_0x639c('0x26')]=qs[_0x639c('0x26')](_0x4d7202[_0x639c('0x37')][_0x639c('0x26')]);_0x543cdc[_0x639c('0x24')]=qs[_0x639c('0x24')](_0x4d7202[_0x639c('0x37')][_0x639c('0x24')]);}return _0x1c530a[_0x639c('0x9c')](_0x543cdc);}})[_0x639c('0x45')](function(_0x445b54){if(_0x445b54){return _0x445b54?{'count':_0x2c93de,'rows':_0x445b54}:null;}})[_0x639c('0x45')](respondWithResult(_0x2bed5a,null))[_0x639c('0x57')](handleError(_0x2bed5a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f1065c8..7ebfca5 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 _0x1d84=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1d84,0xf1));var _0x41d8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x1d84[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0x41d8('0x0'));var Team=require(_0x41d8('0x1'))['db'][_0x41d8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x41d8('0x3')](0x0);var events={'afterCreate':_0x41d8('0x4'),'afterUpdate':_0x41d8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4f808b){return function(_0x515187,_0x119299,_0x13a580){TeamEvents[_0x41d8('0x6')](_0x4f808b+':'+_0x515187['id'],_0x515187);TeamEvents[_0x41d8('0x6')](_0x4f808b,_0x515187);_0x13a580(null);};}for(var e in events){if(events[_0x41d8('0x7')](e)){var event=events[e];Team[_0x41d8('0x8')](e,emitEvent(event));}}module[_0x41d8('0x9')]=TeamEvents; \ No newline at end of file +var _0x4659=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update'];(function(_0x22ed3e,_0xb04e3f){var _0x194d99=function(_0x1643e8){while(--_0x1643e8){_0x22ed3e['push'](_0x22ed3e['shift']());}};_0x194d99(++_0xb04e3f);}(_0x4659,0x13b));var _0x9465=function(_0x41f039,_0x2cdd58){_0x41f039=_0x41f039-0x0;var _0x97be15=_0x4659[_0x41f039];return _0x97be15;};'use strict';var EventEmitter=require(_0x9465('0x0'));var Team=require(_0x9465('0x1'))['db'][_0x9465('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9465('0x3'),'afterUpdate':_0x9465('0x4'),'afterDestroy':_0x9465('0x5')};function emitEvent(_0x1c77b9){return function(_0x1ebc84,_0x263593,_0x59c308){TeamEvents[_0x9465('0x6')](_0x1c77b9+':'+_0x1ebc84['id'],_0x1ebc84);TeamEvents[_0x9465('0x6')](_0x1c77b9,_0x1ebc84);_0x59c308(null);};}for(var e in events){if(events[_0x9465('0x7')](e)){var event=events[e];Team[_0x9465('0x8')](e,emitEvent(event));}}module[_0x9465('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index a02ccee..3759641 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 _0x3cde=['channel','exports','define','Team','Chat','Openchannel','Sms','resolve','all','catch','lodash','./team.attributes','get','then'];(function(_0x46b788,_0x45c0d4){var _0x38192d=function(_0x592f81){while(--_0x592f81){_0x46b788['push'](_0x46b788['shift']());}};_0x38192d(++_0x45c0d4);}(_0x3cde,0xce));var _0xe3cd=function(_0x120aac,_0x36ee4f){_0x120aac=_0x120aac-0x0;var _0x10cd58=_0x3cde[_0x120aac];return _0x10cd58;};'use strict';var _=require(_0xe3cd('0x0'));var attributes=require(_0xe3cd('0x1'));function getQueuesByChannel(_0xb32472,_0x5014c8){var _0x2e9a29=_0xe3cd('0x2')+_0x5014c8+'Queues';return _0xb32472[_0x2e9a29]()[_0xe3cd('0x3')](function(_0x4cc650){return _['map'](_0x4cc650,function(_0x4787f7){_0x4787f7['setDataValue'](_0xe3cd('0x4'),_0x5014c8);return _0x4787f7;});})['catch'](function(_0x41a3d1){throw _0x41a3d1;});}module[_0xe3cd('0x5')]=function(_0xb4f3ef){return _0xb4f3ef[_0xe3cd('0x6')](_0xe3cd('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x55ed91=this;var _0x17741e=[_0xe3cd('0x8'),'Fax','Mail',_0xe3cd('0x9'),_0xe3cd('0xa'),'Voice','Whatsapp'];return Promise[_0xe3cd('0xb')]()['then'](function(){var _0x5dcaa0=_['map'](_0x17741e,function(_0x2700f9){return getQueuesByChannel(_0x55ed91,_0x2700f9);});return Promise[_0xe3cd('0xc')](_0x5dcaa0);})[_0xe3cd('0xd')](function(_0x554796){throw _0x554796;});}}});}; \ No newline at end of file +var _0xd37c=['Chat','Fax','Mail','Openchannel','Whatsapp','resolve','all','lodash','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports','define','Team'];(function(_0x12143d,_0x38299f){var _0xf007db=function(_0xe98497){while(--_0xe98497){_0x12143d['push'](_0x12143d['shift']());}};_0xf007db(++_0x38299f);}(_0xd37c,0x15d));var _0xcd37=function(_0x4f1572,_0x1ec764){_0x4f1572=_0x4f1572-0x0;var _0x58bb3b=_0xd37c[_0x4f1572];return _0x58bb3b;};'use strict';var _=require(_0xcd37('0x0'));var attributes=require(_0xcd37('0x1'));function getQueuesByChannel(_0x1d4e66,_0x1176ff){var _0xda28a8='get'+_0x1176ff+_0xcd37('0x2');return _0x1d4e66[_0xda28a8]()[_0xcd37('0x3')](function(_0x5bcf7f){return _[_0xcd37('0x4')](_0x5bcf7f,function(_0x2f417d){_0x2f417d[_0xcd37('0x5')](_0xcd37('0x6'),_0x1176ff);return _0x2f417d;});})[_0xcd37('0x7')](function(_0xe3627a){throw _0xe3627a;});}module[_0xcd37('0x8')]=function(_0x394352){return _0x394352[_0xcd37('0x9')](_0xcd37('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1045f5=this;var _0x24f371=[_0xcd37('0xb'),_0xcd37('0xc'),_0xcd37('0xd'),_0xcd37('0xe'),'Sms','Voice',_0xcd37('0xf')];return Promise[_0xcd37('0x10')]()[_0xcd37('0x3')](function(){var _0x3a1430=_[_0xcd37('0x4')](_0x24f371,function(_0x124e1a){return getQueuesByChannel(_0x1045f5,_0x124e1a);});return Promise[_0xcd37('0x11')](_0x3a1430);})[_0xcd37('0x7')](function(_0x407f9a){throw _0x407f9a;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f12ed11..789c0b9 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 _0x1bc2=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x1bc2,0x1e8));var _0x21bc=function(_0x48d9bd,_0x52040f){_0x48d9bd=_0x48d9bd-0x0;var _0x243ca5=_0x1bc2[_0x48d9bd];return _0x243ca5;};'use strict';var _=require('lodash');var util=require(_0x21bc('0x0'));var moment=require(_0x21bc('0x1'));var BPromise=require(_0x21bc('0x2'));var rs=require(_0x21bc('0x3'));var fs=require('fs');var Redis=require(_0x21bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x21bc('0x5'));var logger=require(_0x21bc('0x6'))(_0x21bc('0x7'));var config=require(_0x21bc('0x8'));var jayson=require(_0x21bc('0x9'));var client=jayson[_0x21bc('0xa')][_0x21bc('0xb')]({'port':0x232a});config[_0x21bc('0xc')]=_[_0x21bc('0xd')](config[_0x21bc('0xc')],{'host':_0x21bc('0xe'),'port':0x18eb});var socket=require(_0x21bc('0xf'))(new Redis(config[_0x21bc('0xc')]));require('./team.socket')[_0x21bc('0x10')](socket);function respondWithRpcPromise(_0x230243,_0x384e53,_0x4e4710){return new BPromise(function(_0x15800a,_0x258866){return client[_0x21bc('0x11')](_0x230243,_0x4e4710)[_0x21bc('0x12')](function(_0x4419d7){logger[_0x21bc('0x13')](_0x21bc('0x14'),_0x384e53,_0x21bc('0x15'));logger[_0x21bc('0x16')](_0x21bc('0x17'),_0x384e53,_0x21bc('0x15'),JSON[_0x21bc('0x18')](_0x4419d7));if(_0x4419d7[_0x21bc('0x19')]){if(_0x4419d7[_0x21bc('0x19')][_0x21bc('0x1a')]===0x1f4){logger[_0x21bc('0x19')](_0x21bc('0x14'),_0x384e53,_0x4419d7[_0x21bc('0x19')]['message']);return _0x258866(_0x4419d7[_0x21bc('0x19')][_0x21bc('0x1b')]);}logger[_0x21bc('0x19')](_0x21bc('0x14'),_0x384e53,_0x4419d7['error'][_0x21bc('0x1b')]);return _0x15800a(_0x4419d7[_0x21bc('0x19')][_0x21bc('0x1b')]);}else{logger[_0x21bc('0x13')](_0x21bc('0x14'),_0x384e53,_0x21bc('0x15'));_0x15800a(_0x4419d7[_0x21bc('0x1c')][_0x21bc('0x1b')]);}})[_0x21bc('0x1d')](function(_0x6634c8){logger[_0x21bc('0x19')](_0x21bc('0x14'),_0x384e53,_0x6634c8);_0x258866(_0x6634c8);});});} \ No newline at end of file +var _0xf0c0=['Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xf0c0,0xee));var _0x0f0c=function(_0xd13cf5,_0x301806){_0xd13cf5=_0xd13cf5-0x0;var _0x550f9c=_0xf0c0[_0xd13cf5];return _0x550f9c;};'use strict';var _=require('lodash');var util=require(_0x0f0c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f0c('0x1'));var fs=require('fs');var Redis=require(_0x0f0c('0x2'));var db=require(_0x0f0c('0x3'))['db'];var utils=require(_0x0f0c('0x4'));var logger=require(_0x0f0c('0x5'))(_0x0f0c('0x6'));var config=require(_0x0f0c('0x7'));var jayson=require(_0x0f0c('0x8'));var client=jayson[_0x0f0c('0x9')][_0x0f0c('0xa')]({'port':0x232a});config[_0x0f0c('0xb')]=_[_0x0f0c('0xc')](config[_0x0f0c('0xb')],{'host':_0x0f0c('0xd'),'port':0x18eb});var socket=require(_0x0f0c('0xe'))(new Redis(config[_0x0f0c('0xb')]));require(_0x0f0c('0xf'))[_0x0f0c('0x10')](socket);function respondWithRpcPromise(_0x5d3b06,_0x710e97,_0x193a7a){return new BPromise(function(_0x13c939,_0x4c48a8){return client[_0x0f0c('0x11')](_0x5d3b06,_0x193a7a)[_0x0f0c('0x12')](function(_0x122f2a){logger[_0x0f0c('0x13')](_0x0f0c('0x14'),_0x710e97,_0x0f0c('0x15'));logger[_0x0f0c('0x16')](_0x0f0c('0x17'),_0x710e97,_0x0f0c('0x15'),JSON[_0x0f0c('0x18')](_0x122f2a));if(_0x122f2a[_0x0f0c('0x19')]){if(_0x122f2a[_0x0f0c('0x19')]['code']===0x1f4){logger['error'](_0x0f0c('0x14'),_0x710e97,_0x122f2a[_0x0f0c('0x19')]['message']);return _0x4c48a8(_0x122f2a['error'][_0x0f0c('0x1a')]);}logger[_0x0f0c('0x19')](_0x0f0c('0x14'),_0x710e97,_0x122f2a[_0x0f0c('0x19')][_0x0f0c('0x1a')]);return _0x13c939(_0x122f2a[_0x0f0c('0x19')][_0x0f0c('0x1a')]);}else{logger['info'](_0x0f0c('0x14'),_0x710e97,_0x0f0c('0x15'));_0x13c939(_0x122f2a[_0x0f0c('0x1b')][_0x0f0c('0x1a')]);}})[_0x0f0c('0x1c')](function(_0x37aecc){logger[_0x0f0c('0x19')](_0x0f0c('0x14'),_0x710e97,_0x37aecc);_0x4c48a8(_0x37aecc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4a2da1c..05489b2 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 _0x24a9=['removeListener','register','length','./team.events','save','update'];(function(_0x241770,_0x461011){var _0x434ce8=function(_0x311101){while(--_0x311101){_0x241770['push'](_0x241770['shift']());}};_0x434ce8(++_0x461011);}(_0x24a9,0xf9));var _0x924a=function(_0x2f71b4,_0x20486c){_0x2f71b4=_0x2f71b4-0x0;var _0x427d96=_0x24a9[_0x2f71b4];return _0x427d96;};'use strict';var TeamEvents=require(_0x924a('0x0'));var events=[_0x924a('0x1'),'remove',_0x924a('0x2')];function createListener(_0x3be878,_0x421010){return function(_0x3eb096){_0x421010['emit'](_0x3be878,_0x3eb096);};}function removeListener(_0x1dc029,_0x424d2d){return function(){TeamEvents[_0x924a('0x3')](_0x1dc029,_0x424d2d);};}exports[_0x924a('0x4')]=function(_0x63206c){for(var _0x497773=0x0,_0x557b12=events[_0x924a('0x5')];_0x497773<_0x557b12;_0x497773++){var _0x59b79a=events[_0x497773];var _0x4a7e89=createListener('team:'+_0x59b79a,_0x63206c);TeamEvents['on'](_0x59b79a,_0x4a7e89);}}; \ No newline at end of file +var _0xa74f=['emit','removeListener','length','team:','remove'];(function(_0x55a39d,_0x53791b){var _0x11e560=function(_0x2b93c3){while(--_0x2b93c3){_0x55a39d['push'](_0x55a39d['shift']());}};_0x11e560(++_0x53791b);}(_0xa74f,0x9a));var _0xfa74=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xa74f[_0x2bf466];return _0x856885;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xfa74('0x0'),'update'];function createListener(_0x4b5765,_0x29e4c8){return function(_0x110824){_0x29e4c8[_0xfa74('0x1')](_0x4b5765,_0x110824);};}function removeListener(_0x25a9b7,_0x5b367b){return function(){TeamEvents[_0xfa74('0x2')](_0x25a9b7,_0x5b367b);};}exports['register']=function(_0x543cfe){for(var _0x43dd2f=0x0,_0x9ddbd2=events[_0xfa74('0x3')];_0x43dd2f<_0x9ddbd2;_0x43dd2f++){var _0x2d9fa9=events[_0x43dd2f];var _0x287921=createListener(_0xfa74('0x4')+_0x2d9fa9,_0x543cfe);TeamEvents['on'](_0x2d9fa9,_0x287921);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4bd7115..573ca9c 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eec=['sequelize','exports','INTEGER'];(function(_0x31ed7e,_0x11edf5){var _0x55c46f=function(_0x7efbbc){while(--_0x7efbbc){_0x31ed7e['push'](_0x31ed7e['shift']());}};_0x55c46f(++_0x11edf5);}(_0x3eec,0x1e9));var _0xc3ee=function(_0xf9b9e,_0x1997bb){_0xf9b9e=_0xf9b9e-0x0;var _0x8fb246=_0x3eec[_0xf9b9e];return _0x8fb246;};'use strict';var Sequelize=require(_0xc3ee('0x0'));module[_0xc3ee('0x1')]={'TeamId':{'type':Sequelize[_0xc3ee('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xc3ee('0x2')]}}; \ No newline at end of file +var _0x6c4b=['sequelize','exports','INTEGER'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x6c4b,0x93));var _0xb6c4=function(_0x1e46e0,_0x5c4908){_0x1e46e0=_0x1e46e0-0x0;var _0x330742=_0x6c4b[_0x1e46e0];return _0x330742;};'use strict';var Sequelize=require(_0xb6c4('0x0'));module[_0xb6c4('0x1')]={'TeamId':{'type':Sequelize[_0xb6c4('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0800192..7051ba2 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a9a=['./teamVoicePrefix.attributes','exports','define','../../config/logger','api','moment','request-promise','path'];(function(_0x281f42,_0x59c2a4){var _0x2aaa83=function(_0x1e3a90){while(--_0x1e3a90){_0x281f42['push'](_0x281f42['shift']());}};_0x2aaa83(++_0x59c2a4);}(_0x8a9a,0x193));var _0xa8a9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8a9a[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa8a9('0x0'))(_0xa8a9('0x1'));var moment=require(_0xa8a9('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8a9('0x3'));var fs=require('fs');var path=require(_0xa8a9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8a9('0x5'));module[_0xa8a9('0x6')]=function(_0x16b086,_0x39d1db){return _0x16b086[_0xa8a9('0x7')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c6=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x63c6,0xbb));var _0x663c=function(_0x48e954,_0x4546e8){_0x48e954=_0x48e954-0x0;var _0x124016=_0x63c6[_0x48e954];return _0x124016;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x663c('0x2'));var BPromise=require(_0x663c('0x3'));var rp=require(_0x663c('0x4'));var fs=require('fs');var path=require(_0x663c('0x5'));var rimraf=require(_0x663c('0x6'));var config=require(_0x663c('0x7'));var attributes=require(_0x663c('0x8'));module[_0x663c('0x9')]=function(_0x6bdbd1,_0x4fedf8){return _0x6bdbd1[_0x663c('0xa')](_0x663c('0xb'),attributes,{'tableName':_0x663c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 843f24c..a2ed580 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x156e94,_0x48c891){var _0x552da7=function(_0xe0cfab){while(--_0xe0cfab){_0x156e94['push'](_0x156e94['shift']());}};_0x552da7(++_0x48c891);}(_0xe706,0xa3));var _0x6e70=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0xe706[_0x31080a];return _0x58d2fc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 910cfb4..6c032f7 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 _0xf625=['sequelize','exports','INTEGER'];(function(_0x5475b6,_0x32e77b){var _0x4b43ea=function(_0x269355){while(--_0x269355){_0x5475b6['push'](_0x5475b6['shift']());}};_0x4b43ea(++_0x32e77b);}(_0xf625,0x18c));var _0x5f62=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0xf625[_0x13fd59];return _0x2e6ce7;};'use strict';var Sequelize=require(_0x5f62('0x0'));module[_0x5f62('0x1')]={'penalty':{'type':Sequelize[_0x5f62('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe436=['exports','sequelize'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0xe436,0x1af));var _0x6e43=function(_0x4d9c62,_0x51f760){_0x4d9c62=_0x4d9c62-0x0;var _0x522e2c=_0xe436[_0x4d9c62];return _0x522e2c;};'use strict';var Sequelize=require(_0x6e43('0x0'));module[_0x6e43('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 3cb0a69..6d92d08 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 _0x5645=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5645,0x19e));var _0x5564=function(_0x1a3be0,_0x395f0b){_0x1a3be0=_0x1a3be0-0x0;var _0x2bbe28=_0x5645[_0x1a3be0];return _0x2bbe28;};'use strict';var _=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var logger=require(_0x5564('0x2'))(_0x5564('0x3'));var moment=require(_0x5564('0x4'));var BPromise=require('bluebird');var rp=require(_0x5564('0x5'));var fs=require('fs');var path=require(_0x5564('0x6'));var rimraf=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var attributes=require(_0x5564('0x9'));module[_0x5564('0xa')]=function(_0x6d7911,_0x196e16){return _0x6d7911[_0x5564('0xb')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777f=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x777f,0x9f));var _0xf777=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x777f[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fs=require('fs');var path=require(_0xf777('0x7'));var rimraf=require('rimraf');var config=require(_0xf777('0x8'));var attributes=require(_0xf777('0x9'));module['exports']=function(_0x5b7903,_0x5df5dc){return _0x5b7903[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'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 3222c35..0fb19a1 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 _0x6a72=['message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x6a72,0x118));var _0x26a7=function(_0x3f0553,_0x1ee7d8){_0x3f0553=_0x3f0553-0x0;var _0x185007=_0x6a72[_0x3f0553];return _0x185007;};'use strict';var _=require(_0x26a7('0x0'));var util=require(_0x26a7('0x1'));var moment=require(_0x26a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x26a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26a7('0x4'))['db'];var utils=require(_0x26a7('0x5'));var logger=require(_0x26a7('0x6'))(_0x26a7('0x7'));var config=require(_0x26a7('0x8'));var jayson=require(_0x26a7('0x9'));var client=jayson[_0x26a7('0xa')][_0x26a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ae95c,_0x20e058,_0x46dbc0){return new BPromise(function(_0x5115c5,_0x7fa77b){return client[_0x26a7('0xc')](_0x4ae95c,_0x46dbc0)[_0x26a7('0xd')](function(_0x274dbf){logger['info'](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x20e058,_0x26a7('0xf'),JSON[_0x26a7('0x10')](_0x274dbf));if(_0x274dbf[_0x26a7('0x11')]){if(_0x274dbf['error'][_0x26a7('0x12')]===0x1f4){logger[_0x26a7('0x11')](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x7fa77b(_0x274dbf['error'][_0x26a7('0x13')]);}logger['error'](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x5115c5(_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);}else{logger[_0x26a7('0x14')](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));_0x5115c5(_0x274dbf[_0x26a7('0x15')][_0x26a7('0x13')]);}})[_0x26a7('0x16')](function(_0x19ed18){logger[_0x26a7('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x20e058,_0x19ed18);_0x7fa77b(_0x19ed18);});});} \ No newline at end of file +var _0xb64e=['http','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x38f386,_0x223e5e){var _0x501672=function(_0xbc392c){while(--_0xbc392c){_0x38f386['push'](_0x38f386['shift']());}};_0x501672(++_0x223e5e);}(_0xb64e,0x89));var _0xeb64=function(_0xb0be8e,_0x3a1258){_0xb0be8e=_0xb0be8e-0x0;var _0x4ee710=_0xb64e[_0xb0be8e];return _0x4ee710;};'use strict';var _=require(_0xeb64('0x0'));var util=require(_0xeb64('0x1'));var moment=require('moment');var BPromise=require(_0xeb64('0x2'));var rs=require(_0xeb64('0x3'));var fs=require('fs');var Redis=require(_0xeb64('0x4'));var db=require(_0xeb64('0x5'))['db'];var utils=require(_0xeb64('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xeb64('0x7'));var jayson=require(_0xeb64('0x8'));var client=jayson[_0xeb64('0x9')][_0xeb64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27410b,_0x2a212d,_0xe843e7){return new BPromise(function(_0x303707,_0x5a2c1b){return client[_0xeb64('0xb')](_0x27410b,_0xe843e7)['then'](function(_0x33ecb7){logger['info'](_0xeb64('0xc'),_0x2a212d,_0xeb64('0xd'));logger[_0xeb64('0xe')](_0xeb64('0xf'),_0x2a212d,_0xeb64('0xd'),JSON['stringify'](_0x33ecb7));if(_0x33ecb7[_0xeb64('0x10')]){if(_0x33ecb7[_0xeb64('0x10')][_0xeb64('0x11')]===0x1f4){logger['error'](_0xeb64('0xc'),_0x2a212d,_0x33ecb7[_0xeb64('0x10')][_0xeb64('0x12')]);return _0x5a2c1b(_0x33ecb7[_0xeb64('0x10')][_0xeb64('0x12')]);}logger[_0xeb64('0x10')](_0xeb64('0xc'),_0x2a212d,_0x33ecb7[_0xeb64('0x10')][_0xeb64('0x12')]);return _0x303707(_0x33ecb7[_0xeb64('0x10')][_0xeb64('0x12')]);}else{logger[_0xeb64('0x13')](_0xeb64('0xc'),_0x2a212d,_0xeb64('0xd'));_0x303707(_0x33ecb7['result']['message']);}})[_0xeb64('0x14')](function(_0x17087b){logger[_0xeb64('0x10')](_0xeb64('0xc'),_0x2a212d,_0x17087b);_0x5a2c1b(_0x17087b);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8f3ad5d..ff351ea 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 _0x471a=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x471a,0x18d));var _0xa471=function(_0x175e61,_0x3f505b){_0x175e61=_0x175e61-0x0;var _0x54c24c=_0x471a[_0x175e61];return _0x54c24c;};'use strict';var multer=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var path=require(_0xa471('0x2'));var timeout=require('connect-timeout');var express=require(_0xa471('0x3'));var router=express[_0xa471('0x4')]();var fs_extra=require(_0xa471('0x5'));var auth=require(_0xa471('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./template.controller');router[_0xa471('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa471('0x8'),auth[_0xa471('0x9')](),controller[_0xa471('0xa')]);router['post']('/',auth[_0xa471('0x9')](),controller['create']);router['put'](_0xa471('0x8'),auth[_0xa471('0x9')](),controller[_0xa471('0xb')]);router[_0xa471('0xc')]('/:id',auth[_0xa471('0x9')](),controller[_0xa471('0xd')]);module[_0xa471('0xe')]=router; \ No newline at end of file +var _0xb4d9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb4d9,0xce));var _0x9b4d=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb4d9[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var path=require('path');var timeout=require(_0x9b4d('0x2'));var express=require(_0x9b4d('0x3'));var router=express[_0x9b4d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b4d('0x5'));var interaction=require(_0x9b4d('0x6'));var config=require(_0x9b4d('0x7'));var controller=require(_0x9b4d('0x8'));router[_0x9b4d('0x9')]('/',auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xb')]);router[_0x9b4d('0x9')](_0x9b4d('0xc'),auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xd')]);router['post']('/',auth[_0x9b4d('0xa')](),controller['create']);router[_0x9b4d('0xe')]('/:id',auth[_0x9b4d('0xa')](),controller[_0x9b4d('0xf')]);router[_0x9b4d('0x10')](_0x9b4d('0xc'),auth[_0x9b4d('0xa')](),controller[_0x9b4d('0x11')]);module[_0x9b4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 088808b..b74bab8 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 _0x54e4=['sequelize','exports','STRING','TEXT'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x54e4,0xe0));var _0x454e=function(_0x4a0e41,_0x1759ea){_0x4a0e41=_0x4a0e41-0x0;var _0x58ebd9=_0x54e4[_0x4a0e41];return _0x58ebd9;};'use strict';var Sequelize=require(_0x454e('0x0'));module[_0x454e('0x1')]={'name':{'type':Sequelize[_0x454e('0x2')]},'description':{'type':Sequelize[_0x454e('0x2')]},'html':{'type':Sequelize[_0x454e('0x3')]}}; \ No newline at end of file +var _0x9098=['STRING','sequelize','exports'];(function(_0xc22d61,_0x29a510){var _0xd25cdc=function(_0x2cf642){while(--_0x2cf642){_0xc22d61['push'](_0xc22d61['shift']());}};_0xd25cdc(++_0x29a510);}(_0x9098,0xbe));var _0x8909=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9098[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8909('0x0'));module[_0x8909('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8909('0x2')]},'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 76815c5..493d2b5 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 _0xd328=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','Templates','UserProfileResource','destroy','stack','name','send','index','map','Template','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation'];(function(_0x46f526,_0xc2616c){var _0x5c0eb3=function(_0x8ef5b7){while(--_0x8ef5b7){_0x46f526['push'](_0x46f526['shift']());}};_0x5c0eb3(++_0xc2616c);}(_0xd328,0x192));var _0x8d32=function(_0x4758cd,_0x419e30){_0x4758cd=_0x4758cd-0x0;var _0x59c8da=_0xd328[_0x4758cd];return _0x59c8da;};'use strict';var emlformat=require(_0x8d32('0x0'));var rimraf=require(_0x8d32('0x1'));var zipdir=require(_0x8d32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8d32('0x3'));var Mustache=require(_0x8d32('0x4'));var util=require('util');var path=require(_0x8d32('0x5'));var sox=require(_0x8d32('0x6'));var csv=require(_0x8d32('0x7'));var ejs=require(_0x8d32('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d32('0x9'));var crypto=require('crypto');var jsforce=require(_0x8d32('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8d32('0x7'));var querystring=require(_0x8d32('0xb'));var Papa=require('papaparse');var Redis=require(_0x8d32('0xc'));var authService=require(_0x8d32('0xd'));var qs=require(_0x8d32('0xe'));var as=require(_0x8d32('0xf'));var hardwareService=require(_0x8d32('0x10'));var logger=require(_0x8d32('0x11'))(_0x8d32('0x12'));var utils=require(_0x8d32('0x13'));var config=require(_0x8d32('0x14'));var licenseUtil=require(_0x8d32('0x15'));var db=require(_0x8d32('0x16'))['db'];function respondWithStatusCode(_0x58eb2b,_0x92d989){_0x92d989=_0x92d989||0xcc;return function(_0x2d332c){if(_0x2d332c){return _0x58eb2b[_0x8d32('0x17')](_0x92d989);}return _0x58eb2b[_0x8d32('0x18')](_0x92d989)[_0x8d32('0x19')]();};}function respondWithResult(_0x48238e,_0x460ab8){_0x460ab8=_0x460ab8||0xc8;return function(_0xbd7c70){if(_0xbd7c70){return _0x48238e[_0x8d32('0x18')](_0x460ab8)[_0x8d32('0x1a')](_0xbd7c70);}};}function respondWithFilteredResult(_0x20b6d9,_0x3b11f3){return function(_0x4868db){if(_0x4868db){var _0x1b871a=typeof _0x3b11f3[_0x8d32('0x1b')]===_0x8d32('0x1c')&&typeof _0x3b11f3[_0x8d32('0x1d')]===_0x8d32('0x1c');var _0x6d0c04=_0x4868db['count'];var _0x155d59=_0x1b871a?0x0:_0x3b11f3[_0x8d32('0x1b')];var _0x78316a=_0x1b871a?_0x4868db[_0x8d32('0x1e')]:_0x3b11f3['offset']+_0x3b11f3[_0x8d32('0x1d')];var _0x2d4f28;if(_0x78316a>=_0x6d0c04){_0x78316a=_0x6d0c04;_0x2d4f28=0xc8;}else{_0x2d4f28=0xce;}_0x20b6d9[_0x8d32('0x18')](_0x2d4f28);return _0x20b6d9['set'](_0x8d32('0x1f'),_0x155d59+'-'+_0x78316a+'/'+_0x6d0c04)['json'](_0x4868db);}return null;};}function patchUpdates(_0x215aa4){return function(_0x1c9126){try{jsonpatch[_0x8d32('0x20')](_0x1c9126,_0x215aa4,!![]);}catch(_0x35623e){return BPromise[_0x8d32('0x21')](_0x35623e);}return _0x1c9126[_0x8d32('0x22')]();};}function saveUpdates(_0x16f2ff,_0x5025d3){return function(_0xc6fbc4){if(_0xc6fbc4){return _0xc6fbc4['update'](_0x16f2ff)[_0x8d32('0x23')](function(_0x14f8ab){return _0x14f8ab;});}return null;};}function removeEntity(_0xd3fa62,_0x26e76b){return function(_0x5833dd){if(_0x5833dd){return _0x5833dd['destroy']()[_0x8d32('0x23')](function(){var _0x1bfa34=_0x5833dd['get']({'plain':!![]});var _0x4b9c93=_0x8d32('0x24');return db[_0x8d32('0x25')][_0x8d32('0x26')]({'where':{'type':_0x4b9c93,'resourceId':_0x1bfa34['id']}})['then'](function(){return _0x5833dd;});})[_0x8d32('0x23')](function(){_0xd3fa62[_0x8d32('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f78e,_0x59f691){return function(_0xa6d7e3){if(!_0xa6d7e3){_0x49f78e[_0x8d32('0x17')](0x194);}return _0xa6d7e3;};}function handleError(_0x3ec78c,_0x253a1a){_0x253a1a=_0x253a1a||0x1f4;return function(_0xd647d1){logger['error'](_0xd647d1[_0x8d32('0x27')]);if(_0xd647d1[_0x8d32('0x28')]){delete _0xd647d1[_0x8d32('0x28')];}_0x3ec78c[_0x8d32('0x18')](_0x253a1a)[_0x8d32('0x29')](_0xd647d1);};}exports[_0x8d32('0x2a')]=function(_0x5d3cb2,_0x24d2e4){var _0x491f08={},_0x1a6865={},_0x1f4e90={'count':0x0,'rows':[]};var _0x54a979=_[_0x8d32('0x2b')](db[_0x8d32('0x2c')]['rawAttributes'],function(_0xaee864){return{'name':_0xaee864['fieldName'],'type':_0xaee864['type'][_0x8d32('0x2d')]};});_0x1a6865[_0x8d32('0x2e')]=_['map'](_0x54a979,_0x8d32('0x28'));_0x1a6865['query']=_[_0x8d32('0x2f')](_0x5d3cb2[_0x8d32('0x30')]);_0x1a6865[_0x8d32('0x31')]=_[_0x8d32('0x32')](_0x1a6865[_0x8d32('0x2e')],_0x1a6865['query']);_0x491f08['attributes']=_['intersection'](_0x1a6865[_0x8d32('0x2e')],qs[_0x8d32('0x33')](_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x33')]));_0x491f08['attributes']=_0x491f08[_0x8d32('0x34')][_0x8d32('0x35')]?_0x491f08['attributes']:_0x1a6865['model'];if(!_0x5d3cb2['query'][_0x8d32('0x36')]('nolimit')){_0x491f08[_0x8d32('0x1d')]=qs['limit'](_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x1d')]);_0x491f08[_0x8d32('0x1b')]=qs[_0x8d32('0x1b')](_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x1b')]);}_0x491f08[_0x8d32('0x37')]=qs[_0x8d32('0x38')](_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x38')]);_0x491f08['where']=qs[_0x8d32('0x31')](_['pick'](_0x5d3cb2[_0x8d32('0x30')],_0x1a6865[_0x8d32('0x31')]),_0x54a979);if(_0x5d3cb2[_0x8d32('0x30')]['filter']){_0x491f08[_0x8d32('0x39')]=_['merge'](_0x491f08['where'],{'$or':_[_0x8d32('0x2b')](_0x54a979,function(_0x5a4c0a){if(_0x5a4c0a[_0x8d32('0x3a')]!==_0x8d32('0x3b')){var _0x1bc1cc={};_0x1bc1cc[_0x5a4c0a['name']]={'$like':'%'+_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x3c')]+'%'};return _0x1bc1cc;}})});}_0x491f08=_['merge']({},_0x491f08,_0x5d3cb2[_0x8d32('0x3d')]);var _0x586907={'where':_0x491f08['where']};return db[_0x8d32('0x2c')][_0x8d32('0x1e')](_0x586907)['then'](function(_0x174e91){_0x1f4e90[_0x8d32('0x1e')]=_0x174e91;if(_0x5d3cb2[_0x8d32('0x30')][_0x8d32('0x3e')]){_0x491f08['include']=[{'all':!![]}];}return db['Template'][_0x8d32('0x3f')](_0x491f08);})['then'](function(_0x2620ce){_0x1f4e90[_0x8d32('0x40')]=_0x2620ce;return _0x1f4e90;})['then'](respondWithFilteredResult(_0x24d2e4,_0x491f08))[_0x8d32('0x41')](handleError(_0x24d2e4,null));};exports['show']=function(_0xa88c15,_0xd65f7f){var _0x34437d={'raw':!![],'where':{'id':_0xa88c15[_0x8d32('0x42')]['id']}},_0xcf8433={};_0xcf8433[_0x8d32('0x2e')]=_[_0x8d32('0x2f')](db[_0x8d32('0x2c')][_0x8d32('0x43')]);_0xcf8433[_0x8d32('0x30')]=_[_0x8d32('0x2f')](_0xa88c15['query']);_0xcf8433[_0x8d32('0x31')]=_['intersection'](_0xcf8433[_0x8d32('0x2e')],_0xcf8433[_0x8d32('0x30')]);_0x34437d['attributes']=_[_0x8d32('0x32')](_0xcf8433[_0x8d32('0x2e')],qs['fields'](_0xa88c15[_0x8d32('0x30')]['fields']));_0x34437d[_0x8d32('0x34')]=_0x34437d['attributes'][_0x8d32('0x35')]?_0x34437d[_0x8d32('0x34')]:_0xcf8433[_0x8d32('0x2e')];if(_0xa88c15[_0x8d32('0x30')][_0x8d32('0x3e')]){_0x34437d[_0x8d32('0x44')]=[{'all':!![]}];}_0x34437d=_[_0x8d32('0x45')]({},_0x34437d,_0xa88c15['options']);return db['Template']['find'](_0x34437d)[_0x8d32('0x23')](handleEntityNotFound(_0xd65f7f,null))[_0x8d32('0x23')](respondWithResult(_0xd65f7f,null))[_0x8d32('0x41')](handleError(_0xd65f7f,null));};exports[_0x8d32('0x46')]=function(_0x853523,_0x5e774b){return db[_0x8d32('0x2c')][_0x8d32('0x46')](_0x853523[_0x8d32('0x47')],{})[_0x8d32('0x23')](function(_0x2d9ed9){var _0x142942=_0x853523[_0x8d32('0x48')]['get']({'plain':!![]});if(!_0x142942)throw new Error(_0x8d32('0x49'));if(_0x142942[_0x8d32('0x4a')]===_0x8d32('0x48')){var _0x3a44e1=_0x2d9ed9['get']({'plain':!![]});var _0x51b7de='Templates';return db[_0x8d32('0x4b')][_0x8d32('0x4c')]({'where':{'name':_0x51b7de,'userProfileId':_0x142942['userProfileId']},'raw':!![]})[_0x8d32('0x23')](function(_0x586514){if(_0x586514&&_0x586514[_0x8d32('0x4d')]===0x0){return db['UserProfileResource'][_0x8d32('0x46')]({'name':_0x3a44e1['name'],'resourceId':_0x3a44e1['id'],'type':_0x586514[_0x8d32('0x28')],'sectionId':_0x586514['id']},{})['then'](function(){return _0x2d9ed9;});}else{return _0x2d9ed9;}})[_0x8d32('0x41')](function(_0x535807){logger[_0x8d32('0x4e')](_0x8d32('0x4f'),_0x535807);throw _0x535807;});}return _0x2d9ed9;})['then'](respondWithResult(_0x5e774b,0xc9))['catch'](handleError(_0x5e774b,null));};exports['update']=function(_0xf03ac3,_0x23bbce){if(_0xf03ac3[_0x8d32('0x47')]['id']){delete _0xf03ac3['body']['id'];}return db['Template']['find']({'where':{'id':_0xf03ac3['params']['id']}})['then'](handleEntityNotFound(_0x23bbce,null))[_0x8d32('0x23')](saveUpdates(_0xf03ac3[_0x8d32('0x47')],null))['then'](respondWithResult(_0x23bbce,null))[_0x8d32('0x41')](handleError(_0x23bbce,null));};exports[_0x8d32('0x26')]=function(_0xd69dab,_0xa1a001){return db[_0x8d32('0x2c')]['find']({'where':{'id':_0xd69dab[_0x8d32('0x42')]['id']}})['then'](handleEntityNotFound(_0xa1a001,null))[_0x8d32('0x23')](removeEntity(_0xa1a001,null))[_0x8d32('0x41')](handleError(_0xa1a001,null));}; \ No newline at end of file +var _0xbb70=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Templates','UserProfileResource','name','send','Template','rawAttributes','type','key','model','filters','query','attributes','intersection','fields','length'];(function(_0x480957,_0x2632b7){var _0x5101d3=function(_0xca6835){while(--_0xca6835){_0x480957['push'](_0x480957['shift']());}};_0x5101d3(++_0x2632b7);}(_0xbb70,0x1e4));var _0x0bb7=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbb70[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0x0bb7('0x0'));var rimraf=require(_0x0bb7('0x1'));var zipdir=require(_0x0bb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bb7('0x3'));var moment=require('moment');var BPromise=require(_0x0bb7('0x4'));var Mustache=require(_0x0bb7('0x5'));var util=require(_0x0bb7('0x6'));var path=require(_0x0bb7('0x7'));var sox=require(_0x0bb7('0x8'));var csv=require('to-csv');var ejs=require(_0x0bb7('0x9'));var fs=require('fs');var fs_extra=require(_0x0bb7('0xa'));var _=require(_0x0bb7('0xb'));var squel=require(_0x0bb7('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bb7('0xd'));var deskjs=require(_0x0bb7('0xe'));var toCsv=require(_0x0bb7('0xf'));var querystring=require(_0x0bb7('0x10'));var Papa=require('papaparse');var Redis=require(_0x0bb7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bb7('0x12'));var hardwareService=require(_0x0bb7('0x13'));var logger=require(_0x0bb7('0x14'))(_0x0bb7('0x15'));var utils=require(_0x0bb7('0x16'));var config=require(_0x0bb7('0x17'));var licenseUtil=require(_0x0bb7('0x18'));var db=require(_0x0bb7('0x19'))['db'];function respondWithStatusCode(_0x36da10,_0x1d7a15){_0x1d7a15=_0x1d7a15||0xcc;return function(_0x3c508c){if(_0x3c508c){return _0x36da10['sendStatus'](_0x1d7a15);}return _0x36da10[_0x0bb7('0x1a')](_0x1d7a15)[_0x0bb7('0x1b')]();};}function respondWithResult(_0x5d3a25,_0x4c14fb){_0x4c14fb=_0x4c14fb||0xc8;return function(_0x3ab296){if(_0x3ab296){return _0x5d3a25['status'](_0x4c14fb)[_0x0bb7('0x1c')](_0x3ab296);}};}function respondWithFilteredResult(_0x62cea2,_0x31456c){return function(_0x2363d6){if(_0x2363d6){var _0x14e390=typeof _0x31456c[_0x0bb7('0x1d')]===_0x0bb7('0x1e')&&typeof _0x31456c[_0x0bb7('0x1f')]===_0x0bb7('0x1e');var _0x547af2=_0x2363d6[_0x0bb7('0x20')];var _0xb8a7d1=_0x14e390?0x0:_0x31456c['offset'];var _0x3c4a73=_0x14e390?_0x2363d6[_0x0bb7('0x20')]:_0x31456c[_0x0bb7('0x1d')]+_0x31456c[_0x0bb7('0x1f')];var _0x385378;if(_0x3c4a73>=_0x547af2){_0x3c4a73=_0x547af2;_0x385378=0xc8;}else{_0x385378=0xce;}_0x62cea2['status'](_0x385378);return _0x62cea2[_0x0bb7('0x21')](_0x0bb7('0x22'),_0xb8a7d1+'-'+_0x3c4a73+'/'+_0x547af2)[_0x0bb7('0x1c')](_0x2363d6);}return null;};}function patchUpdates(_0x1bfcc4){return function(_0x3d0bba){try{jsonpatch['apply'](_0x3d0bba,_0x1bfcc4,!![]);}catch(_0x23b140){return BPromise['reject'](_0x23b140);}return _0x3d0bba[_0x0bb7('0x23')]();};}function saveUpdates(_0x37d71f,_0x4b8ae0){return function(_0xcadda3){if(_0xcadda3){return _0xcadda3[_0x0bb7('0x24')](_0x37d71f)[_0x0bb7('0x25')](function(_0x2f3d42){return _0x2f3d42;});}return null;};}function removeEntity(_0x4953f9,_0x11792a){return function(_0x18e656){if(_0x18e656){return _0x18e656[_0x0bb7('0x26')]()[_0x0bb7('0x25')](function(){var _0x7816cd=_0x18e656[_0x0bb7('0x27')]({'plain':!![]});var _0x47c4b4=_0x0bb7('0x28');return db[_0x0bb7('0x29')][_0x0bb7('0x26')]({'where':{'type':_0x47c4b4,'resourceId':_0x7816cd['id']}})[_0x0bb7('0x25')](function(){return _0x18e656;});})['then'](function(){_0x4953f9[_0x0bb7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fbed,_0x557fe6){return function(_0x29d03a){if(!_0x29d03a){_0x56fbed['sendStatus'](0x194);}return _0x29d03a;};}function handleError(_0x3cd5a6,_0x1a3e01){_0x1a3e01=_0x1a3e01||0x1f4;return function(_0x25b0e7){logger['error'](_0x25b0e7['stack']);if(_0x25b0e7[_0x0bb7('0x2a')]){delete _0x25b0e7[_0x0bb7('0x2a')];}_0x3cd5a6[_0x0bb7('0x1a')](_0x1a3e01)[_0x0bb7('0x2b')](_0x25b0e7);};}exports['index']=function(_0x7a79ae,_0x2f7eb8){var _0x5e445a={},_0x2d08a9={},_0x548304={'count':0x0,'rows':[]};var _0x213db9=_['map'](db[_0x0bb7('0x2c')][_0x0bb7('0x2d')],function(_0x3be436){return{'name':_0x3be436['fieldName'],'type':_0x3be436[_0x0bb7('0x2e')][_0x0bb7('0x2f')]};});_0x2d08a9[_0x0bb7('0x30')]=_['map'](_0x213db9,_0x0bb7('0x2a'));_0x2d08a9['query']=_['keys'](_0x7a79ae['query']);_0x2d08a9[_0x0bb7('0x31')]=_['intersection'](_0x2d08a9[_0x0bb7('0x30')],_0x2d08a9[_0x0bb7('0x32')]);_0x5e445a[_0x0bb7('0x33')]=_[_0x0bb7('0x34')](_0x2d08a9[_0x0bb7('0x30')],qs[_0x0bb7('0x35')](_0x7a79ae[_0x0bb7('0x32')]['fields']));_0x5e445a[_0x0bb7('0x33')]=_0x5e445a[_0x0bb7('0x33')][_0x0bb7('0x36')]?_0x5e445a[_0x0bb7('0x33')]:_0x2d08a9[_0x0bb7('0x30')];if(!_0x7a79ae['query'][_0x0bb7('0x37')](_0x0bb7('0x38'))){_0x5e445a[_0x0bb7('0x1f')]=qs[_0x0bb7('0x1f')](_0x7a79ae[_0x0bb7('0x32')][_0x0bb7('0x1f')]);_0x5e445a[_0x0bb7('0x1d')]=qs[_0x0bb7('0x1d')](_0x7a79ae[_0x0bb7('0x32')]['offset']);}_0x5e445a[_0x0bb7('0x39')]=qs[_0x0bb7('0x3a')](_0x7a79ae['query'][_0x0bb7('0x3a')]);_0x5e445a[_0x0bb7('0x3b')]=qs[_0x0bb7('0x31')](_[_0x0bb7('0x3c')](_0x7a79ae[_0x0bb7('0x32')],_0x2d08a9['filters']),_0x213db9);if(_0x7a79ae['query'][_0x0bb7('0x3d')]){_0x5e445a[_0x0bb7('0x3b')]=_[_0x0bb7('0x3e')](_0x5e445a['where'],{'$or':_[_0x0bb7('0x3f')](_0x213db9,function(_0x3398b2){if(_0x3398b2[_0x0bb7('0x2e')]!==_0x0bb7('0x40')){var _0x1ea0f6={};_0x1ea0f6[_0x3398b2[_0x0bb7('0x2a')]]={'$like':'%'+_0x7a79ae[_0x0bb7('0x32')]['filter']+'%'};return _0x1ea0f6;}})});}_0x5e445a=_['merge']({},_0x5e445a,_0x7a79ae[_0x0bb7('0x41')]);var _0x17d767={'where':_0x5e445a[_0x0bb7('0x3b')]};return db['Template']['count'](_0x17d767)[_0x0bb7('0x25')](function(_0x5db73e){_0x548304['count']=_0x5db73e;if(_0x7a79ae[_0x0bb7('0x32')][_0x0bb7('0x42')]){_0x5e445a[_0x0bb7('0x43')]=[{'all':!![]}];}return db['Template'][_0x0bb7('0x44')](_0x5e445a);})['then'](function(_0x4d460f){_0x548304['rows']=_0x4d460f;return _0x548304;})[_0x0bb7('0x25')](respondWithFilteredResult(_0x2f7eb8,_0x5e445a))['catch'](handleError(_0x2f7eb8,null));};exports[_0x0bb7('0x45')]=function(_0x2b4b7d,_0x1c5fa3){var _0x266729={'raw':!![],'where':{'id':_0x2b4b7d[_0x0bb7('0x46')]['id']}},_0x35aad6={};_0x35aad6['model']=_[_0x0bb7('0x47')](db[_0x0bb7('0x2c')][_0x0bb7('0x2d')]);_0x35aad6[_0x0bb7('0x32')]=_[_0x0bb7('0x47')](_0x2b4b7d[_0x0bb7('0x32')]);_0x35aad6['filters']=_[_0x0bb7('0x34')](_0x35aad6[_0x0bb7('0x30')],_0x35aad6[_0x0bb7('0x32')]);_0x266729['attributes']=_[_0x0bb7('0x34')](_0x35aad6[_0x0bb7('0x30')],qs['fields'](_0x2b4b7d[_0x0bb7('0x32')][_0x0bb7('0x35')]));_0x266729[_0x0bb7('0x33')]=_0x266729[_0x0bb7('0x33')][_0x0bb7('0x36')]?_0x266729[_0x0bb7('0x33')]:_0x35aad6[_0x0bb7('0x30')];if(_0x2b4b7d['query'][_0x0bb7('0x42')]){_0x266729[_0x0bb7('0x43')]=[{'all':!![]}];}_0x266729=_[_0x0bb7('0x3e')]({},_0x266729,_0x2b4b7d['options']);return db['Template'][_0x0bb7('0x48')](_0x266729)[_0x0bb7('0x25')](handleEntityNotFound(_0x1c5fa3,null))[_0x0bb7('0x25')](respondWithResult(_0x1c5fa3,null))[_0x0bb7('0x49')](handleError(_0x1c5fa3,null));};exports['create']=function(_0x1f9903,_0x4f0c5a){return db[_0x0bb7('0x2c')][_0x0bb7('0x4a')](_0x1f9903[_0x0bb7('0x4b')],{})[_0x0bb7('0x25')](function(_0x2cad25){var _0x218f38=_0x1f9903['user'][_0x0bb7('0x27')]({'plain':!![]});if(!_0x218f38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x218f38['role']==='user'){var _0x4c0e92=_0x2cad25[_0x0bb7('0x27')]({'plain':!![]});var _0x1868cc=_0x0bb7('0x28');return db['UserProfileSection'][_0x0bb7('0x48')]({'where':{'name':_0x1868cc,'userProfileId':_0x218f38['userProfileId']},'raw':!![]})['then'](function(_0x42db28){if(_0x42db28&&_0x42db28['autoAssociation']===0x0){return db[_0x0bb7('0x29')][_0x0bb7('0x4a')]({'name':_0x4c0e92['name'],'resourceId':_0x4c0e92['id'],'type':_0x42db28[_0x0bb7('0x2a')],'sectionId':_0x42db28['id']},{})[_0x0bb7('0x25')](function(){return _0x2cad25;});}else{return _0x2cad25;}})['catch'](function(_0x4e9bfc){logger['error'](_0x0bb7('0x4c'),_0x4e9bfc);throw _0x4e9bfc;});}return _0x2cad25;})[_0x0bb7('0x25')](respondWithResult(_0x4f0c5a,0xc9))[_0x0bb7('0x49')](handleError(_0x4f0c5a,null));};exports[_0x0bb7('0x24')]=function(_0x4f7d9f,_0x1fd9d7){if(_0x4f7d9f[_0x0bb7('0x4b')]['id']){delete _0x4f7d9f[_0x0bb7('0x4b')]['id'];}return db['Template']['find']({'where':{'id':_0x4f7d9f['params']['id']}})[_0x0bb7('0x25')](handleEntityNotFound(_0x1fd9d7,null))[_0x0bb7('0x25')](saveUpdates(_0x4f7d9f[_0x0bb7('0x4b')],null))[_0x0bb7('0x25')](respondWithResult(_0x1fd9d7,null))[_0x0bb7('0x49')](handleError(_0x1fd9d7,null));};exports['destroy']=function(_0xfcfb7b,_0x4cd62f){return db[_0x0bb7('0x2c')][_0x0bb7('0x48')]({'where':{'id':_0xfcfb7b[_0x0bb7('0x46')]['id']}})[_0x0bb7('0x25')](handleEntityNotFound(_0x4cd62f,null))[_0x0bb7('0x25')](removeEntity(_0x4cd62f,null))['catch'](handleError(_0x4cd62f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bb3f9bf..3f7e60f 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 _0xd994=['request-promise','rimraf','../../config/environment','./template.attributes','define','Template','util','../../config/logger','api','moment','bluebird'];(function(_0x115853,_0x45825c){var _0x4c7fb7=function(_0x27cc7b){while(--_0x27cc7b){_0x115853['push'](_0x115853['shift']());}};_0x4c7fb7(++_0x45825c);}(_0xd994,0x74));var _0x4d99=function(_0x2dcd16,_0x21f1b9){_0x2dcd16=_0x2dcd16-0x0;var _0xdb328c=_0xd994[_0x2dcd16];return _0xdb328c;};'use strict';var _=require('lodash');var util=require(_0x4d99('0x0'));var logger=require(_0x4d99('0x1'))(_0x4d99('0x2'));var moment=require(_0x4d99('0x3'));var BPromise=require(_0x4d99('0x4'));var rp=require(_0x4d99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d99('0x6'));var config=require(_0x4d99('0x7'));var attributes=require(_0x4d99('0x8'));module['exports']=function(_0x461320,_0x4bbc7b){return _0x461320[_0x4d99('0x9')](_0x4d99('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24bb=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','../../config/logger','api','moment'];(function(_0x238d76,_0x3fd972){var _0x26fa29=function(_0x50b03c){while(--_0x50b03c){_0x238d76['push'](_0x238d76['shift']());}};_0x26fa29(++_0x3fd972);}(_0x24bb,0x19d));var _0xb24b=function(_0x40c522,_0x1de007){_0x40c522=_0x40c522-0x0;var _0x4288b0=_0x24bb[_0x40c522];return _0x4288b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb24b('0x0'))(_0xb24b('0x1'));var moment=require(_0xb24b('0x2'));var BPromise=require(_0xb24b('0x3'));var rp=require(_0xb24b('0x4'));var fs=require('fs');var path=require(_0xb24b('0x5'));var rimraf=require(_0xb24b('0x6'));var config=require(_0xb24b('0x7'));var attributes=require(_0xb24b('0x8'));module[_0xb24b('0x9')]=function(_0x20c854,_0x24ee85){return _0x20c854[_0xb24b('0xa')](_0xb24b('0xb'),attributes,{'tableName':_0xb24b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 8d889d5..7b9a6a2 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 _0x8d58=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8d58,0x1a8));var _0x88d5=function(_0x345060,_0x2fb966){_0x345060=_0x345060-0x0;var _0xec1d2e=_0x8d58[_0x345060];return _0xec1d2e;};'use strict';var _=require(_0x88d5('0x0'));var util=require('util');var moment=require(_0x88d5('0x1'));var BPromise=require(_0x88d5('0x2'));var rs=require(_0x88d5('0x3'));var fs=require('fs');var Redis=require(_0x88d5('0x4'));var db=require(_0x88d5('0x5'))['db'];var utils=require(_0x88d5('0x6'));var logger=require(_0x88d5('0x7'))(_0x88d5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x88d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eaf86,_0x7e33bc,_0x1996e6){return new BPromise(function(_0x3155c2,_0x33a1bd){return client[_0x88d5('0xa')](_0x5eaf86,_0x1996e6)['then'](function(_0x28fa38){logger[_0x88d5('0xb')](_0x88d5('0xc'),_0x7e33bc,_0x88d5('0xd'));logger[_0x88d5('0xe')](_0x88d5('0xf'),_0x7e33bc,_0x88d5('0xd'),JSON[_0x88d5('0x10')](_0x28fa38));if(_0x28fa38[_0x88d5('0x11')]){if(_0x28fa38[_0x88d5('0x11')][_0x88d5('0x12')]===0x1f4){logger[_0x88d5('0x11')](_0x88d5('0xc'),_0x7e33bc,_0x28fa38['error'][_0x88d5('0x13')]);return _0x33a1bd(_0x28fa38[_0x88d5('0x11')][_0x88d5('0x13')]);}logger['error']('Template,\x20%s,\x20%s',_0x7e33bc,_0x28fa38['error'][_0x88d5('0x13')]);return _0x3155c2(_0x28fa38[_0x88d5('0x11')][_0x88d5('0x13')]);}else{logger[_0x88d5('0xb')]('Template,\x20%s,\x20%s',_0x7e33bc,_0x88d5('0xd'));_0x3155c2(_0x28fa38[_0x88d5('0x14')][_0x88d5('0x13')]);}})[_0x88d5('0x15')](function(_0x3d0372){logger[_0x88d5('0x11')](_0x88d5('0xc'),_0x7e33bc,_0x3d0372);_0x33a1bd(_0x3d0372);});});}exports[_0x88d5('0x16')]=function(_0x3bf68b){var _0x36f53b=this;return new Promise(function(_0x41340b,_0x557595){return db['Template'][_0x88d5('0x17')]({'raw':_0x3bf68b[_0x88d5('0x18')]?_0x3bf68b[_0x88d5('0x18')][_0x88d5('0x19')]===undefined?!![]:![]:!![],'where':_0x3bf68b[_0x88d5('0x18')]?_0x3bf68b[_0x88d5('0x18')][_0x88d5('0x1a')]||null:null,'attributes':_0x3bf68b[_0x88d5('0x18')]?_0x3bf68b[_0x88d5('0x18')][_0x88d5('0x1b')]||null:null,'limit':_0x3bf68b['options']?_0x3bf68b['options'][_0x88d5('0x1c')]||null:null,'include':_0x3bf68b[_0x88d5('0x18')]?_0x3bf68b[_0x88d5('0x18')][_0x88d5('0x1d')]?_[_0x88d5('0x1e')](_0x3bf68b[_0x88d5('0x18')][_0x88d5('0x1d')],function(_0x28bc33){return{'model':db[_0x28bc33[_0x88d5('0x1f')]],'as':_0x28bc33['as'],'attributes':_0x28bc33[_0x88d5('0x1b')],'include':_0x28bc33['include']?_[_0x88d5('0x1e')](_0x28bc33[_0x88d5('0x1d')],function(_0x4e60bb){return{'model':db[_0x4e60bb[_0x88d5('0x1f')]],'as':_0x4e60bb['as'],'attributes':_0x4e60bb[_0x88d5('0x1b')],'include':_0x4e60bb['include']?_[_0x88d5('0x1e')](_0x4e60bb['include'],function(_0x3796d5){return{'model':db[_0x3796d5['model']],'as':_0x3796d5['as'],'attributes':_0x3796d5[_0x88d5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x88d5('0x20')](function(_0x11f6c8){logger[_0x88d5('0xb')]('GetTemplate',_0x3bf68b);logger[_0x88d5('0xe')](_0x88d5('0x16'),_0x3bf68b,JSON[_0x88d5('0x10')](_0x11f6c8));_0x41340b(_0x11f6c8);})[_0x88d5('0x15')](function(_0x58ba05){logger[_0x88d5('0x11')](_0x88d5('0x16'),_0x58ba05['message'],_0x3bf68b);_0x557595(_0x36f53b[_0x88d5('0x11')](0x1f4,_0x58ba05[_0x88d5('0x13')]));});});}; \ No newline at end of file +var _0x9bee=['../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','Template','findAll','options','raw','where','attributes','include','map','model','GetTemplate','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x541203,_0xd0afcf){var _0x422daf=function(_0x4523d8){while(--_0x4523d8){_0x541203['push'](_0x541203['shift']());}};_0x422daf(++_0xd0afcf);}(_0x9bee,0xfa));var _0xe9be=function(_0x3e2ff2,_0x36dfe5){_0x3e2ff2=_0x3e2ff2-0x0;var _0x1ea1b2=_0x9bee[_0x3e2ff2];return _0x1ea1b2;};'use strict';var _=require(_0xe9be('0x0'));var util=require(_0xe9be('0x1'));var moment=require(_0xe9be('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9be('0x3'));var fs=require('fs');var Redis=require(_0xe9be('0x4'));var db=require(_0xe9be('0x5'))['db'];var utils=require(_0xe9be('0x6'));var logger=require(_0xe9be('0x7'))(_0xe9be('0x8'));var config=require('../../config/environment');var jayson=require(_0xe9be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51ba72,_0x5333c4,_0x2346b7){return new BPromise(function(_0x22102f,_0x54c1b9){return client['request'](_0x51ba72,_0x2346b7)[_0xe9be('0xa')](function(_0x13fdf9){logger[_0xe9be('0xb')]('Template,\x20%s,\x20%s',_0x5333c4,_0xe9be('0xc'));logger['debug'](_0xe9be('0xd'),_0x5333c4,_0xe9be('0xc'),JSON[_0xe9be('0xe')](_0x13fdf9));if(_0x13fdf9[_0xe9be('0xf')]){if(_0x13fdf9[_0xe9be('0xf')][_0xe9be('0x10')]===0x1f4){logger[_0xe9be('0xf')](_0xe9be('0x11'),_0x5333c4,_0x13fdf9[_0xe9be('0xf')][_0xe9be('0x12')]);return _0x54c1b9(_0x13fdf9['error'][_0xe9be('0x12')]);}logger[_0xe9be('0xf')]('Template,\x20%s,\x20%s',_0x5333c4,_0x13fdf9[_0xe9be('0xf')][_0xe9be('0x12')]);return _0x22102f(_0x13fdf9[_0xe9be('0xf')][_0xe9be('0x12')]);}else{logger[_0xe9be('0xb')]('Template,\x20%s,\x20%s',_0x5333c4,'request\x20sent');_0x22102f(_0x13fdf9[_0xe9be('0x13')]['message']);}})[_0xe9be('0x14')](function(_0x1cf199){logger[_0xe9be('0xf')]('Template,\x20%s,\x20%s',_0x5333c4,_0x1cf199);_0x54c1b9(_0x1cf199);});});}exports['GetTemplate']=function(_0x339fb6){var _0x15bb63=this;return new Promise(function(_0x2d23ad,_0x255521){return db[_0xe9be('0x15')][_0xe9be('0x16')]({'raw':_0x339fb6['options']?_0x339fb6[_0xe9be('0x17')][_0xe9be('0x18')]===undefined?!![]:![]:!![],'where':_0x339fb6[_0xe9be('0x17')]?_0x339fb6[_0xe9be('0x17')][_0xe9be('0x19')]||null:null,'attributes':_0x339fb6['options']?_0x339fb6[_0xe9be('0x17')][_0xe9be('0x1a')]||null:null,'limit':_0x339fb6['options']?_0x339fb6[_0xe9be('0x17')]['limit']||null:null,'include':_0x339fb6[_0xe9be('0x17')]?_0x339fb6['options'][_0xe9be('0x1b')]?_[_0xe9be('0x1c')](_0x339fb6['options']['include'],function(_0xd6237b){return{'model':db[_0xd6237b[_0xe9be('0x1d')]],'as':_0xd6237b['as'],'attributes':_0xd6237b['attributes'],'include':_0xd6237b[_0xe9be('0x1b')]?_[_0xe9be('0x1c')](_0xd6237b[_0xe9be('0x1b')],function(_0x426ef5){return{'model':db[_0x426ef5[_0xe9be('0x1d')]],'as':_0x426ef5['as'],'attributes':_0x426ef5['attributes'],'include':_0x426ef5[_0xe9be('0x1b')]?_[_0xe9be('0x1c')](_0x426ef5[_0xe9be('0x1b')],function(_0x39562e){return{'model':db[_0x39562e[_0xe9be('0x1d')]],'as':_0x39562e['as'],'attributes':_0x39562e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9be('0xa')](function(_0x33dc99){logger[_0xe9be('0xb')](_0xe9be('0x1e'),_0x339fb6);logger[_0xe9be('0x1f')](_0xe9be('0x1e'),_0x339fb6,JSON[_0xe9be('0xe')](_0x33dc99));_0x2d23ad(_0x33dc99);})[_0xe9be('0x14')](function(_0x338da5){logger['error']('GetTemplate',_0x338da5[_0xe9be('0x12')],_0x339fb6);_0x255521(_0x15bb63['error'](0x1f4,_0x338da5['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3948979..e290df3 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 _0x56a0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAnyConditions','/:id/actions','post','/:id/all_conditions','/:id/any_conditions','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2ab7f3,_0x5e6fd2){var _0x189a3e=function(_0x54dbd5){while(--_0x54dbd5){_0x2ab7f3['push'](_0x2ab7f3['shift']());}};_0x189a3e(++_0x5e6fd2);}(_0x56a0,0x101));var _0x056a=function(_0x5aaf95,_0x5e8f9b){_0x5aaf95=_0x5aaf95-0x0;var _0x1eb0c5=_0x56a0[_0x5aaf95];return _0x1eb0c5;};'use strict';var multer=require(_0x056a('0x0'));var util=require(_0x056a('0x1'));var path=require(_0x056a('0x2'));var timeout=require(_0x056a('0x3'));var express=require(_0x056a('0x4'));var router=express[_0x056a('0x5')]();var fs_extra=require(_0x056a('0x6'));var auth=require(_0x056a('0x7'));var interaction=require(_0x056a('0x8'));var config=require(_0x056a('0x9'));var controller=require(_0x056a('0xa'));router[_0x056a('0xb')]('/',auth[_0x056a('0xc')](),controller[_0x056a('0xd')]);router[_0x056a('0xb')]('/:id',auth[_0x056a('0xc')](),controller[_0x056a('0xe')]);router['get']('/:id/all_conditions',auth[_0x056a('0xc')](),controller['getAllConditions']);router[_0x056a('0xb')]('/:id/any_conditions',auth[_0x056a('0xc')](),controller[_0x056a('0xf')]);router[_0x056a('0xb')](_0x056a('0x10'),auth[_0x056a('0xc')](),controller['getActions']);router[_0x056a('0x11')]('/',auth[_0x056a('0xc')](),controller['create']);router[_0x056a('0x11')](_0x056a('0x12'),auth[_0x056a('0xc')](),controller['addAllCondition']);router[_0x056a('0x11')](_0x056a('0x13'),auth[_0x056a('0xc')](),controller['addAnyCondition']);router[_0x056a('0x11')](_0x056a('0x10'),auth['isAuthenticated'](),controller['addAction']);router['put'](_0x056a('0x14'),auth[_0x056a('0xc')](),controller[_0x056a('0x15')]);router[_0x056a('0x16')](_0x056a('0x14'),auth[_0x056a('0xc')](),controller[_0x056a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5546=['post','addAllCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5546,0x79));var _0x6554=function(_0x359656,_0x41804f){_0x359656=_0x359656-0x0;var _0x2a9d82=_0x5546[_0x359656];return _0x2a9d82;};'use strict';var multer=require(_0x6554('0x0'));var util=require(_0x6554('0x1'));var path=require(_0x6554('0x2'));var timeout=require(_0x6554('0x3'));var express=require(_0x6554('0x4'));var router=express[_0x6554('0x5')]();var fs_extra=require(_0x6554('0x6'));var auth=require(_0x6554('0x7'));var interaction=require(_0x6554('0x8'));var config=require('../../config/environment');var controller=require(_0x6554('0x9'));router[_0x6554('0xa')]('/',auth[_0x6554('0xb')](),controller[_0x6554('0xc')]);router[_0x6554('0xa')](_0x6554('0xd'),auth[_0x6554('0xb')](),controller['show']);router[_0x6554('0xa')](_0x6554('0xe'),auth[_0x6554('0xb')](),controller[_0x6554('0xf')]);router['get'](_0x6554('0x10'),auth['isAuthenticated'](),controller[_0x6554('0x11')]);router[_0x6554('0xa')]('/:id/actions',auth['isAuthenticated'](),controller[_0x6554('0x12')]);router[_0x6554('0x13')]('/',auth[_0x6554('0xb')](),controller['create']);router[_0x6554('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x6554('0x14')]);router[_0x6554('0x13')](_0x6554('0x10'),auth[_0x6554('0xb')](),controller['addAnyCondition']);router[_0x6554('0x13')](_0x6554('0x15'),auth[_0x6554('0xb')](),controller[_0x6554('0x16')]);router[_0x6554('0x17')](_0x6554('0xd'),auth[_0x6554('0xb')](),controller[_0x6554('0x18')]);router[_0x6554('0x19')](_0x6554('0xd'),auth[_0x6554('0xb')](),controller[_0x6554('0x1a')]);module[_0x6554('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a79d77e..d122427 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 _0x6003=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6003,0xae));var _0x3600=function(_0x195a3a,_0x2a00e8){_0x195a3a=_0x195a3a-0x0;var _0x5783eb=_0x6003[_0x195a3a];return _0x5783eb;};'use strict';var Sequelize=require(_0x3600('0x0'));module[_0x3600('0x1')]={'name':{'type':Sequelize[_0x3600('0x2')]},'channel':{'type':Sequelize[_0x3600('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfb25=['BOOLEAN','STRING'];(function(_0x1ee2f8,_0x28b42f){var _0x48d644=function(_0x2c8fac){while(--_0x2c8fac){_0x1ee2f8['push'](_0x1ee2f8['shift']());}};_0x48d644(++_0x28b42f);}(_0xfb25,0x14f));var _0x5fb2=function(_0x18a84f,_0x26add7){_0x18a84f=_0x18a84f-0x0;var _0x4cfb46=_0xfb25[_0x18a84f];return _0x4cfb46;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5fb2('0x0')]},'channel':{'type':Sequelize[_0x5fb2('0x0')]},'description':{'type':Sequelize[_0x5fb2('0x0')]},'status':{'type':Sequelize[_0x5fb2('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5d3584c..064079c 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 _0x2ca0=['merge','options','includeAll','findAll','rows','show','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','find','userProfileId','autoAssociation','catch','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','order','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x2ca0,0x141));var _0x02ca=function(_0x30d719,_0x22729b){_0x30d719=_0x30d719-0x0;var _0x21358e=_0x2ca0[_0x30d719];return _0x21358e;};'use strict';var emlformat=require(_0x02ca('0x0'));var rimraf=require(_0x02ca('0x1'));var zipdir=require(_0x02ca('0x2'));var jsonpatch=require(_0x02ca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02ca('0x4'));var Mustache=require(_0x02ca('0x5'));var util=require('util');var path=require(_0x02ca('0x6'));var sox=require(_0x02ca('0x7'));var csv=require(_0x02ca('0x8'));var ejs=require(_0x02ca('0x9'));var fs=require('fs');var fs_extra=require(_0x02ca('0xa'));var _=require(_0x02ca('0xb'));var squel=require(_0x02ca('0xc'));var crypto=require(_0x02ca('0xd'));var jsforce=require(_0x02ca('0xe'));var deskjs=require(_0x02ca('0xf'));var toCsv=require(_0x02ca('0x8'));var querystring=require(_0x02ca('0x10'));var Papa=require(_0x02ca('0x11'));var Redis=require(_0x02ca('0x12'));var authService=require(_0x02ca('0x13'));var qs=require(_0x02ca('0x14'));var as=require(_0x02ca('0x15'));var hardwareService=require(_0x02ca('0x16'));var logger=require(_0x02ca('0x17'))(_0x02ca('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x02ca('0x19'));var db=require(_0x02ca('0x1a'))['db'];function respondWithStatusCode(_0x38f010,_0x5ec2f6){_0x5ec2f6=_0x5ec2f6||0xcc;return function(_0x10d3be){if(_0x10d3be){return _0x38f010['sendStatus'](_0x5ec2f6);}return _0x38f010[_0x02ca('0x1b')](_0x5ec2f6)[_0x02ca('0x1c')]();};}function respondWithResult(_0x2bb3e6,_0x349af7){_0x349af7=_0x349af7||0xc8;return function(_0x12e7e4){if(_0x12e7e4){return _0x2bb3e6[_0x02ca('0x1b')](_0x349af7)[_0x02ca('0x1d')](_0x12e7e4);}};}function respondWithFilteredResult(_0x453681,_0x499187){return function(_0x1a5342){if(_0x1a5342){var _0x324af0=typeof _0x499187[_0x02ca('0x1e')]===_0x02ca('0x1f')&&typeof _0x499187[_0x02ca('0x20')]==='undefined';var _0x42a675=_0x1a5342['count'];var _0x19ef6f=_0x324af0?0x0:_0x499187['offset'];var _0x419b86=_0x324af0?_0x1a5342[_0x02ca('0x21')]:_0x499187[_0x02ca('0x1e')]+_0x499187[_0x02ca('0x20')];var _0x5eac21;if(_0x419b86>=_0x42a675){_0x419b86=_0x42a675;_0x5eac21=0xc8;}else{_0x5eac21=0xce;}_0x453681[_0x02ca('0x1b')](_0x5eac21);return _0x453681[_0x02ca('0x22')](_0x02ca('0x23'),_0x19ef6f+'-'+_0x419b86+'/'+_0x42a675)[_0x02ca('0x1d')](_0x1a5342);}return null;};}function patchUpdates(_0x5759bb){return function(_0x32d4ad){try{jsonpatch[_0x02ca('0x24')](_0x32d4ad,_0x5759bb,!![]);}catch(_0x182d75){return BPromise[_0x02ca('0x25')](_0x182d75);}return _0x32d4ad[_0x02ca('0x26')]();};}function saveUpdates(_0x3a2908,_0x3cf74b){return function(_0x56b410){if(_0x56b410){return _0x56b410[_0x02ca('0x27')](_0x3a2908)[_0x02ca('0x28')](function(_0x328d73){return _0x328d73;});}return null;};}function removeEntity(_0x92b9af,_0xa10ded){return function(_0x413213){if(_0x413213){return _0x413213[_0x02ca('0x29')]()[_0x02ca('0x28')](function(){var _0x35c0f9=_0x413213[_0x02ca('0x2a')]({'plain':!![]});var _0x5b385f='Triggers';return db[_0x02ca('0x2b')][_0x02ca('0x29')]({'where':{'type':_0x5b385f,'resourceId':_0x35c0f9['id']}})[_0x02ca('0x28')](function(){return _0x413213;});})[_0x02ca('0x28')](function(){_0x92b9af[_0x02ca('0x1b')](0xcc)[_0x02ca('0x1c')]();});}};}function handleEntityNotFound(_0x37ef7e,_0x4d57c7){return function(_0x12bf08){if(!_0x12bf08){_0x37ef7e[_0x02ca('0x2c')](0x194);}return _0x12bf08;};}function handleError(_0xb4e311,_0x22c5ca){_0x22c5ca=_0x22c5ca||0x1f4;return function(_0x3eab5c){logger[_0x02ca('0x2d')](_0x3eab5c[_0x02ca('0x2e')]);if(_0x3eab5c[_0x02ca('0x2f')]){delete _0x3eab5c['name'];}_0xb4e311[_0x02ca('0x1b')](_0x22c5ca)[_0x02ca('0x30')](_0x3eab5c);};}exports[_0x02ca('0x31')]=function(_0x5adbd8,_0x5cd322){var _0x1a3744={},_0xb65824={},_0x6ab8f2={'count':0x0,'rows':[]};var _0x4c4ec6=_[_0x02ca('0x32')](db[_0x02ca('0x33')][_0x02ca('0x34')],function(_0x5721f8){return{'name':_0x5721f8[_0x02ca('0x35')],'type':_0x5721f8['type'][_0x02ca('0x36')]};});_0xb65824[_0x02ca('0x37')]=_[_0x02ca('0x32')](_0x4c4ec6,_0x02ca('0x2f'));_0xb65824['query']=_['keys'](_0x5adbd8[_0x02ca('0x38')]);_0xb65824[_0x02ca('0x39')]=_['intersection'](_0xb65824[_0x02ca('0x37')],_0xb65824[_0x02ca('0x38')]);_0x1a3744[_0x02ca('0x3a')]=_[_0x02ca('0x3b')](_0xb65824[_0x02ca('0x37')],qs[_0x02ca('0x3c')](_0x5adbd8[_0x02ca('0x38')]['fields']));_0x1a3744[_0x02ca('0x3a')]=_0x1a3744['attributes'][_0x02ca('0x3d')]?_0x1a3744['attributes']:_0xb65824[_0x02ca('0x37')];if(!_0x5adbd8['query']['hasOwnProperty'](_0x02ca('0x3e'))){_0x1a3744[_0x02ca('0x20')]=qs['limit'](_0x5adbd8[_0x02ca('0x38')][_0x02ca('0x20')]);_0x1a3744[_0x02ca('0x1e')]=qs[_0x02ca('0x1e')](_0x5adbd8[_0x02ca('0x38')][_0x02ca('0x1e')]);}_0x1a3744['order']=qs[_0x02ca('0x3f')](_0x5adbd8[_0x02ca('0x38')][_0x02ca('0x3f')]);_0x1a3744[_0x02ca('0x40')]=qs[_0x02ca('0x39')](_[_0x02ca('0x41')](_0x5adbd8[_0x02ca('0x38')],_0xb65824[_0x02ca('0x39')]),_0x4c4ec6);if(_0x5adbd8['query'][_0x02ca('0x42')]){_0x1a3744['where']=_['merge'](_0x1a3744[_0x02ca('0x40')],{'$or':_['map'](_0x4c4ec6,function(_0x90b46c){if(_0x90b46c['type']!=='VIRTUAL'){var _0x5e8386={};_0x5e8386[_0x90b46c[_0x02ca('0x2f')]]={'$like':'%'+_0x5adbd8[_0x02ca('0x38')][_0x02ca('0x42')]+'%'};return _0x5e8386;}})});}_0x1a3744=_[_0x02ca('0x43')]({},_0x1a3744,_0x5adbd8[_0x02ca('0x44')]);var _0x39a435={'where':_0x1a3744[_0x02ca('0x40')]};return db[_0x02ca('0x33')][_0x02ca('0x21')](_0x39a435)['then'](function(_0xf2ed8f){_0x6ab8f2[_0x02ca('0x21')]=_0xf2ed8f;if(_0x5adbd8[_0x02ca('0x38')][_0x02ca('0x45')]){_0x1a3744['include']=[{'all':!![]}];}return db[_0x02ca('0x33')][_0x02ca('0x46')](_0x1a3744);})[_0x02ca('0x28')](function(_0x1979a5){_0x6ab8f2[_0x02ca('0x47')]=_0x1979a5;return _0x6ab8f2;})[_0x02ca('0x28')](respondWithFilteredResult(_0x5cd322,_0x1a3744))['catch'](handleError(_0x5cd322,null));};exports[_0x02ca('0x48')]=function(_0xcd1d0,_0x5ed4d3){var _0x527612={'raw':![],'where':{'id':_0xcd1d0[_0x02ca('0x49')]['id']}},_0x329723={};_0x329723['model']=_['keys'](db[_0x02ca('0x33')][_0x02ca('0x34')]);_0x329723[_0x02ca('0x38')]=_[_0x02ca('0x4a')](_0xcd1d0[_0x02ca('0x38')]);_0x329723[_0x02ca('0x39')]=_['intersection'](_0x329723[_0x02ca('0x37')],_0x329723['query']);_0x527612[_0x02ca('0x3a')]=_[_0x02ca('0x3b')](_0x329723[_0x02ca('0x37')],qs[_0x02ca('0x3c')](_0xcd1d0[_0x02ca('0x38')][_0x02ca('0x3c')]));_0x527612[_0x02ca('0x3a')]=_0x527612['attributes'][_0x02ca('0x3d')]?_0x527612[_0x02ca('0x3a')]:_0x329723[_0x02ca('0x37')];if(_0xcd1d0[_0x02ca('0x38')]['includeAll']){_0x527612['include']=[{'all':!![]}];}_0x527612=_['merge']({},_0x527612,_0xcd1d0[_0x02ca('0x44')]);return db[_0x02ca('0x33')]['find'](_0x527612)[_0x02ca('0x28')](handleEntityNotFound(_0x5ed4d3,null))[_0x02ca('0x28')](respondWithResult(_0x5ed4d3,null))['catch'](handleError(_0x5ed4d3,null));};exports[_0x02ca('0x4b')]=function(_0x24b940,_0x1bcaf2){return db[_0x02ca('0x33')][_0x02ca('0x4b')](_0x24b940[_0x02ca('0x4c')],{})['then'](function(_0xa6041d){var _0x29dbbb=_0x24b940['user'][_0x02ca('0x2a')]({'plain':!![]});if(!_0x29dbbb)throw new Error(_0x02ca('0x4d'));if(_0x29dbbb[_0x02ca('0x4e')]==='user'){var _0xc01974=_0xa6041d[_0x02ca('0x2a')]({'plain':!![]});var _0x217890=_0x02ca('0x4f');return db['UserProfileSection'][_0x02ca('0x50')]({'where':{'name':_0x217890,'userProfileId':_0x29dbbb[_0x02ca('0x51')]},'raw':!![]})[_0x02ca('0x28')](function(_0x3b44b8){if(_0x3b44b8&&_0x3b44b8[_0x02ca('0x52')]===0x0){return db[_0x02ca('0x2b')][_0x02ca('0x4b')]({'name':_0xc01974['name'],'resourceId':_0xc01974['id'],'type':_0x3b44b8['name'],'sectionId':_0x3b44b8['id']},{})[_0x02ca('0x28')](function(){return _0xa6041d;});}else{return _0xa6041d;}})[_0x02ca('0x53')](function(_0x63e717){logger[_0x02ca('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63e717);throw _0x63e717;});}return _0xa6041d;})[_0x02ca('0x28')](respondWithResult(_0x1bcaf2,0xc9))[_0x02ca('0x53')](handleError(_0x1bcaf2,null));};exports[_0x02ca('0x27')]=function(_0x3356e4,_0x18e890){if(_0x3356e4[_0x02ca('0x4c')]['id']){delete _0x3356e4[_0x02ca('0x4c')]['id'];}return db[_0x02ca('0x33')][_0x02ca('0x50')]({'where':{'id':_0x3356e4[_0x02ca('0x49')]['id']}})['then'](handleEntityNotFound(_0x18e890,null))[_0x02ca('0x28')](saveUpdates(_0x3356e4[_0x02ca('0x4c')],null))[_0x02ca('0x28')](respondWithResult(_0x18e890,null))[_0x02ca('0x53')](handleError(_0x18e890,null));};exports[_0x02ca('0x29')]=function(_0x1a267e,_0x4b07b5){return db[_0x02ca('0x33')][_0x02ca('0x50')]({'where':{'id':_0x1a267e[_0x02ca('0x49')]['id']}})[_0x02ca('0x28')](handleEntityNotFound(_0x4b07b5,null))[_0x02ca('0x28')](removeEntity(_0x4b07b5,null))['catch'](handleError(_0x4b07b5,null));};exports[_0x02ca('0x54')]=function(_0x2a91da,_0x2a51ea,_0x27f6ea){if(_0x2a91da[_0x02ca('0x4c')]['id']){delete _0x2a91da[_0x02ca('0x4c')]['id'];}return db[_0x02ca('0x33')]['find']({'where':{'id':_0x2a91da[_0x02ca('0x49')]['id']}})[_0x02ca('0x28')](handleEntityNotFound(_0x2a51ea,null))[_0x02ca('0x28')](function(_0x4a6c6f){if(_0x4a6c6f){_0x2a91da[_0x02ca('0x4c')][_0x02ca('0x55')]=_0x4a6c6f['id'];return db[_0x02ca('0x56')][_0x02ca('0x4b')](_0x2a91da[_0x02ca('0x4c')]);}})[_0x02ca('0x28')](respondWithResult(_0x2a51ea,null))[_0x02ca('0x53')](handleError(_0x2a51ea,null));};exports[_0x02ca('0x57')]=function(_0x37a150,_0x269d3e,_0x1a72f6){if(_0x37a150[_0x02ca('0x4c')]['id']){delete _0x37a150['body']['id'];}return db[_0x02ca('0x33')]['find']({'where':{'id':_0x37a150[_0x02ca('0x49')]['id']}})['then'](handleEntityNotFound(_0x269d3e,null))['then'](function(_0x29d823){if(_0x29d823){_0x37a150[_0x02ca('0x4c')][_0x02ca('0x58')]=_0x29d823['id'];return db['Condition']['create'](_0x37a150[_0x02ca('0x4c')]);}})[_0x02ca('0x28')](respondWithResult(_0x269d3e,null))['catch'](handleError(_0x269d3e,null));};exports['getAllConditions']=function(_0x3dc000,_0x2cfbfd,_0x33e6fd){var _0x259c1c={};var _0x418dc3={};var _0x25c5a8;var _0x5864ae;return db['Trigger'][_0x02ca('0x59')]({'where':{'id':_0x3dc000['params']['id']}})[_0x02ca('0x28')](handleEntityNotFound(_0x2cfbfd,null))[_0x02ca('0x28')](function(_0xe055b2){if(_0xe055b2){_0x25c5a8=_0xe055b2;_0x418dc3[_0x02ca('0x37')]=_['keys'](db['Condition'][_0x02ca('0x34')]);_0x418dc3[_0x02ca('0x38')]=_['keys'](_0x3dc000[_0x02ca('0x38')]);_0x418dc3[_0x02ca('0x39')]=_['intersection'](_0x418dc3['model'],_0x418dc3['query']);_0x259c1c[_0x02ca('0x3a')]=_[_0x02ca('0x3b')](_0x418dc3[_0x02ca('0x37')],qs['fields'](_0x3dc000[_0x02ca('0x38')][_0x02ca('0x3c')]));_0x259c1c[_0x02ca('0x3a')]=_0x259c1c['attributes'][_0x02ca('0x3d')]?_0x259c1c[_0x02ca('0x3a')]:_0x418dc3[_0x02ca('0x37')];_0x259c1c[_0x02ca('0x5a')]=qs['sort'](_0x3dc000['query']['sort']);_0x259c1c[_0x02ca('0x40')]=qs[_0x02ca('0x39')](_[_0x02ca('0x41')](_0x3dc000['query'],_0x418dc3['filters']));if(_0x3dc000[_0x02ca('0x38')]['filter']){_0x259c1c['where']=_[_0x02ca('0x43')](_0x259c1c[_0x02ca('0x40')],{'$or':_['map'](_0x259c1c[_0x02ca('0x3a')],function(_0xf82074){var _0x635622={};_0x635622[_0xf82074]={'$like':'%'+_0x3dc000[_0x02ca('0x38')]['filter']+'%'};return _0x635622;})});}_0x259c1c=_['merge']({},_0x259c1c,_0x3dc000[_0x02ca('0x44')]);return _0x25c5a8[_0x02ca('0x5b')](_0x259c1c);}})['then'](function(_0x114305){if(_0x114305){_0x5864ae=_0x114305['length'];if(!_0x3dc000[_0x02ca('0x38')][_0x02ca('0x5c')](_0x02ca('0x3e'))){_0x259c1c[_0x02ca('0x20')]=qs[_0x02ca('0x20')](_0x3dc000[_0x02ca('0x38')][_0x02ca('0x20')]);_0x259c1c[_0x02ca('0x1e')]=qs['offset'](_0x3dc000['query'][_0x02ca('0x1e')]);}return _0x25c5a8[_0x02ca('0x5b')](_0x259c1c);}})['then'](function(_0x29af27){if(_0x29af27){return _0x29af27?{'count':_0x5864ae,'rows':_0x29af27}:null;}})['then'](respondWithResult(_0x2cfbfd,null))['catch'](handleError(_0x2cfbfd,null));};exports[_0x02ca('0x5d')]=function(_0x555093,_0x5bb3a4,_0x42e824){var _0x2f296b={};var _0x2d2cfa={};var _0x37cb60;var _0x53505d;return db[_0x02ca('0x33')][_0x02ca('0x59')]({'where':{'id':_0x555093['params']['id']}})['then'](handleEntityNotFound(_0x5bb3a4,null))[_0x02ca('0x28')](function(_0x573b29){if(_0x573b29){_0x37cb60=_0x573b29;_0x2d2cfa[_0x02ca('0x37')]=_[_0x02ca('0x4a')](db[_0x02ca('0x56')][_0x02ca('0x34')]);_0x2d2cfa['query']=_['keys'](_0x555093[_0x02ca('0x38')]);_0x2d2cfa['filters']=_[_0x02ca('0x3b')](_0x2d2cfa[_0x02ca('0x37')],_0x2d2cfa[_0x02ca('0x38')]);_0x2f296b[_0x02ca('0x3a')]=_['intersection'](_0x2d2cfa[_0x02ca('0x37')],qs[_0x02ca('0x3c')](_0x555093[_0x02ca('0x38')][_0x02ca('0x3c')]));_0x2f296b[_0x02ca('0x3a')]=_0x2f296b[_0x02ca('0x3a')]['length']?_0x2f296b[_0x02ca('0x3a')]:_0x2d2cfa['model'];_0x2f296b[_0x02ca('0x5a')]=qs[_0x02ca('0x3f')](_0x555093[_0x02ca('0x38')][_0x02ca('0x3f')]);_0x2f296b[_0x02ca('0x40')]=qs[_0x02ca('0x39')](_[_0x02ca('0x41')](_0x555093['query'],_0x2d2cfa[_0x02ca('0x39')]));if(_0x555093[_0x02ca('0x38')][_0x02ca('0x42')]){_0x2f296b[_0x02ca('0x40')]=_[_0x02ca('0x43')](_0x2f296b[_0x02ca('0x40')],{'$or':_[_0x02ca('0x32')](_0x2f296b[_0x02ca('0x3a')],function(_0x25cd9f){var _0x3fee05={};_0x3fee05[_0x25cd9f]={'$like':'%'+_0x555093[_0x02ca('0x38')][_0x02ca('0x42')]+'%'};return _0x3fee05;})});}_0x2f296b=_['merge']({},_0x2f296b,_0x555093['options']);return _0x37cb60[_0x02ca('0x5d')](_0x2f296b);}})[_0x02ca('0x28')](function(_0x85417a){if(_0x85417a){_0x53505d=_0x85417a[_0x02ca('0x3d')];if(!_0x555093['query'][_0x02ca('0x5c')](_0x02ca('0x3e'))){_0x2f296b[_0x02ca('0x20')]=qs['limit'](_0x555093[_0x02ca('0x38')][_0x02ca('0x20')]);_0x2f296b[_0x02ca('0x1e')]=qs[_0x02ca('0x1e')](_0x555093['query']['offset']);}return _0x37cb60[_0x02ca('0x5d')](_0x2f296b);}})[_0x02ca('0x28')](function(_0x5de69b){if(_0x5de69b){return _0x5de69b?{'count':_0x53505d,'rows':_0x5de69b}:null;}})['then'](respondWithResult(_0x5bb3a4,null))['catch'](handleError(_0x5bb3a4,null));};exports['addAction']=function(_0x24c43b,_0x1eec4e,_0x26135b){if(_0x24c43b[_0x02ca('0x4c')]['id']){delete _0x24c43b[_0x02ca('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x24c43b[_0x02ca('0x49')]['id']}})[_0x02ca('0x28')](handleEntityNotFound(_0x1eec4e,null))[_0x02ca('0x28')](function(_0x288ce7){if(_0x288ce7){_0x24c43b[_0x02ca('0x4c')][_0x02ca('0x5e')]=_0x288ce7['id'];return db[_0x02ca('0x5f')][_0x02ca('0x4b')](_0x24c43b[_0x02ca('0x4c')]);}})['then'](respondWithResult(_0x1eec4e,null))['catch'](handleError(_0x1eec4e,null));};exports[_0x02ca('0x60')]=function(_0x590295,_0x14b077,_0x2bf92b){var _0x30fbc2={};var _0x3f1497={};var _0x5ce885;var _0x500d3c;return db[_0x02ca('0x33')][_0x02ca('0x59')]({'where':{'id':_0x590295[_0x02ca('0x49')]['id']}})['then'](handleEntityNotFound(_0x14b077,null))[_0x02ca('0x28')](function(_0x2e8d0f){if(_0x2e8d0f){_0x5ce885=_0x2e8d0f;_0x3f1497[_0x02ca('0x37')]=_['keys'](db[_0x02ca('0x5f')][_0x02ca('0x34')]);_0x3f1497[_0x02ca('0x38')]=_[_0x02ca('0x4a')](_0x590295[_0x02ca('0x38')]);_0x3f1497[_0x02ca('0x39')]=_['intersection'](_0x3f1497[_0x02ca('0x37')],_0x3f1497[_0x02ca('0x38')]);_0x30fbc2[_0x02ca('0x3a')]=_['intersection'](_0x3f1497['model'],qs[_0x02ca('0x3c')](_0x590295['query'][_0x02ca('0x3c')]));_0x30fbc2[_0x02ca('0x3a')]=_0x30fbc2['attributes']['length']?_0x30fbc2[_0x02ca('0x3a')]:_0x3f1497[_0x02ca('0x37')];_0x30fbc2[_0x02ca('0x5a')]=qs['sort'](_0x590295[_0x02ca('0x38')][_0x02ca('0x3f')]);_0x30fbc2[_0x02ca('0x40')]=qs['filters'](_[_0x02ca('0x41')](_0x590295[_0x02ca('0x38')],_0x3f1497['filters']));if(_0x590295[_0x02ca('0x38')][_0x02ca('0x42')]){_0x30fbc2[_0x02ca('0x40')]=_[_0x02ca('0x43')](_0x30fbc2[_0x02ca('0x40')],{'$or':_[_0x02ca('0x32')](_0x30fbc2['attributes'],function(_0x3e6752){var _0x52670d={};_0x52670d[_0x3e6752]={'$like':'%'+_0x590295['query'][_0x02ca('0x42')]+'%'};return _0x52670d;})});}_0x30fbc2=_['merge']({},_0x30fbc2,_0x590295[_0x02ca('0x44')]);return _0x5ce885['getActions'](_0x30fbc2);}})[_0x02ca('0x28')](function(_0xebaf94){if(_0xebaf94){_0x500d3c=_0xebaf94[_0x02ca('0x3d')];if(!_0x590295[_0x02ca('0x38')]['hasOwnProperty'](_0x02ca('0x3e'))){_0x30fbc2[_0x02ca('0x20')]=qs[_0x02ca('0x20')](_0x590295['query']['limit']);_0x30fbc2[_0x02ca('0x1e')]=qs[_0x02ca('0x1e')](_0x590295[_0x02ca('0x38')][_0x02ca('0x1e')]);}return _0x5ce885[_0x02ca('0x60')](_0x30fbc2);}})[_0x02ca('0x28')](function(_0x1a4f47){if(_0x1a4f47){return _0x1a4f47?{'count':_0x500d3c,'rows':_0x1a4f47}:null;}})['then'](respondWithResult(_0x14b077,null))['catch'](handleError(_0x14b077,null));}; \ No newline at end of file +var _0x9027=['eml-format','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','reject','save','update','then','Triggers','UserProfileResource','name','send','index','map','Trigger','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions'];(function(_0xf0add2,_0x271f85){var _0x1d5808=function(_0x24763d){while(--_0x24763d){_0xf0add2['push'](_0xf0add2['shift']());}};_0x1d5808(++_0x271f85);}(_0x9027,0xbc));var _0x7902=function(_0x58e6f7,_0x1446eb){_0x58e6f7=_0x58e6f7-0x0;var _0x2fdbe2=_0x9027[_0x58e6f7];return _0x2fdbe2;};'use strict';var emlformat=require(_0x7902('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7902('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7902('0x2'));var Mustache=require(_0x7902('0x3'));var util=require('util');var path=require(_0x7902('0x4'));var sox=require(_0x7902('0x5'));var csv=require(_0x7902('0x6'));var ejs=require(_0x7902('0x7'));var fs=require('fs');var fs_extra=require(_0x7902('0x8'));var _=require(_0x7902('0x9'));var squel=require(_0x7902('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7902('0xb'));var toCsv=require(_0x7902('0x6'));var querystring=require(_0x7902('0xc'));var Papa=require(_0x7902('0xd'));var Redis=require(_0x7902('0xe'));var authService=require(_0x7902('0xf'));var qs=require(_0x7902('0x10'));var as=require(_0x7902('0x11'));var hardwareService=require(_0x7902('0x12'));var logger=require(_0x7902('0x13'))('api');var utils=require(_0x7902('0x14'));var config=require(_0x7902('0x15'));var licenseUtil=require(_0x7902('0x16'));var db=require(_0x7902('0x17'))['db'];function respondWithStatusCode(_0x114523,_0x2a397c){_0x2a397c=_0x2a397c||0xcc;return function(_0x207bd7){if(_0x207bd7){return _0x114523[_0x7902('0x18')](_0x2a397c);}return _0x114523['status'](_0x2a397c)[_0x7902('0x19')]();};}function respondWithResult(_0x14b86a,_0x42e8ec){_0x42e8ec=_0x42e8ec||0xc8;return function(_0x56704d){if(_0x56704d){return _0x14b86a[_0x7902('0x1a')](_0x42e8ec)[_0x7902('0x1b')](_0x56704d);}};}function respondWithFilteredResult(_0x1ffe44,_0x91a4fa){return function(_0x10cf1a){if(_0x10cf1a){var _0x2e2851=typeof _0x91a4fa[_0x7902('0x1c')]===_0x7902('0x1d')&&typeof _0x91a4fa['limit']===_0x7902('0x1d');var _0x4634d4=_0x10cf1a[_0x7902('0x1e')];var _0x4b9ebd=_0x2e2851?0x0:_0x91a4fa[_0x7902('0x1c')];var _0x487200=_0x2e2851?_0x10cf1a[_0x7902('0x1e')]:_0x91a4fa['offset']+_0x91a4fa['limit'];var _0x20807e;if(_0x487200>=_0x4634d4){_0x487200=_0x4634d4;_0x20807e=0xc8;}else{_0x20807e=0xce;}_0x1ffe44[_0x7902('0x1a')](_0x20807e);return _0x1ffe44[_0x7902('0x1f')]('Content-Range',_0x4b9ebd+'-'+_0x487200+'/'+_0x4634d4)[_0x7902('0x1b')](_0x10cf1a);}return null;};}function patchUpdates(_0x449f7a){return function(_0x16be57){try{jsonpatch['apply'](_0x16be57,_0x449f7a,!![]);}catch(_0x20e251){return BPromise[_0x7902('0x20')](_0x20e251);}return _0x16be57[_0x7902('0x21')]();};}function saveUpdates(_0x242756,_0x41e070){return function(_0x19159f){if(_0x19159f){return _0x19159f[_0x7902('0x22')](_0x242756)['then'](function(_0x1ee1c2){return _0x1ee1c2;});}return null;};}function removeEntity(_0x134b67,_0x355a7c){return function(_0x53492f){if(_0x53492f){return _0x53492f['destroy']()[_0x7902('0x23')](function(){var _0x2885ed=_0x53492f['get']({'plain':!![]});var _0x54a699=_0x7902('0x24');return db[_0x7902('0x25')]['destroy']({'where':{'type':_0x54a699,'resourceId':_0x2885ed['id']}})[_0x7902('0x23')](function(){return _0x53492f;});})[_0x7902('0x23')](function(){_0x134b67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cbedd,_0x41659a){return function(_0x2414c5){if(!_0x2414c5){_0x2cbedd['sendStatus'](0x194);}return _0x2414c5;};}function handleError(_0x2adf61,_0x32e093){_0x32e093=_0x32e093||0x1f4;return function(_0x527d5b){logger['error'](_0x527d5b['stack']);if(_0x527d5b[_0x7902('0x26')]){delete _0x527d5b[_0x7902('0x26')];}_0x2adf61[_0x7902('0x1a')](_0x32e093)[_0x7902('0x27')](_0x527d5b);};}exports[_0x7902('0x28')]=function(_0x31ad46,_0x534344){var _0x41e1e7={},_0x11ab24={},_0x26ea93={'count':0x0,'rows':[]};var _0x345c49=_[_0x7902('0x29')](db[_0x7902('0x2a')]['rawAttributes'],function(_0x241726){return{'name':_0x241726[_0x7902('0x2b')],'type':_0x241726[_0x7902('0x2c')]['key']};});_0x11ab24[_0x7902('0x2d')]=_['map'](_0x345c49,_0x7902('0x26'));_0x11ab24[_0x7902('0x2e')]=_[_0x7902('0x2f')](_0x31ad46['query']);_0x11ab24[_0x7902('0x30')]=_[_0x7902('0x31')](_0x11ab24[_0x7902('0x2d')],_0x11ab24['query']);_0x41e1e7[_0x7902('0x32')]=_['intersection'](_0x11ab24[_0x7902('0x2d')],qs[_0x7902('0x33')](_0x31ad46[_0x7902('0x2e')][_0x7902('0x33')]));_0x41e1e7[_0x7902('0x32')]=_0x41e1e7[_0x7902('0x32')][_0x7902('0x34')]?_0x41e1e7[_0x7902('0x32')]:_0x11ab24[_0x7902('0x2d')];if(!_0x31ad46['query'][_0x7902('0x35')](_0x7902('0x36'))){_0x41e1e7['limit']=qs['limit'](_0x31ad46['query'][_0x7902('0x37')]);_0x41e1e7['offset']=qs[_0x7902('0x1c')](_0x31ad46[_0x7902('0x2e')][_0x7902('0x1c')]);}_0x41e1e7[_0x7902('0x38')]=qs[_0x7902('0x39')](_0x31ad46[_0x7902('0x2e')][_0x7902('0x39')]);_0x41e1e7['where']=qs[_0x7902('0x30')](_[_0x7902('0x3a')](_0x31ad46[_0x7902('0x2e')],_0x11ab24[_0x7902('0x30')]),_0x345c49);if(_0x31ad46[_0x7902('0x2e')][_0x7902('0x3b')]){_0x41e1e7[_0x7902('0x3c')]=_[_0x7902('0x3d')](_0x41e1e7[_0x7902('0x3c')],{'$or':_[_0x7902('0x29')](_0x345c49,function(_0x264cb3){if(_0x264cb3[_0x7902('0x2c')]!==_0x7902('0x3e')){var _0x2f5d21={};_0x2f5d21[_0x264cb3[_0x7902('0x26')]]={'$like':'%'+_0x31ad46[_0x7902('0x2e')]['filter']+'%'};return _0x2f5d21;}})});}_0x41e1e7=_[_0x7902('0x3d')]({},_0x41e1e7,_0x31ad46[_0x7902('0x3f')]);var _0x5c263f={'where':_0x41e1e7[_0x7902('0x3c')]};return db[_0x7902('0x2a')][_0x7902('0x1e')](_0x5c263f)[_0x7902('0x23')](function(_0xd6a123){_0x26ea93[_0x7902('0x1e')]=_0xd6a123;if(_0x31ad46[_0x7902('0x2e')]['includeAll']){_0x41e1e7[_0x7902('0x40')]=[{'all':!![]}];}return db[_0x7902('0x2a')][_0x7902('0x41')](_0x41e1e7);})[_0x7902('0x23')](function(_0x36c100){_0x26ea93[_0x7902('0x42')]=_0x36c100;return _0x26ea93;})[_0x7902('0x23')](respondWithFilteredResult(_0x534344,_0x41e1e7))[_0x7902('0x43')](handleError(_0x534344,null));};exports[_0x7902('0x44')]=function(_0xd6f5fc,_0x2315f3){var _0x58c794={'raw':![],'where':{'id':_0xd6f5fc[_0x7902('0x45')]['id']}},_0x54659e={};_0x54659e[_0x7902('0x2d')]=_['keys'](db[_0x7902('0x2a')][_0x7902('0x46')]);_0x54659e['query']=_[_0x7902('0x2f')](_0xd6f5fc['query']);_0x54659e[_0x7902('0x30')]=_[_0x7902('0x31')](_0x54659e[_0x7902('0x2d')],_0x54659e[_0x7902('0x2e')]);_0x58c794[_0x7902('0x32')]=_['intersection'](_0x54659e[_0x7902('0x2d')],qs[_0x7902('0x33')](_0xd6f5fc['query'][_0x7902('0x33')]));_0x58c794['attributes']=_0x58c794[_0x7902('0x32')][_0x7902('0x34')]?_0x58c794[_0x7902('0x32')]:_0x54659e['model'];if(_0xd6f5fc[_0x7902('0x2e')][_0x7902('0x47')]){_0x58c794[_0x7902('0x40')]=[{'all':!![]}];}_0x58c794=_[_0x7902('0x3d')]({},_0x58c794,_0xd6f5fc[_0x7902('0x3f')]);return db[_0x7902('0x2a')][_0x7902('0x48')](_0x58c794)[_0x7902('0x23')](handleEntityNotFound(_0x2315f3,null))[_0x7902('0x23')](respondWithResult(_0x2315f3,null))[_0x7902('0x43')](handleError(_0x2315f3,null));};exports[_0x7902('0x49')]=function(_0x48db01,_0x2cd326){return db[_0x7902('0x2a')][_0x7902('0x49')](_0x48db01['body'],{})[_0x7902('0x23')](function(_0x1d255b){var _0x15a6d4=_0x48db01[_0x7902('0x4a')][_0x7902('0x4b')]({'plain':!![]});if(!_0x15a6d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15a6d4[_0x7902('0x4c')]===_0x7902('0x4a')){var _0x4cfd38=_0x1d255b[_0x7902('0x4b')]({'plain':!![]});var _0x588cc5=_0x7902('0x24');return db['UserProfileSection'][_0x7902('0x48')]({'where':{'name':_0x588cc5,'userProfileId':_0x15a6d4[_0x7902('0x4d')]},'raw':!![]})[_0x7902('0x23')](function(_0x26cca8){if(_0x26cca8&&_0x26cca8[_0x7902('0x4e')]===0x0){return db[_0x7902('0x25')][_0x7902('0x49')]({'name':_0x4cfd38[_0x7902('0x26')],'resourceId':_0x4cfd38['id'],'type':_0x26cca8[_0x7902('0x26')],'sectionId':_0x26cca8['id']},{})['then'](function(){return _0x1d255b;});}else{return _0x1d255b;}})['catch'](function(_0xc6830e){logger[_0x7902('0x4f')](_0x7902('0x50'),_0xc6830e);throw _0xc6830e;});}return _0x1d255b;})[_0x7902('0x23')](respondWithResult(_0x2cd326,0xc9))['catch'](handleError(_0x2cd326,null));};exports[_0x7902('0x22')]=function(_0x131a30,_0x53f851){if(_0x131a30[_0x7902('0x51')]['id']){delete _0x131a30[_0x7902('0x51')]['id'];}return db[_0x7902('0x2a')][_0x7902('0x48')]({'where':{'id':_0x131a30[_0x7902('0x45')]['id']}})['then'](handleEntityNotFound(_0x53f851,null))[_0x7902('0x23')](saveUpdates(_0x131a30[_0x7902('0x51')],null))[_0x7902('0x23')](respondWithResult(_0x53f851,null))[_0x7902('0x43')](handleError(_0x53f851,null));};exports[_0x7902('0x52')]=function(_0x308af5,_0x248042){return db[_0x7902('0x2a')][_0x7902('0x48')]({'where':{'id':_0x308af5['params']['id']}})['then'](handleEntityNotFound(_0x248042,null))['then'](removeEntity(_0x248042,null))['catch'](handleError(_0x248042,null));};exports['addAllCondition']=function(_0x1d7d22,_0x243290,_0x3a879c){if(_0x1d7d22[_0x7902('0x51')]['id']){delete _0x1d7d22[_0x7902('0x51')]['id'];}return db[_0x7902('0x2a')][_0x7902('0x48')]({'where':{'id':_0x1d7d22[_0x7902('0x45')]['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x243290,null))[_0x7902('0x23')](function(_0x2a78d8){if(_0x2a78d8){_0x1d7d22[_0x7902('0x51')][_0x7902('0x53')]=_0x2a78d8['id'];return db[_0x7902('0x54')]['create'](_0x1d7d22[_0x7902('0x51')]);}})[_0x7902('0x23')](respondWithResult(_0x243290,null))[_0x7902('0x43')](handleError(_0x243290,null));};exports[_0x7902('0x55')]=function(_0x18991f,_0x51f5ae,_0x2a2b73){if(_0x18991f[_0x7902('0x51')]['id']){delete _0x18991f[_0x7902('0x51')]['id'];}return db[_0x7902('0x2a')][_0x7902('0x48')]({'where':{'id':_0x18991f[_0x7902('0x45')]['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x51f5ae,null))['then'](function(_0x25bacc){if(_0x25bacc){_0x18991f[_0x7902('0x51')][_0x7902('0x56')]=_0x25bacc['id'];return db[_0x7902('0x54')][_0x7902('0x49')](_0x18991f['body']);}})['then'](respondWithResult(_0x51f5ae,null))[_0x7902('0x43')](handleError(_0x51f5ae,null));};exports[_0x7902('0x57')]=function(_0x5f26c5,_0x1cd4a0,_0x4c4e79){var _0xa8fcaa={};var _0x293c0e={};var _0x2282d6;var _0x481f5d;return db[_0x7902('0x2a')][_0x7902('0x58')]({'where':{'id':_0x5f26c5['params']['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x1cd4a0,null))[_0x7902('0x23')](function(_0x270cff){if(_0x270cff){_0x2282d6=_0x270cff;_0x293c0e[_0x7902('0x2d')]=_[_0x7902('0x2f')](db[_0x7902('0x54')]['rawAttributes']);_0x293c0e[_0x7902('0x2e')]=_[_0x7902('0x2f')](_0x5f26c5[_0x7902('0x2e')]);_0x293c0e['filters']=_[_0x7902('0x31')](_0x293c0e[_0x7902('0x2d')],_0x293c0e['query']);_0xa8fcaa[_0x7902('0x32')]=_[_0x7902('0x31')](_0x293c0e[_0x7902('0x2d')],qs[_0x7902('0x33')](_0x5f26c5[_0x7902('0x2e')][_0x7902('0x33')]));_0xa8fcaa[_0x7902('0x32')]=_0xa8fcaa[_0x7902('0x32')][_0x7902('0x34')]?_0xa8fcaa['attributes']:_0x293c0e[_0x7902('0x2d')];_0xa8fcaa[_0x7902('0x38')]=qs['sort'](_0x5f26c5['query'][_0x7902('0x39')]);_0xa8fcaa[_0x7902('0x3c')]=qs[_0x7902('0x30')](_[_0x7902('0x3a')](_0x5f26c5['query'],_0x293c0e[_0x7902('0x30')]));if(_0x5f26c5[_0x7902('0x2e')][_0x7902('0x3b')]){_0xa8fcaa[_0x7902('0x3c')]=_[_0x7902('0x3d')](_0xa8fcaa[_0x7902('0x3c')],{'$or':_[_0x7902('0x29')](_0xa8fcaa[_0x7902('0x32')],function(_0xb96546){var _0x3441={};_0x3441[_0xb96546]={'$like':'%'+_0x5f26c5[_0x7902('0x2e')]['filter']+'%'};return _0x3441;})});}_0xa8fcaa=_[_0x7902('0x3d')]({},_0xa8fcaa,_0x5f26c5[_0x7902('0x3f')]);return _0x2282d6[_0x7902('0x57')](_0xa8fcaa);}})[_0x7902('0x23')](function(_0x32a96e){if(_0x32a96e){_0x481f5d=_0x32a96e[_0x7902('0x34')];if(!_0x5f26c5[_0x7902('0x2e')][_0x7902('0x35')]('nolimit')){_0xa8fcaa[_0x7902('0x37')]=qs[_0x7902('0x37')](_0x5f26c5[_0x7902('0x2e')][_0x7902('0x37')]);_0xa8fcaa[_0x7902('0x1c')]=qs[_0x7902('0x1c')](_0x5f26c5[_0x7902('0x2e')]['offset']);}return _0x2282d6[_0x7902('0x57')](_0xa8fcaa);}})[_0x7902('0x23')](function(_0x3647a3){if(_0x3647a3){return _0x3647a3?{'count':_0x481f5d,'rows':_0x3647a3}:null;}})['then'](respondWithResult(_0x1cd4a0,null))[_0x7902('0x43')](handleError(_0x1cd4a0,null));};exports['getAnyConditions']=function(_0x5aaa75,_0x1603cf,_0x3e669b){var _0x57feeb={};var _0x1fae2e={};var _0x43ec3c;var _0x18e8cf;return db[_0x7902('0x2a')][_0x7902('0x58')]({'where':{'id':_0x5aaa75[_0x7902('0x45')]['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x1603cf,null))[_0x7902('0x23')](function(_0x2987da){if(_0x2987da){_0x43ec3c=_0x2987da;_0x1fae2e[_0x7902('0x2d')]=_[_0x7902('0x2f')](db['Condition'][_0x7902('0x46')]);_0x1fae2e[_0x7902('0x2e')]=_[_0x7902('0x2f')](_0x5aaa75[_0x7902('0x2e')]);_0x1fae2e['filters']=_[_0x7902('0x31')](_0x1fae2e[_0x7902('0x2d')],_0x1fae2e[_0x7902('0x2e')]);_0x57feeb[_0x7902('0x32')]=_['intersection'](_0x1fae2e[_0x7902('0x2d')],qs[_0x7902('0x33')](_0x5aaa75['query'][_0x7902('0x33')]));_0x57feeb[_0x7902('0x32')]=_0x57feeb['attributes'][_0x7902('0x34')]?_0x57feeb[_0x7902('0x32')]:_0x1fae2e[_0x7902('0x2d')];_0x57feeb[_0x7902('0x38')]=qs['sort'](_0x5aaa75[_0x7902('0x2e')]['sort']);_0x57feeb[_0x7902('0x3c')]=qs['filters'](_[_0x7902('0x3a')](_0x5aaa75['query'],_0x1fae2e[_0x7902('0x30')]));if(_0x5aaa75[_0x7902('0x2e')][_0x7902('0x3b')]){_0x57feeb[_0x7902('0x3c')]=_[_0x7902('0x3d')](_0x57feeb[_0x7902('0x3c')],{'$or':_[_0x7902('0x29')](_0x57feeb[_0x7902('0x32')],function(_0x440aa8){var _0x28d9d7={};_0x28d9d7[_0x440aa8]={'$like':'%'+_0x5aaa75['query']['filter']+'%'};return _0x28d9d7;})});}_0x57feeb=_[_0x7902('0x3d')]({},_0x57feeb,_0x5aaa75[_0x7902('0x3f')]);return _0x43ec3c[_0x7902('0x59')](_0x57feeb);}})['then'](function(_0x4eb494){if(_0x4eb494){_0x18e8cf=_0x4eb494[_0x7902('0x34')];if(!_0x5aaa75['query'][_0x7902('0x35')](_0x7902('0x36'))){_0x57feeb[_0x7902('0x37')]=qs['limit'](_0x5aaa75['query']['limit']);_0x57feeb[_0x7902('0x1c')]=qs['offset'](_0x5aaa75[_0x7902('0x2e')][_0x7902('0x1c')]);}return _0x43ec3c[_0x7902('0x59')](_0x57feeb);}})[_0x7902('0x23')](function(_0x5ccf6a){if(_0x5ccf6a){return _0x5ccf6a?{'count':_0x18e8cf,'rows':_0x5ccf6a}:null;}})[_0x7902('0x23')](respondWithResult(_0x1603cf,null))[_0x7902('0x43')](handleError(_0x1603cf,null));};exports[_0x7902('0x5a')]=function(_0x191ee4,_0x2c610d,_0x5ca950){if(_0x191ee4[_0x7902('0x51')]['id']){delete _0x191ee4[_0x7902('0x51')]['id'];}return db[_0x7902('0x2a')][_0x7902('0x48')]({'where':{'id':_0x191ee4[_0x7902('0x45')]['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x2c610d,null))[_0x7902('0x23')](function(_0x5b8c76){if(_0x5b8c76){_0x191ee4[_0x7902('0x51')][_0x7902('0x5b')]=_0x5b8c76['id'];return db[_0x7902('0x5c')][_0x7902('0x49')](_0x191ee4[_0x7902('0x51')]);}})['then'](respondWithResult(_0x2c610d,null))['catch'](handleError(_0x2c610d,null));};exports[_0x7902('0x5d')]=function(_0x1cc27f,_0x4157c5,_0x34c22d){var _0x2af948={};var _0x1430b5={};var _0x23b786;var _0x899323;return db[_0x7902('0x2a')][_0x7902('0x58')]({'where':{'id':_0x1cc27f[_0x7902('0x45')]['id']}})[_0x7902('0x23')](handleEntityNotFound(_0x4157c5,null))['then'](function(_0x2ce6af){if(_0x2ce6af){_0x23b786=_0x2ce6af;_0x1430b5[_0x7902('0x2d')]=_[_0x7902('0x2f')](db['Action']['rawAttributes']);_0x1430b5[_0x7902('0x2e')]=_[_0x7902('0x2f')](_0x1cc27f['query']);_0x1430b5['filters']=_[_0x7902('0x31')](_0x1430b5[_0x7902('0x2d')],_0x1430b5[_0x7902('0x2e')]);_0x2af948['attributes']=_[_0x7902('0x31')](_0x1430b5[_0x7902('0x2d')],qs[_0x7902('0x33')](_0x1cc27f[_0x7902('0x2e')][_0x7902('0x33')]));_0x2af948[_0x7902('0x32')]=_0x2af948[_0x7902('0x32')][_0x7902('0x34')]?_0x2af948['attributes']:_0x1430b5[_0x7902('0x2d')];_0x2af948[_0x7902('0x38')]=qs['sort'](_0x1cc27f[_0x7902('0x2e')][_0x7902('0x39')]);_0x2af948[_0x7902('0x3c')]=qs[_0x7902('0x30')](_['pick'](_0x1cc27f[_0x7902('0x2e')],_0x1430b5['filters']));if(_0x1cc27f[_0x7902('0x2e')]['filter']){_0x2af948['where']=_[_0x7902('0x3d')](_0x2af948[_0x7902('0x3c')],{'$or':_['map'](_0x2af948[_0x7902('0x32')],function(_0x13bab5){var _0x3646de={};_0x3646de[_0x13bab5]={'$like':'%'+_0x1cc27f[_0x7902('0x2e')][_0x7902('0x3b')]+'%'};return _0x3646de;})});}_0x2af948=_[_0x7902('0x3d')]({},_0x2af948,_0x1cc27f[_0x7902('0x3f')]);return _0x23b786['getActions'](_0x2af948);}})[_0x7902('0x23')](function(_0x1327a0){if(_0x1327a0){_0x899323=_0x1327a0[_0x7902('0x34')];if(!_0x1cc27f['query'][_0x7902('0x35')]('nolimit')){_0x2af948[_0x7902('0x37')]=qs[_0x7902('0x37')](_0x1cc27f[_0x7902('0x2e')][_0x7902('0x37')]);_0x2af948['offset']=qs[_0x7902('0x1c')](_0x1cc27f[_0x7902('0x2e')]['offset']);}return _0x23b786[_0x7902('0x5d')](_0x2af948);}})[_0x7902('0x23')](function(_0x163758){if(_0x163758){return _0x163758?{'count':_0x899323,'rows':_0x163758}:null;}})[_0x7902('0x23')](respondWithResult(_0x4157c5,null))['catch'](handleError(_0x4157c5,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index dbbdad6..b95551a 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 _0xe35c=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./trigger.attributes','exports','define'];(function(_0x4f95f8,_0xb73784){var _0x123b8e=function(_0x89ad8f){while(--_0x89ad8f){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x123b8e(++_0xb73784);}(_0xe35c,0x146));var _0xce35=function(_0x50dc4e,_0xc4040b){_0x50dc4e=_0x50dc4e-0x0;var _0x429e20=_0xe35c[_0x50dc4e];return _0x429e20;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var logger=require(_0xce35('0x2'))(_0xce35('0x3'));var moment=require(_0xce35('0x4'));var BPromise=require(_0xce35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce35('0x6'));var config=require('../../config/environment');var attributes=require(_0xce35('0x7'));module[_0xce35('0x8')]=function(_0x3a4bb,_0x47e53c){return _0x3a4bb[_0xce35('0x9')](_0xce35('0xa'),attributes,{'tableName':_0xce35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe132=['Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xe132,0x162));var _0x2e13=function(_0x134d4b,_0x5f44a2){_0x134d4b=_0x134d4b-0x0;var _0x26a9fb=_0xe132[_0x134d4b];return _0x26a9fb;};'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('./trigger.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/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 5c722cd..f012c25 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 _0x13e6=['client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','debug','Trigger','find','ShowTrigger','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3bb873,_0x75582c){var _0x63652e=function(_0x6a446f){while(--_0x6a446f){_0x3bb873['push'](_0x3bb873['shift']());}};_0x63652e(++_0x75582c);}(_0x13e6,0x1b3));var _0x613e=function(_0x1e2b1c,_0x137fd2){_0x1e2b1c=_0x1e2b1c-0x0;var _0x230664=_0x13e6[_0x1e2b1c];return _0x230664;};'use strict';var _=require(_0x613e('0x0'));var util=require(_0x613e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613e('0x2'));var fs=require('fs');var Redis=require(_0x613e('0x3'));var db=require(_0x613e('0x4'))['db'];var utils=require(_0x613e('0x5'));var logger=require(_0x613e('0x6'))(_0x613e('0x7'));var config=require('../../config/environment');var jayson=require(_0x613e('0x8'));var client=jayson[_0x613e('0x9')][_0x613e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2adb6c,_0x5ac884,_0x16cc2e){return new BPromise(function(_0x3d22b3,_0x9931ae){return client[_0x613e('0xb')](_0x2adb6c,_0x16cc2e)[_0x613e('0xc')](function(_0x542621){logger['info'](_0x613e('0xd'),_0x5ac884,_0x613e('0xe'));logger['debug'](_0x613e('0xf'),_0x5ac884,_0x613e('0xe'),JSON[_0x613e('0x10')](_0x542621));if(_0x542621[_0x613e('0x11')]){if(_0x542621[_0x613e('0x11')][_0x613e('0x12')]===0x1f4){logger[_0x613e('0x11')]('Trigger,\x20%s,\x20%s',_0x5ac884,_0x542621[_0x613e('0x11')][_0x613e('0x13')]);return _0x9931ae(_0x542621[_0x613e('0x11')][_0x613e('0x13')]);}logger[_0x613e('0x11')](_0x613e('0xd'),_0x5ac884,_0x542621[_0x613e('0x11')][_0x613e('0x13')]);return _0x3d22b3(_0x542621[_0x613e('0x11')][_0x613e('0x13')]);}else{logger[_0x613e('0x14')](_0x613e('0xd'),_0x5ac884,_0x613e('0xe'));_0x3d22b3(_0x542621[_0x613e('0x15')][_0x613e('0x13')]);}})[_0x613e('0x16')](function(_0x401b74){logger[_0x613e('0x11')](_0x613e('0xd'),_0x5ac884,_0x401b74);_0x9931ae(_0x401b74);});});}exports['GetTrigger']=function(_0x2b8c6b){var _0x5502c0=this;return new Promise(function(_0x45eaf2,_0x45f79e){return db['Trigger'][_0x613e('0x17')]({'raw':_0x2b8c6b[_0x613e('0x18')]?_0x2b8c6b['options'][_0x613e('0x19')]===undefined?!![]:![]:!![],'where':_0x2b8c6b[_0x613e('0x18')]?_0x2b8c6b['options'][_0x613e('0x1a')]||null:null,'attributes':_0x2b8c6b[_0x613e('0x18')]?_0x2b8c6b['options'][_0x613e('0x1b')]||null:null,'limit':_0x2b8c6b[_0x613e('0x18')]?_0x2b8c6b[_0x613e('0x18')][_0x613e('0x1c')]||null:null,'include':_0x2b8c6b[_0x613e('0x18')]?_0x2b8c6b[_0x613e('0x18')][_0x613e('0x1d')]?_['map'](_0x2b8c6b[_0x613e('0x18')][_0x613e('0x1d')],function(_0x2c74fb){return{'model':db[_0x2c74fb[_0x613e('0x1e')]],'as':_0x2c74fb['as'],'attributes':_0x2c74fb[_0x613e('0x1b')],'include':_0x2c74fb[_0x613e('0x1d')]?_[_0x613e('0x1f')](_0x2c74fb[_0x613e('0x1d')],function(_0x2c0ceb){return{'model':db[_0x2c0ceb[_0x613e('0x1e')]],'as':_0x2c0ceb['as'],'attributes':_0x2c0ceb[_0x613e('0x1b')],'include':_0x2c0ceb['include']?_['map'](_0x2c0ceb['include'],function(_0x6fd80d){return{'model':db[_0x6fd80d[_0x613e('0x1e')]],'as':_0x6fd80d['as'],'attributes':_0x6fd80d[_0x613e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x613e('0xc')](function(_0x3936ab){logger[_0x613e('0x14')](_0x613e('0x20'),_0x2b8c6b);logger[_0x613e('0x21')](_0x613e('0x20'),_0x2b8c6b,JSON[_0x613e('0x10')](_0x3936ab));_0x45eaf2(_0x3936ab);})[_0x613e('0x16')](function(_0x2f48fa){logger[_0x613e('0x11')](_0x613e('0x20'),_0x2f48fa[_0x613e('0x13')],_0x2b8c6b);_0x45f79e(_0x5502c0[_0x613e('0x11')](0x1f4,_0x2f48fa[_0x613e('0x13')]));});});};exports['ShowTrigger']=function(_0x3f3a78){var _0xc1632d=this;return new Promise(function(_0x63bb4d,_0x23d685){return db[_0x613e('0x22')][_0x613e('0x23')]({'raw':_0x3f3a78[_0x613e('0x18')]?_0x3f3a78['options'][_0x613e('0x19')]===undefined?!![]:![]:!![],'where':_0x3f3a78['options']?_0x3f3a78[_0x613e('0x18')]['where']||null:null,'attributes':_0x3f3a78[_0x613e('0x18')]?_0x3f3a78[_0x613e('0x18')][_0x613e('0x1b')]||null:null,'include':_0x3f3a78['options']?_0x3f3a78['options'][_0x613e('0x1d')]?_[_0x613e('0x1f')](_0x3f3a78['options'][_0x613e('0x1d')],function(_0x5c9a92){return{'model':db[_0x5c9a92[_0x613e('0x1e')]],'as':_0x5c9a92['as'],'attributes':_0x5c9a92[_0x613e('0x1b')],'include':_0x5c9a92[_0x613e('0x1d')]?_['map'](_0x5c9a92[_0x613e('0x1d')],function(_0x37baef){return{'model':db[_0x37baef[_0x613e('0x1e')]],'as':_0x37baef['as'],'attributes':_0x37baef[_0x613e('0x1b')],'include':_0x37baef[_0x613e('0x1d')]?_['map'](_0x37baef[_0x613e('0x1d')],function(_0x212d47){return{'model':db[_0x212d47[_0x613e('0x1e')]],'as':_0x212d47['as'],'attributes':_0x212d47[_0x613e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40c321){logger[_0x613e('0x14')](_0x613e('0x24'),_0x3f3a78);logger['debug']('ShowTrigger',_0x3f3a78,JSON['stringify'](_0x40c321));_0x63bb4d(_0x40c321);})[_0x613e('0x16')](function(_0x217113){logger['error'](_0x613e('0x24'),_0x217113[_0x613e('0x13')],_0x3f3a78);_0x23d685(_0xc1632d[_0x613e('0x11')](0x1f4,_0x217113[_0x613e('0x13')]));});});}; \ No newline at end of file +var _0x5e3e=['stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','code','result','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','message','ShowTrigger','find'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5e3e,0x1d6));var _0xe5e3=function(_0x404f55,_0x2814e3){_0x404f55=_0x404f55-0x0;var _0x395a9e=_0x5e3e[_0x404f55];return _0x395a9e;};'use strict';var _=require(_0xe5e3('0x0'));var util=require(_0xe5e3('0x1'));var moment=require(_0xe5e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5e3('0x3'));var fs=require('fs');var Redis=require(_0xe5e3('0x4'));var db=require(_0xe5e3('0x5'))['db'];var utils=require(_0xe5e3('0x6'));var logger=require('../../config/logger')(_0xe5e3('0x7'));var config=require(_0xe5e3('0x8'));var jayson=require(_0xe5e3('0x9'));var client=jayson['client'][_0xe5e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x173058,_0x3f5dce,_0x362f9a){return new BPromise(function(_0x21b516,_0xaf4f1a){return client[_0xe5e3('0xb')](_0x173058,_0x362f9a)[_0xe5e3('0xc')](function(_0x110504){logger[_0xe5e3('0xd')](_0xe5e3('0xe'),_0x3f5dce,_0xe5e3('0xf'));logger[_0xe5e3('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3f5dce,'request\x20sent',JSON['stringify'](_0x110504));if(_0x110504[_0xe5e3('0x11')]){if(_0x110504[_0xe5e3('0x11')][_0xe5e3('0x12')]===0x1f4){logger[_0xe5e3('0x11')](_0xe5e3('0xe'),_0x3f5dce,_0x110504['error']['message']);return _0xaf4f1a(_0x110504[_0xe5e3('0x11')]['message']);}logger[_0xe5e3('0x11')](_0xe5e3('0xe'),_0x3f5dce,_0x110504[_0xe5e3('0x11')]['message']);return _0x21b516(_0x110504[_0xe5e3('0x11')]['message']);}else{logger[_0xe5e3('0xd')](_0xe5e3('0xe'),_0x3f5dce,_0xe5e3('0xf'));_0x21b516(_0x110504[_0xe5e3('0x13')]['message']);}})['catch'](function(_0x9bdee8){logger[_0xe5e3('0x11')](_0xe5e3('0xe'),_0x3f5dce,_0x9bdee8);_0xaf4f1a(_0x9bdee8);});});}exports['GetTrigger']=function(_0x33fa74){var _0x127dcd=this;return new Promise(function(_0x23beb9,_0x3e77d5){return db[_0xe5e3('0x14')][_0xe5e3('0x15')]({'raw':_0x33fa74[_0xe5e3('0x16')]?_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x17')]===undefined?!![]:![]:!![],'where':_0x33fa74['options']?_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x18')]||null:null,'attributes':_0x33fa74[_0xe5e3('0x16')]?_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x19')]||null:null,'limit':_0x33fa74[_0xe5e3('0x16')]?_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x1a')]||null:null,'include':_0x33fa74[_0xe5e3('0x16')]?_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x1b')]?_[_0xe5e3('0x1c')](_0x33fa74[_0xe5e3('0x16')][_0xe5e3('0x1b')],function(_0x1aeb79){return{'model':db[_0x1aeb79[_0xe5e3('0x1d')]],'as':_0x1aeb79['as'],'attributes':_0x1aeb79[_0xe5e3('0x19')],'include':_0x1aeb79[_0xe5e3('0x1b')]?_[_0xe5e3('0x1c')](_0x1aeb79['include'],function(_0x2e2613){return{'model':db[_0x2e2613[_0xe5e3('0x1d')]],'as':_0x2e2613['as'],'attributes':_0x2e2613['attributes'],'include':_0x2e2613[_0xe5e3('0x1b')]?_[_0xe5e3('0x1c')](_0x2e2613[_0xe5e3('0x1b')],function(_0x53c8d0){return{'model':db[_0x53c8d0[_0xe5e3('0x1d')]],'as':_0x53c8d0['as'],'attributes':_0x53c8d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5e3('0xc')](function(_0x2dd2f4){logger['info'](_0xe5e3('0x1e'),_0x33fa74);logger[_0xe5e3('0x10')](_0xe5e3('0x1e'),_0x33fa74,JSON['stringify'](_0x2dd2f4));_0x23beb9(_0x2dd2f4);})['catch'](function(_0xf2abc3){logger[_0xe5e3('0x11')](_0xe5e3('0x1e'),_0xf2abc3[_0xe5e3('0x1f')],_0x33fa74);_0x3e77d5(_0x127dcd[_0xe5e3('0x11')](0x1f4,_0xf2abc3['message']));});});};exports[_0xe5e3('0x20')]=function(_0x352a0f){var _0x1b6b2e=this;return new Promise(function(_0x531796,_0x1cc9db){return db[_0xe5e3('0x14')][_0xe5e3('0x21')]({'raw':_0x352a0f[_0xe5e3('0x16')]?_0x352a0f[_0xe5e3('0x16')][_0xe5e3('0x17')]===undefined?!![]:![]:!![],'where':_0x352a0f[_0xe5e3('0x16')]?_0x352a0f['options'][_0xe5e3('0x18')]||null:null,'attributes':_0x352a0f[_0xe5e3('0x16')]?_0x352a0f['options'][_0xe5e3('0x19')]||null:null,'include':_0x352a0f[_0xe5e3('0x16')]?_0x352a0f['options'][_0xe5e3('0x1b')]?_['map'](_0x352a0f[_0xe5e3('0x16')][_0xe5e3('0x1b')],function(_0x12b579){return{'model':db[_0x12b579['model']],'as':_0x12b579['as'],'attributes':_0x12b579[_0xe5e3('0x19')],'include':_0x12b579[_0xe5e3('0x1b')]?_['map'](_0x12b579[_0xe5e3('0x1b')],function(_0x531252){return{'model':db[_0x531252[_0xe5e3('0x1d')]],'as':_0x531252['as'],'attributes':_0x531252[_0xe5e3('0x19')],'include':_0x531252[_0xe5e3('0x1b')]?_[_0xe5e3('0x1c')](_0x531252['include'],function(_0x90162c){return{'model':db[_0x90162c[_0xe5e3('0x1d')]],'as':_0x90162c['as'],'attributes':_0x90162c[_0xe5e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe5e3('0xc')](function(_0x32a795){logger['info'](_0xe5e3('0x20'),_0x352a0f);logger[_0xe5e3('0x10')]('ShowTrigger',_0x352a0f,JSON[_0xe5e3('0x22')](_0x32a795));_0x531796(_0x32a795);})[_0xe5e3('0x23')](function(_0x2f1599){logger[_0xe5e3('0x11')](_0xe5e3('0x20'),_0x2f1599[_0xe5e3('0x1f')],_0x352a0f);_0x1cc9db(_0x1b6b2e[_0xe5e3('0x11')](0x1f4,_0x2f1599[_0xe5e3('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fb6a2ff..a57c5f4 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 _0xb71b=['get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x4f0a61,_0x1df9a7){var _0x447ea6=function(_0x22577e){while(--_0x22577e){_0x4f0a61['push'](_0x4f0a61['shift']());}};_0x447ea6(++_0x1df9a7);}(_0xb71b,0x1b9));var _0xbb71=function(_0x25f862,_0x1c1e4e){_0x25f862=_0x25f862-0x0;var _0x1c7b67=_0xb71b[_0x25f862];return _0x1c7b67;};'use strict';var multer=require(_0xbb71('0x0'));var util=require(_0xbb71('0x1'));var path=require(_0xbb71('0x2'));var timeout=require(_0xbb71('0x3'));var express=require('express');var router=express[_0xbb71('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb71('0x5'));var interaction=require(_0xbb71('0x6'));var config=require(_0xbb71('0x7'));var controller=require(_0xbb71('0x8'));router[_0xbb71('0x9')]('/',auth[_0xbb71('0xa')](),controller[_0xbb71('0xb')]);router[_0xbb71('0x9')](_0xbb71('0xc'),auth[_0xbb71('0xa')](),controller[_0xbb71('0xd')]);router[_0xbb71('0xe')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0xbb71('0xa')](),controller['create']);router['put'](_0xbb71('0xc'),auth[_0xbb71('0xa')](),controller[_0xbb71('0xf')]);router['delete']('/:id',auth[_0xbb71('0xa')](),controller[_0xbb71('0x10')]);module[_0xbb71('0x11')]=router; \ No newline at end of file +var _0x4388=['/:id','show','/:id/clone','clone','post','create','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index'];(function(_0x184c80,_0x4f13dc){var _0x569191=function(_0x8a58de){while(--_0x8a58de){_0x184c80['push'](_0x184c80['shift']());}};_0x569191(++_0x4f13dc);}(_0x4388,0x8f));var _0x8438=function(_0x43cd8c,_0x53b715){_0x43cd8c=_0x43cd8c-0x0;var _0x4f879e=_0x4388[_0x43cd8c];return _0x4f879e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8438('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8438('0x1')]();var fs_extra=require(_0x8438('0x2'));var auth=require(_0x8438('0x3'));var interaction=require(_0x8438('0x4'));var config=require(_0x8438('0x5'));var controller=require(_0x8438('0x6'));router['get']('/',auth[_0x8438('0x7')](),controller[_0x8438('0x8')]);router['get'](_0x8438('0x9'),auth[_0x8438('0x7')](),controller[_0x8438('0xa')]);router['post'](_0x8438('0xb'),auth['isAuthenticated'](),controller[_0x8438('0xc')]);router[_0x8438('0xd')]('/',auth[_0x8438('0x7')](),controller[_0x8438('0xe')]);router[_0x8438('0xf')]('/:id',auth[_0x8438('0x7')](),controller[_0x8438('0x10')]);router['delete'](_0x8438('0x9'),auth['isAuthenticated'](),controller[_0x8438('0x11')]);module[_0x8438('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 42ec64f..698e581 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 _0xb823=['split','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','user','peer','friend','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing'];(function(_0x161155,_0x440881){var _0x371535=function(_0xca6d9f){while(--_0xca6d9f){_0x161155['push'](_0x161155['shift']());}};_0x371535(++_0x440881);}(_0xb823,0x1a7));var _0x3b82=function(_0x2cba09,_0x23ee85){_0x2cba09=_0x2cba09-0x0;var _0x10d084=_0xb823[_0x2cba09];return _0x10d084;};'use strict';var Sequelize=require(_0x3b82('0x0'));module[_0x3b82('0x1')]={'name':{'type':Sequelize[_0x3b82('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x3b82('0x3'),_0x3b82('0x4')),'allowNull':![],'defaultValue':_0x3b82('0x5')},'context':{'type':Sequelize[_0x3b82('0x2')],'allowNull':![],'defaultValue':_0x3b82('0x6')},'callingpres':{'type':Sequelize[_0x3b82('0x7')]('ALLOWED_NOT_SCREENED',_0x3b82('0x8'),_0x3b82('0x9'),_0x3b82('0xa'),_0x3b82('0xb'),_0x3b82('0xc'),'PROHIB_FAILED_SCREEN',_0x3b82('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3b82('0x2')]},'secret':{'type':Sequelize[_0x3b82('0x2')]},'md5secret':{'type':Sequelize[_0x3b82('0x2')]},'remotesecret':{'type':Sequelize[_0x3b82('0x2')]},'transport':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':_0x3b82('0xe'),'set':function(_0x342953){this[_0x3b82('0xf')]('transport',_0x342953?_0x342953[_0x3b82('0x10')](','):null);},'get':function(){return this[_0x3b82('0x11')](_0x3b82('0x12'))?this['getDataValue'](_0x3b82('0x12'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x3b82('0x13'),_0x3b82('0x14'),_0x3b82('0x15'),_0x3b82('0x16'),_0x3b82('0x17')),'defaultValue':_0x3b82('0x13')},'directmedia':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no','nonat',_0x3b82('0x19'),_0x3b82('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3b82('0x2')]},'nat':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x16c87c){this[_0x3b82('0xf')]('nat',_0x16c87c?_0x16c87c[_0x3b82('0x10')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue']('nat')[_0x3b82('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3b82('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3b82('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3b82('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x315c79){this[_0x3b82('0xf')](_0x3b82('0x1c'),_0x315c79?_0x315c79[_0x3b82('0x10')](';'):_0x3b82('0x1d'));},'get':function(){return this[_0x3b82('0x11')]('allow')?this['getDataValue']('allow')[_0x3b82('0x1b')](';'):null;},'comment':_0x3b82('0x1e')},'autoframing':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'insecure':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':'port,invite','set':function(_0x13117a){this[_0x3b82('0xf')](_0x3b82('0x1f'),_0x13117a?_0x13117a[_0x3b82('0x10')](','):null);},'get':function(){return this[_0x3b82('0x11')](_0x3b82('0x1f'))?this[_0x3b82('0x11')]('insecure')[_0x3b82('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no',_0x3b82('0x20'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x3b82('0x7')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':_0x3b82('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3b82('0x18')},'busylevel':{'type':Sequelize[_0x3b82('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x3b82('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x3b82('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no',_0x3b82('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3b82('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'mailbox':{'type':Sequelize[_0x3b82('0x2')]},'session_timers':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x24'),_0x3b82('0x25'),_0x3b82('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x3b82('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x27'),_0x3b82('0x28')),'defaultValue':_0x3b82('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x3b82('0x2')]},'fromdomain':{'type':Sequelize[_0x3b82('0x2')]},'fromuser':{'type':Sequelize[_0x3b82('0x2')]},'port':{'type':Sequelize[_0x3b82('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3b82('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x3b82('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3b82('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3b82('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no',_0x3b82('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3b82('0x2')]},'callbackextension':{'type':Sequelize[_0x3b82('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x3b82('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3b82('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x3b82('0x2')]},'contactdeny':{'type':Sequelize[_0x3b82('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3b82('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3b82('0x2')]},'maxforwards':{'type':Sequelize[_0x3b82('0x22')](0xb)},'encryption':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no')},'icesupport':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3b82('0x18'),'no',_0x3b82('0x2a'),_0x3b82('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3b82('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x2c'),_0x3b82('0x2d'),_0x3b82('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3b82('0x2')]},'usereqphone':{'type':Sequelize[_0x3b82('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3b82('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3b82('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no')},'vmexten':{'type':Sequelize[_0x3b82('0x2')]},'mohinterpret':{'type':Sequelize[_0x3b82('0x2')]},'mohsuggest':{'type':Sequelize[_0x3b82('0x2')]},'parkinglot':{'type':Sequelize[_0x3b82('0x2')]},'description':{'type':Sequelize[_0x3b82('0x2')]},'host':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':_0x3b82('0x2f')},'canreinvite':{'type':Sequelize[_0x3b82('0x7')](_0x3b82('0x18'),'no','nonat','update',_0x3b82('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3b82('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3b82('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3b82('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x334b=['nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','getDataValue','split','ENUM','rfc2833','info','auto','yes','update','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','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]','INTEGER','always','refuse','originate','uas','fingerprint','active','passive','actpass'];(function(_0x146a54,_0xdc746b){var _0x1aea53=function(_0x213fe2){while(--_0x213fe2){_0x146a54['push'](_0x146a54['shift']());}};_0x1aea53(++_0xdc746b);}(_0x334b,0xbf));var _0xb334=function(_0x3b6964,_0x2445e1){_0x3b6964=_0x3b6964-0x0;var _0x11ad10=_0x334b[_0x3b6964];return _0x11ad10;};'use strict';var Sequelize=require(_0xb334('0x0'));module[_0xb334('0x1')]={'name':{'type':Sequelize[_0xb334('0x2')],'allowNull':![],'unique':_0xb334('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xb334('0x4'),_0xb334('0x5'),_0xb334('0x6')),'allowNull':![],'defaultValue':_0xb334('0x4')},'context':{'type':Sequelize[_0xb334('0x2')],'allowNull':![],'defaultValue':_0xb334('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xb334('0x8'),_0xb334('0x9'),_0xb334('0xa'),_0xb334('0xb'),_0xb334('0xc'),_0xb334('0xd'),_0xb334('0xe'))},'deny':{'type':Sequelize[_0xb334('0x2')]},'permit':{'type':Sequelize[_0xb334('0x2')]},'secret':{'type':Sequelize[_0xb334('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xb334('0x2')]},'transport':{'type':Sequelize[_0xb334('0x2')],'defaultValue':_0xb334('0xf'),'set':function(_0x384287){this['setDataValue']('transport',_0x384287?_0x384287['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xb334('0x10')]('transport')[_0xb334('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x13'),_0xb334('0x14'),'shortinfo','inband',_0xb334('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no','nonat',_0xb334('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb334('0x12')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb334('0x2')]},'directmediadeny':{'type':Sequelize[_0xb334('0x2')]},'nat':{'type':Sequelize[_0xb334('0x2')],'defaultValue':_0xb334('0x18'),'set':function(_0x31f49e){this[_0xb334('0x19')](_0xb334('0x1a'),_0x31f49e?_0x31f49e[_0xb334('0x1b')](','):null);},'get':function(){return this[_0xb334('0x10')](_0xb334('0x1a'))?this[_0xb334('0x10')]('nat')['split'](','):null;},'comment':_0xb334('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb334('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb334('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb334('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb334('0x2')],'defaultValue':_0xb334('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb334('0x1e'),'set':function(_0x307780){this[_0xb334('0x19')]('allow',_0x307780?_0x307780['join'](';'):_0xb334('0x1e'));},'get':function(){return this[_0xb334('0x10')]('allow')?this[_0xb334('0x10')]('allow')[_0xb334('0x11')](';'):null;},'comment':_0xb334('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0xb334('0x16'),'no')},'insecure':{'type':Sequelize[_0xb334('0x2')],'defaultValue':_0xb334('0x20'),'set':function(_0xc493c6){this['setDataValue'](_0xb334('0x21'),_0xc493c6?_0xc493c6[_0xb334('0x1b')](','):null);},'get':function(){return this[_0xb334('0x10')](_0xb334('0x21'))?this[_0xb334('0x10')](_0xb334('0x21'))[_0xb334('0x11')](','):null;},'comment':_0xb334('0x22')},'trustrpid':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xb334('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0xb334('0x12')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xb334('0x16'),'no')},'accountcode':{'type':Sequelize[_0xb334('0x23')](0xb)},'setvar':{'type':Sequelize[_0xb334('0x2')]},'callerid':{'type':Sequelize[_0xb334('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb334('0x2')]},'callcounter':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no'),'defaultValue':_0xb334('0x16')},'busylevel':{'type':Sequelize[_0xb334('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xb334('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xb334('0x12')]('yes','no',_0xb334('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb334('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'mailbox':{'type':Sequelize[_0xb334('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xb334('0x25'),_0xb334('0x26'))},'session_expires':{'type':Sequelize[_0xb334('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xb334('0x12')]('uac',_0xb334('0x27')),'defaultValue':_0xb334('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xb334('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xb334('0x2')]},'fromuser':{'type':Sequelize[_0xb334('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xb334('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xb334('0x2')]},'defaultuser':{'type':Sequelize[_0xb334('0x2')]},'rtptimeout':{'type':Sequelize[_0xb334('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xb334('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb334('0x2')]},'callbackextension':{'type':Sequelize[_0xb334('0x2')]},'timert1':{'type':Sequelize[_0xb334('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xb334('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xb334('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xb334('0x2')]},'use_q850_reason':{'type':Sequelize[_0xb334('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'force_avp':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no',_0xb334('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xb334('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb334('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xb334('0x2')]},'dtlscapath':{'type':Sequelize[_0xb334('0x2')]},'dtlssetup':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x29'),_0xb334('0x2a'),_0xb334('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb334('0x2')]},'recordofffeature':{'type':Sequelize[_0xb334('0x2')]},'call_limit':{'type':Sequelize[_0xb334('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xb334('0x12')](_0xb334('0x16'),'no')},'vmexten':{'type':Sequelize[_0xb334('0x2')]},'mohinterpret':{'type':Sequelize[_0xb334('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xb334('0x2')]},'description':{'type':Sequelize[_0xb334('0x2')]},'host':{'type':Sequelize[_0xb334('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xb334('0x12')]('yes','no',_0xb334('0x2c'),'update',_0xb334('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb334('0x2')]},'otherFields':{'type':Sequelize[_0xb334('0x2')]},'active':{'type':Sequelize[_0xb334('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xb334('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 f55cb59..d78d168 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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x20832c,_0x36df6d){var _0x3803c3=function(_0xd721dd){while(--_0xd721dd){_0x20832c['push'](_0x20832c['shift']());}};_0x3803c3(++_0x36df6d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xaf5c36,_0x29167f){_0xaf5c36=_0xaf5c36-0x0;var _0x221327=_0xd6d6[_0xaf5c36];return _0x221327;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +var _0x24ca=['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','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5e93f3,_0x57e9c3){var _0x183e24=function(_0xd63c52){while(--_0xd63c52){_0x5e93f3['push'](_0x5e93f3['shift']());}};_0x183e24(++_0x57e9c3);}(_0x24ca,0x1bc));var _0xa24c=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x24ca[_0xcfc44];return _0x307a25;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b6da1fc..2083044 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 _0xe6ab=['rimraf','./trunk.attributes','define','Trunk','tools_trunks','util','../../config/logger','api','request-promise'];(function(_0x403435,_0xcb4543){var _0x212dc8=function(_0x46bc0c){while(--_0x46bc0c){_0x403435['push'](_0x403435['shift']());}};_0x212dc8(++_0xcb4543);}(_0xe6ab,0x1b5));var _0xbe6a=function(_0x3e8beb,_0x18694e){_0x3e8beb=_0x3e8beb-0x0;var _0x1b2ab9=_0xe6ab[_0x3e8beb];return _0x1b2ab9;};'use strict';var _=require('lodash');var util=require(_0xbe6a('0x0'));var logger=require(_0xbe6a('0x1'))(_0xbe6a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbe6a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe6a('0x4'));var config=require('../../config/environment');var attributes=require(_0xbe6a('0x5'));module['exports']=function(_0x1a796d,_0x2b2dca){return _0x1a796d[_0xbe6a('0x6')](_0xbe6a('0x7'),attributes,{'tableName':_0xbe6a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd21=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x28f75c,_0x1b218b){var _0x1e3b8a=function(_0x3e1595){while(--_0x3e1595){_0x28f75c['push'](_0x28f75c['shift']());}};_0x1e3b8a(++_0x1b218b);}(_0xfd21,0xbc));var _0x1fd2=function(_0x246050,_0x39b817){_0x246050=_0x246050-0x0;var _0xf31c15=_0xfd21[_0x246050];return _0xf31c15;};'use strict';var _=require('lodash');var util=require(_0x1fd2('0x0'));var logger=require(_0x1fd2('0x1'))(_0x1fd2('0x2'));var moment=require(_0x1fd2('0x3'));var BPromise=require(_0x1fd2('0x4'));var rp=require(_0x1fd2('0x5'));var fs=require('fs');var path=require(_0x1fd2('0x6'));var rimraf=require(_0x1fd2('0x7'));var config=require(_0x1fd2('0x8'));var attributes=require(_0x1fd2('0x9'));module[_0x1fd2('0xa')]=function(_0xec07d9,_0x274b47){return _0xec07d9[_0x1fd2('0xb')](_0x1fd2('0xc'),attributes,{'tableName':_0x1fd2('0xd'),'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 89f8207..3fd8ce5 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 _0xf765=['raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xf765,0xe1));var _0x5f76=function(_0x199e3a,_0x127dda){_0x199e3a=_0x199e3a-0x0;var _0x423bf6=_0xf765[_0x199e3a];return _0x423bf6;};'use strict';var _=require(_0x5f76('0x0'));var util=require(_0x5f76('0x1'));var moment=require(_0x5f76('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f76('0x3'));var fs=require('fs');var Redis=require(_0x5f76('0x4'));var db=require(_0x5f76('0x5'))['db'];var utils=require(_0x5f76('0x6'));var logger=require(_0x5f76('0x7'))(_0x5f76('0x8'));var config=require(_0x5f76('0x9'));var jayson=require(_0x5f76('0xa'));var client=jayson[_0x5f76('0xb')][_0x5f76('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ce334,_0x5dd1b6,_0x246459){return new BPromise(function(_0x5b4b00,_0x431c44){return client[_0x5f76('0xd')](_0x4ce334,_0x246459)['then'](function(_0x17c6d1){logger[_0x5f76('0xe')](_0x5f76('0xf'),_0x5dd1b6,_0x5f76('0x10'));logger[_0x5f76('0x11')](_0x5f76('0x12'),_0x5dd1b6,'request\x20sent',JSON['stringify'](_0x17c6d1));if(_0x17c6d1[_0x5f76('0x13')]){if(_0x17c6d1[_0x5f76('0x13')][_0x5f76('0x14')]===0x1f4){logger[_0x5f76('0x13')](_0x5f76('0xf'),_0x5dd1b6,_0x17c6d1[_0x5f76('0x13')][_0x5f76('0x15')]);return _0x431c44(_0x17c6d1['error'][_0x5f76('0x15')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5dd1b6,_0x17c6d1[_0x5f76('0x13')][_0x5f76('0x15')]);return _0x5b4b00(_0x17c6d1[_0x5f76('0x13')][_0x5f76('0x15')]);}else{logger[_0x5f76('0xe')](_0x5f76('0xf'),_0x5dd1b6,_0x5f76('0x10'));_0x5b4b00(_0x17c6d1['result'][_0x5f76('0x15')]);}})[_0x5f76('0x16')](function(_0x387b3b){logger['error'](_0x5f76('0xf'),_0x5dd1b6,_0x387b3b);_0x431c44(_0x387b3b);});});}exports[_0x5f76('0x17')]=function(_0x5a0bd1){var _0x243463=this;return new Promise(function(_0x2d540e,_0x88b2fe){return db[_0x5f76('0x18')][_0x5f76('0x19')]({'raw':_0x5a0bd1[_0x5f76('0x1a')]?_0x5a0bd1[_0x5f76('0x1a')][_0x5f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a0bd1['options']?_0x5a0bd1[_0x5f76('0x1a')][_0x5f76('0x1c')]||null:null,'attributes':_0x5a0bd1[_0x5f76('0x1a')]?_0x5a0bd1[_0x5f76('0x1a')][_0x5f76('0x1d')]||null:null,'limit':_0x5a0bd1['options']?_0x5a0bd1['options'][_0x5f76('0x1e')]||null:null,'include':_0x5a0bd1[_0x5f76('0x1a')]?_0x5a0bd1['options'][_0x5f76('0x1f')]?_[_0x5f76('0x20')](_0x5a0bd1[_0x5f76('0x1a')][_0x5f76('0x1f')],function(_0x29327f){return{'model':db[_0x29327f[_0x5f76('0x21')]],'as':_0x29327f['as'],'attributes':_0x29327f[_0x5f76('0x1d')],'include':_0x29327f[_0x5f76('0x1f')]?_['map'](_0x29327f[_0x5f76('0x1f')],function(_0x2be123){return{'model':db[_0x2be123[_0x5f76('0x21')]],'as':_0x2be123['as'],'attributes':_0x2be123['attributes'],'include':_0x2be123[_0x5f76('0x1f')]?_[_0x5f76('0x20')](_0x2be123[_0x5f76('0x1f')],function(_0x2e2ee4){return{'model':db[_0x2e2ee4['model']],'as':_0x2e2ee4['as'],'attributes':_0x2e2ee4[_0x5f76('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c82a){logger[_0x5f76('0xe')](_0x5f76('0x17'),_0x5a0bd1);logger[_0x5f76('0x11')](_0x5f76('0x17'),_0x5a0bd1,JSON['stringify'](_0x43c82a));_0x2d540e(_0x43c82a);})['catch'](function(_0x69387c){logger[_0x5f76('0x13')]('GetTrunk',_0x69387c[_0x5f76('0x15')],_0x5a0bd1);_0x88b2fe(_0x243463[_0x5f76('0x13')](0x1f4,_0x69387c[_0x5f76('0x15')]));});});};exports[_0x5f76('0x22')]=function(_0x5cacfd){var _0x41919d=this;return new Promise(function(_0x3b0ed1,_0x8458d5){return db[_0x5f76('0x18')][_0x5f76('0x23')]({'raw':_0x5cacfd[_0x5f76('0x1a')]?_0x5cacfd['options'][_0x5f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cacfd['options']?_0x5cacfd[_0x5f76('0x1a')][_0x5f76('0x1c')]||null:null,'attributes':_0x5cacfd[_0x5f76('0x1a')]?_0x5cacfd[_0x5f76('0x1a')][_0x5f76('0x1d')]||null:null,'include':_0x5cacfd[_0x5f76('0x1a')]?_0x5cacfd[_0x5f76('0x1a')][_0x5f76('0x1f')]?_[_0x5f76('0x20')](_0x5cacfd['options'][_0x5f76('0x1f')],function(_0x39d80c){return{'model':db[_0x39d80c['model']],'as':_0x39d80c['as'],'attributes':_0x39d80c[_0x5f76('0x1d')],'include':_0x39d80c[_0x5f76('0x1f')]?_['map'](_0x39d80c[_0x5f76('0x1f')],function(_0x1ff7bb){return{'model':db[_0x1ff7bb[_0x5f76('0x21')]],'as':_0x1ff7bb['as'],'attributes':_0x1ff7bb['attributes'],'include':_0x1ff7bb[_0x5f76('0x1f')]?_['map'](_0x1ff7bb[_0x5f76('0x1f')],function(_0x422521){return{'model':db[_0x422521[_0x5f76('0x21')]],'as':_0x422521['as'],'attributes':_0x422521[_0x5f76('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x278429){logger[_0x5f76('0xe')]('ShowTrunk',_0x5cacfd);logger['debug'](_0x5f76('0x22'),_0x5cacfd,JSON['stringify'](_0x278429));_0x3b0ed1(_0x278429);})[_0x5f76('0x16')](function(_0x584a91){logger[_0x5f76('0x13')](_0x5f76('0x22'),_0x584a91[_0x5f76('0x15')],_0x5cacfd);_0x8458d5(_0x41919d['error'](0x1f4,_0x584a91[_0x5f76('0x15')]));});});}; \ No newline at end of file +var _0x0d8d=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','where','attributes','limit','include','map','model','GetTrunk','ShowTrunk','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info'];(function(_0x482af3,_0xf39f41){var _0x7cecfb=function(_0x3ec4b6){while(--_0x3ec4b6){_0x482af3['push'](_0x482af3['shift']());}};_0x7cecfb(++_0xf39f41);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x12b367,_0x137901){_0x12b367=_0x12b367-0x0;var _0x4913fb=_0x0d8d[_0x12b367];return _0x4913fb;};'use strict';var _=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var moment=require(_0xd0d8('0x2'));var BPromise=require(_0xd0d8('0x3'));var rs=require(_0xd0d8('0x4'));var fs=require('fs');var Redis=require(_0xd0d8('0x5'));var db=require(_0xd0d8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0d8('0x7'))(_0xd0d8('0x8'));var config=require('../../config/environment');var jayson=require(_0xd0d8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3ebf,_0x3c50a4,_0xf1a31c){return new BPromise(function(_0x3e8c9b,_0x21cb44){return client['request'](_0x5f3ebf,_0xf1a31c)[_0xd0d8('0xa')](function(_0x20798a){logger[_0xd0d8('0xb')](_0xd0d8('0xc'),_0x3c50a4,_0xd0d8('0xd'));logger[_0xd0d8('0xe')](_0xd0d8('0xf'),_0x3c50a4,'request\x20sent',JSON[_0xd0d8('0x10')](_0x20798a));if(_0x20798a[_0xd0d8('0x11')]){if(_0x20798a[_0xd0d8('0x11')][_0xd0d8('0x12')]===0x1f4){logger['error'](_0xd0d8('0xc'),_0x3c50a4,_0x20798a[_0xd0d8('0x11')][_0xd0d8('0x13')]);return _0x21cb44(_0x20798a[_0xd0d8('0x11')][_0xd0d8('0x13')]);}logger['error'](_0xd0d8('0xc'),_0x3c50a4,_0x20798a[_0xd0d8('0x11')]['message']);return _0x3e8c9b(_0x20798a['error'][_0xd0d8('0x13')]);}else{logger[_0xd0d8('0xb')](_0xd0d8('0xc'),_0x3c50a4,_0xd0d8('0xd'));_0x3e8c9b(_0x20798a[_0xd0d8('0x14')]['message']);}})['catch'](function(_0x51f53d){logger['error'](_0xd0d8('0xc'),_0x3c50a4,_0x51f53d);_0x21cb44(_0x51f53d);});});}exports['GetTrunk']=function(_0x4ff357){var _0x55c95a=this;return new Promise(function(_0x385e25,_0x391f2e){return db['Trunk']['findAll']({'raw':_0x4ff357[_0xd0d8('0x15')]?_0x4ff357[_0xd0d8('0x15')][_0xd0d8('0x16')]===undefined?!![]:![]:!![],'where':_0x4ff357[_0xd0d8('0x15')]?_0x4ff357[_0xd0d8('0x15')][_0xd0d8('0x17')]||null:null,'attributes':_0x4ff357['options']?_0x4ff357[_0xd0d8('0x15')][_0xd0d8('0x18')]||null:null,'limit':_0x4ff357[_0xd0d8('0x15')]?_0x4ff357['options'][_0xd0d8('0x19')]||null:null,'include':_0x4ff357['options']?_0x4ff357[_0xd0d8('0x15')][_0xd0d8('0x1a')]?_[_0xd0d8('0x1b')](_0x4ff357[_0xd0d8('0x15')][_0xd0d8('0x1a')],function(_0x18d305){return{'model':db[_0x18d305[_0xd0d8('0x1c')]],'as':_0x18d305['as'],'attributes':_0x18d305[_0xd0d8('0x18')],'include':_0x18d305['include']?_[_0xd0d8('0x1b')](_0x18d305[_0xd0d8('0x1a')],function(_0x377784){return{'model':db[_0x377784[_0xd0d8('0x1c')]],'as':_0x377784['as'],'attributes':_0x377784[_0xd0d8('0x18')],'include':_0x377784[_0xd0d8('0x1a')]?_[_0xd0d8('0x1b')](_0x377784[_0xd0d8('0x1a')],function(_0x53382b){return{'model':db[_0x53382b[_0xd0d8('0x1c')]],'as':_0x53382b['as'],'attributes':_0x53382b[_0xd0d8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0d8('0xa')](function(_0xca6da3){logger[_0xd0d8('0xb')](_0xd0d8('0x1d'),_0x4ff357);logger[_0xd0d8('0xe')](_0xd0d8('0x1d'),_0x4ff357,JSON[_0xd0d8('0x10')](_0xca6da3));_0x385e25(_0xca6da3);})['catch'](function(_0x5b4d69){logger['error']('GetTrunk',_0x5b4d69[_0xd0d8('0x13')],_0x4ff357);_0x391f2e(_0x55c95a[_0xd0d8('0x11')](0x1f4,_0x5b4d69[_0xd0d8('0x13')]));});});};exports[_0xd0d8('0x1e')]=function(_0x2c4dfb){var _0xca207d=this;return new Promise(function(_0x5aa8e8,_0x6bc7e5){return db['Trunk']['find']({'raw':_0x2c4dfb[_0xd0d8('0x15')]?_0x2c4dfb[_0xd0d8('0x15')][_0xd0d8('0x16')]===undefined?!![]:![]:!![],'where':_0x2c4dfb[_0xd0d8('0x15')]?_0x2c4dfb['options'][_0xd0d8('0x17')]||null:null,'attributes':_0x2c4dfb[_0xd0d8('0x15')]?_0x2c4dfb[_0xd0d8('0x15')][_0xd0d8('0x18')]||null:null,'include':_0x2c4dfb[_0xd0d8('0x15')]?_0x2c4dfb[_0xd0d8('0x15')][_0xd0d8('0x1a')]?_[_0xd0d8('0x1b')](_0x2c4dfb[_0xd0d8('0x15')][_0xd0d8('0x1a')],function(_0x34f08b){return{'model':db[_0x34f08b[_0xd0d8('0x1c')]],'as':_0x34f08b['as'],'attributes':_0x34f08b[_0xd0d8('0x18')],'include':_0x34f08b['include']?_['map'](_0x34f08b[_0xd0d8('0x1a')],function(_0x28b971){return{'model':db[_0x28b971[_0xd0d8('0x1c')]],'as':_0x28b971['as'],'attributes':_0x28b971[_0xd0d8('0x18')],'include':_0x28b971[_0xd0d8('0x1a')]?_[_0xd0d8('0x1b')](_0x28b971['include'],function(_0x1eb658){return{'model':db[_0x1eb658[_0xd0d8('0x1c')]],'as':_0x1eb658['as'],'attributes':_0x1eb658[_0xd0d8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x230ca9){logger[_0xd0d8('0xb')](_0xd0d8('0x1e'),_0x2c4dfb);logger[_0xd0d8('0xe')](_0xd0d8('0x1e'),_0x2c4dfb,JSON[_0xd0d8('0x10')](_0x230ca9));_0x5aa8e8(_0x230ca9);})[_0xd0d8('0x1f')](function(_0x6cb8fc){logger[_0xd0d8('0x11')](_0xd0d8('0x1e'),_0x6cb8fc[_0xd0d8('0x13')],_0x2c4dfb);_0x6bc7e5(_0xca207d[_0xd0d8('0x11')](0x1f4,_0x6cb8fc[_0xd0d8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 15eb854..eafa489 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5421=['/:id','isAuthenticated','update','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x60c77e,_0x1473f2){var _0x1209a4=function(_0x28ebdc){while(--_0x28ebdc){_0x60c77e['push'](_0x60c77e['shift']());}};_0x1209a4(++_0x1473f2);}(_0x5421,0x133));var _0x1542=function(_0x31ad1e,_0x5fdfb8){_0x31ad1e=_0x31ad1e-0x0;var _0x21215c=_0x5421[_0x31ad1e];return _0x21215c;};'use strict';var express=require(_0x1542('0x0'));var router=express[_0x1542('0x1')]();var auth=require(_0x1542('0x2'));var controller=require(_0x1542('0x3'));router[_0x1542('0x4')](_0x1542('0x5'),auth[_0x1542('0x6')](),controller[_0x1542('0x7')]);module['exports']=router; \ No newline at end of file +var _0x8456=['update','exports','express','Router','../../components/auth/service','/:id','isAuthenticated'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8456,0x13d));var _0x6845=function(_0x377bfb,_0x40a6b8){_0x377bfb=_0x377bfb-0x0;var _0x4bb900=_0x8456[_0x377bfb];return _0x4bb900;};'use strict';var express=require(_0x6845('0x0'));var router=express[_0x6845('0x1')]();var auth=require(_0x6845('0x2'));var controller=require('./user-setting.controller');router['put'](_0x6845('0x3'),auth[_0x6845('0x4')](),controller[_0x6845('0x5')]);module[_0x6845('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index e84df0f..3f108c4 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec64=['info','exports','BOOLEAN','TEXT','INTEGER','UserId','error','warning'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xec64,0x1c6));var _0x4ec6=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0xec64[_0x462fe4];return _0x82b23a;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x4ec6('0x0'),_0x4ec6('0x1'),_0x4ec6('0x2'),'debug'];module[_0x4ec6('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4ec6('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4ec6('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x4ec6('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4ec6('0x6')],'unique':_0x4ec6('0x7')}}; \ No newline at end of file +var _0xd094=['sequelize','error','warning','info','ENUM','BOOLEAN','DATE'];(function(_0x561950,_0x3b4b29){var _0x4d0631=function(_0x345ebe){while(--_0x345ebe){_0x561950['push'](_0x561950['shift']());}};_0x4d0631(++_0x3b4b29);}(_0xd094,0x142));var _0x4d09=function(_0x498468,_0x4c3715){_0x498468=_0x498468-0x0;var _0x61ba70=_0xd094[_0x498468];return _0x61ba70;};'use strict';var Sequelize=require(_0x4d09('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x4d09('0x1'),_0x4d09('0x2'),_0x4d09('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x4d09('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4d09('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4d09('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x4d09('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index d274c3f..0d31a53 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a72=['admin','params','UserSetting','find','then','catch','ioredis','../../config/logger','../../config/environment','socket.io-emitter','./user-setting.socket','redis','localhost','json','update','error','stack','name','status','send'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0x7a72,0x1be));var _0x27a7=function(_0x5429b3,_0x1d8c46){_0x5429b3=_0x5429b3-0x0;var _0x1322a8=_0x7a72[_0x5429b3];return _0x1322a8;};'use strict';var _=require('lodash');var Redis=require(_0x27a7('0x0'));var logger=require(_0x27a7('0x1'))('api');var config=require(_0x27a7('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x27a7('0x3'))(new Redis(config['redis']));require(_0x27a7('0x4'))['register'](socket);config[_0x27a7('0x5')]=_['defaults'](config[_0x27a7('0x5')],{'host':_0x27a7('0x6'),'port':0x18eb});function respondWithResult(_0x5d7305,_0x4ede34){_0x4ede34=_0x4ede34||0xc8;return function(_0x1de957){if(_0x1de957){return _0x5d7305['status'](_0x4ede34)[_0x27a7('0x7')](_0x1de957);}};}function saveUpdates(_0x4679aa){return function(_0x218514){if(_0x218514){return _0x218514[_0x27a7('0x8')](_0x4679aa)['then'](function(_0x1ce909){return _0x1ce909;});}return null;};}function handleEntityNotFound(_0x2547cc){return function(_0x3a54bd){if(!_0x3a54bd){_0x2547cc['sendStatus'](0x194);}return _0x3a54bd;};}function handleError(_0x299206,_0x38a600){_0x38a600=_0x38a600||0x1f4;return function(_0x567418){logger[_0x27a7('0x9')](_0x567418[_0x27a7('0xa')]);if(_0x567418['name']){delete _0x567418[_0x27a7('0xb')];}_0x299206[_0x27a7('0xc')](_0x38a600)[_0x27a7('0xd')](_0x567418);};}exports[_0x27a7('0x8')]=function(_0x428e6a,_0x20189e){if(_0x428e6a['user']['role']!==_0x27a7('0xe'))throw new Error('Unauthorized');if(isNaN(Number(_0x428e6a[_0x27a7('0xf')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x27a7('0x10')][_0x27a7('0x11')]({'where':{'id':_0x428e6a[_0x27a7('0xf')]['id']}})[_0x27a7('0x12')](handleEntityNotFound(_0x20189e,null))['then'](saveUpdates(_0x428e6a['body'],null))[_0x27a7('0x12')](respondWithResult(_0x20189e,null))[_0x27a7('0x13')](handleError(_0x20189e,null));}; \ No newline at end of file +var _0x9f62=['Invalid\x20user\x20setting\x20id','UserSetting','find','body','ioredis','api','../../config/environment','../../mysqldb','./user-setting.socket','register','redis','defaults','localhost','status','then','sendStatus','error','send','update','user','role','admin','Unauthorized','params'];(function(_0x14e5c2,_0x5766dd){var _0x4f6d55=function(_0x17d6e0){while(--_0x17d6e0){_0x14e5c2['push'](_0x14e5c2['shift']());}};_0x4f6d55(++_0x5766dd);}(_0x9f62,0x154));var _0x29f6=function(_0x5dd170,_0x33018e){_0x5dd170=_0x5dd170-0x0;var _0x5f58b6=_0x9f62[_0x5dd170];return _0x5f58b6;};'use strict';var _=require('lodash');var Redis=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var config=require(_0x29f6('0x2'));var db=require(_0x29f6('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x29f6('0x4'))[_0x29f6('0x5')](socket);config[_0x29f6('0x6')]=_[_0x29f6('0x7')](config['redis'],{'host':_0x29f6('0x8'),'port':0x18eb});function respondWithResult(_0x272876,_0x9a43fe){_0x9a43fe=_0x9a43fe||0xc8;return function(_0x2ba602){if(_0x2ba602){return _0x272876[_0x29f6('0x9')](_0x9a43fe)['json'](_0x2ba602);}};}function saveUpdates(_0x5ec7aa){return function(_0x5f43bb){if(_0x5f43bb){return _0x5f43bb['update'](_0x5ec7aa)[_0x29f6('0xa')](function(_0x44db16){return _0x44db16;});}return null;};}function handleEntityNotFound(_0x4fb455){return function(_0x5a0724){if(!_0x5a0724){_0x4fb455[_0x29f6('0xb')](0x194);}return _0x5a0724;};}function handleError(_0x442623,_0x4909e0){_0x4909e0=_0x4909e0||0x1f4;return function(_0x17b69c){logger[_0x29f6('0xc')](_0x17b69c['stack']);if(_0x17b69c['name']){delete _0x17b69c['name'];}_0x442623['status'](_0x4909e0)[_0x29f6('0xd')](_0x17b69c);};}exports[_0x29f6('0xe')]=function(_0x189344,_0x11a1fd){if(_0x189344[_0x29f6('0xf')][_0x29f6('0x10')]!==_0x29f6('0x11'))throw new Error(_0x29f6('0x12'));if(isNaN(Number(_0x189344[_0x29f6('0x13')]['id'])))throw new Error(_0x29f6('0x14'));return db[_0x29f6('0x15')][_0x29f6('0x16')]({'where':{'id':_0x189344[_0x29f6('0x13')]['id']}})[_0x29f6('0xa')](handleEntityNotFound(_0x11a1fd,null))[_0x29f6('0xa')](saveUpdates(_0x189344[_0x29f6('0x17')],null))[_0x29f6('0xa')](respondWithResult(_0x11a1fd,null))['catch'](handleError(_0x11a1fd,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 2acce82..58d4d67 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad72=['setMaxListeners','save','emit','hook','exports','../../mysqldb'];(function(_0x2a82ed,_0x1eab9d){var _0x5d299e=function(_0x4a4d96){while(--_0x4a4d96){_0x2a82ed['push'](_0x2a82ed['shift']());}};_0x5d299e(++_0x1eab9d);}(_0xad72,0x113));var _0x2ad7=function(_0x3f8cbe,_0x367bfa){_0x3f8cbe=_0x3f8cbe-0x0;var _0x51324a=_0xad72[_0x3f8cbe];return _0x51324a;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x2ad7('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2ad7('0x1')](0x0);var events={'afterCreate':_0x2ad7('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x537021){return function(_0x324d4c,_0x4d8b1e,_0x154230){UserSettingEvents[_0x2ad7('0x3')](_0x537021+':'+_0x324d4c['id'],_0x324d4c);UserSettingEvents[_0x2ad7('0x3')](_0x537021,_0x324d4c);_0x154230(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x2ad7('0x4')](e,emitEvent(event));}}module[_0x2ad7('0x5')]=UserSettingEvents; \ No newline at end of file +var _0xc312=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting'];(function(_0x1e947f,_0x59c3c0){var _0x31cd93=function(_0x2dee8b){while(--_0x2dee8b){_0x1e947f['push'](_0x1e947f['shift']());}};_0x31cd93(++_0x59c3c0);}(_0xc312,0x1e4));var _0x2c31=function(_0x2e53ae,_0xebda49){_0x2e53ae=_0x2e53ae-0x0;var _0x4dffb5=_0xc312[_0x2e53ae];return _0x4dffb5;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x2c31('0x0'))['db'][_0x2c31('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2c31('0x2')](0x0);var events={'afterCreate':_0x2c31('0x3'),'afterUpdate':'update','afterDestroy':_0x2c31('0x4')};function emitEvent(_0x3f1f7e){return function(_0x5cff45,_0x40a5db,_0x2e99b0){UserSettingEvents['emit'](_0x3f1f7e+':'+_0x5cff45['id'],_0x5cff45);UserSettingEvents[_0x2c31('0x5')](_0x3f1f7e,_0x5cff45);_0x2e99b0(null);};}for(var e in events){if(events[_0x2c31('0x6')](e)){var event=events[e];UserSetting[_0x2c31('0x7')](e,emitEvent(event));}}module[_0x2c31('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 380b236..e1ab0c0 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0825=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x0825,0x1e4));var _0x5082=function(_0x503115,_0x73110){_0x503115=_0x503115-0x0;var _0x2cfabf=_0x0825[_0x503115];return _0x2cfabf;};'use strict';var attributes=require(_0x5082('0x0'));module[_0x5082('0x1')]=function(_0x5889f4){return _0x5889f4['define'](_0x5082('0x2'),attributes,{'tableName':_0x5082('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d25c5){if(!_0x5d25c5[_0x5082('0x4')])_0x5d25c5[_0x5082('0x5')]=null;else if(_0x5d25c5[_0x5082('0x5')]===null)_0x5d25c5[_0x5082('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x1beb=['./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x22f862,_0x379b50){var _0x20b9bc=function(_0x5b10c5){while(--_0x5b10c5){_0x22f862['push'](_0x22f862['shift']());}};_0x20b9bc(++_0x379b50);}(_0x1beb,0x165));var _0xb1be=function(_0x1d0213,_0x545dff){_0x1d0213=_0x1d0213-0x0;var _0x1726b5=_0x1beb[_0x1d0213];return _0x1726b5;};'use strict';var attributes=require(_0xb1be('0x0'));module[_0xb1be('0x1')]=function(_0x56672f){return _0x56672f[_0xb1be('0x2')](_0xb1be('0x3'),attributes,{'tableName':_0xb1be('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55259c){if(!_0x55259c[_0xb1be('0x5')])_0x55259c[_0xb1be('0x6')]=null;else if(_0x55259c['clientSideLoggingEnabledSince']===null)_0x55259c[_0xb1be('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 1cbfc9c..f2ac3f3 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08a0=['user-setting:update','user-setting:update:user-','user-setting:','./user-setting.events','save','remove','emit'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x08a0,0x106));var _0x008a=function(_0x42f270,_0x452dec){_0x42f270=_0x42f270-0x0;var _0x57bc5b=_0x08a0[_0x42f270];return _0x57bc5b;};'use strict';var UserSettingEvents=require(_0x008a('0x0'));var events=[_0x008a('0x1'),_0x008a('0x2'),'update'];function createListener(_0x5d7398,_0x327047){return function(_0x2d458e){_0x327047[_0x008a('0x3')](_0x5d7398,_0x2d458e);if(_0x5d7398===_0x008a('0x4')){_0x327047['emit'](_0x008a('0x5')+_0x2d458e['UserId'],_0x2d458e);}};}exports['register']=function(_0x48fd01){for(var _0x10f50f=0x0,_0x1557e4=events['length'];_0x10f50f<_0x1557e4;_0x10f50f++){var _0x200c0f=events[_0x10f50f];var _0x3e3cac=createListener(_0x008a('0x6')+_0x200c0f,_0x48fd01);UserSettingEvents['on'](_0x200c0f,_0x3e3cac);}}; \ No newline at end of file +var _0x35cd=['user-setting:','./user-setting.events','remove','user-setting:update','emit','user-setting:update:user-','UserId','length'];(function(_0x328ab0,_0x3c9cf9){var _0x3f5954=function(_0x39e1b4){while(--_0x39e1b4){_0x328ab0['push'](_0x328ab0['shift']());}};_0x3f5954(++_0x3c9cf9);}(_0x35cd,0x199));var _0xd35c=function(_0x45682b,_0x22ef44){_0x45682b=_0x45682b-0x0;var _0x28c3cd=_0x35cd[_0x45682b];return _0x28c3cd;};'use strict';var UserSettingEvents=require(_0xd35c('0x0'));var events=['save',_0xd35c('0x1'),'update'];function createListener(_0x3ddd5f,_0x539eca){return function(_0x33c08e){_0x539eca['emit'](_0x3ddd5f,_0x33c08e);if(_0x3ddd5f===_0xd35c('0x2')){_0x539eca[_0xd35c('0x3')](_0xd35c('0x4')+_0x33c08e[_0xd35c('0x5')],_0x33c08e);}};}exports['register']=function(_0x20f6fd){for(var _0x316e0a=0x0,_0x30517c=events[_0xd35c('0x6')];_0x316e0a<_0x30517c;_0x316e0a++){var _0x32b67a=events[_0x316e0a];var _0x2b6b20=createListener(_0xd35c('0x7')+_0x32b67a,_0x20f6fd);UserSettingEvents['on'](_0x32b67a,_0x2b6b20);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 45ef55e..bbbbbe3 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 _0xdba6=['addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','createApiKey','put','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeApiKey','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','addQueues','join','root','server/files/images/','format','%s-%s','originalname','single','addAvatar','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts'];(function(_0x17f515,_0x26e47f){var _0x5ea54b=function(_0x32de1b){while(--_0x32de1b){_0x17f515['push'](_0x17f515['shift']());}};_0x5ea54b(++_0x26e47f);}(_0xdba6,0x14d));var _0x6dba=function(_0x1bdc0c,_0x1d890f){_0x1bdc0c=_0x1bdc0c-0x0;var _0x5e57f3=_0xdba6[_0x1bdc0c];return _0x5e57f3;};'use strict';var multer=require(_0x6dba('0x0'));var util=require('util');var path=require(_0x6dba('0x1'));var timeout=require(_0x6dba('0x2'));var express=require(_0x6dba('0x3'));var router=express['Router']();var fs_extra=require(_0x6dba('0x4'));var auth=require(_0x6dba('0x5'));var interaction=require(_0x6dba('0x6'));var config=require('../../config/environment');var controller=require(_0x6dba('0x7'));router[_0x6dba('0x8')]('/',auth[_0x6dba('0x9')](),controller['index']);router[_0x6dba('0x8')]('/describe',auth[_0x6dba('0x9')](),controller[_0x6dba('0xa')]);router[_0x6dba('0x8')](_0x6dba('0xb'),auth[_0x6dba('0x9')](),controller[_0x6dba('0xc')]);router['get'](_0x6dba('0xd'),auth['isAuthenticated'](),controller[_0x6dba('0xe')]);router[_0x6dba('0x8')](_0x6dba('0xf'),auth['isAuthenticated'](),controller[_0x6dba('0x10')]);router[_0x6dba('0x8')](_0x6dba('0x11'),controller[_0x6dba('0x12')]);router[_0x6dba('0x8')](_0x6dba('0x13'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x14')]);router[_0x6dba('0x8')](_0x6dba('0x15'),auth['isAuthenticated'](),controller['getContacts']);router[_0x6dba('0x8')](_0x6dba('0x16'),auth[_0x6dba('0x9')](),controller['getQueues']);router[_0x6dba('0x8')](_0x6dba('0x17'),auth['isAuthenticated'](),controller[_0x6dba('0x18')]);router[_0x6dba('0x8')](_0x6dba('0x19'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x1a')]);router[_0x6dba('0x8')](_0x6dba('0x1b'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x6dba('0x8')](_0x6dba('0x1c'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x1d')]);router[_0x6dba('0x8')](_0x6dba('0x1e'),auth['isAuthenticated'](),controller['getChatInteractions']);router['get'](_0x6dba('0x1f'),auth[_0x6dba('0x9')](),controller['getOpenchannelInteractions']);router[_0x6dba('0x8')](_0x6dba('0x20'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x21')]);router[_0x6dba('0x8')]('/:id/sms/interactions',auth[_0x6dba('0x9')](),controller[_0x6dba('0x22')]);router[_0x6dba('0x8')](_0x6dba('0x23'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x24')]);router[_0x6dba('0x8')](_0x6dba('0x25'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x26')]);router['get'](_0x6dba('0x27'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6dba('0x8')](_0x6dba('0x28'),auth['isAuthenticated'](),controller['getLists']);router[_0x6dba('0x8')](_0x6dba('0x29'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x2a')]);router['get'](_0x6dba('0x2b'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x2c')]);router[_0x6dba('0x8')](_0x6dba('0x2d'),auth[_0x6dba('0x9')](),controller['getFaxAccounts']);router[_0x6dba('0x8')]('/:id/mail_accounts',auth[_0x6dba('0x9')](),controller['getMailAccounts']);router[_0x6dba('0x8')]('/:id/openchannel_accounts',auth[_0x6dba('0x9')](),controller[_0x6dba('0x2e')]);router['get'](_0x6dba('0x2f'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x30')]);router[_0x6dba('0x8')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x6dba('0x31')]);router[_0x6dba('0x8')](_0x6dba('0x32'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x33')]);router['get'](_0x6dba('0x34'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x35')]);router['get'](_0x6dba('0x36'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x37')]);router[_0x6dba('0x38')](_0x6dba('0x15'),auth[_0x6dba('0x9')](),controller['addContacts']);router[_0x6dba('0x38')]('/',auth[_0x6dba('0x9')](),controller[_0x6dba('0x39')]);router['post'](_0x6dba('0x3a'),auth[_0x6dba('0x9')](),controller['bulkCreate']);router[_0x6dba('0x38')]('/:id/queues',auth[_0x6dba('0x9')](),controller[_0x6dba('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c6c11,_0x3a3dd7,_0x190f75){_0x190f75(null,path[_0x6dba('0x3c')](config[_0x6dba('0x3d')],_0x6dba('0x3e')));},'filename':function(_0x22cd1c,_0x45f171,_0x3d5d15){_0x3d5d15(null,util[_0x6dba('0x3f')](_0x6dba('0x40'),Date['now'](),_0x45f171[_0x6dba('0x41')]));}})});router[_0x6dba('0x38')](_0x6dba('0x11'),upload[_0x6dba('0x42')]('file'),controller[_0x6dba('0x43')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x6dba('0x44')]);router[_0x6dba('0x38')]('/:id/logout',auth[_0x6dba('0x9')](),controller[_0x6dba('0x45')]);router[_0x6dba('0x38')](_0x6dba('0x46'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x47')]);router['post'](_0x6dba('0x48'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x49')]);router[_0x6dba('0x38')]('/:id/teams',auth[_0x6dba('0x9')](),controller[_0x6dba('0x4a')]);router[_0x6dba('0x38')]('/:id/chat_interactions',auth[_0x6dba('0x9')](),controller['addChatInteractions']);router[_0x6dba('0x38')](_0x6dba('0x4b'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x4c')]);router['post'](_0x6dba('0x4d'),auth[_0x6dba('0x9')](),controller['addFaxInteractions']);router['post'](_0x6dba('0x4e'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x4f')]);router[_0x6dba('0x38')](_0x6dba('0x50'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x51')]);router[_0x6dba('0x38')](_0x6dba('0x52'),auth['isAuthenticated'](),controller[_0x6dba('0x53')]);router[_0x6dba('0x38')](_0x6dba('0x2d'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x54')]);router[_0x6dba('0x38')](_0x6dba('0x55'),auth[_0x6dba('0x9')](),controller['addMailAccounts']);router[_0x6dba('0x38')](_0x6dba('0x56'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x57')]);router[_0x6dba('0x38')](_0x6dba('0x2f'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x58')]);router[_0x6dba('0x38')](_0x6dba('0x59'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x5a')]);router[_0x6dba('0x38')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x6dba('0x38')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x6dba('0x5b')]);router['put']('/:id',auth[_0x6dba('0x9')](),controller['update']);router[_0x6dba('0x5c')](_0x6dba('0x5d'),auth['isAuthenticated'](),controller[_0x6dba('0x5e')]);router[_0x6dba('0x5f')](_0x6dba('0x16'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x6dba('0x5f')]('/:id/teams',auth[_0x6dba('0x9')](),controller[_0x6dba('0x60')]);router[_0x6dba('0x5f')]('/:id',auth[_0x6dba('0x9')](),controller[_0x6dba('0x61')]);router[_0x6dba('0x5f')](_0x6dba('0x62'),auth['isAuthenticated'](),controller[_0x6dba('0x63')]);router['delete'](_0x6dba('0x4b'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x6dba('0x5f')](_0x6dba('0x4d'),auth[_0x6dba('0x9')](),controller['removeFaxInteractions']);router[_0x6dba('0x5f')](_0x6dba('0x4e'),auth['isAuthenticated'](),controller[_0x6dba('0x64')]);router[_0x6dba('0x5f')](_0x6dba('0x50'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x65')]);router[_0x6dba('0x5f')](_0x6dba('0x52'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x66')]);router['delete'](_0x6dba('0x2d'),auth[_0x6dba('0x9')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x6dba('0x56'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x6dba('0x5f')](_0x6dba('0x2f'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x6dba('0x5f')](_0x6dba('0x59'),auth[_0x6dba('0x9')](),controller['removeChatWebsites']);router[_0x6dba('0x5f')](_0x6dba('0x32'),auth[_0x6dba('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x6dba('0x36'),auth[_0x6dba('0x9')](),controller[_0x6dba('0x67')]);module[_0x6dba('0x68')]=router; \ No newline at end of file +var _0x1364=['getContacts','getQueues','/:id/queues_rt','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','now','single','file','addAvatar','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/mail_interactions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/whoami','whoami','getPresence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts'];(function(_0x44d32f,_0x50898d){var _0x1fa392=function(_0x22b51e){while(--_0x22b51e){_0x44d32f['push'](_0x44d32f['shift']());}};_0x1fa392(++_0x50898d);}(_0x1364,0x1eb));var _0x4136=function(_0x3acf5e,_0x145883){_0x3acf5e=_0x3acf5e-0x0;var _0x23c14f=_0x1364[_0x3acf5e];return _0x23c14f;};'use strict';var multer=require(_0x4136('0x0'));var util=require('util');var path=require(_0x4136('0x1'));var timeout=require(_0x4136('0x2'));var express=require('express');var router=express[_0x4136('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4136('0x4'));var interaction=require(_0x4136('0x5'));var config=require(_0x4136('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x4136('0x7')](),controller['index']);router[_0x4136('0x8')](_0x4136('0x9'),auth[_0x4136('0x7')](),controller[_0x4136('0xa')]);router[_0x4136('0x8')](_0x4136('0xb'),auth['isAuthenticated'](),controller[_0x4136('0xc')]);router[_0x4136('0x8')]('/presence',auth[_0x4136('0x7')](),controller[_0x4136('0xd')]);router[_0x4136('0x8')](_0x4136('0xe'),auth[_0x4136('0x7')](),controller['show']);router[_0x4136('0x8')](_0x4136('0xf'),controller['getAvatar']);router['get'](_0x4136('0x10'),auth[_0x4136('0x7')](),controller[_0x4136('0x11')]);router['get'](_0x4136('0x12'),auth[_0x4136('0x7')](),controller[_0x4136('0x13')]);router[_0x4136('0x8')]('/:id/queues',auth[_0x4136('0x7')](),controller[_0x4136('0x14')]);router[_0x4136('0x8')](_0x4136('0x15'),auth[_0x4136('0x7')](),controller['getVoiceQueuesRt']);router[_0x4136('0x8')]('/:id/groups',auth['isAuthenticated'](),controller[_0x4136('0x16')]);router[_0x4136('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0x4136('0x8')](_0x4136('0x17'),auth['isAuthenticated'](),controller[_0x4136('0x18')]);router[_0x4136('0x8')](_0x4136('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x4136('0x8')]('/:id/openchannel/interactions',auth[_0x4136('0x7')](),controller[_0x4136('0x1a')]);router['get'](_0x4136('0x1b'),auth[_0x4136('0x7')](),controller['getMailInteractions']);router[_0x4136('0x8')](_0x4136('0x1c'),auth[_0x4136('0x7')](),controller[_0x4136('0x1d')]);router[_0x4136('0x8')](_0x4136('0x1e'),auth[_0x4136('0x7')](),controller[_0x4136('0x1f')]);router[_0x4136('0x8')]('/:id/whatsapp/interactions',auth[_0x4136('0x7')](),controller['getWhatsappInteractions']);router[_0x4136('0x8')](_0x4136('0x20'),auth['isAuthenticated'](),controller[_0x4136('0x21')]);router[_0x4136('0x8')]('/:id/lists',auth[_0x4136('0x7')](),controller['getLists']);router[_0x4136('0x8')]('/:id/agents',auth[_0x4136('0x7')](),controller[_0x4136('0x22')]);router['get'](_0x4136('0x23'),auth[_0x4136('0x7')](),controller[_0x4136('0x24')]);router[_0x4136('0x8')]('/:id/fax_accounts',auth[_0x4136('0x7')](),controller[_0x4136('0x25')]);router['get'](_0x4136('0x26'),auth['isAuthenticated'](),controller[_0x4136('0x27')]);router[_0x4136('0x8')](_0x4136('0x28'),auth[_0x4136('0x7')](),controller[_0x4136('0x29')]);router['get'](_0x4136('0x2a'),auth[_0x4136('0x7')](),controller[_0x4136('0x2b')]);router[_0x4136('0x8')](_0x4136('0x2c'),auth[_0x4136('0x7')](),controller[_0x4136('0x2d')]);router[_0x4136('0x8')](_0x4136('0x2e'),auth[_0x4136('0x7')](),controller['getWhatsappAccounts']);router[_0x4136('0x8')](_0x4136('0x2f'),auth[_0x4136('0x7')](),controller[_0x4136('0x30')]);router[_0x4136('0x8')](_0x4136('0x31'),auth[_0x4136('0x7')](),controller[_0x4136('0x32')]);router[_0x4136('0x33')](_0x4136('0x12'),auth[_0x4136('0x7')](),controller['addContacts']);router[_0x4136('0x33')]('/',auth[_0x4136('0x7')](),controller[_0x4136('0x34')]);router[_0x4136('0x33')]('/create_many',auth[_0x4136('0x7')](),controller[_0x4136('0x35')]);router[_0x4136('0x33')](_0x4136('0x36'),auth[_0x4136('0x7')](),controller[_0x4136('0x37')]);var upload=multer({'storage':multer[_0x4136('0x38')]({'destination':function(_0x34f52e,_0x2c8e66,_0x452f10){_0x452f10(null,path[_0x4136('0x39')](config[_0x4136('0x3a')],_0x4136('0x3b')));},'filename':function(_0x267195,_0xfc28aa,_0x584531){_0x584531(null,util[_0x4136('0x3c')]('%s-%s',Date[_0x4136('0x3d')](),_0xfc28aa['originalname']));}})});router[_0x4136('0x33')](_0x4136('0xf'),upload[_0x4136('0x3e')](_0x4136('0x3f')),controller[_0x4136('0x40')]);router[_0x4136('0x33')]('/:id/login',auth[_0x4136('0x7')](),controller['login']);router[_0x4136('0x33')]('/:id/logout',auth[_0x4136('0x7')](),controller['logout']);router[_0x4136('0x33')](_0x4136('0x41'),auth[_0x4136('0x7')](),controller[_0x4136('0x42')]);router[_0x4136('0x33')](_0x4136('0x43'),auth['isAuthenticated'](),controller['unpause']);router[_0x4136('0x33')](_0x4136('0x20'),auth[_0x4136('0x7')](),controller[_0x4136('0x44')]);router[_0x4136('0x33')](_0x4136('0x45'),auth[_0x4136('0x7')](),controller[_0x4136('0x46')]);router[_0x4136('0x33')]('/:id/mail_interactions',auth[_0x4136('0x7')](),controller['addMailInteractions']);router[_0x4136('0x33')]('/:id/fax_interactions',auth[_0x4136('0x7')](),controller['addFaxInteractions']);router[_0x4136('0x33')](_0x4136('0x47'),auth[_0x4136('0x7')](),controller['addSmsInteractions']);router['post'](_0x4136('0x48'),auth[_0x4136('0x7')](),controller[_0x4136('0x49')]);router[_0x4136('0x33')](_0x4136('0x4a'),auth[_0x4136('0x7')](),controller[_0x4136('0x4b')]);router[_0x4136('0x33')](_0x4136('0x4c'),auth[_0x4136('0x7')](),controller[_0x4136('0x4d')]);router['post'](_0x4136('0x26'),auth['isAuthenticated'](),controller[_0x4136('0x4e')]);router[_0x4136('0x33')](_0x4136('0x28'),auth[_0x4136('0x7')](),controller[_0x4136('0x4f')]);router[_0x4136('0x33')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x4136('0x50')]);router[_0x4136('0x33')](_0x4136('0x2c'),auth[_0x4136('0x7')](),controller[_0x4136('0x51')]);router[_0x4136('0x33')](_0x4136('0x2e'),auth[_0x4136('0x7')](),controller[_0x4136('0x52')]);router[_0x4136('0x33')]('/:id/api_key',auth[_0x4136('0x7')](),controller[_0x4136('0x53')]);router[_0x4136('0x54')](_0x4136('0xe'),auth[_0x4136('0x7')](),controller[_0x4136('0x55')]);router[_0x4136('0x54')](_0x4136('0x56'),auth['isAuthenticated'](),controller[_0x4136('0x57')]);router[_0x4136('0x58')]('/:id/queues',auth[_0x4136('0x7')](),controller[_0x4136('0x59')]);router[_0x4136('0x58')](_0x4136('0x20'),auth[_0x4136('0x7')](),controller['removeTeams']);router[_0x4136('0x58')](_0x4136('0xe'),auth['isAuthenticated'](),controller[_0x4136('0x5a')]);router[_0x4136('0x58')](_0x4136('0x45'),auth[_0x4136('0x7')](),controller['removeChatInteractions']);router[_0x4136('0x58')](_0x4136('0x5b'),auth[_0x4136('0x7')](),controller['removeMailInteractions']);router['delete'](_0x4136('0x5c'),auth[_0x4136('0x7')](),controller['removeFaxInteractions']);router['delete'](_0x4136('0x47'),auth[_0x4136('0x7')](),controller[_0x4136('0x5d')]);router[_0x4136('0x58')](_0x4136('0x48'),auth[_0x4136('0x7')](),controller[_0x4136('0x5e')]);router[_0x4136('0x58')](_0x4136('0x4a'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x4136('0x58')](_0x4136('0x4c'),auth['isAuthenticated'](),controller[_0x4136('0x5f')]);router[_0x4136('0x58')](_0x4136('0x26'),auth['isAuthenticated'](),controller[_0x4136('0x60')]);router['delete'](_0x4136('0x28'),auth[_0x4136('0x7')](),controller[_0x4136('0x61')]);router['delete'](_0x4136('0x2a'),auth[_0x4136('0x7')](),controller[_0x4136('0x62')]);router[_0x4136('0x58')](_0x4136('0x2c'),auth['isAuthenticated'](),controller[_0x4136('0x63')]);router[_0x4136('0x58')]('/:id/whatsapp_accounts',auth[_0x4136('0x7')](),controller['removeWhatsappAccounts']);router['delete'](_0x4136('0x31'),auth[_0x4136('0x7')](),controller[_0x4136('0x64')]);module[_0x4136('0x65')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f2e3235..9c3658c 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 _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x4c152e,_0x59a298){var _0x5d2aa4=function(_0x24aba1){while(--_0x24aba1){_0x4c152e['push'](_0x4c152e['shift']());}};_0x5d2aa4(++_0x59a298);}(_0xedd9,0xfc));var _0x9edd=function(_0x338e09,_0x463951){_0x338e09=_0x338e09-0x0;var _0x5e78f2=_0xedd9[_0x338e09];return _0x5e78f2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 47c239c..f1d4150 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 _0x7b66=['$ne','$eq','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$any','CmHopper','firstName','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','flatten','lower','col','desc','asc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','role','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','find','name','UserProfileResource','index','User','rawAttributes','fieldName','type','filter','salt','getOptions','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','rows','true','length','dataValues','sms','fax','mail','whatsapp','all','show','params','model','password','keys','intersection','fields','options','openchannel','body','describe','addContacts','ids','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','SELECT','from','mailbox','fullname','email','permissions','101','102','103','110','104','106','107','108','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','userProfileId','VoiceMail','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','autoAssociation','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','SIP/%s','UserVoiceQueueRt','upsert','Queue:remove','addAvatar','file','filename','join','root','userpic','download','existsSync','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','filters','order','sort','where','pick','merge','getContacts','hasOwnProperty','CmList','List','Tags','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','format','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','bulkCreate','isMiddleware','logout','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','flattenDeep','getLists','getAgents','send','omit','removeChatInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gt','$gte','$lt','$lte'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x7b66,0x1c0));var _0x67b6=function(_0x314f2b,_0xf57864){_0x314f2b=_0x314f2b-0x0;var _0x532905=_0x7b66[_0x314f2b];return _0x532905;};'use strict';var moment=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var path=require(_0x67b6('0x2'));var fs=require('fs');var _=require(_0x67b6('0x3'));var squel=require(_0x67b6('0x4'));var jayson=require(_0x67b6('0x5'));var Redis=require(_0x67b6('0x6'));var authService=require(_0x67b6('0x7'));var qs=require(_0x67b6('0x8'));var logger=require('../../config/logger')(_0x67b6('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67b6('0xa'));var APIBadRequestError=require(_0x67b6('0xb'))[_0x67b6('0xc')];var APINotFoundError=require(_0x67b6('0xb'))['APINotFoundError'];var APIHandleError=require(_0x67b6('0xb'))[_0x67b6('0xd')];var db=require(_0x67b6('0xe'))['db'];var socket=require(_0x67b6('0xf'))(new Redis(config[_0x67b6('0x10')]));require(_0x67b6('0x11'))[_0x67b6('0x12')](socket);config['redis']=_[_0x67b6('0x13')](config[_0x67b6('0x10')],{'host':_0x67b6('0x14'),'port':0x18eb});var amiClient=jayson[_0x67b6('0x15')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x350071,_0x2f55af,_0x547a9f,_0x3d4aeb){return new Promise(function(_0x21f1dd,_0x2a62f4){var _0x57bf5d=_0x3d4aeb||amiClient;return _0x57bf5d[_0x67b6('0x16')](_0x350071,_0x547a9f)[_0x67b6('0x17')](function(_0x42ae8a){logger[_0x67b6('0x18')](_0x67b6('0x19'),_0x2f55af,'request\x20sent');logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x2f55af,_0x67b6('0x1a'),JSON[_0x67b6('0x1b')](_0x42ae8a));if(_0x42ae8a[_0x67b6('0x1c')]){if(_0x42ae8a[_0x67b6('0x1c')]['code']===0x1f4){logger[_0x67b6('0x1c')]('User,\x20%s,\x20%s',_0x2f55af,_0x42ae8a[_0x67b6('0x1c')][_0x67b6('0x1d')]);return _0x2a62f4(_0x42ae8a[_0x67b6('0x1c')]['message']);}logger[_0x67b6('0x1c')](_0x67b6('0x19'),_0x2f55af,_0x42ae8a[_0x67b6('0x1c')]['message']);return _0x21f1dd(_0x42ae8a[_0x67b6('0x1c')]['message']);}else{logger['info'](_0x67b6('0x19'),_0x2f55af,'request\x20sent');_0x21f1dd(_0x42ae8a[_0x67b6('0x1e')]['message']);}})[_0x67b6('0x1f')](function(_0x53abd8){logger[_0x67b6('0x1c')](_0x67b6('0x19'),_0x2f55af,_0x53abd8);_0x2a62f4(_0x53abd8);});});}function respondWithStatusCode(_0x5d5679,_0x5cef93){_0x5cef93=_0x5cef93||0xcc;return function(_0x302b8d){if(_0x302b8d){return _0x5d5679[_0x67b6('0x20')](_0x5cef93);}return _0x5d5679[_0x67b6('0x21')](_0x5cef93)[_0x67b6('0x22')]();};}function respondWithResult(_0x102434,_0x302124){_0x302124=_0x302124||0xc8;return function(_0x16330a){if(_0x16330a){return _0x102434[_0x67b6('0x21')](_0x302124)[_0x67b6('0x23')](_0x16330a);}};}function respondWithFilteredResult(_0x24d6a5,_0x3ce488){return function(_0x29d604){if(_0x29d604){var _0x1f1358=typeof _0x3ce488[_0x67b6('0x24')]==='undefined'&&typeof _0x3ce488[_0x67b6('0x25')]===_0x67b6('0x26');var _0x1d046c=_0x29d604[_0x67b6('0x27')];var _0x1d80ab=_0x1f1358?0x0:_0x3ce488['offset'];var _0x4dd3ab=_0x1f1358?_0x29d604[_0x67b6('0x27')]:_0x3ce488[_0x67b6('0x24')]+_0x3ce488[_0x67b6('0x25')];var _0x3c8ff0;if(_0x4dd3ab>=_0x1d046c){_0x4dd3ab=_0x1d046c;_0x3c8ff0=0xc8;}else{_0x3c8ff0=0xce;}_0x24d6a5['status'](_0x3c8ff0);return _0x24d6a5[_0x67b6('0x28')](_0x67b6('0x29'),_0x1d80ab+'-'+_0x4dd3ab+'/'+_0x1d046c)[_0x67b6('0x23')](_0x29d604);}return null;};}function saveUpdates(_0x17bd35){return function(_0x135b9c){if(_0x135b9c){return _0x135b9c[_0x67b6('0x2a')](_0x17bd35)[_0x67b6('0x17')](function(_0x30ca75){if(_0x30ca75[_0x67b6('0x2b')]==='agent'){socket[_0x67b6('0x2c')](_0x67b6('0x2d')+_0x30ca75['id'],_0x30ca75);}return _0x30ca75;});}return null;};}function removeEntity(_0x542fd8){return function(_0x283fa6){if(_0x283fa6){return _0x283fa6[_0x67b6('0x2e')]()[_0x67b6('0x17')](function(){var _0x2b58e8=_0x283fa6[_0x67b6('0x2f')]({'plain':!![]});if(_0x2b58e8[_0x67b6('0x2b')]===_0x67b6('0x30'))return;var _0x411d90=[{'name':_0x67b6('0x31'),'value':_0x67b6('0x32'),'ignore':!![]},{'name':_0x67b6('0x33'),'value':_0x67b6('0x34'),'ignore':![]},{'name':_0x67b6('0x35'),'value':_0x67b6('0x36'),'ignore':![]}];var _0x25f71a=_(_0x411d90)['filter'](_0x67b6('0x37'))[_0x67b6('0x38')](_0x67b6('0x39'))[_0x67b6('0x39')]();if(_[_0x67b6('0x3a')](_0x25f71a,_0x2b58e8[_0x67b6('0x2b')])){return;}var _0x29b943=_[_0x67b6('0x3b')](_0x411d90,[_0x67b6('0x39'),_0x2b58e8['role']])[_0x67b6('0x3c')];return db[_0x67b6('0x3d')][_0x67b6('0x2e')]({'where':{'type':_0x29b943,'resourceId':_0x2b58e8['id']}})[_0x67b6('0x17')](function(){return _0x283fa6;});})[_0x67b6('0x17')](function(){_0x542fd8[_0x67b6('0x21')](0xcc)[_0x67b6('0x22')]();});}};}function handleEntityNotFound(_0x59daa5){return function(_0x5790e3){if(!_0x5790e3){_0x59daa5['sendStatus'](0x194);}return _0x5790e3;};}function handleError(_0x5a8378,_0x9a9983){_0x9a9983=_0x9a9983||0x1f4;return function(_0x1537cb){logger[_0x67b6('0x1c')](_0x1537cb['stack']);if(_0x1537cb[_0x67b6('0x3c')]){delete _0x1537cb[_0x67b6('0x3c')];}_0x5a8378[_0x67b6('0x21')](_0x9a9983)['send'](_0x1537cb);};}exports[_0x67b6('0x3e')]=function(_0x690464,_0x1fa2f1){var _0x39dda6={},_0x3a3c8e={'count':0x0,'rows':[]};var _0xc9aa8f=_(db[_0x67b6('0x3f')][_0x67b6('0x40')])[_0x67b6('0x38')](function(_0x9d0270){return{'name':_0x9d0270[_0x67b6('0x41')],'type':_0x9d0270[_0x67b6('0x42')]['key']};})[_0x67b6('0x43')](function(_0x2577ca){return!_['includes'](['password',_0x67b6('0x44')],_0x2577ca[_0x67b6('0x3c')]);})[_0x67b6('0x39')]();_0x39dda6=qs[_0x67b6('0x45')](_0xc9aa8f,_0x690464);var _0x1ae55c={'where':_0x39dda6['where']};return db[_0x67b6('0x3f')][_0x67b6('0x27')](_0x1ae55c)[_0x67b6('0x17')](function(_0xbd5ca1){_0x3a3c8e[_0x67b6('0x27')]=_0xbd5ca1;if(_0x690464[_0x67b6('0x46')][_0x67b6('0x47')]){_0x39dda6[_0x67b6('0x48')]=[{'all':!![]}];}if(_0x690464[_0x67b6('0x46')][_0x67b6('0x49')]==='true'){_0x39dda6['include']=[{'model':db[_0x67b6('0x4a')],'as':_0x67b6('0x49')}];}if(!_[_0x67b6('0x3a')](_0x39dda6[_0x67b6('0x4b')],'id')){_0x39dda6[_0x67b6('0x4b')][_0x67b6('0x4c')]('id');}return db['User'][_0x67b6('0x4d')](_0x39dda6);})[_0x67b6('0x17')](function(_0x40dca8){_0x3a3c8e[_0x67b6('0x4e')]=_0x40dca8;if(_0x690464['query']['openTabs']===_0x67b6('0x4f')){var _0x4f47f1=[];for(var _0x9795cf=0x0;_0x9795cf<_0x3a3c8e['rows'][_0x67b6('0x50')];_0x9795cf++){_0x4f47f1[_0x67b6('0x4c')](get_open_tabs('chat',_0x3a3c8e[_0x67b6('0x4e')][_0x9795cf][_0x67b6('0x51')]));_0x4f47f1['push'](get_open_tabs(_0x67b6('0x52'),_0x3a3c8e[_0x67b6('0x4e')][_0x9795cf]['dataValues']));_0x4f47f1[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x53'),_0x3a3c8e[_0x67b6('0x4e')][_0x9795cf][_0x67b6('0x51')]));_0x4f47f1[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x54'),_0x3a3c8e[_0x67b6('0x4e')][_0x9795cf][_0x67b6('0x51')]));_0x4f47f1[_0x67b6('0x4c')](get_open_tabs('openchannel',_0x3a3c8e[_0x67b6('0x4e')][_0x9795cf][_0x67b6('0x51')]));_0x4f47f1['push'](get_open_tabs(_0x67b6('0x55'),_0x3a3c8e['rows'][_0x9795cf][_0x67b6('0x51')]));}return Promise[_0x67b6('0x56')](_0x4f47f1)['then'](function(){return _0x3a3c8e;});}else{return _0x3a3c8e;}})['then'](respondWithFilteredResult(_0x1fa2f1,_0x39dda6))[_0x67b6('0x1f')](handleError(_0x1fa2f1,null));};exports[_0x67b6('0x57')]=function(_0x4970ad,_0x2f5284){var _0x4dfc9c={'raw':![],'where':{'id':_0x4970ad[_0x67b6('0x58')]['id']}},_0x5e1bdd={};_0x5e1bdd[_0x67b6('0x59')]=_['differenceBy'](_['keys'](db[_0x67b6('0x3f')][_0x67b6('0x40')]),[_0x67b6('0x5a'),_0x67b6('0x44')]);_0x5e1bdd['query']=_[_0x67b6('0x5b')](_0x4970ad[_0x67b6('0x46')]);_0x5e1bdd['filters']=_[_0x67b6('0x5c')](_0x5e1bdd[_0x67b6('0x59')],_0x5e1bdd['query']);_0x4dfc9c[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x5e1bdd['model'],qs[_0x67b6('0x5d')](_0x4970ad[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x4dfc9c[_0x67b6('0x4b')]=_0x4dfc9c[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x4dfc9c[_0x67b6('0x4b')]:_0x5e1bdd[_0x67b6('0x59')];if(_0x4970ad[_0x67b6('0x46')][_0x67b6('0x47')]){_0x4dfc9c['include']=[{'all':!![]}];}if(_0x4970ad[_0x67b6('0x46')][_0x67b6('0x49')]===_0x67b6('0x4f')){_0x4dfc9c[_0x67b6('0x48')]=[{'model':db[_0x67b6('0x4a')],'as':_0x67b6('0x49')}];}_0x4dfc9c=_['merge']({},_0x4dfc9c,_0x4970ad[_0x67b6('0x5e')]);if(!_[_0x67b6('0x3a')](_0x4dfc9c['attributes'],'id')){_0x4dfc9c[_0x67b6('0x4b')]['push']('id');}return db[_0x67b6('0x3f')][_0x67b6('0x3b')](_0x4dfc9c)[_0x67b6('0x17')](handleEntityNotFound(_0x2f5284,null))[_0x67b6('0x17')](function(_0x49545d){var _0x28be42=[];values=_0x49545d;if(_0x4970ad[_0x67b6('0x46')]['openTabs']==='true'){_0x28be42['push'](get_open_tabs('chat',_0x49545d[_0x67b6('0x51')]));_0x28be42['push'](get_open_tabs(_0x67b6('0x52'),_0x49545d['dataValues']));_0x28be42[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x5f'),_0x49545d[_0x67b6('0x51')]));_0x28be42[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x55'),_0x49545d[_0x67b6('0x51')]));_0x28be42[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x53'),_0x49545d[_0x67b6('0x51')]));_0x28be42[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x54'),_0x49545d['dataValues']));return Promise[_0x67b6('0x56')](_0x28be42);}else{return values;}})[_0x67b6('0x17')](function(){return values;})[_0x67b6('0x17')](respondWithResult(_0x2f5284,null))[_0x67b6('0x1f')](handleError(_0x2f5284,null));};exports[_0x67b6('0x2a')]=function(_0x425b24,_0x35c00a){if(_0x425b24[_0x67b6('0x60')]['id']){delete _0x425b24[_0x67b6('0x60')]['id'];}delete _0x425b24[_0x67b6('0x60')][_0x67b6('0x2b')];return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x425b24[_0x67b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x35c00a,null))[_0x67b6('0x17')](saveUpdates(_0x425b24[_0x67b6('0x60')],null))[_0x67b6('0x17')](respondWithResult(_0x35c00a,null))[_0x67b6('0x1f')](handleError(_0x35c00a,null));};exports[_0x67b6('0x61')]=function(_0x3d5555,_0x3e671b){return db[_0x67b6('0x3f')]['describe']()[_0x67b6('0x17')](respondWithResult(_0x3e671b,null))[_0x67b6('0x1f')](handleError(_0x3e671b,null));};exports[_0x67b6('0x62')]=function(_0x2a0551,_0x4a0b7e){return db['User'][_0x67b6('0x3b')]({'where':{'id':_0x2a0551['params']['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x4a0b7e,null))[_0x67b6('0x17')](function(_0x36100e){if(_0x36100e){return _0x36100e['addContacts'](_0x2a0551['body'][_0x67b6('0x63')],_['omit'](_0x2a0551[_0x67b6('0x60')],[_0x67b6('0x63'),'id'])||{});}})['then'](respondWithResult(_0x4a0b7e,null))[_0x67b6('0x1f')](handleError(_0x4a0b7e,null));};function validateUser(_0xc92353){return new Promise(function(_0x15183b,_0x1dd47a){if(_0xc92353[_0x67b6('0x64')])return _0x15183b(_0xc92353);return db[_0x67b6('0x65')][_0x67b6('0x66')](0x1)[_0x67b6('0x17')](function(_0x4f2c5a){if(_0x4f2c5a['securePassword'])authService[_0x67b6('0x67')](_0xc92353['password']);db[_0x67b6('0x3f')][_0x67b6('0x68')](_0x67b6('0x64'))[_0x67b6('0x17')](function(_0x35f3bc){if(_[_0x67b6('0x69')](_0x35f3bc)){_0xc92353[_0x67b6('0x64')]=_0x4f2c5a[_0x67b6('0x6a')]||0x1;return;}if(_['isNil'](_0x4f2c5a[_0x67b6('0x6a')])||_0x4f2c5a[_0x67b6('0x6a')]===_0x35f3bc){_0xc92353[_0x67b6('0x64')]=_0x35f3bc+0x1;return;}if(_0x4f2c5a[_0x67b6('0x6a')]>_0x35f3bc){_0xc92353[_0x67b6('0x64')]=_0x4f2c5a[_0x67b6('0x6a')];return;}return db[_0x67b6('0x6b')][_0x67b6('0x46')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x67b6('0x6b')]['QueryTypes'][_0x67b6('0x6c')]})[_0x67b6('0x17')](function(_0x246f70){if(_0x246f70&&_0x246f70['length']){for(var _0x194b9e=0x0,_0x50804a=_0x246f70[_0x67b6('0x50')];_0x194b9e<_0x50804a&&_[_0x67b6('0x69')](_0xc92353[_0x67b6('0x64')]);_0x194b9e++){if(_0x4f2c5a['min_internal']<=_0x246f70[_0x194b9e]['from']){_0xc92353[_0x67b6('0x64')]=_0x246f70[_0x194b9e]['from'];}else if(_0x4f2c5a[_0x67b6('0x6a')]>_0x246f70[_0x194b9e][_0x67b6('0x6d')]&&_0x4f2c5a[_0x67b6('0x6a')]<=_0x246f70[_0x194b9e]['to']){_0xc92353[_0x67b6('0x64')]=_0x4f2c5a[_0x67b6('0x6a')];}}}if(_[_0x67b6('0x69')](_0xc92353[_0x67b6('0x64')])){_0xc92353['internal']=_0x35f3bc+0x1;}return _0x15183b(_0xc92353);});});})[_0x67b6('0x1f')](function(_0x5ade5d){_0x1dd47a(_0x5ade5d);});});}function updateUser(_0x3ffe80){return new Promise(function(_0x258b2c,_0x5de49a){try{if(_0x3ffe80['voicemail']){_0x3ffe80[_0x67b6('0x6e')]=_0x3ffe80['internal'];_0x3ffe80['VoiceMail']={'mailbox':_0x3ffe80[_0x67b6('0x64')],'password':_0x3ffe80[_0x67b6('0x5a')],'fullname':_0x3ffe80[_0x67b6('0x6f')],'email':_0x3ffe80[_0x67b6('0x70')]};}if(_0x3ffe80['role']==='agent'){if(!_0x3ffe80['permissions'])_0x3ffe80[_0x67b6('0x71')]=[_0x67b6('0x72'),_0x67b6('0x73'),_0x67b6('0x74'),'113',_0x67b6('0x75'),_0x67b6('0x76'),'105',_0x67b6('0x77'),_0x67b6('0x78'),_0x67b6('0x79'),'109','100','111',_0x67b6('0x7a'),_0x67b6('0x7b')];}_0x258b2c(_0x3ffe80);}catch(_0x42ceba){_0x5de49a(_0x42ceba);}});}exports[_0x67b6('0x7c')]=function(_0x353409,_0x22fdcd){if(_0x353409[_0x67b6('0x32')][_0x67b6('0x2b')]===_0x67b6('0x34'))throw new Error(_0x67b6('0x7d'));if(_0x353409['body'][_0x67b6('0x2b')]===_0x67b6('0x32')&&_0x353409[_0x67b6('0x32')][_0x67b6('0x2b')]!==_0x67b6('0x30')){throw new Error(_0x67b6('0x7e'));}if(_0x353409[_0x67b6('0x60')][_0x67b6('0x2b')]===_0x67b6('0x30')&&_0x353409[_0x67b6('0x32')][_0x67b6('0x2b')]!==_0x67b6('0x30')){throw new Error(_0x67b6('0x7f'));}return licenseUtil[_0x67b6('0x80')]([_0x353409['body']])[_0x67b6('0x17')](function(){return validateUser(_0x353409['body']);})[_0x67b6('0x17')](function(_0x33d5f3){return updateUser(_0x33d5f3)[_0x67b6('0x17')](function(_0x1a2785){if(_0x1a2785[_0x67b6('0x2b')]===_0x67b6('0x30')){_0x1a2785[_0x67b6('0x81')]=_0x353409[_0x67b6('0x32')][_0x67b6('0x81')];delete _0x1a2785[_0x67b6('0x82')];}return _0x1a2785;});})[_0x67b6('0x17')](function(_0x3d33d7){return db[_0x67b6('0x3f')]['create'](_0x3d33d7,{'include':[{'model':db[_0x67b6('0x83')],'as':_0x67b6('0x83')}]});})['then'](function(_0xaf8558){if(_0x353409[_0x67b6('0x60')][_0x67b6('0x2b')]==='user')return _0xaf8558;if(_0x353409['user'][_0x67b6('0x2b')]!==_0x67b6('0x32'))return _0xaf8558;return db['UserProfileSection'][_0x67b6('0x3b')]({'where':{'name':_0xaf8558[_0x67b6('0x2b')]===_0x67b6('0x34')?_0x67b6('0x33'):_0x67b6('0x35'),'userProfileId':_0x353409['user']['userProfileId']},'raw':!![]})[_0x67b6('0x17')](function(_0x3ca010){if(!_0x3ca010||_0x3ca010['autoAssociation']!=0x0)return _0xaf8558;return db[_0x67b6('0x3d')][_0x67b6('0x7c')]({'name':_0xaf8558['name'],'resourceId':_0xaf8558['id'],'type':_0x3ca010[_0x67b6('0x3c')],'sectionId':_0x3ca010['id']},{})[_0x67b6('0x17')](function(){return _0xaf8558;});})[_0x67b6('0x1f')](function(_0x1f31b2){logger['error'](_0x67b6('0x84'),_0x1f31b2);throw _0x1f31b2;});})['then'](respondWithResult(_0x22fdcd,0xc9))[_0x67b6('0x1f')](handleError(_0x22fdcd,null));};exports['bulkCreate']=function(_0x30489a,_0x259193){var _0x45f53e=_0x30489a[_0x67b6('0x60')];var _0x540a48=[];if(_0x30489a[_0x67b6('0x32')][_0x67b6('0x2b')]===_0x67b6('0x34'))throw new Error(_0x67b6('0x7d'));if(_[_0x67b6('0x85')](_0x45f53e,['role','user'])&&_0x30489a[_0x67b6('0x32')][_0x67b6('0x2b')]!==_0x67b6('0x30')){throw new Error(_0x67b6('0x7e'));}if(_[_0x67b6('0x85')](_0x45f53e,[_0x67b6('0x2b'),_0x67b6('0x30')])&&_0x30489a[_0x67b6('0x32')]['role']!==_0x67b6('0x30')){throw new Error(_0x67b6('0x86'));}return licenseUtil[_0x67b6('0x80')](_0x45f53e)[_0x67b6('0x17')](function(){return validateUser(_0x45f53e[0x0]);})[_0x67b6('0x17')](function(){for(var _0x3ec9be=0x1;_0x3ec9be<_0x45f53e[_0x67b6('0x50')];_0x3ec9be++){var _0x5be895=_0x45f53e[_0x3ec9be-0x1][_0x67b6('0x64')];if(!_0x45f53e[_0x3ec9be][_0x67b6('0x64')])_0x45f53e[_0x3ec9be][_0x67b6('0x64')]=_0x5be895+0x1;_0x540a48[_0x67b6('0x4c')](validateUser(_0x45f53e[_0x3ec9be]));}return Promise['all'](_0x540a48);})[_0x67b6('0x17')](function(){_0x540a48=[];for(var _0xcc1faf=0x0;_0xcc1faf<_0x45f53e['length'];_0xcc1faf++){_0x540a48['push'](updateUser(_0x45f53e[_0xcc1faf]));}return Promise['all'](_0x540a48);})[_0x67b6('0x17')](function(){_0x540a48=_0x45f53e['map'](function(_0x10496c){return db['User'][_0x67b6('0x7c')](_0x10496c,{'include':[{'model':db[_0x67b6('0x83')],'as':_0x67b6('0x83')}]})[_0x67b6('0x17')](function(_0x982e80){_0x10496c['id']=_0x982e80['id'];return _0x10496c;});});return Promise[_0x67b6('0x56')](_0x540a48);})[_0x67b6('0x17')](function(_0x1f3eda){if(_0x30489a[_0x67b6('0x60')]['role']===_0x67b6('0x32'))return _0x1f3eda;if(_0x30489a[_0x67b6('0x32')][_0x67b6('0x2b')]!==_0x67b6('0x32'))return _0x1f3eda;var _0x2dcf3a=_['some'](_0x1f3eda,function(_0xab75b2){return _0xab75b2['role']===_0x67b6('0x34')||_0xab75b2[_0x67b6('0x2b')]===_0x67b6('0x36');});if(!_0x2dcf3a)return _0x1f3eda;return db[_0x67b6('0x87')]['findAll']({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x30489a[_0x67b6('0x32')][_0x67b6('0x82')]},'raw':!![]})[_0x67b6('0x17')](function(_0x45c91d){if(_[_0x67b6('0x88')](_0x45c91d)||!_[_0x67b6('0x85')](_0x45c91d,[_0x67b6('0x89'),0x0]))return _0x1f3eda;_0x540a48=[];var _0x405e43=_(_0x45c91d)[_0x67b6('0x38')](function(_0x5dc776){if(_0x5dc776[_0x67b6('0x89')]===0x1)return;return _0x5dc776[_0x67b6('0x3c')]===_0x67b6('0x33')?'agent':_0x67b6('0x36');})[_0x67b6('0x8a')]()[_0x67b6('0x39')]();for(var _0x5e97ce=0x0;_0x5e97ce<_0x1f3eda[_0x67b6('0x50')];_0x5e97ce++){if(!_[_0x67b6('0x3a')](_0x405e43,_0x1f3eda[_0x5e97ce][_0x67b6('0x2b')]))return;var _0x218271=_0x1f3eda[_0x5e97ce][_0x67b6('0x2b')]==='agent'?_0x67b6('0x33'):_0x67b6('0x35');_0x540a48[_0x67b6('0x4c')](db[_0x67b6('0x3d')][_0x67b6('0x7c')]({'name':_0x1f3eda[_0x5e97ce][_0x67b6('0x3c')],'resourceId':_0x1f3eda[_0x5e97ce]['id'],'type':_0x218271,'sectionId':_[_0x67b6('0x3b')](_0x45c91d,['name',_0x218271])['id']},{}));}return Promise[_0x67b6('0x56')](_0x540a48);});})[_0x67b6('0x17')](respondWithResult(_0x259193,0xc9))['catch'](handleError(_0x259193,null));};exports[_0x67b6('0x8b')]=function(_0x1acd9e,_0x2adc5c){if(_0x1acd9e[_0x67b6('0x60')]['id']){delete _0x1acd9e[_0x67b6('0x60')]['id'];}return db['User'][_0x67b6('0x3b')]({'where':{'id':_0x1acd9e['params']['id']}})['then'](function(_0x451f43){if(!_0x451f43)return null;if(_0x451f43['id']===_0x1acd9e['user']['id']){if(!_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x8c')]||!_0x1acd9e['body']['newPassword']){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x8f'));}if(!_0x451f43['authenticate'](_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x8c')])){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x90'));}if(_0x1acd9e['body'][_0x67b6('0x8c')]===_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x91')]){throw new db[(_0x67b6('0x8d'))]['ValidationError'](_0x67b6('0x92'));}}else if(_0x1acd9e['user']['role']===_0x67b6('0x30')){if(!_0x1acd9e[_0x67b6('0x60')]['newPassword']){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x93'));}}else if(_0x1acd9e['user'][_0x67b6('0x2b')]==='user'){if(!_0x1acd9e['body'][_0x67b6('0x91')]){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x93'));}if(_0x451f43[_0x67b6('0x2b')]!==_0x67b6('0x34')){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x7d'));}}else{throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))](_0x67b6('0x7d'));}return _0x451f43;})[_0x67b6('0x17')](handleEntityNotFound(_0x2adc5c,null))[_0x67b6('0x17')](function(_0xaa391b){return db['Setting'][_0x67b6('0x94')]({'attributes':['id',_0x67b6('0x95'),_0x67b6('0x96'),'passwordHistoryLimit']})['then'](function(_0x1dcd10){if(_0x1dcd10[_0x67b6('0x95')])authService['validatePasswordPattern'](_0x1acd9e['body'][_0x67b6('0x91')]);if(!_0x1dcd10['enforcePasswordHistory']||!_0xaa391b[_0x67b6('0x97')])return _0xaa391b;authService[_0x67b6('0x98')](_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x91')],_0xaa391b[_0x67b6('0x97')],_0x1dcd10[_0x67b6('0x99')]);return _0xaa391b;})[_0x67b6('0x17')](saveUpdates({'password':_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x91')],'passwordResetAt':_0x1acd9e[_0x67b6('0x32')]['id']==_0x1acd9e[_0x67b6('0x58')]['id']?moment():null,'previousPasswords':authService[_0x67b6('0x9a')](_0x1acd9e[_0x67b6('0x60')][_0x67b6('0x91')],_0xaa391b['previousPasswords'])},null));})[_0x67b6('0x17')](respondWithResult(_0x2adc5c,null))['catch'](handleError(_0x2adc5c,null));};exports[_0x67b6('0x9b')]=function(_0x5ccfd2,_0x158be4){var _0x1b3712=_0x5ccfd2[_0x67b6('0x60')][_0x67b6('0x9c')];return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x5ccfd2[_0x67b6('0x58')]['id']},'attributes':['id','name',_0x67b6('0x2b'),_0x67b6('0x9d'),_0x67b6('0x9e'),_0x67b6('0x9f'),_0x67b6('0xa0')]})[_0x67b6('0x17')](handleEntityNotFound(_0x158be4,null))[_0x67b6('0x17')](function(_0x496aba){if(_0x496aba){if(!utils[_0x67b6('0xa1')](_0x1b3712)){throw new db[(_0x67b6('0x8d'))]['ValidationError'](_0x67b6('0xa2'));}return _0x496aba[_0x67b6('0xa3')+_[_0x67b6('0xa4')](_0x1b3712[_0x67b6('0xa5')]())+_0x67b6('0xa6')](_0x5ccfd2['body'][_0x67b6('0x63')],{'penalty':_0x5ccfd2[_0x67b6('0x60')][_0x67b6('0xa7')]||0x0})[_0x67b6('0xa8')](function(_0x182112){for(var _0x115df1=0x0;_0x115df1<_0x5ccfd2[_0x67b6('0x60')][_0x67b6('0x63')][_0x67b6('0x50')];_0x115df1+=0x1){var _0x1d9ef6={'UserId':Number(_0x5ccfd2['params']['id'])};_0x1d9ef6[_[_0x67b6('0xa4')](_0x1b3712[_0x67b6('0xa5')]())+_0x67b6('0xa9')]=Number(_0x5ccfd2[_0x67b6('0x60')][_0x67b6('0x63')][_0x115df1]);socket['emit'](_0x67b6('0x32')+_[_0x67b6('0xa4')](_0x1b3712[_0x67b6('0xa5')]())+_0x67b6('0xaa'),_0x1d9ef6);}return _0x182112;})[_0x67b6('0x17')](function(){if(_0x1b3712===_0x67b6('0xab')){return db[_0x67b6('0xac')][_0x67b6('0x4d')]({'where':{'id':_0x5ccfd2['body'][_0x67b6('0x63')]||[]},'raw':!![],'attributes':['id',_0x67b6('0x3c')]});}})['then'](function(_0x3d02e7){var _0x3905df=_0x496aba['get']({'plain':!![]});var _0x54ad4a=[];if(_0x1b3712===_0x67b6('0xab')&&_0x3905df[_0x67b6('0x2b')]===_0x67b6('0x34')&&_0x3905df[_0x67b6('0x9d')]){for(let _0x5eccb3=0x0;_0x5eccb3<_0x3d02e7[_0x67b6('0x50')];_0x5eccb3+=0x1){_0x54ad4a[_0x67b6('0x4c')]({'membername':_0x3905df[_0x67b6('0x3c')],'UserId':_0x3905df['id'],'queue_name':_0x3d02e7[_0x5eccb3][_0x67b6('0x3c')],'VoiceQueueId':_0x3d02e7[_0x5eccb3]['id'],'interface':_[_0x67b6('0x69')](_0x3905df[_0x67b6('0xa0')])?util['format'](_0x67b6('0xad'),_0x3905df[_0x67b6('0x3c')]):_0x3905df[_0x67b6('0xa0')],'paused':_0x3905df[_0x67b6('0x9f')]||![],'penalty':_0x5ccfd2[_0x67b6('0x60')][_0x67b6('0xa7')]||0x0});}return Promise[_0x67b6('0x56')](_0x54ad4a['map'](function(_0x314648){return db[_0x67b6('0xae')][_0x67b6('0xaf')](_0x314648);}));}return _0x496aba;});}})[_0x67b6('0x17')](respondWithStatusCode(_0x158be4,null))[_0x67b6('0x1f')](handleError(_0x158be4,null));};exports['removeQueues']=function(_0x244b4b,_0xf110e3){var _0xf1b166,_0x534aca;return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x244b4b[_0x67b6('0x58')]['id']},'attributes':['id',_0x67b6('0x3c'),'role']})[_0x67b6('0x17')](handleEntityNotFound(_0xf110e3,null))[_0x67b6('0x17')](function(_0x46fe23){if(_0x46fe23){_0xf1b166=_0x46fe23;if(!_0x244b4b['query']['channel']||!utils[_0x67b6('0xa1')](_0x244b4b[_0x67b6('0x46')]['channel'])){throw new db[(_0x67b6('0x8d'))][(_0x67b6('0x8e'))]('Unknown\x20channel');}return _0x46fe23['remove'+_[_0x67b6('0xa4')](_0x244b4b[_0x67b6('0x46')][_0x67b6('0x9c')][_0x67b6('0xa5')]())+'Queues'](_0x244b4b[_0x67b6('0x46')][_0x67b6('0x63')]);}})[_0x67b6('0x17')](function(_0x1b9263){if(_['isArray'](_0x244b4b[_0x67b6('0x46')][_0x67b6('0x63')])){for(var _0x2a1eab=0x0;_0x2a1eab<_0x244b4b['query'][_0x67b6('0x63')][_0x67b6('0x50')];_0x2a1eab+=0x1){_0x534aca={'UserId':Number(_0x244b4b[_0x67b6('0x58')]['id'])};_0x534aca[_[_0x67b6('0xa4')](_0x244b4b[_0x67b6('0x46')]['channel'][_0x67b6('0xa5')]())+_0x67b6('0xa9')]=Number(_0x244b4b[_0x67b6('0x46')]['ids'][_0x2a1eab]);socket[_0x67b6('0x2c')](_0x67b6('0x32')+_[_0x67b6('0xa4')](_0x244b4b['query']['channel'][_0x67b6('0xa5')]())+_0x67b6('0xb0'),_0x534aca);}}else{_0x534aca={'UserId':Number(_0x244b4b[_0x67b6('0x58')]['id'])};_0x534aca[_[_0x67b6('0xa4')](_0x244b4b[_0x67b6('0x46')][_0x67b6('0x9c')][_0x67b6('0xa5')]())+_0x67b6('0xa9')]=Number(_0x244b4b['query'][_0x67b6('0x63')]);socket[_0x67b6('0x2c')]('user'+_[_0x67b6('0xa4')](_0x244b4b[_0x67b6('0x46')][_0x67b6('0x9c')][_0x67b6('0xa5')]())+_0x67b6('0xb0'),_0x534aca);}return _0x1b9263;})[_0x67b6('0x17')](function(){if(_0x244b4b[_0x67b6('0x46')]['channel']==='voice'){return db[_0x67b6('0xae')][_0x67b6('0x2e')]({'where':{'UserId':_0x244b4b[_0x67b6('0x58')]['id'],'VoiceQueueId':_0x244b4b[_0x67b6('0x46')][_0x67b6('0x63')]},'individualHooks':!![]})[_0x67b6('0x17')](function(){return _0xf1b166;});}return _0xf1b166;})[_0x67b6('0x17')](respondWithStatusCode(_0xf110e3,null))[_0x67b6('0x1f')](handleError(_0xf110e3,null));};exports[_0x67b6('0xb1')]=function(_0x2103ce,_0x27c55d){_0x2103ce['body']['userpic']=_0x2103ce[_0x67b6('0xb2')][_0x67b6('0xb3')];return db['User'][_0x67b6('0x3b')]({'where':{'id':_0x2103ce[_0x67b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x27c55d,null))[_0x67b6('0x17')](saveUpdates(_0x2103ce['body'],null))[_0x67b6('0x17')](respondWithResult(_0x27c55d,null))[_0x67b6('0x1f')](handleError(_0x27c55d,null));};exports['getAvatar']=function(_0x4173fe,_0x2ea798){var _0x20f034=path[_0x67b6('0xb4')](config[_0x67b6('0xb5')],'server/files/images/logos/default_profile.png');return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x4173fe['params']['id']},'attributes':['id',_0x67b6('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x2ea798,null))[_0x67b6('0x17')](function(_0x24731c){if(_0x24731c){if(_[_0x67b6('0x69')](_0x24731c[_0x67b6('0xb6')])){return _0x2ea798[_0x67b6('0xb7')](_0x20f034);}else{if(!fs[_0x67b6('0xb8')](path[_0x67b6('0xb4')](config['root'],'server/files/images/',_0x24731c['userpic']))){return _0x2ea798['download'](_0x20f034);}return _0x2ea798[_0x67b6('0xb7')](path[_0x67b6('0xb4')](config[_0x67b6('0xb5')],'server/files/images/',_0x24731c[_0x67b6('0xb6')]));}}})['catch'](handleError(_0x2ea798,null));};exports[_0x67b6('0xb9')]=function(_0x5381cc,_0x879688){return db['User'][_0x67b6('0x3b')]({'where':{'id':_0x5381cc[_0x67b6('0x58')]['id']},'attributes':['id']})[_0x67b6('0x17')](handleEntityNotFound(_0x879688,null))[_0x67b6('0x17')](function(_0x5b3c78){var _0x2576b6=[];values=_0x5b3c78[_0x67b6('0x51')];_0x2576b6[_0x67b6('0x4c')](get_open_tabs('chat',_0x5b3c78['dataValues']));_0x2576b6[_0x67b6('0x4c')](get_open_tabs('sms',_0x5b3c78['dataValues']));_0x2576b6[_0x67b6('0x4c')](get_open_tabs('openchannel',_0x5b3c78[_0x67b6('0x51')]));_0x2576b6['push'](get_open_tabs(_0x67b6('0x55'),_0x5b3c78[_0x67b6('0x51')]));_0x2576b6[_0x67b6('0x4c')](get_open_tabs(_0x67b6('0x53'),_0x5b3c78['dataValues']));_0x2576b6['push'](get_open_tabs('mail',_0x5b3c78[_0x67b6('0x51')]));return Promise[_0x67b6('0x56')](_0x2576b6);})[_0x67b6('0x17')](function(_0x265ea9){if(_0x265ea9){var _0xfbd60=_[_0x67b6('0x38')](values[_0x67b6('0xba')],function(_0x290d71){return{'channel':'CHAT','id':_0x290d71['id'],'createdAt':_0x290d71[_0x67b6('0xbb')]};});var _0x1e5280=_[_0x67b6('0x38')](values[_0x67b6('0xbc')],function(_0x36558d){return{'channel':'FAX','id':_0x36558d['id'],'createdAt':_0x36558d['createdAt']};});var _0x36bfe5=_[_0x67b6('0x38')](values[_0x67b6('0xbd')],function(_0x3e974f){return{'channel':_0x67b6('0xbe'),'id':_0x3e974f['id'],'createdAt':_0x3e974f[_0x67b6('0xbb')]};});var _0x1c2b91=_[_0x67b6('0x38')](values[_0x67b6('0xbf')],function(_0x318472){return{'channel':_0x67b6('0xc0'),'id':_0x318472['id'],'createdAt':_0x318472[_0x67b6('0xbb')]};});var _0x5bf99c=_[_0x67b6('0x38')](values[_0x67b6('0xc1')],function(_0x5a1a82){return{'channel':'SMS','id':_0x5a1a82['id'],'createdAt':_0x5a1a82[_0x67b6('0xbb')]};});var _0x5d76ec=_[_0x67b6('0x38')](values[_0x67b6('0xc2')],function(_0x1e0cba){return{'channel':_0x67b6('0xc3'),'id':_0x1e0cba['id'],'createdAt':_0x1e0cba[_0x67b6('0xbb')]};});var _0x45ad96=_[_0x67b6('0xc4')](_0xfbd60,_0x1e5280,_0x36bfe5,_0x1c2b91,_0x5bf99c,_0x5d76ec);var _0x1d7ecb={'count':_0x45ad96[_0x67b6('0x50')],'rows':_0x45ad96};return _0x1d7ecb;}else return null;})[_0x67b6('0x17')](respondWithResult(_0x879688,null))[_0x67b6('0x1f')](handleError(_0x879688,null));};exports['getContacts']=function(_0x1b9dac,_0x317c5e){var _0x4c646e={};var _0x47348c={};var _0x3d60f3;var _0x54d9b4;return db[_0x67b6('0x3f')]['findOne']({'where':{'id':_0x1b9dac[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x317c5e,null))[_0x67b6('0x17')](function(_0x1a26d3){if(_0x1a26d3){_0x3d60f3=_0x1a26d3;_0x47348c[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db['CmContact'][_0x67b6('0x40')]);_0x47348c[_0x67b6('0x46')]=_[_0x67b6('0x5b')](_0x1b9dac[_0x67b6('0x46')]);_0x47348c[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x47348c[_0x67b6('0x59')],_0x47348c['query']);_0x4c646e[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x47348c[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x1b9dac[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x4c646e[_0x67b6('0x4b')]=_0x4c646e[_0x67b6('0x4b')]['length']?_0x4c646e[_0x67b6('0x4b')]:_0x47348c[_0x67b6('0x59')];_0x4c646e[_0x67b6('0xc6')]=qs['sort'](_0x1b9dac[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x4c646e[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x1b9dac['query'],_0x47348c[_0x67b6('0xc5')]));if(_0x1b9dac['query'][_0x67b6('0x43')]){_0x4c646e[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x4c646e['where'],{'$or':_['map'](_0x4c646e[_0x67b6('0x4b')],function(_0x55e74b){var _0x3ad5b9={};_0x3ad5b9[_0x55e74b]={'$like':'%'+_0x1b9dac[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x3ad5b9;})});}_0x4c646e=_[_0x67b6('0xca')]({},_0x4c646e,_0x1b9dac[_0x67b6('0x5e')]);return _0x3d60f3[_0x67b6('0xcb')](_0x4c646e);}})[_0x67b6('0x17')](function(_0x5b4003){if(_0x5b4003){_0x54d9b4=_0x5b4003['length'];if(_0x1b9dac['query'][_0x67b6('0xcc')](_0x67b6('0x47'))){_0x4c646e[_0x67b6('0x48')]=[{'model':db[_0x67b6('0xcd')],'as':_0x67b6('0xce'),'required':![]},{'model':db['Tag'],'as':_0x67b6('0xcf'),'attributes':['id',_0x67b6('0x3c'),'color'],'where':_0x1b9dac[_0x67b6('0x46')][_0x67b6('0xd0')]?{'id':_0x1b9dac[_0x67b6('0x46')][_0x67b6('0xd0')]}:undefined,'required':_0x1b9dac['query'][_0x67b6('0xd0')]?!![]:![]}];}if(!_0x1b9dac[_0x67b6('0x46')]['hasOwnProperty'](_0x67b6('0xd1'))){_0x4c646e['limit']=qs[_0x67b6('0x25')](_0x1b9dac[_0x67b6('0x46')][_0x67b6('0x25')]);_0x4c646e[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x1b9dac[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x3d60f3[_0x67b6('0xcb')](_0x4c646e);}})[_0x67b6('0x17')](function(_0x3bd5d7){if(_0x3bd5d7){return _0x3bd5d7?{'count':_0x54d9b4,'rows':_0x3bd5d7}:null;}})[_0x67b6('0x17')](respondWithResult(_0x317c5e,null))[_0x67b6('0x1f')](handleError(_0x317c5e,null));};exports[_0x67b6('0xd2')]=function(_0x59f29a,_0x453c34){var _0x119a83;var _0x55e8d3={};var _0x19d5b6;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x59f29a[_0x67b6('0x58')]['id']},'attributes':['id','name',_0x67b6('0x2b')]})[_0x67b6('0x17')](handleEntityNotFound(_0x453c34,null))[_0x67b6('0x17')](function(_0x3cabbe){if(!utils[_0x67b6('0xa1')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x9c')])){throw new db['Sequelize']['ValidationError'](_0x67b6('0xa2'));}_0x119a83=_0x3cabbe;var _0x480af9={};_0x480af9[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_[_0x67b6('0xa4')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x9c')])+_0x67b6('0xd3')][_0x67b6('0x40')]);_0x480af9[_0x67b6('0x46')]=_['keys'](_0x59f29a[_0x67b6('0x46')]);_0x480af9[_0x67b6('0xc5')]=_['intersection'](_0x480af9[_0x67b6('0x59')],_0x480af9[_0x67b6('0x46')]);_0x55e8d3[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x480af9[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x59f29a['query']['fields']));_0x55e8d3[_0x67b6('0x4b')]=_0x55e8d3[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x55e8d3[_0x67b6('0x4b')]:_0x480af9[_0x67b6('0x59')];_0x55e8d3[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x55e8d3[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_['pick'](_0x59f29a[_0x67b6('0x46')],_0x480af9[_0x67b6('0xc5')]));if(_0x59f29a[_0x67b6('0x46')][_0x67b6('0x43')]){_0x55e8d3[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x55e8d3[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x55e8d3[_0x67b6('0x4b')],function(_0x3e66c5){var _0xb8e4b={};_0xb8e4b[_0x3e66c5]={'$like':'%'+_0x59f29a['query']['filter']+'%'};return _0xb8e4b;})});}_0x55e8d3=_[_0x67b6('0xca')]({},_0x55e8d3,_0x59f29a[_0x67b6('0x5e')]);switch(_0x119a83[_0x67b6('0x2b')]){case'admin':return db[_[_0x67b6('0xa4')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x9c')])+_0x67b6('0xd3')][_0x67b6('0x4d')](_0x55e8d3);case _0x67b6('0x32'):case _0x67b6('0x34'):return _0x119a83['get'+_[_0x67b6('0xa4')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x9c')])+_0x67b6('0xa6')](_0x55e8d3);default:throw new db[(_0x67b6('0x8d'))]['ValidationError'](_0x67b6('0xd4'));}})['then'](function(_0x4ed191){_0x19d5b6=_0x4ed191['length'];if(!_0x59f29a[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x55e8d3[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x25')]);_0x55e8d3[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x24')]);}switch(_0x119a83[_0x67b6('0x2b')]){case _0x67b6('0x30'):return db[_[_0x67b6('0xa4')](_0x59f29a[_0x67b6('0x46')][_0x67b6('0x9c')])+_0x67b6('0xd3')][_0x67b6('0x4d')](_0x55e8d3);case _0x67b6('0x32'):case'agent':return _0x119a83[_0x67b6('0x2f')+_['capitalize'](_0x59f29a['query']['channel'])+_0x67b6('0xa6')](_0x55e8d3);}})['then'](function(_0x6899c5){return{'count':_0x19d5b6,'rows':_0x6899c5};})['then'](respondWithResult(_0x453c34,null))['catch'](handleError(_0x453c34,null));};exports[_0x67b6('0xd5')]=function(_0xe503bc,_0x316684){var _0xf21215={};var _0x3c3242={};var _0x575151;var _0x3c32d6;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0xe503bc[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x316684,null))[_0x67b6('0x17')](function(_0x7f3ff5){if(_0x7f3ff5){_0x575151=_0x7f3ff5;_0x3c3242[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0xae')]['rawAttributes']);_0x3c3242[_0x67b6('0x46')]=_[_0x67b6('0x5b')](_0xe503bc[_0x67b6('0x46')]);_0x3c3242['filters']=_[_0x67b6('0x5c')](_0x3c3242[_0x67b6('0x59')],_0x3c3242[_0x67b6('0x46')]);_0xf21215[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x3c3242[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0xe503bc[_0x67b6('0x46')][_0x67b6('0x5d')]));_0xf21215['attributes']=_0xf21215[_0x67b6('0x4b')][_0x67b6('0x50')]?_0xf21215[_0x67b6('0x4b')]:_0x3c3242['model'];_0xf21215[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0xe503bc[_0x67b6('0x46')][_0x67b6('0xc7')]);_0xf21215[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0xe503bc[_0x67b6('0x46')],_0x3c3242[_0x67b6('0xc5')]));if(_0xe503bc[_0x67b6('0x46')][_0x67b6('0x43')]){_0xf21215[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0xf21215[_0x67b6('0xc8')],{'$or':_['map'](_0xf21215[_0x67b6('0x4b')],function(_0x3d4173){var _0x3a3d76={};_0x3a3d76[_0x3d4173]={'$like':'%'+_0xe503bc[_0x67b6('0x46')]['filter']+'%'};return _0x3a3d76;})});}_0xf21215=_[_0x67b6('0xca')]({},_0xf21215,_0xe503bc[_0x67b6('0x5e')]);return _0x575151[_0x67b6('0xd5')](_0xf21215);}})[_0x67b6('0x17')](function(_0x5dace6){if(_0x5dace6){_0x3c32d6=_0x5dace6['length'];if(!_0xe503bc[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0xf21215[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0xe503bc[_0x67b6('0x46')][_0x67b6('0x25')]);_0xf21215[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0xe503bc[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x575151[_0x67b6('0xd5')](_0xf21215);}})['then'](function(_0x2abba6){if(_0x2abba6){return _0x2abba6?{'count':_0x3c32d6,'rows':_0x2abba6}:null;}})[_0x67b6('0x17')](respondWithResult(_0x316684,null))[_0x67b6('0x1f')](handleError(_0x316684,null));};exports[_0x67b6('0xd6')]=function(_0x57d042,_0x1f722c){var _0xd58bcf={};var _0x2da13d={};var _0x2ba0ba;var _0x40b664;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x57d042[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x1f722c,null))['then'](function(_0x38ac93){if(_0x38ac93){_0x2ba0ba=_0x38ac93;_0x2da13d[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0xd7')]['rawAttributes']);_0x2da13d['query']=_[_0x67b6('0x5b')](_0x57d042[_0x67b6('0x46')]);_0x2da13d[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x2da13d[_0x67b6('0x59')],_0x2da13d[_0x67b6('0x46')]);_0xd58bcf[_0x67b6('0x4b')]=_['intersection'](_0x2da13d['model'],qs[_0x67b6('0x5d')](_0x57d042['query'][_0x67b6('0x5d')]));_0xd58bcf[_0x67b6('0x4b')]=_0xd58bcf['attributes'][_0x67b6('0x50')]?_0xd58bcf[_0x67b6('0x4b')]:_0x2da13d[_0x67b6('0x59')];_0xd58bcf[_0x67b6('0xc6')]=qs['sort'](_0x57d042[_0x67b6('0x46')]['sort']);_0xd58bcf[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x57d042['query'],_0x2da13d[_0x67b6('0xc5')]));if(_0x57d042[_0x67b6('0x46')]['filter']){_0xd58bcf[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0xd58bcf['where'],{'$or':_[_0x67b6('0x38')](_0xd58bcf[_0x67b6('0x4b')],function(_0x465d60){var _0x979bea={};_0x979bea[_0x465d60]={'$like':'%'+_0x57d042[_0x67b6('0x46')]['filter']+'%'};return _0x979bea;})});}_0xd58bcf=_[_0x67b6('0xca')]({},_0xd58bcf,_0x57d042['options']);return _0x2ba0ba[_0x67b6('0xd6')](_0xd58bcf);}})[_0x67b6('0x17')](function(_0x29d07f){if(_0x29d07f){_0x40b664=_0x29d07f[_0x67b6('0x50')];if(!_0x57d042[_0x67b6('0x46')]['hasOwnProperty'](_0x67b6('0xd1'))){_0xd58bcf[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x57d042[_0x67b6('0x46')][_0x67b6('0x25')]);_0xd58bcf[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x57d042[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x2ba0ba[_0x67b6('0xd6')](_0xd58bcf);}})[_0x67b6('0x17')](function(_0x25225c){if(_0x25225c){return _0x25225c?{'count':_0x40b664,'rows':_0x25225c}:null;}})[_0x67b6('0x17')](respondWithResult(_0x1f722c,null))[_0x67b6('0x1f')](handleError(_0x1f722c,null));};exports[_0x67b6('0xd8')]=function(_0xe05c85,_0xb1797d){var _0x262d11={'raw':!![],'where':{}};var _0x20e6af={};var _0xf02622={'count':0x0,'rows':[]};return db['User'][_0x67b6('0x94')]({'where':{'id':_0xe05c85['params']['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0xb1797d,null))[_0x67b6('0x17')](function(_0x250c28){if(_0x250c28){_0x20e6af[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0xd9')][_0x67b6('0x40')]);_0x20e6af[_0x67b6('0x46')]=_[_0x67b6('0x5b')](_0xe05c85[_0x67b6('0x46')]);_0x20e6af['filters']=_[_0x67b6('0x5c')](_0x20e6af[_0x67b6('0x59')],_0x20e6af[_0x67b6('0x46')]);_0x262d11[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x20e6af['model'],qs[_0x67b6('0x5d')](_0xe05c85[_0x67b6('0x46')]['fields']));_0x262d11[_0x67b6('0x4b')]=_0x262d11[_0x67b6('0x4b')]['length']?_0x262d11['attributes']:_0x20e6af[_0x67b6('0x59')];if(!_0xe05c85[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x262d11[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0xe05c85[_0x67b6('0x46')][_0x67b6('0x25')]);_0x262d11[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0xe05c85[_0x67b6('0x46')]['offset']);}_0x262d11[_0x67b6('0xc6')]=qs['sort'](_0xe05c85['query'][_0x67b6('0xc7')]);_0x262d11[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0xe05c85[_0x67b6('0x46')],_0x20e6af[_0x67b6('0xc5')]));_0x262d11[_0x67b6('0xc8')][_0x67b6('0xda')]=_0x250c28['id'];if(_0xe05c85['query']['filter']){_0x262d11[_0x67b6('0xc8')]=_['merge'](_0x262d11['where'],{'$or':_[_0x67b6('0x38')](_0x262d11['attributes'],function(_0x47a69b){var _0x4adb1d={};_0x4adb1d[_0x47a69b]={'$like':'%'+_0xe05c85[_0x67b6('0x46')]['filter']+'%'};return _0x4adb1d;})});}_0x262d11=_[_0x67b6('0xca')]({},_0x262d11,_0xe05c85[_0x67b6('0x5e')]);return db['VoiceRecording'][_0x67b6('0x27')]({'where':_0x262d11[_0x67b6('0xc8')]})[_0x67b6('0x17')](function(_0x5abe9){_0xf02622[_0x67b6('0x27')]=_0x5abe9;if(_0xe05c85[_0x67b6('0x46')][_0x67b6('0x47')]){_0x262d11[_0x67b6('0x48')]=[{'all':!![]}];}return db[_0x67b6('0xd9')][_0x67b6('0x4d')](_0x262d11);})[_0x67b6('0x17')](function(_0x536eef){_0xf02622[_0x67b6('0x4e')]=_0x536eef;return _0xf02622;});}})[_0x67b6('0x17')](respondWithFilteredResult(_0xb1797d,_0x262d11))['catch'](handleError(_0xb1797d,null));};exports[_0x67b6('0xdb')]=function(_0x45c237,_0x128930){var _0x553da7={'raw':!![],'where':{}};var _0x23a271={};var _0x51f042={'count':0x0,'rows':[]};return db['User'][_0x67b6('0x94')]({'where':{'id':_0x45c237[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x128930,null))[_0x67b6('0x17')](function(_0x2d2117){if(_0x2d2117){_0x23a271['model']=_[_0x67b6('0x5b')](db['ScreenRecording'][_0x67b6('0x40')]);_0x23a271[_0x67b6('0x46')]=_['keys'](_0x45c237[_0x67b6('0x46')]);_0x23a271[_0x67b6('0xc5')]=_['intersection'](_0x23a271[_0x67b6('0x59')],_0x23a271['query']);_0x553da7[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x23a271[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x45c237['query'][_0x67b6('0x5d')]));_0x553da7['attributes']=_0x553da7[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x553da7[_0x67b6('0x4b')]:_0x23a271['model'];if(!_0x45c237[_0x67b6('0x46')][_0x67b6('0xcc')]('nolimit')){_0x553da7['limit']=qs['limit'](_0x45c237[_0x67b6('0x46')][_0x67b6('0x25')]);_0x553da7[_0x67b6('0x24')]=qs['offset'](_0x45c237[_0x67b6('0x46')][_0x67b6('0x24')]);}_0x553da7[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x45c237['query'][_0x67b6('0xc7')]);_0x553da7[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x45c237[_0x67b6('0x46')],_0x23a271[_0x67b6('0xc5')]));_0x553da7[_0x67b6('0xc8')][_0x67b6('0xda')]=_0x2d2117['id'];if(_0x45c237['query'][_0x67b6('0x43')]){_0x553da7[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x553da7[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x553da7[_0x67b6('0x4b')],function(_0x11691e){var _0x1a43c0={};_0x1a43c0[_0x11691e]={'$like':'%'+_0x45c237[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x1a43c0;})});}_0x553da7=_[_0x67b6('0xca')]({},_0x553da7,_0x45c237['options']);return db['ScreenRecording']['count']({'where':_0x553da7[_0x67b6('0xc8')]})[_0x67b6('0x17')](function(_0x49b2d){_0x51f042[_0x67b6('0x27')]=_0x49b2d;if(_0x45c237[_0x67b6('0x46')][_0x67b6('0x47')]){_0x553da7[_0x67b6('0x48')]=[{'all':!![]}];}return db[_0x67b6('0xdc')][_0x67b6('0x4d')](_0x553da7);})['then'](function(_0x5e77cc){_0x51f042[_0x67b6('0x4e')]=_0x5e77cc;return _0x51f042;});}})[_0x67b6('0x17')](respondWithFilteredResult(_0x128930,_0x553da7))['catch'](handleError(_0x128930,null));};exports[_0x67b6('0xdd')]=function(_0x37869a,_0x287fe5){var _0x1156bc={};var _0x50b186={};var _0x5e3c88;var _0x4e7f93;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x37869a[_0x67b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x287fe5,null))[_0x67b6('0x17')](function(_0x43144f){if(_0x43144f){_0x5e3c88=_0x43144f;_0x50b186[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db['ChatInteraction'][_0x67b6('0x40')]);_0x50b186['query']=_[_0x67b6('0x5b')](_0x37869a[_0x67b6('0x46')]);_0x50b186[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x50b186[_0x67b6('0x59')],_0x50b186[_0x67b6('0x46')]);_0x1156bc[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x50b186[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x37869a[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x1156bc[_0x67b6('0x4b')]=_0x1156bc['attributes'][_0x67b6('0x50')]?_0x1156bc['attributes']:_0x50b186[_0x67b6('0x59')];_0x1156bc[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x37869a[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x1156bc[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x37869a[_0x67b6('0x46')],_0x50b186[_0x67b6('0xc5')]));if(_0x37869a[_0x67b6('0x46')]['filter']){_0x1156bc['where']=_[_0x67b6('0xca')](_0x1156bc[_0x67b6('0xc8')],{'$or':_['map'](_0x1156bc['attributes'],function(_0x803c95){var _0x19e88f={};_0x19e88f[_0x803c95]={'$like':'%'+_0x37869a[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x19e88f;})});}_0x1156bc=_[_0x67b6('0xca')]({},_0x1156bc,_0x37869a[_0x67b6('0x5e')]);return _0x5e3c88[_0x67b6('0xdd')](_0x1156bc);}})[_0x67b6('0x17')](function(_0x518fe7){if(_0x518fe7){_0x4e7f93=_0x518fe7[_0x67b6('0x50')];if(!_0x37869a['query'][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x1156bc['limit']=qs[_0x67b6('0x25')](_0x37869a['query'][_0x67b6('0x25')]);_0x1156bc['offset']=qs[_0x67b6('0x24')](_0x37869a[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x5e3c88[_0x67b6('0xdd')](_0x1156bc);}})[_0x67b6('0x17')](function(_0x43d7f1){if(_0x43d7f1){return _0x43d7f1?{'count':_0x4e7f93,'rows':_0x43d7f1}:null;}})[_0x67b6('0x17')](respondWithResult(_0x287fe5,null))[_0x67b6('0x1f')](handleError(_0x287fe5,null));};exports[_0x67b6('0xde')]=function(_0x213f64,_0x11aede){var _0x2924f3={};var _0x34228e={};var _0x5cada2;var _0x581c31;return db['User'][_0x67b6('0x94')]({'where':{'id':_0x213f64[_0x67b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x11aede,null))[_0x67b6('0x17')](function(_0x2d7aa4){if(_0x2d7aa4){_0x5cada2=_0x2d7aa4;_0x34228e[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0xdf')][_0x67b6('0x40')]);_0x34228e[_0x67b6('0x46')]=_['keys'](_0x213f64[_0x67b6('0x46')]);_0x34228e[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x34228e['model'],_0x34228e[_0x67b6('0x46')]);_0x2924f3[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x34228e[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x213f64[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x2924f3[_0x67b6('0x4b')]=_0x2924f3[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x2924f3[_0x67b6('0x4b')]:_0x34228e[_0x67b6('0x59')];_0x2924f3[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x213f64['query']['sort']);_0x2924f3['where']=qs[_0x67b6('0xc5')](_['pick'](_0x213f64['query'],_0x34228e['filters']));if(_0x213f64[_0x67b6('0x46')][_0x67b6('0x43')]){_0x2924f3[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x2924f3[_0x67b6('0xc8')],{'$or':_['map'](_0x2924f3[_0x67b6('0x4b')],function(_0xa7736f){var _0x3fe52c={};_0x3fe52c[_0xa7736f]={'$like':'%'+_0x213f64[_0x67b6('0x46')]['filter']+'%'};return _0x3fe52c;})});}_0x2924f3=_[_0x67b6('0xca')]({},_0x2924f3,_0x213f64[_0x67b6('0x5e')]);return _0x5cada2[_0x67b6('0xde')](_0x2924f3);}})[_0x67b6('0x17')](function(_0x5a8056){if(_0x5a8056){_0x581c31=_0x5a8056[_0x67b6('0x50')];if(!_0x213f64['query']['hasOwnProperty'](_0x67b6('0xd1'))){_0x2924f3[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x213f64[_0x67b6('0x46')][_0x67b6('0x25')]);_0x2924f3['offset']=qs[_0x67b6('0x24')](_0x213f64['query']['offset']);}return _0x5cada2[_0x67b6('0xde')](_0x2924f3);}})[_0x67b6('0x17')](function(_0x9f2185){if(_0x9f2185){return _0x9f2185?{'count':_0x581c31,'rows':_0x9f2185}:null;}})['then'](respondWithResult(_0x11aede,null))[_0x67b6('0x1f')](handleError(_0x11aede,null));};exports['getMailInteractions']=function(_0x37975a,_0xbc4773){var _0x4d6d35={'raw':!![],'where':{}};var _0xefd11b={};var _0x37b9f9={'count':0x0,'rows':[]};return db['User'][_0x67b6('0x94')]({'where':{'id':_0x37975a[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0xbc4773,null))[_0x67b6('0x17')](function(_0xf0ed22){if(_0xf0ed22){_0xefd11b[_0x67b6('0x59')]=_['keys'](db[_0x67b6('0xe0')]['rawAttributes']);_0xefd11b[_0x67b6('0x46')]=_['keys'](_0x37975a[_0x67b6('0x46')]);_0xefd11b[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0xefd11b[_0x67b6('0x59')],_0xefd11b['query']);_0x4d6d35[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0xefd11b[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x37975a[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x4d6d35['attributes']=_0x4d6d35['attributes'][_0x67b6('0x50')]?_0x4d6d35[_0x67b6('0x4b')]:_0xefd11b[_0x67b6('0x59')];if(!_0x37975a[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x4d6d35[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x37975a[_0x67b6('0x46')][_0x67b6('0x25')]);_0x4d6d35[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x37975a['query'][_0x67b6('0x24')]);}_0x4d6d35['order']=qs[_0x67b6('0xc7')](_0x37975a[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x4d6d35['where']=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x37975a[_0x67b6('0x46')],_0xefd11b[_0x67b6('0xc5')]));_0x4d6d35[_0x67b6('0xc8')][_0x67b6('0xda')]=_0xf0ed22['id'];if(_0x37975a[_0x67b6('0x46')][_0x67b6('0x43')]){_0x4d6d35['where']=_[_0x67b6('0xca')](_0x4d6d35[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x4d6d35[_0x67b6('0x4b')],function(_0x4565f5){var _0x56b07b={};_0x56b07b[_0x4565f5]={'$like':'%'+_0x37975a[_0x67b6('0x46')]['filter']+'%'};return _0x56b07b;})});}_0x4d6d35=_[_0x67b6('0xca')]({},_0x4d6d35,_0x37975a[_0x67b6('0x5e')]);return db['MailInteraction'][_0x67b6('0x27')]({'where':_0x4d6d35[_0x67b6('0xc8')]})['then'](function(_0x21b8ac){_0x37b9f9[_0x67b6('0x27')]=_0x21b8ac;if(_0x37975a['query']['includeAll']){_0x4d6d35[_0x67b6('0x48')]=[{'all':!![]}];}return db['MailInteraction'][_0x67b6('0x4d')](_0x4d6d35);})['then'](function(_0x22faa7){_0x37b9f9[_0x67b6('0x4e')]=_0x22faa7;return _0x37b9f9;});}})['then'](respondWithFilteredResult(_0xbc4773,_0x4d6d35))[_0x67b6('0x1f')](handleError(_0xbc4773,null));};exports[_0x67b6('0xe1')]=function(_0x462a55,_0x14d8fa){var _0x328346={};var _0x29f8eb={};var _0x1bdfc8;var _0x3ff483;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x462a55[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x14d8fa,null))[_0x67b6('0x17')](function(_0x42c4de){if(_0x42c4de){_0x1bdfc8=_0x42c4de;_0x29f8eb['model']=_[_0x67b6('0x5b')](db[_0x67b6('0xe2')][_0x67b6('0x40')]);_0x29f8eb['query']=_[_0x67b6('0x5b')](_0x462a55[_0x67b6('0x46')]);_0x29f8eb[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x29f8eb['model'],_0x29f8eb['query']);_0x328346['attributes']=_[_0x67b6('0x5c')](_0x29f8eb[_0x67b6('0x59')],qs['fields'](_0x462a55['query'][_0x67b6('0x5d')]));_0x328346[_0x67b6('0x4b')]=_0x328346[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x328346[_0x67b6('0x4b')]:_0x29f8eb[_0x67b6('0x59')];_0x328346['order']=qs[_0x67b6('0xc7')](_0x462a55[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x328346[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_['pick'](_0x462a55[_0x67b6('0x46')],_0x29f8eb['filters']));if(_0x462a55['query'][_0x67b6('0x43')]){_0x328346['where']=_[_0x67b6('0xca')](_0x328346[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x328346['attributes'],function(_0x2bca3f){var _0x2ce79f={};_0x2ce79f[_0x2bca3f]={'$like':'%'+_0x462a55[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x2ce79f;})});}_0x328346=_[_0x67b6('0xca')]({},_0x328346,_0x462a55[_0x67b6('0x5e')]);return _0x1bdfc8['getSmsInteractions'](_0x328346);}})[_0x67b6('0x17')](function(_0x17a910){if(_0x17a910){_0x3ff483=_0x17a910[_0x67b6('0x50')];if(!_0x462a55['query'][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x328346[_0x67b6('0x25')]=qs['limit'](_0x462a55[_0x67b6('0x46')][_0x67b6('0x25')]);_0x328346[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x462a55[_0x67b6('0x46')]['offset']);}return _0x1bdfc8[_0x67b6('0xe1')](_0x328346);}})[_0x67b6('0x17')](function(_0x4c4167){if(_0x4c4167){return _0x4c4167?{'count':_0x3ff483,'rows':_0x4c4167}:null;}})[_0x67b6('0x17')](respondWithResult(_0x14d8fa,null))[_0x67b6('0x1f')](handleError(_0x14d8fa,null));};exports['getFaxInteractions']=function(_0x6bc73b,_0x1451f4){var _0x4f91a7={};var _0x1d3810={};var _0x142790;var _0x22b074;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x6bc73b[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x1451f4,null))[_0x67b6('0x17')](function(_0x3be5ae){if(_0x3be5ae){_0x142790=_0x3be5ae;_0x1d3810[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0xe3')]['rawAttributes']);_0x1d3810['query']=_['keys'](_0x6bc73b[_0x67b6('0x46')]);_0x1d3810['filters']=_[_0x67b6('0x5c')](_0x1d3810[_0x67b6('0x59')],_0x1d3810[_0x67b6('0x46')]);_0x4f91a7['attributes']=_[_0x67b6('0x5c')](_0x1d3810[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x6bc73b[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x4f91a7['attributes']=_0x4f91a7[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x4f91a7[_0x67b6('0x4b')]:_0x1d3810['model'];_0x4f91a7[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x6bc73b['query'][_0x67b6('0xc7')]);_0x4f91a7[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x6bc73b['query'],_0x1d3810[_0x67b6('0xc5')]));if(_0x6bc73b[_0x67b6('0x46')][_0x67b6('0x43')]){_0x4f91a7[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x4f91a7[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x4f91a7[_0x67b6('0x4b')],function(_0x24f7a0){var _0x43b2e7={};_0x43b2e7[_0x24f7a0]={'$like':'%'+_0x6bc73b[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x43b2e7;})});}_0x4f91a7=_[_0x67b6('0xca')]({},_0x4f91a7,_0x6bc73b[_0x67b6('0x5e')]);return _0x142790[_0x67b6('0xe4')](_0x4f91a7);}})[_0x67b6('0x17')](function(_0x2e8ba8){if(_0x2e8ba8){_0x22b074=_0x2e8ba8['length'];if(!_0x6bc73b['query'][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x4f91a7[_0x67b6('0x25')]=qs['limit'](_0x6bc73b[_0x67b6('0x46')]['limit']);_0x4f91a7[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x6bc73b['query'][_0x67b6('0x24')]);}return _0x142790[_0x67b6('0xe4')](_0x4f91a7);}})[_0x67b6('0x17')](function(_0x4a9a18){if(_0x4a9a18){return _0x4a9a18?{'count':_0x22b074,'rows':_0x4a9a18}:null;}})[_0x67b6('0x17')](respondWithResult(_0x1451f4,null))[_0x67b6('0x1f')](handleError(_0x1451f4,null));};exports['getWhatsappInteractions']=function(_0x36335c,_0x5baf53){var _0x45b13b={};var _0x5e6530={};var _0x554c91;var _0x37ad6b;return db[_0x67b6('0x3f')]['findOne']({'where':{'id':_0x36335c['params']['id']}})['then'](handleEntityNotFound(_0x5baf53,null))[_0x67b6('0x17')](function(_0xb48b02){if(_0xb48b02){_0x554c91=_0xb48b02;_0x5e6530[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db['WhatsappInteraction'][_0x67b6('0x40')]);_0x5e6530[_0x67b6('0x46')]=_[_0x67b6('0x5b')](_0x36335c[_0x67b6('0x46')]);_0x5e6530[_0x67b6('0xc5')]=_['intersection'](_0x5e6530[_0x67b6('0x59')],_0x5e6530['query']);_0x45b13b[_0x67b6('0x4b')]=_['intersection'](_0x5e6530[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x36335c[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x45b13b[_0x67b6('0x4b')]=_0x45b13b[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x45b13b[_0x67b6('0x4b')]:_0x5e6530[_0x67b6('0x59')];_0x45b13b['order']=qs[_0x67b6('0xc7')](_0x36335c['query'][_0x67b6('0xc7')]);_0x45b13b[_0x67b6('0xc8')]=qs['filters'](_['pick'](_0x36335c[_0x67b6('0x46')],_0x5e6530['filters']));if(_0x36335c[_0x67b6('0x46')][_0x67b6('0x43')]){_0x45b13b[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x45b13b[_0x67b6('0xc8')],{'$or':_['map'](_0x45b13b['attributes'],function(_0x5a29fb){var _0x32bd72={};_0x32bd72[_0x5a29fb]={'$like':'%'+_0x36335c[_0x67b6('0x46')]['filter']+'%'};return _0x32bd72;})});}_0x45b13b=_[_0x67b6('0xca')]({},_0x45b13b,_0x36335c['options']);return _0x554c91['getWhatsappInteractions'](_0x45b13b);}})[_0x67b6('0x17')](function(_0x38b225){if(_0x38b225){_0x37ad6b=_0x38b225[_0x67b6('0x50')];if(!_0x36335c['query']['hasOwnProperty']('nolimit')){_0x45b13b['limit']=qs['limit'](_0x36335c['query']['limit']);_0x45b13b[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x36335c[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x554c91[_0x67b6('0xe5')](_0x45b13b);}})[_0x67b6('0x17')](function(_0x1ef197){if(_0x1ef197){return _0x1ef197?{'count':_0x37ad6b,'rows':_0x1ef197}:null;}})[_0x67b6('0x17')](respondWithResult(_0x5baf53,null))[_0x67b6('0x1f')](handleError(_0x5baf53,null));};exports[_0x67b6('0xe6')]=function(_0x1112c8,_0x3d7273,_0x48c151){var _0x1ad39f;var _0x319cd7;var _0xf5d2d2;var _0x2f2638=!_[_0x67b6('0x69')](_0x1112c8[_0x67b6('0x58')]['id'])?_0x1112c8[_0x67b6('0x58')]['id']:!_[_0x67b6('0x69')](_0x1112c8[_0x67b6('0x32')]['id'])?_0x1112c8['user']['id']:null;return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x2f2638,'role':{'$or':['admin',_0x67b6('0x32'),_0x67b6('0x34')]}},'attributes':['id','name','phone',_0x67b6('0xe7'),'role',_0x67b6('0x64'),_0x67b6('0x9e')]})[_0x67b6('0x17')](function(_0x4eba6b){if(_0x4eba6b){if(_0x4eba6b[_0x67b6('0x2b')]===_0x67b6('0x34')){_0x1ad39f=_0x4eba6b;if(_0x1112c8['body'][_0x67b6('0xa0')]){_0xf5d2d2=util['format'](_0x67b6('0xe8'),_0x1ad39f[_0x1112c8[_0x67b6('0x60')][_0x67b6('0xa0')]]);}else if(_0x1112c8[_0x67b6('0x60')][_0x67b6('0xe9')]){_0xf5d2d2=util[_0x67b6('0xea')](_0x67b6('0xad'),_0x1112c8[_0x67b6('0x60')]['intrf']);}else{_0xf5d2d2=util[_0x67b6('0xea')](_0x67b6('0xad'),_0x1ad39f[_0x67b6('0x3c')]);}socket['to'](util['format']('user:%s',_0x1ad39f['name']))[_0x67b6('0x2c')](_0x67b6('0xeb'),{'user':{'id':_0x1ad39f['id'],'name':_0x1ad39f[_0x67b6('0x3c')]},'ip':_0x1112c8['headers'][_0x67b6('0xec')]||_0x1112c8[_0x67b6('0xed')][_0x67b6('0xee')]||_0x1112c8['socket'][_0x67b6('0xee')]||_0x1112c8[_0x67b6('0xed')][_0x67b6('0xef')][_0x67b6('0xee')]});return db['UserVoiceQueueRt'][_0x67b6('0x2e')]({'where':{'membername':_0x1ad39f[_0x67b6('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x67b6('0x8e'))](_0x67b6('0xf0'));}})[_0x67b6('0x17')](function(){if(_0x1ad39f){return _0x1ad39f['getVoiceQueues']({'raw':!![]});}})[_0x67b6('0x17')](function(_0x5b8845){if(_0x1ad39f){if(_0x5b8845){_0x319cd7=_0x5b8845;if(_0x319cd7[_0x67b6('0x50')]){var _0x41b085=_0x319cd7[_0x67b6('0x38')](function(_0x5054be){var _0x1a7778={'membername':_0x1ad39f['name'],'UserId':_0x1ad39f['id'],'queue_name':_0x5054be[_0x67b6('0x3c')],'VoiceQueueId':_0x5054be['id'],'interface':_0xf5d2d2,'paused':_0x1ad39f[_0x67b6('0x9e')]||![],'penalty':_0x5054be['UserVoiceQueue.penalty']||0x0};return db[_0x67b6('0xae')][_0x67b6('0xaf')](_0x1a7778);});return Promise[_0x67b6('0x56')](_0x41b085);}}}})[_0x67b6('0x17')](function(){if(_0x1ad39f){return db[_0x67b6('0xf1')]['findAll']({'where':{'membername':_0x1ad39f[_0x67b6('0x3c')],'exitAt':null}});}})['then'](function(_0x2215bf){if(_0x1ad39f){var _0x327d80=[];_0x2215bf[_0x67b6('0xf2')](function(_0x903377){_0x327d80['push'](_0x903377[_0x67b6('0x2a')]({'exitAt':moment()[_0x67b6('0xea')](_0x67b6('0xf3'))}));});return Promise[_0x67b6('0x56')](_0x327d80);}})[_0x67b6('0x17')](function(){if(_0x1ad39f){var _0x4924c7=[];var _0x5603d8=[];var _0x5c8598=utils[_0x67b6('0xf4')]();var _0x3fe436={'membername':_0x1ad39f['name'],'interface':_0xf5d2d2,'enterAt':moment()[_0x67b6('0xea')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1ad39f[_0x67b6('0x2b')],'internal':_0x1ad39f[_0x67b6('0x64')]};_0x5c8598[_0x67b6('0xf2')](function(_0x71ebd){_0x4924c7[_0x67b6('0x4c')](_['merge']({'channel':_0x71ebd,'type':_0x67b6('0xf5'),'data1':_0x1112c8[_0x67b6('0x60')][_0x67b6('0xf6')],'data2':_0xf5d2d2},_0x3fe436));if(_0x1ad39f['loginInPause']){_0x5603d8[_0x67b6('0x4c')](_[_0x67b6('0xca')]({'channel':_0x71ebd,'type':'PAUSE','data1':_0x67b6('0xf7')},_0x3fe436));}});return db[_0x67b6('0xf1')][_0x67b6('0xf8')](_0x4924c7[_0x67b6('0xc4')](_0x5603d8),{'individualHooks':!![]});}})[_0x67b6('0x17')](function(){if(_0x1ad39f){return _0x1ad39f[_0x67b6('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x67b6('0xea')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1ad39f[_0x67b6('0x9e')]||![],'mailPause':_0x1ad39f[_0x67b6('0x9e')]||![],'chatPause':_0x1ad39f[_0x67b6('0x9e')]||![],'faxPause':_0x1ad39f[_0x67b6('0x9e')]||![],'smsPause':_0x1ad39f[_0x67b6('0x9e')]||![],'openchannelPause':_0x1ad39f['loginInPause']||![],'whatsappPause':_0x1ad39f['loginInPause']||![],'pauseType':_0x1ad39f[_0x67b6('0x9e')]?_0x67b6('0xf7'):null,'interface':_0xf5d2d2,'lastPauseAt':moment()['format'](_0x67b6('0xf3'))});}})[_0x67b6('0x17')](function(_0x70778b){if(_0x1112c8[_0x67b6('0xf9')]){return _0x48c151();}else{return Promise['resolve'](_0x70778b)[_0x67b6('0x17')](respondWithResult(_0x3d7273,null));}})[_0x67b6('0x1f')](handleError(_0x3d7273,null));};exports[_0x67b6('0xfa')]=function(_0x585e29,_0x97f0d1){var _0x50df8a;return db['User'][_0x67b6('0x3b')]({'where':{'id':_0x585e29[_0x67b6('0x58')]['id'],'role':_0x67b6('0x34')},'attributes':['id',_0x67b6('0x3c'),_0x67b6('0x2b')]})['then'](handleEntityNotFound(_0x97f0d1,null))['then'](function(_0x7ccc82){if(_0x7ccc82){_0x50df8a=_0x7ccc82;return db[_0x67b6('0xae')][_0x67b6('0x2e')]({'where':{'membername':_0x50df8a[_0x67b6('0x3c')]},'individualHooks':!![]});}})[_0x67b6('0x17')](function(){return db[_0x67b6('0xf1')][_0x67b6('0x4d')]({'where':{'membername':_0x50df8a[_0x67b6('0x3c')],'exitAt':null}});})['then'](function(_0x453161){var _0x1242c5=[];_0x453161[_0x67b6('0xf2')](function(_0x10c291){_0x1242c5[_0x67b6('0x4c')](_0x10c291[_0x67b6('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x67b6('0x56')](_0x1242c5);})['then'](function(){return _0x50df8a[_0x67b6('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x67b6('0x17')](respondWithResult(_0x97f0d1,null))[_0x67b6('0x1f')](handleError(_0x97f0d1,null));};exports[_0x67b6('0xfb')]=function(_0x33ade9,_0x3bb86b){var _0x4228a6;return db[_0x67b6('0xae')][_0x67b6('0x2a')]({'paused':0x1},{'where':{'UserId':_0x33ade9[_0x67b6('0x58')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x67b6('0x3f')]['find']({'where':{'id':_0x33ade9[_0x67b6('0x58')]['id'],'role':_0x67b6('0x34')},'attributes':['id',_0x67b6('0x3c'),_0x67b6('0x2b'),_0x67b6('0x64'),_0x67b6('0xa0'),'online']});})[_0x67b6('0x17')](handleEntityNotFound(_0x3bb86b,null))[_0x67b6('0x17')](function(_0x4f056f){if(_0x4f056f){_0x4228a6=_0x4f056f;return respondWithRpcPromise(_0x67b6('0xfc'),_0x67b6('0xfb'),{'id':_0x4228a6['id'],'name':_0x4228a6['name'],'pause':!![]});}})[_0x67b6('0x17')](function(){if(_0x4228a6){return db[_0x67b6('0xf1')]['findAll']({'where':{'membername':_0x4228a6[_0x67b6('0x3c')],'type':_0x67b6('0xfd'),'exitAt':null}});}})['then'](function(_0x3dedca){if(_0x3dedca[_0x67b6('0x50')]){var _0x3f0fb3=moment()[_0x67b6('0xea')](_0x67b6('0xf3'));for(var _0x52e5a8=0x0,_0x4be08a=_0x3dedca[_0x67b6('0x50')];_0x52e5a8<_0x4be08a;_0x52e5a8++){_0x3dedca[_0x52e5a8][_0x67b6('0xfe')]({'exitAt':_0x3f0fb3});}}})[_0x67b6('0x17')](function(){var _0x3cc2f6=[];var _0x5603c1=utils['getChannels']();_0x5603c1[_0x67b6('0xf2')](function(_0x50a757){_0x3cc2f6[_0x67b6('0x4c')]({'channel':_0x50a757,'membername':_0x4228a6[_0x67b6('0x3c')],'interface':_[_0x67b6('0x69')](_0x4228a6[_0x67b6('0xa0')])?util[_0x67b6('0xea')](_0x67b6('0xad'),_0x4228a6['name']):_0x4228a6['interface'],'type':_0x67b6('0xfd'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x33ade9['body'][_0x67b6('0x42')]||'DEFAULT\x20PAUSE','role':_0x4228a6[_0x67b6('0x2b')],'internal':_0x4228a6[_0x67b6('0x64')]});});return db[_0x67b6('0xf1')][_0x67b6('0xf8')](_0x3cc2f6,{'individualHooks':!![]});})[_0x67b6('0x17')](function(){return _0x4228a6[_0x67b6('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x33ade9[_0x67b6('0x60')]['type']||_0x67b6('0xff'),'lastPauseAt':moment()[_0x67b6('0xea')](_0x67b6('0xf3'))});})['then'](respondWithResult(_0x3bb86b,null))[_0x67b6('0x1f')](handleError(_0x3bb86b,null));};exports[_0x67b6('0x100')]=function(_0x39613d,_0x47e360){if(_0x39613d[_0x67b6('0x60')][_0x67b6('0x9c')]&&!utils[_0x67b6('0xa1')](_0x39613d[_0x67b6('0x60')][_0x67b6('0x9c')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x39613d['body'][_0x67b6('0x9c')]));}return db[_0x67b6('0x3f')][_0x67b6('0x3b')]({'where':{'id':_0x39613d[_0x67b6('0x58')]['id']},'attributes':['id',_0x67b6('0x3c'),'role',_0x67b6('0x64'),_0x67b6('0xa0'),_0x67b6('0x9d'),_0x67b6('0x9f'),_0x67b6('0x101'),'chatPause',_0x67b6('0x102'),_0x67b6('0x103'),_0x67b6('0x104'),_0x67b6('0x105'),_0x67b6('0x106'),_0x67b6('0x107')]})['then'](function(_0xa4717b){if(!_0xa4717b){throw new APINotFoundError(util[_0x67b6('0xea')](_0x67b6('0x108'),_0x39613d['params']['id']));}return _0xa4717b['unpause'](_0x39613d[_0x67b6('0x60')]['channel']);})[_0x67b6('0x17')](respondWithResult(_0x47e360,null))[_0x67b6('0x1f')](APIHandleError(_0x47e360));};exports[_0x67b6('0x109')]=function(_0x3f79db,_0x1c7e92){var _0x3467b0={};var _0x23371d={};var _0x287b16;var _0x3c235b;return db['User'][_0x67b6('0x94')]({'where':{'id':_0x3f79db[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x1c7e92,null))[_0x67b6('0x17')](function(_0x53972b){if(_0x53972b){_0x287b16=_0x53972b;_0x23371d[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0x10a')][_0x67b6('0x40')]);_0x23371d[_0x67b6('0x46')]=_['keys'](_0x3f79db[_0x67b6('0x46')]);_0x23371d['filters']=_['intersection'](_0x23371d[_0x67b6('0x59')],_0x23371d[_0x67b6('0x46')]);_0x3467b0['attributes']=_[_0x67b6('0x5c')](_0x23371d[_0x67b6('0x59')],qs['fields'](_0x3f79db['query']['fields']));_0x3467b0[_0x67b6('0x4b')]=_0x3467b0['attributes'][_0x67b6('0x50')]?_0x3467b0[_0x67b6('0x4b')]:_0x23371d[_0x67b6('0x59')];_0x3467b0['order']=qs[_0x67b6('0xc7')](_0x3f79db[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x3467b0[_0x67b6('0xc8')]=qs[_0x67b6('0xc5')](_[_0x67b6('0xc9')](_0x3f79db['query'],_0x23371d[_0x67b6('0xc5')]));if(_0x3f79db['query'][_0x67b6('0x43')]){_0x3467b0['where']=_['merge'](_0x3467b0[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x3467b0['attributes'],function(_0x1f8817){var _0x50a3b3={};_0x50a3b3[_0x1f8817]={'$like':'%'+_0x3f79db[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x50a3b3;})});}_0x3467b0=_['merge']({},_0x3467b0,_0x3f79db[_0x67b6('0x5e')]);return _0x287b16[_0x67b6('0x109')](_0x3467b0);}})[_0x67b6('0x17')](function(_0x64cf3d){if(_0x64cf3d){_0x3c235b=_0x64cf3d['length'];if(!_0x3f79db[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x3467b0[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x3f79db['query'][_0x67b6('0x25')]);_0x3467b0[_0x67b6('0x24')]=qs[_0x67b6('0x24')](_0x3f79db[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x287b16[_0x67b6('0x109')](_0x3467b0);}})[_0x67b6('0x17')](function(_0x4c727b){if(_0x4c727b){return _0x4c727b?{'count':_0x3c235b,'rows':_0x4c727b}:null;}})[_0x67b6('0x17')](respondWithResult(_0x1c7e92,null))[_0x67b6('0x1f')](handleError(_0x1c7e92,null));};exports['addTeams']=function(_0x92a781,_0x4a759d){var _0x55cc0d=_0x92a781['params']['id'];var _0x52bf30=_0x92a781[_0x67b6('0x60')]?_0x92a781[_0x67b6('0x60')]['ids']:null;var _0x4cb21b=[];return Promise[_0x67b6('0x10b')]()[_0x67b6('0x17')](function(){if(!_0x52bf30)throw new APIBadRequestError(_0x67b6('0x10c'));})[_0x67b6('0x17')](function(){return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x55cc0d}});})[_0x67b6('0x17')](function(_0x3a3757){if(!_0x3a3757)throw new APINotFoundError(util[_0x67b6('0xea')](_0x67b6('0x108'),_0x92a781[_0x67b6('0x58')]['id']));return db[_0x67b6('0x6b')][_0x67b6('0x10d')](function(_0x15af11){return _0x3a3757[_0x67b6('0x10e')](_0x52bf30,{'transaction':_0x15af11})['then'](function(){return db[_0x67b6('0x10a')][_0x67b6('0x4d')]({'where':{'id':{'$in':_0x52bf30}}});})['then'](function(_0x5f2814){var _0x23ea0a=_[_0x67b6('0x38')](_0x5f2814,function(_0x7e6ea6){return _0x7e6ea6[_0x67b6('0x10f')]();});return Promise[_0x67b6('0x56')](_0x23ea0a);})[_0x67b6('0x17')](function(_0x12287d){_0x4cb21b=_['flattenDeep'](_0x12287d);var _0x4397ca=_[_0x67b6('0x38')](_0x4cb21b,function(_0x17400d){return _0x17400d[_0x67b6('0x110')](_0x3a3757['id'],{'transaction':_0x15af11});});return Promise['all'](_0x4397ca);})[_0x67b6('0x17')](function(){if(!_0x3a3757['online'])return;var _0x31f807=_[_0x67b6('0x43')](_0x4cb21b,function(_0x3e9081){return _0x3e9081[_0x67b6('0x111')]('channel')===_0x67b6('0x112');});var _0x5a7658=_['map'](_0x31f807,function(_0x42c30f){return db[_0x67b6('0xae')][_0x67b6('0xaf')]({'membername':_0x3a3757[_0x67b6('0x3c')],'UserId':_0x3a3757['id'],'queue_name':_0x42c30f[_0x67b6('0x3c')],'VoiceQueueId':_0x42c30f['id'],'interface':_['isNil'](_0x3a3757[_0x67b6('0xa0')])?util['format']('SIP/%s',_0x3a3757['name']):_0x3a3757[_0x67b6('0xa0')],'paused':_0x3a3757[_0x67b6('0x9f')]||![],'penalty':_0x3a3757['penalty']},{'transaction':_0x15af11});});return Promise[_0x67b6('0x56')](_0x5a7658);})[_0x67b6('0x17')](function(){return db[_0x67b6('0x113')][_0x67b6('0x4d')]({'where':{'teamId':{'$in':_0x52bf30}}});})['then'](function(_0x3337aa){var _0x10cba7=_['map'](_0x3337aa,function(_0x27718f){return db[_0x67b6('0x114')]['create']({'UserId':_0x3a3757['id'],'VoicePrefixId':_0x27718f[_0x67b6('0x115')]},{'transaction':_0x15af11});});return Promise[_0x67b6('0x56')](_0x10cba7);});});})[_0x67b6('0x17')](function(){for(var _0x32d209=0x0;_0x32d209<_0x4cb21b[_0x67b6('0x50')];_0x32d209++){var _0x2c4122=_0x4cb21b[_0x32d209][_0x67b6('0x111')](_0x67b6('0x9c'));var _0x151539=_0x2c4122+_0x67b6('0xa9');socket['emit'](_0x67b6('0x32')+_0x2c4122+_0x67b6('0xaa'),{'UserId':_0x55cc0d,['queueField']:_0x4cb21b[_0x32d209]['id']});}})[_0x67b6('0x17')](respondWithStatusCode(_0x4a759d,null))['catch'](APIHandleError(_0x4a759d));};exports[_0x67b6('0x116')]=function(_0x33904e,_0x2fe80a){var _0x286988=_0x33904e[_0x67b6('0x58')]['id'];var _0x26149c=null;if(_0x33904e[_0x67b6('0x46')][_0x67b6('0x63')]){_0x26149c=_[_0x67b6('0x117')](_0x33904e[_0x67b6('0x46')][_0x67b6('0x63')])?_0x33904e['query'][_0x67b6('0x63')]:[_0x33904e['query'][_0x67b6('0x63')]];}var _0x338880=[];return Promise[_0x67b6('0x10b')]()[_0x67b6('0x17')](function(){if(!_0x26149c)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x67b6('0x17')](function(){return db[_0x67b6('0x3f')]['findOne']({'where':{'id':_0x286988}});})['then'](function(_0x1fb32f){if(!_0x1fb32f)throw new APINotFoundError(util['format'](_0x67b6('0x108'),_0x33904e[_0x67b6('0x58')]['id']));return db[_0x67b6('0x6b')][_0x67b6('0x10d')](function(_0x49b4b0){return _0x1fb32f[_0x67b6('0x116')](_0x26149c,{'transaction':_0x49b4b0})[_0x67b6('0x17')](function(){return db[_0x67b6('0x10a')][_0x67b6('0x4d')]({'where':{'id':{'$in':_0x26149c}}});})[_0x67b6('0x17')](function(_0x28ba5b){var _0x19b610=_['map'](_0x28ba5b,function(_0x3253c0){return _0x3253c0['getAssociatedQueues']();});return Promise['all'](_0x19b610);})[_0x67b6('0x17')](function(_0x528d37){_0x338880=_[_0x67b6('0x118')](_0x528d37);var _0x2010d3=_['map'](_0x338880,function(_0x58e2e0){return _0x58e2e0['removeAgent'](_0x1fb32f['id'],{'transaction':_0x49b4b0});});return Promise['all'](_0x2010d3);})[_0x67b6('0x17')](function(){if(!_0x1fb32f[_0x67b6('0x9d')])return;var _0x20bd7e=_[_0x67b6('0x43')](_0x338880,function(_0x2235ed){return _0x2235ed[_0x67b6('0x111')](_0x67b6('0x9c'))===_0x67b6('0x112');});var _0x2218c3=_[_0x67b6('0x38')](_0x20bd7e,function(_0x303d00){return db[_0x67b6('0xae')][_0x67b6('0x2e')]({'where':{'VoiceQueueId':_0x303d00['id'],'UserId':_0x1fb32f['id']},'transaction':_0x49b4b0});});return Promise[_0x67b6('0x56')](_0x2218c3);})['then'](function(){return db[_0x67b6('0x113')][_0x67b6('0x4d')]({'where':{'teamId':{'$in':_0x26149c}}});})[_0x67b6('0x17')](function(_0x3adb30){var _0x513470=_['map'](_0x3adb30,function(_0x30cc4b){return db[_0x67b6('0x114')][_0x67b6('0x2e')]({'where':{'UserId':_0x1fb32f['id'],'VoicePrefixId':_0x30cc4b[_0x67b6('0x115')]}},{'transaction':_0x49b4b0});});return Promise['all'](_0x513470);});});})[_0x67b6('0x17')](function(){for(var _0x1fb571=0x0;_0x1fb571<_0x338880[_0x67b6('0x50')];_0x1fb571++){var _0xe18e4a=_0x338880[_0x1fb571]['getDataValue'](_0x67b6('0x9c'));var _0x59aad=_0xe18e4a+'QueueId';socket[_0x67b6('0x2c')]('user'+_0xe18e4a+_0x67b6('0xb0'),{'UserId':_0x286988,['queueField']:_0x338880[_0x1fb571]['id']});}})[_0x67b6('0x17')](respondWithStatusCode(_0x2fe80a,null))[_0x67b6('0x1f')](APIHandleError(_0x2fe80a));};exports[_0x67b6('0x119')]=function(_0x5850b5,_0x3bc92c){var _0x5c19a2={};var _0x1f8e3f={};var _0x3808d8;var _0x49b7df;return db[_0x67b6('0x3f')]['findOne']({'where':{'id':_0x5850b5['params']['id']}})['then'](handleEntityNotFound(_0x3bc92c,null))[_0x67b6('0x17')](function(_0x21b155){if(_0x21b155){_0x3808d8=_0x21b155;_0x1f8e3f[_0x67b6('0x59')]=_['keys'](db['CmList']['rawAttributes']);_0x1f8e3f['query']=_[_0x67b6('0x5b')](_0x5850b5[_0x67b6('0x46')]);_0x1f8e3f['filters']=_[_0x67b6('0x5c')](_0x1f8e3f['model'],_0x1f8e3f[_0x67b6('0x46')]);_0x5c19a2[_0x67b6('0x4b')]=_[_0x67b6('0x5c')](_0x1f8e3f[_0x67b6('0x59')],qs['fields'](_0x5850b5[_0x67b6('0x46')][_0x67b6('0x5d')]));_0x5c19a2['attributes']=_0x5c19a2[_0x67b6('0x4b')]['length']?_0x5c19a2[_0x67b6('0x4b')]:_0x1f8e3f[_0x67b6('0x59')];_0x5c19a2['order']=qs[_0x67b6('0xc7')](_0x5850b5[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x5c19a2[_0x67b6('0xc8')]=qs['filters'](_[_0x67b6('0xc9')](_0x5850b5[_0x67b6('0x46')],_0x1f8e3f[_0x67b6('0xc5')]));if(_0x5850b5[_0x67b6('0x46')][_0x67b6('0x43')]){_0x5c19a2[_0x67b6('0xc8')]=_['merge'](_0x5c19a2[_0x67b6('0xc8')],{'$or':_['map'](_0x5c19a2['attributes'],function(_0x51ea5a){var _0x23191b={};_0x23191b[_0x51ea5a]={'$like':'%'+_0x5850b5[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x23191b;})});}_0x5c19a2=_['merge']({},_0x5c19a2,_0x5850b5[_0x67b6('0x5e')]);return _0x3808d8['getLists'](_0x5c19a2);}})['then'](function(_0x5ae415){if(_0x5ae415){_0x49b7df=_0x5ae415[_0x67b6('0x50')];if(!_0x5850b5[_0x67b6('0x46')][_0x67b6('0xcc')](_0x67b6('0xd1'))){_0x5c19a2[_0x67b6('0x25')]=qs[_0x67b6('0x25')](_0x5850b5[_0x67b6('0x46')]['limit']);_0x5c19a2['offset']=qs[_0x67b6('0x24')](_0x5850b5[_0x67b6('0x46')][_0x67b6('0x24')]);}return _0x3808d8[_0x67b6('0x119')](_0x5c19a2);}})[_0x67b6('0x17')](function(_0xd3ae24){if(_0xd3ae24){return _0xd3ae24?{'count':_0x49b7df,'rows':_0xd3ae24}:null;}})[_0x67b6('0x17')](respondWithResult(_0x3bc92c,null))[_0x67b6('0x1f')](handleError(_0x3bc92c,null));};exports[_0x67b6('0x11a')]=function(_0x310be1,_0x568964){var _0x3d979e={};var _0x3ff5c1={};var _0x521914;return db[_0x67b6('0x3f')][_0x67b6('0x94')]({'where':{'id':_0x310be1[_0x67b6('0x58')]['id']}})[_0x67b6('0x17')](handleEntityNotFound(_0x568964,null))[_0x67b6('0x17')](function(_0x5cf6cd){if(_0x5cf6cd){_0x521914=_0x5cf6cd;_0x3ff5c1[_0x67b6('0x59')]=_[_0x67b6('0x5b')](db[_0x67b6('0x3f')]['rawAttributes']);_0x3ff5c1[_0x67b6('0x46')]=_[_0x67b6('0x5b')](_0x310be1[_0x67b6('0x46')]);_0x3ff5c1[_0x67b6('0xc5')]=_[_0x67b6('0x5c')](_0x3ff5c1[_0x67b6('0x59')],_0x3ff5c1[_0x67b6('0x46')]);_0x3d979e['attributes']=_['intersection'](_0x3ff5c1[_0x67b6('0x59')],qs[_0x67b6('0x5d')](_0x310be1['query'][_0x67b6('0x5d')]));_0x3d979e[_0x67b6('0x4b')]=_0x3d979e[_0x67b6('0x4b')][_0x67b6('0x50')]?_0x3d979e[_0x67b6('0x4b')]:_0x3ff5c1[_0x67b6('0x59')];_0x3d979e[_0x67b6('0xc6')]=qs[_0x67b6('0xc7')](_0x310be1[_0x67b6('0x46')][_0x67b6('0xc7')]);_0x3d979e['where']=qs['filters'](_['pick'](_0x310be1['query'],_0x3ff5c1[_0x67b6('0xc5')]));if(_0x310be1[_0x67b6('0x46')][_0x67b6('0x43')]){_0x3d979e[_0x67b6('0xc8')]=_[_0x67b6('0xca')](_0x3d979e[_0x67b6('0xc8')],{'$or':_[_0x67b6('0x38')](_0x3d979e[_0x67b6('0x4b')],function(_0x3dad58){var _0x2570f5={};_0x2570f5[_0x3dad58]={'$like':'%'+_0x310be1[_0x67b6('0x46')][_0x67b6('0x43')]+'%'};return _0x2570f5;})});}_0x3d979e[_0x67b6('0x59')]=db[_0x67b6('0x3f')];_0x3d979e['as']=_0x67b6('0x33');_0x3d979e=_[_0x67b6('0xca')]({},_0x3d979e,_0x310be1[_0x67b6('0x5e')]);return _0x521914['getVoiceQueues']({'include':[_0x3d979e]});}})['then'](function(_0x40feb8){if(_0x40feb8){var _0x49d95c={},_0x2a13dc=[];for(var _0x436385=0x0;_0x436385<_0x40feb8['length'];_0x436385+=0x1){for(var _0x162a3b=0x0,_0x593f38;_0x162a3b<_0x40feb8[_0x436385][_0x67b6('0x33')][_0x67b6('0x50')];_0x162a3b+=0x1){_0x593f38=_0x40feb8[_0x436385][_0x67b6('0x33')][_0x162a3b][_0x67b6('0x2f')]({'plain':!![]});_0x49d95c[_0x593f38['id']]=_0x593f38;}}_0x49d95c=_['values'](_0x49d95c);for(var _0x4e9c06=qs[_0x67b6('0x24')](_0x310be1[_0x67b6('0x46')][_0x67b6('0x24')]);_0x4e9c06<_0x49d95c[_0x67b6('0x50')]&&_0x2a13dc['length']=_0x5e8a9c){_0x3a85ec=_0x5e8a9c;_0x39280b=0xc8;}else{_0x39280b=0xce;}_0x12f3a8['status'](_0x39280b);return _0x12f3a8[_0x4840('0x20')](_0x4840('0x21'),_0x13545c+'-'+_0x3a85ec+'/'+_0x5e8a9c)[_0x4840('0x22')](_0xc82a01);}return null;};}function saveUpdates(_0x1e0ef0){return function(_0x32dc20){if(_0x32dc20){return _0x32dc20[_0x4840('0x23')](_0x1e0ef0)[_0x4840('0x12')](function(_0x47ad87){if(_0x47ad87[_0x4840('0x24')]===_0x4840('0x25')){socket[_0x4840('0x26')](_0x4840('0x27')+_0x47ad87['id'],_0x47ad87);}return _0x47ad87;});}return null;};}function removeEntity(_0x14bdcd){return function(_0xc82d81){if(_0xc82d81){return _0xc82d81[_0x4840('0x28')]()['then'](function(){var _0x238d05=_0xc82d81['get']({'plain':!![]});if(_0x238d05[_0x4840('0x24')]===_0x4840('0x29'))return;var _0x36b004=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4840('0x2a'),'value':_0x4840('0x25'),'ignore':![]},{'name':_0x4840('0x2b'),'value':_0x4840('0x2c'),'ignore':![]}];var _0x1a4097=_(_0x36b004)[_0x4840('0x2d')]('ignore')[_0x4840('0x2e')](_0x4840('0x2f'))['value']();if(_[_0x4840('0x30')](_0x1a4097,_0x238d05[_0x4840('0x24')])){return;}var _0x59c429=_['find'](_0x36b004,[_0x4840('0x2f'),_0x238d05['role']])['name'];return db[_0x4840('0x31')][_0x4840('0x28')]({'where':{'type':_0x59c429,'resourceId':_0x238d05['id']}})[_0x4840('0x12')](function(){return _0xc82d81;});})['then'](function(){_0x14bdcd[_0x4840('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f37f2){return function(_0x34c18e){if(!_0x34c18e){_0x2f37f2[_0x4840('0x32')](0x194);}return _0x34c18e;};}function handleError(_0x102683,_0x3aaa59){_0x3aaa59=_0x3aaa59||0x1f4;return function(_0x4a5ab9){logger[_0x4840('0x17')](_0x4a5ab9['stack']);if(_0x4a5ab9['name']){delete _0x4a5ab9[_0x4840('0x33')];}_0x102683['status'](_0x3aaa59)[_0x4840('0x34')](_0x4a5ab9);};}exports[_0x4840('0x35')]=function(_0xb943af,_0x27faa2){var _0x56c8ea={},_0x3372e0={'count':0x0,'rows':[]};var _0x1d600e=_(db[_0x4840('0x36')][_0x4840('0x37')])[_0x4840('0x2e')](function(_0xc46fad){return{'name':_0xc46fad[_0x4840('0x38')],'type':_0xc46fad[_0x4840('0x39')][_0x4840('0x3a')]};})[_0x4840('0x2d')](function(_0x10511d){return!_[_0x4840('0x30')]([_0x4840('0x3b'),_0x4840('0x3c')],_0x10511d['name']);})['value']();_0x56c8ea=qs[_0x4840('0x3d')](_0x1d600e,_0xb943af);var _0x34042b={'where':_0x56c8ea[_0x4840('0x3e')]};return db[_0x4840('0x36')]['count'](_0x34042b)[_0x4840('0x12')](function(_0x34ed8a){_0x3372e0['count']=_0x34ed8a;if(_0xb943af[_0x4840('0x3f')][_0x4840('0x40')]){_0x56c8ea['include']=[{'all':!![]}];}if(_0xb943af[_0x4840('0x3f')]['userSetting']===_0x4840('0x41')){_0x56c8ea[_0x4840('0x42')]=[{'model':db[_0x4840('0x43')],'as':_0x4840('0x44')}];}if(!_[_0x4840('0x30')](_0x56c8ea[_0x4840('0x45')],'id')){_0x56c8ea[_0x4840('0x45')][_0x4840('0x46')]('id');}return db[_0x4840('0x36')][_0x4840('0x47')](_0x56c8ea);})[_0x4840('0x12')](function(_0x487dab){_0x3372e0[_0x4840('0x48')]=_0x487dab;if(_0xb943af[_0x4840('0x3f')][_0x4840('0x49')]===_0x4840('0x41')){var _0x311228=[];for(var _0x4ba663=0x0;_0x4ba663<_0x3372e0[_0x4840('0x48')][_0x4840('0x4a')];_0x4ba663++){_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x4b'),_0x3372e0[_0x4840('0x48')][_0x4ba663][_0x4840('0x4c')]));_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x4d'),_0x3372e0['rows'][_0x4ba663]['dataValues']));_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x4e'),_0x3372e0[_0x4840('0x48')][_0x4ba663][_0x4840('0x4c')]));_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x4f'),_0x3372e0['rows'][_0x4ba663][_0x4840('0x4c')]));_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x50'),_0x3372e0[_0x4840('0x48')][_0x4ba663][_0x4840('0x4c')]));_0x311228[_0x4840('0x46')](get_open_tabs(_0x4840('0x51'),_0x3372e0['rows'][_0x4ba663][_0x4840('0x4c')]));}return Promise[_0x4840('0x52')](_0x311228)[_0x4840('0x12')](function(){return _0x3372e0;});}else{return _0x3372e0;}})[_0x4840('0x12')](respondWithFilteredResult(_0x27faa2,_0x56c8ea))[_0x4840('0x53')](handleError(_0x27faa2,null));};exports[_0x4840('0x54')]=function(_0x2dce94,_0x2b44e4){var _0x2b7ef2={'raw':![],'where':{'id':_0x2dce94[_0x4840('0x55')]['id']}},_0x617052={};_0x617052[_0x4840('0x56')]=_['differenceBy'](_['keys'](db[_0x4840('0x36')][_0x4840('0x37')]),[_0x4840('0x3b'),_0x4840('0x3c')]);_0x617052[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x2dce94[_0x4840('0x3f')]);_0x617052[_0x4840('0x58')]=_[_0x4840('0x59')](_0x617052[_0x4840('0x56')],_0x617052[_0x4840('0x3f')]);_0x2b7ef2[_0x4840('0x45')]=_[_0x4840('0x59')](_0x617052[_0x4840('0x56')],qs['fields'](_0x2dce94['query']['fields']));_0x2b7ef2[_0x4840('0x45')]=_0x2b7ef2['attributes']['length']?_0x2b7ef2['attributes']:_0x617052['model'];if(_0x2dce94[_0x4840('0x3f')][_0x4840('0x40')]){_0x2b7ef2[_0x4840('0x42')]=[{'all':!![]}];}if(_0x2dce94['query']['userSetting']===_0x4840('0x41')){_0x2b7ef2[_0x4840('0x42')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x2b7ef2=_[_0x4840('0x5a')]({},_0x2b7ef2,_0x2dce94[_0x4840('0x5b')]);if(!_[_0x4840('0x30')](_0x2b7ef2['attributes'],'id')){_0x2b7ef2[_0x4840('0x45')][_0x4840('0x46')]('id');}return db[_0x4840('0x36')][_0x4840('0x5c')](_0x2b7ef2)[_0x4840('0x12')](handleEntityNotFound(_0x2b44e4,null))['then'](function(_0x28e4f3){var _0x3a814a=[];values=_0x28e4f3;if(_0x2dce94[_0x4840('0x3f')]['openTabs']===_0x4840('0x41')){_0x3a814a[_0x4840('0x46')](get_open_tabs(_0x4840('0x4b'),_0x28e4f3['dataValues']));_0x3a814a['push'](get_open_tabs(_0x4840('0x4d'),_0x28e4f3[_0x4840('0x4c')]));_0x3a814a['push'](get_open_tabs(_0x4840('0x50'),_0x28e4f3[_0x4840('0x4c')]));_0x3a814a[_0x4840('0x46')](get_open_tabs('whatsapp',_0x28e4f3['dataValues']));_0x3a814a['push'](get_open_tabs(_0x4840('0x4e'),_0x28e4f3[_0x4840('0x4c')]));_0x3a814a[_0x4840('0x46')](get_open_tabs(_0x4840('0x4f'),_0x28e4f3[_0x4840('0x4c')]));return Promise[_0x4840('0x52')](_0x3a814a);}else{return values;}})[_0x4840('0x12')](function(){return values;})[_0x4840('0x12')](respondWithResult(_0x2b44e4,null))[_0x4840('0x53')](handleError(_0x2b44e4,null));};exports['update']=function(_0x82ae7b,_0x284835){if(_0x82ae7b[_0x4840('0x5d')]['id']){delete _0x82ae7b[_0x4840('0x5d')]['id'];}delete _0x82ae7b[_0x4840('0x5d')][_0x4840('0x24')];return db[_0x4840('0x36')]['find']({'where':{'id':_0x82ae7b[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x284835,null))['then'](saveUpdates(_0x82ae7b[_0x4840('0x5d')],null))['then'](respondWithResult(_0x284835,null))[_0x4840('0x53')](handleError(_0x284835,null));};exports[_0x4840('0x5e')]=function(_0x2240b6,_0x426a56){return db['User'][_0x4840('0x5e')]()['then'](respondWithResult(_0x426a56,null))['catch'](handleError(_0x426a56,null));};exports[_0x4840('0x5f')]=function(_0x52f083,_0x21bdbb){return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x52f083[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x21bdbb,null))[_0x4840('0x12')](function(_0x50af52){if(_0x50af52){return _0x50af52[_0x4840('0x5f')](_0x52f083[_0x4840('0x5d')][_0x4840('0x60')],_[_0x4840('0x61')](_0x52f083['body'],['ids','id'])||{});}})[_0x4840('0x12')](respondWithResult(_0x21bdbb,null))[_0x4840('0x53')](handleError(_0x21bdbb,null));};function validateUser(_0x4e25f5){return new Promise(function(_0x31c009,_0x4175f8){if(_0x4e25f5[_0x4840('0x62')])return _0x31c009(_0x4e25f5);return db[_0x4840('0x63')][_0x4840('0x64')](0x1)[_0x4840('0x12')](function(_0x297e72){if(_0x297e72[_0x4840('0x65')])authService['validatePasswordPattern'](_0x4e25f5[_0x4840('0x3b')]);db[_0x4840('0x36')]['max'](_0x4840('0x62'))[_0x4840('0x12')](function(_0x156fc0){if(_[_0x4840('0x66')](_0x156fc0)){_0x4e25f5[_0x4840('0x62')]=_0x297e72['min_internal']||0x1;return;}if(_[_0x4840('0x66')](_0x297e72['min_internal'])||_0x297e72[_0x4840('0x67')]===_0x156fc0){_0x4e25f5[_0x4840('0x62')]=_0x156fc0+0x1;return;}if(_0x297e72[_0x4840('0x67')]>_0x156fc0){_0x4e25f5[_0x4840('0x62')]=_0x297e72['min_internal'];return;}return db['sequelize'][_0x4840('0x3f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x4840('0x68')]})[_0x4840('0x12')](function(_0x4f5e2c){if(_0x4f5e2c&&_0x4f5e2c[_0x4840('0x4a')]){for(var _0xaf1153=0x0,_0x445101=_0x4f5e2c[_0x4840('0x4a')];_0xaf1153<_0x445101&&_[_0x4840('0x66')](_0x4e25f5[_0x4840('0x62')]);_0xaf1153++){if(_0x297e72[_0x4840('0x67')]<=_0x4f5e2c[_0xaf1153][_0x4840('0x69')]){_0x4e25f5['internal']=_0x4f5e2c[_0xaf1153][_0x4840('0x69')];}else if(_0x297e72['min_internal']>_0x4f5e2c[_0xaf1153][_0x4840('0x69')]&&_0x297e72[_0x4840('0x67')]<=_0x4f5e2c[_0xaf1153]['to']){_0x4e25f5[_0x4840('0x62')]=_0x297e72[_0x4840('0x67')];}}}if(_[_0x4840('0x66')](_0x4e25f5[_0x4840('0x62')])){_0x4e25f5[_0x4840('0x62')]=_0x156fc0+0x1;}return _0x31c009(_0x4e25f5);});});})[_0x4840('0x53')](function(_0x4d66c0){_0x4175f8(_0x4d66c0);});});}function updateUser(_0x1ff6e1){return new Promise(function(_0x58e102,_0x11125c){try{if(_0x1ff6e1['voicemail']){_0x1ff6e1[_0x4840('0x6a')]=_0x1ff6e1[_0x4840('0x62')];_0x1ff6e1[_0x4840('0x6b')]={'mailbox':_0x1ff6e1['internal'],'password':_0x1ff6e1[_0x4840('0x3b')],'fullname':_0x1ff6e1[_0x4840('0x6c')],'email':_0x1ff6e1[_0x4840('0x6d')]};}if(_0x1ff6e1[_0x4840('0x24')]===_0x4840('0x25')){if(!_0x1ff6e1[_0x4840('0x6e')])_0x1ff6e1[_0x4840('0x6e')]=['101',_0x4840('0x6f'),_0x4840('0x70'),_0x4840('0x71'),'110','104',_0x4840('0x72'),_0x4840('0x73'),_0x4840('0x74'),_0x4840('0x75'),_0x4840('0x76'),'100',_0x4840('0x77'),'114',_0x4840('0x78')];}_0x58e102(_0x1ff6e1);}catch(_0x25990d){_0x11125c(_0x25990d);}});}exports['create']=function(_0x292404,_0x3655e8){if(_0x292404['user']['role']===_0x4840('0x25'))throw new Error(_0x4840('0x79'));if(_0x292404['body'][_0x4840('0x24')]==='user'&&_0x292404[_0x4840('0x7a')]['role']!=='admin'){throw new Error(_0x4840('0x7b'));}if(_0x292404['body'][_0x4840('0x24')]===_0x4840('0x29')&&_0x292404[_0x4840('0x7a')][_0x4840('0x24')]!==_0x4840('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x292404['body']])[_0x4840('0x12')](function(){return validateUser(_0x292404['body']);})[_0x4840('0x12')](function(_0x2e3e5a){return updateUser(_0x2e3e5a)[_0x4840('0x12')](function(_0x4ae9a9){if(_0x4ae9a9[_0x4840('0x24')]===_0x4840('0x29')){_0x4ae9a9['settingsEnabled']=_0x292404[_0x4840('0x7a')]['settingsEnabled'];delete _0x4ae9a9[_0x4840('0x7c')];}return _0x4ae9a9;});})[_0x4840('0x12')](function(_0x450bc7){return db['User'][_0x4840('0x7d')](_0x450bc7,{'include':[{'model':db[_0x4840('0x6b')],'as':_0x4840('0x6b')}]});})[_0x4840('0x12')](function(_0x55cc9d){if(_0x292404[_0x4840('0x5d')][_0x4840('0x24')]==='user')return _0x55cc9d;if(_0x292404[_0x4840('0x7a')][_0x4840('0x24')]!==_0x4840('0x7a'))return _0x55cc9d;return db['UserProfileSection']['find']({'where':{'name':_0x55cc9d[_0x4840('0x24')]===_0x4840('0x25')?_0x4840('0x2a'):_0x4840('0x2b'),'userProfileId':_0x292404['user']['userProfileId']},'raw':!![]})['then'](function(_0x16ecae){if(!_0x16ecae||_0x16ecae[_0x4840('0x7e')]!=0x0)return _0x55cc9d;return db['UserProfileResource']['create']({'name':_0x55cc9d['name'],'resourceId':_0x55cc9d['id'],'type':_0x16ecae[_0x4840('0x33')],'sectionId':_0x16ecae['id']},{})[_0x4840('0x12')](function(){return _0x55cc9d;});})['catch'](function(_0x45769d){logger[_0x4840('0x17')](_0x4840('0x7f'),_0x45769d);throw _0x45769d;});})[_0x4840('0x12')](respondWithResult(_0x3655e8,0xc9))[_0x4840('0x53')](handleError(_0x3655e8,null));};exports['bulkCreate']=function(_0x349f10,_0x165d27){var _0x3b9447=_0x349f10[_0x4840('0x5d')];var _0x54c757=[];if(_0x349f10[_0x4840('0x7a')][_0x4840('0x24')]==='agent')throw new Error('Unauthorized');if(_['some'](_0x3b9447,[_0x4840('0x24'),_0x4840('0x7a')])&&_0x349f10[_0x4840('0x7a')]['role']!==_0x4840('0x29')){throw new Error(_0x4840('0x7b'));}if(_[_0x4840('0x80')](_0x3b9447,[_0x4840('0x24'),_0x4840('0x29')])&&_0x349f10[_0x4840('0x7a')]['role']!=='admin'){throw new Error(_0x4840('0x81'));}return licenseUtil['checkUserLimits'](_0x3b9447)[_0x4840('0x12')](function(){return validateUser(_0x3b9447[0x0]);})['then'](function(){for(var _0x5b269d=0x1;_0x5b269d<_0x3b9447[_0x4840('0x4a')];_0x5b269d++){var _0x475af4=_0x3b9447[_0x5b269d-0x1][_0x4840('0x62')];if(!_0x3b9447[_0x5b269d][_0x4840('0x62')])_0x3b9447[_0x5b269d][_0x4840('0x62')]=_0x475af4+0x1;_0x54c757[_0x4840('0x46')](validateUser(_0x3b9447[_0x5b269d]));}return Promise[_0x4840('0x52')](_0x54c757);})['then'](function(){_0x54c757=[];for(var _0x6baf89=0x0;_0x6baf89<_0x3b9447[_0x4840('0x4a')];_0x6baf89++){_0x54c757[_0x4840('0x46')](updateUser(_0x3b9447[_0x6baf89]));}return Promise['all'](_0x54c757);})['then'](function(){_0x54c757=_0x3b9447[_0x4840('0x2e')](function(_0x16e011){return db[_0x4840('0x36')][_0x4840('0x7d')](_0x16e011,{'include':[{'model':db[_0x4840('0x6b')],'as':_0x4840('0x6b')}]})['then'](function(_0x2d8703){_0x16e011['id']=_0x2d8703['id'];return _0x16e011;});});return Promise[_0x4840('0x52')](_0x54c757);})[_0x4840('0x12')](function(_0x1824fd){if(_0x349f10[_0x4840('0x5d')][_0x4840('0x24')]===_0x4840('0x7a'))return _0x1824fd;if(_0x349f10[_0x4840('0x7a')][_0x4840('0x24')]!=='user')return _0x1824fd;var _0x3c43ec=_[_0x4840('0x80')](_0x1824fd,function(_0x52e492){return _0x52e492[_0x4840('0x24')]===_0x4840('0x25')||_0x52e492[_0x4840('0x24')]===_0x4840('0x2c');});if(!_0x3c43ec)return _0x1824fd;return db[_0x4840('0x82')]['findAll']({'where':{'name':{'$or':[_0x4840('0x2a'),_0x4840('0x2b')]},'userProfileId':_0x349f10[_0x4840('0x7a')]['userProfileId']},'raw':!![]})[_0x4840('0x12')](function(_0x2aa4f1){if(_[_0x4840('0x83')](_0x2aa4f1)||!_[_0x4840('0x80')](_0x2aa4f1,[_0x4840('0x7e'),0x0]))return _0x1824fd;_0x54c757=[];var _0x1d1e2e=_(_0x2aa4f1)[_0x4840('0x2e')](function(_0x412f37){if(_0x412f37[_0x4840('0x7e')]===0x1)return;return _0x412f37[_0x4840('0x33')]===_0x4840('0x2a')?'agent':_0x4840('0x2c');})['compact']()['value']();for(var _0x3292e5=0x0;_0x3292e5<_0x1824fd[_0x4840('0x4a')];_0x3292e5++){if(!_[_0x4840('0x30')](_0x1d1e2e,_0x1824fd[_0x3292e5][_0x4840('0x24')]))return;var _0x1ea203=_0x1824fd[_0x3292e5][_0x4840('0x24')]===_0x4840('0x25')?'Agents':_0x4840('0x2b');_0x54c757[_0x4840('0x46')](db['UserProfileResource'][_0x4840('0x7d')]({'name':_0x1824fd[_0x3292e5][_0x4840('0x33')],'resourceId':_0x1824fd[_0x3292e5]['id'],'type':_0x1ea203,'sectionId':_[_0x4840('0x5c')](_0x2aa4f1,[_0x4840('0x33'),_0x1ea203])['id']},{}));}return Promise[_0x4840('0x52')](_0x54c757);});})[_0x4840('0x12')](respondWithResult(_0x165d27,0xc9))[_0x4840('0x53')](handleError(_0x165d27,null));};exports[_0x4840('0x84')]=function(_0x31f672,_0x5d4b2f){if(_0x31f672[_0x4840('0x5d')]['id']){delete _0x31f672[_0x4840('0x5d')]['id'];}return db[_0x4840('0x36')]['find']({'where':{'id':_0x31f672[_0x4840('0x55')]['id']}})[_0x4840('0x12')](function(_0x3a6e9f){if(!_0x3a6e9f)return null;if(_0x3a6e9f['id']===_0x31f672[_0x4840('0x7a')]['id']){if(!_0x31f672[_0x4840('0x5d')]['oldPassword']||!_0x31f672[_0x4840('0x5d')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x4840('0x85'));}if(!_0x3a6e9f[_0x4840('0x86')](_0x31f672[_0x4840('0x5d')][_0x4840('0x87')])){throw new db['Sequelize'][(_0x4840('0x88'))]('Wrong\x20credentials');}if(_0x31f672['body'][_0x4840('0x87')]===_0x31f672[_0x4840('0x5d')]['newPassword']){throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))](_0x4840('0x8a'));}}else if(_0x31f672['user'][_0x4840('0x24')]===_0x4840('0x29')){if(!_0x31f672['body']['newPassword']){throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x31f672[_0x4840('0x7a')][_0x4840('0x24')]===_0x4840('0x7a')){if(!_0x31f672[_0x4840('0x5d')][_0x4840('0x8b')]){throw new db[(_0x4840('0x89'))]['ValidationError'](_0x4840('0x8c'));}if(_0x3a6e9f['role']!==_0x4840('0x25')){throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))](_0x4840('0x79'));}}else{throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))](_0x4840('0x79'));}return _0x3a6e9f;})[_0x4840('0x12')](handleEntityNotFound(_0x5d4b2f,null))[_0x4840('0x12')](function(_0x3be4f1){return db[_0x4840('0x63')][_0x4840('0x8d')]({'attributes':['id',_0x4840('0x65'),_0x4840('0x8e'),_0x4840('0x8f')]})[_0x4840('0x12')](function(_0x13e93d){if(_0x13e93d[_0x4840('0x65')])authService[_0x4840('0x90')](_0x31f672[_0x4840('0x5d')][_0x4840('0x8b')]);if(!_0x13e93d[_0x4840('0x8e')]||!_0x3be4f1[_0x4840('0x91')])return _0x3be4f1;authService['validatePasswordHistory'](_0x31f672[_0x4840('0x5d')]['newPassword'],_0x3be4f1[_0x4840('0x91')],_0x13e93d[_0x4840('0x8f')]);return _0x3be4f1;})['then'](saveUpdates({'password':_0x31f672[_0x4840('0x5d')]['newPassword'],'passwordResetAt':_0x31f672[_0x4840('0x7a')]['id']==_0x31f672[_0x4840('0x55')]['id']?moment():null,'previousPasswords':authService[_0x4840('0x92')](_0x31f672[_0x4840('0x5d')][_0x4840('0x8b')],_0x3be4f1[_0x4840('0x91')])},null));})['then'](respondWithResult(_0x5d4b2f,null))[_0x4840('0x53')](handleError(_0x5d4b2f,null));};exports[_0x4840('0x93')]=function(_0x171927,_0x48aa07){var _0x10da15=_0x171927[_0x4840('0x5d')]['channel'];return db['User'][_0x4840('0x5c')]({'where':{'id':_0x171927[_0x4840('0x55')]['id']},'attributes':['id',_0x4840('0x33'),_0x4840('0x24'),_0x4840('0x94'),_0x4840('0x95'),_0x4840('0x96'),'interface']})[_0x4840('0x12')](handleEntityNotFound(_0x48aa07,null))['then'](function(_0x25ec9e){if(_0x25ec9e){if(!utils[_0x4840('0x97')](_0x10da15)){throw new db['Sequelize'][(_0x4840('0x88'))]('Unknown\x20channel');}return _0x25ec9e[_0x4840('0x98')+_[_0x4840('0x99')](_0x10da15[_0x4840('0x9a')]())+_0x4840('0x9b')](_0x171927[_0x4840('0x5d')][_0x4840('0x60')],{'penalty':_0x171927['body'][_0x4840('0x9c')]||0x0})[_0x4840('0x9d')](function(_0x15cd35){for(var _0x232cf0=0x0;_0x232cf0<_0x171927[_0x4840('0x5d')][_0x4840('0x60')][_0x4840('0x4a')];_0x232cf0+=0x1){var _0x588cc4={'UserId':Number(_0x171927[_0x4840('0x55')]['id'])};_0x588cc4[_[_0x4840('0x99')](_0x10da15[_0x4840('0x9a')]())+'QueueId']=Number(_0x171927['body'][_0x4840('0x60')][_0x232cf0]);socket[_0x4840('0x26')](_0x4840('0x7a')+_[_0x4840('0x99')](_0x10da15[_0x4840('0x9a')]())+'Queue:save',_0x588cc4);}return _0x15cd35;})[_0x4840('0x12')](function(){if(_0x10da15==='voice'){return db[_0x4840('0x9e')]['findAll']({'where':{'id':_0x171927[_0x4840('0x5d')][_0x4840('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4840('0x12')](function(_0x54e8ef){var _0x2a998b=_0x25ec9e['get']({'plain':!![]});var _0x1ff90d=[];if(_0x10da15==='voice'&&_0x2a998b[_0x4840('0x24')]===_0x4840('0x25')&&_0x2a998b[_0x4840('0x94')]){for(let _0x5cb9d5=0x0;_0x5cb9d5<_0x54e8ef[_0x4840('0x4a')];_0x5cb9d5+=0x1){_0x1ff90d[_0x4840('0x46')]({'membername':_0x2a998b[_0x4840('0x33')],'UserId':_0x2a998b['id'],'queue_name':_0x54e8ef[_0x5cb9d5][_0x4840('0x33')],'VoiceQueueId':_0x54e8ef[_0x5cb9d5]['id'],'interface':_[_0x4840('0x66')](_0x2a998b[_0x4840('0x9f')])?util[_0x4840('0xa0')](_0x4840('0xa1'),_0x2a998b[_0x4840('0x33')]):_0x2a998b['interface'],'paused':_0x2a998b[_0x4840('0x96')]||![],'penalty':_0x171927[_0x4840('0x5d')]['penalty']||0x0});}return Promise[_0x4840('0x52')](_0x1ff90d[_0x4840('0x2e')](function(_0x6f345d){return db[_0x4840('0xa2')][_0x4840('0xa3')](_0x6f345d);}));}return _0x25ec9e;});}})[_0x4840('0x12')](respondWithStatusCode(_0x48aa07,null))[_0x4840('0x53')](handleError(_0x48aa07,null));};exports[_0x4840('0xa4')]=function(_0x1b0712,_0x42c5c6){var _0x3f24f8,_0x801f5f;return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x1b0712[_0x4840('0x55')]['id']},'attributes':['id','name',_0x4840('0x24')]})[_0x4840('0x12')](handleEntityNotFound(_0x42c5c6,null))[_0x4840('0x12')](function(_0x1d43e8){if(_0x1d43e8){_0x3f24f8=_0x1d43e8;if(!_0x1b0712[_0x4840('0x3f')]['channel']||!utils[_0x4840('0x97')](_0x1b0712['query']['channel'])){throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))]('Unknown\x20channel');}return _0x1d43e8[_0x4840('0xa5')+_[_0x4840('0x99')](_0x1b0712[_0x4840('0x3f')]['channel'][_0x4840('0x9a')]())+'Queues'](_0x1b0712[_0x4840('0x3f')][_0x4840('0x60')]);}})[_0x4840('0x12')](function(_0x3c148f){if(_[_0x4840('0xa6')](_0x1b0712[_0x4840('0x3f')]['ids'])){for(var _0x2bee10=0x0;_0x2bee10<_0x1b0712['query'][_0x4840('0x60')]['length'];_0x2bee10+=0x1){_0x801f5f={'UserId':Number(_0x1b0712[_0x4840('0x55')]['id'])};_0x801f5f[_[_0x4840('0x99')](_0x1b0712[_0x4840('0x3f')][_0x4840('0xa7')]['toLowerCase']())+_0x4840('0xa8')]=Number(_0x1b0712[_0x4840('0x3f')]['ids'][_0x2bee10]);socket[_0x4840('0x26')](_0x4840('0x7a')+_[_0x4840('0x99')](_0x1b0712[_0x4840('0x3f')]['channel']['toLowerCase']())+_0x4840('0xa9'),_0x801f5f);}}else{_0x801f5f={'UserId':Number(_0x1b0712[_0x4840('0x55')]['id'])};_0x801f5f[_[_0x4840('0x99')](_0x1b0712[_0x4840('0x3f')][_0x4840('0xa7')][_0x4840('0x9a')]())+_0x4840('0xa8')]=Number(_0x1b0712[_0x4840('0x3f')][_0x4840('0x60')]);socket['emit'](_0x4840('0x7a')+_[_0x4840('0x99')](_0x1b0712[_0x4840('0x3f')][_0x4840('0xa7')][_0x4840('0x9a')]())+_0x4840('0xa9'),_0x801f5f);}return _0x3c148f;})[_0x4840('0x12')](function(){if(_0x1b0712[_0x4840('0x3f')][_0x4840('0xa7')]===_0x4840('0xaa')){return db[_0x4840('0xa2')]['destroy']({'where':{'UserId':_0x1b0712[_0x4840('0x55')]['id'],'VoiceQueueId':_0x1b0712['query'][_0x4840('0x60')]},'individualHooks':!![]})[_0x4840('0x12')](function(){return _0x3f24f8;});}return _0x3f24f8;})['then'](respondWithStatusCode(_0x42c5c6,null))['catch'](handleError(_0x42c5c6,null));};exports['addAvatar']=function(_0xfa8c70,_0xf5882c){_0xfa8c70['body']['userpic']=_0xfa8c70[_0x4840('0xab')][_0x4840('0xac')];return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0xfa8c70[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0xf5882c,null))[_0x4840('0x12')](saveUpdates(_0xfa8c70[_0x4840('0x5d')],null))[_0x4840('0x12')](respondWithResult(_0xf5882c,null))[_0x4840('0x53')](handleError(_0xf5882c,null));};exports[_0x4840('0xad')]=function(_0x3c9aa5,_0x5b4b99){var _0xa712a9=path[_0x4840('0xae')](config[_0x4840('0xaf')],_0x4840('0xb0'));return db[_0x4840('0x36')]['find']({'where':{'id':_0x3c9aa5['params']['id']},'attributes':['id',_0x4840('0xb1')],'raw':!![]})[_0x4840('0x12')](handleEntityNotFound(_0x5b4b99,null))['then'](function(_0x5871e8){if(_0x5871e8){if(_[_0x4840('0x66')](_0x5871e8['userpic'])){return _0x5b4b99['download'](_0xa712a9);}else{if(!fs['existsSync'](path['join'](config[_0x4840('0xaf')],_0x4840('0xb2'),_0x5871e8[_0x4840('0xb1')]))){return _0x5b4b99[_0x4840('0xb3')](_0xa712a9);}return _0x5b4b99[_0x4840('0xb3')](path[_0x4840('0xae')](config[_0x4840('0xaf')],'server/files/images/',_0x5871e8[_0x4840('0xb1')]));}}})[_0x4840('0x53')](handleError(_0x5b4b99,null));};exports[_0x4840('0xb4')]=function(_0x168b7b,_0x30a46a){return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x168b7b[_0x4840('0x55')]['id']},'attributes':['id']})[_0x4840('0x12')](handleEntityNotFound(_0x30a46a,null))[_0x4840('0x12')](function(_0x13a9a8){var _0x125fc3=[];values=_0x13a9a8['dataValues'];_0x125fc3[_0x4840('0x46')](get_open_tabs(_0x4840('0x4b'),_0x13a9a8[_0x4840('0x4c')]));_0x125fc3['push'](get_open_tabs(_0x4840('0x4d'),_0x13a9a8[_0x4840('0x4c')]));_0x125fc3[_0x4840('0x46')](get_open_tabs('openchannel',_0x13a9a8[_0x4840('0x4c')]));_0x125fc3['push'](get_open_tabs(_0x4840('0x51'),_0x13a9a8[_0x4840('0x4c')]));_0x125fc3['push'](get_open_tabs('fax',_0x13a9a8[_0x4840('0x4c')]));_0x125fc3[_0x4840('0x46')](get_open_tabs('mail',_0x13a9a8[_0x4840('0x4c')]));return Promise[_0x4840('0x52')](_0x125fc3);})[_0x4840('0x12')](function(_0x328c42){if(_0x328c42){var _0x3ab4b3=_[_0x4840('0x2e')](values[_0x4840('0xb5')],function(_0x3932cd){return{'channel':_0x4840('0xb6'),'id':_0x3932cd['id'],'createdAt':_0x3932cd[_0x4840('0xb7')]};});var _0x317d29=_['map'](values[_0x4840('0xb8')],function(_0x2a7c19){return{'channel':_0x4840('0xb9'),'id':_0x2a7c19['id'],'createdAt':_0x2a7c19[_0x4840('0xb7')]};});var _0x44b3aa=_['map'](values[_0x4840('0xba')],function(_0x821f6c){return{'channel':_0x4840('0xbb'),'id':_0x821f6c['id'],'createdAt':_0x821f6c[_0x4840('0xb7')]};});var _0x8418be=_[_0x4840('0x2e')](values[_0x4840('0xbc')],function(_0x1e646b){return{'channel':_0x4840('0xbd'),'id':_0x1e646b['id'],'createdAt':_0x1e646b[_0x4840('0xb7')]};});var _0x2a6649=_[_0x4840('0x2e')](values[_0x4840('0xbe')],function(_0x4533e3){return{'channel':'SMS','id':_0x4533e3['id'],'createdAt':_0x4533e3[_0x4840('0xb7')]};});var _0x284ec0=_[_0x4840('0x2e')](values[_0x4840('0xbf')],function(_0x263025){return{'channel':_0x4840('0xc0'),'id':_0x263025['id'],'createdAt':_0x263025[_0x4840('0xb7')]};});var _0x451a27=_[_0x4840('0xc1')](_0x3ab4b3,_0x317d29,_0x44b3aa,_0x8418be,_0x2a6649,_0x284ec0);var _0x3dabe6={'count':_0x451a27[_0x4840('0x4a')],'rows':_0x451a27};return _0x3dabe6;}else return null;})['then'](respondWithResult(_0x30a46a,null))[_0x4840('0x53')](handleError(_0x30a46a,null));};exports[_0x4840('0xc2')]=function(_0x16efa4,_0x2cd767){var _0x1425b4={};var _0x228dbe={};var _0x38c413;var _0x2bf58a;return db['User'][_0x4840('0x8d')]({'where':{'id':_0x16efa4[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x2cd767,null))[_0x4840('0x12')](function(_0x5b8bdf){if(_0x5b8bdf){_0x38c413=_0x5b8bdf;_0x228dbe[_0x4840('0x56')]=_[_0x4840('0x57')](db['CmContact'][_0x4840('0x37')]);_0x228dbe[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x16efa4['query']);_0x228dbe[_0x4840('0x58')]=_[_0x4840('0x59')](_0x228dbe[_0x4840('0x56')],_0x228dbe['query']);_0x1425b4[_0x4840('0x45')]=_['intersection'](_0x228dbe[_0x4840('0x56')],qs['fields'](_0x16efa4[_0x4840('0x3f')]['fields']));_0x1425b4[_0x4840('0x45')]=_0x1425b4['attributes'][_0x4840('0x4a')]?_0x1425b4[_0x4840('0x45')]:_0x228dbe['model'];_0x1425b4['order']=qs['sort'](_0x16efa4[_0x4840('0x3f')][_0x4840('0xc3')]);_0x1425b4[_0x4840('0x3e')]=qs[_0x4840('0x58')](_['pick'](_0x16efa4[_0x4840('0x3f')],_0x228dbe['filters']));if(_0x16efa4[_0x4840('0x3f')][_0x4840('0x2d')]){_0x1425b4['where']=_[_0x4840('0x5a')](_0x1425b4[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x1425b4['attributes'],function(_0x123afe){var _0x21a110={};_0x21a110[_0x123afe]={'$like':'%'+_0x16efa4[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x21a110;})});}_0x1425b4=_[_0x4840('0x5a')]({},_0x1425b4,_0x16efa4['options']);return _0x38c413['getContacts'](_0x1425b4);}})[_0x4840('0x12')](function(_0x2eba0e){if(_0x2eba0e){_0x2bf58a=_0x2eba0e[_0x4840('0x4a')];if(_0x16efa4[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0x40'))){_0x1425b4['include']=[{'model':db[_0x4840('0xc5')],'as':_0x4840('0xc6'),'required':![]},{'model':db[_0x4840('0xc7')],'as':_0x4840('0xc8'),'attributes':['id',_0x4840('0x33'),_0x4840('0xc9')],'where':_0x16efa4[_0x4840('0x3f')][_0x4840('0xca')]?{'id':_0x16efa4[_0x4840('0x3f')][_0x4840('0xca')]}:undefined,'required':_0x16efa4[_0x4840('0x3f')][_0x4840('0xca')]?!![]:![]}];}if(!_0x16efa4['query'][_0x4840('0xc4')](_0x4840('0xcb'))){_0x1425b4['limit']=qs[_0x4840('0x1f')](_0x16efa4[_0x4840('0x3f')][_0x4840('0x1f')]);_0x1425b4[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x16efa4['query'][_0x4840('0x1e')]);}return _0x38c413[_0x4840('0xc2')](_0x1425b4);}})['then'](function(_0x243336){if(_0x243336){return _0x243336?{'count':_0x2bf58a,'rows':_0x243336}:null;}})['then'](respondWithResult(_0x2cd767,null))[_0x4840('0x53')](handleError(_0x2cd767,null));};exports[_0x4840('0xcc')]=function(_0x39199a,_0x52f025){var _0x357bb7;var _0x34c1a0={};var _0x2cf0f2;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x39199a[_0x4840('0x55')]['id']},'attributes':['id',_0x4840('0x33'),_0x4840('0x24')]})[_0x4840('0x12')](handleEntityNotFound(_0x52f025,null))[_0x4840('0x12')](function(_0x483b23){if(!utils[_0x4840('0x97')](_0x39199a['query'][_0x4840('0xa7')])){throw new db[(_0x4840('0x89'))]['ValidationError'](_0x4840('0xcd'));}_0x357bb7=_0x483b23;var _0x108567={};_0x108567[_0x4840('0x56')]=_[_0x4840('0x57')](db[_[_0x4840('0x99')](_0x39199a[_0x4840('0x3f')][_0x4840('0xa7')])+'Queue']['rawAttributes']);_0x108567[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x39199a[_0x4840('0x3f')]);_0x108567['filters']=_[_0x4840('0x59')](_0x108567[_0x4840('0x56')],_0x108567[_0x4840('0x3f')]);_0x34c1a0[_0x4840('0x45')]=_['intersection'](_0x108567[_0x4840('0x56')],qs[_0x4840('0xce')](_0x39199a['query']['fields']));_0x34c1a0[_0x4840('0x45')]=_0x34c1a0[_0x4840('0x45')]['length']?_0x34c1a0[_0x4840('0x45')]:_0x108567[_0x4840('0x56')];_0x34c1a0[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x39199a[_0x4840('0x3f')][_0x4840('0xc3')]);_0x34c1a0[_0x4840('0x3e')]=qs[_0x4840('0x58')](_[_0x4840('0xd0')](_0x39199a['query'],_0x108567[_0x4840('0x58')]));if(_0x39199a[_0x4840('0x3f')][_0x4840('0x2d')]){_0x34c1a0[_0x4840('0x3e')]=_['merge'](_0x34c1a0[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x34c1a0[_0x4840('0x45')],function(_0x1596b6){var _0x1ccdeb={};_0x1ccdeb[_0x1596b6]={'$like':'%'+_0x39199a['query'][_0x4840('0x2d')]+'%'};return _0x1ccdeb;})});}_0x34c1a0=_[_0x4840('0x5a')]({},_0x34c1a0,_0x39199a[_0x4840('0x5b')]);switch(_0x357bb7[_0x4840('0x24')]){case'admin':return db[_['capitalize'](_0x39199a[_0x4840('0x3f')][_0x4840('0xa7')])+'Queue'][_0x4840('0x47')](_0x34c1a0);case'user':case'agent':return _0x357bb7[_0x4840('0xd1')+_[_0x4840('0x99')](_0x39199a[_0x4840('0x3f')]['channel'])+_0x4840('0x9b')](_0x34c1a0);default:throw new db[(_0x4840('0x89'))][(_0x4840('0x88'))]('Unknown\x20role');}})[_0x4840('0x12')](function(_0x2510b0){_0x2cf0f2=_0x2510b0[_0x4840('0x4a')];if(!_0x39199a[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x34c1a0['limit']=qs[_0x4840('0x1f')](_0x39199a[_0x4840('0x3f')]['limit']);_0x34c1a0[_0x4840('0x1e')]=qs['offset'](_0x39199a[_0x4840('0x3f')][_0x4840('0x1e')]);}switch(_0x357bb7['role']){case _0x4840('0x29'):return db[_['capitalize'](_0x39199a['query'][_0x4840('0xa7')])+'Queue'][_0x4840('0x47')](_0x34c1a0);case _0x4840('0x7a'):case _0x4840('0x25'):return _0x357bb7[_0x4840('0xd1')+_[_0x4840('0x99')](_0x39199a['query']['channel'])+'Queues'](_0x34c1a0);}})[_0x4840('0x12')](function(_0x580eef){return{'count':_0x2cf0f2,'rows':_0x580eef};})[_0x4840('0x12')](respondWithResult(_0x52f025,null))['catch'](handleError(_0x52f025,null));};exports[_0x4840('0xd2')]=function(_0x574881,_0x1d10db){var _0x557f00={};var _0x3c28de={};var _0x10e036;var _0x1567bf;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x574881[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x1d10db,null))[_0x4840('0x12')](function(_0x1b514c){if(_0x1b514c){_0x10e036=_0x1b514c;_0x3c28de[_0x4840('0x56')]=_[_0x4840('0x57')](db['UserVoiceQueueRt'][_0x4840('0x37')]);_0x3c28de[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x574881[_0x4840('0x3f')]);_0x3c28de[_0x4840('0x58')]=_[_0x4840('0x59')](_0x3c28de[_0x4840('0x56')],_0x3c28de[_0x4840('0x3f')]);_0x557f00[_0x4840('0x45')]=_[_0x4840('0x59')](_0x3c28de[_0x4840('0x56')],qs['fields'](_0x574881[_0x4840('0x3f')][_0x4840('0xce')]));_0x557f00[_0x4840('0x45')]=_0x557f00[_0x4840('0x45')][_0x4840('0x4a')]?_0x557f00['attributes']:_0x3c28de[_0x4840('0x56')];_0x557f00[_0x4840('0xcf')]=qs['sort'](_0x574881['query'][_0x4840('0xc3')]);_0x557f00[_0x4840('0x3e')]=qs['filters'](_[_0x4840('0xd0')](_0x574881[_0x4840('0x3f')],_0x3c28de[_0x4840('0x58')]));if(_0x574881[_0x4840('0x3f')]['filter']){_0x557f00[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x557f00[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x557f00['attributes'],function(_0x54878c){var _0x1b3392={};_0x1b3392[_0x54878c]={'$like':'%'+_0x574881[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x1b3392;})});}_0x557f00=_[_0x4840('0x5a')]({},_0x557f00,_0x574881[_0x4840('0x5b')]);return _0x10e036[_0x4840('0xd2')](_0x557f00);}})[_0x4840('0x12')](function(_0x46a39f){if(_0x46a39f){_0x1567bf=_0x46a39f[_0x4840('0x4a')];if(!_0x574881[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x557f00[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x574881[_0x4840('0x3f')][_0x4840('0x1f')]);_0x557f00[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x574881['query'][_0x4840('0x1e')]);}return _0x10e036[_0x4840('0xd2')](_0x557f00);}})[_0x4840('0x12')](function(_0x93e845){if(_0x93e845){return _0x93e845?{'count':_0x1567bf,'rows':_0x93e845}:null;}})[_0x4840('0x12')](respondWithResult(_0x1d10db,null))[_0x4840('0x53')](handleError(_0x1d10db,null));};exports[_0x4840('0xd3')]=function(_0x679e77,_0x57aa1d){var _0xccd2ac={};var _0x13edb8={};var _0xe4b404;var _0x17a776;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x679e77[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x57aa1d,null))[_0x4840('0x12')](function(_0x1915c1){if(_0x1915c1){_0xe4b404=_0x1915c1;_0x13edb8['model']=_[_0x4840('0x57')](db['ChatGroup'][_0x4840('0x37')]);_0x13edb8[_0x4840('0x3f')]=_['keys'](_0x679e77[_0x4840('0x3f')]);_0x13edb8[_0x4840('0x58')]=_['intersection'](_0x13edb8['model'],_0x13edb8['query']);_0xccd2ac['attributes']=_[_0x4840('0x59')](_0x13edb8[_0x4840('0x56')],qs[_0x4840('0xce')](_0x679e77[_0x4840('0x3f')][_0x4840('0xce')]));_0xccd2ac[_0x4840('0x45')]=_0xccd2ac[_0x4840('0x45')][_0x4840('0x4a')]?_0xccd2ac[_0x4840('0x45')]:_0x13edb8['model'];_0xccd2ac[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x679e77[_0x4840('0x3f')][_0x4840('0xc3')]);_0xccd2ac['where']=qs[_0x4840('0x58')](_['pick'](_0x679e77[_0x4840('0x3f')],_0x13edb8[_0x4840('0x58')]));if(_0x679e77[_0x4840('0x3f')][_0x4840('0x2d')]){_0xccd2ac['where']=_[_0x4840('0x5a')](_0xccd2ac[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0xccd2ac['attributes'],function(_0x48fe22){var _0x14d908={};_0x14d908[_0x48fe22]={'$like':'%'+_0x679e77['query'][_0x4840('0x2d')]+'%'};return _0x14d908;})});}_0xccd2ac=_['merge']({},_0xccd2ac,_0x679e77[_0x4840('0x5b')]);return _0xe4b404['getGroups'](_0xccd2ac);}})[_0x4840('0x12')](function(_0x53fa60){if(_0x53fa60){_0x17a776=_0x53fa60[_0x4840('0x4a')];if(!_0x679e77['query'][_0x4840('0xc4')](_0x4840('0xcb'))){_0xccd2ac[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x679e77[_0x4840('0x3f')]['limit']);_0xccd2ac['offset']=qs[_0x4840('0x1e')](_0x679e77[_0x4840('0x3f')]['offset']);}return _0xe4b404['getGroups'](_0xccd2ac);}})[_0x4840('0x12')](function(_0x37e26a){if(_0x37e26a){return _0x37e26a?{'count':_0x17a776,'rows':_0x37e26a}:null;}})[_0x4840('0x12')](respondWithResult(_0x57aa1d,null))[_0x4840('0x53')](handleError(_0x57aa1d,null));};exports[_0x4840('0xd4')]=function(_0x5bf56d,_0x599d1c){var _0x51d9d1={'raw':!![],'where':{}};var _0x421e0f={};var _0x349fdf={'count':0x0,'rows':[]};return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x5bf56d[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x599d1c,null))[_0x4840('0x12')](function(_0x534738){if(_0x534738){_0x421e0f[_0x4840('0x56')]=_[_0x4840('0x57')](db['VoiceRecording'][_0x4840('0x37')]);_0x421e0f[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x5bf56d[_0x4840('0x3f')]);_0x421e0f['filters']=_[_0x4840('0x59')](_0x421e0f['model'],_0x421e0f[_0x4840('0x3f')]);_0x51d9d1[_0x4840('0x45')]=_['intersection'](_0x421e0f[_0x4840('0x56')],qs[_0x4840('0xce')](_0x5bf56d[_0x4840('0x3f')]['fields']));_0x51d9d1[_0x4840('0x45')]=_0x51d9d1[_0x4840('0x45')][_0x4840('0x4a')]?_0x51d9d1[_0x4840('0x45')]:_0x421e0f[_0x4840('0x56')];if(!_0x5bf56d[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x51d9d1[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x5bf56d['query'][_0x4840('0x1f')]);_0x51d9d1['offset']=qs['offset'](_0x5bf56d[_0x4840('0x3f')][_0x4840('0x1e')]);}_0x51d9d1[_0x4840('0xcf')]=qs['sort'](_0x5bf56d[_0x4840('0x3f')][_0x4840('0xc3')]);_0x51d9d1[_0x4840('0x3e')]=qs[_0x4840('0x58')](_[_0x4840('0xd0')](_0x5bf56d[_0x4840('0x3f')],_0x421e0f[_0x4840('0x58')]));_0x51d9d1[_0x4840('0x3e')]['UserId']=_0x534738['id'];if(_0x5bf56d['query'][_0x4840('0x2d')]){_0x51d9d1[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x51d9d1[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x51d9d1[_0x4840('0x45')],function(_0x64a238){var _0x39dcfb={};_0x39dcfb[_0x64a238]={'$like':'%'+_0x5bf56d[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x39dcfb;})});}_0x51d9d1=_[_0x4840('0x5a')]({},_0x51d9d1,_0x5bf56d['options']);return db[_0x4840('0xd5')]['count']({'where':_0x51d9d1[_0x4840('0x3e')]})[_0x4840('0x12')](function(_0x368df4){_0x349fdf[_0x4840('0xd6')]=_0x368df4;if(_0x5bf56d[_0x4840('0x3f')][_0x4840('0x40')]){_0x51d9d1[_0x4840('0x42')]=[{'all':!![]}];}return db[_0x4840('0xd5')]['findAll'](_0x51d9d1);})[_0x4840('0x12')](function(_0x1eed10){_0x349fdf[_0x4840('0x48')]=_0x1eed10;return _0x349fdf;});}})[_0x4840('0x12')](respondWithFilteredResult(_0x599d1c,_0x51d9d1))[_0x4840('0x53')](handleError(_0x599d1c,null));};exports[_0x4840('0xd7')]=function(_0x3ee57f,_0x40dbf0){var _0xc4ca91={'raw':!![],'where':{}};var _0x5a8db8={};var _0x12f408={'count':0x0,'rows':[]};return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x3ee57f[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x40dbf0,null))[_0x4840('0x12')](function(_0xcc0b26){if(_0xcc0b26){_0x5a8db8[_0x4840('0x56')]=_[_0x4840('0x57')](db[_0x4840('0xd8')][_0x4840('0x37')]);_0x5a8db8[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x3ee57f[_0x4840('0x3f')]);_0x5a8db8['filters']=_[_0x4840('0x59')](_0x5a8db8[_0x4840('0x56')],_0x5a8db8[_0x4840('0x3f')]);_0xc4ca91[_0x4840('0x45')]=_['intersection'](_0x5a8db8[_0x4840('0x56')],qs[_0x4840('0xce')](_0x3ee57f['query'][_0x4840('0xce')]));_0xc4ca91['attributes']=_0xc4ca91['attributes'][_0x4840('0x4a')]?_0xc4ca91[_0x4840('0x45')]:_0x5a8db8[_0x4840('0x56')];if(!_0x3ee57f[_0x4840('0x3f')][_0x4840('0xc4')]('nolimit')){_0xc4ca91[_0x4840('0x1f')]=qs['limit'](_0x3ee57f['query']['limit']);_0xc4ca91[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x3ee57f[_0x4840('0x3f')][_0x4840('0x1e')]);}_0xc4ca91[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x3ee57f[_0x4840('0x3f')]['sort']);_0xc4ca91[_0x4840('0x3e')]=qs['filters'](_[_0x4840('0xd0')](_0x3ee57f['query'],_0x5a8db8[_0x4840('0x58')]));_0xc4ca91['where']['UserId']=_0xcc0b26['id'];if(_0x3ee57f['query'][_0x4840('0x2d')]){_0xc4ca91[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0xc4ca91[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0xc4ca91[_0x4840('0x45')],function(_0xc83ffc){var _0x4110b0={};_0x4110b0[_0xc83ffc]={'$like':'%'+_0x3ee57f[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x4110b0;})});}_0xc4ca91=_[_0x4840('0x5a')]({},_0xc4ca91,_0x3ee57f['options']);return db[_0x4840('0xd8')][_0x4840('0xd6')]({'where':_0xc4ca91[_0x4840('0x3e')]})[_0x4840('0x12')](function(_0x4d1af6){_0x12f408[_0x4840('0xd6')]=_0x4d1af6;if(_0x3ee57f[_0x4840('0x3f')][_0x4840('0x40')]){_0xc4ca91[_0x4840('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4840('0x47')](_0xc4ca91);})[_0x4840('0x12')](function(_0x1fc520){_0x12f408[_0x4840('0x48')]=_0x1fc520;return _0x12f408;});}})[_0x4840('0x12')](respondWithFilteredResult(_0x40dbf0,_0xc4ca91))[_0x4840('0x53')](handleError(_0x40dbf0,null));};exports['getChatInteractions']=function(_0x4554ed,_0x1a8817){var _0x3affc9={};var _0x5dff6e={};var _0x3e0dde;var _0x27d1b7;return db['User'][_0x4840('0x8d')]({'where':{'id':_0x4554ed[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x1a8817,null))[_0x4840('0x12')](function(_0x471a90){if(_0x471a90){_0x3e0dde=_0x471a90;_0x5dff6e[_0x4840('0x56')]=_[_0x4840('0x57')](db['ChatInteraction'][_0x4840('0x37')]);_0x5dff6e['query']=_['keys'](_0x4554ed[_0x4840('0x3f')]);_0x5dff6e[_0x4840('0x58')]=_[_0x4840('0x59')](_0x5dff6e[_0x4840('0x56')],_0x5dff6e['query']);_0x3affc9['attributes']=_[_0x4840('0x59')](_0x5dff6e[_0x4840('0x56')],qs[_0x4840('0xce')](_0x4554ed[_0x4840('0x3f')][_0x4840('0xce')]));_0x3affc9[_0x4840('0x45')]=_0x3affc9[_0x4840('0x45')]['length']?_0x3affc9['attributes']:_0x5dff6e[_0x4840('0x56')];_0x3affc9[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x4554ed[_0x4840('0x3f')][_0x4840('0xc3')]);_0x3affc9[_0x4840('0x3e')]=qs[_0x4840('0x58')](_['pick'](_0x4554ed['query'],_0x5dff6e[_0x4840('0x58')]));if(_0x4554ed[_0x4840('0x3f')][_0x4840('0x2d')]){_0x3affc9[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x3affc9[_0x4840('0x3e')],{'$or':_['map'](_0x3affc9[_0x4840('0x45')],function(_0x3657d1){var _0xa39fcf={};_0xa39fcf[_0x3657d1]={'$like':'%'+_0x4554ed['query']['filter']+'%'};return _0xa39fcf;})});}_0x3affc9=_[_0x4840('0x5a')]({},_0x3affc9,_0x4554ed[_0x4840('0x5b')]);return _0x3e0dde[_0x4840('0xd9')](_0x3affc9);}})[_0x4840('0x12')](function(_0x1c4e0b){if(_0x1c4e0b){_0x27d1b7=_0x1c4e0b[_0x4840('0x4a')];if(!_0x4554ed[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x3affc9[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x4554ed[_0x4840('0x3f')][_0x4840('0x1f')]);_0x3affc9[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x4554ed[_0x4840('0x3f')]['offset']);}return _0x3e0dde['getChatInteractions'](_0x3affc9);}})[_0x4840('0x12')](function(_0x262020){if(_0x262020){return _0x262020?{'count':_0x27d1b7,'rows':_0x262020}:null;}})[_0x4840('0x12')](respondWithResult(_0x1a8817,null))[_0x4840('0x53')](handleError(_0x1a8817,null));};exports[_0x4840('0xda')]=function(_0x51212c,_0x15ef28){var _0x5ddaff={};var _0x4b17ca={};var _0x1df200;var _0x48d762;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x51212c[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x15ef28,null))['then'](function(_0x10e4f7){if(_0x10e4f7){_0x1df200=_0x10e4f7;_0x4b17ca[_0x4840('0x56')]=_[_0x4840('0x57')](db[_0x4840('0xdb')][_0x4840('0x37')]);_0x4b17ca[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x51212c[_0x4840('0x3f')]);_0x4b17ca[_0x4840('0x58')]=_[_0x4840('0x59')](_0x4b17ca[_0x4840('0x56')],_0x4b17ca[_0x4840('0x3f')]);_0x5ddaff[_0x4840('0x45')]=_[_0x4840('0x59')](_0x4b17ca[_0x4840('0x56')],qs[_0x4840('0xce')](_0x51212c['query'][_0x4840('0xce')]));_0x5ddaff[_0x4840('0x45')]=_0x5ddaff[_0x4840('0x45')]['length']?_0x5ddaff[_0x4840('0x45')]:_0x4b17ca[_0x4840('0x56')];_0x5ddaff[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x51212c[_0x4840('0x3f')][_0x4840('0xc3')]);_0x5ddaff['where']=qs[_0x4840('0x58')](_[_0x4840('0xd0')](_0x51212c[_0x4840('0x3f')],_0x4b17ca['filters']));if(_0x51212c['query']['filter']){_0x5ddaff[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x5ddaff['where'],{'$or':_[_0x4840('0x2e')](_0x5ddaff[_0x4840('0x45')],function(_0xfec660){var _0x133d37={};_0x133d37[_0xfec660]={'$like':'%'+_0x51212c[_0x4840('0x3f')]['filter']+'%'};return _0x133d37;})});}_0x5ddaff=_[_0x4840('0x5a')]({},_0x5ddaff,_0x51212c[_0x4840('0x5b')]);return _0x1df200[_0x4840('0xda')](_0x5ddaff);}})[_0x4840('0x12')](function(_0x114468){if(_0x114468){_0x48d762=_0x114468[_0x4840('0x4a')];if(!_0x51212c[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x5ddaff[_0x4840('0x1f')]=qs['limit'](_0x51212c[_0x4840('0x3f')][_0x4840('0x1f')]);_0x5ddaff[_0x4840('0x1e')]=qs['offset'](_0x51212c[_0x4840('0x3f')][_0x4840('0x1e')]);}return _0x1df200[_0x4840('0xda')](_0x5ddaff);}})['then'](function(_0x3d122a){if(_0x3d122a){return _0x3d122a?{'count':_0x48d762,'rows':_0x3d122a}:null;}})[_0x4840('0x12')](respondWithResult(_0x15ef28,null))[_0x4840('0x53')](handleError(_0x15ef28,null));};exports[_0x4840('0xdc')]=function(_0x4e664d,_0x1fd425){var _0x1f5cd8={'raw':!![],'where':{}};var _0x525bef={};var _0x31812f={'count':0x0,'rows':[]};return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x4e664d[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x1fd425,null))[_0x4840('0x12')](function(_0x5dd042){if(_0x5dd042){_0x525bef[_0x4840('0x56')]=_['keys'](db[_0x4840('0xdd')]['rawAttributes']);_0x525bef[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x4e664d[_0x4840('0x3f')]);_0x525bef[_0x4840('0x58')]=_['intersection'](_0x525bef[_0x4840('0x56')],_0x525bef['query']);_0x1f5cd8['attributes']=_[_0x4840('0x59')](_0x525bef[_0x4840('0x56')],qs[_0x4840('0xce')](_0x4e664d['query']['fields']));_0x1f5cd8[_0x4840('0x45')]=_0x1f5cd8[_0x4840('0x45')][_0x4840('0x4a')]?_0x1f5cd8[_0x4840('0x45')]:_0x525bef[_0x4840('0x56')];if(!_0x4e664d[_0x4840('0x3f')]['hasOwnProperty'](_0x4840('0xcb'))){_0x1f5cd8[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x4e664d['query']['limit']);_0x1f5cd8['offset']=qs[_0x4840('0x1e')](_0x4e664d[_0x4840('0x3f')][_0x4840('0x1e')]);}_0x1f5cd8[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x4e664d['query'][_0x4840('0xc3')]);_0x1f5cd8[_0x4840('0x3e')]=qs['filters'](_[_0x4840('0xd0')](_0x4e664d[_0x4840('0x3f')],_0x525bef[_0x4840('0x58')]));_0x1f5cd8['where'][_0x4840('0xde')]=_0x5dd042['id'];if(_0x4e664d[_0x4840('0x3f')][_0x4840('0x2d')]){_0x1f5cd8[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x1f5cd8[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x1f5cd8[_0x4840('0x45')],function(_0x529383){var _0x439da8={};_0x439da8[_0x529383]={'$like':'%'+_0x4e664d['query'][_0x4840('0x2d')]+'%'};return _0x439da8;})});}_0x1f5cd8=_[_0x4840('0x5a')]({},_0x1f5cd8,_0x4e664d[_0x4840('0x5b')]);return db[_0x4840('0xdd')][_0x4840('0xd6')]({'where':_0x1f5cd8[_0x4840('0x3e')]})[_0x4840('0x12')](function(_0x249b71){_0x31812f[_0x4840('0xd6')]=_0x249b71;if(_0x4e664d[_0x4840('0x3f')][_0x4840('0x40')]){_0x1f5cd8[_0x4840('0x42')]=[{'all':!![]}];}return db[_0x4840('0xdd')][_0x4840('0x47')](_0x1f5cd8);})[_0x4840('0x12')](function(_0x2c3136){_0x31812f[_0x4840('0x48')]=_0x2c3136;return _0x31812f;});}})[_0x4840('0x12')](respondWithFilteredResult(_0x1fd425,_0x1f5cd8))[_0x4840('0x53')](handleError(_0x1fd425,null));};exports[_0x4840('0xdf')]=function(_0x1fa7c3,_0x1853b7){var _0x5d2862={};var _0x36835c={};var _0x3b1153;var _0x254972;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x1fa7c3[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x1853b7,null))[_0x4840('0x12')](function(_0x49c85f){if(_0x49c85f){_0x3b1153=_0x49c85f;_0x36835c[_0x4840('0x56')]=_[_0x4840('0x57')](db['SmsInteraction'][_0x4840('0x37')]);_0x36835c[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x1fa7c3['query']);_0x36835c[_0x4840('0x58')]=_[_0x4840('0x59')](_0x36835c[_0x4840('0x56')],_0x36835c[_0x4840('0x3f')]);_0x5d2862[_0x4840('0x45')]=_[_0x4840('0x59')](_0x36835c[_0x4840('0x56')],qs[_0x4840('0xce')](_0x1fa7c3[_0x4840('0x3f')][_0x4840('0xce')]));_0x5d2862[_0x4840('0x45')]=_0x5d2862[_0x4840('0x45')][_0x4840('0x4a')]?_0x5d2862[_0x4840('0x45')]:_0x36835c['model'];_0x5d2862[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x1fa7c3[_0x4840('0x3f')][_0x4840('0xc3')]);_0x5d2862[_0x4840('0x3e')]=qs[_0x4840('0x58')](_['pick'](_0x1fa7c3[_0x4840('0x3f')],_0x36835c[_0x4840('0x58')]));if(_0x1fa7c3[_0x4840('0x3f')][_0x4840('0x2d')]){_0x5d2862[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x5d2862[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x5d2862[_0x4840('0x45')],function(_0x308298){var _0x745e02={};_0x745e02[_0x308298]={'$like':'%'+_0x1fa7c3[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x745e02;})});}_0x5d2862=_[_0x4840('0x5a')]({},_0x5d2862,_0x1fa7c3[_0x4840('0x5b')]);return _0x3b1153[_0x4840('0xdf')](_0x5d2862);}})[_0x4840('0x12')](function(_0x60c991){if(_0x60c991){_0x254972=_0x60c991[_0x4840('0x4a')];if(!_0x1fa7c3[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x5d2862[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x1fa7c3[_0x4840('0x3f')]['limit']);_0x5d2862[_0x4840('0x1e')]=qs['offset'](_0x1fa7c3['query'][_0x4840('0x1e')]);}return _0x3b1153['getSmsInteractions'](_0x5d2862);}})[_0x4840('0x12')](function(_0x165499){if(_0x165499){return _0x165499?{'count':_0x254972,'rows':_0x165499}:null;}})[_0x4840('0x12')](respondWithResult(_0x1853b7,null))['catch'](handleError(_0x1853b7,null));};exports['getFaxInteractions']=function(_0x3c44f4,_0x543760){var _0x2a2dc6={};var _0x593718={};var _0x581968;var _0x2e176e;return db['User'][_0x4840('0x8d')]({'where':{'id':_0x3c44f4[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x543760,null))[_0x4840('0x12')](function(_0x1587b5){if(_0x1587b5){_0x581968=_0x1587b5;_0x593718[_0x4840('0x56')]=_[_0x4840('0x57')](db[_0x4840('0xe0')]['rawAttributes']);_0x593718[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x3c44f4[_0x4840('0x3f')]);_0x593718[_0x4840('0x58')]=_[_0x4840('0x59')](_0x593718[_0x4840('0x56')],_0x593718[_0x4840('0x3f')]);_0x2a2dc6[_0x4840('0x45')]=_['intersection'](_0x593718[_0x4840('0x56')],qs['fields'](_0x3c44f4[_0x4840('0x3f')]['fields']));_0x2a2dc6[_0x4840('0x45')]=_0x2a2dc6[_0x4840('0x45')][_0x4840('0x4a')]?_0x2a2dc6['attributes']:_0x593718[_0x4840('0x56')];_0x2a2dc6['order']=qs[_0x4840('0xc3')](_0x3c44f4[_0x4840('0x3f')][_0x4840('0xc3')]);_0x2a2dc6['where']=qs[_0x4840('0x58')](_[_0x4840('0xd0')](_0x3c44f4['query'],_0x593718['filters']));if(_0x3c44f4[_0x4840('0x3f')][_0x4840('0x2d')]){_0x2a2dc6[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x2a2dc6[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x2a2dc6[_0x4840('0x45')],function(_0x35ef69){var _0x15c2fa={};_0x15c2fa[_0x35ef69]={'$like':'%'+_0x3c44f4[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x15c2fa;})});}_0x2a2dc6=_[_0x4840('0x5a')]({},_0x2a2dc6,_0x3c44f4[_0x4840('0x5b')]);return _0x581968['getFaxInteractions'](_0x2a2dc6);}})['then'](function(_0x520b51){if(_0x520b51){_0x2e176e=_0x520b51[_0x4840('0x4a')];if(!_0x3c44f4[_0x4840('0x3f')][_0x4840('0xc4')]('nolimit')){_0x2a2dc6[_0x4840('0x1f')]=qs[_0x4840('0x1f')](_0x3c44f4['query'][_0x4840('0x1f')]);_0x2a2dc6[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x3c44f4[_0x4840('0x3f')][_0x4840('0x1e')]);}return _0x581968[_0x4840('0xe1')](_0x2a2dc6);}})[_0x4840('0x12')](function(_0x4a3824){if(_0x4a3824){return _0x4a3824?{'count':_0x2e176e,'rows':_0x4a3824}:null;}})[_0x4840('0x12')](respondWithResult(_0x543760,null))['catch'](handleError(_0x543760,null));};exports[_0x4840('0xe2')]=function(_0x582cd6,_0xf96ef9){var _0x56aebb={};var _0x1d31d9={};var _0x36a7b6;var _0x5f4f1f;return db['User'][_0x4840('0x8d')]({'where':{'id':_0x582cd6[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0xf96ef9,null))[_0x4840('0x12')](function(_0x3b1f63){if(_0x3b1f63){_0x36a7b6=_0x3b1f63;_0x1d31d9['model']=_[_0x4840('0x57')](db[_0x4840('0xe3')][_0x4840('0x37')]);_0x1d31d9['query']=_[_0x4840('0x57')](_0x582cd6[_0x4840('0x3f')]);_0x1d31d9[_0x4840('0x58')]=_['intersection'](_0x1d31d9[_0x4840('0x56')],_0x1d31d9[_0x4840('0x3f')]);_0x56aebb[_0x4840('0x45')]=_[_0x4840('0x59')](_0x1d31d9[_0x4840('0x56')],qs['fields'](_0x582cd6['query'][_0x4840('0xce')]));_0x56aebb['attributes']=_0x56aebb['attributes'][_0x4840('0x4a')]?_0x56aebb['attributes']:_0x1d31d9[_0x4840('0x56')];_0x56aebb[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x582cd6[_0x4840('0x3f')][_0x4840('0xc3')]);_0x56aebb[_0x4840('0x3e')]=qs[_0x4840('0x58')](_['pick'](_0x582cd6[_0x4840('0x3f')],_0x1d31d9[_0x4840('0x58')]));if(_0x582cd6[_0x4840('0x3f')][_0x4840('0x2d')]){_0x56aebb[_0x4840('0x3e')]=_['merge'](_0x56aebb[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x56aebb['attributes'],function(_0x675fab){var _0x4de9b3={};_0x4de9b3[_0x675fab]={'$like':'%'+_0x582cd6[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x4de9b3;})});}_0x56aebb=_[_0x4840('0x5a')]({},_0x56aebb,_0x582cd6[_0x4840('0x5b')]);return _0x36a7b6[_0x4840('0xe2')](_0x56aebb);}})[_0x4840('0x12')](function(_0x6483ee){if(_0x6483ee){_0x5f4f1f=_0x6483ee['length'];if(!_0x582cd6['query']['hasOwnProperty'](_0x4840('0xcb'))){_0x56aebb[_0x4840('0x1f')]=qs['limit'](_0x582cd6[_0x4840('0x3f')][_0x4840('0x1f')]);_0x56aebb[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x582cd6[_0x4840('0x3f')][_0x4840('0x1e')]);}return _0x36a7b6[_0x4840('0xe2')](_0x56aebb);}})[_0x4840('0x12')](function(_0x4bcd73){if(_0x4bcd73){return _0x4bcd73?{'count':_0x5f4f1f,'rows':_0x4bcd73}:null;}})['then'](respondWithResult(_0xf96ef9,null))['catch'](handleError(_0xf96ef9,null));};exports['login']=function(_0x3965d6,_0x477d08,_0x5dbcde){var _0x2ad2d7;var _0x321938;var _0x4edeb4;var _0x153943=!_[_0x4840('0x66')](_0x3965d6[_0x4840('0x55')]['id'])?_0x3965d6['params']['id']:!_[_0x4840('0x66')](_0x3965d6[_0x4840('0x7a')]['id'])?_0x3965d6[_0x4840('0x7a')]['id']:null;return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x153943,'role':{'$or':[_0x4840('0x29'),'user',_0x4840('0x25')]}},'attributes':['id',_0x4840('0x33'),_0x4840('0xe4'),'mobile',_0x4840('0x24'),_0x4840('0x62'),_0x4840('0x95')]})['then'](function(_0xf69017){if(_0xf69017){if(_0xf69017['role']==='agent'){_0x2ad2d7=_0xf69017;if(_0x3965d6[_0x4840('0x5d')]['interface']){_0x4edeb4=util[_0x4840('0xa0')](_0x4840('0xe5'),_0x2ad2d7[_0x3965d6[_0x4840('0x5d')][_0x4840('0x9f')]]);}else if(_0x3965d6[_0x4840('0x5d')][_0x4840('0xe6')]){_0x4edeb4=util[_0x4840('0xa0')](_0x4840('0xa1'),_0x3965d6[_0x4840('0x5d')][_0x4840('0xe6')]);}else{_0x4edeb4=util[_0x4840('0xa0')](_0x4840('0xa1'),_0x2ad2d7[_0x4840('0x33')]);}socket['to'](util[_0x4840('0xa0')](_0x4840('0xe7'),_0x2ad2d7[_0x4840('0x33')]))['emit']('user:forcelogout',{'user':{'id':_0x2ad2d7['id'],'name':_0x2ad2d7[_0x4840('0x33')]},'ip':_0x3965d6['headers'][_0x4840('0xe8')]||_0x3965d6['connection'][_0x4840('0xe9')]||_0x3965d6['socket'][_0x4840('0xe9')]||_0x3965d6[_0x4840('0xea')]['socket'][_0x4840('0xe9')]});return db['UserVoiceQueueRt'][_0x4840('0x28')]({'where':{'membername':_0x2ad2d7[_0x4840('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x4840('0x89'))]['ValidationError'](_0x4840('0xeb'));}})[_0x4840('0x12')](function(){if(_0x2ad2d7){return _0x2ad2d7[_0x4840('0xec')]({'raw':!![]});}})['then'](function(_0x49eb4f){if(_0x2ad2d7){if(_0x49eb4f){_0x321938=_0x49eb4f;if(_0x321938[_0x4840('0x4a')]){var _0x50886b=_0x321938[_0x4840('0x2e')](function(_0x48d362){var _0x382018={'membername':_0x2ad2d7[_0x4840('0x33')],'UserId':_0x2ad2d7['id'],'queue_name':_0x48d362['name'],'VoiceQueueId':_0x48d362['id'],'interface':_0x4edeb4,'paused':_0x2ad2d7[_0x4840('0x95')]||![],'penalty':_0x48d362[_0x4840('0xed')]||0x0};return db[_0x4840('0xa2')][_0x4840('0xa3')](_0x382018);});return Promise[_0x4840('0x52')](_0x50886b);}}}})[_0x4840('0x12')](function(){if(_0x2ad2d7){return db['MemberReport'][_0x4840('0x47')]({'where':{'membername':_0x2ad2d7[_0x4840('0x33')],'exitAt':null}});}})[_0x4840('0x12')](function(_0x204426){if(_0x2ad2d7){var _0x254eec=[];_0x204426[_0x4840('0xee')](function(_0x153e54){_0x254eec[_0x4840('0x46')](_0x153e54[_0x4840('0x23')]({'exitAt':moment()[_0x4840('0xa0')](_0x4840('0xef'))}));});return Promise[_0x4840('0x52')](_0x254eec);}})['then'](function(){if(_0x2ad2d7){var _0x568bec=[];var _0x13b023=[];var _0x48f7eb=utils['getChannels']();var _0x547dbf={'membername':_0x2ad2d7[_0x4840('0x33')],'interface':_0x4edeb4,'enterAt':moment()[_0x4840('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2ad2d7['role'],'internal':_0x2ad2d7[_0x4840('0x62')]};_0x48f7eb[_0x4840('0xee')](function(_0x43b397){_0x568bec[_0x4840('0x46')](_['merge']({'channel':_0x43b397,'type':_0x4840('0xf0'),'data1':_0x3965d6[_0x4840('0x5d')][_0x4840('0xf1')],'data2':_0x4edeb4},_0x547dbf));if(_0x2ad2d7['loginInPause']){_0x13b023[_0x4840('0x46')](_[_0x4840('0x5a')]({'channel':_0x43b397,'type':_0x4840('0xf2'),'data1':'LOGININPAUSE'},_0x547dbf));}});return db[_0x4840('0xf3')][_0x4840('0xf4')](_0x568bec[_0x4840('0xc1')](_0x13b023),{'individualHooks':!![]});}})['then'](function(){if(_0x2ad2d7){return _0x2ad2d7[_0x4840('0x23')]({'online':!![],'lastLoginAt':moment()[_0x4840('0xa0')](_0x4840('0xef')),'voicePause':_0x2ad2d7[_0x4840('0x95')]||![],'mailPause':_0x2ad2d7[_0x4840('0x95')]||![],'chatPause':_0x2ad2d7[_0x4840('0x95')]||![],'faxPause':_0x2ad2d7[_0x4840('0x95')]||![],'smsPause':_0x2ad2d7[_0x4840('0x95')]||![],'openchannelPause':_0x2ad2d7[_0x4840('0x95')]||![],'whatsappPause':_0x2ad2d7[_0x4840('0x95')]||![],'pauseType':_0x2ad2d7[_0x4840('0x95')]?_0x4840('0xf5'):null,'interface':_0x4edeb4,'lastPauseAt':moment()[_0x4840('0xa0')](_0x4840('0xef'))});}})['then'](function(_0x349929){if(_0x3965d6[_0x4840('0xf6')]){return _0x5dbcde();}else{return Promise[_0x4840('0xf7')](_0x349929)[_0x4840('0x12')](respondWithResult(_0x477d08,null));}})[_0x4840('0x53')](handleError(_0x477d08,null));};exports['logout']=function(_0x2378a6,_0x4f56d0){var _0x30ec9c;return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x2378a6[_0x4840('0x55')]['id'],'role':_0x4840('0x25')},'attributes':['id',_0x4840('0x33'),'role']})[_0x4840('0x12')](handleEntityNotFound(_0x4f56d0,null))['then'](function(_0x20b385){if(_0x20b385){_0x30ec9c=_0x20b385;return db[_0x4840('0xa2')][_0x4840('0x28')]({'where':{'membername':_0x30ec9c[_0x4840('0x33')]},'individualHooks':!![]});}})[_0x4840('0x12')](function(){return db[_0x4840('0xf3')][_0x4840('0x47')]({'where':{'membername':_0x30ec9c[_0x4840('0x33')],'exitAt':null}});})['then'](function(_0x4cc9ac){var _0x38d986=[];_0x4cc9ac['forEach'](function(_0xd35051){_0x38d986[_0x4840('0x46')](_0xd35051[_0x4840('0x23')]({'exitAt':moment()[_0x4840('0xa0')](_0x4840('0xef'))}));});return Promise['all'](_0x38d986);})[_0x4840('0x12')](function(){return _0x30ec9c[_0x4840('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x4f56d0,null))['catch'](handleError(_0x4f56d0,null));};exports[_0x4840('0xf8')]=function(_0x3ddadc,_0x139b68){var _0x4507eb;return db[_0x4840('0xa2')][_0x4840('0x23')]({'paused':0x1},{'where':{'UserId':_0x3ddadc[_0x4840('0x55')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x3ddadc[_0x4840('0x55')]['id'],'role':_0x4840('0x25')},'attributes':['id',_0x4840('0x33'),_0x4840('0x24'),_0x4840('0x62'),'interface',_0x4840('0x94')]});})[_0x4840('0x12')](handleEntityNotFound(_0x139b68,null))['then'](function(_0x11d2c1){if(_0x11d2c1){_0x4507eb=_0x11d2c1;return respondWithRpcPromise(_0x4840('0xf9'),'pause',{'id':_0x4507eb['id'],'name':_0x4507eb['name'],'pause':!![]});}})[_0x4840('0x12')](function(){if(_0x4507eb){return db['MemberReport'][_0x4840('0x47')]({'where':{'membername':_0x4507eb[_0x4840('0x33')],'type':_0x4840('0xf2'),'exitAt':null}});}})[_0x4840('0x12')](function(_0x23b099){if(_0x23b099[_0x4840('0x4a')]){var _0x431b23=moment()[_0x4840('0xa0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3e586b=0x0,_0x3eeb52=_0x23b099[_0x4840('0x4a')];_0x3e586b<_0x3eeb52;_0x3e586b++){_0x23b099[_0x3e586b][_0x4840('0xfa')]({'exitAt':_0x431b23});}}})[_0x4840('0x12')](function(){var _0x375304=[];var _0x51da17=utils[_0x4840('0xfb')]();_0x51da17['forEach'](function(_0x2acc70){_0x375304[_0x4840('0x46')]({'channel':_0x2acc70,'membername':_0x4507eb[_0x4840('0x33')],'interface':_[_0x4840('0x66')](_0x4507eb['interface'])?util['format']('SIP/%s',_0x4507eb[_0x4840('0x33')]):_0x4507eb[_0x4840('0x9f')],'type':_0x4840('0xf2'),'enterAt':moment()[_0x4840('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3ddadc['body'][_0x4840('0x39')]||_0x4840('0xfc'),'role':_0x4507eb[_0x4840('0x24')],'internal':_0x4507eb[_0x4840('0x62')]});});return db[_0x4840('0xf3')][_0x4840('0xf4')](_0x375304,{'individualHooks':!![]});})['then'](function(){return _0x4507eb[_0x4840('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3ddadc[_0x4840('0x5d')][_0x4840('0x39')]||_0x4840('0xfc'),'lastPauseAt':moment()[_0x4840('0xa0')](_0x4840('0xef'))});})[_0x4840('0x12')](respondWithResult(_0x139b68,null))[_0x4840('0x53')](handleError(_0x139b68,null));};exports[_0x4840('0xfd')]=function(_0x1b35e6,_0x44e7f4){if(_0x1b35e6[_0x4840('0x5d')]['channel']&&!utils[_0x4840('0x97')](_0x1b35e6['body'][_0x4840('0xa7')])){throw new APIBadRequestError(util['format'](_0x4840('0xfe'),_0x1b35e6[_0x4840('0x5d')][_0x4840('0xa7')]));}return db[_0x4840('0x36')][_0x4840('0x5c')]({'where':{'id':_0x1b35e6[_0x4840('0x55')]['id']},'attributes':['id','name','role',_0x4840('0x62'),_0x4840('0x9f'),'online','voicePause','mailPause','chatPause',_0x4840('0xff'),_0x4840('0x100'),'smsPause',_0x4840('0x101'),_0x4840('0x102'),_0x4840('0x103')]})[_0x4840('0x12')](function(_0x5a9cbc){if(!_0x5a9cbc){throw new APINotFoundError(util[_0x4840('0xa0')](_0x4840('0x104'),_0x1b35e6[_0x4840('0x55')]['id']));}return _0x5a9cbc['unpause'](_0x1b35e6[_0x4840('0x5d')][_0x4840('0xa7')]);})[_0x4840('0x12')](respondWithResult(_0x44e7f4,null))[_0x4840('0x53')](APIHandleError(_0x44e7f4));};exports[_0x4840('0x105')]=function(_0x393475,_0x461496){var _0x3d1f90={};var _0x41acc4={};var _0x6af807;var _0x2f5285;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x393475[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x461496,null))[_0x4840('0x12')](function(_0x90fa4e){if(_0x90fa4e){_0x6af807=_0x90fa4e;_0x41acc4[_0x4840('0x56')]=_[_0x4840('0x57')](db['Team'][_0x4840('0x37')]);_0x41acc4[_0x4840('0x3f')]=_[_0x4840('0x57')](_0x393475['query']);_0x41acc4[_0x4840('0x58')]=_[_0x4840('0x59')](_0x41acc4['model'],_0x41acc4[_0x4840('0x3f')]);_0x3d1f90[_0x4840('0x45')]=_[_0x4840('0x59')](_0x41acc4[_0x4840('0x56')],qs[_0x4840('0xce')](_0x393475[_0x4840('0x3f')]['fields']));_0x3d1f90[_0x4840('0x45')]=_0x3d1f90[_0x4840('0x45')]['length']?_0x3d1f90['attributes']:_0x41acc4[_0x4840('0x56')];_0x3d1f90[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x393475[_0x4840('0x3f')][_0x4840('0xc3')]);_0x3d1f90[_0x4840('0x3e')]=qs[_0x4840('0x58')](_['pick'](_0x393475[_0x4840('0x3f')],_0x41acc4[_0x4840('0x58')]));if(_0x393475[_0x4840('0x3f')]['filter']){_0x3d1f90[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x3d1f90[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x3d1f90['attributes'],function(_0x38ba51){var _0x4adaec={};_0x4adaec[_0x38ba51]={'$like':'%'+_0x393475[_0x4840('0x3f')]['filter']+'%'};return _0x4adaec;})});}_0x3d1f90=_[_0x4840('0x5a')]({},_0x3d1f90,_0x393475[_0x4840('0x5b')]);return _0x6af807[_0x4840('0x105')](_0x3d1f90);}})[_0x4840('0x12')](function(_0x866d22){if(_0x866d22){_0x2f5285=_0x866d22[_0x4840('0x4a')];if(!_0x393475['query']['hasOwnProperty'](_0x4840('0xcb'))){_0x3d1f90[_0x4840('0x1f')]=qs['limit'](_0x393475['query'][_0x4840('0x1f')]);_0x3d1f90['offset']=qs[_0x4840('0x1e')](_0x393475[_0x4840('0x3f')][_0x4840('0x1e')]);}return _0x6af807['getTeams'](_0x3d1f90);}})[_0x4840('0x12')](function(_0x5fba1){if(_0x5fba1){return _0x5fba1?{'count':_0x2f5285,'rows':_0x5fba1}:null;}})[_0x4840('0x12')](respondWithResult(_0x461496,null))[_0x4840('0x53')](handleError(_0x461496,null));};exports[_0x4840('0x106')]=function(_0x2c2a08,_0x20d4dd){var _0x1533a8=_0x2c2a08[_0x4840('0x55')]['id'];var _0x1c7649=_0x2c2a08['body']?_0x2c2a08[_0x4840('0x5d')][_0x4840('0x60')]:null;var _0x3e5ed6=[];return Promise[_0x4840('0xf7')]()['then'](function(){if(!_0x1c7649)throw new APIBadRequestError(_0x4840('0x107'));})['then'](function(){return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x1533a8}});})[_0x4840('0x12')](function(_0x2015a0){if(!_0x2015a0)throw new APINotFoundError(util['format'](_0x4840('0x104'),_0x2c2a08[_0x4840('0x55')]['id']));return db[_0x4840('0x108')][_0x4840('0x109')](function(_0x378466){return _0x2015a0['addTeams'](_0x1c7649,{'transaction':_0x378466})[_0x4840('0x12')](function(){return db['Team'][_0x4840('0x47')]({'where':{'id':{'$in':_0x1c7649}}});})['then'](function(_0x48c5c2){var _0x327f15=_[_0x4840('0x2e')](_0x48c5c2,function(_0x4fb8c9){return _0x4fb8c9['getAssociatedQueues']();});return Promise[_0x4840('0x52')](_0x327f15);})['then'](function(_0x4f7b9d){_0x3e5ed6=_['flattenDeep'](_0x4f7b9d);var _0x301825=_['map'](_0x3e5ed6,function(_0x1c3a95){return _0x1c3a95[_0x4840('0x10a')](_0x2015a0['id'],{'transaction':_0x378466});});return Promise[_0x4840('0x52')](_0x301825);})[_0x4840('0x12')](function(){if(!_0x2015a0[_0x4840('0x94')])return;var _0x135ef3=_[_0x4840('0x2d')](_0x3e5ed6,function(_0x375ff6){return _0x375ff6[_0x4840('0x10b')](_0x4840('0xa7'))==='Voice';});var _0xf91e00=_[_0x4840('0x2e')](_0x135ef3,function(_0x292df4){return db[_0x4840('0xa2')][_0x4840('0xa3')]({'membername':_0x2015a0[_0x4840('0x33')],'UserId':_0x2015a0['id'],'queue_name':_0x292df4['name'],'VoiceQueueId':_0x292df4['id'],'interface':_[_0x4840('0x66')](_0x2015a0[_0x4840('0x9f')])?util[_0x4840('0xa0')](_0x4840('0xa1'),_0x2015a0[_0x4840('0x33')]):_0x2015a0['interface'],'paused':_0x2015a0[_0x4840('0x96')]||![],'penalty':_0x2015a0[_0x4840('0x9c')]},{'transaction':_0x378466});});return Promise[_0x4840('0x52')](_0xf91e00);})['then'](function(){return db[_0x4840('0x10c')][_0x4840('0x47')]({'where':{'teamId':{'$in':_0x1c7649}}});})[_0x4840('0x12')](function(_0x4038e4){var _0x2e0713=_[_0x4840('0x2e')](_0x4038e4,function(_0x373dc2){return db[_0x4840('0x10d')][_0x4840('0x7d')]({'UserId':_0x2015a0['id'],'VoicePrefixId':_0x373dc2[_0x4840('0x10e')]},{'transaction':_0x378466});});return Promise[_0x4840('0x52')](_0x2e0713);});});})['then'](function(){for(var _0x2c7e31=0x0;_0x2c7e31<_0x3e5ed6[_0x4840('0x4a')];_0x2c7e31++){var _0x28789c=_0x3e5ed6[_0x2c7e31][_0x4840('0x10b')]('channel');var _0x118b47=_0x28789c+'QueueId';socket[_0x4840('0x26')](_0x4840('0x7a')+_0x28789c+_0x4840('0x10f'),{'UserId':_0x1533a8,['queueField']:_0x3e5ed6[_0x2c7e31]['id']});}})['then'](respondWithStatusCode(_0x20d4dd,null))['catch'](APIHandleError(_0x20d4dd));};exports[_0x4840('0x110')]=function(_0x3794a2,_0x2b6f8a){var _0x4d56be=_0x3794a2[_0x4840('0x55')]['id'];var _0x5a76f4=null;if(_0x3794a2[_0x4840('0x3f')][_0x4840('0x60')]){_0x5a76f4=_[_0x4840('0xa6')](_0x3794a2[_0x4840('0x3f')][_0x4840('0x60')])?_0x3794a2[_0x4840('0x3f')][_0x4840('0x60')]:[_0x3794a2[_0x4840('0x3f')][_0x4840('0x60')]];}var _0x200c9e=[];return Promise[_0x4840('0xf7')]()[_0x4840('0x12')](function(){if(!_0x5a76f4)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x4840('0x12')](function(){return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x4d56be}});})[_0x4840('0x12')](function(_0x28e5b4){if(!_0x28e5b4)throw new APINotFoundError(util[_0x4840('0xa0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3794a2[_0x4840('0x55')]['id']));return db[_0x4840('0x108')][_0x4840('0x109')](function(_0x1222de){return _0x28e5b4[_0x4840('0x110')](_0x5a76f4,{'transaction':_0x1222de})[_0x4840('0x12')](function(){return db[_0x4840('0x111')][_0x4840('0x47')]({'where':{'id':{'$in':_0x5a76f4}}});})[_0x4840('0x12')](function(_0x2d412b){var _0x21c105=_['map'](_0x2d412b,function(_0x505650){return _0x505650[_0x4840('0x112')]();});return Promise[_0x4840('0x52')](_0x21c105);})['then'](function(_0x56c6be){_0x200c9e=_[_0x4840('0x113')](_0x56c6be);var _0x1c03a3=_[_0x4840('0x2e')](_0x200c9e,function(_0x52115c){return _0x52115c[_0x4840('0x114')](_0x28e5b4['id'],{'transaction':_0x1222de});});return Promise['all'](_0x1c03a3);})[_0x4840('0x12')](function(){if(!_0x28e5b4[_0x4840('0x94')])return;var _0x59c061=_[_0x4840('0x2d')](_0x200c9e,function(_0x3b9126){return _0x3b9126[_0x4840('0x10b')]('channel')===_0x4840('0x115');});var _0xc0e44b=_[_0x4840('0x2e')](_0x59c061,function(_0x376820){return db[_0x4840('0xa2')][_0x4840('0x28')]({'where':{'VoiceQueueId':_0x376820['id'],'UserId':_0x28e5b4['id']},'transaction':_0x1222de});});return Promise[_0x4840('0x52')](_0xc0e44b);})['then'](function(){return db[_0x4840('0x10c')][_0x4840('0x47')]({'where':{'teamId':{'$in':_0x5a76f4}}});})[_0x4840('0x12')](function(_0x11fc5a){var _0x4da6e5=_['map'](_0x11fc5a,function(_0x3bcc2b){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x28e5b4['id'],'VoicePrefixId':_0x3bcc2b[_0x4840('0x10e')]}},{'transaction':_0x1222de});});return Promise[_0x4840('0x52')](_0x4da6e5);});});})[_0x4840('0x12')](function(){for(var _0x3f4e77=0x0;_0x3f4e77<_0x200c9e[_0x4840('0x4a')];_0x3f4e77++){var _0xf4f574=_0x200c9e[_0x3f4e77]['getDataValue']('channel');var _0x4501cf=_0xf4f574+'QueueId';socket[_0x4840('0x26')](_0x4840('0x7a')+_0xf4f574+'Queue:remove',{'UserId':_0x4d56be,['queueField']:_0x200c9e[_0x3f4e77]['id']});}})[_0x4840('0x12')](respondWithStatusCode(_0x2b6f8a,null))[_0x4840('0x53')](APIHandleError(_0x2b6f8a));};exports[_0x4840('0x116')]=function(_0x22693f,_0x4c5a76){var _0x4056e1={};var _0x22128e={};var _0x23f24a;var _0x56a9af;return db[_0x4840('0x36')][_0x4840('0x8d')]({'where':{'id':_0x22693f[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x4c5a76,null))[_0x4840('0x12')](function(_0x22b9cf){if(_0x22b9cf){_0x23f24a=_0x22b9cf;_0x22128e[_0x4840('0x56')]=_['keys'](db[_0x4840('0xc5')][_0x4840('0x37')]);_0x22128e[_0x4840('0x3f')]=_['keys'](_0x22693f[_0x4840('0x3f')]);_0x22128e[_0x4840('0x58')]=_[_0x4840('0x59')](_0x22128e[_0x4840('0x56')],_0x22128e[_0x4840('0x3f')]);_0x4056e1['attributes']=_[_0x4840('0x59')](_0x22128e['model'],qs['fields'](_0x22693f[_0x4840('0x3f')][_0x4840('0xce')]));_0x4056e1[_0x4840('0x45')]=_0x4056e1[_0x4840('0x45')][_0x4840('0x4a')]?_0x4056e1[_0x4840('0x45')]:_0x22128e[_0x4840('0x56')];_0x4056e1[_0x4840('0xcf')]=qs[_0x4840('0xc3')](_0x22693f[_0x4840('0x3f')]['sort']);_0x4056e1[_0x4840('0x3e')]=qs[_0x4840('0x58')](_[_0x4840('0xd0')](_0x22693f[_0x4840('0x3f')],_0x22128e[_0x4840('0x58')]));if(_0x22693f[_0x4840('0x3f')]['filter']){_0x4056e1['where']=_[_0x4840('0x5a')](_0x4056e1[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x4056e1[_0x4840('0x45')],function(_0x4ba636){var _0x3eefb7={};_0x3eefb7[_0x4ba636]={'$like':'%'+_0x22693f[_0x4840('0x3f')]['filter']+'%'};return _0x3eefb7;})});}_0x4056e1=_[_0x4840('0x5a')]({},_0x4056e1,_0x22693f[_0x4840('0x5b')]);return _0x23f24a[_0x4840('0x116')](_0x4056e1);}})['then'](function(_0x4cecb9){if(_0x4cecb9){_0x56a9af=_0x4cecb9[_0x4840('0x4a')];if(!_0x22693f[_0x4840('0x3f')][_0x4840('0xc4')](_0x4840('0xcb'))){_0x4056e1[_0x4840('0x1f')]=qs['limit'](_0x22693f[_0x4840('0x3f')][_0x4840('0x1f')]);_0x4056e1[_0x4840('0x1e')]=qs[_0x4840('0x1e')](_0x22693f[_0x4840('0x3f')][_0x4840('0x1e')]);}return _0x23f24a['getLists'](_0x4056e1);}})[_0x4840('0x12')](function(_0xf96982){if(_0xf96982){return _0xf96982?{'count':_0x56a9af,'rows':_0xf96982}:null;}})['then'](respondWithResult(_0x4c5a76,null))[_0x4840('0x53')](handleError(_0x4c5a76,null));};exports[_0x4840('0x117')]=function(_0x4fa3b5,_0x3fc7c6){var _0x25dec1={};var _0x165754={};var _0x38c7e0;return db[_0x4840('0x36')]['findOne']({'where':{'id':_0x4fa3b5[_0x4840('0x55')]['id']}})[_0x4840('0x12')](handleEntityNotFound(_0x3fc7c6,null))[_0x4840('0x12')](function(_0x354350){if(_0x354350){_0x38c7e0=_0x354350;_0x165754[_0x4840('0x56')]=_[_0x4840('0x57')](db['User']['rawAttributes']);_0x165754[_0x4840('0x3f')]=_['keys'](_0x4fa3b5[_0x4840('0x3f')]);_0x165754[_0x4840('0x58')]=_['intersection'](_0x165754[_0x4840('0x56')],_0x165754['query']);_0x25dec1[_0x4840('0x45')]=_[_0x4840('0x59')](_0x165754[_0x4840('0x56')],qs['fields'](_0x4fa3b5[_0x4840('0x3f')][_0x4840('0xce')]));_0x25dec1[_0x4840('0x45')]=_0x25dec1[_0x4840('0x45')][_0x4840('0x4a')]?_0x25dec1[_0x4840('0x45')]:_0x165754[_0x4840('0x56')];_0x25dec1['order']=qs[_0x4840('0xc3')](_0x4fa3b5[_0x4840('0x3f')]['sort']);_0x25dec1['where']=qs['filters'](_[_0x4840('0xd0')](_0x4fa3b5[_0x4840('0x3f')],_0x165754[_0x4840('0x58')]));if(_0x4fa3b5[_0x4840('0x3f')]['filter']){_0x25dec1[_0x4840('0x3e')]=_[_0x4840('0x5a')](_0x25dec1[_0x4840('0x3e')],{'$or':_[_0x4840('0x2e')](_0x25dec1[_0x4840('0x45')],function(_0x2b8fd0){var _0x24bc0c={};_0x24bc0c[_0x2b8fd0]={'$like':'%'+_0x4fa3b5[_0x4840('0x3f')][_0x4840('0x2d')]+'%'};return _0x24bc0c;})});}_0x25dec1[_0x4840('0x56')]=db[_0x4840('0x36')];_0x25dec1['as']=_0x4840('0x2a');_0x25dec1=_[_0x4840('0x5a')]({},_0x25dec1,_0x4fa3b5[_0x4840('0x5b')]);return _0x38c7e0[_0x4840('0xec')]({'include':[_0x25dec1]});}})[_0x4840('0x12')](function(_0x56c893){if(_0x56c893){var _0x272ca1={},_0x2ed3f9=[];for(var _0xa9648e=0x0;_0xa9648e<_0x56c893[_0x4840('0x4a')];_0xa9648e+=0x1){for(var _0x73b038=0x0,_0x29cc98;_0x73b038<_0x56c893[_0xa9648e][_0x4840('0x2a')][_0x4840('0x4a')];_0x73b038+=0x1){_0x29cc98=_0x56c893[_0xa9648e][_0x4840('0x2a')][_0x73b038]['get']({'plain':!![]});_0x272ca1[_0x29cc98['id']]=_0x29cc98;}}_0x272ca1=_['values'](_0x272ca1);for(var _0x4f320b=qs['offset'](_0x4fa3b5[_0x4840('0x3f')][_0x4840('0x1e')]);_0x4f320b<_0x272ca1[_0x4840('0x4a')]&&_0x2ed3f9[_0x4840('0x4a')]=_0x271ec6[_0x7d3c('0x51')]){throw new Error(_0x7d3c('0x52'));}})[_0x7d3c('0x19')](function(){if(_0x5e56b8){return db[_0x7d3c('0x43')]['destroy']({'where':{'membername':_0x5e56b8[_0x7d3c('0x23')]},'individualHooks':!![]});}})[_0x7d3c('0x19')](function(){if(_0x5e56b8){return _0x5e56b8[_0x7d3c('0x53')]({'raw':!![]});}})[_0x7d3c('0x19')](function(_0x11a550){if(_0x5e56b8){if(_0x11a550){var _0x41126c=[];_0x2fe425=_0x11a550;if(_0x2fe425[_0x7d3c('0x2a')]){for(var _0x207e69=0x0;_0x207e69<_0x2fe425['length'];_0x207e69++){_0x41126c[_0x7d3c('0x2d')](db['UserVoiceQueueRt'][_0x7d3c('0x54')]({'membername':_0x5e56b8['name'],'UserId':_0x5e56b8['id'],'queue_name':_0x2fe425[_0x207e69][_0x7d3c('0x23')],'VoiceQueueId':_0x2fe425[_0x207e69]['id'],'interface':_0x27db93,'paused':_0x5e56b8[_0x7d3c('0x4b')]||![],'penalty':_0x2fe425[_0x207e69]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x41126c);}}}})['then'](function(){if(_0x5e56b8){return db['MemberReport'][_0x7d3c('0x10')]({'where':{'membername':_0x5e56b8[_0x7d3c('0x23')],'exitAt':null}});}})[_0x7d3c('0x19')](function(_0x24b97c){if(_0x5e56b8){if(_0x24b97c&&_0x24b97c[_0x7d3c('0x2a')]){var _0x2bda7c=[];_0x24b97c[_0x7d3c('0x46')](function(_0xc31aa0){_0x2bda7c['push'](_0xc31aa0[_0x7d3c('0x28')]({'exitAt':moment()[_0x7d3c('0x26')](_0x7d3c('0x2b'))}));});return BPromise[_0x7d3c('0x47')](_0x2bda7c);}}})[_0x7d3c('0x19')](function(){if(_0x5e56b8){var _0x1a7cc2=[];var _0x3d4ed2=[];var _0x59a9a1=utils[_0x7d3c('0x2c')]();var _0x28b994={'membername':_0x5e56b8[_0x7d3c('0x23')],'interface':_0x27db93,'enterAt':moment()[_0x7d3c('0x26')](_0x7d3c('0x2b')),'role':_0x5e56b8[_0x7d3c('0x24')],'internal':_0x5e56b8[_0x7d3c('0x30')]};_0x59a9a1['forEach'](function(_0xc044df){_0x1a7cc2['push'](_[_0x7d3c('0x55')]({'channel':_0xc044df,'type':_0x7d3c('0x56'),'data1':_0x7d3c('0x57'),'data2':_0x27db93},_0x28b994));if(_0x5e56b8[_0x7d3c('0x4b')]){_0x3d4ed2['push'](_[_0x7d3c('0x55')]({'channel':_0xc044df,'type':_0x7d3c('0x29'),'data1':_0x7d3c('0x58')},_0x28b994));}});return db[_0x7d3c('0x45')][_0x7d3c('0x32')](_0x1a7cc2[_0x7d3c('0x59')](_0x3d4ed2),{'individualHooks':!![]});}})[_0x7d3c('0x19')](function(){if(_0x5e56b8){return _0x5e56b8['update']({'online':!![],'lastLoginAt':moment()['format'](_0x7d3c('0x2b')),'voicePause':_0x5e56b8[_0x7d3c('0x4b')]||![],'mailPause':_0x5e56b8[_0x7d3c('0x4b')]||![],'chatPause':_0x5e56b8['loginInPause']||![],'faxPause':_0x5e56b8[_0x7d3c('0x4b')]||![],'smsPause':_0x5e56b8['loginInPause']||![],'openchannelPause':_0x5e56b8['loginInPause']||![],'pauseType':_0x5e56b8[_0x7d3c('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x7d3c('0x26')](_0x7d3c('0x2b')),'interface':_0x27db93});}})[_0x7d3c('0x19')](function(_0x39102f){_0x334bfb(_0x39102f);})[_0x7d3c('0x1d')](function(_0x59f96e){_0x2ee653(_0x490bce[_0x7d3c('0x1e')](0x1f4,_0x59f96e[_0x7d3c('0x1f')]));});});}; \ No newline at end of file +var _0xa648=['LoginUser','mobile','phone','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','GetUser','User','options','raw','where','attributes','limit','include','model','map','then','info','stringify','catch','error','message','find','ShowUser','PauseUser','name','role','internal','interface','update','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','findOne','online','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','UserVoiceQueueRt','forEach','all'];(function(_0x23c913,_0x2fce64){var _0x294274=function(_0x4ba6f6){while(--_0x4ba6f6){_0x23c913['push'](_0x23c913['shift']());}};_0x294274(++_0x2fce64);}(_0xa648,0x1b7));var _0x8a64=function(_0x2614b5,_0x39a45d){_0x2614b5=_0x2614b5-0x0;var _0x5be462=_0xa648[_0x2614b5];return _0x5be462;};'use strict';var _=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var moment=require('moment');var BPromise=require(_0x8a64('0x2'));var Redis=require(_0x8a64('0x3'));var db=require(_0x8a64('0x4'))['db'];var utils=require(_0x8a64('0x5'));var logger=require(_0x8a64('0x6'))(_0x8a64('0x7'));var config=require(_0x8a64('0x8'));config['redis']=_[_0x8a64('0x9')](config[_0x8a64('0xa')],{'host':_0x8a64('0xb'),'port':0x18eb});var socket=require(_0x8a64('0xc'))(new Redis(config[_0x8a64('0xa')]));require('./user.socket')[_0x8a64('0xd')](socket);exports[_0x8a64('0xe')]=function(_0x32b75b){var _0x51336d=this;return new Promise(function(_0x5e5606,_0x4bdd21){return db[_0x8a64('0xf')]['findAll']({'raw':_0x32b75b[_0x8a64('0x10')]?_0x32b75b[_0x8a64('0x10')][_0x8a64('0x11')]===undefined?!![]:![]:!![],'where':_0x32b75b['options']?_0x32b75b['options'][_0x8a64('0x12')]||null:null,'attributes':_0x32b75b['options']?_0x32b75b[_0x8a64('0x10')][_0x8a64('0x13')]||null:null,'limit':_0x32b75b['options']?_0x32b75b[_0x8a64('0x10')][_0x8a64('0x14')]||null:null,'include':_0x32b75b[_0x8a64('0x10')]?_0x32b75b[_0x8a64('0x10')]['include']?_['map'](_0x32b75b['options'][_0x8a64('0x15')],function(_0x14eff7){return{'model':db[_0x14eff7[_0x8a64('0x16')]],'as':_0x14eff7['as'],'attributes':_0x14eff7['attributes'],'include':_0x14eff7['include']?_[_0x8a64('0x17')](_0x14eff7[_0x8a64('0x15')],function(_0x30a44f){return{'model':db[_0x30a44f['model']],'as':_0x30a44f['as'],'attributes':_0x30a44f[_0x8a64('0x13')],'include':_0x30a44f['include']?_['map'](_0x30a44f[_0x8a64('0x15')],function(_0x412c58){return{'model':db[_0x412c58[_0x8a64('0x16')]],'as':_0x412c58['as'],'attributes':_0x412c58['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a64('0x18')](function(_0x3b2f90){logger[_0x8a64('0x19')](_0x8a64('0xe'),_0x32b75b);logger['debug']('GetUser',_0x32b75b,JSON[_0x8a64('0x1a')](_0x3b2f90));_0x5e5606(_0x3b2f90);})[_0x8a64('0x1b')](function(_0x474557){logger[_0x8a64('0x1c')]('GetUser',_0x474557[_0x8a64('0x1d')],_0x32b75b);_0x4bdd21(_0x51336d['error'](0x1f4,_0x474557['message']));});});};exports['ShowUser']=function(_0x5d9e42){var _0x54a93c=this;return new Promise(function(_0x54fdb7,_0x444447){return db[_0x8a64('0xf')][_0x8a64('0x1e')]({'raw':_0x5d9e42[_0x8a64('0x10')]?_0x5d9e42[_0x8a64('0x10')][_0x8a64('0x11')]===undefined?!![]:![]:!![],'where':_0x5d9e42[_0x8a64('0x10')]?_0x5d9e42['options'][_0x8a64('0x12')]||null:null,'attributes':_0x5d9e42[_0x8a64('0x10')]?_0x5d9e42[_0x8a64('0x10')]['attributes']||null:null,'include':_0x5d9e42[_0x8a64('0x10')]?_0x5d9e42[_0x8a64('0x10')]['include']?_[_0x8a64('0x17')](_0x5d9e42['options'][_0x8a64('0x15')],function(_0x5e6253){return{'model':db[_0x5e6253[_0x8a64('0x16')]],'as':_0x5e6253['as'],'attributes':_0x5e6253[_0x8a64('0x13')],'include':_0x5e6253[_0x8a64('0x15')]?_[_0x8a64('0x17')](_0x5e6253[_0x8a64('0x15')],function(_0x4570e8){return{'model':db[_0x4570e8['model']],'as':_0x4570e8['as'],'attributes':_0x4570e8[_0x8a64('0x13')],'include':_0x4570e8[_0x8a64('0x15')]?_['map'](_0x4570e8['include'],function(_0x3bcf5f){return{'model':db[_0x3bcf5f[_0x8a64('0x16')]],'as':_0x3bcf5f['as'],'attributes':_0x3bcf5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a64('0x18')](function(_0x249262){logger[_0x8a64('0x19')](_0x8a64('0x1f'),_0x5d9e42);logger['debug'](_0x8a64('0x1f'),_0x5d9e42,JSON[_0x8a64('0x1a')](_0x249262));_0x54fdb7(_0x249262);})[_0x8a64('0x1b')](function(_0x3207fd){logger['error'](_0x8a64('0x1f'),_0x3207fd['message'],_0x5d9e42);_0x444447(_0x54a93c[_0x8a64('0x1c')](0x1f4,_0x3207fd[_0x8a64('0x1d')]));});});};exports[_0x8a64('0x20')]=function(_0x3075a6){var _0x377b64;return db[_0x8a64('0xf')][_0x8a64('0x1e')]({'where':_0x3075a6[_0x8a64('0x10')]['where']||{},'attributes':['id',_0x8a64('0x21'),_0x8a64('0x22'),_0x8a64('0x23'),_0x8a64('0x24')]})[_0x8a64('0x18')](function(_0xf991f9){if(!_0xf991f9){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3075a6['params']['id']));}_0x377b64=_0xf991f9;return db['UserVoiceQueueRt'][_0x8a64('0x25')]({'paused':0x1},{'where':{'UserId':_0x377b64['id']},'individualHooks':!![]});})[_0x8a64('0x18')](function(){return db['MemberReport'][_0x8a64('0x26')]({'where':{'membername':_0x377b64[_0x8a64('0x21')],'type':'PAUSE','exitAt':null}});})[_0x8a64('0x18')](function(_0x3f7e55){if(_0x3f7e55&&_0x3f7e55[_0x8a64('0x27')]){var _0x52bd39=moment()[_0x8a64('0x28')](_0x8a64('0x29'));for(var _0x26005b=0x0,_0xf238d4=_0x3f7e55[_0x8a64('0x27')];_0x26005b<_0xf238d4;_0x26005b++){_0x3f7e55[_0x26005b][_0x8a64('0x2a')]({'exitAt':_0x52bd39});}}})[_0x8a64('0x18')](function(){var _0x66a4a0=[];var _0x4b07b8=utils[_0x8a64('0x2b')]();_0x4b07b8['forEach'](function(_0x5f57ca){_0x66a4a0[_0x8a64('0x2c')]({'channel':_0x5f57ca,'membername':_0x377b64[_0x8a64('0x21')],'interface':_['isNil'](_0x377b64[_0x8a64('0x24')])?util[_0x8a64('0x28')](_0x8a64('0x2d'),_0x377b64[_0x8a64('0x21')]):_0x377b64[_0x8a64('0x24')],'type':_0x8a64('0x2e'),'enterAt':moment()[_0x8a64('0x28')](_0x8a64('0x29')),'data1':_0x3075a6[_0x8a64('0x2f')][_0x8a64('0x30')]||_0x8a64('0x31'),'role':_0x377b64[_0x8a64('0x22')],'internal':_0x377b64[_0x8a64('0x23')],'uniqueid':_0x3075a6[_0x8a64('0x2f')][_0x8a64('0x32')]||null});});return db[_0x8a64('0x33')][_0x8a64('0x34')](_0x66a4a0,{'individualHooks':!![]});})[_0x8a64('0x18')](function(){return _0x377b64[_0x8a64('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3075a6['body'][_0x8a64('0x30')]||_0x8a64('0x31'),'lastPauseAt':moment()[_0x8a64('0x28')](_0x8a64('0x29'))});})['catch'](function(_0x217679){throw _0x217679;});};exports[_0x8a64('0x35')]=function(_0x3e154c){return Promise[_0x8a64('0x36')]()[_0x8a64('0x18')](function(){if(_0x3e154c[_0x8a64('0x2f')][_0x8a64('0x37')]&&!utils[_0x8a64('0x38')](_0x3e154c[_0x8a64('0x2f')][_0x8a64('0x37')])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3e154c[_0x8a64('0x2f')][_0x8a64('0x37')]));}return db[_0x8a64('0xf')][_0x8a64('0x39')]({'where':_0x3e154c[_0x8a64('0x10')][_0x8a64('0x12')]||{},'attributes':['id',_0x8a64('0x21'),'role',_0x8a64('0x23'),_0x8a64('0x24'),_0x8a64('0x3a'),'voicePause',_0x8a64('0x3b'),_0x8a64('0x3c'),'faxPause',_0x8a64('0x3d'),_0x8a64('0x3e'),_0x8a64('0x3f'),'pauseType','lastPauseAt']});})['then'](function(_0x3f5c3b){if(!_0x3f5c3b){throw new Error(util['format'](_0x8a64('0x40'),_0x3e154c['params']['id']));}return _0x3f5c3b[_0x8a64('0x41')](_0x3e154c['body']['channel'],_0x8a64('0x42'));})[_0x8a64('0x1b')](function(_0x12ef7d){throw _0x12ef7d;});};exports[_0x8a64('0x43')]=function(_0x47650b){var _0x158fee=this;return new Promise(function(_0x3d19cc,_0xa55ef){var _0x39c25f;return db[_0x8a64('0xf')]['findOne']({'where':_0x47650b[_0x8a64('0x10')][_0x8a64('0x12')]||{},'attributes':['id',_0x8a64('0x21')]})[_0x8a64('0x18')](function(_0x25e967){if(_0x25e967){_0x39c25f=_0x25e967;return db[_0x8a64('0x44')]['destroy']({'where':{'membername':_0x39c25f[_0x8a64('0x21')]},'individualHooks':!![]});}})[_0x8a64('0x18')](function(){if(_0x39c25f){return db[_0x8a64('0x33')][_0x8a64('0x26')]({'where':{'membername':_0x39c25f[_0x8a64('0x21')],'exitAt':null}});}})[_0x8a64('0x18')](function(_0x1e56b6){if(_0x39c25f){if(_0x1e56b6&&_0x1e56b6['length']){var _0x51c86b=[];_0x1e56b6[_0x8a64('0x45')](function(_0x4d5e17){_0x51c86b['push'](_0x4d5e17[_0x8a64('0x25')]({'exitAt':moment()[_0x8a64('0x28')](_0x8a64('0x29'))}));});return BPromise[_0x8a64('0x46')](_0x51c86b);}}})[_0x8a64('0x18')](function(){if(_0x39c25f){return _0x39c25f[_0x8a64('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x8a64('0x18')](function(_0x4c1302){_0x3d19cc(_0x4c1302);})['catch'](function(_0x3afff9){_0xa55ef(_0x158fee[_0x8a64('0x1c')](0x1f4,_0x3afff9[_0x8a64('0x1d')]));});});};exports[_0x8a64('0x47')]=function(_0x1029e2){var _0x910074=this;return new Promise(function(_0x3c06dd,_0x442ce7){var _0x405528;var _0x1eac8d;var _0x805ed1;var _0x50445d;return db['User'][_0x8a64('0x39')]({'where':_0x1029e2[_0x8a64('0x10')]['where']||{},'attributes':['id',_0x8a64('0x21'),_0x8a64('0x22'),_0x8a64('0x48'),_0x8a64('0x49'),_0x8a64('0x23'),'loginInPause',_0x8a64('0x24')]})[_0x8a64('0x18')](function(_0x5cb091){if(_0x5cb091){_0x405528=_0x5cb091;_0x50445d=_0x1029e2[_0x8a64('0x2f')][_0x8a64('0x24')]?_0x1029e2[_0x8a64('0x2f')][_0x8a64('0x24')]:util[_0x8a64('0x28')](_0x8a64('0x2d'),_0x405528['name']);return db[_0x8a64('0xf')][_0x8a64('0x4a')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x405528['id']}}});}})[_0x8a64('0x18')](function(_0x484934){if(_0x484934){_0x805ed1=_0x484934;return require(_0x8a64('0x4b'))[_0x8a64('0x4c')]();}})[_0x8a64('0x18')](function(_0x1b257f){if(_0x1b257f&&_0x1b257f[_0x8a64('0x4d')]&&_0x805ed1>=_0x1b257f[_0x8a64('0x4d')]){throw new Error(_0x8a64('0x4e'));}})[_0x8a64('0x18')](function(){if(_0x405528){return db[_0x8a64('0x44')]['destroy']({'where':{'membername':_0x405528[_0x8a64('0x21')]},'individualHooks':!![]});}})[_0x8a64('0x18')](function(){if(_0x405528){return _0x405528['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x177b1d){if(_0x405528){if(_0x177b1d){var _0x2e014a=[];_0x1eac8d=_0x177b1d;if(_0x1eac8d[_0x8a64('0x27')]){for(var _0x283214=0x0;_0x283214<_0x1eac8d[_0x8a64('0x27')];_0x283214++){_0x2e014a[_0x8a64('0x2c')](db[_0x8a64('0x44')]['upsert']({'membername':_0x405528[_0x8a64('0x21')],'UserId':_0x405528['id'],'queue_name':_0x1eac8d[_0x283214][_0x8a64('0x21')],'VoiceQueueId':_0x1eac8d[_0x283214]['id'],'interface':_0x50445d,'paused':_0x405528[_0x8a64('0x4f')]||![],'penalty':_0x1eac8d[_0x283214][_0x8a64('0x50')]||0x0}));}return BPromise[_0x8a64('0x46')](_0x2e014a);}}}})[_0x8a64('0x18')](function(){if(_0x405528){return db[_0x8a64('0x33')]['findAll']({'where':{'membername':_0x405528[_0x8a64('0x21')],'exitAt':null}});}})[_0x8a64('0x18')](function(_0x2d49a0){if(_0x405528){if(_0x2d49a0&&_0x2d49a0[_0x8a64('0x27')]){var _0x322242=[];_0x2d49a0[_0x8a64('0x45')](function(_0x266e3f){_0x322242['push'](_0x266e3f[_0x8a64('0x25')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8a64('0x46')](_0x322242);}}})[_0x8a64('0x18')](function(){if(_0x405528){var _0x347040=[];var _0x397c9a=[];var _0x3ac27a=utils[_0x8a64('0x2b')]();var _0x580b2b={'membername':_0x405528[_0x8a64('0x21')],'interface':_0x50445d,'enterAt':moment()[_0x8a64('0x28')](_0x8a64('0x29')),'role':_0x405528[_0x8a64('0x22')],'internal':_0x405528['internal']};_0x3ac27a[_0x8a64('0x45')](function(_0x30ff70){_0x347040[_0x8a64('0x2c')](_[_0x8a64('0x51')]({'channel':_0x30ff70,'type':_0x8a64('0x52'),'data1':_0x8a64('0x53'),'data2':_0x50445d},_0x580b2b));if(_0x405528[_0x8a64('0x4f')]){_0x397c9a[_0x8a64('0x2c')](_['merge']({'channel':_0x30ff70,'type':_0x8a64('0x2e'),'data1':'LOGININPAUSE'},_0x580b2b));}});return db['MemberReport'][_0x8a64('0x34')](_0x347040[_0x8a64('0x54')](_0x397c9a),{'individualHooks':!![]});}})[_0x8a64('0x18')](function(){if(_0x405528){return _0x405528[_0x8a64('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0x8a64('0x29')),'voicePause':_0x405528[_0x8a64('0x4f')]||![],'mailPause':_0x405528['loginInPause']||![],'chatPause':_0x405528[_0x8a64('0x4f')]||![],'faxPause':_0x405528[_0x8a64('0x4f')]||![],'smsPause':_0x405528[_0x8a64('0x4f')]||![],'openchannelPause':_0x405528[_0x8a64('0x4f')]||![],'pauseType':_0x405528[_0x8a64('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x8a64('0x28')](_0x8a64('0x29')),'interface':_0x50445d});}})[_0x8a64('0x18')](function(_0xd56232){_0x3c06dd(_0xd56232);})[_0x8a64('0x1b')](function(_0x57e5d4){_0x442ce7(_0x910074[_0x8a64('0x1c')](0x1f4,_0x57e5d4['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f0775a6..201d16c 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 _0x5113=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0xe50100,_0x998ce3){var _0x191c48=function(_0x5a1484){while(--_0x5a1484){_0xe50100['push'](_0xe50100['shift']());}};_0x191c48(++_0x998ce3);}(_0x5113,0x105));var _0x3511=function(_0x2a05bf,_0x55e3a4){_0x2a05bf=_0x2a05bf-0x0;var _0x38a62e=_0x5113[_0x2a05bf];return _0x38a62e;};'use strict';var UserEvents=require(_0x3511('0x0'));var events=[_0x3511('0x1'),_0x3511('0x2'),_0x3511('0x3')];function createListener(_0x4390f0,_0x3e39c7){return function(_0x39d92b){_0x3e39c7[_0x3511('0x4')](_0x4390f0,_0x39d92b);};}function removeListener(_0x4543a0,_0x1de300){return function(){UserEvents[_0x3511('0x5')](_0x4543a0,_0x1de300);};}exports[_0x3511('0x6')]=function(_0x14012f){for(var _0x1f442b=0x0,_0x301c59=events[_0x3511('0x7')];_0x1f442b<_0x301c59;_0x1f442b++){var _0x64a120=events[_0x1f442b];var _0x3ddb85=createListener(_0x3511('0x8')+_0x64a120,_0x14012f);UserEvents['on'](_0x64a120,_0x3ddb85);}}; \ No newline at end of file +var _0x71a4=['removeListener','register','length','save','remove'];(function(_0x39f85c,_0x54d68b){var _0x124ff3=function(_0x291cdc){while(--_0x291cdc){_0x39f85c['push'](_0x39f85c['shift']());}};_0x124ff3(++_0x54d68b);}(_0x71a4,0x1de));var _0x471a=function(_0x465c38,_0x290e5d){_0x465c38=_0x465c38-0x0;var _0x4dc91f=_0x71a4[_0x465c38];return _0x4dc91f;};'use strict';var UserEvents=require('./user.events');var events=[_0x471a('0x0'),_0x471a('0x1'),'update'];function createListener(_0x5bc603,_0x2991f3){return function(_0x464e9b){_0x2991f3['emit'](_0x5bc603,_0x464e9b);};}function removeListener(_0x4d5549,_0x4709cb){return function(){UserEvents[_0x471a('0x2')](_0x4d5549,_0x4709cb);};}exports[_0x471a('0x3')]=function(_0x2778b4){for(var _0x169cf5=0x0,_0x10ee94=events[_0x471a('0x4')];_0x169cf5<_0x10ee94;_0x169cf5++){var _0xa6dfdb=events[_0x169cf5];var _0x24bc56=createListener('user:'+_0xa6dfdb,_0x2778b4);UserEvents['on'](_0xa6dfdb,_0x24bc56);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9e2692a..23d3e71 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x564c3f,_0x563c13){var _0xdeb099=function(_0x3a4b97){while(--_0x3a4b97){_0x564c3f['push'](_0x564c3f['shift']());}};_0xdeb099(++_0x563c13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4f9d4e,_0x546f3d){var _0x3c8998=function(_0x1e93b5){while(--_0x1e93b5){_0x4f9d4e['push'](_0x4f9d4e['shift']());}};_0x3c8998(++_0x546f3d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xcb91[_0x3a04ab];return _0x4bff6d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 30ba291..27a1ecd 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 _0xb8f1=['exports','sequelize'];(function(_0x515c82,_0x4d6af6){var _0x2f774d=function(_0x10dcf0){while(--_0x10dcf0){_0x515c82['push'](_0x515c82['shift']());}};_0x2f774d(++_0x4d6af6);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x1f7bea,_0x411dd6){_0x1f7bea=_0x1f7bea-0x0;var _0xdb9a17=_0xb8f1[_0x1f7bea];return _0xdb9a17;};'use strict';var Sequelize=require(_0x1b8f('0x0'));module[_0x1b8f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf3d1=['exports','INTEGER'];(function(_0x1fabd7,_0x3bed33){var _0x5314a1=function(_0x30e23b){while(--_0x30e23b){_0x1fabd7['push'](_0x1fabd7['shift']());}};_0x5314a1(++_0x3bed33);}(_0xf3d1,0x1da));var _0x1f3d=function(_0x1e9dd1,_0x2e180a){_0x1e9dd1=_0x1e9dd1-0x0;var _0x1752dc=_0xf3d1[_0x1e9dd1];return _0x1752dc;};'use strict';var Sequelize=require('sequelize');module[_0x1f3d('0x0')]={'penalty':{'type':Sequelize[_0x1f3d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b2756d1..b337c17 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 _0x4e86=['request-promise','path','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird'];(function(_0x1764f5,_0x4a119f){var _0x1ac765=function(_0x143dbb){while(--_0x143dbb){_0x1764f5['push'](_0x1764f5['shift']());}};_0x1ac765(++_0x4a119f);}(_0x4e86,0x15b));var _0x64e8=function(_0x58682e,_0x48176d){_0x58682e=_0x58682e-0x0;var _0x533e59=_0x4e86[_0x58682e];return _0x533e59;};'use strict';var _=require(_0x64e8('0x0'));var util=require(_0x64e8('0x1'));var logger=require('../../config/logger')(_0x64e8('0x2'));var moment=require(_0x64e8('0x3'));var BPromise=require(_0x64e8('0x4'));var rp=require(_0x64e8('0x5'));var fs=require('fs');var path=require(_0x64e8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64e8('0x7'));module['exports']=function(_0x372e4d,_0x3e590a){return _0x372e4d[_0x64e8('0x8')](_0x64e8('0x9'),attributes,{'tableName':_0x64e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x554f=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','request-promise','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x554f,0x1d2));var _0xf554=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x554f[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0xf554('0x0'));var logger=require(_0xf554('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf554('0x2'));var fs=require('fs');var path=require(_0xf554('0x3'));var rimraf=require('rimraf');var config=require(_0xf554('0x4'));var attributes=require(_0xf554('0x5'));module[_0xf554('0x6')]=function(_0x309bda,_0x5dfc3d){return _0x309bda[_0xf554('0x7')](_0xf554('0x8'),attributes,{'tableName':_0xf554('0x9'),'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 88c5ce3..5e832e0 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 _0xe83e=['stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe83e,0x1bb));var _0xee83=function(_0x124e1e,_0x2752eb){_0x124e1e=_0x124e1e-0x0;var _0x11f146=_0xe83e[_0x124e1e];return _0x11f146;};'use strict';var _=require(_0xee83('0x0'));var util=require(_0xee83('0x1'));var moment=require(_0xee83('0x2'));var BPromise=require(_0xee83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee83('0x4'))['db'];var utils=require(_0xee83('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xee83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xee83('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4457fe,_0x19c982,_0xecc2f6){return new BPromise(function(_0x1cc11f,_0x3e5284){return client[_0xee83('0x8')](_0x4457fe,_0xecc2f6)[_0xee83('0x9')](function(_0x593221){logger[_0xee83('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x19c982,_0xee83('0xb'));logger['debug'](_0xee83('0xc'),_0x19c982,_0xee83('0xb'),JSON[_0xee83('0xd')](_0x593221));if(_0x593221[_0xee83('0xe')]){if(_0x593221['error']['code']===0x1f4){logger[_0xee83('0xe')](_0xee83('0xf'),_0x19c982,_0x593221[_0xee83('0xe')][_0xee83('0x10')]);return _0x3e5284(_0x593221[_0xee83('0xe')]['message']);}logger[_0xee83('0xe')](_0xee83('0xf'),_0x19c982,_0x593221['error'][_0xee83('0x10')]);return _0x1cc11f(_0x593221['error'][_0xee83('0x10')]);}else{logger[_0xee83('0xa')](_0xee83('0xf'),_0x19c982,_0xee83('0xb'));_0x1cc11f(_0x593221[_0xee83('0x11')]['message']);}})[_0xee83('0x12')](function(_0xd911e2){logger[_0xee83('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x19c982,_0xd911e2);_0x3e5284(_0xd911e2);});});} \ No newline at end of file +var _0x6118=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x53f3a3,_0x5c6645){var _0x192038=function(_0x253791){while(--_0x253791){_0x53f3a3['push'](_0x53f3a3['shift']());}};_0x192038(++_0x5c6645);}(_0x6118,0x12b));var _0x8611=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6118[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x8611('0x0'));var util=require(_0x8611('0x1'));var moment=require(_0x8611('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8611('0x3'));var db=require(_0x8611('0x4'))['db'];var utils=require(_0x8611('0x5'));var logger=require(_0x8611('0x6'))(_0x8611('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8611('0x8')][_0x8611('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49cb3f,_0x1c27f0,_0x167b62){return new BPromise(function(_0x55df10,_0x99bfad){return client[_0x8611('0xa')](_0x49cb3f,_0x167b62)[_0x8611('0xb')](function(_0x1349c9){logger[_0x8611('0xc')](_0x8611('0xd'),_0x1c27f0,_0x8611('0xe'));logger['debug'](_0x8611('0xf'),_0x1c27f0,'request\x20sent',JSON[_0x8611('0x10')](_0x1349c9));if(_0x1349c9[_0x8611('0x11')]){if(_0x1349c9['error'][_0x8611('0x12')]===0x1f4){logger[_0x8611('0x11')](_0x8611('0xd'),_0x1c27f0,_0x1349c9[_0x8611('0x11')][_0x8611('0x13')]);return _0x99bfad(_0x1349c9['error']['message']);}logger[_0x8611('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x1c27f0,_0x1349c9[_0x8611('0x11')][_0x8611('0x13')]);return _0x55df10(_0x1349c9[_0x8611('0x11')]['message']);}else{logger[_0x8611('0xc')](_0x8611('0xd'),_0x1c27f0,_0x8611('0xe'));_0x55df10(_0x1349c9[_0x8611('0x14')]['message']);}})[_0x8611('0x15')](function(_0x2733ba){logger[_0x8611('0x11')](_0x8611('0xd'),_0x1c27f0,_0x2733ba);_0x99bfad(_0x2733ba);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 26ed12f..351375a 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4615e3,_0x180d64){var _0x5c256b=function(_0x972847){while(--_0x972847){_0x4615e3['push'](_0x4615e3['shift']());}};_0x5c256b(++_0x180d64);}(_0x70e0,0x17b));var _0x070e=function(_0x4cdc1e,_0x58b9aa){_0x4cdc1e=_0x4cdc1e-0x0;var _0x148572=_0x70e0[_0x4cdc1e];return _0x148572;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x21f449,_0x1fa685){var _0x58f2ae=function(_0x52c003){while(--_0x52c003){_0x21f449['push'](_0x21f449['shift']());}};_0x58f2ae(++_0x1fa685);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xcb91[_0x166742];return _0xb7814a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e0fd6cb..8633c76 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 _0xc216=['INTEGER','STRING','sequelize','exports'];(function(_0x40303d,_0x540882){var _0x5d72bd=function(_0x8ec349){while(--_0x8ec349){_0x40303d['push'](_0x40303d['shift']());}};_0x5d72bd(++_0x540882);}(_0xc216,0x1c6));var _0x6c21=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xc216[_0xb833b1];return _0x1ab87a;};'use strict';var Sequelize=require(_0x6c21('0x0'));module[_0x6c21('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6c21('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6c21('0x3')]}}; \ No newline at end of file +var _0x45e7=['exports','INTEGER','STRING','sequelize'];(function(_0x51bc61,_0x4bec20){var _0x19fc7a=function(_0x43cf3d){while(--_0x43cf3d){_0x51bc61['push'](_0x51bc61['shift']());}};_0x19fc7a(++_0x4bec20);}(_0x45e7,0x177));var _0x745e=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x45e7[_0x22431e];return _0xd978e9;};'use strict';var Sequelize=require(_0x745e('0x0'));module[_0x745e('0x1')]={'penalty':{'type':Sequelize[_0x745e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x745e('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 35d623c..e7cd86d 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 _0xddb5=['moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xddb5,0x168));var _0x5ddb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xddb5[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5ddb('0x0'));var util=require(_0x5ddb('0x1'));var logger=require(_0x5ddb('0x2'))('api');var moment=require(_0x5ddb('0x3'));var BPromise=require(_0x5ddb('0x4'));var rp=require(_0x5ddb('0x5'));var fs=require('fs');var path=require(_0x5ddb('0x6'));var rimraf=require('rimraf');var config=require(_0x5ddb('0x7'));var attributes=require(_0x5ddb('0x8'));module['exports']=function(_0x51dff7,_0x2ac6a9){return _0x51dff7['define'](_0x5ddb('0x9'),attributes,{'tableName':_0x5ddb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf3d=['../../config/logger','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xbf3d,0x70));var _0xdbf3=function(_0x528737,_0x1a0d76){_0x528737=_0x528737-0x0;var _0x2fe56b=_0xbf3d[_0x528737];return _0x2fe56b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdbf3('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdbf3('0x1'));var fs=require('fs');var path=require(_0xdbf3('0x2'));var rimraf=require(_0xdbf3('0x3'));var config=require(_0xdbf3('0x4'));var attributes=require(_0xdbf3('0x5'));module['exports']=function(_0x1c91e1,_0x2e8e93){return _0x1c91e1[_0xdbf3('0x6')]('UserFaxQueue',attributes,{'tableName':_0xdbf3('0x7'),'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 489bbcb..ffb8b36 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 _0x4a2a=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x254a5f,_0x5b5887){var _0x27998c=function(_0x1067b9){while(--_0x1067b9){_0x254a5f['push'](_0x254a5f['shift']());}};_0x27998c(++_0x5b5887);}(_0x4a2a,0x113));var _0xa4a2=function(_0x19f7aa,_0x1e0138){_0x19f7aa=_0x19f7aa-0x0;var _0x19f635=_0x4a2a[_0x19f7aa];return _0x19f635;};'use strict';var _=require(_0xa4a2('0x0'));var util=require(_0xa4a2('0x1'));var moment=require(_0xa4a2('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4a2('0x4'))['db'];var utils=require(_0xa4a2('0x5'));var logger=require('../../config/logger')(_0xa4a2('0x6'));var config=require(_0xa4a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa4a2('0x8')][_0xa4a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9048b1,_0x5a29f1,_0x54452c){return new BPromise(function(_0x1cb40a,_0x15b5d2){return client['request'](_0x9048b1,_0x54452c)[_0xa4a2('0xa')](function(_0x37ed46){logger[_0xa4a2('0xb')](_0xa4a2('0xc'),_0x5a29f1,_0xa4a2('0xd'));logger[_0xa4a2('0xe')](_0xa4a2('0xf'),_0x5a29f1,'request\x20sent',JSON[_0xa4a2('0x10')](_0x37ed46));if(_0x37ed46[_0xa4a2('0x11')]){if(_0x37ed46[_0xa4a2('0x11')][_0xa4a2('0x12')]===0x1f4){logger[_0xa4a2('0x11')](_0xa4a2('0xc'),_0x5a29f1,_0x37ed46['error'][_0xa4a2('0x13')]);return _0x15b5d2(_0x37ed46[_0xa4a2('0x11')][_0xa4a2('0x13')]);}logger[_0xa4a2('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x5a29f1,_0x37ed46[_0xa4a2('0x11')][_0xa4a2('0x13')]);return _0x1cb40a(_0x37ed46[_0xa4a2('0x11')][_0xa4a2('0x13')]);}else{logger['info'](_0xa4a2('0xc'),_0x5a29f1,_0xa4a2('0xd'));_0x1cb40a(_0x37ed46['result']['message']);}})[_0xa4a2('0x14')](function(_0xf312b9){logger[_0xa4a2('0x11')](_0xa4a2('0xc'),_0x5a29f1,_0xf312b9);_0x15b5d2(_0xf312b9);});});} \ No newline at end of file +var _0x10aa=['code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1be184,_0x280366){var _0x5be223=function(_0x23ada3){while(--_0x23ada3){_0x1be184['push'](_0x1be184['shift']());}};_0x5be223(++_0x280366);}(_0x10aa,0x17b));var _0xa10a=function(_0x4ad512,_0x9a88a0){_0x4ad512=_0x4ad512-0x0;var _0x1bfba7=_0x10aa[_0x4ad512];return _0x1bfba7;};'use strict';var _=require(_0xa10a('0x0'));var util=require('util');var moment=require(_0xa10a('0x1'));var BPromise=require(_0xa10a('0x2'));var rs=require(_0xa10a('0x3'));var fs=require('fs');var Redis=require(_0xa10a('0x4'));var db=require(_0xa10a('0x5'))['db'];var utils=require(_0xa10a('0x6'));var logger=require(_0xa10a('0x7'))(_0xa10a('0x8'));var config=require(_0xa10a('0x9'));var jayson=require(_0xa10a('0xa'));var client=jayson['client'][_0xa10a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c2f8,_0x5a1680,_0x417e25){return new BPromise(function(_0x60cb50,_0x5be624){return client['request'](_0x16c2f8,_0x417e25)['then'](function(_0x11e8f0){logger[_0xa10a('0xc')](_0xa10a('0xd'),_0x5a1680,_0xa10a('0xe'));logger['debug'](_0xa10a('0xf'),_0x5a1680,_0xa10a('0xe'),JSON[_0xa10a('0x10')](_0x11e8f0));if(_0x11e8f0['error']){if(_0x11e8f0['error'][_0xa10a('0x11')]===0x1f4){logger['error'](_0xa10a('0xd'),_0x5a1680,_0x11e8f0['error']['message']);return _0x5be624(_0x11e8f0[_0xa10a('0x12')][_0xa10a('0x13')]);}logger[_0xa10a('0x12')](_0xa10a('0xd'),_0x5a1680,_0x11e8f0[_0xa10a('0x12')][_0xa10a('0x13')]);return _0x60cb50(_0x11e8f0[_0xa10a('0x12')]['message']);}else{logger[_0xa10a('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x5a1680,_0xa10a('0xe'));_0x60cb50(_0x11e8f0[_0xa10a('0x14')][_0xa10a('0x13')]);}})[_0xa10a('0x15')](function(_0x3a14c6){logger[_0xa10a('0x12')](_0xa10a('0xd'),_0x5a1680,_0x3a14c6);_0x5be624(_0x3a14c6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f5393ed..8b388dd 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4214c5,_0x484996){var _0x468a73=function(_0x5bd2ac){while(--_0x5bd2ac){_0x4214c5['push'](_0x4214c5['shift']());}};_0x468a73(++_0x484996);}(_0xedd9,0xfc));var _0x9edd=function(_0x307374,_0x52f551){_0x307374=_0x307374-0x0;var _0x31c272=_0xedd9[_0x307374];return _0x31c272;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5ac92d,_0x14061b){var _0x1abd6e=function(_0x241e4e){while(--_0x241e4e){_0x5ac92d['push'](_0x5ac92d['shift']());}};_0x1abd6e(++_0x14061b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 81e15ca..4a5b69f 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 _0x0971=['INTEGER','sequelize','exports'];(function(_0x53aba4,_0x559c7d){var _0x538e6a=function(_0x459c3b){while(--_0x459c3b){_0x53aba4['push'](_0x53aba4['shift']());}};_0x538e6a(++_0x559c7d);}(_0x0971,0xee));var _0x1097=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x0971[_0x4b03c9];return _0x161ba2;};'use strict';var Sequelize=require(_0x1097('0x0'));module[_0x1097('0x1')]={'penalty':{'type':Sequelize[_0x1097('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x08aa=['exports','INTEGER'];(function(_0x386d12,_0x3a8cc8){var _0x4e2d68=function(_0x76107e){while(--_0x76107e){_0x386d12['push'](_0x386d12['shift']());}};_0x4e2d68(++_0x3a8cc8);}(_0x08aa,0x9a));var _0xa08a=function(_0x1ce5e0,_0x17c973){_0x1ce5e0=_0x1ce5e0-0x0;var _0x1b7a74=_0x08aa[_0x1ce5e0];return _0x1b7a74;};'use strict';var Sequelize=require('sequelize');module[_0xa08a('0x0')]={'penalty':{'type':Sequelize[_0xa08a('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 c8d7c04..9de76d2 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 _0x7088=['api','moment','bluebird','path','rimraf','../../config/environment','exports','UserMailQueue','user_has_mail_queues','lodash','../../config/logger'];(function(_0x33eed5,_0x20c5f6){var _0x2c27da=function(_0x144512){while(--_0x144512){_0x33eed5['push'](_0x33eed5['shift']());}};_0x2c27da(++_0x20c5f6);}(_0x7088,0x1c1));var _0x8708=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7088[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x8708('0x0'));var util=require('util');var logger=require(_0x8708('0x1'))(_0x8708('0x2'));var moment=require(_0x8708('0x3'));var BPromise=require(_0x8708('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8708('0x5'));var rimraf=require(_0x8708('0x6'));var config=require(_0x8708('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x8708('0x8')]=function(_0x9d09d1,_0x599de8){return _0x9d09d1['define'](_0x8708('0x9'),attributes,{'tableName':_0x8708('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca14=['../../config/logger','api','moment','bluebird','path','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues'];(function(_0x50a69c,_0x302258){var _0x197d9b=function(_0x380449){while(--_0x380449){_0x50a69c['push'](_0x50a69c['shift']());}};_0x197d9b(++_0x302258);}(_0xca14,0x172));var _0x4ca1=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0xca14[_0x5869f5];return _0x6beba1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ca1('0x0'))(_0x4ca1('0x1'));var moment=require(_0x4ca1('0x2'));var BPromise=require(_0x4ca1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ca1('0x4'));var rimraf=require('rimraf');var config=require(_0x4ca1('0x5'));var attributes=require(_0x4ca1('0x6'));module[_0x4ca1('0x7')]=function(_0x196349,_0x31e952){return _0x196349['define'](_0x4ca1('0x8'),attributes,{'tableName':_0x4ca1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 6e38e34..22a2fdf 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x37bd5a,_0x27a0c5){var _0x23edbb=function(_0x485a55){while(--_0x485a55){_0x37bd5a['push'](_0x37bd5a['shift']());}};_0x23edbb(++_0x27a0c5);}(_0xe14b,0x93));var _0xbe14=function(_0x208a7b,_0xec21c1){_0x208a7b=_0x208a7b-0x0;var _0x1fc74c=_0xe14b[_0x208a7b];return _0x1fc74c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1959fa,_0x5cd425){var _0x54c038=function(_0x43d1a2){while(--_0x43d1a2){_0x1959fa['push'](_0x1959fa['shift']());}};_0x54c038(++_0x5cd425);}(_0x6aa7,0x178));var _0x76aa=function(_0x1cc7bf,_0x143305){_0x1cc7bf=_0x1cc7bf-0x0;var _0x2ca440=_0x6aa7[_0x1cc7bf];return _0x2ca440;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index b0f4067..8531df3 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 _0x92ad=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x527dbb,_0xfd0a5e){var _0x2306f7=function(_0x277224){while(--_0x277224){_0x527dbb['push'](_0x527dbb['shift']());}};_0x2306f7(++_0xfd0a5e);}(_0x92ad,0x139));var _0xd92a=function(_0x37b279,_0x3ba2aa){_0x37b279=_0x37b279-0x0;var _0x537f36=_0x92ad[_0x37b279];return _0x537f36;};'use strict';var multer=require(_0xd92a('0x0'));var util=require(_0xd92a('0x1'));var path=require(_0xd92a('0x2'));var timeout=require(_0xd92a('0x3'));var express=require(_0xd92a('0x4'));var router=express[_0xd92a('0x5')]();var fs_extra=require(_0xd92a('0x6'));var auth=require(_0xd92a('0x7'));var interaction=require(_0xd92a('0x8'));var config=require(_0xd92a('0x9'));var controller=require(_0xd92a('0xa'));router[_0xd92a('0xb')]('/',auth[_0xd92a('0xc')](),controller[_0xd92a('0xd')]);module[_0xd92a('0xe')]=router; \ No newline at end of file +var _0x85b5=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x110e3c,_0x23f15c){var _0x26d2f4=function(_0x5a5697){while(--_0x5a5697){_0x110e3c['push'](_0x110e3c['shift']());}};_0x26d2f4(++_0x23f15c);}(_0x85b5,0xc6));var _0x585b=function(_0x205473,_0x550f04){_0x205473=_0x205473-0x0;var _0x60d838=_0x85b5[_0x205473];return _0x60d838;};'use strict';var multer=require('multer');var util=require(_0x585b('0x0'));var path=require(_0x585b('0x1'));var timeout=require(_0x585b('0x2'));var express=require(_0x585b('0x3'));var router=express[_0x585b('0x4')]();var fs_extra=require(_0x585b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x585b('0x6'));var config=require(_0x585b('0x7'));var controller=require(_0x585b('0x8'));router[_0x585b('0x9')]('/',auth[_0x585b('0xa')](),controller['sendUserNotification']);module[_0x585b('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 40e80dc..47f3f22 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 _0xde30=['STRING','BOOLEAN','sequelize'];(function(_0x1ee49e,_0x395898){var _0x279788=function(_0x3851eb){while(--_0x3851eb){_0x1ee49e['push'](_0x1ee49e['shift']());}};_0x279788(++_0x395898);}(_0xde30,0xa7));var _0x0de3=function(_0x135196,_0x13d329){_0x135196=_0x135196-0x0;var _0x21a193=_0xde30[_0x135196];return _0x21a193;};'use strict';var Sequelize=require(_0x0de3('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x0de3('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x0de3('0x2')]}}; \ No newline at end of file +var _0x30c5=['exports','TEXT','STRING','BOOLEAN'];(function(_0x180edc,_0x2be29c){var _0x15cbe2=function(_0x5e6015){while(--_0x5e6015){_0x180edc['push'](_0x180edc['shift']());}};_0x15cbe2(++_0x2be29c);}(_0x30c5,0x158));var _0x530c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x30c5[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x530c('0x0')]={'body':{'type':Sequelize[_0x530c('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x530c('0x2')]},'beep':{'type':Sequelize[_0x530c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 6e53a90..f582c61 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 _0x86f3=['json','undefined','count','offset','limit','set','Content-Range','save','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','includes','queue','replace','Queue','push','all','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end'];(function(_0x331a65,_0x567144){var _0x4171ff=function(_0x406b62){while(--_0x406b62){_0x331a65['push'](_0x331a65['shift']());}};_0x4171ff(++_0x567144);}(_0x86f3,0x16c));var _0x386f=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x86f3[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require(_0x386f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x386f('0x1'));var jsonpatch=require(_0x386f('0x2'));var rp=require(_0x386f('0x3'));var moment=require('moment');var BPromise=require(_0x386f('0x4'));var Mustache=require(_0x386f('0x5'));var util=require(_0x386f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x386f('0x7'));var fs=require('fs');var fs_extra=require(_0x386f('0x8'));var _=require(_0x386f('0x9'));var squel=require(_0x386f('0xa'));var crypto=require(_0x386f('0xb'));var jsforce=require(_0x386f('0xc'));var deskjs=require(_0x386f('0xd'));var toCsv=require(_0x386f('0xe'));var querystring=require(_0x386f('0xf'));var Papa=require(_0x386f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x386f('0x11'));var hardwareService=require(_0x386f('0x12'));var logger=require(_0x386f('0x13'))(_0x386f('0x14'));var utils=require('../../config/utils');var config=require(_0x386f('0x15'));var licenseUtil=require(_0x386f('0x16'));var db=require(_0x386f('0x17'))['db'];config[_0x386f('0x18')]=_[_0x386f('0x19')](config[_0x386f('0x18')],{'host':_0x386f('0x1a'),'port':0x18eb});var socket=require(_0x386f('0x1b'))(new Redis(config[_0x386f('0x18')]));require(_0x386f('0x1c'))['register'](socket);function respondWithStatusCode(_0x4add34,_0x2d0d76){_0x2d0d76=_0x2d0d76||0xcc;return function(_0x3e1518){if(_0x3e1518){return _0x4add34[_0x386f('0x1d')](_0x2d0d76);}return _0x4add34[_0x386f('0x1e')](_0x2d0d76)[_0x386f('0x1f')]();};}function respondWithResult(_0x1e1cd4,_0x8d6037){_0x8d6037=_0x8d6037||0xc8;return function(_0x33b6a9){if(_0x33b6a9){return _0x1e1cd4[_0x386f('0x1e')](_0x8d6037)[_0x386f('0x20')](_0x33b6a9);}};}function respondWithFilteredResult(_0x1ebc94,_0x454b95){return function(_0x169225){if(_0x169225){var _0x56a6b3=typeof _0x454b95['offset']===_0x386f('0x21')&&typeof _0x454b95['limit']==='undefined';var _0x13a490=_0x169225[_0x386f('0x22')];var _0x25105a=_0x56a6b3?0x0:_0x454b95[_0x386f('0x23')];var _0x1f53e4=_0x56a6b3?_0x169225['count']:_0x454b95[_0x386f('0x23')]+_0x454b95[_0x386f('0x24')];var _0x10542d;if(_0x1f53e4>=_0x13a490){_0x1f53e4=_0x13a490;_0x10542d=0xc8;}else{_0x10542d=0xce;}_0x1ebc94[_0x386f('0x1e')](_0x10542d);return _0x1ebc94[_0x386f('0x25')](_0x386f('0x26'),_0x25105a+'-'+_0x1f53e4+'/'+_0x13a490)[_0x386f('0x20')](_0x169225);}return null;};}function patchUpdates(_0x3579e0){return function(_0x17415c){try{jsonpatch['apply'](_0x17415c,_0x3579e0,!![]);}catch(_0x5be997){return BPromise['reject'](_0x5be997);}return _0x17415c[_0x386f('0x27')]();};}function saveUpdates(_0x1a436d,_0x1f5d66){return function(_0x1c5b61){if(_0x1c5b61){return _0x1c5b61['update'](_0x1a436d)[_0x386f('0x28')](function(_0x18288f){return _0x18288f;});}return null;};}function removeEntity(_0x594263,_0x305cb8){return function(_0x124b05){if(_0x124b05){return _0x124b05['destroy']()[_0x386f('0x28')](function(){_0x594263[_0x386f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a7fa,_0x22b437){return function(_0x34ce13){if(!_0x34ce13){_0x16a7fa[_0x386f('0x1d')](0x194);}return _0x34ce13;};}function handleError(_0x4252c5,_0x29803c){_0x29803c=_0x29803c||0x1f4;return function(_0x41372f){logger[_0x386f('0x29')](_0x41372f[_0x386f('0x2a')]);if(_0x41372f['name']){delete _0x41372f[_0x386f('0x2b')];}_0x4252c5['status'](_0x29803c)[_0x386f('0x2c')](_0x41372f);};}exports[_0x386f('0x2d')]=function(_0x4b2a88,_0xee5409,_0x4ec35a){if(!_0x4b2a88[_0x386f('0x2e')][_0x386f('0x2f')](_0x386f('0x30'))&&!_0x4b2a88[_0x386f('0x2e')][_0x386f('0x2f')](_0x386f('0x31'))){throw new db['Sequelize'][(_0x386f('0x32'))](_0x386f('0x33'));}else{if(_0x4b2a88[_0x386f('0x2e')][_0x386f('0x2f')](_0x386f('0x31'))&&!_0x4b2a88[_0x386f('0x2e')][_0x386f('0x2f')](_0x386f('0x34'))){throw new db[(_0x386f('0x35'))][(_0x386f('0x32'))](_0x386f('0x36'));}if(!_0x4b2a88[_0x386f('0x2e')]['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0x386f('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4de9f0=JSON['parse'](_0x4b2a88[_0x386f('0x2e')][_0x386f('0x37')]);}catch(_0x714215){logger[_0x386f('0x29')](_0x714215);throw new db[(_0x386f('0x35'))][(_0x386f('0x32'))](_0x386f('0x38'));}var _0x27bc5d=[_0x386f('0x39'),_0x386f('0x3a'),_0x386f('0x3b'),_0x386f('0x3c'),_0x386f('0x3d'),'voicequeue',_0x386f('0x3e'),'team',_0x386f('0x3f')];if(_[_0x386f('0x40')](_0x4de9f0,function(_0x338219){return!_['includes'](_0x27bc5d,_0x338219[_0x386f('0x41')][_0x386f('0x42')]());})){throw new db[(_0x386f('0x35'))][(_0x386f('0x32'))](_0x386f('0x43'));}}}var _0x5be8be={};_0x5be8be['senderName']=_0x4b2a88[_0x386f('0x2e')][_0x386f('0x2f')](_0x386f('0x44'))?_0x4b2a88['body'][_0x386f('0x44')]:_0x4b2a88[_0x386f('0x3f')]['fullname'];_0x5be8be[_0x386f('0x45')]=_[_0x386f('0x46')](_0x4b2a88[_0x386f('0x2e')][_0x386f('0x45')])?null:_0x4b2a88['body'][_0x386f('0x45')];_0x5be8be['beep']=_0x4b2a88[_0x386f('0x2e')][_0x386f('0x47')]||![];_0x5be8be['SenderId']=_0x4b2a88[_0x386f('0x3f')]['id'];return getContent(_0x4b2a88['body'])[_0x386f('0x28')](function(_0x3deeeb){_0x5be8be['body']=_0x3deeeb;return getRecipients(_0x4de9f0);})[_0x386f('0x28')](function(_0x36c911){_0x5be8be[_0x386f('0x48')]=_[_0x386f('0x49')](_0x36c911)[_0x386f('0x4a')](',');return db[_0x386f('0x4b')][_0x386f('0x4c')](function(_0x4e1851){return db[_0x386f('0x4d')][_0x386f('0x4e')](_0x5be8be,{'raw':!![],'transaction':_0x4e1851})[_0x386f('0x28')](function(_0x3de76e){var _0x1997b1={'sender':_0x5be8be[_0x386f('0x44')],'description':_0x5be8be['recipientsDescription'],'content':_0x5be8be[_0x386f('0x2e')],'beep':_0x5be8be[_0x386f('0x47')]};_0x36c911[_0x386f('0x4f')](function(_0xcc78fb){_0x1997b1['recipient']=_0xcc78fb;socket[_0x386f('0x50')](_0x386f('0x51'),_0x1997b1);});return _0x3de76e;});});})[_0x386f('0x28')](respondWithResult(_0xee5409,0xc9))[_0x386f('0x52')](handleError(_0xee5409,null));};function getContent(_0x396781){return new BPromise(function(_0x2c99f1,_0x504669){if(_0x396781[_0x386f('0x30')]){_0x2c99f1(_0x396781[_0x386f('0x30')]);return;}return db[_0x386f('0x53')][_0x386f('0x54')]({'attributes':[_0x386f('0x55')],'where':{'id':_0x396781[_0x386f('0x31')]},'raw':!![]})[_0x386f('0x28')](function(_0x2a6108){if(!_0x2a6108)throw new db['Sequelize']['ValidationError'](_0x386f('0x56'));var _0x382654=Mustache['render'](_0x2a6108[_0x386f('0x55')],_0x396781[_0x386f('0x34')]);_0x2c99f1(_0x382654);})[_0x386f('0x52')](function(_0x4b3e99){_0x504669(_0x4b3e99);});});}function getRecipients(_0x5cdd04){return new BPromise(function(_0x56ba74,_0x1a85e8){var _0x4a3d61=[];var _0x988a7=[];_0x5cdd04[_0x386f('0x4f')](function(_0x55fa6b){var _0x49a1ea=_[_0x386f('0x57')](_0x55fa6b[_0x386f('0x41')][_0x386f('0x42')]());if(_0x49a1ea===_0x386f('0x58')){_0x4a3d61=_[_0x386f('0x59')](_0x4a3d61,_0x55fa6b[_0x386f('0x5a')]);}else{if(_[_0x386f('0x5b')](_0x49a1ea,_0x386f('0x5c')))_0x49a1ea=_0x49a1ea[_0x386f('0x5d')](_0x386f('0x5c'),_0x386f('0x5e'));_0x55fa6b[_0x386f('0x5a')][_0x386f('0x4f')](function(_0x33a6a8){_0x988a7[_0x386f('0x5f')](getAgents(_0x49a1ea,_0x33a6a8));});}});return BPromise[_0x386f('0x60')](_0x988a7)['then'](function(_0x3bc49f){_0x4a3d61=_[_0x386f('0x59')](_0x4a3d61,_['flatten'](_0x3bc49f));_0x56ba74(_0x4a3d61);})[_0x386f('0x52')](function(_0x922990){_0x1a85e8(_0x922990);});});}function getAgents(_0x321835,_0x404793){return new BPromise(function(_0x50afe7,_0x4d6e45){return db[_0x321835]['findOne']({'where':{'id':_0x404793}})[_0x386f('0x28')](function(_0x52ab91){return _0x52ab91[_0x386f('0x61')]({'attributes':['id'],'raw':!![]})[_0x386f('0x28')](function(_0x27226d){var _0x25b729=_[_0x386f('0x62')](_0x27226d,'id');_0x50afe7(_0x25b729);});})[_0x386f('0x52')](function(_0x28e48b){_0x4d6e45(_0x28e48b);});});} \ No newline at end of file +var _0xc52c=['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','localhost','redis','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','model','toLowerCase','union','ids','replace','Queue','push','all','flatten','map','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x39f060,_0xe1b897){var _0x3593e5=function(_0xaa7d0d){while(--_0xaa7d0d){_0x39f060['push'](_0x39f060['shift']());}};_0x3593e5(++_0xe1b897);}(_0xc52c,0x121));var _0xcc52=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xc52c[_0x38841c];return _0x500610;};'use strict';var emlformat=require(_0xcc52('0x0'));var rimraf=require(_0xcc52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcc52('0x2'));var BPromise=require(_0xcc52('0x3'));var Mustache=require('mustache');var util=require(_0xcc52('0x4'));var path=require(_0xcc52('0x5'));var sox=require(_0xcc52('0x6'));var csv=require(_0xcc52('0x7'));var ejs=require(_0xcc52('0x8'));var fs=require('fs');var fs_extra=require(_0xcc52('0x9'));var _=require(_0xcc52('0xa'));var squel=require(_0xcc52('0xb'));var crypto=require(_0xcc52('0xc'));var jsforce=require(_0xcc52('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcc52('0x7'));var querystring=require(_0xcc52('0xe'));var Papa=require(_0xcc52('0xf'));var Redis=require(_0xcc52('0x10'));var authService=require(_0xcc52('0x11'));var qs=require(_0xcc52('0x12'));var as=require(_0xcc52('0x13'));var hardwareService=require(_0xcc52('0x14'));var logger=require(_0xcc52('0x15'))(_0xcc52('0x16'));var utils=require(_0xcc52('0x17'));var config=require(_0xcc52('0x18'));var licenseUtil=require(_0xcc52('0x19'));var db=require(_0xcc52('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xcc52('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc52('0x1c')]));require(_0xcc52('0x1d'))['register'](socket);function respondWithStatusCode(_0x37b152,_0x1d035c){_0x1d035c=_0x1d035c||0xcc;return function(_0x544664){if(_0x544664){return _0x37b152[_0xcc52('0x1e')](_0x1d035c);}return _0x37b152[_0xcc52('0x1f')](_0x1d035c)[_0xcc52('0x20')]();};}function respondWithResult(_0x15eb75,_0x41c6e0){_0x41c6e0=_0x41c6e0||0xc8;return function(_0x13b8d9){if(_0x13b8d9){return _0x15eb75[_0xcc52('0x1f')](_0x41c6e0)[_0xcc52('0x21')](_0x13b8d9);}};}function respondWithFilteredResult(_0x3591ca,_0x17fa5d){return function(_0x6902e6){if(_0x6902e6){var _0x1d0da0=typeof _0x17fa5d[_0xcc52('0x22')]===_0xcc52('0x23')&&typeof _0x17fa5d[_0xcc52('0x24')]===_0xcc52('0x23');var _0x32e79f=_0x6902e6[_0xcc52('0x25')];var _0x134190=_0x1d0da0?0x0:_0x17fa5d[_0xcc52('0x22')];var _0x12e09f=_0x1d0da0?_0x6902e6[_0xcc52('0x25')]:_0x17fa5d[_0xcc52('0x22')]+_0x17fa5d[_0xcc52('0x24')];var _0x3cb5df;if(_0x12e09f>=_0x32e79f){_0x12e09f=_0x32e79f;_0x3cb5df=0xc8;}else{_0x3cb5df=0xce;}_0x3591ca[_0xcc52('0x1f')](_0x3cb5df);return _0x3591ca[_0xcc52('0x26')]('Content-Range',_0x134190+'-'+_0x12e09f+'/'+_0x32e79f)['json'](_0x6902e6);}return null;};}function patchUpdates(_0x36b5ed){return function(_0x45f78f){try{jsonpatch['apply'](_0x45f78f,_0x36b5ed,!![]);}catch(_0x58a0c2){return BPromise['reject'](_0x58a0c2);}return _0x45f78f[_0xcc52('0x27')]();};}function saveUpdates(_0x49df77,_0x446a47){return function(_0x468661){if(_0x468661){return _0x468661['update'](_0x49df77)[_0xcc52('0x28')](function(_0x48a974){return _0x48a974;});}return null;};}function removeEntity(_0x2571fc,_0x27a454){return function(_0x26630b){if(_0x26630b){return _0x26630b[_0xcc52('0x29')]()[_0xcc52('0x28')](function(){_0x2571fc['status'](0xcc)[_0xcc52('0x20')]();});}};}function handleEntityNotFound(_0xc05041,_0x516609){return function(_0x198f15){if(!_0x198f15){_0xc05041['sendStatus'](0x194);}return _0x198f15;};}function handleError(_0x2844e1,_0x10ffba){_0x10ffba=_0x10ffba||0x1f4;return function(_0x23997d){logger[_0xcc52('0x2a')](_0x23997d[_0xcc52('0x2b')]);if(_0x23997d[_0xcc52('0x2c')]){delete _0x23997d['name'];}_0x2844e1['status'](_0x10ffba)[_0xcc52('0x2d')](_0x23997d);};}exports[_0xcc52('0x2e')]=function(_0x3594cd,_0x4bc5aa,_0x2c3e19){if(!_0x3594cd[_0xcc52('0x2f')]['hasOwnProperty']('text')&&!_0x3594cd[_0xcc52('0x2f')][_0xcc52('0x30')](_0xcc52('0x31'))){throw new db[(_0xcc52('0x32'))]['ValidationError'](_0xcc52('0x33'));}else{if(_0x3594cd['body'][_0xcc52('0x30')](_0xcc52('0x31'))&&!_0x3594cd[_0xcc52('0x2f')][_0xcc52('0x30')]('view')){throw new db[(_0xcc52('0x32'))][(_0xcc52('0x34'))](_0xcc52('0x35'));}if(!_0x3594cd[_0xcc52('0x2f')]['hasOwnProperty'](_0xcc52('0x36'))){throw new db['Sequelize'][(_0xcc52('0x34'))](_0xcc52('0x37'));}else{try{var _0x4a311b=JSON[_0xcc52('0x38')](_0x3594cd[_0xcc52('0x2f')][_0xcc52('0x36')]);}catch(_0x203ca0){logger['error'](_0x203ca0);throw new db[(_0xcc52('0x32'))][(_0xcc52('0x34'))](_0xcc52('0x39'));}var _0x9a0b76=[_0xcc52('0x3a'),_0xcc52('0x3b'),_0xcc52('0x3c'),_0xcc52('0x3d'),_0xcc52('0x3e'),_0xcc52('0x3f'),_0xcc52('0x40'),_0xcc52('0x41'),_0xcc52('0x42')];if(_['some'](_0x4a311b,function(_0x2bed08){return!_[_0xcc52('0x43')](_0x9a0b76,_0x2bed08['model']['toLowerCase']());})){throw new db[(_0xcc52('0x32'))][(_0xcc52('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x36acd9={};_0x36acd9['senderName']=_0x3594cd[_0xcc52('0x2f')]['hasOwnProperty'](_0xcc52('0x44'))?_0x3594cd[_0xcc52('0x2f')]['senderName']:_0x3594cd[_0xcc52('0x42')][_0xcc52('0x45')];_0x36acd9[_0xcc52('0x46')]=_['isEmpty'](_0x3594cd['body'][_0xcc52('0x46')])?null:_0x3594cd['body']['recipientsDescription'];_0x36acd9[_0xcc52('0x47')]=_0x3594cd['body']['beep']||![];_0x36acd9[_0xcc52('0x48')]=_0x3594cd['user']['id'];return getContent(_0x3594cd[_0xcc52('0x2f')])[_0xcc52('0x28')](function(_0x3d2925){_0x36acd9[_0xcc52('0x2f')]=_0x3d2925;return getRecipients(_0x4a311b);})[_0xcc52('0x28')](function(_0x34f77d){_0x36acd9[_0xcc52('0x49')]=_[_0xcc52('0x4a')](_0x34f77d)[_0xcc52('0x4b')](',');return db[_0xcc52('0x4c')][_0xcc52('0x4d')](function(_0xd3d36a){return db['UserNotification'][_0xcc52('0x4e')](_0x36acd9,{'raw':!![],'transaction':_0xd3d36a})[_0xcc52('0x28')](function(_0x457355){var _0x55a3ba={'sender':_0x36acd9[_0xcc52('0x44')],'description':_0x36acd9[_0xcc52('0x46')],'content':_0x36acd9[_0xcc52('0x2f')],'beep':_0x36acd9[_0xcc52('0x47')]};_0x34f77d[_0xcc52('0x4f')](function(_0x27fea0){_0x55a3ba[_0xcc52('0x50')]=_0x27fea0;socket[_0xcc52('0x51')](_0xcc52('0x52'),_0x55a3ba);});return _0x457355;});});})['then'](respondWithResult(_0x4bc5aa,0xc9))[_0xcc52('0x53')](handleError(_0x4bc5aa,null));};function getContent(_0x1ca69e){return new BPromise(function(_0x18e43a,_0x1039bb){if(_0x1ca69e[_0xcc52('0x54')]){_0x18e43a(_0x1ca69e[_0xcc52('0x54')]);return;}return db[_0xcc52('0x55')]['findOne']({'attributes':[_0xcc52('0x56')],'where':{'id':_0x1ca69e[_0xcc52('0x31')]},'raw':!![]})[_0xcc52('0x28')](function(_0x49998f){if(!_0x49998f)throw new db[(_0xcc52('0x32'))][(_0xcc52('0x34'))](_0xcc52('0x57'));var _0x22ef58=Mustache[_0xcc52('0x58')](_0x49998f[_0xcc52('0x56')],_0x1ca69e[_0xcc52('0x59')]);_0x18e43a(_0x22ef58);})[_0xcc52('0x53')](function(_0x3c20db){_0x1039bb(_0x3c20db);});});}function getRecipients(_0x481be4){return new BPromise(function(_0x2a0805,_0x519b3d){var _0x44ac75=[];var _0x54c75b=[];_0x481be4[_0xcc52('0x4f')](function(_0x382c5a){var _0x2ce21d=_['startCase'](_0x382c5a[_0xcc52('0x5a')][_0xcc52('0x5b')]());if(_0x2ce21d==='User'){_0x44ac75=_[_0xcc52('0x5c')](_0x44ac75,_0x382c5a[_0xcc52('0x5d')]);}else{if(_['includes'](_0x2ce21d,'queue'))_0x2ce21d=_0x2ce21d[_0xcc52('0x5e')]('queue',_0xcc52('0x5f'));_0x382c5a[_0xcc52('0x5d')][_0xcc52('0x4f')](function(_0x5890ea){_0x54c75b[_0xcc52('0x60')](getAgents(_0x2ce21d,_0x5890ea));});}});return BPromise[_0xcc52('0x61')](_0x54c75b)[_0xcc52('0x28')](function(_0x28c686){_0x44ac75=_[_0xcc52('0x5c')](_0x44ac75,_[_0xcc52('0x62')](_0x28c686));_0x2a0805(_0x44ac75);})[_0xcc52('0x53')](function(_0x49df9c){_0x519b3d(_0x49df9c);});});}function getAgents(_0x1ae80c,_0xe6917f){return new BPromise(function(_0x93af92,_0x1c5d66){return db[_0x1ae80c]['findOne']({'where':{'id':_0xe6917f}})[_0xcc52('0x28')](function(_0x1495f9){return _0x1495f9['getAgents']({'attributes':['id'],'raw':!![]})[_0xcc52('0x28')](function(_0x208c4f){var _0x48ffd1=_[_0xcc52('0x63')](_0x208c4f,'id');_0x93af92(_0x48ffd1);});})['catch'](function(_0x4b91cc){_0x1c5d66(_0x4b91cc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7938c27..5d173f9 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 _0xc901=['emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc901,0x175));var _0x1c90=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc901[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x1c90('0x0'));var UserNotification=require(_0x1c90('0x1'))['db'][_0x1c90('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1c90('0x3')](0x0);var events={'afterCreate':_0x1c90('0x4'),'afterUpdate':_0x1c90('0x5'),'afterDestroy':_0x1c90('0x6')};function emitEvent(_0x6b0215){return function(_0x162ba2,_0x4abb4d,_0x2252a3){UserNotificationEvents['emit'](_0x6b0215+':'+_0x162ba2['id'],_0x162ba2);UserNotificationEvents[_0x1c90('0x7')](_0x6b0215,_0x162ba2);_0x2252a3(null);};}for(var e in events){if(events[_0x1c90('0x8')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x1c90('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xf98f=['remove','emit','hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf98f,0x94));var _0xff98=function(_0x4e3915,_0x5b5efa){_0x4e3915=_0x4e3915-0x0;var _0x1a609a=_0xf98f[_0x4e3915];return _0x1a609a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xff98('0x0'))['db'][_0xff98('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xff98('0x2')](0x0);var events={'afterCreate':_0xff98('0x3'),'afterUpdate':_0xff98('0x4'),'afterDestroy':_0xff98('0x5')};function emitEvent(_0xf087a3){return function(_0x21424e,_0xf9cd77,_0x5c0f73){UserNotificationEvents[_0xff98('0x6')](_0xf087a3+':'+_0x21424e['id'],_0x21424e);UserNotificationEvents[_0xff98('0x6')](_0xf087a3,_0x21424e);_0x5c0f73(null);};}for(var e in events){if(events[_0xff98('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xff98('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f241ef8..605af4c 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 _0x40fb=['request-promise','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x3e550e,_0x51b57b){var _0x569b0f=function(_0x46c1ae){while(--_0x46c1ae){_0x3e550e['push'](_0x3e550e['shift']());}};_0x569b0f(++_0x51b57b);}(_0x40fb,0xb1));var _0xb40f=function(_0x2ab5d7,_0x1243d9){_0x2ab5d7=_0x2ab5d7-0x0;var _0x516388=_0x40fb[_0x2ab5d7];return _0x516388;};'use strict';var _=require(_0xb40f('0x0'));var util=require(_0xb40f('0x1'));var logger=require('../../config/logger')(_0xb40f('0x2'));var moment=require(_0xb40f('0x3'));var BPromise=require(_0xb40f('0x4'));var rp=require(_0xb40f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb40f('0x6'));var config=require('../../config/environment');var attributes=require(_0xb40f('0x7'));module[_0xb40f('0x8')]=function(_0x12c365,_0x26dfe4){return _0x12c365[_0xb40f('0x9')](_0xb40f('0xa'),attributes,{'tableName':_0xb40f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb40f('0xc'),'collate':_0xb40f('0xd')});}; \ No newline at end of file +var _0x9323=['lodash','util','../../config/logger','api','moment','path','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4'];(function(_0x1b4cb5,_0x243d8a){var _0xad10c7=function(_0x14f899){while(--_0x14f899){_0x1b4cb5['push'](_0x1b4cb5['shift']());}};_0xad10c7(++_0x243d8a);}(_0x9323,0x84));var _0x3932=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9323[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3932('0x0'));var util=require(_0x3932('0x1'));var logger=require(_0x3932('0x2'))(_0x3932('0x3'));var moment=require(_0x3932('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3932('0x5'));var rimraf=require(_0x3932('0x6'));var config=require('../../config/environment');var attributes=require(_0x3932('0x7'));module['exports']=function(_0x452e01,_0x416095){return _0x452e01[_0x3932('0x8')](_0x3932('0x9'),attributes,{'tableName':_0x3932('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3932('0xb'),'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 1f81b2c..edba825 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 _0x314f=['localhost','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x45416a,_0x50d3ec){var _0x5c24f3=function(_0x902ad4){while(--_0x902ad4){_0x45416a['push'](_0x45416a['shift']());}};_0x5c24f3(++_0x50d3ec);}(_0x314f,0x1bd));var _0xf314=function(_0x216a92,_0x961558){_0x216a92=_0x216a92-0x0;var _0x2dc6e8=_0x314f[_0x216a92];return _0x2dc6e8;};'use strict';var _=require(_0xf314('0x0'));var util=require('util');var moment=require(_0xf314('0x1'));var BPromise=require(_0xf314('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf314('0x3'))['db'];var utils=require(_0xf314('0x4'));var logger=require('../../config/logger')(_0xf314('0x5'));var config=require(_0xf314('0x6'));var jayson=require(_0xf314('0x7'));var client=jayson[_0xf314('0x8')][_0xf314('0x9')]({'port':0x232a});config[_0xf314('0xa')]=_['defaults'](config[_0xf314('0xa')],{'host':_0xf314('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf314('0xa')]));require('./userNotification.socket')[_0xf314('0xc')](socket);function respondWithRpcPromise(_0x47e1e1,_0x699df6,_0x18fa06){return new BPromise(function(_0x262e51,_0x256541){return client[_0xf314('0xd')](_0x47e1e1,_0x18fa06)[_0xf314('0xe')](function(_0x536c37){logger[_0xf314('0xf')](_0xf314('0x10'),_0x699df6,_0xf314('0x11'));logger['debug'](_0xf314('0x12'),_0x699df6,'request\x20sent',JSON[_0xf314('0x13')](_0x536c37));if(_0x536c37[_0xf314('0x14')]){if(_0x536c37[_0xf314('0x14')][_0xf314('0x15')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x699df6,_0x536c37[_0xf314('0x14')][_0xf314('0x16')]);return _0x256541(_0x536c37[_0xf314('0x14')][_0xf314('0x16')]);}logger[_0xf314('0x14')]('UserNotification,\x20%s,\x20%s',_0x699df6,_0x536c37[_0xf314('0x14')][_0xf314('0x16')]);return _0x262e51(_0x536c37[_0xf314('0x14')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x699df6,_0xf314('0x11'));_0x262e51(_0x536c37['result'][_0xf314('0x16')]);}})[_0xf314('0x17')](function(_0x10fff7){logger[_0xf314('0x14')](_0xf314('0x10'),_0x699df6,_0x10fff7);_0x256541(_0x10fff7);});});} \ No newline at end of file +var _0x8763=['redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2c2f5e,_0x58c448){var _0x5ec1b2=function(_0x4dd6d0){while(--_0x4dd6d0){_0x2c2f5e['push'](_0x2c2f5e['shift']());}};_0x5ec1b2(++_0x58c448);}(_0x8763,0x117));var _0x3876=function(_0x2e2b8f,_0x2a1b39){_0x2e2b8f=_0x2e2b8f-0x0;var _0x1c1af4=_0x8763[_0x2e2b8f];return _0x1c1af4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3876('0x0'));var BPromise=require('bluebird');var rs=require(_0x3876('0x1'));var fs=require('fs');var Redis=require(_0x3876('0x2'));var db=require(_0x3876('0x3'))['db'];var utils=require(_0x3876('0x4'));var logger=require(_0x3876('0x5'))(_0x3876('0x6'));var config=require(_0x3876('0x7'));var jayson=require(_0x3876('0x8'));var client=jayson[_0x3876('0x9')][_0x3876('0xa')]({'port':0x232a});config[_0x3876('0xb')]=_[_0x3876('0xc')](config[_0x3876('0xb')],{'host':_0x3876('0xd'),'port':0x18eb});var socket=require(_0x3876('0xe'))(new Redis(config['redis']));require(_0x3876('0xf'))['register'](socket);function respondWithRpcPromise(_0x452fd3,_0x4ddf4f,_0x1abfaa){return new BPromise(function(_0xb5bf8b,_0x411b9c){return client[_0x3876('0x10')](_0x452fd3,_0x1abfaa)[_0x3876('0x11')](function(_0x278cfa){logger[_0x3876('0x12')](_0x3876('0x13'),_0x4ddf4f,_0x3876('0x14'));logger[_0x3876('0x15')](_0x3876('0x16'),_0x4ddf4f,_0x3876('0x14'),JSON[_0x3876('0x17')](_0x278cfa));if(_0x278cfa[_0x3876('0x18')]){if(_0x278cfa[_0x3876('0x18')][_0x3876('0x19')]===0x1f4){logger[_0x3876('0x18')]('UserNotification,\x20%s,\x20%s',_0x4ddf4f,_0x278cfa['error']['message']);return _0x411b9c(_0x278cfa[_0x3876('0x18')][_0x3876('0x1a')]);}logger[_0x3876('0x18')](_0x3876('0x13'),_0x4ddf4f,_0x278cfa[_0x3876('0x18')][_0x3876('0x1a')]);return _0xb5bf8b(_0x278cfa[_0x3876('0x18')][_0x3876('0x1a')]);}else{logger['info'](_0x3876('0x13'),_0x4ddf4f,_0x3876('0x14'));_0xb5bf8b(_0x278cfa[_0x3876('0x1b')][_0x3876('0x1a')]);}})[_0x3876('0x1c')](function(_0x550a54){logger[_0x3876('0x18')]('UserNotification,\x20%s,\x20%s',_0x4ddf4f,_0x550a54);_0x411b9c(_0x550a54);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3dc80e3..9e824a0 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 _0x0c02=['./userNotification.events','update','removeListener','register','length'];(function(_0x2982ae,_0x3917cd){var _0x3aafbc=function(_0x50b4ee){while(--_0x50b4ee){_0x2982ae['push'](_0x2982ae['shift']());}};_0x3aafbc(++_0x3917cd);}(_0x0c02,0x131));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x20c0('0x0'));var events=['save','remove',_0x20c0('0x1')];function createListener(_0x11eb2a,_0x4c4627){return function(_0x18ee8f){_0x4c4627['emit'](_0x11eb2a,_0x18ee8f);};}function removeListener(_0x592a5c,_0x420afb){return function(){UserNotificationEvents[_0x20c0('0x2')](_0x592a5c,_0x420afb);};}exports[_0x20c0('0x3')]=function(_0x17b9e9){for(var _0x34f790=0x0,_0x1193b8=events[_0x20c0('0x4')];_0x34f790<_0x1193b8;_0x34f790++){var _0x4601c8=events[_0x34f790];var _0x5004cb=createListener('userNotification:'+_0x4601c8,_0x17b9e9);UserNotificationEvents['on'](_0x4601c8,_0x5004cb);}}; \ No newline at end of file +var _0x3d09=['update','register','userNotification:','save','remove'];(function(_0x45451b,_0x5e62d5){var _0x5be78f=function(_0x2c8553){while(--_0x2c8553){_0x45451b['push'](_0x45451b['shift']());}};_0x5be78f(++_0x5e62d5);}(_0x3d09,0x9e));var _0x93d0=function(_0xbf8ea8,_0x324f4e){_0xbf8ea8=_0xbf8ea8-0x0;var _0x41ed2d=_0x3d09[_0xbf8ea8];return _0x41ed2d;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x93d0('0x0'),_0x93d0('0x1'),_0x93d0('0x2')];function createListener(_0x498475,_0x1834ae){return function(_0x1fce75){_0x1834ae['emit'](_0x498475,_0x1fce75);};}function removeListener(_0x37f397,_0x3c0b8f){return function(){UserNotificationEvents['removeListener'](_0x37f397,_0x3c0b8f);};}exports[_0x93d0('0x3')]=function(_0x3adb2e){for(var _0x2663f0=0x0,_0xd51eef=events['length'];_0x2663f0<_0xd51eef;_0x2663f0++){var _0x11fb30=events[_0x2663f0];var _0x2a331e=createListener(_0x93d0('0x4')+_0x11fb30,_0x3adb2e);UserNotificationEvents['on'](_0x11fb30,_0x2a331e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 64ff9e4..822362c 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5002d2,_0x485fc6){var _0x4c6ae5=function(_0x194e73){while(--_0x194e73){_0x5002d2['push'](_0x5002d2['shift']());}};_0x4c6ae5(++_0x485fc6);}(_0xedd9,0xfc));var _0x9edd=function(_0x62c639,_0xf77af){_0x62c639=_0x62c639-0x0;var _0xcf1251=_0xedd9[_0x62c639];return _0xcf1251;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3c4d45,_0x3bf4f1){var _0x42ee3a=function(_0x29d62b){while(--_0x29d62b){_0x3c4d45['push'](_0x3c4d45['shift']());}};_0x42ee3a(++_0x3bf4f1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xcb91[_0x2f3ecd];return _0xffdc44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1fbd83e..412d223 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 _0xf3ad=['exports','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf3ad,0x1ee));var _0xdf3a=function(_0x169b39,_0x15f8b7){_0x169b39=_0x169b39-0x0;var _0x35d112=_0xf3ad[_0x169b39];return _0x35d112;};'use strict';var Sequelize=require(_0xdf3a('0x0'));module[_0xdf3a('0x1')]={'penalty':{'type':Sequelize[_0xdf3a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc090=['INTEGER','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc090,0x112));var _0x0c09=function(_0x4ceb58,_0x93010e){_0x4ceb58=_0x4ceb58-0x0;var _0x26c987=_0xc090[_0x4ceb58];return _0x26c987;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'penalty':{'type':Sequelize[_0x0c09('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 12536f2..a5838a6 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 _0x0ec6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','lodash','util','api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0ec6,0x9d));var _0x60ec=function(_0xd30482,_0x28e270){_0xd30482=_0xd30482-0x0;var _0x2243a7=_0x0ec6[_0xd30482];return _0x2243a7;};'use strict';var _=require(_0x60ec('0x0'));var util=require(_0x60ec('0x1'));var logger=require('../../config/logger')(_0x60ec('0x2'));var moment=require(_0x60ec('0x3'));var BPromise=require(_0x60ec('0x4'));var rp=require(_0x60ec('0x5'));var fs=require('fs');var path=require(_0x60ec('0x6'));var rimraf=require(_0x60ec('0x7'));var config=require(_0x60ec('0x8'));var attributes=require(_0x60ec('0x9'));module['exports']=function(_0x276281,_0x4bfea4){return _0x276281['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50ef=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x493c48,_0x4a41a8){var _0x598d76=function(_0xf25c10){while(--_0xf25c10){_0x493c48['push'](_0x493c48['shift']());}};_0x598d76(++_0x4a41a8);}(_0x50ef,0x173));var _0xf50e=function(_0x3e5349,_0x143a5c){_0x3e5349=_0x3e5349-0x0;var _0x5d8637=_0x50ef[_0x3e5349];return _0x5d8637;};'use strict';var _=require(_0xf50e('0x0'));var util=require(_0xf50e('0x1'));var logger=require(_0xf50e('0x2'))(_0xf50e('0x3'));var moment=require(_0xf50e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf50e('0x5'));var fs=require('fs');var path=require(_0xf50e('0x6'));var rimraf=require(_0xf50e('0x7'));var config=require(_0xf50e('0x8'));var attributes=require(_0xf50e('0x9'));module[_0xf50e('0xa')]=function(_0x14a823,_0x893f22){return _0x14a823[_0xf50e('0xb')](_0xf50e('0xc'),attributes,{'tableName':_0xf50e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index a3f7dcb..acd192e 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 _0x974c=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e8602,_0x2ce012){var _0x4434fb=function(_0x5ea1cb){while(--_0x5ea1cb){_0x5e8602['push'](_0x5e8602['shift']());}};_0x4434fb(++_0x2ce012);}(_0x974c,0x136));var _0xc974=function(_0x3d8433,_0x2be148){_0x3d8433=_0x3d8433-0x0;var _0x4a928e=_0x974c[_0x3d8433];return _0x4a928e;};'use strict';var _=require(_0xc974('0x0'));var util=require(_0xc974('0x1'));var moment=require('moment');var BPromise=require(_0xc974('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc974('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc974('0x4'));var logger=require('../../config/logger')(_0xc974('0x5'));var config=require(_0xc974('0x6'));var jayson=require(_0xc974('0x7'));var client=jayson[_0xc974('0x8')][_0xc974('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e63dd,_0x9c50d6,_0x556774){return new BPromise(function(_0x56b10b,_0x4ba826){return client['request'](_0x3e63dd,_0x556774)[_0xc974('0xa')](function(_0x5796e9){logger[_0xc974('0xb')](_0xc974('0xc'),_0x9c50d6,'request\x20sent');logger[_0xc974('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x9c50d6,'request\x20sent',JSON[_0xc974('0xe')](_0x5796e9));if(_0x5796e9[_0xc974('0xf')]){if(_0x5796e9[_0xc974('0xf')]['code']===0x1f4){logger[_0xc974('0xf')](_0xc974('0xc'),_0x9c50d6,_0x5796e9[_0xc974('0xf')][_0xc974('0x10')]);return _0x4ba826(_0x5796e9['error']['message']);}logger[_0xc974('0xf')](_0xc974('0xc'),_0x9c50d6,_0x5796e9[_0xc974('0xf')]['message']);return _0x56b10b(_0x5796e9[_0xc974('0xf')][_0xc974('0x10')]);}else{logger[_0xc974('0xb')](_0xc974('0xc'),_0x9c50d6,_0xc974('0x11'));_0x56b10b(_0x5796e9[_0xc974('0x12')]['message']);}})[_0xc974('0x13')](function(_0x2f3432){logger[_0xc974('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x9c50d6,_0x2f3432);_0x4ba826(_0x2f3432);});});} \ No newline at end of file +var _0x8797=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8797,0x79));var _0x7879=function(_0x86597f,_0x5dc3b3){_0x86597f=_0x86597f-0x0;var _0x1f4e98=_0x8797[_0x86597f];return _0x1f4e98;};'use strict';var _=require(_0x7879('0x0'));var util=require(_0x7879('0x1'));var moment=require(_0x7879('0x2'));var BPromise=require('bluebird');var rs=require(_0x7879('0x3'));var fs=require('fs');var Redis=require(_0x7879('0x4'));var db=require(_0x7879('0x5'))['db'];var utils=require(_0x7879('0x6'));var logger=require(_0x7879('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7879('0x8'));var client=jayson[_0x7879('0x9')][_0x7879('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16b00d,_0x507d72,_0x56a268){return new BPromise(function(_0x53a2b4,_0x570484){return client[_0x7879('0xb')](_0x16b00d,_0x56a268)[_0x7879('0xc')](function(_0x2fc33a){logger[_0x7879('0xd')](_0x7879('0xe'),_0x507d72,_0x7879('0xf'));logger['debug'](_0x7879('0x10'),_0x507d72,_0x7879('0xf'),JSON[_0x7879('0x11')](_0x2fc33a));if(_0x2fc33a[_0x7879('0x12')]){if(_0x2fc33a[_0x7879('0x12')][_0x7879('0x13')]===0x1f4){logger[_0x7879('0x12')](_0x7879('0xe'),_0x507d72,_0x2fc33a[_0x7879('0x12')][_0x7879('0x14')]);return _0x570484(_0x2fc33a['error'][_0x7879('0x14')]);}logger[_0x7879('0x12')](_0x7879('0xe'),_0x507d72,_0x2fc33a[_0x7879('0x12')][_0x7879('0x14')]);return _0x53a2b4(_0x2fc33a[_0x7879('0x12')][_0x7879('0x14')]);}else{logger[_0x7879('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x507d72,_0x7879('0xf'));_0x53a2b4(_0x2fc33a[_0x7879('0x15')][_0x7879('0x14')]);}})[_0x7879('0x16')](function(_0x425ad9){logger[_0x7879('0x12')](_0x7879('0xe'),_0x507d72,_0x425ad9);_0x570484(_0x425ad9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1a830de..b5685c0 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 _0xaab2=['/:id/sections','/:id/resources','getResources','post','/:id/clone','clone','addResources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x395718,_0x20322d){var _0x3028b8=function(_0x416f5c){while(--_0x416f5c){_0x395718['push'](_0x395718['shift']());}};_0x3028b8(++_0x20322d);}(_0xaab2,0xca));var _0x2aab=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xaab2[_0x411add];return _0x238242;};'use strict';var multer=require('multer');var util=require(_0x2aab('0x0'));var path=require(_0x2aab('0x1'));var timeout=require(_0x2aab('0x2'));var express=require('express');var router=express[_0x2aab('0x3')]();var fs_extra=require(_0x2aab('0x4'));var auth=require(_0x2aab('0x5'));var interaction=require(_0x2aab('0x6'));var config=require(_0x2aab('0x7'));var controller=require('./userProfile.controller');router[_0x2aab('0x8')]('/',auth['isAuthenticated'](),controller[_0x2aab('0x9')]);router[_0x2aab('0x8')](_0x2aab('0xa'),auth[_0x2aab('0xb')](),controller['describe']);router[_0x2aab('0x8')](_0x2aab('0xc'),auth[_0x2aab('0xb')](),controller[_0x2aab('0xd')]);router[_0x2aab('0x8')](_0x2aab('0xe'),auth['isAuthenticated'](),controller['getSections']);router[_0x2aab('0x8')](_0x2aab('0xf'),auth['isAuthenticated'](),controller[_0x2aab('0x10')]);router[_0x2aab('0x11')]('/',auth[_0x2aab('0xb')](),controller['create']);router[_0x2aab('0x11')](_0x2aab('0x12'),auth[_0x2aab('0xb')](),controller[_0x2aab('0x13')]);router[_0x2aab('0x11')](_0x2aab('0xe'),auth['isAuthenticated'](),controller['addSections']);router[_0x2aab('0x11')]('/:id/resources',auth['isAuthenticated'](),controller[_0x2aab('0x14')]);router[_0x2aab('0x15')](_0x2aab('0xc'),auth[_0x2aab('0xb')](),controller[_0x2aab('0x16')]);router[_0x2aab('0x17')](_0x2aab('0xc'),auth[_0x2aab('0xb')](),controller['destroy']);router[_0x2aab('0x17')](_0x2aab('0xe'),auth[_0x2aab('0xb')](),controller[_0x2aab('0x18')]);router[_0x2aab('0x17')](_0x2aab('0xf'),auth[_0x2aab('0xb')](),controller[_0x2aab('0x19')]);module[_0x2aab('0x1a')]=router; \ No newline at end of file +var _0x8a00=['show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a00,0x1ef));var _0x08a0=function(_0x581e81,_0x13cf76){_0x581e81=_0x581e81-0x0;var _0x1a61bc=_0x8a00[_0x581e81];return _0x1a61bc;};'use strict';var multer=require(_0x08a0('0x0'));var util=require(_0x08a0('0x1'));var path=require(_0x08a0('0x2'));var timeout=require(_0x08a0('0x3'));var express=require(_0x08a0('0x4'));var router=express[_0x08a0('0x5')]();var fs_extra=require(_0x08a0('0x6'));var auth=require(_0x08a0('0x7'));var interaction=require(_0x08a0('0x8'));var config=require(_0x08a0('0x9'));var controller=require(_0x08a0('0xa'));router[_0x08a0('0xb')]('/',auth[_0x08a0('0xc')](),controller[_0x08a0('0xd')]);router['get'](_0x08a0('0xe'),auth[_0x08a0('0xc')](),controller[_0x08a0('0xf')]);router[_0x08a0('0xb')](_0x08a0('0x10'),auth[_0x08a0('0xc')](),controller[_0x08a0('0x11')]);router[_0x08a0('0xb')](_0x08a0('0x12'),auth[_0x08a0('0xc')](),controller[_0x08a0('0x13')]);router[_0x08a0('0xb')](_0x08a0('0x14'),auth['isAuthenticated'](),controller[_0x08a0('0x15')]);router['post']('/',auth[_0x08a0('0xc')](),controller[_0x08a0('0x16')]);router[_0x08a0('0x17')](_0x08a0('0x18'),auth[_0x08a0('0xc')](),controller['clone']);router['post'](_0x08a0('0x12'),auth[_0x08a0('0xc')](),controller[_0x08a0('0x19')]);router[_0x08a0('0x17')](_0x08a0('0x14'),auth['isAuthenticated'](),controller[_0x08a0('0x1a')]);router['put'](_0x08a0('0x10'),auth[_0x08a0('0xc')](),controller['update']);router[_0x08a0('0x1b')](_0x08a0('0x10'),auth['isAuthenticated'](),controller[_0x08a0('0x1c')]);router['delete'](_0x08a0('0x12'),auth[_0x08a0('0xc')](),controller[_0x08a0('0x1d')]);router['delete'](_0x08a0('0x14'),auth[_0x08a0('0xc')](),controller[_0x08a0('0x1e')]);module[_0x08a0('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e586c66..22c6de3 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 _0x8ddf=['getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8ddf,0x8b));var _0xf8dd=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x8ddf[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require('sequelize');module[_0xf8dd('0x0')]={'name':{'type':Sequelize[_0xf8dd('0x1')],'allowNull':![],'unique':_0xf8dd('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xb7eddd){this[_0xf8dd('0x3')](_0xf8dd('0x4'),_0xb7eddd?_0xb7eddd['join'](''):[]);},'get':function(){return this[_0xf8dd('0x5')](_0xf8dd('0x4'))?this[_0xf8dd('0x5')]('crudPermissions')[_0xf8dd('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf8dd('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd927=['getDataValue','split','BOOLEAN','exports','STRING','name','crudPermissions','join'];(function(_0x52af16,_0x59cb6f){var _0x7e642c=function(_0x2c0ccc){while(--_0x2c0ccc){_0x52af16['push'](_0x52af16['shift']());}};_0x7e642c(++_0x59cb6f);}(_0xd927,0x1d3));var _0x7d92=function(_0x51a556,_0x54aec4){_0x51a556=_0x51a556-0x0;var _0x30cdb6=_0xd927[_0x51a556];return _0x30cdb6;};'use strict';var Sequelize=require('sequelize');module[_0x7d92('0x0')]={'name':{'type':Sequelize[_0x7d92('0x1')],'allowNull':![],'unique':_0x7d92('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x293255){this['setDataValue'](_0x7d92('0x3'),_0x293255?_0x293255[_0x7d92('0x4')](''):[]);},'get':function(){return this[_0x7d92('0x5')](_0x7d92('0x3'))?this['getDataValue']('crudPermissions')[_0x7d92('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7d92('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 32d598a..e87fa91 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 _0xb1be=['bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','localhost','socket.io-emitter','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','map','UserProfile','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','keys','rawAttributes','includeAll','catch','create','body','clone','params','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources'];(function(_0x49668e,_0x2192db){var _0x1ca211=function(_0x369808){while(--_0x369808){_0x49668e['push'](_0x49668e['shift']());}};_0x1ca211(++_0x2192db);}(_0xb1be,0x1c9));var _0xeb1b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1be[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xeb1b('0x0'));var rimraf=require(_0xeb1b('0x1'));var zipdir=require(_0xeb1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb1b('0x3'));var moment=require(_0xeb1b('0x4'));var BPromise=require(_0xeb1b('0x5'));var Mustache=require(_0xeb1b('0x6'));var util=require(_0xeb1b('0x7'));var path=require(_0xeb1b('0x8'));var sox=require(_0xeb1b('0x9'));var csv=require('to-csv');var ejs=require(_0xeb1b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb1b('0xb'));var crypto=require(_0xeb1b('0xc'));var jsforce=require(_0xeb1b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb1b('0xe'));var Redis=require(_0xeb1b('0xf'));var authService=require(_0xeb1b('0x10'));var qs=require(_0xeb1b('0x11'));var as=require(_0xeb1b('0x12'));var hardwareService=require(_0xeb1b('0x13'));var logger=require(_0xeb1b('0x14'))('api');var utils=require(_0xeb1b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xeb1b('0x16')]=_['defaults'](config[_0xeb1b('0x16')],{'host':_0xeb1b('0x17'),'port':0x18eb});var socket=require(_0xeb1b('0x18'))(new Redis(config[_0xeb1b('0x16')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x57c526,_0x661032){_0x661032=_0x661032||0xcc;return function(_0x4f2fe4){if(_0x4f2fe4){return _0x57c526['sendStatus'](_0x661032);}return _0x57c526[_0xeb1b('0x19')](_0x661032)[_0xeb1b('0x1a')]();};}function respondWithResult(_0x12d8a8,_0x1117ac){_0x1117ac=_0x1117ac||0xc8;return function(_0x33ac7c){if(_0x33ac7c){return _0x12d8a8[_0xeb1b('0x19')](_0x1117ac)[_0xeb1b('0x1b')](_0x33ac7c);}};}function respondWithFilteredResult(_0x23fdfd,_0xbd75ae){return function(_0x74c52e){if(_0x74c52e){var _0x1db772=typeof _0xbd75ae['offset']===_0xeb1b('0x1c')&&typeof _0xbd75ae[_0xeb1b('0x1d')]==='undefined';var _0x2ad1b5=_0x74c52e['count'];var _0x2fafca=_0x1db772?0x0:_0xbd75ae[_0xeb1b('0x1e')];var _0x3163e1=_0x1db772?_0x74c52e[_0xeb1b('0x1f')]:_0xbd75ae[_0xeb1b('0x1e')]+_0xbd75ae['limit'];var _0x2cf674;if(_0x3163e1>=_0x2ad1b5){_0x3163e1=_0x2ad1b5;_0x2cf674=0xc8;}else{_0x2cf674=0xce;}_0x23fdfd[_0xeb1b('0x19')](_0x2cf674);return _0x23fdfd['set'](_0xeb1b('0x20'),_0x2fafca+'-'+_0x3163e1+'/'+_0x2ad1b5)[_0xeb1b('0x1b')](_0x74c52e);}return null;};}function patchUpdates(_0x50d5a8){return function(_0x2db8f4){try{jsonpatch[_0xeb1b('0x21')](_0x2db8f4,_0x50d5a8,!![]);}catch(_0x1bce2b){return BPromise[_0xeb1b('0x22')](_0x1bce2b);}return _0x2db8f4['save']();};}function saveUpdates(_0x3079f2,_0x1122bb){return function(_0x5f3824){if(_0x5f3824){return _0x5f3824[_0xeb1b('0x23')](_0x3079f2)['then'](function(_0x4cfecf){return _0x4cfecf;});}return null;};}function removeEntity(_0x2a7bdb,_0x23e0a2){return function(_0x13445d){if(_0x13445d){return _0x13445d[_0xeb1b('0x24')]()[_0xeb1b('0x25')](function(){_0x2a7bdb[_0xeb1b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a52a1,_0x55b841){return function(_0x1ee751){if(!_0x1ee751){_0x3a52a1[_0xeb1b('0x26')](0x194);}return _0x1ee751;};}function handleError(_0x3c0dc3,_0x1f9381){_0x1f9381=_0x1f9381||0x1f4;return function(_0x13da15){logger[_0xeb1b('0x27')](_0x13da15[_0xeb1b('0x28')]);if(_0x13da15[_0xeb1b('0x29')]){delete _0x13da15[_0xeb1b('0x29')];}_0x3c0dc3[_0xeb1b('0x19')](_0x1f9381)[_0xeb1b('0x2a')](_0x13da15);};}exports['index']=function(_0x1da5f4,_0x12eb73){var _0x3a584d={},_0x2273ae={},_0x1a6135={'count':0x0,'rows':[]};var _0x89c420=_[_0xeb1b('0x2b')](db[_0xeb1b('0x2c')]['rawAttributes'],function(_0x1c0551){return{'name':_0x1c0551[_0xeb1b('0x2d')],'type':_0x1c0551[_0xeb1b('0x2e')]['key']};});_0x2273ae[_0xeb1b('0x2f')]=_[_0xeb1b('0x2b')](_0x89c420,_0xeb1b('0x29'));_0x2273ae[_0xeb1b('0x30')]=_['keys'](_0x1da5f4[_0xeb1b('0x30')]);_0x2273ae['filters']=_[_0xeb1b('0x31')](_0x2273ae[_0xeb1b('0x2f')],_0x2273ae[_0xeb1b('0x30')]);_0x3a584d[_0xeb1b('0x32')]=_[_0xeb1b('0x31')](_0x2273ae[_0xeb1b('0x2f')],qs['fields'](_0x1da5f4[_0xeb1b('0x30')][_0xeb1b('0x33')]));_0x3a584d['attributes']=_0x3a584d[_0xeb1b('0x32')][_0xeb1b('0x34')]?_0x3a584d['attributes']:_0x2273ae[_0xeb1b('0x2f')];if(!_0x1da5f4[_0xeb1b('0x30')][_0xeb1b('0x35')](_0xeb1b('0x36'))){_0x3a584d[_0xeb1b('0x1d')]=qs[_0xeb1b('0x1d')](_0x1da5f4[_0xeb1b('0x30')][_0xeb1b('0x1d')]);_0x3a584d['offset']=qs['offset'](_0x1da5f4[_0xeb1b('0x30')]['offset']);}_0x3a584d[_0xeb1b('0x37')]=qs[_0xeb1b('0x38')](_0x1da5f4['query'][_0xeb1b('0x38')]);_0x3a584d[_0xeb1b('0x39')]=qs[_0xeb1b('0x3a')](_[_0xeb1b('0x3b')](_0x1da5f4[_0xeb1b('0x30')],_0x2273ae[_0xeb1b('0x3a')]),_0x89c420);if(_0x1da5f4[_0xeb1b('0x30')][_0xeb1b('0x3c')]){_0x3a584d['where']=_[_0xeb1b('0x3d')](_0x3a584d[_0xeb1b('0x39')],{'$or':_[_0xeb1b('0x2b')](_0x89c420,function(_0x157a13){if(_0x157a13[_0xeb1b('0x2e')]!==_0xeb1b('0x3e')){var _0x2c49bc={};_0x2c49bc[_0x157a13[_0xeb1b('0x29')]]={'$like':'%'+_0x1da5f4['query'][_0xeb1b('0x3c')]+'%'};return _0x2c49bc;}})});}_0x3a584d=_['merge']({},_0x3a584d,_0x1da5f4[_0xeb1b('0x3f')]);var _0x30b8c8={'where':_0x3a584d['where']};return db[_0xeb1b('0x2c')]['count'](_0x30b8c8)['then'](function(_0x1a4dad){_0x1a6135[_0xeb1b('0x1f')]=_0x1a4dad;if(_0x1da5f4[_0xeb1b('0x30')]['includeAll']){_0x3a584d[_0xeb1b('0x40')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x3a584d);})['then'](function(_0x5a55e2){_0x1a6135[_0xeb1b('0x41')]=_0x5a55e2;return _0x1a6135;})[_0xeb1b('0x25')](respondWithFilteredResult(_0x12eb73,_0x3a584d))['catch'](handleError(_0x12eb73,null));};exports[_0xeb1b('0x42')]=function(_0xbe6809,_0x241ea8){var _0x386977={'raw':![],'where':{'id':_0xbe6809['params']['id']}},_0x41c514={};_0x41c514[_0xeb1b('0x2f')]=_[_0xeb1b('0x43')](db['UserProfile'][_0xeb1b('0x44')]);_0x41c514['query']=_['keys'](_0xbe6809[_0xeb1b('0x30')]);_0x41c514['filters']=_[_0xeb1b('0x31')](_0x41c514[_0xeb1b('0x2f')],_0x41c514[_0xeb1b('0x30')]);_0x386977[_0xeb1b('0x32')]=_[_0xeb1b('0x31')](_0x41c514[_0xeb1b('0x2f')],qs[_0xeb1b('0x33')](_0xbe6809[_0xeb1b('0x30')][_0xeb1b('0x33')]));_0x386977[_0xeb1b('0x32')]=_0x386977[_0xeb1b('0x32')][_0xeb1b('0x34')]?_0x386977['attributes']:_0x41c514[_0xeb1b('0x2f')];if(_0xbe6809[_0xeb1b('0x30')][_0xeb1b('0x45')]){_0x386977[_0xeb1b('0x40')]=[{'all':!![]}];}_0x386977=_[_0xeb1b('0x3d')]({},_0x386977,_0xbe6809['options']);return db[_0xeb1b('0x2c')]['find'](_0x386977)[_0xeb1b('0x25')](handleEntityNotFound(_0x241ea8,null))[_0xeb1b('0x25')](respondWithResult(_0x241ea8,null))[_0xeb1b('0x46')](handleError(_0x241ea8,null));};exports[_0xeb1b('0x47')]=function(_0x3546bf,_0x5a7c52){return db[_0xeb1b('0x2c')][_0xeb1b('0x47')](_0x3546bf[_0xeb1b('0x48')],{})[_0xeb1b('0x25')](respondWithResult(_0x5a7c52,0xc9))['catch'](handleError(_0x5a7c52,null));};exports[_0xeb1b('0x49')]=function(_0x51d79f,_0x4a00d1){var _0x32e787={'where':{'id':_0x51d79f[_0xeb1b('0x4a')]['id']}},_0x7f7ab4={};_0x7f7ab4[_0xeb1b('0x2f')]=_[_0xeb1b('0x43')](db['UserProfile']['rawAttributes']);_0x32e787[_0xeb1b('0x32')]=_[_0xeb1b('0x31')](_0x7f7ab4['model'],qs[_0xeb1b('0x33')](_0x51d79f['query'][_0xeb1b('0x33')]));_0x32e787['attributes']=_0x32e787[_0xeb1b('0x32')][_0xeb1b('0x34')]?_0x32e787['attributes']:_0x7f7ab4[_0xeb1b('0x2f')];if(_0x51d79f[_0xeb1b('0x30')][_0xeb1b('0x45')]){_0x32e787[_0xeb1b('0x40')]=[{'all':!![]}];}_0x32e787=_['merge']({},_0x32e787,_0x51d79f[_0xeb1b('0x3f')]);return db[_0xeb1b('0x2c')][_0xeb1b('0x4b')](_0x32e787)[_0xeb1b('0x25')](handleEntityNotFound(_0x4a00d1,null))['then'](function(_0x938c00){if(_0x938c00){var _0x1002ed=_0x938c00[_0xeb1b('0x4c')]({'plain':!![]});_0x1002ed=qs[_0xeb1b('0x4d')](_0x1002ed,['id',_0xeb1b('0x4e'),_0xeb1b('0x4f'),_0xeb1b('0x50')]);_0x51d79f[_0xeb1b('0x48')]=_[_0xeb1b('0x4d')](_0x51d79f[_0xeb1b('0x48')],['id',_0xeb1b('0x4e'),_0xeb1b('0x4f')]);return db[_0xeb1b('0x51')][_0xeb1b('0x52')](function(_0x1fca39){return db[_0xeb1b('0x2c')][_0xeb1b('0x47')](_[_0xeb1b('0x3d')](_0x1002ed,_0x51d79f[_0xeb1b('0x48')]),{'include':_0x51d79f['query'][_0xeb1b('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x1fca39})[_0xeb1b('0x25')](function(_0x365c11){var _0x237c4b=_0x365c11[_0xeb1b('0x4c')]({'plain':!![]});return db[_0xeb1b('0x53')][_0xeb1b('0x54')]({'where':{'userProfileId':_0x51d79f['params']['id']},'raw':!![]})[_0xeb1b('0x25')](function(_0xce8074){if(_0xce8074){return BPromise[_0xeb1b('0x55')](_0xce8074,function(_0x106f33){return new BPromise(function(_0x10aac0,_0x5cd6d5){if(_0x106f33[_0xeb1b('0x56')]===null||_0x106f33['autoAssociation']===0x1)_0x10aac0(null);return db['UserProfileResource'][_0xeb1b('0x54')]({'where':{'sectionId':_0x106f33['id']},'raw':!![]})[_0xeb1b('0x25')](function(_0x480fc9){var _0x102237=_[_0xeb1b('0x2b')](_0x480fc9,function(_0x1a654d){return qs[_0xeb1b('0x4d')](_0x1a654d,['id','createdAt','updatedAt',_0xeb1b('0x57')]);});_0x10aac0(_0x102237);})['catch'](function(_0x51fd0b){_0x5cd6d5(_0x51fd0b);});})[_0xeb1b('0x25')](function(_0x2e254e){var _0x9aa539=qs['omit'](_0x106f33,['id',_0xeb1b('0x4e'),_0xeb1b('0x4f')]);_0x9aa539[_0xeb1b('0x58')]=_0x237c4b['id'];if(_0x2e254e)_0x9aa539[_0xeb1b('0x59')]=_0x2e254e;return _0x9aa539;})[_0xeb1b('0x25')](function(_0x5dcdfe){return db['UserProfileSection'][_0xeb1b('0x47')](_0x5dcdfe,{'include':[{'model':db[_0xeb1b('0x5a')],'as':_0xeb1b('0x59')}],'raw':!![],'transaction':_0x1fca39});});})[_0xeb1b('0x25')](function(){return _0x237c4b;});}});});});}})[_0xeb1b('0x25')](respondWithResult(_0x4a00d1,0xc9))[_0xeb1b('0x46')](handleError(_0x4a00d1,null));};exports[_0xeb1b('0x23')]=function(_0x31954d,_0x23d548){if(_0x31954d[_0xeb1b('0x48')]['id']){delete _0x31954d[_0xeb1b('0x48')]['id'];}return db[_0xeb1b('0x2c')][_0xeb1b('0x4b')]({'where':{'id':_0x31954d[_0xeb1b('0x4a')]['id']}})[_0xeb1b('0x25')](handleEntityNotFound(_0x23d548,null))[_0xeb1b('0x25')](saveUpdates(_0x31954d[_0xeb1b('0x48')],null))[_0xeb1b('0x25')](respondWithResult(_0x23d548,null))[_0xeb1b('0x46')](handleError(_0x23d548,null));};exports[_0xeb1b('0x24')]=function(_0x1167a9,_0x3f71bd){return db['UserProfile'][_0xeb1b('0x4b')]({'where':{'id':_0x1167a9[_0xeb1b('0x4a')]['id']}})[_0xeb1b('0x25')](handleEntityNotFound(_0x3f71bd,null))[_0xeb1b('0x25')](removeEntity(_0x3f71bd,null))['catch'](handleError(_0x3f71bd,null));};exports[_0xeb1b('0x5b')]=function(_0x3df1b0,_0x1147f1){return db['UserProfile'][_0xeb1b('0x5b')]()['then'](respondWithResult(_0x1147f1,null))[_0xeb1b('0x46')](handleError(_0x1147f1,null));};exports[_0xeb1b('0x5c')]=function(_0x49b507,_0x567288){var _0xd80a1d=_0x49b507[_0xeb1b('0x48')];return db['UserProfile'][_0xeb1b('0x4b')]({'where':{'id':_0x49b507[_0xeb1b('0x4a')]['id']}})[_0xeb1b('0x25')](handleEntityNotFound(_0x567288,null))[_0xeb1b('0x25')](function(_0x27a723){if(_0x27a723){return db[_0xeb1b('0x51')][_0xeb1b('0x52')](function(_0x5e28d0){return db['UserProfileSection'][_0xeb1b('0x24')]({'where':{'userProfileId':_0x49b507[_0xeb1b('0x4a')]['id'],'sectionId':_[_0xeb1b('0x2b')](_0xd80a1d,function(_0x5af4d7){return _0x5af4d7['sectionId'];})},'transaction':_0x5e28d0})['then'](function(){var _0x6b8e81=_[_0xeb1b('0x2b')](_0xd80a1d,function(_0x13459c){_0x13459c[_0xeb1b('0x58')]=_0x49b507[_0xeb1b('0x4a')]['id'];return _0x13459c;});var _0x5365bf=[];return BPromise['each'](_0x6b8e81,function(_0x29a528){return db[_0xeb1b('0x53')][_0xeb1b('0x47')](_0x29a528,{'include':[{'model':db['UserProfileResource'],'as':_0xeb1b('0x59')}],'raw':!![],'transaction':_0x5e28d0})['then'](function(_0x13cf25){_0x5365bf[_0xeb1b('0x5d')](_0x13cf25[_0xeb1b('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x5365bf;});});});}})['then'](function(_0x5262fa){return _0x5262fa;})[_0xeb1b('0x25')](respondWithResult(_0x567288,null))['catch'](handleError(_0x567288,null));};exports[_0xeb1b('0x5e')]=function(_0x354700,_0x3efd0b){var _0x3308b6;return db['UserProfile']['find']({'where':{'id':_0x354700[_0xeb1b('0x4a')]['id']},'attributes':['id','name']})[_0xeb1b('0x25')](handleEntityNotFound(_0x3efd0b,null))[_0xeb1b('0x25')](function(_0x95ed9c){if(_0x95ed9c){_0x3308b6=_0x95ed9c;return db[_0xeb1b('0x53')]['destroy']({'where':{'userProfileId':_0x354700[_0xeb1b('0x4a')]['id'],'sectionId':_0x354700[_0xeb1b('0x30')][_0xeb1b('0x5f')]}});}})[_0xeb1b('0x25')](function(){return _0x3308b6;})['then'](respondWithStatusCode(_0x3efd0b,null))[_0xeb1b('0x46')](handleError(_0x3efd0b,null));};exports[_0xeb1b('0x60')]=function(_0x37a093,_0x430143){var _0x529a9e=[];var _0x3ac8a4=[];return db[_0xeb1b('0x53')]['findAll']({'where':{'userProfileId':_0x37a093[_0xeb1b('0x4a')]['id']},'raw':!![]})[_0xeb1b('0x25')](function(_0x381fdf){_0x529a9e=_[_0xeb1b('0x3c')](_0x381fdf,function(_0x20d432){return _0x20d432[_0xeb1b('0x61')]===0x1||_[_0xeb1b('0x62')]([0x3eb,0x709],_0x20d432['sectionId']);});if(!_[_0xeb1b('0x63')](_0x529a9e)){return _[_0xeb1b('0x2b')](_0x529a9e,function(_0x43069b){return _0x43069b[_0xeb1b('0x57')];});}else{return;}})['then'](function(_0x24a797){if(_0x24a797)_0x3ac8a4=_0x24a797;if(_[_0xeb1b('0x62')](_0x3ac8a4,0x64)){var _0xb63cd2=_[_0xeb1b('0x4b')](_0x529a9e,{'sectionId':0x64});return hasDefaultDashboard(_0xb63cd2)[_0xeb1b('0x25')](function(_0x38b777){return _[_0xeb1b('0x2b')](_0x529a9e,function(_0x3d19a2){if(_0x3d19a2[_0xeb1b('0x57')]===0x64){_0x3d19a2[_0xeb1b('0x64')]=_0x38b777;}return _0x3d19a2;});});}else{return;}})[_0xeb1b('0x25')](function(_0x22292a){if(_0x22292a)_0x529a9e=_0x22292a;if(_[_0xeb1b('0x62')](_0x3ac8a4,0x3eb)){var _0x3461d1=_[_0xeb1b('0x4b')](_0x529a9e,{'sectionId':0x3eb});return getCustomDashboards(_0x3461d1)[_0xeb1b('0x25')](function(_0x21952e){return _[_0xeb1b('0x2b')](_0x529a9e,function(_0x5f3bb8){if(_0x3461d1[_0xeb1b('0x61')]){if(_0x5f3bb8[_0xeb1b('0x57')]===0x3eb){_0x5f3bb8[_0xeb1b('0x64')]=_0x21952e;}}else{if(_0x5f3bb8[_0xeb1b('0x57')]===0x64){if(!_0x5f3bb8[_0xeb1b('0x64')]){_0x5f3bb8[_0xeb1b('0x64')]=[];}_0x5f3bb8['subsections']=_0x5f3bb8[_0xeb1b('0x64')][_0xeb1b('0x65')](_0x21952e);}}return _0x5f3bb8;});});}else{return;}})['then'](function(_0x55e636){if(_0x55e636)_0x529a9e=_0x55e636;if(_[_0xeb1b('0x62')](_0x3ac8a4,0x709)){var _0x5217af=_[_0xeb1b('0x4b')](_0x529a9e,{'sectionId':0x709});return getPlugins(_0x5217af)['then'](function(_0x22bbf0){if(_0x5217af['enabled']){return _[_0xeb1b('0x2b')](_0x529a9e,function(_0x40214a){if(_0x40214a[_0xeb1b('0x57')]===0x709){_0x40214a[_0xeb1b('0x64')]=_0x22bbf0;}return _0x40214a;});}else{var _0x4c6321={'sectionId':0x76c,'enabled':0x1,'subsections':_0x22bbf0};var _0x1d7e01=_[_0xeb1b('0x2b')](_0x529a9e);_0x1d7e01['push'](_0x4c6321);return _0x1d7e01;}});}else{return;}})['then'](function(_0x3b50f8){if(_0x3b50f8)_0x529a9e=_0x3b50f8;return _[_0xeb1b('0x3c')](_0x529a9e,[_0xeb1b('0x61'),0x1]);})['then'](respondWithResult(_0x430143,null))[_0xeb1b('0x46')](handleError(_0x430143,null));};function hasDefaultDashboard(_0x45e19c){var _0x5beaaa=[0x65];return new BPromise(function(_0x27d1f3,_0x4104e2){try{if(_0x45e19c[_0xeb1b('0x56')]){_0x27d1f3(_0x5beaaa);}else{return db[_0xeb1b('0x5a')][_0xeb1b('0x66')]({'where':{'sectionId':_0x45e19c['id']},'raw':!![]})['then'](function(_0x3e57bf){_0x3e57bf?_0x27d1f3(_0x5beaaa):_0x27d1f3();});}}catch(_0x17c773){_0x4104e2(_0x17c773);}});}function getCustomDashboards(_0x57b459){var _0x3af01d=[];return new BPromise(function(_0x5c88df,_0x39825c){try{if(_0x57b459[_0xeb1b('0x56')]){return db[_0xeb1b('0x67')][_0xeb1b('0x54')]({'raw':!![]})[_0xeb1b('0x25')](function(_0x327cde){_0x327cde[_0xeb1b('0x68')](function(_0x4ce3f3){_0x3af01d[_0xeb1b('0x5d')](_0x4ce3f3['id']+0x1869f);});_0x5c88df(_0x3af01d);});}else{return db['UserProfileResource'][_0xeb1b('0x54')]({'where':{'sectionId':_0x57b459['id']},'raw':!![]})[_0xeb1b('0x25')](function(_0x37b5ce){_0x37b5ce[_0xeb1b('0x68')](function(_0x366413){_0x3af01d[_0xeb1b('0x5d')](_0x366413[_0xeb1b('0x69')]+0x1869f);});_0x5c88df(_0x3af01d);});}}catch(_0x6c375){_0x39825c(_0x6c375);}});}function getPlugins(_0x339bdd){var _0x1f3303=[];return new BPromise(function(_0x97855f,_0x59eeae){try{if(_0x339bdd[_0xeb1b('0x56')]){return db[_0xeb1b('0x6a')][_0xeb1b('0x54')]({'raw':!![]})[_0xeb1b('0x25')](function(_0x53f6c9){_0x53f6c9[_0xeb1b('0x68')](function(_0x5c6012){_0x1f3303[_0xeb1b('0x5d')](_0x5c6012['id']+0x15b38);});_0x97855f(_0x1f3303);});}else{return db['UserProfileResource'][_0xeb1b('0x54')]({'where':{'sectionId':_0x339bdd['id']},'raw':!![]})[_0xeb1b('0x25')](function(_0x2d5e4f){_0x2d5e4f[_0xeb1b('0x68')](function(_0x4d2ca8){_0x1f3303['push'](_0x4d2ca8[_0xeb1b('0x69')]+0x15b38);});_0x97855f(_0x1f3303);});}}catch(_0x2907c8){_0x59eeae(_0x2907c8);}});}exports[_0xeb1b('0x6b')]=function(_0x4f0f08,_0x68d533){return db[_0xeb1b('0x2c')][_0xeb1b('0x4b')]({'where':{'id':_0x4f0f08[_0xeb1b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x68d533,null))[_0xeb1b('0x25')](function(_0x3cadb2){if(_0x3cadb2){return db[_0xeb1b('0x51')][_0xeb1b('0x52')](function(_0x1097f2){return db[_0xeb1b('0x53')][_0xeb1b('0x54')]({'where':{'userProfileId':_0x4f0f08[_0xeb1b('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xeb1b('0x25')](function(_0x1c77a7){if(_0x1c77a7){return db['UserProfileSection'][_0xeb1b('0x24')]({'where':{'userProfileId':_0x4f0f08[_0xeb1b('0x4a')]['id'],'id':_[_0xeb1b('0x2b')](_0x1c77a7,function(_0x411b04){return _0x411b04['id'];})},'transaction':_0x1097f2});}})[_0xeb1b('0x25')](function(_0x2636d2){var _0x59ae0e=_['map'](_0x4f0f08[_0xeb1b('0x48')],function(_0x289f95){_0x289f95[_0xeb1b('0x58')]=_0x4f0f08[_0xeb1b('0x4a')]['id'];return _0x289f95;});return db['UserProfileSection'][_0xeb1b('0x6c')](_0x59ae0e,{'raw':!![],'transaction':_0x1097f2});})[_0xeb1b('0x25')](function(_0x348eef){var _0x55370e=_[_0xeb1b('0x3c')](_[_0xeb1b('0x2b')](_0x348eef,function(_0x3b4d0e){return _0x3b4d0e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x55370e){return db[_0xeb1b('0x53')][_0xeb1b('0x54')]({'where':{'userProfileId':_0x4f0f08[_0xeb1b('0x4a')]['id'],'sectionId':_[_0xeb1b('0x2b')](_0x55370e,function(_0x361cfb){return _0x361cfb['sectionId'];})},'attributes':['id',_0xeb1b('0x57')],'raw':!![]})[_0xeb1b('0x25')](function(_0x2eba8c){var _0x22e143=_[_0xeb1b('0x2b')](_0x4f0f08[_0xeb1b('0x48')],function(_0x2a6c19){_0x2a6c19[_0xeb1b('0x58')]=_0x4f0f08[_0xeb1b('0x4a')]['id'];return _0x2a6c19;});return db[_0xeb1b('0x5a')][_0xeb1b('0x6c')](_0x22e143,{'raw':!![],'transaction':_0x1097f2});});}})[_0xeb1b('0x46')](handleError(_0x68d533,null));});}})['then'](function(_0x475f03){var _0x44de3d=_[_0xeb1b('0x2b')](_0x475f03,function(_0x2a3ec1){return _0x2a3ec1[_0xeb1b('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x68d533,null))[_0xeb1b('0x46')](handleError(_0x68d533,null));};exports['removeResources']=function(_0x474fdc,_0x3219f6,_0x384038){return db[_0xeb1b('0x2c')][_0xeb1b('0x4b')]({'where':{'id':_0x474fdc[_0xeb1b('0x4a')]['id']}})[_0xeb1b('0x25')](handleEntityNotFound(_0x3219f6,null))[_0xeb1b('0x25')](function(_0x1dcb14){if(_0x1dcb14){return _0x1dcb14[_0xeb1b('0x6d')](_0x474fdc[_0xeb1b('0x30')][_0xeb1b('0x5f')]);}})[_0xeb1b('0x25')](respondWithStatusCode(_0x3219f6,null))[_0xeb1b('0x46')](handleError(_0x3219f6,null));};exports[_0xeb1b('0x6e')]=function(_0xc51b58,_0x26f376){var _0x282910={};if(!_0xc51b58[_0xeb1b('0x30')][_0xeb1b('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0xc51b58[_0xeb1b('0x30')][_0xeb1b('0x35')](_0xeb1b('0x36'))){_0x282910['limit']=qs[_0xeb1b('0x1d')](_0xc51b58[_0xeb1b('0x30')][_0xeb1b('0x1d')]);_0x282910[_0xeb1b('0x1e')]=qs[_0xeb1b('0x1e')](_0xc51b58[_0xeb1b('0x30')][_0xeb1b('0x1e')]);}return db[_0xeb1b('0x2c')][_0xeb1b('0x4b')]({'where':{'id':_0xc51b58['params']['id']}})['then'](function(_0x20403d){if(!_0x20403d)throw new Error(_0xeb1b('0x70')+_0xc51b58[_0xeb1b('0x4a')]['id']);return db[_0xeb1b('0x2c')][_0xeb1b('0x6e')](_0xc51b58);})['then'](respondWithFilteredResult(_0x26f376,_0x282910))[_0xeb1b('0x46')](handleError(_0x26f376,null));}; \ No newline at end of file +var _0x68e5=['status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','rows','catch','show','params','keys','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','findAll','each','autoAssociation','userProfileId','Resources','UserProfileResource','describe','addSections','sequelize','sectionId','push','removeSections','ids','getSections','includes','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus'];(function(_0x4bdabe,_0x2c8066){var _0x22eb41=function(_0x1e32d2){while(--_0x1e32d2){_0x4bdabe['push'](_0x4bdabe['shift']());}};_0x22eb41(++_0x2c8066);}(_0x68e5,0x13f));var _0x568e=function(_0x4f2488,_0x21a90a){_0x4f2488=_0x4f2488-0x0;var _0x3e20f5=_0x68e5[_0x4f2488];return _0x3e20f5;};'use strict';var emlformat=require(_0x568e('0x0'));var rimraf=require(_0x568e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x568e('0x2'));var rp=require(_0x568e('0x3'));var moment=require(_0x568e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x568e('0x5'));var util=require(_0x568e('0x6'));var path=require(_0x568e('0x7'));var sox=require(_0x568e('0x8'));var csv=require(_0x568e('0x9'));var ejs=require(_0x568e('0xa'));var fs=require('fs');var fs_extra=require(_0x568e('0xb'));var _=require(_0x568e('0xc'));var squel=require(_0x568e('0xd'));var crypto=require('crypto');var jsforce=require(_0x568e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x568e('0x9'));var querystring=require(_0x568e('0xf'));var Papa=require(_0x568e('0x10'));var Redis=require('ioredis');var authService=require(_0x568e('0x11'));var qs=require(_0x568e('0x12'));var as=require(_0x568e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x568e('0x14'))(_0x568e('0x15'));var utils=require('../../config/utils');var config=require(_0x568e('0x16'));var licenseUtil=require(_0x568e('0x17'));var db=require(_0x568e('0x18'))['db'];config[_0x568e('0x19')]=_[_0x568e('0x1a')](config[_0x568e('0x19')],{'host':_0x568e('0x1b'),'port':0x18eb});var socket=require(_0x568e('0x1c'))(new Redis(config[_0x568e('0x19')]));require(_0x568e('0x1d'))[_0x568e('0x1e')](socket);function respondWithStatusCode(_0x3d5351,_0x3c7722){_0x3c7722=_0x3c7722||0xcc;return function(_0x1ef6a1){if(_0x1ef6a1){return _0x3d5351[_0x568e('0x1f')](_0x3c7722);}return _0x3d5351[_0x568e('0x20')](_0x3c7722)[_0x568e('0x21')]();};}function respondWithResult(_0x26cde8,_0x36d089){_0x36d089=_0x36d089||0xc8;return function(_0x1642c4){if(_0x1642c4){return _0x26cde8[_0x568e('0x20')](_0x36d089)['json'](_0x1642c4);}};}function respondWithFilteredResult(_0x299a80,_0x240383){return function(_0x49829d){if(_0x49829d){var _0x369530=typeof _0x240383[_0x568e('0x22')]===_0x568e('0x23')&&typeof _0x240383[_0x568e('0x24')]===_0x568e('0x23');var _0x492ee2=_0x49829d[_0x568e('0x25')];var _0x3c6619=_0x369530?0x0:_0x240383['offset'];var _0x73896e=_0x369530?_0x49829d[_0x568e('0x25')]:_0x240383[_0x568e('0x22')]+_0x240383[_0x568e('0x24')];var _0x581b3a;if(_0x73896e>=_0x492ee2){_0x73896e=_0x492ee2;_0x581b3a=0xc8;}else{_0x581b3a=0xce;}_0x299a80['status'](_0x581b3a);return _0x299a80[_0x568e('0x26')](_0x568e('0x27'),_0x3c6619+'-'+_0x73896e+'/'+_0x492ee2)[_0x568e('0x28')](_0x49829d);}return null;};}function patchUpdates(_0x47abb7){return function(_0x4a2bfc){try{jsonpatch['apply'](_0x4a2bfc,_0x47abb7,!![]);}catch(_0x1f17c4){return BPromise[_0x568e('0x29')](_0x1f17c4);}return _0x4a2bfc[_0x568e('0x2a')]();};}function saveUpdates(_0x41515e,_0x131c3b){return function(_0x3513a6){if(_0x3513a6){return _0x3513a6[_0x568e('0x2b')](_0x41515e)[_0x568e('0x2c')](function(_0x1b5343){return _0x1b5343;});}return null;};}function removeEntity(_0x326bc8,_0x1fdada){return function(_0x95d203){if(_0x95d203){return _0x95d203[_0x568e('0x2d')]()[_0x568e('0x2c')](function(){_0x326bc8[_0x568e('0x20')](0xcc)[_0x568e('0x21')]();});}};}function handleEntityNotFound(_0x1dbda5,_0x535941){return function(_0x50389c){if(!_0x50389c){_0x1dbda5[_0x568e('0x1f')](0x194);}return _0x50389c;};}function handleError(_0x253acb,_0x16fe03){_0x16fe03=_0x16fe03||0x1f4;return function(_0x1d468e){logger['error'](_0x1d468e[_0x568e('0x2e')]);if(_0x1d468e[_0x568e('0x2f')]){delete _0x1d468e[_0x568e('0x2f')];}_0x253acb['status'](_0x16fe03)['send'](_0x1d468e);};}exports[_0x568e('0x30')]=function(_0x6e1c58,_0x52fb75){var _0x4fd95a={},_0x208128={},_0x34979d={'count':0x0,'rows':[]};var _0x14d6ad=_[_0x568e('0x31')](db[_0x568e('0x32')][_0x568e('0x33')],function(_0x437d7a){return{'name':_0x437d7a[_0x568e('0x34')],'type':_0x437d7a[_0x568e('0x35')][_0x568e('0x36')]};});_0x208128[_0x568e('0x37')]=_[_0x568e('0x31')](_0x14d6ad,'name');_0x208128['query']=_['keys'](_0x6e1c58['query']);_0x208128[_0x568e('0x38')]=_[_0x568e('0x39')](_0x208128[_0x568e('0x37')],_0x208128[_0x568e('0x3a')]);_0x4fd95a[_0x568e('0x3b')]=_[_0x568e('0x39')](_0x208128[_0x568e('0x37')],qs[_0x568e('0x3c')](_0x6e1c58[_0x568e('0x3a')][_0x568e('0x3c')]));_0x4fd95a[_0x568e('0x3b')]=_0x4fd95a[_0x568e('0x3b')][_0x568e('0x3d')]?_0x4fd95a[_0x568e('0x3b')]:_0x208128[_0x568e('0x37')];if(!_0x6e1c58[_0x568e('0x3a')][_0x568e('0x3e')](_0x568e('0x3f'))){_0x4fd95a[_0x568e('0x24')]=qs[_0x568e('0x24')](_0x6e1c58['query'][_0x568e('0x24')]);_0x4fd95a['offset']=qs[_0x568e('0x22')](_0x6e1c58[_0x568e('0x3a')][_0x568e('0x22')]);}_0x4fd95a['order']=qs['sort'](_0x6e1c58[_0x568e('0x3a')][_0x568e('0x40')]);_0x4fd95a['where']=qs['filters'](_['pick'](_0x6e1c58['query'],_0x208128[_0x568e('0x38')]),_0x14d6ad);if(_0x6e1c58['query'][_0x568e('0x41')]){_0x4fd95a['where']=_[_0x568e('0x42')](_0x4fd95a[_0x568e('0x43')],{'$or':_[_0x568e('0x31')](_0x14d6ad,function(_0x491f48){if(_0x491f48[_0x568e('0x35')]!=='VIRTUAL'){var _0x7f6ce1={};_0x7f6ce1[_0x491f48[_0x568e('0x2f')]]={'$like':'%'+_0x6e1c58[_0x568e('0x3a')][_0x568e('0x41')]+'%'};return _0x7f6ce1;}})});}_0x4fd95a=_[_0x568e('0x42')]({},_0x4fd95a,_0x6e1c58[_0x568e('0x44')]);var _0x1fdf52={'where':_0x4fd95a[_0x568e('0x43')]};return db[_0x568e('0x32')]['count'](_0x1fdf52)['then'](function(_0x3724f4){_0x34979d[_0x568e('0x25')]=_0x3724f4;if(_0x6e1c58['query'][_0x568e('0x45')]){_0x4fd95a[_0x568e('0x46')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x4fd95a);})['then'](function(_0x5f02eb){_0x34979d[_0x568e('0x47')]=_0x5f02eb;return _0x34979d;})['then'](respondWithFilteredResult(_0x52fb75,_0x4fd95a))[_0x568e('0x48')](handleError(_0x52fb75,null));};exports[_0x568e('0x49')]=function(_0x12603f,_0x259284){var _0x29108f={'raw':![],'where':{'id':_0x12603f[_0x568e('0x4a')]['id']}},_0x358373={};_0x358373['model']=_['keys'](db['UserProfile'][_0x568e('0x33')]);_0x358373[_0x568e('0x3a')]=_[_0x568e('0x4b')](_0x12603f[_0x568e('0x3a')]);_0x358373[_0x568e('0x38')]=_['intersection'](_0x358373[_0x568e('0x37')],_0x358373[_0x568e('0x3a')]);_0x29108f[_0x568e('0x3b')]=_[_0x568e('0x39')](_0x358373[_0x568e('0x37')],qs[_0x568e('0x3c')](_0x12603f[_0x568e('0x3a')][_0x568e('0x3c')]));_0x29108f['attributes']=_0x29108f['attributes'][_0x568e('0x3d')]?_0x29108f[_0x568e('0x3b')]:_0x358373['model'];if(_0x12603f[_0x568e('0x3a')][_0x568e('0x45')]){_0x29108f[_0x568e('0x46')]=[{'all':!![]}];}_0x29108f=_['merge']({},_0x29108f,_0x12603f[_0x568e('0x44')]);return db['UserProfile'][_0x568e('0x4c')](_0x29108f)[_0x568e('0x2c')](handleEntityNotFound(_0x259284,null))[_0x568e('0x2c')](respondWithResult(_0x259284,null))[_0x568e('0x48')](handleError(_0x259284,null));};exports[_0x568e('0x4d')]=function(_0x270128,_0x412945){return db['UserProfile']['create'](_0x270128[_0x568e('0x4e')],{})[_0x568e('0x2c')](respondWithResult(_0x412945,0xc9))[_0x568e('0x48')](handleError(_0x412945,null));};exports[_0x568e('0x4f')]=function(_0x21827c,_0x40b17a){var _0x4a5ef7={'where':{'id':_0x21827c[_0x568e('0x4a')]['id']}},_0x308eb3={};_0x308eb3[_0x568e('0x37')]=_[_0x568e('0x4b')](db['UserProfile']['rawAttributes']);_0x4a5ef7[_0x568e('0x3b')]=_['intersection'](_0x308eb3[_0x568e('0x37')],qs[_0x568e('0x3c')](_0x21827c[_0x568e('0x3a')][_0x568e('0x3c')]));_0x4a5ef7[_0x568e('0x3b')]=_0x4a5ef7['attributes'][_0x568e('0x3d')]?_0x4a5ef7[_0x568e('0x3b')]:_0x308eb3[_0x568e('0x37')];if(_0x21827c[_0x568e('0x3a')][_0x568e('0x45')]){_0x4a5ef7[_0x568e('0x46')]=[{'all':!![]}];}_0x4a5ef7=_['merge']({},_0x4a5ef7,_0x21827c['options']);return db[_0x568e('0x32')]['find'](_0x4a5ef7)['then'](handleEntityNotFound(_0x40b17a,null))['then'](function(_0x5cdd09){if(_0x5cdd09){var _0x4b3572=_0x5cdd09[_0x568e('0x50')]({'plain':!![]});_0x4b3572=qs[_0x568e('0x51')](_0x4b3572,['id',_0x568e('0x52'),_0x568e('0x53'),_0x568e('0x54')]);_0x21827c['body']=_[_0x568e('0x51')](_0x21827c['body'],['id',_0x568e('0x52'),_0x568e('0x53')]);return db['sequelize'][_0x568e('0x55')](function(_0x301444){return db[_0x568e('0x32')]['create'](_[_0x568e('0x42')](_0x4b3572,_0x21827c[_0x568e('0x4e')]),{'include':_0x21827c[_0x568e('0x3a')][_0x568e('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x301444})[_0x568e('0x2c')](function(_0x5994f0){var _0x2bd45d=_0x5994f0[_0x568e('0x50')]({'plain':!![]});return db[_0x568e('0x56')][_0x568e('0x57')]({'where':{'userProfileId':_0x21827c[_0x568e('0x4a')]['id']},'raw':!![]})[_0x568e('0x2c')](function(_0x149321){if(_0x149321){return BPromise[_0x568e('0x58')](_0x149321,function(_0x5a8cc4){return new BPromise(function(_0x1feb9b,_0x2dd74b){if(_0x5a8cc4[_0x568e('0x59')]===null||_0x5a8cc4[_0x568e('0x59')]===0x1)_0x1feb9b(null);return db['UserProfileResource'][_0x568e('0x57')]({'where':{'sectionId':_0x5a8cc4['id']},'raw':!![]})[_0x568e('0x2c')](function(_0x52f369){var _0x3ed2df=_[_0x568e('0x31')](_0x52f369,function(_0x259009){return qs[_0x568e('0x51')](_0x259009,['id','createdAt',_0x568e('0x53'),'sectionId']);});_0x1feb9b(_0x3ed2df);})[_0x568e('0x48')](function(_0xcb0266){_0x2dd74b(_0xcb0266);});})['then'](function(_0x4af2ee){var _0x5d756b=qs[_0x568e('0x51')](_0x5a8cc4,['id',_0x568e('0x52'),_0x568e('0x53')]);_0x5d756b[_0x568e('0x5a')]=_0x2bd45d['id'];if(_0x4af2ee)_0x5d756b[_0x568e('0x5b')]=_0x4af2ee;return _0x5d756b;})[_0x568e('0x2c')](function(_0x397e39){return db[_0x568e('0x56')][_0x568e('0x4d')](_0x397e39,{'include':[{'model':db[_0x568e('0x5c')],'as':_0x568e('0x5b')}],'raw':!![],'transaction':_0x301444});});})[_0x568e('0x2c')](function(){return _0x2bd45d;});}});});});}})[_0x568e('0x2c')](respondWithResult(_0x40b17a,0xc9))['catch'](handleError(_0x40b17a,null));};exports[_0x568e('0x2b')]=function(_0x52ad17,_0x12122c){if(_0x52ad17[_0x568e('0x4e')]['id']){delete _0x52ad17['body']['id'];}return db[_0x568e('0x32')][_0x568e('0x4c')]({'where':{'id':_0x52ad17[_0x568e('0x4a')]['id']}})[_0x568e('0x2c')](handleEntityNotFound(_0x12122c,null))[_0x568e('0x2c')](saveUpdates(_0x52ad17[_0x568e('0x4e')],null))[_0x568e('0x2c')](respondWithResult(_0x12122c,null))[_0x568e('0x48')](handleError(_0x12122c,null));};exports[_0x568e('0x2d')]=function(_0x2c6c42,_0x20dd76){return db[_0x568e('0x32')][_0x568e('0x4c')]({'where':{'id':_0x2c6c42[_0x568e('0x4a')]['id']}})[_0x568e('0x2c')](handleEntityNotFound(_0x20dd76,null))[_0x568e('0x2c')](removeEntity(_0x20dd76,null))[_0x568e('0x48')](handleError(_0x20dd76,null));};exports['describe']=function(_0x53cf1b,_0x56386e){return db[_0x568e('0x32')][_0x568e('0x5d')]()[_0x568e('0x2c')](respondWithResult(_0x56386e,null))[_0x568e('0x48')](handleError(_0x56386e,null));};exports[_0x568e('0x5e')]=function(_0x48f7a6,_0x556a48){var _0x2bbb82=_0x48f7a6['body'];return db[_0x568e('0x32')][_0x568e('0x4c')]({'where':{'id':_0x48f7a6[_0x568e('0x4a')]['id']}})[_0x568e('0x2c')](handleEntityNotFound(_0x556a48,null))[_0x568e('0x2c')](function(_0x5d8a8d){if(_0x5d8a8d){return db[_0x568e('0x5f')][_0x568e('0x55')](function(_0x31bd68){return db['UserProfileSection'][_0x568e('0x2d')]({'where':{'userProfileId':_0x48f7a6['params']['id'],'sectionId':_[_0x568e('0x31')](_0x2bbb82,function(_0x157b6c){return _0x157b6c[_0x568e('0x60')];})},'transaction':_0x31bd68})['then'](function(){var _0x2efc9a=_['map'](_0x2bbb82,function(_0x133d5e){_0x133d5e['userProfileId']=_0x48f7a6[_0x568e('0x4a')]['id'];return _0x133d5e;});var _0x574248=[];return BPromise[_0x568e('0x58')](_0x2efc9a,function(_0x5dd470){return db['UserProfileSection'][_0x568e('0x4d')](_0x5dd470,{'include':[{'model':db[_0x568e('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x31bd68})[_0x568e('0x2c')](function(_0x351218){_0x574248[_0x568e('0x61')](_0x351218[_0x568e('0x50')]({'plain':!![]}));});})[_0x568e('0x2c')](function(){return _0x574248;});});});}})[_0x568e('0x2c')](function(_0x455933){return _0x455933;})[_0x568e('0x2c')](respondWithResult(_0x556a48,null))[_0x568e('0x48')](handleError(_0x556a48,null));};exports[_0x568e('0x62')]=function(_0x49a036,_0x86e1b4){var _0x2b6afd;return db[_0x568e('0x32')][_0x568e('0x4c')]({'where':{'id':_0x49a036[_0x568e('0x4a')]['id']},'attributes':['id',_0x568e('0x2f')]})[_0x568e('0x2c')](handleEntityNotFound(_0x86e1b4,null))['then'](function(_0x3fe0b5){if(_0x3fe0b5){_0x2b6afd=_0x3fe0b5;return db['UserProfileSection'][_0x568e('0x2d')]({'where':{'userProfileId':_0x49a036[_0x568e('0x4a')]['id'],'sectionId':_0x49a036[_0x568e('0x3a')][_0x568e('0x63')]}});}})[_0x568e('0x2c')](function(){return _0x2b6afd;})[_0x568e('0x2c')](respondWithStatusCode(_0x86e1b4,null))[_0x568e('0x48')](handleError(_0x86e1b4,null));};exports[_0x568e('0x64')]=function(_0x20b592,_0x2e1a5e){var _0x2fa407=[];var _0x246826=[];return db[_0x568e('0x56')][_0x568e('0x57')]({'where':{'userProfileId':_0x20b592[_0x568e('0x4a')]['id']},'raw':!![]})['then'](function(_0x52d3b5){_0x2fa407=_[_0x568e('0x41')](_0x52d3b5,function(_0x186775){return _0x186775['enabled']===0x1||_[_0x568e('0x65')]([0x3eb,0x709],_0x186775['sectionId']);});if(!_['isEmpty'](_0x2fa407)){return _[_0x568e('0x31')](_0x2fa407,function(_0x24cf29){return _0x24cf29[_0x568e('0x60')];});}else{return;}})[_0x568e('0x2c')](function(_0x1a523f){if(_0x1a523f)_0x246826=_0x1a523f;if(_[_0x568e('0x65')](_0x246826,0x64)){var _0x1f3986=_[_0x568e('0x4c')](_0x2fa407,{'sectionId':0x64});return hasDefaultDashboard(_0x1f3986)[_0x568e('0x2c')](function(_0x479276){return _['map'](_0x2fa407,function(_0x16426c){if(_0x16426c['sectionId']===0x64){_0x16426c[_0x568e('0x66')]=_0x479276;}return _0x16426c;});});}else{return;}})[_0x568e('0x2c')](function(_0x37bbd6){if(_0x37bbd6)_0x2fa407=_0x37bbd6;if(_[_0x568e('0x65')](_0x246826,0x3eb)){var _0x56d379=_['find'](_0x2fa407,{'sectionId':0x3eb});return getCustomDashboards(_0x56d379)[_0x568e('0x2c')](function(_0x1afc2b){return _[_0x568e('0x31')](_0x2fa407,function(_0x4720d8){if(_0x56d379[_0x568e('0x67')]){if(_0x4720d8['sectionId']===0x3eb){_0x4720d8['subsections']=_0x1afc2b;}}else{if(_0x4720d8[_0x568e('0x60')]===0x64){if(!_0x4720d8[_0x568e('0x66')]){_0x4720d8[_0x568e('0x66')]=[];}_0x4720d8[_0x568e('0x66')]=_0x4720d8[_0x568e('0x66')][_0x568e('0x68')](_0x1afc2b);}}return _0x4720d8;});});}else{return;}})[_0x568e('0x2c')](function(_0x16ba0f){if(_0x16ba0f)_0x2fa407=_0x16ba0f;if(_['includes'](_0x246826,0x709)){var _0x15ef89=_[_0x568e('0x4c')](_0x2fa407,{'sectionId':0x709});return getPlugins(_0x15ef89)[_0x568e('0x2c')](function(_0x341f54){if(_0x15ef89[_0x568e('0x67')]){return _[_0x568e('0x31')](_0x2fa407,function(_0x3e1f3e){if(_0x3e1f3e[_0x568e('0x60')]===0x709){_0x3e1f3e['subsections']=_0x341f54;}return _0x3e1f3e;});}else{var _0x5bf8ee={'sectionId':0x76c,'enabled':0x1,'subsections':_0x341f54};var _0x510b0c=_[_0x568e('0x31')](_0x2fa407);_0x510b0c[_0x568e('0x61')](_0x5bf8ee);return _0x510b0c;}});}else{return;}})[_0x568e('0x2c')](function(_0x50669a){if(_0x50669a)_0x2fa407=_0x50669a;return _[_0x568e('0x41')](_0x2fa407,['enabled',0x1]);})[_0x568e('0x2c')](respondWithResult(_0x2e1a5e,null))['catch'](handleError(_0x2e1a5e,null));};function hasDefaultDashboard(_0x44270d){var _0xc06dc3=[0x65];return new BPromise(function(_0x3c7bd4,_0x4cdcd8){try{if(_0x44270d[_0x568e('0x59')]){_0x3c7bd4(_0xc06dc3);}else{return db[_0x568e('0x5c')][_0x568e('0x69')]({'where':{'sectionId':_0x44270d['id']},'raw':!![]})[_0x568e('0x2c')](function(_0x4dc46a){_0x4dc46a?_0x3c7bd4(_0xc06dc3):_0x3c7bd4();});}}catch(_0x4b147a){_0x4cdcd8(_0x4b147a);}});}function getCustomDashboards(_0x1425c6){var _0x2f51d9=[];return new BPromise(function(_0x3b1fd2,_0x3d0ffc){try{if(_0x1425c6['autoAssociation']){return db[_0x568e('0x6a')]['findAll']({'raw':!![]})[_0x568e('0x2c')](function(_0xcde7e2){_0xcde7e2[_0x568e('0x6b')](function(_0x1bd003){_0x2f51d9['push'](_0x1bd003['id']+0x1869f);});_0x3b1fd2(_0x2f51d9);});}else{return db[_0x568e('0x5c')][_0x568e('0x57')]({'where':{'sectionId':_0x1425c6['id']},'raw':!![]})[_0x568e('0x2c')](function(_0x10212f){_0x10212f[_0x568e('0x6b')](function(_0x581f9a){_0x2f51d9[_0x568e('0x61')](_0x581f9a[_0x568e('0x6c')]+0x1869f);});_0x3b1fd2(_0x2f51d9);});}}catch(_0x1dfa13){_0x3d0ffc(_0x1dfa13);}});}function getPlugins(_0x23df60){var _0x3c5885=[];return new BPromise(function(_0x4073b5,_0x26544a){try{if(_0x23df60[_0x568e('0x59')]){return db[_0x568e('0x6d')]['findAll']({'raw':!![]})['then'](function(_0x1b1c43){_0x1b1c43['forEach'](function(_0x221207){_0x3c5885[_0x568e('0x61')](_0x221207['id']+0x15b38);});_0x4073b5(_0x3c5885);});}else{return db[_0x568e('0x5c')][_0x568e('0x57')]({'where':{'sectionId':_0x23df60['id']},'raw':!![]})[_0x568e('0x2c')](function(_0x3efc7d){_0x3efc7d[_0x568e('0x6b')](function(_0xcc86c9){_0x3c5885[_0x568e('0x61')](_0xcc86c9[_0x568e('0x6c')]+0x15b38);});_0x4073b5(_0x3c5885);});}}catch(_0x181b0b){_0x26544a(_0x181b0b);}});}exports[_0x568e('0x6e')]=function(_0x9fc672,_0x209c30){return db['UserProfile'][_0x568e('0x4c')]({'where':{'id':_0x9fc672['params']['id']}})[_0x568e('0x2c')](handleEntityNotFound(_0x209c30,null))[_0x568e('0x2c')](function(_0x2ab837){if(_0x2ab837){return db['sequelize'][_0x568e('0x55')](function(_0x1b8bff){return db[_0x568e('0x56')][_0x568e('0x57')]({'where':{'userProfileId':_0x9fc672[_0x568e('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x568e('0x2c')](function(_0x2ebcc7){if(_0x2ebcc7){return db['UserProfileSection'][_0x568e('0x2d')]({'where':{'userProfileId':_0x9fc672[_0x568e('0x4a')]['id'],'id':_[_0x568e('0x31')](_0x2ebcc7,function(_0x149291){return _0x149291['id'];})},'transaction':_0x1b8bff});}})[_0x568e('0x2c')](function(_0x32b256){var _0x55d2a9=_[_0x568e('0x31')](_0x9fc672[_0x568e('0x4e')],function(_0x3648b4){_0x3648b4[_0x568e('0x5a')]=_0x9fc672[_0x568e('0x4a')]['id'];return _0x3648b4;});return db['UserProfileSection'][_0x568e('0x6f')](_0x55d2a9,{'raw':!![],'transaction':_0x1b8bff});})[_0x568e('0x2c')](function(_0x3c117d){var _0x8ddb58=_[_0x568e('0x41')](_[_0x568e('0x31')](_0x3c117d,function(_0xa44b23){return _0xa44b23[_0x568e('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x8ddb58){return db['UserProfileSection'][_0x568e('0x57')]({'where':{'userProfileId':_0x9fc672[_0x568e('0x4a')]['id'],'sectionId':_[_0x568e('0x31')](_0x8ddb58,function(_0x4948b3){return _0x4948b3[_0x568e('0x60')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x568e('0x2c')](function(_0x13498f){var _0x4bfff9=_[_0x568e('0x31')](_0x9fc672[_0x568e('0x4e')],function(_0x18ff1f){_0x18ff1f[_0x568e('0x5a')]=_0x9fc672['params']['id'];return _0x18ff1f;});return db['UserProfileResource'][_0x568e('0x6f')](_0x4bfff9,{'raw':!![],'transaction':_0x1b8bff});});}})[_0x568e('0x48')](handleError(_0x209c30,null));});}})['then'](function(_0x17840d){var _0xf2dbfc=_['map'](_0x17840d,function(_0x4083d7){return _0x4083d7[_0x568e('0x50')]({'plain':!![]});});})[_0x568e('0x2c')](respondWithResult(_0x209c30,null))[_0x568e('0x48')](handleError(_0x209c30,null));};exports[_0x568e('0x70')]=function(_0x566866,_0x2ee810,_0x45d63c){return db[_0x568e('0x32')][_0x568e('0x4c')]({'where':{'id':_0x566866[_0x568e('0x4a')]['id']}})[_0x568e('0x2c')](handleEntityNotFound(_0x2ee810,null))[_0x568e('0x2c')](function(_0x4a7c9f){if(_0x4a7c9f){return _0x4a7c9f[_0x568e('0x70')](_0x566866[_0x568e('0x3a')][_0x568e('0x63')]);}})[_0x568e('0x2c')](respondWithStatusCode(_0x2ee810,null))[_0x568e('0x48')](handleError(_0x2ee810,null));};exports[_0x568e('0x71')]=function(_0x1a292a,_0x1b1f07){var _0x10cadf={};if(!_0x1a292a[_0x568e('0x3a')][_0x568e('0x72')])throw new Error(_0x568e('0x73'));if(!_0x1a292a[_0x568e('0x3a')]['hasOwnProperty'](_0x568e('0x3f'))){_0x10cadf[_0x568e('0x24')]=qs[_0x568e('0x24')](_0x1a292a[_0x568e('0x3a')][_0x568e('0x24')]);_0x10cadf['offset']=qs[_0x568e('0x22')](_0x1a292a[_0x568e('0x3a')][_0x568e('0x22')]);}return db[_0x568e('0x32')]['find']({'where':{'id':_0x1a292a[_0x568e('0x4a')]['id']}})[_0x568e('0x2c')](function(_0x3be942){if(!_0x3be942)throw new Error(_0x568e('0x74')+_0x1a292a[_0x568e('0x4a')]['id']);return db[_0x568e('0x32')][_0x568e('0x71')](_0x1a292a);})[_0x568e('0x2c')](respondWithFilteredResult(_0x1b1f07,_0x10cadf))[_0x568e('0x48')](handleError(_0x1b1f07,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 734441d..4a6af1a 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 _0x3837=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x3837,0x1d1));var _0x7383=function(_0x266add,_0x50e6a8){_0x266add=_0x266add-0x0;var _0x3d531b=_0x3837[_0x266add];return _0x3d531b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7383('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7383('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7383('0x2'),'afterDestroy':_0x7383('0x3')};function emitEvent(_0x49878d){return function(_0x227ab2,_0xf57468,_0x53485d){UserProfileEvents['emit'](_0x49878d+':'+_0x227ab2['id'],_0x227ab2);UserProfileEvents[_0x7383('0x4')](_0x49878d,_0x227ab2);_0x53485d(null);};}for(var e in events){if(events[_0x7383('0x5')](e)){var event=events[e];UserProfile[_0x7383('0x6')](e,emitEvent(event));}}module[_0x7383('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xfb11=['hasOwnProperty','exports','events','UserProfile','setMaxListeners','update','emit'];(function(_0x10c1bb,_0x3c861c){var _0x1691cf=function(_0x253193){while(--_0x253193){_0x10c1bb['push'](_0x10c1bb['shift']());}};_0x1691cf(++_0x3c861c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xfb11[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x1fb1('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1fb1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18108f){return function(_0x5a830e,_0x190f74,_0x2ae20f){UserProfileEvents['emit'](_0x18108f+':'+_0x5a830e['id'],_0x5a830e);UserProfileEvents[_0x1fb1('0x4')](_0x18108f,_0x5a830e);_0x2ae20f(null);};}for(var e in events){if(events[_0x1fb1('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1fb1('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d2c3413..9bc2c30 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 _0x3932=['_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','DefaultReports','custom','rows','ids','customSorting','extraQueryConditions','count','include','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','findAll','then','associatedResources','map','catch','value','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','agents','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','templates','Template','triggers','Trunk','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_'];(function(_0x42fb5f,_0x4ee895){var _0x2f3128=function(_0x342f6f){while(--_0x342f6f){_0x42fb5f['push'](_0x42fb5f['shift']());}};_0x2f3128(++_0x4ee895);}(_0x3932,0xf9));var _0x2393=function(_0x4f1179,_0x500455){_0x4f1179=_0x4f1179-0x0;var _0x27b7f8=_0x3932[_0x4f1179];return _0x27b7f8;};'use strict';var _=require(_0x2393('0x0'));var attributes=require(_0x2393('0x1'));var qs=require(_0x2393('0x2'));var squel=require(_0x2393('0x3'));module['exports']=function(_0x17350d){var _0x1691d3=_0x17350d[_0x2393('0x4')];function _0x175639(_0x4e73b0,_0x54bf06){return new Promise(function(_0x5b90a9,_0xf6f665){if(!_0x54bf06)return _0x5b90a9(null);var _0x3f2c53=_0x54bf06[_0x2393('0x5')]?{[_0x54bf06['filter'][_0x2393('0x6')]]:_0x54bf06[_0x2393('0x5')]['value']}:undefined;return _0x1691d3[_0x4e73b0][_0x2393('0x7')]({'where':_0x3f2c53,'raw':!![]})[_0x2393('0x8')](function(_0x21ff17){_0x54bf06[_0x2393('0x9')]=_[_0x2393('0xa')](_0x21ff17,'id');_0x5b90a9(_0x54bf06);})[_0x2393('0xb')](function(_0x2ccbb4){_0xf6f665(_0x2ccbb4);});});}function _0x425e92(_0x531bf6,_0x4fe041){return new Promise(function(_0x58e7f5,_0x190cd1){var _0x3d877=_0x531bf6[_0x2393('0x5')]?{[_0x531bf6[_0x2393('0x5')][_0x2393('0x6')]]:_0x531bf6['filter'][_0x2393('0xc')]}:undefined;return _0x1691d3[_0x531bf6[_0x2393('0xd')]][_0x2393('0x7')]({'where':_0x3d877,'raw':!![]})[_0x2393('0x8')](function(_0x145dd2){_0x4fe041[_0x2393('0x9')]=_[_0x2393('0xa')](_0x145dd2,function(_0x39df59){return _0x39df59[_0x2393('0xe')];});_0x58e7f5(_0x4fe041);})[_0x2393('0xb')](function(_0x4ad9cc){_0x190cd1(_0x4ad9cc);});});}function _0x52a0ff(_0x3feb9d,_0x3a22b5,_0x10137b){if(!_0x3a22b5)return Promise[_0x2393('0xf')](null);return new Promise(function(_0x274c8a,_0x528855){return _0x1691d3[_0x2393('0x10')][_0x2393('0x7')]({'where':{'sectionId':_0x3a22b5['id']},'raw':!![]})[_0x2393('0x8')](function(_0x2cb28c){if(_0x3feb9d['field']&&_0x3feb9d['field']!=='id'){_0x3a22b5[_0x2393('0x9')]=_[_0x2393('0xa')](_0x2cb28c,function(_0x57ed3d){return _0x57ed3d[_0x3feb9d['field']];});}else{if(_0x10137b===_0x2393('0x11')){_0x3a22b5['associatedResources']=_[_0x2393('0xa')](_0x2cb28c,function(_0x54e279){return{'id':_0x54e279[_0x2393('0x12')],'type':_0x54e279[_0x2393('0x13')]};});}else{_0x3a22b5['associatedResources']=_[_0x2393('0xa')](_0x2cb28c,function(_0x20cc5f){return _0x20cc5f['resourceId'];});}}_0x274c8a(_0x3a22b5);})['catch'](function(_0x5e102a){_0x528855(_0x5e102a);});});}function _0xf62e5a(_0x52689f,_0x661e56){var _0xe9833a={'parentSections':[]};switch(_0x52689f[_0x2393('0x14')]()){case _0x2393('0x15'):_0xe9833a['childModel']='SquareProject';break;case _0x2393('0x16'):_0xe9833a[_0x2393('0x17')]='SquareOdbc';break;case'squarerecordings':_0xe9833a['childModel']=_0x2393('0x18');_0xe9833a[_0x2393('0x19')]=[{'name':_0x2393('0x1a'),'field':_0x2393('0xe'),'foreignKey':_0x2393('0x1b')}];break;case _0x2393('0x1c'):_0xe9833a['childModel']='JscriptyProject';break;case _0x2393('0x1d'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x1e');_0xe9833a['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x2393('0x1f')}];break;case _0x2393('0x20'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x21');break;case _0x2393('0x22'):_0xe9833a['childModel']=_0x2393('0x23');break;case'globalcustomfields':_0xe9833a['childModel']=_0x2393('0x24');break;case _0x2393('0x25'):_0xe9833a[_0x2393('0x17')]='ChatQueue';break;case _0x2393('0x26'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x27');break;case _0x2393('0x28'):_0xe9833a['childModel']=_0x2393('0x29');break;case _0x2393('0x2a'):_0xe9833a[_0x2393('0x17')]='FaxAccount';break;case _0x2393('0x2b'):case _0x2393('0x2c'):case _0x2393('0x2d'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x2e');break;case _0x2393('0x2f'):_0xe9833a['childModel']=_0x2393('0x30');break;case _0x2393('0x31'):_0xe9833a['childModel']=_0x2393('0x32');break;case _0x2393('0x33'):_0xe9833a[_0x2393('0x17')]='VoiceRecording';_0xe9833a[_0x2393('0x19')]=[{'name':_0x2393('0x34'),'field':_0x2393('0xe'),'foreignKey':_0x2393('0x35'),'model':_0x2393('0x36'),'filter':{'field':_0x2393('0x37'),'value':['agent']}},{'name':'Telephones','field':_0x2393('0xe'),'foreignKey':_0x2393('0x35'),'model':_0x2393('0x36'),'filter':{'field':_0x2393('0x37'),'value':[_0x2393('0x38')]}},{'name':_0x2393('0x39'),'field':'name','foreignKey':_0x2393('0x3a'),'model':_0x2393('0x3b'),'filter':{'field':_0x2393('0x13'),'value':['inbound']}},{'name':_0x2393('0x3c'),'field':_0x2393('0xe'),'foreignKey':_0x2393('0x3a'),'model':_0x2393('0x3b'),'filter':{'field':_0x2393('0x13'),'value':[_0x2393('0x3d')]}}];break;case _0x2393('0x3e'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x3f');break;case _0x2393('0x40'):_0xe9833a[_0x2393('0x17')]='VoiceChanSpy';break;case _0x2393('0x41'):_0xe9833a['childModel']=_0x2393('0x42');break;case'ivrcampaigns':_0xe9833a[_0x2393('0x17')]=_0x2393('0x43');break;case _0x2393('0x44'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x45');break;case _0x2393('0x46'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x47');break;case _0x2393('0x48'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x49');break;case'openchannelqueues':_0xe9833a[_0x2393('0x17')]=_0x2393('0x4a');break;case _0x2393('0x4b'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x4c');break;case _0x2393('0x4d'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x4e');break;case'smsaccounts':_0xe9833a[_0x2393('0x17')]=_0x2393('0x4f');break;case _0x2393('0x50'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x51');break;case'whatsappaccounts':_0xe9833a[_0x2393('0x17')]='WhatsappAccount';break;case _0x2393('0x52'):_0xe9833a[_0x2393('0x17')]='Team';break;case _0x2393('0x53'):case _0x2393('0x54'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x3b');if(_0x661e56){_0xe9833a['parentSections']=[{'name':'VoiceQueues'},{'name':_0x2393('0x3c')}];}break;case'users':case _0x2393('0x55'):case'telephones':_0xe9833a['childModel']=_0x2393('0x36');if(_0x661e56){_0xe9833a[_0x2393('0x19')]=[{'name':_0x2393('0x56'),'filter':{'field':'role','value':[_0x2393('0x57'),_0x2393('0x58')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xe9833a[_0x2393('0x17')]=_0x2393('0x59');break;case _0x2393('0x5a'):_0xe9833a['childModel']=_0x2393('0x5b');break;case'freshdeskaccounts':_0xe9833a['childModel']=_0x2393('0x5c');break;case'sugarcrmaccounts':_0xe9833a[_0x2393('0x17')]=_0x2393('0x5d');break;case _0x2393('0x5e'):_0xe9833a[_0x2393('0x17')]='DeskAccount';break;case _0x2393('0x5f'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x60');break;case _0x2393('0x61'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x36');break;case'cannedanswers':_0xe9833a['childModel']=_0x2393('0x62');break;case'dispositions':_0xe9833a[_0x2393('0x17')]=_0x2393('0x63');break;case _0x2393('0x64'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x65');break;case _0x2393('0x66'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x67');break;case _0x2393('0x68'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x69');break;case _0x2393('0x6a'):_0xe9833a[_0x2393('0x17')]='Schedule';break;case _0x2393('0x6b'):_0xe9833a['childModel']=_0x2393('0x6c');break;case'tags':_0xe9833a[_0x2393('0x17')]=_0x2393('0x6d');break;case _0x2393('0x6e'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x6f');break;case _0x2393('0x70'):_0xe9833a[_0x2393('0x17')]='Trigger';break;case'trunks':_0xe9833a[_0x2393('0x17')]=_0x2393('0x71');break;case'variables':_0xe9833a[_0x2393('0x17')]='Variable';break;case _0x2393('0x72'):_0xe9833a[_0x2393('0x17')]=_0x2393('0x73');break;case'extractedreports':_0xe9833a[_0x2393('0x17')]='AnalyticExtractedReport';_0xe9833a[_0x2393('0x19')]=[{'name':_0x2393('0x74'),'field':'id','foreignKey':_0x2393('0x75')}];break;case _0x2393('0x76'):_0xe9833a['childModel']=_0x2393('0x77');break;}return _0xe9833a;}function _0x427d84(_0x1831d2,_0x58fed6){var _0x2a285c=_0x1831d2[_0x2393('0x78')](0x0)[_0x2393('0x79')]()+_0x1831d2[_0x2393('0x7a')](0x1);var _0x338a22={'type':_0x1691d3['Sequelize'][_0x2393('0x7b')][_0x2393('0x7c')],'raw':!![]};return new Promise(function(_0x34bf3a,_0x27a352){var _0x356751=squel['select']()[_0x2393('0x6')]('ui.'+_0x2a285c+_0x2393('0x7d'),'id')[_0x2393('0x6')](_0x2393('0x7e'))[_0x2393('0x7f')](_0x2393('0x80')+_0x1831d2+_0x2393('0x81'),'ui')['where'](_0x2393('0x82'),_0x58fed6['id']);return _0x1691d3[_0x2393('0x83')][_0x2393('0x84')](_0x356751['toString'](),_0x338a22)[_0x2393('0x8')](function(_0x146822){_0x58fed6[_0x2a285c+_0x2393('0x85')]=_0x146822;_0x34bf3a(_0x146822);})[_0x2393('0xb')](function(_0x35e314){_0x27a352(_0x35e314);});});}return _0x17350d[_0x2393('0x86')](_0x2393('0x87'),attributes,{'tableName':_0x2393('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1f8089){var _0x4c4df6={'raw':_0x1f8089[_0x2393('0x84')]['raw'],'where':{}};var _0x493500={};var _0x4391a7={'count':0x0,'rows':[]};var _0x1cea03=_0x1f8089[_0x2393('0x84')][_0x2393('0x89')];var _0x513b40=_0x1f8089[_0x2393('0x84')]['mergeResources']||![];var _0x3d4c06=_0xf62e5a(_0x1cea03,_0x513b40);if(!_0x3d4c06[_0x2393('0x17')])throw new Error(_0x2393('0x8a')+_0x1cea03+'\x27');var _0x19ec50=[{'name':_0x1cea03}];if(!_[_0x2393('0x8b')](_0x3d4c06[_0x2393('0x19')]))_0x19ec50=_0x3d4c06[_0x2393('0x19')];var _0x566062=[];for(var _0x9d9692=0x0;_0x9d9692<_0x19ec50[_0x2393('0x8c')];_0x9d9692++){_0x566062['push'](_0x1691d3[_0x2393('0x8d')][_0x2393('0x8e')]({'where':{'userProfileId':_0x1f8089['params']['id'],'name':_0x19ec50[_0x9d9692][_0x2393('0xe')]},'raw':!![]}));}return Promise[_0x2393('0x8f')](_0x566062)[_0x2393('0x8')](function(_0x349f3b){var _0x30d7e2=_[_0x2393('0x5')](_0x349f3b,function(_0x3318fb){return _0x3318fb?_0x3318fb:undefined;});var _0x3b110e=_[_0x2393('0x5')](_0x19ec50,[_0x2393('0x90'),!![]]);var _0x4d4b3d=_[_0x2393('0x8b')](_0x30d7e2)&&_[_0x2393('0x8b')](_0x3b110e)?null:_[_0x2393('0x91')](_0x3b110e,_0x30d7e2);if(!_0x4d4b3d)return null;var _0x3b2778=[];for(var _0x3ddfcc=0x0;_0x3ddfcc<_0x4d4b3d[_0x2393('0x8c')];_0x3ddfcc++){var _0x21c14c=_['find'](_0x19ec50,function(_0xe64aca){return _0x4d4b3d[_0x3ddfcc]?_0xe64aca['name']===_0x4d4b3d[_0x3ddfcc][_0x2393('0xe')]:null;});if(_0x21c14c){if(_0x4d4b3d[_0x3ddfcc][_0x2393('0x90')]){_0x3b2778[_0x2393('0x92')](_0x175639(_0x3d4c06[_0x2393('0x17')],_0x4d4b3d[_0x3ddfcc]));}else{if(!_0x4d4b3d[_0x3ddfcc][_0x2393('0x93')]){_0x3b2778[_0x2393('0x92')](_0x52a0ff(_0x21c14c,_0x4d4b3d[_0x3ddfcc],_0x3d4c06[_0x2393('0x17')]));}else{if(_0x21c14c[_0x2393('0xd')]){_0x3b2778[_0x2393('0x92')](_0x425e92(_0x21c14c,_0x4d4b3d[_0x3ddfcc]));}}}}}return Promise[_0x2393('0x8f')](_0x3b2778);})[_0x2393('0x8')](function(_0x566278){var _0x434c1e=_0x566278;var _0x1629d3=null;if(_0x434c1e){_0x1629d3=_0x434c1e[_0x2393('0x8c')]===0x1?_0x434c1e[0x0]:null;}if(!_0x1629d3&&!_0x434c1e)return _0x4391a7;var _0x4013c0=_0x1691d3[_0x3d4c06[_0x2393('0x17')]][_0x2393('0x94')];_0x493500[_0x2393('0xd')]=_['keys'](_0x4013c0);_0x493500['query']=_[_0x2393('0x95')](_0x1f8089[_0x2393('0x84')]);_0x493500[_0x2393('0x96')]=_[_0x2393('0x97')](_0x493500['model'],_0x493500[_0x2393('0x84')]);_0x4c4df6[_0x2393('0x98')]=_[_0x2393('0x97')](_0x493500[_0x2393('0xd')],qs[_0x2393('0x99')](_0x1f8089[_0x2393('0x84')][_0x2393('0x99')]));_0x4c4df6[_0x2393('0x98')]=_0x4c4df6[_0x2393('0x98')][_0x2393('0x8c')]?_0x4c4df6['attributes']:_0x493500[_0x2393('0xd')];if(!_0x1f8089[_0x2393('0x84')]['hasOwnProperty'](_0x2393('0x9a'))){_0x4c4df6[_0x2393('0x9b')]=qs['limit'](_0x1f8089[_0x2393('0x84')][_0x2393('0x9b')]);_0x4c4df6['offset']=qs[_0x2393('0x9c')](_0x1f8089[_0x2393('0x84')][_0x2393('0x9c')]);}_0x4c4df6[_0x2393('0x9d')]=qs[_0x2393('0x9e')](_0x1f8089[_0x2393('0x84')][_0x2393('0x9e')]);_0x4c4df6[_0x2393('0x9f')]=qs[_0x2393('0x96')](_[_0x2393('0xa0')](_0x1f8089['query'],_0x493500['filters']));if(_0x1f8089[_0x2393('0x84')][_0x2393('0x5')]){_0x4c4df6[_0x2393('0x9f')]=_['merge'](_0x4c4df6[_0x2393('0x9f')],{'$or':_[_0x2393('0xa')](_0x4013c0,function(_0x35d92b){if(_0x35d92b[_0x2393('0x13')][_0x2393('0xa1')]!==_0x2393('0xa2')){var _0x4ebefa={};_0x4ebefa[_0x35d92b['field']]={'$like':'%'+_0x1f8089['query']['filter']+'%'};return _0x4ebefa;}})});}var _0x212549=[];var _0x3f26e9=null;var _0x25493b={};if(_0x1629d3){_0x3f26e9=_[_0x2393('0x8e')](_0x19ec50,['name',_0x1629d3['name']]);if(_0x3f26e9[_0x2393('0x6')]){_0x25493b={};if(_0x3d4c06[_0x2393('0x17')]===_0x2393('0x11')){_0x25493b[_0x3f26e9['foreignKey']]=_[_0x2393('0xa')](_0x1629d3[_0x2393('0x9')],'id');}else{_0x25493b[_0x3f26e9[_0x2393('0xa3')]]=_0x1629d3[_0x2393('0x9')];}_0x212549['push'](_0x25493b);}else{_0x4c4df6[_0x2393('0x9f')]['id']=_0x1629d3[_0x2393('0x9')];}}else{for(var _0x128321=0x0;_0x128321<_0x434c1e[_0x2393('0x8c')];_0x128321++){_0x3f26e9=_[_0x2393('0x8e')](_0x19ec50,[_0x2393('0xe'),_0x434c1e[_0x128321][_0x2393('0xe')]]);if(_0x3f26e9[_0x2393('0x6')]){_0x25493b={};_0x25493b[_0x3f26e9[_0x2393('0xa3')]]=_0x434c1e[_0x128321]['associatedResources'];_0x212549[_0x2393('0x92')](_0x25493b);}else{if(!_0x4c4df6['where']['id'])_0x4c4df6[_0x2393('0x9f')]['id']=[];_0x434c1e[_0x128321][_0x2393('0x9')][_0x2393('0xa4')](function(_0x586633){_0x4c4df6[_0x2393('0x9f')]['id'][_0x2393('0x92')](_0x586633);});}}}if(!_[_0x2393('0x8b')](_0x212549)){_0x4c4df6[_0x2393('0x9f')]=_['merge'](_0x4c4df6[_0x2393('0x9f')],{'$and':{'$or':_0x212549}});}_0x4c4df6=_[_0x2393('0xa5')]({},_0x4c4df6,_0x1f8089[_0x2393('0xa6')]);if(_0x1629d3&&!_0x1629d3[_0x2393('0x93')]&&_0x3d4c06[_0x2393('0x17')]===_0x2393('0x11')){if(_0x1f8089[_0x2393('0x84')][_0x2393('0xa7')]){_0x4c4df6['include']=[{'all':!![]}];}return _0x1691d3[_0x3d4c06[_0x2393('0x17')]][_0x2393('0x7')](_0x4c4df6)[_0x2393('0x8')](function(_0x49485e){var _0x4865b7=[];_0x49485e[_0x2393('0xa4')](function(_0x367a2e){var _0x3f59b3;switch(_0x367a2e[_0x2393('0xa8')]){case'default':_0x3f59b3=_[_0x2393('0x8e')](_0x1629d3['associatedResources'],function(_0x4e408a){return _0x4e408a['id']===_0x367a2e['reportId']&&_0x4e408a['type']===_0x2393('0xa9');});break;case _0x2393('0xaa'):_0x3f59b3=_['find'](_0x1629d3['associatedResources'],function(_0x3ef236){return _0x3ef236['id']===_0x367a2e[_0x2393('0x75')]&&_0x3ef236[_0x2393('0x13')]==='CustomReports';});break;}if(_0x3f59b3)_0x4865b7[_0x2393('0x92')](_0x367a2e);});_0x4391a7['count']=_0x4865b7[_0x2393('0x8c')];_0x4391a7[_0x2393('0xab')]=_0x4865b7;return _0x4391a7;});}else{if(!_['isEmpty'](_0x1f8089[_0x2393('0x84')][_0x2393('0xac')])){_0x4c4df6[_0x2393('0x9f')]['id']=_0x4c4df6['where']['id']?_[_0x2393('0x97')](_0x4c4df6[_0x2393('0x9f')]['id'],_0x1f8089[_0x2393('0x84')]['ids']):_0x1f8089[_0x2393('0x84')][_0x2393('0xac')];if(_0x1f8089[_0x2393('0x84')][_0x2393('0xad')]){_0x4c4df6[_0x2393('0x9d')]=_0x1f8089[_0x2393('0x84')][_0x2393('0xad')];}}if(_0x1f8089[_0x2393('0x84')][_0x2393('0xae')]){_0x4c4df6[_0x2393('0x9f')]=_['merge'](_0x4c4df6[_0x2393('0x9f')],{'$and':_0x1f8089[_0x2393('0x84')][_0x2393('0xae')]});}return _0x1691d3[_0x3d4c06[_0x2393('0x17')]][_0x2393('0xaf')]({'where':_0x4c4df6[_0x2393('0x9f')]})[_0x2393('0x8')](function(_0x576ef1){_0x4391a7[_0x2393('0xaf')]=_0x576ef1;if(_0x1f8089[_0x2393('0x84')]['includeAll']){if(_0x3d4c06[_0x2393('0x17')]===_0x2393('0x1e')){_0x4c4df6[_0x2393('0xb0')]=[{'model':_0x1691d3[_0x2393('0x6d')],'as':_0x2393('0xb1'),'attributes':['id','name',_0x2393('0xb2')],'required':_0x1f8089[_0x2393('0x84')][_0x2393('0xb3')]?!![]:![]},{'model':_0x1691d3[_0x2393('0x6d')],'as':_0x2393('0xb4'),'attributes':['id',_0x2393('0xe'),_0x2393('0xb2')],'through':_0x1f8089[_0x2393('0x84')][_0x2393('0xb3')]?{'attributes':[],'where':{'TagId':_0x1f8089[_0x2393('0x84')][_0x2393('0xb3')]||undefined}}:{},'required':_0x1f8089[_0x2393('0x84')][_0x2393('0xb3')]?!![]:![]}];}else{_0x4c4df6[_0x2393('0xb0')]=[{'all':!![]}];}}return _0x1691d3[_0x3d4c06[_0x2393('0x17')]][_0x2393('0x7')](_0x4c4df6);})[_0x2393('0x8')](function(_0x1d39b4){_0x4391a7[_0x2393('0xab')]=_0x1d39b4;if(_0x1cea03===_0x2393('0x34')&&_0x1f8089[_0x2393('0x84')][_0x2393('0xb5')]==='true'){var _0x2a9d2e=[];for(var _0x3c03c4=0x0;_0x3c03c4<_0x4391a7['rows'][_0x2393('0x8c')];_0x3c03c4++){_0x2a9d2e['push'](_0x427d84(_0x2393('0xb6'),_0x4391a7[_0x2393('0xab')][_0x3c03c4][_0x2393('0xb7')]));_0x2a9d2e[_0x2393('0x92')](_0x427d84(_0x2393('0xb8'),_0x4391a7[_0x2393('0xab')][_0x3c03c4][_0x2393('0xb7')]));_0x2a9d2e[_0x2393('0x92')](_0x427d84(_0x2393('0xb9'),_0x4391a7[_0x2393('0xab')][_0x3c03c4]['dataValues']));_0x2a9d2e['push'](_0x427d84(_0x2393('0xba'),_0x4391a7[_0x2393('0xab')][_0x3c03c4][_0x2393('0xb7')]));_0x2a9d2e[_0x2393('0x92')](_0x427d84(_0x2393('0xbb'),_0x4391a7['rows'][_0x3c03c4][_0x2393('0xb7')]));_0x2a9d2e[_0x2393('0x92')](_0x427d84(_0x2393('0xbc'),_0x4391a7[_0x2393('0xab')][_0x3c03c4][_0x2393('0xb7')]));}return Promise[_0x2393('0x8f')](_0x2a9d2e)['then'](function(){return _0x4391a7;});}return _0x4391a7;});}});}}});}; \ No newline at end of file +var _0x650b=['internalroutes','outboundroutes','voicemails','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','QueueCampaigns','users','telephones','admin','zendeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Plugin','Reports','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','push','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','filters','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','include','Tags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','then','associatedResources','map','catch','value','model','findAll','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes'];(function(_0xa56ac1,_0x8234e7){var _0x525a0f=function(_0x327421){while(--_0x327421){_0xa56ac1['push'](_0xa56ac1['shift']());}};_0x525a0f(++_0x8234e7);}(_0x650b,0x142));var _0xb650=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0x650b[_0x3f43ef];return _0x20af43;};'use strict';var _=require(_0xb650('0x0'));var attributes=require(_0xb650('0x1'));var qs=require(_0xb650('0x2'));var squel=require(_0xb650('0x3'));module[_0xb650('0x4')]=function(_0x231cd5){var _0x209aff=_0x231cd5[_0xb650('0x5')];function _0x2c63bb(_0x33b924,_0x2e73ba){return new Promise(function(_0x3b3e29,_0x3ad497){if(!_0x2e73ba)return _0x3b3e29(null);var _0x3451f6=_0x2e73ba[_0xb650('0x6')]?{[_0x2e73ba['filter'][_0xb650('0x7')]]:_0x2e73ba[_0xb650('0x6')]['value']}:undefined;return _0x209aff[_0x33b924]['findAll']({'where':_0x3451f6,'raw':!![]})[_0xb650('0x8')](function(_0x1db0b2){_0x2e73ba[_0xb650('0x9')]=_[_0xb650('0xa')](_0x1db0b2,'id');_0x3b3e29(_0x2e73ba);})[_0xb650('0xb')](function(_0x2e5c09){_0x3ad497(_0x2e5c09);});});}function _0x24ba6e(_0xe39173,_0x46d716){return new Promise(function(_0x351515,_0x2012a7){var _0x2080dc=_0xe39173[_0xb650('0x6')]?{[_0xe39173['filter'][_0xb650('0x7')]]:_0xe39173['filter'][_0xb650('0xc')]}:undefined;return _0x209aff[_0xe39173[_0xb650('0xd')]][_0xb650('0xe')]({'where':_0x2080dc,'raw':!![]})[_0xb650('0x8')](function(_0x3b5992){_0x46d716[_0xb650('0x9')]=_[_0xb650('0xa')](_0x3b5992,function(_0x8858e4){return _0x8858e4[_0xb650('0xf')];});_0x351515(_0x46d716);})[_0xb650('0xb')](function(_0x1519b0){_0x2012a7(_0x1519b0);});});}function _0x3a30d6(_0x8a064f,_0x57d07f,_0xcb9937){if(!_0x57d07f)return Promise['resolve'](null);return new Promise(function(_0x2cb565,_0x39cf34){return _0x209aff[_0xb650('0x10')][_0xb650('0xe')]({'where':{'sectionId':_0x57d07f['id']},'raw':!![]})[_0xb650('0x8')](function(_0x12c57a){if(_0x8a064f[_0xb650('0x7')]&&_0x8a064f[_0xb650('0x7')]!=='id'){_0x57d07f['associatedResources']=_[_0xb650('0xa')](_0x12c57a,function(_0x22e511){return _0x22e511[_0x8a064f['field']];});}else{if(_0xcb9937===_0xb650('0x11')){_0x57d07f[_0xb650('0x9')]=_[_0xb650('0xa')](_0x12c57a,function(_0x59651d){return{'id':_0x59651d[_0xb650('0x12')],'type':_0x59651d[_0xb650('0x13')]};});}else{_0x57d07f[_0xb650('0x9')]=_['map'](_0x12c57a,function(_0x176ca0){return _0x176ca0['resourceId'];});}}_0x2cb565(_0x57d07f);})[_0xb650('0xb')](function(_0x2fe904){_0x39cf34(_0x2fe904);});});}function _0x3f6ee3(_0x420a01,_0x3335c9){var _0x380feb={'parentSections':[]};switch(_0x420a01['toLowerCase']()){case _0xb650('0x14'):_0x380feb[_0xb650('0x15')]=_0xb650('0x16');break;case _0xb650('0x17'):_0x380feb[_0xb650('0x15')]='SquareOdbc';break;case _0xb650('0x18'):_0x380feb[_0xb650('0x15')]=_0xb650('0x19');_0x380feb['parentSections']=[{'name':_0xb650('0x1a'),'field':_0xb650('0xf'),'foreignKey':'projectName'}];break;case _0xb650('0x1b'):_0x380feb[_0xb650('0x15')]='JscriptyProject';break;case _0xb650('0x1c'):_0x380feb[_0xb650('0x15')]=_0xb650('0x1d');_0x380feb[_0xb650('0x1e')]=[{'name':_0xb650('0x1f'),'field':'id','foreignKey':_0xb650('0x20')}];break;case _0xb650('0x21'):_0x380feb[_0xb650('0x15')]=_0xb650('0x22');break;case _0xb650('0x23'):_0x380feb[_0xb650('0x15')]='CmCompany';break;case'globalcustomfields':_0x380feb[_0xb650('0x15')]=_0xb650('0x24');break;case _0xb650('0x25'):_0x380feb[_0xb650('0x15')]=_0xb650('0x26');break;case _0xb650('0x27'):_0x380feb[_0xb650('0x15')]='ChatWebsite';break;case _0xb650('0x28'):_0x380feb[_0xb650('0x15')]='FaxQueue';break;case _0xb650('0x29'):_0x380feb[_0xb650('0x15')]=_0xb650('0x2a');break;case _0xb650('0x2b'):case _0xb650('0x2c'):case _0xb650('0x2d'):_0x380feb[_0xb650('0x15')]='VoiceExtension';break;case'contexts':_0x380feb[_0xb650('0x15')]='VoiceContext';break;case _0xb650('0x2e'):_0x380feb[_0xb650('0x15')]='VoiceMail';break;case _0xb650('0x2f'):_0x380feb[_0xb650('0x15')]='VoiceRecording';_0x380feb[_0xb650('0x1e')]=[{'name':_0xb650('0x30'),'field':_0xb650('0xf'),'foreignKey':_0xb650('0x31'),'model':_0xb650('0x32'),'filter':{'field':_0xb650('0x33'),'value':[_0xb650('0x34')]}},{'name':_0xb650('0x35'),'field':_0xb650('0xf'),'foreignKey':'membername','model':_0xb650('0x32'),'filter':{'field':_0xb650('0x33'),'value':[_0xb650('0x36')]}},{'name':_0xb650('0x37'),'field':_0xb650('0xf'),'foreignKey':_0xb650('0x38'),'model':_0xb650('0x39'),'filter':{'field':'type','value':[_0xb650('0x3a')]}},{'name':'QueueCampaigns','field':_0xb650('0xf'),'foreignKey':_0xb650('0x38'),'model':_0xb650('0x39'),'filter':{'field':'type','value':[_0xb650('0x3b')]}}];break;case'musiconholds':_0x380feb['childModel']='VoiceMusicOnHold';break;case _0xb650('0x3c'):_0x380feb[_0xb650('0x15')]=_0xb650('0x3d');break;case'voiceprefixes':_0x380feb['childModel']=_0xb650('0x3e');break;case _0xb650('0x3f'):_0x380feb['childModel']=_0xb650('0x40');break;case _0xb650('0x41'):_0x380feb[_0xb650('0x15')]='MailQueue';break;case _0xb650('0x42'):_0x380feb['childModel']=_0xb650('0x43');break;case _0xb650('0x44'):_0x380feb[_0xb650('0x15')]=_0xb650('0x45');break;case'openchannelqueues':_0x380feb[_0xb650('0x15')]=_0xb650('0x46');break;case'openchannelaccounts':_0x380feb[_0xb650('0x15')]=_0xb650('0x47');break;case _0xb650('0x48'):_0x380feb[_0xb650('0x15')]=_0xb650('0x49');break;case _0xb650('0x4a'):_0x380feb['childModel']=_0xb650('0x4b');break;case'whatsappqueues':_0x380feb[_0xb650('0x15')]=_0xb650('0x4c');break;case _0xb650('0x4d'):_0x380feb[_0xb650('0x15')]=_0xb650('0x4e');break;case _0xb650('0x4f'):_0x380feb[_0xb650('0x15')]=_0xb650('0x50');break;case'voicequeues':case _0xb650('0x51'):_0x380feb['childModel']=_0xb650('0x39');if(_0x3335c9){_0x380feb[_0xb650('0x1e')]=[{'name':_0xb650('0x37')},{'name':_0xb650('0x52')}];}break;case _0xb650('0x53'):case'agents':case _0xb650('0x54'):_0x380feb[_0xb650('0x15')]=_0xb650('0x32');if(_0x3335c9){_0x380feb[_0xb650('0x1e')]=[{'name':'Users','filter':{'field':_0xb650('0x33'),'value':[_0xb650('0x55'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xb650('0x35')}];}break;case _0xb650('0x56'):_0x380feb[_0xb650('0x15')]='ZendeskAccount';break;case'salesforceaccounts':_0x380feb[_0xb650('0x15')]='SalesforceAccount';break;case'freshdeskaccounts':_0x380feb[_0xb650('0x15')]=_0xb650('0x57');break;case _0xb650('0x58'):_0x380feb[_0xb650('0x15')]=_0xb650('0x59');break;case'deskaccounts':_0x380feb[_0xb650('0x15')]=_0xb650('0x5a');break;case _0xb650('0x5b'):_0x380feb[_0xb650('0x15')]=_0xb650('0x5c');break;case'vtigeraccounts':_0x380feb['childModel']=_0xb650('0x32');break;case'cannedanswers':_0x380feb['childModel']=_0xb650('0x5d');break;case _0xb650('0x5e'):_0x380feb[_0xb650('0x15')]=_0xb650('0x5f');break;case'customdashboards':_0x380feb[_0xb650('0x15')]=_0xb650('0x60');break;case _0xb650('0x61'):_0x380feb[_0xb650('0x15')]=_0xb650('0x62');break;case'pauses':_0x380feb[_0xb650('0x15')]=_0xb650('0x63');break;case _0xb650('0x64'):_0x380feb[_0xb650('0x15')]=_0xb650('0x65');break;case'sounds':_0x380feb[_0xb650('0x15')]=_0xb650('0x66');break;case'tags':_0x380feb[_0xb650('0x15')]=_0xb650('0x67');break;case _0xb650('0x68'):_0x380feb[_0xb650('0x15')]=_0xb650('0x69');break;case'triggers':_0x380feb['childModel']=_0xb650('0x6a');break;case _0xb650('0x6b'):_0x380feb[_0xb650('0x15')]=_0xb650('0x6c');break;case _0xb650('0x6d'):_0x380feb[_0xb650('0x15')]='Variable';break;case'plugins':_0x380feb[_0xb650('0x15')]=_0xb650('0x6e');break;case'extractedreports':_0x380feb[_0xb650('0x15')]='AnalyticExtractedReport';_0x380feb['parentSections']=[{'name':_0xb650('0x6f'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x380feb[_0xb650('0x15')]=_0xb650('0x70');break;}return _0x380feb;}function _0x4dd255(_0x451c6c,_0x348eed){var _0x49e8bf=_0x451c6c[_0xb650('0x71')](0x0)[_0xb650('0x72')]()+_0x451c6c['slice'](0x1);var _0x32b9af={'type':_0x209aff['Sequelize'][_0xb650('0x73')][_0xb650('0x74')],'raw':!![]};return new Promise(function(_0x81c17,_0x3030fa){var _0x15d008=squel[_0xb650('0x75')]()[_0xb650('0x7')](_0xb650('0x76')+_0x49e8bf+_0xb650('0x77'),'id')[_0xb650('0x7')](_0xb650('0x78'))[_0xb650('0x79')]('user_has_'+_0x451c6c+'_interactions','ui')[_0xb650('0x7a')](_0xb650('0x7b'),_0x348eed['id']);return _0x209aff[_0xb650('0x7c')][_0xb650('0x7d')](_0x15d008[_0xb650('0x7e')](),_0x32b9af)[_0xb650('0x8')](function(_0xfe2a4d){_0x348eed[_0x49e8bf+_0xb650('0x7f')]=_0xfe2a4d;_0x81c17(_0xfe2a4d);})['catch'](function(_0x542370){_0x3030fa(_0x542370);});});}return _0x231cd5[_0xb650('0x80')](_0xb650('0x81'),attributes,{'tableName':_0xb650('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2ff199){var _0x563ba0={'raw':_0x2ff199[_0xb650('0x7d')][_0xb650('0x83')],'where':{}};var _0x43a34f={};var _0x2e6dd8={'count':0x0,'rows':[]};var _0x31da54=_0x2ff199['query']['section'];var _0x1e1484=_0x2ff199[_0xb650('0x7d')][_0xb650('0x84')]||![];var _0x1efca5=_0x3f6ee3(_0x31da54,_0x1e1484);if(!_0x1efca5['childModel'])throw new Error(_0xb650('0x85')+_0x31da54+'\x27');var _0xd4d801=[{'name':_0x31da54}];if(!_[_0xb650('0x86')](_0x1efca5[_0xb650('0x1e')]))_0xd4d801=_0x1efca5[_0xb650('0x1e')];var _0x963f5d=[];for(var _0x6bf9f1=0x0;_0x6bf9f1<_0xd4d801[_0xb650('0x87')];_0x6bf9f1++){_0x963f5d['push'](_0x209aff[_0xb650('0x88')][_0xb650('0x89')]({'where':{'userProfileId':_0x2ff199[_0xb650('0x8a')]['id'],'name':_0xd4d801[_0x6bf9f1][_0xb650('0xf')]},'raw':!![]}));}return Promise[_0xb650('0x8b')](_0x963f5d)[_0xb650('0x8')](function(_0x3dee5e){var _0x429dea=_[_0xb650('0x6')](_0x3dee5e,function(_0x207a7d){return _0x207a7d?_0x207a7d:undefined;});var _0x597430=_[_0xb650('0x6')](_0xd4d801,[_0xb650('0x8c'),!![]]);var _0x2185f4=_['isEmpty'](_0x429dea)&&_[_0xb650('0x86')](_0x597430)?null:_['union'](_0x597430,_0x429dea);if(!_0x2185f4)return null;var _0x50593e=[];for(var _0x497e27=0x0;_0x497e27<_0x2185f4[_0xb650('0x87')];_0x497e27++){var _0x576f41=_['find'](_0xd4d801,function(_0x2ee9df){return _0x2185f4[_0x497e27]?_0x2ee9df['name']===_0x2185f4[_0x497e27][_0xb650('0xf')]:null;});if(_0x576f41){if(_0x2185f4[_0x497e27]['ignore']){_0x50593e['push'](_0x2c63bb(_0x1efca5[_0xb650('0x15')],_0x2185f4[_0x497e27]));}else{if(!_0x2185f4[_0x497e27]['autoAssociation']){_0x50593e['push'](_0x3a30d6(_0x576f41,_0x2185f4[_0x497e27],_0x1efca5['childModel']));}else{if(_0x576f41[_0xb650('0xd')]){_0x50593e[_0xb650('0x8d')](_0x24ba6e(_0x576f41,_0x2185f4[_0x497e27]));}}}}}return Promise[_0xb650('0x8b')](_0x50593e);})[_0xb650('0x8')](function(_0x422f56){var _0x34a50c=_0x422f56;var _0x19a553=null;if(_0x34a50c){_0x19a553=_0x34a50c[_0xb650('0x87')]===0x1?_0x34a50c[0x0]:null;}if(!_0x19a553&&!_0x34a50c)return _0x2e6dd8;var _0x184569=_0x209aff[_0x1efca5[_0xb650('0x15')]][_0xb650('0x8e')];_0x43a34f[_0xb650('0xd')]=_[_0xb650('0x8f')](_0x184569);_0x43a34f['query']=_[_0xb650('0x8f')](_0x2ff199[_0xb650('0x7d')]);_0x43a34f['filters']=_[_0xb650('0x90')](_0x43a34f[_0xb650('0xd')],_0x43a34f[_0xb650('0x7d')]);_0x563ba0[_0xb650('0x91')]=_['intersection'](_0x43a34f['model'],qs['fields'](_0x2ff199[_0xb650('0x7d')][_0xb650('0x92')]));_0x563ba0[_0xb650('0x91')]=_0x563ba0[_0xb650('0x91')][_0xb650('0x87')]?_0x563ba0[_0xb650('0x91')]:_0x43a34f[_0xb650('0xd')];if(!_0x2ff199[_0xb650('0x7d')]['hasOwnProperty'](_0xb650('0x93'))){_0x563ba0[_0xb650('0x94')]=qs[_0xb650('0x94')](_0x2ff199[_0xb650('0x7d')][_0xb650('0x94')]);_0x563ba0[_0xb650('0x95')]=qs[_0xb650('0x95')](_0x2ff199[_0xb650('0x7d')][_0xb650('0x95')]);}_0x563ba0[_0xb650('0x96')]=qs[_0xb650('0x97')](_0x2ff199[_0xb650('0x7d')]['sort']);_0x563ba0[_0xb650('0x7a')]=qs['filters'](_[_0xb650('0x98')](_0x2ff199[_0xb650('0x7d')],_0x43a34f[_0xb650('0x99')]));if(_0x2ff199[_0xb650('0x7d')][_0xb650('0x6')]){_0x563ba0[_0xb650('0x7a')]=_[_0xb650('0x9a')](_0x563ba0[_0xb650('0x7a')],{'$or':_['map'](_0x184569,function(_0x3c105c){if(_0x3c105c[_0xb650('0x13')]['key']!==_0xb650('0x9b')){var _0x356047={};_0x356047[_0x3c105c['field']]={'$like':'%'+_0x2ff199[_0xb650('0x7d')][_0xb650('0x6')]+'%'};return _0x356047;}})});}var _0x1f7a82=[];var _0x15d9f4=null;var _0x4f1cbc={};if(_0x19a553){_0x15d9f4=_[_0xb650('0x89')](_0xd4d801,[_0xb650('0xf'),_0x19a553['name']]);if(_0x15d9f4[_0xb650('0x7')]){_0x4f1cbc={};if(_0x1efca5['childModel']==='AnalyticExtractedReport'){_0x4f1cbc[_0x15d9f4['foreignKey']]=_[_0xb650('0xa')](_0x19a553[_0xb650('0x9')],'id');}else{_0x4f1cbc[_0x15d9f4['foreignKey']]=_0x19a553['associatedResources'];}_0x1f7a82[_0xb650('0x8d')](_0x4f1cbc);}else{_0x563ba0[_0xb650('0x7a')]['id']=_0x19a553[_0xb650('0x9')];}}else{for(var _0x4b6b3e=0x0;_0x4b6b3e<_0x34a50c['length'];_0x4b6b3e++){_0x15d9f4=_[_0xb650('0x89')](_0xd4d801,['name',_0x34a50c[_0x4b6b3e][_0xb650('0xf')]]);if(_0x15d9f4[_0xb650('0x7')]){_0x4f1cbc={};_0x4f1cbc[_0x15d9f4[_0xb650('0x9c')]]=_0x34a50c[_0x4b6b3e][_0xb650('0x9')];_0x1f7a82[_0xb650('0x8d')](_0x4f1cbc);}else{if(!_0x563ba0['where']['id'])_0x563ba0[_0xb650('0x7a')]['id']=[];_0x34a50c[_0x4b6b3e][_0xb650('0x9')][_0xb650('0x9d')](function(_0x5d54d2){_0x563ba0[_0xb650('0x7a')]['id'][_0xb650('0x8d')](_0x5d54d2);});}}}if(!_[_0xb650('0x86')](_0x1f7a82)){_0x563ba0[_0xb650('0x7a')]=_[_0xb650('0x9a')](_0x563ba0['where'],{'$and':{'$or':_0x1f7a82}});}_0x563ba0=_[_0xb650('0x9a')]({},_0x563ba0,_0x2ff199[_0xb650('0x9e')]);if(_0x19a553&&!_0x19a553[_0xb650('0x9f')]&&_0x1efca5[_0xb650('0x15')]===_0xb650('0x11')){if(_0x2ff199[_0xb650('0x7d')][_0xb650('0xa0')]){_0x563ba0['include']=[{'all':!![]}];}return _0x209aff[_0x1efca5['childModel']]['findAll'](_0x563ba0)['then'](function(_0xdc474a){var _0xac6ab=[];_0xdc474a[_0xb650('0x9d')](function(_0x1af4e2){var _0x3f9710;switch(_0x1af4e2[_0xb650('0xa1')]){case _0xb650('0xa2'):_0x3f9710=_[_0xb650('0x89')](_0x19a553[_0xb650('0x9')],function(_0x4ab7ce){return _0x4ab7ce['id']===_0x1af4e2[_0xb650('0xa3')]&&_0x4ab7ce[_0xb650('0x13')]===_0xb650('0xa4');});break;case _0xb650('0xa5'):_0x3f9710=_['find'](_0x19a553[_0xb650('0x9')],function(_0x4deabd){return _0x4deabd['id']===_0x1af4e2[_0xb650('0xa3')]&&_0x4deabd[_0xb650('0x13')]===_0xb650('0xa6');});break;}if(_0x3f9710)_0xac6ab[_0xb650('0x8d')](_0x1af4e2);});_0x2e6dd8[_0xb650('0xa7')]=_0xac6ab[_0xb650('0x87')];_0x2e6dd8[_0xb650('0xa8')]=_0xac6ab;return _0x2e6dd8;});}else{if(!_[_0xb650('0x86')](_0x2ff199[_0xb650('0x7d')][_0xb650('0xa9')])){_0x563ba0['where']['id']=_0x563ba0[_0xb650('0x7a')]['id']?_[_0xb650('0x90')](_0x563ba0[_0xb650('0x7a')]['id'],_0x2ff199[_0xb650('0x7d')][_0xb650('0xa9')]):_0x2ff199[_0xb650('0x7d')][_0xb650('0xa9')];if(_0x2ff199[_0xb650('0x7d')][_0xb650('0xaa')]){_0x563ba0[_0xb650('0x96')]=_0x2ff199[_0xb650('0x7d')]['customSorting'];}}if(_0x2ff199['query']['extraQueryConditions']){_0x563ba0[_0xb650('0x7a')]=_[_0xb650('0x9a')](_0x563ba0['where'],{'$and':_0x2ff199[_0xb650('0x7d')][_0xb650('0xab')]});}return _0x209aff[_0x1efca5[_0xb650('0x15')]][_0xb650('0xa7')]({'where':_0x563ba0[_0xb650('0x7a')]})['then'](function(_0x39431e){_0x2e6dd8[_0xb650('0xa7')]=_0x39431e;if(_0x2ff199[_0xb650('0x7d')]['includeAll']){if(_0x1efca5['childModel']===_0xb650('0x1d')){_0x563ba0[_0xb650('0xac')]=[{'model':_0x209aff[_0xb650('0x67')],'as':_0xb650('0xad'),'attributes':['id',_0xb650('0xf'),'color'],'required':_0x2ff199['query'][_0xb650('0xae')]?!![]:![]},{'model':_0x209aff[_0xb650('0x67')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x2ff199['query'][_0xb650('0xae')]?{'attributes':[],'where':{'TagId':_0x2ff199[_0xb650('0x7d')][_0xb650('0xae')]||undefined}}:{},'required':_0x2ff199[_0xb650('0x7d')][_0xb650('0xae')]?!![]:![]}];}else{_0x563ba0[_0xb650('0xac')]=[{'all':!![]}];}}return _0x209aff[_0x1efca5[_0xb650('0x15')]][_0xb650('0xe')](_0x563ba0);})[_0xb650('0x8')](function(_0x1fd77f){_0x2e6dd8[_0xb650('0xa8')]=_0x1fd77f;if(_0x31da54===_0xb650('0x30')&&_0x2ff199[_0xb650('0x7d')][_0xb650('0xaf')]===_0xb650('0xb0')){var _0x1020b1=[];for(var _0x232bad=0x0;_0x232bad<_0x2e6dd8['rows'][_0xb650('0x87')];_0x232bad++){_0x1020b1['push'](_0x4dd255(_0xb650('0xb1'),_0x2e6dd8[_0xb650('0xa8')][_0x232bad][_0xb650('0xb2')]));_0x1020b1[_0xb650('0x8d')](_0x4dd255(_0xb650('0xb3'),_0x2e6dd8[_0xb650('0xa8')][_0x232bad][_0xb650('0xb2')]));_0x1020b1[_0xb650('0x8d')](_0x4dd255(_0xb650('0xb4'),_0x2e6dd8['rows'][_0x232bad][_0xb650('0xb2')]));_0x1020b1[_0xb650('0x8d')](_0x4dd255(_0xb650('0xb5'),_0x2e6dd8[_0xb650('0xa8')][_0x232bad][_0xb650('0xb2')]));_0x1020b1[_0xb650('0x8d')](_0x4dd255(_0xb650('0xb6'),_0x2e6dd8[_0xb650('0xa8')][_0x232bad]['dataValues']));_0x1020b1[_0xb650('0x8d')](_0x4dd255('whatsapp',_0x2e6dd8['rows'][_0x232bad][_0xb650('0xb2')]));}return Promise[_0xb650('0x8b')](_0x1020b1)[_0xb650('0x8')](function(){return _0x2e6dd8;});}return _0x2e6dd8;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e1f48b0..5b085c5 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 _0x4910=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util'];(function(_0x26f2bd,_0x3bde60){var _0x559fea=function(_0x407128){while(--_0x407128){_0x26f2bd['push'](_0x26f2bd['shift']());}};_0x559fea(++_0x3bde60);}(_0x4910,0x1d9));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require('bluebird');var rs=require(_0x0491('0x3'));var fs=require('fs');var Redis=require(_0x0491('0x4'));var db=require(_0x0491('0x5'))['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))('rpc');var config=require(_0x0491('0x8'));var jayson=require(_0x0491('0x9'));var client=jayson[_0x0491('0xa')][_0x0491('0xb')]({'port':0x232a});config[_0x0491('0xc')]=_['defaults'](config[_0x0491('0xc')],{'host':_0x0491('0xd'),'port':0x18eb});var socket=require(_0x0491('0xe'))(new Redis(config[_0x0491('0xc')]));require(_0x0491('0xf'))['register'](socket);function respondWithRpcPromise(_0x1a4359,_0x51bd65,_0x39bafa){return new BPromise(function(_0x1b57a1,_0x3ff9c6){return client[_0x0491('0x10')](_0x1a4359,_0x39bafa)[_0x0491('0x11')](function(_0x12ab48){logger[_0x0491('0x12')](_0x0491('0x13'),_0x51bd65,_0x0491('0x14'));logger[_0x0491('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x51bd65,_0x0491('0x14'),JSON['stringify'](_0x12ab48));if(_0x12ab48[_0x0491('0x16')]){if(_0x12ab48['error']['code']===0x1f4){logger[_0x0491('0x16')](_0x0491('0x13'),_0x51bd65,_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);return _0x3ff9c6(_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);}logger[_0x0491('0x16')](_0x0491('0x13'),_0x51bd65,_0x12ab48[_0x0491('0x16')][_0x0491('0x17')]);return _0x1b57a1(_0x12ab48['error'][_0x0491('0x17')]);}else{logger[_0x0491('0x12')](_0x0491('0x13'),_0x51bd65,_0x0491('0x14'));_0x1b57a1(_0x12ab48[_0x0491('0x18')][_0x0491('0x17')]);}})['catch'](function(_0x1a924b){logger[_0x0491('0x16')]('UserProfile,\x20%s,\x20%s',_0x51bd65,_0x1a924b);_0x3ff9c6(_0x1a924b);});});} \ No newline at end of file +var _0xc373=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x25e378,_0x50d078){var _0x3e5149=function(_0x435cae){while(--_0x435cae){_0x25e378['push'](_0x25e378['shift']());}};_0x3e5149(++_0x50d078);}(_0xc373,0x1c7));var _0x3c37=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0xc373[_0x238830];return _0x5917f0;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3c37('0x9')]=_[_0x3c37('0xa')](config[_0x3c37('0x9')],{'host':_0x3c37('0xb'),'port':0x18eb});var socket=require(_0x3c37('0xc'))(new Redis(config[_0x3c37('0x9')]));require(_0x3c37('0xd'))[_0x3c37('0xe')](socket);function respondWithRpcPromise(_0xa015c8,_0x57349e,_0x4bf38e){return new BPromise(function(_0x444545,_0x3d493c){return client[_0x3c37('0xf')](_0xa015c8,_0x4bf38e)[_0x3c37('0x10')](function(_0x17a164){logger[_0x3c37('0x11')](_0x3c37('0x12'),_0x57349e,'request\x20sent');logger[_0x3c37('0x13')](_0x3c37('0x14'),_0x57349e,_0x3c37('0x15'),JSON['stringify'](_0x17a164));if(_0x17a164['error']){if(_0x17a164[_0x3c37('0x16')]['code']===0x1f4){logger['error'](_0x3c37('0x12'),_0x57349e,_0x17a164[_0x3c37('0x16')][_0x3c37('0x17')]);return _0x3d493c(_0x17a164[_0x3c37('0x16')][_0x3c37('0x17')]);}logger[_0x3c37('0x16')](_0x3c37('0x12'),_0x57349e,_0x17a164[_0x3c37('0x16')][_0x3c37('0x17')]);return _0x444545(_0x17a164['error'][_0x3c37('0x17')]);}else{logger[_0x3c37('0x11')]('UserProfile,\x20%s,\x20%s',_0x57349e,'request\x20sent');_0x444545(_0x17a164[_0x3c37('0x18')][_0x3c37('0x17')]);}})[_0x3c37('0x19')](function(_0xaf1f45){logger[_0x3c37('0x16')](_0x3c37('0x12'),_0x57349e,_0xaf1f45);_0x3d493c(_0xaf1f45);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 38f71e5..6c405fc 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 _0x3728=['userProfile:','./userProfile.events','save','remove','emit','removeListener','length'];(function(_0x21ec55,_0x538170){var _0xa3aace=function(_0x1d1a9c){while(--_0x1d1a9c){_0x21ec55['push'](_0x21ec55['shift']());}};_0xa3aace(++_0x538170);}(_0x3728,0xb7));var _0x8372=function(_0x5454d1,_0x545bcc){_0x5454d1=_0x5454d1-0x0;var _0x46200f=_0x3728[_0x5454d1];return _0x46200f;};'use strict';var UserProfileEvents=require(_0x8372('0x0'));var events=[_0x8372('0x1'),_0x8372('0x2'),'update'];function createListener(_0x2cb683,_0x833589){return function(_0x2108c9){_0x833589[_0x8372('0x3')](_0x2cb683,_0x2108c9);};}function removeListener(_0x3d096a,_0x4a525f){return function(){UserProfileEvents[_0x8372('0x4')](_0x3d096a,_0x4a525f);};}exports['register']=function(_0x11ea9e){for(var _0x5b2117=0x0,_0x4d97df=events[_0x8372('0x5')];_0x5b2117<_0x4d97df;_0x5b2117++){var _0xdf6e3d=events[_0x5b2117];var _0x5dbe93=createListener(_0x8372('0x6')+_0xdf6e3d,_0x11ea9e);UserProfileEvents['on'](_0xdf6e3d,_0x5dbe93);}}; \ No newline at end of file +var _0x4c6a=['update','emit','removeListener','register','length','userProfile:','save','remove'];(function(_0x529d3d,_0xa005c8){var _0x522c21=function(_0x43ecac){while(--_0x43ecac){_0x529d3d['push'](_0x529d3d['shift']());}};_0x522c21(++_0xa005c8);}(_0x4c6a,0x1b6));var _0xa4c6=function(_0x5af491,_0x4ad2fd){_0x5af491=_0x5af491-0x0;var _0x6ec62f=_0x4c6a[_0x5af491];return _0x6ec62f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xa4c6('0x0'),_0xa4c6('0x1'),_0xa4c6('0x2')];function createListener(_0x3fa2f0,_0x44d1c9){return function(_0x266680){_0x44d1c9[_0xa4c6('0x3')](_0x3fa2f0,_0x266680);};}function removeListener(_0x12ae82,_0x4cf637){return function(){UserProfileEvents[_0xa4c6('0x4')](_0x12ae82,_0x4cf637);};}exports[_0xa4c6('0x5')]=function(_0x4bc5c9){for(var _0x4ad502=0x0,_0x5cf6af=events[_0xa4c6('0x6')];_0x4ad502<_0x5cf6af;_0x4ad502++){var _0x48d5ab=events[_0x4ad502];var _0x43bef6=createListener(_0xa4c6('0x7')+_0x48d5ab,_0x4bc5c9);UserProfileEvents['on'](_0x48d5ab,_0x43bef6);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 63de96d..93c6fe8 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 _0xbd9b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5eb6e9,_0x5a90c9){var _0xf2f26=function(_0x5beafb){while(--_0x5beafb){_0x5eb6e9['push'](_0x5eb6e9['shift']());}};_0xf2f26(++_0x5a90c9);}(_0xbd9b,0x10f));var _0xbbd9=function(_0x3a678e,_0x4d297c){_0x3a678e=_0x3a678e-0x0;var _0x2e62e7=_0xbd9b[_0x3a678e];return _0x2e62e7;};'use strict';var multer=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var path=require(_0xbbd9('0x2'));var timeout=require(_0xbbd9('0x3'));var express=require(_0xbbd9('0x4'));var router=express[_0xbbd9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbbd9('0x6'));var config=require(_0xbbd9('0x7'));var controller=require(_0xbbd9('0x8'));router[_0xbbd9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbbd9('0xa')]);router['get'](_0xbbd9('0xb'),auth[_0xbbd9('0xc')](),controller['describe']);router['get']('/:id',auth[_0xbbd9('0xc')](),controller[_0xbbd9('0xd')]);router['post']('/',auth[_0xbbd9('0xc')](),controller[_0xbbd9('0xe')]);router[_0xbbd9('0xf')](_0xbbd9('0x10'),auth[_0xbbd9('0xc')](),controller[_0xbbd9('0x11')]);router[_0xbbd9('0x12')](_0xbbd9('0x10'),auth[_0xbbd9('0xc')](),controller[_0xbbd9('0x13')]);module[_0xbbd9('0x14')]=router; \ No newline at end of file +var _0x6707=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x147c53,_0x2a4a43){var _0x4d2012=function(_0x397ec6){while(--_0x397ec6){_0x147c53['push'](_0x147c53['shift']());}};_0x4d2012(++_0x2a4a43);}(_0x6707,0x165));var _0x7670=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x6707[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x7670('0x0'));var util=require('util');var path=require(_0x7670('0x1'));var timeout=require(_0x7670('0x2'));var express=require(_0x7670('0x3'));var router=express[_0x7670('0x4')]();var fs_extra=require(_0x7670('0x5'));var auth=require(_0x7670('0x6'));var interaction=require(_0x7670('0x7'));var config=require(_0x7670('0x8'));var controller=require(_0x7670('0x9'));router[_0x7670('0xa')]('/',auth[_0x7670('0xb')](),controller[_0x7670('0xc')]);router['get'](_0x7670('0xd'),auth[_0x7670('0xb')](),controller[_0x7670('0xe')]);router[_0x7670('0xa')](_0x7670('0xf'),auth['isAuthenticated'](),controller[_0x7670('0x10')]);router[_0x7670('0x11')]('/',auth['isAuthenticated'](),controller[_0x7670('0x12')]);router[_0x7670('0x13')](_0x7670('0xf'),auth[_0x7670('0xb')](),controller['update']);router[_0x7670('0x14')](_0x7670('0xf'),auth[_0x7670('0xb')](),controller[_0x7670('0x15')]);module[_0x7670('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2cc5054..89ee85b 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 _0x6928=['INTEGER','STRING','sequelize','exports'];(function(_0x5bd757,_0x3fad85){var _0x1f7d87=function(_0x247785){while(--_0x247785){_0x5bd757['push'](_0x5bd757['shift']());}};_0x1f7d87(++_0x3fad85);}(_0x6928,0x1e6));var _0x8692=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6928[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x8692('0x0'));module[_0x8692('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8692('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8692('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x8c38=['INTEGER','exports','STRING'];(function(_0x361c81,_0x15fa34){var _0x185866=function(_0x3607d5){while(--_0x3607d5){_0x361c81['push'](_0x361c81['shift']());}};_0x185866(++_0x15fa34);}(_0x8c38,0x8b));var _0x88c3=function(_0x44e91a,_0xfac909){_0x44e91a=_0x44e91a-0x0;var _0x3aad4d=_0x8c38[_0x44e91a];return _0x3aad4d;};'use strict';var Sequelize=require('sequelize');module[_0x88c3('0x0')]={'name':{'type':Sequelize[_0x88c3('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x88c3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x88c3('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 5993d60..b0ec37b 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 _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x6343,0x168));var _0x3634=function(_0x1095af,_0x42fdd7){_0x1095af=_0x1095af-0x0;var _0x56b385=_0x6343[_0x1095af];return _0x56b385;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file +var _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7044f8b..deb520d 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 _0x4e4e=['sectionId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4e4e,0x97));var _0xe4e4=function(_0x4a3bc8,_0x2c8864){_0x4a3bc8=_0x4a3bc8-0x0;var _0x20f722=_0x4e4e[_0x4a3bc8];return _0x20f722;};'use strict';var _=require(_0xe4e4('0x0'));var util=require(_0xe4e4('0x1'));var logger=require(_0xe4e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe4e4('0x3'));var rp=require(_0xe4e4('0x4'));var fs=require('fs');var path=require(_0xe4e4('0x5'));var rimraf=require(_0xe4e4('0x6'));var config=require(_0xe4e4('0x7'));var attributes=require(_0xe4e4('0x8'));module[_0xe4e4('0x9')]=function(_0x3536a6,_0x3057b4){return _0x3536a6[_0xe4e4('0xa')](_0xe4e4('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe4e4('0xc'),'fields':[_0xe4e4('0xd'),_0xe4e4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4deb=['moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0xbb6de5,_0x34d871){var _0x5642dd=function(_0x3e484d){while(--_0x3e484d){_0xbb6de5['push'](_0xbb6de5['shift']());}};_0x5642dd(++_0x34d871);}(_0x4deb,0x8c));var _0xb4de=function(_0x5e80a1,_0x5558fa){_0x5e80a1=_0x5e80a1-0x0;var _0x2290fc=_0x4deb[_0x5e80a1];return _0x2290fc;};'use strict';var _=require(_0xb4de('0x0'));var util=require(_0xb4de('0x1'));var logger=require(_0xb4de('0x2'))(_0xb4de('0x3'));var moment=require(_0xb4de('0x4'));var BPromise=require(_0xb4de('0x5'));var rp=require(_0xb4de('0x6'));var fs=require('fs');var path=require(_0xb4de('0x7'));var rimraf=require('rimraf');var config=require(_0xb4de('0x8'));var attributes=require(_0xb4de('0x9'));module[_0xb4de('0xa')]=function(_0x4f0027,_0x4ee009){return _0x4f0027[_0xb4de('0xb')](_0xb4de('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xb4de('0xd'),'fields':[_0xb4de('0xe'),_0xb4de('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3e95d81..118e9ed 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 _0x8b77=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result'];(function(_0x40fd1f,_0x431799){var _0x4bdd79=function(_0x8076bc){while(--_0x8076bc){_0x40fd1f['push'](_0x40fd1f['shift']());}};_0x4bdd79(++_0x431799);}(_0x8b77,0x9a));var _0x78b7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8b77[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x78b7('0x0'));var moment=require(_0x78b7('0x1'));var BPromise=require(_0x78b7('0x2'));var rs=require(_0x78b7('0x3'));var fs=require('fs');var Redis=require(_0x78b7('0x4'));var db=require(_0x78b7('0x5'))['db'];var utils=require(_0x78b7('0x6'));var logger=require(_0x78b7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78b7('0x8'));var client=jayson['client'][_0x78b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4189,_0x49816c,_0x4ab53f){return new BPromise(function(_0x1a5a9f,_0xe1303e){return client[_0x78b7('0xa')](_0x5a4189,_0x4ab53f)[_0x78b7('0xb')](function(_0x545ed5){logger[_0x78b7('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x49816c,'request\x20sent');logger[_0x78b7('0xd')](_0x78b7('0xe'),_0x49816c,_0x78b7('0xf'),JSON[_0x78b7('0x10')](_0x545ed5));if(_0x545ed5[_0x78b7('0x11')]){if(_0x545ed5['error'][_0x78b7('0x12')]===0x1f4){logger[_0x78b7('0x11')](_0x78b7('0x13'),_0x49816c,_0x545ed5['error']['message']);return _0xe1303e(_0x545ed5[_0x78b7('0x11')][_0x78b7('0x14')]);}logger[_0x78b7('0x11')](_0x78b7('0x13'),_0x49816c,_0x545ed5[_0x78b7('0x11')][_0x78b7('0x14')]);return _0x1a5a9f(_0x545ed5[_0x78b7('0x11')][_0x78b7('0x14')]);}else{logger[_0x78b7('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x49816c,_0x78b7('0xf'));_0x1a5a9f(_0x545ed5[_0x78b7('0x15')][_0x78b7('0x14')]);}})['catch'](function(_0x58eada){logger[_0x78b7('0x11')](_0x78b7('0x13'),_0x49816c,_0x58eada);_0xe1303e(_0x58eada);});});} \ No newline at end of file +var _0x5e5e=['result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x5e5e,0x10a));var _0xe5e5=function(_0x56a7a3,_0x49cbc1){_0x56a7a3=_0x56a7a3-0x0;var _0xd1dd22=_0x5e5e[_0x56a7a3];return _0xd1dd22;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5e5('0x0'));var rs=require(_0xe5e5('0x1'));var fs=require('fs');var Redis=require(_0xe5e5('0x2'));var db=require(_0xe5e5('0x3'))['db'];var utils=require(_0xe5e5('0x4'));var logger=require(_0xe5e5('0x5'))(_0xe5e5('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5e5('0x7'));var client=jayson[_0xe5e5('0x8')][_0xe5e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93a532,_0x3fef99,_0x59e6a4){return new BPromise(function(_0x47d538,_0xafc6b6){return client[_0xe5e5('0xa')](_0x93a532,_0x59e6a4)[_0xe5e5('0xb')](function(_0x393900){logger[_0xe5e5('0xc')](_0xe5e5('0xd'),_0x3fef99,_0xe5e5('0xe'));logger[_0xe5e5('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3fef99,_0xe5e5('0xe'),JSON[_0xe5e5('0x10')](_0x393900));if(_0x393900[_0xe5e5('0x11')]){if(_0x393900[_0xe5e5('0x11')][_0xe5e5('0x12')]===0x1f4){logger[_0xe5e5('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3fef99,_0x393900[_0xe5e5('0x11')]['message']);return _0xafc6b6(_0x393900[_0xe5e5('0x11')][_0xe5e5('0x13')]);}logger['error'](_0xe5e5('0xd'),_0x3fef99,_0x393900[_0xe5e5('0x11')]['message']);return _0x47d538(_0x393900['error'][_0xe5e5('0x13')]);}else{logger[_0xe5e5('0xc')](_0xe5e5('0xd'),_0x3fef99,_0xe5e5('0xe'));_0x47d538(_0x393900[_0xe5e5('0x14')][_0xe5e5('0x13')]);}})[_0xe5e5('0x15')](function(_0xdc9fb3){logger['error'](_0xe5e5('0xd'),_0x3fef99,_0xdc9fb3);_0xafc6b6(_0xdc9fb3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1eb249e..3e57cf8 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 _0x8319=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8319,0x14a));var _0x9831=function(_0x385fb1,_0x3e2d5f){_0x385fb1=_0x385fb1-0x0;var _0x55c323=_0x8319[_0x385fb1];return _0x55c323;};'use strict';var multer=require(_0x9831('0x0'));var util=require(_0x9831('0x1'));var path=require(_0x9831('0x2'));var timeout=require(_0x9831('0x3'));var express=require('express');var router=express[_0x9831('0x4')]();var fs_extra=require(_0x9831('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9831('0x6'));var config=require(_0x9831('0x7'));var controller=require('./userProfileSection.controller');router[_0x9831('0x8')]('/',auth[_0x9831('0x9')](),controller[_0x9831('0xa')]);router[_0x9831('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9831('0x8')](_0x9831('0xb'),auth[_0x9831('0x9')](),controller[_0x9831('0xc')]);router[_0x9831('0xd')]('/',auth[_0x9831('0x9')](),controller[_0x9831('0xe')]);router[_0x9831('0xf')]('/:id',auth[_0x9831('0x9')](),controller[_0x9831('0x10')]);router[_0x9831('0x11')](_0x9831('0xb'),auth['isAuthenticated'](),controller[_0x9831('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd45d=['update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','describe','/:id','show','post','put'];(function(_0x3f517d,_0x57fb5b){var _0xa50a5=function(_0x476b3a){while(--_0x476b3a){_0x3f517d['push'](_0x3f517d['shift']());}};_0xa50a5(++_0x57fb5b);}(_0xd45d,0x17c));var _0xdd45=function(_0x15e2fb,_0x341089){_0x15e2fb=_0x15e2fb-0x0;var _0x393205=_0xd45d[_0x15e2fb];return _0x393205;};'use strict';var multer=require('multer');var util=require(_0xdd45('0x0'));var path=require(_0xdd45('0x1'));var timeout=require(_0xdd45('0x2'));var express=require('express');var router=express[_0xdd45('0x3')]();var fs_extra=require(_0xdd45('0x4'));var auth=require(_0xdd45('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdd45('0x6'));var controller=require(_0xdd45('0x7'));router[_0xdd45('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd45('0x9')]);router[_0xdd45('0x8')]('/describe',auth[_0xdd45('0xa')](),controller[_0xdd45('0xb')]);router['get'](_0xdd45('0xc'),auth[_0xdd45('0xa')](),controller[_0xdd45('0xd')]);router[_0xdd45('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd45('0xf')](_0xdd45('0xc'),auth['isAuthenticated'](),controller[_0xdd45('0x10')]);router['delete'](_0xdd45('0xc'),auth[_0xdd45('0xa')](),controller['destroy']);module[_0xdd45('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b9bb1f7..cb1cd07 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 _0x0972=['crudPermissions','join','getDataValue','split','exports','STRING','BOOLEAN','setDataValue'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0972,0x64));var _0x2097=function(_0x115fbe,_0x43d2a6){_0x115fbe=_0x115fbe-0x0;var _0x30477e=_0x0972[_0x115fbe];return _0x30477e;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2097('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2097('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2097('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x348ad8){this[_0x2097('0x3')](_0x2097('0x4'),_0x348ad8?_0x348ad8[_0x2097('0x5')](''):[]);},'get':function(){return this[_0x2097('0x6')](_0x2097('0x4'))?this[_0x2097('0x6')]('crudPermissions')[_0x2097('0x7')](''):[];}}}; \ No newline at end of file +var _0xb03e=['setDataValue','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1dd91c,_0x13f2e1){_0x1dd91c=_0x1dd91c-0x0;var _0x433fb8=_0xb03e[_0x1dd91c];return _0x433fb8;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb03('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb03('0x1')],'set':function(_0x1fe650){this[_0xeb03('0x4')](_0xeb03('0x5'),_0x1fe650?_0x1fe650[_0xeb03('0x6')](''):[]);},'get':function(){return this[_0xeb03('0x7')]('crudPermissions')?this[_0xeb03('0x7')](_0xeb03('0x5'))[_0xeb03('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e65d600..b384f44 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 _0xdef3=['status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xdef3,0x75));var _0x3def=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xdef3[_0x424501];return _0xb719af;};'use strict';var emlformat=require(_0x3def('0x0'));var rimraf=require(_0x3def('0x1'));var zipdir=require(_0x3def('0x2'));var jsonpatch=require(_0x3def('0x3'));var rp=require(_0x3def('0x4'));var moment=require('moment');var BPromise=require(_0x3def('0x5'));var Mustache=require(_0x3def('0x6'));var util=require(_0x3def('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3def('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3def('0x9'));var squel=require(_0x3def('0xa'));var crypto=require('crypto');var jsforce=require(_0x3def('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3def('0x8'));var querystring=require(_0x3def('0xc'));var Papa=require(_0x3def('0xd'));var Redis=require(_0x3def('0xe'));var authService=require(_0x3def('0xf'));var qs=require(_0x3def('0x10'));var as=require(_0x3def('0x11'));var hardwareService=require(_0x3def('0x12'));var logger=require(_0x3def('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3def('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3def('0x15'))['db'];function respondWithStatusCode(_0x511afc,_0x39d18c){_0x39d18c=_0x39d18c||0xcc;return function(_0x17d5b9){if(_0x17d5b9){return _0x511afc[_0x3def('0x16')](_0x39d18c);}return _0x511afc[_0x3def('0x17')](_0x39d18c)[_0x3def('0x18')]();};}function respondWithResult(_0x31c07d,_0x51c076){_0x51c076=_0x51c076||0xc8;return function(_0x11c55f){if(_0x11c55f){return _0x31c07d[_0x3def('0x17')](_0x51c076)[_0x3def('0x19')](_0x11c55f);}};}function respondWithFilteredResult(_0x54dc5b,_0x187bb9){return function(_0x5d225c){if(_0x5d225c){var _0xc1a579=typeof _0x187bb9['offset']===_0x3def('0x1a')&&typeof _0x187bb9[_0x3def('0x1b')]===_0x3def('0x1a');var _0xfa527c=_0x5d225c[_0x3def('0x1c')];var _0x3c41e9=_0xc1a579?0x0:_0x187bb9[_0x3def('0x1d')];var _0x2c79b3=_0xc1a579?_0x5d225c[_0x3def('0x1c')]:_0x187bb9[_0x3def('0x1d')]+_0x187bb9[_0x3def('0x1b')];var _0x3386e4;if(_0x2c79b3>=_0xfa527c){_0x2c79b3=_0xfa527c;_0x3386e4=0xc8;}else{_0x3386e4=0xce;}_0x54dc5b[_0x3def('0x17')](_0x3386e4);return _0x54dc5b['set'](_0x3def('0x1e'),_0x3c41e9+'-'+_0x2c79b3+'/'+_0xfa527c)['json'](_0x5d225c);}return null;};}function patchUpdates(_0x425b07){return function(_0x3e5b15){try{jsonpatch[_0x3def('0x1f')](_0x3e5b15,_0x425b07,!![]);}catch(_0x3e6513){return BPromise[_0x3def('0x20')](_0x3e6513);}return _0x3e5b15['save']();};}function saveUpdates(_0x281912,_0xe2040f){return function(_0x2c589d){if(_0x2c589d){return _0x2c589d['update'](_0x281912)[_0x3def('0x21')](function(_0x5abfdd){return _0x5abfdd;});}return null;};}function removeEntity(_0x3bc61e,_0x16357d){return function(_0xa0e353){if(_0xa0e353){return _0xa0e353[_0x3def('0x22')]()['then'](function(){_0x3bc61e[_0x3def('0x17')](0xcc)[_0x3def('0x18')]();});}};}function handleEntityNotFound(_0xba7416,_0x4fabf3){return function(_0x23b6a5){if(!_0x23b6a5){_0xba7416['sendStatus'](0x194);}return _0x23b6a5;};}function handleError(_0xaf18f5,_0x357809){_0x357809=_0x357809||0x1f4;return function(_0x40ffc8){logger[_0x3def('0x23')](_0x40ffc8[_0x3def('0x24')]);if(_0x40ffc8['name']){delete _0x40ffc8[_0x3def('0x25')];}_0xaf18f5[_0x3def('0x17')](_0x357809)[_0x3def('0x26')](_0x40ffc8);};}exports[_0x3def('0x27')]=function(_0x5035a8,_0x77d0e1){var _0x148d42={},_0x1f1830={},_0x421519={'count':0x0,'rows':[]};var _0x1c6e87=_['map'](db[_0x3def('0x28')][_0x3def('0x29')],function(_0x27be9d){return{'name':_0x27be9d['fieldName'],'type':_0x27be9d['type'][_0x3def('0x2a')]};});_0x1f1830[_0x3def('0x2b')]=_[_0x3def('0x2c')](_0x1c6e87,_0x3def('0x25'));_0x1f1830['query']=_[_0x3def('0x2d')](_0x5035a8[_0x3def('0x2e')]);_0x1f1830['filters']=_[_0x3def('0x2f')](_0x1f1830['model'],_0x1f1830['query']);_0x148d42['attributes']=_[_0x3def('0x2f')](_0x1f1830[_0x3def('0x2b')],qs[_0x3def('0x30')](_0x5035a8[_0x3def('0x2e')][_0x3def('0x30')]));_0x148d42[_0x3def('0x31')]=_0x148d42[_0x3def('0x31')][_0x3def('0x32')]?_0x148d42[_0x3def('0x31')]:_0x1f1830[_0x3def('0x2b')];if(!_0x5035a8[_0x3def('0x2e')][_0x3def('0x33')](_0x3def('0x34'))){_0x148d42[_0x3def('0x1b')]=qs['limit'](_0x5035a8['query'][_0x3def('0x1b')]);_0x148d42[_0x3def('0x1d')]=qs['offset'](_0x5035a8[_0x3def('0x2e')][_0x3def('0x1d')]);}_0x148d42[_0x3def('0x35')]=qs[_0x3def('0x36')](_0x5035a8[_0x3def('0x2e')][_0x3def('0x36')]);_0x148d42[_0x3def('0x37')]=qs['filters'](_['pick'](_0x5035a8[_0x3def('0x2e')],_0x1f1830['filters']),_0x1c6e87);if(_0x5035a8[_0x3def('0x2e')][_0x3def('0x38')]){_0x148d42[_0x3def('0x37')]=_[_0x3def('0x39')](_0x148d42['where'],{'$or':_['map'](_0x1c6e87,function(_0x25fca0){if(_0x25fca0['type']!=='VIRTUAL'){var _0x16d673={};_0x16d673[_0x25fca0[_0x3def('0x25')]]={'$like':'%'+_0x5035a8[_0x3def('0x2e')]['filter']+'%'};return _0x16d673;}})});}_0x148d42=_['merge']({},_0x148d42,_0x5035a8[_0x3def('0x3a')]);var _0x54c343={'where':_0x148d42[_0x3def('0x37')]};return db['UserProfileSection']['count'](_0x54c343)['then'](function(_0x37c628){_0x421519[_0x3def('0x1c')]=_0x37c628;if(_0x5035a8[_0x3def('0x2e')][_0x3def('0x3b')]){_0x148d42[_0x3def('0x3c')]=[{'all':!![]}];}return db[_0x3def('0x28')][_0x3def('0x3d')](_0x148d42);})[_0x3def('0x21')](function(_0x2c4611){_0x421519[_0x3def('0x3e')]=_0x2c4611;return _0x421519;})[_0x3def('0x21')](respondWithFilteredResult(_0x77d0e1,_0x148d42))['catch'](handleError(_0x77d0e1,null));};exports['show']=function(_0x53684d,_0x1f0424){var _0x58d69b={'raw':![],'where':{'id':_0x53684d[_0x3def('0x3f')]['id']}},_0xad29b6={};_0xad29b6['model']=_[_0x3def('0x2d')](db[_0x3def('0x28')]['rawAttributes']);_0xad29b6[_0x3def('0x2e')]=_[_0x3def('0x2d')](_0x53684d[_0x3def('0x2e')]);_0xad29b6['filters']=_[_0x3def('0x2f')](_0xad29b6[_0x3def('0x2b')],_0xad29b6['query']);_0x58d69b[_0x3def('0x31')]=_[_0x3def('0x2f')](_0xad29b6[_0x3def('0x2b')],qs[_0x3def('0x30')](_0x53684d[_0x3def('0x2e')][_0x3def('0x30')]));_0x58d69b['attributes']=_0x58d69b[_0x3def('0x31')]['length']?_0x58d69b[_0x3def('0x31')]:_0xad29b6[_0x3def('0x2b')];if(_0x53684d[_0x3def('0x2e')]['includeAll']){_0x58d69b[_0x3def('0x3c')]=[{'all':!![]}];}_0x58d69b=_[_0x3def('0x39')]({},_0x58d69b,_0x53684d[_0x3def('0x3a')]);return db[_0x3def('0x28')][_0x3def('0x40')](_0x58d69b)[_0x3def('0x21')](handleEntityNotFound(_0x1f0424,null))['then'](respondWithResult(_0x1f0424,null))[_0x3def('0x41')](handleError(_0x1f0424,null));};exports[_0x3def('0x42')]=function(_0x29000b,_0x435e17){return db['UserProfileSection'][_0x3def('0x42')](_0x29000b[_0x3def('0x43')],{})[_0x3def('0x21')](respondWithResult(_0x435e17,0xc9))[_0x3def('0x41')](handleError(_0x435e17,null));};exports[_0x3def('0x44')]=function(_0xff0a31,_0x142067){if(_0xff0a31[_0x3def('0x43')]['id']){delete _0xff0a31[_0x3def('0x43')]['id'];}return db[_0x3def('0x28')]['find']({'where':{'id':_0xff0a31[_0x3def('0x3f')]['id']}})[_0x3def('0x21')](handleEntityNotFound(_0x142067,null))[_0x3def('0x21')](saveUpdates(_0xff0a31[_0x3def('0x43')],null))[_0x3def('0x21')](respondWithResult(_0x142067,null))[_0x3def('0x41')](handleError(_0x142067,null));};exports[_0x3def('0x22')]=function(_0x4aede3,_0x15c30b){return db[_0x3def('0x28')][_0x3def('0x40')]({'where':{'id':_0x4aede3[_0x3def('0x3f')]['id']}})[_0x3def('0x21')](handleEntityNotFound(_0x15c30b,null))['then'](removeEntity(_0x15c30b,null))['catch'](handleError(_0x15c30b,null));};exports[_0x3def('0x45')]=function(_0x43922c,_0x3c17fe){return db[_0x3def('0x28')][_0x3def('0x45')]()[_0x3def('0x21')](respondWithResult(_0x3c17fe,null))[_0x3def('0x41')](handleError(_0x3c17fe,null));}; \ No newline at end of file +var _0x0782=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','stack','name','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','catch','params','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch'];(function(_0xe6df9d,_0x8fad94){var _0x29ffad=function(_0xba933c){while(--_0xba933c){_0xe6df9d['push'](_0xe6df9d['shift']());}};_0x29ffad(++_0x8fad94);}(_0x0782,0x1b3));var _0x2078=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x0782[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0x2078('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2078('0x1'));var jsonpatch=require(_0x2078('0x2'));var rp=require(_0x2078('0x3'));var moment=require(_0x2078('0x4'));var BPromise=require(_0x2078('0x5'));var Mustache=require(_0x2078('0x6'));var util=require(_0x2078('0x7'));var path=require(_0x2078('0x8'));var sox=require('sox');var csv=require(_0x2078('0x9'));var ejs=require(_0x2078('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2078('0xb'));var squel=require(_0x2078('0xc'));var crypto=require('crypto');var jsforce=require(_0x2078('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2078('0x9'));var querystring=require(_0x2078('0xe'));var Papa=require(_0x2078('0xf'));var Redis=require(_0x2078('0x10'));var authService=require(_0x2078('0x11'));var qs=require(_0x2078('0x12'));var as=require(_0x2078('0x13'));var hardwareService=require(_0x2078('0x14'));var logger=require(_0x2078('0x15'))(_0x2078('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2078('0x17'));var db=require(_0x2078('0x18'))['db'];function respondWithStatusCode(_0x928162,_0x240208){_0x240208=_0x240208||0xcc;return function(_0x50d341){if(_0x50d341){return _0x928162[_0x2078('0x19')](_0x240208);}return _0x928162['status'](_0x240208)[_0x2078('0x1a')]();};}function respondWithResult(_0x11ec93,_0x3ccc30){_0x3ccc30=_0x3ccc30||0xc8;return function(_0x2aafcc){if(_0x2aafcc){return _0x11ec93[_0x2078('0x1b')](_0x3ccc30)[_0x2078('0x1c')](_0x2aafcc);}};}function respondWithFilteredResult(_0x445c70,_0x441da9){return function(_0x18c074){if(_0x18c074){var _0x508ec2=typeof _0x441da9[_0x2078('0x1d')]===_0x2078('0x1e')&&typeof _0x441da9['limit']===_0x2078('0x1e');var _0x44ff8e=_0x18c074['count'];var _0x40b596=_0x508ec2?0x0:_0x441da9[_0x2078('0x1d')];var _0x5202f8=_0x508ec2?_0x18c074['count']:_0x441da9[_0x2078('0x1d')]+_0x441da9[_0x2078('0x1f')];var _0x2274fa;if(_0x5202f8>=_0x44ff8e){_0x5202f8=_0x44ff8e;_0x2274fa=0xc8;}else{_0x2274fa=0xce;}_0x445c70[_0x2078('0x1b')](_0x2274fa);return _0x445c70['set'](_0x2078('0x20'),_0x40b596+'-'+_0x5202f8+'/'+_0x44ff8e)[_0x2078('0x1c')](_0x18c074);}return null;};}function patchUpdates(_0x1a8e16){return function(_0x405240){try{jsonpatch[_0x2078('0x21')](_0x405240,_0x1a8e16,!![]);}catch(_0x1bae7a){return BPromise[_0x2078('0x22')](_0x1bae7a);}return _0x405240[_0x2078('0x23')]();};}function saveUpdates(_0x8bce75,_0x1b4892){return function(_0x1eab5d){if(_0x1eab5d){return _0x1eab5d[_0x2078('0x24')](_0x8bce75)[_0x2078('0x25')](function(_0x3a1684){return _0x3a1684;});}return null;};}function removeEntity(_0x2e3440,_0x18be2e){return function(_0x29d90f){if(_0x29d90f){return _0x29d90f['destroy']()[_0x2078('0x25')](function(){_0x2e3440['status'](0xcc)[_0x2078('0x1a')]();});}};}function handleEntityNotFound(_0x1b4662,_0x5ddbd9){return function(_0x5ce973){if(!_0x5ce973){_0x1b4662[_0x2078('0x19')](0x194);}return _0x5ce973;};}function handleError(_0x1318db,_0x449005){_0x449005=_0x449005||0x1f4;return function(_0xd74734){logger[_0x2078('0x26')](_0xd74734[_0x2078('0x27')]);if(_0xd74734[_0x2078('0x28')]){delete _0xd74734['name'];}_0x1318db[_0x2078('0x1b')](_0x449005)['send'](_0xd74734);};}exports['index']=function(_0x56951d,_0x285476){var _0x1cedba={},_0x15517c={},_0x4b3044={'count':0x0,'rows':[]};var _0x34a071=_[_0x2078('0x29')](db[_0x2078('0x2a')][_0x2078('0x2b')],function(_0x50b8eb){return{'name':_0x50b8eb['fieldName'],'type':_0x50b8eb[_0x2078('0x2c')][_0x2078('0x2d')]};});_0x15517c[_0x2078('0x2e')]=_[_0x2078('0x29')](_0x34a071,_0x2078('0x28'));_0x15517c[_0x2078('0x2f')]=_[_0x2078('0x30')](_0x56951d['query']);_0x15517c[_0x2078('0x31')]=_[_0x2078('0x32')](_0x15517c[_0x2078('0x2e')],_0x15517c[_0x2078('0x2f')]);_0x1cedba[_0x2078('0x33')]=_[_0x2078('0x32')](_0x15517c[_0x2078('0x2e')],qs['fields'](_0x56951d[_0x2078('0x2f')][_0x2078('0x34')]));_0x1cedba[_0x2078('0x33')]=_0x1cedba[_0x2078('0x33')]['length']?_0x1cedba[_0x2078('0x33')]:_0x15517c[_0x2078('0x2e')];if(!_0x56951d[_0x2078('0x2f')][_0x2078('0x35')](_0x2078('0x36'))){_0x1cedba['limit']=qs['limit'](_0x56951d[_0x2078('0x2f')][_0x2078('0x1f')]);_0x1cedba[_0x2078('0x1d')]=qs['offset'](_0x56951d[_0x2078('0x2f')][_0x2078('0x1d')]);}_0x1cedba[_0x2078('0x37')]=qs['sort'](_0x56951d['query']['sort']);_0x1cedba[_0x2078('0x38')]=qs[_0x2078('0x31')](_[_0x2078('0x39')](_0x56951d['query'],_0x15517c['filters']),_0x34a071);if(_0x56951d[_0x2078('0x2f')]['filter']){_0x1cedba[_0x2078('0x38')]=_[_0x2078('0x3a')](_0x1cedba[_0x2078('0x38')],{'$or':_[_0x2078('0x29')](_0x34a071,function(_0x374027){if(_0x374027[_0x2078('0x2c')]!==_0x2078('0x3b')){var _0x2691fb={};_0x2691fb[_0x374027['name']]={'$like':'%'+_0x56951d[_0x2078('0x2f')][_0x2078('0x3c')]+'%'};return _0x2691fb;}})});}_0x1cedba=_['merge']({},_0x1cedba,_0x56951d[_0x2078('0x3d')]);var _0x17f4dc={'where':_0x1cedba['where']};return db[_0x2078('0x2a')][_0x2078('0x3e')](_0x17f4dc)[_0x2078('0x25')](function(_0x11b463){_0x4b3044[_0x2078('0x3e')]=_0x11b463;if(_0x56951d['query']['includeAll']){_0x1cedba[_0x2078('0x3f')]=[{'all':!![]}];}return db[_0x2078('0x2a')][_0x2078('0x40')](_0x1cedba);})['then'](function(_0x1b3ecf){_0x4b3044['rows']=_0x1b3ecf;return _0x4b3044;})[_0x2078('0x25')](respondWithFilteredResult(_0x285476,_0x1cedba))[_0x2078('0x41')](handleError(_0x285476,null));};exports['show']=function(_0x5a4bd7,_0x17b22b){var _0x4312d0={'raw':![],'where':{'id':_0x5a4bd7[_0x2078('0x42')]['id']}},_0x2773d2={};_0x2773d2[_0x2078('0x2e')]=_[_0x2078('0x30')](db['UserProfileSection'][_0x2078('0x2b')]);_0x2773d2[_0x2078('0x2f')]=_['keys'](_0x5a4bd7[_0x2078('0x2f')]);_0x2773d2[_0x2078('0x31')]=_[_0x2078('0x32')](_0x2773d2[_0x2078('0x2e')],_0x2773d2['query']);_0x4312d0[_0x2078('0x33')]=_[_0x2078('0x32')](_0x2773d2[_0x2078('0x2e')],qs[_0x2078('0x34')](_0x5a4bd7[_0x2078('0x2f')]['fields']));_0x4312d0[_0x2078('0x33')]=_0x4312d0[_0x2078('0x33')]['length']?_0x4312d0[_0x2078('0x33')]:_0x2773d2['model'];if(_0x5a4bd7['query'][_0x2078('0x43')]){_0x4312d0[_0x2078('0x3f')]=[{'all':!![]}];}_0x4312d0=_[_0x2078('0x3a')]({},_0x4312d0,_0x5a4bd7['options']);return db[_0x2078('0x2a')][_0x2078('0x44')](_0x4312d0)[_0x2078('0x25')](handleEntityNotFound(_0x17b22b,null))[_0x2078('0x25')](respondWithResult(_0x17b22b,null))[_0x2078('0x41')](handleError(_0x17b22b,null));};exports[_0x2078('0x45')]=function(_0x1986e8,_0x2536da){return db['UserProfileSection']['create'](_0x1986e8['body'],{})[_0x2078('0x25')](respondWithResult(_0x2536da,0xc9))[_0x2078('0x41')](handleError(_0x2536da,null));};exports[_0x2078('0x24')]=function(_0x322acd,_0xd086fb){if(_0x322acd[_0x2078('0x46')]['id']){delete _0x322acd[_0x2078('0x46')]['id'];}return db[_0x2078('0x2a')][_0x2078('0x44')]({'where':{'id':_0x322acd[_0x2078('0x42')]['id']}})[_0x2078('0x25')](handleEntityNotFound(_0xd086fb,null))[_0x2078('0x25')](saveUpdates(_0x322acd[_0x2078('0x46')],null))[_0x2078('0x25')](respondWithResult(_0xd086fb,null))['catch'](handleError(_0xd086fb,null));};exports[_0x2078('0x47')]=function(_0x12eefd,_0x50a8e5){return db[_0x2078('0x2a')][_0x2078('0x44')]({'where':{'id':_0x12eefd[_0x2078('0x42')]['id']}})[_0x2078('0x25')](handleEntityNotFound(_0x50a8e5,null))[_0x2078('0x25')](removeEntity(_0x50a8e5,null))[_0x2078('0x41')](handleError(_0x50a8e5,null));};exports[_0x2078('0x48')]=function(_0x2b7b9d,_0xfc4181){return db[_0x2078('0x2a')][_0x2078('0x48')]()[_0x2078('0x25')](respondWithResult(_0xfc4181,null))[_0x2078('0x41')](handleError(_0xfc4181,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9e24e9a..c0d3404 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 _0x89ca=['define','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes'];(function(_0x32603b,_0x2837f0){var _0x289b39=function(_0x44456f){while(--_0x44456f){_0x32603b['push'](_0x32603b['shift']());}};_0x289b39(++_0x2837f0);}(_0x89ca,0xe1));var _0xa89c=function(_0x2b9a68,_0x4ca98e){_0x2b9a68=_0x2b9a68-0x0;var _0x19bbe9=_0x89ca[_0x2b9a68];return _0x19bbe9;};'use strict';var _=require(_0xa89c('0x0'));var util=require(_0xa89c('0x1'));var logger=require(_0xa89c('0x2'))(_0xa89c('0x3'));var moment=require(_0xa89c('0x4'));var BPromise=require('bluebird');var rp=require(_0xa89c('0x5'));var fs=require('fs');var path=require(_0xa89c('0x6'));var rimraf=require('rimraf');var config=require(_0xa89c('0x7'));var attributes=require(_0xa89c('0x8'));module['exports']=function(_0x3d0352,_0x485611){return _0x3d0352[_0xa89c('0x9')]('UserProfileSection',attributes,{'tableName':_0xa89c('0xa'),'paranoid':![],'indexes':[{'name':_0xa89c('0xb'),'fields':['sectionId',_0xa89c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4ab=['sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x4496cd,_0x112c71){var _0x33d882=function(_0x4e729d){while(--_0x4e729d){_0x4496cd['push'](_0x4496cd['shift']());}};_0x33d882(++_0x112c71);}(_0xb4ab,0x112));var _0xbb4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4ab[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xbb4a('0x0'));var util=require(_0xbb4a('0x1'));var logger=require(_0xbb4a('0x2'))(_0xbb4a('0x3'));var moment=require('moment');var BPromise=require(_0xbb4a('0x4'));var rp=require(_0xbb4a('0x5'));var fs=require('fs');var path=require(_0xbb4a('0x6'));var rimraf=require(_0xbb4a('0x7'));var config=require(_0xbb4a('0x8'));var attributes=require('./userProfileSection.attributes');module[_0xbb4a('0x9')]=function(_0x1de31c,_0x398bd4){return _0x1de31c[_0xbb4a('0xa')](_0xbb4a('0xb'),attributes,{'tableName':_0xbb4a('0xc'),'paranoid':![],'indexes':[{'name':_0xbb4a('0xd'),'fields':[_0xbb4a('0xe'),_0xbb4a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ca8c751..4c1b82d 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 _0xd3d7=['../../config/utils','rpc','jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1efc61,_0x358794){var _0x4205f7=function(_0x4e2002){while(--_0x4e2002){_0x1efc61['push'](_0x1efc61['shift']());}};_0x4205f7(++_0x358794);}(_0xd3d7,0x143));var _0x7d3d=function(_0x2c1fa4,_0x28e431){_0x2c1fa4=_0x2c1fa4-0x0;var _0x48daed=_0xd3d7[_0x2c1fa4];return _0x48daed;};'use strict';var _=require(_0x7d3d('0x0'));var util=require(_0x7d3d('0x1'));var moment=require(_0x7d3d('0x2'));var BPromise=require(_0x7d3d('0x3'));var rs=require(_0x7d3d('0x4'));var fs=require('fs');var Redis=require(_0x7d3d('0x5'));var db=require(_0x7d3d('0x6'))['db'];var utils=require(_0x7d3d('0x7'));var logger=require('../../config/logger')(_0x7d3d('0x8'));var config=require('../../config/environment');var jayson=require(_0x7d3d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x449b15,_0xa8d29a,_0x23d110){return new BPromise(function(_0x8b8867,_0x377fb9){return client[_0x7d3d('0xa')](_0x449b15,_0x23d110)[_0x7d3d('0xb')](function(_0xa98368){logger[_0x7d3d('0xc')](_0x7d3d('0xd'),_0xa8d29a,_0x7d3d('0xe'));logger[_0x7d3d('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xa8d29a,'request\x20sent',JSON[_0x7d3d('0x10')](_0xa98368));if(_0xa98368[_0x7d3d('0x11')]){if(_0xa98368[_0x7d3d('0x11')][_0x7d3d('0x12')]===0x1f4){logger[_0x7d3d('0x11')](_0x7d3d('0xd'),_0xa8d29a,_0xa98368[_0x7d3d('0x11')]['message']);return _0x377fb9(_0xa98368[_0x7d3d('0x11')][_0x7d3d('0x13')]);}logger[_0x7d3d('0x11')]('UserProfileSection,\x20%s,\x20%s',_0xa8d29a,_0xa98368[_0x7d3d('0x11')][_0x7d3d('0x13')]);return _0x8b8867(_0xa98368[_0x7d3d('0x11')][_0x7d3d('0x13')]);}else{logger[_0x7d3d('0xc')]('UserProfileSection,\x20%s,\x20%s',_0xa8d29a,_0x7d3d('0xe'));_0x8b8867(_0xa98368[_0x7d3d('0x14')]['message']);}})[_0x7d3d('0x15')](function(_0x373d3e){logger['error'](_0x7d3d('0xd'),_0xa8d29a,_0x373d3e);_0x377fb9(_0x373d3e);});});} \ No newline at end of file +var _0x7ed3=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x7ed3,0x1c0));var _0x37ed=function(_0x43f425,_0x1c52bf){_0x43f425=_0x43f425-0x0;var _0x39ac46=_0x7ed3[_0x43f425];return _0x39ac46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37ed('0x0'));var BPromise=require(_0x37ed('0x1'));var rs=require(_0x37ed('0x2'));var fs=require('fs');var Redis=require(_0x37ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x37ed('0x4'));var jayson=require(_0x37ed('0x5'));var client=jayson[_0x37ed('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bb2e,_0x401065,_0x5e2b58){return new BPromise(function(_0x25da0b,_0x56974c){return client[_0x37ed('0x7')](_0x18bb2e,_0x5e2b58)[_0x37ed('0x8')](function(_0x7abcc3){logger[_0x37ed('0x9')](_0x37ed('0xa'),_0x401065,'request\x20sent');logger[_0x37ed('0xb')](_0x37ed('0xc'),_0x401065,'request\x20sent',JSON[_0x37ed('0xd')](_0x7abcc3));if(_0x7abcc3[_0x37ed('0xe')]){if(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0xf')]===0x1f4){logger[_0x37ed('0xe')](_0x37ed('0xa'),_0x401065,_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);return _0x56974c(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);}logger['error'](_0x37ed('0xa'),_0x401065,_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);return _0x25da0b(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);}else{logger[_0x37ed('0x9')](_0x37ed('0xa'),_0x401065,_0x37ed('0x11'));_0x25da0b(_0x7abcc3[_0x37ed('0x12')][_0x37ed('0x10')]);}})[_0x37ed('0x13')](function(_0x4b1e38){logger[_0x37ed('0xe')](_0x37ed('0xa'),_0x401065,_0x4b1e38);_0x56974c(_0x4b1e38);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 45dfc70..a20dcbf 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d52cc,_0x27d161){var _0x57ae07=function(_0x1a9590){while(--_0x1a9590){_0x2d52cc['push'](_0x2d52cc['shift']());}};_0x57ae07(++_0x27d161);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xcb91[_0x31dde9];return _0x1fbf2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x140b6f,_0x17c890){var _0x3ad053=function(_0x59d4b8){while(--_0x59d4b8){_0x140b6f['push'](_0x140b6f['shift']());}};_0x3ad053(++_0x17c890);}(_0xe706,0xa3));var _0x6e70=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xe706[_0x23f8c8];return _0x3dc718;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index da6dfb2..67e4bab 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 _0xa5c0=['exports','INTEGER','sequelize'];(function(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a5c('0x0'));module[_0x0a5c('0x1')]={'penalty':{'type':Sequelize[_0x0a5c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd3e1=['exports','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd3e1,0xa0));var _0x1d3e=function(_0x3034a9,_0x44e256){_0x3034a9=_0x3034a9-0x0;var _0x4d0cef=_0xd3e1[_0x3034a9];return _0x4d0cef;};'use strict';var Sequelize=require('sequelize');module[_0x1d3e('0x0')]={'penalty':{'type':Sequelize[_0x1d3e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 74bcae6..733cf1e 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc359=['user_has_sms_queues','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x14be9e,_0x44e984){var _0x11fd99=function(_0x26cd70){while(--_0x26cd70){_0x14be9e['push'](_0x14be9e['shift']());}};_0x11fd99(++_0x44e984);}(_0xc359,0x1d9));var _0x9c35=function(_0x381a28,_0x4eb359){_0x381a28=_0x381a28-0x0;var _0x5e572d=_0xc359[_0x381a28];return _0x5e572d;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('UserSmsQueue',attributes,{'tableName':_0x9c35('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x199c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x199c,0x1d8));var _0xc199=function(_0x2359a0,_0x51ab9c){_0x2359a0=_0x2359a0-0x0;var _0x269f47=_0x199c[_0x2359a0];return _0x269f47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc199('0x0'))(_0xc199('0x1'));var moment=require(_0xc199('0x2'));var BPromise=require(_0xc199('0x3'));var rp=require(_0xc199('0x4'));var fs=require('fs');var path=require(_0xc199('0x5'));var rimraf=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xc199('0x8')]=function(_0x2ff172,_0x499721){return _0x2ff172['define'](_0xc199('0x9'),attributes,{'tableName':_0xc199('0xa'),'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 7d8fb72..a345606 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 _0xc71a=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc71a,0x148));var _0xac71=function(_0xd5b794,_0x5a52a1){_0xd5b794=_0xd5b794-0x0;var _0x4ccb5f=_0xc71a[_0xd5b794];return _0x4ccb5f;};'use strict';var _=require(_0xac71('0x0'));var util=require('util');var moment=require(_0xac71('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac71('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac71('0x3'))(_0xac71('0x4'));var config=require(_0xac71('0x5'));var jayson=require(_0xac71('0x6'));var client=jayson[_0xac71('0x7')][_0xac71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x785558,_0x1f6970,_0x4cd06f){return new BPromise(function(_0x53f75f,_0xbe4a4b){return client['request'](_0x785558,_0x4cd06f)[_0xac71('0x9')](function(_0x27fcd4){logger[_0xac71('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x1f6970,_0xac71('0xb'));logger[_0xac71('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1f6970,_0xac71('0xb'),JSON[_0xac71('0xd')](_0x27fcd4));if(_0x27fcd4[_0xac71('0xe')]){if(_0x27fcd4['error'][_0xac71('0xf')]===0x1f4){logger['error'](_0xac71('0x10'),_0x1f6970,_0x27fcd4[_0xac71('0xe')]['message']);return _0xbe4a4b(_0x27fcd4[_0xac71('0xe')]['message']);}logger['error'](_0xac71('0x10'),_0x1f6970,_0x27fcd4[_0xac71('0xe')][_0xac71('0x11')]);return _0x53f75f(_0x27fcd4['error'][_0xac71('0x11')]);}else{logger[_0xac71('0xa')](_0xac71('0x10'),_0x1f6970,_0xac71('0xb'));_0x53f75f(_0x27fcd4[_0xac71('0x12')][_0xac71('0x11')]);}})['catch'](function(_0x339e87){logger[_0xac71('0xe')](_0xac71('0x10'),_0x1f6970,_0x339e87);_0xbe4a4b(_0x339e87);});});} \ No newline at end of file +var _0x920e=['client','http','request','info','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x41b53d,_0x5467d3){var _0x1054e9=function(_0x1589f0){while(--_0x1589f0){_0x41b53d['push'](_0x41b53d['shift']());}};_0x1054e9(++_0x5467d3);}(_0x920e,0x121));var _0xe920=function(_0x132dfd,_0x1dfad9){_0x132dfd=_0x132dfd-0x0;var _0xb6926e=_0x920e[_0x132dfd];return _0xb6926e;};'use strict';var _=require(_0xe920('0x0'));var util=require(_0xe920('0x1'));var moment=require(_0xe920('0x2'));var BPromise=require(_0xe920('0x3'));var rs=require(_0xe920('0x4'));var fs=require('fs');var Redis=require(_0xe920('0x5'));var db=require(_0xe920('0x6'))['db'];var utils=require(_0xe920('0x7'));var logger=require('../../config/logger')(_0xe920('0x8'));var config=require('../../config/environment');var jayson=require(_0xe920('0x9'));var client=jayson[_0xe920('0xa')][_0xe920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f1f49,_0x251230,_0x1108d7){return new BPromise(function(_0x1d3831,_0x3f6bcc){return client[_0xe920('0xc')](_0x2f1f49,_0x1108d7)['then'](function(_0x92c375){logger[_0xe920('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x251230,_0xe920('0xe'));logger[_0xe920('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x251230,_0xe920('0xe'),JSON[_0xe920('0x10')](_0x92c375));if(_0x92c375['error']){if(_0x92c375[_0xe920('0x11')][_0xe920('0x12')]===0x1f4){logger[_0xe920('0x11')](_0xe920('0x13'),_0x251230,_0x92c375[_0xe920('0x11')][_0xe920('0x14')]);return _0x3f6bcc(_0x92c375[_0xe920('0x11')]['message']);}logger[_0xe920('0x11')](_0xe920('0x13'),_0x251230,_0x92c375[_0xe920('0x11')][_0xe920('0x14')]);return _0x1d3831(_0x92c375['error']['message']);}else{logger[_0xe920('0xd')](_0xe920('0x13'),_0x251230,_0xe920('0xe'));_0x1d3831(_0x92c375[_0xe920('0x15')]['message']);}})[_0xe920('0x16')](function(_0x1f7961){logger[_0xe920('0x11')](_0xe920('0x13'),_0x251230,_0x1f7961);_0x3f6bcc(_0x1f7961);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b7bd605..d6c88e7 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa876=['INTEGER','exports'];(function(_0x39d269,_0x5c2a37){var _0x1cf9e7=function(_0x1d77ab){while(--_0x1d77ab){_0x39d269['push'](_0x39d269['shift']());}};_0x1cf9e7(++_0x5c2a37);}(_0xa876,0x13d));var _0x6a87=function(_0x3a1a51,_0x14c470){_0x3a1a51=_0x3a1a51-0x0;var _0xa43104=_0xa876[_0x3a1a51];return _0xa43104;};'use strict';var Sequelize=require('sequelize');module[_0x6a87('0x0')]={'UserId':{'type':Sequelize[_0x6a87('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6a87('0x1')]}}; \ No newline at end of file +var _0x3473=['sequelize','exports','INTEGER'];(function(_0x355141,_0x4ce3bd){var _0x328382=function(_0x44e03c){while(--_0x44e03c){_0x355141['push'](_0x355141['shift']());}};_0x328382(++_0x4ce3bd);}(_0x3473,0xb7));var _0x3347=function(_0x4a0b21,_0x1d310d){_0x4a0b21=_0x4a0b21-0x0;var _0xbc48b8=_0x3473[_0x4a0b21];return _0xbc48b8;};'use strict';var Sequelize=require(_0x3347('0x0'));module[_0x3347('0x1')]={'UserId':{'type':Sequelize[_0x3347('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3347('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index fa62240..8a24128 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xdb5f22,_0x1805e2){var _0x2d36c6=function(_0x399110){while(--_0x399110){_0xdb5f22['push'](_0xdb5f22['shift']());}};_0x2d36c6(++_0x1805e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4750e8,_0x14111f){var _0x395452=function(_0x3ac3fd){while(--_0x3ac3fd){_0x4750e8['push'](_0x4750e8['shift']());}};_0x395452(++_0x14111f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 0726baa..3d72185 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3a4541,_0x22c9d8){var _0x4b9448=function(_0x533e29){while(--_0x533e29){_0x3a4541['push'](_0x3a4541['shift']());}};_0x4b9448(++_0x22c9d8);}(_0x70e0,0x17b));var _0x070e=function(_0x41836d,_0x3881c7){_0x41836d=_0x41836d-0x0;var _0x1674f3=_0x70e0[_0x41836d];return _0x1674f3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x54fc68,_0x4d6cd3){var _0x23d6d8=function(_0x4dcf30){while(--_0x4dcf30){_0x54fc68['push'](_0x54fc68['shift']());}};_0x23d6d8(++_0x4d6cd3);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 5768977..ea3acf0 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 _0xa506=['INTEGER','exports'];(function(_0x4539ee,_0x5757ab){var _0x2a6f5f=function(_0x4d64fa){while(--_0x4d64fa){_0x4539ee['push'](_0x4539ee['shift']());}};_0x2a6f5f(++_0x5757ab);}(_0xa506,0x181));var _0x6a50=function(_0x210a98,_0x10cd6f){_0x210a98=_0x210a98-0x0;var _0x5c0b10=_0xa506[_0x210a98];return _0x5c0b10;};'use strict';var Sequelize=require('sequelize');module[_0x6a50('0x0')]={'penalty':{'type':Sequelize[_0x6a50('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x35b5=['sequelize','exports','INTEGER'];(function(_0x3a1dda,_0x5c56d7){var _0x5ca3e1=function(_0x303fd9){while(--_0x303fd9){_0x3a1dda['push'](_0x3a1dda['shift']());}};_0x5ca3e1(++_0x5c56d7);}(_0x35b5,0x14a));var _0x535b=function(_0x9feaee,_0x1226bd){_0x9feaee=_0x9feaee-0x0;var _0x262bc7=_0x35b5[_0x9feaee];return _0x262bc7;};'use strict';var Sequelize=require(_0x535b('0x0'));module[_0x535b('0x1')]={'penalty':{'type':Sequelize[_0x535b('0x2')],'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 fce7c16..95f4d1b 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 _0xcd18=['./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xcd18,0xff));var _0x8cd1=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0xcd18[_0x5dee2a];return _0x31e98e;};'use strict';var _=require(_0x8cd1('0x0'));var util=require(_0x8cd1('0x1'));var logger=require(_0x8cd1('0x2'))(_0x8cd1('0x3'));var moment=require(_0x8cd1('0x4'));var BPromise=require('bluebird');var rp=require(_0x8cd1('0x5'));var fs=require('fs');var path=require(_0x8cd1('0x6'));var rimraf=require(_0x8cd1('0x7'));var config=require(_0x8cd1('0x8'));var attributes=require(_0x8cd1('0x9'));module[_0x8cd1('0xa')]=function(_0x2653c1,_0x471c11){return _0x2653c1['define']('UserVoiceQueue',attributes,{'tableName':_0x8cd1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x766d=['moment','bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueue','util','../../config/logger','api'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x766d,0x126));var _0xd766=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x766d[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xd766('0x0'));var logger=require(_0xd766('0x1'))(_0xd766('0x2'));var moment=require(_0xd766('0x3'));var BPromise=require(_0xd766('0x4'));var rp=require(_0xd766('0x5'));var fs=require('fs');var path=require(_0xd766('0x6'));var rimraf=require(_0xd766('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xd766('0x8')]=function(_0x39004d,_0x51960c){return _0x39004d[_0xd766('0x9')](_0xd766('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 75870c3..785c905 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 _0xf048=['jayson/promise','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xf048,0x8a));var _0x8f04=function(_0x568d79,_0x344656){_0x568d79=_0x568d79-0x0;var _0x5613ea=_0xf048[_0x568d79];return _0x5613ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8f04('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f04('0x1'));var db=require(_0x8f04('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f04('0x3'))(_0x8f04('0x4'));var config=require(_0x8f04('0x5'));var jayson=require(_0x8f04('0x6'));var client=jayson['client'][_0x8f04('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2be49b,_0xcae4a7,_0xd009c0){return new BPromise(function(_0x535ea6,_0x10475b){return client['request'](_0x2be49b,_0xd009c0)[_0x8f04('0x8')](function(_0x4881ba){logger[_0x8f04('0x9')](_0x8f04('0xa'),_0xcae4a7,_0x8f04('0xb'));logger[_0x8f04('0xc')](_0x8f04('0xd'),_0xcae4a7,_0x8f04('0xb'),JSON[_0x8f04('0xe')](_0x4881ba));if(_0x4881ba[_0x8f04('0xf')]){if(_0x4881ba[_0x8f04('0xf')]['code']===0x1f4){logger[_0x8f04('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xcae4a7,_0x4881ba[_0x8f04('0xf')][_0x8f04('0x10')]);return _0x10475b(_0x4881ba['error'][_0x8f04('0x10')]);}logger[_0x8f04('0xf')](_0x8f04('0xa'),_0xcae4a7,_0x4881ba[_0x8f04('0xf')][_0x8f04('0x10')]);return _0x535ea6(_0x4881ba[_0x8f04('0xf')][_0x8f04('0x10')]);}else{logger['info'](_0x8f04('0xa'),_0xcae4a7,_0x8f04('0xb'));_0x535ea6(_0x4881ba[_0x8f04('0x11')][_0x8f04('0x10')]);}})['catch'](function(_0x4aae7d){logger[_0x8f04('0xf')](_0x8f04('0xa'),_0xcae4a7,_0x4aae7d);_0x10475b(_0x4aae7d);});});} \ No newline at end of file +var _0x0d56=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3aad,_0x1a8930){var _0xc1545f=function(_0xe00964){while(--_0xe00964){_0x3aad['push'](_0x3aad['shift']());}};_0xc1545f(++_0x1a8930);}(_0x0d56,0x158));var _0x60d5=function(_0x3c49e2,_0x5d1332){_0x3c49e2=_0x3c49e2-0x0;var _0x12ccea=_0x0d56[_0x3c49e2];return _0x12ccea;};'use strict';var _=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var moment=require('moment');var BPromise=require(_0x60d5('0x2'));var rs=require(_0x60d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60d5('0x4'));var logger=require(_0x60d5('0x5'))(_0x60d5('0x6'));var config=require(_0x60d5('0x7'));var jayson=require(_0x60d5('0x8'));var client=jayson['client'][_0x60d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47f502,_0x1127dd,_0x38c0c2){return new BPromise(function(_0x56ffc5,_0x2fa1c8){return client[_0x60d5('0xa')](_0x47f502,_0x38c0c2)[_0x60d5('0xb')](function(_0xbc4f96){logger['info'](_0x60d5('0xc'),_0x1127dd,'request\x20sent');logger[_0x60d5('0xd')](_0x60d5('0xe'),_0x1127dd,_0x60d5('0xf'),JSON[_0x60d5('0x10')](_0xbc4f96));if(_0xbc4f96[_0x60d5('0x11')]){if(_0xbc4f96[_0x60d5('0x11')][_0x60d5('0x12')]===0x1f4){logger['error'](_0x60d5('0xc'),_0x1127dd,_0xbc4f96[_0x60d5('0x11')][_0x60d5('0x13')]);return _0x2fa1c8(_0xbc4f96[_0x60d5('0x11')][_0x60d5('0x13')]);}logger[_0x60d5('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1127dd,_0xbc4f96[_0x60d5('0x11')][_0x60d5('0x13')]);return _0x56ffc5(_0xbc4f96[_0x60d5('0x11')][_0x60d5('0x13')]);}else{logger[_0x60d5('0x14')](_0x60d5('0xc'),_0x1127dd,_0x60d5('0xf'));_0x56ffc5(_0xbc4f96[_0x60d5('0x15')]['message']);}})[_0x60d5('0x16')](function(_0x128cd3){logger[_0x60d5('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1127dd,_0x128cd3);_0x2fa1c8(_0x128cd3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 16de3a2..9aa3f2f 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xa599e2,_0x3046be){var _0x122f49=function(_0x4f3d6d){while(--_0x4f3d6d){_0xa599e2['push'](_0xa599e2['shift']());}};_0x122f49(++_0x3046be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1f043c,_0x25c881){var _0x1f0a00=function(_0x7972be){while(--_0x7972be){_0x1f043c['push'](_0x1f043c['shift']());}};_0x1f0a00(++_0x25c881);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xcb91[_0x1ee351];return _0x245aaf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2631381..c1a0286 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 _0x4fda=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fda,0x9a));var _0xa4fd=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4fda[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0xa4fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa4fd('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa4fd('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa4fd('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa4fd('0x3')],'allowNull':![],'unique':_0xa4fd('0x4'),'comment':_0xa4fd('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa4fd('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa4fd('0x1')](0xb),'defaultValue':0x0,'comment':_0xa4fd('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa4fd('0x2')}}; \ No newline at end of file +var _0xd630=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x4c338c,_0x5830c0){var _0x4d5444=function(_0x41b3d2){while(--_0x41b3d2){_0x4c338c['push'](_0x4c338c['shift']());}};_0x4d5444(++_0x5830c0);}(_0xd630,0xf9));var _0x0d63=function(_0x56eced,_0x543058){_0x56eced=_0x56eced-0x0;var _0x4bc86b=_0xd630[_0x56eced];return _0x4bc86b;};'use strict';var Sequelize=require('sequelize');module[_0x0d63('0x0')]={'uniqueid':{'type':Sequelize[_0x0d63('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0d63('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x0d63('0x2')},'UserId':{'type':Sequelize[_0x0d63('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0d63('0x3')],'allowNull':![],'unique':_0x0d63('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x0d63('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0d63('0x3')],'allowNull':![],'unique':_0x0d63('0x4'),'comment':_0x0d63('0x2')},'penalty':{'type':Sequelize[_0x0d63('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0d63('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index cfd69b1..6ea9640 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 _0x45d0=['emit','hasOwnProperty','exports','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x80d516,_0x469cca){var _0x1ea80e=function(_0x141af8){while(--_0x141af8){_0x80d516['push'](_0x80d516['shift']());}};_0x1ea80e(++_0x469cca);}(_0x45d0,0x81));var _0x045d=function(_0x4180c0,_0x5c70e5){_0x4180c0=_0x4180c0-0x0;var _0x547bf7=_0x45d0[_0x4180c0];return _0x547bf7;};'use strict';var EventEmitter=require(_0x045d('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x045d('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x045d('0x2')](0x0);var events={'afterCreate':_0x045d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2fdfd7){return function(_0x13ae1c,_0x5ee7aa,_0x27c053){UserVoiceQueueRtEvents['emit'](_0x2fdfd7+':'+_0x13ae1c['id'],_0x13ae1c);UserVoiceQueueRtEvents[_0x045d('0x4')](_0x2fdfd7,_0x13ae1c);_0x27c053(null);};}for(var e in events){if(events[_0x045d('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x045d('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4033=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x4033,0x103));var _0x3403=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x4033[_0x9be28f];return _0xa9f52d;};'use strict';var EventEmitter=require(_0x3403('0x0'));var UserVoiceQueueRt=require(_0x3403('0x1'))['db'][_0x3403('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3403('0x3')](0x0);var events={'afterCreate':_0x3403('0x4'),'afterUpdate':'update','afterDestroy':_0x3403('0x5')};function emitEvent(_0x657c53){return function(_0x38084f,_0x5cd684,_0x4898a5){UserVoiceQueueRtEvents[_0x3403('0x6')](_0x657c53+':'+_0x38084f['id'],_0x38084f);UserVoiceQueueRtEvents['emit'](_0x657c53,_0x38084f);_0x4898a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3403('0x7')](e,emitEvent(event));}}module[_0x3403('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 f02364c..d94b749 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 _0x18a7=['api','bluebird','request-promise','path','rimraf','exports','define','lodash'];(function(_0x19ea87,_0x38f53f){var _0x4f6bee=function(_0x58e8c0){while(--_0x58e8c0){_0x19ea87['push'](_0x19ea87['shift']());}};_0x4f6bee(++_0x38f53f);}(_0x18a7,0x147));var _0x718a=function(_0x174b34,_0xe54bcd){_0x174b34=_0x174b34-0x0;var _0x384bce=_0x18a7[_0x174b34];return _0x384bce;};'use strict';var _=require(_0x718a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x718a('0x1'));var moment=require('moment');var BPromise=require(_0x718a('0x2'));var rp=require(_0x718a('0x3'));var fs=require('fs');var path=require(_0x718a('0x4'));var rimraf=require(_0x718a('0x5'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x718a('0x6')]=function(_0x3f873c,_0x3d455f){return _0x3f873c[_0x718a('0x7')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb378=['../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb378,0x65));var _0x8b37=function(_0x21e509,_0x47cf17){_0x21e509=_0x21e509-0x0;var _0x2ee4b9=_0xb378[_0x21e509];return _0x2ee4b9;};'use strict';var _=require('lodash');var util=require(_0x8b37('0x0'));var logger=require(_0x8b37('0x1'))(_0x8b37('0x2'));var moment=require('moment');var BPromise=require(_0x8b37('0x3'));var rp=require(_0x8b37('0x4'));var fs=require('fs');var path=require(_0x8b37('0x5'));var rimraf=require(_0x8b37('0x6'));var config=require(_0x8b37('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x8b37('0x8')]=function(_0x2d45fa,_0x3bf911){return _0x2d45fa[_0x8b37('0x9')](_0x8b37('0xa'),attributes,{'tableName':_0x8b37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 150afd9..cdce129 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 _0x15ec=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0x341ebe,_0xdb3686){var _0x4179d0=function(_0x3dcced){while(--_0x3dcced){_0x341ebe['push'](_0x341ebe['shift']());}};_0x4179d0(++_0xdb3686);}(_0x15ec,0xe7));var _0xc15e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x15ec[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc15e('0x0'));var util=require(_0xc15e('0x1'));var moment=require(_0xc15e('0x2'));var BPromise=require(_0xc15e('0x3'));var rs=require(_0xc15e('0x4'));var fs=require('fs');var Redis=require(_0xc15e('0x5'));var db=require(_0xc15e('0x6'))['db'];var utils=require(_0xc15e('0x7'));var logger=require('../../config/logger')(_0xc15e('0x8'));var config=require(_0xc15e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc15e('0xa')]['http']({'port':0x232a});config[_0xc15e('0xb')]=_[_0xc15e('0xc')](config[_0xc15e('0xb')],{'host':_0xc15e('0xd'),'port':0x18eb});var socket=require(_0xc15e('0xe'))(new Redis(config[_0xc15e('0xb')]));require(_0xc15e('0xf'))[_0xc15e('0x10')](socket);function respondWithRpcPromise(_0x1c6cf0,_0xd71f99,_0x3f3d34){return new BPromise(function(_0x390a3c,_0x59202b){return client[_0xc15e('0x11')](_0x1c6cf0,_0x3f3d34)['then'](function(_0x232bfb){logger[_0xc15e('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xd71f99,_0xc15e('0x13'));logger[_0xc15e('0x14')](_0xc15e('0x15'),_0xd71f99,'request\x20sent',JSON[_0xc15e('0x16')](_0x232bfb));if(_0x232bfb[_0xc15e('0x17')]){if(_0x232bfb[_0xc15e('0x17')]['code']===0x1f4){logger[_0xc15e('0x17')](_0xc15e('0x18'),_0xd71f99,_0x232bfb[_0xc15e('0x17')]['message']);return _0x59202b(_0x232bfb[_0xc15e('0x17')][_0xc15e('0x19')]);}logger[_0xc15e('0x17')](_0xc15e('0x18'),_0xd71f99,_0x232bfb[_0xc15e('0x17')][_0xc15e('0x19')]);return _0x390a3c(_0x232bfb[_0xc15e('0x17')][_0xc15e('0x19')]);}else{logger[_0xc15e('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xd71f99,_0xc15e('0x13'));_0x390a3c(_0x232bfb[_0xc15e('0x1a')][_0xc15e('0x19')]);}})[_0xc15e('0x1b')](function(_0x39679c){logger['error'](_0xc15e('0x18'),_0xd71f99,_0x39679c);_0x59202b(_0x39679c);});});}exports['GetVoiceQueueRtPauses']=function(_0x25a10a){var _0xcc41b9=this;return new Promise(function(_0x3cbca2,_0xacb477){return db[_0xc15e('0x1c')][_0xc15e('0x1d')]({'raw':_0x25a10a[_0xc15e('0x1e')]?_0x25a10a[_0xc15e('0x1e')][_0xc15e('0x1f')]===undefined?!![]:![]:!![],'where':_0x25a10a[_0xc15e('0x1e')]?_0x25a10a[_0xc15e('0x1e')]['where']||null:null,'attributes':[[db[_0xc15e('0x20')]['fn'](_0xc15e('0x21'),db[_0xc15e('0x20')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})['then'](function(_0x40ec7a){logger[_0xc15e('0x12')](_0xc15e('0x22'),_0x25a10a);logger[_0xc15e('0x14')]('GetVoiceQueueRtPauses',_0x25a10a,JSON[_0xc15e('0x16')](_0x40ec7a));_0x3cbca2(_0x40ec7a);})[_0xc15e('0x1b')](function(_0x12dedc){logger[_0xc15e('0x17')](_0xc15e('0x22'),_0x12dedc[_0xc15e('0x19')],_0x25a10a);_0xacb477(_0xcc41b9[_0xc15e('0x17')](0x1f4,_0x12dedc[_0xc15e('0x19')]));});});}; \ No newline at end of file +var _0x859a=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request'];(function(_0x2d2273,_0x3d5551){var _0x1aa061=function(_0xdd86b1){while(--_0xdd86b1){_0x2d2273['push'](_0x2d2273['shift']());}};_0x1aa061(++_0x3d5551);}(_0x859a,0x136));var _0xa859=function(_0x9d1ebe,_0x31564b){_0x9d1ebe=_0x9d1ebe-0x0;var _0x33dbeb=_0x859a[_0x9d1ebe];return _0x33dbeb;};'use strict';var _=require(_0xa859('0x0'));var util=require('util');var moment=require(_0xa859('0x1'));var BPromise=require(_0xa859('0x2'));var rs=require(_0xa859('0x3'));var fs=require('fs');var Redis=require(_0xa859('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa859('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa859('0x6'));var client=jayson['client'][_0xa859('0x7')]({'port':0x232a});config[_0xa859('0x8')]=_[_0xa859('0x9')](config[_0xa859('0x8')],{'host':_0xa859('0xa'),'port':0x18eb});var socket=require(_0xa859('0xb'))(new Redis(config['redis']));require(_0xa859('0xc'))['register'](socket);function respondWithRpcPromise(_0x23e6f1,_0x459903,_0x111045){return new BPromise(function(_0x99b087,_0x588eee){return client[_0xa859('0xd')](_0x23e6f1,_0x111045)[_0xa859('0xe')](function(_0x116b7f){logger[_0xa859('0xf')](_0xa859('0x10'),_0x459903,_0xa859('0x11'));logger[_0xa859('0x12')](_0xa859('0x13'),_0x459903,_0xa859('0x11'),JSON['stringify'](_0x116b7f));if(_0x116b7f[_0xa859('0x14')]){if(_0x116b7f['error'][_0xa859('0x15')]===0x1f4){logger[_0xa859('0x14')](_0xa859('0x10'),_0x459903,_0x116b7f[_0xa859('0x14')][_0xa859('0x16')]);return _0x588eee(_0x116b7f[_0xa859('0x14')][_0xa859('0x16')]);}logger[_0xa859('0x14')](_0xa859('0x10'),_0x459903,_0x116b7f[_0xa859('0x14')][_0xa859('0x16')]);return _0x99b087(_0x116b7f[_0xa859('0x14')]['message']);}else{logger['info'](_0xa859('0x10'),_0x459903,_0xa859('0x11'));_0x99b087(_0x116b7f[_0xa859('0x17')][_0xa859('0x16')]);}})['catch'](function(_0x3f797e){logger[_0xa859('0x14')](_0xa859('0x10'),_0x459903,_0x3f797e);_0x588eee(_0x3f797e);});});}exports[_0xa859('0x18')]=function(_0x3f178f){var _0x4c94bf=this;return new Promise(function(_0x4a690c,_0x28fea0){return db[_0xa859('0x19')][_0xa859('0x1a')]({'raw':_0x3f178f[_0xa859('0x1b')]?_0x3f178f[_0xa859('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f178f[_0xa859('0x1b')]?_0x3f178f[_0xa859('0x1b')][_0xa859('0x1c')]||null:null,'attributes':[[db[_0xa859('0x1d')]['fn'](_0xa859('0x1e'),db[_0xa859('0x1d')]['fn']('IF',db[_0xa859('0x1d')][_0xa859('0x1f')](_0xa859('0x20')))),_0xa859('0x21')]]})[_0xa859('0xe')](function(_0x28fffb){logger[_0xa859('0xf')](_0xa859('0x18'),_0x3f178f);logger[_0xa859('0x12')](_0xa859('0x18'),_0x3f178f,JSON[_0xa859('0x22')](_0x28fffb));_0x4a690c(_0x28fffb);})[_0xa859('0x23')](function(_0xb91cb1){logger[_0xa859('0x14')]('GetVoiceQueueRtPauses',_0xb91cb1[_0xa859('0x16')],_0x3f178f);_0x28fea0(_0x4c94bf['error'](0x1f4,_0xb91cb1['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d1b03fc..5bd8fd6 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 _0xedf2=['save','remove','update','userVoiceQueueRt:'];(function(_0x8f75c4,_0x5dac6f){var _0x37c2d4=function(_0x3cdb8f){while(--_0x3cdb8f){_0x8f75c4['push'](_0x8f75c4['shift']());}};_0x37c2d4(++_0x5dac6f);}(_0xedf2,0x1ac));var _0x2edf=function(_0x4bcb21,_0x48db18){_0x4bcb21=_0x4bcb21-0x0;var _0x75825=_0xedf2[_0x4bcb21];return _0x75825;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x2edf('0x0'),_0x2edf('0x1'),_0x2edf('0x2')];function createListener(_0x4b454e,_0xce87f7){return function(_0x1ad605){_0xce87f7['emit'](_0x4b454e,_0x1ad605);};}function removeListener(_0x43611a,_0x2c1515){return function(){UserVoiceQueueRtEvents['removeListener'](_0x43611a,_0x2c1515);};}exports['register']=function(_0x3cfc52){for(var _0x3601aa=0x0,_0x5af8d9=events['length'];_0x3601aa<_0x5af8d9;_0x3601aa++){var _0x2b7b21=events[_0x3601aa];var _0x498c41=createListener(_0x2edf('0x3')+_0x2b7b21,_0x3cfc52);UserVoiceQueueRtEvents['on'](_0x2b7b21,_0x498c41);}}; \ No newline at end of file +var _0x294b=['./userVoiceQueueRt.events','remove','update','emit','removeListener','register'];(function(_0x3b57ad,_0x2d8eec){var _0x5a841f=function(_0x2a8c4a){while(--_0x2a8c4a){_0x3b57ad['push'](_0x3b57ad['shift']());}};_0x5a841f(++_0x2d8eec);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xb294('0x0'));var events=['save',_0xb294('0x1'),_0xb294('0x2')];function createListener(_0x3fb36e,_0x411640){return function(_0x1cd458){_0x411640[_0xb294('0x3')](_0x3fb36e,_0x1cd458);};}function removeListener(_0x58fe24,_0x5c0237){return function(){UserVoiceQueueRtEvents[_0xb294('0x4')](_0x58fe24,_0x5c0237);};}exports[_0xb294('0x5')]=function(_0xaa6a67){for(var _0x181f5e=0x0,_0xcc7910=events['length'];_0x181f5e<_0xcc7910;_0x181f5e++){var _0x39dfbf=events[_0x181f5e];var _0x5110aa=createListener('userVoiceQueueRt:'+_0x39dfbf,_0xaa6a67);UserVoiceQueueRtEvents['on'](_0x39dfbf,_0x5110aa);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index fc2d1f6..d855a3e 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4322f8,_0x4540c4){var _0x218c97=function(_0x6b18b1){while(--_0x6b18b1){_0x4322f8['push'](_0x4322f8['shift']());}};_0x218c97(++_0x4540c4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9e645ba..391376c 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 _0xa0d3=['sequelize','INTEGER'];(function(_0x1be03d,_0x46cccf){var _0x45aeda=function(_0x5d9a0a){while(--_0x5d9a0a){_0x1be03d['push'](_0x1be03d['shift']());}};_0x45aeda(++_0x46cccf);}(_0xa0d3,0x1a2));var _0x3a0d=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa0d3[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require(_0x3a0d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3a0d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x98b5=['exports'];(function(_0x4d7f69,_0x417775){var _0x922c90=function(_0x54670d){while(--_0x54670d){_0x4d7f69['push'](_0x4d7f69['shift']());}};_0x922c90(++_0x417775);}(_0x98b5,0x98));var _0x598b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x98b5[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x598b('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 52eadc1..a9f0f1c 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 _0xd4e3=['UserWhatsappQueue','user_has_whatsapp_queues','util','api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x31b6a3,_0x2b372d){var _0x4f7cb2=function(_0x3bb86a){while(--_0x3bb86a){_0x31b6a3['push'](_0x31b6a3['shift']());}};_0x4f7cb2(++_0x2b372d);}(_0xd4e3,0x138));var _0x3d4e=function(_0x441315,_0x55af18){_0x441315=_0x441315-0x0;var _0x3f360c=_0xd4e3[_0x441315];return _0x3f360c;};'use strict';var _=require('lodash');var util=require(_0x3d4e('0x0'));var logger=require('../../config/logger')(_0x3d4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d4e('0x2'));var fs=require('fs');var path=require(_0x3d4e('0x3'));var rimraf=require(_0x3d4e('0x4'));var config=require(_0x3d4e('0x5'));var attributes=require(_0x3d4e('0x6'));module[_0x3d4e('0x7')]=function(_0x2af4dd,_0x2ea112){return _0x2af4dd['define'](_0x3d4e('0x8'),attributes,{'tableName':_0x3d4e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe56e=['rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise','path'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xe56e,0x1f2));var _0xee56=function(_0x42b631,_0x1d0141){_0x42b631=_0x42b631-0x0;var _0x247fd1=_0xe56e[_0x42b631];return _0x247fd1;};'use strict';var _=require(_0xee56('0x0'));var util=require(_0xee56('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xee56('0x2'));var BPromise=require(_0xee56('0x3'));var rp=require(_0xee56('0x4'));var fs=require('fs');var path=require(_0xee56('0x5'));var rimraf=require(_0xee56('0x6'));var config=require('../../config/environment');var attributes=require(_0xee56('0x7'));module[_0xee56('0x8')]=function(_0x445d7d,_0x15844f){return _0x445d7d[_0xee56('0x9')](_0xee56('0xa'),attributes,{'tableName':_0xee56('0xb'),'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 7cb5eca..24f51ec 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 _0x517a=['randomstring','ioredis','../../config/logger','rpc','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x1640c1,_0x4d6e1c){var _0x436883=function(_0x4ae471){while(--_0x4ae471){_0x1640c1['push'](_0x1640c1['shift']());}};_0x436883(++_0x4d6e1c);}(_0x517a,0xd4));var _0xa517=function(_0x21ef1d,_0xbfa6e){_0x21ef1d=_0x21ef1d-0x0;var _0x2dcdf0=_0x517a[_0x21ef1d];return _0x2dcdf0;};'use strict';var _=require(_0xa517('0x0'));var util=require(_0xa517('0x1'));var moment=require(_0xa517('0x2'));var BPromise=require(_0xa517('0x3'));var rs=require(_0xa517('0x4'));var fs=require('fs');var Redis=require(_0xa517('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa517('0x6'))(_0xa517('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc738aa,_0x562e62,_0x425cdf){return new BPromise(function(_0x274178,_0x49e852){return client[_0xa517('0x8')](_0xc738aa,_0x425cdf)[_0xa517('0x9')](function(_0x2356fc){logger[_0xa517('0xa')](_0xa517('0xb'),_0x562e62,'request\x20sent');logger[_0xa517('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x562e62,_0xa517('0xd'),JSON['stringify'](_0x2356fc));if(_0x2356fc[_0xa517('0xe')]){if(_0x2356fc[_0xa517('0xe')][_0xa517('0xf')]===0x1f4){logger['error'](_0xa517('0xb'),_0x562e62,_0x2356fc[_0xa517('0xe')][_0xa517('0x10')]);return _0x49e852(_0x2356fc['error'][_0xa517('0x10')]);}logger[_0xa517('0xe')](_0xa517('0xb'),_0x562e62,_0x2356fc[_0xa517('0xe')]['message']);return _0x274178(_0x2356fc[_0xa517('0xe')]['message']);}else{logger[_0xa517('0xa')](_0xa517('0xb'),_0x562e62,_0xa517('0xd'));_0x274178(_0x2356fc[_0xa517('0x11')][_0xa517('0x10')]);}})['catch'](function(_0x146fca){logger[_0xa517('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x562e62,_0x146fca);_0x49e852(_0x146fca);});});} \ No newline at end of file +var _0xe223=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x1c713d,_0x2c3bb0){var _0x45ae95=function(_0x49918e){while(--_0x49918e){_0x1c713d['push'](_0x1c713d['shift']());}};_0x45ae95(++_0x2c3bb0);}(_0xe223,0xb7));var _0x3e22=function(_0x1110f9,_0x49d4ae){_0x1110f9=_0x1110f9-0x0;var _0x2dfcb3=_0xe223[_0x1110f9];return _0x2dfcb3;};'use strict';var _=require(_0x3e22('0x0'));var util=require(_0x3e22('0x1'));var moment=require('moment');var BPromise=require(_0x3e22('0x2'));var rs=require(_0x3e22('0x3'));var fs=require('fs');var Redis=require(_0x3e22('0x4'));var db=require(_0x3e22('0x5'))['db'];var utils=require(_0x3e22('0x6'));var logger=require(_0x3e22('0x7'))(_0x3e22('0x8'));var config=require('../../config/environment');var jayson=require(_0x3e22('0x9'));var client=jayson[_0x3e22('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3289dd,_0x3a9e96,_0x4e80a7){return new BPromise(function(_0x49c000,_0x5c9eca){return client[_0x3e22('0xb')](_0x3289dd,_0x4e80a7)[_0x3e22('0xc')](function(_0x2ac0f4){logger[_0x3e22('0xd')](_0x3e22('0xe'),_0x3a9e96,'request\x20sent');logger[_0x3e22('0xf')](_0x3e22('0x10'),_0x3a9e96,_0x3e22('0x11'),JSON[_0x3e22('0x12')](_0x2ac0f4));if(_0x2ac0f4['error']){if(_0x2ac0f4[_0x3e22('0x13')][_0x3e22('0x14')]===0x1f4){logger['error'](_0x3e22('0xe'),_0x3a9e96,_0x2ac0f4[_0x3e22('0x13')][_0x3e22('0x15')]);return _0x5c9eca(_0x2ac0f4[_0x3e22('0x13')]['message']);}logger[_0x3e22('0x13')](_0x3e22('0xe'),_0x3a9e96,_0x2ac0f4['error'][_0x3e22('0x15')]);return _0x49c000(_0x2ac0f4[_0x3e22('0x13')][_0x3e22('0x15')]);}else{logger['info'](_0x3e22('0xe'),_0x3a9e96,_0x3e22('0x11'));_0x49c000(_0x2ac0f4['result'][_0x3e22('0x15')]);}})['catch'](function(_0x36a473){logger['error'](_0x3e22('0xe'),_0x3a9e96,_0x36a473);_0x5c9eca(_0x36a473);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c78fba4..149fbd9 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 _0xdeb3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','create','put','update','delete','multer','util','path'];(function(_0x113a94,_0x2aa6b1){var _0x1f6441=function(_0x4a016a){while(--_0x4a016a){_0x113a94['push'](_0x113a94['shift']());}};_0x1f6441(++_0x2aa6b1);}(_0xdeb3,0xeb));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var path=require(_0x3deb('0x2'));var timeout=require(_0x3deb('0x3'));var express=require(_0x3deb('0x4'));var router=express[_0x3deb('0x5')]();var fs_extra=require(_0x3deb('0x6'));var auth=require(_0x3deb('0x7'));var interaction=require(_0x3deb('0x8'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xa')]);router[_0x3deb('0xb')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller['show']);router['post']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xd')]);router[_0x3deb('0xe')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller[_0x3deb('0xf')]);router[_0x3deb('0x10')](_0x3deb('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x54f3=['post','create','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','index','/:id','isAuthenticated','show'];(function(_0x27dd20,_0xb148c4){var _0x5d903c=function(_0x194af6){while(--_0x194af6){_0x27dd20['push'](_0x27dd20['shift']());}};_0x5d903c(++_0xb148c4);}(_0x54f3,0x120));var _0x354f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x54f3[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var controller=require(_0x354f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x354f('0x8')]);router['get'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router[_0x354f('0xc')]('/',auth['isAuthenticated'](),controller[_0x354f('0xd')]);router['put'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['update']);router['delete'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['destroy']);module[_0x354f('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 15055dd..013b616 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 _0xe389=['STRING','sequelize','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe389,0x1b9));var _0x9e38=function(_0x278726,_0x1e452a){_0x278726=_0x278726-0x0;var _0x33e756=_0xe389[_0x278726];return _0x33e756;};'use strict';var Sequelize=require(_0x9e38('0x0'));module[_0x9e38('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e38('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9e38('0x3')]}}; \ No newline at end of file +var _0xe751=['exports','STRING','name','sequelize'];(function(_0x5c8651,_0xce6f79){var _0x381ab6=function(_0x50ab2e){while(--_0x50ab2e){_0x5c8651['push'](_0x5c8651['shift']());}};_0x381ab6(++_0xce6f79);}(_0xe751,0xf7));var _0x1e75=function(_0x3d2601,_0x4b107a){_0x3d2601=_0x3d2601-0x0;var _0x5359b5=_0xe751[_0x3d2601];return _0x5359b5;};'use strict';var Sequelize=require(_0x1e75('0x0'));module[_0x1e75('0x1')]={'name':{'type':Sequelize[_0x1e75('0x2')],'unique':_0x1e75('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1e75('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index e61c978..c2dbe0e 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 _0x1d28=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','Variable','includeAll','include','catch','show','params','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x47b2b0,_0x293376){var _0x378284=function(_0x4bc1e8){while(--_0x4bc1e8){_0x47b2b0['push'](_0x47b2b0['shift']());}};_0x378284(++_0x293376);}(_0x1d28,0x1b6));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x81d2('0x0'));var rimraf=require(_0x81d2('0x1'));var zipdir=require(_0x81d2('0x2'));var jsonpatch=require(_0x81d2('0x3'));var rp=require(_0x81d2('0x4'));var moment=require(_0x81d2('0x5'));var BPromise=require(_0x81d2('0x6'));var Mustache=require(_0x81d2('0x7'));var util=require(_0x81d2('0x8'));var path=require(_0x81d2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x81d2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81d2('0xb'));var squel=require(_0x81d2('0xc'));var crypto=require(_0x81d2('0xd'));var jsforce=require(_0x81d2('0xe'));var deskjs=require(_0x81d2('0xf'));var toCsv=require(_0x81d2('0x10'));var querystring=require(_0x81d2('0x11'));var Papa=require(_0x81d2('0x12'));var Redis=require(_0x81d2('0x13'));var authService=require(_0x81d2('0x14'));var qs=require(_0x81d2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x81d2('0x16'))(_0x81d2('0x17'));var utils=require(_0x81d2('0x18'));var config=require(_0x81d2('0x19'));var licenseUtil=require(_0x81d2('0x1a'));var db=require(_0x81d2('0x1b'))['db'];function respondWithStatusCode(_0xe0ee7d,_0x4cdc2c){_0x4cdc2c=_0x4cdc2c||0xcc;return function(_0x14038a){if(_0x14038a){return _0xe0ee7d['sendStatus'](_0x4cdc2c);}return _0xe0ee7d[_0x81d2('0x1c')](_0x4cdc2c)[_0x81d2('0x1d')]();};}function respondWithResult(_0x417aa0,_0x38f431){_0x38f431=_0x38f431||0xc8;return function(_0x2db519){if(_0x2db519){return _0x417aa0['status'](_0x38f431)['json'](_0x2db519);}};}function respondWithFilteredResult(_0x1c0342,_0x4c2030){return function(_0x4f4698){if(_0x4f4698){var _0x1381a2=typeof _0x4c2030[_0x81d2('0x1e')]===_0x81d2('0x1f')&&typeof _0x4c2030['limit']===_0x81d2('0x1f');var _0x2904ed=_0x4f4698[_0x81d2('0x20')];var _0x3d9cd4=_0x1381a2?0x0:_0x4c2030[_0x81d2('0x1e')];var _0x4a1f0f=_0x1381a2?_0x4f4698['count']:_0x4c2030[_0x81d2('0x1e')]+_0x4c2030['limit'];var _0x1d91b6;if(_0x4a1f0f>=_0x2904ed){_0x4a1f0f=_0x2904ed;_0x1d91b6=0xc8;}else{_0x1d91b6=0xce;}_0x1c0342['status'](_0x1d91b6);return _0x1c0342[_0x81d2('0x21')](_0x81d2('0x22'),_0x3d9cd4+'-'+_0x4a1f0f+'/'+_0x2904ed)[_0x81d2('0x23')](_0x4f4698);}return null;};}function patchUpdates(_0x1e3257){return function(_0x5de68a){try{jsonpatch[_0x81d2('0x24')](_0x5de68a,_0x1e3257,!![]);}catch(_0x2d9c53){return BPromise[_0x81d2('0x25')](_0x2d9c53);}return _0x5de68a[_0x81d2('0x26')]();};}function saveUpdates(_0x1c596d,_0x17ddcd){return function(_0x4e94a2){if(_0x4e94a2){return _0x4e94a2[_0x81d2('0x27')](_0x1c596d)[_0x81d2('0x28')](function(_0xc1ac9b){return _0xc1ac9b;});}return null;};}function removeEntity(_0x24cc60,_0x58c805){return function(_0x3f13db){if(_0x3f13db){return _0x3f13db['destroy']()['then'](function(){var _0x550b4c=_0x3f13db[_0x81d2('0x29')]({'plain':!![]});var _0x402bad=_0x81d2('0x2a');return db[_0x81d2('0x2b')][_0x81d2('0x2c')]({'where':{'type':_0x402bad,'resourceId':_0x550b4c['id']}})[_0x81d2('0x28')](function(){return _0x3f13db;});})[_0x81d2('0x28')](function(){_0x24cc60[_0x81d2('0x1c')](0xcc)[_0x81d2('0x1d')]();});}};}function handleEntityNotFound(_0x4934b5,_0xc19515){return function(_0x2db7f6){if(!_0x2db7f6){_0x4934b5['sendStatus'](0x194);}return _0x2db7f6;};}function handleError(_0x1db1df,_0x4233df){_0x4233df=_0x4233df||0x1f4;return function(_0x525c14){logger[_0x81d2('0x2d')](_0x525c14[_0x81d2('0x2e')]);if(_0x525c14[_0x81d2('0x2f')]){delete _0x525c14[_0x81d2('0x2f')];}_0x1db1df['status'](_0x4233df)[_0x81d2('0x30')](_0x525c14);};}exports[_0x81d2('0x31')]=function(_0x1c904f,_0x4b92c1){var _0xc0999e={},_0x5652f5={},_0x3bdc35={'count':0x0,'rows':[]};var _0x1cfec6=_[_0x81d2('0x32')](db['Variable'][_0x81d2('0x33')],function(_0x27968b){return{'name':_0x27968b[_0x81d2('0x34')],'type':_0x27968b[_0x81d2('0x35')][_0x81d2('0x36')]};});_0x5652f5[_0x81d2('0x37')]=_[_0x81d2('0x32')](_0x1cfec6,_0x81d2('0x2f'));_0x5652f5[_0x81d2('0x38')]=_[_0x81d2('0x39')](_0x1c904f[_0x81d2('0x38')]);_0x5652f5[_0x81d2('0x3a')]=_[_0x81d2('0x3b')](_0x5652f5[_0x81d2('0x37')],_0x5652f5[_0x81d2('0x38')]);_0xc0999e['attributes']=_[_0x81d2('0x3b')](_0x5652f5['model'],qs[_0x81d2('0x3c')](_0x1c904f['query'][_0x81d2('0x3c')]));_0xc0999e[_0x81d2('0x3d')]=_0xc0999e[_0x81d2('0x3d')][_0x81d2('0x3e')]?_0xc0999e[_0x81d2('0x3d')]:_0x5652f5['model'];if(!_0x1c904f[_0x81d2('0x38')][_0x81d2('0x3f')](_0x81d2('0x40'))){_0xc0999e[_0x81d2('0x41')]=qs[_0x81d2('0x41')](_0x1c904f[_0x81d2('0x38')][_0x81d2('0x41')]);_0xc0999e[_0x81d2('0x1e')]=qs[_0x81d2('0x1e')](_0x1c904f[_0x81d2('0x38')][_0x81d2('0x1e')]);}_0xc0999e[_0x81d2('0x42')]=qs[_0x81d2('0x43')](_0x1c904f[_0x81d2('0x38')]['sort']);_0xc0999e[_0x81d2('0x44')]=qs[_0x81d2('0x3a')](_[_0x81d2('0x45')](_0x1c904f[_0x81d2('0x38')],_0x5652f5[_0x81d2('0x3a')]),_0x1cfec6);if(_0x1c904f[_0x81d2('0x38')][_0x81d2('0x46')]){_0xc0999e[_0x81d2('0x44')]=_['merge'](_0xc0999e['where'],{'$or':_['map'](_0x1cfec6,function(_0x4da1b2){if(_0x4da1b2[_0x81d2('0x35')]!=='VIRTUAL'){var _0x4c26ad={};_0x4c26ad[_0x4da1b2['name']]={'$like':'%'+_0x1c904f[_0x81d2('0x38')][_0x81d2('0x46')]+'%'};return _0x4c26ad;}})});}_0xc0999e=_['merge']({},_0xc0999e,_0x1c904f['options']);var _0x2e0e1e={'where':_0xc0999e[_0x81d2('0x44')]};return db[_0x81d2('0x47')]['count'](_0x2e0e1e)['then'](function(_0x1beb8f){_0x3bdc35['count']=_0x1beb8f;if(_0x1c904f[_0x81d2('0x38')][_0x81d2('0x48')]){_0xc0999e[_0x81d2('0x49')]=[{'all':!![]}];}return db['Variable']['findAll'](_0xc0999e);})[_0x81d2('0x28')](function(_0x1b2e22){_0x3bdc35['rows']=_0x1b2e22;return _0x3bdc35;})[_0x81d2('0x28')](respondWithFilteredResult(_0x4b92c1,_0xc0999e))[_0x81d2('0x4a')](handleError(_0x4b92c1,null));};exports[_0x81d2('0x4b')]=function(_0x49d24f,_0x3b61dc){var _0x224d9f={'raw':!![],'where':{'id':_0x49d24f[_0x81d2('0x4c')]['id']}},_0x1ed2e4={};_0x1ed2e4[_0x81d2('0x37')]=_['keys'](db[_0x81d2('0x47')][_0x81d2('0x33')]);_0x1ed2e4[_0x81d2('0x38')]=_[_0x81d2('0x39')](_0x49d24f[_0x81d2('0x38')]);_0x1ed2e4[_0x81d2('0x3a')]=_[_0x81d2('0x3b')](_0x1ed2e4[_0x81d2('0x37')],_0x1ed2e4[_0x81d2('0x38')]);_0x224d9f['attributes']=_[_0x81d2('0x3b')](_0x1ed2e4[_0x81d2('0x37')],qs[_0x81d2('0x3c')](_0x49d24f[_0x81d2('0x38')][_0x81d2('0x3c')]));_0x224d9f[_0x81d2('0x3d')]=_0x224d9f[_0x81d2('0x3d')][_0x81d2('0x3e')]?_0x224d9f[_0x81d2('0x3d')]:_0x1ed2e4[_0x81d2('0x37')];if(_0x49d24f[_0x81d2('0x38')][_0x81d2('0x48')]){_0x224d9f[_0x81d2('0x49')]=[{'all':!![]}];}_0x224d9f=_[_0x81d2('0x4d')]({},_0x224d9f,_0x49d24f[_0x81d2('0x4e')]);return db['Variable'][_0x81d2('0x4f')](_0x224d9f)['then'](handleEntityNotFound(_0x3b61dc,null))['then'](respondWithResult(_0x3b61dc,null))[_0x81d2('0x4a')](handleError(_0x3b61dc,null));};exports['create']=function(_0x4c2587,_0xfaed4){return db[_0x81d2('0x47')][_0x81d2('0x50')](_0x4c2587[_0x81d2('0x51')],{})[_0x81d2('0x28')](function(_0x46cc94){var _0x188e71=_0x4c2587[_0x81d2('0x52')][_0x81d2('0x29')]({'plain':!![]});if(!_0x188e71)throw new Error(_0x81d2('0x53'));if(_0x188e71['role']===_0x81d2('0x52')){var _0x162f8b=_0x46cc94['get']({'plain':!![]});var _0x17eb1f=_0x81d2('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x17eb1f,'userProfileId':_0x188e71[_0x81d2('0x54')]},'raw':!![]})['then'](function(_0x50e944){if(_0x50e944&&_0x50e944[_0x81d2('0x55')]===0x0){return db[_0x81d2('0x2b')][_0x81d2('0x50')]({'name':_0x162f8b[_0x81d2('0x2f')],'resourceId':_0x162f8b['id'],'type':_0x50e944[_0x81d2('0x2f')],'sectionId':_0x50e944['id']},{})[_0x81d2('0x28')](function(){return _0x46cc94;});}else{return _0x46cc94;}})[_0x81d2('0x4a')](function(_0x265187){logger[_0x81d2('0x2d')](_0x81d2('0x56'),_0x265187);throw _0x265187;});}return _0x46cc94;})[_0x81d2('0x28')](respondWithResult(_0xfaed4,0xc9))[_0x81d2('0x4a')](handleError(_0xfaed4,null));};exports[_0x81d2('0x27')]=function(_0x3f8fa5,_0x20fb36){if(_0x3f8fa5[_0x81d2('0x51')]['id']){delete _0x3f8fa5[_0x81d2('0x51')]['id'];}return db[_0x81d2('0x47')][_0x81d2('0x4f')]({'where':{'id':_0x3f8fa5[_0x81d2('0x4c')]['id']}})[_0x81d2('0x28')](handleEntityNotFound(_0x20fb36,null))[_0x81d2('0x28')](saveUpdates(_0x3f8fa5[_0x81d2('0x51')],null))[_0x81d2('0x28')](respondWithResult(_0x20fb36,null))['catch'](handleError(_0x20fb36,null));};exports[_0x81d2('0x2c')]=function(_0x32b8b1,_0x485279){return db[_0x81d2('0x47')][_0x81d2('0x4f')]({'where':{'id':_0x32b8b1[_0x81d2('0x4c')]['id']}})[_0x81d2('0x28')](handleEntityNotFound(_0x485279,null))[_0x81d2('0x28')](removeEntity(_0x485279,null))['catch'](handleError(_0x485279,null));}; \ No newline at end of file +var _0x9309=['nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','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','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1d7877,_0x36c4a3){var _0x35ab2a=function(_0xa6bbad){while(--_0xa6bbad){_0x1d7877['push'](_0x1d7877['shift']());}};_0x35ab2a(++_0x36c4a3);}(_0x9309,0xc6));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9930('0x0'));var rimraf=require(_0x9930('0x1'));var zipdir=require(_0x9930('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9930('0x3'));var moment=require(_0x9930('0x4'));var BPromise=require(_0x9930('0x5'));var Mustache=require(_0x9930('0x6'));var util=require(_0x9930('0x7'));var path=require(_0x9930('0x8'));var sox=require(_0x9930('0x9'));var csv=require(_0x9930('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9930('0xb'));var _=require(_0x9930('0xc'));var squel=require(_0x9930('0xd'));var crypto=require(_0x9930('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9930('0xf'));var toCsv=require(_0x9930('0xa'));var querystring=require(_0x9930('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9930('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9930('0x12'));var hardwareService=require(_0x9930('0x13'));var logger=require(_0x9930('0x14'))(_0x9930('0x15'));var utils=require(_0x9930('0x16'));var config=require(_0x9930('0x17'));var licenseUtil=require(_0x9930('0x18'));var db=require(_0x9930('0x19'))['db'];function respondWithStatusCode(_0x47f882,_0x411f78){_0x411f78=_0x411f78||0xcc;return function(_0x5e729a){if(_0x5e729a){return _0x47f882[_0x9930('0x1a')](_0x411f78);}return _0x47f882[_0x9930('0x1b')](_0x411f78)[_0x9930('0x1c')]();};}function respondWithResult(_0x43185e,_0x47ad6f){_0x47ad6f=_0x47ad6f||0xc8;return function(_0x1e8afe){if(_0x1e8afe){return _0x43185e[_0x9930('0x1b')](_0x47ad6f)[_0x9930('0x1d')](_0x1e8afe);}};}function respondWithFilteredResult(_0x3208c9,_0x7aa4a5){return function(_0x8502da){if(_0x8502da){var _0x5e9f39=typeof _0x7aa4a5[_0x9930('0x1e')]===_0x9930('0x1f')&&typeof _0x7aa4a5[_0x9930('0x20')]===_0x9930('0x1f');var _0x392852=_0x8502da[_0x9930('0x21')];var _0x22e333=_0x5e9f39?0x0:_0x7aa4a5[_0x9930('0x1e')];var _0xa2ccf0=_0x5e9f39?_0x8502da['count']:_0x7aa4a5[_0x9930('0x1e')]+_0x7aa4a5[_0x9930('0x20')];var _0x3af29e;if(_0xa2ccf0>=_0x392852){_0xa2ccf0=_0x392852;_0x3af29e=0xc8;}else{_0x3af29e=0xce;}_0x3208c9['status'](_0x3af29e);return _0x3208c9[_0x9930('0x22')]('Content-Range',_0x22e333+'-'+_0xa2ccf0+'/'+_0x392852)['json'](_0x8502da);}return null;};}function patchUpdates(_0x5257ad){return function(_0x15de12){try{jsonpatch[_0x9930('0x23')](_0x15de12,_0x5257ad,!![]);}catch(_0xc209b3){return BPromise[_0x9930('0x24')](_0xc209b3);}return _0x15de12[_0x9930('0x25')]();};}function saveUpdates(_0x411ab5,_0x513921){return function(_0x20a1eb){if(_0x20a1eb){return _0x20a1eb['update'](_0x411ab5)['then'](function(_0x353f39){return _0x353f39;});}return null;};}function removeEntity(_0x1bc74e,_0x492cb4){return function(_0x2353e8){if(_0x2353e8){return _0x2353e8[_0x9930('0x26')]()[_0x9930('0x27')](function(){var _0x474489=_0x2353e8[_0x9930('0x28')]({'plain':!![]});var _0x4ca1c1=_0x9930('0x29');return db[_0x9930('0x2a')][_0x9930('0x26')]({'where':{'type':_0x4ca1c1,'resourceId':_0x474489['id']}})[_0x9930('0x27')](function(){return _0x2353e8;});})['then'](function(){_0x1bc74e[_0x9930('0x1b')](0xcc)[_0x9930('0x1c')]();});}};}function handleEntityNotFound(_0x2db8ef,_0x1df1d2){return function(_0x5570c2){if(!_0x5570c2){_0x2db8ef[_0x9930('0x1a')](0x194);}return _0x5570c2;};}function handleError(_0x42a20c,_0x17134f){_0x17134f=_0x17134f||0x1f4;return function(_0x194ab6){logger[_0x9930('0x2b')](_0x194ab6[_0x9930('0x2c')]);if(_0x194ab6[_0x9930('0x2d')]){delete _0x194ab6[_0x9930('0x2d')];}_0x42a20c[_0x9930('0x1b')](_0x17134f)[_0x9930('0x2e')](_0x194ab6);};}exports[_0x9930('0x2f')]=function(_0x131776,_0x35ac89){var _0xca96d5={},_0x4d4537={},_0x4059f0={'count':0x0,'rows':[]};var _0x10bb3d=_[_0x9930('0x30')](db[_0x9930('0x31')][_0x9930('0x32')],function(_0x2787c4){return{'name':_0x2787c4[_0x9930('0x33')],'type':_0x2787c4[_0x9930('0x34')][_0x9930('0x35')]};});_0x4d4537[_0x9930('0x36')]=_['map'](_0x10bb3d,_0x9930('0x2d'));_0x4d4537[_0x9930('0x37')]=_[_0x9930('0x38')](_0x131776[_0x9930('0x37')]);_0x4d4537[_0x9930('0x39')]=_[_0x9930('0x3a')](_0x4d4537[_0x9930('0x36')],_0x4d4537['query']);_0xca96d5[_0x9930('0x3b')]=_['intersection'](_0x4d4537[_0x9930('0x36')],qs['fields'](_0x131776[_0x9930('0x37')][_0x9930('0x3c')]));_0xca96d5[_0x9930('0x3b')]=_0xca96d5[_0x9930('0x3b')][_0x9930('0x3d')]?_0xca96d5[_0x9930('0x3b')]:_0x4d4537[_0x9930('0x36')];if(!_0x131776[_0x9930('0x37')][_0x9930('0x3e')](_0x9930('0x3f'))){_0xca96d5['limit']=qs[_0x9930('0x20')](_0x131776[_0x9930('0x37')][_0x9930('0x20')]);_0xca96d5['offset']=qs['offset'](_0x131776['query']['offset']);}_0xca96d5['order']=qs['sort'](_0x131776[_0x9930('0x37')][_0x9930('0x40')]);_0xca96d5[_0x9930('0x41')]=qs['filters'](_[_0x9930('0x42')](_0x131776[_0x9930('0x37')],_0x4d4537['filters']),_0x10bb3d);if(_0x131776['query'][_0x9930('0x43')]){_0xca96d5['where']=_[_0x9930('0x44')](_0xca96d5[_0x9930('0x41')],{'$or':_[_0x9930('0x30')](_0x10bb3d,function(_0x595130){if(_0x595130[_0x9930('0x34')]!=='VIRTUAL'){var _0x324037={};_0x324037[_0x595130[_0x9930('0x2d')]]={'$like':'%'+_0x131776[_0x9930('0x37')][_0x9930('0x43')]+'%'};return _0x324037;}})});}_0xca96d5=_[_0x9930('0x44')]({},_0xca96d5,_0x131776['options']);var _0x52a24c={'where':_0xca96d5[_0x9930('0x41')]};return db[_0x9930('0x31')][_0x9930('0x21')](_0x52a24c)[_0x9930('0x27')](function(_0x36820f){_0x4059f0[_0x9930('0x21')]=_0x36820f;if(_0x131776[_0x9930('0x37')][_0x9930('0x45')]){_0xca96d5[_0x9930('0x46')]=[{'all':!![]}];}return db['Variable'][_0x9930('0x47')](_0xca96d5);})[_0x9930('0x27')](function(_0x316505){_0x4059f0[_0x9930('0x48')]=_0x316505;return _0x4059f0;})[_0x9930('0x27')](respondWithFilteredResult(_0x35ac89,_0xca96d5))[_0x9930('0x49')](handleError(_0x35ac89,null));};exports[_0x9930('0x4a')]=function(_0x289c89,_0x12b8d6){var _0x3d2e88={'raw':!![],'where':{'id':_0x289c89[_0x9930('0x4b')]['id']}},_0xdfaa64={};_0xdfaa64[_0x9930('0x36')]=_[_0x9930('0x38')](db['Variable'][_0x9930('0x32')]);_0xdfaa64[_0x9930('0x37')]=_[_0x9930('0x38')](_0x289c89[_0x9930('0x37')]);_0xdfaa64[_0x9930('0x39')]=_[_0x9930('0x3a')](_0xdfaa64[_0x9930('0x36')],_0xdfaa64[_0x9930('0x37')]);_0x3d2e88[_0x9930('0x3b')]=_[_0x9930('0x3a')](_0xdfaa64['model'],qs[_0x9930('0x3c')](_0x289c89[_0x9930('0x37')][_0x9930('0x3c')]));_0x3d2e88[_0x9930('0x3b')]=_0x3d2e88['attributes']['length']?_0x3d2e88[_0x9930('0x3b')]:_0xdfaa64[_0x9930('0x36')];if(_0x289c89['query'][_0x9930('0x45')]){_0x3d2e88['include']=[{'all':!![]}];}_0x3d2e88=_['merge']({},_0x3d2e88,_0x289c89[_0x9930('0x4c')]);return db[_0x9930('0x31')][_0x9930('0x4d')](_0x3d2e88)[_0x9930('0x27')](handleEntityNotFound(_0x12b8d6,null))[_0x9930('0x27')](respondWithResult(_0x12b8d6,null))['catch'](handleError(_0x12b8d6,null));};exports[_0x9930('0x4e')]=function(_0x3ac67b,_0x28d8a4){return db[_0x9930('0x31')][_0x9930('0x4e')](_0x3ac67b[_0x9930('0x4f')],{})['then'](function(_0x84b018){var _0x32c9b4=_0x3ac67b[_0x9930('0x50')][_0x9930('0x28')]({'plain':!![]});if(!_0x32c9b4)throw new Error(_0x9930('0x51'));if(_0x32c9b4[_0x9930('0x52')]===_0x9930('0x50')){var _0x4cf8b7=_0x84b018['get']({'plain':!![]});var _0x510b3d='Variables';return db[_0x9930('0x53')]['find']({'where':{'name':_0x510b3d,'userProfileId':_0x32c9b4[_0x9930('0x54')]},'raw':!![]})[_0x9930('0x27')](function(_0x2a89f6){if(_0x2a89f6&&_0x2a89f6[_0x9930('0x55')]===0x0){return db[_0x9930('0x2a')][_0x9930('0x4e')]({'name':_0x4cf8b7['name'],'resourceId':_0x4cf8b7['id'],'type':_0x2a89f6['name'],'sectionId':_0x2a89f6['id']},{})[_0x9930('0x27')](function(){return _0x84b018;});}else{return _0x84b018;}})[_0x9930('0x49')](function(_0xaf9e06){logger[_0x9930('0x2b')](_0x9930('0x56'),_0xaf9e06);throw _0xaf9e06;});}return _0x84b018;})[_0x9930('0x27')](respondWithResult(_0x28d8a4,0xc9))[_0x9930('0x49')](handleError(_0x28d8a4,null));};exports['update']=function(_0x18bcd1,_0xb33c81){if(_0x18bcd1[_0x9930('0x4f')]['id']){delete _0x18bcd1[_0x9930('0x4f')]['id'];}return db[_0x9930('0x31')][_0x9930('0x4d')]({'where':{'id':_0x18bcd1[_0x9930('0x4b')]['id']}})[_0x9930('0x27')](handleEntityNotFound(_0xb33c81,null))['then'](saveUpdates(_0x18bcd1[_0x9930('0x4f')],null))[_0x9930('0x27')](respondWithResult(_0xb33c81,null))[_0x9930('0x49')](handleError(_0xb33c81,null));};exports[_0x9930('0x26')]=function(_0x148041,_0x3dc032){return db['Variable'][_0x9930('0x4d')]({'where':{'id':_0x148041[_0x9930('0x4b')]['id']}})[_0x9930('0x27')](handleEntityNotFound(_0x3dc032,null))[_0x9930('0x27')](removeEntity(_0x3dc032,null))[_0x9930('0x49')](handleError(_0x3dc032,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 427241f..bbc42b8 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 _0x1baf=['Variable','../../config/logger','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x1baf,0xc9));var _0xf1ba=function(_0x1a09a2,_0x25cbbc){_0x1a09a2=_0x1a09a2-0x0;var _0x2f6545=_0x1baf[_0x1a09a2];return _0x2f6545;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf1ba('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf1ba('0x1'));var fs=require('fs');var path=require(_0xf1ba('0x2'));var rimraf=require(_0xf1ba('0x3'));var config=require(_0xf1ba('0x4'));var attributes=require(_0xf1ba('0x5'));module[_0xf1ba('0x6')]=function(_0x10e1e7,_0x4d5c91){return _0x10e1e7['define'](_0xf1ba('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3858=['api','bluebird','rimraf','../../config/environment','define','util','../../config/logger'];(function(_0x2cc9fb,_0x114789){var _0x27f802=function(_0x4eab9d){while(--_0x4eab9d){_0x2cc9fb['push'](_0x2cc9fb['shift']());}};_0x27f802(++_0x114789);}(_0x3858,0x116));var _0x8385=function(_0x545c73,_0x1d886f){_0x545c73=_0x545c73-0x0;var _0x194561=_0x3858[_0x545c73];return _0x194561;};'use strict';var _=require('lodash');var util=require(_0x8385('0x0'));var logger=require(_0x8385('0x1'))(_0x8385('0x2'));var moment=require('moment');var BPromise=require(_0x8385('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8385('0x4'));var config=require(_0x8385('0x5'));var attributes=require('./variable.attributes');module['exports']=function(_0xe2f940,_0x4bdaee){return _0xe2f940[_0x8385('0x6')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d3ada63..2ac625e 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x596de3,_0xf801c0){var _0xbf541f=function(_0x3b7460){while(--_0x3b7460){_0x596de3['push'](_0x596de3['shift']());}};_0xbf541f(++_0xf801c0);}(_0xe14b,0x93));var _0xbe14=function(_0x2aa813,_0x19e996){_0x2aa813=_0x2aa813-0x0;var _0x504002=_0xe14b[_0x2aa813];return _0x504002;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x37cb61,_0xa49d0){var _0x4ca1c7=function(_0x4201f9){while(--_0x4201f9){_0x37cb61['push'](_0x37cb61['shift']());}};_0x4ca1c7(++_0xa49d0);}(_0x3e74,0x175));var _0x43e7=function(_0x3156b9,_0x3127fb){_0x3156b9=_0x3156b9-0x0;var _0x592158=_0x3e74[_0x3156b9];return _0x592158;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b519d7d..3cfbdc3 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 _0x25fc=['exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x46888b,_0x2d6165){var _0x52bf28=function(_0x24405f){while(--_0x24405f){_0x46888b['push'](_0x46888b['shift']());}};_0x52bf28(++_0x2d6165);}(_0x25fc,0xef));var _0xc25f=function(_0x1c33f3,_0x19f232){_0x1c33f3=_0x1c33f3-0x0;var _0x257478=_0x25fc[_0x1c33f3];return _0x257478;};'use strict';var express=require(_0xc25f('0x0'));var router=express['Router']();var auth=require(_0xc25f('0x1'));var controller=require(_0xc25f('0x2'));router[_0xc25f('0x3')]('/',controller[_0xc25f('0x4')]);router[_0xc25f('0x3')](_0xc25f('0x5'),auth[_0xc25f('0x6')](),auth[_0xc25f('0x7')](),controller[_0xc25f('0x8')]);router[_0xc25f('0x3')](_0xc25f('0x9'),auth[_0xc25f('0x6')](),auth[_0xc25f('0x7')](),controller[_0xc25f('0xa')]);router[_0xc25f('0x3')](_0xc25f('0xb'),auth[_0xc25f('0x6')](),auth['canUpdate'](),controller[_0xc25f('0xc')]);router['get']('/restart',auth[_0xc25f('0x6')](),controller['restart']);router['get']('/migrations',controller['migrations']);module[_0xc25f('0xd')]=router; \ No newline at end of file +var _0x1d3f=['canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated'];(function(_0x208bc9,_0x4f36f6){var _0x2675a8=function(_0x452e72){while(--_0x452e72){_0x208bc9['push'](_0x208bc9['shift']());}};_0x2675a8(++_0x4f36f6);}(_0x1d3f,0x196));var _0xf1d3=function(_0x2cf062,_0x3c15c6){_0x2cf062=_0x2cf062-0x0;var _0x376203=_0x1d3f[_0x2cf062];return _0x376203;};'use strict';var express=require(_0xf1d3('0x0'));var router=express[_0xf1d3('0x1')]();var auth=require(_0xf1d3('0x2'));var controller=require(_0xf1d3('0x3'));router['get']('/',controller[_0xf1d3('0x4')]);router[_0xf1d3('0x5')](_0xf1d3('0x6'),auth[_0xf1d3('0x7')](),auth[_0xf1d3('0x8')](),controller[_0xf1d3('0x9')]);router[_0xf1d3('0x5')](_0xf1d3('0xa'),auth[_0xf1d3('0x7')](),auth[_0xf1d3('0x8')](),controller[_0xf1d3('0xb')]);router['get'](_0xf1d3('0xc'),auth['isAuthenticated'](),auth[_0xf1d3('0x8')](),controller[_0xf1d3('0xd')]);router[_0xf1d3('0x5')]('/restart',auth[_0xf1d3('0x7')](),controller[_0xf1d3('0xe')]);router[_0xf1d3('0x5')](_0xf1d3('0xf'),controller[_0xf1d3('0x10')]);module[_0xf1d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 243983d..476d67b 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 _0xa8d1=['../../config/logger','update','simple-git','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2'];(function(_0x11d6a7,_0xb9bc04){var _0x2fe61b=function(_0x365ff3){while(--_0x365ff3){_0x11d6a7['push'](_0x11d6a7['shift']());}};_0x2fe61b(++_0xb9bc04);}(_0xa8d1,0x17f));var _0x1a8d=function(_0x9d53fb,_0x4b898b){_0x9d53fb=_0x9d53fb-0x0;var _0x12f955=_0xa8d1[_0x9d53fb];return _0x12f955;};'use strict';var Umzug=require(_0x1a8d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x1a8d('0x1'));var pkginfo=require(_0x1a8d('0x2'))(module,_0x1a8d('0x3'));var compareVersions=require(_0x1a8d('0x4'));var exec=require(_0x1a8d('0x5'))[_0x1a8d('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x1a8d('0x7'));var pm2=require(_0x1a8d('0x8'));var logger=require(_0x1a8d('0x9'))(_0x1a8d('0xa'));var git=require(_0x1a8d('0xb'))(config['root']);exports['index']=function(_0x557f80,_0x5e1ab0){var _0x234aee={'current':module[_0x1a8d('0xc')]['version'],'phonebar':0x2};if(_0x557f80['query']&&_0x557f80[_0x1a8d('0xd')][_0x1a8d('0xe')]){return git[_0x1a8d('0xf')]()[_0x1a8d('0x10')](function(_0x2765ab,_0x76bcfe){_0x234aee['latest']=(_0x2765ab?module[_0x1a8d('0xc')][_0x1a8d('0x3')]:_0x76bcfe[_0x1a8d('0xe')])||_0x1a8d('0x11');return _0x5e1ab0[_0x1a8d('0x12')](0xc8)[_0x1a8d('0x13')](_0x234aee);});}else{return _0x5e1ab0[_0x1a8d('0x12')](0xc8)[_0x1a8d('0x13')](_0x234aee);}};exports[_0x1a8d('0xf')]=function(_0x36a866,_0x5efb8b){return git[_0x1a8d('0xf')](['origin',_0x1a8d('0x14')],function(_0x3daa0){if(_0x3daa0){logger[_0x1a8d('0x15')](_0x3daa0);return _0x5efb8b[_0x1a8d('0x12')](0x1f4)['json'](_0x3daa0);}logger['info'](_0x1a8d('0x16'));return _0x5efb8b[_0x1a8d('0x12')](0xc8)[_0x1a8d('0x13')]({'output':_0x1a8d('0x17')});});};exports[_0x1a8d('0x18')]=function(_0x4ab85f,_0x5d17ca){return git['reset']([_0x1a8d('0x19'),_0x1a8d('0x1a')],function(_0x59a7db){if(_0x59a7db){logger[_0x1a8d('0x15')](_0x59a7db);return _0x5d17ca[_0x1a8d('0x12')](0x1f4)[_0x1a8d('0x13')](_0x59a7db);}logger[_0x1a8d('0x1b')](_0x1a8d('0x1c'));return _0x5d17ca[_0x1a8d('0x12')](0xc8)[_0x1a8d('0x13')]({'output':_0x1a8d('0x1d')});});};exports[_0x1a8d('0x1e')]=function(_0x275f52,_0x240a60){exec(_0x1a8d('0x1f'),function(_0x20eca3,_0xe12dbf,_0x49cdc7){logger[_0x1a8d('0x1b')](_0xe12dbf);logger[_0x1a8d('0x1b')](_0x49cdc7);if(_0x20eca3){logger[_0x1a8d('0x15')](_0x20eca3);return _0x240a60[_0x1a8d('0x12')](0x1f4)['json'](_0x20eca3);}return _0x240a60[_0x1a8d('0x12')](0xc8)[_0x1a8d('0x13')]({'output':_0xe12dbf});});};exports[_0x1a8d('0x20')]=function(_0xb0ca99,_0x214c85){return pm2[_0x1a8d('0x20')](_0x1a8d('0x21'))[_0x1a8d('0x22')](function(_0x32cfec){logger[_0x1a8d('0x1b')](_0x1a8d('0x23'),_0x32cfec);return _0x214c85[_0x1a8d('0x12')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x1a8d('0x24')](function(_0x2d49ba){logger[_0x1a8d('0x15')](_0x2d49ba);return _0x214c85[_0x1a8d('0x12')](0x1f4)[_0x1a8d('0x13')](_0x2d49ba);});};exports[_0x1a8d('0x25')]=function(_0x54a69e,_0x582145){var _0x377632=fs[_0x1a8d('0x26')](path[_0x1a8d('0x27')](config[_0x1a8d('0x28')],_0x1a8d('0x29'),_0x1a8d('0x25')));var _0x135f48=[];for(var _0xc88672=0x0;_0xc88672<_0x377632[_0x1a8d('0x2a')];_0xc88672++){var _0x52108e=_0x377632[_0xc88672][_0x1a8d('0x2b')](_0x1a8d('0x2c'),'');if(compareVersions(module['exports'][_0x1a8d('0x3')],_0x52108e)===-0x1){_0x135f48[_0x1a8d('0x2d')](_0x52108e);}}if(_0x135f48['length']){var _0xc462aa=_0x135f48[_0x1a8d('0x2e')](compareVersions);var _0x70474=new Umzug({'storage':_0x1a8d('0x2f'),'storageOptions':{'model':db[_0x1a8d('0x30')],'modelName':_0x1a8d('0x30'),'columnName':_0x1a8d('0x3')},'migrations':{'params':[db[_0x1a8d('0x2f')][_0x1a8d('0x31')](),db[_0x1a8d('0x2f')][_0x1a8d('0x32')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],_0x1a8d('0x29'),_0x1a8d('0x25')),'pattern':/\.js$/}});_0x70474['up']({'migrations':_[_0x1a8d('0x33')](_0xc462aa,function(_0x9900aa){return _0x9900aa+_0x1a8d('0x2c');})})['then'](function(){return _0x582145[_0x1a8d('0x12')](0xc8)['json']({'output':_0x1a8d('0x34')+module[_0x1a8d('0xc')][_0x1a8d('0x3')]+_0x1a8d('0x35')+_['last'](_0xc462aa),'migrations':_[_0x1a8d('0x27')](_0xc462aa)});})[_0x1a8d('0x24')](function(_0x592025){if(_0x592025 instanceof db[_0x1a8d('0x2f')][_0x1a8d('0x36')]){return _0x582145['status'](0xc8)[_0x1a8d('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x582145[_0x1a8d('0x12')](0x1f4)[_0x1a8d('0x13')](_0x592025);}});}else{return _0x582145['status'](0xc8)['json']({'output':_0x1a8d('0x37')});}}; \ No newline at end of file +var _0x375a=['child_process','exec','../../mysqldb','../../config/pm2','simple-git','index','query','latest','fetch','tags','json','status','origin','master','error','info','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','server','length','replace','exports','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions'];(function(_0x3072eb,_0x455321){var _0x55db4b=function(_0x333eda){while(--_0x333eda){_0x3072eb['push'](_0x3072eb['shift']());}};_0x55db4b(++_0x455321);}(_0x375a,0x94));var _0xa375=function(_0x375239,_0x25af14){_0x375239=_0x375239-0x0;var _0x11e43b=_0x375a[_0x375239];return _0x11e43b;};'use strict';var Umzug=require(_0xa375('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xa375('0x1'));var pkginfo=require(_0xa375('0x2'))(module,_0xa375('0x3'));var compareVersions=require(_0xa375('0x4'));var exec=require(_0xa375('0x5'))[_0xa375('0x6')];var db=require(_0xa375('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xa375('0x8'));var logger=require('../../config/logger')('update');var git=require(_0xa375('0x9'))(config['root']);exports[_0xa375('0xa')]=function(_0x16ffef,_0x2340af){var _0x1a2d4d={'current':module['exports']['version'],'phonebar':0x2};if(_0x16ffef[_0xa375('0xb')]&&_0x16ffef[_0xa375('0xb')][_0xa375('0xc')]){return git[_0xa375('0xd')]()[_0xa375('0xe')](function(_0x85e4bd,_0x1ddf93){_0x1a2d4d[_0xa375('0xc')]=(_0x85e4bd?module['exports'][_0xa375('0x3')]:_0x1ddf93['latest'])||'2.0.0';return _0x2340af['status'](0xc8)[_0xa375('0xf')](_0x1a2d4d);});}else{return _0x2340af[_0xa375('0x10')](0xc8)[_0xa375('0xf')](_0x1a2d4d);}};exports[_0xa375('0xd')]=function(_0x5d6893,_0x4faf8b){return git['fetch']([_0xa375('0x11'),_0xa375('0x12')],function(_0x48da89){if(_0x48da89){logger[_0xa375('0x13')](_0x48da89);return _0x4faf8b[_0xa375('0x10')](0x1f4)[_0xa375('0xf')](_0x48da89);}logger[_0xa375('0x14')]('git\x20fetch');return _0x4faf8b['status'](0xc8)[_0xa375('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xa375('0x15')]=function(_0x3f68b9,_0xf12608){return git[_0xa375('0x15')]([_0xa375('0x16'),'FETCH_HEAD'],function(_0x4d4f14){if(_0x4d4f14){logger[_0xa375('0x13')](_0x4d4f14);return _0xf12608[_0xa375('0x10')](0x1f4)[_0xa375('0xf')](_0x4d4f14);}logger[_0xa375('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xf12608[_0xa375('0x10')](0xc8)[_0xa375('0xf')]({'output':_0xa375('0x17')});});};exports[_0xa375('0x18')]=function(_0x234656,_0x3b2207){exec(_0xa375('0x19'),function(_0x19ca2c,_0x541238,_0x780fa){logger[_0xa375('0x14')](_0x541238);logger[_0xa375('0x14')](_0x780fa);if(_0x19ca2c){logger[_0xa375('0x13')](_0x19ca2c);return _0x3b2207[_0xa375('0x10')](0x1f4)[_0xa375('0xf')](_0x19ca2c);}return _0x3b2207[_0xa375('0x10')](0xc8)[_0xa375('0xf')]({'output':_0x541238});});};exports[_0xa375('0x1a')]=function(_0x50f875,_0x302d2e){return pm2[_0xa375('0x1a')](_0xa375('0x1b'))[_0xa375('0x1c')](function(_0x4241c6){logger[_0xa375('0x14')](_0xa375('0x1d'),_0x4241c6);return _0x302d2e[_0xa375('0x10')](0xc8)['json']({'output':_0xa375('0x1e')});})['catch'](function(_0x2f73c1){logger['error'](_0x2f73c1);return _0x302d2e['status'](0x1f4)['json'](_0x2f73c1);});};exports[_0xa375('0x1f')]=function(_0x18ea9d,_0x188594){var _0x4f79ea=fs[_0xa375('0x20')](path[_0xa375('0x21')](config[_0xa375('0x22')],_0xa375('0x23'),_0xa375('0x1f')));var _0x4b500a=[];for(var _0x36f19e=0x0;_0x36f19e<_0x4f79ea[_0xa375('0x24')];_0x36f19e++){var _0x4c70d2=_0x4f79ea[_0x36f19e][_0xa375('0x25')]('.js','');if(compareVersions(module[_0xa375('0x26')][_0xa375('0x3')],_0x4c70d2)===-0x1){_0x4b500a[_0xa375('0x27')](_0x4c70d2);}}if(_0x4b500a[_0xa375('0x24')]){var _0x105845=_0x4b500a[_0xa375('0x28')](compareVersions);var _0x286c3d=new Umzug({'storage':_0xa375('0x29'),'storageOptions':{'model':db[_0xa375('0x2a')],'modelName':_0xa375('0x2a'),'columnName':_0xa375('0x3')},'migrations':{'params':[db[_0xa375('0x29')][_0xa375('0x2b')](),db[_0xa375('0x29')][_0xa375('0x2c')],function(){throw new Error(_0xa375('0x2d'));}],'path':path[_0xa375('0x21')](config['root'],'server',_0xa375('0x1f')),'pattern':/\.js$/}});_0x286c3d['up']({'migrations':_['map'](_0x105845,function(_0x1dd08c){return _0x1dd08c+_0xa375('0x2e');})})['then'](function(){return _0x188594[_0xa375('0x10')](0xc8)[_0xa375('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xa375('0x26')][_0xa375('0x3')]+_0xa375('0x2f')+_[_0xa375('0x30')](_0x105845),'migrations':_[_0xa375('0x21')](_0x105845)});})['catch'](function(_0x354512){if(_0x354512 instanceof db[_0xa375('0x29')][_0xa375('0x31')]){return _0x188594[_0xa375('0x10')](0xc8)['json']({'output':_0xa375('0x32')});}else{return _0x188594[_0xa375('0x10')](0x1f4)[_0xa375('0xf')](_0x354512);}});}else{return _0x188594['status'](0xc8)[_0xa375('0xf')]({'output':_0xa375('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9c18b18..22b4f19 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 _0x5f0d=['isAuthenticated','describe','create','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x4761de,_0x3ce271){var _0x354e5e=function(_0x13ab64){while(--_0x13ab64){_0x4761de['push'](_0x4761de['shift']());}};_0x354e5e(++_0x3ce271);}(_0x5f0d,0xb1));var _0xd5f0=function(_0x55ce7d,_0x532063){_0x55ce7d=_0x55ce7d-0x0;var _0x23762d=_0x5f0d[_0x55ce7d];return _0x23762d;};'use strict';var multer=require(_0xd5f0('0x0'));var util=require('util');var path=require(_0xd5f0('0x1'));var timeout=require(_0xd5f0('0x2'));var express=require('express');var router=express[_0xd5f0('0x3')]();var fs_extra=require(_0xd5f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd5f0('0x5'));var config=require(_0xd5f0('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xd5f0('0x7')]('/',auth['isAuthenticated'](),controller[_0xd5f0('0x8')]);router[_0xd5f0('0x7')](_0xd5f0('0x9'),auth[_0xd5f0('0xa')](),controller[_0xd5f0('0xb')]);router[_0xd5f0('0x7')]('/:id',auth[_0xd5f0('0xa')](),controller['show']);router['post']('/',auth[_0xd5f0('0xa')](),controller[_0xd5f0('0xc')]);router['put'](_0xd5f0('0xd'),auth[_0xd5f0('0xa')](),controller[_0xd5f0('0xe')]);router[_0xd5f0('0xf')](_0xd5f0('0xd'),auth[_0xd5f0('0xa')](),controller[_0xd5f0('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf06f=['/describe','isAuthenticated','describe','show','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get'];(function(_0x281ef6,_0x3059d1){var _0x4e967f=function(_0x2cd142){while(--_0x2cd142){_0x281ef6['push'](_0x281ef6['shift']());}};_0x4e967f(++_0x3059d1);}(_0xf06f,0x15f));var _0xff06=function(_0x2ecc32,_0x5e7bbd){_0x2ecc32=_0x2ecc32-0x0;var _0x4b6781=_0xf06f[_0x2ecc32];return _0x4b6781;};'use strict';var multer=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var path=require(_0xff06('0x2'));var timeout=require(_0xff06('0x3'));var express=require(_0xff06('0x4'));var router=express['Router']();var fs_extra=require(_0xff06('0x5'));var auth=require(_0xff06('0x6'));var interaction=require(_0xff06('0x7'));var config=require('../../config/environment');var controller=require(_0xff06('0x8'));router[_0xff06('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff06('0x9')](_0xff06('0xa'),auth[_0xff06('0xb')](),controller[_0xff06('0xc')]);router[_0xff06('0x9')]('/:id',auth[_0xff06('0xb')](),controller[_0xff06('0xd')]);router[_0xff06('0xe')]('/',auth['isAuthenticated'](),controller[_0xff06('0xf')]);router['put'](_0xff06('0x10'),auth[_0xff06('0xb')](),controller['update']);router[_0xff06('0x11')](_0xff06('0x10'),auth[_0xff06('0xb')](),controller[_0xff06('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index eb1de4f..bdc427d 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 _0xe1e3=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3fecaa,_0x1d041e){var _0x32e944=function(_0x557c85){while(--_0x557c85){_0x3fecaa['push'](_0x3fecaa['shift']());}};_0x32e944(++_0x1d041e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xa2283e,_0x4ab1ac){_0xa2283e=_0xa2283e-0x0;var _0x9bff84=_0xe1e3[_0xa2283e];return _0x9bff84;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3e1e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3e1e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3e1e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3e1e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3e1e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x3e1e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3e1e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3e1e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3e1e('0x5')]},'agentacw':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3e1e('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x3e1e('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3e1e('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e1e('0x2')]},'language':{'type':Sequelize[_0x3e1e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3e1e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x3e1e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3e1e('0x2')]},'destlanguage':{'type':Sequelize[_0x3e1e('0x2')]},'destaccountcode':{'type':Sequelize[_0x3e1e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e1e('0x2')]},'destuniqueid':{'type':Sequelize[_0x3e1e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x3e1e('0x2')]},'transfer':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3e1e('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3e1e('0x2')]},'agententerreason':{'type':Sequelize[_0x3e1e('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14b7=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0x14b7,0x144));var _0x714b=function(_0x593fa0,_0x23b388){_0x593fa0=_0x593fa0-0x0;var _0x452eee=_0x14b7[_0x593fa0];return _0x452eee;};'use strict';var Sequelize=require(_0x714b('0x0'));module[_0x714b('0x1')]={'type':{'type':Sequelize[_0x714b('0x2')]},'uniqueid':{'type':Sequelize[_0x714b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x714b('0x2')]},'queue':{'type':Sequelize[_0x714b('0x2')]},'interface':{'type':Sequelize[_0x714b('0x2')]},'membername':{'type':Sequelize[_0x714b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x714b('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x714b('0x3')]},'agentdumpAt':{'type':Sequelize[_0x714b('0x3')]},'holdtime':{'type':Sequelize[_0x714b('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x714b('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x714b('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x714b('0x4')]},'agentacw':{'type':Sequelize[_0x714b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x714b('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x714b('0x2')]},'channel':{'type':Sequelize[_0x714b('0x2')]},'channelstate':{'type':Sequelize[_0x714b('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x714b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x714b('0x2')]},'context':{'type':Sequelize[_0x714b('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x714b('0x2')]},'destchannel':{'type':Sequelize[_0x714b('0x2')]},'destchannelstate':{'type':Sequelize[_0x714b('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x714b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x714b('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x714b('0x2')]},'destlanguage':{'type':Sequelize[_0x714b('0x2')]},'destaccountcode':{'type':Sequelize[_0x714b('0x2')]},'destcontext':{'type':Sequelize[_0x714b('0x2')]},'destexten':{'type':Sequelize[_0x714b('0x2')]},'destpriority':{'type':Sequelize[_0x714b('0x2')]},'destuniqueid':{'type':Sequelize[_0x714b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x714b('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x714b('0x2')]},'transfer':{'type':Sequelize[_0x714b('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x714b('0x2')],'comment':_0x714b('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x714b('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 28f3e88..e3e05c3 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 24439ad..c79a3bf 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 _0x44e8=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x35f363,_0x50f60d){var _0x3f4b10=function(_0x39b7ba){while(--_0x39b7ba){_0x35f363['push'](_0x35f363['shift']());}};_0x3f4b10(++_0x50f60d);}(_0x44e8,0xd7));var _0x844e=function(_0x36c309,_0x137344){_0x36c309=_0x36c309-0x0;var _0x26fc18=_0x44e8[_0x36c309];return _0x26fc18;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x844e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7995('0xc'),_0x7995('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b5b9ead..492c211 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 _0xae9f=['VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport'];(function(_0x511717,_0x1d6fcc){var _0x529fa7=function(_0xd0ec09){while(--_0xd0ec09){_0x511717['push'](_0x511717['shift']());}};_0x529fa7(++_0x1d6fcc);}(_0xae9f,0x122));var _0xfae9=function(_0x56eaec,_0x70da79){_0x56eaec=_0x56eaec-0x0;var _0x3047c5=_0xae9f[_0x56eaec];return _0x3047c5;};'use strict';var _=require(_0xfae9('0x0'));var util=require(_0xfae9('0x1'));var moment=require(_0xfae9('0x2'));var BPromise=require(_0xfae9('0x3'));var rs=require(_0xfae9('0x4'));var fs=require('fs');var Redis=require(_0xfae9('0x5'));var db=require(_0xfae9('0x6'))['db'];var utils=require(_0xfae9('0x7'));var logger=require('../../config/logger')(_0xfae9('0x8'));var config=require(_0xfae9('0x9'));var jayson=require(_0xfae9('0xa'));var client=jayson[_0xfae9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c65ac,_0x5b31a4,_0x5a840b){return new BPromise(function(_0x49ddbc,_0x126d12){return client[_0xfae9('0xc')](_0x3c65ac,_0x5a840b)[_0xfae9('0xd')](function(_0x2ec959){logger[_0xfae9('0xe')](_0xfae9('0xf'),_0x5b31a4,'request\x20sent');logger['debug'](_0xfae9('0x10'),_0x5b31a4,'request\x20sent',JSON[_0xfae9('0x11')](_0x2ec959));if(_0x2ec959[_0xfae9('0x12')]){if(_0x2ec959[_0xfae9('0x12')][_0xfae9('0x13')]===0x1f4){logger[_0xfae9('0x12')](_0xfae9('0xf'),_0x5b31a4,_0x2ec959[_0xfae9('0x12')][_0xfae9('0x14')]);return _0x126d12(_0x2ec959[_0xfae9('0x12')]['message']);}logger[_0xfae9('0x12')](_0xfae9('0xf'),_0x5b31a4,_0x2ec959[_0xfae9('0x12')][_0xfae9('0x14')]);return _0x49ddbc(_0x2ec959[_0xfae9('0x12')][_0xfae9('0x14')]);}else{logger[_0xfae9('0xe')](_0xfae9('0xf'),_0x5b31a4,_0xfae9('0x15'));_0x49ddbc(_0x2ec959[_0xfae9('0x16')][_0xfae9('0x14')]);}})[_0xfae9('0x17')](function(_0x50cbbc){logger[_0xfae9('0x12')](_0xfae9('0xf'),_0x5b31a4,_0x50cbbc);_0x126d12(_0x50cbbc);});});}exports[_0xfae9('0x18')]=function(_0x10997c){var _0x5f5cee=this;return new Promise(function(_0x4bde7b,_0x1bca04){return db[_0xfae9('0x19')][_0xfae9('0x1a')](_0x10997c['body'],{'raw':_0x10997c[_0xfae9('0x1b')]?_0x10997c[_0xfae9('0x1b')][_0xfae9('0x1c')]===undefined?!![]:![]:!![]})[_0xfae9('0xd')](function(_0x4bb78e){logger[_0xfae9('0xe')](_0xfae9('0x18'),_0x10997c);logger[_0xfae9('0x1d')](_0xfae9('0x18'),_0x10997c,JSON['stringify'](_0x4bb78e));_0x4bde7b(_0x4bb78e);})['catch'](function(_0x227983){logger[_0xfae9('0x12')]('CreateVoiceAgentReport',_0x227983[_0xfae9('0x14')],_0x10997c);_0x1bca04(_0x5f5cee['error'](0x1f4,_0x227983[_0xfae9('0x14')]));});});};exports[_0xfae9('0x1e')]=function(_0x3a2dd9){var _0x853d1a=this;return new Promise(function(_0x237b75,_0x42b11c){return db[_0xfae9('0x19')][_0xfae9('0x1f')](_0x3a2dd9[_0xfae9('0x20')],{'raw':_0x3a2dd9[_0xfae9('0x1b')]?_0x3a2dd9[_0xfae9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a2dd9[_0xfae9('0x1b')]?_0x3a2dd9[_0xfae9('0x1b')][_0xfae9('0x21')]||null:null,'attributes':_0x3a2dd9[_0xfae9('0x1b')]?_0x3a2dd9[_0xfae9('0x1b')]['attributes']||null:null,'limit':_0x3a2dd9[_0xfae9('0x1b')]?_0x3a2dd9[_0xfae9('0x1b')][_0xfae9('0x22')]||null:null})[_0xfae9('0xd')](function(_0x44517d){logger[_0xfae9('0xe')](_0xfae9('0x1e'),_0x3a2dd9);logger[_0xfae9('0x1d')](_0xfae9('0x1e'),_0x3a2dd9,JSON['stringify'](_0x44517d));_0x237b75(_0x44517d);})[_0xfae9('0x17')](function(_0x34a9d8){logger[_0xfae9('0x12')](_0xfae9('0x1e'),_0x34a9d8[_0xfae9('0x14')],_0x3a2dd9);_0x42b11c(_0x853d1a[_0xfae9('0x12')](0x1f4,_0x34a9d8[_0xfae9('0x14')]));});});}; \ No newline at end of file +var _0x394d=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','then','UpdateVoiceAgentReport','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x394d,0xcd));var _0xd394=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x394d[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xd394('0x0'));var util=require(_0xd394('0x1'));var moment=require(_0xd394('0x2'));var BPromise=require(_0xd394('0x3'));var rs=require(_0xd394('0x4'));var fs=require('fs');var Redis=require(_0xd394('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd394('0x6'))(_0xd394('0x7'));var config=require(_0xd394('0x8'));var jayson=require(_0xd394('0x9'));var client=jayson[_0xd394('0xa')][_0xd394('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a4332,_0x1d4a0d,_0x30407e){return new BPromise(function(_0x2ce7d4,_0x30c299){return client['request'](_0x4a4332,_0x30407e)['then'](function(_0x4b8e73){logger[_0xd394('0xc')](_0xd394('0xd'),_0x1d4a0d,_0xd394('0xe'));logger[_0xd394('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1d4a0d,_0xd394('0xe'),JSON[_0xd394('0x10')](_0x4b8e73));if(_0x4b8e73[_0xd394('0x11')]){if(_0x4b8e73[_0xd394('0x11')][_0xd394('0x12')]===0x1f4){logger[_0xd394('0x11')](_0xd394('0xd'),_0x1d4a0d,_0x4b8e73[_0xd394('0x11')]['message']);return _0x30c299(_0x4b8e73['error'][_0xd394('0x13')]);}logger[_0xd394('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d4a0d,_0x4b8e73['error'][_0xd394('0x13')]);return _0x2ce7d4(_0x4b8e73[_0xd394('0x11')][_0xd394('0x13')]);}else{logger[_0xd394('0xc')](_0xd394('0xd'),_0x1d4a0d,_0xd394('0xe'));_0x2ce7d4(_0x4b8e73[_0xd394('0x14')][_0xd394('0x13')]);}})[_0xd394('0x15')](function(_0x3984e8){logger[_0xd394('0x11')](_0xd394('0xd'),_0x1d4a0d,_0x3984e8);_0x30c299(_0x3984e8);});});}exports[_0xd394('0x16')]=function(_0x52057a){var _0x26e68f=this;return new Promise(function(_0x5916e7,_0x3c92e2){return db[_0xd394('0x17')][_0xd394('0x18')](_0x52057a['body'],{'raw':_0x52057a[_0xd394('0x19')]?_0x52057a['options']['raw']===undefined?!![]:![]:!![]})[_0xd394('0x1a')](function(_0xd764cb){logger[_0xd394('0xc')](_0xd394('0x16'),_0x52057a);logger[_0xd394('0xf')](_0xd394('0x16'),_0x52057a,JSON[_0xd394('0x10')](_0xd764cb));_0x5916e7(_0xd764cb);})['catch'](function(_0x1ccc10){logger[_0xd394('0x11')](_0xd394('0x16'),_0x1ccc10[_0xd394('0x13')],_0x52057a);_0x3c92e2(_0x26e68f[_0xd394('0x11')](0x1f4,_0x1ccc10[_0xd394('0x13')]));});});};exports[_0xd394('0x1b')]=function(_0x4e9844){var _0x5a0c85=this;return new Promise(function(_0x3b1498,_0xb9f777){return db['VoiceAgentReport']['update'](_0x4e9844[_0xd394('0x1c')],{'raw':_0x4e9844[_0xd394('0x19')]?_0x4e9844['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9844[_0xd394('0x19')]?_0x4e9844['options']['where']||null:null,'attributes':_0x4e9844[_0xd394('0x19')]?_0x4e9844['options'][_0xd394('0x1d')]||null:null,'limit':_0x4e9844[_0xd394('0x19')]?_0x4e9844['options'][_0xd394('0x1e')]||null:null})[_0xd394('0x1a')](function(_0x596e1d){logger['info'](_0xd394('0x1b'),_0x4e9844);logger[_0xd394('0xf')]('UpdateVoiceAgentReport',_0x4e9844,JSON['stringify'](_0x596e1d));_0x3b1498(_0x596e1d);})[_0xd394('0x15')](function(_0x320519){logger[_0xd394('0x11')](_0xd394('0x1b'),_0x320519[_0xd394('0x13')],_0x4e9844);_0xb9f777(_0x5a0c85[_0xd394('0x11')](0x1f4,_0x320519['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1e38e00..14f3fc2 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 _0x5fd1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0xf0b45,_0x338ffb){var _0x571039=function(_0x294b9b){while(--_0x294b9b){_0xf0b45['push'](_0xf0b45['shift']());}};_0x571039(++_0x338ffb);}(_0x5fd1,0x155));var _0x15fd=function(_0x34be3c,_0xf5b2f2){_0x34be3c=_0x34be3c-0x0;var _0x52d57f=_0x5fd1[_0x34be3c];return _0x52d57f;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./voiceCallReport.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0x7')](_0x15fd('0xc'),auth['isAuthenticated'](),controller[_0x15fd('0xd')]);router['post']('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);router[_0x15fd('0x10')](_0x15fd('0xc'),auth[_0x15fd('0x8')](),controller[_0x15fd('0x11')]);module[_0x15fd('0x12')]=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','util','path','express','Router'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x20c0('0x9')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')]('/',auth[_0x20c0('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x20c0('0xf')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5649a35..1d29c33 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 _0x79b5=['outbound','inbound-fax','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal'];(function(_0x13d75b,_0x50f782){var _0x5723c7=function(_0x564471){while(--_0x564471){_0x13d75b['push'](_0x13d75b['shift']());}};_0x5723c7(++_0x50f782);}(_0x79b5,0x1bd));var _0x579b=function(_0x1e7563,_0x2ad814){_0x1e7563=_0x1e7563-0x0;var _0x974cae=_0x79b5[_0x1e7563];return _0x974cae;};'use strict';var Sequelize=require(_0x579b('0x0'));module[_0x579b('0x1')]={'uniqueid':{'type':Sequelize[_0x579b('0x2')]},'type':{'type':Sequelize[_0x579b('0x3')]('inbound',_0x579b('0x4'),_0x579b('0x5'),_0x579b('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x579b('0x2')]},'accountcode':{'type':Sequelize[_0x579b('0x2')]},'source':{'type':Sequelize[_0x579b('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x579b('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x579b('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x579b('0x7')]},'systemanswertime':{'type':Sequelize[_0x579b('0x7')]},'answertime':{'type':Sequelize[_0x579b('0x7')]},'endtime':{'type':Sequelize[_0x579b('0x7')]},'duration':{'type':Sequelize[_0x579b('0x8')]},'billableseconds':{'type':Sequelize[_0x579b('0x8')]},'mohtime':{'type':Sequelize[_0x579b('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x579b('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x579b('0x2')]},'userDisposition':{'type':Sequelize[_0x579b('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x579b('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x579b('0x2')]},'note':{'type':Sequelize[_0x579b('0x2')]},'prefix':{'type':Sequelize[_0x579b('0x2')]},'routeid':{'type':Sequelize[_0x579b('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe195=['dialer','TEXT','DATE','INTEGER','STRING','ENUM','inbound','internal','outbound','outbound-fax'];(function(_0x31bad1,_0x163160){var _0x30c64e=function(_0x1c0df5){while(--_0x1c0df5){_0x31bad1['push'](_0x31bad1['shift']());}};_0x30c64e(++_0x163160);}(_0xe195,0x1c6));var _0x5e19=function(_0x45a9be,_0x584397){_0x45a9be=_0x45a9be-0x0;var _0x1dbafb=_0xe195[_0x45a9be];return _0x1dbafb;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5e19('0x0')]},'type':{'type':Sequelize[_0x5e19('0x1')](_0x5e19('0x2'),_0x5e19('0x3'),_0x5e19('0x4'),'inbound-fax',_0x5e19('0x5'),_0x5e19('0x6'))},'tag':{'type':Sequelize[_0x5e19('0x0')]},'accountcode':{'type':Sequelize[_0x5e19('0x0')]},'source':{'type':Sequelize[_0x5e19('0x0')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x5e19('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5e19('0x0')]},'destinationchannel':{'type':Sequelize[_0x5e19('0x0')]},'lastapplication':{'type':Sequelize[_0x5e19('0x0')]},'lastdata':{'type':Sequelize[_0x5e19('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5e19('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5e19('0x8')]},'duration':{'type':Sequelize[_0x5e19('0x9')]},'billableseconds':{'type':Sequelize[_0x5e19('0x9')]},'mohtime':{'type':Sequelize[_0x5e19('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5e19('0x0')]},'amaflags':{'type':Sequelize[_0x5e19('0x0')]},'userfield':{'type':Sequelize[_0x5e19('0x0')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x5e19('0x0')]},'userThirdDisposition':{'type':Sequelize[_0x5e19('0x0')]},'note':{'type':Sequelize[_0x5e19('0x0')]},'prefix':{'type':Sequelize[_0x5e19('0x0')]},'routeid':{'type':Sequelize[_0x5e19('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index cda2ee4..de7f0d6 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x391def,_0x4b6469){_0x391def=_0x391def-0x0;var _0x2eb0d6=_0x5f2f[_0x391def];return _0x2eb0d6;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x2ef3,0xba));var _0x32ef=function(_0x29dac1,_0xce1f83){_0x29dac1=_0x29dac1-0x0;var _0x1f4e4b=_0x2ef3[_0x29dac1];return _0x1f4e4b;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 56e8afd..b1a30fc 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 _0xb223=['path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','moment','bluebird','request-promise'];(function(_0x342acf,_0x40770c){var _0xb95007=function(_0x4531bb){while(--_0x4531bb){_0x342acf['push'](_0x342acf['shift']());}};_0xb95007(++_0x40770c);}(_0xb223,0x194));var _0x3b22=function(_0x71c20a,_0x57fa92){_0x71c20a=_0x71c20a-0x0;var _0x5f09cd=_0xb223[_0x71c20a];return _0x5f09cd;};'use strict';var _=require('lodash');var util=require(_0x3b22('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3b22('0x1'));var BPromise=require(_0x3b22('0x2'));var rp=require(_0x3b22('0x3'));var fs=require('fs');var path=require(_0x3b22('0x4'));var rimraf=require(_0x3b22('0x5'));var config=require('../../config/environment');var attributes=require(_0x3b22('0x6'));module[_0x3b22('0x7')]=function(_0x4d91a8,_0x2d826a){return _0x4d91a8[_0x3b22('0x8')](_0x3b22('0x9'),attributes,{'tableName':_0x3b22('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3b22('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2df=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x1c0fc3,_0x3537bb){var _0x338237=function(_0x4ebb72){while(--_0x4ebb72){_0x1c0fc3['push'](_0x1c0fc3['shift']());}};_0x338237(++_0x3537bb);}(_0xc2df,0x197));var _0xfc2d=function(_0xf177bd,_0x5869d8){_0xf177bd=_0xf177bd-0x0;var _0x3319e1=_0xc2df[_0xf177bd];return _0x3319e1;};'use strict';var _=require(_0xfc2d('0x0'));var util=require(_0xfc2d('0x1'));var logger=require('../../config/logger')(_0xfc2d('0x2'));var moment=require(_0xfc2d('0x3'));var BPromise=require(_0xfc2d('0x4'));var rp=require(_0xfc2d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc2d('0x6'));var config=require(_0xfc2d('0x7'));var attributes=require(_0xfc2d('0x8'));module['exports']=function(_0x2ad876,_0x501529){return _0x2ad876['define'](_0xfc2d('0x9'),attributes,{'tableName':_0xfc2d('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfc2d('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 28ca529..09b0a84 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 _0xb147=['CreateVoiceCallReport','UpdateVoiceCallReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceCallReport','findAll','options','raw','attributes','include','map','model','debug','catch','VoiceCallReport','create'];(function(_0x1d77c8,_0x474bcf){var _0x3efd70=function(_0x116fa5){while(--_0x116fa5){_0x1d77c8['push'](_0x1d77c8['shift']());}};_0x3efd70(++_0x474bcf);}(_0xb147,0x1c2));var _0x7b14=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xb147[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x7b14('0x0'));var util=require(_0x7b14('0x1'));var moment=require(_0x7b14('0x2'));var BPromise=require(_0x7b14('0x3'));var rs=require(_0x7b14('0x4'));var fs=require('fs');var Redis=require(_0x7b14('0x5'));var db=require(_0x7b14('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b14('0x7'));var config=require(_0x7b14('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bad64,_0xa20cd6,_0x5e4cae){return new BPromise(function(_0x1937de,_0x4aafdf){return client[_0x7b14('0x9')](_0x2bad64,_0x5e4cae)[_0x7b14('0xa')](function(_0x21e05d){logger[_0x7b14('0xb')](_0x7b14('0xc'),_0xa20cd6,_0x7b14('0xd'));logger['debug'](_0x7b14('0xe'),_0xa20cd6,_0x7b14('0xd'),JSON[_0x7b14('0xf')](_0x21e05d));if(_0x21e05d[_0x7b14('0x10')]){if(_0x21e05d[_0x7b14('0x10')]['code']===0x1f4){logger[_0x7b14('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xa20cd6,_0x21e05d[_0x7b14('0x10')][_0x7b14('0x11')]);return _0x4aafdf(_0x21e05d['error'][_0x7b14('0x11')]);}logger[_0x7b14('0x10')](_0x7b14('0xc'),_0xa20cd6,_0x21e05d[_0x7b14('0x10')][_0x7b14('0x11')]);return _0x1937de(_0x21e05d[_0x7b14('0x10')]['message']);}else{logger[_0x7b14('0xb')](_0x7b14('0xc'),_0xa20cd6,'request\x20sent');_0x1937de(_0x21e05d[_0x7b14('0x12')][_0x7b14('0x11')]);}})['catch'](function(_0x587fc4){logger['error'](_0x7b14('0xc'),_0xa20cd6,_0x587fc4);_0x4aafdf(_0x587fc4);});});}exports[_0x7b14('0x13')]=function(_0x2e76fe){var _0x232d25=this;return new Promise(function(_0x500264,_0x365426){return db['VoiceCallReport'][_0x7b14('0x14')]({'raw':_0x2e76fe['options']?_0x2e76fe[_0x7b14('0x15')][_0x7b14('0x16')]===undefined?!![]:![]:!![],'where':_0x2e76fe[_0x7b14('0x15')]?_0x2e76fe[_0x7b14('0x15')]['where']||null:null,'attributes':_0x2e76fe[_0x7b14('0x15')]?_0x2e76fe[_0x7b14('0x15')][_0x7b14('0x17')]||null:null,'limit':_0x2e76fe['options']?_0x2e76fe[_0x7b14('0x15')]['limit']||null:null,'include':_0x2e76fe[_0x7b14('0x15')]?_0x2e76fe[_0x7b14('0x15')][_0x7b14('0x18')]?_[_0x7b14('0x19')](_0x2e76fe[_0x7b14('0x15')][_0x7b14('0x18')],function(_0x4a8283){return{'model':db[_0x4a8283['model']],'as':_0x4a8283['as'],'attributes':_0x4a8283[_0x7b14('0x17')],'include':_0x4a8283[_0x7b14('0x18')]?_[_0x7b14('0x19')](_0x4a8283[_0x7b14('0x18')],function(_0x16c53c){return{'model':db[_0x16c53c[_0x7b14('0x1a')]],'as':_0x16c53c['as'],'attributes':_0x16c53c[_0x7b14('0x17')],'include':_0x16c53c[_0x7b14('0x18')]?_[_0x7b14('0x19')](_0x16c53c[_0x7b14('0x18')],function(_0x5ccd36){return{'model':db[_0x5ccd36[_0x7b14('0x1a')]],'as':_0x5ccd36['as'],'attributes':_0x5ccd36[_0x7b14('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7b14('0xa')](function(_0x26133b){logger[_0x7b14('0xb')](_0x7b14('0x13'),_0x2e76fe);logger[_0x7b14('0x1b')](_0x7b14('0x13'),_0x2e76fe,JSON[_0x7b14('0xf')](_0x26133b));_0x500264(_0x26133b);})[_0x7b14('0x1c')](function(_0x2364f1){logger[_0x7b14('0x10')](_0x7b14('0x13'),_0x2364f1[_0x7b14('0x11')],_0x2e76fe);_0x365426(_0x232d25[_0x7b14('0x10')](0x1f4,_0x2364f1[_0x7b14('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x29e343){var _0x1bc8b8=this;return new Promise(function(_0x202898,_0x568583){return db[_0x7b14('0x1d')][_0x7b14('0x1e')](_0x29e343['body'],{'raw':_0x29e343[_0x7b14('0x15')]?_0x29e343[_0x7b14('0x15')][_0x7b14('0x16')]===undefined?!![]:![]:!![]})[_0x7b14('0xa')](function(_0x31111c){logger[_0x7b14('0xb')](_0x7b14('0x1f'),_0x29e343);logger['debug'](_0x7b14('0x1f'),_0x29e343,JSON[_0x7b14('0xf')](_0x31111c));_0x202898(_0x31111c);})[_0x7b14('0x1c')](function(_0x1b6799){logger[_0x7b14('0x10')](_0x7b14('0x1f'),_0x1b6799['message'],_0x29e343);_0x568583(_0x1bc8b8[_0x7b14('0x10')](0x1f4,_0x1b6799[_0x7b14('0x11')]));});});};exports[_0x7b14('0x20')]=function(_0x34ae9f){var _0x4c8fab=this;return new Promise(function(_0x23a141,_0x5b24dc){return db[_0x7b14('0x1d')][_0x7b14('0x21')](_0x34ae9f[_0x7b14('0x22')],{'raw':_0x34ae9f[_0x7b14('0x15')]?_0x34ae9f['options'][_0x7b14('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34ae9f[_0x7b14('0x15')]?_0x34ae9f['options'][_0x7b14('0x23')]||null:null,'attributes':_0x34ae9f[_0x7b14('0x15')]?_0x34ae9f[_0x7b14('0x15')][_0x7b14('0x17')]||null:null,'limit':_0x34ae9f[_0x7b14('0x15')]?_0x34ae9f[_0x7b14('0x15')][_0x7b14('0x24')]||null:null})[_0x7b14('0xa')](function(_0x20f52a){logger['info'](_0x7b14('0x20'),_0x34ae9f);logger[_0x7b14('0x1b')](_0x7b14('0x20'),_0x34ae9f,JSON[_0x7b14('0xf')](_0x20f52a));_0x23a141(_0x20f52a);})[_0x7b14('0x1c')](function(_0x4f939e){logger[_0x7b14('0x10')](_0x7b14('0x20'),_0x4f939e[_0x7b14('0x11')],_0x34ae9f);_0x5b24dc(_0x4c8fab[_0x7b14('0x10')](0x1f4,_0x4f939e['message']));});});}; \ No newline at end of file +var _0x7aca=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','then','GetVoiceCallReport','debug','stringify','catch','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7aca,0x67));var _0xa7ac=function(_0x1dcd38,_0x4199d0){_0x1dcd38=_0x1dcd38-0x0;var _0x5743c2=_0x7aca[_0x1dcd38];return _0x5743c2;};'use strict';var _=require(_0xa7ac('0x0'));var util=require(_0xa7ac('0x1'));var moment=require('moment');var BPromise=require(_0xa7ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7ac('0x3'));var db=require(_0xa7ac('0x4'))['db'];var utils=require(_0xa7ac('0x5'));var logger=require('../../config/logger')(_0xa7ac('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7ac('0x7'));var client=jayson['client'][_0xa7ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ad2a2,_0x34a266,_0xa3e230){return new BPromise(function(_0x2dea8f,_0x3d0fe2){return client[_0xa7ac('0x9')](_0x4ad2a2,_0xa3e230)['then'](function(_0x582795){logger[_0xa7ac('0xa')](_0xa7ac('0xb'),_0x34a266,'request\x20sent');logger['debug'](_0xa7ac('0xc'),_0x34a266,_0xa7ac('0xd'),JSON['stringify'](_0x582795));if(_0x582795[_0xa7ac('0xe')]){if(_0x582795[_0xa7ac('0xe')][_0xa7ac('0xf')]===0x1f4){logger[_0xa7ac('0xe')](_0xa7ac('0xb'),_0x34a266,_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);return _0x3d0fe2(_0x582795[_0xa7ac('0xe')]['message']);}logger[_0xa7ac('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x34a266,_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);return _0x2dea8f(_0x582795[_0xa7ac('0xe')][_0xa7ac('0x10')]);}else{logger[_0xa7ac('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x34a266,_0xa7ac('0xd'));_0x2dea8f(_0x582795['result']['message']);}})['catch'](function(_0x180376){logger[_0xa7ac('0xe')](_0xa7ac('0xb'),_0x34a266,_0x180376);_0x3d0fe2(_0x180376);});});}exports['GetVoiceCallReport']=function(_0x365c9d){var _0x396d4a=this;return new Promise(function(_0x44d16d,_0x4877e4){return db[_0xa7ac('0x11')][_0xa7ac('0x12')]({'raw':_0x365c9d[_0xa7ac('0x13')]?_0x365c9d[_0xa7ac('0x13')][_0xa7ac('0x14')]===undefined?!![]:![]:!![],'where':_0x365c9d[_0xa7ac('0x13')]?_0x365c9d[_0xa7ac('0x13')][_0xa7ac('0x15')]||null:null,'attributes':_0x365c9d[_0xa7ac('0x13')]?_0x365c9d[_0xa7ac('0x13')][_0xa7ac('0x16')]||null:null,'limit':_0x365c9d[_0xa7ac('0x13')]?_0x365c9d['options']['limit']||null:null,'include':_0x365c9d[_0xa7ac('0x13')]?_0x365c9d[_0xa7ac('0x13')]['include']?_[_0xa7ac('0x17')](_0x365c9d['options'][_0xa7ac('0x18')],function(_0x94d3c3){return{'model':db[_0x94d3c3[_0xa7ac('0x19')]],'as':_0x94d3c3['as'],'attributes':_0x94d3c3['attributes'],'include':_0x94d3c3[_0xa7ac('0x18')]?_['map'](_0x94d3c3['include'],function(_0xe120f2){return{'model':db[_0xe120f2[_0xa7ac('0x19')]],'as':_0xe120f2['as'],'attributes':_0xe120f2['attributes'],'include':_0xe120f2['include']?_[_0xa7ac('0x17')](_0xe120f2[_0xa7ac('0x18')],function(_0x5d41a6){return{'model':db[_0x5d41a6[_0xa7ac('0x19')]],'as':_0x5d41a6['as'],'attributes':_0x5d41a6[_0xa7ac('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa7ac('0x1a')](function(_0x3bad21){logger['info'](_0xa7ac('0x1b'),_0x365c9d);logger[_0xa7ac('0x1c')](_0xa7ac('0x1b'),_0x365c9d,JSON[_0xa7ac('0x1d')](_0x3bad21));_0x44d16d(_0x3bad21);})[_0xa7ac('0x1e')](function(_0x3cfb34){logger[_0xa7ac('0xe')]('GetVoiceCallReport',_0x3cfb34['message'],_0x365c9d);_0x4877e4(_0x396d4a[_0xa7ac('0xe')](0x1f4,_0x3cfb34['message']));});});};exports[_0xa7ac('0x1f')]=function(_0x1ba33d){var _0x5c3ca5=this;return new Promise(function(_0x4274e2,_0x1b4dd9){return db[_0xa7ac('0x11')][_0xa7ac('0x20')](_0x1ba33d['body'],{'raw':_0x1ba33d[_0xa7ac('0x13')]?_0x1ba33d[_0xa7ac('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xa7ac('0x1a')](function(_0x39d625){logger[_0xa7ac('0xa')]('CreateVoiceCallReport',_0x1ba33d);logger[_0xa7ac('0x1c')](_0xa7ac('0x1f'),_0x1ba33d,JSON['stringify'](_0x39d625));_0x4274e2(_0x39d625);})['catch'](function(_0x579ff3){logger['error'](_0xa7ac('0x1f'),_0x579ff3['message'],_0x1ba33d);_0x1b4dd9(_0x5c3ca5[_0xa7ac('0xe')](0x1f4,_0x579ff3[_0xa7ac('0x10')]));});});};exports[_0xa7ac('0x21')]=function(_0x50fe51){var _0x291bae=this;return new Promise(function(_0x4531ff,_0xd7c69d){return db[_0xa7ac('0x11')]['update'](_0x50fe51[_0xa7ac('0x22')],{'raw':_0x50fe51[_0xa7ac('0x13')]?_0x50fe51[_0xa7ac('0x13')][_0xa7ac('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50fe51['options']?_0x50fe51[_0xa7ac('0x13')]['where']||null:null,'attributes':_0x50fe51[_0xa7ac('0x13')]?_0x50fe51[_0xa7ac('0x13')]['attributes']||null:null,'limit':_0x50fe51['options']?_0x50fe51[_0xa7ac('0x13')]['limit']||null:null})['then'](function(_0x2b89a0){logger[_0xa7ac('0xa')](_0xa7ac('0x21'),_0x50fe51);logger[_0xa7ac('0x1c')](_0xa7ac('0x21'),_0x50fe51,JSON[_0xa7ac('0x1d')](_0x2b89a0));_0x4531ff(_0x2b89a0);})[_0xa7ac('0x1e')](function(_0xf054c){logger['error']('UpdateVoiceCallReport',_0xf054c['message'],_0x50fe51);_0xd7c69d(_0x291bae[_0xa7ac('0xe')](0x1f4,_0xf054c[_0xa7ac('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ec2c268..2a0b912 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 _0x1ada=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','show','post','isAuthenticated','create','update','destroy','exports','multer','util','path','express'];(function(_0x50667a,_0x86eb28){var _0x4987e5=function(_0x4482b1){while(--_0x4482b1){_0x50667a['push'](_0x50667a['shift']());}};_0x4987e5(++_0x86eb28);}(_0x1ada,0x1ea));var _0xa1ad=function(_0x14d53c,_0x3040f6){_0x14d53c=_0x14d53c-0x0;var _0x5522f2=_0x1ada[_0x14d53c];return _0x5522f2;};'use strict';var multer=require(_0xa1ad('0x0'));var util=require(_0xa1ad('0x1'));var path=require(_0xa1ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1ad('0x3'));var router=express[_0xa1ad('0x4')]();var fs_extra=require(_0xa1ad('0x5'));var auth=require(_0xa1ad('0x6'));var interaction=require(_0xa1ad('0x7'));var config=require(_0xa1ad('0x8'));var controller=require(_0xa1ad('0x9'));router[_0xa1ad('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa1ad('0xa')](_0xa1ad('0xb'),auth['isAuthenticated'](),controller[_0xa1ad('0xc')]);router[_0xa1ad('0xd')]('/',auth[_0xa1ad('0xe')](),controller[_0xa1ad('0xf')]);router['put']('/:id',auth[_0xa1ad('0xe')](),controller[_0xa1ad('0x10')]);router['delete'](_0xa1ad('0xb'),auth[_0xa1ad('0xe')](),controller[_0xa1ad('0x11')]);module[_0xa1ad('0x12')]=router; \ No newline at end of file +var _0x46f4=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46f4,0xe6));var _0x446f=function(_0x21444c,_0x12e8ad){_0x21444c=_0x21444c-0x0;var _0x5bbc48=_0x46f4[_0x21444c];return _0x5bbc48;};'use strict';var multer=require(_0x446f('0x0'));var util=require(_0x446f('0x1'));var path=require(_0x446f('0x2'));var timeout=require('connect-timeout');var express=require(_0x446f('0x3'));var router=express[_0x446f('0x4')]();var fs_extra=require(_0x446f('0x5'));var auth=require(_0x446f('0x6'));var interaction=require(_0x446f('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x446f('0x8')]('/',auth[_0x446f('0x9')](),controller[_0x446f('0xa')]);router[_0x446f('0x8')](_0x446f('0xb'),auth['isAuthenticated'](),controller[_0x446f('0xc')]);router[_0x446f('0xd')]('/',auth[_0x446f('0x9')](),controller['create']);router[_0x446f('0xe')](_0x446f('0xb'),auth[_0x446f('0x9')](),controller[_0x446f('0xf')]);router[_0x446f('0x10')]('/:id',auth[_0x446f('0x9')](),controller[_0x446f('0x11')]);module[_0x446f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b0a01bb..ee08051 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 _0x664f=['STRING','name','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x664f,0x139));var _0xf664=function(_0x5279cb,_0x1601be){_0x5279cb=_0x5279cb-0x0;var _0x55785a=_0x664f[_0x5279cb];return _0x55785a;};'use strict';var Sequelize=require(_0xf664('0x0'));module[_0xf664('0x1')]={'name':{'type':Sequelize[_0xf664('0x2')]},'prefix':{'type':Sequelize[_0xf664('0x2')],'unique':_0xf664('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf664('0x2')],'set':function(_0x42c971){this['setDataValue'](_0xf664('0x4'),_0x42c971?_0x42c971[_0xf664('0x5')](''):[]);},'get':function(){return this[_0xf664('0x6')](_0xf664('0x4'))?this[_0xf664('0x6')](_0xf664('0x4'))[_0xf664('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf664('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xf664('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf664('0x2')]},'description':{'type':Sequelize[_0xf664('0x2')]}}; \ No newline at end of file +var _0x325d=['getDataValue','BOOLEAN','exports','STRING','setDataValue','options','join'];(function(_0x204910,_0x28cbbb){var _0x4db9cd=function(_0x326232){while(--_0x326232){_0x204910['push'](_0x204910['shift']());}};_0x4db9cd(++_0x28cbbb);}(_0x325d,0x167));var _0xd325=function(_0xef9210,_0x57bc5){_0xef9210=_0xef9210-0x0;var _0x5c24c5=_0x325d[_0xef9210];return _0x5c24c5;};'use strict';var Sequelize=require('sequelize');module[_0xd325('0x0')]={'name':{'type':Sequelize[_0xd325('0x1')]},'prefix':{'type':Sequelize[_0xd325('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xd325('0x1')],'set':function(_0xcc5ec9){this[_0xd325('0x2')](_0xd325('0x3'),_0xcc5ec9?_0xcc5ec9[_0xd325('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xd325('0x5')](_0xd325('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xd325('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xd325('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd325('0x1')]},'description':{'type':Sequelize[_0xd325('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6df975e..b363cfe 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 _0x24cd=['undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x45fe0c,_0x4a0487){var _0x3d2d84=function(_0x469f63){while(--_0x469f63){_0x45fe0c['push'](_0x45fe0c['shift']());}};_0x3d2d84(++_0x4a0487);}(_0x24cd,0x83));var _0xd24c=function(_0x4f481d,_0x53d186){_0x4f481d=_0x4f481d-0x0;var _0x42ec70=_0x24cd[_0x4f481d];return _0x42ec70;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd24c('0x2'));var rp=require('request-promise');var moment=require(_0xd24c('0x3'));var BPromise=require(_0xd24c('0x4'));var Mustache=require(_0xd24c('0x5'));var util=require('util');var path=require(_0xd24c('0x6'));var sox=require(_0xd24c('0x7'));var csv=require('to-csv');var ejs=require(_0xd24c('0x8'));var fs=require('fs');var fs_extra=require(_0xd24c('0x9'));var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0x10'));var authService=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var as=require(_0xd24c('0x13'));var hardwareService=require(_0xd24c('0x14'));var logger=require(_0xd24c('0x15'))(_0xd24c('0x16'));var utils=require(_0xd24c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x18'));var db=require(_0xd24c('0x19'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x1a')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1b')](_0x3296ea)[_0xd24c('0x1c')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1d')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=typeof _0x528489[_0xd24c('0x1e')]===_0xd24c('0x1f')&&typeof _0x528489['limit']==='undefined';var _0xc87bb7=_0x34aa92[_0xd24c('0x20')];var _0x170d59=_0x3aa193?0x0:_0x528489['offset'];var _0x9f2d2d=_0x3aa193?_0x34aa92[_0xd24c('0x20')]:_0x528489[_0xd24c('0x1e')]+_0x528489[_0xd24c('0x21')];var _0x478a0f;if(_0x9f2d2d>=_0xc87bb7){_0x9f2d2d=_0xc87bb7;_0x478a0f=0xc8;}else{_0x478a0f=0xce;}_0xe096c[_0xd24c('0x1b')](_0x478a0f);return _0xe096c['set'](_0xd24c('0x22'),_0x170d59+'-'+_0x9f2d2d+'/'+_0xc87bb7)[_0xd24c('0x1d')](_0x34aa92);}return null;};}function patchUpdates(_0x1b3a2f){return function(_0x38c380){try{jsonpatch[_0xd24c('0x23')](_0x38c380,_0x1b3a2f,!![]);}catch(_0x4964e5){return BPromise[_0xd24c('0x24')](_0x4964e5);}return _0x38c380[_0xd24c('0x25')]();};}function saveUpdates(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')](_0x17375b)[_0xd24c('0x27')](function(_0x2549d0){return _0x2549d0;});}return null;};}function removeEntity(_0x5c862f,_0x44471f){return function(_0x2c3328){if(_0x2c3328){return _0x2c3328[_0xd24c('0x28')]()['then'](function(){var _0x4539e7=_0x2c3328[_0xd24c('0x29')]({'plain':!![]});var _0x848e0e=_0xd24c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x848e0e,'resourceId':_0x4539e7['id']}})[_0xd24c('0x27')](function(){return _0x2c3328;});})['then'](function(){_0x5c862f[_0xd24c('0x1b')](0xcc)[_0xd24c('0x1c')]();});}};}function handleEntityNotFound(_0x325fcc,_0x4c0d99){return function(_0x4cb1b3){if(!_0x4cb1b3){_0x325fcc[_0xd24c('0x1a')](0x194);}return _0x4cb1b3;};}function handleError(_0x14d44a,_0x1a18b7){_0x1a18b7=_0x1a18b7||0x1f4;return function(_0x160f03){logger[_0xd24c('0x2b')](_0x160f03[_0xd24c('0x2c')]);if(_0x160f03[_0xd24c('0x2d')]){delete _0x160f03[_0xd24c('0x2d')];}_0x14d44a[_0xd24c('0x1b')](_0x1a18b7)[_0xd24c('0x2e')](_0x160f03);};}exports[_0xd24c('0x2f')]=function(_0x59cbb6,_0x4e128b){var _0x305e90={},_0x445bc6={},_0x1dc70b={'count':0x0,'rows':[]};var _0x56260c=_['map'](db[_0xd24c('0x30')][_0xd24c('0x31')],function(_0x34a64c){return{'name':_0x34a64c[_0xd24c('0x32')],'type':_0x34a64c['type'][_0xd24c('0x33')]};});_0x445bc6[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x56260c,_0xd24c('0x2d'));_0x445bc6[_0xd24c('0x36')]=_[_0xd24c('0x37')](_0x59cbb6[_0xd24c('0x36')]);_0x445bc6[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x445bc6['model'],_0x445bc6[_0xd24c('0x36')]);_0x305e90['attributes']=_['intersection'](_0x445bc6[_0xd24c('0x34')],qs[_0xd24c('0x3a')](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x305e90[_0xd24c('0x3b')]=_0x305e90[_0xd24c('0x3b')][_0xd24c('0x3c')]?_0x305e90['attributes']:_0x445bc6[_0xd24c('0x34')];if(!_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3d')](_0xd24c('0x3e'))){_0x305e90[_0xd24c('0x21')]=qs[_0xd24c('0x21')](_0x59cbb6['query'][_0xd24c('0x21')]);_0x305e90[_0xd24c('0x1e')]=qs['offset'](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x1e')]);}_0x305e90['order']=qs[_0xd24c('0x3f')](_0x59cbb6[_0xd24c('0x36')]['sort']);_0x305e90[_0xd24c('0x40')]=qs[_0xd24c('0x38')](_[_0xd24c('0x41')](_0x59cbb6[_0xd24c('0x36')],_0x445bc6['filters']),_0x56260c);if(_0x59cbb6[_0xd24c('0x36')]['filter']){_0x305e90[_0xd24c('0x40')]=_['merge'](_0x305e90['where'],{'$or':_['map'](_0x56260c,function(_0x4160fb){if(_0x4160fb['type']!=='VIRTUAL'){var _0x66f45={};_0x66f45[_0x4160fb[_0xd24c('0x2d')]]={'$like':'%'+_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x42')]+'%'};return _0x66f45;}})});}_0x305e90=_['merge']({},_0x305e90,_0x59cbb6[_0xd24c('0x43')]);var _0x54a924={'where':_0x305e90[_0xd24c('0x40')]};return db[_0xd24c('0x30')][_0xd24c('0x20')](_0x54a924)[_0xd24c('0x27')](function(_0x27eefa){_0x1dc70b[_0xd24c('0x20')]=_0x27eefa;if(_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x44')]){_0x305e90[_0xd24c('0x45')]=[{'all':!![]}];}return db[_0xd24c('0x30')]['findAll'](_0x305e90);})[_0xd24c('0x27')](function(_0x742082){_0x1dc70b['rows']=_0x742082;return _0x1dc70b;})[_0xd24c('0x27')](respondWithFilteredResult(_0x4e128b,_0x305e90))[_0xd24c('0x46')](handleError(_0x4e128b,null));};exports['show']=function(_0x2f2981,_0x5d91fe){var _0x39cd94={'raw':![],'where':{'id':_0x2f2981[_0xd24c('0x47')]['id']}},_0x2d46b8={};_0x2d46b8[_0xd24c('0x34')]=_[_0xd24c('0x37')](db['VoiceChanSpy'][_0xd24c('0x31')]);_0x2d46b8['query']=_[_0xd24c('0x37')](_0x2f2981['query']);_0x2d46b8[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x2d46b8['model'],_0x2d46b8[_0xd24c('0x36')]);_0x39cd94[_0xd24c('0x3b')]=_['intersection'](_0x2d46b8[_0xd24c('0x34')],qs['fields'](_0x2f2981['query']['fields']));_0x39cd94[_0xd24c('0x3b')]=_0x39cd94[_0xd24c('0x3b')]['length']?_0x39cd94['attributes']:_0x2d46b8[_0xd24c('0x34')];if(_0x2f2981[_0xd24c('0x36')][_0xd24c('0x44')]){_0x39cd94[_0xd24c('0x45')]=[{'all':!![]}];}_0x39cd94=_['merge']({},_0x39cd94,_0x2f2981[_0xd24c('0x43')]);return db[_0xd24c('0x30')]['find'](_0x39cd94)[_0xd24c('0x27')](handleEntityNotFound(_0x5d91fe,null))[_0xd24c('0x27')](respondWithResult(_0x5d91fe,null))[_0xd24c('0x46')](handleError(_0x5d91fe,null));};exports['create']=function(_0x3039aa,_0x4b10c6){return db[_0xd24c('0x30')][_0xd24c('0x48')](_0x3039aa[_0xd24c('0x49')],{})[_0xd24c('0x27')](function(_0x47d5ce){var _0x14684c=_0x3039aa[_0xd24c('0x4a')][_0xd24c('0x29')]({'plain':!![]});if(!_0x14684c)throw new Error(_0xd24c('0x4b'));if(_0x14684c[_0xd24c('0x4c')]===_0xd24c('0x4a')){var _0x3ce7d0=_0x47d5ce[_0xd24c('0x29')]({'plain':!![]});var _0x47067c=_0xd24c('0x2a');return db[_0xd24c('0x4d')]['find']({'where':{'name':_0x47067c,'userProfileId':_0x14684c[_0xd24c('0x4e')]},'raw':!![]})[_0xd24c('0x27')](function(_0x48f011){if(_0x48f011&&_0x48f011['autoAssociation']===0x0){return db['UserProfileResource'][_0xd24c('0x48')]({'name':_0x3ce7d0[_0xd24c('0x2d')],'resourceId':_0x3ce7d0['id'],'type':_0x48f011[_0xd24c('0x2d')],'sectionId':_0x48f011['id']},{})[_0xd24c('0x27')](function(){return _0x47d5ce;});}else{return _0x47d5ce;}})[_0xd24c('0x46')](function(_0x2ea05a){logger[_0xd24c('0x2b')](_0xd24c('0x4f'),_0x2ea05a);throw _0x2ea05a;});}return _0x47d5ce;})[_0xd24c('0x27')](respondWithResult(_0x4b10c6,0xc9))[_0xd24c('0x46')](handleError(_0x4b10c6,null));};exports[_0xd24c('0x26')]=function(_0x4fbb0b,_0x3a8e76){if(_0x4fbb0b[_0xd24c('0x49')]['id']){delete _0x4fbb0b['body']['id'];}return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x4fbb0b[_0xd24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a8e76,null))['then'](saveUpdates(_0x4fbb0b[_0xd24c('0x49')],null))[_0xd24c('0x27')](respondWithResult(_0x3a8e76,null))[_0xd24c('0x46')](handleError(_0x3a8e76,null));};exports[_0xd24c('0x28')]=function(_0x148685,_0x3dee09){return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x148685['params']['id']}})[_0xd24c('0x27')](handleEntityNotFound(_0x3dee09,null))['then'](removeEntity(_0x3dee09,null))['catch'](handleError(_0x3dee09,null));}; \ No newline at end of file +var _0x8164=['save','update','then','destroy','get','ChanSpies','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x4f77dc,_0x2ef0c1){var _0xb9053=function(_0x369773){while(--_0x369773){_0x4f77dc['push'](_0x4f77dc['shift']());}};_0xb9053(++_0x2ef0c1);}(_0x8164,0x170));var _0x4816=function(_0x40b241,_0x2ce6cc){_0x40b241=_0x40b241-0x0;var _0x22b4b1=_0x8164[_0x40b241];return _0x22b4b1;};'use strict';var emlformat=require(_0x4816('0x0'));var rimraf=require(_0x4816('0x1'));var zipdir=require(_0x4816('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4816('0x3'));var moment=require(_0x4816('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4816('0x5'));var util=require('util');var path=require(_0x4816('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4816('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4816('0x8'));var crypto=require(_0x4816('0x9'));var jsforce=require(_0x4816('0xa'));var deskjs=require(_0x4816('0xb'));var toCsv=require(_0x4816('0xc'));var querystring=require(_0x4816('0xd'));var Papa=require(_0x4816('0xe'));var Redis=require(_0x4816('0xf'));var authService=require(_0x4816('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4816('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4816('0x12'))(_0x4816('0x13'));var utils=require('../../config/utils');var config=require(_0x4816('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c173b,_0x51a5f8){_0x51a5f8=_0x51a5f8||0xcc;return function(_0x5c4d42){if(_0x5c4d42){return _0x3c173b[_0x4816('0x15')](_0x51a5f8);}return _0x3c173b['status'](_0x51a5f8)[_0x4816('0x16')]();};}function respondWithResult(_0x2554b4,_0x13a685){_0x13a685=_0x13a685||0xc8;return function(_0x316f36){if(_0x316f36){return _0x2554b4[_0x4816('0x17')](_0x13a685)[_0x4816('0x18')](_0x316f36);}};}function respondWithFilteredResult(_0x1eb683,_0x2a58b7){return function(_0x45c006){if(_0x45c006){var _0x21354c=typeof _0x2a58b7[_0x4816('0x19')]===_0x4816('0x1a')&&typeof _0x2a58b7[_0x4816('0x1b')]===_0x4816('0x1a');var _0x1961a5=_0x45c006[_0x4816('0x1c')];var _0x4803d0=_0x21354c?0x0:_0x2a58b7['offset'];var _0x8d4393=_0x21354c?_0x45c006[_0x4816('0x1c')]:_0x2a58b7[_0x4816('0x19')]+_0x2a58b7[_0x4816('0x1b')];var _0xc8ffd5;if(_0x8d4393>=_0x1961a5){_0x8d4393=_0x1961a5;_0xc8ffd5=0xc8;}else{_0xc8ffd5=0xce;}_0x1eb683[_0x4816('0x17')](_0xc8ffd5);return _0x1eb683[_0x4816('0x1d')](_0x4816('0x1e'),_0x4803d0+'-'+_0x8d4393+'/'+_0x1961a5)[_0x4816('0x18')](_0x45c006);}return null;};}function patchUpdates(_0x53189e){return function(_0x1ab50d){try{jsonpatch['apply'](_0x1ab50d,_0x53189e,!![]);}catch(_0x521472){return BPromise[_0x4816('0x1f')](_0x521472);}return _0x1ab50d[_0x4816('0x20')]();};}function saveUpdates(_0x5de184,_0x2bbaf4){return function(_0x576221){if(_0x576221){return _0x576221[_0x4816('0x21')](_0x5de184)[_0x4816('0x22')](function(_0x571c81){return _0x571c81;});}return null;};}function removeEntity(_0x504851,_0xe484b2){return function(_0x2c8dc4){if(_0x2c8dc4){return _0x2c8dc4[_0x4816('0x23')]()['then'](function(){var _0x9b1a4c=_0x2c8dc4[_0x4816('0x24')]({'plain':!![]});var _0x126c60=_0x4816('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x126c60,'resourceId':_0x9b1a4c['id']}})[_0x4816('0x22')](function(){return _0x2c8dc4;});})[_0x4816('0x22')](function(){_0x504851['status'](0xcc)[_0x4816('0x16')]();});}};}function handleEntityNotFound(_0x4f9386,_0x551d15){return function(_0x386a16){if(!_0x386a16){_0x4f9386[_0x4816('0x15')](0x194);}return _0x386a16;};}function handleError(_0x2d8514,_0x5a1e61){_0x5a1e61=_0x5a1e61||0x1f4;return function(_0xbeb8fb){logger['error'](_0xbeb8fb[_0x4816('0x26')]);if(_0xbeb8fb[_0x4816('0x27')]){delete _0xbeb8fb['name'];}_0x2d8514[_0x4816('0x17')](_0x5a1e61)[_0x4816('0x28')](_0xbeb8fb);};}exports[_0x4816('0x29')]=function(_0x17037a,_0x1ba256){var _0x332af7={},_0x2e9a77={},_0x327a07={'count':0x0,'rows':[]};var _0x11ba1a=_['map'](db[_0x4816('0x2a')][_0x4816('0x2b')],function(_0x56ed76){return{'name':_0x56ed76['fieldName'],'type':_0x56ed76[_0x4816('0x2c')][_0x4816('0x2d')]};});_0x2e9a77[_0x4816('0x2e')]=_[_0x4816('0x2f')](_0x11ba1a,_0x4816('0x27'));_0x2e9a77['query']=_['keys'](_0x17037a['query']);_0x2e9a77[_0x4816('0x30')]=_[_0x4816('0x31')](_0x2e9a77[_0x4816('0x2e')],_0x2e9a77[_0x4816('0x32')]);_0x332af7[_0x4816('0x33')]=_[_0x4816('0x31')](_0x2e9a77['model'],qs[_0x4816('0x34')](_0x17037a['query'][_0x4816('0x34')]));_0x332af7[_0x4816('0x33')]=_0x332af7[_0x4816('0x33')][_0x4816('0x35')]?_0x332af7[_0x4816('0x33')]:_0x2e9a77['model'];if(!_0x17037a[_0x4816('0x32')]['hasOwnProperty']('nolimit')){_0x332af7[_0x4816('0x1b')]=qs['limit'](_0x17037a['query']['limit']);_0x332af7['offset']=qs[_0x4816('0x19')](_0x17037a[_0x4816('0x32')]['offset']);}_0x332af7[_0x4816('0x36')]=qs[_0x4816('0x37')](_0x17037a['query'][_0x4816('0x37')]);_0x332af7[_0x4816('0x38')]=qs[_0x4816('0x30')](_[_0x4816('0x39')](_0x17037a['query'],_0x2e9a77[_0x4816('0x30')]),_0x11ba1a);if(_0x17037a[_0x4816('0x32')][_0x4816('0x3a')]){_0x332af7[_0x4816('0x38')]=_[_0x4816('0x3b')](_0x332af7[_0x4816('0x38')],{'$or':_[_0x4816('0x2f')](_0x11ba1a,function(_0x1ef378){if(_0x1ef378[_0x4816('0x2c')]!==_0x4816('0x3c')){var _0xcbded0={};_0xcbded0[_0x1ef378[_0x4816('0x27')]]={'$like':'%'+_0x17037a[_0x4816('0x32')]['filter']+'%'};return _0xcbded0;}})});}_0x332af7=_[_0x4816('0x3b')]({},_0x332af7,_0x17037a[_0x4816('0x3d')]);var _0x4cbb05={'where':_0x332af7[_0x4816('0x38')]};return db[_0x4816('0x2a')][_0x4816('0x1c')](_0x4cbb05)[_0x4816('0x22')](function(_0x5d441a){_0x327a07[_0x4816('0x1c')]=_0x5d441a;if(_0x17037a['query']['includeAll']){_0x332af7[_0x4816('0x3e')]=[{'all':!![]}];}return db[_0x4816('0x2a')]['findAll'](_0x332af7);})[_0x4816('0x22')](function(_0x432bce){_0x327a07[_0x4816('0x3f')]=_0x432bce;return _0x327a07;})['then'](respondWithFilteredResult(_0x1ba256,_0x332af7))[_0x4816('0x40')](handleError(_0x1ba256,null));};exports[_0x4816('0x41')]=function(_0x178e62,_0xdec91c){var _0x40115d={'raw':![],'where':{'id':_0x178e62['params']['id']}},_0x39c713={};_0x39c713[_0x4816('0x2e')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x39c713[_0x4816('0x32')]=_[_0x4816('0x42')](_0x178e62[_0x4816('0x32')]);_0x39c713[_0x4816('0x30')]=_[_0x4816('0x31')](_0x39c713[_0x4816('0x2e')],_0x39c713[_0x4816('0x32')]);_0x40115d[_0x4816('0x33')]=_[_0x4816('0x31')](_0x39c713[_0x4816('0x2e')],qs['fields'](_0x178e62['query'][_0x4816('0x34')]));_0x40115d[_0x4816('0x33')]=_0x40115d[_0x4816('0x33')][_0x4816('0x35')]?_0x40115d[_0x4816('0x33')]:_0x39c713[_0x4816('0x2e')];if(_0x178e62[_0x4816('0x32')][_0x4816('0x43')]){_0x40115d['include']=[{'all':!![]}];}_0x40115d=_[_0x4816('0x3b')]({},_0x40115d,_0x178e62[_0x4816('0x3d')]);return db[_0x4816('0x2a')]['find'](_0x40115d)['then'](handleEntityNotFound(_0xdec91c,null))[_0x4816('0x22')](respondWithResult(_0xdec91c,null))[_0x4816('0x40')](handleError(_0xdec91c,null));};exports[_0x4816('0x44')]=function(_0x5d8b92,_0x247adb){return db[_0x4816('0x2a')][_0x4816('0x44')](_0x5d8b92[_0x4816('0x45')],{})[_0x4816('0x22')](function(_0x4401c6){var _0xbc898a=_0x5d8b92['user'][_0x4816('0x24')]({'plain':!![]});if(!_0xbc898a)throw new Error(_0x4816('0x46'));if(_0xbc898a[_0x4816('0x47')]===_0x4816('0x48')){var _0x158127=_0x4401c6[_0x4816('0x24')]({'plain':!![]});var _0x309778=_0x4816('0x25');return db[_0x4816('0x49')][_0x4816('0x4a')]({'where':{'name':_0x309778,'userProfileId':_0xbc898a[_0x4816('0x4b')]},'raw':!![]})[_0x4816('0x22')](function(_0x2b2f24){if(_0x2b2f24&&_0x2b2f24[_0x4816('0x4c')]===0x0){return db[_0x4816('0x4d')][_0x4816('0x44')]({'name':_0x158127[_0x4816('0x27')],'resourceId':_0x158127['id'],'type':_0x2b2f24[_0x4816('0x27')],'sectionId':_0x2b2f24['id']},{})[_0x4816('0x22')](function(){return _0x4401c6;});}else{return _0x4401c6;}})[_0x4816('0x40')](function(_0x1702bf){logger[_0x4816('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1702bf);throw _0x1702bf;});}return _0x4401c6;})[_0x4816('0x22')](respondWithResult(_0x247adb,0xc9))[_0x4816('0x40')](handleError(_0x247adb,null));};exports['update']=function(_0x3604e6,_0xa2a654){if(_0x3604e6[_0x4816('0x45')]['id']){delete _0x3604e6[_0x4816('0x45')]['id'];}return db[_0x4816('0x2a')][_0x4816('0x4a')]({'where':{'id':_0x3604e6[_0x4816('0x4f')]['id']}})[_0x4816('0x22')](handleEntityNotFound(_0xa2a654,null))[_0x4816('0x22')](saveUpdates(_0x3604e6[_0x4816('0x45')],null))['then'](respondWithResult(_0xa2a654,null))[_0x4816('0x40')](handleError(_0xa2a654,null));};exports['destroy']=function(_0x440ba5,_0x199363){return db['VoiceChanSpy'][_0x4816('0x4a')]({'where':{'id':_0x440ba5[_0x4816('0x4f')]['id']}})[_0x4816('0x22')](handleEntityNotFound(_0x199363,null))[_0x4816('0x22')](removeEntity(_0x199363,null))[_0x4816('0x40')](handleError(_0x199363,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2d6a9f1..e4771cf 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 _0x963f=['name','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','util','context','from-sip','%s%s','prefix','merge','format','push','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','length','concat','internal'];(function(_0xcdbfbe,_0x46e396){var _0xf21616=function(_0x50aade){while(--_0x50aade){_0xcdbfbe['push'](_0xcdbfbe['shift']());}};_0xf21616(++_0x46e396);}(_0x963f,0x135));var _0xf963=function(_0x27d6ff,_0x1f507c){_0x27d6ff=_0x27d6ff-0x0;var _0x9239aa=_0x963f[_0x27d6ff];return _0x9239aa;};'use strict';var _=require('lodash');var util=require(_0xf963('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1fad9,_0x1b8d88,_0x10bf62){var _0x587353=0x1;var _0x5aead0=[];var _0x121d98={'context':_0x1b8d88[_0xf963('0x1')]||_0xf963('0x2'),'exten':util['format'](_0xf963('0x3'),_0x1fad9[_0xf963('0x4')],_0x10bf62),'type':'system','isApp':![],'ChanSpyId':_0x1fad9['id'],'UserId':_0x1b8d88['id']};_0x5aead0['push'](_[_0xf963('0x5')]({'app':'Set','appdata':util[_0xf963('0x6')]('CDR(type)=%s','chanspy'),'priority':_0x587353++},_0x121d98));if(_0x1fad9['record']){_0x5aead0[_0xf963('0x7')](_[_0xf963('0x5')]({'app':'MixMonitor','appdata':util[_0xf963('0x6')](_0xf963('0x8'),_0x1fad9[_0xf963('0x9')]),'priority':_0x587353++},_0x121d98));}if(_0x1fad9[_0xf963('0xa')]){_0x5aead0[_0xf963('0x7')](_[_0xf963('0x5')]({'app':_0xf963('0xb'),'appdata':_0x1fad9[_0xf963('0xc')],'priority':_0x587353++},_0x121d98));}_0x5aead0[_0xf963('0x7')](_['merge']({'app':_0xf963('0xd'),'appdata':util[_0xf963('0x6')](_0xf963('0xe'),_0x1b8d88['name'],_0x1fad9[_0xf963('0xf')]?_0x1fad9[_0xf963('0xf')][_0xf963('0x10')](''):''),'priority':_0x587353++},_0x121d98));if(_0x1fad9[_0xf963('0x11')]){_0x5aead0['push'](_[_0xf963('0x5')]({'app':'StopMixMonitor','priority':_0x587353++},_0x121d98));}return _0x5aead0;};var getChanSpyApplications=function(_0x4e0a45,_0x5bad63){var _0x1dc4c7=[];for(var _0x20ac54=0x0,_0x48a17d=0x1;_0x20ac54<_0x5bad63[_0xf963('0x12')];_0x20ac54++,_0x48a17d=0x1){_0x1dc4c7=_0x1dc4c7[_0xf963('0x13')](getUserApplications(_0x4e0a45,_0x5bad63[_0x20ac54],_0x5bad63[_0x20ac54][_0xf963('0x14')]));if(_0x5bad63[_0x20ac54][_0xf963('0x14')]!=_0x5bad63[_0x20ac54][_0xf963('0x15')]){_0x1dc4c7=_0x1dc4c7[_0xf963('0x13')](getUserApplications(_0x4e0a45,_0x5bad63[_0x20ac54],_0x5bad63[_0x20ac54]['name']));}}return _0x1dc4c7;};var getChanSpyPromise=function(_0x2f5db8,_0xba39){return new BPromise(function(_0x36515,_0x4ddfcd){return _0x2f5db8['User'][_0xf963('0x16')]({'attributes':['id',_0xf963('0x15'),_0xf963('0x14')],'where':{'role':_0xf963('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0xc5ea2f){if(_0xc5ea2f){return _0x36515(getChanSpyApplications(_0xba39,_0xc5ea2f));}return _0x36515([]);})[_0xf963('0x18')](function(_0x1f0f96){_0x4ddfcd(_0x1f0f96);});});};module['exports']=function(_0x222fca,_0x1faf35){var _0x55d21b=_0x222fca[_0xf963('0x19')];return _0x222fca[_0xf963('0x1a')](_0xf963('0x1b'),attributes,{'tableName':_0xf963('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2588c6,_0x382085,_0x43af75){return getChanSpyPromise(_0x55d21b,_0x2588c6)[_0xf963('0x1d')](function(_0x2e3254){if(_0x2e3254&&_0x2e3254[_0xf963('0x12')]){return _0x55d21b[_0xf963('0x1e')][_0xf963('0x1f')](_0x2e3254);}})[_0xf963('0x1d')](function(){_0x43af75();})[_0xf963('0x18')](function(_0x3188c2){_0x43af75(_0x3188c2);});},'afterUpdate':function(_0x7f26dd,_0x48a7a6,_0x5873fb){return _0x55d21b[_0xf963('0x1e')]['destroy']({'where':{'ChanSpyId':_0x7f26dd['id']}})[_0xf963('0x1d')](function(){return getChanSpyPromise(_0x55d21b,_0x7f26dd);})['then'](function(_0xf9523d){if(_0xf9523d&&_0xf9523d[_0xf963('0x12')]){return _0x55d21b[_0xf963('0x1e')]['bulkCreate'](_0xf9523d);}})['then'](function(){_0x5873fb();})[_0xf963('0x18')](function(_0x274d24){_0x5873fb(_0x274d24);});},'afterDestroy':function(_0x5e26f1,_0x596a0f,_0xb7418){return _0x55d21b[_0xf963('0x1e')][_0xf963('0x20')]({'where':{'ChanSpyId':_0x5e26f1['id']}})[_0xf963('0x1d')](function(){_0xb7418();})[_0xf963('0x18')](function(_0x438301){_0xb7418(_0x438301);});}}});}; \ No newline at end of file +var _0xd7e6=['lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','name','options','StopMixMonitor','internal','concat','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','then'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xd7e6,0x17c));var _0x6d7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d7e('0x0'));var util=require(_0x6d7e('0x1'));var BPromise=require(_0x6d7e('0x2'));var attributes=require(_0x6d7e('0x3'));var getUserApplications=function(_0x4d9321,_0x44eb0d,_0x4bc5b6){var _0x5b961e=0x1;var _0x3050b7=[];var _0x417496={'context':_0x44eb0d['context']||_0x6d7e('0x4'),'exten':util[_0x6d7e('0x5')](_0x6d7e('0x6'),_0x4d9321[_0x6d7e('0x7')],_0x4bc5b6),'type':_0x6d7e('0x8'),'isApp':![],'ChanSpyId':_0x4d9321['id'],'UserId':_0x44eb0d['id']};_0x3050b7[_0x6d7e('0x9')](_[_0x6d7e('0xa')]({'app':_0x6d7e('0xb'),'appdata':util[_0x6d7e('0x5')](_0x6d7e('0xc'),_0x6d7e('0xd')),'priority':_0x5b961e++},_0x417496));if(_0x4d9321[_0x6d7e('0xe')]){_0x3050b7[_0x6d7e('0x9')](_[_0x6d7e('0xa')]({'app':_0x6d7e('0xf'),'appdata':util['format'](_0x6d7e('0x10'),_0x4d9321['recordingFormat']),'priority':_0x5b961e++},_0x417496));}if(_0x4d9321[_0x6d7e('0x11')]){_0x3050b7[_0x6d7e('0x9')](_[_0x6d7e('0xa')]({'app':'Authenticate','appdata':_0x4d9321[_0x6d7e('0x12')],'priority':_0x5b961e++},_0x417496));}_0x3050b7[_0x6d7e('0x9')](_['merge']({'app':'ChanSpy','appdata':util[_0x6d7e('0x5')]('SIP/%s,%s',_0x44eb0d[_0x6d7e('0x13')],_0x4d9321[_0x6d7e('0x14')]?_0x4d9321[_0x6d7e('0x14')]['join'](''):''),'priority':_0x5b961e++},_0x417496));if(_0x4d9321[_0x6d7e('0xe')]){_0x3050b7['push'](_[_0x6d7e('0xa')]({'app':_0x6d7e('0x15'),'priority':_0x5b961e++},_0x417496));}return _0x3050b7;};var getChanSpyApplications=function(_0x1a7d67,_0x3ecc91){var _0x5e4ed8=[];for(var _0x1cb0ff=0x0,_0xcf3f92=0x1;_0x1cb0ff<_0x3ecc91['length'];_0x1cb0ff++,_0xcf3f92=0x1){_0x5e4ed8=_0x5e4ed8['concat'](getUserApplications(_0x1a7d67,_0x3ecc91[_0x1cb0ff],_0x3ecc91[_0x1cb0ff][_0x6d7e('0x16')]));if(_0x3ecc91[_0x1cb0ff][_0x6d7e('0x16')]!=_0x3ecc91[_0x1cb0ff][_0x6d7e('0x13')]){_0x5e4ed8=_0x5e4ed8[_0x6d7e('0x17')](getUserApplications(_0x1a7d67,_0x3ecc91[_0x1cb0ff],_0x3ecc91[_0x1cb0ff][_0x6d7e('0x13')]));}}return _0x5e4ed8;};var getChanSpyPromise=function(_0x3ee768,_0x5a19ae){return new BPromise(function(_0x369049,_0x5497a5){return _0x3ee768[_0x6d7e('0x18')][_0x6d7e('0x19')]({'attributes':['id',_0x6d7e('0x13'),_0x6d7e('0x16')],'where':{'role':_0x6d7e('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x46d6c5){if(_0x46d6c5){return _0x369049(getChanSpyApplications(_0x5a19ae,_0x46d6c5));}return _0x369049([]);})[_0x6d7e('0x1b')](function(_0xc6bce1){_0x5497a5(_0xc6bce1);});});};module[_0x6d7e('0x1c')]=function(_0x4af66e,_0x42b748){var _0x318feb=_0x4af66e[_0x6d7e('0x1d')];return _0x4af66e[_0x6d7e('0x1e')](_0x6d7e('0x1f'),attributes,{'tableName':_0x6d7e('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x419fad,_0x49d477,_0x56f7f8){return getChanSpyPromise(_0x318feb,_0x419fad)['then'](function(_0x337958){if(_0x337958&&_0x337958[_0x6d7e('0x21')]){return _0x318feb[_0x6d7e('0x22')][_0x6d7e('0x23')](_0x337958);}})['then'](function(){_0x56f7f8();})[_0x6d7e('0x1b')](function(_0x545751){_0x56f7f8(_0x545751);});},'afterUpdate':function(_0x1d4d5c,_0x25d19e,_0x26c550){return _0x318feb['VoiceExtension'][_0x6d7e('0x24')]({'where':{'ChanSpyId':_0x1d4d5c['id']}})[_0x6d7e('0x25')](function(){return getChanSpyPromise(_0x318feb,_0x1d4d5c);})['then'](function(_0x5b1498){if(_0x5b1498&&_0x5b1498['length']){return _0x318feb[_0x6d7e('0x22')][_0x6d7e('0x23')](_0x5b1498);}})[_0x6d7e('0x25')](function(){_0x26c550();})['catch'](function(_0x4b6989){_0x26c550(_0x4b6989);});},'afterDestroy':function(_0xb75b1f,_0x5928c5,_0x8b0d19){return _0x318feb['VoiceExtension'][_0x6d7e('0x24')]({'where':{'ChanSpyId':_0xb75b1f['id']}})[_0x6d7e('0x25')](function(){_0x8b0d19();})['catch'](function(_0x3c48e0){_0x8b0d19(_0x3c48e0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bdd5768..0b8dc95 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 _0xe600=['rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb90c8f,_0x491fba){var _0x116156=function(_0x520819){while(--_0x520819){_0xb90c8f['push'](_0xb90c8f['shift']());}};_0x116156(++_0x491fba);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require('moment');var BPromise=require(_0x0e60('0x1'));var rs=require(_0x0e60('0x2'));var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require(_0x0e60('0x8'));var jayson=require(_0x0e60('0x9'));var client=jayson[_0x0e60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7563,_0x497a61,_0x6727dd){return new BPromise(function(_0x30eaed,_0x5ba123){return client[_0x0e60('0xb')](_0x1d7563,_0x6727dd)[_0x0e60('0xc')](function(_0x238537){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));logger['debug'](_0x0e60('0x10'),_0x497a61,_0x0e60('0xf'),JSON[_0x0e60('0x11')](_0x238537));if(_0x238537[_0x0e60('0x12')]){if(_0x238537[_0x0e60('0x12')][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537['error'][_0x0e60('0x14')]);return _0x5ba123(_0x238537[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537[_0x0e60('0x12')]['message']);return _0x30eaed(_0x238537[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));_0x30eaed(_0x238537['result'][_0x0e60('0x14')]);}})[_0x0e60('0x15')](function(_0xdb7760){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0xdb7760);_0x5ba123(_0xdb7760);});});} \ No newline at end of file +var _0x5db8=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5db8,0xbb));var _0x85db=function(_0x570c8a,_0x4a11cc){_0x570c8a=_0x570c8a-0x0;var _0x25dc12=_0x5db8[_0x570c8a];return _0x25dc12;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fda7048..e6dc00c 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 _0x0f48=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x36d9bd,_0x4beab7){var _0x305da7=function(_0x19fddd){while(--_0x19fddd){_0x36d9bd['push'](_0x36d9bd['shift']());}};_0x305da7(++_0x4beab7);}(_0x0f48,0x107));var _0x80f4=function(_0x3c6252,_0x2c317d){_0x3c6252=_0x3c6252-0x0;var _0x20a188=_0x0f48[_0x3c6252];return _0x20a188;};'use strict';var multer=require(_0x80f4('0x0'));var util=require(_0x80f4('0x1'));var path=require('path');var timeout=require(_0x80f4('0x2'));var express=require(_0x80f4('0x3'));var router=express[_0x80f4('0x4')]();var fs_extra=require(_0x80f4('0x5'));var auth=require(_0x80f4('0x6'));var interaction=require(_0x80f4('0x7'));var config=require(_0x80f4('0x8'));var controller=require(_0x80f4('0x9'));router[_0x80f4('0xa')]('/',auth[_0x80f4('0xb')](),controller[_0x80f4('0xc')]);router['get'](_0x80f4('0xd'),auth[_0x80f4('0xb')](),controller['show']);router[_0x80f4('0xe')]('/',auth[_0x80f4('0xb')](),controller[_0x80f4('0xf')]);router['put'](_0x80f4('0xd'),auth[_0x80f4('0xb')](),controller['update']);router[_0x80f4('0x10')](_0x80f4('0xd'),auth[_0x80f4('0xb')](),controller[_0x80f4('0x11')]);module[_0x80f4('0x12')]=router; \ No newline at end of file +var _0x7a15=['/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceContext.controller','isAuthenticated','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7a15,0x9c));var _0x57a1=function(_0x45c03b,_0x30ffcf){_0x45c03b=_0x45c03b-0x0;var _0x6378d9=_0x7a15[_0x45c03b];return _0x6378d9;};'use strict';var multer=require(_0x57a1('0x0'));var util=require(_0x57a1('0x1'));var path=require(_0x57a1('0x2'));var timeout=require(_0x57a1('0x3'));var express=require('express');var router=express[_0x57a1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57a1('0x5'));var controller=require(_0x57a1('0x6'));router['get']('/',auth[_0x57a1('0x7')](),controller['index']);router[_0x57a1('0x8')](_0x57a1('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x57a1('0xa')]('/',auth[_0x57a1('0x7')](),controller['create']);router[_0x57a1('0xb')](_0x57a1('0x9'),auth[_0x57a1('0x7')](),controller['update']);router[_0x57a1('0xc')](_0x57a1('0x9'),auth[_0x57a1('0x7')](),controller[_0x57a1('0xd')]);module[_0x57a1('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 95a61c6..f59d160 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 _0x591a=['exports','STRING','BOOLEAN','sequelize'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x591a,0x163));var _0xa591=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x591a[_0xe84805];return _0x398efd;};'use strict';var Sequelize=require(_0xa591('0x0'));module[_0xa591('0x1')]={'name':{'type':Sequelize[_0xa591('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xa591('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa591('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x32d2=['sequelize','STRING','BOOLEAN'];(function(_0x1ada2a,_0x2cf5bb){var _0x2ef07b=function(_0x2b4d03){while(--_0x2b4d03){_0x1ada2a['push'](_0x1ada2a['shift']());}};_0x2ef07b(++_0x2cf5bb);}(_0x32d2,0x1aa));var _0x232d=function(_0x505891,_0x230df0){_0x505891=_0x505891-0x0;var _0x1cbc11=_0x32d2[_0x505891];return _0x1cbc11;};'use strict';var Sequelize=require(_0x232d('0x0'));module['exports']={'name':{'type':Sequelize[_0x232d('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x232d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x232d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 983594f..2b68b7b 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 _0xe740=['../../config/license/util','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','save','then','get','Contexts','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','show','params','find','body','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','utf8','destroy','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x56e709,_0x2abd2d){var _0x5b7df9=function(_0x31d276){while(--_0x31d276){_0x56e709['push'](_0x56e709['shift']());}};_0x5b7df9(++_0x2abd2d);}(_0xe740,0xb9));var _0x0e74=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xe740[_0x4ab3fb];return _0x34fe1e;};'use strict';var emlformat=require(_0x0e74('0x0'));var rimraf=require(_0x0e74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e74('0x2'));var rp=require('request-promise');var moment=require(_0x0e74('0x3'));var BPromise=require(_0x0e74('0x4'));var Mustache=require(_0x0e74('0x5'));var util=require(_0x0e74('0x6'));var path=require(_0x0e74('0x7'));var sox=require(_0x0e74('0x8'));var csv=require(_0x0e74('0x9'));var ejs=require(_0x0e74('0xa'));var fs=require('fs');var fs_extra=require(_0x0e74('0xb'));var _=require(_0x0e74('0xc'));var squel=require(_0x0e74('0xd'));var crypto=require(_0x0e74('0xe'));var jsforce=require(_0x0e74('0xf'));var deskjs=require(_0x0e74('0x10'));var toCsv=require(_0x0e74('0x9'));var querystring=require(_0x0e74('0x11'));var Papa=require(_0x0e74('0x12'));var Redis=require('ioredis');var authService=require(_0x0e74('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0e74('0x14'));var hardwareService=require(_0x0e74('0x15'));var logger=require(_0x0e74('0x16'))(_0x0e74('0x17'));var utils=require(_0x0e74('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0e74('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0e74('0x1a'));var client=jayson[_0x0e74('0x1b')][_0x0e74('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xa3f7c7,_0x29182c,_0x37bff0,_0x497af8){return new BPromise(function(_0x60c0a7,_0x555a2a){var _0x415b4b=_0x497af8||client;return _0x415b4b['request'](_0xa3f7c7,_0x37bff0)['then'](function(_0x179bbe){logger[_0x0e74('0x1d')](_0x0e74('0x1e'),_0x29182c,'request\x20sent');logger['debug'](_0x0e74('0x1f'),_0x29182c,_0x0e74('0x20'),JSON[_0x0e74('0x21')](_0x179bbe));if(_0x179bbe[_0x0e74('0x22')]){if(_0x179bbe[_0x0e74('0x22')][_0x0e74('0x23')]===0x1f4){logger[_0x0e74('0x22')]('VoiceContext,\x20%s,\x20%s',_0x29182c,_0x179bbe[_0x0e74('0x22')]['message']);return _0x555a2a(_0x179bbe[_0x0e74('0x22')][_0x0e74('0x24')]);}logger[_0x0e74('0x22')](_0x0e74('0x1e'),_0x29182c,_0x179bbe[_0x0e74('0x22')][_0x0e74('0x24')]);return _0x60c0a7(_0x179bbe['error'][_0x0e74('0x24')]);}else{logger[_0x0e74('0x1d')](_0x0e74('0x1e'),_0x29182c,'request\x20sent');_0x60c0a7(_0x179bbe[_0x0e74('0x25')][_0x0e74('0x24')]);}})[_0x0e74('0x26')](function(_0x2c082c){logger['error']('VoiceContext,\x20%s,\x20%s',_0x29182c,_0x2c082c);_0x555a2a(_0x2c082c);});});}function respondWithStatusCode(_0x9df950,_0x3966a3){_0x3966a3=_0x3966a3||0xcc;return function(_0x4e2660){if(_0x4e2660){return _0x9df950['sendStatus'](_0x3966a3);}return _0x9df950[_0x0e74('0x27')](_0x3966a3)[_0x0e74('0x28')]();};}function respondWithResult(_0x44cfaf,_0x4c0b67){_0x4c0b67=_0x4c0b67||0xc8;return function(_0xc8fa20){if(_0xc8fa20){return _0x44cfaf[_0x0e74('0x27')](_0x4c0b67)[_0x0e74('0x29')](_0xc8fa20);}};}function respondWithFilteredResult(_0x4a68a7,_0x2b198b){return function(_0x1eddfe){if(_0x1eddfe){var _0x243000=typeof _0x2b198b[_0x0e74('0x2a')]==='undefined'&&typeof _0x2b198b[_0x0e74('0x2b')]==='undefined';var _0x4cbeb1=_0x1eddfe[_0x0e74('0x2c')];var _0x543eb7=_0x243000?0x0:_0x2b198b[_0x0e74('0x2a')];var _0xce1c11=_0x243000?_0x1eddfe[_0x0e74('0x2c')]:_0x2b198b[_0x0e74('0x2a')]+_0x2b198b[_0x0e74('0x2b')];var _0x53df9f;if(_0xce1c11>=_0x4cbeb1){_0xce1c11=_0x4cbeb1;_0x53df9f=0xc8;}else{_0x53df9f=0xce;}_0x4a68a7[_0x0e74('0x27')](_0x53df9f);return _0x4a68a7[_0x0e74('0x2d')](_0x0e74('0x2e'),_0x543eb7+'-'+_0xce1c11+'/'+_0x4cbeb1)[_0x0e74('0x29')](_0x1eddfe);}return null;};}function patchUpdates(_0x53cb47){return function(_0x25f8de){try{jsonpatch['apply'](_0x25f8de,_0x53cb47,!![]);}catch(_0x3f9133){return BPromise['reject'](_0x3f9133);}return _0x25f8de[_0x0e74('0x2f')]();};}function saveUpdates(_0x283073,_0x27b2f1){return function(_0x4eeb39){if(_0x4eeb39){return _0x4eeb39['update'](_0x283073)[_0x0e74('0x30')](function(_0x75016b){return _0x75016b;});}return null;};}function removeEntity(_0x54ff94,_0x22efe5){return function(_0x156456){if(_0x156456){return _0x156456['destroy']()[_0x0e74('0x30')](function(){var _0x4e4a55=_0x156456[_0x0e74('0x31')]({'plain':!![]});var _0x41e588=_0x0e74('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x41e588,'resourceId':_0x4e4a55['id']}})[_0x0e74('0x30')](function(){return _0x156456;});})['then'](function(){_0x54ff94['status'](0xcc)[_0x0e74('0x28')]();});}};}function handleEntityNotFound(_0x2af393,_0x5a64bc){return function(_0x1b8dd5){if(!_0x1b8dd5){_0x2af393[_0x0e74('0x33')](0x194);}return _0x1b8dd5;};}function handleError(_0x29dac9,_0x33ac4e){_0x33ac4e=_0x33ac4e||0x1f4;return function(_0xa75ca3){logger[_0x0e74('0x22')](_0xa75ca3[_0x0e74('0x34')]);if(_0xa75ca3[_0x0e74('0x35')]){delete _0xa75ca3[_0x0e74('0x35')];}_0x29dac9[_0x0e74('0x27')](_0x33ac4e)['send'](_0xa75ca3);};}exports[_0x0e74('0x36')]=function(_0x3fcb3e,_0x3d0bc8){var _0x2c095a={},_0x454430={},_0x4e6e9f={'count':0x0,'rows':[]};var _0x26900a=_[_0x0e74('0x37')](db['VoiceContext'][_0x0e74('0x38')],function(_0x2494c2){return{'name':_0x2494c2[_0x0e74('0x39')],'type':_0x2494c2[_0x0e74('0x3a')][_0x0e74('0x3b')]};});_0x454430[_0x0e74('0x3c')]=_[_0x0e74('0x37')](_0x26900a,_0x0e74('0x35'));_0x454430['query']=_[_0x0e74('0x3d')](_0x3fcb3e[_0x0e74('0x3e')]);_0x454430['filters']=_[_0x0e74('0x3f')](_0x454430[_0x0e74('0x3c')],_0x454430[_0x0e74('0x3e')]);_0x2c095a['attributes']=_['intersection'](_0x454430['model'],qs[_0x0e74('0x40')](_0x3fcb3e['query']['fields']));_0x2c095a[_0x0e74('0x41')]=_0x2c095a[_0x0e74('0x41')][_0x0e74('0x42')]?_0x2c095a[_0x0e74('0x41')]:_0x454430[_0x0e74('0x3c')];if(!_0x3fcb3e[_0x0e74('0x3e')][_0x0e74('0x43')](_0x0e74('0x44'))){_0x2c095a[_0x0e74('0x2b')]=qs[_0x0e74('0x2b')](_0x3fcb3e[_0x0e74('0x3e')][_0x0e74('0x2b')]);_0x2c095a[_0x0e74('0x2a')]=qs[_0x0e74('0x2a')](_0x3fcb3e['query']['offset']);}_0x2c095a[_0x0e74('0x45')]=qs[_0x0e74('0x46')](_0x3fcb3e[_0x0e74('0x3e')][_0x0e74('0x46')]);_0x2c095a[_0x0e74('0x47')]=qs[_0x0e74('0x48')](_[_0x0e74('0x49')](_0x3fcb3e[_0x0e74('0x3e')],_0x454430[_0x0e74('0x48')]),_0x26900a);if(_0x3fcb3e[_0x0e74('0x3e')][_0x0e74('0x4a')]){_0x2c095a[_0x0e74('0x47')]=_[_0x0e74('0x4b')](_0x2c095a[_0x0e74('0x47')],{'$or':_[_0x0e74('0x37')](_0x26900a,function(_0x34381c){if(_0x34381c['type']!==_0x0e74('0x4c')){var _0x3bb108={};_0x3bb108[_0x34381c[_0x0e74('0x35')]]={'$like':'%'+_0x3fcb3e[_0x0e74('0x3e')]['filter']+'%'};return _0x3bb108;}})});}_0x2c095a=_['merge']({},_0x2c095a,_0x3fcb3e[_0x0e74('0x4d')]);var _0x22a03a={'where':_0x2c095a[_0x0e74('0x47')]};return db[_0x0e74('0x4e')]['count'](_0x22a03a)[_0x0e74('0x30')](function(_0x473648){_0x4e6e9f[_0x0e74('0x2c')]=_0x473648;if(_0x3fcb3e[_0x0e74('0x3e')][_0x0e74('0x4f')]){_0x2c095a[_0x0e74('0x50')]=[{'all':!![]}];}return db[_0x0e74('0x4e')][_0x0e74('0x51')](_0x2c095a);})['then'](function(_0x132c19){_0x4e6e9f['rows']=_0x132c19;return _0x4e6e9f;})[_0x0e74('0x30')](respondWithFilteredResult(_0x3d0bc8,_0x2c095a))[_0x0e74('0x26')](handleError(_0x3d0bc8,null));};exports[_0x0e74('0x52')]=function(_0x410e91,_0x378a51){var _0x536d2b={'raw':![],'where':{'id':_0x410e91[_0x0e74('0x53')]['id']}},_0x596fa3={};_0x596fa3[_0x0e74('0x3c')]=_['keys'](db['VoiceContext'][_0x0e74('0x38')]);_0x596fa3[_0x0e74('0x3e')]=_[_0x0e74('0x3d')](_0x410e91[_0x0e74('0x3e')]);_0x596fa3[_0x0e74('0x48')]=_['intersection'](_0x596fa3['model'],_0x596fa3[_0x0e74('0x3e')]);_0x536d2b[_0x0e74('0x41')]=_[_0x0e74('0x3f')](_0x596fa3[_0x0e74('0x3c')],qs['fields'](_0x410e91['query'][_0x0e74('0x40')]));_0x536d2b['attributes']=_0x536d2b[_0x0e74('0x41')]['length']?_0x536d2b[_0x0e74('0x41')]:_0x596fa3[_0x0e74('0x3c')];if(_0x410e91[_0x0e74('0x3e')][_0x0e74('0x4f')]){_0x536d2b[_0x0e74('0x50')]=[{'all':!![]}];}_0x536d2b=_[_0x0e74('0x4b')]({},_0x536d2b,_0x410e91[_0x0e74('0x4d')]);return db['VoiceContext'][_0x0e74('0x54')](_0x536d2b)['then'](handleEntityNotFound(_0x378a51,null))[_0x0e74('0x30')](respondWithResult(_0x378a51,null))[_0x0e74('0x26')](handleError(_0x378a51,null));};exports['create']=function(_0x1b780f,_0x18ea1e,_0x40b22b){var _0x10cf02;return db['VoiceContext']['create'](_0x1b780f[_0x0e74('0x55')],{'raw':!![]})[_0x0e74('0x30')](function(_0x5b07dd){_0x10cf02=_0x5b07dd;return db[_0x0e74('0x4e')]['findAll']({'raw':!![]});})[_0x0e74('0x30')](function(_0x2a6103){var _0x457459=fs['readFileSync'](path[_0x0e74('0x56')](config[_0x0e74('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x4bc182=ejs[_0x0e74('0x58')](_0x457459,{'contexts':_0x2a6103||[]});fs[_0x0e74('0x59')](_0x0e74('0x5a'),_0x4bc182);})[_0x0e74('0x30')](function(){return respondWithRpcPromise(_0x0e74('0x5b'),_0x0e74('0x5c'),{'module':_0x0e74('0x5d')});})[_0x0e74('0x30')](function(){var _0x53af87=_0x1b780f['user'][_0x0e74('0x31')]({'plain':!![]});if(!_0x53af87)throw new Error(_0x0e74('0x5e'));if(_0x53af87[_0x0e74('0x5f')]===_0x0e74('0x60')){var _0x174f65=_0x10cf02[_0x0e74('0x31')]({'plain':!![]});return db[_0x0e74('0x61')][_0x0e74('0x54')]({'where':{'name':'Contexts','userProfileId':_0x53af87[_0x0e74('0x62')]},'raw':!![]})[_0x0e74('0x30')](function(_0xf3bcd){if(_0xf3bcd&&_0xf3bcd[_0x0e74('0x63')]===0x0){return db['UserProfileResource'][_0x0e74('0x5c')]({'name':_0x174f65[_0x0e74('0x35')],'resourceId':_0x174f65['id'],'type':_0xf3bcd[_0x0e74('0x35')],'sectionId':_0xf3bcd['id']},{})[_0x0e74('0x30')](function(){return _0x10cf02;});}else{return _0x10cf02;}})['catch'](function(_0x1848fe){logger[_0x0e74('0x22')](_0x0e74('0x64'),_0x1848fe);throw _0x1848fe;});}return _0x10cf02;})['then'](respondWithResult(_0x18ea1e,0xc9))[_0x0e74('0x26')](handleError(_0x18ea1e,null));};exports[_0x0e74('0x65')]=function(_0x5f1962,_0x2be737,_0x1a5fb7){var _0x230d2b;return db['VoiceContext'][_0x0e74('0x54')]({'where':{'id':_0x5f1962[_0x0e74('0x53')]['id']}})[_0x0e74('0x30')](handleEntityNotFound(_0x2be737,null))[_0x0e74('0x30')](saveUpdates(_0x5f1962[_0x0e74('0x55')],null))[_0x0e74('0x30')](function(_0x2d31cc){if(_0x2d31cc){_0x230d2b=_0x2d31cc;return db[_0x0e74('0x4e')][_0x0e74('0x51')]({'raw':!![]});}})[_0x0e74('0x30')](function(_0x5dd9ec){var _0xd2f220=fs['readFileSync'](path['join'](config[_0x0e74('0x57')],_0x0e74('0x66')),_0x0e74('0x67'));var _0x102322=ejs[_0x0e74('0x58')](_0xd2f220,{'contexts':_0x5dd9ec||[]});fs[_0x0e74('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x102322);})[_0x0e74('0x30')](function(){return respondWithRpcPromise(_0x0e74('0x5b'),_0x0e74('0x65'),{'module':'chan_sip.so'});})['then'](function(){return _0x230d2b;})[_0x0e74('0x30')](respondWithResult(_0x2be737,null))[_0x0e74('0x26')](handleError(_0x2be737,null));};exports['destroy']=function(_0x3bc3ce,_0x57e559,_0x186392){var _0x9f03a8;return db[_0x0e74('0x4e')][_0x0e74('0x54')]({'where':{'id':_0x3bc3ce['params']['id']}})[_0x0e74('0x30')](handleEntityNotFound(_0x57e559,null))[_0x0e74('0x30')](removeEntity(_0x57e559,null))[_0x0e74('0x30')](function(){return db[_0x0e74('0x4e')][_0x0e74('0x51')]({'raw':!![]});})[_0x0e74('0x30')](function(_0x41ff68){var _0x352b42=fs['readFileSync'](path['join'](config[_0x0e74('0x57')],_0x0e74('0x66')),_0x0e74('0x67'));var _0x2fbd27=ejs[_0x0e74('0x58')](_0x352b42,{'contexts':_0x41ff68});fs['writeFileSync'](_0x0e74('0x5a'),_0x2fbd27);return respondWithRpcPromise('Reload',_0x0e74('0x68'),{'module':_0x0e74('0x5d')});})[_0x0e74('0x26')](handleError(_0x57e559,null));}; \ No newline at end of file +var _0x39bc=['readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','root','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','include','findAll','rawAttributes','includeAll','catch','create','body'];(function(_0x4b866e,_0x3991dd){var _0x29bcd1=function(_0xc923c3){while(--_0xc923c3){_0x4b866e['push'](_0x4b866e['shift']());}};_0x29bcd1(++_0x3991dd);}(_0x39bc,0xdc));var _0xc39b=function(_0x10255d,_0x4ffe63){_0x10255d=_0x10255d-0x0;var _0xdbbd8e=_0x39bc[_0x10255d];return _0xdbbd8e;};'use strict';var emlformat=require(_0xc39b('0x0'));var rimraf=require(_0xc39b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc39b('0x2'));var rp=require(_0xc39b('0x3'));var moment=require(_0xc39b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc39b('0x5'));var util=require('util');var path=require(_0xc39b('0x6'));var sox=require(_0xc39b('0x7'));var csv=require('to-csv');var ejs=require(_0xc39b('0x8'));var fs=require('fs');var fs_extra=require(_0xc39b('0x9'));var _=require(_0xc39b('0xa'));var squel=require('squel');var crypto=require(_0xc39b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc39b('0xc'));var toCsv=require(_0xc39b('0xd'));var querystring=require('querystring');var Papa=require(_0xc39b('0xe'));var Redis=require(_0xc39b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc39b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc39b('0x11'))('api');var utils=require(_0xc39b('0x12'));var config=require(_0xc39b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc39b('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc39b('0x15')][_0xc39b('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x23ba33,_0x1802d0,_0x2daa5a,_0x9de36b){return new BPromise(function(_0x2007df,_0x38fd35){var _0x4de5ae=_0x9de36b||client;return _0x4de5ae[_0xc39b('0x17')](_0x23ba33,_0x2daa5a)[_0xc39b('0x18')](function(_0x387e47){logger[_0xc39b('0x19')](_0xc39b('0x1a'),_0x1802d0,_0xc39b('0x1b'));logger[_0xc39b('0x1c')](_0xc39b('0x1d'),_0x1802d0,_0xc39b('0x1b'),JSON[_0xc39b('0x1e')](_0x387e47));if(_0x387e47[_0xc39b('0x1f')]){if(_0x387e47[_0xc39b('0x1f')][_0xc39b('0x20')]===0x1f4){logger['error'](_0xc39b('0x1a'),_0x1802d0,_0x387e47[_0xc39b('0x1f')][_0xc39b('0x21')]);return _0x38fd35(_0x387e47[_0xc39b('0x1f')][_0xc39b('0x21')]);}logger[_0xc39b('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x1802d0,_0x387e47[_0xc39b('0x1f')][_0xc39b('0x21')]);return _0x2007df(_0x387e47[_0xc39b('0x1f')][_0xc39b('0x21')]);}else{logger[_0xc39b('0x19')](_0xc39b('0x1a'),_0x1802d0,_0xc39b('0x1b'));_0x2007df(_0x387e47[_0xc39b('0x22')][_0xc39b('0x21')]);}})['catch'](function(_0x222184){logger[_0xc39b('0x1f')](_0xc39b('0x1a'),_0x1802d0,_0x222184);_0x38fd35(_0x222184);});});}function respondWithStatusCode(_0x1cc508,_0x5e1a81){_0x5e1a81=_0x5e1a81||0xcc;return function(_0x2ce5aa){if(_0x2ce5aa){return _0x1cc508[_0xc39b('0x23')](_0x5e1a81);}return _0x1cc508[_0xc39b('0x24')](_0x5e1a81)[_0xc39b('0x25')]();};}function respondWithResult(_0x3abad3,_0x6ab5ad){_0x6ab5ad=_0x6ab5ad||0xc8;return function(_0x206b89){if(_0x206b89){return _0x3abad3[_0xc39b('0x24')](_0x6ab5ad)['json'](_0x206b89);}};}function respondWithFilteredResult(_0x15dd47,_0x12cc7d){return function(_0x5b165c){if(_0x5b165c){var _0x3f9cb6=typeof _0x12cc7d['offset']===_0xc39b('0x26')&&typeof _0x12cc7d[_0xc39b('0x27')]===_0xc39b('0x26');var _0x170005=_0x5b165c['count'];var _0x547575=_0x3f9cb6?0x0:_0x12cc7d[_0xc39b('0x28')];var _0x286ac7=_0x3f9cb6?_0x5b165c[_0xc39b('0x29')]:_0x12cc7d['offset']+_0x12cc7d[_0xc39b('0x27')];var _0x198a39;if(_0x286ac7>=_0x170005){_0x286ac7=_0x170005;_0x198a39=0xc8;}else{_0x198a39=0xce;}_0x15dd47[_0xc39b('0x24')](_0x198a39);return _0x15dd47[_0xc39b('0x2a')](_0xc39b('0x2b'),_0x547575+'-'+_0x286ac7+'/'+_0x170005)[_0xc39b('0x2c')](_0x5b165c);}return null;};}function patchUpdates(_0x114b10){return function(_0x4152e7){try{jsonpatch[_0xc39b('0x2d')](_0x4152e7,_0x114b10,!![]);}catch(_0x2bb922){return BPromise[_0xc39b('0x2e')](_0x2bb922);}return _0x4152e7[_0xc39b('0x2f')]();};}function saveUpdates(_0x9d137f,_0x17541e){return function(_0x2d0f6c){if(_0x2d0f6c){return _0x2d0f6c[_0xc39b('0x30')](_0x9d137f)['then'](function(_0xe60e2d){return _0xe60e2d;});}return null;};}function removeEntity(_0x263dda,_0x3b1224){return function(_0x166923){if(_0x166923){return _0x166923[_0xc39b('0x31')]()[_0xc39b('0x18')](function(){var _0x2447fb=_0x166923['get']({'plain':!![]});var _0x3de34a=_0xc39b('0x32');return db[_0xc39b('0x33')][_0xc39b('0x31')]({'where':{'type':_0x3de34a,'resourceId':_0x2447fb['id']}})[_0xc39b('0x18')](function(){return _0x166923;});})[_0xc39b('0x18')](function(){_0x263dda['status'](0xcc)[_0xc39b('0x25')]();});}};}function handleEntityNotFound(_0x43a1a6,_0xf981ab){return function(_0xda0261){if(!_0xda0261){_0x43a1a6[_0xc39b('0x23')](0x194);}return _0xda0261;};}function handleError(_0x5e4d38,_0x1264e5){_0x1264e5=_0x1264e5||0x1f4;return function(_0x115fe5){logger['error'](_0x115fe5[_0xc39b('0x34')]);if(_0x115fe5[_0xc39b('0x35')]){delete _0x115fe5[_0xc39b('0x35')];}_0x5e4d38[_0xc39b('0x24')](_0x1264e5)[_0xc39b('0x36')](_0x115fe5);};}exports[_0xc39b('0x37')]=function(_0x567666,_0x1ed22c){var _0x3241e4={},_0x4cc16d={},_0x25e2ca={'count':0x0,'rows':[]};var _0xbfdf5a=_[_0xc39b('0x38')](db['VoiceContext']['rawAttributes'],function(_0x42c906){return{'name':_0x42c906['fieldName'],'type':_0x42c906[_0xc39b('0x39')][_0xc39b('0x3a')]};});_0x4cc16d[_0xc39b('0x3b')]=_['map'](_0xbfdf5a,_0xc39b('0x35'));_0x4cc16d[_0xc39b('0x3c')]=_[_0xc39b('0x3d')](_0x567666[_0xc39b('0x3c')]);_0x4cc16d[_0xc39b('0x3e')]=_['intersection'](_0x4cc16d[_0xc39b('0x3b')],_0x4cc16d[_0xc39b('0x3c')]);_0x3241e4[_0xc39b('0x3f')]=_[_0xc39b('0x40')](_0x4cc16d['model'],qs[_0xc39b('0x41')](_0x567666[_0xc39b('0x3c')]['fields']));_0x3241e4['attributes']=_0x3241e4[_0xc39b('0x3f')][_0xc39b('0x42')]?_0x3241e4[_0xc39b('0x3f')]:_0x4cc16d[_0xc39b('0x3b')];if(!_0x567666[_0xc39b('0x3c')][_0xc39b('0x43')](_0xc39b('0x44'))){_0x3241e4['limit']=qs['limit'](_0x567666[_0xc39b('0x3c')][_0xc39b('0x27')]);_0x3241e4[_0xc39b('0x28')]=qs[_0xc39b('0x28')](_0x567666[_0xc39b('0x3c')][_0xc39b('0x28')]);}_0x3241e4['order']=qs[_0xc39b('0x45')](_0x567666[_0xc39b('0x3c')][_0xc39b('0x45')]);_0x3241e4[_0xc39b('0x46')]=qs[_0xc39b('0x3e')](_[_0xc39b('0x47')](_0x567666[_0xc39b('0x3c')],_0x4cc16d[_0xc39b('0x3e')]),_0xbfdf5a);if(_0x567666[_0xc39b('0x3c')]['filter']){_0x3241e4[_0xc39b('0x46')]=_['merge'](_0x3241e4[_0xc39b('0x46')],{'$or':_[_0xc39b('0x38')](_0xbfdf5a,function(_0xc180c5){if(_0xc180c5[_0xc39b('0x39')]!=='VIRTUAL'){var _0x1a20c8={};_0x1a20c8[_0xc180c5[_0xc39b('0x35')]]={'$like':'%'+_0x567666[_0xc39b('0x3c')][_0xc39b('0x48')]+'%'};return _0x1a20c8;}})});}_0x3241e4=_[_0xc39b('0x49')]({},_0x3241e4,_0x567666[_0xc39b('0x4a')]);var _0x3872de={'where':_0x3241e4[_0xc39b('0x46')]};return db[_0xc39b('0x4b')][_0xc39b('0x29')](_0x3872de)['then'](function(_0x37ca0e){_0x25e2ca[_0xc39b('0x29')]=_0x37ca0e;if(_0x567666['query']['includeAll']){_0x3241e4[_0xc39b('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0xc39b('0x4d')](_0x3241e4);})[_0xc39b('0x18')](function(_0x2ca7d7){_0x25e2ca['rows']=_0x2ca7d7;return _0x25e2ca;})[_0xc39b('0x18')](respondWithFilteredResult(_0x1ed22c,_0x3241e4))['catch'](handleError(_0x1ed22c,null));};exports['show']=function(_0x57085b,_0x382247){var _0x3705bb={'raw':![],'where':{'id':_0x57085b['params']['id']}},_0x20411e={};_0x20411e[_0xc39b('0x3b')]=_[_0xc39b('0x3d')](db[_0xc39b('0x4b')][_0xc39b('0x4e')]);_0x20411e[_0xc39b('0x3c')]=_[_0xc39b('0x3d')](_0x57085b[_0xc39b('0x3c')]);_0x20411e['filters']=_[_0xc39b('0x40')](_0x20411e[_0xc39b('0x3b')],_0x20411e[_0xc39b('0x3c')]);_0x3705bb[_0xc39b('0x3f')]=_[_0xc39b('0x40')](_0x20411e[_0xc39b('0x3b')],qs['fields'](_0x57085b[_0xc39b('0x3c')][_0xc39b('0x41')]));_0x3705bb[_0xc39b('0x3f')]=_0x3705bb[_0xc39b('0x3f')][_0xc39b('0x42')]?_0x3705bb['attributes']:_0x20411e[_0xc39b('0x3b')];if(_0x57085b[_0xc39b('0x3c')][_0xc39b('0x4f')]){_0x3705bb['include']=[{'all':!![]}];}_0x3705bb=_['merge']({},_0x3705bb,_0x57085b[_0xc39b('0x4a')]);return db[_0xc39b('0x4b')]['find'](_0x3705bb)[_0xc39b('0x18')](handleEntityNotFound(_0x382247,null))['then'](respondWithResult(_0x382247,null))[_0xc39b('0x50')](handleError(_0x382247,null));};exports['create']=function(_0x566856,_0x31e296,_0x5d59c6){var _0xc08df5;return db[_0xc39b('0x4b')][_0xc39b('0x51')](_0x566856[_0xc39b('0x52')],{'raw':!![]})[_0xc39b('0x18')](function(_0x34c33b){_0xc08df5=_0x34c33b;return db[_0xc39b('0x4b')]['findAll']({'raw':!![]});})[_0xc39b('0x18')](function(_0x2b7100){var _0x96ed41=fs[_0xc39b('0x53')](path[_0xc39b('0x54')](config['root'],_0xc39b('0x55')),_0xc39b('0x56'));var _0xabe36=ejs[_0xc39b('0x57')](_0x96ed41,{'contexts':_0x2b7100||[]});fs[_0xc39b('0x58')](_0xc39b('0x59'),_0xabe36);})['then'](function(){return respondWithRpcPromise(_0xc39b('0x5a'),_0xc39b('0x51'),{'module':_0xc39b('0x5b')});})[_0xc39b('0x18')](function(){var _0x55fbae=_0x566856['user'][_0xc39b('0x5c')]({'plain':!![]});if(!_0x55fbae)throw new Error(_0xc39b('0x5d'));if(_0x55fbae[_0xc39b('0x5e')]===_0xc39b('0x5f')){var _0x569345=_0xc08df5['get']({'plain':!![]});return db['UserProfileSection'][_0xc39b('0x60')]({'where':{'name':_0xc39b('0x32'),'userProfileId':_0x55fbae['userProfileId']},'raw':!![]})['then'](function(_0xfa68ac){if(_0xfa68ac&&_0xfa68ac[_0xc39b('0x61')]===0x0){return db[_0xc39b('0x33')][_0xc39b('0x51')]({'name':_0x569345[_0xc39b('0x35')],'resourceId':_0x569345['id'],'type':_0xfa68ac[_0xc39b('0x35')],'sectionId':_0xfa68ac['id']},{})['then'](function(){return _0xc08df5;});}else{return _0xc08df5;}})[_0xc39b('0x50')](function(_0x5390e8){logger[_0xc39b('0x1f')](_0xc39b('0x62'),_0x5390e8);throw _0x5390e8;});}return _0xc08df5;})[_0xc39b('0x18')](respondWithResult(_0x31e296,0xc9))['catch'](handleError(_0x31e296,null));};exports[_0xc39b('0x30')]=function(_0x1b1ee2,_0x2b3c30,_0xc6e3fa){var _0x589dc1;return db[_0xc39b('0x4b')][_0xc39b('0x60')]({'where':{'id':_0x1b1ee2[_0xc39b('0x63')]['id']}})[_0xc39b('0x18')](handleEntityNotFound(_0x2b3c30,null))['then'](saveUpdates(_0x1b1ee2[_0xc39b('0x52')],null))[_0xc39b('0x18')](function(_0x2b8539){if(_0x2b8539){_0x589dc1=_0x2b8539;return db[_0xc39b('0x4b')][_0xc39b('0x4d')]({'raw':!![]});}})['then'](function(_0x581f2b){var _0x2ffa53=fs[_0xc39b('0x53')](path['join'](config[_0xc39b('0x64')],_0xc39b('0x55')),'utf8');var _0x144626=ejs[_0xc39b('0x57')](_0x2ffa53,{'contexts':_0x581f2b||[]});fs[_0xc39b('0x58')](_0xc39b('0x59'),_0x144626);})[_0xc39b('0x18')](function(){return respondWithRpcPromise(_0xc39b('0x5a'),'update',{'module':'chan_sip.so'});})[_0xc39b('0x18')](function(){return _0x589dc1;})[_0xc39b('0x18')](respondWithResult(_0x2b3c30,null))[_0xc39b('0x50')](handleError(_0x2b3c30,null));};exports['destroy']=function(_0x50d5ce,_0x48175f,_0x4b506f){var _0x31bfe1;return db[_0xc39b('0x4b')][_0xc39b('0x60')]({'where':{'id':_0x50d5ce[_0xc39b('0x63')]['id']}})[_0xc39b('0x18')](handleEntityNotFound(_0x48175f,null))[_0xc39b('0x18')](removeEntity(_0x48175f,null))[_0xc39b('0x18')](function(){return db[_0xc39b('0x4b')]['findAll']({'raw':!![]});})[_0xc39b('0x18')](function(_0x5d40e5){var _0x2c9835=fs[_0xc39b('0x53')](path['join'](config[_0xc39b('0x64')],_0xc39b('0x55')),_0xc39b('0x56'));var _0x4d4b92=ejs['render'](_0x2c9835,{'contexts':_0x5d40e5});fs[_0xc39b('0x58')](_0xc39b('0x59'),_0x4d4b92);return respondWithRpcPromise(_0xc39b('0x5a'),_0xc39b('0x31'),{'module':_0xc39b('0x5b')});})[_0xc39b('0x50')](handleError(_0x48175f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 642c623..5e990d6 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 _0x3ece=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceContext.attributes','define','voice_contexts'];(function(_0x2a1a1f,_0x2f32e2){var _0x291648=function(_0x20a395){while(--_0x20a395){_0x2a1a1f['push'](_0x2a1a1f['shift']());}};_0x291648(++_0x2f32e2);}(_0x3ece,0x10e));var _0xe3ec=function(_0x2ba95b,_0x1fedb3){_0x2ba95b=_0x2ba95b-0x0;var _0x5eda82=_0x3ece[_0x2ba95b];return _0x5eda82;};'use strict';var _=require(_0xe3ec('0x0'));var util=require(_0xe3ec('0x1'));var logger=require(_0xe3ec('0x2'))(_0xe3ec('0x3'));var moment=require('moment');var BPromise=require(_0xe3ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3ec('0x5'));var rimraf=require(_0xe3ec('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3ec('0x7'));module['exports']=function(_0x2f22e9,_0x38610a){return _0x2f22e9[_0xe3ec('0x8')]('VoiceContext',attributes,{'tableName':_0xe3ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cfa=['./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5ca033,_0x2483a2){var _0x519e52=function(_0x247fd2){while(--_0x247fd2){_0x5ca033['push'](_0x5ca033['shift']());}};_0x519e52(++_0x2483a2);}(_0x7cfa,0xac));var _0xa7cf=function(_0xade0af,_0x5abd2a){_0xade0af=_0xade0af-0x0;var _0x2a2582=_0x7cfa[_0xade0af];return _0x2a2582;};'use strict';var _=require(_0xa7cf('0x0'));var util=require(_0xa7cf('0x1'));var logger=require(_0xa7cf('0x2'))('api');var moment=require(_0xa7cf('0x3'));var BPromise=require(_0xa7cf('0x4'));var rp=require(_0xa7cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7cf('0x6'));var config=require(_0xa7cf('0x7'));var attributes=require(_0xa7cf('0x8'));module[_0xa7cf('0x9')]=function(_0x2e5701,_0x283110){return _0x2e5701[_0xa7cf('0xa')](_0xa7cf('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index df260f0..353e589 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 _0x09b0=['moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x3441ab,_0x23d988){var _0x1280a9=function(_0x572fdf){while(--_0x572fdf){_0x3441ab['push'](_0x3441ab['shift']());}};_0x1280a9(++_0x23d988);}(_0x09b0,0x1f3));var _0x009b=function(_0x539a7a,_0x47331a){_0x539a7a=_0x539a7a-0x0;var _0x49475e=_0x09b0[_0x539a7a];return _0x49475e;};'use strict';var _=require(_0x009b('0x0'));var util=require('util');var moment=require(_0x009b('0x1'));var BPromise=require('bluebird');var rs=require(_0x009b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x009b('0x3'));var logger=require(_0x009b('0x4'))(_0x009b('0x5'));var config=require('../../config/environment');var jayson=require(_0x009b('0x6'));var client=jayson[_0x009b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9ed6,_0x2dd1ca,_0x476ef9){return new BPromise(function(_0x2cb43c,_0x1fd0da){return client[_0x009b('0x8')](_0x3a9ed6,_0x476ef9)[_0x009b('0x9')](function(_0x21c1cc){logger[_0x009b('0xa')](_0x009b('0xb'),_0x2dd1ca,_0x009b('0xc'));logger[_0x009b('0xd')](_0x009b('0xe'),_0x2dd1ca,_0x009b('0xc'),JSON[_0x009b('0xf')](_0x21c1cc));if(_0x21c1cc['error']){if(_0x21c1cc[_0x009b('0x10')][_0x009b('0x11')]===0x1f4){logger[_0x009b('0x10')](_0x009b('0xb'),_0x2dd1ca,_0x21c1cc['error']['message']);return _0x1fd0da(_0x21c1cc[_0x009b('0x10')][_0x009b('0x12')]);}logger[_0x009b('0x10')](_0x009b('0xb'),_0x2dd1ca,_0x21c1cc[_0x009b('0x10')][_0x009b('0x12')]);return _0x2cb43c(_0x21c1cc['error']['message']);}else{logger[_0x009b('0xa')](_0x009b('0xb'),_0x2dd1ca,'request\x20sent');_0x2cb43c(_0x21c1cc['result']['message']);}})[_0x009b('0x13')](function(_0xa8060b){logger[_0x009b('0x10')](_0x009b('0xb'),_0x2dd1ca,_0xa8060b);_0x1fd0da(_0xa8060b);});});} \ No newline at end of file +var _0x1a83=['VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x2018f7,_0x5533b5){var _0x95f603=function(_0x35b6de){while(--_0x35b6de){_0x2018f7['push'](_0x2018f7['shift']());}};_0x95f603(++_0x5533b5);}(_0x1a83,0x1c0));var _0x31a8=function(_0x78b85,_0x195038){_0x78b85=_0x78b85-0x0;var _0xb5e91=_0x1a83[_0x78b85];return _0xb5e91;};'use strict';var _=require(_0x31a8('0x0'));var util=require(_0x31a8('0x1'));var moment=require(_0x31a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x31a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31a8('0x4'))['db'];var utils=require(_0x31a8('0x5'));var logger=require(_0x31a8('0x6'))(_0x31a8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x31a8('0x8')][_0x31a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bf3c7,_0x2c4b45,_0x471ae1){return new BPromise(function(_0x21f054,_0x1159a9){return client[_0x31a8('0xa')](_0x2bf3c7,_0x471ae1)[_0x31a8('0xb')](function(_0x2d4e94){logger['info'](_0x31a8('0xc'),_0x2c4b45,'request\x20sent');logger['debug'](_0x31a8('0xd'),_0x2c4b45,_0x31a8('0xe'),JSON['stringify'](_0x2d4e94));if(_0x2d4e94[_0x31a8('0xf')]){if(_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x10')]===0x1f4){logger[_0x31a8('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2c4b45,_0x2d4e94['error'][_0x31a8('0x11')]);return _0x1159a9(_0x2d4e94['error'][_0x31a8('0x11')]);}logger['error'](_0x31a8('0xc'),_0x2c4b45,_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x11')]);return _0x21f054(_0x2d4e94['error'][_0x31a8('0x11')]);}else{logger[_0x31a8('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2c4b45,_0x31a8('0xe'));_0x21f054(_0x2d4e94['result'][_0x31a8('0x11')]);}})[_0x31a8('0x13')](function(_0x507797){logger[_0x31a8('0xf')](_0x31a8('0xc'),_0x2c4b45,_0x507797);_0x1159a9(_0x507797);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bdaca39..c6946a3 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 _0x1109=['index','/:id','post','put','update','delete','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0xd05c08,_0x183b12){var _0x47e550=function(_0x2d4a53){while(--_0x2d4a53){_0xd05c08['push'](_0xd05c08['shift']());}};_0x47e550(++_0x183b12);}(_0x1109,0x17d));var _0x9110=function(_0x1a1460,_0x539531){_0x1a1460=_0x1a1460-0x0;var _0x33ab03=_0x1109[_0x1a1460];return _0x33ab03;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9110('0x0'));var timeout=require('connect-timeout');var express=require(_0x9110('0x1'));var router=express['Router']();var fs_extra=require(_0x9110('0x2'));var auth=require(_0x9110('0x3'));var interaction=require(_0x9110('0x4'));var config=require(_0x9110('0x5'));var controller=require(_0x9110('0x6'));router[_0x9110('0x7')]('/',auth[_0x9110('0x8')](),controller[_0x9110('0x9')]);router[_0x9110('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9110('0x7')](_0x9110('0xa'),auth[_0x9110('0x8')](),controller['show']);router[_0x9110('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9110('0xc')](_0x9110('0xa'),auth[_0x9110('0x8')](),controller[_0x9110('0xd')]);router[_0x9110('0xe')](_0x9110('0xa'),auth[_0x9110('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2392=['describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe'];(function(_0x55d56f,_0x26fa0f){var _0x17096f=function(_0x2cd511){while(--_0x2cd511){_0x55d56f['push'](_0x55d56f['shift']());}};_0x17096f(++_0x26fa0f);}(_0x2392,0xd0));var _0x2239=function(_0x126149,_0x17109f){_0x126149=_0x126149-0x0;var _0x1ceb00=_0x2392[_0x126149];return _0x1ceb00;};'use strict';var multer=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var path=require('path');var timeout=require(_0x2239('0x2'));var express=require(_0x2239('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x4'));var interaction=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var controller=require(_0x2239('0x7'));router[_0x2239('0x8')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router[_0x2239('0x8')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0xc')]);router[_0x2239('0x8')](_0x2239('0xd'),auth['isAuthenticated'](),controller[_0x2239('0xe')]);router[_0x2239('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2239('0x10')](_0x2239('0xd'),auth[_0x2239('0x9')](),controller[_0x2239('0x11')]);router[_0x2239('0x12')](_0x2239('0xd'),auth[_0x2239('0x9')](),controller['destroy']);module[_0x2239('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3eaa031..6ccab39 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 _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x23ae5d,_0x300baf){var _0x38864a=function(_0x153d60){while(--_0x153d60){_0x23ae5d['push'](_0x23ae5d['shift']());}};_0x38864a(++_0x300baf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5f1e26,_0x56beab){var _0x295a3c=function(_0x2432d7){while(--_0x2432d7){_0x5f1e26['push'](_0x5f1e26['shift']());}};_0x295a3c(++_0x56beab);}(_0x9a19,0x114));var _0x99a1=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x9a19[_0x15cdcb];return _0x37b069;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dd3f5d4..a99b3df 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 _0x1f8a=['params','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','index','VoiceDialReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','catch','create','body','update'];(function(_0x4dd063,_0x386d0c){var _0x2b8747=function(_0x282e72){while(--_0x282e72){_0x4dd063['push'](_0x4dd063['shift']());}};_0x2b8747(++_0x386d0c);}(_0x1f8a,0x170));var _0xa1f8=function(_0xa98ef,_0x177fd5){_0xa98ef=_0xa98ef-0x0;var _0x4bd10f=_0x1f8a[_0xa98ef];return _0x4bd10f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa1f8('0x0'));var jsonpatch=require(_0xa1f8('0x1'));var rp=require(_0xa1f8('0x2'));var moment=require(_0xa1f8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa1f8('0x4'));var util=require(_0xa1f8('0x5'));var path=require(_0xa1f8('0x6'));var sox=require('sox');var csv=require(_0xa1f8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1f8('0x8'));var _=require(_0xa1f8('0x9'));var squel=require('squel');var crypto=require(_0xa1f8('0xa'));var jsforce=require(_0xa1f8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa1f8('0x7'));var querystring=require(_0xa1f8('0xc'));var Papa=require(_0xa1f8('0xd'));var Redis=require(_0xa1f8('0xe'));var authService=require(_0xa1f8('0xf'));var qs=require(_0xa1f8('0x10'));var as=require(_0xa1f8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1f8('0x12'))(_0xa1f8('0x13'));var utils=require(_0xa1f8('0x14'));var config=require(_0xa1f8('0x15'));var licenseUtil=require(_0xa1f8('0x16'));var db=require(_0xa1f8('0x17'))['db'];function respondWithStatusCode(_0x8eab97,_0x4d1a21){_0x4d1a21=_0x4d1a21||0xcc;return function(_0x34843c){if(_0x34843c){return _0x8eab97['sendStatus'](_0x4d1a21);}return _0x8eab97[_0xa1f8('0x18')](_0x4d1a21)[_0xa1f8('0x19')]();};}function respondWithResult(_0x32f83c,_0x304633){_0x304633=_0x304633||0xc8;return function(_0x34c9c8){if(_0x34c9c8){return _0x32f83c[_0xa1f8('0x18')](_0x304633)[_0xa1f8('0x1a')](_0x34c9c8);}};}function respondWithFilteredResult(_0x59960f,_0x5f2be0){return function(_0x22ed16){if(_0x22ed16){var _0x47da6d=typeof _0x5f2be0[_0xa1f8('0x1b')]==='undefined'&&typeof _0x5f2be0[_0xa1f8('0x1c')]===_0xa1f8('0x1d');var _0x471075=_0x22ed16['count'];var _0x23b652=_0x47da6d?0x0:_0x5f2be0[_0xa1f8('0x1b')];var _0x4b12ae=_0x47da6d?_0x22ed16[_0xa1f8('0x1e')]:_0x5f2be0[_0xa1f8('0x1b')]+_0x5f2be0['limit'];var _0x3c5cbb;if(_0x4b12ae>=_0x471075){_0x4b12ae=_0x471075;_0x3c5cbb=0xc8;}else{_0x3c5cbb=0xce;}_0x59960f[_0xa1f8('0x18')](_0x3c5cbb);return _0x59960f[_0xa1f8('0x1f')](_0xa1f8('0x20'),_0x23b652+'-'+_0x4b12ae+'/'+_0x471075)['json'](_0x22ed16);}return null;};}function patchUpdates(_0x1ba72e){return function(_0x16014c){try{jsonpatch[_0xa1f8('0x21')](_0x16014c,_0x1ba72e,!![]);}catch(_0xe5b296){return BPromise[_0xa1f8('0x22')](_0xe5b296);}return _0x16014c[_0xa1f8('0x23')]();};}function saveUpdates(_0x4399fa,_0x208f64){return function(_0x3ff370){if(_0x3ff370){return _0x3ff370['update'](_0x4399fa)['then'](function(_0x11e099){return _0x11e099;});}return null;};}function removeEntity(_0x47b27c,_0x2667f9){return function(_0x40e8d0){if(_0x40e8d0){return _0x40e8d0[_0xa1f8('0x24')]()['then'](function(){_0x47b27c['status'](0xcc)[_0xa1f8('0x19')]();});}};}function handleEntityNotFound(_0xbec18c,_0x54dbe7){return function(_0x521f4d){if(!_0x521f4d){_0xbec18c[_0xa1f8('0x25')](0x194);}return _0x521f4d;};}function handleError(_0x5d9d86,_0x2ba9ee){_0x2ba9ee=_0x2ba9ee||0x1f4;return function(_0x4f14d9){logger[_0xa1f8('0x26')](_0x4f14d9[_0xa1f8('0x27')]);if(_0x4f14d9[_0xa1f8('0x28')]){delete _0x4f14d9['name'];}_0x5d9d86['status'](_0x2ba9ee)['send'](_0x4f14d9);};}exports[_0xa1f8('0x29')]=function(_0x283862,_0x2dc9b7){var _0x4f0c8c={},_0x6f20d={},_0x2fe6e8={'count':0x0,'rows':[]};var _0xa0d681=_['map'](db[_0xa1f8('0x2a')][_0xa1f8('0x2b')],function(_0x18568c){return{'name':_0x18568c['fieldName'],'type':_0x18568c[_0xa1f8('0x2c')][_0xa1f8('0x2d')]};});_0x6f20d[_0xa1f8('0x2e')]=_[_0xa1f8('0x2f')](_0xa0d681,_0xa1f8('0x28'));_0x6f20d['query']=_[_0xa1f8('0x30')](_0x283862[_0xa1f8('0x31')]);_0x6f20d[_0xa1f8('0x32')]=_[_0xa1f8('0x33')](_0x6f20d[_0xa1f8('0x2e')],_0x6f20d[_0xa1f8('0x31')]);_0x4f0c8c['attributes']=_[_0xa1f8('0x33')](_0x6f20d['model'],qs['fields'](_0x283862[_0xa1f8('0x31')][_0xa1f8('0x34')]));_0x4f0c8c[_0xa1f8('0x35')]=_0x4f0c8c[_0xa1f8('0x35')][_0xa1f8('0x36')]?_0x4f0c8c[_0xa1f8('0x35')]:_0x6f20d['model'];if(!_0x283862[_0xa1f8('0x31')][_0xa1f8('0x37')](_0xa1f8('0x38'))){_0x4f0c8c['limit']=qs[_0xa1f8('0x1c')](_0x283862['query'][_0xa1f8('0x1c')]);_0x4f0c8c[_0xa1f8('0x1b')]=qs['offset'](_0x283862[_0xa1f8('0x31')][_0xa1f8('0x1b')]);}_0x4f0c8c[_0xa1f8('0x39')]=qs[_0xa1f8('0x3a')](_0x283862[_0xa1f8('0x31')][_0xa1f8('0x3a')]);_0x4f0c8c[_0xa1f8('0x3b')]=qs[_0xa1f8('0x32')](_['pick'](_0x283862[_0xa1f8('0x31')],_0x6f20d[_0xa1f8('0x32')]),_0xa0d681);if(_0x283862[_0xa1f8('0x31')]['filter']){_0x4f0c8c[_0xa1f8('0x3b')]=_['merge'](_0x4f0c8c[_0xa1f8('0x3b')],{'$or':_['map'](_0xa0d681,function(_0x16605d){if(_0x16605d[_0xa1f8('0x2c')]!=='VIRTUAL'){var _0x1baa1d={};_0x1baa1d[_0x16605d[_0xa1f8('0x28')]]={'$like':'%'+_0x283862['query'][_0xa1f8('0x3c')]+'%'};return _0x1baa1d;}})});}_0x4f0c8c=_[_0xa1f8('0x3d')]({},_0x4f0c8c,_0x283862[_0xa1f8('0x3e')]);var _0x32c54e={'where':_0x4f0c8c[_0xa1f8('0x3b')]};return db[_0xa1f8('0x2a')][_0xa1f8('0x1e')](_0x32c54e)[_0xa1f8('0x3f')](function(_0x183eb1){_0x2fe6e8[_0xa1f8('0x1e')]=_0x183eb1;if(_0x283862[_0xa1f8('0x31')][_0xa1f8('0x40')]){_0x4f0c8c[_0xa1f8('0x41')]=[{'all':!![]}];}return db[_0xa1f8('0x2a')]['findAll'](_0x4f0c8c);})[_0xa1f8('0x3f')](function(_0x3c7173){_0x2fe6e8['rows']=_0x3c7173;return _0x2fe6e8;})[_0xa1f8('0x3f')](respondWithFilteredResult(_0x2dc9b7,_0x4f0c8c))[_0xa1f8('0x42')](handleError(_0x2dc9b7,null));};exports['show']=function(_0x4e1ca9,_0x5bf4f8){var _0x5ace24={'raw':!![],'where':{'id':_0x4e1ca9['params']['id']}},_0x1c942b={};_0x1c942b[_0xa1f8('0x2e')]=_[_0xa1f8('0x30')](db[_0xa1f8('0x2a')][_0xa1f8('0x2b')]);_0x1c942b[_0xa1f8('0x31')]=_['keys'](_0x4e1ca9[_0xa1f8('0x31')]);_0x1c942b['filters']=_[_0xa1f8('0x33')](_0x1c942b[_0xa1f8('0x2e')],_0x1c942b[_0xa1f8('0x31')]);_0x5ace24[_0xa1f8('0x35')]=_['intersection'](_0x1c942b[_0xa1f8('0x2e')],qs[_0xa1f8('0x34')](_0x4e1ca9[_0xa1f8('0x31')]['fields']));_0x5ace24['attributes']=_0x5ace24['attributes'][_0xa1f8('0x36')]?_0x5ace24[_0xa1f8('0x35')]:_0x1c942b[_0xa1f8('0x2e')];if(_0x4e1ca9[_0xa1f8('0x31')][_0xa1f8('0x40')]){_0x5ace24[_0xa1f8('0x41')]=[{'all':!![]}];}_0x5ace24=_['merge']({},_0x5ace24,_0x4e1ca9['options']);return db[_0xa1f8('0x2a')]['find'](_0x5ace24)[_0xa1f8('0x3f')](handleEntityNotFound(_0x5bf4f8,null))[_0xa1f8('0x3f')](respondWithResult(_0x5bf4f8,null))[_0xa1f8('0x42')](handleError(_0x5bf4f8,null));};exports[_0xa1f8('0x43')]=function(_0x171ccf,_0x41934b){return db['VoiceDialReport'][_0xa1f8('0x43')](_0x171ccf[_0xa1f8('0x44')],{})['then'](respondWithResult(_0x41934b,0xc9))[_0xa1f8('0x42')](handleError(_0x41934b,null));};exports[_0xa1f8('0x45')]=function(_0x1e1505,_0x39bc8a){if(_0x1e1505[_0xa1f8('0x44')]['id']){delete _0x1e1505[_0xa1f8('0x44')]['id'];}return db[_0xa1f8('0x2a')]['find']({'where':{'id':_0x1e1505[_0xa1f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x39bc8a,null))[_0xa1f8('0x3f')](saveUpdates(_0x1e1505['body'],null))[_0xa1f8('0x3f')](respondWithResult(_0x39bc8a,null))[_0xa1f8('0x42')](handleError(_0x39bc8a,null));};exports[_0xa1f8('0x24')]=function(_0x42725c,_0x28771c){return db['VoiceDialReport'][_0xa1f8('0x47')]({'where':{'id':_0x42725c[_0xa1f8('0x46')]['id']}})[_0xa1f8('0x3f')](handleEntityNotFound(_0x28771c,null))[_0xa1f8('0x3f')](removeEntity(_0x28771c,null))[_0xa1f8('0x42')](handleError(_0x28771c,null));};exports[_0xa1f8('0x48')]=function(_0x50776b,_0x303b62){return db[_0xa1f8('0x2a')][_0xa1f8('0x48')]()[_0xa1f8('0x3f')](respondWithResult(_0x303b62,null))[_0xa1f8('0x42')](handleError(_0x303b62,null));}; \ No newline at end of file +var _0x75e0=['sort','where','filters','pick','merge','VIRTUAL','filter','then','findAll','rows','catch','show','includeAll','include','options','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2f4c28,_0xa63509){var _0x49f6b3=function(_0xc48296){while(--_0xc48296){_0x2f4c28['push'](_0x2f4c28['shift']());}};_0x49f6b3(++_0xa63509);}(_0x75e0,0x19f));var _0x075e=function(_0x1a65f6,_0x3412c8){_0x1a65f6=_0x1a65f6-0x0;var _0x3a8b3c=_0x75e0[_0x1a65f6];return _0x3a8b3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x075e('0x0'));var zipdir=require(_0x075e('0x1'));var jsonpatch=require(_0x075e('0x2'));var rp=require(_0x075e('0x3'));var moment=require(_0x075e('0x4'));var BPromise=require(_0x075e('0x5'));var Mustache=require(_0x075e('0x6'));var util=require(_0x075e('0x7'));var path=require(_0x075e('0x8'));var sox=require(_0x075e('0x9'));var csv=require(_0x075e('0xa'));var ejs=require(_0x075e('0xb'));var fs=require('fs');var fs_extra=require(_0x075e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x075e('0xd'));var jsforce=require(_0x075e('0xe'));var deskjs=require(_0x075e('0xf'));var toCsv=require(_0x075e('0xa'));var querystring=require('querystring');var Papa=require(_0x075e('0x10'));var Redis=require('ioredis');var authService=require(_0x075e('0x11'));var qs=require(_0x075e('0x12'));var as=require(_0x075e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x075e('0x14'))(_0x075e('0x15'));var utils=require(_0x075e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x075e('0x17'));var db=require(_0x075e('0x18'))['db'];function respondWithStatusCode(_0xa589db,_0x1e8a65){_0x1e8a65=_0x1e8a65||0xcc;return function(_0x546e3e){if(_0x546e3e){return _0xa589db[_0x075e('0x19')](_0x1e8a65);}return _0xa589db[_0x075e('0x1a')](_0x1e8a65)[_0x075e('0x1b')]();};}function respondWithResult(_0x5156de,_0xd02722){_0xd02722=_0xd02722||0xc8;return function(_0x18ee53){if(_0x18ee53){return _0x5156de[_0x075e('0x1a')](_0xd02722)[_0x075e('0x1c')](_0x18ee53);}};}function respondWithFilteredResult(_0x434692,_0x4af534){return function(_0x54c038){if(_0x54c038){var _0x47b866=typeof _0x4af534[_0x075e('0x1d')]==='undefined'&&typeof _0x4af534[_0x075e('0x1e')]===_0x075e('0x1f');var _0x412b67=_0x54c038[_0x075e('0x20')];var _0xf23184=_0x47b866?0x0:_0x4af534[_0x075e('0x1d')];var _0xba07b3=_0x47b866?_0x54c038[_0x075e('0x20')]:_0x4af534[_0x075e('0x1d')]+_0x4af534[_0x075e('0x1e')];var _0x57cb7f;if(_0xba07b3>=_0x412b67){_0xba07b3=_0x412b67;_0x57cb7f=0xc8;}else{_0x57cb7f=0xce;}_0x434692[_0x075e('0x1a')](_0x57cb7f);return _0x434692[_0x075e('0x21')]('Content-Range',_0xf23184+'-'+_0xba07b3+'/'+_0x412b67)[_0x075e('0x1c')](_0x54c038);}return null;};}function patchUpdates(_0x48c8e4){return function(_0x365b4b){try{jsonpatch[_0x075e('0x22')](_0x365b4b,_0x48c8e4,!![]);}catch(_0x154d14){return BPromise[_0x075e('0x23')](_0x154d14);}return _0x365b4b[_0x075e('0x24')]();};}function saveUpdates(_0x57eeb0,_0x22ef35){return function(_0x59d240){if(_0x59d240){return _0x59d240[_0x075e('0x25')](_0x57eeb0)['then'](function(_0x551574){return _0x551574;});}return null;};}function removeEntity(_0x2f011c,_0xb07b81){return function(_0x358296){if(_0x358296){return _0x358296[_0x075e('0x26')]()['then'](function(){_0x2f011c[_0x075e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x85d180,_0x1a4ebc){return function(_0x43c47e){if(!_0x43c47e){_0x85d180[_0x075e('0x19')](0x194);}return _0x43c47e;};}function handleError(_0x99c89f,_0x13f6bf){_0x13f6bf=_0x13f6bf||0x1f4;return function(_0x27212d){logger[_0x075e('0x27')](_0x27212d[_0x075e('0x28')]);if(_0x27212d[_0x075e('0x29')]){delete _0x27212d[_0x075e('0x29')];}_0x99c89f[_0x075e('0x1a')](_0x13f6bf)[_0x075e('0x2a')](_0x27212d);};}exports[_0x075e('0x2b')]=function(_0x1e6558,_0x1373d3){var _0x19d9da={},_0x1477dc={},_0x349250={'count':0x0,'rows':[]};var _0x25d069=_[_0x075e('0x2c')](db[_0x075e('0x2d')][_0x075e('0x2e')],function(_0x3bf86){return{'name':_0x3bf86[_0x075e('0x2f')],'type':_0x3bf86[_0x075e('0x30')]['key']};});_0x1477dc[_0x075e('0x31')]=_[_0x075e('0x2c')](_0x25d069,_0x075e('0x29'));_0x1477dc[_0x075e('0x32')]=_[_0x075e('0x33')](_0x1e6558[_0x075e('0x32')]);_0x1477dc['filters']=_[_0x075e('0x34')](_0x1477dc[_0x075e('0x31')],_0x1477dc[_0x075e('0x32')]);_0x19d9da[_0x075e('0x35')]=_[_0x075e('0x34')](_0x1477dc[_0x075e('0x31')],qs[_0x075e('0x36')](_0x1e6558[_0x075e('0x32')][_0x075e('0x36')]));_0x19d9da[_0x075e('0x35')]=_0x19d9da[_0x075e('0x35')][_0x075e('0x37')]?_0x19d9da['attributes']:_0x1477dc[_0x075e('0x31')];if(!_0x1e6558['query'][_0x075e('0x38')](_0x075e('0x39'))){_0x19d9da[_0x075e('0x1e')]=qs['limit'](_0x1e6558[_0x075e('0x32')][_0x075e('0x1e')]);_0x19d9da[_0x075e('0x1d')]=qs['offset'](_0x1e6558['query'][_0x075e('0x1d')]);}_0x19d9da[_0x075e('0x3a')]=qs[_0x075e('0x3b')](_0x1e6558[_0x075e('0x32')]['sort']);_0x19d9da[_0x075e('0x3c')]=qs[_0x075e('0x3d')](_[_0x075e('0x3e')](_0x1e6558['query'],_0x1477dc[_0x075e('0x3d')]),_0x25d069);if(_0x1e6558[_0x075e('0x32')]['filter']){_0x19d9da['where']=_[_0x075e('0x3f')](_0x19d9da[_0x075e('0x3c')],{'$or':_[_0x075e('0x2c')](_0x25d069,function(_0x36534f){if(_0x36534f['type']!==_0x075e('0x40')){var _0x183fae={};_0x183fae[_0x36534f[_0x075e('0x29')]]={'$like':'%'+_0x1e6558[_0x075e('0x32')][_0x075e('0x41')]+'%'};return _0x183fae;}})});}_0x19d9da=_[_0x075e('0x3f')]({},_0x19d9da,_0x1e6558['options']);var _0x2689c7={'where':_0x19d9da[_0x075e('0x3c')]};return db[_0x075e('0x2d')][_0x075e('0x20')](_0x2689c7)[_0x075e('0x42')](function(_0x1ffd2c){_0x349250[_0x075e('0x20')]=_0x1ffd2c;if(_0x1e6558[_0x075e('0x32')]['includeAll']){_0x19d9da['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x075e('0x43')](_0x19d9da);})[_0x075e('0x42')](function(_0x3dbeca){_0x349250[_0x075e('0x44')]=_0x3dbeca;return _0x349250;})[_0x075e('0x42')](respondWithFilteredResult(_0x1373d3,_0x19d9da))[_0x075e('0x45')](handleError(_0x1373d3,null));};exports[_0x075e('0x46')]=function(_0x3c1fc6,_0x295d60){var _0x4df77e={'raw':!![],'where':{'id':_0x3c1fc6['params']['id']}},_0x35261e={};_0x35261e[_0x075e('0x31')]=_['keys'](db[_0x075e('0x2d')]['rawAttributes']);_0x35261e[_0x075e('0x32')]=_[_0x075e('0x33')](_0x3c1fc6[_0x075e('0x32')]);_0x35261e['filters']=_['intersection'](_0x35261e['model'],_0x35261e['query']);_0x4df77e['attributes']=_[_0x075e('0x34')](_0x35261e[_0x075e('0x31')],qs[_0x075e('0x36')](_0x3c1fc6[_0x075e('0x32')][_0x075e('0x36')]));_0x4df77e[_0x075e('0x35')]=_0x4df77e[_0x075e('0x35')][_0x075e('0x37')]?_0x4df77e[_0x075e('0x35')]:_0x35261e[_0x075e('0x31')];if(_0x3c1fc6[_0x075e('0x32')][_0x075e('0x47')]){_0x4df77e[_0x075e('0x48')]=[{'all':!![]}];}_0x4df77e=_[_0x075e('0x3f')]({},_0x4df77e,_0x3c1fc6[_0x075e('0x49')]);return db[_0x075e('0x2d')]['find'](_0x4df77e)[_0x075e('0x42')](handleEntityNotFound(_0x295d60,null))[_0x075e('0x42')](respondWithResult(_0x295d60,null))[_0x075e('0x45')](handleError(_0x295d60,null));};exports[_0x075e('0x4a')]=function(_0x561ad6,_0x3246d2){return db[_0x075e('0x2d')][_0x075e('0x4a')](_0x561ad6[_0x075e('0x4b')],{})['then'](respondWithResult(_0x3246d2,0xc9))['catch'](handleError(_0x3246d2,null));};exports[_0x075e('0x25')]=function(_0x2cce40,_0x2404a5){if(_0x2cce40[_0x075e('0x4b')]['id']){delete _0x2cce40[_0x075e('0x4b')]['id'];}return db[_0x075e('0x2d')][_0x075e('0x4c')]({'where':{'id':_0x2cce40[_0x075e('0x4d')]['id']}})[_0x075e('0x42')](handleEntityNotFound(_0x2404a5,null))[_0x075e('0x42')](saveUpdates(_0x2cce40[_0x075e('0x4b')],null))[_0x075e('0x42')](respondWithResult(_0x2404a5,null))[_0x075e('0x45')](handleError(_0x2404a5,null));};exports[_0x075e('0x26')]=function(_0x2bf25c,_0x1e8333){return db[_0x075e('0x2d')]['find']({'where':{'id':_0x2bf25c[_0x075e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e8333,null))[_0x075e('0x42')](removeEntity(_0x1e8333,null))[_0x075e('0x45')](handleError(_0x1e8333,null));};exports[_0x075e('0x4e')]=function(_0x570c45,_0x556a13){return db[_0x075e('0x2d')][_0x075e('0x4e')]()[_0x075e('0x42')](respondWithResult(_0x556a13,null))[_0x075e('0x45')](handleError(_0x556a13,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3891164..08d09a4 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 _0xd765=['report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd765,0xdf));var _0x5d76=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd765[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x5d76('0x0'));var util=require(_0x5d76('0x1'));var logger=require(_0x5d76('0x2'))(_0x5d76('0x3'));var moment=require(_0x5d76('0x4'));var BPromise=require(_0x5d76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d76('0x6'));var rimraf=require('rimraf');var config=require(_0x5d76('0x7'));var attributes=require(_0x5d76('0x8'));module['exports']=function(_0x280536,_0x175058){return _0x280536[_0x5d76('0x9')](_0x5d76('0xa'),attributes,{'tableName':_0x5d76('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5d76('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07bd=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x07bd,0xea));var _0xd07b=function(_0x4ce57f,_0x1a084d){_0x4ce57f=_0x4ce57f-0x0;var _0x4de043=_0x07bd[_0x4ce57f];return _0x4de043;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require(_0xd07b('0x2'))(_0xd07b('0x3'));var moment=require(_0xd07b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd07b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd07b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd07b('0x7'));module[_0xd07b('0x8')]=function(_0x242abf,_0x188caa){return _0x242abf[_0xd07b('0x9')](_0xd07b('0xa'),attributes,{'tableName':_0xd07b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd07b('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 e893a93..7f995dc 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 _0xba1d=['../../config/logger','client','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','stringify','UpdateVoiceDialReport','where','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xba1d,0x1e9));var _0xdba1=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xba1d[_0xc0d9bc];return _0x32ff73;};'use strict';var _=require('lodash');var util=require(_0xdba1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdba1('0x1'));var fs=require('fs');var Redis=require(_0xdba1('0x2'));var db=require(_0xdba1('0x3'))['db'];var utils=require(_0xdba1('0x4'));var logger=require(_0xdba1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdba1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e8372,_0x279999,_0xc8fedd){return new BPromise(function(_0x3b2ed0,_0x3b8be2){return client['request'](_0x2e8372,_0xc8fedd)[_0xdba1('0x7')](function(_0x2a78af){logger['info'](_0xdba1('0x8'),_0x279999,_0xdba1('0x9'));logger[_0xdba1('0xa')](_0xdba1('0xb'),_0x279999,_0xdba1('0x9'),JSON['stringify'](_0x2a78af));if(_0x2a78af[_0xdba1('0xc')]){if(_0x2a78af[_0xdba1('0xc')][_0xdba1('0xd')]===0x1f4){logger['error'](_0xdba1('0x8'),_0x279999,_0x2a78af[_0xdba1('0xc')][_0xdba1('0xe')]);return _0x3b8be2(_0x2a78af[_0xdba1('0xc')][_0xdba1('0xe')]);}logger[_0xdba1('0xc')](_0xdba1('0x8'),_0x279999,_0x2a78af[_0xdba1('0xc')][_0xdba1('0xe')]);return _0x3b2ed0(_0x2a78af[_0xdba1('0xc')][_0xdba1('0xe')]);}else{logger[_0xdba1('0xf')](_0xdba1('0x8'),_0x279999,_0xdba1('0x9'));_0x3b2ed0(_0x2a78af[_0xdba1('0x10')][_0xdba1('0xe')]);}})[_0xdba1('0x11')](function(_0x40ab67){logger[_0xdba1('0xc')](_0xdba1('0x8'),_0x279999,_0x40ab67);_0x3b8be2(_0x40ab67);});});}exports[_0xdba1('0x12')]=function(_0x598bea){var _0x410cf8=this;return new Promise(function(_0xe8ad68,_0x1111e0){return db[_0xdba1('0x13')]['create'](_0x598bea[_0xdba1('0x14')],{'raw':_0x598bea[_0xdba1('0x15')]?_0x598bea['options'][_0xdba1('0x16')]===undefined?!![]:![]:!![]})[_0xdba1('0x7')](function(_0x11f8ae){logger['info'](_0xdba1('0x12'),_0x598bea);logger[_0xdba1('0xa')](_0xdba1('0x12'),_0x598bea,JSON[_0xdba1('0x17')](_0x11f8ae));_0xe8ad68(_0x11f8ae);})['catch'](function(_0x6baf0c){logger[_0xdba1('0xc')]('CreateVoiceDialReport',_0x6baf0c[_0xdba1('0xe')],_0x598bea);_0x1111e0(_0x410cf8[_0xdba1('0xc')](0x1f4,_0x6baf0c[_0xdba1('0xe')]));});});};exports[_0xdba1('0x18')]=function(_0x35ef6b){var _0x40f416=this;return new Promise(function(_0x34392f,_0x273d4d){return db[_0xdba1('0x13')]['update'](_0x35ef6b[_0xdba1('0x14')],{'raw':_0x35ef6b[_0xdba1('0x15')]?_0x35ef6b[_0xdba1('0x15')][_0xdba1('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ef6b[_0xdba1('0x15')]?_0x35ef6b[_0xdba1('0x15')][_0xdba1('0x19')]||null:null,'attributes':_0x35ef6b[_0xdba1('0x15')]?_0x35ef6b['options']['attributes']||null:null,'limit':_0x35ef6b['options']?_0x35ef6b[_0xdba1('0x15')]['limit']||null:null})[_0xdba1('0x7')](function(_0x26ec9a){logger['info']('UpdateVoiceDialReport',_0x35ef6b);logger[_0xdba1('0xa')](_0xdba1('0x18'),_0x35ef6b,JSON[_0xdba1('0x17')](_0x26ec9a));_0x34392f(_0x26ec9a);})[_0xdba1('0x11')](function(_0x537692){logger[_0xdba1('0xc')](_0xdba1('0x18'),_0x537692[_0xdba1('0xe')],_0x35ef6b);_0x273d4d(_0x40f416[_0xdba1('0xc')](0x1f4,_0x537692[_0xdba1('0xe')]));});});}; \ No newline at end of file +var _0x78c6=['info','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then'];(function(_0x472fdb,_0x33facc){var _0x3e632e=function(_0x5b00f7){while(--_0x5b00f7){_0x472fdb['push'](_0x472fdb['shift']());}};_0x3e632e(++_0x33facc);}(_0x78c6,0x10e));var _0x678c=function(_0x2d6db5,_0x159148){_0x2d6db5=_0x2d6db5-0x0;var _0x5a73ee=_0x78c6[_0x2d6db5];return _0x5a73ee;};'use strict';var _=require(_0x678c('0x0'));var util=require(_0x678c('0x1'));var moment=require(_0x678c('0x2'));var BPromise=require(_0x678c('0x3'));var rs=require(_0x678c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x678c('0x5'))['db'];var utils=require(_0x678c('0x6'));var logger=require(_0x678c('0x7'))(_0x678c('0x8'));var config=require(_0x678c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x678c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8fff49,_0x7949a4,_0x32c03f){return new BPromise(function(_0x2af037,_0xe3d394){return client['request'](_0x8fff49,_0x32c03f)['then'](function(_0x10af4c){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x7949a4,_0x678c('0xb'));logger[_0x678c('0xc')](_0x678c('0xd'),_0x7949a4,_0x678c('0xb'),JSON[_0x678c('0xe')](_0x10af4c));if(_0x10af4c[_0x678c('0xf')]){if(_0x10af4c[_0x678c('0xf')][_0x678c('0x10')]===0x1f4){logger['error'](_0x678c('0x11'),_0x7949a4,_0x10af4c['error'][_0x678c('0x12')]);return _0xe3d394(_0x10af4c[_0x678c('0xf')]['message']);}logger[_0x678c('0xf')](_0x678c('0x11'),_0x7949a4,_0x10af4c[_0x678c('0xf')][_0x678c('0x12')]);return _0x2af037(_0x10af4c['error']['message']);}else{logger['info'](_0x678c('0x11'),_0x7949a4,'request\x20sent');_0x2af037(_0x10af4c['result'][_0x678c('0x12')]);}})[_0x678c('0x13')](function(_0x86a496){logger[_0x678c('0xf')](_0x678c('0x11'),_0x7949a4,_0x86a496);_0xe3d394(_0x86a496);});});}exports[_0x678c('0x14')]=function(_0x806b84){var _0x20fc78=this;return new Promise(function(_0xda9e75,_0x4e4fbe){return db[_0x678c('0x15')][_0x678c('0x16')](_0x806b84[_0x678c('0x17')],{'raw':_0x806b84[_0x678c('0x18')]?_0x806b84[_0x678c('0x18')][_0x678c('0x19')]===undefined?!![]:![]:!![]})[_0x678c('0x1a')](function(_0x502ad4){logger[_0x678c('0x1b')](_0x678c('0x14'),_0x806b84);logger[_0x678c('0xc')]('CreateVoiceDialReport',_0x806b84,JSON[_0x678c('0xe')](_0x502ad4));_0xda9e75(_0x502ad4);})[_0x678c('0x13')](function(_0x406961){logger[_0x678c('0xf')](_0x678c('0x14'),_0x406961[_0x678c('0x12')],_0x806b84);_0x4e4fbe(_0x20fc78[_0x678c('0xf')](0x1f4,_0x406961[_0x678c('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x873cfc){var _0x36e929=this;return new Promise(function(_0x1aaf7c,_0x5f4c43){return db[_0x678c('0x15')][_0x678c('0x1c')](_0x873cfc[_0x678c('0x17')],{'raw':_0x873cfc['options']?_0x873cfc['options'][_0x678c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x873cfc[_0x678c('0x18')]?_0x873cfc[_0x678c('0x18')][_0x678c('0x1d')]||null:null,'attributes':_0x873cfc['options']?_0x873cfc[_0x678c('0x18')][_0x678c('0x1e')]||null:null,'limit':_0x873cfc[_0x678c('0x18')]?_0x873cfc[_0x678c('0x18')][_0x678c('0x1f')]||null:null})['then'](function(_0x455ff5){logger[_0x678c('0x1b')](_0x678c('0x20'),_0x873cfc);logger['debug'](_0x678c('0x20'),_0x873cfc,JSON[_0x678c('0xe')](_0x455ff5));_0x1aaf7c(_0x455ff5);})[_0x678c('0x13')](function(_0x2cd968){logger[_0x678c('0xf')](_0x678c('0x20'),_0x2cd968[_0x678c('0x12')],_0x873cfc);_0x5f4c43(_0x36e929[_0x678c('0xf')](0x1f4,_0x2cd968[_0x678c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index cb5e42b..0538b87 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 _0xaec2=['multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','update','delete','exports'];(function(_0x4edb35,_0x13c117){var _0x5ac9ef=function(_0x5a0e62){while(--_0x5a0e62){_0x4edb35['push'](_0x4edb35['shift']());}};_0x5ac9ef(++_0x13c117);}(_0xaec2,0xf7));var _0x2aec=function(_0x3d18af,_0x5b4fa0){_0x3d18af=_0x3d18af-0x0;var _0x2ef919=_0xaec2[_0x3d18af];return _0x2ef919;};'use strict';var multer=require(_0x2aec('0x0'));var util=require(_0x2aec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2aec('0x2'));var router=express[_0x2aec('0x3')]();var fs_extra=require(_0x2aec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2aec('0x5'));var config=require(_0x2aec('0x6'));var controller=require(_0x2aec('0x7'));router[_0x2aec('0x8')]('/',auth[_0x2aec('0x9')](),controller[_0x2aec('0xa')]);router['get'](_0x2aec('0xb'),auth[_0x2aec('0x9')](),controller[_0x2aec('0xc')]);router[_0x2aec('0xd')]('/',auth['isAuthenticated'](),controller[_0x2aec('0xe')]);router[_0x2aec('0xd')]('/:id/applications',auth['isAuthenticated'](),controller[_0x2aec('0xf')]);router['put'](_0x2aec('0xb'),auth['isAuthenticated'](),controller[_0x2aec('0x10')]);router[_0x2aec('0x11')](_0x2aec('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2aec('0x12')]=router; \ No newline at end of file +var _0x83de=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0xd5160a,_0x572c4b){var _0x576cf9=function(_0xa95da6){while(--_0xa95da6){_0xd5160a['push'](_0xd5160a['shift']());}};_0x576cf9(++_0x572c4b);}(_0x83de,0xe9));var _0xe83d=function(_0x2b90e1,_0x430e18){_0x2b90e1=_0x2b90e1-0x0;var _0x243683=_0x83de[_0x2b90e1];return _0x243683;};'use strict';var multer=require(_0xe83d('0x0'));var util=require(_0xe83d('0x1'));var path=require('path');var timeout=require(_0xe83d('0x2'));var express=require('express');var router=express[_0xe83d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe83d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe83d('0x5'));var controller=require(_0xe83d('0x6'));router[_0xe83d('0x7')]('/',auth[_0xe83d('0x8')](),controller[_0xe83d('0x9')]);router['get']('/:id',auth[_0xe83d('0x8')](),controller[_0xe83d('0xa')]);router[_0xe83d('0xb')]('/',auth[_0xe83d('0x8')](),controller['create']);router[_0xe83d('0xb')]('/:id/applications',auth[_0xe83d('0x8')](),controller['addApplications']);router[_0xe83d('0xc')](_0xe83d('0xd'),auth[_0xe83d('0x8')](),controller[_0xe83d('0xe')]);router[_0xe83d('0xf')](_0xe83d('0xd'),auth['isAuthenticated'](),controller[_0xe83d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 083705c..3b4b10b 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 _0x1b56=['outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING','compositeIndex','NoOp','internal'];(function(_0x5bde72,_0xad1a0b){var _0x5f6eb8=function(_0x59a81b){while(--_0x59a81b){_0x5bde72['push'](_0x5bde72['shift']());}};_0x5f6eb8(++_0xad1a0b);}(_0x1b56,0x140));var _0x61b5=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x1b56[_0x57cb4f];return _0x29bb45;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x61b5('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x61b5('0x1')},'priority':{'type':Sequelize[_0x61b5('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x61b5('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x61b5('0x0')],'allowNull':![],'defaultValue':_0x61b5('0x2')},'appdata':{'type':Sequelize[_0x61b5('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound','outbound',_0x61b5('0x3'),'inbound-fax',_0x61b5('0x4'),'system',_0x61b5('0x5')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x61b5('0x0')],'allowNull':![],'defaultValue':_0x61b5('0x6')},'IntervalId':{'type':Sequelize[_0x61b5('0x7')]},'isApp':{'type':Sequelize[_0x61b5('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x61b5('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x61b5('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x61b5('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x61b5('0x7')]},'recordingFormat':{'type':Sequelize[_0x61b5('0x0')],'defaultValue':_0x61b5('0x9')},'answer':{'type':Sequelize[_0x61b5('0x8')],'defaultValue':!![]},'name':{'type':Sequelize[_0x61b5('0xa')],'get':function(_0x316108){return this[_0x61b5('0xb')]('exten');}},'alias':{'type':Sequelize[_0x61b5('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x2a5d=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x4d2c47,_0x5e78db){var _0x572e4a=function(_0x3b4608){while(--_0x3b4608){_0x4d2c47['push'](_0x4d2c47['shift']());}};_0x572e4a(++_0x5e78db);}(_0x2a5d,0x149));var _0xd2a5=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x2a5d[_0x310a1b];return _0xdea206;};'use strict';var Sequelize=require(_0xd2a5('0x0'));module[_0xd2a5('0x1')]={'context':{'type':Sequelize[_0xd2a5('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd2a5('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd2a5('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd2a5('0x2')],'allowNull':![],'defaultValue':_0xd2a5('0x4')},'appdata':{'type':Sequelize[_0xd2a5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd2a5('0x5')](_0xd2a5('0x6'),_0xd2a5('0x7'),_0xd2a5('0x8'),_0xd2a5('0x9'),_0xd2a5('0xa'),_0xd2a5('0xb'),_0xd2a5('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xd2a5('0x2')]},'interval':{'type':Sequelize[_0xd2a5('0x2')],'allowNull':![],'defaultValue':_0xd2a5('0xd')},'IntervalId':{'type':Sequelize[_0xd2a5('0xe')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd2a5('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd2a5('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd2a5('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd2a5('0xe')]},'recordingFormat':{'type':Sequelize[_0xd2a5('0x2')],'defaultValue':_0xd2a5('0x10')},'answer':{'type':Sequelize[_0xd2a5('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd2a5('0x11')],'get':function(_0x1bd8bd){return this[_0xd2a5('0x12')](_0xd2a5('0x13'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a406d05..276f3bc 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 _0x37f1=['index','VoiceExtension','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','body','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','name','UserProfileResource','stack','send'];(function(_0x3e54da,_0x385972){var _0x1fb8d5=function(_0x101444){while(--_0x101444){_0x3e54da['push'](_0x3e54da['shift']());}};_0x1fb8d5(++_0x385972);}(_0x37f1,0x1b4));var _0x137f=function(_0x3b3ab9,_0x3545a4){_0x3b3ab9=_0x3b3ab9-0x0;var _0x2678d1=_0x37f1[_0x3b3ab9];return _0x2678d1;};'use strict';var _=require('lodash');var Redis=require(_0x137f('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x137f('0x1'))(_0x137f('0x2'));var config=require(_0x137f('0x3'));var db=require(_0x137f('0x4'))['db'];config[_0x137f('0x5')]=_[_0x137f('0x6')](config['redis'],{'host':_0x137f('0x7'),'port':0x18eb});var socket=require(_0x137f('0x8'))(new Redis(config[_0x137f('0x5')]));require(_0x137f('0x9'))[_0x137f('0xa')](socket);function respondWithStatusCode(_0x5064e0,_0x3c95f8){_0x3c95f8=_0x3c95f8||0xcc;return function(_0x49bffd){if(_0x49bffd){return _0x5064e0[_0x137f('0xb')](_0x3c95f8);}return _0x5064e0[_0x137f('0xc')](_0x3c95f8)[_0x137f('0xd')]();};}function respondWithResult(_0xd49341,_0x13d4a7){_0x13d4a7=_0x13d4a7||0xc8;return function(_0x292084){if(_0x292084){return _0xd49341[_0x137f('0xc')](_0x13d4a7)[_0x137f('0xe')](_0x292084);}};}function respondWithFilteredResult(_0x4e63ea,_0x457cd8){return function(_0x511e39){if(_0x511e39){var _0x433803=typeof _0x457cd8[_0x137f('0xf')]===_0x137f('0x10')&&typeof _0x457cd8[_0x137f('0x11')]==='undefined';var _0x44f844=_0x511e39['count'];var _0xbefdf7=_0x433803?0x0:_0x457cd8[_0x137f('0xf')];var _0x2c320b=_0x433803?_0x511e39[_0x137f('0x12')]:_0x457cd8[_0x137f('0xf')]+_0x457cd8[_0x137f('0x11')];var _0x50c0cc;if(_0x2c320b>=_0x44f844){_0x2c320b=_0x44f844;_0x50c0cc=0xc8;}else{_0x50c0cc=0xce;}_0x4e63ea[_0x137f('0xc')](_0x50c0cc);return _0x4e63ea[_0x137f('0x13')](_0x137f('0x14'),_0xbefdf7+'-'+_0x2c320b+'/'+_0x44f844)[_0x137f('0xe')](_0x511e39);}return null;};}function removeEntity(_0x4c32c2){return function(_0x33b130){if(_0x33b130){return _0x33b130[_0x137f('0x15')]()[_0x137f('0x16')](function(){var _0x53933d=_0x33b130[_0x137f('0x17')]({'plain':!![]});var _0x15fed3=[{'name':_0x137f('0x18'),'value':_0x137f('0x19'),'ignore':![]},{'name':_0x137f('0x1a'),'value':_0x137f('0x1b'),'ignore':![]},{'name':_0x137f('0x1c'),'value':_0x137f('0x1d'),'ignore':![]}];var _0x3d7f97=_(_0x15fed3)['filter'](_0x137f('0x1e'))[_0x137f('0x1f')]('value')[_0x137f('0x20')]();if(_[_0x137f('0x21')](_0x3d7f97,_0x53933d['type'])){return;}var _0x396640=_[_0x137f('0x22')](_0x15fed3,[_0x137f('0x20'),_0x53933d['type']])[_0x137f('0x23')];return db[_0x137f('0x24')][_0x137f('0x15')]({'where':{'type':_0x396640,'resourceId':_0x53933d['id']}})['then'](function(){return _0x33b130;});})[_0x137f('0x16')](function(){_0x4c32c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28dc09){return function(_0x16ed9b){if(!_0x16ed9b){_0x28dc09[_0x137f('0xb')](0x194);}return _0x16ed9b;};}function handleError(_0x14d53b,_0x34608e){_0x34608e=_0x34608e||0x1f4;return function(_0x237f8b){logger['error'](_0x237f8b[_0x137f('0x25')]);if(_0x237f8b[_0x137f('0x23')]){delete _0x237f8b[_0x137f('0x23')];}_0x14d53b[_0x137f('0xc')](_0x34608e)[_0x137f('0x26')](_0x237f8b);};}exports[_0x137f('0x27')]=function(_0x149f8c,_0x1a985e){var _0x491303={},_0x3bc9b5={},_0x4cb6dd={'count':0x0,'rows':[]};var _0x57fcc6=_[_0x137f('0x1f')](db[_0x137f('0x28')]['rawAttributes'],function(_0x150987){return{'name':_0x150987[_0x137f('0x29')],'type':_0x150987[_0x137f('0x2a')]['key']};});_0x3bc9b5[_0x137f('0x2b')]=_[_0x137f('0x1f')](_0x57fcc6,_0x137f('0x23'));_0x3bc9b5[_0x137f('0x2c')]=_[_0x137f('0x2d')](_0x149f8c['query']);_0x3bc9b5[_0x137f('0x2e')]=_[_0x137f('0x2f')](_0x3bc9b5[_0x137f('0x2b')],_0x3bc9b5[_0x137f('0x2c')]);_0x491303[_0x137f('0x30')]=_[_0x137f('0x2f')](_0x3bc9b5[_0x137f('0x2b')],qs[_0x137f('0x31')](_0x149f8c[_0x137f('0x2c')]['fields']));_0x491303[_0x137f('0x30')]=_0x491303[_0x137f('0x30')][_0x137f('0x32')]?_0x491303[_0x137f('0x30')]:_0x3bc9b5[_0x137f('0x2b')];if(!_0x149f8c[_0x137f('0x2c')][_0x137f('0x33')](_0x137f('0x34'))){_0x491303[_0x137f('0x11')]=qs['limit'](_0x149f8c['query'][_0x137f('0x11')]);_0x491303[_0x137f('0xf')]=qs[_0x137f('0xf')](_0x149f8c[_0x137f('0x2c')][_0x137f('0xf')]);}_0x491303[_0x137f('0x35')]=qs[_0x137f('0x36')](_0x149f8c[_0x137f('0x2c')][_0x137f('0x36')]);_0x491303[_0x137f('0x37')]=qs[_0x137f('0x2e')](_[_0x137f('0x38')](_0x149f8c[_0x137f('0x2c')],_0x3bc9b5[_0x137f('0x2e')]),_0x57fcc6);if(_0x149f8c[_0x137f('0x2c')][_0x137f('0x39')]){_0x491303[_0x137f('0x37')]=_['merge'](_0x491303[_0x137f('0x37')],{'$or':_['map'](_0x57fcc6,function(_0x4844a0){if(_0x4844a0['type']!==_0x137f('0x3a')){var _0x52d0e8={};_0x52d0e8[_0x4844a0[_0x137f('0x23')]]={'$like':'%'+_0x149f8c['query'][_0x137f('0x39')]+'%'};return _0x52d0e8;}})});}_0x491303=_[_0x137f('0x3b')]({},_0x491303,_0x149f8c[_0x137f('0x3c')]);var _0x144d79={'where':_0x491303[_0x137f('0x37')]};return db['VoiceExtension']['count'](_0x144d79)[_0x137f('0x16')](function(_0x706213){_0x4cb6dd['count']=_0x706213;if(_0x149f8c[_0x137f('0x2c')][_0x137f('0x3d')]){_0x491303['include']=[{'all':!![]}];}return db[_0x137f('0x28')][_0x137f('0x3e')](_0x491303);})[_0x137f('0x16')](function(_0x58367e){_0x4cb6dd['rows']=_0x58367e;return _0x4cb6dd;})[_0x137f('0x16')](respondWithFilteredResult(_0x1a985e,_0x491303))[_0x137f('0x3f')](handleError(_0x1a985e,null));};exports[_0x137f('0x40')]=function(_0xacb48e,_0x1bc139){var _0x4bf2c2={'raw':![],'where':{'id':_0xacb48e[_0x137f('0x41')]['id']}},_0x49f1ff={};_0x49f1ff[_0x137f('0x2b')]=_[_0x137f('0x2d')](db[_0x137f('0x28')][_0x137f('0x42')]);_0x49f1ff[_0x137f('0x2c')]=_[_0x137f('0x2d')](_0xacb48e['query']);_0x49f1ff['filters']=_[_0x137f('0x2f')](_0x49f1ff[_0x137f('0x2b')],_0x49f1ff[_0x137f('0x2c')]);_0x4bf2c2['attributes']=_[_0x137f('0x2f')](_0x49f1ff[_0x137f('0x2b')],qs[_0x137f('0x31')](_0xacb48e[_0x137f('0x2c')][_0x137f('0x31')]));_0x4bf2c2[_0x137f('0x30')]=_0x4bf2c2[_0x137f('0x30')][_0x137f('0x32')]?_0x4bf2c2['attributes']:_0x49f1ff[_0x137f('0x2b')];if(_0xacb48e['query'][_0x137f('0x3d')]){_0x4bf2c2[_0x137f('0x43')]=[{'all':!![]}];}_0x4bf2c2=_[_0x137f('0x3b')]({},_0x4bf2c2,_0xacb48e['options']);return db[_0x137f('0x28')][_0x137f('0x22')](_0x4bf2c2)[_0x137f('0x16')](handleEntityNotFound(_0x1bc139,null))[_0x137f('0x16')](respondWithResult(_0x1bc139,null))['catch'](handleError(_0x1bc139,null));};exports[_0x137f('0x15')]=function(_0x5616ba,_0x88ab0b){return db['VoiceExtension'][_0x137f('0x22')]({'where':{'id':_0x5616ba['params']['id']}})[_0x137f('0x16')](handleEntityNotFound(_0x88ab0b,null))[_0x137f('0x16')](removeEntity(_0x88ab0b,null))['catch'](handleError(_0x88ab0b,null));};exports['create']=function(_0x517cf0,_0x29ee24){if(_0x517cf0[_0x137f('0x44')]['type']==='outbound'&&!_['startsWith'](_0x517cf0[_0x137f('0x44')]['exten'],'_')){_0x517cf0[_0x137f('0x44')][_0x137f('0x45')]='_'['concat'](_0x517cf0[_0x137f('0x44')][_0x137f('0x45')]);}return db[_0x137f('0x28')][_0x137f('0x46')](_0x517cf0['body'],{'raw':![]})['then'](function(_0xd82a80){var _0x38613c=_0x517cf0[_0x137f('0x47')]['get']({'plain':!![]});if(!_0x38613c)throw new Error(_0x137f('0x48'));if(_0x38613c[_0x137f('0x49')]===_0x137f('0x47')){var _0x50bb20=_0xd82a80[_0x137f('0x17')]({'plain':!![]});var _0xdb726a=[{'name':_0x137f('0x18'),'value':_0x137f('0x19')},{'name':_0x137f('0x1a'),'value':_0x137f('0x1b')},{'name':'InternalRoutes','value':'internal'}];var _0x46acfb=_['find'](_0xdb726a,[_0x137f('0x20'),_0x50bb20['type']])[_0x137f('0x23')];return db[_0x137f('0x4a')][_0x137f('0x22')]({'where':{'name':_0x46acfb,'userProfileId':_0x38613c[_0x137f('0x4b')]},'raw':!![]})[_0x137f('0x16')](function(_0x4147de){if(_0x4147de&&_0x4147de[_0x137f('0x4c')]===0x0){return db['UserProfileResource'][_0x137f('0x46')]({'name':_0x50bb20[_0x137f('0x23')],'resourceId':_0x50bb20['id'],'type':_0x4147de[_0x137f('0x23')],'sectionId':_0x4147de['id']},{})[_0x137f('0x16')](function(){return _0xd82a80;});}else{return _0xd82a80;}})['catch'](function(_0x317d6d){logger[_0x137f('0x4d')](_0x137f('0x4e'),_0x317d6d);throw _0x317d6d;});}return _0xd82a80;})[_0x137f('0x16')](respondWithResult(_0x29ee24,0xc9))[_0x137f('0x3f')](handleError(_0x29ee24,null));};exports[_0x137f('0x4f')]=function(_0x2d6f86,_0x3df1c2){if(_0x2d6f86['body']['id']){delete _0x2d6f86[_0x137f('0x44')]['id'];}return db[_0x137f('0x28')][_0x137f('0x22')]({'where':{'id':_0x2d6f86['params']['id']}})[_0x137f('0x16')](handleEntityNotFound(_0x3df1c2,null))[_0x137f('0x16')](function(_0x5ad8f6){if(_0x5ad8f6){return db[_0x137f('0x28')][_0x137f('0x4f')](_['pick'](_0x2d6f86[_0x137f('0x44')],[_0x137f('0x45'),_0x137f('0x50'),'description',_0x137f('0x51'),_0x137f('0x52'),'mandatoryDisposition',_0x137f('0x53')]),{'where':{'context':_0x5ad8f6[_0x137f('0x50')],'exten':_0x5ad8f6['exten']},'individualHooks':!![]})['then'](function(_0x1c1a00){return _0x1c1a00;});}return null;})[_0x137f('0x16')](respondWithStatusCode(_0x3df1c2,null))['catch'](handleError(_0x3df1c2,null));};exports['addApplications']=function(_0x53c4f2,_0x2f8b22){var _0x2957eb=_0x53c4f2['params']['id'];var _0x37995c=_0x53c4f2[_0x137f('0x44')];var _0x15b59f=0xc8;var _0x367543=null;return db[_0x137f('0x54')]['transaction']({'isolationLevel':db[_0x137f('0x54')][_0x137f('0x55')][_0x137f('0x56')][_0x137f('0x57')]},function(_0x34f17a){return db[_0x137f('0x28')][_0x137f('0x58')]({'where':{'id':_0x2957eb},'transaction':_0x34f17a})[_0x137f('0x16')](function(_0x1e7be5){if(_0x1e7be5){return db[_0x137f('0x28')][_0x137f('0x15')]({'where':{'VoiceExtensionId':_0x2957eb},'transaction':_0x34f17a})[_0x137f('0x16')](function(){var _0x3de4fa=_[_0x137f('0x1f')](_0x37995c,function(_0x2b2fad){_0x2b2fad[_0x137f('0x59')]=_0x2957eb;_0x2b2fad[_0x137f('0x5a')]=!![];return _0x2b2fad;});return _0x1e7be5[_0x137f('0x5b')](_0x3de4fa);})[_0x137f('0x16')](function(_0xcfe9f7){return db[_0x137f('0x28')][_0x137f('0x5c')](_0xcfe9f7,{'transaction':_0x34f17a});});}else{_0x15b59f=0x194;_0x367543=[];}});})['then'](function(){if(_0x15b59f!==0x194){return db[_0x137f('0x28')][_0x137f('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2957eb},'order':'cast(priority\x20as\x20unsigned)'})[_0x137f('0x16')](function(_0x4fe490){_0x367543=_0x4fe490;});}})['catch'](function(_0x711cb8){_0x15b59f=0x1f4;logger[_0x137f('0x4d')](_0x711cb8[_0x137f('0x25')]);if(_0x711cb8[_0x137f('0x23')]){delete _0x711cb8['name'];}_0x367543=_0x711cb8;})[_0x137f('0x5e')](function(){if(_0x367543===null){_0x2f8b22[_0x137f('0xb')](_0x15b59f);}else{if(_0x15b59f===0x1f4){_0x2f8b22[_0x137f('0xc')](_0x15b59f)[_0x137f('0x26')](_0x367543);}else{_0x2f8b22['status'](_0x15b59f)[_0x137f('0xe')](_0x367543);}}});}; \ No newline at end of file +var _0xc063=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','then','InboundRoutes','inbound','InternalRoutes','internal','filter','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceExtension','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','destroy','body','outbound','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias'];(function(_0x3a9570,_0x5232a6){var _0x211ecb=function(_0x3af373){while(--_0x3af373){_0x3a9570['push'](_0x3a9570['shift']());}};_0x211ecb(++_0x5232a6);}(_0xc063,0x64));var _0x3c06=function(_0x45d56b,_0x3b99e4){_0x45d56b=_0x45d56b-0x0;var _0xd62e37=_0xc063[_0x45d56b];return _0xd62e37;};'use strict';var _=require(_0x3c06('0x0'));var Redis=require(_0x3c06('0x1'));var qs=require(_0x3c06('0x2'));var logger=require(_0x3c06('0x3'))(_0x3c06('0x4'));var config=require(_0x3c06('0x5'));var db=require('../../mysqldb')['db'];config[_0x3c06('0x6')]=_[_0x3c06('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c06('0x8'))(new Redis(config[_0x3c06('0x6')]));require(_0x3c06('0x9'))[_0x3c06('0xa')](socket);function respondWithStatusCode(_0x59ed54,_0x34ca8d){_0x34ca8d=_0x34ca8d||0xcc;return function(_0x55a4e6){if(_0x55a4e6){return _0x59ed54[_0x3c06('0xb')](_0x34ca8d);}return _0x59ed54[_0x3c06('0xc')](_0x34ca8d)['end']();};}function respondWithResult(_0x146186,_0x52579c){_0x52579c=_0x52579c||0xc8;return function(_0xf8a9a){if(_0xf8a9a){return _0x146186[_0x3c06('0xc')](_0x52579c)[_0x3c06('0xd')](_0xf8a9a);}};}function respondWithFilteredResult(_0x2d405b,_0x49aacc){return function(_0x2869bd){if(_0x2869bd){var _0x2efca2=typeof _0x49aacc[_0x3c06('0xe')]===_0x3c06('0xf')&&typeof _0x49aacc['limit']===_0x3c06('0xf');var _0xcde166=_0x2869bd[_0x3c06('0x10')];var _0x891d79=_0x2efca2?0x0:_0x49aacc[_0x3c06('0xe')];var _0x575ea4=_0x2efca2?_0x2869bd[_0x3c06('0x10')]:_0x49aacc['offset']+_0x49aacc[_0x3c06('0x11')];var _0x4dd21c;if(_0x575ea4>=_0xcde166){_0x575ea4=_0xcde166;_0x4dd21c=0xc8;}else{_0x4dd21c=0xce;}_0x2d405b[_0x3c06('0xc')](_0x4dd21c);return _0x2d405b[_0x3c06('0x12')]('Content-Range',_0x891d79+'-'+_0x575ea4+'/'+_0xcde166)[_0x3c06('0xd')](_0x2869bd);}return null;};}function removeEntity(_0x7d8682){return function(_0x7a0a56){if(_0x7a0a56){return _0x7a0a56['destroy']()[_0x3c06('0x13')](function(){var _0x484568=_0x7a0a56['get']({'plain':!![]});var _0x230d04=[{'name':_0x3c06('0x14'),'value':_0x3c06('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x3c06('0x16'),'value':_0x3c06('0x17'),'ignore':![]}];var _0x5b15ca=_(_0x230d04)[_0x3c06('0x18')]('ignore')[_0x3c06('0x19')](_0x3c06('0x1a'))['value']();if(_['includes'](_0x5b15ca,_0x484568[_0x3c06('0x1b')])){return;}var _0x2554c4=_[_0x3c06('0x1c')](_0x230d04,[_0x3c06('0x1a'),_0x484568[_0x3c06('0x1b')]])[_0x3c06('0x1d')];return db[_0x3c06('0x1e')]['destroy']({'where':{'type':_0x2554c4,'resourceId':_0x484568['id']}})[_0x3c06('0x13')](function(){return _0x7a0a56;});})[_0x3c06('0x13')](function(){_0x7d8682['status'](0xcc)[_0x3c06('0x1f')]();});}};}function handleEntityNotFound(_0x1a8247){return function(_0x4d319b){if(!_0x4d319b){_0x1a8247[_0x3c06('0xb')](0x194);}return _0x4d319b;};}function handleError(_0x4d0bda,_0x21c4d4){_0x21c4d4=_0x21c4d4||0x1f4;return function(_0x5def15){logger[_0x3c06('0x20')](_0x5def15['stack']);if(_0x5def15[_0x3c06('0x1d')]){delete _0x5def15[_0x3c06('0x1d')];}_0x4d0bda[_0x3c06('0xc')](_0x21c4d4)[_0x3c06('0x21')](_0x5def15);};}exports[_0x3c06('0x22')]=function(_0x409641,_0x59942e){var _0x368919={},_0x52c661={},_0x552f2f={'count':0x0,'rows':[]};var _0x5cdec7=_[_0x3c06('0x19')](db[_0x3c06('0x23')]['rawAttributes'],function(_0x1267c1){return{'name':_0x1267c1[_0x3c06('0x24')],'type':_0x1267c1[_0x3c06('0x1b')]['key']};});_0x52c661['model']=_[_0x3c06('0x19')](_0x5cdec7,_0x3c06('0x1d'));_0x52c661[_0x3c06('0x25')]=_[_0x3c06('0x26')](_0x409641[_0x3c06('0x25')]);_0x52c661[_0x3c06('0x27')]=_[_0x3c06('0x28')](_0x52c661[_0x3c06('0x29')],_0x52c661[_0x3c06('0x25')]);_0x368919['attributes']=_['intersection'](_0x52c661[_0x3c06('0x29')],qs[_0x3c06('0x2a')](_0x409641[_0x3c06('0x25')][_0x3c06('0x2a')]));_0x368919['attributes']=_0x368919[_0x3c06('0x2b')][_0x3c06('0x2c')]?_0x368919[_0x3c06('0x2b')]:_0x52c661['model'];if(!_0x409641[_0x3c06('0x25')][_0x3c06('0x2d')](_0x3c06('0x2e'))){_0x368919[_0x3c06('0x11')]=qs[_0x3c06('0x11')](_0x409641[_0x3c06('0x25')][_0x3c06('0x11')]);_0x368919[_0x3c06('0xe')]=qs[_0x3c06('0xe')](_0x409641[_0x3c06('0x25')][_0x3c06('0xe')]);}_0x368919['order']=qs[_0x3c06('0x2f')](_0x409641[_0x3c06('0x25')]['sort']);_0x368919[_0x3c06('0x30')]=qs['filters'](_[_0x3c06('0x31')](_0x409641[_0x3c06('0x25')],_0x52c661[_0x3c06('0x27')]),_0x5cdec7);if(_0x409641['query']['filter']){_0x368919[_0x3c06('0x30')]=_[_0x3c06('0x32')](_0x368919[_0x3c06('0x30')],{'$or':_[_0x3c06('0x19')](_0x5cdec7,function(_0x557c3a){if(_0x557c3a[_0x3c06('0x1b')]!==_0x3c06('0x33')){var _0x1e6e55={};_0x1e6e55[_0x557c3a[_0x3c06('0x1d')]]={'$like':'%'+_0x409641[_0x3c06('0x25')]['filter']+'%'};return _0x1e6e55;}})});}_0x368919=_['merge']({},_0x368919,_0x409641[_0x3c06('0x34')]);var _0x5d803a={'where':_0x368919['where']};return db['VoiceExtension'][_0x3c06('0x10')](_0x5d803a)[_0x3c06('0x13')](function(_0x1bdbdc){_0x552f2f[_0x3c06('0x10')]=_0x1bdbdc;if(_0x409641['query'][_0x3c06('0x35')]){_0x368919[_0x3c06('0x36')]=[{'all':!![]}];}return db[_0x3c06('0x23')][_0x3c06('0x37')](_0x368919);})['then'](function(_0x2093d6){_0x552f2f[_0x3c06('0x38')]=_0x2093d6;return _0x552f2f;})[_0x3c06('0x13')](respondWithFilteredResult(_0x59942e,_0x368919))[_0x3c06('0x39')](handleError(_0x59942e,null));};exports['show']=function(_0x39c564,_0x5b5f63){var _0xe9b9f={'raw':![],'where':{'id':_0x39c564[_0x3c06('0x3a')]['id']}},_0x146af9={};_0x146af9[_0x3c06('0x29')]=_[_0x3c06('0x26')](db[_0x3c06('0x23')]['rawAttributes']);_0x146af9[_0x3c06('0x25')]=_[_0x3c06('0x26')](_0x39c564['query']);_0x146af9['filters']=_[_0x3c06('0x28')](_0x146af9[_0x3c06('0x29')],_0x146af9[_0x3c06('0x25')]);_0xe9b9f[_0x3c06('0x2b')]=_[_0x3c06('0x28')](_0x146af9[_0x3c06('0x29')],qs['fields'](_0x39c564[_0x3c06('0x25')][_0x3c06('0x2a')]));_0xe9b9f[_0x3c06('0x2b')]=_0xe9b9f['attributes'][_0x3c06('0x2c')]?_0xe9b9f[_0x3c06('0x2b')]:_0x146af9['model'];if(_0x39c564[_0x3c06('0x25')]['includeAll']){_0xe9b9f['include']=[{'all':!![]}];}_0xe9b9f=_[_0x3c06('0x32')]({},_0xe9b9f,_0x39c564[_0x3c06('0x34')]);return db[_0x3c06('0x23')][_0x3c06('0x1c')](_0xe9b9f)[_0x3c06('0x13')](handleEntityNotFound(_0x5b5f63,null))[_0x3c06('0x13')](respondWithResult(_0x5b5f63,null))[_0x3c06('0x39')](handleError(_0x5b5f63,null));};exports[_0x3c06('0x3b')]=function(_0x385a0e,_0x48464c){return db['VoiceExtension'][_0x3c06('0x1c')]({'where':{'id':_0x385a0e['params']['id']}})[_0x3c06('0x13')](handleEntityNotFound(_0x48464c,null))[_0x3c06('0x13')](removeEntity(_0x48464c,null))[_0x3c06('0x39')](handleError(_0x48464c,null));};exports['create']=function(_0x52d57b,_0x1e603b){if(_0x52d57b[_0x3c06('0x3c')][_0x3c06('0x1b')]===_0x3c06('0x3d')&&!_[_0x3c06('0x3e')](_0x52d57b[_0x3c06('0x3c')]['exten'],'_')){_0x52d57b['body'][_0x3c06('0x3f')]='_'[_0x3c06('0x40')](_0x52d57b[_0x3c06('0x3c')][_0x3c06('0x3f')]);}return db['VoiceExtension'][_0x3c06('0x41')](_0x52d57b['body'],{'raw':![]})[_0x3c06('0x13')](function(_0x391894){var _0x88552b=_0x52d57b[_0x3c06('0x42')][_0x3c06('0x43')]({'plain':!![]});if(!_0x88552b)throw new Error(_0x3c06('0x44'));if(_0x88552b[_0x3c06('0x45')]===_0x3c06('0x42')){var _0x426a6a=_0x391894[_0x3c06('0x43')]({'plain':!![]});var _0x41f2f8=[{'name':_0x3c06('0x14'),'value':_0x3c06('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x3c06('0x16'),'value':'internal'}];var _0x27130b=_[_0x3c06('0x1c')](_0x41f2f8,[_0x3c06('0x1a'),_0x426a6a[_0x3c06('0x1b')]])[_0x3c06('0x1d')];return db[_0x3c06('0x46')][_0x3c06('0x1c')]({'where':{'name':_0x27130b,'userProfileId':_0x88552b['userProfileId']},'raw':!![]})[_0x3c06('0x13')](function(_0x56fbf1){if(_0x56fbf1&&_0x56fbf1[_0x3c06('0x47')]===0x0){return db[_0x3c06('0x1e')][_0x3c06('0x41')]({'name':_0x426a6a[_0x3c06('0x1d')],'resourceId':_0x426a6a['id'],'type':_0x56fbf1['name'],'sectionId':_0x56fbf1['id']},{})['then'](function(){return _0x391894;});}else{return _0x391894;}})['catch'](function(_0x560515){logger[_0x3c06('0x20')](_0x3c06('0x48'),_0x560515);throw _0x560515;});}return _0x391894;})[_0x3c06('0x13')](respondWithResult(_0x1e603b,0xc9))['catch'](handleError(_0x1e603b,null));};exports[_0x3c06('0x49')]=function(_0x4b21cb,_0x36ac89){if(_0x4b21cb['body']['id']){delete _0x4b21cb[_0x3c06('0x3c')]['id'];}return db['VoiceExtension'][_0x3c06('0x1c')]({'where':{'id':_0x4b21cb[_0x3c06('0x3a')]['id']}})['then'](handleEntityNotFound(_0x36ac89,null))[_0x3c06('0x13')](function(_0xa9c640){if(_0xa9c640){return db[_0x3c06('0x23')][_0x3c06('0x49')](_['pick'](_0x4b21cb['body'],[_0x3c06('0x3f'),_0x3c06('0x4a'),_0x3c06('0x4b'),_0x3c06('0x4c'),_0x3c06('0x4d'),_0x3c06('0x4e'),_0x3c06('0x4f')]),{'where':{'context':_0xa9c640[_0x3c06('0x4a')],'exten':_0xa9c640[_0x3c06('0x3f')]},'individualHooks':!![]})[_0x3c06('0x13')](function(_0x376c96){return _0x376c96;});}return null;})[_0x3c06('0x13')](respondWithStatusCode(_0x36ac89,null))['catch'](handleError(_0x36ac89,null));};exports['addApplications']=function(_0x23ed7c,_0x2579a5){var _0x2ba38b=_0x23ed7c[_0x3c06('0x3a')]['id'];var _0xebf006=_0x23ed7c[_0x3c06('0x3c')];var _0x5676e1=0xc8;var _0x276d34=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3c06('0x50')][_0x3c06('0x51')][_0x3c06('0x52')][_0x3c06('0x53')]},function(_0xba0eee){return db[_0x3c06('0x23')]['findOne']({'where':{'id':_0x2ba38b},'transaction':_0xba0eee})['then'](function(_0x2d37e7){if(_0x2d37e7){return db[_0x3c06('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x2ba38b},'transaction':_0xba0eee})[_0x3c06('0x13')](function(){var _0x435b62=_[_0x3c06('0x19')](_0xebf006,function(_0x529806){_0x529806['VoiceExtensionId']=_0x2ba38b;_0x529806[_0x3c06('0x54')]=!![];return _0x529806;});return _0x2d37e7[_0x3c06('0x55')](_0x435b62);})['then'](function(_0x452bd5){return db[_0x3c06('0x23')][_0x3c06('0x56')](_0x452bd5,{'transaction':_0xba0eee});});}else{_0x5676e1=0x194;_0x276d34=[];}});})['then'](function(){if(_0x5676e1!==0x194){return db['VoiceExtension'][_0x3c06('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2ba38b},'order':_0x3c06('0x58')})[_0x3c06('0x13')](function(_0x5581bb){_0x276d34=_0x5581bb;});}})['catch'](function(_0x26e793){_0x5676e1=0x1f4;logger[_0x3c06('0x20')](_0x26e793['stack']);if(_0x26e793[_0x3c06('0x1d')]){delete _0x26e793['name'];}_0x276d34=_0x26e793;})[_0x3c06('0x59')](function(){if(_0x276d34===null){_0x2579a5[_0x3c06('0xb')](_0x5676e1);}else{if(_0x5676e1===0x1f4){_0x2579a5[_0x3c06('0xc')](_0x5676e1)['send'](_0x276d34);}else{_0x2579a5[_0x3c06('0xc')](_0x5676e1)[_0x3c06('0xd')](_0x276d34);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 26afbf3..11f454a 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 _0x31a6=['events','../../mysqldb','VoiceExtension','save','remove','emit','hook'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x31a6,0xf5));var _0x631a=function(_0x95d649,_0x532a0a){_0x95d649=_0x95d649-0x0;var _0x367875=_0x31a6[_0x95d649];return _0x367875;};'use strict';var EventEmitter=require(_0x631a('0x0'));var VoiceExtension=require(_0x631a('0x1'))['db'][_0x631a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x631a('0x3'),'afterUpdate':'update','afterDestroy':_0x631a('0x4')};function emitEvent(_0x350715){return function(_0x1f0087,_0x741689,_0x10b9ef){VoiceExtensionEvents[_0x631a('0x5')](_0x350715+':'+_0x1f0087['id'],_0x1f0087);VoiceExtensionEvents['emit'](_0x350715,_0x1f0087);_0x10b9ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x631a('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xd912=['hasOwnProperty','events','../../mysqldb','VoiceExtension','save','remove','emit'];(function(_0x1e191d,_0x42eba2){var _0x3b772d=function(_0x43bc81){while(--_0x43bc81){_0x1e191d['push'](_0x1e191d['shift']());}};_0x3b772d(++_0x42eba2);}(_0xd912,0xb0));var _0x2d91=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd912[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x2d91('0x0'));var VoiceExtension=require(_0x2d91('0x1'))['db'][_0x2d91('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d91('0x3'),'afterUpdate':'update','afterDestroy':_0x2d91('0x4')};function emitEvent(_0x43123e){return function(_0x5dd46a,_0x5054a5,_0x39513a){VoiceExtensionEvents[_0x2d91('0x5')](_0x43123e+':'+_0x5dd46a['id'],_0x5dd46a);VoiceExtensionEvents['emit'](_0x43123e,_0x5dd46a);_0x39513a(null);};}for(var e in events){if(events[_0x2d91('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 160d560..731d68d 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 _0x0c42=['No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','length','name','split','phone','param','prefix','SIP','join','none','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','type','Set','exten','alias','NoOp','CDR(routeAlias)='];(function(_0x1c75de,_0x52c9b3){var _0x20a5e6=function(_0x5cbec1){while(--_0x5cbec1){_0x1c75de['push'](_0x1c75de['shift']());}};_0x20a5e6(++_0x52c9b3);}(_0x0c42,0x191));var _0x20c4=function(_0x4cceda,_0x4039c0){_0x4cceda=_0x4cceda-0x0;var _0x27dcaa=_0x0c42[_0x4cceda];return _0x27dcaa;};'use strict';var _=require(_0x20c4('0x0'));var attributes=require(_0x20c4('0x1'));module[_0x20c4('0x2')]=function(_0x46af92){var _0xe6959=_0x46af92['models'];function _0x5d686d(_0x3a3e5b){var _0x1296a8=0x2;var _0x24bfc1=[{'type':_0x3a3e5b[_0x20c4('0x3')],'app':_0x20c4('0x4'),'appdata':'CDR(type)='+_0x3a3e5b[_0x20c4('0x3')],'context':_0x3a3e5b['context'],'exten':_0x3a3e5b[_0x20c4('0x5')],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']},{'type':_0x3a3e5b['type'],'app':_0x3a3e5b[_0x20c4('0x6')]?_0x20c4('0x4'):_0x20c4('0x7'),'appdata':_0x3a3e5b['alias']?_0x20c4('0x8')+_0x3a3e5b[_0x20c4('0x6')]:_0x20c4('0x9'),'context':_0x3a3e5b[_0x20c4('0xa')],'exten':_0x3a3e5b[_0x20c4('0x5')],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']}];if(_0x3a3e5b[_0x20c4('0x3')]===_0x20c4('0xb')){_0x24bfc1[_0x20c4('0xc')]({'type':_0x20c4('0xb'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0xd')+_0x3a3e5b['id'],'context':_0x3a3e5b[_0x20c4('0xa')],'exten':_0x3a3e5b[_0x20c4('0x5')],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']});}_0x24bfc1['push']({'type':_0x3a3e5b[_0x20c4('0x3')],'app':'Set','appdata':_0x20c4('0xe'),'context':_0x3a3e5b[_0x20c4('0xa')],'exten':_0x3a3e5b['exten'],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']},{'type':_0x3a3e5b[_0x20c4('0x3')],'app':'Set','appdata':_0x20c4('0xf'),'context':_0x3a3e5b[_0x20c4('0xa')],'exten':_0x3a3e5b[_0x20c4('0x5')],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']},{'type':_0x3a3e5b['type'],'app':_0x20c4('0x4'),'appdata':_0x20c4('0x10'),'context':_0x3a3e5b[_0x20c4('0xa')],'exten':_0x3a3e5b[_0x20c4('0x5')],'priority':_0x1296a8++,'VoiceExtensionId':_0x3a3e5b['id']});return _0x24bfc1;}function _0x6385ad(_0x57d1a3){var _0x2f79a0=0x2;var _0x3fd9b7=[{'type':_0x20c4('0x11'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x12'),'context':_0x57d1a3['context'],'exten':_0x57d1a3['exten'],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x57d1a3['alias']?_0x20c4('0x4'):_0x20c4('0x7'),'appdata':_0x57d1a3[_0x20c4('0x6')]?_0x20c4('0x8')+_0x57d1a3[_0x20c4('0x6')]:_0x20c4('0x9'),'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x13')+(_0x57d1a3[_0x20c4('0x14')]?_0x20c4('0x15')+_0x57d1a3[_0x20c4('0x14')]+'}':_0x20c4('0x16')),'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0xd')+_0x57d1a3['id'],'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x20c4('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2f79a0+0x2)+'):Goto('+(_0x2f79a0+0x1)+')','context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':'outbound','app':_0x20c4('0x4'),'appdata':_0x57d1a3[_0x20c4('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x57d1a3[_0x20c4('0x14')]+'}':_0x20c4('0x18'),'context':_0x57d1a3['context'],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':'outbound','app':_0x20c4('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0xf'),'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3['exten'],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':'outbound','app':_0x20c4('0x4'),'appdata':_0x20c4('0x10'),'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':'Set','appdata':_0x20c4('0x19')+_0x57d1a3['id'],'context':_0x57d1a3['context'],'exten':_0x57d1a3[_0x20c4('0x5')],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']}];if(_0x57d1a3['hasOwnProperty']('recordingFormat')&&_0x57d1a3['recordingFormat']!=='none'){_0x3fd9b7[_0x20c4('0xc')]({'type':'outbound','app':_0x20c4('0x4'),'appdata':_0x20c4('0x1a'),'context':_0x57d1a3[_0x20c4('0xa')],'exten':_0x57d1a3['exten'],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']},{'type':_0x20c4('0x11'),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x1b')+_0x57d1a3[_0x20c4('0x1c')]||_0x20c4('0x1d'),'context':_0x57d1a3['context'],'exten':_0x57d1a3['exten'],'priority':_0x2f79a0++,'VoiceExtensionId':_0x57d1a3['id']});}return _0x3fd9b7;}function _0x578b05(_0x5d9b04,_0x19882f){var _0x26e7d4=[{'name':_0x20c4('0x1e'),'param':0x0},{'name':_0x20c4('0x1f'),'param':0x1},{'name':_0x20c4('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0x29c250={};var _0x552bea=_0x19882f['split'](',');var _0x49cdb8=[];for(var _0x25aca3=0x0;_0x25aca3<_0x26e7d4[_0x20c4('0x21')];_0x25aca3++){switch(_0x26e7d4[_0x25aca3][_0x20c4('0x22')]){case _0x20c4('0x1e'):_0x29c250[_0x20c4('0x1e')]=_0x552bea[_0x26e7d4[_0x25aca3]['param']][_0x20c4('0x23')]('/')[0x1];_0x29c250[_0x20c4('0x24')]=_0x552bea[_0x26e7d4[_0x25aca3][_0x20c4('0x25')]][_0x20c4('0x23')]('/')[0x2];_0x29c250[_0x20c4('0x26')]=_0x29c250[_0x20c4('0x24')]?_0x29c250[_0x20c4('0x24')][_0x20c4('0x23')]('$')[0x0]:undefined;_0x29c250[_0x20c4('0x24')]=_0x5d9b04[_0x20c4('0x14')]?(_0x29c250[_0x20c4('0x26')]||'')+'${EXTEN:'+_0x5d9b04[_0x20c4('0x14')]+'}':(_0x29c250['prefix']||'')+_0x20c4('0x16');_0x49cdb8[_0x26e7d4[_0x25aca3][_0x20c4('0x25')]]=[_0x20c4('0x27'),_0x29c250[_0x20c4('0x1e')],_0x29c250[_0x20c4('0x24')]][_0x20c4('0x28')]('/');break;case _0x20c4('0x20'):_0x29c250[_0x20c4('0x20')]=_0x552bea[_0x26e7d4[_0x25aca3][_0x20c4('0x25')]];if(_0x5d9b04['recordingFormat']!==_0x20c4('0x29')){if(_0x29c250[_0x20c4('0x20')]['indexOf'](_0x20c4('0x2a'))<0x0){_0x29c250['options']+=_0x20c4('0x2a');}}else{_0x29c250['options']=_0x29c250[_0x20c4('0x20')]['replace'](_0x20c4('0x2a'),'');}_0x49cdb8[_0x26e7d4[_0x25aca3][_0x20c4('0x25')]]=_0x29c250[_0x20c4('0x20')];break;default:_0x49cdb8[_0x26e7d4[_0x25aca3]['param']]=_0x552bea[_0x26e7d4[_0x25aca3]['param']];}}return _0x49cdb8['join'](',');}function _0x1de291(_0x1cb31a,_0xbc1700,_0xe03cbd){return new Promise(function(_0x252e9f,_0xdb39bc){var _0x332beb=[];if(_[_0x20c4('0x2b')](_0xbc1700))return _0x252e9f(_0x332beb);_0xe6959[_0x20c4('0x2c')][_0x20c4('0x2d')]({'attributes':['id',_0x20c4('0x2e'),_0x20c4('0x2f')],'raw':!![]})[_0x20c4('0x30')](function(_0x4e9fc7){for(var _0x402c83=0x0,_0x40f314=0x0;_0x402c83<_0xbc1700['length'];_0x402c83++,_0x40f314=0x0){var _0x3c5a56=_0xbc1700[_0x402c83];var _0x44ca82=[];var _0x38605a=[];delete _0x3c5a56['id'];if(_0x3c5a56[_0x20c4('0x2e')]!==_0x20c4('0x31')){_0x3c5a56[_0x20c4('0x32')]=[_0x3c5a56['interval']];}else{_0x3c5a56[_0x20c4('0x32')]=_0x3c5a56[_0x20c4('0x2f')]?_[_0x20c4('0x33')](_[_0x20c4('0x34')](_0x4e9fc7,{'IntervalId':_0x3c5a56[_0x20c4('0x2f')]}),_0x20c4('0x2e')):[];}_0x3c5a56[_0x20c4('0xa')]=_0x1cb31a[_0x20c4('0xa')];_0x3c5a56[_0x20c4('0x5')]=_0x1cb31a['exten'];if(_0x3c5a56[_0x20c4('0x3')])_0x3c5a56[_0x20c4('0x3')]=_0x3c5a56[_0x20c4('0x3')][_0x20c4('0x35')]();if(_0x1cb31a[_0x20c4('0x3')]==='outbound'){if(_0x3c5a56[_0x20c4('0x36')]('tag')&&_0x3c5a56[_0x20c4('0x37')]&&_0x3c5a56[_0x20c4('0x37')]!=='--'){_0x44ca82[_0x20c4('0xc')]({'type':_0x3c5a56['type'][_0x20c4('0x35')](),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x38')+_0x3c5a56[_0x20c4('0x37')],'context':_0x1cb31a[_0x20c4('0xa')],'exten':_0x1cb31a[_0x20c4('0x5')],'priority':_0x3c5a56['intervals'][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});}_0x44ca82[_0x20c4('0xc')]({'type':_0x3c5a56[_0x20c4('0x3')]['toLowerCase'](),'app':_0x20c4('0x17'),'appdata':_0x20c4('0x39')+(_0x3c5a56[_0x20c4('0x3a')]?_0x20c4('0x3b')+_0x3c5a56['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x1cb31a[_0x20c4('0xa')],'exten':_0x1cb31a[_0x20c4('0x5')],'priority':_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});}else{if(_0x3c5a56['hasOwnProperty'](_0x20c4('0x3c'))){if([_0x20c4('0x3d'),_0x20c4('0x3e')][_0x20c4('0x3f')](_0x3c5a56[_0x20c4('0x40')][_0x20c4('0x35')]())&&_0x3c5a56[_0x20c4('0x41')]!=='custom'){if(_0x3c5a56['answer']){_0x44ca82[_0x20c4('0xc')]({'type':_0x3c5a56[_0x20c4('0x3')][_0x20c4('0x35')](),'app':'ExecIf','appdata':_0x20c4('0x42'),'context':_0x1cb31a[_0x20c4('0xa')],'exten':_0x1cb31a['exten'],'priority':_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});_0x44ca82['push']({'type':_0x3c5a56[_0x20c4('0x3')][_0x20c4('0x35')](),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x43'),'context':_0x1cb31a['context'],'exten':_0x1cb31a[_0x20c4('0x5')],'priority':_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});}else{_0x44ca82[_0x20c4('0xc')]({'type':_0x3c5a56['type'][_0x20c4('0x35')](),'app':_0x20c4('0x17'),'appdata':_0x20c4('0x44'),'context':_0x1cb31a['context'],'exten':_0x1cb31a[_0x20c4('0x5')],'priority':_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});_0x44ca82['push']({'type':_0x3c5a56[_0x20c4('0x3')]['toLowerCase'](),'app':_0x20c4('0x4'),'appdata':_0x20c4('0x45'),'context':_0x1cb31a[_0x20c4('0xa')],'exten':_0x1cb31a[_0x20c4('0x5')],'priority':_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]+_0xe03cbd+_0x40f314++,'VoiceExtensionId':_0x1cb31a['id']});}}}}for(var _0x464fa5=0x0;_0x464fa5<_0x3c5a56['intervals'][_0x20c4('0x21')];_0x464fa5++){var _0x51d204=_0xe03cbd+_0x3c5a56['intervals'][_0x20c4('0x21')];var _0x5b56ff=_0x464fa5===_0x3c5a56[_0x20c4('0x32')][_0x20c4('0x21')]-0x1?_0xe03cbd+_0x44ca82[_0x20c4('0x21')]+_0x38605a[_0x20c4('0x21')]+0x2:_0xe03cbd+_0x464fa5+0x1;_0x44ca82[_0x20c4('0x46')](_0x464fa5,0x0,{'type':_0x1cb31a[_0x20c4('0x3')],'app':_0x20c4('0x47'),'appdata':_0x3c5a56[_0x20c4('0x32')][_0x464fa5]+'?'+_0x1cb31a[_0x20c4('0xa')]+',${EXTEN},'+_0x51d204+':'+_0x1cb31a[_0x20c4('0xa')]+_0x20c4('0x48')+_0x5b56ff,'exten':_0x1cb31a[_0x20c4('0x5')],'context':_0x1cb31a[_0x20c4('0xa')],'priority':_0xe03cbd+_0x464fa5,'VoiceExtensionId':_0x1cb31a['id']});}if(_0x3c5a56[_0x20c4('0x41')]===_0x20c4('0x49'))_0x3c5a56['appdata']=_0x578b05(_0x1cb31a,_0x3c5a56[_0x20c4('0x4a')]);_0x3c5a56[_0x20c4('0x4b')]=_0x44ca82[_0x20c4('0x21')]?_[_0x20c4('0x4c')](_0x44ca82)[_0x20c4('0x4b')]+0x1:_0xe03cbd;_0x332beb=_[_0x20c4('0x4d')](_0x332beb,_0x44ca82,[_0x3c5a56],_0x38605a);_0xe03cbd=_['last'](_0x332beb)[_0x20c4('0x4b')]+0x1;}return _0x252e9f(_0x332beb);})[_0x20c4('0x4e')](function(_0x414df9){_0xdb39bc(_0x414df9);});});}return _0x46af92[_0x20c4('0x4f')](_0x20c4('0x50'),attributes,{'tableName':_0x20c4('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x438b8f){var _0x3c47bf=this['get']({'plain':!![]});var _0x105265=_0x3c47bf['type']===_0x20c4('0x11')?_0x6385ad(_0x3c47bf):_0x5d686d(_0x3c47bf);return _0x1de291(_0x3c47bf,_0x438b8f,_[_0x20c4('0x4c')](_0x105265)[_0x20c4('0x4b')]+0x1)[_0x20c4('0x30')](function(_0xed4086){var _0x4eb6a6=_[_0x20c4('0x4d')](_0x105265,_0xed4086);_0x4eb6a6['push']({'type':_0x3c47bf['type'],'app':'Hangup','exten':_0x3c47bf[_0x20c4('0x5')],'context':_0x3c47bf[_0x20c4('0xa')],'priority':_[_0x20c4('0x4c')](_0x4eb6a6)['priority']+0x1,'VoiceExtensionId':_0x3c47bf['id']});return _0x4eb6a6;});}}});}; \ No newline at end of file +var _0x54da=['last','concat','catch','define','voice_extensions','get','Hangup','lodash','exports','models','type','context','Set','NoOp','alias','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','trunk','timeout','length','split','param','prefix','phone','${EXTEN:','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','IntervalId','interval','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority'];(function(_0x535aba,_0x456915){var _0x2182ca=function(_0x5f51d7){while(--_0x5f51d7){_0x535aba['push'](_0x535aba['shift']());}};_0x2182ca(++_0x456915);}(_0x54da,0x9d));var _0xa54d=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x54da[_0x4f217f];return _0x3b583a;};'use strict';var _=require(_0xa54d('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xa54d('0x1')]=function(_0x4e4b1b){var _0x52e168=_0x4e4b1b[_0xa54d('0x2')];function _0x50cff1(_0x22184a){var _0x280f78=0x2;var _0x936fe1=[{'type':_0x22184a[_0xa54d('0x3')],'app':'Set','appdata':'CDR(type)='+_0x22184a[_0xa54d('0x3')],'context':_0x22184a[_0xa54d('0x4')],'exten':_0x22184a['exten'],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']},{'type':_0x22184a['type'],'app':_0x22184a['alias']?_0xa54d('0x5'):_0xa54d('0x6'),'appdata':_0x22184a[_0xa54d('0x7')]?'CDR(routeAlias)='+_0x22184a[_0xa54d('0x7')]:_0xa54d('0x8'),'context':_0x22184a['context'],'exten':_0x22184a['exten'],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']}];if(_0x22184a[_0xa54d('0x3')]==='inbound'){_0x936fe1[_0xa54d('0x9')]({'type':_0xa54d('0xa'),'app':_0xa54d('0x5'),'appdata':'CDR(routeid)='+_0x22184a['id'],'context':_0x22184a[_0xa54d('0x4')],'exten':_0x22184a['exten'],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']});}_0x936fe1['push']({'type':_0x22184a['type'],'app':_0xa54d('0x5'),'appdata':_0xa54d('0xb'),'context':_0x22184a[_0xa54d('0x4')],'exten':_0x22184a[_0xa54d('0xc')],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']},{'type':_0x22184a[_0xa54d('0x3')],'app':'Set','appdata':_0xa54d('0xd'),'context':_0x22184a[_0xa54d('0x4')],'exten':_0x22184a[_0xa54d('0xc')],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']},{'type':_0x22184a[_0xa54d('0x3')],'app':_0xa54d('0x5'),'appdata':_0xa54d('0xe'),'context':_0x22184a[_0xa54d('0x4')],'exten':_0x22184a[_0xa54d('0xc')],'priority':_0x280f78++,'VoiceExtensionId':_0x22184a['id']});return _0x936fe1;}function _0x300ca1(_0x398877){var _0x3227f7=0x2;var _0x27362d=[{'type':'outbound','app':_0xa54d('0x5'),'appdata':_0xa54d('0xf'),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0x398877[_0xa54d('0x7')]?'Set':'NoOp','appdata':_0x398877[_0xa54d('0x7')]?_0xa54d('0x11')+_0x398877[_0xa54d('0x7')]:_0xa54d('0x8'),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0xa54d('0x5'),'appdata':'CDR(destination)='+(_0x398877[_0xa54d('0x12')]?'${EXTEN:'+_0x398877['cutdigits']+'}':_0xa54d('0x13')),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877['exten'],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':'outbound','app':_0xa54d('0x5'),'appdata':'CDR(routeid)='+_0x398877['id'],'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0xa54d('0x14'),'appdata':_0xa54d('0x15')+(_0x3227f7+0x2)+_0xa54d('0x16')+(_0x3227f7+0x1)+')','context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0xa54d('0x5'),'appdata':_0x398877[_0xa54d('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x398877[_0xa54d('0x12')]+'}':_0xa54d('0x17'),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877['exten'],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0xa54d('0x5'),'appdata':_0xa54d('0xb'),'context':_0x398877['context'],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':'Set','appdata':_0xa54d('0xd'),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877['exten'],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':_0xa54d('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x398877['context'],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':'Set','appdata':'outboundrouteid='+_0x398877['id'],'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']}];if(_0x398877[_0xa54d('0x18')]('recordingFormat')&&_0x398877['recordingFormat']!=='none'){_0x27362d[_0xa54d('0x9')]({'type':_0xa54d('0x10'),'app':'Set','appdata':_0xa54d('0x19'),'context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']},{'type':_0xa54d('0x10'),'app':'Set','appdata':_0xa54d('0x1a')+_0x398877[_0xa54d('0x1b')]||'wav','context':_0x398877[_0xa54d('0x4')],'exten':_0x398877[_0xa54d('0xc')],'priority':_0x3227f7++,'VoiceExtensionId':_0x398877['id']});}return _0x27362d;}function _0x3d5794(_0xd4c692,_0x2ecf81){var _0x69b869=[{'name':_0xa54d('0x1c'),'param':0x0},{'name':_0xa54d('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x2b6ec7={};var _0x15b1c5=_0x2ecf81['split'](',');var _0x49d4b8=[];for(var _0x45c98b=0x0;_0x45c98b<_0x69b869[_0xa54d('0x1e')];_0x45c98b++){switch(_0x69b869[_0x45c98b]['name']){case _0xa54d('0x1c'):_0x2b6ec7[_0xa54d('0x1c')]=_0x15b1c5[_0x69b869[_0x45c98b]['param']][_0xa54d('0x1f')]('/')[0x1];_0x2b6ec7['phone']=_0x15b1c5[_0x69b869[_0x45c98b][_0xa54d('0x20')]][_0xa54d('0x1f')]('/')[0x2];_0x2b6ec7[_0xa54d('0x21')]=_0x2b6ec7['phone']?_0x2b6ec7['phone'][_0xa54d('0x1f')]('$')[0x0]:undefined;_0x2b6ec7[_0xa54d('0x22')]=_0xd4c692[_0xa54d('0x12')]?(_0x2b6ec7[_0xa54d('0x21')]||'')+_0xa54d('0x23')+_0xd4c692[_0xa54d('0x12')]+'}':(_0x2b6ec7[_0xa54d('0x21')]||'')+_0xa54d('0x13');_0x49d4b8[_0x69b869[_0x45c98b][_0xa54d('0x20')]]=[_0xa54d('0x24'),_0x2b6ec7[_0xa54d('0x1c')],_0x2b6ec7['phone']][_0xa54d('0x25')]('/');break;case'options':_0x2b6ec7[_0xa54d('0x26')]=_0x15b1c5[_0x69b869[_0x45c98b]['param']];if(_0xd4c692[_0xa54d('0x1b')]!==_0xa54d('0x27')){if(_0x2b6ec7[_0xa54d('0x26')][_0xa54d('0x28')](_0xa54d('0x29'))<0x0){_0x2b6ec7[_0xa54d('0x26')]+=_0xa54d('0x29');}}else{_0x2b6ec7[_0xa54d('0x26')]=_0x2b6ec7[_0xa54d('0x26')][_0xa54d('0x2a')](_0xa54d('0x29'),'');}_0x49d4b8[_0x69b869[_0x45c98b][_0xa54d('0x20')]]=_0x2b6ec7[_0xa54d('0x26')];break;default:_0x49d4b8[_0x69b869[_0x45c98b][_0xa54d('0x20')]]=_0x15b1c5[_0x69b869[_0x45c98b][_0xa54d('0x20')]];}}return _0x49d4b8['join'](',');}function _0x51ee7c(_0x3600f4,_0x28dbe3,_0x2caf9b){return new Promise(function(_0x38e26a,_0xd7c19a){var _0x3570a7=[];if(_['isEmpty'](_0x28dbe3))return _0x38e26a(_0x3570a7);_0x52e168['Interval']['findAll']({'attributes':['id','interval',_0xa54d('0x2b')],'raw':!![]})['then'](function(_0x4bb6fe){for(var _0x287ecb=0x0,_0x3e2f0d=0x0;_0x287ecb<_0x28dbe3['length'];_0x287ecb++,_0x3e2f0d=0x0){var _0x32dcee=_0x28dbe3[_0x287ecb];var _0xc0814=[];var _0x3b1075=[];delete _0x32dcee['id'];if(_0x32dcee[_0xa54d('0x2c')]!==_0xa54d('0x2d')){_0x32dcee[_0xa54d('0x2e')]=[_0x32dcee['interval']];}else{_0x32dcee[_0xa54d('0x2e')]=_0x32dcee['IntervalId']?_[_0xa54d('0x2f')](_['filter'](_0x4bb6fe,{'IntervalId':_0x32dcee[_0xa54d('0x2b')]}),_0xa54d('0x2c')):[];}_0x32dcee[_0xa54d('0x4')]=_0x3600f4[_0xa54d('0x4')];_0x32dcee[_0xa54d('0xc')]=_0x3600f4[_0xa54d('0xc')];if(_0x32dcee[_0xa54d('0x3')])_0x32dcee[_0xa54d('0x3')]=_0x32dcee['type'][_0xa54d('0x30')]();if(_0x3600f4[_0xa54d('0x3')]===_0xa54d('0x10')){if(_0x32dcee[_0xa54d('0x18')](_0xa54d('0x31'))&&_0x32dcee['tag']&&_0x32dcee[_0xa54d('0x31')]!=='--'){_0xc0814[_0xa54d('0x9')]({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':_0xa54d('0x5'),'appdata':_0xa54d('0x32')+_0x32dcee['tag'],'context':_0x3600f4[_0xa54d('0x4')],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee['intervals']['length']+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});}_0xc0814[_0xa54d('0x9')]({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':'ExecIf','appdata':_0xa54d('0x33')+(_0x32dcee['callerID']?_0xa54d('0x34')+_0x32dcee[_0xa54d('0x35')]+')':_0xa54d('0x36')),'context':_0x3600f4[_0xa54d('0x4')],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee[_0xa54d('0x2e')]['length']+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});}else{if(_0x32dcee[_0xa54d('0x18')](_0xa54d('0x37'))){if([_0xa54d('0x38'),_0xa54d('0x39')][_0xa54d('0x3a')](_0x32dcee['app']['toLowerCase']())&&_0x32dcee[_0xa54d('0x3b')]!=='custom'){if(_0x32dcee[_0xa54d('0x37')]){_0xc0814[_0xa54d('0x9')]({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':_0xa54d('0x14'),'appdata':_0xa54d('0x3c'),'context':_0x3600f4['context'],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee[_0xa54d('0x2e')]['length']+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});_0xc0814[_0xa54d('0x9')]({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':'Set','appdata':_0xa54d('0x3d'),'context':_0x3600f4[_0xa54d('0x4')],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee[_0xa54d('0x2e')][_0xa54d('0x1e')]+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});}else{_0xc0814['push']({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':_0xa54d('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3600f4[_0xa54d('0x4')],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee[_0xa54d('0x2e')][_0xa54d('0x1e')]+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});_0xc0814[_0xa54d('0x9')]({'type':_0x32dcee[_0xa54d('0x3')][_0xa54d('0x30')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3600f4['context'],'exten':_0x3600f4[_0xa54d('0xc')],'priority':_0x32dcee[_0xa54d('0x2e')][_0xa54d('0x1e')]+_0x2caf9b+_0x3e2f0d++,'VoiceExtensionId':_0x3600f4['id']});}}}}for(var _0x3eef59=0x0;_0x3eef59<_0x32dcee[_0xa54d('0x2e')][_0xa54d('0x1e')];_0x3eef59++){var _0x572da0=_0x2caf9b+_0x32dcee[_0xa54d('0x2e')]['length'];var _0x16809a=_0x3eef59===_0x32dcee['intervals'][_0xa54d('0x1e')]-0x1?_0x2caf9b+_0xc0814['length']+_0x3b1075['length']+0x2:_0x2caf9b+_0x3eef59+0x1;_0xc0814[_0xa54d('0x3e')](_0x3eef59,0x0,{'type':_0x3600f4[_0xa54d('0x3')],'app':_0xa54d('0x3f'),'appdata':_0x32dcee[_0xa54d('0x2e')][_0x3eef59]+'?'+_0x3600f4[_0xa54d('0x4')]+_0xa54d('0x40')+_0x572da0+':'+_0x3600f4[_0xa54d('0x4')]+_0xa54d('0x40')+_0x16809a,'exten':_0x3600f4[_0xa54d('0xc')],'context':_0x3600f4[_0xa54d('0x4')],'priority':_0x2caf9b+_0x3eef59,'VoiceExtensionId':_0x3600f4['id']});}if(_0x32dcee[_0xa54d('0x3b')]===_0xa54d('0x41'))_0x32dcee['appdata']=_0x3d5794(_0x3600f4,_0x32dcee[_0xa54d('0x42')]);_0x32dcee[_0xa54d('0x43')]=_0xc0814[_0xa54d('0x1e')]?_[_0xa54d('0x44')](_0xc0814)[_0xa54d('0x43')]+0x1:_0x2caf9b;_0x3570a7=_[_0xa54d('0x45')](_0x3570a7,_0xc0814,[_0x32dcee],_0x3b1075);_0x2caf9b=_[_0xa54d('0x44')](_0x3570a7)['priority']+0x1;}return _0x38e26a(_0x3570a7);})[_0xa54d('0x46')](function(_0x32128c){_0xd7c19a(_0x32128c);});});}return _0x4e4b1b[_0xa54d('0x47')]('VoiceExtension',attributes,{'tableName':_0xa54d('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1525d1){var _0x5d29f8=this[_0xa54d('0x49')]({'plain':!![]});var _0x3fef5b=_0x5d29f8[_0xa54d('0x3')]===_0xa54d('0x10')?_0x300ca1(_0x5d29f8):_0x50cff1(_0x5d29f8);return _0x51ee7c(_0x5d29f8,_0x1525d1,_[_0xa54d('0x44')](_0x3fef5b)[_0xa54d('0x43')]+0x1)['then'](function(_0x41131c){var _0x264280=_[_0xa54d('0x45')](_0x3fef5b,_0x41131c);_0x264280['push']({'type':_0x5d29f8[_0xa54d('0x3')],'app':_0xa54d('0x4a'),'exten':_0x5d29f8['exten'],'context':_0x5d29f8[_0xa54d('0x4')],'priority':_[_0xa54d('0x44')](_0x264280)[_0xa54d('0x43')]+0x1,'VoiceExtensionId':_0x5d29f8['id']});return _0x264280;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e7d2a26..f8747d0 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 _0xd819=['map','include','model','then','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit'];(function(_0x2081aa,_0x31d653){var _0x36485d=function(_0x4381f5){while(--_0x4381f5){_0x2081aa['push'](_0x2081aa['shift']());}};_0x36485d(++_0x31d653);}(_0xd819,0x181));var _0x9d81=function(_0x2b5d39,_0x55a5f2){_0x2b5d39=_0x2b5d39-0x0;var _0x3917c4=_0xd819[_0x2b5d39];return _0x3917c4;};'use strict';var _=require('lodash');var util=require(_0x9d81('0x0'));var moment=require(_0x9d81('0x1'));var BPromise=require(_0x9d81('0x2'));var rs=require(_0x9d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d81('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d81('0x5'))('rpc');var config=require(_0x9d81('0x6'));var jayson=require(_0x9d81('0x7'));var client=jayson[_0x9d81('0x8')]['http']({'port':0x232a});config[_0x9d81('0x9')]=_[_0x9d81('0xa')](config[_0x9d81('0x9')],{'host':_0x9d81('0xb'),'port':0x18eb});var socket=require(_0x9d81('0xc'))(new Redis(config[_0x9d81('0x9')]));require(_0x9d81('0xd'))[_0x9d81('0xe')](socket);function respondWithRpcPromise(_0x25a4c0,_0x3932e7,_0x17a3a3){return new BPromise(function(_0x44bba4,_0x404b15){return client[_0x9d81('0xf')](_0x25a4c0,_0x17a3a3)['then'](function(_0x139d28){logger[_0x9d81('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x3932e7,_0x9d81('0x11'));logger[_0x9d81('0x12')](_0x9d81('0x13'),_0x3932e7,_0x9d81('0x11'),JSON['stringify'](_0x139d28));if(_0x139d28[_0x9d81('0x14')]){if(_0x139d28['error'][_0x9d81('0x15')]===0x1f4){logger['error'](_0x9d81('0x16'),_0x3932e7,_0x139d28[_0x9d81('0x14')]['message']);return _0x404b15(_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);}logger[_0x9d81('0x14')](_0x9d81('0x16'),_0x3932e7,_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);return _0x44bba4(_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);}else{logger['info'](_0x9d81('0x16'),_0x3932e7,_0x9d81('0x11'));_0x44bba4(_0x139d28[_0x9d81('0x18')][_0x9d81('0x17')]);}})[_0x9d81('0x19')](function(_0x49e4c9){logger['error'](_0x9d81('0x16'),_0x3932e7,_0x49e4c9);_0x404b15(_0x49e4c9);});});}exports[_0x9d81('0x1a')]=function(_0x3104ad){var _0x40960c=this;return new Promise(function(_0x409720,_0x175d4f){return db[_0x9d81('0x1b')][_0x9d81('0x1c')]({'raw':_0x3104ad[_0x9d81('0x1d')]?_0x3104ad[_0x9d81('0x1d')][_0x9d81('0x1e')]===undefined?!![]:![]:!![],'where':_0x3104ad[_0x9d81('0x1d')]?_0x3104ad[_0x9d81('0x1d')]['where']||null:null,'attributes':_0x3104ad[_0x9d81('0x1d')]?_0x3104ad[_0x9d81('0x1d')][_0x9d81('0x1f')]||null:null,'limit':_0x3104ad[_0x9d81('0x1d')]?_0x3104ad[_0x9d81('0x1d')][_0x9d81('0x20')]||null:null,'include':_0x3104ad[_0x9d81('0x1d')]?_0x3104ad[_0x9d81('0x1d')]['include']?_[_0x9d81('0x21')](_0x3104ad[_0x9d81('0x1d')][_0x9d81('0x22')],function(_0x220535){return{'model':db[_0x220535['model']],'as':_0x220535['as'],'attributes':_0x220535[_0x9d81('0x1f')],'include':_0x220535['include']?_[_0x9d81('0x21')](_0x220535['include'],function(_0x3835b5){return{'model':db[_0x3835b5['model']],'as':_0x3835b5['as'],'attributes':_0x3835b5[_0x9d81('0x1f')],'include':_0x3835b5[_0x9d81('0x22')]?_[_0x9d81('0x21')](_0x3835b5[_0x9d81('0x22')],function(_0xb82d79){return{'model':db[_0xb82d79[_0x9d81('0x23')]],'as':_0xb82d79['as'],'attributes':_0xb82d79[_0x9d81('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9d81('0x24')](function(_0x1861d9){logger[_0x9d81('0x10')](_0x9d81('0x1a'),_0x3104ad);logger[_0x9d81('0x12')](_0x9d81('0x1a'),_0x3104ad,JSON[_0x9d81('0x25')](_0x1861d9));_0x409720(_0x1861d9);})[_0x9d81('0x19')](function(_0xe0cf0d){logger['error']('GetVoiceExtension',_0xe0cf0d[_0x9d81('0x17')],_0x3104ad);_0x175d4f(_0x40960c[_0x9d81('0x14')](0x1f4,_0xe0cf0d[_0x9d81('0x17')]));});});}; \ No newline at end of file +var _0xdb2a=['raw','where','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x549eb9,_0x155e11){var _0x280dc1=function(_0x12a44d){while(--_0x12a44d){_0x549eb9['push'](_0x549eb9['shift']());}};_0x280dc1(++_0x155e11);}(_0xdb2a,0x16f));var _0xadb2=function(_0x1fdd6d,_0x58acfb){_0x1fdd6d=_0x1fdd6d-0x0;var _0x30b56f=_0xdb2a[_0x1fdd6d];return _0x30b56f;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var moment=require(_0xadb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb2('0x3'));var db=require(_0xadb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb2('0x5'))('rpc');var config=require(_0xadb2('0x6'));var jayson=require(_0xadb2('0x7'));var client=jayson[_0xadb2('0x8')][_0xadb2('0x9')]({'port':0x232a});config[_0xadb2('0xa')]=_['defaults'](config[_0xadb2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xadb2('0xb'))(new Redis(config[_0xadb2('0xa')]));require(_0xadb2('0xc'))['register'](socket);function respondWithRpcPromise(_0x407b26,_0xe47423,_0x15f179){return new BPromise(function(_0x49706f,_0x23d553){return client['request'](_0x407b26,_0x15f179)[_0xadb2('0xd')](function(_0x4fac30){logger['info'](_0xadb2('0xe'),_0xe47423,_0xadb2('0xf'));logger[_0xadb2('0x10')](_0xadb2('0x11'),_0xe47423,'request\x20sent',JSON[_0xadb2('0x12')](_0x4fac30));if(_0x4fac30[_0xadb2('0x13')]){if(_0x4fac30[_0xadb2('0x13')][_0xadb2('0x14')]===0x1f4){logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x4fac30[_0xadb2('0x13')][_0xadb2('0x15')]);return _0x23d553(_0x4fac30[_0xadb2('0x13')]['message']);}logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x4fac30['error'][_0xadb2('0x15')]);return _0x49706f(_0x4fac30['error'][_0xadb2('0x15')]);}else{logger[_0xadb2('0x16')](_0xadb2('0xe'),_0xe47423,'request\x20sent');_0x49706f(_0x4fac30[_0xadb2('0x17')][_0xadb2('0x15')]);}})[_0xadb2('0x18')](function(_0x58dfa3){logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x58dfa3);_0x23d553(_0x58dfa3);});});}exports[_0xadb2('0x19')]=function(_0x1eeefb){var _0x2a66a6=this;return new Promise(function(_0x1dd0d0,_0xca90c4){return db[_0xadb2('0x1a')][_0xadb2('0x1b')]({'raw':_0x1eeefb['options']?_0x1eeefb[_0xadb2('0x1c')][_0xadb2('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eeefb['options']?_0x1eeefb[_0xadb2('0x1c')][_0xadb2('0x1e')]||null:null,'attributes':_0x1eeefb[_0xadb2('0x1c')]?_0x1eeefb['options'][_0xadb2('0x1f')]||null:null,'limit':_0x1eeefb['options']?_0x1eeefb[_0xadb2('0x1c')][_0xadb2('0x20')]||null:null,'include':_0x1eeefb[_0xadb2('0x1c')]?_0x1eeefb[_0xadb2('0x1c')][_0xadb2('0x21')]?_[_0xadb2('0x22')](_0x1eeefb[_0xadb2('0x1c')][_0xadb2('0x21')],function(_0xc95bd0){return{'model':db[_0xc95bd0[_0xadb2('0x23')]],'as':_0xc95bd0['as'],'attributes':_0xc95bd0['attributes'],'include':_0xc95bd0['include']?_[_0xadb2('0x22')](_0xc95bd0[_0xadb2('0x21')],function(_0xb01ff4){return{'model':db[_0xb01ff4[_0xadb2('0x23')]],'as':_0xb01ff4['as'],'attributes':_0xb01ff4[_0xadb2('0x1f')],'include':_0xb01ff4[_0xadb2('0x21')]?_[_0xadb2('0x22')](_0xb01ff4[_0xadb2('0x21')],function(_0x44a76b){return{'model':db[_0x44a76b['model']],'as':_0x44a76b['as'],'attributes':_0x44a76b['attributes']};}):[]};}):[]};}):[]:[]})[_0xadb2('0xd')](function(_0x5592b9){logger['info'](_0xadb2('0x19'),_0x1eeefb);logger['debug']('GetVoiceExtension',_0x1eeefb,JSON[_0xadb2('0x12')](_0x5592b9));_0x1dd0d0(_0x5592b9);})[_0xadb2('0x18')](function(_0x2a16c3){logger[_0xadb2('0x13')](_0xadb2('0x19'),_0x2a16c3[_0xadb2('0x15')],_0x1eeefb);_0xca90c4(_0x2a66a6[_0xadb2('0x13')](0x1f4,_0x2a16c3[_0xadb2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index fb1c69d..791f957 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x24cb8c,_0x423901){var _0x2b9b59=function(_0x21ded5){while(--_0x21ded5){_0x24cb8c['push'](_0x24cb8c['shift']());}};_0x2b9b59(++_0x423901);}(_0xe14b,0x93));var _0xbe14=function(_0x541928,_0x4a7ceb){_0x541928=_0x541928-0x0;var _0x4eaa35=_0xe14b[_0x541928];return _0x4eaa35;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x27ba23,_0x56e2b9){var _0x289948=function(_0x5f5294){while(--_0x5f5294){_0x27ba23['push'](_0x27ba23['shift']());}};_0x289948(++_0x56e2b9);}(_0x7a54,0x106));var _0x47a5=function(_0xb96758,_0x37169c){_0xb96758=_0xb96758-0x0;var _0x5e6181=_0x7a54[_0xb96758];return _0x5e6181;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 61913bf..85dcff3 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 _0xacf4=['index','/:id','isAuthenticated','show','post','create','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x4977d6,_0xcb82b0){var _0x544d35=function(_0x1dc2dc){while(--_0x1dc2dc){_0x4977d6['push'](_0x4977d6['shift']());}};_0x544d35(++_0xcb82b0);}(_0xacf4,0xe7));var _0x4acf=function(_0xcd0ede,_0xd16617){_0xcd0ede=_0xcd0ede-0x0;var _0x421a1=_0xacf4[_0xcd0ede];return _0x421a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id/messages',auth[_0x4acf('0xb')](),controller['getMessages']);router[_0x4acf('0xd')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0xe')]);router['put'](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller['update']);router['delete'](_0x4acf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0xf')]=router; \ No newline at end of file +var _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x2a07,0x74));var _0x72a0=function(_0x1aac1d,_0x1dca6c){_0x1aac1d=_0x1aac1d-0x0;var _0x140f0d=_0x2a07[_0x1aac1d];return _0x140f0d;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 5625ad6..001a851 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 _0xff99=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x3dfcba,_0x3b0971){var _0x22f973=function(_0x1bf9b8){while(--_0x1bf9b8){_0x3dfcba['push'](_0x3dfcba['shift']());}};_0x22f973(++_0x3b0971);}(_0xff99,0x6c));var _0x9ff9=function(_0x5073e1,_0x45be5d){_0x5073e1=_0x5073e1-0x0;var _0x4f7218=_0xff99[_0x5073e1];return _0x4f7218;};'use strict';var Sequelize=require(_0x9ff9('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x9ff9('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9ff9('0x2'),'unique':_0x9ff9('0x3')},'mailbox':{'type':Sequelize[_0x9ff9('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x9ff9('0x1')]},'fullname':{'type':Sequelize[_0x9ff9('0x1')]},'email':{'type':Sequelize[_0x9ff9('0x1')],'validate':{'isEmail':!![]},'set':function(_0x130e62){this[_0x9ff9('0x4')](_0x9ff9('0x5'),typeof _0x130e62===_0x9ff9('0x6')&&_0x130e62[_0x9ff9('0x7')]()?_0x130e62[_0x9ff9('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x9ff9('0x1')],'defaultValue':_0x9ff9('0x8')},'attach':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':_0x9ff9('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':_0x9ff9('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9ff9('0x1')]},'callback':{'type':Sequelize[_0x9ff9('0x1')]},'review':{'type':Sequelize[_0x9ff9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9ff9('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9ff9('0x9')]('yes','no'),'defaultValue':_0x9ff9('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9ff9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9ff9('0x9')](_0x9ff9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9ff9('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x9ff9('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9ff9('0x1')]},'maxsecs':{'type':Sequelize[_0x9ff9('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9ff9('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9ff9('0xe')],'get':function(){return this['getDataValue'](_0x9ff9('0xf'))+_0x9ff9('0x10')+this[_0x9ff9('0x11')](_0x9ff9('0x12'));}}}; \ No newline at end of file +var _0xbe19=['trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string'];(function(_0x2cdd4d,_0x394c2f){var _0x55cbc8=function(_0x3b92cb){while(--_0x3b92cb){_0x2cdd4d['push'](_0x2cdd4d['shift']());}};_0x55cbc8(++_0x394c2f);}(_0xbe19,0x1ba));var _0x9be1=function(_0x924ba1,_0x3f45de){_0x924ba1=_0x924ba1-0x0;var _0x443539=_0xbe19[_0x924ba1];return _0x443539;};'use strict';var Sequelize=require(_0x9be1('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x9be1('0x1')]},'context':{'type':Sequelize[_0x9be1('0x1')],'defaultValue':_0x9be1('0x2'),'unique':_0x9be1('0x3')},'mailbox':{'type':Sequelize[_0x9be1('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x9be1('0x1')]},'fullname':{'type':Sequelize[_0x9be1('0x1')]},'email':{'type':Sequelize[_0x9be1('0x1')],'validate':{'isEmail':!![]},'set':function(_0x117e82){this[_0x9be1('0x4')]('email',typeof _0x117e82===_0x9be1('0x5')&&_0x117e82[_0x9be1('0x6')]()?_0x117e82[_0x9be1('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':_0x9be1('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9be1('0x1')]},'review':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9be1('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9be1('0x7')](_0x9be1('0x8'),'no'),'defaultValue':_0x9be1('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9be1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9be1('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9be1('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9be1('0x1')]},'maxsecs':{'type':Sequelize[_0x9be1('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9be1('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9be1('0xb')],'get':function(){return this['getDataValue'](_0x9be1('0xc'))+_0x9be1('0xd')+this[_0x9be1('0xe')](_0x9be1('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 13c38e6..3c3130c 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 _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x28b4cd,_0x573ff1){var _0x4229cc=function(_0x2ba663){while(--_0x2ba663){_0x28b4cd['push'](_0x28b4cd['shift']());}};_0x4229cc(++_0x573ff1);}(_0xe605,0x92));var _0x5e60=function(_0x3468ff,_0x20c595){_0x3468ff=_0x3468ff-0x0;var _0x5ad8d7=_0xe605[_0x3468ff];return _0x5ad8d7;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file +var _0x6324=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','rawAttributes','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x455893,_0x909838){var _0x3851e8=function(_0x32ac8a){while(--_0x32ac8a){_0x455893['push'](_0x455893['shift']());}};_0x3851e8(++_0x909838);}(_0x6324,0x142));var _0x4632=function(_0x49a1a0,_0x48f776){_0x49a1a0=_0x49a1a0-0x0;var _0x518a4f=_0x6324[_0x49a1a0];return _0x518a4f;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':!![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x25')]=function(_0x32cd35,_0x6c2864){if(_0x32cd35[_0x4632('0x51')]['id']){delete _0x32cd35[_0x4632('0x51')]['id'];}return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x32cd35[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](saveUpdates(_0x32cd35[_0x4632('0x51')],null))[_0x4632('0x26')](respondWithResult(_0x6c2864,null))['catch'](handleError(_0x6c2864,null));};exports[_0x4632('0x27')]=function(_0x433fea,_0x41409d){return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x433fea[_0x4632('0x44')]['id']}})['then'](handleEntityNotFound(_0x41409d,null))[_0x4632('0x26')](removeEntity(_0x41409d,null))[_0x4632('0x42')](handleError(_0x41409d,null));};exports[_0x4632('0x52')]=function(_0x4b91cf,_0x3aeefd,_0x334a8e){return db[_0x4632('0x30')][_0x4632('0x53')]({'where':{'id':_0x4b91cf[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3aeefd,null))[_0x4632('0x26')](function(_0x4658de){var _0x2965df;var _0x3abcbf={},_0x58d39a={};_0x58d39a[_0x4632('0x37')]=_[_0x4632('0x33')](db['VoiceMailMessage'][_0x4632('0x54')]);_0x58d39a['query']=_['keys'](_0x4b91cf[_0x4632('0x34')]);_0x58d39a[_0x4632('0x35')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],_0x58d39a[_0x4632('0x34')]);_0x3abcbf[_0x4632('0x38')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],qs[_0x4632('0x45')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x45')]));_0x3abcbf[_0x4632('0x38')]=_0x3abcbf[_0x4632('0x38')][_0x4632('0x46')]?_0x3abcbf['attributes']:_0x58d39a['model'];if(!_0x4b91cf[_0x4632('0x34')][_0x4632('0x55')](_0x4632('0x39'))){_0x3abcbf[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x4b91cf[_0x4632('0x34')]['limit']);_0x3abcbf[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x1c')]);}_0x3abcbf['order']=qs['sort'](_0x4b91cf[_0x4632('0x34')]['sort']);_0x3abcbf[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x56')](_0x4b91cf[_0x4632('0x34')],_0x58d39a[_0x4632('0x35')]));if(_0x4b91cf['query'][_0x4632('0x3c')]){_0x3abcbf[_0x4632('0x3b')]=_['merge'](_0x3abcbf['where'],{'$or':_[_0x4632('0x2f')](_0x3abcbf[_0x4632('0x38')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x4b91cf['query']['filter']+'%'};return _0x3090d6;})});}_0x3abcbf['where']=_[_0x4632('0x3d')](_0x3abcbf['where'],{'mailboxuser':_0x4658de[_0x4632('0x57')]});_0x3abcbf=_[_0x4632('0x3d')]({},_0x3abcbf,_0x4b91cf[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x59')](_0x3abcbf)[_0x4632('0x26')](respondWithFilteredResult(_0x3aeefd,_0x3abcbf));})[_0x4632('0x42')](handleError(_0x3aeefd,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5dc3297..6a3d094 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 _0x25ad=['context','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x25ad,0xd3));var _0xd25a=function(_0x52eceb,_0x400bb4){_0x52eceb=_0x52eceb-0x0;var _0x415694=_0x25ad[_0x52eceb];return _0x415694;};'use strict';var _=require(_0xd25a('0x0'));var util=require(_0xd25a('0x1'));var logger=require(_0xd25a('0x2'))(_0xd25a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require(_0xd25a('0x5'));var rimraf=require(_0xd25a('0x6'));var config=require(_0xd25a('0x7'));var attributes=require(_0xd25a('0x8'));module[_0xd25a('0x9')]=function(_0x463034,_0x52dba8){return _0x463034[_0xd25a('0xa')](_0xd25a('0xb'),attributes,{'tableName':_0xd25a('0xc'),'paranoid':![],'indexes':[{'name':_0xd25a('0xd'),'fields':['mailbox',_0xd25a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bbb=['mailbox','lodash','../../config/logger','path','rimraf','../../config/environment','./voiceMail.attributes','voice_voicemail','mailbox_context'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4bbb,0x1c3));var _0xb4bb=function(_0x2b3b45,_0x129a02){_0x2b3b45=_0x2b3b45-0x0;var _0x5d951a=_0x4bbb[_0x2b3b45];return _0x5d951a;};'use strict';var _=require(_0xb4bb('0x0'));var util=require('util');var logger=require(_0xb4bb('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4bb('0x2'));var rimraf=require(_0xb4bb('0x3'));var config=require(_0xb4bb('0x4'));var attributes=require(_0xb4bb('0x5'));module['exports']=function(_0xff135c,_0x28b702){return _0xff135c['define']('VoiceMail',attributes,{'tableName':_0xb4bb('0x6'),'paranoid':![],'indexes':[{'name':_0xb4bb('0x7'),'fields':[_0xb4bb('0x8'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2dcca9a..beea0b7 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 _0x8b50=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8b50,0x131));var _0x08b5=function(_0x3447bd,_0x34f6d3){_0x3447bd=_0x3447bd-0x0;var _0x2290bb=_0x8b50[_0x3447bd];return _0x2290bb;};'use strict';var _=require('lodash');var util=require(_0x08b5('0x0'));var moment=require(_0x08b5('0x1'));var BPromise=require(_0x08b5('0x2'));var rs=require(_0x08b5('0x3'));var fs=require('fs');var Redis=require(_0x08b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08b5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x08b5('0x6'));var jayson=require(_0x08b5('0x7'));var client=jayson[_0x08b5('0x8')][_0x08b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3757c5,_0x4461f7,_0x58afb0){return new BPromise(function(_0x2e7bde,_0x4caf8d){return client[_0x08b5('0xa')](_0x3757c5,_0x58afb0)[_0x08b5('0xb')](function(_0x44d72a){logger['info'](_0x08b5('0xc'),_0x4461f7,_0x08b5('0xd'));logger[_0x08b5('0xe')](_0x08b5('0xf'),_0x4461f7,_0x08b5('0xd'),JSON[_0x08b5('0x10')](_0x44d72a));if(_0x44d72a[_0x08b5('0x11')]){if(_0x44d72a['error']['code']===0x1f4){logger[_0x08b5('0x11')](_0x08b5('0xc'),_0x4461f7,_0x44d72a['error']['message']);return _0x4caf8d(_0x44d72a[_0x08b5('0x11')][_0x08b5('0x12')]);}logger[_0x08b5('0x11')](_0x08b5('0xc'),_0x4461f7,_0x44d72a[_0x08b5('0x11')][_0x08b5('0x12')]);return _0x2e7bde(_0x44d72a[_0x08b5('0x11')][_0x08b5('0x12')]);}else{logger['info'](_0x08b5('0xc'),_0x4461f7,_0x08b5('0xd'));_0x2e7bde(_0x44d72a[_0x08b5('0x13')][_0x08b5('0x12')]);}})['catch'](function(_0x4d7ae4){logger[_0x08b5('0x11')](_0x08b5('0xc'),_0x4461f7,_0x4d7ae4);_0x4caf8d(_0x4d7ae4);});});} \ No newline at end of file +var _0x4344=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4344,0x1ec));var _0x4434=function(_0x49818a,_0x4e961f){_0x49818a=_0x49818a-0x0;var _0x3f58c5=_0x4344[_0x49818a];return _0x3f58c5;};'use strict';var _=require(_0x4434('0x0'));var util=require(_0x4434('0x1'));var moment=require(_0x4434('0x2'));var BPromise=require(_0x4434('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4434('0x4'))['db'];var utils=require(_0x4434('0x5'));var logger=require(_0x4434('0x6'))(_0x4434('0x7'));var config=require(_0x4434('0x8'));var jayson=require(_0x4434('0x9'));var client=jayson[_0x4434('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127524,_0x2e41e4,_0x573e22){return new BPromise(function(_0x20d81e,_0x35c105){return client[_0x4434('0xb')](_0x127524,_0x573e22)[_0x4434('0xc')](function(_0x3fb639){logger[_0x4434('0xd')](_0x4434('0xe'),_0x2e41e4,_0x4434('0xf'));logger[_0x4434('0x10')](_0x4434('0x11'),_0x2e41e4,_0x4434('0xf'),JSON[_0x4434('0x12')](_0x3fb639));if(_0x3fb639[_0x4434('0x13')]){if(_0x3fb639[_0x4434('0x13')]['code']===0x1f4){logger[_0x4434('0x13')]('VoiceMail,\x20%s,\x20%s',_0x2e41e4,_0x3fb639[_0x4434('0x13')]['message']);return _0x35c105(_0x3fb639[_0x4434('0x13')]['message']);}logger[_0x4434('0x13')](_0x4434('0xe'),_0x2e41e4,_0x3fb639[_0x4434('0x13')][_0x4434('0x14')]);return _0x20d81e(_0x3fb639[_0x4434('0x13')][_0x4434('0x14')]);}else{logger[_0x4434('0xd')](_0x4434('0xe'),_0x2e41e4,'request\x20sent');_0x20d81e(_0x3fb639['result'][_0x4434('0x14')]);}})['catch'](function(_0x2529b8){logger['error'](_0x4434('0xe'),_0x2e41e4,_0x2529b8);_0x35c105(_0x2529b8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f1fa365..8e951b5 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 _0x0aff=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/download','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4cf2ac,_0x39d182){var _0xbf5dc1=function(_0xd7e307){while(--_0xd7e307){_0x4cf2ac['push'](_0x4cf2ac['shift']());}};_0xbf5dc1(++_0x39d182);}(_0x0aff,0x1cb));var _0xf0af=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x0aff[_0x18546c];return _0x46ef43;};'use strict';var multer=require(_0xf0af('0x0'));var util=require(_0xf0af('0x1'));var path=require(_0xf0af('0x2'));var timeout=require(_0xf0af('0x3'));var express=require(_0xf0af('0x4'));var router=express[_0xf0af('0x5')]();var fs_extra=require(_0xf0af('0x6'));var auth=require(_0xf0af('0x7'));var interaction=require(_0xf0af('0x8'));var config=require(_0xf0af('0x9'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf0af('0xa')]);router[_0xf0af('0xb')](_0xf0af('0xc'),auth[_0xf0af('0xd')](),controller['show']);router[_0xf0af('0xb')](_0xf0af('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xf0af('0xf')]('/',auth[_0xf0af('0xd')](),controller['create']);router[_0xf0af('0x10')]('/:id',auth[_0xf0af('0xd')](),controller[_0xf0af('0x11')]);router[_0xf0af('0x12')](_0xf0af('0xc'),auth[_0xf0af('0xd')](),controller[_0xf0af('0x13')]);module[_0xf0af('0x14')]=router; \ No newline at end of file +var _0x96a3=['/:id','show','/:id/download','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x191674,_0x5b3d48){var _0x2fd9cb=function(_0x53f67d){while(--_0x53f67d){_0x191674['push'](_0x191674['shift']());}};_0x2fd9cb(++_0x5b3d48);}(_0x96a3,0xf2));var _0x396a=function(_0x16d04a,_0x23f5f8){_0x16d04a=_0x16d04a-0x0;var _0x4ec0c2=_0x96a3[_0x16d04a];return _0x4ec0c2;};'use strict';var multer=require(_0x396a('0x0'));var util=require(_0x396a('0x1'));var path=require('path');var timeout=require(_0x396a('0x2'));var express=require(_0x396a('0x3'));var router=express[_0x396a('0x4')]();var fs_extra=require(_0x396a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x396a('0x6'));var controller=require(_0x396a('0x7'));router[_0x396a('0x8')]('/',auth[_0x396a('0x9')](),controller['index']);router[_0x396a('0x8')](_0x396a('0xa'),auth['isAuthenticated'](),controller[_0x396a('0xb')]);router[_0x396a('0x8')](_0x396a('0xc'),auth[_0x396a('0x9')](),controller['download']);router[_0x396a('0xd')]('/',auth[_0x396a('0x9')](),controller[_0x396a('0xe')]);router['put'](_0x396a('0xa'),auth[_0x396a('0x9')](),controller['update']);router[_0x396a('0xf')]('/:id',auth[_0x396a('0x9')](),controller[_0x396a('0x10')]);module[_0x396a('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 5b37312..f3a0847 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 _0x29e7=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL'];(function(_0x2986d5,_0x37db4a){var _0x14dff2=function(_0x1e08e2){while(--_0x1e08e2){_0x2986d5['push'](_0x2986d5['shift']());}};_0x14dff2(++_0x37db4a);}(_0x29e7,0x16f));var _0x729e=function(_0x475bf1,_0x5235b6){_0x475bf1=_0x475bf1-0x0;var _0x4095d1=_0x29e7[_0x475bf1];return _0x4095d1;};'use strict';var Sequelize=require(_0x729e('0x0'));module[_0x729e('0x1')]={'name':{'type':Sequelize[_0x729e('0x2')],'get':function(_0xe3f68a){return this[_0x729e('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x729e('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x729e('0x6')](_0x729e('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x729e('0x5')],'defaultValue':''},'stamp':{'type':_0x729e('0x8'),'defaultValue':Sequelize[_0x729e('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x7e40=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x1277a6,_0x12f4e3){var _0x347020=function(_0x34972d){while(--_0x34972d){_0x1277a6['push'](_0x1277a6['shift']());}};_0x347020(++_0x12f4e3);}(_0x7e40,0x81));var _0x07e4=function(_0x4244f8,_0x42dd75){_0x4244f8=_0x4244f8-0x0;var _0x49fd44=_0x7e40[_0x4244f8];return _0x49fd44;};'use strict';var Sequelize=require('sequelize');module[_0x07e4('0x0')]={'name':{'type':Sequelize[_0x07e4('0x1')],'get':function(_0x2a9e34){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x07e4('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x07e4('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x07e4('0x3')],'defaultValue':''},'stamp':{'type':_0x07e4('0x5'),'defaultValue':Sequelize[_0x07e4('0x6')](_0x07e4('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1f1cdf4..1660dea 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 _0x4c44=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','save','then','destroy','end','error','stack','send','index','VoiceMailMessage','rawAttributes','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','catch','update','body','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','request-promise','moment'];(function(_0x382cd4,_0x5d3c15){var _0x4fe7b5=function(_0x44edff){while(--_0x44edff){_0x382cd4['push'](_0x382cd4['shift']());}};_0x4fe7b5(++_0x5d3c15);}(_0x4c44,0x9a));var _0x44c4=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x4c44[_0x1b4002];return _0x1716f3;};'use strict';var emlformat=require(_0x44c4('0x0'));var rimraf=require(_0x44c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44c4('0x2'));var moment=require(_0x44c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x44c4('0x4'));var util=require(_0x44c4('0x5'));var path=require(_0x44c4('0x6'));var sox=require(_0x44c4('0x7'));var csv=require(_0x44c4('0x8'));var ejs=require(_0x44c4('0x9'));var fs=require('fs');var fs_extra=require(_0x44c4('0xa'));var _=require(_0x44c4('0xb'));var squel=require(_0x44c4('0xc'));var crypto=require(_0x44c4('0xd'));var jsforce=require(_0x44c4('0xe'));var deskjs=require(_0x44c4('0xf'));var toCsv=require(_0x44c4('0x8'));var querystring=require(_0x44c4('0x10'));var Papa=require(_0x44c4('0x11'));var Redis=require('ioredis');var authService=require(_0x44c4('0x12'));var qs=require(_0x44c4('0x13'));var as=require(_0x44c4('0x14'));var hardwareService=require(_0x44c4('0x15'));var logger=require('../../config/logger')(_0x44c4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x44c4('0x17'))['db'];function respondWithStatusCode(_0x2611af,_0x573a8e){_0x573a8e=_0x573a8e||0xcc;return function(_0x2205a6){if(_0x2205a6){return _0x2611af[_0x44c4('0x18')](_0x573a8e);}return _0x2611af[_0x44c4('0x19')](_0x573a8e)['end']();};}function respondWithResult(_0x5d2a75,_0x1d220b){_0x1d220b=_0x1d220b||0xc8;return function(_0x55b11d){if(_0x55b11d){return _0x5d2a75[_0x44c4('0x19')](_0x1d220b)['json'](_0x55b11d);}};}function respondWithFilteredResult(_0x3ae544,_0x5a2070){return function(_0x421816){if(_0x421816){var _0x2dd70c=typeof _0x5a2070[_0x44c4('0x1a')]==='undefined'&&typeof _0x5a2070[_0x44c4('0x1b')]==='undefined';var _0x1ce8ba=_0x421816['count'];var _0x190dc8=_0x2dd70c?0x0:_0x5a2070['offset'];var _0x135dfb=_0x2dd70c?_0x421816['count']:_0x5a2070[_0x44c4('0x1a')]+_0x5a2070['limit'];var _0x4462b1;if(_0x135dfb>=_0x1ce8ba){_0x135dfb=_0x1ce8ba;_0x4462b1=0xc8;}else{_0x4462b1=0xce;}_0x3ae544[_0x44c4('0x19')](_0x4462b1);return _0x3ae544[_0x44c4('0x1c')](_0x44c4('0x1d'),_0x190dc8+'-'+_0x135dfb+'/'+_0x1ce8ba)[_0x44c4('0x1e')](_0x421816);}return null;};}function patchUpdates(_0x268f9f){return function(_0x55d563){try{jsonpatch[_0x44c4('0x1f')](_0x55d563,_0x268f9f,!![]);}catch(_0x3b3884){return BPromise['reject'](_0x3b3884);}return _0x55d563[_0x44c4('0x20')]();};}function saveUpdates(_0xfcb62,_0x39b61e){return function(_0x4ddc10){if(_0x4ddc10){return _0x4ddc10['update'](_0xfcb62)[_0x44c4('0x21')](function(_0x578ab8){return _0x578ab8;});}return null;};}function removeEntity(_0x5e1115,_0x275760){return function(_0x12de24){if(_0x12de24){return _0x12de24[_0x44c4('0x22')]()['then'](function(){_0x5e1115[_0x44c4('0x19')](0xcc)[_0x44c4('0x23')]();});}};}function handleEntityNotFound(_0x351c3f,_0x30ee7c){return function(_0x4eb35c){if(!_0x4eb35c){_0x351c3f[_0x44c4('0x18')](0x194);}return _0x4eb35c;};}function handleError(_0x45b977,_0x5de146){_0x5de146=_0x5de146||0x1f4;return function(_0x4b430c){logger[_0x44c4('0x24')](_0x4b430c[_0x44c4('0x25')]);if(_0x4b430c['name']){delete _0x4b430c['name'];}_0x45b977['status'](_0x5de146)[_0x44c4('0x26')](_0x4b430c);};}exports[_0x44c4('0x27')]=function(_0x3d5bd0,_0x5be564){var _0x31dff8={},_0x4bfca8={},_0x2d0796={'count':0x0,'rows':[]};var _0x3df61f=_['map'](db[_0x44c4('0x28')][_0x44c4('0x29')],function(_0x18337e){return{'name':_0x18337e['fieldName'],'type':_0x18337e[_0x44c4('0x2a')][_0x44c4('0x2b')]};});_0x4bfca8[_0x44c4('0x2c')]=_['differenceBy'](_[_0x44c4('0x2d')](_0x3df61f,'name'),[_0x44c4('0x2e')]);_0x4bfca8[_0x44c4('0x2f')]=_[_0x44c4('0x30')](_0x3d5bd0[_0x44c4('0x2f')]);_0x4bfca8[_0x44c4('0x31')]=_['intersection'](_0x4bfca8[_0x44c4('0x2c')],_0x4bfca8[_0x44c4('0x2f')]);_0x31dff8[_0x44c4('0x32')]=_[_0x44c4('0x33')](_0x4bfca8[_0x44c4('0x2c')],qs['fields'](_0x3d5bd0[_0x44c4('0x2f')][_0x44c4('0x34')]));_0x31dff8['attributes']=_0x31dff8[_0x44c4('0x32')][_0x44c4('0x35')]?_0x31dff8[_0x44c4('0x32')]:_0x4bfca8['model'];if(!_0x3d5bd0[_0x44c4('0x2f')]['hasOwnProperty']('nolimit')){_0x31dff8[_0x44c4('0x1b')]=qs[_0x44c4('0x1b')](_0x3d5bd0[_0x44c4('0x2f')][_0x44c4('0x1b')]);_0x31dff8['offset']=qs[_0x44c4('0x1a')](_0x3d5bd0[_0x44c4('0x2f')]['offset']);}_0x31dff8[_0x44c4('0x36')]=qs['sort'](_0x3d5bd0[_0x44c4('0x2f')]['sort']);_0x31dff8[_0x44c4('0x37')]=qs['filters'](_[_0x44c4('0x38')](_0x3d5bd0[_0x44c4('0x2f')],_0x4bfca8[_0x44c4('0x31')]),_0x3df61f);if(_0x3d5bd0[_0x44c4('0x2f')]['filter']){_0x31dff8[_0x44c4('0x37')]=_[_0x44c4('0x39')](_0x31dff8[_0x44c4('0x37')],{'$or':_[_0x44c4('0x2d')](_0x3df61f,function(_0x589d51){if(_0x589d51[_0x44c4('0x2a')]!==_0x44c4('0x3a')){var _0x19ac95={};_0x19ac95[_0x589d51[_0x44c4('0x2e')]]={'$like':'%'+_0x3d5bd0[_0x44c4('0x2f')]['filter']+'%'};return _0x19ac95;}})});}_0x31dff8=_['merge']({},_0x31dff8,_0x3d5bd0[_0x44c4('0x3b')]);var _0x3fbeb8={'where':_0x31dff8['where']};return db[_0x44c4('0x28')]['count'](_0x3fbeb8)[_0x44c4('0x21')](function(_0x586402){_0x2d0796['count']=_0x586402;if(_0x3d5bd0[_0x44c4('0x2f')][_0x44c4('0x3c')]){_0x31dff8[_0x44c4('0x3d')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x44c4('0x3e')](_0x31dff8);})[_0x44c4('0x21')](function(_0x25a0a2){_0x2d0796['rows']=_0x25a0a2;return _0x2d0796;})[_0x44c4('0x21')](respondWithFilteredResult(_0x5be564,_0x31dff8))['catch'](handleError(_0x5be564,null));};exports[_0x44c4('0x3f')]=function(_0x58cd3d,_0x85d20d){var _0x589a41={'raw':!![],'where':{'id':_0x58cd3d[_0x44c4('0x40')]['id']}},_0x4e1941={};_0x4e1941[_0x44c4('0x2c')]=_[_0x44c4('0x30')](db[_0x44c4('0x28')][_0x44c4('0x29')]);_0x4e1941[_0x44c4('0x2f')]=_['keys'](_0x58cd3d[_0x44c4('0x2f')]);_0x4e1941['filters']=_[_0x44c4('0x33')](_0x4e1941[_0x44c4('0x2c')],_0x4e1941[_0x44c4('0x2f')]);_0x589a41[_0x44c4('0x32')]=_[_0x44c4('0x33')](_0x4e1941[_0x44c4('0x2c')],qs[_0x44c4('0x34')](_0x58cd3d['query']['fields']));_0x589a41[_0x44c4('0x32')]=_0x589a41['attributes'][_0x44c4('0x35')]?_0x589a41[_0x44c4('0x32')]:_0x4e1941[_0x44c4('0x2c')];if(_0x58cd3d[_0x44c4('0x2f')][_0x44c4('0x3c')]){_0x589a41['include']=[{'all':!![]}];}_0x589a41=_['merge']({},_0x589a41,_0x58cd3d['options']);return db[_0x44c4('0x28')][_0x44c4('0x41')](_0x589a41)[_0x44c4('0x21')](handleEntityNotFound(_0x85d20d,null))[_0x44c4('0x21')](respondWithResult(_0x85d20d,null))['catch'](handleError(_0x85d20d,null));};exports[_0x44c4('0x42')]=function(_0x103bc3,_0x38ed76){return db[_0x44c4('0x28')][_0x44c4('0x42')](_0x103bc3['body'],{})[_0x44c4('0x21')](respondWithResult(_0x38ed76,0xc9))[_0x44c4('0x43')](handleError(_0x38ed76,null));};exports[_0x44c4('0x44')]=function(_0x468dcb,_0x51fa34){if(_0x468dcb[_0x44c4('0x45')]['id']){delete _0x468dcb[_0x44c4('0x45')]['id'];}return db[_0x44c4('0x28')][_0x44c4('0x41')]({'where':{'id':_0x468dcb[_0x44c4('0x40')]['id']}})[_0x44c4('0x21')](handleEntityNotFound(_0x51fa34,null))[_0x44c4('0x21')](saveUpdates(_0x468dcb['body'],null))[_0x44c4('0x21')](respondWithResult(_0x51fa34,null))[_0x44c4('0x43')](handleError(_0x51fa34,null));};exports['destroy']=function(_0xac4158,_0xb383ed){return db[_0x44c4('0x28')][_0x44c4('0x41')]({'where':{'id':_0xac4158['params']['id']}})['then'](handleEntityNotFound(_0xb383ed,null))[_0x44c4('0x21')](removeEntity(_0xb383ed,null))[_0x44c4('0x43')](handleError(_0xb383ed,null));};exports[_0x44c4('0x46')]=function(_0x438982,_0x5ad5ec,_0x3f5ec3){return db[_0x44c4('0x28')][_0x44c4('0x41')]({'where':{'id':_0x438982[_0x44c4('0x40')]['id']},'attributes':['id','recording',_0x44c4('0x47')]})[_0x44c4('0x21')](handleEntityNotFound(_0x5ad5ec,null))[_0x44c4('0x21')](function(_0x3d838a){if(_0x3d838a){if(!_0x3d838a[_0x44c4('0x48')]){throw new db[(_0x44c4('0x49'))]['ValidationError'](_0x44c4('0x4a'));}var _0x2facd0={'Content-Type':_0x44c4('0x4b'),'Content-Disposition':'attachment'};if(_0x3d838a[_0x44c4('0x47')]){_0x2facd0[_0x44c4('0x4c')]=_0x44c4('0x4d')+_0x3d838a[_0x44c4('0x47')]+_0x44c4('0x4e');}_0x5ad5ec[_0x44c4('0x1c')](_0x2facd0);return _0x5ad5ec['send'](new Buffer(_0x3d838a[_0x44c4('0x48')]));}})[_0x44c4('0x43')](handleError(_0x5ad5ec,null));}; \ No newline at end of file +var _0x5cf9=['params','options','find','create','body','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x5cf9,0x165));var _0x95cf=function(_0x149573,_0x3be55a){_0x149573=_0x149573-0x0;var _0x36a940=_0x5cf9[_0x149573];return _0x36a940;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95cf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95cf('0x1'));var rp=require('request-promise');var moment=require(_0x95cf('0x2'));var BPromise=require(_0x95cf('0x3'));var Mustache=require(_0x95cf('0x4'));var util=require(_0x95cf('0x5'));var path=require('path');var sox=require(_0x95cf('0x6'));var csv=require(_0x95cf('0x7'));var ejs=require(_0x95cf('0x8'));var fs=require('fs');var fs_extra=require(_0x95cf('0x9'));var _=require(_0x95cf('0xa'));var squel=require(_0x95cf('0xb'));var crypto=require(_0x95cf('0xc'));var jsforce=require(_0x95cf('0xd'));var deskjs=require(_0x95cf('0xe'));var toCsv=require(_0x95cf('0x7'));var querystring=require('querystring');var Papa=require(_0x95cf('0xf'));var Redis=require(_0x95cf('0x10'));var authService=require(_0x95cf('0x11'));var qs=require(_0x95cf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95cf('0x13'));var logger=require(_0x95cf('0x14'))(_0x95cf('0x15'));var utils=require(_0x95cf('0x16'));var config=require(_0x95cf('0x17'));var licenseUtil=require(_0x95cf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aebb7,_0x6d43a0){_0x6d43a0=_0x6d43a0||0xcc;return function(_0x39f623){if(_0x39f623){return _0x2aebb7[_0x95cf('0x19')](_0x6d43a0);}return _0x2aebb7[_0x95cf('0x1a')](_0x6d43a0)[_0x95cf('0x1b')]();};}function respondWithResult(_0x47acd2,_0x28a1fb){_0x28a1fb=_0x28a1fb||0xc8;return function(_0x5e19eb){if(_0x5e19eb){return _0x47acd2[_0x95cf('0x1a')](_0x28a1fb)[_0x95cf('0x1c')](_0x5e19eb);}};}function respondWithFilteredResult(_0x51cb92,_0x5c0c12){return function(_0x25240e){if(_0x25240e){var _0x25f484=typeof _0x5c0c12[_0x95cf('0x1d')]===_0x95cf('0x1e')&&typeof _0x5c0c12[_0x95cf('0x1f')]===_0x95cf('0x1e');var _0x215dcd=_0x25240e[_0x95cf('0x20')];var _0x3ba017=_0x25f484?0x0:_0x5c0c12[_0x95cf('0x1d')];var _0x191ac9=_0x25f484?_0x25240e[_0x95cf('0x20')]:_0x5c0c12[_0x95cf('0x1d')]+_0x5c0c12['limit'];var _0x18842e;if(_0x191ac9>=_0x215dcd){_0x191ac9=_0x215dcd;_0x18842e=0xc8;}else{_0x18842e=0xce;}_0x51cb92[_0x95cf('0x1a')](_0x18842e);return _0x51cb92[_0x95cf('0x21')](_0x95cf('0x22'),_0x3ba017+'-'+_0x191ac9+'/'+_0x215dcd)['json'](_0x25240e);}return null;};}function patchUpdates(_0xe50025){return function(_0x107eed){try{jsonpatch[_0x95cf('0x23')](_0x107eed,_0xe50025,!![]);}catch(_0x2d6446){return BPromise[_0x95cf('0x24')](_0x2d6446);}return _0x107eed[_0x95cf('0x25')]();};}function saveUpdates(_0x27cb6e,_0x12c46f){return function(_0x432401){if(_0x432401){return _0x432401[_0x95cf('0x26')](_0x27cb6e)[_0x95cf('0x27')](function(_0x882728){return _0x882728;});}return null;};}function removeEntity(_0x3859ad,_0x2bfb1d){return function(_0xcf8a6c){if(_0xcf8a6c){return _0xcf8a6c['destroy']()[_0x95cf('0x27')](function(){_0x3859ad[_0x95cf('0x1a')](0xcc)[_0x95cf('0x1b')]();});}};}function handleEntityNotFound(_0x1fac4a,_0x20e427){return function(_0x5e4fe4){if(!_0x5e4fe4){_0x1fac4a[_0x95cf('0x19')](0x194);}return _0x5e4fe4;};}function handleError(_0x4911dc,_0x44f453){_0x44f453=_0x44f453||0x1f4;return function(_0x3b0b60){logger[_0x95cf('0x28')](_0x3b0b60[_0x95cf('0x29')]);if(_0x3b0b60['name']){delete _0x3b0b60[_0x95cf('0x2a')];}_0x4911dc[_0x95cf('0x1a')](_0x44f453)[_0x95cf('0x2b')](_0x3b0b60);};}exports[_0x95cf('0x2c')]=function(_0x5f1edd,_0x27ea72){var _0x30fef2={},_0x950520={},_0x597045={'count':0x0,'rows':[]};var _0x223cd2=_[_0x95cf('0x2d')](db[_0x95cf('0x2e')][_0x95cf('0x2f')],function(_0x4bb1ef){return{'name':_0x4bb1ef[_0x95cf('0x30')],'type':_0x4bb1ef[_0x95cf('0x31')][_0x95cf('0x32')]};});_0x950520['model']=_[_0x95cf('0x33')](_['map'](_0x223cd2,_0x95cf('0x2a')),['name']);_0x950520[_0x95cf('0x34')]=_[_0x95cf('0x35')](_0x5f1edd[_0x95cf('0x34')]);_0x950520[_0x95cf('0x36')]=_[_0x95cf('0x37')](_0x950520[_0x95cf('0x38')],_0x950520[_0x95cf('0x34')]);_0x30fef2[_0x95cf('0x39')]=_[_0x95cf('0x37')](_0x950520[_0x95cf('0x38')],qs['fields'](_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x3a')]));_0x30fef2['attributes']=_0x30fef2['attributes'][_0x95cf('0x3b')]?_0x30fef2[_0x95cf('0x39')]:_0x950520['model'];if(!_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x3c')](_0x95cf('0x3d'))){_0x30fef2[_0x95cf('0x1f')]=qs[_0x95cf('0x1f')](_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x1f')]);_0x30fef2['offset']=qs[_0x95cf('0x1d')](_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x1d')]);}_0x30fef2['order']=qs[_0x95cf('0x3e')](_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x3e')]);_0x30fef2[_0x95cf('0x3f')]=qs[_0x95cf('0x36')](_[_0x95cf('0x40')](_0x5f1edd[_0x95cf('0x34')],_0x950520[_0x95cf('0x36')]),_0x223cd2);if(_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x41')]){_0x30fef2[_0x95cf('0x3f')]=_[_0x95cf('0x42')](_0x30fef2[_0x95cf('0x3f')],{'$or':_[_0x95cf('0x2d')](_0x223cd2,function(_0x6c001d){if(_0x6c001d[_0x95cf('0x31')]!=='VIRTUAL'){var _0x118609={};_0x118609[_0x6c001d['name']]={'$like':'%'+_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x41')]+'%'};return _0x118609;}})});}_0x30fef2=_['merge']({},_0x30fef2,_0x5f1edd['options']);var _0x11aadc={'where':_0x30fef2[_0x95cf('0x3f')]};return db[_0x95cf('0x2e')]['count'](_0x11aadc)[_0x95cf('0x27')](function(_0x320ae0){_0x597045[_0x95cf('0x20')]=_0x320ae0;if(_0x5f1edd[_0x95cf('0x34')][_0x95cf('0x43')]){_0x30fef2[_0x95cf('0x44')]=[{'all':!![]}];}return db[_0x95cf('0x2e')][_0x95cf('0x45')](_0x30fef2);})[_0x95cf('0x27')](function(_0x44c56e){_0x597045[_0x95cf('0x46')]=_0x44c56e;return _0x597045;})[_0x95cf('0x27')](respondWithFilteredResult(_0x27ea72,_0x30fef2))[_0x95cf('0x47')](handleError(_0x27ea72,null));};exports[_0x95cf('0x48')]=function(_0x402485,_0x2ff4bc){var _0x1a3ac6={'raw':!![],'where':{'id':_0x402485[_0x95cf('0x49')]['id']}},_0x492ed5={};_0x492ed5['model']=_[_0x95cf('0x35')](db[_0x95cf('0x2e')]['rawAttributes']);_0x492ed5[_0x95cf('0x34')]=_[_0x95cf('0x35')](_0x402485['query']);_0x492ed5[_0x95cf('0x36')]=_[_0x95cf('0x37')](_0x492ed5[_0x95cf('0x38')],_0x492ed5[_0x95cf('0x34')]);_0x1a3ac6['attributes']=_[_0x95cf('0x37')](_0x492ed5[_0x95cf('0x38')],qs[_0x95cf('0x3a')](_0x402485[_0x95cf('0x34')]['fields']));_0x1a3ac6['attributes']=_0x1a3ac6[_0x95cf('0x39')][_0x95cf('0x3b')]?_0x1a3ac6[_0x95cf('0x39')]:_0x492ed5[_0x95cf('0x38')];if(_0x402485[_0x95cf('0x34')][_0x95cf('0x43')]){_0x1a3ac6[_0x95cf('0x44')]=[{'all':!![]}];}_0x1a3ac6=_[_0x95cf('0x42')]({},_0x1a3ac6,_0x402485[_0x95cf('0x4a')]);return db[_0x95cf('0x2e')][_0x95cf('0x4b')](_0x1a3ac6)['then'](handleEntityNotFound(_0x2ff4bc,null))['then'](respondWithResult(_0x2ff4bc,null))[_0x95cf('0x47')](handleError(_0x2ff4bc,null));};exports[_0x95cf('0x4c')]=function(_0x53436e,_0x27880a){return db[_0x95cf('0x2e')]['create'](_0x53436e[_0x95cf('0x4d')],{})['then'](respondWithResult(_0x27880a,0xc9))[_0x95cf('0x47')](handleError(_0x27880a,null));};exports[_0x95cf('0x26')]=function(_0x4d74e6,_0x1f6235){if(_0x4d74e6[_0x95cf('0x4d')]['id']){delete _0x4d74e6[_0x95cf('0x4d')]['id'];}return db[_0x95cf('0x2e')]['find']({'where':{'id':_0x4d74e6[_0x95cf('0x49')]['id']}})[_0x95cf('0x27')](handleEntityNotFound(_0x1f6235,null))['then'](saveUpdates(_0x4d74e6[_0x95cf('0x4d')],null))[_0x95cf('0x27')](respondWithResult(_0x1f6235,null))[_0x95cf('0x47')](handleError(_0x1f6235,null));};exports['destroy']=function(_0x40ac41,_0x498b47){return db[_0x95cf('0x2e')][_0x95cf('0x4b')]({'where':{'id':_0x40ac41[_0x95cf('0x49')]['id']}})[_0x95cf('0x27')](handleEntityNotFound(_0x498b47,null))[_0x95cf('0x27')](removeEntity(_0x498b47,null))[_0x95cf('0x47')](handleError(_0x498b47,null));};exports['download']=function(_0x3c7fa1,_0x2dfdc3,_0x1ff0f9){return db['VoiceMailMessage']['find']({'where':{'id':_0x3c7fa1['params']['id']},'attributes':['id',_0x95cf('0x4e'),_0x95cf('0x4f')]})['then'](handleEntityNotFound(_0x2dfdc3,null))['then'](function(_0x3b1df8){if(_0x3b1df8){if(!_0x3b1df8[_0x95cf('0x4e')]){throw new db[(_0x95cf('0x50'))]['ValidationError'](_0x95cf('0x51'));}var _0x463d88={'Content-Type':_0x95cf('0x52'),'Content-Disposition':'attachment'};if(_0x3b1df8[_0x95cf('0x4f')]){_0x463d88[_0x95cf('0x53')]=_0x95cf('0x54')+_0x3b1df8[_0x95cf('0x4f')]+_0x95cf('0x55');}_0x2dfdc3[_0x95cf('0x21')](_0x463d88);return _0x2dfdc3[_0x95cf('0x2b')](new Buffer(_0x3b1df8['recording']));}})[_0x95cf('0x47')](handleError(_0x2dfdc3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f27a7ce..3529838 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 _0x99c9=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x22b108,_0x462562){var _0x4ce9a9=function(_0x501dbe){while(--_0x501dbe){_0x22b108['push'](_0x22b108['shift']());}};_0x4ce9a9(++_0x462562);}(_0x99c9,0xe2));var _0x999c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x99c9[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fs=require('fs');var path=require(_0x999c('0x7'));var rimraf=require(_0x999c('0x8'));var config=require(_0x999c('0x9'));var attributes=require(_0x999c('0xa'));module[_0x999c('0xb')]=function(_0x1e67f7,_0x5d7b42){return _0x1e67f7[_0x999c('0xc')](_0x999c('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x999c('0xe'),'fields':[_0x999c('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x454c=['dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x48f03b,_0x4484b6){var _0x272b72=function(_0x371c8e){while(--_0x371c8e){_0x48f03b['push'](_0x48f03b['shift']());}};_0x272b72(++_0x4484b6);}(_0x454c,0x1f0));var _0xc454=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x454c[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xc454('0x0'));var util=require(_0xc454('0x1'));var logger=require('../../config/logger')(_0xc454('0x2'));var moment=require(_0xc454('0x3'));var BPromise=require(_0xc454('0x4'));var rp=require(_0xc454('0x5'));var fs=require('fs');var path=require(_0xc454('0x6'));var rimraf=require(_0xc454('0x7'));var config=require(_0xc454('0x8'));var attributes=require(_0xc454('0x9'));module[_0xc454('0xa')]=function(_0x509f9f,_0x121c35){return _0x509f9f[_0xc454('0xb')](_0xc454('0xc'),attributes,{'tableName':_0xc454('0xd'),'paranoid':![],'indexes':[{'name':_0xc454('0xe'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4a6ae8f..b2d4307 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 _0x7d6c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28e7ad,_0x304787){var _0x111aeb=function(_0x1df52b){while(--_0x1df52b){_0x28e7ad['push'](_0x28e7ad['shift']());}};_0x111aeb(++_0x304787);}(_0x7d6c,0x10d));var _0xc7d6=function(_0x4830b3,_0x499059){_0x4830b3=_0x4830b3-0x0;var _0x58ec71=_0x7d6c[_0x4830b3];return _0x58ec71;};'use strict';var _=require(_0xc7d6('0x0'));var util=require(_0xc7d6('0x1'));var moment=require(_0xc7d6('0x2'));var BPromise=require(_0xc7d6('0x3'));var rs=require(_0xc7d6('0x4'));var fs=require('fs');var Redis=require(_0xc7d6('0x5'));var db=require(_0xc7d6('0x6'))['db'];var utils=require(_0xc7d6('0x7'));var logger=require(_0xc7d6('0x8'))(_0xc7d6('0x9'));var config=require(_0xc7d6('0xa'));var jayson=require(_0xc7d6('0xb'));var client=jayson[_0xc7d6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x139512,_0x5d2e95,_0x3c4ca7){return new BPromise(function(_0xd3bd6f,_0x198f81){return client['request'](_0x139512,_0x3c4ca7)['then'](function(_0x57f560){logger['info'](_0xc7d6('0xd'),_0x5d2e95,'request\x20sent');logger[_0xc7d6('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5d2e95,_0xc7d6('0xf'),JSON[_0xc7d6('0x10')](_0x57f560));if(_0x57f560[_0xc7d6('0x11')]){if(_0x57f560[_0xc7d6('0x11')][_0xc7d6('0x12')]===0x1f4){logger[_0xc7d6('0x11')](_0xc7d6('0xd'),_0x5d2e95,_0x57f560['error'][_0xc7d6('0x13')]);return _0x198f81(_0x57f560[_0xc7d6('0x11')][_0xc7d6('0x13')]);}logger[_0xc7d6('0x11')](_0xc7d6('0xd'),_0x5d2e95,_0x57f560['error'][_0xc7d6('0x13')]);return _0xd3bd6f(_0x57f560[_0xc7d6('0x11')][_0xc7d6('0x13')]);}else{logger[_0xc7d6('0x14')](_0xc7d6('0xd'),_0x5d2e95,_0xc7d6('0xf'));_0xd3bd6f(_0x57f560[_0xc7d6('0x15')][_0xc7d6('0x13')]);}})[_0xc7d6('0x16')](function(_0x417fea){logger['error'](_0xc7d6('0xd'),_0x5d2e95,_0x417fea);_0x198f81(_0x417fea);});});} \ No newline at end of file +var _0xf5f3=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf5f3,0x15f));var _0x3f5f=function(_0x15c6f2,_0x4a7db3){_0x15c6f2=_0x15c6f2-0x0;var _0x32dc53=_0xf5f3[_0x15c6f2];return _0x32dc53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f5f('0x0'));var BPromise=require(_0x3f5f('0x1'));var rs=require(_0x3f5f('0x2'));var fs=require('fs');var Redis=require(_0x3f5f('0x3'));var db=require(_0x3f5f('0x4'))['db'];var utils=require(_0x3f5f('0x5'));var logger=require(_0x3f5f('0x6'))(_0x3f5f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f5f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5a2d,_0x2a1384,_0x27a4de){return new BPromise(function(_0x116432,_0x35112a){return client['request'](_0x4b5a2d,_0x27a4de)[_0x3f5f('0x9')](function(_0x1b427f){logger[_0x3f5f('0xa')](_0x3f5f('0xb'),_0x2a1384,_0x3f5f('0xc'));logger[_0x3f5f('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2a1384,_0x3f5f('0xc'),JSON[_0x3f5f('0xe')](_0x1b427f));if(_0x1b427f[_0x3f5f('0xf')]){if(_0x1b427f[_0x3f5f('0xf')][_0x3f5f('0x10')]===0x1f4){logger[_0x3f5f('0xf')](_0x3f5f('0xb'),_0x2a1384,_0x1b427f['error'][_0x3f5f('0x11')]);return _0x35112a(_0x1b427f[_0x3f5f('0xf')][_0x3f5f('0x11')]);}logger[_0x3f5f('0xf')](_0x3f5f('0xb'),_0x2a1384,_0x1b427f['error']['message']);return _0x116432(_0x1b427f[_0x3f5f('0xf')][_0x3f5f('0x11')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x2a1384,_0x3f5f('0xc'));_0x116432(_0x1b427f[_0x3f5f('0x12')]['message']);}})['catch'](function(_0x9f5e75){logger[_0x3f5f('0xf')](_0x3f5f('0xb'),_0x2a1384,_0x9f5e75);_0x35112a(_0x9f5e75);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bc711fe..d611d15 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 _0x00a4=['delete','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','update'];(function(_0x58e008,_0x5f4471){var _0xa386b1=function(_0x1f69fd){while(--_0x1f69fd){_0x58e008['push'](_0x58e008['shift']());}};_0xa386b1(++_0x5f4471);}(_0x00a4,0x17a));var _0x400a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00a4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x400a('0x0'));var path=require(_0x400a('0x1'));var timeout=require(_0x400a('0x2'));var express=require('express');var router=express[_0x400a('0x3')]();var fs_extra=require(_0x400a('0x4'));var auth=require(_0x400a('0x5'));var interaction=require(_0x400a('0x6'));var config=require(_0x400a('0x7'));var controller=require(_0x400a('0x8'));router[_0x400a('0x9')]('/',auth['isAuthenticated'](),controller[_0x400a('0xa')]);router[_0x400a('0x9')](_0x400a('0xb'),auth['isAuthenticated'](),controller[_0x400a('0xc')]);router[_0x400a('0x9')](_0x400a('0xd'),auth[_0x400a('0xe')](),controller[_0x400a('0xf')]);router[_0x400a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x400a('0x10')](_0x400a('0xd'),auth[_0x400a('0xe')](),controller['addSound']);router['put'](_0x400a('0xb'),auth[_0x400a('0xe')](),controller[_0x400a('0x11')]);router[_0x400a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x400a('0x13')]);router['delete'](_0x400a('0x14'),auth[_0x400a('0xe')](),controller[_0x400a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa695=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','create','post','addSound','put','/:id','update','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x4cfb98,_0xe60dfe){var _0x38b42a=function(_0x53a68d){while(--_0x53a68d){_0x4cfb98['push'](_0x4cfb98['shift']());}};_0x38b42a(++_0xe60dfe);}(_0xa695,0x1df));var _0x5a69=function(_0x390533,_0x414258){_0x390533=_0x390533-0x0;var _0x315f75=_0xa695[_0x390533];return _0x315f75;};'use strict';var multer=require(_0x5a69('0x0'));var util=require('util');var path=require(_0x5a69('0x1'));var timeout=require(_0x5a69('0x2'));var express=require(_0x5a69('0x3'));var router=express[_0x5a69('0x4')]();var fs_extra=require(_0x5a69('0x5'));var auth=require(_0x5a69('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a69('0x7'));router[_0x5a69('0x8')]('/',auth[_0x5a69('0x9')](),controller[_0x5a69('0xa')]);router[_0x5a69('0x8')]('/:id',auth[_0x5a69('0x9')](),controller[_0x5a69('0xb')]);router[_0x5a69('0x8')](_0x5a69('0xc'),auth['isAuthenticated'](),controller[_0x5a69('0xd')]);router['post']('/',auth[_0x5a69('0x9')](),controller[_0x5a69('0xe')]);router[_0x5a69('0xf')](_0x5a69('0xc'),auth[_0x5a69('0x9')](),controller[_0x5a69('0x10')]);router[_0x5a69('0x11')](_0x5a69('0x12'),auth[_0x5a69('0x9')](),controller[_0x5a69('0x13')]);router['delete']('/:id',auth[_0x5a69('0x9')](),controller[_0x5a69('0x14')]);router['delete'](_0x5a69('0x15'),auth['isAuthenticated'](),controller[_0x5a69('0x16')]);module[_0x5a69('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c48701f..fd251b1 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 _0xa679=['mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0xa679,0x8a));var _0x9a67=function(_0x4123cd,_0x511de7){_0x4123cd=_0x4123cd-0x0;var _0x5369da=_0xa679[_0x4123cd];return _0x5369da;};'use strict';var Sequelize=require(_0x9a67('0x0'));module[_0x9a67('0x1')]={'name':{'type':Sequelize[_0x9a67('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9a67('0x3')](_0x9a67('0x4'),_0x9a67('0x5'),_0x9a67('0x6'),_0x9a67('0x7'),'quietmp3',_0x9a67('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![],'defaultValue':_0x9a67('0x9')},'format':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![]},'stamp':{'type':_0x9a67('0xa')},'defaultEntry':{'type':Sequelize[_0x9a67('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xab1c=['mp3','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x2e2720,_0x1ae995){var _0x3f9d2d=function(_0x5067a2){while(--_0x5067a2){_0x2e2720['push'](_0x2e2720['shift']());}};_0x3f9d2d(++_0x1ae995);}(_0xab1c,0x1cb));var _0xcab1=function(_0x23df83,_0x2f87f3){_0x23df83=_0x23df83-0x0;var _0x3203d2=_0xab1c[_0x23df83];return _0x3203d2;};'use strict';var Sequelize=require(_0xcab1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcab1('0x1')],'allowNull':![],'unique':_0xcab1('0x2')},'mode':{'type':Sequelize[_0xcab1('0x3')](_0xcab1('0x4'),_0xcab1('0x5'),_0xcab1('0x6'),_0xcab1('0x7'),_0xcab1('0x8'),_0xcab1('0x9')),'allowNull':!![],'defaultValue':_0xcab1('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xcab1('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xcab1('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xcab1('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xcab1('0x1')],'allowNull':!![]},'stamp':{'type':_0xcab1('0xa')},'defaultEntry':{'type':Sequelize[_0xcab1('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 8c48bd9..e7ad43b 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 _0x5572=['then','get','MusicOnHolds','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','catch','find','params','create','sequelize','transaction','body','mode','files','directory','join','root','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','sort','nolimit','getSounds','eml-format','rimraf','zip-dir','bluebird','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','reject','update','destroy'];(function(_0x2f5e86,_0x358bcd){var _0x44f1e6=function(_0x15c37c){while(--_0x15c37c){_0x2f5e86['push'](_0x2f5e86['shift']());}};_0x44f1e6(++_0x358bcd);}(_0x5572,0x195));var _0x2557=function(_0xa93b42,_0x2fe981){_0xa93b42=_0xa93b42-0x0;var _0x1befd5=_0x5572[_0xa93b42];return _0x1befd5;};'use strict';var emlformat=require(_0x2557('0x0'));var rimraf=require(_0x2557('0x1'));var zipdir=require(_0x2557('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2557('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2557('0x4'));var sox=require(_0x2557('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2557('0x6'));var _=require('lodash');var squel=require(_0x2557('0x7'));var crypto=require(_0x2557('0x8'));var jsforce=require(_0x2557('0x9'));var deskjs=require(_0x2557('0xa'));var toCsv=require(_0x2557('0xb'));var querystring=require('querystring');var Papa=require(_0x2557('0xc'));var Redis=require(_0x2557('0xd'));var authService=require(_0x2557('0xe'));var qs=require(_0x2557('0xf'));var as=require(_0x2557('0x10'));var hardwareService=require(_0x2557('0x11'));var logger=require(_0x2557('0x12'))(_0x2557('0x13'));var utils=require(_0x2557('0x14'));var config=require(_0x2557('0x15'));var licenseUtil=require(_0x2557('0x16'));var db=require(_0x2557('0x17'))['db'];function respondWithStatusCode(_0x40651e,_0x2ef0f1){_0x2ef0f1=_0x2ef0f1||0xcc;return function(_0x3f99fe){if(_0x3f99fe){return _0x40651e[_0x2557('0x18')](_0x2ef0f1);}return _0x40651e[_0x2557('0x19')](_0x2ef0f1)[_0x2557('0x1a')]();};}function respondWithResult(_0x378206,_0x1c17ee){_0x1c17ee=_0x1c17ee||0xc8;return function(_0x52c0bf){if(_0x52c0bf){return _0x378206['status'](_0x1c17ee)['json'](_0x52c0bf);}};}function respondWithFilteredResult(_0x23ae55,_0x44324f){return function(_0x3b0ad9){if(_0x3b0ad9){var _0x4c24c3=typeof _0x44324f['offset']===_0x2557('0x1b')&&typeof _0x44324f[_0x2557('0x1c')]==='undefined';var _0x33943a=_0x3b0ad9[_0x2557('0x1d')];var _0x3abdc7=_0x4c24c3?0x0:_0x44324f[_0x2557('0x1e')];var _0x40e1ab=_0x4c24c3?_0x3b0ad9[_0x2557('0x1d')]:_0x44324f[_0x2557('0x1e')]+_0x44324f[_0x2557('0x1c')];var _0x42fdfe;if(_0x40e1ab>=_0x33943a){_0x40e1ab=_0x33943a;_0x42fdfe=0xc8;}else{_0x42fdfe=0xce;}_0x23ae55[_0x2557('0x19')](_0x42fdfe);return _0x23ae55[_0x2557('0x1f')]('Content-Range',_0x3abdc7+'-'+_0x40e1ab+'/'+_0x33943a)['json'](_0x3b0ad9);}return null;};}function patchUpdates(_0x4522db){return function(_0x5e9287){try{jsonpatch['apply'](_0x5e9287,_0x4522db,!![]);}catch(_0x1a19ce){return BPromise[_0x2557('0x20')](_0x1a19ce);}return _0x5e9287['save']();};}function saveUpdates(_0x56f346,_0x1d11b3){return function(_0x14f129){if(_0x14f129){return _0x14f129[_0x2557('0x21')](_0x56f346)['then'](function(_0x20c5f5){return _0x20c5f5;});}return null;};}function removeEntity(_0x260a21,_0x304f4f){return function(_0x5440d0){if(_0x5440d0){return _0x5440d0[_0x2557('0x22')]()[_0x2557('0x23')](function(){var _0x4d85c4=_0x5440d0[_0x2557('0x24')]({'plain':!![]});var _0x5d4cc2=_0x2557('0x25');return db[_0x2557('0x26')][_0x2557('0x22')]({'where':{'type':_0x5d4cc2,'resourceId':_0x4d85c4['id']}})[_0x2557('0x23')](function(){return _0x5440d0;});})[_0x2557('0x23')](function(){_0x260a21[_0x2557('0x19')](0xcc)[_0x2557('0x1a')]();});}};}function handleEntityNotFound(_0x3ca017,_0x66756c){return function(_0x4d5969){if(!_0x4d5969){_0x3ca017['sendStatus'](0x194);}return _0x4d5969;};}function handleError(_0x4f9485,_0x3271f1){_0x3271f1=_0x3271f1||0x1f4;return function(_0x523684){logger['error'](_0x523684['stack']);if(_0x523684['name']){delete _0x523684[_0x2557('0x27')];}_0x4f9485[_0x2557('0x19')](_0x3271f1)[_0x2557('0x28')](_0x523684);};}exports['index']=function(_0x5a6e32,_0x5f39a7){var _0x377d3d={},_0x4c5bd7={},_0x7d5827={'count':0x0,'rows':[]};var _0x1cba6e=_[_0x2557('0x29')](db['VoiceMusicOnHold'][_0x2557('0x2a')],function(_0x382455){return{'name':_0x382455[_0x2557('0x2b')],'type':_0x382455[_0x2557('0x2c')][_0x2557('0x2d')]};});_0x4c5bd7['model']=_[_0x2557('0x29')](_0x1cba6e,_0x2557('0x27'));_0x4c5bd7[_0x2557('0x2e')]=_[_0x2557('0x2f')](_0x5a6e32[_0x2557('0x2e')]);_0x4c5bd7['filters']=_['intersection'](_0x4c5bd7[_0x2557('0x30')],_0x4c5bd7[_0x2557('0x2e')]);_0x377d3d['attributes']=_[_0x2557('0x31')](_0x4c5bd7[_0x2557('0x30')],qs[_0x2557('0x32')](_0x5a6e32[_0x2557('0x2e')]['fields']));_0x377d3d[_0x2557('0x33')]=_0x377d3d[_0x2557('0x33')][_0x2557('0x34')]?_0x377d3d[_0x2557('0x33')]:_0x4c5bd7[_0x2557('0x30')];if(!_0x5a6e32[_0x2557('0x2e')][_0x2557('0x35')]('nolimit')){_0x377d3d[_0x2557('0x1c')]=qs[_0x2557('0x1c')](_0x5a6e32[_0x2557('0x2e')][_0x2557('0x1c')]);_0x377d3d['offset']=qs[_0x2557('0x1e')](_0x5a6e32[_0x2557('0x2e')][_0x2557('0x1e')]);}_0x377d3d[_0x2557('0x36')]=qs['sort'](_0x5a6e32[_0x2557('0x2e')]['sort']);delete _0x5a6e32[_0x2557('0x2e')]['sort'];_0x377d3d[_0x2557('0x37')]=qs[_0x2557('0x38')](_[_0x2557('0x39')](_0x5a6e32['query'],_0x4c5bd7[_0x2557('0x38')]),_0x1cba6e);if(_0x5a6e32[_0x2557('0x2e')][_0x2557('0x3a')]){_0x377d3d[_0x2557('0x37')]=_[_0x2557('0x3b')](_0x377d3d['where'],{'$or':_[_0x2557('0x29')](_0x1cba6e,function(_0x10b9d5){if(_0x10b9d5[_0x2557('0x2c')]!==_0x2557('0x3c')){var _0x25d98e={};_0x25d98e[_0x10b9d5['name']]={'$like':'%'+_0x5a6e32[_0x2557('0x2e')][_0x2557('0x3a')]+'%'};return _0x25d98e;}})});}_0x377d3d=_['merge']({},_0x377d3d,_0x5a6e32[_0x2557('0x3d')]);var _0x3fd17b={'where':_0x377d3d[_0x2557('0x37')]};return db['VoiceMusicOnHold']['count'](_0x3fd17b)[_0x2557('0x23')](function(_0x49944f){_0x7d5827[_0x2557('0x1d')]=_0x49944f;if(_0x5a6e32[_0x2557('0x2e')][_0x2557('0x3e')]){_0x377d3d[_0x2557('0x3f')]=[{'all':!![]}];}return db[_0x2557('0x40')][_0x2557('0x41')](_0x377d3d);})['then'](function(_0x53c645){_0x7d5827['rows']=_0x53c645;return _0x7d5827;})[_0x2557('0x23')](respondWithFilteredResult(_0x5f39a7,_0x377d3d))[_0x2557('0x42')](handleError(_0x5f39a7,null));};exports['show']=function(_0x7f2e11,_0x33da00){var _0x3695d4={'raw':![],'where':{'id':_0x7f2e11['params']['id']}},_0x21ee77={};_0x21ee77[_0x2557('0x30')]=_['keys'](db[_0x2557('0x40')]['rawAttributes']);_0x21ee77[_0x2557('0x2e')]=_['keys'](_0x7f2e11[_0x2557('0x2e')]);_0x21ee77[_0x2557('0x38')]=_[_0x2557('0x31')](_0x21ee77[_0x2557('0x30')],_0x21ee77['query']);_0x3695d4[_0x2557('0x33')]=_['intersection'](_0x21ee77['model'],qs['fields'](_0x7f2e11['query'][_0x2557('0x32')]));_0x3695d4[_0x2557('0x33')]=_0x3695d4[_0x2557('0x33')]['length']?_0x3695d4['attributes']:_0x21ee77[_0x2557('0x30')];if(_0x7f2e11[_0x2557('0x2e')][_0x2557('0x3e')]){_0x3695d4[_0x2557('0x3f')]=[{'all':!![]}];}_0x3695d4=_[_0x2557('0x3b')]({},_0x3695d4,_0x7f2e11[_0x2557('0x3d')]);return db['VoiceMusicOnHold'][_0x2557('0x43')](_0x3695d4)['then'](handleEntityNotFound(_0x33da00,null))[_0x2557('0x23')](respondWithResult(_0x33da00,null))['catch'](handleError(_0x33da00,null));};exports[_0x2557('0x21')]=function(_0x5cd5d7,_0x36005a){if(_0x5cd5d7['body']['id']){delete _0x5cd5d7['body']['id'];}return db[_0x2557('0x40')]['find']({'where':{'id':_0x5cd5d7[_0x2557('0x44')]['id']}})[_0x2557('0x23')](handleEntityNotFound(_0x36005a,null))[_0x2557('0x23')](saveUpdates(_0x5cd5d7['body'],null))['then'](respondWithResult(_0x36005a,null))[_0x2557('0x42')](handleError(_0x36005a,null));};exports[_0x2557('0x45')]=function(_0x44903f,_0x8b26d3,_0x15ceb5){return db[_0x2557('0x46')][_0x2557('0x47')](function(_0x167703){if(_0x44903f[_0x2557('0x48')][_0x2557('0x49')]===_0x2557('0x4a')){_0x44903f[_0x2557('0x48')][_0x2557('0x4b')]=path[_0x2557('0x4c')](config[_0x2557('0x4d')],'server/files/moh',_0x44903f[_0x2557('0x48')][_0x2557('0x27')]);}return db['VoiceMusicOnHold'][_0x2557('0x45')](_0x44903f[_0x2557('0x48')],{'transaction':_0x167703})[_0x2557('0x23')](function(_0x2a4286){if(_0x44903f[_0x2557('0x48')][_0x2557('0x49')]===_0x2557('0x4a')){fs[_0x2557('0x4e')](_0x2a4286[_0x2557('0x4b')],parseInt(_0x2557('0x4f'),0x8));}var _0x1b402f=_0x44903f[_0x2557('0x50')]['get']({'plain':!![]});if(!_0x1b402f)throw new Error(_0x2557('0x51'));if(_0x1b402f[_0x2557('0x52')]===_0x2557('0x50')){var _0x505a0c=_0x2a4286['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x2557('0x25'),'userProfileId':_0x1b402f[_0x2557('0x53')]},'raw':!![]})['then'](function(_0x1c101a){if(_0x1c101a&&_0x1c101a[_0x2557('0x54')]===0x0){return db[_0x2557('0x26')][_0x2557('0x45')]({'name':_0x505a0c['name'],'resourceId':_0x505a0c['id'],'type':_0x1c101a[_0x2557('0x27')],'sectionId':_0x1c101a['id']},{})['then'](function(){return _0x2a4286;});}else{return _0x2a4286;}})['catch'](function(_0x39ae80){logger[_0x2557('0x55')](_0x2557('0x56'),_0x39ae80);});}return _0x2a4286;});})[_0x2557('0x23')](respondWithResult(_0x8b26d3,0xc9))['catch'](handleError(_0x8b26d3,null));};exports[_0x2557('0x22')]=function(_0x242592,_0x274705,_0x332cbc){var _0x164a53;return db[_0x2557('0x40')][_0x2557('0x43')]({'where':{'id':_0x242592['params']['id']}})[_0x2557('0x23')](function(_0x29c688){if(_0x29c688){return db[_0x2557('0x46')]['transaction'](function(_0x354fa2){return _0x29c688[_0x2557('0x22')]({'transaction':_0x354fa2,'raw':!![]})[_0x2557('0x23')](function(_0x5b8998){if(_0x5b8998['directory']){fs[_0x2557('0x57')](_0x5b8998[_0x2557('0x4b')])[_0x2557('0x58')](function(_0xe5688c){fs[_0x2557('0x59')](path[_0x2557('0x4c')](_0x5b8998[_0x2557('0x4b')],_0xe5688c));});fs['rmdirSync'](_0x5b8998[_0x2557('0x4b')]);}return _0x5b8998;});})['catch'](function(_0x2b59ff){throw new db[(_0x2557('0x5a'))][(_0x2557('0x5b'))](_0x2b59ff[_0x2557('0x5c')]);});}})['then'](handleEntityNotFound(_0x274705,null))['then'](removeEntity(_0x274705,null))[_0x2557('0x42')](handleError(_0x274705,null));};exports['addSound']=function(_0x67ad85,_0x412bac,_0x4e00c4){return db['sequelize'][_0x2557('0x47')](function(_0x4333e2){var _0x4330c9;return db[_0x2557('0x40')]['find']({'where':{'id':_0x67ad85[_0x2557('0x44')]['id']}})[_0x2557('0x23')](function(_0x24d7ca){if(_0x24d7ca){_0x4330c9=_0x24d7ca;return _0x24d7ca[_0x2557('0x5d')](_0x67ad85[_0x2557('0x48')]['id'],{'transaction':_0x4333e2});}})[_0x2557('0x23')](function(_0x5bf60){if(_0x5bf60){return db[_0x2557('0x5e')][_0x2557('0x5f')]({'where':{'id':_0x67ad85[_0x2557('0x48')]['id']},'attributes':['id','name',_0x2557('0x60'),_0x2557('0x61'),_0x2557('0x62')],'raw':!![]});}})['then'](function(_0x4b6379){if(_0x4b6379){var _0x414997=path[_0x2557('0x4c')](config[_0x2557('0x4d')],_0x2557('0x63'),util[_0x2557('0x64')](_0x2557('0x65'),path[_0x2557('0x66')](_0x4b6379[_0x2557('0x60')],path[_0x2557('0x67')](_0x4b6379[_0x2557('0x60')])),_0x4b6379['converted_format']));var _0x197bf6=path[_0x2557('0x4c')](config[_0x2557('0x4d')],_0x2557('0x68'),_0x4330c9[_0x2557('0x27')],util[_0x2557('0x64')](_0x2557('0x65'),_0x4b6379['name'],_0x4b6379['converted_format']));fs[_0x2557('0x69')](_0x414997,_0x197bf6);return _0x4b6379;}})['catch'](function(_0x41405c){throw new db[(_0x2557('0x5a'))][(_0x2557('0x5b'))](_0x41405c[_0x2557('0x5c')]);});})[_0x2557('0x23')](handleEntityNotFound(_0x412bac,null))[_0x2557('0x23')](respondWithResult(_0x412bac,0xc9))[_0x2557('0x42')](handleError(_0x412bac,null));};exports['removeSound']=function(_0x562a9b,_0x34562e,_0x1aec34){return db[_0x2557('0x46')][_0x2557('0x47')](function(_0x180239){var _0x99f48b;return db[_0x2557('0x40')]['findOne']({'where':{'id':_0x562a9b[_0x2557('0x44')]['id']}})[_0x2557('0x23')](handleEntityNotFound(_0x34562e,null))['then'](function(_0x155222){if(_0x155222){_0x99f48b=_0x155222;return _0x155222[_0x2557('0x6a')](_0x562a9b[_0x2557('0x44')]['id2']);}})[_0x2557('0x23')](function(_0x2c9613){if(_0x2c9613){return db[_0x2557('0x5e')][_0x2557('0x5f')]({'where':{'id':_0x562a9b['params']['id2']},'attributes':['id',_0x2557('0x27'),_0x2557('0x60'),_0x2557('0x61'),_0x2557('0x62')],'raw':!![]});}})[_0x2557('0x23')](function(_0x4909d9){if(_0x4909d9){fs[_0x2557('0x59')](path['join'](_0x99f48b[_0x2557('0x4b')],util['format']('%s.%s',_0x4909d9[_0x2557('0x27')],_0x4909d9['converted_format'])));return _0x4909d9;}})['catch'](function(_0x1c0ecb){throw new db[(_0x2557('0x5a'))][(_0x2557('0x5b'))](_0x1c0ecb['message']);});})['then'](handleEntityNotFound(_0x34562e,null))[_0x2557('0x23')](respondWithStatusCode(_0x34562e,0xcc))[_0x2557('0x42')](handleError(_0x34562e,null));};exports['getSounds']=function(_0x2a3347,_0x414473,_0x1435c8){var _0x5aefb0={};var _0x42c9cb={};var _0x1ea017;var _0x1f319f;return db[_0x2557('0x40')]['findOne']({'where':{'id':_0x2a3347[_0x2557('0x44')]['id']}})[_0x2557('0x23')](handleEntityNotFound(_0x414473,null))[_0x2557('0x23')](function(_0x3d370d){if(_0x3d370d){_0x1ea017=_0x3d370d;_0x42c9cb[_0x2557('0x30')]=_['keys'](db[_0x2557('0x5e')][_0x2557('0x2a')]);_0x42c9cb[_0x2557('0x2e')]=_['keys'](_0x2a3347[_0x2557('0x2e')]);_0x42c9cb[_0x2557('0x38')]=_[_0x2557('0x31')](_0x42c9cb[_0x2557('0x30')],_0x42c9cb[_0x2557('0x2e')]);_0x5aefb0[_0x2557('0x33')]=_[_0x2557('0x31')](_0x42c9cb[_0x2557('0x30')],qs[_0x2557('0x32')](_0x2a3347[_0x2557('0x2e')][_0x2557('0x32')]));_0x5aefb0[_0x2557('0x33')]=_0x5aefb0[_0x2557('0x33')][_0x2557('0x34')]?_0x5aefb0[_0x2557('0x33')]:_0x42c9cb[_0x2557('0x30')];_0x5aefb0[_0x2557('0x36')]=qs[_0x2557('0x6b')](_0x2a3347[_0x2557('0x2e')]['sort']);_0x5aefb0[_0x2557('0x37')]=qs[_0x2557('0x38')](_[_0x2557('0x39')](_0x2a3347[_0x2557('0x2e')],_0x42c9cb['filters']));if(_0x2a3347[_0x2557('0x2e')][_0x2557('0x3a')]){_0x5aefb0[_0x2557('0x37')]=_[_0x2557('0x3b')](_0x5aefb0['where'],{'$or':_[_0x2557('0x29')](_0x5aefb0[_0x2557('0x33')],function(_0x48a952){var _0xa719d9={};_0xa719d9[_0x48a952]={'$like':'%'+_0x2a3347[_0x2557('0x2e')][_0x2557('0x3a')]+'%'};return _0xa719d9;})});}_0x5aefb0=_['merge']({},_0x5aefb0,_0x2a3347[_0x2557('0x3d')]);return _0x1ea017['getSounds'](_0x5aefb0);}})[_0x2557('0x23')](function(_0x267586){if(_0x267586){_0x1f319f=_0x267586[_0x2557('0x34')];if(!_0x2a3347[_0x2557('0x2e')]['hasOwnProperty'](_0x2557('0x6c'))){_0x5aefb0[_0x2557('0x1c')]=qs[_0x2557('0x1c')](_0x2a3347[_0x2557('0x2e')]['limit']);_0x5aefb0[_0x2557('0x1e')]=qs[_0x2557('0x1e')](_0x2a3347['query'][_0x2557('0x1e')]);}return _0x1ea017[_0x2557('0x6d')](_0x5aefb0);}})['then'](function(_0x3feebb){if(_0x3feebb){return _0x3feebb?{'count':_0x1f319f,'rows':_0x3feebb}:null;}})[_0x2557('0x23')](respondWithResult(_0x414473,null))[_0x2557('0x42')](handleError(_0x414473,null));}; \ No newline at end of file +var _0xb281=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','destroy','end','error','name','send','index','VoiceMusicOnHold','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','update','body','find','catch','create','transaction','mode','files','directory','join','root','mkdirSync','0777','user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','sequelize','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','Sound','save_name','format','converted_format','server/files/moh','%s.%s','Sequelize','removeSound','findOne','id2','getSounds','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x532710,_0x52195f){var _0x6d7ca=function(_0x56f45d){while(--_0x56f45d){_0x532710['push'](_0x532710['shift']());}};_0x6d7ca(++_0x52195f);}(_0xb281,0xc9));var _0x1b28=function(_0x4c4b81,_0xdcdd0d){_0x4c4b81=_0x4c4b81-0x0;var _0x454b18=_0xb281[_0x4c4b81];return _0x454b18;};'use strict';var emlformat=require(_0x1b28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b28('0x1'));var jsonpatch=require(_0x1b28('0x2'));var rp=require(_0x1b28('0x3'));var moment=require(_0x1b28('0x4'));var BPromise=require(_0x1b28('0x5'));var Mustache=require('mustache');var util=require(_0x1b28('0x6'));var path=require(_0x1b28('0x7'));var sox=require('sox');var csv=require(_0x1b28('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b28('0x9'));var _=require(_0x1b28('0xa'));var squel=require(_0x1b28('0xb'));var crypto=require(_0x1b28('0xc'));var jsforce=require(_0x1b28('0xd'));var deskjs=require(_0x1b28('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b28('0xf'));var Papa=require(_0x1b28('0x10'));var Redis=require(_0x1b28('0x11'));var authService=require(_0x1b28('0x12'));var qs=require(_0x1b28('0x13'));var as=require(_0x1b28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b28('0x15'))('api');var utils=require(_0x1b28('0x16'));var config=require(_0x1b28('0x17'));var licenseUtil=require(_0x1b28('0x18'));var db=require(_0x1b28('0x19'))['db'];function respondWithStatusCode(_0x432306,_0x43c6d3){_0x43c6d3=_0x43c6d3||0xcc;return function(_0x4acda2){if(_0x4acda2){return _0x432306[_0x1b28('0x1a')](_0x43c6d3);}return _0x432306[_0x1b28('0x1b')](_0x43c6d3)['end']();};}function respondWithResult(_0x1602a1,_0x385b48){_0x385b48=_0x385b48||0xc8;return function(_0x3038ea){if(_0x3038ea){return _0x1602a1[_0x1b28('0x1b')](_0x385b48)[_0x1b28('0x1c')](_0x3038ea);}};}function respondWithFilteredResult(_0xa4fcd9,_0x31e621){return function(_0x548c3f){if(_0x548c3f){var _0x15611a=typeof _0x31e621[_0x1b28('0x1d')]==='undefined'&&typeof _0x31e621[_0x1b28('0x1e')]===_0x1b28('0x1f');var _0x3cefe1=_0x548c3f[_0x1b28('0x20')];var _0x17659=_0x15611a?0x0:_0x31e621[_0x1b28('0x1d')];var _0x51df1f=_0x15611a?_0x548c3f['count']:_0x31e621[_0x1b28('0x1d')]+_0x31e621['limit'];var _0x576c0c;if(_0x51df1f>=_0x3cefe1){_0x51df1f=_0x3cefe1;_0x576c0c=0xc8;}else{_0x576c0c=0xce;}_0xa4fcd9['status'](_0x576c0c);return _0xa4fcd9[_0x1b28('0x21')](_0x1b28('0x22'),_0x17659+'-'+_0x51df1f+'/'+_0x3cefe1)[_0x1b28('0x1c')](_0x548c3f);}return null;};}function patchUpdates(_0x326bc9){return function(_0x213e01){try{jsonpatch[_0x1b28('0x23')](_0x213e01,_0x326bc9,!![]);}catch(_0x16dd46){return BPromise[_0x1b28('0x24')](_0x16dd46);}return _0x213e01[_0x1b28('0x25')]();};}function saveUpdates(_0x2250fc,_0x28da26){return function(_0x47d4b1){if(_0x47d4b1){return _0x47d4b1['update'](_0x2250fc)[_0x1b28('0x26')](function(_0x1eb66e){return _0x1eb66e;});}return null;};}function removeEntity(_0x420525,_0x232d8e){return function(_0x3a67a4){if(_0x3a67a4){return _0x3a67a4['destroy']()[_0x1b28('0x26')](function(){var _0x42537e=_0x3a67a4[_0x1b28('0x27')]({'plain':!![]});var _0x588a95='MusicOnHolds';return db['UserProfileResource'][_0x1b28('0x28')]({'where':{'type':_0x588a95,'resourceId':_0x42537e['id']}})[_0x1b28('0x26')](function(){return _0x3a67a4;});})[_0x1b28('0x26')](function(){_0x420525[_0x1b28('0x1b')](0xcc)[_0x1b28('0x29')]();});}};}function handleEntityNotFound(_0x58cdd5,_0x1f7eed){return function(_0x527076){if(!_0x527076){_0x58cdd5[_0x1b28('0x1a')](0x194);}return _0x527076;};}function handleError(_0x1b55c3,_0x3d1fee){_0x3d1fee=_0x3d1fee||0x1f4;return function(_0x4fb84d){logger[_0x1b28('0x2a')](_0x4fb84d['stack']);if(_0x4fb84d[_0x1b28('0x2b')]){delete _0x4fb84d['name'];}_0x1b55c3[_0x1b28('0x1b')](_0x3d1fee)[_0x1b28('0x2c')](_0x4fb84d);};}exports[_0x1b28('0x2d')]=function(_0x470b8e,_0x24e137){var _0x523dd7={},_0x46691d={},_0x37bdce={'count':0x0,'rows':[]};var _0x492bb4=_['map'](db[_0x1b28('0x2e')]['rawAttributes'],function(_0x52ad21){return{'name':_0x52ad21['fieldName'],'type':_0x52ad21[_0x1b28('0x2f')][_0x1b28('0x30')]};});_0x46691d['model']=_[_0x1b28('0x31')](_0x492bb4,_0x1b28('0x2b'));_0x46691d[_0x1b28('0x32')]=_[_0x1b28('0x33')](_0x470b8e[_0x1b28('0x32')]);_0x46691d[_0x1b28('0x34')]=_['intersection'](_0x46691d[_0x1b28('0x35')],_0x46691d[_0x1b28('0x32')]);_0x523dd7[_0x1b28('0x36')]=_[_0x1b28('0x37')](_0x46691d[_0x1b28('0x35')],qs[_0x1b28('0x38')](_0x470b8e['query'][_0x1b28('0x38')]));_0x523dd7['attributes']=_0x523dd7[_0x1b28('0x36')][_0x1b28('0x39')]?_0x523dd7['attributes']:_0x46691d[_0x1b28('0x35')];if(!_0x470b8e[_0x1b28('0x32')][_0x1b28('0x3a')](_0x1b28('0x3b'))){_0x523dd7['limit']=qs[_0x1b28('0x1e')](_0x470b8e['query'][_0x1b28('0x1e')]);_0x523dd7['offset']=qs[_0x1b28('0x1d')](_0x470b8e[_0x1b28('0x32')]['offset']);}_0x523dd7['order']=qs['sort'](_0x470b8e[_0x1b28('0x32')][_0x1b28('0x3c')]);delete _0x470b8e[_0x1b28('0x32')][_0x1b28('0x3c')];_0x523dd7[_0x1b28('0x3d')]=qs['filters'](_[_0x1b28('0x3e')](_0x470b8e[_0x1b28('0x32')],_0x46691d['filters']),_0x492bb4);if(_0x470b8e[_0x1b28('0x32')][_0x1b28('0x3f')]){_0x523dd7[_0x1b28('0x3d')]=_[_0x1b28('0x40')](_0x523dd7[_0x1b28('0x3d')],{'$or':_[_0x1b28('0x31')](_0x492bb4,function(_0x328800){if(_0x328800[_0x1b28('0x2f')]!==_0x1b28('0x41')){var _0x134e3c={};_0x134e3c[_0x328800[_0x1b28('0x2b')]]={'$like':'%'+_0x470b8e[_0x1b28('0x32')][_0x1b28('0x3f')]+'%'};return _0x134e3c;}})});}_0x523dd7=_[_0x1b28('0x40')]({},_0x523dd7,_0x470b8e[_0x1b28('0x42')]);var _0x1230a8={'where':_0x523dd7[_0x1b28('0x3d')]};return db[_0x1b28('0x2e')]['count'](_0x1230a8)[_0x1b28('0x26')](function(_0x295376){_0x37bdce[_0x1b28('0x20')]=_0x295376;if(_0x470b8e['query']['includeAll']){_0x523dd7[_0x1b28('0x43')]=[{'all':!![]}];}return db[_0x1b28('0x2e')][_0x1b28('0x44')](_0x523dd7);})[_0x1b28('0x26')](function(_0x4351a1){_0x37bdce[_0x1b28('0x45')]=_0x4351a1;return _0x37bdce;})[_0x1b28('0x26')](respondWithFilteredResult(_0x24e137,_0x523dd7))['catch'](handleError(_0x24e137,null));};exports[_0x1b28('0x46')]=function(_0xebe122,_0x8e6677){var _0x193230={'raw':![],'where':{'id':_0xebe122[_0x1b28('0x47')]['id']}},_0x168c9b={};_0x168c9b['model']=_[_0x1b28('0x33')](db[_0x1b28('0x2e')]['rawAttributes']);_0x168c9b[_0x1b28('0x32')]=_['keys'](_0xebe122[_0x1b28('0x32')]);_0x168c9b[_0x1b28('0x34')]=_[_0x1b28('0x37')](_0x168c9b['model'],_0x168c9b[_0x1b28('0x32')]);_0x193230[_0x1b28('0x36')]=_[_0x1b28('0x37')](_0x168c9b[_0x1b28('0x35')],qs[_0x1b28('0x38')](_0xebe122['query']['fields']));_0x193230[_0x1b28('0x36')]=_0x193230['attributes'][_0x1b28('0x39')]?_0x193230[_0x1b28('0x36')]:_0x168c9b['model'];if(_0xebe122['query']['includeAll']){_0x193230[_0x1b28('0x43')]=[{'all':!![]}];}_0x193230=_[_0x1b28('0x40')]({},_0x193230,_0xebe122[_0x1b28('0x42')]);return db[_0x1b28('0x2e')]['find'](_0x193230)[_0x1b28('0x26')](handleEntityNotFound(_0x8e6677,null))[_0x1b28('0x26')](respondWithResult(_0x8e6677,null))['catch'](handleError(_0x8e6677,null));};exports[_0x1b28('0x48')]=function(_0x551dee,_0x405423){if(_0x551dee[_0x1b28('0x49')]['id']){delete _0x551dee[_0x1b28('0x49')]['id'];}return db[_0x1b28('0x2e')][_0x1b28('0x4a')]({'where':{'id':_0x551dee[_0x1b28('0x47')]['id']}})[_0x1b28('0x26')](handleEntityNotFound(_0x405423,null))['then'](saveUpdates(_0x551dee[_0x1b28('0x49')],null))[_0x1b28('0x26')](respondWithResult(_0x405423,null))[_0x1b28('0x4b')](handleError(_0x405423,null));};exports[_0x1b28('0x4c')]=function(_0x2aedf6,_0xb0fb70,_0x22b9c1){return db['sequelize'][_0x1b28('0x4d')](function(_0x345f6d){if(_0x2aedf6[_0x1b28('0x49')][_0x1b28('0x4e')]===_0x1b28('0x4f')){_0x2aedf6[_0x1b28('0x49')][_0x1b28('0x50')]=path[_0x1b28('0x51')](config[_0x1b28('0x52')],'server/files/moh',_0x2aedf6[_0x1b28('0x49')][_0x1b28('0x2b')]);}return db[_0x1b28('0x2e')][_0x1b28('0x4c')](_0x2aedf6[_0x1b28('0x49')],{'transaction':_0x345f6d})[_0x1b28('0x26')](function(_0x375d87){if(_0x2aedf6[_0x1b28('0x49')][_0x1b28('0x4e')]===_0x1b28('0x4f')){fs[_0x1b28('0x53')](_0x375d87[_0x1b28('0x50')],parseInt(_0x1b28('0x54'),0x8));}var _0x15ede=_0x2aedf6[_0x1b28('0x55')][_0x1b28('0x27')]({'plain':!![]});if(!_0x15ede)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15ede[_0x1b28('0x56')]===_0x1b28('0x55')){var _0x553d33=_0x375d87[_0x1b28('0x27')]({'plain':!![]});return db[_0x1b28('0x57')][_0x1b28('0x4a')]({'where':{'name':_0x1b28('0x58'),'userProfileId':_0x15ede[_0x1b28('0x59')]},'raw':!![]})[_0x1b28('0x26')](function(_0x20ec64){if(_0x20ec64&&_0x20ec64[_0x1b28('0x5a')]===0x0){return db[_0x1b28('0x5b')][_0x1b28('0x4c')]({'name':_0x553d33[_0x1b28('0x2b')],'resourceId':_0x553d33['id'],'type':_0x20ec64['name'],'sectionId':_0x20ec64['id']},{})[_0x1b28('0x26')](function(){return _0x375d87;});}else{return _0x375d87;}})[_0x1b28('0x4b')](function(_0x353fa1){logger[_0x1b28('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353fa1);});}return _0x375d87;});})[_0x1b28('0x26')](respondWithResult(_0xb0fb70,0xc9))[_0x1b28('0x4b')](handleError(_0xb0fb70,null));};exports[_0x1b28('0x28')]=function(_0x28862d,_0x3f2a4a,_0x556582){var _0x2bcbcf;return db['VoiceMusicOnHold'][_0x1b28('0x4a')]({'where':{'id':_0x28862d['params']['id']}})[_0x1b28('0x26')](function(_0x4a39aa){if(_0x4a39aa){return db[_0x1b28('0x5c')]['transaction'](function(_0x174d24){return _0x4a39aa[_0x1b28('0x28')]({'transaction':_0x174d24,'raw':!![]})[_0x1b28('0x26')](function(_0x2f3ce8){if(_0x2f3ce8['directory']){fs[_0x1b28('0x5d')](_0x2f3ce8[_0x1b28('0x50')])[_0x1b28('0x5e')](function(_0x27f95e){fs[_0x1b28('0x5f')](path[_0x1b28('0x51')](_0x2f3ce8[_0x1b28('0x50')],_0x27f95e));});fs['rmdirSync'](_0x2f3ce8[_0x1b28('0x50')]);}return _0x2f3ce8;});})[_0x1b28('0x4b')](function(_0x40b0e1){throw new db['Sequelize'][(_0x1b28('0x60'))](_0x40b0e1[_0x1b28('0x61')]);});}})[_0x1b28('0x26')](handleEntityNotFound(_0x3f2a4a,null))[_0x1b28('0x26')](removeEntity(_0x3f2a4a,null))[_0x1b28('0x4b')](handleError(_0x3f2a4a,null));};exports[_0x1b28('0x62')]=function(_0x34fe08,_0x10a35a,_0x666cd){return db[_0x1b28('0x5c')][_0x1b28('0x4d')](function(_0x5a0a4d){var _0x29105c;return db[_0x1b28('0x2e')][_0x1b28('0x4a')]({'where':{'id':_0x34fe08[_0x1b28('0x47')]['id']}})['then'](function(_0xca3e8f){if(_0xca3e8f){_0x29105c=_0xca3e8f;return _0xca3e8f['addSound'](_0x34fe08[_0x1b28('0x49')]['id'],{'transaction':_0x5a0a4d});}})[_0x1b28('0x26')](function(_0x352307){if(_0x352307){return db[_0x1b28('0x63')]['findOne']({'where':{'id':_0x34fe08[_0x1b28('0x49')]['id']},'attributes':['id',_0x1b28('0x2b'),_0x1b28('0x64'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x5cb834){if(_0x5cb834){var _0x4edecb=path[_0x1b28('0x51')](config[_0x1b28('0x52')],'server/files/sounds/converted',util[_0x1b28('0x65')]('%s.%s',path['basename'](_0x5cb834[_0x1b28('0x64')],path['extname'](_0x5cb834['save_name'])),_0x5cb834[_0x1b28('0x66')]));var _0x200fb8=path[_0x1b28('0x51')](config[_0x1b28('0x52')],_0x1b28('0x67'),_0x29105c[_0x1b28('0x2b')],util[_0x1b28('0x65')](_0x1b28('0x68'),_0x5cb834['name'],_0x5cb834[_0x1b28('0x66')]));fs['symlinkSync'](_0x4edecb,_0x200fb8);return _0x5cb834;}})[_0x1b28('0x4b')](function(_0x2246ba){throw new db[(_0x1b28('0x69'))][(_0x1b28('0x60'))](_0x2246ba[_0x1b28('0x61')]);});})[_0x1b28('0x26')](handleEntityNotFound(_0x10a35a,null))['then'](respondWithResult(_0x10a35a,0xc9))[_0x1b28('0x4b')](handleError(_0x10a35a,null));};exports[_0x1b28('0x6a')]=function(_0x38f203,_0x36880c,_0x580eae){return db[_0x1b28('0x5c')][_0x1b28('0x4d')](function(_0x2b83e2){var _0x1b8e6a;return db['VoiceMusicOnHold'][_0x1b28('0x6b')]({'where':{'id':_0x38f203['params']['id']}})['then'](handleEntityNotFound(_0x36880c,null))[_0x1b28('0x26')](function(_0x1f1679){if(_0x1f1679){_0x1b8e6a=_0x1f1679;return _0x1f1679[_0x1b28('0x6a')](_0x38f203[_0x1b28('0x47')][_0x1b28('0x6c')]);}})[_0x1b28('0x26')](function(_0x54d3cb){if(_0x54d3cb){return db[_0x1b28('0x63')][_0x1b28('0x6b')]({'where':{'id':_0x38f203[_0x1b28('0x47')][_0x1b28('0x6c')]},'attributes':['id',_0x1b28('0x2b'),_0x1b28('0x64'),_0x1b28('0x66'),'createdAt'],'raw':!![]});}})[_0x1b28('0x26')](function(_0x3c2fa1){if(_0x3c2fa1){fs[_0x1b28('0x5f')](path[_0x1b28('0x51')](_0x1b8e6a[_0x1b28('0x50')],util['format'](_0x1b28('0x68'),_0x3c2fa1['name'],_0x3c2fa1[_0x1b28('0x66')])));return _0x3c2fa1;}})['catch'](function(_0x2ab880){throw new db['Sequelize'][(_0x1b28('0x60'))](_0x2ab880[_0x1b28('0x61')]);});})['then'](handleEntityNotFound(_0x36880c,null))[_0x1b28('0x26')](respondWithStatusCode(_0x36880c,0xcc))['catch'](handleError(_0x36880c,null));};exports[_0x1b28('0x6d')]=function(_0x20a7a8,_0x1c2b92,_0x27b545){var _0xd6ecab={};var _0x356b91={};var _0xddcf97;var _0x1ec85d;return db[_0x1b28('0x2e')][_0x1b28('0x6b')]({'where':{'id':_0x20a7a8[_0x1b28('0x47')]['id']}})[_0x1b28('0x26')](handleEntityNotFound(_0x1c2b92,null))[_0x1b28('0x26')](function(_0x402074){if(_0x402074){_0xddcf97=_0x402074;_0x356b91['model']=_['keys'](db[_0x1b28('0x63')]['rawAttributes']);_0x356b91[_0x1b28('0x32')]=_[_0x1b28('0x33')](_0x20a7a8[_0x1b28('0x32')]);_0x356b91['filters']=_[_0x1b28('0x37')](_0x356b91[_0x1b28('0x35')],_0x356b91[_0x1b28('0x32')]);_0xd6ecab[_0x1b28('0x36')]=_[_0x1b28('0x37')](_0x356b91[_0x1b28('0x35')],qs['fields'](_0x20a7a8[_0x1b28('0x32')]['fields']));_0xd6ecab[_0x1b28('0x36')]=_0xd6ecab[_0x1b28('0x36')]['length']?_0xd6ecab[_0x1b28('0x36')]:_0x356b91['model'];_0xd6ecab[_0x1b28('0x6e')]=qs[_0x1b28('0x3c')](_0x20a7a8[_0x1b28('0x32')][_0x1b28('0x3c')]);_0xd6ecab[_0x1b28('0x3d')]=qs[_0x1b28('0x34')](_['pick'](_0x20a7a8[_0x1b28('0x32')],_0x356b91[_0x1b28('0x34')]));if(_0x20a7a8[_0x1b28('0x32')][_0x1b28('0x3f')]){_0xd6ecab[_0x1b28('0x3d')]=_[_0x1b28('0x40')](_0xd6ecab[_0x1b28('0x3d')],{'$or':_[_0x1b28('0x31')](_0xd6ecab['attributes'],function(_0x2c7630){var _0x4282b5={};_0x4282b5[_0x2c7630]={'$like':'%'+_0x20a7a8[_0x1b28('0x32')][_0x1b28('0x3f')]+'%'};return _0x4282b5;})});}_0xd6ecab=_[_0x1b28('0x40')]({},_0xd6ecab,_0x20a7a8[_0x1b28('0x42')]);return _0xddcf97[_0x1b28('0x6d')](_0xd6ecab);}})[_0x1b28('0x26')](function(_0x35196b){if(_0x35196b){_0x1ec85d=_0x35196b[_0x1b28('0x39')];if(!_0x20a7a8[_0x1b28('0x32')][_0x1b28('0x3a')](_0x1b28('0x3b'))){_0xd6ecab[_0x1b28('0x1e')]=qs['limit'](_0x20a7a8[_0x1b28('0x32')][_0x1b28('0x1e')]);_0xd6ecab[_0x1b28('0x1d')]=qs[_0x1b28('0x1d')](_0x20a7a8[_0x1b28('0x32')]['offset']);}return _0xddcf97[_0x1b28('0x6d')](_0xd6ecab);}})[_0x1b28('0x26')](function(_0x324d56){if(_0x324d56){return _0x324d56?{'count':_0x1ec85d,'rows':_0x324d56}:null;}})[_0x1b28('0x26')](respondWithResult(_0x1c2b92,null))[_0x1b28('0x4b')](handleError(_0x1c2b92,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4df94f8..d473102 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 _0x6170=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6170,0x1d5));var _0x0617=function(_0x56cc34,_0x26905e){_0x56cc34=_0x56cc34-0x0;var _0x449981=_0x6170[_0x56cc34];return _0x449981;};'use strict';var _=require(_0x0617('0x0'));var util=require('util');var logger=require(_0x0617('0x1'))(_0x0617('0x2'));var moment=require(_0x0617('0x3'));var BPromise=require(_0x0617('0x4'));var rp=require(_0x0617('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0617('0x6'));var config=require(_0x0617('0x7'));var attributes=require(_0x0617('0x8'));module[_0x0617('0x9')]=function(_0x43c2bb,_0x2f0638){return _0x43c2bb[_0x0617('0xa')](_0x0617('0xb'),attributes,{'tableName':_0x0617('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f74=['path','rimraf','../../config/environment','exports','voice_musiconhold','lodash','util','bluebird','request-promise'];(function(_0xf1f2e0,_0x37c415){var _0x991373=function(_0x5baf7f){while(--_0x5baf7f){_0xf1f2e0['push'](_0xf1f2e0['shift']());}};_0x991373(++_0x37c415);}(_0x5f74,0x17f));var _0x45f7=function(_0x599cc,_0x87ba60){_0x599cc=_0x599cc-0x0;var _0x4db909=_0x5f74[_0x599cc];return _0x4db909;};'use strict';var _=require(_0x45f7('0x0'));var util=require(_0x45f7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x45f7('0x2'));var rp=require(_0x45f7('0x3'));var fs=require('fs');var path=require(_0x45f7('0x4'));var rimraf=require(_0x45f7('0x5'));var config=require(_0x45f7('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x45f7('0x7')]=function(_0x15c7ac,_0x2147c5){return _0x15c7ac['define']('VoiceMusicOnHold',attributes,{'tableName':_0x45f7('0x8'),'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 f04c320..d9292f9 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x288742,_0x655a1b){var _0x243f16=function(_0x132e58){while(--_0x132e58){_0x288742['push'](_0x288742['shift']());}};_0x243f16(++_0x655a1b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2b3ec4,_0x213666){var _0x92d0d3=function(_0x5d0421){while(--_0x5d0421){_0x2b3ec4['push'](_0x2b3ec4['shift']());}};_0x92d0d3(++_0x213666);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d0ed16b..a6cd55e 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 _0x385b=['isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','put','delete','removeAgents','removeTeams','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x597412,_0x5bc195){var _0xfc3cef=function(_0x1c8a6e){while(--_0x1c8a6e){_0x597412['push'](_0x597412['shift']());}};_0xfc3cef(++_0x5bc195);}(_0x385b,0x1a7));var _0xb385=function(_0xb80ee3,_0x4d9bc3){_0xb80ee3=_0xb80ee3-0x0;var _0x34720a=_0x385b[_0xb80ee3];return _0x34720a;};'use strict';var multer=require('multer');var util=require(_0xb385('0x0'));var path=require('path');var timeout=require(_0xb385('0x1'));var express=require(_0xb385('0x2'));var router=express[_0xb385('0x3')]();var fs_extra=require(_0xb385('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb385('0x5'));var config=require(_0xb385('0x6'));var controller=require(_0xb385('0x7'));router[_0xb385('0x8')]('/',auth[_0xb385('0x9')](),controller[_0xb385('0xa')]);router[_0xb385('0x8')](_0xb385('0xb'),auth['isAuthenticated'](),controller[_0xb385('0xc')]);router[_0xb385('0x8')](_0xb385('0xd'),auth[_0xb385('0x9')](),controller['show']);router[_0xb385('0x8')](_0xb385('0xe'),auth['isAuthenticated'](),controller[_0xb385('0xf')]);router[_0xb385('0x8')](_0xb385('0x10'),auth[_0xb385('0x9')](),controller[_0xb385('0x11')]);router[_0xb385('0x12')]('/',auth['isAuthenticated'](),controller[_0xb385('0x13')]);router['post']('/:id/users',auth[_0xb385('0x9')](),controller['addAgents']);router[_0xb385('0x12')](_0xb385('0x10'),auth[_0xb385('0x9')](),controller['addTeams']);router[_0xb385('0x14')](_0xb385('0xd'),auth[_0xb385('0x9')](),controller['update']);router[_0xb385('0x15')](_0xb385('0xd'),auth[_0xb385('0x9')](),controller['destroy']);router[_0xb385('0x15')](_0xb385('0xe'),auth[_0xb385('0x9')](),controller[_0xb385('0x16')]);router[_0xb385('0x15')](_0xb385('0x10'),auth[_0xb385('0x9')](),controller[_0xb385('0x17')]);module['exports']=router; \ No newline at end of file +var _0x665c=['index','get','/describe','/:id','isAuthenticated','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26a2d1,_0x2b87e5){var _0x29ee30=function(_0xd4cad6){while(--_0xd4cad6){_0x26a2d1['push'](_0x26a2d1['shift']());}};_0x29ee30(++_0x2b87e5);}(_0x665c,0x1a9));var _0xc665=function(_0x2bf88a,_0x3b65d4){_0x2bf88a=_0x2bf88a-0x0;var _0x289b72=_0x665c[_0x2bf88a];return _0x289b72;};'use strict';var multer=require(_0xc665('0x0'));var util=require(_0xc665('0x1'));var path=require(_0xc665('0x2'));var timeout=require(_0xc665('0x3'));var express=require(_0xc665('0x4'));var router=express[_0xc665('0x5')]();var fs_extra=require(_0xc665('0x6'));var auth=require(_0xc665('0x7'));var interaction=require(_0xc665('0x8'));var config=require(_0xc665('0x9'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc665('0xa')]);router[_0xc665('0xb')](_0xc665('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc665('0xb')](_0xc665('0xd'),auth[_0xc665('0xe')](),controller[_0xc665('0xf')]);router[_0xc665('0xb')](_0xc665('0x10'),auth[_0xc665('0xe')](),controller[_0xc665('0x11')]);router['get'](_0xc665('0x12'),auth['isAuthenticated'](),controller[_0xc665('0x13')]);router[_0xc665('0x14')]('/',auth[_0xc665('0xe')](),controller[_0xc665('0x15')]);router[_0xc665('0x14')](_0xc665('0x10'),auth[_0xc665('0xe')](),controller['addAgents']);router[_0xc665('0x14')](_0xc665('0x12'),auth[_0xc665('0xe')](),controller['addTeams']);router[_0xc665('0x16')](_0xc665('0xd'),auth[_0xc665('0xe')](),controller[_0xc665('0x17')]);router[_0xc665('0x18')](_0xc665('0xd'),auth['isAuthenticated'](),controller[_0xc665('0x19')]);router['delete'](_0xc665('0x10'),auth[_0xc665('0xe')](),controller[_0xc665('0x1a')]);router['delete'](_0xc665('0x12'),auth[_0xc665('0xe')](),controller[_0xc665('0x1b')]);module[_0xc665('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6788ee2..a8e9fea 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 _0x119c=['INTEGER','exports','STRING','system-','getDataValue'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x119c,0x15a));var _0xc119=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x119c[_0x2932cf];return _0x1711dd;};'use strict';var Sequelize=require('sequelize');module[_0xc119('0x0')]={'name':{'type':Sequelize[_0xc119('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d9ed9){return _0xc119('0x2')+this[_0xc119('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0xc119('0x1')]},'callerIdAll':{'type':Sequelize[_0xc119('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xc119('0x4')]}}; \ No newline at end of file +var _0xc57c=['name','VIRTUAL','system-','getDataValue','INTEGER','exports','STRING'];(function(_0x2c0d05,_0x2f95dc){var _0x2c543a=function(_0x2cddd9){while(--_0x2cddd9){_0x2c0d05['push'](_0x2c0d05['shift']());}};_0x2c543a(++_0x2f95dc);}(_0xc57c,0x1b7));var _0xcc57=function(_0x5b5b7b,_0xfc8a0a){_0x5b5b7b=_0x5b5b7b-0x0;var _0x338f67=_0xc57c[_0x5b5b7b];return _0x338f67;};'use strict';var Sequelize=require('sequelize');module[_0xcc57('0x0')]={'name':{'type':Sequelize[_0xcc57('0x1')],'allowNull':![],'unique':_0xcc57('0x2')},'prefix':{'type':Sequelize[_0xcc57('0x3')],'get':function(_0x45d799){return _0xcc57('0x4')+this[_0xcc57('0x5')](_0xcc57('0x2'))+'-';}},'description':{'type':Sequelize[_0xcc57('0x1')]},'callerIdAll':{'type':Sequelize[_0xcc57('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xcc57('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a30b592..9e339d2 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 _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x2c4580,_0x3c180d){var _0x352062=function(_0x392ba3){while(--_0x392ba3){_0x2c4580['push'](_0x2c4580['shift']());}};_0x352062(++_0x3c180d);}(_0x2032,0xd9));var _0x2203=function(_0x53a192,_0x205ee7){_0x53a192=_0x53a192-0x0;var _0x4f64e1=_0x2032[_0x53a192];return _0x4f64e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0x1eba=['UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','compact','removeTeams','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','index','map','VoicePrefix','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','voicePause','flatMap','Agents','addTeams','each'];(function(_0x110171,_0x1c5afc){var _0x3fc862=function(_0x2b2082){while(--_0x2b2082){_0x110171['push'](_0x110171['shift']());}};_0x3fc862(++_0x1c5afc);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x1eba[_0x49e584];return _0x58b1be;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];config[_0xa1eb('0x19')]=_['defaults'](config[_0xa1eb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1eb('0x19')]));require('./voicePrefix.socket')[_0xa1eb('0x1a')](socket);function respondWithStatusCode(_0x2178e2,_0x14e048){_0x14e048=_0x14e048||0xcc;return function(_0x2877cb){if(_0x2877cb){return _0x2178e2[_0xa1eb('0x1b')](_0x14e048);}return _0x2178e2[_0xa1eb('0x1c')](_0x14e048)[_0xa1eb('0x1d')]();};}function respondWithResult(_0x45d6dd,_0x211e42){_0x211e42=_0x211e42||0xc8;return function(_0x4aa527){if(_0x4aa527){return _0x45d6dd[_0xa1eb('0x1c')](_0x211e42)['json'](_0x4aa527);}};}function respondWithFilteredResult(_0x1401ef,_0x3dafcd){return function(_0x33c4e3){if(_0x33c4e3){var _0x1a5d2c=typeof _0x3dafcd['offset']===_0xa1eb('0x1e')&&typeof _0x3dafcd[_0xa1eb('0x1f')]===_0xa1eb('0x1e');var _0xcf45c1=_0x33c4e3[_0xa1eb('0x20')];var _0x3b8607=_0x1a5d2c?0x0:_0x3dafcd[_0xa1eb('0x21')];var _0x166f7f=_0x1a5d2c?_0x33c4e3['count']:_0x3dafcd[_0xa1eb('0x21')]+_0x3dafcd['limit'];var _0x2258d1;if(_0x166f7f>=_0xcf45c1){_0x166f7f=_0xcf45c1;_0x2258d1=0xc8;}else{_0x2258d1=0xce;}_0x1401ef[_0xa1eb('0x1c')](_0x2258d1);return _0x1401ef[_0xa1eb('0x22')](_0xa1eb('0x23'),_0x3b8607+'-'+_0x166f7f+'/'+_0xcf45c1)['json'](_0x33c4e3);}return null;};}function patchUpdates(_0x539634){return function(_0x168221){try{jsonpatch[_0xa1eb('0x24')](_0x168221,_0x539634,!![]);}catch(_0x5b0903){return BPromise[_0xa1eb('0x25')](_0x5b0903);}return _0x168221[_0xa1eb('0x26')]();};}function saveUpdates(_0x258d3a,_0xa6b20c){return function(_0x23b49e){if(_0x23b49e){return _0x23b49e[_0xa1eb('0x27')](_0x258d3a)[_0xa1eb('0x28')](function(_0x364b1c){return _0x364b1c;});}return null;};}function removeEntity(_0xd7bb88,_0x352796){return function(_0xb77fd6){if(_0xb77fd6){return _0xb77fd6[_0xa1eb('0x29')]()['then'](function(){var _0x7c617e=_0xb77fd6[_0xa1eb('0x2a')]({'plain':!![]});var _0x491f37=_0xa1eb('0x2b');return db['UserProfileResource'][_0xa1eb('0x29')]({'where':{'type':_0x491f37,'resourceId':_0x7c617e['id']}})[_0xa1eb('0x28')](function(){return _0xb77fd6;});})['then'](function(){_0xd7bb88[_0xa1eb('0x1c')](0xcc)[_0xa1eb('0x1d')]();});}};}function handleEntityNotFound(_0x136835,_0x4f64bb){return function(_0x12cf56){if(!_0x12cf56){_0x136835[_0xa1eb('0x1b')](0x194);}return _0x12cf56;};}function handleError(_0x55f5cc,_0x273a42){_0x273a42=_0x273a42||0x1f4;return function(_0xb27bf9){logger[_0xa1eb('0x2c')](_0xb27bf9[_0xa1eb('0x2d')]);if(_0xb27bf9[_0xa1eb('0x2e')]){delete _0xb27bf9['name'];}_0x55f5cc[_0xa1eb('0x1c')](_0x273a42)[_0xa1eb('0x2f')](_0xb27bf9);};}exports[_0xa1eb('0x30')]=function(_0x2ae21d,_0x383e26){var _0xcd9efd={},_0x1d5b64={},_0xcfda64={'count':0x0,'rows':[]};var _0x254727=_[_0xa1eb('0x31')](db[_0xa1eb('0x32')]['rawAttributes'],function(_0x563b11){return{'name':_0x563b11[_0xa1eb('0x33')],'type':_0x563b11[_0xa1eb('0x34')][_0xa1eb('0x35')]};});_0x1d5b64[_0xa1eb('0x36')]=_[_0xa1eb('0x31')](_0x254727,'name');_0x1d5b64['query']=_[_0xa1eb('0x37')](_0x2ae21d[_0xa1eb('0x38')]);_0x1d5b64['filters']=_['intersection'](_0x1d5b64[_0xa1eb('0x36')],_0x1d5b64['query']);_0xcd9efd[_0xa1eb('0x39')]=_['intersection'](_0x1d5b64[_0xa1eb('0x36')],qs[_0xa1eb('0x3a')](_0x2ae21d[_0xa1eb('0x38')]['fields']));_0xcd9efd[_0xa1eb('0x39')]=_0xcd9efd[_0xa1eb('0x39')][_0xa1eb('0x3b')]?_0xcd9efd['attributes']:_0x1d5b64[_0xa1eb('0x36')];if(!_0x2ae21d[_0xa1eb('0x38')][_0xa1eb('0x3c')](_0xa1eb('0x3d'))){_0xcd9efd[_0xa1eb('0x1f')]=qs['limit'](_0x2ae21d[_0xa1eb('0x38')][_0xa1eb('0x1f')]);_0xcd9efd[_0xa1eb('0x21')]=qs[_0xa1eb('0x21')](_0x2ae21d[_0xa1eb('0x38')][_0xa1eb('0x21')]);}_0xcd9efd[_0xa1eb('0x3e')]=qs[_0xa1eb('0x3f')](_0x2ae21d['query'][_0xa1eb('0x3f')]);_0xcd9efd[_0xa1eb('0x40')]=qs[_0xa1eb('0x41')](_[_0xa1eb('0x42')](_0x2ae21d[_0xa1eb('0x38')],_0x1d5b64['filters']),_0x254727);if(_0x2ae21d[_0xa1eb('0x38')][_0xa1eb('0x43')]){_0xcd9efd[_0xa1eb('0x40')]=_['merge'](_0xcd9efd[_0xa1eb('0x40')],{'$or':_[_0xa1eb('0x31')](_0x254727,function(_0x2ae6d8){if(_0x2ae6d8[_0xa1eb('0x34')]!==_0xa1eb('0x44')){var _0x1e5b3b={};_0x1e5b3b[_0x2ae6d8[_0xa1eb('0x2e')]]={'$like':'%'+_0x2ae21d['query'][_0xa1eb('0x43')]+'%'};return _0x1e5b3b;}})});}_0xcd9efd=_[_0xa1eb('0x45')]({},_0xcd9efd,_0x2ae21d['options']);var _0xf6c04b={'where':_0xcd9efd['where']};return db[_0xa1eb('0x32')][_0xa1eb('0x20')](_0xf6c04b)[_0xa1eb('0x28')](function(_0x361675){_0xcfda64[_0xa1eb('0x20')]=_0x361675;if(_0x2ae21d[_0xa1eb('0x38')][_0xa1eb('0x46')]){_0xcd9efd[_0xa1eb('0x47')]=[{'all':!![]}];}return db[_0xa1eb('0x32')][_0xa1eb('0x48')](_0xcd9efd);})[_0xa1eb('0x28')](function(_0x3c4690){_0xcfda64[_0xa1eb('0x49')]=_0x3c4690;return _0xcfda64;})[_0xa1eb('0x28')](respondWithFilteredResult(_0x383e26,_0xcd9efd))[_0xa1eb('0x4a')](handleError(_0x383e26,null));};exports[_0xa1eb('0x4b')]=function(_0x4e068d,_0x10f983){var _0x4fd053={'raw':![],'where':{'id':_0x4e068d[_0xa1eb('0x4c')]['id']}},_0x3edc6b={};_0x3edc6b['model']=_['keys'](db[_0xa1eb('0x32')][_0xa1eb('0x4d')]);_0x3edc6b[_0xa1eb('0x38')]=_['keys'](_0x4e068d[_0xa1eb('0x38')]);_0x3edc6b[_0xa1eb('0x41')]=_[_0xa1eb('0x4e')](_0x3edc6b[_0xa1eb('0x36')],_0x3edc6b[_0xa1eb('0x38')]);_0x4fd053[_0xa1eb('0x39')]=_[_0xa1eb('0x4e')](_0x3edc6b[_0xa1eb('0x36')],qs[_0xa1eb('0x3a')](_0x4e068d[_0xa1eb('0x38')][_0xa1eb('0x3a')]));_0x4fd053[_0xa1eb('0x39')]=_0x4fd053[_0xa1eb('0x39')][_0xa1eb('0x3b')]?_0x4fd053['attributes']:_0x3edc6b[_0xa1eb('0x36')];if(_0x4e068d[_0xa1eb('0x38')][_0xa1eb('0x46')]){_0x4fd053[_0xa1eb('0x47')]=[{'all':!![]}];}_0x4fd053=_[_0xa1eb('0x45')]({},_0x4fd053,_0x4e068d[_0xa1eb('0x4f')]);return db[_0xa1eb('0x32')]['find'](_0x4fd053)[_0xa1eb('0x28')](handleEntityNotFound(_0x10f983,null))[_0xa1eb('0x28')](respondWithResult(_0x10f983,null))[_0xa1eb('0x4a')](handleError(_0x10f983,null));};exports[_0xa1eb('0x29')]=function(_0x8975a1,_0x1302f6){return db[_0xa1eb('0x32')][_0xa1eb('0x50')]({'where':{'id':_0x8975a1[_0xa1eb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1302f6,null))[_0xa1eb('0x28')](removeEntity(_0x1302f6,null))['catch'](handleError(_0x1302f6,null));};exports[_0xa1eb('0x51')]=function(_0x495c01,_0x1a815e){return db[_0xa1eb('0x32')][_0xa1eb('0x51')]()['then'](respondWithResult(_0x1a815e,null))[_0xa1eb('0x4a')](handleError(_0x1a815e,null));};exports[_0xa1eb('0x52')]=function(_0x549c95,_0x10d6d5){var _0x2926e7;return db[_0xa1eb('0x53')][_0xa1eb('0x54')](function(_0x11cc84){return db[_0xa1eb('0x32')][_0xa1eb('0x52')](_0x549c95[_0xa1eb('0x55')],{'transaction':_0x11cc84})[_0xa1eb('0x28')](function(_0x3d9a41){_0x2926e7=_0x3d9a41[_0xa1eb('0x2a')]({'plain':!![]});return db[_0xa1eb('0x56')][_0xa1eb('0x50')]({'where':{'id':_0x2926e7[_0xa1eb('0x57')]},'raw':!![]})[_0xa1eb('0x28')](function(_0x2ba6c0){return createVoicePrefixExtensions(_0x2926e7,_0x2ba6c0,_0x11cc84);});});})[_0xa1eb('0x28')](function(){var _0x589186=_0x549c95[_0xa1eb('0x58')][_0xa1eb('0x2a')]({'plain':!![]});if(!_0x589186)throw new Error(_0xa1eb('0x59'));if(_0x589186[_0xa1eb('0x5a')]===_0xa1eb('0x58')){var _0x1f5da6=_0x2926e7;return db['UserProfileSection'][_0xa1eb('0x50')]({'where':{'name':_0xa1eb('0x2b'),'userProfileId':_0x589186[_0xa1eb('0x5b')]},'raw':!![]})[_0xa1eb('0x28')](function(_0xa46d79){if(_0xa46d79&&_0xa46d79[_0xa1eb('0x5c')]===0x0){return db[_0xa1eb('0x5d')]['create']({'name':_0x1f5da6[_0xa1eb('0x2e')],'resourceId':_0x1f5da6['id'],'type':_0xa46d79[_0xa1eb('0x2e')],'sectionId':_0xa46d79['id']},{})[_0xa1eb('0x28')](function(){return _0x2926e7;});}else{return _0x2926e7;}})[_0xa1eb('0x4a')](function(_0x4c30ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c30ad);throw _0x4c30ad;});}return _0x2926e7;})['then'](respondWithResult(_0x10d6d5,null))[_0xa1eb('0x4a')](handleError(_0x10d6d5,null));};function Extension(_0x1e1e5d,_0x591907,_0x4643f3,_0x3e2d2f){this[_0xa1eb('0x5e')]=_0xa1eb('0x5f');this['exten']=_0x1e1e5d;this['app']=_0x4643f3;this[_0xa1eb('0x34')]=_0xa1eb('0x60');this[_0xa1eb('0x61')]=_0xa1eb('0x62');this[_0xa1eb('0x63')]=_0x591907;this[_0xa1eb('0x64')]=_0x3e2d2f;}function createVoicePrefixExtensions(_0x51580f,_0x532dfa,_0x43f223){return new BPromise(function(_0x5afc3e,_0x3ea940){var _0x57172d=new Extension(formatPrefixName(_0x51580f[_0xa1eb('0x65')]),0x1,_0xa1eb('0x66'),'Voice\x20Prefix');_0x57172d[_0xa1eb('0x67')]=_0x51580f['id'];return db[_0xa1eb('0x56')]['create'](_0x57172d,{'transaction':_0x43f223})[_0xa1eb('0x28')](function(_0x17feb5){var _0x3b97c7=_0x17feb5['get']({'plain':!![]});var _0x9799d3=_[_0xa1eb('0x31')](addVoicePrefixExtensions(_0x51580f,_0x532dfa),function(_0x4af59a){_0x4af59a[_0xa1eb('0x57')]=_0x3b97c7['id'];_0x4af59a[_0xa1eb('0x67')]=_0x51580f['id'];return _0x4af59a;});return db[_0xa1eb('0x56')]['bulkCreate'](_0x9799d3,{'transaction':_0x43f223})[_0xa1eb('0x28')](function(_0x5aa916){if(!_0x5aa916){return _0x3ea940(_0xa1eb('0x68'));}else{return _0x5afc3e(_0x5aa916);}})[_0xa1eb('0x4a')](function(_0x40eae0){return _0x3ea940(_0x40eae0);});});;});};function addVoicePrefixExtensions(_0x331a80,_0x2df867){var _0x48f49d=[];var _0x2aba03=formatPrefixName(_0x331a80[_0xa1eb('0x65')]);_0x48f49d[_0xa1eb('0x69')](new Extension(_0x2aba03,0x2,'Set',_0xa1eb('0x6a')+_0x331a80['name']));if(_0x331a80['callerIdAll']){_0x48f49d['push'](new Extension(_0x2aba03,0x3,'Set',_0xa1eb('0x6b')+_0x331a80[_0xa1eb('0x6c')]));}else{_0x48f49d[_0xa1eb('0x69')](new Extension(_0x2aba03,0x3,_0xa1eb('0x66'),_0xa1eb('0x6d')));}_0x48f49d[_0xa1eb('0x69')](new Extension(_0x2aba03,0x4,_0xa1eb('0x6e'),_0x2df867[_0xa1eb('0x5e')]+','+_0xa1eb('0x6f')+(0x8+_0x331a80[_0xa1eb('0x2e')]['length'])+'}'+','+0x1));return _0x48f49d;}function formatPrefixName(_0x79bee8){var _0x1d1c91='_';for(var _0x46207c=0x0;_0x46207c<_0x79bee8[_0xa1eb('0x3b')];_0x46207c++){if(_0x79bee8[_0xa1eb('0x70')](_0x46207c)=='-'){_0x1d1c91+=_0x79bee8[_0xa1eb('0x70')](_0x46207c);}else{_0x1d1c91+='['+_0x79bee8['charAt'](_0x46207c)+']';}}_0x1d1c91+='.';return _0x1d1c91;}exports[_0xa1eb('0x27')]=function(_0x2b6996,_0x16c5a3,_0x58147f){var _0x1434a1=_0x2b6996[_0xa1eb('0x55')];_0x1434a1[_0xa1eb('0x65')]=_0xa1eb('0x71')+_0x1434a1[_0xa1eb('0x2e')]+'-';return db['sequelize'][_0xa1eb('0x54')](function(_0x50eff6){return db[_0xa1eb('0x32')]['update'](_0x1434a1,{'where':{'id':_0x1434a1['id']},'transaction':_0x50eff6})[_0xa1eb('0x28')](function(){return db[_0xa1eb('0x56')][_0xa1eb('0x29')]({'where':{'VoicePrefixId':_0x1434a1['id']},'transaction':_0x50eff6})[_0xa1eb('0x28')](function(){return db['VoiceExtension'][_0xa1eb('0x50')]({'where':{'id':_0x1434a1[_0xa1eb('0x57')]},'raw':!![]})[_0xa1eb('0x28')](function(_0x293f74){return createVoicePrefixExtensions(_0x1434a1,_0x293f74,_0x50eff6);});});});})['then'](function(){return db[_0xa1eb('0x32')][_0xa1eb('0x72')](_0x1434a1['id']);})[_0xa1eb('0x28')](respondWithResult(_0x16c5a3,null))[_0xa1eb('0x4a')](handleError(_0x16c5a3,null));};exports[_0xa1eb('0x73')]=function(_0x22a7cb,_0x389e44,_0x471633){return db[_0xa1eb('0x32')]['find']({'where':{'id':_0x22a7cb['params']['id']}})['then'](handleEntityNotFound(_0x389e44,null))[_0xa1eb('0x28')](function(_0x5b7785){if(_0x5b7785){return _0x5b7785[_0xa1eb('0x73')](_0x22a7cb[_0xa1eb('0x55')]['ids'],_['omit'](_0x22a7cb[_0xa1eb('0x55')],[_0xa1eb('0x74'),'id'])||{})[_0xa1eb('0x75')](function(_0x6027f7){for(var _0x470489=0x0;_0x470489<_0x22a7cb['body']['ids'][_0xa1eb('0x3b')];_0x470489+=0x1){socket[_0xa1eb('0x76')](_0xa1eb('0x77'),{'UserId':Number(_0x22a7cb[_0xa1eb('0x55')]['ids'][_0x470489]),'VoicePrefixId':Number(_0x22a7cb[_0xa1eb('0x4c')]['id'])});}return _0x6027f7;});}})[_0xa1eb('0x28')](respondWithResult(_0x389e44,null))[_0xa1eb('0x4a')](handleError(_0x389e44,null));};exports[_0xa1eb('0x78')]=function(_0x3863ce,_0x37d8c4,_0x3fd52a){return db[_0xa1eb('0x32')][_0xa1eb('0x50')]({'where':{'id':_0x3863ce[_0xa1eb('0x4c')]['id']}})[_0xa1eb('0x28')](handleEntityNotFound(_0x37d8c4,null))['then'](function(_0x21d884){if(_0x21d884){return _0x21d884[_0xa1eb('0x78')](_0x3863ce[_0xa1eb('0x38')][_0xa1eb('0x74')])[_0xa1eb('0x28')](function(){if(_[_0xa1eb('0x79')](_0x3863ce['query'][_0xa1eb('0x74')])){for(var _0x36a94f=0x0;_0x36a94f<_0x3863ce[_0xa1eb('0x38')][_0xa1eb('0x74')]['length'];_0x36a94f+=0x1){socket['emit'](_0xa1eb('0x7a'),{'UserId':Number(_0x3863ce['query'][_0xa1eb('0x74')][_0x36a94f]),'VoicePrefixId':Number(_0x3863ce[_0xa1eb('0x4c')]['id'])});}}else{socket['emit'](_0xa1eb('0x7a'),{'UserId':Number(_0x3863ce[_0xa1eb('0x38')]['ids']),'VoicePrefixId':Number(_0x3863ce[_0xa1eb('0x4c')]['id'])});}});}})[_0xa1eb('0x28')](respondWithStatusCode(_0x37d8c4,null))[_0xa1eb('0x4a')](handleError(_0x37d8c4,null));};exports[_0xa1eb('0x7b')]=function(_0x3d9034,_0x20cf70,_0x824123){var _0x2ce2e1={};var _0x3d32da={};var _0x64943f;var _0x3b4851;return db['VoicePrefix'][_0xa1eb('0x7c')]({'where':{'id':_0x3d9034[_0xa1eb('0x4c')]['id']}})[_0xa1eb('0x28')](handleEntityNotFound(_0x20cf70,null))[_0xa1eb('0x28')](function(_0x49e563){if(_0x49e563){_0x64943f=_0x49e563;_0x3d32da[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](db[_0xa1eb('0x7d')]['rawAttributes']);_0x3d32da[_0xa1eb('0x38')]=_[_0xa1eb('0x37')](_0x3d9034[_0xa1eb('0x38')]);_0x3d32da['filters']=_[_0xa1eb('0x4e')](_0x3d32da['model'],_0x3d32da[_0xa1eb('0x38')]);_0x2ce2e1[_0xa1eb('0x39')]=_[_0xa1eb('0x4e')](_0x3d32da[_0xa1eb('0x36')],qs[_0xa1eb('0x3a')](_0x3d9034[_0xa1eb('0x38')][_0xa1eb('0x3a')]));_0x2ce2e1[_0xa1eb('0x39')]=_0x2ce2e1['attributes'][_0xa1eb('0x3b')]?_0x2ce2e1[_0xa1eb('0x39')]:_0x3d32da[_0xa1eb('0x36')];_0x2ce2e1[_0xa1eb('0x3e')]=qs[_0xa1eb('0x3f')](_0x3d9034['query'][_0xa1eb('0x3f')]);_0x2ce2e1[_0xa1eb('0x40')]=qs['filters'](_[_0xa1eb('0x42')](_0x3d9034['query'],_0x3d32da['filters']));if(_0x3d9034[_0xa1eb('0x38')][_0xa1eb('0x43')]){_0x2ce2e1['where']=_[_0xa1eb('0x45')](_0x2ce2e1[_0xa1eb('0x40')],{'$or':_['map'](_0x2ce2e1[_0xa1eb('0x39')],function(_0x2c49d1){var _0x4d2598={};_0x4d2598[_0x2c49d1]={'$like':'%'+_0x3d9034['query'][_0xa1eb('0x43')]+'%'};return _0x4d2598;})});}_0x2ce2e1=_['merge']({},_0x2ce2e1,_0x3d9034[_0xa1eb('0x4f')]);return _0x64943f[_0xa1eb('0x7b')](_0x2ce2e1);}})[_0xa1eb('0x28')](function(_0x316a75){if(_0x316a75){_0x3b4851=_0x316a75[_0xa1eb('0x3b')];if(!_0x3d9034[_0xa1eb('0x38')]['hasOwnProperty'](_0xa1eb('0x3d'))){_0x2ce2e1['limit']=qs[_0xa1eb('0x1f')](_0x3d9034[_0xa1eb('0x38')][_0xa1eb('0x1f')]);_0x2ce2e1[_0xa1eb('0x21')]=qs[_0xa1eb('0x21')](_0x3d9034[_0xa1eb('0x38')][_0xa1eb('0x21')]);}return _0x64943f['getAgents'](_0x2ce2e1);}})[_0xa1eb('0x28')](function(_0x4effc0){if(_0x4effc0){return _0x4effc0?{'count':_0x3b4851,'rows':_0x4effc0}:null;}})['then'](respondWithResult(_0x20cf70,null))[_0xa1eb('0x4a')](handleError(_0x20cf70,null));};exports[_0xa1eb('0x7e')]=function(_0x456ddb,_0x559d58,_0x14eff1){var _0x717fbf={};var _0x5ef8c1={};var _0x2dd909;var _0x58d694;return db[_0xa1eb('0x32')]['findOne']({'where':{'id':_0x456ddb[_0xa1eb('0x4c')]['id']}})[_0xa1eb('0x28')](handleEntityNotFound(_0x559d58,null))['then'](function(_0x52c3d6){if(_0x52c3d6){_0x2dd909=_0x52c3d6;_0x5ef8c1[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](db[_0xa1eb('0x7f')][_0xa1eb('0x4d')]);_0x5ef8c1[_0xa1eb('0x38')]=_[_0xa1eb('0x37')](_0x456ddb[_0xa1eb('0x38')]);_0x5ef8c1[_0xa1eb('0x41')]=_[_0xa1eb('0x4e')](_0x5ef8c1[_0xa1eb('0x36')],_0x5ef8c1[_0xa1eb('0x38')]);_0x717fbf[_0xa1eb('0x39')]=_[_0xa1eb('0x4e')](_0x5ef8c1[_0xa1eb('0x36')],qs[_0xa1eb('0x3a')](_0x456ddb['query'][_0xa1eb('0x3a')]));_0x717fbf[_0xa1eb('0x39')]=_0x717fbf['attributes'][_0xa1eb('0x3b')]?_0x717fbf['attributes']:_0x5ef8c1[_0xa1eb('0x36')];_0x717fbf[_0xa1eb('0x3e')]=qs[_0xa1eb('0x3f')](_0x456ddb['query'][_0xa1eb('0x3f')]);_0x717fbf[_0xa1eb('0x40')]=qs[_0xa1eb('0x41')](_[_0xa1eb('0x42')](_0x456ddb['query'],_0x5ef8c1[_0xa1eb('0x41')]));if(_0x456ddb['query'][_0xa1eb('0x43')]){_0x717fbf[_0xa1eb('0x40')]=_[_0xa1eb('0x45')](_0x717fbf[_0xa1eb('0x40')],{'$or':_[_0xa1eb('0x31')](_0x717fbf[_0xa1eb('0x39')],function(_0xc27d40){var _0x1e3d9c={};_0x1e3d9c[_0xc27d40]={'$like':'%'+_0x456ddb['query'][_0xa1eb('0x43')]+'%'};return _0x1e3d9c;})});}_0x717fbf=_[_0xa1eb('0x45')]({},_0x717fbf,_0x456ddb[_0xa1eb('0x4f')]);return _0x2dd909[_0xa1eb('0x7e')](_0x717fbf);}})[_0xa1eb('0x28')](function(_0x322728){if(_0x322728){_0x58d694=_0x322728[_0xa1eb('0x3b')];if(!_0x456ddb[_0xa1eb('0x38')][_0xa1eb('0x3c')](_0xa1eb('0x3d'))){_0x717fbf[_0xa1eb('0x1f')]=qs[_0xa1eb('0x1f')](_0x456ddb[_0xa1eb('0x38')][_0xa1eb('0x1f')]);_0x717fbf['offset']=qs[_0xa1eb('0x21')](_0x456ddb[_0xa1eb('0x38')]['offset']);}return _0x2dd909['getTeams'](_0x717fbf);}})[_0xa1eb('0x28')](function(_0x106dd9){if(_0x106dd9){return _0x106dd9?{'count':_0x58d694,'rows':_0x106dd9}:null;}})[_0xa1eb('0x28')](respondWithResult(_0x559d58,null))[_0xa1eb('0x4a')](handleError(_0x559d58,null));};exports['addTeams']=function(_0x402acb,_0x49441f,_0x3ad4ca){var _0x2151a8=_0x402acb[_0xa1eb('0x55')][_0xa1eb('0x74')];var _0x33a90e;return db[_0xa1eb('0x7f')][_0xa1eb('0x48')]({'where':{'id':_0x2151a8},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xa1eb('0x80'),'interface'],'raw':!![]}]})[_0xa1eb('0x28')](function(_0x2c97f8){if(_0x2c97f8){_0x33a90e=_0x2c97f8;var _0x1c1a59=_[_0xa1eb('0x81')](_0x2c97f8,function(_0x438746){var _0x16528e=_0x438746[_0xa1eb('0x2a')]({'plain':!![]});return _0x16528e[_0xa1eb('0x82')];});return db[_0xa1eb('0x32')][_0xa1eb('0x50')]({'where':{'id':_0x402acb[_0xa1eb('0x4c')]['id']}})[_0xa1eb('0x28')](function(_0x3d9f66){return db[_0xa1eb('0x53')][_0xa1eb('0x54')](function(_0x562666){return _0x3d9f66[_0xa1eb('0x83')](_0x2151a8,{'transaction':_0x562666})['then'](function(){return BPromise[_0xa1eb('0x84')](_0x33a90e,function(_0x230a07){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x230a07['id'],'VoicePrefixId':_0x402acb[_0xa1eb('0x4c')]['id']},{'transaction':_0x562666});});})[_0xa1eb('0x28')](function(){return BPromise[_0xa1eb('0x84')](_0x1c1a59,function(_0x38451d){return db[_0xa1eb('0x85')][_0xa1eb('0x86')]({'where':{'UserId':_0x38451d['id'],'VoicePrefixId':_0x402acb['params']['id']},'transaction':_0x562666});});})[_0xa1eb('0x28')](function(){_0x1c1a59[_0xa1eb('0x87')](function(_0x11d0ab){socket[_0xa1eb('0x76')](_0xa1eb('0x77'),{'UserId':_0x11d0ab['id'],'VoicePrefixId':_0x3d9f66['id']});});});});});}})[_0xa1eb('0x28')](respondWithStatusCode(_0x49441f,null))[_0xa1eb('0x4a')](handleError(_0x49441f,null));};exports['removeTeams']=function(_0x37e2d5,_0x1cfec1,_0x4d9d0b){return db['Team'][_0xa1eb('0x48')]({'where':{'id':_0x37e2d5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa1eb('0x7d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa1eb('0x28')](handleEntityNotFound(_0x1cfec1,null))[_0xa1eb('0x28')](function(_0x5b8b32){var _0xe47df5=_[_0xa1eb('0x31')](_0x5b8b32,'id');var _0x382643=[];var _0x89e33c=[];var _0x4f535b=squel[_0xa1eb('0x88')]();_0x4f535b[_0xa1eb('0x89')](_0xa1eb('0x8a'))[_0xa1eb('0x8b')](_0xa1eb('0x8c'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa1eb('0x40')](_0xa1eb('0x8d'),_0x37e2d5[_0xa1eb('0x4c')]['id']);for(var _0x3da094=0x0;_0x3da094<_0x5b8b32[_0xa1eb('0x3b')];_0x3da094+=0x1){let _0x41e608=_0x5b8b32[_0x3da094];for(var _0x934746=0x0;_0x934746<_0x41e608[_0xa1eb('0x82')][_0xa1eb('0x3b')];_0x934746+=0x1){let _0x34e1ae=_0x41e608[_0xa1eb('0x82')][_0x934746];var _0x368e4e=_0x4f535b[_0xa1eb('0x8e')]();_0x368e4e[_0xa1eb('0x40')](_0xa1eb('0x8f'),_0x34e1ae['id']);_0x89e33c[_0xa1eb('0x69')](db[_0xa1eb('0x53')]['query'](_0x368e4e[_0xa1eb('0x90')](),{'type':db[_0xa1eb('0x53')]['QueryTypes'][_0xa1eb('0x91')]})[_0xa1eb('0x28')](function(_0x155a90){if(_0x155a90[_0xa1eb('0x3b')]===0x1){return _0x34e1ae['id'];}else{var _0x1d018a=_['every'](_['map'](_0x155a90,_0xa1eb('0x92')),function(_0x4ab784){return _[_0xa1eb('0x93')](_0xe47df5,_0x4ab784);});if(_0x1d018a){return _0x34e1ae['id'];}}}));}}return BPromise[_0xa1eb('0x94')](_0x89e33c)['then'](function(_0x4e3121){_0x382643=_(_0x382643)['union'](_0x4e3121)[_0xa1eb('0x95')]()['value']();return db[_0xa1eb('0x32')][_0xa1eb('0x50')]({'where':{'id':_0x37e2d5[_0xa1eb('0x4c')]['id']}})[_0xa1eb('0x28')](function(_0x29ecae){return db[_0xa1eb('0x53')][_0xa1eb('0x54')](function(_0x5a0dd4){return _0x29ecae[_0xa1eb('0x96')](_0x37e2d5[_0xa1eb('0x38')][_0xa1eb('0x74')],{'transaction':_0x5a0dd4})['then'](function(){if(!_['isEmpty'](_0x382643)){return _0x29ecae[_0xa1eb('0x78')](_0x382643,{'transaction':_0x5a0dd4});}})[_0xa1eb('0x28')](function(){_0x382643[_0xa1eb('0x87')](function(_0x42720b){socket[_0xa1eb('0x76')]('userVoicePrefix:remove',{'UserId':_0x42720b,'VoicePrefixId':_0x29ecae['id']});});});});});});})[_0xa1eb('0x28')](respondWithStatusCode(_0x1cfec1,null))['catch'](handleError(_0x1cfec1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f3d6c5e..1942072 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 _0x8797=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix'];(function(_0x5cf81a,_0x3bf6f6){var _0x18afeb=function(_0x2b6491){while(--_0x2b6491){_0x5cf81a['push'](_0x5cf81a['shift']());}};_0x18afeb(++_0x3bf6f6);}(_0x8797,0x1a6));var _0x7879=function(_0x26d2a1,_0x351a41){_0x26d2a1=_0x26d2a1-0x0;var _0x3d28f8=_0x8797[_0x26d2a1];return _0x3d28f8;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x7879('0x0'))['db'][_0x7879('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7879('0x2')](0x0);var events={'afterCreate':_0x7879('0x3'),'afterUpdate':'update','afterDestroy':_0x7879('0x4')};function emitEvent(_0x1129e5){return function(_0x245423,_0x3937bf,_0xce0a79){VoicePrefixEvents[_0x7879('0x5')](_0x1129e5+':'+_0x245423['id'],_0x245423);VoicePrefixEvents[_0x7879('0x5')](_0x1129e5,_0x245423);_0xce0a79(null);};}for(var e in events){if(events[_0x7879('0x6')](e)){var event=events[e];VoicePrefix[_0x7879('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xff66=['VoicePrefix','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2f8e44,_0x25e114){var _0x57b567=function(_0x233b43){while(--_0x233b43){_0x2f8e44['push'](_0x2f8e44['shift']());}};_0x57b567(++_0x25e114);}(_0xff66,0x7d));var _0x6ff6=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xff66[_0x26b5ff];return _0x58603e;};'use strict';var EventEmitter=require(_0x6ff6('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x6ff6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ff6('0x2'),'afterUpdate':_0x6ff6('0x3'),'afterDestroy':_0x6ff6('0x4')};function emitEvent(_0x5ec705){return function(_0x174eaa,_0x4e09f6,_0x3815de){VoicePrefixEvents['emit'](_0x5ec705+':'+_0x174eaa['id'],_0x174eaa);VoicePrefixEvents[_0x6ff6('0x5')](_0x5ec705,_0x174eaa);_0x3815de(null);};}for(var e in events){if(events[_0x6ff6('0x6')](e)){var event=events[e];VoicePrefix[_0x6ff6('0x7')](e,emitEvent(event));}}module[_0x6ff6('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index dc3d0ec..1e93311 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 _0x87a0=['lodash','api','moment','path','rimraf','../../config/environment','exports','define','VoicePrefix'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x87a0,0xea));var _0x087a=function(_0x2f2690,_0x38fb94){_0x2f2690=_0x2f2690-0x0;var _0x7eefc6=_0x87a0[_0x2f2690];return _0x7eefc6;};'use strict';var _=require(_0x087a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x087a('0x1'));var moment=require(_0x087a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x087a('0x3'));var rimraf=require(_0x087a('0x4'));var config=require(_0x087a('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x087a('0x6')]=function(_0xfc3123,_0x153ab4){return _0xfc3123[_0x087a('0x7')](_0x087a('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5116=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','util','api','bluebird','request-promise','path'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x5116,0x1c9));var _0x6511=function(_0xadf085,_0x578770){_0xadf085=_0xadf085-0x0;var _0x124df8=_0x5116[_0xadf085];return _0x124df8;};'use strict';var _=require('lodash');var util=require(_0x6511('0x0'));var logger=require('../../config/logger')(_0x6511('0x1'));var moment=require('moment');var BPromise=require(_0x6511('0x2'));var rp=require(_0x6511('0x3'));var fs=require('fs');var path=require(_0x6511('0x4'));var rimraf=require(_0x6511('0x5'));var config=require(_0x6511('0x6'));var attributes=require(_0x6511('0x7'));module[_0x6511('0x8')]=function(_0x54b76b,_0x117ed9){return _0x54b76b['define'](_0x6511('0x9'),attributes,{'tableName':_0x6511('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 fa34cc4..005c077 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 _0x0570=['debug','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x54b3c2,_0x50dda1){var _0x1c7b41=function(_0x3cd864){while(--_0x3cd864){_0x54b3c2['push'](_0x54b3c2['shift']());}};_0x1c7b41(++_0x50dda1);}(_0x0570,0x172));var _0x0057=function(_0x33367b,_0x227a61){_0x33367b=_0x33367b-0x0;var _0x2d8d26=_0x0570[_0x33367b];return _0x2d8d26;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});config['redis']=_[_0x0057('0xa')](config['redis'],{'host':_0x0057('0xb'),'port':0x18eb});var socket=require(_0x0057('0xc'))(new Redis(config[_0x0057('0xd')]));require(_0x0057('0xe'))[_0x0057('0xf')](socket);function respondWithRpcPromise(_0x54f384,_0x3dd577,_0x2fd05d){return new BPromise(function(_0xb56a5c,_0x5d493f){return client[_0x0057('0x10')](_0x54f384,_0x2fd05d)[_0x0057('0x11')](function(_0x48805a){logger['info'](_0x0057('0x12'),_0x3dd577,_0x0057('0x13'));logger[_0x0057('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3dd577,_0x0057('0x13'),JSON[_0x0057('0x15')](_0x48805a));if(_0x48805a[_0x0057('0x16')]){if(_0x48805a[_0x0057('0x16')]['code']===0x1f4){logger[_0x0057('0x16')](_0x0057('0x12'),_0x3dd577,_0x48805a['error'][_0x0057('0x17')]);return _0x5d493f(_0x48805a[_0x0057('0x16')]['message']);}logger[_0x0057('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3dd577,_0x48805a[_0x0057('0x16')]['message']);return _0xb56a5c(_0x48805a[_0x0057('0x16')][_0x0057('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3dd577,_0x0057('0x13'));_0xb56a5c(_0x48805a[_0x0057('0x18')]['message']);}})[_0x0057('0x19')](function(_0x5b5a4b){logger[_0x0057('0x16')](_0x0057('0x12'),_0x3dd577,_0x5b5a4b);_0x5d493f(_0x5b5a4b);});});} \ No newline at end of file +var _0x2d07=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x2d07,0x13a));var _0x72d0=function(_0x4b9b78,_0x1dc74a){_0x4b9b78=_0x4b9b78-0x0;var _0x330388=_0x2d07[_0x4b9b78];return _0x330388;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});config[_0x72d0('0xb')]=_[_0x72d0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x72d0('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0xb6293,_0x4116c1,_0x1d8102){return new BPromise(function(_0x36c904,_0x4b545f){return client['request'](_0xb6293,_0x1d8102)['then'](function(_0x17f795){logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));logger[_0x72d0('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4116c1,_0x72d0('0x10'),JSON[_0x72d0('0x12')](_0x17f795));if(_0x17f795[_0x72d0('0x13')]){if(_0x17f795['error'][_0x72d0('0x14')]===0x1f4){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x4b545f(_0x17f795[_0x72d0('0x13')]['message']);}logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x36c904(_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);}else{logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));_0x36c904(_0x17f795['result'][_0x72d0('0x15')]);}})[_0x72d0('0x16')](function(_0x2cd4aa){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x2cd4aa);_0x4b545f(_0x2cd4aa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f3cd014..f89afda 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 _0x3dd5=['removeListener','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3dd5,0x73));var _0x53dd=function(_0x1100ff,_0x2dce61){_0x1100ff=_0x1100ff-0x0;var _0x368202=_0x3dd5[_0x1100ff];return _0x368202;};'use strict';var VoicePrefixEvents=require(_0x53dd('0x0'));var events=['save',_0x53dd('0x1'),_0x53dd('0x2')];function createListener(_0x45d521,_0x3b6401){return function(_0xfa7c49){_0x3b6401[_0x53dd('0x3')](_0x45d521,_0xfa7c49);};}function removeListener(_0x2ac886,_0x378841){return function(){VoicePrefixEvents[_0x53dd('0x4')](_0x2ac886,_0x378841);};}exports['register']=function(_0x3c8f9e){for(var _0x26c218=0x0,_0x37e012=events[_0x53dd('0x5')];_0x26c218<_0x37e012;_0x26c218++){var _0x4d3132=events[_0x26c218];var _0x561ded=createListener(_0x53dd('0x6')+_0x4d3132,_0x3c8f9e);VoicePrefixEvents['on'](_0x4d3132,_0x561ded);}}; \ No newline at end of file +var _0xfd3a=['save','remove','update','emit','removeListener','length','./voicePrefix.events'];(function(_0x242ee8,_0x18b946){var _0x1c5740=function(_0x19d135){while(--_0x19d135){_0x242ee8['push'](_0x242ee8['shift']());}};_0x1c5740(++_0x18b946);}(_0xfd3a,0x179));var _0xafd3=function(_0xae0b69,_0x2bd756){_0xae0b69=_0xae0b69-0x0;var _0x5e183e=_0xfd3a[_0xae0b69];return _0x5e183e;};'use strict';var VoicePrefixEvents=require(_0xafd3('0x0'));var events=[_0xafd3('0x1'),_0xafd3('0x2'),_0xafd3('0x3')];function createListener(_0x4ce05e,_0x488608){return function(_0x160b0d){_0x488608[_0xafd3('0x4')](_0x4ce05e,_0x160b0d);};}function removeListener(_0x328118,_0x415217){return function(){VoicePrefixEvents[_0xafd3('0x5')](_0x328118,_0x415217);};}exports['register']=function(_0x9db715){for(var _0x1a72eb=0x0,_0x1f7e16=events[_0xafd3('0x6')];_0x1a72eb<_0x1f7e16;_0x1a72eb++){var _0xd2d780=events[_0x1a72eb];var _0x4c4dcd=createListener('voicePrefix:'+_0xd2d780,_0x9db715);VoicePrefixEvents['on'](_0xd2d780,_0x4c4dcd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 920ceaa..6c8e7a2 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x801846,_0x33b830){var _0x456a96=function(_0x4920b3){while(--_0x4920b3){_0x801846['push'](_0x801846['shift']());}};_0x456a96(++_0x33b830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4ba102,_0x3dc213){var _0x1f35e7=function(_0xceae5a){while(--_0xceae5a){_0x4ba102['push'](_0x4ba102['shift']());}};_0x1f35e7(++_0x3dc213);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 3a87d22..6f7778a 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 _0xb13f=['rrordered','setDataValue','type','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','yes','ENUM','all','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\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','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','outbound','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom'];(function(_0x557079,_0x4adad5){var _0x39d8fa=function(_0x4e04c8){while(--_0x4e04c8){_0x557079['push'](_0x557079['shift']());}};_0x39d8fa(++_0x4adad5);}(_0xb13f,0x131));var _0xfb13=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0xb13f[_0x1d3fdc];return _0x128bb0;};'use strict';var Sequelize=require(_0xfb13('0x0'));module[_0xfb13('0x1')]={'name':{'type':Sequelize[_0xfb13('0x2')],'allowNull':![],'unique':_0xfb13('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xfb13('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfb13('0x5'),_0xfb13('0x6'),_0xfb13('0x7'),'random',_0xfb13('0x8'),_0xfb13('0x9'),_0xfb13('0xa'),_0xfb13('0xb')),'allowNull':![],'defaultValue':_0xfb13('0x5'),'set':function(_0x1c6c9c){this[_0xfb13('0xc')]('strategy',_0x1c6c9c?_0x1c6c9c:_0xfb13('0x8'));},'get':function(){var _0x3f1e24=this['getDataValue'](_0xfb13('0xd'));var _0x1c2523=this[_0xfb13('0xe')](_0xfb13('0xf'));var _0x2c9e5d=this[_0xfb13('0xe')](_0xfb13('0x10'));if(_0x3f1e24===_0xfb13('0x4')){if(_0x1c2523===_0xfb13('0x11')){return null;}if(_0x1c2523===_0xfb13('0x12')&&![_0xfb13('0x8'),_0xfb13('0x13')]['includes'](_0x2c9e5d)){this['setDataValue'](_0xfb13('0x10'),_0xfb13('0x8'));}}return _0x2c9e5d;}},'servicelevel':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfb13('0x14')](0xb)},'timeout':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfb13('0x2')]},'weight':{'type':Sequelize[_0xfb13('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfb13('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no',_0xfb13('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfb13('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfb13('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfb13('0x16')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xfb13('0x15'),'no'),'defaultValue':_0xfb13('0x15')},'announce_holdtime':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xfb13('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfb13('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xfb13('0x2')]},'queue_quantity2':{'type':Sequelize[_0xfb13('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xfb13('0x2')]},'queue_less_than':{'type':Sequelize[_0xfb13('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x18ab30){this['setDataValue'](_0xfb13('0x18'),_0x18ab30?_0x18ab30[_0xfb13('0x19')](','):[]);},'get':function(){return this[_0xfb13('0xe')](_0xfb13('0x18'))?this['getDataValue'](_0xfb13('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':'yes','set':function(_0x452aa8){this[_0xfb13('0xc')](_0xfb13('0x1a'),_0x452aa8?_0x452aa8[_0xfb13('0x19')](','):undefined);},'get':function(){return this[_0xfb13('0xe')](_0xfb13('0x1a'))?this[_0xfb13('0xe')](_0xfb13('0x1a'))[_0xfb13('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':'no','set':function(_0x3e8583){this['setDataValue'](_0xfb13('0x1c'),_0x3e8583?_0x3e8583[_0xfb13('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xfb13('0x1c'))?this[_0xfb13('0xe')](_0xfb13('0x1c'))[_0xfb13('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfb13('0x16')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb13('0x2')]},'acw':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':0x0,'set':function(_0x389388){this[_0xfb13('0xc')](_0xfb13('0x1e'),_0x389388);if(_0x389388){if(this[_0xfb13('0xe')](_0xfb13('0x1f'))<0x2){this['setDataValue'](_0xfb13('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfb13('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':0x0,'comment':_0xfb13('0x20')},'dialMethod':{'type':Sequelize[_0xfb13('0x16')](_0xfb13('0x11'),'progressive',_0xfb13('0x21'),_0xfb13('0x22'),'booked'),'defaultValue':_0xfb13('0x23'),'comment':_0xfb13('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfb13('0x14')](0x4)[_0xfb13('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfb13('0x26')},'dialLimitQueue':{'type':Sequelize[_0xfb13('0x14')](0x4)[_0xfb13('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfb13('0x27')},'dialPowerLevel':{'type':Sequelize[_0xfb13('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfb13('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xfb13('0x2a'),_0xfb13('0x2b')),'defaultValue':_0xfb13('0x2b'),'comment':_0xfb13('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfb13('0x28')](0x2)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfb13('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfb13('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfb13('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xfb13('0x30'),'comment':_0xfb13('0x31')},'dialQueueTimeout':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x32')},'dialQueueProject':{'type':Sequelize[_0xfb13('0x2')],'comment':_0xfb13('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb13('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfb13('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb13('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfb13('0x39')},'dialTimezone':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfb13('0x2')],'defaultValue':_0xfb13('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':_0xfb13('0x3b')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfb13('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xfb13('0x14')](0x9)[_0xfb13('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfb13('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfb13('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfb13('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfb13('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xfb13('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfb13('0x14')](0x9)[_0xfb13('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfb13('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfb13('0x14')](0x9)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfb13('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfb13('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfb13('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfb13('0x42')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xfb13('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfb13('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfb13('0x44'),'ASC'),'defaultValue':_0xfb13('0x44')},'dialQueueProject2':{'type':Sequelize[_0xfb13('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfb13('0x45')},'dialCutDigit':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb13('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfb13('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfb13('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfb13('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfb13('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfb13('0x14')](0x5)[_0xfb13('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xfb13('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':![],'comment':_0xfb13('0x4c'),'set':function(_0x9a465){if(!_0x9a465)this[_0xfb13('0xc')](_0xfb13('0x4d'),null);this['setDataValue'](_0xfb13('0x4e'),_0x9a465);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfb13('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfb13('0x14')](0x3)[_0xfb13('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xfb13('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfb13('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x8371=['Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','leastrecent','rrmemory','linear','wrandom','rrordered','ringall','strategy','getDataValue','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','progressive','power'];(function(_0x418209,_0x29858e){var _0x17e00d=function(_0x5a3f4d){while(--_0x5a3f4d){_0x418209['push'](_0x418209['shift']());}};_0x17e00d(++_0x29858e);}(_0x8371,0x123));var _0x1837=function(_0x2aa1c1,_0x223b3e){_0x2aa1c1=_0x2aa1c1-0x0;var _0x449db7=_0x8371[_0x2aa1c1];return _0x449db7;};'use strict';var Sequelize=require(_0x1837('0x0'));module[_0x1837('0x1')]={'name':{'type':Sequelize[_0x1837('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x4'),_0x1837('0x5')),'allowNull':![],'defaultValue':_0x1837('0x4')},'musiconhold':{'type':Sequelize[_0x1837('0x2')],'defaultValue':_0x1837('0x6')},'announce':{'type':Sequelize[_0x1837('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1837('0x3')]('rr','ringall',_0x1837('0x7'),'fewestcalls','random',_0x1837('0x8'),_0x1837('0x9'),_0x1837('0xa'),_0x1837('0xb')),'allowNull':![],'defaultValue':_0x1837('0xc'),'set':function(_0x2407ef){this['setDataValue'](_0x1837('0xd'),_0x2407ef?_0x2407ef:_0x1837('0x8'));},'get':function(){var _0x2567ee=this['getDataValue']('type');var _0x4f85a2=this[_0x1837('0xe')]('dialMethod');var _0x5b5505=this[_0x1837('0xe')](_0x1837('0xd'));if(_0x2567ee==='outbound'){if(_0x4f85a2===_0x1837('0xf')){return null;}if(_0x4f85a2===_0x1837('0x10')&&![_0x1837('0x8'),_0x1837('0x11')][_0x1837('0x12')](_0x5b5505)){this[_0x1837('0x13')](_0x1837('0xd'),_0x1837('0x8'));}}return _0x5b5505;}},'servicelevel':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1837('0x14')](0xb)},'timeout':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1837('0x2')]},'weight':{'type':Sequelize[_0x1837('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':_0x1837('0x15')},'autopause':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1837('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1837('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1837('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1837('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':_0x1837('0x15')},'announce_holdtime':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no',_0x1837('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1837('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x1837('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1837('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1837('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1837('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1837('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1837('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1837('0x2')]},'queue_quantity2':{'type':Sequelize[_0x1837('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x246460){this[_0x1837('0x13')]('periodic_announce',_0x246460?_0x246460[_0x1837('0x17')](','):[]);},'get':function(){return this[_0x1837('0xe')](_0x1837('0x18'))?this[_0x1837('0xe')](_0x1837('0x18'))[_0x1837('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x1837('0x2')],'defaultValue':_0x1837('0x15'),'set':function(_0x46135b){this[_0x1837('0x13')]('joinempty',_0x46135b?_0x46135b['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1837('0x1a'))?this[_0x1837('0xe')]('joinempty')[_0x1837('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1837('0x2')],'defaultValue':'no','set':function(_0x412593){this[_0x1837('0x13')]('leavewhenempty',_0x412593?_0x412593[_0x1837('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x1837('0x1b'))?this[_0x1837('0xe')](_0x1837('0x1b'))[_0x1837('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1837('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x1837('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1837('0x2')]},'description':{'type':Sequelize[_0x1837('0x2')]},'acw':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':0x0,'set':function(_0x5b048f){this[_0x1837('0x13')](_0x1837('0x1d'),_0x5b048f);if(_0x5b048f){if(this['getDataValue']('wrapuptime')<0x2){this[_0x1837('0x13')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1837('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':0x0,'comment':_0x1837('0x1e')},'dialMethod':{'type':Sequelize[_0x1837('0x3')](_0x1837('0xf'),_0x1837('0x1f'),_0x1837('0x20'),'predictive',_0x1837('0x10')),'defaultValue':_0x1837('0x1f'),'comment':_0x1837('0x21')},'dialLimitChannel':{'type':Sequelize[_0x1837('0x14')](0x4)[_0x1837('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1837('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x1837('0x24')](0x2)[_0x1837('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1837('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x26'),_0x1837('0x27')),'defaultValue':_0x1837('0x27'),'comment':_0x1837('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1837('0x24')](0x2)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1837('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1837('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1837('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1837('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x1837('0x2')],'defaultValue':_0x1837('0x2c'),'comment':_0x1837('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x1837('0x2')],'comment':_0x1837('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1837('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'comment':_0x1837('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1837('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1837('0x34')},'dialTimezone':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1837('0x2')],'defaultValue':_0x1837('0x35')},'dialPrefix':{'type':Sequelize[_0x1837('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1837('0x36'),_0x1837('0x37'),_0x1837('0x38')),'defaultValue':_0x1837('0x36')},'dialAMDActive':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':0x0,'comment':_0x1837('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x1837('0x14')](0x9)[_0x1837('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1837('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x1837('0x14')](0x9)[_0x1837('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1837('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1837('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1837('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1837('0x14')](0x9)[_0x1837('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1837('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x1837('0x14')](0x9)[_0x1837('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1837('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1837('0x14')](0x9)[_0x1837('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1837('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1837('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1837('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1837('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1837('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x1837('0x14')](0x5)[_0x1837('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1837('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1837('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1837('0x3')](_0x1837('0x43'),_0x1837('0x44')),'defaultValue':_0x1837('0x43')},'dialQueueProject2':{'type':Sequelize[_0x1837('0x2')],'comment':_0x1837('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1837('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1837('0x45')},'dialCutDigit':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1837('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1837('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)[_0x1837('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1837('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1837('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1837('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1837('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1837('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':![],'comment':_0x1837('0x4e'),'set':function(_0x190d42){if(!_0x190d42)this[_0x1837('0x13')](_0x1837('0x4f'),null);this[_0x1837('0x13')](_0x1837('0x50'),_0x190d42);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1837('0x14')](0x3)[_0x1837('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1837('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x1837('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1837('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4eff747..a32f77d 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 _0x202a=['addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','VoiceQueue','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','catch','create','body','get','user','VoiceQueues','inbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','VoiceQueueId','CmHopperBlack','getTeams','Team','User','Agents','voicePause','interface','flatMap','forEach','penalty','addTeams','each','TeamVoiceQueue','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','spread','online','removeAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','createdAt','select','CmListId','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','ContactId','fromQuery','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists'];(function(_0x3cb1ef,_0x2fc330){var _0x356656=function(_0x4ea372){while(--_0x4ea372){_0x3cb1ef['push'](_0x3cb1ef['shift']());}};_0x356656(++_0x2fc330);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa202('0x0'));var zipdir=require(_0xa202('0x1'));var jsonpatch=require(_0xa202('0x2'));var rp=require('request-promise');var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa202('0x4'));var sox=require(_0xa202('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa202('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];config['redis']=_[_0xa202('0x13')](config[_0xa202('0x14')],{'host':_0xa202('0x15'),'port':0x18eb});var socket=require(_0xa202('0x16'))(new Redis(config[_0xa202('0x14')]));require(_0xa202('0x17'))['register'](socket);function respondWithStatusCode(_0x13510c,_0x3b3ec9){_0x3b3ec9=_0x3b3ec9||0xcc;return function(_0x3880ad){if(_0x3880ad){return _0x13510c[_0xa202('0x18')](_0x3b3ec9);}return _0x13510c[_0xa202('0x19')](_0x3b3ec9)['end']();};}function respondWithResult(_0x331df8,_0x30b18b){_0x30b18b=_0x30b18b||0xc8;return function(_0x1221a2){if(_0x1221a2){return _0x331df8[_0xa202('0x19')](_0x30b18b)[_0xa202('0x1a')](_0x1221a2);}};}function respondWithFilteredResult(_0x214a08,_0x5d348c){return function(_0x44a1b6){if(_0x44a1b6){var _0x53ff78=typeof _0x5d348c[_0xa202('0x1b')]==='undefined'&&typeof _0x5d348c[_0xa202('0x1c')]===_0xa202('0x1d');var _0x130c45=_0x44a1b6[_0xa202('0x1e')];var _0x391e82=_0x53ff78?0x0:_0x5d348c['offset'];var _0x1da0e2=_0x53ff78?_0x44a1b6[_0xa202('0x1e')]:_0x5d348c[_0xa202('0x1b')]+_0x5d348c[_0xa202('0x1c')];var _0x188195;if(_0x1da0e2>=_0x130c45){_0x1da0e2=_0x130c45;_0x188195=0xc8;}else{_0x188195=0xce;}_0x214a08['status'](_0x188195);return _0x214a08[_0xa202('0x1f')](_0xa202('0x20'),_0x391e82+'-'+_0x1da0e2+'/'+_0x130c45)[_0xa202('0x1a')](_0x44a1b6);}return null;};}function patchUpdates(_0x44801a){return function(_0x5845f5){try{jsonpatch[_0xa202('0x21')](_0x5845f5,_0x44801a,!![]);}catch(_0x192d3c){return BPromise['reject'](_0x192d3c);}return _0x5845f5['save']();};}function saveUpdates(_0x7991c7,_0x2f5714){return function(_0x47ceb1){if(_0x47ceb1){return _0x47ceb1[_0xa202('0x22')](_0x7991c7)['then'](function(_0x5373b6){return _0x5373b6;});}return null;};}function removeEntity(_0x72fe3e,_0x268ee9){return function(_0x397553){if(_0x397553){return _0x397553[_0xa202('0x23')]()[_0xa202('0x24')](function(){var _0x1d6704=_0x397553['get']({'plain':!![]});var _0x571571=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0xa202('0x25'),'value':_0xa202('0x26'),'ignore':![]}];var _0x3db218=_(_0x571571)['filter'](_0xa202('0x27'))[_0xa202('0x28')](_0xa202('0x29'))[_0xa202('0x29')]();if(_[_0xa202('0x2a')](_0x3db218,_0x1d6704[_0xa202('0x2b')])){return;}var _0x41b09b=_[_0xa202('0x2c')](_0x571571,[_0xa202('0x29'),_0x1d6704[_0xa202('0x2b')]])[_0xa202('0x2d')];return db[_0xa202('0x2e')][_0xa202('0x23')]({'where':{'type':_0x41b09b,'resourceId':_0x1d6704['id']}})[_0xa202('0x24')](function(){return _0x397553;});})[_0xa202('0x24')](function(){_0x72fe3e[_0xa202('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418ff0,_0x15eb0e){return function(_0x35ec2b){if(!_0x35ec2b){_0x418ff0[_0xa202('0x18')](0x194);}return _0x35ec2b;};}function handleError(_0x374590,_0x348544){_0x348544=_0x348544||0x1f4;return function(_0x4e7b0d){logger[_0xa202('0x2f')](_0x4e7b0d[_0xa202('0x30')]);if(_0x4e7b0d['name']){delete _0x4e7b0d[_0xa202('0x2d')];}_0x374590[_0xa202('0x19')](_0x348544)['send'](_0x4e7b0d);};}exports['index']=function(_0x59193d,_0x272cff){var _0x3d84a9={},_0x353014={},_0x18d13d={'count':0x0,'rows':[]};var _0x2c158c=_['map'](db[_0xa202('0x31')]['rawAttributes'],function(_0x2cb87a){return{'name':_0x2cb87a[_0xa202('0x32')],'type':_0x2cb87a[_0xa202('0x2b')]['key']};});_0x353014[_0xa202('0x33')]=_['map'](_0x2c158c,'name');_0x353014[_0xa202('0x34')]=_[_0xa202('0x35')](_0x59193d['query']);_0x353014[_0xa202('0x36')]=_['intersection'](_0x353014['model'],_0x353014[_0xa202('0x34')]);_0x3d84a9[_0xa202('0x37')]=_['intersection'](_0x353014[_0xa202('0x33')],qs[_0xa202('0x38')](_0x59193d[_0xa202('0x34')]['fields']));_0x3d84a9[_0xa202('0x37')]=_0x3d84a9[_0xa202('0x37')][_0xa202('0x39')]?_0x3d84a9[_0xa202('0x37')]:_0x353014[_0xa202('0x33')];if(!_0x59193d[_0xa202('0x34')][_0xa202('0x3a')](_0xa202('0x3b'))){_0x3d84a9[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x59193d[_0xa202('0x34')][_0xa202('0x1c')]);_0x3d84a9['offset']=qs['offset'](_0x59193d[_0xa202('0x34')][_0xa202('0x1b')]);}_0x3d84a9[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x59193d[_0xa202('0x34')][_0xa202('0x3d')]);_0x3d84a9[_0xa202('0x3e')]=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x59193d[_0xa202('0x34')],_0x353014['filters']),_0x2c158c);if(_0x59193d[_0xa202('0x34')][_0xa202('0x40')]){_0x3d84a9['where']=_['merge'](_0x3d84a9['where'],{'$or':_[_0xa202('0x28')](_0x2c158c,function(_0x3dfeb5){if(_0x3dfeb5[_0xa202('0x2b')]!==_0xa202('0x41')){var _0x5035e2={};_0x5035e2[_0x3dfeb5[_0xa202('0x2d')]]={'$like':'%'+_0x59193d[_0xa202('0x34')][_0xa202('0x40')]+'%'};return _0x5035e2;}})});}_0x3d84a9=_[_0xa202('0x42')]({},_0x3d84a9,_0x59193d['options']);var _0x169a02={'where':_0x3d84a9[_0xa202('0x3e')]};return db[_0xa202('0x31')]['count'](_0x169a02)[_0xa202('0x24')](function(_0xaf38be){_0x18d13d[_0xa202('0x1e')]=_0xaf38be;if(_0x59193d[_0xa202('0x34')][_0xa202('0x43')]){_0x3d84a9[_0xa202('0x44')]=[{'all':!![]}];}return db[_0xa202('0x31')][_0xa202('0x45')](_0x3d84a9);})[_0xa202('0x24')](function(_0x1c7cd0){_0x18d13d[_0xa202('0x46')]=_0x1c7cd0;return _0x18d13d;})[_0xa202('0x24')](respondWithFilteredResult(_0x272cff,_0x3d84a9))['catch'](handleError(_0x272cff,null));};exports[_0xa202('0x47')]=function(_0x1dca0c,_0x2608a2){var _0x26c959={'raw':![],'where':{'id':_0x1dca0c[_0xa202('0x48')]['id']}},_0x40ba81={};_0x40ba81[_0xa202('0x33')]=_[_0xa202('0x35')](db['VoiceQueue'][_0xa202('0x49')]);_0x40ba81[_0xa202('0x34')]=_[_0xa202('0x35')](_0x1dca0c['query']);_0x40ba81[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x40ba81[_0xa202('0x33')],_0x40ba81['query']);_0x26c959[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x40ba81[_0xa202('0x33')],qs[_0xa202('0x38')](_0x1dca0c[_0xa202('0x34')][_0xa202('0x38')]));_0x26c959[_0xa202('0x37')]=_0x26c959[_0xa202('0x37')][_0xa202('0x39')]?_0x26c959[_0xa202('0x37')]:_0x40ba81[_0xa202('0x33')];if(_0x1dca0c['query'][_0xa202('0x43')]){_0x26c959[_0xa202('0x44')]=[{'all':!![]}];}_0x26c959=_[_0xa202('0x42')]({},_0x26c959,_0x1dca0c['options']);return db['VoiceQueue'][_0xa202('0x2c')](_0x26c959)[_0xa202('0x24')](handleEntityNotFound(_0x2608a2,null))['then'](respondWithResult(_0x2608a2,null))[_0xa202('0x4b')](handleError(_0x2608a2,null));};exports[_0xa202('0x4c')]=function(_0x52d64d,_0x218108){return db[_0xa202('0x31')][_0xa202('0x4c')](_0x52d64d[_0xa202('0x4d')],{})['then'](function(_0x205bf2){var _0x5de652=_0x52d64d['user'][_0xa202('0x4e')]({'plain':!![]});if(!_0x5de652)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5de652['role']===_0xa202('0x4f')){var _0x51953a=_0x205bf2['get']({'plain':!![]});var _0x172ec1=[{'name':_0xa202('0x50'),'value':_0xa202('0x51')},{'name':_0xa202('0x25'),'value':_0xa202('0x26')}];var _0x1e2b8=_[_0xa202('0x2c')](_0x172ec1,['value',_0x51953a[_0xa202('0x2b')]])[_0xa202('0x2d')];return db[_0xa202('0x52')][_0xa202('0x2c')]({'where':{'name':_0x1e2b8,'userProfileId':_0x5de652[_0xa202('0x53')]},'raw':!![]})[_0xa202('0x24')](function(_0xaea834){if(_0xaea834&&_0xaea834['autoAssociation']===0x0){return db[_0xa202('0x2e')][_0xa202('0x4c')]({'name':_0x51953a[_0xa202('0x2d')],'resourceId':_0x51953a['id'],'type':_0xaea834['name'],'sectionId':_0xaea834['id']},{})['then'](function(){return _0x205bf2;});}else{return _0x205bf2;}})['catch'](function(_0x43d1a5){logger[_0xa202('0x2f')](_0xa202('0x54'),_0x43d1a5);throw _0x43d1a5;});}return _0x205bf2;})[_0xa202('0x24')](respondWithResult(_0x218108,0xc9))[_0xa202('0x4b')](handleError(_0x218108,null));};exports[_0xa202('0x55')]=function(_0x3b1efe,_0x1f3677){var _0x42bb2f={'where':{'id':_0x3b1efe[_0xa202('0x48')]['id']}},_0x590ebe={};_0x590ebe['model']=_[_0xa202('0x35')](db[_0xa202('0x31')][_0xa202('0x49')]);_0x42bb2f[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x590ebe['model'],qs[_0xa202('0x38')](_0x3b1efe[_0xa202('0x34')]['fields']));_0x42bb2f[_0xa202('0x37')]=_0x42bb2f['attributes'][_0xa202('0x39')]?_0x42bb2f['attributes']:_0x590ebe['model'];if(_0x3b1efe[_0xa202('0x34')][_0xa202('0x43')]){_0x42bb2f[_0xa202('0x44')]=[{'all':!![]}];}_0x42bb2f=_[_0xa202('0x42')]({},_0x42bb2f,_0x3b1efe[_0xa202('0x56')]);return db['VoiceQueue']['find'](_0x42bb2f)['then'](handleEntityNotFound(_0x1f3677,null))[_0xa202('0x24')](function(_0x3a30b8){if(_0x3a30b8){var _0x22ea2e=_0x3a30b8[_0xa202('0x4e')]({'plain':!![]});_0x22ea2e=qs[_0xa202('0x57')](_0x22ea2e,['id','createdAt','updatedAt']);_0x3b1efe['body']=_[_0xa202('0x57')](_0x3b1efe[_0xa202('0x4d')],['id','createdAt',_0xa202('0x58')]);return db[_0xa202('0x31')]['create'](_['merge'](_0x22ea2e,_0x3b1efe[_0xa202('0x4d')]),{'include':_0x3b1efe['query'][_0xa202('0x43')]?[{'all':!![]}]:undefined})[_0xa202('0x24')](function(_0x72a8ca){var _0x4bf8f4=_0x3b1efe[_0xa202('0x4f')][_0xa202('0x4e')]({'plain':!![]});if(!_0x4bf8f4)throw new Error(_0xa202('0x59'));if(_0x4bf8f4['role']===_0xa202('0x4f')){var _0x392d76=_0x72a8ca[_0xa202('0x4e')]({'plain':!![]});var _0x1f7304=[{'name':'VoiceQueues','value':_0xa202('0x51')},{'name':_0xa202('0x25'),'value':'outbound'}];var _0x2d6cc0=_[_0xa202('0x2c')](_0x1f7304,['value',_0x392d76['type']])[_0xa202('0x2d')];return db[_0xa202('0x52')]['find']({'where':{'name':_0x2d6cc0,'userProfileId':_0x4bf8f4['userProfileId']},'raw':!![]})['then'](function(_0xf726e6){if(_0xf726e6&&_0xf726e6['autoAssociation']===0x0){return db[_0xa202('0x2e')][_0xa202('0x4c')]({'name':_0x392d76[_0xa202('0x2d')],'resourceId':_0x392d76['id'],'type':_0xf726e6[_0xa202('0x2d')],'sectionId':_0xf726e6['id']},{})[_0xa202('0x24')](function(){return _0x72a8ca;});}else{return _0x72a8ca;}})[_0xa202('0x4b')](function(_0x3c731c){logger[_0xa202('0x2f')](_0xa202('0x54'),_0x3c731c);throw _0x3c731c;});}return _0x72a8ca;});}})[_0xa202('0x24')](respondWithResult(_0x1f3677,0xc9))[_0xa202('0x4b')](handleError(_0x1f3677,null));};exports[_0xa202('0x22')]=function(_0x2d588b,_0x16dc6a){if(_0x2d588b[_0xa202('0x4d')]['id']){delete _0x2d588b[_0xa202('0x4d')]['id'];}return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x2d588b['params']['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x16dc6a,null))[_0xa202('0x24')](saveUpdates(_0x2d588b[_0xa202('0x4d')],null))['then'](respondWithResult(_0x16dc6a,null))['catch'](handleError(_0x16dc6a,null));};exports[_0xa202('0x23')]=function(_0x28ea4c,_0x210ff2){return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x28ea4c[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x210ff2,null))[_0xa202('0x24')](removeEntity(_0x210ff2,null))[_0xa202('0x4b')](handleError(_0x210ff2,null));};exports[_0xa202('0x5a')]=function(_0x12b81e,_0x2c9936,_0x874371){var _0x268914={'raw':![],'where':{}};var _0x573bd8={};var _0x1ff0db={'count':0x0,'rows':[]};return db[_0xa202('0x31')]['findOne']({'where':{'id':_0x12b81e[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x2c9936,null))['then'](function(_0x4afce1){if(_0x4afce1){_0x573bd8[_0xa202('0x33')]=_[_0xa202('0x35')](db['CmHopper'][_0xa202('0x49')]);_0x573bd8[_0xa202('0x34')]=_['keys'](_0x12b81e['query']);_0x573bd8[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x573bd8['model'],_0x573bd8[_0xa202('0x34')]);_0x268914['attributes']=_[_0xa202('0x4a')](_0x573bd8['model'],qs['fields'](_0x12b81e['query'][_0xa202('0x38')]));_0x268914[_0xa202('0x37')]=_0x268914[_0xa202('0x37')]['length']?_0x268914[_0xa202('0x37')]:_0x573bd8[_0xa202('0x33')];if(!_0x12b81e[_0xa202('0x34')][_0xa202('0x3a')](_0xa202('0x3b'))){_0x268914[_0xa202('0x1c')]=qs['limit'](_0x12b81e[_0xa202('0x34')][_0xa202('0x1c')]);_0x268914[_0xa202('0x1b')]=qs[_0xa202('0x1b')](_0x12b81e[_0xa202('0x34')][_0xa202('0x1b')]);}_0x268914[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x12b81e['query']['sort']);_0x268914[_0xa202('0x3e')]=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x12b81e['query'],_0x573bd8[_0xa202('0x36')]));_0x268914[_0xa202('0x3e')]['VoiceQueueId']=_0x4afce1['id'];if(_0x12b81e[_0xa202('0x34')][_0xa202('0x40')]){_0x268914[_0xa202('0x3e')]=_['merge'](_0x268914[_0xa202('0x3e')],{'$or':_['map'](_0x268914['attributes'],function(_0x163dc7){var _0x5d4a2b={};_0x5d4a2b[_0x163dc7]={'$like':'%'+_0x12b81e[_0xa202('0x34')][_0xa202('0x40')]+'%'};return _0x5d4a2b;})});}_0x268914=_[_0xa202('0x42')]({},_0x268914,_0x12b81e['options']);return db[_0xa202('0x5b')]['count']({'where':_0x268914['where']})[_0xa202('0x24')](function(_0x3f8607){_0x1ff0db['count']=_0x3f8607;if(_0x12b81e[_0xa202('0x34')][_0xa202('0x43')]){_0x268914[_0xa202('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0xa202('0x45')](_0x268914);})[_0xa202('0x24')](function(_0x46b74d){_0x1ff0db[_0xa202('0x46')]=_0x46b74d;return _0x1ff0db;});}})[_0xa202('0x24')](respondWithFilteredResult(_0x2c9936,_0x268914))[_0xa202('0x4b')](handleError(_0x2c9936,null));};exports[_0xa202('0x5c')]=function(_0x446cdb,_0x5b1a30,_0x14a5db){var _0x57a47a={'raw':!![],'where':{}};var _0x5e9b75={};var _0x3c13c9={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x446cdb['params']['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x5b1a30,null))[_0xa202('0x24')](function(_0x406805){if(_0x406805){_0x5e9b75['model']=_[_0xa202('0x35')](db[_0xa202('0x5d')]['rawAttributes']);_0x5e9b75[_0xa202('0x34')]=_[_0xa202('0x35')](_0x446cdb['query']);_0x5e9b75[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x5e9b75['model'],_0x5e9b75['query']);_0x57a47a[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x5e9b75[_0xa202('0x33')],qs['fields'](_0x446cdb[_0xa202('0x34')][_0xa202('0x38')]));_0x57a47a['attributes']=_0x57a47a[_0xa202('0x37')][_0xa202('0x39')]?_0x57a47a[_0xa202('0x37')]:_0x5e9b75[_0xa202('0x33')];if(!_0x446cdb[_0xa202('0x34')][_0xa202('0x3a')]('nolimit')){_0x57a47a['limit']=qs[_0xa202('0x1c')](_0x446cdb[_0xa202('0x34')]['limit']);_0x57a47a['offset']=qs[_0xa202('0x1b')](_0x446cdb[_0xa202('0x34')][_0xa202('0x1b')]);}_0x57a47a[_0xa202('0x3c')]=qs['sort'](_0x446cdb[_0xa202('0x34')][_0xa202('0x3d')]);_0x57a47a[_0xa202('0x3e')]=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x446cdb[_0xa202('0x34')],_0x5e9b75[_0xa202('0x36')]));_0x57a47a[_0xa202('0x3e')]['VoiceQueueId']=_0x406805['id'];if(_0x446cdb['query'][_0xa202('0x40')]){_0x57a47a[_0xa202('0x3e')]=_['merge'](_0x57a47a['where'],{'$or':_['map'](_0x57a47a['attributes'],function(_0x312b7b){var _0x4fa0b3={};_0x4fa0b3[_0x312b7b]={'$like':'%'+_0x446cdb['query']['filter']+'%'};return _0x4fa0b3;})});}_0x57a47a=_[_0xa202('0x42')]({},_0x57a47a,_0x446cdb['options']);return db[_0xa202('0x5d')][_0xa202('0x1e')]({'where':_0x57a47a[_0xa202('0x3e')]})[_0xa202('0x24')](function(_0x2e4c31){_0x3c13c9[_0xa202('0x1e')]=_0x2e4c31;if(_0x446cdb[_0xa202('0x34')][_0xa202('0x43')]){_0x57a47a['include']=[{'all':!![]}];}return db[_0xa202('0x5d')][_0xa202('0x45')](_0x57a47a);})[_0xa202('0x24')](function(_0x2acf4b){_0x3c13c9[_0xa202('0x46')]=_0x2acf4b;return _0x3c13c9;});}})[_0xa202('0x24')](respondWithFilteredResult(_0x5b1a30,_0x57a47a))[_0xa202('0x4b')](handleError(_0x5b1a30,null));};exports[_0xa202('0x5e')]=function(_0x34e925,_0x30e8e2,_0x50eede){var _0x138203={'raw':!![],'where':{}};var _0x66b533={};var _0x3b7beb={'count':0x0,'rows':[]};return db[_0xa202('0x31')][_0xa202('0x5f')]({'where':{'id':_0x34e925[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x30e8e2,null))[_0xa202('0x24')](function(_0x14a022){if(_0x14a022){_0x66b533['model']=_[_0xa202('0x35')](db[_0xa202('0x60')]['rawAttributes']);_0x66b533['query']=_[_0xa202('0x35')](_0x34e925[_0xa202('0x34')]);_0x66b533[_0xa202('0x36')]=_['intersection'](_0x66b533['model'],_0x66b533[_0xa202('0x34')]);_0x138203[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x66b533[_0xa202('0x33')],qs['fields'](_0x34e925[_0xa202('0x34')][_0xa202('0x38')]));_0x138203[_0xa202('0x37')]=_0x138203[_0xa202('0x37')][_0xa202('0x39')]?_0x138203[_0xa202('0x37')]:_0x66b533[_0xa202('0x33')];if(!_0x34e925['query'][_0xa202('0x3a')](_0xa202('0x3b'))){_0x138203[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x34e925[_0xa202('0x34')][_0xa202('0x1c')]);_0x138203['offset']=qs[_0xa202('0x1b')](_0x34e925[_0xa202('0x34')][_0xa202('0x1b')]);}_0x138203[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x34e925['query'][_0xa202('0x3d')]);_0x138203[_0xa202('0x3e')]=qs[_0xa202('0x36')](_['pick'](_0x34e925[_0xa202('0x34')],_0x66b533['filters']));_0x138203['where']['VoiceQueueId']=_0x14a022['id'];if(_0x34e925[_0xa202('0x34')][_0xa202('0x40')]){_0x138203[_0xa202('0x3e')]=_[_0xa202('0x42')](_0x138203[_0xa202('0x3e')],{'$or':_[_0xa202('0x28')](_0x138203[_0xa202('0x37')],function(_0x49d70a){var _0x550e12={};_0x550e12[_0x49d70a]={'$like':'%'+_0x34e925[_0xa202('0x34')][_0xa202('0x40')]+'%'};return _0x550e12;})});}_0x138203=_[_0xa202('0x42')]({},_0x138203,_0x34e925[_0xa202('0x56')]);return db['CmHopperFinal'][_0xa202('0x1e')]({'where':_0x138203[_0xa202('0x3e')]})[_0xa202('0x24')](function(_0xca75e3){_0x3b7beb[_0xa202('0x1e')]=_0xca75e3;if(_0x34e925[_0xa202('0x34')][_0xa202('0x43')]){_0x138203['include']=[{'all':!![]}];}return db[_0xa202('0x60')][_0xa202('0x45')](_0x138203);})['then'](function(_0x2e202e){_0x3b7beb[_0xa202('0x46')]=_0x2e202e;return _0x3b7beb;});}})[_0xa202('0x24')](respondWithFilteredResult(_0x30e8e2,_0x138203))['catch'](handleError(_0x30e8e2,null));};exports[_0xa202('0x61')]=function(_0x17d530,_0x3fb37e,_0x4e368e){var _0x3221db={'raw':!![],'where':{}};var _0x1baf64={};var _0xe6afe9={'count':0x0,'rows':[]};return db[_0xa202('0x31')]['findOne']({'where':{'id':_0x17d530[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x3fb37e,null))[_0xa202('0x24')](function(_0x375558){if(_0x375558){_0x1baf64['model']=_['keys'](db['CmHopperBlack'][_0xa202('0x49')]);_0x1baf64[_0xa202('0x34')]=_[_0xa202('0x35')](_0x17d530[_0xa202('0x34')]);_0x1baf64[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x1baf64['model'],_0x1baf64[_0xa202('0x34')]);_0x3221db['attributes']=_[_0xa202('0x4a')](_0x1baf64[_0xa202('0x33')],qs['fields'](_0x17d530['query'][_0xa202('0x38')]));_0x3221db['attributes']=_0x3221db[_0xa202('0x37')]['length']?_0x3221db[_0xa202('0x37')]:_0x1baf64[_0xa202('0x33')];if(!_0x17d530['query'][_0xa202('0x3a')](_0xa202('0x3b'))){_0x3221db[_0xa202('0x1c')]=qs['limit'](_0x17d530[_0xa202('0x34')]['limit']);_0x3221db[_0xa202('0x1b')]=qs[_0xa202('0x1b')](_0x17d530['query'][_0xa202('0x1b')]);}_0x3221db['order']=qs[_0xa202('0x3d')](_0x17d530[_0xa202('0x34')][_0xa202('0x3d')]);_0x3221db[_0xa202('0x3e')]=qs['filters'](_[_0xa202('0x3f')](_0x17d530['query'],_0x1baf64[_0xa202('0x36')]));_0x3221db[_0xa202('0x3e')][_0xa202('0x62')]=_0x375558['id'];if(_0x17d530[_0xa202('0x34')]['filter']){_0x3221db[_0xa202('0x3e')]=_[_0xa202('0x42')](_0x3221db[_0xa202('0x3e')],{'$or':_[_0xa202('0x28')](_0x3221db[_0xa202('0x37')],function(_0x1541ef){var _0x2dd649={};_0x2dd649[_0x1541ef]={'$like':'%'+_0x17d530['query'][_0xa202('0x40')]+'%'};return _0x2dd649;})});}_0x3221db=_['merge']({},_0x3221db,_0x17d530[_0xa202('0x56')]);return db[_0xa202('0x63')][_0xa202('0x1e')]({'where':_0x3221db[_0xa202('0x3e')]})[_0xa202('0x24')](function(_0x4990fd){_0xe6afe9[_0xa202('0x1e')]=_0x4990fd;if(_0x17d530[_0xa202('0x34')][_0xa202('0x43')]){_0x3221db[_0xa202('0x44')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3221db);})[_0xa202('0x24')](function(_0x2bb5d9){_0xe6afe9[_0xa202('0x46')]=_0x2bb5d9;return _0xe6afe9;});}})[_0xa202('0x24')](respondWithFilteredResult(_0x3fb37e,_0x3221db))[_0xa202('0x4b')](handleError(_0x3fb37e,null));};exports[_0xa202('0x64')]=function(_0x160f24,_0x2e9e65,_0x3f2cc3){var _0x2d210d={};var _0x4f4b29={};var _0x12c9aa;var _0x540751;return db['VoiceQueue'][_0xa202('0x5f')]({'where':{'id':_0x160f24[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x2e9e65,null))['then'](function(_0x57f400){if(_0x57f400){_0x12c9aa=_0x57f400;_0x4f4b29['model']=_[_0xa202('0x35')](db[_0xa202('0x65')][_0xa202('0x49')]);_0x4f4b29[_0xa202('0x34')]=_[_0xa202('0x35')](_0x160f24[_0xa202('0x34')]);_0x4f4b29[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x4f4b29[_0xa202('0x33')],_0x4f4b29[_0xa202('0x34')]);_0x2d210d[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x4f4b29[_0xa202('0x33')],qs[_0xa202('0x38')](_0x160f24[_0xa202('0x34')][_0xa202('0x38')]));_0x2d210d['attributes']=_0x2d210d[_0xa202('0x37')][_0xa202('0x39')]?_0x2d210d[_0xa202('0x37')]:_0x4f4b29['model'];_0x2d210d[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x160f24[_0xa202('0x34')]['sort']);_0x2d210d[_0xa202('0x3e')]=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x160f24[_0xa202('0x34')],_0x4f4b29['filters']));if(_0x160f24[_0xa202('0x34')][_0xa202('0x40')]){_0x2d210d['where']=_[_0xa202('0x42')](_0x2d210d[_0xa202('0x3e')],{'$or':_[_0xa202('0x28')](_0x2d210d[_0xa202('0x37')],function(_0x2b4b8e){var _0x29d4ac={};_0x29d4ac[_0x2b4b8e]={'$like':'%'+_0x160f24[_0xa202('0x34')][_0xa202('0x40')]+'%'};return _0x29d4ac;})});}_0x2d210d=_[_0xa202('0x42')]({},_0x2d210d,_0x160f24[_0xa202('0x56')]);return _0x12c9aa['getTeams'](_0x2d210d);}})[_0xa202('0x24')](function(_0x4e1d37){if(_0x4e1d37){_0x540751=_0x4e1d37[_0xa202('0x39')];if(!_0x160f24[_0xa202('0x34')][_0xa202('0x3a')](_0xa202('0x3b'))){_0x2d210d[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x160f24[_0xa202('0x34')][_0xa202('0x1c')]);_0x2d210d[_0xa202('0x1b')]=qs['offset'](_0x160f24[_0xa202('0x34')]['offset']);}return _0x12c9aa[_0xa202('0x64')](_0x2d210d);}})[_0xa202('0x24')](function(_0x101ca4){if(_0x101ca4){return _0x101ca4?{'count':_0x540751,'rows':_0x101ca4}:null;}})[_0xa202('0x24')](respondWithResult(_0x2e9e65,null))[_0xa202('0x4b')](handleError(_0x2e9e65,null));};exports['addTeams']=function(_0x18e727,_0x5a6bcd,_0x4816a3){var _0x5b5ae1=_0x18e727['body']['teams'];var _0x32964e=_[_0xa202('0x28')](_0x5b5ae1,'id');return db[_0xa202('0x65')]['findAll']({'where':{'id':_0x32964e},'attributes':['id'],'include':[{'model':db[_0xa202('0x66')],'as':_0xa202('0x67'),'attributes':['id',_0xa202('0x2d'),'online',_0xa202('0x68'),_0xa202('0x69')],'raw':!![]}]})['then'](function(_0x44a6bd){if(_0x44a6bd){var _0x164006=_[_0xa202('0x6a')](_0x44a6bd,function(_0xad51){var _0x3ab106=_0xad51['get']({'plain':!![]});_0x3ab106['Agents'][_0xa202('0x6b')](function(_0x1a42a8){_0x1a42a8[_0xa202('0x6c')]=_[_0xa202('0x2c')](_0x5b5ae1,{'id':_0x3ab106['id']})[_0xa202('0x6c')];});return _0x3ab106[_0xa202('0x67')];});return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x18e727[_0xa202('0x48')]['id']}})['then'](function(_0x59dcb6){return db['sequelize']['transaction'](function(_0x1303ed){return _0x59dcb6[_0xa202('0x6d')](_0x32964e,{'transaction':_0x1303ed})[_0xa202('0x24')](function(){return BPromise[_0xa202('0x6e')](_0x5b5ae1,function(_0x149bd0){return db[_0xa202('0x6f')]['upsert']({'TeamId':_0x149bd0['id'],'VoiceQueueId':_0x18e727['params']['id'],'penalty':_0x149bd0['penalty']},{'transaction':_0x1303ed});});})[_0xa202('0x24')](function(){return BPromise['each'](_0x164006,function(_0x84ef1c){return db[_0xa202('0x70')]['findOrCreate']({'where':{'UserId':_0x84ef1c['id'],'VoiceQueueId':_0x18e727['params']['id']},'defaults':{'penalty':_0x84ef1c[_0xa202('0x6c')]},'transaction':_0x1303ed});});})['then'](function(){return BPromise[_0xa202('0x6e')](_[_0xa202('0x40')](_0x164006,{'online':!![]}),function(_0x2d6ddb){return db[_0xa202('0x71')][_0xa202('0x72')]({'membername':_0x2d6ddb[_0xa202('0x2d')],'UserId':_0x2d6ddb['id'],'queue_name':_0x59dcb6[_0xa202('0x2d')],'VoiceQueueId':_0x59dcb6['id'],'interface':_[_0xa202('0x73')](_0x2d6ddb[_0xa202('0x69')])?util[_0xa202('0x74')](_0xa202('0x75'),_0x2d6ddb[_0xa202('0x2d')]):_0x2d6ddb[_0xa202('0x69')],'paused':_0x2d6ddb[_0xa202('0x68')]||![],'penalty':_0x2d6ddb[_0xa202('0x6c')]},{'transaction':_0x1303ed});});})['then'](function(){_0x164006[_0xa202('0x6b')](function(_0x3067f8){socket[_0xa202('0x76')](_0xa202('0x77'),{'UserId':_0x3067f8['id'],'VoiceQueueId':_0x59dcb6['id']});});});});});}})[_0xa202('0x24')](respondWithStatusCode(_0x5a6bcd,null))['catch'](handleError(_0x5a6bcd,null));};exports['removeTeams']=function(_0x356064,_0x2a7854,_0x2c045a){return db[_0xa202('0x65')][_0xa202('0x45')]({'where':{'id':_0x356064[_0xa202('0x34')][_0xa202('0x78')]},'attributes':['id'],'include':[{'model':db[_0xa202('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa202('0x24')](handleEntityNotFound(_0x2a7854,null))[_0xa202('0x24')](function(_0x236cc1){var _0x4718dd=_[_0xa202('0x28')](_0x236cc1,'id');var _0x725d6=[];var _0x5985f5=[];var _0x4c25ed=squel['select']();_0x4c25ed[_0xa202('0x79')](_0xa202('0x7a'))[_0xa202('0x7b')](_0xa202('0x7c'),'tq')[_0xa202('0x7d')](_0xa202('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa202('0x7f'),_0x356064['params']['id']);for(var _0x1377b2=0x0;_0x1377b2<_0x236cc1[_0xa202('0x39')];_0x1377b2+=0x1){let _0x300f69=_0x236cc1[_0x1377b2];for(var _0x1c818e=0x0;_0x1c818e<_0x300f69[_0xa202('0x67')][_0xa202('0x39')];_0x1c818e+=0x1){let _0x2026b2=_0x300f69[_0xa202('0x67')][_0x1c818e];var _0x30793d=_0x4c25ed[_0xa202('0x55')]();_0x30793d['where']('ut.UserId\x20=\x20?',_0x2026b2['id']);_0x5985f5[_0xa202('0x80')](db['sequelize'][_0xa202('0x34')](_0x30793d['toString'](),{'type':db[_0xa202('0x81')][_0xa202('0x82')][_0xa202('0x83')]})['then'](function(_0x2dfa73){if(_0x2dfa73[_0xa202('0x39')]===0x1){return _0x2026b2['id'];}else{var _0x402d29=_[_0xa202('0x84')](_[_0xa202('0x28')](_0x2dfa73,_0xa202('0x85')),function(_0x67467){return _[_0xa202('0x2a')](_0x4718dd,_0x67467);});if(_0x402d29){return _0x2026b2['id'];}}}));}}return BPromise[_0xa202('0x86')](_0x5985f5)[_0xa202('0x24')](function(_0x2c8dfd){_0x725d6=_(_0x725d6)[_0xa202('0x87')](_0x2c8dfd)['compact']()[_0xa202('0x29')]();return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x356064[_0xa202('0x48')]['id']}})[_0xa202('0x24')](function(_0x3e9ae9){return db['sequelize'][_0xa202('0x88')](function(_0x3d3d18){return _0x3e9ae9['removeTeams'](_0x356064['query'][_0xa202('0x78')],{'transaction':_0x3d3d18})[_0xa202('0x24')](function(){if(!_[_0xa202('0x89')](_0x725d6)){return _0x3e9ae9['removeAgents'](_0x725d6,{'transaction':_0x3d3d18})[_0xa202('0x24')](function(){return db[_0xa202('0x71')]['destroy']({'where':{'VoiceQueueId':_0x356064[_0xa202('0x48')]['id'],'UserId':_0x725d6},'transaction':_0x3d3d18});});}})[_0xa202('0x24')](function(){_0x725d6['forEach'](function(_0x180982){socket[_0xa202('0x76')](_0xa202('0x8a'),{'UserId':_0x180982,'VoiceQueueId':_0x3e9ae9['id']});});});});});});})[_0xa202('0x24')](respondWithStatusCode(_0x2a7854,null))[_0xa202('0x4b')](handleError(_0x2a7854,null));};exports[_0xa202('0x8b')]=function(_0x272f88,_0x5e2bed,_0x1d8550){var _0x468fa6,_0x4c8623;return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x272f88[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x5e2bed,null))[_0xa202('0x24')](function(_0x2eab60){if(_0x2eab60){_0x4c8623=_0x2eab60;return _0x2eab60[_0xa202('0x8b')](_0x272f88[_0xa202('0x4d')][_0xa202('0x78')],_[_0xa202('0x57')](_0x272f88['body'],[_0xa202('0x78'),'id'])||{})[_0xa202('0x8c')](function(_0x4875ef){for(var _0x5559b6=0x0;_0x5559b6<_0x272f88['body'][_0xa202('0x78')][_0xa202('0x39')];_0x5559b6+=0x1){socket[_0xa202('0x76')](_0xa202('0x77'),{'UserId':Number(_0x272f88[_0xa202('0x4d')][_0xa202('0x78')][_0x5559b6]),'VoiceQueueId':Number(_0x272f88[_0xa202('0x48')]['id'])});}return _0x4875ef;});}})[_0xa202('0x24')](function(_0x1e8ba5){_0x468fa6=_0x1e8ba5||[];if(_0x4c8623){return db[_0xa202('0x66')][_0xa202('0x45')]({'where':{'id':_0x272f88[_0xa202('0x4d')]['ids']},'attributes':['id',_0xa202('0x2d'),_0xa202('0x8d'),_0xa202('0x68'),_0xa202('0x69')],'raw':!![]});}})[_0xa202('0x24')](function(_0x4a95b4){if(!_[_0xa202('0x89')](_0x4a95b4)){var _0x37b8a0=[];for(var _0xf54860=0x0;_0xf54860<_0x4a95b4[_0xa202('0x39')];_0xf54860++){if(_0x4a95b4[_0xf54860]['online']){_0x37b8a0[_0xa202('0x80')](db[_0xa202('0x71')][_0xa202('0x72')]({'membername':_0x4a95b4[_0xf54860]['name'],'UserId':_0x4a95b4[_0xf54860]['id'],'queue_name':_0x4c8623[_0xa202('0x2d')],'VoiceQueueId':_0x4c8623['id'],'interface':_[_0xa202('0x73')](_0x4a95b4[_0xf54860][_0xa202('0x69')])?util[_0xa202('0x74')]('SIP/%s',_0x4a95b4[_0xf54860][_0xa202('0x2d')]):_0x4a95b4[_0xf54860][_0xa202('0x69')],'paused':_0x4a95b4[_0xf54860][_0xa202('0x68')]||![],'penalty':_0x272f88[_0xa202('0x4d')][_0xa202('0x6c')]||0x0}));}}return BPromise[_0xa202('0x86')](_0x37b8a0);}})[_0xa202('0x24')](function(){return _0x468fa6;})['then'](respondWithResult(_0x5e2bed,null))['catch'](handleError(_0x5e2bed,null));};exports['removeAgents']=function(_0x5cdd35,_0xd9fb01,_0x313c5b){return db[_0xa202('0x31')]['find']({'where':{'id':_0x5cdd35['params']['id']}})[_0xa202('0x24')](handleEntityNotFound(_0xd9fb01,null))['then'](function(_0x28c3e4){if(_0x28c3e4){return _0x28c3e4[_0xa202('0x8e')](_0x5cdd35[_0xa202('0x34')][_0xa202('0x78')])[_0xa202('0x24')](function(){if(_[_0xa202('0x8f')](_0x5cdd35[_0xa202('0x34')]['ids'])){for(var _0x50b428=0x0;_0x50b428<_0x5cdd35[_0xa202('0x34')][_0xa202('0x78')][_0xa202('0x39')];_0x50b428+=0x1){socket[_0xa202('0x76')](_0xa202('0x8a'),{'UserId':Number(_0x5cdd35['query'][_0xa202('0x78')][_0x50b428]),'VoiceQueueId':Number(_0x5cdd35[_0xa202('0x48')]['id'])});}}else{socket['emit'](_0xa202('0x8a'),{'UserId':Number(_0x5cdd35['query'][_0xa202('0x78')]),'VoiceQueueId':Number(_0x5cdd35['params']['id'])});}});}})[_0xa202('0x24')](function(_0x57a870){return db[_0xa202('0x71')]['destroy']({'where':{'VoiceQueueId':_0x5cdd35[_0xa202('0x48')]['id'],'UserId':_0x5cdd35['query'][_0xa202('0x78')]}})[_0xa202('0x24')](function(){return _0x57a870;});})[_0xa202('0x24')](respondWithStatusCode(_0xd9fb01,null))['catch'](handleError(_0xd9fb01,null));};exports[_0xa202('0x90')]=function(_0x43ae59,_0xa3334e,_0x5d7885){var _0x21948e={};var _0x5d8d05={};var _0x1ca174;var _0x673333;return db['VoiceQueue'][_0xa202('0x5f')]({'where':{'id':_0x43ae59[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0xa3334e,null))['then'](function(_0x424842){if(_0x424842){_0x1ca174=_0x424842;_0x5d8d05[_0xa202('0x33')]=_['keys'](db[_0xa202('0x66')][_0xa202('0x49')]);_0x5d8d05[_0xa202('0x34')]=_[_0xa202('0x35')](_0x43ae59[_0xa202('0x34')]);_0x5d8d05[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x5d8d05[_0xa202('0x33')],_0x5d8d05[_0xa202('0x34')]);_0x21948e[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x5d8d05[_0xa202('0x33')],qs[_0xa202('0x38')](_0x43ae59['query'][_0xa202('0x38')]));_0x21948e[_0xa202('0x37')]=_0x21948e[_0xa202('0x37')][_0xa202('0x39')]?_0x21948e[_0xa202('0x37')]:_0x5d8d05[_0xa202('0x33')];_0x21948e[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x43ae59[_0xa202('0x34')][_0xa202('0x3d')]);_0x21948e['where']=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x43ae59[_0xa202('0x34')],_0x5d8d05['filters']));if(_0x43ae59[_0xa202('0x34')][_0xa202('0x40')]){_0x21948e[_0xa202('0x3e')]=_[_0xa202('0x42')](_0x21948e[_0xa202('0x3e')],{'$or':_[_0xa202('0x28')](_0x21948e[_0xa202('0x37')],function(_0x32327f){var _0x3f8e12={};_0x3f8e12[_0x32327f]={'$like':'%'+_0x43ae59['query']['filter']+'%'};return _0x3f8e12;})});}_0x21948e=_[_0xa202('0x42')]({},_0x21948e,_0x43ae59[_0xa202('0x56')]);return _0x1ca174['getAgents'](_0x21948e);}})[_0xa202('0x24')](function(_0x185b19){if(_0x185b19){_0x673333=_0x185b19[_0xa202('0x39')];if(!_0x43ae59[_0xa202('0x34')]['hasOwnProperty'](_0xa202('0x3b'))){_0x21948e['limit']=qs[_0xa202('0x1c')](_0x43ae59[_0xa202('0x34')][_0xa202('0x1c')]);_0x21948e[_0xa202('0x1b')]=qs[_0xa202('0x1b')](_0x43ae59[_0xa202('0x34')][_0xa202('0x1b')]);}return _0x1ca174[_0xa202('0x90')](_0x21948e);}})[_0xa202('0x24')](function(_0x537ed3){if(_0x537ed3){return _0x537ed3?{'count':_0x673333,'rows':_0x537ed3}:null;}})[_0xa202('0x24')](respondWithResult(_0xa3334e,null))['catch'](handleError(_0xa3334e,null));};exports[_0xa202('0x91')]=function(_0x3ea975,_0x1ddb33,_0x1dee3b){var _0x497e78={};var _0x34cf1e={};var _0x223d52;var _0x3b9d14;return db[_0xa202('0x31')][_0xa202('0x5f')]({'where':{'id':_0x3ea975[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x1ddb33,null))[_0xa202('0x24')](function(_0x32781c){if(_0x32781c){_0x223d52=_0x32781c;_0x34cf1e[_0xa202('0x33')]=_[_0xa202('0x35')](db[_0xa202('0x71')][_0xa202('0x49')]);_0x34cf1e[_0xa202('0x34')]=_[_0xa202('0x35')](_0x3ea975[_0xa202('0x34')]);_0x34cf1e[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x34cf1e[_0xa202('0x33')],_0x34cf1e[_0xa202('0x34')]);_0x497e78[_0xa202('0x37')]=_['intersection'](_0x34cf1e['model'],qs[_0xa202('0x38')](_0x3ea975[_0xa202('0x34')][_0xa202('0x38')]));_0x497e78[_0xa202('0x37')]=_0x497e78['attributes'][_0xa202('0x39')]?_0x497e78[_0xa202('0x37')]:_0x34cf1e[_0xa202('0x33')];_0x497e78[_0xa202('0x3c')]=qs['sort'](_0x3ea975['query'][_0xa202('0x3d')]);_0x497e78[_0xa202('0x3e')]=qs['filters'](_[_0xa202('0x3f')](_0x3ea975['query'],_0x34cf1e[_0xa202('0x36')]));if(_0x3ea975[_0xa202('0x34')][_0xa202('0x40')]){_0x497e78[_0xa202('0x3e')]=_[_0xa202('0x42')](_0x497e78[_0xa202('0x3e')],{'$or':_['map'](_0x497e78[_0xa202('0x37')],function(_0x2982ab){var _0x531e48={};_0x531e48[_0x2982ab]={'$like':'%'+_0x3ea975[_0xa202('0x34')][_0xa202('0x40')]+'%'};return _0x531e48;})});}_0x497e78=_[_0xa202('0x42')]({},_0x497e78,_0x3ea975[_0xa202('0x56')]);return _0x223d52['getMembers'](_0x497e78);}})[_0xa202('0x24')](function(_0x4abfdc){if(_0x4abfdc){_0x3b9d14=_0x4abfdc[_0xa202('0x39')];if(!_0x3ea975[_0xa202('0x34')][_0xa202('0x3a')](_0xa202('0x3b'))){_0x497e78[_0xa202('0x1c')]=qs['limit'](_0x3ea975[_0xa202('0x34')]['limit']);_0x497e78[_0xa202('0x1b')]=qs[_0xa202('0x1b')](_0x3ea975[_0xa202('0x34')][_0xa202('0x1b')]);}return _0x223d52[_0xa202('0x91')](_0x497e78);}})[_0xa202('0x24')](function(_0x15a69c){return _0x15a69c?{'count':_0x3b9d14,'rows':_0x15a69c}:null;})[_0xa202('0x24')](respondWithResult(_0x1ddb33,null))['catch'](handleError(_0x1ddb33,null));};exports['getLists']=function(_0x5d9295,_0x377db2,_0x3d98c6){var _0x756410={};var _0x123cd2={};var _0x1f39d7;var _0x53b77d;return db[_0xa202('0x31')][_0xa202('0x5f')]({'where':{'id':_0x5d9295[_0xa202('0x48')]['id']}})['then'](handleEntityNotFound(_0x377db2,null))[_0xa202('0x24')](function(_0xd0286){if(_0xd0286){_0x1f39d7=_0xd0286;_0x123cd2[_0xa202('0x33')]=_[_0xa202('0x35')](db[_0xa202('0x92')]['rawAttributes']);_0x123cd2[_0xa202('0x34')]=_[_0xa202('0x35')](_0x5d9295[_0xa202('0x34')]);_0x123cd2['filters']=_['intersection'](_0x123cd2['model'],_0x123cd2[_0xa202('0x34')]);_0x756410[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x123cd2['model'],qs['fields'](_0x5d9295[_0xa202('0x34')]['fields']));_0x756410[_0xa202('0x37')]=_0x756410[_0xa202('0x37')][_0xa202('0x39')]?_0x756410[_0xa202('0x37')]:_0x123cd2['model'];_0x756410[_0xa202('0x3c')]=qs[_0xa202('0x3d')](_0x5d9295['query']['sort']);_0x756410[_0xa202('0x3e')]=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x5d9295[_0xa202('0x34')],_0x123cd2['filters']));if(_0x5d9295[_0xa202('0x34')]['filter']){_0x756410['where']=_[_0xa202('0x42')](_0x756410[_0xa202('0x3e')],{'$or':_[_0xa202('0x28')](_0x756410[_0xa202('0x37')],function(_0x5a6b30){var _0x41ab94={};_0x41ab94[_0x5a6b30]={'$like':'%'+_0x5d9295[_0xa202('0x34')]['filter']+'%'};return _0x41ab94;})});}_0x756410=_[_0xa202('0x42')]({},_0x756410,_0x5d9295['options']);return _0x1f39d7[_0xa202('0x93')](_0x756410);}})[_0xa202('0x24')](function(_0xf81e3a){if(_0xf81e3a){_0x53b77d=_0xf81e3a[_0xa202('0x39')];if(!_0x5d9295[_0xa202('0x34')][_0xa202('0x3a')](_0xa202('0x3b'))){_0x756410[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x5d9295[_0xa202('0x34')][_0xa202('0x1c')]);_0x756410[_0xa202('0x1b')]=qs[_0xa202('0x1b')](_0x5d9295[_0xa202('0x34')][_0xa202('0x1b')]);}return _0x1f39d7[_0xa202('0x93')](_0x756410);}})[_0xa202('0x24')](function(_0x4bbebc){if(_0x4bbebc){return _0x4bbebc?{'count':_0x53b77d,'rows':_0x4bbebc}:null;}})[_0xa202('0x24')](respondWithResult(_0x377db2,null))[_0xa202('0x4b')](handleError(_0x377db2,null));};exports[_0xa202('0x94')]=function(_0x3d9e07,_0x58fb36,_0xf08e62){var _0x125849=moment()[_0xa202('0x74')](_0xa202('0x95'));var _0xb6d500,_0x3eaabe;return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x3d9e07[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x58fb36,null))['then'](function(_0x3243ad){if(_0x3243ad){_0x3eaabe=_0x3243ad;return _0x3243ad['addLists'](_0x3d9e07['body']['ids'],_[_0xa202('0x57')](_0x3d9e07[_0xa202('0x4d')],['ids','id'])||{});}return null;})[_0xa202('0x8c')](function(_0x4d3a62){var _0xff1ced;_0xb6d500=_0x4d3a62||[];var _0x1ac3b0=[];if(_0x4d3a62){for(var _0x22bb3b=0x0;_0x22bb3b<_0x4d3a62[_0xa202('0x39')];_0x22bb3b+=0x1){var _0x4a403d=_0x4d3a62[_0x22bb3b][_0xa202('0x4e')]({'plain':!![]});_0x3eaabe[_0xa202('0x96')]=_0x3d9e07[_0xa202('0x4d')]['dialCheckDuplicateType']?_0x3d9e07['body']['dialCheckDuplicateType']:_0x3eaabe[_0xa202('0x96')];switch(_0x3eaabe['dialCheckDuplicateType']){case _0xa202('0x97'):_0xff1ced=squel[_0xa202('0x98')]()[_0xa202('0x99')]('cm_hopper')['fromQuery']([_0xa202('0x9a'),_0xa202('0x9b'),'ContactId','ListId',_0xa202('0x62'),_0xa202('0x9c'),_0xa202('0x58')],squel[_0xa202('0x9d')]()[_0xa202('0x79')](_0xa202('0x9a'),'phone')['field']('\x27'+_0x125849+'\x27',_0xa202('0x9b'))['field']('id','ContactId')[_0xa202('0x79')](_0x4a403d[_0xa202('0x9e')]['toString'](),_0xa202('0x9f'))['field'](_0x3d9e07[_0xa202('0x48')]['id'][_0xa202('0xa0')](),_0xa202('0x62'))[_0xa202('0x79')]('\x27'+_0x125849+'\x27',_0xa202('0x9c'))['field']('\x27'+_0x125849+'\x27',_0xa202('0x58'))[_0xa202('0x7b')](_0xa202('0xa1'))[_0xa202('0x3e')](_0xa202('0xa2'))['where'](_0xa202('0xa3'),_0x4a403d[_0xa202('0x9e')][_0xa202('0xa0')]())[_0xa202('0x3e')](_0xa202('0xa4'))[_0xa202('0x3e')](_0xa202('0xa5'),squel[_0xa202('0x9d')]()['field'](_0xa202('0xa6'))['from'](_0xa202('0xa7'))[_0xa202('0x3e')](_0xa202('0x7f'),_0x3d9e07[_0xa202('0x48')]['id'][_0xa202('0xa0')]()))[_0xa202('0x3e')](_0xa202('0xa5'),squel[_0xa202('0x9d')]()[_0xa202('0x79')](_0xa202('0xa8'))['from']('cm_hopper')[_0xa202('0x3e')]('VoiceQueueId\x20=\x20?',_0x3d9e07[_0xa202('0x48')]['id'][_0xa202('0xa0')]())))['toString']();break;case _0xa202('0xa9'):_0xff1ced=squel[_0xa202('0x98')]()[_0xa202('0x99')](_0xa202('0xaa'))['fromQuery'](['phone',_0xa202('0x9b'),_0xa202('0xab'),_0xa202('0x9f'),_0xa202('0x62'),_0xa202('0x9c'),_0xa202('0x58')],squel['select']()[_0xa202('0x79')](_0xa202('0x9a'),_0xa202('0x9a'))[_0xa202('0x79')]('\x27'+_0x125849+'\x27',_0xa202('0x9b'))[_0xa202('0x79')]('id',_0xa202('0xab'))[_0xa202('0x79')](_0x4a403d[_0xa202('0x9e')][_0xa202('0xa0')](),_0xa202('0x9f'))['field'](_0x3d9e07['params']['id'][_0xa202('0xa0')](),'VoiceQueueId')[_0xa202('0x79')]('\x27'+_0x125849+'\x27',_0xa202('0x9c'))['field']('\x27'+_0x125849+'\x27','updatedAt')[_0xa202('0x7b')]('cm_contacts')[_0xa202('0x3e')](_0xa202('0xa2'))[_0xa202('0x3e')]('ListId\x20=\x20?',_0x4a403d[_0xa202('0x9e')][_0xa202('0xa0')]())[_0xa202('0x3e')](_0xa202('0xa4'))[_0xa202('0x3e')](_0xa202('0xa5'),squel['select']()[_0xa202('0x79')]('COALESCE(phone,\x27\x27)')[_0xa202('0x7b')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x3d9e07[_0xa202('0x48')]['id'][_0xa202('0xa0')]())))['toString']();break;default:_0xff1ced=squel[_0xa202('0x98')]()['into'](_0xa202('0xaa'))[_0xa202('0xac')](['phone',_0xa202('0x9b'),_0xa202('0xab'),_0xa202('0x9f'),_0xa202('0x62'),'createdAt',_0xa202('0x58')],squel[_0xa202('0x9d')]()[_0xa202('0x79')]('phone',_0xa202('0x9a'))[_0xa202('0x79')]('\x27'+_0x125849+'\x27','scheduledAt')['field']('id',_0xa202('0xab'))['field'](_0x4a403d[_0xa202('0x9e')][_0xa202('0xa0')](),_0xa202('0x9f'))[_0xa202('0x79')](_0x3d9e07['params']['id'][_0xa202('0xa0')](),_0xa202('0x62'))[_0xa202('0x79')]('\x27'+_0x125849+'\x27','createdAt')[_0xa202('0x79')]('\x27'+_0x125849+'\x27',_0xa202('0x58'))['from']('cm_contacts')[_0xa202('0x3e')](_0xa202('0xa2'))[_0xa202('0x3e')](_0xa202('0xa3'),_0x4a403d['CmListId'][_0xa202('0xa0')]())['where'](_0xa202('0xa4')))['toString']();}_0x1ac3b0[_0xa202('0x80')](db[_0xa202('0x81')]['query'](_0xff1ced));}return BPromise[_0xa202('0x86')](_0x1ac3b0);}})[_0xa202('0x24')](function(){var _0x46ea78=[];var _0x28cf63=squel[_0xa202('0x98')]()[_0xa202('0x99')](_0xa202('0xad'))['fromQuery']([_0xa202('0xae'),_0xa202('0x9a'),'OrderBy','createdAt','updatedAt'],squel[_0xa202('0x9d')]()['field'](_0xa202('0xaf'))[_0xa202('0x79')](_0xa202('0xb0'))['field'](_0xa202('0xb1'))['field']('\x27'+_0x125849+'\x27',_0xa202('0x9c'))[_0xa202('0x79')]('\x27'+_0x125849+'\x27',_0xa202('0x58'))[_0xa202('0x7b')](_0xa202('0xb2'),'ci')[_0xa202('0x7d')](_0xa202('0xaa'),'h',_0xa202('0xb3'))[_0xa202('0x3e')]('h.scheduledat=?',_0x125849)[_0xa202('0x3e')](_0xa202('0xb4'),_0xa202('0xb5')))['toString']();_0x46ea78[_0xa202('0x80')](db[_0xa202('0x81')][_0xa202('0x34')](_0x28cf63));return BPromise[_0xa202('0x86')](_0x46ea78);})['then'](function(){return _0xb6d500;})['then'](respondWithResult(_0x58fb36,null))[_0xa202('0x4b')](handleError(_0x58fb36,null));};exports[_0xa202('0xb6')]=function(_0x550df2,_0x248e45,_0x3354dd){return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x550df2['params']['id']}})['then'](handleEntityNotFound(_0x248e45,null))[_0xa202('0x24')](function(_0x741343){if(_0x741343){return _0x741343[_0xa202('0xb6')](_0x550df2['query'][_0xa202('0x78')]);}})[_0xa202('0x24')](function(_0x254ad9){if(_0x254ad9){return db[_0xa202('0x5b')][_0xa202('0x23')]({'where':{'ListId':_0x550df2[_0xa202('0x34')][_0xa202('0x78')],'VoiceQueueId':_0x550df2['params']['id']}})[_0xa202('0x24')](function(){return _0x254ad9;});}})['then'](respondWithStatusCode(_0x248e45,null))['catch'](handleError(_0x248e45,null));};exports[_0xa202('0xb7')]=function(_0x183df4,_0x29b1ce,_0x4b151d){var _0x1d0bc9={};var _0x37934d={};var _0x519179;var _0x406aed;return db[_0xa202('0x31')]['findOne']({'where':{'id':_0x183df4[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x29b1ce,null))['then'](function(_0x142aab){if(_0x142aab){_0x519179=_0x142aab;_0x37934d[_0xa202('0x33')]=_[_0xa202('0x35')](db['CmList'][_0xa202('0x49')]);_0x37934d['query']=_[_0xa202('0x35')](_0x183df4[_0xa202('0x34')]);_0x37934d[_0xa202('0x36')]=_[_0xa202('0x4a')](_0x37934d[_0xa202('0x33')],_0x37934d[_0xa202('0x34')]);_0x1d0bc9[_0xa202('0x37')]=_[_0xa202('0x4a')](_0x37934d[_0xa202('0x33')],qs[_0xa202('0x38')](_0x183df4['query'][_0xa202('0x38')]));_0x1d0bc9['attributes']=_0x1d0bc9[_0xa202('0x37')][_0xa202('0x39')]?_0x1d0bc9[_0xa202('0x37')]:_0x37934d[_0xa202('0x33')];_0x1d0bc9[_0xa202('0x3c')]=qs['sort'](_0x183df4[_0xa202('0x34')][_0xa202('0x3d')]);_0x1d0bc9['where']=qs[_0xa202('0x36')](_[_0xa202('0x3f')](_0x183df4['query'],_0x37934d[_0xa202('0x36')]));if(_0x183df4[_0xa202('0x34')][_0xa202('0x40')]){_0x1d0bc9[_0xa202('0x3e')]=_[_0xa202('0x42')](_0x1d0bc9['where'],{'$or':_[_0xa202('0x28')](_0x1d0bc9[_0xa202('0x37')],function(_0x4b13be){var _0x5be091={};_0x5be091[_0x4b13be]={'$like':'%'+_0x183df4['query'][_0xa202('0x40')]+'%'};return _0x5be091;})});}_0x1d0bc9=_[_0xa202('0x42')]({},_0x1d0bc9,_0x183df4['options']);return _0x519179['getBlackLists'](_0x1d0bc9);}})[_0xa202('0x24')](function(_0x1f601b){if(_0x1f601b){_0x406aed=_0x1f601b[_0xa202('0x39')];if(!_0x183df4['query'][_0xa202('0x3a')](_0xa202('0x3b'))){_0x1d0bc9[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x183df4['query'][_0xa202('0x1c')]);_0x1d0bc9['offset']=qs[_0xa202('0x1b')](_0x183df4[_0xa202('0x34')][_0xa202('0x1b')]);}return _0x519179[_0xa202('0xb7')](_0x1d0bc9);}})['then'](function(_0x57e7c3){if(_0x57e7c3){return _0x57e7c3?{'count':_0x406aed,'rows':_0x57e7c3}:null;}})[_0xa202('0x24')](respondWithResult(_0x29b1ce,null))[_0xa202('0x4b')](handleError(_0x29b1ce,null));};exports[_0xa202('0xb8')]=function(_0x12a6a2,_0x1a50d9,_0x59aa6e){var _0x5a7816,_0x1450a3;return db['VoiceQueue'][_0xa202('0x2c')]({'where':{'id':_0x12a6a2[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x1a50d9,null))[_0xa202('0x24')](function(_0x2cc6a){if(_0x2cc6a){_0x1450a3=_0x2cc6a;return _0x2cc6a[_0xa202('0xb8')](_0x12a6a2[_0xa202('0x4d')][_0xa202('0x78')],_[_0xa202('0x57')](_0x12a6a2[_0xa202('0x4d')],[_0xa202('0x78'),'id'])||{});}return null;})['spread'](function(_0x2b8202){var _0x3148ef;_0x5a7816=_0x2b8202||[];var _0x653cdf=[];if(_0x2b8202){for(var _0x3930db=0x0;_0x3930db<_0x2b8202[_0xa202('0x39')];_0x3930db+=0x1){var _0x41b827=_0x2b8202[_0x3930db]['get']({'plain':!![]});_0x3148ef=squel['insert']()[_0xa202('0x99')](_0xa202('0xb9'))['fromQuery']([_0xa202('0x9a'),_0xa202('0xab'),_0xa202('0x9f'),'VoiceQueueId',_0xa202('0x9c'),_0xa202('0x58')],squel[_0xa202('0x9d')]()[_0xa202('0x79')](_0xa202('0x9a'),_0xa202('0x9a'))['field']('id',_0xa202('0xab'))['field'](_0x41b827['CmListId'][_0xa202('0xa0')](),'ListId')[_0xa202('0x79')](_0x12a6a2['params']['id']['toString'](),_0xa202('0x62'))[_0xa202('0x79')](_0xa202('0xba'),_0xa202('0x9c'))[_0xa202('0x79')](_0xa202('0xba'),'updatedAt')[_0xa202('0x7b')]('cm_contacts')['where'](_0xa202('0xa2'))[_0xa202('0x3e')](_0xa202('0xa3'),_0x41b827[_0xa202('0x9e')][_0xa202('0xa0')]())[_0xa202('0x3e')](_0xa202('0xa4')))['toString']();_0x653cdf[_0xa202('0x80')](db['sequelize'][_0xa202('0x34')](_0x3148ef));}return BPromise[_0xa202('0x86')](_0x653cdf);}})[_0xa202('0x24')](function(){return _0x5a7816;})[_0xa202('0x24')](respondWithResult(_0x1a50d9,null))[_0xa202('0x4b')](handleError(_0x1a50d9,null));};exports[_0xa202('0xbb')]=function(_0x4e1f0f,_0x2ac59f,_0x47add5){return db[_0xa202('0x31')][_0xa202('0x2c')]({'where':{'id':_0x4e1f0f[_0xa202('0x48')]['id']}})[_0xa202('0x24')](handleEntityNotFound(_0x2ac59f,null))['then'](function(_0x26eed6){if(_0x26eed6){return _0x26eed6[_0xa202('0xbb')](_0x4e1f0f['query'][_0xa202('0x78')]);}})[_0xa202('0x24')](function(_0x7989ea){if(_0x7989ea){return db[_0xa202('0x63')]['destroy']({'where':{'ListId':_0x4e1f0f[_0xa202('0x34')][_0xa202('0x78')],'VoiceQueueId':_0x4e1f0f[_0xa202('0x48')]['id']}})[_0xa202('0x24')](function(){return _0x7989ea;});}})[_0xa202('0x24')](respondWithStatusCode(_0x2ac59f,null))[_0xa202('0x4b')](handleError(_0x2ac59f,null));}; \ No newline at end of file +var _0xc1fa=['model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','userProfileId','getHoppers','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','forEach','penalty','transaction','each','upsert','findOrCreate','isNil','format','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','spread','voicePause','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ListId','scheduledAt','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','value','includes','find','type','name','UserProfileResource','end','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','key'];(function(_0x1efa26,_0x2a2295){var _0x4bdc5f=function(_0x155bee){while(--_0x155bee){_0x1efa26['push'](_0x1efa26['shift']());}};_0x4bdc5f(++_0x2a2295);}(_0xc1fa,0x83));var _0xac1f=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xc1fa[_0x39f34f];return _0x59fee1;};'use strict';var emlformat=require(_0xac1f('0x0'));var rimraf=require(_0xac1f('0x1'));var zipdir=require(_0xac1f('0x2'));var jsonpatch=require(_0xac1f('0x3'));var rp=require(_0xac1f('0x4'));var moment=require(_0xac1f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xac1f('0x6'));var util=require(_0xac1f('0x7'));var path=require(_0xac1f('0x8'));var sox=require(_0xac1f('0x9'));var csv=require(_0xac1f('0xa'));var ejs=require(_0xac1f('0xb'));var fs=require('fs');var fs_extra=require(_0xac1f('0xc'));var _=require(_0xac1f('0xd'));var squel=require(_0xac1f('0xe'));var crypto=require(_0xac1f('0xf'));var jsforce=require(_0xac1f('0x10'));var deskjs=require(_0xac1f('0x11'));var toCsv=require('to-csv');var querystring=require(_0xac1f('0x12'));var Papa=require(_0xac1f('0x13'));var Redis=require(_0xac1f('0x14'));var authService=require(_0xac1f('0x15'));var qs=require(_0xac1f('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xac1f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xac1f('0x18'));var licenseUtil=require(_0xac1f('0x19'));var db=require('../../mysqldb')['db'];config[_0xac1f('0x1a')]=_[_0xac1f('0x1b')](config[_0xac1f('0x1a')],{'host':_0xac1f('0x1c'),'port':0x18eb});var socket=require(_0xac1f('0x1d'))(new Redis(config[_0xac1f('0x1a')]));require(_0xac1f('0x1e'))[_0xac1f('0x1f')](socket);function respondWithStatusCode(_0x2c7411,_0x1ab6dc){_0x1ab6dc=_0x1ab6dc||0xcc;return function(_0x38bb3a){if(_0x38bb3a){return _0x2c7411[_0xac1f('0x20')](_0x1ab6dc);}return _0x2c7411[_0xac1f('0x21')](_0x1ab6dc)['end']();};}function respondWithResult(_0xeeff2e,_0x1c7610){_0x1c7610=_0x1c7610||0xc8;return function(_0x6f5a10){if(_0x6f5a10){return _0xeeff2e['status'](_0x1c7610)[_0xac1f('0x22')](_0x6f5a10);}};}function respondWithFilteredResult(_0x5c7847,_0xb825f3){return function(_0x1c5e74){if(_0x1c5e74){var _0x120b4e=typeof _0xb825f3[_0xac1f('0x23')]==='undefined'&&typeof _0xb825f3[_0xac1f('0x24')]===_0xac1f('0x25');var _0x558519=_0x1c5e74[_0xac1f('0x26')];var _0x4b5c14=_0x120b4e?0x0:_0xb825f3[_0xac1f('0x23')];var _0x3ce2fa=_0x120b4e?_0x1c5e74[_0xac1f('0x26')]:_0xb825f3[_0xac1f('0x23')]+_0xb825f3[_0xac1f('0x24')];var _0x1d1158;if(_0x3ce2fa>=_0x558519){_0x3ce2fa=_0x558519;_0x1d1158=0xc8;}else{_0x1d1158=0xce;}_0x5c7847[_0xac1f('0x21')](_0x1d1158);return _0x5c7847[_0xac1f('0x27')]('Content-Range',_0x4b5c14+'-'+_0x3ce2fa+'/'+_0x558519)['json'](_0x1c5e74);}return null;};}function patchUpdates(_0x3a773a){return function(_0x3a56ff){try{jsonpatch[_0xac1f('0x28')](_0x3a56ff,_0x3a773a,!![]);}catch(_0x4107dd){return BPromise[_0xac1f('0x29')](_0x4107dd);}return _0x3a56ff[_0xac1f('0x2a')]();};}function saveUpdates(_0x3a991f,_0x494021){return function(_0x46048f){if(_0x46048f){return _0x46048f[_0xac1f('0x2b')](_0x3a991f)[_0xac1f('0x2c')](function(_0x5b69ce){return _0x5b69ce;});}return null;};}function removeEntity(_0x479293,_0x25f1fd){return function(_0x3dab27){if(_0x3dab27){return _0x3dab27[_0xac1f('0x2d')]()[_0xac1f('0x2c')](function(){var _0x1f1472=_0x3dab27[_0xac1f('0x2e')]({'plain':!![]});var _0x381046=[{'name':_0xac1f('0x2f'),'value':_0xac1f('0x30'),'ignore':![]},{'name':'QueueCampaigns','value':_0xac1f('0x31'),'ignore':![]}];var _0x28216e=_(_0x381046)[_0xac1f('0x32')]('ignore')['map'](_0xac1f('0x33'))[_0xac1f('0x33')]();if(_[_0xac1f('0x34')](_0x28216e,_0x1f1472['type'])){return;}var _0x59d945=_[_0xac1f('0x35')](_0x381046,[_0xac1f('0x33'),_0x1f1472[_0xac1f('0x36')]])[_0xac1f('0x37')];return db[_0xac1f('0x38')][_0xac1f('0x2d')]({'where':{'type':_0x59d945,'resourceId':_0x1f1472['id']}})[_0xac1f('0x2c')](function(){return _0x3dab27;});})[_0xac1f('0x2c')](function(){_0x479293[_0xac1f('0x21')](0xcc)[_0xac1f('0x39')]();});}};}function handleEntityNotFound(_0x3464a4,_0x2cce9f){return function(_0x3f9faf){if(!_0x3f9faf){_0x3464a4[_0xac1f('0x20')](0x194);}return _0x3f9faf;};}function handleError(_0x1bb37a,_0x1bf6d0){_0x1bf6d0=_0x1bf6d0||0x1f4;return function(_0x1c0111){logger['error'](_0x1c0111[_0xac1f('0x3a')]);if(_0x1c0111[_0xac1f('0x37')]){delete _0x1c0111[_0xac1f('0x37')];}_0x1bb37a['status'](_0x1bf6d0)[_0xac1f('0x3b')](_0x1c0111);};}exports[_0xac1f('0x3c')]=function(_0x1c461a,_0xfc5dbe){var _0x3f7847={},_0x4a8d06={},_0x2777ca={'count':0x0,'rows':[]};var _0x1a94e6=_[_0xac1f('0x3d')](db[_0xac1f('0x3e')][_0xac1f('0x3f')],function(_0x1e3e7e){return{'name':_0x1e3e7e[_0xac1f('0x40')],'type':_0x1e3e7e[_0xac1f('0x36')][_0xac1f('0x41')]};});_0x4a8d06[_0xac1f('0x42')]=_[_0xac1f('0x3d')](_0x1a94e6,_0xac1f('0x37'));_0x4a8d06[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x1c461a[_0xac1f('0x43')]);_0x4a8d06[_0xac1f('0x45')]=_['intersection'](_0x4a8d06['model'],_0x4a8d06[_0xac1f('0x43')]);_0x3f7847[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x4a8d06['model'],qs[_0xac1f('0x48')](_0x1c461a[_0xac1f('0x43')][_0xac1f('0x48')]));_0x3f7847[_0xac1f('0x46')]=_0x3f7847[_0xac1f('0x46')][_0xac1f('0x49')]?_0x3f7847['attributes']:_0x4a8d06['model'];if(!_0x1c461a['query']['hasOwnProperty']('nolimit')){_0x3f7847['limit']=qs[_0xac1f('0x24')](_0x1c461a[_0xac1f('0x43')][_0xac1f('0x24')]);_0x3f7847[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x1c461a['query'][_0xac1f('0x23')]);}_0x3f7847[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x1c461a['query']['sort']);_0x3f7847['where']=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x1c461a[_0xac1f('0x43')],_0x4a8d06[_0xac1f('0x45')]),_0x1a94e6);if(_0x1c461a[_0xac1f('0x43')][_0xac1f('0x32')]){_0x3f7847[_0xac1f('0x4d')]=_['merge'](_0x3f7847['where'],{'$or':_[_0xac1f('0x3d')](_0x1a94e6,function(_0x53c36c){if(_0x53c36c['type']!=='VIRTUAL'){var _0xb31e1a={};_0xb31e1a[_0x53c36c[_0xac1f('0x37')]]={'$like':'%'+_0x1c461a[_0xac1f('0x43')][_0xac1f('0x32')]+'%'};return _0xb31e1a;}})});}_0x3f7847=_[_0xac1f('0x4e')]({},_0x3f7847,_0x1c461a[_0xac1f('0x4f')]);var _0x42bc66={'where':_0x3f7847[_0xac1f('0x4d')]};return db[_0xac1f('0x3e')][_0xac1f('0x26')](_0x42bc66)['then'](function(_0xe6ae1a){_0x2777ca['count']=_0xe6ae1a;if(_0x1c461a[_0xac1f('0x43')][_0xac1f('0x50')]){_0x3f7847[_0xac1f('0x51')]=[{'all':!![]}];}return db[_0xac1f('0x3e')][_0xac1f('0x52')](_0x3f7847);})['then'](function(_0x2871ef){_0x2777ca[_0xac1f('0x53')]=_0x2871ef;return _0x2777ca;})['then'](respondWithFilteredResult(_0xfc5dbe,_0x3f7847))[_0xac1f('0x54')](handleError(_0xfc5dbe,null));};exports[_0xac1f('0x55')]=function(_0xe112f7,_0x497b59){var _0x980cd5={'raw':![],'where':{'id':_0xe112f7[_0xac1f('0x56')]['id']}},_0x14a94e={};_0x14a94e[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0x3e')][_0xac1f('0x3f')]);_0x14a94e[_0xac1f('0x43')]=_['keys'](_0xe112f7['query']);_0x14a94e[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x14a94e[_0xac1f('0x42')],_0x14a94e[_0xac1f('0x43')]);_0x980cd5['attributes']=_[_0xac1f('0x47')](_0x14a94e[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0xe112f7[_0xac1f('0x43')][_0xac1f('0x48')]));_0x980cd5[_0xac1f('0x46')]=_0x980cd5['attributes'][_0xac1f('0x49')]?_0x980cd5[_0xac1f('0x46')]:_0x14a94e[_0xac1f('0x42')];if(_0xe112f7[_0xac1f('0x43')][_0xac1f('0x50')]){_0x980cd5['include']=[{'all':!![]}];}_0x980cd5=_[_0xac1f('0x4e')]({},_0x980cd5,_0xe112f7[_0xac1f('0x4f')]);return db[_0xac1f('0x3e')][_0xac1f('0x35')](_0x980cd5)[_0xac1f('0x2c')](handleEntityNotFound(_0x497b59,null))['then'](respondWithResult(_0x497b59,null))['catch'](handleError(_0x497b59,null));};exports['create']=function(_0x2bd4a4,_0x46f153){return db['VoiceQueue'][_0xac1f('0x57')](_0x2bd4a4['body'],{})[_0xac1f('0x2c')](function(_0x51c9c8){var _0x2e381=_0x2bd4a4[_0xac1f('0x58')][_0xac1f('0x2e')]({'plain':!![]});if(!_0x2e381)throw new Error(_0xac1f('0x59'));if(_0x2e381['role']===_0xac1f('0x58')){var _0x18aa51=_0x51c9c8['get']({'plain':!![]});var _0x2a659d=[{'name':_0xac1f('0x2f'),'value':_0xac1f('0x30')},{'name':_0xac1f('0x5a'),'value':_0xac1f('0x31')}];var _0x477b05=_[_0xac1f('0x35')](_0x2a659d,[_0xac1f('0x33'),_0x18aa51['type']])['name'];return db[_0xac1f('0x5b')][_0xac1f('0x35')]({'where':{'name':_0x477b05,'userProfileId':_0x2e381['userProfileId']},'raw':!![]})['then'](function(_0x49170b){if(_0x49170b&&_0x49170b[_0xac1f('0x5c')]===0x0){return db[_0xac1f('0x38')]['create']({'name':_0x18aa51['name'],'resourceId':_0x18aa51['id'],'type':_0x49170b[_0xac1f('0x37')],'sectionId':_0x49170b['id']},{})[_0xac1f('0x2c')](function(){return _0x51c9c8;});}else{return _0x51c9c8;}})[_0xac1f('0x54')](function(_0xbdc913){logger['error'](_0xac1f('0x5d'),_0xbdc913);throw _0xbdc913;});}return _0x51c9c8;})[_0xac1f('0x2c')](respondWithResult(_0x46f153,0xc9))['catch'](handleError(_0x46f153,null));};exports['clone']=function(_0x4ecf14,_0x4406e6){var _0x364462={'where':{'id':_0x4ecf14['params']['id']}},_0x3d3615={};_0x3d3615['model']=_[_0xac1f('0x44')](db[_0xac1f('0x3e')][_0xac1f('0x3f')]);_0x364462[_0xac1f('0x46')]=_['intersection'](_0x3d3615[_0xac1f('0x42')],qs['fields'](_0x4ecf14[_0xac1f('0x43')][_0xac1f('0x48')]));_0x364462[_0xac1f('0x46')]=_0x364462[_0xac1f('0x46')][_0xac1f('0x49')]?_0x364462[_0xac1f('0x46')]:_0x3d3615[_0xac1f('0x42')];if(_0x4ecf14['query']['includeAll']){_0x364462[_0xac1f('0x51')]=[{'all':!![]}];}_0x364462=_['merge']({},_0x364462,_0x4ecf14[_0xac1f('0x4f')]);return db[_0xac1f('0x3e')][_0xac1f('0x35')](_0x364462)[_0xac1f('0x2c')](handleEntityNotFound(_0x4406e6,null))[_0xac1f('0x2c')](function(_0x18d4ec){if(_0x18d4ec){var _0xb4da10=_0x18d4ec[_0xac1f('0x2e')]({'plain':!![]});_0xb4da10=qs[_0xac1f('0x5e')](_0xb4da10,['id',_0xac1f('0x5f'),_0xac1f('0x60')]);_0x4ecf14[_0xac1f('0x61')]=_['omit'](_0x4ecf14[_0xac1f('0x61')],['id',_0xac1f('0x5f'),'updatedAt']);return db[_0xac1f('0x3e')][_0xac1f('0x57')](_[_0xac1f('0x4e')](_0xb4da10,_0x4ecf14[_0xac1f('0x61')]),{'include':_0x4ecf14[_0xac1f('0x43')][_0xac1f('0x50')]?[{'all':!![]}]:undefined})[_0xac1f('0x2c')](function(_0x4cf37c){var _0x4b95ba=_0x4ecf14[_0xac1f('0x58')][_0xac1f('0x2e')]({'plain':!![]});if(!_0x4b95ba)throw new Error(_0xac1f('0x59'));if(_0x4b95ba['role']===_0xac1f('0x58')){var _0x437be8=_0x4cf37c[_0xac1f('0x2e')]({'plain':!![]});var _0xbe2775=[{'name':_0xac1f('0x2f'),'value':_0xac1f('0x30')},{'name':_0xac1f('0x5a'),'value':'outbound'}];var _0x29c799=_[_0xac1f('0x35')](_0xbe2775,[_0xac1f('0x33'),_0x437be8[_0xac1f('0x36')]])[_0xac1f('0x37')];return db[_0xac1f('0x5b')][_0xac1f('0x35')]({'where':{'name':_0x29c799,'userProfileId':_0x4b95ba[_0xac1f('0x62')]},'raw':!![]})[_0xac1f('0x2c')](function(_0x2df5f3){if(_0x2df5f3&&_0x2df5f3['autoAssociation']===0x0){return db['UserProfileResource'][_0xac1f('0x57')]({'name':_0x437be8[_0xac1f('0x37')],'resourceId':_0x437be8['id'],'type':_0x2df5f3[_0xac1f('0x37')],'sectionId':_0x2df5f3['id']},{})[_0xac1f('0x2c')](function(){return _0x4cf37c;});}else{return _0x4cf37c;}})[_0xac1f('0x54')](function(_0x1918a3){logger['error'](_0xac1f('0x5d'),_0x1918a3);throw _0x1918a3;});}return _0x4cf37c;});}})['then'](respondWithResult(_0x4406e6,0xc9))[_0xac1f('0x54')](handleError(_0x4406e6,null));};exports[_0xac1f('0x2b')]=function(_0x3f3517,_0x2c8967){if(_0x3f3517[_0xac1f('0x61')]['id']){delete _0x3f3517['body']['id'];}return db[_0xac1f('0x3e')]['find']({'where':{'id':_0x3f3517[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x2c8967,null))[_0xac1f('0x2c')](saveUpdates(_0x3f3517[_0xac1f('0x61')],null))['then'](respondWithResult(_0x2c8967,null))[_0xac1f('0x54')](handleError(_0x2c8967,null));};exports['destroy']=function(_0x507b7a,_0x45f56d){return db['VoiceQueue']['find']({'where':{'id':_0x507b7a['params']['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x45f56d,null))[_0xac1f('0x2c')](removeEntity(_0x45f56d,null))[_0xac1f('0x54')](handleError(_0x45f56d,null));};exports[_0xac1f('0x63')]=function(_0x11a656,_0x208d72,_0x292583){var _0x5457b4={'raw':![],'where':{}};var _0x83012f={};var _0x46d438={'count':0x0,'rows':[]};return db[_0xac1f('0x3e')]['findOne']({'where':{'id':_0x11a656[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x208d72,null))[_0xac1f('0x2c')](function(_0x50a415){if(_0x50a415){_0x83012f['model']=_['keys'](db[_0xac1f('0x64')][_0xac1f('0x3f')]);_0x83012f['query']=_['keys'](_0x11a656[_0xac1f('0x43')]);_0x83012f['filters']=_[_0xac1f('0x47')](_0x83012f[_0xac1f('0x42')],_0x83012f[_0xac1f('0x43')]);_0x5457b4[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x83012f['model'],qs[_0xac1f('0x48')](_0x11a656[_0xac1f('0x43')]['fields']));_0x5457b4[_0xac1f('0x46')]=_0x5457b4['attributes'][_0xac1f('0x49')]?_0x5457b4[_0xac1f('0x46')]:_0x83012f[_0xac1f('0x42')];if(!_0x11a656[_0xac1f('0x43')][_0xac1f('0x65')](_0xac1f('0x66'))){_0x5457b4['limit']=qs[_0xac1f('0x24')](_0x11a656['query'][_0xac1f('0x24')]);_0x5457b4[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x11a656['query'][_0xac1f('0x23')]);}_0x5457b4[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x11a656[_0xac1f('0x43')]['sort']);_0x5457b4[_0xac1f('0x4d')]=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x11a656[_0xac1f('0x43')],_0x83012f['filters']));_0x5457b4['where'][_0xac1f('0x67')]=_0x50a415['id'];if(_0x11a656[_0xac1f('0x43')][_0xac1f('0x32')]){_0x5457b4[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x5457b4[_0xac1f('0x4d')],{'$or':_[_0xac1f('0x3d')](_0x5457b4['attributes'],function(_0x2e1819){var _0x3b2730={};_0x3b2730[_0x2e1819]={'$like':'%'+_0x11a656['query'][_0xac1f('0x32')]+'%'};return _0x3b2730;})});}_0x5457b4=_[_0xac1f('0x4e')]({},_0x5457b4,_0x11a656['options']);return db[_0xac1f('0x64')]['count']({'where':_0x5457b4[_0xac1f('0x4d')]})['then'](function(_0x4b6c04){_0x46d438[_0xac1f('0x26')]=_0x4b6c04;if(_0x11a656[_0xac1f('0x43')][_0xac1f('0x50')]){_0x5457b4[_0xac1f('0x51')]=[{'all':!![]}];}return db[_0xac1f('0x64')][_0xac1f('0x52')](_0x5457b4);})[_0xac1f('0x2c')](function(_0x53d20c){_0x46d438['rows']=_0x53d20c;return _0x46d438;});}})[_0xac1f('0x2c')](respondWithFilteredResult(_0x208d72,_0x5457b4))[_0xac1f('0x54')](handleError(_0x208d72,null));};exports[_0xac1f('0x68')]=function(_0x1e25df,_0x328736,_0x52bfc6){var _0x44f27e={'raw':!![],'where':{}};var _0x40287e={};var _0x1abb46={'count':0x0,'rows':[]};return db[_0xac1f('0x3e')][_0xac1f('0x69')]({'where':{'id':_0x1e25df['params']['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x328736,null))[_0xac1f('0x2c')](function(_0x3b189f){if(_0x3b189f){_0x40287e[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0x6a')][_0xac1f('0x3f')]);_0x40287e[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x1e25df[_0xac1f('0x43')]);_0x40287e[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x40287e[_0xac1f('0x42')],_0x40287e[_0xac1f('0x43')]);_0x44f27e['attributes']=_[_0xac1f('0x47')](_0x40287e[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0x1e25df[_0xac1f('0x43')][_0xac1f('0x48')]));_0x44f27e[_0xac1f('0x46')]=_0x44f27e[_0xac1f('0x46')][_0xac1f('0x49')]?_0x44f27e[_0xac1f('0x46')]:_0x40287e[_0xac1f('0x42')];if(!_0x1e25df[_0xac1f('0x43')][_0xac1f('0x65')]('nolimit')){_0x44f27e[_0xac1f('0x24')]=qs[_0xac1f('0x24')](_0x1e25df[_0xac1f('0x43')][_0xac1f('0x24')]);_0x44f27e[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x1e25df[_0xac1f('0x43')]['offset']);}_0x44f27e[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x1e25df[_0xac1f('0x43')][_0xac1f('0x4b')]);_0x44f27e[_0xac1f('0x4d')]=qs[_0xac1f('0x45')](_['pick'](_0x1e25df['query'],_0x40287e[_0xac1f('0x45')]));_0x44f27e[_0xac1f('0x4d')]['VoiceQueueId']=_0x3b189f['id'];if(_0x1e25df['query']['filter']){_0x44f27e[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x44f27e['where'],{'$or':_[_0xac1f('0x3d')](_0x44f27e['attributes'],function(_0x56cc82){var _0x4d254f={};_0x4d254f[_0x56cc82]={'$like':'%'+_0x1e25df[_0xac1f('0x43')]['filter']+'%'};return _0x4d254f;})});}_0x44f27e=_[_0xac1f('0x4e')]({},_0x44f27e,_0x1e25df[_0xac1f('0x4f')]);return db[_0xac1f('0x6a')][_0xac1f('0x26')]({'where':_0x44f27e[_0xac1f('0x4d')]})[_0xac1f('0x2c')](function(_0x5df190){_0x1abb46[_0xac1f('0x26')]=_0x5df190;if(_0x1e25df[_0xac1f('0x43')]['includeAll']){_0x44f27e[_0xac1f('0x51')]=[{'all':!![]}];}return db[_0xac1f('0x6a')]['findAll'](_0x44f27e);})['then'](function(_0x126f96){_0x1abb46[_0xac1f('0x53')]=_0x126f96;return _0x1abb46;});}})['then'](respondWithFilteredResult(_0x328736,_0x44f27e))[_0xac1f('0x54')](handleError(_0x328736,null));};exports[_0xac1f('0x6b')]=function(_0x18ed02,_0x41c77d,_0x320242){var _0x2799d1={'raw':!![],'where':{}};var _0x5a42b9={};var _0x36e18e={'count':0x0,'rows':[]};return db[_0xac1f('0x3e')][_0xac1f('0x69')]({'where':{'id':_0x18ed02[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x41c77d,null))[_0xac1f('0x2c')](function(_0x2b2704){if(_0x2b2704){_0x5a42b9[_0xac1f('0x42')]=_[_0xac1f('0x44')](db['CmHopperFinal'][_0xac1f('0x3f')]);_0x5a42b9['query']=_['keys'](_0x18ed02[_0xac1f('0x43')]);_0x5a42b9[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x5a42b9[_0xac1f('0x42')],_0x5a42b9[_0xac1f('0x43')]);_0x2799d1[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x5a42b9[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0x18ed02[_0xac1f('0x43')]['fields']));_0x2799d1[_0xac1f('0x46')]=_0x2799d1[_0xac1f('0x46')][_0xac1f('0x49')]?_0x2799d1['attributes']:_0x5a42b9[_0xac1f('0x42')];if(!_0x18ed02[_0xac1f('0x43')][_0xac1f('0x65')]('nolimit')){_0x2799d1['limit']=qs[_0xac1f('0x24')](_0x18ed02[_0xac1f('0x43')][_0xac1f('0x24')]);_0x2799d1[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x18ed02[_0xac1f('0x43')][_0xac1f('0x23')]);}_0x2799d1[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x18ed02[_0xac1f('0x43')][_0xac1f('0x4b')]);_0x2799d1['where']=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x18ed02[_0xac1f('0x43')],_0x5a42b9[_0xac1f('0x45')]));_0x2799d1[_0xac1f('0x4d')][_0xac1f('0x67')]=_0x2b2704['id'];if(_0x18ed02[_0xac1f('0x43')][_0xac1f('0x32')]){_0x2799d1[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x2799d1[_0xac1f('0x4d')],{'$or':_[_0xac1f('0x3d')](_0x2799d1['attributes'],function(_0x11527c){var _0x59bd0c={};_0x59bd0c[_0x11527c]={'$like':'%'+_0x18ed02[_0xac1f('0x43')][_0xac1f('0x32')]+'%'};return _0x59bd0c;})});}_0x2799d1=_[_0xac1f('0x4e')]({},_0x2799d1,_0x18ed02[_0xac1f('0x4f')]);return db['CmHopperFinal'][_0xac1f('0x26')]({'where':_0x2799d1[_0xac1f('0x4d')]})['then'](function(_0x36e28e){_0x36e18e[_0xac1f('0x26')]=_0x36e28e;if(_0x18ed02['query'][_0xac1f('0x50')]){_0x2799d1[_0xac1f('0x51')]=[{'all':!![]}];}return db[_0xac1f('0x6c')][_0xac1f('0x52')](_0x2799d1);})[_0xac1f('0x2c')](function(_0x2ce3fb){_0x36e18e[_0xac1f('0x53')]=_0x2ce3fb;return _0x36e18e;});}})[_0xac1f('0x2c')](respondWithFilteredResult(_0x41c77d,_0x2799d1))['catch'](handleError(_0x41c77d,null));};exports[_0xac1f('0x6d')]=function(_0x148486,_0x65a706,_0x25cea7){var _0x1e0ad8={'raw':!![],'where':{}};var _0x2e0326={};var _0x45c038={'count':0x0,'rows':[]};return db[_0xac1f('0x3e')]['findOne']({'where':{'id':_0x148486[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x65a706,null))['then'](function(_0x4335e8){if(_0x4335e8){_0x2e0326['model']=_['keys'](db[_0xac1f('0x6e')][_0xac1f('0x3f')]);_0x2e0326[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x148486[_0xac1f('0x43')]);_0x2e0326['filters']=_[_0xac1f('0x47')](_0x2e0326[_0xac1f('0x42')],_0x2e0326[_0xac1f('0x43')]);_0x1e0ad8[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x2e0326[_0xac1f('0x42')],qs['fields'](_0x148486[_0xac1f('0x43')][_0xac1f('0x48')]));_0x1e0ad8[_0xac1f('0x46')]=_0x1e0ad8[_0xac1f('0x46')][_0xac1f('0x49')]?_0x1e0ad8[_0xac1f('0x46')]:_0x2e0326[_0xac1f('0x42')];if(!_0x148486[_0xac1f('0x43')][_0xac1f('0x65')](_0xac1f('0x66'))){_0x1e0ad8[_0xac1f('0x24')]=qs[_0xac1f('0x24')](_0x148486[_0xac1f('0x43')][_0xac1f('0x24')]);_0x1e0ad8[_0xac1f('0x23')]=qs['offset'](_0x148486[_0xac1f('0x43')][_0xac1f('0x23')]);}_0x1e0ad8[_0xac1f('0x4a')]=qs['sort'](_0x148486[_0xac1f('0x43')][_0xac1f('0x4b')]);_0x1e0ad8['where']=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x148486[_0xac1f('0x43')],_0x2e0326[_0xac1f('0x45')]));_0x1e0ad8[_0xac1f('0x4d')][_0xac1f('0x67')]=_0x4335e8['id'];if(_0x148486[_0xac1f('0x43')][_0xac1f('0x32')]){_0x1e0ad8[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x1e0ad8[_0xac1f('0x4d')],{'$or':_['map'](_0x1e0ad8[_0xac1f('0x46')],function(_0x1b1bbe){var _0x4db3d7={};_0x4db3d7[_0x1b1bbe]={'$like':'%'+_0x148486['query'][_0xac1f('0x32')]+'%'};return _0x4db3d7;})});}_0x1e0ad8=_[_0xac1f('0x4e')]({},_0x1e0ad8,_0x148486[_0xac1f('0x4f')]);return db[_0xac1f('0x6e')][_0xac1f('0x26')]({'where':_0x1e0ad8[_0xac1f('0x4d')]})['then'](function(_0x2b3b8b){_0x45c038['count']=_0x2b3b8b;if(_0x148486['query']['includeAll']){_0x1e0ad8[_0xac1f('0x51')]=[{'all':!![]}];}return db[_0xac1f('0x6e')][_0xac1f('0x52')](_0x1e0ad8);})[_0xac1f('0x2c')](function(_0x31a1eb){_0x45c038['rows']=_0x31a1eb;return _0x45c038;});}})[_0xac1f('0x2c')](respondWithFilteredResult(_0x65a706,_0x1e0ad8))[_0xac1f('0x54')](handleError(_0x65a706,null));};exports[_0xac1f('0x6f')]=function(_0x1eba14,_0x538ddd,_0x1d11c9){var _0x1a4d69={};var _0x469697={};var _0x2d453f;var _0x2daf7d;return db[_0xac1f('0x3e')]['findOne']({'where':{'id':_0x1eba14[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x538ddd,null))[_0xac1f('0x2c')](function(_0x36e80b){if(_0x36e80b){_0x2d453f=_0x36e80b;_0x469697[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0x70')][_0xac1f('0x3f')]);_0x469697['query']=_[_0xac1f('0x44')](_0x1eba14[_0xac1f('0x43')]);_0x469697[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x469697[_0xac1f('0x42')],_0x469697[_0xac1f('0x43')]);_0x1a4d69[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x469697['model'],qs[_0xac1f('0x48')](_0x1eba14[_0xac1f('0x43')][_0xac1f('0x48')]));_0x1a4d69['attributes']=_0x1a4d69['attributes']['length']?_0x1a4d69[_0xac1f('0x46')]:_0x469697['model'];_0x1a4d69[_0xac1f('0x4a')]=qs['sort'](_0x1eba14[_0xac1f('0x43')][_0xac1f('0x4b')]);_0x1a4d69['where']=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x1eba14['query'],_0x469697['filters']));if(_0x1eba14[_0xac1f('0x43')][_0xac1f('0x32')]){_0x1a4d69[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x1a4d69[_0xac1f('0x4d')],{'$or':_['map'](_0x1a4d69[_0xac1f('0x46')],function(_0x4aaa05){var _0x540d1c={};_0x540d1c[_0x4aaa05]={'$like':'%'+_0x1eba14[_0xac1f('0x43')]['filter']+'%'};return _0x540d1c;})});}_0x1a4d69=_['merge']({},_0x1a4d69,_0x1eba14['options']);return _0x2d453f['getTeams'](_0x1a4d69);}})['then'](function(_0x3b72a6){if(_0x3b72a6){_0x2daf7d=_0x3b72a6[_0xac1f('0x49')];if(!_0x1eba14[_0xac1f('0x43')][_0xac1f('0x65')](_0xac1f('0x66'))){_0x1a4d69['limit']=qs[_0xac1f('0x24')](_0x1eba14['query']['limit']);_0x1a4d69[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x1eba14['query']['offset']);}return _0x2d453f['getTeams'](_0x1a4d69);}})[_0xac1f('0x2c')](function(_0x26777b){if(_0x26777b){return _0x26777b?{'count':_0x2daf7d,'rows':_0x26777b}:null;}})[_0xac1f('0x2c')](respondWithResult(_0x538ddd,null))[_0xac1f('0x54')](handleError(_0x538ddd,null));};exports[_0xac1f('0x71')]=function(_0xcaab1e,_0xc0579,_0x4622d6){var _0x12492e=_0xcaab1e['body'][_0xac1f('0x72')];var _0x4c5f09=_[_0xac1f('0x3d')](_0x12492e,'id');return db[_0xac1f('0x70')]['findAll']({'where':{'id':_0x4c5f09},'attributes':['id'],'include':[{'model':db[_0xac1f('0x73')],'as':_0xac1f('0x74'),'attributes':['id',_0xac1f('0x37'),_0xac1f('0x75'),'voicePause',_0xac1f('0x76')],'raw':!![]}]})['then'](function(_0x130f1d){if(_0x130f1d){var _0x56cf27=_[_0xac1f('0x77')](_0x130f1d,function(_0x522b74){var _0x13a40e=_0x522b74[_0xac1f('0x2e')]({'plain':!![]});_0x13a40e[_0xac1f('0x74')][_0xac1f('0x78')](function(_0x1b3f7c){_0x1b3f7c[_0xac1f('0x79')]=_['find'](_0x12492e,{'id':_0x13a40e['id']})[_0xac1f('0x79')];});return _0x13a40e[_0xac1f('0x74')];});return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0xcaab1e[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](function(_0x17f2bf){return db['sequelize'][_0xac1f('0x7a')](function(_0x245d70){return _0x17f2bf[_0xac1f('0x71')](_0x4c5f09,{'transaction':_0x245d70})[_0xac1f('0x2c')](function(){return BPromise[_0xac1f('0x7b')](_0x12492e,function(_0x47b160){return db['TeamVoiceQueue'][_0xac1f('0x7c')]({'TeamId':_0x47b160['id'],'VoiceQueueId':_0xcaab1e[_0xac1f('0x56')]['id'],'penalty':_0x47b160[_0xac1f('0x79')]},{'transaction':_0x245d70});});})[_0xac1f('0x2c')](function(){return BPromise[_0xac1f('0x7b')](_0x56cf27,function(_0x9a22d7){return db['UserVoiceQueue'][_0xac1f('0x7d')]({'where':{'UserId':_0x9a22d7['id'],'VoiceQueueId':_0xcaab1e['params']['id']},'defaults':{'penalty':_0x9a22d7[_0xac1f('0x79')]},'transaction':_0x245d70});});})[_0xac1f('0x2c')](function(){return BPromise['each'](_[_0xac1f('0x32')](_0x56cf27,{'online':!![]}),function(_0xabf16e){return db['UserVoiceQueueRt'][_0xac1f('0x7c')]({'membername':_0xabf16e['name'],'UserId':_0xabf16e['id'],'queue_name':_0x17f2bf['name'],'VoiceQueueId':_0x17f2bf['id'],'interface':_[_0xac1f('0x7e')](_0xabf16e['interface'])?util[_0xac1f('0x7f')]('SIP/%s',_0xabf16e['name']):_0xabf16e[_0xac1f('0x76')],'paused':_0xabf16e['voicePause']||![],'penalty':_0xabf16e['penalty']},{'transaction':_0x245d70});});})[_0xac1f('0x2c')](function(){_0x56cf27[_0xac1f('0x78')](function(_0x37c08a){socket['emit'](_0xac1f('0x80'),{'UserId':_0x37c08a['id'],'VoiceQueueId':_0x17f2bf['id']});});});});});}})[_0xac1f('0x2c')](respondWithStatusCode(_0xc0579,null))['catch'](handleError(_0xc0579,null));};exports[_0xac1f('0x81')]=function(_0x3a43a6,_0x4d9e55,_0xed05cb){return db[_0xac1f('0x70')][_0xac1f('0x52')]({'where':{'id':_0x3a43a6[_0xac1f('0x43')][_0xac1f('0x82')]},'attributes':['id'],'include':[{'model':db[_0xac1f('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xac1f('0x2c')](handleEntityNotFound(_0x4d9e55,null))['then'](function(_0x363238){var _0x213ad4=_['map'](_0x363238,'id');var _0x200b97=[];var _0x16f66d=[];var _0x5d3b1f=squel[_0xac1f('0x83')]();_0x5d3b1f[_0xac1f('0x84')](_0xac1f('0x85'))[_0xac1f('0x86')](_0xac1f('0x87'),'tq')[_0xac1f('0x88')](_0xac1f('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xac1f('0x8a'),_0x3a43a6['params']['id']);for(var _0x547388=0x0;_0x547388<_0x363238[_0xac1f('0x49')];_0x547388+=0x1){let _0x2ad700=_0x363238[_0x547388];for(var _0x279ab6=0x0;_0x279ab6<_0x2ad700[_0xac1f('0x74')][_0xac1f('0x49')];_0x279ab6+=0x1){let _0x1e1da3=_0x2ad700['Agents'][_0x279ab6];var _0x3735e4=_0x5d3b1f[_0xac1f('0x8b')]();_0x3735e4['where'](_0xac1f('0x8c'),_0x1e1da3['id']);_0x16f66d[_0xac1f('0x8d')](db['sequelize'][_0xac1f('0x43')](_0x3735e4['toString'](),{'type':db[_0xac1f('0x8e')]['QueryTypes'][_0xac1f('0x8f')]})['then'](function(_0x5336e7){if(_0x5336e7[_0xac1f('0x49')]===0x1){return _0x1e1da3['id'];}else{var _0x2d4243=_['every'](_[_0xac1f('0x3d')](_0x5336e7,'TeamId'),function(_0x599d82){return _[_0xac1f('0x34')](_0x213ad4,_0x599d82);});if(_0x2d4243){return _0x1e1da3['id'];}}}));}}return BPromise[_0xac1f('0x90')](_0x16f66d)[_0xac1f('0x2c')](function(_0x191501){_0x200b97=_(_0x200b97)[_0xac1f('0x91')](_0x191501)[_0xac1f('0x92')]()[_0xac1f('0x33')]();return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x3a43a6[_0xac1f('0x56')]['id']}})['then'](function(_0x4fe7d2){return db['sequelize']['transaction'](function(_0x18b971){return _0x4fe7d2[_0xac1f('0x81')](_0x3a43a6[_0xac1f('0x43')][_0xac1f('0x82')],{'transaction':_0x18b971})[_0xac1f('0x2c')](function(){if(!_[_0xac1f('0x93')](_0x200b97)){return _0x4fe7d2[_0xac1f('0x94')](_0x200b97,{'transaction':_0x18b971})['then'](function(){return db[_0xac1f('0x95')]['destroy']({'where':{'VoiceQueueId':_0x3a43a6[_0xac1f('0x56')]['id'],'UserId':_0x200b97},'transaction':_0x18b971});});}})[_0xac1f('0x2c')](function(){_0x200b97['forEach'](function(_0x220c8d){socket[_0xac1f('0x96')](_0xac1f('0x97'),{'UserId':_0x220c8d,'VoiceQueueId':_0x4fe7d2['id']});});});});});});})[_0xac1f('0x2c')](respondWithStatusCode(_0x4d9e55,null))[_0xac1f('0x54')](handleError(_0x4d9e55,null));};exports['addAgents']=function(_0x46df32,_0x4ffa68,_0x230181){var _0x1030ba,_0x2308b9;return db[_0xac1f('0x3e')]['find']({'where':{'id':_0x46df32['params']['id']}})['then'](handleEntityNotFound(_0x4ffa68,null))[_0xac1f('0x2c')](function(_0x35a4c4){if(_0x35a4c4){_0x2308b9=_0x35a4c4;return _0x35a4c4[_0xac1f('0x98')](_0x46df32[_0xac1f('0x61')][_0xac1f('0x82')],_[_0xac1f('0x5e')](_0x46df32['body'],[_0xac1f('0x82'),'id'])||{})[_0xac1f('0x99')](function(_0xcdab2c){for(var _0x4449e5=0x0;_0x4449e5<_0x46df32[_0xac1f('0x61')][_0xac1f('0x82')][_0xac1f('0x49')];_0x4449e5+=0x1){socket[_0xac1f('0x96')](_0xac1f('0x80'),{'UserId':Number(_0x46df32[_0xac1f('0x61')]['ids'][_0x4449e5]),'VoiceQueueId':Number(_0x46df32[_0xac1f('0x56')]['id'])});}return _0xcdab2c;});}})[_0xac1f('0x2c')](function(_0x44faa2){_0x1030ba=_0x44faa2||[];if(_0x2308b9){return db[_0xac1f('0x73')][_0xac1f('0x52')]({'where':{'id':_0x46df32[_0xac1f('0x61')][_0xac1f('0x82')]},'attributes':['id',_0xac1f('0x37'),_0xac1f('0x75'),_0xac1f('0x9a'),_0xac1f('0x76')],'raw':!![]});}})[_0xac1f('0x2c')](function(_0x587a5){if(!_['isEmpty'](_0x587a5)){var _0x3781ef=[];for(var _0xd1c1e=0x0;_0xd1c1e<_0x587a5[_0xac1f('0x49')];_0xd1c1e++){if(_0x587a5[_0xd1c1e]['online']){_0x3781ef[_0xac1f('0x8d')](db[_0xac1f('0x95')][_0xac1f('0x7c')]({'membername':_0x587a5[_0xd1c1e]['name'],'UserId':_0x587a5[_0xd1c1e]['id'],'queue_name':_0x2308b9[_0xac1f('0x37')],'VoiceQueueId':_0x2308b9['id'],'interface':_['isNil'](_0x587a5[_0xd1c1e][_0xac1f('0x76')])?util['format'](_0xac1f('0x9b'),_0x587a5[_0xd1c1e][_0xac1f('0x37')]):_0x587a5[_0xd1c1e][_0xac1f('0x76')],'paused':_0x587a5[_0xd1c1e][_0xac1f('0x9a')]||![],'penalty':_0x46df32[_0xac1f('0x61')][_0xac1f('0x79')]||0x0}));}}return BPromise[_0xac1f('0x90')](_0x3781ef);}})[_0xac1f('0x2c')](function(){return _0x1030ba;})[_0xac1f('0x2c')](respondWithResult(_0x4ffa68,null))[_0xac1f('0x54')](handleError(_0x4ffa68,null));};exports[_0xac1f('0x94')]=function(_0x7d79d9,_0x5a6a49,_0x55e843){return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x7d79d9[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x5a6a49,null))[_0xac1f('0x2c')](function(_0x43288e){if(_0x43288e){return _0x43288e[_0xac1f('0x94')](_0x7d79d9[_0xac1f('0x43')][_0xac1f('0x82')])['then'](function(){if(_[_0xac1f('0x9c')](_0x7d79d9[_0xac1f('0x43')][_0xac1f('0x82')])){for(var _0x270700=0x0;_0x270700<_0x7d79d9[_0xac1f('0x43')][_0xac1f('0x82')]['length'];_0x270700+=0x1){socket[_0xac1f('0x96')](_0xac1f('0x97'),{'UserId':Number(_0x7d79d9['query']['ids'][_0x270700]),'VoiceQueueId':Number(_0x7d79d9[_0xac1f('0x56')]['id'])});}}else{socket[_0xac1f('0x96')](_0xac1f('0x97'),{'UserId':Number(_0x7d79d9[_0xac1f('0x43')]['ids']),'VoiceQueueId':Number(_0x7d79d9[_0xac1f('0x56')]['id'])});}});}})[_0xac1f('0x2c')](function(_0x56bd76){return db[_0xac1f('0x95')][_0xac1f('0x2d')]({'where':{'VoiceQueueId':_0x7d79d9[_0xac1f('0x56')]['id'],'UserId':_0x7d79d9['query'][_0xac1f('0x82')]}})[_0xac1f('0x2c')](function(){return _0x56bd76;});})[_0xac1f('0x2c')](respondWithStatusCode(_0x5a6a49,null))['catch'](handleError(_0x5a6a49,null));};exports[_0xac1f('0x9d')]=function(_0x407efc,_0x4c40a8,_0x56639f){var _0x434ec0={};var _0x5a3f35={};var _0x5c2ac6;var _0xf86dd;return db[_0xac1f('0x3e')][_0xac1f('0x69')]({'where':{'id':_0x407efc[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x4c40a8,null))[_0xac1f('0x2c')](function(_0x565404){if(_0x565404){_0x5c2ac6=_0x565404;_0x5a3f35[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0x73')][_0xac1f('0x3f')]);_0x5a3f35[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x407efc[_0xac1f('0x43')]);_0x5a3f35[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x5a3f35[_0xac1f('0x42')],_0x5a3f35[_0xac1f('0x43')]);_0x434ec0[_0xac1f('0x46')]=_[_0xac1f('0x47')](_0x5a3f35['model'],qs[_0xac1f('0x48')](_0x407efc[_0xac1f('0x43')][_0xac1f('0x48')]));_0x434ec0['attributes']=_0x434ec0[_0xac1f('0x46')]['length']?_0x434ec0['attributes']:_0x5a3f35[_0xac1f('0x42')];_0x434ec0[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x407efc[_0xac1f('0x43')]['sort']);_0x434ec0[_0xac1f('0x4d')]=qs['filters'](_[_0xac1f('0x4c')](_0x407efc[_0xac1f('0x43')],_0x5a3f35['filters']));if(_0x407efc[_0xac1f('0x43')][_0xac1f('0x32')]){_0x434ec0[_0xac1f('0x4d')]=_['merge'](_0x434ec0[_0xac1f('0x4d')],{'$or':_[_0xac1f('0x3d')](_0x434ec0['attributes'],function(_0x1929a3){var _0x14363e={};_0x14363e[_0x1929a3]={'$like':'%'+_0x407efc[_0xac1f('0x43')][_0xac1f('0x32')]+'%'};return _0x14363e;})});}_0x434ec0=_[_0xac1f('0x4e')]({},_0x434ec0,_0x407efc[_0xac1f('0x4f')]);return _0x5c2ac6['getAgents'](_0x434ec0);}})[_0xac1f('0x2c')](function(_0x30afa9){if(_0x30afa9){_0xf86dd=_0x30afa9[_0xac1f('0x49')];if(!_0x407efc[_0xac1f('0x43')][_0xac1f('0x65')](_0xac1f('0x66'))){_0x434ec0[_0xac1f('0x24')]=qs['limit'](_0x407efc[_0xac1f('0x43')]['limit']);_0x434ec0['offset']=qs[_0xac1f('0x23')](_0x407efc['query'][_0xac1f('0x23')]);}return _0x5c2ac6[_0xac1f('0x9d')](_0x434ec0);}})[_0xac1f('0x2c')](function(_0x4ae7f2){if(_0x4ae7f2){return _0x4ae7f2?{'count':_0xf86dd,'rows':_0x4ae7f2}:null;}})[_0xac1f('0x2c')](respondWithResult(_0x4c40a8,null))['catch'](handleError(_0x4c40a8,null));};exports[_0xac1f('0x9e')]=function(_0x12ab7f,_0x4de2d3,_0x1822cb){var _0x43ef76={};var _0x3ddaa0={};var _0x35bbfb;var _0xe231a6;return db[_0xac1f('0x3e')][_0xac1f('0x69')]({'where':{'id':_0x12ab7f[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x4de2d3,null))[_0xac1f('0x2c')](function(_0x548c6f){if(_0x548c6f){_0x35bbfb=_0x548c6f;_0x3ddaa0[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0x95')][_0xac1f('0x3f')]);_0x3ddaa0[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x12ab7f[_0xac1f('0x43')]);_0x3ddaa0[_0xac1f('0x45')]=_[_0xac1f('0x47')](_0x3ddaa0[_0xac1f('0x42')],_0x3ddaa0[_0xac1f('0x43')]);_0x43ef76['attributes']=_[_0xac1f('0x47')](_0x3ddaa0[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0x12ab7f[_0xac1f('0x43')][_0xac1f('0x48')]));_0x43ef76[_0xac1f('0x46')]=_0x43ef76[_0xac1f('0x46')]['length']?_0x43ef76[_0xac1f('0x46')]:_0x3ddaa0['model'];_0x43ef76['order']=qs[_0xac1f('0x4b')](_0x12ab7f[_0xac1f('0x43')][_0xac1f('0x4b')]);_0x43ef76[_0xac1f('0x4d')]=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x12ab7f['query'],_0x3ddaa0[_0xac1f('0x45')]));if(_0x12ab7f['query'][_0xac1f('0x32')]){_0x43ef76[_0xac1f('0x4d')]=_['merge'](_0x43ef76[_0xac1f('0x4d')],{'$or':_[_0xac1f('0x3d')](_0x43ef76['attributes'],function(_0x567983){var _0x31754d={};_0x31754d[_0x567983]={'$like':'%'+_0x12ab7f[_0xac1f('0x43')][_0xac1f('0x32')]+'%'};return _0x31754d;})});}_0x43ef76=_['merge']({},_0x43ef76,_0x12ab7f[_0xac1f('0x4f')]);return _0x35bbfb[_0xac1f('0x9e')](_0x43ef76);}})[_0xac1f('0x2c')](function(_0x109c46){if(_0x109c46){_0xe231a6=_0x109c46[_0xac1f('0x49')];if(!_0x12ab7f[_0xac1f('0x43')]['hasOwnProperty'](_0xac1f('0x66'))){_0x43ef76[_0xac1f('0x24')]=qs[_0xac1f('0x24')](_0x12ab7f[_0xac1f('0x43')][_0xac1f('0x24')]);_0x43ef76[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x12ab7f[_0xac1f('0x43')][_0xac1f('0x23')]);}return _0x35bbfb[_0xac1f('0x9e')](_0x43ef76);}})[_0xac1f('0x2c')](function(_0x300a06){return _0x300a06?{'count':_0xe231a6,'rows':_0x300a06}:null;})[_0xac1f('0x2c')](respondWithResult(_0x4de2d3,null))[_0xac1f('0x54')](handleError(_0x4de2d3,null));};exports[_0xac1f('0x9f')]=function(_0x3067e6,_0x5d7f76,_0x4c190c){var _0x33985e={};var _0x323d73={};var _0x15fddd;var _0x29f27b;return db[_0xac1f('0x3e')]['findOne']({'where':{'id':_0x3067e6[_0xac1f('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d7f76,null))[_0xac1f('0x2c')](function(_0x1f896e){if(_0x1f896e){_0x15fddd=_0x1f896e;_0x323d73[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0xa0')][_0xac1f('0x3f')]);_0x323d73[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x3067e6[_0xac1f('0x43')]);_0x323d73['filters']=_[_0xac1f('0x47')](_0x323d73['model'],_0x323d73[_0xac1f('0x43')]);_0x33985e[_0xac1f('0x46')]=_['intersection'](_0x323d73[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0x3067e6[_0xac1f('0x43')][_0xac1f('0x48')]));_0x33985e['attributes']=_0x33985e[_0xac1f('0x46')][_0xac1f('0x49')]?_0x33985e[_0xac1f('0x46')]:_0x323d73[_0xac1f('0x42')];_0x33985e[_0xac1f('0x4a')]=qs[_0xac1f('0x4b')](_0x3067e6[_0xac1f('0x43')]['sort']);_0x33985e[_0xac1f('0x4d')]=qs[_0xac1f('0x45')](_[_0xac1f('0x4c')](_0x3067e6[_0xac1f('0x43')],_0x323d73[_0xac1f('0x45')]));if(_0x3067e6[_0xac1f('0x43')]['filter']){_0x33985e['where']=_[_0xac1f('0x4e')](_0x33985e['where'],{'$or':_[_0xac1f('0x3d')](_0x33985e['attributes'],function(_0x3ca34b){var _0xde1a1c={};_0xde1a1c[_0x3ca34b]={'$like':'%'+_0x3067e6[_0xac1f('0x43')][_0xac1f('0x32')]+'%'};return _0xde1a1c;})});}_0x33985e=_[_0xac1f('0x4e')]({},_0x33985e,_0x3067e6[_0xac1f('0x4f')]);return _0x15fddd[_0xac1f('0x9f')](_0x33985e);}})[_0xac1f('0x2c')](function(_0x244e72){if(_0x244e72){_0x29f27b=_0x244e72[_0xac1f('0x49')];if(!_0x3067e6['query'][_0xac1f('0x65')](_0xac1f('0x66'))){_0x33985e[_0xac1f('0x24')]=qs[_0xac1f('0x24')](_0x3067e6[_0xac1f('0x43')]['limit']);_0x33985e[_0xac1f('0x23')]=qs['offset'](_0x3067e6['query'][_0xac1f('0x23')]);}return _0x15fddd[_0xac1f('0x9f')](_0x33985e);}})['then'](function(_0x1e7ca3){if(_0x1e7ca3){return _0x1e7ca3?{'count':_0x29f27b,'rows':_0x1e7ca3}:null;}})[_0xac1f('0x2c')](respondWithResult(_0x5d7f76,null))[_0xac1f('0x54')](handleError(_0x5d7f76,null));};exports[_0xac1f('0xa1')]=function(_0x301a4a,_0x48840c,_0x15d006){var _0x261f55=moment()[_0xac1f('0x7f')](_0xac1f('0xa2'));var _0x1ce770,_0x2ec1dc;return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x301a4a['params']['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x48840c,null))['then'](function(_0x36858d){if(_0x36858d){_0x2ec1dc=_0x36858d;return _0x36858d[_0xac1f('0xa1')](_0x301a4a['body']['ids'],_[_0xac1f('0x5e')](_0x301a4a['body'],['ids','id'])||{});}return null;})[_0xac1f('0x99')](function(_0x18ff95){var _0x2904b6;_0x1ce770=_0x18ff95||[];var _0x5c6778=[];if(_0x18ff95){for(var _0x4a2391=0x0;_0x4a2391<_0x18ff95[_0xac1f('0x49')];_0x4a2391+=0x1){var _0x56a285=_0x18ff95[_0x4a2391][_0xac1f('0x2e')]({'plain':!![]});_0x2ec1dc[_0xac1f('0xa3')]=_0x301a4a[_0xac1f('0x61')][_0xac1f('0xa3')]?_0x301a4a[_0xac1f('0x61')][_0xac1f('0xa3')]:_0x2ec1dc[_0xac1f('0xa3')];switch(_0x2ec1dc[_0xac1f('0xa3')]){case _0xac1f('0xa4'):_0x2904b6=squel['insert']()[_0xac1f('0xa5')](_0xac1f('0xa6'))[_0xac1f('0xa7')]([_0xac1f('0xa8'),'scheduledAt','ContactId',_0xac1f('0xa9'),_0xac1f('0x67'),_0xac1f('0x5f'),_0xac1f('0x60')],squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xa8'),'phone')[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0xaa'))[_0xac1f('0x84')]('id',_0xac1f('0xab'))['field'](_0x56a285[_0xac1f('0xac')]['toString'](),_0xac1f('0xa9'))[_0xac1f('0x84')](_0x301a4a[_0xac1f('0x56')]['id']['toString'](),_0xac1f('0x67'))[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0x5f'))[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27','updatedAt')[_0xac1f('0x86')](_0xac1f('0xad'))[_0xac1f('0x4d')](_0xac1f('0xae'))[_0xac1f('0x4d')](_0xac1f('0xaf'),_0x56a285['CmListId'][_0xac1f('0xb0')]())[_0xac1f('0x4d')](_0xac1f('0xb1'))[_0xac1f('0x4d')](_0xac1f('0xb2'),squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xb3'))['from'](_0xac1f('0xb4'))[_0xac1f('0x4d')]('VoiceQueueId\x20=\x20?',_0x301a4a['params']['id'][_0xac1f('0xb0')]()))[_0xac1f('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xac1f('0x83')]()[_0xac1f('0x84')]('COALESCE(phone,\x27\x27)')[_0xac1f('0x86')]('cm_hopper')[_0xac1f('0x4d')](_0xac1f('0x8a'),_0x301a4a['params']['id'][_0xac1f('0xb0')]())))[_0xac1f('0xb0')]();break;case _0xac1f('0xb5'):_0x2904b6=squel[_0xac1f('0xb6')]()[_0xac1f('0xa5')](_0xac1f('0xa6'))[_0xac1f('0xa7')]([_0xac1f('0xa8'),_0xac1f('0xaa'),_0xac1f('0xab'),_0xac1f('0xa9'),_0xac1f('0x67'),'createdAt',_0xac1f('0x60')],squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xa8'),_0xac1f('0xa8'))['field']('\x27'+_0x261f55+'\x27',_0xac1f('0xaa'))[_0xac1f('0x84')]('id',_0xac1f('0xab'))['field'](_0x56a285[_0xac1f('0xac')]['toString'](),_0xac1f('0xa9'))[_0xac1f('0x84')](_0x301a4a['params']['id'][_0xac1f('0xb0')](),'VoiceQueueId')['field']('\x27'+_0x261f55+'\x27',_0xac1f('0x5f'))[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0x60'))[_0xac1f('0x86')](_0xac1f('0xad'))[_0xac1f('0x4d')](_0xac1f('0xae'))[_0xac1f('0x4d')](_0xac1f('0xaf'),_0x56a285[_0xac1f('0xac')]['toString']())[_0xac1f('0x4d')](_0xac1f('0xb1'))[_0xac1f('0x4d')](_0xac1f('0xb2'),squel['select']()[_0xac1f('0x84')]('COALESCE(phone,\x27\x27)')[_0xac1f('0x86')]('cm_hopper')[_0xac1f('0x4d')](_0xac1f('0x8a'),_0x301a4a[_0xac1f('0x56')]['id'][_0xac1f('0xb0')]())))[_0xac1f('0xb0')]();break;default:_0x2904b6=squel[_0xac1f('0xb6')]()['into'](_0xac1f('0xa6'))['fromQuery']([_0xac1f('0xa8'),_0xac1f('0xaa'),_0xac1f('0xab'),_0xac1f('0xa9'),'VoiceQueueId',_0xac1f('0x5f'),'updatedAt'],squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xa8'),_0xac1f('0xa8'))['field']('\x27'+_0x261f55+'\x27','scheduledAt')[_0xac1f('0x84')]('id','ContactId')[_0xac1f('0x84')](_0x56a285['CmListId'][_0xac1f('0xb0')](),'ListId')[_0xac1f('0x84')](_0x301a4a['params']['id'][_0xac1f('0xb0')](),_0xac1f('0x67'))[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0x5f'))['field']('\x27'+_0x261f55+'\x27',_0xac1f('0x60'))['from'](_0xac1f('0xad'))[_0xac1f('0x4d')]('deletedAt\x20IS\x20NULL')[_0xac1f('0x4d')]('ListId\x20=\x20?',_0x56a285[_0xac1f('0xac')][_0xac1f('0xb0')]())[_0xac1f('0x4d')](_0xac1f('0xb1')))[_0xac1f('0xb0')]();}_0x5c6778['push'](db[_0xac1f('0x8e')][_0xac1f('0x43')](_0x2904b6));}return BPromise[_0xac1f('0x90')](_0x5c6778);}})[_0xac1f('0x2c')](function(){var _0x369dc2=[];var _0x34f06b=squel[_0xac1f('0xb6')]()['into'](_0xac1f('0xb7'))[_0xac1f('0xa7')]([_0xac1f('0xb8'),_0xac1f('0xa8'),_0xac1f('0xb9'),_0xac1f('0x5f'),_0xac1f('0x60')],squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xba'))[_0xac1f('0x84')](_0xac1f('0xbb'))[_0xac1f('0x84')]('ci.OrderBy+1')[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0x5f'))[_0xac1f('0x84')]('\x27'+_0x261f55+'\x27',_0xac1f('0x60'))[_0xac1f('0x86')](_0xac1f('0xbc'),'ci')[_0xac1f('0x88')](_0xac1f('0xa6'),'h',_0xac1f('0xbd'))[_0xac1f('0x4d')](_0xac1f('0xbe'),_0x261f55)[_0xac1f('0x4d')]('ci.ItemClass=?',_0xac1f('0xbf')))[_0xac1f('0xb0')]();_0x369dc2[_0xac1f('0x8d')](db['sequelize']['query'](_0x34f06b));return BPromise[_0xac1f('0x90')](_0x369dc2);})[_0xac1f('0x2c')](function(){return _0x1ce770;})['then'](respondWithResult(_0x48840c,null))[_0xac1f('0x54')](handleError(_0x48840c,null));};exports[_0xac1f('0xc0')]=function(_0x1c3940,_0xf68d08,_0xca035c){return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x1c3940[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0xf68d08,null))['then'](function(_0x1b3490){if(_0x1b3490){return _0x1b3490[_0xac1f('0xc0')](_0x1c3940[_0xac1f('0x43')][_0xac1f('0x82')]);}})['then'](function(_0x1a20a3){if(_0x1a20a3){return db[_0xac1f('0x64')][_0xac1f('0x2d')]({'where':{'ListId':_0x1c3940[_0xac1f('0x43')][_0xac1f('0x82')],'VoiceQueueId':_0x1c3940[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](function(){return _0x1a20a3;});}})['then'](respondWithStatusCode(_0xf68d08,null))['catch'](handleError(_0xf68d08,null));};exports[_0xac1f('0xc1')]=function(_0x7316c4,_0x47138b,_0x5b9f0e){var _0x372a43={};var _0x18f1df={};var _0x2714b7;var _0x339089;return db[_0xac1f('0x3e')][_0xac1f('0x69')]({'where':{'id':_0x7316c4[_0xac1f('0x56')]['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x47138b,null))[_0xac1f('0x2c')](function(_0x5ec98f){if(_0x5ec98f){_0x2714b7=_0x5ec98f;_0x18f1df[_0xac1f('0x42')]=_[_0xac1f('0x44')](db[_0xac1f('0xa0')][_0xac1f('0x3f')]);_0x18f1df[_0xac1f('0x43')]=_[_0xac1f('0x44')](_0x7316c4[_0xac1f('0x43')]);_0x18f1df[_0xac1f('0x45')]=_['intersection'](_0x18f1df[_0xac1f('0x42')],_0x18f1df[_0xac1f('0x43')]);_0x372a43[_0xac1f('0x46')]=_['intersection'](_0x18f1df[_0xac1f('0x42')],qs[_0xac1f('0x48')](_0x7316c4[_0xac1f('0x43')][_0xac1f('0x48')]));_0x372a43[_0xac1f('0x46')]=_0x372a43[_0xac1f('0x46')][_0xac1f('0x49')]?_0x372a43[_0xac1f('0x46')]:_0x18f1df['model'];_0x372a43['order']=qs['sort'](_0x7316c4[_0xac1f('0x43')]['sort']);_0x372a43[_0xac1f('0x4d')]=qs[_0xac1f('0x45')](_['pick'](_0x7316c4[_0xac1f('0x43')],_0x18f1df[_0xac1f('0x45')]));if(_0x7316c4[_0xac1f('0x43')]['filter']){_0x372a43[_0xac1f('0x4d')]=_[_0xac1f('0x4e')](_0x372a43['where'],{'$or':_[_0xac1f('0x3d')](_0x372a43['attributes'],function(_0x208ea3){var _0x4e6565={};_0x4e6565[_0x208ea3]={'$like':'%'+_0x7316c4['query'][_0xac1f('0x32')]+'%'};return _0x4e6565;})});}_0x372a43=_['merge']({},_0x372a43,_0x7316c4[_0xac1f('0x4f')]);return _0x2714b7[_0xac1f('0xc1')](_0x372a43);}})[_0xac1f('0x2c')](function(_0x34d82b){if(_0x34d82b){_0x339089=_0x34d82b[_0xac1f('0x49')];if(!_0x7316c4[_0xac1f('0x43')][_0xac1f('0x65')](_0xac1f('0x66'))){_0x372a43[_0xac1f('0x24')]=qs['limit'](_0x7316c4[_0xac1f('0x43')][_0xac1f('0x24')]);_0x372a43[_0xac1f('0x23')]=qs[_0xac1f('0x23')](_0x7316c4[_0xac1f('0x43')][_0xac1f('0x23')]);}return _0x2714b7[_0xac1f('0xc1')](_0x372a43);}})[_0xac1f('0x2c')](function(_0x156b13){if(_0x156b13){return _0x156b13?{'count':_0x339089,'rows':_0x156b13}:null;}})[_0xac1f('0x2c')](respondWithResult(_0x47138b,null))[_0xac1f('0x54')](handleError(_0x47138b,null));};exports[_0xac1f('0xc2')]=function(_0x55f31a,_0x4bbe57,_0x23e873){var _0xc0b865,_0x3765ff;return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x55f31a['params']['id']}})['then'](handleEntityNotFound(_0x4bbe57,null))[_0xac1f('0x2c')](function(_0x23f615){if(_0x23f615){_0x3765ff=_0x23f615;return _0x23f615['addBlackLists'](_0x55f31a[_0xac1f('0x61')]['ids'],_['omit'](_0x55f31a['body'],[_0xac1f('0x82'),'id'])||{});}return null;})['spread'](function(_0x2c45f5){var _0x80524b;_0xc0b865=_0x2c45f5||[];var _0x414080=[];if(_0x2c45f5){for(var _0x11a9cf=0x0;_0x11a9cf<_0x2c45f5[_0xac1f('0x49')];_0x11a9cf+=0x1){var _0x1f6fad=_0x2c45f5[_0x11a9cf][_0xac1f('0x2e')]({'plain':!![]});_0x80524b=squel[_0xac1f('0xb6')]()[_0xac1f('0xa5')]('cm_hopper_black')[_0xac1f('0xa7')]([_0xac1f('0xa8'),'ContactId',_0xac1f('0xa9'),'VoiceQueueId',_0xac1f('0x5f'),_0xac1f('0x60')],squel[_0xac1f('0x83')]()[_0xac1f('0x84')](_0xac1f('0xa8'),'phone')['field']('id',_0xac1f('0xab'))[_0xac1f('0x84')](_0x1f6fad['CmListId'][_0xac1f('0xb0')](),_0xac1f('0xa9'))[_0xac1f('0x84')](_0x55f31a[_0xac1f('0x56')]['id'][_0xac1f('0xb0')](),_0xac1f('0x67'))[_0xac1f('0x84')](_0xac1f('0xc3'),_0xac1f('0x5f'))[_0xac1f('0x84')](_0xac1f('0xc3'),_0xac1f('0x60'))[_0xac1f('0x86')](_0xac1f('0xad'))[_0xac1f('0x4d')](_0xac1f('0xae'))[_0xac1f('0x4d')](_0xac1f('0xaf'),_0x1f6fad['CmListId'][_0xac1f('0xb0')]())['where'](_0xac1f('0xb1')))[_0xac1f('0xb0')]();_0x414080[_0xac1f('0x8d')](db[_0xac1f('0x8e')][_0xac1f('0x43')](_0x80524b));}return BPromise[_0xac1f('0x90')](_0x414080);}})['then'](function(){return _0xc0b865;})['then'](respondWithResult(_0x4bbe57,null))[_0xac1f('0x54')](handleError(_0x4bbe57,null));};exports['removeBlackLists']=function(_0x387116,_0x1548af,_0xc00584){return db[_0xac1f('0x3e')][_0xac1f('0x35')]({'where':{'id':_0x387116['params']['id']}})[_0xac1f('0x2c')](handleEntityNotFound(_0x1548af,null))[_0xac1f('0x2c')](function(_0x150311){if(_0x150311){return _0x150311[_0xac1f('0xc4')](_0x387116[_0xac1f('0x43')][_0xac1f('0x82')]);}})['then'](function(_0x322cb9){if(_0x322cb9){return db[_0xac1f('0x6e')][_0xac1f('0x2d')]({'where':{'ListId':_0x387116[_0xac1f('0x43')][_0xac1f('0x82')],'VoiceQueueId':_0x387116['params']['id']}})[_0xac1f('0x2c')](function(){return _0x322cb9;});}})['then'](respondWithStatusCode(_0x1548af,null))[_0xac1f('0x54')](handleError(_0x1548af,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 26395eb..3513fba 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 _0x64df=['events','../../mysqldb','VoiceQueue','setMaxListeners','emit','hasOwnProperty'];(function(_0x15766e,_0x2c0464){var _0x562cf9=function(_0x34c671){while(--_0x34c671){_0x15766e['push'](_0x15766e['shift']());}};_0x562cf9(++_0x2c0464);}(_0x64df,0x1bc));var _0xf64d=function(_0x656222,_0x158bdc){_0x656222=_0x656222-0x0;var _0x20790b=_0x64df[_0x656222];return _0x20790b;};'use strict';var EventEmitter=require(_0xf64d('0x0'));var VoiceQueue=require(_0xf64d('0x1'))['db'][_0xf64d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf64d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5278ce){return function(_0x3b4ddc,_0x11ce3b,_0x416499){VoiceQueueEvents[_0xf64d('0x4')](_0x5278ce+':'+_0x3b4ddc['id'],_0x3b4ddc);VoiceQueueEvents['emit'](_0x5278ce,_0x3b4ddc);_0x416499(null);};}for(var e in events){if(events[_0xf64d('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x8ca9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ca9,0x1c6));var _0x98ca=function(_0x4026c8,_0x477780){_0x4026c8=_0x4026c8-0x0;var _0xf7aeba=_0x8ca9[_0x4026c8];return _0xf7aeba;};'use strict';var EventEmitter=require(_0x98ca('0x0'));var VoiceQueue=require(_0x98ca('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x98ca('0x2')](0x0);var events={'afterCreate':_0x98ca('0x3'),'afterUpdate':_0x98ca('0x4'),'afterDestroy':_0x98ca('0x5')};function emitEvent(_0x13ba97){return function(_0x2d4578,_0x247344,_0x190351){VoiceQueueEvents[_0x98ca('0x6')](_0x13ba97+':'+_0x2d4578['id'],_0x2d4578);VoiceQueueEvents[_0x98ca('0x6')](_0x13ba97,_0x2d4578);_0x190351(null);};}for(var e in events){if(events[_0x98ca('0x7')](e)){var event=events[e];VoiceQueue[_0x98ca('0x8')](e,emitEvent(event));}}module[_0x98ca('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5b86b1a..435db3d 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0x3e74,0x175));var _0x43e7=function(_0x2aaca4,_0x3dc18d){_0x2aaca4=_0x2aaca4-0x0;var _0x38ce78=_0x3e74[_0x2aaca4];return _0x38ce78;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1f97cd,_0x3d0dc0){var _0x2e78c6=function(_0x24f621){while(--_0x24f621){_0x1f97cd['push'](_0x1f97cd['shift']());}};_0x2e78c6(++_0x3d0dc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index face514..6674410 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 _0xdf80=['socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueue','VoiceQueue','options','where','limit','map','include','attributes','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x5a1b51,_0x5b869b){var _0x1eb59e=function(_0x56274a){while(--_0x56274a){_0x5a1b51['push'](_0x5a1b51['shift']());}};_0x1eb59e(++_0x5b869b);}(_0xdf80,0x1ec));var _0x0df8=function(_0x3e9fdb,_0x40622){_0x3e9fdb=_0x3e9fdb-0x0;var _0xf847c4=_0xdf80[_0x3e9fdb];return _0xf847c4;};'use strict';var _=require(_0x0df8('0x0'));var util=require(_0x0df8('0x1'));var moment=require(_0x0df8('0x2'));var BPromise=require(_0x0df8('0x3'));var rs=require(_0x0df8('0x4'));var fs=require('fs');var Redis=require(_0x0df8('0x5'));var db=require(_0x0df8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0df8('0x7'))(_0x0df8('0x8'));var config=require(_0x0df8('0x9'));var jayson=require(_0x0df8('0xa'));var client=jayson[_0x0df8('0xb')]['http']({'port':0x232a});config[_0x0df8('0xc')]=_[_0x0df8('0xd')](config[_0x0df8('0xc')],{'host':_0x0df8('0xe'),'port':0x18eb});var socket=require(_0x0df8('0xf'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0df8('0x10')](socket);function respondWithRpcPromise(_0x188530,_0x2a5f66,_0x26c54d){return new BPromise(function(_0x103db8,_0x422de5){return client['request'](_0x188530,_0x26c54d)[_0x0df8('0x11')](function(_0xb70f94){logger[_0x0df8('0x12')](_0x0df8('0x13'),_0x2a5f66,'request\x20sent');logger['debug'](_0x0df8('0x14'),_0x2a5f66,'request\x20sent',JSON[_0x0df8('0x15')](_0xb70f94));if(_0xb70f94['error']){if(_0xb70f94[_0x0df8('0x16')]['code']===0x1f4){logger['error'](_0x0df8('0x13'),_0x2a5f66,_0xb70f94['error'][_0x0df8('0x17')]);return _0x422de5(_0xb70f94[_0x0df8('0x16')][_0x0df8('0x17')]);}logger[_0x0df8('0x16')](_0x0df8('0x13'),_0x2a5f66,_0xb70f94[_0x0df8('0x16')][_0x0df8('0x17')]);return _0x103db8(_0xb70f94[_0x0df8('0x16')][_0x0df8('0x17')]);}else{logger[_0x0df8('0x12')](_0x0df8('0x13'),_0x2a5f66,_0x0df8('0x18'));_0x103db8(_0xb70f94[_0x0df8('0x19')][_0x0df8('0x17')]);}})[_0x0df8('0x1a')](function(_0x136ee6){logger[_0x0df8('0x16')](_0x0df8('0x13'),_0x2a5f66,_0x136ee6);_0x422de5(_0x136ee6);});});}exports[_0x0df8('0x1b')]=function(_0x4f9b51){var _0x51b393=this;return new Promise(function(_0x44f234,_0x113137){return db[_0x0df8('0x1c')]['findAll']({'raw':_0x4f9b51[_0x0df8('0x1d')]?_0x4f9b51[_0x0df8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4f9b51[_0x0df8('0x1d')]?_0x4f9b51[_0x0df8('0x1d')][_0x0df8('0x1e')]||null:null,'attributes':_0x4f9b51[_0x0df8('0x1d')]?_0x4f9b51[_0x0df8('0x1d')]['attributes']||null:null,'limit':_0x4f9b51[_0x0df8('0x1d')]?_0x4f9b51['options'][_0x0df8('0x1f')]||null:null,'include':_0x4f9b51[_0x0df8('0x1d')]?_0x4f9b51[_0x0df8('0x1d')]['include']?_[_0x0df8('0x20')](_0x4f9b51[_0x0df8('0x1d')][_0x0df8('0x21')],function(_0x361db1){return{'model':db[_0x361db1['model']],'as':_0x361db1['as'],'attributes':_0x361db1[_0x0df8('0x22')],'include':_0x361db1['include']?_[_0x0df8('0x20')](_0x361db1[_0x0df8('0x21')],function(_0x154545){return{'model':db[_0x154545[_0x0df8('0x23')]],'as':_0x154545['as'],'attributes':_0x154545['attributes'],'include':_0x154545[_0x0df8('0x21')]?_[_0x0df8('0x20')](_0x154545['include'],function(_0x33b7af){return{'model':db[_0x33b7af[_0x0df8('0x23')]],'as':_0x33b7af['as'],'attributes':_0x33b7af[_0x0df8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0df8('0x11')](function(_0x2f019d){logger['info']('GetVoiceQueue',_0x4f9b51);logger[_0x0df8('0x24')](_0x0df8('0x1b'),_0x4f9b51,JSON[_0x0df8('0x15')](_0x2f019d));_0x44f234(_0x2f019d);})[_0x0df8('0x1a')](function(_0x21fd7c){logger['error'](_0x0df8('0x1b'),_0x21fd7c[_0x0df8('0x17')],_0x4f9b51);_0x113137(_0x51b393[_0x0df8('0x16')](0x1f4,_0x21fd7c[_0x0df8('0x17')]));});});};exports[_0x0df8('0x25')]=function(_0x25015b){var _0x5aac19=this;return new Promise(function(_0x5ebe6c,_0x38c111){return db[_0x0df8('0x1c')][_0x0df8('0x26')]({'raw':_0x25015b[_0x0df8('0x1d')]?_0x25015b['options']['raw']===undefined?!![]:![]:!![],'where':_0x25015b['options']?_0x25015b[_0x0df8('0x1d')][_0x0df8('0x1e')]||null:null,'attributes':_0x25015b[_0x0df8('0x1d')]?_0x25015b[_0x0df8('0x1d')][_0x0df8('0x22')]||null:null,'include':_0x25015b['options']?_0x25015b[_0x0df8('0x1d')][_0x0df8('0x21')]?_[_0x0df8('0x20')](_0x25015b[_0x0df8('0x1d')]['include'],function(_0x3821a7){return{'model':db[_0x3821a7[_0x0df8('0x23')]],'as':_0x3821a7['as'],'attributes':_0x3821a7[_0x0df8('0x22')],'include':_0x3821a7[_0x0df8('0x21')]?_['map'](_0x3821a7['include'],function(_0x3ade4a){return{'model':db[_0x3ade4a[_0x0df8('0x23')]],'as':_0x3ade4a['as'],'attributes':_0x3ade4a[_0x0df8('0x22')],'include':_0x3ade4a['include']?_[_0x0df8('0x20')](_0x3ade4a[_0x0df8('0x21')],function(_0xa89488){return{'model':db[_0xa89488['model']],'as':_0xa89488['as'],'attributes':_0xa89488[_0x0df8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0df8('0x11')](function(_0x27fe8b){logger[_0x0df8('0x12')](_0x0df8('0x25'),_0x25015b);logger['debug'](_0x0df8('0x25'),_0x25015b,JSON[_0x0df8('0x15')](_0x27fe8b));_0x5ebe6c(_0x27fe8b);})[_0x0df8('0x1a')](function(_0x1dd9de){logger[_0x0df8('0x16')](_0x0df8('0x25'),_0x1dd9de['message'],_0x25015b);_0x38c111(_0x5aac19[_0x0df8('0x16')](0x1f4,_0x1dd9de[_0x0df8('0x17')]));});});}; \ No newline at end of file +var _0x5c4d=['then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request'];(function(_0x4c92e2,_0x4c7caa){var _0x4c5ccb=function(_0x338f66){while(--_0x338f66){_0x4c92e2['push'](_0x4c92e2['shift']());}};_0x4c5ccb(++_0x4c7caa);}(_0x5c4d,0x6a));var _0xd5c4=function(_0x5debab,_0x2abef8){_0x5debab=_0x5debab-0x0;var _0x20333e=_0x5c4d[_0x5debab];return _0x20333e;};'use strict';var _=require(_0xd5c4('0x0'));var util=require('util');var moment=require(_0xd5c4('0x1'));var BPromise=require(_0xd5c4('0x2'));var rs=require(_0xd5c4('0x3'));var fs=require('fs');var Redis=require(_0xd5c4('0x4'));var db=require(_0xd5c4('0x5'))['db'];var utils=require(_0xd5c4('0x6'));var logger=require(_0xd5c4('0x7'))(_0xd5c4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd5c4('0x9')][_0xd5c4('0xa')]({'port':0x232a});config['redis']=_[_0xd5c4('0xb')](config[_0xd5c4('0xc')],{'host':_0xd5c4('0xd'),'port':0x18eb});var socket=require(_0xd5c4('0xe'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xd5c4('0xf')](socket);function respondWithRpcPromise(_0x45b5b5,_0x14b53f,_0xfb0f9d){return new BPromise(function(_0xf98cb9,_0x56891a){return client[_0xd5c4('0x10')](_0x45b5b5,_0xfb0f9d)[_0xd5c4('0x11')](function(_0x35ca7c){logger[_0xd5c4('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x14b53f,_0xd5c4('0x13'));logger[_0xd5c4('0x14')](_0xd5c4('0x15'),_0x14b53f,_0xd5c4('0x13'),JSON[_0xd5c4('0x16')](_0x35ca7c));if(_0x35ca7c['error']){if(_0x35ca7c[_0xd5c4('0x17')]['code']===0x1f4){logger[_0xd5c4('0x17')](_0xd5c4('0x18'),_0x14b53f,_0x35ca7c[_0xd5c4('0x17')][_0xd5c4('0x19')]);return _0x56891a(_0x35ca7c[_0xd5c4('0x17')][_0xd5c4('0x19')]);}logger[_0xd5c4('0x17')](_0xd5c4('0x18'),_0x14b53f,_0x35ca7c[_0xd5c4('0x17')][_0xd5c4('0x19')]);return _0xf98cb9(_0x35ca7c[_0xd5c4('0x17')]['message']);}else{logger[_0xd5c4('0x12')](_0xd5c4('0x18'),_0x14b53f,'request\x20sent');_0xf98cb9(_0x35ca7c[_0xd5c4('0x1a')]['message']);}})[_0xd5c4('0x1b')](function(_0x12f718){logger[_0xd5c4('0x17')](_0xd5c4('0x18'),_0x14b53f,_0x12f718);_0x56891a(_0x12f718);});});}exports[_0xd5c4('0x1c')]=function(_0x1e9c58){var _0x5679ce=this;return new Promise(function(_0x3bdc44,_0x30a5bb){return db['VoiceQueue'][_0xd5c4('0x1d')]({'raw':_0x1e9c58[_0xd5c4('0x1e')]?_0x1e9c58['options'][_0xd5c4('0x1f')]===undefined?!![]:![]:!![],'where':_0x1e9c58[_0xd5c4('0x1e')]?_0x1e9c58[_0xd5c4('0x1e')]['where']||null:null,'attributes':_0x1e9c58[_0xd5c4('0x1e')]?_0x1e9c58['options'][_0xd5c4('0x20')]||null:null,'limit':_0x1e9c58[_0xd5c4('0x1e')]?_0x1e9c58['options'][_0xd5c4('0x21')]||null:null,'include':_0x1e9c58[_0xd5c4('0x1e')]?_0x1e9c58[_0xd5c4('0x1e')]['include']?_['map'](_0x1e9c58[_0xd5c4('0x1e')]['include'],function(_0x51a680){return{'model':db[_0x51a680['model']],'as':_0x51a680['as'],'attributes':_0x51a680[_0xd5c4('0x20')],'include':_0x51a680['include']?_['map'](_0x51a680['include'],function(_0xe83138){return{'model':db[_0xe83138['model']],'as':_0xe83138['as'],'attributes':_0xe83138[_0xd5c4('0x20')],'include':_0xe83138[_0xd5c4('0x22')]?_[_0xd5c4('0x23')](_0xe83138['include'],function(_0x43c2ef){return{'model':db[_0x43c2ef[_0xd5c4('0x24')]],'as':_0x43c2ef['as'],'attributes':_0x43c2ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5c4('0x11')](function(_0x539e75){logger['info'](_0xd5c4('0x1c'),_0x1e9c58);logger[_0xd5c4('0x14')](_0xd5c4('0x1c'),_0x1e9c58,JSON['stringify'](_0x539e75));_0x3bdc44(_0x539e75);})[_0xd5c4('0x1b')](function(_0x2bbfba){logger[_0xd5c4('0x17')](_0xd5c4('0x1c'),_0x2bbfba[_0xd5c4('0x19')],_0x1e9c58);_0x30a5bb(_0x5679ce['error'](0x1f4,_0x2bbfba[_0xd5c4('0x19')]));});});};exports[_0xd5c4('0x25')]=function(_0xf7df01){var _0x342610=this;return new Promise(function(_0x1ce612,_0x44485d){return db[_0xd5c4('0x26')][_0xd5c4('0x27')]({'raw':_0xf7df01[_0xd5c4('0x1e')]?_0xf7df01[_0xd5c4('0x1e')][_0xd5c4('0x1f')]===undefined?!![]:![]:!![],'where':_0xf7df01[_0xd5c4('0x1e')]?_0xf7df01[_0xd5c4('0x1e')][_0xd5c4('0x28')]||null:null,'attributes':_0xf7df01[_0xd5c4('0x1e')]?_0xf7df01[_0xd5c4('0x1e')][_0xd5c4('0x20')]||null:null,'include':_0xf7df01[_0xd5c4('0x1e')]?_0xf7df01['options']['include']?_[_0xd5c4('0x23')](_0xf7df01[_0xd5c4('0x1e')][_0xd5c4('0x22')],function(_0x4f2b1f){return{'model':db[_0x4f2b1f[_0xd5c4('0x24')]],'as':_0x4f2b1f['as'],'attributes':_0x4f2b1f[_0xd5c4('0x20')],'include':_0x4f2b1f['include']?_['map'](_0x4f2b1f[_0xd5c4('0x22')],function(_0x4ca094){return{'model':db[_0x4ca094[_0xd5c4('0x24')]],'as':_0x4ca094['as'],'attributes':_0x4ca094[_0xd5c4('0x20')],'include':_0x4ca094[_0xd5c4('0x22')]?_[_0xd5c4('0x23')](_0x4ca094[_0xd5c4('0x22')],function(_0x5e1caf){return{'model':db[_0x5e1caf[_0xd5c4('0x24')]],'as':_0x5e1caf['as'],'attributes':_0x5e1caf[_0xd5c4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd5c4('0x11')](function(_0x1e7193){logger[_0xd5c4('0x12')](_0xd5c4('0x25'),_0xf7df01);logger[_0xd5c4('0x14')]('ShowVoiceQueue',_0xf7df01,JSON[_0xd5c4('0x16')](_0x1e7193));_0x1ce612(_0x1e7193);})[_0xd5c4('0x1b')](function(_0x179512){logger[_0xd5c4('0x17')]('ShowVoiceQueue',_0x179512[_0xd5c4('0x19')],_0xf7df01);_0x44485d(_0x342610['error'](0x1f4,_0x179512['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f6a5e3c..8a7ed73 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 _0x1df8=['emit','removeListener','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x273ebd,_0x1fd1ab){var _0x430974=function(_0x4929ff){while(--_0x4929ff){_0x273ebd['push'](_0x273ebd['shift']());}};_0x430974(++_0x1fd1ab);}(_0x1df8,0x184));var _0x81df=function(_0x743b0b,_0x4f30bb){_0x743b0b=_0x743b0b-0x0;var _0x1a52d2=_0x1df8[_0x743b0b];return _0x1a52d2;};'use strict';var VoiceQueueEvents=require(_0x81df('0x0'));var events=[_0x81df('0x1'),_0x81df('0x2'),_0x81df('0x3')];function createListener(_0x162255,_0x484723){return function(_0x32bf7f){_0x484723[_0x81df('0x4')](_0x162255,_0x32bf7f);};}function removeListener(_0x5b0753,_0x4b2101){return function(){VoiceQueueEvents[_0x81df('0x5')](_0x5b0753,_0x4b2101);};}exports['register']=function(_0x2222b8){for(var _0x43bad7=0x0,_0x44aaa0=events['length'];_0x43bad7<_0x44aaa0;_0x43bad7++){var _0x6339a1=events[_0x43bad7];var _0xb5086=createListener(_0x81df('0x6')+_0x6339a1,_0x2222b8);VoiceQueueEvents['on'](_0x6339a1,_0xb5086);}}; \ No newline at end of file +var _0x716e=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x716e,0x13b));var _0xe716=function(_0x804239,_0x4ac7a5){_0x804239=_0x804239-0x0;var _0x4a5199=_0x716e[_0x804239];return _0x4a5199;};'use strict';var VoiceQueueEvents=require(_0xe716('0x0'));var events=[_0xe716('0x1'),_0xe716('0x2'),_0xe716('0x3')];function createListener(_0x477aa1,_0xfcb1d9){return function(_0x43fc78){_0xfcb1d9[_0xe716('0x4')](_0x477aa1,_0x43fc78);};}function removeListener(_0xe6c912,_0x4b5867){return function(){VoiceQueueEvents['removeListener'](_0xe6c912,_0x4b5867);};}exports[_0xe716('0x5')]=function(_0x10d7f9){for(var _0x2a7d31=0x0,_0x5dbba9=events[_0xe716('0x6')];_0x2a7d31<_0x5dbba9;_0x2a7d31++){var _0x337d3b=events[_0x2a7d31];var _0x4f7071=createListener(_0xe716('0x7')+_0x337d3b,_0x10d7f9);VoiceQueueEvents['on'](_0x337d3b,_0x4f7071);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 053bbeb..8379e1d 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 _0xb411=['get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3a90ff,_0x4b480f){var _0x21531c=function(_0xea98ae){while(--_0xea98ae){_0x3a90ff['push'](_0x3a90ff['shift']());}};_0x21531c(++_0x4b480f);}(_0xb411,0x12b));var _0x1b41=function(_0x3cd3ca,_0x27920a){_0x3cd3ca=_0x3cd3ca-0x0;var _0x4e9890=_0xb411[_0x3cd3ca];return _0x4e9890;};'use strict';var multer=require('multer');var util=require(_0x1b41('0x0'));var path=require(_0x1b41('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b41('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1b41('0x3'));var config=require(_0x1b41('0x4'));var controller=require('./voiceQueueReport.controller');router[_0x1b41('0x5')]('/',auth[_0x1b41('0x6')](),controller[_0x1b41('0x7')]);router[_0x1b41('0x5')](_0x1b41('0x8'),auth[_0x1b41('0x6')](),controller[_0x1b41('0x9')]);router[_0x1b41('0x5')](_0x1b41('0xa'),auth[_0x1b41('0x6')](),controller['getVoiceQueuesReport']);router['get'](_0x1b41('0xb'),auth[_0x1b41('0x6')](),controller[_0x1b41('0xc')]);router[_0x1b41('0xd')]('/',auth[_0x1b41('0x6')](),controller['create']);router[_0x1b41('0xe')]('/:id',auth[_0x1b41('0x6')](),controller[_0x1b41('0xf')]);router[_0x1b41('0x10')](_0x1b41('0xb'),auth['isAuthenticated'](),controller[_0x1b41('0x11')]);module[_0x1b41('0x12')]=router; \ No newline at end of file +var _0x047c=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','post','put','/:id','update','delete','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x047c,0x1b8));var _0xc047=function(_0xf9cb79,_0x57cb52){_0xf9cb79=_0xf9cb79-0x0;var _0x4358e5=_0x047c[_0xf9cb79];return _0x4358e5;};'use strict';var multer=require(_0xc047('0x0'));var util=require(_0xc047('0x1'));var path=require(_0xc047('0x2'));var timeout=require(_0xc047('0x3'));var express=require(_0xc047('0x4'));var router=express[_0xc047('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc047('0x6'));var config=require(_0xc047('0x7'));var controller=require(_0xc047('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc047('0x9')]);router[_0xc047('0xa')]('/describe',auth[_0xc047('0xb')](),controller[_0xc047('0xc')]);router['get'](_0xc047('0xd'),auth[_0xc047('0xb')](),controller[_0xc047('0xe')]);router[_0xc047('0xa')]('/:id',auth[_0xc047('0xb')](),controller['show']);router[_0xc047('0xf')]('/',auth[_0xc047('0xb')](),controller['create']);router[_0xc047('0x10')](_0xc047('0x11'),auth['isAuthenticated'](),controller[_0xc047('0x12')]);router[_0xc047('0x13')](_0xc047('0x11'),auth[_0xc047('0xb')](),controller['destroy']);module[_0xc047('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5e4e31b..896a8fb 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 _0xe60c=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xe60c,0x170));var _0xce60=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0xe60c[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require(_0xce60('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xce60('0x1')]},'uniqueid':{'type':Sequelize[_0xce60('0x1')]},'calleridnum':{'type':Sequelize[_0xce60('0x1')]},'calleridname':{'type':Sequelize[_0xce60('0x1')]},'queue':{'type':Sequelize[_0xce60('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xce60('0x2')],'set':function(_0x5d5ced){var _0x3dbbcc=moment(_0x5d5ced);var _0x48796b=moment(this[_0xce60('0x3')]('queuecallerjoinAt'))['format'](_0xce60('0x4'));var _0x553637=_0x3dbbcc[_0xce60('0x5')](_0x48796b,_0xce60('0x6'));this['setDataValue'](_0xce60('0x7'),_0x5d5ced);this[_0xce60('0x8')](_0xce60('0x9'),_0x553637||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xce60('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xce60('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xce60('0x2')]},'queuecallerexit':{'type':Sequelize[_0xce60('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xce60('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xce60('0x1')],'comment':_0xce60('0xc')},'originalposition':{'type':Sequelize[_0xce60('0xa')]},'channel':{'type':Sequelize[_0xce60('0x1')]},'connectedlinenum':{'type':Sequelize[_0xce60('0x1')]},'connectedlinename':{'type':Sequelize[_0xce60('0x1')]},'accountcode':{'type':Sequelize[_0xce60('0x1')]},'context':{'type':Sequelize[_0xce60('0x1')]},'exten':{'type':Sequelize[_0xce60('0x1')]},'priority':{'type':Sequelize[_0xce60('0x1')]},'holdtime':{'type':Sequelize[_0xce60('0xa')]},'mohtime':{'type':Sequelize[_0xce60('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xce60('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xce60('0x1')]},'transfer':{'type':Sequelize[_0xce60('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce60('0x1')],'comment':_0xce60('0xd')},'transferexten':{'type':Sequelize[_0xce60('0x1')]},'transferuniqueid':{'type':Sequelize[_0xce60('0x1')]},'disposition':{'type':Sequelize[_0xce60('0x1')]},'secondDisposition':{'type':Sequelize[_0xce60('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xce60('0x1')]}}; \ No newline at end of file +var _0x3f6c=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt'];(function(_0x4dd81a,_0x3c8236){var _0x4309b9=function(_0x13dbcc){while(--_0x13dbcc){_0x4dd81a['push'](_0x4dd81a['shift']());}};_0x4309b9(++_0x3c8236);}(_0x3f6c,0x7a));var _0xc3f6=function(_0x14709f,_0x2d4534){_0x14709f=_0x14709f-0x0;var _0x5a1e1f=_0x3f6c[_0x14709f];return _0x5a1e1f;};'use strict';var Sequelize=require(_0xc3f6('0x0'));var moment=require(_0xc3f6('0x1'));module[_0xc3f6('0x2')]={'type':{'type':Sequelize[_0xc3f6('0x3')]},'uniqueid':{'type':Sequelize[_0xc3f6('0x3')]},'calleridnum':{'type':Sequelize[_0xc3f6('0x3')]},'calleridname':{'type':Sequelize[_0xc3f6('0x3')]},'queue':{'type':Sequelize[_0xc3f6('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xc3f6('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x41e288){var _0x4e2a01=moment(_0x41e288);var _0x5e5e08=moment(this['getDataValue'](_0xc3f6('0x5')))[_0xc3f6('0x6')](_0xc3f6('0x7'));var _0x5ca306=_0x4e2a01[_0xc3f6('0x8')](_0x5e5e08,_0xc3f6('0x9'));this['setDataValue']('queuecallerleaveAt',_0x41e288);this[_0xc3f6('0xa')](_0xc3f6('0xb'),_0x5ca306||null);}},'position':{'type':Sequelize[_0xc3f6('0xc')]},'count':{'type':Sequelize[_0xc3f6('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xc3f6('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc3f6('0x4')]},'queuecallerexit':{'type':Sequelize[_0xc3f6('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc3f6('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xc3f6('0xe')},'originalposition':{'type':Sequelize[_0xc3f6('0xc')]},'channel':{'type':Sequelize[_0xc3f6('0x3')]},'connectedlinenum':{'type':Sequelize[_0xc3f6('0x3')]},'connectedlinename':{'type':Sequelize[_0xc3f6('0x3')]},'accountcode':{'type':Sequelize[_0xc3f6('0x3')]},'context':{'type':Sequelize[_0xc3f6('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc3f6('0x3')]},'holdtime':{'type':Sequelize[_0xc3f6('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc3f6('0x3')]},'transfer':{'type':Sequelize[_0xc3f6('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc3f6('0x3')],'comment':_0xc3f6('0xf')},'transferexten':{'type':Sequelize[_0xc3f6('0x3')]},'transferuniqueid':{'type':Sequelize[_0xc3f6('0x3')]},'disposition':{'type':Sequelize[_0xc3f6('0x3')]},'secondDisposition':{'type':Sequelize[_0xc3f6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xc3f6('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xc3f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 837fb0a..7873a93 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 _0x6dac=['../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','index','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','rows','catch','show','params','model','keys','find','create','body','describe','pick','map','findAll','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x6dac,0xe1));var _0xc6da=function(_0x1249db,_0xe5b1b5){_0x1249db=_0x1249db-0x0;var _0x4a68b6=_0x6dac[_0x1249db];return _0x4a68b6;};'use strict';var emlformat=require(_0xc6da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6da('0x1'));var jsonpatch=require(_0xc6da('0x2'));var rp=require('request-promise');var moment=require(_0xc6da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6da('0x4'));var util=require(_0xc6da('0x5'));var path=require(_0xc6da('0x6'));var sox=require('sox');var csv=require(_0xc6da('0x7'));var ejs=require(_0xc6da('0x8'));var fs=require('fs');var fs_extra=require(_0xc6da('0x9'));var _=require(_0xc6da('0xa'));var squel=require(_0xc6da('0xb'));var crypto=require(_0xc6da('0xc'));var jsforce=require(_0xc6da('0xd'));var deskjs=require(_0xc6da('0xe'));var toCsv=require(_0xc6da('0x7'));var querystring=require(_0xc6da('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6da('0x10'));var qs=require(_0xc6da('0x11'));var as=require(_0xc6da('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6da('0x13'))(_0xc6da('0x14'));var utils=require(_0xc6da('0x15'));var config=require(_0xc6da('0x16'));var licenseUtil=require(_0xc6da('0x17'));var db=require(_0xc6da('0x18'))['db'];config[_0xc6da('0x19')]=_['defaults'](config[_0xc6da('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6da('0x1a'))(new Redis(config[_0xc6da('0x19')]));require(_0xc6da('0x1b'))[_0xc6da('0x1c')](socket);function respondWithStatusCode(_0x2c650e,_0x49bd81){_0x49bd81=_0x49bd81||0xcc;return function(_0x427039){if(_0x427039){return _0x2c650e[_0xc6da('0x1d')](_0x49bd81);}return _0x2c650e[_0xc6da('0x1e')](_0x49bd81)[_0xc6da('0x1f')]();};}function respondWithResult(_0x1135f8,_0xf06397){_0xf06397=_0xf06397||0xc8;return function(_0x436946){if(_0x436946){return _0x1135f8['status'](_0xf06397)['json'](_0x436946);}};}function respondWithFilteredResult(_0x42d370,_0x24b17d){return function(_0x5dd0ed){if(_0x5dd0ed){var _0x516c5d=typeof _0x24b17d[_0xc6da('0x20')]===_0xc6da('0x21')&&typeof _0x24b17d[_0xc6da('0x22')]==='undefined';var _0x5ed355=_0x5dd0ed['count'];var _0x85a566=_0x516c5d?0x0:_0x24b17d['offset'];var _0x4664c0=_0x516c5d?_0x5dd0ed[_0xc6da('0x23')]:_0x24b17d['offset']+_0x24b17d[_0xc6da('0x22')];var _0x3162f0;if(_0x4664c0>=_0x5ed355){_0x4664c0=_0x5ed355;_0x3162f0=0xc8;}else{_0x3162f0=0xce;}_0x42d370['status'](_0x3162f0);return _0x42d370[_0xc6da('0x24')](_0xc6da('0x25'),_0x85a566+'-'+_0x4664c0+'/'+_0x5ed355)[_0xc6da('0x26')](_0x5dd0ed);}return null;};}function patchUpdates(_0x401a98){return function(_0x445e2e){try{jsonpatch[_0xc6da('0x27')](_0x445e2e,_0x401a98,!![]);}catch(_0x11c7a6){return BPromise[_0xc6da('0x28')](_0x11c7a6);}return _0x445e2e[_0xc6da('0x29')]();};}function saveUpdates(_0x34f923,_0x576f50){return function(_0x47da4a){if(_0x47da4a){return _0x47da4a[_0xc6da('0x2a')](_0x34f923)[_0xc6da('0x2b')](function(_0x2c8941){return _0x2c8941;});}return null;};}function removeEntity(_0x20b361,_0x118fc6){return function(_0x223954){if(_0x223954){return _0x223954[_0xc6da('0x2c')]()['then'](function(){_0x20b361[_0xc6da('0x1e')](0xcc)[_0xc6da('0x1f')]();});}};}function handleEntityNotFound(_0x10d1ae,_0x17b34c){return function(_0x538252){if(!_0x538252){_0x10d1ae[_0xc6da('0x1d')](0x194);}return _0x538252;};}function handleError(_0x1127e3,_0x43becd){_0x43becd=_0x43becd||0x1f4;return function(_0x2b407d){logger['error'](_0x2b407d['stack']);if(_0x2b407d[_0xc6da('0x2d')]){delete _0x2b407d[_0xc6da('0x2d')];}_0x1127e3[_0xc6da('0x1e')](_0x43becd)['send'](_0x2b407d);};}exports[_0xc6da('0x2e')]=function(_0x1b44aa,_0x3a8c74){var _0x440525={},_0x480db3={},_0x3dddd7={'count':0x0,'rows':[]};var _0xf18298=_['map'](db['VoiceQueueReport'][_0xc6da('0x2f')],function(_0x45eb8b){return{'name':_0x45eb8b[_0xc6da('0x30')],'type':_0x45eb8b[_0xc6da('0x31')][_0xc6da('0x32')]};});_0x480db3['model']=_['map'](_0xf18298,_0xc6da('0x2d'));_0x480db3[_0xc6da('0x33')]=_['keys'](_0x1b44aa[_0xc6da('0x33')]);_0x480db3[_0xc6da('0x34')]=_[_0xc6da('0x35')](_0x480db3['model'],_0x480db3[_0xc6da('0x33')]);_0x440525[_0xc6da('0x36')]=_[_0xc6da('0x35')](_0x480db3['model'],qs[_0xc6da('0x37')](_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x37')]));_0x440525[_0xc6da('0x36')]=_0x440525[_0xc6da('0x36')][_0xc6da('0x38')]?_0x440525[_0xc6da('0x36')]:_0x480db3['model'];if(!_0x1b44aa['query'][_0xc6da('0x39')](_0xc6da('0x3a'))){_0x440525[_0xc6da('0x22')]=qs[_0xc6da('0x22')](_0x1b44aa[_0xc6da('0x33')]['limit']);_0x440525[_0xc6da('0x20')]=qs[_0xc6da('0x20')](_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x20')]);}_0x440525[_0xc6da('0x3b')]=qs[_0xc6da('0x3c')](_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x3c')]);_0x440525[_0xc6da('0x3d')]=qs['filters'](_['pick'](_0x1b44aa[_0xc6da('0x33')],_0x480db3[_0xc6da('0x34')]),_0xf18298);if(_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x3e')]){_0x440525[_0xc6da('0x3d')]=_[_0xc6da('0x3f')](_0x440525[_0xc6da('0x3d')],{'$or':_['map'](_0xf18298,function(_0x392965){if(_0x392965['type']!==_0xc6da('0x40')){var _0xadf903={};_0xadf903[_0x392965[_0xc6da('0x2d')]]={'$like':'%'+_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x3e')]+'%'};return _0xadf903;}})});}_0x440525=_[_0xc6da('0x3f')]({},_0x440525,_0x1b44aa[_0xc6da('0x41')]);var _0x3577a8={'where':_0x440525[_0xc6da('0x3d')]};return db[_0xc6da('0x42')][_0xc6da('0x23')](_0x3577a8)[_0xc6da('0x2b')](function(_0x12bef4){_0x3dddd7[_0xc6da('0x23')]=_0x12bef4;if(_0x1b44aa[_0xc6da('0x33')][_0xc6da('0x43')]){_0x440525[_0xc6da('0x44')]=[{'all':!![]}];}return db[_0xc6da('0x42')]['findAll'](_0x440525);})[_0xc6da('0x2b')](function(_0xdabed4){_0x3dddd7[_0xc6da('0x45')]=_0xdabed4;return _0x3dddd7;})[_0xc6da('0x2b')](respondWithFilteredResult(_0x3a8c74,_0x440525))[_0xc6da('0x46')](handleError(_0x3a8c74,null));};exports[_0xc6da('0x47')]=function(_0x431449,_0x3e7b36){var _0x37e1a6={'raw':![],'where':{'id':_0x431449[_0xc6da('0x48')]['id']}},_0x40602d={};_0x40602d[_0xc6da('0x49')]=_[_0xc6da('0x4a')](db[_0xc6da('0x42')][_0xc6da('0x2f')]);_0x40602d[_0xc6da('0x33')]=_[_0xc6da('0x4a')](_0x431449['query']);_0x40602d['filters']=_[_0xc6da('0x35')](_0x40602d[_0xc6da('0x49')],_0x40602d[_0xc6da('0x33')]);_0x37e1a6[_0xc6da('0x36')]=_[_0xc6da('0x35')](_0x40602d[_0xc6da('0x49')],qs['fields'](_0x431449[_0xc6da('0x33')][_0xc6da('0x37')]));_0x37e1a6['attributes']=_0x37e1a6[_0xc6da('0x36')][_0xc6da('0x38')]?_0x37e1a6['attributes']:_0x40602d[_0xc6da('0x49')];if(_0x431449['query'][_0xc6da('0x43')]){_0x37e1a6[_0xc6da('0x44')]=[{'all':!![]}];}_0x37e1a6=_[_0xc6da('0x3f')]({},_0x37e1a6,_0x431449[_0xc6da('0x41')]);return db['VoiceQueueReport'][_0xc6da('0x4b')](_0x37e1a6)[_0xc6da('0x2b')](handleEntityNotFound(_0x3e7b36,null))['then'](respondWithResult(_0x3e7b36,null))[_0xc6da('0x46')](handleError(_0x3e7b36,null));};exports[_0xc6da('0x4c')]=function(_0xc33ec5,_0x38bd6e){return db[_0xc6da('0x42')]['create'](_0xc33ec5['body'],{})[_0xc6da('0x2b')](respondWithResult(_0x38bd6e,0xc9))[_0xc6da('0x46')](handleError(_0x38bd6e,null));};exports[_0xc6da('0x2a')]=function(_0x56a52d,_0x3733f5){if(_0x56a52d[_0xc6da('0x4d')]['id']){delete _0x56a52d[_0xc6da('0x4d')]['id'];}return db[_0xc6da('0x42')][_0xc6da('0x4b')]({'where':{'id':_0x56a52d[_0xc6da('0x48')]['id']}})[_0xc6da('0x2b')](handleEntityNotFound(_0x3733f5,null))[_0xc6da('0x2b')](saveUpdates(_0x56a52d[_0xc6da('0x4d')],null))['then'](respondWithResult(_0x3733f5,null))[_0xc6da('0x46')](handleError(_0x3733f5,null));};exports[_0xc6da('0x2c')]=function(_0xd8dd40,_0x1816c4){return db[_0xc6da('0x42')]['find']({'where':{'id':_0xd8dd40[_0xc6da('0x48')]['id']}})[_0xc6da('0x2b')](handleEntityNotFound(_0x1816c4,null))[_0xc6da('0x2b')](removeEntity(_0x1816c4,null))[_0xc6da('0x46')](handleError(_0x1816c4,null));};exports[_0xc6da('0x4e')]=function(_0x23913a,_0xfb4013){return db['VoiceQueueReport'][_0xc6da('0x4e')]()[_0xc6da('0x2b')](respondWithResult(_0xfb4013,null))[_0xc6da('0x46')](handleError(_0xfb4013,null));};exports['getVoiceQueuesReport']=function(_0x3fecac,_0x396320){var _0x35689d={},_0x306995={},_0x2043d5={'count':0x0,'rows':[]};_0x306995[_0xc6da('0x49')]=_[_0xc6da('0x4a')](db[_0xc6da('0x42')][_0xc6da('0x2f')]);_0x306995[_0xc6da('0x33')]=_['keys'](_0x3fecac[_0xc6da('0x33')]);_0x306995[_0xc6da('0x34')]=_[_0xc6da('0x35')](_0x306995['model'],_0x306995[_0xc6da('0x33')]);_0x35689d[_0xc6da('0x36')]=_[_0xc6da('0x35')](_0x306995[_0xc6da('0x49')],qs['fields'](_0x3fecac[_0xc6da('0x33')][_0xc6da('0x37')]));_0x35689d[_0xc6da('0x36')]=_0x35689d[_0xc6da('0x36')][_0xc6da('0x38')]?_0x35689d[_0xc6da('0x36')]:_0x306995[_0xc6da('0x49')];if(!_0x3fecac[_0xc6da('0x33')][_0xc6da('0x39')](_0xc6da('0x3a'))){_0x35689d[_0xc6da('0x22')]=qs[_0xc6da('0x22')](_0x3fecac[_0xc6da('0x33')][_0xc6da('0x22')]);_0x35689d['offset']=qs[_0xc6da('0x20')](_0x3fecac['query'][_0xc6da('0x20')]);}_0x35689d[_0xc6da('0x3b')]=qs['sort'](_0x3fecac[_0xc6da('0x33')][_0xc6da('0x3c')]);_0x35689d[_0xc6da('0x3d')]=qs[_0xc6da('0x34')](_[_0xc6da('0x4f')](_0x3fecac['query'],_0x306995[_0xc6da('0x34')]));if(_0x3fecac[_0xc6da('0x33')]['filter']){_0x35689d[_0xc6da('0x3d')]=_[_0xc6da('0x3f')](_0x35689d['where'],{'$or':_[_0xc6da('0x50')](_0x35689d[_0xc6da('0x36')],function(_0x187018){var _0x4f827e={};_0x4f827e[_0x187018]={'$like':'%'+_0x3fecac[_0xc6da('0x33')][_0xc6da('0x3e')]+'%'};return _0x4f827e;})});}_0x35689d=_[_0xc6da('0x3f')]({},_0x35689d,_0x3fecac[_0xc6da('0x41')]);var _0x369047={'where':_0x35689d[_0xc6da('0x3d')]};return db[_0xc6da('0x42')][_0xc6da('0x23')](_0x369047)[_0xc6da('0x2b')](function(_0x248c65){_0x2043d5['count']=_0x248c65;if(_0x3fecac[_0xc6da('0x33')][_0xc6da('0x43')]){_0x35689d['include']=[{'all':!![]}];}return db[_0xc6da('0x42')][_0xc6da('0x51')](_0x35689d);})[_0xc6da('0x2b')](function(_0x1d41ab){_0x2043d5[_0xc6da('0x45')]=_0x1d41ab;return _0x2043d5;})['then'](respondWithFilteredResult(_0x396320,_0x35689d,_0xc6da('0x52')))[_0xc6da('0x46')](handleError(_0x396320,null,_0xc6da('0x52')));}; \ No newline at end of file +var _0x97cc=['options','find','create','body','params','getVoiceQueuesReport','sort','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','VIRTUAL','filter','merge','then','include','findAll','rows','catch','show','length','includeAll'];(function(_0x23975a,_0x3603f0){var _0x35817d=function(_0xc75108){while(--_0xc75108){_0x23975a['push'](_0x23975a['shift']());}};_0x35817d(++_0x3603f0);}(_0x97cc,0xb4));var _0xc97c=function(_0x2700f6,_0x27b670){_0x2700f6=_0x2700f6-0x0;var _0x4453b0=_0x97cc[_0x2700f6];return _0x4453b0;};'use strict';var emlformat=require(_0xc97c('0x0'));var rimraf=require(_0xc97c('0x1'));var zipdir=require(_0xc97c('0x2'));var jsonpatch=require(_0xc97c('0x3'));var rp=require(_0xc97c('0x4'));var moment=require('moment');var BPromise=require(_0xc97c('0x5'));var Mustache=require('mustache');var util=require(_0xc97c('0x6'));var path=require('path');var sox=require(_0xc97c('0x7'));var csv=require('to-csv');var ejs=require(_0xc97c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc97c('0x9'));var squel=require(_0xc97c('0xa'));var crypto=require(_0xc97c('0xb'));var jsforce=require(_0xc97c('0xc'));var deskjs=require(_0xc97c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc97c('0xe'));var Papa=require(_0xc97c('0xf'));var Redis=require(_0xc97c('0x10'));var authService=require(_0xc97c('0x11'));var qs=require(_0xc97c('0x12'));var as=require(_0xc97c('0x13'));var hardwareService=require(_0xc97c('0x14'));var logger=require(_0xc97c('0x15'))('api');var utils=require(_0xc97c('0x16'));var config=require(_0xc97c('0x17'));var licenseUtil=require(_0xc97c('0x18'));var db=require(_0xc97c('0x19'))['db'];config[_0xc97c('0x1a')]=_['defaults'](config[_0xc97c('0x1a')],{'host':_0xc97c('0x1b'),'port':0x18eb});var socket=require(_0xc97c('0x1c'))(new Redis(config[_0xc97c('0x1a')]));require('./voiceQueueReport.socket')[_0xc97c('0x1d')](socket);function respondWithStatusCode(_0x53f194,_0x156ea8){_0x156ea8=_0x156ea8||0xcc;return function(_0x348d82){if(_0x348d82){return _0x53f194[_0xc97c('0x1e')](_0x156ea8);}return _0x53f194[_0xc97c('0x1f')](_0x156ea8)[_0xc97c('0x20')]();};}function respondWithResult(_0x38011e,_0x22b52e){_0x22b52e=_0x22b52e||0xc8;return function(_0x9aa7e9){if(_0x9aa7e9){return _0x38011e['status'](_0x22b52e)[_0xc97c('0x21')](_0x9aa7e9);}};}function respondWithFilteredResult(_0x4e54de,_0x2e63ed){return function(_0x1d7e03){if(_0x1d7e03){var _0x297b3e=typeof _0x2e63ed[_0xc97c('0x22')]===_0xc97c('0x23')&&typeof _0x2e63ed[_0xc97c('0x24')]===_0xc97c('0x23');var _0x20ae58=_0x1d7e03[_0xc97c('0x25')];var _0x18448f=_0x297b3e?0x0:_0x2e63ed[_0xc97c('0x22')];var _0x1942f6=_0x297b3e?_0x1d7e03['count']:_0x2e63ed[_0xc97c('0x22')]+_0x2e63ed[_0xc97c('0x24')];var _0x572532;if(_0x1942f6>=_0x20ae58){_0x1942f6=_0x20ae58;_0x572532=0xc8;}else{_0x572532=0xce;}_0x4e54de[_0xc97c('0x1f')](_0x572532);return _0x4e54de[_0xc97c('0x26')](_0xc97c('0x27'),_0x18448f+'-'+_0x1942f6+'/'+_0x20ae58)[_0xc97c('0x21')](_0x1d7e03);}return null;};}function patchUpdates(_0x3c84e0){return function(_0x3027d4){try{jsonpatch[_0xc97c('0x28')](_0x3027d4,_0x3c84e0,!![]);}catch(_0x42a168){return BPromise[_0xc97c('0x29')](_0x42a168);}return _0x3027d4[_0xc97c('0x2a')]();};}function saveUpdates(_0xa60a4d,_0x2e179e){return function(_0x8d4764){if(_0x8d4764){return _0x8d4764[_0xc97c('0x2b')](_0xa60a4d)['then'](function(_0x424a0f){return _0x424a0f;});}return null;};}function removeEntity(_0x5cb78d,_0xa955){return function(_0x1a5673){if(_0x1a5673){return _0x1a5673[_0xc97c('0x2c')]()['then'](function(){_0x5cb78d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15295f,_0x10a871){return function(_0x518836){if(!_0x518836){_0x15295f[_0xc97c('0x1e')](0x194);}return _0x518836;};}function handleError(_0x2b7923,_0x34b4af){_0x34b4af=_0x34b4af||0x1f4;return function(_0x570541){logger[_0xc97c('0x2d')](_0x570541[_0xc97c('0x2e')]);if(_0x570541[_0xc97c('0x2f')]){delete _0x570541[_0xc97c('0x2f')];}_0x2b7923[_0xc97c('0x1f')](_0x34b4af)[_0xc97c('0x30')](_0x570541);};}exports[_0xc97c('0x31')]=function(_0x3f0e7a,_0x103572){var _0x192436={},_0x439454={},_0x10174e={'count':0x0,'rows':[]};var _0x51f1cd=_['map'](db[_0xc97c('0x32')][_0xc97c('0x33')],function(_0x489541){return{'name':_0x489541[_0xc97c('0x34')],'type':_0x489541[_0xc97c('0x35')][_0xc97c('0x36')]};});_0x439454['model']=_[_0xc97c('0x37')](_0x51f1cd,_0xc97c('0x2f'));_0x439454['query']=_[_0xc97c('0x38')](_0x3f0e7a[_0xc97c('0x39')]);_0x439454[_0xc97c('0x3a')]=_['intersection'](_0x439454['model'],_0x439454[_0xc97c('0x39')]);_0x192436['attributes']=_[_0xc97c('0x3b')](_0x439454[_0xc97c('0x3c')],qs[_0xc97c('0x3d')](_0x3f0e7a[_0xc97c('0x39')][_0xc97c('0x3d')]));_0x192436[_0xc97c('0x3e')]=_0x192436[_0xc97c('0x3e')]['length']?_0x192436[_0xc97c('0x3e')]:_0x439454['model'];if(!_0x3f0e7a[_0xc97c('0x39')][_0xc97c('0x3f')](_0xc97c('0x40'))){_0x192436[_0xc97c('0x24')]=qs[_0xc97c('0x24')](_0x3f0e7a['query'][_0xc97c('0x24')]);_0x192436[_0xc97c('0x22')]=qs[_0xc97c('0x22')](_0x3f0e7a['query']['offset']);}_0x192436[_0xc97c('0x41')]=qs['sort'](_0x3f0e7a[_0xc97c('0x39')]['sort']);_0x192436['where']=qs[_0xc97c('0x3a')](_['pick'](_0x3f0e7a[_0xc97c('0x39')],_0x439454[_0xc97c('0x3a')]),_0x51f1cd);if(_0x3f0e7a['query']['filter']){_0x192436['where']=_['merge'](_0x192436[_0xc97c('0x42')],{'$or':_['map'](_0x51f1cd,function(_0x47bd34){if(_0x47bd34[_0xc97c('0x35')]!==_0xc97c('0x43')){var _0x353975={};_0x353975[_0x47bd34['name']]={'$like':'%'+_0x3f0e7a['query'][_0xc97c('0x44')]+'%'};return _0x353975;}})});}_0x192436=_[_0xc97c('0x45')]({},_0x192436,_0x3f0e7a['options']);var _0xc8cc06={'where':_0x192436[_0xc97c('0x42')]};return db[_0xc97c('0x32')]['count'](_0xc8cc06)[_0xc97c('0x46')](function(_0x2ec9f1){_0x10174e[_0xc97c('0x25')]=_0x2ec9f1;if(_0x3f0e7a['query']['includeAll']){_0x192436[_0xc97c('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc97c('0x48')](_0x192436);})['then'](function(_0x10d5d7){_0x10174e[_0xc97c('0x49')]=_0x10d5d7;return _0x10174e;})[_0xc97c('0x46')](respondWithFilteredResult(_0x103572,_0x192436))[_0xc97c('0x4a')](handleError(_0x103572,null));};exports[_0xc97c('0x4b')]=function(_0x4610db,_0x3094a7){var _0x1ba20b={'raw':![],'where':{'id':_0x4610db['params']['id']}},_0x3ecb70={};_0x3ecb70[_0xc97c('0x3c')]=_[_0xc97c('0x38')](db[_0xc97c('0x32')][_0xc97c('0x33')]);_0x3ecb70['query']=_[_0xc97c('0x38')](_0x4610db[_0xc97c('0x39')]);_0x3ecb70['filters']=_[_0xc97c('0x3b')](_0x3ecb70[_0xc97c('0x3c')],_0x3ecb70[_0xc97c('0x39')]);_0x1ba20b['attributes']=_[_0xc97c('0x3b')](_0x3ecb70['model'],qs[_0xc97c('0x3d')](_0x4610db['query'][_0xc97c('0x3d')]));_0x1ba20b[_0xc97c('0x3e')]=_0x1ba20b[_0xc97c('0x3e')][_0xc97c('0x4c')]?_0x1ba20b['attributes']:_0x3ecb70[_0xc97c('0x3c')];if(_0x4610db['query'][_0xc97c('0x4d')]){_0x1ba20b['include']=[{'all':!![]}];}_0x1ba20b=_[_0xc97c('0x45')]({},_0x1ba20b,_0x4610db[_0xc97c('0x4e')]);return db[_0xc97c('0x32')][_0xc97c('0x4f')](_0x1ba20b)[_0xc97c('0x46')](handleEntityNotFound(_0x3094a7,null))[_0xc97c('0x46')](respondWithResult(_0x3094a7,null))['catch'](handleError(_0x3094a7,null));};exports[_0xc97c('0x50')]=function(_0x57a4ea,_0x4c47b1){return db[_0xc97c('0x32')][_0xc97c('0x50')](_0x57a4ea[_0xc97c('0x51')],{})[_0xc97c('0x46')](respondWithResult(_0x4c47b1,0xc9))[_0xc97c('0x4a')](handleError(_0x4c47b1,null));};exports[_0xc97c('0x2b')]=function(_0x128ac8,_0x39edb4){if(_0x128ac8[_0xc97c('0x51')]['id']){delete _0x128ac8[_0xc97c('0x51')]['id'];}return db['VoiceQueueReport'][_0xc97c('0x4f')]({'where':{'id':_0x128ac8[_0xc97c('0x52')]['id']}})['then'](handleEntityNotFound(_0x39edb4,null))[_0xc97c('0x46')](saveUpdates(_0x128ac8[_0xc97c('0x51')],null))['then'](respondWithResult(_0x39edb4,null))[_0xc97c('0x4a')](handleError(_0x39edb4,null));};exports[_0xc97c('0x2c')]=function(_0x54c245,_0x35ad27){return db[_0xc97c('0x32')][_0xc97c('0x4f')]({'where':{'id':_0x54c245[_0xc97c('0x52')]['id']}})['then'](handleEntityNotFound(_0x35ad27,null))[_0xc97c('0x46')](removeEntity(_0x35ad27,null))[_0xc97c('0x4a')](handleError(_0x35ad27,null));};exports['describe']=function(_0x29805f,_0x4fef36){return db[_0xc97c('0x32')]['describe']()['then'](respondWithResult(_0x4fef36,null))['catch'](handleError(_0x4fef36,null));};exports[_0xc97c('0x53')]=function(_0x3f4787,_0x1db7f6){var _0x189d66={},_0x151f11={},_0x41d0e5={'count':0x0,'rows':[]};_0x151f11[_0xc97c('0x3c')]=_[_0xc97c('0x38')](db['VoiceQueueReport'][_0xc97c('0x33')]);_0x151f11[_0xc97c('0x39')]=_['keys'](_0x3f4787[_0xc97c('0x39')]);_0x151f11[_0xc97c('0x3a')]=_[_0xc97c('0x3b')](_0x151f11[_0xc97c('0x3c')],_0x151f11[_0xc97c('0x39')]);_0x189d66['attributes']=_[_0xc97c('0x3b')](_0x151f11['model'],qs['fields'](_0x3f4787[_0xc97c('0x39')]['fields']));_0x189d66[_0xc97c('0x3e')]=_0x189d66[_0xc97c('0x3e')][_0xc97c('0x4c')]?_0x189d66[_0xc97c('0x3e')]:_0x151f11[_0xc97c('0x3c')];if(!_0x3f4787[_0xc97c('0x39')][_0xc97c('0x3f')](_0xc97c('0x40'))){_0x189d66[_0xc97c('0x24')]=qs[_0xc97c('0x24')](_0x3f4787[_0xc97c('0x39')][_0xc97c('0x24')]);_0x189d66['offset']=qs['offset'](_0x3f4787['query'][_0xc97c('0x22')]);}_0x189d66[_0xc97c('0x41')]=qs[_0xc97c('0x54')](_0x3f4787[_0xc97c('0x39')][_0xc97c('0x54')]);_0x189d66['where']=qs[_0xc97c('0x3a')](_[_0xc97c('0x55')](_0x3f4787['query'],_0x151f11[_0xc97c('0x3a')]));if(_0x3f4787[_0xc97c('0x39')][_0xc97c('0x44')]){_0x189d66['where']=_[_0xc97c('0x45')](_0x189d66[_0xc97c('0x42')],{'$or':_[_0xc97c('0x37')](_0x189d66[_0xc97c('0x3e')],function(_0x31cdfc){var _0x5aa999={};_0x5aa999[_0x31cdfc]={'$like':'%'+_0x3f4787[_0xc97c('0x39')][_0xc97c('0x44')]+'%'};return _0x5aa999;})});}_0x189d66=_[_0xc97c('0x45')]({},_0x189d66,_0x3f4787[_0xc97c('0x4e')]);var _0x4e6069={'where':_0x189d66[_0xc97c('0x42')]};return db[_0xc97c('0x32')][_0xc97c('0x25')](_0x4e6069)[_0xc97c('0x46')](function(_0x3f3775){_0x41d0e5['count']=_0x3f3775;if(_0x3f4787[_0xc97c('0x39')][_0xc97c('0x4d')]){_0x189d66['include']=[{'all':!![]}];}return db[_0xc97c('0x32')]['findAll'](_0x189d66);})['then'](function(_0x5e4cda){_0x41d0e5[_0xc97c('0x49')]=_0x5e4cda;return _0x41d0e5;})[_0xc97c('0x46')](respondWithFilteredResult(_0x1db7f6,_0x189d66,_0xc97c('0x53')))[_0xc97c('0x4a')](handleError(_0x1db7f6,null,_0xc97c('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index fd626ae..aed12d0 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 _0x723e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x4bbccd,_0x45b258){var _0x29aa10=function(_0x5863c4){while(--_0x5863c4){_0x4bbccd['push'](_0x4bbccd['shift']());}};_0x29aa10(++_0x45b258);}(_0x723e,0xb9));var _0xe723=function(_0x4e848,_0xdc4e75){_0x4e848=_0x4e848-0x0;var _0x1eba5e=_0x723e[_0x4e848];return _0x1eba5e;};'use strict';var EventEmitter=require(_0xe723('0x0'));var VoiceQueueReport=require(_0xe723('0x1'))['db'][_0xe723('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe723('0x3'),'afterUpdate':'update','afterDestroy':_0xe723('0x4')};function emitEvent(_0x11b8fd){return function(_0x378041,_0x1341b4,_0x1ed36d){VoiceQueueReportEvents[_0xe723('0x5')](_0x11b8fd+':'+_0x378041['id'],_0x378041);VoiceQueueReportEvents[_0xe723('0x5')](_0x11b8fd,_0x378041);_0x1ed36d(null);};}for(var e in events){if(events[_0xe723('0x6')](e)){var event=events[e];VoiceQueueReport[_0xe723('0x7')](e,emitEvent(event));}}module[_0xe723('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x7dd0=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x52711f,_0x4cf48b){var _0x736442=function(_0x1170b2){while(--_0x1170b2){_0x52711f['push'](_0x52711f['shift']());}};_0x736442(++_0x4cf48b);}(_0x7dd0,0xe6));var _0x07dd=function(_0xf024c9,_0x4ddae3){_0xf024c9=_0xf024c9-0x0;var _0x4b6eaf=_0x7dd0[_0xf024c9];return _0x4b6eaf;};'use strict';var EventEmitter=require(_0x07dd('0x0'));var VoiceQueueReport=require(_0x07dd('0x1'))['db'][_0x07dd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x07dd('0x3')](0x0);var events={'afterCreate':_0x07dd('0x4'),'afterUpdate':_0x07dd('0x5'),'afterDestroy':_0x07dd('0x6')};function emitEvent(_0x39439b){return function(_0x49e2c4,_0x529eb4,_0x3645c0){VoiceQueueReportEvents[_0x07dd('0x7')](_0x39439b+':'+_0x49e2c4['id'],_0x49e2c4);VoiceQueueReportEvents[_0x07dd('0x7')](_0x39439b,_0x49e2c4);_0x3645c0(null);};}for(var e in events){if(events[_0x07dd('0x8')](e)){var event=events[e];VoiceQueueReport[_0x07dd('0x9')](e,emitEvent(event));}}module[_0x07dd('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 024896e..b0a1f1b 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 _0x8269=['calleridnum','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','uniqueid'];(function(_0x21f9fc,_0x33b8f2){var _0x1b5af9=function(_0x506f67){while(--_0x506f67){_0x21f9fc['push'](_0x21f9fc['shift']());}};_0x1b5af9(++_0x33b8f2);}(_0x8269,0xbc));var _0x9826=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x8269[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x9826('0x0'));var util=require('util');var logger=require(_0x9826('0x1'))(_0x9826('0x2'));var moment=require(_0x9826('0x3'));var BPromise=require(_0x9826('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9826('0x5'));var rimraf=require(_0x9826('0x6'));var config=require(_0x9826('0x7'));var attributes=require(_0x9826('0x8'));module['exports']=function(_0xda46bd,_0x44fd1b){return _0xda46bd['define']('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9826('0x9')]},{'fields':[_0x9826('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30c9=['request-promise','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x3c6ff6,_0x4e136a){var _0x4ac5ba=function(_0x1da29e){while(--_0x1da29e){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x4ac5ba(++_0x4e136a);}(_0x30c9,0x8c));var _0x930c=function(_0x10e7a9,_0x35363d){_0x10e7a9=_0x10e7a9-0x0;var _0x59dde3=_0x30c9[_0x10e7a9];return _0x59dde3;};'use strict';var _=require(_0x930c('0x0'));var util=require(_0x930c('0x1'));var logger=require(_0x930c('0x2'))(_0x930c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x930c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x930c('0x5'));var attributes=require(_0x930c('0x6'));module['exports']=function(_0x187da6,_0x555370){return _0x187da6[_0x930c('0x7')](_0x930c('0x8'),attributes,{'tableName':_0x930c('0x9'),'paranoid':![],'indexes':[{'fields':[_0x930c('0xa')]},{'fields':[_0x930c('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 5b9d39c..e09e428 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 _0x0464=['CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','VoiceQueueReport','create','body'];(function(_0x21de23,_0x39837b){var _0xae92d4=function(_0x184c06){while(--_0x184c06){_0x21de23['push'](_0x21de23['shift']());}};_0xae92d4(++_0x39837b);}(_0x0464,0x106));var _0x4046=function(_0x53a06e,_0x1dd83d){_0x53a06e=_0x53a06e-0x0;var _0x29b535=_0x0464[_0x53a06e];return _0x29b535;};'use strict';var _=require(_0x4046('0x0'));var util=require(_0x4046('0x1'));var moment=require(_0x4046('0x2'));var BPromise=require(_0x4046('0x3'));var rs=require(_0x4046('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4046('0x5'))['db'];var utils=require(_0x4046('0x6'));var logger=require(_0x4046('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4046('0x8'));var client=jayson[_0x4046('0x9')]['http']({'port':0x232a});config[_0x4046('0xa')]=_[_0x4046('0xb')](config['redis'],{'host':_0x4046('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4046('0xa')]));require(_0x4046('0xd'))[_0x4046('0xe')](socket);function respondWithRpcPromise(_0x4bb2e9,_0x837418,_0x44c5e4){return new BPromise(function(_0x116764,_0xd6304e){return client['request'](_0x4bb2e9,_0x44c5e4)[_0x4046('0xf')](function(_0x56a398){logger[_0x4046('0x10')](_0x4046('0x11'),_0x837418,_0x4046('0x12'));logger[_0x4046('0x13')](_0x4046('0x14'),_0x837418,_0x4046('0x12'),JSON[_0x4046('0x15')](_0x56a398));if(_0x56a398[_0x4046('0x16')]){if(_0x56a398[_0x4046('0x16')][_0x4046('0x17')]===0x1f4){logger[_0x4046('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x837418,_0x56a398[_0x4046('0x16')][_0x4046('0x18')]);return _0xd6304e(_0x56a398[_0x4046('0x16')][_0x4046('0x18')]);}logger[_0x4046('0x16')](_0x4046('0x11'),_0x837418,_0x56a398[_0x4046('0x16')][_0x4046('0x18')]);return _0x116764(_0x56a398[_0x4046('0x16')][_0x4046('0x18')]);}else{logger[_0x4046('0x10')](_0x4046('0x11'),_0x837418,_0x4046('0x12'));_0x116764(_0x56a398[_0x4046('0x19')][_0x4046('0x18')]);}})[_0x4046('0x1a')](function(_0x380fef){logger['error'](_0x4046('0x11'),_0x837418,_0x380fef);_0xd6304e(_0x380fef);});});}exports[_0x4046('0x1b')]=function(_0x401be8){var _0xe10eab=this;return new Promise(function(_0xa74ee5,_0x29cb6d){return db['VoiceQueueReport'][_0x4046('0x1c')]({'raw':_0x401be8[_0x4046('0x1d')]?_0x401be8[_0x4046('0x1d')][_0x4046('0x1e')]===undefined?!![]:![]:!![],'where':_0x401be8[_0x4046('0x1d')]?_0x401be8[_0x4046('0x1d')][_0x4046('0x1f')]||null:null,'attributes':_0x401be8[_0x4046('0x1d')]?_0x401be8[_0x4046('0x1d')][_0x4046('0x20')]||null:null,'limit':_0x401be8['options']?_0x401be8['options']['limit']||null:null,'include':_0x401be8['options']?_0x401be8[_0x4046('0x1d')][_0x4046('0x21')]?_['map'](_0x401be8[_0x4046('0x1d')][_0x4046('0x21')],function(_0x378776){return{'model':db[_0x378776['model']],'as':_0x378776['as'],'attributes':_0x378776['attributes'],'include':_0x378776[_0x4046('0x21')]?_[_0x4046('0x22')](_0x378776['include'],function(_0x4e7dce){return{'model':db[_0x4e7dce['model']],'as':_0x4e7dce['as'],'attributes':_0x4e7dce[_0x4046('0x20')],'include':_0x4e7dce[_0x4046('0x21')]?_[_0x4046('0x22')](_0x4e7dce['include'],function(_0x2f1cef){return{'model':db[_0x2f1cef[_0x4046('0x23')]],'as':_0x2f1cef['as'],'attributes':_0x2f1cef[_0x4046('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4046('0xf')](function(_0xcc8b51){logger['info'](_0x4046('0x1b'),_0x401be8);logger[_0x4046('0x13')]('GetVoiceQueueReport',_0x401be8,JSON[_0x4046('0x15')](_0xcc8b51));_0xa74ee5(_0xcc8b51);})[_0x4046('0x1a')](function(_0x3b45ee){logger[_0x4046('0x16')](_0x4046('0x1b'),_0x3b45ee['message'],_0x401be8);_0x29cb6d(_0xe10eab['error'](0x1f4,_0x3b45ee[_0x4046('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x4cf144){var _0xee9a10=this;return new Promise(function(_0xb77018,_0x1d707d){return db[_0x4046('0x24')][_0x4046('0x25')](_0x4cf144[_0x4046('0x26')],{'raw':_0x4cf144[_0x4046('0x1d')]?_0x4cf144[_0x4046('0x1d')][_0x4046('0x1e')]===undefined?!![]:![]:!![]})[_0x4046('0xf')](function(_0x346d7f){logger[_0x4046('0x10')](_0x4046('0x27'),_0x4cf144);logger[_0x4046('0x13')](_0x4046('0x27'),_0x4cf144,JSON[_0x4046('0x15')](_0x346d7f));_0xb77018(_0x346d7f);})[_0x4046('0x1a')](function(_0xfbcad7){logger[_0x4046('0x16')](_0x4046('0x27'),_0xfbcad7['message'],_0x4cf144);_0x1d707d(_0xee9a10[_0x4046('0x16')](0x1f4,_0xfbcad7[_0x4046('0x18')]));});});};exports[_0x4046('0x28')]=function(_0x33fdbd){var _0x49637f=this;return new Promise(function(_0x13dfb0,_0x44210c){return db[_0x4046('0x24')][_0x4046('0x29')](_0x33fdbd[_0x4046('0x26')],{'raw':_0x33fdbd[_0x4046('0x1d')]?_0x33fdbd[_0x4046('0x1d')][_0x4046('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fdbd[_0x4046('0x1d')]?_0x33fdbd[_0x4046('0x1d')][_0x4046('0x1f')]||null:null,'attributes':_0x33fdbd['options']?_0x33fdbd['options'][_0x4046('0x20')]||null:null,'limit':_0x33fdbd[_0x4046('0x1d')]?_0x33fdbd[_0x4046('0x1d')][_0x4046('0x2a')]||null:null})[_0x4046('0xf')](function(_0x4c56c8){logger[_0x4046('0x10')](_0x4046('0x28'),_0x33fdbd);logger[_0x4046('0x13')]('UpdateVoiceQueueReport',_0x33fdbd,JSON['stringify'](_0x4c56c8));_0x13dfb0(_0x4c56c8);})[_0x4046('0x1a')](function(_0x934219){logger[_0x4046('0x16')](_0x4046('0x28'),_0x934219[_0x4046('0x18')],_0x33fdbd);_0x44210c(_0x49637f[_0x4046('0x16')](0x1f4,_0x934219[_0x4046('0x18')]));});});}; \ No newline at end of file +var _0x8624=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','findAll','raw','options','where','attributes','limit','map','include','model','GetVoiceQueueReport','debug','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','request','then','info'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x8624,0x192));var _0x4862=function(_0xb40f40,_0x41708a){_0xb40f40=_0xb40f40-0x0;var _0x55c108=_0x8624[_0xb40f40];return _0x55c108;};'use strict';var _=require('lodash');var util=require(_0x4862('0x0'));var moment=require(_0x4862('0x1'));var BPromise=require(_0x4862('0x2'));var rs=require(_0x4862('0x3'));var fs=require('fs');var Redis=require(_0x4862('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4862('0x5'));var logger=require(_0x4862('0x6'))(_0x4862('0x7'));var config=require(_0x4862('0x8'));var jayson=require(_0x4862('0x9'));var client=jayson[_0x4862('0xa')][_0x4862('0xb')]({'port':0x232a});config[_0x4862('0xc')]=_['defaults'](config[_0x4862('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4862('0xd'))(new Redis(config[_0x4862('0xc')]));require(_0x4862('0xe'))['register'](socket);function respondWithRpcPromise(_0x3a25e3,_0x3cd8c5,_0x25ff80){return new BPromise(function(_0x1ece89,_0x53bb10){return client[_0x4862('0xf')](_0x3a25e3,_0x25ff80)[_0x4862('0x10')](function(_0x1617f6){logger[_0x4862('0x11')](_0x4862('0x12'),_0x3cd8c5,_0x4862('0x13'));logger['debug'](_0x4862('0x14'),_0x3cd8c5,'request\x20sent',JSON['stringify'](_0x1617f6));if(_0x1617f6[_0x4862('0x15')]){if(_0x1617f6[_0x4862('0x15')][_0x4862('0x16')]===0x1f4){logger[_0x4862('0x15')](_0x4862('0x12'),_0x3cd8c5,_0x1617f6[_0x4862('0x15')][_0x4862('0x17')]);return _0x53bb10(_0x1617f6[_0x4862('0x15')][_0x4862('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3cd8c5,_0x1617f6[_0x4862('0x15')][_0x4862('0x17')]);return _0x1ece89(_0x1617f6[_0x4862('0x15')]['message']);}else{logger[_0x4862('0x11')](_0x4862('0x12'),_0x3cd8c5,'request\x20sent');_0x1ece89(_0x1617f6['result'][_0x4862('0x17')]);}})['catch'](function(_0x1e67e7){logger[_0x4862('0x15')](_0x4862('0x12'),_0x3cd8c5,_0x1e67e7);_0x53bb10(_0x1e67e7);});});}exports['GetVoiceQueueReport']=function(_0x1b4817){var _0x59644e=this;return new Promise(function(_0x58a7ce,_0x523f72){return db['VoiceQueueReport'][_0x4862('0x18')]({'raw':_0x1b4817['options']?_0x1b4817['options'][_0x4862('0x19')]===undefined?!![]:![]:!![],'where':_0x1b4817['options']?_0x1b4817[_0x4862('0x1a')][_0x4862('0x1b')]||null:null,'attributes':_0x1b4817[_0x4862('0x1a')]?_0x1b4817['options'][_0x4862('0x1c')]||null:null,'limit':_0x1b4817[_0x4862('0x1a')]?_0x1b4817[_0x4862('0x1a')][_0x4862('0x1d')]||null:null,'include':_0x1b4817[_0x4862('0x1a')]?_0x1b4817[_0x4862('0x1a')]['include']?_[_0x4862('0x1e')](_0x1b4817[_0x4862('0x1a')][_0x4862('0x1f')],function(_0x32c475){return{'model':db[_0x32c475[_0x4862('0x20')]],'as':_0x32c475['as'],'attributes':_0x32c475[_0x4862('0x1c')],'include':_0x32c475[_0x4862('0x1f')]?_[_0x4862('0x1e')](_0x32c475['include'],function(_0x117e0d){return{'model':db[_0x117e0d[_0x4862('0x20')]],'as':_0x117e0d['as'],'attributes':_0x117e0d[_0x4862('0x1c')],'include':_0x117e0d[_0x4862('0x1f')]?_[_0x4862('0x1e')](_0x117e0d[_0x4862('0x1f')],function(_0x212110){return{'model':db[_0x212110[_0x4862('0x20')]],'as':_0x212110['as'],'attributes':_0x212110[_0x4862('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4862('0x10')](function(_0x19bdfa){logger[_0x4862('0x11')](_0x4862('0x21'),_0x1b4817);logger[_0x4862('0x22')](_0x4862('0x21'),_0x1b4817,JSON[_0x4862('0x23')](_0x19bdfa));_0x58a7ce(_0x19bdfa);})['catch'](function(_0x4361c8){logger[_0x4862('0x15')](_0x4862('0x21'),_0x4361c8[_0x4862('0x17')],_0x1b4817);_0x523f72(_0x59644e[_0x4862('0x15')](0x1f4,_0x4361c8['message']));});});};exports[_0x4862('0x24')]=function(_0x2c04a3){var _0x47b085=this;return new Promise(function(_0x48887e,_0x2b4e90){return db[_0x4862('0x25')][_0x4862('0x26')](_0x2c04a3['body'],{'raw':_0x2c04a3[_0x4862('0x1a')]?_0x2c04a3[_0x4862('0x1a')][_0x4862('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4f795d){logger[_0x4862('0x11')](_0x4862('0x24'),_0x2c04a3);logger[_0x4862('0x22')](_0x4862('0x24'),_0x2c04a3,JSON[_0x4862('0x23')](_0x4f795d));_0x48887e(_0x4f795d);})['catch'](function(_0x52f0a3){logger[_0x4862('0x15')](_0x4862('0x24'),_0x52f0a3['message'],_0x2c04a3);_0x2b4e90(_0x47b085[_0x4862('0x15')](0x1f4,_0x52f0a3[_0x4862('0x17')]));});});};exports[_0x4862('0x27')]=function(_0x1ac511){var _0x174783=this;return new Promise(function(_0x1232ed,_0x4e4baa){return db[_0x4862('0x25')][_0x4862('0x28')](_0x1ac511[_0x4862('0x29')],{'raw':_0x1ac511[_0x4862('0x1a')]?_0x1ac511['options'][_0x4862('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac511[_0x4862('0x1a')]?_0x1ac511['options'][_0x4862('0x1b')]||null:null,'attributes':_0x1ac511[_0x4862('0x1a')]?_0x1ac511['options']['attributes']||null:null,'limit':_0x1ac511[_0x4862('0x1a')]?_0x1ac511[_0x4862('0x1a')][_0x4862('0x1d')]||null:null})[_0x4862('0x10')](function(_0x21414a){logger[_0x4862('0x11')](_0x4862('0x27'),_0x1ac511);logger['debug'](_0x4862('0x27'),_0x1ac511,JSON[_0x4862('0x23')](_0x21414a));_0x1232ed(_0x21414a);})['catch'](function(_0x1e4f4c){logger[_0x4862('0x15')]('UpdateVoiceQueueReport',_0x1e4f4c['message'],_0x1ac511);_0x4e4baa(_0x174783[_0x4862('0x15')](0x1f4,_0x1e4f4c[_0x4862('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4a79b2a..7070bae 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 _0x4262=['voiceQueueReport:','./voiceQueueReport.events','save','remove','removeListener','register','length'];(function(_0x48e047,_0x35c0c2){var _0x51f1ec=function(_0x4eaf15){while(--_0x4eaf15){_0x48e047['push'](_0x48e047['shift']());}};_0x51f1ec(++_0x35c0c2);}(_0x4262,0x15f));var _0x2426=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4262[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require(_0x2426('0x0'));var events=[_0x2426('0x1'),_0x2426('0x2'),'update'];function createListener(_0x30c544,_0x5b6c14){return function(_0x251ee7){_0x5b6c14['emit'](_0x30c544,_0x251ee7);};}function removeListener(_0x4b6f7c,_0x19be9b){return function(){VoiceQueueReportEvents[_0x2426('0x3')](_0x4b6f7c,_0x19be9b);};}exports[_0x2426('0x4')]=function(_0x127500){for(var _0x4a6553=0x0,_0x12f6f0=events[_0x2426('0x5')];_0x4a6553<_0x12f6f0;_0x4a6553++){var _0x2ba584=events[_0x4a6553];var _0x2bffc1=createListener(_0x2426('0x6')+_0x2ba584,_0x127500);VoiceQueueReportEvents['on'](_0x2ba584,_0x2bffc1);}}; \ No newline at end of file +var _0xbe52=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbe52,0x164));var _0x2be5=function(_0x44bb48,_0xab2bdb){_0x44bb48=_0x44bb48-0x0;var _0x1dd2e8=_0xbe52[_0x44bb48];return _0x1dd2e8;};'use strict';var VoiceQueueReportEvents=require(_0x2be5('0x0'));var events=[_0x2be5('0x1'),_0x2be5('0x2'),_0x2be5('0x3')];function createListener(_0x3c958e,_0x5ecf66){return function(_0x90c88c){_0x5ecf66[_0x2be5('0x4')](_0x3c958e,_0x90c88c);};}function removeListener(_0x3339d3,_0x20abd0){return function(){VoiceQueueReportEvents[_0x2be5('0x5')](_0x3339d3,_0x20abd0);};}exports[_0x2be5('0x6')]=function(_0x39dc18){for(var _0x13fadf=0x0,_0x2ca6a7=events[_0x2be5('0x7')];_0x13fadf<_0x2ca6a7;_0x13fadf++){var _0x1f346a=events[_0x13fadf];var _0x3169b3=createListener('voiceQueueReport:'+_0x1f346a,_0x39dc18);VoiceQueueReportEvents['on'](_0x1f346a,_0x3169b3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6095b5f..9fb9b20 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 _0x5e87=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','post','create','put','destroy','exports','multer','express','Router','fs-extra'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x5e87,0x8c));var _0x75e8=function(_0x278574,_0x8bcbd5){_0x278574=_0x278574-0x0;var _0x3a6c8=_0x5e87[_0x278574];return _0x3a6c8;};'use strict';var multer=require(_0x75e8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75e8('0x1'));var router=express[_0x75e8('0x2')]();var fs_extra=require(_0x75e8('0x3'));var auth=require(_0x75e8('0x4'));var interaction=require(_0x75e8('0x5'));var config=require(_0x75e8('0x6'));var controller=require(_0x75e8('0x7'));router['get']('/',auth[_0x75e8('0x8')](),controller[_0x75e8('0x9')]);router['get'](_0x75e8('0xa'),auth[_0x75e8('0x8')](),controller['show']);router[_0x75e8('0xb')]('/',auth['isAuthenticated'](),controller[_0x75e8('0xc')]);router[_0x75e8('0xd')](_0x75e8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x75e8('0xa'),auth[_0x75e8('0x8')](),controller[_0x75e8('0xe')]);module[_0x75e8('0xf')]=router; \ No newline at end of file +var _0xa7eb=['get','isAuthenticated','index','show','post','put','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa7eb,0x71));var _0xba7e=function(_0x35a6d1,_0x470fcd){_0x35a6d1=_0x35a6d1-0x0;var _0x2d2052=_0xa7eb[_0x35a6d1];return _0x2d2052;};'use strict';var multer=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xba7e('0x2'));var router=express[_0xba7e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xba7e('0x4'));var interaction=require(_0xba7e('0x5'));var config=require('../../config/environment');var controller=require(_0xba7e('0x6'));router[_0xba7e('0x7')]('/',auth[_0xba7e('0x8')](),controller[_0xba7e('0x9')]);router[_0xba7e('0x7')]('/:id',auth[_0xba7e('0x8')](),controller[_0xba7e('0xa')]);router[_0xba7e('0xb')]('/',auth[_0xba7e('0x8')](),controller['create']);router[_0xba7e('0xc')]('/:id',auth[_0xba7e('0x8')](),controller['update']);router[_0xba7e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xba7e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e8e767a..7f49355 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 _0x44f4=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x312cc2,_0x214ca1){var _0x30a4fa=function(_0x2c039d){while(--_0x2c039d){_0x312cc2['push'](_0x312cc2['shift']());}};_0x30a4fa(++_0x214ca1);}(_0x44f4,0x199));var _0x444f=function(_0x47af6a,_0xcd6041){_0x47af6a=_0x47af6a-0x0;var _0x4b0aba=_0x44f4[_0x47af6a];return _0x4b0aba;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x444f('0x0'));module['exports']={'time':{'type':Sequelize[_0x444f('0x1')]},'callid':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x444f('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x444f('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x444f('0x3')](_0x444f('0x4'))}}; \ No newline at end of file +var _0xa269=['sequelize','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa269,0x127));var _0x9a26=function(_0x238415,_0x5760c7){_0x238415=_0x238415-0x0;var _0x506fa6=_0xa269[_0x238415];return _0x506fa6;};'use strict';var Sequelize=require(_0x9a26('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x9a26('0x1')]},'callid':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9a26('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9a26('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x9a26('0x3')](_0x9a26('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6b00296..b6d6610 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 _0x2029=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','intersection','length','options','create','body','catch','eml-format','rimraf','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x2029,0x84));var _0x9202=function(_0xc5aea0,_0x226ce0){_0xc5aea0=_0xc5aea0-0x0;var _0x4c9c04=_0x2029[_0xc5aea0];return _0x4c9c04;};'use strict';var emlformat=require(_0x9202('0x0'));var rimraf=require(_0x9202('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9202('0x2'));var moment=require(_0x9202('0x3'));var BPromise=require(_0x9202('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9202('0x5'));var sox=require(_0x9202('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9202('0x7'));var _=require(_0x9202('0x8'));var squel=require(_0x9202('0x9'));var crypto=require('crypto');var jsforce=require(_0x9202('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9202('0xb'));var querystring=require(_0x9202('0xc'));var Papa=require(_0x9202('0xd'));var Redis=require('ioredis');var authService=require(_0x9202('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9202('0xf'));var hardwareService=require(_0x9202('0x10'));var logger=require('../../config/logger')(_0x9202('0x11'));var utils=require(_0x9202('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9202('0x13'))['db'];function respondWithStatusCode(_0x339291,_0x18c869){_0x18c869=_0x18c869||0xcc;return function(_0x25dc67){if(_0x25dc67){return _0x339291['sendStatus'](_0x18c869);}return _0x339291[_0x9202('0x14')](_0x18c869)['end']();};}function respondWithResult(_0x4009fd,_0x32750a){_0x32750a=_0x32750a||0xc8;return function(_0x1394b1){if(_0x1394b1){return _0x4009fd[_0x9202('0x14')](_0x32750a)['json'](_0x1394b1);}};}function respondWithFilteredResult(_0x2b0bb5,_0x3e5a42){return function(_0x22fb47){if(_0x22fb47){var _0x4bbc7a=typeof _0x3e5a42[_0x9202('0x15')]==='undefined'&&typeof _0x3e5a42[_0x9202('0x16')]===_0x9202('0x17');var _0x1fa92d=_0x22fb47[_0x9202('0x18')];var _0x3aeb21=_0x4bbc7a?0x0:_0x3e5a42['offset'];var _0x3e44eb=_0x4bbc7a?_0x22fb47[_0x9202('0x18')]:_0x3e5a42[_0x9202('0x15')]+_0x3e5a42['limit'];var _0x1f01d7;if(_0x3e44eb>=_0x1fa92d){_0x3e44eb=_0x1fa92d;_0x1f01d7=0xc8;}else{_0x1f01d7=0xce;}_0x2b0bb5[_0x9202('0x14')](_0x1f01d7);return _0x2b0bb5[_0x9202('0x19')](_0x9202('0x1a'),_0x3aeb21+'-'+_0x3e44eb+'/'+_0x1fa92d)['json'](_0x22fb47);}return null;};}function patchUpdates(_0x5dfbd3){return function(_0x4554c2){try{jsonpatch[_0x9202('0x1b')](_0x4554c2,_0x5dfbd3,!![]);}catch(_0x2cc666){return BPromise[_0x9202('0x1c')](_0x2cc666);}return _0x4554c2[_0x9202('0x1d')]();};}function saveUpdates(_0x3b76bf,_0x4a0e0c){return function(_0x2b36a8){if(_0x2b36a8){return _0x2b36a8[_0x9202('0x1e')](_0x3b76bf)['then'](function(_0x4d0b66){return _0x4d0b66;});}return null;};}function removeEntity(_0x1aae50,_0x566272){return function(_0x277a1a){if(_0x277a1a){return _0x277a1a[_0x9202('0x1f')]()[_0x9202('0x20')](function(){_0x1aae50[_0x9202('0x14')](0xcc)[_0x9202('0x21')]();});}};}function handleEntityNotFound(_0x526319,_0x35d232){return function(_0x5cdd78){if(!_0x5cdd78){_0x526319[_0x9202('0x22')](0x194);}return _0x5cdd78;};}function handleError(_0x552e45,_0x1aeb60){_0x1aeb60=_0x1aeb60||0x1f4;return function(_0x17329f){logger[_0x9202('0x23')](_0x17329f[_0x9202('0x24')]);if(_0x17329f[_0x9202('0x25')]){delete _0x17329f[_0x9202('0x25')];}_0x552e45[_0x9202('0x14')](_0x1aeb60)[_0x9202('0x26')](_0x17329f);};}exports[_0x9202('0x27')]=function(_0x25fbd8,_0x261a65){var _0x53887e={},_0x47ce38={},_0x18cf98={'count':0x0,'rows':[]};var _0x2ade71=_['map'](db['VoiceQueuesLog'][_0x9202('0x28')],function(_0x22bbcd){return{'name':_0x22bbcd[_0x9202('0x29')],'type':_0x22bbcd[_0x9202('0x2a')][_0x9202('0x2b')]};});_0x47ce38[_0x9202('0x2c')]=_[_0x9202('0x2d')](_0x2ade71,_0x9202('0x25'));_0x47ce38[_0x9202('0x2e')]=_[_0x9202('0x2f')](_0x25fbd8[_0x9202('0x2e')]);_0x47ce38['filters']=_['intersection'](_0x47ce38[_0x9202('0x2c')],_0x47ce38[_0x9202('0x2e')]);_0x53887e[_0x9202('0x30')]=_['intersection'](_0x47ce38[_0x9202('0x2c')],qs[_0x9202('0x31')](_0x25fbd8[_0x9202('0x2e')][_0x9202('0x31')]));_0x53887e[_0x9202('0x30')]=_0x53887e['attributes']['length']?_0x53887e[_0x9202('0x30')]:_0x47ce38[_0x9202('0x2c')];if(!_0x25fbd8[_0x9202('0x2e')][_0x9202('0x32')](_0x9202('0x33'))){_0x53887e[_0x9202('0x16')]=qs[_0x9202('0x16')](_0x25fbd8[_0x9202('0x2e')][_0x9202('0x16')]);_0x53887e[_0x9202('0x15')]=qs[_0x9202('0x15')](_0x25fbd8[_0x9202('0x2e')][_0x9202('0x15')]);}_0x53887e['order']=qs['sort'](_0x25fbd8[_0x9202('0x2e')][_0x9202('0x34')]);_0x53887e[_0x9202('0x35')]=qs[_0x9202('0x36')](_['pick'](_0x25fbd8['query'],_0x47ce38[_0x9202('0x36')]),_0x2ade71);if(_0x25fbd8['query']['filter']){_0x53887e[_0x9202('0x35')]=_[_0x9202('0x37')](_0x53887e[_0x9202('0x35')],{'$or':_[_0x9202('0x2d')](_0x2ade71,function(_0x3eaa63){if(_0x3eaa63[_0x9202('0x2a')]!==_0x9202('0x38')){var _0x1a1196={};_0x1a1196[_0x3eaa63[_0x9202('0x25')]]={'$like':'%'+_0x25fbd8[_0x9202('0x2e')][_0x9202('0x39')]+'%'};return _0x1a1196;}})});}_0x53887e=_['merge']({},_0x53887e,_0x25fbd8['options']);var _0x2bc1e8={'where':_0x53887e[_0x9202('0x35')]};return db[_0x9202('0x3a')][_0x9202('0x18')](_0x2bc1e8)[_0x9202('0x20')](function(_0x50c063){_0x18cf98[_0x9202('0x18')]=_0x50c063;if(_0x25fbd8[_0x9202('0x2e')][_0x9202('0x3b')]){_0x53887e[_0x9202('0x3c')]=[{'all':!![]}];}return db[_0x9202('0x3a')][_0x9202('0x3d')](_0x53887e);})['then'](function(_0x174120){_0x18cf98[_0x9202('0x3e')]=_0x174120;return _0x18cf98;})['then'](respondWithFilteredResult(_0x261a65,_0x53887e))['catch'](handleError(_0x261a65,null));};exports[_0x9202('0x3f')]=function(_0x42aab6,_0x90788){var _0x37e123={'raw':!![],'where':{'id':_0x42aab6[_0x9202('0x40')]['id']}},_0x448fe9={};_0x448fe9[_0x9202('0x2c')]=_[_0x9202('0x2f')](db[_0x9202('0x3a')][_0x9202('0x28')]);_0x448fe9[_0x9202('0x2e')]=_[_0x9202('0x2f')](_0x42aab6['query']);_0x448fe9[_0x9202('0x36')]=_['intersection'](_0x448fe9['model'],_0x448fe9[_0x9202('0x2e')]);_0x37e123['attributes']=_[_0x9202('0x41')](_0x448fe9['model'],qs[_0x9202('0x31')](_0x42aab6['query'][_0x9202('0x31')]));_0x37e123[_0x9202('0x30')]=_0x37e123[_0x9202('0x30')][_0x9202('0x42')]?_0x37e123[_0x9202('0x30')]:_0x448fe9[_0x9202('0x2c')];if(_0x42aab6[_0x9202('0x2e')][_0x9202('0x3b')]){_0x37e123['include']=[{'all':!![]}];}_0x37e123=_[_0x9202('0x37')]({},_0x37e123,_0x42aab6[_0x9202('0x43')]);return db['VoiceQueuesLog']['find'](_0x37e123)[_0x9202('0x20')](handleEntityNotFound(_0x90788,null))[_0x9202('0x20')](respondWithResult(_0x90788,null))['catch'](handleError(_0x90788,null));};exports[_0x9202('0x44')]=function(_0x287f5e,_0x11cf7f){return db[_0x9202('0x3a')][_0x9202('0x44')](_0x287f5e[_0x9202('0x45')],{})[_0x9202('0x20')](respondWithResult(_0x11cf7f,0xc9))[_0x9202('0x46')](handleError(_0x11cf7f,null));};exports[_0x9202('0x1e')]=function(_0x289905,_0x29f3dc){if(_0x289905[_0x9202('0x45')]['id']){delete _0x289905[_0x9202('0x45')]['id'];}return db[_0x9202('0x3a')]['find']({'where':{'id':_0x289905[_0x9202('0x40')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x29f3dc,null))[_0x9202('0x20')](saveUpdates(_0x289905['body'],null))[_0x9202('0x20')](respondWithResult(_0x29f3dc,null))[_0x9202('0x46')](handleError(_0x29f3dc,null));};exports[_0x9202('0x1f')]=function(_0x3dbf4f,_0xae170d){return db[_0x9202('0x3a')]['find']({'where':{'id':_0x3dbf4f[_0x9202('0x40')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0xae170d,null))['then'](removeEntity(_0xae170d,null))[_0x9202('0x46')](handleError(_0xae170d,null));}; \ No newline at end of file +var _0x7c4d=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','status','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x7c4d,0x12d));var _0xd7c4=function(_0x333a32,_0x437895){_0x333a32=_0x333a32-0x0;var _0x546b48=_0x7c4d[_0x333a32];return _0x546b48;};'use strict';var emlformat=require(_0xd7c4('0x0'));var rimraf=require(_0xd7c4('0x1'));var zipdir=require(_0xd7c4('0x2'));var jsonpatch=require(_0xd7c4('0x3'));var rp=require(_0xd7c4('0x4'));var moment=require(_0xd7c4('0x5'));var BPromise=require(_0xd7c4('0x6'));var Mustache=require(_0xd7c4('0x7'));var util=require(_0xd7c4('0x8'));var path=require(_0xd7c4('0x9'));var sox=require(_0xd7c4('0xa'));var csv=require(_0xd7c4('0xb'));var ejs=require(_0xd7c4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7c4('0xd'));var squel=require(_0xd7c4('0xe'));var crypto=require(_0xd7c4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd7c4('0x10'));var toCsv=require(_0xd7c4('0xb'));var querystring=require('querystring');var Papa=require(_0xd7c4('0x11'));var Redis=require(_0xd7c4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd7c4('0x13'));var as=require(_0xd7c4('0x14'));var hardwareService=require(_0xd7c4('0x15'));var logger=require(_0xd7c4('0x16'))(_0xd7c4('0x17'));var utils=require(_0xd7c4('0x18'));var config=require(_0xd7c4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2779ab,_0x1a73b4){_0x1a73b4=_0x1a73b4||0xcc;return function(_0x50d620){if(_0x50d620){return _0x2779ab[_0xd7c4('0x1a')](_0x1a73b4);}return _0x2779ab['status'](_0x1a73b4)['end']();};}function respondWithResult(_0x465c23,_0x3f5462){_0x3f5462=_0x3f5462||0xc8;return function(_0x59a57c){if(_0x59a57c){return _0x465c23['status'](_0x3f5462)[_0xd7c4('0x1b')](_0x59a57c);}};}function respondWithFilteredResult(_0x2a5f78,_0x4600de){return function(_0x494229){if(_0x494229){var _0x26cf77=typeof _0x4600de[_0xd7c4('0x1c')]===_0xd7c4('0x1d')&&typeof _0x4600de['limit']===_0xd7c4('0x1d');var _0x4752f6=_0x494229[_0xd7c4('0x1e')];var _0x3cbd60=_0x26cf77?0x0:_0x4600de[_0xd7c4('0x1c')];var _0x2bf824=_0x26cf77?_0x494229[_0xd7c4('0x1e')]:_0x4600de[_0xd7c4('0x1c')]+_0x4600de[_0xd7c4('0x1f')];var _0x5cfd89;if(_0x2bf824>=_0x4752f6){_0x2bf824=_0x4752f6;_0x5cfd89=0xc8;}else{_0x5cfd89=0xce;}_0x2a5f78['status'](_0x5cfd89);return _0x2a5f78[_0xd7c4('0x20')](_0xd7c4('0x21'),_0x3cbd60+'-'+_0x2bf824+'/'+_0x4752f6)[_0xd7c4('0x1b')](_0x494229);}return null;};}function patchUpdates(_0x5f0f0d){return function(_0x5dbd71){try{jsonpatch[_0xd7c4('0x22')](_0x5dbd71,_0x5f0f0d,!![]);}catch(_0x50ea2c){return BPromise[_0xd7c4('0x23')](_0x50ea2c);}return _0x5dbd71[_0xd7c4('0x24')]();};}function saveUpdates(_0x43442f,_0x19347e){return function(_0x208ce8){if(_0x208ce8){return _0x208ce8[_0xd7c4('0x25')](_0x43442f)[_0xd7c4('0x26')](function(_0x4069bc){return _0x4069bc;});}return null;};}function removeEntity(_0xbf2856,_0x2c1623){return function(_0x21c1ac){if(_0x21c1ac){return _0x21c1ac[_0xd7c4('0x27')]()[_0xd7c4('0x26')](function(){_0xbf2856['status'](0xcc)[_0xd7c4('0x28')]();});}};}function handleEntityNotFound(_0x39c5a9,_0x15de82){return function(_0x5ecdb5){if(!_0x5ecdb5){_0x39c5a9[_0xd7c4('0x1a')](0x194);}return _0x5ecdb5;};}function handleError(_0x43b206,_0x2c7cc7){_0x2c7cc7=_0x2c7cc7||0x1f4;return function(_0x5ee033){logger[_0xd7c4('0x29')](_0x5ee033[_0xd7c4('0x2a')]);if(_0x5ee033[_0xd7c4('0x2b')]){delete _0x5ee033['name'];}_0x43b206[_0xd7c4('0x2c')](_0x2c7cc7)['send'](_0x5ee033);};}exports[_0xd7c4('0x2d')]=function(_0x1bda47,_0x18cbb2){var _0xdea06={},_0x57ad52={},_0xffdf88={'count':0x0,'rows':[]};var _0xedfd08=_['map'](db[_0xd7c4('0x2e')][_0xd7c4('0x2f')],function(_0x2806ae){return{'name':_0x2806ae[_0xd7c4('0x30')],'type':_0x2806ae[_0xd7c4('0x31')][_0xd7c4('0x32')]};});_0x57ad52[_0xd7c4('0x33')]=_['map'](_0xedfd08,_0xd7c4('0x2b'));_0x57ad52[_0xd7c4('0x34')]=_[_0xd7c4('0x35')](_0x1bda47['query']);_0x57ad52[_0xd7c4('0x36')]=_[_0xd7c4('0x37')](_0x57ad52[_0xd7c4('0x33')],_0x57ad52[_0xd7c4('0x34')]);_0xdea06['attributes']=_[_0xd7c4('0x37')](_0x57ad52[_0xd7c4('0x33')],qs['fields'](_0x1bda47[_0xd7c4('0x34')][_0xd7c4('0x38')]));_0xdea06[_0xd7c4('0x39')]=_0xdea06[_0xd7c4('0x39')]['length']?_0xdea06[_0xd7c4('0x39')]:_0x57ad52['model'];if(!_0x1bda47[_0xd7c4('0x34')]['hasOwnProperty']('nolimit')){_0xdea06[_0xd7c4('0x1f')]=qs[_0xd7c4('0x1f')](_0x1bda47[_0xd7c4('0x34')][_0xd7c4('0x1f')]);_0xdea06[_0xd7c4('0x1c')]=qs[_0xd7c4('0x1c')](_0x1bda47[_0xd7c4('0x34')][_0xd7c4('0x1c')]);}_0xdea06[_0xd7c4('0x3a')]=qs[_0xd7c4('0x3b')](_0x1bda47['query']['sort']);_0xdea06[_0xd7c4('0x3c')]=qs[_0xd7c4('0x36')](_[_0xd7c4('0x3d')](_0x1bda47[_0xd7c4('0x34')],_0x57ad52[_0xd7c4('0x36')]),_0xedfd08);if(_0x1bda47[_0xd7c4('0x34')][_0xd7c4('0x3e')]){_0xdea06[_0xd7c4('0x3c')]=_[_0xd7c4('0x3f')](_0xdea06[_0xd7c4('0x3c')],{'$or':_[_0xd7c4('0x40')](_0xedfd08,function(_0xdd30f6){if(_0xdd30f6[_0xd7c4('0x31')]!=='VIRTUAL'){var _0x42c720={};_0x42c720[_0xdd30f6[_0xd7c4('0x2b')]]={'$like':'%'+_0x1bda47[_0xd7c4('0x34')][_0xd7c4('0x3e')]+'%'};return _0x42c720;}})});}_0xdea06=_[_0xd7c4('0x3f')]({},_0xdea06,_0x1bda47['options']);var _0x51d8c3={'where':_0xdea06[_0xd7c4('0x3c')]};return db[_0xd7c4('0x2e')][_0xd7c4('0x1e')](_0x51d8c3)[_0xd7c4('0x26')](function(_0xbb86d3){_0xffdf88['count']=_0xbb86d3;if(_0x1bda47['query'][_0xd7c4('0x41')]){_0xdea06[_0xd7c4('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xd7c4('0x43')](_0xdea06);})['then'](function(_0x1abcf3){_0xffdf88[_0xd7c4('0x44')]=_0x1abcf3;return _0xffdf88;})[_0xd7c4('0x26')](respondWithFilteredResult(_0x18cbb2,_0xdea06))[_0xd7c4('0x45')](handleError(_0x18cbb2,null));};exports[_0xd7c4('0x46')]=function(_0x554b3c,_0x5d14f0){var _0x4a7ffe={'raw':!![],'where':{'id':_0x554b3c[_0xd7c4('0x47')]['id']}},_0x22b449={};_0x22b449['model']=_[_0xd7c4('0x35')](db[_0xd7c4('0x2e')][_0xd7c4('0x2f')]);_0x22b449[_0xd7c4('0x34')]=_[_0xd7c4('0x35')](_0x554b3c[_0xd7c4('0x34')]);_0x22b449[_0xd7c4('0x36')]=_[_0xd7c4('0x37')](_0x22b449['model'],_0x22b449[_0xd7c4('0x34')]);_0x4a7ffe[_0xd7c4('0x39')]=_[_0xd7c4('0x37')](_0x22b449[_0xd7c4('0x33')],qs[_0xd7c4('0x38')](_0x554b3c[_0xd7c4('0x34')]['fields']));_0x4a7ffe['attributes']=_0x4a7ffe[_0xd7c4('0x39')][_0xd7c4('0x48')]?_0x4a7ffe[_0xd7c4('0x39')]:_0x22b449[_0xd7c4('0x33')];if(_0x554b3c[_0xd7c4('0x34')][_0xd7c4('0x41')]){_0x4a7ffe[_0xd7c4('0x42')]=[{'all':!![]}];}_0x4a7ffe=_[_0xd7c4('0x3f')]({},_0x4a7ffe,_0x554b3c['options']);return db['VoiceQueuesLog'][_0xd7c4('0x49')](_0x4a7ffe)[_0xd7c4('0x26')](handleEntityNotFound(_0x5d14f0,null))[_0xd7c4('0x26')](respondWithResult(_0x5d14f0,null))[_0xd7c4('0x45')](handleError(_0x5d14f0,null));};exports[_0xd7c4('0x4a')]=function(_0x26971a,_0x1778f5){return db[_0xd7c4('0x2e')][_0xd7c4('0x4a')](_0x26971a[_0xd7c4('0x4b')],{})[_0xd7c4('0x26')](respondWithResult(_0x1778f5,0xc9))[_0xd7c4('0x45')](handleError(_0x1778f5,null));};exports[_0xd7c4('0x25')]=function(_0x1b6de5,_0x568723){if(_0x1b6de5[_0xd7c4('0x4b')]['id']){delete _0x1b6de5['body']['id'];}return db[_0xd7c4('0x2e')][_0xd7c4('0x49')]({'where':{'id':_0x1b6de5['params']['id']}})[_0xd7c4('0x26')](handleEntityNotFound(_0x568723,null))[_0xd7c4('0x26')](saveUpdates(_0x1b6de5[_0xd7c4('0x4b')],null))[_0xd7c4('0x26')](respondWithResult(_0x568723,null))['catch'](handleError(_0x568723,null));};exports[_0xd7c4('0x27')]=function(_0x326819,_0x355d39){return db[_0xd7c4('0x2e')][_0xd7c4('0x49')]({'where':{'id':_0x326819[_0xd7c4('0x47')]['id']}})[_0xd7c4('0x26')](handleEntityNotFound(_0x355d39,null))[_0xd7c4('0x26')](removeEntity(_0x355d39,null))['catch'](handleError(_0x355d39,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 53db1dc..a83e9e3 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 _0x3445=['event_dtm','dtm','lodash','util','moment','bluebird','path','rimraf','../../config/environment','define','VoiceQueuesLog','voice_queues_log'];(function(_0x7025b0,_0x9533f1){var _0x6e444c=function(_0x258fe9){while(--_0x258fe9){_0x7025b0['push'](_0x7025b0['shift']());}};_0x6e444c(++_0x9533f1);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5344('0x2'));var BPromise=require(_0x5344('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5344('0x4'));var rimraf=require(_0x5344('0x5'));var config=require(_0x5344('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x27eda8,_0x228eb6){return _0x27eda8[_0x5344('0x7')](_0x5344('0x8'),attributes,{'tableName':_0x5344('0x9'),'paranoid':![],'indexes':[{'name':_0x5344('0xa'),'fields':['event',_0x5344('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x05d9=['event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x4b4eb6,_0x360128){var _0x2e8747=function(_0x3e9eea){while(--_0x3e9eea){_0x4b4eb6['push'](_0x4b4eb6['shift']());}};_0x2e8747(++_0x360128);}(_0x05d9,0x1b3));var _0x905d=function(_0x4fcd09,_0x4a1772){_0x4fcd09=_0x4fcd09-0x0;var _0x2c24b9=_0x05d9[_0x4fcd09];return _0x2c24b9;};'use strict';var _=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var logger=require(_0x905d('0x2'))(_0x905d('0x3'));var moment=require(_0x905d('0x4'));var BPromise=require(_0x905d('0x5'));var rp=require(_0x905d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x905d('0x7'));var config=require('../../config/environment');var attributes=require(_0x905d('0x8'));module[_0x905d('0x9')]=function(_0x5ac361,_0x37159e){return _0x5ac361[_0x905d('0xa')](_0x905d('0xb'),attributes,{'tableName':_0x905d('0xc'),'paranoid':![],'indexes':[{'name':_0x905d('0xd'),'fields':[_0x905d('0xe'),_0x905d('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 60025e9..9d4afa9 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 _0xabc4=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x2265c7,_0x2731db){var _0x296b78=function(_0x4af313){while(--_0x4af313){_0x2265c7['push'](_0x2265c7['shift']());}};_0x296b78(++_0x2731db);}(_0xabc4,0x160));var _0x4abc=function(_0x19a490,_0x4627d9){_0x19a490=_0x19a490-0x0;var _0x52081c=_0xabc4[_0x19a490];return _0x52081c;};'use strict';var _=require('lodash');var util=require(_0x4abc('0x0'));var moment=require(_0x4abc('0x1'));var BPromise=require(_0x4abc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abc('0x3'));var db=require(_0x4abc('0x4'))['db'];var utils=require(_0x4abc('0x5'));var logger=require(_0x4abc('0x6'))(_0x4abc('0x7'));var config=require(_0x4abc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4abc('0x9')][_0x4abc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c346e,_0x59febf,_0xd100b4){return new BPromise(function(_0x59910a,_0x578bdb){return client[_0x4abc('0xb')](_0x3c346e,_0xd100b4)[_0x4abc('0xc')](function(_0x48a00a){logger[_0x4abc('0xd')](_0x4abc('0xe'),_0x59febf,_0x4abc('0xf'));logger[_0x4abc('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x59febf,'request\x20sent',JSON[_0x4abc('0x11')](_0x48a00a));if(_0x48a00a[_0x4abc('0x12')]){if(_0x48a00a['error'][_0x4abc('0x13')]===0x1f4){logger[_0x4abc('0x12')](_0x4abc('0xe'),_0x59febf,_0x48a00a[_0x4abc('0x12')][_0x4abc('0x14')]);return _0x578bdb(_0x48a00a[_0x4abc('0x12')][_0x4abc('0x14')]);}logger[_0x4abc('0x12')](_0x4abc('0xe'),_0x59febf,_0x48a00a[_0x4abc('0x12')][_0x4abc('0x14')]);return _0x59910a(_0x48a00a[_0x4abc('0x12')][_0x4abc('0x14')]);}else{logger[_0x4abc('0xd')](_0x4abc('0xe'),_0x59febf,_0x4abc('0xf'));_0x59910a(_0x48a00a['result'][_0x4abc('0x14')]);}})[_0x4abc('0x15')](function(_0x171f72){logger[_0x4abc('0x12')](_0x4abc('0xe'),_0x59febf,_0x171f72);_0x578bdb(_0x171f72);});});} \ No newline at end of file +var _0xc36a=['request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x558c5e,_0x549052){var _0x492f84=function(_0x1a90b0){while(--_0x1a90b0){_0x558c5e['push'](_0x558c5e['shift']());}};_0x492f84(++_0x549052);}(_0xc36a,0x180));var _0xac36=function(_0x2b8356,_0x42a7a1){_0x2b8356=_0x2b8356-0x0;var _0x4ea7ad=_0xc36a[_0x2b8356];return _0x4ea7ad;};'use strict';var _=require(_0xac36('0x0'));var util=require(_0xac36('0x1'));var moment=require('moment');var BPromise=require(_0xac36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac36('0x3'));var db=require(_0xac36('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac36('0x5'));var config=require('../../config/environment');var jayson=require(_0xac36('0x6'));var client=jayson[_0xac36('0x7')][_0xac36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa2f50e,_0x4a72ab,_0x5b8700){return new BPromise(function(_0xe6d230,_0x5e406c){return client['request'](_0xa2f50e,_0x5b8700)[_0xac36('0x9')](function(_0x53c15f){logger[_0xac36('0xa')](_0xac36('0xb'),_0x4a72ab,_0xac36('0xc'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4a72ab,_0xac36('0xc'),JSON[_0xac36('0xd')](_0x53c15f));if(_0x53c15f[_0xac36('0xe')]){if(_0x53c15f[_0xac36('0xe')]['code']===0x1f4){logger[_0xac36('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a72ab,_0x53c15f[_0xac36('0xe')][_0xac36('0xf')]);return _0x5e406c(_0x53c15f[_0xac36('0xe')][_0xac36('0xf')]);}logger[_0xac36('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a72ab,_0x53c15f[_0xac36('0xe')][_0xac36('0xf')]);return _0xe6d230(_0x53c15f[_0xac36('0xe')]['message']);}else{logger['info'](_0xac36('0xb'),_0x4a72ab,'request\x20sent');_0xe6d230(_0x53c15f[_0xac36('0x10')][_0xac36('0xf')]);}})[_0xac36('0x11')](function(_0x19366b){logger[_0xac36('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a72ab,_0x19366b);_0x5e406c(_0x19366b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 155b76b..21f59fb 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 _0x31f9=['/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x4a2388,_0x4243db){var _0xd35f34=function(_0x1ebb82){while(--_0x1ebb82){_0x4a2388['push'](_0x4a2388['shift']());}};_0xd35f34(++_0x4243db);}(_0x31f9,0xb3));var _0x931f=function(_0x5eca50,_0x1c3d9f){_0x5eca50=_0x5eca50-0x0;var _0x1f2c02=_0x31f9[_0x5eca50];return _0x1f2c02;};'use strict';var multer=require(_0x931f('0x0'));var util=require(_0x931f('0x1'));var path=require(_0x931f('0x2'));var timeout=require('connect-timeout');var express=require(_0x931f('0x3'));var router=express[_0x931f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x931f('0x5'));var interaction=require(_0x931f('0x6'));var config=require('../../config/environment');var controller=require(_0x931f('0x7'));router[_0x931f('0x8')]('/',auth[_0x931f('0x9')](),controller[_0x931f('0xa')]);router[_0x931f('0x8')]('/describe',auth[_0x931f('0x9')](),controller[_0x931f('0xb')]);router[_0x931f('0x8')](_0x931f('0xc'),auth[_0x931f('0x9')](),controller['show']);router[_0x931f('0x8')](_0x931f('0xd'),auth[_0x931f('0x9')](),controller[_0x931f('0xe')]);router[_0x931f('0x8')](_0x931f('0xf'),controller[_0x931f('0x10')]);router[_0x931f('0x8')](_0x931f('0x11'),auth['isAuthenticated'](),controller[_0x931f('0x12')]);router[_0x931f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x931f('0x13')]('/:id/transcribe',auth[_0x931f('0x9')](),controller[_0x931f('0x14')]);router['put'](_0x931f('0xc'),auth[_0x931f('0x9')](),controller[_0x931f('0x15')]);router[_0x931f('0x16')](_0x931f('0xc'),auth[_0x931f('0x9')](),controller[_0x931f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdd42=['/:id/transcribe','downloadTranscribe','create','post','runTranscribe','/:id','update','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id/download','download','/:id/downloads','downloads'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xdd42,0x1be));var _0x2dd4=function(_0x51f382,_0x477a5c){_0x51f382=_0x51f382-0x0;var _0x4ad235=_0xdd42[_0x51f382];return _0x4ad235;};'use strict';var multer=require('multer');var util=require(_0x2dd4('0x0'));var path=require(_0x2dd4('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dd4('0x2'));var router=express[_0x2dd4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2dd4('0x4'));var config=require(_0x2dd4('0x5'));var controller=require('./voiceRecording.controller');router[_0x2dd4('0x6')]('/',auth['isAuthenticated'](),controller[_0x2dd4('0x7')]);router[_0x2dd4('0x6')]('/describe',auth[_0x2dd4('0x8')](),controller[_0x2dd4('0x9')]);router['get']('/:id',auth[_0x2dd4('0x8')](),controller['show']);router[_0x2dd4('0x6')](_0x2dd4('0xa'),auth[_0x2dd4('0x8')](),controller[_0x2dd4('0xb')]);router[_0x2dd4('0x6')](_0x2dd4('0xc'),controller[_0x2dd4('0xd')]);router[_0x2dd4('0x6')](_0x2dd4('0xe'),auth[_0x2dd4('0x8')](),controller[_0x2dd4('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2dd4('0x10')]);router[_0x2dd4('0x11')](_0x2dd4('0xe'),auth[_0x2dd4('0x8')](),controller[_0x2dd4('0x12')]);router['put'](_0x2dd4('0x13'),auth[_0x2dd4('0x8')](),controller[_0x2dd4('0x14')]);router['delete'](_0x2dd4('0x13'),auth[_0x2dd4('0x8')](),controller[_0x2dd4('0x15')]);module[_0x2dd4('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 47c3791..756abe1 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 7be4be3..559a195 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 _0x6534=['Not\x20found','downloads','../../components/encryptor','sequelize','col','token','$and','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','describe','download','uniqueid','find','%s.cypher','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send'];(function(_0x2ffd1f,_0x4d8b3e){var _0x565c5d=function(_0x348fe9){while(--_0x348fe9){_0x2ffd1f['push'](_0x2ffd1f['shift']());}};_0x565c5d(++_0x4d8b3e);}(_0x6534,0x161));var _0x4653=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6534[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4653('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4653('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4653('0x2'));var moment=require(_0x4653('0x3'));var BPromise=require(_0x4653('0x4'));var Mustache=require(_0x4653('0x5'));var util=require(_0x4653('0x6'));var path=require('path');var sox=require(_0x4653('0x7'));var csv=require(_0x4653('0x8'));var ejs=require(_0x4653('0x9'));var fs=require('fs');var fs_extra=require(_0x4653('0xa'));var _=require('lodash');var squel=require(_0x4653('0xb'));var crypto=require(_0x4653('0xc'));var jsforce=require(_0x4653('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4653('0x8'));var querystring=require(_0x4653('0xe'));var Papa=require('papaparse');var AWS=require(_0x4653('0xf'));var uuidv4=require(_0x4653('0x10'));var Redis=require(_0x4653('0x11'));var authService=require(_0x4653('0x12'));var qs=require(_0x4653('0x13'));var as=require(_0x4653('0x14'));var hardwareService=require(_0x4653('0x15'));var logger=require(_0x4653('0x16'))(_0x4653('0x17'));var utils=require(_0x4653('0x18'));var config=require(_0x4653('0x19'));var licenseUtil=require(_0x4653('0x1a'));var db=require(_0x4653('0x1b'))['db'];function respondWithStatusCode(_0x2d24a2,_0x595c57){_0x595c57=_0x595c57||0xcc;return function(_0x263523){if(_0x263523){return _0x2d24a2[_0x4653('0x1c')](_0x595c57);}return _0x2d24a2[_0x4653('0x1d')](_0x595c57)[_0x4653('0x1e')]();};}function respondWithResult(_0x20d7cd,_0x3382a4){_0x3382a4=_0x3382a4||0xc8;return function(_0x490e3d){if(_0x490e3d){return _0x20d7cd['status'](_0x3382a4)[_0x4653('0x1f')](_0x490e3d);}};}function respondWithFilteredResult(_0x33f924,_0x20a4ac){return function(_0x12d656){if(_0x12d656){var _0x44c8c7=typeof _0x20a4ac[_0x4653('0x20')]===_0x4653('0x21')&&typeof _0x20a4ac[_0x4653('0x22')]===_0x4653('0x21');var _0x41186d=_0x12d656[_0x4653('0x23')];var _0x1b8c34=_0x44c8c7?0x0:_0x20a4ac[_0x4653('0x20')];var _0x4a5686=_0x44c8c7?_0x12d656['count']:_0x20a4ac['offset']+_0x20a4ac[_0x4653('0x22')];var _0x3597ff;if(_0x4a5686>=_0x41186d){_0x4a5686=_0x41186d;_0x3597ff=0xc8;}else{_0x3597ff=0xce;}_0x33f924[_0x4653('0x1d')](_0x3597ff);return _0x33f924[_0x4653('0x24')](_0x4653('0x25'),_0x1b8c34+'-'+_0x4a5686+'/'+_0x41186d)[_0x4653('0x1f')](_0x12d656);}return null;};}function patchUpdates(_0x3a1d14){return function(_0x5d5ec9){try{jsonpatch['apply'](_0x5d5ec9,_0x3a1d14,!![]);}catch(_0x309f32){return BPromise[_0x4653('0x26')](_0x309f32);}return _0x5d5ec9[_0x4653('0x27')]();};}function saveUpdates(_0x1641fb,_0x35aa43){return function(_0x5c9539){if(_0x5c9539){return _0x5c9539[_0x4653('0x28')](_0x1641fb)[_0x4653('0x29')](function(_0x37f53f){return _0x37f53f;});}return null;};}function removeEntity(_0x2a0ad7,_0x1ed579){return function(_0x2148fd){if(_0x2148fd){return _0x2148fd[_0x4653('0x2a')]()[_0x4653('0x29')](function(){_0x2a0ad7[_0x4653('0x1d')](0xcc)[_0x4653('0x1e')]();});}};}function handleEntityNotFound(_0x1a52e7,_0x3065d3){return function(_0x287464){if(!_0x287464){_0x1a52e7[_0x4653('0x1c')](0x194);}return _0x287464;};}function handleError(_0x121c94,_0x2b670a){_0x2b670a=_0x2b670a||0x1f4;return function(_0xa335d5){logger['error'](_0xa335d5[_0x4653('0x2b')]);if(_0xa335d5[_0x4653('0x2c')]){delete _0xa335d5['name'];}_0x121c94[_0x4653('0x1d')](_0x2b670a)['send'](_0xa335d5);};}exports[_0x4653('0x2d')]=function(_0xaad5f3,_0x444758){var _0x2baeee={},_0xc3199b={},_0x2469a3={'count':0x0,'rows':[]};var _0x295f45=_[_0x4653('0x2e')](db[_0x4653('0x2f')][_0x4653('0x30')],function(_0x2c5735){return{'name':_0x2c5735['fieldName'],'type':_0x2c5735[_0x4653('0x31')][_0x4653('0x32')]};});_0xc3199b[_0x4653('0x33')]=_[_0x4653('0x34')](_[_0x4653('0x2e')](_0x295f45,'name'),[_0x4653('0x35')]);_0xc3199b['query']=_['keys'](_0xaad5f3[_0x4653('0x36')]);_0xc3199b[_0x4653('0x37')]=_[_0x4653('0x38')](_0xc3199b[_0x4653('0x33')],_0xc3199b[_0x4653('0x36')]);_0x2baeee[_0x4653('0x39')]=_['intersection'](_0xc3199b[_0x4653('0x33')],qs[_0x4653('0x3a')](_0xaad5f3['query'][_0x4653('0x3a')]));_0x2baeee[_0x4653('0x39')]=_0x2baeee[_0x4653('0x39')]['length']?_0x2baeee[_0x4653('0x39')]:_0xc3199b[_0x4653('0x33')];if(!_0xaad5f3['query']['hasOwnProperty']('nolimit')){_0x2baeee[_0x4653('0x22')]=qs[_0x4653('0x22')](_0xaad5f3['query'][_0x4653('0x22')]);_0x2baeee['offset']=qs[_0x4653('0x20')](_0xaad5f3[_0x4653('0x36')]['offset']);}_0x2baeee[_0x4653('0x3b')]=qs[_0x4653('0x3c')](_0xaad5f3[_0x4653('0x36')]['sort']);_0x2baeee[_0x4653('0x3d')]=qs[_0x4653('0x37')](_[_0x4653('0x3e')](_0xaad5f3[_0x4653('0x36')],_0xc3199b[_0x4653('0x37')]),_0x295f45);if(_0xaad5f3[_0x4653('0x36')][_0x4653('0x3f')]){_0x2baeee[_0x4653('0x3d')]=_[_0x4653('0x40')](_0x2baeee[_0x4653('0x3d')],{'$or':_[_0x4653('0x2e')](_0x295f45,function(_0x19da44){if(_0x19da44[_0x4653('0x31')]!==_0x4653('0x41')){var _0x12e4d7={};_0x12e4d7[_0x19da44[_0x4653('0x2c')]]={'$like':'%'+_0xaad5f3[_0x4653('0x36')][_0x4653('0x3f')]+'%'};return _0x12e4d7;}})});}_0x2baeee=_[_0x4653('0x40')]({},_0x2baeee,_0xaad5f3[_0x4653('0x42')]);var _0x55c9f9={'where':_0x2baeee[_0x4653('0x3d')]};return db[_0x4653('0x2f')][_0x4653('0x23')](_0x55c9f9)['then'](function(_0x1f8b68){_0x2469a3[_0x4653('0x23')]=_0x1f8b68;if(_0xaad5f3[_0x4653('0x36')][_0x4653('0x43')]){_0x2baeee[_0x4653('0x44')]=[{'all':!![]}];}return db[_0x4653('0x2f')]['findAll'](_0x2baeee);})[_0x4653('0x29')](function(_0x465f2f){_0x2469a3[_0x4653('0x45')]=_0x465f2f;return _0x2469a3;})[_0x4653('0x29')](respondWithFilteredResult(_0x444758,_0x2baeee))[_0x4653('0x46')](handleError(_0x444758,null));};exports[_0x4653('0x47')]=function(_0x5303d7,_0x17a58d){var _0x534648={'raw':![],'where':{'id':_0x5303d7[_0x4653('0x48')]['id']}},_0x35051c={};_0x35051c[_0x4653('0x33')]=_[_0x4653('0x49')](db[_0x4653('0x2f')]['rawAttributes']);_0x35051c[_0x4653('0x36')]=_[_0x4653('0x49')](_0x5303d7[_0x4653('0x36')]);_0x35051c[_0x4653('0x37')]=_['intersection'](_0x35051c[_0x4653('0x33')],_0x35051c[_0x4653('0x36')]);_0x534648['attributes']=_[_0x4653('0x38')](_0x35051c[_0x4653('0x33')],qs[_0x4653('0x3a')](_0x5303d7[_0x4653('0x36')][_0x4653('0x3a')]));_0x534648[_0x4653('0x39')]=_0x534648[_0x4653('0x39')]['length']?_0x534648[_0x4653('0x39')]:_0x35051c[_0x4653('0x33')];if(_0x5303d7[_0x4653('0x36')][_0x4653('0x43')]){_0x534648[_0x4653('0x44')]=[{'all':!![]}];}_0x534648=_['merge']({},_0x534648,_0x5303d7[_0x4653('0x42')]);return db[_0x4653('0x2f')]['find'](_0x534648)[_0x4653('0x29')](handleEntityNotFound(_0x17a58d,null))[_0x4653('0x29')](respondWithResult(_0x17a58d,null))[_0x4653('0x46')](handleError(_0x17a58d,null));};exports[_0x4653('0x4a')]=function(_0x3f5d5e,_0x175576){return db[_0x4653('0x2f')][_0x4653('0x4a')](_0x3f5d5e[_0x4653('0x4b')],{})[_0x4653('0x29')](respondWithResult(_0x175576,0xc9))['catch'](handleError(_0x175576,null));};exports['update']=function(_0x1f6c48,_0x4538b1){if(_0x1f6c48[_0x4653('0x4b')]['id']){delete _0x1f6c48[_0x4653('0x4b')]['id'];}return db[_0x4653('0x2f')]['find']({'where':{'id':_0x1f6c48[_0x4653('0x48')]['id']}})['then'](handleEntityNotFound(_0x4538b1,null))['then'](saveUpdates(_0x1f6c48['body'],null))[_0x4653('0x29')](respondWithResult(_0x4538b1,null))[_0x4653('0x46')](handleError(_0x4538b1,null));};exports[_0x4653('0x4c')]=function(_0x3ab685,_0x163759){return db[_0x4653('0x2f')][_0x4653('0x4c')]()[_0x4653('0x29')](respondWithResult(_0x163759,null))['catch'](handleError(_0x163759,null));};exports[_0x4653('0x4d')]=function(_0x171c3e,_0x7857d3,_0x801062){var _0x5196bb=require('../../components/encryptor');var _0x499c8f=![];var _0x1a1a22={};if(_0x171c3e['query'][_0x4653('0x31')]&&_0x171c3e[_0x4653('0x36')][_0x4653('0x31')]===_0x4653('0x4e')){_0x1a1a22[_0x4653('0x4e')]=_0x171c3e[_0x4653('0x48')]['id'];}else{_0x1a1a22['id']=_0x171c3e[_0x4653('0x48')]['id'];}return db['VoiceRecording'][_0x4653('0x4f')]({'where':_0x1a1a22,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x7857d3,null))['then'](function(_0x4fd8e4){if(_0x4fd8e4){var _0x533184=_0x4fd8e4['value'];var _0x22da89=util[_0x4653('0x35')](_0x4653('0x50'),_0x533184);if(fs[_0x4653('0x51')](_0x22da89)){_0x499c8f=!![];return _0x5196bb[_0x4653('0x52')](_0x22da89,_0x533184,config[_0x4653('0x53')][_0x4653('0x54')])[_0x4653('0x29')](function(){return _0x4fd8e4;});}return _0x4fd8e4;}})[_0x4653('0x29')](function(_0x4bc55a){if(_0x4bc55a){var _0x22b6f4=_0x4bc55a[_0x4653('0x55')];if(!fs[_0x4653('0x51')](_0x22b6f4)){throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x58'));}if(_0x4bc55a[_0x4653('0x59')]){return _0x7857d3[_0x4653('0x4d')](_0x22b6f4,_0x4bc55a[_0x4653('0x59')]+path[_0x4653('0x5a')](_0x22b6f4),function(){if(_0x499c8f){fs[_0x4653('0x5b')](_0x22b6f4);}});}else{return _0x7857d3[_0x4653('0x4d')](_0x22b6f4,function(_0xdfb123){if(_0x499c8f){fs['unlink'](_0x22b6f4);}});}}})[_0x4653('0x46')](function(_0x5b88f6){if(_0x5b88f6[_0x4653('0x5c')]==='VoiceRecording\x20not\x20found'){_0x7857d3[_0x4653('0x1d')](0x194)[_0x4653('0x5d')](_0x4653('0x5e'));}else{return handleError(_0x7857d3,null);}});};exports[_0x4653('0x5f')]=function(_0x3c1a65,_0x2f88fb,_0x154d09){var _0xb09b7a=require(_0x4653('0x60'));var _0x5477ce=![];var _0x4d7268={'$and':[db[_0x4653('0x61')]['where'](db['sequelize']['fn']('MD5',db[_0x4653('0x61')][_0x4653('0x62')]('uniqueid')),_0x3c1a65[_0x4653('0x36')][_0x4653('0x63')])]};if(_0x3c1a65[_0x4653('0x36')][_0x4653('0x31')]&&_0x3c1a65['query']['type']===_0x4653('0x4e')){_0x4d7268[_0x4653('0x64')]['push']({'uniqueid':_0x3c1a65[_0x4653('0x48')]['id']});}else{_0x4d7268[_0x4653('0x64')][_0x4653('0x65')]({'id':_0x3c1a65[_0x4653('0x48')]['id']});}return db['VoiceRecording'][_0x4653('0x4f')]({'where':_0x4d7268,'attributes':['id',_0x4653('0x55')],'raw':!![]})[_0x4653('0x29')](handleEntityNotFound(_0x2f88fb,null))[_0x4653('0x29')](function(_0x49b37b){if(_0x49b37b){var _0x3cac72=util[_0x4653('0x35')](_0x4653('0x50'),_0x49b37b[_0x4653('0x55')]);if(fs[_0x4653('0x51')](_0x3cac72)){_0x5477ce=!![];return _0xb09b7a[_0x4653('0x52')](_0x3cac72,_0x49b37b[_0x4653('0x55')],config[_0x4653('0x53')]['recording'])[_0x4653('0x29')](function(){return _0x49b37b;});}return _0x49b37b;}})[_0x4653('0x29')](function(_0x5038bb){if(_0x5038bb){if(!fs['existsSync'](_0x5038bb[_0x4653('0x55')])){throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x58'));}if(_0x5038bb[_0x4653('0x59')]){return _0x2f88fb[_0x4653('0x4d')](_0x5038bb[_0x4653('0x55')],_0x5038bb[_0x4653('0x59')]+path[_0x4653('0x5a')](_0x5038bb[_0x4653('0x55')]),function(){if(_0x5477ce){fs[_0x4653('0x5b')](_0x5038bb[_0x4653('0x55')]);}});}else{return _0x2f88fb[_0x4653('0x4d')](_0x5038bb[_0x4653('0x55')],function(_0x57bf94){if(_0x5477ce){fs[_0x4653('0x5b')](_0x5038bb[_0x4653('0x55')]);}});}}})[_0x4653('0x46')](handleError(_0x2f88fb,null));};exports[_0x4653('0x2a')]=function(_0x162785,_0x1bac34){return db[_0x4653('0x2f')][_0x4653('0x4f')]({'where':{'id':_0x162785['params']['id']}})[_0x4653('0x29')](function(_0x4bff92){if(_[_0x4653('0x66')](_0x4bff92)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4bff92;})[_0x4653('0x29')](function(_0x4d9be4){var _0x5319c3=_0x4d9be4[_0x4653('0x55')];logger[_0x4653('0x67')](_0x4653('0x68'),_0x5319c3);if(!_['isNil'](_0x4d9be4[_0x4653('0x55')])&&fs[_0x4653('0x51')](_0x5319c3)){logger['info']('File:\x20\x22'+_0x5319c3+_0x4653('0x69'));fs['unlinkSync'](_0x5319c3);}_0x5319c3=_0x5319c3+_0x4653('0x6a');if(!_[_0x4653('0x66')](_0x4d9be4[_0x4653('0x55')])&&fs[_0x4653('0x51')](_0x5319c3)){logger[_0x4653('0x67')](_0x4653('0x6b')+_0x5319c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4653('0x6c')](_0x5319c3);}return _0x4d9be4;})[_0x4653('0x29')](function(_0x406c87){if(!_0x406c87)throw new InternalError();return _0x406c87[_0x4653('0x2a')]();})[_0x4653('0x29')](function(){_0x1bac34[_0x4653('0x1d')](0xcc)[_0x4653('0x1e')]();})['catch'](handleError(_0x1bac34,null));};function getBucketslist(_0x3e7497,_0x8fb229,_0x4f06a5){return new Promise(function(_0xa26ae4,_0x460a85){var _0x15014d=new AWS['S3']({'accessKeyId':_0x8fb229,'secretAccessKey':_0x3e7497,'region':_0x4f06a5});_0x15014d['listBuckets']({},function(_0x40a474,_0x120c31){if(_0x40a474){return _0x460a85(_0x40a474);}else{return _0xa26ae4(_0x120c31);}});});}function createBucket(_0x204d42,_0x2d3dcc,_0x33dbcf,_0x58f73b){return new Promise(function(_0x2c0159,_0x30bc49){var _0x543511=new AWS['S3']({'accessKeyId':_0x2d3dcc,'secretAccessKey':_0x204d42,'region':_0x33dbcf});_0x543511['createBucket']({'Bucket':_0x58f73b},function(_0x51ff6a,_0x17101a){if(_0x51ff6a){return _0x30bc49(_0x51ff6a);}else{return _0x2c0159(_0x17101a);}});});}function uploadFile(_0x1f23a0,_0x44d10a,_0x2194fc,_0x5381ae,_0x3f6869,_0x5d504b){return new Promise(function(_0x3ab649,_0x279f17){var _0x30070d=new AWS['S3']({'accessKeyId':_0x44d10a,'secretAccessKey':_0x1f23a0,'region':_0x2194fc});_0x30070d['upload']({'Bucket':_0x5381ae,'Key':_0x3f6869,'Body':_0x5d504b},function(_0x54171a,_0x102e1e){if(_0x54171a){return _0x279f17(_0x54171a);}else{return _0x3ab649(_0x102e1e);}});});}function startTranscribe(_0x13ab5d,_0x16d6aa,_0x1fc3c3,_0x3cc7cf,_0x2f927a,_0x55fc91){return new Promise(function(_0x3e328a,_0xad4abe){var _0x4ad8e7=new AWS[(_0x4653('0x6d'))]({'accessKeyId':_0x16d6aa,'secretAccessKey':_0x13ab5d,'region':_0x1fc3c3});_0x4ad8e7[_0x4653('0x6e')]({'TranscriptionJobName':_0x3cc7cf,'LanguageCode':_0x2f927a,'Media':{'MediaFileUri':_0x55fc91}},function(_0x4a74a7,_0x218c2d){if(_0x4a74a7){return _0xad4abe(_0x4a74a7);}else{return _0x3e328a(_0x218c2d);}});});}function transcribe(_0x297dbf,_0x3d40e8,_0x3e5dc3,_0x2245cd,_0x3c0534,_0x4c375e,_0x38ff29){return new Promise(function(_0x498a2a,_0x2c7cc3){var _0x5ec56d={};logger['info'](util[_0x4653('0x35')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x297dbf,_0x3c0534));return uploadFile(_0x3d40e8,_0x3e5dc3,_0x2245cd,_0x3c0534,path[_0x4653('0x6f')](_0x4c375e),fs[_0x4653('0x70')](_0x4c375e))['then'](function(_0x560b5d){logger[_0x4653('0x67')](util[_0x4653('0x35')](_0x4653('0x71'),_0x297dbf,_0x3c0534,_0x560b5d[_0x4653('0x72')]));_0x5ec56d['bucket']=_0x560b5d[_0x4653('0x73')];_0x5ec56d['location']=_0x560b5d[_0x4653('0x72')];logger[_0x4653('0x67')](util[_0x4653('0x35')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x297dbf));return startTranscribe(_0x3d40e8,_0x3e5dc3,_0x2245cd,uuidv4(),_0x38ff29,_0x560b5d[_0x4653('0x72')]);})[_0x4653('0x29')](function(_0x268135){logger[_0x4653('0x67')](util[_0x4653('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x297dbf,_0x268135['TranscriptionJob'][_0x4653('0x74')]));_0x5ec56d[_0x4653('0x75')]=_0x268135['TranscriptionJob'][_0x4653('0x74')];_0x5ec56d['transcribeStatus']=_0x268135[_0x4653('0x76')][_0x4653('0x77')];return _0x498a2a(_0x5ec56d);})[_0x4653('0x46')](function(_0x66c919){return _0x2c7cc3(_0x66c919);});});}exports['runTranscribe']=function(_0x261bf5,_0x3c74a9,_0x426eca){var _0x1c872f;var _0x310c67;var _0x1d667f;var _0x188a9d=require(_0x4653('0x60'));return db[_0x4653('0x2f')][_0x4653('0x78')]({'where':{'id':_0x261bf5['params']['id']}})[_0x4653('0x29')](function(_0x21cb1c){if(_0x21cb1c){var _0x209e46=util[_0x4653('0x35')](_0x4653('0x50'),_0x21cb1c[_0x4653('0x55')]);if(fs[_0x4653('0x51')](_0x209e46)){cypher=!![];return _0x188a9d['decryptFile'](_0x209e46,_0x21cb1c[_0x4653('0x55')],config[_0x4653('0x53')][_0x4653('0x54')])[_0x4653('0x29')](function(){return _0x21cb1c;});}return _0x21cb1c;}})['then'](function(_0x27d9ae){if(!_0x27d9ae){throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x79'));}_0x310c67=_0x27d9ae;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x4653('0x29')](handleEntityNotFound(_0x3c74a9,null))['then'](function(_0x3345f4){if(_0x3345f4){_0x1c872f=_0x3345f4;if(!_0x1c872f[_0x4653('0x7a')]||!_0x1c872f[_0x4653('0x7b')]||!_0x1c872f[_0x4653('0x7c')]||!_0x1c872f[_0x4653('0x7d')]||!_0x1c872f[_0x4653('0x7e')]){throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x7f'));}if(_0x261bf5[_0x4653('0x4b')]['runSentiment']&&(!_0x1c872f[_0x4653('0x80')]||!_0x1c872f[_0x4653('0x81')]||!_0x1c872f[_0x4653('0x82')]||!_0x1c872f[_0x4653('0x7d')]||!_0x1c872f['bucket'])){throw new db['Sequelize'][(_0x4653('0x57'))](_0x4653('0x83'));}return db[_0x4653('0x84')][_0x4653('0x78')]({'where':{'id':_0x1c872f[_0x4653('0x7b')]}});}})[_0x4653('0x29')](function(_0xe4e6fc){if(!_0xe4e6fc){throw new db[(_0x4653('0x56'))]['ValidationError'](_0x4653('0x85'));}if(!_0xe4e6fc[_0x4653('0x86')]||!_0xe4e6fc[_0x4653('0x87')]){throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x88'));}_0x1d667f=_0xe4e6fc;return getBucketslist(_0x1d667f['data1'],_0x1d667f[_0x4653('0x87')],_0x1c872f['transcribeRegion']);})[_0x4653('0x29')](function(_0x4989a7){if(_0x4989a7&&_0x4989a7[_0x4653('0x89')]){var _0x59a008=_[_0x4653('0x4f')](_0x4989a7[_0x4653('0x89')],function(_0x563e11){return _0x563e11[_0x4653('0x8a')]===_0x1c872f[_0x4653('0x7e')];});if(!_0x59a008){logger[_0x4653('0x67')](util[_0x4653('0x35')](_0x4653('0x8b'),_0x261bf5[_0x4653('0x48')]['id'],_0x1c872f[_0x4653('0x7e')]));return createBucket(_0x1d667f[_0x4653('0x86')],_0x1d667f[_0x4653('0x87')],_0x1c872f[_0x4653('0x7c')],_0x1c872f[_0x4653('0x7e')]);}logger[_0x4653('0x67')](util['format'](_0x4653('0x8c'),_0x261bf5[_0x4653('0x48')]['id'],_0x1c872f[_0x4653('0x7e')]));return;}})['then'](function(_0x3f8af1){if(_0x310c67['transcribeStatus']===_0x4653('0x8d')){return transcribe(_0x261bf5[_0x4653('0x48')]['id'],_0x1d667f[_0x4653('0x86')],_0x1d667f['data2'],_0x1c872f[_0x4653('0x7c')],_0x1c872f[_0x4653('0x7e')],_0x310c67[_0x4653('0x55')],_0x1c872f[_0x4653('0x7d')]);}else{logger[_0x4653('0x67')](util[_0x4653('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x261bf5[_0x4653('0x48')]['id']));return{'transcribeStatus':_0x4653('0x8e')};}})[_0x4653('0x29')](function(_0x1216fd){if(_0x1216fd){_0x1216fd['tempSentiment']=_0x261bf5['body']['runSentiment'];return _0x310c67[_0x4653('0x8f')](_0x1216fd);}})[_0x4653('0x29')](respondWithResult(_0x3c74a9,null))['catch'](handleError(_0x3c74a9,null));};function writeFile(_0x1f9c1e,_0x57b6c1){return new Promise(function(_0x19039b,_0x36603e){fs['writeFile'](_0x57b6c1,_0x1f9c1e,function(_0x379c99,_0x1ea167){if(_0x379c99){return _0x36603e(_0x379c99);}else{return _0x19039b(_0x1ea167);}});});}exports[_0x4653('0x90')]=function(_0x1a04d0,_0x1dd023,_0x3e1663){return db[_0x4653('0x2f')][_0x4653('0x78')]({'where':{'id':_0x1a04d0[_0x4653('0x48')]['id']}})[_0x4653('0x29')](handleEntityNotFound(_0x1dd023))['then'](function(_0x447e4b){if(_0x447e4b&&_0x447e4b[_0x4653('0x91')]){var _0x48d051=_0x447e4b['fileText'];var _0x49e1a0=config[_0x4653('0x92')]+'/server/files/transcribes/transcribe_'+_0x447e4b['id']+_0x4653('0x93');if(fs[_0x4653('0x51')](_0x49e1a0)){return _0x49e1a0;}return writeFile(_0x48d051,_0x49e1a0)[_0x4653('0x29')](function(){return _0x49e1a0;});}else{throw new db[(_0x4653('0x56'))][(_0x4653('0x57'))](_0x4653('0x94'));}})[_0x4653('0x29')](function(_0x53bccd){return _0x1dd023[_0x4653('0x4d')](_0x53bccd);})[_0x4653('0x46')](handleError(_0x1dd023));}; \ No newline at end of file +var _0x9cc8=['undefined','limit','count','set','Content-Range','apply','update','destroy','sendStatus','error','stack','name','send','index','type','key','differenceBy','map','format','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','VoiceRecording','then','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','Sequelize','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','token','push','$and','%s.cypher','ValidationError','VoiceRecording\x20not\x20found','extname','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9cc8,0x113));var _0x89cc=function(_0x21c5f3,_0xe5977){_0x21c5f3=_0x21c5f3-0x0;var _0x1b4e99=_0x9cc8[_0x21c5f3];return _0x1b4e99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89cc('0x0'));var zipdir=require(_0x89cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89cc('0x2'));var moment=require('moment');var BPromise=require(_0x89cc('0x3'));var Mustache=require('mustache');var util=require(_0x89cc('0x4'));var path=require('path');var sox=require(_0x89cc('0x5'));var csv=require(_0x89cc('0x6'));var ejs=require(_0x89cc('0x7'));var fs=require('fs');var fs_extra=require(_0x89cc('0x8'));var _=require(_0x89cc('0x9'));var squel=require(_0x89cc('0xa'));var crypto=require(_0x89cc('0xb'));var jsforce=require(_0x89cc('0xc'));var deskjs=require(_0x89cc('0xd'));var toCsv=require(_0x89cc('0x6'));var querystring=require(_0x89cc('0xe'));var Papa=require(_0x89cc('0xf'));var AWS=require(_0x89cc('0x10'));var uuidv4=require(_0x89cc('0x11'));var Redis=require(_0x89cc('0x12'));var authService=require(_0x89cc('0x13'));var qs=require(_0x89cc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89cc('0x15'));var logger=require(_0x89cc('0x16'))(_0x89cc('0x17'));var utils=require(_0x89cc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x89cc('0x19'));var db=require(_0x89cc('0x1a'))['db'];function respondWithStatusCode(_0x2d22df,_0x36ad15){_0x36ad15=_0x36ad15||0xcc;return function(_0x3d3793){if(_0x3d3793){return _0x2d22df['sendStatus'](_0x36ad15);}return _0x2d22df[_0x89cc('0x1b')](_0x36ad15)[_0x89cc('0x1c')]();};}function respondWithResult(_0x436ef5,_0x152ecc){_0x152ecc=_0x152ecc||0xc8;return function(_0x9f5da4){if(_0x9f5da4){return _0x436ef5[_0x89cc('0x1b')](_0x152ecc)[_0x89cc('0x1d')](_0x9f5da4);}};}function respondWithFilteredResult(_0xf1ab38,_0x49af41){return function(_0x1cff2c){if(_0x1cff2c){var _0x466a62=typeof _0x49af41[_0x89cc('0x1e')]===_0x89cc('0x1f')&&typeof _0x49af41[_0x89cc('0x20')]===_0x89cc('0x1f');var _0x1009d8=_0x1cff2c[_0x89cc('0x21')];var _0x3be0a1=_0x466a62?0x0:_0x49af41[_0x89cc('0x1e')];var _0x4f37e1=_0x466a62?_0x1cff2c[_0x89cc('0x21')]:_0x49af41['offset']+_0x49af41[_0x89cc('0x20')];var _0x4193c8;if(_0x4f37e1>=_0x1009d8){_0x4f37e1=_0x1009d8;_0x4193c8=0xc8;}else{_0x4193c8=0xce;}_0xf1ab38['status'](_0x4193c8);return _0xf1ab38[_0x89cc('0x22')](_0x89cc('0x23'),_0x3be0a1+'-'+_0x4f37e1+'/'+_0x1009d8)['json'](_0x1cff2c);}return null;};}function patchUpdates(_0x5c994a){return function(_0x556cac){try{jsonpatch[_0x89cc('0x24')](_0x556cac,_0x5c994a,!![]);}catch(_0x2cc220){return BPromise['reject'](_0x2cc220);}return _0x556cac['save']();};}function saveUpdates(_0x428cd,_0x1856d1){return function(_0x36e108){if(_0x36e108){return _0x36e108[_0x89cc('0x25')](_0x428cd)['then'](function(_0x12a5e7){return _0x12a5e7;});}return null;};}function removeEntity(_0x12582d,_0x2babab){return function(_0x323343){if(_0x323343){return _0x323343[_0x89cc('0x26')]()['then'](function(){_0x12582d[_0x89cc('0x1b')](0xcc)[_0x89cc('0x1c')]();});}};}function handleEntityNotFound(_0x48197,_0x272041){return function(_0xb79472){if(!_0xb79472){_0x48197[_0x89cc('0x27')](0x194);}return _0xb79472;};}function handleError(_0x4e76fe,_0x16bb0d){_0x16bb0d=_0x16bb0d||0x1f4;return function(_0x4f138d){logger[_0x89cc('0x28')](_0x4f138d[_0x89cc('0x29')]);if(_0x4f138d[_0x89cc('0x2a')]){delete _0x4f138d[_0x89cc('0x2a')];}_0x4e76fe[_0x89cc('0x1b')](_0x16bb0d)[_0x89cc('0x2b')](_0x4f138d);};}exports[_0x89cc('0x2c')]=function(_0xbb8253,_0x2dcd42){var _0x5af1c4={},_0x5d2dfb={},_0x3a29c5={'count':0x0,'rows':[]};var _0x108276=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x2fd42e){return{'name':_0x2fd42e['fieldName'],'type':_0x2fd42e[_0x89cc('0x2d')][_0x89cc('0x2e')]};});_0x5d2dfb['model']=_[_0x89cc('0x2f')](_[_0x89cc('0x30')](_0x108276,_0x89cc('0x2a')),[_0x89cc('0x31')]);_0x5d2dfb[_0x89cc('0x32')]=_[_0x89cc('0x33')](_0xbb8253['query']);_0x5d2dfb['filters']=_[_0x89cc('0x34')](_0x5d2dfb['model'],_0x5d2dfb[_0x89cc('0x32')]);_0x5af1c4['attributes']=_[_0x89cc('0x34')](_0x5d2dfb['model'],qs['fields'](_0xbb8253[_0x89cc('0x32')][_0x89cc('0x35')]));_0x5af1c4[_0x89cc('0x36')]=_0x5af1c4[_0x89cc('0x36')]['length']?_0x5af1c4[_0x89cc('0x36')]:_0x5d2dfb[_0x89cc('0x37')];if(!_0xbb8253[_0x89cc('0x32')][_0x89cc('0x38')](_0x89cc('0x39'))){_0x5af1c4[_0x89cc('0x20')]=qs[_0x89cc('0x20')](_0xbb8253[_0x89cc('0x32')][_0x89cc('0x20')]);_0x5af1c4[_0x89cc('0x1e')]=qs[_0x89cc('0x1e')](_0xbb8253['query']['offset']);}_0x5af1c4[_0x89cc('0x3a')]=qs[_0x89cc('0x3b')](_0xbb8253[_0x89cc('0x32')][_0x89cc('0x3b')]);_0x5af1c4[_0x89cc('0x3c')]=qs[_0x89cc('0x3d')](_[_0x89cc('0x3e')](_0xbb8253['query'],_0x5d2dfb[_0x89cc('0x3d')]),_0x108276);if(_0xbb8253[_0x89cc('0x32')][_0x89cc('0x3f')]){_0x5af1c4['where']=_[_0x89cc('0x40')](_0x5af1c4[_0x89cc('0x3c')],{'$or':_[_0x89cc('0x30')](_0x108276,function(_0x459bb1){if(_0x459bb1[_0x89cc('0x2d')]!==_0x89cc('0x41')){var _0x1cab1e={};_0x1cab1e[_0x459bb1[_0x89cc('0x2a')]]={'$like':'%'+_0xbb8253[_0x89cc('0x32')][_0x89cc('0x3f')]+'%'};return _0x1cab1e;}})});}_0x5af1c4=_[_0x89cc('0x40')]({},_0x5af1c4,_0xbb8253['options']);var _0x33c7e2={'where':_0x5af1c4[_0x89cc('0x3c')]};return db[_0x89cc('0x42')]['count'](_0x33c7e2)[_0x89cc('0x43')](function(_0x1ebdc6){_0x3a29c5[_0x89cc('0x21')]=_0x1ebdc6;if(_0xbb8253[_0x89cc('0x32')][_0x89cc('0x44')]){_0x5af1c4[_0x89cc('0x45')]=[{'all':!![]}];}return db['VoiceRecording'][_0x89cc('0x46')](_0x5af1c4);})[_0x89cc('0x43')](function(_0x56a4b2){_0x3a29c5[_0x89cc('0x47')]=_0x56a4b2;return _0x3a29c5;})['then'](respondWithFilteredResult(_0x2dcd42,_0x5af1c4))[_0x89cc('0x48')](handleError(_0x2dcd42,null));};exports['show']=function(_0x190e80,_0x36817b){var _0x256c57={'raw':![],'where':{'id':_0x190e80['params']['id']}},_0x3ff9d4={};_0x3ff9d4[_0x89cc('0x37')]=_[_0x89cc('0x33')](db[_0x89cc('0x42')]['rawAttributes']);_0x3ff9d4['query']=_['keys'](_0x190e80[_0x89cc('0x32')]);_0x3ff9d4[_0x89cc('0x3d')]=_['intersection'](_0x3ff9d4[_0x89cc('0x37')],_0x3ff9d4['query']);_0x256c57['attributes']=_[_0x89cc('0x34')](_0x3ff9d4[_0x89cc('0x37')],qs['fields'](_0x190e80[_0x89cc('0x32')][_0x89cc('0x35')]));_0x256c57['attributes']=_0x256c57[_0x89cc('0x36')][_0x89cc('0x49')]?_0x256c57[_0x89cc('0x36')]:_0x3ff9d4[_0x89cc('0x37')];if(_0x190e80[_0x89cc('0x32')][_0x89cc('0x44')]){_0x256c57[_0x89cc('0x45')]=[{'all':!![]}];}_0x256c57=_[_0x89cc('0x40')]({},_0x256c57,_0x190e80['options']);return db[_0x89cc('0x42')][_0x89cc('0x4a')](_0x256c57)[_0x89cc('0x43')](handleEntityNotFound(_0x36817b,null))[_0x89cc('0x43')](respondWithResult(_0x36817b,null))[_0x89cc('0x48')](handleError(_0x36817b,null));};exports[_0x89cc('0x4b')]=function(_0x1f4842,_0x702261){return db[_0x89cc('0x42')][_0x89cc('0x4b')](_0x1f4842['body'],{})[_0x89cc('0x43')](respondWithResult(_0x702261,0xc9))['catch'](handleError(_0x702261,null));};exports['update']=function(_0x37f132,_0x12aceb){if(_0x37f132[_0x89cc('0x4c')]['id']){delete _0x37f132[_0x89cc('0x4c')]['id'];}return db['VoiceRecording'][_0x89cc('0x4a')]({'where':{'id':_0x37f132[_0x89cc('0x4d')]['id']}})[_0x89cc('0x43')](handleEntityNotFound(_0x12aceb,null))[_0x89cc('0x43')](saveUpdates(_0x37f132['body'],null))['then'](respondWithResult(_0x12aceb,null))[_0x89cc('0x48')](handleError(_0x12aceb,null));};exports[_0x89cc('0x4e')]=function(_0x588794,_0x55a804){return db[_0x89cc('0x42')][_0x89cc('0x4e')]()[_0x89cc('0x43')](respondWithResult(_0x55a804,null))[_0x89cc('0x48')](handleError(_0x55a804,null));};exports[_0x89cc('0x4f')]=function(_0x337348,_0x101957,_0x52dc1a){var _0x5c7819=require(_0x89cc('0x50'));var _0x517ef4=![];var _0x3bd12b={};if(_0x337348[_0x89cc('0x32')][_0x89cc('0x2d')]&&_0x337348[_0x89cc('0x32')]['type']===_0x89cc('0x51')){_0x3bd12b[_0x89cc('0x51')]=_0x337348[_0x89cc('0x4d')]['id'];}else{_0x3bd12b['id']=_0x337348['params']['id'];}return db[_0x89cc('0x42')][_0x89cc('0x4a')]({'where':_0x3bd12b,'attributes':['id',_0x89cc('0x52')],'raw':!![]})[_0x89cc('0x43')](handleEntityNotFound(_0x101957,null))['then'](function(_0x3dfc16){if(_0x3dfc16){var _0x56e675=_0x3dfc16[_0x89cc('0x52')];var _0x188f97=util[_0x89cc('0x31')]('%s.cypher',_0x56e675);if(fs['existsSync'](_0x188f97)){_0x517ef4=!![];return _0x5c7819[_0x89cc('0x53')](_0x188f97,_0x56e675,config[_0x89cc('0x54')][_0x89cc('0x55')])[_0x89cc('0x43')](function(){return _0x3dfc16;});}return _0x3dfc16;}})[_0x89cc('0x43')](function(_0x38ce95){if(_0x38ce95){var _0xdaa7bc=_0x38ce95['value'];if(!fs[_0x89cc('0x56')](_0xdaa7bc)){throw new db[(_0x89cc('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x38ce95[_0x89cc('0x58')]){return _0x101957[_0x89cc('0x4f')](_0xdaa7bc,_0x38ce95[_0x89cc('0x58')]+path['extname'](_0xdaa7bc),function(){if(_0x517ef4){fs[_0x89cc('0x59')](_0xdaa7bc);}});}else{return _0x101957[_0x89cc('0x4f')](_0xdaa7bc,function(_0x1b4162){if(_0x517ef4){fs[_0x89cc('0x59')](_0xdaa7bc);}});}}})[_0x89cc('0x48')](function(_0x1697c5){if(_0x1697c5[_0x89cc('0x5a')]==='VoiceRecording\x20not\x20found'){_0x101957[_0x89cc('0x1b')](0x194)[_0x89cc('0x2b')](_0x89cc('0x5b'));}else{return handleError(_0x101957,null);}});};exports[_0x89cc('0x5c')]=function(_0x27fa57,_0x3550f0,_0x34af1b){var _0x12a7dd=require(_0x89cc('0x50'));var _0x1bc376=![];var _0x432b76={'$and':[db[_0x89cc('0x5d')][_0x89cc('0x3c')](db[_0x89cc('0x5d')]['fn'](_0x89cc('0x5e'),db[_0x89cc('0x5d')]['col'](_0x89cc('0x51'))),_0x27fa57[_0x89cc('0x32')][_0x89cc('0x5f')])]};if(_0x27fa57[_0x89cc('0x32')][_0x89cc('0x2d')]&&_0x27fa57[_0x89cc('0x32')]['type']===_0x89cc('0x51')){_0x432b76['$and'][_0x89cc('0x60')]({'uniqueid':_0x27fa57[_0x89cc('0x4d')]['id']});}else{_0x432b76[_0x89cc('0x61')]['push']({'id':_0x27fa57[_0x89cc('0x4d')]['id']});}return db['VoiceRecording'][_0x89cc('0x4a')]({'where':_0x432b76,'attributes':['id','value'],'raw':!![]})[_0x89cc('0x43')](handleEntityNotFound(_0x3550f0,null))[_0x89cc('0x43')](function(_0x1c6ee9){if(_0x1c6ee9){var _0x41f7b2=util[_0x89cc('0x31')](_0x89cc('0x62'),_0x1c6ee9[_0x89cc('0x52')]);if(fs['existsSync'](_0x41f7b2)){_0x1bc376=!![];return _0x12a7dd[_0x89cc('0x53')](_0x41f7b2,_0x1c6ee9[_0x89cc('0x52')],config[_0x89cc('0x54')][_0x89cc('0x55')])[_0x89cc('0x43')](function(){return _0x1c6ee9;});}return _0x1c6ee9;}})['then'](function(_0x594c17){if(_0x594c17){if(!fs['existsSync'](_0x594c17['value'])){throw new db[(_0x89cc('0x57'))][(_0x89cc('0x63'))](_0x89cc('0x64'));}if(_0x594c17[_0x89cc('0x58')]){return _0x3550f0[_0x89cc('0x4f')](_0x594c17['value'],_0x594c17[_0x89cc('0x58')]+path[_0x89cc('0x65')](_0x594c17[_0x89cc('0x52')]),function(){if(_0x1bc376){fs[_0x89cc('0x59')](_0x594c17[_0x89cc('0x52')]);}});}else{return _0x3550f0[_0x89cc('0x4f')](_0x594c17['value'],function(_0x10a58e){if(_0x1bc376){fs[_0x89cc('0x59')](_0x594c17[_0x89cc('0x52')]);}});}}})['catch'](handleError(_0x3550f0,null));};exports[_0x89cc('0x26')]=function(_0x17e858,_0x5e11f8){return db[_0x89cc('0x42')][_0x89cc('0x4a')]({'where':{'id':_0x17e858['params']['id']}})['then'](function(_0x314228){if(_[_0x89cc('0x66')](_0x314228)){throw new ReferenceError('Entity\x20not\x20found');}return _0x314228;})[_0x89cc('0x43')](function(_0x374278){var _0x4c1061=_0x374278['value'];logger[_0x89cc('0x67')](_0x89cc('0x68'),_0x4c1061);if(!_['isNil'](_0x374278[_0x89cc('0x52')])&&fs['existsSync'](_0x4c1061)){logger['info'](_0x89cc('0x69')+_0x4c1061+_0x89cc('0x6a'));fs[_0x89cc('0x6b')](_0x4c1061);}_0x4c1061=_0x4c1061+_0x89cc('0x6c');if(!_[_0x89cc('0x66')](_0x374278[_0x89cc('0x52')])&&fs[_0x89cc('0x56')](_0x4c1061)){logger[_0x89cc('0x67')]('File:\x20\x22'+_0x4c1061+_0x89cc('0x6a'));fs[_0x89cc('0x6b')](_0x4c1061);}return _0x374278;})['then'](function(_0x3c665b){if(!_0x3c665b)throw new InternalError();return _0x3c665b['destroy']();})[_0x89cc('0x43')](function(){_0x5e11f8[_0x89cc('0x1b')](0xcc)[_0x89cc('0x1c')]();})[_0x89cc('0x48')](handleError(_0x5e11f8,null));};function getBucketslist(_0x34db73,_0x546d0c,_0x99789e){return new Promise(function(_0xdd03b3,_0x1c7794){var _0x1a1800=new AWS['S3']({'accessKeyId':_0x546d0c,'secretAccessKey':_0x34db73,'region':_0x99789e});_0x1a1800[_0x89cc('0x6d')]({},function(_0x18b190,_0x30686f){if(_0x18b190){return _0x1c7794(_0x18b190);}else{return _0xdd03b3(_0x30686f);}});});}function createBucket(_0x14d1e5,_0x1eef9d,_0x380a8a,_0x14e44f){return new Promise(function(_0xbd5d01,_0xc857e3){var _0x150dfe=new AWS['S3']({'accessKeyId':_0x1eef9d,'secretAccessKey':_0x14d1e5,'region':_0x380a8a});_0x150dfe[_0x89cc('0x6e')]({'Bucket':_0x14e44f},function(_0x29c6dd,_0x258f7c){if(_0x29c6dd){return _0xc857e3(_0x29c6dd);}else{return _0xbd5d01(_0x258f7c);}});});}function uploadFile(_0x411f1e,_0x316646,_0x278d26,_0x100b37,_0x54d631,_0x179a5f){return new Promise(function(_0x431642,_0xb28de3){var _0x35aa1b=new AWS['S3']({'accessKeyId':_0x316646,'secretAccessKey':_0x411f1e,'region':_0x278d26});_0x35aa1b[_0x89cc('0x6f')]({'Bucket':_0x100b37,'Key':_0x54d631,'Body':_0x179a5f},function(_0x3edba0,_0x5773b1){if(_0x3edba0){return _0xb28de3(_0x3edba0);}else{return _0x431642(_0x5773b1);}});});}function startTranscribe(_0x3f364c,_0x424ceb,_0x875252,_0x266367,_0x213389,_0x160a32){return new Promise(function(_0x50e6e4,_0x28c683){var _0x430a1d=new AWS['TranscribeService']({'accessKeyId':_0x424ceb,'secretAccessKey':_0x3f364c,'region':_0x875252});_0x430a1d[_0x89cc('0x70')]({'TranscriptionJobName':_0x266367,'LanguageCode':_0x213389,'Media':{'MediaFileUri':_0x160a32}},function(_0x340424,_0x229182){if(_0x340424){return _0x28c683(_0x340424);}else{return _0x50e6e4(_0x229182);}});});}function transcribe(_0x225aad,_0x1d3525,_0x4de0a0,_0x493362,_0x21ca1a,_0x5b488f,_0x53b75e){return new Promise(function(_0x46ac7f,_0x4f3854){var _0x3c3c8c={};logger[_0x89cc('0x67')](util[_0x89cc('0x31')](_0x89cc('0x71'),_0x225aad,_0x21ca1a));return uploadFile(_0x1d3525,_0x4de0a0,_0x493362,_0x21ca1a,path[_0x89cc('0x72')](_0x5b488f),fs[_0x89cc('0x73')](_0x5b488f))[_0x89cc('0x43')](function(_0x4f1dc3){logger['info'](util['format'](_0x89cc('0x74'),_0x225aad,_0x21ca1a,_0x4f1dc3['Location']));_0x3c3c8c[_0x89cc('0x75')]=_0x4f1dc3[_0x89cc('0x76')];_0x3c3c8c['location']=_0x4f1dc3[_0x89cc('0x77')];logger[_0x89cc('0x67')](util[_0x89cc('0x31')](_0x89cc('0x78'),_0x225aad));return startTranscribe(_0x1d3525,_0x4de0a0,_0x493362,uuidv4(),_0x53b75e,_0x4f1dc3[_0x89cc('0x77')]);})[_0x89cc('0x43')](function(_0x5cfc43){logger[_0x89cc('0x67')](util[_0x89cc('0x31')](_0x89cc('0x79'),_0x225aad,_0x5cfc43['TranscriptionJob'][_0x89cc('0x7a')]));_0x3c3c8c['transcribeName']=_0x5cfc43['TranscriptionJob'][_0x89cc('0x7a')];_0x3c3c8c[_0x89cc('0x7b')]=_0x5cfc43['TranscriptionJob'][_0x89cc('0x7c')];return _0x46ac7f(_0x3c3c8c);})[_0x89cc('0x48')](function(_0x45f018){return _0x4f3854(_0x45f018);});});}exports['runTranscribe']=function(_0xc0a960,_0x3301f1,_0x4d1abf){var _0x6e96e4;var _0x22b5d1;var _0x57b157;var _0x3923c9=require(_0x89cc('0x50'));return db[_0x89cc('0x42')][_0x89cc('0x7d')]({'where':{'id':_0xc0a960[_0x89cc('0x4d')]['id']}})[_0x89cc('0x43')](function(_0x288594){if(_0x288594){var _0x4bcb7b=util[_0x89cc('0x31')](_0x89cc('0x62'),_0x288594['value']);if(fs[_0x89cc('0x56')](_0x4bcb7b)){cypher=!![];return _0x3923c9['decryptFile'](_0x4bcb7b,_0x288594[_0x89cc('0x52')],config[_0x89cc('0x54')]['recording'])['then'](function(){return _0x288594;});}return _0x288594;}})[_0x89cc('0x43')](function(_0x44358e){if(!_0x44358e){throw new db['Sequelize'][(_0x89cc('0x63'))](_0x89cc('0x7e'));}_0x22b5d1=_0x44358e;return db[_0x89cc('0x7f')][_0x89cc('0x7d')]({'where':{'id':0x1}});})[_0x89cc('0x43')](handleEntityNotFound(_0x3301f1,null))[_0x89cc('0x43')](function(_0x2b0e3d){if(_0x2b0e3d){_0x6e96e4=_0x2b0e3d;if(!_0x6e96e4[_0x89cc('0x80')]||!_0x6e96e4[_0x89cc('0x81')]||!_0x6e96e4[_0x89cc('0x82')]||!_0x6e96e4['language']||!_0x6e96e4['bucket']){throw new db[(_0x89cc('0x57'))][(_0x89cc('0x63'))](_0x89cc('0x83'));}if(_0xc0a960[_0x89cc('0x4c')][_0x89cc('0x84')]&&(!_0x6e96e4[_0x89cc('0x85')]||!_0x6e96e4[_0x89cc('0x86')]||!_0x6e96e4[_0x89cc('0x87')]||!_0x6e96e4[_0x89cc('0x88')]||!_0x6e96e4[_0x89cc('0x75')])){throw new db[(_0x89cc('0x57'))][(_0x89cc('0x63'))](_0x89cc('0x89'));}return db['CloudProvider'][_0x89cc('0x7d')]({'where':{'id':_0x6e96e4[_0x89cc('0x81')]}});}})[_0x89cc('0x43')](function(_0x4412c5){if(!_0x4412c5){throw new db['Sequelize'][(_0x89cc('0x63'))](_0x89cc('0x8a'));}if(!_0x4412c5['data1']||!_0x4412c5[_0x89cc('0x8b')]){throw new db[(_0x89cc('0x57'))][(_0x89cc('0x63'))](_0x89cc('0x8c'));}_0x57b157=_0x4412c5;return getBucketslist(_0x57b157[_0x89cc('0x8d')],_0x57b157[_0x89cc('0x8b')],_0x6e96e4[_0x89cc('0x82')]);})[_0x89cc('0x43')](function(_0x2d54d4){if(_0x2d54d4&&_0x2d54d4[_0x89cc('0x8e')]){var _0x3dc0cc=_['find'](_0x2d54d4[_0x89cc('0x8e')],function(_0x5f0c59){return _0x5f0c59[_0x89cc('0x8f')]===_0x6e96e4['bucket'];});if(!_0x3dc0cc){logger[_0x89cc('0x67')](util[_0x89cc('0x31')](_0x89cc('0x90'),_0xc0a960[_0x89cc('0x4d')]['id'],_0x6e96e4[_0x89cc('0x75')]));return createBucket(_0x57b157[_0x89cc('0x8d')],_0x57b157[_0x89cc('0x8b')],_0x6e96e4[_0x89cc('0x82')],_0x6e96e4[_0x89cc('0x75')]);}logger['info'](util['format'](_0x89cc('0x91'),_0xc0a960[_0x89cc('0x4d')]['id'],_0x6e96e4['bucket']));return;}})[_0x89cc('0x43')](function(_0x12e678){if(_0x22b5d1[_0x89cc('0x7b')]===_0x89cc('0x92')){return transcribe(_0xc0a960[_0x89cc('0x4d')]['id'],_0x57b157[_0x89cc('0x8d')],_0x57b157[_0x89cc('0x8b')],_0x6e96e4[_0x89cc('0x82')],_0x6e96e4[_0x89cc('0x75')],_0x22b5d1[_0x89cc('0x52')],_0x6e96e4['language']);}else{logger[_0x89cc('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xc0a960[_0x89cc('0x4d')]['id']));return{'transcribeStatus':_0x89cc('0x93')};}})[_0x89cc('0x43')](function(_0x179768){if(_0x179768){_0x179768[_0x89cc('0x94')]=_0xc0a960['body']['runSentiment'];return _0x22b5d1['updateAttributes'](_0x179768);}})[_0x89cc('0x43')](respondWithResult(_0x3301f1,null))['catch'](handleError(_0x3301f1,null));};function writeFile(_0x5447bd,_0x1244ab){return new Promise(function(_0x33cf05,_0x3946ae){fs[_0x89cc('0x95')](_0x1244ab,_0x5447bd,function(_0x3d5d4b,_0x57b6ed){if(_0x3d5d4b){return _0x3946ae(_0x3d5d4b);}else{return _0x33cf05(_0x57b6ed);}});});}exports[_0x89cc('0x96')]=function(_0x2716d3,_0x30506f,_0x2b0b07){return db[_0x89cc('0x42')]['findOne']({'where':{'id':_0x2716d3['params']['id']}})[_0x89cc('0x43')](handleEntityNotFound(_0x30506f))['then'](function(_0x2e6be9){if(_0x2e6be9&&_0x2e6be9[_0x89cc('0x97')]){var _0x5f0727=_0x2e6be9[_0x89cc('0x97')];var _0x26936c=config['root']+'/server/files/transcribes/transcribe_'+_0x2e6be9['id']+'.txt';if(fs['existsSync'](_0x26936c)){return _0x26936c;}return writeFile(_0x5f0727,_0x26936c)[_0x89cc('0x43')](function(){return _0x26936c;});}else{throw new db[(_0x89cc('0x57'))][(_0x89cc('0x63'))](_0x89cc('0x98'));}})[_0x89cc('0x43')](function(_0x11fde0){return _0x30506f[_0x89cc('0x4f')](_0x11fde0);})[_0x89cc('0x48')](handleError(_0x30506f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 898b404..58efd45 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 _0x8fed=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x20260a,_0x5c0adc){var _0x45f463=function(_0x10a6db){while(--_0x10a6db){_0x20260a['push'](_0x20260a['shift']());}};_0x45f463(++_0x5c0adc);}(_0x8fed,0xf5));var _0xd8fe=function(_0x311f04,_0x372366){_0x311f04=_0x311f04-0x0;var _0x264b6e=_0x8fed[_0x311f04];return _0x264b6e;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x12d94e,_0x3cd4e3){return _0x12d94e[_0xd8fe('0x0')](_0xd8fe('0x1'),attributes,{'tableName':_0xd8fe('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd8fe('0x3')]},{'name':_0xd8fe('0x4'),'fields':[_0xd8fe('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5089=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x3eece6,_0x32d59e){var _0x216115=function(_0x2c3ac1){while(--_0x2c3ac1){_0x3eece6['push'](_0x3eece6['shift']());}};_0x216115(++_0x32d59e);}(_0x5089,0x1bb));var _0x9508=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x5089[_0x3653c7];return _0x58a021;};'use strict';var attributes=require(_0x9508('0x0'));module[_0x9508('0x1')]=function(_0x5eec86,_0x2d60c7){return _0x5eec86[_0x9508('0x2')](_0x9508('0x3'),attributes,{'tableName':_0x9508('0x4'),'paranoid':![],'indexes':[{'name':_0x9508('0x5'),'fields':['uniqueid']},{'name':_0x9508('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7701a02..e365247 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 _0xffd6=['catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','Setting','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x47efbc,_0x1fca00){var _0x5e1e11=function(_0x45bfa6){while(--_0x45bfa6){_0x47efbc['push'](_0x47efbc['shift']());}};_0x5e1e11(++_0x1fca00);}(_0xffd6,0x97));var _0x6ffd=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0xffd6[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['VoiceRecording'][_0x6ffd('0x17')](_0x889a4b[_0x6ffd('0x18')],{'raw':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x19')][_0x6ffd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x889a4b['options']?_0x889a4b['options'][_0x6ffd('0x1b')]||null:null,'attributes':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b['options'][_0x6ffd('0x1c')]||null:null,'limit':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b[_0x6ffd('0x19')]['limit']||null:null})[_0x6ffd('0xa')](function(_0x2efeb5){logger['info'](_0x6ffd('0x16'),_0x889a4b);logger[_0x6ffd('0xd')]('UpdateVoiceRecording',_0x889a4b,JSON[_0x6ffd('0xf')](_0x2efeb5));_0x11a609(_0x2efeb5);})[_0x6ffd('0x15')](function(_0xb504e5){logger['error'](_0x6ffd('0x16'),_0xb504e5[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0xb504e5['message']));});});};exports[_0x6ffd('0x1d')]=function(_0x5a55e2){var _0x41ab4a=this;return new Promise(function(_0x43269c,_0x56c6de){var _0x520258=require(_0x6ffd('0x1e'));var _0x2a0391;return db[_0x6ffd('0x1f')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6ffd('0xa')](function(_0x48feb4){_0x2a0391=_0x48feb4;return db[_0x6ffd('0x20')][_0x6ffd('0x21')](_0x5a55e2['body']);})[_0x6ffd('0xa')](function(_0xc790b2){if(_0x2a0391[_0x6ffd('0x22')]&&fs[_0x6ffd('0x23')](_0xc790b2[_0x6ffd('0x24')])){var _0x31c609=util[_0x6ffd('0x25')](_0x6ffd('0x26'),_0xc790b2[_0x6ffd('0x24')]);return _0x520258[_0x6ffd('0x27')](_0xc790b2[_0x6ffd('0x24')],_0x31c609,config[_0x6ffd('0x28')][_0x6ffd('0x29')])['then'](function(){fs['unlink'](_0xc790b2['value']);logger[_0x6ffd('0x13')](_0x6ffd('0x2a'));return _0xc790b2;});}return _0xc790b2;})[_0x6ffd('0xa')](function(_0x528a3f){logger[_0x6ffd('0x13')](_0x6ffd('0x1d'),_0x5a55e2);logger[_0x6ffd('0xd')](_0x6ffd('0x1d'),_0x5a55e2,JSON[_0x6ffd('0xf')](_0x528a3f));_0x43269c(_0x528a3f);})[_0x6ffd('0x15')](function(_0x26394c){logger[_0x6ffd('0x10')](_0x6ffd('0x1d'),_0x26394c['message'],_0x5a55e2);_0x56c6de(_0x41ab4a[_0x6ffd('0x10')](0x1f4,_0x26394c[_0x6ffd('0x12')]));});});}; \ No newline at end of file +var _0x8e3f=['where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw'];(function(_0x925658,_0x35e35d){var _0x2b9837=function(_0x19b2f3){while(--_0x19b2f3){_0x925658['push'](_0x925658['shift']());}};_0x2b9837(++_0x35e35d);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['update'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1b')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc['options'][_0xf8e3('0x1c')]||null:null,'limit':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1d')]||null:null})['then'](function(_0x39df34){logger['info'](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1e')](_0x39df34));_0x2e27e3(_0x39df34);})[_0xf8e3('0x15')](function(_0x3ac384){logger['error'](_0xf8e3('0x16'),_0x3ac384[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0x3ac384[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x1f')]=function(_0x3b41a1){var _0x2963ed=this;return new Promise(function(_0x157a2d,_0x56fa8e){var _0x356e0a=require(_0xf8e3('0x20'));var _0x12ebd2;return db[_0xf8e3('0x21')][_0xf8e3('0x22')]({'attributes':['id',_0xf8e3('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf8e3('0xc')](function(_0xfaf15d){_0x12ebd2=_0xfaf15d;return db['VoiceRecording'][_0xf8e3('0x24')](_0x3b41a1[_0xf8e3('0x18')]);})[_0xf8e3('0xc')](function(_0x28b2f2){if(_0x12ebd2['callRecordingEncryption']&&fs[_0xf8e3('0x25')](_0x28b2f2[_0xf8e3('0x26')])){var _0x40f64d=util[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x28b2f2[_0xf8e3('0x26')]);return _0x356e0a[_0xf8e3('0x29')](_0x28b2f2[_0xf8e3('0x26')],_0x40f64d,config['secrets'][_0xf8e3('0x2a')])[_0xf8e3('0xc')](function(){fs['unlink'](_0x28b2f2['value']);logger['info'](_0xf8e3('0x2b'));return _0x28b2f2;});}return _0x28b2f2;})['then'](function(_0x2559ea){logger[_0xf8e3('0xd')](_0xf8e3('0x1f'),_0x3b41a1);logger[_0xf8e3('0x10')]('CreateVoiceRecording',_0x3b41a1,JSON['stringify'](_0x2559ea));_0x157a2d(_0x2559ea);})[_0xf8e3('0x15')](function(_0x2f87d8){logger[_0xf8e3('0x12')](_0xf8e3('0x1f'),_0x2f87d8[_0xf8e3('0x14')],_0x3b41a1);_0x56fa8e(_0x2963ed[_0xf8e3('0x12')](0x1f4,_0x2f87d8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0a53213..51faa2c 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 _0x6586=['index','/describe','describe','/:id','show','create','put','update','destroy','multer','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x6586,0x129));var _0x6658=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6586[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x6658('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6658('0x1'));var router=express[_0x6658('0x2')]();var fs_extra=require(_0x6658('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6658('0x4'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x6658('0x5')]('/',auth[_0x6658('0x6')](),controller[_0x6658('0x7')]);router['get'](_0x6658('0x8'),auth[_0x6658('0x6')](),controller[_0x6658('0x9')]);router['get'](_0x6658('0xa'),auth[_0x6658('0x6')](),controller[_0x6658('0xb')]);router['post']('/',auth[_0x6658('0x6')](),controller[_0x6658('0xc')]);router[_0x6658('0xd')](_0x6658('0xa'),auth[_0x6658('0x6')](),controller[_0x6658('0xe')]);router['delete'](_0x6658('0xa'),auth[_0x6658('0x6')](),controller[_0x6658('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0aef=['./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56a4d8,_0x145c37){var _0x67ab6=function(_0x38c3ad){while(--_0x38c3ad){_0x56a4d8['push'](_0x56a4d8['shift']());}};_0x67ab6(++_0x145c37);}(_0x0aef,0x198));var _0xf0ae=function(_0xc13521,_0x5cbbd6){_0xc13521=_0xc13521-0x0;var _0x604113=_0x0aef[_0xc13521];return _0x604113;};'use strict';var multer=require(_0xf0ae('0x0'));var util=require(_0xf0ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0ae('0x2'));var router=express['Router']();var fs_extra=require(_0xf0ae('0x3'));var auth=require(_0xf0ae('0x4'));var interaction=require(_0xf0ae('0x5'));var config=require('../../config/environment');var controller=require(_0xf0ae('0x6'));router[_0xf0ae('0x7')]('/',auth['isAuthenticated'](),controller[_0xf0ae('0x8')]);router['get'](_0xf0ae('0x9'),auth[_0xf0ae('0xa')](),controller[_0xf0ae('0xb')]);router[_0xf0ae('0x7')](_0xf0ae('0xc'),auth[_0xf0ae('0xa')](),controller['show']);router[_0xf0ae('0xd')]('/',auth[_0xf0ae('0xa')](),controller[_0xf0ae('0xe')]);router['put']('/:id',auth[_0xf0ae('0xa')](),controller['update']);router[_0xf0ae('0xf')](_0xf0ae('0xc'),auth['isAuthenticated'](),controller[_0xf0ae('0x10')]);module[_0xf0ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 713e636..c0c37f1 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 _0x41e4=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x1b1e12,_0x3605ff){var _0x1043f2=function(_0x1b84b6){while(--_0x1b84b6){_0x1b1e12['push'](_0x1b1e12['shift']());}};_0x1043f2(++_0x3605ff);}(_0x41e4,0xa6));var _0x441e=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x41e4[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x441e('0x0'));var moment=require(_0x441e('0x1'));module[_0x441e('0x2')]={'type':{'type':Sequelize[_0x441e('0x3')](_0x441e('0x4'),_0x441e('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x441e('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x441e('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x441e('0x6')]},'transfererexten':{'type':Sequelize[_0x441e('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x441e('0x6')]},'transfereechannel':{'type':Sequelize[_0x441e('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x441e('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x441e('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x441e('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x441e('0x6')]},'transfereecontext':{'type':Sequelize[_0x441e('0x6')]},'transfereeexten':{'type':Sequelize[_0x441e('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x441e('0x3')](_0x441e('0x7'),'No')},'context':{'type':Sequelize[_0x441e('0x6')]},'extension':{'type':Sequelize[_0x441e('0x6')]}}; \ No newline at end of file +var _0xa722=['ENUM','Yes','sequelize','moment','exports','blind','attended','STRING'];(function(_0x1ccdc9,_0x5cbab3){var _0x470dc8=function(_0x45e2ac){while(--_0x45e2ac){_0x1ccdc9['push'](_0x1ccdc9['shift']());}};_0x470dc8(++_0x5cbab3);}(_0xa722,0x1ca));var _0x2a72=function(_0x4b793b,_0x1ee112){_0x4b793b=_0x4b793b-0x0;var _0xcfbd6a=_0xa722[_0x4b793b];return _0xcfbd6a;};'use strict';var Sequelize=require(_0x2a72('0x0'));var moment=require(_0x2a72('0x1'));module[_0x2a72('0x2')]={'type':{'type':Sequelize['ENUM'](_0x2a72('0x3'),_0x2a72('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2a72('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2a72('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2a72('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x2a72('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x2a72('0x5')]},'transferercontext':{'type':Sequelize[_0x2a72('0x5')]},'transfererexten':{'type':Sequelize[_0x2a72('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x2a72('0x5')]},'transfereechannel':{'type':Sequelize[_0x2a72('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x2a72('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x2a72('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2a72('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2a72('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x2a72('0x5')]},'transfereeexten':{'type':Sequelize[_0x2a72('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2a72('0x5')]},'isexternal':{'type':Sequelize[_0x2a72('0x6')](_0x2a72('0x7'),'No')},'context':{'type':Sequelize[_0x2a72('0x5')]},'extension':{'type':Sequelize[_0x2a72('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 2e2cac2..484dc88 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 _0x6c75=['reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6c75,0xbd));var _0x56c7=function(_0xa82c60,_0x3f05bf){_0xa82c60=_0xa82c60-0x0;var _0x291fef=_0x6c75[_0xa82c60];return _0x291fef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x56c7('0x0'));var rp=require(_0x56c7('0x1'));var moment=require('moment');var BPromise=require(_0x56c7('0x2'));var Mustache=require(_0x56c7('0x3'));var util=require(_0x56c7('0x4'));var path=require(_0x56c7('0x5'));var sox=require('sox');var csv=require(_0x56c7('0x6'));var ejs=require(_0x56c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56c7('0x8'));var squel=require(_0x56c7('0x9'));var crypto=require(_0x56c7('0xa'));var jsforce=require(_0x56c7('0xb'));var deskjs=require(_0x56c7('0xc'));var toCsv=require(_0x56c7('0x6'));var querystring=require(_0x56c7('0xd'));var Papa=require('papaparse');var Redis=require(_0x56c7('0xe'));var authService=require(_0x56c7('0xf'));var qs=require(_0x56c7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56c7('0x11'));var logger=require(_0x56c7('0x12'))(_0x56c7('0x13'));var utils=require(_0x56c7('0x14'));var config=require(_0x56c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c7('0x16'))['db'];function respondWithStatusCode(_0x5245f5,_0xa653f8){_0xa653f8=_0xa653f8||0xcc;return function(_0x1dd514){if(_0x1dd514){return _0x5245f5[_0x56c7('0x17')](_0xa653f8);}return _0x5245f5[_0x56c7('0x18')](_0xa653f8)[_0x56c7('0x19')]();};}function respondWithResult(_0x2e7f3e,_0x87e7e5){_0x87e7e5=_0x87e7e5||0xc8;return function(_0x6b78e1){if(_0x6b78e1){return _0x2e7f3e[_0x56c7('0x18')](_0x87e7e5)['json'](_0x6b78e1);}};}function respondWithFilteredResult(_0x23f4cd,_0x290fca){return function(_0x5a4ce7){if(_0x5a4ce7){var _0x552831=typeof _0x290fca[_0x56c7('0x1a')]===_0x56c7('0x1b')&&typeof _0x290fca[_0x56c7('0x1c')]==='undefined';var _0x145642=_0x5a4ce7[_0x56c7('0x1d')];var _0x46b19e=_0x552831?0x0:_0x290fca[_0x56c7('0x1a')];var _0x254b57=_0x552831?_0x5a4ce7[_0x56c7('0x1d')]:_0x290fca[_0x56c7('0x1a')]+_0x290fca[_0x56c7('0x1c')];var _0x467c42;if(_0x254b57>=_0x145642){_0x254b57=_0x145642;_0x467c42=0xc8;}else{_0x467c42=0xce;}_0x23f4cd['status'](_0x467c42);return _0x23f4cd['set'](_0x56c7('0x1e'),_0x46b19e+'-'+_0x254b57+'/'+_0x145642)[_0x56c7('0x1f')](_0x5a4ce7);}return null;};}function patchUpdates(_0x2b19bd){return function(_0x2c43fc){try{jsonpatch[_0x56c7('0x20')](_0x2c43fc,_0x2b19bd,!![]);}catch(_0xe3ede1){return BPromise[_0x56c7('0x21')](_0xe3ede1);}return _0x2c43fc[_0x56c7('0x22')]();};}function saveUpdates(_0x58d779,_0x17ec14){return function(_0x39da1e){if(_0x39da1e){return _0x39da1e[_0x56c7('0x23')](_0x58d779)[_0x56c7('0x24')](function(_0x3c24c1){return _0x3c24c1;});}return null;};}function removeEntity(_0x1863e5,_0x1358ba){return function(_0x5b6106){if(_0x5b6106){return _0x5b6106[_0x56c7('0x25')]()[_0x56c7('0x24')](function(){_0x1863e5[_0x56c7('0x18')](0xcc)[_0x56c7('0x19')]();});}};}function handleEntityNotFound(_0x1abff3,_0x45f5c1){return function(_0x508ca0){if(!_0x508ca0){_0x1abff3[_0x56c7('0x17')](0x194);}return _0x508ca0;};}function handleError(_0x303722,_0x3c712a){_0x3c712a=_0x3c712a||0x1f4;return function(_0x3410ca){logger[_0x56c7('0x26')](_0x3410ca[_0x56c7('0x27')]);if(_0x3410ca[_0x56c7('0x28')]){delete _0x3410ca[_0x56c7('0x28')];}_0x303722['status'](_0x3c712a)[_0x56c7('0x29')](_0x3410ca);};}exports[_0x56c7('0x2a')]=function(_0x3faf9e,_0x41233d){var _0x5872c6={},_0x2d83b5={},_0x437ab2={'count':0x0,'rows':[]};var _0x5394ad=_[_0x56c7('0x2b')](db[_0x56c7('0x2c')]['rawAttributes'],function(_0x7cfc29){return{'name':_0x7cfc29[_0x56c7('0x2d')],'type':_0x7cfc29[_0x56c7('0x2e')][_0x56c7('0x2f')]};});_0x2d83b5[_0x56c7('0x30')]=_['map'](_0x5394ad,'name');_0x2d83b5[_0x56c7('0x31')]=_[_0x56c7('0x32')](_0x3faf9e[_0x56c7('0x31')]);_0x2d83b5[_0x56c7('0x33')]=_[_0x56c7('0x34')](_0x2d83b5[_0x56c7('0x30')],_0x2d83b5[_0x56c7('0x31')]);_0x5872c6[_0x56c7('0x35')]=_['intersection'](_0x2d83b5['model'],qs['fields'](_0x3faf9e[_0x56c7('0x31')]['fields']));_0x5872c6[_0x56c7('0x35')]=_0x5872c6[_0x56c7('0x35')][_0x56c7('0x36')]?_0x5872c6[_0x56c7('0x35')]:_0x2d83b5[_0x56c7('0x30')];if(!_0x3faf9e[_0x56c7('0x31')]['hasOwnProperty']('nolimit')){_0x5872c6[_0x56c7('0x1c')]=qs[_0x56c7('0x1c')](_0x3faf9e['query'][_0x56c7('0x1c')]);_0x5872c6[_0x56c7('0x1a')]=qs['offset'](_0x3faf9e[_0x56c7('0x31')][_0x56c7('0x1a')]);}_0x5872c6[_0x56c7('0x37')]=qs['sort'](_0x3faf9e[_0x56c7('0x31')][_0x56c7('0x38')]);_0x5872c6[_0x56c7('0x39')]=qs['filters'](_[_0x56c7('0x3a')](_0x3faf9e['query'],_0x2d83b5['filters']),_0x5394ad);if(_0x3faf9e[_0x56c7('0x31')][_0x56c7('0x3b')]){_0x5872c6[_0x56c7('0x39')]=_[_0x56c7('0x3c')](_0x5872c6['where'],{'$or':_[_0x56c7('0x2b')](_0x5394ad,function(_0x2232e7){if(_0x2232e7[_0x56c7('0x2e')]!==_0x56c7('0x3d')){var _0x4c4054={};_0x4c4054[_0x2232e7[_0x56c7('0x28')]]={'$like':'%'+_0x3faf9e[_0x56c7('0x31')]['filter']+'%'};return _0x4c4054;}})});}_0x5872c6=_['merge']({},_0x5872c6,_0x3faf9e['options']);var _0x6cf8={'where':_0x5872c6[_0x56c7('0x39')]};return db[_0x56c7('0x2c')][_0x56c7('0x1d')](_0x6cf8)[_0x56c7('0x24')](function(_0x1a71c4){_0x437ab2['count']=_0x1a71c4;if(_0x3faf9e[_0x56c7('0x31')][_0x56c7('0x3e')]){_0x5872c6[_0x56c7('0x3f')]=[{'all':!![]}];}return db[_0x56c7('0x2c')][_0x56c7('0x40')](_0x5872c6);})[_0x56c7('0x24')](function(_0x41104b){_0x437ab2[_0x56c7('0x41')]=_0x41104b;return _0x437ab2;})[_0x56c7('0x24')](respondWithFilteredResult(_0x41233d,_0x5872c6))[_0x56c7('0x42')](handleError(_0x41233d,null));};exports['show']=function(_0x3b7cc8,_0xaeb545){var _0xd9d529={'raw':!![],'where':{'id':_0x3b7cc8[_0x56c7('0x43')]['id']}},_0x5e4194={};_0x5e4194[_0x56c7('0x30')]=_[_0x56c7('0x32')](db['VoiceTransferReport']['rawAttributes']);_0x5e4194['query']=_['keys'](_0x3b7cc8[_0x56c7('0x31')]);_0x5e4194[_0x56c7('0x33')]=_['intersection'](_0x5e4194['model'],_0x5e4194[_0x56c7('0x31')]);_0xd9d529[_0x56c7('0x35')]=_[_0x56c7('0x34')](_0x5e4194[_0x56c7('0x30')],qs[_0x56c7('0x44')](_0x3b7cc8[_0x56c7('0x31')][_0x56c7('0x44')]));_0xd9d529['attributes']=_0xd9d529[_0x56c7('0x35')][_0x56c7('0x36')]?_0xd9d529[_0x56c7('0x35')]:_0x5e4194[_0x56c7('0x30')];if(_0x3b7cc8[_0x56c7('0x31')]['includeAll']){_0xd9d529['include']=[{'all':!![]}];}_0xd9d529=_[_0x56c7('0x3c')]({},_0xd9d529,_0x3b7cc8[_0x56c7('0x45')]);return db[_0x56c7('0x2c')][_0x56c7('0x46')](_0xd9d529)[_0x56c7('0x24')](handleEntityNotFound(_0xaeb545,null))['then'](respondWithResult(_0xaeb545,null))[_0x56c7('0x42')](handleError(_0xaeb545,null));};exports[_0x56c7('0x47')]=function(_0x3f39b6,_0x25b7f6){return db['VoiceTransferReport'][_0x56c7('0x47')](_0x3f39b6[_0x56c7('0x48')],{})['then'](respondWithResult(_0x25b7f6,0xc9))[_0x56c7('0x42')](handleError(_0x25b7f6,null));};exports[_0x56c7('0x23')]=function(_0x3f098f,_0x232d32){if(_0x3f098f[_0x56c7('0x48')]['id']){delete _0x3f098f[_0x56c7('0x48')]['id'];}return db[_0x56c7('0x2c')][_0x56c7('0x46')]({'where':{'id':_0x3f098f['params']['id']}})[_0x56c7('0x24')](handleEntityNotFound(_0x232d32,null))[_0x56c7('0x24')](saveUpdates(_0x3f098f[_0x56c7('0x48')],null))[_0x56c7('0x24')](respondWithResult(_0x232d32,null))[_0x56c7('0x42')](handleError(_0x232d32,null));};exports[_0x56c7('0x25')]=function(_0x47064d,_0x9c050b){return db['VoiceTransferReport'][_0x56c7('0x46')]({'where':{'id':_0x47064d[_0x56c7('0x43')]['id']}})[_0x56c7('0x24')](handleEntityNotFound(_0x9c050b,null))[_0x56c7('0x24')](removeEntity(_0x9c050b,null))[_0x56c7('0x42')](handleError(_0x9c050b,null));};exports[_0x56c7('0x49')]=function(_0x4cd81c,_0x123a91){return db[_0x56c7('0x2c')]['describe']()['then'](respondWithResult(_0x123a91,null))[_0x56c7('0x42')](handleError(_0x123a91,null));}; \ No newline at end of file +var _0x8775=['includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','merge','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x5ada87,_0x596cfd){var _0x424d8e=function(_0x5458aa){while(--_0x5458aa){_0x5ada87['push'](_0x5ada87['shift']());}};_0x424d8e(++_0x596cfd);}(_0x8775,0x1e3));var _0x5877=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x8775[_0x264b9b];return _0x4c7a0e;};'use strict';var emlformat=require(_0x5877('0x0'));var rimraf=require(_0x5877('0x1'));var zipdir=require(_0x5877('0x2'));var jsonpatch=require(_0x5877('0x3'));var rp=require('request-promise');var moment=require(_0x5877('0x4'));var BPromise=require(_0x5877('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5877('0x6'));var sox=require('sox');var csv=require(_0x5877('0x7'));var ejs=require(_0x5877('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5877('0x9'));var squel=require(_0x5877('0xa'));var crypto=require(_0x5877('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5877('0xc'));var toCsv=require(_0x5877('0x7'));var querystring=require(_0x5877('0xd'));var Papa=require(_0x5877('0xe'));var Redis=require(_0x5877('0xf'));var authService=require(_0x5877('0x10'));var qs=require(_0x5877('0x11'));var as=require(_0x5877('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5877('0x13'))(_0x5877('0x14'));var utils=require(_0x5877('0x15'));var config=require(_0x5877('0x16'));var licenseUtil=require(_0x5877('0x17'));var db=require(_0x5877('0x18'))['db'];function respondWithStatusCode(_0x45ae9e,_0x4a7ae4){_0x4a7ae4=_0x4a7ae4||0xcc;return function(_0x3bbec6){if(_0x3bbec6){return _0x45ae9e[_0x5877('0x19')](_0x4a7ae4);}return _0x45ae9e[_0x5877('0x1a')](_0x4a7ae4)['end']();};}function respondWithResult(_0x234e79,_0xd31a83){_0xd31a83=_0xd31a83||0xc8;return function(_0x4accb2){if(_0x4accb2){return _0x234e79[_0x5877('0x1a')](_0xd31a83)[_0x5877('0x1b')](_0x4accb2);}};}function respondWithFilteredResult(_0x4e3c78,_0x424708){return function(_0xfd7afa){if(_0xfd7afa){var _0x380aff=typeof _0x424708[_0x5877('0x1c')]==='undefined'&&typeof _0x424708[_0x5877('0x1d')]===_0x5877('0x1e');var _0x307194=_0xfd7afa[_0x5877('0x1f')];var _0x53090f=_0x380aff?0x0:_0x424708[_0x5877('0x1c')];var _0x827556=_0x380aff?_0xfd7afa[_0x5877('0x1f')]:_0x424708['offset']+_0x424708[_0x5877('0x1d')];var _0x1af879;if(_0x827556>=_0x307194){_0x827556=_0x307194;_0x1af879=0xc8;}else{_0x1af879=0xce;}_0x4e3c78['status'](_0x1af879);return _0x4e3c78['set'](_0x5877('0x20'),_0x53090f+'-'+_0x827556+'/'+_0x307194)['json'](_0xfd7afa);}return null;};}function patchUpdates(_0x1c4b4f){return function(_0x2fb77e){try{jsonpatch[_0x5877('0x21')](_0x2fb77e,_0x1c4b4f,!![]);}catch(_0x226d85){return BPromise[_0x5877('0x22')](_0x226d85);}return _0x2fb77e[_0x5877('0x23')]();};}function saveUpdates(_0x239b6c,_0x24ea70){return function(_0x28a2d5){if(_0x28a2d5){return _0x28a2d5[_0x5877('0x24')](_0x239b6c)[_0x5877('0x25')](function(_0x1ef04a){return _0x1ef04a;});}return null;};}function removeEntity(_0x3ec9b0,_0x3dded6){return function(_0x178c75){if(_0x178c75){return _0x178c75['destroy']()[_0x5877('0x25')](function(){_0x3ec9b0[_0x5877('0x1a')](0xcc)[_0x5877('0x26')]();});}};}function handleEntityNotFound(_0xb4cac3,_0x199039){return function(_0x1f03fc){if(!_0x1f03fc){_0xb4cac3['sendStatus'](0x194);}return _0x1f03fc;};}function handleError(_0x5020cc,_0x315c97){_0x315c97=_0x315c97||0x1f4;return function(_0x5d646a){logger[_0x5877('0x27')](_0x5d646a[_0x5877('0x28')]);if(_0x5d646a[_0x5877('0x29')]){delete _0x5d646a['name'];}_0x5020cc[_0x5877('0x1a')](_0x315c97)[_0x5877('0x2a')](_0x5d646a);};}exports[_0x5877('0x2b')]=function(_0x459185,_0x78928b){var _0x158f1a={},_0x4648ae={},_0x53668f={'count':0x0,'rows':[]};var _0x2569e1=_[_0x5877('0x2c')](db[_0x5877('0x2d')]['rawAttributes'],function(_0x40a739){return{'name':_0x40a739[_0x5877('0x2e')],'type':_0x40a739[_0x5877('0x2f')][_0x5877('0x30')]};});_0x4648ae[_0x5877('0x31')]=_['map'](_0x2569e1,'name');_0x4648ae[_0x5877('0x32')]=_[_0x5877('0x33')](_0x459185[_0x5877('0x32')]);_0x4648ae[_0x5877('0x34')]=_[_0x5877('0x35')](_0x4648ae[_0x5877('0x31')],_0x4648ae[_0x5877('0x32')]);_0x158f1a[_0x5877('0x36')]=_[_0x5877('0x35')](_0x4648ae['model'],qs[_0x5877('0x37')](_0x459185[_0x5877('0x32')][_0x5877('0x37')]));_0x158f1a[_0x5877('0x36')]=_0x158f1a['attributes']['length']?_0x158f1a[_0x5877('0x36')]:_0x4648ae[_0x5877('0x31')];if(!_0x459185['query'][_0x5877('0x38')](_0x5877('0x39'))){_0x158f1a[_0x5877('0x1d')]=qs['limit'](_0x459185['query'][_0x5877('0x1d')]);_0x158f1a[_0x5877('0x1c')]=qs[_0x5877('0x1c')](_0x459185[_0x5877('0x32')]['offset']);}_0x158f1a[_0x5877('0x3a')]=qs[_0x5877('0x3b')](_0x459185[_0x5877('0x32')]['sort']);_0x158f1a[_0x5877('0x3c')]=qs[_0x5877('0x34')](_['pick'](_0x459185['query'],_0x4648ae[_0x5877('0x34')]),_0x2569e1);if(_0x459185[_0x5877('0x32')][_0x5877('0x3d')]){_0x158f1a[_0x5877('0x3c')]=_['merge'](_0x158f1a['where'],{'$or':_[_0x5877('0x2c')](_0x2569e1,function(_0xe28b13){if(_0xe28b13[_0x5877('0x2f')]!==_0x5877('0x3e')){var _0xcf0f0d={};_0xcf0f0d[_0xe28b13['name']]={'$like':'%'+_0x459185[_0x5877('0x32')][_0x5877('0x3d')]+'%'};return _0xcf0f0d;}})});}_0x158f1a=_['merge']({},_0x158f1a,_0x459185['options']);var _0x4ca080={'where':_0x158f1a[_0x5877('0x3c')]};return db[_0x5877('0x2d')][_0x5877('0x1f')](_0x4ca080)[_0x5877('0x25')](function(_0x5021e1){_0x53668f['count']=_0x5021e1;if(_0x459185[_0x5877('0x32')][_0x5877('0x3f')]){_0x158f1a['include']=[{'all':!![]}];}return db[_0x5877('0x2d')][_0x5877('0x40')](_0x158f1a);})[_0x5877('0x25')](function(_0x445b2d){_0x53668f[_0x5877('0x41')]=_0x445b2d;return _0x53668f;})[_0x5877('0x25')](respondWithFilteredResult(_0x78928b,_0x158f1a))[_0x5877('0x42')](handleError(_0x78928b,null));};exports[_0x5877('0x43')]=function(_0x4eebde,_0x5c7426){var _0x42e4a8={'raw':!![],'where':{'id':_0x4eebde[_0x5877('0x44')]['id']}},_0x8845a9={};_0x8845a9['model']=_[_0x5877('0x33')](db[_0x5877('0x2d')][_0x5877('0x45')]);_0x8845a9['query']=_['keys'](_0x4eebde[_0x5877('0x32')]);_0x8845a9[_0x5877('0x34')]=_[_0x5877('0x35')](_0x8845a9[_0x5877('0x31')],_0x8845a9[_0x5877('0x32')]);_0x42e4a8['attributes']=_[_0x5877('0x35')](_0x8845a9[_0x5877('0x31')],qs[_0x5877('0x37')](_0x4eebde[_0x5877('0x32')]['fields']));_0x42e4a8[_0x5877('0x36')]=_0x42e4a8[_0x5877('0x36')][_0x5877('0x46')]?_0x42e4a8[_0x5877('0x36')]:_0x8845a9[_0x5877('0x31')];if(_0x4eebde[_0x5877('0x32')]['includeAll']){_0x42e4a8[_0x5877('0x47')]=[{'all':!![]}];}_0x42e4a8=_[_0x5877('0x48')]({},_0x42e4a8,_0x4eebde['options']);return db[_0x5877('0x2d')]['find'](_0x42e4a8)[_0x5877('0x25')](handleEntityNotFound(_0x5c7426,null))[_0x5877('0x25')](respondWithResult(_0x5c7426,null))[_0x5877('0x42')](handleError(_0x5c7426,null));};exports[_0x5877('0x49')]=function(_0x90841d,_0x4dfb47){return db[_0x5877('0x2d')]['create'](_0x90841d[_0x5877('0x4a')],{})[_0x5877('0x25')](respondWithResult(_0x4dfb47,0xc9))[_0x5877('0x42')](handleError(_0x4dfb47,null));};exports['update']=function(_0x4f7341,_0x29a605){if(_0x4f7341['body']['id']){delete _0x4f7341[_0x5877('0x4a')]['id'];}return db[_0x5877('0x2d')]['find']({'where':{'id':_0x4f7341[_0x5877('0x44')]['id']}})[_0x5877('0x25')](handleEntityNotFound(_0x29a605,null))[_0x5877('0x25')](saveUpdates(_0x4f7341[_0x5877('0x4a')],null))[_0x5877('0x25')](respondWithResult(_0x29a605,null))[_0x5877('0x42')](handleError(_0x29a605,null));};exports[_0x5877('0x4b')]=function(_0x4ebb8,_0x95641b){return db['VoiceTransferReport'][_0x5877('0x4c')]({'where':{'id':_0x4ebb8[_0x5877('0x44')]['id']}})[_0x5877('0x25')](handleEntityNotFound(_0x95641b,null))[_0x5877('0x25')](removeEntity(_0x95641b,null))[_0x5877('0x42')](handleError(_0x95641b,null));};exports[_0x5877('0x4d')]=function(_0x278450,_0x5938a3){return db[_0x5877('0x2d')][_0x5877('0x4d')]()['then'](respondWithResult(_0x5938a3,null))[_0x5877('0x42')](handleError(_0x5938a3,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 73bd857..1f67ea5 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 _0x5990=['report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoiceTransferReport'];(function(_0x517b18,_0x495b58){var _0x400ed3=function(_0x3ce1be){while(--_0x3ce1be){_0x517b18['push'](_0x517b18['shift']());}};_0x400ed3(++_0x495b58);}(_0x5990,0xdd));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0599('0x0'));var util=require('util');var logger=require(_0x0599('0x1'))(_0x0599('0x2'));var moment=require(_0x0599('0x3'));var BPromise=require(_0x0599('0x4'));var rp=require(_0x0599('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0599('0x6'));var config=require(_0x0599('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x4606be,_0x2e76ab){return _0x4606be[_0x0599('0x8')](_0x0599('0x9'),attributes,{'tableName':_0x0599('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2b9=['moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api'];(function(_0x57745d,_0x1e6cca){var _0x4e0cb4=function(_0x2bc3b7){while(--_0x2bc3b7){_0x57745d['push'](_0x57745d['shift']());}};_0x4e0cb4(++_0x1e6cca);}(_0xf2b9,0x183));var _0x9f2b=function(_0x3ae024,_0x5bb823){_0x3ae024=_0x3ae024-0x0;var _0x1a3cfe=_0xf2b9[_0x3ae024];return _0x1a3cfe;};'use strict';var _=require('lodash');var util=require(_0x9f2b('0x0'));var logger=require(_0x9f2b('0x1'))(_0x9f2b('0x2'));var moment=require(_0x9f2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f2b('0x4'));var fs=require('fs');var path=require(_0x9f2b('0x5'));var rimraf=require(_0x9f2b('0x6'));var config=require(_0x9f2b('0x7'));var attributes=require(_0x9f2b('0x8'));module[_0x9f2b('0x9')]=function(_0x32b727,_0x309190){return _0x32b727[_0x9f2b('0xa')](_0x9f2b('0xb'),attributes,{'tableName':_0x9f2b('0xc'),'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 f25274a..d71e2f8 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 _0xd836=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','info','catch','body','options','then','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x1f2eaa,_0x2814ef){var _0x2c69e3=function(_0x2f4eef){while(--_0x2f4eef){_0x1f2eaa['push'](_0x1f2eaa['shift']());}};_0x2c69e3(++_0x2814ef);}(_0xd836,0xc3));var _0x6d83=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd836[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6d83('0x0'));var util=require(_0x6d83('0x1'));var moment=require(_0x6d83('0x2'));var BPromise=require(_0x6d83('0x3'));var rs=require(_0x6d83('0x4'));var fs=require('fs');var Redis=require(_0x6d83('0x5'));var db=require(_0x6d83('0x6'))['db'];var utils=require(_0x6d83('0x7'));var logger=require(_0x6d83('0x8'))('rpc');var config=require(_0x6d83('0x9'));var jayson=require(_0x6d83('0xa'));var client=jayson['client'][_0x6d83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a6df0,_0x149fa8,_0x18d918){return new BPromise(function(_0x4ab1e5,_0x13e6da){return client[_0x6d83('0xc')](_0x1a6df0,_0x18d918)['then'](function(_0x2f655f){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x149fa8,_0x6d83('0xd'));logger[_0x6d83('0xe')](_0x6d83('0xf'),_0x149fa8,_0x6d83('0xd'),JSON[_0x6d83('0x10')](_0x2f655f));if(_0x2f655f['error']){if(_0x2f655f[_0x6d83('0x11')]['code']===0x1f4){logger[_0x6d83('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x149fa8,_0x2f655f['error'][_0x6d83('0x12')]);return _0x13e6da(_0x2f655f[_0x6d83('0x11')][_0x6d83('0x12')]);}logger[_0x6d83('0x11')](_0x6d83('0x13'),_0x149fa8,_0x2f655f[_0x6d83('0x11')][_0x6d83('0x12')]);return _0x4ab1e5(_0x2f655f[_0x6d83('0x11')][_0x6d83('0x12')]);}else{logger[_0x6d83('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x149fa8,_0x6d83('0xd'));_0x4ab1e5(_0x2f655f['result']['message']);}})[_0x6d83('0x15')](function(_0x638a61){logger[_0x6d83('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x149fa8,_0x638a61);_0x13e6da(_0x638a61);});});}exports['CreateVoiceTransferReport']=function(_0x5cb739){var _0x3eb5b3=this;return new Promise(function(_0x5c2fe4,_0x88144e){return db['VoiceTransferReport']['create'](_0x5cb739[_0x6d83('0x16')],{'raw':_0x5cb739[_0x6d83('0x17')]?_0x5cb739[_0x6d83('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6d83('0x18')](function(_0x483420){logger[_0x6d83('0x14')](_0x6d83('0x19'),_0x5cb739);logger[_0x6d83('0xe')](_0x6d83('0x19'),_0x5cb739,JSON['stringify'](_0x483420));_0x5c2fe4(_0x483420);})[_0x6d83('0x15')](function(_0x5f17f8){logger['error']('CreateVoiceTransferReport',_0x5f17f8[_0x6d83('0x12')],_0x5cb739);_0x88144e(_0x3eb5b3[_0x6d83('0x11')](0x1f4,_0x5f17f8['message']));});});}; \ No newline at end of file +var _0x3ed0=['create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','VoiceTransferReport'];(function(_0x29deea,_0x2dc067){var _0x522bb1=function(_0x22aebe){while(--_0x22aebe){_0x29deea['push'](_0x29deea['shift']());}};_0x522bb1(++_0x2dc067);}(_0x3ed0,0x19a));var _0x03ed=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x3ed0[_0x420513];return _0x1b44ec;};'use strict';var _=require(_0x03ed('0x0'));var util=require(_0x03ed('0x1'));var moment=require(_0x03ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x03ed('0x3'));var fs=require('fs');var Redis=require(_0x03ed('0x4'));var db=require(_0x03ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03ed('0x6'))('rpc');var config=require(_0x03ed('0x7'));var jayson=require(_0x03ed('0x8'));var client=jayson[_0x03ed('0x9')][_0x03ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df499,_0x15dfda,_0x5e02bc){return new BPromise(function(_0x406f62,_0x19f2c5){return client['request'](_0x3df499,_0x5e02bc)[_0x03ed('0xb')](function(_0x39c88a){logger[_0x03ed('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x15dfda,_0x03ed('0xd'));logger[_0x03ed('0xe')](_0x03ed('0xf'),_0x15dfda,'request\x20sent',JSON[_0x03ed('0x10')](_0x39c88a));if(_0x39c88a[_0x03ed('0x11')]){if(_0x39c88a[_0x03ed('0x11')]['code']===0x1f4){logger['error'](_0x03ed('0x12'),_0x15dfda,_0x39c88a['error']['message']);return _0x19f2c5(_0x39c88a[_0x03ed('0x11')][_0x03ed('0x13')]);}logger[_0x03ed('0x11')](_0x03ed('0x12'),_0x15dfda,_0x39c88a[_0x03ed('0x11')][_0x03ed('0x13')]);return _0x406f62(_0x39c88a[_0x03ed('0x11')][_0x03ed('0x13')]);}else{logger[_0x03ed('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x15dfda,_0x03ed('0xd'));_0x406f62(_0x39c88a['result'][_0x03ed('0x13')]);}})[_0x03ed('0x14')](function(_0x39e1e8){logger[_0x03ed('0x11')](_0x03ed('0x12'),_0x15dfda,_0x39e1e8);_0x19f2c5(_0x39e1e8);});});}exports['CreateVoiceTransferReport']=function(_0x3851f8){var _0x4af3c2=this;return new Promise(function(_0x2de71a,_0x2e123b){return db[_0x03ed('0x15')][_0x03ed('0x16')](_0x3851f8[_0x03ed('0x17')],{'raw':_0x3851f8[_0x03ed('0x18')]?_0x3851f8[_0x03ed('0x18')][_0x03ed('0x19')]===undefined?!![]:![]:!![]})[_0x03ed('0xb')](function(_0x17ca2b){logger[_0x03ed('0xc')]('CreateVoiceTransferReport',_0x3851f8);logger['debug'](_0x03ed('0x1a'),_0x3851f8,JSON[_0x03ed('0x10')](_0x17ca2b));_0x2de71a(_0x17ca2b);})['catch'](function(_0x2f7777){logger[_0x03ed('0x11')]('CreateVoiceTransferReport',_0x2f7777[_0x03ed('0x13')],_0x3851f8);_0x2e123b(_0x4af3c2[_0x03ed('0x11')](0x1f4,_0x2f7777[_0x03ed('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d235cff..b6121a7 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 _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x750a,0x140));var _0xa750=function(_0x1b0ce2,_0x125c91){_0x1b0ce2=_0x1b0ce2-0x0;var _0x1056fa=_0x750a[_0x1b0ce2];return _0x1056fa;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file +var _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x48e58f,_0x50ff2b){var _0x2cc57e=function(_0x18924f){while(--_0x18924f){_0x48e58f['push'](_0x48e58f['shift']());}};_0x2cc57e(++_0x50ff2b);}(_0xaa88,0x137));var _0x8aa8=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xaa88[_0xd7b0a4];return _0x184e9e;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index af6af09..8dff56e 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 _0xfe57=['VoiceChannels','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','format','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls'];(function(_0x4de6e0,_0x4a093d){var _0x5f101e=function(_0x165325){while(--_0x165325){_0x4de6e0['push'](_0x4de6e0['shift']());}};_0x5f101e(++_0x4a093d);}(_0xfe57,0x195));var _0x7fe5=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xfe57[_0x175e89];return _0x2ed996;};'use strict';var path=require(_0x7fe5('0x0'));var fs=require('fs');var _=require(_0x7fe5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x7fe5('0x2'));var BPromise=require(_0x7fe5('0x3'));var jayson=require(_0x7fe5('0x4'));var amiClient=jayson[_0x7fe5('0x5')][_0x7fe5('0x6')]({'port':0x232a});var logger=require(_0x7fe5('0x7'))(_0x7fe5('0x8'));var Redis=require(_0x7fe5('0x9'));config[_0x7fe5('0xa')]=_[_0x7fe5('0xb')](config[_0x7fe5('0xa')],{'host':_0x7fe5('0xc'),'port':0x18eb});var io=require(_0x7fe5('0xd'))(new Redis(config['redis']));var Schema=require(_0x7fe5('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'callNumber':{'type':_0x7fe5('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x7fe5('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7fe5('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':_0x7fe5('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x7fe5('0x10'),'required':[!![],_0x7fe5('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x7fe5('0x11'),'required':[!![],_0x7fe5('0xf')]}});function emit(_0xbdf0a4,_0x4989a,_0x3f699b){logger[_0x7fe5('0x13')](_0xbdf0a4,_0x4989a,JSON['stringify'](_0x3f699b));io['to'](_0xbdf0a4)[_0x7fe5('0x14')](_0x4989a,_0x3f699b);}function handleError(_0x3c7dd3){return function(_0x340d5e){console[_0x7fe5('0x15')](_0x7fe5('0x16'),_0x340d5e,_0x340d5e instanceof RangeError);logger[_0x7fe5('0x17')](_0x340d5e[_0x7fe5('0x18')]);if(_0x340d5e instanceof RangeError){if(_0x340d5e[_0x7fe5('0x19')]){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x194)['send'](_0x340d5e);}else{if(_0x340d5e['name']){delete _0x340d5e[_0x7fe5('0x19')];}_0x3c7dd3[_0x7fe5('0x1a')](0x1f4)[_0x7fe5('0x1b')](_0x340d5e);}};}function checkError(){return function(_0x327301){if(!_0x327301){throw new RangeError(_0x7fe5('0x1c'));}return _0x327301;};}function respondWithRpcPromise(_0x39c3ba,_0x24efbb){return new BPromise(function(_0xdd9df7,_0x1b271c){var _0x28a7fd=amiClient;return _0x28a7fd[_0x7fe5('0x1d')](_0x39c3ba,_0x24efbb)[_0x7fe5('0x1e')](function(_0x54ee98){if(_0x54ee98[_0x7fe5('0x17')]){if(_0x54ee98[_0x7fe5('0x17')][_0x7fe5('0x1f')]===0x1f4){return _0x1b271c(_0x54ee98['error'][_0x7fe5('0x20')]);}return _0xdd9df7(_0x54ee98['error'][_0x7fe5('0x20')]);}else{_0xdd9df7(_0x54ee98['result']);}})[_0x7fe5('0x21')](function(_0x190355){_0x1b271c(_0x190355);});});}function getAgent(_0x134876){return db[_0x7fe5('0x22')][_0x7fe5('0x23')]({'where':{'id':_0x134876,'role':_0x7fe5('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x5f2d25,_0x417a56){return new BPromise(function(_0x450759,_0x27b66d){var _0x13c96b=respondWithRpcPromise('VoiceChannels');var _0x46f816=getAgent(_0x5f2d25);Promise['all']([_0x13c96b,_0x46f816])[_0x7fe5('0x1e')](function(_0x1420de){var _0x204bc8=_0x1420de[0x0];var _0x28a689=_0x1420de[0x1];var _0x1f8572=_[_0x7fe5('0x25')](_0x204bc8['rows'],function(_0xe521c6){return _0xe521c6[_0x7fe5('0x26')]==_0x28a689['id']&&_0xe521c6['sessionId']==_0x417a56;});if(_0x1f8572[_0x7fe5('0x27')]==0x1){_0x450759(_0x28a689);}else{_0x27b66d(new RangeError(_0x7fe5('0x28')+_0x417a56+_0x7fe5('0x29')));}});});}exports[_0x7fe5('0x2a')]=function(_0x465e46,_0x53ef16){logger['info'](_0x7fe5('0x2b'),_0x465e46[_0x7fe5('0x2c')]);var _0x3dbb62=originateValidation[_0x7fe5('0xe')](_0x465e46['body']);if(_0x3dbb62[_0x7fe5('0x27')]>0x0){return _0x53ef16[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x3dbb62);}var _0x4227b7=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4ecbba=_0x465e46[_0x7fe5('0x2c')][_0x7fe5('0x2f')];var _0x2c8225=_0x465e46[_0x7fe5('0x2c')]['callerId'];var _0x5617c2=_0x465e46[_0x7fe5('0x2c')]['callbackUrl'];return getAgent(_0x4227b7)[_0x7fe5('0x1e')](function(_0x513680){logger[_0x7fe5('0x13')]('entityFound:',_0x513680['name']);emit(util['format']('user:%s',_0x513680[_0x7fe5('0x19')]),_0x7fe5('0x30'),{'callNumber':_0x4ecbba,'callerId':_0x2c8225,'callbackUrl':_0x5617c2});return _0x53ef16['status'](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x31')});})['catch'](handleError(_0x53ef16));};exports[_0x7fe5('0x32')]=function(_0x4a641d,_0x4aeed2){logger[_0x7fe5('0x13')](_0x7fe5('0x33'),_0x4a641d[_0x7fe5('0x2c')]);var _0x2ff773=hangupValidation[_0x7fe5('0xe')](_0x4a641d['body']);if(_0x2ff773[_0x7fe5('0x27')]>0x0){return _0x4aeed2[_0x7fe5('0x1a')](0x190)['json'](_0x2ff773);}var _0x1fa05a=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0xf75042=_0x4a641d[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x1fa05a)[_0x7fe5('0x1e')](function(_0x50cfa5){logger['info'](_0x7fe5('0x35'),_0x50cfa5['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x50cfa5['name']),_0x7fe5('0x38'),{'sessionId':_0xf75042});return _0x4aeed2[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x39')});})[_0x7fe5('0x21')](handleError(_0x4aeed2));};exports[_0x7fe5('0x3a')]=function(_0x1cd6d3,_0x4ee6cc){logger['info'](_0x7fe5('0x3b'),_0x1cd6d3['body']);var _0xad0b05=answerValidation[_0x7fe5('0xe')](_0x1cd6d3[_0x7fe5('0x2c')]);if(_0xad0b05[_0x7fe5('0x27')]>0x0){return _0x4ee6cc['status'](0x190)[_0x7fe5('0x2d')](_0xad0b05);}var _0x5439bc=_0x1cd6d3['body'][_0x7fe5('0x2e')];var _0x585f27=_0x1cd6d3['body'][_0x7fe5('0x34')];return getAgent(_0x5439bc)[_0x7fe5('0x1e')](function(_0x46826f){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x46826f['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x46826f['name']),_0x7fe5('0x3c'),{'sessionId':_0x585f27});return _0x4ee6cc[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x3d')});})['catch'](handleError(_0x4ee6cc));};exports[_0x7fe5('0x3e')]=function(_0x13225e,_0x7355ac){logger['info'](_0x7fe5('0x3f'),_0x13225e[_0x7fe5('0x2c')]);var _0x3efc98=holdValidation['validate'](_0x13225e[_0x7fe5('0x2c')]);if(_0x3efc98[_0x7fe5('0x27')]>0x0){return _0x7355ac[_0x7fe5('0x1a')](0x190)['json'](_0x3efc98);}var _0x19c4a6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x4610b6=_0x13225e[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x19c4a6)[_0x7fe5('0x1e')](function(_0x447b57){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x447b57[_0x7fe5('0x19')]);emit(util['format']('user:%s',_0x447b57['name']),'webbar:hold',{'sessionId':_0x4610b6});return _0x7355ac[_0x7fe5('0x1a')](0xc8)['json']({'error':![],'message':_0x7fe5('0x40')});})[_0x7fe5('0x21')](handleError(_0x7355ac));};exports[_0x7fe5('0x41')]=function(_0x1d9ca8,_0x362f33){logger['info'](_0x7fe5('0x42'),_0x1d9ca8[_0x7fe5('0x2c')]);var _0x1bd234=unholdValidation[_0x7fe5('0xe')](_0x1d9ca8[_0x7fe5('0x2c')]);if(_0x1bd234[_0x7fe5('0x27')]>0x0){return _0x362f33[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x1bd234);}var _0x2df3b0=_0x1d9ca8[_0x7fe5('0x2c')]['userId'];var _0x1c16d4=_0x1d9ca8[_0x7fe5('0x2c')][_0x7fe5('0x34')];return getAgent(_0x2df3b0)[_0x7fe5('0x1e')](function(_0x18b041){logger[_0x7fe5('0x13')]('entityFound:',_0x18b041[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x18b041[_0x7fe5('0x19')]),_0x7fe5('0x43'),{'sessionId':_0x1c16d4});return _0x362f33[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x7fe5('0x21')](handleError(_0x362f33));};exports[_0x7fe5('0x44')]=function(_0x11d474,_0x637c0a){logger[_0x7fe5('0x13')]('calls\x20fired:',_0x637c0a[_0x7fe5('0x2c')]);var _0x34a430=callsValidation[_0x7fe5('0xe')](_0x11d474[_0x7fe5('0x2c')]);if(_0x34a430['length']>0x0){return _0x637c0a[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x34a430);}var _0x13b865=_0x11d474[_0x7fe5('0x2c')][_0x7fe5('0x2e')];var _0x25e583=respondWithRpcPromise(_0x7fe5('0x45'));var _0x26607a=getAgent(_0x13b865);return Promise[_0x7fe5('0x46')]([_0x25e583,_0x26607a])[_0x7fe5('0x1e')](function(_0xe5b5cf){var _0x59bd7c=_0xe5b5cf[0x0];var _0x44015c=_0xe5b5cf[0x1];var _0x1ce47c=_[_0x7fe5('0x25')](_0x59bd7c['rows'],function(_0x53e554){return _0x53e554[_0x7fe5('0x26')]==_0x44015c['id'];});return _0x637c0a['status'](0xc8)[_0x7fe5('0x2d')]({'count':_0x1ce47c[_0x7fe5('0x27')],'rows':_0x1ce47c});})['catch'](handleError(_0x637c0a));};exports[_0x7fe5('0x47')]=function(_0x47c811,_0x1fd083){logger[_0x7fe5('0x13')](_0x7fe5('0x48'),_0x47c811[_0x7fe5('0x2c')]);var _0x42d7b3=conferenceValidation[_0x7fe5('0xe')](_0x47c811['body']);if(_0x42d7b3['length']>0x0){return _0x1fd083[_0x7fe5('0x1a')](0x190)[_0x7fe5('0x2d')](_0x42d7b3);}var _0x42f66a=_0x47c811[_0x7fe5('0x2c')][_0x7fe5('0x2e')];return getAgent(_0x42f66a)['then'](function(_0x1eb46e){logger[_0x7fe5('0x13')](_0x7fe5('0x35'),_0x1eb46e[_0x7fe5('0x19')]);emit(util[_0x7fe5('0x36')]('user:%s',_0x1eb46e[_0x7fe5('0x19')]),_0x7fe5('0x49'));return _0x1fd083[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4a')});})[_0x7fe5('0x21')](handleError(_0x1fd083));};exports[_0x7fe5('0x4b')]=function(_0x512252,_0x343057){logger[_0x7fe5('0x13')](_0x7fe5('0x4c'),_0x512252[_0x7fe5('0x2c')]);var _0x87af50=transferValidation[_0x7fe5('0xe')](_0x512252[_0x7fe5('0x2c')]);if(_0x87af50['length']>0x0){return _0x343057['status'](0x190)[_0x7fe5('0x2d')](_0x87af50);}var _0x4c3ee6=_0x512252[_0x7fe5('0x2c')]['userId'];var _0x3bb81b=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x34')];var _0x31eb57=_0x512252[_0x7fe5('0x2c')][_0x7fe5('0x4d')];return getAgent(_0x4c3ee6)[_0x7fe5('0x1e')](function(_0x411c3c){logger['info'](_0x7fe5('0x35'),_0x411c3c['name']);emit(util[_0x7fe5('0x36')](_0x7fe5('0x37'),_0x411c3c[_0x7fe5('0x19')]),'webbar:transfer',{'sessionId':_0x3bb81b,'transferNumber':_0x31eb57});return _0x343057[_0x7fe5('0x1a')](0xc8)[_0x7fe5('0x2d')]({'error':![],'message':_0x7fe5('0x4e')});})[_0x7fe5('0x21')](handleError(_0x343057));}; \ No newline at end of file +var _0x0a9a=['hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','message','result','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','body','length','status','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','answer','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:'];(function(_0x2476f9,_0x53c193){var _0x5624c3=function(_0x200220){while(--_0x200220){_0x2476f9['push'](_0x2476f9['shift']());}};_0x5624c3(++_0x53c193);}(_0x0a9a,0x183));var _0xa0a9=function(_0xf4bf53,_0x1f7395){_0xf4bf53=_0xf4bf53-0x0;var _0x5e9604=_0x0a9a[_0xf4bf53];return _0x5e9604;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa0a9('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xa0a9('0x1'));var util=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var jayson=require(_0xa0a9('0x4'));var amiClient=jayson['client'][_0xa0a9('0x5')]({'port':0x232a});var logger=require(_0xa0a9('0x6'))('webbarapi');var Redis=require(_0xa0a9('0x7'));config[_0xa0a9('0x8')]=_[_0xa0a9('0x9')](config[_0xa0a9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa0a9('0xa'))(new Redis(config['redis']));var Schema=require(_0xa0a9('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'callNumber':{'type':_0xa0a9('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xa0a9('0xe')},'callbackUrl':{'type':_0xa0a9('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':[!![],_0xa0a9('0xf')]},'transferNumber':{'type':_0xa0a9('0xe'),'required':[!![],_0xa0a9('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x176faa,_0x48c315,_0x4a57dd){logger[_0xa0a9('0x11')](_0x176faa,_0x48c315,JSON[_0xa0a9('0x12')](_0x4a57dd));io['to'](_0x176faa)[_0xa0a9('0x13')](_0x48c315,_0x4a57dd);}function handleError(_0x16c3e3){return function(_0x568409){console[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x568409,_0x568409 instanceof RangeError);logger[_0xa0a9('0x16')](_0x568409[_0xa0a9('0x17')]);if(_0x568409 instanceof RangeError){if(_0x568409[_0xa0a9('0x18')]){delete _0x568409[_0xa0a9('0x18')];}_0x16c3e3['status'](0x194)[_0xa0a9('0x19')](_0x568409);}else{if(_0x568409[_0xa0a9('0x18')]){delete _0x568409['name'];}_0x16c3e3['status'](0x1f4)[_0xa0a9('0x19')](_0x568409);}};}function checkError(){return function(_0x1f6955){if(!_0x1f6955){throw new RangeError(_0xa0a9('0x1a'));}return _0x1f6955;};}function respondWithRpcPromise(_0x54a9a9,_0x307d7e){return new BPromise(function(_0x4e6f4c,_0x1fb36b){var _0x5e6148=amiClient;return _0x5e6148[_0xa0a9('0x1b')](_0x54a9a9,_0x307d7e)[_0xa0a9('0x1c')](function(_0x2f0b14){if(_0x2f0b14[_0xa0a9('0x16')]){if(_0x2f0b14['error'][_0xa0a9('0x1d')]===0x1f4){return _0x1fb36b(_0x2f0b14['error'][_0xa0a9('0x1e')]);}return _0x4e6f4c(_0x2f0b14[_0xa0a9('0x16')][_0xa0a9('0x1e')]);}else{_0x4e6f4c(_0x2f0b14[_0xa0a9('0x1f')]);}})['catch'](function(_0x7c1502){_0x1fb36b(_0x7c1502);});});}function getAgent(_0xe49d3b){return db[_0xa0a9('0x20')][_0xa0a9('0x21')]({'where':{'id':_0xe49d3b,'role':'agent'}})[_0xa0a9('0x1c')](checkError());}function getAgentCheckSession(_0x38e454,_0x2eae30){return new BPromise(function(_0x5c446e,_0x54125d){var _0x2b3cbb=respondWithRpcPromise(_0xa0a9('0x22'));var _0x10bbfd=getAgent(_0x38e454);Promise[_0xa0a9('0x23')]([_0x2b3cbb,_0x10bbfd])[_0xa0a9('0x1c')](function(_0xe218ff){var _0x2386c9=_0xe218ff[0x0];var _0x24e744=_0xe218ff[0x1];var _0xc6a4=_[_0xa0a9('0x24')](_0x2386c9[_0xa0a9('0x25')],function(_0x554191){return _0x554191[_0xa0a9('0x26')]==_0x24e744['id']&&_0x554191[_0xa0a9('0x27')]==_0x2eae30;});if(_0xc6a4['length']==0x1){_0x5c446e(_0x24e744);}else{_0x54125d(new RangeError(_0xa0a9('0x28')+_0x2eae30+_0xa0a9('0x29')));}});});}exports['originate']=function(_0x47c19b,_0x45374e){logger['info']('originate\x20fired:',_0x47c19b[_0xa0a9('0x2a')]);var _0x104936=originateValidation[_0xa0a9('0xb')](_0x47c19b[_0xa0a9('0x2a')]);if(_0x104936[_0xa0a9('0x2b')]>0x0){return _0x45374e[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x104936);}var _0x4bbcc2=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x539807=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2f')];var _0x2363e6=_0x47c19b['body']['callerId'];var _0x3b1a11=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x30')];return getAgent(_0x4bbcc2)[_0xa0a9('0x1c')](function(_0x520817){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x520817[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x520817[_0xa0a9('0x18')]),_0xa0a9('0x33'),{'callNumber':_0x539807,'callerId':_0x2363e6,'callbackUrl':_0x3b1a11});return _0x45374e['status'](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x34')});})[_0xa0a9('0x35')](handleError(_0x45374e));};exports[_0xa0a9('0x36')]=function(_0x2e11dc,_0x1d6bae){logger[_0xa0a9('0x11')](_0xa0a9('0x37'),_0x2e11dc[_0xa0a9('0x2a')]);var _0x2ea301=hangupValidation[_0xa0a9('0xb')](_0x2e11dc[_0xa0a9('0x2a')]);if(_0x2ea301[_0xa0a9('0x2b')]>0x0){return _0x1d6bae[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x2ea301);}var _0x1b1aff=_0x2e11dc[_0xa0a9('0x2a')]['userId'];var _0x3f1e4f=_0x2e11dc[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1b1aff)['then'](function(_0x757e10){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x757e10[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x757e10[_0xa0a9('0x18')]),_0xa0a9('0x38'),{'sessionId':_0x3f1e4f});return _0x1d6bae[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0xa0a9('0x35')](handleError(_0x1d6bae));};exports[_0xa0a9('0x39')]=function(_0x39c02a,_0x32d926){logger[_0xa0a9('0x11')]('answer\x20fired:',_0x39c02a[_0xa0a9('0x2a')]);var _0x11c130=answerValidation[_0xa0a9('0xb')](_0x39c02a[_0xa0a9('0x2a')]);if(_0x11c130[_0xa0a9('0x2b')]>0x0){return _0x32d926['status'](0x190)[_0xa0a9('0x2d')](_0x11c130);}var _0x1c8760=_0x39c02a['body']['userId'];var _0x41cd22=_0x39c02a[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1c8760)[_0xa0a9('0x1c')](function(_0x4a128f){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x4a128f[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x4a128f[_0xa0a9('0x18')]),_0xa0a9('0x3b'),{'sessionId':_0x41cd22});return _0x32d926[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3c')});})[_0xa0a9('0x35')](handleError(_0x32d926));};exports[_0xa0a9('0x3d')]=function(_0x2fcc76,_0x3bb0fb){logger[_0xa0a9('0x11')](_0xa0a9('0x3e'),_0x2fcc76[_0xa0a9('0x2a')]);var _0x54e917=holdValidation[_0xa0a9('0xb')](_0x2fcc76['body']);if(_0x54e917[_0xa0a9('0x2b')]>0x0){return _0x3bb0fb[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x54e917);}var _0x132eca=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x38cb0d=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x132eca)['then'](function(_0x5d4162){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5d4162['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5d4162[_0xa0a9('0x18')]),'webbar:hold',{'sessionId':_0x38cb0d});return _0x3bb0fb[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3f')});})[_0xa0a9('0x35')](handleError(_0x3bb0fb));};exports['unhold']=function(_0x398501,_0x45db88){logger[_0xa0a9('0x11')](_0xa0a9('0x40'),_0x398501[_0xa0a9('0x2a')]);var _0x41128b=unholdValidation[_0xa0a9('0xb')](_0x398501['body']);if(_0x41128b[_0xa0a9('0x2b')]>0x0){return _0x45db88[_0xa0a9('0x2c')](0x190)['json'](_0x41128b);}var _0x2cbd5e=_0x398501[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x506168=_0x398501['body'][_0xa0a9('0x27')];return getAgent(_0x2cbd5e)[_0xa0a9('0x1c')](function(_0x3f67ac){logger[_0xa0a9('0x11')]('entityFound:',_0x3f67ac['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x3f67ac['name']),'webbar:unhold',{'sessionId':_0x506168});return _0x45db88[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x41')});})[_0xa0a9('0x35')](handleError(_0x45db88));};exports[_0xa0a9('0x42')]=function(_0x361bf1,_0x24af09){logger[_0xa0a9('0x11')](_0xa0a9('0x43'),_0x24af09[_0xa0a9('0x2a')]);var _0x2da124=callsValidation['validate'](_0x361bf1[_0xa0a9('0x2a')]);if(_0x2da124[_0xa0a9('0x2b')]>0x0){return _0x24af09[_0xa0a9('0x2c')](0x190)['json'](_0x2da124);}var _0x426ddc=_0x361bf1[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x4a1912=respondWithRpcPromise(_0xa0a9('0x22'));var _0x18893f=getAgent(_0x426ddc);return Promise[_0xa0a9('0x23')]([_0x4a1912,_0x18893f])[_0xa0a9('0x1c')](function(_0x3d47b3){var _0x47107f=_0x3d47b3[0x0];var _0x12f97d=_0x3d47b3[0x1];var _0x577c1f=_[_0xa0a9('0x24')](_0x47107f[_0xa0a9('0x25')],function(_0x3f6ef4){return _0x3f6ef4[_0xa0a9('0x26')]==_0x12f97d['id'];});return _0x24af09[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'count':_0x577c1f[_0xa0a9('0x2b')],'rows':_0x577c1f});})['catch'](handleError(_0x24af09));};exports['conference']=function(_0x4a2307,_0x40d0f5){logger['info'](_0xa0a9('0x44'),_0x4a2307['body']);var _0x349f1b=conferenceValidation[_0xa0a9('0xb')](_0x4a2307[_0xa0a9('0x2a')]);if(_0x349f1b[_0xa0a9('0x2b')]>0x0){return _0x40d0f5[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x349f1b);}var _0x1c7191=_0x4a2307[_0xa0a9('0x2a')]['userId'];return getAgent(_0x1c7191)['then'](function(_0x471e1a){logger['info'](_0xa0a9('0x31'),_0x471e1a[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')]('user:%s',_0x471e1a[_0xa0a9('0x18')]),'webbar:conference');return _0x40d0f5[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x45')});})['catch'](handleError(_0x40d0f5));};exports[_0xa0a9('0x46')]=function(_0x478b4e,_0x2648e4){logger['info'](_0xa0a9('0x47'),_0x478b4e['body']);var _0x662a0=transferValidation[_0xa0a9('0xb')](_0x478b4e[_0xa0a9('0x2a')]);if(_0x662a0[_0xa0a9('0x2b')]>0x0){return _0x2648e4[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x662a0);}var _0x4cc06d=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x2e6d3f=_0x478b4e['body'][_0xa0a9('0x27')];var _0x184b0e=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x48')];return getAgent(_0x4cc06d)[_0xa0a9('0x1c')](function(_0x5581c7){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5581c7[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5581c7[_0xa0a9('0x18')]),_0xa0a9('0x49'),{'sessionId':_0x2e6d3f,'transferNumber':_0x184b0e});return _0x2648e4[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x4a')});})['catch'](handleError(_0x2648e4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 87a9252..118f92d 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x5381c5,_0x365d95){var _0x3c5257=function(_0x8f17e5){while(--_0x8f17e5){_0x5381c5['push'](_0x5381c5['shift']());}};_0x3c5257(++_0x365d95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./whatsappAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router; \ No newline at end of file +var _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x232e60,_0x558b4e){var _0xfdb818=function(_0x3f453d){while(--_0x3f453d){_0x232e60['push'](_0x232e60['shift']());}};_0xfdb818(++_0x558b4e);}(_0x5c3c,0x132));var _0xc5c3=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5c3c[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 62ec023..312d38f 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 _0x452a=['twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x452a,0x104));var _0xa452=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x452a[_0x8cb2f9];return _0x164887;};'use strict';var Sequelize=require(_0xa452('0x0'));var rs=require(_0xa452('0x1'));module[_0xa452('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa452('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa452('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa452('0x3')],'defaultValue':function(){return rs[_0xa452('0x4')]();}},'phone':{'type':Sequelize[_0xa452('0x3')]},'type':{'type':Sequelize[_0xa452('0x5')](_0xa452('0x6'),_0xa452('0x7'))},'accountSid':{'type':Sequelize[_0xa452('0x3')]},'baseUrl':{'type':Sequelize[_0xa452('0x3')]},'authToken':{'type':Sequelize[_0xa452('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa452('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa452('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa452('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa452('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa452('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa452('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa452('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa452('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa452('0xb'),'set':function(_0x815c03){if(!_0x815c03){this['setDataValue'](_0xa452('0xc'),null);}this['setDataValue'](_0xa452('0xd'),_0x815c03);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3ae2=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1275b0,_0x3b7d7d){var _0x409ba5=function(_0x476df7){while(--_0x476df7){_0x1275b0['push'](_0x1275b0['shift']());}};_0x409ba5(++_0x3b7d7d);}(_0x3ae2,0x1d4));var _0x23ae=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x3ae2[_0xc77819];return _0x1c9434;};'use strict';var Sequelize=require(_0x23ae('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x23ae('0x1')],'unique':_0x23ae('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x23ae('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x23ae('0x1')],'defaultValue':function(){return rs[_0x23ae('0x3')]();}},'phone':{'type':Sequelize[_0x23ae('0x1')]},'type':{'type':Sequelize[_0x23ae('0x4')](_0x23ae('0x5'),_0x23ae('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x23ae('0x1')]},'notificationTemplate':{'type':Sequelize[_0x23ae('0x7')],'defaultValue':function(){return _0x23ae('0x8');}},'notificationSound':{'type':Sequelize[_0x23ae('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x23ae('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x23ae('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x23ae('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x23ae('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x23ae('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x23ae('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x23ae('0x9')],'defaultValue':![],'comment':_0x23ae('0xc'),'set':function(_0x15ad6f){if(!_0x15ad6f){this[_0x23ae('0xd')](_0x23ae('0xe'),null);}this[_0x23ae('0xd')]('mandatoryDisposition',_0x15ad6f);}},'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 06200c1..510f158 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 _0xdb25=['apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','WhatsappAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','user','role','WhatsappAccounts','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','timestamp','applications','priority','asc','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','push','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','jayson/promise','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x5d6d50,_0x3d17a8){var _0x404622=function(_0x32dd13){while(--_0x32dd13){_0x5d6d50['push'](_0x5d6d50['shift']());}};_0x404622(++_0x3d17a8);}(_0xdb25,0x159));var _0x5db2=function(_0x2d71a7,_0x183540){_0x2d71a7=_0x2d71a7-0x0;var _0xe3badf=_0xdb25[_0x2d71a7];return _0xe3badf;};'use strict';var emlformat=require(_0x5db2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5db2('0x1'));var jsonpatch=require(_0x5db2('0x2'));var rp=require(_0x5db2('0x3'));var moment=require(_0x5db2('0x4'));var BPromise=require(_0x5db2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5db2('0x6'));var sox=require(_0x5db2('0x7'));var csv=require('to-csv');var ejs=require(_0x5db2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5db2('0x9'));var squel=require(_0x5db2('0xa'));var crypto=require(_0x5db2('0xb'));var jsforce=require(_0x5db2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5db2('0xd'));var querystring=require(_0x5db2('0xe'));var Papa=require(_0x5db2('0xf'));var Redis=require('ioredis');var authService=require(_0x5db2('0x10'));var qs=require(_0x5db2('0x11'));var as=require(_0x5db2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5db2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5db2('0x14'));var db=require(_0x5db2('0x15'))['db'];config['redis']=_[_0x5db2('0x16')](config[_0x5db2('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5db2('0x18'))(new Redis(config[_0x5db2('0x17')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x5db2('0x19'));var client=jayson['client'][_0x5db2('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x4d09d7,_0x4fe2fa,_0x263fc9,_0x36a1d2){return new BPromise(function(_0xd41785,_0x5813f9){var _0x19ef18=_0x36a1d2||client;return _0x19ef18[_0x5db2('0x1b')](_0x4d09d7,_0x263fc9)['then'](function(_0x373e99){logger['info'](_0x5db2('0x1c'),_0x4fe2fa,_0x5db2('0x1d'));logger[_0x5db2('0x1e')](_0x5db2('0x1f'),_0x4fe2fa,'request\x20sent',JSON[_0x5db2('0x20')](_0x373e99));if(_0x373e99[_0x5db2('0x21')]){if(_0x373e99[_0x5db2('0x21')][_0x5db2('0x22')]===0x1f4){logger['error'](_0x5db2('0x1c'),_0x4fe2fa,_0x373e99[_0x5db2('0x21')][_0x5db2('0x23')]);return _0x5813f9(_0x373e99[_0x5db2('0x21')][_0x5db2('0x23')]);}logger[_0x5db2('0x21')](_0x5db2('0x1c'),_0x4fe2fa,_0x373e99[_0x5db2('0x21')][_0x5db2('0x23')]);return _0xd41785(_0x373e99[_0x5db2('0x21')]['message']);}else{logger['info'](_0x5db2('0x1c'),_0x4fe2fa,_0x5db2('0x1d'));_0xd41785(_0x373e99['result'][_0x5db2('0x23')]);}})['catch'](function(_0x5a5379){logger[_0x5db2('0x21')](_0x5db2('0x1c'),_0x4fe2fa,_0x5a5379);_0x5813f9(_0x5a5379);});});}function respondWithStatusCode(_0x375a32,_0x1191ed){_0x1191ed=_0x1191ed||0xcc;return function(_0x3159a8){if(_0x3159a8){return _0x375a32[_0x5db2('0x24')](_0x1191ed);}return _0x375a32[_0x5db2('0x25')](_0x1191ed)[_0x5db2('0x26')]();};}function respondWithResult(_0x51fa29,_0x50a4ae){_0x50a4ae=_0x50a4ae||0xc8;return function(_0x1b8b52){if(_0x1b8b52){return _0x51fa29[_0x5db2('0x25')](_0x50a4ae)['json'](_0x1b8b52);}};}function respondWithFilteredResult(_0x7c6eee,_0x5f1625){return function(_0x1bb85f){if(_0x1bb85f){var _0x39e60c=typeof _0x5f1625[_0x5db2('0x27')]===_0x5db2('0x28')&&typeof _0x5f1625[_0x5db2('0x29')]==='undefined';var _0x349745=_0x1bb85f[_0x5db2('0x2a')];var _0x44cf36=_0x39e60c?0x0:_0x5f1625[_0x5db2('0x27')];var _0xe85b3e=_0x39e60c?_0x1bb85f['count']:_0x5f1625[_0x5db2('0x27')]+_0x5f1625[_0x5db2('0x29')];var _0x378483;if(_0xe85b3e>=_0x349745){_0xe85b3e=_0x349745;_0x378483=0xc8;}else{_0x378483=0xce;}_0x7c6eee['status'](_0x378483);return _0x7c6eee[_0x5db2('0x2b')](_0x5db2('0x2c'),_0x44cf36+'-'+_0xe85b3e+'/'+_0x349745)['json'](_0x1bb85f);}return null;};}function patchUpdates(_0x451b5b){return function(_0x3cb2af){try{jsonpatch[_0x5db2('0x2d')](_0x3cb2af,_0x451b5b,!![]);}catch(_0x2be3f){return BPromise[_0x5db2('0x2e')](_0x2be3f);}return _0x3cb2af[_0x5db2('0x2f')]();};}function saveUpdates(_0x383a0d,_0x55367e){return function(_0x54f6e5){if(_0x54f6e5){return _0x54f6e5[_0x5db2('0x30')](_0x383a0d)[_0x5db2('0x31')](function(_0x4bba7d){return _0x4bba7d;});}return null;};}function removeEntity(_0x16137e,_0x1f574f){return function(_0x2dfff9){if(_0x2dfff9){return _0x2dfff9[_0x5db2('0x32')]()[_0x5db2('0x31')](function(){var _0x4d9cf9=_0x2dfff9[_0x5db2('0x33')]({'plain':!![]});var _0x32f32b='WhatsappAccounts';return db[_0x5db2('0x34')][_0x5db2('0x32')]({'where':{'type':_0x32f32b,'resourceId':_0x4d9cf9['id']}})[_0x5db2('0x31')](function(){return _0x2dfff9;});})[_0x5db2('0x31')](function(){_0x16137e['status'](0xcc)[_0x5db2('0x26')]();});}};}function handleEntityNotFound(_0x3e3c7a,_0xb16c5a){return function(_0x320f03){if(!_0x320f03){_0x3e3c7a[_0x5db2('0x24')](0x194);}return _0x320f03;};}function handleError(_0x31c1e6,_0x393752){_0x393752=_0x393752||0x1f4;return function(_0x1ebe54){logger[_0x5db2('0x21')](_0x1ebe54[_0x5db2('0x35')]);if(_0x1ebe54['name']){delete _0x1ebe54[_0x5db2('0x36')];}_0x31c1e6[_0x5db2('0x25')](_0x393752)[_0x5db2('0x37')](_0x1ebe54);};}exports['index']=function(_0x2f1c32,_0xe431ed){var _0x5537cc={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3fa5c4={},_0x595add={'count':0x0,'rows':[]};var _0x2f5932=_[_0x5db2('0x38')](db[_0x5db2('0x39')]['rawAttributes'],function(_0x502c72){return{'name':_0x502c72[_0x5db2('0x3a')],'type':_0x502c72[_0x5db2('0x3b')][_0x5db2('0x3c')]};});_0x3fa5c4[_0x5db2('0x3d')]=_[_0x5db2('0x38')](_0x2f5932,'name');_0x3fa5c4['query']=_[_0x5db2('0x3e')](_0x2f1c32[_0x5db2('0x3f')]);_0x3fa5c4[_0x5db2('0x40')]=_[_0x5db2('0x41')](_0x3fa5c4[_0x5db2('0x3d')],_0x3fa5c4['query']);_0x5537cc[_0x5db2('0x42')]=_['intersection'](_0x3fa5c4[_0x5db2('0x3d')],qs[_0x5db2('0x43')](_0x2f1c32['query'][_0x5db2('0x43')]));_0x5537cc[_0x5db2('0x42')]=_0x5537cc[_0x5db2('0x42')][_0x5db2('0x44')]?_0x5537cc['attributes']:_0x3fa5c4[_0x5db2('0x3d')];if(!_0x2f1c32[_0x5db2('0x3f')][_0x5db2('0x45')](_0x5db2('0x46'))){_0x5537cc[_0x5db2('0x29')]=qs[_0x5db2('0x29')](_0x2f1c32[_0x5db2('0x3f')][_0x5db2('0x29')]);_0x5537cc['offset']=qs[_0x5db2('0x27')](_0x2f1c32[_0x5db2('0x3f')][_0x5db2('0x27')]);}_0x5537cc[_0x5db2('0x47')]=qs[_0x5db2('0x48')](_0x2f1c32[_0x5db2('0x3f')][_0x5db2('0x48')]);_0x5537cc['where']=qs[_0x5db2('0x40')](_[_0x5db2('0x49')](_0x2f1c32[_0x5db2('0x3f')],_0x3fa5c4[_0x5db2('0x40')]),_0x2f5932);if(_0x2f1c32['query']['filter']){_0x5537cc[_0x5db2('0x4a')]=_[_0x5db2('0x4b')](_0x5537cc[_0x5db2('0x4a')],{'$or':_['map'](_0x2f5932,function(_0x29a787){if(_0x29a787['type']!==_0x5db2('0x4c')){var _0x21d7a3={};_0x21d7a3[_0x29a787['name']]={'$like':'%'+_0x2f1c32['query'][_0x5db2('0x4d')]+'%'};return _0x21d7a3;}})});}_0x5537cc=_['merge']({},_0x5537cc,_0x2f1c32[_0x5db2('0x4e')]);var _0x18db25={'where':_0x5537cc[_0x5db2('0x4a')]};return db['WhatsappAccount']['count'](_0x18db25)['then'](function(_0x1fd768){_0x595add[_0x5db2('0x2a')]=_0x1fd768;if(_0x2f1c32[_0x5db2('0x3f')][_0x5db2('0x4f')]){_0x5537cc[_0x5db2('0x50')]=[{'all':!![]}];}return db[_0x5db2('0x39')]['findAll'](_0x5537cc);})[_0x5db2('0x31')](function(_0xe61b70){_0x595add[_0x5db2('0x51')]=_0xe61b70;return _0x595add;})[_0x5db2('0x31')](respondWithFilteredResult(_0xe431ed,_0x5537cc))['catch'](handleError(_0xe431ed,null));};exports[_0x5db2('0x52')]=function(_0x38874e,_0x468373){var _0x5bc69b={'raw':![],'where':{'id':_0x38874e[_0x5db2('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x5db2('0x54')}]},_0x3ec9fe={};_0x3ec9fe['model']=_[_0x5db2('0x3e')](db[_0x5db2('0x39')][_0x5db2('0x55')]);_0x3ec9fe['query']=_[_0x5db2('0x3e')](_0x38874e[_0x5db2('0x3f')]);_0x3ec9fe[_0x5db2('0x40')]=_[_0x5db2('0x41')](_0x3ec9fe[_0x5db2('0x3d')],_0x3ec9fe['query']);_0x5bc69b['attributes']=_[_0x5db2('0x41')](_0x3ec9fe[_0x5db2('0x3d')],qs[_0x5db2('0x43')](_0x38874e[_0x5db2('0x3f')][_0x5db2('0x43')]));_0x5bc69b[_0x5db2('0x42')]=_0x5bc69b['attributes'][_0x5db2('0x44')]?_0x5bc69b[_0x5db2('0x42')]:_0x3ec9fe[_0x5db2('0x3d')];if(_0x38874e[_0x5db2('0x3f')]['includeAll']){_0x5bc69b[_0x5db2('0x50')]=[{'all':!![]}];}_0x5bc69b=_[_0x5db2('0x4b')]({},_0x5bc69b,_0x38874e['options']);return db[_0x5db2('0x39')][_0x5db2('0x56')](_0x5bc69b)['then'](handleEntityNotFound(_0x468373,null))['then'](respondWithResult(_0x468373,null))['catch'](handleError(_0x468373,null));};exports['create']=function(_0xfe25e8,_0xdd4229){return db[_0x5db2('0x39')][_0x5db2('0x57')](_0xfe25e8['body'],{})['then'](function(_0x469b73){var _0x2d156b=_0xfe25e8[_0x5db2('0x58')][_0x5db2('0x33')]({'plain':!![]});if(!_0x2d156b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d156b[_0x5db2('0x59')]===_0x5db2('0x58')){var _0x1e1a01=_0x469b73[_0x5db2('0x33')]({'plain':!![]});var _0x5a16e4=_0x5db2('0x5a');return db[_0x5db2('0x5b')][_0x5db2('0x56')]({'where':{'name':_0x5a16e4,'userProfileId':_0x2d156b[_0x5db2('0x5c')]},'raw':!![]})['then'](function(_0x5cc6f0){if(_0x5cc6f0&&_0x5cc6f0['autoAssociation']===0x0){return db[_0x5db2('0x34')][_0x5db2('0x57')]({'name':_0x1e1a01[_0x5db2('0x36')],'resourceId':_0x1e1a01['id'],'type':_0x5cc6f0[_0x5db2('0x36')],'sectionId':_0x5cc6f0['id']},{})[_0x5db2('0x31')](function(){return _0x469b73;});}else{return _0x469b73;}})[_0x5db2('0x5d')](function(_0x382111){logger[_0x5db2('0x21')](_0x5db2('0x5e'),_0x382111);throw _0x382111;});}return _0x469b73;})[_0x5db2('0x31')](respondWithResult(_0xdd4229,0xc9))[_0x5db2('0x5d')](handleError(_0xdd4229,null));};exports[_0x5db2('0x30')]=function(_0x1e208c,_0x56b6fb){if(_0x1e208c[_0x5db2('0x5f')]['id']){delete _0x1e208c['body']['id'];}return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x1e208c['params']['id']},'include':[{'model':db[_0x5db2('0x60')],'as':_0x5db2('0x54')}]})['then'](handleEntityNotFound(_0x56b6fb,null))[_0x5db2('0x31')](saveUpdates(_0x1e208c[_0x5db2('0x5f')],null))[_0x5db2('0x31')](respondWithResult(_0x56b6fb,null))[_0x5db2('0x5d')](handleError(_0x56b6fb,null));};exports[_0x5db2('0x32')]=function(_0x32e3e4,_0x3d0293){return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x32e3e4[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x3d0293,null))[_0x5db2('0x31')](removeEntity(_0x3d0293,null))[_0x5db2('0x5d')](handleError(_0x3d0293,null));};exports['describe']=function(_0x4364a2,_0x42608e){return db[_0x5db2('0x39')]['describe']()['then'](respondWithResult(_0x42608e,null))[_0x5db2('0x5d')](handleError(_0x42608e,null));};exports[_0x5db2('0x61')]=function(_0x30b95d,_0x296e71,_0x3bc331){if(_0x30b95d[_0x5db2('0x5f')]['id']){delete _0x30b95d['body']['id'];}return db[_0x5db2('0x39')]['find']({'where':{'id':_0x30b95d[_0x5db2('0x53')]['id']}})['then'](handleEntityNotFound(_0x296e71,null))[_0x5db2('0x31')](function(_0x40471a){if(_0x40471a){_0x30b95d[_0x5db2('0x5f')][_0x5db2('0x62')]=_0x40471a['id'];return db[_0x5db2('0x63')]['create'](_0x30b95d[_0x5db2('0x5f')]);}})[_0x5db2('0x31')](respondWithResult(_0x296e71,null))[_0x5db2('0x5d')](handleError(_0x296e71,null));};exports[_0x5db2('0x64')]=function(_0x1cfe7e,_0x1e318e,_0x3bb218){var _0xe920bd={'raw':![],'where':{}};var _0x40147e={};var _0x15ed15={'count':0x0,'rows':[]};return db[_0x5db2('0x39')][_0x5db2('0x65')]({'where':{'id':_0x1cfe7e[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x1e318e,null))[_0x5db2('0x31')](function(_0xdfdf54){if(_0xdfdf54){_0x40147e[_0x5db2('0x3d')]=_['keys'](db[_0x5db2('0x63')][_0x5db2('0x55')]);_0x40147e[_0x5db2('0x3f')]=_[_0x5db2('0x3e')](_0x1cfe7e['query']);_0x40147e['filters']=_[_0x5db2('0x41')](_0x40147e[_0x5db2('0x3d')],_0x40147e[_0x5db2('0x3f')]);_0xe920bd[_0x5db2('0x42')]=_[_0x5db2('0x41')](_0x40147e[_0x5db2('0x3d')],qs[_0x5db2('0x43')](_0x1cfe7e[_0x5db2('0x3f')][_0x5db2('0x43')]));_0xe920bd['attributes']=_0xe920bd[_0x5db2('0x42')][_0x5db2('0x44')]?_0xe920bd[_0x5db2('0x42')]:_0x40147e[_0x5db2('0x3d')];if(!_0x1cfe7e[_0x5db2('0x3f')][_0x5db2('0x45')]('nolimit')){_0xe920bd[_0x5db2('0x29')]=qs[_0x5db2('0x29')](_0x1cfe7e[_0x5db2('0x3f')][_0x5db2('0x29')]);_0xe920bd[_0x5db2('0x27')]=qs['offset'](_0x1cfe7e['query']['offset']);}_0xe920bd[_0x5db2('0x47')]=qs[_0x5db2('0x48')](_0x1cfe7e[_0x5db2('0x3f')][_0x5db2('0x48')]);_0xe920bd[_0x5db2('0x4a')]=qs[_0x5db2('0x40')](_[_0x5db2('0x49')](_0x1cfe7e[_0x5db2('0x3f')],_0x40147e[_0x5db2('0x40')]));_0xe920bd['where'][_0x5db2('0x62')]=_0xdfdf54['id'];if(_0x1cfe7e[_0x5db2('0x3f')]['filter']){_0xe920bd[_0x5db2('0x4a')]=_[_0x5db2('0x4b')](_0xe920bd[_0x5db2('0x4a')],{'$or':_[_0x5db2('0x38')](_0xe920bd['attributes'],function(_0x545c2e){var _0x1fefea={};_0x1fefea[_0x545c2e]={'$like':'%'+_0x1cfe7e['query'][_0x5db2('0x4d')]+'%'};return _0x1fefea;})});}_0xe920bd=_[_0x5db2('0x4b')]({},_0xe920bd,_0x1cfe7e[_0x5db2('0x4e')]);return db[_0x5db2('0x63')][_0x5db2('0x2a')]({'where':_0xe920bd[_0x5db2('0x4a')]})[_0x5db2('0x31')](function(_0x2387bc){_0x15ed15[_0x5db2('0x2a')]=_0x2387bc;if(_0x1cfe7e[_0x5db2('0x3f')][_0x5db2('0x4f')]){_0xe920bd[_0x5db2('0x50')]=[{'all':!![]}];}return db[_0x5db2('0x63')][_0x5db2('0x66')](_0xe920bd);})['then'](function(_0x4b74a7){_0x15ed15[_0x5db2('0x51')]=_0x4b74a7;return _0x15ed15;});}})['then'](respondWithFilteredResult(_0x1e318e,_0xe920bd))[_0x5db2('0x5d')](handleError(_0x1e318e,null));};exports['removeDispositions']=function(_0x39135b,_0x3f77bb,_0xf46516){return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x39135b[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x3f77bb,null))[_0x5db2('0x31')](function(_0x3cbde6){if(_0x3cbde6){return _0x3cbde6[_0x5db2('0x67')](_0x39135b[_0x5db2('0x3f')]['ids']);}})[_0x5db2('0x31')](respondWithStatusCode(_0x3f77bb,null))['catch'](handleError(_0x3f77bb,null));};exports[_0x5db2('0x68')]=function(_0x82f9b5,_0x417253,_0x3f2236){if(_0x82f9b5[_0x5db2('0x5f')]['id']){delete _0x82f9b5['body']['id'];}return db[_0x5db2('0x39')]['find']({'where':{'id':_0x82f9b5[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x417253,null))['then'](function(_0x16f5a7){if(_0x16f5a7){_0x82f9b5[_0x5db2('0x5f')][_0x5db2('0x62')]=_0x16f5a7['id'];return db[_0x5db2('0x69')]['create'](_0x82f9b5[_0x5db2('0x5f')]);}})['then'](respondWithResult(_0x417253,null))[_0x5db2('0x5d')](handleError(_0x417253,null));};exports[_0x5db2('0x6a')]=function(_0x472dfd,_0x4194ad,_0x44353b){var _0x4ebaa0={'raw':![],'where':{}};var _0x29d1cf={};var _0xc54732={'count':0x0,'rows':[]};return db[_0x5db2('0x39')][_0x5db2('0x65')]({'where':{'id':_0x472dfd[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x4194ad,null))[_0x5db2('0x31')](function(_0x559318){if(_0x559318){_0x29d1cf[_0x5db2('0x3d')]=_[_0x5db2('0x3e')](db[_0x5db2('0x69')][_0x5db2('0x55')]);_0x29d1cf['query']=_[_0x5db2('0x3e')](_0x472dfd['query']);_0x29d1cf[_0x5db2('0x40')]=_['intersection'](_0x29d1cf[_0x5db2('0x3d')],_0x29d1cf['query']);_0x4ebaa0[_0x5db2('0x42')]=_[_0x5db2('0x41')](_0x29d1cf['model'],qs['fields'](_0x472dfd['query'][_0x5db2('0x43')]));_0x4ebaa0[_0x5db2('0x42')]=_0x4ebaa0[_0x5db2('0x42')][_0x5db2('0x44')]?_0x4ebaa0['attributes']:_0x29d1cf[_0x5db2('0x3d')];if(!_0x472dfd['query'][_0x5db2('0x45')](_0x5db2('0x46'))){_0x4ebaa0[_0x5db2('0x29')]=qs[_0x5db2('0x29')](_0x472dfd[_0x5db2('0x3f')][_0x5db2('0x29')]);_0x4ebaa0[_0x5db2('0x27')]=qs[_0x5db2('0x27')](_0x472dfd[_0x5db2('0x3f')][_0x5db2('0x27')]);}_0x4ebaa0[_0x5db2('0x47')]=qs[_0x5db2('0x48')](_0x472dfd[_0x5db2('0x3f')]['sort']);_0x4ebaa0[_0x5db2('0x4a')]=qs[_0x5db2('0x40')](_[_0x5db2('0x49')](_0x472dfd[_0x5db2('0x3f')],_0x29d1cf['filters']));_0x4ebaa0[_0x5db2('0x4a')][_0x5db2('0x62')]=_0x559318['id'];if(_0x472dfd[_0x5db2('0x3f')][_0x5db2('0x4d')]){_0x4ebaa0[_0x5db2('0x4a')]=_['merge'](_0x4ebaa0[_0x5db2('0x4a')],{'$or':_[_0x5db2('0x38')](_0x4ebaa0[_0x5db2('0x42')],function(_0x3460ac){var _0x4536df={};_0x4536df[_0x3460ac]={'$like':'%'+_0x472dfd[_0x5db2('0x3f')]['filter']+'%'};return _0x4536df;})});}_0x4ebaa0=_[_0x5db2('0x4b')]({},_0x4ebaa0,_0x472dfd[_0x5db2('0x4e')]);return db[_0x5db2('0x69')][_0x5db2('0x2a')]({'where':_0x4ebaa0[_0x5db2('0x4a')]})[_0x5db2('0x31')](function(_0x294e26){_0xc54732[_0x5db2('0x2a')]=_0x294e26;if(_0x472dfd[_0x5db2('0x3f')][_0x5db2('0x4f')]){_0x4ebaa0['include']=[{'all':!![]}];}return db[_0x5db2('0x69')]['findAll'](_0x4ebaa0);})[_0x5db2('0x31')](function(_0x10b8a0){_0xc54732['rows']=_0x10b8a0;return _0xc54732;});}})[_0x5db2('0x31')](respondWithFilteredResult(_0x4194ad,_0x4ebaa0))['catch'](handleError(_0x4194ad,null));};exports[_0x5db2('0x6b')]=function(_0x40147f,_0x12d180,_0x32c01c){return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x40147f[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x12d180,null))[_0x5db2('0x31')](function(_0x583755){if(_0x583755){return _0x583755[_0x5db2('0x6b')](_0x40147f[_0x5db2('0x3f')][_0x5db2('0x6c')]);}})[_0x5db2('0x31')](respondWithStatusCode(_0x12d180,null))['catch'](handleError(_0x12d180,null));};exports[_0x5db2('0x6d')]=function(_0x7d2f35,_0x1c975b,_0x325a68){return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x7d2f35[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x1c975b,null))[_0x5db2('0x31')](function(_0x4c1c8b){if(_0x4c1c8b){return _0x4c1c8b[_0x5db2('0x6d')](_0x7d2f35[_0x5db2('0x5f')][_0x5db2('0x6c')],_[_0x5db2('0x6e')](_0x7d2f35[_0x5db2('0x5f')],['ids','id'])||{})[_0x5db2('0x6f')](function(_0x279b97){for(var _0x23b416=0x0;_0x23b416<_0x7d2f35[_0x5db2('0x5f')]['ids'][_0x5db2('0x44')];_0x23b416+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x7d2f35[_0x5db2('0x5f')][_0x5db2('0x6c')][_0x23b416]),'WhatsappAccountId':Number(_0x7d2f35[_0x5db2('0x53')]['id'])});}return _0x279b97;});}})[_0x5db2('0x31')](respondWithResult(_0x1c975b,null))[_0x5db2('0x5d')](handleError(_0x1c975b,null));};exports[_0x5db2('0x70')]=function(_0x1121d8,_0x1c3f96,_0x186ca2){return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x1121d8[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x1c3f96,null))[_0x5db2('0x31')](function(_0x2a8b4f){if(_0x2a8b4f){return _0x2a8b4f[_0x5db2('0x70')](_0x1121d8[_0x5db2('0x3f')]['ids'])['then'](function(){if(_[_0x5db2('0x71')](_0x1121d8[_0x5db2('0x3f')][_0x5db2('0x6c')])){for(var _0x46b23e=0x0;_0x46b23e<_0x1121d8['query'][_0x5db2('0x6c')][_0x5db2('0x44')];_0x46b23e+=0x1){socket[_0x5db2('0x72')](_0x5db2('0x73'),{'UserId':Number(_0x1121d8[_0x5db2('0x3f')][_0x5db2('0x6c')][_0x46b23e]),'WhatsappAccountId':Number(_0x1121d8[_0x5db2('0x53')]['id'])});}}else{socket[_0x5db2('0x72')](_0x5db2('0x73'),{'UserId':Number(_0x1121d8[_0x5db2('0x3f')][_0x5db2('0x6c')]),'WhatsappAccountId':Number(_0x1121d8[_0x5db2('0x53')]['id'])});}});}})[_0x5db2('0x31')](respondWithStatusCode(_0x1c3f96,null))[_0x5db2('0x5d')](handleError(_0x1c3f96,null));};exports[_0x5db2('0x74')]=function(_0x180b08,_0x1995ac,_0x244b4e){var _0x5644bd={};var _0x18f733={};var _0x3f62f4;var _0x4cb065;return db[_0x5db2('0x39')][_0x5db2('0x65')]({'where':{'id':_0x180b08[_0x5db2('0x53')]['id']}})[_0x5db2('0x31')](handleEntityNotFound(_0x1995ac,null))[_0x5db2('0x31')](function(_0x4e5757){if(_0x4e5757){_0x3f62f4=_0x4e5757;_0x18f733['model']=_['keys'](db['User'][_0x5db2('0x55')]);_0x18f733[_0x5db2('0x3f')]=_[_0x5db2('0x3e')](_0x180b08['query']);_0x18f733[_0x5db2('0x40')]=_[_0x5db2('0x41')](_0x18f733['model'],_0x18f733[_0x5db2('0x3f')]);_0x5644bd[_0x5db2('0x42')]=_[_0x5db2('0x41')](_0x18f733[_0x5db2('0x3d')],qs[_0x5db2('0x43')](_0x180b08['query'][_0x5db2('0x43')]));_0x5644bd[_0x5db2('0x42')]=_0x5644bd[_0x5db2('0x42')][_0x5db2('0x44')]?_0x5644bd[_0x5db2('0x42')]:_0x18f733['model'];_0x5644bd[_0x5db2('0x47')]=qs[_0x5db2('0x48')](_0x180b08[_0x5db2('0x3f')]['sort']);_0x5644bd[_0x5db2('0x4a')]=qs[_0x5db2('0x40')](_[_0x5db2('0x49')](_0x180b08['query'],_0x18f733[_0x5db2('0x40')]));if(_0x180b08[_0x5db2('0x3f')][_0x5db2('0x4d')]){_0x5644bd[_0x5db2('0x4a')]=_[_0x5db2('0x4b')](_0x5644bd[_0x5db2('0x4a')],{'$or':_['map'](_0x5644bd['attributes'],function(_0x3f303b){var _0x1412ba={};_0x1412ba[_0x3f303b]={'$like':'%'+_0x180b08[_0x5db2('0x3f')][_0x5db2('0x4d')]+'%'};return _0x1412ba;})});}_0x5644bd=_[_0x5db2('0x4b')]({},_0x5644bd,_0x180b08['options']);return _0x3f62f4[_0x5db2('0x74')](_0x5644bd);}})[_0x5db2('0x31')](function(_0x104f0e){if(_0x104f0e){_0x4cb065=_0x104f0e[_0x5db2('0x44')];if(!_0x180b08[_0x5db2('0x3f')][_0x5db2('0x45')](_0x5db2('0x46'))){_0x5644bd[_0x5db2('0x29')]=qs['limit'](_0x180b08['query']['limit']);_0x5644bd[_0x5db2('0x27')]=qs['offset'](_0x180b08[_0x5db2('0x3f')][_0x5db2('0x27')]);}return _0x3f62f4[_0x5db2('0x74')](_0x5644bd);}})[_0x5db2('0x31')](function(_0x4f5ce6){if(_0x4f5ce6){return _0x4f5ce6?{'count':_0x4cb065,'rows':_0x4f5ce6}:null;}})[_0x5db2('0x31')](respondWithResult(_0x1995ac,null))[_0x5db2('0x5d')](handleError(_0x1995ac,null));};exports[_0x5db2('0x75')]=function(_0x39d99a,_0x33d07){var _0x57950e=_0x39d99a[_0x5db2('0x53')]['id'];var _0x3d3b83=_0x39d99a[_0x5db2('0x5f')];var _0x31a396=0xc8;var _0x37f917=null;return db['sequelize'][_0x5db2('0x76')]({'isolationLevel':db[_0x5db2('0x77')][_0x5db2('0x78')][_0x5db2('0x79')][_0x5db2('0x7a')]},function(_0x471ce9){return db['WhatsappAccount'][_0x5db2('0x65')]({'where':{'id':_0x57950e},'transaction':_0x471ce9})[_0x5db2('0x31')](function(_0x2576fa){if(_0x2576fa){return db[_0x5db2('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x57950e},'transaction':_0x471ce9})[_0x5db2('0x31')](function(){var _0x549ebf=_['map'](_0x3d3b83,function(_0x2995bf){_0x2995bf[_0x5db2('0x62')]=_0x57950e;return _0x2995bf;});return db[_0x5db2('0x7b')][_0x5db2('0x7c')](_0x549ebf,{'transaction':_0x471ce9});});}else{_0x31a396=0x194;_0x37f917=[];}});})['then'](function(){if(_0x31a396!==0x194){return db[_0x5db2('0x7b')][_0x5db2('0x7d')]({'where':{'WhatsappAccountId':_0x57950e},'order':'priority'})[_0x5db2('0x31')](function(_0x91acab){_0x37f917=_0x91acab;});}})[_0x5db2('0x5d')](function(_0xd18b){_0x31a396=0x1f4;logger[_0x5db2('0x21')](_0xd18b[_0x5db2('0x35')]);if(_0xd18b[_0x5db2('0x36')]){delete _0xd18b[_0x5db2('0x36')];}_0x37f917=_0xd18b;})[_0x5db2('0x7e')](function(){if(_0x37f917===null){_0x33d07[_0x5db2('0x24')](_0x31a396);}else{if(_0x31a396===0x1f4){_0x33d07[_0x5db2('0x25')](_0x31a396)[_0x5db2('0x37')](_0x37f917);}else{_0x33d07[_0x5db2('0x25')](_0x31a396)[_0x5db2('0x7f')](_0x37f917);}}});};exports[_0x5db2('0x80')]=function(_0x2bc7ab,_0x39bb77,_0x29994e){var _0x240468={};var _0x1d92ec={};var _0xe18f41;var _0x2775ab;return db[_0x5db2('0x39')]['findOne']({'where':{'id':_0x2bc7ab[_0x5db2('0x53')]['id']}})['then'](handleEntityNotFound(_0x39bb77,null))[_0x5db2('0x31')](function(_0x299c6c){if(_0x299c6c){_0xe18f41=_0x299c6c;_0x1d92ec['model']=_[_0x5db2('0x3e')](db[_0x5db2('0x7b')][_0x5db2('0x55')]);_0x1d92ec[_0x5db2('0x3f')]=_[_0x5db2('0x3e')](_0x2bc7ab[_0x5db2('0x3f')]);_0x1d92ec[_0x5db2('0x40')]=_['intersection'](_0x1d92ec[_0x5db2('0x3d')],_0x1d92ec[_0x5db2('0x3f')]);_0x240468[_0x5db2('0x42')]=_[_0x5db2('0x41')](_0x1d92ec[_0x5db2('0x3d')],qs[_0x5db2('0x43')](_0x2bc7ab[_0x5db2('0x3f')]['fields']));_0x240468[_0x5db2('0x42')]=_0x240468[_0x5db2('0x42')][_0x5db2('0x44')]?_0x240468[_0x5db2('0x42')]:_0x1d92ec[_0x5db2('0x3d')];_0x240468[_0x5db2('0x47')]=qs[_0x5db2('0x48')](_0x2bc7ab[_0x5db2('0x3f')][_0x5db2('0x48')]);_0x240468[_0x5db2('0x4a')]=qs['filters'](_[_0x5db2('0x49')](_0x2bc7ab[_0x5db2('0x3f')],_0x1d92ec[_0x5db2('0x40')]));if(_0x2bc7ab[_0x5db2('0x3f')][_0x5db2('0x4d')]){_0x240468['where']=_['merge'](_0x240468[_0x5db2('0x4a')],{'$or':_[_0x5db2('0x38')](_0x240468[_0x5db2('0x42')],function(_0x55d967){var _0xec7b69={};_0xec7b69[_0x55d967]={'$like':'%'+_0x2bc7ab[_0x5db2('0x3f')]['filter']+'%'};return _0xec7b69;})});}_0x240468=_[_0x5db2('0x4b')]({},_0x240468,_0x2bc7ab['options']);return _0xe18f41[_0x5db2('0x80')](_0x240468);}})['then'](function(_0xb30978){if(_0xb30978){_0x2775ab=_0xb30978[_0x5db2('0x44')];if(!_0x2bc7ab[_0x5db2('0x3f')][_0x5db2('0x45')](_0x5db2('0x46'))){_0x240468['limit']=qs[_0x5db2('0x29')](_0x2bc7ab[_0x5db2('0x3f')]['limit']);_0x240468['offset']=qs['offset'](_0x2bc7ab['query']['offset']);}return _0xe18f41[_0x5db2('0x80')](_0x240468);}})[_0x5db2('0x31')](function(_0xff5d7a){if(_0xff5d7a){return _0xff5d7a?{'count':_0x2775ab,'rows':_0xff5d7a}:null;}})[_0x5db2('0x31')](respondWithResult(_0x39bb77,null))['catch'](handleError(_0x39bb77,null));};exports[_0x5db2('0x81')]=function(_0x109835,_0x1612c9,_0x26314f){var _0x2b3403={'channel':_0x5db2('0x82')};var _0x161ee1=[];var _0x4794f3=[];var _0x443cb3={};return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x109835[_0x5db2('0x53')]['id']},'include':[{'model':db[_0x5db2('0x7b')],'as':_0x5db2('0x83')}]})[_0x5db2('0x31')](handleEntityNotFound(_0x1612c9,null))[_0x5db2('0x31')](function(_0x404f19){_0x2b3403[_0x5db2('0x84')]=_0x404f19;if(_0x2b3403[_0x5db2('0x84')]&&_0x2b3403['account']['type']===_0x5db2('0x85')&&_0x109835[_0x5db2('0x5f')][_0x5db2('0x86')]){if(_0x109835[_0x5db2('0x5f')][_0x5db2('0x86')][_0x5db2('0x44')]===0x0)return;if(_0x109835[_0x5db2('0x5f')][_0x5db2('0x86')][0x0]['state']!==_0x5db2('0x87'))return;return db['WhatsappMessage'][_0x5db2('0x30')]({'read':!![],'readAt':_0x109835[_0x5db2('0x5f')]['statuses'][0x0][_0x5db2('0x88')]},{'where':{'messageId':_0x109835[_0x5db2('0x5f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x5db2('0x31')](function(_0x307047){return _0x1612c9[_0x5db2('0x25')](0xc8)[_0x5db2('0x7f')](_0x307047);});}_0x2b3403[_0x5db2('0x89')]=_['orderBy'](_0x404f19['Applications'],[_0x5db2('0x8a')],[_0x5db2('0x8b')]);if(_0x2b3403['account']['Applications']){delete _0x2b3403[_0x5db2('0x84')][_0x5db2('0x83')];}return db[_0x5db2('0x8c')][_0x5db2('0x8d')]()[_0x5db2('0x31')](function(_0x357096){if(!_0x357096){throw new db[(_0x5db2('0x8e'))]['ValidationError'](_0x5db2('0x8f'));}_0x161ee1=_[_0x5db2('0x90')](_[_0x5db2('0x3e')](_0x357096),[_0x5db2('0x91'),_0x5db2('0x92')]);_0x4794f3=_[_0x5db2('0x90')](_[_0x5db2('0x3e')](_0x357096),[_0x5db2('0x91'),_0x5db2('0x92'),_0x5db2('0x93'),_0x5db2('0x94')]);_0x2b3403[_0x5db2('0x5f')]={'mapKey':_0x5db2('0x95')};if(_0x2b3403[_0x5db2('0x84')]&&_0x2b3403['account']['type']===_0x5db2('0x96')){_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x97')]=_0x109835[_0x5db2('0x5f')][_0x5db2('0x98')][_0x5db2('0x99')](_0x5db2('0x9a'),'');_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x5f')]=_0x109835[_0x5db2('0x5f')]['Body'];_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x9b')]=_0x109835['body'][_0x5db2('0x9c')];}if(_0x2b3403[_0x5db2('0x84')]&&_0x2b3403['account'][_0x5db2('0x3b')]==='sinch'){_0x2b3403['body']['from']=_0x109835[_0x5db2('0x5f')][_0x5db2('0x9d')][0x0][_0x5db2('0x97')];_0x2b3403[_0x5db2('0x5f')]['body']=_0x109835['body']['notifications'][0x0]['message']['body'];_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x9b')]=_0x109835[_0x5db2('0x5f')][_0x5db2('0x9d')][0x0][_0x5db2('0x9e')];}if(_0x2b3403[_0x5db2('0x5f')]['id']){delete _0x2b3403['body']['id'];}if(_[_0x5db2('0x9f')](_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x97')])){throw new db[(_0x5db2('0x8e'))]['ValidationError'](_0x5db2('0xa0'));}if(_[_0x5db2('0x9f')](_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x5f')])||_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x5f')]===''){throw new db[(_0x5db2('0x8e'))][(_0x5db2('0xa1'))](_0x5db2('0xa2'));}if(_[_0x5db2('0x9f')](_0x2b3403[_0x5db2('0x5f')][_0x5db2('0xa3')])){throw new db[(_0x5db2('0x8e'))][(_0x5db2('0xa1'))](_0x5db2('0xa4')+_0x4794f3);}if(!_[_0x5db2('0xa5')](_0x4794f3,_0x2b3403[_0x5db2('0x5f')][_0x5db2('0xa3')])){throw new db[(_0x5db2('0x8e'))][(_0x5db2('0xa1'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4794f3);}_0x443cb3[_0x2b3403[_0x5db2('0x5f')][_0x5db2('0xa3')]]=_0x2b3403['body'][_0x5db2('0x97')];return db[_0x5db2('0xa6')][_0x5db2('0x56')]({'where':{'id':_0x2b3403[_0x5db2('0x84')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x5db2('0xa7'),'where':_0x443cb3,'limit':0x1,'order':[[_0x5db2('0x92'),'DESC']]}]});})[_0x5db2('0x31')](handleEntityNotFound(_0x1612c9,null))[_0x5db2('0x31')](function(_0x2eb235){if(_0x2eb235){_0x2b3403[_0x5db2('0xa8')]=_[_0x5db2('0x6e')](_0x2eb235,['Contacts']);if(_0x2eb235[_0x5db2('0xa7')]['length']){return _0x2eb235['Contacts'][0x0];}var _0x190871=_['defaults'](_0x2b3403[_0x5db2('0x5f')],{'firstName':_0x2b3403[_0x5db2('0x5f')]['from'],'ListId':_0x2eb235['id']});_0x190871[_0x2b3403[_0x5db2('0x5f')][_0x5db2('0xa3')]]=_0x2b3403[_0x5db2('0x5f')][_0x5db2('0x97')];return db[_0x5db2('0x8c')]['create'](_0x190871,{'fields':_0x161ee1,'raw':!![]});}})[_0x5db2('0x31')](handleEntityNotFound(_0x1612c9,null))[_0x5db2('0x31')](function(_0x95309c){if(_0x95309c){_0x2b3403[_0x5db2('0xa9')]=_0x95309c;var _0x49b051={'ContactId':_0x95309c['id'],'phone':_0x2b3403['body']['from'],'WhatsappAccountId':_0x109835[_0x5db2('0x53')]['id']};var _0x17a2e5={'ContactId':_0x95309c['id'],'WhatsappAccountId':_0x109835['params']['id'],'closed':![]};return db[_0x5db2('0xaa')]['find']({'where':_0x17a2e5})[_0x5db2('0x31')](function(_0x52a8e2){if(_0x52a8e2){return[_0x52a8e2,![]];}return db[_0x5db2('0xaa')][_0x5db2('0x57')](_0x49b051)[_0x5db2('0x31')](function(_0xa30d70){return[_0xa30d70,!![]];});});}})[_0x5db2('0x6f')](function(_0x5351fb,_0x1069c9){_0x2b3403[_0x5db2('0xab')]=_0x5351fb['get']({'plain':!![]});_0x2b3403[_0x5db2('0xab')][_0x5db2('0xac')]=![];if(_0x1069c9){if(_0x2b3403[_0x5db2('0x84')]['autoclose']){_0x2b3403[_0x5db2('0x89')][_0x5db2('0xad')]({'id':0x0,'priority':_0x2b3403[_0x5db2('0x89')][_0x5db2('0x44')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5db2('0xae')});}_0x2b3403[_0x5db2('0xab')][_0x5db2('0xac')]=!![];}return db[_0x5db2('0xaf')][_0x5db2('0x57')]({'phone':_0x2b3403['body'][_0x5db2('0x97')],'messageId':_0x2b3403[_0x5db2('0x5f')]['messageId'],'body':_0x2b3403['body']['body'],'WhatsappAccountId':_0x109835[_0x5db2('0x53')]['id'],'WhatsappInteractionId':_0x5351fb['id'],'direction':'in','ContactId':_0x5351fb[_0x5db2('0xb0')],'AttachmentId':_0x2b3403[_0x5db2('0x5f')][_0x5db2('0xb1')]});})[_0x5db2('0x31')](function(_0x2435cc){_0x2b3403[_0x5db2('0x23')]=_0x2435cc;if(_0x2b3403['interaction'][_0x5db2('0xb2')]){return db[_0x5db2('0xb3')][_0x5db2('0x56')]({'attributes':['id','name'],'where':{'id':_0x2b3403[_0x5db2('0xab')][_0x5db2('0xb2')]}})[_0x5db2('0x31')](function(_0x2605cb){if(_0x2605cb){_0x2b3403[_0x5db2('0x89')][_0x5db2('0xb4')]({'id':0x0,'priority':0x0,'app':_0x5db2('0xb5'),'appdata':_0x2605cb[_0x5db2('0x36')]+','+(_0x2b3403[_0x5db2('0x84')][_0x5db2('0xb6')]||0xa),'interval':_0x5db2('0xae')});}return respondWithRpcPromise(_0x5db2('0xb7'),_0x5db2('0xb8'),_0x2b3403);});}return respondWithRpcPromise(_0x5db2('0xb7'),_0x5db2('0xb8'),_0x2b3403);})[_0x5db2('0x31')](function(_0x1bfe95){if(_0x1bfe95){var _0x51672f=0xc8;var _0x507d8a=_0x5db2('0xb9');logger[_0x5db2('0xba')](_0x5db2('0x1f'),_0x507d8a,_0x51672f,_0x5db2('0xbb'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x507d8a,_0x51672f,_0x5db2('0xbb'),JSON[_0x5db2('0x20')](_0x1bfe95));if(_0x2b3403['account'][_0x5db2('0x3b')]===_0x5db2('0x96')){return _0x1612c9[_0x5db2('0x25')](_0x51672f)['set']('Content-Type',_0x5db2('0xbc'))[_0x5db2('0x37')](_0x5db2('0xbd'));}else{return _0x1612c9[_0x5db2('0x25')](_0x51672f)[_0x5db2('0x7f')](_0x1bfe95);}}});})[_0x5db2('0x5d')](handleError(_0x1612c9,null));};exports[_0x5db2('0x37')]=function(_0x36227c,_0x16d637,_0xb7c29b){var _0x10f15a,_0x1a0043,_0x3088c9;if(_[_0x5db2('0x9f')](_0x36227c[_0x5db2('0x5f')][_0x5db2('0x5f')])||_0x36227c['body']['body']===''){throw new db[(_0x5db2('0x8e'))][(_0x5db2('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5db2('0x9f')](_0x36227c[_0x5db2('0x5f')]['to'])){throw new db[(_0x5db2('0x8e'))][(_0x5db2('0xa1'))](_0x5db2('0xbe'));}_0x10f15a=_0x36227c[_0x5db2('0x5f')]['to'];return db[_0x5db2('0x39')][_0x5db2('0x56')]({'where':{'id':_0x36227c[_0x5db2('0x53')]['id']},'include':[{'model':db[_0x5db2('0xa6')],'as':'List','include':[{'model':db[_0x5db2('0x8c')],'as':_0x5db2('0xa7'),'where':{'mobile':_0x10f15a},'limit':0x1,'order':[[_0x5db2('0x92'),'DESC']]}]}]})[_0x5db2('0x31')](handleEntityNotFound(_0x16d637,null))['then'](function(_0x379254){if(_0x379254&&_0x379254['List']){_0x1a0043=_0x379254[_0x5db2('0x33')]({'plain':!![]});if(_0x1a0043[_0x5db2('0xbf')]&&_0x1a0043['List']['Contacts']['length']){return _0x1a0043[_0x5db2('0xbf')]['Contacts'][0x0];}return db[_0x5db2('0x8c')][_0x5db2('0x57')](_[_0x5db2('0x16')](_0x36227c['body'],{'firstName':_0x10f15a,'mobile':_0x10f15a,'phone':_0x10f15a,'ListId':_0x1a0043[_0x5db2('0x94')]}));}})['then'](handleEntityNotFound(_0x16d637,null))['then'](function(_0x1ceb7a){if(_0x1ceb7a){_0x3088c9=_0x1ceb7a;return db[_0x5db2('0xaa')]['find']({'where':{'ContactId':_0x3088c9['id'],'closed':![],'WhatsappAccountId':_0x1a0043['id']}})[_0x5db2('0x31')](function(_0x4b6e4){if(_0x4b6e4){return[_0x4b6e4,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x36227c[_0x5db2('0x58')]['id'],'ContactId':_0x3088c9['id'],'WhatsappAccountId':_0x1a0043['id'],'phone':_0x10f15a,'firstMsgDirection':_0x5db2('0xc0'),'Messages':[_[_0x5db2('0x4b')](_0x36227c[_0x5db2('0x5f')],{'read':![],'body':_0x36227c[_0x5db2('0x5f')][_0x5db2('0x5f')],'phone':_0x10f15a,'WhatsappAccountId':_0x1a0043['id'],'UserId':_0x36227c[_0x5db2('0x58')]['id'],'ContactId':_0x3088c9['id']})]},{'include':[{'model':db[_0x5db2('0xaf')],'as':_0x5db2('0xc1')}]})['then'](function(_0x15025a){return[_0x15025a,!![]];});});}})['spread'](function(_0x2a8ad2,_0x360502){if(_0x360502){return _0x2a8ad2;}return db[_0x5db2('0xaf')][_0x5db2('0x57')](_[_0x5db2('0x4b')](_0x36227c['body'],{'read':![],'body':_0x36227c[_0x5db2('0x5f')][_0x5db2('0x5f')],'phone':_0x10f15a,'WhatsappAccountId':_0x1a0043['id'],'WhatsappInteractionId':_0x2a8ad2['id'],'UserId':_0x36227c[_0x5db2('0x58')]['id'],'ContactId':_0x3088c9['id']}))[_0x5db2('0x31')](function(_0x465e60){_0x2a8ad2[_0x5db2('0xc2')][_0x5db2('0xc1')]=[];_0x2a8ad2['dataValues'][_0x5db2('0xc1')][_0x5db2('0xad')](_0x465e60[_0x5db2('0xc2')]);return _0x2a8ad2;});})[_0x5db2('0x31')](respondWithResult(_0x16d637,null))['catch'](handleError(_0x16d637,null));}; \ No newline at end of file +var _0x1fae=['body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','include','rows','show','params','intersection','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','userProfileId','autoAssociation','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','order','filters','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','updatedAt','DESC','list','Contacts','WhatsappInteraction','interaction','autoclose','applications','push','*,*,*,*','created','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a'];(function(_0x80da37,_0x28b1f0){var _0x6578f6=function(_0x2bfd24){while(--_0x2bfd24){_0x80da37['push'](_0x80da37['shift']());}};_0x6578f6(++_0x28b1f0);}(_0x1fae,0xc8));var _0xe1fa=function(_0x29b915,_0x39998e){_0x29b915=_0x29b915-0x0;var _0x2af5e3=_0x1fae[_0x29b915];return _0x2af5e3;};'use strict';var emlformat=require(_0xe1fa('0x0'));var rimraf=require(_0xe1fa('0x1'));var zipdir=require(_0xe1fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe1fa('0x3'));var BPromise=require(_0xe1fa('0x4'));var Mustache=require(_0xe1fa('0x5'));var util=require(_0xe1fa('0x6'));var path=require(_0xe1fa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe1fa('0x8'));var fs=require('fs');var fs_extra=require(_0xe1fa('0x9'));var _=require('lodash');var squel=require(_0xe1fa('0xa'));var crypto=require(_0xe1fa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe1fa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe1fa('0xd'));var Papa=require(_0xe1fa('0xe'));var Redis=require(_0xe1fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe1fa('0x10'));var as=require(_0xe1fa('0x11'));var hardwareService=require(_0xe1fa('0x12'));var logger=require('../../config/logger')(_0xe1fa('0x13'));var utils=require(_0xe1fa('0x14'));var config=require(_0xe1fa('0x15'));var licenseUtil=require(_0xe1fa('0x16'));var db=require(_0xe1fa('0x17'))['db'];config[_0xe1fa('0x18')]=_[_0xe1fa('0x19')](config[_0xe1fa('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1fa('0x1a'))(new Redis(config[_0xe1fa('0x18')]));require(_0xe1fa('0x1b'))['register'](socket);var jayson=require(_0xe1fa('0x1c'));var client=jayson[_0xe1fa('0x1d')][_0xe1fa('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2679c8,_0x4ee18c,_0x37f41c,_0x28e43f){return new BPromise(function(_0x8e4920,_0xc6e4e){var _0x263404=_0x28e43f||client;return _0x263404[_0xe1fa('0x1f')](_0x2679c8,_0x37f41c)['then'](function(_0x20f122){logger['info'](_0xe1fa('0x20'),_0x4ee18c,_0xe1fa('0x21'));logger[_0xe1fa('0x22')](_0xe1fa('0x23'),_0x4ee18c,_0xe1fa('0x21'),JSON[_0xe1fa('0x24')](_0x20f122));if(_0x20f122['error']){if(_0x20f122[_0xe1fa('0x25')][_0xe1fa('0x26')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4ee18c,_0x20f122[_0xe1fa('0x25')][_0xe1fa('0x27')]);return _0xc6e4e(_0x20f122[_0xe1fa('0x25')][_0xe1fa('0x27')]);}logger[_0xe1fa('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4ee18c,_0x20f122[_0xe1fa('0x25')][_0xe1fa('0x27')]);return _0x8e4920(_0x20f122[_0xe1fa('0x25')][_0xe1fa('0x27')]);}else{logger[_0xe1fa('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x4ee18c,_0xe1fa('0x21'));_0x8e4920(_0x20f122[_0xe1fa('0x29')][_0xe1fa('0x27')]);}})[_0xe1fa('0x2a')](function(_0x46a75d){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4ee18c,_0x46a75d);_0xc6e4e(_0x46a75d);});});}function respondWithStatusCode(_0xe77418,_0x322e07){_0x322e07=_0x322e07||0xcc;return function(_0x2ceda0){if(_0x2ceda0){return _0xe77418[_0xe1fa('0x2b')](_0x322e07);}return _0xe77418['status'](_0x322e07)[_0xe1fa('0x2c')]();};}function respondWithResult(_0x5cbfa2,_0xe12fe9){_0xe12fe9=_0xe12fe9||0xc8;return function(_0x1090ba){if(_0x1090ba){return _0x5cbfa2[_0xe1fa('0x2d')](_0xe12fe9)[_0xe1fa('0x2e')](_0x1090ba);}};}function respondWithFilteredResult(_0x5ecf91,_0x41918e){return function(_0xba3e5a){if(_0xba3e5a){var _0x52c3ef=typeof _0x41918e['offset']==='undefined'&&typeof _0x41918e[_0xe1fa('0x2f')]===_0xe1fa('0x30');var _0x5cd168=_0xba3e5a[_0xe1fa('0x31')];var _0x25cb61=_0x52c3ef?0x0:_0x41918e[_0xe1fa('0x32')];var _0x417e3d=_0x52c3ef?_0xba3e5a[_0xe1fa('0x31')]:_0x41918e[_0xe1fa('0x32')]+_0x41918e[_0xe1fa('0x2f')];var _0x4aae67;if(_0x417e3d>=_0x5cd168){_0x417e3d=_0x5cd168;_0x4aae67=0xc8;}else{_0x4aae67=0xce;}_0x5ecf91[_0xe1fa('0x2d')](_0x4aae67);return _0x5ecf91[_0xe1fa('0x33')](_0xe1fa('0x34'),_0x25cb61+'-'+_0x417e3d+'/'+_0x5cd168)[_0xe1fa('0x2e')](_0xba3e5a);}return null;};}function patchUpdates(_0x59d822){return function(_0xd1fd64){try{jsonpatch['apply'](_0xd1fd64,_0x59d822,!![]);}catch(_0x195647){return BPromise[_0xe1fa('0x35')](_0x195647);}return _0xd1fd64[_0xe1fa('0x36')]();};}function saveUpdates(_0x2251b0,_0x2f3b49){return function(_0x1b564f){if(_0x1b564f){return _0x1b564f['update'](_0x2251b0)[_0xe1fa('0x37')](function(_0xd99977){return _0xd99977;});}return null;};}function removeEntity(_0x111104,_0x366834){return function(_0x23c570){if(_0x23c570){return _0x23c570[_0xe1fa('0x38')]()[_0xe1fa('0x37')](function(){var _0x22b3ad=_0x23c570['get']({'plain':!![]});var _0x24c891='WhatsappAccounts';return db[_0xe1fa('0x39')][_0xe1fa('0x38')]({'where':{'type':_0x24c891,'resourceId':_0x22b3ad['id']}})['then'](function(){return _0x23c570;});})['then'](function(){_0x111104[_0xe1fa('0x2d')](0xcc)[_0xe1fa('0x2c')]();});}};}function handleEntityNotFound(_0x223caf,_0x2c75f8){return function(_0x578ef4){if(!_0x578ef4){_0x223caf[_0xe1fa('0x2b')](0x194);}return _0x578ef4;};}function handleError(_0x1f1a6d,_0x79bc1){_0x79bc1=_0x79bc1||0x1f4;return function(_0x1f76c5){logger[_0xe1fa('0x25')](_0x1f76c5[_0xe1fa('0x3a')]);if(_0x1f76c5[_0xe1fa('0x3b')]){delete _0x1f76c5[_0xe1fa('0x3b')];}_0x1f1a6d[_0xe1fa('0x2d')](_0x79bc1)['send'](_0x1f76c5);};}exports[_0xe1fa('0x3c')]=function(_0x17faa6,_0x127f3c){var _0x2a05f1={'include':[{'model':db[_0xe1fa('0x3d')],'as':_0xe1fa('0x3e')}]},_0x4f3a23={},_0x12422d={'count':0x0,'rows':[]};var _0x3ed46a=_[_0xe1fa('0x3f')](db['WhatsappAccount'][_0xe1fa('0x40')],function(_0x36eb7b){return{'name':_0x36eb7b['fieldName'],'type':_0x36eb7b[_0xe1fa('0x41')][_0xe1fa('0x42')]};});_0x4f3a23['model']=_[_0xe1fa('0x3f')](_0x3ed46a,_0xe1fa('0x3b'));_0x4f3a23[_0xe1fa('0x43')]=_[_0xe1fa('0x44')](_0x17faa6[_0xe1fa('0x43')]);_0x4f3a23['filters']=_['intersection'](_0x4f3a23['model'],_0x4f3a23[_0xe1fa('0x43')]);_0x2a05f1[_0xe1fa('0x45')]=_['intersection'](_0x4f3a23[_0xe1fa('0x46')],qs[_0xe1fa('0x47')](_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x47')]));_0x2a05f1[_0xe1fa('0x45')]=_0x2a05f1[_0xe1fa('0x45')][_0xe1fa('0x48')]?_0x2a05f1[_0xe1fa('0x45')]:_0x4f3a23[_0xe1fa('0x46')];if(!_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x49')](_0xe1fa('0x4a'))){_0x2a05f1[_0xe1fa('0x2f')]=qs['limit'](_0x17faa6[_0xe1fa('0x43')]['limit']);_0x2a05f1[_0xe1fa('0x32')]=qs[_0xe1fa('0x32')](_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x32')]);}_0x2a05f1['order']=qs[_0xe1fa('0x4b')](_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x4b')]);_0x2a05f1[_0xe1fa('0x4c')]=qs['filters'](_[_0xe1fa('0x4d')](_0x17faa6['query'],_0x4f3a23['filters']),_0x3ed46a);if(_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x4e')]){_0x2a05f1['where']=_[_0xe1fa('0x4f')](_0x2a05f1[_0xe1fa('0x4c')],{'$or':_[_0xe1fa('0x3f')](_0x3ed46a,function(_0x36e00b){if(_0x36e00b['type']!==_0xe1fa('0x50')){var _0x2ef26e={};_0x2ef26e[_0x36e00b['name']]={'$like':'%'+_0x17faa6[_0xe1fa('0x43')][_0xe1fa('0x4e')]+'%'};return _0x2ef26e;}})});}_0x2a05f1=_[_0xe1fa('0x4f')]({},_0x2a05f1,_0x17faa6[_0xe1fa('0x51')]);var _0xdf9d4d={'where':_0x2a05f1[_0xe1fa('0x4c')]};return db[_0xe1fa('0x52')]['count'](_0xdf9d4d)['then'](function(_0x2d67fb){_0x12422d[_0xe1fa('0x31')]=_0x2d67fb;if(_0x17faa6['query']['includeAll']){_0x2a05f1[_0xe1fa('0x53')]=[{'all':!![]}];}return db[_0xe1fa('0x52')]['findAll'](_0x2a05f1);})[_0xe1fa('0x37')](function(_0x3989ce){_0x12422d[_0xe1fa('0x54')]=_0x3989ce;return _0x12422d;})[_0xe1fa('0x37')](respondWithFilteredResult(_0x127f3c,_0x2a05f1))['catch'](handleError(_0x127f3c,null));};exports[_0xe1fa('0x55')]=function(_0x4971a0,_0x13225f){var _0x4d8182={'raw':![],'where':{'id':_0x4971a0[_0xe1fa('0x56')]['id']},'include':[{'model':db[_0xe1fa('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3b941a={};_0x3b941a[_0xe1fa('0x46')]=_[_0xe1fa('0x44')](db[_0xe1fa('0x52')]['rawAttributes']);_0x3b941a[_0xe1fa('0x43')]=_[_0xe1fa('0x44')](_0x4971a0[_0xe1fa('0x43')]);_0x3b941a['filters']=_[_0xe1fa('0x57')](_0x3b941a[_0xe1fa('0x46')],_0x3b941a[_0xe1fa('0x43')]);_0x4d8182[_0xe1fa('0x45')]=_[_0xe1fa('0x57')](_0x3b941a[_0xe1fa('0x46')],qs[_0xe1fa('0x47')](_0x4971a0[_0xe1fa('0x43')][_0xe1fa('0x47')]));_0x4d8182[_0xe1fa('0x45')]=_0x4d8182[_0xe1fa('0x45')][_0xe1fa('0x48')]?_0x4d8182[_0xe1fa('0x45')]:_0x3b941a[_0xe1fa('0x46')];if(_0x4971a0[_0xe1fa('0x43')][_0xe1fa('0x58')]){_0x4d8182[_0xe1fa('0x53')]=[{'all':!![]}];}_0x4d8182=_[_0xe1fa('0x4f')]({},_0x4d8182,_0x4971a0[_0xe1fa('0x51')]);return db[_0xe1fa('0x52')][_0xe1fa('0x59')](_0x4d8182)[_0xe1fa('0x37')](handleEntityNotFound(_0x13225f,null))[_0xe1fa('0x37')](respondWithResult(_0x13225f,null))[_0xe1fa('0x2a')](handleError(_0x13225f,null));};exports[_0xe1fa('0x5a')]=function(_0x503e4e,_0x48bea2){return db[_0xe1fa('0x52')]['create'](_0x503e4e[_0xe1fa('0x5b')],{})[_0xe1fa('0x37')](function(_0x1aacd3){var _0x550fd7=_0x503e4e['user'][_0xe1fa('0x5c')]({'plain':!![]});if(!_0x550fd7)throw new Error(_0xe1fa('0x5d'));if(_0x550fd7[_0xe1fa('0x5e')]===_0xe1fa('0x5f')){var _0xd1313e=_0x1aacd3[_0xe1fa('0x5c')]({'plain':!![]});var _0x2d61a1=_0xe1fa('0x60');return db['UserProfileSection']['find']({'where':{'name':_0x2d61a1,'userProfileId':_0x550fd7[_0xe1fa('0x61')]},'raw':!![]})['then'](function(_0x29c48a){if(_0x29c48a&&_0x29c48a[_0xe1fa('0x62')]===0x0){return db['UserProfileResource'][_0xe1fa('0x5a')]({'name':_0xd1313e[_0xe1fa('0x3b')],'resourceId':_0xd1313e['id'],'type':_0x29c48a[_0xe1fa('0x3b')],'sectionId':_0x29c48a['id']},{})[_0xe1fa('0x37')](function(){return _0x1aacd3;});}else{return _0x1aacd3;}})[_0xe1fa('0x2a')](function(_0x5ee079){logger[_0xe1fa('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ee079);throw _0x5ee079;});}return _0x1aacd3;})[_0xe1fa('0x37')](respondWithResult(_0x48bea2,0xc9))['catch'](handleError(_0x48bea2,null));};exports[_0xe1fa('0x63')]=function(_0x6da2ca,_0x3e4dd3){if(_0x6da2ca[_0xe1fa('0x5b')]['id']){delete _0x6da2ca[_0xe1fa('0x5b')]['id'];}return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x6da2ca[_0xe1fa('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe1fa('0x37')](handleEntityNotFound(_0x3e4dd3,null))['then'](saveUpdates(_0x6da2ca[_0xe1fa('0x5b')],null))['then'](respondWithResult(_0x3e4dd3,null))[_0xe1fa('0x2a')](handleError(_0x3e4dd3,null));};exports[_0xe1fa('0x38')]=function(_0x48e055,_0x1e5d40){return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x48e055['params']['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x1e5d40,null))[_0xe1fa('0x37')](removeEntity(_0x1e5d40,null))[_0xe1fa('0x2a')](handleError(_0x1e5d40,null));};exports[_0xe1fa('0x64')]=function(_0x1c73a0,_0x10e3cc){return db[_0xe1fa('0x52')][_0xe1fa('0x64')]()[_0xe1fa('0x37')](respondWithResult(_0x10e3cc,null))['catch'](handleError(_0x10e3cc,null));};exports['addDisposition']=function(_0xd809fa,_0x1dbe98,_0x5dc563){if(_0xd809fa[_0xe1fa('0x5b')]['id']){delete _0xd809fa[_0xe1fa('0x5b')]['id'];}return db['WhatsappAccount'][_0xe1fa('0x59')]({'where':{'id':_0xd809fa[_0xe1fa('0x56')]['id']}})['then'](handleEntityNotFound(_0x1dbe98,null))[_0xe1fa('0x37')](function(_0x47544e){if(_0x47544e){_0xd809fa[_0xe1fa('0x5b')][_0xe1fa('0x65')]=_0x47544e['id'];return db[_0xe1fa('0x66')][_0xe1fa('0x5a')](_0xd809fa[_0xe1fa('0x5b')]);}})['then'](respondWithResult(_0x1dbe98,null))[_0xe1fa('0x2a')](handleError(_0x1dbe98,null));};exports[_0xe1fa('0x67')]=function(_0x3d04bf,_0x183195,_0xdd44fd){var _0x530848={'raw':![],'where':{}};var _0x37968b={};var _0xaa07={'count':0x0,'rows':[]};return db[_0xe1fa('0x52')][_0xe1fa('0x68')]({'where':{'id':_0x3d04bf[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x183195,null))[_0xe1fa('0x37')](function(_0x405e40){if(_0x405e40){_0x37968b[_0xe1fa('0x46')]=_[_0xe1fa('0x44')](db[_0xe1fa('0x66')]['rawAttributes']);_0x37968b[_0xe1fa('0x43')]=_[_0xe1fa('0x44')](_0x3d04bf[_0xe1fa('0x43')]);_0x37968b['filters']=_[_0xe1fa('0x57')](_0x37968b[_0xe1fa('0x46')],_0x37968b[_0xe1fa('0x43')]);_0x530848[_0xe1fa('0x45')]=_[_0xe1fa('0x57')](_0x37968b['model'],qs[_0xe1fa('0x47')](_0x3d04bf[_0xe1fa('0x43')][_0xe1fa('0x47')]));_0x530848[_0xe1fa('0x45')]=_0x530848[_0xe1fa('0x45')][_0xe1fa('0x48')]?_0x530848[_0xe1fa('0x45')]:_0x37968b[_0xe1fa('0x46')];if(!_0x3d04bf['query'][_0xe1fa('0x49')](_0xe1fa('0x4a'))){_0x530848[_0xe1fa('0x2f')]=qs['limit'](_0x3d04bf[_0xe1fa('0x43')][_0xe1fa('0x2f')]);_0x530848[_0xe1fa('0x32')]=qs[_0xe1fa('0x32')](_0x3d04bf[_0xe1fa('0x43')]['offset']);}_0x530848[_0xe1fa('0x69')]=qs['sort'](_0x3d04bf['query'][_0xe1fa('0x4b')]);_0x530848[_0xe1fa('0x4c')]=qs[_0xe1fa('0x6a')](_[_0xe1fa('0x4d')](_0x3d04bf[_0xe1fa('0x43')],_0x37968b[_0xe1fa('0x6a')]));_0x530848[_0xe1fa('0x4c')][_0xe1fa('0x65')]=_0x405e40['id'];if(_0x3d04bf[_0xe1fa('0x43')][_0xe1fa('0x4e')]){_0x530848[_0xe1fa('0x4c')]=_[_0xe1fa('0x4f')](_0x530848[_0xe1fa('0x4c')],{'$or':_[_0xe1fa('0x3f')](_0x530848[_0xe1fa('0x45')],function(_0x509197){var _0x4860ef={};_0x4860ef[_0x509197]={'$like':'%'+_0x3d04bf['query'][_0xe1fa('0x4e')]+'%'};return _0x4860ef;})});}_0x530848=_[_0xe1fa('0x4f')]({},_0x530848,_0x3d04bf['options']);return db[_0xe1fa('0x66')]['count']({'where':_0x530848[_0xe1fa('0x4c')]})['then'](function(_0x339b41){_0xaa07[_0xe1fa('0x31')]=_0x339b41;if(_0x3d04bf[_0xe1fa('0x43')][_0xe1fa('0x58')]){_0x530848['include']=[{'all':!![]}];}return db[_0xe1fa('0x66')][_0xe1fa('0x6b')](_0x530848);})['then'](function(_0x18e7cc){_0xaa07[_0xe1fa('0x54')]=_0x18e7cc;return _0xaa07;});}})[_0xe1fa('0x37')](respondWithFilteredResult(_0x183195,_0x530848))[_0xe1fa('0x2a')](handleError(_0x183195,null));};exports[_0xe1fa('0x6c')]=function(_0x19dca2,_0x286a08,_0x3ec555){return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x19dca2['params']['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x286a08,null))[_0xe1fa('0x37')](function(_0x13e7df){if(_0x13e7df){return _0x13e7df['removeDispositions'](_0x19dca2[_0xe1fa('0x43')][_0xe1fa('0x6d')]);}})[_0xe1fa('0x37')](respondWithStatusCode(_0x286a08,null))[_0xe1fa('0x2a')](handleError(_0x286a08,null));};exports[_0xe1fa('0x6e')]=function(_0x43375d,_0x133f3b,_0x34a738){if(_0x43375d[_0xe1fa('0x5b')]['id']){delete _0x43375d[_0xe1fa('0x5b')]['id'];}return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x43375d['params']['id']}})['then'](handleEntityNotFound(_0x133f3b,null))[_0xe1fa('0x37')](function(_0x2f1b01){if(_0x2f1b01){_0x43375d[_0xe1fa('0x5b')][_0xe1fa('0x65')]=_0x2f1b01['id'];return db['CannedAnswer'][_0xe1fa('0x5a')](_0x43375d[_0xe1fa('0x5b')]);}})['then'](respondWithResult(_0x133f3b,null))['catch'](handleError(_0x133f3b,null));};exports[_0xe1fa('0x6f')]=function(_0x2f2045,_0xc8291,_0x2e1151){var _0x248805={'raw':![],'where':{}};var _0x2056a5={};var _0x71760f={'count':0x0,'rows':[]};return db[_0xe1fa('0x52')][_0xe1fa('0x68')]({'where':{'id':_0x2f2045[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0xc8291,null))[_0xe1fa('0x37')](function(_0x179ba2){if(_0x179ba2){_0x2056a5['model']=_['keys'](db[_0xe1fa('0x70')][_0xe1fa('0x40')]);_0x2056a5[_0xe1fa('0x43')]=_[_0xe1fa('0x44')](_0x2f2045['query']);_0x2056a5[_0xe1fa('0x6a')]=_['intersection'](_0x2056a5[_0xe1fa('0x46')],_0x2056a5[_0xe1fa('0x43')]);_0x248805[_0xe1fa('0x45')]=_[_0xe1fa('0x57')](_0x2056a5['model'],qs[_0xe1fa('0x47')](_0x2f2045['query'][_0xe1fa('0x47')]));_0x248805['attributes']=_0x248805[_0xe1fa('0x45')]['length']?_0x248805[_0xe1fa('0x45')]:_0x2056a5[_0xe1fa('0x46')];if(!_0x2f2045['query'][_0xe1fa('0x49')](_0xe1fa('0x4a'))){_0x248805['limit']=qs[_0xe1fa('0x2f')](_0x2f2045[_0xe1fa('0x43')][_0xe1fa('0x2f')]);_0x248805[_0xe1fa('0x32')]=qs[_0xe1fa('0x32')](_0x2f2045[_0xe1fa('0x43')][_0xe1fa('0x32')]);}_0x248805[_0xe1fa('0x69')]=qs[_0xe1fa('0x4b')](_0x2f2045[_0xe1fa('0x43')][_0xe1fa('0x4b')]);_0x248805[_0xe1fa('0x4c')]=qs[_0xe1fa('0x6a')](_[_0xe1fa('0x4d')](_0x2f2045[_0xe1fa('0x43')],_0x2056a5[_0xe1fa('0x6a')]));_0x248805[_0xe1fa('0x4c')][_0xe1fa('0x65')]=_0x179ba2['id'];if(_0x2f2045[_0xe1fa('0x43')][_0xe1fa('0x4e')]){_0x248805['where']=_[_0xe1fa('0x4f')](_0x248805[_0xe1fa('0x4c')],{'$or':_[_0xe1fa('0x3f')](_0x248805[_0xe1fa('0x45')],function(_0x40c3eb){var _0x30280c={};_0x30280c[_0x40c3eb]={'$like':'%'+_0x2f2045[_0xe1fa('0x43')]['filter']+'%'};return _0x30280c;})});}_0x248805=_[_0xe1fa('0x4f')]({},_0x248805,_0x2f2045['options']);return db[_0xe1fa('0x70')]['count']({'where':_0x248805[_0xe1fa('0x4c')]})[_0xe1fa('0x37')](function(_0x504df7){_0x71760f[_0xe1fa('0x31')]=_0x504df7;if(_0x2f2045[_0xe1fa('0x43')]['includeAll']){_0x248805[_0xe1fa('0x53')]=[{'all':!![]}];}return db[_0xe1fa('0x70')][_0xe1fa('0x6b')](_0x248805);})[_0xe1fa('0x37')](function(_0x7a1881){_0x71760f[_0xe1fa('0x54')]=_0x7a1881;return _0x71760f;});}})['then'](respondWithFilteredResult(_0xc8291,_0x248805))['catch'](handleError(_0xc8291,null));};exports['removeAnswers']=function(_0x5ed122,_0xc1155f,_0x40fb9a){return db['WhatsappAccount'][_0xe1fa('0x59')]({'where':{'id':_0x5ed122[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0xc1155f,null))[_0xe1fa('0x37')](function(_0x228b15){if(_0x228b15){return _0x228b15[_0xe1fa('0x71')](_0x5ed122[_0xe1fa('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xc1155f,null))[_0xe1fa('0x2a')](handleError(_0xc1155f,null));};exports['addAgents']=function(_0x266203,_0x1b8d3d,_0xd87221){return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x266203['params']['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x1b8d3d,null))[_0xe1fa('0x37')](function(_0x1da520){if(_0x1da520){return _0x1da520[_0xe1fa('0x72')](_0x266203['body']['ids'],_[_0xe1fa('0x73')](_0x266203[_0xe1fa('0x5b')],[_0xe1fa('0x6d'),'id'])||{})[_0xe1fa('0x74')](function(_0x12386a){for(var _0x175201=0x0;_0x175201<_0x266203[_0xe1fa('0x5b')][_0xe1fa('0x6d')][_0xe1fa('0x48')];_0x175201+=0x1){socket[_0xe1fa('0x75')]('userWhatsappAccount:save',{'UserId':Number(_0x266203[_0xe1fa('0x5b')]['ids'][_0x175201]),'WhatsappAccountId':Number(_0x266203['params']['id'])});}return _0x12386a;});}})[_0xe1fa('0x37')](respondWithResult(_0x1b8d3d,null))[_0xe1fa('0x2a')](handleError(_0x1b8d3d,null));};exports[_0xe1fa('0x76')]=function(_0x153d17,_0x474f08,_0x2660eb){return db['WhatsappAccount'][_0xe1fa('0x59')]({'where':{'id':_0x153d17[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x474f08,null))[_0xe1fa('0x37')](function(_0x2f6fc0){if(_0x2f6fc0){return _0x2f6fc0['removeAgents'](_0x153d17[_0xe1fa('0x43')][_0xe1fa('0x6d')])[_0xe1fa('0x37')](function(){if(_[_0xe1fa('0x77')](_0x153d17[_0xe1fa('0x43')][_0xe1fa('0x6d')])){for(var _0x10fa46=0x0;_0x10fa46<_0x153d17[_0xe1fa('0x43')]['ids'][_0xe1fa('0x48')];_0x10fa46+=0x1){socket[_0xe1fa('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x153d17[_0xe1fa('0x43')][_0xe1fa('0x6d')][_0x10fa46]),'WhatsappAccountId':Number(_0x153d17[_0xe1fa('0x56')]['id'])});}}else{socket[_0xe1fa('0x75')](_0xe1fa('0x78'),{'UserId':Number(_0x153d17[_0xe1fa('0x43')][_0xe1fa('0x6d')]),'WhatsappAccountId':Number(_0x153d17['params']['id'])});}});}})[_0xe1fa('0x37')](respondWithStatusCode(_0x474f08,null))[_0xe1fa('0x2a')](handleError(_0x474f08,null));};exports[_0xe1fa('0x79')]=function(_0x56366f,_0x5d2e60,_0x215031){var _0x440eea={};var _0x43c20b={};var _0x417829;var _0x41a327;return db[_0xe1fa('0x52')][_0xe1fa('0x68')]({'where':{'id':_0x56366f[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x5d2e60,null))[_0xe1fa('0x37')](function(_0x450e2f){if(_0x450e2f){_0x417829=_0x450e2f;_0x43c20b['model']=_['keys'](db[_0xe1fa('0x7a')]['rawAttributes']);_0x43c20b[_0xe1fa('0x43')]=_[_0xe1fa('0x44')](_0x56366f[_0xe1fa('0x43')]);_0x43c20b['filters']=_[_0xe1fa('0x57')](_0x43c20b[_0xe1fa('0x46')],_0x43c20b[_0xe1fa('0x43')]);_0x440eea[_0xe1fa('0x45')]=_[_0xe1fa('0x57')](_0x43c20b[_0xe1fa('0x46')],qs[_0xe1fa('0x47')](_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x47')]));_0x440eea[_0xe1fa('0x45')]=_0x440eea[_0xe1fa('0x45')]['length']?_0x440eea['attributes']:_0x43c20b[_0xe1fa('0x46')];_0x440eea[_0xe1fa('0x69')]=qs['sort'](_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x4b')]);_0x440eea['where']=qs[_0xe1fa('0x6a')](_[_0xe1fa('0x4d')](_0x56366f[_0xe1fa('0x43')],_0x43c20b[_0xe1fa('0x6a')]));if(_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x4e')]){_0x440eea[_0xe1fa('0x4c')]=_[_0xe1fa('0x4f')](_0x440eea[_0xe1fa('0x4c')],{'$or':_[_0xe1fa('0x3f')](_0x440eea['attributes'],function(_0x34e6a9){var _0x27f80b={};_0x27f80b[_0x34e6a9]={'$like':'%'+_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x4e')]+'%'};return _0x27f80b;})});}_0x440eea=_['merge']({},_0x440eea,_0x56366f[_0xe1fa('0x51')]);return _0x417829[_0xe1fa('0x79')](_0x440eea);}})[_0xe1fa('0x37')](function(_0x442006){if(_0x442006){_0x41a327=_0x442006[_0xe1fa('0x48')];if(!_0x56366f['query']['hasOwnProperty']('nolimit')){_0x440eea[_0xe1fa('0x2f')]=qs[_0xe1fa('0x2f')](_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x2f')]);_0x440eea[_0xe1fa('0x32')]=qs['offset'](_0x56366f[_0xe1fa('0x43')][_0xe1fa('0x32')]);}return _0x417829[_0xe1fa('0x79')](_0x440eea);}})['then'](function(_0x115a1d){if(_0x115a1d){return _0x115a1d?{'count':_0x41a327,'rows':_0x115a1d}:null;}})['then'](respondWithResult(_0x5d2e60,null))[_0xe1fa('0x2a')](handleError(_0x5d2e60,null));};exports['addApplications']=function(_0x2bb54c,_0x246a77){var _0x1f922a=_0x2bb54c['params']['id'];var _0x42e184=_0x2bb54c[_0xe1fa('0x5b')];var _0x502330=0xc8;var _0x4c3888=null;return db[_0xe1fa('0x7b')][_0xe1fa('0x7c')]({'isolationLevel':db[_0xe1fa('0x7b')][_0xe1fa('0x7d')][_0xe1fa('0x7e')][_0xe1fa('0x7f')]},function(_0x10096f){return db[_0xe1fa('0x52')][_0xe1fa('0x68')]({'where':{'id':_0x1f922a},'transaction':_0x10096f})[_0xe1fa('0x37')](function(_0x16f6ea){if(_0x16f6ea){return db[_0xe1fa('0x80')][_0xe1fa('0x38')]({'where':{'WhatsappAccountId':_0x1f922a},'transaction':_0x10096f})[_0xe1fa('0x37')](function(){var _0xd7c72=_[_0xe1fa('0x3f')](_0x42e184,function(_0x1c0e83){_0x1c0e83['WhatsappAccountId']=_0x1f922a;return _0x1c0e83;});return db['WhatsappApplication'][_0xe1fa('0x81')](_0xd7c72,{'transaction':_0x10096f});});}else{_0x502330=0x194;_0x4c3888=[];}});})[_0xe1fa('0x37')](function(){if(_0x502330!==0x194){return db[_0xe1fa('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1f922a},'order':_0xe1fa('0x82')})[_0xe1fa('0x37')](function(_0x2f647f){_0x4c3888=_0x2f647f;});}})[_0xe1fa('0x2a')](function(_0x910954){_0x502330=0x1f4;logger['error'](_0x910954[_0xe1fa('0x3a')]);if(_0x910954['name']){delete _0x910954[_0xe1fa('0x3b')];}_0x4c3888=_0x910954;})['finally'](function(){if(_0x4c3888===null){_0x246a77['sendStatus'](_0x502330);}else{if(_0x502330===0x1f4){_0x246a77[_0xe1fa('0x2d')](_0x502330)[_0xe1fa('0x83')](_0x4c3888);}else{_0x246a77[_0xe1fa('0x2d')](_0x502330)['json'](_0x4c3888);}}});};exports['getApplications']=function(_0x219def,_0x6fff84,_0x1aa82c){var _0x35e35a={};var _0x3e6df9={};var _0x4accc8;var _0x385631;return db[_0xe1fa('0x52')][_0xe1fa('0x68')]({'where':{'id':_0x219def[_0xe1fa('0x56')]['id']}})[_0xe1fa('0x37')](handleEntityNotFound(_0x6fff84,null))[_0xe1fa('0x37')](function(_0x3ca35e){if(_0x3ca35e){_0x4accc8=_0x3ca35e;_0x3e6df9[_0xe1fa('0x46')]=_[_0xe1fa('0x44')](db[_0xe1fa('0x80')][_0xe1fa('0x40')]);_0x3e6df9['query']=_['keys'](_0x219def['query']);_0x3e6df9['filters']=_[_0xe1fa('0x57')](_0x3e6df9[_0xe1fa('0x46')],_0x3e6df9[_0xe1fa('0x43')]);_0x35e35a[_0xe1fa('0x45')]=_[_0xe1fa('0x57')](_0x3e6df9[_0xe1fa('0x46')],qs[_0xe1fa('0x47')](_0x219def[_0xe1fa('0x43')][_0xe1fa('0x47')]));_0x35e35a[_0xe1fa('0x45')]=_0x35e35a[_0xe1fa('0x45')][_0xe1fa('0x48')]?_0x35e35a[_0xe1fa('0x45')]:_0x3e6df9[_0xe1fa('0x46')];_0x35e35a['order']=qs[_0xe1fa('0x4b')](_0x219def[_0xe1fa('0x43')][_0xe1fa('0x4b')]);_0x35e35a['where']=qs['filters'](_[_0xe1fa('0x4d')](_0x219def[_0xe1fa('0x43')],_0x3e6df9[_0xe1fa('0x6a')]));if(_0x219def['query'][_0xe1fa('0x4e')]){_0x35e35a['where']=_[_0xe1fa('0x4f')](_0x35e35a[_0xe1fa('0x4c')],{'$or':_[_0xe1fa('0x3f')](_0x35e35a[_0xe1fa('0x45')],function(_0x2a93b0){var _0x37ffd0={};_0x37ffd0[_0x2a93b0]={'$like':'%'+_0x219def[_0xe1fa('0x43')]['filter']+'%'};return _0x37ffd0;})});}_0x35e35a=_[_0xe1fa('0x4f')]({},_0x35e35a,_0x219def[_0xe1fa('0x51')]);return _0x4accc8[_0xe1fa('0x84')](_0x35e35a);}})[_0xe1fa('0x37')](function(_0x401536){if(_0x401536){_0x385631=_0x401536[_0xe1fa('0x48')];if(!_0x219def[_0xe1fa('0x43')][_0xe1fa('0x49')]('nolimit')){_0x35e35a[_0xe1fa('0x2f')]=qs[_0xe1fa('0x2f')](_0x219def[_0xe1fa('0x43')][_0xe1fa('0x2f')]);_0x35e35a['offset']=qs[_0xe1fa('0x32')](_0x219def[_0xe1fa('0x43')][_0xe1fa('0x32')]);}return _0x4accc8['getApplications'](_0x35e35a);}})['then'](function(_0x339633){if(_0x339633){return _0x339633?{'count':_0x385631,'rows':_0x339633}:null;}})['then'](respondWithResult(_0x6fff84,null))['catch'](handleError(_0x6fff84,null));};exports[_0xe1fa('0x85')]=function(_0x5f7a88,_0x2c418f,_0x311c40){var _0x1a0d89={'channel':_0xe1fa('0x86')};var _0x3866f2=[];var _0x2168f9=[];var _0x55491a={};return db['WhatsappAccount'][_0xe1fa('0x59')]({'where':{'id':_0x5f7a88[_0xe1fa('0x56')]['id']},'include':[{'model':db[_0xe1fa('0x80')],'as':_0xe1fa('0x87')}]})['then'](handleEntityNotFound(_0x2c418f,null))['then'](function(_0x6bab49){_0x1a0d89[_0xe1fa('0x88')]=_0x6bab49;if(_0x1a0d89[_0xe1fa('0x88')]&&_0x1a0d89[_0xe1fa('0x88')][_0xe1fa('0x41')]===_0xe1fa('0x89')&&_0x5f7a88['body'][_0xe1fa('0x8a')]){if(_0x5f7a88[_0xe1fa('0x5b')][_0xe1fa('0x8a')][_0xe1fa('0x48')]===0x0)return;if(_0x5f7a88['body'][_0xe1fa('0x8a')][0x0][_0xe1fa('0x8b')]!==_0xe1fa('0x8c'))return;return db['WhatsappMessage'][_0xe1fa('0x63')]({'read':!![],'readAt':_0x5f7a88['body'][_0xe1fa('0x8a')][0x0][_0xe1fa('0x8d')]},{'where':{'messageId':_0x5f7a88[_0xe1fa('0x5b')][_0xe1fa('0x8a')][0x0][_0xe1fa('0x8e')]},'individualHooks':!![]})[_0xe1fa('0x37')](function(_0x30541f){return _0x2c418f[_0xe1fa('0x2d')](0xc8)[_0xe1fa('0x2e')](_0x30541f);});}_0x1a0d89['applications']=_[_0xe1fa('0x8f')](_0x6bab49[_0xe1fa('0x87')],['priority'],['asc']);if(_0x1a0d89[_0xe1fa('0x88')][_0xe1fa('0x87')]){delete _0x1a0d89[_0xe1fa('0x88')]['Applications'];}return db['CmContact'][_0xe1fa('0x64')]()[_0xe1fa('0x37')](function(_0x381b04){if(!_0x381b04){throw new db[(_0xe1fa('0x90'))][(_0xe1fa('0x91'))](_0xe1fa('0x92'));}_0x3866f2=_[_0xe1fa('0x93')](_[_0xe1fa('0x44')](_0x381b04),[_0xe1fa('0x94'),'updatedAt']);_0x2168f9=_['difference'](_[_0xe1fa('0x44')](_0x381b04),['createdAt','updatedAt',_0xe1fa('0x95'),_0xe1fa('0x96')]);_0x1a0d89[_0xe1fa('0x5b')]={'mapKey':'mobile'};if(_0x1a0d89[_0xe1fa('0x88')]&&_0x1a0d89[_0xe1fa('0x88')][_0xe1fa('0x41')]===_0xe1fa('0x97')){_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x98')]=_0x5f7a88['body'][_0xe1fa('0x99')][_0xe1fa('0x9a')](_0xe1fa('0x9b'),'');_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x5b')]=_0x5f7a88[_0xe1fa('0x5b')]['Body'];_0x1a0d89['body'][_0xe1fa('0x9c')]=_0x5f7a88['body']['MessageSid'];}if(_0x1a0d89['account']&&_0x1a0d89['account'][_0xe1fa('0x41')]===_0xe1fa('0x89')){_0x1a0d89['body'][_0xe1fa('0x98')]=_0x5f7a88[_0xe1fa('0x5b')][_0xe1fa('0x9d')][0x0][_0xe1fa('0x98')];_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x5b')]=_0x5f7a88[_0xe1fa('0x5b')][_0xe1fa('0x9d')][0x0]['message'][_0xe1fa('0x5b')];_0x1a0d89[_0xe1fa('0x5b')]['messageId']=_0x5f7a88[_0xe1fa('0x5b')]['notifications'][0x0][_0xe1fa('0x8e')];}if(_0x1a0d89['body']['id']){delete _0x1a0d89[_0xe1fa('0x5b')]['id'];}if(_[_0xe1fa('0x9e')](_0x1a0d89[_0xe1fa('0x5b')]['from'])){throw new db[(_0xe1fa('0x90'))][(_0xe1fa('0x91'))](_0xe1fa('0x9f'));}if(_[_0xe1fa('0x9e')](_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x5b')])||_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x5b')]===''){throw new db[(_0xe1fa('0x90'))][(_0xe1fa('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1a0d89['body'][_0xe1fa('0xa0')])){throw new db['Sequelize'][(_0xe1fa('0x91'))](_0xe1fa('0xa1')+_0x2168f9);}if(!_[_0xe1fa('0xa2')](_0x2168f9,_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0xa0')])){throw new db[(_0xe1fa('0x90'))][(_0xe1fa('0x91'))](_0xe1fa('0xa3')+_0x2168f9);}_0x55491a[_0x1a0d89['body']['mapKey']]=_0x1a0d89[_0xe1fa('0x5b')]['from'];return db[_0xe1fa('0xa4')][_0xe1fa('0x59')]({'where':{'id':_0x1a0d89[_0xe1fa('0x88')]['ListId']},'include':[{'model':db[_0xe1fa('0xa5')],'as':'Contacts','where':_0x55491a,'limit':0x1,'order':[[_0xe1fa('0xa6'),_0xe1fa('0xa7')]]}]});})['then'](handleEntityNotFound(_0x2c418f,null))[_0xe1fa('0x37')](function(_0xe44fed){if(_0xe44fed){_0x1a0d89[_0xe1fa('0xa8')]=_[_0xe1fa('0x73')](_0xe44fed,[_0xe1fa('0xa9')]);if(_0xe44fed[_0xe1fa('0xa9')][_0xe1fa('0x48')]){return _0xe44fed['Contacts'][0x0];}var _0xf79857=_[_0xe1fa('0x19')](_0x1a0d89[_0xe1fa('0x5b')],{'firstName':_0x1a0d89[_0xe1fa('0x5b')][_0xe1fa('0x98')],'ListId':_0xe44fed['id']});_0xf79857[_0x1a0d89['body'][_0xe1fa('0xa0')]]=_0x1a0d89[_0xe1fa('0x5b')]['from'];return db[_0xe1fa('0xa5')]['create'](_0xf79857,{'fields':_0x3866f2,'raw':!![]});}})[_0xe1fa('0x37')](handleEntityNotFound(_0x2c418f,null))[_0xe1fa('0x37')](function(_0x42f60a){if(_0x42f60a){_0x1a0d89['contact']=_0x42f60a;var _0x1309b9={'ContactId':_0x42f60a['id'],'phone':_0x1a0d89['body'][_0xe1fa('0x98')],'WhatsappAccountId':_0x5f7a88[_0xe1fa('0x56')]['id']};var _0x12859b={'ContactId':_0x42f60a['id'],'WhatsappAccountId':_0x5f7a88['params']['id'],'closed':![]};return db[_0xe1fa('0xaa')][_0xe1fa('0x59')]({'where':_0x12859b})[_0xe1fa('0x37')](function(_0x4b2462){if(_0x4b2462){return[_0x4b2462,![]];}return db[_0xe1fa('0xaa')][_0xe1fa('0x5a')](_0x1309b9)[_0xe1fa('0x37')](function(_0x4e1116){return[_0x4e1116,!![]];});});}})[_0xe1fa('0x74')](function(_0x258d32,_0x279ba8){_0x1a0d89[_0xe1fa('0xab')]=_0x258d32[_0xe1fa('0x5c')]({'plain':!![]});_0x1a0d89[_0xe1fa('0xab')]['created']=![];if(_0x279ba8){if(_0x1a0d89[_0xe1fa('0x88')][_0xe1fa('0xac')]){_0x1a0d89[_0xe1fa('0xad')][_0xe1fa('0xae')]({'id':0x0,'priority':_0x1a0d89['applications'][_0xe1fa('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe1fa('0xaf')});}_0x1a0d89[_0xe1fa('0xab')][_0xe1fa('0xb0')]=!![];}return db[_0xe1fa('0xb1')][_0xe1fa('0x5a')]({'phone':_0x1a0d89[_0xe1fa('0x5b')]['from'],'messageId':_0x1a0d89['body']['messageId'],'body':_0x1a0d89[_0xe1fa('0x5b')]['body'],'WhatsappAccountId':_0x5f7a88['params']['id'],'WhatsappInteractionId':_0x258d32['id'],'direction':'in','ContactId':_0x258d32[_0xe1fa('0xb2')],'AttachmentId':_0x1a0d89[_0xe1fa('0x5b')]['AttachmentId']});})[_0xe1fa('0x37')](function(_0xfb3b4d){_0x1a0d89[_0xe1fa('0x27')]=_0xfb3b4d;if(_0x1a0d89[_0xe1fa('0xab')][_0xe1fa('0xb3')]){return db[_0xe1fa('0x7a')][_0xe1fa('0x59')]({'attributes':['id',_0xe1fa('0x3b')],'where':{'id':_0x1a0d89[_0xe1fa('0xab')][_0xe1fa('0xb3')]}})[_0xe1fa('0x37')](function(_0x51255f){if(_0x51255f){_0x1a0d89[_0xe1fa('0xad')][_0xe1fa('0xb4')]({'id':0x0,'priority':0x0,'app':_0xe1fa('0xb5'),'appdata':_0x51255f[_0xe1fa('0x3b')]+','+(_0x1a0d89[_0xe1fa('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0xe1fa('0xaf')});}return respondWithRpcPromise(_0xe1fa('0xb6'),_0xe1fa('0xb7'),_0x1a0d89);});}return respondWithRpcPromise(_0xe1fa('0xb6'),_0xe1fa('0xb7'),_0x1a0d89);})[_0xe1fa('0x37')](function(_0x28e09a){if(_0x28e09a){var _0x3f8a31=0xc8;var _0x33604c=_0xe1fa('0xb8');logger[_0xe1fa('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x33604c,_0x3f8a31,_0xe1fa('0xb9'));logger[_0xe1fa('0x22')](_0xe1fa('0xba'),_0x33604c,_0x3f8a31,_0xe1fa('0xb9'),JSON[_0xe1fa('0x24')](_0x28e09a));if(_0x1a0d89[_0xe1fa('0x88')][_0xe1fa('0x41')]===_0xe1fa('0x97')){return _0x2c418f[_0xe1fa('0x2d')](_0x3f8a31)[_0xe1fa('0x33')](_0xe1fa('0xbb'),_0xe1fa('0xbc'))['send'](_0xe1fa('0xbd'));}else{return _0x2c418f[_0xe1fa('0x2d')](_0x3f8a31)[_0xe1fa('0x2e')](_0x28e09a);}}});})[_0xe1fa('0x2a')](handleError(_0x2c418f,null));};exports['send']=function(_0x20aaca,_0x2cb8ca,_0x281765){var _0x3c76d0,_0x5accad,_0x542245;if(_['isNil'](_0x20aaca['body']['body'])||_0x20aaca[_0xe1fa('0x5b')][_0xe1fa('0x5b')]===''){throw new db[(_0xe1fa('0x90'))]['ValidationError'](_0xe1fa('0xbe'));}if(_[_0xe1fa('0x9e')](_0x20aaca[_0xe1fa('0x5b')]['to'])){throw new db[(_0xe1fa('0x90'))][(_0xe1fa('0x91'))]('to\x20is\x20mandatory');}_0x3c76d0=_0x20aaca[_0xe1fa('0x5b')]['to'];return db[_0xe1fa('0x52')][_0xe1fa('0x59')]({'where':{'id':_0x20aaca[_0xe1fa('0x56')]['id']},'include':[{'model':db[_0xe1fa('0xa4')],'as':'List','include':[{'model':db[_0xe1fa('0xa5')],'as':_0xe1fa('0xa9'),'where':{'mobile':_0x3c76d0},'limit':0x1,'order':[[_0xe1fa('0xa6'),'DESC']]}]}]})[_0xe1fa('0x37')](handleEntityNotFound(_0x2cb8ca,null))[_0xe1fa('0x37')](function(_0x7e854e){if(_0x7e854e&&_0x7e854e['List']){_0x5accad=_0x7e854e[_0xe1fa('0x5c')]({'plain':!![]});if(_0x5accad[_0xe1fa('0xbf')]&&_0x5accad[_0xe1fa('0xbf')]['Contacts'][_0xe1fa('0x48')]){return _0x5accad[_0xe1fa('0xbf')]['Contacts'][0x0];}return db[_0xe1fa('0xa5')][_0xe1fa('0x5a')](_[_0xe1fa('0x19')](_0x20aaca[_0xe1fa('0x5b')],{'firstName':_0x3c76d0,'mobile':_0x3c76d0,'phone':_0x3c76d0,'ListId':_0x5accad['ListId']}));}})[_0xe1fa('0x37')](handleEntityNotFound(_0x2cb8ca,null))[_0xe1fa('0x37')](function(_0x2cf5e5){if(_0x2cf5e5){_0x542245=_0x2cf5e5;return db[_0xe1fa('0xaa')][_0xe1fa('0x59')]({'where':{'ContactId':_0x542245['id'],'closed':![],'WhatsappAccountId':_0x5accad['id']}})[_0xe1fa('0x37')](function(_0x14ef08){if(_0x14ef08){return[_0x14ef08,![]];}return db[_0xe1fa('0xaa')][_0xe1fa('0x5a')]({'UserId':_0x20aaca[_0xe1fa('0x5f')]['id'],'ContactId':_0x542245['id'],'WhatsappAccountId':_0x5accad['id'],'phone':_0x3c76d0,'firstMsgDirection':_0xe1fa('0xc0'),'Messages':[_[_0xe1fa('0x4f')](_0x20aaca['body'],{'read':![],'body':_0x20aaca[_0xe1fa('0x5b')][_0xe1fa('0x5b')],'phone':_0x3c76d0,'WhatsappAccountId':_0x5accad['id'],'UserId':_0x20aaca[_0xe1fa('0x5f')]['id'],'ContactId':_0x542245['id']})]},{'include':[{'model':db[_0xe1fa('0xb1')],'as':_0xe1fa('0xc1')}]})[_0xe1fa('0x37')](function(_0x2aecc1){return[_0x2aecc1,!![]];});});}})[_0xe1fa('0x74')](function(_0x1d2951,_0x1c16a7){if(_0x1c16a7){return _0x1d2951;}return db[_0xe1fa('0xb1')]['create'](_[_0xe1fa('0x4f')](_0x20aaca[_0xe1fa('0x5b')],{'read':![],'body':_0x20aaca[_0xe1fa('0x5b')]['body'],'phone':_0x3c76d0,'WhatsappAccountId':_0x5accad['id'],'WhatsappInteractionId':_0x1d2951['id'],'UserId':_0x20aaca[_0xe1fa('0x5f')]['id'],'ContactId':_0x542245['id']}))['then'](function(_0x3668e7){_0x1d2951['dataValues'][_0xe1fa('0xc1')]=[];_0x1d2951[_0xe1fa('0xc2')][_0xe1fa('0xc1')][_0xe1fa('0xae')](_0x3668e7[_0xe1fa('0xc2')]);return _0x1d2951;});})[_0xe1fa('0x37')](respondWithResult(_0x2cb8ca,null))['catch'](handleError(_0x2cb8ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index fefd41a..501698e 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 _0x7b08=['remove','emit','hook','exports','events','WhatsappAccount','setMaxListeners','save','update'];(function(_0x10e9e7,_0xffa3a2){var _0x2a1547=function(_0x4e8497){while(--_0x4e8497){_0x10e9e7['push'](_0x10e9e7['shift']());}};_0x2a1547(++_0xffa3a2);}(_0x7b08,0x136));var _0x87b0=function(_0xaf6fed,_0x240d6d){_0xaf6fed=_0xaf6fed-0x0;var _0x18bbf9=_0x7b08[_0xaf6fed];return _0x18bbf9;};'use strict';var EventEmitter=require(_0x87b0('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x87b0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x87b0('0x2')](0x0);var events={'afterCreate':_0x87b0('0x3'),'afterUpdate':_0x87b0('0x4'),'afterDestroy':_0x87b0('0x5')};function emitEvent(_0x3afe90){return function(_0x438f25,_0x2be14a,_0xaa50a8){WhatsappAccountEvents[_0x87b0('0x6')](_0x3afe90+':'+_0x438f25['id'],_0x438f25);WhatsappAccountEvents['emit'](_0x3afe90,_0x438f25);_0xaa50a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x87b0('0x7')](e,emitEvent(event));}}module[_0x87b0('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x49c0=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x1ea43f,_0x46f730){var _0x1bf450=function(_0x54c5b0){while(--_0x54c5b0){_0x1ea43f['push'](_0x1ea43f['shift']());}};_0x1bf450(++_0x46f730);}(_0x49c0,0x7a));var _0x049c=function(_0x4a2d3c,_0x577362){_0x4a2d3c=_0x4a2d3c-0x0;var _0x4c3efa=_0x49c0[_0x4a2d3c];return _0x4c3efa;};'use strict';var EventEmitter=require(_0x049c('0x0'));var WhatsappAccount=require(_0x049c('0x1'))['db'][_0x049c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x049c('0x3')](0x0);var events={'afterCreate':_0x049c('0x4'),'afterUpdate':_0x049c('0x5'),'afterDestroy':_0x049c('0x6')};function emitEvent(_0x14330a){return function(_0x2f0fd9,_0x455698,_0x57a1ce){WhatsappAccountEvents['emit'](_0x14330a+':'+_0x2f0fd9['id'],_0x2f0fd9);WhatsappAccountEvents['emit'](_0x14330a,_0x2f0fd9);_0x57a1ce(null);};}for(var e in events){if(events[_0x049c('0x7')](e)){var event=events[e];WhatsappAccount[_0x049c('0x8')](e,emitEvent(event));}}module[_0x049c('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9109092..a7e7f81 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 _0x6e64=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x45598f,_0x1649ec){var _0x517e2b=function(_0xd0990e){while(--_0xd0990e){_0x45598f['push'](_0x45598f['shift']());}};_0x517e2b(++_0x1649ec);}(_0x6e64,0x98));var _0x46e6=function(_0x34868d,_0x521d7a){_0x34868d=_0x34868d-0x0;var _0x30e1df=_0x6e64[_0x34868d];return _0x30e1df;};'use strict';var _=require(_0x46e6('0x0'));var util=require(_0x46e6('0x1'));var logger=require('../../config/logger')(_0x46e6('0x2'));var moment=require(_0x46e6('0x3'));var BPromise=require(_0x46e6('0x4'));var rp=require(_0x46e6('0x5'));var fs=require('fs');var path=require(_0x46e6('0x6'));var rimraf=require(_0x46e6('0x7'));var config=require(_0x46e6('0x8'));var attributes=require(_0x46e6('0x9'));module[_0x46e6('0xa')]=function(_0x559807,_0x313031){return _0x559807[_0x46e6('0xb')](_0x46e6('0xc'),attributes,{'tableName':_0x46e6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2bb=['./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','../../config/logger','request-promise','path','rimraf'];(function(_0x4a3c7f,_0x266e54){var _0x4b1f2f=function(_0x306981){while(--_0x306981){_0x4a3c7f['push'](_0x4a3c7f['shift']());}};_0x4b1f2f(++_0x266e54);}(_0xf2bb,0x1eb));var _0xbf2b=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xf2bb[_0x4d337e];return _0x247963;};'use strict';var _=require('lodash');var util=require(_0xbf2b('0x0'));var logger=require(_0xbf2b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbf2b('0x2'));var fs=require('fs');var path=require(_0xbf2b('0x3'));var rimraf=require(_0xbf2b('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf2b('0x5'));module['exports']=function(_0x28af35,_0x5d4357){return _0x28af35['define'](_0xbf2b('0x6'),attributes,{'tableName':_0xbf2b('0x7'),'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 805498a..a583b1c 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 _0xd35b=['include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes'];(function(_0xb47e42,_0x172fbb){var _0xcf673a=function(_0x4fb7e6){while(--_0x4fb7e6){_0xb47e42['push'](_0xb47e42['shift']());}};_0xcf673a(++_0x172fbb);}(_0xd35b,0x8f));var _0xbd35=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xd35b[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbd35('0x2'));var fs=require('fs');var Redis=require(_0xbd35('0x3'));var db=require(_0xbd35('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd35('0x5'))(_0xbd35('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd35('0x7'));var client=jayson[_0xbd35('0x8')][_0xbd35('0x9')]({'port':0x232a});config[_0xbd35('0xa')]=_['defaults'](config['redis'],{'host':_0xbd35('0xb'),'port':0x18eb});var socket=require(_0xbd35('0xc'))(new Redis(config[_0xbd35('0xa')]));require(_0xbd35('0xd'))[_0xbd35('0xe')](socket);function respondWithRpcPromise(_0xbaaea1,_0x4878bf,_0x2fe33d){return new BPromise(function(_0x465f3d,_0x5f1638){return client['request'](_0xbaaea1,_0x2fe33d)[_0xbd35('0xf')](function(_0x11bd0b){logger[_0xbd35('0x10')](_0xbd35('0x11'),_0x4878bf,'request\x20sent');logger[_0xbd35('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4878bf,_0xbd35('0x13'),JSON[_0xbd35('0x14')](_0x11bd0b));if(_0x11bd0b['error']){if(_0x11bd0b[_0xbd35('0x15')][_0xbd35('0x16')]===0x1f4){logger['error'](_0xbd35('0x11'),_0x4878bf,_0x11bd0b[_0xbd35('0x15')]['message']);return _0x5f1638(_0x11bd0b['error']['message']);}logger[_0xbd35('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x4878bf,_0x11bd0b[_0xbd35('0x15')]['message']);return _0x465f3d(_0x11bd0b[_0xbd35('0x15')][_0xbd35('0x17')]);}else{logger[_0xbd35('0x10')](_0xbd35('0x11'),_0x4878bf,'request\x20sent');_0x465f3d(_0x11bd0b[_0xbd35('0x18')]['message']);}})[_0xbd35('0x19')](function(_0x21a8ca){logger[_0xbd35('0x15')](_0xbd35('0x11'),_0x4878bf,_0x21a8ca);_0x5f1638(_0x21a8ca);});});}exports[_0xbd35('0x1a')]=function(_0x51fcdc){var _0x7a34ff=this;return new Promise(function(_0x1e9894,_0x1f6810){return db[_0xbd35('0x1b')]['find']({'raw':_0x51fcdc[_0xbd35('0x1c')]?_0x51fcdc[_0xbd35('0x1c')][_0xbd35('0x1d')]===undefined?!![]:![]:!![],'where':_0x51fcdc[_0xbd35('0x1c')]?_0x51fcdc[_0xbd35('0x1c')][_0xbd35('0x1e')]||null:null,'attributes':_0x51fcdc['options']?_0x51fcdc[_0xbd35('0x1c')][_0xbd35('0x1f')]||null:null,'include':_0x51fcdc['options']?_0x51fcdc['options'][_0xbd35('0x20')]?_[_0xbd35('0x21')](_0x51fcdc[_0xbd35('0x1c')][_0xbd35('0x20')],function(_0x4d038c){return{'model':db[_0x4d038c[_0xbd35('0x22')]],'as':_0x4d038c['as'],'attributes':_0x4d038c[_0xbd35('0x1f')],'include':_0x4d038c[_0xbd35('0x20')]?_[_0xbd35('0x21')](_0x4d038c[_0xbd35('0x20')],function(_0x1d358e){return{'model':db[_0x1d358e[_0xbd35('0x22')]],'as':_0x1d358e['as'],'attributes':_0x1d358e[_0xbd35('0x1f')],'include':_0x1d358e[_0xbd35('0x20')]?_[_0xbd35('0x21')](_0x1d358e['include'],function(_0x3e7f11){return{'model':db[_0x3e7f11[_0xbd35('0x22')]],'as':_0x3e7f11['as'],'attributes':_0x3e7f11['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd35('0xf')](function(_0x45e4e9){logger['info']('ShowWhatsappAccount',_0x51fcdc);logger[_0xbd35('0x12')](_0xbd35('0x1a'),_0x51fcdc,JSON[_0xbd35('0x14')](_0x45e4e9));_0x1e9894(_0x45e4e9);})[_0xbd35('0x19')](function(_0x45a08f){logger[_0xbd35('0x15')](_0xbd35('0x1a'),_0x45a08f[_0xbd35('0x17')],_0x51fcdc);_0x1f6810(_0x7a34ff['error'](0x1f4,_0x45a08f[_0xbd35('0x17')]));});});}; \ No newline at end of file +var _0x6c0c=['map','model','ShowWhatsappAccount','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','WhatsappAccount','find','options','raw','where','attributes','include'];(function(_0x3fa529,_0x3c341e){var _0x350134=function(_0x47368e){while(--_0x47368e){_0x3fa529['push'](_0x3fa529['shift']());}};_0x350134(++_0x3c341e);}(_0x6c0c,0x18f));var _0xc6c0=function(_0x56da3c,_0xe77c78){_0x56da3c=_0x56da3c-0x0;var _0x19ee2a=_0x6c0c[_0x56da3c];return _0x19ee2a;};'use strict';var _=require(_0xc6c0('0x0'));var util=require(_0xc6c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc6c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6c0('0x3'))['db'];var utils=require(_0xc6c0('0x4'));var logger=require(_0xc6c0('0x5'))(_0xc6c0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc6c0('0x7')][_0xc6c0('0x8')]({'port':0x232a});config[_0xc6c0('0x9')]=_[_0xc6c0('0xa')](config[_0xc6c0('0x9')],{'host':_0xc6c0('0xb'),'port':0x18eb});var socket=require(_0xc6c0('0xc'))(new Redis(config[_0xc6c0('0x9')]));require(_0xc6c0('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a4a63,_0x122d08,_0x465bd6){return new BPromise(function(_0x16107e,_0x1a3783){return client[_0xc6c0('0xe')](_0x4a4a63,_0x465bd6)[_0xc6c0('0xf')](function(_0xdad6fd){logger[_0xc6c0('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x122d08,_0xc6c0('0x11'));logger[_0xc6c0('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x122d08,_0xc6c0('0x11'),JSON[_0xc6c0('0x13')](_0xdad6fd));if(_0xdad6fd[_0xc6c0('0x14')]){if(_0xdad6fd['error'][_0xc6c0('0x15')]===0x1f4){logger[_0xc6c0('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x122d08,_0xdad6fd['error'][_0xc6c0('0x16')]);return _0x1a3783(_0xdad6fd[_0xc6c0('0x14')]['message']);}logger['error'](_0xc6c0('0x17'),_0x122d08,_0xdad6fd[_0xc6c0('0x14')]['message']);return _0x16107e(_0xdad6fd[_0xc6c0('0x14')][_0xc6c0('0x16')]);}else{logger['info'](_0xc6c0('0x17'),_0x122d08,_0xc6c0('0x11'));_0x16107e(_0xdad6fd[_0xc6c0('0x18')]['message']);}})[_0xc6c0('0x19')](function(_0x43acf7){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x122d08,_0x43acf7);_0x1a3783(_0x43acf7);});});}exports['ShowWhatsappAccount']=function(_0x20ec29){var _0x450dcb=this;return new Promise(function(_0x175695,_0x3e9d09){return db[_0xc6c0('0x1a')][_0xc6c0('0x1b')]({'raw':_0x20ec29[_0xc6c0('0x1c')]?_0x20ec29[_0xc6c0('0x1c')][_0xc6c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x20ec29[_0xc6c0('0x1c')]?_0x20ec29[_0xc6c0('0x1c')][_0xc6c0('0x1e')]||null:null,'attributes':_0x20ec29[_0xc6c0('0x1c')]?_0x20ec29[_0xc6c0('0x1c')][_0xc6c0('0x1f')]||null:null,'include':_0x20ec29[_0xc6c0('0x1c')]?_0x20ec29['options'][_0xc6c0('0x20')]?_[_0xc6c0('0x21')](_0x20ec29[_0xc6c0('0x1c')][_0xc6c0('0x20')],function(_0x320b38){return{'model':db[_0x320b38['model']],'as':_0x320b38['as'],'attributes':_0x320b38[_0xc6c0('0x1f')],'include':_0x320b38[_0xc6c0('0x20')]?_[_0xc6c0('0x21')](_0x320b38[_0xc6c0('0x20')],function(_0x4b42bb){return{'model':db[_0x4b42bb['model']],'as':_0x4b42bb['as'],'attributes':_0x4b42bb[_0xc6c0('0x1f')],'include':_0x4b42bb[_0xc6c0('0x20')]?_[_0xc6c0('0x21')](_0x4b42bb[_0xc6c0('0x20')],function(_0x3e1751){return{'model':db[_0x3e1751[_0xc6c0('0x22')]],'as':_0x3e1751['as'],'attributes':_0x3e1751[_0xc6c0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37687a){logger['info']('ShowWhatsappAccount',_0x20ec29);logger[_0xc6c0('0x12')](_0xc6c0('0x23'),_0x20ec29,JSON['stringify'](_0x37687a));_0x175695(_0x37687a);})[_0xc6c0('0x19')](function(_0x375d76){logger[_0xc6c0('0x14')](_0xc6c0('0x23'),_0x375d76[_0xc6c0('0x16')],_0x20ec29);_0x3e9d09(_0x450dcb['error'](0x1f4,_0x375d76[_0xc6c0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6a1151e..91ab357 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 _0x4002=['remove','update','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x2f5bc2,_0x507a96){var _0x3e0794=function(_0x1e8a0a){while(--_0x1e8a0a){_0x2f5bc2['push'](_0x2f5bc2['shift']());}};_0x3e0794(++_0x507a96);}(_0x4002,0x19d));var _0x2400=function(_0x37aa49,_0x3dc581){_0x37aa49=_0x37aa49-0x0;var _0x314833=_0x4002[_0x37aa49];return _0x314833;};'use strict';var WhatsappAccountEvents=require(_0x2400('0x0'));var events=[_0x2400('0x1'),_0x2400('0x2'),_0x2400('0x3')];function createListener(_0xefd005,_0x19fff1){return function(_0x32b348){_0x19fff1['emit'](_0xefd005,_0x32b348);};}function removeListener(_0x5e086a,_0x276023){return function(){WhatsappAccountEvents['removeListener'](_0x5e086a,_0x276023);};}exports['register']=function(_0x78834){for(var _0x1a1d99=0x0,_0x9e8f1b=events['length'];_0x1a1d99<_0x9e8f1b;_0x1a1d99++){var _0x5158c9=events[_0x1a1d99];var _0x5528c0=createListener(_0x2400('0x4')+_0x5158c9,_0x78834);WhatsappAccountEvents['on'](_0x5158c9,_0x5528c0);}}; \ No newline at end of file +var _0x401b=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','whatsappAccount:'];(function(_0xf95790,_0x480b35){var _0x11e45d=function(_0x63b873){while(--_0x63b873){_0xf95790['push'](_0xf95790['shift']());}};_0x11e45d(++_0x480b35);}(_0x401b,0x98));var _0xb401=function(_0x31f2b7,_0xc6ab9a){_0x31f2b7=_0x31f2b7-0x0;var _0x57835d=_0x401b[_0x31f2b7];return _0x57835d;};'use strict';var WhatsappAccountEvents=require(_0xb401('0x0'));var events=[_0xb401('0x1'),_0xb401('0x2'),_0xb401('0x3')];function createListener(_0xfdb114,_0xac9923){return function(_0x2676af){_0xac9923[_0xb401('0x4')](_0xfdb114,_0x2676af);};}function removeListener(_0x3c4a66,_0xe98090){return function(){WhatsappAccountEvents[_0xb401('0x5')](_0x3c4a66,_0xe98090);};}exports[_0xb401('0x6')]=function(_0x28c204){for(var _0xdbe073=0x0,_0x346dff=events['length'];_0xdbe073<_0x346dff;_0xdbe073++){var _0x1da9cc=events[_0xdbe073];var _0x4ff431=createListener(_0xb401('0x7')+_0x1da9cc,_0x28c204);WhatsappAccountEvents['on'](_0x1da9cc,_0x4ff431);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1e90274..fbcf84a 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 _0xd1f5=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x386e88,_0x26ac2e){var _0x2b3208=function(_0x42b498){while(--_0x42b498){_0x386e88['push'](_0x386e88['shift']());}};_0x2b3208(++_0x26ac2e);}(_0xd1f5,0x12b));var _0x5d1f=function(_0x529bab,_0x29314f){_0x529bab=_0x529bab-0x0;var _0xb2dc0e=_0xd1f5[_0x529bab];return _0xb2dc0e;};'use strict';var multer=require('multer');var util=require(_0x5d1f('0x0'));var path=require(_0x5d1f('0x1'));var timeout=require(_0x5d1f('0x2'));var express=require(_0x5d1f('0x3'));var router=express[_0x5d1f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5d1f('0x5'));var interaction=require(_0x5d1f('0x6'));var config=require(_0x5d1f('0x7'));var controller=require('./whatsappApplication.controller');router[_0x5d1f('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d1f('0x9')]);router['get']('/:id',auth[_0x5d1f('0xa')](),controller[_0x5d1f('0xb')]);router[_0x5d1f('0xc')]('/',auth[_0x5d1f('0xa')](),controller[_0x5d1f('0xd')]);router[_0x5d1f('0xe')](_0x5d1f('0xf'),auth[_0x5d1f('0xa')](),controller[_0x5d1f('0x10')]);router[_0x5d1f('0x11')](_0x5d1f('0xf'),auth[_0x5d1f('0xa')](),controller[_0x5d1f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd587=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x276098,_0x5cb3a9){var _0x48be8d=function(_0x57d90d){while(--_0x57d90d){_0x276098['push'](_0x276098['shift']());}};_0x48be8d(++_0x5cb3a9);}(_0xd587,0x143));var _0x7d58=function(_0x37a636,_0x3f85bb){_0x37a636=_0x37a636-0x0;var _0x1ee1fd=_0xd587[_0x37a636];return _0x1ee1fd;};'use strict';var multer=require(_0x7d58('0x0'));var util=require('util');var path=require(_0x7d58('0x1'));var timeout=require(_0x7d58('0x2'));var express=require(_0x7d58('0x3'));var router=express[_0x7d58('0x4')]();var fs_extra=require(_0x7d58('0x5'));var auth=require(_0x7d58('0x6'));var interaction=require(_0x7d58('0x7'));var config=require(_0x7d58('0x8'));var controller=require(_0x7d58('0x9'));router[_0x7d58('0xa')]('/',auth[_0x7d58('0xb')](),controller['index']);router['get'](_0x7d58('0xc'),auth[_0x7d58('0xb')](),controller[_0x7d58('0xd')]);router[_0x7d58('0xe')]('/',auth[_0x7d58('0xb')](),controller[_0x7d58('0xf')]);router[_0x7d58('0x10')](_0x7d58('0xc'),auth[_0x7d58('0xb')](),controller[_0x7d58('0x11')]);router[_0x7d58('0x12')](_0x7d58('0xc'),auth['isAuthenticated'](),controller[_0x7d58('0x13')]);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 61087f1..d08e87d 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 _0x1388=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x245f78,_0xa3d26a){var _0x2eeb95=function(_0x3e8a4b){while(--_0x3e8a4b){_0x245f78['push'](_0x245f78['shift']());}};_0x2eeb95(++_0xa3d26a);}(_0x1388,0xf2));var _0x8138=function(_0x1c66d8,_0x16d85d){_0x1c66d8=_0x1c66d8-0x0;var _0xf1cc0a=_0x1388[_0x1c66d8];return _0xf1cc0a;};'use strict';var Sequelize=require(_0x8138('0x0'));module[_0x8138('0x1')]={'priority':{'type':Sequelize[_0x8138('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8138('0x3')],'allowNull':![],'defaultValue':_0x8138('0x4')},'appdata':{'type':Sequelize[_0x8138('0x5')]()},'description':{'type':Sequelize[_0x8138('0x3')]},'interval':{'type':Sequelize[_0x8138('0x3')],'defaultValue':_0x8138('0x6')}}; \ No newline at end of file +var _0x6a77=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6a77,0x1b4));var _0x76a7=function(_0x1752f7,_0x5245f2){_0x1752f7=_0x1752f7-0x0;var _0x5abf0e=_0x6a77[_0x1752f7];return _0x5abf0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x76a7('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x76a7('0x1')],'allowNull':![],'defaultValue':_0x76a7('0x2')},'appdata':{'type':Sequelize[_0x76a7('0x3')]()},'description':{'type':Sequelize[_0x76a7('0x1')]},'interval':{'type':Sequelize[_0x76a7('0x1')],'defaultValue':_0x76a7('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fe0be14..c7b408c 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 _0xf55c=['request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','name','index','map','WhatsappApplication','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','rawAttributes','options','find','body','eml-format','zip-dir','fast-json-patch'];(function(_0x133946,_0x54db1d){var _0x693c7c=function(_0x3a41f9){while(--_0x3a41f9){_0x133946['push'](_0x133946['shift']());}};_0x693c7c(++_0x54db1d);}(_0xf55c,0x1e7));var _0xcf55=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xf55c[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0xcf55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf55('0x1'));var jsonpatch=require(_0xcf55('0x2'));var rp=require(_0xcf55('0x3'));var moment=require(_0xcf55('0x4'));var BPromise=require(_0xcf55('0x5'));var Mustache=require(_0xcf55('0x6'));var util=require(_0xcf55('0x7'));var path=require('path');var sox=require(_0xcf55('0x8'));var csv=require(_0xcf55('0x9'));var ejs=require(_0xcf55('0xa'));var fs=require('fs');var fs_extra=require(_0xcf55('0xb'));var _=require('lodash');var squel=require(_0xcf55('0xc'));var crypto=require(_0xcf55('0xd'));var jsforce=require(_0xcf55('0xe'));var deskjs=require(_0xcf55('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf55('0x10'));var Papa=require(_0xcf55('0x11'));var Redis=require(_0xcf55('0x12'));var authService=require(_0xcf55('0x13'));var qs=require(_0xcf55('0x14'));var as=require(_0xcf55('0x15'));var hardwareService=require(_0xcf55('0x16'));var logger=require('../../config/logger')(_0xcf55('0x17'));var utils=require(_0xcf55('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf55('0x19'))['db'];function respondWithStatusCode(_0x7cf19f,_0x742392){_0x742392=_0x742392||0xcc;return function(_0x46fa7a){if(_0x46fa7a){return _0x7cf19f[_0xcf55('0x1a')](_0x742392);}return _0x7cf19f[_0xcf55('0x1b')](_0x742392)[_0xcf55('0x1c')]();};}function respondWithResult(_0x32f03f,_0x111e5e){_0x111e5e=_0x111e5e||0xc8;return function(_0x40d4fe){if(_0x40d4fe){return _0x32f03f[_0xcf55('0x1b')](_0x111e5e)[_0xcf55('0x1d')](_0x40d4fe);}};}function respondWithFilteredResult(_0x547a5a,_0x410f47){return function(_0xfba091){if(_0xfba091){var _0x26c004=typeof _0x410f47[_0xcf55('0x1e')]===_0xcf55('0x1f')&&typeof _0x410f47['limit']===_0xcf55('0x1f');var _0x4a7a55=_0xfba091[_0xcf55('0x20')];var _0xeed93=_0x26c004?0x0:_0x410f47[_0xcf55('0x1e')];var _0x52195b=_0x26c004?_0xfba091[_0xcf55('0x20')]:_0x410f47['offset']+_0x410f47[_0xcf55('0x21')];var _0x1511ba;if(_0x52195b>=_0x4a7a55){_0x52195b=_0x4a7a55;_0x1511ba=0xc8;}else{_0x1511ba=0xce;}_0x547a5a[_0xcf55('0x1b')](_0x1511ba);return _0x547a5a['set']('Content-Range',_0xeed93+'-'+_0x52195b+'/'+_0x4a7a55)['json'](_0xfba091);}return null;};}function patchUpdates(_0x4562af){return function(_0x9cd5d5){try{jsonpatch[_0xcf55('0x22')](_0x9cd5d5,_0x4562af,!![]);}catch(_0x5df9e9){return BPromise[_0xcf55('0x23')](_0x5df9e9);}return _0x9cd5d5[_0xcf55('0x24')]();};}function saveUpdates(_0x5630ff,_0x4ad708){return function(_0x1283cc){if(_0x1283cc){return _0x1283cc[_0xcf55('0x25')](_0x5630ff)['then'](function(_0x1891d1){return _0x1891d1;});}return null;};}function removeEntity(_0x6dbf56,_0x1bb5cf){return function(_0x3c0723){if(_0x3c0723){return _0x3c0723[_0xcf55('0x26')]()[_0xcf55('0x27')](function(){_0x6dbf56[_0xcf55('0x1b')](0xcc)[_0xcf55('0x1c')]();});}};}function handleEntityNotFound(_0x524828,_0x37e734){return function(_0x51df33){if(!_0x51df33){_0x524828[_0xcf55('0x1a')](0x194);}return _0x51df33;};}function handleError(_0x1ecc93,_0x3c08f7){_0x3c08f7=_0x3c08f7||0x1f4;return function(_0x51471f){logger['error'](_0x51471f['stack']);if(_0x51471f[_0xcf55('0x28')]){delete _0x51471f[_0xcf55('0x28')];}_0x1ecc93['status'](_0x3c08f7)['send'](_0x51471f);};}exports[_0xcf55('0x29')]=function(_0x4a81cc,_0xeddf9){var _0x4128c0={},_0x1f9ed9={},_0xb98b74={'count':0x0,'rows':[]};var _0x2540c7=_[_0xcf55('0x2a')](db[_0xcf55('0x2b')]['rawAttributes'],function(_0x163f5f){return{'name':_0x163f5f['fieldName'],'type':_0x163f5f[_0xcf55('0x2c')][_0xcf55('0x2d')]};});_0x1f9ed9[_0xcf55('0x2e')]=_['map'](_0x2540c7,_0xcf55('0x28'));_0x1f9ed9[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x4a81cc[_0xcf55('0x2f')]);_0x1f9ed9['filters']=_[_0xcf55('0x31')](_0x1f9ed9['model'],_0x1f9ed9['query']);_0x4128c0['attributes']=_[_0xcf55('0x31')](_0x1f9ed9['model'],qs['fields'](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x32')]));_0x4128c0['attributes']=_0x4128c0[_0xcf55('0x33')][_0xcf55('0x34')]?_0x4128c0['attributes']:_0x1f9ed9['model'];if(!_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x35')](_0xcf55('0x36'))){_0x4128c0[_0xcf55('0x21')]=qs['limit'](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x21')]);_0x4128c0[_0xcf55('0x1e')]=qs[_0xcf55('0x1e')](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x1e')]);}_0x4128c0['order']=qs[_0xcf55('0x37')](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x37')]);_0x4128c0[_0xcf55('0x38')]=qs['filters'](_[_0xcf55('0x39')](_0x4a81cc[_0xcf55('0x2f')],_0x1f9ed9['filters']),_0x2540c7);if(_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x3a')]){_0x4128c0[_0xcf55('0x38')]=_[_0xcf55('0x3b')](_0x4128c0[_0xcf55('0x38')],{'$or':_[_0xcf55('0x2a')](_0x2540c7,function(_0x1ce402){if(_0x1ce402[_0xcf55('0x2c')]!==_0xcf55('0x3c')){var _0x44df88={};_0x44df88[_0x1ce402['name']]={'$like':'%'+_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x3a')]+'%'};return _0x44df88;}})});}_0x4128c0=_[_0xcf55('0x3b')]({},_0x4128c0,_0x4a81cc['options']);var _0x47d7da={'where':_0x4128c0[_0xcf55('0x38')]};return db[_0xcf55('0x2b')][_0xcf55('0x20')](_0x47d7da)['then'](function(_0x113949){_0xb98b74['count']=_0x113949;if(_0x4a81cc['query'][_0xcf55('0x3d')]){_0x4128c0[_0xcf55('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xcf55('0x3f')](_0x4128c0);})[_0xcf55('0x27')](function(_0x5349e7){_0xb98b74['rows']=_0x5349e7;return _0xb98b74;})[_0xcf55('0x27')](respondWithFilteredResult(_0xeddf9,_0x4128c0))[_0xcf55('0x40')](handleError(_0xeddf9,null));};exports['show']=function(_0x43ac3d,_0x38f079){var _0x18a918={'raw':!![],'where':{'id':_0x43ac3d[_0xcf55('0x41')]['id']}},_0x386c57={};_0x386c57['model']=_[_0xcf55('0x30')](db['WhatsappApplication'][_0xcf55('0x42')]);_0x386c57[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x43ac3d[_0xcf55('0x2f')]);_0x386c57['filters']=_['intersection'](_0x386c57[_0xcf55('0x2e')],_0x386c57[_0xcf55('0x2f')]);_0x18a918[_0xcf55('0x33')]=_[_0xcf55('0x31')](_0x386c57['model'],qs[_0xcf55('0x32')](_0x43ac3d['query']['fields']));_0x18a918[_0xcf55('0x33')]=_0x18a918[_0xcf55('0x33')][_0xcf55('0x34')]?_0x18a918[_0xcf55('0x33')]:_0x386c57[_0xcf55('0x2e')];if(_0x43ac3d[_0xcf55('0x2f')][_0xcf55('0x3d')]){_0x18a918['include']=[{'all':!![]}];}_0x18a918=_['merge']({},_0x18a918,_0x43ac3d[_0xcf55('0x43')]);return db[_0xcf55('0x2b')][_0xcf55('0x44')](_0x18a918)[_0xcf55('0x27')](handleEntityNotFound(_0x38f079,null))[_0xcf55('0x27')](respondWithResult(_0x38f079,null))[_0xcf55('0x40')](handleError(_0x38f079,null));};exports['create']=function(_0xebc7c2,_0x41d4a5){return db[_0xcf55('0x2b')]['create'](_0xebc7c2[_0xcf55('0x45')],{})[_0xcf55('0x27')](respondWithResult(_0x41d4a5,0xc9))['catch'](handleError(_0x41d4a5,null));};exports['update']=function(_0x9859f,_0x6db4b5){if(_0x9859f[_0xcf55('0x45')]['id']){delete _0x9859f[_0xcf55('0x45')]['id'];}return db[_0xcf55('0x2b')]['find']({'where':{'id':_0x9859f[_0xcf55('0x41')]['id']}})[_0xcf55('0x27')](handleEntityNotFound(_0x6db4b5,null))[_0xcf55('0x27')](saveUpdates(_0x9859f[_0xcf55('0x45')],null))[_0xcf55('0x27')](respondWithResult(_0x6db4b5,null))['catch'](handleError(_0x6db4b5,null));};exports[_0xcf55('0x26')]=function(_0x5a5d6d,_0x50072f){return db[_0xcf55('0x2b')][_0xcf55('0x44')]({'where':{'id':_0x5a5d6d[_0xcf55('0x41')]['id']}})[_0xcf55('0x27')](handleEntityNotFound(_0x50072f,null))[_0xcf55('0x27')](removeEntity(_0x50072f,null))['catch'](handleError(_0x50072f,null));}; \ No newline at end of file +var _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x54e4e6,_0x5a2d7c){var _0x3d4cf9=function(_0x255b63){while(--_0x255b63){_0x54e4e6['push'](_0x54e4e6['shift']());}};_0x3d4cf9(++_0x5a2d7c);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x569dcf,_0x5c2c07){_0x569dcf=_0x569dcf-0x0;var _0x406849=_0xb8cb[_0x569dcf];return _0x406849;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c4c962a..fbb3ef5 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 _0x8a28=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a28,0xfd));var _0x88a2=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x8a28[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88a2('0xc'),'collate':_0x88a2('0xd')});}; \ No newline at end of file +var _0xe57e=['../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xe57e,0xf2));var _0xee57=function(_0xf3b159,_0x19f251){_0xf3b159=_0xf3b159-0x0;var _0x2e89ce=_0xe57e[_0xf3b159];return _0x2e89ce;};'use strict';var _=require(_0xee57('0x0'));var util=require('util');var logger=require(_0xee57('0x1'))(_0xee57('0x2'));var moment=require(_0xee57('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee57('0x4'));var rimraf=require('rimraf');var config=require(_0xee57('0x5'));var attributes=require(_0xee57('0x6'));module[_0xee57('0x7')]=function(_0x4e21c4,_0x491334){return _0x4e21c4[_0xee57('0x8')](_0xee57('0x9'),attributes,{'tableName':_0xee57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee57('0xb'),'collate':_0xee57('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index bd25552..ba8e1fc 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 _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','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','lodash','util'];(function(_0x357552,_0x280f83){var _0xa10009=function(_0x11f658){while(--_0x11f658){_0x357552['push'](_0x357552['shift']());}};_0xa10009(++_0x280f83);}(_0x0e85,0x7c));var _0x50e8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0e85[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x30f4f3,_0x2242cf){var _0x410e81=function(_0x44b049){while(--_0x44b049){_0x30f4f3['push'](_0x30f4f3['shift']());}};_0x410e81(++_0x2242cf);}(_0xfd28,0x148));var _0x8fd2=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xfd28[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 7572d11..88c26e6 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 _0xb4c7=['post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','create'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x201bfb,_0x2712a1){_0x201bfb=_0x201bfb-0x0;var _0x298760=_0xb4c7[_0x201bfb];return _0x298760;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0xc')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0xc')](_0x7b4c('0x12'),auth[_0x7b4c('0xa')](),controller['download']);router['post']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x14')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x14')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x18')),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')](_0x7b4c('0x1b'),_0x7b4c('0x1c')),controller['update']);router[_0x7b4c('0x1d')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x1e')),controller[_0x7b4c('0x1f')]);router[_0x7b4c('0x1d')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x20')]);module[_0x7b4c('0x21')]=router; \ No newline at end of file +var _0xe015=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','whatsapp','put','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe015,0x13b));var _0x5e01=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe015[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['get'](_0x5e01('0xe'),auth['isAuthenticated'](),controller[_0x5e01('0xf')]);router['get'](_0x5e01('0x10'),auth[_0x5e01('0x8')](),controller['download']);router[_0x5e01('0x11')]('/',auth[_0x5e01('0x8')](),controller['create']);router['post'](_0x5e01('0xe'),auth[_0x5e01('0x8')](),controller[_0x5e01('0x12')]);router[_0x5e01('0x11')](_0x5e01('0x13'),auth[_0x5e01('0x8')](),interaction['tracked'](_0x5e01('0x14'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x5e01('0x15')](_0x5e01('0xc'),auth['isAuthenticated'](),interaction[_0x5e01('0x16')]('whatsapp',_0x5e01('0x17')),controller['update']);router[_0x5e01('0x18')]('/:id',auth[_0x5e01('0x8')](),interaction['tracked']('whatsapp',_0x5e01('0x19')),controller[_0x5e01('0x1a')]);router['delete'](_0x5e01('0x13'),auth[_0x5e01('0x8')](),controller[_0x5e01('0x1b')]);module[_0x5e01('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 26f4a8f..3f19841 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 _0x7a3e=['ENUM','BOOLEAN','sequelize','moment','exports','DATE','STRING','out'];(function(_0x45910b,_0x422813){var _0x2ff112=function(_0x5adbae){while(--_0x5adbae){_0x45910b['push'](_0x45910b['shift']());}};_0x2ff112(++_0x422813);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x11ed5e,_0x409979){_0x11ed5e=_0x11ed5e-0x0;var _0x1632ee=_0x7a3e[_0x11ed5e];return _0x1632ee;};'use strict';var Sequelize=require(_0xe7a3('0x0'));var moment=require(_0xe7a3('0x1'));module[_0xe7a3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe7a3('0x3')]},'disposition':{'type':Sequelize[_0xe7a3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe7a3('0x4')]},'phone':{'type':Sequelize[_0xe7a3('0x4')]},'read1stAt':{'type':Sequelize[_0xe7a3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe7a3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe7a3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe7a3('0x6')]('in',_0xe7a3('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe7a3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x14f5=['moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3d310e,_0x200571){var _0x23ff86=function(_0x1002c2){while(--_0x1002c2){_0x3d310e['push'](_0x3d310e['shift']());}};_0x23ff86(++_0x200571);}(_0x14f5,0xae));var _0x514f=function(_0x398ec1,_0x1d63d8){_0x398ec1=_0x398ec1-0x0;var _0xcd9efa=_0x14f5[_0x398ec1];return _0xcd9efa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x514f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x514f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x514f('0x2')]},'disposition':{'type':Sequelize[_0x514f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x514f('0x3')]},'note':{'type':Sequelize[_0x514f('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x514f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x514f('0x4')]('in',_0x514f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x514f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x514f('0x4')]('in',_0x514f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x514f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9e7c8a5..a132133 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 _0x94ee=['download','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','fullname','get','Whatsapp','N.A.','closed','closedAt','disposition','map','existsSync','basename','out','System','value','root','downloadInteraction.ejs','.pdf','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','index','WhatsappInteraction','fieldName','type','user','catch','params','model','keys','query','filters','attributes','intersection','fields','include','merge','options','create','body','update','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0x94ee,0x11d));var _0xe94e=function(_0x139133,_0x1b2c15){_0x139133=_0x139133-0x0;var _0x48dcb0=_0x94ee[_0x139133];return _0x48dcb0;};'use strict';var rimraf=require(_0xe94e('0x0'));var zipdir=require(_0xe94e('0x1'));var moment=require(_0xe94e('0x2'));var BPromise=require(_0xe94e('0x3'));var util=require(_0xe94e('0x4'));var path=require('path');var ejs=require(_0xe94e('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe94e('0x6'));var interaction=require(_0xe94e('0x7'));var qs=require(_0xe94e('0x8'));var pdf=require(_0xe94e('0x9'));var logger=require(_0xe94e('0xa'))('api');var config=require('../../config/environment');var db=require(_0xe94e('0xb'))['db'];config[_0xe94e('0xc')]=_[_0xe94e('0xd')](config[_0xe94e('0xc')],{'host':_0xe94e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe94e('0xf'))[_0xe94e('0x10')](socket);function respondWithStatusCode(_0x11503f,_0x2d716b){_0x2d716b=_0x2d716b||0xcc;return function(_0x152257){if(_0x152257){return _0x11503f['sendStatus'](_0x2d716b);}return _0x11503f[_0xe94e('0x11')](_0x2d716b)['end']();};}function respondWithResult(_0x5af4c4,_0xe3c97d){_0xe3c97d=_0xe3c97d||0xc8;return function(_0x227568){if(_0x227568){return _0x5af4c4[_0xe94e('0x11')](_0xe3c97d)['json'](_0x227568);}};}function respondWithFilteredResult(_0x17c122,_0x1349ba){return function(_0x20d378){if(_0x20d378){var _0x49c923=typeof _0x1349ba[_0xe94e('0x12')]===_0xe94e('0x13')&&typeof _0x1349ba[_0xe94e('0x14')]===_0xe94e('0x13');var _0x3ec8c2=_0x20d378[_0xe94e('0x15')];var _0x2bab00=_0x49c923?0x0:_0x1349ba[_0xe94e('0x12')];var _0x264e38=_0x49c923?_0x20d378[_0xe94e('0x15')]:_0x1349ba[_0xe94e('0x12')]+_0x1349ba[_0xe94e('0x14')];var _0x6792aa;if(_0x264e38>=_0x3ec8c2){_0x264e38=_0x3ec8c2;_0x6792aa=0xc8;}else{_0x6792aa=0xce;}_0x17c122[_0xe94e('0x11')](_0x6792aa);return _0x17c122[_0xe94e('0x16')](_0xe94e('0x17'),_0x2bab00+'-'+_0x264e38+'/'+_0x3ec8c2)[_0xe94e('0x18')](_0x20d378);}return null;};}function saveUpdates(_0x2cf923){return function(_0x305a67){if(_0x305a67){return _0x305a67['update'](_0x2cf923)[_0xe94e('0x19')](function(_0x22e7a3){return _0x22e7a3;});}return null;};}function removeEntity(_0x4c66b7){return function(_0x5113a9){if(_0x5113a9){return _0x5113a9[_0xe94e('0x1a')]()[_0xe94e('0x19')](function(){_0x4c66b7[_0xe94e('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4b32){return function(_0x178846){if(!_0x178846){_0x3d4b32[_0xe94e('0x1b')](0x194);}return _0x178846;};}function handleError(_0xa71046,_0x3b371b){_0x3b371b=_0x3b371b||0x1f4;return function(_0xb8ca2a){logger[_0xe94e('0x1c')](_0xb8ca2a[_0xe94e('0x1d')]);if(_0xb8ca2a['name']){delete _0xb8ca2a[_0xe94e('0x1e')];}_0xa71046['status'](_0x3b371b)[_0xe94e('0x1f')](_0xb8ca2a);};}exports[_0xe94e('0x20')]=function(_0x239455,_0x455e95){var _0x3e5d1c={};var _0x5dfcdc=_['map'](db[_0xe94e('0x21')]['rawAttributes'],function(_0x18b77c){return{'name':_0x18b77c[_0xe94e('0x22')],'type':_0x18b77c[_0xe94e('0x23')]['key']};});_0x3e5d1c=qs['getOptions'](_0x5dfcdc,_0x239455);return interaction['findAll']('whatsapp',_0x239455['query'],_0x239455[_0xe94e('0x24')],_0x3e5d1c,_0x5dfcdc)[_0xe94e('0x19')](respondWithFilteredResult(_0x455e95,_0x3e5d1c))[_0xe94e('0x25')](handleError(_0x455e95,null));};exports['show']=function(_0x45c512,_0x5c4b7e){var _0x5701dd={'raw':![],'where':{'id':_0x45c512[_0xe94e('0x26')]['id']}},_0x3b3da0={};_0x3b3da0[_0xe94e('0x27')]=_[_0xe94e('0x28')](db[_0xe94e('0x21')]['rawAttributes']);_0x3b3da0[_0xe94e('0x29')]=_[_0xe94e('0x28')](_0x45c512[_0xe94e('0x29')]);_0x3b3da0[_0xe94e('0x2a')]=_['intersection'](_0x3b3da0['model'],_0x3b3da0['query']);_0x5701dd[_0xe94e('0x2b')]=_[_0xe94e('0x2c')](_0x3b3da0[_0xe94e('0x27')],qs[_0xe94e('0x2d')](_0x45c512[_0xe94e('0x29')][_0xe94e('0x2d')]));_0x5701dd[_0xe94e('0x2b')]=_0x5701dd['attributes']['length']?_0x5701dd[_0xe94e('0x2b')]:_0x3b3da0['model'];if(_0x45c512[_0xe94e('0x29')]['includeAll']){_0x5701dd[_0xe94e('0x2e')]=[{'all':!![]}];}_0x5701dd=_[_0xe94e('0x2f')]({},_0x5701dd,_0x45c512[_0xe94e('0x30')]);return db['WhatsappInteraction']['find'](_0x5701dd)['then'](handleEntityNotFound(_0x5c4b7e,null))['then'](respondWithResult(_0x5c4b7e,null))['catch'](handleError(_0x5c4b7e,null));};exports['create']=function(_0x46ecb9,_0x49f2f3){return db['WhatsappInteraction'][_0xe94e('0x31')](_0x46ecb9[_0xe94e('0x32')],{})[_0xe94e('0x19')](respondWithResult(_0x49f2f3,0xc9))['catch'](handleError(_0x49f2f3,null));};exports[_0xe94e('0x33')]=function(_0x2f076a,_0x4c0d73){if(_0x2f076a[_0xe94e('0x32')]['id']){delete _0x2f076a[_0xe94e('0x32')]['id'];}return db[_0xe94e('0x21')][_0xe94e('0x34')]({'where':{'id':_0x2f076a['params']['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x4c0d73,null))[_0xe94e('0x19')](saveUpdates(_0x2f076a[_0xe94e('0x32')],null))['then'](respondWithResult(_0x4c0d73,null))[_0xe94e('0x25')](handleError(_0x4c0d73,null));};exports[_0xe94e('0x1a')]=function(_0x4ab60a,_0x1b2a01){return db[_0xe94e('0x21')]['find']({'where':{'id':_0x4ab60a['params']['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x1b2a01,null))['then'](removeEntity(_0x1b2a01,null))[_0xe94e('0x25')](handleError(_0x1b2a01,null));};exports[_0xe94e('0x35')]=function(_0x5e829d,_0x45e7ed){return db[_0xe94e('0x21')][_0xe94e('0x35')]()['then'](respondWithResult(_0x45e7ed,null))[_0xe94e('0x25')](handleError(_0x45e7ed,null));};exports[_0xe94e('0x36')]=function(_0x262da7,_0x1f948d){return db[_0xe94e('0x37')][_0xe94e('0x34')]({'where':{'id':_0x262da7['params']['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x1f948d,null))['then'](function(_0x2eb7d0){if(_0x2eb7d0){return _0x2eb7d0[_0xe94e('0x36')](_0x262da7[_0xe94e('0x32')][_0xe94e('0x38')],_[_0xe94e('0x39')](_0x262da7[_0xe94e('0x32')],[_0xe94e('0x38'),'id'])||{});}})[_0xe94e('0x19')](respondWithResult(_0x1f948d,null))[_0xe94e('0x25')](handleError(_0x1f948d,null));};exports[_0xe94e('0x3a')]=function(_0x3d22ba,_0x111eb1){var _0x1ec956={'raw':![],'where':{}};var _0x2ec4ca={};var _0x5b49e9={'count':0x0,'rows':[]};return db[_0xe94e('0x21')][_0xe94e('0x3b')]({'where':{'id':_0x3d22ba[_0xe94e('0x26')]['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x111eb1,null))[_0xe94e('0x19')](function(_0x428fa9){if(_0x428fa9){_0x2ec4ca[_0xe94e('0x27')]=_[_0xe94e('0x28')](db[_0xe94e('0x37')][_0xe94e('0x3c')]);_0x2ec4ca[_0xe94e('0x29')]=_['keys'](_0x3d22ba['query']);_0x2ec4ca[_0xe94e('0x2a')]=_[_0xe94e('0x2c')](_0x2ec4ca[_0xe94e('0x27')],_0x2ec4ca[_0xe94e('0x29')]);_0x1ec956[_0xe94e('0x2b')]=_['intersection'](_0x2ec4ca[_0xe94e('0x27')],qs[_0xe94e('0x2d')](_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x2d')]));_0x1ec956['attributes']=_0x1ec956['attributes']['length']?_0x1ec956[_0xe94e('0x2b')]:_0x2ec4ca['model'];if(!_0x3d22ba['query'][_0xe94e('0x3d')](_0xe94e('0x3e'))){_0x1ec956['limit']=qs['limit'](_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x14')]);_0x1ec956[_0xe94e('0x12')]=qs[_0xe94e('0x12')](_0x3d22ba[_0xe94e('0x29')]['offset']);}_0x1ec956[_0xe94e('0x3f')]=qs[_0xe94e('0x40')](_0x3d22ba['query'][_0xe94e('0x40')]);_0x1ec956['where']=qs[_0xe94e('0x2a')](_[_0xe94e('0x41')](_0x3d22ba[_0xe94e('0x29')],_0x2ec4ca[_0xe94e('0x2a')]));_0x1ec956[_0xe94e('0x42')][_0xe94e('0x43')]=_0x428fa9['id'];if(_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x44')]){_0x1ec956[_0xe94e('0x42')]=_[_0xe94e('0x2f')](_0x1ec956[_0xe94e('0x42')],{'$or':_['map'](_0x1ec956['attributes'],function(_0x48aa18){var _0x28abd6={};_0x28abd6[_0x48aa18]={'$like':'%'+_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x44')]+'%'};return _0x28abd6;})});}if(_0x3d22ba['query'][_0xe94e('0x45')]){var _0x19eae4=_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x45')][_0xe94e('0x46')](',');var _0x55bc48={};_0x55bc48[_0x19eae4[0x0]]={'$gte':moment(_0x19eae4[0x1])[_0xe94e('0x47')](_0xe94e('0x48'))};_0x1ec956[_0xe94e('0x42')]=_[_0xe94e('0x2f')](_0x1ec956[_0xe94e('0x42')],_0x55bc48);}_0x1ec956=_[_0xe94e('0x2f')]({},_0x1ec956,_0x3d22ba[_0xe94e('0x30')]);return db[_0xe94e('0x37')]['count']({'where':_0x1ec956[_0xe94e('0x42')]})[_0xe94e('0x19')](function(_0x7511cb){_0x5b49e9[_0xe94e('0x15')]=_0x7511cb;if(_0x3d22ba[_0xe94e('0x29')][_0xe94e('0x49')]){_0x1ec956[_0xe94e('0x2e')]=[{'all':!![]}];}return db[_0xe94e('0x37')][_0xe94e('0x4a')](_0x1ec956);})[_0xe94e('0x19')](function(_0x5cc4bd){_0x5b49e9[_0xe94e('0x4b')]=_0x5cc4bd;return _0x5b49e9;});}})['then'](respondWithFilteredResult(_0x111eb1,_0x1ec956))[_0xe94e('0x25')](handleError(_0x111eb1,null));};exports[_0xe94e('0x4c')]=function(_0x206203,_0x27c8a4){return db[_0xe94e('0x21')]['find']({'where':{'id':_0x206203[_0xe94e('0x26')]['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x27c8a4,null))[_0xe94e('0x19')](function(_0x488fe0){if(_0x488fe0){return _0x488fe0[_0xe94e('0x4d')](_0x206203[_0xe94e('0x32')][_0xe94e('0x38')],_[_0xe94e('0x39')](_0x206203[_0xe94e('0x32')],[_0xe94e('0x38'),'id'])||{})[_0xe94e('0x4e')](function(){return db[_0xe94e('0x4f')][_0xe94e('0x4a')]({'attributes':['id',_0xe94e('0x1e'),_0xe94e('0x50')],'where':{'id':_0x206203[_0xe94e('0x32')]['ids']}});})['then'](function(_0x55d038){socket[_0xe94e('0x51')](_0xe94e('0x52'),{'id':Number(_0x206203[_0xe94e('0x26')]['id']),'tags':_0x55d038||[]});return{'id':Number(_0x206203[_0xe94e('0x26')]['id']),'tags':_0x55d038||[]};});}})[_0xe94e('0x19')](respondWithResult(_0x27c8a4,null))[_0xe94e('0x25')](handleError(_0x27c8a4,null));};exports['removeTags']=function(_0x76ee71,_0x245a3d){return db[_0xe94e('0x21')][_0xe94e('0x34')]({'where':{'id':_0x76ee71[_0xe94e('0x26')]['id']}})[_0xe94e('0x19')](handleEntityNotFound(_0x245a3d,null))[_0xe94e('0x19')](function(_0x476206){if(_0x476206){return _0x476206[_0xe94e('0x53')](_0x76ee71[_0xe94e('0x29')][_0xe94e('0x38')]);}})[_0xe94e('0x19')](respondWithStatusCode(_0x245a3d,null))[_0xe94e('0x25')](handleError(_0x245a3d,null));};exports[_0xe94e('0x54')]=function(_0x267043,_0x164fba){var _0x2d7121=moment()['unix']()[_0xe94e('0x55')]();var _0x1edea6=path[_0xe94e('0x56')](config['root'],_0xe94e('0x57'),_0xe94e('0x58'),_0xe94e('0x59'));var _0x4c2fa0=path['join'](config['root'],_0xe94e('0x57'),_0xe94e('0x58'),_0xe94e('0x5a'));var _0x323bf0=path['join'](_0x1edea6,_0x2d7121);var _0x513a5c=util[_0xe94e('0x47')](_0xe94e('0x5b'),_0x267043[_0xe94e('0x26')]['id'],_0x2d7121);var _0x7860aa=path[_0xe94e('0x56')](_0x1edea6,_0x513a5c);var _0x19f99c=[];_0x19f99c['push']({'model':db[_0xe94e('0x5c')],'as':_0xe94e('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x19f99c[_0xe94e('0x5d')]({'model':db['CmContact'],'as':_0xe94e('0x5e'),'attributes':['id',_0xe94e('0x5f'),_0xe94e('0x60')],'raw':!![]});if(_0x267043[_0xe94e('0x29')][_0xe94e('0x5a')]){_0x19f99c[_0xe94e('0x5d')]({'model':db[_0xe94e('0x61')],'as':_0xe94e('0x61'),'raw':!![]});}var _0x5a7d3c=[{'model':db['WhatsappMessage'],'as':_0xe94e('0x62'),'attributes':['id',_0xe94e('0x32'),_0xe94e('0x63'),_0xe94e('0x64'),_0xe94e('0x65'),_0xe94e('0x66')],'include':_0x19f99c}];_0x5a7d3c[_0xe94e('0x5d')]({'model':db['WhatsappAccount'],'as':_0xe94e('0x67'),'attributes':['id','name']});_0x5a7d3c[_0xe94e('0x5d')]({'model':db[_0xe94e('0x5c')],'as':_0xe94e('0x68'),'attributes':['id',_0xe94e('0x69')]});return db[_0xe94e('0x21')][_0xe94e('0x34')]({'where':{'id':_0x267043['params']['id']},'include':_0x5a7d3c})['then'](handleEntityNotFound(_0x164fba,null))[_0xe94e('0x19')](function(_0x331001){if(_0x331001){var _0x375b75=_0x331001[_0xe94e('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x323bf0);var _0x16496b={'channel':_0xe94e('0x6b'),'account':_0x375b75[_0xe94e('0x67')][_0xe94e('0x1e')],'agent':_0x375b75['Owner']?_0x375b75[_0xe94e('0x68')][_0xe94e('0x69')]:_0xe94e('0x6c'),'createdAt':moment(_0x375b75['createdAt'])[_0xe94e('0x47')](_0xe94e('0x48'))[_0xe94e('0x55')](),'closedAt':_0x375b75[_0xe94e('0x6d')]?moment(_0x375b75[_0xe94e('0x6e')])[_0xe94e('0x47')](_0xe94e('0x48'))[_0xe94e('0x55')]():'','disposition':_0x375b75[_0xe94e('0x6f')],'messages':_(_0x375b75[_0xe94e('0x62')])[_0xe94e('0x44')]({'secret':![]})[_0xe94e('0x70')](function(_0x54fe4c){if(_0x54fe4c['Attachment']){var _0x590772=path[_0xe94e('0x56')](_0x4c2fa0,_0x54fe4c[_0xe94e('0x61')]['basename']);if(fs[_0xe94e('0x71')](_0x590772)){fs['createReadStream'](_0x590772)['pipe'](fs['createWriteStream'](path[_0xe94e('0x56')](_0x323bf0,_0x54fe4c[_0xe94e('0x61')][_0xe94e('0x72')])));}}return{'date':moment(_0x54fe4c[_0xe94e('0x63')])[_0xe94e('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe94e('0x55')](),'sender':_0x54fe4c['direction']===_0xe94e('0x73')?_0x54fe4c['User']?_0x54fe4c[_0xe94e('0x5c')][_0xe94e('0x69')]:_0xe94e('0x74'):_0x54fe4c[_0xe94e('0x5e')][_0xe94e('0x5f')]+(_0x54fe4c['Contact']['lastName']?'\x20'+_0x54fe4c[_0xe94e('0x5e')]['lastName']:''),'body':_0x54fe4c[_0xe94e('0x61')]?_0x54fe4c[_0xe94e('0x61')][_0xe94e('0x72')]:_0x54fe4c[_0xe94e('0x32')],'direction':_0x54fe4c[_0xe94e('0x64')]===_0xe94e('0x73')?'A':'C','secret':_0x54fe4c[_0xe94e('0x65')],'read':_0x54fe4c['read'],'attachment':_0x54fe4c[_0xe94e('0x61')]};})[_0xe94e('0x75')]()};return ejs['renderFile'](path[_0xe94e('0x56')](config[_0xe94e('0x76')],_0xe94e('0x57'),'views',_0xe94e('0x77')),{'interaction':_0x16496b})[_0xe94e('0x19')](function(_0x495258){var _0x5df53c=path['join'](_0x323bf0,'transcript-'+_0x375b75['id']+'-'+_0x2d7121+_0xe94e('0x78'));var _0x80014c={'path':_0x5df53c,'channel':'Whatsapp','interactionId':_0x375b75['id']};return pdf['createPdfFromHTML'](_0x495258,_0x80014c);})['then'](function(){return new BPromise(function(_0x30932f,_0x5dccf4){zipdir(_0x323bf0,{'saveTo':_0x7860aa},function(_0x2d4324,_0xd23062){if(_0x2d4324)return _0x5dccf4(_0x2d4324);return _0x30932f(_0xd23062);});})[_0xe94e('0x19')](function(){return new BPromise(function(_0x51346d,_0x2df83d){rimraf(_0x323bf0,function(_0xef6b88){if(_0xef6b88)_0x2df83d(_0xef6b88);return _0x51346d();});});})['then'](function(){return _0x164fba['download'](_0x7860aa,_0x513a5c,function(_0xa9c740){if(_0xa9c740){console[_0xe94e('0x79')](_0xe94e('0x7a'),_0xa9c740);}else{fs['unlinkSync'](_0x7860aa);}});});});}else{return _0x164fba[_0xe94e('0x1b')](0xc8);}})[_0xe94e('0x25')](handleError(_0x164fba,null));}; \ No newline at end of file +var _0xf7d2=['key','getOptions','user','show','query','keys','filters','intersection','model','attributes','fields','merge','options','catch','create','body','find','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','setTags','Tag','findAll','color','removeTags','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','read','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','createdAt','closed','closedAt','disposition','Attachment','basename','existsSync','pipe','createWriteStream','out','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','util','path','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xf7d2,0x149));var _0x2f7d=function(_0x19a9b5,_0x198382){_0x19a9b5=_0x19a9b5-0x0;var _0x632733=_0xf7d2[_0x19a9b5];return _0x632733;};'use strict';var rimraf=require(_0x2f7d('0x0'));var zipdir=require(_0x2f7d('0x1'));var moment=require(_0x2f7d('0x2'));var BPromise=require('bluebird');var util=require(_0x2f7d('0x3'));var path=require(_0x2f7d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x2f7d('0x5'));var qs=require(_0x2f7d('0x6'));var pdf=require(_0x2f7d('0x7'));var logger=require(_0x2f7d('0x8'))('api');var config=require(_0x2f7d('0x9'));var db=require(_0x2f7d('0xa'))['db'];config[_0x2f7d('0xb')]=_[_0x2f7d('0xc')](config[_0x2f7d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f7d('0xb')]));require(_0x2f7d('0xd'))[_0x2f7d('0xe')](socket);function respondWithStatusCode(_0x54c9e3,_0x135724){_0x135724=_0x135724||0xcc;return function(_0x3b9d52){if(_0x3b9d52){return _0x54c9e3[_0x2f7d('0xf')](_0x135724);}return _0x54c9e3[_0x2f7d('0x10')](_0x135724)[_0x2f7d('0x11')]();};}function respondWithResult(_0x4968b8,_0x4b4ab5){_0x4b4ab5=_0x4b4ab5||0xc8;return function(_0x35c242){if(_0x35c242){return _0x4968b8[_0x2f7d('0x10')](_0x4b4ab5)[_0x2f7d('0x12')](_0x35c242);}};}function respondWithFilteredResult(_0x5ac5a4,_0x4de7d7){return function(_0x12c760){if(_0x12c760){var _0x3c089d=typeof _0x4de7d7[_0x2f7d('0x13')]==='undefined'&&typeof _0x4de7d7[_0x2f7d('0x14')]==='undefined';var _0x358fd5=_0x12c760[_0x2f7d('0x15')];var _0x11e1aa=_0x3c089d?0x0:_0x4de7d7[_0x2f7d('0x13')];var _0x5c3ced=_0x3c089d?_0x12c760['count']:_0x4de7d7[_0x2f7d('0x13')]+_0x4de7d7[_0x2f7d('0x14')];var _0x5d0cb9;if(_0x5c3ced>=_0x358fd5){_0x5c3ced=_0x358fd5;_0x5d0cb9=0xc8;}else{_0x5d0cb9=0xce;}_0x5ac5a4[_0x2f7d('0x10')](_0x5d0cb9);return _0x5ac5a4['set'](_0x2f7d('0x16'),_0x11e1aa+'-'+_0x5c3ced+'/'+_0x358fd5)['json'](_0x12c760);}return null;};}function saveUpdates(_0x552cc9){return function(_0x5264ca){if(_0x5264ca){return _0x5264ca[_0x2f7d('0x17')](_0x552cc9)[_0x2f7d('0x18')](function(_0x4ac70e){return _0x4ac70e;});}return null;};}function removeEntity(_0x2656da){return function(_0x295114){if(_0x295114){return _0x295114[_0x2f7d('0x19')]()[_0x2f7d('0x18')](function(){_0x2656da[_0x2f7d('0x10')](0xcc)[_0x2f7d('0x11')]();});}};}function handleEntityNotFound(_0x43bfb0){return function(_0x27dad7){if(!_0x27dad7){_0x43bfb0[_0x2f7d('0xf')](0x194);}return _0x27dad7;};}function handleError(_0x5b046d,_0x217987){_0x217987=_0x217987||0x1f4;return function(_0x947ac4){logger[_0x2f7d('0x1a')](_0x947ac4[_0x2f7d('0x1b')]);if(_0x947ac4[_0x2f7d('0x1c')]){delete _0x947ac4['name'];}_0x5b046d[_0x2f7d('0x10')](_0x217987)[_0x2f7d('0x1d')](_0x947ac4);};}exports[_0x2f7d('0x1e')]=function(_0x7e2fba,_0x469c5a){var _0x7fece1={};var _0x25704e=_['map'](db[_0x2f7d('0x1f')][_0x2f7d('0x20')],function(_0x38e94f){return{'name':_0x38e94f[_0x2f7d('0x21')],'type':_0x38e94f['type'][_0x2f7d('0x22')]};});_0x7fece1=qs[_0x2f7d('0x23')](_0x25704e,_0x7e2fba);return interaction['findAll']('whatsapp',_0x7e2fba['query'],_0x7e2fba[_0x2f7d('0x24')],_0x7fece1,_0x25704e)[_0x2f7d('0x18')](respondWithFilteredResult(_0x469c5a,_0x7fece1))['catch'](handleError(_0x469c5a,null));};exports[_0x2f7d('0x25')]=function(_0x5308ec,_0xb4c5c5){var _0xbf6a79={'raw':![],'where':{'id':_0x5308ec['params']['id']}},_0x36288a={};_0x36288a['model']=_['keys'](db[_0x2f7d('0x1f')][_0x2f7d('0x20')]);_0x36288a[_0x2f7d('0x26')]=_[_0x2f7d('0x27')](_0x5308ec[_0x2f7d('0x26')]);_0x36288a[_0x2f7d('0x28')]=_[_0x2f7d('0x29')](_0x36288a[_0x2f7d('0x2a')],_0x36288a[_0x2f7d('0x26')]);_0xbf6a79[_0x2f7d('0x2b')]=_['intersection'](_0x36288a[_0x2f7d('0x2a')],qs[_0x2f7d('0x2c')](_0x5308ec[_0x2f7d('0x26')]['fields']));_0xbf6a79['attributes']=_0xbf6a79[_0x2f7d('0x2b')]['length']?_0xbf6a79[_0x2f7d('0x2b')]:_0x36288a['model'];if(_0x5308ec['query']['includeAll']){_0xbf6a79['include']=[{'all':!![]}];}_0xbf6a79=_[_0x2f7d('0x2d')]({},_0xbf6a79,_0x5308ec[_0x2f7d('0x2e')]);return db[_0x2f7d('0x1f')]['find'](_0xbf6a79)[_0x2f7d('0x18')](handleEntityNotFound(_0xb4c5c5,null))[_0x2f7d('0x18')](respondWithResult(_0xb4c5c5,null))[_0x2f7d('0x2f')](handleError(_0xb4c5c5,null));};exports[_0x2f7d('0x30')]=function(_0x3d5217,_0x4ff6f1){return db[_0x2f7d('0x1f')][_0x2f7d('0x30')](_0x3d5217[_0x2f7d('0x31')],{})[_0x2f7d('0x18')](respondWithResult(_0x4ff6f1,0xc9))['catch'](handleError(_0x4ff6f1,null));};exports[_0x2f7d('0x17')]=function(_0x168bc0,_0x44d3c6){if(_0x168bc0[_0x2f7d('0x31')]['id']){delete _0x168bc0[_0x2f7d('0x31')]['id'];}return db[_0x2f7d('0x1f')][_0x2f7d('0x32')]({'where':{'id':_0x168bc0['params']['id']}})[_0x2f7d('0x18')](handleEntityNotFound(_0x44d3c6,null))[_0x2f7d('0x18')](saveUpdates(_0x168bc0[_0x2f7d('0x31')],null))[_0x2f7d('0x18')](respondWithResult(_0x44d3c6,null))[_0x2f7d('0x2f')](handleError(_0x44d3c6,null));};exports[_0x2f7d('0x19')]=function(_0x1b599f,_0x5aea22){return db[_0x2f7d('0x1f')][_0x2f7d('0x32')]({'where':{'id':_0x1b599f[_0x2f7d('0x33')]['id']}})['then'](handleEntityNotFound(_0x5aea22,null))[_0x2f7d('0x18')](removeEntity(_0x5aea22,null))[_0x2f7d('0x2f')](handleError(_0x5aea22,null));};exports[_0x2f7d('0x34')]=function(_0x352eff,_0x3f58f1){return db[_0x2f7d('0x1f')][_0x2f7d('0x34')]()[_0x2f7d('0x18')](respondWithResult(_0x3f58f1,null))['catch'](handleError(_0x3f58f1,null));};exports[_0x2f7d('0x35')]=function(_0x1a5908,_0x19d654){return db[_0x2f7d('0x36')][_0x2f7d('0x32')]({'where':{'id':_0x1a5908[_0x2f7d('0x33')]['id']}})['then'](handleEntityNotFound(_0x19d654,null))[_0x2f7d('0x18')](function(_0x36c71f){if(_0x36c71f){return _0x36c71f['addMessage'](_0x1a5908[_0x2f7d('0x31')][_0x2f7d('0x37')],_[_0x2f7d('0x38')](_0x1a5908[_0x2f7d('0x31')],[_0x2f7d('0x37'),'id'])||{});}})['then'](respondWithResult(_0x19d654,null))[_0x2f7d('0x2f')](handleError(_0x19d654,null));};exports['getMessages']=function(_0x21cbc4,_0x55cf65){var _0x13443a={'raw':![],'where':{}};var _0x833fc4={};var _0x59296c={'count':0x0,'rows':[]};return db[_0x2f7d('0x1f')][_0x2f7d('0x39')]({'where':{'id':_0x21cbc4[_0x2f7d('0x33')]['id']}})['then'](handleEntityNotFound(_0x55cf65,null))[_0x2f7d('0x18')](function(_0xdc5d3b){if(_0xdc5d3b){_0x833fc4[_0x2f7d('0x2a')]=_[_0x2f7d('0x27')](db[_0x2f7d('0x36')]['rawAttributes']);_0x833fc4['query']=_[_0x2f7d('0x27')](_0x21cbc4['query']);_0x833fc4['filters']=_[_0x2f7d('0x29')](_0x833fc4['model'],_0x833fc4['query']);_0x13443a[_0x2f7d('0x2b')]=_[_0x2f7d('0x29')](_0x833fc4[_0x2f7d('0x2a')],qs[_0x2f7d('0x2c')](_0x21cbc4['query'][_0x2f7d('0x2c')]));_0x13443a['attributes']=_0x13443a['attributes']['length']?_0x13443a['attributes']:_0x833fc4[_0x2f7d('0x2a')];if(!_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x3a')](_0x2f7d('0x3b'))){_0x13443a[_0x2f7d('0x14')]=qs[_0x2f7d('0x14')](_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x14')]);_0x13443a['offset']=qs['offset'](_0x21cbc4['query'][_0x2f7d('0x13')]);}_0x13443a[_0x2f7d('0x3c')]=qs[_0x2f7d('0x3d')](_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x3d')]);_0x13443a[_0x2f7d('0x3e')]=qs['filters'](_['pick'](_0x21cbc4[_0x2f7d('0x26')],_0x833fc4[_0x2f7d('0x28')]));_0x13443a['where']['WhatsappInteractionId']=_0xdc5d3b['id'];if(_0x21cbc4['query'][_0x2f7d('0x3f')]){_0x13443a[_0x2f7d('0x3e')]=_['merge'](_0x13443a[_0x2f7d('0x3e')],{'$or':_[_0x2f7d('0x40')](_0x13443a[_0x2f7d('0x2b')],function(_0x5924c0){var _0x8cf61={};_0x8cf61[_0x5924c0]={'$like':'%'+_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x3f')]+'%'};return _0x8cf61;})});}if(_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x41')]){var _0x1e5e04=_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x41')]['split'](',');var _0x22e0d5={};_0x22e0d5[_0x1e5e04[0x0]]={'$gte':moment(_0x1e5e04[0x1])[_0x2f7d('0x42')](_0x2f7d('0x43'))};_0x13443a[_0x2f7d('0x3e')]=_[_0x2f7d('0x2d')](_0x13443a[_0x2f7d('0x3e')],_0x22e0d5);}_0x13443a=_[_0x2f7d('0x2d')]({},_0x13443a,_0x21cbc4['options']);return db[_0x2f7d('0x36')]['count']({'where':_0x13443a[_0x2f7d('0x3e')]})['then'](function(_0x2558a0){_0x59296c[_0x2f7d('0x15')]=_0x2558a0;if(_0x21cbc4[_0x2f7d('0x26')][_0x2f7d('0x44')]){_0x13443a[_0x2f7d('0x45')]=[{'all':!![]}];}return db[_0x2f7d('0x36')]['findAll'](_0x13443a);})[_0x2f7d('0x18')](function(_0x496d9){_0x59296c[_0x2f7d('0x46')]=_0x496d9;return _0x59296c;});}})[_0x2f7d('0x18')](respondWithFilteredResult(_0x55cf65,_0x13443a))[_0x2f7d('0x2f')](handleError(_0x55cf65,null));};exports[_0x2f7d('0x47')]=function(_0x453575,_0x313ecd){return db[_0x2f7d('0x1f')]['find']({'where':{'id':_0x453575['params']['id']}})['then'](handleEntityNotFound(_0x313ecd,null))[_0x2f7d('0x18')](function(_0x462d61){if(_0x462d61){return _0x462d61[_0x2f7d('0x48')](_0x453575[_0x2f7d('0x31')]['ids'],_[_0x2f7d('0x38')](_0x453575[_0x2f7d('0x31')],[_0x2f7d('0x37'),'id'])||{})['spread'](function(){return db[_0x2f7d('0x49')][_0x2f7d('0x4a')]({'attributes':['id',_0x2f7d('0x1c'),_0x2f7d('0x4b')],'where':{'id':_0x453575[_0x2f7d('0x31')][_0x2f7d('0x37')]}});})[_0x2f7d('0x18')](function(_0x4dcb5b){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x453575[_0x2f7d('0x33')]['id']),'tags':_0x4dcb5b||[]});return{'id':Number(_0x453575[_0x2f7d('0x33')]['id']),'tags':_0x4dcb5b||[]};});}})[_0x2f7d('0x18')](respondWithResult(_0x313ecd,null))[_0x2f7d('0x2f')](handleError(_0x313ecd,null));};exports[_0x2f7d('0x4c')]=function(_0x27db89,_0x32887f){return db['WhatsappInteraction'][_0x2f7d('0x32')]({'where':{'id':_0x27db89[_0x2f7d('0x33')]['id']}})[_0x2f7d('0x18')](handleEntityNotFound(_0x32887f,null))['then'](function(_0x368ef8){if(_0x368ef8){return _0x368ef8[_0x2f7d('0x4c')](_0x27db89[_0x2f7d('0x26')][_0x2f7d('0x37')]);}})[_0x2f7d('0x18')](respondWithStatusCode(_0x32887f,null))[_0x2f7d('0x2f')](handleError(_0x32887f,null));};exports['download']=function(_0x154af6,_0x19888a){var _0x2a6fc9=moment()[_0x2f7d('0x4d')]()[_0x2f7d('0x4e')]();var _0x1e844b=path[_0x2f7d('0x4f')](config[_0x2f7d('0x50')],_0x2f7d('0x51'),'files',_0x2f7d('0x52'));var _0x22dfd8=path['join'](config[_0x2f7d('0x50')],_0x2f7d('0x51'),_0x2f7d('0x53'),_0x2f7d('0x54'));var _0x4f0d31=path[_0x2f7d('0x4f')](_0x1e844b,_0x2a6fc9);var _0x4c2231=util[_0x2f7d('0x42')](_0x2f7d('0x55'),_0x154af6[_0x2f7d('0x33')]['id'],_0x2a6fc9);var _0x50bc0f=path[_0x2f7d('0x4f')](_0x1e844b,_0x4c2231);var _0x40c03e=[];_0x40c03e[_0x2f7d('0x56')]({'model':db[_0x2f7d('0x57')],'as':_0x2f7d('0x57'),'attributes':['id',_0x2f7d('0x58')],'raw':!![]});_0x40c03e[_0x2f7d('0x56')]({'model':db[_0x2f7d('0x59')],'as':_0x2f7d('0x5a'),'attributes':['id',_0x2f7d('0x5b'),_0x2f7d('0x5c')],'raw':!![]});if(_0x154af6[_0x2f7d('0x26')]['attachments']){_0x40c03e[_0x2f7d('0x56')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x105630=[{'model':db[_0x2f7d('0x36')],'as':_0x2f7d('0x5d'),'attributes':['id',_0x2f7d('0x31'),'createdAt',_0x2f7d('0x5e'),_0x2f7d('0x5f'),_0x2f7d('0x60')],'include':_0x40c03e}];_0x105630[_0x2f7d('0x56')]({'model':db[_0x2f7d('0x61')],'as':_0x2f7d('0x62'),'attributes':['id',_0x2f7d('0x1c')]});_0x105630[_0x2f7d('0x56')]({'model':db[_0x2f7d('0x57')],'as':_0x2f7d('0x63'),'attributes':['id',_0x2f7d('0x58')]});return db[_0x2f7d('0x1f')][_0x2f7d('0x32')]({'where':{'id':_0x154af6[_0x2f7d('0x33')]['id']},'include':_0x105630})[_0x2f7d('0x18')](handleEntityNotFound(_0x19888a,null))[_0x2f7d('0x18')](function(_0x252f2a){if(_0x252f2a){var _0x2517bc=_0x252f2a['get']({'plain':!![]});fs[_0x2f7d('0x64')](_0x4f0d31);var _0xe4f09e={'channel':_0x2f7d('0x65'),'account':_0x2517bc[_0x2f7d('0x62')][_0x2f7d('0x1c')],'agent':_0x2517bc['Owner']?_0x2517bc[_0x2f7d('0x63')]['fullname']:_0x2f7d('0x66'),'createdAt':moment(_0x2517bc[_0x2f7d('0x67')])[_0x2f7d('0x42')](_0x2f7d('0x43'))[_0x2f7d('0x4e')](),'closedAt':_0x2517bc[_0x2f7d('0x68')]?moment(_0x2517bc[_0x2f7d('0x69')])[_0x2f7d('0x42')](_0x2f7d('0x43'))[_0x2f7d('0x4e')]():'','disposition':_0x2517bc[_0x2f7d('0x6a')],'messages':_(_0x2517bc[_0x2f7d('0x5d')])[_0x2f7d('0x3f')]({'secret':![]})[_0x2f7d('0x40')](function(_0x27eacb){if(_0x27eacb[_0x2f7d('0x6b')]){var _0x3423ab=path[_0x2f7d('0x4f')](_0x22dfd8,_0x27eacb['Attachment'][_0x2f7d('0x6c')]);if(fs[_0x2f7d('0x6d')](_0x3423ab)){fs['createReadStream'](_0x3423ab)[_0x2f7d('0x6e')](fs[_0x2f7d('0x6f')](path[_0x2f7d('0x4f')](_0x4f0d31,_0x27eacb['Attachment'][_0x2f7d('0x6c')])));}}return{'date':moment(_0x27eacb[_0x2f7d('0x67')])[_0x2f7d('0x42')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2f7d('0x4e')](),'sender':_0x27eacb['direction']==='out'?_0x27eacb[_0x2f7d('0x57')]?_0x27eacb[_0x2f7d('0x57')][_0x2f7d('0x58')]:'System':_0x27eacb[_0x2f7d('0x5a')][_0x2f7d('0x5b')]+(_0x27eacb['Contact'][_0x2f7d('0x5c')]?'\x20'+_0x27eacb[_0x2f7d('0x5a')][_0x2f7d('0x5c')]:''),'body':_0x27eacb[_0x2f7d('0x6b')]?_0x27eacb[_0x2f7d('0x6b')][_0x2f7d('0x6c')]:_0x27eacb[_0x2f7d('0x31')],'direction':_0x27eacb[_0x2f7d('0x5e')]===_0x2f7d('0x70')?'A':'C','secret':_0x27eacb[_0x2f7d('0x5f')],'read':_0x27eacb['read'],'attachment':_0x27eacb['Attachment']};})[_0x2f7d('0x71')]()};return ejs['renderFile'](path['join'](config[_0x2f7d('0x50')],'server',_0x2f7d('0x72'),_0x2f7d('0x73')),{'interaction':_0xe4f09e})[_0x2f7d('0x18')](function(_0x1510ab){var _0x41da75=path[_0x2f7d('0x4f')](_0x4f0d31,_0x2f7d('0x74')+_0x2517bc['id']+'-'+_0x2a6fc9+_0x2f7d('0x75'));var _0x28b544={'path':_0x41da75,'channel':'Whatsapp','interactionId':_0x2517bc['id']};return pdf[_0x2f7d('0x76')](_0x1510ab,_0x28b544);})['then'](function(){return new BPromise(function(_0x96d285,_0x2ea900){zipdir(_0x4f0d31,{'saveTo':_0x50bc0f},function(_0x10c60d,_0x2bd75b){if(_0x10c60d)return _0x2ea900(_0x10c60d);return _0x96d285(_0x2bd75b);});})[_0x2f7d('0x18')](function(){return new BPromise(function(_0x510cf9,_0x3b8c0a){rimraf(_0x4f0d31,function(_0x335dc3){if(_0x335dc3)_0x3b8c0a(_0x335dc3);return _0x510cf9();});});})[_0x2f7d('0x18')](function(){return _0x19888a['download'](_0x50bc0f,_0x4c2231,function(_0x29d5ce){if(_0x29d5ce){console['log'](_0x2f7d('0x77'),_0x29d5ce);}else{fs[_0x2f7d('0x78')](_0x50bc0f);}});});});}else{return _0x19888a[_0x2f7d('0xf')](0xc8);}})[_0x2f7d('0x2f')](handleError(_0x19888a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a313f4b..cdc4a18 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 _0x7229=['../../mysqldb','WhatsappInteraction','WhatsappMessage','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','events'];(function(_0x5b5ffe,_0x1c5874){var _0x2d12bc=function(_0x14d075){while(--_0x14d075){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x2d12bc(++_0x1c5874);}(_0x7229,0x76));var _0x9722=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7229[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x9722('0x0'));var WhatsappInteraction=require(_0x9722('0x1'))['db'][_0x9722('0x2')];var WhatsappMessage=require(_0x9722('0x1'))['db'][_0x9722('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9722('0x4'),'afterDestroy':_0x9722('0x5')};function emitEvent(_0x43fcea){return function(_0x8f2a98,_0x7fae8c,_0x43e0ed){_0x8f2a98[_0x9722('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x161765){_0x8f2a98['setDataValue'](_0x9722('0x7'),_0x161765[_0x9722('0x8')](function(_0x185f94){return{'id':_0x185f94['id']};}));return WhatsappMessage[_0x9722('0x9')]({'where':{'WhatsappInteractionId':_0x8f2a98['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9722('0xa')](function(_0x408509){_0x8f2a98[_0x9722('0xb')](_0x9722('0xc'),_0x408509['length']);WhatsappInteractionEvents['emit'](_0x43fcea+':'+_0x8f2a98['id'],_0x8f2a98);WhatsappInteractionEvents[_0x9722('0xd')](_0x43fcea,_0x8f2a98);_0x43e0ed(null);})[_0x9722('0xe')](_0x43e0ed(null));};}for(var e in events){if(events[_0x9722('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9722('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xc6d8=['unreadMessages','length','emit','catch','hook','events','WhatsappInteraction','WhatsappMessage','save','getUsers','then','Users','map','setDataValue'];(function(_0x50395f,_0x1ea864){var _0x5bd21c=function(_0x478183){while(--_0x478183){_0x50395f['push'](_0x50395f['shift']());}};_0x5bd21c(++_0x1ea864);}(_0xc6d8,0xd7));var _0x8c6d=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0xc6d8[_0xdbd4f7];return _0x5c3f9d;};'use strict';var EventEmitter=require(_0x8c6d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8c6d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8c6d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c6d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352b8c){return function(_0xdff6f,_0x17781d,_0x4f5e8f){_0xdff6f[_0x8c6d('0x4')]({'attributes':['id'],'raw':!![]})[_0x8c6d('0x5')](function(_0x98cae4){_0xdff6f['setDataValue'](_0x8c6d('0x6'),_0x98cae4[_0x8c6d('0x7')](function(_0x16d4b2){return{'id':_0x16d4b2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xdff6f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c6d('0x5')](function(_0x1ec65c){_0xdff6f[_0x8c6d('0x8')](_0x8c6d('0x9'),_0x1ec65c[_0x8c6d('0xa')]);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c+':'+_0xdff6f['id'],_0xdff6f);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c,_0xdff6f);_0x4f5e8f(null);})[_0x8c6d('0xc')](_0x4f5e8f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x8c6d('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3088009..8a153c8 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 _0xeb8d=['whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','rimraf','./whatsappInteraction.attributes','define'];(function(_0x372c73,_0x30a399){var _0x5e6c9e=function(_0x2c4f38){while(--_0x2c4f38){_0x372c73['push'](_0x372c73['shift']());}};_0x5e6c9e(++_0x30a399);}(_0xeb8d,0x89));var _0xdeb8=function(_0x3960e5,_0x1b5e72){_0x3960e5=_0x3960e5-0x0;var _0x3e0dbf=_0xeb8d[_0x3960e5];return _0x3e0dbf;};'use strict';var _=require(_0xdeb8('0x0'));var util=require(_0xdeb8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdeb8('0x2'));var BPromise=require('bluebird');var rp=require(_0xdeb8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdeb8('0x4'));var config=require('../../config/environment');var attributes=require(_0xdeb8('0x5'));module['exports']=function(_0x58b82b,_0x2a2844){return _0x58b82b[_0xdeb8('0x6')]('WhatsappInteraction',attributes,{'tableName':_0xdeb8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x112853,_0x554abb,_0x3ad675){if(_0x112853['changed'](_0xdeb8('0x8'))){_0x112853[_0xdeb8('0x9')]=moment()[_0xdeb8('0xa')](_0xdeb8('0xb'));}_0x3ad675(null,_0x112853);}}});}; \ No newline at end of file +var _0xd9eb=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd9eb,0xca));var _0xbd9e=function(_0x451b32,_0x1eace6){_0x451b32=_0x451b32-0x0;var _0x4ac489=_0xd9eb[_0x451b32];return _0x4ac489;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2dbf84,_0x20cddf,_0x7755b8){if(_0x2dbf84[_0xbd9e('0xf')](_0xbd9e('0x10'))){_0x2dbf84[_0xbd9e('0x11')]=moment()[_0xbd9e('0x12')](_0xbd9e('0x13'));}_0x7755b8(null,_0x2dbf84);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6ea46d2..15efa53 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 _0x91d1=['socket.io-emitter','./whatsappInteraction.socket','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','stringify','addTags','ids','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost'];(function(_0x2f3de0,_0x4d1935){var _0x259d82=function(_0x11f282){while(--_0x11f282){_0x2f3de0['push'](_0x2f3de0['shift']());}};_0x259d82(++_0x4d1935);}(_0x91d1,0x1ed));var _0x191d=function(_0x1f4d4f,_0x195a3b){_0x1f4d4f=_0x1f4d4f-0x0;var _0x16abbf=_0x91d1[_0x1f4d4f];return _0x16abbf;};'use strict';var _=require(_0x191d('0x0'));var util=require(_0x191d('0x1'));var moment=require(_0x191d('0x2'));var BPromise=require(_0x191d('0x3'));var rs=require(_0x191d('0x4'));var fs=require('fs');var Redis=require(_0x191d('0x5'));var db=require(_0x191d('0x6'))['db'];var utils=require(_0x191d('0x7'));var logger=require(_0x191d('0x8'))(_0x191d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x191d('0xa')]['http']({'port':0x232a});config[_0x191d('0xb')]=_[_0x191d('0xc')](config[_0x191d('0xb')],{'host':_0x191d('0xd'),'port':0x18eb});var socket=require(_0x191d('0xe'))(new Redis(config[_0x191d('0xb')]));require(_0x191d('0xf'))['register'](socket);function respondWithRpcPromise(_0x4fac9d,_0x25517e,_0xbbbe4f){return new BPromise(function(_0xfe2b0b,_0x18193b){return client['request'](_0x4fac9d,_0xbbbe4f)[_0x191d('0x10')](function(_0x18d524){logger['info'](_0x191d('0x11'),_0x25517e,_0x191d('0x12'));logger[_0x191d('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x25517e,_0x191d('0x12'),JSON['stringify'](_0x18d524));if(_0x18d524[_0x191d('0x14')]){if(_0x18d524[_0x191d('0x14')]['code']===0x1f4){logger[_0x191d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x25517e,_0x18d524[_0x191d('0x14')][_0x191d('0x15')]);return _0x18193b(_0x18d524[_0x191d('0x14')]['message']);}logger['error'](_0x191d('0x11'),_0x25517e,_0x18d524[_0x191d('0x14')][_0x191d('0x15')]);return _0xfe2b0b(_0x18d524[_0x191d('0x14')][_0x191d('0x15')]);}else{logger['info'](_0x191d('0x11'),_0x25517e,_0x191d('0x12'));_0xfe2b0b(_0x18d524[_0x191d('0x16')][_0x191d('0x15')]);}})[_0x191d('0x17')](function(_0x310bd1){logger['error'](_0x191d('0x11'),_0x25517e,_0x310bd1);_0x18193b(_0x310bd1);});});}exports[_0x191d('0x18')]=function(_0x5bd323){var _0x5f4527=this;return new Promise(function(_0x338e4a,_0x3a69d2){return db[_0x191d('0x19')][_0x191d('0x1a')](_0x5bd323[_0x191d('0x1b')],{'raw':_0x5bd323[_0x191d('0x1c')]?_0x5bd323['options'][_0x191d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bd323[_0x191d('0x1c')]?_0x5bd323[_0x191d('0x1c')][_0x191d('0x1e')]||null:null,'attributes':_0x5bd323[_0x191d('0x1c')]?_0x5bd323[_0x191d('0x1c')][_0x191d('0x1f')]||null:null,'limit':_0x5bd323[_0x191d('0x1c')]?_0x5bd323[_0x191d('0x1c')]['limit']||null:null})['then'](function(_0x29b2ae){logger['info'](_0x191d('0x18'),_0x5bd323);logger[_0x191d('0x13')](_0x191d('0x18'),_0x5bd323,JSON[_0x191d('0x20')](_0x29b2ae));_0x338e4a(_0x29b2ae);})['catch'](function(_0x5831f8){logger[_0x191d('0x14')]('UpdateWhatsappInteraction',_0x5831f8['message'],_0x5bd323);_0x3a69d2(_0x5f4527[_0x191d('0x14')](0x1f4,_0x5831f8[_0x191d('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x51bf80){return new Promise(function(_0x528530,_0xd92685){return db[_0x191d('0x19')]['find']({'where':_0x51bf80[_0x191d('0x1c')]?_0x51bf80[_0x191d('0x1c')][_0x191d('0x1e')]||null:null})['then'](function(_0x240ed9){if(_0x240ed9){return _0x240ed9[_0x191d('0x21')](_0x51bf80[_0x191d('0x1b')][_0x191d('0x22')],_[_0x191d('0x23')](_0x51bf80['body'],[_0x191d('0x22'),'id'])||{});}})[_0x191d('0x24')](function(_0x49ce41){logger[_0x191d('0x25')]('AddTags',_0x51bf80);logger['debug'](_0x191d('0x26'),_0x51bf80,JSON['stringify'](_0x49ce41));_0x528530(_0x49ce41);})[_0x191d('0x17')](function(_0x181b42){logger['error'](_0x191d('0x26'),_0x181b42[_0x191d('0x15')],_0x51bf80);_0xd92685(_this[_0x191d('0x14')](0x1f4,_0x181b42[_0x191d('0x15')]));});});}; \ No newline at end of file +var _0x0df5=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x1972de,_0x1e0efb){var _0x1591a3=function(_0x24be21){while(--_0x24be21){_0x1972de['push'](_0x1972de['shift']());}};_0x1591a3(++_0x1e0efb);}(_0x0df5,0x114));var _0x50df=function(_0x2af67a,_0x11e127){_0x2af67a=_0x2af67a-0x0;var _0x14a933=_0x0df5[_0x2af67a];return _0x14a933;};'use strict';var _=require(_0x50df('0x0'));var util=require(_0x50df('0x1'));var moment=require(_0x50df('0x2'));var BPromise=require(_0x50df('0x3'));var rs=require(_0x50df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x50df('0x6'))(_0x50df('0x7'));var config=require('../../config/environment');var jayson=require(_0x50df('0x8'));var client=jayson['client'][_0x50df('0x9')]({'port':0x232a});config['redis']=_[_0x50df('0xa')](config[_0x50df('0xb')],{'host':_0x50df('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50df('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e8f62,_0x462494,_0xaeed76){return new BPromise(function(_0x39e3d5,_0x4f9c9f){return client[_0x50df('0xe')](_0x5e8f62,_0xaeed76)[_0x50df('0xf')](function(_0x2557f2){logger[_0x50df('0x10')](_0x50df('0x11'),_0x462494,'request\x20sent');logger['debug'](_0x50df('0x12'),_0x462494,'request\x20sent',JSON['stringify'](_0x2557f2));if(_0x2557f2['error']){if(_0x2557f2[_0x50df('0x13')][_0x50df('0x14')]===0x1f4){logger['error'](_0x50df('0x11'),_0x462494,_0x2557f2[_0x50df('0x13')][_0x50df('0x15')]);return _0x4f9c9f(_0x2557f2['error']['message']);}logger['error'](_0x50df('0x11'),_0x462494,_0x2557f2[_0x50df('0x13')][_0x50df('0x15')]);return _0x39e3d5(_0x2557f2[_0x50df('0x13')][_0x50df('0x15')]);}else{logger[_0x50df('0x10')](_0x50df('0x11'),_0x462494,_0x50df('0x16'));_0x39e3d5(_0x2557f2[_0x50df('0x17')][_0x50df('0x15')]);}})[_0x50df('0x18')](function(_0x452944){logger[_0x50df('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x462494,_0x452944);_0x4f9c9f(_0x452944);});});}exports[_0x50df('0x19')]=function(_0xb476fb){var _0x3037a6=this;return new Promise(function(_0x44b227,_0x51c517){return db[_0x50df('0x1a')][_0x50df('0x1b')](_0xb476fb[_0x50df('0x1c')],{'raw':_0xb476fb['options']?_0xb476fb[_0x50df('0x1d')][_0x50df('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb476fb[_0x50df('0x1d')]?_0xb476fb[_0x50df('0x1d')][_0x50df('0x1f')]||null:null,'attributes':_0xb476fb[_0x50df('0x1d')]?_0xb476fb['options'][_0x50df('0x20')]||null:null,'limit':_0xb476fb[_0x50df('0x1d')]?_0xb476fb[_0x50df('0x1d')][_0x50df('0x21')]||null:null})[_0x50df('0xf')](function(_0x4ad773){logger[_0x50df('0x10')]('UpdateWhatsappInteraction',_0xb476fb);logger['debug'](_0x50df('0x19'),_0xb476fb,JSON[_0x50df('0x22')](_0x4ad773));_0x44b227(_0x4ad773);})[_0x50df('0x18')](function(_0x4ab73e){logger[_0x50df('0x13')](_0x50df('0x19'),_0x4ab73e['message'],_0xb476fb);_0x51c517(_0x3037a6[_0x50df('0x13')](0x1f4,_0x4ab73e[_0x50df('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x400bdd){return new Promise(function(_0x48fab4,_0x4beabb){return db[_0x50df('0x1a')][_0x50df('0x23')]({'where':_0x400bdd[_0x50df('0x1d')]?_0x400bdd[_0x50df('0x1d')][_0x50df('0x1f')]||null:null})[_0x50df('0xf')](function(_0x853fa){if(_0x853fa){return _0x853fa['addTags'](_0x400bdd[_0x50df('0x1c')][_0x50df('0x24')],_[_0x50df('0x25')](_0x400bdd[_0x50df('0x1c')],['ids','id'])||{});}})[_0x50df('0x26')](function(_0x109aa3){logger[_0x50df('0x10')](_0x50df('0x27'),_0x400bdd);logger['debug'](_0x50df('0x27'),_0x400bdd,JSON[_0x50df('0x22')](_0x109aa3));_0x48fab4(_0x109aa3);})['catch'](function(_0x2afc1c){logger[_0x50df('0x13')](_0x50df('0x27'),_0x2afc1c[_0x50df('0x15')],_0x400bdd);_0x4beabb(_this['error'](0x1f4,_0x2afc1c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 18a4b93..48a5154 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 _0xc989=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc989,0xd8));var _0x9c98=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc989[_0x167cc1];return _0x10bc4b;};'use strict';var WhatsappInteractionEvents=require(_0x9c98('0x0'));var events=[_0x9c98('0x1'),_0x9c98('0x2'),_0x9c98('0x3')];function createListener(_0x50db27,_0x70514b){return function(_0x1fdcd6){_0x70514b[_0x9c98('0x4')](_0x50db27,_0x1fdcd6);};}function removeListener(_0x250dfb,_0x43f5a0){return function(){WhatsappInteractionEvents[_0x9c98('0x5')](_0x250dfb,_0x43f5a0);};}exports[_0x9c98('0x6')]=function(_0x1f4168){for(var _0x5bd669=0x0,_0x1d76cb=events[_0x9c98('0x7')];_0x5bd669<_0x1d76cb;_0x5bd669++){var _0x36ff1f=events[_0x5bd669];var _0x1b2116=createListener(_0x9c98('0x8')+_0x36ff1f,_0x1f4168);WhatsappInteractionEvents['on'](_0x36ff1f,_0x1b2116);}}; \ No newline at end of file +var _0xffdf=['whatsappInteraction:','./whatsappInteraction.events','save','remove','register'];(function(_0x2eff18,_0x5ab475){var _0x34ccb8=function(_0x157bd6){while(--_0x157bd6){_0x2eff18['push'](_0x2eff18['shift']());}};_0x34ccb8(++_0x5ab475);}(_0xffdf,0x1a5));var _0xfffd=function(_0x22df72,_0x53eda7){_0x22df72=_0x22df72-0x0;var _0x289287=_0xffdf[_0x22df72];return _0x289287;};'use strict';var WhatsappInteractionEvents=require(_0xfffd('0x0'));var events=[_0xfffd('0x1'),_0xfffd('0x2'),'update'];function createListener(_0x4f99d3,_0x2cc439){return function(_0x49b491){_0x2cc439['emit'](_0x4f99d3,_0x49b491);};}function removeListener(_0x5c644f,_0x2065b9){return function(){WhatsappInteractionEvents['removeListener'](_0x5c644f,_0x2065b9);};}exports[_0xfffd('0x3')]=function(_0x175fde){for(var _0x47b800=0x0,_0x24309c=events['length'];_0x47b800<_0x24309c;_0x47b800++){var _0x2ac4ad=events[_0x47b800];var _0x5b073a=createListener(_0xfffd('0x4')+_0x2ac4ad,_0x175fde);WhatsappInteractionEvents['on'](_0x2ac4ad,_0x5b073a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a6708b6..e37223e 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 _0x44c9=['reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsappmessage:create','status','put','update','/:id/accept','/:id/reject'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x44c9,0x112));var _0x944c=function(_0x5c41e9,_0x435daf){_0x5c41e9=_0x5c41e9-0x0;var _0x2dcb5c=_0x44c9[_0x5c41e9];return _0x2dcb5c;};'use strict';var multer=require(_0x944c('0x0'));var util=require(_0x944c('0x1'));var path=require(_0x944c('0x2'));var timeout=require('connect-timeout');var express=require(_0x944c('0x3'));var router=express[_0x944c('0x4')]();var fs_extra=require(_0x944c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x944c('0x6'));var config=require(_0x944c('0x7'));var controller=require(_0x944c('0x8'));router[_0x944c('0x9')]('/',auth[_0x944c('0xa')](),controller[_0x944c('0xb')]);router['get'](_0x944c('0xc'),auth['isAuthenticated'](),controller[_0x944c('0xd')]);router[_0x944c('0x9')](_0x944c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x944c('0xf')]('/',auth[_0x944c('0xa')](),interaction[_0x944c('0x10')]('whatsapp',_0x944c('0x11')),controller['create']);router['post']('/:id/status',controller[_0x944c('0x12')]);router[_0x944c('0x13')](_0x944c('0xe'),auth['isAuthenticated'](),controller[_0x944c('0x14')]);router[_0x944c('0x13')](_0x944c('0x15'),auth[_0x944c('0xa')](),controller['accept']);router['put'](_0x944c('0x16'),auth[_0x944c('0xa')](),controller[_0x944c('0x17')]);router[_0x944c('0x18')](_0x944c('0xe'),auth[_0x944c('0xa')](),controller[_0x944c('0x19')]);module[_0x944c('0x1a')]=router; \ No newline at end of file +var _0x4423=['./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show','tracked','whatsapp','whatsappmessage:create','post','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4423,0x8a));var _0x3442=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4423[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x3442('0x0'));var util=require(_0x3442('0x1'));var path=require(_0x3442('0x2'));var timeout=require(_0x3442('0x3'));var express=require(_0x3442('0x4'));var router=express[_0x3442('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3442('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3442('0x7'));router[_0x3442('0x8')]('/',auth['isAuthenticated'](),controller[_0x3442('0x9')]);router[_0x3442('0x8')](_0x3442('0xa'),auth[_0x3442('0xb')](),controller[_0x3442('0xc')]);router[_0x3442('0x8')]('/:id',auth[_0x3442('0xb')](),controller[_0x3442('0xd')]);router['post']('/',auth[_0x3442('0xb')](),interaction[_0x3442('0xe')](_0x3442('0xf'),_0x3442('0x10')),controller['create']);router[_0x3442('0x11')]('/:id/status',controller[_0x3442('0x12')]);router[_0x3442('0x13')](_0x3442('0x14'),auth[_0x3442('0xb')](),controller[_0x3442('0x15')]);router[_0x3442('0x13')](_0x3442('0x16'),auth['isAuthenticated'](),controller[_0x3442('0x17')]);router[_0x3442('0x13')](_0x3442('0x18'),auth[_0x3442('0xb')](),controller[_0x3442('0x19')]);router[_0x3442('0x1a')](_0x3442('0x14'),auth['isAuthenticated'](),controller[_0x3442('0x1b')]);module[_0x3442('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 12347f6..53f2c0f 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 _0x8bea=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4127dc,_0x5558fe){var _0x310070=function(_0x190691){while(--_0x190691){_0x4127dc['push'](_0x4127dc['shift']());}};_0x310070(++_0x5558fe);}(_0x8bea,0xfc));var _0xa8be=function(_0x25f94c,_0x43702f){_0x25f94c=_0x25f94c-0x0;var _0x2693f0=_0x8bea[_0x25f94c];return _0x2693f0;};'use strict';var Sequelize=require(_0xa8be('0x0'));module[_0xa8be('0x1')]={'body':{'type':Sequelize[_0xa8be('0x2')](_0xa8be('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa8be('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8be('0x5')]('in','out'),'defaultValue':_0xa8be('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa8be('0x7')](0xbe)},'phone':{'type':Sequelize[_0xa8be('0x7')]},'readAt':{'type':Sequelize[_0xa8be('0x8')]},'secret':{'type':Sequelize[_0xa8be('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa8be('0x7')]},'providerResponse':{'type':Sequelize[_0xa8be('0x2')]}}; \ No newline at end of file +var _0x3604=['DATE','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x463645,_0x3b9949){var _0x4778cb=function(_0x3624ea){while(--_0x3624ea){_0x463645['push'](_0x463645['shift']());}};_0x4778cb(++_0x3b9949);}(_0x3604,0x174));var _0x4360=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3604[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module[_0x4360('0x0')]={'body':{'type':Sequelize[_0x4360('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4360('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4360('0x3')]('in',_0x4360('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4360('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4360('0x5')]},'readAt':{'type':Sequelize[_0x4360('0x6')]},'secret':{'type':Sequelize[_0x4360('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4360('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 73516a4..988f454 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 _0x1fda=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','destroy','describe','../../config/logger','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','role','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fda,0x173));var _0xa1fd=function(_0x96ccd0,_0x484539){_0x96ccd0=_0x96ccd0-0x0;var _0x7ebf8f=_0x1fda[_0x96ccd0];return _0x7ebf8f;};'use strict';var emlformat=require(_0xa1fd('0x0'));var rimraf=require(_0xa1fd('0x1'));var zipdir=require(_0xa1fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa1fd('0x3'));var BPromise=require(_0xa1fd('0x4'));var Mustache=require(_0xa1fd('0x5'));var util=require(_0xa1fd('0x6'));var path=require('path');var sox=require(_0xa1fd('0x7'));var csv=require('to-csv');var ejs=require(_0xa1fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1fd('0x9'));var squel=require(_0xa1fd('0xa'));var crypto=require(_0xa1fd('0xb'));var jsforce=require(_0xa1fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1fd('0xd'));var querystring=require(_0xa1fd('0xe'));var Papa=require(_0xa1fd('0xf'));var Redis=require(_0xa1fd('0x10'));var authService=require(_0xa1fd('0x11'));var qs=require(_0xa1fd('0x12'));var as=require(_0xa1fd('0x13'));var hardwareService=require(_0xa1fd('0x14'));var logger=require('../../config/logger')(_0xa1fd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1fd('0x16'));var db=require(_0xa1fd('0x17'))['db'];config['redis']=_[_0xa1fd('0x18')](config['redis'],{'host':_0xa1fd('0x19'),'port':0x18eb});var socket=require(_0xa1fd('0x1a'))(new Redis(config[_0xa1fd('0x1b')]));require(_0xa1fd('0x1c'))[_0xa1fd('0x1d')](socket);var jayson=require(_0xa1fd('0x1e'));var client=jayson[_0xa1fd('0x1f')][_0xa1fd('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xa1fd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x12f87d,_0xc77440,_0x5a119e,_0x4bf56f){return new BPromise(function(_0x5e6763,_0x39e574){var _0x56fe4f=_0x4bf56f||client;return _0x56fe4f[_0xa1fd('0x21')](_0x12f87d,_0x5a119e)[_0xa1fd('0x22')](function(_0x39b248){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xc77440,_0xa1fd('0x23'));logger[_0xa1fd('0x24')](_0xa1fd('0x25'),_0xc77440,_0xa1fd('0x23'),JSON[_0xa1fd('0x26')](_0x39b248));if(_0x39b248[_0xa1fd('0x27')]){if(_0x39b248[_0xa1fd('0x27')][_0xa1fd('0x28')]===0x1f4){logger[_0xa1fd('0x27')](_0xa1fd('0x29'),_0xc77440,_0x39b248[_0xa1fd('0x27')]['message']);return _0x39e574(_0x39b248[_0xa1fd('0x27')][_0xa1fd('0x2a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xc77440,_0x39b248[_0xa1fd('0x27')][_0xa1fd('0x2a')]);return _0x5e6763(_0x39b248[_0xa1fd('0x27')][_0xa1fd('0x2a')]);}else{logger[_0xa1fd('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0xc77440,'request\x20sent');_0x5e6763(_0x39b248[_0xa1fd('0x2c')]['message']);}})[_0xa1fd('0x2d')](function(_0x52d5dd){logger['error'](_0xa1fd('0x29'),_0xc77440,_0x52d5dd);_0x39e574(_0x52d5dd);});});}function respondWithStatusCode(_0x3ff576,_0x543449){_0x543449=_0x543449||0xcc;return function(_0x53ab69){if(_0x53ab69){return _0x3ff576['sendStatus'](_0x543449);}return _0x3ff576[_0xa1fd('0x2e')](_0x543449)[_0xa1fd('0x2f')]();};}function respondWithResult(_0x4aac4f,_0x554526){_0x554526=_0x554526||0xc8;return function(_0x2246fd){if(_0x2246fd){return _0x4aac4f[_0xa1fd('0x2e')](_0x554526)[_0xa1fd('0x30')](_0x2246fd);}};}function respondWithFilteredResult(_0xe190d1,_0x3e0cb8){return function(_0x32e2d1){if(_0x32e2d1){var _0x42d84a=typeof _0x3e0cb8[_0xa1fd('0x31')]===_0xa1fd('0x32')&&typeof _0x3e0cb8[_0xa1fd('0x33')]===_0xa1fd('0x32');var _0x145a86=_0x32e2d1[_0xa1fd('0x34')];var _0x3f3093=_0x42d84a?0x0:_0x3e0cb8[_0xa1fd('0x31')];var _0x48a71a=_0x42d84a?_0x32e2d1[_0xa1fd('0x34')]:_0x3e0cb8[_0xa1fd('0x31')]+_0x3e0cb8[_0xa1fd('0x33')];var _0x2a4520;if(_0x48a71a>=_0x145a86){_0x48a71a=_0x145a86;_0x2a4520=0xc8;}else{_0x2a4520=0xce;}_0xe190d1[_0xa1fd('0x2e')](_0x2a4520);return _0xe190d1[_0xa1fd('0x35')](_0xa1fd('0x36'),_0x3f3093+'-'+_0x48a71a+'/'+_0x145a86)[_0xa1fd('0x30')](_0x32e2d1);}return null;};}function patchUpdates(_0x1d7d48){return function(_0x31e19a){try{jsonpatch[_0xa1fd('0x37')](_0x31e19a,_0x1d7d48,!![]);}catch(_0x19d909){return BPromise['reject'](_0x19d909);}return _0x31e19a[_0xa1fd('0x38')]();};}function saveUpdates(_0x43c754,_0x1b4f80){return function(_0x1013ff){if(_0x1013ff){return _0x1013ff[_0xa1fd('0x39')](_0x43c754)[_0xa1fd('0x22')](function(_0x77e0a5){return _0x77e0a5;});}return null;};}function removeEntity(_0x22023e,_0x2a1733){return function(_0x44f0f5){if(_0x44f0f5){return _0x44f0f5['destroy']()[_0xa1fd('0x22')](function(){_0x22023e[_0xa1fd('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d59c2,_0x150847){return function(_0x3ffaf4){if(!_0x3ffaf4){_0x4d59c2['sendStatus'](0x194);}return _0x3ffaf4;};}function handleError(_0x135700,_0x30ee57){_0x30ee57=_0x30ee57||0x1f4;return function(_0x25ae94){logger['error'](_0x25ae94['stack']);if(_0x25ae94[_0xa1fd('0x3a')]){delete _0x25ae94[_0xa1fd('0x3a')];}_0x135700[_0xa1fd('0x2e')](_0x30ee57)['send'](_0x25ae94);};}exports[_0xa1fd('0x3b')]=function(_0x2f2d47,_0x1cd985){var _0x507c34={},_0x9cd3d3={},_0x12b8e7={'count':0x0,'rows':[]};var _0x446c05=_[_0xa1fd('0x3c')](db[_0xa1fd('0x3d')][_0xa1fd('0x3e')],function(_0x219a0f){return{'name':_0x219a0f[_0xa1fd('0x3f')],'type':_0x219a0f[_0xa1fd('0x40')]['key']};});_0x9cd3d3[_0xa1fd('0x41')]=_[_0xa1fd('0x3c')](_0x446c05,_0xa1fd('0x3a'));_0x9cd3d3[_0xa1fd('0x42')]=_['keys'](_0x2f2d47[_0xa1fd('0x42')]);_0x9cd3d3[_0xa1fd('0x43')]=_['intersection'](_0x9cd3d3[_0xa1fd('0x41')],_0x9cd3d3[_0xa1fd('0x42')]);_0x507c34[_0xa1fd('0x44')]=_[_0xa1fd('0x45')](_0x9cd3d3['model'],qs[_0xa1fd('0x46')](_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x46')]));_0x507c34['attributes']=_0x507c34['attributes']['length']?_0x507c34[_0xa1fd('0x44')]:_0x9cd3d3[_0xa1fd('0x41')];if(!_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x47')](_0xa1fd('0x48'))){_0x507c34[_0xa1fd('0x33')]=qs[_0xa1fd('0x33')](_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x33')]);_0x507c34[_0xa1fd('0x31')]=qs[_0xa1fd('0x31')](_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x31')]);}_0x507c34[_0xa1fd('0x49')]=qs[_0xa1fd('0x4a')](_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x4a')]);_0x507c34[_0xa1fd('0x4b')]=qs['filters'](_[_0xa1fd('0x4c')](_0x2f2d47[_0xa1fd('0x42')],_0x9cd3d3['filters']),_0x446c05);if(_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x4d')]){_0x507c34['where']=_[_0xa1fd('0x4e')](_0x507c34[_0xa1fd('0x4b')],{'$or':_[_0xa1fd('0x3c')](_0x446c05,function(_0x42b14c){if(_0x42b14c[_0xa1fd('0x40')]!==_0xa1fd('0x4f')){var _0x4f7698={};_0x4f7698[_0x42b14c[_0xa1fd('0x3a')]]={'$like':'%'+_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x4d')]+'%'};return _0x4f7698;}})});}_0x507c34=_['merge']({},_0x507c34,_0x2f2d47[_0xa1fd('0x50')]);var _0x1ec90a={'where':_0x507c34[_0xa1fd('0x4b')]};return db['WhatsappMessage'][_0xa1fd('0x34')](_0x1ec90a)[_0xa1fd('0x22')](function(_0xeeb81e){_0x12b8e7[_0xa1fd('0x34')]=_0xeeb81e;if(_0x2f2d47[_0xa1fd('0x42')][_0xa1fd('0x51')]){_0x507c34[_0xa1fd('0x52')]=[{'all':!![]}];}return db[_0xa1fd('0x3d')][_0xa1fd('0x53')](_0x507c34);})[_0xa1fd('0x22')](function(_0x44af52){_0x12b8e7[_0xa1fd('0x54')]=_0x44af52;return _0x12b8e7;})[_0xa1fd('0x22')](respondWithFilteredResult(_0x1cd985,_0x507c34))['catch'](handleError(_0x1cd985,null));};exports[_0xa1fd('0x55')]=function(_0x474318,_0x2241af){var _0x3947ae={'raw':!![],'where':{'id':_0x474318['params']['id']}},_0x2771da={};_0x2771da['model']=_[_0xa1fd('0x56')](db['WhatsappMessage']['rawAttributes']);_0x2771da[_0xa1fd('0x42')]=_[_0xa1fd('0x56')](_0x474318[_0xa1fd('0x42')]);_0x2771da['filters']=_[_0xa1fd('0x45')](_0x2771da[_0xa1fd('0x41')],_0x2771da[_0xa1fd('0x42')]);_0x3947ae[_0xa1fd('0x44')]=_['intersection'](_0x2771da[_0xa1fd('0x41')],qs[_0xa1fd('0x46')](_0x474318['query'][_0xa1fd('0x46')]));_0x3947ae[_0xa1fd('0x44')]=_0x3947ae[_0xa1fd('0x44')]['length']?_0x3947ae[_0xa1fd('0x44')]:_0x2771da['model'];if(_0x474318[_0xa1fd('0x42')][_0xa1fd('0x51')]){_0x3947ae[_0xa1fd('0x52')]=[{'all':!![]}];}_0x3947ae=_[_0xa1fd('0x4e')]({},_0x3947ae,_0x474318[_0xa1fd('0x50')]);return db['WhatsappMessage'][_0xa1fd('0x57')](_0x3947ae)['then'](handleEntityNotFound(_0x2241af,null))[_0xa1fd('0x22')](respondWithResult(_0x2241af,null))[_0xa1fd('0x2d')](handleError(_0x2241af,null));};exports[_0xa1fd('0x58')]=function(_0x4941e8,_0x43f603){return db[_0xa1fd('0x3d')][_0xa1fd('0x58')](_0x4941e8[_0xa1fd('0x59')],{})[_0xa1fd('0x22')](respondWithResult(_0x43f603,0xc9))[_0xa1fd('0x2d')](handleError(_0x43f603,null));};exports[_0xa1fd('0x39')]=function(_0xfd821c,_0x596c76){if(_0xfd821c[_0xa1fd('0x59')]['id']){delete _0xfd821c[_0xa1fd('0x59')]['id'];}return db[_0xa1fd('0x3d')][_0xa1fd('0x57')]({'where':{'id':_0xfd821c[_0xa1fd('0x5a')]['id']}})[_0xa1fd('0x22')](handleEntityNotFound(_0x596c76,null))['then'](saveUpdates(_0xfd821c[_0xa1fd('0x59')],null))[_0xa1fd('0x22')](respondWithResult(_0x596c76,null))[_0xa1fd('0x2d')](handleError(_0x596c76,null));};exports[_0xa1fd('0x5b')]=function(_0x18cdf1,_0x4ba50c){return db[_0xa1fd('0x3d')][_0xa1fd('0x57')]({'where':{'id':_0x18cdf1[_0xa1fd('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4ba50c,null))['then'](removeEntity(_0x4ba50c,null))[_0xa1fd('0x2d')](handleError(_0x4ba50c,null));};exports[_0xa1fd('0x5c')]=function(_0x19208b,_0x30146a){return db[_0xa1fd('0x3d')][_0xa1fd('0x5c')]()[_0xa1fd('0x22')](respondWithResult(_0x30146a,null))[_0xa1fd('0x2d')](handleError(_0x30146a,null));};var interaction_log=require(_0xa1fd('0x5d'))(_0xa1fd('0x5e'));exports[_0xa1fd('0x5f')]=function(_0x10866f,_0x505068,_0x30bbc3){var _0x4cb6d6={'agent':{},'channel':'whatsapp'};if(_0x10866f[_0xa1fd('0x59')]['id']){delete _0x10866f[_0xa1fd('0x59')]['id'];}_0x10866f['body']['read']=!![];_0x10866f['body'][_0xa1fd('0x60')]=moment()[_0xa1fd('0x61')](_0xa1fd('0x62'));_0x10866f[_0xa1fd('0x59')][_0xa1fd('0x63')]=_0x10866f[_0xa1fd('0x59')][_0xa1fd('0x63')]||_0x10866f[_0xa1fd('0x64')]['id'];_0x4cb6d6[_0xa1fd('0x65')]['id']=_0x10866f[_0xa1fd('0x59')][_0xa1fd('0x63')];return db[_0xa1fd('0x3d')][_0xa1fd('0x57')]({'where':{'id':_0x10866f[_0xa1fd('0x5a')]['id'],'UserId':null}})[_0xa1fd('0x22')](handleEntityNotFound(_0x505068,null))[_0xa1fd('0x22')](saveUpdates(_0x10866f['body'],null))[_0xa1fd('0x22')](function(_0x359f7c){if(_0x359f7c){_0x4cb6d6[_0xa1fd('0x2a')]=_0x359f7c[_0xa1fd('0x66')]({'plain':!![]});return db[_0xa1fd('0x67')][_0xa1fd('0x57')]({'where':{'id':_0x359f7c[_0xa1fd('0x68')]}});}return null;})[_0xa1fd('0x22')](handleEntityNotFound(_0x505068,null))[_0xa1fd('0x22')](function(_0x5c9563){if(_0x5c9563){return _0x5c9563[_0xa1fd('0x39')]({'UserId':_0x10866f[_0xa1fd('0x59')][_0xa1fd('0x63')],'read1stAt':_['isNil'](_0x5c9563[_0xa1fd('0x69')])?moment()[_0xa1fd('0x61')](_0xa1fd('0x62')):undefined});}return null;})[_0xa1fd('0x22')](function(_0x179d4b){if(_0x179d4b){_0x4cb6d6[_0xa1fd('0x6a')]=_0x179d4b['get']({'plain':!![]});interaction_log[_0xa1fd('0x2b')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10866f[_0xa1fd('0x64')]['id'],_0x10866f[_0xa1fd('0x64')][_0xa1fd('0x3a')],_0x10866f['user'][_0xa1fd('0x6b')],_0x4cb6d6[_0xa1fd('0x6a')]['id'],_0x10866f[_0xa1fd('0x59')]?JSON[_0xa1fd('0x26')](_0x10866f[_0xa1fd('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa1fd('0x6c'),_0x4cb6d6);}return null;})['then'](function(_0x11483b){var _0x3d4e3d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x11483b[_0xa1fd('0x2a')][_0xa1fd('0x6d')];return db['sequelize']['query'](_0x3d4e3d,{'type':db[_0xa1fd('0x6e')][_0xa1fd('0x6f')][_0xa1fd('0x70')],'raw':!![]})[_0xa1fd('0x22')](function(_0x3b29f1){return _0x3b29f1;});})['then'](function(_0x19c1df){if(_0x19c1df){_0x4cb6d6['message'][_0xa1fd('0x71')]=_0x19c1df[0x0];if(!_0x10866f[_0xa1fd('0x59')][_0xa1fd('0x63')])return;return db[_0xa1fd('0x72')][_0xa1fd('0x57')]({'where':{'id':_0x10866f['body']['UserId'],'role':_0xa1fd('0x65')},'attributes':['id','name',_0xa1fd('0x73'),_0xa1fd('0x74'),_0xa1fd('0x75')],'raw':!![]});}return null;})[_0xa1fd('0x22')](function(_0x33a596){if(!_0x33a596)return null;_0x4cb6d6['message']['agent']=_0x33a596;return _0x4cb6d6;})[_0xa1fd('0x22')](function(_0x671d8c){if(_0x671d8c){if(_0x10866f['body'][_0xa1fd('0x76')]){_0x4cb6d6[_0xa1fd('0x2a')][_0xa1fd('0x77')]=util['format'](_0xa1fd('0x78'),_0x10866f[_0xa1fd('0x64')][_0xa1fd('0x3a')]);_0x4cb6d6[_0xa1fd('0x2a')][_0xa1fd('0x79')]=_0x4cb6d6[_0xa1fd('0x79')];_0x4cb6d6[_0xa1fd('0x2a')]['motionChannel']=_0x4cb6d6[_0xa1fd('0x79')];_0x4cb6d6[_0xa1fd('0x2a')][_0xa1fd('0x7a')]=_0xa1fd('0x5f');return respondWithRpcPromise(_0xa1fd('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x4cb6d6[_0xa1fd('0x2a')]},client9002)[_0xa1fd('0x22')](function(){return _0x4cb6d6;});}return _0x4cb6d6;}return null;})['then'](respondWithResult(_0x505068,null))[_0xa1fd('0x2d')](handleError(_0x505068,null));};var interaction_log=require(_0xa1fd('0x5d'))(_0xa1fd('0x5e'));exports[_0xa1fd('0x7c')]=function(_0x38f4be,_0x530dc3,_0x39c330){var _0x1d7821={'agent':{},'channel':'whatsapp'};if(_0x38f4be[_0xa1fd('0x59')]['id']){delete _0x38f4be[_0xa1fd('0x59')]['id'];}_0x38f4be['body']['UserId']=_0x38f4be[_0xa1fd('0x59')][_0xa1fd('0x63')]||_0x38f4be[_0xa1fd('0x64')]['id'];_0x1d7821[_0xa1fd('0x65')]['id']=_0x38f4be['body'][_0xa1fd('0x63')];return db[_0xa1fd('0x3d')][_0xa1fd('0x57')]({'where':{'id':_0x38f4be['params']['id'],'UserId':null}})[_0xa1fd('0x22')](handleEntityNotFound(_0x530dc3,null))[_0xa1fd('0x22')](function(_0x3d72ea){if(_0x3d72ea){_0x1d7821['message']=_0x3d72ea['get']({'plain':!![]});return db[_0xa1fd('0x67')]['find']({'where':{'id':_0x3d72ea[_0xa1fd('0x68')]}});}return null;})[_0xa1fd('0x22')](handleEntityNotFound(_0x530dc3,null))[_0xa1fd('0x22')](function(_0x115fea){if(_0x115fea){_0x1d7821['interaction']=_0x115fea[_0xa1fd('0x66')]({'plain':!![]});interaction_log[_0xa1fd('0x2b')](_0xa1fd('0x7d'),_0x38f4be[_0xa1fd('0x64')]['id'],_0x38f4be[_0xa1fd('0x64')][_0xa1fd('0x3a')],_0x38f4be['user']['role'],_0x1d7821[_0xa1fd('0x6a')]['id'],_0x38f4be['body']?JSON[_0xa1fd('0x26')](_0x38f4be['body']):_0xa1fd('0x7e'));return respondWithRpcPromise(_0xa1fd('0x7f'),_0xa1fd('0x80'),_0x1d7821);}return null;})[_0xa1fd('0x22')](function(_0x11af98){var _0x51bcdb=_0xa1fd('0x81')+_0x11af98[_0xa1fd('0x2a')]['ContactId'];return db[_0xa1fd('0x82')][_0xa1fd('0x42')](_0x51bcdb,{'type':db['Sequelize'][_0xa1fd('0x6f')]['SELECT'],'raw':!![]})[_0xa1fd('0x22')](function(_0x499769){return _0x499769;});})[_0xa1fd('0x22')](function(_0x251bcd){if(_0x251bcd){_0x1d7821['message'][_0xa1fd('0x71')]=_0x251bcd[0x0];if(!_0x38f4be[_0xa1fd('0x59')][_0xa1fd('0x63')])return;return db['User']['find']({'where':{'id':_0x38f4be[_0xa1fd('0x59')]['UserId'],'role':_0xa1fd('0x65')},'attributes':['id','name',_0xa1fd('0x73'),_0xa1fd('0x74'),'internal'],'raw':!![]});}return null;})[_0xa1fd('0x22')](function(_0x18c47b){if(!_0x18c47b)return null;_0x1d7821[_0xa1fd('0x2a')][_0xa1fd('0x65')]=_0x18c47b;return _0x1d7821;})[_0xa1fd('0x22')](function(_0x1b1c49){if(_0x1b1c49){_0x1b1c49[_0xa1fd('0x2a')]['interface']=util[_0xa1fd('0x61')](_0xa1fd('0x78'),_0x38f4be[_0xa1fd('0x64')][_0xa1fd('0x3a')]);_0x1b1c49['message'][_0xa1fd('0x79')]=_0x1d7821['channel'];_0x1b1c49[_0xa1fd('0x2a')]['motionChannel']=_0x1d7821[_0xa1fd('0x79')];_0x1b1c49['message']['event']=_0xa1fd('0x7c');respondWithRpcPromise(_0xa1fd('0x7b'),_0xa1fd('0x7b'),{'event':'rejectmessage','message':_0x1b1c49[_0xa1fd('0x2a')]},client9002);return _0x1d7821;}return null;})[_0xa1fd('0x22')](respondWithResult(_0x530dc3,null))[_0xa1fd('0x2d')](handleError(_0x530dc3,null));};exports[_0xa1fd('0x2e')]=function(_0x47670d,_0xeb34f6,_0x5ec92c){if(_0x47670d[_0xa1fd('0x59')]['id']){delete _0x47670d['body']['id'];}var _0x2e8ac3;return db[_0xa1fd('0x3d')][_0xa1fd('0x57')]({'where':{'id':_0x47670d['params']['id']}})[_0xa1fd('0x22')](handleEntityNotFound(_0xeb34f6,null))[_0xa1fd('0x22')](function(_0x3e2c7e){if(_0x3e2c7e){_0x2e8ac3=_0x3e2c7e;return db[_0xa1fd('0x83')][_0xa1fd('0x57')]({'where':{'id':_0x3e2c7e[_0xa1fd('0x84')]}});}})[_0xa1fd('0x22')](handleEntityNotFound(_0xeb34f6,null))[_0xa1fd('0x22')](function(_0x744336){if(_0x744336){logger[_0xa1fd('0x24')](_0xa1fd('0x85'),_0xa1fd('0x2e'),_0xa1fd('0x86'),_0x744336['type'],util[_0xa1fd('0x87')](_0x47670d[_0xa1fd('0x59')],{'showHidden':![],'depth':null}));switch(_0x744336['type']){case _0xa1fd('0x88'):if(_0x47670d[_0xa1fd('0x59')]['MessageSid']&&_0x47670d[_0xa1fd('0x59')][_0xa1fd('0x89')]===_0x2e8ac3['messageId']&&_0x47670d[_0xa1fd('0x59')][_0xa1fd('0x8a')]&&_0x47670d['body']['MessageStatus']==='read'){return _0x2e8ac3[_0xa1fd('0x39')]({'read':!![]});}else{logger[_0xa1fd('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xa1fd('0x88'),util[_0xa1fd('0x87')](_0x47670d[_0xa1fd('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2e8ac3;}})[_0xa1fd('0x22')](respondWithResult(_0xeb34f6,null))[_0xa1fd('0x2d')](handleError(_0xeb34f6,null));}; \ No newline at end of file +var _0xe58a=['MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','apply','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid'];(function(_0x22d2ff,_0x56a793){var _0x4a50b6=function(_0x54512c){while(--_0x54512c){_0x22d2ff['push'](_0x22d2ff['shift']());}};_0x4a50b6(++_0x56a793);}(_0xe58a,0x1bc));var _0xae58=function(_0x6e0c5d,_0x1cef8d){_0x6e0c5d=_0x6e0c5d-0x0;var _0x2c45f0=_0xe58a[_0x6e0c5d];return _0x2c45f0;};'use strict';var emlformat=require(_0xae58('0x0'));var rimraf=require(_0xae58('0x1'));var zipdir=require(_0xae58('0x2'));var jsonpatch=require(_0xae58('0x3'));var rp=require(_0xae58('0x4'));var moment=require(_0xae58('0x5'));var BPromise=require(_0xae58('0x6'));var Mustache=require(_0xae58('0x7'));var util=require(_0xae58('0x8'));var path=require(_0xae58('0x9'));var sox=require(_0xae58('0xa'));var csv=require(_0xae58('0xb'));var ejs=require(_0xae58('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae58('0xd'));var squel=require(_0xae58('0xe'));var crypto=require(_0xae58('0xf'));var jsforce=require(_0xae58('0x10'));var deskjs=require(_0xae58('0x11'));var toCsv=require(_0xae58('0xb'));var querystring=require(_0xae58('0x12'));var Papa=require(_0xae58('0x13'));var Redis=require(_0xae58('0x14'));var authService=require(_0xae58('0x15'));var qs=require(_0xae58('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae58('0x17'));var logger=require(_0xae58('0x18'))(_0xae58('0x19'));var utils=require(_0xae58('0x1a'));var config=require(_0xae58('0x1b'));var licenseUtil=require(_0xae58('0x1c'));var db=require(_0xae58('0x1d'))['db'];config[_0xae58('0x1e')]=_[_0xae58('0x1f')](config[_0xae58('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0xae58('0x20'))(new Redis(config[_0xae58('0x1e')]));require(_0xae58('0x21'))['register'](socket);var jayson=require(_0xae58('0x22'));var client=jayson[_0xae58('0x23')][_0xae58('0x24')]({'port':0x232c});var client9002=jayson['client'][_0xae58('0x24')]({'port':0x232a});function respondWithRpcPromise(_0xd5face,_0x1ef172,_0x4036a8,_0x418a4c){return new BPromise(function(_0x1ddce1,_0x25560d){var _0x5cd980=_0x418a4c||client;return _0x5cd980['request'](_0xd5face,_0x4036a8)[_0xae58('0x25')](function(_0x2edb16){logger[_0xae58('0x26')](_0xae58('0x27'),_0x1ef172,_0xae58('0x28'));logger[_0xae58('0x29')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1ef172,'request\x20sent',JSON[_0xae58('0x2a')](_0x2edb16));if(_0x2edb16[_0xae58('0x2b')]){if(_0x2edb16[_0xae58('0x2b')][_0xae58('0x2c')]===0x1f4){logger[_0xae58('0x2b')](_0xae58('0x27'),_0x1ef172,_0x2edb16[_0xae58('0x2b')]['message']);return _0x25560d(_0x2edb16[_0xae58('0x2b')][_0xae58('0x2d')]);}logger[_0xae58('0x2b')](_0xae58('0x27'),_0x1ef172,_0x2edb16[_0xae58('0x2b')][_0xae58('0x2d')]);return _0x1ddce1(_0x2edb16[_0xae58('0x2b')][_0xae58('0x2d')]);}else{logger[_0xae58('0x26')](_0xae58('0x27'),_0x1ef172,_0xae58('0x28'));_0x1ddce1(_0x2edb16[_0xae58('0x2e')][_0xae58('0x2d')]);}})['catch'](function(_0x21b273){logger[_0xae58('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x1ef172,_0x21b273);_0x25560d(_0x21b273);});});}function respondWithStatusCode(_0x10d922,_0x365139){_0x365139=_0x365139||0xcc;return function(_0x5594d9){if(_0x5594d9){return _0x10d922[_0xae58('0x2f')](_0x365139);}return _0x10d922[_0xae58('0x30')](_0x365139)[_0xae58('0x31')]();};}function respondWithResult(_0x275def,_0x58ed9d){_0x58ed9d=_0x58ed9d||0xc8;return function(_0xb4f3ac){if(_0xb4f3ac){return _0x275def[_0xae58('0x30')](_0x58ed9d)[_0xae58('0x32')](_0xb4f3ac);}};}function respondWithFilteredResult(_0x39bb32,_0x4d2637){return function(_0x278948){if(_0x278948){var _0x4e198d=typeof _0x4d2637['offset']===_0xae58('0x33')&&typeof _0x4d2637['limit']==='undefined';var _0x350c4f=_0x278948[_0xae58('0x34')];var _0xf909f1=_0x4e198d?0x0:_0x4d2637[_0xae58('0x35')];var _0x1be7c7=_0x4e198d?_0x278948['count']:_0x4d2637['offset']+_0x4d2637[_0xae58('0x36')];var _0x1e42bf;if(_0x1be7c7>=_0x350c4f){_0x1be7c7=_0x350c4f;_0x1e42bf=0xc8;}else{_0x1e42bf=0xce;}_0x39bb32[_0xae58('0x30')](_0x1e42bf);return _0x39bb32['set']('Content-Range',_0xf909f1+'-'+_0x1be7c7+'/'+_0x350c4f)[_0xae58('0x32')](_0x278948);}return null;};}function patchUpdates(_0x21e06d){return function(_0x25bc9d){try{jsonpatch[_0xae58('0x37')](_0x25bc9d,_0x21e06d,!![]);}catch(_0x45a324){return BPromise['reject'](_0x45a324);}return _0x25bc9d[_0xae58('0x38')]();};}function saveUpdates(_0xa3409,_0x45ee6d){return function(_0x2ea649){if(_0x2ea649){return _0x2ea649[_0xae58('0x39')](_0xa3409)[_0xae58('0x25')](function(_0x16192e){return _0x16192e;});}return null;};}function removeEntity(_0x3911ba,_0x29e6b8){return function(_0x4244a2){if(_0x4244a2){return _0x4244a2[_0xae58('0x3a')]()[_0xae58('0x25')](function(){_0x3911ba['status'](0xcc)[_0xae58('0x31')]();});}};}function handleEntityNotFound(_0x2be82b,_0xc666d8){return function(_0x190a61){if(!_0x190a61){_0x2be82b[_0xae58('0x2f')](0x194);}return _0x190a61;};}function handleError(_0xdaeb7,_0x1d67e3){_0x1d67e3=_0x1d67e3||0x1f4;return function(_0x1fbe54){logger[_0xae58('0x2b')](_0x1fbe54[_0xae58('0x3b')]);if(_0x1fbe54['name']){delete _0x1fbe54[_0xae58('0x3c')];}_0xdaeb7['status'](_0x1d67e3)[_0xae58('0x3d')](_0x1fbe54);};}exports[_0xae58('0x3e')]=function(_0x77620f,_0x45cea3){var _0x49d24a={},_0x2c1816={},_0x19b7f9={'count':0x0,'rows':[]};var _0x34fb33=_[_0xae58('0x3f')](db[_0xae58('0x40')][_0xae58('0x41')],function(_0x5c35be){return{'name':_0x5c35be[_0xae58('0x42')],'type':_0x5c35be['type'][_0xae58('0x43')]};});_0x2c1816[_0xae58('0x44')]=_[_0xae58('0x3f')](_0x34fb33,_0xae58('0x3c'));_0x2c1816[_0xae58('0x45')]=_[_0xae58('0x46')](_0x77620f['query']);_0x2c1816[_0xae58('0x47')]=_[_0xae58('0x48')](_0x2c1816[_0xae58('0x44')],_0x2c1816[_0xae58('0x45')]);_0x49d24a[_0xae58('0x49')]=_[_0xae58('0x48')](_0x2c1816[_0xae58('0x44')],qs[_0xae58('0x4a')](_0x77620f[_0xae58('0x45')][_0xae58('0x4a')]));_0x49d24a['attributes']=_0x49d24a[_0xae58('0x49')][_0xae58('0x4b')]?_0x49d24a['attributes']:_0x2c1816['model'];if(!_0x77620f[_0xae58('0x45')][_0xae58('0x4c')](_0xae58('0x4d'))){_0x49d24a[_0xae58('0x36')]=qs[_0xae58('0x36')](_0x77620f[_0xae58('0x45')][_0xae58('0x36')]);_0x49d24a[_0xae58('0x35')]=qs['offset'](_0x77620f['query'][_0xae58('0x35')]);}_0x49d24a[_0xae58('0x4e')]=qs[_0xae58('0x4f')](_0x77620f['query'][_0xae58('0x4f')]);_0x49d24a[_0xae58('0x50')]=qs[_0xae58('0x47')](_[_0xae58('0x51')](_0x77620f[_0xae58('0x45')],_0x2c1816[_0xae58('0x47')]),_0x34fb33);if(_0x77620f['query'][_0xae58('0x52')]){_0x49d24a[_0xae58('0x50')]=_[_0xae58('0x53')](_0x49d24a[_0xae58('0x50')],{'$or':_['map'](_0x34fb33,function(_0x419591){if(_0x419591[_0xae58('0x54')]!==_0xae58('0x55')){var _0x51026b={};_0x51026b[_0x419591['name']]={'$like':'%'+_0x77620f['query'][_0xae58('0x52')]+'%'};return _0x51026b;}})});}_0x49d24a=_[_0xae58('0x53')]({},_0x49d24a,_0x77620f[_0xae58('0x56')]);var _0x515332={'where':_0x49d24a[_0xae58('0x50')]};return db[_0xae58('0x40')][_0xae58('0x34')](_0x515332)['then'](function(_0x5c6af2){_0x19b7f9[_0xae58('0x34')]=_0x5c6af2;if(_0x77620f['query'][_0xae58('0x57')]){_0x49d24a[_0xae58('0x58')]=[{'all':!![]}];}return db[_0xae58('0x40')][_0xae58('0x59')](_0x49d24a);})[_0xae58('0x25')](function(_0x2fea5d){_0x19b7f9[_0xae58('0x5a')]=_0x2fea5d;return _0x19b7f9;})['then'](respondWithFilteredResult(_0x45cea3,_0x49d24a))[_0xae58('0x5b')](handleError(_0x45cea3,null));};exports[_0xae58('0x5c')]=function(_0x322fc6,_0x2f72ed){var _0x305a22={'raw':!![],'where':{'id':_0x322fc6['params']['id']}},_0x336c6a={};_0x336c6a['model']=_[_0xae58('0x46')](db['WhatsappMessage'][_0xae58('0x41')]);_0x336c6a[_0xae58('0x45')]=_[_0xae58('0x46')](_0x322fc6[_0xae58('0x45')]);_0x336c6a['filters']=_[_0xae58('0x48')](_0x336c6a[_0xae58('0x44')],_0x336c6a[_0xae58('0x45')]);_0x305a22[_0xae58('0x49')]=_[_0xae58('0x48')](_0x336c6a[_0xae58('0x44')],qs[_0xae58('0x4a')](_0x322fc6[_0xae58('0x45')]['fields']));_0x305a22[_0xae58('0x49')]=_0x305a22[_0xae58('0x49')][_0xae58('0x4b')]?_0x305a22[_0xae58('0x49')]:_0x336c6a['model'];if(_0x322fc6[_0xae58('0x45')][_0xae58('0x57')]){_0x305a22[_0xae58('0x58')]=[{'all':!![]}];}_0x305a22=_[_0xae58('0x53')]({},_0x305a22,_0x322fc6[_0xae58('0x56')]);return db[_0xae58('0x40')][_0xae58('0x5d')](_0x305a22)['then'](handleEntityNotFound(_0x2f72ed,null))[_0xae58('0x25')](respondWithResult(_0x2f72ed,null))[_0xae58('0x5b')](handleError(_0x2f72ed,null));};exports[_0xae58('0x5e')]=function(_0x37ad7f,_0x5e145e){return db['WhatsappMessage']['create'](_0x37ad7f[_0xae58('0x5f')],{})[_0xae58('0x25')](respondWithResult(_0x5e145e,0xc9))[_0xae58('0x5b')](handleError(_0x5e145e,null));};exports[_0xae58('0x39')]=function(_0x21d5b6,_0x552578){if(_0x21d5b6[_0xae58('0x5f')]['id']){delete _0x21d5b6['body']['id'];}return db[_0xae58('0x40')]['find']({'where':{'id':_0x21d5b6[_0xae58('0x60')]['id']}})['then'](handleEntityNotFound(_0x552578,null))[_0xae58('0x25')](saveUpdates(_0x21d5b6[_0xae58('0x5f')],null))[_0xae58('0x25')](respondWithResult(_0x552578,null))['catch'](handleError(_0x552578,null));};exports['destroy']=function(_0x2b16c8,_0xdb7710){return db['WhatsappMessage'][_0xae58('0x5d')]({'where':{'id':_0x2b16c8['params']['id']}})[_0xae58('0x25')](handleEntityNotFound(_0xdb7710,null))[_0xae58('0x25')](removeEntity(_0xdb7710,null))[_0xae58('0x5b')](handleError(_0xdb7710,null));};exports[_0xae58('0x61')]=function(_0x8682d0,_0x10b5db){return db[_0xae58('0x40')]['describe']()['then'](respondWithResult(_0x10b5db,null))[_0xae58('0x5b')](handleError(_0x10b5db,null));};var interaction_log=require(_0xae58('0x18'))('whatsapp-interactions');exports[_0xae58('0x62')]=function(_0x4ab34c,_0x4a8a74,_0x42b8ce){var _0x4d5496={'agent':{},'channel':_0xae58('0x63')};if(_0x4ab34c[_0xae58('0x5f')]['id']){delete _0x4ab34c['body']['id'];}_0x4ab34c[_0xae58('0x5f')][_0xae58('0x64')]=!![];_0x4ab34c[_0xae58('0x5f')][_0xae58('0x65')]=moment()[_0xae58('0x66')](_0xae58('0x67'));_0x4ab34c['body'][_0xae58('0x68')]=_0x4ab34c[_0xae58('0x5f')][_0xae58('0x68')]||_0x4ab34c[_0xae58('0x69')]['id'];_0x4d5496[_0xae58('0x6a')]['id']=_0x4ab34c['body'][_0xae58('0x68')];return db['WhatsappMessage'][_0xae58('0x5d')]({'where':{'id':_0x4ab34c[_0xae58('0x60')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a8a74,null))[_0xae58('0x25')](saveUpdates(_0x4ab34c[_0xae58('0x5f')],null))[_0xae58('0x25')](function(_0xcaa5b1){if(_0xcaa5b1){_0x4d5496[_0xae58('0x2d')]=_0xcaa5b1['get']({'plain':!![]});return db['WhatsappInteraction'][_0xae58('0x5d')]({'where':{'id':_0xcaa5b1['WhatsappInteractionId']}});}return null;})[_0xae58('0x25')](handleEntityNotFound(_0x4a8a74,null))['then'](function(_0x320d1c){if(_0x320d1c){return _0x320d1c[_0xae58('0x39')]({'UserId':_0x4ab34c['body'][_0xae58('0x68')],'read1stAt':_[_0xae58('0x6b')](_0x320d1c['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4bb9b3){if(_0x4bb9b3){_0x4d5496[_0xae58('0x6c')]=_0x4bb9b3[_0xae58('0x6d')]({'plain':!![]});interaction_log[_0xae58('0x26')](_0xae58('0x6e'),_0x4ab34c[_0xae58('0x69')]['id'],_0x4ab34c['user']['name'],_0x4ab34c['user'][_0xae58('0x6f')],_0x4d5496[_0xae58('0x6c')]['id'],_0x4ab34c[_0xae58('0x5f')]?JSON[_0xae58('0x2a')](_0x4ab34c[_0xae58('0x5f')]):_0xae58('0x70'));return respondWithRpcPromise(_0xae58('0x71'),_0xae58('0x72'),_0x4d5496);}return null;})['then'](function(_0x262a59){var _0xe30375='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x262a59[_0xae58('0x2d')][_0xae58('0x73')];return db[_0xae58('0x74')][_0xae58('0x45')](_0xe30375,{'type':db[_0xae58('0x75')][_0xae58('0x76')][_0xae58('0x77')],'raw':!![]})[_0xae58('0x25')](function(_0xf2a735){return _0xf2a735;});})['then'](function(_0x45b137){if(_0x45b137){_0x4d5496['message'][_0xae58('0x78')]=_0x45b137[0x0];if(!_0x4ab34c[_0xae58('0x5f')][_0xae58('0x68')])return;return db[_0xae58('0x79')][_0xae58('0x5d')]({'where':{'id':_0x4ab34c[_0xae58('0x5f')]['UserId'],'role':_0xae58('0x6a')},'attributes':['id',_0xae58('0x3c'),_0xae58('0x7a'),_0xae58('0x7b'),_0xae58('0x7c')],'raw':!![]});}return null;})[_0xae58('0x25')](function(_0x2b7279){if(!_0x2b7279)return null;_0x4d5496[_0xae58('0x2d')][_0xae58('0x6a')]=_0x2b7279;return _0x4d5496;})[_0xae58('0x25')](function(_0x37b148){if(_0x37b148){if(_0x4ab34c[_0xae58('0x5f')][_0xae58('0x7d')]){_0x4d5496[_0xae58('0x2d')]['interface']=util[_0xae58('0x66')](_0xae58('0x7e'),_0x4ab34c[_0xae58('0x69')][_0xae58('0x3c')]);_0x4d5496[_0xae58('0x2d')]['channel']=_0x4d5496[_0xae58('0x7f')];_0x4d5496[_0xae58('0x2d')][_0xae58('0x80')]=_0x4d5496[_0xae58('0x7f')];_0x4d5496[_0xae58('0x2d')][_0xae58('0x81')]=_0xae58('0x62');return respondWithRpcPromise('EventManager',_0xae58('0x82'),{'event':_0xae58('0x83'),'message':_0x4d5496[_0xae58('0x2d')]},client9002)[_0xae58('0x25')](function(){return _0x4d5496;});}return _0x4d5496;}return null;})[_0xae58('0x25')](respondWithResult(_0x4a8a74,null))[_0xae58('0x5b')](handleError(_0x4a8a74,null));};var interaction_log=require(_0xae58('0x18'))('whatsapp-interactions');exports[_0xae58('0x84')]=function(_0x150d4e,_0x356b58,_0x764e64){var _0x21546d={'agent':{},'channel':_0xae58('0x63')};if(_0x150d4e[_0xae58('0x5f')]['id']){delete _0x150d4e[_0xae58('0x5f')]['id'];}_0x150d4e[_0xae58('0x5f')][_0xae58('0x68')]=_0x150d4e[_0xae58('0x5f')]['UserId']||_0x150d4e[_0xae58('0x69')]['id'];_0x21546d[_0xae58('0x6a')]['id']=_0x150d4e[_0xae58('0x5f')][_0xae58('0x68')];return db[_0xae58('0x40')][_0xae58('0x5d')]({'where':{'id':_0x150d4e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x356b58,null))[_0xae58('0x25')](function(_0xf91542){if(_0xf91542){_0x21546d[_0xae58('0x2d')]=_0xf91542[_0xae58('0x6d')]({'plain':!![]});return db[_0xae58('0x85')][_0xae58('0x5d')]({'where':{'id':_0xf91542['WhatsappInteractionId']}});}return null;})[_0xae58('0x25')](handleEntityNotFound(_0x356b58,null))[_0xae58('0x25')](function(_0x44abc9){if(_0x44abc9){_0x21546d[_0xae58('0x6c')]=_0x44abc9['get']({'plain':!![]});interaction_log[_0xae58('0x26')](_0xae58('0x86'),_0x150d4e['user']['id'],_0x150d4e['user'][_0xae58('0x3c')],_0x150d4e[_0xae58('0x69')]['role'],_0x21546d['interaction']['id'],_0x150d4e['body']?JSON[_0xae58('0x2a')](_0x150d4e[_0xae58('0x5f')]):'null');return respondWithRpcPromise('RejectMessage',_0xae58('0x87'),_0x21546d);}return null;})[_0xae58('0x25')](function(_0x271d2d){var _0x57b538=_0xae58('0x88')+_0x271d2d[_0xae58('0x2d')][_0xae58('0x73')];return db[_0xae58('0x74')][_0xae58('0x45')](_0x57b538,{'type':db['Sequelize'][_0xae58('0x76')][_0xae58('0x77')],'raw':!![]})[_0xae58('0x25')](function(_0x1d6686){return _0x1d6686;});})[_0xae58('0x25')](function(_0xe8754f){if(_0xe8754f){_0x21546d[_0xae58('0x2d')][_0xae58('0x78')]=_0xe8754f[0x0];if(!_0x150d4e['body']['UserId'])return;return db[_0xae58('0x79')][_0xae58('0x5d')]({'where':{'id':_0x150d4e['body'][_0xae58('0x68')],'role':_0xae58('0x6a')},'attributes':['id',_0xae58('0x3c'),_0xae58('0x7a'),'email','internal'],'raw':!![]});}return null;})[_0xae58('0x25')](function(_0x5c8fc0){if(!_0x5c8fc0)return null;_0x21546d['message'][_0xae58('0x6a')]=_0x5c8fc0;return _0x21546d;})['then'](function(_0x3f4bf1){if(_0x3f4bf1){_0x3f4bf1[_0xae58('0x2d')][_0xae58('0x89')]=util[_0xae58('0x66')](_0xae58('0x7e'),_0x150d4e[_0xae58('0x69')]['name']);_0x3f4bf1['message']['channel']=_0x21546d[_0xae58('0x7f')];_0x3f4bf1['message'][_0xae58('0x80')]=_0x21546d[_0xae58('0x7f')];_0x3f4bf1[_0xae58('0x2d')][_0xae58('0x81')]=_0xae58('0x84');respondWithRpcPromise(_0xae58('0x82'),'EventManager',{'event':'rejectmessage','message':_0x3f4bf1[_0xae58('0x2d')]},client9002);return _0x21546d;}return null;})[_0xae58('0x25')](respondWithResult(_0x356b58,null))[_0xae58('0x5b')](handleError(_0x356b58,null));};exports[_0xae58('0x30')]=function(_0xfe7913,_0x17e9c3,_0x214f9f){if(_0xfe7913[_0xae58('0x5f')]['id']){delete _0xfe7913[_0xae58('0x5f')]['id'];}var _0x4532f3;return db[_0xae58('0x40')][_0xae58('0x5d')]({'where':{'id':_0xfe7913['params']['id']}})[_0xae58('0x25')](handleEntityNotFound(_0x17e9c3,null))[_0xae58('0x25')](function(_0x5ac76d){if(_0x5ac76d){_0x4532f3=_0x5ac76d;return db[_0xae58('0x8a')][_0xae58('0x5d')]({'where':{'id':_0x5ac76d[_0xae58('0x8b')]}});}})[_0xae58('0x25')](handleEntityNotFound(_0x17e9c3,null))[_0xae58('0x25')](function(_0x49b1cb){if(_0x49b1cb){logger[_0xae58('0x29')](_0xae58('0x8c'),'status',_0xae58('0x8d'),_0x49b1cb[_0xae58('0x54')],util[_0xae58('0x8e')](_0xfe7913[_0xae58('0x5f')],{'showHidden':![],'depth':null}));switch(_0x49b1cb[_0xae58('0x54')]){case'twilio':if(_0xfe7913[_0xae58('0x5f')][_0xae58('0x8f')]&&_0xfe7913['body'][_0xae58('0x8f')]===_0x4532f3['messageId']&&_0xfe7913[_0xae58('0x5f')]['MessageStatus']&&_0xfe7913[_0xae58('0x5f')][_0xae58('0x90')]===_0xae58('0x64')){return _0x4532f3['update']({'read':!![]});}else{logger[_0xae58('0x2b')](_0xae58('0x91'),_0xae58('0x30'),_0xae58('0x92'),util[_0xae58('0x8e')](_0xfe7913['body'],{'showHidden':![],'depth':null}));}break;}return _0x4532f3;}})[_0xae58('0x25')](respondWithResult(_0x17e9c3,null))[_0xae58('0x5b')](handleError(_0x17e9c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 50b4c61..29ec3fe 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 _0x74f0=['hasOwnProperty','hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x74f0,0xf3));var _0x074f=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0x74f0[_0x275f4a];return _0x4b4a21;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x074f('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x074f('0x1'),'afterUpdate':_0x074f('0x2'),'afterDestroy':_0x074f('0x3')};function emitEvent(_0x3fd9ba){return function(_0x4e4b99,_0x51fbdc,_0x3d8d87){WhatsappMessageEvents[_0x074f('0x4')](_0x3fd9ba+':'+_0x4e4b99['id'],_0x4e4b99);WhatsappMessageEvents[_0x074f('0x4')](_0x3fd9ba,_0x4e4b99);_0x3d8d87(null);};}for(var e in events){if(events[_0x074f('0x5')](e)){var event=events[e];WhatsappMessage[_0x074f('0x6')](e,emitEvent(event));}}module[_0x074f('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb9a7=['emit','hasOwnProperty','hook','exports','../../mysqldb','update'];(function(_0x238b9a,_0x4fcbb8){var _0x59ebf3=function(_0x165123){while(--_0x165123){_0x238b9a['push'](_0x238b9a['shift']());}};_0x59ebf3(++_0x4fcbb8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb9a7[_0x1b2ff7];return _0x31656a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x7b9a('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b9a('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1396ec){return function(_0x40ef7d,_0x37b25b,_0x24cae3){WhatsappMessageEvents[_0x7b9a('0x2')](_0x1396ec+':'+_0x40ef7d['id'],_0x40ef7d);WhatsappMessageEvents[_0x7b9a('0x2')](_0x1396ec,_0x40ef7d);_0x24cae3(null);};}for(var e in events){if(events[_0x7b9a('0x3')](e)){var event=events[e];WhatsappMessage[_0x7b9a('0x4')](e,emitEvent(event));}}module[_0x7b9a('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3712c25..a12714b 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 _0xc705=['body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc705,0x114));var _0x5c70=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xc705[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0x5c70('0x0'));var util=require(_0x5c70('0x1'));var logger=require(_0x5c70('0x2'))(_0x5c70('0x3'));var moment=require(_0x5c70('0x4'));var BPromise=require('bluebird');var rp=require(_0x5c70('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x5c70('0x6'));var rimraf=require(_0x5c70('0x7'));var config=require(_0x5c70('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x5c70('0x9')]=function(_0x1eacec,_0x2647ab){return _0x1eacec[_0x5c70('0xa')]('WhatsappMessage',attributes,{'tableName':_0x5c70('0xb'),'paranoid':![],'indexes':[{'name':_0x5c70('0xc'),'fields':['messageId']},{'name':_0x5c70('0xd'),'fields':[_0x5c70('0xe')],'type':_0x5c70('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24aeda,_0x444c31,_0x54a758){var _0x19ed81=_0x1eacec[_0x5c70('0x10')];var _0x546069=_0x24aeda['get']({'plain':!![]});if(_0x546069[_0x5c70('0x11')][_0x5c70('0x12')]()==='in'||_0x546069[_0x5c70('0x11')][_0x5c70('0x12')]()===_0x5c70('0x13')&&!_0x546069['secret']&&!_[_0x5c70('0x14')](_0x546069[_0x5c70('0x15')])){_0x19ed81[_0x5c70('0x16')]['findOne']({'where':{'id':_0x546069[_0x5c70('0x17')]}})['then'](function(_0x19838b){if(_0x19838b){_0x19838b['update']({'lastMsgAt':_0x546069[_0x5c70('0x18')],'lastMsgDirection':_0x546069[_0x5c70('0x11')]['toLowerCase']()});}})[_0x5c70('0x19')](function(_0x366aee){console[_0x5c70('0x1a')](_0x366aee);});}if(_0x546069[_0x5c70('0x11')]===_0x5c70('0x13')&&!_0x546069['secret']){var _0x8d973f;_0x19ed81[_0x5c70('0x1b')][_0x5c70('0x1c')]({'where':{'id':_0x546069[_0x5c70('0x1d')]},'raw':!![]})[_0x5c70('0x1e')](function(_0x4c9058){_0x8d973f=_0x4c9058;if(_0x8d973f&&_0x8d973f[_0x5c70('0x1f')]){switch(_0x8d973f[_0x5c70('0x1f')]){case _0x5c70('0x20'):var _0x33999d=require(_0x5c70('0x20'));if(_0x8d973f[_0x5c70('0x21')]&&_0x8d973f[_0x5c70('0x22')]&&_0x8d973f[_0x5c70('0x23')]){var _0x103b13=new _0x33999d(_0x8d973f[_0x5c70('0x21')],_0x8d973f[_0x5c70('0x22')]);_0x103b13[_0x5c70('0x24')][_0x5c70('0x25')]({'body':_0x546069[_0x5c70('0xe')],'to':_0x5c70('0x26')+_0x546069[_0x5c70('0x23')],'from':'whatsapp:'+_0x8d973f[_0x5c70('0x23')],'statusCallback':_0x8d973f[_0x5c70('0x27')]+_0x5c70('0x28')+_0x546069['id']+_0x5c70('0x29')+_0x8d973f[_0x5c70('0x2a')]})['then'](function(_0x50c639){if(_0x50c639['sid']){return _0x24aeda[_0x5c70('0x2b')]({'messageId':_0x50c639['sid']});}})[_0x5c70('0x19')](function(_0x28cda6){logger['error'](_0x5c70('0x2c'),_0x5c70('0x2d'),_0x5c70('0x20'),util['inspect'](_0x28cda6,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c70('0x2d'),_0x5c70('0x20'),_0x5c70('0x2e'));}break;case _0x5c70('0x2f'):var _0x1af894=_0x8d973f[_0x5c70('0x21')];var _0x4fb666=_0x8d973f[_0x5c70('0x22')];var _0x505e7b=_0x8d973f[_0x5c70('0x30')]+'/whatsapp/v1/'+_0x1af894+_0x5c70('0x31');var _0x379b2c={'to':[_0x546069[_0x5c70('0x23')]],'message':{'type':'text','text':_0x546069[_0x5c70('0xe')]}};var _0x5d4ab8={'method':_0x5c70('0x32'),'uri':_0x505e7b,'headers':{'Authorization':'Bearer\x20'+_0x4fb666,'Content-Type':_0x5c70('0x33')},'body':_0x379b2c,'json':!![]};rp(_0x5d4ab8)[_0x5c70('0x1e')](function(_0x29a2ce){if(_0x29a2ce[_0x5c70('0x34')][0x0]['message_id']){return _0x24aeda[_0x5c70('0x2b')]({'messageId':_0x29a2ce[_0x5c70('0x34')][0x0][_0x5c70('0x35')]});}})['catch'](function(_0x73d930){logger[_0x5c70('0x36')](_0x5c70('0x37'),_0x73d930);});break;}}})[_0x5c70('0x38')](function(){_0x54a758();});}else{_0x54a758();}}},'charset':_0x5c70('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc30b=['then','update','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','body','whatsapp:','remote','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId'];(function(_0x1f8aa2,_0x5462f2){var _0x48338e=function(_0x3fc30e){while(--_0x3fc30e){_0x1f8aa2['push'](_0x1f8aa2['shift']());}};_0x48338e(++_0x5462f2);}(_0xc30b,0xdf));var _0xbc30=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc30b[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0xbc30('0x0'));var logger=require(_0xbc30('0x1'))('api');var moment=require(_0xbc30('0x2'));var BPromise=require(_0xbc30('0x3'));var rp=require(_0xbc30('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xbc30('0x5'));var rimraf=require(_0xbc30('0x6'));var config=require(_0xbc30('0x7'));var attributes=require(_0xbc30('0x8'));module[_0xbc30('0x9')]=function(_0x12653b,_0x2066e8){return _0x12653b[_0xbc30('0xa')]('WhatsappMessage',attributes,{'tableName':_0xbc30('0xb'),'paranoid':![],'indexes':[{'name':_0xbc30('0xc'),'fields':[_0xbc30('0xc')]},{'name':_0xbc30('0xd'),'fields':['body'],'type':_0xbc30('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16418f,_0x49376c,_0x1f4013){var _0x19e0ca=_0x12653b[_0xbc30('0xf')];var _0x356388=_0x16418f[_0xbc30('0x10')]({'plain':!![]});if(_0x356388[_0xbc30('0x11')][_0xbc30('0x12')]()==='in'||_0x356388[_0xbc30('0x11')]['toLowerCase']()===_0xbc30('0x13')&&!_0x356388['secret']&&!_[_0xbc30('0x14')](_0x356388[_0xbc30('0x15')])){_0x19e0ca[_0xbc30('0x16')][_0xbc30('0x17')]({'where':{'id':_0x356388[_0xbc30('0x18')]}})[_0xbc30('0x19')](function(_0xeee86e){if(_0xeee86e){_0xeee86e[_0xbc30('0x1a')]({'lastMsgAt':_0x356388[_0xbc30('0x1b')],'lastMsgDirection':_0x356388[_0xbc30('0x11')][_0xbc30('0x12')]()});}})[_0xbc30('0x1c')](function(_0x16c9e6){console['error'](_0x16c9e6);});}if(_0x356388[_0xbc30('0x11')]===_0xbc30('0x13')&&!_0x356388[_0xbc30('0x1d')]){var _0x297ac0;_0x19e0ca[_0xbc30('0x1e')][_0xbc30('0x1f')]({'where':{'id':_0x356388[_0xbc30('0x20')]},'raw':!![]})['then'](function(_0x4aa4a5){_0x297ac0=_0x4aa4a5;if(_0x297ac0&&_0x297ac0[_0xbc30('0x21')]){switch(_0x297ac0['type']){case _0xbc30('0x22'):var _0x50c83b=require(_0xbc30('0x22'));if(_0x297ac0['accountSid']&&_0x297ac0[_0xbc30('0x23')]&&_0x297ac0[_0xbc30('0x24')]){var _0xb89ea0=new _0x50c83b(_0x297ac0[_0xbc30('0x25')],_0x297ac0[_0xbc30('0x23')]);_0xb89ea0[_0xbc30('0x26')][_0xbc30('0x27')]({'body':_0x356388[_0xbc30('0x28')],'to':_0xbc30('0x29')+_0x356388[_0xbc30('0x24')],'from':_0xbc30('0x29')+_0x297ac0[_0xbc30('0x24')],'statusCallback':_0x297ac0[_0xbc30('0x2a')]+'/api/whatsapp/messages/'+_0x356388['id']+_0xbc30('0x2b')+_0x297ac0['token']})[_0xbc30('0x19')](function(_0x33a4fb){if(_0x33a4fb['sid']){return _0x16418f[_0xbc30('0x1a')]({'messageId':_0x33a4fb[_0xbc30('0x2c')]});}})['catch'](function(_0x392ebf){logger[_0xbc30('0x2d')](_0xbc30('0x2e'),'afterCreate','twilio',util['inspect'](_0x392ebf,{'showHidden':![],'depth':null}));});}else{logger[_0xbc30('0x2d')](_0xbc30('0x2e'),_0xbc30('0x2f'),_0xbc30('0x22'),_0xbc30('0x30'));}break;case _0xbc30('0x31'):var _0x4b307f=_0x297ac0[_0xbc30('0x25')];var _0x593ae5=_0x297ac0['authToken'];var _0x5f1232=_0x297ac0[_0xbc30('0x32')]+_0xbc30('0x33')+_0x4b307f+_0xbc30('0x34');var _0x4e3a18={'to':[_0x356388[_0xbc30('0x24')]],'message':{'type':_0xbc30('0x35'),'text':_0x356388['body']}};var _0x1a8ed8={'method':_0xbc30('0x36'),'uri':_0x5f1232,'headers':{'Authorization':_0xbc30('0x37')+_0x593ae5,'Content-Type':_0xbc30('0x38')},'body':_0x4e3a18,'json':!![]};rp(_0x1a8ed8)['then'](function(_0x32aba9){if(_0x32aba9[_0xbc30('0x39')][0x0][_0xbc30('0x3a')]){return _0x16418f['update']({'messageId':_0x32aba9[_0xbc30('0x39')][0x0][_0xbc30('0x3a')]});}})['catch'](function(_0x28c13b){logger['err'](_0xbc30('0x3b'),_0x28c13b);});break;}}})[_0xbc30('0x3c')](function(){_0x1f4013();});}else{_0x1f4013();}}},'charset':_0xbc30('0x3d'),'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 a606668..1e4c6c4 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 _0x66b7=['http','defaults','localhost','socket.io-emitter','redis','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappMessage','body','options','raw','CreateWhatsappMessage','lodash','util','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x66b7,0x112));var _0x766b=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x66b7[_0x26a4ea];return _0x1b669e;};'use strict';var _=require(_0x766b('0x0'));var util=require(_0x766b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x766b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x766b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x766b('0x4'));var jayson=require(_0x766b('0x5'));var client=jayson['client'][_0x766b('0x6')]({'port':0x232a});config['redis']=_[_0x766b('0x7')](config['redis'],{'host':_0x766b('0x8'),'port':0x18eb});var socket=require(_0x766b('0x9'))(new Redis(config[_0x766b('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x29911b,_0x472467,_0xded5ca){return new BPromise(function(_0x274465,_0x1ccffd){return client[_0x766b('0xb')](_0x29911b,_0xded5ca)[_0x766b('0xc')](function(_0x34e9b4){logger[_0x766b('0xd')](_0x766b('0xe'),_0x472467,_0x766b('0xf'));logger[_0x766b('0x10')](_0x766b('0x11'),_0x472467,'request\x20sent',JSON[_0x766b('0x12')](_0x34e9b4));if(_0x34e9b4[_0x766b('0x13')]){if(_0x34e9b4[_0x766b('0x13')]['code']===0x1f4){logger[_0x766b('0x13')](_0x766b('0xe'),_0x472467,_0x34e9b4[_0x766b('0x13')][_0x766b('0x14')]);return _0x1ccffd(_0x34e9b4[_0x766b('0x13')][_0x766b('0x14')]);}logger[_0x766b('0x13')](_0x766b('0xe'),_0x472467,_0x34e9b4[_0x766b('0x13')]['message']);return _0x274465(_0x34e9b4['error'][_0x766b('0x14')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x472467,'request\x20sent');_0x274465(_0x34e9b4[_0x766b('0x15')][_0x766b('0x14')]);}})[_0x766b('0x16')](function(_0x20306d){logger[_0x766b('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x472467,_0x20306d);_0x1ccffd(_0x20306d);});});}exports['CreateWhatsappMessage']=function(_0x44bac7){var _0x28fc61=this;return new Promise(function(_0x1acf0b,_0x79ff08){return db[_0x766b('0x17')]['create'](_0x44bac7[_0x766b('0x18')],{'raw':_0x44bac7[_0x766b('0x19')]?_0x44bac7[_0x766b('0x19')][_0x766b('0x1a')]===undefined?!![]:![]:!![]})[_0x766b('0xc')](function(_0x34b129){logger['info'](_0x766b('0x1b'),_0x44bac7);logger[_0x766b('0x10')](_0x766b('0x1b'),_0x44bac7,JSON[_0x766b('0x12')](_0x34b129));_0x1acf0b(_0x34b129);})['catch'](function(_0x460922){logger[_0x766b('0x13')]('CreateWhatsappMessage',_0x460922['message'],_0x44bac7);_0x79ff08(_0x28fc61[_0x766b('0x13')](0x1f4,_0x460922['message']));});});}; \ No newline at end of file +var _0x2968=['../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','CreateWhatsappMessage','create','body','options','raw','util','moment','bluebird','ioredis'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2968,0x134));var _0x8296=function(_0x5e4483,_0x4bd4e2){_0x5e4483=_0x5e4483-0x0;var _0x22823e=_0x2968[_0x5e4483];return _0x22823e;};'use strict';var _=require('lodash');var util=require(_0x8296('0x0'));var moment=require(_0x8296('0x1'));var BPromise=require(_0x8296('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8296('0x3'));var db=require(_0x8296('0x4'))['db'];var utils=require(_0x8296('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8296('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x8296('0x7')]=_[_0x8296('0x8')](config[_0x8296('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8296('0x9'))(new Redis(config[_0x8296('0x7')]));require('./whatsappMessage.socket')[_0x8296('0xa')](socket);function respondWithRpcPromise(_0xa492f,_0x2c68b1,_0x514a07){return new BPromise(function(_0x3b6751,_0x33c09c){return client['request'](_0xa492f,_0x514a07)['then'](function(_0x25309a){logger['info'](_0x8296('0xb'),_0x2c68b1,_0x8296('0xc'));logger[_0x8296('0xd')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2c68b1,_0x8296('0xc'),JSON[_0x8296('0xe')](_0x25309a));if(_0x25309a[_0x8296('0xf')]){if(_0x25309a[_0x8296('0xf')]['code']===0x1f4){logger[_0x8296('0xf')](_0x8296('0xb'),_0x2c68b1,_0x25309a[_0x8296('0xf')]['message']);return _0x33c09c(_0x25309a[_0x8296('0xf')][_0x8296('0x10')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2c68b1,_0x25309a[_0x8296('0xf')]['message']);return _0x3b6751(_0x25309a['error'][_0x8296('0x10')]);}else{logger[_0x8296('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2c68b1,'request\x20sent');_0x3b6751(_0x25309a['result'][_0x8296('0x10')]);}})[_0x8296('0x12')](function(_0x2c61e7){logger[_0x8296('0xf')](_0x8296('0xb'),_0x2c68b1,_0x2c61e7);_0x33c09c(_0x2c61e7);});});}exports[_0x8296('0x13')]=function(_0x5aaf88){var _0x1aff5f=this;return new Promise(function(_0x235fc3,_0x4f213f){return db['WhatsappMessage'][_0x8296('0x14')](_0x5aaf88[_0x8296('0x15')],{'raw':_0x5aaf88[_0x8296('0x16')]?_0x5aaf88[_0x8296('0x16')][_0x8296('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x461d11){logger[_0x8296('0x11')]('CreateWhatsappMessage',_0x5aaf88);logger[_0x8296('0xd')](_0x8296('0x13'),_0x5aaf88,JSON[_0x8296('0xe')](_0x461d11));_0x235fc3(_0x461d11);})['catch'](function(_0x5970b5){logger[_0x8296('0xf')](_0x8296('0x13'),_0x5970b5[_0x8296('0x10')],_0x5aaf88);_0x4f213f(_0x1aff5f[_0x8296('0xf')](0x1f4,_0x5970b5[_0x8296('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index daf76d4..5aeb47c 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 _0x9f0f=['emit','register','length','whatsappMessage:','save','update'];(function(_0x4bf448,_0x495276){var _0x2af0f4=function(_0x58339c){while(--_0x58339c){_0x4bf448['push'](_0x4bf448['shift']());}};_0x2af0f4(++_0x495276);}(_0x9f0f,0xf4));var _0xf9f0=function(_0xf854d8,_0x3a9a03){_0xf854d8=_0xf854d8-0x0;var _0x559eb2=_0x9f0f[_0xf854d8];return _0x559eb2;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf9f0('0x0'),'remove',_0xf9f0('0x1')];function createListener(_0x322a45,_0x50034a){return function(_0x45829b){_0x50034a[_0xf9f0('0x2')](_0x322a45,_0x45829b);};}function removeListener(_0x4155c0,_0x578f75){return function(){WhatsappMessageEvents['removeListener'](_0x4155c0,_0x578f75);};}exports[_0xf9f0('0x3')]=function(_0x20702a){for(var _0x4fc69a=0x0,_0x481161=events[_0xf9f0('0x4')];_0x4fc69a<_0x481161;_0x4fc69a++){var _0x4fe0c0=events[_0x4fc69a];var _0xeef918=createListener(_0xf9f0('0x5')+_0x4fe0c0,_0x20702a);WhatsappMessageEvents['on'](_0x4fe0c0,_0xeef918);}}; \ No newline at end of file +var _0xcd8d=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5eb558,_0x5a1eaf){var _0x30d5c1=function(_0x1a75b8){while(--_0x1a75b8){_0x5eb558['push'](_0x5eb558['shift']());}};_0x30d5c1(++_0x5a1eaf);}(_0xcd8d,0x1d5));var _0xdcd8=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0xcd8d[_0x4dbba7];return _0x43ef83;};'use strict';var WhatsappMessageEvents=require(_0xdcd8('0x0'));var events=[_0xdcd8('0x1'),_0xdcd8('0x2'),_0xdcd8('0x3')];function createListener(_0x159db4,_0x53c58e){return function(_0x105660){_0x53c58e[_0xdcd8('0x4')](_0x159db4,_0x105660);};}function removeListener(_0x33c144,_0x28c8cd){return function(){WhatsappMessageEvents[_0xdcd8('0x5')](_0x33c144,_0x28c8cd);};}exports[_0xdcd8('0x6')]=function(_0x2b81f7){for(var _0x40438b=0x0,_0x1ba4d0=events[_0xdcd8('0x7')];_0x40438b<_0x1ba4d0;_0x40438b++){var _0x1784de=events[_0x40438b];var _0x1c1e4a=createListener(_0xdcd8('0x8')+_0x1784de,_0x2b81f7);WhatsappMessageEvents['on'](_0x1784de,_0x1c1e4a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e79312f..4efa469 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 _0xe086=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','isAuthenticated','show','getMembers','/:id/teams','getAgents','create','post','/:id/users','addAgents','put','/:id','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x275794,_0x50c188){var _0x2ef73b=function(_0x3ad3a7){while(--_0x3ad3a7){_0x275794['push'](_0x275794['shift']());}};_0x2ef73b(++_0x50c188);}(_0xe086,0x14a));var _0x6e08=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe086[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6e08('0x0'));var util=require(_0x6e08('0x1'));var path=require(_0x6e08('0x2'));var timeout=require(_0x6e08('0x3'));var express=require(_0x6e08('0x4'));var router=express[_0x6e08('0x5')]();var fs_extra=require(_0x6e08('0x6'));var auth=require(_0x6e08('0x7'));var interaction=require(_0x6e08('0x8'));var config=require(_0x6e08('0x9'));var controller=require(_0x6e08('0xa'));router[_0x6e08('0xb')]('/',auth['isAuthenticated'](),controller[_0x6e08('0xc')]);router[_0x6e08('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6e08('0xb')]('/:id',auth[_0x6e08('0xd')](),controller[_0x6e08('0xe')]);router[_0x6e08('0xb')]('/:id/members',auth[_0x6e08('0xd')](),controller[_0x6e08('0xf')]);router[_0x6e08('0xb')](_0x6e08('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6e08('0xb')]('/:id/users',auth[_0x6e08('0xd')](),controller[_0x6e08('0x11')]);router['post']('/',auth[_0x6e08('0xd')](),controller[_0x6e08('0x12')]);router[_0x6e08('0x13')](_0x6e08('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6e08('0x13')](_0x6e08('0x14'),auth[_0x6e08('0xd')](),controller[_0x6e08('0x15')]);router[_0x6e08('0x16')]('/:id',auth[_0x6e08('0xd')](),controller['update']);router['delete'](_0x6e08('0x17'),auth[_0x6e08('0xd')](),controller['destroy']);router[_0x6e08('0x18')]('/:id/teams',auth[_0x6e08('0xd')](),controller[_0x6e08('0x19')]);router[_0x6e08('0x18')]('/:id/users',auth[_0x6e08('0xd')](),controller[_0x6e08('0x1a')]);module[_0x6e08('0x1b')]=router; \ No newline at end of file +var _0xf521=['/:id','getMembers','/:id/teams','isAuthenticated','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe'];(function(_0x2349e2,_0x5caafd){var _0x3dc63a=function(_0x18e646){while(--_0x18e646){_0x2349e2['push'](_0x2349e2['shift']());}};_0x3dc63a(++_0x5caafd);}(_0xf521,0x17d));var _0x1f52=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0xf521[_0xfb42e6];return _0x27265b;};'use strict';var multer=require(_0x1f52('0x0'));var util=require('util');var path=require(_0x1f52('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f52('0x2'));var router=express[_0x1f52('0x3')]();var fs_extra=require(_0x1f52('0x4'));var auth=require(_0x1f52('0x5'));var interaction=require(_0x1f52('0x6'));var config=require('../../config/environment');var controller=require(_0x1f52('0x7'));router[_0x1f52('0x8')]('/',auth['isAuthenticated'](),controller[_0x1f52('0x9')]);router['get'](_0x1f52('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1f52('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x1f52('0xc')]);router[_0x1f52('0x8')](_0x1f52('0xd'),auth[_0x1f52('0xe')](),controller['getTeams']);router[_0x1f52('0x8')](_0x1f52('0xf'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x10')]);router[_0x1f52('0x11')]('/',auth[_0x1f52('0xe')](),controller[_0x1f52('0x12')]);router['post'](_0x1f52('0xd'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x13')]);router[_0x1f52('0x11')](_0x1f52('0xf'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x14')]);router[_0x1f52('0x15')](_0x1f52('0xb'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x16')]);router['delete']('/:id',auth[_0x1f52('0xe')](),controller[_0x1f52('0x17')]);router['delete'](_0x1f52('0xd'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x18')]);router[_0x1f52('0x19')](_0x1f52('0xf'),auth[_0x1f52('0xe')](),controller[_0x1f52('0x1a')]);module[_0x1f52('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5fc5806..09e1205 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 _0x24cf=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x65a8c,_0x14e97b){var _0x2d8547=function(_0x7fd7ea){while(--_0x7fd7ea){_0x65a8c['push'](_0x65a8c['shift']());}};_0x2d8547(++_0x14e97b);}(_0x24cf,0x1d5));var _0xf24c=function(_0x380e15,_0xf91555){_0x380e15=_0x380e15-0x0;var _0x9f1cc7=_0x24cf[_0x380e15];return _0x9f1cc7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf24c('0x0')],'unique':_0xf24c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf24c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf24c('0x3')](_0xf24c('0x4'),'beepall',_0xf24c('0x5'))},'description':{'type':Sequelize[_0xf24c('0x0')]}}; \ No newline at end of file +var _0x2333=['roundrobin','STRING','sequelize','exports','INTEGER','ENUM','beepall'];(function(_0x1a18c1,_0x573e55){var _0x444d33=function(_0x5d825c){while(--_0x5d825c){_0x1a18c1['push'](_0x1a18c1['shift']());}};_0x444d33(++_0x573e55);}(_0x2333,0x11a));var _0x3233=function(_0x3f1869,_0x39951f){_0x3f1869=_0x3f1869-0x0;var _0x304210=_0x2333[_0x3f1869];return _0x304210;};'use strict';var Sequelize=require(_0x3233('0x0'));module[_0x3233('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3233('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3233('0x3')]('rrmemory',_0x3233('0x4'),_0x3233('0x5'))},'description':{'type':Sequelize[_0x3233('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 28d4a8b..e2b0c2d 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 _0x4015=['ids','Agents','online','voicePause','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4015,0xb1));var _0x5401=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x4015[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5401('0x0'));var zipdir=require(_0x5401('0x1'));var jsonpatch=require(_0x5401('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5401('0x3'));var Mustache=require(_0x5401('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5401('0x5'));var csv=require(_0x5401('0x6'));var ejs=require(_0x5401('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5401('0x8'));var crypto=require(_0x5401('0x9'));var jsforce=require(_0x5401('0xa'));var deskjs=require(_0x5401('0xb'));var toCsv=require(_0x5401('0x6'));var querystring=require(_0x5401('0xc'));var Papa=require(_0x5401('0xd'));var Redis=require(_0x5401('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5401('0xf'));var as=require(_0x5401('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5401('0x11'))(_0x5401('0x12'));var utils=require(_0x5401('0x13'));var config=require(_0x5401('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5401('0x15')](config['redis'],{'host':_0x5401('0x16'),'port':0x18eb});var socket=require(_0x5401('0x17'))(new Redis(config[_0x5401('0x18')]));require('./whatsappQueue.socket')[_0x5401('0x19')](socket);function respondWithStatusCode(_0x573072,_0x17e233){_0x17e233=_0x17e233||0xcc;return function(_0x57c4b){if(_0x57c4b){return _0x573072[_0x5401('0x1a')](_0x17e233);}return _0x573072[_0x5401('0x1b')](_0x17e233)[_0x5401('0x1c')]();};}function respondWithResult(_0x2a41c7,_0x57d055){_0x57d055=_0x57d055||0xc8;return function(_0x3b9bc8){if(_0x3b9bc8){return _0x2a41c7['status'](_0x57d055)['json'](_0x3b9bc8);}};}function respondWithFilteredResult(_0x30eb37,_0x3c6f85){return function(_0x399698){if(_0x399698){var _0x1ec1b6=typeof _0x3c6f85[_0x5401('0x1d')]===_0x5401('0x1e')&&typeof _0x3c6f85[_0x5401('0x1f')]==='undefined';var _0x131093=_0x399698[_0x5401('0x20')];var _0x1e2565=_0x1ec1b6?0x0:_0x3c6f85[_0x5401('0x1d')];var _0x5497d3=_0x1ec1b6?_0x399698['count']:_0x3c6f85[_0x5401('0x1d')]+_0x3c6f85[_0x5401('0x1f')];var _0x563cf1;if(_0x5497d3>=_0x131093){_0x5497d3=_0x131093;_0x563cf1=0xc8;}else{_0x563cf1=0xce;}_0x30eb37[_0x5401('0x1b')](_0x563cf1);return _0x30eb37[_0x5401('0x21')](_0x5401('0x22'),_0x1e2565+'-'+_0x5497d3+'/'+_0x131093)[_0x5401('0x23')](_0x399698);}return null;};}function patchUpdates(_0x82f58b){return function(_0x1d53b3){try{jsonpatch[_0x5401('0x24')](_0x1d53b3,_0x82f58b,!![]);}catch(_0x301a3a){return BPromise[_0x5401('0x25')](_0x301a3a);}return _0x1d53b3[_0x5401('0x26')]();};}function saveUpdates(_0x62fbcb,_0x1636eb){return function(_0x3fb1a5){if(_0x3fb1a5){return _0x3fb1a5[_0x5401('0x27')](_0x62fbcb)[_0x5401('0x28')](function(_0x101d2f){return _0x101d2f;});}return null;};}function removeEntity(_0x463724,_0x1d7e68){return function(_0x2886f2){if(_0x2886f2){return _0x2886f2[_0x5401('0x29')]()['then'](function(){var _0xd12444=_0x2886f2['get']({'plain':!![]});var _0x4b135e='WhatsappQueues';return db[_0x5401('0x2a')][_0x5401('0x29')]({'where':{'type':_0x4b135e,'resourceId':_0xd12444['id']}})['then'](function(){return _0x2886f2;});})[_0x5401('0x28')](function(){_0x463724[_0x5401('0x1b')](0xcc)[_0x5401('0x1c')]();});}};}function handleEntityNotFound(_0x26a7f1,_0x84dd37){return function(_0x29f4a5){if(!_0x29f4a5){_0x26a7f1[_0x5401('0x1a')](0x194);}return _0x29f4a5;};}function handleError(_0x1135f9,_0x3147c6){_0x3147c6=_0x3147c6||0x1f4;return function(_0x475e44){logger[_0x5401('0x2b')](_0x475e44[_0x5401('0x2c')]);if(_0x475e44[_0x5401('0x2d')]){delete _0x475e44[_0x5401('0x2d')];}_0x1135f9[_0x5401('0x1b')](_0x3147c6)[_0x5401('0x2e')](_0x475e44);};}exports['index']=function(_0x565486,_0x1f53a0){var _0x4af544={},_0x39af9d={},_0x37d177={'count':0x0,'rows':[]};var _0x30461a=_[_0x5401('0x2f')](db[_0x5401('0x30')][_0x5401('0x31')],function(_0xfe5f54){return{'name':_0xfe5f54[_0x5401('0x32')],'type':_0xfe5f54['type']['key']};});_0x39af9d['model']=_['map'](_0x30461a,_0x5401('0x2d'));_0x39af9d['query']=_[_0x5401('0x33')](_0x565486[_0x5401('0x34')]);_0x39af9d[_0x5401('0x35')]=_[_0x5401('0x36')](_0x39af9d[_0x5401('0x37')],_0x39af9d[_0x5401('0x34')]);_0x4af544[_0x5401('0x38')]=_[_0x5401('0x36')](_0x39af9d[_0x5401('0x37')],qs[_0x5401('0x39')](_0x565486[_0x5401('0x34')][_0x5401('0x39')]));_0x4af544[_0x5401('0x38')]=_0x4af544['attributes']['length']?_0x4af544[_0x5401('0x38')]:_0x39af9d[_0x5401('0x37')];if(!_0x565486['query'][_0x5401('0x3a')]('nolimit')){_0x4af544[_0x5401('0x1f')]=qs[_0x5401('0x1f')](_0x565486[_0x5401('0x34')][_0x5401('0x1f')]);_0x4af544['offset']=qs[_0x5401('0x1d')](_0x565486[_0x5401('0x34')][_0x5401('0x1d')]);}_0x4af544[_0x5401('0x3b')]=qs[_0x5401('0x3c')](_0x565486['query'][_0x5401('0x3c')]);_0x4af544[_0x5401('0x3d')]=qs[_0x5401('0x35')](_[_0x5401('0x3e')](_0x565486[_0x5401('0x34')],_0x39af9d[_0x5401('0x35')]),_0x30461a);if(_0x565486[_0x5401('0x34')][_0x5401('0x3f')]){_0x4af544[_0x5401('0x3d')]=_[_0x5401('0x40')](_0x4af544[_0x5401('0x3d')],{'$or':_['map'](_0x30461a,function(_0x4852db){if(_0x4852db[_0x5401('0x41')]!==_0x5401('0x42')){var _0x273e54={};_0x273e54[_0x4852db[_0x5401('0x2d')]]={'$like':'%'+_0x565486[_0x5401('0x34')][_0x5401('0x3f')]+'%'};return _0x273e54;}})});}_0x4af544=_[_0x5401('0x40')]({},_0x4af544,_0x565486[_0x5401('0x43')]);var _0x3aa9ea={'where':_0x4af544[_0x5401('0x3d')]};return db['WhatsappQueue'][_0x5401('0x20')](_0x3aa9ea)[_0x5401('0x28')](function(_0x3b1d98){_0x37d177['count']=_0x3b1d98;if(_0x565486['query'][_0x5401('0x44')]){_0x4af544['include']=[{'all':!![]}];}return db[_0x5401('0x30')][_0x5401('0x45')](_0x4af544);})['then'](function(_0x2367bf){_0x37d177[_0x5401('0x46')]=_0x2367bf;return _0x37d177;})[_0x5401('0x28')](respondWithFilteredResult(_0x1f53a0,_0x4af544))[_0x5401('0x47')](handleError(_0x1f53a0,null));};exports[_0x5401('0x48')]=function(_0x135f01,_0x1c5c84){var _0x4ec674={'raw':!![],'where':{'id':_0x135f01['params']['id']}},_0xf48c={};_0xf48c[_0x5401('0x37')]=_[_0x5401('0x33')](db[_0x5401('0x30')]['rawAttributes']);_0xf48c[_0x5401('0x34')]=_[_0x5401('0x33')](_0x135f01[_0x5401('0x34')]);_0xf48c[_0x5401('0x35')]=_[_0x5401('0x36')](_0xf48c[_0x5401('0x37')],_0xf48c[_0x5401('0x34')]);_0x4ec674[_0x5401('0x38')]=_['intersection'](_0xf48c['model'],qs[_0x5401('0x39')](_0x135f01['query'][_0x5401('0x39')]));_0x4ec674[_0x5401('0x38')]=_0x4ec674[_0x5401('0x38')][_0x5401('0x49')]?_0x4ec674[_0x5401('0x38')]:_0xf48c[_0x5401('0x37')];if(_0x135f01[_0x5401('0x34')][_0x5401('0x44')]){_0x4ec674[_0x5401('0x4a')]=[{'all':!![]}];}_0x4ec674=_[_0x5401('0x40')]({},_0x4ec674,_0x135f01[_0x5401('0x43')]);return db[_0x5401('0x30')]['find'](_0x4ec674)[_0x5401('0x28')](handleEntityNotFound(_0x1c5c84,null))[_0x5401('0x28')](respondWithResult(_0x1c5c84,null))[_0x5401('0x47')](handleError(_0x1c5c84,null));};exports[_0x5401('0x4b')]=function(_0x5b491f,_0x17c49b){return db[_0x5401('0x30')][_0x5401('0x4b')](_0x5b491f['body'],{})[_0x5401('0x28')](function(_0x5570dc){var _0x250d08=_0x5b491f[_0x5401('0x4c')][_0x5401('0x4d')]({'plain':!![]});if(!_0x250d08)throw new Error(_0x5401('0x4e'));if(_0x250d08[_0x5401('0x4f')]==='user'){var _0x23b9dc=_0x5570dc['get']({'plain':!![]});var _0x1e97d8='WhatsappQueues';return db[_0x5401('0x50')][_0x5401('0x51')]({'where':{'name':_0x1e97d8,'userProfileId':_0x250d08[_0x5401('0x52')]},'raw':!![]})['then'](function(_0x41b4fa){if(_0x41b4fa&&_0x41b4fa['autoAssociation']===0x0){return db[_0x5401('0x2a')][_0x5401('0x4b')]({'name':_0x23b9dc['name'],'resourceId':_0x23b9dc['id'],'type':_0x41b4fa['name'],'sectionId':_0x41b4fa['id']},{})[_0x5401('0x28')](function(){return _0x5570dc;});}else{return _0x5570dc;}})[_0x5401('0x47')](function(_0x907a8c){logger[_0x5401('0x2b')](_0x5401('0x53'),_0x907a8c);throw _0x907a8c;});}return _0x5570dc;})[_0x5401('0x28')](respondWithResult(_0x17c49b,0xc9))['catch'](handleError(_0x17c49b,null));};exports[_0x5401('0x27')]=function(_0x200360,_0x80ae3f){if(_0x200360[_0x5401('0x54')]['id']){delete _0x200360[_0x5401('0x54')]['id'];}return db['WhatsappQueue'][_0x5401('0x51')]({'where':{'id':_0x200360[_0x5401('0x55')]['id']}})['then'](handleEntityNotFound(_0x80ae3f,null))[_0x5401('0x28')](saveUpdates(_0x200360['body'],null))[_0x5401('0x28')](respondWithResult(_0x80ae3f,null))['catch'](handleError(_0x80ae3f,null));};exports[_0x5401('0x29')]=function(_0x380749,_0x112c1c){return db['WhatsappQueue']['find']({'where':{'id':_0x380749[_0x5401('0x55')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x112c1c,null))[_0x5401('0x28')](removeEntity(_0x112c1c,null))[_0x5401('0x47')](handleError(_0x112c1c,null));};exports[_0x5401('0x56')]=function(_0x2a2db5,_0x533b48){return db[_0x5401('0x30')]['describe']()['then'](respondWithResult(_0x533b48,null))[_0x5401('0x47')](handleError(_0x533b48,null));};exports[_0x5401('0x57')]=function(_0x1ead14,_0x4e211c,_0x42a0f1){var _0x26b624={'raw':!![],'where':{}},_0x524a92={},_0x2be9aa;return db[_0x5401('0x30')][_0x5401('0x58')]({'where':{'id':_0x1ead14[_0x5401('0x55')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x4e211c,null))[_0x5401('0x28')](function(_0x104adc){if(_0x104adc){_0x2be9aa=_0x104adc[_0x5401('0x4d')]({'plain':!![]});_0x524a92['model']=_['keys'](db[_0x5401('0x59')][_0x5401('0x31')]);_0x524a92[_0x5401('0x34')]=_[_0x5401('0x33')](_0x1ead14[_0x5401('0x34')]);_0x524a92[_0x5401('0x35')]=_[_0x5401('0x36')](_0x524a92['model'],_0x524a92[_0x5401('0x34')]);_0x26b624[_0x5401('0x38')]=_[_0x5401('0x36')](_0x524a92['model'],qs[_0x5401('0x39')](_0x1ead14[_0x5401('0x34')]['fields']));_0x26b624[_0x5401('0x38')]=_0x26b624[_0x5401('0x38')][_0x5401('0x49')]?_0x26b624[_0x5401('0x38')]:_0x524a92['model'];if(!_0x1ead14[_0x5401('0x34')][_0x5401('0x3a')](_0x5401('0x5a'))){_0x26b624[_0x5401('0x1f')]=qs[_0x5401('0x1f')](_0x1ead14[_0x5401('0x34')][_0x5401('0x1f')]);_0x26b624[_0x5401('0x1d')]=qs['offset'](_0x1ead14[_0x5401('0x34')]['offset']);}_0x26b624[_0x5401('0x3b')]=qs[_0x5401('0x3c')](_0x1ead14[_0x5401('0x34')][_0x5401('0x3c')]);_0x26b624[_0x5401('0x3d')]=qs[_0x5401('0x35')](_['pick'](_0x1ead14[_0x5401('0x34')],_0x524a92['filters']));_0x26b624[_0x5401('0x3d')][_0x5401('0x5b')]=_0x104adc['id'];if(_0x1ead14['query'][_0x5401('0x3f')]){_0x26b624[_0x5401('0x3d')]=_[_0x5401('0x40')](_0x26b624[_0x5401('0x3d')],{'$or':_[_0x5401('0x2f')](_0x26b624[_0x5401('0x38')],function(_0x31340f){var _0x26c7be={};_0x26c7be[_0x31340f]={'$like':'%'+_0x1ead14['query']['filter']+'%'};return _0x26c7be;})});}_0x26b624=_[_0x5401('0x40')]({},_0x26b624,_0x1ead14[_0x5401('0x43')]);return db['UserWhatsappQueue'][_0x5401('0x45')](_0x26b624);}})[_0x5401('0x28')](function(_0x550a1b){if(_0x550a1b){return db[_0x5401('0x5c')][_0x5401('0x5d')]({'where':{'id':_[_0x5401('0x2f')](_0x550a1b,_0x5401('0x5e')),'role':_0x5401('0x5f')},'attributes':['id','name',_0x5401('0x60'),_0x5401('0x61'),_0x5401('0x62')]});}})[_0x5401('0x28')](function(_0xcb8e62){if(_0xcb8e62){return{'count':_0xcb8e62[_0x5401('0x20')],'rows':_[_0x5401('0x2f')](_0xcb8e62[_0x5401('0x46')],function(_0x5b69b2){return{'membername':_0x5b69b2[_0x5401('0x2d')],'UserId':_0x5b69b2['id'],'queue_name':_0x2be9aa[_0x5401('0x2d')],'WhatsappQueueId':_0x2be9aa['id'],'interface':util[_0x5401('0x63')](_0x5401('0x64'),_0x5401('0x65'),_0x5b69b2[_0x5401('0x2d')]),'penalty':0x0,'paused':_0x5b69b2[_0x5401('0x60')],'createdAt':_0x5b69b2[_0x5401('0x62')],'updatedAt':_0x5b69b2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e211c,_0x26b624))[_0x5401('0x47')](handleError(_0x4e211c,null));};exports[_0x5401('0x66')]=function(_0x9b392b,_0x380fb7,_0x480e24){var _0x1a4886={};var _0x29254a={};var _0x52b836;var _0x5a00e4;return db[_0x5401('0x30')][_0x5401('0x58')]({'where':{'id':_0x9b392b[_0x5401('0x55')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x380fb7,null))['then'](function(_0x2277ba){if(_0x2277ba){_0x52b836=_0x2277ba;_0x29254a['model']=_['keys'](db[_0x5401('0x67')][_0x5401('0x31')]);_0x29254a[_0x5401('0x34')]=_[_0x5401('0x33')](_0x9b392b[_0x5401('0x34')]);_0x29254a[_0x5401('0x35')]=_[_0x5401('0x36')](_0x29254a[_0x5401('0x37')],_0x29254a[_0x5401('0x34')]);_0x1a4886[_0x5401('0x38')]=_[_0x5401('0x36')](_0x29254a[_0x5401('0x37')],qs[_0x5401('0x39')](_0x9b392b['query'][_0x5401('0x39')]));_0x1a4886['attributes']=_0x1a4886[_0x5401('0x38')][_0x5401('0x49')]?_0x1a4886[_0x5401('0x38')]:_0x29254a[_0x5401('0x37')];_0x1a4886[_0x5401('0x3b')]=qs['sort'](_0x9b392b[_0x5401('0x34')][_0x5401('0x3c')]);_0x1a4886[_0x5401('0x3d')]=qs[_0x5401('0x35')](_['pick'](_0x9b392b[_0x5401('0x34')],_0x29254a[_0x5401('0x35')]));if(_0x9b392b[_0x5401('0x34')][_0x5401('0x3f')]){_0x1a4886['where']=_['merge'](_0x1a4886['where'],{'$or':_['map'](_0x1a4886[_0x5401('0x38')],function(_0x56557d){var _0x36668e={};_0x36668e[_0x56557d]={'$like':'%'+_0x9b392b[_0x5401('0x34')][_0x5401('0x3f')]+'%'};return _0x36668e;})});}_0x1a4886=_[_0x5401('0x40')]({},_0x1a4886,_0x9b392b['options']);return _0x52b836[_0x5401('0x66')](_0x1a4886);}})[_0x5401('0x28')](function(_0x2c0759){if(_0x2c0759){_0x5a00e4=_0x2c0759[_0x5401('0x49')];if(!_0x9b392b[_0x5401('0x34')][_0x5401('0x3a')]('nolimit')){_0x1a4886[_0x5401('0x1f')]=qs[_0x5401('0x1f')](_0x9b392b['query'][_0x5401('0x1f')]);_0x1a4886[_0x5401('0x1d')]=qs[_0x5401('0x1d')](_0x9b392b[_0x5401('0x34')][_0x5401('0x1d')]);}return _0x52b836[_0x5401('0x66')](_0x1a4886);}})['then'](function(_0x3dd230){if(_0x3dd230){return _0x3dd230?{'count':_0x5a00e4,'rows':_0x3dd230}:null;}})[_0x5401('0x28')](respondWithResult(_0x380fb7,null))[_0x5401('0x47')](handleError(_0x380fb7,null));};exports[_0x5401('0x68')]=function(_0x544dd0,_0x27e128,_0x59bce4){var _0x13cc86=_0x544dd0['body'][_0x5401('0x69')];return db[_0x5401('0x67')][_0x5401('0x45')]({'where':{'id':_0x13cc86},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5401('0x6a'),'attributes':['id',_0x5401('0x2d'),_0x5401('0x6b'),_0x5401('0x6c'),'interface'],'raw':!![]}]})[_0x5401('0x28')](function(_0x42f95e){if(_0x42f95e){var _0x3fb843=_['flatMap'](_0x42f95e,function(_0x1e98c9){var _0x3e80bb=_0x1e98c9[_0x5401('0x4d')]({'plain':!![]});return _0x3e80bb[_0x5401('0x6a')];});return db[_0x5401('0x30')][_0x5401('0x51')]({'where':{'id':_0x544dd0[_0x5401('0x55')]['id']}})[_0x5401('0x28')](function(_0x228ddf){return db['sequelize'][_0x5401('0x6d')](function(_0x203c31){return _0x228ddf[_0x5401('0x68')](_0x13cc86,{'transaction':_0x203c31})['then'](function(){return BPromise[_0x5401('0x6e')](_0x3fb843,function(_0x3ef747){return db[_0x5401('0x59')][_0x5401('0x6f')]({'where':{'UserId':_0x3ef747['id'],'WhatsappQueueId':_0x544dd0[_0x5401('0x55')]['id']},'transaction':_0x203c31});});})[_0x5401('0x28')](function(){_0x3fb843[_0x5401('0x70')](function(_0x23ca65){socket[_0x5401('0x71')](_0x5401('0x72'),{'UserId':_0x23ca65['id'],'WhatsappQueueId':_0x228ddf['id']});});});});});}})[_0x5401('0x28')](respondWithStatusCode(_0x27e128,null))[_0x5401('0x47')](handleError(_0x27e128,null));};exports[_0x5401('0x73')]=function(_0x4d262a,_0x5026ee,_0x4dc45b){return db[_0x5401('0x67')][_0x5401('0x45')]({'where':{'id':_0x4d262a[_0x5401('0x34')][_0x5401('0x69')]},'attributes':['id'],'include':[{'model':db[_0x5401('0x5c')],'as':_0x5401('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5026ee,null))[_0x5401('0x28')](function(_0x375f24){var _0x13f5ce=_[_0x5401('0x2f')](_0x375f24,'id');var _0x524ebd=[];var _0x58d2a9=[];var _0x39286d=squel[_0x5401('0x74')]();_0x39286d[_0x5401('0x75')](_0x5401('0x76'))['from']('team_has_whatsapp_queues','tq')[_0x5401('0x77')](_0x5401('0x78'),'ut',_0x5401('0x79'))[_0x5401('0x3d')](_0x5401('0x7a'),_0x4d262a[_0x5401('0x55')]['id']);for(var _0x48068c=0x0;_0x48068c<_0x375f24[_0x5401('0x49')];_0x48068c+=0x1){let _0x332f0d=_0x375f24[_0x48068c];for(var _0xea8be=0x0;_0xea8be<_0x332f0d[_0x5401('0x6a')][_0x5401('0x49')];_0xea8be+=0x1){let _0x2b1a32=_0x332f0d['Agents'][_0xea8be];var _0x379cb1=_0x39286d[_0x5401('0x7b')]();_0x379cb1[_0x5401('0x3d')](_0x5401('0x7c'),_0x2b1a32['id']);_0x58d2a9[_0x5401('0x7d')](db[_0x5401('0x7e')]['query'](_0x379cb1['toString'](),{'type':db[_0x5401('0x7e')][_0x5401('0x7f')][_0x5401('0x80')]})[_0x5401('0x28')](function(_0x4422e2){if(_0x4422e2[_0x5401('0x49')]===0x1){return _0x2b1a32['id'];}else{var _0x33d1da=_[_0x5401('0x81')](_[_0x5401('0x2f')](_0x4422e2,'TeamId'),function(_0x41f48e){return _['includes'](_0x13f5ce,_0x41f48e);});if(_0x33d1da){return _0x2b1a32['id'];}}}));}}return BPromise[_0x5401('0x82')](_0x58d2a9)['then'](function(_0x305a3f){_0x524ebd=_(_0x524ebd)[_0x5401('0x83')](_0x305a3f)[_0x5401('0x84')]()['value']();return db[_0x5401('0x30')][_0x5401('0x51')]({'where':{'id':_0x4d262a['params']['id']}})[_0x5401('0x28')](function(_0x1264f0){return db[_0x5401('0x7e')][_0x5401('0x6d')](function(_0x703eaf){return _0x1264f0['removeTeams'](_0x4d262a['query'][_0x5401('0x69')],{'transaction':_0x703eaf})[_0x5401('0x28')](function(){if(!_[_0x5401('0x85')](_0x524ebd)){return _0x1264f0[_0x5401('0x86')](_0x524ebd,{'transaction':_0x703eaf});}})[_0x5401('0x28')](function(){_0x524ebd[_0x5401('0x70')](function(_0x236a28){socket[_0x5401('0x71')](_0x5401('0x87'),{'UserId':_0x236a28,'WhatsappQueueId':_0x1264f0['id']});});});});});});})[_0x5401('0x28')](respondWithStatusCode(_0x5026ee,null))[_0x5401('0x47')](handleError(_0x5026ee,null));};exports[_0x5401('0x88')]=function(_0x4061fa,_0x223db8,_0x50854d){return db[_0x5401('0x30')][_0x5401('0x51')]({'where':{'id':_0x4061fa[_0x5401('0x55')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x223db8,null))[_0x5401('0x28')](function(_0x4be4d4){if(_0x4be4d4){return _0x4be4d4[_0x5401('0x88')](_0x4061fa[_0x5401('0x54')][_0x5401('0x69')],_[_0x5401('0x89')](_0x4061fa[_0x5401('0x54')],[_0x5401('0x69'),'id'])||{})[_0x5401('0x8a')](function(_0x176396){for(var _0x243b04=0x0;_0x243b04<_0x4061fa['body'][_0x5401('0x69')]['length'];_0x243b04+=0x1){socket[_0x5401('0x71')](_0x5401('0x72'),{'UserId':Number(_0x4061fa[_0x5401('0x54')]['ids'][_0x243b04]),'WhatsappQueueId':Number(_0x4061fa['params']['id'])});}return _0x176396;});}})['then'](respondWithResult(_0x223db8,null))['catch'](handleError(_0x223db8,null));};exports[_0x5401('0x86')]=function(_0x1f3434,_0x41eab7,_0x1152e1){return db[_0x5401('0x30')]['find']({'where':{'id':_0x1f3434[_0x5401('0x55')]['id']}})['then'](handleEntityNotFound(_0x41eab7,null))[_0x5401('0x28')](function(_0x4ef6ae){if(_0x4ef6ae){return _0x4ef6ae['removeAgents'](_0x1f3434[_0x5401('0x34')][_0x5401('0x69')])[_0x5401('0x28')](function(){if(_[_0x5401('0x8b')](_0x1f3434[_0x5401('0x34')][_0x5401('0x69')])){for(var _0x3a2bab=0x0;_0x3a2bab<_0x1f3434[_0x5401('0x34')][_0x5401('0x69')]['length'];_0x3a2bab+=0x1){socket[_0x5401('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x1f3434[_0x5401('0x34')][_0x5401('0x69')][_0x3a2bab]),'WhatsappQueueId':Number(_0x1f3434[_0x5401('0x55')]['id'])});}}else{socket[_0x5401('0x71')](_0x5401('0x87'),{'UserId':Number(_0x1f3434[_0x5401('0x34')][_0x5401('0x69')]),'WhatsappQueueId':Number(_0x1f3434[_0x5401('0x55')]['id'])});}});}})[_0x5401('0x28')](respondWithStatusCode(_0x41eab7,null))[_0x5401('0x47')](handleError(_0x41eab7,null));};exports[_0x5401('0x8c')]=function(_0x2972e2,_0x1f19d9,_0x19481b){var _0x45f906={};var _0x4fe340={};var _0x29fe5d;var _0x583dfa;return db[_0x5401('0x30')][_0x5401('0x58')]({'where':{'id':_0x2972e2[_0x5401('0x55')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x1f19d9,null))['then'](function(_0x2ddec8){if(_0x2ddec8){_0x29fe5d=_0x2ddec8;_0x4fe340[_0x5401('0x37')]=_[_0x5401('0x33')](db['User'][_0x5401('0x31')]);_0x4fe340[_0x5401('0x34')]=_[_0x5401('0x33')](_0x2972e2['query']);_0x4fe340[_0x5401('0x35')]=_[_0x5401('0x36')](_0x4fe340[_0x5401('0x37')],_0x4fe340[_0x5401('0x34')]);_0x45f906[_0x5401('0x38')]=_['intersection'](_0x4fe340[_0x5401('0x37')],qs[_0x5401('0x39')](_0x2972e2[_0x5401('0x34')]['fields']));_0x45f906[_0x5401('0x38')]=_0x45f906[_0x5401('0x38')]['length']?_0x45f906['attributes']:_0x4fe340[_0x5401('0x37')];_0x45f906[_0x5401('0x3b')]=qs[_0x5401('0x3c')](_0x2972e2['query'][_0x5401('0x3c')]);_0x45f906['where']=qs[_0x5401('0x35')](_[_0x5401('0x3e')](_0x2972e2[_0x5401('0x34')],_0x4fe340[_0x5401('0x35')]));if(_0x2972e2[_0x5401('0x34')]['filter']){_0x45f906[_0x5401('0x3d')]=_[_0x5401('0x40')](_0x45f906[_0x5401('0x3d')],{'$or':_[_0x5401('0x2f')](_0x45f906[_0x5401('0x38')],function(_0x28b02e){var _0x346bc5={};_0x346bc5[_0x28b02e]={'$like':'%'+_0x2972e2[_0x5401('0x34')]['filter']+'%'};return _0x346bc5;})});}_0x45f906=_[_0x5401('0x40')]({},_0x45f906,_0x2972e2['options']);return _0x29fe5d['getAgents'](_0x45f906);}})[_0x5401('0x28')](function(_0x4afbf1){if(_0x4afbf1){_0x583dfa=_0x4afbf1['length'];if(!_0x2972e2['query']['hasOwnProperty'](_0x5401('0x5a'))){_0x45f906[_0x5401('0x1f')]=qs[_0x5401('0x1f')](_0x2972e2[_0x5401('0x34')][_0x5401('0x1f')]);_0x45f906[_0x5401('0x1d')]=qs[_0x5401('0x1d')](_0x2972e2[_0x5401('0x34')][_0x5401('0x1d')]);}return _0x29fe5d[_0x5401('0x8c')](_0x45f906);}})['then'](function(_0x31b104){if(_0x31b104){return _0x31b104?{'count':_0x583dfa,'rows':_0x31b104}:null;}})['then'](respondWithResult(_0x1f19d9,null))[_0x5401('0x47')](handleError(_0x1f19d9,null));}; \ No newline at end of file +var _0xd4cd=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAll','User','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key'];(function(_0x1dd0cb,_0x55e76b){var _0x1218b0=function(_0x527ee3){while(--_0x527ee3){_0x1dd0cb['push'](_0x1dd0cb['shift']());}};_0x1218b0(++_0x55e76b);}(_0xd4cd,0x174));var _0xdd4c=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xd4cd[_0x368587];return _0x42d33c;};'use strict';var emlformat=require(_0xdd4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd4c('0x1'));var jsonpatch=require(_0xdd4c('0x2'));var rp=require(_0xdd4c('0x3'));var moment=require(_0xdd4c('0x4'));var BPromise=require(_0xdd4c('0x5'));var Mustache=require(_0xdd4c('0x6'));var util=require(_0xdd4c('0x7'));var path=require(_0xdd4c('0x8'));var sox=require(_0xdd4c('0x9'));var csv=require(_0xdd4c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4c('0xb'));var squel=require(_0xdd4c('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd4c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdd4c('0xa'));var querystring=require('querystring');var Papa=require(_0xdd4c('0xe'));var Redis=require(_0xdd4c('0xf'));var authService=require(_0xdd4c('0x10'));var qs=require(_0xdd4c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4c('0x12'))(_0xdd4c('0x13'));var utils=require(_0xdd4c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdd4c('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xdd4c('0x16')],{'host':_0xdd4c('0x17'),'port':0x18eb});var socket=require(_0xdd4c('0x18'))(new Redis(config[_0xdd4c('0x16')]));require('./whatsappQueue.socket')[_0xdd4c('0x19')](socket);function respondWithStatusCode(_0x18d515,_0x5f0c2b){_0x5f0c2b=_0x5f0c2b||0xcc;return function(_0x263852){if(_0x263852){return _0x18d515[_0xdd4c('0x1a')](_0x5f0c2b);}return _0x18d515[_0xdd4c('0x1b')](_0x5f0c2b)[_0xdd4c('0x1c')]();};}function respondWithResult(_0x3fa543,_0x56fbdb){_0x56fbdb=_0x56fbdb||0xc8;return function(_0x40a9e9){if(_0x40a9e9){return _0x3fa543[_0xdd4c('0x1b')](_0x56fbdb)[_0xdd4c('0x1d')](_0x40a9e9);}};}function respondWithFilteredResult(_0x1fef0d,_0xd53787){return function(_0x42b00e){if(_0x42b00e){var _0x2e703d=typeof _0xd53787[_0xdd4c('0x1e')]==='undefined'&&typeof _0xd53787['limit']===_0xdd4c('0x1f');var _0x277dfd=_0x42b00e[_0xdd4c('0x20')];var _0x2a2f4c=_0x2e703d?0x0:_0xd53787[_0xdd4c('0x1e')];var _0x1c55c9=_0x2e703d?_0x42b00e[_0xdd4c('0x20')]:_0xd53787['offset']+_0xd53787[_0xdd4c('0x21')];var _0x59c2df;if(_0x1c55c9>=_0x277dfd){_0x1c55c9=_0x277dfd;_0x59c2df=0xc8;}else{_0x59c2df=0xce;}_0x1fef0d[_0xdd4c('0x1b')](_0x59c2df);return _0x1fef0d[_0xdd4c('0x22')](_0xdd4c('0x23'),_0x2a2f4c+'-'+_0x1c55c9+'/'+_0x277dfd)[_0xdd4c('0x1d')](_0x42b00e);}return null;};}function patchUpdates(_0x318e03){return function(_0x32cb95){try{jsonpatch[_0xdd4c('0x24')](_0x32cb95,_0x318e03,!![]);}catch(_0x2ed251){return BPromise[_0xdd4c('0x25')](_0x2ed251);}return _0x32cb95['save']();};}function saveUpdates(_0x2863bc,_0x12b089){return function(_0x264337){if(_0x264337){return _0x264337[_0xdd4c('0x26')](_0x2863bc)[_0xdd4c('0x27')](function(_0x2b8aa6){return _0x2b8aa6;});}return null;};}function removeEntity(_0x2edc3c,_0x190e08){return function(_0x51d4a1){if(_0x51d4a1){return _0x51d4a1['destroy']()[_0xdd4c('0x27')](function(){var _0x55bf88=_0x51d4a1[_0xdd4c('0x28')]({'plain':!![]});var _0x3e0102=_0xdd4c('0x29');return db[_0xdd4c('0x2a')][_0xdd4c('0x2b')]({'where':{'type':_0x3e0102,'resourceId':_0x55bf88['id']}})['then'](function(){return _0x51d4a1;});})[_0xdd4c('0x27')](function(){_0x2edc3c[_0xdd4c('0x1b')](0xcc)[_0xdd4c('0x1c')]();});}};}function handleEntityNotFound(_0x118436,_0x7e29ae){return function(_0x26f348){if(!_0x26f348){_0x118436[_0xdd4c('0x1a')](0x194);}return _0x26f348;};}function handleError(_0xb3d2e4,_0x3b23ae){_0x3b23ae=_0x3b23ae||0x1f4;return function(_0x561f9d){logger[_0xdd4c('0x2c')](_0x561f9d[_0xdd4c('0x2d')]);if(_0x561f9d[_0xdd4c('0x2e')]){delete _0x561f9d[_0xdd4c('0x2e')];}_0xb3d2e4[_0xdd4c('0x1b')](_0x3b23ae)[_0xdd4c('0x2f')](_0x561f9d);};}exports[_0xdd4c('0x30')]=function(_0x59429d,_0x5383d6){var _0x50854b={},_0x49669d={},_0x2d1a2d={'count':0x0,'rows':[]};var _0x22bdbe=_[_0xdd4c('0x31')](db[_0xdd4c('0x32')]['rawAttributes'],function(_0x54dd37){return{'name':_0x54dd37[_0xdd4c('0x33')],'type':_0x54dd37[_0xdd4c('0x34')][_0xdd4c('0x35')]};});_0x49669d[_0xdd4c('0x36')]=_[_0xdd4c('0x31')](_0x22bdbe,'name');_0x49669d[_0xdd4c('0x37')]=_[_0xdd4c('0x38')](_0x59429d[_0xdd4c('0x37')]);_0x49669d[_0xdd4c('0x39')]=_['intersection'](_0x49669d[_0xdd4c('0x36')],_0x49669d[_0xdd4c('0x37')]);_0x50854b[_0xdd4c('0x3a')]=_[_0xdd4c('0x3b')](_0x49669d[_0xdd4c('0x36')],qs[_0xdd4c('0x3c')](_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x3c')]));_0x50854b[_0xdd4c('0x3a')]=_0x50854b['attributes'][_0xdd4c('0x3d')]?_0x50854b[_0xdd4c('0x3a')]:_0x49669d['model'];if(!_0x59429d['query'][_0xdd4c('0x3e')](_0xdd4c('0x3f'))){_0x50854b[_0xdd4c('0x21')]=qs['limit'](_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x21')]);_0x50854b['offset']=qs[_0xdd4c('0x1e')](_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x1e')]);}_0x50854b['order']=qs[_0xdd4c('0x40')](_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x40')]);_0x50854b['where']=qs[_0xdd4c('0x39')](_[_0xdd4c('0x41')](_0x59429d['query'],_0x49669d[_0xdd4c('0x39')]),_0x22bdbe);if(_0x59429d['query'][_0xdd4c('0x42')]){_0x50854b[_0xdd4c('0x43')]=_[_0xdd4c('0x44')](_0x50854b[_0xdd4c('0x43')],{'$or':_['map'](_0x22bdbe,function(_0x2467a6){if(_0x2467a6[_0xdd4c('0x34')]!==_0xdd4c('0x45')){var _0x425686={};_0x425686[_0x2467a6['name']]={'$like':'%'+_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x42')]+'%'};return _0x425686;}})});}_0x50854b=_[_0xdd4c('0x44')]({},_0x50854b,_0x59429d[_0xdd4c('0x46')]);var _0x191800={'where':_0x50854b[_0xdd4c('0x43')]};return db['WhatsappQueue'][_0xdd4c('0x20')](_0x191800)[_0xdd4c('0x27')](function(_0x263265){_0x2d1a2d[_0xdd4c('0x20')]=_0x263265;if(_0x59429d[_0xdd4c('0x37')][_0xdd4c('0x47')]){_0x50854b[_0xdd4c('0x48')]=[{'all':!![]}];}return db[_0xdd4c('0x32')]['findAll'](_0x50854b);})[_0xdd4c('0x27')](function(_0xeaaa44){_0x2d1a2d[_0xdd4c('0x49')]=_0xeaaa44;return _0x2d1a2d;})[_0xdd4c('0x27')](respondWithFilteredResult(_0x5383d6,_0x50854b))[_0xdd4c('0x4a')](handleError(_0x5383d6,null));};exports[_0xdd4c('0x4b')]=function(_0x1ff2db,_0x135f65){var _0x1bbddf={'raw':!![],'where':{'id':_0x1ff2db[_0xdd4c('0x4c')]['id']}},_0x127c30={};_0x127c30[_0xdd4c('0x36')]=_['keys'](db['WhatsappQueue'][_0xdd4c('0x4d')]);_0x127c30[_0xdd4c('0x37')]=_[_0xdd4c('0x38')](_0x1ff2db[_0xdd4c('0x37')]);_0x127c30[_0xdd4c('0x39')]=_['intersection'](_0x127c30[_0xdd4c('0x36')],_0x127c30[_0xdd4c('0x37')]);_0x1bbddf['attributes']=_[_0xdd4c('0x3b')](_0x127c30[_0xdd4c('0x36')],qs['fields'](_0x1ff2db[_0xdd4c('0x37')][_0xdd4c('0x3c')]));_0x1bbddf[_0xdd4c('0x3a')]=_0x1bbddf['attributes'][_0xdd4c('0x3d')]?_0x1bbddf[_0xdd4c('0x3a')]:_0x127c30[_0xdd4c('0x36')];if(_0x1ff2db[_0xdd4c('0x37')][_0xdd4c('0x47')]){_0x1bbddf['include']=[{'all':!![]}];}_0x1bbddf=_[_0xdd4c('0x44')]({},_0x1bbddf,_0x1ff2db[_0xdd4c('0x46')]);return db[_0xdd4c('0x32')]['find'](_0x1bbddf)[_0xdd4c('0x27')](handleEntityNotFound(_0x135f65,null))[_0xdd4c('0x27')](respondWithResult(_0x135f65,null))['catch'](handleError(_0x135f65,null));};exports[_0xdd4c('0x4e')]=function(_0x1d599f,_0xe73ee1){return db[_0xdd4c('0x32')][_0xdd4c('0x4e')](_0x1d599f['body'],{})[_0xdd4c('0x27')](function(_0x21e687){var _0x1c85ff=_0x1d599f[_0xdd4c('0x4f')][_0xdd4c('0x28')]({'plain':!![]});if(!_0x1c85ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c85ff[_0xdd4c('0x50')]===_0xdd4c('0x4f')){var _0x48af4b=_0x21e687[_0xdd4c('0x28')]({'plain':!![]});var _0x3d8ebf='WhatsappQueues';return db[_0xdd4c('0x51')][_0xdd4c('0x52')]({'where':{'name':_0x3d8ebf,'userProfileId':_0x1c85ff[_0xdd4c('0x53')]},'raw':!![]})[_0xdd4c('0x27')](function(_0x496d2f){if(_0x496d2f&&_0x496d2f[_0xdd4c('0x54')]===0x0){return db[_0xdd4c('0x2a')][_0xdd4c('0x4e')]({'name':_0x48af4b[_0xdd4c('0x2e')],'resourceId':_0x48af4b['id'],'type':_0x496d2f['name'],'sectionId':_0x496d2f['id']},{})['then'](function(){return _0x21e687;});}else{return _0x21e687;}})['catch'](function(_0x1ea3d4){logger[_0xdd4c('0x2c')](_0xdd4c('0x55'),_0x1ea3d4);throw _0x1ea3d4;});}return _0x21e687;})[_0xdd4c('0x27')](respondWithResult(_0xe73ee1,0xc9))[_0xdd4c('0x4a')](handleError(_0xe73ee1,null));};exports['update']=function(_0x3f5151,_0x25dc1d){if(_0x3f5151[_0xdd4c('0x56')]['id']){delete _0x3f5151[_0xdd4c('0x56')]['id'];}return db['WhatsappQueue'][_0xdd4c('0x52')]({'where':{'id':_0x3f5151['params']['id']}})['then'](handleEntityNotFound(_0x25dc1d,null))[_0xdd4c('0x27')](saveUpdates(_0x3f5151['body'],null))['then'](respondWithResult(_0x25dc1d,null))['catch'](handleError(_0x25dc1d,null));};exports[_0xdd4c('0x2b')]=function(_0x5a8837,_0x2f2fc0){return db[_0xdd4c('0x32')]['find']({'where':{'id':_0x5a8837['params']['id']}})['then'](handleEntityNotFound(_0x2f2fc0,null))[_0xdd4c('0x27')](removeEntity(_0x2f2fc0,null))[_0xdd4c('0x4a')](handleError(_0x2f2fc0,null));};exports[_0xdd4c('0x57')]=function(_0xf1584b,_0x1bea73){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x1bea73,null))[_0xdd4c('0x4a')](handleError(_0x1bea73,null));};exports[_0xdd4c('0x58')]=function(_0x2f75a8,_0x382b21,_0xdf7e99){var _0x4ed8f8={'raw':!![],'where':{}},_0x5d27da={},_0x8579d7;return db[_0xdd4c('0x32')][_0xdd4c('0x59')]({'where':{'id':_0x2f75a8[_0xdd4c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x382b21,null))[_0xdd4c('0x27')](function(_0x4cc60f){if(_0x4cc60f){_0x8579d7=_0x4cc60f['get']({'plain':!![]});_0x5d27da[_0xdd4c('0x36')]=_['keys'](db[_0xdd4c('0x5a')]['rawAttributes']);_0x5d27da[_0xdd4c('0x37')]=_[_0xdd4c('0x38')](_0x2f75a8[_0xdd4c('0x37')]);_0x5d27da[_0xdd4c('0x39')]=_['intersection'](_0x5d27da[_0xdd4c('0x36')],_0x5d27da['query']);_0x4ed8f8[_0xdd4c('0x3a')]=_[_0xdd4c('0x3b')](_0x5d27da[_0xdd4c('0x36')],qs[_0xdd4c('0x3c')](_0x2f75a8[_0xdd4c('0x37')]['fields']));_0x4ed8f8[_0xdd4c('0x3a')]=_0x4ed8f8['attributes']['length']?_0x4ed8f8[_0xdd4c('0x3a')]:_0x5d27da['model'];if(!_0x2f75a8[_0xdd4c('0x37')]['hasOwnProperty']('nolimit')){_0x4ed8f8['limit']=qs[_0xdd4c('0x21')](_0x2f75a8['query'][_0xdd4c('0x21')]);_0x4ed8f8[_0xdd4c('0x1e')]=qs[_0xdd4c('0x1e')](_0x2f75a8[_0xdd4c('0x37')][_0xdd4c('0x1e')]);}_0x4ed8f8[_0xdd4c('0x5b')]=qs[_0xdd4c('0x40')](_0x2f75a8[_0xdd4c('0x37')][_0xdd4c('0x40')]);_0x4ed8f8[_0xdd4c('0x43')]=qs['filters'](_[_0xdd4c('0x41')](_0x2f75a8[_0xdd4c('0x37')],_0x5d27da['filters']));_0x4ed8f8[_0xdd4c('0x43')][_0xdd4c('0x5c')]=_0x4cc60f['id'];if(_0x2f75a8['query'][_0xdd4c('0x42')]){_0x4ed8f8[_0xdd4c('0x43')]=_[_0xdd4c('0x44')](_0x4ed8f8[_0xdd4c('0x43')],{'$or':_[_0xdd4c('0x31')](_0x4ed8f8['attributes'],function(_0x829800){var _0x53029c={};_0x53029c[_0x829800]={'$like':'%'+_0x2f75a8['query'][_0xdd4c('0x42')]+'%'};return _0x53029c;})});}_0x4ed8f8=_[_0xdd4c('0x44')]({},_0x4ed8f8,_0x2f75a8[_0xdd4c('0x46')]);return db[_0xdd4c('0x5a')][_0xdd4c('0x5d')](_0x4ed8f8);}})[_0xdd4c('0x27')](function(_0x49f436){if(_0x49f436){return db[_0xdd4c('0x5e')][_0xdd4c('0x5f')]({'where':{'id':_[_0xdd4c('0x31')](_0x49f436,'UserId'),'role':_0xdd4c('0x60')},'attributes':['id',_0xdd4c('0x2e'),_0xdd4c('0x61'),'updatedAt',_0xdd4c('0x62')]});}})[_0xdd4c('0x27')](function(_0x5e6780){if(_0x5e6780){return{'count':_0x5e6780[_0xdd4c('0x20')],'rows':_[_0xdd4c('0x31')](_0x5e6780[_0xdd4c('0x49')],function(_0x34a8dc){return{'membername':_0x34a8dc[_0xdd4c('0x2e')],'UserId':_0x34a8dc['id'],'queue_name':_0x8579d7['name'],'WhatsappQueueId':_0x8579d7['id'],'interface':util[_0xdd4c('0x63')](_0xdd4c('0x64'),_0xdd4c('0x65'),_0x34a8dc['name']),'penalty':0x0,'paused':_0x34a8dc[_0xdd4c('0x61')],'createdAt':_0x34a8dc[_0xdd4c('0x62')],'updatedAt':_0x34a8dc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x382b21,_0x4ed8f8))['catch'](handleError(_0x382b21,null));};exports[_0xdd4c('0x66')]=function(_0x31284e,_0xac0444,_0x18b714){var _0x4666c3={};var _0x36f807={};var _0x426a0c;var _0x3670d9;return db[_0xdd4c('0x32')][_0xdd4c('0x59')]({'where':{'id':_0x31284e[_0xdd4c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xac0444,null))[_0xdd4c('0x27')](function(_0x2d03c5){if(_0x2d03c5){_0x426a0c=_0x2d03c5;_0x36f807['model']=_[_0xdd4c('0x38')](db[_0xdd4c('0x67')][_0xdd4c('0x4d')]);_0x36f807[_0xdd4c('0x37')]=_[_0xdd4c('0x38')](_0x31284e['query']);_0x36f807[_0xdd4c('0x39')]=_[_0xdd4c('0x3b')](_0x36f807[_0xdd4c('0x36')],_0x36f807[_0xdd4c('0x37')]);_0x4666c3[_0xdd4c('0x3a')]=_['intersection'](_0x36f807[_0xdd4c('0x36')],qs[_0xdd4c('0x3c')](_0x31284e[_0xdd4c('0x37')][_0xdd4c('0x3c')]));_0x4666c3[_0xdd4c('0x3a')]=_0x4666c3['attributes'][_0xdd4c('0x3d')]?_0x4666c3[_0xdd4c('0x3a')]:_0x36f807[_0xdd4c('0x36')];_0x4666c3[_0xdd4c('0x5b')]=qs['sort'](_0x31284e[_0xdd4c('0x37')][_0xdd4c('0x40')]);_0x4666c3['where']=qs[_0xdd4c('0x39')](_[_0xdd4c('0x41')](_0x31284e[_0xdd4c('0x37')],_0x36f807[_0xdd4c('0x39')]));if(_0x31284e[_0xdd4c('0x37')][_0xdd4c('0x42')]){_0x4666c3[_0xdd4c('0x43')]=_[_0xdd4c('0x44')](_0x4666c3[_0xdd4c('0x43')],{'$or':_[_0xdd4c('0x31')](_0x4666c3['attributes'],function(_0x316f27){var _0x28df4b={};_0x28df4b[_0x316f27]={'$like':'%'+_0x31284e['query'][_0xdd4c('0x42')]+'%'};return _0x28df4b;})});}_0x4666c3=_['merge']({},_0x4666c3,_0x31284e['options']);return _0x426a0c['getTeams'](_0x4666c3);}})[_0xdd4c('0x27')](function(_0xdf9cbd){if(_0xdf9cbd){_0x3670d9=_0xdf9cbd[_0xdd4c('0x3d')];if(!_0x31284e[_0xdd4c('0x37')][_0xdd4c('0x3e')](_0xdd4c('0x3f'))){_0x4666c3['limit']=qs[_0xdd4c('0x21')](_0x31284e[_0xdd4c('0x37')][_0xdd4c('0x21')]);_0x4666c3[_0xdd4c('0x1e')]=qs['offset'](_0x31284e[_0xdd4c('0x37')]['offset']);}return _0x426a0c['getTeams'](_0x4666c3);}})[_0xdd4c('0x27')](function(_0x4c4bc7){if(_0x4c4bc7){return _0x4c4bc7?{'count':_0x3670d9,'rows':_0x4c4bc7}:null;}})['then'](respondWithResult(_0xac0444,null))[_0xdd4c('0x4a')](handleError(_0xac0444,null));};exports['addTeams']=function(_0x2c7ee0,_0x37f7c8,_0x10b603){var _0x10289e=_0x2c7ee0[_0xdd4c('0x56')][_0xdd4c('0x68')];return db[_0xdd4c('0x67')][_0xdd4c('0x5d')]({'where':{'id':_0x10289e},'attributes':['id'],'include':[{'model':db[_0xdd4c('0x5e')],'as':_0xdd4c('0x69'),'attributes':['id',_0xdd4c('0x2e'),_0xdd4c('0x6a'),_0xdd4c('0x6b'),_0xdd4c('0x6c')],'raw':!![]}]})[_0xdd4c('0x27')](function(_0x3aa577){if(_0x3aa577){var _0x1b3c20=_['flatMap'](_0x3aa577,function(_0x2d3a34){var _0x2f9782=_0x2d3a34['get']({'plain':!![]});return _0x2f9782[_0xdd4c('0x69')];});return db[_0xdd4c('0x32')][_0xdd4c('0x52')]({'where':{'id':_0x2c7ee0[_0xdd4c('0x4c')]['id']}})[_0xdd4c('0x27')](function(_0x109492){return db[_0xdd4c('0x6d')]['transaction'](function(_0x31c18b){return _0x109492['addTeams'](_0x10289e,{'transaction':_0x31c18b})[_0xdd4c('0x27')](function(){return BPromise[_0xdd4c('0x6e')](_0x1b3c20,function(_0x663ff3){return db[_0xdd4c('0x5a')][_0xdd4c('0x6f')]({'where':{'UserId':_0x663ff3['id'],'WhatsappQueueId':_0x2c7ee0[_0xdd4c('0x4c')]['id']},'transaction':_0x31c18b});});})[_0xdd4c('0x27')](function(){_0x1b3c20['forEach'](function(_0x9a2079){socket['emit'](_0xdd4c('0x70'),{'UserId':_0x9a2079['id'],'WhatsappQueueId':_0x109492['id']});});});});});}})[_0xdd4c('0x27')](respondWithStatusCode(_0x37f7c8,null))[_0xdd4c('0x4a')](handleError(_0x37f7c8,null));};exports[_0xdd4c('0x71')]=function(_0x27a65d,_0x46015c,_0x3c0977){return db[_0xdd4c('0x67')][_0xdd4c('0x5d')]({'where':{'id':_0x27a65d[_0xdd4c('0x37')][_0xdd4c('0x68')]},'attributes':['id'],'include':[{'model':db[_0xdd4c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdd4c('0x27')](handleEntityNotFound(_0x46015c,null))[_0xdd4c('0x27')](function(_0x2b80ec){var _0x4fd683=_['map'](_0x2b80ec,'id');var _0x18b4e2=[];var _0x2a8a5a=[];var _0x590cc5=squel[_0xdd4c('0x72')]();_0x590cc5[_0xdd4c('0x73')](_0xdd4c('0x74'))[_0xdd4c('0x75')]('team_has_whatsapp_queues','tq')[_0xdd4c('0x76')](_0xdd4c('0x77'),'ut',_0xdd4c('0x78'))['where'](_0xdd4c('0x79'),_0x27a65d['params']['id']);for(var _0x42f74a=0x0;_0x42f74a<_0x2b80ec[_0xdd4c('0x3d')];_0x42f74a+=0x1){let _0x271f78=_0x2b80ec[_0x42f74a];for(var _0x47e983=0x0;_0x47e983<_0x271f78[_0xdd4c('0x69')][_0xdd4c('0x3d')];_0x47e983+=0x1){let _0x56db3b=_0x271f78[_0xdd4c('0x69')][_0x47e983];var _0x4e2ea3=_0x590cc5[_0xdd4c('0x7a')]();_0x4e2ea3[_0xdd4c('0x43')]('ut.UserId\x20=\x20?',_0x56db3b['id']);_0x2a8a5a['push'](db[_0xdd4c('0x6d')][_0xdd4c('0x37')](_0x4e2ea3[_0xdd4c('0x7b')](),{'type':db[_0xdd4c('0x6d')][_0xdd4c('0x7c')][_0xdd4c('0x7d')]})['then'](function(_0x2a8925){if(_0x2a8925[_0xdd4c('0x3d')]===0x1){return _0x56db3b['id'];}else{var _0x31a337=_['every'](_[_0xdd4c('0x31')](_0x2a8925,_0xdd4c('0x7e')),function(_0x3a13c5){return _[_0xdd4c('0x7f')](_0x4fd683,_0x3a13c5);});if(_0x31a337){return _0x56db3b['id'];}}}));}}return BPromise[_0xdd4c('0x80')](_0x2a8a5a)[_0xdd4c('0x27')](function(_0x310fab){_0x18b4e2=_(_0x18b4e2)[_0xdd4c('0x81')](_0x310fab)[_0xdd4c('0x82')]()[_0xdd4c('0x83')]();return db[_0xdd4c('0x32')][_0xdd4c('0x52')]({'where':{'id':_0x27a65d['params']['id']}})['then'](function(_0x1aedd0){return db[_0xdd4c('0x6d')][_0xdd4c('0x84')](function(_0x44eac1){return _0x1aedd0[_0xdd4c('0x71')](_0x27a65d[_0xdd4c('0x37')]['ids'],{'transaction':_0x44eac1})['then'](function(){if(!_['isEmpty'](_0x18b4e2)){return _0x1aedd0[_0xdd4c('0x85')](_0x18b4e2,{'transaction':_0x44eac1});}})['then'](function(){_0x18b4e2[_0xdd4c('0x86')](function(_0x5a61e2){socket[_0xdd4c('0x87')]('userWhatsappQueue:remove',{'UserId':_0x5a61e2,'WhatsappQueueId':_0x1aedd0['id']});});});});});});})[_0xdd4c('0x27')](respondWithStatusCode(_0x46015c,null))['catch'](handleError(_0x46015c,null));};exports[_0xdd4c('0x88')]=function(_0x4aac89,_0x13ba11,_0x1fc1c0){return db[_0xdd4c('0x32')][_0xdd4c('0x52')]({'where':{'id':_0x4aac89[_0xdd4c('0x4c')]['id']}})[_0xdd4c('0x27')](handleEntityNotFound(_0x13ba11,null))[_0xdd4c('0x27')](function(_0x514208){if(_0x514208){return _0x514208[_0xdd4c('0x88')](_0x4aac89[_0xdd4c('0x56')][_0xdd4c('0x68')],_[_0xdd4c('0x89')](_0x4aac89[_0xdd4c('0x56')],['ids','id'])||{})[_0xdd4c('0x8a')](function(_0x27de53){for(var _0x3c9c8f=0x0;_0x3c9c8f<_0x4aac89[_0xdd4c('0x56')][_0xdd4c('0x68')][_0xdd4c('0x3d')];_0x3c9c8f+=0x1){socket['emit'](_0xdd4c('0x70'),{'UserId':Number(_0x4aac89['body'][_0xdd4c('0x68')][_0x3c9c8f]),'WhatsappQueueId':Number(_0x4aac89[_0xdd4c('0x4c')]['id'])});}return _0x27de53;});}})[_0xdd4c('0x27')](respondWithResult(_0x13ba11,null))[_0xdd4c('0x4a')](handleError(_0x13ba11,null));};exports[_0xdd4c('0x85')]=function(_0x3141eb,_0x57811c,_0x82779b){return db['WhatsappQueue']['find']({'where':{'id':_0x3141eb[_0xdd4c('0x4c')]['id']}})[_0xdd4c('0x27')](handleEntityNotFound(_0x57811c,null))[_0xdd4c('0x27')](function(_0x2c1b31){if(_0x2c1b31){return _0x2c1b31['removeAgents'](_0x3141eb[_0xdd4c('0x37')][_0xdd4c('0x68')])[_0xdd4c('0x27')](function(){if(_[_0xdd4c('0x8b')](_0x3141eb[_0xdd4c('0x37')][_0xdd4c('0x68')])){for(var _0x6ef547=0x0;_0x6ef547<_0x3141eb[_0xdd4c('0x37')]['ids']['length'];_0x6ef547+=0x1){socket['emit'](_0xdd4c('0x8c'),{'UserId':Number(_0x3141eb[_0xdd4c('0x37')][_0xdd4c('0x68')][_0x6ef547]),'WhatsappQueueId':Number(_0x3141eb[_0xdd4c('0x4c')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x3141eb['query'][_0xdd4c('0x68')]),'WhatsappQueueId':Number(_0x3141eb[_0xdd4c('0x4c')]['id'])});}});}})[_0xdd4c('0x27')](respondWithStatusCode(_0x57811c,null))[_0xdd4c('0x4a')](handleError(_0x57811c,null));};exports[_0xdd4c('0x8d')]=function(_0x28e7dd,_0x496693,_0x19ad5e){var _0x322d05={};var _0xde5f6a={};var _0x4144f2;var _0x57a6dd;return db[_0xdd4c('0x32')][_0xdd4c('0x59')]({'where':{'id':_0x28e7dd[_0xdd4c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x496693,null))[_0xdd4c('0x27')](function(_0x4b3c62){if(_0x4b3c62){_0x4144f2=_0x4b3c62;_0xde5f6a[_0xdd4c('0x36')]=_[_0xdd4c('0x38')](db[_0xdd4c('0x5e')][_0xdd4c('0x4d')]);_0xde5f6a[_0xdd4c('0x37')]=_['keys'](_0x28e7dd[_0xdd4c('0x37')]);_0xde5f6a[_0xdd4c('0x39')]=_['intersection'](_0xde5f6a[_0xdd4c('0x36')],_0xde5f6a[_0xdd4c('0x37')]);_0x322d05[_0xdd4c('0x3a')]=_[_0xdd4c('0x3b')](_0xde5f6a[_0xdd4c('0x36')],qs['fields'](_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x3c')]));_0x322d05[_0xdd4c('0x3a')]=_0x322d05[_0xdd4c('0x3a')][_0xdd4c('0x3d')]?_0x322d05[_0xdd4c('0x3a')]:_0xde5f6a[_0xdd4c('0x36')];_0x322d05[_0xdd4c('0x5b')]=qs[_0xdd4c('0x40')](_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x40')]);_0x322d05[_0xdd4c('0x43')]=qs['filters'](_[_0xdd4c('0x41')](_0x28e7dd[_0xdd4c('0x37')],_0xde5f6a[_0xdd4c('0x39')]));if(_0x28e7dd['query'][_0xdd4c('0x42')]){_0x322d05['where']=_[_0xdd4c('0x44')](_0x322d05[_0xdd4c('0x43')],{'$or':_['map'](_0x322d05[_0xdd4c('0x3a')],function(_0x5c11f){var _0x2f458f={};_0x2f458f[_0x5c11f]={'$like':'%'+_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x42')]+'%'};return _0x2f458f;})});}_0x322d05=_[_0xdd4c('0x44')]({},_0x322d05,_0x28e7dd['options']);return _0x4144f2[_0xdd4c('0x8d')](_0x322d05);}})['then'](function(_0xa90f11){if(_0xa90f11){_0x57a6dd=_0xa90f11[_0xdd4c('0x3d')];if(!_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x3e')]('nolimit')){_0x322d05[_0xdd4c('0x21')]=qs[_0xdd4c('0x21')](_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x21')]);_0x322d05[_0xdd4c('0x1e')]=qs[_0xdd4c('0x1e')](_0x28e7dd[_0xdd4c('0x37')][_0xdd4c('0x1e')]);}return _0x4144f2['getAgents'](_0x322d05);}})['then'](function(_0x7720e2){if(_0x7720e2){return _0x7720e2?{'count':_0x57a6dd,'rows':_0x7720e2}:null;}})[_0xdd4c('0x27')](respondWithResult(_0x496693,null))[_0xdd4c('0x4a')](handleError(_0x496693,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b8a656e..48f4db3 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 _0xa4f7=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue'];(function(_0x109566,_0x4d5510){var _0x4f0c8f=function(_0x773978){while(--_0x773978){_0x109566['push'](_0x109566['shift']());}};_0x4f0c8f(++_0x4d5510);}(_0xa4f7,0xd6));var _0x7a4f=function(_0xa95478,_0xe8470e){_0xa95478=_0xa95478-0x0;var _0x33a045=_0xa4f7[_0xa95478];return _0x33a045;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7a4f('0x0'))['db'][_0x7a4f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a4f('0x2'),'afterUpdate':_0x7a4f('0x3'),'afterDestroy':_0x7a4f('0x4')};function emitEvent(_0x230fd3){return function(_0x20762d,_0x75ba39,_0xfc0aac){WhatsappQueueEvents[_0x7a4f('0x5')](_0x230fd3+':'+_0x20762d['id'],_0x20762d);WhatsappQueueEvents[_0x7a4f('0x5')](_0x230fd3,_0x20762d);_0xfc0aac(null);};}for(var e in events){if(events[_0x7a4f('0x6')](e)){var event=events[e];WhatsappQueue[_0x7a4f('0x7')](e,emitEvent(event));}}module[_0x7a4f('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf3f8=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x42f00b,_0x408fbd){var _0x1f46bb=function(_0x4fc4d5){while(--_0x4fc4d5){_0x42f00b['push'](_0x42f00b['shift']());}};_0x1f46bb(++_0x408fbd);}(_0xf3f8,0x98));var _0x8f3f=function(_0x3d3b37,_0xf38e25){_0x3d3b37=_0x3d3b37-0x0;var _0x2dd66a=_0xf3f8[_0x3d3b37];return _0x2dd66a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x8f3f('0x0'))['db'][_0x8f3f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8f3f('0x2')](0x0);var events={'afterCreate':_0x8f3f('0x3'),'afterUpdate':_0x8f3f('0x4'),'afterDestroy':_0x8f3f('0x5')};function emitEvent(_0x1da986){return function(_0x1eaee7,_0x34a524,_0x5b3876){WhatsappQueueEvents['emit'](_0x1da986+':'+_0x1eaee7['id'],_0x1eaee7);WhatsappQueueEvents['emit'](_0x1da986,_0x1eaee7);_0x5b3876(null);};}for(var e in events){if(events[_0x8f3f('0x6')](e)){var event=events[e];WhatsappQueue[_0x8f3f('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f4dea00..bfc398b 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 _0x1130=['WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes','define'];(function(_0x44cb12,_0x22381a){var _0x3f2610=function(_0x4c4d7e){while(--_0x4c4d7e){_0x44cb12['push'](_0x44cb12['shift']());}};_0x3f2610(++_0x22381a);}(_0x1130,0x115));var _0x0113=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x1130[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x0113('0x0'));var logger=require(_0x0113('0x1'))(_0x0113('0x2'));var moment=require(_0x0113('0x3'));var BPromise=require(_0x0113('0x4'));var rp=require(_0x0113('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0113('0x6'));var attributes=require(_0x0113('0x7'));module['exports']=function(_0x15b63d,_0x56ee1a){return _0x15b63d[_0x0113('0x8')](_0x0113('0x9'),attributes,{'tableName':_0x0113('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b6a=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger','api'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3b6a,0x170));var _0xa3b6=function(_0x4e37bc,_0x8174e7){_0x4e37bc=_0x4e37bc-0x0;var _0x48a8b7=_0x3b6a[_0x4e37bc];return _0x48a8b7;};'use strict';var _=require(_0xa3b6('0x0'));var util=require(_0xa3b6('0x1'));var logger=require(_0xa3b6('0x2'))(_0xa3b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa3b6('0x4'));var fs=require('fs');var path=require(_0xa3b6('0x5'));var rimraf=require(_0xa3b6('0x6'));var config=require(_0xa3b6('0x7'));var attributes=require(_0xa3b6('0x8'));module[_0xa3b6('0x9')]=function(_0x2ad71d,_0xa415a6){return _0x2ad71d[_0xa3b6('0xa')](_0xa3b6('0xb'),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 918579f..600d5d4 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 _0x400e=['rpc','client','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','model','include','map','ShowWhatsappQueue','find','stringify','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xaf5f7d,_0x75eeff){var _0x14ea40=function(_0x42ff49){while(--_0x42ff49){_0xaf5f7d['push'](_0xaf5f7d['shift']());}};_0x14ea40(++_0x75eeff);}(_0x400e,0x1f3));var _0xe400=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x400e[_0x65c0bb];return _0x320bd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe400('0x0'));var BPromise=require('bluebird');var rs=require(_0xe400('0x1'));var fs=require('fs');var Redis=require(_0xe400('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe400('0x3'));var logger=require(_0xe400('0x4'))(_0xe400('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe400('0x6')]['http']({'port':0x232a});config[_0xe400('0x7')]=_['defaults'](config['redis'],{'host':_0xe400('0x8'),'port':0x18eb});var socket=require(_0xe400('0x9'))(new Redis(config[_0xe400('0x7')]));require('./whatsappQueue.socket')[_0xe400('0xa')](socket);function respondWithRpcPromise(_0x549310,_0x4afc11,_0x259f10){return new BPromise(function(_0x129b15,_0x244f85){return client[_0xe400('0xb')](_0x549310,_0x259f10)[_0xe400('0xc')](function(_0x45645a){logger[_0xe400('0xd')](_0xe400('0xe'),_0x4afc11,_0xe400('0xf'));logger[_0xe400('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4afc11,_0xe400('0xf'),JSON['stringify'](_0x45645a));if(_0x45645a[_0xe400('0x11')]){if(_0x45645a['error'][_0xe400('0x12')]===0x1f4){logger[_0xe400('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4afc11,_0x45645a['error']['message']);return _0x244f85(_0x45645a[_0xe400('0x11')]['message']);}logger[_0xe400('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4afc11,_0x45645a[_0xe400('0x11')]['message']);return _0x129b15(_0x45645a[_0xe400('0x11')][_0xe400('0x13')]);}else{logger[_0xe400('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x4afc11,_0xe400('0xf'));_0x129b15(_0x45645a[_0xe400('0x14')]['message']);}})[_0xe400('0x15')](function(_0xcbc628){logger[_0xe400('0x11')](_0xe400('0xe'),_0x4afc11,_0xcbc628);_0x244f85(_0xcbc628);});});}exports[_0xe400('0x16')]=function(_0x2e2b0a){var _0x4fa178=this;return new Promise(function(_0x30a259,_0x4eb0ef){return db[_0xe400('0x17')][_0xe400('0x18')]({'raw':_0x2e2b0a[_0xe400('0x19')]?_0x2e2b0a[_0xe400('0x19')][_0xe400('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e2b0a[_0xe400('0x19')]?_0x2e2b0a[_0xe400('0x19')][_0xe400('0x1b')]||null:null,'attributes':_0x2e2b0a[_0xe400('0x19')]?_0x2e2b0a[_0xe400('0x19')][_0xe400('0x1c')]||null:null,'limit':_0x2e2b0a['options']?_0x2e2b0a[_0xe400('0x19')][_0xe400('0x1d')]||null:null,'include':_0x2e2b0a[_0xe400('0x19')]?_0x2e2b0a['options']['include']?_['map'](_0x2e2b0a[_0xe400('0x19')]['include'],function(_0x3c718d){return{'model':db[_0x3c718d[_0xe400('0x1e')]],'as':_0x3c718d['as'],'attributes':_0x3c718d['attributes'],'include':_0x3c718d[_0xe400('0x1f')]?_[_0xe400('0x20')](_0x3c718d[_0xe400('0x1f')],function(_0x2a7cde){return{'model':db[_0x2a7cde['model']],'as':_0x2a7cde['as'],'attributes':_0x2a7cde[_0xe400('0x1c')],'include':_0x2a7cde[_0xe400('0x1f')]?_[_0xe400('0x20')](_0x2a7cde[_0xe400('0x1f')],function(_0x2b1433){return{'model':db[_0x2b1433['model']],'as':_0x2b1433['as'],'attributes':_0x2b1433[_0xe400('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe400('0xc')](function(_0xfc8225){logger['info'](_0xe400('0x16'),_0x2e2b0a);logger[_0xe400('0x10')]('GetWhatsappQueue',_0x2e2b0a,JSON['stringify'](_0xfc8225));_0x30a259(_0xfc8225);})[_0xe400('0x15')](function(_0xbdf6f3){logger[_0xe400('0x11')](_0xe400('0x16'),_0xbdf6f3[_0xe400('0x13')],_0x2e2b0a);_0x4eb0ef(_0x4fa178[_0xe400('0x11')](0x1f4,_0xbdf6f3[_0xe400('0x13')]));});});};exports[_0xe400('0x21')]=function(_0x37d388){var _0x57fd2f=this;return new Promise(function(_0x74c5a9,_0x19bdba){return db['WhatsappQueue'][_0xe400('0x22')]({'raw':_0x37d388['options']?_0x37d388[_0xe400('0x19')][_0xe400('0x1a')]===undefined?!![]:![]:!![],'where':_0x37d388['options']?_0x37d388[_0xe400('0x19')][_0xe400('0x1b')]||null:null,'attributes':_0x37d388[_0xe400('0x19')]?_0x37d388[_0xe400('0x19')][_0xe400('0x1c')]||null:null,'include':_0x37d388['options']?_0x37d388[_0xe400('0x19')]['include']?_[_0xe400('0x20')](_0x37d388[_0xe400('0x19')][_0xe400('0x1f')],function(_0x31d990){return{'model':db[_0x31d990[_0xe400('0x1e')]],'as':_0x31d990['as'],'attributes':_0x31d990[_0xe400('0x1c')],'include':_0x31d990[_0xe400('0x1f')]?_[_0xe400('0x20')](_0x31d990['include'],function(_0x10a2f7){return{'model':db[_0x10a2f7[_0xe400('0x1e')]],'as':_0x10a2f7['as'],'attributes':_0x10a2f7['attributes'],'include':_0x10a2f7[_0xe400('0x1f')]?_[_0xe400('0x20')](_0x10a2f7[_0xe400('0x1f')],function(_0x547244){return{'model':db[_0x547244[_0xe400('0x1e')]],'as':_0x547244['as'],'attributes':_0x547244[_0xe400('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe400('0xc')](function(_0x4c3ec5){logger[_0xe400('0xd')](_0xe400('0x21'),_0x37d388);logger[_0xe400('0x10')](_0xe400('0x21'),_0x37d388,JSON[_0xe400('0x23')](_0x4c3ec5));_0x74c5a9(_0x4c3ec5);})['catch'](function(_0x18ab58){logger['error'](_0xe400('0x21'),_0x18ab58[_0xe400('0x13')],_0x37d388);_0x19bdba(_0x57fd2f[_0xe400('0x11')](0x1f4,_0x18ab58[_0xe400('0x13')]));});});}; \ No newline at end of file +var _0xad8e=['../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','catch','ShowWhatsappQueue','moment','bluebird','ioredis','../../mysqldb'];(function(_0x45e0a1,_0x13f2be){var _0xaa2b1c=function(_0x12c0d2){while(--_0x12c0d2){_0x45e0a1['push'](_0x45e0a1['shift']());}};_0xaa2b1c(++_0x13f2be);}(_0xad8e,0x11c));var _0xead8=function(_0x46d44d,_0x12dff9){_0x46d44d=_0x46d44d-0x0;var _0x34c937=_0xad8e[_0x46d44d];return _0x34c937;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xead8('0x0'));var BPromise=require(_0xead8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xead8('0x2'));var db=require(_0xead8('0x3'))['db'];var utils=require(_0xead8('0x4'));var logger=require('../../config/logger')(_0xead8('0x5'));var config=require(_0xead8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xead8('0x7')]['http']({'port':0x232a});config[_0xead8('0x8')]=_['defaults'](config[_0xead8('0x8')],{'host':_0xead8('0x9'),'port':0x18eb});var socket=require(_0xead8('0xa'))(new Redis(config[_0xead8('0x8')]));require(_0xead8('0xb'))['register'](socket);function respondWithRpcPromise(_0x3a0115,_0x578f72,_0x4d8923){return new BPromise(function(_0xa89bd7,_0x18af98){return client[_0xead8('0xc')](_0x3a0115,_0x4d8923)['then'](function(_0x16be4a){logger[_0xead8('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x578f72,_0xead8('0xe'));logger[_0xead8('0xf')](_0xead8('0x10'),_0x578f72,'request\x20sent',JSON['stringify'](_0x16be4a));if(_0x16be4a[_0xead8('0x11')]){if(_0x16be4a['error']['code']===0x1f4){logger[_0xead8('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x578f72,_0x16be4a[_0xead8('0x11')][_0xead8('0x12')]);return _0x18af98(_0x16be4a[_0xead8('0x11')][_0xead8('0x12')]);}logger[_0xead8('0x11')](_0xead8('0x13'),_0x578f72,_0x16be4a['error']['message']);return _0xa89bd7(_0x16be4a[_0xead8('0x11')][_0xead8('0x12')]);}else{logger[_0xead8('0xd')](_0xead8('0x13'),_0x578f72,_0xead8('0xe'));_0xa89bd7(_0x16be4a[_0xead8('0x14')][_0xead8('0x12')]);}})['catch'](function(_0x1522bb){logger['error'](_0xead8('0x13'),_0x578f72,_0x1522bb);_0x18af98(_0x1522bb);});});}exports[_0xead8('0x15')]=function(_0xe70b4d){var _0x53ebc3=this;return new Promise(function(_0x255ac5,_0xfd3c6d){return db[_0xead8('0x16')][_0xead8('0x17')]({'raw':_0xe70b4d[_0xead8('0x18')]?_0xe70b4d[_0xead8('0x18')][_0xead8('0x19')]===undefined?!![]:![]:!![],'where':_0xe70b4d[_0xead8('0x18')]?_0xe70b4d['options'][_0xead8('0x1a')]||null:null,'attributes':_0xe70b4d['options']?_0xe70b4d['options']['attributes']||null:null,'limit':_0xe70b4d[_0xead8('0x18')]?_0xe70b4d[_0xead8('0x18')][_0xead8('0x1b')]||null:null,'include':_0xe70b4d['options']?_0xe70b4d[_0xead8('0x18')][_0xead8('0x1c')]?_[_0xead8('0x1d')](_0xe70b4d[_0xead8('0x18')][_0xead8('0x1c')],function(_0x4f6d9c){return{'model':db[_0x4f6d9c[_0xead8('0x1e')]],'as':_0x4f6d9c['as'],'attributes':_0x4f6d9c[_0xead8('0x1f')],'include':_0x4f6d9c[_0xead8('0x1c')]?_[_0xead8('0x1d')](_0x4f6d9c[_0xead8('0x1c')],function(_0xec0126){return{'model':db[_0xec0126[_0xead8('0x1e')]],'as':_0xec0126['as'],'attributes':_0xec0126['attributes'],'include':_0xec0126['include']?_[_0xead8('0x1d')](_0xec0126['include'],function(_0x379962){return{'model':db[_0x379962['model']],'as':_0x379962['as'],'attributes':_0x379962[_0xead8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xead8('0x20')](function(_0x2f3368){logger[_0xead8('0xd')](_0xead8('0x15'),_0xe70b4d);logger[_0xead8('0xf')](_0xead8('0x15'),_0xe70b4d,JSON[_0xead8('0x21')](_0x2f3368));_0x255ac5(_0x2f3368);})[_0xead8('0x22')](function(_0x5523c5){logger[_0xead8('0x11')](_0xead8('0x15'),_0x5523c5[_0xead8('0x12')],_0xe70b4d);_0xfd3c6d(_0x53ebc3[_0xead8('0x11')](0x1f4,_0x5523c5['message']));});});};exports[_0xead8('0x23')]=function(_0x7f34cd){var _0x33ddc6=this;return new Promise(function(_0x4862cf,_0x3771df){return db[_0xead8('0x16')]['find']({'raw':_0x7f34cd[_0xead8('0x18')]?_0x7f34cd['options'][_0xead8('0x19')]===undefined?!![]:![]:!![],'where':_0x7f34cd[_0xead8('0x18')]?_0x7f34cd[_0xead8('0x18')][_0xead8('0x1a')]||null:null,'attributes':_0x7f34cd[_0xead8('0x18')]?_0x7f34cd[_0xead8('0x18')][_0xead8('0x1f')]||null:null,'include':_0x7f34cd['options']?_0x7f34cd[_0xead8('0x18')]['include']?_['map'](_0x7f34cd[_0xead8('0x18')][_0xead8('0x1c')],function(_0x2bfa43){return{'model':db[_0x2bfa43['model']],'as':_0x2bfa43['as'],'attributes':_0x2bfa43[_0xead8('0x1f')],'include':_0x2bfa43['include']?_[_0xead8('0x1d')](_0x2bfa43['include'],function(_0xd65378){return{'model':db[_0xd65378[_0xead8('0x1e')]],'as':_0xd65378['as'],'attributes':_0xd65378[_0xead8('0x1f')],'include':_0xd65378['include']?_[_0xead8('0x1d')](_0xd65378[_0xead8('0x1c')],function(_0x50a569){return{'model':db[_0x50a569[_0xead8('0x1e')]],'as':_0x50a569['as'],'attributes':_0x50a569[_0xead8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xead8('0x20')](function(_0x33e054){logger[_0xead8('0xd')](_0xead8('0x23'),_0x7f34cd);logger[_0xead8('0xf')]('ShowWhatsappQueue',_0x7f34cd,JSON[_0xead8('0x21')](_0x33e054));_0x4862cf(_0x33e054);})[_0xead8('0x22')](function(_0x39ddf3){logger[_0xead8('0x11')](_0xead8('0x23'),_0x39ddf3[_0xead8('0x12')],_0x7f34cd);_0x3771df(_0x33ddc6[_0xead8('0x11')](0x1f4,_0x39ddf3[_0xead8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e8b59f6..9187ec2 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 _0x942d=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3a144f,_0x598c90){var _0x5968eb=function(_0x59e182){while(--_0x59e182){_0x3a144f['push'](_0x3a144f['shift']());}};_0x5968eb(++_0x598c90);}(_0x942d,0x1b2));var _0xd942=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x942d[_0x36eaaa];return _0x461349;};'use strict';var WhatsappQueueEvents=require(_0xd942('0x0'));var events=[_0xd942('0x1'),_0xd942('0x2'),_0xd942('0x3')];function createListener(_0x35b658,_0x3c555a){return function(_0x51b10f){_0x3c555a[_0xd942('0x4')](_0x35b658,_0x51b10f);};}function removeListener(_0x38da00,_0x34709b){return function(){WhatsappQueueEvents[_0xd942('0x5')](_0x38da00,_0x34709b);};}exports[_0xd942('0x6')]=function(_0x596110){for(var _0x2c6863=0x0,_0x2eaa1b=events[_0xd942('0x7')];_0x2c6863<_0x2eaa1b;_0x2c6863++){var _0x154466=events[_0x2c6863];var _0x169c56=createListener(_0xd942('0x8')+_0x154466,_0x596110);WhatsappQueueEvents['on'](_0x154466,_0x169c56);}}; \ No newline at end of file +var _0xc528=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x2bb649,_0x48f399){var _0x33652c=function(_0x4b233c){while(--_0x4b233c){_0x2bb649['push'](_0x2bb649['shift']());}};_0x33652c(++_0x48f399);}(_0xc528,0x102));var _0x8c52=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc528[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappQueueEvents=require(_0x8c52('0x0'));var events=[_0x8c52('0x1'),_0x8c52('0x2'),_0x8c52('0x3')];function createListener(_0x3bb875,_0xd9aa95){return function(_0xc050ab){_0xd9aa95[_0x8c52('0x4')](_0x3bb875,_0xc050ab);};}function removeListener(_0x172992,_0xfda74c){return function(){WhatsappQueueEvents[_0x8c52('0x5')](_0x172992,_0xfda74c);};}exports[_0x8c52('0x6')]=function(_0x40bd79){for(var _0x1ccb77=0x0,_0x5637de=events[_0x8c52('0x7')];_0x1ccb77<_0x5637de;_0x1ccb77++){var _0x52bfc9=events[_0x1ccb77];var _0x26f3a7=createListener(_0x8c52('0x8')+_0x52bfc9,_0x40bd79);WhatsappQueueEvents['on'](_0x52bfc9,_0x26f3a7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c435387..ca792df 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 _0xd03f=['connect-timeout','express','../../components/interaction/service','./whatsappQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xd03f,0x1d8));var _0xfd03=function(_0x106895,_0xf6b6be){_0x106895=_0x106895-0x0;var _0x3ee675=_0xd03f[_0x106895];return _0x3ee675;};'use strict';var multer=require(_0xfd03('0x0'));var util=require(_0xfd03('0x1'));var path=require(_0xfd03('0x2'));var timeout=require(_0xfd03('0x3'));var express=require(_0xfd03('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd03('0x5'));var config=require('../../config/environment');var controller=require(_0xfd03('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd03('0x7')]);router[_0xfd03('0x8')](_0xfd03('0x9'),auth[_0xfd03('0xa')](),controller[_0xfd03('0xb')]);router['get'](_0xfd03('0xc'),auth[_0xfd03('0xa')](),controller[_0xfd03('0xd')]);router['post']('/',auth[_0xfd03('0xa')](),controller['create']);router[_0xfd03('0xe')](_0xfd03('0xc'),auth[_0xfd03('0xa')](),controller[_0xfd03('0xf')]);router[_0xfd03('0x10')]('/:id',auth[_0xfd03('0xa')](),controller[_0xfd03('0x11')]);module[_0xfd03('0x12')]=router; \ No newline at end of file +var _0x3c70=['delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update'];(function(_0x400a3b,_0x5a5189){var _0x53426b=function(_0x113d6d){while(--_0x113d6d){_0x400a3b['push'](_0x400a3b['shift']());}};_0x53426b(++_0x5a5189);}(_0x3c70,0x81));var _0x03c7=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3c70[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require(_0x03c7('0x0'));var path=require('path');var timeout=require(_0x03c7('0x1'));var express=require(_0x03c7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x03c7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x03c7('0x4'));var controller=require(_0x03c7('0x5'));router['get']('/',auth[_0x03c7('0x6')](),controller[_0x03c7('0x7')]);router[_0x03c7('0x8')](_0x03c7('0x9'),auth[_0x03c7('0x6')](),controller['describe']);router[_0x03c7('0x8')](_0x03c7('0xa'),auth[_0x03c7('0x6')](),controller[_0x03c7('0xb')]);router[_0x03c7('0xc')]('/',auth['isAuthenticated'](),controller[_0x03c7('0xd')]);router['put']('/:id',auth[_0x03c7('0x6')](),controller[_0x03c7('0xe')]);router[_0x03c7('0xf')](_0x03c7('0xa'),auth[_0x03c7('0x6')](),controller[_0x03c7('0x10')]);module[_0x03c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b6316eb..71e02f1 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x28d134,_0x2b8ff2){var _0x29de84=function(_0x5ab863){while(--_0x5ab863){_0x28d134['push'](_0x28d134['shift']());}};_0x29de84(++_0x2b8ff2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5528b4,_0x287637){var _0x44a8df=function(_0xefeb49){while(--_0xefeb49){_0x5528b4['push'](_0x5528b4['shift']());}};_0x44a8df(++_0x287637);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5114d52..6c78f94 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 _0x236c=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappQueueReport','fieldName','key','query','filters','intersection'];(function(_0x33c631,_0x397cfb){var _0x24203e=function(_0x324d92){while(--_0x324d92){_0x33c631['push'](_0x33c631['shift']());}};_0x24203e(++_0x397cfb);}(_0x236c,0x155));var _0xc236=function(_0x24ffbe,_0x2fe39a){_0x24ffbe=_0x24ffbe-0x0;var _0x398331=_0x236c[_0x24ffbe];return _0x398331;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x21fab8[_0xc236('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308cd6,_0x21d78f){return function(_0x356042){if(!_0x356042){_0x308cd6[_0xc236('0x26')](0x194);}return _0x356042;};}function handleError(_0x561da1,_0x42f248){_0x42f248=_0x42f248||0x1f4;return function(_0x5da4b2){logger['error'](_0x5da4b2[_0xc236('0x27')]);if(_0x5da4b2['name']){delete _0x5da4b2[_0xc236('0x28')];}_0x561da1['status'](_0x42f248)[_0xc236('0x29')](_0x5da4b2);};}exports['index']=function(_0x423842,_0x1d144b){var _0x4f5175={},_0x5a61b5={},_0x265c8d={'count':0x0,'rows':[]};var _0x1fd31d=_[_0xc236('0x2a')](db[_0xc236('0x2b')]['rawAttributes'],function(_0x4e3262){return{'name':_0x4e3262[_0xc236('0x2c')],'type':_0x4e3262['type'][_0xc236('0x2d')]};});_0x5a61b5['model']=_[_0xc236('0x2a')](_0x1fd31d,_0xc236('0x28'));_0x5a61b5['query']=_['keys'](_0x423842[_0xc236('0x2e')]);_0x5a61b5[_0xc236('0x2f')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],_0x5a61b5[_0xc236('0x2e')]);_0x4f5175[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x423842['query']['fields']));_0x4f5175['attributes']=_0x4f5175[_0xc236('0x32')][_0xc236('0x34')]?_0x4f5175[_0xc236('0x32')]:_0x5a61b5[_0xc236('0x31')];if(!_0x423842[_0xc236('0x2e')][_0xc236('0x35')](_0xc236('0x36'))){_0x4f5175['limit']=qs[_0xc236('0x37')](_0x423842[_0xc236('0x2e')][_0xc236('0x37')]);_0x4f5175['offset']=qs[_0xc236('0x1a')](_0x423842[_0xc236('0x2e')][_0xc236('0x1a')]);}_0x4f5175[_0xc236('0x38')]=qs['sort'](_0x423842[_0xc236('0x2e')][_0xc236('0x39')]);_0x4f5175[_0xc236('0x3a')]=qs[_0xc236('0x2f')](_[_0xc236('0x3b')](_0x423842[_0xc236('0x2e')],_0x5a61b5[_0xc236('0x2f')]),_0x1fd31d);if(_0x423842[_0xc236('0x2e')][_0xc236('0x3c')]){_0x4f5175[_0xc236('0x3a')]=_[_0xc236('0x3d')](_0x4f5175[_0xc236('0x3a')],{'$or':_[_0xc236('0x2a')](_0x1fd31d,function(_0x237193){if(_0x237193[_0xc236('0x3e')]!==_0xc236('0x3f')){var _0x46db5a={};_0x46db5a[_0x237193['name']]={'$like':'%'+_0x423842['query']['filter']+'%'};return _0x46db5a;}})});}_0x4f5175=_['merge']({},_0x4f5175,_0x423842[_0xc236('0x40')]);var _0x5c4739={'where':_0x4f5175[_0xc236('0x3a')]};return db[_0xc236('0x2b')][_0xc236('0x1c')](_0x5c4739)[_0xc236('0x24')](function(_0xdf7897){_0x265c8d[_0xc236('0x1c')]=_0xdf7897;if(_0x423842[_0xc236('0x2e')][_0xc236('0x41')]){_0x4f5175[_0xc236('0x42')]=[{'all':!![]}];}return db[_0xc236('0x2b')][_0xc236('0x43')](_0x4f5175);})[_0xc236('0x24')](function(_0x3b2f2f){_0x265c8d[_0xc236('0x44')]=_0x3b2f2f;return _0x265c8d;})[_0xc236('0x24')](respondWithFilteredResult(_0x1d144b,_0x4f5175))['catch'](handleError(_0x1d144b,null));};exports[_0xc236('0x45')]=function(_0x24b851,_0x506ba0){var _0xb90a83={'raw':!![],'where':{'id':_0x24b851[_0xc236('0x46')]['id']}},_0x5b0bc5={};_0x5b0bc5['model']=_[_0xc236('0x47')](db[_0xc236('0x2b')][_0xc236('0x48')]);_0x5b0bc5['query']=_[_0xc236('0x47')](_0x24b851[_0xc236('0x2e')]);_0x5b0bc5[_0xc236('0x2f')]=_['intersection'](_0x5b0bc5[_0xc236('0x31')],_0x5b0bc5[_0xc236('0x2e')]);_0xb90a83[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5b0bc5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x24b851['query'][_0xc236('0x33')]));_0xb90a83['attributes']=_0xb90a83[_0xc236('0x32')][_0xc236('0x34')]?_0xb90a83[_0xc236('0x32')]:_0x5b0bc5[_0xc236('0x31')];if(_0x24b851[_0xc236('0x2e')][_0xc236('0x41')]){_0xb90a83[_0xc236('0x42')]=[{'all':!![]}];}_0xb90a83=_['merge']({},_0xb90a83,_0x24b851[_0xc236('0x40')]);return db['WhatsappQueueReport'][_0xc236('0x49')](_0xb90a83)[_0xc236('0x24')](handleEntityNotFound(_0x506ba0,null))['then'](respondWithResult(_0x506ba0,null))[_0xc236('0x4a')](handleError(_0x506ba0,null));};exports[_0xc236('0x4b')]=function(_0x3c1c5c,_0x161890){return db[_0xc236('0x2b')][_0xc236('0x4b')](_0x3c1c5c[_0xc236('0x4c')],{})['then'](respondWithResult(_0x161890,0xc9))['catch'](handleError(_0x161890,null));};exports[_0xc236('0x23')]=function(_0x2afed2,_0x510f7f){if(_0x2afed2[_0xc236('0x4c')]['id']){delete _0x2afed2[_0xc236('0x4c')]['id'];}return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x2afed2[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x510f7f,null))[_0xc236('0x24')](saveUpdates(_0x2afed2[_0xc236('0x4c')],null))[_0xc236('0x24')](respondWithResult(_0x510f7f,null))['catch'](handleError(_0x510f7f,null));};exports[_0xc236('0x25')]=function(_0x307663,_0x41b7d5){return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x307663[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x41b7d5,null))['then'](removeEntity(_0x41b7d5,null))[_0xc236('0x4a')](handleError(_0x41b7d5,null));};exports[_0xc236('0x4d')]=function(_0x17c86b,_0x16ff63){return db['WhatsappQueueReport'][_0xc236('0x4d')]()[_0xc236('0x24')](respondWithResult(_0x16ff63,null))[_0xc236('0x4a')](handleError(_0x16ff63,null));}; \ No newline at end of file +var _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x16fdeb,_0x46d28e){var _0x1ea06f=function(_0x5b86d8){while(--_0x5b86d8){_0x16fdeb['push'](_0x16fdeb['shift']());}};_0x1ea06f(++_0x46d28e);}(_0x0565,0xf2));var _0x5056=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x0565[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1d1e20d..08e3528 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 _0xcbf4=['../../config/logger','moment','bluebird','request-promise','path','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x2934ec,_0x19399b){var _0x2b193c=function(_0x12f817){while(--_0x12f817){_0x2934ec['push'](_0x2934ec['shift']());}};_0x2b193c(++_0x19399b);}(_0xcbf4,0xd6));var _0x4cbf=function(_0x3450ef,_0x2d0ad9){_0x3450ef=_0x3450ef-0x0;var _0xe0a63c=_0xcbf4[_0x3450ef];return _0xe0a63c;};'use strict';var _=require(_0x4cbf('0x0'));var util=require(_0x4cbf('0x1'));var logger=require(_0x4cbf('0x2'))('api');var moment=require(_0x4cbf('0x3'));var BPromise=require(_0x4cbf('0x4'));var rp=require(_0x4cbf('0x5'));var fs=require('fs');var path=require(_0x4cbf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cbf('0x7'));module['exports']=function(_0x1754f6,_0x588c23){return _0x1754f6[_0x4cbf('0x8')](_0x4cbf('0x9'),attributes,{'tableName':_0x4cbf('0xa'),'paranoid':![],'indexes':[{'name':_0x4cbf('0xb'),'fields':[_0x4cbf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb00=['lodash','util','../../config/logger','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0xb5319f,_0x5352ff){var _0x186f43=function(_0x26170b){while(--_0x26170b){_0xb5319f['push'](_0xb5319f['shift']());}};_0x186f43(++_0x5352ff);}(_0xcb00,0x186));var _0x0cb0=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xcb00[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x0cb0('0x0'));var util=require(_0x0cb0('0x1'));var logger=require(_0x0cb0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cb0('0x3'));var rimraf=require('rimraf');var config=require(_0x0cb0('0x4'));var attributes=require(_0x0cb0('0x5'));module[_0x0cb0('0x6')]=function(_0x515bc1,_0x4ed5ee){return _0x515bc1[_0x0cb0('0x7')](_0x0cb0('0x8'),attributes,{'tableName':_0x0cb0('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 82823f4..905ecf2 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 _0x42dc=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0x42dc,0x115));var _0xc42d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x42dc[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xc42d('0x0'));var util=require(_0xc42d('0x1'));var moment=require(_0xc42d('0x2'));var BPromise=require(_0xc42d('0x3'));var rs=require(_0xc42d('0x4'));var fs=require('fs');var Redis=require(_0xc42d('0x5'));var db=require(_0xc42d('0x6'))['db'];var utils=require(_0xc42d('0x7'));var logger=require(_0xc42d('0x8'))(_0xc42d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc42d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31dad7,_0x11c0b9,_0x4b9441){return new BPromise(function(_0x7ba4dc,_0x44170d){return client['request'](_0x31dad7,_0x4b9441)['then'](function(_0x381f2b){logger[_0xc42d('0xb')](_0xc42d('0xc'),_0x11c0b9,_0xc42d('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x11c0b9,'request\x20sent',JSON[_0xc42d('0xe')](_0x381f2b));if(_0x381f2b[_0xc42d('0xf')]){if(_0x381f2b[_0xc42d('0xf')][_0xc42d('0x10')]===0x1f4){logger[_0xc42d('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x11c0b9,_0x381f2b[_0xc42d('0xf')][_0xc42d('0x11')]);return _0x44170d(_0x381f2b['error'][_0xc42d('0x11')]);}logger[_0xc42d('0xf')](_0xc42d('0xc'),_0x11c0b9,_0x381f2b['error']['message']);return _0x7ba4dc(_0x381f2b[_0xc42d('0xf')]['message']);}else{logger[_0xc42d('0xb')](_0xc42d('0xc'),_0x11c0b9,'request\x20sent');_0x7ba4dc(_0x381f2b[_0xc42d('0x12')][_0xc42d('0x11')]);}})[_0xc42d('0x13')](function(_0x168a75){logger['error'](_0xc42d('0xc'),_0x11c0b9,_0x168a75);_0x44170d(_0x168a75);});});}exports[_0xc42d('0x14')]=function(_0x1b24c5){var _0x556c42=this;return new Promise(function(_0xf885b8,_0x164a71){return db[_0xc42d('0x15')][_0xc42d('0x16')](_0x1b24c5[_0xc42d('0x17')],{'raw':_0x1b24c5[_0xc42d('0x18')]?_0x1b24c5[_0xc42d('0x18')][_0xc42d('0x19')]===undefined?!![]:![]:!![]})[_0xc42d('0x1a')](function(_0x225079){logger[_0xc42d('0xb')](_0xc42d('0x14'),_0x1b24c5);logger['debug'](_0xc42d('0x14'),_0x1b24c5,JSON[_0xc42d('0xe')](_0x225079));_0xf885b8(_0x225079);})['catch'](function(_0x570479){logger[_0xc42d('0xf')](_0xc42d('0x14'),_0x570479['message'],_0x1b24c5);_0x164a71(_0x556c42[_0xc42d('0xf')](0x1f4,_0x570479['message']));});});};exports[_0xc42d('0x1b')]=function(_0x1570ea){var _0xce420a=this;return new Promise(function(_0x34128f,_0x386180){return db[_0xc42d('0x15')][_0xc42d('0x1c')](_0x1570ea[_0xc42d('0x17')],{'raw':_0x1570ea[_0xc42d('0x18')]?_0x1570ea['options'][_0xc42d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1570ea[_0xc42d('0x18')]?_0x1570ea[_0xc42d('0x18')][_0xc42d('0x1d')]||null:null,'attributes':_0x1570ea['options']?_0x1570ea['options'][_0xc42d('0x1e')]||null:null,'limit':_0x1570ea[_0xc42d('0x18')]?_0x1570ea[_0xc42d('0x18')][_0xc42d('0x1f')]||null:null})[_0xc42d('0x1a')](function(_0x53c84f){logger[_0xc42d('0xb')](_0xc42d('0x1b'),_0x1570ea);logger['debug'](_0xc42d('0x1b'),_0x1570ea,JSON[_0xc42d('0xe')](_0x53c84f));_0x34128f(_0x53c84f);})[_0xc42d('0x13')](function(_0x35d4){logger[_0xc42d('0xf')](_0xc42d('0x1b'),_0x35d4[_0xc42d('0x11')],_0x1570ea);_0x386180(_0xce420a[_0xc42d('0xf')](0x1f4,_0x35d4['message']));});});}; \ No newline at end of file +var _0x52da=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','create','options','raw','WhatsappQueueReport','update','body','where','attributes','UpdateWhatsappQueueReport'];(function(_0x542085,_0x7d4c53){var _0xb4c5db=function(_0x34d806){while(--_0x34d806){_0x542085['push'](_0x542085['shift']());}};_0xb4c5db(++_0x7d4c53);}(_0x52da,0x129));var _0xa52d=function(_0x304f80,_0x2f7b5b){_0x304f80=_0x304f80-0x0;var _0x4c0f2d=_0x52da[_0x304f80];return _0x4c0f2d;};'use strict';var _=require(_0xa52d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa52d('0x1'));var rs=require(_0xa52d('0x2'));var fs=require('fs');var Redis=require(_0xa52d('0x3'));var db=require(_0xa52d('0x4'))['db'];var utils=require(_0xa52d('0x5'));var logger=require(_0xa52d('0x6'))(_0xa52d('0x7'));var config=require(_0xa52d('0x8'));var jayson=require(_0xa52d('0x9'));var client=jayson[_0xa52d('0xa')][_0xa52d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd9df1f,_0x25ce9f,_0x47f615){return new BPromise(function(_0x22a54f,_0x2a8318){return client[_0xa52d('0xc')](_0xd9df1f,_0x47f615)[_0xa52d('0xd')](function(_0x441682){logger[_0xa52d('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25ce9f,_0xa52d('0xf'));logger[_0xa52d('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x25ce9f,_0xa52d('0xf'),JSON[_0xa52d('0x11')](_0x441682));if(_0x441682[_0xa52d('0x12')]){if(_0x441682[_0xa52d('0x12')][_0xa52d('0x13')]===0x1f4){logger[_0xa52d('0x12')](_0xa52d('0x14'),_0x25ce9f,_0x441682[_0xa52d('0x12')][_0xa52d('0x15')]);return _0x2a8318(_0x441682[_0xa52d('0x12')][_0xa52d('0x15')]);}logger[_0xa52d('0x12')](_0xa52d('0x14'),_0x25ce9f,_0x441682['error'][_0xa52d('0x15')]);return _0x22a54f(_0x441682['error'][_0xa52d('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x25ce9f,_0xa52d('0xf'));_0x22a54f(_0x441682['result']['message']);}})[_0xa52d('0x16')](function(_0x45c94f){logger[_0xa52d('0x12')](_0xa52d('0x14'),_0x25ce9f,_0x45c94f);_0x2a8318(_0x45c94f);});});}exports[_0xa52d('0x17')]=function(_0x300af1){var _0x478854=this;return new Promise(function(_0x6e15ee,_0x31b39e){return db['WhatsappQueueReport'][_0xa52d('0x18')](_0x300af1['body'],{'raw':_0x300af1[_0xa52d('0x19')]?_0x300af1[_0xa52d('0x19')][_0xa52d('0x1a')]===undefined?!![]:![]:!![]})[_0xa52d('0xd')](function(_0x3b40ab){logger[_0xa52d('0xe')](_0xa52d('0x17'),_0x300af1);logger['debug']('CreateWhatsappQueueReport',_0x300af1,JSON[_0xa52d('0x11')](_0x3b40ab));_0x6e15ee(_0x3b40ab);})[_0xa52d('0x16')](function(_0x5bf274){logger[_0xa52d('0x12')](_0xa52d('0x17'),_0x5bf274[_0xa52d('0x15')],_0x300af1);_0x31b39e(_0x478854['error'](0x1f4,_0x5bf274[_0xa52d('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x47203c){var _0x303064=this;return new Promise(function(_0x3aa080,_0x6db877){return db[_0xa52d('0x1b')][_0xa52d('0x1c')](_0x47203c[_0xa52d('0x1d')],{'raw':_0x47203c['options']?_0x47203c[_0xa52d('0x19')][_0xa52d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47203c[_0xa52d('0x19')]?_0x47203c['options'][_0xa52d('0x1e')]||null:null,'attributes':_0x47203c[_0xa52d('0x19')]?_0x47203c['options'][_0xa52d('0x1f')]||null:null,'limit':_0x47203c[_0xa52d('0x19')]?_0x47203c[_0xa52d('0x19')]['limit']||null:null})['then'](function(_0x26d4fd){logger[_0xa52d('0xe')](_0xa52d('0x20'),_0x47203c);logger[_0xa52d('0x10')](_0xa52d('0x20'),_0x47203c,JSON[_0xa52d('0x11')](_0x26d4fd));_0x3aa080(_0x26d4fd);})['catch'](function(_0x300d18){logger[_0xa52d('0x12')](_0xa52d('0x20'),_0x300d18[_0xa52d('0x15')],_0x47203c);_0x6db877(_0x303064['error'](0x1f4,_0x300d18[_0xa52d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 12babe3..4bf5fc9 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 _0xa8f7=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xa8f7,0x177));var _0x7a8f=function(_0x204e93,_0x2ae432){_0x204e93=_0x204e93-0x0;var _0x15f3a3=_0xa8f7[_0x204e93];return _0x15f3a3;};'use strict';var multer=require('multer');var util=require(_0x7a8f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a8f('0x1'));var router=express[_0x7a8f('0x2')]();var fs_extra=require(_0x7a8f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7a8f('0x4'));var config=require(_0x7a8f('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0x7a8f('0x6')]('/',auth[_0x7a8f('0x7')](),controller[_0x7a8f('0x8')]);router[_0x7a8f('0x6')](_0x7a8f('0x9'),auth[_0x7a8f('0x7')](),controller[_0x7a8f('0xa')]);router[_0x7a8f('0x6')](_0x7a8f('0xb'),auth[_0x7a8f('0x7')](),controller[_0x7a8f('0xc')]);router[_0x7a8f('0xd')]('/',auth[_0x7a8f('0x7')](),controller[_0x7a8f('0xe')]);router[_0x7a8f('0xf')](_0x7a8f('0xb'),auth['isAuthenticated'](),controller[_0x7a8f('0x10')]);router['delete'](_0x7a8f('0xb'),auth['isAuthenticated'](),controller[_0x7a8f('0x11')]);module[_0x7a8f('0x12')]=router; \ No newline at end of file +var _0x1bb7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xbd8fcf,_0x5a33c7){var _0x3ae50e=function(_0x45c32e){while(--_0x45c32e){_0xbd8fcf['push'](_0xbd8fcf['shift']());}};_0x3ae50e(++_0x5a33c7);}(_0x1bb7,0xf9));var _0x71bb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1bb7[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x71bb('0x0'));var util=require(_0x71bb('0x1'));var path=require(_0x71bb('0x2'));var timeout=require(_0x71bb('0x3'));var express=require(_0x71bb('0x4'));var router=express[_0x71bb('0x5')]();var fs_extra=require(_0x71bb('0x6'));var auth=require(_0x71bb('0x7'));var interaction=require(_0x71bb('0x8'));var config=require(_0x71bb('0x9'));var controller=require(_0x71bb('0xa'));router[_0x71bb('0xb')]('/',auth[_0x71bb('0xc')](),controller[_0x71bb('0xd')]);router['get'](_0x71bb('0xe'),auth[_0x71bb('0xc')](),controller[_0x71bb('0xf')]);router[_0x71bb('0xb')](_0x71bb('0x10'),auth[_0x71bb('0xc')](),controller['show']);router[_0x71bb('0x11')]('/',auth[_0x71bb('0xc')](),controller[_0x71bb('0x12')]);router[_0x71bb('0x13')]('/:id',auth[_0x71bb('0xc')](),controller['update']);router[_0x71bb('0x14')](_0x71bb('0x10'),auth[_0x71bb('0xc')](),controller[_0x71bb('0x15')]);module[_0x71bb('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d70a930..6383999 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 _0xb4e2=['sequelize','ENUM','DATE'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x522fd0,_0x5f55da){_0x522fd0=_0x522fd0-0x0;var _0x531c14=_0xb4e2[_0x522fd0];return _0x531c14;};'use strict';var Sequelize=require(_0x2b4e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2b4e('0x1')]('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2b4e('0x2')]}}; \ No newline at end of file +var _0xd142=['sequelize','exports','STRING','ENUM','queue','DATE'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0xd142,0x11a));var _0x2d14=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xd142[_0x119629];return _0x49a771;};'use strict';var Sequelize=require(_0x2d14('0x0'));module[_0x2d14('0x1')]={'uniqueid':{'type':Sequelize[_0x2d14('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2d14('0x3')]('account','agent',_0x2d14('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2d14('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3617f48..c56427d 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 _0x4639=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4639,0x115));var _0x9463=function(_0xc864d,_0x3443f2){_0xc864d=_0xc864d-0x0;var _0x4a1305=_0x4639[_0xc864d];return _0x4a1305;};'use strict';var emlformat=require(_0x9463('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9463('0x1'));var rp=require(_0x9463('0x2'));var moment=require(_0x9463('0x3'));var BPromise=require(_0x9463('0x4'));var Mustache=require(_0x9463('0x5'));var util=require(_0x9463('0x6'));var path=require(_0x9463('0x7'));var sox=require('sox');var csv=require(_0x9463('0x8'));var ejs=require(_0x9463('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9463('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9463('0xb'));var toCsv=require(_0x9463('0x8'));var querystring=require(_0x9463('0xc'));var Papa=require('papaparse');var Redis=require(_0x9463('0xd'));var authService=require(_0x9463('0xe'));var qs=require(_0x9463('0xf'));var as=require(_0x9463('0x10'));var hardwareService=require(_0x9463('0x11'));var logger=require(_0x9463('0x12'))(_0x9463('0x13'));var utils=require(_0x9463('0x14'));var config=require(_0x9463('0x15'));var licenseUtil=require(_0x9463('0x16'));var db=require(_0x9463('0x17'))['db'];function respondWithStatusCode(_0x3b9c65,_0x180cfd){_0x180cfd=_0x180cfd||0xcc;return function(_0x3bb684){if(_0x3bb684){return _0x3b9c65[_0x9463('0x18')](_0x180cfd);}return _0x3b9c65[_0x9463('0x19')](_0x180cfd)[_0x9463('0x1a')]();};}function respondWithResult(_0x24b1ec,_0x14a5e5){_0x14a5e5=_0x14a5e5||0xc8;return function(_0x4a0cd4){if(_0x4a0cd4){return _0x24b1ec[_0x9463('0x19')](_0x14a5e5)['json'](_0x4a0cd4);}};}function respondWithFilteredResult(_0x19259c,_0x281237){return function(_0x1915e5){if(_0x1915e5){var _0x2054a3=typeof _0x281237[_0x9463('0x1b')]==='undefined'&&typeof _0x281237[_0x9463('0x1c')]===_0x9463('0x1d');var _0x98f2bc=_0x1915e5['count'];var _0x549167=_0x2054a3?0x0:_0x281237[_0x9463('0x1b')];var _0x422064=_0x2054a3?_0x1915e5[_0x9463('0x1e')]:_0x281237[_0x9463('0x1b')]+_0x281237[_0x9463('0x1c')];var _0x3a6ac2;if(_0x422064>=_0x98f2bc){_0x422064=_0x98f2bc;_0x3a6ac2=0xc8;}else{_0x3a6ac2=0xce;}_0x19259c[_0x9463('0x19')](_0x3a6ac2);return _0x19259c[_0x9463('0x1f')](_0x9463('0x20'),_0x549167+'-'+_0x422064+'/'+_0x98f2bc)[_0x9463('0x21')](_0x1915e5);}return null;};}function patchUpdates(_0x3d26e4){return function(_0x58d79c){try{jsonpatch[_0x9463('0x22')](_0x58d79c,_0x3d26e4,!![]);}catch(_0x15e1fd){return BPromise[_0x9463('0x23')](_0x15e1fd);}return _0x58d79c[_0x9463('0x24')]();};}function saveUpdates(_0x545c48,_0x24f85a){return function(_0x44e03d){if(_0x44e03d){return _0x44e03d[_0x9463('0x25')](_0x545c48)[_0x9463('0x26')](function(_0x6f0db1){return _0x6f0db1;});}return null;};}function removeEntity(_0x2d7cec,_0x214f7e){return function(_0x3c2a5b){if(_0x3c2a5b){return _0x3c2a5b[_0x9463('0x27')]()[_0x9463('0x26')](function(){_0x2d7cec[_0x9463('0x19')](0xcc)[_0x9463('0x1a')]();});}};}function handleEntityNotFound(_0x447b1a,_0xff7501){return function(_0x62286d){if(!_0x62286d){_0x447b1a[_0x9463('0x18')](0x194);}return _0x62286d;};}function handleError(_0x41716a,_0x12e967){_0x12e967=_0x12e967||0x1f4;return function(_0x505207){logger[_0x9463('0x28')](_0x505207[_0x9463('0x29')]);if(_0x505207[_0x9463('0x2a')]){delete _0x505207[_0x9463('0x2a')];}_0x41716a[_0x9463('0x19')](_0x12e967)['send'](_0x505207);};}exports[_0x9463('0x2b')]=function(_0x508128,_0x22d768){var _0x18723a={},_0x1777f7={},_0xb39a03={'count':0x0,'rows':[]};var _0x196c0b=_[_0x9463('0x2c')](db[_0x9463('0x2d')]['rawAttributes'],function(_0x4effe2){return{'name':_0x4effe2[_0x9463('0x2e')],'type':_0x4effe2[_0x9463('0x2f')][_0x9463('0x30')]};});_0x1777f7['model']=_[_0x9463('0x2c')](_0x196c0b,_0x9463('0x2a'));_0x1777f7[_0x9463('0x31')]=_[_0x9463('0x32')](_0x508128[_0x9463('0x31')]);_0x1777f7[_0x9463('0x33')]=_[_0x9463('0x34')](_0x1777f7[_0x9463('0x35')],_0x1777f7[_0x9463('0x31')]);_0x18723a[_0x9463('0x36')]=_[_0x9463('0x34')](_0x1777f7[_0x9463('0x35')],qs[_0x9463('0x37')](_0x508128[_0x9463('0x31')][_0x9463('0x37')]));_0x18723a[_0x9463('0x36')]=_0x18723a[_0x9463('0x36')][_0x9463('0x38')]?_0x18723a[_0x9463('0x36')]:_0x1777f7[_0x9463('0x35')];if(!_0x508128[_0x9463('0x31')]['hasOwnProperty']('nolimit')){_0x18723a['limit']=qs[_0x9463('0x1c')](_0x508128[_0x9463('0x31')][_0x9463('0x1c')]);_0x18723a[_0x9463('0x1b')]=qs[_0x9463('0x1b')](_0x508128[_0x9463('0x31')][_0x9463('0x1b')]);}_0x18723a[_0x9463('0x39')]=qs[_0x9463('0x3a')](_0x508128[_0x9463('0x31')][_0x9463('0x3a')]);_0x18723a[_0x9463('0x3b')]=qs[_0x9463('0x33')](_['pick'](_0x508128[_0x9463('0x31')],_0x1777f7['filters']),_0x196c0b);if(_0x508128[_0x9463('0x31')]['filter']){_0x18723a[_0x9463('0x3b')]=_[_0x9463('0x3c')](_0x18723a[_0x9463('0x3b')],{'$or':_[_0x9463('0x2c')](_0x196c0b,function(_0x29a3d7){if(_0x29a3d7[_0x9463('0x2f')]!=='VIRTUAL'){var _0xec3803={};_0xec3803[_0x29a3d7[_0x9463('0x2a')]]={'$like':'%'+_0x508128[_0x9463('0x31')][_0x9463('0x3d')]+'%'};return _0xec3803;}})});}_0x18723a=_[_0x9463('0x3c')]({},_0x18723a,_0x508128[_0x9463('0x3e')]);var _0x3698f8={'where':_0x18723a[_0x9463('0x3b')]};return db[_0x9463('0x2d')][_0x9463('0x1e')](_0x3698f8)[_0x9463('0x26')](function(_0x36c792){_0xb39a03[_0x9463('0x1e')]=_0x36c792;if(_0x508128[_0x9463('0x31')][_0x9463('0x3f')]){_0x18723a[_0x9463('0x40')]=[{'all':!![]}];}return db[_0x9463('0x2d')][_0x9463('0x41')](_0x18723a);})['then'](function(_0x4c391b){_0xb39a03[_0x9463('0x42')]=_0x4c391b;return _0xb39a03;})[_0x9463('0x26')](respondWithFilteredResult(_0x22d768,_0x18723a))[_0x9463('0x43')](handleError(_0x22d768,null));};exports[_0x9463('0x44')]=function(_0x557db7,_0x10a307){var _0x529283={'raw':!![],'where':{'id':_0x557db7['params']['id']}},_0x196621={};_0x196621[_0x9463('0x35')]=_[_0x9463('0x32')](db['WhatsappTransferReport'][_0x9463('0x45')]);_0x196621[_0x9463('0x31')]=_['keys'](_0x557db7[_0x9463('0x31')]);_0x196621[_0x9463('0x33')]=_[_0x9463('0x34')](_0x196621[_0x9463('0x35')],_0x196621[_0x9463('0x31')]);_0x529283[_0x9463('0x36')]=_[_0x9463('0x34')](_0x196621[_0x9463('0x35')],qs[_0x9463('0x37')](_0x557db7[_0x9463('0x31')][_0x9463('0x37')]));_0x529283[_0x9463('0x36')]=_0x529283[_0x9463('0x36')]['length']?_0x529283[_0x9463('0x36')]:_0x196621['model'];if(_0x557db7[_0x9463('0x31')][_0x9463('0x3f')]){_0x529283['include']=[{'all':!![]}];}_0x529283=_['merge']({},_0x529283,_0x557db7['options']);return db[_0x9463('0x2d')]['find'](_0x529283)['then'](handleEntityNotFound(_0x10a307,null))[_0x9463('0x26')](respondWithResult(_0x10a307,null))[_0x9463('0x43')](handleError(_0x10a307,null));};exports[_0x9463('0x46')]=function(_0x1fa268,_0x491eb7){return db['WhatsappTransferReport'][_0x9463('0x46')](_0x1fa268[_0x9463('0x47')],{})[_0x9463('0x26')](respondWithResult(_0x491eb7,0xc9))[_0x9463('0x43')](handleError(_0x491eb7,null));};exports[_0x9463('0x25')]=function(_0x2b6277,_0xf6a53e){if(_0x2b6277[_0x9463('0x47')]['id']){delete _0x2b6277[_0x9463('0x47')]['id'];}return db[_0x9463('0x2d')]['find']({'where':{'id':_0x2b6277[_0x9463('0x48')]['id']}})[_0x9463('0x26')](handleEntityNotFound(_0xf6a53e,null))['then'](saveUpdates(_0x2b6277[_0x9463('0x47')],null))[_0x9463('0x26')](respondWithResult(_0xf6a53e,null))[_0x9463('0x43')](handleError(_0xf6a53e,null));};exports['destroy']=function(_0x11becf,_0xaf1dca){return db[_0x9463('0x2d')]['find']({'where':{'id':_0x11becf[_0x9463('0x48')]['id']}})[_0x9463('0x26')](handleEntityNotFound(_0xaf1dca,null))[_0x9463('0x26')](removeEntity(_0xaf1dca,null))[_0x9463('0x43')](handleError(_0xaf1dca,null));};exports['describe']=function(_0x3e7ef9,_0x1f84f3){return db[_0x9463('0x2d')][_0x9463('0x49')]()[_0x9463('0x26')](respondWithResult(_0x1f84f3,null))['catch'](handleError(_0x1f84f3,null));}; \ No newline at end of file +var _0x8fbe=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','save','then','destroy','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','catch','update','describe','eml-format','rimraf'];(function(_0x57f114,_0x5378a1){var _0x3cbc26=function(_0x3bfd40){while(--_0x3bfd40){_0x57f114['push'](_0x57f114['shift']());}};_0x3cbc26(++_0x5378a1);}(_0x8fbe,0x1c6));var _0xe8fb=function(_0x11fb02,_0x3cd369){_0x11fb02=_0x11fb02-0x0;var _0x47db94=_0x8fbe[_0x11fb02];return _0x47db94;};'use strict';var emlformat=require(_0xe8fb('0x0'));var rimraf=require(_0xe8fb('0x1'));var zipdir=require(_0xe8fb('0x2'));var jsonpatch=require(_0xe8fb('0x3'));var rp=require(_0xe8fb('0x4'));var moment=require(_0xe8fb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8fb('0x6'));var path=require(_0xe8fb('0x7'));var sox=require(_0xe8fb('0x8'));var csv=require(_0xe8fb('0x9'));var ejs=require(_0xe8fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe8fb('0xb'));var _=require(_0xe8fb('0xc'));var squel=require(_0xe8fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe8fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe8fb('0x9'));var querystring=require(_0xe8fb('0xf'));var Papa=require(_0xe8fb('0x10'));var Redis=require(_0xe8fb('0x11'));var authService=require(_0xe8fb('0x12'));var qs=require(_0xe8fb('0x13'));var as=require(_0xe8fb('0x14'));var hardwareService=require(_0xe8fb('0x15'));var logger=require(_0xe8fb('0x16'))(_0xe8fb('0x17'));var utils=require(_0xe8fb('0x18'));var config=require(_0xe8fb('0x19'));var licenseUtil=require(_0xe8fb('0x1a'));var db=require(_0xe8fb('0x1b'))['db'];function respondWithStatusCode(_0x33901d,_0x1dccc0){_0x1dccc0=_0x1dccc0||0xcc;return function(_0x38eaf7){if(_0x38eaf7){return _0x33901d[_0xe8fb('0x1c')](_0x1dccc0);}return _0x33901d[_0xe8fb('0x1d')](_0x1dccc0)['end']();};}function respondWithResult(_0x3f06b0,_0x101845){_0x101845=_0x101845||0xc8;return function(_0x4a14c0){if(_0x4a14c0){return _0x3f06b0[_0xe8fb('0x1d')](_0x101845)['json'](_0x4a14c0);}};}function respondWithFilteredResult(_0x101b95,_0x4628ce){return function(_0x47007d){if(_0x47007d){var _0xe14866=typeof _0x4628ce[_0xe8fb('0x1e')]===_0xe8fb('0x1f')&&typeof _0x4628ce[_0xe8fb('0x20')]==='undefined';var _0xec1e0=_0x47007d[_0xe8fb('0x21')];var _0x1632fd=_0xe14866?0x0:_0x4628ce[_0xe8fb('0x1e')];var _0x3cf418=_0xe14866?_0x47007d[_0xe8fb('0x21')]:_0x4628ce[_0xe8fb('0x1e')]+_0x4628ce[_0xe8fb('0x20')];var _0x50e353;if(_0x3cf418>=_0xec1e0){_0x3cf418=_0xec1e0;_0x50e353=0xc8;}else{_0x50e353=0xce;}_0x101b95[_0xe8fb('0x1d')](_0x50e353);return _0x101b95['set']('Content-Range',_0x1632fd+'-'+_0x3cf418+'/'+_0xec1e0)[_0xe8fb('0x22')](_0x47007d);}return null;};}function patchUpdates(_0x429ea0){return function(_0x766a01){try{jsonpatch[_0xe8fb('0x23')](_0x766a01,_0x429ea0,!![]);}catch(_0x32c463){return BPromise['reject'](_0x32c463);}return _0x766a01[_0xe8fb('0x24')]();};}function saveUpdates(_0x51d09d,_0x47e55e){return function(_0x1bc625){if(_0x1bc625){return _0x1bc625['update'](_0x51d09d)[_0xe8fb('0x25')](function(_0x388ef5){return _0x388ef5;});}return null;};}function removeEntity(_0x193bd9,_0x4d92ed){return function(_0x108221){if(_0x108221){return _0x108221[_0xe8fb('0x26')]()[_0xe8fb('0x25')](function(){_0x193bd9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x447d9a,_0x4e8461){return function(_0x4bbf86){if(!_0x4bbf86){_0x447d9a['sendStatus'](0x194);}return _0x4bbf86;};}function handleError(_0x24a5e7,_0x58a9c2){_0x58a9c2=_0x58a9c2||0x1f4;return function(_0x232358){logger['error'](_0x232358['stack']);if(_0x232358[_0xe8fb('0x27')]){delete _0x232358['name'];}_0x24a5e7[_0xe8fb('0x1d')](_0x58a9c2)[_0xe8fb('0x28')](_0x232358);};}exports[_0xe8fb('0x29')]=function(_0x1827bb,_0x5c4cf4){var _0x4ad63d={},_0x15e500={},_0x5141c6={'count':0x0,'rows':[]};var _0x2a6108=_[_0xe8fb('0x2a')](db[_0xe8fb('0x2b')][_0xe8fb('0x2c')],function(_0x4dd747){return{'name':_0x4dd747[_0xe8fb('0x2d')],'type':_0x4dd747['type'][_0xe8fb('0x2e')]};});_0x15e500[_0xe8fb('0x2f')]=_[_0xe8fb('0x2a')](_0x2a6108,_0xe8fb('0x27'));_0x15e500[_0xe8fb('0x30')]=_[_0xe8fb('0x31')](_0x1827bb[_0xe8fb('0x30')]);_0x15e500[_0xe8fb('0x32')]=_[_0xe8fb('0x33')](_0x15e500[_0xe8fb('0x2f')],_0x15e500['query']);_0x4ad63d[_0xe8fb('0x34')]=_[_0xe8fb('0x33')](_0x15e500[_0xe8fb('0x2f')],qs[_0xe8fb('0x35')](_0x1827bb[_0xe8fb('0x30')]['fields']));_0x4ad63d[_0xe8fb('0x34')]=_0x4ad63d[_0xe8fb('0x34')][_0xe8fb('0x36')]?_0x4ad63d[_0xe8fb('0x34')]:_0x15e500[_0xe8fb('0x2f')];if(!_0x1827bb['query']['hasOwnProperty'](_0xe8fb('0x37'))){_0x4ad63d[_0xe8fb('0x20')]=qs['limit'](_0x1827bb[_0xe8fb('0x30')][_0xe8fb('0x20')]);_0x4ad63d[_0xe8fb('0x1e')]=qs[_0xe8fb('0x1e')](_0x1827bb[_0xe8fb('0x30')]['offset']);}_0x4ad63d[_0xe8fb('0x38')]=qs['sort'](_0x1827bb[_0xe8fb('0x30')][_0xe8fb('0x39')]);_0x4ad63d[_0xe8fb('0x3a')]=qs[_0xe8fb('0x32')](_[_0xe8fb('0x3b')](_0x1827bb[_0xe8fb('0x30')],_0x15e500[_0xe8fb('0x32')]),_0x2a6108);if(_0x1827bb[_0xe8fb('0x30')][_0xe8fb('0x3c')]){_0x4ad63d[_0xe8fb('0x3a')]=_[_0xe8fb('0x3d')](_0x4ad63d[_0xe8fb('0x3a')],{'$or':_[_0xe8fb('0x2a')](_0x2a6108,function(_0x3dec00){if(_0x3dec00[_0xe8fb('0x3e')]!==_0xe8fb('0x3f')){var _0x155a8a={};_0x155a8a[_0x3dec00[_0xe8fb('0x27')]]={'$like':'%'+_0x1827bb[_0xe8fb('0x30')][_0xe8fb('0x3c')]+'%'};return _0x155a8a;}})});}_0x4ad63d=_[_0xe8fb('0x3d')]({},_0x4ad63d,_0x1827bb[_0xe8fb('0x40')]);var _0x5129ea={'where':_0x4ad63d[_0xe8fb('0x3a')]};return db[_0xe8fb('0x2b')][_0xe8fb('0x21')](_0x5129ea)['then'](function(_0x1e281c){_0x5141c6[_0xe8fb('0x21')]=_0x1e281c;if(_0x1827bb[_0xe8fb('0x30')][_0xe8fb('0x41')]){_0x4ad63d[_0xe8fb('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xe8fb('0x43')](_0x4ad63d);})['then'](function(_0x20e8b7){_0x5141c6['rows']=_0x20e8b7;return _0x5141c6;})[_0xe8fb('0x25')](respondWithFilteredResult(_0x5c4cf4,_0x4ad63d))['catch'](handleError(_0x5c4cf4,null));};exports[_0xe8fb('0x44')]=function(_0x5f8e0e,_0x37c1f1){var _0x10f5b7={'raw':!![],'where':{'id':_0x5f8e0e[_0xe8fb('0x45')]['id']}},_0x218097={};_0x218097[_0xe8fb('0x2f')]=_[_0xe8fb('0x31')](db[_0xe8fb('0x2b')][_0xe8fb('0x2c')]);_0x218097[_0xe8fb('0x30')]=_[_0xe8fb('0x31')](_0x5f8e0e[_0xe8fb('0x30')]);_0x218097[_0xe8fb('0x32')]=_[_0xe8fb('0x33')](_0x218097['model'],_0x218097['query']);_0x10f5b7['attributes']=_[_0xe8fb('0x33')](_0x218097[_0xe8fb('0x2f')],qs['fields'](_0x5f8e0e['query'][_0xe8fb('0x35')]));_0x10f5b7['attributes']=_0x10f5b7[_0xe8fb('0x34')][_0xe8fb('0x36')]?_0x10f5b7[_0xe8fb('0x34')]:_0x218097[_0xe8fb('0x2f')];if(_0x5f8e0e['query'][_0xe8fb('0x41')]){_0x10f5b7[_0xe8fb('0x42')]=[{'all':!![]}];}_0x10f5b7=_[_0xe8fb('0x3d')]({},_0x10f5b7,_0x5f8e0e['options']);return db[_0xe8fb('0x2b')][_0xe8fb('0x46')](_0x10f5b7)[_0xe8fb('0x25')](handleEntityNotFound(_0x37c1f1,null))[_0xe8fb('0x25')](respondWithResult(_0x37c1f1,null))['catch'](handleError(_0x37c1f1,null));};exports[_0xe8fb('0x47')]=function(_0x19282f,_0x7a17f2){return db[_0xe8fb('0x2b')][_0xe8fb('0x47')](_0x19282f[_0xe8fb('0x48')],{})[_0xe8fb('0x25')](respondWithResult(_0x7a17f2,0xc9))[_0xe8fb('0x49')](handleError(_0x7a17f2,null));};exports[_0xe8fb('0x4a')]=function(_0x525b24,_0x2f6419){if(_0x525b24[_0xe8fb('0x48')]['id']){delete _0x525b24[_0xe8fb('0x48')]['id'];}return db[_0xe8fb('0x2b')][_0xe8fb('0x46')]({'where':{'id':_0x525b24[_0xe8fb('0x45')]['id']}})[_0xe8fb('0x25')](handleEntityNotFound(_0x2f6419,null))['then'](saveUpdates(_0x525b24[_0xe8fb('0x48')],null))[_0xe8fb('0x25')](respondWithResult(_0x2f6419,null))[_0xe8fb('0x49')](handleError(_0x2f6419,null));};exports[_0xe8fb('0x26')]=function(_0x1eeb73,_0x25aab2){return db[_0xe8fb('0x2b')][_0xe8fb('0x46')]({'where':{'id':_0x1eeb73[_0xe8fb('0x45')]['id']}})[_0xe8fb('0x25')](handleEntityNotFound(_0x25aab2,null))[_0xe8fb('0x25')](removeEntity(_0x25aab2,null))[_0xe8fb('0x49')](handleError(_0x25aab2,null));};exports[_0xe8fb('0x4b')]=function(_0x42edb5,_0x189f1b){return db[_0xe8fb('0x2b')][_0xe8fb('0x4b')]()['then'](respondWithResult(_0x189f1b,null))[_0xe8fb('0x49')](handleError(_0x189f1b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3b2f5db..e9c68b4 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 _0xd2e0=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x166a5f,_0x29c141){var _0x3a4c78=function(_0x98fb2c){while(--_0x98fb2c){_0x166a5f['push'](_0x166a5f['shift']());}};_0x3a4c78(++_0x29c141);}(_0xd2e0,0x148));var _0x0d2e=function(_0x17c0ee,_0x3846b1){_0x17c0ee=_0x17c0ee-0x0;var _0x1c91ee=_0xd2e0[_0x17c0ee];return _0x1c91ee;};'use strict';var _=require(_0x0d2e('0x0'));var util=require(_0x0d2e('0x1'));var logger=require(_0x0d2e('0x2'))(_0x0d2e('0x3'));var moment=require('moment');var BPromise=require(_0x0d2e('0x4'));var rp=require(_0x0d2e('0x5'));var fs=require('fs');var path=require(_0x0d2e('0x6'));var rimraf=require(_0x0d2e('0x7'));var config=require(_0x0d2e('0x8'));var attributes=require(_0x0d2e('0x9'));module[_0x0d2e('0xa')]=function(_0x3776e4,_0x3ce98d){return _0x3776e4[_0x0d2e('0xb')](_0x0d2e('0xc'),attributes,{'tableName':_0x0d2e('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0d2e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89f1=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x38797b,_0x11eaef){var _0x2c0953=function(_0x50d5c4){while(--_0x50d5c4){_0x38797b['push'](_0x38797b['shift']());}};_0x2c0953(++_0x11eaef);}(_0x89f1,0x1bc));var _0x189f=function(_0x47410f,_0x53d9b2){_0x47410f=_0x47410f-0x0;var _0x272541=_0x89f1[_0x47410f];return _0x272541;};'use strict';var _=require('lodash');var util=require(_0x189f('0x0'));var logger=require(_0x189f('0x1'))(_0x189f('0x2'));var moment=require(_0x189f('0x3'));var BPromise=require(_0x189f('0x4'));var rp=require(_0x189f('0x5'));var fs=require('fs');var path=require(_0x189f('0x6'));var rimraf=require(_0x189f('0x7'));var config=require(_0x189f('0x8'));var attributes=require(_0x189f('0x9'));module[_0x189f('0xa')]=function(_0x1b730a,_0x5c78c8){return _0x1b730a['define'](_0x189f('0xb'),attributes,{'tableName':_0x189f('0xc'),'paranoid':![],'indexes':[{'name':_0x189f('0xd'),'fields':[_0x189f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 547e35d..e8ace58 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 _0x121e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x12293a,_0x3e11d8){var _0x1500f3=function(_0x108fbd){while(--_0x108fbd){_0x12293a['push'](_0x12293a['shift']());}};_0x1500f3(++_0x3e11d8);}(_0x121e,0x1a5));var _0xe121=function(_0x180f6f,_0x156718){_0x180f6f=_0x180f6f-0x0;var _0x3aa3f2=_0x121e[_0x180f6f];return _0x3aa3f2;};'use strict';var _=require(_0xe121('0x0'));var util=require('util');var moment=require(_0xe121('0x1'));var BPromise=require(_0xe121('0x2'));var rs=require(_0xe121('0x3'));var fs=require('fs');var Redis=require(_0xe121('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe121('0x5'));var logger=require(_0xe121('0x6'))(_0xe121('0x7'));var config=require(_0xe121('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe121('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0f9f,_0x194984,_0x467d57){return new BPromise(function(_0x34009d,_0x407c19){return client['request'](_0x5e0f9f,_0x467d57)[_0xe121('0xa')](function(_0x1d8133){logger[_0xe121('0xb')](_0xe121('0xc'),_0x194984,_0xe121('0xd'));logger[_0xe121('0xe')](_0xe121('0xf'),_0x194984,'request\x20sent',JSON['stringify'](_0x1d8133));if(_0x1d8133[_0xe121('0x10')]){if(_0x1d8133[_0xe121('0x10')]['code']===0x1f4){logger[_0xe121('0x10')](_0xe121('0xc'),_0x194984,_0x1d8133[_0xe121('0x10')][_0xe121('0x11')]);return _0x407c19(_0x1d8133[_0xe121('0x10')][_0xe121('0x11')]);}logger[_0xe121('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x194984,_0x1d8133[_0xe121('0x10')][_0xe121('0x11')]);return _0x34009d(_0x1d8133[_0xe121('0x10')][_0xe121('0x11')]);}else{logger[_0xe121('0xb')](_0xe121('0xc'),_0x194984,_0xe121('0xd'));_0x34009d(_0x1d8133[_0xe121('0x12')][_0xe121('0x11')]);}})[_0xe121('0x13')](function(_0x77d59b){logger[_0xe121('0x10')](_0xe121('0xc'),_0x194984,_0x77d59b);_0x407c19(_0x77d59b);});});} \ No newline at end of file +var _0xaf75=['then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4b6e1f,_0x2f71f4){var _0x20a644=function(_0x35da7f){while(--_0x35da7f){_0x4b6e1f['push'](_0x4b6e1f['shift']());}};_0x20a644(++_0x2f71f4);}(_0xaf75,0x197));var _0x5af7=function(_0x1ffcf3,_0x528637){_0x1ffcf3=_0x1ffcf3-0x0;var _0x5c3f92=_0xaf75[_0x1ffcf3];return _0x5c3f92;};'use strict';var _=require(_0x5af7('0x0'));var util=require(_0x5af7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5af7('0x2'));var fs=require('fs');var Redis=require(_0x5af7('0x3'));var db=require(_0x5af7('0x4'))['db'];var utils=require(_0x5af7('0x5'));var logger=require(_0x5af7('0x6'))(_0x5af7('0x7'));var config=require(_0x5af7('0x8'));var jayson=require(_0x5af7('0x9'));var client=jayson[_0x5af7('0xa')][_0x5af7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e4f00,_0x44ea9f,_0x2dd0cf){return new BPromise(function(_0x2f62d8,_0x5951e3){return client[_0x5af7('0xc')](_0x1e4f00,_0x2dd0cf)[_0x5af7('0xd')](function(_0x1dac97){logger[_0x5af7('0xe')](_0x5af7('0xf'),_0x44ea9f,_0x5af7('0x10'));logger[_0x5af7('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x44ea9f,'request\x20sent',JSON['stringify'](_0x1dac97));if(_0x1dac97[_0x5af7('0x12')]){if(_0x1dac97[_0x5af7('0x12')][_0x5af7('0x13')]===0x1f4){logger[_0x5af7('0x12')](_0x5af7('0xf'),_0x44ea9f,_0x1dac97[_0x5af7('0x12')][_0x5af7('0x14')]);return _0x5951e3(_0x1dac97[_0x5af7('0x12')][_0x5af7('0x14')]);}logger[_0x5af7('0x12')](_0x5af7('0xf'),_0x44ea9f,_0x1dac97['error']['message']);return _0x2f62d8(_0x1dac97[_0x5af7('0x12')][_0x5af7('0x14')]);}else{logger[_0x5af7('0xe')](_0x5af7('0xf'),_0x44ea9f,'request\x20sent');_0x2f62d8(_0x1dac97['result'][_0x5af7('0x14')]);}})['catch'](function(_0xd38e6b){logger['error'](_0x5af7('0xf'),_0x44ea9f,_0xd38e6b);_0x5951e3(_0xd38e6b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c926f0f..41d4d4b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7579=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','default','then','listen','info','start','filter','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','App\x20Ready!','catch','log','error'];(function(_0x103a4b,_0x3f35f4){var _0x32a502=function(_0x5b7308){while(--_0x5b7308){_0x103a4b['push'](_0x103a4b['shift']());}};_0x32a502(++_0x3f35f4);}(_0x7579,0x1e2));var _0x9757=function(_0x53fb55,_0x3befcf){_0x53fb55=_0x53fb55-0x0;var _0x181a74=_0x7579[_0x53fb55];return _0x181a74;};'use strict';var _=require(_0x9757('0x0'));var db=require(_0x9757('0x1'))['db'];var seedDb=require(_0x9757('0x2'));var checkLicense=require(_0x9757('0x3'));var rpc=require(_0x9757('0x4'));var config=require(_0x9757('0x5'));var logger=require('./config/logger')(_0x9757('0x6'));var pm2=require(_0x9757('0x7'));var pm2Config=require(_0x9757('0x8'));var schedule=require(_0x9757('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x9757('0xa'));var transcribe=require(_0x9757('0xb'));var provider=require(_0x9757('0xc'));function main(){return db['sequelize'][_0x9757('0xd')]()['then'](function(){if(config[_0x9757('0xe')]){return seedDb[_0x9757('0xf')]();}})[_0x9757('0x10')](function(){return checkLicense['default']();})[_0x9757('0x10')](function(){return rpc[_0x9757('0x11')]();})[_0x9757('0x10')](function(_0xc35036){logger[_0x9757('0x12')](_0xc35036);return chat[_0x9757('0x13')]();})[_0x9757('0x10')](function(){return whatsapp[_0x9757('0x13')]();})[_0x9757('0x10')](function(){return schedule[_0x9757('0x13')]();})[_0x9757('0x10')](function(){return transcribe['start']();})[_0x9757('0x10')](function(){return provider[_0x9757('0x13')]();})[_0x9757('0x10')](function(_0x595a9e){logger[_0x9757('0x12')](_0x595a9e);return pm2[_0x9757('0x13')](pm2Config);})[_0x9757('0x10')](function(_0x14f67c){var _0x224229=_0x14f67c[_0x9757('0x14')](function(_0x105e56){return typeof _0x105e56['exitCode']===_0x9757('0x15')&&_0x105e56['exitCode']>=0x0;});if(_0x224229[_0x9757('0x16')]>0x0){throw new Error(_0x224229[_0x9757('0x16')]+_0x9757('0x17')+_[_0x9757('0x18')](_0x224229,function(_0x3f6be9){return'\x22'+_0x3f6be9[_0x9757('0x19')]['name']+'\x22';}));}logger[_0x9757('0x12')](_0x9757('0x1a'),_[_0x9757('0x18')](_[_0x9757('0x14')](_0x14f67c,{'status':_0x9757('0x1b')}),_0x9757('0x1c'))[_0x9757('0x1d')]());logger['info'](_0x9757('0x1e'),_['map'](_['filter'](_0x14f67c,function(_0x37c889){return _0x37c889[_0x9757('0x1f')]!==_0x9757('0x1b');}),_0x9757('0x1c'))['join']()||'None');console['log'](_0x9757('0x20'));})[_0x9757('0x21')](function(_0x3bec93){console[_0x9757('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3bec93);logger[_0x9757('0x23')](_0x9757('0x24'),_0x3bec93);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x08d9=['\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','Offline\x20apps:','status','join','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x330330,_0x850c46){var _0x17102f=function(_0x406648){while(--_0x406648){_0x330330['push'](_0x330330['shift']());}};_0x17102f(++_0x850c46);}(_0x08d9,0xc2));var _0x908d=function(_0x2b6f64,_0xfdce45){_0x2b6f64=_0x2b6f64-0x0;var _0x5ece01=_0x08d9[_0x2b6f64];return _0x5ece01;};'use strict';var _=require(_0x908d('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x908d('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x908d('0x2'));var config=require(_0x908d('0x3'));var logger=require(_0x908d('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x908d('0x5'));var schedule=require(_0x908d('0x6'));var chat=require(_0x908d('0x7'));var whatsapp=require(_0x908d('0x8'));var transcribe=require(_0x908d('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x908d('0xa')][_0x908d('0xb')]()[_0x908d('0xc')](function(){if(config[_0x908d('0xd')]){return seedDb[_0x908d('0xe')]();}})[_0x908d('0xc')](function(){return checkLicense[_0x908d('0xe')]();})[_0x908d('0xc')](function(){return rpc[_0x908d('0xf')]();})[_0x908d('0xc')](function(_0x570b56){logger[_0x908d('0x10')](_0x570b56);return chat[_0x908d('0x11')]();})[_0x908d('0xc')](function(){return whatsapp[_0x908d('0x11')]();})[_0x908d('0xc')](function(){return schedule['start']();})['then'](function(){return transcribe['start']();})[_0x908d('0xc')](function(){return provider[_0x908d('0x11')]();})[_0x908d('0xc')](function(_0x23d6c8){logger[_0x908d('0x10')](_0x23d6c8);return pm2[_0x908d('0x11')](pm2Config);})[_0x908d('0xc')](function(_0x4dcd6f){var _0x508b2e=_0x4dcd6f[_0x908d('0x12')](function(_0x207ac1){return typeof _0x207ac1[_0x908d('0x13')]===_0x908d('0x14')&&_0x207ac1['exitCode']>=0x0;});if(_0x508b2e['length']>0x0){throw new Error(_0x508b2e[_0x908d('0x15')]+_0x908d('0x16')+_[_0x908d('0x17')](_0x508b2e,function(_0x3f1c00){return'\x22'+_0x3f1c00['pm2_env'][_0x908d('0x18')]+'\x22';}));}logger[_0x908d('0x10')](_0x908d('0x19'),_[_0x908d('0x17')](_[_0x908d('0x12')](_0x4dcd6f,{'status':_0x908d('0x1a')}),_0x908d('0x18'))['join']());logger[_0x908d('0x10')](_0x908d('0x1b'),_[_0x908d('0x17')](_['filter'](_0x4dcd6f,function(_0x37a7b8){return _0x37a7b8[_0x908d('0x1c')]!==_0x908d('0x1a');}),_0x908d('0x18'))[_0x908d('0x1d')]()||'None');console[_0x908d('0x1e')]('App\x20Ready!');})[_0x908d('0x1f')](function(_0x10148){console[_0x908d('0x1e')](_0x908d('0x20'),_0x10148);logger[_0x908d('0x21')](_0x908d('0x22'),_0x10148);process[_0x908d('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 537c086..e931a12 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x226ac0,_0x4c2837){var _0x204480=function(_0x7caaab){while(--_0x7caaab){_0x226ac0['push'](_0x226ac0['shift']());}};_0x204480(++_0x4c2837);}(_0x55ca,0x126));var _0xa55c=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x55ca[_0x1aa049];return _0x357f29;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x54ef=['../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','headers','authorization','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','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','splice','encryptString','join','promisify','sign','secret','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment'];(function(_0x396b9d,_0x119344){var _0x54851=function(_0x29bc0a){while(--_0x29bc0a){_0x396b9d['push'](_0x396b9d['shift']());}};_0x54851(++_0x119344);}(_0x54ef,0x112));var _0xf54e=function(_0x5280f3,_0x13ab95){_0x5280f3=_0x5280f3-0x0;var _0xa754fe=_0x54ef[_0x5280f3];return _0xa754fe;};'use strict';var db=require(_0xf54e('0x0'))['db'];var config=require(_0xf54e('0x1'));var hardwareConf=require(_0xf54e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xf54e('0x3'));var _=require(_0xf54e('0x4'));var jwt=require(_0xf54e('0x5'));var expressJwt=require(_0xf54e('0x6'));var compose=require(_0xf54e('0x7'));var basicAuth=require(_0xf54e('0x8'));var crypto=require(_0xf54e('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xf54e('0xa'));var validateJwt=expressJwt({'secret':config[_0xf54e('0xb')][_0xf54e('0xc')]});var userAttributes=['id','role',_0xf54e('0xd'),'name',_0xf54e('0xe'),_0xf54e('0xf'),'userpic',_0xf54e('0x10'),_0xf54e('0x11'),_0xf54e('0x12'),_0xf54e('0x13'),'mailPause',_0xf54e('0x14'),_0xf54e('0x15'),_0xf54e('0x16'),_0xf54e('0x17'),'showWebBar',_0xf54e('0x18'),'lastPauseAt','crudPermissions',_0xf54e('0x19'),_0xf54e('0x1a'),_0xf54e('0x1b'),_0xf54e('0x1c'),'phoneBarAutoAnswerDelay',_0xf54e('0x1d'),_0xf54e('0x1e'),_0xf54e('0x1f'),_0xf54e('0x20'),'phoneBarExpires',_0xf54e('0x21'),_0xf54e('0x22'),_0xf54e('0x23'),'hotdesk','interface',_0xf54e('0x24'),_0xf54e('0x25'),_0xf54e('0x26'),_0xf54e('0x27'),_0xf54e('0x28'),_0xf54e('0x29'),_0xf54e('0x2a'),_0xf54e('0x2b'),_0xf54e('0x2c'),_0xf54e('0x2d'),_0xf54e('0x2e'),'emailAutoanswer','emailAutoanswerDelay',_0xf54e('0x2f'),'smsAutoanswerDelay',_0xf54e('0x30'),_0xf54e('0x31'),_0xf54e('0x32'),_0xf54e('0x33'),_0xf54e('0x34'),_0xf54e('0x35')];exports[_0xf54e('0x36')]=function(){return this[_0xf54e('0x37')](!![])[_0xf54e('0x38')](function(_0x5f9eea,_0x1c58bd,_0x5b83df){if(_0x5f9eea[_0xf54e('0x39')]){_0x5b83df();}else{return db['ChatInteraction'][_0xf54e('0x3a')]({'where':{'id':_0x5f9eea[_0xf54e('0x3b')]['id']},'attributes':['id',_0xf54e('0x3c'),_0xf54e('0x3d')],'raw':!![]})[_0xf54e('0x3e')](function(_0x160160){if(_0x160160&&_0x160160[_0xf54e('0x3c')]){return _0x1c58bd[_0xf54e('0x3f')](_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?0x195:0x193)[_0xf54e('0x41')]({'message':_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?'Unmanaged.':_0xf54e('0x42')});}else{_0x5b83df();}})['catch'](function(_0x282c63){_0x5b83df(_0x282c63);});}});};exports['isAuthenticated']=function isAuthenticated(_0x15b888){return compose()[_0xf54e('0x38')](function(_0x21ba00,_0xa13cd0,_0x25b643){var _0x3993e4;if(_0x21ba00[_0xf54e('0x43')]['authorization']){if(_['startsWith'](_0x21ba00[_0xf54e('0x43')][_0xf54e('0x44')],_0xf54e('0x45'))){var _0x16d00f=basicAuth(_0x21ba00);db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'name':_0x16d00f[_0xf54e('0x48')]}})[_0xf54e('0x3e')](function(_0x3ae704){if(!_0x3ae704||!_0x3ae704[_0xf54e('0x49')](_0x16d00f['pass'])){return _0xa13cd0['status'](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x4a')});}_0x21ba00['user']={'id':_0x3ae704['id']};_0x25b643();})[_0xf54e('0x4b')](function(_0x82e313){_0x25b643(_0x82e313);});}else if(_[_0xf54e('0x4c')](_0x21ba00[_0xf54e('0x43')]['authorization'],'Bearer')){validateJwt(_0x21ba00,_0xa13cd0,_0x25b643);}else{if(_0x15b888){_0x25b643();}else{return _0xa13cd0['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x4d')});}}}else if(_0x21ba00[_0xf54e('0x4e')][_0xf54e('0x4f')]){try{var _0x29dc39={'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ba00['query']['apikey'],_0x29dc39)[_0xf54e('0x3e')](function(_0x734187){return db['User']['find']({'where':{'id':_0x734187[_0xf54e('0x51')]}})[_0xf54e('0x3e')](function(_0x173e6c){_0x3993e4=_0x173e6c;return db['Setting'][_0xf54e('0x3a')]({'where':{'id':0x1},'attributes':[_0xf54e('0x52'),'blockDuration'],'raw':!![]});})[_0xf54e('0x3e')](function(_0x6e5bdf){if(!_0x3993e4||!_[_0xf54e('0x53')](_0x3993e4[_0xf54e('0x54')],_0x734187[_0xf54e('0x55')])){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3993e4[_0xf54e('0x56')]){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3993e4[_0xf54e('0x57')]){if(_0x6e5bdf[_0xf54e('0x58')]>0x0){if(moment(_0x3993e4[_0xf54e('0x59')])[_0xf54e('0x5a')](_0x6e5bdf[_0xf54e('0x58')],_0xf54e('0x5b'))>moment()){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}else{return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}_0x21ba00[_0xf54e('0x39')]={'id':_0x3993e4['id']};_0x25b643();});})[_0xf54e('0x4b')](function(){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x533423){_0x25b643(_0x533423);}}else if(_0x15b888){_0x25b643();}else{return _0xa13cd0[_0xf54e('0x3f')](0x193)[_0xf54e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf54e('0x38')](function(_0x311ce1,_0x381c03,_0x4f61d7){if(_0x311ce1[_0xf54e('0x39')]){db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'id':_0x311ce1[_0xf54e('0x39')]['id']},'attributes':userAttributes})[_0xf54e('0x3e')](function(_0x143a39){if(!_0x143a39){return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5d')});}_0x311ce1['user']=_0x143a39;_0x4f61d7();})[_0xf54e('0x4b')](function(_0x3447fd){_0x4f61d7(_0x3447fd);});}else if(_0x15b888){_0x4f61d7();}else{return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5e')});}});};exports[_0xf54e('0x5f')]=function canUpdate(){return compose()['use'](function(_0x23a4a1,_0x59af72,_0x1d16e0){return licenseUtil['getLicense']()[_0xf54e('0x3e')](function(_0x331b16){if(_0x331b16[_0xf54e('0x60')]){_0x1d16e0();}else{return _0x59af72['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0x32fb46){_0x1d16e0(_0x32fb46);});});};exports[_0xf54e('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x427799,_0x297737,_0x346bb4){return licenseUtil[_0xf54e('0x63')]()['then'](function(_0x1bdb5a){if(_0x1bdb5a[_0xf54e('0x64')]){_0x346bb4();}else{return _0x297737['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0xca0141){_0x346bb4(_0xca0141);});});};exports['isMiddleware']=function(_0x196e68,_0x2b645e,_0x2527f6){_0x196e68[_0xf54e('0x65')]=!![];return _0x2527f6();};exports[_0xf54e('0x66')]=function signToken(_0x3237ef){return signJwt(_0x3237ef);};exports[_0xf54e('0x67')]=function(_0xd7b0c5,_0x15bfef){if(!_0xd7b0c5[_0xf54e('0x39')]){return _0x15bfef[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x68')});}var _0x2de1fe={'payload':{'id':_0xd7b0c5[_0xf54e('0x39')]['id'],'role':_0xd7b0c5[_0xf54e('0x39')][_0xf54e('0x69')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2de1fe)[_0xf54e('0x3e')](function(_0x21fd80){_0x15bfef[_0xf54e('0x6a')]('motion.token',_0x21fd80);_0x15bfef['redirect'](_0xf54e('0x6b'));})[_0xf54e('0x4b')](function(_0x45861b){return _0x15bfef[_0xf54e('0x3f')](0x1f4)[_0xf54e('0x6c')](_0x45861b);});};exports[_0xf54e('0x6d')]=function(_0x22763f){if(_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x54')])||_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x6f')])){return null;}else{return createJwt(_0x22763f);}};exports['generateApiKey']=function(_0x2aacf6){_0x2aacf6[_0xf54e('0x54')]=generateNonce();_0x2aacf6[_0xf54e('0x6f')]=generateIssuedAt();return createJwt(_0x2aacf6);};exports[_0xf54e('0x70')]=function(_0x1b8f16,_0x30f53b){var _0x18a25f=_0x1b8f16['query'][_0xf54e('0x4f')];if(_0x18a25f){var _0x5fabd2={'nonce':_0x30f53b[_0xf54e('0x54')],'iat':_0x30f53b['apiKeyIat'],'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x18a25f,_0x5fabd2)[_0xf54e('0x3e')](function(){return generateApiKey(_0x30f53b);});}else{throw{'message':_0xf54e('0x71')};}};exports[_0xf54e('0x72')]=function(_0x5b882f){var _0x1d8ccf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d8ccf[_0xf54e('0x73')](_0x5b882f))throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0xf54e('0x76'));return;};exports[_0xf54e('0x77')]=function(_0x21d485,_0x55d57f,_0x55de5c){var _0x4270e1=encryptor[_0xf54e('0x78')](_0x55d57f)['split'](',');for(var _0x29743e=0x0;_0x29743e<_0x55de5c;_0x29743e++){if(!_0x4270e1[_0x29743e])break;if(_0x21d485['toLowerCase']()===_0x4270e1[_0x29743e][_0xf54e('0x79')]()){var _0x528a64=util[_0xf54e('0x7a')](_0xf54e('0x7b'),_0x55de5c);if(_0x55de5c===0x1){_0x528a64=_0xf54e('0x7c');}throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0x528a64);}}return;};exports[_0xf54e('0x7d')]=function(_0x556e55,_0x479572){var _0x79345=_0x479572?encryptor[_0xf54e('0x78')](_0x479572)['split'](','):[];if(_0x79345['length']===0x5){_0x79345[_0xf54e('0x7e')](-0x1,0x1);}_0x79345['unshift'](_0x556e55);return encryptor[_0xf54e('0x7f')](_0x79345[_0xf54e('0x80')](','));};function signJwt(_0x47596c){var _0x2b11f8=BPromise[_0xf54e('0x81')](jwt[_0xf54e('0x82')],{'context':jwt});var _0x3bf476=_0x47596c[_0xf54e('0x83')]||config[_0xf54e('0xb')][_0xf54e('0xc')];return new BPromise(function(_0x1f9dad,_0x2c6d0e){_0x2b11f8(_0x47596c[_0xf54e('0x84')],_0x3bf476,_0x47596c[_0xf54e('0x85')])['then'](function(_0x302f3d){_0x1f9dad(_0x302f3d);})[_0xf54e('0x4b')](function(_0xb7ff4d){_0x2c6d0e(_0xb7ff4d);});});}function verifyJwt(_0x11908b,_0x1e4c0d,_0x494629){var _0xf50b1b=BPromise[_0xf54e('0x81')](jwt['verify'],{'context':jwt});var _0x51ec35=_0x494629||config[_0xf54e('0xb')]['session'];return new BPromise(function(_0x26322a,_0x39c5eb){_0xf50b1b(_0x11908b,_0x51ec35,_0x1e4c0d)[_0xf54e('0x3e')](function(_0x9789b9){_0x26322a(_0x9789b9);})['catch'](function(_0x2ecda1){_0x39c5eb(_0x2ecda1);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf54e('0x86')](_0xf54e('0x87'));}function generateIssuedAt(){return Math[_0xf54e('0x88')](Date['now']()/0x3e8)[_0xf54e('0x86')]();}function createJwt(_0x504ec7){var _0x3f7224={'payload':{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce']},'options':{'algorithm':_0xf54e('0x89'),'subject':_0x504ec7['id']['toString'](),'issuer':hardwareConf[_0xf54e('0x50')](),'audience':hardwareConf[_0xf54e('0x50')]()}};return signJwt(_0x3f7224)[_0xf54e('0x3e')](function(_0x38405c){return{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce'],'token':_0x38405c};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 1a8b728..fbfaa1d 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0x20ee7b,_0x43aaf7){var _0x494bcc=function(_0x1c53eb){while(--_0x1c53eb){_0x20ee7b['push'](_0x20ee7b['shift']());}};_0x494bcc(++_0x43aaf7);}(_0xb10b,0x12a));var _0xbb10=function(_0x53286a,_0x485c92){_0x53286a=_0x53286a-0x0;var _0x5730ff=_0xb10b[_0x53286a];return _0x5730ff;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file +var _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0xc169e,_0x43573a){var _0x11077b=function(_0x4a2409){while(--_0x4a2409){_0xc169e['push'](_0xc169e['shift']());}};_0x11077b(++_0x43573a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e5608,_0x8b6979){_0x3e5608=_0x3e5608-0x0;var _0x4128d3=_0xb10b[_0x3e5608];return _0x4128d3;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 22ca8d9..b7ffdff 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8b5=['start','value','end','Tag','tags','clause','and','User','user','uc.UserId\x20=\x20?','keys','map','some','name','compact','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IN\x20?','attributes','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','sequelize','toString','Tags','clone','COUNT(*)','isEmpty','SELECT','query','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','createdAt','updatedAt','deletedAt','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default'];(function(_0x42b448,_0x112d6f){var _0x5c929c=function(_0x39fd42){while(--_0x39fd42){_0x42b448['push'](_0x42b448['shift']());}};_0x5c929c(++_0x112d6f);}(_0xb8b5,0x16e));var _0x5b8b=function(_0x13a0a7,_0xf7597c){_0x13a0a7=_0x13a0a7-0x0;var _0x16dcff=_0xb8b5[_0x13a0a7];return _0x16dcff;};'use strict';var _=require(_0x5b8b('0x0'));var squel=require(_0x5b8b('0x1'));var as=require(_0x5b8b('0x2'));var qs=require(_0x5b8b('0x3'));var utils=require(_0x5b8b('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x326d42,_0x16dff3){var _0x1f595d=![];if(_0x326d42[_0x5b8b('0x5')]===_0x5b8b('0x6')&&!_0x16dff3[_0x5b8b('0x7')]&&!_0x16dff3[_0x5b8b('0x8')]&&_0x16dff3[_0x5b8b('0x9')]!==_0x5b8b('0xa')){_0x1f595d=!![];}return _0x1f595d;}function getContactsSubquery(){return squel[_0x5b8b('0xb')]()['from'](_0x5b8b('0xc'),'c')[_0x5b8b('0xd')](_0x5b8b('0xe'));}function applyJoinClauses(_0x58f35c,_0x54d4d1){var _0xc2c33f=_0x54d4d1?'c':_0x5b8b('0xf');_0x58f35c[_0x5b8b('0x10')](_0x5b8b('0x11'),'uc',_0x5b8b('0x12')+_0xc2c33f+'.id')[_0x5b8b('0x10')](_0x5b8b('0x13'),'ct',_0x5b8b('0x14')+_0xc2c33f+_0x5b8b('0x15'))['left_join']('tools_tags','t',_0x5b8b('0x16'));return _0x58f35c;}function addFieldsToQuery(_0xd5daa6,_0x4a1f50,_0x2f6e4e,_0x55dfbd,_0x46167d){var _0x113792=_0x46167d?'c':_0x5b8b('0xf');if(!_0x4a1f50){_0x4a1f50=['id',_0x5b8b('0x17'),'lastName',_0x5b8b('0x18'),_0x5b8b('0x19'),_0x5b8b('0x1a'),'email','ListId','CompanyId',_0x5b8b('0x1b'),_0x5b8b('0x1c'),_0x5b8b('0x1d'),'TagIds'];}else if(!_0x4a1f50['includes']('id')){_0x4a1f50[_0x5b8b('0x1e')]('id');}var _0x142a0c=_0x2f6e4e&&_0x46167d||!_0x2f6e4e&&!_0x46167d;if(_0x55dfbd){_0x142a0c=_0x55dfbd&&_0x46167d||!_0x55dfbd&&!_0x46167d;}_0x4a1f50[_0x5b8b('0x1f')](function(_0x486aba){if(_0x486aba===_0x5b8b('0x20')){if(_0x142a0c){_0xd5daa6[_0x5b8b('0x21')](_0x5b8b('0x22'),_0x486aba);}else if(_0x2f6e4e||_0x55dfbd){_0xd5daa6[_0x5b8b('0x21')](_0x113792+'.'+_0x486aba);}}else{_0xd5daa6[_0x5b8b('0x21')](_0x113792+'.'+_0x486aba);}});return _0xd5daa6;}function getSqlClauses(){var _0x7672fa={'default':squel[_0x5b8b('0x23')](),'fields':squel[_0x5b8b('0x23')](),'filter':squel[_0x5b8b('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x5b8b('0x23')](),'skip':![]}};return _0x7672fa;}function parseTagParameter(_0x1c6ddb){var _0x3e24b0=squel['expr']();if(_0x1c6ddb){var _0x1fecec=utils[_0x5b8b('0x24')](_0x1c6ddb);_0x1fecec[_0x5b8b('0x1f')](function(_0x21f794){_0x3e24b0['or'](_0x5b8b('0x25'),'%,'+_0x21f794+',%');});}return _0x3e24b0;}function parseSearchFilter(_0x39503b){var _0x2396de=squel[_0x5b8b('0x23')]();if(_0x39503b){var _0x3a1696=_0x39503b[_0x5b8b('0x26')]('\x5c','\x5c\x5c')[_0x5b8b('0x26')](/'/g,'\x27\x27');if(_0x3a1696[_0x5b8b('0x27')]('\x20')[_0x5b8b('0x28')]>0x1){_0x2396de['or'](_0x5b8b('0x29'),qs['getFullTextValue'](_0x3a1696),null);}else{if(qs['isNumeric'](_0x3a1696)){_0x2396de['or'](_0x5b8b('0x2a'),_0x3a1696+'%');_0x2396de['or']('c.phone\x20LIKE\x20?',_0x3a1696+'%');_0x2396de['or']('c.mobile\x20LIKE\x20?',_0x3a1696+'%');_0x2396de['or']('c.fax\x20LIKE\x20?',_0x3a1696+'%');}else if(qs[_0x5b8b('0x2b')](_0x3a1696)){_0x2396de['or'](_0x5b8b('0x2c'),_0x3a1696+'%');}else{_0x2396de['or'](_0x5b8b('0x2d'),'%'+_0x3a1696+'%');_0x2396de['or'](_0x5b8b('0x2e'),'%'+_0x3a1696+'%');_0x2396de['or']('c.email\x20LIKE\x20?','%'+_0x3a1696+'%');}}}return _0x2396de;}function parseAdvancedSearchFilter(_0x2c19de,_0x4ca35e){var _0x19b862=getSqlClauses();var _0x116dd3=as[_0x5b8b('0x2f')](_0x2c19de);var _0x924b6=_0x116dd3[_0x5b8b('0x30')];for(var _0x5c3b3e=0x0;_0x5c3b3e<_0x116dd3[_0x5b8b('0x31')][_0x5b8b('0x28')];_0x5c3b3e++){var _0x244686=_0x116dd3[_0x5b8b('0x31')][_0x5c3b3e];var _0x23192d='c';var _0x385e91=_[_0x5b8b('0x32')](_0x4ca35e,['name',_0x244686[_0x5b8b('0x21')]]);if(_0x385e91){if(_0x244686[_0x5b8b('0x21')]===_0x5b8b('0x33')||_0x385e91[_0x5b8b('0x34')]===_0x5b8b('0x35')){_0x244686[_0x5b8b('0x36')]='DATE';}var _0x3d92c0=as[_0x5b8b('0x37')](_0x23192d,_0x385e91[_0x5b8b('0x38')],_0x244686);_0x19b862[_0x5b8b('0x39')][_0x924b6](_0x3d92c0['text'],_0x3d92c0['value'][_0x5b8b('0x3a')],_0x3d92c0[_0x5b8b('0x3b')][_0x5b8b('0x3c')]);}else{if(_0x244686[_0x5b8b('0x21')]===_0x5b8b('0x3d')){var _0x585cef=_0x244686['value'][_0x5b8b('0x27')](',')['map'](function(_0x8e0a9a){return Number(_0x8e0a9a);});var _0xf2ab20=parseTagParameter(_0x585cef);_0x19b862[_0x5b8b('0x3e')][_0x5b8b('0x3f')][_0x5b8b('0x40')](_0xf2ab20);_0x19b862['tags']['ids']=_0x585cef;}else if(_0x244686[_0x5b8b('0x21')]===_0x5b8b('0x41')){_0x19b862[_0x5b8b('0x42')][_0x5b8b('0x3f')][_0x5b8b('0x40')](_0x5b8b('0x43'),_0x244686[_0x5b8b('0x3b')]);_0x19b862[_0x5b8b('0x42')]['skip']=!![];}}}return _0x19b862;}function parseModelFields(_0x56d641,_0x42bf12){var _0x5ec30a=squel[_0x5b8b('0x23')]();var _0x1004f5=_(_0x56d641)[_0x5b8b('0x44')]()[_0x5b8b('0x45')](function(_0x5c2672){return _[_0x5b8b('0x46')](_0x42bf12,[_0x5b8b('0x47'),_0x5c2672])?_0x5c2672:undefined;})[_0x5b8b('0x48')]()[_0x5b8b('0x3b')]();if(_0x56d641['Contact']){_0x1004f5[_0x5b8b('0x1e')](_0x5b8b('0x49'));}if(_0x1004f5[_0x5b8b('0x28')]>0x0){_0x1004f5['forEach'](function(_0x55c041){if(_0x55c041===_0x5b8b('0x8')){_0x5ec30a[_0x5b8b('0x40')]('c.ListId\x20IN\x20?',[]['concat'](_0x56d641[_0x55c041]));}else if(_0x55c041===_0x5b8b('0x49')){var _0x316044='%'+_0x56d641[_0x55c041]+'%';_0x5ec30a[_0x5b8b('0x40')](_0x5b8b('0x4a'),_0x316044);}else{_0x5ec30a[_0x5b8b('0x40')]('c.'+_0x55c041+_0x5b8b('0x4b'),_0x56d641[_0x55c041]);}});}return _0x5ec30a;}function parseQueryParameters(_0x3a54bb,_0x1405e5){var _0x23291f=getSqlClauses();return Promise[_0x5b8b('0x4c')]()[_0x5b8b('0x4d')](function(){return parseModelFields(_0x3a54bb,_0x1405e5);})['then'](function(_0x4f4fed){_0x23291f[_0x5b8b('0x4e')][_0x5b8b('0x40')](_0x4f4fed);return parseTagParameter(_0x3a54bb['tag']);})['then'](function(_0x1bf1fb){_0x23291f['tags'][_0x5b8b('0x3f')][_0x5b8b('0x40')](_0x1bf1fb);return parseSearchFilter(_0x3a54bb[_0x5b8b('0x4f')]);})[_0x5b8b('0x4d')](function(_0x15cc7a){_0x23291f[_0x5b8b('0x4f')]=_0x15cc7a;return _0x23291f;});}function checkListsRestrictions(_0x39e9dd,_0x22e0ba,_0x1d245e){var _0x46b710=squel[_0x5b8b('0x23')]();return Promise[_0x5b8b('0x4c')]()[_0x5b8b('0x4d')](function(){if(_0x22e0ba[_0x5b8b('0x7')]&&_0x39e9dd[_0x5b8b('0x5')]===_0x5b8b('0x6')&&!_0x1d245e){return _0x39e9dd[_0x5b8b('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x5b8b('0x4d')](function(_0x178780){if(_0x178780){if(_0x178780['length']===0x0){_0x46b710[_0x5b8b('0x40')]('c.ListId\x20IS\x20NULL');}else{_0x46b710[_0x5b8b('0x40')](_0x5b8b('0x51'),_[_0x5b8b('0x45')](_0x178780,'id'));}}})[_0x5b8b('0x4d')](function(){return _0x46b710;});}function buildContactsQuery(_0x45ba5c,_0x227016,_0xedcf0d,_0xe700a4,_0x1068ec,_0x28be38){if(_0x227016){_0x227016=_0xedcf0d[_0x5b8b('0x52')];}_0x45ba5c=addFieldsToQuery(_0x45ba5c,_0x227016,_0xe700a4,_0x28be38,!![]);var _0x5466b3=squel[_0x5b8b('0xb')]();_0x5466b3=addFieldsToQuery(_0x5466b3,_0x227016,_0xe700a4,_0x28be38,![]);if(_0xe700a4||_0x28be38){_0x45ba5c=applyJoinClauses(_0x45ba5c,!![]);_0x45ba5c['group'](_0x5b8b('0x53'));if(_0xedcf0d[_0x5b8b('0x54')]){_0x5466b3[_0x5b8b('0x54')](_0xedcf0d[_0x5b8b('0x54')]);}if(_0xedcf0d[_0x5b8b('0x55')]){_0x5466b3[_0x5b8b('0x55')](_0xedcf0d[_0x5b8b('0x55')]);}}else{_0x5466b3=applyJoinClauses(_0x5466b3,![]);_0x5466b3[_0x5b8b('0x56')](_0x5b8b('0x57'));if(_0xedcf0d['limit']){_0x45ba5c[_0x5b8b('0x54')](_0xedcf0d[_0x5b8b('0x54')]);}if(_0xedcf0d['offset']){_0x45ba5c[_0x5b8b('0x55')](_0xedcf0d[_0x5b8b('0x55')]);}}_0x5466b3[_0x5b8b('0x58')](_0x1068ec);if(_0xedcf0d[_0x5b8b('0x59')]){_0xedcf0d[_0x5b8b('0x59')][_0x5b8b('0x1f')](function(_0x305269){_0x45ba5c[_0x5b8b('0x59')]('c.'+_0x305269[0x0],_0x305269[0x1]===_0x5b8b('0x5a')?![]:!![]);_0x5466b3[_0x5b8b('0x59')](_0x5b8b('0x5b')+_0x305269[0x0],_0x305269[0x1]===_0x5b8b('0x5a')?![]:!![]);});}_0x5466b3[_0x5b8b('0x5c')](_0x45ba5c,_0x5b8b('0xf'));return _0x5466b3;}function getFilteredContacts(_0x256d8b){var _0x4117ec=[];return db['Tag'][_0x5b8b('0x5d')]({'attributes':['id',_0x5b8b('0x47'),_0x5b8b('0x5e')],'raw':!![]})[_0x5b8b('0x4d')](function(_0x3cbf29){_0x4117ec=_[_0x5b8b('0x5f')](_0x3cbf29,'id');var _0x2ab424={'type':db[_0x5b8b('0x60')][_0x5b8b('0x61')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x5b8b('0x62')]['query'](_0x256d8b[_0x5b8b('0x63')](),_0x2ab424);})['then'](function(_0x42d5ba){_0x42d5ba[_0x5b8b('0x1f')](function(_0x2e1efd){if(_0x2e1efd[_0x5b8b('0x20')]){_0x2e1efd[_0x5b8b('0x64')]=[];_0x2e1efd['TagIds']['split'](',')[_0x5b8b('0x1f')](function(_0xe92f8f){_0x2e1efd[_0x5b8b('0x64')]['push'](_0x4117ec[_0xe92f8f]);});}delete _0x2e1efd[_0x5b8b('0x20')];});return _0x42d5ba;});}function countFilteredContacts(_0x4e86f7,_0x309006){var _0x16c109=_0x4e86f7[_0x5b8b('0x65')]();_0x16c109[_0x5b8b('0x21')](_0x5b8b('0x66'));_0x16c109=applyJoinClauses(_0x16c109,!![]);_0x4e86f7[_0x5b8b('0x56')](_0x5b8b('0x53'));var _0x2ed200=utils['getSelectedTags'](_0x309006);if(!_[_0x5b8b('0x67')](_0x2ed200)){_0x16c109[_0x5b8b('0xd')]('t.id\x20IN\x20?',_0x2ed200);}var _0x793ec5={'type':db[_0x5b8b('0x60')][_0x5b8b('0x61')][_0x5b8b('0x68')],'raw':!![]};return db[_0x5b8b('0x62')][_0x5b8b('0x69')](_0x16c109[_0x5b8b('0x63')](),_0x793ec5)[_0x5b8b('0x4d')](function(_0x4da999){return _0x4da999[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x1eb7=['keyBy','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','COUNT(*)','isEmpty','Sequelize','query','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','datetime','castTo','DATE','type','default','value','start','end','Tag','map','tags','clause','User','user','and','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','findAll'];(function(_0x51d7b6,_0x3be752){var _0x3c04e4=function(_0x3ba670){while(--_0x3ba670){_0x51d7b6['push'](_0x51d7b6['shift']());}};_0x3c04e4(++_0x3be752);}(_0x1eb7,0x14a));var _0x71eb=function(_0x3d6bb0,_0x344f8b){_0x3d6bb0=_0x3d6bb0-0x0;var _0x1ac8b5=_0x1eb7[_0x3d6bb0];return _0x1ac8b5;};'use strict';var _=require('lodash');var squel=require(_0x71eb('0x0'));var as=require(_0x71eb('0x1'));var qs=require(_0x71eb('0x2'));var utils=require(_0x71eb('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x430ca7,_0x597253){var _0x178405=![];if(_0x430ca7[_0x71eb('0x4')]==='agent'&&!_0x597253[_0x71eb('0x5')]&&!_0x597253[_0x71eb('0x6')]&&_0x597253[_0x71eb('0x7')]!==_0x71eb('0x8')){_0x178405=!![];}return _0x178405;}function getContactsSubquery(){return squel['select']()[_0x71eb('0x9')](_0x71eb('0xa'),'c')[_0x71eb('0xb')](_0x71eb('0xc'));}function applyJoinClauses(_0x4d7199,_0x3181c4){var _0x16482c=_0x3181c4?'c':_0x71eb('0xd');_0x4d7199[_0x71eb('0xe')]('cm_user_has_contacts','uc',_0x71eb('0xf')+_0x16482c+_0x71eb('0x10'))['left_join'](_0x71eb('0x11'),'ct',_0x71eb('0x12')+_0x16482c+_0x71eb('0x10'))[_0x71eb('0xe')](_0x71eb('0x13'),'t',_0x71eb('0x14'));return _0x4d7199;}function addFieldsToQuery(_0x403619,_0x19cdcf,_0x2d8e26,_0x465543,_0x4dc2f){var _0x4cb863=_0x4dc2f?'c':_0x71eb('0xd');if(!_0x19cdcf){_0x19cdcf=['id',_0x71eb('0x15'),_0x71eb('0x16'),_0x71eb('0x17'),_0x71eb('0x18'),_0x71eb('0x19'),_0x71eb('0x1a'),_0x71eb('0x6'),_0x71eb('0x1b'),'createdAt','updatedAt',_0x71eb('0x1c'),_0x71eb('0x1d')];}else if(!_0x19cdcf[_0x71eb('0x1e')]('id')){_0x19cdcf[_0x71eb('0x1f')]('id');}var _0x2d8d86=_0x2d8e26&&_0x4dc2f||!_0x2d8e26&&!_0x4dc2f;if(_0x465543){_0x2d8d86=_0x465543&&_0x4dc2f||!_0x465543&&!_0x4dc2f;}_0x19cdcf[_0x71eb('0x20')](function(_0xe28e50){if(_0xe28e50===_0x71eb('0x1d')){if(_0x2d8d86){_0x403619[_0x71eb('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe28e50);}else if(_0x2d8e26||_0x465543){_0x403619[_0x71eb('0x21')](_0x4cb863+'.'+_0xe28e50);}}else{_0x403619['field'](_0x4cb863+'.'+_0xe28e50);}});return _0x403619;}function getSqlClauses(){var _0x1e3801={'default':squel[_0x71eb('0x22')](),'fields':squel[_0x71eb('0x22')](),'filter':squel[_0x71eb('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x71eb('0x22')](),'skip':![]}};return _0x1e3801;}function parseTagParameter(_0x3dad17){var _0x823cc1=squel[_0x71eb('0x22')]();if(_0x3dad17){var _0x2b5341=utils[_0x71eb('0x23')](_0x3dad17);_0x2b5341[_0x71eb('0x20')](function(_0x2e9ac9){_0x823cc1['or'](_0x71eb('0x24'),'%,'+_0x2e9ac9+',%');});}return _0x823cc1;}function parseSearchFilter(_0x2d2860){var _0x5c05b2=squel[_0x71eb('0x22')]();if(_0x2d2860){var _0x1d4b96=_0x2d2860[_0x71eb('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1d4b96[_0x71eb('0x26')]('\x20')[_0x71eb('0x27')]>0x1){_0x5c05b2['or'](_0x71eb('0x28'),qs[_0x71eb('0x29')](_0x1d4b96),null);}else{if(qs[_0x71eb('0x2a')](_0x1d4b96)){_0x5c05b2['or'](_0x71eb('0x2b'),_0x1d4b96+'%');_0x5c05b2['or']('c.phone\x20LIKE\x20?',_0x1d4b96+'%');_0x5c05b2['or']('c.mobile\x20LIKE\x20?',_0x1d4b96+'%');_0x5c05b2['or'](_0x71eb('0x2c'),_0x1d4b96+'%');}else if(qs[_0x71eb('0x2d')](_0x1d4b96)){_0x5c05b2['or'](_0x71eb('0x2e'),_0x1d4b96+'%');}else{_0x5c05b2['or'](_0x71eb('0x2f'),'%'+_0x1d4b96+'%');_0x5c05b2['or'](_0x71eb('0x30'),'%'+_0x1d4b96+'%');_0x5c05b2['or']('c.email\x20LIKE\x20?','%'+_0x1d4b96+'%');}}}return _0x5c05b2;}function parseAdvancedSearchFilter(_0x3c4489,_0x51bc37){var _0x1b075b=getSqlClauses();var _0x3d2162=as['parseSearch'](_0x3c4489);var _0x3a50b8=_0x3d2162[_0x71eb('0x31')];for(var _0x101295=0x0;_0x101295<_0x3d2162[_0x71eb('0x32')]['length'];_0x101295++){var _0x5001f8=_0x3d2162[_0x71eb('0x32')][_0x101295];var _0x5458d3='c';var _0x181a94=_[_0x71eb('0x33')](_0x51bc37,[_0x71eb('0x34'),_0x5001f8[_0x71eb('0x21')]]);if(_0x181a94){if(_0x5001f8[_0x71eb('0x21')]==='dateOfBirth'||_0x181a94['fieldType']===_0x71eb('0x35')){_0x5001f8[_0x71eb('0x36')]=_0x71eb('0x37');}var _0x2c8b78=as['buildExpression'](_0x5458d3,_0x181a94[_0x71eb('0x38')],_0x5001f8);_0x1b075b[_0x71eb('0x39')][_0x3a50b8](_0x2c8b78['text'],_0x2c8b78[_0x71eb('0x3a')][_0x71eb('0x3b')],_0x2c8b78[_0x71eb('0x3a')][_0x71eb('0x3c')]);}else{if(_0x5001f8['field']===_0x71eb('0x3d')){var _0x5923f1=_0x5001f8[_0x71eb('0x3a')][_0x71eb('0x26')](',')[_0x71eb('0x3e')](function(_0x5ad858){return Number(_0x5ad858);});var _0xe6e0b9=parseTagParameter(_0x5923f1);_0x1b075b[_0x71eb('0x3f')][_0x71eb('0x40')]['and'](_0xe6e0b9);_0x1b075b[_0x71eb('0x3f')]['ids']=_0x5923f1;}else if(_0x5001f8[_0x71eb('0x21')]===_0x71eb('0x41')){_0x1b075b[_0x71eb('0x42')][_0x71eb('0x40')][_0x71eb('0x43')]('uc.UserId\x20=\x20?',_0x5001f8['value']);_0x1b075b[_0x71eb('0x42')][_0x71eb('0x44')]=!![];}}}return _0x1b075b;}function parseModelFields(_0x3a978d,_0x54b241){var _0x552121=squel[_0x71eb('0x22')]();var _0x156d18=_(_0x3a978d)[_0x71eb('0x45')]()[_0x71eb('0x3e')](function(_0x2d50f0){return _[_0x71eb('0x46')](_0x54b241,['name',_0x2d50f0])?_0x2d50f0:undefined;})[_0x71eb('0x47')]()[_0x71eb('0x3a')]();if(_0x3a978d[_0x71eb('0x48')]){_0x156d18[_0x71eb('0x1f')](_0x71eb('0x48'));}if(_0x156d18[_0x71eb('0x27')]>0x0){_0x156d18[_0x71eb('0x20')](function(_0x2dcef0){if(_0x2dcef0==='ListId'){_0x552121[_0x71eb('0x43')](_0x71eb('0x49'),[][_0x71eb('0x4a')](_0x3a978d[_0x2dcef0]));}else if(_0x2dcef0===_0x71eb('0x48')){var _0x35c9ce='%'+_0x3a978d[_0x2dcef0]+'%';_0x552121['and'](_0x71eb('0x4b'),_0x35c9ce);}else{_0x552121[_0x71eb('0x43')]('c.'+_0x2dcef0+_0x71eb('0x4c'),_0x3a978d[_0x2dcef0]);}});}return _0x552121;}function parseQueryParameters(_0xe5ab75,_0x38accd){var _0x112f0f=getSqlClauses();return Promise[_0x71eb('0x4d')]()[_0x71eb('0x4e')](function(){return parseModelFields(_0xe5ab75,_0x38accd);})[_0x71eb('0x4e')](function(_0xe834c1){_0x112f0f['fields']['and'](_0xe834c1);return parseTagParameter(_0xe5ab75[_0x71eb('0x4f')]);})[_0x71eb('0x4e')](function(_0x37dd71){_0x112f0f['tags']['clause']['and'](_0x37dd71);return parseSearchFilter(_0xe5ab75[_0x71eb('0x50')]);})[_0x71eb('0x4e')](function(_0x5b3b0b){_0x112f0f[_0x71eb('0x50')]=_0x5b3b0b;return _0x112f0f;});}function checkListsRestrictions(_0x57b0e6,_0x176d28,_0x1e7d10){var _0x141948=squel['expr']();return Promise['resolve']()[_0x71eb('0x4e')](function(){if(_0x176d28[_0x71eb('0x5')]&&_0x57b0e6[_0x71eb('0x4')]===_0x71eb('0x51')&&!_0x1e7d10){return _0x57b0e6[_0x71eb('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x8a4cc6){if(_0x8a4cc6){if(_0x8a4cc6['length']===0x0){_0x141948[_0x71eb('0x43')](_0x71eb('0x53'));}else{_0x141948[_0x71eb('0x43')](_0x71eb('0x49'),_[_0x71eb('0x3e')](_0x8a4cc6,'id'));}}})[_0x71eb('0x4e')](function(){return _0x141948;});}function buildContactsQuery(_0x28d833,_0x37cea4,_0x3bfb9d,_0x7a3c28,_0x39c034,_0x3ba36f){if(_0x37cea4){_0x37cea4=_0x3bfb9d['attributes'];}_0x28d833=addFieldsToQuery(_0x28d833,_0x37cea4,_0x7a3c28,_0x3ba36f,!![]);var _0x58697b=squel['select']();_0x58697b=addFieldsToQuery(_0x58697b,_0x37cea4,_0x7a3c28,_0x3ba36f,![]);if(_0x7a3c28||_0x3ba36f){_0x28d833=applyJoinClauses(_0x28d833,!![]);_0x28d833[_0x71eb('0x54')](_0x71eb('0x55'));if(_0x3bfb9d[_0x71eb('0x56')]){_0x58697b['limit'](_0x3bfb9d[_0x71eb('0x56')]);}if(_0x3bfb9d['offset']){_0x58697b['offset'](_0x3bfb9d[_0x71eb('0x57')]);}}else{_0x58697b=applyJoinClauses(_0x58697b,![]);_0x58697b[_0x71eb('0x54')](_0x71eb('0x58'));if(_0x3bfb9d[_0x71eb('0x56')]){_0x28d833['limit'](_0x3bfb9d[_0x71eb('0x56')]);}if(_0x3bfb9d[_0x71eb('0x57')]){_0x28d833['offset'](_0x3bfb9d[_0x71eb('0x57')]);}}_0x58697b[_0x71eb('0x59')](_0x39c034);if(_0x3bfb9d['order']){_0x3bfb9d[_0x71eb('0x5a')]['forEach'](function(_0x55f83c){_0x28d833[_0x71eb('0x5a')]('c.'+_0x55f83c[0x0],_0x55f83c[0x1]==='DESC'?![]:!![]);_0x58697b['order'](_0x71eb('0x5b')+_0x55f83c[0x0],_0x55f83c[0x1]===_0x71eb('0x5c')?![]:!![]);});}_0x58697b[_0x71eb('0x9')](_0x28d833,'subqry');return _0x58697b;}function getFilteredContacts(_0x24ebf3){var _0x234ae3=[];return db[_0x71eb('0x3d')][_0x71eb('0x5d')]({'attributes':['id',_0x71eb('0x34'),'color'],'raw':!![]})[_0x71eb('0x4e')](function(_0x4f52f6){_0x234ae3=_[_0x71eb('0x5e')](_0x4f52f6,'id');var _0x3a6985={'type':db['Sequelize'][_0x71eb('0x5f')][_0x71eb('0x60')],'model':db[_0x71eb('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x71eb('0x62')]['query'](_0x24ebf3[_0x71eb('0x63')](),_0x3a6985);})[_0x71eb('0x4e')](function(_0x4e1106){_0x4e1106[_0x71eb('0x20')](function(_0x454806){if(_0x454806[_0x71eb('0x1d')]){_0x454806['Tags']=[];_0x454806[_0x71eb('0x1d')][_0x71eb('0x26')](',')['forEach'](function(_0x1c798f){_0x454806[_0x71eb('0x64')][_0x71eb('0x1f')](_0x234ae3[_0x1c798f]);});}delete _0x454806[_0x71eb('0x1d')];});return _0x4e1106;});}function countFilteredContacts(_0x2eb6fd,_0x537184){var _0x200373=_0x2eb6fd['clone']();_0x200373[_0x71eb('0x21')](_0x71eb('0x65'));_0x200373=applyJoinClauses(_0x200373,!![]);_0x2eb6fd[_0x71eb('0x54')]('c.id');var _0x563961=utils[_0x71eb('0x23')](_0x537184);if(!_[_0x71eb('0x66')](_0x563961)){_0x200373[_0x71eb('0xb')]('t.id\x20IN\x20?',_0x563961);}var _0x582a5f={'type':db[_0x71eb('0x67')][_0x71eb('0x5f')][_0x71eb('0x60')],'raw':!![]};return db[_0x71eb('0x62')][_0x71eb('0x68')](_0x200373['toString'](),_0x582a5f)[_0x71eb('0x4e')](function(_0x595e5a){return _0x595e5a[0x0][_0x71eb('0x65')];});}module[_0x71eb('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b42974e..975af6e 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 _0xbd04=['encryptString','secret','update','utf8','base64','decryptString','final','crypto','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createCipher','data','write','end','binary','unlink','decryptFile','createWriteStream','createDecipher'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbd04,0x130));var _0x4bd0=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xbd04[_0xc6be3a];return _0x56a310;};'use strict';var crypto=require(_0x4bd0('0x0'));var fs=require('fs');var BPromise=require(_0x4bd0('0x1'));var _=require(_0x4bd0('0x2'));var config=require(_0x4bd0('0x3'));var logger=require('../../config/logger')(_0x4bd0('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4bd0('0x5')]['session'],'algorithm':_0x4bd0('0x6')};const fileOptions={'algorithm':_0x4bd0('0x7')};if(config[_0x4bd0('0x8')]&&config[_0x4bd0('0x8')][_0x4bd0('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x4bd0('0x9')]=config[_0x4bd0('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x4bd0('0xa')](config['encrypt']['algorithm'],_0x4bd0('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x300624){return AES_SUPPORTED_RX[_0x4bd0('0xc')](_0x300624);}function getSupportedCiphers(){return crypto[_0x4bd0('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1decf2){return getSupportedCiphers()[_0x4bd0('0xe')](_0x1decf2)>-0x1;}function combineOptions(_0x5625df){var _0x253c8b={};for(var _0x4b2a89 in fileOptions){if(fileOptions['hasOwnProperty'](_0x4b2a89)){_0x253c8b[_0x4b2a89]=fileOptions[_0x4b2a89];}}if(_0x5625df){for(var _0x595b85 in _0x5625df){if(_0x5625df[_0x4bd0('0xf')](_0x595b85)){_0x253c8b[_0x595b85]=_0x5625df[_0x595b85];}}}return _0x253c8b;}exports[_0x4bd0('0x10')]=function(_0x2160bf,_0x1460ed,_0x31b38a,_0x46c763){return new BPromise(function(_0x243080,_0x5e61f5){_0x46c763=combineOptions(_0x46c763);var _0x527110=new Buffer(_0x31b38a);var _0x530307=fs['createReadStream'](_0x2160bf);var _0x540acb=fs['createWriteStream'](_0x1460ed);var _0x414e09=crypto[_0x4bd0('0x11')](_0x46c763[_0x4bd0('0x9')],_0x527110);_0x530307['on'](_0x4bd0('0x12'),function(_0x337728){var _0x5d34ec=new Buffer(_0x414e09['update'](_0x337728),'binary');_0x540acb[_0x4bd0('0x13')](_0x5d34ec);});_0x530307['on'](_0x4bd0('0x14'),function(){try{var _0x3cec09=new Buffer(_0x414e09['final'](_0x4bd0('0x15')),_0x4bd0('0x15'));_0x540acb[_0x4bd0('0x13')](_0x3cec09);_0x540acb[_0x4bd0('0x14')]();_0x540acb['on']('close',function(){return _0x243080(_0x1460ed);});}catch(_0x309279){fs[_0x4bd0('0x16')](_0x1460ed);return _0x5e61f5(_0x309279);}});});};exports[_0x4bd0('0x17')]=function(_0x123f7e,_0x568973,_0x453e8d,_0x1a7879){return new BPromise(function(_0x126642,_0x365f98){_0x1a7879=combineOptions(_0x1a7879);var _0x60894=new Buffer(_0x453e8d);var _0x10ecdc=fs['createReadStream'](_0x123f7e);var _0x2ccd07=fs[_0x4bd0('0x18')](_0x568973);var _0x493506=crypto[_0x4bd0('0x19')](_0x1a7879[_0x4bd0('0x9')],_0x60894);_0x10ecdc['on'](_0x4bd0('0x12'),function(_0x3e6b0c){var _0x32a523=new Buffer(_0x493506['update'](_0x3e6b0c),'binary');_0x2ccd07[_0x4bd0('0x13')](_0x32a523);});_0x10ecdc['on']('end',function(){try{var _0x2fc5f0=new Buffer(_0x493506['final'](_0x4bd0('0x15')),'binary');_0x2ccd07[_0x4bd0('0x13')](_0x2fc5f0);_0x2ccd07[_0x4bd0('0x14')]();_0x2ccd07['on']('close',function(){return _0x126642(_0x568973);});}catch(_0x32dc89){fs[_0x4bd0('0x16')](_0x568973);return _0x365f98(_0x32dc89);}});});};exports[_0x4bd0('0x1a')]=function(_0x1f96f2,_0x4ed31d,_0x14fc8f){var _0x1bc450=_0x14fc8f||stringOptions['algorithm'];var _0x37d236=_0x4ed31d||stringOptions[_0x4bd0('0x1b')];var _0x121a8e=crypto[_0x4bd0('0x11')](_0x1bc450,_0x37d236);var _0x196663=_0x121a8e[_0x4bd0('0x1c')](_0x1f96f2,_0x4bd0('0x1d'),_0x4bd0('0x1e'));_0x196663+=_0x121a8e['final']('base64');return _0x196663;};exports[_0x4bd0('0x1f')]=function(_0x53fd59,_0x1ddf6a,_0x3e9c32){var _0x5df1a1=_0x3e9c32||stringOptions['algorithm'];var _0x307458=_0x1ddf6a||stringOptions[_0x4bd0('0x1b')];var _0x2bbdac=crypto[_0x4bd0('0x19')](_0x5df1a1,_0x307458);var _0x34c7d3=_0x2bbdac['update'](_0x53fd59,'base64',_0x4bd0('0x1d'));_0x34c7d3+=_0x2bbdac[_0x4bd0('0x20')](_0x4bd0('0x1d'));return _0x34c7d3;}; \ No newline at end of file +var _0x0f98=['createDecipher','data','close','unlink','encryptString','secret','utf8','decryptString','base64','crypto','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','end','final','write','decryptFile'];(function(_0x3b138b,_0x292247){var _0x2e67a9=function(_0x4c5cdb){while(--_0x4c5cdb){_0x3b138b['push'](_0x3b138b['shift']());}};_0x2e67a9(++_0x292247);}(_0x0f98,0xae));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x80f9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x80f9('0x1'));var config=require(_0x80f9('0x2'));var logger=require('../../config/logger')(_0x80f9('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x80f9('0x4')]['session'],'algorithm':_0x80f9('0x5')};const fileOptions={'algorithm':_0x80f9('0x6')};if(config[_0x80f9('0x7')]&&config[_0x80f9('0x7')][_0x80f9('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x80f9('0x8')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x80f9('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x80f9('0x7')]['algorithm'],_0x80f9('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0xa7a5bc){return AES_SUPPORTED_RX[_0x80f9('0xa')](_0xa7a5bc);}function getSupportedCiphers(){return crypto[_0x80f9('0xb')]()[_0x80f9('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x24d1e7){return getSupportedCiphers()['indexOf'](_0x24d1e7)>-0x1;}function combineOptions(_0x180af5){var _0x38f9a9={};for(var _0x189ed2 in fileOptions){if(fileOptions[_0x80f9('0xd')](_0x189ed2)){_0x38f9a9[_0x189ed2]=fileOptions[_0x189ed2];}}if(_0x180af5){for(var _0x457ada in _0x180af5){if(_0x180af5[_0x80f9('0xd')](_0x457ada)){_0x38f9a9[_0x457ada]=_0x180af5[_0x457ada];}}}return _0x38f9a9;}exports[_0x80f9('0xe')]=function(_0x199494,_0x34b522,_0xf67313,_0x596d89){return new BPromise(function(_0x3921a2,_0x33110f){_0x596d89=combineOptions(_0x596d89);var _0x5acb35=new Buffer(_0xf67313);var _0x33b1ec=fs[_0x80f9('0xf')](_0x199494);var _0x15c43a=fs[_0x80f9('0x10')](_0x34b522);var _0x2886a7=crypto[_0x80f9('0x11')](_0x596d89[_0x80f9('0x8')],_0x5acb35);_0x33b1ec['on']('data',function(_0x592fb3){var _0xaf87c8=new Buffer(_0x2886a7[_0x80f9('0x12')](_0x592fb3),_0x80f9('0x13'));_0x15c43a['write'](_0xaf87c8);});_0x33b1ec['on'](_0x80f9('0x14'),function(){try{var _0x300970=new Buffer(_0x2886a7[_0x80f9('0x15')](_0x80f9('0x13')),'binary');_0x15c43a[_0x80f9('0x16')](_0x300970);_0x15c43a[_0x80f9('0x14')]();_0x15c43a['on']('close',function(){return _0x3921a2(_0x34b522);});}catch(_0x3a8b39){fs['unlink'](_0x34b522);return _0x33110f(_0x3a8b39);}});});};exports[_0x80f9('0x17')]=function(_0x11cdf7,_0x2b57e4,_0x299261,_0x127d02){return new BPromise(function(_0x168950,_0x4f7a4c){_0x127d02=combineOptions(_0x127d02);var _0x26d6dc=new Buffer(_0x299261);var _0x17fe4f=fs['createReadStream'](_0x11cdf7);var _0x4cebda=fs[_0x80f9('0x10')](_0x2b57e4);var _0x33efbf=crypto[_0x80f9('0x18')](_0x127d02[_0x80f9('0x8')],_0x26d6dc);_0x17fe4f['on'](_0x80f9('0x19'),function(_0x136e63){var _0x3fe829=new Buffer(_0x33efbf[_0x80f9('0x12')](_0x136e63),_0x80f9('0x13'));_0x4cebda[_0x80f9('0x16')](_0x3fe829);});_0x17fe4f['on']('end',function(){try{var _0x9fc964=new Buffer(_0x33efbf[_0x80f9('0x15')]('binary'),_0x80f9('0x13'));_0x4cebda[_0x80f9('0x16')](_0x9fc964);_0x4cebda[_0x80f9('0x14')]();_0x4cebda['on'](_0x80f9('0x1a'),function(){return _0x168950(_0x2b57e4);});}catch(_0x478d03){fs[_0x80f9('0x1b')](_0x2b57e4);return _0x4f7a4c(_0x478d03);}});});};exports[_0x80f9('0x1c')]=function(_0x138d85,_0x5880f4,_0x460eb7){var _0x2da8f5=_0x460eb7||stringOptions['algorithm'];var _0x3276af=_0x5880f4||stringOptions[_0x80f9('0x1d')];var _0x518a92=crypto[_0x80f9('0x11')](_0x2da8f5,_0x3276af);var _0xf1d20b=_0x518a92[_0x80f9('0x12')](_0x138d85,_0x80f9('0x1e'),'base64');_0xf1d20b+=_0x518a92[_0x80f9('0x15')]('base64');return _0xf1d20b;};exports[_0x80f9('0x1f')]=function(_0x244ce5,_0x41879b,_0x1acdce){var _0x49bf9a=_0x1acdce||stringOptions[_0x80f9('0x8')];var _0x2e2eaa=_0x41879b||stringOptions[_0x80f9('0x1d')];var _0xf0ee9c=crypto[_0x80f9('0x18')](_0x49bf9a,_0x2e2eaa);var _0x5d26cf=_0xf0ee9c[_0x80f9('0x12')](_0x244ce5,_0x80f9('0x20'),_0x80f9('0x1e'));_0x5d26cf+=_0xf0ee9c['final']('utf8');return _0x5d26cf;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 29b024b..09f979b 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 _0x2620=['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','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x2620,0x1e8));var _0x0262=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x2620[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x0262('0x0'));var path=require('path');var _=require(_0x0262('0x1'));var csv=require(_0x0262('0x2'));var fs=require('fs');var BPromise=require(_0x0262('0x3'));var zipdir=require(_0x0262('0x4'));var rimraf=require('rimraf');var db=require(_0x0262('0x5'))['db'];var dbH=require(_0x0262('0x5'))[_0x0262('0x6')];var logger=require(_0x0262('0x7'))(_0x0262('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0262('0x9')][0x2]);var QUERY=process[_0x0262('0x9')][0x3];var PATH=process[_0x0262('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c4706,_0x35391a){var _0x108876={'status':_0x5c4706};var _0x440028={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35391a){_0x108876[_0x0262('0xa')]=_0x35391a;}return db['AnalyticExtractedReport']['update'](_0x108876,_0x440028);}function main(){var _0x153ba0=0x1388;var _0x4cb253;logger[_0x0262('0xb')](util['format'](_0x0262('0xc'),EXTRACTED_REPORT_ID,_0x0262('0xd')));return db[_0x0262('0xe')][_0x0262('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0262('0x10'),_0x0262('0x11')]})[_0x0262('0x12')](function(_0x1f76bc){if(_0x1f76bc){_0x4cb253=_0x1f76bc;_0x153ba0=_0x4cb253[_0x0262('0x11')]||0x1388;}})['then'](function(){return dbH[_0x0262('0x13')][_0x0262('0x14')](util[_0x0262('0x15')](_0x0262('0x16'),QUERY),{'type':dbH[_0x0262('0x13')]['QueryTypes'][_0x0262('0x17')]});})[_0x0262('0x12')](function(_0x337375){if(!_0x337375[0x0][_0x0262('0x18')]){return analyticExtractedReport('Empty');}var _0x1eccca=[];var _0x4b5e06=0x0;if(_0x4cb253['split']){if(_0x337375&&_0x337375[_0x0262('0x19')]){var _0x29ac23=_[_0x0262('0x1a')](_0x337375[0x0][_0x0262('0x18')]/_0x153ba0);var _0x45ae0a=Number[_0x0262('0x1b')](_0x337375[0x0]['num']/_0x153ba0)?_0x337375[0x0][_0x0262('0x18')]%_0x153ba0:0x0;_0x29ac23[_0x0262('0x1c')](function(_0x57cad3){if(_0x57cad3>0x0){_0x4b5e06+=_0x153ba0;}_0x1eccca[_0x0262('0x1d')](dbH[_0x0262('0x13')]['query'](util[_0x0262('0x15')](_0x0262('0x1e'),QUERY,_0x153ba0,_0x4b5e06),{'type':dbH[_0x0262('0x13')][_0x0262('0x1f')][_0x0262('0x17')]}));});if(_0x45ae0a>0x0){_0x4b5e06+=_0x153ba0;_0x1eccca['push'](dbH['sequelize'][_0x0262('0x14')](util[_0x0262('0x15')](_0x0262('0x1e'),QUERY,_0x45ae0a,_0x4b5e06),{'type':dbH['sequelize']['QueryTypes'][_0x0262('0x17')]}));}}}else{_0x1eccca['push'](dbH[_0x0262('0x13')][_0x0262('0x14')](QUERY,{'type':dbH[_0x0262('0x13')][_0x0262('0x1f')][_0x0262('0x17')]}));}var _0x5a3b5f=path['dirname'](PATH);var _0x27ea98=path['basename'](PATH,_0x0262('0x20'));var _0x1e148f=_0x4cb253['split']&&_0x1eccca[_0x0262('0x19')]>0x1;var _0x26088c=[];if(!fs[_0x0262('0x21')](path[_0x0262('0x22')](_0x5a3b5f,_0x27ea98))&&_0x1e148f){fs[_0x0262('0x23')](path[_0x0262('0x22')](_0x5a3b5f,_0x27ea98));}return BPromise[_0x0262('0x24')](_0x1eccca,function(_0x3e9104){_0x26088c[_0x0262('0x1d')](_0x3e9104);})[_0x0262('0x12')](function(){for(var _0x25f528=0x0;_0x25f528<_0x26088c['length'];_0x25f528+=0x1){var _0xbd6ef1;var _0x29bb2f=_0x26088c[_0x25f528];if(_0x1e148f){_0xbd6ef1=path[_0x0262('0x22')](_0x5a3b5f,_0x27ea98,util['format'](_0x0262('0x25'),_0x27ea98,_0x25f528,'csv'));}else{_0xbd6ef1=path['join'](_0x5a3b5f,util[_0x0262('0x15')](_0x0262('0x26'),_0x27ea98,'csv'));}fs[_0x0262('0x27')](_0xbd6ef1,csv(_0x29bb2f));}})[_0x0262('0x12')](function(){if(_0x1e148f){return new Promise(function(_0x16eec3){zipdir(path[_0x0262('0x22')](_0x5a3b5f,_0x27ea98),{'saveTo':path[_0x0262('0x22')](_0x5a3b5f,util[_0x0262('0x15')](_0x0262('0x26'),_0x27ea98,_0x0262('0x28')))},function(_0x4441e4,_0x20fd3a){rimraf(path[_0x0262('0x22')](_0x5a3b5f,_0x27ea98),function(){});_0x16eec3(_0x0262('0x29'));});});}})['then'](function(){logger[_0x0262('0xb')](util[_0x0262('0x15')](_0x0262('0x2a'),EXTRACTED_REPORT_ID,_0x0262('0xd')));return analyticExtractedReport('Completed',_0x1e148f?util[_0x0262('0x15')](_0x0262('0x26'),_0x27ea98,_0x1e148f?'zip':_0x0262('0x2b')):null);});})[_0x0262('0x2c')](function(_0x4c6e96){logger[_0x0262('0xb')](util[_0x0262('0x15')](_0x0262('0x2d'),EXTRACTED_REPORT_ID,_0x0262('0xd')),util[_0x0262('0x2e')](_0x4c6e96,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0262('0x2f'));})[_0x0262('0x30')](function(){process[_0x0262('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd15c=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format'];(function(_0x5dec42,_0x164a15){var _0x794b12=function(_0x1d85c9){while(--_0x1d85c9){_0x5dec42['push'](_0x5dec42['shift']());}};_0x794b12(++_0x164a15);}(_0xd15c,0x14f));var _0xcd15=function(_0x443e83,_0x456f54){_0x443e83=_0x443e83-0x0;var _0x35e701=_0xd15c[_0x443e83];return _0x35e701;};'use strict';var util=require(_0xcd15('0x0'));var path=require(_0xcd15('0x1'));var _=require(_0xcd15('0x2'));var csv=require(_0xcd15('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xcd15('0x4'));var db=require(_0xcd15('0x5'))['db'];var dbH=require('../../mysqldb')[_0xcd15('0x6')];var logger=require(_0xcd15('0x7'))(_0xcd15('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xcd15('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcd15('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xb1686c,_0x36405d){var _0x370cd6={'status':_0xb1686c};var _0x58182e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x36405d){_0x370cd6[_0xcd15('0xa')]=_0x36405d;}return db[_0xcd15('0xb')][_0xcd15('0xc')](_0x370cd6,_0x58182e);}function main(){var _0x4b2b34=0x1388;var _0x139f4d;logger[_0xcd15('0xd')](util[_0xcd15('0xe')](_0xcd15('0xf'),EXTRACTED_REPORT_ID,_0xcd15('0x10')));return db[_0xcd15('0x11')][_0xcd15('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcd15('0x13'),_0xcd15('0x14')]})['then'](function(_0x32b33e){if(_0x32b33e){_0x139f4d=_0x32b33e;_0x4b2b34=_0x139f4d[_0xcd15('0x14')]||0x1388;}})[_0xcd15('0x15')](function(){return dbH[_0xcd15('0x16')]['query'](util['format'](_0xcd15('0x17'),QUERY),{'type':dbH[_0xcd15('0x16')][_0xcd15('0x18')][_0xcd15('0x19')]});})[_0xcd15('0x15')](function(_0xc929fa){if(!_0xc929fa[0x0][_0xcd15('0x1a')]){return analyticExtractedReport(_0xcd15('0x1b'));}var _0xe683f2=[];var _0x752782=0x0;if(_0x139f4d[_0xcd15('0x13')]){if(_0xc929fa&&_0xc929fa[_0xcd15('0x1c')]){var _0x57b196=_['range'](_0xc929fa[0x0][_0xcd15('0x1a')]/_0x4b2b34);var _0x1b54eb=Number[_0xcd15('0x1d')](_0xc929fa[0x0][_0xcd15('0x1a')]/_0x4b2b34)?_0xc929fa[0x0][_0xcd15('0x1a')]%_0x4b2b34:0x0;_0x57b196[_0xcd15('0x1e')](function(_0x3361b7){if(_0x3361b7>0x0){_0x752782+=_0x4b2b34;}_0xe683f2[_0xcd15('0x1f')](dbH[_0xcd15('0x16')]['query'](util[_0xcd15('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b2b34,_0x752782),{'type':dbH[_0xcd15('0x16')][_0xcd15('0x18')][_0xcd15('0x19')]}));});if(_0x1b54eb>0x0){_0x752782+=_0x4b2b34;_0xe683f2[_0xcd15('0x1f')](dbH['sequelize'][_0xcd15('0x20')](util[_0xcd15('0xe')](_0xcd15('0x21'),QUERY,_0x1b54eb,_0x752782),{'type':dbH[_0xcd15('0x16')][_0xcd15('0x18')][_0xcd15('0x19')]}));}}}else{_0xe683f2['push'](dbH['sequelize'][_0xcd15('0x20')](QUERY,{'type':dbH[_0xcd15('0x16')]['QueryTypes'][_0xcd15('0x19')]}));}var _0x436e3f=path['dirname'](PATH);var _0x2f48ba=path[_0xcd15('0x22')](PATH,_0xcd15('0x23'));var _0x4ac9fd=_0x139f4d['split']&&_0xe683f2[_0xcd15('0x1c')]>0x1;var _0x299bf2=[];if(!fs[_0xcd15('0x24')](path[_0xcd15('0x25')](_0x436e3f,_0x2f48ba))&&_0x4ac9fd){fs[_0xcd15('0x26')](path[_0xcd15('0x25')](_0x436e3f,_0x2f48ba));}return BPromise['each'](_0xe683f2,function(_0x4ca87e){_0x299bf2[_0xcd15('0x1f')](_0x4ca87e);})['then'](function(){for(var _0x4d800f=0x0;_0x4d800f<_0x299bf2['length'];_0x4d800f+=0x1){var _0x159f43;var _0x17d27c=_0x299bf2[_0x4d800f];if(_0x4ac9fd){_0x159f43=path[_0xcd15('0x25')](_0x436e3f,_0x2f48ba,util[_0xcd15('0xe')](_0xcd15('0x27'),_0x2f48ba,_0x4d800f,_0xcd15('0x28')));}else{_0x159f43=path[_0xcd15('0x25')](_0x436e3f,util[_0xcd15('0xe')](_0xcd15('0x29'),_0x2f48ba,_0xcd15('0x28')));}fs[_0xcd15('0x2a')](_0x159f43,csv(_0x17d27c));}})['then'](function(){if(_0x4ac9fd){return new Promise(function(_0x3bb33e){zipdir(path[_0xcd15('0x25')](_0x436e3f,_0x2f48ba),{'saveTo':path[_0xcd15('0x25')](_0x436e3f,util['format'](_0xcd15('0x29'),_0x2f48ba,_0xcd15('0x2b')))},function(_0x1f801d,_0x361111){rimraf(path[_0xcd15('0x25')](_0x436e3f,_0x2f48ba),function(){});_0x3bb33e('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0xcd15('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xcd15('0x10')));return analyticExtractedReport(_0xcd15('0x2c'),_0x4ac9fd?util[_0xcd15('0xe')]('%s.%s',_0x2f48ba,_0x4ac9fd?'zip':'csv'):null);});})['catch'](function(_0x2e0a03){logger[_0xcd15('0xd')](util[_0xcd15('0xe')](_0xcd15('0x2d'),EXTRACTED_REPORT_ID,_0xcd15('0x10')),util[_0xcd15('0x2e')](_0x2e0a03,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcd15('0x2f'));})[_0xcd15('0x30')](function(){process[_0xcd15('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f52e9d1..1ca6be7 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 _0xdf63=['keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','pageBreak','before','margin','toString','\x20/\x20','black','Empty','Setting','find','split','splitSizePdf','then','range','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','.pdf','join','mkdirSync','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','%s\x20#%d','channel','Arial','center','Interaction\x20Transcript','header','footer','pipe','createWriteStream','finish','createPdfFromHTML','catch','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','value','fill','length','auto','body','push','concat','chunk'];(function(_0x5183aa,_0x54277c){var _0x73ac67=function(_0x14759c){while(--_0x14759c){_0x5183aa['push'](_0x5183aa['shift']());}};_0x73ac67(++_0x54277c);}(_0xdf63,0x84));var _0x3df6=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0xdf63[_0x5b3950];return _0x41e436;};'use strict';var _=require(_0x3df6('0x0'));var fs=require('fs');var util=require(_0x3df6('0x1'));var path=require(_0x3df6('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x3df6('0x3'));var PdfPrinter=require(_0x3df6('0x4'));var zipdir=require(_0x3df6('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x3df6('0x6'))[_0x3df6('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x3df6('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3df6('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3df6('0x9')][0x4];var NAME=process[_0x3df6('0x9')][0x5];var FORMAT=_0x3df6('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5627b6,_0x3bb49){var _0x568470={'status':_0x5627b6};var _0x1d244d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bb49){_0x568470[_0x3df6('0xb')]=_0x3bb49;}return db[_0x3df6('0xc')]['update'](_0x568470,_0x1d244d);}function getHeaders(_0x2426ec){return _[_0x3df6('0xd')](_0x2426ec,function(_0x4b1f5e){return{'text':_0x4b1f5e,'style':'tableHeader'};});}function getRows(_0x2a1f86,_0x2800eb){return _['map'](_0x2800eb,function(_0x4a314f){return _(_0x4a314f)['pick'](_0x2a1f86)[_0x3df6('0xd')](function(_0x5413d9){return _0x5413d9?_['toString'](_0x5413d9):'';})[_0x3df6('0xe')]();});}function createTable(_0x383d05,_0x293ecc){var _0x24052e={'widths':_[_0x3df6('0xf')](Array(_0x383d05[_0x3df6('0x10')]),0x91),'heights':function(_0x4187c8){return _0x4187c8===0x0?_0x3df6('0x11'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4a70ae=getHeaders(_0x383d05);_0x24052e[_0x3df6('0x12')][_0x3df6('0x13')](_0x4a70ae);var _0x3237e0=getRows(_0x383d05,_0x293ecc);_0x24052e[_0x3df6('0x12')]=_0x24052e[_0x3df6('0x12')][_0x3df6('0x14')](_0x3237e0);return _0x24052e;}function createTables(_0xe3baf5){var _0x3d06cf=[];var _0x1366b7=_[_0x3df6('0x15')](Object[_0x3df6('0x16')](_0xe3baf5[0x0]),0x5);_0x1366b7[_0x3df6('0x17')](function(_0xdcac68){_0x3d06cf['push'](createTable(_0xdcac68,_0xe3baf5));});return _0x3d06cf;}function getPDFDocDefinition(_0x147a3b){var _0x2983e9=util[_0x3df6('0x18')](_0x3df6('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x3df6('0x1a')])[_0x3df6('0x18')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3df6('0x18')](FORMAT));var _0x13e306=[];for(var _0x5e19f1=0x0;_0x5e19f1<_0x147a3b[_0x3df6('0x10')];_0x5e19f1++){var _0x5813f6=[];if(_0x5e19f1===0x0){_0x5813f6['push']({'text':_0x2983e9,'style':'header'});}var _0x4e5073={'table':_0x147a3b[_0x5e19f1]};if(_0x5e19f1>0x0){_0x4e5073[_0x3df6('0x1b')]=_0x3df6('0x1c');_0x4e5073[_0x3df6('0x1d')]=[0x0,0x46,0x0,0x0];}_0x5813f6[_0x3df6('0x13')](_0x4e5073);_0x13e306[_0x3df6('0x13')](_0x5813f6);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x13e306,'footer':function(_0x1d3c42,_0x50d816){return{'text':_0x1d3c42[_0x3df6('0x1e')]()+_0x3df6('0x1f')+_0x50d816,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3df6('0x20')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1a1e10){var _0x5ad288=0x1388;var _0x4cd77b;if(!_0x1a1e10[0x0]['num']){return analyticExtractedReport(_0x3df6('0x21'));}return db[_0x3df6('0x22')][_0x3df6('0x23')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3df6('0x24'),_0x3df6('0x25')]})[_0x3df6('0x26')](function(_0x2212d5){if(_0x2212d5){_0x4cd77b=_0x2212d5;_0x5ad288=_0x4cd77b['splitSizePdf']||0x3e8;}})[_0x3df6('0x26')](function(){var _0x341b6d=[];var _0xb47c9c=0x0;if(_0x4cd77b[_0x3df6('0x24')]){if(_0x1a1e10&&_0x1a1e10[_0x3df6('0x10')]){var _0x58e152=_[_0x3df6('0x27')](_0x1a1e10[0x0][_0x3df6('0x28')]/_0x5ad288);var _0x199f06=Number['isInteger'](_0x1a1e10[0x0][_0x3df6('0x28')]/_0x5ad288)?_0x1a1e10[0x0][_0x3df6('0x28')]%_0x5ad288:0x0;_0x58e152['forEach'](function(_0x2ca8aa){if(_0x2ca8aa>0x0){_0xb47c9c+=_0x5ad288;}_0x341b6d[_0x3df6('0x13')](dbH[_0x3df6('0x29')]['query'](util[_0x3df6('0x18')](_0x3df6('0x2a'),QUERY,_0x5ad288,_0xb47c9c),{'type':dbH[_0x3df6('0x29')][_0x3df6('0x2b')][_0x3df6('0x2c')]}));});if(_0x199f06>0x0){_0xb47c9c+=_0x5ad288;_0x341b6d['push'](dbH[_0x3df6('0x29')][_0x3df6('0x2d')](util[_0x3df6('0x18')](_0x3df6('0x2a'),QUERY,_0x199f06,_0xb47c9c),{'type':dbH[_0x3df6('0x29')][_0x3df6('0x2b')][_0x3df6('0x2c')]}));}}}else{_0x341b6d['push'](dbH[_0x3df6('0x29')][_0x3df6('0x2d')](QUERY,{'type':dbH[_0x3df6('0x29')][_0x3df6('0x2b')][_0x3df6('0x2c')]}));}var _0x3e5860=path[_0x3df6('0x2e')](PATH);var _0x2a881b=path['basename'](PATH,_0x3df6('0x2f'));var _0x94353e=_0x4cd77b['split']&&_0x341b6d[_0x3df6('0x10')]>0x1;var _0x4560fe=[];if(!fs['existsSync'](path[_0x3df6('0x30')](_0x3e5860,_0x2a881b))&&_0x94353e){fs[_0x3df6('0x31')](path[_0x3df6('0x30')](_0x3e5860,_0x2a881b));}return BPromise['each'](_0x341b6d,function(_0x2defe9){_0x4560fe[_0x3df6('0x13')](_0x2defe9);})[_0x3df6('0x26')](function(){var _0x1b46cd=[];for(var _0x5dd5c1=0x0;_0x5dd5c1<_0x4560fe[_0x3df6('0x10')];_0x5dd5c1+=0x1){var _0x3d519d=_0x4560fe[_0x5dd5c1];var _0x5b2d55=createTables(_['flatten'](_0x3d519d));var _0x546b7d;var _0x4b049b=getPDFDocDefinition(_0x5b2d55);var _0x39acd1=getPDFPrinter();var _0xdc1965=_0x39acd1[_0x3df6('0x32')](_0x4b049b);if(_0x94353e){_0x546b7d=path['join'](_0x3e5860,_0x2a881b,util[_0x3df6('0x18')]('%s%d.%s',_0x2a881b,_0x5dd5c1,_0x3df6('0x33')));}else{_0x546b7d=path[_0x3df6('0x30')](_0x3e5860,util[_0x3df6('0x18')]('%s.%s',_0x2a881b,_0x3df6('0x33')));}_0x1b46cd['push'](writePDFDocument(_0xdc1965,_0x546b7d));}return Promise['all'](_0x1b46cd);})[_0x3df6('0x26')](function(){if(_0x94353e){return new Promise(function(_0x3c22ad){zipdir(path[_0x3df6('0x30')](_0x3e5860,_0x2a881b),{'saveTo':path[_0x3df6('0x30')](_0x3e5860,util[_0x3df6('0x18')](_0x3df6('0x34'),_0x2a881b,_0x3df6('0x35')))},function(){rimraf(path[_0x3df6('0x30')](_0x3e5860,_0x2a881b),function(){});_0x3c22ad(_0x3df6('0x36'));});});}})[_0x3df6('0x26')](function(){if(!_0x94353e)return;rimraf(path[_0x3df6('0x30')](_0x3e5860,_0x2a881b),function(){});})[_0x3df6('0x26')](function(){logger[_0x3df6('0x37')](util['format'](_0x3df6('0x38'),EXTRACTED_REPORT_ID,_0x3df6('0x39')));return analyticExtractedReport(_0x3df6('0x3a'),_0x94353e?util[_0x3df6('0x18')](_0x3df6('0x34'),_0x2a881b,_0x94353e?_0x3df6('0x35'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3df6('0x37')](util[_0x3df6('0x18')](_0x3df6('0x3b'),EXTRACTED_REPORT_ID,_0x3df6('0x39')));return db[_0x3df6('0xc')][_0x3df6('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1ff84a){EXTRACTED_REPORT=_0x1ff84a;return dbH[_0x3df6('0x29')][_0x3df6('0x2d')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3df6('0x29')][_0x3df6('0x2b')]['SELECT']});})[_0x3df6('0x26')](extractReport)['catch'](function(_0x6f7ecb){logger[_0x3df6('0x37')](util['format'](_0x3df6('0x3d'),EXTRACTED_REPORT_ID,_0x3df6('0x39')),util['inspect'](_0x6f7ecb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3df6('0x3e'));})['finally'](function(){process[_0x3df6('0x3f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb7cbe8=new PdfPrinter({'Arial':{'normal':__dirname+_0x3df6('0x40'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xb7cbe8;}function getPDFDocDefinitionFromHTML(_0x1e3e09,_0xeb453){var _0x592577=util[_0x3df6('0x18')](_0x3df6('0x41'),_0xeb453[_0x3df6('0x42')],_0xeb453['interactionId']);var _0x2997d7=moment()[_0x3df6('0x18')]('YYYY-MM-DD')[_0x3df6('0x1e')]();var _0x1b3e57=htmlToPdfmake(_0x1e3e09,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1b3e57],'defaultStyle':{'font':_0x3df6('0x43')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3df6('0x44'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3df6('0x44'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x3df6('0x45'),'style':_0x3df6('0x46')}];},'footer':function(_0xf82ba4,_0x531b88){return[{'text':util[_0x3df6('0x18')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x592577,_0xf82ba4,_0x531b88,_0x2997d7),'style':_0x3df6('0x47')}];}};}function writePDFDocument(_0x286ea9,_0x32b083){return new Promise(function(_0x314319,_0x4d0889){var _0x4cd7f5=_0x286ea9[_0x3df6('0x48')](fs[_0x3df6('0x49')](_0x32b083));_0x4cd7f5['on'](_0x3df6('0x4a'),function(){_0x314319(_0x3df6('0x4a'));});_0x4cd7f5['on']('error',function(_0x2762ac){_0x4d0889(_0x2762ac);});_0x286ea9['end']();});}exports[_0x3df6('0x4b')]=function(_0x295cca,_0xa8c078){var _0x1b5c0f=getPDFPrinter();var _0x351afc=getPDFDocDefinitionFromHTML(_0x295cca,_0xa8c078);var _0x5a2cec=_0x1b5c0f[_0x3df6('0x32')](_0x351afc);return writePDFDocument(_0x5a2cec,_0xa8c078[_0x3df6('0x2')])[_0x3df6('0x4c')](function(_0x5c71d2){throw _0x5c71d2;});}; \ No newline at end of file +var _0xddef=['QueryTypes','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','pick','map','value','fill','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','length','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x557497,_0x4ca1f0){var _0x452046=function(_0x6d8f62){while(--_0x6d8f62){_0x557497['push'](_0x557497['shift']());}};_0x452046(++_0x4ca1f0);}(_0xddef,0x70));var _0xfdde=function(_0x1b5df2,_0x48f81c){_0x1b5df2=_0x1b5df2-0x0;var _0x2b34af=_0xddef[_0x1b5df2];return _0x2b34af;};'use strict';var _=require(_0xfdde('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xfdde('0x1'));var moment=require(_0xfdde('0x2'));var htmlToPdfmake=require(_0xfdde('0x3'));var PdfPrinter=require(_0xfdde('0x4'));var zipdir=require(_0xfdde('0x5'));var rimraf=require(_0xfdde('0x6'));var JSDOM=require(_0xfdde('0x7'))['JSDOM'];var window=new JSDOM('')[_0xfdde('0x8')];var BPromise=require('bluebird');var db=require(_0xfdde('0x9'))['db'];var dbH=require('../../mysqldb')[_0xfdde('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfdde('0xb')][0x2]);var QUERY=process[_0xfdde('0xb')][0x3];var PATH=process[_0xfdde('0xb')][0x4];var NAME=process[_0xfdde('0xb')][0x5];var FORMAT=_0xfdde('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x58f2fa,_0x5e0c6e){var _0x553c85={'status':_0x58f2fa};var _0x19a736={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e0c6e){_0x553c85[_0xfdde('0xd')]=_0x5e0c6e;}return db[_0xfdde('0xe')]['update'](_0x553c85,_0x19a736);}function getHeaders(_0x4726d6){return _['map'](_0x4726d6,function(_0x1f6e88){return{'text':_0x1f6e88,'style':_0xfdde('0xf')};});}function getRows(_0x2750fc,_0x29052f){return _['map'](_0x29052f,function(_0x3b4129){return _(_0x3b4129)[_0xfdde('0x10')](_0x2750fc)[_0xfdde('0x11')](function(_0x329207){return _0x329207?_['toString'](_0x329207):'';})[_0xfdde('0x12')]();});}function createTable(_0x4035d2,_0x539ffe){var _0x233bac={'widths':_[_0xfdde('0x13')](Array(_0x4035d2['length']),0x91),'heights':function(_0x3b38e9){return _0x3b38e9===0x0?_0xfdde('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2ffead=getHeaders(_0x4035d2);_0x233bac[_0xfdde('0x15')][_0xfdde('0x16')](_0x2ffead);var _0x201770=getRows(_0x4035d2,_0x539ffe);_0x233bac['body']=_0x233bac[_0xfdde('0x15')]['concat'](_0x201770);return _0x233bac;}function createTables(_0xaeb976){var _0x23e16a=[];var _0x2442f0=_[_0xfdde('0x17')](Object['keys'](_0xaeb976[0x0]),0x5);_0x2442f0[_0xfdde('0x18')](function(_0x900f5f){_0x23e16a[_0xfdde('0x16')](createTable(_0x900f5f,_0xaeb976));});return _0x23e16a;}function getPDFDocDefinition(_0x10c6a2){var _0x525490=util[_0xfdde('0x19')](_0xfdde('0x1a'),NAME,EXTRACTED_REPORT[_0xfdde('0x1b')],moment(EXTRACTED_REPORT[_0xfdde('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfdde('0x1d')])[_0xfdde('0x19')](FORMAT));var _0x40b04d=[];for(var _0x1198a7=0x0;_0x1198a7<_0x10c6a2['length'];_0x1198a7++){var _0x13b1df=[];if(_0x1198a7===0x0){_0x13b1df['push']({'text':_0x525490,'style':_0xfdde('0x1e')});}var _0x348866={'table':_0x10c6a2[_0x1198a7]};if(_0x1198a7>0x0){_0x348866[_0xfdde('0x1f')]=_0xfdde('0x20');_0x348866[_0xfdde('0x21')]=[0x0,0x46,0x0,0x0];}_0x13b1df[_0xfdde('0x16')](_0x348866);_0x40b04d[_0xfdde('0x16')](_0x13b1df);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x40b04d,'footer':function(_0x372568,_0x20414a){return{'text':_0x372568[_0xfdde('0x22')]()+_0xfdde('0x23')+_0x20414a,'style':_0xfdde('0x24')};},'defaultStyle':{'font':_0xfdde('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfdde('0x26')},'footer':{'alignment':_0xfdde('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x37a56f){var _0xfdddb5=0x1388;var _0x46e46d;if(!_0x37a56f[0x0][_0xfdde('0x28')]){return analyticExtractedReport(_0xfdde('0x29'));}return db[_0xfdde('0x2a')][_0xfdde('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfdde('0x2c'),_0xfdde('0x2d')]})[_0xfdde('0x2e')](function(_0x210c42){if(_0x210c42){_0x46e46d=_0x210c42;_0xfdddb5=_0x46e46d['splitSizePdf']||0x3e8;}})[_0xfdde('0x2e')](function(){var _0x32a5a1=[];var _0x28113e=0x0;if(_0x46e46d['split']){if(_0x37a56f&&_0x37a56f[_0xfdde('0x2f')]){var _0x582ea7=_['range'](_0x37a56f[0x0]['num']/_0xfdddb5);var _0x1c033c=Number[_0xfdde('0x30')](_0x37a56f[0x0][_0xfdde('0x28')]/_0xfdddb5)?_0x37a56f[0x0][_0xfdde('0x28')]%_0xfdddb5:0x0;_0x582ea7['forEach'](function(_0x4625c7){if(_0x4625c7>0x0){_0x28113e+=_0xfdddb5;}_0x32a5a1[_0xfdde('0x16')](dbH[_0xfdde('0x31')][_0xfdde('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xfdddb5,_0x28113e),{'type':dbH[_0xfdde('0x31')]['QueryTypes']['SELECT']}));});if(_0x1c033c>0x0){_0x28113e+=_0xfdddb5;_0x32a5a1[_0xfdde('0x16')](dbH[_0xfdde('0x31')][_0xfdde('0x32')](util[_0xfdde('0x19')](_0xfdde('0x33'),QUERY,_0x1c033c,_0x28113e),{'type':dbH[_0xfdde('0x31')]['QueryTypes'][_0xfdde('0x34')]}));}}}else{_0x32a5a1[_0xfdde('0x16')](dbH[_0xfdde('0x31')][_0xfdde('0x32')](QUERY,{'type':dbH[_0xfdde('0x31')]['QueryTypes'][_0xfdde('0x34')]}));}var _0x4dfee8=path[_0xfdde('0x35')](PATH);var _0x333de1=path[_0xfdde('0x36')](PATH,_0xfdde('0x37'));var _0x1ef852=_0x46e46d[_0xfdde('0x2c')]&&_0x32a5a1['length']>0x1;var _0x5a973b=[];if(!fs['existsSync'](path[_0xfdde('0x38')](_0x4dfee8,_0x333de1))&&_0x1ef852){fs[_0xfdde('0x39')](path[_0xfdde('0x38')](_0x4dfee8,_0x333de1));}return BPromise[_0xfdde('0x3a')](_0x32a5a1,function(_0x35c2b3){_0x5a973b['push'](_0x35c2b3);})[_0xfdde('0x2e')](function(){var _0x1d243a=[];for(var _0x19f576=0x0;_0x19f576<_0x5a973b[_0xfdde('0x2f')];_0x19f576+=0x1){var _0x3f9726=_0x5a973b[_0x19f576];var _0x16eaea=createTables(_['flatten'](_0x3f9726));var _0x3b866a;var _0x2d827d=getPDFDocDefinition(_0x16eaea);var _0x1d4b36=getPDFPrinter();var _0x41ffef=_0x1d4b36[_0xfdde('0x3b')](_0x2d827d);if(_0x1ef852){_0x3b866a=path[_0xfdde('0x38')](_0x4dfee8,_0x333de1,util[_0xfdde('0x19')](_0xfdde('0x3c'),_0x333de1,_0x19f576,_0xfdde('0x3d')));}else{_0x3b866a=path[_0xfdde('0x38')](_0x4dfee8,util['format']('%s.%s',_0x333de1,'pdf'));}_0x1d243a[_0xfdde('0x16')](writePDFDocument(_0x41ffef,_0x3b866a));}return Promise[_0xfdde('0x3e')](_0x1d243a);})[_0xfdde('0x2e')](function(){if(_0x1ef852){return new Promise(function(_0x540ecb){zipdir(path['join'](_0x4dfee8,_0x333de1),{'saveTo':path['join'](_0x4dfee8,util[_0xfdde('0x19')](_0xfdde('0x3f'),_0x333de1,_0xfdde('0x40')))},function(){rimraf(path['join'](_0x4dfee8,_0x333de1),function(){});_0x540ecb('zip\x20finished');});});}})[_0xfdde('0x2e')](function(){if(!_0x1ef852)return;rimraf(path['join'](_0x4dfee8,_0x333de1),function(){});})[_0xfdde('0x2e')](function(){logger[_0xfdde('0x41')](util['format'](_0xfdde('0x42'),EXTRACTED_REPORT_ID,_0xfdde('0x43')));return analyticExtractedReport(_0xfdde('0x44'),_0x1ef852?util['format'](_0xfdde('0x3f'),_0x333de1,_0x1ef852?'zip':_0xfdde('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfdde('0x41')](util[_0xfdde('0x19')](_0xfdde('0x45'),EXTRACTED_REPORT_ID,_0xfdde('0x43')));return db['AnalyticExtractedReport'][_0xfdde('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xfdde('0x2e')](function(_0x43630c){EXTRACTED_REPORT=_0x43630c;return dbH[_0xfdde('0x31')]['query'](util['format'](_0xfdde('0x47'),QUERY),{'type':dbH[_0xfdde('0x31')][_0xfdde('0x48')][_0xfdde('0x34')]});})[_0xfdde('0x2e')](extractReport)[_0xfdde('0x49')](function(_0x4460a3){logger[_0xfdde('0x41')](util[_0xfdde('0x19')](_0xfdde('0x4a'),EXTRACTED_REPORT_ID,_0xfdde('0x43')),util['inspect'](_0x4460a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfdde('0x4b'));})['finally'](function(){process[_0xfdde('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x593947=new PdfPrinter({'Arial':{'normal':__dirname+_0xfdde('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xfdde('0x4e'),'bolditalics':__dirname+_0xfdde('0x4f')}});return _0x593947;}function getPDFDocDefinitionFromHTML(_0x5ececc,_0x40ba29){var _0x5573f3=util[_0xfdde('0x19')](_0xfdde('0x50'),_0x40ba29[_0xfdde('0x51')],_0x40ba29['interactionId']);var _0x17dfbc=moment()[_0xfdde('0x19')](_0xfdde('0x52'))[_0xfdde('0x22')]();var _0x423468=htmlToPdfmake(_0x5ececc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x423468],'defaultStyle':{'font':_0xfdde('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfdde('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfdde('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfdde('0x53')}},'header':function(){return[{'text':_0xfdde('0x54'),'style':_0xfdde('0x1e')}];},'footer':function(_0x5251aa,_0xe401e4){return[{'text':util[_0xfdde('0x19')](_0xfdde('0x55'),_0x5573f3,_0x5251aa,_0xe401e4,_0x17dfbc),'style':_0xfdde('0x24')}];}};}function writePDFDocument(_0x1b89ff,_0x20d8ea){return new Promise(function(_0x49aae4,_0x2351b7){var _0x1c7b53=_0x1b89ff[_0xfdde('0x56')](fs[_0xfdde('0x57')](_0x20d8ea));_0x1c7b53['on'](_0xfdde('0x58'),function(){_0x49aae4(_0xfdde('0x58'));});_0x1c7b53['on'](_0xfdde('0x59'),function(_0x1d9519){_0x2351b7(_0x1d9519);});_0x1b89ff[_0xfdde('0x5a')]();});}exports[_0xfdde('0x5b')]=function(_0x2cf8e6,_0x558176){var _0x4d2b6d=getPDFPrinter();var _0x2d12d6=getPDFDocDefinitionFromHTML(_0x2cf8e6,_0x558176);var _0x3f689e=_0x4d2b6d[_0xfdde('0x3b')](_0x2d12d6);return writePDFDocument(_0x3f689e,_0x558176[_0xfdde('0x1')])[_0xfdde('0x49')](function(_0x4565b9){throw _0x4565b9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e9b33d9..f7bd507 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 _0xb70c=['json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash'];(function(_0x26f022,_0x498949){var _0x1e7daf=function(_0x25c15d){while(--_0x25c15d){_0x26f022['push'](_0x26f022['shift']());}};_0x1e7daf(++_0x498949);}(_0xb70c,0x10b));var _0xcb70=function(_0x1d453f,_0x5793a9){_0x1d453f=_0x1d453f-0x0;var _0x50996a=_0xb70c[_0x1d453f];return _0x50996a;};'use strict';var util=require(_0xcb70('0x0'));var path=require(_0xcb70('0x1'));var _=require(_0xcb70('0x2'));var fs=require('fs');var json2xls=require(_0xcb70('0x3'));var BPromise=require(_0xcb70('0x4'));var zipdir=require(_0xcb70('0x5'));var rimraf=require(_0xcb70('0x6'));var db=require(_0xcb70('0x7'))['db'];var dbH=require(_0xcb70('0x7'))['dbH'];var logger=require(_0xcb70('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcb70('0x9')][0x2]);var QUERY=process[_0xcb70('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x479b75,_0x468f77){var _0x49ee24={'status':_0x479b75};var _0x201965={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x468f77){_0x49ee24['savename']=_0x468f77;}return db[_0xcb70('0xa')][_0xcb70('0xb')](_0x49ee24,_0x201965);}function main(){var _0x5f0b8c=0x1388;var _0x3e541c;logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0xe'),EXTRACTED_REPORT_ID,_0xcb70('0xf')));return db[_0xcb70('0x10')][_0xcb70('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcb70('0x12'),_0xcb70('0x13')]})[_0xcb70('0x14')](function(_0x42d7b2){if(_0x42d7b2){_0x3e541c=_0x42d7b2;_0x5f0b8c=_0x3e541c[_0xcb70('0x13')]||0x1388;}})[_0xcb70('0x14')](function(){return dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x17'),QUERY),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')]['SELECT']});})[_0xcb70('0x14')](function(_0x79af3a){if(!_0x79af3a[0x0]['num']){return analyticExtractedReport(_0xcb70('0x19'));}var _0x4d71ab=[];var _0x5561ac=0x0;if(_0x3e541c[_0xcb70('0x12')]){if(_0x79af3a&&_0x79af3a[_0xcb70('0x1a')]){var _0x48cace=_[_0xcb70('0x1b')](_0x79af3a[0x0][_0xcb70('0x1c')]/_0x5f0b8c);var _0x380e1d=Number[_0xcb70('0x1d')](_0x79af3a[0x0][_0xcb70('0x1c')]/_0x5f0b8c)?_0x79af3a[0x0][_0xcb70('0x1c')]%_0x5f0b8c:0x0;_0x48cace[_0xcb70('0x1e')](function(_0x506773){if(_0x506773>0x0){_0x5561ac+=_0x5f0b8c;}_0x4d71ab['push'](dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x1f'),QUERY,_0x5f0b8c,_0x5561ac),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));});if(_0x380e1d>0x0){_0x5561ac+=_0x5f0b8c;_0x4d71ab[_0xcb70('0x21')](dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x1f'),QUERY,_0x380e1d,_0x5561ac),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));}}}else{_0x4d71ab['push'](dbH['sequelize'][_0xcb70('0x16')](QUERY,{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));}var _0x61864f=path['dirname'](PATH);var _0x4aaa86=path[_0xcb70('0x22')](PATH,_0xcb70('0x23'));var _0x50bbb3=_0x3e541c[_0xcb70('0x12')]&&_0x4d71ab[_0xcb70('0x1a')]>0x1;var _0x5707e5=[];if(!fs[_0xcb70('0x24')](path[_0xcb70('0x25')](_0x61864f,_0x4aaa86))&&_0x50bbb3){fs['mkdirSync'](path['join'](_0x61864f,_0x4aaa86));}return BPromise[_0xcb70('0x26')](_0x4d71ab,function(_0x61cefc){_0x5707e5[_0xcb70('0x21')](_0x61cefc);})['then'](function(){for(var _0x1e3c10=0x0;_0x1e3c10<_0x5707e5[_0xcb70('0x1a')];_0x1e3c10+=0x1){var _0x1834bb;var _0x5a41a1=_0x5707e5[_0x1e3c10];if(_0x50bbb3){_0x1834bb=path[_0xcb70('0x25')](_0x61864f,_0x4aaa86,util[_0xcb70('0xd')](_0xcb70('0x27'),_0x4aaa86,_0x1e3c10,'xlsx'));}else{_0x1834bb=path[_0xcb70('0x25')](_0x61864f,util[_0xcb70('0xd')](_0xcb70('0x28'),_0x4aaa86,_0xcb70('0x29')));}fs[_0xcb70('0x2a')](_0x1834bb,json2xls(_0x5a41a1),_0xcb70('0x2b'));}})[_0xcb70('0x14')](function(){if(_0x50bbb3){return new Promise(function(_0xd75525){zipdir(path[_0xcb70('0x25')](_0x61864f,_0x4aaa86),{'saveTo':path['join'](_0x61864f,util[_0xcb70('0xd')]('%s.%s',_0x4aaa86,_0xcb70('0x2c')))},function(_0x55f7ce,_0x2e9481){rimraf(path[_0xcb70('0x25')](_0x61864f,_0x4aaa86),function(){});_0xd75525(_0xcb70('0x2d'));});});}})[_0xcb70('0x14')](function(){logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0x2e'),EXTRACTED_REPORT_ID,_0xcb70('0xf')));return analyticExtractedReport(_0xcb70('0x2f'),_0x50bbb3?util[_0xcb70('0xd')](_0xcb70('0x28'),_0x4aaa86,_0x50bbb3?_0xcb70('0x2c'):_0xcb70('0x29')):null);});})[_0xcb70('0x30')](function(_0x677990){logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0x31'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xcb70('0x32')](_0x677990,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb70('0x33'));})[_0xcb70('0x34')](function(){process[_0xcb70('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x983f=['lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','split','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','inspect','Failed','finally','exit','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x983f,0xd3));var _0xf983=function(_0x40a114,_0x2b70d4){_0x40a114=_0x40a114-0x0;var _0x4353d9=_0x983f[_0x40a114];return _0x4353d9;};'use strict';var util=require('util');var path=require(_0xf983('0x0'));var _=require(_0xf983('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf983('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xf983('0x3'));var db=require(_0xf983('0x4'))['db'];var dbH=require(_0xf983('0x4'))[_0xf983('0x5')];var logger=require(_0xf983('0x6'))(_0xf983('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf983('0x8')][0x3];var PATH=process[_0xf983('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b4d92,_0x164d82){var _0x4ab230={'status':_0x1b4d92};var _0x560d0e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x164d82){_0x4ab230[_0xf983('0x9')]=_0x164d82;}return db[_0xf983('0xa')][_0xf983('0xb')](_0x4ab230,_0x560d0e);}function main(){var _0x102a33=0x1388;var _0x3fb60;logger[_0xf983('0xc')](util['format'](_0xf983('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xf983('0xe')][_0xf983('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf983('0x10')]})[_0xf983('0x11')](function(_0x4f25c8){if(_0x4f25c8){_0x3fb60=_0x4f25c8;_0x102a33=_0x3fb60['splitSizeXlsx']||0x1388;}})[_0xf983('0x11')](function(){return dbH[_0xf983('0x12')][_0xf983('0x13')](util['format'](_0xf983('0x14'),QUERY),{'type':dbH[_0xf983('0x12')]['QueryTypes'][_0xf983('0x15')]});})[_0xf983('0x11')](function(_0x44ab58){if(!_0x44ab58[0x0][_0xf983('0x16')]){return analyticExtractedReport('Empty');}var _0x44a35a=[];var _0x2ea226=0x0;if(_0x3fb60[_0xf983('0x17')]){if(_0x44ab58&&_0x44ab58[_0xf983('0x18')]){var _0x3ae7fd=_[_0xf983('0x19')](_0x44ab58[0x0]['num']/_0x102a33);var _0x5abe37=Number[_0xf983('0x1a')](_0x44ab58[0x0][_0xf983('0x16')]/_0x102a33)?_0x44ab58[0x0][_0xf983('0x16')]%_0x102a33:0x0;_0x3ae7fd[_0xf983('0x1b')](function(_0x27d933){if(_0x27d933>0x0){_0x2ea226+=_0x102a33;}_0x44a35a[_0xf983('0x1c')](dbH[_0xf983('0x12')][_0xf983('0x13')](util[_0xf983('0x1d')](_0xf983('0x1e'),QUERY,_0x102a33,_0x2ea226),{'type':dbH['sequelize'][_0xf983('0x1f')][_0xf983('0x15')]}));});if(_0x5abe37>0x0){_0x2ea226+=_0x102a33;_0x44a35a['push'](dbH[_0xf983('0x12')][_0xf983('0x13')](util[_0xf983('0x1d')](_0xf983('0x1e'),QUERY,_0x5abe37,_0x2ea226),{'type':dbH[_0xf983('0x12')][_0xf983('0x1f')][_0xf983('0x15')]}));}}}else{_0x44a35a[_0xf983('0x1c')](dbH[_0xf983('0x12')][_0xf983('0x13')](QUERY,{'type':dbH[_0xf983('0x12')]['QueryTypes'][_0xf983('0x15')]}));}var _0x1f8c56=path[_0xf983('0x20')](PATH);var _0x1ec8dd=path[_0xf983('0x21')](PATH,_0xf983('0x22'));var _0x5c46f3=_0x3fb60[_0xf983('0x17')]&&_0x44a35a[_0xf983('0x18')]>0x1;var _0x3b5b57=[];if(!fs[_0xf983('0x23')](path[_0xf983('0x24')](_0x1f8c56,_0x1ec8dd))&&_0x5c46f3){fs[_0xf983('0x25')](path[_0xf983('0x24')](_0x1f8c56,_0x1ec8dd));}return BPromise[_0xf983('0x26')](_0x44a35a,function(_0x8f694){_0x3b5b57[_0xf983('0x1c')](_0x8f694);})['then'](function(){for(var _0x3612aa=0x0;_0x3612aa<_0x3b5b57[_0xf983('0x18')];_0x3612aa+=0x1){var _0x1d552b;var _0xd529d0=_0x3b5b57[_0x3612aa];if(_0x5c46f3){_0x1d552b=path[_0xf983('0x24')](_0x1f8c56,_0x1ec8dd,util[_0xf983('0x1d')]('%s%d.%s',_0x1ec8dd,_0x3612aa,_0xf983('0x27')));}else{_0x1d552b=path[_0xf983('0x24')](_0x1f8c56,util['format'](_0xf983('0x28'),_0x1ec8dd,_0xf983('0x27')));}fs[_0xf983('0x29')](_0x1d552b,json2xls(_0xd529d0),_0xf983('0x2a'));}})[_0xf983('0x11')](function(){if(_0x5c46f3){return new Promise(function(_0x24037e){zipdir(path['join'](_0x1f8c56,_0x1ec8dd),{'saveTo':path[_0xf983('0x24')](_0x1f8c56,util[_0xf983('0x1d')](_0xf983('0x28'),_0x1ec8dd,_0xf983('0x2b')))},function(_0xecf7d,_0x4ba284){rimraf(path['join'](_0x1f8c56,_0x1ec8dd),function(){});_0x24037e(_0xf983('0x2c'));});});}})[_0xf983('0x11')](function(){logger[_0xf983('0xc')](util[_0xf983('0x1d')](_0xf983('0x2d'),EXTRACTED_REPORT_ID,_0xf983('0x2e')));return analyticExtractedReport(_0xf983('0x2f'),_0x5c46f3?util[_0xf983('0x1d')](_0xf983('0x28'),_0x1ec8dd,_0x5c46f3?_0xf983('0x2b'):'xlsx'):null);});})[_0xf983('0x30')](function(_0x1a52d8){logger['info'](util[_0xf983('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf983('0x2e')),util[_0xf983('0x31')](_0x1a52d8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf983('0x32'));})[_0xf983('0x33')](function(){process[_0xf983('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ea9a4f5..b1f55fa 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 _0x25de=['destroy','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','*,*,*,*','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','length','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction'];(function(_0x4e7c09,_0x452405){var _0x5b2f05=function(_0x5d01a8){while(--_0x5d01a8){_0x4e7c09['push'](_0x4e7c09['shift']());}};_0x5b2f05(++_0x452405);}(_0x25de,0xd7));var _0xe25d=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x25de[_0x320b8e];return _0x55a10a;};'use strict';var _=require('lodash');var util=require(_0xe25d('0x0'));function rewrite(_0x20ae04,_0x3d4044){var _0x44504f=this;return _0x20ae04[_0xe25d('0x1')][_0xe25d('0x2')][_0xe25d('0x3')]({'raw':!![]})[_0xe25d('0x4')](function(_0x12c0e3){_0x44504f[_0xe25d('0x5')]=_0x12c0e3;return _0x20ae04[_0xe25d('0x1')]['VoiceExtension'][_0xe25d('0x3')]({'where':{'IntervalId':_0x3d4044[_0xe25d('0x6')]},'raw':!![]});})[_0xe25d('0x4')](function(_0x9f551d){return _0x20ae04[_0xe25d('0x1')][_0xe25d('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xe25d('0x8')](_[_0xe25d('0x9')](_0x9f551d,_0xe25d('0xa')))}},'order':[{'raw':_0xe25d('0xb')}],'raw':!![]});})[_0xe25d('0x4')](function(_0x203114){var _0x5827b6=_[_0xe25d('0xc')](_0x203114,{'priority':'1'});var _0x134138=_['filter'](_0x203114,{'isApp':0x1});var _0x57c571=_[_0xe25d('0xd')](_0x134138,_0xe25d('0xa'));var _0x1b1064=[_0xe25d('0xe'),'playback'];var _0x1f145b=[];var _0x3791fc=[];for(var _0x2f3a67 in _0x57c571){if(_0x57c571[_0xe25d('0xf')](_0x2f3a67)){_0x44504f[_0xe25d('0x10')]=0x2;_0x44504f[_0xe25d('0x11')]=[];_0x44504f[_0xe25d('0x12')]=_[_0xe25d('0x13')](_0x5827b6,{'exten':_0x57c571[_0x2f3a67][0x0]['exten']});_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':util['format']('CDR(type)=%s',_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')]),'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f['priority']++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});if(_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')]===_0xe25d('0x19')){_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0]['type'],'app':_0xe25d('0x16'),'appdata':'CDR(routeid)='+_0x57c571[_0x2f3a67][0x0]['VoiceExtensionId'],'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});}else if(_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')]===_0xe25d('0x1a')){if(_0x44504f[_0xe25d('0x12')]){_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0]['type'],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x1b')+(_0x44504f[_0xe25d('0x12')]['cutdigits']?_0xe25d('0x1c')+_0x44504f[_0xe25d('0x12')][_0xe25d('0x1d')]+'}':'${EXTEN}'),'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0]['exten'],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});}_0x44504f[_0xe25d('0x11')]['push']({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x1e')+_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')],'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0]['exten'],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0]['VoiceExtensionId']});var _0x2ce849=_0x44504f['priority']++;_0x44504f[_0xe25d('0x11')]['push']({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x1f'),'appdata':_0xe25d('0x20')+(_0x2ce849+0x2)+_0xe25d('0x21')+(_0x2ce849+0x1)+')','context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x2ce849,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});if(_0x44504f['extension']){_0x44504f['extensions'][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':'Set','appdata':_0x44504f[_0xe25d('0x12')][_0xe25d('0x1d')]?_0xe25d('0x22')+_0x44504f['extension'][_0xe25d('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0]['exten'],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0]['VoiceExtensionId']});}_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x23')+_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')],'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f['priority']++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});if(_0x44504f['extension']&&_0x44504f[_0xe25d('0x12')]['hasOwnProperty'](_0xe25d('0x24'))&&_0x44504f[_0xe25d('0x12')][_0xe25d('0x24')]!=='none'){_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x25'),'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});_0x44504f[_0xe25d('0x11')][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x26')+_0x44504f[_0xe25d('0x12')]['recordingFormat']||_0xe25d('0x27'),'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0]['exten'],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});}}_0x44504f[_0xe25d('0x11')]['push']({'type':_0x57c571[_0x2f3a67][0x0]['type'],'app':_0xe25d('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});_0x44504f['extensions'][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x28'),'context':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x17')],'exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'priority':_0x44504f[_0xe25d('0x10')]++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});_0x44504f['extensions'][_0xe25d('0x14')]({'type':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x15')],'app':'Set','appdata':_0xe25d('0x29'),'context':_0x57c571[_0x2f3a67][0x0]['context'],'exten':_0x57c571[_0x2f3a67][0x0]['exten'],'priority':_0x44504f['priority']++,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});for(var _0x10a801=0x0,_0x80c077=0x0;_0x10a801<_0x57c571[_0x2f3a67]['length'];_0x10a801+=0x1,_0x80c077=0x0){var _0x50ee66=_0x57c571[_0x2f3a67][_0x10a801];if(_0x50ee66[_0xe25d('0x15')]){_0x50ee66['type']=_0x50ee66['type']['toLowerCase']();}var _0x34bd9f=[];var _0x3a4c2e=[];delete _0x50ee66['id'];delete _0x50ee66[_0xe25d('0x2a')];delete _0x50ee66[_0xe25d('0x2b')];var _0xfc5bcc=_0x50ee66['interval']!==_0xe25d('0x2c')?[_0x50ee66['interval']]:_0x50ee66[_0xe25d('0x6')]?_['map'](_['filter'](_0x44504f[_0xe25d('0x5')],{'IntervalId':_0x50ee66['IntervalId']}),_0xe25d('0x2d')):[];if(_0x50ee66['hasOwnProperty'](_0xe25d('0x2e'))){if(_0x50ee66['tag']&&_0x50ee66[_0xe25d('0x2e')]!=='--'){_0x34bd9f[_0xe25d('0x14')]({'type':_0x50ee66['type'],'app':'Set','appdata':'CDR(tag)='+_0x50ee66[_0xe25d('0x2e')],'context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66['exten'],'priority':_0xfc5bcc['length']+_0x44504f[_0xe25d('0x10')]+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});}}if(_0x50ee66['type']===_0xe25d('0x1a')&&_0x50ee66[_0xe25d('0xf')](_0xe25d('0x2f'))){if(_0x50ee66[_0xe25d('0x2f')]){_0x34bd9f[_0xe25d('0x14')]({'type':_0x50ee66[_0xe25d('0x15')],'app':_0xe25d('0x1f'),'appdata':_0xe25d('0x30')+_0x50ee66['callerID']+')','context':_0x50ee66['context'],'exten':_0x50ee66[_0xe25d('0xa')],'priority':_0xfc5bcc['length']+_0x44504f['priority']+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});}else{_0x34bd9f['push']({'type':_0x50ee66[_0xe25d('0x15')],'app':'ExecIf','appdata':_0xe25d('0x31'),'context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66[_0xe25d('0xa')],'priority':_0xfc5bcc[_0xe25d('0x32')]+_0x44504f[_0xe25d('0x10')]+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});}}if(_0x50ee66[_0xe25d('0xf')](_0xe25d('0x33'))){if(_0x1b1064[_0xe25d('0x34')](_0x50ee66[_0xe25d('0x35')][_0xe25d('0x36')]())>=0x0&&_0x50ee66[_0xe25d('0x37')]!==_0xe25d('0x38')){if(_0x50ee66['answer']){_0x34bd9f[_0xe25d('0x14')]({'type':_0x50ee66['type'],'app':'ExecIf','appdata':_0xe25d('0x39'),'context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66[_0xe25d('0xa')],'priority':_0xfc5bcc[_0xe25d('0x32')]+_0x44504f[_0xe25d('0x10')]+_0x80c077++,'VoiceExtensionId':_0x50ee66['VoiceExtensionId']});_0x34bd9f['push']({'type':_0x50ee66[_0xe25d('0x15')],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x3a'),'context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66[_0xe25d('0xa')],'priority':_0xfc5bcc['length']+_0x44504f['priority']+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});}else{_0x34bd9f[_0xe25d('0x14')]({'type':_0x50ee66[_0xe25d('0x15')],'app':_0xe25d('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66['exten'],'priority':_0xfc5bcc['length']+_0x44504f[_0xe25d('0x10')]+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});_0x34bd9f['push']({'type':_0x50ee66['type'],'app':_0xe25d('0x16'),'appdata':_0xe25d('0x3b'),'context':_0x50ee66[_0xe25d('0x17')],'exten':_0x50ee66[_0xe25d('0xa')],'priority':_0xfc5bcc['length']+_0x44504f[_0xe25d('0x10')]+_0x80c077++,'VoiceExtensionId':_0x50ee66[_0xe25d('0x18')]});}}}for(var _0x531c5d=0x0;_0x531c5d<_0xfc5bcc[_0xe25d('0x32')];_0x531c5d+=0x1){var _0x3c4e0a=_0x44504f[_0xe25d('0x10')]+_0xfc5bcc[_0xe25d('0x32')];var _0x589854=_0x531c5d===_0xfc5bcc[_0xe25d('0x32')]-0x1?_0x44504f[_0xe25d('0x10')]+_0x34bd9f['length']+_0x3a4c2e[_0xe25d('0x32')]+0x2:_0x44504f[_0xe25d('0x10')]+_0x531c5d+0x1;_0x34bd9f[_0xe25d('0x3c')](_0x531c5d,0x0,{'type':_0x50ee66[_0xe25d('0x15')],'app':'GotoIfTime','appdata':_0xfc5bcc[_0x531c5d]+'?'+_0x50ee66['context']+_0xe25d('0x3d')+_0x3c4e0a+':'+_0x50ee66[_0xe25d('0x17')]+_0xe25d('0x3d')+_0x589854,'exten':_0x50ee66[_0xe25d('0xa')],'context':_0x50ee66[_0xe25d('0x17')],'priority':_0x44504f[_0xe25d('0x10')]+_0x531c5d,'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});}_0x50ee66[_0xe25d('0x10')]=_0x34bd9f['length']?_[_0xe25d('0x3e')](_0x34bd9f)[_0xe25d('0x10')]+0x1:_0x44504f[_0xe25d('0x10')];_0x44504f[_0xe25d('0x10')]=(_0x3a4c2e[_0xe25d('0x32')]?_[_0xe25d('0x3e')](_0x3a4c2e)[_0xe25d('0x10')]:_0x50ee66[_0xe25d('0x10')])+0x1;_0x44504f[_0xe25d('0x11')]=_['concat'](_0x44504f[_0xe25d('0x11')],_0x34bd9f,[_0x50ee66],_0x3a4c2e);}_0x44504f[_0xe25d('0x11')]['push']({'type':_0x57c571[_0x2f3a67][0x0]['type'],'app':'Hangup','exten':_0x57c571[_0x2f3a67][0x0][_0xe25d('0xa')],'context':_0x57c571[_0x2f3a67][0x0]['context'],'priority':_0x44504f[_0xe25d('0x10')],'VoiceExtensionId':_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]});_0x1f145b['push'](_0x57c571[_0x2f3a67][0x0][_0xe25d('0x18')]);_0x3791fc=_[_0xe25d('0x3f')](_0x3791fc,_0x44504f[_0xe25d('0x11')]);}}return _0x20ae04[_0xe25d('0x40')](function(_0x9d1c2c){return _0x20ae04['models'][_0xe25d('0x7')][_0xe25d('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1f145b}},'transaction':_0x9d1c2c})[_0xe25d('0x4')](function(_0x38e65e){return _0x20ae04[_0xe25d('0x1')][_0xe25d('0x7')][_0xe25d('0x42')](_['sortBy'](_0x3791fc,_0xe25d('0x10')),{'transaction':_0x9d1c2c});});});})[_0xe25d('0x43')](function(_0x135206){console[_0xe25d('0x44')](_0x135206);});}exports[_0xe25d('0x45')]=rewrite; \ No newline at end of file +var _0xe373=['custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','VoiceExtension','destroy','bulkCreate','sortBy','lodash','util','findAll','then','IntervalId','models','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','appType'];(function(_0x2be60a,_0x14f736){var _0x2d61a5=function(_0x20c766){while(--_0x20c766){_0x2be60a['push'](_0x2be60a['shift']());}};_0x2d61a5(++_0x14f736);}(_0xe373,0x1a6));var _0x3e37=function(_0x3b17bd,_0x4c3653){_0x3b17bd=_0x3b17bd-0x0;var _0x34c0ec=_0xe373[_0x3b17bd];return _0x34c0ec;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));function rewrite(_0x374ce1,_0x534334){var _0x33bef3=this;return _0x374ce1['models']['Interval'][_0x3e37('0x2')]({'raw':!![]})[_0x3e37('0x3')](function(_0x584975){_0x33bef3['intervals']=_0x584975;return _0x374ce1['models']['VoiceExtension'][_0x3e37('0x2')]({'where':{'IntervalId':_0x534334[_0x3e37('0x4')]},'raw':!![]});})['then'](function(_0x3af3c8){return _0x374ce1[_0x3e37('0x5')]['VoiceExtension'][_0x3e37('0x2')]({'where':{'exten':{'$in':_[_0x3e37('0x6')](_['map'](_0x3af3c8,_0x3e37('0x7')))}},'order':[{'raw':_0x3e37('0x8')}],'raw':!![]});})['then'](function(_0x16e5a0){var _0xcb7111=_[_0x3e37('0x9')](_0x16e5a0,{'priority':'1'});var _0x267744=_[_0x3e37('0x9')](_0x16e5a0,{'isApp':0x1});var _0x1427ee=_[_0x3e37('0xa')](_0x267744,_0x3e37('0x7'));var _0x33c6f2=[_0x3e37('0xb'),'playback'];var _0x2cab50=[];var _0x59cf30=[];for(var _0x31a52c in _0x1427ee){if(_0x1427ee[_0x3e37('0xc')](_0x31a52c)){_0x33bef3[_0x3e37('0xd')]=0x2;_0x33bef3[_0x3e37('0xe')]=[];_0x33bef3[_0x3e37('0xf')]=_[_0x3e37('0x10')](_0xcb7111,{'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')]});_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':'Set','appdata':util[_0x3e37('0x13')](_0x3e37('0x14'),_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')]),'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0]['exten'],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});if(_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')]==='inbound'){_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x18')+_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')],'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});}else if(_0x1427ee[_0x31a52c][0x0]['type']===_0x3e37('0x19')){if(_0x33bef3[_0x3e37('0xf')]){_0x33bef3['extensions']['push']({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x1a')+(_0x33bef3[_0x3e37('0xf')][_0x3e37('0x1b')]?_0x3e37('0x1c')+_0x33bef3['extension'][_0x3e37('0x1b')]+'}':_0x3e37('0x1d')),'context':_0x1427ee[_0x31a52c][0x0]['context'],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});}_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x18')+_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')],'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});var _0x2184cd=_0x33bef3['priority']++;_0x33bef3[_0x3e37('0xe')]['push']({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2184cd+0x2)+_0x3e37('0x1f')+(_0x2184cd+0x1)+')','context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x2184cd,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});if(_0x33bef3[_0x3e37('0xf')]){_0x33bef3[_0x3e37('0xe')]['push']({'type':_0x1427ee[_0x31a52c][0x0]['type'],'app':_0x3e37('0x17'),'appdata':_0x33bef3[_0x3e37('0xf')][_0x3e37('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x33bef3['extension'][_0x3e37('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3['priority']++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});}_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x20')+_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')],'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});if(_0x33bef3[_0x3e37('0xf')]&&_0x33bef3[_0x3e37('0xf')][_0x3e37('0xc')](_0x3e37('0x21'))&&_0x33bef3['extension'][_0x3e37('0x21')]!==_0x3e37('0x22')){_0x33bef3[_0x3e37('0xe')]['push']({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x23'),'context':_0x1427ee[_0x31a52c][0x0]['context'],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3['priority']++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});_0x33bef3[_0x3e37('0xe')]['push']({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':'Set','appdata':_0x3e37('0x24')+_0x33bef3[_0x3e37('0xf')][_0x3e37('0x21')]||_0x3e37('0x25'),'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});}}_0x33bef3['extensions']['push']({'type':_0x1427ee[_0x31a52c][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3['priority']++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});_0x33bef3['extensions'][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x26'),'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0]['exten'],'priority':_0x33bef3['priority']++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x27'),'context':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x15')],'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'priority':_0x33bef3[_0x3e37('0xd')]++,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']});for(var _0x5b5ae3=0x0,_0x5e2ea3=0x0;_0x5b5ae3<_0x1427ee[_0x31a52c]['length'];_0x5b5ae3+=0x1,_0x5e2ea3=0x0){var _0x57828e=_0x1427ee[_0x31a52c][_0x5b5ae3];if(_0x57828e[_0x3e37('0x12')]){_0x57828e[_0x3e37('0x12')]=_0x57828e[_0x3e37('0x12')][_0x3e37('0x28')]();}var _0x2471bb=[];var _0x389592=[];delete _0x57828e['id'];delete _0x57828e[_0x3e37('0x29')];delete _0x57828e[_0x3e37('0x2a')];var _0x1eb5d2=_0x57828e[_0x3e37('0x2b')]!==_0x3e37('0x2c')?[_0x57828e['interval']]:_0x57828e[_0x3e37('0x4')]?_[_0x3e37('0x2d')](_[_0x3e37('0x9')](_0x33bef3[_0x3e37('0x2e')],{'IntervalId':_0x57828e[_0x3e37('0x4')]}),_0x3e37('0x2b')):[];if(_0x57828e[_0x3e37('0xc')]('tag')){if(_0x57828e[_0x3e37('0x2f')]&&_0x57828e[_0x3e37('0x2f')]!=='--'){_0x2471bb['push']({'type':_0x57828e[_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x30')+_0x57828e['tag'],'context':_0x57828e[_0x3e37('0x15')],'exten':_0x57828e['exten'],'priority':_0x1eb5d2[_0x3e37('0x31')]+_0x33bef3['priority']+_0x5e2ea3++,'VoiceExtensionId':_0x57828e['VoiceExtensionId']});}}if(_0x57828e['type']==='outbound'&&_0x57828e[_0x3e37('0xc')](_0x3e37('0x32'))){if(_0x57828e['callerID']){_0x2471bb[_0x3e37('0x11')]({'type':_0x57828e[_0x3e37('0x12')],'app':_0x3e37('0x1e'),'appdata':_0x3e37('0x33')+_0x57828e[_0x3e37('0x32')]+')','context':_0x57828e['context'],'exten':_0x57828e[_0x3e37('0x7')],'priority':_0x1eb5d2[_0x3e37('0x31')]+_0x33bef3['priority']+_0x5e2ea3++,'VoiceExtensionId':_0x57828e[_0x3e37('0x16')]});}else{_0x2471bb[_0x3e37('0x11')]({'type':_0x57828e['type'],'app':'ExecIf','appdata':_0x3e37('0x34'),'context':_0x57828e[_0x3e37('0x15')],'exten':_0x57828e[_0x3e37('0x7')],'priority':_0x1eb5d2[_0x3e37('0x31')]+_0x33bef3[_0x3e37('0xd')]+_0x5e2ea3++,'VoiceExtensionId':_0x57828e[_0x3e37('0x16')]});}}if(_0x57828e[_0x3e37('0xc')]('answer')){if(_0x33c6f2['indexOf'](_0x57828e['app'][_0x3e37('0x28')]())>=0x0&&_0x57828e[_0x3e37('0x35')]!==_0x3e37('0x36')){if(_0x57828e[_0x3e37('0x37')]){_0x2471bb['push']({'type':_0x57828e['type'],'app':_0x3e37('0x1e'),'appdata':_0x3e37('0x38'),'context':_0x57828e['context'],'exten':_0x57828e[_0x3e37('0x7')],'priority':_0x1eb5d2[_0x3e37('0x31')]+_0x33bef3['priority']+_0x5e2ea3++,'VoiceExtensionId':_0x57828e[_0x3e37('0x16')]});_0x2471bb[_0x3e37('0x11')]({'type':_0x57828e[_0x3e37('0x12')],'app':'Set','appdata':_0x3e37('0x39'),'context':_0x57828e[_0x3e37('0x15')],'exten':_0x57828e[_0x3e37('0x7')],'priority':_0x1eb5d2[_0x3e37('0x31')]+_0x33bef3[_0x3e37('0xd')]+_0x5e2ea3++,'VoiceExtensionId':_0x57828e['VoiceExtensionId']});}else{_0x2471bb[_0x3e37('0x11')]({'type':_0x57828e['type'],'app':_0x3e37('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x57828e[_0x3e37('0x15')],'exten':_0x57828e[_0x3e37('0x7')],'priority':_0x1eb5d2['length']+_0x33bef3[_0x3e37('0xd')]+_0x5e2ea3++,'VoiceExtensionId':_0x57828e[_0x3e37('0x16')]});_0x2471bb[_0x3e37('0x11')]({'type':_0x57828e[_0x3e37('0x12')],'app':_0x3e37('0x17'),'appdata':_0x3e37('0x3a'),'context':_0x57828e[_0x3e37('0x15')],'exten':_0x57828e['exten'],'priority':_0x1eb5d2['length']+_0x33bef3[_0x3e37('0xd')]+_0x5e2ea3++,'VoiceExtensionId':_0x57828e['VoiceExtensionId']});}}}for(var _0x25dbc6=0x0;_0x25dbc6<_0x1eb5d2[_0x3e37('0x31')];_0x25dbc6+=0x1){var _0x36ab05=_0x33bef3[_0x3e37('0xd')]+_0x1eb5d2[_0x3e37('0x31')];var _0x27af33=_0x25dbc6===_0x1eb5d2[_0x3e37('0x31')]-0x1?_0x33bef3[_0x3e37('0xd')]+_0x2471bb[_0x3e37('0x31')]+_0x389592['length']+0x2:_0x33bef3[_0x3e37('0xd')]+_0x25dbc6+0x1;_0x2471bb[_0x3e37('0x3b')](_0x25dbc6,0x0,{'type':_0x57828e[_0x3e37('0x12')],'app':_0x3e37('0x3c'),'appdata':_0x1eb5d2[_0x25dbc6]+'?'+_0x57828e['context']+_0x3e37('0x3d')+_0x36ab05+':'+_0x57828e[_0x3e37('0x15')]+_0x3e37('0x3d')+_0x27af33,'exten':_0x57828e['exten'],'context':_0x57828e[_0x3e37('0x15')],'priority':_0x33bef3[_0x3e37('0xd')]+_0x25dbc6,'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});}_0x57828e['priority']=_0x2471bb[_0x3e37('0x31')]?_[_0x3e37('0x3e')](_0x2471bb)[_0x3e37('0xd')]+0x1:_0x33bef3[_0x3e37('0xd')];_0x33bef3[_0x3e37('0xd')]=(_0x389592[_0x3e37('0x31')]?_[_0x3e37('0x3e')](_0x389592)[_0x3e37('0xd')]:_0x57828e[_0x3e37('0xd')])+0x1;_0x33bef3[_0x3e37('0xe')]=_['concat'](_0x33bef3[_0x3e37('0xe')],_0x2471bb,[_0x57828e],_0x389592);}_0x33bef3[_0x3e37('0xe')][_0x3e37('0x11')]({'type':_0x1427ee[_0x31a52c][0x0]['type'],'app':_0x3e37('0x3f'),'exten':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x7')],'context':_0x1427ee[_0x31a52c][0x0]['context'],'priority':_0x33bef3[_0x3e37('0xd')],'VoiceExtensionId':_0x1427ee[_0x31a52c][0x0][_0x3e37('0x16')]});_0x2cab50[_0x3e37('0x11')](_0x1427ee[_0x31a52c][0x0]['VoiceExtensionId']);_0x59cf30=_['concat'](_0x59cf30,_0x33bef3[_0x3e37('0xe')]);}}return _0x374ce1['transaction'](function(_0x47a8a2){return _0x374ce1[_0x3e37('0x5')][_0x3e37('0x40')][_0x3e37('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2cab50}},'transaction':_0x47a8a2})[_0x3e37('0x3')](function(_0x3f9dfa){return _0x374ce1['models'][_0x3e37('0x40')][_0x3e37('0x42')](_[_0x3e37('0x43')](_0x59cf30,_0x3e37('0xd')),{'transaction':_0x47a8a2});});});})['catch'](function(_0x107a2b){console['error'](_0x107a2b);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index bda361a..34b944d 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 _0x98c2=['api','redis','defaults','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','always','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger'];(function(_0x1bf89a,_0x2a2949){var _0x198910=function(_0x171142){while(--_0x171142){_0x1bf89a['push'](_0x1bf89a['shift']());}};_0x198910(++_0x2a2949);}(_0x98c2,0xdc));var _0x298c=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x98c2[_0xbb091];return _0x467a04;};'use strict';var BPromise=require(_0x298c('0x0'));var util=require('util');var _=require(_0x298c('0x1'));var fs=require('fs');var squel=require(_0x298c('0x2'));var Papa=require(_0x298c('0x3'));var Redis=require(_0x298c('0x4'));var db=require(_0x298c('0x5'))['db'];var config=require(_0x298c('0x6'));var logger=require(_0x298c('0x7'))(_0x298c('0x8'));config[_0x298c('0x9')]=_[_0x298c('0xa')](config[_0x298c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x298c('0xb'))(new Redis(config[_0x298c('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x298c('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x298c('0xd')][0x2]==='undefined'||process[_0x298c('0xd')][0x2]===_0x298c('0xe')){throw new Error(_0x298c('0xf'));}var FILEPATH=process[_0x298c('0xd')][0x2];if(!process[_0x298c('0xd')][0x3]||process[_0x298c('0xd')][0x3]===_0x298c('0x10')||process[_0x298c('0xd')][0x3]==='null'||!process['argv'][0x4]||process[_0x298c('0xd')][0x4]===_0x298c('0x10')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x298c('0x11')](process[_0x298c('0xd')][0x3][_0x298c('0x12')](','),process[_0x298c('0xd')][0x4]['split'](','));if(!process[_0x298c('0xd')][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x298c('0xe')){throw new Error(_0x298c('0x13'));}var LISTID=process[_0x298c('0xd')][0x5];var COMPANYID=process[_0x298c('0xd')][0x6]&&process[_0x298c('0xd')][0x6]!==_0x298c('0x10')&&process[_0x298c('0xd')][0x6]!==_0x298c('0xe')?process[_0x298c('0xd')][0x6]:null;var DUPLICATES=process[_0x298c('0xd')][0x7]&&process['argv'][0x7]!==_0x298c('0x10')&&process['argv'][0x7]!==_0x298c('0xe')?process[_0x298c('0xd')][0x7]:null;if(!process[_0x298c('0xd')][0x8]||process[_0x298c('0xd')][0x8]===_0x298c('0x10')||process[_0x298c('0xd')][0x8]===_0x298c('0xe')){throw new Error(_0x298c('0x14'));}var SOCKET_TIMESTAMP=process[_0x298c('0xd')][0x8];}catch(_0x22b5c4){logger[_0x298c('0x15')](_0x22b5c4);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(_0x4933c5,_0x3df63b,_0xcaf226,_0x46eb75){var _0x3c8a2d={'message':_0x3df63b};_0x3c8a2d[_0x4933c5]=!![];if(_0xcaf226){_0x3c8a2d['contact']=_0xcaf226;}if(_0x46eb75){_0x3c8a2d[_0x298c('0x16')]=_0x46eb75;}return _0x3c8a2d;}function isEmail(_0x25914d){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))*$/[_0x298c('0x17')](_0x25914d);}function checkRow(_0xb3ccc7,_0x53c7f4,_0x28b36b){return new BPromise(function(_0xaa851c,_0x21127b){if(_['isNil'](_0xb3ccc7)){return _0x21127b(handleCheckRowError('error',_0x298c('0x18'),null,_0x28b36b));}if(_0xb3ccc7[_0x298c('0x19')]&&_0xb3ccc7['errors'][_0x298c('0x1a')]){var _0x389793=_[_0x298c('0x1b')](_0xb3ccc7[_0x298c('0x19')],_0x298c('0x1c'))[_0x298c('0x1d')](';');return _0x21127b(handleCheckRowError(_0x298c('0x15'),_0x389793,null,_0x28b36b));}var _0x226ea8={};for(var _0x4c4360 in FIELDS){if(FIELDS[_0x298c('0x1e')](_0x4c4360)&&FIELDS[_0x4c4360]){_0x226ea8[_0x4c4360]=_0xb3ccc7[_0x298c('0x1f')][0x0][FIELDS[_0x4c4360]]||_0xb3ccc7[_0x298c('0x1f')][0x0]['\ufeff'+FIELDS[_0x4c4360]];}}if(!_0x226ea8['firstName']){return _0x21127b(handleCheckRowError(_0x298c('0x15'),_0x298c('0x20'),null,_0x28b36b));}if(!_0x226ea8[_0x298c('0x21')]){return _0x21127b(handleCheckRowError('error',_0x298c('0x22'),null,_0x28b36b));}if(_0x226ea8[_0x298c('0x23')]){var _0x35537a=moment(_0x226ea8[_0x298c('0x23')],_0x298c('0x24'));if(!_0x35537a[_0x298c('0x25')]()){return _0x21127b(handleCheckRowError('error',_0x298c('0x26'),null,_0x28b36b));}}if(_0x226ea8['email']){if(!isEmail(_0x226ea8[_0x298c('0x27')])){return _0x21127b(handleCheckRowError(_0x298c('0x15'),_0x298c('0x28'),null,_0x28b36b));}}_0x226ea8[_0x298c('0x29')]=LISTID;_0x226ea8[_0x298c('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x298c('0x1a')]&&_0x53c7f4){var _0x2fe800={};for(var _0x5c7df3=0x0,_0x3d6015=DUPLICATES[_0x298c('0x1a')];_0x5c7df3<_0x3d6015;_0x5c7df3+=0x1){_0x2fe800[DUPLICATES[_0x5c7df3]]=_0x226ea8[DUPLICATES[_0x5c7df3]];}var _0x1c04cd=_[_0x298c('0x2b')](_0x53c7f4,_0x2fe800);if(_0x1c04cd){return _0x21127b(handleCheckRowError(_0x298c('0x2c'),_0x298c('0x2d'),_0x1c04cd,_0x28b36b));}}return db[_0x298c('0x2e')][_0x298c('0x2f')](_0x226ea8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x226ea8)})[_0x298c('0x30')](function(_0x53bb68){if(DUPLICATES&&DUPLICATES[_0x298c('0x1a')]&&_0x53c7f4){_0x53c7f4[_0x298c('0x31')](_[_0x298c('0x32')](_0x226ea8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x53bb68['id'];return _0xaa851c();})[_0x298c('0x33')](function(_0x593664){return _0x21127b(handleCheckRowError(_0x298c('0x15'),_0x298c('0x34')+(_0x593664[_0x298c('0x1c')]||JSON[_0x298c('0x35')](_0x593664)),null,_0x28b36b));});});}function checkHopper(){function _0x9222e9(){return function(_0x2a9ecf){logger[_0x298c('0x15')](_0x298c('0x36'),_0x298c('0x37'),util[_0x298c('0x38')](_0x2a9ecf,{'showHidden':![],'depth':null}));};}var _0x6ed99b=function(_0x1a6d9d,_0x3076f5){var _0x3d903c=squel[_0x298c('0x39')]()[_0x298c('0x3a')](_0x298c('0x3b'))[_0x298c('0x3c')](['phone',_0x298c('0x3d'),_0x298c('0x3e'),_0x298c('0x29'),_0x3076f5,'createdAt',_0x298c('0x3f')],squel[_0x298c('0x40')]()[_0x298c('0x41')](_0x298c('0x21'),_0x298c('0x21'))[_0x298c('0x41')](_0x298c('0x42'),_0x298c('0x3d'))[_0x298c('0x41')]('id',_0x298c('0x3e'))['field'](LISTID[_0x298c('0x43')](),'ListId')['field'](_0x1a6d9d['id']['toString'](),_0x3076f5)[_0x298c('0x41')](_0x298c('0x42'),_0x298c('0x44'))[_0x298c('0x41')](_0x298c('0x42'),_0x298c('0x3f'))[_0x298c('0x45')](_0x298c('0x46'))[_0x298c('0x47')](_0x298c('0x48'))[_0x298c('0x47')](_0x298c('0x49'),LISTID['toString']())[_0x298c('0x47')](_0x298c('0x4a'))[_0x298c('0x47')](_0x298c('0x4b'),squel[_0x298c('0x40')]()['field'](_0x298c('0x21'))[_0x298c('0x45')](_0x298c('0x3b'))[_0x298c('0x47')](_0x3076f5+_0x298c('0x4c'),_0x1a6d9d['id'][_0x298c('0x43')]())))['toString']();return _0x3d903c;};var _0xa46fc8=function(_0x5b219b,_0xd9d614){var _0x4af30e=squel[_0x298c('0x39')]()[_0x298c('0x3a')](_0x298c('0x3b'))[_0x298c('0x3c')]([_0x298c('0x21'),'scheduledAt','ContactId','ListId',_0xd9d614,_0x298c('0x44'),_0x298c('0x3f')],squel[_0x298c('0x40')]()['field'](_0x298c('0x21'),_0x298c('0x21'))['field'](_0x298c('0x42'),'scheduledAt')[_0x298c('0x41')]('id',_0x298c('0x3e'))[_0x298c('0x41')](LISTID[_0x298c('0x43')](),_0x298c('0x29'))['field'](_0x5b219b['id']['toString'](),_0xd9d614)[_0x298c('0x41')]('NOW()',_0x298c('0x44'))['field'](_0x298c('0x42'),_0x298c('0x3f'))['from'](_0x298c('0x46'))['where'](_0x298c('0x48'))[_0x298c('0x47')]('ListId\x20=\x20?',LISTID['toString']())[_0x298c('0x47')](_0x298c('0x4d'),squel[_0x298c('0x4e')](hopperContacts))[_0x298c('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0x298c('0x47')](_0x298c('0x4b'),squel[_0x298c('0x40')]()[_0x298c('0x41')](_0x298c('0x4f'))['from'](_0x298c('0x50'))['where'](_0xd9d614+_0x298c('0x4c'),_0x5b219b['id'][_0x298c('0x43')]()))[_0x298c('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x298c('0x40')]()[_0x298c('0x41')](_0x298c('0x21'))[_0x298c('0x45')](_0x298c('0x3b'))[_0x298c('0x47')](_0xd9d614+_0x298c('0x4c'),_0x5b219b['id'][_0x298c('0x43')]())))[_0x298c('0x43')]();return _0x4af30e;};function _0x2a8da1(_0x37f65e,_0x6d1d86){var _0x391b18=squel[_0x298c('0x39')]()[_0x298c('0x3a')](_0x298c('0x3b'))[_0x298c('0x3c')](['phone','scheduledAt',_0x298c('0x3e'),_0x298c('0x29'),_0x6d1d86,_0x298c('0x44'),'updatedAt'],squel[_0x298c('0x40')]()['field']('phone',_0x298c('0x21'))['field']('NOW()',_0x298c('0x3d'))[_0x298c('0x41')]('id','ContactId')[_0x298c('0x41')](LISTID[_0x298c('0x43')](),'ListId')['field'](_0x37f65e['id'][_0x298c('0x43')](),_0x6d1d86)[_0x298c('0x41')](_0x298c('0x42'),_0x298c('0x44'))['field'](_0x298c('0x42'),_0x298c('0x3f'))[_0x298c('0x45')](_0x298c('0x46'))[_0x298c('0x47')](_0x298c('0x48'))[_0x298c('0x47')](_0x298c('0x49'),LISTID['toString']())[_0x298c('0x47')](_0x298c('0x4d'),squel['str'](hopperContacts))[_0x298c('0x47')](_0x298c('0x4a')))[_0x298c('0x43')]();return _0x391b18;}function _0x4395a8(_0x392e3e,_0x219667){var _0x1d3970=squel[_0x298c('0x39')]()[_0x298c('0x3a')](_0x298c('0x51'))[_0x298c('0x3c')]([_0x298c('0x21'),_0x298c('0x3e'),_0x298c('0x29'),_0x219667,_0x298c('0x44'),_0x298c('0x3f')],squel[_0x298c('0x40')]()[_0x298c('0x41')](_0x298c('0x21'),_0x298c('0x21'))[_0x298c('0x41')]('id',_0x298c('0x3e'))[_0x298c('0x41')](LISTID['toString'](),_0x298c('0x29'))['field'](_0x392e3e['id'][_0x298c('0x43')](),_0x219667)[_0x298c('0x41')](_0x298c('0x42'),_0x298c('0x44'))[_0x298c('0x41')](_0x298c('0x42'),'updatedAt')[_0x298c('0x45')](_0x298c('0x46'))[_0x298c('0x47')](_0x298c('0x48'))[_0x298c('0x47')](_0x298c('0x49'),LISTID['toString']())[_0x298c('0x47')](_0x298c('0x4d'),squel[_0x298c('0x4e')](hopperContacts))[_0x298c('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x298c('0x43')]();return _0x1d3970;}return db[_0x298c('0x52')][_0x298c('0x53')]({'where':{'type':_0x298c('0x54')},'attributes':['id',_0x298c('0x55')],'include':[{'model':db[_0x298c('0x56')],'as':_0x298c('0x57'),'where':{'id':LISTID}}]})[_0x298c('0x30')](function(_0x4a819c){var _0x4f5e16=[];if(_0x4a819c){var _0x53692b;for(var _0x51e42b=0x0,_0x41c052;_0x51e42b<_0x4a819c['length'];_0x51e42b+=0x1){_0x41c052=_0x4a819c[_0x51e42b][_0x298c('0x58')]({'plain':!![]});switch(_0x41c052[_0x298c('0x55')]){case'always':_0x4f5e16['push'](db[_0x298c('0x59')][_0x298c('0x5a')](_0xa46fc8(_0x41c052,_0x298c('0x5b')))['then'](function(){})[_0x298c('0x33')](_0x9222e9()));break;case _0x298c('0x5c'):_0x4f5e16[_0x298c('0x31')](db['sequelize']['query'](_0x6ed99b(_0x41c052,_0x298c('0x5b')))[_0x298c('0x30')](function(){})[_0x298c('0x33')](_0x9222e9()));break;default:_0x4f5e16[_0x298c('0x31')](db[_0x298c('0x59')][_0x298c('0x5a')](_0x2a8da1(_0x41c052,_0x298c('0x5b')))[_0x298c('0x30')](function(){})[_0x298c('0x33')](_0x9222e9()));}}}return _0x4f5e16;})[_0x298c('0x5d')]()[_0x298c('0x30')](function(){return db[_0x298c('0x52')][_0x298c('0x53')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x298c('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x25db61){var _0x48341c=[];if(_0x25db61){var _0x16267d;for(var _0x259261=0x0,_0x14e2c5;_0x259261<_0x25db61[_0x298c('0x1a')];_0x259261+=0x1){_0x14e2c5=_0x25db61[_0x259261][_0x298c('0x58')]({'plain':!![]});_0x48341c['push'](db[_0x298c('0x59')][_0x298c('0x5a')](_0x4395a8(_0x14e2c5,'VoiceQueueId'))[_0x298c('0x30')](function(){})[_0x298c('0x33')](_0x9222e9()));}}return _0x48341c;})[_0x298c('0x5d')]();})['then'](function(){return db['Campaign'][_0x298c('0x53')]({'attributes':['id',_0x298c('0x55')],'include':[{'model':db[_0x298c('0x56')],'as':_0x298c('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x1dea7e){var _0x14ea0a=[];if(_0x1dea7e){for(var _0x215857=0x0,_0x3c2767;_0x215857<_0x1dea7e[_0x298c('0x1a')];_0x215857+=0x1){_0x3c2767=_0x1dea7e[_0x215857][_0x298c('0x58')]({'plain':!![]});switch(_0x3c2767[_0x298c('0x55')]){case _0x298c('0x5e'):_0x14ea0a['push'](db[_0x298c('0x59')][_0x298c('0x5a')](_0xa46fc8(_0x3c2767,_0x298c('0x5f')))[_0x298c('0x30')](function(){})[_0x298c('0x33')](_0x9222e9()));break;case _0x298c('0x5c'):_0x14ea0a[_0x298c('0x31')](db[_0x298c('0x59')]['query'](_0x6ed99b(_0x3c2767,_0x298c('0x5f')))['then'](function(){})['catch'](_0x9222e9()));break;default:_0x14ea0a[_0x298c('0x31')](db[_0x298c('0x59')][_0x298c('0x5a')](_0x2a8da1(_0x3c2767,_0x298c('0x5f')))['then'](function(){})[_0x298c('0x33')](_0x9222e9()));}}}return _0x14ea0a;})['all']();})[_0x298c('0x30')](function(){return db[_0x298c('0x60')][_0x298c('0x53')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x298c('0x61'),'where':{'id':LISTID}}]})[_0x298c('0x30')](function(_0x9b4a36){var _0x80373d=[];if(_0x9b4a36){for(var _0x1d3c2c=0x0,_0x12d977;_0x1d3c2c<_0x9b4a36[_0x298c('0x1a')];_0x1d3c2c+=0x1){_0x12d977=_0x9b4a36[_0x1d3c2c][_0x298c('0x58')]({'plain':!![]});_0x80373d[_0x298c('0x31')](db[_0x298c('0x59')][_0x298c('0x5a')](_0x4395a8(_0x12d977,'CampaignId'))[_0x298c('0x30')](function(){})[_0x298c('0x33')](_0x9222e9()));}}return _0x80373d;})[_0x298c('0x5d')]();})[_0x298c('0x33')](function(_0x144d95){logger[_0x298c('0x15')](_0x298c('0x62'),'generalCheckHopper',_0x144d95[_0x298c('0x1c')]);});}var processPromises=function(_0x46d94){return BPromise['all'](promises)['then'](function(_0x43514a){})[_0x298c('0x33')](function(_0xce1172){logger[_0x298c('0x15')](_0x298c('0x63'),JSON['stringify'](_0xce1172));})[_0x298c('0x64')](function(){socket[_0x298c('0x65')](_0x298c('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46d94){return _0x46d94[_0x298c('0x67')]();}});};var endCsv=function(){return BPromise[_0x298c('0x68')]()[_0x298c('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x298c('0x30')](function(){socket[_0x298c('0x65')](_0x298c('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x298c('0x69')](FILEPATH);}catch(_0x404bca){logger[_0x298c('0x15')](_0x298c('0x6a'),JSON[_0x298c('0x35')](_0x404bca));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x298c('0x6b')](_0x298c('0x6c'));endCsv();});function main(){return BPromise[_0x298c('0x68')]()[_0x298c('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x298c('0x12')](',');return db['CmContact'][_0x298c('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x13fd92){var _0x251a96=fs[_0x298c('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x298c('0x6e')](_0x251a96,{'header':!![],'skipEmptyLines':!![],'step':function(_0x106699,_0x24a9ab){total+=0x1;var _0x385b49=total;promises[_0x298c('0x31')](checkRow(_0x106699,_0x13fd92,_0x385b49)[_0x298c('0x30')](function(){success+=0x1;})[_0x298c('0x33')](function(_0x3f4077){if(_0x3f4077[_0x298c('0x15')]){errors+=0x1;delete _0x3f4077['error'];}else if(_0x3f4077[_0x298c('0x2c')]){duplicates+=0x1;delete _0x3f4077[_0x298c('0x2c')];}rows[_0x298c('0x31')](_0x3f4077);}));if(total%0xc8===0x0){_0x24a9ab[_0x298c('0x6f')]();return processPromises(_0x24a9ab);}},'complete':function(){return processPromises()[_0x298c('0x30')](function(){logger[_0x298c('0x6b')](_0x298c('0x70'));endCsv();});},'error':function(_0x19c1c0,_0x1041ef){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x19c1c0));endCsv();}});})[_0x298c('0x33')](function(_0x1a8e56){logger[_0x298c('0x15')](_0x298c('0x71'),JSON['stringify'](_0x1a8e56));});}main(); \ No newline at end of file +var _0xd59c=['firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','ListId','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','VoiceQueue','outbound','CmList','Lists','get','sequelize','query','onlyIfOpen','catch','all','BlackLists','VoiceQueueId','Campaign','findAll','dialCheckDuplicateType','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','localhost','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join'];(function(_0x937649,_0x1c91ee){var _0x2acaeb=function(_0x43bfc7){while(--_0x43bfc7){_0x937649['push'](_0x937649['shift']());}};_0x2acaeb(++_0x1c91ee);}(_0xd59c,0x123));var _0xcd59=function(_0x17ef27,_0x229051){_0x17ef27=_0x17ef27-0x0;var _0x182267=_0xd59c[_0x17ef27];return _0x182267;};'use strict';var BPromise=require(_0xcd59('0x0'));var util=require(_0xcd59('0x1'));var _=require(_0xcd59('0x2'));var fs=require('fs');var squel=require(_0xcd59('0x3'));var Papa=require(_0xcd59('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xcd59('0x5'));var logger=require(_0xcd59('0x6'))(_0xcd59('0x7'));config[_0xcd59('0x8')]=_['defaults'](config[_0xcd59('0x8')],{'host':_0xcd59('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd59('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xcd59('0xa')](socket);try{if(!process[_0xcd59('0xb')][0x2]||process[_0xcd59('0xb')][0x2]==='undefined'||process[_0xcd59('0xb')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xcd59('0xb')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xcd59('0xc')||process['argv'][0x3]===_0xcd59('0xd')||!process[_0xcd59('0xb')][0x4]||process['argv'][0x4]==='undefined'||process[_0xcd59('0xb')][0x4]==='null'){throw new Error(_0xcd59('0xe'));}var FIELDS=_[_0xcd59('0xf')](process['argv'][0x3]['split'](','),process['argv'][0x4][_0xcd59('0x10')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xcd59('0xc')||process['argv'][0x5]===_0xcd59('0xd')){throw new Error(_0xcd59('0x11'));}var LISTID=process[_0xcd59('0xb')][0x5];var COMPANYID=process[_0xcd59('0xb')][0x6]&&process[_0xcd59('0xb')][0x6]!==_0xcd59('0xc')&&process[_0xcd59('0xb')][0x6]!==_0xcd59('0xd')?process[_0xcd59('0xb')][0x6]:null;var DUPLICATES=process[_0xcd59('0xb')][0x7]&&process['argv'][0x7]!==_0xcd59('0xc')&&process['argv'][0x7]!==_0xcd59('0xd')?process['argv'][0x7]:null;if(!process[_0xcd59('0xb')][0x8]||process[_0xcd59('0xb')][0x8]===_0xcd59('0xc')||process[_0xcd59('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xcd59('0xb')][0x8];}catch(_0x19af37){logger[_0xcd59('0x12')](_0x19af37);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(_0x21adfd,_0x3f558b,_0x27b5b2,_0x4b397f){var _0x212fd6={'message':_0x3f558b};_0x212fd6[_0x21adfd]=!![];if(_0x27b5b2){_0x212fd6[_0xcd59('0x13')]=_0x27b5b2;}if(_0x4b397f){_0x212fd6[_0xcd59('0x14')]=_0x4b397f;}return _0x212fd6;}function isEmail(_0x33f6b3){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'](_0x33f6b3);}function checkRow(_0x548af1,_0x34ba2d,_0xbc0dde){return new BPromise(function(_0x570680,_0x5beea1){if(_[_0xcd59('0x15')](_0x548af1)){return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0xcd59('0x16'),null,_0xbc0dde));}if(_0x548af1[_0xcd59('0x17')]&&_0x548af1[_0xcd59('0x17')][_0xcd59('0x18')]){var _0x1d33f5=_['map'](_0x548af1['errors'],_0xcd59('0x19'))[_0xcd59('0x1a')](';');return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0x1d33f5,null,_0xbc0dde));}var _0x4f4f6c={};for(var _0x2152f8 in FIELDS){if(FIELDS['hasOwnProperty'](_0x2152f8)&&FIELDS[_0x2152f8]){_0x4f4f6c[_0x2152f8]=_0x548af1['data'][0x0][FIELDS[_0x2152f8]]||_0x548af1['data'][0x0]['\ufeff'+FIELDS[_0x2152f8]];}}if(!_0x4f4f6c['firstName']){return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0xcd59('0x1b'),null,_0xbc0dde));}if(!_0x4f4f6c[_0xcd59('0x1c')]){return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0xcd59('0x1d'),null,_0xbc0dde));}if(_0x4f4f6c[_0xcd59('0x1e')]){var _0x2b5806=moment(_0x4f4f6c[_0xcd59('0x1e')],_0xcd59('0x1f'));if(!_0x2b5806['isValid']()){return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0xcd59('0x20'),null,_0xbc0dde));}}if(_0x4f4f6c[_0xcd59('0x21')]){if(!isEmail(_0x4f4f6c['email'])){return _0x5beea1(handleCheckRowError(_0xcd59('0x12'),_0xcd59('0x22'),null,_0xbc0dde));}}_0x4f4f6c['ListId']=LISTID;_0x4f4f6c[_0xcd59('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcd59('0x18')]&&_0x34ba2d){var _0xd7dc52={};for(var _0x53215b=0x0,_0x2fadfe=DUPLICATES[_0xcd59('0x18')];_0x53215b<_0x2fadfe;_0x53215b+=0x1){_0xd7dc52[DUPLICATES[_0x53215b]]=_0x4f4f6c[DUPLICATES[_0x53215b]];}var _0x3d4895=_[_0xcd59('0x24')](_0x34ba2d,_0xd7dc52);if(_0x3d4895){return _0x5beea1(handleCheckRowError(_0xcd59('0x25'),'Duplicate\x20Contact',_0x3d4895,_0xbc0dde));}}return db[_0xcd59('0x26')][_0xcd59('0x27')](_0x4f4f6c,{'raw':!![],'hooks':![],'fields':_[_0xcd59('0x28')](_0x4f4f6c)})[_0xcd59('0x29')](function(_0x5764d8){if(DUPLICATES&&DUPLICATES['length']&&_0x34ba2d){_0x34ba2d[_0xcd59('0x2a')](_[_0xcd59('0x2b')](_0x4f4f6c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5764d8['id'];return _0x570680();})['catch'](function(_0x231271){return _0x5beea1(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x231271[_0xcd59('0x19')]||JSON[_0xcd59('0x2c')](_0x231271)),null,_0xbc0dde));});});}function checkHopper(){function _0x2f01d7(){return function(_0x4b8c3d){logger[_0xcd59('0x12')](_0xcd59('0x2d'),_0xcd59('0x2e'),util[_0xcd59('0x2f')](_0x4b8c3d,{'showHidden':![],'depth':null}));};}var _0x328218=function(_0x55339a,_0x127746){var _0x3752cf=squel[_0xcd59('0x30')]()['into'](_0xcd59('0x31'))[_0xcd59('0x32')]([_0xcd59('0x1c'),_0xcd59('0x33'),_0xcd59('0x34'),'ListId',_0x127746,_0xcd59('0x35'),'updatedAt'],squel[_0xcd59('0x36')]()[_0xcd59('0x37')](_0xcd59('0x1c'),_0xcd59('0x1c'))[_0xcd59('0x37')](_0xcd59('0x38'),_0xcd59('0x33'))['field']('id',_0xcd59('0x34'))['field'](LISTID[_0xcd59('0x39')](),_0xcd59('0x3a'))[_0xcd59('0x37')](_0x55339a['id'][_0xcd59('0x39')](),_0x127746)['field'](_0xcd59('0x38'),_0xcd59('0x35'))['field'](_0xcd59('0x38'),_0xcd59('0x3b'))[_0xcd59('0x3c')](_0xcd59('0x3d'))[_0xcd59('0x3e')](_0xcd59('0x3f'))[_0xcd59('0x3e')](_0xcd59('0x40'),LISTID[_0xcd59('0x39')]())[_0xcd59('0x3e')](_0xcd59('0x41'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xcd59('0x36')]()[_0xcd59('0x37')](_0xcd59('0x1c'))['from'](_0xcd59('0x31'))[_0xcd59('0x3e')](_0x127746+'\x20=\x20?',_0x55339a['id'][_0xcd59('0x39')]())))['toString']();return _0x3752cf;};var _0x1a0000=function(_0x4a9130,_0x35953e){var _0x31deb6=squel[_0xcd59('0x30')]()[_0xcd59('0x42')](_0xcd59('0x31'))[_0xcd59('0x32')]([_0xcd59('0x1c'),'scheduledAt',_0xcd59('0x34'),_0xcd59('0x3a'),_0x35953e,_0xcd59('0x35'),_0xcd59('0x3b')],squel['select']()[_0xcd59('0x37')](_0xcd59('0x1c'),_0xcd59('0x1c'))[_0xcd59('0x37')](_0xcd59('0x38'),_0xcd59('0x33'))[_0xcd59('0x37')]('id','ContactId')[_0xcd59('0x37')](LISTID[_0xcd59('0x39')](),_0xcd59('0x3a'))[_0xcd59('0x37')](_0x4a9130['id'][_0xcd59('0x39')](),_0x35953e)['field'](_0xcd59('0x38'),'createdAt')[_0xcd59('0x37')]('NOW()',_0xcd59('0x3b'))['from'](_0xcd59('0x3d'))[_0xcd59('0x3e')](_0xcd59('0x3f'))[_0xcd59('0x3e')](_0xcd59('0x40'),LISTID[_0xcd59('0x39')]())[_0xcd59('0x3e')](_0xcd59('0x43'),squel[_0xcd59('0x44')](hopperContacts))[_0xcd59('0x3e')](_0xcd59('0x41'))['where'](_0xcd59('0x45'),squel['select']()['field']('calleridnum')[_0xcd59('0x3c')](_0xcd59('0x46'))[_0xcd59('0x3e')](_0x35953e+_0xcd59('0x47'),_0x4a9130['id'][_0xcd59('0x39')]()))[_0xcd59('0x3e')](_0xcd59('0x45'),squel[_0xcd59('0x36')]()[_0xcd59('0x37')](_0xcd59('0x1c'))['from'](_0xcd59('0x31'))[_0xcd59('0x3e')](_0x35953e+_0xcd59('0x47'),_0x4a9130['id'][_0xcd59('0x39')]())))[_0xcd59('0x39')]();return _0x31deb6;};function _0x398f34(_0x1174ef,_0x569e54){var _0x26583b=squel['insert']()[_0xcd59('0x42')](_0xcd59('0x31'))[_0xcd59('0x32')]([_0xcd59('0x1c'),_0xcd59('0x33'),_0xcd59('0x34'),_0xcd59('0x3a'),_0x569e54,'createdAt',_0xcd59('0x3b')],squel[_0xcd59('0x36')]()[_0xcd59('0x37')]('phone',_0xcd59('0x1c'))[_0xcd59('0x37')]('NOW()','scheduledAt')['field']('id',_0xcd59('0x34'))['field'](LISTID['toString'](),_0xcd59('0x3a'))['field'](_0x1174ef['id'][_0xcd59('0x39')](),_0x569e54)['field'](_0xcd59('0x38'),_0xcd59('0x35'))[_0xcd59('0x37')](_0xcd59('0x38'),_0xcd59('0x3b'))[_0xcd59('0x3c')](_0xcd59('0x3d'))['where'](_0xcd59('0x3f'))[_0xcd59('0x3e')]('ListId\x20=\x20?',LISTID[_0xcd59('0x39')]())['where'](_0xcd59('0x43'),squel[_0xcd59('0x44')](hopperContacts))[_0xcd59('0x3e')](_0xcd59('0x41')))[_0xcd59('0x39')]();return _0x26583b;}function _0x1b1297(_0x282413,_0x2af96b){var _0x64de22=squel[_0xcd59('0x30')]()[_0xcd59('0x42')]('cm_hopper_black')[_0xcd59('0x32')]([_0xcd59('0x1c'),_0xcd59('0x34'),_0xcd59('0x3a'),_0x2af96b,_0xcd59('0x35'),_0xcd59('0x3b')],squel[_0xcd59('0x36')]()[_0xcd59('0x37')](_0xcd59('0x1c'),'phone')[_0xcd59('0x37')]('id',_0xcd59('0x34'))['field'](LISTID[_0xcd59('0x39')](),_0xcd59('0x3a'))[_0xcd59('0x37')](_0x282413['id'][_0xcd59('0x39')](),_0x2af96b)['field'](_0xcd59('0x38'),_0xcd59('0x35'))[_0xcd59('0x37')](_0xcd59('0x38'),_0xcd59('0x3b'))['from']('cm_contacts')[_0xcd59('0x3e')](_0xcd59('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0xcd59('0x39')]())['where'](_0xcd59('0x43'),squel[_0xcd59('0x44')](hopperContacts))[_0xcd59('0x3e')](_0xcd59('0x41')))[_0xcd59('0x39')]();return _0x64de22;}return db[_0xcd59('0x48')]['findAll']({'where':{'type':_0xcd59('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xcd59('0x4a')],'as':_0xcd59('0x4b'),'where':{'id':LISTID}}]})[_0xcd59('0x29')](function(_0x3f44ac){var _0x104a99=[];if(_0x3f44ac){var _0x2e088b;for(var _0xde9548=0x0,_0x4a07dd;_0xde9548<_0x3f44ac['length'];_0xde9548+=0x1){_0x4a07dd=_0x3f44ac[_0xde9548][_0xcd59('0x4c')]({'plain':!![]});switch(_0x4a07dd['dialCheckDuplicateType']){case'always':_0x104a99[_0xcd59('0x2a')](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x1a0000(_0x4a07dd,'VoiceQueueId'))['then'](function(){})['catch'](_0x2f01d7()));break;case _0xcd59('0x4f'):_0x104a99[_0xcd59('0x2a')](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x328218(_0x4a07dd,'VoiceQueueId'))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));break;default:_0x104a99['push'](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x398f34(_0x4a07dd,'VoiceQueueId'))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));}}}return _0x104a99;})[_0xcd59('0x51')]()[_0xcd59('0x29')](function(){return db[_0xcd59('0x48')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xcd59('0x4a')],'as':_0xcd59('0x52'),'where':{'id':LISTID}}]})[_0xcd59('0x29')](function(_0x35105d){var _0x2dcae1=[];if(_0x35105d){var _0x3aa4db;for(var _0x348a4d=0x0,_0xe76305;_0x348a4d<_0x35105d[_0xcd59('0x18')];_0x348a4d+=0x1){_0xe76305=_0x35105d[_0x348a4d][_0xcd59('0x4c')]({'plain':!![]});_0x2dcae1[_0xcd59('0x2a')](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x1b1297(_0xe76305,_0xcd59('0x53')))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));}}return _0x2dcae1;})[_0xcd59('0x51')]();})[_0xcd59('0x29')](function(){return db[_0xcd59('0x54')][_0xcd59('0x55')]({'attributes':['id',_0xcd59('0x56')],'include':[{'model':db[_0xcd59('0x4a')],'as':_0xcd59('0x4b'),'where':{'id':LISTID}}]})['then'](function(_0x448188){var _0x590ab8=[];if(_0x448188){for(var _0x5c2f91=0x0,_0x4e9aeb;_0x5c2f91<_0x448188['length'];_0x5c2f91+=0x1){_0x4e9aeb=_0x448188[_0x5c2f91][_0xcd59('0x4c')]({'plain':!![]});switch(_0x4e9aeb['dialCheckDuplicateType']){case _0xcd59('0x57'):_0x590ab8[_0xcd59('0x2a')](db[_0xcd59('0x4d')]['query'](_0x1a0000(_0x4e9aeb,_0xcd59('0x58')))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));break;case _0xcd59('0x4f'):_0x590ab8['push'](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x328218(_0x4e9aeb,'CampaignId'))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));break;default:_0x590ab8['push'](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x398f34(_0x4e9aeb,'CampaignId'))['then'](function(){})[_0xcd59('0x50')](_0x2f01d7()));}}}return _0x590ab8;})['all']();})[_0xcd59('0x29')](function(){return db[_0xcd59('0x54')][_0xcd59('0x55')]({'attributes':['id'],'include':[{'model':db[_0xcd59('0x4a')],'as':_0xcd59('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x268093){var _0x5e63ea=[];if(_0x268093){for(var _0x29bb7b=0x0,_0x804737;_0x29bb7b<_0x268093[_0xcd59('0x18')];_0x29bb7b+=0x1){_0x804737=_0x268093[_0x29bb7b][_0xcd59('0x4c')]({'plain':!![]});_0x5e63ea[_0xcd59('0x2a')](db[_0xcd59('0x4d')][_0xcd59('0x4e')](_0x1b1297(_0x804737,_0xcd59('0x58')))[_0xcd59('0x29')](function(){})[_0xcd59('0x50')](_0x2f01d7()));}}return _0x5e63ea;})['all']();})['catch'](function(_0x3738e6){logger[_0xcd59('0x12')]('cmContact,\x20%s,\x20%s',_0xcd59('0x59'),_0x3738e6[_0xcd59('0x19')]);});}var processPromises=function(_0x4e1aed){return BPromise['all'](promises)[_0xcd59('0x29')](function(_0x522536){})['catch'](function(_0x4b116e){logger[_0xcd59('0x12')](_0xcd59('0x5a'),JSON[_0xcd59('0x2c')](_0x4b116e));})[_0xcd59('0x5b')](function(){socket[_0xcd59('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4e1aed){return _0x4e1aed['resume']();}});};var endCsv=function(){return BPromise[_0xcd59('0x5d')]()[_0xcd59('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0xcd59('0x29')](function(){socket[_0xcd59('0x5c')](_0xcd59('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcd59('0x5f')](FILEPATH);}catch(_0x3ad2cd){logger[_0xcd59('0x12')](_0xcd59('0x60'),JSON[_0xcd59('0x2c')](_0x3ad2cd));}finally{process[_0xcd59('0x61')](0x0);}});};process['on'](_0xcd59('0x62'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xcd59('0x5d')]()[_0xcd59('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcd59('0x10')](',');return db[_0xcd59('0x26')][_0xcd59('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcd59('0x29')](function(_0x1b5b2c){var _0x3a6aad=fs[_0xcd59('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcd59('0x64')](_0x3a6aad,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ca04a,_0x533d51){total+=0x1;var _0x5a7e0e=total;promises['push'](checkRow(_0x5ca04a,_0x1b5b2c,_0x5a7e0e)[_0xcd59('0x29')](function(){success+=0x1;})[_0xcd59('0x50')](function(_0x2b01f1){if(_0x2b01f1[_0xcd59('0x12')]){errors+=0x1;delete _0x2b01f1[_0xcd59('0x12')];}else if(_0x2b01f1[_0xcd59('0x25')]){duplicates+=0x1;delete _0x2b01f1[_0xcd59('0x25')];}rows[_0xcd59('0x2a')](_0x2b01f1);}));if(total%0xc8===0x0){_0x533d51[_0xcd59('0x65')]();return processPromises(_0x533d51);}},'complete':function(){return processPromises()['then'](function(){logger[_0xcd59('0x66')](_0xcd59('0x67'));endCsv();});},'error':function(_0x5ab399,_0x3607c4){logger['info'](_0xcd59('0x68'),JSON[_0xcd59('0x2c')](_0x5ab399));endCsv();}});})['catch'](function(_0x1faa59){logger[_0xcd59('0x12')](_0xcd59('0x69'),JSON[_0xcd59('0x2c')](_0x1faa59));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4d7df04..aa4968a 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 _0x5f32=['cm_contacts.priority','fromQuery','priority','cm_contacts.createdAt\x20=\x20?','updatedAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','send','start','binding','clone','socket_timestamp','root','.csv','includes','header','ContactItemType','findAll','name','parse','createReadStream','rows','find','_description','hasOwnProperty','data','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','utcOffset','firstName','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','orderBy','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','UserId','recallme','select','cm_contacts','.CmListId','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20'];(function(_0x3697cc,_0x4ddc5f){var _0x1172b5=function(_0x18154c){while(--_0x18154c){_0x3697cc['push'](_0x3697cc['shift']());}};_0x1172b5(++_0x4ddc5f);}(_0x5f32,0x12d));var _0x25f3=function(_0x418c4e,_0x6095cd){_0x418c4e=_0x418c4e-0x0;var _0x5126ac=_0x5f32[_0x418c4e];return _0x5126ac;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x25f3('0x0'));var Papa=require(_0x25f3('0x1'));var util=require(_0x25f3('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x25f3('0x3'));var Redis=require(_0x25f3('0x4'));var db=require(_0x25f3('0x5'))['db'];var config=require(_0x25f3('0x6'));var shared=require(_0x25f3('0x7'));var logger=require(_0x25f3('0x8'))(_0x25f3('0x9'));config[_0x25f3('0xa')]=_[_0x25f3('0xb')](config['redis'],{'host':_0x25f3('0xc'),'port':0x18eb});var socket=require(_0x25f3('0xd'))(new Redis(config[_0x25f3('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x25f3('0xe')](_0x25f3('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x25f3('0xe')](_0x25f3('0xf'));function isEmail(_0x1446ab){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'](_0x1446ab);}function selectNotIn(_0x21458c,_0x3b766f,_0x20555f,_0x2435bb,_0x366312){return squel['select']()[_0x25f3('0x10')](_0x25f3('0x11'))[_0x25f3('0x12')](_0x2435bb)[_0x25f3('0x13')](_0x3b766f,null,_0x3b766f+_0x25f3('0x14')+_0x2435bb+'.'+_0x20555f)[_0x25f3('0x15')](_0x2435bb+'.'+_0x20555f+_0x25f3('0x16')+_0x21458c+'.'+_0x20555f)[_0x25f3('0x15')](_0x3b766f+_0x25f3('0x17')+_0x366312[_0x25f3('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3fd5f6,_0x14edaf){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x25f3('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x25f3('0x19')](function(_0x5a0715){if(_0x5a0715!==null){var _0x5e8643=[];for(var _0x92cbcf=0x0;_0x92cbcf<_0x5a0715[_0x25f3('0x1a')];_0x92cbcf++){var _0x271c3e=_0x5a0715[_0x92cbcf];_0x5e8643['push'](insertAdditionalPhones(_0x271c3e));}}Promise['all'](_0x5e8643)[_0x25f3('0x19')](function(){_0x3fd5f6({'val':0x1});});});});}function insertAdditionalPhones(_0x2c77d4){return new Promise(function(_0x6431b2,_0x24df9a){var _0x562986=_0x2c77d4[_0x25f3('0x18')];var _0x2084d1=_0x562986['split'](';');var _0x9adbc2=[];orderBy=0x0;for(var _0x158454=0x0;_0x158454<_0x2084d1[_0x25f3('0x1a')];_0x158454++){_0x9adbc2[_0x25f3('0x1b')](splitAdditionalPhone(_0x2c77d4['id'],_0x2084d1[_0x158454]));}Promise[_0x25f3('0x1c')](_0x9adbc2)[_0x25f3('0x19')](function(){_0x6431b2({'val':_0x2084d1[_0x25f3('0x1a')]});});});}function splitAdditionalPhone(_0x2184de,_0x13aca1){return new Promise(function(_0x188b31,_0x2b2a8b){var _0x444d88=_0x13aca1[_0x25f3('0x1d')](':');var _0x9608a9=_0x444d88[0x0];var _0x3a8d60=_0x444d88[0x1];if(!_[_0x25f3('0x1e')](_0x3a8d60)){var _0xc054dc=_0x3a8d60['split']('|');var _0x54f4fd=[];for(var _0x3b06b1=0x0;_0x3b06b1<_0xc054dc['length'];_0x3b06b1++){if(_0xc054dc[_0x3b06b1]!==''){var _0x4feee2=_[_0x25f3('0x1f')](promisesAdditionalPhones,{'contactId':_0x2184de,'phone':_0xc054dc[_0x3b06b1]});if(_0x4feee2[_0x25f3('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x25f3('0x1b')]({'contactId':_0x2184de,'contactTypeId':_0x9608a9,'phone':_0xc054dc[_0x3b06b1],'orderBy':orderBy});}}}_0x188b31({'ok':0x1});}else _0x188b31({'res':0x0});});}function createAdditionalPhone(_0x414bd3,_0x40a7cf,_0x103ec9,_0x371c73){var _0x5b9979='';var _0xbedf06='';var _0x1136ca=_0x103ec9[_0x25f3('0x1d')]('§');_0x5b9979=_0x1136ca[0x0];if(_0x1136ca[_0x25f3('0x1a')]==0x2)_0xbedf06=_0x1136ca[0x1];return new Promise(function(_0x6c2df0,_0xa7de40){return db[_0x25f3('0x20')][_0x25f3('0x21')]({'where':{'CmContactId':_0x414bd3,'item':_0x5b9979}})['then'](function(_0x2aa490){if(_0x2aa490){return db[_0x25f3('0x20')][_0x25f3('0x22')]({'ItemTypeId':_0x40a7cf,'description':_0xbedf06,'OrderBy':_0x371c73},{'where':{'CmContactId':_0x414bd3,'item':_0x5b9979}})[_0x25f3('0x19')](function(_0x37d6b6){_0x6c2df0({'res':_0x25f3('0x23')});});}else{return db['CmContactHasItem'][_0x25f3('0x24')]({'CmContactId':_0x414bd3,'item':_0x5b9979,'description':_0xbedf06,'ItemTypeId':_0x40a7cf,'OrderBy':_0x371c73,'ItemClass':_0x25f3('0x25')})[_0x25f3('0x19')](function(_0x54dca7){_0x6c2df0({'res':_0x25f3('0x26')});});}});});}function insertCmHopper(_0x40e3ac,_0x5ddfe9,_0x39a0f3,_0x170396,_0x17d0f7){var _0x24a8a7=[_0x25f3('0x27'),_0x25f3('0x28'),_0x25f3('0x29'),_0x25f3('0x2a'),_0x5ddfe9+'.'+_0x170396,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x25f3('0x2b'),'\x22'+_0x17d0f7+'\x22'];return squel[_0x25f3('0x2c')]()[_0x25f3('0x2d')](_0x25f3('0x2e'))['fromQuery'](['phone','scheduledat',_0x25f3('0x2f'),_0x25f3('0x30'),_0x170396,_0x25f3('0x31'),'updatedAt','priority',_0x25f3('0x32'),_0x25f3('0x33')],squel[_0x25f3('0x34')]()['fields'](_0x24a8a7)[_0x25f3('0x12')](_0x5ddfe9)[_0x25f3('0x13')](_0x25f3('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x5ddfe9+_0x25f3('0x36'))[_0x25f3('0x13')](_0x39a0f3,null,_0x39a0f3+_0x25f3('0x14')+_0x5ddfe9+'.'+_0x170396)[_0x25f3('0x15')](_0x5ddfe9+'.CmListId\x20=\x20?',_0x40e3ac)[_0x25f3('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x25f3('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5ddfe9,_0x39a0f3,_0x170396,_0x25f3('0x2e'),[_0x25f3('0x37'),_0x25f3('0x38')]))['where'](_0x25f3('0x39'),selectNotIn(_0x5ddfe9,_0x39a0f3,_0x170396,_0x25f3('0x2e'),[_0x25f3('0x37')])))[_0x25f3('0x3a')]();}function insertCmHopperBlack(_0x5a3eef,_0x16a978,_0x3d53c3,_0x2f0421){var _0x332c6d=[_0x25f3('0x27'),'cm_contacts.id',_0x25f3('0x2a'),_0x16a978+'.'+_0x2f0421,_0x25f3('0x3b'),_0x25f3('0x3c')];return squel[_0x25f3('0x2c')]()[_0x25f3('0x2d')](_0x25f3('0x3d'))['fromQuery']([_0x25f3('0x11'),_0x25f3('0x2f'),'ListId',_0x2f0421,_0x25f3('0x31'),'updatedAt'],squel[_0x25f3('0x34')]()[_0x25f3('0x3e')](_0x332c6d)[_0x25f3('0x12')](_0x16a978)['join'](_0x25f3('0x35'),null,_0x25f3('0x3f')+_0x16a978+_0x25f3('0x36'))[_0x25f3('0x13')](_0x3d53c3,null,_0x3d53c3+_0x25f3('0x14')+_0x16a978+'.'+_0x2f0421)[_0x25f3('0x15')](_0x16a978+_0x25f3('0x40'),_0x5a3eef)[_0x25f3('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x25f3('0x15')](_0x25f3('0x39'),squel['select']()[_0x25f3('0x10')](_0x25f3('0x11'))[_0x25f3('0x12')](_0x25f3('0x3d'))[_0x25f3('0x15')](_0x25f3('0x41'),_0x5a3eef)['where'](_0x2f0421+_0x25f3('0x16')+_0x16a978+'.'+_0x2f0421)))[_0x25f3('0x3a')]();}function insertTzCmHopper(_0x43b375,_0x1af750,_0x4ee225,_0x530e7f,_0x38ec64,_0x8b004b){var _0x342f84=[_0x25f3('0x27'),_0x25f3('0x42')+_0x8b004b+'.offset-cm_contacts.utcOffset\x20minute)',_0x25f3('0x29'),_0x25f3('0x2a'),_0x1af750+'.'+_0x530e7f,_0x25f3('0x3b'),'cm_contacts.updatedAt',_0x25f3('0x43'),'cm_contacts.UserId','\x22'+_0x38ec64+'\x22'];var _0x485d89=squel[_0x25f3('0x2c')]()[_0x25f3('0x2d')](_0x25f3('0x2e'))[_0x25f3('0x44')](['phone','scheduledat','ContactId',_0x25f3('0x30'),_0x530e7f,'createdAt','updatedAt',_0x25f3('0x45'),_0x25f3('0x32'),_0x25f3('0x33')],squel[_0x25f3('0x34')]()['fields'](_0x342f84)[_0x25f3('0x12')](_0x1af750)[_0x25f3('0x13')](_0x25f3('0x35'),null,_0x25f3('0x3f')+_0x1af750+_0x25f3('0x36'))[_0x25f3('0x13')](_0x4ee225,null,_0x4ee225+_0x25f3('0x14')+_0x1af750+'.'+_0x530e7f)[_0x25f3('0x13')](_0x8b004b,null,_0x8b004b+_0x25f3('0x14')+_0x1af750+'.'+_0x530e7f)[_0x25f3('0x15')](_0x1af750+'.CmListId\x20=\x20?',_0x43b375)[_0x25f3('0x15')](_0x25f3('0x46'),NOW)[_0x25f3('0x15')](_0x25f3('0x39'),selectNotIn(_0x1af750,_0x4ee225,_0x530e7f,'cm_hopper',[_0x25f3('0x37'),'\x22onlyIfOpen\x22']))['where'](_0x25f3('0x39'),selectNotIn(_0x1af750,_0x4ee225,_0x530e7f,_0x25f3('0x2e'),['\x22always\x22'])))['toString']();return _0x485d89;}function insertTzCmHopperBlack(_0x1fb80c,_0x2273f3,_0x269838,_0x1bb27d){var _0x5879b1=[_0x25f3('0x27'),'cm_contacts.id',_0x25f3('0x2a'),_0x2273f3+'.'+_0x1bb27d,_0x25f3('0x3b'),'cm_contacts.updatedAt'];return squel[_0x25f3('0x2c')]()['into'](_0x25f3('0x3d'))[_0x25f3('0x44')]([_0x25f3('0x11'),_0x25f3('0x2f'),'ListId',_0x1bb27d,_0x25f3('0x31'),_0x25f3('0x47')],squel[_0x25f3('0x34')]()[_0x25f3('0x3e')](_0x5879b1)[_0x25f3('0x12')](_0x2273f3)['join'](_0x25f3('0x35'),null,_0x25f3('0x3f')+_0x2273f3+'.CmListId')[_0x25f3('0x13')](_0x269838,null,_0x269838+_0x25f3('0x14')+_0x2273f3+'.'+_0x1bb27d)[_0x25f3('0x15')](_0x2273f3+'.CmListId\x20=\x20?',_0x1fb80c)[_0x25f3('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x25f3('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x25f3('0x11'))[_0x25f3('0x12')](_0x25f3('0x3d'))[_0x25f3('0x15')](_0x25f3('0x41'),_0x1fb80c)[_0x25f3('0x15')](_0x1bb27d+'\x20=\x20'+_0x2273f3+'.'+_0x1bb27d)))[_0x25f3('0x3a')]();}function insertCmHopperAdditionalPhones(_0x2682de){var _0x47032e=[_0x25f3('0x48'),_0x25f3('0x49'),'cm_contact_has_items.OrderBy',_0x25f3('0x4a'),_0x25f3('0x4b')];return squel['insert']()['into'](_0x25f3('0x4c'))['fromQuery']([_0x25f3('0x4d'),_0x25f3('0x11'),_0x25f3('0x4e'),_0x25f3('0x31'),_0x25f3('0x47')],squel[_0x25f3('0x34')]()['fields'](_0x47032e)[_0x25f3('0x12')](_0x25f3('0x2e'))['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x25f3('0x13')](_0x25f3('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x25f3('0x50'),_0x2682de)[_0x25f3('0x15')](_0x25f3('0x46'),NOW))[_0x25f3('0x3a')]();}function insertCmContact(_0x4f1d2c,_0x5551db,_0x325428,_0x37ff50){var _0x38d1a9=_[_0x25f3('0x51')](_[_0x25f3('0x52')](_0x37ff50),[_0x25f3('0x30'),_0x25f3('0x53'),_0x25f3('0x31'),_0x25f3('0x47')]);return squel[_0x25f3('0x2c')]()['into']('cm_contacts')[_0x25f3('0x44')](_0x38d1a9,squel[_0x25f3('0x34')]()[_0x25f3('0x3e')](_0x38d1a9)['from'](_0x5551db)[_0x25f3('0x15')]('('+_0x325428[_0x25f3('0x13')](',')+_0x25f3('0x54'),squel[_0x25f3('0x34')]()[_0x25f3('0x3e')](_0x325428)[_0x25f3('0x12')](_0x25f3('0x35'))[_0x25f3('0x15')](_0x25f3('0x41'),_0x4f1d2c)[_0x25f3('0x15')](_0x25f3('0x55')))[_0x25f3('0x15')](_0x25f3('0x56'),squel['select']()[_0x25f3('0x10')](_0x25f3('0x57'),_0x25f3('0x58'))[_0x25f3('0x12')](_0x5551db)[_0x25f3('0x59')](_0x325428[_0x25f3('0x13')](','))))[_0x25f3('0x3a')]();}function handleStop(){logger[_0x25f3('0x5a')](_0x25f3('0x5b'));stopped=!![];}function handleUncaughtException(_0x54a295){logger[_0x25f3('0x5c')](_0x54a295[_0x25f3('0x5d')]);process[_0x25f3('0x5e')](0x1);}function handleError(_0x46490a,_0x2d937d){stats[_0x25f3('0x5f')][_0x25f3('0x1b')]({'name':_0x2d937d['code'],'message':_0x2d937d[_0x25f3('0x5d')],'row':_0x46490a});}function handleQuery(_0x5327b4){logger['info'](_0x5327b4);return db[_0x25f3('0x60')][_0x25f3('0x61')](_0x5327b4)['spread'](function(_0x431fee){results['push'](_0x431fee);})[_0x25f3('0x62')](function(_0x13d95c){logger[_0x25f3('0x5c')](_0x13d95c[_0x25f3('0x5d')]);});}function updateTzCampaigns(_0x305c47){return new Promise(function(_0x5969b0,_0x182bd1){var _0x4bdde4=squel[_0x25f3('0x34')]()['fields'](['campaigns.id',_0x25f3('0x63')])[_0x25f3('0x12')](_0x25f3('0x64'))[_0x25f3('0x13')](_0x25f3('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x25f3('0x66')+_0x305c47);db['sequelize']['query'](_0x4bdde4[_0x25f3('0x3a')]())[_0x25f3('0x67')](function(_0x1e27fe){var _0x1f5a7f=[];for(var _0x306ed4=0x0;_0x306ed4<_0x1e27fe[_0x25f3('0x1a')];_0x306ed4++){_0x1f5a7f[_0x25f3('0x1b')](getTimezoneData(_0x1e27fe[_0x306ed4],tmp_campaigns));}BPromise[_0x25f3('0x1c')](_0x1f5a7f)[_0x25f3('0x19')](function(){_0x5969b0({'val':0x1});});})[_0x25f3('0x62')](function(_0x4e813b){logger['error'](_0x4e813b[_0x25f3('0x5d')]);_0x5969b0({'val':0x0});});});}function updateTzVoiceQueues(_0x2114b7){return new Promise(function(_0x2b32f5,_0x48bb34){var _0x422538=squel[_0x25f3('0x34')]()[_0x25f3('0x3e')]([_0x25f3('0x68'),'voice_queues.dialTimezone'])[_0x25f3('0x12')](_0x25f3('0x69'))[_0x25f3('0x13')](_0x25f3('0x6a'),null,_0x25f3('0x6b'))['where'](_0x25f3('0x6c')+_0x2114b7);db[_0x25f3('0x60')][_0x25f3('0x61')](_0x422538[_0x25f3('0x3a')]())[_0x25f3('0x67')](function(_0x193e7f){var _0x2f45a9=[];for(var _0x44e955=0x0;_0x44e955<_0x193e7f['length'];_0x44e955++){_0x2f45a9[_0x25f3('0x1b')](getTimezoneData(_0x193e7f[_0x44e955],tmp_voice_queues));}BPromise['all'](_0x2f45a9)[_0x25f3('0x19')](function(){_0x2b32f5({'val':0x1});});})[_0x25f3('0x62')](function(_0x2f454f){logger[_0x25f3('0x5c')](_0x2f454f[_0x25f3('0x5d')]);_0x2b32f5({'val':0x0});});});}function getTimezoneData(_0x54d5ee,_0x25b9ee){return new Promise(function(_0xdae79,_0x4d0ccf){var _0x5e7caa=shared[_0x25f3('0x6d')];var _0xc3662=_0x5e7caa[_0x54d5ee[_0x25f3('0x6e')]];if(_[_0x25f3('0x1e')](_0xc3662)){_0xdae79({'ret':0x1});}else{var _0x214c0f=_0xc3662['utcOffset'];var _0x451d01=squel[_0x25f3('0x2c')]()[_0x25f3('0x2d')](_0x25b9ee)[_0x25f3('0x6f')]('id',_0x54d5ee['id'])[_0x25f3('0x6f')](_0x25f3('0x70'),_0x214c0f)['set'](_0x25f3('0x6e'),_0x54d5ee[_0x25f3('0x6e')])[_0x25f3('0x3a')]();return db[_0x25f3('0x60')][_0x25f3('0x61')](_0x451d01)[_0x25f3('0x67')](function(_0x4a52bc){_0xdae79({'ret':0x1});})['catch'](function(_0x25023a){logger[_0x25f3('0x5c')](_0x25023a['message']);_0x4d0ccf({'ret':0x1});});}});}function handleTZQuery(_0x555e9c){logger[_0x25f3('0x5a')](_0x555e9c);return db[_0x25f3('0x60')][_0x25f3('0x61')](_0x555e9c)[_0x25f3('0x67')](function(_0x2da4ae){})[_0x25f3('0x62')](function(_0x38d84b){logger['error'](_0x38d84b[_0x25f3('0x5d')]);});}function main(_0x7006f1,_0x49fb7a,_0x42b66a,_0x544e64){logger[_0x25f3('0x5a')](_0x25f3('0x71'),_0x7006f1,JSON['stringify'](_0x49fb7a));process[_0x25f3('0x72')](_0x25f3('0x73'));var _0x58114b=_0x49fb7a[_0x25f3('0x74')];var _0x1c6d9c=_[_0x25f3('0x75')](_0x58114b);var _0x9b4d4b=_0x49fb7a[_0x25f3('0x76')];var _0x2e2d36=path[_0x25f3('0x13')](config[_0x25f3('0x77')],'server/files/tmp',_0x9b4d4b+_0x25f3('0x78'));hasTZ=_[_0x25f3('0x52')](_0x58114b)[_0x25f3('0x79')](_0x25f3('0x6e'));var _0x3e9e52=_[_0x25f3('0x52')](_0x58114b)[_0x25f3('0x13')]();logger['info'](_0x25f3('0x7a'),_0x3e9e52);db[_0x25f3('0x7b')][_0x25f3('0x7c')]({'raw':!![],'attributes':['id','name']})[_0x25f3('0x19')](function(_0x4e8b52){for(var _0x3823c2=0x0;_0x3823c2<_0x4e8b52['length'];_0x3823c2++){if(_0x4e8b52[_0x3823c2]['name']in _0x58114b){contactItemTypes[_0x25f3('0x1b')](_0x4e8b52[_0x3823c2]);delete _0x1c6d9c[_0x4e8b52[_0x3823c2]['name']];hasAdditionalPhones=!![];}for(var _0x47ec61 in _0x58114b){if(_0x4e8b52[_0x3823c2][_0x25f3('0x7d')]+'_description'===_0x47ec61){phoneDescriptions['push']({'itemTypeId':_0x4e8b52[_0x3823c2]['id'],'description':_0x47ec61});delete _0x1c6d9c[_0x47ec61];}}}if(hasAdditionalPhones)_0x1c6d9c[_0x25f3('0x18')]='';var _0x5b0b82=_[_0x25f3('0x52')](_0x1c6d9c)['join']();logger['info']('header',_0x5b0b82);fs['writeFileSync'](_0x2e2d36,_0x5b0b82+'\x0a');Papa[_0x25f3('0x7e')](fs[_0x25f3('0x7f')](_0x7006f1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2070ed,_0x1e6cac){try{for(var _0x3e9f5f=0x0,_0x1bb72f=[];_0x3e9f5f<_0x2070ed['data'][_0x25f3('0x1a')];_0x3e9f5f++){stats[_0x25f3('0x80')]+=0x1;if(_0x2070ed[_0x25f3('0x5f')][_0x3e9f5f]){handleError(_0x2070ed['data'][_0x3e9f5f],_0x2070ed[_0x25f3('0x5f')][_0x3e9f5f]);}else{var _0x2eec80=[];var _0x463760=[];var _0x990bf9={};for(var _0x1bc13b in _0x58114b){let _0x59c340=contactItemTypes[_0x25f3('0x81')](_0x4b6a4b=>_0x4b6a4b[_0x25f3('0x7d')]===_0x1bc13b);let _0x3c314a=contactItemTypes['find'](_0x97b843=>_0x97b843[_0x25f3('0x7d')]+_0x25f3('0x82')===_0x1bc13b);if(_[_0x25f3('0x1e')](_0x59c340)&&_[_0x25f3('0x1e')](_0x3c314a)){if(_0x58114b[_0x25f3('0x83')](_0x1bc13b)){if(_0x2070ed[_0x25f3('0x84')][_0x3e9f5f][_0x58114b[_0x1bc13b]]){var _0x1222e7=_[_0x25f3('0x85')](_0x2070ed[_0x25f3('0x84')][_0x3e9f5f][_0x58114b[_0x1bc13b]][_0x25f3('0x86')](/"/g,'\x27'));switch(_0x1bc13b){case _0x25f3('0x87'):var _0x1e0477=moment(_0x1222e7,_0x25f3('0xf'),!![]);if(_0x1e0477[_0x25f3('0x88')]()){_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x1222e7+'\x22');}else{_0x2eec80['push'](_0x25f3('0x89'));}break;case _0x25f3('0x45'):var _0x2590a6=parseInt(_0x1222e7);_0x1222e7=_[_0x25f3('0x8a')](_0x2590a6)||_0x2590a6<0x0||_0x2590a6>0x4?_0x544e64?0x3:0x2:_0x2590a6;_0x1bb72f['push']('\x22'+_0x1222e7+'\x22');break;case _0x25f3('0x32'):var _0x3d22bf=parseInt(_0x1222e7);if(_[_0x25f3('0x8b')](_0x3d22bf)&&_[_0x25f3('0x79')](_0x42b66a,_0x3d22bf)){_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x3d22bf+'\x22');}else{_0x2eec80[_0x25f3('0x1b')](_0x25f3('0x8c'));}break;case _0x25f3('0x8d'):if(isEmail(_0x1222e7)){_0x1bb72f['push']('\x22'+_0x1222e7+'\x22');}else{_0x2eec80[_0x25f3('0x1b')](_0x25f3('0x8e'));}break;case _0x25f3('0x8f'):var _0x9cea=moment(_0x1222e7,_0x25f3('0x90'),!![]);if(_0x9cea['isValid']()){_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x1222e7+'\x22');}else{_0x2eec80[_0x25f3('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x25f3('0x6e'):var _0xd0f17c=shared[_0x25f3('0x6d')];var _0x42d197=_0xd0f17c[_0x1222e7];if(!_[_0x25f3('0x1e')](_0x42d197)){var _0x2f71df=_0x42d197[_0x25f3('0x91')];_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x1222e7+'\x22');_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x2f71df+'\x22');}break;default:_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x1222e7+'\x22');}}else{switch(_0x1bc13b){case _0x25f3('0x92'):case _0x25f3('0x11'):_0x2eec80['push'](_0x1bc13b+'\x20not\x20specified');break;default:_0x1bb72f['push']('\x22\x22');}}}}else{var _0x3aed3a='';if(!_[_0x25f3('0x1e')](_0x59c340)){if(!_0x990bf9['hasOwnProperty'](_0x59c340['id'])){if(!_[_0x25f3('0x1e')](_0x2070ed[_0x25f3('0x84')][_0x3e9f5f][_0x58114b[_0x1bc13b]])){var _0x1222e7=_['trim'](_0x2070ed['data'][_0x3e9f5f][_0x58114b[_0x1bc13b]][_0x25f3('0x86')](/"/g,'\x27'));var _0x3a534e=phoneDescriptions[_0x25f3('0x81')](_0x32472e=>_0x32472e['itemTypeId']===_0x59c340['id']);if(!_['isNil'](_0x3a534e)){var _0x172d60=_[_0x25f3('0x85')](_0x2070ed[_0x25f3('0x84')][_0x3e9f5f][_0x58114b[_0x3a534e[_0x25f3('0x93')]]][_0x25f3('0x86')](/"/g,'\x27'));if(!_[_0x25f3('0x1e')](_0x172d60))_0x1222e7=_0x1222e7+'§'+_0x172d60;}if(_0x3aed3a=='')_0x3aed3a=_0x1222e7;else _0x3aed3a+='|'+_0x1222e7;}_0x463760[_0x25f3('0x1b')](_0x59c340['id']+':'+_0x3aed3a);_0x990bf9[_0x59c340['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bb72f[_0x25f3('0x1b')]('\x22'+_0x463760[_0x25f3('0x13')](';')+'\x22');}if(_0x2eec80['length']){handleError(_0x2070ed['data'][_0x3e9f5f],{'code':_0x25f3('0x94'),'message':_0x2eec80[_0x25f3('0x13')]()});}else{fs[_0x25f3('0x95')](_0x2e2d36,_0x1bb72f[_0x25f3('0x13')]()+'\x0a');}_0x1bb72f=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x25f3('0x96')+_0x9b4d4b,stats);stats[_0x25f3('0x5f')]=[];}}if(stopped){logger['info'](_0x25f3('0x97'));_0x1e6cac[_0x25f3('0x98')]();}}catch(_0x49090a){handleError(_0x2070ed[_0x25f3('0x84')][_0x3e9f5f],{'code':_0x25f3('0x99'),'message':_0x49090a['message']});logger[_0x25f3('0x5c')](_0x25f3('0x9a'),_0x49090a['message']);}},'complete':function(){try{var _0x4463ee=[];var _0x141729=[];var _0x8f7ca5=_0x25f3('0x35');if(_0x49fb7a[_0x25f3('0x9b')]&&_0x49fb7a[_0x25f3('0x9b')][_0x25f3('0x1a')]){_0x8f7ca5=_0x25f3('0x9c')+_0x9b4d4b;_0x4463ee[_0x25f3('0x1b')](_0x25f3('0x9d')+_0x8f7ca5+_0x25f3('0x9e'));}tmp_campaigns=_0x25f3('0x9f')+_0x9b4d4b;tmp_voice_queues=_0x25f3('0xa0')+_0x9b4d4b;_0x141729[_0x25f3('0x1b')](_0x25f3('0x9d')+tmp_campaigns+_0x25f3('0xa1'));_0x141729[_0x25f3('0x1b')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x25f3('0xa2')](_0x141729,handleTZQuery)['then'](function(_0x4b78f9){updateTzCampaigns(_0x49fb7a[_0x25f3('0x30')])['then'](function(_0x2e58ac){updateTzVoiceQueues(_0x49fb7a[_0x25f3('0x30')])['then'](function(_0x9c6653){if(hasTZ)_0x5b0b82=_0x5b0b82['replace']('dialTimezone','dialTimezone,utcOffset');var _0x49f58a=util[_0x25f3('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2e2d36,_0x8f7ca5,_0x5b0b82,_0x49fb7a[_0x25f3('0x30')],_0x49fb7a[_0x25f3('0x53')]||null,NOW,NOW);if(_['isNil'](_0x58114b[_0x25f3('0x87')])){_0x49f58a+=',\x20scheduledAt\x20=\x20NOW()';}_0x4463ee['push'](_0x49f58a);if(_0x49fb7a[_0x25f3('0x9b')]&&_0x49fb7a['duplicates'][_0x25f3('0x1a')]){_0x4463ee[_0x25f3('0x1b')](insertCmContact(_0x49fb7a[_0x25f3('0x30')],_0x8f7ca5,_0x49fb7a['duplicates'],_0x58114b));_0x4463ee[_0x25f3('0x1b')]('DROP\x20TABLE\x20'+_0x8f7ca5+';');}BPromise[_0x25f3('0xa2')](_0x4463ee,handleQuery)[_0x25f3('0x19')](function(_0x37d75e){BPromise['all']([handleAdditionalPhones()])[_0x25f3('0x19')](function(){_0x4463ee=[];for(var _0x5d6a6a=0x0;_0x5d6a6a\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','select','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones'];(function(_0x21c9d3,_0xc79fa3){var _0x7852bc=function(_0x345ea3){while(--_0x345ea3){_0x21c9d3['push'](_0x21c9d3['shift']());}};_0x7852bc(++_0xc79fa3);}(_0x77a4,0x9f));var _0x477a=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x77a4[_0x14a862];return _0x245eb5;};'use strict';var fs=require('fs');var path=require(_0x477a('0x0'));var _=require(_0x477a('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x477a('0x2'));var moment=require(_0x477a('0x3'));var squel=require(_0x477a('0x4'));var Redis=require('ioredis');var db=require(_0x477a('0x5'))['db'];var config=require(_0x477a('0x6'));var shared=require(_0x477a('0x7'));var logger=require(_0x477a('0x8'))('import');config[_0x477a('0x9')]=_[_0x477a('0xa')](config[_0x477a('0x9')],{'host':_0x477a('0xb'),'port':0x18eb});var socket=require(_0x477a('0xc'))(new Redis(config[_0x477a('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x477a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x477a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x578feb){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'](_0x578feb);}function selectNotIn(_0x2b31a9,_0x17772c,_0x35e855,_0x126323,_0x5f2b54){return squel[_0x477a('0xe')]()['field']('phone')[_0x477a('0xf')](_0x126323)[_0x477a('0x10')](_0x17772c,null,_0x17772c+_0x477a('0x11')+_0x126323+'.'+_0x35e855)['where'](_0x126323+'.'+_0x35e855+_0x477a('0x12')+_0x2b31a9+'.'+_0x35e855)['where'](_0x17772c+_0x477a('0x13')+_0x5f2b54[_0x477a('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x233733,_0x981061){promisesAdditionalPhones=[];return db[_0x477a('0x14')][_0x477a('0x15')]({'raw':!![],'attributes':['id',_0x477a('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x477a('0x17')](function(_0x12c29e){if(_0x12c29e!==null){var _0x4b8fcc=[];for(var _0x549a16=0x0;_0x549a16<_0x12c29e[_0x477a('0x18')];_0x549a16++){var _0x2f7cbc=_0x12c29e[_0x549a16];_0x4b8fcc['push'](insertAdditionalPhones(_0x2f7cbc));}}Promise[_0x477a('0x19')](_0x4b8fcc)['then'](function(){_0x233733({'val':0x1});});});});}function insertAdditionalPhones(_0x131d97){return new Promise(function(_0x523a94,_0xe0aced){var _0x128681=_0x131d97[_0x477a('0x16')];var _0x185d22=_0x128681['split'](';');var _0x25ac11=[];orderBy=0x0;for(var _0x13822b=0x0;_0x13822b<_0x185d22['length'];_0x13822b++){_0x25ac11['push'](splitAdditionalPhone(_0x131d97['id'],_0x185d22[_0x13822b]));}Promise['all'](_0x25ac11)[_0x477a('0x17')](function(){_0x523a94({'val':_0x185d22[_0x477a('0x18')]});});});}function splitAdditionalPhone(_0x4086c5,_0x264ad3){return new Promise(function(_0xd42499,_0x4c55b8){var _0x100690=_0x264ad3['split'](':');var _0xbaa7a1=_0x100690[0x0];var _0x1c49c5=_0x100690[0x1];if(!_[_0x477a('0x1a')](_0x1c49c5)){var _0x4ae18c=_0x1c49c5[_0x477a('0x1b')]('|');var _0x386434=[];for(var _0x46b776=0x0;_0x46b776<_0x4ae18c[_0x477a('0x18')];_0x46b776++){if(_0x4ae18c[_0x46b776]!==''){var _0x2d09d8=_[_0x477a('0x1c')](promisesAdditionalPhones,{'contactId':_0x4086c5,'phone':_0x4ae18c[_0x46b776]});if(_0x2d09d8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x477a('0x1d')]({'contactId':_0x4086c5,'contactTypeId':_0xbaa7a1,'phone':_0x4ae18c[_0x46b776],'orderBy':orderBy});}}}_0xd42499({'ok':0x1});}else _0xd42499({'res':0x0});});}function createAdditionalPhone(_0x165bf8,_0x416ffd,_0x2c2ca0,_0x228736){var _0x2ff074='';var _0x50597e='';var _0x8e51cf=_0x2c2ca0[_0x477a('0x1b')]('§');_0x2ff074=_0x8e51cf[0x0];if(_0x8e51cf[_0x477a('0x18')]==0x2)_0x50597e=_0x8e51cf[0x1];return new Promise(function(_0x2996b1,_0x4e1039){return db['CmContactHasItem'][_0x477a('0x1e')]({'where':{'CmContactId':_0x165bf8,'item':_0x2ff074}})[_0x477a('0x17')](function(_0x5b6dc5){if(_0x5b6dc5){return db[_0x477a('0x1f')][_0x477a('0x20')]({'ItemTypeId':_0x416ffd,'description':_0x50597e,'OrderBy':_0x228736},{'where':{'CmContactId':_0x165bf8,'item':_0x2ff074}})['then'](function(_0x82d274){_0x2996b1({'res':_0x477a('0x21')});});}else{return db[_0x477a('0x1f')][_0x477a('0x22')]({'CmContactId':_0x165bf8,'item':_0x2ff074,'description':_0x50597e,'ItemTypeId':_0x416ffd,'OrderBy':_0x228736,'ItemClass':_0x477a('0x23')})['then'](function(_0x4f4db4){_0x2996b1({'res':_0x477a('0x24')});});}});});}function insertCmHopper(_0x2924a6,_0x1e5c83,_0x32dacc,_0x29e57f,_0x5aa36b){var _0x1670f7=['cm_contacts.phone',_0x477a('0x25'),_0x477a('0x26'),'cm_contacts.ListId',_0x1e5c83+'.'+_0x29e57f,_0x477a('0x27'),_0x477a('0x28'),'cm_contacts.priority',_0x477a('0x29'),'\x22'+_0x5aa36b+'\x22'];return squel[_0x477a('0x2a')]()[_0x477a('0x2b')](_0x477a('0x2c'))[_0x477a('0x2d')](['phone',_0x477a('0x2e'),_0x477a('0x2f'),_0x477a('0x30'),_0x29e57f,_0x477a('0x31'),_0x477a('0x32'),'priority','UserId',_0x477a('0x33')],squel['select']()[_0x477a('0x34')](_0x1670f7)[_0x477a('0xf')](_0x1e5c83)[_0x477a('0x10')](_0x477a('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x1e5c83+'.CmListId')[_0x477a('0x10')](_0x32dacc,null,_0x32dacc+_0x477a('0x11')+_0x1e5c83+'.'+_0x29e57f)['where'](_0x1e5c83+_0x477a('0x36'),_0x2924a6)[_0x477a('0x37')](_0x477a('0x38'),NOW)['where'](_0x477a('0x39'),selectNotIn(_0x1e5c83,_0x32dacc,_0x29e57f,_0x477a('0x2c'),[_0x477a('0x3a'),_0x477a('0x3b')]))['where'](_0x477a('0x39'),selectNotIn(_0x1e5c83,_0x32dacc,_0x29e57f,_0x477a('0x2c'),[_0x477a('0x3a')])))['toString']();}function insertCmHopperBlack(_0x21616d,_0x2e696c,_0x3d02f5,_0x202d2d){var _0x69c68f=[_0x477a('0x3c'),_0x477a('0x26'),_0x477a('0x3d'),_0x2e696c+'.'+_0x202d2d,_0x477a('0x27'),'cm_contacts.updatedAt'];return squel[_0x477a('0x2a')]()[_0x477a('0x2b')](_0x477a('0x3e'))[_0x477a('0x2d')]([_0x477a('0x3f'),'ContactId',_0x477a('0x30'),_0x202d2d,'createdAt',_0x477a('0x32')],squel[_0x477a('0xe')]()[_0x477a('0x34')](_0x69c68f)['from'](_0x2e696c)['join'](_0x477a('0x35'),null,_0x477a('0x40')+_0x2e696c+'.CmListId')[_0x477a('0x10')](_0x3d02f5,null,_0x3d02f5+_0x477a('0x11')+_0x2e696c+'.'+_0x202d2d)[_0x477a('0x37')](_0x2e696c+_0x477a('0x36'),_0x21616d)[_0x477a('0x37')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x477a('0xe')]()['field']('phone')[_0x477a('0xf')]('cm_hopper_black')[_0x477a('0x37')](_0x477a('0x41'),_0x21616d)[_0x477a('0x37')](_0x202d2d+_0x477a('0x12')+_0x2e696c+'.'+_0x202d2d)))[_0x477a('0x42')]();}function insertTzCmHopper(_0xacc6fc,_0x1cf18a,_0x5e6327,_0x29d2bd,_0x344e96,_0x221977){var _0x23c3d0=[_0x477a('0x3c'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x221977+_0x477a('0x43'),_0x477a('0x26'),'cm_contacts.ListId',_0x1cf18a+'.'+_0x29d2bd,'cm_contacts.createdAt',_0x477a('0x28'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x344e96+'\x22'];var _0xeb4924=squel[_0x477a('0x2a')]()[_0x477a('0x2b')](_0x477a('0x2c'))['fromQuery'](['phone',_0x477a('0x2e'),_0x477a('0x2f'),_0x477a('0x30'),_0x29d2bd,_0x477a('0x31'),_0x477a('0x32'),_0x477a('0x44'),_0x477a('0x45'),_0x477a('0x33')],squel['select']()[_0x477a('0x34')](_0x23c3d0)[_0x477a('0xf')](_0x1cf18a)['join'](_0x477a('0x35'),null,_0x477a('0x40')+_0x1cf18a+_0x477a('0x46'))[_0x477a('0x10')](_0x5e6327,null,_0x5e6327+_0x477a('0x11')+_0x1cf18a+'.'+_0x29d2bd)[_0x477a('0x10')](_0x221977,null,_0x221977+_0x477a('0x11')+_0x1cf18a+'.'+_0x29d2bd)[_0x477a('0x37')](_0x1cf18a+_0x477a('0x36'),_0xacc6fc)[_0x477a('0x37')](_0x477a('0x38'),NOW)[_0x477a('0x37')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cf18a,_0x5e6327,_0x29d2bd,_0x477a('0x2c'),[_0x477a('0x3a'),_0x477a('0x3b')]))[_0x477a('0x37')](_0x477a('0x39'),selectNotIn(_0x1cf18a,_0x5e6327,_0x29d2bd,_0x477a('0x2c'),[_0x477a('0x3a')])))[_0x477a('0x42')]();return _0xeb4924;}function insertTzCmHopperBlack(_0xd79dd3,_0x47436d,_0x1b19af,_0xa41dc1){var _0x20999c=[_0x477a('0x3c'),_0x477a('0x26'),_0x477a('0x3d'),_0x47436d+'.'+_0xa41dc1,_0x477a('0x27'),_0x477a('0x28')];return squel[_0x477a('0x2a')]()[_0x477a('0x2b')](_0x477a('0x3e'))[_0x477a('0x2d')]([_0x477a('0x3f'),_0x477a('0x2f'),_0x477a('0x30'),_0xa41dc1,_0x477a('0x31'),_0x477a('0x32')],squel[_0x477a('0xe')]()[_0x477a('0x34')](_0x20999c)[_0x477a('0xf')](_0x47436d)[_0x477a('0x10')](_0x477a('0x35'),null,_0x477a('0x40')+_0x47436d+_0x477a('0x46'))[_0x477a('0x10')](_0x1b19af,null,_0x1b19af+'.id\x20=\x20'+_0x47436d+'.'+_0xa41dc1)[_0x477a('0x37')](_0x47436d+'.CmListId\x20=\x20?',_0xd79dd3)[_0x477a('0x37')](_0x477a('0x38'),NOW)[_0x477a('0x37')](_0x477a('0x39'),squel[_0x477a('0xe')]()[_0x477a('0x47')](_0x477a('0x3f'))[_0x477a('0xf')](_0x477a('0x3e'))[_0x477a('0x37')]('ListId\x20=\x20?',_0xd79dd3)[_0x477a('0x37')](_0xa41dc1+_0x477a('0x12')+_0x47436d+'.'+_0xa41dc1)))['toString']();}function insertCmHopperAdditionalPhones(_0x43686c){var _0x5c87e0=[_0x477a('0x48'),'cm_contact_has_items.item',_0x477a('0x49'),_0x477a('0x4a'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x477a('0x2b')](_0x477a('0x4b'))[_0x477a('0x2d')](['CmHopperId',_0x477a('0x3f'),_0x477a('0x4c'),_0x477a('0x31'),'updatedAt'],squel[_0x477a('0xe')]()['fields'](_0x5c87e0)[_0x477a('0xf')](_0x477a('0x2c'))[_0x477a('0x10')](_0x477a('0x35'),null,_0x477a('0x4d'))[_0x477a('0x10')](_0x477a('0x4e'),null,_0x477a('0x4f'))[_0x477a('0x37')](_0x477a('0x50'),_0x43686c)[_0x477a('0x37')](_0x477a('0x38'),NOW))[_0x477a('0x42')]();}function insertCmContact(_0x2d7ca1,_0x336843,_0x46ee80,_0x2f3983){var _0x1302a3=_['concat'](_['keys'](_0x2f3983),[_0x477a('0x30'),_0x477a('0x51'),_0x477a('0x31'),_0x477a('0x32')]);return squel[_0x477a('0x2a')]()[_0x477a('0x2b')](_0x477a('0x35'))[_0x477a('0x2d')](_0x1302a3,squel[_0x477a('0xe')]()['fields'](_0x1302a3)[_0x477a('0xf')](_0x336843)[_0x477a('0x37')]('('+_0x46ee80[_0x477a('0x10')](',')+_0x477a('0x52'),squel[_0x477a('0xe')]()[_0x477a('0x34')](_0x46ee80)[_0x477a('0xf')](_0x477a('0x35'))[_0x477a('0x37')]('ListId\x20=\x20?',_0x2d7ca1)[_0x477a('0x37')]('deletedAt\x20IS\x20NULL'))[_0x477a('0x37')](_0x477a('0x53'),squel[_0x477a('0xe')]()[_0x477a('0x47')]('MIN(id)','min_id')[_0x477a('0xf')](_0x336843)[_0x477a('0x54')](_0x46ee80[_0x477a('0x10')](','))))['toString']();}function handleStop(){logger[_0x477a('0x55')](_0x477a('0x56'));stopped=!![];}function handleUncaughtException(_0x353cb6){logger[_0x477a('0x57')](_0x353cb6[_0x477a('0x58')]);process[_0x477a('0x59')](0x1);}function handleError(_0x5c61fc,_0x586963){stats['errors']['push']({'name':_0x586963[_0x477a('0x5a')],'message':_0x586963['message'],'row':_0x5c61fc});}function handleQuery(_0x1602e5){logger[_0x477a('0x55')](_0x1602e5);return db['sequelize'][_0x477a('0x5b')](_0x1602e5)['spread'](function(_0x27a7a9){results[_0x477a('0x1d')](_0x27a7a9);})[_0x477a('0x5c')](function(_0x5e8682){logger[_0x477a('0x57')](_0x5e8682[_0x477a('0x58')]);});}function updateTzCampaigns(_0x57c59d){return new Promise(function(_0x31a21a,_0x533365){var _0x3e1e25=squel[_0x477a('0xe')]()[_0x477a('0x34')]([_0x477a('0x5d'),_0x477a('0x5e')])[_0x477a('0xf')](_0x477a('0x5f'))[_0x477a('0x10')](_0x477a('0x60'),null,_0x477a('0x61'))[_0x477a('0x37')](_0x477a('0x62')+_0x57c59d);db[_0x477a('0x63')]['query'](_0x3e1e25['toString']())[_0x477a('0x64')](function(_0x7278af){var _0x395a22=[];for(var _0x25d74c=0x0;_0x25d74c<_0x7278af[_0x477a('0x18')];_0x25d74c++){_0x395a22[_0x477a('0x1d')](getTimezoneData(_0x7278af[_0x25d74c],tmp_campaigns));}BPromise[_0x477a('0x19')](_0x395a22)['then'](function(){_0x31a21a({'val':0x1});});})[_0x477a('0x5c')](function(_0x49ef92){logger['error'](_0x49ef92['message']);_0x31a21a({'val':0x0});});});}function updateTzVoiceQueues(_0x36e5af){return new Promise(function(_0x2afc9b,_0x46a248){var _0x3453c0=squel[_0x477a('0xe')]()[_0x477a('0x34')]([_0x477a('0x65'),_0x477a('0x66')])[_0x477a('0xf')](_0x477a('0x67'))[_0x477a('0x10')]('voice_queues_has_cm_lists',null,_0x477a('0x68'))[_0x477a('0x37')](_0x477a('0x69')+_0x36e5af);db['sequelize'][_0x477a('0x5b')](_0x3453c0['toString']())['spread'](function(_0x4c4c6f){var _0x3fe43b=[];for(var _0x3ecc38=0x0;_0x3ecc38<_0x4c4c6f['length'];_0x3ecc38++){_0x3fe43b[_0x477a('0x1d')](getTimezoneData(_0x4c4c6f[_0x3ecc38],tmp_voice_queues));}BPromise[_0x477a('0x19')](_0x3fe43b)[_0x477a('0x17')](function(){_0x2afc9b({'val':0x1});});})[_0x477a('0x5c')](function(_0x5910f9){logger[_0x477a('0x57')](_0x5910f9[_0x477a('0x58')]);_0x2afc9b({'val':0x0});});});}function getTimezoneData(_0x43ef59,_0x58a9ee){return new Promise(function(_0x2a2b86,_0x390808){var _0x5a2261=shared[_0x477a('0x6a')];var _0x536ab8=_0x5a2261[_0x43ef59[_0x477a('0x6b')]];if(_['isNil'](_0x536ab8)){_0x2a2b86({'ret':0x1});}else{var _0x3cd606=_0x536ab8['utcOffset'];var _0x1bf149=squel[_0x477a('0x2a')]()['into'](_0x58a9ee)[_0x477a('0x6c')]('id',_0x43ef59['id'])[_0x477a('0x6c')]('offset',_0x3cd606)[_0x477a('0x6c')](_0x477a('0x6b'),_0x43ef59['dialTimezone'])[_0x477a('0x42')]();return db[_0x477a('0x63')][_0x477a('0x5b')](_0x1bf149)[_0x477a('0x64')](function(_0x56d739){_0x2a2b86({'ret':0x1});})['catch'](function(_0x25c4df){logger['error'](_0x25c4df[_0x477a('0x58')]);_0x390808({'ret':0x1});});}});}function handleTZQuery(_0x336cc7){logger[_0x477a('0x55')](_0x336cc7);return db[_0x477a('0x63')][_0x477a('0x5b')](_0x336cc7)[_0x477a('0x64')](function(_0x116a55){})[_0x477a('0x5c')](function(_0x528ffd){logger[_0x477a('0x57')](_0x528ffd['message']);});}function main(_0x173d1b,_0x2a880a,_0x16bca9,_0x239eb8){logger[_0x477a('0x55')]('main',_0x173d1b,JSON['stringify'](_0x2a880a));process[_0x477a('0x6d')]('start');var _0x2766a8=_0x2a880a[_0x477a('0x6e')];var _0x354483=_[_0x477a('0x6f')](_0x2766a8);var _0x2777ef=_0x2a880a['socket_timestamp'];var _0x9dca72=path[_0x477a('0x10')](config[_0x477a('0x70')],'server/files/tmp',_0x2777ef+_0x477a('0x71'));hasTZ=_['keys'](_0x2766a8)[_0x477a('0x72')]('dialTimezone');var _0x3bd443=_[_0x477a('0x73')](_0x2766a8)[_0x477a('0x10')]();logger[_0x477a('0x55')](_0x477a('0x74'),_0x3bd443);db[_0x477a('0x75')]['findAll']({'raw':!![],'attributes':['id',_0x477a('0x76')]})[_0x477a('0x17')](function(_0x18d6f1){for(var _0x1b1df7=0x0;_0x1b1df7<_0x18d6f1[_0x477a('0x18')];_0x1b1df7++){if(_0x18d6f1[_0x1b1df7][_0x477a('0x76')]in _0x2766a8){contactItemTypes[_0x477a('0x1d')](_0x18d6f1[_0x1b1df7]);delete _0x354483[_0x18d6f1[_0x1b1df7][_0x477a('0x76')]];hasAdditionalPhones=!![];}for(var _0x3ed78f in _0x2766a8){if(_0x18d6f1[_0x1b1df7][_0x477a('0x76')]+_0x477a('0x77')===_0x3ed78f){phoneDescriptions[_0x477a('0x1d')]({'itemTypeId':_0x18d6f1[_0x1b1df7]['id'],'description':_0x3ed78f});delete _0x354483[_0x3ed78f];}}}if(hasAdditionalPhones)_0x354483[_0x477a('0x16')]='';var _0x4c05ea=_[_0x477a('0x73')](_0x354483)[_0x477a('0x10')]();logger[_0x477a('0x55')](_0x477a('0x74'),_0x4c05ea);fs[_0x477a('0x78')](_0x9dca72,_0x4c05ea+'\x0a');Papa[_0x477a('0x79')](fs[_0x477a('0x7a')](_0x173d1b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e3892,_0x54c059){try{for(var _0x23a5c2=0x0,_0x47f58e=[];_0x23a5c2<_0x5e3892[_0x477a('0x7b')]['length'];_0x23a5c2++){stats[_0x477a('0x7c')]+=0x1;if(_0x5e3892[_0x477a('0x7d')][_0x23a5c2]){handleError(_0x5e3892[_0x477a('0x7b')][_0x23a5c2],_0x5e3892[_0x477a('0x7d')][_0x23a5c2]);}else{var _0x375939=[];var _0x4a181e=[];var _0x1a5d1c={};for(var _0x16ebc5 in _0x2766a8){let _0x369564=contactItemTypes[_0x477a('0x7e')](_0x29be43=>_0x29be43['name']===_0x16ebc5);let _0x16062f=contactItemTypes[_0x477a('0x7e')](_0x4c1e44=>_0x4c1e44['name']+_0x477a('0x77')===_0x16ebc5);if(_['isNil'](_0x369564)&&_[_0x477a('0x1a')](_0x16062f)){if(_0x2766a8[_0x477a('0x7f')](_0x16ebc5)){if(_0x5e3892[_0x477a('0x7b')][_0x23a5c2][_0x2766a8[_0x16ebc5]]){var _0x10dc8d=_[_0x477a('0x80')](_0x5e3892[_0x477a('0x7b')][_0x23a5c2][_0x2766a8[_0x16ebc5]][_0x477a('0x81')](/"/g,'\x27'));switch(_0x16ebc5){case _0x477a('0x2e'):var _0xe02cdc=moment(_0x10dc8d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xe02cdc[_0x477a('0x82')]()){_0x47f58e[_0x477a('0x1d')]('\x22'+_0x10dc8d+'\x22');}else{_0x375939[_0x477a('0x1d')](_0x477a('0x83'));}break;case _0x477a('0x44'):var _0x2483a8=parseInt(_0x10dc8d);_0x10dc8d=_['isNaN'](_0x2483a8)||_0x2483a8<0x0||_0x2483a8>0x4?_0x239eb8?0x3:0x2:_0x2483a8;_0x47f58e[_0x477a('0x1d')]('\x22'+_0x10dc8d+'\x22');break;case _0x477a('0x45'):var _0x4c3d59=parseInt(_0x10dc8d);if(_[_0x477a('0x84')](_0x4c3d59)&&_['includes'](_0x16bca9,_0x4c3d59)){_0x47f58e[_0x477a('0x1d')]('\x22'+_0x4c3d59+'\x22');}else{_0x375939[_0x477a('0x1d')](_0x477a('0x85'));}break;case _0x477a('0x86'):if(isEmail(_0x10dc8d)){_0x47f58e['push']('\x22'+_0x10dc8d+'\x22');}else{_0x375939[_0x477a('0x1d')](_0x477a('0x87'));}break;case _0x477a('0x88'):var _0x3e04e7=moment(_0x10dc8d,_0x477a('0x89'),!![]);if(_0x3e04e7[_0x477a('0x82')]()){_0x47f58e['push']('\x22'+_0x10dc8d+'\x22');}else{_0x375939[_0x477a('0x1d')](_0x477a('0x8a'));}break;case _0x477a('0x6b'):var _0x1397ab=shared['timezones'];var _0x23a21d=_0x1397ab[_0x10dc8d];if(!_[_0x477a('0x1a')](_0x23a21d)){var _0x132aaf=_0x23a21d[_0x477a('0x8b')];_0x47f58e['push']('\x22'+_0x10dc8d+'\x22');_0x47f58e[_0x477a('0x1d')]('\x22'+_0x132aaf+'\x22');}break;default:_0x47f58e[_0x477a('0x1d')]('\x22'+_0x10dc8d+'\x22');}}else{switch(_0x16ebc5){case _0x477a('0x8c'):case _0x477a('0x3f'):_0x375939[_0x477a('0x1d')](_0x16ebc5+'\x20not\x20specified');break;default:_0x47f58e[_0x477a('0x1d')]('\x22\x22');}}}}else{var _0x3f943e='';if(!_[_0x477a('0x1a')](_0x369564)){if(!_0x1a5d1c[_0x477a('0x7f')](_0x369564['id'])){if(!_['isNil'](_0x5e3892[_0x477a('0x7b')][_0x23a5c2][_0x2766a8[_0x16ebc5]])){var _0x10dc8d=_[_0x477a('0x80')](_0x5e3892[_0x477a('0x7b')][_0x23a5c2][_0x2766a8[_0x16ebc5]][_0x477a('0x81')](/"/g,'\x27'));var _0x30742c=phoneDescriptions[_0x477a('0x7e')](_0x434de2=>_0x434de2[_0x477a('0x8d')]===_0x369564['id']);if(!_[_0x477a('0x1a')](_0x30742c)){var _0x4d79a9=_[_0x477a('0x80')](_0x5e3892[_0x477a('0x7b')][_0x23a5c2][_0x2766a8[_0x30742c[_0x477a('0x8e')]]][_0x477a('0x81')](/"/g,'\x27'));if(!_[_0x477a('0x1a')](_0x4d79a9))_0x10dc8d=_0x10dc8d+'§'+_0x4d79a9;}if(_0x3f943e=='')_0x3f943e=_0x10dc8d;else _0x3f943e+='|'+_0x10dc8d;}_0x4a181e['push'](_0x369564['id']+':'+_0x3f943e);_0x1a5d1c[_0x369564['id']]=0x1;}}}}if(hasAdditionalPhones){_0x47f58e['push']('\x22'+_0x4a181e['join'](';')+'\x22');}if(_0x375939[_0x477a('0x18')]){handleError(_0x5e3892[_0x477a('0x7b')][_0x23a5c2],{'code':_0x477a('0x8f'),'message':_0x375939[_0x477a('0x10')]()});}else{fs[_0x477a('0x90')](_0x9dca72,_0x47f58e[_0x477a('0x10')]()+'\x0a');}_0x47f58e=[];}if(!(stats[_0x477a('0x7c')]%0xc8)){socket[_0x477a('0x91')](_0x477a('0x92')+_0x2777ef,stats);stats[_0x477a('0x7d')]=[];}}if(stopped){logger[_0x477a('0x55')]('Abort\x20parser');_0x54c059[_0x477a('0x93')]();}}catch(_0x1fcff5){handleError(_0x5e3892[_0x477a('0x7b')][_0x23a5c2],{'code':_0x477a('0x94'),'message':_0x1fcff5[_0x477a('0x58')]});logger[_0x477a('0x57')](_0x477a('0x95'),_0x1fcff5[_0x477a('0x58')]);}},'complete':function(){try{var _0x5ed301=[];var _0x301169=[];var _0x17e4a9=_0x477a('0x35');if(_0x2a880a['duplicates']&&_0x2a880a[_0x477a('0x96')][_0x477a('0x18')]){_0x17e4a9='cm_contacts_'+_0x2777ef;_0x5ed301[_0x477a('0x1d')](_0x477a('0x97')+_0x17e4a9+_0x477a('0x98'));}tmp_campaigns=_0x477a('0x99')+_0x2777ef;tmp_voice_queues=_0x477a('0x9a')+_0x2777ef;_0x301169[_0x477a('0x1d')](_0x477a('0x97')+tmp_campaigns+_0x477a('0x9b'));_0x301169[_0x477a('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x477a('0x9b'));BPromise['each'](_0x301169,handleTZQuery)[_0x477a('0x17')](function(_0x4b6aac){updateTzCampaigns(_0x2a880a['ListId'])['then'](function(_0x6fc30c){updateTzVoiceQueues(_0x2a880a[_0x477a('0x30')])[_0x477a('0x17')](function(_0x8c4fdc){if(hasTZ)_0x4c05ea=_0x4c05ea[_0x477a('0x81')](_0x477a('0x6b'),_0x477a('0x9c'));var _0x311e85=util['format']('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',_0x9dca72,_0x17e4a9,_0x4c05ea,_0x2a880a[_0x477a('0x30')],_0x2a880a[_0x477a('0x51')]||null,NOW,NOW);if(_[_0x477a('0x1a')](_0x2766a8[_0x477a('0x2e')])){_0x311e85+=_0x477a('0x9d');}_0x5ed301['push'](_0x311e85);if(_0x2a880a['duplicates']&&_0x2a880a[_0x477a('0x96')]['length']){_0x5ed301[_0x477a('0x1d')](insertCmContact(_0x2a880a[_0x477a('0x30')],_0x17e4a9,_0x2a880a[_0x477a('0x96')],_0x2766a8));_0x5ed301[_0x477a('0x1d')](_0x477a('0x9e')+_0x17e4a9+';');}BPromise['each'](_0x5ed301,handleQuery)[_0x477a('0x17')](function(_0x4b49f0){BPromise[_0x477a('0x19')]([handleAdditionalPhones()])[_0x477a('0x17')](function(){_0x5ed301=[];for(var _0x567f12=0x0;_0x567f12_0x5407f5[_0xe56f('0x66')]===_0x3074e4);let _0x28ef74=contactItemTypes[_0xe56f('0x6e')](_0x22dfc4=>_0x22dfc4[_0xe56f('0x66')]+'_description'===_0x3074e4);if(_['isNil'](_0x55985f)&&_['isNil'](_0x28ef74)){if(_0x92b989['hasOwnProperty'](_0x3074e4)){if(_0x4c96ca['data'][_0x2a266d][_0x92b989[_0x3074e4]]){var _0x38019e=_['trim'](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x3074e4]][_0xe56f('0x6f')](/"/g,'\x27'));switch(_0x3074e4){case _0xe56f('0x32'):var _0x7755c4=moment(_0x38019e,_0xe56f('0xc'),!![]);if(_0x7755c4[_0xe56f('0x70')]()){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017[_0xe56f('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe56f('0x36'):var _0xb3eb56=parseInt(_0x38019e);_0x38019e=_['isNaN'](_0xb3eb56)||_0xb3eb56<0x0||_0xb3eb56>0x4?_0x1c72f4?0x3:0x2:_0xb3eb56;_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');break;case _0xe56f('0x37'):var _0x485dfd=parseInt(_0x38019e);if(_[_0xe56f('0x71')](_0x485dfd)&&_[_0xe56f('0x72')](_0x104d51,_0x485dfd)){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x485dfd+'\x22');}else{_0x310017[_0xe56f('0x1a')](_0xe56f('0x73'));}break;case _0xe56f('0x74'):if(isEmail(_0x38019e)){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017['push'](_0xe56f('0x75'));}break;case _0xe56f('0x76'):var _0x52276e=moment(_0x38019e,_0xe56f('0x77'),!![]);if(_0x52276e['isValid']()){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017[_0xe56f('0x1a')](_0xe56f('0x78'));}break;default:_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}}else{switch(_0x3074e4){case _0xe56f('0x79'):case _0xe56f('0x10'):_0x310017[_0xe56f('0x1a')](_0x3074e4+_0xe56f('0x7a'));break;default:_0xc15eb2[_0xe56f('0x1a')]('\x22\x22');}}}}else{var _0x1dac38='';if(!_[_0xe56f('0x18')](_0x55985f)){if(!_0x256ce6[_0xe56f('0x7b')](_0x55985f['id'])){for(var _0xb783f2=0x0;_0xb783f2<_0x92b989[_0x3074e4]['length'];_0xb783f2++){var _0x38019e=_[_0xe56f('0x7c')](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x3074e4][_0xb783f2]][_0xe56f('0x6f')](/"/g,'\x27'));var _0x445a61=phoneDescriptions[_0xe56f('0x6e')](_0xd2dd5c=>_0xd2dd5c[_0xe56f('0x7d')]===_0x55985f['id']);if(!_['isNil'](_0x445a61)){var _0x2475e3=_[_0xe56f('0x7c')](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x445a61['description']][0x0]][_0xe56f('0x6f')](/"/g,'\x27'));if(!_[_0xe56f('0x18')](_0x2475e3))_0x38019e=_0x38019e+'§'+_0x2475e3;}if(_0x1dac38=='')_0x1dac38=_0x38019e;else _0x1dac38+='|'+_0x38019e;}_0x31c56b[_0xe56f('0x1a')](_0x55985f['id']+':'+_0x1dac38);_0x256ce6[_0x55985f['id']]=0x1;}}}}if(hasAdditionalPhones){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x31c56b['join'](';')+'\x22');}if(_0x310017[_0xe56f('0x17')]){handleError(_0x4c96ca[_0xe56f('0x6b')][_0x2a266d],{'code':_0xe56f('0x7e'),'message':_0x310017[_0xe56f('0x11')]()});}else{fs['appendFileSync'](_0x599622,_0xc15eb2[_0xe56f('0x11')]()+'\x0a');}_0xc15eb2=[];}if(!(stats[_0xe56f('0x6c')]%0xc8)){socket[_0xe56f('0x7f')]('contact:import:'+_0x58fa85,stats);stats[_0xe56f('0x6d')]=[];}}if(stopped){logger[_0xe56f('0x58')](_0xe56f('0x80'));_0x9679c9[_0xe56f('0x81')]();}}catch(_0x276b84){handleError(_0x4c96ca[_0xe56f('0x6b')][_0x2a266d],{'code':_0xe56f('0x82'),'message':_0x276b84[_0xe56f('0x5b')]});logger[_0xe56f('0x1e')]('step',_0x276b84[_0xe56f('0x5b')]);}},'complete':function(){try{var _0x29583a=[];var _0x598d06=tempTableName;_0x29583a[_0xe56f('0x1a')](_0xe56f('0x83')+_0x598d06+_0xe56f('0x84'));logger[_0xe56f('0x58')]('CIS\x20len',contactItemTypes[_0xe56f('0x17')]);var _0x53cf7c=util[_0xe56f('0xb')](_0xe56f('0x85'),_0x599622,_0x598d06,_0x3b6962,_0x277258[_0xe56f('0x33')],_0x277258[_0xe56f('0x54')]||null,NOW,NOW);if(_[_0xe56f('0x18')](_0x92b989[_0xe56f('0x32')])){_0x53cf7c+=_0xe56f('0x86');}_0x29583a[_0xe56f('0x1a')](_0x53cf7c);BPromise[_0xe56f('0x87')](_0x29583a,handleQuery)[_0xe56f('0x1c')](function(_0x1eb33f){BPromise[_0xe56f('0x1b')]([handleAdditionalPhones()])[_0xe56f('0x1c')](function(){_0x29583a=[];for(var _0x3ab009=0x0;_0x3ab009\x20\x20');}var _0x3551d5=path[_0xe56f('0x11')](config[_0xe56f('0x93')],_0xe56f('0x62'),process[_0xe56f('0x92')][0x2]);if(!fs['existsSync'](_0x3551d5)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x48de58={};try{_0x48de58=JSON[_0xe56f('0x6a')](process[_0xe56f('0x92')][0x3]);if(!_0x48de58['binding']){throw new Error(_0xe56f('0x94'));}var _0x2a6d34=0x0;if(_0x48de58[_0xe56f('0x5f')][_0xe56f('0x37')]){_0x2a6d34=0x1;}if(!_0x48de58[_0xe56f('0x33')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x40a0b9){throw new Error(_0xe56f('0x95'));}var _0x305c43=[];try{_0x305c43=_[_0xe56f('0x96')](JSON[_0xe56f('0x6a')](process['argv'][0x4]),'id');}catch(_0x52570a){logger[_0xe56f('0x58')](_0xe56f('0x97'));}main(_0x3551d5,_0x48de58,_0x305c43,_0x2a6d34);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe56f('0x98'),handleUncaughtException); \ No newline at end of file +var _0xc3ed=['split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','createdAt','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','exit','errors','code','query','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','createReadStream','rows','data','_description','hasOwnProperty','trim','isNaN','isNumber','includes','agent\x20not\x20exists','email','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','find','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','finish','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','parse','No\x20agent\x20available','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','message'];(function(_0x2eec9e,_0x59e015){var _0x4e8b48=function(_0x5750db){while(--_0x5750db){_0x2eec9e['push'](_0x2eec9e['shift']());}};_0x4e8b48(++_0x59e015);}(_0xc3ed,0x111));var _0xdc3e=function(_0xea896c,_0x47a284){_0xea896c=_0xea896c-0x0;var _0x1e7e53=_0xc3ed[_0xea896c];return _0x1e7e53;};'use strict';var fs=require('fs');var path=require(_0xdc3e('0x0'));var _=require(_0xdc3e('0x1'));var Papa=require('papaparse');var util=require(_0xdc3e('0x2'));var BPromise=require(_0xdc3e('0x3'));var moment=require(_0xdc3e('0x4'));var squel=require(_0xdc3e('0x5'));var Redis=require(_0xdc3e('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xdc3e('0x7'));var logger=require('../../../config/logger')(_0xdc3e('0x8'));config[_0xdc3e('0x9')]=_[_0xdc3e('0xa')](config[_0xdc3e('0x9')],{'host':_0xdc3e('0xb'),'port':0x18eb});var socket=require(_0xdc3e('0xc'))(new Redis(config[_0xdc3e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xdc3e('0xd')](_0xdc3e('0xe'));var tempTableName=_0xdc3e('0xf')+moment()[_0xdc3e('0xd')](_0xdc3e('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x462f28){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))*$/[_0xdc3e('0x11')](_0x462f28);}function selectNotIn(_0x10dce7,_0xfc1a1e,_0x18a4c6,_0x4af4b6,_0x3b05bc){return squel[_0xdc3e('0x12')]()[_0xdc3e('0x13')]('phone')[_0xdc3e('0x14')](_0x4af4b6)['join'](_0xfc1a1e,null,_0xfc1a1e+_0xdc3e('0x15')+_0x4af4b6+'.'+_0x18a4c6)[_0xdc3e('0x16')](_0x4af4b6+'.'+_0x18a4c6+'\x20=\x20'+_0x10dce7+'.'+_0x18a4c6)['where'](_0xfc1a1e+_0xdc3e('0x17')+_0x3b05bc['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x15133e,_0x14b0ab){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdc3e('0x18')]['query'](_0xdc3e('0x19')+tempTableName)[_0xdc3e('0x1a')](function(_0x384c96){if(_0x384c96!==null){var _0x20ff82=[];for(var _0x56ece5=0x0;_0x56ece5<_0x384c96[_0xdc3e('0x1b')];_0x56ece5++){var _0x2e6f59=_0x384c96[_0x56ece5];if(!_[_0xdc3e('0x1c')](_0x2e6f59[_0xdc3e('0x1d')])){if(!_['isNil'](_0x2e6f59[_0xdc3e('0x1e')]))_0x20ff82[_0xdc3e('0x1f')](insertAdditionalPhones(_0x2e6f59));promisesContact[_0xdc3e('0x1f')]({'contact':_0x2e6f59});}}}Promise[_0xdc3e('0x20')](_0x20ff82)[_0xdc3e('0x21')](function(){_0x15133e({'val':0x1});});})[_0xdc3e('0x22')](function(_0x13bc8c){logger[_0xdc3e('0x23')](_0x13bc8c[_0xdc3e('0x24')]);});});}function insertAdditionalPhones(_0x1da9c0){return new Promise(function(_0x7b4ee,_0x37f6be){var _0x470d31=_0x1da9c0[_0xdc3e('0x1e')];if(_['isNil'](_0x470d31))_0x37f6be({'val':0x0});else{var _0x19e2fc=_0x470d31['split'](';');var _0x2ae1e3=[];orderBy=0x0;for(var _0x4f0a23=0x0;_0x4f0a23<_0x19e2fc['length'];_0x4f0a23++){_0x2ae1e3[_0xdc3e('0x1f')](splitAdditionalPhone(_0x1da9c0['id'],_0x19e2fc[_0x4f0a23]));}Promise[_0xdc3e('0x20')](_0x2ae1e3)['then'](function(){_0x7b4ee({'val':_0x19e2fc[_0xdc3e('0x1b')]});});}});}function splitAdditionalPhone(_0x2116b4,_0x16be9f){return new Promise(function(_0x276786,_0xcf3f50){var _0x246305=_0x16be9f['split'](':');var _0xd5e163=_0x246305[0x0];var _0x4e2e98=_0x246305[0x1];if(_0x4e2e98!==''){var _0x1aef09=_0x4e2e98[_0xdc3e('0x25')]('|');var _0x44cc9c=[];for(var _0x519a09=0x0;_0x519a09<_0x1aef09[_0xdc3e('0x1b')];_0x519a09++){if(_0x1aef09[_0x519a09]!==''){var _0x45bb49=_[_0xdc3e('0x26')](promisesAdditionalPhones,{'contactId':_0x2116b4,'phone':_0x1aef09[_0x519a09]});if(_0x45bb49[_0xdc3e('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2116b4,'contactTypeId':_0xd5e163,'phone':_0x1aef09[_0x519a09],'orderBy':orderBy});}}}_0x276786({'ok':0x1});}else _0x276786({'res':0x0});});}function createAdditionalPhone(_0x14da02,_0x595454,_0x489b18,_0x2ff2c0){var _0x3d1e1f='';var _0x1168bb='';var _0x232e54=_0x489b18[_0xdc3e('0x25')]('§');_0x3d1e1f=_0x232e54[0x0];if(_0x232e54['length']==0x2)_0x1168bb=_0x232e54[0x1];return new Promise(function(_0x4e4202,_0x2e3e39){return db[_0xdc3e('0x27')][_0xdc3e('0x28')]({'where':{'CmContactId':_0x14da02,'item':_0x3d1e1f}})[_0xdc3e('0x21')](function(_0x4f69e7){if(_0x4f69e7){return db['CmContactHasItem'][_0xdc3e('0x29')]({'ItemTypeId':_0x595454,'description':_0x1168bb,'OrderBy':_0x2ff2c0},{'where':{'CmContactId':_0x14da02,'item':_0x3d1e1f}})[_0xdc3e('0x21')](function(_0x470e1f){_0x4e4202({'res':_0xdc3e('0x2a')});});}else{return db[_0xdc3e('0x27')][_0xdc3e('0x2b')]({'CmContactId':_0x14da02,'item':_0x3d1e1f,'ItemTypeId':_0x595454,'description':_0x1168bb,'OrderBy':_0x2ff2c0,'ItemClass':_0xdc3e('0x2c')})[_0xdc3e('0x21')](function(_0x42904e){_0x4e4202({'res':_0xdc3e('0x2d')});});}});});}function updateContact(_0x1fd7fd){return new Promise(function(_0x4fb69a,_0x3b34a5){var _0x5335e6=_0x1fd7fd['id'];delete _0x1fd7fd['id'];return db[_0xdc3e('0x2e')][_0xdc3e('0x29')](_0x1fd7fd,{'where':{'id':_0x5335e6}})[_0xdc3e('0x21')](function(_0x76366d){updatedRows+=0x1;return db[_0xdc3e('0x2f')][_0xdc3e('0x29')]({'phone':_0x1fd7fd[_0xdc3e('0x1d')]},{'where':{'ContactId':_0x5335e6}})['then'](function(_0x3881b9){_0x4fb69a({'ret':'OK'});});});});}function insertCmHopper(_0x1dee65,_0x353e7c,_0x244e5d,_0x3e589b,_0x388f5c){var _0x21ccc5=[_0xdc3e('0x30'),_0xdc3e('0x31'),_0xdc3e('0x32'),_0xdc3e('0x33'),_0x353e7c+'.'+_0x3e589b,_0xdc3e('0x34'),_0xdc3e('0x35'),'cm_contacts.priority',_0xdc3e('0x36'),'\x22'+_0x388f5c+'\x22'];return squel[_0xdc3e('0x37')]()[_0xdc3e('0x38')](_0xdc3e('0x39'))[_0xdc3e('0x3a')]([_0xdc3e('0x1d'),_0xdc3e('0x3b'),_0xdc3e('0x3c'),_0xdc3e('0x3d'),_0x3e589b,'createdAt',_0xdc3e('0x3e'),_0xdc3e('0x3f'),_0xdc3e('0x40'),_0xdc3e('0x41')],squel['select']()[_0xdc3e('0x42')](_0x21ccc5)[_0xdc3e('0x14')](_0x353e7c)[_0xdc3e('0x43')](_0xdc3e('0x44'),null,_0xdc3e('0x45')+_0x353e7c+_0xdc3e('0x46'))[_0xdc3e('0x43')](_0x244e5d,null,_0x244e5d+_0xdc3e('0x15')+_0x353e7c+'.'+_0x3e589b)['where'](_0x353e7c+_0xdc3e('0x47'),_0x1dee65)[_0xdc3e('0x16')](_0xdc3e('0x48'),NOW)[_0xdc3e('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x353e7c,_0x244e5d,_0x3e589b,'cm_hopper',[_0xdc3e('0x49'),'\x22onlyIfOpen\x22']))['where'](_0xdc3e('0x4a'),selectNotIn(_0x353e7c,_0x244e5d,_0x3e589b,_0xdc3e('0x39'),[_0xdc3e('0x49')])))[_0xdc3e('0x4b')]();}function insertCmHopperBlack(_0x248b78,_0x3ee3e1,_0x6b669f,_0x3145d1){var _0x563784=[_0xdc3e('0x30'),_0xdc3e('0x32'),'cm_contacts.ListId',_0x3ee3e1+'.'+_0x3145d1,'cm_contacts.createdAt',_0xdc3e('0x35')];return squel['insert']()[_0xdc3e('0x38')](_0xdc3e('0x4c'))[_0xdc3e('0x3a')](['phone','ContactId',_0xdc3e('0x3d'),_0x3145d1,_0xdc3e('0x4d'),_0xdc3e('0x3e')],squel['select']()['fields'](_0x563784)['from'](_0x3ee3e1)[_0xdc3e('0x43')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3ee3e1+_0xdc3e('0x46'))[_0xdc3e('0x43')](_0x6b669f,null,_0x6b669f+_0xdc3e('0x15')+_0x3ee3e1+'.'+_0x3145d1)['where'](_0x3ee3e1+_0xdc3e('0x47'),_0x248b78)['where'](_0xdc3e('0x48'),NOW)[_0xdc3e('0x16')](_0xdc3e('0x4a'),squel[_0xdc3e('0x12')]()[_0xdc3e('0x13')](_0xdc3e('0x1d'))[_0xdc3e('0x14')](_0xdc3e('0x4c'))['where'](_0xdc3e('0x4e'),_0x248b78)[_0xdc3e('0x16')](_0x3145d1+_0xdc3e('0x4f'),_0x3ee3e1+'.'+_0x3145d1)))[_0xdc3e('0x4b')]();}function insertCmHopperAdditionalPhones(_0x241b2d){var _0x5cff6e=[_0xdc3e('0x50'),_0xdc3e('0x51'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xdc3e('0x52')];return squel[_0xdc3e('0x37')]()[_0xdc3e('0x38')](_0xdc3e('0x53'))[_0xdc3e('0x3a')]([_0xdc3e('0x54'),_0xdc3e('0x1d'),'OrderBy',_0xdc3e('0x4d'),'updatedAt'],squel[_0xdc3e('0x12')]()[_0xdc3e('0x42')](_0x5cff6e)[_0xdc3e('0x14')](_0xdc3e('0x39'))[_0xdc3e('0x43')](_0xdc3e('0x44'),null,_0xdc3e('0x55'))[_0xdc3e('0x43')]('cm_contact_has_items',null,_0xdc3e('0x56'))[_0xdc3e('0x16')](_0xdc3e('0x57'),_0x241b2d)['where'](_0xdc3e('0x48'),NOW))[_0xdc3e('0x4b')]();}function insertCmContact(_0x409792,_0x347693,_0xd81377,_0x4b1b74){var _0x74118e=_[_0xdc3e('0x58')](_[_0xdc3e('0x59')](_0x4b1b74),[_0xdc3e('0x3d'),_0xdc3e('0x5a'),_0xdc3e('0x4d'),_0xdc3e('0x3e')]);return squel[_0xdc3e('0x37')]()[_0xdc3e('0x38')](_0xdc3e('0x44'))[_0xdc3e('0x3a')](_0x74118e,squel[_0xdc3e('0x12')]()[_0xdc3e('0x42')](_0x74118e)[_0xdc3e('0x14')](_0x347693)[_0xdc3e('0x16')]('('+_0xd81377['join'](',')+_0xdc3e('0x5b'),squel[_0xdc3e('0x12')]()['fields'](_0xd81377)[_0xdc3e('0x14')]('cm_contacts')[_0xdc3e('0x16')]('ListId\x20=\x20?',_0x409792))[_0xdc3e('0x16')](_0xdc3e('0x5c'),squel[_0xdc3e('0x12')]()['field'](_0xdc3e('0x5d'),'min_id')[_0xdc3e('0x14')](_0x347693)[_0xdc3e('0x5e')](_0xd81377[_0xdc3e('0x43')](','))))[_0xdc3e('0x4b')]();}function handleStop(){logger[_0xdc3e('0x5f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x431ba8){logger[_0xdc3e('0x23')](_0x431ba8[_0xdc3e('0x24')]);process[_0xdc3e('0x60')](0x1);}function handleError(_0x56ea7e,_0x5147f1){stats[_0xdc3e('0x61')]['push']({'name':_0x5147f1[_0xdc3e('0x62')],'message':_0x5147f1[_0xdc3e('0x24')],'row':_0x56ea7e});}function handleQuery(_0x6f48ac){logger[_0xdc3e('0x5f')](_0x6f48ac);return db[_0xdc3e('0x18')][_0xdc3e('0x63')](_0x6f48ac)[_0xdc3e('0x1a')](function(_0x4e8f8a){results['push'](_0x4e8f8a);})[_0xdc3e('0x22')](function(_0x28a07a){logger[_0xdc3e('0x23')](_0x28a07a[_0xdc3e('0x24')]);});}function main(_0x2d81a6,_0x3b28da,_0xc56b09,_0x5d2938){logger[_0xdc3e('0x5f')]('main',_0x2d81a6,JSON[_0xdc3e('0x64')](_0x3b28da));process['send'](_0xdc3e('0x65'));var _0x54f545=_0x3b28da[_0xdc3e('0x66')];var _0x4b5128=_[_0xdc3e('0x67')](_0x54f545);var _0x32003f=_0x3b28da[_0xdc3e('0x68')];var _0x61fa74=path[_0xdc3e('0x43')](config[_0xdc3e('0x69')],_0xdc3e('0x6a'),_0x32003f+_0xdc3e('0x6b'));logger[_0xdc3e('0x5f')](_0xdc3e('0x6c'),_0x3b28da);db[_0xdc3e('0x6d')][_0xdc3e('0x6e')]({'raw':!![],'attributes':['id',_0xdc3e('0x6f')]})['then'](function(_0x1d384d){for(var _0x445011=0x0;_0x445011<_0x1d384d[_0xdc3e('0x1b')];_0x445011++){if(_0x1d384d[_0x445011][_0xdc3e('0x6f')]in _0x54f545){contactItemTypes[_0xdc3e('0x1f')](_0x1d384d[_0x445011]);delete _0x4b5128[_0x1d384d[_0x445011][_0xdc3e('0x6f')]];hasAdditionalPhones=!![];}for(var _0x514dd6 in _0x54f545){if(_0x1d384d[_0x445011][_0xdc3e('0x6f')]+'_description'===_0x514dd6){phoneDescriptions[_0xdc3e('0x1f')]({'itemTypeId':_0x1d384d[_0x445011]['id'],'description':_0x514dd6});delete _0x4b5128[_0x514dd6];}}}if(hasAdditionalPhones)_0x4b5128[_0xdc3e('0x1e')]='';var _0x39be30=_[_0xdc3e('0x59')](_0x4b5128)[_0xdc3e('0x43')]();logger[_0xdc3e('0x5f')](_0xdc3e('0x70'),_0x39be30);fs[_0xdc3e('0x71')](_0x61fa74,_0x39be30+'\x0a');Papa['parse'](fs[_0xdc3e('0x72')](_0x2d81a6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x32abac,_0x330182){try{for(var _0x584b67=0x0,_0xcafc5f=[];_0x584b67<_0x32abac['data'][_0xdc3e('0x1b')];_0x584b67++){stats[_0xdc3e('0x73')]+=0x1;if(_0x32abac['errors'][_0x584b67]){handleError(_0x32abac[_0xdc3e('0x74')][_0x584b67],_0x32abac[_0xdc3e('0x61')][_0x584b67]);}else{var _0x8a6666=[];var _0x4082e5=[];var _0x1ee0c3={};for(var _0x56b426 in _0x54f545){let _0x1907c3=contactItemTypes['find'](_0x4b0623=>_0x4b0623[_0xdc3e('0x6f')]===_0x56b426);let _0x5c4f0f=contactItemTypes['find'](_0x5e3c9c=>_0x5e3c9c[_0xdc3e('0x6f')]+_0xdc3e('0x75')===_0x56b426);if(_[_0xdc3e('0x1c')](_0x1907c3)&&_[_0xdc3e('0x1c')](_0x5c4f0f)){if(_0x54f545[_0xdc3e('0x76')](_0x56b426)){if(_0x32abac[_0xdc3e('0x74')][_0x584b67][_0x54f545[_0x56b426]]){var _0x405788=_[_0xdc3e('0x77')](_0x32abac['data'][_0x584b67][_0x54f545[_0x56b426]]['replace'](/"/g,'\x27'));switch(_0x56b426){case'scheduledat':var _0xf58294=moment(_0x405788,_0xdc3e('0xe'),!![]);if(_0xf58294['isValid']()){_0xcafc5f['push']('\x22'+_0x405788+'\x22');}else{_0x8a6666[_0xdc3e('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4c9846=parseInt(_0x405788);_0x405788=_[_0xdc3e('0x78')](_0x4c9846)||_0x4c9846<0x0||_0x4c9846>0x4?_0x5d2938?0x3:0x2:_0x4c9846;_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0x405788+'\x22');break;case _0xdc3e('0x40'):var _0xf8c89e=parseInt(_0x405788);if(_[_0xdc3e('0x79')](_0xf8c89e)&&_[_0xdc3e('0x7a')](_0xc56b09,_0xf8c89e)){_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0xf8c89e+'\x22');}else{_0x8a6666[_0xdc3e('0x1f')](_0xdc3e('0x7b'));}break;case _0xdc3e('0x7c'):if(isEmail(_0x405788)){_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0x405788+'\x22');}else{_0x8a6666[_0xdc3e('0x1f')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0xd8af9=moment(_0x405788,'YYYY-MM-DD',!![]);if(_0xd8af9[_0xdc3e('0x7d')]()){_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0x405788+'\x22');}else{_0x8a6666[_0xdc3e('0x1f')](_0xdc3e('0x7e'));}break;default:_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0x405788+'\x22');}}else{switch(_0x56b426){case _0xdc3e('0x7f'):case _0xdc3e('0x1d'):_0x8a6666[_0xdc3e('0x1f')](_0x56b426+_0xdc3e('0x80'));break;default:_0xcafc5f[_0xdc3e('0x1f')]('\x22\x22');}}}}else{var _0x3ee39c='';if(!_[_0xdc3e('0x1c')](_0x1907c3)){if(!_0x1ee0c3['hasOwnProperty'](_0x1907c3['id'])){for(var _0xb36f8e=0x0;_0xb36f8e<_0x54f545[_0x56b426]['length'];_0xb36f8e++){var _0x405788=_[_0xdc3e('0x77')](_0x32abac[_0xdc3e('0x74')][_0x584b67][_0x54f545[_0x56b426][_0xb36f8e]][_0xdc3e('0x81')](/"/g,'\x27'));var _0x11cfc2=phoneDescriptions[_0xdc3e('0x82')](_0x50aaf3=>_0x50aaf3['itemTypeId']===_0x1907c3['id']);if(!_[_0xdc3e('0x1c')](_0x11cfc2)){var _0x415c59=_['trim'](_0x32abac['data'][_0x584b67][_0x54f545[_0x11cfc2['description']][0x0]][_0xdc3e('0x81')](/"/g,'\x27'));if(!_[_0xdc3e('0x1c')](_0x415c59))_0x405788=_0x405788+'§'+_0x415c59;}if(_0x3ee39c=='')_0x3ee39c=_0x405788;else _0x3ee39c+='|'+_0x405788;}_0x4082e5[_0xdc3e('0x1f')](_0x1907c3['id']+':'+_0x3ee39c);_0x1ee0c3[_0x1907c3['id']]=0x1;}}}}if(hasAdditionalPhones){_0xcafc5f[_0xdc3e('0x1f')]('\x22'+_0x4082e5[_0xdc3e('0x43')](';')+'\x22');}if(_0x8a6666[_0xdc3e('0x1b')]){handleError(_0x32abac[_0xdc3e('0x74')][_0x584b67],{'code':_0xdc3e('0x83'),'message':_0x8a6666[_0xdc3e('0x43')]()});}else{fs[_0xdc3e('0x84')](_0x61fa74,_0xcafc5f[_0xdc3e('0x43')]()+'\x0a');}_0xcafc5f=[];}if(!(stats[_0xdc3e('0x73')]%0xc8)){socket[_0xdc3e('0x85')](_0xdc3e('0x86')+_0x32003f,stats);stats[_0xdc3e('0x61')]=[];}}if(stopped){logger['info'](_0xdc3e('0x87'));_0x330182[_0xdc3e('0x88')]();}}catch(_0x3e0bed){handleError(_0x32abac['data'][_0x584b67],{'code':_0xdc3e('0x89'),'message':_0x3e0bed[_0xdc3e('0x24')]});logger[_0xdc3e('0x23')]('step',_0x3e0bed[_0xdc3e('0x24')]);}},'complete':function(){try{var _0x31bc05=[];var _0x821a36=tempTableName;_0x31bc05[_0xdc3e('0x1f')](_0xdc3e('0x8a')+_0x821a36+_0xdc3e('0x8b'));logger['info']('CIS\x20len',contactItemTypes[_0xdc3e('0x1b')]);var _0x3c0b87=util[_0xdc3e('0xd')](_0xdc3e('0x8c'),_0x61fa74,_0x821a36,_0x39be30,_0x3b28da[_0xdc3e('0x3d')],_0x3b28da['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x54f545['scheduledat'])){_0x3c0b87+=_0xdc3e('0x8d');}_0x31bc05[_0xdc3e('0x1f')](_0x3c0b87);BPromise['each'](_0x31bc05,handleQuery)[_0xdc3e('0x21')](function(_0x13d813){BPromise[_0xdc3e('0x20')]([handleAdditionalPhones()])[_0xdc3e('0x21')](function(){_0x31bc05=[];for(var _0x2f8cbe=0x0;_0x2f8cbe\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting'];(function(_0x2038bc,_0x310c9f){var _0x266da4=function(_0x150354){while(--_0x150354){_0x2038bc['push'](_0x2038bc['shift']());}};_0x266da4(++_0x310c9f);}(_0xb821,0xa7));var _0x1b82=function(_0x114a21,_0x379ac8){_0x114a21=_0x114a21-0x0;var _0x15a54a=_0xb821[_0x114a21];return _0x15a54a;};'use strict';var _=require('lodash');var squel=require(_0x1b82('0x0'));var as=require(_0x1b82('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x1b82('0x2')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3b1d14,_0x1403ab,_0x3fadf0){var _0x26db32=![];var _0x597ca7=utils[_0x1b82('0x3')](_0x3b1d14);if(_0x1403ab[_0x1b82('0x4')]===_0x1b82('0x5')&&!_0x3fadf0[_0x1b82('0x6')]&&!_0x3fadf0[_0x597ca7]){_0x26db32=!![];}return _0x26db32;}function getTagsQuery(){return squel[_0x1b82('0x7')]()[_0x1b82('0x8')]('id')[_0x1b82('0x8')](_0x1b82('0x9'))[_0x1b82('0x8')]('color')[_0x1b82('0xa')](_0x1b82('0xb'));}function getUsersQuery(_0x44dfd4,_0x14c57a){var _0xcffb87=utils[_0x1b82('0xc')](_0x44dfd4);var _0x739f99=_0x1b82('0xd')+_0x44dfd4+'_interactions';var _0x46007e=squel[_0x1b82('0x7')]()[_0x1b82('0x8')](_0x1b82('0xe'))['field'](_0x1b82('0xf'))['field']('ui.'+_0xcffb87)[_0x1b82('0xa')](_0x739f99,'ui')['left_join'](_0x1b82('0x10'),'u',_0x1b82('0x11'));if(_0x14c57a['length']>0x0){_0x46007e[_0x1b82('0x12')]('ui.'+_0xcffb87+'\x20IN\x20?',_[_0x1b82('0x13')](_0x14c57a,'id'));}return _0x46007e;}function getInteractionsQuery(_0x5eb8ed){var _0x111247=utils[_0x1b82('0x14')](_0x5eb8ed);var _0xf42818=utils['getAccountFK'](_0x5eb8ed);var _0x514082=utils[_0x1b82('0xc')](_0x5eb8ed);return squel['select']()[_0x1b82('0xa')](_0x111247[_0x1b82('0x15')],'i')[_0x1b82('0x16')]('cm_contacts','c',_0x1b82('0x17'))[_0x1b82('0x16')](_0x1b82('0x10'),'o',_0x1b82('0x18'))[_0x1b82('0x16')](_0x111247['accounts'],'a',_0x1b82('0x19')+_0xf42818)[_0x1b82('0x16')](_0x111247[_0x1b82('0x1a')],'me',_0x1b82('0x1b')+_0x514082+_0x1b82('0x1c'))[_0x1b82('0x16')](_0x111247[_0x1b82('0x1d')],'it','it.'+_0x514082+_0x1b82('0x1c'))[_0x1b82('0x16')]('tools_tags','t',_0x1b82('0x1e'));}function getSqlClauses(){var _0x225b81={'body':squel[_0x1b82('0x1f')](),'contact':squel['expr'](),'default':squel[_0x1b82('0x1f')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x1b82('0x1f')](),'ids':null},'user':squel[_0x1b82('0x1f')]()};return _0x225b81;}function parseTagParameter(_0xfd00d1){var _0x257b79=squel['expr']();if(_0xfd00d1){var _0x222483=utils[_0x1b82('0x20')](_0xfd00d1);_0x222483[_0x1b82('0x21')](function(_0x7455e8){_0x257b79['or'](_0x1b82('0x22'),'%,'+_0x7455e8+',%');});}return _0x257b79;}function parseReadParameter(_0x1b8b6f){var _0x223b6a='';if(_0x1b8b6f){_0x223b6a=_0x1b82('0x23');if(_0x1b8b6f==='1'){_0x223b6a=_0x223b6a[_0x1b82('0x24')](_0x1b82('0x25'),'=');}else{_0x223b6a=_0x223b6a[_0x1b82('0x24')](_0x1b82('0x25'),'>');}}return _0x223b6a;}function parseSearchFilter(_0x466441,_0x5ea890){var _0x17b3aa=squel[_0x1b82('0x1f')]();if(_0x5ea890){var _0x155a34=_0x5ea890[_0x1b82('0x24')]('\x5c','\x5c\x5c')[_0x1b82('0x24')](/'/g,'\x27\x27');if(qs[_0x1b82('0x26')](_0x155a34)){_0x17b3aa['or'](_0x1b82('0x27'),_0x155a34+'%');if([_0x1b82('0x28'),_0x1b82('0x29')][_0x1b82('0x2a')](_0x466441)){_0x17b3aa['or']('i.phone\x20LIKE\x20?',_0x155a34+'%');}else if(_0x466441===_0x1b82('0x2b')){_0x17b3aa['or'](_0x1b82('0x2c'),_0x155a34+'%');}else if(_0x466441===_0x1b82('0x2d')){_0x17b3aa['or'](_0x1b82('0x2e'),_0x155a34+'%');}}else if(_0x466441==='mail'&&qs[_0x1b82('0x2f')](_0x155a34)){_0x17b3aa['or'](_0x1b82('0x30'),_0x155a34+'%');}else{if(_0x466441==='mail'){_0x17b3aa['or'](_0x1b82('0x31'),qs[_0x1b82('0x32')](_0x155a34))['or'](_0x1b82('0x33'),qs['getFullTextValue'](_0x155a34));}else{if(_0x466441!=='fax'){_0x17b3aa['or'](_0x1b82('0x34'),qs['getFullTextValue'](_0x155a34));}_0x17b3aa['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x155a34+'%');}}}return _0x17b3aa;}function parseAdvancedSearchFilter(_0x417795,_0x1cd22a){var _0x7fd793=getSqlClauses();var _0x592207=as[_0x1b82('0x35')](_0x417795);var _0x366db3=_0x592207[_0x1b82('0x36')];for(var _0x31607f=0x0;_0x31607f<_0x592207['conditions'][_0x1b82('0x37')];_0x31607f++){var _0x1cd7de=_0x592207[_0x1b82('0x38')][_0x31607f];var _0x5ebf6c='i';var _0x48fd54=_[_0x1b82('0x39')](_0x1cd22a,['name',_0x1cd7de[_0x1b82('0x8')]]);if(_0x48fd54){var _0x1e6a9=as[_0x1b82('0x3a')](_0x5ebf6c,_0x48fd54[_0x1b82('0x3b')],_0x1cd7de);_0x7fd793[_0x1b82('0x3c')][_0x366db3](_0x1e6a9[_0x1b82('0x3d')],_0x1e6a9[_0x1b82('0x3e')][_0x1b82('0x3f')],_0x1e6a9['value']['end']);}else{switch(_0x1cd7de[_0x1b82('0x8')]){case'unreadMessages':var _0x34890e=parseReadParameter(_0x1cd7de['value']);_0x7fd793[_0x1b82('0x40')][_0x1b82('0x41')](_0x34890e);break;case _0x1b82('0x42'):if(_0x1cd7de[_0x1b82('0x43')]===_0x1b82('0x44')){if(_0x1cd7de[_0x1b82('0x3e')]['split']('\x20')[_0x1b82('0x37')]>0x1){_0x7fd793['contact'][_0x366db3](_0x1b82('0x45'),qs['getFullTextValue'](_0x1cd7de[_0x1b82('0x3e')]),null);}else{var _0x4edc17='%'+_0x1cd7de['value']+'%';_0x7fd793[_0x1b82('0x46')][_0x366db3](_0x1b82('0x47'),_0x4edc17,_0x4edc17,_0x4edc17);}}else{_0x48fd54=_[_0x1b82('0x39')](_0x1cd22a,[_0x1b82('0x9'),_0x1b82('0x48')]);_0x1cd7de['field']=_0x1b82('0x48');_0x1e6a9=as['buildExpression'](_0x5ebf6c,_0x48fd54[_0x1b82('0x3b')],_0x1cd7de);_0x7fd793[_0x1b82('0x46')][_0x366db3](_0x1e6a9[_0x1b82('0x3d')],_0x1e6a9[_0x1b82('0x3e')][_0x1b82('0x3f')],_0x1e6a9['value'][_0x1b82('0x49')]);}break;case'Tag':var _0x318f6b=_0x1cd7de[_0x1b82('0x3e')]['split'](',')[_0x1b82('0x13')](function(_0x225f6b){return Number(_0x225f6b);});var _0x388411=parseTagParameter(_0x318f6b);_0x7fd793[_0x1b82('0x4a')][_0x1b82('0x4b')][_0x1b82('0x41')](_0x388411);_0x7fd793[_0x1b82('0x4a')]['ids']=_0x318f6b;break;case _0x1b82('0x4c'):if(_0x1cd7de['operator']===_0x1b82('0x44')){_0x7fd793[_0x1b82('0x4d')][_0x366db3](_0x1b82('0x4e'),'%'+_0x1cd7de[_0x1b82('0x3e')]+'%',null);}else{_0x48fd54=_[_0x1b82('0x39')](_0x1cd22a,[_0x1b82('0x9'),_0x1b82('0x4f')]);_0x1cd7de[_0x1b82('0x8')]=_0x1b82('0x4f');_0x1e6a9=as[_0x1b82('0x3a')](_0x5ebf6c,_0x48fd54[_0x1b82('0x3b')],_0x1cd7de);_0x7fd793[_0x1b82('0x4d')][_0x366db3](_0x1e6a9[_0x1b82('0x3d')],_0x1e6a9[_0x1b82('0x3e')]['start'],_0x1e6a9['value'][_0x1b82('0x49')]);}break;case'body':case _0x1b82('0x50'):_0x1e6a9=as[_0x1b82('0x3a')]('me',null,_0x1cd7de);_0x7fd793[_0x1b82('0x51')][_0x366db3](_0x1e6a9['text'],_0x1e6a9[_0x1b82('0x3e')]['start'],_0x1e6a9['value'][_0x1b82('0x49')]);break;}}}return _0x7fd793;}function parseModelFields(_0x2aadf7,_0x242324,_0x56b618){var _0x1e159a=utils[_0x1b82('0x3')](_0x2aadf7);var _0x538692=squel['expr']();var _0x106282=_(_0x242324)[_0x1b82('0x52')]()[_0x1b82('0x13')](function(_0x4fe1d7){return _[_0x1b82('0x53')](_0x56b618,[_0x1b82('0x9'),_0x4fe1d7])?_0x4fe1d7:undefined;})[_0x1b82('0x54')]()[_0x1b82('0x3e')]();if(_0x106282[_0x1b82('0x37')]>0x0){_0x106282[_0x1b82('0x21')](function(_0x4b6ab3){if(_0x4b6ab3===_0x1e159a){_0x538692[_0x1b82('0x41')]('i.'+_0x1e159a+'\x20IN\x20?',[][_0x1b82('0x55')](_0x242324[_0x4b6ab3]));}else if(_0x4b6ab3===_0x1b82('0x56')){var _0x5d9708=JSON[_0x1b82('0x57')](_0x242324[_0x4b6ab3])['$gte'];var _0x328973=JSON[_0x1b82('0x57')](_0x242324[_0x4b6ab3])[_0x1b82('0x58')];_0x538692[_0x1b82('0x41')](_0x1b82('0x59'),_0x5d9708,_0x328973);}else{if(_0x242324[_0x4b6ab3]===_0x1b82('0x5a')){_0x538692['and']('i.'+_0x4b6ab3+'\x20IS\x20NULL');}else{_0x538692[_0x1b82('0x41')]('i.'+_0x4b6ab3+_0x1b82('0x5b'),_0x242324[_0x4b6ab3]);}}});}return _0x538692;}function parseQueryParameters(_0x1b9e81,_0x26c1ec,_0x3db460){var _0x1f1463=getSqlClauses();return Promise[_0x1b82('0x5c')]()[_0x1b82('0x5d')](function(){return parseModelFields(_0x1b9e81,_0x26c1ec,_0x3db460);})['then'](function(_0x4cdcfe){_0x1f1463['fields'][_0x1b82('0x41')](_0x4cdcfe);return parseReadParameter(_0x26c1ec[_0x1b82('0x40')]);})[_0x1b82('0x5d')](function(_0x27ad80){_0x1f1463[_0x1b82('0x40')][_0x1b82('0x41')](_0x27ad80);return parseTagParameter(_0x26c1ec[_0x1b82('0x5e')]);})['then'](function(_0x250293){_0x1f1463[_0x1b82('0x4a')][_0x1b82('0x4b')][_0x1b82('0x41')](_0x250293);return parseSearchFilter(_0x1b9e81,_0x26c1ec[_0x1b82('0x5f')]);})[_0x1b82('0x5d')](function(_0x25ee4e){_0x1f1463[_0x1b82('0x5f')]=_0x25ee4e;return _0x1f1463;});}function checkAccountsRestrictions(_0x52d4c5,_0x2e6486,_0x23e735){var _0x39be28=utils[_0x1b82('0x3')](_0x52d4c5);var _0x2bce47='get'+_['capitalize'](_0x52d4c5)+(_0x52d4c5===_0x1b82('0x60')?_0x1b82('0x61'):_0x1b82('0x62'));var _0x362fa2=squel['expr']();return Promise[_0x1b82('0x5c')]()[_0x1b82('0x5d')](function(){if(_0x23e735[_0x1b82('0x6')]&&_0x2e6486[_0x1b82('0x4')]===_0x1b82('0x5')){return _0x2e6486[_0x2bce47]({'attributes':['id'],'raw':!![]});}})[_0x1b82('0x5d')](function(_0x3e591a){if(_0x3e591a){if(_0x3e591a[_0x1b82('0x37')]===0x0){_0x362fa2[_0x1b82('0x41')]('i.'+_0x39be28+_0x1b82('0x63'));}else{_0x362fa2['and']('i.'+_0x39be28+_0x1b82('0x64'),_[_0x1b82('0x13')](_0x3e591a,'id'));}}else if(!_0x23e735[_0x39be28]){_0x362fa2['and']('i.'+_0x39be28+_0x1b82('0x65'));}})[_0x1b82('0x5d')](function(){return _0x362fa2;});}function getClosedOrderClause(_0x1e0eaf,_0x2a5435){var _0x4b26c4='';var _0x30f13a=[_0x1b82('0x66'),_0x1b82('0x67'),_0x1b82('0x68')];if(_0x1e0eaf===_0x1b82('0x69')){_0x30f13a[_0x1b82('0x6a')]('i.substatus');}if(_0x2a5435[_0x1b82('0x6b')]==='0'&&_0x1e0eaf==='mail'){_0x4b26c4=_0x1b82('0x6c');}else{if(_0x2a5435['closed']==='1'){_0x30f13a[_0x1b82('0x6d')]();}_0x4b26c4=_0x1b82('0x6e')+_0x30f13a[_0x1b82('0x6f')](',\x20')+')';}return _0x4b26c4;}function getFilteredInteractions(_0x2db0fe,_0x412073,_0x282b3c,_0x245f20){var _0x50d123=utils[_0x1b82('0xc')](_0x2db0fe);var _0x21dbf4=_[_0x1b82('0x70')](_0x2db0fe)+_0x1b82('0x71');var _0x567b9a=[];var _0x2cf368=getTagsQuery();var _0x3153b7={'type':db[_0x1b82('0x72')][_0x1b82('0x73')][_0x1b82('0x74')],'raw':!![]};var _0x1873de=[];var _0xe31cbc=[];return db[_0x1b82('0x75')]['query'](_0x2cf368[_0x1b82('0x76')](),_0x3153b7)[_0x1b82('0x5d')](function(_0x34a231){_0x567b9a=_['keyBy'](_0x34a231,'id');_0x3153b7=_[_0x1b82('0x77')](_0x3153b7,{'model':db[_0x21dbf4],'mapToModel':!![],'nest':!![]});if(_0x282b3c[_0x1b82('0x78')]){_0x245f20['attributes'][_0x1b82('0x21')](function(_0x5cc386){_0x412073[_0x1b82('0x8')]('i.'+_0x5cc386);});}else{_0x412073['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1b82('0x79'));_0x412073[_0x1b82('0x8')](_0x1b82('0x7a'),_0x1b82('0x7b'));_0x412073[_0x1b82('0x8')]('a.mandatoryDisposition',_0x1b82('0x7c'));if(_0x2db0fe==='mail'){_0x412073[_0x1b82('0x8')](_0x1b82('0x7d'),_0x1b82('0x7e'));_0x412073[_0x1b82('0x8')](_0x1b82('0x7f'),_0x1b82('0x80'));_0x412073[_0x1b82('0x8')](_0x1b82('0x81'));_0x412073[_0x1b82('0x8')](_0x1b82('0x82'));_0x412073[_0x1b82('0x8')]('i.updatedAt');_0x412073[_0x1b82('0x8')]('i.closed');_0x412073['field'](_0x1b82('0x83'));_0x412073[_0x1b82('0x8')](_0x1b82('0x84'));_0x412073[_0x1b82('0x8')](_0x1b82('0x85'));_0x412073[_0x1b82('0x8')](_0x1b82('0x86'));_0x412073[_0x1b82('0x8')](_0x1b82('0x87'));_0x412073[_0x1b82('0x8')]('i.disposition');_0x412073[_0x1b82('0x8')]('i.secondDisposition');_0x412073[_0x1b82('0x8')]('i.thirdDisposition');_0x412073[_0x1b82('0x8')](_0x1b82('0x6c'));_0x412073[_0x1b82('0x8')](_0x1b82('0x88'));_0x412073[_0x1b82('0x8')]('i.ContactId');_0x412073[_0x1b82('0x8')]('i.MailAccountId');_0x412073['field'](_0x1b82('0x89'));}else if(_0x2db0fe===_0x1b82('0x2d')){_0x412073[_0x1b82('0x8')]('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',_0x1b82('0x80'));}else{_0x412073['field'](_0x1b82('0x8a'),'contactName');}if(_0x2db0fe!==_0x1b82('0x69')){_0x412073[_0x1b82('0x8')](_0x1b82('0x8b'));}_0x412073[_0x1b82('0x8')]('c.firstName',_0x1b82('0x8c'));_0x412073['field'](_0x1b82('0x8d'),_0x1b82('0x8e'));_0x412073[_0x1b82('0x8')](_0x1b82('0x8f'),_0x1b82('0x90'));_0x412073['field'](_0x1b82('0x91'),'Contact.phone');_0x412073[_0x1b82('0x8')]('c.mobile',_0x1b82('0x92'));_0x412073[_0x1b82('0x8')](_0x1b82('0x93'),'Contact.fax');_0x412073[_0x1b82('0x8')](_0x1b82('0x94'),_0x1b82('0x95'));_0x412073['field'](_0x1b82('0x96'),_0x1b82('0x97'));_0x412073[_0x1b82('0x8')](_0x1b82('0x98'),_0x1b82('0x99'));}if(_0x245f20['limit']){_0x412073[_0x1b82('0x9a')](_0x245f20['limit']);}if(_0x245f20['offset']){_0x412073[_0x1b82('0x9b')](_0x245f20['offset']);}return db[_0x1b82('0x75')][_0x1b82('0x9c')](_0x412073['toString'](),_0x3153b7);})[_0x1b82('0x5d')](function(_0x391207){_0x1873de=_0x391207;var _0x553ac5=getUsersQuery(_0x2db0fe,_0x1873de);return db['sequelize']['query'](_0x553ac5['toString'](),_0x3153b7);})[_0x1b82('0x5d')](function(_0x1405dd){_0xe31cbc=_[_0x1b82('0x9d')](_0x1405dd,_0x50d123);if(_0x2db0fe==='mail'){return db[_0x1b82('0x9e')]['findOne']({'attributes':[_0x1b82('0x9f')],'raw':!![]});}})[_0x1b82('0x5d')](function(_0x96910f){var _0x41f87b=_0x96910f?_0x96910f['enableEmailPreview']:undefined;var _0x168e53=_0x1873de[_0x1b82('0x13')](function(_0x14510c){return updateInteraction(_0x14510c,_0x567b9a,_0xe31cbc,_0x41f87b);});return Promise[_0x1b82('0xa0')](_0x168e53);});}function countFilteredInteractions(_0x346b6d,_0x3a4e7d){var _0x2dbcdb=_0x346b6d['clone']();_0x2dbcdb['field'](_0x1b82('0xa1'));_0x2dbcdb['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1b82('0x79'));var _0x225749=utils[_0x1b82('0x20')](_0x3a4e7d);if(!_['isEmpty'](_0x225749)){_0x2dbcdb[_0x1b82('0x12')]('t.id\x20IN\x20?',_0x225749);}var _0x385c2d={'type':db[_0x1b82('0x72')][_0x1b82('0x73')][_0x1b82('0x74')],'raw':!![]};return db['sequelize'][_0x1b82('0x9c')](_0x2dbcdb['toString'](),_0x385c2d);}module[_0x1b82('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xc788=['i.UserId','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','where','exports','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','name','color','tools_tags','user_has_','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','getInteractionsTables','cm_contacts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','buildExpression','type','default','value','end','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','Tag','map','tags','clause','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','user','body','plainBody','keys','some','compact','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','capitalize','chat','Websites','Accounts','search','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId'];(function(_0x332998,_0x2d99c7){var _0x460be7=function(_0x1a4d24){while(--_0x1a4d24){_0x332998['push'](_0x332998['shift']());}};_0x460be7(++_0x2d99c7);}(_0xc788,0xc4));var _0x8c78=function(_0x3d80ae,_0x115102){_0x3d80ae=_0x3d80ae-0x0;var _0x5be6cc=_0xc788[_0x3d80ae];return _0x5be6cc;};'use strict';var _=require(_0x8c78('0x0'));var squel=require(_0x8c78('0x1'));var as=require(_0x8c78('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x8c78('0x3')];var utils=require(_0x8c78('0x4'));var db=require(_0x8c78('0x5'))['db'];function skipInteractionsQuery(_0x1d0670,_0x386f0a,_0x5498f9){var _0x70960c=![];var _0x4555da=utils[_0x8c78('0x6')](_0x1d0670);if(_0x386f0a[_0x8c78('0x7')]===_0x8c78('0x8')&&!_0x5498f9['search']&&!_0x5498f9[_0x4555da]){_0x70960c=!![];}return _0x70960c;}function getTagsQuery(){return squel[_0x8c78('0x9')]()[_0x8c78('0xa')]('id')[_0x8c78('0xa')](_0x8c78('0xb'))[_0x8c78('0xa')](_0x8c78('0xc'))['from'](_0x8c78('0xd'));}function getUsersQuery(_0x47a54b,_0x3d55f0){var _0x45935a=utils['getInteractionFK'](_0x47a54b);var _0x1a05a7=_0x8c78('0xe')+_0x47a54b+'_interactions';var _0x3a673c=squel['select']()['field'](_0x8c78('0xf'))[_0x8c78('0xa')](_0x8c78('0x10'))[_0x8c78('0xa')](_0x8c78('0x11')+_0x45935a)[_0x8c78('0x12')](_0x1a05a7,'ui')[_0x8c78('0x13')](_0x8c78('0x14'),'u',_0x8c78('0x15'));if(_0x3d55f0[_0x8c78('0x16')]>0x0){_0x3a673c['where'](_0x8c78('0x11')+_0x45935a+_0x8c78('0x17'),_['map'](_0x3d55f0,'id'));}return _0x3a673c;}function getInteractionsQuery(_0x45b85f){var _0x554464=utils[_0x8c78('0x18')](_0x45b85f);var _0x23824e=utils[_0x8c78('0x6')](_0x45b85f);var _0x461eff=utils['getInteractionFK'](_0x45b85f);return squel['select']()[_0x8c78('0x12')](_0x554464['interactions'],'i')['left_join'](_0x8c78('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8c78('0x13')](_0x8c78('0x14'),'o','o.id\x20=\x20i.UserId')[_0x8c78('0x13')](_0x554464['accounts'],'a',_0x8c78('0x1a')+_0x23824e)[_0x8c78('0x13')](_0x554464['messages'],'me',_0x8c78('0x1b')+_0x461eff+_0x8c78('0x1c'))['left_join'](_0x554464[_0x8c78('0x1d')],'it',_0x8c78('0x1e')+_0x461eff+_0x8c78('0x1c'))[_0x8c78('0x13')](_0x8c78('0xd'),'t',_0x8c78('0x1f'));}function getSqlClauses(){var _0xbfdf6f={'body':squel[_0x8c78('0x20')](),'contact':squel[_0x8c78('0x20')](),'default':squel['expr'](),'fields':squel[_0x8c78('0x20')](),'filter':squel[_0x8c78('0x20')](),'read':squel[_0x8c78('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x8c78('0x20')]()};return _0xbfdf6f;}function parseTagParameter(_0x5d7445){var _0xe85d05=squel[_0x8c78('0x20')]();if(_0x5d7445){var _0x8d9ff9=utils['getSelectedTags'](_0x5d7445);_0x8d9ff9[_0x8c78('0x21')](function(_0x2568d5){_0xe85d05['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2568d5+',%');});}return _0xe85d05;}function parseReadParameter(_0x20b128){var _0x4376da='';if(_0x20b128){_0x4376da=_0x8c78('0x22');if(_0x20b128==='1'){_0x4376da=_0x4376da[_0x8c78('0x23')](_0x8c78('0x24'),'=');}else{_0x4376da=_0x4376da[_0x8c78('0x23')]('{OPERATOR}','>');}}return _0x4376da;}function parseSearchFilter(_0x1c3039,_0x51add6){var _0xfa5e7b=squel[_0x8c78('0x20')]();if(_0x51add6){var _0xb69c52=_0x51add6['replace']('\x5c','\x5c\x5c')[_0x8c78('0x23')](/'/g,'\x27\x27');if(qs[_0x8c78('0x25')](_0xb69c52)){_0xfa5e7b['or']('i.id\x20LIKE\x20?',_0xb69c52+'%');if([_0x8c78('0x26'),_0x8c78('0x27')][_0x8c78('0x28')](_0x1c3039)){_0xfa5e7b['or']('i.phone\x20LIKE\x20?',_0xb69c52+'%');}else if(_0x1c3039===_0x8c78('0x29')){_0xfa5e7b['or'](_0x8c78('0x2a'),_0xb69c52+'%');}else if(_0x1c3039===_0x8c78('0x2b')){_0xfa5e7b['or']('i.from\x20LIKE\x20?',_0xb69c52+'%');}}else if(_0x1c3039===_0x8c78('0x2c')&&qs[_0x8c78('0x2d')](_0xb69c52)){_0xfa5e7b['or']('c.email\x20LIKE\x20?',_0xb69c52+'%');}else{if(_0x1c3039===_0x8c78('0x2c')){_0xfa5e7b['or'](_0x8c78('0x2e'),qs[_0x8c78('0x2f')](_0xb69c52))['or'](_0x8c78('0x30'),qs[_0x8c78('0x2f')](_0xb69c52));}else{if(_0x1c3039!==_0x8c78('0x29')){_0xfa5e7b['or'](_0x8c78('0x31'),qs[_0x8c78('0x2f')](_0xb69c52));}_0xfa5e7b['or'](_0x8c78('0x32'),_0xb69c52+'%');}}}return _0xfa5e7b;}function parseAdvancedSearchFilter(_0x15a868,_0x5c1f63){var _0x3e9bf1=getSqlClauses();var _0x45e673=as[_0x8c78('0x33')](_0x15a868);var _0xc503ab=_0x45e673[_0x8c78('0x34')];for(var _0x51e188=0x0;_0x51e188<_0x45e673[_0x8c78('0x35')][_0x8c78('0x16')];_0x51e188++){var _0x1312ca=_0x45e673['conditions'][_0x51e188];var _0x814ba9='i';var _0x25ea2f=_['find'](_0x5c1f63,[_0x8c78('0xb'),_0x1312ca['field']]);if(_0x25ea2f){var _0xee735e=as[_0x8c78('0x36')](_0x814ba9,_0x25ea2f[_0x8c78('0x37')],_0x1312ca);_0x3e9bf1[_0x8c78('0x38')][_0xc503ab](_0xee735e['text'],_0xee735e[_0x8c78('0x39')]['start'],_0xee735e[_0x8c78('0x39')][_0x8c78('0x3a')]);}else{switch(_0x1312ca[_0x8c78('0xa')]){case'unreadMessages':var _0x5a04fa=parseReadParameter(_0x1312ca[_0x8c78('0x39')]);_0x3e9bf1[_0x8c78('0x3b')][_0x8c78('0x3c')](_0x5a04fa);break;case _0x8c78('0x3d'):if(_0x1312ca[_0x8c78('0x3e')]===_0x8c78('0x3f')){if(_0x1312ca[_0x8c78('0x39')][_0x8c78('0x40')]('\x20')[_0x8c78('0x16')]>0x1){_0x3e9bf1[_0x8c78('0x41')][_0xc503ab](_0x8c78('0x42'),qs[_0x8c78('0x2f')](_0x1312ca[_0x8c78('0x39')]),null);}else{var _0x5af5a5='%'+_0x1312ca[_0x8c78('0x39')]+'%';_0x3e9bf1[_0x8c78('0x41')][_0xc503ab]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5af5a5,_0x5af5a5,_0x5af5a5);}}else{_0x25ea2f=_['find'](_0x5c1f63,[_0x8c78('0xb'),_0x8c78('0x43')]);_0x1312ca['field']=_0x8c78('0x43');_0xee735e=as[_0x8c78('0x36')](_0x814ba9,_0x25ea2f['type'],_0x1312ca);_0x3e9bf1[_0x8c78('0x41')][_0xc503ab](_0xee735e[_0x8c78('0x44')],_0xee735e['value'][_0x8c78('0x45')],_0xee735e[_0x8c78('0x39')][_0x8c78('0x3a')]);}break;case _0x8c78('0x46'):var _0x3dfb4b=_0x1312ca['value']['split'](',')[_0x8c78('0x47')](function(_0x2f6a6b){return Number(_0x2f6a6b);});var _0xac60f9=parseTagParameter(_0x3dfb4b);_0x3e9bf1[_0x8c78('0x48')][_0x8c78('0x49')][_0x8c78('0x3c')](_0xac60f9);_0x3e9bf1[_0x8c78('0x48')][_0x8c78('0x4a')]=_0x3dfb4b;break;case _0x8c78('0x4b'):if(_0x1312ca[_0x8c78('0x3e')]===_0x8c78('0x3f')){_0x3e9bf1['user'][_0xc503ab](_0x8c78('0x4c'),'%'+_0x1312ca[_0x8c78('0x39')]+'%',null);}else{_0x25ea2f=_[_0x8c78('0x4d')](_0x5c1f63,[_0x8c78('0xb'),_0x8c78('0x4e')]);_0x1312ca['field']=_0x8c78('0x4e');_0xee735e=as[_0x8c78('0x36')](_0x814ba9,_0x25ea2f[_0x8c78('0x37')],_0x1312ca);_0x3e9bf1[_0x8c78('0x4f')][_0xc503ab](_0xee735e[_0x8c78('0x44')],_0xee735e['value'][_0x8c78('0x45')],_0xee735e['value']['end']);}break;case _0x8c78('0x50'):case _0x8c78('0x51'):_0xee735e=as[_0x8c78('0x36')]('me',null,_0x1312ca);_0x3e9bf1['body'][_0xc503ab](_0xee735e[_0x8c78('0x44')],_0xee735e[_0x8c78('0x39')][_0x8c78('0x45')],_0xee735e[_0x8c78('0x39')][_0x8c78('0x3a')]);break;}}}return _0x3e9bf1;}function parseModelFields(_0x38083e,_0x26103c,_0x1f5cdb){var _0x14b084=utils['getAccountFK'](_0x38083e);var _0x1f8993=squel[_0x8c78('0x20')]();var _0xba0de6=_(_0x26103c)[_0x8c78('0x52')]()['map'](function(_0x2fa61e){return _[_0x8c78('0x53')](_0x1f5cdb,[_0x8c78('0xb'),_0x2fa61e])?_0x2fa61e:undefined;})[_0x8c78('0x54')]()['value']();if(_0xba0de6[_0x8c78('0x16')]>0x0){_0xba0de6[_0x8c78('0x21')](function(_0x1b9380){if(_0x1b9380===_0x14b084){_0x1f8993['and']('i.'+_0x14b084+_0x8c78('0x17'),[]['concat'](_0x26103c[_0x1b9380]));}else if(_0x1b9380===_0x8c78('0x55')){var _0xe6325b=JSON[_0x8c78('0x56')](_0x26103c[_0x1b9380])[_0x8c78('0x57')];var _0x349b87=JSON[_0x8c78('0x56')](_0x26103c[_0x1b9380])[_0x8c78('0x58')];_0x1f8993[_0x8c78('0x3c')](_0x8c78('0x59'),_0xe6325b,_0x349b87);}else{if(_0x26103c[_0x1b9380]===_0x8c78('0x5a')){_0x1f8993[_0x8c78('0x3c')]('i.'+_0x1b9380+_0x8c78('0x5b'));}else{_0x1f8993[_0x8c78('0x3c')]('i.'+_0x1b9380+_0x8c78('0x5c'),_0x26103c[_0x1b9380]);}}});}return _0x1f8993;}function parseQueryParameters(_0x54b40d,_0x22fe6c,_0x3721f4){var _0x11c490=getSqlClauses();return Promise[_0x8c78('0x5d')]()['then'](function(){return parseModelFields(_0x54b40d,_0x22fe6c,_0x3721f4);})[_0x8c78('0x5e')](function(_0x32fa95){_0x11c490[_0x8c78('0x5f')][_0x8c78('0x3c')](_0x32fa95);return parseReadParameter(_0x22fe6c[_0x8c78('0x3b')]);})[_0x8c78('0x5e')](function(_0x5986f0){_0x11c490[_0x8c78('0x3b')][_0x8c78('0x3c')](_0x5986f0);return parseTagParameter(_0x22fe6c['tag']);})[_0x8c78('0x5e')](function(_0x568ad0){_0x11c490[_0x8c78('0x48')][_0x8c78('0x49')][_0x8c78('0x3c')](_0x568ad0);return parseSearchFilter(_0x54b40d,_0x22fe6c[_0x8c78('0x60')]);})[_0x8c78('0x5e')](function(_0x35cf85){_0x11c490[_0x8c78('0x60')]=_0x35cf85;return _0x11c490;});}function checkAccountsRestrictions(_0x49fa4c,_0x1c8d79,_0x3e7e32){var _0x4e77a9=utils[_0x8c78('0x6')](_0x49fa4c);var _0x3529aa='get'+_[_0x8c78('0x61')](_0x49fa4c)+(_0x49fa4c===_0x8c78('0x62')?_0x8c78('0x63'):_0x8c78('0x64'));var _0x405b40=squel[_0x8c78('0x20')]();return Promise[_0x8c78('0x5d')]()[_0x8c78('0x5e')](function(){if(_0x3e7e32[_0x8c78('0x65')]&&_0x1c8d79[_0x8c78('0x7')]===_0x8c78('0x8')){return _0x1c8d79[_0x3529aa]({'attributes':['id'],'raw':!![]});}})[_0x8c78('0x5e')](function(_0x1468f2){if(_0x1468f2){if(_0x1468f2[_0x8c78('0x16')]===0x0){_0x405b40['and']('i.'+_0x4e77a9+_0x8c78('0x5b'));}else{_0x405b40['and']('i.'+_0x4e77a9+_0x8c78('0x17'),_['map'](_0x1468f2,'id'));}}else if(!_0x3e7e32[_0x4e77a9]){_0x405b40['and']('i.'+_0x4e77a9+'\x20IS\x20NOT\x20NULL');}})[_0x8c78('0x5e')](function(){return _0x405b40;});}function getClosedOrderClause(_0x5d4778,_0x4c1dec){var _0x502991='';var _0x4373b4=[_0x8c78('0x66'),_0x8c78('0x67'),_0x8c78('0x68')];if(_0x5d4778==='mail'){_0x4373b4[_0x8c78('0x69')](_0x8c78('0x6a'));}if(_0x4c1dec[_0x8c78('0x6b')]==='0'&&_0x5d4778===_0x8c78('0x2c')){_0x502991=_0x8c78('0x6a');}else{if(_0x4c1dec[_0x8c78('0x6b')]==='1'){_0x4373b4[_0x8c78('0x6c')]();}_0x502991=_0x8c78('0x6d')+_0x4373b4[_0x8c78('0x6e')](',\x20')+')';}return _0x502991;}function getFilteredInteractions(_0x472006,_0x6407b7,_0x437695,_0x3e1ee0){var _0x37da1f=utils['getInteractionFK'](_0x472006);var _0x46f57b=_['capitalize'](_0x472006)+_0x8c78('0x6f');var _0x28d1a7=[];var _0x420ccf=getTagsQuery();var _0x4e8038={'type':db[_0x8c78('0x70')][_0x8c78('0x71')][_0x8c78('0x72')],'raw':!![]};var _0x4fa0b0=[];var _0x1fa8a4=[];return db[_0x8c78('0x73')]['query'](_0x420ccf[_0x8c78('0x74')](),_0x4e8038)[_0x8c78('0x5e')](function(_0x1763a7){_0x28d1a7=_['keyBy'](_0x1763a7,'id');_0x4e8038=_[_0x8c78('0x75')](_0x4e8038,{'model':db[_0x46f57b],'mapToModel':!![],'nest':!![]});if(_0x437695[_0x8c78('0x5f')]){_0x3e1ee0[_0x8c78('0x76')][_0x8c78('0x21')](function(_0x173a78){_0x6407b7[_0x8c78('0xa')]('i.'+_0x173a78);});}else{_0x6407b7[_0x8c78('0xa')](_0x8c78('0x77'),_0x8c78('0x78'));_0x6407b7['field'](_0x8c78('0x79'),_0x8c78('0x7a'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x7b'),_0x8c78('0x7c'));if(_0x472006===_0x8c78('0x2c')){_0x6407b7[_0x8c78('0xa')](_0x8c78('0x7d'),_0x8c78('0x7e'));_0x6407b7['field'](_0x8c78('0x7f'),_0x8c78('0x80'));_0x6407b7['field']('i.id');_0x6407b7[_0x8c78('0xa')]('i.createdAt');_0x6407b7[_0x8c78('0xa')](_0x8c78('0x81'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x82'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x83'));_0x6407b7['field']('i.attach');_0x6407b7[_0x8c78('0xa')](_0x8c78('0x84'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x85'));_0x6407b7[_0x8c78('0xa')]('i.subject');_0x6407b7[_0x8c78('0xa')](_0x8c78('0x68'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x67'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x66'));_0x6407b7['field'](_0x8c78('0x6a'));_0x6407b7[_0x8c78('0xa')]('i.to');_0x6407b7[_0x8c78('0xa')](_0x8c78('0x86'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x87'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x88'));}else if(_0x472006===_0x8c78('0x2b')){_0x6407b7[_0x8c78('0xa')](_0x8c78('0x89'),_0x8c78('0x80'));}else{_0x6407b7[_0x8c78('0xa')](_0x8c78('0x8a'),_0x8c78('0x80'));}if(_0x472006!==_0x8c78('0x2c')){_0x6407b7[_0x8c78('0xa')](_0x8c78('0x8b'));}_0x6407b7[_0x8c78('0xa')]('c.firstName',_0x8c78('0x8c'));_0x6407b7['field']('c.lastName',_0x8c78('0x8d'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x8e'),_0x8c78('0x8f'));_0x6407b7['field'](_0x8c78('0x90'),_0x8c78('0x91'));_0x6407b7[_0x8c78('0xa')]('c.mobile',_0x8c78('0x92'));_0x6407b7[_0x8c78('0xa')](_0x8c78('0x93'),_0x8c78('0x94'));_0x6407b7['field'](_0x8c78('0x95'),_0x8c78('0x96'));_0x6407b7['field']('o.internal','Owner.internal');_0x6407b7[_0x8c78('0xa')](_0x8c78('0x97'),_0x8c78('0x98'));}if(_0x3e1ee0[_0x8c78('0x99')]){_0x6407b7['limit'](_0x3e1ee0[_0x8c78('0x99')]);}if(_0x3e1ee0['offset']){_0x6407b7[_0x8c78('0x9a')](_0x3e1ee0[_0x8c78('0x9a')]);}return db[_0x8c78('0x73')][_0x8c78('0x9b')](_0x6407b7[_0x8c78('0x74')](),_0x4e8038);})[_0x8c78('0x5e')](function(_0x5b1a37){_0x4fa0b0=_0x5b1a37;var _0x5c67c9=getUsersQuery(_0x472006,_0x4fa0b0);return db['sequelize'][_0x8c78('0x9b')](_0x5c67c9[_0x8c78('0x74')](),_0x4e8038);})['then'](function(_0xb40796){_0x1fa8a4=_[_0x8c78('0x9c')](_0xb40796,_0x37da1f);if(_0x472006===_0x8c78('0x2c')){return db['Setting'][_0x8c78('0x9d')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x8c78('0x5e')](function(_0x253e6f){var _0x3f013b=_0x253e6f?_0x253e6f[_0x8c78('0x9e')]:undefined;var _0x475b0f=_0x4fa0b0[_0x8c78('0x47')](function(_0x336a0a){return updateInteraction(_0x336a0a,_0x28d1a7,_0x1fa8a4,_0x3f013b);});return Promise[_0x8c78('0x9f')](_0x475b0f);});}function countFilteredInteractions(_0x396c06,_0x46d5c2){var _0x1c1e49=_0x396c06[_0x8c78('0xa0')]();_0x1c1e49['field'](_0x8c78('0xa1'));_0x1c1e49[_0x8c78('0xa')](_0x8c78('0x77'),'unreadMessages');var _0x2cc6f8=utils[_0x8c78('0xa2')](_0x46d5c2);if(!_[_0x8c78('0xa3')](_0x2cc6f8)){_0x1c1e49[_0x8c78('0xa4')]('t.id\x20IN\x20?',_0x2cc6f8);}var _0x2c719b={'type':db[_0x8c78('0x70')][_0x8c78('0x71')]['SELECT'],'raw':!![]};return db[_0x8c78('0x73')][_0x8c78('0x9b')](_0x1c1e49[_0x8c78('0x74')](),_0x2c719b);}module[_0x8c78('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 94d895b..645a38d 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f24=['answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','plainBody','then','lastMsgText','updateInteraction','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','fullname','split','forEach','waiting','talking'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f24,0xa0));var _0x47f2=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x7f24[_0x369a98];return _0x29565c;};'use strict';var _=require(_0x47f2('0x0'));var db=require(_0x47f2('0x1'))['db'];function getInteractionUsers(_0x1b1354,_0x4f6df1){return new Promise(function(_0x1913c7,_0x428d0f){try{var _0x19eae7=[];if(_0x4f6df1[_0x1b1354]){_0x19eae7=_0x4f6df1[_0x1b1354][_0x47f2('0x2')](function(_0x1d4ec5){return{'id':_0x1d4ec5['id'],'fullname':_0x1d4ec5[_0x47f2('0x3')]};});}return _0x1913c7(_0x19eae7);}catch(_0x3731c7){_0x428d0f(_0x3731c7);}});}function getInteractionTags(_0x25e01f,_0x2ba4f8){var _0xa94fff=[];if(_0x25e01f){_0x25e01f[_0x47f2('0x4')](',')[_0x47f2('0x5')](function(_0x1c53bc){_0xa94fff['push'](_0x2ba4f8[_0x1c53bc]);});}return _0xa94fff;}function updateWaitingCounter(_0x59530d){if(_0x59530d[_0x47f2('0x6')]){_0x59530d['waiting']-=0x1;}}function updateInteractionCounters(_0x34ee26){_0x34ee26['waiting']=0x0;_0x34ee26[_0x47f2('0x7')]=0x0;_0x34ee26[_0x47f2('0x8')]=0x0;_0x34ee26[_0x47f2('0x9')]=0x0;_0x34ee26[_0x47f2('0xa')]=0x0;_0x34ee26[_0x47f2('0xb')]=0x0;if(_0x34ee26['closed']){if(_0x34ee26[_0x47f2('0xc')]===_0x47f2('0xa')){_0x34ee26['abandoned']+=0x1;updateWaitingCounter(_0x34ee26);}if(_0x34ee26['UserId']){_0x34ee26[_0x47f2('0x8')]+=0x1;if(_0x34ee26[_0x47f2('0x7')]){_0x34ee26[_0x47f2('0x7')]-=0x1;}}else{if(_0x34ee26[_0x47f2('0xc')]){_0x34ee26[_0x47f2('0x9')]+=0x1;updateWaitingCounter(_0x34ee26);}}}else{if(!_0x34ee26[_0x47f2('0xd')]){_0x34ee26[_0x47f2('0x6')]+=0x1;}if(_0x34ee26[_0x47f2('0xd')]){_0x34ee26[_0x47f2('0x7')]+=0x1;updateWaitingCounter(_0x34ee26);}}_0x34ee26['total']+=0x1;return _0x34ee26;}function getLastMessageText(_0x2c2441){return db[_0x47f2('0xe')][_0x47f2('0xf')]({'where':{'$and':[{'MailInteractionId':_0x2c2441['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x47f2('0x10')],'order':'-id','raw':!![]})[_0x47f2('0x11')](function(_0x56a3ee){if(_0x56a3ee&&_0x56a3ee[_0x47f2('0x10')]){_0x2c2441[_0x47f2('0x12')]=_['trimStart'](_0x56a3ee['plainBody']);}return _0x2c2441;})['catch'](function(_0xd5efab){throw _0xd5efab;});}exports[_0x47f2('0x13')]=function(_0x58f3c1,_0x331283,_0xc87856,_0x3a346b){return new Promise(function(_0x227922,_0x1a0225){return getInteractionUsers(_0x58f3c1['id'],_0xc87856)[_0x47f2('0x11')](function(_0x44bc09){_0x58f3c1[_0x47f2('0x14')]=_0x44bc09;return getInteractionTags(_0x58f3c1[_0x47f2('0x15')],_0x331283);})[_0x47f2('0x11')](function(_0x2c9586){_0x58f3c1[_0x47f2('0x16')]=_0x2c9586;delete _0x58f3c1[_0x47f2('0x15')];return updateInteractionCounters(_0x58f3c1);})[_0x47f2('0x11')](function(_0x526910){if(_0x3a346b){return getLastMessageText(_0x526910);}else{return _0x526910;}})[_0x47f2('0x11')](function(_0x4d3b4a){_0x227922(_0x4d3b4a);})[_0x47f2('0x17')](function(_0x814392){_0x1a0225(_0x814392);});});}; \ No newline at end of file +var _0x4da1=['map','split','forEach','push','waiting','unmanaged','abandoned','UserId','answered','talking','disposition','total','MailMessage','findOne','out','plainBody','-id','then','catch','updateInteraction','Users','TagIds','lodash'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x4da1,0xce));var _0x14da=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4da1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x14da('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x49e71a,_0x427782){return new Promise(function(_0x146beb,_0x645aa9){try{var _0x219416=[];if(_0x427782[_0x49e71a]){_0x219416=_0x427782[_0x49e71a][_0x14da('0x1')](function(_0x59441b){return{'id':_0x59441b['id'],'fullname':_0x59441b['fullname']};});}return _0x146beb(_0x219416);}catch(_0x5db264){_0x645aa9(_0x5db264);}});}function getInteractionTags(_0x5f1c1d,_0x57e28d){var _0x46d290=[];if(_0x5f1c1d){_0x5f1c1d[_0x14da('0x2')](',')[_0x14da('0x3')](function(_0x40ee15){_0x46d290[_0x14da('0x4')](_0x57e28d[_0x40ee15]);});}return _0x46d290;}function updateWaitingCounter(_0x47a095){if(_0x47a095['waiting']){_0x47a095[_0x14da('0x5')]-=0x1;}}function updateInteractionCounters(_0x31183d){_0x31183d[_0x14da('0x5')]=0x0;_0x31183d['talking']=0x0;_0x31183d['answered']=0x0;_0x31183d[_0x14da('0x6')]=0x0;_0x31183d['abandoned']=0x0;_0x31183d['total']=0x0;if(_0x31183d['closed']){if(_0x31183d['disposition']===_0x14da('0x7')){_0x31183d['abandoned']+=0x1;updateWaitingCounter(_0x31183d);}if(_0x31183d[_0x14da('0x8')]){_0x31183d[_0x14da('0x9')]+=0x1;if(_0x31183d[_0x14da('0xa')]){_0x31183d[_0x14da('0xa')]-=0x1;}}else{if(_0x31183d[_0x14da('0xb')]){_0x31183d['unmanaged']+=0x1;updateWaitingCounter(_0x31183d);}}}else{if(!_0x31183d[_0x14da('0x8')]){_0x31183d['waiting']+=0x1;}if(_0x31183d['UserId']){_0x31183d[_0x14da('0xa')]+=0x1;updateWaitingCounter(_0x31183d);}}_0x31183d[_0x14da('0xc')]+=0x1;return _0x31183d;}function getLastMessageText(_0x120807){return db[_0x14da('0xd')][_0x14da('0xe')]({'where':{'$and':[{'MailInteractionId':_0x120807['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x14da('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x14da('0x10')],'order':_0x14da('0x11'),'raw':!![]})[_0x14da('0x12')](function(_0x25a876){if(_0x25a876&&_0x25a876[_0x14da('0x10')]){_0x120807['lastMsgText']=_['trimStart'](_0x25a876['plainBody']);}return _0x120807;})[_0x14da('0x13')](function(_0x128d77){throw _0x128d77;});}exports[_0x14da('0x14')]=function(_0x52df30,_0xac5f4b,_0x29c6a8,_0x5b9fb6){return new Promise(function(_0x112670,_0x2945b7){return getInteractionUsers(_0x52df30['id'],_0x29c6a8)[_0x14da('0x12')](function(_0x597f1e){_0x52df30[_0x14da('0x15')]=_0x597f1e;return getInteractionTags(_0x52df30[_0x14da('0x16')],_0xac5f4b);})[_0x14da('0x12')](function(_0x275b93){_0x52df30['Tags']=_0x275b93;delete _0x52df30['TagIds'];return updateInteractionCounters(_0x52df30);})[_0x14da('0x12')](function(_0x5dc42e){if(_0x5b9fb6){return getLastMessageText(_0x5dc42e);}else{return _0x5dc42e;}})[_0x14da('0x12')](function(_0xecaea0){_0x112670(_0xecaea0);})['catch'](function(_0x4b1e28){_0x2945b7(_0x4b1e28);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d9cf930..75f6300 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2a7=['unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','name','role','null','Interaction','then','update','catch','error','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','InteractionId','upperFirst'];(function(_0xb65ffb,_0x2cc0af){var _0x58f55c=function(_0x24ba56){while(--_0x24ba56){_0xb65ffb['push'](_0xb65ffb['shift']());}};_0x58f55c(++_0x2cc0af);}(_0xf2a7,0x144));var _0x7f2a=function(_0x48b957,_0x4b5393){_0x48b957=_0x48b957-0x0;var _0x774060=_0xf2a7[_0x48b957];return _0x774060;};'use strict';var _=require(_0x7f2a('0x0'));var db=require(_0x7f2a('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x7f2a('0x2')),'mail':require(_0x7f2a('0x3'))(_0x7f2a('0x4')),'fax':require(_0x7f2a('0x3'))('fax-interactions'),'sms':require('../../config/logger')(_0x7f2a('0x5')),'chat':require(_0x7f2a('0x3'))(_0x7f2a('0x6')),'whatsapp':require(_0x7f2a('0x3'))(_0x7f2a('0x7'))};function getAccountFK(_0x390c5a){return _[_0x7f2a('0x8')](_0x390c5a)+(_0x390c5a===_0x7f2a('0x9')?'Website':'Account')+'Id';}function getInteractionFK(_0x4387b6){return _[_0x7f2a('0x8')](_0x4387b6)+_0x7f2a('0xa');}function getInteractionId(_0x432ecd,_0xd8eddc,_0x23c3cb){if(_0x432ecd&&_0x432ecd[_['upperFirst'](_0x23c3cb)+'InteractionId']){return _0x432ecd[_[_0x7f2a('0xb')](_0x23c3cb)+_0x7f2a('0xa')];}else if(_0x432ecd&&_0x432ecd['id']){return _0x432ecd['id'];}else if(_0xd8eddc&&_0xd8eddc['id']){return _0xd8eddc['id'];}else{return _0x7f2a('0xc');}}function getInteractionsTables(_0x5522ce){return{'accounts':_0x5522ce+'_'+(_0x5522ce===_0x7f2a('0x9')?_0x7f2a('0xd'):'accounts'),'interactions':_0x5522ce+_0x7f2a('0xe'),'interactionsTags':_0x5522ce+_0x7f2a('0xf'),'messages':_0x5522ce+_0x7f2a('0x10'),'userInteractions':_0x7f2a('0x11')+_0x5522ce+_0x7f2a('0xe')};}function getSelectedTags(_0x31927e){var _0x5788c9=[];if(_0x31927e){_0x5788c9=Array[_0x7f2a('0x12')](_0x31927e)?_0x31927e:[_0x31927e];}return _0x5788c9;}function log(_0xa4cc82,_0x2e1da2,_0xa133b3,_0x57a88e,_0x444a9a,_0x4bd659){loggers[_0x444a9a[_0x7f2a('0x13')]()][_0xa4cc82]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4bd659['toUpperCase'](),_0x2e1da2?_0x2e1da2['id']:null,_0x2e1da2?_0x2e1da2[_0x7f2a('0x14')]:null,_0x2e1da2?_0x2e1da2[_0x7f2a('0x15')]:null,getInteractionId(_0xa133b3,_0x57a88e,_0x444a9a),_0xa133b3?JSON['stringify'](_0xa133b3):_0x7f2a('0x16'));}function updateUser(_0x2e287f,_0x1459ae,_0x12ca63,_0x3e981d,_0x2feef8){db[_[_0x7f2a('0xb')](_0x3e981d)+_0x7f2a('0x17')]['findOne']({'where':{'id':getInteractionId(_0x1459ae,_0x12ca63,_0x3e981d)}})[_0x7f2a('0x18')](function(_0x3ccf4b){if(_0x3ccf4b){return _0x3ccf4b[_0x7f2a('0x19')]({'UserId':_0x2e287f?_0x2e287f['id']:null});}})[_0x7f2a('0x18')](function(_0x43ed57){if(_0x43ed57){log('info',_0x2e287f,_0x1459ae,_0x12ca63,_0x3e981d,_0x2feef8);}})[_0x7f2a('0x1a')](function(){log(_0x7f2a('0x1b'),_0x2e287f,_0x1459ae,_0x12ca63,_0x3e981d,_0x2feef8);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x8a8d=['_interaction_has_tags','_messages','user_has_','isArray','toUpperCase','name','stringify','upperFirst','then','update','info','catch','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','unknown','websites','_interactions'];(function(_0x44d809,_0x1f76fb){var _0x5361b9=function(_0x3e2a7f){while(--_0x3e2a7f){_0x44d809['push'](_0x44d809['shift']());}};_0x5361b9(++_0x1f76fb);}(_0x8a8d,0x179));var _0xd8a8=function(_0x214b3d,_0x28978b){_0x214b3d=_0x214b3d-0x0;var _0xcee44a=_0x8a8d[_0x214b3d];return _0xcee44a;};'use strict';var _=require('lodash');var db=require(_0xd8a8('0x0'))['db'];var loggers={'openchannel':require(_0xd8a8('0x1'))('openchannel-interactions'),'mail':require(_0xd8a8('0x1'))(_0xd8a8('0x2')),'fax':require(_0xd8a8('0x1'))(_0xd8a8('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd8a8('0x4'))};function getAccountFK(_0x5ba945){return _[_0xd8a8('0x5')](_0x5ba945)+(_0x5ba945===_0xd8a8('0x6')?_0xd8a8('0x7'):_0xd8a8('0x8'))+'Id';}function getInteractionFK(_0x22b742){return _[_0xd8a8('0x5')](_0x22b742)+'InteractionId';}function getInteractionId(_0x388004,_0x46bfe5,_0x4cfadd){if(_0x388004&&_0x388004[_['upperFirst'](_0x4cfadd)+_0xd8a8('0x9')]){return _0x388004[_['upperFirst'](_0x4cfadd)+_0xd8a8('0x9')];}else if(_0x388004&&_0x388004['id']){return _0x388004['id'];}else if(_0x46bfe5&&_0x46bfe5['id']){return _0x46bfe5['id'];}else{return _0xd8a8('0xa');}}function getInteractionsTables(_0x5c6c73){return{'accounts':_0x5c6c73+'_'+(_0x5c6c73===_0xd8a8('0x6')?_0xd8a8('0xb'):'accounts'),'interactions':_0x5c6c73+_0xd8a8('0xc'),'interactionsTags':_0x5c6c73+_0xd8a8('0xd'),'messages':_0x5c6c73+_0xd8a8('0xe'),'userInteractions':_0xd8a8('0xf')+_0x5c6c73+_0xd8a8('0xc')};}function getSelectedTags(_0x20e965){var _0x7d436d=[];if(_0x20e965){_0x7d436d=Array[_0xd8a8('0x10')](_0x20e965)?_0x20e965:[_0x20e965];}return _0x7d436d;}function log(_0x218322,_0x4539f3,_0x564f40,_0x52863b,_0x4f9f7e,_0x546e92){loggers[_0x4f9f7e['toLowerCase']()][_0x218322]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x546e92[_0xd8a8('0x11')](),_0x4539f3?_0x4539f3['id']:null,_0x4539f3?_0x4539f3[_0xd8a8('0x12')]:null,_0x4539f3?_0x4539f3['role']:null,getInteractionId(_0x564f40,_0x52863b,_0x4f9f7e),_0x564f40?JSON[_0xd8a8('0x13')](_0x564f40):'null');}function updateUser(_0x13d617,_0x589351,_0x45da24,_0x4b29c4,_0x26ea76){db[_[_0xd8a8('0x14')](_0x4b29c4)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x589351,_0x45da24,_0x4b29c4)}})[_0xd8a8('0x15')](function(_0x40fdbf){if(_0x40fdbf){return _0x40fdbf[_0xd8a8('0x16')]({'UserId':_0x13d617?_0x13d617['id']:null});}})[_0xd8a8('0x15')](function(_0x812574){if(_0x812574){log(_0xd8a8('0x17'),_0x13d617,_0x589351,_0x45da24,_0x4b29c4,_0x26ea76);}})[_0xd8a8('0x18')](function(){log('error',_0x13d617,_0x589351,_0x45da24,_0x4b29c4,_0x26ea76);});}module[_0xd8a8('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 55c80a1..5efbfa4 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 _0xb19f=['count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then'];(function(_0x16ae0d,_0x26c762){var _0xed0618=function(_0x5e6a90){while(--_0x5e6a90){_0x16ae0d['push'](_0x16ae0d['shift']());}};_0xed0618(++_0x26c762);}(_0xb19f,0x1c5));var _0xfb19=function(_0x471b36,_0x2095a9){_0x471b36=_0x471b36-0x0;var _0x1e10c6=_0xb19f[_0x471b36];return _0x1e10c6;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xfb19('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xfb19('0x1'));function getValueFromLicense(_0x5ac6bf,_0x54bee7){if(_0x5ac6bf&&_0x54bee7){if(_0x54bee7[_0xfb19('0x2')]&&_0x54bee7[_0xfb19('0x3')]){var _0xd80074=_0x54bee7[_0xfb19('0x2')];var _0x7807c6=_0x54bee7[_0xfb19('0x3')];var _0x3ae3b8=_0xd80074['split']('-')[0x4];var _0x1ef13d=_0xd80074[_0xfb19('0x4')]('-')[0x0];var _0x407453=crypto['createDecipher'](_0xfb19('0x5'),util['format']('%s:%s:%s',_0x3ae3b8,_0xd80074,_0x1ef13d));var _0x51c602=_0x407453[_0xfb19('0x6')](_0x7807c6,_0xfb19('0x7'),_0xfb19('0x8'));_0x51c602+=_0x407453[_0xfb19('0x9')]('utf8');var _0x41ea61=JSON['parse'](_0x51c602);return _0x41ea61[_0xfb19('0xa')](_0x5ac6bf)?_0x41ea61[_0x5ac6bf]:null;}}return null;}function isLimit(_0x328e08,_0x113e00,_0x461139,_0x1199ce){var _0x47428c=_0x113e00;return compose()[_0xfb19('0xb')](function(_0x1ad65a,_0x2a6df6,_0x204e89){return db[_0xfb19('0xc')][_0xfb19('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xfb19('0xe')](function(_0x3e14f7){var _0x5b9c8f=getValueFromLicense(_0x328e08,_0x3e14f7);return _0x5b9c8f?_0x5b9c8f:_0x47428c;})[_0xfb19('0xe')](function(_0x90bafd){_0x47428c=_0x90bafd;return _0x461139[_0xfb19('0xf')](_0x1199ce);})['then'](function(_0x590e79){if(_0x590e79>=_0x47428c){return _0x2a6df6[_0xfb19('0x10')](0x193)[_0xfb19('0x11')]({'message':util[_0xfb19('0x12')](_0xfb19('0x13'),_0x328e08)});}_0x204e89();})[_0xfb19('0x14')](function(_0x115b72){_0x204e89(_0x115b72);});});}function isUserLimit(){return isLimit(_0xfb19('0x15'),0x1,db[_0xfb19('0x16')],{'where':{'$or':[{'role':_0xfb19('0x17')},{'role':_0xfb19('0x18')}]}});}exports[_0xfb19('0x19')]=isUserLimit; \ No newline at end of file +var _0xa317=['update','final','utf8','parse','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','split','format','%s:%s:%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa317,0x13a));var _0x7a31=function(_0x58e95e,_0x4a3e9b){_0x58e95e=_0x58e95e-0x0;var _0x4cdb1a=_0xa317[_0x58e95e];return _0x4cdb1a;};'use strict';var crypto=require(_0x7a31('0x0'));var util=require(_0x7a31('0x1'));var compose=require(_0x7a31('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x7a31('0x3'));function getValueFromLicense(_0x10a48f,_0x2a4dac){if(_0x10a48f&&_0x2a4dac){if(_0x2a4dac[_0x7a31('0x4')]&&_0x2a4dac['license']){var _0x3085f0=_0x2a4dac[_0x7a31('0x4')];var _0x14c45f=_0x2a4dac['license'];var _0x3ed899=_0x3085f0['split']('-')[0x4];var _0xc37685=_0x3085f0[_0x7a31('0x5')]('-')[0x0];var _0x3f6e95=crypto['createDecipher']('aes-256-ctr',util[_0x7a31('0x6')](_0x7a31('0x7'),_0x3ed899,_0x3085f0,_0xc37685));var _0x52708b=_0x3f6e95[_0x7a31('0x8')](_0x14c45f,'base64','utf8');_0x52708b+=_0x3f6e95[_0x7a31('0x9')](_0x7a31('0xa'));var _0x3b6b30=JSON[_0x7a31('0xb')](_0x52708b);return _0x3b6b30['hasOwnProperty'](_0x10a48f)?_0x3b6b30[_0x10a48f]:null;}}return null;}function isLimit(_0x120a02,_0x2a914b,_0x1e6740,_0x564f85){var _0x38f5e4=_0x2a914b;return compose()[_0x7a31('0xc')](function(_0x4767a3,_0x360ec3,_0x1c1e35){return db[_0x7a31('0xd')][_0x7a31('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x498ec4){var _0xb396df=getValueFromLicense(_0x120a02,_0x498ec4);return _0xb396df?_0xb396df:_0x38f5e4;})[_0x7a31('0xf')](function(_0x538b58){_0x38f5e4=_0x538b58;return _0x1e6740[_0x7a31('0x10')](_0x564f85);})[_0x7a31('0xf')](function(_0x34713d){if(_0x34713d>=_0x38f5e4){return _0x360ec3[_0x7a31('0x11')](0x193)['json']({'message':util[_0x7a31('0x6')](_0x7a31('0x12'),_0x120a02)});}_0x1c1e35();})['catch'](function(_0x5cc1eb){_0x1c1e35(_0x5cc1eb);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x7a31('0x13')],{'where':{'$or':[{'role':_0x7a31('0x14')},{'role':_0x7a31('0x15')}]}});}exports[_0x7a31('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4b0445e..1a4ad81 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 _0x56a4=['BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','shift','pop','utcOffset','format','add','hours','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','match','indexOf','map','conditions','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','\x20OR\x20','IN\x20?','$notIn','=\x20?','<>\x20?','$substring','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?'];(function(_0x3a950d,_0x4f2ece){var _0x546dfb=function(_0x41eaff){while(--_0x41eaff){_0x3a950d['push'](_0x3a950d['shift']());}};_0x546dfb(++_0x4f2ece);}(_0x56a4,0x1bb));var _0x456a=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0x56a4[_0x3ae34a];return _0x4c9edc;};'use strict';var _=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));exports[_0x456a('0x2')]=function(_0x52d05a){var _0x8304ac={'conditions':[]};_0x8304ac['sqlOperator']=_[_0x456a('0x3')](_0x52d05a,_0x456a('0x4'))?'or':_0x456a('0x5');var _0xad87e6=_0x52d05a['replace'](_0x456a('0x6'),'')[_0x456a('0x7')]('[$or]','')[_0x456a('0x8')]('||');for(var _0x34fec2=0x0;_0x34fec2<_0xad87e6[_0x456a('0x9')];_0x34fec2++){var _0x25c863=_0xad87e6[_0x34fec2][_0x456a('0x8')](':=');var _0x37b81b=_0x25c863[0x0];var _0x39827e=_0x25c863[_0x456a('0xa')](0x1);_0x39827e[_0x456a('0xb')](function(_0x3e5db0){var _0x662758=_0x3e5db0['split']('[')['shift']();var _0x465d83=_0x3e5db0[_0x456a('0xc')](/\[(.*?)\]/g);_0x465d83[_0x456a('0xb')](function(_0x3a648e){var _0x12f3d2=_0x3a648e[_0x456a('0x8')]('[')['filter'](function(_0x1ba567){return _0x1ba567[_0x456a('0xd')](']')>-0x1;})[_0x456a('0xe')](function(_0x13ac00){return _0x13ac00[_0x456a('0x8')](']')[0x0];})[0x0];_0x8304ac[_0x456a('0xf')]['push']({'field':_0x37b81b,'operator':_0x662758,'value':_0x12f3d2});});});}return _0x8304ac;};exports['buildExpression']=function(_0x1a081d,_0x5662d1,_0x1a921f){var _0x1b1534={};if(_0x5662d1===_0x456a('0x10')){if(_0x1a921f[_0x456a('0x11')]===_0x456a('0x12')){_0x1a921f[_0x456a('0x11')]=_0x456a('0x13');_0x1a921f[_0x456a('0x14')]+=','+_0x1a921f[_0x456a('0x14')];}else if(_[_0x456a('0x15')]([_0x456a('0x16'),_0x456a('0x17')],_0x1a921f[_0x456a('0x11')])){_0x1a921f[_0x456a('0x14')]=moment(_0x1a921f[_0x456a('0x14')])['add'](0x1,_0x456a('0x18'))['format'](_0x456a('0x19'));}}if(_0x1a921f[_0x456a('0x1a')]){_0x5662d1=_0x1a921f[_0x456a('0x1a')];_0x1b1534[_0x456a('0x1b')]='CAST('+_0x1a081d+'.'+_0x1a921f['field']+_0x456a('0x1c')+_0x1a921f['castTo']+')\x20'+parseOperator(_0x1a921f[_0x456a('0x11')]);}else{_0x1b1534[_0x456a('0x1b')]=_0x1a081d+'.'+_0x1a921f[_0x456a('0x1d')]+'\x20'+parseOperator(_0x1a921f[_0x456a('0x11')]);}if(_[_0x456a('0x15')]([_0x456a('0x1e'),'$notIn'],_0x1a921f['operator']))_0x1b1534[_0x456a('0x1b')]='('+_0x1b1534[_0x456a('0x1b')]+_0x456a('0x1f')+_0x1a081d+'.'+_0x1a921f[_0x456a('0x1d')]+'\x20IS\x20NULL)';_0x1b1534['value']=parseValue(_0x5662d1,_0x1a921f[_0x456a('0x11')],_0x1a921f[_0x456a('0x14')]);return _0x1b1534;};function parseOperator(_0x36ad3b){var _0x27e16c;switch(_0x36ad3b){case'$in':_0x27e16c=_0x456a('0x20');break;case _0x456a('0x21'):_0x27e16c='NOT\x20IN\x20?';break;case'$eq':_0x27e16c=_0x456a('0x22');break;case _0x456a('0x1e'):_0x27e16c=_0x456a('0x23');break;case _0x456a('0x24'):case'$startsWith':case'$endsWith':_0x27e16c='LIKE\x20?';break;case _0x456a('0x25'):_0x27e16c=_0x456a('0x26');break;case'$gt':_0x27e16c=_0x456a('0x27');break;case _0x456a('0x17'):_0x27e16c=_0x456a('0x28');break;case _0x456a('0x29'):_0x27e16c=_0x456a('0x2a');break;case _0x456a('0x13'):_0x27e16c=_0x456a('0x2b');break;}return _0x27e16c;}function parseValue(_0x34ad3e,_0x1ff42b,_0x3d42f4){var _0x3c136d={'start':undefined,'end':undefined};switch(_0x1ff42b){case _0x456a('0x2c'):case'$notIn':_0x3c136d[_0x456a('0x2d')]=_0x3d42f4[_0x456a('0x8')](',');break;case _0x456a('0x24'):_0x3c136d[_0x456a('0x2d')]='%'+_0x3d42f4+'%';break;case'$startsWith':_0x3c136d['start']=_0x3d42f4+'%';break;case _0x456a('0x2e'):_0x3c136d['start']='%'+_0x3d42f4;break;case _0x456a('0x13'):var _0x283560=_0x3d42f4[_0x456a('0x8')](',');var _0x3d42f4=_0x283560[_0x456a('0x2f')]();var _0x265f87=_0x283560[_0x456a('0x30')]();if(_0x34ad3e===_0x456a('0x10')){_0x3d42f4=moment(_0x3d42f4)[_0x456a('0x31')](0x0,!![])[_0x456a('0x32')]();_0x265f87=moment(_0x265f87)[_0x456a('0x31')](0x0,!![])[_0x456a('0x33')](0x17,_0x456a('0x34'))[_0x456a('0x33')](0x3b,'minutes')[_0x456a('0x33')](0x3b,_0x456a('0x35'))[_0x456a('0x32')]();}_0x3c136d={'start':_0x3d42f4,'end':_0x265f87};break;default:_0x3c136d[_0x456a('0x2d')]=_0x3d42f4;break;}return _0x3c136d;} \ No newline at end of file +var _0x52cf=['$in','start','$substring','$endsWith','shift','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x52cf,0x171));var _0xf52c=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x52cf[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xf52c('0x0'));var moment=require('moment');exports[_0xf52c('0x1')]=function(_0x5d3fa7){var _0x47abcc={'conditions':[]};_0x47abcc[_0xf52c('0x2')]=_[_0xf52c('0x3')](_0x5d3fa7,_0xf52c('0x4'))?'or':_0xf52c('0x5');var _0x34bbbc=_0x5d3fa7[_0xf52c('0x6')](_0xf52c('0x7'),'')[_0xf52c('0x6')](_0xf52c('0x4'),'')['split']('||');for(var _0x18aa1e=0x0;_0x18aa1e<_0x34bbbc[_0xf52c('0x8')];_0x18aa1e++){var _0x17e4af=_0x34bbbc[_0x18aa1e][_0xf52c('0x9')](':=');var _0xe6f66d=_0x17e4af[0x0];var _0x50bfeb=_0x17e4af[_0xf52c('0xa')](0x1);_0x50bfeb[_0xf52c('0xb')](function(_0x6cd94e){var _0xa5e850=_0x6cd94e[_0xf52c('0x9')]('[')['shift']();var _0x3feaa6=_0x6cd94e[_0xf52c('0xc')](/\[(.*?)\]/g);_0x3feaa6['forEach'](function(_0x70078c){var _0x3d5152=_0x70078c[_0xf52c('0x9')]('[')[_0xf52c('0xd')](function(_0x23b27e){return _0x23b27e[_0xf52c('0xe')](']')>-0x1;})[_0xf52c('0xf')](function(_0x58db64){return _0x58db64[_0xf52c('0x9')](']')[0x0];})[0x0];_0x47abcc[_0xf52c('0x10')][_0xf52c('0x11')]({'field':_0xe6f66d,'operator':_0xa5e850,'value':_0x3d5152});});});}return _0x47abcc;};exports[_0xf52c('0x12')]=function(_0x152678,_0x1b1a80,_0x42826a){var _0x207718={};if(_0x1b1a80===_0xf52c('0x13')){if(_0x42826a[_0xf52c('0x14')]===_0xf52c('0x15')){_0x42826a[_0xf52c('0x14')]=_0xf52c('0x16');_0x42826a['value']+=','+_0x42826a[_0xf52c('0x17')];}else if(_[_0xf52c('0x18')]([_0xf52c('0x19'),_0xf52c('0x1a')],_0x42826a['operator'])){_0x42826a[_0xf52c('0x17')]=moment(_0x42826a['value'])[_0xf52c('0x1b')](0x1,'days')[_0xf52c('0x1c')](_0xf52c('0x1d'));}}if(_0x42826a[_0xf52c('0x1e')]){_0x1b1a80=_0x42826a[_0xf52c('0x1e')];_0x207718[_0xf52c('0x1f')]=_0xf52c('0x20')+_0x152678+'.'+_0x42826a[_0xf52c('0x21')]+_0xf52c('0x22')+_0x42826a[_0xf52c('0x1e')]+')\x20'+parseOperator(_0x42826a[_0xf52c('0x14')]);}else{_0x207718[_0xf52c('0x1f')]=_0x152678+'.'+_0x42826a[_0xf52c('0x21')]+'\x20'+parseOperator(_0x42826a[_0xf52c('0x14')]);}if(_[_0xf52c('0x18')](['$ne','$notIn'],_0x42826a[_0xf52c('0x14')]))_0x207718[_0xf52c('0x1f')]='('+_0x207718[_0xf52c('0x1f')]+_0xf52c('0x23')+_0x152678+'.'+_0x42826a[_0xf52c('0x21')]+_0xf52c('0x24');_0x207718['value']=parseValue(_0x1b1a80,_0x42826a[_0xf52c('0x14')],_0x42826a[_0xf52c('0x17')]);return _0x207718;};function parseOperator(_0x472a4d){var _0x2e1599;switch(_0x472a4d){case'$in':_0x2e1599=_0xf52c('0x25');break;case _0xf52c('0x26'):_0x2e1599=_0xf52c('0x27');break;case _0xf52c('0x15'):_0x2e1599=_0xf52c('0x28');break;case _0xf52c('0x29'):_0x2e1599=_0xf52c('0x2a');break;case'$substring':case _0xf52c('0x2b'):case'$endsWith':_0x2e1599=_0xf52c('0x2c');break;case _0xf52c('0x2d'):_0x2e1599=_0xf52c('0x2e');break;case _0xf52c('0x19'):_0x2e1599=_0xf52c('0x2f');break;case _0xf52c('0x1a'):_0x2e1599=_0xf52c('0x30');break;case _0xf52c('0x31'):_0x2e1599=_0xf52c('0x32');break;case'$between':_0x2e1599='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e1599;}function parseValue(_0x204d14,_0x527314,_0xfef10c){var _0x2535dd={'start':undefined,'end':undefined};switch(_0x527314){case _0xf52c('0x33'):case'$notIn':_0x2535dd[_0xf52c('0x34')]=_0xfef10c['split'](',');break;case _0xf52c('0x35'):_0x2535dd['start']='%'+_0xfef10c+'%';break;case _0xf52c('0x2b'):_0x2535dd['start']=_0xfef10c+'%';break;case _0xf52c('0x36'):_0x2535dd[_0xf52c('0x34')]='%'+_0xfef10c;break;case'$between':var _0x2cdfca=_0xfef10c[_0xf52c('0x9')](',');var _0xfef10c=_0x2cdfca[_0xf52c('0x37')]();var _0x4299c2=_0x2cdfca['pop']();if(_0x204d14===_0xf52c('0x13')){_0xfef10c=moment(_0xfef10c)[_0xf52c('0x38')](0x0,!![])[_0xf52c('0x1c')]();_0x4299c2=moment(_0x4299c2)[_0xf52c('0x38')](0x0,!![])['add'](0x17,_0xf52c('0x39'))[_0xf52c('0x1b')](0x3b,_0xf52c('0x3a'))[_0xf52c('0x1b')](0x3b,_0xf52c('0x3b'))['format']();}_0x2535dd={'start':_0xfef10c,'end':_0x4299c2};break;default:_0x2535dd['start']=_0xfef10c;break;}return _0x2535dd;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7ebe0cc..f7b4d58 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 _0x9c5a=['YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','indexOf','col','priority','unsigned','substr','DESC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','query','$id','name','intersection','model','attributes','nolimit','order','filter','object','columns','value','where','VIRTUAL','lower','merge','options','lodash','sequelize','parse','keys','includes','fields','split','filters','find','type','DATE','isPlainObject','format'];(function(_0x36630e,_0x4132a4){var _0x430205=function(_0x10d242){while(--_0x10d242){_0x36630e['push'](_0x36630e['shift']());}};_0x430205(++_0x4132a4);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x23b185,_0x15dfea){_0x23b185=_0x23b185-0x0;var _0x285ab0=_0x9c5a[_0x23b185];return _0x285ab0;};'use strict';var _=require(_0xa9c5('0x0'));var sequelize=require(_0xa9c5('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x32ab4d){var _0x1cd14d=['ne'];try{var _0x1d0ee9=JSON[_0xa9c5('0x2')](_0x32ab4d);var _0x4f5552=Object[_0xa9c5('0x3')](_0x1d0ee9)[0x0];return _0x1cd14d[_0xa9c5('0x4')](_0x4f5552);}catch(_0x4e9403){return![];}}function getOperatorValue(_0x1e3c83){var _0x4d9c7a=JSON[_0xa9c5('0x2')](_0x1e3c83);var _0x3df556=Object['keys'](_0x4d9c7a)[0x0];var _0x4b6db6=_0x4d9c7a[_0x3df556];return{['$'+_0x3df556]:_0x4b6db6};}exports[_0xa9c5('0x5')]=function(_0x16f331){var _0x52afb2=null;if(_0x16f331){_0x52afb2=_0x16f331[_0xa9c5('0x6')](',');}return _0x52afb2;};exports[_0xa9c5('0x7')]=function(_0x51c14c,_0x2e4f45){var _0x40a79d={};if(!_['isEmpty'](_0x51c14c)){_['forOwn'](_0x51c14c,function(_0x38e106,_0x11421c){try{if(_0x2e4f45){var _0x45f8d8=_[_0xa9c5('0x8')](_0x2e4f45,{'name':_0x11421c})||{};if(hasSequelizeOperator(_0x38e106)){_0x40a79d[_0x11421c]=getOperatorValue(_0x38e106);}else if(_0x45f8d8[_0xa9c5('0x9')]===_0xa9c5('0xa')&&_[_0xa9c5('0xb')](_0x38e106)){var _0x42d5cf=JSON[_0xa9c5('0x2')](_0x38e106);var _0x1ea48={'$gte':moment(moment(_0x42d5cf['$gte'])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0xc')](),'$lte':moment(moment(_0x42d5cf[_0xa9c5('0xf')])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0x10')](0x1,'s')[_0xa9c5('0xc')]()};_0x40a79d[_0x11421c]=_0x1ea48;}else if(_0x45f8d8['name']===_0xa9c5('0x11')){_0x40a79d[_0x11421c]=_0x38e106;}else{_0x40a79d[_0x11421c]=_[_0xa9c5('0x12')](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}else{_0x40a79d[_0x11421c]=_['isArray'](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}catch(_0x1142d9){_0x40a79d[_0x11421c]=_0x38e106[_0xa9c5('0x6')](',');}});}return _0x40a79d;};exports[_0xa9c5('0x13')]=function(_0x452a9b){_0x452a9b=parseInt(_0x452a9b,0xa);if(!_0x452a9b||_0x452a9b<0x0){_0x452a9b=LIMIT_VALUE;}return _0x452a9b;};exports[_0xa9c5('0x14')]=function(_0x3b8d4d){_0x3b8d4d=parseInt(_0x3b8d4d,0xa);if(!_0x3b8d4d||_0x3b8d4d<0x0){_0x3b8d4d=0x0;}return _0x3b8d4d;};exports[_0xa9c5('0x15')]=function(_0x2c7cd5){var _0x36c486,_0x113c8f=null;if(_0x2c7cd5){_0x36c486=_0x2c7cd5[_0xa9c5('0x6')](',');_0x113c8f=_['map'](_0x36c486,function(_0x1115ad){if(_0x1115ad[_0xa9c5('0x16')]('-')===0x0){return[_0x1115ad==='priority'?sequelize['cast'](sequelize[_0xa9c5('0x17')](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad[_0xa9c5('0x1a')](0x1),_0xa9c5('0x1b')];}else{return[_0x1115ad===_0xa9c5('0x18')?sequelize['cast'](sequelize['col'](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad,'ASC'];}});}return _0x113c8f;};exports[_0xa9c5('0x1c')]=function(_0x424b4c,_0x306c9b){if(_[_0xa9c5('0x1d')](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x12')](_0x424b4c)){for(var _0x40f08b=0x0;_0x40f08b<_0x424b4c[_0xa9c5('0x1e')];_0x40f08b+=0x1){_0x424b4c[_0x40f08b]=this['omit'](_0x424b4c[_0x40f08b],_0x306c9b);}return _0x424b4c;}if(!_['isObject'](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x1f')](_0x306c9b)){_0x306c9b=[_0x306c9b];}if(!_['isArray'](_0x306c9b)){return _0x424b4c;}for(var _0x1762ac=0x0;_0x1762ac<_0x306c9b[_0xa9c5('0x1e')];_0x1762ac+=0x1){_['unset'](_0x424b4c,_0x306c9b[_0x1762ac]);}for(var _0x11a723 in _0x424b4c){if(_0x424b4c[_0xa9c5('0x20')](_0x11a723)){_0x424b4c[_0x11a723]=this['omit'](_0x424b4c[_0x11a723],_0x306c9b);}}return _0x424b4c;};exports[_0xa9c5('0x21')]=function(_0x32baf9){return _0x32baf9[_0xa9c5('0x22')](RegExp(_0xa9c5('0x23')))?!![]:![];};exports[_0xa9c5('0x24')]=function(_0x4f6e70){return _0x4f6e70[_0xa9c5('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3c3da7){var _0x1ef388=[];_0x3c3da7[_0xa9c5('0x6')](/[ ,]+/)['forEach'](function(_0xc6d0c1){_0xc6d0c1=_0xc6d0c1[_0xa9c5('0x25')](/([^:]")"+/g,'$1');_0xc6d0c1='+'+_0xc6d0c1+'*';var _0x5bc9bb=/[ `!@#$%^&*()_\-?~]/;if(_0xc6d0c1[_0xa9c5('0x22')](_0x5bc9bb))_0xc6d0c1='\x22'+_0xc6d0c1+'\x22';_0x1ef388[_0xa9c5('0x26')](_0xc6d0c1);});return _0x1ef388[_0xa9c5('0x27')]('\x20');};exports[_0xa9c5('0x28')]=function(_0x22ee21,_0x3392d0,_0x3a66d8){var _0x4b9104={},_0x452330={};if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')]){_0x3392d0[_0xa9c5('0x29')]['id']=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];delete _0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];}_0x4b9104['model']=_['map'](_0x22ee21,_0xa9c5('0x2b'));_0x4b9104[_0xa9c5('0x29')]=_[_0xa9c5('0x3')](_0x3392d0[_0xa9c5('0x29')]);_0x4b9104[_0xa9c5('0x7')]=_[_0xa9c5('0x2c')](_0x4b9104['model'],_0x4b9104['query']);_0x452330['attributes']=_[_0xa9c5('0x2c')](_0x4b9104[_0xa9c5('0x2d')],this['fields'](_0x3392d0[_0xa9c5('0x29')]['fields']));_0x452330[_0xa9c5('0x2e')]=_0x452330[_0xa9c5('0x2e')][_0xa9c5('0x1e')]?_0x452330[_0xa9c5('0x2e')]:_0x4b9104['model'];if(!_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x20')](_0xa9c5('0x2f'))){_0x452330[_0xa9c5('0x13')]=this[_0xa9c5('0x13')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x13')]);_0x452330[_0xa9c5('0x14')]=this['offset'](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x14')]);}_0x452330[_0xa9c5('0x30')]=this[_0xa9c5('0x15')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x15')]);_0x452330['where']=this[_0xa9c5('0x7')](_['pick'](_0x3392d0[_0xa9c5('0x29')],_0x4b9104['filters']),_0x22ee21);if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]){var _0x37fb1b=_0x22ee21;var _0x5d09c5=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')];if(typeof _0x5d09c5===_0xa9c5('0x32')){_0x37fb1b=_[_0xa9c5('0x31')](_0x22ee21,function(_0x5914d2){return _[_0xa9c5('0x4')](_0x5d09c5[_0xa9c5('0x33')],_0x5914d2[_0xa9c5('0x2b')]);});_0x5d09c5=_0x5d09c5[_0xa9c5('0x34')];}_0x452330[_0xa9c5('0x35')]=_['merge'](_0x452330[_0xa9c5('0x35')],{'$or':_['map'](_0x37fb1b,function(_0x1de605){if(_0x1de605[_0xa9c5('0x9')]!==_0xa9c5('0x36')){if(_0x3a66d8){return sequelize[_0xa9c5('0x35')](sequelize['fn'](_0xa9c5('0x37'),sequelize[_0xa9c5('0x17')](_0x1de605[_0xa9c5('0x2b')])),{'$like':sequelize['fn'](_0xa9c5('0x37'),'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%')});}else{var _0x4aa4dd={};_0x4aa4dd[_0x1de605[_0xa9c5('0x2b')]]={'$like':'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%'};return _0x4aa4dd;}}})});}_0x452330=_[_0xa9c5('0x38')]({},_0x452330,_0x3392d0[_0xa9c5('0x39')]);return _0x452330;}; \ No newline at end of file +var _0x2d17=['indexOf','unsigned','substr','priority','cast','col','length','omit','unset','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','getOptions','query','$id','model','name','keys','intersection','attributes','hasOwnProperty','offset','order','where','pick','filter','object','columns','merge','VIRTUAL','lower','lodash','sequelize','parse','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','sort','map'];(function(_0x551559,_0x37688f){var _0x5590da=function(_0x43fa3c){while(--_0x43fa3c){_0x551559['push'](_0x551559['shift']());}};_0x5590da(++_0x37688f);}(_0x2d17,0x17e));var _0x72d1=function(_0x2a8618,_0x120c60){_0x2a8618=_0x2a8618-0x0;var _0x164340=_0x2d17[_0x2a8618];return _0x164340;};'use strict';var _=require(_0x72d1('0x0'));var sequelize=require(_0x72d1('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x12f23c){var _0x4727f9=['ne'];try{var _0x531f4e=JSON[_0x72d1('0x2')](_0x12f23c);var _0x38fec7=Object['keys'](_0x531f4e)[0x0];return _0x4727f9[_0x72d1('0x3')](_0x38fec7);}catch(_0x4dfee1){return![];}}function getOperatorValue(_0x39150f){var _0x50f551=JSON[_0x72d1('0x2')](_0x39150f);var _0x239d1f=Object['keys'](_0x50f551)[0x0];var _0x477264=_0x50f551[_0x239d1f];return{['$'+_0x239d1f]:_0x477264};}exports[_0x72d1('0x4')]=function(_0x19e248){var _0x4e7f3e=null;if(_0x19e248){_0x4e7f3e=_0x19e248[_0x72d1('0x5')](',');}return _0x4e7f3e;};exports[_0x72d1('0x6')]=function(_0x283775,_0x593c91){var _0x1d7520={};if(!_[_0x72d1('0x7')](_0x283775)){_[_0x72d1('0x8')](_0x283775,function(_0x14a41e,_0x3cb9c2){try{if(_0x593c91){var _0x3916f2=_[_0x72d1('0x9')](_0x593c91,{'name':_0x3cb9c2})||{};if(hasSequelizeOperator(_0x14a41e)){_0x1d7520[_0x3cb9c2]=getOperatorValue(_0x14a41e);}else if(_0x3916f2[_0x72d1('0xa')]===_0x72d1('0xb')&&_[_0x72d1('0xc')](_0x14a41e)){var _0x5ad4df=JSON[_0x72d1('0x2')](_0x14a41e);var _0x37017c={'$gte':moment(moment(_0x5ad4df[_0x72d1('0xd')])[_0x72d1('0xe')](_0x72d1('0xf')))[_0x72d1('0x10')]()[_0x72d1('0xe')](),'$lte':moment(moment(_0x5ad4df[_0x72d1('0x11')])[_0x72d1('0xe')](_0x72d1('0xf')))[_0x72d1('0x10')]()[_0x72d1('0x12')](0x1,'s')[_0x72d1('0xe')]()};_0x1d7520[_0x3cb9c2]=_0x37017c;}else if(_0x3916f2['name']===_0x72d1('0x13')){_0x1d7520[_0x3cb9c2]=_0x14a41e;}else{_0x1d7520[_0x3cb9c2]=_['isArray'](_0x14a41e)?_0x14a41e:JSON[_0x72d1('0x2')](_0x14a41e);}}else{_0x1d7520[_0x3cb9c2]=_[_0x72d1('0x14')](_0x14a41e)?_0x14a41e:JSON['parse'](_0x14a41e);}}catch(_0x1061b7){_0x1d7520[_0x3cb9c2]=_0x14a41e[_0x72d1('0x5')](',');}});}return _0x1d7520;};exports[_0x72d1('0x15')]=function(_0x49caf4){_0x49caf4=parseInt(_0x49caf4,0xa);if(!_0x49caf4||_0x49caf4<0x0){_0x49caf4=LIMIT_VALUE;}return _0x49caf4;};exports['offset']=function(_0x313d7b){_0x313d7b=parseInt(_0x313d7b,0xa);if(!_0x313d7b||_0x313d7b<0x0){_0x313d7b=0x0;}return _0x313d7b;};exports[_0x72d1('0x16')]=function(_0x2233cb){var _0x1865c1,_0x8d6890=null;if(_0x2233cb){_0x1865c1=_0x2233cb[_0x72d1('0x5')](',');_0x8d6890=_[_0x72d1('0x17')](_0x1865c1,function(_0x5c7982){if(_0x5c7982[_0x72d1('0x18')]('-')===0x0){return[_0x5c7982==='priority'?sequelize['cast'](sequelize['col']('priority'),_0x72d1('0x19')):_0x5c7982[_0x72d1('0x1a')](0x1),'DESC'];}else{return[_0x5c7982===_0x72d1('0x1b')?sequelize[_0x72d1('0x1c')](sequelize[_0x72d1('0x1d')](_0x72d1('0x1b')),_0x72d1('0x19')):_0x5c7982,'ASC'];}});}return _0x8d6890;};exports['omit']=function(_0x188eca,_0x36bc65){if(_[_0x72d1('0x7')](_0x188eca)){return _0x188eca;}if(_[_0x72d1('0x14')](_0x188eca)){for(var _0xdf6a69=0x0;_0xdf6a69<_0x188eca[_0x72d1('0x1e')];_0xdf6a69+=0x1){_0x188eca[_0xdf6a69]=this[_0x72d1('0x1f')](_0x188eca[_0xdf6a69],_0x36bc65);}return _0x188eca;}if(!_['isObject'](_0x188eca)){return _0x188eca;}if(_['isString'](_0x36bc65)){_0x36bc65=[_0x36bc65];}if(!_[_0x72d1('0x14')](_0x36bc65)){return _0x188eca;}for(var _0x482cb8=0x0;_0x482cb8<_0x36bc65[_0x72d1('0x1e')];_0x482cb8+=0x1){_[_0x72d1('0x20')](_0x188eca,_0x36bc65[_0x482cb8]);}for(var _0x2c113d in _0x188eca){if(_0x188eca['hasOwnProperty'](_0x2c113d)){_0x188eca[_0x2c113d]=this[_0x72d1('0x1f')](_0x188eca[_0x2c113d],_0x36bc65);}}return _0x188eca;};exports['isNumeric']=function(_0x707cd0){return _0x707cd0[_0x72d1('0x21')](RegExp(_0x72d1('0x22')))?!![]:![];};exports[_0x72d1('0x23')]=function(_0x51242b){return _0x51242b[_0x72d1('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x42c03c){var _0x32dc5e=[];_0x42c03c['split'](/[ ,]+/)[_0x72d1('0x24')](function(_0x358b0c){_0x358b0c=_0x358b0c[_0x72d1('0x25')](/([^:]")"+/g,'$1');_0x358b0c='+'+_0x358b0c+'*';var _0x11ea2f=/[ `!@#$%^&*()_\-?~]/;if(_0x358b0c[_0x72d1('0x21')](_0x11ea2f))_0x358b0c='\x22'+_0x358b0c+'\x22';_0x32dc5e['push'](_0x358b0c);});return _0x32dc5e[_0x72d1('0x26')]('\x20');};exports[_0x72d1('0x27')]=function(_0x9efc2f,_0x482033,_0x244f4a){var _0x14669a={},_0x4a2909={};if(_0x482033[_0x72d1('0x28')][_0x72d1('0x29')]){_0x482033[_0x72d1('0x28')]['id']=_0x482033['query'][_0x72d1('0x29')];delete _0x482033['query'][_0x72d1('0x29')];}_0x14669a[_0x72d1('0x2a')]=_[_0x72d1('0x17')](_0x9efc2f,_0x72d1('0x2b'));_0x14669a[_0x72d1('0x28')]=_[_0x72d1('0x2c')](_0x482033[_0x72d1('0x28')]);_0x14669a[_0x72d1('0x6')]=_[_0x72d1('0x2d')](_0x14669a[_0x72d1('0x2a')],_0x14669a[_0x72d1('0x28')]);_0x4a2909['attributes']=_[_0x72d1('0x2d')](_0x14669a[_0x72d1('0x2a')],this[_0x72d1('0x4')](_0x482033[_0x72d1('0x28')]['fields']));_0x4a2909[_0x72d1('0x2e')]=_0x4a2909[_0x72d1('0x2e')][_0x72d1('0x1e')]?_0x4a2909['attributes']:_0x14669a[_0x72d1('0x2a')];if(!_0x482033[_0x72d1('0x28')][_0x72d1('0x2f')]('nolimit')){_0x4a2909[_0x72d1('0x15')]=this[_0x72d1('0x15')](_0x482033[_0x72d1('0x28')]['limit']);_0x4a2909[_0x72d1('0x30')]=this[_0x72d1('0x30')](_0x482033[_0x72d1('0x28')][_0x72d1('0x30')]);}_0x4a2909[_0x72d1('0x31')]=this[_0x72d1('0x16')](_0x482033[_0x72d1('0x28')]['sort']);_0x4a2909[_0x72d1('0x32')]=this[_0x72d1('0x6')](_[_0x72d1('0x33')](_0x482033[_0x72d1('0x28')],_0x14669a[_0x72d1('0x6')]),_0x9efc2f);if(_0x482033[_0x72d1('0x28')][_0x72d1('0x34')]){var _0x1d4fdf=_0x9efc2f;var _0x55438b=_0x482033[_0x72d1('0x28')][_0x72d1('0x34')];if(typeof _0x55438b===_0x72d1('0x35')){_0x1d4fdf=_[_0x72d1('0x34')](_0x9efc2f,function(_0x45870b){return _[_0x72d1('0x3')](_0x55438b[_0x72d1('0x36')],_0x45870b[_0x72d1('0x2b')]);});_0x55438b=_0x55438b['value'];}_0x4a2909['where']=_[_0x72d1('0x37')](_0x4a2909[_0x72d1('0x32')],{'$or':_[_0x72d1('0x17')](_0x1d4fdf,function(_0x21d361){if(_0x21d361['type']!==_0x72d1('0x38')){if(_0x244f4a){return sequelize[_0x72d1('0x32')](sequelize['fn']('lower',sequelize[_0x72d1('0x1d')](_0x21d361['name'])),{'$like':sequelize['fn'](_0x72d1('0x39'),'%'+_0x482033[_0x72d1('0x28')]['filter']+'%')});}else{var _0x37c69a={};_0x37c69a[_0x21d361['name']]={'$like':'%'+_0x482033['query']['filter']+'%'};return _0x37c69a;}}})});}_0x4a2909=_[_0x72d1('0x37')]({},_0x4a2909,_0x482033['options']);return _0x4a2909;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6dc6cd2..728ebbf 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73b3=['whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','lodash','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','faxStatus','openchannelStatus','smsStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','idle','getAgentIdsByStatus','findAll','name','fullname','pauseType','merge','globalStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0xd2e40d,_0x4116f4){var _0x4407cf=function(_0x361278){while(--_0x361278){_0xd2e40d['push'](_0xd2e40d['shift']());}};_0x4407cf(++_0x4116f4);}(_0x73b3,0x192));var _0x373b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x73b3[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x373b('0x0'));var jayson=require('jayson/promise');var db=require(_0x373b('0x1'))['db'];var amiClient=jayson['client'][_0x373b('0x2')]({'port':0x232a});var routingClient=jayson[_0x373b('0x3')][_0x373b('0x2')]({'port':0x232c});function isAgentPaused(_0x4181ff,_0x5894e4){var _0x46752d=[_0x4181ff[_0x373b('0x4')],_0x4181ff[_0x373b('0x5')],_0x4181ff[_0x373b('0x6')],_0x4181ff[_0x373b('0x7')],_0x4181ff[_0x373b('0x8')],_0x4181ff[_0x373b('0x9')],_0x4181ff[_0x373b('0xa')]];if(!_0x5894e4)return _['every'](_0x46752d);var _0x11c055=_[_0x373b('0xb')](_0x46752d);return _0x11c055[_0x373b('0xc')]>0x0&&_0x11c055[_0x373b('0xc')]<_0x46752d[_0x373b('0xc')]?!![]:![];}function isIdle(_0x481544){return _0x481544==='idle'||_0x481544===_0x373b('0xd')||_0x481544===_0x373b('0xe')||_0x481544===_0x373b('0xf')||_[_0x373b('0x10')](_0x481544);}function isAgentIdle(_0x3e4033){if(_0x3e4033['voiceStatus']!=='idle'&&_0x3e4033[_0x373b('0x9')]){_0x3e4033[_0x373b('0x11')]=_0x373b('0x12');return![];}return _[_0x373b('0x13')]([_0x3e4033['chatStatus'],_0x3e4033[_0x373b('0x14')],_0x3e4033['mailStatus'],_0x3e4033[_0x373b('0x15')],_0x3e4033[_0x373b('0x16')],_0x3e4033[_0x373b('0x11')],_0x3e4033['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x373b('0x17')]('Agents',{})[_0x373b('0x18')](function(_0x43e195){if(_0x43e195[_0x373b('0x19')]){throw new Error(_0x373b('0x1a'));}var _0x83275b=_0x43e195['result'];return routingClient['request'](_0x373b('0x1b'),{})[_0x373b('0x18')](function(_0x3bcea8){if(_0x3bcea8[_0x373b('0x19')]){throw new Error(_0x373b('0x1c'));}var _0x36dd22=_0x3bcea8[_0x373b('0x1d')];return _['merge']({},_0x83275b,_0x36dd22);});})[_0x373b('0x1e')](function(_0x5b9fe3){throw _0x5b9fe3;});}exports[_0x373b('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x6f47ce){var _0x4d0fec=_0x373b('0xd');if(isAgentPaused(_0x6f47ce))_0x4d0fec='pause';else if(isAgentPaused(_0x6f47ce,!![]))_0x4d0fec=_0x373b('0x20');else if(isAgentIdle(_0x6f47ce))_0x4d0fec='idle';else _0x4d0fec=_0x373b('0x21');return _0x4d0fec;}exports[_0x373b('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x52004a,_0x57580e){var _0x43e6cd=_[_0x373b('0x23')](_0x52004a)?_0x52004a:[_0x52004a];var _0x1701b0=_[_0x373b('0x24')](_0x57580e)+_0x373b('0x25');var _0x291cce=_[_0x373b('0x26')](_0x43e6cd,function(_0x321d2d){return db[_0x1701b0][_0x373b('0x27')]({'where':{'id':_0x321d2d}})['then'](function(_0x315133){if(!_0x315133)return[];return _0x315133[_0x373b('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x373b('0x29')](_0x291cce)[_0x373b('0x18')](function(_0x29a415){var _0x449294=_(_0x29a415)[_0x373b('0x2a')]()[_0x373b('0x26')]('id')[_0x373b('0x2b')]()[_0x373b('0x2c')]();return _0x449294;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3fb854,_0x241130,_0x267cdf){try{if(_0x241130['length']>0x0){_0x3fb854=_0x3fb854[_0x373b('0xb')](function(_0x38fc06){return _0x241130[_0x373b('0x2d')](_0x38fc06['id']);});}var _0x380717=_0x3fb854[_0x373b('0xb')](function(_0x52b9ae){var _0x1b7898=_0x373b('0x21');if(isAgentIdle(_0x52b9ae)){_0x1b7898=_0x373b('0x2e');}return _0x1b7898===_0x267cdf;});return _[_0x373b('0x26')](_0x380717,'id');}catch(_0x3f7b11){throw _0x3f7b11;}}exports[_0x373b('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x56d491,_0x28d83b,_0x3c55b1){return Promise['resolve']()[_0x373b('0x18')](function(){if(_0x28d83b[_0x373b('0xc')]>0x0){_0x56d491=_0x56d491['filter'](function(_0x581d96){return _0x28d83b[_0x373b('0x2d')](_0x581d96['id']);});}return _0x56d491;})[_0x373b('0x18')](function(){return db['User'][_0x373b('0x30')]({'attributes':['id',_0x373b('0x31'),_0x373b('0x32'),_0x373b('0x4'),_0x373b('0x5'),_0x373b('0x6'),_0x373b('0x7'),_0x373b('0x8'),'voicePause',_0x373b('0xa'),_0x373b('0x33')],'where':{'id':{'$in':_[_0x373b('0x26')](_0x56d491,'id')}},'raw':!![]});})[_0x373b('0x18')](function(_0x51b298){return _0x51b298[_0x373b('0x26')](function(_0x38ce20){var _0x5dce2=_['find'](_0x56d491,['id',_0x38ce20['id']]);var _0x6fe678=filterAgentAttributes(_0x5dce2);_[_0x373b('0x34')](_0x38ce20,_0x6fe678);_0x38ce20[_0x373b('0x35')]=getAgentStatus(_0x38ce20);return _0x38ce20;});})[_0x373b('0x18')](function(_0x110254){var _0x58d766=sortAgentsByStatus(_0x110254,_0x3c55b1);return _[_0x373b('0x26')](_0x58d766,'id');})[_0x373b('0x1e')](function(_0x251331){throw _0x251331;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x12439a){var _0x949c2e={'fields':[],'order':null};var _0x105d03=_0x12439a[_0x373b('0x36')](',');_0x949c2e[_0x373b('0x37')]=_[_0x373b('0xb')](_0x105d03,function(_0x182893){if(!_0x182893[_0x373b('0x2d')]('globalStatus')){return!![];}_0x949c2e[_0x373b('0x38')]=_[_0x373b('0x39')](_0x182893,'-')?_0x373b('0x3a'):_0x373b('0x3b');return![];});return _0x949c2e;}exports[_0x373b('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x3fe3fc){if(_0x3fe3fc[_0x373b('0x2d')](_0x373b('0x32'))&&!_0x3fe3fc['includes']('internal')){var _0x2a49fa=_0x3fe3fc[_0x373b('0x3d')](0x0,_0x3fe3fc[_0x373b('0x3e')]('fullname'));_0x3fe3fc+=','+_0x2a49fa+_0x373b('0x3f');}return _0x3fe3fc;}exports[_0x373b('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x1a4205,_0x372f2e){var _0x351067=_0x1a4205[_0x373b('0x41')](function(_0xfcdbe6,_0x6f3b4c){if(_0xfcdbe6[_0x373b('0x35')]===_0x6f3b4c[_0x373b('0x35')]){if(_0xfcdbe6[_0x373b('0x35')]===_0x373b('0x12')){if(_0x372f2e==='DESC'){return(_0xfcdbe6[_0x373b('0x33')]||'')<(_0x6f3b4c['pauseType']||'')||_0xfcdbe6[_0x373b('0x32')][_0x373b('0x42')]()>_0x6f3b4c[_0x373b('0x32')][_0x373b('0x42')]()?0x1:-0x1;}else{return(_0xfcdbe6[_0x373b('0x33')]||'')<(_0x6f3b4c[_0x373b('0x33')]||'')||_0xfcdbe6[_0x373b('0x32')][_0x373b('0x42')]()>_0x6f3b4c[_0x373b('0x32')][_0x373b('0x42')]()?-0x1:0x1;}}else{if(_0x372f2e==='DESC'){return _0xfcdbe6['fullname'][_0x373b('0x42')]()<_0x6f3b4c['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0xfcdbe6[_0x373b('0x32')][_0x373b('0x42')]()<_0x6f3b4c['fullname'][_0x373b('0x42')]()?-0x1:0x1;}}}else{if(_0x372f2e==='DESC'){return _0xfcdbe6['globalStatus']<_0x6f3b4c[_0x373b('0x35')]?0x1:-0x1;}else{return _0xfcdbe6['globalStatus']<_0x6f3b4c[_0x373b('0x35')]?-0x1:0x1;}}});return _0x351067;}exports[_0x373b('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x2b1e10){var _0xb17acc=[_0x373b('0x44'),'online',_0x373b('0x45'),_0x373b('0x46'),_0x373b('0x33'),'lastPauseAt',_0x373b('0x3f'),_0x373b('0x47'),'chatPause',_0x373b('0x7'),_0x373b('0x6'),_0x373b('0x8'),_0x373b('0xa'),_0x373b('0x5'),_0x373b('0x9'),_0x373b('0x48'),_0x373b('0x49'),_0x373b('0x4a'),_0x373b('0x4b'),_0x373b('0x4c'),_0x373b('0x4d'),_0x373b('0x4e'),_0x373b('0x4f'),'mailCurrentCapacity',_0x373b('0x50'),_0x373b('0x51'),'faxCurrentCapacity',_0x373b('0x52'),_0x373b('0x15'),_0x373b('0x53'),_0x373b('0x16'),'whatsappStatus',_0x373b('0x14'),_0x373b('0x11'),_0x373b('0x54'),_0x373b('0x55'),_0x373b('0x56'),_0x373b('0x57'),_0x373b('0x58'),_0x373b('0x59'),_0x373b('0x5a'),_0x373b('0x5b'),'destconnectedlinenum',_0x373b('0x5c'),_0x373b('0x5d'),_0x373b('0x5e'),'routealias'];var _0x4e0828=[_0x373b('0x4'),_0x373b('0x7'),_0x373b('0x6'),_0x373b('0x8'),_0x373b('0xa'),_0x373b('0x5'),_0x373b('0x9'),'online'];var _0x1cd2bb=_(_0x2b1e10)[_0x373b('0x5f')](_0x4e0828)[_0x373b('0x60')](_0xb17acc)[_0x373b('0x2c')]();return _0x1cd2bb;}exports[_0x373b('0x61')]=filterAgentAttributes; \ No newline at end of file +var _0x598e=['pick','value','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','includes','resolve','User','findAll','name','fullname','mailPause','openchannelPause','pauseType','find','catch','split','fields','globalStatus','order','DESC','ASC','internal','substring','indexOf','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit'];(function(_0x543a99,_0x4c9cdf){var _0xac8270=function(_0x27fd73){while(--_0x27fd73){_0x543a99['push'](_0x543a99['shift']());}};_0xac8270(++_0x4c9cdf);}(_0x598e,0xc5));var _0xe598=function(_0x58a02d,_0x536812){_0x58a02d=_0x58a02d-0x0;var _0x1e4aa3=_0x598e[_0x58a02d];return _0x1e4aa3;};'use strict';var _=require(_0xe598('0x0'));var jayson=require(_0xe598('0x1'));var db=require(_0xe598('0x2'))['db'];var amiClient=jayson[_0xe598('0x3')][_0xe598('0x4')]({'port':0x232a});var routingClient=jayson[_0xe598('0x3')][_0xe598('0x4')]({'port':0x232c});function isAgentPaused(_0x271631,_0x53e5d7){var _0xfb2af5=[_0x271631[_0xe598('0x5')],_0x271631[_0xe598('0x6')],_0x271631['mailPause'],_0x271631['openchannelPause'],_0x271631[_0xe598('0x7')],_0x271631[_0xe598('0x8')],_0x271631[_0xe598('0x9')]];if(!_0x53e5d7)return _[_0xe598('0xa')](_0xfb2af5);var _0x33f41=_[_0xe598('0xb')](_0xfb2af5);return _0x33f41[_0xe598('0xc')]>0x0&&_0x33f41[_0xe598('0xc')]<_0xfb2af5[_0xe598('0xc')]?!![]:![];}function isIdle(_0x1d4045){return _0x1d4045==='idle'||_0x1d4045===_0xe598('0xd')||_0x1d4045===_0xe598('0xe')||_0x1d4045===_0xe598('0xf')||_[_0xe598('0x10')](_0x1d4045);}function isAgentIdle(_0x21cf80){if(_0x21cf80[_0xe598('0x11')]!==_0xe598('0x12')&&_0x21cf80[_0xe598('0x8')]){_0x21cf80[_0xe598('0x11')]=_0xe598('0x13');return![];}return _[_0xe598('0xa')]([_0x21cf80[_0xe598('0x14')],_0x21cf80['faxStatus'],_0x21cf80[_0xe598('0x15')],_0x21cf80[_0xe598('0x16')],_0x21cf80[_0xe598('0x17')],_0x21cf80[_0xe598('0x11')],_0x21cf80['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xe598('0x18'),{})[_0xe598('0x19')](function(_0x5dfa23){if(_0x5dfa23[_0xe598('0x1a')]){throw new Error(_0xe598('0x1b'));}var _0x1847f7=_0x5dfa23[_0xe598('0x1c')];return routingClient[_0xe598('0x1d')]('Agents',{})['then'](function(_0x18b355){if(_0x18b355[_0xe598('0x1a')]){throw new Error(_0xe598('0x1e'));}var _0x22a9cc=_0x18b355['result'];return _[_0xe598('0x1f')]({},_0x1847f7,_0x22a9cc);});})['catch'](function(_0x51fba6){throw _0x51fba6;});}exports[_0xe598('0x20')]=getRealtimeAgents;function getAgentStatus(_0x1d945f){var _0x33cf6f=_0xe598('0xd');if(isAgentPaused(_0x1d945f))_0x33cf6f=_0xe598('0x13');else if(isAgentPaused(_0x1d945f,!![]))_0x33cf6f=_0xe598('0x21');else if(isAgentIdle(_0x1d945f))_0x33cf6f=_0xe598('0x12');else _0x33cf6f=_0xe598('0x22');return _0x33cf6f;}exports[_0xe598('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x383bbd,_0x2f6dc0){var _0x24d501=_['isArray'](_0x383bbd)?_0x383bbd:[_0x383bbd];var _0x3d98ec=_[_0xe598('0x24')](_0x2f6dc0)+_0xe598('0x25');var _0x5a46ae=_[_0xe598('0x26')](_0x24d501,function(_0x5b7771){return db[_0x3d98ec][_0xe598('0x27')]({'where':{'id':_0x5b7771}})['then'](function(_0x230891){if(!_0x230891)return[];return _0x230891[_0xe598('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe598('0x29')](_0x5a46ae)[_0xe598('0x19')](function(_0x3c3f0d){var _0x493401=_(_0x3c3f0d)[_0xe598('0x2a')]()[_0xe598('0x26')]('id')['uniq']()['value']();return _0x493401;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4cc1ed,_0x224bc9,_0x4337cd){try{if(_0x224bc9[_0xe598('0xc')]>0x0){_0x4cc1ed=_0x4cc1ed[_0xe598('0xb')](function(_0x1a5c4b){return _0x224bc9[_0xe598('0x2b')](_0x1a5c4b['id']);});}var _0x1b1675=_0x4cc1ed[_0xe598('0xb')](function(_0x16940f){var _0x3d689a=_0xe598('0x22');if(isAgentIdle(_0x16940f)){_0x3d689a=_0xe598('0x12');}return _0x3d689a===_0x4337cd;});return _[_0xe598('0x26')](_0x1b1675,'id');}catch(_0x25f6d5){throw _0x25f6d5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1535af,_0x3e8cfd,_0x5e64c3){return Promise[_0xe598('0x2c')]()[_0xe598('0x19')](function(){if(_0x3e8cfd[_0xe598('0xc')]>0x0){_0x1535af=_0x1535af[_0xe598('0xb')](function(_0x401a82){return _0x3e8cfd['includes'](_0x401a82['id']);});}return _0x1535af;})['then'](function(){return db[_0xe598('0x2d')][_0xe598('0x2e')]({'attributes':['id',_0xe598('0x2f'),_0xe598('0x30'),_0xe598('0x5'),'faxPause',_0xe598('0x31'),_0xe598('0x32'),'smsPause',_0xe598('0x8'),_0xe598('0x9'),_0xe598('0x33')],'where':{'id':{'$in':_[_0xe598('0x26')](_0x1535af,'id')}},'raw':!![]});})['then'](function(_0xaced99){return _0xaced99['map'](function(_0x5147ac){var _0x407d8b=_[_0xe598('0x34')](_0x1535af,['id',_0x5147ac['id']]);var _0x5841a3=filterAgentAttributes(_0x407d8b);_['merge'](_0x5147ac,_0x5841a3);_0x5147ac['globalStatus']=getAgentStatus(_0x5147ac);return _0x5147ac;});})[_0xe598('0x19')](function(_0x1a2141){var _0xfab26e=sortAgentsByStatus(_0x1a2141,_0x5e64c3);return _['map'](_0xfab26e,'id');})[_0xe598('0x35')](function(_0x5ad0bf){throw _0x5ad0bf;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x47b066){var _0x5137c1={'fields':[],'order':null};var _0x3a639e=_0x47b066[_0xe598('0x36')](',');_0x5137c1[_0xe598('0x37')]=_[_0xe598('0xb')](_0x3a639e,function(_0x3c7024){if(!_0x3c7024[_0xe598('0x2b')](_0xe598('0x38'))){return!![];}_0x5137c1[_0xe598('0x39')]=_['startsWith'](_0x3c7024,'-')?_0xe598('0x3a'):_0xe598('0x3b');return![];});return _0x5137c1;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x160f3a){if(_0x160f3a['includes'](_0xe598('0x30'))&&!_0x160f3a['includes'](_0xe598('0x3c'))){var _0x206fc3=_0x160f3a[_0xe598('0x3d')](0x0,_0x160f3a[_0xe598('0x3e')](_0xe598('0x30')));_0x160f3a+=','+_0x206fc3+_0xe598('0x3c');}return _0x160f3a;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x5131b8,_0x57f960){var _0x1fe3ba=_0x5131b8['sort'](function(_0x2f28f9,_0x277739){if(_0x2f28f9[_0xe598('0x38')]===_0x277739[_0xe598('0x38')]){if(_0x2f28f9['globalStatus']===_0xe598('0x13')){if(_0x57f960===_0xe598('0x3a')){return(_0x2f28f9[_0xe598('0x33')]||'')<(_0x277739[_0xe598('0x33')]||'')||_0x2f28f9[_0xe598('0x30')][_0xe598('0x3f')]()>_0x277739[_0xe598('0x30')][_0xe598('0x3f')]()?0x1:-0x1;}else{return(_0x2f28f9[_0xe598('0x33')]||'')<(_0x277739[_0xe598('0x33')]||'')||_0x2f28f9[_0xe598('0x30')][_0xe598('0x3f')]()>_0x277739[_0xe598('0x30')][_0xe598('0x3f')]()?-0x1:0x1;}}else{if(_0x57f960===_0xe598('0x3a')){return _0x2f28f9['fullname'][_0xe598('0x3f')]()<_0x277739[_0xe598('0x30')][_0xe598('0x3f')]()?0x1:-0x1;}else{return _0x2f28f9['fullname'][_0xe598('0x3f')]()<_0x277739[_0xe598('0x30')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x57f960===_0xe598('0x3a')){return _0x2f28f9[_0xe598('0x38')]<_0x277739[_0xe598('0x38')]?0x1:-0x1;}else{return _0x2f28f9[_0xe598('0x38')]<_0x277739[_0xe598('0x38')]?-0x1:0x1;}}});return _0x1fe3ba;}exports[_0xe598('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x377bdc){var _0x2c3e23=['userpic',_0xe598('0x41'),_0xe598('0x42'),_0xe598('0x43'),'pauseType',_0xe598('0x43'),_0xe598('0x3c'),_0xe598('0x44'),_0xe598('0x5'),_0xe598('0x32'),_0xe598('0x31'),_0xe598('0x7'),_0xe598('0x9'),_0xe598('0x6'),_0xe598('0x8'),_0xe598('0x45'),_0xe598('0x46'),_0xe598('0x47'),_0xe598('0x48'),_0xe598('0x49'),_0xe598('0x4a'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xe598('0x4b'),_0xe598('0x4c'),_0xe598('0x4d'),_0xe598('0x4e'),_0xe598('0x14'),_0xe598('0x16'),_0xe598('0x15'),_0xe598('0x17'),'whatsappStatus',_0xe598('0x4f'),_0xe598('0x11'),_0xe598('0x50'),_0xe598('0x51'),_0xe598('0x52'),_0xe598('0x53'),_0xe598('0x54'),_0xe598('0x55'),_0xe598('0x56'),_0xe598('0x57'),_0xe598('0x58'),_0xe598('0x59'),_0xe598('0x5a'),_0xe598('0x5b'),_0xe598('0x5c')];var _0x25015e=[_0xe598('0x5'),'openchannelPause',_0xe598('0x31'),_0xe598('0x7'),'whatsappPause',_0xe598('0x6'),'voicePause',_0xe598('0x41')];var _0x1729e3=_(_0x377bdc)[_0xe598('0x5d')](_0x25015e)[_0xe598('0x5e')](_0x2c3e23)[_0xe598('0x5f')]();return _0x1729e3;}exports[_0xe598('0x60')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index d44ed12..e09dd10 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe09e=['inbound','outbound','concat','map','get','find','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues'];(function(_0x589cb8,_0x43929a){var _0x1f78d5=function(_0x55957b){while(--_0x55957b){_0x589cb8['push'](_0x589cb8['shift']());}};_0x1f78d5(++_0x43929a);}(_0xe09e,0xf9));var _0xee09=function(_0x428761,_0x24666d){_0x428761=_0x428761-0x0;var _0x10fea4=_0xe09e[_0x428761];return _0x10fea4;};'use strict';var _=require('lodash');var jayson=require(_0xee09('0x0'));var util=require(_0xee09('0x1'));var amiClient=jayson[_0xee09('0x2')][_0xee09('0x3')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xee09('0x4'),_0xee09('0x5'),_0xee09('0x6'),_0xee09('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xee09('0x8'),_0xee09('0x9'),'invalid',_0xee09('0xa'),_0xee09('0xb'),_0xee09('0xc'),'ringing',_0xee09('0xd'),_0xee09('0xe'),_0xee09('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0xee09('0x10'),'statusMessage',_0xee09('0x11'),_0xee09('0x12'),_0xee09('0x13'),_0xee09('0x14'),_0xee09('0x15'),_0xee09('0x16'),'erlangCallToSecond',_0xee09('0x17'),'erlangBusyFactor','dialPredictiveInterval',_0xee09('0x18'),_0xee09('0x19'),_0xee09('0x1a'),'predictiveIntervalTotalCalls',_0xee09('0x1b'),_0xee09('0x1c'),_0xee09('0x1d'),'predictiveIntervalAvgHoldtime',_0xee09('0x1e')];function getRealtimeQueues(_0x462c04,_0x2b9338){var _0xd7bf1c=_0x2b9338===_0xee09('0x1f')?amiClient:routingClient;return _0xd7bf1c[_0xee09('0x20')](_[_0xee09('0x21')](_0x2b9338)+_0xee09('0x22'),_0x462c04)[_0xee09('0x23')](function(_0x2bd12c){if(_0x2bd12c[_0xee09('0x24')])throw new Error(util['format'](_0xee09('0x25'),_0x2b9338));return _0x2bd12c['result'];})['catch'](function(_0x27e086){throw _0x27e086;});}exports[_0xee09('0x26')]=getRealtimeQueues;function initializeQueues(_0x4d1fef,_0x35e375,_0x366c6b,_0x3e0a76){var _0x324317=DEFAULT_QUEUE_ATTRIBUTES;if(_0x366c6b===_0xee09('0x1f')){if(_0x3e0a76===_0xee09('0x27')){_0x324317=_0x324317['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3e0a76===_0xee09('0x28')){_0x324317=_0x324317[_0xee09('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4d1fef[_0xee09('0x2a')](function(_0x3ed433){var _0x54398d=_0x3ed433[_0xee09('0x2b')]({'plain':!![]});_0x54398d[_0xee09('0x6')]=0x0;_0x54398d[_0xee09('0xa')]=0x0;_0x54398d['loggedIn']=0x0;_0x54398d['available']=0x0;_0x54398d[_0xee09('0x7')]=0x0;if(_0x366c6b===_0xee09('0x1f')){_0x54398d['talking']=0x0;_0x54398d['busy']=0x0;if(_0x3e0a76===_0xee09('0x28')){_0x54398d['pTalking']=0x0;_0x54398d['originated']=0x0;}}var _0x180576=_[_0xee09('0x2c')](_0x35e375,['id',_0x54398d['id']]);if(_0x180576){_[_0xee09('0x2d')](_0x54398d,_[_0xee09('0x2e')](_0x180576,_0x324317));}return _0x54398d;});}exports[_0xee09('0x2f')]=initializeQueues; \ No newline at end of file +var _0x22ad=['talking','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','then','catch','getRealtimeQueues','inbound','map','get','busy','outbound','pick','initializeQueues','lodash','client','http','available','paused','waiting','inUse','invalid','ringing'];(function(_0x47a8ff,_0x3ecdb1){var _0x1d02a7=function(_0x5b205b){while(--_0x5b205b){_0x47a8ff['push'](_0x47a8ff['shift']());}};_0x1d02a7(++_0x3ecdb1);}(_0x22ad,0x7b));var _0xd22a=function(_0x4147,_0x29c1ef){_0x4147=_0x4147-0x0;var _0x188606=_0x22ad[_0x4147];return _0x188606;};'use strict';var _=require(_0xd22a('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0xd22a('0x1')][_0xd22a('0x2')]({'port':0x232a});var routingClient=jayson[_0xd22a('0x1')][_0xd22a('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd22a('0x3'),'loggedIn',_0xd22a('0x4'),_0xd22a('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xd22a('0x6'),_0xd22a('0x7'),'loggedInDb','notInUse','onHold',_0xd22a('0x8'),'ringInUse',_0xd22a('0x9'),'unavailable',_0xd22a('0xa')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd22a('0xb'),_0xd22a('0xc'),_0xd22a('0xd'),_0xd22a('0xe'),_0xd22a('0xf'),'dialMethod',_0xd22a('0x10'),_0xd22a('0x11'),_0xd22a('0x12'),_0xd22a('0x13'),_0xd22a('0x14'),_0xd22a('0x15'),_0xd22a('0x16'),'dialPredictiveInterval',_0xd22a('0x17'),_0xd22a('0x18'),_0xd22a('0x19'),'predictiveIntervalTotalCalls',_0xd22a('0x1a'),_0xd22a('0x1b'),_0xd22a('0x1c'),_0xd22a('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x568e8b,_0xc36556){var _0x4bb864=_0xc36556===_0xd22a('0x1e')?amiClient:routingClient;return _0x4bb864[_0xd22a('0x1f')](_[_0xd22a('0x20')](_0xc36556)+_0xd22a('0x21'),_0x568e8b)[_0xd22a('0x22')](function(_0x406546){if(_0x406546['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xc36556));return _0x406546['result'];})[_0xd22a('0x23')](function(_0xa6b0e3){throw _0xa6b0e3;});}exports[_0xd22a('0x24')]=getRealtimeQueues;function initializeQueues(_0x4df3fb,_0x24dae4,_0x361724,_0x3ad12d){var _0x2d95d3=DEFAULT_QUEUE_ATTRIBUTES;if(_0x361724===_0xd22a('0x1e')){if(_0x3ad12d===_0xd22a('0x25')){_0x2d95d3=_0x2d95d3['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3ad12d==='outbound'){_0x2d95d3=_0x2d95d3['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4df3fb[_0xd22a('0x26')](function(_0x59b4fa){var _0x5d2f3=_0x59b4fa[_0xd22a('0x27')]({'plain':!![]});_0x5d2f3['paused']=0x0;_0x5d2f3['loggedInDb']=0x0;_0x5d2f3['loggedIn']=0x0;_0x5d2f3['available']=0x0;_0x5d2f3[_0xd22a('0x5')]=0x0;if(_0x361724===_0xd22a('0x1e')){_0x5d2f3[_0xd22a('0x9')]=0x0;_0x5d2f3[_0xd22a('0x28')]=0x0;if(_0x3ad12d===_0xd22a('0x29')){_0x5d2f3['pTalking']=0x0;_0x5d2f3['originated']=0x0;}}var _0x24c132=_['find'](_0x24dae4,['id',_0x5d2f3['id']]);if(_0x24c132){_['merge'](_0x5d2f3,_[_0xd22a('0x2a')](_0x24c132,_0x2d95d3));}return _0x5d2f3;});}exports[_0xd22a('0x2b')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 50e00d7..a9e8c29 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x41fe72,_0xaa8f97){var _0x717fdf=function(_0x294ed8){while(--_0x294ed8){_0x41fe72['push'](_0x41fe72['shift']());}};_0x717fdf(++_0xaa8f97);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 8863228..d149709 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 _0x1a1c=['internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','join','md5','update','digest','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','crypto','execSync','../environment','orderBy','keys','length','IPv4'];(function(_0xaea831,_0x177ba8){var _0x39bb0a=function(_0x401f58){while(--_0x401f58){_0xaea831['push'](_0xaea831['shift']());}};_0x39bb0a(++_0x177ba8);}(_0x1a1c,0x16d));var _0xc1a1=function(_0xce61ec,_0x43f9ba){_0xce61ec=_0xce61ec-0x0;var _0x348d12=_0x1a1c[_0xce61ec];return _0x348d12;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xc1a1('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xc1a1('0x1')];var config=require(_0xc1a1('0x2'));function getInterfaces(){var _0x1f0a5a=[];var _0x1a1419=os['networkInterfaces']();var _0x25c815=_[_0xc1a1('0x3')](_[_0xc1a1('0x4')](_0x1a1419));for(var _0xd0f1d7=0x0;_0xd0f1d7<_0x25c815[_0xc1a1('0x5')];_0xd0f1d7++){var _0xb90024=_0x1a1419[_0x25c815[_0xd0f1d7]]['filter'](function(_0x3eb8ad){return _0x3eb8ad['family']===_0xc1a1('0x6')&&_0x3eb8ad[_0xc1a1('0x7')]===![];});_0x1f0a5a=_0x1f0a5a[_0xc1a1('0x8')](_0xb90024);}return _0x1f0a5a;}function getFirstInterface(){var _0x177397=_[_0xc1a1('0x9')](getInterfaces());return{'macAddress':_0x177397&&_0x177397[_0xc1a1('0xa')]?_0x177397[_0xc1a1('0xa')]:_0xc1a1('0xb'),'ipAddress':_0x177397&&_0x177397[_0xc1a1('0xc')]?_0x177397[_0xc1a1('0xc')]:'127.0.0.1'};}exports[_0xc1a1('0xd')]=getFirstInterface;function getCPUhash(){var _0x306e07=_[_0xc1a1('0x3')](os['cpus']()[_0xc1a1('0xe')](function(_0x57f4e4){return _0x57f4e4[_0xc1a1('0xf')];}))[_0xc1a1('0x10')](':');return crypto['createHash'](_0xc1a1('0x11'))[_0xc1a1('0x12')](_0x306e07)[_0xc1a1('0x13')]('hex');}exports['getUuid']=function(){var _0x140f60=os[_0xc1a1('0x14')]();var _0x461ca5=/[0-9a-f-]{36}/;if(config[_0xc1a1('0x15')]&&_0x461ca5[_0xc1a1('0x16')](config[_0xc1a1('0x15')])){return config[_0xc1a1('0x15')];}else if(_0x140f60==='win32'){return exec(_0xc1a1('0x17'),{'encoding':_0xc1a1('0x18')})[_0xc1a1('0x19')]('\x0d\x0a','');}else{var _0x5e8bad=getFirstInterface();var _0x30f267=getCPUhash();var _0x95f61b=_0x30f267+'|'+os[_0xc1a1('0x1a')]()+'|'+_0x5e8bad[_0xc1a1('0x1b')]+'|'+_0x5e8bad[_0xc1a1('0x1c')];var _0x23772b=crypto['createHash'](_0xc1a1('0x11'))[_0xc1a1('0x12')](_0x95f61b)[_0xc1a1('0x13')](_0xc1a1('0x1d'));return _0x23772b['substring'](0x0,0x8)+'-'+_0x23772b[_0xc1a1('0x1e')](0x8,0xc)+'-'+_0x23772b[_0xc1a1('0x1e')](0xc,0x10)+'-'+_0x23772b['substring'](0x10,0x14)+'-'+_0x23772b[_0xc1a1('0x1e')](0x14);}}; \ No newline at end of file +var _0xa784=['dmidecode\x20--string\x20system-uuid','hostname','macAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','hex','getUuid','platform','licenseToken'];(function(_0x5046f0,_0x143f3c){var _0x423c81=function(_0xb2bc31){while(--_0xb2bc31){_0x5046f0['push'](_0x5046f0['shift']());}};_0x423c81(++_0x143f3c);}(_0xa784,0x115));var _0x4a78=function(_0x4426fa,_0x4affcf){_0x4426fa=_0x4426fa-0x0;var _0x3f6280=_0xa784[_0x4426fa];return _0x3f6280;};'use strict';var _=require(_0x4a78('0x0'));var os=require('os');var crypto=require(_0x4a78('0x1'));var machine=require(_0x4a78('0x2'));var exec=require('child_process')[_0x4a78('0x3')];var config=require(_0x4a78('0x4'));function getInterfaces(){var _0x5aae79=[];var _0x2e8abd=os[_0x4a78('0x5')]();var _0x47fd05=_['orderBy'](_[_0x4a78('0x6')](_0x2e8abd));for(var _0x40405e=0x0;_0x40405e<_0x47fd05['length'];_0x40405e++){var _0x5bc533=_0x2e8abd[_0x47fd05[_0x40405e]][_0x4a78('0x7')](function(_0x63324){return _0x63324[_0x4a78('0x8')]===_0x4a78('0x9')&&_0x63324[_0x4a78('0xa')]===![];});_0x5aae79=_0x5aae79[_0x4a78('0xb')](_0x5bc533);}return _0x5aae79;}function getFirstInterface(){var _0x522cd=_[_0x4a78('0xc')](getInterfaces());return{'macAddress':_0x522cd&&_0x522cd['mac']?_0x522cd[_0x4a78('0xd')]:_0x4a78('0xe'),'ipAddress':_0x522cd&&_0x522cd[_0x4a78('0xf')]?_0x522cd['address']:'127.0.0.1'};}exports[_0x4a78('0x10')]=getFirstInterface;function getCPUhash(){var _0x781bf3=_[_0x4a78('0x11')](os[_0x4a78('0x12')]()[_0x4a78('0x13')](function(_0x5e5c91){return _0x5e5c91[_0x4a78('0x14')];}))[_0x4a78('0x15')](':');return crypto['createHash'](_0x4a78('0x16'))[_0x4a78('0x17')](_0x781bf3)[_0x4a78('0x18')](_0x4a78('0x19'));}exports[_0x4a78('0x1a')]=function(){var _0x1b1180=os[_0x4a78('0x1b')]();var _0xe8e712=/[0-9a-f-]{36}/;if(config[_0x4a78('0x1c')]&&_0xe8e712['test'](config['licenseToken'])){return config['licenseToken'];}else if(_0x1b1180==='win32'){return exec(_0x4a78('0x1d'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x396331=getFirstInterface();var _0x41b774=getCPUhash();var _0x5579a4=_0x41b774+'|'+os[_0x4a78('0x1e')]()+'|'+_0x396331[_0x4a78('0x1f')]+'|'+_0x396331['ipAddress'];var _0x14a6e4=crypto[_0x4a78('0x20')](_0x4a78('0x16'))['update'](_0x5579a4)[_0x4a78('0x18')](_0x4a78('0x19'));return _0x14a6e4['substring'](0x0,0x8)+'-'+_0x14a6e4[_0x4a78('0x21')](0x8,0xc)+'-'+_0x14a6e4['substring'](0xc,0x10)+'-'+_0x14a6e4[_0x4a78('0x21')](0x10,0x14)+'-'+_0x14a6e4['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f2dcbaa..ce612b6 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 _0xf61d=['error','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s'];(function(_0x55dc75,_0x19b20c){var _0x451043=function(_0x4ddc2d){while(--_0x4ddc2d){_0x55dc75['push'](_0x55dc75['shift']());}};_0x451043(++_0x19b20c);}(_0xf61d,0xf8));var _0xdf61=function(_0x49c6cc,_0x308bdb){_0x49c6cc=_0x49c6cc-0x0;var _0x22e239=_0xf61d[_0x49c6cc];return _0x22e239;};'use strict';var util=require(_0xdf61('0x0'));var moment=require(_0xdf61('0x1'));var rp=require('request-promise');var BPromise=require(_0xdf61('0x2'));var pkginfo=require(_0xdf61('0x3'))(module,'version');var db=require(_0xdf61('0x4'))['db'];var encryptor=require(_0xdf61('0x5'));var hardware=require(_0xdf61('0x6'));var logger=require(_0xdf61('0x7'))('license');var HOST=_0xdf61('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2d0e92){return new BPromise(function(_0x4c9554,_0x1cb079){var _0x13ea49=util['format'](_0xdf61('0x9'),HOST,_0x2d0e92,module[_0xdf61('0xa')][_0xdf61('0xb')]);if(oldToken){_0x13ea49=util[_0xdf61('0xc')](_0xdf61('0xd'),HOST,_0x2d0e92,module[_0xdf61('0xa')][_0xdf61('0xb')],oldToken);}var _0x392d05={'uri':_0x13ea49,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x392d05)[_0xdf61('0xe')](function(_0x46b912){_0x4c9554(_0x46b912);})[_0xdf61('0xf')](function(_0x5d6200){_0x1cb079(_0x5d6200);});});}function manageLicense(_0x572587,_0x53f671){var _0x13f915=_0x53f671[_0xdf61('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x13f915[_0xdf61('0x11')]!==_0x572587&&!_0x13f915[_0xdf61('0x12')]){oldToken=_0x13f915[_0xdf61('0x11')];}httpRequest(_0x572587)['then'](function(_0x36d0a6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x36d0a6['active']){isOldTokenSent=![];if(!_0x13f915[_0xdf61('0x13')]&&_0x13f915['license']!=_0x36d0a6[_0xdf61('0x13')]||_0x13f915[_0xdf61('0x13')]&&_0x13f915['data2']){logger['info'](_0xdf61('0x14'));}if(_0x13f915[_0xdf61('0x13')]&&!_0x13f915['data2']&&_0x13f915['license']!=_0x36d0a6[_0xdf61('0x13')]){logger[_0xdf61('0x15')](_0xdf61('0x16'));}if(_0x13f915[_0xdf61('0x13')]&&!_0x13f915[_0xdf61('0x12')]&&_0x13f915[_0xdf61('0x13')]==_0x36d0a6[_0xdf61('0x13')]){return _0x53f671;}return _0x53f671[_0xdf61('0x17')]({'data1':_0x572587,'data2':null,'license':_0x36d0a6['license']});}else{if(_0x36d0a6[_0xdf61('0x13')]||_0x13f915[_0xdf61('0x13')]){if(!_0x13f915['data2']){if(_0x13f915[_0xdf61('0x11')]==_0x572587){GRAY_PERIOD_REASON=_0xdf61('0x18');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xdf61('0x19');logger['info'](_0xdf61('0x1a'),_0x13f915[_0xdf61('0x11')],_0x572587);}logger[_0xdf61('0x15')](_0xdf61('0x1b'),GRAY_PERIOD_REASON[_0xdf61('0x1c')](),moment()[_0xdf61('0xc')](_0xdf61('0x1d')));return _0x53f671[_0xdf61('0x17')]({'data2':encryptor['encryptString'](moment()[_0xdf61('0xc')](_0xdf61('0x1d')))});}else{if(moment()[_0xdf61('0x1e')](encryptor['decryptString'](_0x13f915[_0xdf61('0x12')]),'days')>DAYS){logger[_0xdf61('0x15')](_0xdf61('0x1f'),moment()[_0xdf61('0xc')](_0xdf61('0x1d')));isOldTokenSent=![];return _0x53f671[_0xdf61('0x17')]({'data1':_0x572587,'data2':null,'license':null});}}}else{if(_0x13f915[_0xdf61('0x11')]!=_0x572587){logger[_0xdf61('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x13f915[_0xdf61('0x11')],_0x572587);return _0x53f671['update']({'data1':_0x572587,'data2':null,'license':null});}}}return _0x53f671;})[_0xdf61('0xe')](function(_0x5f3225){_0x53f671=_0x5f3225;})[_0xdf61('0xf')](function(_0x10c03e){logger[_0xdf61('0x20')](_0x10c03e['message']);})[_0xdf61('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xdf61('0x22')](),_0x53f671);},TIME);});}function defaultLicense(){var _0x405cdf=hardware[_0xdf61('0x22')]();if(_0x405cdf){return db[_0xdf61('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x405cdf}})[_0xdf61('0x24')](function(_0x567e4c,_0x3ef8f4){logger['info'](_0xdf61('0x25'),_0x405cdf);manageLicense(_0x405cdf,_0x567e4c);})[_0xdf61('0xf')](function(_0x305099){logger[_0xdf61('0x20')](_0x305099[_0xdf61('0x26')]);});}}exports[_0xdf61('0x27')]=defaultLicense; \ No newline at end of file +var _0xb06d=['util','bluebird','version','../../components/encryptor','./hardware','../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','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x4c8a33,_0x1aef86){var _0xc2224c=function(_0x5f049a){while(--_0x5f049a){_0x4c8a33['push'](_0x4c8a33['shift']());}};_0xc2224c(++_0x1aef86);}(_0xb06d,0x1ee));var _0xdb06=function(_0x39ee89,_0x249960){_0x39ee89=_0x39ee89-0x0;var _0x2065ec=_0xb06d[_0x39ee89];return _0x2065ec;};'use strict';var util=require(_0xdb06('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xdb06('0x1'));var pkginfo=require('pkginfo')(module,_0xdb06('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xdb06('0x3'));var hardware=require(_0xdb06('0x4'));var logger=require(_0xdb06('0x5'))('license');var HOST=_0xdb06('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc77c48){return new BPromise(function(_0x25a767,_0x5264cd){var _0xa0bc05=util[_0xdb06('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0xc77c48,module[_0xdb06('0x8')][_0xdb06('0x2')]);if(oldToken){_0xa0bc05=util[_0xdb06('0x7')](_0xdb06('0x9'),HOST,_0xc77c48,module['exports'][_0xdb06('0x2')],oldToken);}var _0xe585dd={'uri':_0xa0bc05,'method':_0xdb06('0xa'),'timeout':0xea60,'json':!![]};return rp(_0xe585dd)['then'](function(_0x8d7c00){_0x25a767(_0x8d7c00);})[_0xdb06('0xb')](function(_0x4b6138){_0x5264cd(_0x4b6138);});});}function manageLicense(_0x4c00ae,_0x45072c){var _0x314b62=_0x45072c[_0xdb06('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x314b62[_0xdb06('0xd')]!==_0x4c00ae&&!_0x314b62[_0xdb06('0xe')]){oldToken=_0x314b62['data1'];}httpRequest(_0x4c00ae)[_0xdb06('0xf')](function(_0x3651f1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3651f1[_0xdb06('0x10')]){isOldTokenSent=![];if(!_0x314b62[_0xdb06('0x11')]&&_0x314b62['license']!=_0x3651f1[_0xdb06('0x11')]||_0x314b62[_0xdb06('0x11')]&&_0x314b62['data2']){logger[_0xdb06('0x12')](_0xdb06('0x13'));}if(_0x314b62['license']&&!_0x314b62[_0xdb06('0xe')]&&_0x314b62[_0xdb06('0x11')]!=_0x3651f1[_0xdb06('0x11')]){logger[_0xdb06('0x12')](_0xdb06('0x14'));}if(_0x314b62[_0xdb06('0x11')]&&!_0x314b62[_0xdb06('0xe')]&&_0x314b62[_0xdb06('0x11')]==_0x3651f1[_0xdb06('0x11')]){return _0x45072c;}return _0x45072c[_0xdb06('0x15')]({'data1':_0x4c00ae,'data2':null,'license':_0x3651f1['license']});}else{if(_0x3651f1[_0xdb06('0x11')]||_0x314b62[_0xdb06('0x11')]){if(!_0x314b62[_0xdb06('0xe')]){if(_0x314b62[_0xdb06('0xd')]==_0x4c00ae){GRAY_PERIOD_REASON=_0xdb06('0x16');logger[_0xdb06('0x12')](_0xdb06('0x17'));}else{GRAY_PERIOD_REASON=_0xdb06('0x18');logger[_0xdb06('0x12')](_0xdb06('0x19'),_0x314b62[_0xdb06('0xd')],_0x4c00ae);}logger[_0xdb06('0x12')](_0xdb06('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xdb06('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x45072c[_0xdb06('0x15')]({'data2':encryptor['encryptString'](moment()[_0xdb06('0x7')](_0xdb06('0x1b')))});}else{if(moment()[_0xdb06('0x1c')](encryptor[_0xdb06('0x1d')](_0x314b62[_0xdb06('0xe')]),'days')>DAYS){logger[_0xdb06('0x12')](_0xdb06('0x1e'),moment()[_0xdb06('0x7')](_0xdb06('0x1b')));isOldTokenSent=![];return _0x45072c[_0xdb06('0x15')]({'data1':_0x4c00ae,'data2':null,'license':null});}}}else{if(_0x314b62[_0xdb06('0xd')]!=_0x4c00ae){logger['info'](_0xdb06('0x19'),_0x314b62[_0xdb06('0xd')],_0x4c00ae);return _0x45072c[_0xdb06('0x15')]({'data1':_0x4c00ae,'data2':null,'license':null});}}}return _0x45072c;})[_0xdb06('0xf')](function(_0xddfc14){_0x45072c=_0xddfc14;})[_0xdb06('0xb')](function(_0xad8581){logger[_0xdb06('0x1f')](_0xad8581[_0xdb06('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x45072c);},TIME);});}function defaultLicense(){var _0x3789a0=hardware[_0xdb06('0x21')]();if(_0x3789a0){return db['License'][_0xdb06('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x3789a0}})[_0xdb06('0x23')](function(_0x5ce167,_0x1254ff){logger[_0xdb06('0x12')](_0xdb06('0x24'),_0x3789a0);manageLicense(_0x3789a0,_0x5ce167);})['catch'](function(_0x106e19){logger[_0xdb06('0x1f')](_0x106e19[_0xdb06('0x20')]);});}}exports[_0xdb06('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 304ba85..8b1a750 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 _0x4179=['./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','defaults','then','catch','uuid','license','isEmpty','data1','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','message','findAll','role','COUNT','sequelize','col','admin','user','telephone','users','telephones','forEach','count','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird'];(function(_0x39600c,_0x2227af){var _0x12bc11=function(_0x18fd87){while(--_0x18fd87){_0x39600c['push'](_0x39600c['shift']());}};_0x12bc11(++_0x2227af);}(_0x4179,0x89));var _0x9417=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x4179[_0x350182];return _0x4a0892;};'use strict';var util=require(_0x9417('0x0'));var _=require(_0x9417('0x1'));var moment=require(_0x9417('0x2'));var BPromise=require(_0x9417('0x3'));var hardware=require(_0x9417('0x4'));var encryptor=require(_0x9417('0x5'));var db=require(_0x9417('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9417('0x7'),'machineUuid':hardware[_0x9417('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9417('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9417('0xa'),'machineUuid':hardware[_0x9417('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21e653){return new BPromise(function(_0x7da408,_0x3b000c){return db['License'][_0x9417('0xb')](_[_0x9417('0xc')](_0x21e653,{'raw':!![],'where':{'id':0x1}}))[_0x9417('0xd')](function(_0x24e9c9){return checkLicense(_0x24e9c9,null);})['then'](function(_0x2f6a0a){_0x7da408(_0x2f6a0a);return;})[_0x9417('0xe')](function(_0x5170cc){_0x3b000c(_0x5170cc);});});}function checkLicense(_0x18f1d2,_0x3abebf){if(!_0x18f1d2){demoLicense[_0x9417('0xf')]=_0x18f1d2['data1'];return demoLicense;}try{var _0x1d9a95=_0x3abebf||_0x18f1d2[_0x9417('0x10')];if(_[_0x9417('0x11')](_0x1d9a95)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1cef19=_0x18f1d2[_0x9417('0x12')];var _0x5d9c0f=_0x18f1d2['data2'];var _0x5092a0=_0x1cef19[_0x9417('0x13')]('-')[0x4];var _0x127296=_0x1cef19['split']('-')[0x0];var _0x37e643=encryptor[_0x9417('0x14')](_0x1d9a95,util[_0x9417('0x15')](_0x9417('0x16'),_0x5092a0,_0x1cef19,_0x127296));var _0x115bac=JSON[_0x9417('0x17')](_0x37e643);_0x115bac[_0x9417('0x18')]=![];_0x115bac['uuid']=_0x1cef19;_0x115bac[_0x9417('0x19')]=hardware[_0x9417('0x8')]();if(_0x5d9c0f){var _0x3ef276=encryptor[_0x9417('0x14')](_0x5d9c0f);_0x115bac['gray']=_0x3ef276;_0x115bac[_0x9417('0x1a')]=moment(_0x3ef276)[_0x9417('0x1b')](0x7,_0x9417('0x1c'))['format']();_0x115bac[_0x9417('0x1d')]=_0x115bac['uuid']!=_0x115bac[_0x9417('0x19')]?'changed':'disabled';}return _0x115bac;}catch(_0x41aa5d){breakingLicense[_0x9417('0xf')]=_0x18f1d2[_0x9417('0x12')];breakingLicense[_0x9417('0x1e')]=_0x41aa5d[_0x9417('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xfec5c2,_0x5aeb6d){getLicense()[_0x9417('0xd')](function(_0x1c97ee){return db['User'][_0x9417('0x1f')]({'attributes':[_0x9417('0x20'),[db['sequelize']['fn'](_0x9417('0x21'),db[_0x9417('0x22')][_0x9417('0x23')](_0x9417('0x20'))),'count']],'group':_0x9417('0x20'),'where':{'role':{'$or':[_0x9417('0x24'),_0x9417('0x25'),_0x9417('0x26')]}},'raw':!![]})[_0x9417('0xd')](function(_0x4b222c){var _0xe27e8d={'user':_0x1c97ee[_0x9417('0x27')]||0x0,'telephone':_0x1c97ee[_0x9417('0x28')]||0x0};_0x4b222c[_0x9417('0x29')](function(_0x4c2c4e){var _0x1504e6=_0x4c2c4e[_0x9417('0x20')]===_0x9417('0x24')?_0x9417('0x25'):_0x4c2c4e[_0x9417('0x20')];_0xe27e8d[_0x1504e6]-=_0x4c2c4e[_0x9417('0x2a')];if(_0xe27e8d[_0x1504e6]<0x0)_0xe27e8d[_0x1504e6]=0x0;});_0xfec5c2(_0xe27e8d);return;});})['catch'](function(_0x5e3dd4){_0x5aeb6d(_0x5e3dd4);});});}function checkUserLimits(_0x3b3fad){return new BPromise(function(_0xce62d6,_0xe84b1c){getLimits()['then'](function(_0x54ecd9){var _0x12d44f=_['pick'](_[_0x9417('0x2b')](_0x3b3fad,_0x9417('0x20')),[_0x9417('0x24'),_0x9417('0x25'),_0x9417('0x26')]);var _0x265cf5=(_0x12d44f[_0x9417('0x24')]||0x0)+(_0x12d44f[_0x9417('0x25')]||0x0);var _0xabde2c=_0x12d44f[_0x9417('0x26')]||0x0;if(_0x265cf5>_0x54ecd9[_0x9417('0x25')])return _0xe84b1c(_0x9417('0x2c'));if(_0xabde2c>_0x54ecd9[_0x9417('0x26')])return _0xe84b1c(_0x9417('0x2d'));return _0xce62d6();})[_0x9417('0xe')](function(_0x2d3f0e){_0xe84b1c(_0x2d3f0e);});});}module[_0x9417('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4f1b=['telephone','users','telephones','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','role','sequelize','col','count','user'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x4f1b,0xe9));var _0xb4f1=function(_0x36e4c3,_0x14142c){_0x36e4c3=_0x36e4c3-0x0;var _0x493260=_0x4f1b[_0x36e4c3];return _0x493260;};'use strict';var util=require(_0xb4f1('0x0'));var _=require('lodash');var moment=require(_0xb4f1('0x1'));var BPromise=require(_0xb4f1('0x2'));var hardware=require('./hardware');var encryptor=require(_0xb4f1('0x3'));var db=require(_0xb4f1('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb4f1('0x5'),'machineUuid':hardware[_0xb4f1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb4f1('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb4f1('0x8'),'machineUuid':hardware[_0xb4f1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x172880){return new BPromise(function(_0x38f444,_0x553c30){return db['License'][_0xb4f1('0x9')](_[_0xb4f1('0xa')](_0x172880,{'raw':!![],'where':{'id':0x1}}))[_0xb4f1('0xb')](function(_0xf386d7){return checkLicense(_0xf386d7,null);})[_0xb4f1('0xb')](function(_0x4b7e3d){_0x38f444(_0x4b7e3d);return;})[_0xb4f1('0xc')](function(_0x598530){_0x553c30(_0x598530);});});}function checkLicense(_0x49469f,_0x429cc1){if(!_0x49469f){demoLicense[_0xb4f1('0xd')]=_0x49469f[_0xb4f1('0xe')];return demoLicense;}try{var _0xa88690=_0x429cc1||_0x49469f[_0xb4f1('0xf')];if(_[_0xb4f1('0x10')](_0xa88690)){throw new Error(_0xb4f1('0x11'));}var _0x151f7f=_0x49469f[_0xb4f1('0xe')];var _0x529ccf=_0x49469f[_0xb4f1('0x12')];var _0x4474a8=_0x151f7f[_0xb4f1('0x13')]('-')[0x4];var _0x3593c5=_0x151f7f[_0xb4f1('0x13')]('-')[0x0];var _0x43a8a0=encryptor[_0xb4f1('0x14')](_0xa88690,util[_0xb4f1('0x15')]('%s:%s:%s',_0x4474a8,_0x151f7f,_0x3593c5));var _0x1ff8d0=JSON[_0xb4f1('0x16')](_0x43a8a0);_0x1ff8d0['demo']=![];_0x1ff8d0[_0xb4f1('0xd')]=_0x151f7f;_0x1ff8d0[_0xb4f1('0x17')]=hardware['getUuid']();if(_0x529ccf){var _0x3d6f08=encryptor[_0xb4f1('0x14')](_0x529ccf);_0x1ff8d0[_0xb4f1('0x18')]=_0x3d6f08;_0x1ff8d0['deadline']=moment(_0x3d6f08)[_0xb4f1('0x19')](0x7,_0xb4f1('0x1a'))['format']();_0x1ff8d0[_0xb4f1('0x1b')]=_0x1ff8d0[_0xb4f1('0xd')]!=_0x1ff8d0[_0xb4f1('0x17')]?_0xb4f1('0x1c'):_0xb4f1('0x1d');}return _0x1ff8d0;}catch(_0xd4bf17){breakingLicense[_0xb4f1('0xd')]=_0x49469f['data1'];breakingLicense[_0xb4f1('0x1e')]=_0xd4bf17[_0xb4f1('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4bd593,_0x52eec6){getLicense()[_0xb4f1('0xb')](function(_0x130038){return db[_0xb4f1('0x1f')]['findAll']({'attributes':[_0xb4f1('0x20'),[db[_0xb4f1('0x21')]['fn']('COUNT',db[_0xb4f1('0x21')][_0xb4f1('0x22')](_0xb4f1('0x20'))),_0xb4f1('0x23')]],'group':_0xb4f1('0x20'),'where':{'role':{'$or':['admin',_0xb4f1('0x24'),_0xb4f1('0x25')]}},'raw':!![]})[_0xb4f1('0xb')](function(_0x5c6f09){var _0xc5ed97={'user':_0x130038[_0xb4f1('0x26')]||0x0,'telephone':_0x130038[_0xb4f1('0x27')]||0x0};_0x5c6f09['forEach'](function(_0x1993b3){var _0x2c5ed5=_0x1993b3[_0xb4f1('0x20')]===_0xb4f1('0x28')?_0xb4f1('0x24'):_0x1993b3[_0xb4f1('0x20')];_0xc5ed97[_0x2c5ed5]-=_0x1993b3[_0xb4f1('0x23')];if(_0xc5ed97[_0x2c5ed5]<0x0)_0xc5ed97[_0x2c5ed5]=0x0;});_0x4bd593(_0xc5ed97);return;});})[_0xb4f1('0xc')](function(_0x41c12b){_0x52eec6(_0x41c12b);});});}function checkUserLimits(_0x7f60cc){return new BPromise(function(_0x532aa7,_0x3d81dc){getLimits()[_0xb4f1('0xb')](function(_0x2c5558){var _0x4d759a=_[_0xb4f1('0x29')](_[_0xb4f1('0x2a')](_0x7f60cc,_0xb4f1('0x20')),[_0xb4f1('0x28'),_0xb4f1('0x24'),_0xb4f1('0x25')]);var _0x38a448=(_0x4d759a[_0xb4f1('0x28')]||0x0)+(_0x4d759a[_0xb4f1('0x24')]||0x0);var _0x355901=_0x4d759a['telephone']||0x0;if(_0x38a448>_0x2c5558[_0xb4f1('0x24')])return _0x3d81dc(_0xb4f1('0x2b'));if(_0x355901>_0x2c5558[_0xb4f1('0x25')])return _0x3d81dc(_0xb4f1('0x2c'));return _0x532aa7();})[_0xb4f1('0xc')](function(_0x541545){_0x3d81dc(_0x541545);});});}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 8b4e46c..b753480 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 _0x6d11=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x1798b4,_0x1fe5f3){var _0x775f8=function(_0x161451){while(--_0x161451){_0x1798b4['push'](_0x1798b4['shift']());}};_0x775f8(++_0x1fe5f3);}(_0x6d11,0xbf));var _0x16d1=function(_0x476d6e,_0x106b0f){_0x476d6e=_0x476d6e-0x0;var _0xeb9664=_0x6d11[_0x476d6e];return _0xeb9664;};'use strict';module[_0x16d1('0x0')]={'DOMAIN':_0x16d1('0x1'),'SESSION_SECRET':_0x16d1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x16d1('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x36ee=['myappanuglar-secret','secret'];(function(_0x5219b0,_0x2519f3){var _0x55b2b9=function(_0x178d27){while(--_0x178d27){_0x5219b0['push'](_0x5219b0['shift']());}};_0x55b2b9(++_0x2519f3);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 60f3c0f..4a02008 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f8e=['exports','../utils/loggers'];(function(_0x504548,_0x5d9f8e){var _0x5c62f6=function(_0x5e2bf9){while(--_0x5e2bf9){_0x504548['push'](_0x504548['shift']());}};_0x5c62f6(++_0x5d9f8e);}(_0x4f8e,0x1bd));var _0xe4f8=function(_0x581b73,_0x4fa43c){_0x581b73=_0x581b73-0x0;var _0x3ea0ec=_0x4f8e[_0x581b73];return _0x3ea0ec;};'use strict';var fileLogger=require(_0xe4f8('0x0'))['fileLogger'];module[_0xe4f8('0x1')]=fileLogger; \ No newline at end of file +var _0x63b1=['fileLogger','exports'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x63b1,0x170));var _0x163b=function(_0x336bfb,_0x3a0ae0){_0x336bfb=_0x336bfb-0x0;var _0x2552b4=_0x63b1[_0x336bfb];return _0x2552b4;};'use strict';var fileLogger=require('../utils/loggers')[_0x163b('0x0')];module[_0x163b('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 840c396..228d500 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 _0x453c=['../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../config/environment','resolve','join','root','legacy-libs','express'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x453c,0xe4));var _0xc453=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x453c[_0x419e17];return _0x1f2044;};'use strict';var path=require('path');var cfg=require(_0xc453('0x0'));var env={'NODE_PATH':path[_0xc453('0x1')](path[_0xc453('0x2')](cfg[_0xc453('0x3')],_0xc453('0x4')))};var pm2config={'apps':[{'name':_0xc453('0x5'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path['join'](__dirname,_0xc453('0x6')),'env':env},{'name':_0xc453('0x7'),'script':path[_0xc453('0x2')](__dirname,_0xc453('0x8')),'env':env},{'name':'email','script':path['join'](__dirname,_0xc453('0x9')),'env':env},{'name':_0xc453('0xa'),'script':path['join'](__dirname,_0xc453('0xb')),'env':env},{'name':_0xc453('0xc'),'script':path[_0xc453('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x9c5c=['../../services/xdr/index.js','../../config/environment','resolve','root','join','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c5c,0xfe));var _0xc9c5=function(_0x30f2ab,_0x22db97){_0x30f2ab=_0x30f2ab-0x0;var _0x3ca3a4=_0x9c5c[_0x30f2ab];return _0x3ca3a4;};'use strict';var path=require('path');var cfg=require(_0xc9c5('0x0'));var env={'NODE_PATH':path[_0xc9c5('0x1')](path['join'](cfg[_0xc9c5('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path[_0xc9c5('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0xc9c5('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0xc9c5('0x3')](__dirname,_0xc9c5('0x4')),'env':env},{'name':_0xc9c5('0x5'),'script':path['join'](__dirname,_0xc9c5('0x6')),'env':env},{'name':_0xc9c5('0x7'),'script':path[_0xc9c5('0x3')](__dirname,_0xc9c5('0x8')),'env':env},{'name':_0xc9c5('0x9'),'script':path[_0xc9c5('0x3')](__dirname,_0xc9c5('0xa')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 32ac71b..863e46e 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 _0x0926=['disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','then','stop'];(function(_0x46b75f,_0x3c6181){var _0xc5176d=function(_0x23e50e){while(--_0x23e50e){_0x46b75f['push'](_0x46b75f['shift']());}};_0xc5176d(++_0x3c6181);}(_0x0926,0x118));var _0x6092=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x0926[_0x179e11];return _0x549f04;};'use strict';var pm2=require(_0x6092('0x0'));var BPromise=require(_0x6092('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x510e8e,_0x4485a0){return pm2[_0x6092('0x2')](function(_0x152dbb){if(_0x152dbb){return _0x4485a0(_0x152dbb);}return _0x510e8e(_0x6092('0x3'));});});};exports['start']=function(_0x1e61e1){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x20dee1,_0x5ef543){return pm2['start'](_0x1e61e1,function(_0x18c29e,_0x365b5f){if(_0x18c29e){return _0x5ef543(_0x18c29e);}pm2['disconnect']();return _0x20dee1(_0x365b5f);});});});};exports['stop']=function(_0x1e6581){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x1149fa,_0x3d67e1){return pm2[_0x6092('0x5')](_0x1e6581,function(_0x3cf6d1,_0x477558){if(_0x3cf6d1){return _0x3d67e1(_0x3cf6d1);}pm2[_0x6092('0x6')]();return _0x1149fa(_0x477558);});});});};exports['restart']=function(_0x1dbd34){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x5db19f,_0x5e963e){return pm2[_0x6092('0x7')](_0x1dbd34,function(_0x1d6213,_0x2ac1ac){if(_0x1d6213){return _0x5e963e(_0x1d6213);}pm2[_0x6092('0x6')]();return _0x5db19f(_0x2ac1ac);});});});};exports[_0x6092('0x8')]=function(){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x342d16,_0x853781){return pm2[_0x6092('0x8')](function(_0x2da477,_0x15a573){if(_0x2da477){return _0x853781(_0x2da477);}pm2[_0x6092('0x6')]();return _0x342d16(_0x15a573);});});});};exports[_0x6092('0x9')]=function(_0x46b52c){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x56afc8,_0x2e34be){return pm2[_0x6092('0x9')](_0x46b52c,function(_0x1619b7,_0x19aa55){if(_0x1619b7){return _0x2e34be(_0x1619b7);}pm2[_0x6092('0x6')]();return _0x56afc8(_0x19aa55);});});});};exports[_0x6092('0xa')]=function(_0x1320ed){return connect()['then'](function(){return new BPromise(function(_0xf9c065,_0x1efa08){return pm2[_0x6092('0xa')](_0x1320ed,function(_0x4232f0,_0xfdf803){if(_0x4232f0){return _0x1efa08(_0x4232f0);}pm2[_0x6092('0x6')]();return _0xf9c065(_0xfdf803);});});});};exports['dump']=function(){return connect()[_0x6092('0x4')](function(){return new BPromise(function(_0x51683b,_0x25b059){return pm2[_0x6092('0xb')](function(_0x563fd7){if(_0x563fd7){return _0x25b059(_0x563fd7);}return _0x51683b(_0x6092('0xc'));});});});}; \ No newline at end of file +var _0xd071=['then','disconnect','stop','restart','list','describe','dump','saved','pm2','connect','start'];(function(_0x5bc0df,_0x4b6fbe){var _0x6cb2a2=function(_0x2ecefc){while(--_0x2ecefc){_0x5bc0df['push'](_0x5bc0df['shift']());}};_0x6cb2a2(++_0x4b6fbe);}(_0xd071,0x1ec));var _0x1d07=function(_0x71b921,_0x2fa3c2){_0x71b921=_0x71b921-0x0;var _0x120d49=_0xd071[_0x71b921];return _0x120d49;};'use strict';var pm2=require(_0x1d07('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x17c3c8,_0xffb4c9){return pm2[_0x1d07('0x1')](function(_0xd42844){if(_0xd42844){return _0xffb4c9(_0xd42844);}return _0x17c3c8('connected');});});};exports[_0x1d07('0x2')]=function(_0x1d581f){return connect()[_0x1d07('0x3')](function(){return new BPromise(function(_0x34e7ea,_0xfc7384){return pm2[_0x1d07('0x2')](_0x1d581f,function(_0x1b8908,_0x123bff){if(_0x1b8908){return _0xfc7384(_0x1b8908);}pm2[_0x1d07('0x4')]();return _0x34e7ea(_0x123bff);});});});};exports[_0x1d07('0x5')]=function(_0x401406){return connect()[_0x1d07('0x3')](function(){return new BPromise(function(_0x4afef7,_0x5aeafe){return pm2[_0x1d07('0x5')](_0x401406,function(_0x1b835f,_0x49220d){if(_0x1b835f){return _0x5aeafe(_0x1b835f);}pm2[_0x1d07('0x4')]();return _0x4afef7(_0x49220d);});});});};exports[_0x1d07('0x6')]=function(_0x463f8e){return connect()[_0x1d07('0x3')](function(){return new BPromise(function(_0x16ccc1,_0x57a448){return pm2[_0x1d07('0x6')](_0x463f8e,function(_0x3f88cf,_0x44d68c){if(_0x3f88cf){return _0x57a448(_0x3f88cf);}pm2[_0x1d07('0x4')]();return _0x16ccc1(_0x44d68c);});});});};exports[_0x1d07('0x7')]=function(){return connect()[_0x1d07('0x3')](function(){return new BPromise(function(_0x361472,_0x27933a){return pm2[_0x1d07('0x7')](function(_0x25413,_0xf95e8b){if(_0x25413){return _0x27933a(_0x25413);}pm2[_0x1d07('0x4')]();return _0x361472(_0xf95e8b);});});});};exports[_0x1d07('0x8')]=function(_0x50121f){return connect()['then'](function(){return new BPromise(function(_0x2ef0d8,_0x24b8a6){return pm2['describe'](_0x50121f,function(_0x418494,_0x4e03d9){if(_0x418494){return _0x24b8a6(_0x418494);}pm2['disconnect']();return _0x2ef0d8(_0x4e03d9);});});});};exports['delete']=function(_0x2afcc4){return connect()['then'](function(){return new BPromise(function(_0x586c1e,_0x108e60){return pm2['delete'](_0x2afcc4,function(_0x29776e,_0x2e1c60){if(_0x29776e){return _0x108e60(_0x29776e);}pm2[_0x1d07('0x4')]();return _0x586c1e(_0x2e1c60);});});});};exports[_0x1d07('0x9')]=function(){return connect()[_0x1d07('0x3')](function(){return new BPromise(function(_0x5ee268,_0x2b1ef9){return pm2['dump'](function(_0x633e26){if(_0x633e26){return _0x2b1ef9(_0x633e26);}return _0x5ee268(_0x1d07('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 97f6363..02d3c66 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 _0x0aa0=['../logger','schedule','redis','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../mysqldb'];(function(_0x500ae4,_0x109a37){var _0x11b498=function(_0x977167){while(--_0x977167){_0x500ae4['push'](_0x500ae4['shift']());}};_0x11b498(++_0x109a37);}(_0x0aa0,0x164));var _0x00aa=function(_0x2b9e48,_0x2e593c){_0x2b9e48=_0x2b9e48-0x0;var _0x440569=_0x0aa0[_0x2b9e48];return _0x440569;};'use strict';var _=require(_0x00aa('0x0'));var moment=require(_0x00aa('0x1'));var Redis=require(_0x00aa('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x00aa('0x3'))['db'];var logger=require(_0x00aa('0x4'))(_0x00aa('0x5'));config[_0x00aa('0x6')]=_['defaults'](config[_0x00aa('0x6')],{'host':_0x00aa('0x7'),'port':0x18eb});var io=require(_0x00aa('0x8'))(new Redis(config[_0x00aa('0x6')]));function closeInteractions(){var _0x3ceb08=0x0;var _0x31f349=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x00aa('0x9')],'where':{'id':0x1}})[_0x00aa('0xa')](function(_0x110245){_0x3ceb08=_0x110245[_0x00aa('0x9')];if(_0x3ceb08){return db[_0x00aa('0xb')][_0x00aa('0xc')]({'raw':!![],'attributes':['id',_0x00aa('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x00aa('0xe')](_0x110245[_0x00aa('0x9')],'minutes')}}});}else{return[];}})[_0x00aa('0xa')](function(_0x5a4b6b){if(_0x5a4b6b&&_0x5a4b6b[_0x00aa('0xf')]){_0x31f349=_[_0x00aa('0x10')](_0x5a4b6b||[],'id');logger[_0x00aa('0x11')](_0x00aa('0x12'),_0x31f349[_0x00aa('0x13')]());return db[_0x00aa('0xb')]['update']({'closeReason':_0x00aa('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x00aa('0x15')](_0x00aa('0x16'))},{'where':{'id':_0x31f349}});}})[_0x00aa('0xa')](function(){if(_0x31f349&&_0x31f349[_0x00aa('0xf')]){logger[_0x00aa('0x11')](_0x00aa('0x17'),_0x31f349[_0x00aa('0x13')]());for(var _0x52dec8=0x0;_0x52dec8<_0x31f349[_0x00aa('0xf')];_0x52dec8++){io[_0x00aa('0x18')](_0x00aa('0x19'),{'id':_0x31f349[_0x52dec8],'closed':!![]});}}})[_0x00aa('0x1a')](function(_0x56d34b){logger[_0x00aa('0x1b')](_0x00aa('0x1c'),_0x56d34b?util['inspect'](_0x56d34b,{'showHidden':![],'depth':null}):'');});}exports[_0x00aa('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7e5d=['subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x7e5d,0xa9));var _0xd7e5=function(_0x490ad0,_0x472ddb){_0x490ad0=_0x490ad0-0x0;var _0x129031=_0x7e5d[_0x490ad0];return _0x129031;};'use strict';var _=require(_0xd7e5('0x0'));var moment=require(_0xd7e5('0x1'));var Redis=require(_0xd7e5('0x2'));var util=require('util');var config=require(_0xd7e5('0x3'));var db=require(_0xd7e5('0x4'))['db'];var logger=require(_0xd7e5('0x5'))(_0xd7e5('0x6'));config['redis']=_[_0xd7e5('0x7')](config[_0xd7e5('0x8')],{'host':_0xd7e5('0x9'),'port':0x18eb});var io=require(_0xd7e5('0xa'))(new Redis(config[_0xd7e5('0x8')]));function closeInteractions(){var _0x2b7321=0x0;var _0x1c3acb=[];return db[_0xd7e5('0xb')][_0xd7e5('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd7e5('0xd')](function(_0x10eeb8){_0x2b7321=_0x10eeb8[_0xd7e5('0xe')];if(_0x2b7321){return db[_0xd7e5('0xf')]['findAll']({'raw':!![],'attributes':['id',_0xd7e5('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd7e5('0x11')](_0x10eeb8[_0xd7e5('0xe')],_0xd7e5('0x12'))}}});}else{return[];}})['then'](function(_0x103eda){if(_0x103eda&&_0x103eda[_0xd7e5('0x13')]){_0x1c3acb=_[_0xd7e5('0x14')](_0x103eda||[],'id');logger[_0xd7e5('0x15')](_0xd7e5('0x16'),_0x1c3acb[_0xd7e5('0x17')]());return db[_0xd7e5('0xf')][_0xd7e5('0x18')]({'closeReason':'system','disposition':_0xd7e5('0x19'),'closed':!![],'closedAt':moment()['format'](_0xd7e5('0x1a'))},{'where':{'id':_0x1c3acb}});}})['then'](function(){if(_0x1c3acb&&_0x1c3acb['length']){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1c3acb[_0xd7e5('0x17')]());for(var _0x274143=0x0;_0x274143<_0x1c3acb[_0xd7e5('0x13')];_0x274143++){io[_0xd7e5('0x1b')](_0xd7e5('0x1c'),{'id':_0x1c3acb[_0x274143],'closed':!![]});}}})['catch'](function(_0x3dcd92){logger[_0xd7e5('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3dcd92?util['inspect'](_0x3dcd92,{'showHidden':![],'depth':null}):'');});}exports[_0xd7e5('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 51cbe5a..432a159 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ac3=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0ac3,0x115));var _0x30ac=function(_0x3775e3,_0x159b92){_0x3775e3=_0x3775e3-0x0;var _0x265a20=_0x0ac3[_0x3775e3];return _0x265a20;};'use strict';function start(){var _0x3b77dc=require(_0x30ac('0x0'));return _0x3b77dc['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xf7a0=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x23086d,_0x308c2e){var _0xf0b81=function(_0x523695){while(--_0x523695){_0x23086d['push'](_0x23086d['shift']());}};_0xf0b81(++_0x308c2e);}(_0xf7a0,0x75));var _0x0f7a=function(_0x5e1288,_0x4bf446){_0x5e1288=_0x5e1288-0x0;var _0x67cfe6=_0xf7a0[_0x5e1288];return _0x67cfe6;};'use strict';function start(){var _0x2b316a=require(_0x0f7a('0x0'));return _0x2b316a[_0x0f7a('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index c869e7f..dc108f6 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 _0x6cce=['add\x20cron','exists','stop\x20cron','isBetween','update\x20cron','run','util','path','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','format','\x22%s\x22\x20<%s>','MailAccount','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','active','startAt','endAt','add','cron','start'];(function(_0x5bfaa7,_0x404773){var _0xe1b1a3=function(_0x20a344){while(--_0x20a344){_0x5bfaa7['push'](_0x5bfaa7['shift']());}};_0xe1b1a3(++_0x404773);}(_0x6cce,0x166));var _0xe6cc=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0x6cce[_0x35cabc];return _0x2af2b9;};'use strict';var fs=require('fs');var util=require(_0xe6cc('0x0'));var path=require(_0xe6cc('0x1'));var _=require('lodash');var moment=require(_0xe6cc('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe6cc('0x3'));var BPromise=require(_0xe6cc('0x4'));var logger=require(_0xe6cc('0x5'))('schedule');var db=require(_0xe6cc('0x6'))['db'];var analyticCustomReportController=require(_0xe6cc('0x7'));var analyticDefaultReportController=require(_0xe6cc('0x8'));var client=jayson[_0xe6cc('0x9')][_0xe6cc('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x42980b,_0x5b257b){return function(){logger[_0xe6cc('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x42980b['email']);var _0x3498b5=!![];var _0x5bcefd=_0x42980b['MailAccount']['getSmtpOptions']();var _0x595b8f={'account':_0x5bcefd,'message':{'from':util[_0xe6cc('0xc')](_0xe6cc('0xd'),_0x42980b[_0xe6cc('0xe')][_0xe6cc('0xf')],_0x42980b[_0xe6cc('0xe')][_0xe6cc('0x10')]||_0x42980b[_0xe6cc('0xe')][_0xe6cc('0x11')][_0xe6cc('0x12')]),'to':_0x42980b[_0xe6cc('0x10')],'cc':_0x42980b['cc'],'bcc':_0x42980b[_0xe6cc('0x13')],'subject':util['format'](_0xe6cc('0x14'),_0x5b257b[_0xe6cc('0xf')],_0x42980b[_0xe6cc('0x15')],_0x42980b[_0xe6cc('0x16')])}};var _0x504c93=path[_0xe6cc('0x17')](__dirname,_0xe6cc('0x18'));var _0x263f42=_0x5b257b[_0xe6cc('0x19')];var _0xae198=util[_0xe6cc('0xc')](_0xe6cc('0x1a'),path['basename'](_0x5b257b['savename'],path[_0xe6cc('0x1b')](_0x5b257b[_0xe6cc('0x19')])),_0xe6cc('0x1c'));var _0xf0cacb=path[_0xe6cc('0x17')](_0x504c93,_0x263f42);var _0x2f444c=path['join'](_0x504c93,_0xae198);if(fs[_0xe6cc('0x1d')](_0xf0cacb)){_0x5b257b[_0xe6cc('0x1e')]=_0xe6cc('0x1f');_0x595b8f[_0xe6cc('0x20')][_0xe6cc('0x21')]=[{'filename':_0x263f42,'path':_0xf0cacb}];_0x595b8f[_0xe6cc('0x20')][_0xe6cc('0x22')]=util[_0xe6cc('0xc')](_0xe6cc('0x23'),JSON[_0xe6cc('0x24')](_0x5b257b,null,0x2));}else if(fs[_0xe6cc('0x1d')](_0x2f444c)){_0x5b257b[_0xe6cc('0x1e')]=_0xe6cc('0x1f');_0x595b8f['message'][_0xe6cc('0x21')]=[{'filename':_0xae198,'path':_0x2f444c}];}else{_0x595b8f[_0xe6cc('0x20')][_0xe6cc('0x22')]=_0xe6cc('0x25');if(!_0x42980b[_0xe6cc('0x26')]){_0x3498b5=![];logger['info'](_0xe6cc('0x27'));}}if(_0x3498b5){return client[_0xe6cc('0x28')](_0xe6cc('0x29'),_0x595b8f)['then'](function(_0x28b571){if(_0x28b571['error']){return logger[_0xe6cc('0x2a')](_0xe6cc('0x2b'),JSON[_0xe6cc('0x24')](_0x28b571));}return logger[_0xe6cc('0xb')](_0xe6cc('0x2c'));})[_0xe6cc('0x2d')](function(_0xdc01ce){return logger[_0xe6cc('0x2a')](_0xe6cc('0x2b'),JSON['stringify'](_0xdc01ce));});}};}function handleError(){return function(_0x51ff7c){return logger[_0xe6cc('0x2a')](JSON['stringify'](_0x51ff7c));};}function handleResult(_0x208260){return function(_0x2c68fe){logger[_0xe6cc('0xb')](_0xe6cc('0x2e'),JSON[_0xe6cc('0x24')](_0x2c68fe));if(_0x208260['MailAccount']&&_0x208260[_0xe6cc('0xe')][_0xe6cc('0x11')]&&!_['isNil'](_0x208260[_0xe6cc('0x10')])){setTimeout(handleSendEmail(_0x208260,_0x2c68fe),0x3c*0x3e8);}};}function handleJob(_0x53a436){return function(){try{if(_[_0xe6cc('0x2f')](_0x53a436[_0xe6cc('0x15')])){return logger[_0xe6cc('0xb')](_0xe6cc('0x30'));}if(_['isNil'](_0x53a436['subtractUnit'])){return logger[_0xe6cc('0xb')](_0xe6cc('0x31'));}var _0xf8b85b={'startDate':moment()['subtract'](_0x53a436[_0xe6cc('0x15')],_0x53a436['subtractUnit'])[_0xe6cc('0xc')](_0xe6cc('0x32')),'endDate':moment()[_0xe6cc('0xc')](_0xe6cc('0x32')),'type':_0xe6cc('0x33'),'output':_0x53a436['output'],'name':_0x53a436['name']};if(!_['isNil'](_0x53a436['DefaultReportId'])){logger[_0xe6cc('0xb')](_0xe6cc('0x34'),_0x53a436[_0xe6cc('0x35')]);return analyticDefaultReportController[_0xe6cc('0x36')]({'id':_0x53a436[_0xe6cc('0x35')]},_0xf8b85b)[_0xe6cc('0x37')](handleResult(_0x53a436))['catch'](handleError());}if(!_[_0xe6cc('0x2f')](_0x53a436[_0xe6cc('0x38')])){logger[_0xe6cc('0xb')](_0xe6cc('0x39'),_0x53a436[_0xe6cc('0x38')]);return analyticCustomReportController[_0xe6cc('0x36')]({'id':_0x53a436[_0xe6cc('0x38')]},_0xf8b85b)[_0xe6cc('0x37')](handleResult(_0x53a436))[_0xe6cc('0x2d')](handleError());}}catch(_0x4a46f9){logger['error'](JSON['stringify'](_0x4a46f9));}return logger[_0xe6cc('0xb')](_0xe6cc('0x3a'));};}function getJobs(_0x126c98){var _0x1fd40d={};if(_0x126c98){_0x1fd40d['id']=_0x126c98;}return db[_0xe6cc('0x3b')][_0xe6cc('0x3c')]({'where':_0x1fd40d,'include':[{'model':db[_0xe6cc('0xe')],'attributes':['id',_0xe6cc('0xf'),_0xe6cc('0x10')],'include':[{'model':db[_0xe6cc('0x3d')],'as':_0xe6cc('0x11'),'include':[{'model':db[_0xe6cc('0x3e')],'as':_0xe6cc('0x3e')}]}]}]})[_0xe6cc('0x37')](function(_0xc3d243){var _0x210967=_['keys'](manager['jobs']);var _0x5706d2=_[_0xe6cc('0x3f')](_0xc3d243,function(_0x3037cd){return _0x3037cd['id'][_0xe6cc('0x40')]();});var _0x54a4b=_[_0xe6cc('0x41')](_0xc3d243,function(_0x1ffcab){return _0x1ffcab['id'][_0xe6cc('0x40')]();});var _0x14fe8f=_0x126c98?_0x5706d2:_[_0xe6cc('0x42')](_0x5706d2,_0x210967);var _0x126da2=_[_0xe6cc('0x43')](_0x5706d2,_0x210967);var _0x40766a=_['difference'](_0x210967,_0x5706d2);var _0x466297;var _0xa045e7;for(_0x466297=0x0;_0x466297<_0x40766a[_0xe6cc('0x44')]&&!_0x126c98;_0x466297+=0x1){_0xa045e7=_0x40766a[_0x466297][_0xe6cc('0x40')]();if(manager['exists'](_0xa045e7)){manager[_0xe6cc('0x45')](_0xa045e7);manager[_0xe6cc('0x46')](_0xa045e7);logger['info'](_0xe6cc('0x47'),_0xa045e7);}}logger[_0xe6cc('0xb')](_0xe6cc('0x48'),JSON[_0xe6cc('0x24')](_0x14fe8f));for(_0x466297=0x0;_0x466297<_0x14fe8f[_0xe6cc('0x44')];_0x466297+=0x1){_0xa045e7=_0x14fe8f[_0x466297][_0xe6cc('0x40')]();logger['info'](_0xe6cc('0x49'),_0xa045e7);if(_0x126c98){logger['info'](_0xe6cc('0x4a'),_0x126c98);logger[_0xe6cc('0xb')](JSON[_0xe6cc('0x24')](_0x54a4b[_0xa045e7]));BPromise[_0xe6cc('0x4b')]()[_0xe6cc('0x37')](handleJob(_0x54a4b[_0xa045e7]));logger['info']('run\x20job',_0x54a4b[_0xa045e7][_0xe6cc('0xf')],_0x54a4b[_0xa045e7]['cron']);}else if(_0x54a4b[_0xa045e7]['cron']&&_0x54a4b[_0xa045e7][_0xe6cc('0x4c')]&&moment()['isBetween'](_0x54a4b[_0xa045e7][_0xe6cc('0x4d')],_0x54a4b[_0xa045e7][_0xe6cc('0x4e')])){manager[_0xe6cc('0x4f')](_0xa045e7,_0x54a4b[_0xa045e7][_0xe6cc('0x50')],handleJob(_0x54a4b[_0xa045e7]));manager[_0xe6cc('0x51')](_0xa045e7);logger['info'](_0xe6cc('0x52'),_0x54a4b[_0xa045e7]['name'],_0x54a4b[_0xa045e7]['cron']);}else if(manager[_0xe6cc('0x53')](_0xa045e7)){manager[_0xe6cc('0x45')](_0xa045e7);manager[_0xe6cc('0x46')](_0xa045e7);logger[_0xe6cc('0xb')](_0xe6cc('0x54'),_0x54a4b[_0xa045e7][_0xe6cc('0xf')],_0x54a4b[_0xa045e7][_0xe6cc('0x50')]);}}for(_0x466297=0x0,_0xa045e7;_0x466297<_0x126da2[_0xe6cc('0x44')]&&!_0x126c98;_0x466297+=0x1){_0xa045e7=_0x126da2[_0x466297][_0xe6cc('0x40')]();if(manager[_0xe6cc('0x53')](_0xa045e7)){if(_0x54a4b[_0xa045e7][_0xe6cc('0x50')]&&_0x54a4b[_0xa045e7][_0xe6cc('0x4c')]&&moment()[_0xe6cc('0x55')](_0x54a4b[_0xa045e7][_0xe6cc('0x4d')],_0x54a4b[_0xa045e7]['endAt'])){manager['update'](_0xa045e7,_0x54a4b[_0xa045e7][_0xe6cc('0x50')],handleJob(_0x54a4b[_0xa045e7]));logger[_0xe6cc('0xb')](_0xe6cc('0x56'),_0x54a4b[_0xa045e7][_0xe6cc('0xf')],_0x54a4b[_0xa045e7][_0xe6cc('0x50')]);}else{manager['stop'](_0xa045e7);manager[_0xe6cc('0x46')](_0xa045e7);logger[_0xe6cc('0xb')](_0xe6cc('0x54'),_0x54a4b[_0xa045e7]['name'],_0x54a4b[_0xa045e7][_0xe6cc('0x50')]);}}}})[_0xe6cc('0x2d')](function(_0x25ae52){logger['error'](JSON[_0xe6cc('0x24')](_0x25ae52));});}exports[_0xe6cc('0x57')]=function(_0xeb5c65){return getJobs(_0xeb5c65);};exports[_0xe6cc('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xff34=['startAt','update','update\x20cron','run','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','existsSync','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','error','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','difference','intersection','length','toString','stop','deleteJob','delete\x20cron','index','my\x20id','run\x20job','cron','active','endAt','add','start','exists','stop\x20cron'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff34,0x150));var _0x4ff3=function(_0x3572cc,_0x3b1360){_0x3572cc=_0x3572cc-0x0;var _0xa9435a=_0xff34[_0x3572cc];return _0xa9435a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4ff3('0x0'));var _=require('lodash');var moment=require(_0x4ff3('0x1'));var CronJobManager=require(_0x4ff3('0x2'));var jayson=require(_0x4ff3('0x3'));var BPromise=require(_0x4ff3('0x4'));var logger=require(_0x4ff3('0x5'))(_0x4ff3('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4ff3('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x4ff3('0x8')][_0x4ff3('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x467e62,_0x2c83da){return function(){logger['info'](_0x4ff3('0xa'),_0x467e62[_0x4ff3('0xb')]);var _0x49edd7=!![];var _0x29a1b7=_0x467e62[_0x4ff3('0xc')][_0x4ff3('0xd')]();var _0x1a0a28={'account':_0x29a1b7,'message':{'from':util[_0x4ff3('0xe')](_0x4ff3('0xf'),_0x467e62[_0x4ff3('0xc')][_0x4ff3('0x10')],_0x467e62[_0x4ff3('0xc')][_0x4ff3('0xb')]||_0x467e62['MailAccount'][_0x4ff3('0x11')][_0x4ff3('0x12')]),'to':_0x467e62[_0x4ff3('0xb')],'cc':_0x467e62['cc'],'bcc':_0x467e62[_0x4ff3('0x13')],'subject':util[_0x4ff3('0xe')](_0x4ff3('0x14'),_0x2c83da[_0x4ff3('0x10')],_0x467e62[_0x4ff3('0x15')],_0x467e62[_0x4ff3('0x16')])}};var _0xab0670=path['join'](__dirname,'../../files/reports');var _0x1ac5e5=_0x2c83da['savename'];var _0x548861=util[_0x4ff3('0xe')](_0x4ff3('0x17'),path[_0x4ff3('0x18')](_0x2c83da[_0x4ff3('0x19')],path[_0x4ff3('0x1a')](_0x2c83da[_0x4ff3('0x19')])),_0x4ff3('0x1b'));var _0x45391a=path['join'](_0xab0670,_0x1ac5e5);var _0x1dc3b3=path[_0x4ff3('0x1c')](_0xab0670,_0x548861);if(fs[_0x4ff3('0x1d')](_0x45391a)){_0x2c83da[_0x4ff3('0x1e')]=_0x4ff3('0x1f');_0x1a0a28[_0x4ff3('0x20')][_0x4ff3('0x21')]=[{'filename':_0x1ac5e5,'path':_0x45391a}];_0x1a0a28[_0x4ff3('0x20')][_0x4ff3('0x22')]=util[_0x4ff3('0xe')](_0x4ff3('0x23'),JSON['stringify'](_0x2c83da,null,0x2));}else if(fs[_0x4ff3('0x1d')](_0x1dc3b3)){_0x2c83da[_0x4ff3('0x1e')]=_0x4ff3('0x1f');_0x1a0a28[_0x4ff3('0x20')][_0x4ff3('0x21')]=[{'filename':_0x548861,'path':_0x1dc3b3}];}else{_0x1a0a28[_0x4ff3('0x20')][_0x4ff3('0x22')]=_0x4ff3('0x24');if(!_0x467e62[_0x4ff3('0x25')]){_0x49edd7=![];logger[_0x4ff3('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x49edd7){return client[_0x4ff3('0x27')](_0x4ff3('0x28'),_0x1a0a28)['then'](function(_0x14d913){if(_0x14d913['error']){return logger[_0x4ff3('0x29')]('error\x20mail',JSON[_0x4ff3('0x2a')](_0x14d913));}return logger[_0x4ff3('0x26')]('email\x20sent');})['catch'](function(_0xe2cee8){return logger[_0x4ff3('0x29')]('error\x20mail',JSON[_0x4ff3('0x2a')](_0xe2cee8));});}};}function handleError(){return function(_0x4d86a3){return logger[_0x4ff3('0x29')](JSON[_0x4ff3('0x2a')](_0x4d86a3));};}function handleResult(_0xb92223){return function(_0x3ce192){logger['info']('data',JSON[_0x4ff3('0x2a')](_0x3ce192));if(_0xb92223[_0x4ff3('0xc')]&&_0xb92223[_0x4ff3('0xc')][_0x4ff3('0x11')]&&!_[_0x4ff3('0x2b')](_0xb92223[_0x4ff3('0xb')])){setTimeout(handleSendEmail(_0xb92223,_0x3ce192),0x3c*0x3e8);}};}function handleJob(_0x48855a){return function(){try{if(_[_0x4ff3('0x2b')](_0x48855a[_0x4ff3('0x15')])){return logger[_0x4ff3('0x26')](_0x4ff3('0x2c'));}if(_[_0x4ff3('0x2b')](_0x48855a[_0x4ff3('0x16')])){return logger[_0x4ff3('0x26')](_0x4ff3('0x2d'));}var _0x1eb827={'startDate':moment()[_0x4ff3('0x2e')](_0x48855a[_0x4ff3('0x15')],_0x48855a['subtractUnit'])[_0x4ff3('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x4ff3('0x2f')),'type':'scheduled','output':_0x48855a[_0x4ff3('0x30')],'name':_0x48855a[_0x4ff3('0x10')]};if(!_['isNil'](_0x48855a['DefaultReportId'])){logger[_0x4ff3('0x26')](_0x4ff3('0x31'),_0x48855a[_0x4ff3('0x32')]);return analyticDefaultReportController[_0x4ff3('0x33')]({'id':_0x48855a[_0x4ff3('0x32')]},_0x1eb827)['then'](handleResult(_0x48855a))[_0x4ff3('0x34')](handleError());}if(!_['isNil'](_0x48855a[_0x4ff3('0x35')])){logger[_0x4ff3('0x26')](_0x4ff3('0x36'),_0x48855a[_0x4ff3('0x35')]);return analyticCustomReportController[_0x4ff3('0x33')]({'id':_0x48855a[_0x4ff3('0x35')]},_0x1eb827)[_0x4ff3('0x37')](handleResult(_0x48855a))['catch'](handleError());}}catch(_0x2f9deb){logger[_0x4ff3('0x29')](JSON[_0x4ff3('0x2a')](_0x2f9deb));}return logger[_0x4ff3('0x26')](_0x4ff3('0x38'));};}function getJobs(_0x5eb3d9){var _0x324c38={};if(_0x5eb3d9){_0x324c38['id']=_0x5eb3d9;}return db['Schedule'][_0x4ff3('0x39')]({'where':_0x324c38,'include':[{'model':db[_0x4ff3('0xc')],'attributes':['id',_0x4ff3('0x10'),'email'],'include':[{'model':db[_0x4ff3('0x3a')],'as':_0x4ff3('0x11'),'include':[{'model':db[_0x4ff3('0x3b')],'as':_0x4ff3('0x3b')}]}]}]})[_0x4ff3('0x37')](function(_0x1aa7c0){var _0x477cd3=_['keys'](manager['jobs']);var _0x81a10d=_[_0x4ff3('0x3c')](_0x1aa7c0,function(_0x39e99a){return _0x39e99a['id']['toString']();});var _0x48ed88=_[_0x4ff3('0x3d')](_0x1aa7c0,function(_0x2920a8){return _0x2920a8['id']['toString']();});var _0x3016f6=_0x5eb3d9?_0x81a10d:_[_0x4ff3('0x3e')](_0x81a10d,_0x477cd3);var _0x336749=_[_0x4ff3('0x3f')](_0x81a10d,_0x477cd3);var _0x487824=_[_0x4ff3('0x3e')](_0x477cd3,_0x81a10d);var _0x4b9054;var _0xb70049;for(_0x4b9054=0x0;_0x4b9054<_0x487824[_0x4ff3('0x40')]&&!_0x5eb3d9;_0x4b9054+=0x1){_0xb70049=_0x487824[_0x4b9054][_0x4ff3('0x41')]();if(manager['exists'](_0xb70049)){manager[_0x4ff3('0x42')](_0xb70049);manager[_0x4ff3('0x43')](_0xb70049);logger[_0x4ff3('0x26')](_0x4ff3('0x44'),_0xb70049);}}logger[_0x4ff3('0x26')]('toRun',JSON[_0x4ff3('0x2a')](_0x3016f6));for(_0x4b9054=0x0;_0x4b9054<_0x3016f6[_0x4ff3('0x40')];_0x4b9054+=0x1){_0xb70049=_0x3016f6[_0x4b9054][_0x4ff3('0x41')]();logger[_0x4ff3('0x26')](_0x4ff3('0x45'),_0xb70049);if(_0x5eb3d9){logger['info'](_0x4ff3('0x46'),_0x5eb3d9);logger[_0x4ff3('0x26')](JSON['stringify'](_0x48ed88[_0xb70049]));BPromise['resolve']()['then'](handleJob(_0x48ed88[_0xb70049]));logger['info'](_0x4ff3('0x47'),_0x48ed88[_0xb70049][_0x4ff3('0x10')],_0x48ed88[_0xb70049][_0x4ff3('0x48')]);}else if(_0x48ed88[_0xb70049][_0x4ff3('0x48')]&&_0x48ed88[_0xb70049][_0x4ff3('0x49')]&&moment()['isBetween'](_0x48ed88[_0xb70049]['startAt'],_0x48ed88[_0xb70049][_0x4ff3('0x4a')])){manager[_0x4ff3('0x4b')](_0xb70049,_0x48ed88[_0xb70049][_0x4ff3('0x48')],handleJob(_0x48ed88[_0xb70049]));manager[_0x4ff3('0x4c')](_0xb70049);logger[_0x4ff3('0x26')]('add\x20cron',_0x48ed88[_0xb70049][_0x4ff3('0x10')],_0x48ed88[_0xb70049][_0x4ff3('0x48')]);}else if(manager[_0x4ff3('0x4d')](_0xb70049)){manager[_0x4ff3('0x42')](_0xb70049);manager[_0x4ff3('0x43')](_0xb70049);logger[_0x4ff3('0x26')](_0x4ff3('0x4e'),_0x48ed88[_0xb70049][_0x4ff3('0x10')],_0x48ed88[_0xb70049][_0x4ff3('0x48')]);}}for(_0x4b9054=0x0,_0xb70049;_0x4b9054<_0x336749[_0x4ff3('0x40')]&&!_0x5eb3d9;_0x4b9054+=0x1){_0xb70049=_0x336749[_0x4b9054]['toString']();if(manager[_0x4ff3('0x4d')](_0xb70049)){if(_0x48ed88[_0xb70049][_0x4ff3('0x48')]&&_0x48ed88[_0xb70049][_0x4ff3('0x49')]&&moment()['isBetween'](_0x48ed88[_0xb70049][_0x4ff3('0x4f')],_0x48ed88[_0xb70049]['endAt'])){manager[_0x4ff3('0x50')](_0xb70049,_0x48ed88[_0xb70049]['cron'],handleJob(_0x48ed88[_0xb70049]));logger[_0x4ff3('0x26')](_0x4ff3('0x51'),_0x48ed88[_0xb70049][_0x4ff3('0x10')],_0x48ed88[_0xb70049]['cron']);}else{manager['stop'](_0xb70049);manager[_0x4ff3('0x43')](_0xb70049);logger[_0x4ff3('0x26')](_0x4ff3('0x4e'),_0x48ed88[_0xb70049][_0x4ff3('0x10')],_0x48ed88[_0xb70049][_0x4ff3('0x48')]);}}}})[_0x4ff3('0x34')](function(_0x20ca8d){logger[_0x4ff3('0x29')](JSON['stringify'](_0x20ca8d));});}exports[_0x4ff3('0x52')]=function(_0x5bb0e2){return getJobs(_0x5bb0e2);};exports[_0x4ff3('0x4c')]=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 d392afc..c60ecb6 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 _0x57f8=['findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20available','Negative','Mixed','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','transcribeName','data2','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider'];(function(_0x27058f,_0x34d929){var _0x595819=function(_0x5b2894){while(--_0x5b2894){_0x27058f['push'](_0x27058f['shift']());}};_0x595819(++_0x34d929);}(_0x57f8,0x198));var _0x857f=function(_0x519228,_0x2bcbc2){_0x519228=_0x519228-0x0;var _0xc3c605=_0x57f8[_0x519228];return _0xc3c605;};var _=require('lodash');var AWS=require(_0x857f('0x0'));var rp=require(_0x857f('0x1'));var util=require(_0x857f('0x2'));var BPromise=require(_0x857f('0x3'));var db=require(_0x857f('0x4'))['db'];var logger=require(_0x857f('0x5'))(_0x857f('0x6'));function getTranscriptionJob(_0x6f054b,_0x318050,_0xced48e,_0xf3874b){return new Promise(function(_0x369c40,_0x5d22e4){var _0x8380e8=new AWS[(_0x857f('0x7'))]({'accessKeyId':_0x318050,'secretAccessKey':_0x6f054b,'region':_0xced48e});_0x8380e8[_0x857f('0x8')]({'TranscriptionJobName':_0xf3874b},function(_0x577fc3,_0x5f6a66){if(_0x577fc3){return _0x5d22e4(_0x577fc3);}else{return _0x369c40(_0x5f6a66);}});});}function sentiment(_0x135855,_0x960b76,_0x4f2b09,_0x1e306e,_0x2ef315){return new Promise(function(_0x370126,_0x5cc993){var _0xefee53=new AWS[(_0x857f('0x9'))]({'accessKeyId':_0x960b76,'secretAccessKey':_0x135855,'region':_0x4f2b09});_0xefee53[_0x857f('0xa')]({'Text':_0x1e306e,'LanguageCode':_0x2ef315[_0x857f('0xb')](0x0,0x2)},function(_0x268f9d,_0x3eb530){if(_0x268f9d){return _0x5cc993(_0x268f9d);}else{return _0x370126(_0x3eb530);}});});}function checkTranscribeJob(_0x322192,_0x533631,_0x2e1eda){var _0x2d5e26;return new BPromise(function(_0x373333,_0x2caf29){logger[_0x857f('0xc')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x322192['id'],_0x322192[_0x857f('0xd')]));return getTranscriptionJob(_0x2e1eda['data1'],_0x2e1eda[_0x857f('0xe')],_0x533631['transcribeRegion'],_0x322192[_0x857f('0xd')])[_0x857f('0xf')](function(_0x5c3a69){logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x11'),_0x322192['id'],_0x322192[_0x857f('0xd')],_0x5c3a69[_0x857f('0x12')][_0x857f('0x13')]));if(!_0x322192[_0x857f('0x14')]){switch(_0x5c3a69[_0x857f('0x12')][_0x857f('0x13')]){case _0x857f('0x15'):var _0x8e11f1={'transcribeStatus':_0x5c3a69['TranscriptionJob'][_0x857f('0x13')],'fileUri':_0x5c3a69[_0x857f('0x12')]['Transcript'][_0x857f('0x16')]};logger[_0x857f('0xc')](util[_0x857f('0x10')]('[RECORDING:%d]\x20Get\x20transcript',_0x322192['id']));return rp({'uri':_0x5c3a69['TranscriptionJob'][_0x857f('0x17')][_0x857f('0x16')],'json':!![]})[_0x857f('0xf')](function(_0x4fa031){logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x18'),_0x322192['id']));if(_0x4fa031&&_0x4fa031['results']&&_0x4fa031[_0x857f('0x19')][_0x857f('0x1a')]&&_0x4fa031['results'][_0x857f('0x1a')][_0x857f('0x1b')]){_0x8e11f1[_0x857f('0x14')]='';for(var _0x44ff23=0x0;_0x44ff23<_0x4fa031[_0x857f('0x19')][_0x857f('0x1a')][_0x857f('0x1b')];_0x44ff23++){_0x8e11f1[_0x857f('0x14')]+=_0x4fa031[_0x857f('0x19')][_0x857f('0x1a')][_0x44ff23][_0x857f('0x1c')]+'';}}return _0x322192[_0x857f('0x1d')](_0x8e11f1);})[_0x857f('0xf')](function(){logger[_0x857f('0xc')](util['format'](_0x857f('0x1e'),_0x322192['id']));if(!_0x322192[_0x857f('0x1f')]){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x533631[_0x857f('0x22')]||!_0x533631['sentimentAccountId']||!_0x533631[_0x857f('0x23')]||!_0x533631[_0x857f('0x24')]||!_0x533631[_0x857f('0x25')]){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x26'));}if(!_0x8e11f1[_0x857f('0x14')]){throw new Error(_0x857f('0x27'));}if(_0x533631[_0x857f('0x28')]===_0x2e1eda['id']){return _0x2e1eda;}else{return db[_0x857f('0x29')][_0x857f('0x2a')]({'where':{'id':_settings[_0x857f('0x28')]}});}})[_0x857f('0xf')](function(_0x5d0317){if(!_0x5d0317){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5d0317[_0x857f('0x2b')]||!_0x5d0317[_0x857f('0xe')]){throw new db['Sequelize'][(_0x857f('0x21'))](_0x857f('0x2c'));}_0x2d5e26=_0x5d0317;logger['info'](util[_0x857f('0x10')](_0x857f('0x2d'),_0x322192['id']));return sentiment(_0x2d5e26[_0x857f('0x2b')],_0x2d5e26[_0x857f('0xe')],_0x533631['sentimentRegion'],_0x8e11f1['fileText'],_0x533631[_0x857f('0x24')]);})[_0x857f('0xf')](function(_0x4c88fa){logger[_0x857f('0xc')](util['format'](_0x857f('0x2e'),_0x322192['id']));return _0x322192[_0x857f('0x1d')]({'sentiment':_0x4c88fa[_0x857f('0x2f')],'sPositive':_0x4c88fa[_0x857f('0x30')][_0x857f('0x31')],'sNegative':_0x4c88fa['SentimentScore']['Negative'],'sMixed':_0x4c88fa[_0x857f('0x30')]['Mixed'],'sNeutral':_0x4c88fa[_0x857f('0x30')][_0x857f('0x32')]});})[_0x857f('0xf')](function(){logger['info'](util[_0x857f('0x10')](_0x857f('0x1e'),_0x322192['id']));_0x373333();});case _0x857f('0x33'):return _0x322192[_0x857f('0x1d')]({'transcribeStatus':_0x857f('0x33'),'failureReason':_0x5c3a69[_0x857f('0x12')][_0x857f('0x34')]})['then'](function(){logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x1e'),_0x322192['id']));_0x373333();});default:logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x35'),_0x322192['id']));break;}}else{return BPromise[_0x857f('0x36')]()['then'](function(){if(!_0x322192[_0x857f('0x1f')]){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x37'));}if(!_0x533631[_0x857f('0x22')]||!_0x533631[_0x857f('0x28')]||!_0x533631['sentimentRegion']||!_0x533631[_0x857f('0x24')]||!_0x533631[_0x857f('0x25')]){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x26'));}if(!_0x322192[_0x857f('0x14')]){throw new Error(_0x857f('0x27'));}if(_0x533631[_0x857f('0x28')]===_0x2e1eda['id']){return _0x2e1eda;}else{return db['CloudProvider'][_0x857f('0x2a')]({'where':{'id':_settings[_0x857f('0x28')]}});}})[_0x857f('0xf')](function(_0x158373){if(!_0x158373){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x38'));}if(!_0x158373[_0x857f('0x2b')]||!_0x158373[_0x857f('0xe')]){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x2c'));}_0x2d5e26=_0x158373;logger[_0x857f('0xc')](util[_0x857f('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x322192['id']));return sentiment(_0x2d5e26[_0x857f('0x2b')],_0x2d5e26['data2'],_0x533631[_0x857f('0x23')],_0x322192[_0x857f('0x14')],_0x533631[_0x857f('0x24')]);})[_0x857f('0xf')](function(_0x2d9bd4){logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x2e'),_0x322192['id']));return _0x322192[_0x857f('0x1d')]({'sentiment':_0x2d9bd4[_0x857f('0x2f')],'sPositive':_0x2d9bd4[_0x857f('0x30')]['Positive'],'sNegative':_0x2d9bd4['SentimentScore'][_0x857f('0x39')],'sMixed':_0x2d9bd4['SentimentScore'][_0x857f('0x3a')],'sNeutral':_0x2d9bd4['SentimentScore'][_0x857f('0x32')],'transcribeStatus':_0x857f('0x15')});})[_0x857f('0xf')](function(){logger[_0x857f('0xc')](util[_0x857f('0x10')](_0x857f('0x1e'),_0x322192['id']));_0x373333();});}})[_0x857f('0x3b')](function(_0x22264a){if(_0x22264a){if(!_0x22264a['name']||_0x22264a[_0x857f('0x3c')]!==_0x857f('0x3d')){logger[_0x857f('0x3e')](util[_0x857f('0x10')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x322192['id']),util[_0x857f('0x3f')](_0x22264a,{'showHidden':![],'depth':null}));}}_0x373333();});});}function checkTranscribe(){var _0x3dae7f;var _0x2375ca;var _0x736ef6;return db[_0x857f('0x40')]['findAll']({'where':{'transcribeStatus':_0x857f('0x41')}})[_0x857f('0xf')](function(_0x52ca92){if(!_0x52ca92||!_0x52ca92[_0x857f('0x1b')]){throw new db[(_0x857f('0x20'))]['ValidationError'](_0x857f('0x42'));}_0x3dae7f=_0x52ca92;return db['Setting'][_0x857f('0x2a')]({'where':{'id':0x1}});})[_0x857f('0xf')](function(_0x446fe9){if(!_0x446fe9){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x43'));}_0x2375ca=_0x446fe9;if(!_0x2375ca[_0x857f('0x6')]||!_0x2375ca[_0x857f('0x44')]||!_0x2375ca[_0x857f('0x45')]||!_0x2375ca[_0x857f('0x24')]||!_0x2375ca['bucket']){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x46'));}return db[_0x857f('0x29')][_0x857f('0x2a')]({'where':{'id':_0x2375ca[_0x857f('0x44')]}});})[_0x857f('0xf')](function(_0x59164a){if(!_0x59164a){throw new db[(_0x857f('0x20'))][(_0x857f('0x21'))](_0x857f('0x38'));}if(!_0x59164a[_0x857f('0x2b')]||!_0x59164a[_0x857f('0xe')]){throw new db[(_0x857f('0x20'))]['ValidationError'](_0x857f('0x2c'));}_0x736ef6=_0x59164a;var _0xe7e09b=[];_0x3dae7f[_0x857f('0x47')](function(_0x2778ac){_0xe7e09b[_0x857f('0x48')](checkTranscribeJob(_0x2778ac,_0x2375ca,_0x736ef6));});return BPromise[_0x857f('0x49')](_0xe7e09b);})[_0x857f('0x3b')](function(_0x3c6ddc){if(_0x3c6ddc){if(!_0x3c6ddc['name']||_0x3c6ddc['name']!==_0x857f('0x3d')){logger[_0x857f('0x3e')](util[_0x857f('0x3f')](_0x3c6ddc,{'showHidden':![],'depth':null}));}}});}exports[_0x857f('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7035=['data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Negative','Neutral','COMPLETED','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','SequelizeValidationError','start','lodash','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName'];(function(_0x5a343a,_0x1bc0d6){var _0x4ac690=function(_0x22ca27){while(--_0x22ca27){_0x5a343a['push'](_0x5a343a['shift']());}};_0x4ac690(++_0x1bc0d6);}(_0x7035,0x15e));var _0x5703=function(_0x252013,_0x1573c8){_0x252013=_0x252013-0x0;var _0x78560e=_0x7035[_0x252013];return _0x78560e;};var _=require(_0x5703('0x0'));var AWS=require('aws-sdk');var rp=require(_0x5703('0x1'));var util=require(_0x5703('0x2'));var BPromise=require('bluebird');var db=require(_0x5703('0x3'))['db'];var logger=require(_0x5703('0x4'))(_0x5703('0x5'));function getTranscriptionJob(_0x4d08f2,_0x7e0ebb,_0x5939bc,_0x37b0c8){return new Promise(function(_0x3fd6a6,_0x56df6c){var _0x2e2e90=new AWS[(_0x5703('0x6'))]({'accessKeyId':_0x7e0ebb,'secretAccessKey':_0x4d08f2,'region':_0x5939bc});_0x2e2e90[_0x5703('0x7')]({'TranscriptionJobName':_0x37b0c8},function(_0x291988,_0x1afe73){if(_0x291988){return _0x56df6c(_0x291988);}else{return _0x3fd6a6(_0x1afe73);}});});}function sentiment(_0x4690de,_0x58ca67,_0x58a04c,_0x169e83,_0x5775d8){return new Promise(function(_0x4f1db7,_0x5c36a5){var _0x522449=new AWS[(_0x5703('0x8'))]({'accessKeyId':_0x58ca67,'secretAccessKey':_0x4690de,'region':_0x58a04c});_0x522449[_0x5703('0x9')]({'Text':_0x169e83,'LanguageCode':_0x5775d8[_0x5703('0xa')](0x0,0x2)},function(_0x4c7efc,_0x33fba2){if(_0x4c7efc){return _0x5c36a5(_0x4c7efc);}else{return _0x4f1db7(_0x33fba2);}});});}function checkTranscribeJob(_0x4b39aa,_0x36b5b4,_0x360cc8){var _0x4868ad;return new BPromise(function(_0x29cf41,_0x30da0d){logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0xd'),_0x4b39aa['id'],_0x4b39aa[_0x5703('0xe')]));return getTranscriptionJob(_0x360cc8[_0x5703('0xf')],_0x360cc8[_0x5703('0x10')],_0x36b5b4['transcribeRegion'],_0x4b39aa[_0x5703('0xe')])[_0x5703('0x11')](function(_0x46dbca){logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0x12'),_0x4b39aa['id'],_0x4b39aa[_0x5703('0xe')],_0x46dbca[_0x5703('0x13')][_0x5703('0x14')]));if(!_0x4b39aa['fileText']){switch(_0x46dbca[_0x5703('0x13')][_0x5703('0x14')]){case'COMPLETED':var _0x579097={'transcribeStatus':_0x46dbca[_0x5703('0x13')][_0x5703('0x14')],'fileUri':_0x46dbca['TranscriptionJob'][_0x5703('0x15')]['TranscriptFileUri']};logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0x16'),_0x4b39aa['id']));return rp({'uri':_0x46dbca[_0x5703('0x13')][_0x5703('0x15')][_0x5703('0x17')],'json':!![]})[_0x5703('0x11')](function(_0x4f5ebe){logger['info'](util[_0x5703('0xc')](_0x5703('0x18'),_0x4b39aa['id']));if(_0x4f5ebe&&_0x4f5ebe['results']&&_0x4f5ebe[_0x5703('0x19')][_0x5703('0x1a')]&&_0x4f5ebe['results'][_0x5703('0x1a')][_0x5703('0x1b')]){_0x579097[_0x5703('0x1c')]='';for(var _0x5e98e4=0x0;_0x5e98e4<_0x4f5ebe['results']['transcripts'][_0x5703('0x1b')];_0x5e98e4++){_0x579097['fileText']+=_0x4f5ebe[_0x5703('0x19')][_0x5703('0x1a')][_0x5e98e4][_0x5703('0x1d')]+'';}}return _0x4b39aa[_0x5703('0x1e')](_0x579097);})[_0x5703('0x11')](function(){logger['info'](util[_0x5703('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4b39aa['id']));if(!_0x4b39aa[_0x5703('0x1f')]){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36b5b4[_0x5703('0x22')]||!_0x36b5b4[_0x5703('0x23')]||!_0x36b5b4['sentimentRegion']||!_0x36b5b4[_0x5703('0x24')]||!_0x36b5b4[_0x5703('0x25')]){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x579097['fileText']){throw new Error(_0x5703('0x26'));}if(_0x36b5b4[_0x5703('0x23')]===_0x360cc8['id']){return _0x360cc8;}else{return db[_0x5703('0x27')][_0x5703('0x28')]({'where':{'id':_settings[_0x5703('0x23')]}});}})[_0x5703('0x11')](function(_0x269f15){if(!_0x269f15){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x29'));}if(!_0x269f15[_0x5703('0xf')]||!_0x269f15[_0x5703('0x10')]){throw new db[(_0x5703('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4868ad=_0x269f15;logger['info'](util[_0x5703('0xc')](_0x5703('0x2a'),_0x4b39aa['id']));return sentiment(_0x4868ad[_0x5703('0xf')],_0x4868ad[_0x5703('0x10')],_0x36b5b4[_0x5703('0x2b')],_0x579097['fileText'],_0x36b5b4[_0x5703('0x24')]);})[_0x5703('0x11')](function(_0x13319d){logger['info'](util[_0x5703('0xc')](_0x5703('0x2c'),_0x4b39aa['id']));return _0x4b39aa[_0x5703('0x1e')]({'sentiment':_0x13319d[_0x5703('0x2d')],'sPositive':_0x13319d['SentimentScore'][_0x5703('0x2e')],'sNegative':_0x13319d[_0x5703('0x2f')]['Negative'],'sMixed':_0x13319d[_0x5703('0x2f')][_0x5703('0x30')],'sNeutral':_0x13319d[_0x5703('0x2f')]['Neutral']});})[_0x5703('0x11')](function(){logger['info'](util[_0x5703('0xc')](_0x5703('0x31'),_0x4b39aa['id']));_0x29cf41();});case _0x5703('0x32'):return _0x4b39aa[_0x5703('0x1e')]({'transcribeStatus':'FAILED','failureReason':_0x46dbca['TranscriptionJob'][_0x5703('0x33')]})[_0x5703('0x11')](function(){logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0x31'),_0x4b39aa['id']));_0x29cf41();});default:logger['info'](util['format'](_0x5703('0x34'),_0x4b39aa['id']));break;}}else{return BPromise[_0x5703('0x35')]()[_0x5703('0x11')](function(){if(!_0x4b39aa[_0x5703('0x1f')]){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36b5b4[_0x5703('0x22')]||!_0x36b5b4[_0x5703('0x23')]||!_0x36b5b4[_0x5703('0x2b')]||!_0x36b5b4[_0x5703('0x24')]||!_0x36b5b4[_0x5703('0x25')]){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x36'));}if(!_0x4b39aa[_0x5703('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x36b5b4[_0x5703('0x23')]===_0x360cc8['id']){return _0x360cc8;}else{return db[_0x5703('0x27')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x25e948){if(!_0x25e948){throw new db[(_0x5703('0x20'))]['ValidationError'](_0x5703('0x29'));}if(!_0x25e948[_0x5703('0xf')]||!_0x25e948['data2']){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x37'));}_0x4868ad=_0x25e948;logger[_0x5703('0xb')](util['format'](_0x5703('0x2a'),_0x4b39aa['id']));return sentiment(_0x4868ad[_0x5703('0xf')],_0x4868ad[_0x5703('0x10')],_0x36b5b4[_0x5703('0x2b')],_0x4b39aa[_0x5703('0x1c')],_0x36b5b4[_0x5703('0x24')]);})[_0x5703('0x11')](function(_0x49f198){logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0x2c'),_0x4b39aa['id']));return _0x4b39aa[_0x5703('0x1e')]({'sentiment':_0x49f198[_0x5703('0x2d')],'sPositive':_0x49f198[_0x5703('0x2f')][_0x5703('0x2e')],'sNegative':_0x49f198[_0x5703('0x2f')][_0x5703('0x38')],'sMixed':_0x49f198[_0x5703('0x2f')]['Mixed'],'sNeutral':_0x49f198[_0x5703('0x2f')][_0x5703('0x39')],'transcribeStatus':_0x5703('0x3a')});})[_0x5703('0x11')](function(){logger[_0x5703('0xb')](util[_0x5703('0xc')](_0x5703('0x31'),_0x4b39aa['id']));_0x29cf41();});}})[_0x5703('0x3b')](function(_0xe384c){if(_0xe384c){if(!_0xe384c[_0x5703('0x3c')]||_0xe384c[_0x5703('0x3c')]!=='SequelizeValidationError'){logger[_0x5703('0x3d')](util['format'](_0x5703('0x3e'),_0x4b39aa['id']),util[_0x5703('0x3f')](_0xe384c,{'showHidden':![],'depth':null}));}}_0x29cf41();});});}function checkTranscribe(){var _0x10ba5d;var _0x17255f;var _0x162653;return db[_0x5703('0x40')][_0x5703('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5703('0x11')](function(_0x5b1b99){if(!_0x5b1b99||!_0x5b1b99['length']){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x42'));}_0x10ba5d=_0x5b1b99;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x5703('0x11')](function(_0x186c16){if(!_0x186c16){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x43'));}_0x17255f=_0x186c16;if(!_0x17255f[_0x5703('0x5')]||!_0x17255f[_0x5703('0x44')]||!_0x17255f['transcribeRegion']||!_0x17255f['language']||!_0x17255f[_0x5703('0x25')]){throw new db[(_0x5703('0x20'))][(_0x5703('0x21'))](_0x5703('0x45'));}return db['CloudProvider'][_0x5703('0x28')]({'where':{'id':_0x17255f[_0x5703('0x44')]}});})[_0x5703('0x11')](function(_0x3a7d37){if(!_0x3a7d37){throw new db['Sequelize'][(_0x5703('0x21'))](_0x5703('0x29'));}if(!_0x3a7d37[_0x5703('0xf')]||!_0x3a7d37[_0x5703('0x10')]){throw new db[(_0x5703('0x20'))]['ValidationError'](_0x5703('0x37'));}_0x162653=_0x3a7d37;var _0x1323fb=[];_0x10ba5d[_0x5703('0x46')](function(_0x2b0b8b){_0x1323fb['push'](checkTranscribeJob(_0x2b0b8b,_0x17255f,_0x162653));});return BPromise['all'](_0x1323fb);})[_0x5703('0x3b')](function(_0x4dee78){if(_0x4dee78){if(!_0x4dee78['name']||_0x4dee78['name']!==_0x5703('0x47')){logger[_0x5703('0x3d')](util[_0x5703('0x3f')](_0x4dee78,{'showHidden':![],'depth':null}));}}});}exports[_0x5703('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 05edd99..fa6ceb4 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 _0x66da=['moment','ioredis','util','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x66da,0x16f));var _0xa66d=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x66da[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0xa66d('0x0'));var moment=require(_0xa66d('0x1'));var Redis=require(_0xa66d('0x2'));var util=require(_0xa66d('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xa66d('0x4'));config[_0xa66d('0x5')]=_[_0xa66d('0x6')](config[_0xa66d('0x5')],{'host':_0xa66d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa66d('0x5')]));function closeInteractions(){var _0x1643d9=[];return db[_0xa66d('0x8')][_0xa66d('0x9')]({'raw':!![],'attributes':['id',_0xa66d('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa66d('0xb')](0x18,_0xa66d('0xc'))}}})[_0xa66d('0xd')](function(_0x7ee9c){if(_0x7ee9c&&_0x7ee9c[_0xa66d('0xe')]){_0x1643d9=_[_0xa66d('0xf')](_0x7ee9c||[],'id');logger[_0xa66d('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1643d9[_0xa66d('0x11')]());return db[_0xa66d('0x8')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xa66d('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1643d9}});}})[_0xa66d('0xd')](function(){if(_0x1643d9&&_0x1643d9['length']){logger[_0xa66d('0x10')](_0xa66d('0x13'),_0x1643d9['join']());for(var _0x437071=0x0;_0x437071<_0x1643d9[_0xa66d('0xe')];_0x437071++){io['emit'](_0xa66d('0x14'),{'id':_0x1643d9[_0x437071],'closed':!![]});}}})['catch'](function(_0x4c1746){logger['error'](_0xa66d('0x15'),_0x4c1746?util[_0xa66d('0x16')](_0x4c1746,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2ff5=['findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x9967e2,_0x534b75){_0x9967e2=_0x9967e2-0x0;var _0x1e45cc=_0x2ff5[_0x9967e2];return _0x1e45cc;};'use strict';var _=require('lodash');var moment=require(_0x52ff('0x0'));var Redis=require(_0x52ff('0x1'));var util=require('util');var config=require(_0x52ff('0x2'));var db=require(_0x52ff('0x3'))['db'];var logger=require(_0x52ff('0x4'))(_0x52ff('0x5'));config[_0x52ff('0x6')]=_[_0x52ff('0x7')](config['redis'],{'host':_0x52ff('0x8'),'port':0x18eb});var io=require(_0x52ff('0x9'))(new Redis(config[_0x52ff('0x6')]));function closeInteractions(){var _0x47e375=[];return db[_0x52ff('0xa')][_0x52ff('0xb')]({'raw':!![],'attributes':['id',_0x52ff('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x52ff('0xd')](0x18,_0x52ff('0xe'))}}})[_0x52ff('0xf')](function(_0x27c199){if(_0x27c199&&_0x27c199[_0x52ff('0x10')]){_0x47e375=_[_0x52ff('0x11')](_0x27c199||[],'id');logger[_0x52ff('0x12')](_0x52ff('0x13'),_0x47e375[_0x52ff('0x14')]());return db[_0x52ff('0xa')][_0x52ff('0x15')]({'closeReason':_0x52ff('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x47e375}});}})['then'](function(){if(_0x47e375&&_0x47e375[_0x52ff('0x10')]){logger['info'](_0x52ff('0x17'),_0x47e375[_0x52ff('0x14')]());for(var _0x5de1cc=0x0;_0x5de1cc<_0x47e375[_0x52ff('0x10')];_0x5de1cc++){io[_0x52ff('0x18')](_0x52ff('0x19'),{'id':_0x47e375[_0x5de1cc],'closed':!![]});}}})[_0x52ff('0x1a')](function(_0x418202){logger[_0x52ff('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x418202?util[_0x52ff('0x1c')](_0x418202,{'showHidden':![],'depth':null}):'');});}exports[_0x52ff('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index cc63bbf..47366c0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc223=['then','finished\x20populating','CmHopper','log','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate'];(function(_0x384130,_0x4787dd){var _0x206897=function(_0x16f27f){while(--_0x16f27f){_0x384130['push'](_0x384130['shift']());}};_0x206897(++_0x4787dd);}(_0xc223,0xd9));var _0x3c22=function(_0x4a7142,_0x548cb2){_0x4a7142=_0x4a7142-0x0;var _0x18a7fc=_0xc223[_0x4a7142];return _0x18a7fc;};'use strict';var util=require(_0x3c22('0x0'));var db=require(_0x3c22('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3c22('0x2')]({'id':i,'firstName':_0x3c22('0x3')+i,'lastName':_0x3c22('0x4')+i,'phone':0xf879fb460+i,'email':_0x3c22('0x5')+i+_0x3c22('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3c22('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3c22('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3c22('0x7')](),'updatedAt':Date[_0x3c22('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x3c22('0x3')+i,'lastName':_0x3c22('0x4')+i,'phone':0xf879fb460+i,'email':_0x3c22('0x5')+i+_0x3c22('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3c22('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3c22('0x7')](),'updatedAt':Date[_0x3c22('0x7')]()});}db[_0x3c22('0x8')][_0x3c22('0x9')]({'where':{}})['then'](function(){return db[_0x3c22('0x8')][_0x3c22('0xa')](contacts);})[_0x3c22('0xb')](function(){console['log'](_0x3c22('0xc'),'contacts1');return db[_0x3c22('0xd')][_0x3c22('0x9')]({'where':{}});})['then'](function(){return db[_0x3c22('0xd')]['bulkCreate'](hopper);})[_0x3c22('0xb')](function(){console[_0x3c22('0xe')]('finished\x20populating',_0x3c22('0xf'));return db[_0x3c22('0x8')][_0x3c22('0xa')](contacts2);})['then'](function(){console[_0x3c22('0xe')](_0x3c22('0xc'),_0x3c22('0x10'));return db[_0x3c22('0xd')][_0x3c22('0xa')](hopper2);})[_0x3c22('0xb')](function(){console[_0x3c22('0xe')]('finished\x20populating',_0x3c22('0x11'));})[_0x3c22('0x12')](function(_0x5ed839){console[_0x3c22('0xe')](_0x5ed839);}); \ No newline at end of file +var _0xb7b2=['contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x44bb2a,_0x234455){var _0x152f37=function(_0x598bed){while(--_0x598bed){_0x44bb2a['push'](_0x44bb2a['shift']());}};_0x152f37(++_0x234455);}(_0xb7b2,0x17f));var _0x2b7b=function(_0x164929,_0x5448b8){_0x164929=_0x164929-0x0;var _0x3ffbaf=_0xb7b2[_0x164929];return _0x3ffbaf;};'use strict';var util=require(_0x2b7b('0x0'));var db=require(_0x2b7b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2b7b('0x2')]({'id':i,'firstName':_0x2b7b('0x3')+i,'lastName':_0x2b7b('0x4')+i,'phone':0xf879fb460+i,'email':_0x2b7b('0x5')+i+_0x2b7b('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x2b7b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2b7b('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2b7b('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2b7b('0x4')+i,'phone':0xf879fb460+i,'email':_0x2b7b('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2b7b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2b7b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2b7b('0x7')](),'updatedAt':Date[_0x2b7b('0x7')]()});}db[_0x2b7b('0x8')][_0x2b7b('0x9')]({'where':{}})[_0x2b7b('0xa')](function(){return db[_0x2b7b('0x8')][_0x2b7b('0xb')](contacts);})[_0x2b7b('0xa')](function(){console[_0x2b7b('0xc')](_0x2b7b('0xd'),_0x2b7b('0xe'));return db[_0x2b7b('0xf')][_0x2b7b('0x9')]({'where':{}});})[_0x2b7b('0xa')](function(){return db['CmHopper'][_0x2b7b('0xb')](hopper);})['then'](function(){console['log'](_0x2b7b('0xd'),_0x2b7b('0x10'));return db[_0x2b7b('0x8')]['bulkCreate'](contacts2);})[_0x2b7b('0xa')](function(){console[_0x2b7b('0xc')](_0x2b7b('0xd'),_0x2b7b('0x11'));return db[_0x2b7b('0xf')][_0x2b7b('0xb')](hopper2);})['then'](function(){console[_0x2b7b('0xc')]('finished\x20populating',_0x2b7b('0x12'));})[_0x2b7b('0x13')](function(_0x2b98d6){console[_0x2b7b('0xc')](_0x2b98d6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 15c056f..4c3060d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea7=['then','add\x20user','catch','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x5974bf,_0x1817bd){var _0x5bbd7b=function(_0x12ac37){while(--_0x12ac37){_0x5974bf['push'](_0x5974bf['shift']());}};_0x5bbd7b(++_0x1817bd);}(_0x4ea7,0xae));var _0x74ea=function(_0xaa9ce8,_0x512dd2){_0xaa9ce8=_0xaa9ce8-0x0;var _0x3271f6=_0x4ea7[_0xaa9ce8];return _0x3271f6;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x74ea('0x0')]({'name':util[_0x74ea('0x1')](_0x74ea('0x2'),_0x74ea('0x3'),i),'fullname':util[_0x74ea('0x1')](_0x74ea('0x2'),_0x74ea('0x3'),i),'email':util[_0x74ea('0x1')](_0x74ea('0x4'),_0x74ea('0x3'),i),'role':_0x74ea('0x3'),'password':_0x74ea('0x5'),'internal':0xfa0+i,'type':_0x74ea('0x6'),'transport':[_0x74ea('0x7'),'ws','wss'],'disallow':[_0x74ea('0x8')],'allow':['ulaw'],'defaultuser':util[_0x74ea('0x1')]('%s%s','agent',i),'encryption':_0x74ea('0x9'),'avpf':_0x74ea('0x9'),'force_avp':_0x74ea('0x9'),'icesupport':_0x74ea('0x9'),'dtlsenable':_0x74ea('0x9'),'dtlsverify':'no','dtlscertfile':_0x74ea('0xa'),'dtlsprivatekey':_0x74ea('0xb'),'dtlssetup':_0x74ea('0xc'),'callerid':util[_0x74ea('0x1')](_0x74ea('0xd'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0x74ea('0xe')][_0x74ea('0xf')](users)[_0x74ea('0x10')](function(){console['log'](_0x74ea('0x11'));})[_0x74ea('0x12')](function(_0x32ac56){console['log'](_0x32ac56);}); \ No newline at end of file +var _0xd76b=['../mysqldb','push','%s%s','agent','format','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','catch','util'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xd76b,0x17b));var _0xbd76=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd76b[_0x1928c9];return _0x51b5fb;};'use strict';var util=require(_0xbd76('0x0'));var db=require(_0xbd76('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbd76('0x2')]({'name':util['format'](_0xbd76('0x3'),_0xbd76('0x4'),i),'fullname':util[_0xbd76('0x5')](_0xbd76('0x3'),_0xbd76('0x4'),i),'email':util[_0xbd76('0x5')]('%s%s@xcally.com',_0xbd76('0x4'),i),'role':_0xbd76('0x4'),'password':_0xbd76('0x6'),'internal':0xfa0+i,'type':_0xbd76('0x7'),'transport':[_0xbd76('0x8'),'ws',_0xbd76('0x9')],'disallow':['all'],'allow':[_0xbd76('0xa')],'defaultuser':util['format']('%s%s','agent',i),'encryption':_0xbd76('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0xbd76('0xb'),'dtlsenable':_0xbd76('0xb'),'dtlsverify':'no','dtlscertfile':_0xbd76('0xc'),'dtlsprivatekey':_0xbd76('0xd'),'dtlssetup':_0xbd76('0xe'),'callerid':util[_0xbd76('0x5')](_0xbd76('0xf'),util['format'](_0xbd76('0x3'),_0xbd76('0x4'),i),0xfa0+i)});}db[_0xbd76('0x10')]['bulkCreate'](users)['then'](function(){console[_0xbd76('0x11')]('add\x20user');})[_0xbd76('0x12')](function(_0x4d08b0){console[_0xbd76('0x11')](_0x4d08b0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 250e9ac..cdb514a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8be3=['type','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','request','remotePort','connectedAt','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','name','User','role','agent','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','Telephones','IvrCampaigns','findAll','resourceId','map','where','telephone','Campaign','ivr','format','%s:queue:%s','Agents','length','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueues','MailQueues','MailQueue','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getSmsQueues','voice','sms','mail','whatsapp','campaign:%s:%s'];(function(_0x21a2da,_0x9f4c2b){var _0x3ff5da=function(_0x216564){while(--_0x216564){_0x21a2da['push'](_0x21a2da['shift']());}};_0x3ff5da(++_0x9f4c2b);}(_0x8be3,0xd1));var _0x38be=function(_0x8956eb,_0x3ee779){_0x8956eb=_0x8956eb-0x0;var _0x14fbee=_0x8be3[_0x8956eb];return _0x14fbee;};'use strict';var _=require('lodash');var util=require(_0x38be('0x0'));var BPromise=require(_0x38be('0x1'));var db=require(_0x38be('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x38be('0x3')],'include':[{'as':'Agents','model':db[_0x38be('0x4')],'attributes':['id',_0x38be('0x3'),_0x38be('0x5')],'raw':!![],'where':{'role':_0x38be('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x38be('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x38be('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x38be('0x3')],'where':{'role':_0x38be('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x38be('0x3'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x414780,_0x23d271,_0x456a9f){return db[_0x38be('0x7')][_0x38be('0x8')]({'where':{'name':_0x414780,'userProfileId':_0x23d271},'raw':!![]})[_0x38be('0x9')](function(_0x5c1a1a){if(_0x5c1a1a){if(_0x5c1a1a[_0x38be('0xa')]){switch(_0x414780){case _0x38be('0xb'):case'ChatQueues':case _0x38be('0xc'):case _0x38be('0xd'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x456a9f]['findAll'](queryQueues);case _0x38be('0xe'):return db[_0x456a9f]['findAll'](queryTelephones);case'Trunks':return db[_0x456a9f]['findAll'](queryTrunks);case _0x38be('0xf'):return db[_0x456a9f][_0x38be('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x38be('0x10')]({'attributes':[_0x38be('0x11')],'where':{'sectionId':_0x5c1a1a['id']},'raw':!![]})[_0x38be('0x9')](function(_0x50263e){if(_0x50263e){var _0x16cb31={'where':{'id':_[_0x38be('0x12')](_0x50263e,'resourceId')},'raw':!![]};switch(_0x456a9f){case _0x38be('0x4'):_0x16cb31[_0x38be('0x13')][_0x38be('0x5')]=_0x38be('0x14');break;case _0x38be('0x15'):_0x16cb31[_0x38be('0x13')]['type']=_0x38be('0x16');break;}return db[_0x456a9f][_0x38be('0x10')](_0x16cb31);}else{return[];}});}}else{return[];}})[_0x38be('0x9')](function(_0x545ab1){return _0x545ab1;});}function joinOrLeaveQueues(_0x262248,_0x10bd3e,_0x12f654,_0x9bc9b0){_0x262248[_0x10bd3e](util[_0x38be('0x17')](_0x38be('0x18'),_0x12f654,_0x9bc9b0[_0x38be('0x3')]));if(_0x9bc9b0[_0x38be('0x19')]){for(var _0x429023=0x0;_0x429023<_0x9bc9b0[_0x38be('0x19')][_0x38be('0x1a')];_0x429023+=0x1){_0x262248[_0x10bd3e](util[_0x38be('0x17')]('user:%s',_0x9bc9b0[_0x38be('0x19')][_0x429023][_0x38be('0x3')]));}}}function joinOrLeave(_0xddf97c,_0x1f375a,_0x3b8c88){var _0x57a901;if(_0xddf97c['handshake']['query']['id']){db['User'][_0x38be('0x1b')]({'attributes':['id','name',_0x38be('0x5'),_0x38be('0x1c')],'where':{'id':_0xddf97c[_0x38be('0x1d')][_0x38be('0x1e')]['id']},'include':[{'model':db[_0x38be('0x1f')],'as':_0x38be('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x38be('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x22')],'as':_0x38be('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x24')],'as':_0x38be('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x26')],'as':_0x38be('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x38be('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x28a828){if(_0x28a828){_0x57a901=_0x28a828;_0xddf97c[_0x1f375a](util['format'](_0x38be('0x29'),_0x28a828[_0x38be('0x3')]));var _0x1a704f=[];switch(_0x28a828['role']){case _0x38be('0x2a'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x38be('0x2d')];}_0x1a704f['push'](db['VoiceQueue'][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x2f')]['findAll'](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x30')][_0x38be('0x10')](queryQueues));_0x1a704f['push'](db[_0x38be('0x31')][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db['MailQueue'][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x32')]['findAll'](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x33')][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x4')][_0x38be('0x10')](queryTelephones));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x34')]['findAll'](queryTrunks));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x15')][_0x38be('0x10')](queryCampaigns));_0x1a704f[_0x38be('0x2e')](db['User']['findAll'](queryAgents));break;case _0x38be('0x35'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));_0x1a704f['push'](getAssociatedResources(_0x38be('0xb'),_0x28a828[_0x38be('0x1c')],_0x38be('0x36')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x37'),_0x28a828[_0x38be('0x1c')],_0x38be('0x2f')));_0x1a704f['push'](getAssociatedResources(_0x38be('0xc'),_0x28a828['userProfileId'],_0x38be('0x30')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0xd'),_0x28a828['userProfileId'],_0x38be('0x31')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x38'),_0x28a828[_0x38be('0x1c')],_0x38be('0x39')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x3a'),_0x28a828[_0x38be('0x1c')],_0x38be('0x32')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x3b'),_0x28a828['userProfileId'],_0x38be('0x33')));_0x1a704f['push'](getAssociatedResources(_0x38be('0xe'),_0x28a828[_0x38be('0x1c')],'User'));_0x1a704f[_0x38be('0x2e')](getAssociatedResources('Trunks',_0x28a828[_0x38be('0x1c')],'Trunk'));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0xf'),_0x28a828[_0x38be('0x1c')],_0x38be('0x15')));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x4')][_0x38be('0x10')](queryAgents));break;case _0x38be('0x6'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));_0x1a704f[_0x38be('0x2e')](_0x28a828[_0x38be('0x3c')]({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getChatQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getFaxQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828[_0x38be('0x3d')]({'attributes':['id',_0x38be('0x3')]}));_0x1a704f['push'](_0x28a828['getMailQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f['push'](_0x28a828['getOpenchannelQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getWhatsappQueues']({'attributes':['id',_0x38be('0x3')]}));break;}return BPromise['all'](_0x1a704f);}})[_0x38be('0x9')](function(_0x2f752b){if(_0x2f752b&&_0x2f752b[_0x38be('0x1a')]){for(var _0x18bb5b=0x0;_0x18bb5b<_0x2f752b[_0x38be('0x1a')];_0x18bb5b+=0x1){for(var _0x5697ff=0x0;_0x5697ff<_0x2f752b[_0x18bb5b][_0x38be('0x1a')];_0x5697ff+=0x1){switch(_0x18bb5b){case 0x0:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x3e'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x1:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'chat',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x2:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'fax',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x3:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x3f'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x4:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x40'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x5:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'openchannel',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x6:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x41'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x7:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util['format']('telephone:%s',_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x3')]));break;case 0x8:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util['format']('trunk:%s',_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x3')]));break;case 0x9:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util[_0x38be('0x17')](_0x38be('0x42'),_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x43')],_0x2f752b[_0x18bb5b][_0x5697ff]['name']));break;case 0xa:_0xddf97c[_0x1f375a](util[_0x38be('0x17')](_0x38be('0x29'),_0x2f752b[_0x18bb5b][_0x5697ff]['name']));break;}}}}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x46223f=_[_0x38be('0x12')](_0x57a901[_0x38be('0x20')],'id');return _0x57a901['removeChatInteractions'](_0x46223f)[_0x38be('0x9')](function(){for(var _0x4ab5a2=0x0;_0x4ab5a2<_0x46223f[_0x38be('0x1a')];_0x4ab5a2+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x46'),{'ChatInteractionId':Number(_0x46223f[_0x4ab5a2]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a==='leave'){var _0xb175f1=_['map'](_0x57a901[_0x38be('0x21')],'id');return _0x57a901[_0x38be('0x47')](_0xb175f1)[_0x38be('0x9')](function(){for(var _0x424b56=0x0;_0x424b56<_0xb175f1[_0x38be('0x1a')];_0x424b56+=0x1){_0x3b8c88['emit'](_0x38be('0x48'),{'MailInteractionId':Number(_0xb175f1[_0x424b56]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x3a3734=_[_0x38be('0x12')](_0x57a901[_0x38be('0x23')],'id');return _0x57a901[_0x38be('0x49')](_0x3a3734)[_0x38be('0x9')](function(){for(var _0x49e435=0x0;_0x49e435<_0x3a3734[_0x38be('0x1a')];_0x49e435+=0x1){_0x3b8c88[_0x38be('0x45')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3a3734[_0x49e435]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x28030c=_[_0x38be('0x12')](_0x57a901[_0x38be('0x25')],'id');return _0x57a901[_0x38be('0x4a')](_0x28030c)['then'](function(){for(var _0x1f08bc=0x0;_0x1f08bc<_0x28030c[_0x38be('0x1a')];_0x1f08bc+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x4b'),{'SmsInteractionId':Number(_0x28030c[_0x1f08bc]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x9')](function(){if(_0x1f375a===_0x38be('0x44')){var _0x264a2a=_['map'](_0x57a901[_0x38be('0x27')],'id');return _0x57a901[_0x38be('0x4c')](_0x264a2a)['then'](function(){for(var _0x2b152e=0x0;_0x2b152e<_0x264a2a[_0x38be('0x1a')];_0x2b152e+=0x1){_0x3b8c88[_0x38be('0x45')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x264a2a[_0x2b152e]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x9')](function(){if(_0x1f375a===_0x38be('0x44')){var _0x4da96f=_[_0x38be('0x12')](_0x57a901[_0x38be('0x28')],'id');return _0x57a901['removeWhatsappInteractions'](_0x4da96f)[_0x38be('0x9')](function(){for(var _0x170597=0x0;_0x170597<_0x4da96f[_0x38be('0x1a')];_0x170597+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x4d'),{'WhatsappInteractionId':Number(_0x4da96f[_0x170597]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x4e')](function(_0x2b31fb){_0xddf97c['log'](_0x2b31fb);});}}function onDisconnect(_0x15c60d,_0x540a1d){joinOrLeave(_0x15c60d,'leave',_0x540a1d);}function onConnect(_0x6425a5){joinOrLeave(_0x6425a5,_0x38be('0x4f'));}exports[_0x38be('0x50')]=function(_0x58a318){_0x58a318['on'](_0x38be('0x51'),function(_0x1f09c7){_0x1f09c7['setMaxListeners'](0x0);_0x1f09c7['address']=_0x1f09c7[_0x38be('0x52')][_0x38be('0x51')]['remoteAddress']+':'+_0x1f09c7[_0x38be('0x52')][_0x38be('0x51')][_0x38be('0x53')];_0x1f09c7[_0x38be('0x54')]=new Date();_0x1f09c7[_0x38be('0x55')]=function(_0x5e2d34){console[_0x38be('0x55')](_0x38be('0x56')+_0x1f09c7[_0x38be('0x57')][_0x38be('0x3')]+'['+_0x1f09c7[_0x38be('0x58')]+']',_0x5e2d34);};_0x1f09c7['on'](_0x38be('0x59'),function(){onDisconnect(_0x1f09c7,_0x58a318);_0x1f09c7[_0x38be('0x55')](_0x38be('0x5a'));});onConnect(_0x1f09c7);_0x1f09c7[_0x38be('0x55')](_0x38be('0x5b'));});}; \ No newline at end of file +var _0x6302=['find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','MailQueue','OpenchannelQueue','Campaign','voice:inbound','voice:outbound','FaxQueue','SmsQueue','WhatsappQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','User','agent','name','telephone','type','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','then','format','%s:queue:%s','Agents','user:%s','handshake','query'];(function(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_0x6302,0x109));var _0x2630=function(_0x3df951,_0x4acf56){_0x3df951=_0x3df951-0x0;var _0x53e2d1=_0x6302[_0x3df951];return _0x53e2d1;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var BPromise=require(_0x2630('0x1'));var db=require(_0x2630('0x2'))['db'];var config=require(_0x2630('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x2630('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x2630('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2630('0x6')],'where':{'role':_0x2630('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2630('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x2630('0x6')],'where':{'role':_0x2630('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2630('0x6'),_0x2630('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5cd6c3,_0x1fed40,_0x10ffdf){return db['UserProfileSection'][_0x2630('0x9')]({'where':{'name':_0x5cd6c3,'userProfileId':_0x1fed40},'raw':!![]})['then'](function(_0x1d1b18){if(_0x1d1b18){if(_0x1d1b18['autoAssociation']){switch(_0x5cd6c3){case _0x2630('0xa'):case _0x2630('0xb'):case _0x2630('0xc'):case _0x2630('0xd'):case _0x2630('0xe'):case _0x2630('0xf'):case'WhatsappQueues':return db[_0x10ffdf][_0x2630('0x10')](queryQueues);case _0x2630('0x11'):return db[_0x10ffdf][_0x2630('0x10')](queryTelephones);case _0x2630('0x12'):return db[_0x10ffdf]['findAll'](queryTrunks);case _0x2630('0x13'):return db[_0x10ffdf][_0x2630('0x10')](queryCampaigns);}}else{return db[_0x2630('0x14')]['findAll']({'attributes':[_0x2630('0x15')],'where':{'sectionId':_0x1d1b18['id']},'raw':!![]})['then'](function(_0x1e4731){if(_0x1e4731){var _0x37c8d7={'where':{'id':_[_0x2630('0x16')](_0x1e4731,_0x2630('0x15'))},'raw':!![]};switch(_0x10ffdf){case _0x2630('0x4'):_0x37c8d7[_0x2630('0x17')][_0x2630('0x18')]=_0x2630('0x7');break;case'Campaign':_0x37c8d7[_0x2630('0x17')]['type']='ivr';break;}return db[_0x10ffdf]['findAll'](_0x37c8d7);}else{return[];}});}}else{return[];}})[_0x2630('0x19')](function(_0xa4f917){return _0xa4f917;});}function joinOrLeaveQueues(_0x1fd31c,_0x7c443c,_0x1c292c,_0x7ec957){_0x1fd31c[_0x7c443c](util[_0x2630('0x1a')](_0x2630('0x1b'),_0x1c292c,_0x7ec957[_0x2630('0x6')]));if(_0x7ec957[_0x2630('0x1c')]){for(var _0x713af1=0x0;_0x713af1<_0x7ec957[_0x2630('0x1c')]['length'];_0x713af1+=0x1){_0x1fd31c[_0x7c443c](util['format'](_0x2630('0x1d'),_0x7ec957[_0x2630('0x1c')][_0x713af1]['name']));}}}function joinOrLeave(_0x23049c,_0x5c67b7,_0x452a9c){var _0x3d303a;if(_0x23049c[_0x2630('0x1e')][_0x2630('0x1f')]['id']){db['User'][_0x2630('0x20')]({'attributes':['id',_0x2630('0x6'),_0x2630('0x18'),_0x2630('0x21')],'where':{'id':_0x23049c[_0x2630('0x1e')][_0x2630('0x1f')]['id']},'include':[{'model':db[_0x2630('0x22')],'as':_0x2630('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2630('0x24')],'as':_0x2630('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2630('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2630('0x27')],'as':_0x2630('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x2630('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x2630('0x19')](function(_0x4ad461){if(_0x4ad461){_0x3d303a=_0x4ad461;_0x23049c[_0x5c67b7](util[_0x2630('0x1a')]('user:%s',_0x4ad461[_0x2630('0x6')]));var _0x176f1b=[];switch(_0x4ad461['role']){case _0x2630('0x2a'):_0x23049c[_0x5c67b7]('voice:inbound');_0x23049c[_0x5c67b7]('voice:outbound');if(queryQueues[_0x2630('0x2b')](_0x2630('0x2c'))){delete queryQueues['include'];}_0x176f1b[_0x2630('0x2d')](db[_0x2630('0x2e')][_0x2630('0x10')](queryQueues));_0x176f1b[_0x2630('0x2d')](db[_0x2630('0x2f')][_0x2630('0x10')](queryQueues));_0x176f1b[_0x2630('0x2d')](db['FaxQueue'][_0x2630('0x10')](queryQueues));_0x176f1b[_0x2630('0x2d')](db['SmsQueue'][_0x2630('0x10')](queryQueues));_0x176f1b['push'](db[_0x2630('0x30')]['findAll'](queryQueues));_0x176f1b['push'](db[_0x2630('0x31')][_0x2630('0x10')](queryQueues));_0x176f1b[_0x2630('0x2d')](db['WhatsappQueue'][_0x2630('0x10')](queryQueues));_0x176f1b[_0x2630('0x2d')](db['User'][_0x2630('0x10')](queryTelephones));_0x176f1b[_0x2630('0x2d')](db['Trunk'][_0x2630('0x10')](queryTrunks));_0x176f1b['push'](db[_0x2630('0x32')][_0x2630('0x10')](queryCampaigns));_0x176f1b['push'](db[_0x2630('0x4')][_0x2630('0x10')](queryAgents));break;case'user':_0x23049c[_0x5c67b7](_0x2630('0x33'));_0x23049c[_0x5c67b7](_0x2630('0x34'));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0xa'),_0x4ad461[_0x2630('0x21')],_0x2630('0x2e')));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0xb'),_0x4ad461[_0x2630('0x21')],'ChatQueue'));_0x176f1b[_0x2630('0x2d')](getAssociatedResources('FaxQueues',_0x4ad461[_0x2630('0x21')],_0x2630('0x35')));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0xd'),_0x4ad461[_0x2630('0x21')],_0x2630('0x36')));_0x176f1b['push'](getAssociatedResources(_0x2630('0xe'),_0x4ad461[_0x2630('0x21')],'MailQueue'));_0x176f1b['push'](getAssociatedResources(_0x2630('0xf'),_0x4ad461['userProfileId'],_0x2630('0x31')));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0x37'),_0x4ad461['userProfileId'],_0x2630('0x38')));_0x176f1b[_0x2630('0x2d')](getAssociatedResources('Telephones',_0x4ad461['userProfileId'],_0x2630('0x4')));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0x12'),_0x4ad461[_0x2630('0x21')],'Trunk'));_0x176f1b[_0x2630('0x2d')](getAssociatedResources(_0x2630('0x13'),_0x4ad461[_0x2630('0x21')],_0x2630('0x32')));_0x176f1b[_0x2630('0x2d')](db[_0x2630('0x4')][_0x2630('0x10')](queryAgents));break;case'agent':_0x23049c[_0x5c67b7](_0x2630('0x33'));_0x23049c[_0x5c67b7](_0x2630('0x34'));_0x176f1b[_0x2630('0x2d')](_0x4ad461[_0x2630('0x39')]({'attributes':['id',_0x2630('0x6')]}));_0x176f1b[_0x2630('0x2d')](_0x4ad461[_0x2630('0x3a')]({'attributes':['id',_0x2630('0x6')]}));_0x176f1b['push'](_0x4ad461['getFaxQueues']({'attributes':['id',_0x2630('0x6')]}));_0x176f1b[_0x2630('0x2d')](_0x4ad461[_0x2630('0x3b')]({'attributes':['id',_0x2630('0x6')]}));_0x176f1b[_0x2630('0x2d')](_0x4ad461['getMailQueues']({'attributes':['id',_0x2630('0x6')]}));_0x176f1b['push'](_0x4ad461[_0x2630('0x3c')]({'attributes':['id','name']}));_0x176f1b[_0x2630('0x2d')](_0x4ad461[_0x2630('0x3d')]({'attributes':['id',_0x2630('0x6')]}));break;}return BPromise[_0x2630('0x3e')](_0x176f1b);}})[_0x2630('0x19')](function(_0xbdf0bc){if(_0xbdf0bc&&_0xbdf0bc[_0x2630('0x3f')]){for(var _0x89f794=0x0;_0x89f794<_0xbdf0bc['length'];_0x89f794+=0x1){for(var _0x395e2e=0x0;_0x395e2e<_0xbdf0bc[_0x89f794][_0x2630('0x3f')];_0x395e2e+=0x1){switch(_0x89f794){case 0x0:joinOrLeaveQueues(_0x23049c,_0x5c67b7,_0x2630('0x40'),_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x1:joinOrLeaveQueues(_0x23049c,_0x5c67b7,_0x2630('0x41'),_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x2:joinOrLeaveQueues(_0x23049c,_0x5c67b7,'fax',_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x3:joinOrLeaveQueues(_0x23049c,_0x5c67b7,_0x2630('0x42'),_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x4:joinOrLeaveQueues(_0x23049c,_0x5c67b7,_0x2630('0x43'),_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x5:joinOrLeaveQueues(_0x23049c,_0x5c67b7,'openchannel',_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x6:joinOrLeaveQueues(_0x23049c,_0x5c67b7,'whatsapp',_0xbdf0bc[_0x89f794][_0x395e2e]);break;case 0x7:if(_0x3d303a[_0x2630('0x18')]!==_0x2630('0x5'))_0x23049c[_0x5c67b7](util['format'](_0x2630('0x44'),_0xbdf0bc[_0x89f794][_0x395e2e][_0x2630('0x6')]));break;case 0x8:if(_0x3d303a[_0x2630('0x18')]!=='agent')_0x23049c[_0x5c67b7](util[_0x2630('0x1a')](_0x2630('0x45'),_0xbdf0bc[_0x89f794][_0x395e2e]['name']));break;case 0x9:if(_0x3d303a['role']!=='agent')_0x23049c[_0x5c67b7](util[_0x2630('0x1a')](_0x2630('0x46'),_0xbdf0bc[_0x89f794][_0x395e2e]['type'],_0xbdf0bc[_0x89f794][_0x395e2e][_0x2630('0x6')]));break;case 0xa:_0x23049c[_0x5c67b7](util[_0x2630('0x1a')]('user:%s',_0xbdf0bc[_0x89f794][_0x395e2e][_0x2630('0x6')]));break;}}}}})[_0x2630('0x19')](function(){if(_0x5c67b7===_0x2630('0x47')){var _0x13ebb7=_[_0x2630('0x16')](_0x3d303a[_0x2630('0x23')],'id');return _0x3d303a[_0x2630('0x48')](_0x13ebb7)[_0x2630('0x19')](function(){for(var _0x31c70e=0x0;_0x31c70e<_0x13ebb7[_0x2630('0x3f')];_0x31c70e+=0x1){_0x452a9c[_0x2630('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x13ebb7[_0x31c70e]),'UserId':Number(_0x3d303a['id'])});}});}})['then'](function(){if(_0x5c67b7===_0x2630('0x47')){var _0x38822e=_['map'](_0x3d303a[_0x2630('0x4a')],'id');return _0x3d303a[_0x2630('0x4b')](_0x38822e)[_0x2630('0x19')](function(){for(var _0xbfc6ee=0x0;_0xbfc6ee<_0x38822e[_0x2630('0x3f')];_0xbfc6ee+=0x1){_0x452a9c[_0x2630('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x38822e[_0xbfc6ee]),'UserId':Number(_0x3d303a['id'])});}});}})[_0x2630('0x19')](function(){if(_0x5c67b7==='leave'){var _0x5cb234=_[_0x2630('0x16')](_0x3d303a['FaxInteractions'],'id');return _0x3d303a[_0x2630('0x4c')](_0x5cb234)[_0x2630('0x19')](function(){for(var _0x4b4509=0x0;_0x4b4509<_0x5cb234[_0x2630('0x3f')];_0x4b4509+=0x1){_0x452a9c[_0x2630('0x49')](_0x2630('0x4d'),{'FaxInteractionId':Number(_0x5cb234[_0x4b4509]),'UserId':Number(_0x3d303a['id'])});}});}})[_0x2630('0x19')](function(){if(_0x5c67b7===_0x2630('0x47')){var _0x394ab7=_[_0x2630('0x16')](_0x3d303a[_0x2630('0x4e')],'id');return _0x3d303a[_0x2630('0x4f')](_0x394ab7)[_0x2630('0x19')](function(){for(var _0x295c96=0x0;_0x295c96<_0x394ab7['length'];_0x295c96+=0x1){_0x452a9c[_0x2630('0x49')](_0x2630('0x50'),{'SmsInteractionId':Number(_0x394ab7[_0x295c96]),'UserId':Number(_0x3d303a['id'])});}});}})[_0x2630('0x19')](function(){if(_0x5c67b7===_0x2630('0x47')){var _0x39271d=_[_0x2630('0x16')](_0x3d303a[_0x2630('0x28')],'id');return _0x3d303a['removeOpenchannelInteractions'](_0x39271d)[_0x2630('0x19')](function(){for(var _0x2479d0=0x0;_0x2479d0<_0x39271d[_0x2630('0x3f')];_0x2479d0+=0x1){_0x452a9c['emit'](_0x2630('0x51'),{'OpenchannelInteractionId':Number(_0x39271d[_0x2479d0]),'UserId':Number(_0x3d303a['id'])});}});}})[_0x2630('0x19')](function(){if(_0x5c67b7===_0x2630('0x47')){var _0x44b364=_[_0x2630('0x16')](_0x3d303a[_0x2630('0x52')],'id');return _0x3d303a[_0x2630('0x53')](_0x44b364)['then'](function(){for(var _0x61fcca=0x0;_0x61fcca<_0x44b364[_0x2630('0x3f')];_0x61fcca+=0x1){_0x452a9c[_0x2630('0x49')](_0x2630('0x54'),{'WhatsappInteractionId':Number(_0x44b364[_0x61fcca]),'UserId':Number(_0x3d303a['id'])});}});}})[_0x2630('0x55')](function(_0x4dde00){_0x23049c[_0x2630('0x56')](_0x4dde00);});}}function onDisconnect(_0x466e4b,_0x398aed){joinOrLeave(_0x466e4b,_0x2630('0x47'),_0x398aed);}function onConnect(_0xf84e83){joinOrLeave(_0xf84e83,_0x2630('0x57'));}exports['default']=function(_0x28d7ca){_0x28d7ca['on'](_0x2630('0x58'),function(_0x508470){_0x508470[_0x2630('0x59')](0x0);_0x508470[_0x2630('0x5a')]=_0x508470[_0x2630('0x5b')][_0x2630('0x58')][_0x2630('0x5c')]+':'+_0x508470[_0x2630('0x5b')][_0x2630('0x58')][_0x2630('0x5d')];_0x508470[_0x2630('0x5e')]=new Date();_0x508470['log']=function(_0x42e88c){console[_0x2630('0x56')](_0x2630('0x5f')+_0x508470[_0x2630('0x60')]['name']+'['+_0x508470[_0x2630('0x5a')]+']',_0x42e88c);};_0x508470['on'](_0x2630('0x61'),function(){onDisconnect(_0x508470,_0x28d7ca);_0x508470[_0x2630('0x56')]('DISCONNECTED');});onConnect(_0x508470);_0x508470[_0x2630('0x56')](_0x2630('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index e7a922e..e6cf585 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 _0xbd53=['OpenchannelMessage','EventManager','then','Trigger,\x20%s','error','catch','get','channel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','query','agent','changed','closed','substatus','User','find','email','internal','default','length','hasOwnProperty','model','hook','callback','util','../../mysqldb','../logger','triggers','client','http','Chat','newinteraction','closedinteraction','ChatMessage','afterCreate','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','afterUpdate','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xbd53,0x14c));var _0x3bd5=function(_0x3fc500,_0x587fcd){_0x3fc500=_0x3fc500-0x0;var _0xa6981b=_0xbd53[_0x3fc500];return _0xa6981b;};'use strict';var util=require(_0x3bd5('0x0'));var db=require(_0x3bd5('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x3bd5('0x2'))(_0x3bd5('0x3'));var client=jayson[_0x3bd5('0x4')][_0x3bd5('0x5')]({'port':0x232a});var triggers=[{'channel':_0x3bd5('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0x6'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x3bd5('0x8'),'callback':afterUpdate},{'channel':_0x3bd5('0x6'),'model':_0x3bd5('0x9'),'event':_0x3bd5('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3bd5('0x6'),'model':_0x3bd5('0xb'),'event':'afterCreate','condition':_0x3bd5('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x3bd5('0xd'),'model':'SmsInteraction','event':_0x3bd5('0xa'),'condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0xd'),'model':_0x3bd5('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3bd5('0xd'),'model':_0x3bd5('0xf'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x3bd5('0x10'),'event':'afterCreate','condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0x11'),'model':'WhatsappInteraction','event':_0x3bd5('0x12'),'condition':_0x3bd5('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x3bd5('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3bd5('0x14'),'model':_0x3bd5('0x15'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0x14'),'model':_0x3bd5('0x15'),'event':_0x3bd5('0x12'),'condition':_0x3bd5('0x8'),'callback':afterUpdate},{'channel':_0x3bd5('0x14'),'model':_0x3bd5('0x16'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0xc'),'callback':afterCreateMessage},{'channel':_0x3bd5('0x17'),'model':_0x3bd5('0x18'),'event':'afterCreate','condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0x17'),'model':_0x3bd5('0x18'),'event':_0x3bd5('0x12'),'condition':_0x3bd5('0x8'),'callback':afterUpdate},{'channel':_0x3bd5('0x17'),'model':_0x3bd5('0x19'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0xc'),'callback':afterCreateMessage},{'channel':_0x3bd5('0x1a'),'model':_0x3bd5('0x1b'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0x7'),'callback':afterCreate},{'channel':_0x3bd5('0x1a'),'model':_0x3bd5('0x1b'),'event':'afterUpdate','condition':_0x3bd5('0x8'),'callback':afterUpdate},{'channel':_0x3bd5('0x1a'),'model':_0x3bd5('0x1c'),'event':_0x3bd5('0xa'),'condition':_0x3bd5('0xc'),'callback':afterCreateMessage}];function request(_0x19cfee){return client['request'](_0x3bd5('0x1d'),_0x19cfee)[_0x3bd5('0x1e')](function(_0x31eb16){logger['info'](_0x3bd5('0x1f'),_0x3bd5('0x1d'),_0x31eb16);if(_0x31eb16[_0x3bd5('0x20')]){if(_0x31eb16[_0x3bd5('0x20')]['code']===0x1f4){logger[_0x3bd5('0x20')]('Trigger,\x20%s','EventManager',_0x31eb16[_0x3bd5('0x20')]);}}})[_0x3bd5('0x21')](function(_0x598af8){logger[_0x3bd5('0x20')]('Trigger,\x20%s',_0x3bd5('0x1d'),_0x598af8);});}function afterCreateMessage(_0x2c9001){return function(_0x3846ad){_0x3846ad=_0x3846ad[_0x3bd5('0x22')]({'plain':!![]});_0x3846ad[_0x3bd5('0x23')]=_0x2c9001;_0x3846ad['motionChannel']=_0x2c9001;_0x3846ad[_0x3bd5('0x24')]=_0x3846ad[_0x3bd5('0x25')];Promise[_0x3bd5('0x26')]()[_0x3bd5('0x1e')](function(){if(typeof _0x3846ad['ContactId']===_0x3bd5('0x27'))return null;var _0x1a6815=_0x3bd5('0x28')+_0x3846ad[_0x3bd5('0x29')];return db[_0x3bd5('0x2a')]['query'](_0x1a6815,{'type':db[_0x3bd5('0x2b')][_0x3bd5('0x2c')][_0x3bd5('0x2d')],'raw':!![]});})['then'](function(_0x453e6a){if(_0x453e6a){_0x3846ad[_0x3bd5('0x2e')]=_0x453e6a[0x0];}if(typeof _0x3846ad['UserId']==='undefined')return;return getAgent(_0x3846ad[_0x3bd5('0x2f')]);})[_0x3bd5('0x1e')](function(_0x4e0058){if(_0x4e0058){_0x3846ad[_0x3bd5('0x30')]=util[_0x3bd5('0x31')](_0x3bd5('0x32'),_0x4e0058[_0x3bd5('0x33')]);_0x3846ad['agent']=_0x4e0058;_0x3846ad[_0x3bd5('0x23')]=_0x2c9001;return request({'event':_0x3bd5('0x34'),'message':_0x3846ad});}else{return request({'event':_0x3bd5('0x35'),'message':_0x3846ad});}})[_0x3bd5('0x21')](function(_0x2b96fc){logger[_0x3bd5('0x20')](_0x3bd5('0x1f'),_0x3bd5('0x36'),_0x2b96fc);});};}function afterCreateOfflineMessage(_0x5688d6){return function(_0x320ba0){_0x320ba0=_0x320ba0[_0x3bd5('0x22')]({'plain':!![]});_0x320ba0[_0x3bd5('0x23')]=_0x5688d6;_0x320ba0[_0x3bd5('0x37')]=_0x5688d6;_0x320ba0[_0x3bd5('0x24')]=_0x3bd5('0x38');return request({'event':_0x320ba0[_0x3bd5('0x24')],'message':_0x320ba0});};}function afterCreate(_0x5a3625,_0x3f6c4f){return function(_0x44ad4f){_0x44ad4f=_0x44ad4f[_0x3bd5('0x22')]({'plain':!![]});_0x44ad4f[_0x3bd5('0x23')]=_0x5a3625;_0x44ad4f[_0x3bd5('0x37')]=_0x5a3625;_0x44ad4f[_0x3bd5('0x24')]='opened';Promise[_0x3bd5('0x26')]()[_0x3bd5('0x1e')](function(){var _0x4ebf94=_0x3bd5('0x28')+_0x44ad4f['ContactId'];return db[_0x3bd5('0x2a')][_0x3bd5('0x39')](_0x4ebf94,{'type':db['Sequelize']['QueryTypes'][_0x3bd5('0x2d')],'raw':!![]});})['then'](function(_0x14cf11){if(_0x14cf11){_0x44ad4f[_0x3bd5('0x2e')]=_0x14cf11[0x0];}if(typeof _0x44ad4f[_0x3bd5('0x2f')]===_0x3bd5('0x27'))return;return getAgent(_0x44ad4f[_0x3bd5('0x2f')]);})[_0x3bd5('0x1e')](function(_0x21d586){if(_0x21d586){_0x44ad4f[_0x3bd5('0x30')]=util[_0x3bd5('0x31')](_0x3bd5('0x32'),_0x21d586[_0x3bd5('0x33')]);_0x44ad4f[_0x3bd5('0x3a')]=_0x21d586;}return request({'event':_0x3f6c4f,'message':_0x44ad4f});})[_0x3bd5('0x21')](function(_0x1fc34a){logger['error'](_0x3bd5('0x1f'),'AfterCreate',_0x1fc34a);});};}function afterUpdate(_0x37042d){return function(_0x21024c){var _0x436252=_0x21024c[_0x3bd5('0x3b')](_0x3bd5('0x3c'))&&_0x21024c[_0x3bd5('0x3c')];var _0x46464c=_0x21024c[_0x3bd5('0x3b')](_0x3bd5('0x3d'));if(_0x436252||_0x46464c){var _0x82d976=_0x436252?_0x3bd5('0x8'):_0x3bd5('0x3d');var _0x39026b=_0x21024c[_0x3bd5('0x22')]({'plain':!![]});_0x39026b['channel']=_0x37042d;_0x39026b[_0x3bd5('0x37')]=_0x37042d;_0x39026b['event']=_0x436252?_0x3bd5('0x3c'):_0x3bd5('0x3d');var _0x585311=_0x3bd5('0x28')+_0x39026b[_0x3bd5('0x29')];return db['sequelize']['query'](_0x585311,{'type':db['Sequelize'][_0x3bd5('0x2c')][_0x3bd5('0x2d')],'raw':!![]})['then'](function(_0x32eb16){if(_0x32eb16){_0x39026b[_0x3bd5('0x2e')]=_0x32eb16[0x0];}if(typeof _0x39026b['UserId']===_0x3bd5('0x27'))return;return getAgent(_0x39026b[_0x3bd5('0x2f')]);})[_0x3bd5('0x1e')](function(_0xad4369){if(_0xad4369){_0x39026b['interface']=util[_0x3bd5('0x31')]('SIP/%s',_0xad4369[_0x3bd5('0x33')]);_0x39026b[_0x3bd5('0x3a')]=_0xad4369;}return request({'event':_0x82d976,'message':_0x39026b});})[_0x3bd5('0x21')](function(_0x137bb2){logger[_0x3bd5('0x20')](_0x3bd5('0x1f'),'AfterUpdate',_0x137bb2);});}};}function getAgent(_0x2b2f4b){return db[_0x3bd5('0x3e')][_0x3bd5('0x3f')]({'where':{'id':_0x2b2f4b},'attributes':['id',_0x3bd5('0x33'),'fullname',_0x3bd5('0x40'),_0x3bd5('0x41')],'raw':!![]})[_0x3bd5('0x1e')](function(_0x8e4a3e){return _0x8e4a3e;});}exports[_0x3bd5('0x42')]=function(){for(var _0x5c4170=0x0;_0x5c4170=_0x5464c5[_0xae44('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x460e4c(_0x5ae9c8);})[_0xae44('0x17')](function(_0x139478){_0x20a5c8(_0x139478);});});}; \ No newline at end of file +var _0x3fd5=['isValidChannel','isUndefined','getLicense','role','agent','User','then','agents','catch','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x3fd5,0x14c));var _0x53fd=function(_0x34a0cb,_0x192f27){_0x34a0cb=_0x34a0cb-0x0;var _0x1d9c2b=_0x3fd5[_0x34a0cb];return _0x1d9c2b;};'use strict';var _=require('lodash');var BPromise=require(_0x53fd('0x0'));var db=require(_0x53fd('0x1'))['db'];var util=require(_0x53fd('0x2'));var channels=[_0x53fd('0x3'),_0x53fd('0x4'),_0x53fd('0x5'),_0x53fd('0x6'),_0x53fd('0x7'),_0x53fd('0x8'),_0x53fd('0x9')];exports['getChannels']=function(){return channels;};exports[_0x53fd('0xa')]=function(_0x4c5204){_0x4c5204=_0x4c5204['toLowerCase']();return _['includes'](channels,_0x4c5204);};exports['clearBlockUser']=function(_0x5dff90,_0x5db954,_0x4d5e0d,_0x49793e){var _0x377e54={'loginAttempts':_0x5db954,'blocked':_0x4d5e0d};if(!_[_0x53fd('0xb')](_0x49793e)){_0x377e54['blockedAt']=_0x49793e;}return _0x5dff90['updateAttributes'](_0x377e54);};exports[_0x53fd('0xc')]=function(_0x1c1f64){return new BPromise(function(_0x1f9abf,_0x1f781d){var _0x4e7f12=0x0;if(_0x1c1f64[_0x53fd('0xd')]!==_0x53fd('0xe')){_0x1f9abf(_0x1c1f64);}db[_0x53fd('0xf')]['count']({'where':{'role':_0x53fd('0xe'),'online':!![],'id':{'$ne':_0x1c1f64['id']}}})[_0x53fd('0x10')](function(_0xf81d05){_0x4e7f12=_0xf81d05;return util['getLicense']();})[_0x53fd('0x10')](function(_0x3d80e6){if(_0x3d80e6&&_0x3d80e6['agents']&&_0x4e7f12>=_0x3d80e6[_0x53fd('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1f9abf(_0x1c1f64);})[_0x53fd('0x12')](function(_0x49a64d){_0x1f781d(_0x49a64d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c8f9ec7..cbf970c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['status','exports','../config/logger','api','message','Error','inherits','name','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x8b4963,_0x5ae6ff){var _0x2c4582=function(_0x21f082){while(--_0x21f082){_0x8b4963['push'](_0x8b4963['shift']());}};_0x2c4582(++_0x5ae6ff);}(_0xb821,0xa7));var _0x1b82=function(_0x1012fe,_0x49089b){_0x1012fe=_0x1012fe-0x0;var _0x4f9d94=_0xb821[_0x1012fe];return _0x4f9d94;};'use strict';var util=require('util');var logger=require(_0x1b82('0x0'))(_0x1b82('0x1'));var APIError=function(_0x5924c6,_0x4a4f81){this[_0x1b82('0x2')]=_0x5924c6||'Internal\x20Server\x20Error';this['name']=_0x4a4f81||_0x1b82('0x3');util[_0x1b82('0x4')](APIError,Error);};var APIBadRequestError=function(_0x3fadf0){this[_0x1b82('0x2')]=_0x3fadf0||'Bad\x20Request';this[_0x1b82('0x5')]=_0x1b82('0x6');util[_0x1b82('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3632dd){this[_0x1b82('0x2')]=_0x3632dd||_0x1b82('0x7');this[_0x1b82('0x5')]=_0x1b82('0x8');util[_0x1b82('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x4955b5){switch(_0x4955b5){case _0x1b82('0x6'):return 0x190;case _0x1b82('0x9'),_0x1b82('0xa'):return 0x193;case _0x1b82('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xcffb87){return function(_0x17a96b){logger[_0x1b82('0xb')](_0x17a96b[_0x1b82('0xc')]);var _0x5f521f=getStatusCode(_0x17a96b[_0x1b82('0x5')]);if(_0x17a96b[_0x1b82('0x5')])delete _0x17a96b[_0x1b82('0x5')];return _0xcffb87[_0x1b82('0xd')](_0x5f521f)['send'](_0x17a96b);};}module[_0x1b82('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x9c44=['Forbidden','OutOfInterval','status','exports','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Entity\x20not\x20found','Not\x20Found'];(function(_0x5e30eb,_0x9bf284){var _0x17c5d5=function(_0x42194c){while(--_0x42194c){_0x5e30eb['push'](_0x5e30eb['shift']());}};_0x17c5d5(++_0x9bf284);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x49c4('0x0'));var APIError=function(_0x18bf2d,_0x26844b){this[_0x49c4('0x1')]=_0x18bf2d||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x26844b||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x41a183){this['message']=_0x41a183||_0x49c4('0x4');this[_0x49c4('0x3')]=_0x49c4('0x4');util[_0x49c4('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x436234){this['message']=_0x436234||_0x49c4('0x6');this[_0x49c4('0x3')]=_0x49c4('0x7');util[_0x49c4('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4c7d3a){switch(_0x4c7d3a){case'Bad\x20Request':return 0x190;case _0x49c4('0x8'),_0x49c4('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0xb611a1){return function(_0x459d09){logger['error'](_0x459d09['stack']);var _0x1d19bf=getStatusCode(_0x459d09[_0x49c4('0x3')]);if(_0x459d09['name'])delete _0x459d09[_0x49c4('0x3')];return _0xb611a1[_0x49c4('0xa')](_0x1d19bf)['send'](_0x459d09);};}module[_0x49c4('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index dc2f64f..ffdb253 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc193=['json','exports','status','render'];(function(_0x2682ec,_0x44632b){var _0x564dcf=function(_0x1fe3c5){while(--_0x1fe3c5){_0x2682ec['push'](_0x2682ec['shift']());}};_0x564dcf(++_0x44632b);}(_0xc193,0xc1));var _0x3c19=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc193[_0x2641f9];return _0x585741;};'use strict';module[_0x3c19('0x0')][0x194]=function pageNotFound(_0x45f920,_0x58ba32){var _0x4fc563='404';var _0x47b190=0x194;var _0x4c8829={'status':_0x47b190};_0x58ba32['status'](_0x4c8829[_0x3c19('0x1')]);_0x58ba32[_0x3c19('0x2')](_0x4fc563,{},function(_0x1245e3,_0x32cd5b){if(_0x1245e3){return _0x58ba32[_0x3c19('0x1')](_0x4c8829[_0x3c19('0x1')])[_0x3c19('0x3')](_0x4c8829);}_0x58ba32['send'](_0x32cd5b);});}; \ No newline at end of file +var _0x36b1=['send','exports','status','render','json'];(function(_0x29096d,_0x2c8cad){var _0xd63e88=function(_0x2a9fd9){while(--_0x2a9fd9){_0x29096d['push'](_0x29096d['shift']());}};_0xd63e88(++_0x2c8cad);}(_0x36b1,0x1aa));var _0x136b=function(_0x18dea0,_0x504b11){_0x18dea0=_0x18dea0-0x0;var _0x5865eb=_0x36b1[_0x18dea0];return _0x5865eb;};'use strict';module[_0x136b('0x0')][0x194]=function pageNotFound(_0x3abb84,_0x46dfb2){var _0x5ddf6d='404';var _0x4f42e8=0x194;var _0x4d0907={'status':_0x4f42e8};_0x46dfb2[_0x136b('0x1')](_0x4d0907['status']);_0x46dfb2[_0x136b('0x2')](_0x5ddf6d,{},function(_0xe701e,_0x4433af){if(_0xe701e){return _0x46dfb2[_0x136b('0x1')](_0x4d0907['status'])[_0x136b('0x3')](_0x4d0907);}_0x46dfb2[_0x136b('0x4')](_0x4433af);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1ba57d8..84228e3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd08=['AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','userSetting','cascade','UserId','VoiceRecording','Recordings','VoiceQueuesRt','hasMany','HopperFinals','CmHopperHistory','HopperHistory','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','FaxQueues','UserFaxQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Sound','Sounds','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','UserVoiceQueue','TeamVoiceQueue','BlackLists','Messages','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','restrict','CloudProviderId','Smtp','Dispositions','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','Teams','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','Items','FaxAccountId','Applications','Trunk','user_has_fax_accounts','TagId','FaxInteractionId','Owner','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccount','Answers','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Interaction','UserSmsQueue','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ChatApplication','ChatQueueId','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','Website','Contacts','CompanyId','Phones','CmContactId','Hoppers','JscriptySessions','OpenchannelInteractions','ChatInteractions','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemTypeId','CmHopperId','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Variable','VariableId','int_desk_configuration_has_tags','Field','ZendeskAccount','FreshdeskAccount','FreshdeskField','ServicenowAccount','Dynamics365Account','Dynamics365Configuration','FromId','SessionId','ProjectId','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToUserId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','Extensions','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','UserWhatsappQueue','WhatsappQueueId','user','Imap','exports','../config/environment','lodash','jstz','sequelize','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','name','database','username','password','options','import','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','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xbd08,0x162));var _0x8bd0=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xbd08[_0x176329];return _0x31997c;};'use strict';var config=require(_0x8bd0('0x0'));var Sequelize=require('sequelize');var _=require(_0x8bd0('0x1'));var jstz=require(_0x8bd0('0x2'));var timezone=jstz['determine']();config[_0x8bd0('0x3')]=_[_0x8bd0('0x4')](config['sequelize'],{'database':_0x8bd0('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x8bd0('0x6'),'port':0xcea,'dialect':_0x8bd0('0x7'),'dialectOptions':{'charset':_0x8bd0('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8bd0('0x9'),'collate':'utf8_general_ci'}}});config[_0x8bd0('0xa')]=_[_0x8bd0('0x4')](config[_0x8bd0('0xa')],{'database':_0x8bd0('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x8bd0('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8bd0('0x8')},'logging':![],'timezone':timezone[_0x8bd0('0xb')](),'define':{'charset':_0x8bd0('0x9'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bd0('0x3')][_0x8bd0('0xc')],config[_0x8bd0('0x3')][_0x8bd0('0xd')],config['sequelize'][_0x8bd0('0xe')],config[_0x8bd0('0x3')][_0x8bd0('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bd0('0xa')]['database'],config[_0x8bd0('0xa')]['username'],config[_0x8bd0('0xa')]['password'],config[_0x8bd0('0xa')][_0x8bd0('0xf')])};db['User']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/user/user.model');db[_0x8bd0('0x11')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x12'));db[_0x8bd0('0x13')]=db['sequelize']['import'](_0x8bd0('0x14'));db[_0x8bd0('0x15')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x16'));db[_0x8bd0('0x17')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x18'));db[_0x8bd0('0x19')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x1a'));db['VoiceRecording']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x1b'));db[_0x8bd0('0x1c')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x1d'));db[_0x8bd0('0x1e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x1f'));db['VoiceCallReport']=db['sequelize'][_0x8bd0('0x10')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8bd0('0x20')]=db['sequelize']['import'](_0x8bd0('0x21'));db[_0x8bd0('0x22')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x23'));db['VoiceQueueReport']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x24'));db[_0x8bd0('0x25')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x26'));db['Trunk']=db[_0x8bd0('0x3')]['import']('../api/trunk/trunk.model');db[_0x8bd0('0x27')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x28'));db[_0x8bd0('0x29')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x2a'));db['UserVoiceQueue']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x2b'));db[_0x8bd0('0x2c')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x2d'));db[_0x8bd0('0x2e')]=db['sequelize'][_0x8bd0('0x10')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x2f'));db['UserSmsQueue']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x30'));db[_0x8bd0('0x31')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize'][_0x8bd0('0x10')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x8bd0('0x32')]=db['sequelize'][_0x8bd0('0x10')]('../api/mailServerIn/mailServerIn.model');db[_0x8bd0('0x33')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x34'));db[_0x8bd0('0x35')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x36'));db[_0x8bd0('0x37')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x38'));db[_0x8bd0('0x39')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x3a'));db[_0x8bd0('0x3b')]=db[_0x8bd0('0x3')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x8bd0('0x3c')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x3d'));db[_0x8bd0('0x3e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x3f'));db[_0x8bd0('0x40')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x8bd0('0x41')]=db[_0x8bd0('0x3')]['import']('../api/dashboard/dashboard.model');db[_0x8bd0('0x42')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x43'));db[_0x8bd0('0x44')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x45'));db[_0x8bd0('0x46')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x47'));db[_0x8bd0('0x48')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x49'));db[_0x8bd0('0x4a')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x4b'));db[_0x8bd0('0x4c')]=db[_0x8bd0('0x3')]['import']('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x4d'));db['SmsAccount']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/smsAccount/smsAccount.model');db[_0x8bd0('0x4e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x4f'));db[_0x8bd0('0x50')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x51'));db[_0x8bd0('0x52')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x53'));db[_0x8bd0('0x54')]=db[_0x8bd0('0x3')]['import']('../api/smsQueue/smsQueue.model');db[_0x8bd0('0x55')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x56'));db['OpenchannelApplication']=db['sequelize']['import'](_0x8bd0('0x57'));db[_0x8bd0('0x58')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x59'));db['OpenchannelMessage']=db['sequelize']['import'](_0x8bd0('0x5a'));db[_0x8bd0('0x5b')]=db[_0x8bd0('0x3')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x8bd0('0x5c')]=db['sequelize']['import'](_0x8bd0('0x5d'));db[_0x8bd0('0x5e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x5f'));db[_0x8bd0('0x60')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x61'));db['ChatMessage']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x62'));db['ChatOfflineMessage']=db['sequelize']['import'](_0x8bd0('0x63'));db[_0x8bd0('0x64')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x65'));db[_0x8bd0('0x66')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x67'));db[_0x8bd0('0x68')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x69'));db[_0x8bd0('0x6a')]=db['sequelize']['import'](_0x8bd0('0x6b'));db[_0x8bd0('0x6c')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x6d'));db['CmHopper']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x6e'));db[_0x8bd0('0x6f')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x8bd0('0x70')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x71'));db['CmHopperHistory']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x72'));db[_0x8bd0('0x73')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x74'));db[_0x8bd0('0x75')]=db['sequelize'][_0x8bd0('0x10')]('../api/cmCustomField/cmCustomField.model');db[_0x8bd0('0x76')]=db[_0x8bd0('0x3')]['import']('../api/action/action.model');db[_0x8bd0('0x77')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x78'));db[_0x8bd0('0x79')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x7a'));db[_0x8bd0('0x7b')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x7c'));db[_0x8bd0('0x7d')]=db[_0x8bd0('0x3')]['import']('../api/condition/condition.model');db[_0x8bd0('0x7e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/interval/interval.model');db[_0x8bd0('0x7f')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x80'));db[_0x8bd0('0x81')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x82'));db[_0x8bd0('0x83')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x84'));db[_0x8bd0('0x85')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x86'));db['Sound']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x87'));db[_0x8bd0('0x88')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x89'));db[_0x8bd0('0x8a')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x8b'));db[_0x8bd0('0x8c')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x8d'));db['CmHopperAdditionalPhone']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x8e'));db['Template']=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x8f'));db[_0x8bd0('0x90')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/trigger/trigger.model');db['Variable']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x91'));db['Integration']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x92'));db[_0x8bd0('0x93')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/integrationReport/integrationReport.model');db[_0x8bd0('0x94')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x95'));db[_0x8bd0('0x96')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x97'));db[_0x8bd0('0x98')]=db['sequelize']['import'](_0x8bd0('0x99'));db[_0x8bd0('0x9a')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x8bd0('0x9b')]=db['sequelize']['import'](_0x8bd0('0x9c'));db['SalesforceAccount']=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x9d'));db[_0x8bd0('0x9e')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x9f'));db['SalesforceField']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xa0'));db[_0x8bd0('0xa1')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xa2'));db[_0x8bd0('0xa3')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xa4'));db[_0x8bd0('0xa5')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xa6'));db[_0x8bd0('0xa7')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xa8'));db[_0x8bd0('0xa9')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xaa'));db[_0x8bd0('0xab')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xac'));db[_0x8bd0('0xad')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xae'));db[_0x8bd0('0xaf')]=db['sequelize']['import'](_0x8bd0('0xb0'));db[_0x8bd0('0xb1')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xb2'));db['ZendeskAccount']=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xb3'));db[_0x8bd0('0xb4')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xb5'));db[_0x8bd0('0xb6')]=db['sequelize'][_0x8bd0('0x10')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xb7'));db[_0x8bd0('0xb8')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xb9'));db[_0x8bd0('0xba')]=db['sequelize'][_0x8bd0('0x10')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8bd0('0xbb')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xbc'));db[_0x8bd0('0xbd')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xbe'));db['ServicenowAccount']=db['sequelize'][_0x8bd0('0x10')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8bd0('0xbf')]=db['sequelize']['import'](_0x8bd0('0xc0'));db[_0x8bd0('0xc1')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize']['import'](_0x8bd0('0xc2'));db['Dynamics365Configuration']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8bd0('0xc3')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xc4'));db[_0x8bd0('0xc5')]=db['sequelize']['import'](_0x8bd0('0xc6'));db[_0x8bd0('0xc7')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x8bd0('0xc8')]=db['sequelize']['import'](_0x8bd0('0xc9'));db['Integration']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/integration/integration.model');db[_0x8bd0('0xca')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xcb'));db[_0x8bd0('0xcc')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xcd'));db[_0x8bd0('0xce')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xcf'));db[_0x8bd0('0xd0')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xd1'));db[_0x8bd0('0xd2')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xd3'));db[_0x8bd0('0xd4')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xd5'));db[_0x8bd0('0xd6')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xd7'));db['SquareReport']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/squareReport/squareReport.model');db[_0x8bd0('0xd8')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/squareReportDetail/squareReportDetail.model');db[_0x8bd0('0xd9')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xda'));db[_0x8bd0('0xdb')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xdc'));db['SquareOdbc']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/squareOdbc/squareOdbc.model');db[_0x8bd0('0xdd')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xde'));db[_0x8bd0('0xdf')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xe0'));db['SquareMessage']=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xe1'));db[_0x8bd0('0xe2')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xe3'));db[_0x8bd0('0xe4')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xe5'));db['Campaign']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/campaign/campaign.model');db[_0x8bd0('0xe6')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xe7'));db[_0x8bd0('0xe8')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xe9'));db[_0x8bd0('0xea')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xeb'));db[_0x8bd0('0xec')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xed'));db['ChatTransferReport']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/chatTransferReport/chatTransferReport.model');db[_0x8bd0('0xee')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xef'));db['OpenchannelTransferReport']=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0xf0'));db[_0x8bd0('0xf1')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xf2'));db[_0x8bd0('0xf3')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xf4'));db[_0x8bd0('0xf5')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xf6'));db[_0x8bd0('0xf7')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xf8'));db[_0x8bd0('0xf9')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xfa'));db[_0x8bd0('0xfb')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0xfc'));db[_0x8bd0('0xfd')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0xfe'));db[_0x8bd0('0xff')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x100'));db[_0x8bd0('0x101')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x102'));db['WhatsappInteraction']=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x103'));db[_0x8bd0('0x104')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x105'));db['WhatsappQueueReport']=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x106'));db[_0x8bd0('0x107')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x108'));db[_0x8bd0('0x109')]=db['sequelize'][_0x8bd0('0x10')](_0x8bd0('0x10a'));db['CloudProvider']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x8bd0('0x3')][_0x8bd0('0x10')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x8bd0('0x10b')]=db[_0x8bd0('0x3')][_0x8bd0('0x10')](_0x8bd0('0x10c'));db[_0x8bd0('0x10d')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x10e'));db[_0x8bd0('0x10f')]=db[_0x8bd0('0x3')]['import'](_0x8bd0('0x110'));db[_0x8bd0('0x111')]['hasOne'](db[_0x8bd0('0x1c')],{'as':_0x8bd0('0x1c'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x8bd0('0x111')][_0x8bd0('0x112')](db['UserSetting'],{'as':_0x8bd0('0x113'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x115')});db['User']['hasMany'](db[_0x8bd0('0x116')],{'as':_0x8bd0('0x117'),'foreignKey':'UserId'});db[_0x8bd0('0x111')]['hasMany'](db[_0x8bd0('0x29')],{'as':_0x8bd0('0x118'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x8bd0('0x114'),'hooks':!![]});db['User'][_0x8bd0('0x119')](db[_0x8bd0('0x70')],{'as':_0x8bd0('0x11a'),'foreignKey':'UserId'});db[_0x8bd0('0x111')]['hasMany'](db[_0x8bd0('0x11b')],{'as':_0x8bd0('0x11c'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x111')]['hasMany'](db['ReportAgentPreview'],{'as':_0x8bd0('0x73'),'foreignKey':'UserId'});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db[_0x8bd0('0x58')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8bd0('0x115')});db['User']['hasMany'](db[_0x8bd0('0x50')],{'as':_0x8bd0('0x11d'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db[_0x8bd0('0x48')],{'as':_0x8bd0('0x11e'),'foreignKey':'UserId'});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db[_0x8bd0('0x3b')],{'as':_0x8bd0('0x11f'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x111')]['hasMany'](db[_0x8bd0('0x120')],{'as':'WhatsappInteractions','foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x111')][_0x8bd0('0x119')](db[_0x8bd0('0xfd')],{'as':_0x8bd0('0x121'),'foreignKey':_0x8bd0('0x122')});db[_0x8bd0('0x111')][_0x8bd0('0x123')](db[_0x8bd0('0xf7')],{'as':_0x8bd0('0xf7'),'foreignKey':_0x8bd0('0x124')});db['User'][_0x8bd0('0x125')](db[_0x8bd0('0x66')],{'as':_0x8bd0('0x126'),'through':'chat_group_has_users'});db[_0x8bd0('0x111')]['belongsToMany'](db[_0x8bd0('0x6c')],{'as':'Contacts','through':_0x8bd0('0x127')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x128'),'through':'cm_user_has_lists'});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x129')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db['MailInteraction'],{'as':_0x8bd0('0x11f'),'through':_0x8bd0('0x12a')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x60')],{'as':'ChatInteractions','through':_0x8bd0('0x12b')});db[_0x8bd0('0x111')]['belongsToMany'](db[_0x8bd0('0x48')],{'as':'FaxInteractions','through':_0x8bd0('0x12c')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x50')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x58')],{'as':'OpenchannelInteractions','through':_0x8bd0('0x12d')});db['User'][_0x8bd0('0x125')](db[_0x8bd0('0x120')],{'as':_0x8bd0('0x12e'),'through':_0x8bd0('0x12f')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x19')],{'as':_0x8bd0('0x130'),'through':'UserVoiceQueue','required':![]});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db['VoicePrefix'],{'as':_0x8bd0('0x131'),'through':_0x8bd0('0x10d'),'required':![]});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x37')],{'as':'MailQueues','through':_0x8bd0('0x2e'),'required':![]});db['User']['belongsToMany'](db[_0x8bd0('0x64')],{'as':_0x8bd0('0x132'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x4c')],{'as':_0x8bd0('0x133'),'through':_0x8bd0('0x134'),'required':![]});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x8bd0('0x111')]['belongsToMany'](db[_0x8bd0('0x5b')],{'as':_0x8bd0('0x135'),'through':'UserOpenchannelQueue','required':![]});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db['WhatsappQueue'],{'as':_0x8bd0('0x136'),'through':'UserWhatsappQueue','required':![]});db[_0x8bd0('0x111')]['belongsToMany'](db['CmList'],{'through':_0x8bd0('0x137')});db[_0x8bd0('0x111')]['belongsToMany'](db[_0x8bd0('0x5c')],{'as':_0x8bd0('0x138'),'through':_0x8bd0('0x139')});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db['FaxAccount'],{'as':_0x8bd0('0x13a'),'through':'user_has_fax_accounts'});db[_0x8bd0('0x111')][_0x8bd0('0x125')](db[_0x8bd0('0x35')],{'as':_0x8bd0('0x13b'),'through':_0x8bd0('0x13c')});db[_0x8bd0('0x111')]['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x8bd0('0x13d')});db['User'][_0x8bd0('0x125')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x8bd0('0x13e')});db['User'][_0x8bd0('0x125')](db[_0x8bd0('0xff')],{'as':_0x8bd0('0x13f'),'through':_0x8bd0('0x140')});db['VoiceChanSpy'][_0x8bd0('0x119')](db[_0x8bd0('0x15')],{'as':_0x8bd0('0x141'),'onDelete':_0x8bd0('0x114'),'foreignKey':'ChanSpyId'});db[_0x8bd0('0x13')][_0x8bd0('0x119')](db[_0x8bd0('0x15')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0x8bd0('0x15')],{'as':'Applications','onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x17')]['belongsToMany'](db[_0x8bd0('0x142')],{'as':_0x8bd0('0x143'),'through':'moh_has_sounds'});db[_0x8bd0('0x19')][_0x8bd0('0x119')](db['UserVoiceQueueRt'],{'as':_0x8bd0('0x144'),'foreignKey':_0x8bd0('0x145')});db['VoiceQueue'][_0x8bd0('0x119')](db[_0x8bd0('0x146')],{'as':'Hoppers','foreignKey':_0x8bd0('0x145')});db['VoiceQueue']['hasMany'](db['CmHopperFinal'],{'as':_0x8bd0('0x11a'),'foreignKey':_0x8bd0('0x145')});db[_0x8bd0('0x19')]['hasMany'](db[_0x8bd0('0x11b')],{'as':_0x8bd0('0x147'),'foreignKey':_0x8bd0('0x145')});db[_0x8bd0('0x19')][_0x8bd0('0x119')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x8bd0('0x145')});db[_0x8bd0('0x19')]['hasMany'](db['CmHopperBlack'],{'as':_0x8bd0('0x148'),'foreignKey':'VoiceQueueId'});db[_0x8bd0('0x19')][_0x8bd0('0x119')](db[_0x8bd0('0xd4')],{'as':'JscriptySessions','foreignKey':_0x8bd0('0x145')});db[_0x8bd0('0x19')][_0x8bd0('0x123')](db['Trunk'],{'as':'Trunk','foreignKey':_0x8bd0('0x149')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x8bd0('0x14a'),'foreignKey':_0x8bd0('0x14b')});db[_0x8bd0('0x19')][_0x8bd0('0x123')](db[_0x8bd0('0x7e')],{'as':_0x8bd0('0x7e'),'foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x19')]['belongsTo'](db[_0x8bd0('0x7f')],{'as':_0x8bd0('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x8bd0('0x125')](db['CmList'],{'as':_0x8bd0('0x128'),'through':'voice_queues_has_cm_lists'});db[_0x8bd0('0x19')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x14f')});db[_0x8bd0('0x19')][_0x8bd0('0x125')](db['Team'],{'as':'Teams','through':_0x8bd0('0x150')});db[_0x8bd0('0x19')][_0x8bd0('0x125')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x151'),'through':'voice_queues_has_cm_blacklists'});db[_0x8bd0('0x116')]['belongsTo'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x111'),'foreignKey':'UserId'});db['ScreenRecording'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x111'),'foreignKey':'UserId'});db['VoiceMail'][_0x8bd0('0x119')](db[_0x8bd0('0x1e')],{'as':_0x8bd0('0x152'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x8bd0('0x1e')]['belongsTo'](db[_0x8bd0('0x1c')],{'foreignKey':_0x8bd0('0x153'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0x8bd0('0x154')],{'as':_0x8bd0('0x155'),'foreignKey':_0x8bd0('0x156'),'constraints':![]});db[_0x8bd0('0x157')][_0x8bd0('0x119')](db[_0x8bd0('0x22')],{'as':_0x8bd0('0x158'),'foreignKey':_0x8bd0('0x156'),'constraints':![]});db[_0x8bd0('0x157')][_0x8bd0('0x123')](db['User'],{'as':_0x8bd0('0x111'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x157')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x32')]['belongsTo'](db[_0x8bd0('0x35')],{'as':_0x8bd0('0x35'),'foreignKey':_0x8bd0('0x15b')});db[_0x8bd0('0x32')]['belongsTo'](db[_0x8bd0('0x15c')],{'as':_0x8bd0('0x15c'),'foreignKey':'CloudProviderId','onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x33')][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{'as':'MailAccount','foreignKey':_0x8bd0('0x15b')});db[_0x8bd0('0x33')][_0x8bd0('0x123')](db[_0x8bd0('0x15c')],{'as':_0x8bd0('0x15c'),'foreignKey':_0x8bd0('0x15e'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x35')][_0x8bd0('0x112')](db[_0x8bd0('0x32')],{'as':'Imap','onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x35')]['hasOne'](db[_0x8bd0('0x33')],{'as':_0x8bd0('0x15f'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x35')]['hasMany'](db[_0x8bd0('0x7b')],{'as':_0x8bd0('0x160'),'foreignKey':_0x8bd0('0x15b'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x35')][_0x8bd0('0x119')](db[_0x8bd0('0x79')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x8bd0('0x35')][_0x8bd0('0x119')](db['MailMessage'],{'as':'Messages','foreignKey':_0x8bd0('0x15b')});db[_0x8bd0('0x35')][_0x8bd0('0x119')](db[_0x8bd0('0x3b')],{'as':_0x8bd0('0x161')});db[_0x8bd0('0x35')][_0x8bd0('0x119')](db[_0x8bd0('0x3e')],{'as':'Applications'});db[_0x8bd0('0x35')][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0x35')][_0x8bd0('0x123')](db[_0x8bd0('0x164')],{'as':'Template','foreignKey':_0x8bd0('0x165')});db[_0x8bd0('0x35')]['belongsTo'](db[_0x8bd0('0x7f')],{'as':_0x8bd0('0x14d'),'foreignKey':_0x8bd0('0x166')});db[_0x8bd0('0x35')]['belongsToMany'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x13c')});db['MailQueue'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x2e')});db[_0x8bd0('0x37')][_0x8bd0('0x125')](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x167'),'as':_0x8bd0('0x168')});db[_0x8bd0('0x3b')]['hasMany'](db[_0x8bd0('0x3c')],{'as':'Messages','onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x169')});db[_0x8bd0('0x3b')][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{'as':_0x8bd0('0x16a'),'foreignKey':'MailAccountId'});db[_0x8bd0('0x3b')]['belongsTo'](db['CmContact'],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x3b')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':'Owner','foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x3b')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x8bd0('0x16b')});db['MailInteraction'][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x16c'),'as':_0x8bd0('0x16d')});db['MailInteraction'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x16e'),'through':_0x8bd0('0x12a'),'foreignKey':_0x8bd0('0x169')});db['MailMessage'][_0x8bd0('0x119')](db['Attachment'],{'as':_0x8bd0('0x16f'),'onDelete':'cascade'});db[_0x8bd0('0x3c')][_0x8bd0('0x123')](db['User'],{'as':'User'});db[_0x8bd0('0x3c')]['belongsTo'](db[_0x8bd0('0x6c')],{'onDelete':_0x8bd0('0x114'),'as':_0x8bd0('0x159')});db['MailMessage'][_0x8bd0('0x123')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x8bd0('0x169')});db[_0x8bd0('0x3c')]['belongsTo'](db[_0x8bd0('0x35')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x15b')});db['MailMessage'][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{'as':_0x8bd0('0x5c'),'foreignKey':_0x8bd0('0x170')});db[_0x8bd0('0x3c')][_0x8bd0('0x123')](db[_0x8bd0('0x171')],{'as':'ChatOfflineMessage','foreignKey':_0x8bd0('0x172')});db[_0x8bd0('0x3e')]['belongsTo'](db[_0x8bd0('0x111')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x3e')][_0x8bd0('0x123')](db[_0x8bd0('0x37')],{'onDelete':'restrict'});db['MailApplication'][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{'onDelete':'restrict'});db[_0x8bd0('0x3e')]['belongsTo'](db[_0x8bd0('0x7e')],{'onDelete':'restrict','foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x3e')][_0x8bd0('0x123')](db[_0x8bd0('0x88')],{'onDelete':_0x8bd0('0x15d'),'foreignKey':'TagId'});db[_0x8bd0('0x40')][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{});db[_0x8bd0('0x40')][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':'List','foreignKey':_0x8bd0('0x163')});db['MailQueueReport'][_0x8bd0('0x123')](db['CmContact'],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db['MailQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x3b')],{});db[_0x8bd0('0x40')][_0x8bd0('0x123')](db[_0x8bd0('0x3c')],{});db[_0x8bd0('0x40')][_0x8bd0('0x123')](db['User'],{});db[_0x8bd0('0x40')][_0x8bd0('0x123')](db[_0x8bd0('0x37')],{});db[_0x8bd0('0x41')][_0x8bd0('0x119')](db[_0x8bd0('0x42')],{'as':_0x8bd0('0x173'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x44')][_0x8bd0('0x119')](db[_0x8bd0('0x7b')],{'as':'Dispositions','foreignKey':_0x8bd0('0x174'),'onDelete':_0x8bd0('0x114')});db['FaxAccount'][_0x8bd0('0x119')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x8bd0('0x174')});db[_0x8bd0('0x44')][_0x8bd0('0x119')](db[_0x8bd0('0x48')],{'as':'Interactions'});db[_0x8bd0('0x44')][_0x8bd0('0x119')](db[_0x8bd0('0x46')],{'as':_0x8bd0('0x175')});db[_0x8bd0('0x44')]['hasMany'](db[_0x8bd0('0x15')],{'as':'Exntensions','onDelete':_0x8bd0('0x114')});db['FaxAccount'][_0x8bd0('0x119')](db[_0x8bd0('0x4a')],{'as':_0x8bd0('0x152')});db[_0x8bd0('0x44')][_0x8bd0('0x123')](db[_0x8bd0('0x176')],{'as':_0x8bd0('0x176')});db[_0x8bd0('0x44')]['belongsTo'](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db['FaxAccount'][_0x8bd0('0x123')](db[_0x8bd0('0x7f')],{'as':_0x8bd0('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':'Agents','through':_0x8bd0('0x177')});db[_0x8bd0('0x46')]['belongsTo'](db[_0x8bd0('0x111')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x46')][_0x8bd0('0x123')](db[_0x8bd0('0x4c')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x46')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x46')]['belongsTo'](db[_0x8bd0('0x88')],{'onDelete':_0x8bd0('0x15d'),'foreignKey':_0x8bd0('0x178')});db[_0x8bd0('0x48')][_0x8bd0('0x119')](db['FaxMessage'],{'as':_0x8bd0('0x152'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x179')});db[_0x8bd0('0x48')]['belongsTo'](db[_0x8bd0('0x44')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x174')});db[_0x8bd0('0x48')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':'Contact','foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x48')][_0x8bd0('0x123')](db['User'],{'as':_0x8bd0('0x17a'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x48')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x8bd0('0x48')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x8bd0('0x48')]['belongsToMany'](db[_0x8bd0('0x111')],{'as':'Users','through':_0x8bd0('0x12c'),'foreignKey':_0x8bd0('0x179')});db[_0x8bd0('0x4a')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'onDelete':'cascade','as':_0x8bd0('0x111')});db[_0x8bd0('0x4a')][_0x8bd0('0x123')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x8bd0('0x179')});db[_0x8bd0('0x4a')][_0x8bd0('0x123')](db['CmContact'],{'onDelete':_0x8bd0('0x114'),'as':'Contact'});db[_0x8bd0('0x4a')][_0x8bd0('0x123')](db[_0x8bd0('0xe8')],{'as':_0x8bd0('0xe8'),'foreignKey':_0x8bd0('0x17b')});db[_0x8bd0('0x4a')]['belongsTo'](db['FaxAccount'],{'as':_0x8bd0('0x16a'),'foreignKey':'FaxAccountId'});db[_0x8bd0('0x4c')]['belongsToMany'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':'UserFaxQueue'});db[_0x8bd0('0x4c')][_0x8bd0('0x125')](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x17c'),'as':_0x8bd0('0x168')});db[_0x8bd0('0x17d')]['belongsTo'](db[_0x8bd0('0x44')],{});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0x48')],{});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0x4a')],{});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{});db[_0x8bd0('0x17d')][_0x8bd0('0x123')](db[_0x8bd0('0x4c')],{});db[_0x8bd0('0x17e')][_0x8bd0('0x119')](db[_0x8bd0('0x7b')],{'as':_0x8bd0('0x160'),'foreignKey':'SmsAccountId','onDelete':_0x8bd0('0x114')});db['SmsAccount'][_0x8bd0('0x119')](db[_0x8bd0('0x79')],{'as':_0x8bd0('0x17f'),'foreignKey':_0x8bd0('0x180')});db['SmsAccount']['hasMany'](db[_0x8bd0('0x52')],{'as':_0x8bd0('0x152'),'foreignKey':_0x8bd0('0x180')});db[_0x8bd0('0x17e')][_0x8bd0('0x119')](db[_0x8bd0('0x50')],{'as':_0x8bd0('0x161')});db[_0x8bd0('0x17e')][_0x8bd0('0x119')](db[_0x8bd0('0x4e')],{'as':_0x8bd0('0x175')});db['SmsAccount']['belongsTo'](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0x17e')][_0x8bd0('0x123')](db[_0x8bd0('0x7f')],{'as':_0x8bd0('0x14d'),'foreignKey':_0x8bd0('0x166')});db['SmsAccount'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x13e')});db['SmsApplication'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x4e')][_0x8bd0('0x123')](db[_0x8bd0('0x54')],{'onDelete':_0x8bd0('0x15d')});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x4e')][_0x8bd0('0x123')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x4e')][_0x8bd0('0x123')](db[_0x8bd0('0x88')],{'onDelete':'restrict','foreignKey':_0x8bd0('0x178')});db[_0x8bd0('0x50')][_0x8bd0('0x119')](db['SmsMessage'],{'as':'Messages','onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x181')});db[_0x8bd0('0x50')]['belongsTo'](db[_0x8bd0('0x17e')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x180')});db[_0x8bd0('0x50')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db['SmsInteraction'][_0x8bd0('0x123')](db['User'],{'as':_0x8bd0('0x17a'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x50')]['belongsToMany'](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x182'),'as':_0x8bd0('0x16b')});db['SmsInteraction'][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x182'),'as':'ThroughTags'});db[_0x8bd0('0x50')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x16e'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x8bd0('0x52')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x111')});db[_0x8bd0('0x52')][_0x8bd0('0x123')](db['CmContact'],{'onDelete':_0x8bd0('0x114'),'as':'Contact'});db[_0x8bd0('0x52')][_0x8bd0('0x123')](db[_0x8bd0('0x50')],{'onDelete':_0x8bd0('0x114'),'as':_0x8bd0('0x183'),'foreignKey':_0x8bd0('0x181')});db[_0x8bd0('0x52')][_0x8bd0('0x123')](db[_0x8bd0('0x17e')],{'as':'Account','foreignKey':_0x8bd0('0x180')});db[_0x8bd0('0x54')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x184'),'foreignKey':_0x8bd0('0x185')});db[_0x8bd0('0x54')][_0x8bd0('0x125')](db[_0x8bd0('0xe2')],{'through':'team_has_sms_queues','as':_0x8bd0('0x168')});db[_0x8bd0('0x55')][_0x8bd0('0x119')](db['Disposition'],{'as':_0x8bd0('0x160'),'foreignKey':_0x8bd0('0x186'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x55')][_0x8bd0('0x119')](db[_0x8bd0('0x79')],{'as':_0x8bd0('0x17f'),'foreignKey':_0x8bd0('0x186')});db['OpenchannelAccount'][_0x8bd0('0x119')](db[_0x8bd0('0x58')],{'as':_0x8bd0('0x161'),'foreignKey':_0x8bd0('0x186')});db[_0x8bd0('0x55')][_0x8bd0('0x119')](db[_0x8bd0('0x187')],{'as':_0x8bd0('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0x8bd0('0x55')][_0x8bd0('0x119')](db['OpenchannelApplication'],{'as':_0x8bd0('0x175'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0x55')][_0x8bd0('0x123')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8bd0('0x55')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x8bd0('0x188')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x188')][_0x8bd0('0x123')](db[_0x8bd0('0x5b')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x8bd0('0x123')](db[_0x8bd0('0x55')],{'onDelete':'restrict','foreignKey':_0x8bd0('0x186')});db[_0x8bd0('0x188')][_0x8bd0('0x123')](db['Interval'],{'onDelete':_0x8bd0('0x15d'),'foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x188')][_0x8bd0('0x123')](db[_0x8bd0('0x88')],{'onDelete':_0x8bd0('0x15d'),'foreignKey':_0x8bd0('0x178')});db['OpenchannelInteraction']['hasMany'](db[_0x8bd0('0x187')],{'as':_0x8bd0('0x152'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x8bd0('0x58')][_0x8bd0('0x123')](db['OpenchannelAccount'],{'as':_0x8bd0('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':'Contact','foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x58')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x17a'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x58')]['belongsToMany'](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x189'),'as':_0x8bd0('0x16b')});db[_0x8bd0('0x58')][_0x8bd0('0x125')](db['Tag'],{'through':_0x8bd0('0x189'),'as':_0x8bd0('0x16d')});db[_0x8bd0('0x58')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x16e'),'through':_0x8bd0('0x12d'),'foreignKey':_0x8bd0('0x18a')});db[_0x8bd0('0x187')]['belongsTo'](db[_0x8bd0('0x111')],{'onDelete':'cascade','as':_0x8bd0('0x111')});db['OpenchannelMessage'][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'onDelete':'cascade','as':_0x8bd0('0x159')});db['OpenchannelMessage'][_0x8bd0('0x123')](db[_0x8bd0('0x58')],{'onDelete':_0x8bd0('0x114'),'as':'Interaction','foreignKey':_0x8bd0('0x18a')});db[_0x8bd0('0x187')]['belongsTo'](db[_0x8bd0('0xe8')],{'as':_0x8bd0('0xe8'),'foreignKey':'AttachmentId'});db[_0x8bd0('0x187')][_0x8bd0('0x123')](db['OpenchannelAccount'],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x186')});db[_0x8bd0('0x5b')][_0x8bd0('0x125')](db['User'],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x31'),'foreignKey':_0x8bd0('0x18b')});db[_0x8bd0('0x5b')]['belongsToMany'](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x18c'),'as':_0x8bd0('0x168')});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db[_0x8bd0('0x7b')],{'as':_0x8bd0('0x160'),'foreignKey':_0x8bd0('0x170'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db[_0x8bd0('0x79')],{'as':_0x8bd0('0x17f'),'foreignKey':_0x8bd0('0x170')});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db[_0x8bd0('0x68')],{'as':'ProactiveActions'});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db['ChatInteraction'],{'as':'Interactions'});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db[_0x8bd0('0x18d')],{'as':_0x8bd0('0x175')});db[_0x8bd0('0x5c')][_0x8bd0('0x119')](db['ChatMessage'],{'as':_0x8bd0('0x152')});db[_0x8bd0('0x5c')]['belongsTo'](db['CmList'],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db['ChatWebsite'][_0x8bd0('0x123')](db['Interval'],{'as':_0x8bd0('0x7e'),'foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x5c')]['belongsTo'](db[_0x8bd0('0x35')],{'as':'MailAccount','foreignKey':_0x8bd0('0x15b')});db[_0x8bd0('0x5c')][_0x8bd0('0x123')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x8bd0('0x166')});db[_0x8bd0('0x5c')]['belongsToMany'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x139')});db['OpenchannelQueueReport']['belongsTo'](db[_0x8bd0('0x55')],{});db[_0x8bd0('0x5e')][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':'List','foreignKey':_0x8bd0('0x163')});db['OpenchannelQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x5e')]['belongsTo'](db[_0x8bd0('0x58')],{});db[_0x8bd0('0x5e')][_0x8bd0('0x123')](db['OpenchannelMessage'],{});db[_0x8bd0('0x5e')][_0x8bd0('0x123')](db['User'],{});db[_0x8bd0('0x5e')][_0x8bd0('0x123')](db['OpenchannelQueue'],{});db[_0x8bd0('0x18d')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':'Agent','foreignKey':_0x8bd0('0x115'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x18d')][_0x8bd0('0x123')](db[_0x8bd0('0x64')],{'as':'Queue','foreignKey':_0x8bd0('0x18e'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x18d')]['belongsTo'](db[_0x8bd0('0x5c')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x18d')]['belongsTo'](db['Tag'],{'onDelete':_0x8bd0('0x15d'),'foreignKey':_0x8bd0('0x178')});db[_0x8bd0('0x60')]['hasMany'](db[_0x8bd0('0x18f')],{'as':_0x8bd0('0x152'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x190')});db['ChatInteraction'][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{'as':_0x8bd0('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x8bd0('0x60')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x60')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x17a'),'foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x60')][_0x8bd0('0x125')](db['Tag'],{'through':_0x8bd0('0x191'),'as':_0x8bd0('0x16b')});db['ChatInteraction']['belongsToMany'](db[_0x8bd0('0x88')],{'through':'chat_interaction_has_tags','as':_0x8bd0('0x16d')});db['ChatInteraction'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x8bd0('0x190')});db[_0x8bd0('0x18f')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'onDelete':'cascade','as':_0x8bd0('0x111')});db[_0x8bd0('0x18f')][_0x8bd0('0x123')](db['CmContact'],{'onDelete':_0x8bd0('0x114'),'as':'Contact','foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x18f')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0x8bd0('0x183'),'foreignKey':_0x8bd0('0x190')});db[_0x8bd0('0x18f')][_0x8bd0('0x123')](db['Attachment'],{'as':'Attachment','foreignKey':_0x8bd0('0x17b')});db[_0x8bd0('0x18f')][_0x8bd0('0x123')](db['ChatWebsite'],{'as':_0x8bd0('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x8bd0('0x171')][_0x8bd0('0x119')](db[_0x8bd0('0xe8')],{'as':'Attachments','foreignKey':_0x8bd0('0x172'),'onDelete':'cascade','hooks':!![]});db[_0x8bd0('0x171')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'onDelete':_0x8bd0('0x114'),'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x171')][_0x8bd0('0x123')](db['ChatWebsite'],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x170')});db[_0x8bd0('0x64')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x2c'),'hooks':!![]});db[_0x8bd0('0x64')][_0x8bd0('0x125')](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x192'),'as':_0x8bd0('0x168')});db[_0x8bd0('0x66')][_0x8bd0('0x119')](db[_0x8bd0('0xce')],{'as':_0x8bd0('0x152'),'foreignKey':'ChatGroupId','onDelete':_0x8bd0('0x114')});db['ChatGroup'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x144'),'through':'chat_group_has_users'});db[_0x8bd0('0x68')][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{'as':_0x8bd0('0x193'),'foreignKey':'ChatWebsiteId'});db[_0x8bd0('0x6a')][_0x8bd0('0x119')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x194'),'foreignKey':_0x8bd0('0x195')});db['CmContact'][_0x8bd0('0x119')](db[_0x8bd0('0x8c')],{'as':_0x8bd0('0x196'),'foreignKey':_0x8bd0('0x197')});db[_0x8bd0('0x6c')]['hasMany'](db[_0x8bd0('0x146')],{'as':_0x8bd0('0x198'),'foreignKey':_0x8bd0('0x15a')});db['CmContact'][_0x8bd0('0x119')](db['CmHopperFinal'],{'as':_0x8bd0('0x11a'),'foreignKey':_0x8bd0('0x15a')});db['CmContact'][_0x8bd0('0x119')](db[_0x8bd0('0x11b')],{'as':_0x8bd0('0x147'),'foreignKey':_0x8bd0('0x15a')});db['CmContact'][_0x8bd0('0x119')](db[_0x8bd0('0x73')],{'as':_0x8bd0('0x73'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0x6c')][_0x8bd0('0x119')](db[_0x8bd0('0xd4')],{'as':_0x8bd0('0x199'),'foreignKey':'ContactId'});db[_0x8bd0('0x6c')]['hasMany'](db[_0x8bd0('0x58')],{'as':_0x8bd0('0x19a'),'foreignKey':_0x8bd0('0x15a'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x6c')][_0x8bd0('0x119')](db[_0x8bd0('0x60')],{'as':_0x8bd0('0x19b'),'foreignKey':_0x8bd0('0x15a'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x6c')][_0x8bd0('0x119')](db[_0x8bd0('0x50')],{'as':_0x8bd0('0x11d'),'foreignKey':'ContactId','onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x6c')]['hasMany'](db[_0x8bd0('0x48')],{'as':_0x8bd0('0x11e'),'foreignKey':_0x8bd0('0x15a'),'onDelete':'restrict'});db[_0x8bd0('0x6c')][_0x8bd0('0x119')](db[_0x8bd0('0x3b')],{'as':'MailInteractions','foreignKey':_0x8bd0('0x15a'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x6c')]['belongsTo'](db['CmCompany'],{'as':_0x8bd0('0x19c'),'foreignKey':_0x8bd0('0x195')});db[_0x8bd0('0x6c')]['belongsTo'](db['CmList'],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x6c')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x16e'),'through':_0x8bd0('0x127')});db[_0x8bd0('0x6c')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'as':_0x8bd0('0x16b'),'through':_0x8bd0('0x19d')});db[_0x8bd0('0x6c')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x19d'),'as':'ThroughTags'});db['CmHopper'][_0x8bd0('0x119')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0x8bd0('0x146')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':'Contact','foreignKey':_0x8bd0('0x15a'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x146')][_0x8bd0('0x123')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x146')][_0x8bd0('0x123')](db['User'],{'as':'Agent','foreignKey':_0x8bd0('0x115')});db[_0x8bd0('0x146')][_0x8bd0('0x123')](db[_0x8bd0('0x19')],{'as':_0x8bd0('0x19e'),'foreignKey':_0x8bd0('0x145'),'onDelete':'cascade'});db[_0x8bd0('0x146')][_0x8bd0('0x123')](db[_0x8bd0('0x19f')],{'as':_0x8bd0('0x19f'),'foreignKey':_0x8bd0('0x1a0'),'onDelete':_0x8bd0('0x114')});db['CmHopper'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x17a'),'foreignKey':_0x8bd0('0x1a1')});db[_0x8bd0('0x6f')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a'),'onDelete':_0x8bd0('0x114')});db['CmHopperBlack']['belongsTo'](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x8bd0('0x19')],{'as':'Queue','foreignKey':_0x8bd0('0x145'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x6f')][_0x8bd0('0x123')](db[_0x8bd0('0x19f')],{'as':'Campaign','foreignKey':_0x8bd0('0x1a0'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x77')][_0x8bd0('0x119')](db['Condition'],{'as':{'plural':'All','singular':_0x8bd0('0x1a2')},'foreignKey':_0x8bd0('0x1a3'),'onDelete':_0x8bd0('0x114'),'hooks':!![]});db[_0x8bd0('0x77')][_0x8bd0('0x119')](db['Condition'],{'as':{'plural':'Any','singular':_0x8bd0('0x1a4')},'foreignKey':_0x8bd0('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x8bd0('0x77')][_0x8bd0('0x119')](db[_0x8bd0('0x76')],{'as':_0x8bd0('0x1a6'),'foreignKey':'AutomationId','onDelete':_0x8bd0('0x114'),'hooks':!![]});db[_0x8bd0('0x7b')][_0x8bd0('0x119')](db[_0x8bd0('0x7b')],{'as':_0x8bd0('0x160'),'foreignKey':_0x8bd0('0x1a7'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0x7e')][_0x8bd0('0x119')](db[_0x8bd0('0x7e')],{'as':_0x8bd0('0x1a8'),'foreignKey':_0x8bd0('0x14c'),'onDelete':_0x8bd0('0x114'),'hooks':!![],'required':![]});db[_0x8bd0('0x7e')][_0x8bd0('0x119')](db[_0x8bd0('0x15')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x8bd0('0x15d')});db['Interval'][_0x8bd0('0x119')](db[_0x8bd0('0x3e')],{'as':_0x8bd0('0x1a9'),'foreignKey':'IntervalId'});db[_0x8bd0('0x7e')][_0x8bd0('0x119')](db[_0x8bd0('0x18d')],{'as':_0x8bd0('0x1aa'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x8bd0('0x46')],{'as':'FaxApplications','foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x7e')][_0x8bd0('0x119')](db[_0x8bd0('0x4e')],{'as':'SmsApplications','foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x85')][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{});db[_0x8bd0('0x85')][_0x8bd0('0x123')](db['AnalyticDefaultReport'],{'foreignKey':_0x8bd0('0x1ab')});db[_0x8bd0('0x85')][_0x8bd0('0x123')](db[_0x8bd0('0x94')],{'foreignKey':_0x8bd0('0x1ac')});db[_0x8bd0('0x142')]['belongsToMany'](db[_0x8bd0('0x17')],{'as':_0x8bd0('0x1ad'),'through':_0x8bd0('0x1ae'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x88')]['belongsToMany'](db[_0x8bd0('0x6c')],{'through':'cm_contact_has_tags'});db[_0x8bd0('0x88')][_0x8bd0('0x125')](db[_0x8bd0('0x60')],{'through':_0x8bd0('0x191')});db[_0x8bd0('0x88')][_0x8bd0('0x125')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x8bd0('0x88')][_0x8bd0('0x125')](db[_0x8bd0('0x50')],{'through':'sms_interaction_has_tags'});db[_0x8bd0('0x88')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x8bd0('0x88')][_0x8bd0('0x125')](db['OpenchannelInteraction'],{'through':_0x8bd0('0x189')});db[_0x8bd0('0x88')][_0x8bd0('0x125')](db[_0x8bd0('0x120')],{'through':_0x8bd0('0x1af')});db[_0x8bd0('0x8c')][_0x8bd0('0x123')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x8bd0('0x1b0')});db['CmHopperAdditionalPhone'][_0x8bd0('0x123')](db[_0x8bd0('0x146')],{'as':'Hopper','foreignKey':_0x8bd0('0x1b1')});db[_0x8bd0('0x8c')]['belongsTo'](db['CmContact'],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x197')});db[_0x8bd0('0x90')]['hasMany'](db[_0x8bd0('0x7d')],{'as':{'plural':_0x8bd0('0x1b2'),'singular':_0x8bd0('0x1b3')},'foreignKey':'TriggerAllId','onDelete':_0x8bd0('0x114'),'hooks':!![]});db['Trigger'][_0x8bd0('0x119')](db[_0x8bd0('0x7d')],{'as':{'plural':_0x8bd0('0x1b4'),'singular':_0x8bd0('0x1b5')},'foreignKey':_0x8bd0('0x1b6'),'onDelete':_0x8bd0('0x114'),'hooks':!![]});db[_0x8bd0('0x90')][_0x8bd0('0x119')](db[_0x8bd0('0x76')],{'as':_0x8bd0('0x1a6'),'foreignKey':_0x8bd0('0x1b7'),'onDelete':_0x8bd0('0x114'),'hooks':!![]});db['AnalyticCustomReport'][_0x8bd0('0x119')](db[_0x8bd0('0x1b8')],{'as':_0x8bd0('0x1b9'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1ac'),'hooks':!![]});db[_0x8bd0('0x96')][_0x8bd0('0x119')](db[_0x8bd0('0x1b8')],{'as':_0x8bd0('0x1b9'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1ab')});db[_0x8bd0('0x9a')]['hasMany'](db[_0x8bd0('0x1b8')],{'as':_0x8bd0('0x1b9'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1ba')});db[_0x8bd0('0x1b8')][_0x8bd0('0x123')](db[_0x8bd0('0x9a')],{'foreignKey':_0x8bd0('0x1ba')});db[_0x8bd0('0x1bb')]['hasMany'](db[_0x8bd0('0x9e')],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0x9e')][_0x8bd0('0x119')](db[_0x8bd0('0x1be')],{'as':_0x8bd0('0x1bf'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c0')});db['SalesforceConfiguration']['hasMany'](db[_0x8bd0('0x1be')],{'as':_0x8bd0('0x1c1'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0x9e')][_0x8bd0('0x119')](db[_0x8bd0('0x1be')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0x9e')][_0x8bd0('0x123')](db[_0x8bd0('0x1bb')],{'as':_0x8bd0('0x16a'),'foreignKey':'AccountId'});db[_0x8bd0('0x1be')][_0x8bd0('0x119')](db[_0x8bd0('0x1be')],{'as':_0x8bd0('0x1c4'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x8bd0('0x119')](db['SalesforceField'],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0x1be')][_0x8bd0('0x119')](db['SalesforceField'],{'as':'Field','foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0x1be')][_0x8bd0('0x123')](db['Variable'],{'as':_0x8bd0('0x1c6'),'foreignKey':'VariableId'});db[_0x8bd0('0xa1')][_0x8bd0('0x119')](db[_0x8bd0('0xa3')],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xa3')][_0x8bd0('0x119')](db[_0x8bd0('0xa5')],{'as':_0x8bd0('0x1bf'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xa3')][_0x8bd0('0x119')](db[_0x8bd0('0xa5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x8bd0('0xa3')][_0x8bd0('0x119')](db[_0x8bd0('0xa5')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x8bd0('0xa3')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x8bd0('0x16a'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x8bd0('0x119')](db[_0x8bd0('0xa5')],{'as':_0x8bd0('0x1c4'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xa5')]['hasMany'](db[_0x8bd0('0xa5')],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db['SugarcrmField'][_0x8bd0('0x119')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x8bd0('0xa5')]['belongsTo'](db['Variable'],{'as':_0x8bd0('0x1c6'),'foreignKey':_0x8bd0('0x1c7')});db[_0x8bd0('0xa7')][_0x8bd0('0x119')](db[_0x8bd0('0xa9')],{'as':_0x8bd0('0x1bc'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1bd')});db['DeskConfiguration'][_0x8bd0('0x119')](db['DeskField'],{'as':_0x8bd0('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8bd0('0xa9')][_0x8bd0('0x119')](db[_0x8bd0('0xab')],{'as':_0x8bd0('0x1c1'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xa9')]['hasMany'](db[_0x8bd0('0xab')],{'as':_0x8bd0('0x1b9'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xa9')]['belongsTo'](db[_0x8bd0('0xa7')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xa9')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x1c8')});db[_0x8bd0('0xab')][_0x8bd0('0x119')](db[_0x8bd0('0xab')],{'as':_0x8bd0('0x1c4'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xab')][_0x8bd0('0x119')](db['DeskField'],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xab')]['hasMany'](db[_0x8bd0('0xab')],{'as':_0x8bd0('0x1c9'),'foreignKey':'FieldId'});db[_0x8bd0('0xab')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8bd0('0xad')][_0x8bd0('0x119')](db['ZohoConfiguration'],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xaf')][_0x8bd0('0x119')](db[_0x8bd0('0xb1')],{'as':_0x8bd0('0x1bf'),'onDelete':_0x8bd0('0x114'),'foreignKey':'SubjectId'});db[_0x8bd0('0xaf')][_0x8bd0('0x119')](db[_0x8bd0('0xb1')],{'as':_0x8bd0('0x1c1'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c2')});db['ZohoConfiguration'][_0x8bd0('0x119')](db['ZohoField'],{'as':_0x8bd0('0x1b9'),'onDelete':_0x8bd0('0x114'),'foreignKey':'FieldId'});db[_0x8bd0('0xaf')][_0x8bd0('0x123')](db[_0x8bd0('0xad')],{'as':'Account','foreignKey':_0x8bd0('0x1bd')});db['ZohoField'][_0x8bd0('0x119')](db[_0x8bd0('0xb1')],{'as':'Subject','foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xb1')][_0x8bd0('0x119')](db['ZohoField'],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xb1')]['hasMany'](db[_0x8bd0('0xb1')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xb1')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8bd0('0x1ca')][_0x8bd0('0x119')](db['ZendeskConfiguration'],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x8bd0('0x119')](db[_0x8bd0('0xb6')],{'as':_0x8bd0('0x1bf'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xb4')][_0x8bd0('0x119')](db[_0x8bd0('0xb6')],{'as':_0x8bd0('0x1c1'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xb4')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x8bd0('0xb4')][_0x8bd0('0x123')](db[_0x8bd0('0x1ca')],{'as':'Account','foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xb4')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x8bd0('0x119')](db['ZendeskField'],{'as':_0x8bd0('0x1c4'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xb6')][_0x8bd0('0x119')](db[_0x8bd0('0xb6')],{'as':_0x8bd0('0x1c5'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db[_0x8bd0('0xb6')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xb6')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':_0x8bd0('0x1c6'),'foreignKey':_0x8bd0('0x1c7')});db[_0x8bd0('0x1cb')][_0x8bd0('0x119')](db[_0x8bd0('0xb8')],{'as':_0x8bd0('0x1bc'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xb8')]['hasMany'](db[_0x8bd0('0x1cc')],{'as':_0x8bd0('0x1bf'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c0')});db['FreshdeskConfiguration'][_0x8bd0('0x119')](db[_0x8bd0('0x1cc')],{'as':_0x8bd0('0x1c1'),'onDelete':_0x8bd0('0x114'),'foreignKey':'DescriptionId'});db[_0x8bd0('0xb8')][_0x8bd0('0x119')](db[_0x8bd0('0x1cc')],{'as':_0x8bd0('0x1b9'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c3')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xb8')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x8bd0('0x1cc')][_0x8bd0('0x119')](db[_0x8bd0('0x1cc')],{'as':_0x8bd0('0x1c4'),'foreignKey':'SubjectId'});db[_0x8bd0('0x1cc')][_0x8bd0('0x119')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8bd0('0x1cc')][_0x8bd0('0x119')](db[_0x8bd0('0x1cc')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0x1cc')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':'Variable','foreignKey':_0x8bd0('0x1c7')});db[_0x8bd0('0xba')][_0x8bd0('0x119')](db['VtigerConfiguration'],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xbb')][_0x8bd0('0x119')](db[_0x8bd0('0xbd')],{'as':_0x8bd0('0x1bf'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xbb')]['hasMany'](db[_0x8bd0('0xbd')],{'as':_0x8bd0('0x1c1'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xbb')][_0x8bd0('0x119')](db[_0x8bd0('0xbd')],{'as':_0x8bd0('0x1b9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xbb')][_0x8bd0('0x123')](db[_0x8bd0('0xba')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xbd')][_0x8bd0('0x119')](db['VtigerField'],{'as':'Subject','foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xbd')][_0x8bd0('0x119')](db['VtigerField'],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db['VtigerField'][_0x8bd0('0x119')](db[_0x8bd0('0xbd')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xbd')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':'Variable','foreignKey':_0x8bd0('0x1c7')});db['ServicenowAccount'][_0x8bd0('0x119')](db['ServicenowConfiguration'],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':'AccountId'});db[_0x8bd0('0xbf')]['hasMany'](db['ServicenowField'],{'as':_0x8bd0('0x1bf'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xbf')]['hasMany'](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xbf')][_0x8bd0('0x119')](db[_0x8bd0('0xc1')],{'as':_0x8bd0('0x1b9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xbf')][_0x8bd0('0x123')](db[_0x8bd0('0x1cd')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xc1')][_0x8bd0('0x119')](db[_0x8bd0('0xc1')],{'as':'Subject','foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0xc1')]['hasMany'](db[_0x8bd0('0xc1')],{'as':'Description','foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xc1')][_0x8bd0('0x119')](db[_0x8bd0('0xc1')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db['ServicenowField'][_0x8bd0('0x123')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x8bd0('0x1ce')][_0x8bd0('0x119')](db[_0x8bd0('0x1cf')],{'as':_0x8bd0('0x1bc'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db['Dynamics365Account'][_0x8bd0('0x123')](db['CloudProvider'],{'as':_0x8bd0('0x15c'),'foreignKey':_0x8bd0('0x15e')});db['Dynamics365Configuration'][_0x8bd0('0x119')](db['Dynamics365Field'],{'as':_0x8bd0('0x1bf'),'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1c0')});db[_0x8bd0('0x1cf')]['hasMany'](db[_0x8bd0('0xc3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x8bd0('0x119')](db['Dynamics365Field'],{'as':_0x8bd0('0x1b9'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1c3')});db['Dynamics365Configuration']['belongsTo'](db['Dynamics365Account'],{'as':_0x8bd0('0x16a'),'foreignKey':'AccountId'});db[_0x8bd0('0xc3')][_0x8bd0('0x119')](db[_0x8bd0('0xc3')],{'as':_0x8bd0('0x1c4'),'foreignKey':'SubjectId'});db[_0x8bd0('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xc3')][_0x8bd0('0x119')](db[_0x8bd0('0xc3')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xc3')][_0x8bd0('0x123')](db[_0x8bd0('0x1c6')],{'as':'Variable','foreignKey':_0x8bd0('0x1c7')});db[_0x8bd0('0xc5')][_0x8bd0('0x119')](db[_0x8bd0('0xc7')],{'as':'Configurations','onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xc7')]['hasMany'](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1bf'),'foreignKey':_0x8bd0('0x1c0')});db['FreshsalesConfiguration'][_0x8bd0('0x119')](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1c1'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x8bd0('0x119')](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1b9'),'foreignKey':'FieldId'});db[_0x8bd0('0xc7')][_0x8bd0('0x123')](db[_0x8bd0('0xc5')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x1bd')});db[_0x8bd0('0xc8')][_0x8bd0('0x119')](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1c4'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x8bd0('0x119')](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1c5'),'foreignKey':_0x8bd0('0x1c2')});db[_0x8bd0('0xc8')]['hasMany'](db[_0x8bd0('0xc8')],{'as':_0x8bd0('0x1c9'),'foreignKey':_0x8bd0('0x1c3')});db[_0x8bd0('0xc8')][_0x8bd0('0x123')](db['Variable'],{'as':_0x8bd0('0x1c6'),'foreignKey':'VariableId'});db[_0x8bd0('0xcc')][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{});db['ChatQueueReport']['belongsTo'](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xcc')][_0x8bd0('0x123')](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0xcc')][_0x8bd0('0x123')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x18f')],{});db[_0x8bd0('0xcc')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{});db['ChatQueueReport']['belongsTo'](db['ChatQueue'],{});db[_0x8bd0('0xce')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'onDelete':_0x8bd0('0x114'),'foreignKey':_0x8bd0('0x1d0')});db[_0x8bd0('0xce')][_0x8bd0('0x123')](db['User'],{'onDelete':_0x8bd0('0x114'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x8bd0('0x119')](db[_0x8bd0('0xd2')],{'foreignKey':'SessionId','onDelete':_0x8bd0('0x114')});db[_0x8bd0('0xd4')]['hasMany'](db[_0x8bd0('0xd0')],{'foreignKey':_0x8bd0('0x1d1'),'onDelete':'cascade'});db['SmsQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x17e')],{});db[_0x8bd0('0xd6')][_0x8bd0('0x123')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xd6')]['belongsTo'](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db[_0x8bd0('0xd6')][_0x8bd0('0x123')](db[_0x8bd0('0x50')],{});db['SmsQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x52')],{});db[_0x8bd0('0xd6')]['belongsTo'](db[_0x8bd0('0x111')],{});db['SmsQueueReport'][_0x8bd0('0x123')](db[_0x8bd0('0x54')],{});db['JscriptyProject'][_0x8bd0('0x119')](db[_0x8bd0('0xd4')],{'foreignKey':'ProjectId'});db[_0x8bd0('0xd9')][_0x8bd0('0x119')](db['JscriptyQuestionReport'],{'foreignKey':_0x8bd0('0x1d2')});db['JscriptyProject'][_0x8bd0('0x119')](db[_0x8bd0('0xd0')],{'foreignKey':_0x8bd0('0x1d2')});db[_0x8bd0('0xe2')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x129')});db[_0x8bd0('0xe2')]['belongsToMany'](db[_0x8bd0('0x19')],{'through':'TeamVoiceQueue','as':_0x8bd0('0x130')});db['Team'][_0x8bd0('0x125')](db[_0x8bd0('0x37')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team']['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team'][_0x8bd0('0x125')](db[_0x8bd0('0x4c')],{'through':_0x8bd0('0x17c'),'as':_0x8bd0('0x133')});db['Team'][_0x8bd0('0x125')](db[_0x8bd0('0x54')],{'through':_0x8bd0('0x1d3'),'as':'SmsQueues'});db[_0x8bd0('0xe2')][_0x8bd0('0x125')](db[_0x8bd0('0x5b')],{'through':_0x8bd0('0x18c'),'as':_0x8bd0('0x135')});db['Team'][_0x8bd0('0x125')](db[_0x8bd0('0x109')],{'through':_0x8bd0('0x1d4'),'as':_0x8bd0('0x136')});db['Team'][_0x8bd0('0x125')](db['VoicePrefix'],{'through':_0x8bd0('0x10b'),'as':_0x8bd0('0x131')});db[_0x8bd0('0x19f')][_0x8bd0('0x119')](db[_0x8bd0('0x146')],{'as':_0x8bd0('0x198'),'foreignKey':_0x8bd0('0x1a0')});db[_0x8bd0('0x19f')][_0x8bd0('0x119')](db[_0x8bd0('0x70')],{'as':_0x8bd0('0x11a'),'foreignKey':_0x8bd0('0x1a0')});db[_0x8bd0('0x19f')][_0x8bd0('0x119')](db[_0x8bd0('0x11b')],{'as':'HopperHistories','foreignKey':_0x8bd0('0x1a0')});db[_0x8bd0('0x19f')]['hasMany'](db['CmHopperBlack'],{'as':_0x8bd0('0x148'),'foreignKey':_0x8bd0('0x1a0')});db[_0x8bd0('0x19f')][_0x8bd0('0x123')](db['Trunk'],{'as':'Trunk','foreignKey':_0x8bd0('0x149')});db[_0x8bd0('0x19f')][_0x8bd0('0x123')](db[_0x8bd0('0x176')],{'as':_0x8bd0('0x14a'),'foreignKey':'TrunkBackupId'});db[_0x8bd0('0x19f')][_0x8bd0('0x123')](db[_0x8bd0('0x7e')],{'as':'Interval','foreignKey':_0x8bd0('0x14c')});db[_0x8bd0('0x19f')][_0x8bd0('0x123')](db[_0x8bd0('0xdd')],{'as':'SquareProject','foreignKey':_0x8bd0('0x1d5')});db[_0x8bd0('0x19f')][_0x8bd0('0x125')](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x128'),'through':_0x8bd0('0x1d6')});db[_0x8bd0('0x19f')]['belongsToMany'](db['CmList'],{'as':_0x8bd0('0x151'),'through':_0x8bd0('0x1d7')});db[_0x8bd0('0xe8')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x8bd0('0x172')});db[_0x8bd0('0xec')][_0x8bd0('0x123')](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x8bd0('0x3b')],{});db[_0x8bd0('0xec')][_0x8bd0('0x123')](db['MailAccount'],{'foreignKey':_0x8bd0('0x1d8'),'as':_0x8bd0('0x1d9')});db['MailTransferReport'][_0x8bd0('0x123')](db['User'],{'foreignKey':_0x8bd0('0x1da'),'as':_0x8bd0('0x1db')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x8bd0('0x1dc')});db[_0x8bd0('0xec')]['belongsTo'](db[_0x8bd0('0x37')],{'foreignKey':_0x8bd0('0x1dd'),'as':_0x8bd0('0x1de')});db[_0x8bd0('0xec')][_0x8bd0('0x123')](db[_0x8bd0('0x35')],{'foreignKey':_0x8bd0('0x1df'),'as':'ToAccount'});db['ChatTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x18f')],{});db['ChatTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x60')],{});db[_0x8bd0('0x1e0')][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{'foreignKey':_0x8bd0('0x1e1'),'as':_0x8bd0('0x1d9')});db[_0x8bd0('0x1e0')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':_0x8bd0('0x1da'),'as':_0x8bd0('0x1db')});db[_0x8bd0('0x1e0')]['belongsTo'](db['User'],{'foreignKey':_0x8bd0('0x1e2'),'as':_0x8bd0('0x1dc')});db['ChatTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x64')],{'foreignKey':'ToChatQueueId','as':_0x8bd0('0x1de')});db['ChatTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x5c')],{'foreignKey':_0x8bd0('0x1e3'),'as':_0x8bd0('0x1e4')});db['FaxTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x4a')],{});db[_0x8bd0('0xee')][_0x8bd0('0x123')](db[_0x8bd0('0x48')],{});db[_0x8bd0('0xee')][_0x8bd0('0x123')](db[_0x8bd0('0x44')],{'foreignKey':_0x8bd0('0x1e5'),'as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x8bd0('0x1db')});db[_0x8bd0('0xee')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':_0x8bd0('0x1e2'),'as':'ToAgent'});db[_0x8bd0('0xee')][_0x8bd0('0x123')](db['FaxQueue'],{'foreignKey':_0x8bd0('0x1e6'),'as':_0x8bd0('0x1de')});db[_0x8bd0('0xee')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8bd0('0x1e7'),'as':_0x8bd0('0x1e4')});db['OpenchannelTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x187')],{});db[_0x8bd0('0x1e8')][_0x8bd0('0x123')](db['OpenchannelInteraction'],{});db[_0x8bd0('0x1e8')]['belongsTo'](db[_0x8bd0('0x55')],{'foreignKey':_0x8bd0('0x1e9'),'as':_0x8bd0('0x1d9')});db[_0x8bd0('0x1e8')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':_0x8bd0('0x1da'),'as':_0x8bd0('0x1db')});db['OpenchannelTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':_0x8bd0('0x1e2'),'as':_0x8bd0('0x1dc')});db[_0x8bd0('0x1e8')][_0x8bd0('0x123')](db[_0x8bd0('0x5b')],{'foreignKey':'ToOpenchannelQueueId','as':_0x8bd0('0x1de')});db['OpenchannelTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x55')],{'foreignKey':_0x8bd0('0x1ea'),'as':_0x8bd0('0x1e4')});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db[_0x8bd0('0x52')],{});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db[_0x8bd0('0x50')],{});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db['SmsAccount'],{'foreignKey':_0x8bd0('0x1eb'),'as':_0x8bd0('0x1d9')});db['SmsTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':'FromUserId','as':_0x8bd0('0x1db')});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':_0x8bd0('0x1e2'),'as':_0x8bd0('0x1dc')});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db['SmsQueue'],{'foreignKey':_0x8bd0('0x1ec'),'as':_0x8bd0('0x1de')});db[_0x8bd0('0xf1')][_0x8bd0('0x123')](db[_0x8bd0('0x17e')],{'foreignKey':'ToSmsAccountId','as':_0x8bd0('0x1e4')});db[_0x8bd0('0xf3')]['hasMany'](db[_0x8bd0('0x7b')],{'as':'Dispositions','foreignKey':_0x8bd0('0x163'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0xf3')]['hasMany'](db[_0x8bd0('0x75')],{'as':_0x8bd0('0x1ed'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xf3')]['hasMany'](db[_0x8bd0('0x6c')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xf3')][_0x8bd0('0x119')](db[_0x8bd0('0x70')],{'as':_0x8bd0('0x11a'),'foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xf3')][_0x8bd0('0x119')](db[_0x8bd0('0x11b')],{'as':'HopperHistory','foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0xf3')]['hasMany'](db[_0x8bd0('0x73')],{'as':_0x8bd0('0x73'),'foreignKey':_0x8bd0('0x163')});db['CmList'][_0x8bd0('0x125')](db[_0x8bd0('0x19')],{'as':_0x8bd0('0x1ee'),'through':_0x8bd0('0x1ef')});db['CmList']['belongsToMany'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x137')});db[_0x8bd0('0xf5')][_0x8bd0('0x119')](db[_0x8bd0('0x15')],{'as':_0x8bd0('0x1f0'),'onDelete':'cascade'});db[_0x8bd0('0xf5')][_0x8bd0('0x125')](db['User'],{'as':_0x8bd0('0x14e'),'through':'UserVoicePrefix'});db[_0x8bd0('0xf5')]['belongsToMany'](db['Team'],{'through':'TeamVoicePrefix','as':_0x8bd0('0x168')});db['UserProfile'][_0x8bd0('0x119')](db[_0x8bd0('0x111')],{'as':'Users','foreignKey':_0x8bd0('0x124')});db[_0x8bd0('0xf7')]['hasMany'](db[_0x8bd0('0xf9')],{'as':_0x8bd0('0x1f1'),'foreignKey':'userProfileId','onDelete':_0x8bd0('0x114')});db[_0x8bd0('0xf9')][_0x8bd0('0x119')](db['UserProfileResource'],{'as':_0x8bd0('0x1f2'),'foreignKey':_0x8bd0('0x1f3'),'onDelete':_0x8bd0('0x114')});db[_0x8bd0('0xff')][_0x8bd0('0x119')](db[_0x8bd0('0x7b')],{'as':_0x8bd0('0x160'),'foreignKey':_0x8bd0('0x1f4'),'onDelete':'cascade'});db['WhatsappAccount'][_0x8bd0('0x119')](db[_0x8bd0('0x79')],{'as':_0x8bd0('0x17f'),'foreignKey':'WhatsappAccountId'});db[_0x8bd0('0xff')][_0x8bd0('0x119')](db['WhatsappMessage'],{'as':_0x8bd0('0x152'),'foreignKey':_0x8bd0('0x1f4')});db['WhatsappAccount'][_0x8bd0('0x119')](db[_0x8bd0('0x120')],{'as':_0x8bd0('0x161')});db[_0x8bd0('0xff')][_0x8bd0('0x119')](db['WhatsappApplication'],{'as':_0x8bd0('0x175')});db['WhatsappAccount']['belongsTo'](db[_0x8bd0('0xf3')],{'as':_0x8bd0('0x162'),'foreignKey':_0x8bd0('0x163')});db['WhatsappAccount']['belongsTo'](db[_0x8bd0('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8bd0('0xff')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x140')});db[_0x8bd0('0x101')]['belongsTo'](db[_0x8bd0('0x111')],{'onDelete':'restrict'});db[_0x8bd0('0x101')][_0x8bd0('0x123')](db[_0x8bd0('0x109')],{'onDelete':'restrict'});db[_0x8bd0('0x101')][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x101')][_0x8bd0('0x123')](db[_0x8bd0('0x7e')],{'onDelete':_0x8bd0('0x15d'),'foreignKey':'IntervalId'});db[_0x8bd0('0x101')]['belongsTo'](db['Tag'],{'onDelete':_0x8bd0('0x15d'),'foreignKey':_0x8bd0('0x178')});db[_0x8bd0('0x120')][_0x8bd0('0x119')](db[_0x8bd0('0x104')],{'as':_0x8bd0('0x152'),'onDelete':'cascade','foreignKey':_0x8bd0('0x1f5')});db[_0x8bd0('0x120')][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{'as':'Account','foreignKey':_0x8bd0('0x1f4')});db[_0x8bd0('0x120')]['belongsTo'](db[_0x8bd0('0x6c')],{'as':_0x8bd0('0x159'),'foreignKey':_0x8bd0('0x15a')});db['WhatsappInteraction'][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'as':'Owner','foreignKey':'UserId'});db[_0x8bd0('0x120')][_0x8bd0('0x125')](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x1af'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0x8bd0('0x88')],{'through':_0x8bd0('0x1af'),'as':_0x8bd0('0x16d')});db[_0x8bd0('0x120')][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x16e'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x111')});db[_0x8bd0('0x104')]['belongsTo'](db[_0x8bd0('0x6c')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage'][_0x8bd0('0x123')](db[_0x8bd0('0x120')],{'onDelete':'cascade','as':_0x8bd0('0x183'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{'as':_0x8bd0('0x16a'),'foreignKey':_0x8bd0('0x1f4')});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db['CmList'],{'as':'List','foreignKey':_0x8bd0('0x163')});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db['CmContact'],{'as':_0x8bd0('0x159'),'foreignKey':'ContactId'});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db[_0x8bd0('0x120')],{});db[_0x8bd0('0x1f6')]['belongsTo'](db[_0x8bd0('0x109')],{});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db[_0x8bd0('0x104')],{});db[_0x8bd0('0x1f6')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{});db[_0x8bd0('0x107')]['belongsTo'](db[_0x8bd0('0x104')],{});db[_0x8bd0('0x107')][_0x8bd0('0x123')](db[_0x8bd0('0x120')],{});db[_0x8bd0('0x107')][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{'foreignKey':'FromWhatsappAccountId','as':_0x8bd0('0x1d9')});db[_0x8bd0('0x107')][_0x8bd0('0x123')](db[_0x8bd0('0xff')],{'foreignKey':_0x8bd0('0x1f7'),'as':_0x8bd0('0x1e4')});db['WhatsappTransferReport'][_0x8bd0('0x123')](db[_0x8bd0('0x109')],{'foreignKey':'ToQueueId','as':_0x8bd0('0x1de')});db[_0x8bd0('0x107')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8bd0('0x107')][_0x8bd0('0x123')](db[_0x8bd0('0x111')],{'foreignKey':'ToUserId','as':_0x8bd0('0x1dc')});db['WhatsappQueue'][_0x8bd0('0x125')](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x14e'),'through':_0x8bd0('0x1f8'),'foreignKey':_0x8bd0('0x1f9')});db[_0x8bd0('0x109')]['belongsToMany'](db[_0x8bd0('0xe2')],{'through':_0x8bd0('0x1d4'),'as':_0x8bd0('0x168')});db[_0x8bd0('0x10f')]['belongsTo'](db[_0x8bd0('0x111')],{'as':_0x8bd0('0x1fa'),'foreignKey':_0x8bd0('0x115'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x8bd0('0x112')](db['Dynamics365Account'],{'as':_0x8bd0('0x1ce'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x15c')][_0x8bd0('0x112')](db[_0x8bd0('0x32')],{'as':_0x8bd0('0x1fb'),'onDelete':_0x8bd0('0x15d')});db[_0x8bd0('0x15c')][_0x8bd0('0x112')](db[_0x8bd0('0x33')],{'as':_0x8bd0('0x15f'),'onDelete':'restrict'});module[_0x8bd0('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc1de=['MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','restrict','MailAccountId','CloudProviderId','Imap','Disposition','CannedAnswer','Answers','List','ListId','Template','TemplateId','MailInteractionId','Owner','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Interactions','user_has_fax_accounts','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','FaxMessage','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','Interaction','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Website','CmContactId','CmHopper','Hoppers','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CampaignId','OwnerId','All','AutomationAllId','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','Fields','CustomReportId','MetricId','AnalyticMetric','AccountId','Subjects','SubjectId','Descriptions','Subject','Description','DescriptionId','Variable','VariableId','Configurations','FieldId','DeskField','Field','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Configuration','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','user_has_teams','VoiceQueues','team_has_mail_queues','team_has_sms_queues','team_has_whatsapp_queues','WhatsappQueues','Lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0xc1de,0x1ba));var _0xec1d=function(_0x4ebfa2,_0x1b15a8){_0x4ebfa2=_0x4ebfa2-0x0;var _0x4d1d65=_0xc1de[_0x4ebfa2];return _0x4d1d65;};'use strict';var config=require(_0xec1d('0x0'));var Sequelize=require(_0xec1d('0x1'));var _=require(_0xec1d('0x2'));var jstz=require(_0xec1d('0x3'));var timezone=jstz[_0xec1d('0x4')]();config[_0xec1d('0x1')]=_[_0xec1d('0x5')](config[_0xec1d('0x1')],{'database':_0xec1d('0x6'),'username':_0xec1d('0x7'),'password':_0xec1d('0x8'),'options':{'host':_0xec1d('0x9'),'port':0xcea,'dialect':_0xec1d('0xa'),'dialectOptions':{'charset':_0xec1d('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xec1d('0xc')}}});config[_0xec1d('0xd')]=_[_0xec1d('0x5')](config[_0xec1d('0xd')],{'database':_0xec1d('0x6'),'username':'xcall','password':_0xec1d('0x8'),'options':{'host':_0xec1d('0x9'),'port':0xcea,'dialect':_0xec1d('0xa'),'dialectOptions':{'charset':_0xec1d('0xb')},'logging':![],'timezone':timezone[_0xec1d('0xe')](),'define':{'charset':'utf8','collate':_0xec1d('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xec1d('0x1')][_0xec1d('0xf')],config[_0xec1d('0x1')][_0xec1d('0x10')],config[_0xec1d('0x1')][_0xec1d('0x11')],config[_0xec1d('0x1')][_0xec1d('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xec1d('0xf')],config[_0xec1d('0xd')][_0xec1d('0x10')],config[_0xec1d('0xd')][_0xec1d('0x11')],config[_0xec1d('0xd')]['options'])};db[_0xec1d('0x13')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x15'));db['VoiceChanSpy']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x16'));db['VoiceContext']=db[_0xec1d('0x1')]['import'](_0xec1d('0x17'));db[_0xec1d('0x18')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x19'));db[_0xec1d('0x1a')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x1b'));db[_0xec1d('0x1c')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0xec1d('0x1d')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x1e'));db[_0xec1d('0x1f')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x20'));db[_0xec1d('0x21')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x22'));db['VoiceMailMessage']=db['sequelize']['import'](_0xec1d('0x23'));db[_0xec1d('0x24')]=db['sequelize']['import'](_0xec1d('0x25'));db[_0xec1d('0x26')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xec1d('0x27')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xec1d('0x28')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x29'));db[_0xec1d('0x2a')]=db['sequelize'][_0xec1d('0x14')]('../api/memberReport/memberReport.model');db[_0xec1d('0x2b')]=db['sequelize'][_0xec1d('0x14')]('../api/trunk/trunk.model');db[_0xec1d('0x2c')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x2d'));db[_0xec1d('0x2e')]=db[_0xec1d('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x2f'));db[_0xec1d('0x30')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x31'));db[_0xec1d('0x32')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x33'));db[_0xec1d('0x34')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x35'));db[_0xec1d('0x36')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x37'));db['UserWhatsappQueue']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x38'));db[_0xec1d('0x39')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0xec1d('0x3a')]=db[_0xec1d('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xec1d('0x3b')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x3c'));db[_0xec1d('0x3d')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x3e'));db[_0xec1d('0x3f')]=db[_0xec1d('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x40'));db[_0xec1d('0x41')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x42'));db[_0xec1d('0x43')]=db['sequelize'][_0xec1d('0x14')]('../api/mailApplication/mailApplication.model');db[_0xec1d('0x44')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x45'));db[_0xec1d('0x46')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x47'));db['DashboardItem']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x48'));db[_0xec1d('0x49')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/faxAccount/faxAccount.model');db[_0xec1d('0x4a')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x4b'));db[_0xec1d('0x4c')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x4d'));db['FaxMessage']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x4e'));db[_0xec1d('0x4f')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x50'));db[_0xec1d('0x51')]=db['sequelize'][_0xec1d('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0xec1d('0x52')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x53'));db[_0xec1d('0x54')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x55'));db['SmsInteraction']=db[_0xec1d('0x1')]['import'](_0xec1d('0x56'));db[_0xec1d('0x57')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x58'));db[_0xec1d('0x59')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x5a'));db[_0xec1d('0x5b')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x5c'));db[_0xec1d('0x5d')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x5e'));db[_0xec1d('0x5f')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x60'));db[_0xec1d('0x61')]=db[_0xec1d('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xec1d('0x62')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x63'));db[_0xec1d('0x64')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x65'));db[_0xec1d('0x66')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x67'));db['ChatInteraction']=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x68'));db[_0xec1d('0x69')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x6a'));db[_0xec1d('0x6b')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x6c'));db[_0xec1d('0x6d')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x6e'));db[_0xec1d('0x6f')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x70'));db[_0xec1d('0x71')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x72'));db[_0xec1d('0x73')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/cmCompany/cmCompany.model');db[_0xec1d('0x74')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x75'));db['CmHopper']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x76'));db[_0xec1d('0x77')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x78'));db[_0xec1d('0x79')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x7a'));db[_0xec1d('0x7b')]=db['sequelize'][_0xec1d('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x7c'));db[_0xec1d('0x7d')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x7e'));db[_0xec1d('0x7f')]=db['sequelize'][_0xec1d('0x14')]('../api/action/action.model');db[_0xec1d('0x80')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x81'));db['CannedAnswer']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x82'));db['Disposition']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x83'));db[_0xec1d('0x84')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x85'));db[_0xec1d('0x86')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x87'));db[_0xec1d('0x88')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x89'));db[_0xec1d('0x8a')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x8b'));db[_0xec1d('0x8c')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x8d'));db[_0xec1d('0x8e')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x8f'));db[_0xec1d('0x90')]=db['sequelize'][_0xec1d('0x14')]('../api/tag/tag.model');db[_0xec1d('0x91')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/contactItemType/contactItemType.model');db[_0xec1d('0x92')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0xec1d('0x1')]['import'](_0xec1d('0x93'));db['Template']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/template/template.model');db[_0xec1d('0x94')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x95'));db['Variable']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x96'));db['Integration']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x97'));db['IntegrationReport']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/integrationReport/integrationReport.model');db[_0xec1d('0x98')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x99'));db['AnalyticDefaultReport']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xec1d('0x9a')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x9b'));db['AnalyticMetric']=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x9c'));db[_0xec1d('0x9d')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x9e'));db[_0xec1d('0x9f')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xa0'));db[_0xec1d('0xa1')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xa2'));db[_0xec1d('0xa3')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xa4'));db[_0xec1d('0xa5')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xa6'));db[_0xec1d('0xa7')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xa8'));db[_0xec1d('0xa9')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xaa'));db[_0xec1d('0xab')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xec1d('0xac')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xad'));db[_0xec1d('0xae')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xaf'));db['DeskField']=db['sequelize'][_0xec1d('0x14')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xb0'));db[_0xec1d('0xb1')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xb2'));db[_0xec1d('0xb3')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intZohoField/intZohoField.model');db[_0xec1d('0xb4')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xb5'));db[_0xec1d('0xb6')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xb7'));db[_0xec1d('0xb8')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xec1d('0xb9')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xba'));db[_0xec1d('0xbb')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xbc'));db['FreshdeskField']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xec1d('0xbd')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xec1d('0xbe')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xbf'));db['VtigerField']=db[_0xec1d('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xec1d('0xc0')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xc1'));db[_0xec1d('0xc2')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xc3'));db[_0xec1d('0xc4')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xc5'));db[_0xec1d('0xc6')]=db['sequelize']['import'](_0xec1d('0xc7'));db['Dynamics365Configuration']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xc8'));db[_0xec1d('0xc9')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xec1d('0xca')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xcb'));db[_0xec1d('0xcc')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xcd'));db[_0xec1d('0xce')]=db[_0xec1d('0x1')]['import']('../api/integration/integration.model');db['Network']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xcf'));db[_0xec1d('0xd0')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xd1'));db[_0xec1d('0xd2')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xec1d('0xd3')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xd4'));db['JscriptyQuestionReport']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xd5'));db[_0xec1d('0xd6')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xd7'));db[_0xec1d('0xd8')]=db['sequelize']['import'](_0xec1d('0xd9'));db['SquareReport']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xda'));db[_0xec1d('0xdb')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xdc'));db[_0xec1d('0xdd')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xec1d('0xde')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/setting/setting.model');db[_0xec1d('0xdf')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xe0'));db[_0xec1d('0xe1')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xe2'));db[_0xec1d('0xe3')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xe4'));db[_0xec1d('0xe5')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0xec1d('0xe6')]=db[_0xec1d('0x1')]['import'](_0xec1d('0xe7'));db['License']=db['sequelize']['import'](_0xec1d('0xe8'));db[_0xec1d('0xe9')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xea'));db['Migration']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/migration/migration.model');db['Attachment']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/attachment/attachment.model');db[_0xec1d('0xeb')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xec'));db[_0xec1d('0xed')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xec1d('0xee')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xef'));db['FaxTransferReport']=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xf0'));db['OpenchannelTransferReport']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xf1'));db[_0xec1d('0xf2')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xf3'));db[_0xec1d('0xf4')]=db['sequelize']['import'](_0xec1d('0xf5'));db[_0xec1d('0xf6')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xf7'));db['UserProfile']=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/userProfile/userProfile.model');db[_0xec1d('0xf8')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xf9'));db[_0xec1d('0xfa')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0xfb'));db[_0xec1d('0xfc')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xfd'));db['WhatsappAccount']=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0xfe'));db[_0xec1d('0xff')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x100'));db[_0xec1d('0x101')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x102'));db[_0xec1d('0x103')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0xec1d('0x104')]=db[_0xec1d('0x1')]['import'](_0xec1d('0x105'));db[_0xec1d('0x106')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x107'));db[_0xec1d('0x108')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0xec1d('0x109')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x10a'));db[_0xec1d('0x10b')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x10c'));db[_0xec1d('0x10d')]=db['sequelize'][_0xec1d('0x14')](_0xec1d('0x10e'));db[_0xec1d('0x10f')]=db[_0xec1d('0x1')][_0xec1d('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xec1d('0x110')]=db[_0xec1d('0x1')][_0xec1d('0x14')](_0xec1d('0x111'));db['User'][_0xec1d('0x112')](db[_0xec1d('0x21')],{'as':'VoiceMail','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x114')});db[_0xec1d('0x13')]['hasOne'](db[_0xec1d('0x110')],{'as':_0xec1d('0x115'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x114')});db['User'][_0xec1d('0x116')](db[_0xec1d('0x1d')],{'as':'Recordings','foreignKey':_0xec1d('0x114')});db['User'][_0xec1d('0x116')](db[_0xec1d('0x2e')],{'as':_0xec1d('0x117'),'foreignKey':'UserId'});db[_0xec1d('0x13')][_0xec1d('0x116')](db['VoiceExtension'],{'as':_0xec1d('0x118'),'onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x13')][_0xec1d('0x116')](db[_0xec1d('0x79')],{'as':'HopperFinals','foreignKey':_0xec1d('0x114')});db[_0xec1d('0x13')][_0xec1d('0x116')](db[_0xec1d('0x7b')],{'as':_0xec1d('0x119'),'foreignKey':'UserId'});db[_0xec1d('0x13')]['hasMany'](db[_0xec1d('0x11a')],{'as':_0xec1d('0x11a'),'foreignKey':_0xec1d('0x114')});db['User']['hasMany'](db[_0xec1d('0x5f')],{'as':_0xec1d('0x11b'),'foreignKey':_0xec1d('0x114')});db[_0xec1d('0x13')][_0xec1d('0x116')](db[_0xec1d('0x11c')],{'as':_0xec1d('0x11d'),'foreignKey':_0xec1d('0x114')});db['User']['hasMany'](db[_0xec1d('0x11e')],{'as':_0xec1d('0x11f'),'foreignKey':_0xec1d('0x114')});db['User'][_0xec1d('0x116')](db['FaxInteraction'],{'as':_0xec1d('0x120'),'foreignKey':'UserId'});db[_0xec1d('0x13')][_0xec1d('0x116')](db[_0xec1d('0x121')],{'as':'MailInteractions','foreignKey':_0xec1d('0x114')});db[_0xec1d('0x13')]['hasMany'](db[_0xec1d('0x101')],{'as':_0xec1d('0x122'),'foreignKey':'UserId'});db[_0xec1d('0x13')]['hasMany'](db[_0xec1d('0xfc')],{'as':_0xec1d('0x123'),'foreignKey':'SenderId'});db[_0xec1d('0x13')][_0xec1d('0x124')](db['UserProfile'],{'as':_0xec1d('0x125'),'foreignKey':'userProfileId'});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x6f')],{'as':_0xec1d('0x127'),'through':_0xec1d('0x128')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x74')],{'as':_0xec1d('0x129'),'through':'cm_user_has_contacts'});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0xf4')],{'as':'Lists','through':_0xec1d('0x12a')});db[_0xec1d('0x13')]['belongsToMany'](db[_0xec1d('0xe6')],{'through':'user_has_teams'});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x121')],{'as':_0xec1d('0x12b'),'through':_0xec1d('0x12c')});db['User'][_0xec1d('0x126')](db[_0xec1d('0x11c')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x4c')],{'as':_0xec1d('0x120'),'through':_0xec1d('0x12d')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x11e')],{'as':'SmsInteractions','through':_0xec1d('0x12e')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x5f')],{'as':_0xec1d('0x11b'),'through':_0xec1d('0x12f')});db['User'][_0xec1d('0x126')](db[_0xec1d('0x101')],{'as':'WhatsappInteractions','through':_0xec1d('0x130')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x1c')],{'as':'VoiceQueues','through':_0xec1d('0x131'),'required':![]});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0xf6')],{'as':_0xec1d('0x132'),'through':_0xec1d('0x10f'),'required':![]});db[_0xec1d('0x13')]['belongsToMany'](db[_0xec1d('0x3d')],{'as':_0xec1d('0x133'),'through':'UserMailQueue','required':![]});db[_0xec1d('0x13')]['belongsToMany'](db[_0xec1d('0x6d')],{'as':_0xec1d('0x134'),'through':_0xec1d('0x30'),'required':![],'hooks':!![]});db['User'][_0xec1d('0x126')](db[_0xec1d('0x4f')],{'as':_0xec1d('0x135'),'through':_0xec1d('0x136'),'required':![]});db[_0xec1d('0x13')][_0xec1d('0x126')](db['SmsQueue'],{'as':_0xec1d('0x137'),'through':'UserSmsQueue','required':![]});db[_0xec1d('0x13')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xec1d('0x138'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xec1d('0x126')](db[_0xec1d('0x108')],{'as':'WhatsappQueues','through':_0xec1d('0x139'),'required':![]});db['User'][_0xec1d('0x126')](db['CmList'],{'through':_0xec1d('0x12a')});db[_0xec1d('0x13')]['belongsToMany'](db[_0xec1d('0x62')],{'as':'ChatWebsites','through':_0xec1d('0x13a')});db['User'][_0xec1d('0x126')](db[_0xec1d('0x49')],{'as':_0xec1d('0x13b'),'through':'user_has_fax_accounts'});db[_0xec1d('0x13')]['belongsToMany'](db[_0xec1d('0x3b')],{'as':_0xec1d('0x13c'),'through':_0xec1d('0x13d')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x5b')],{'as':_0xec1d('0x13e'),'through':_0xec1d('0x13f')});db['User'][_0xec1d('0x126')](db[_0xec1d('0x52')],{'as':_0xec1d('0x140'),'through':_0xec1d('0x141')});db[_0xec1d('0x13')][_0xec1d('0x126')](db[_0xec1d('0x142')],{'as':_0xec1d('0x143'),'through':_0xec1d('0x144')});db[_0xec1d('0x145')][_0xec1d('0x116')](db[_0xec1d('0x18')],{'as':'SpiedAgents','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x146')});db[_0xec1d('0x147')][_0xec1d('0x116')](db['VoiceExtension'],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0xec1d('0x18')],{'as':_0xec1d('0x148'),'onDelete':'cascade'});db[_0xec1d('0x1a')][_0xec1d('0x126')](db[_0xec1d('0x8e')],{'as':_0xec1d('0x149'),'through':_0xec1d('0x14a')});db[_0xec1d('0x1c')]['hasMany'](db[_0xec1d('0x2e')],{'as':_0xec1d('0x14b'),'foreignKey':_0xec1d('0x14c')});db[_0xec1d('0x1c')][_0xec1d('0x116')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xec1d('0x14c')});db[_0xec1d('0x1c')][_0xec1d('0x116')](db[_0xec1d('0x79')],{'as':_0xec1d('0x14d'),'foreignKey':'VoiceQueueId'});db[_0xec1d('0x1c')]['hasMany'](db['CmHopperHistory'],{'as':_0xec1d('0x14e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xec1d('0x11a')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xec1d('0x1c')][_0xec1d('0x116')](db[_0xec1d('0x77')],{'as':_0xec1d('0x14f'),'foreignKey':_0xec1d('0x14c')});db['VoiceQueue'][_0xec1d('0x116')](db['JscriptySessionReport'],{'as':_0xec1d('0x150'),'foreignKey':_0xec1d('0x14c')});db[_0xec1d('0x1c')][_0xec1d('0x124')](db[_0xec1d('0x2b')],{'as':'Trunk','foreignKey':_0xec1d('0x151')});db[_0xec1d('0x1c')][_0xec1d('0x124')](db[_0xec1d('0x2b')],{'as':'TrunkBackup','foreignKey':_0xec1d('0x152')});db[_0xec1d('0x1c')][_0xec1d('0x124')](db[_0xec1d('0x86')],{'as':_0xec1d('0x86'),'foreignKey':_0xec1d('0x153')});db[_0xec1d('0x1c')][_0xec1d('0x124')](db[_0xec1d('0x88')],{'as':_0xec1d('0x154'),'foreignKey':_0xec1d('0x155')});db[_0xec1d('0x1c')][_0xec1d('0x126')](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xec1d('0x1c')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x131')});db[_0xec1d('0x1c')][_0xec1d('0x126')](db[_0xec1d('0xe6')],{'as':_0xec1d('0x157'),'through':'TeamVoiceQueue'});db[_0xec1d('0x1c')][_0xec1d('0x126')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xec1d('0x1d')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x13'),'foreignKey':_0xec1d('0x114')});db[_0xec1d('0x1f')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x13'),'foreignKey':_0xec1d('0x114')});db[_0xec1d('0x21')]['hasMany'](db[_0xec1d('0x158')],{'as':_0xec1d('0x159'),'onDelete':'cascade','foreignKey':_0xec1d('0x15a'),'sourceKey':'mailbox'});db[_0xec1d('0x158')][_0xec1d('0x124')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xec1d('0x15b')});db[_0xec1d('0x24')][_0xec1d('0x116')](db[_0xec1d('0x28')],{'as':_0xec1d('0x15c'),'foreignKey':_0xec1d('0x15d'),'constraints':![]});db[_0xec1d('0x24')]['hasMany'](db[_0xec1d('0x27')],{'as':_0xec1d('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0xec1d('0x24')]['belongsTo'](db['User'],{'as':_0xec1d('0x13'),'foreignKey':_0xec1d('0x114')});db['VoiceCallReport'][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db['MailServerIn'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{'as':_0xec1d('0x3b'),'foreignKey':'MailAccountId'});db[_0xec1d('0x39')][_0xec1d('0x124')](db['CloudProvider'],{'as':_0xec1d('0x109'),'foreignKey':'CloudProviderId','onDelete':_0xec1d('0x161')});db[_0xec1d('0x3a')]['belongsTo'](db[_0xec1d('0x3b')],{'as':_0xec1d('0x3b'),'foreignKey':_0xec1d('0x162')});db[_0xec1d('0x3a')][_0xec1d('0x124')](db['CloudProvider'],{'as':_0xec1d('0x109'),'foreignKey':_0xec1d('0x163'),'onDelete':_0xec1d('0x161')});db[_0xec1d('0x3b')][_0xec1d('0x112')](db['MailServerIn'],{'as':_0xec1d('0x164'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x3b')][_0xec1d('0x112')](db[_0xec1d('0x3a')],{'as':'Smtp','onDelete':_0xec1d('0x113')});db[_0xec1d('0x3b')][_0xec1d('0x116')](db[_0xec1d('0x165')],{'as':'Dispositions','foreignKey':_0xec1d('0x162'),'onDelete':_0xec1d('0x113')});db['MailAccount']['hasMany'](db[_0xec1d('0x166')],{'as':_0xec1d('0x167'),'foreignKey':'MailAccountId'});db[_0xec1d('0x3b')][_0xec1d('0x116')](db['MailMessage'],{'as':'Messages','foreignKey':_0xec1d('0x162')});db[_0xec1d('0x3b')][_0xec1d('0x116')](db[_0xec1d('0x121')],{'as':'Interactions'});db[_0xec1d('0x3b')][_0xec1d('0x116')](db[_0xec1d('0x43')],{'as':_0xec1d('0x148')});db[_0xec1d('0x3b')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db['MailAccount'][_0xec1d('0x124')](db[_0xec1d('0x16a')],{'as':'Template','foreignKey':_0xec1d('0x16b')});db[_0xec1d('0x3b')][_0xec1d('0x124')](db[_0xec1d('0x88')],{'as':_0xec1d('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec1d('0x3b')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x13d')});db[_0xec1d('0x3d')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x32')});db[_0xec1d('0x3d')][_0xec1d('0x126')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0xec1d('0x121')][_0xec1d('0x116')](db['MailMessage'],{'as':_0xec1d('0x159'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x16c')});db['MailInteraction']['belongsTo'](db[_0xec1d('0x3b')],{'as':'Account','foreignKey':_0xec1d('0x162')});db[_0xec1d('0x121')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x121')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x16d'),'foreignKey':'UserId'});db[_0xec1d('0x121')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x16e'),'as':_0xec1d('0x16f')});db[_0xec1d('0x121')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x16e'),'as':'ThroughTags'});db[_0xec1d('0x121')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':'user_has_mail_interactions','foreignKey':_0xec1d('0x16c')});db[_0xec1d('0x41')]['hasMany'](db[_0xec1d('0x171')],{'as':_0xec1d('0x172'),'onDelete':_0xec1d('0x113')});db['MailMessage'][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x13')});db[_0xec1d('0x41')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'onDelete':_0xec1d('0x113'),'as':'Contact'});db[_0xec1d('0x41')]['belongsTo'](db[_0xec1d('0x121')],{'as':'Interaction','foreignKey':_0xec1d('0x16c')});db[_0xec1d('0x41')][_0xec1d('0x124')](db[_0xec1d('0x3b')],{'as':_0xec1d('0x173'),'foreignKey':'MailAccountId'});db['MailMessage'][_0xec1d('0x124')](db[_0xec1d('0x62')],{'as':_0xec1d('0x62'),'foreignKey':_0xec1d('0x174')});db[_0xec1d('0x41')][_0xec1d('0x124')](db[_0xec1d('0x6b')],{'as':_0xec1d('0x6b'),'foreignKey':_0xec1d('0x175')});db[_0xec1d('0x43')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'onDelete':'restrict'});db[_0xec1d('0x43')][_0xec1d('0x124')](db['MailQueue'],{'onDelete':_0xec1d('0x161')});db['MailApplication'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{'onDelete':'restrict'});db[_0xec1d('0x43')][_0xec1d('0x124')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xec1d('0x153')});db[_0xec1d('0x43')]['belongsTo'](db['Tag'],{'onDelete':_0xec1d('0x161'),'foreignKey':_0xec1d('0x176')});db['MailQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{});db[_0xec1d('0x44')][_0xec1d('0x124')](db['CmList'],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db['MailQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db['MailQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x121')],{});db[_0xec1d('0x44')][_0xec1d('0x124')](db[_0xec1d('0x41')],{});db[_0xec1d('0x44')][_0xec1d('0x124')](db['User'],{});db[_0xec1d('0x44')][_0xec1d('0x124')](db[_0xec1d('0x3d')],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':'Items','onDelete':_0xec1d('0x113')});db[_0xec1d('0x49')][_0xec1d('0x116')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xec1d('0x113')});db[_0xec1d('0x49')][_0xec1d('0x116')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0xec1d('0x116')](db[_0xec1d('0x4c')],{'as':_0xec1d('0x177')});db[_0xec1d('0x49')][_0xec1d('0x116')](db[_0xec1d('0x4a')],{'as':_0xec1d('0x148')});db[_0xec1d('0x49')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xec1d('0x113')});db[_0xec1d('0x49')][_0xec1d('0x116')](db['FaxMessage'],{'as':'Messages'});db[_0xec1d('0x49')][_0xec1d('0x124')](db[_0xec1d('0x2b')],{'as':_0xec1d('0x2b')});db[_0xec1d('0x49')]['belongsTo'](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db['FaxAccount'][_0xec1d('0x124')](db[_0xec1d('0x88')],{'as':_0xec1d('0x154'),'foreignKey':_0xec1d('0x155')});db[_0xec1d('0x49')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x178')});db[_0xec1d('0x4a')]['belongsTo'](db['User'],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0x4a')][_0xec1d('0x124')](db['FaxQueue'],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0x4a')][_0xec1d('0x124')](db[_0xec1d('0x49')],{'onDelete':_0xec1d('0x161')});db['FaxApplication'][_0xec1d('0x124')](db['Tag'],{'onDelete':_0xec1d('0x161'),'foreignKey':_0xec1d('0x176')});db[_0xec1d('0x4c')][_0xec1d('0x116')](db['FaxMessage'],{'as':_0xec1d('0x159'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x179')});db[_0xec1d('0x4c')]['belongsTo'](db[_0xec1d('0x49')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x17a')});db[_0xec1d('0x4c')]['belongsTo'](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x4c')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xec1d('0x4c')]['belongsToMany'](db[_0xec1d('0x90')],{'through':_0xec1d('0x17b'),'as':_0xec1d('0x16f')});db[_0xec1d('0x4c')]['belongsToMany'](db[_0xec1d('0x90')],{'through':_0xec1d('0x17b'),'as':'ThroughTags'});db[_0xec1d('0x4c')]['belongsToMany'](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':'user_has_fax_interactions','foreignKey':_0xec1d('0x179')});db[_0xec1d('0x17c')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'onDelete':_0xec1d('0x113'),'as':'User'});db[_0xec1d('0x17c')][_0xec1d('0x124')](db[_0xec1d('0x4c')],{'as':'Interaction','foreignKey':_0xec1d('0x179')});db[_0xec1d('0x17c')]['belongsTo'](db[_0xec1d('0x74')],{'onDelete':_0xec1d('0x113'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0xec1d('0x171')],{'as':_0xec1d('0x171'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0xec1d('0x124')](db['FaxAccount'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x17a')});db[_0xec1d('0x4f')][_0xec1d('0x126')](db['User'],{'as':_0xec1d('0x156'),'through':_0xec1d('0x136')});db[_0xec1d('0x4f')][_0xec1d('0x126')](db[_0xec1d('0xe6')],{'through':_0xec1d('0x17d'),'as':_0xec1d('0x157')});db[_0xec1d('0x51')][_0xec1d('0x124')](db[_0xec1d('0x49')],{});db[_0xec1d('0x51')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db['FaxQueueReport'][_0xec1d('0x124')](db['CmContact'],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db['FaxQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x4c')],{});db[_0xec1d('0x51')][_0xec1d('0x124')](db['FaxMessage'],{});db[_0xec1d('0x51')][_0xec1d('0x124')](db[_0xec1d('0x13')],{});db['FaxQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x4f')],{});db[_0xec1d('0x52')][_0xec1d('0x116')](db[_0xec1d('0x165')],{'as':_0xec1d('0x17e'),'foreignKey':_0xec1d('0x17f'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x52')][_0xec1d('0x116')](db[_0xec1d('0x166')],{'as':_0xec1d('0x167'),'foreignKey':_0xec1d('0x17f')});db[_0xec1d('0x52')][_0xec1d('0x116')](db['SmsMessage'],{'as':_0xec1d('0x159'),'foreignKey':_0xec1d('0x17f')});db['SmsAccount'][_0xec1d('0x116')](db[_0xec1d('0x11e')],{'as':_0xec1d('0x177')});db[_0xec1d('0x52')][_0xec1d('0x116')](db[_0xec1d('0x54')],{'as':_0xec1d('0x148')});db[_0xec1d('0x52')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':'ListId'});db[_0xec1d('0x52')][_0xec1d('0x124')](db[_0xec1d('0x88')],{'as':_0xec1d('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec1d('0x52')][_0xec1d('0x126')](db['User'],{'as':'Agents','through':_0xec1d('0x141')});db[_0xec1d('0x54')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0x54')][_0xec1d('0x124')](db[_0xec1d('0x59')],{'onDelete':_0xec1d('0x161')});db['SmsApplication'][_0xec1d('0x124')](db[_0xec1d('0x52')],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0x54')][_0xec1d('0x124')](db[_0xec1d('0x86')],{'onDelete':_0xec1d('0x161'),'foreignKey':_0xec1d('0x153')});db[_0xec1d('0x54')][_0xec1d('0x124')](db['Tag'],{'onDelete':_0xec1d('0x161'),'foreignKey':'TagId'});db['SmsInteraction'][_0xec1d('0x116')](db['SmsMessage'],{'as':_0xec1d('0x159'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x180')});db[_0xec1d('0x11e')][_0xec1d('0x124')](db[_0xec1d('0x52')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x17f')});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xec1d('0x160')});db[_0xec1d('0x11e')]['belongsTo'](db[_0xec1d('0x13')],{'as':'Owner','foreignKey':_0xec1d('0x114')});db[_0xec1d('0x11e')][_0xec1d('0x126')](db['Tag'],{'through':_0xec1d('0x181'),'as':'Tags'});db[_0xec1d('0x11e')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':'sms_interaction_has_tags','as':_0xec1d('0x182')});db[_0xec1d('0x11e')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':_0xec1d('0x12e'),'foreignKey':_0xec1d('0x180')});db[_0xec1d('0x57')]['belongsTo'](db[_0xec1d('0x13')],{'as':_0xec1d('0x13')});db[_0xec1d('0x57')][_0xec1d('0x124')](db['CmContact'],{'onDelete':_0xec1d('0x113'),'as':'Contact'});db[_0xec1d('0x57')][_0xec1d('0x124')](db[_0xec1d('0x11e')],{'onDelete':_0xec1d('0x113'),'as':_0xec1d('0x183'),'foreignKey':'SmsInteractionId'});db[_0xec1d('0x57')]['belongsTo'](db['SmsAccount'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x17f')});db['SmsQueue'][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x34'),'foreignKey':'SmsQueueId'});db['SmsQueue'][_0xec1d('0x126')](db[_0xec1d('0xe6')],{'through':'team_has_sms_queues','as':_0xec1d('0x157')});db['OpenchannelAccount'][_0xec1d('0x116')](db[_0xec1d('0x165')],{'as':_0xec1d('0x17e'),'foreignKey':_0xec1d('0x184'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x5b')]['hasMany'](db['CannedAnswer'],{'as':_0xec1d('0x167'),'foreignKey':_0xec1d('0x184')});db[_0xec1d('0x5b')][_0xec1d('0x116')](db[_0xec1d('0x5f')],{'as':_0xec1d('0x177'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xec1d('0x185')],{'as':_0xec1d('0x159'),'foreignKey':_0xec1d('0x184')});db[_0xec1d('0x5b')][_0xec1d('0x116')](db[_0xec1d('0x5d')],{'as':_0xec1d('0x148'),'foreignKey':'OpenchannelAccountId'});db[_0xec1d('0x5b')]['belongsTo'](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db['OpenchannelAccount'][_0xec1d('0x124')](db['Pause'],{'as':_0xec1d('0x154'),'foreignKey':_0xec1d('0x155')});db[_0xec1d('0x5b')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x13f')});db[_0xec1d('0x5d')][_0xec1d('0x124')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xec1d('0x124')](db[_0xec1d('0x61')],{'onDelete':_0xec1d('0x161'),'foreignKey':_0xec1d('0x186')});db[_0xec1d('0x5d')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xec1d('0x184')});db[_0xec1d('0x5d')][_0xec1d('0x124')](db[_0xec1d('0x86')],{'onDelete':'restrict','foreignKey':_0xec1d('0x153')});db[_0xec1d('0x5d')][_0xec1d('0x124')](db[_0xec1d('0x90')],{'onDelete':_0xec1d('0x161'),'foreignKey':'TagId'});db[_0xec1d('0x5f')][_0xec1d('0x116')](db['OpenchannelMessage'],{'as':_0xec1d('0x159'),'onDelete':'cascade','foreignKey':_0xec1d('0x187')});db[_0xec1d('0x5f')][_0xec1d('0x124')](db[_0xec1d('0x5b')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x184')});db[_0xec1d('0x5f')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x5f')][_0xec1d('0x124')](db['User'],{'as':'Owner','foreignKey':_0xec1d('0x114')});db[_0xec1d('0x5f')]['belongsToMany'](db[_0xec1d('0x90')],{'through':_0xec1d('0x188'),'as':_0xec1d('0x16f')});db[_0xec1d('0x5f')]['belongsToMany'](db['Tag'],{'through':_0xec1d('0x188'),'as':_0xec1d('0x182')});db['OpenchannelInteraction'][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':'user_has_openchannel_interactions','foreignKey':_0xec1d('0x187')});db[_0xec1d('0x185')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'onDelete':'cascade','as':_0xec1d('0x13')});db[_0xec1d('0x185')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'onDelete':'cascade','as':_0xec1d('0x15f')});db[_0xec1d('0x185')][_0xec1d('0x124')](db[_0xec1d('0x5f')],{'onDelete':'cascade','as':_0xec1d('0x183'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xec1d('0x124')](db['Attachment'],{'as':'Attachment','foreignKey':_0xec1d('0x189')});db[_0xec1d('0x185')][_0xec1d('0x124')](db['OpenchannelAccount'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x184')});db[_0xec1d('0x61')][_0xec1d('0x126')](db['User'],{'as':'Agents','through':_0xec1d('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0xec1d('0x61')]['belongsToMany'](db[_0xec1d('0xe6')],{'through':_0xec1d('0x18a'),'as':_0xec1d('0x157')});db['ChatWebsite']['hasMany'](db[_0xec1d('0x165')],{'as':_0xec1d('0x17e'),'foreignKey':_0xec1d('0x174'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x62')][_0xec1d('0x116')](db[_0xec1d('0x166')],{'as':_0xec1d('0x167'),'foreignKey':'ChatWebsiteId'});db[_0xec1d('0x62')][_0xec1d('0x116')](db[_0xec1d('0x71')],{'as':_0xec1d('0x18b')});db[_0xec1d('0x62')][_0xec1d('0x116')](db[_0xec1d('0x11c')],{'as':_0xec1d('0x177')});db[_0xec1d('0x62')][_0xec1d('0x116')](db['ChatApplication'],{'as':_0xec1d('0x148')});db[_0xec1d('0x62')][_0xec1d('0x116')](db[_0xec1d('0x69')],{'as':_0xec1d('0x159')});db['ChatWebsite'][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':'ListId'});db[_0xec1d('0x62')]['belongsTo'](db[_0xec1d('0x86')],{'as':'Interval','foreignKey':_0xec1d('0x153')});db['ChatWebsite'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{'as':_0xec1d('0x3b'),'foreignKey':_0xec1d('0x162')});db['ChatWebsite'][_0xec1d('0x124')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xec1d('0x155')});db[_0xec1d('0x62')]['belongsToMany'](db[_0xec1d('0x13')],{'as':'Agents','through':_0xec1d('0x13a')});db[_0xec1d('0x64')][_0xec1d('0x124')](db[_0xec1d('0x5b')],{});db[_0xec1d('0x64')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0x64')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db['OpenchannelQueueReport'][_0xec1d('0x124')](db[_0xec1d('0x5f')],{});db[_0xec1d('0x64')]['belongsTo'](db[_0xec1d('0x185')],{});db['OpenchannelQueueReport'][_0xec1d('0x124')](db['User'],{});db[_0xec1d('0x64')][_0xec1d('0x124')](db['OpenchannelQueue'],{});db[_0xec1d('0x66')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x18c'),'foreignKey':'UserId','onDelete':_0xec1d('0x161')});db[_0xec1d('0x66')][_0xec1d('0x124')](db[_0xec1d('0x6d')],{'as':_0xec1d('0x18d'),'foreignKey':_0xec1d('0x18e'),'onDelete':'restrict'});db['ChatApplication'][_0xec1d('0x124')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xec1d('0x174'),'onDelete':'restrict'});db[_0xec1d('0x66')][_0xec1d('0x124')](db[_0xec1d('0x90')],{'onDelete':_0xec1d('0x161'),'foreignKey':'TagId'});db['ChatInteraction'][_0xec1d('0x116')](db[_0xec1d('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xec1d('0x18f')});db[_0xec1d('0x11c')][_0xec1d('0x124')](db[_0xec1d('0x62')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x174')});db[_0xec1d('0x11c')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':'ContactId'});db['ChatInteraction'][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x16d'),'foreignKey':_0xec1d('0x114')});db[_0xec1d('0x11c')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x190'),'as':_0xec1d('0x16f')});db['ChatInteraction'][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x190'),'as':_0xec1d('0x182')});db[_0xec1d('0x11c')]['belongsToMany'](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':_0xec1d('0x191'),'foreignKey':_0xec1d('0x18f')});db[_0xec1d('0x69')][_0xec1d('0x124')](db['User'],{'onDelete':_0xec1d('0x113'),'as':_0xec1d('0x13')});db[_0xec1d('0x69')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'onDelete':'cascade','as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x69')][_0xec1d('0x124')](db[_0xec1d('0x11c')],{'onDelete':_0xec1d('0x113'),'as':'Interaction','foreignKey':_0xec1d('0x18f')});db[_0xec1d('0x69')][_0xec1d('0x124')](db[_0xec1d('0x171')],{'as':_0xec1d('0x171'),'foreignKey':_0xec1d('0x189')});db['ChatMessage'][_0xec1d('0x124')](db['ChatWebsite'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x174')});db['ChatOfflineMessage'][_0xec1d('0x116')](db[_0xec1d('0x171')],{'as':_0xec1d('0x172'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x6b')]['belongsTo'](db[_0xec1d('0x74')],{'onDelete':'cascade','as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x6b')][_0xec1d('0x124')](db[_0xec1d('0x62')],{'as':'Account','foreignKey':_0xec1d('0x174')});db[_0xec1d('0x6d')][_0xec1d('0x126')](db['User'],{'as':_0xec1d('0x156'),'through':_0xec1d('0x30'),'hooks':!![]});db[_0xec1d('0x6d')][_0xec1d('0x126')](db[_0xec1d('0xe6')],{'through':_0xec1d('0x192'),'as':_0xec1d('0x157')});db['ChatGroup'][_0xec1d('0x116')](db[_0xec1d('0xd2')],{'as':_0xec1d('0x159'),'foreignKey':_0xec1d('0x193'),'onDelete':_0xec1d('0x113')});db['ChatGroup']['belongsToMany'](db[_0xec1d('0x13')],{'as':'Members','through':_0xec1d('0x128')});db[_0xec1d('0x71')][_0xec1d('0x124')](db['ChatWebsite'],{'as':_0xec1d('0x194'),'foreignKey':_0xec1d('0x174')});db[_0xec1d('0x73')][_0xec1d('0x116')](db[_0xec1d('0x74')],{'as':_0xec1d('0x129'),'foreignKey':'CompanyId'});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x92')],{'as':'Phones','foreignKey':_0xec1d('0x195')});db[_0xec1d('0x74')]['hasMany'](db[_0xec1d('0x196')],{'as':_0xec1d('0x197'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x74')]['hasMany'](db['CmHopperFinal'],{'as':_0xec1d('0x14d'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x7b')],{'as':_0xec1d('0x14e'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x11a')],{'as':_0xec1d('0x11a'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0xd6')],{'as':_0xec1d('0x150'),'foreignKey':'ContactId'});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x5f')],{'as':_0xec1d('0x11b'),'foreignKey':_0xec1d('0x160'),'onDelete':'restrict'});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x11c')],{'as':_0xec1d('0x11d'),'foreignKey':_0xec1d('0x160'),'onDelete':_0xec1d('0x161')});db[_0xec1d('0x74')][_0xec1d('0x116')](db['SmsInteraction'],{'as':_0xec1d('0x11f'),'foreignKey':_0xec1d('0x160'),'onDelete':'restrict'});db[_0xec1d('0x74')][_0xec1d('0x116')](db[_0xec1d('0x4c')],{'as':_0xec1d('0x120'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xec1d('0x74')]['hasMany'](db[_0xec1d('0x121')],{'as':_0xec1d('0x12b'),'foreignKey':_0xec1d('0x160'),'onDelete':_0xec1d('0x161')});db[_0xec1d('0x74')][_0xec1d('0x124')](db['CmCompany'],{'as':_0xec1d('0x198'),'foreignKey':_0xec1d('0x199')});db[_0xec1d('0x74')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':'List','foreignKey':_0xec1d('0x169'),'onDelete':'cascade'});db[_0xec1d('0x74')][_0xec1d('0x126')](db['User'],{'as':'Users','through':_0xec1d('0x19a')});db[_0xec1d('0x74')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'as':_0xec1d('0x16f'),'through':'cm_contact_has_tags'});db[_0xec1d('0x74')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x19b'),'as':'ThroughTags'});db['CmHopper'][_0xec1d('0x116')](db[_0xec1d('0x19c')],{'as':_0xec1d('0x19d'),'foreignKey':'CmHopperId'});db['CmHopper'][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':'ContactId','onDelete':_0xec1d('0x113')});db[_0xec1d('0x196')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x196')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x18c'),'foreignKey':'UserId'});db[_0xec1d('0x196')]['belongsTo'](db[_0xec1d('0x1c')],{'as':'Queue','foreignKey':_0xec1d('0x14c'),'onDelete':_0xec1d('0x113')});db['CmHopper'][_0xec1d('0x124')](db['Campaign'],{'as':_0xec1d('0xe9'),'foreignKey':_0xec1d('0x19e'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x196')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x16d'),'foreignKey':_0xec1d('0x19f')});db[_0xec1d('0x77')]['belongsTo'](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':'ContactId','onDelete':_0xec1d('0x113')});db[_0xec1d('0x77')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':'List','foreignKey':'ListId','onDelete':_0xec1d('0x113')});db[_0xec1d('0x77')][_0xec1d('0x124')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xec1d('0x14c'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x77')][_0xec1d('0x124')](db[_0xec1d('0xe9')],{'as':'Campaign','foreignKey':_0xec1d('0x19e'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x80')][_0xec1d('0x116')](db['Condition'],{'as':{'plural':_0xec1d('0x1a0'),'singular':'OneAll'},'foreignKey':_0xec1d('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0xec1d('0x80')][_0xec1d('0x116')](db[_0xec1d('0x84')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xec1d('0x1a2'),'onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x80')][_0xec1d('0x116')](db[_0xec1d('0x7f')],{'as':_0xec1d('0x1a3'),'foreignKey':_0xec1d('0x1a4'),'onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x165')][_0xec1d('0x116')](db[_0xec1d('0x165')],{'as':_0xec1d('0x17e'),'foreignKey':_0xec1d('0x1a5'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0x86')][_0xec1d('0x116')](db['Interval'],{'as':_0xec1d('0x1a6'),'foreignKey':'IntervalId','onDelete':_0xec1d('0x113'),'hooks':!![],'required':![]});db[_0xec1d('0x86')]['hasMany'](db[_0xec1d('0x18')],{'as':_0xec1d('0x118'),'foreignKey':_0xec1d('0x153'),'onDelete':_0xec1d('0x161')});db['Interval']['hasMany'](db[_0xec1d('0x43')],{'as':_0xec1d('0x1a7'),'foreignKey':_0xec1d('0x153')});db['Interval']['hasMany'](db[_0xec1d('0x66')],{'as':_0xec1d('0x1a8'),'foreignKey':_0xec1d('0x153')});db[_0xec1d('0x86')][_0xec1d('0x116')](db[_0xec1d('0x4a')],{'as':_0xec1d('0x1a9'),'foreignKey':_0xec1d('0x153')});db[_0xec1d('0x86')]['hasMany'](db[_0xec1d('0x54')],{'as':'SmsApplications','foreignKey':_0xec1d('0x153')});db['Schedule'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{});db[_0xec1d('0x8c')][_0xec1d('0x124')](db[_0xec1d('0x1aa')],{'foreignKey':_0xec1d('0x1ab')});db[_0xec1d('0x8c')][_0xec1d('0x124')](db[_0xec1d('0x98')],{'foreignKey':'CustomReportId'});db[_0xec1d('0x8e')][_0xec1d('0x126')](db[_0xec1d('0x1a')],{'as':_0xec1d('0x1ac'),'through':_0xec1d('0x14a'),'onDelete':'restrict'});db[_0xec1d('0x90')][_0xec1d('0x126')](db[_0xec1d('0x74')],{'through':_0xec1d('0x19b')});db['Tag'][_0xec1d('0x126')](db[_0xec1d('0x11c')],{'through':_0xec1d('0x190')});db[_0xec1d('0x90')][_0xec1d('0x126')](db[_0xec1d('0x121')],{'through':'mail_interaction_has_tags'});db['Tag'][_0xec1d('0x126')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xec1d('0x90')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xec1d('0x90')][_0xec1d('0x126')](db[_0xec1d('0x5f')],{'through':_0xec1d('0x188')});db[_0xec1d('0x90')][_0xec1d('0x126')](db[_0xec1d('0x101')],{'through':_0xec1d('0x1ad')});db[_0xec1d('0x92')]['belongsTo'](db[_0xec1d('0x91')],{'as':_0xec1d('0x1ae'),'foreignKey':_0xec1d('0x1af')});db[_0xec1d('0x19c')]['belongsTo'](db[_0xec1d('0x196')],{'as':_0xec1d('0x1b0'),'foreignKey':_0xec1d('0x1b1')});db['CmContactHasItem'][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x195')});db[_0xec1d('0x94')][_0xec1d('0x116')](db[_0xec1d('0x84')],{'as':{'plural':_0xec1d('0x1b2'),'singular':_0xec1d('0x1b3')},'foreignKey':_0xec1d('0x1b4'),'onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x94')]['hasMany'](db[_0xec1d('0x84')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xec1d('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xec1d('0x94')][_0xec1d('0x116')](db[_0xec1d('0x7f')],{'as':_0xec1d('0x1a3'),'foreignKey':'TriggerId','onDelete':_0xec1d('0x113'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xec1d('0x9d')],{'as':_0xec1d('0x1b6'),'onDelete':'cascade','foreignKey':_0xec1d('0x1b7'),'hooks':!![]});db[_0xec1d('0x1aa')][_0xec1d('0x116')](db[_0xec1d('0x9d')],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xec1d('0x116')](db[_0xec1d('0x9d')],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1b8')});db[_0xec1d('0x9d')]['belongsTo'](db[_0xec1d('0x1b9')],{'foreignKey':_0xec1d('0x1b8')});db[_0xec1d('0xa1')][_0xec1d('0x116')](db[_0xec1d('0xa3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xa3')][_0xec1d('0x116')](db['SalesforceField'],{'as':_0xec1d('0x1bb'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1bc')});db['SalesforceConfiguration'][_0xec1d('0x116')](db[_0xec1d('0xa5')],{'as':_0xec1d('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xec1d('0xa3')][_0xec1d('0x116')](db[_0xec1d('0xa5')],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':'FieldId'});db[_0xec1d('0xa3')][_0xec1d('0x124')](db['SalesforceAccount'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xa5')][_0xec1d('0x116')](db[_0xec1d('0xa5')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xa5')]['hasMany'](db[_0xec1d('0xa5')],{'as':_0xec1d('0x1bf'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xa5')][_0xec1d('0x116')](db[_0xec1d('0xa5')],{'as':'Field','foreignKey':'FieldId'});db[_0xec1d('0xa5')]['belongsTo'](db['Variable'],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db['SugarcrmAccount'][_0xec1d('0x116')](db[_0xec1d('0xa9')],{'as':_0xec1d('0x1c3'),'onDelete':'cascade','foreignKey':_0xec1d('0x1ba')});db['SugarcrmConfiguration'][_0xec1d('0x116')](db[_0xec1d('0xab')],{'as':_0xec1d('0x1bb'),'onDelete':_0xec1d('0x113'),'foreignKey':'SubjectId'});db[_0xec1d('0xa9')][_0xec1d('0x116')](db[_0xec1d('0xab')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xa9')][_0xec1d('0x116')](db['SugarcrmField'],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c4')});db['SugarcrmConfiguration'][_0xec1d('0x124')](db[_0xec1d('0xa7')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xab')][_0xec1d('0x116')](db[_0xec1d('0xab')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xab')][_0xec1d('0x116')](db[_0xec1d('0xab')],{'as':_0xec1d('0x1bf'),'foreignKey':'DescriptionId'});db[_0xec1d('0xab')][_0xec1d('0x116')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xab')][_0xec1d('0x124')](db[_0xec1d('0x1c1')],{'as':_0xec1d('0x1c1'),'foreignKey':'VariableId'});db[_0xec1d('0xac')]['hasMany'](db[_0xec1d('0xae')],{'as':_0xec1d('0x1c3'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xae')][_0xec1d('0x116')](db[_0xec1d('0x1c5')],{'as':'Subjects','onDelete':_0xec1d('0x113'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0xec1d('0x116')](db[_0xec1d('0x1c5')],{'as':_0xec1d('0x1bd'),'onDelete':'cascade','foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xae')]['hasMany'](db[_0xec1d('0x1c5')],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c4')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0xec1d('0x173'),'foreignKey':'AccountId'});db[_0xec1d('0xae')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField']['hasMany'](db[_0xec1d('0x1c5')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0x1c5')][_0xec1d('0x116')](db[_0xec1d('0x1c5')],{'as':_0xec1d('0x1bf'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0x1c5')][_0xec1d('0x116')](db['DeskField'],{'as':_0xec1d('0x1c6'),'foreignKey':_0xec1d('0x1c4')});db['DeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0x1c7')][_0xec1d('0x116')](db[_0xec1d('0xb1')],{'as':_0xec1d('0x1c3'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xb1')][_0xec1d('0x116')](db[_0xec1d('0xb3')],{'as':_0xec1d('0x1bb'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xb1')][_0xec1d('0x116')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xb1')]['hasMany'](db[_0xec1d('0xb3')],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xb1')][_0xec1d('0x124')](db[_0xec1d('0x1c7')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xb3')][_0xec1d('0x116')](db[_0xec1d('0xb3')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xb3')][_0xec1d('0x116')](db[_0xec1d('0xb3')],{'as':'Description','foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xb3')][_0xec1d('0x116')](db[_0xec1d('0xb3')],{'as':'Field','foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xb3')][_0xec1d('0x124')](db['Variable'],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0xb4')][_0xec1d('0x116')](db[_0xec1d('0xb6')],{'as':_0xec1d('0x1c3'),'onDelete':_0xec1d('0x113'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xec1d('0x116')](db[_0xec1d('0xb8')],{'as':_0xec1d('0x1bb'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xb6')][_0xec1d('0x116')](db[_0xec1d('0xb8')],{'as':_0xec1d('0x1bd'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xb6')]['hasMany'](db['ZendeskField'],{'as':_0xec1d('0x1b6'),'foreignKey':_0xec1d('0x1c4')});db['ZendeskConfiguration'][_0xec1d('0x124')](db[_0xec1d('0xb4')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xb6')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x1c8')});db[_0xec1d('0xb8')][_0xec1d('0x116')](db[_0xec1d('0xb8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xec1d('0xb8')]['hasMany'](db['ZendeskField'],{'as':_0xec1d('0x1bf'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0xec1d('0x116')](db['ZendeskField'],{'as':_0xec1d('0x1c6'),'foreignKey':_0xec1d('0x1c4')});db['ZendeskField'][_0xec1d('0x124')](db['Variable'],{'as':_0xec1d('0x1c1'),'foreignKey':'VariableId'});db[_0xec1d('0xb9')][_0xec1d('0x116')](db[_0xec1d('0xbb')],{'as':'Configurations','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xbb')]['hasMany'](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xec1d('0x113'),'foreignKey':'SubjectId'});db[_0xec1d('0xbb')][_0xec1d('0x116')](db[_0xec1d('0x1c9')],{'as':'Descriptions','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c0')});db['FreshdeskConfiguration'][_0xec1d('0x116')](db[_0xec1d('0x1c9')],{'as':_0xec1d('0x1b6'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xbb')][_0xec1d('0x124')](db['FreshdeskAccount'],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xbb')][_0xec1d('0x126')](db['Tag'],{'through':_0xec1d('0x1ca')});db[_0xec1d('0x1c9')][_0xec1d('0x116')](db[_0xec1d('0x1c9')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db['FreshdeskField']['hasMany'](db[_0xec1d('0x1c9')],{'as':'Description','foreignKey':_0xec1d('0x1c0')});db['FreshdeskField'][_0xec1d('0x116')](db[_0xec1d('0x1c9')],{'as':_0xec1d('0x1c6'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0x1c9')]['belongsTo'](db[_0xec1d('0x1c1')],{'as':_0xec1d('0x1c1'),'foreignKey':'VariableId'});db[_0xec1d('0xbd')][_0xec1d('0x116')](db[_0xec1d('0xbe')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xec1d('0x1ba')});db['VtigerConfiguration'][_0xec1d('0x116')](db['VtigerField'],{'as':_0xec1d('0x1bb'),'foreignKey':'SubjectId'});db[_0xec1d('0xbe')][_0xec1d('0x116')](db[_0xec1d('0x1cb')],{'as':_0xec1d('0x1bd'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xbe')][_0xec1d('0x116')](db['VtigerField'],{'as':_0xec1d('0x1b6'),'foreignKey':'FieldId'});db[_0xec1d('0xbe')]['belongsTo'](db[_0xec1d('0xbd')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1ba')});db['VtigerField'][_0xec1d('0x116')](db[_0xec1d('0x1cb')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db['VtigerField'][_0xec1d('0x116')](db['VtigerField'],{'as':_0xec1d('0x1bf'),'foreignKey':'DescriptionId'});db[_0xec1d('0x1cb')][_0xec1d('0x116')](db[_0xec1d('0x1cb')],{'as':'Field','foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0x1cb')][_0xec1d('0x124')](db[_0xec1d('0x1c1')],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0xc0')][_0xec1d('0x116')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ba')});db[_0xec1d('0xc2')]['hasMany'](db[_0xec1d('0xc4')],{'as':_0xec1d('0x1bb'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xc2')][_0xec1d('0x116')](db[_0xec1d('0xc4')],{'as':_0xec1d('0x1bd'),'foreignKey':_0xec1d('0x1c0')});db['ServicenowConfiguration'][_0xec1d('0x116')](db['ServicenowField'],{'as':_0xec1d('0x1b6'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xc2')][_0xec1d('0x124')](db[_0xec1d('0xc0')],{'as':'Account','foreignKey':'AccountId'});db[_0xec1d('0xc4')][_0xec1d('0x116')](db[_0xec1d('0xc4')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db['ServicenowField'][_0xec1d('0x116')](db[_0xec1d('0xc4')],{'as':_0xec1d('0x1bf'),'foreignKey':'DescriptionId'});db[_0xec1d('0xc4')][_0xec1d('0x116')](db[_0xec1d('0xc4')],{'as':_0xec1d('0x1c6'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xc4')][_0xec1d('0x124')](db['Variable'],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0xc6')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xec1d('0x1c3'),'onDelete':_0xec1d('0x113'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0xec1d('0x124')](db[_0xec1d('0x109')],{'as':_0xec1d('0x109'),'foreignKey':_0xec1d('0x163')});db[_0xec1d('0x1cc')]['hasMany'](db['Dynamics365Field'],{'as':_0xec1d('0x1bb'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1bc')});db['Dynamics365Configuration'][_0xec1d('0x116')](db[_0xec1d('0xc9')],{'as':_0xec1d('0x1bd'),'onDelete':'cascade','foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0x1cc')][_0xec1d('0x116')](db['Dynamics365Field'],{'as':_0xec1d('0x1b6'),'onDelete':'cascade','foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0x1cc')][_0xec1d('0x124')](db[_0xec1d('0xc6')],{'as':_0xec1d('0x173'),'foreignKey':'AccountId'});db[_0xec1d('0xc9')][_0xec1d('0x116')](db[_0xec1d('0xc9')],{'as':_0xec1d('0x1be'),'foreignKey':_0xec1d('0x1bc')});db['Dynamics365Field'][_0xec1d('0x116')](db[_0xec1d('0xc9')],{'as':_0xec1d('0x1bf'),'foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xc9')][_0xec1d('0x116')](db[_0xec1d('0xc9')],{'as':_0xec1d('0x1c6'),'foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xc9')][_0xec1d('0x124')](db[_0xec1d('0x1c1')],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0x1cd')][_0xec1d('0x116')](db[_0xec1d('0xca')],{'as':'Configurations','onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ba')});db['FreshsalesConfiguration'][_0xec1d('0x116')](db[_0xec1d('0xcc')],{'as':_0xec1d('0x1bb'),'foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xca')][_0xec1d('0x116')](db[_0xec1d('0xcc')],{'as':'Descriptions','foreignKey':_0xec1d('0x1c0')});db[_0xec1d('0xca')][_0xec1d('0x116')](db['FreshsalesField'],{'as':_0xec1d('0x1b6'),'foreignKey':_0xec1d('0x1c4')});db['FreshsalesConfiguration'][_0xec1d('0x124')](db[_0xec1d('0x1cd')],{'as':'Account','foreignKey':_0xec1d('0x1ba')});db['FreshsalesField'][_0xec1d('0x116')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xec1d('0x1bc')});db[_0xec1d('0xcc')][_0xec1d('0x116')](db['FreshsalesField'],{'as':_0xec1d('0x1bf'),'foreignKey':'DescriptionId'});db[_0xec1d('0xcc')][_0xec1d('0x116')](db[_0xec1d('0xcc')],{'as':'Field','foreignKey':_0xec1d('0x1c4')});db[_0xec1d('0xcc')][_0xec1d('0x124')](db[_0xec1d('0x1c1')],{'as':_0xec1d('0x1c1'),'foreignKey':_0xec1d('0x1c2')});db[_0xec1d('0xd0')][_0xec1d('0x124')](db[_0xec1d('0x62')],{});db['ChatQueueReport'][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':'List','foreignKey':_0xec1d('0x169')});db[_0xec1d('0xd0')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xec1d('0xd0')]['belongsTo'](db[_0xec1d('0x11c')],{});db[_0xec1d('0xd0')]['belongsTo'](db[_0xec1d('0x69')],{});db[_0xec1d('0xd0')][_0xec1d('0x124')](db['User'],{});db[_0xec1d('0xd0')][_0xec1d('0x124')](db[_0xec1d('0x6d')],{});db['ChatInternalMessage'][_0xec1d('0x124')](db['User'],{'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1ce')});db[_0xec1d('0xd2')]['belongsTo'](db[_0xec1d('0x13')],{'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x1cf')});db[_0xec1d('0xd6')][_0xec1d('0x116')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xec1d('0x113')});db['JscriptySessionReport'][_0xec1d('0x116')](db[_0xec1d('0xd3')],{'foreignKey':_0xec1d('0x1d0'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0xd8')]['belongsTo'](db[_0xec1d('0x52')],{});db[_0xec1d('0xd8')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0xd8')]['belongsTo'](db[_0xec1d('0x74')],{'as':'Contact','foreignKey':_0xec1d('0x160')});db[_0xec1d('0xd8')]['belongsTo'](db[_0xec1d('0x11e')],{});db[_0xec1d('0xd8')]['belongsTo'](db[_0xec1d('0x57')],{});db[_0xec1d('0xd8')]['belongsTo'](db[_0xec1d('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0xec1d('0x59')],{});db[_0xec1d('0xdd')][_0xec1d('0x116')](db[_0xec1d('0xd6')],{'foreignKey':_0xec1d('0x1d1')});db[_0xec1d('0xdd')][_0xec1d('0x116')](db[_0xec1d('0x1d2')],{'foreignKey':_0xec1d('0x1d1')});db[_0xec1d('0xdd')]['hasMany'](db[_0xec1d('0xd3')],{'foreignKey':_0xec1d('0x1d1')});db[_0xec1d('0xe6')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x1d3')});db[_0xec1d('0xe6')][_0xec1d('0x126')](db[_0xec1d('0x1c')],{'through':_0xec1d('0x10b'),'as':_0xec1d('0x1d4')});db[_0xec1d('0xe6')][_0xec1d('0x126')](db[_0xec1d('0x3d')],{'through':_0xec1d('0x1d5'),'as':_0xec1d('0x133')});db[_0xec1d('0xe6')][_0xec1d('0x126')](db[_0xec1d('0x6d')],{'through':'team_has_chat_queues','as':_0xec1d('0x134')});db[_0xec1d('0xe6')][_0xec1d('0x126')](db[_0xec1d('0x4f')],{'through':_0xec1d('0x17d'),'as':_0xec1d('0x135')});db[_0xec1d('0xe6')]['belongsToMany'](db[_0xec1d('0x59')],{'through':_0xec1d('0x1d6'),'as':_0xec1d('0x137')});db[_0xec1d('0xe6')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0xec1d('0x18a'),'as':_0xec1d('0x138')});db[_0xec1d('0xe6')]['belongsToMany'](db[_0xec1d('0x108')],{'through':_0xec1d('0x1d7'),'as':_0xec1d('0x1d8')});db[_0xec1d('0xe6')]['belongsToMany'](db[_0xec1d('0xf6')],{'through':'TeamVoicePrefix','as':_0xec1d('0x132')});db[_0xec1d('0xe9')][_0xec1d('0x116')](db[_0xec1d('0x196')],{'as':_0xec1d('0x197'),'foreignKey':_0xec1d('0x19e')});db[_0xec1d('0xe9')][_0xec1d('0x116')](db[_0xec1d('0x79')],{'as':_0xec1d('0x14d'),'foreignKey':_0xec1d('0x19e')});db[_0xec1d('0xe9')][_0xec1d('0x116')](db[_0xec1d('0x7b')],{'as':_0xec1d('0x14e'),'foreignKey':_0xec1d('0x19e')});db['Campaign'][_0xec1d('0x116')](db[_0xec1d('0x77')],{'as':'HopperBlacks','foreignKey':_0xec1d('0x19e')});db[_0xec1d('0xe9')][_0xec1d('0x124')](db[_0xec1d('0x2b')],{'as':_0xec1d('0x2b'),'foreignKey':'TrunkId'});db[_0xec1d('0xe9')][_0xec1d('0x124')](db[_0xec1d('0x2b')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xec1d('0xe9')][_0xec1d('0x124')](db['Interval'],{'as':'Interval','foreignKey':_0xec1d('0x153')});db[_0xec1d('0xe9')]['belongsTo'](db[_0xec1d('0xe1')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xec1d('0xe9')]['belongsToMany'](db[_0xec1d('0xf4')],{'as':_0xec1d('0x1d9'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xec1d('0x126')](db[_0xec1d('0xf4')],{'as':'BlackLists','through':_0xec1d('0x1da')});db['Attachment'][_0xec1d('0x124')](db[_0xec1d('0x6b')],{'as':_0xec1d('0x6b'),'foreignKey':_0xec1d('0x175')});db[_0xec1d('0xed')][_0xec1d('0x124')](db[_0xec1d('0x41')],{});db['MailTransferReport'][_0xec1d('0x124')](db['MailInteraction'],{});db[_0xec1d('0xed')][_0xec1d('0x124')](db['MailAccount'],{'foreignKey':_0xec1d('0x1db'),'as':_0xec1d('0x1dc')});db[_0xec1d('0xed')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1dd'),'as':_0xec1d('0x1de')});db[_0xec1d('0xed')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1df'),'as':_0xec1d('0x1e0')});db[_0xec1d('0xed')][_0xec1d('0x124')](db['MailQueue'],{'foreignKey':_0xec1d('0x1e1'),'as':_0xec1d('0x1e2')});db['MailTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x3b')],{'foreignKey':_0xec1d('0x1e3'),'as':_0xec1d('0x1e4')});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x11c')],{});db[_0xec1d('0xee')][_0xec1d('0x124')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xec1d('0x1dc')});db[_0xec1d('0xee')]['belongsTo'](db['User'],{'foreignKey':_0xec1d('0x1dd'),'as':_0xec1d('0x1de')});db[_0xec1d('0xee')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1df'),'as':_0xec1d('0x1e0')});db['ChatTransferReport'][_0xec1d('0x124')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xec1d('0x1e2')});db['ChatTransferReport']['belongsTo'](db[_0xec1d('0x62')],{'foreignKey':_0xec1d('0x1e5'),'as':_0xec1d('0x1e4')});db[_0xec1d('0x1e6')][_0xec1d('0x124')](db[_0xec1d('0x17c')],{});db[_0xec1d('0x1e6')]['belongsTo'](db[_0xec1d('0x4c')],{});db['FaxTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x49')],{'foreignKey':_0xec1d('0x1e7'),'as':'FromAccount'});db[_0xec1d('0x1e6')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xec1d('0x1e6')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1df'),'as':'ToAgent'});db[_0xec1d('0x1e6')][_0xec1d('0x124')](db[_0xec1d('0x4f')],{'foreignKey':_0xec1d('0x1e8'),'as':_0xec1d('0x1e2')});db['FaxTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x49')],{'foreignKey':_0xec1d('0x1e9'),'as':_0xec1d('0x1e4')});db[_0xec1d('0x1ea')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xec1d('0x1ea')]['belongsTo'](db[_0xec1d('0x5f')],{});db[_0xec1d('0x1ea')][_0xec1d('0x124')](db[_0xec1d('0x5b')],{'foreignKey':_0xec1d('0x1eb'),'as':_0xec1d('0x1dc')});db['OpenchannelTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1dd'),'as':_0xec1d('0x1de')});db[_0xec1d('0x1ea')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1df'),'as':_0xec1d('0x1e0')});db['OpenchannelTransferReport']['belongsTo'](db[_0xec1d('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db['OpenchannelTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x5b')],{'foreignKey':_0xec1d('0x1ec'),'as':_0xec1d('0x1e4')});db[_0xec1d('0xf2')][_0xec1d('0x124')](db['SmsMessage'],{});db[_0xec1d('0xf2')][_0xec1d('0x124')](db[_0xec1d('0x11e')],{});db[_0xec1d('0xf2')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xec1d('0x1ed'),'as':'FromAccount'});db[_0xec1d('0xf2')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':'FromUserId','as':_0xec1d('0x1de')});db[_0xec1d('0xf2')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':_0xec1d('0x1df'),'as':_0xec1d('0x1e0')});db[_0xec1d('0xf2')][_0xec1d('0x124')](db[_0xec1d('0x59')],{'foreignKey':'ToSmsQueueId','as':_0xec1d('0x1e2')});db[_0xec1d('0xf2')][_0xec1d('0x124')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xec1d('0xf4')][_0xec1d('0x116')](db[_0xec1d('0x165')],{'as':'Dispositions','foreignKey':_0xec1d('0x169'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0xf4')]['hasMany'](db['CmCustomField'],{'as':_0xec1d('0x1ee'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0xf4')]['hasMany'](db['CmContact'],{'as':_0xec1d('0x129'),'onDelete':_0xec1d('0x113'),'foreignKey':_0xec1d('0x169')});db['CmList']['hasMany'](db[_0xec1d('0x79')],{'as':_0xec1d('0x14d'),'foreignKey':'ListId'});db[_0xec1d('0xf4')]['hasMany'](db[_0xec1d('0x7b')],{'as':_0xec1d('0x119'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0xf4')][_0xec1d('0x116')](db[_0xec1d('0x11a')],{'as':_0xec1d('0x11a'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0xec1d('0x1ef'),'through':_0xec1d('0x1f0')});db['CmList'][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x12a')});db[_0xec1d('0xf6')][_0xec1d('0x116')](db['VoiceExtension'],{'as':_0xec1d('0x118'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0xf6')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x10f')});db['VoicePrefix'][_0xec1d('0x126')](db['Team'],{'through':'TeamVoicePrefix','as':'Teams'});db[_0xec1d('0x125')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xec1d('0x1f1')});db[_0xec1d('0x125')][_0xec1d('0x116')](db[_0xec1d('0xf8')],{'as':_0xec1d('0x1f2'),'foreignKey':_0xec1d('0x1f1'),'onDelete':_0xec1d('0x113')});db[_0xec1d('0xf8')]['hasMany'](db[_0xec1d('0xfa')],{'as':_0xec1d('0x1f3'),'foreignKey':_0xec1d('0x1f4'),'onDelete':_0xec1d('0x113')});db['WhatsappAccount'][_0xec1d('0x116')](db['Disposition'],{'as':_0xec1d('0x17e'),'foreignKey':'WhatsappAccountId','onDelete':_0xec1d('0x113')});db[_0xec1d('0x142')][_0xec1d('0x116')](db['CannedAnswer'],{'as':_0xec1d('0x167'),'foreignKey':_0xec1d('0x1f5')});db[_0xec1d('0x142')][_0xec1d('0x116')](db[_0xec1d('0x103')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xec1d('0x142')][_0xec1d('0x116')](db['WhatsappInteraction'],{'as':_0xec1d('0x177')});db[_0xec1d('0x142')][_0xec1d('0x116')](db['WhatsappApplication'],{'as':_0xec1d('0x148')});db[_0xec1d('0x142')][_0xec1d('0x124')](db[_0xec1d('0xf4')],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0x142')][_0xec1d('0x124')](db[_0xec1d('0x88')],{'as':_0xec1d('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':'user_has_whatsapp_accounts'});db[_0xec1d('0xff')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'onDelete':_0xec1d('0x161')});db['WhatsappApplication']['belongsTo'](db[_0xec1d('0x108')],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0xff')][_0xec1d('0x124')](db[_0xec1d('0x142')],{'onDelete':_0xec1d('0x161')});db[_0xec1d('0xff')][_0xec1d('0x124')](db[_0xec1d('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication'][_0xec1d('0x124')](db[_0xec1d('0x90')],{'onDelete':_0xec1d('0x161'),'foreignKey':_0xec1d('0x176')});db['WhatsappInteraction'][_0xec1d('0x116')](db[_0xec1d('0x103')],{'as':'Messages','onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xec1d('0x124')](db[_0xec1d('0x142')],{'as':_0xec1d('0x173'),'foreignKey':'WhatsappAccountId'});db[_0xec1d('0x101')]['belongsTo'](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x101')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':'Owner','foreignKey':_0xec1d('0x114')});db[_0xec1d('0x101')]['belongsToMany'](db[_0xec1d('0x90')],{'through':_0xec1d('0x1ad'),'as':_0xec1d('0x16f')});db[_0xec1d('0x101')][_0xec1d('0x126')](db[_0xec1d('0x90')],{'through':_0xec1d('0x1ad'),'as':_0xec1d('0x182')});db[_0xec1d('0x101')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x170'),'through':'user_has_whatsapp_interactions','foreignKey':_0xec1d('0x1f6')});db['WhatsappMessage'][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':_0xec1d('0x13')});db['WhatsappMessage'][_0xec1d('0x124')](db[_0xec1d('0x74')],{'onDelete':_0xec1d('0x113'),'as':'Contact'});db[_0xec1d('0x103')][_0xec1d('0x124')](db[_0xec1d('0x101')],{'onDelete':_0xec1d('0x113'),'as':_0xec1d('0x183'),'foreignKey':_0xec1d('0x1f6')});db[_0xec1d('0x103')][_0xec1d('0x124')](db[_0xec1d('0x142')],{'as':_0xec1d('0x173'),'foreignKey':_0xec1d('0x1f5')});db[_0xec1d('0x104')][_0xec1d('0x124')](db[_0xec1d('0x142')],{});db[_0xec1d('0x104')][_0xec1d('0x124')](db['CmList'],{'as':_0xec1d('0x168'),'foreignKey':_0xec1d('0x169')});db[_0xec1d('0x104')][_0xec1d('0x124')](db[_0xec1d('0x74')],{'as':_0xec1d('0x15f'),'foreignKey':_0xec1d('0x160')});db[_0xec1d('0x104')][_0xec1d('0x124')](db[_0xec1d('0x101')],{});db[_0xec1d('0x104')][_0xec1d('0x124')](db[_0xec1d('0x108')],{});db[_0xec1d('0x104')][_0xec1d('0x124')](db['WhatsappMessage'],{});db[_0xec1d('0x104')][_0xec1d('0x124')](db['User'],{});db[_0xec1d('0x106')][_0xec1d('0x124')](db[_0xec1d('0x103')],{});db[_0xec1d('0x106')]['belongsTo'](db[_0xec1d('0x101')],{});db[_0xec1d('0x106')][_0xec1d('0x124')](db['WhatsappAccount'],{'foreignKey':_0xec1d('0x1f7'),'as':_0xec1d('0x1dc')});db['WhatsappTransferReport'][_0xec1d('0x124')](db[_0xec1d('0x142')],{'foreignKey':_0xec1d('0x1f8'),'as':'ToAccount'});db[_0xec1d('0x106')][_0xec1d('0x124')](db[_0xec1d('0x108')],{'foreignKey':_0xec1d('0x1f9'),'as':_0xec1d('0x1e2')});db[_0xec1d('0x106')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'foreignKey':'FromUserId','as':_0xec1d('0x1de')});db[_0xec1d('0x106')]['belongsTo'](db[_0xec1d('0x13')],{'foreignKey':'ToUserId','as':_0xec1d('0x1e0')});db[_0xec1d('0x108')][_0xec1d('0x126')](db[_0xec1d('0x13')],{'as':_0xec1d('0x156'),'through':_0xec1d('0x139'),'foreignKey':_0xec1d('0x1fa')});db[_0xec1d('0x108')][_0xec1d('0x126')](db[_0xec1d('0xe6')],{'through':_0xec1d('0x1d7'),'as':_0xec1d('0x157')});db[_0xec1d('0x110')][_0xec1d('0x124')](db[_0xec1d('0x13')],{'as':'user','foreignKey':_0xec1d('0x114'),'onDelete':_0xec1d('0x113'),'hooks':!![]});db[_0xec1d('0x109')][_0xec1d('0x112')](db[_0xec1d('0xc6')],{'as':_0xec1d('0xc6'),'onDelete':_0xec1d('0x161')});db[_0xec1d('0x109')][_0xec1d('0x112')](db['MailServerIn'],{'as':_0xec1d('0x164'),'onDelete':'restrict'});db[_0xec1d('0x109')][_0xec1d('0x112')](db['MailServerOut'],{'as':_0xec1d('0x1fb'),'onDelete':_0xec1d('0x161')});module[_0xec1d('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5a282be..b249066 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x922d=['./api/pm2','/api/logs','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/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/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./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/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2'];(function(_0x417ed2,_0x1ab762){var _0x1c42c0=function(_0x43e88d){while(--_0x43e88d){_0x417ed2['push'](_0x417ed2['shift']());}};_0x1c42c0(++_0x1ab762);}(_0x922d,0x117));var _0xd922=function(_0x33c228,_0x5dd746){_0x33c228=_0x33c228-0x0;var _0x4cc4b8=_0x922d[_0x33c228];return _0x4cc4b8;};'use strict';var path=require(_0xd922('0x0'));var express=require(_0xd922('0x1'));var errors=require(_0xd922('0x2'));var config=require(_0xd922('0x3'));var setupLoggers=require(_0xd922('0x4'))[_0xd922('0x5')];var clientSideLogs=require(_0xd922('0x6'));exports['default']=function(_0x40d79d){return setupLoggers(_0x40d79d)[_0xd922('0x7')](function(){_0x40d79d[_0xd922('0x8')]('/api/users',require(_0xd922('0x9')));_0x40d79d['use'](_0xd922('0xa'),require('./api/voiceChanSpy'));_0x40d79d['use'](_0xd922('0xb'),require(_0xd922('0xc')));_0x40d79d[_0xd922('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x40d79d[_0xd922('0x8')](_0xd922('0xd'),require('./api/voiceMusicOnHold'));_0x40d79d[_0xd922('0x8')](_0xd922('0xe'),require('./api/voiceQueue'));_0x40d79d[_0xd922('0x8')](_0xd922('0xf'),require('./api/voiceRecording'));_0x40d79d[_0xd922('0x8')](_0xd922('0x10'),require(_0xd922('0x11')));_0x40d79d[_0xd922('0x8')]('/api/voice/mails',require('./api/voiceMail'));_0x40d79d[_0xd922('0x8')](_0xd922('0x12'),require(_0xd922('0x13')));_0x40d79d[_0xd922('0x8')](_0xd922('0x14'),require(_0xd922('0x15')));_0x40d79d[_0xd922('0x8')]('/api/voice/dials/reports',require(_0xd922('0x16')));_0x40d79d[_0xd922('0x8')]('/api/voice/agents/reports',require(_0xd922('0x17')));_0x40d79d['use'](_0xd922('0x18'),require(_0xd922('0x19')));_0x40d79d[_0xd922('0x8')]('/api/members/reports',require('./api/memberReport'));_0x40d79d[_0xd922('0x8')](_0xd922('0x1a'),require(_0xd922('0x1b')));_0x40d79d[_0xd922('0x8')](_0xd922('0x1c'),require(_0xd922('0x1d')));_0x40d79d[_0xd922('0x8')](_0xd922('0x1e'),require(_0xd922('0x1f')));_0x40d79d[_0xd922('0x8')](_0xd922('0x20'),require('./api/mailAccount'));_0x40d79d[_0xd922('0x8')](_0xd922('0x21'),require('./api/mailQueue'));_0x40d79d[_0xd922('0x8')](_0xd922('0x22'),require('./api/mailSubstatus'));_0x40d79d[_0xd922('0x8')](_0xd922('0x23'),require('./api/mailInteraction'));_0x40d79d[_0xd922('0x8')]('/api/mail/messages',require(_0xd922('0x24')));_0x40d79d[_0xd922('0x8')](_0xd922('0x25'),require(_0xd922('0x26')));_0x40d79d[_0xd922('0x8')](_0xd922('0x27'),require(_0xd922('0x28')));_0x40d79d['use'](_0xd922('0x29'),require(_0xd922('0x2a')));_0x40d79d[_0xd922('0x8')](_0xd922('0x2b'),require('./api/dashboardItem'));_0x40d79d[_0xd922('0x8')](_0xd922('0x2c'),require(_0xd922('0x2d')));_0x40d79d[_0xd922('0x8')](_0xd922('0x2e'),require('./api/faxApplication'));_0x40d79d['use'](_0xd922('0x2f'),require(_0xd922('0x30')));_0x40d79d[_0xd922('0x8')](_0xd922('0x31'),require(_0xd922('0x32')));_0x40d79d[_0xd922('0x8')](_0xd922('0x33'),require('./api/faxQueue'));_0x40d79d[_0xd922('0x8')](_0xd922('0x34'),require('./api/faxQueueReport'));_0x40d79d[_0xd922('0x8')]('/api/sms/accounts',require(_0xd922('0x35')));_0x40d79d['use']('/api/sms/applications',require('./api/smsApplication'));_0x40d79d[_0xd922('0x8')](_0xd922('0x36'),require(_0xd922('0x37')));_0x40d79d[_0xd922('0x8')](_0xd922('0x38'),require(_0xd922('0x39')));_0x40d79d[_0xd922('0x8')]('/api/sms/queues',require(_0xd922('0x3a')));_0x40d79d[_0xd922('0x8')]('/api/openchannel/accounts',require(_0xd922('0x3b')));_0x40d79d[_0xd922('0x8')]('/api/openchannel/applications',require(_0xd922('0x3c')));_0x40d79d[_0xd922('0x8')](_0xd922('0x3d'),require('./api/openchannelInteraction'));_0x40d79d[_0xd922('0x8')](_0xd922('0x3e'),require(_0xd922('0x3f')));_0x40d79d[_0xd922('0x8')](_0xd922('0x40'),require('./api/openchannelQueue'));_0x40d79d[_0xd922('0x8')]('/api/chat/websites',require(_0xd922('0x41')));_0x40d79d[_0xd922('0x8')](_0xd922('0x42'),require(_0xd922('0x43')));_0x40d79d[_0xd922('0x8')](_0xd922('0x44'),require(_0xd922('0x45')));_0x40d79d[_0xd922('0x8')](_0xd922('0x46'),require(_0xd922('0x47')));_0x40d79d[_0xd922('0x8')](_0xd922('0x48'),require(_0xd922('0x49')));_0x40d79d['use']('/api/chat/offline_messages',require(_0xd922('0x4a')));_0x40d79d[_0xd922('0x8')](_0xd922('0x4b'),require('./api/chatQueue'));_0x40d79d[_0xd922('0x8')]('/api/chat/groups',require(_0xd922('0x4c')));_0x40d79d[_0xd922('0x8')](_0xd922('0x4d'),require('./api/chatProactiveAction'));_0x40d79d[_0xd922('0x8')](_0xd922('0x4e'),require(_0xd922('0x4f')));_0x40d79d[_0xd922('0x8')](_0xd922('0x50'),require(_0xd922('0x51')));_0x40d79d[_0xd922('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x40d79d[_0xd922('0x8')]('/api/cm/hopper_black',require(_0xd922('0x52')));_0x40d79d[_0xd922('0x8')](_0xd922('0x53'),require(_0xd922('0x54')));_0x40d79d[_0xd922('0x8')](_0xd922('0x55'),require(_0xd922('0x56')));_0x40d79d[_0xd922('0x8')](_0xd922('0x57'),require(_0xd922('0x58')));_0x40d79d['use'](_0xd922('0x59'),require(_0xd922('0x5a')));_0x40d79d['use'](_0xd922('0x5b'),require(_0xd922('0x5c')));_0x40d79d[_0xd922('0x8')](_0xd922('0x5d'),require('./api/cannedAnswer'));_0x40d79d[_0xd922('0x8')](_0xd922('0x5e'),require(_0xd922('0x5f')));_0x40d79d['use'](_0xd922('0x60'),require(_0xd922('0x61')));_0x40d79d[_0xd922('0x8')](_0xd922('0x62'),require(_0xd922('0x63')));_0x40d79d['use'](_0xd922('0x64'),require('./api/pause'));_0x40d79d[_0xd922('0x8')](_0xd922('0x65'),require(_0xd922('0x66')));_0x40d79d[_0xd922('0x8')](_0xd922('0x67'),require(_0xd922('0x68')));_0x40d79d['use'](_0xd922('0x69'),require(_0xd922('0x6a')));_0x40d79d[_0xd922('0x8')](_0xd922('0x6b'),require('./api/sound'));_0x40d79d[_0xd922('0x8')](_0xd922('0x6c'),require(_0xd922('0x6d')));_0x40d79d[_0xd922('0x8')]('/api/contact_item_types',require(_0xd922('0x6e')));_0x40d79d[_0xd922('0x8')]('/api/cm_contact_has_items',require(_0xd922('0x6f')));_0x40d79d['use']('/api/cm_hopper_additional_phones',require(_0xd922('0x70')));_0x40d79d[_0xd922('0x8')](_0xd922('0x71'),require(_0xd922('0x72')));_0x40d79d[_0xd922('0x8')]('/api/triggers',require(_0xd922('0x73')));_0x40d79d[_0xd922('0x8')](_0xd922('0x74'),require(_0xd922('0x75')));_0x40d79d['use']('/api/integrations',require(_0xd922('0x76')));_0x40d79d[_0xd922('0x8')](_0xd922('0x77'),require('./api/integrationReport'));_0x40d79d[_0xd922('0x8')](_0xd922('0x78'),require(_0xd922('0x79')));_0x40d79d[_0xd922('0x8')]('/api/analytics/default_reports',require(_0xd922('0x7a')));_0x40d79d[_0xd922('0x8')](_0xd922('0x7b'),require(_0xd922('0x7c')));_0x40d79d[_0xd922('0x8')](_0xd922('0x7d'),require(_0xd922('0x7e')));_0x40d79d[_0xd922('0x8')](_0xd922('0x7f'),require(_0xd922('0x80')));_0x40d79d[_0xd922('0x8')](_0xd922('0x81'),require('./api/analyticTreeReport'));_0x40d79d[_0xd922('0x8')]('/api/integrations/salesforce/accounts',require(_0xd922('0x82')));_0x40d79d['use'](_0xd922('0x83'),require(_0xd922('0x84')));_0x40d79d[_0xd922('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x40d79d['use']('/api/integrations/sugarcrm/accounts',require(_0xd922('0x85')));_0x40d79d['use'](_0xd922('0x86'),require(_0xd922('0x87')));_0x40d79d[_0xd922('0x8')](_0xd922('0x88'),require(_0xd922('0x89')));_0x40d79d[_0xd922('0x8')](_0xd922('0x8a'),require('./api/intDeskAccount'));_0x40d79d[_0xd922('0x8')]('/api/integrations/desk/configurations',require(_0xd922('0x8b')));_0x40d79d[_0xd922('0x8')](_0xd922('0x8c'),require(_0xd922('0x8d')));_0x40d79d[_0xd922('0x8')]('/api/integrations/zoho/accounts',require(_0xd922('0x8e')));_0x40d79d['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x40d79d[_0xd922('0x8')](_0xd922('0x8f'),require(_0xd922('0x90')));_0x40d79d[_0xd922('0x8')](_0xd922('0x91'),require('./api/intZendeskAccount'));_0x40d79d[_0xd922('0x8')](_0xd922('0x92'),require(_0xd922('0x93')));_0x40d79d['use'](_0xd922('0x94'),require('./api/intZendeskField'));_0x40d79d['use']('/api/integrations/freshdesk/accounts',require(_0xd922('0x95')));_0x40d79d[_0xd922('0x8')](_0xd922('0x96'),require(_0xd922('0x97')));_0x40d79d[_0xd922('0x8')](_0xd922('0x98'),require(_0xd922('0x99')));_0x40d79d[_0xd922('0x8')](_0xd922('0x9a'),require(_0xd922('0x9b')));_0x40d79d[_0xd922('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x40d79d[_0xd922('0x8')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x40d79d[_0xd922('0x8')](_0xd922('0x9c'),require('./api/intServicenowAccount'));_0x40d79d[_0xd922('0x8')](_0xd922('0x9d'),require('./api/intServicenowConfiguration'));_0x40d79d[_0xd922('0x8')](_0xd922('0x9e'),require(_0xd922('0x9f')));_0x40d79d['use'](_0xd922('0xa0'),require(_0xd922('0xa1')));_0x40d79d[_0xd922('0x8')](_0xd922('0xa2'),require('./api/intDynamics365Configuration'));_0x40d79d['use'](_0xd922('0xa3'),require('./api/intDynamics365Field'));_0x40d79d[_0xd922('0x8')]('/api/integrations/freshsales/accounts',require(_0xd922('0xa4')));_0x40d79d[_0xd922('0x8')](_0xd922('0xa5'),require(_0xd922('0xa6')));_0x40d79d[_0xd922('0x8')](_0xd922('0xa7'),require(_0xd922('0xa8')));_0x40d79d[_0xd922('0x8')](_0xd922('0xa9'),require(_0xd922('0xaa')));_0x40d79d[_0xd922('0x8')](_0xd922('0xab'),require(_0xd922('0xac')));_0x40d79d[_0xd922('0x8')](_0xd922('0xad'),require(_0xd922('0xae')));_0x40d79d[_0xd922('0x8')](_0xd922('0xaf'),require(_0xd922('0xb0')));_0x40d79d['use'](_0xd922('0xb1'),require(_0xd922('0xb2')));_0x40d79d[_0xd922('0x8')](_0xd922('0xb3'),require(_0xd922('0xb4')));_0x40d79d[_0xd922('0x8')](_0xd922('0xb5'),require('./api/smsQueueReport'));_0x40d79d[_0xd922('0x8')](_0xd922('0xb6'),require(_0xd922('0xb7')));_0x40d79d[_0xd922('0x8')]('/api/square/details/reports',require(_0xd922('0xb8')));_0x40d79d['use'](_0xd922('0xb9'),require(_0xd922('0xba')));_0x40d79d[_0xd922('0x8')](_0xd922('0xbb'),require('./api/setting'));_0x40d79d[_0xd922('0x8')](_0xd922('0xbc'),require(_0xd922('0xbd')));_0x40d79d['use'](_0xd922('0xbe'),require(_0xd922('0xbf')));_0x40d79d[_0xd922('0x8')](_0xd922('0xc0'),require(_0xd922('0xc1')));_0x40d79d[_0xd922('0x8')](_0xd922('0xc2'),require(_0xd922('0xc3')));_0x40d79d['use'](_0xd922('0xc4'),require('./api/team'));_0x40d79d[_0xd922('0x8')](_0xd922('0xc5'),require('./api/license'));_0x40d79d[_0xd922('0x8')](_0xd922('0xc6'),require('./api/campaign'));_0x40d79d[_0xd922('0x8')](_0xd922('0xc7'),require('./api/migration'));_0x40d79d['use'](_0xd922('0xc8'),require(_0xd922('0xc9')));_0x40d79d[_0xd922('0x8')]('/api/plugins',require(_0xd922('0xca')));_0x40d79d[_0xd922('0x8')](_0xd922('0xcb'),require('./api/mailTransferReport'));_0x40d79d[_0xd922('0x8')](_0xd922('0xcc'),require('./api/chatTransferReport'));_0x40d79d['use'](_0xd922('0xcd'),require(_0xd922('0xce')));_0x40d79d[_0xd922('0x8')]('/api/openchannel/reports/transfer',require(_0xd922('0xcf')));_0x40d79d[_0xd922('0x8')](_0xd922('0xd0'),require(_0xd922('0xd1')));_0x40d79d[_0xd922('0x8')](_0xd922('0xd2'),require(_0xd922('0xd3')));_0x40d79d['use'](_0xd922('0xd4'),require(_0xd922('0xd5')));_0x40d79d[_0xd922('0x8')](_0xd922('0xd6'),require(_0xd922('0xd7')));_0x40d79d[_0xd922('0x8')]('/api/userProfile/sections',require(_0xd922('0xd8')));_0x40d79d[_0xd922('0x8')](_0xd922('0xd9'),require(_0xd922('0xda')));_0x40d79d[_0xd922('0x8')]('/api/userNotifications',require(_0xd922('0xdb')));_0x40d79d[_0xd922('0x8')](_0xd922('0xdc'),require('./api/whatsappAccount'));_0x40d79d[_0xd922('0x8')](_0xd922('0xdd'),require('./api/whatsappApplication'));_0x40d79d[_0xd922('0x8')](_0xd922('0xde'),require(_0xd922('0xdf')));_0x40d79d[_0xd922('0x8')](_0xd922('0xe0'),require(_0xd922('0xe1')));_0x40d79d['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x40d79d['use'](_0xd922('0xe2'),require(_0xd922('0xe3')));_0x40d79d['use'](_0xd922('0xe4'),require(_0xd922('0xe5')));_0x40d79d[_0xd922('0x8')](_0xd922('0xe6'),require('./api/cloudProvider'));_0x40d79d[_0xd922('0x8')](_0xd922('0xe7'),require(_0xd922('0xe8')));_0x40d79d[_0xd922('0x8')](_0xd922('0xe9'),require(_0xd922('0xea')));_0x40d79d['use'](_0xd922('0xeb'),require('./api/authLocal'));_0x40d79d[_0xd922('0x8')](_0xd922('0xec'),require(_0xd922('0xed')));_0x40d79d[_0xd922('0x8')](_0xd922('0xee'),require(_0xd922('0xef')));_0x40d79d[_0xd922('0x8')](_0xd922('0xf0'),require(_0xd922('0xf1')));_0x40d79d['use'](_0xd922('0xf2'),require(_0xd922('0xf3')));_0x40d79d['use'](_0xd922('0xf4'),require('./api/version'));_0x40d79d[_0xd922('0x8')](_0xd922('0xf5'),require('./api/system'));_0x40d79d[_0xd922('0x8')](_0xd922('0xf6'),require(_0xd922('0xf7')));_0x40d79d[_0xd922('0x8')]('/api/webbar',require('./api/webbar'));_0x40d79d[_0xd922('0x8')](_0xd922('0xf8'),clientSideLogs);_0x40d79d['use']('/apidoc',express[_0xd922('0xf9')](path[_0xd922('0xfa')](config[_0xd922('0xfb')],'/apidoc')));_0x40d79d['use'](_0xd922('0xfc'),express[_0xd922('0xf9')](path[_0xd922('0xfa')](config[_0xd922('0xfb')],_0xd922('0xfc'))));_0x40d79d[_0xd922('0x8')](_0xd922('0xfd'),express[_0xd922('0xf9')](path[_0xd922('0xfa')](config['root'],_0xd922('0xfd'))));_0x40d79d[_0xd922('0x8')](_0xd922('0xfe'),express[_0xd922('0xf9')](path[_0xd922('0xfa')](config[_0xd922('0xfb')],_0xd922('0xff'),_0xd922('0x100'))));_0x40d79d[_0xd922('0x8')](_0xd922('0x101'),express[_0xd922('0xf9')](path[_0xd922('0xfa')](config[_0xd922('0xfb')],'/server/files/plugins')));_0x40d79d[_0xd922('0x102')](_0xd922('0x103'))[_0xd922('0x104')](errors[0x194]);_0x40d79d[_0xd922('0x102')]('/*')[_0xd922('0x104')](function(_0x38eb6f,_0x14e94b){_0x14e94b['sendFile'](path[_0xd922('0x105')](_0x40d79d[_0xd922('0x104')]('appPath')+_0xd922('0x106')));});return _0x40d79d;});}; \ No newline at end of file +var _0x31ab=['/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/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/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','/snippet','snippet','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','resolve','get','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/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/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount'];(function(_0x18f69c,_0x5cde7b){var _0x2b73e1=function(_0xe272e4){while(--_0xe272e4){_0x18f69c['push'](_0x18f69c['shift']());}};_0x2b73e1(++_0x5cde7b);}(_0x31ab,0x18b));var _0xb31a=function(_0x5ddd5c,_0x2958d7){_0x5ddd5c=_0x5ddd5c-0x0;var _0x59b82f=_0x31ab[_0x5ddd5c];return _0x59b82f;};'use strict';var path=require(_0xb31a('0x0'));var express=require(_0xb31a('0x1'));var errors=require(_0xb31a('0x2'));var config=require(_0xb31a('0x3'));var setupLoggers=require(_0xb31a('0x4'))['setupLoggers'];var clientSideLogs=require(_0xb31a('0x5'));exports[_0xb31a('0x6')]=function(_0xfca6b0){return setupLoggers(_0xfca6b0)[_0xb31a('0x7')](function(){_0xfca6b0[_0xb31a('0x8')]('/api/users',require(_0xb31a('0x9')));_0xfca6b0['use'](_0xb31a('0xa'),require(_0xb31a('0xb')));_0xfca6b0[_0xb31a('0x8')]('/api/voice/contexts',require(_0xb31a('0xc')));_0xfca6b0[_0xb31a('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd'),require('./api/voiceMusicOnHold'));_0xfca6b0['use']('/api/voice/queues',require(_0xb31a('0xe')));_0xfca6b0['use'](_0xb31a('0xf'),require(_0xb31a('0x10')));_0xfca6b0['use'](_0xb31a('0x11'),require('./api/screenRecording'));_0xfca6b0[_0xb31a('0x8')]('/api/voice/mails',require(_0xb31a('0x12')));_0xfca6b0[_0xb31a('0x8')]('/api/voice/mails/messages',require(_0xb31a('0x13')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x14'),require(_0xb31a('0x15')));_0xfca6b0['use'](_0xb31a('0x16'),require(_0xb31a('0x17')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x18'),require(_0xb31a('0x19')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x1a'),require(_0xb31a('0x1b')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x1c'),require('./api/memberReport'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x1d'),require(_0xb31a('0x1e')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x1f'),require(_0xb31a('0x20')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x21'),require(_0xb31a('0x22')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x23'),require(_0xb31a('0x24')));_0xfca6b0['use'](_0xb31a('0x25'),require('./api/mailQueue'));_0xfca6b0[_0xb31a('0x8')]('/api/mail/substatuses',require(_0xb31a('0x26')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x27'),require('./api/mailInteraction'));_0xfca6b0['use']('/api/mail/messages',require('./api/mailMessage'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x28'),require(_0xb31a('0x29')));_0xfca6b0['use'](_0xb31a('0x2a'),require(_0xb31a('0x2b')));_0xfca6b0[_0xb31a('0x8')]('/api/dashboards',require(_0xb31a('0x2c')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x2d'),require(_0xb31a('0x2e')));_0xfca6b0[_0xb31a('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0xfca6b0['use'](_0xb31a('0x2f'),require(_0xb31a('0x30')));_0xfca6b0[_0xb31a('0x8')]('/api/fax/interactions',require(_0xb31a('0x31')));_0xfca6b0[_0xb31a('0x8')]('/api/fax/messages',require(_0xb31a('0x32')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x33'),require(_0xb31a('0x34')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x35'),require(_0xb31a('0x36')));_0xfca6b0[_0xb31a('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x37'),require(_0xb31a('0x38')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x39'),require(_0xb31a('0x3a')));_0xfca6b0['use'](_0xb31a('0x3b'),require(_0xb31a('0x3c')));_0xfca6b0[_0xb31a('0x8')]('/api/sms/queues',require(_0xb31a('0x3d')));_0xfca6b0['use'](_0xb31a('0x3e'),require('./api/openchannelAccount'));_0xfca6b0[_0xb31a('0x8')]('/api/openchannel/applications',require(_0xb31a('0x3f')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x40'),require('./api/openchannelInteraction'));_0xfca6b0['use'](_0xb31a('0x41'),require(_0xb31a('0x42')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x43'),require(_0xb31a('0x44')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x45'),require(_0xb31a('0x46')));_0xfca6b0['use'](_0xb31a('0x47'),require(_0xb31a('0x48')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x49'),require(_0xb31a('0x4a')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x4b'),require(_0xb31a('0x4c')));_0xfca6b0[_0xb31a('0x8')]('/api/chat/messages',require(_0xb31a('0x4d')));_0xfca6b0['use']('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x4e'),require('./api/chatQueue'));_0xfca6b0['use'](_0xb31a('0x4f'),require(_0xb31a('0x50')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x51'),require('./api/chatProactiveAction'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x52'),require(_0xb31a('0x53')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x54'),require(_0xb31a('0x55')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x56'),require('./api/cmHopper'));_0xfca6b0['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0xfca6b0[_0xb31a('0x8')]('/api/cm/hopper_final',require(_0xb31a('0x57')));_0xfca6b0['use'](_0xb31a('0x58'),require('./api/cmHopperHistory'));_0xfca6b0['use'](_0xb31a('0x59'),require(_0xb31a('0x5a')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x5b'),require('./api/action'));_0xfca6b0['use'](_0xb31a('0x5c'),require(_0xb31a('0x5d')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x5e'),require(_0xb31a('0x5f')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x60'),require(_0xb31a('0x61')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x62'),require(_0xb31a('0x63')));_0xfca6b0['use'](_0xb31a('0x64'),require(_0xb31a('0x65')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x66'),require(_0xb31a('0x67')));_0xfca6b0['use'](_0xb31a('0x68'),require(_0xb31a('0x69')));_0xfca6b0['use'](_0xb31a('0x6a'),require(_0xb31a('0x6b')));_0xfca6b0[_0xb31a('0x8')]('/api/schedules',require(_0xb31a('0x6c')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x6d'),require(_0xb31a('0x6e')));_0xfca6b0[_0xb31a('0x8')]('/api/tags',require(_0xb31a('0x6f')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x70'),require('./api/contactItemType'));_0xfca6b0[_0xb31a('0x8')]('/api/cm_contact_has_items',require(_0xb31a('0x71')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x72'),require(_0xb31a('0x73')));_0xfca6b0['use'](_0xb31a('0x74'),require(_0xb31a('0x75')));_0xfca6b0['use'](_0xb31a('0x76'),require(_0xb31a('0x77')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x78'),require(_0xb31a('0x79')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x7a'),require(_0xb31a('0x7b')));_0xfca6b0['use'](_0xb31a('0x7c'),require(_0xb31a('0x7d')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x7e'),require(_0xb31a('0x7f')));_0xfca6b0['use'](_0xb31a('0x80'),require(_0xb31a('0x81')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x82'),require(_0xb31a('0x83')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x84'),require(_0xb31a('0x85')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x86'),require(_0xb31a('0x87')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x88'),require(_0xb31a('0x89')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x8a'),require('./api/intSalesforceAccount'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x8b'),require('./api/intSalesforceConfiguration'));_0xfca6b0[_0xb31a('0x8')]('/api/integrations/salesforce/fields',require(_0xb31a('0x8c')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x8d'),require(_0xb31a('0x8e')));_0xfca6b0[_0xb31a('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xb31a('0x8f')));_0xfca6b0['use'](_0xb31a('0x90'),require('./api/intSugarcrmField'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x91'),require(_0xb31a('0x92')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x93'),require(_0xb31a('0x94')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x95'),require(_0xb31a('0x96')));_0xfca6b0['use'](_0xb31a('0x97'),require(_0xb31a('0x98')));_0xfca6b0['use'](_0xb31a('0x99'),require('./api/intZohoConfiguration'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x9a'),require(_0xb31a('0x9b')));_0xfca6b0['use'](_0xb31a('0x9c'),require(_0xb31a('0x9d')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x9e'),require('./api/intZendeskConfiguration'));_0xfca6b0['use'](_0xb31a('0x9f'),require('./api/intZendeskField'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xa0'),require('./api/intFreshdeskAccount'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xa1'),require(_0xb31a('0xa2')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xa3'),require(_0xb31a('0xa4')));_0xfca6b0['use'](_0xb31a('0xa5'),require(_0xb31a('0xa6')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xa7'),require(_0xb31a('0xa8')));_0xfca6b0[_0xb31a('0x8')]('/api/integrations/vtiger/fields',require(_0xb31a('0xa9')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xaa'),require(_0xb31a('0xab')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xac'),require('./api/intServicenowConfiguration'));_0xfca6b0[_0xb31a('0x8')]('/api/integrations/servicenow/fields',require(_0xb31a('0xad')));_0xfca6b0['use'](_0xb31a('0xae'),require(_0xb31a('0xaf')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb0'),require('./api/intDynamics365Configuration'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb1'),require('./api/intDynamics365Field'));_0xfca6b0[_0xb31a('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb2'),require('./api/intFreshsalesConfiguration'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb3'),require('./api/intFreshsalesField'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb4'),require(_0xb31a('0xb5')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb6'),require(_0xb31a('0xb7')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xb8'),require(_0xb31a('0xb9')));_0xfca6b0[_0xb31a('0x8')]('/api/jscripty/answers/reports',require(_0xb31a('0xba')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xbb'),require(_0xb31a('0xbc')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xbd'),require('./api/jscriptySessionReport'));_0xfca6b0[_0xb31a('0x8')]('/api/sms/reports/queue',require(_0xb31a('0xbe')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xbf'),require(_0xb31a('0xc0')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xc1'),require(_0xb31a('0xc2')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xc3'),require(_0xb31a('0xc4')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xc5'),require(_0xb31a('0xc6')));_0xfca6b0['use'](_0xb31a('0xc7'),require('./api/squareOdbc'));_0xfca6b0['use'](_0xb31a('0xc8'),require(_0xb31a('0xc9')));_0xfca6b0[_0xb31a('0x8')]('/api/square/recordings',require('./api/squareRecording'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xca'),require(_0xb31a('0xcb')));_0xfca6b0[_0xb31a('0x8')]('/api/teams',require(_0xb31a('0xcc')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xcd'),require('./api/license'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xce'),require(_0xb31a('0xcf')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd0'),require(_0xb31a('0xd1')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd2'),require(_0xb31a('0xd3')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd4'),require('./api/plugin'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd5'),require(_0xb31a('0xd6')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd7'),require(_0xb31a('0xd8')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xd9'),require('./api/faxTransferReport'));_0xfca6b0['use'](_0xb31a('0xda'),require(_0xb31a('0xdb')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xdc'),require(_0xb31a('0xdd')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xde'),require(_0xb31a('0xdf')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xe0'),require(_0xb31a('0xe1')));_0xfca6b0[_0xb31a('0x8')]('/api/userProfiles',require(_0xb31a('0xe2')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xe3'),require(_0xb31a('0xe4')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xe5'),require(_0xb31a('0xe6')));_0xfca6b0['use'](_0xb31a('0xe7'),require(_0xb31a('0xe8')));_0xfca6b0[_0xb31a('0x8')]('/api/whatsapp/accounts',require(_0xb31a('0xe9')));_0xfca6b0[_0xb31a('0x8')]('/api/whatsapp/applications',require(_0xb31a('0xea')));_0xfca6b0['use'](_0xb31a('0xeb'),require('./api/whatsappInteraction'));_0xfca6b0['use'](_0xb31a('0xec'),require(_0xb31a('0xed')));_0xfca6b0[_0xb31a('0x8')]('/api/whatsapp/reports/queue',require(_0xb31a('0xee')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xef'),require('./api/whatsappTransferReport'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xf0'),require(_0xb31a('0xf1')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xf2'),require(_0xb31a('0xf3')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xf4'),require(_0xb31a('0xf5')));_0xfca6b0[_0xb31a('0x8')]('/api/user-settings',require(_0xb31a('0xf6')));_0xfca6b0[_0xb31a('0x8')]('/api/auth/local',require('./api/authLocal'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xf7'),require('./api/authGoogle'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xf8'),require(_0xb31a('0xf9')));_0xfca6b0[_0xb31a('0x8')]('/api/jira',require('./api/jira'));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xfa'),require(_0xb31a('0xfb')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xfc'),require(_0xb31a('0xfd')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0xfe'),require(_0xb31a('0xff')));_0xfca6b0['use']('/api/pm2',require(_0xb31a('0x100')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x101'),require(_0xb31a('0x102')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x103'),clientSideLogs);_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x104'),express[_0xb31a('0x105')](path[_0xb31a('0x106')](config['root'],_0xb31a('0x104'))));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x107'),express['static'](path[_0xb31a('0x106')](config['root'],'/www')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x108'),express[_0xb31a('0x105')](path[_0xb31a('0x106')](config[_0xb31a('0x109')],_0xb31a('0x108'))));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x10a'),express[_0xb31a('0x105')](path[_0xb31a('0x106')](config[_0xb31a('0x109')],_0xb31a('0x10b'),'3.1.0')));_0xfca6b0[_0xb31a('0x8')](_0xb31a('0x10c'),express[_0xb31a('0x105')](path[_0xb31a('0x106')](config['root'],'/server/files/plugins')));_0xfca6b0['route'](_0xb31a('0x10d'))['get'](errors[0x194]);_0xfca6b0['route']('/*')['get'](function(_0x34c54e,_0x2d2720){_0x2d2720['sendFile'](path[_0xb31a('0x10e')](_0xfca6b0[_0xb31a('0x10f')](_0xb31a('0x110'))+_0xb31a('0x111')));});return _0xfca6b0;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 71edc4e..bfee9d7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd983=['../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.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','http','port','rpc','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc'];(function(_0x11caa3,_0x7f2ae6){var _0x4fb170=function(_0x568829){while(--_0x568829){_0x11caa3['push'](_0x11caa3['shift']());}};_0x4fb170(++_0x7f2ae6);}(_0xd983,0x7d));var _0x3d98=function(_0x569892,_0x26a674){_0x569892=_0x569892-0x0;var _0xa70981=_0xd983[_0x569892];return _0xa70981;};'use strict';var jayson=require(_0x3d98('0x0'));var _=require(_0x3d98('0x1'));var config=require(_0x3d98('0x2'));exports['listen']=function(){return new Promise(function(_0x282341,_0x1d5601){var _0x1cb3ca={};_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x4')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x5')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x6')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x7')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x8')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x9')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0xa')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0xb')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0xc')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0xd')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/mailServerIn/mailServerIn.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0xe')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0xf')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x10')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x11')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x12')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x13')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x14')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/faxApplication/faxApplication.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x15')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/faxMessage/faxMessage.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x16')));_0x1cb3ca=_['merge'](_0x1cb3ca,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/smsAccount/smsAccount.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x17')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x18')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/smsQueue/smsQueue.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x19')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x1a')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x1b')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/chatInteraction/chatInteraction.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x1c')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x1d')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x1e')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x1f')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x20')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x21')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x22')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x23')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x24')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x25')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x26')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x27')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x28')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x29')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x2a')));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x2b')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x2c')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x2d')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x2e')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x2f')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x30')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x31')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x32')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x33')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x34')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x35')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/squareOdbc/squareOdbc.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x36')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x37')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x38')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x39')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/attachment/attachment.rpc'));_0x1cb3ca=_['merge'](_0x1cb3ca,require(_0x3d98('0x3a')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require(_0x3d98('0x3b')));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1cb3ca=_[_0x3d98('0x3')](_0x1cb3ca,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2a1f18=jayson['server'](_0x1cb3ca)[_0x3d98('0x3c')]();var _0x312e3d=config['rpc']['port']||config[_0x3d98('0x3d')]+0x1;var _0x31e41b=config[_0x3d98('0x3e')]['ip']||_0x3d98('0x3f');_0x2a1f18['on'](_0x3d98('0x40'),function(_0x37b149){return _0x1d5601(_0x37b149);});_0x2a1f18[_0x3d98('0x41')](_0x312e3d,_0x31e41b,function(){console[_0x3d98('0x42')](_0x3d98('0x43'),_0x31e41b,_0x312e3d);require(_0x3d98('0x44'))[_0x3d98('0x45')]();return _0x282341(_0x3d98('0x46')+_0x31e41b+':'+_0x312e3d);});});}; \ No newline at end of file +var _0x029a=['../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','rpc','port','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../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/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc'];(function(_0x4ff666,_0x35c126){var _0x5cf1ae=function(_0x5bc33a){while(--_0x5bc33a){_0x4ff666['push'](_0x4ff666['shift']());}};_0x5cf1ae(++_0x35c126);}(_0x029a,0xb5));var _0xa029=function(_0x15c773,_0x325c41){_0x15c773=_0x15c773-0x0;var _0x81312c=_0x029a[_0x15c773];return _0x81312c;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa029('0x0'));var config=require(_0xa029('0x1'));exports['listen']=function(){return new Promise(function(_0x1641f3,_0x5cf600){var _0x31aaba={};_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/user/user.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/voiceExtension/voiceExtension.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/voiceQueue/voiceQueue.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x3')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x4')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x5')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/memberReport/memberReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x6')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/mailServerIn/mailServerIn.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/mailAccount/mailAccount.rpc'));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x7')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x8')));_0x31aaba=_['merge'](_0x31aaba,require('../api/mailMessage/mailMessage.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x9')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0xa')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0xb')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/faxInteraction/faxInteraction.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0xc')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0xd')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0xe')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0xf')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x10')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x11')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x12')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x13')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x14')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x31aaba=_['merge'](_0x31aaba,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x15')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x16')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x17')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/cmContact/cmContact.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x18')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x19')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x1a')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x1b')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x1c')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x1d')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x1e')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x1f')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x20')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/trigger/trigger.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x21')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x22')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x23')));_0x31aaba=_['merge'](_0x31aaba,require(_0xa029('0x24')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x25')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x26')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x27')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x28')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x29')));_0x31aaba=_['merge'](_0x31aaba,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2a')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/squareOdbc/squareOdbc.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/squareProject/squareProject.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/squareRecording/squareRecording.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2b')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2c')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/attachment/attachment.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2d')));_0x31aaba=_['merge'](_0x31aaba,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2e')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x2f')));_0x31aaba=_[_0xa029('0x2')](_0x31aaba,require(_0xa029('0x30')));var _0x402366=jayson[_0xa029('0x31')](_0x31aaba)['http']();var _0x50fcee=config[_0xa029('0x32')][_0xa029('0x33')]||config[_0xa029('0x33')]+0x1;var _0x4a32ab=config['rpc']['ip']||'localhost';_0x402366['on']('error',function(_0x4e926d){return _0x5cf600(_0x4e926d);});_0x402366[_0xa029('0x34')](_0x50fcee,_0x4a32ab,function(){console['log'](_0xa029('0x35'),_0x4a32ab,_0x50fcee);require('../config/triggers')[_0xa029('0x36')]();return _0x1641f3(_0xa029('0x37')+_0x4a32ab+':'+_0x50fcee);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d7bf10d..64f21e0 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 _0xd9db=['split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith'];(function(_0x396145,_0x4c46cc){var _0x163af7=function(_0x54383f){while(--_0x54383f){_0x396145['push'](_0x396145['shift']());}};_0x163af7(++_0x4c46cc);}(_0xd9db,0x8a));var _0xbd9d=function(_0xbd300c,_0x2daccf){_0xbd300c=_0xbd300c-0x0;var _0x4216a5=_0xd9db[_0xbd300c];return _0x4216a5;};'use strict';var util=require(_0xbd9d('0x0'));var _=require(_0xbd9d('0x1'));var EventEmitter=require('events')[_0xbd9d('0x2')];var AGIReply=require(_0xbd9d('0x3'));var AGIError=require(_0xbd9d('0x4'));function AGIChannel(_0x2e2a1b){var _0x11af25=this,_0x284c2b=new AGIReply(),_0x363833=![],_0x126901={};EventEmitter[_0xbd9d('0x5')](_0x11af25);_0x2e2a1b[_0xbd9d('0x6')](_0xbd9d('0x7'));_0x2e2a1b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x284c2b['setEncoding'](_0xbd9d('0x7'));_0x284c2b['on'](_0xbd9d('0x8'),function(_0x1b71e7){for(var _0x59d653 in _0x1b71e7){_0x11af25[_0x59d653]=_0x1b71e7[_0x59d653];}_0x11af25[_0xbd9d('0x9')](_0xbd9d('0xa'));});_0x284c2b['on'](_0xbd9d('0xb'),function(_0x3a0414){if(_0x3a0414[_0xbd9d('0xc')]()==_0xbd9d('0xd')){_0x11af25[_0xbd9d('0x9')](_0xbd9d('0xd'));return;}if(_0x3a0414[_0xbd9d('0xe')](0x0,0xb)==_0xbd9d('0xf')){_0x363833=!![];}if(_0x363833){_0x126901['rx']+=_0x3a0414+'\x0a';if(_0x3a0414[_0xbd9d('0x10')](_0xbd9d('0x11'))!=-0x1){_0x363833=![];}}else{_0x126901['rx']=_0x3a0414;}if(_0x363833){return;}if(typeof _0x126901['cb']==_0xbd9d('0x12')){var _0x53da90=_0x126901['rx']['substring'](0x0,0x3),_0xf5f13=null,_0x1820b9=null;_0x53da90=parseInt(_0x53da90);if(isNaN(_0x53da90)){_0x126901['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbd9d('0x13')});return;}if(_0x53da90!=0xc8){_0x126901['cb'](null,{'code':_0x53da90,'result':-0x1,'extra':'KO'});return;}_0xf5f13=_0x126901['rx']['substring'](0x4)[_0xbd9d('0x14')]('result=','');if(_0xf5f13[_0xbd9d('0x15')]('\x20')!=-0x1){_0xf5f13=_0xf5f13[_0xbd9d('0x16')](0x0,_0xf5f13[_0xbd9d('0x15')]('\x20'));}if(_[_0xbd9d('0x17')](_0xf5f13,'-1')){_0xf5f13=parseInt(_0xf5f13);}_0x1820b9=_0x126901['rx'][_0xbd9d('0x18')]('\x20');if(_0x1820b9[_0xbd9d('0x19')]==0x3){_0x1820b9=_0x1820b9[0x2][_0xbd9d('0xe')](0x1,_0x1820b9[0x2][_0xbd9d('0x19')]-0x1);}else if(_0x1820b9['length']>0x3){var _0x1e56ae=/\((.+)\)/;var _0xa0de52=_0x126901['rx']['match'](_0x1e56ae);if(_0xa0de52){_0x1820b9=_0xa0de52[0x1];}else{_0x1820b9=null;}}else{_0x1820b9=null;}_0x126901['cb'](null,{'code':_0x53da90,'result':_0xf5f13,'extra':_0x1820b9});}});_0x2e2a1b['on'](_0xbd9d('0x1a'),function(_0x4cce3c){_0x11af25['emit'](_0xbd9d('0x1a'),new AGIError(_0xbd9d('0x1b'),_0x4cce3c[_0xbd9d('0x1c')]));});_0x2e2a1b['on'](_0xbd9d('0x1d'),function(){_0x11af25[_0xbd9d('0x9')]('close',new AGIError(_0xbd9d('0x1e')));});_0x2e2a1b['on'](_0xbd9d('0x1f'),function(){_0x11af25[_0xbd9d('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2e2a1b[_0xbd9d('0x20')]();});_0x2e2a1b[_0xbd9d('0x21')](_0x284c2b);this[_0xbd9d('0x22')]=function(_0x58af8e,_0x358fdf){var _0x58af8e=_0x58af8e||'',_0x358fdf=typeof _0x358fdf=='function'?_0x358fdf:new Function();_0x126901={'tx':_0x58af8e,'rx':'','cb':_0x358fdf};_0x2e2a1b[_0xbd9d('0x23')](_0x58af8e+'\x0a');},this[_0xbd9d('0x1d')]=function(){_0x2e2a1b[_0xbd9d('0x20')]();};}util[_0xbd9d('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x26')]=function(_0x3f125e){return this[_0xbd9d('0x22')][_0xbd9d('0x27')](this,_0x3f125e);};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x28')]=function(){return this[_0xbd9d('0x26')](_0xbd9d('0x29'));};AGIChannel['prototype'][_0xbd9d('0x2a')]=function(_0x30efbc,_0x123654,_0x188b64){_0x30efbc=_0x30efbc===undefined?_0xbd9d('0x2b'):_0x30efbc;_0x123654=_0x123654===undefined?'5':_0x123654;_0x188b64=_0x188b64===undefined?'1':_0x188b64;return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x2d'),_0x30efbc,_0x123654*0x3e8,_0x188b64));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x2e')]=function(_0x77fef8){_0x77fef8=_0x77fef8||'NO\x20MESSAGE';return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x2f'),_0x77fef8));};AGIChannel[_0xbd9d('0x25')]['exec']=function(_0x2c1a54,_0x1a1074){if(_[_0xbd9d('0x30')](_0x1a1074)){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x31'),_0x2c1a54,_0x1a1074['join'](',')));}return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x31'),_0x2c1a54,_0x1a1074));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x32')]=function(_0x5af60c){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x33'),_0x5af60c));};AGIChannel['prototype'][_0xbd9d('0x34')]=function(_0x3e96c2){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')]('SET\x20EXTENSION\x20%s',_0x3e96c2));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x35')]=function(_0x536463){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')]('SET\x20PRIORITY\x20%s',_0x536463));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0xd')]=function(){return this[_0xbd9d('0x26')](_0xbd9d('0x36'));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x37')]=function(_0x4aee9f,_0x4697a7){var _0x1598e8=_[_0xbd9d('0x38')](_0x4697a7)||_[_0xbd9d('0x39')](_0x4697a7)?_0x4697a7[_0xbd9d('0x3a')]():_0x4697a7;return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4aee9f,_0x1598e8?_0x1598e8[_0xbd9d('0x3a')]()[_0xbd9d('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x3b')]=function(_0x4c5a18,_0x1d40d2){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x3c'),_0x4c5a18,_0x1d40d2));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x3d')]=function(_0x530475,_0x8a16a4){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x3e'),_0x530475,_0x8a16a4));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x3f')]=function(_0x5739e2,_0x36e96f){return this[_0xbd9d('0x26')](util[_0xbd9d('0x2c')](_0xbd9d('0x40'),_0x5739e2,_0x36e96f));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x41')]=function(_0x31a21b,_0x1d5c4e,_0x31c105){_0x1d5c4e=_0x1d5c4e||this['extension'];_0x31c105=_0x31c105||0x1;this['setContext'](_0x31a21b);this[_0xbd9d('0x34')](_0x1d5c4e);this[_0xbd9d('0x35')](_0x31c105);return this[_0xbd9d('0x2e')](util[_0xbd9d('0x2c')](_0xbd9d('0x42'),_0x31a21b,_0x1d5c4e,_0x31c105));};AGIChannel['prototype'][_0xbd9d('0x43')]=function(_0x1f7ec6){return this['sendRequest'](util[_0xbd9d('0x2c')](_0xbd9d('0x44'),_0x1f7ec6));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x45')]=function(_0x1935f4,_0x2e5d44,_0x18073e,_0x60c281,_0xc08ccf,_0x43d6c4){_0x2e5d44=_0x2e5d44||_0xbd9d('0x46');_0x18073e=_0x18073e||'';_0x60c281=_0x60c281===undefined?-0x1:_0x60c281==='-1'?-0x1:_0x60c281*0x3e8;_0xc08ccf=_0xc08ccf===undefined?'':'s='+_0xc08ccf;_0x43d6c4=_0x43d6c4?_0xbd9d('0x47'):'';return this[_0xbd9d('0x26')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1935f4,_0x2e5d44,_0x18073e,_0x60c281,_0x43d6c4,_0xc08ccf));};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x48')]=function(_0x2d4316,_0x252dee){_0x252dee=_0x252dee||'';return this['sendRequest'](util[_0xbd9d('0x2c')](_0xbd9d('0x49'),_0x2d4316,_0x252dee));};AGIChannel['prototype'][_0xbd9d('0x4a')]=function(_0xc36d05){return this['exec'](_0xbd9d('0x4b'),_0xc36d05);};AGIChannel[_0xbd9d('0x25')][_0xbd9d('0x4c')]=function(_0x5717bd){return this[_0xbd9d('0x4d')](_0xbd9d('0x4e'),_0x5717bd);};AGIChannel['prototype'][_0xbd9d('0x1a')]=function(_0x2f3c99,_0x13a737){this[_0xbd9d('0x2e')](util[_0xbd9d('0x2c')](_0xbd9d('0x4f'),_0x2f3c99['id'],_0x2f3c99[_0xbd9d('0x50')],_0x13a737));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x5078=['sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x1d80f1,_0x810c4c){var _0x9df9b4=function(_0x136fab){while(--_0x136fab){_0x1d80f1['push'](_0x1d80f1['shift']());}};_0x9df9b4(++_0x810c4c);}(_0x5078,0x148));var _0x8507=function(_0x2605e7,_0x236140){_0x2605e7=_0x2605e7-0x0;var _0x1982c3=_0x5078[_0x2605e7];return _0x1982c3;};'use strict';var util=require(_0x8507('0x0'));var _=require(_0x8507('0x1'));var EventEmitter=require(_0x8507('0x2'))[_0x8507('0x3')];var AGIReply=require(_0x8507('0x4'));var AGIError=require(_0x8507('0x5'));function AGIChannel(_0x43500e){var _0x20608d=this,_0x1a4930=new AGIReply(),_0x239a82=![],_0x2aa379={};EventEmitter[_0x8507('0x6')](_0x20608d);_0x43500e[_0x8507('0x7')](_0x8507('0x8'));_0x43500e[_0x8507('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1a4930[_0x8507('0x7')]('utf8');_0x1a4930['on'](_0x8507('0xa'),function(_0x2a4991){for(var _0x2a7f27 in _0x2a4991){_0x20608d[_0x2a7f27]=_0x2a4991[_0x2a7f27];}_0x20608d['emit']('ready');});_0x1a4930['on'](_0x8507('0xb'),function(_0x1c71f5){if(_0x1c71f5[_0x8507('0xc')]()==_0x8507('0xd')){_0x20608d[_0x8507('0xe')](_0x8507('0xd'));return;}if(_0x1c71f5[_0x8507('0xf')](0x0,0xb)=='520-Invalid'){_0x239a82=!![];}if(_0x239a82){_0x2aa379['rx']+=_0x1c71f5+'\x0a';if(_0x1c71f5[_0x8507('0x10')](_0x8507('0x11'))!=-0x1){_0x239a82=![];}}else{_0x2aa379['rx']=_0x1c71f5;}if(_0x239a82){return;}if(typeof _0x2aa379['cb']==_0x8507('0x12')){var _0x31109f=_0x2aa379['rx']['substring'](0x0,0x3),_0x21a236=null,_0x5c41e2=null;_0x31109f=parseInt(_0x31109f);if(isNaN(_0x31109f)){_0x2aa379['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8507('0x13')});return;}if(_0x31109f!=0xc8){_0x2aa379['cb'](null,{'code':_0x31109f,'result':-0x1,'extra':'KO'});return;}_0x21a236=_0x2aa379['rx'][_0x8507('0xf')](0x4)[_0x8507('0x14')](_0x8507('0x15'),'');if(_0x21a236[_0x8507('0x16')]('\x20')!=-0x1){_0x21a236=_0x21a236[_0x8507('0x17')](0x0,_0x21a236['indexOf']('\x20'));}if(_['startsWith'](_0x21a236,'-1')){_0x21a236=parseInt(_0x21a236);}_0x5c41e2=_0x2aa379['rx'][_0x8507('0x18')]('\x20');if(_0x5c41e2[_0x8507('0x19')]==0x3){_0x5c41e2=_0x5c41e2[0x2][_0x8507('0xf')](0x1,_0x5c41e2[0x2]['length']-0x1);}else if(_0x5c41e2[_0x8507('0x19')]>0x3){var _0x375a0d=/\((.+)\)/;var _0x26bfaf=_0x2aa379['rx'][_0x8507('0x1a')](_0x375a0d);if(_0x26bfaf){_0x5c41e2=_0x26bfaf[0x1];}else{_0x5c41e2=null;}}else{_0x5c41e2=null;}_0x2aa379['cb'](null,{'code':_0x31109f,'result':_0x21a236,'extra':_0x5c41e2});}});_0x43500e['on'](_0x8507('0x1b'),function(_0x13b285){_0x20608d[_0x8507('0xe')](_0x8507('0x1b'),new AGIError('E_AGI_SOCKET_ERROR',_0x13b285['code']));});_0x43500e['on'](_0x8507('0x1c'),function(){_0x20608d[_0x8507('0xe')](_0x8507('0x1c'),new AGIError(_0x8507('0x1d')));});_0x43500e['on'](_0x8507('0x1e'),function(){_0x20608d['emit'](_0x8507('0x1e'),new AGIError(_0x8507('0x1f')));_0x43500e[_0x8507('0x20')]();});_0x43500e[_0x8507('0x21')](_0x1a4930);this[_0x8507('0x22')]=function(_0x14eac2,_0x42e5ff){var _0x14eac2=_0x14eac2||'',_0x42e5ff=typeof _0x42e5ff==_0x8507('0x12')?_0x42e5ff:new Function();_0x2aa379={'tx':_0x14eac2,'rx':'','cb':_0x42e5ff};_0x43500e[_0x8507('0x23')](_0x14eac2+'\x0a');},this[_0x8507('0x1c')]=function(){_0x43500e[_0x8507('0x20')]();};}util[_0x8507('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x8507('0x25')][_0x8507('0x26')]=function(_0x358e50){return this['command'][_0x8507('0x27')](this,_0x358e50);};AGIChannel[_0x8507('0x25')][_0x8507('0x28')]=function(){return this['sendRequest'](_0x8507('0x29'));};AGIChannel[_0x8507('0x25')][_0x8507('0x2a')]=function(_0x160402,_0x4fd7c0,_0xc48bf5){_0x160402=_0x160402===undefined?_0x8507('0x2b'):_0x160402;_0x4fd7c0=_0x4fd7c0===undefined?'5':_0x4fd7c0;_0xc48bf5=_0xc48bf5===undefined?'1':_0xc48bf5;return this[_0x8507('0x26')](util[_0x8507('0x2c')](_0x8507('0x2d'),_0x160402,_0x4fd7c0*0x3e8,_0xc48bf5));};AGIChannel['prototype'][_0x8507('0x2e')]=function(_0xb01c06){_0xb01c06=_0xb01c06||_0x8507('0x2f');return this[_0x8507('0x26')](util[_0x8507('0x2c')](_0x8507('0x30'),_0xb01c06));};AGIChannel[_0x8507('0x25')][_0x8507('0x31')]=function(_0xa3642,_0x6e9a38){if(_[_0x8507('0x32')](_0x6e9a38)){return this[_0x8507('0x26')](util[_0x8507('0x2c')]('EXEC\x20%s\x20%s',_0xa3642,_0x6e9a38['join'](',')));}return this[_0x8507('0x26')](util['format'](_0x8507('0x33'),_0xa3642,_0x6e9a38));};AGIChannel[_0x8507('0x25')]['setContext']=function(_0x53595c){return this['sendRequest'](util[_0x8507('0x2c')](_0x8507('0x34'),_0x53595c));};AGIChannel[_0x8507('0x25')][_0x8507('0x35')]=function(_0x181a99){return this[_0x8507('0x26')](util['format']('SET\x20EXTENSION\x20%s',_0x181a99));};AGIChannel[_0x8507('0x25')][_0x8507('0x36')]=function(_0xc9d20f){return this['sendRequest'](util['format'](_0x8507('0x37'),_0xc9d20f));};AGIChannel[_0x8507('0x25')]['hangup']=function(){return this[_0x8507('0x26')](_0x8507('0x38'));};AGIChannel['prototype']['setVariable']=function(_0x51048c,_0x134f88){var _0x14c87b=_[_0x8507('0x39')](_0x134f88)||_[_0x8507('0x3a')](_0x134f88)?_0x134f88['toString']():_0x134f88;return this['sendRequest'](util[_0x8507('0x2c')](_0x8507('0x3b'),_0x51048c,_0x14c87b?_0x14c87b['toString']()[_0x8507('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8507('0x25')][_0x8507('0x3c')]=function(_0x4bc252,_0xfd452e){return this[_0x8507('0x26')](util[_0x8507('0x2c')](_0x8507('0x3d'),_0x4bc252,_0xfd452e));};AGIChannel[_0x8507('0x25')][_0x8507('0x3e')]=function(_0x5b4872,_0x42e640){return this[_0x8507('0x26')](util['format'](_0x8507('0x3f'),_0x5b4872,_0x42e640));};AGIChannel[_0x8507('0x25')]['sayPhonetic']=function(_0x2297a8,_0x500eb6){return this[_0x8507('0x26')](util[_0x8507('0x2c')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2297a8,_0x500eb6));};AGIChannel[_0x8507('0x25')]['continueAt']=function(_0x3051fb,_0xd2d97,_0x44f25d){_0xd2d97=_0xd2d97||this[_0x8507('0x40')];_0x44f25d=_0x44f25d||0x1;this[_0x8507('0x41')](_0x3051fb);this[_0x8507('0x35')](_0xd2d97);this['setPriority'](_0x44f25d);return this[_0x8507('0x2e')](util[_0x8507('0x2c')](_0x8507('0x42'),_0x3051fb,_0xd2d97,_0x44f25d));};AGIChannel[_0x8507('0x25')]['getVariable']=function(_0x260a98){return this[_0x8507('0x26')](util['format'](_0x8507('0x43'),_0x260a98));};AGIChannel[_0x8507('0x25')][_0x8507('0x44')]=function(_0x4f6ef0,_0x3e22d7,_0x4e2621,_0x2865cf,_0xebe038,_0xa09a2c){_0x3e22d7=_0x3e22d7||_0x8507('0x45');_0x4e2621=_0x4e2621||'';_0x2865cf=_0x2865cf===undefined?-0x1:_0x2865cf==='-1'?-0x1:_0x2865cf*0x3e8;_0xebe038=_0xebe038===undefined?'':'s='+_0xebe038;_0xa09a2c=_0xa09a2c?'BEEP':'';return this[_0x8507('0x26')](util[_0x8507('0x2c')](_0x8507('0x46'),_0x4f6ef0,_0x3e22d7,_0x4e2621,_0x2865cf,_0xa09a2c,_0xebe038));};AGIChannel[_0x8507('0x25')]['streamFile']=function(_0x5f4c21,_0x4d4b97){_0x4d4b97=_0x4d4b97||'';return this[_0x8507('0x26')](util[_0x8507('0x2c')](_0x8507('0x47'),_0x5f4c21,_0x4d4b97));};AGIChannel[_0x8507('0x25')][_0x8507('0x48')]=function(_0x171b20){return this['exec'](_0x8507('0x49'),_0x171b20);};AGIChannel[_0x8507('0x25')]['wait']=function(_0x3fa349){return this[_0x8507('0x31')](_0x8507('0x4a'),_0x3fa349);};AGIChannel[_0x8507('0x25')][_0x8507('0x1b')]=function(_0x42fb62,_0x4858b6){this['noop'](util['format'](_0x8507('0x4b'),_0x42fb62['id'],_0x42fb62[_0x8507('0x4c')],_0x4858b6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8507('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index af3f8cd..f48a19c 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 _0xbcda=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x9b5ab4,_0x456641){var _0x1a56da=function(_0x5c534e){while(--_0x5c534e){_0x9b5ab4['push'](_0x9b5ab4['shift']());}};_0x1a56da(++_0x456641);}(_0xbcda,0x107));var _0xabcd=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xbcda[_0x3054be];return _0x3df150;};'use strict';var util=require(_0xabcd('0x0'));var error={'E_AGI_UNDEFINED':_0xabcd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xabcd('0x2'),'E_AGI_SERVER_CLOSE':_0xabcd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xabcd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xabcd('0x5'),'E_AGI_SOCKET_ERROR':_0xabcd('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xabcd('0x7'),'E_AGI_COMMAND_EMPTY':_0xabcd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xabcd('0x9'),'E_AGI_IVR_ENTRY':_0xabcd('0xa')};function AGIError(_0x4192bf){var _0x4192bf=_0x4192bf||null,_0x34e099=_0x34e099||[],_0x5395bc=0x1,_0x35baa6='';if(!error[_0x4192bf]){_0x4192bf=_0xabcd('0xb');}_0x34e099['push'](error[_0x4192bf]);while(arguments[_0x5395bc]){_0x34e099[_0xabcd('0xc')](arguments[_0x5395bc]);_0x5395bc++;}_0x35baa6=util[_0xabcd('0xd')][_0xabcd('0xe')](util,_0x34e099);this[_0xabcd('0xf')]=_0x35baa6;this[_0xabcd('0x10')]=_0x4192bf;}module[_0xabcd('0x11')]=AGIError; \ No newline at end of file +var _0x9e33=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x1e48fc,_0x354e58){var _0x5a6098=function(_0x34bf43){while(--_0x34bf43){_0x1e48fc['push'](_0x1e48fc['shift']());}};_0x5a6098(++_0x354e58);}(_0x9e33,0x174));var _0x39e3=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x9e33[_0x152121];return _0x592a85;};'use strict';var util=require(_0x39e3('0x0'));var error={'E_AGI_UNDEFINED':_0x39e3('0x1'),'E_AGI_ARGUMENT_PORT':_0x39e3('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x39e3('0x3'),'E_AGI_SOCKET_ERROR':_0x39e3('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x39e3('0x5'),'E_AGI_COMMAND_EMPTY':_0x39e3('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x39e3('0x7'),'E_AGI_IVR_ENTRY':_0x39e3('0x8')};function AGIError(_0x58198f){var _0x58198f=_0x58198f||null,_0x11b97c=_0x11b97c||[],_0x444984=0x1,_0x541ab7='';if(!error[_0x58198f]){_0x58198f='E_AGI_UNDEFINED';}_0x11b97c['push'](error[_0x58198f]);while(arguments[_0x444984]){_0x11b97c['push'](arguments[_0x444984]);_0x444984++;}_0x541ab7=util['format'][_0x39e3('0x9')](util,_0x11b97c);this[_0x39e3('0xa')]=_0x541ab7;this[_0x39e3('0xb')]=_0x58198f;}module[_0x39e3('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d88d464..897be14 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc3a=['../../config/environment','redis','subscribe','emit','E_AGI_SERVER_ERROR','message','agi','parse','error','exports','lodash','events'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdc3a,0xfa));var _0xadc3=function(_0x520129,_0xb5bb86){_0x520129=_0x520129-0x0;var _0xd52628=_0xdc3a[_0x520129];return _0xd52628;};'use strict';var _=require(_0xadc3('0x0'));var EventEmitter=require(_0xadc3('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0xadc3('0x2'));config[_0xadc3('0x3')]=_['defaults'](config[_0xadc3('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xadc3('0x3')]);sub[_0xadc3('0x4')]('agi',function(_0x3bc712){if(_0x3bc712)return eventEmitter[_0xadc3('0x5')]('error',new AGIError(_0xadc3('0x6'),_0x3bc712));});sub['on'](_0xadc3('0x7'),function(_0x2159a8,_0x162f21){if(_0x2159a8!==_0xadc3('0x8'))return;try{var _0x346df0=JSON[_0xadc3('0x9')](_0x162f21);eventEmitter[_0xadc3('0x5')]('projectUpdate',_0x346df0);}catch(_0x5aef38){eventEmitter[_0xadc3('0x5')](_0xadc3('0xa'),new AGIError(_0xadc3('0x6'),_0x5aef38));}});module[_0xadc3('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x24d4=['ioredis','./error','defaults','localhost','redis','agi','error','parse','emit','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter'];(function(_0x2d573d,_0x148520){var _0x56ec1e=function(_0x434d29){while(--_0x434d29){_0x2d573d['push'](_0x2d573d['shift']());}};_0x56ec1e(++_0x148520);}(_0x24d4,0x10b));var _0x424d=function(_0x179604,_0x48c283){_0x179604=_0x179604-0x0;var _0x29b655=_0x24d4[_0x179604];return _0x29b655;};'use strict';var _=require(_0x424d('0x0'));var EventEmitter=require(_0x424d('0x1'))[_0x424d('0x2')];var Redis=require(_0x424d('0x3'));var AGIError=require(_0x424d('0x4'));var config=require('../../config/environment');config['redis']=_[_0x424d('0x5')](config['redis'],{'host':_0x424d('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x424d('0x7')]);sub['subscribe'](_0x424d('0x8'),function(_0x11159f){if(_0x11159f)return eventEmitter['emit'](_0x424d('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x11159f));});sub['on']('message',function(_0x3e0d9d,_0xb8d560){if(_0x3e0d9d!==_0x424d('0x8'))return;try{var _0x1fd2d0=JSON[_0x424d('0xa')](_0xb8d560);eventEmitter[_0x424d('0xb')](_0x424d('0xc'),_0x1fd2d0);}catch(_0x300700){eventEmitter[_0x424d('0xb')]('error',new AGIError(_0x424d('0xd'),_0x300700));}});module[_0x424d('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4b1f640..2350f90 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 _0xfe0d=['getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0xfe0d,0x1d0));var _0xdfe0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe0d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xdfe0('0x0'));var logger=require(_0xdfe0('0x1'))('agi');var verticesWithRetry=[_0xdfe0('0x2'),_0xdfe0('0x3'),_0xdfe0('0x4')];var Graph=function(){this[_0xdfe0('0x5')]={};this[_0xdfe0('0x6')]={};this[_0xdfe0('0x7')]=0x0;};Graph['prototype']['addVertex']=function(_0x5c934d){this[_0xdfe0('0x5')][_0x5c934d['id']]=_0x5c934d;this['edges'][_0x5c934d['id']]=[];};Graph[_0xdfe0('0x8')][_0xdfe0('0x9')]=function(_0x203c9d,_0xa853bb,_0x567d16){this[_0xdfe0('0x6')][_0x203c9d][_0xdfe0('0xa')]({'target':_0xa853bb,'condition':_0x567d16});this[_0xdfe0('0x7')]+=0x1;};Graph[_0xdfe0('0x8')][_0xdfe0('0xb')]=function(){return _[_0xdfe0('0xb')](this[_0xdfe0('0x5')]);};Graph[_0xdfe0('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph['prototype'][_0xdfe0('0xc')]=function(_0x523e54){return this[_0xdfe0('0x5')][_0x523e54];};Graph[_0xdfe0('0x8')][_0xdfe0('0xd')]=function(_0x191b37,_0x250b2c){if(!this[_0xdfe0('0x5')][_0x191b37]){return logger['info'](_0xdfe0('0xe'));}var _0x800c1d=_0x250b2c(this['vertices'][_0x191b37]);if(!_0x800c1d){return logger[_0xdfe0('0xf')](_0xdfe0('0x10'));}if(this[_0xdfe0('0x6')][_0x191b37][_0xdfe0('0x11')]===0x0){return logger[_0xdfe0('0xf')]('no\x20edge/s\x20available');}for(var _0x2887ba=0x0,_0x229aee=[],_0x548dbf=![];_0x2887ba\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','EventEmitter','projectUpdate','error','findIndex','deleted','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info'];(function(_0x33c529,_0x15bd67){var _0x1ff5ef=function(_0x5b78b1){while(--_0x5b78b1){_0x33c529['push'](_0x33c529['shift']());}};_0x1ff5ef(++_0x15bd67);}(_0xdf67,0x1b1));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7df6('0x0'));var syncho=require(_0x7df6('0x1'));var util=require(_0x7df6('0x2'));var config=require(_0x7df6('0x3'));var logger=require('../../config/logger')(_0x7df6('0x4'));var utilLicense=require(_0x7df6('0x5'));var rpc=require(_0x7df6('0x6'));var Project=require('./project');var AGIEmitter=require('./events')[_0x7df6('0x7')];var projects=[];config[_0x7df6('0x4')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x7df6('0x8'),projectUpdateHandler);function connectionHandler(_0x1b16bf){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1b16bf);agiHandler(_0x1b16bf);}catch(_0x506284){logger[_0x7df6('0x9')](_0x506284['stack']);}});});}function projectUpdateHandler(_0x2de2d4){try{var _0x4dc401=_[_0x7df6('0xa')](projects,['id',_0x2de2d4['id']]);if(_0x4dc401>-0x1){if(_0x2de2d4[_0x7df6('0xb')]===!![]){projects['splice'](_0x4dc401,0x1);}else{projects[_0x4dc401]=_0x2de2d4;}}else{projects['push'](_0x2de2d4);}}catch(_0x4e2c70){logger[_0x7df6('0x9')](_0x4e2c70['stack']);}}function listeningHandler(){console['log'](_0x7df6('0xc'),config[_0x7df6('0x4')][_0x7df6('0xd')]);logger[_0x7df6('0xe')](util[_0x7df6('0xf')](_0x7df6('0x10'),config['agi']['ip'],config[_0x7df6('0x4')][_0x7df6('0xd')]));}function errorHandler(_0x491497){if(_0x491497&&_0x491497['name']&&_0x491497[_0x7df6('0x11')]){logger['error'](util[_0x7df6('0xf')](_0x7df6('0x12'),_0x491497[_0x7df6('0x13')],_0x491497[_0x7df6('0x11')]));}else{logger[_0x7df6('0x9')](util[_0x7df6('0xf')](_0x7df6('0x14'),_0x491497[_0x7df6('0x15')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x7df6('0x16')],this['callerid'],this[_0x7df6('0x17')],this[_0x7df6('0x18')]));try{createSquareReport(this);}catch(_0x4f7e1c){logger[_0x7df6('0x9')](_0x4f7e1c[_0x7df6('0x15')]);}}function timeoutHandler(){logger[_0x7df6('0xe')](util[_0x7df6('0xf')](_0x7df6('0x19'),this['arg_1'],this['calleridname'],this[_0x7df6('0x1a')],this[_0x7df6('0x17')],this[_0x7df6('0x18')]));}function hangupHandler(){logger[_0x7df6('0xe')](util[_0x7df6('0xf')](_0x7df6('0x1b'),this[_0x7df6('0x1c')],this[_0x7df6('0x16')],this[_0x7df6('0x1a')],this['dnid'],this['uniqueid']));this[_0x7df6('0x1d')]=!![];}function createSquareReport(_0x108a8c,_0x3c4586){rpc[_0x7df6('0x1e')](_0x108a8c)[_0x7df6('0x1f')](function(_0x3364d5){if(_0x3c4586){_0x3c4586(null,_0x3364d5);}})[_0x7df6('0x20')](function(_0x4ee13f){if(_0x3c4586){_0x3c4586(null,_0x4ee13f);}});}function setChannelVariables(_0x4e9a66){for(var _0x538e6c in _0x4e9a66){if(_0x4e9a66[_0x7df6('0x21')](_0x538e6c)){if(_0x538e6c[_0x7df6('0x22')](_0x7df6('0x23'))===0x0){_0x4e9a66[_0x538e6c[_0x7df6('0x24')](0x4)]=_0x4e9a66[_0x538e6c];delete _0x4e9a66[_0x538e6c];}}}}function agiHandler(_0x4954d3){logger[_0x7df6('0x25')](_0x7df6('0x26'),JSON[_0x7df6('0x27')](_0x4954d3,null,0x2));logger[_0x7df6('0xe')](util[_0x7df6('0xf')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4954d3[_0x7df6('0x1c')],_0x4954d3[_0x7df6('0x16')],_0x4954d3[_0x7df6('0x1a')],_0x4954d3[_0x7df6('0x17')],_0x4954d3[_0x7df6('0x18')]));_0x4954d3['on']('error',errorHandler);_0x4954d3['on'](_0x7df6('0x28'),closeHandler);_0x4954d3['on']('timeout',timeoutHandler);_0x4954d3[_0x7df6('0x1d')]=![];_0x4954d3['on'](_0x7df6('0x29'),hangupHandler);var _0x3402bc=_[_0x7df6('0x2a')](projects,[_0x7df6('0x13'),_0x4954d3[_0x7df6('0x1c')]]);if(!_0x3402bc)return Project[_0x7df6('0x2b')](_0x4954d3);if(!_0x3402bc['production'])return Project[_0x7df6('0x2c')](_0x4954d3);return Project[_0x7df6('0x2d')](_0x3402bc,_0x4954d3);}function main(){var _0x544bc2;return utilLicense[_0x7df6('0x2e')]()[_0x7df6('0x1f')](function(_0x2b407a){if(!_0x2b407a)return;if(_0x2b407a[_0x7df6('0x2f')]){if(_0x2b407a[_0x7df6('0x30')]&&_0x2b407a[_0x7df6('0x30')]>0x0){logger[_0x7df6('0xe')](util[_0x7df6('0xf')](_0x7df6('0x31'),_0x2b407a[_0x7df6('0x30')]));_0x544bc2=_0x2b407a[_0x7df6('0x30')];}else{logger['info'](_0x7df6('0x32'));}}else{logger['info'](_0x7df6('0x33'));_0x544bc2=-0x1;}})[_0x7df6('0x1f')](function(){return Project['getAll']();})['then'](function(_0x154ffc){projects=_0x154ffc;return;})[_0x7df6('0x20')](function(_0x16a78b){logger[_0x7df6('0x9')](_0x7df6('0x34'),_0x16a78b[_0x7df6('0x15')]);})[_0x7df6('0x35')](function(){var _0x578aef=require(_0x7df6('0x36'))(config[_0x7df6('0x4')][_0x7df6('0xd')],config[_0x7df6('0x4')]['ip'],_0x544bc2);_0x578aef['on'](_0x7df6('0x9'),errorHandler);_0x578aef['on']('listening',listeningHandler);_0x578aef['on'](_0x7df6('0x37'),connectionHandler);_0x578aef['on'](_0x7df6('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0x255b=['createSquareReport','catch','hasOwnProperty','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted','splice','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x58f745,_0x36bff6){var _0x19f228=function(_0x5bd4e4){while(--_0x5bd4e4){_0x58f745['push'](_0x58f745['shift']());}};_0x19f228(++_0x36bff6);}(_0x255b,0x1ac));var _0xb255=function(_0xf4c853,_0x27e648){_0xf4c853=_0xf4c853-0x0;var _0x37175b=_0x255b[_0xf4c853];return _0x37175b;};'use strict';var _=require(_0xb255('0x0'));var syncho=require(_0xb255('0x1'));var util=require(_0xb255('0x2'));var config=require(_0xb255('0x3'));var logger=require(_0xb255('0x4'))(_0xb255('0x5'));var utilLicense=require(_0xb255('0x6'));var rpc=require(_0xb255('0x7'));var Project=require('./project');var AGIEmitter=require(_0xb255('0x8'))[_0xb255('0x9')];var projects=[];config['agi']=_['defaults'](config['agi'],{'ip':_0xb255('0xa'),'port':0x11dd});AGIEmitter['on'](_0xb255('0xb'),projectUpdateHandler);function connectionHandler(_0x43e2ba){process[_0xb255('0xc')](function(){syncho(function(){try{setChannelVariables(_0x43e2ba);agiHandler(_0x43e2ba);}catch(_0x41f52f){logger[_0xb255('0xd')](_0x41f52f['stack']);}});});}function projectUpdateHandler(_0x7dd882){try{var _0x195d2c=_[_0xb255('0xe')](projects,['id',_0x7dd882['id']]);if(_0x195d2c>-0x1){if(_0x7dd882[_0xb255('0xf')]===!![]){projects[_0xb255('0x10')](_0x195d2c,0x1);}else{projects[_0x195d2c]=_0x7dd882;}}else{projects[_0xb255('0x11')](_0x7dd882);}}catch(_0x1a5b9e){logger['error'](_0x1a5b9e[_0xb255('0x12')]);}}function listeningHandler(){console[_0xb255('0x13')](_0xb255('0x14'),config[_0xb255('0x5')][_0xb255('0x15')]);logger[_0xb255('0x16')](util[_0xb255('0x17')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xb255('0x5')]['ip'],config['agi'][_0xb255('0x15')]));}function errorHandler(_0x383e53){if(_0x383e53&&_0x383e53[_0xb255('0x18')]&&_0x383e53[_0xb255('0x19')]){logger[_0xb255('0xd')](util[_0xb255('0x17')]('[%s]\x20%s',_0x383e53[_0xb255('0x18')],_0x383e53[_0xb255('0x19')]));}else{logger[_0xb255('0xd')](util[_0xb255('0x17')](_0xb255('0x1a'),_0x383e53['stack']));}}function closeHandler(){logger[_0xb255('0x16')](util[_0xb255('0x17')](_0xb255('0x1b'),this['arg_1'],this[_0xb255('0x1c')],this[_0xb255('0x1d')],this[_0xb255('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1c4ff8){logger['error'](_0x1c4ff8['stack']);}}function timeoutHandler(){logger['info'](util[_0xb255('0x17')](_0xb255('0x1f'),this[_0xb255('0x20')],this[_0xb255('0x1c')],this[_0xb255('0x1d')],this['dnid'],this[_0xb255('0x21')]));}function hangupHandler(){logger['info'](util[_0xb255('0x17')](_0xb255('0x22'),this[_0xb255('0x20')],this['calleridname'],this[_0xb255('0x1d')],this['dnid'],this['uniqueid']));this[_0xb255('0x23')]=!![];}function createSquareReport(_0x2703c8,_0x1c4bbb){rpc[_0xb255('0x24')](_0x2703c8)['then'](function(_0x25f0b8){if(_0x1c4bbb){_0x1c4bbb(null,_0x25f0b8);}})[_0xb255('0x25')](function(_0x4b2b8e){if(_0x1c4bbb){_0x1c4bbb(null,_0x4b2b8e);}});}function setChannelVariables(_0x55b6df){for(var _0x394b05 in _0x55b6df){if(_0x55b6df[_0xb255('0x26')](_0x394b05)){if(_0x394b05['indexOf'](_0xb255('0x27'))===0x0){_0x55b6df[_0x394b05['substring'](0x4)]=_0x55b6df[_0x394b05];delete _0x55b6df[_0x394b05];}}}}function agiHandler(_0x41dc80){logger[_0xb255('0x28')](_0xb255('0x29'),JSON[_0xb255('0x2a')](_0x41dc80,null,0x2));logger['info'](util[_0xb255('0x17')](_0xb255('0x2b'),_0x41dc80[_0xb255('0x20')],_0x41dc80[_0xb255('0x1c')],_0x41dc80[_0xb255('0x1d')],_0x41dc80['dnid'],_0x41dc80['uniqueid']));_0x41dc80['on'](_0xb255('0xd'),errorHandler);_0x41dc80['on']('close',closeHandler);_0x41dc80['on']('timeout',timeoutHandler);_0x41dc80['evtHangup']=![];_0x41dc80['on']('hangup',hangupHandler);var _0x4e79dc=_['find'](projects,[_0xb255('0x18'),_0x41dc80[_0xb255('0x20')]]);if(!_0x4e79dc)return Project[_0xb255('0x2c')](_0x41dc80);if(!_0x4e79dc['production'])return Project[_0xb255('0x2d')](_0x41dc80);return Project[_0xb255('0x2e')](_0x4e79dc,_0x41dc80);}function main(){var _0x49e4b2;return utilLicense[_0xb255('0x2f')]()[_0xb255('0x30')](function(_0x29ad44){if(!_0x29ad44)return;if(_0x29ad44[_0xb255('0x31')]){if(_0x29ad44['callysquare']&&_0x29ad44['callysquare']>0x0){logger[_0xb255('0x16')](util[_0xb255('0x17')](_0xb255('0x32'),_0x29ad44['callysquare']));_0x49e4b2=_0x29ad44[_0xb255('0x33')];}else{logger[_0xb255('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xb255('0x16')](_0xb255('0x34'));_0x49e4b2=-0x1;}})[_0xb255('0x30')](function(){return Project[_0xb255('0x35')]();})[_0xb255('0x30')](function(_0x268dd0){projects=_0x268dd0;return;})[_0xb255('0x25')](function(_0x58eb9e){logger[_0xb255('0xd')](_0xb255('0x36'),_0x58eb9e['stack']);})[_0xb255('0x37')](function(){var _0x3028ab=require(_0xb255('0x38'))(config['agi'][_0xb255('0x15')],config[_0xb255('0x5')]['ip'],_0x49e4b2);_0x3028ab['on'](_0xb255('0xd'),errorHandler);_0x3028ab['on']('listening',listeningHandler);_0x3028ab['on'](_0xb255('0x39'),connectionHandler);_0x3028ab['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 41dd7cf..a375f27 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 _0x8193=['request','then','error','message','result','catch','SendMail','bluebird','jayson/promise','http'];(function(_0x8bfc96,_0x239475){var _0x2001b3=function(_0x2aef9d){while(--_0x2aef9d){_0x8bfc96['push'](_0x8bfc96['shift']());}};_0x2001b3(++_0x239475);}(_0x8193,0x115));var _0x3819=function(_0x11611e,_0x595b41){_0x11611e=_0x11611e-0x0;var _0x1a3024=_0x8193[_0x11611e];return _0x1a3024;};'use strict';var BPromise=require(_0x3819('0x0'));var jayson=require(_0x3819('0x1'));var client=jayson['client'][_0x3819('0x2')]({'port':0x232b});function request(_0x107420,_0x241ef1){return new BPromise(function(_0x394381,_0x59a7c6){return client[_0x3819('0x3')](_0x107420,_0x241ef1)[_0x3819('0x4')](function(_0x1bb928){if(_0x1bb928[_0x3819('0x5')]){return _0x59a7c6(_0x1bb928[_0x3819('0x5')][_0x3819('0x6')]);}else{return _0x394381(_0x1bb928[_0x3819('0x7')]);}})[_0x3819('0x8')](function(_0x1c1310){return _0x59a7c6(_0x1c1310);});});}exports['sendMailMessage']=function(_0x2cf074,_0x3bc7ce){return request(_0x3819('0x9'),{'account':_0x2cf074,'message':_0x3bc7ce});}; \ No newline at end of file +var _0xcdba=['SendMail','client','http','then','error','sendMailMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcdba,0x10f));var _0xacdb=function(_0x563a0a,_0x53b99d){_0x563a0a=_0x563a0a-0x0;var _0x45aab2=_0xcdba[_0x563a0a];return _0x45aab2;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xacdb('0x0')][_0xacdb('0x1')]({'port':0x232b});function request(_0x23f977,_0x5ea3a3){return new BPromise(function(_0x1f433b,_0x52bf8d){return client['request'](_0x23f977,_0x5ea3a3)[_0xacdb('0x2')](function(_0x2b4c13){if(_0x2b4c13[_0xacdb('0x3')]){return _0x52bf8d(_0x2b4c13[_0xacdb('0x3')]['message']);}else{return _0x1f433b(_0x2b4c13['result']);}})['catch'](function(_0x4a88c5){return _0x52bf8d(_0x4a88c5);});});}exports[_0xacdb('0x4')]=function(_0x3cba85,_0x56f45c){return request(_0xacdb('0x5'),{'account':_0x3cba85,'message':_0x56f45c});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index fe59938..84e433b 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa241=['uniqueid','traverseBFS','clear','vertex','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','dnid','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','source','target','value','toJson','mxGraphModel','debug','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid'];(function(_0x455a49,_0x441ef7){var _0x2c1e7a=function(_0x3e4d77){while(--_0x3e4d77){_0x455a49['push'](_0x455a49['shift']());}};_0x2c1e7a(++_0x441ef7);}(_0xa241,0x1af));var _0x1a24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa241[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1a24('0x0'));var moment=require(_0x1a24('0x1'));var parser=require(_0x1a24('0x2'));var util=require(_0x1a24('0x3'));var logger=require(_0x1a24('0x4'))(_0x1a24('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x1a24('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x1a24('0x7')](function(_0x46f659){logger[_0x1a24('0x8')](_0x1a24('0x9'),_0x46f659[_0x1a24('0xa')]);return[];});}function addVertex(_0x45b0bd,_0x345ae5,_0x26469a){_0x345ae5[_0x1a24('0xb')]=_0x26469a;if(_0x345ae5[_0x1a24('0xc')](_0x1a24('0xd'))){_0x345ae5[_0x1a24('0xe')]=parseInt(_0x345ae5[_0x1a24('0xd')],0xa);}_0x45b0bd[_0x1a24('0xf')](_[_0x1a24('0x10')](_0x345ae5,_0x1a24('0x11')));}function initGraph(_0x538d21,_0x105ad9){var _0x1bbc7c=new Graph();for(var _0x2bf4d9 in _0x538d21){if(_0x538d21[_0x1a24('0xc')](_0x2bf4d9)){if(_['isArray'](_0x538d21[_0x2bf4d9])){for(var _0x5f430b=0x0;_0x5f430b<_0x538d21[_0x2bf4d9]['length'];_0x5f430b+=0x1){addVertex(_0x1bbc7c,_0x538d21[_0x2bf4d9][_0x5f430b],_0x2bf4d9);}}else{addVertex(_0x1bbc7c,_0x538d21[_0x2bf4d9],_0x2bf4d9);}}}for(var _0x52b179=0x0;_0x52b179<_0x105ad9['length'];_0x52b179+=0x1){if(_0x105ad9[_0x52b179][_0x1a24('0x12')]&&_0x105ad9[_0x52b179][_0x1a24('0x13')]){_0x1bbc7c['addEdge'](_0x105ad9[_0x52b179][_0x1a24('0x12')],_0x105ad9[_0x52b179]['target'],_0x105ad9[_0x52b179][_0x1a24('0x14')]);}}return _0x1bbc7c;}function getRoot(_0x33008f){return parser[_0x1a24('0x15')](_0x33008f,{'object':!![]})[_0x1a24('0x16')]['root'];}function inspect(_0x1d38bd){return util['inspect'](_0x1d38bd,{'showHidden':![],'depth':null});}function initialize(_0x3ef0c8,_0x285f94){var _0x4379cd=getRoot(_0x3ef0c8['production']);if(!_0x4379cd||!_0x4379cd['start'])return;var _0x195c2f,_0x38bc8d,_0x37f702;logger[_0x1a24('0x17')](_0x1a24('0x18'),JSON['stringify'](_0x4379cd,null,0x2));_0x285f94[_0x1a24('0x19')]=moment()[_0x1a24('0x1a')](_0x1a24('0x1b'));_0x195c2f=initGraph(_[_0x1a24('0x10')](_0x4379cd,'mxCell'),_0x4379cd[_0x1a24('0x11')]);_0x38bc8d=new Vertices(_0x285f94,rpc,mailRpc);logger[_0x1a24('0x1c')](util[_0x1a24('0x1a')](_0x1a24('0x1d'),_0x285f94[_0x1a24('0x1e')],_0x285f94[_0x1a24('0x1f')],_0x285f94[_0x1a24('0x20')],_0x285f94['dnid'],_0x285f94[_0x1a24('0x21')]));_0x195c2f[_0x1a24('0x22')](_0x4379cd['start']['id'],function(_0x37c057){try{_0x37c057=_0x38bc8d[_0x1a24('0x23')](_0x37c057);logger[_0x1a24('0x17')](_0x1a24('0x24'),JSON[_0x1a24('0x25')](_0x37c057,null,0x2));if(_0x37c057[_0x1a24('0xb')]==='gotoc'){logger[_0x1a24('0x1c')](_0x1a24('0x26'));_0x285f94['context']=_0x37c057[_0x1a24('0x27')]||_0x285f94[_0x1a24('0x27')];_0x285f94[_0x1a24('0x28')]=_0x37c057[_0x1a24('0x28')];_0x285f94[_0x1a24('0x29')]=_0x37c057[_0x1a24('0x29')]?_0x37c057[_0x1a24('0x29')]-0x1:0x1;return null;}else if(_0x37c057&&_0x38bc8d[_0x37c057['agicommand']]){_0x37f702=_0x38bc8d[_0x37c057[_0x1a24('0xb')]](_0x37c057);logger[_0x1a24('0x1c')](_0x1a24('0x2a'),JSON[_0x1a24('0x25')](_0x37f702,null,0x2));if(_0x37f702&&_0x37f702[_0x1a24('0x2b')]===AGI_CODE_SUCCESS&&_0x37f702[_0x1a24('0x2c')]!==AGI_RESULT_ERROR&&!_0x285f94[_0x1a24('0x2d')]){logger[_0x1a24('0x17')](_0x1a24('0x2a'),inspect(_0x37f702));return _[_0x1a24('0x2e')](_0x37f702['result'])?null:_0x37f702[_0x1a24('0x2c')][_0x1a24('0x2f')]();}else{logger[_0x1a24('0x8')](_0x1a24('0x2a'),inspect(_0x37f702));return null;}}else{logger[_0x1a24('0x8')](_0x1a24('0x30'));return null;}}catch(_0x3abb25){logger['error'](_0x3abb25[_0x1a24('0xa')]);return null;}});if(_0x4379cd['finally']){logger['info'](util[_0x1a24('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x285f94[_0x1a24('0x1e')],_0x285f94[_0x1a24('0x1f')],_0x285f94[_0x1a24('0x20')],_0x285f94[_0x1a24('0x31')],_0x285f94[_0x1a24('0x21')]));_0x195c2f[_0x1a24('0x22')](_0x4379cd[_0x1a24('0x32')]['id'],function(_0x3cb489){try{_0x3cb489=_0x38bc8d[_0x1a24('0x23')](_0x3cb489);logger[_0x1a24('0x17')]('vertex',JSON['stringify'](_0x3cb489,null,0x2));if(_0x3cb489&&_0x38bc8d[_0x3cb489['agicommand']]){_0x37f702=_0x38bc8d[_0x3cb489['agicommand']](_0x3cb489);if(_0x37f702){logger['debug']('response',inspect(_0x37f702));return _['isUndefined'](_0x37f702['result'])?null:_0x37f702[_0x1a24('0x2c')]['toString']();}else{logger[_0x1a24('0x8')](_0x1a24('0x2a'),inspect(_0x37f702));return null;}}else{logger[_0x1a24('0x8')](_0x1a24('0x30'));return null;}}catch(_0x3b19e6){logger[_0x1a24('0x8')](_0x3b19e6[_0x1a24('0xa')]);return null;}});}logger['info'](util[_0x1a24('0x1a')](_0x1a24('0x33'),_0x285f94[_0x1a24('0x1e')],_0x285f94[_0x1a24('0x1f')],_0x285f94[_0x1a24('0x20')],_0x285f94['dnid'],_0x285f94['uniqueid']));logger[_0x1a24('0x1c')](util[_0x1a24('0x1a')](_0x1a24('0x34'),_0x285f94[_0x1a24('0x27')],_0x285f94['extension'],parseInt(_0x285f94[_0x1a24('0x29')],0xa)+0x1));_0x285f94['continueAt'](_0x285f94['context'],_0x285f94['extension'],parseInt(_0x285f94[_0x1a24('0x29')],0xa)+0x1);_0x285f94[_0x1a24('0x35')]();}function handleNotFound(_0x267a00){logger[_0x1a24('0x8')](util[_0x1a24('0x1a')](_0x1a24('0x36'),_0x267a00[_0x1a24('0x1e')]));_0x267a00[_0x1a24('0x37')](_0x267a00[_0x1a24('0x27')],_0x267a00[_0x1a24('0x28')],parseInt(_0x267a00[_0x1a24('0x29')],0xa)+0x1);_0x267a00['close']();}function handleUnpublished(_0x5bbdfd){logger[_0x1a24('0x8')](util[_0x1a24('0x1a')](_0x1a24('0x38'),_0x5bbdfd[_0x1a24('0x1e')]));_0x5bbdfd['continueAt'](_0x5bbdfd[_0x1a24('0x27')],_0x5bbdfd['extension'],parseInt(_0x5bbdfd[_0x1a24('0x29')],0xa)+0x1);_0x5bbdfd['close']();}module[_0x1a24('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x78de=['agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[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','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','./rpc','./mailRpc','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','target','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','evtHangup','isUndefined','result','toString'];(function(_0x92706d,_0x5e096c){var _0x15a7eb=function(_0x621d78){while(--_0x621d78){_0x92706d['push'](_0x92706d['shift']());}};_0x15a7eb(++_0x5e096c);}(_0x78de,0x8b));var _0xe78d=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x78de[_0x576266];return _0x18234f;};'use strict';var _=require(_0xe78d('0x0'));var moment=require('moment');var parser=require(_0xe78d('0x1'));var util=require(_0xe78d('0x2'));var logger=require(_0xe78d('0x3'))('agi');var rpc=require(_0xe78d('0x4'));var mailRpc=require(_0xe78d('0x5'));var Graph=require('./graph');var Vertices=require(_0xe78d('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe78d('0x7')]()['catch'](function(_0x1e4c55){logger[_0xe78d('0x8')](_0xe78d('0x9'),_0x1e4c55[_0xe78d('0xa')]);return[];});}function addVertex(_0x31208b,_0x2e7ff5,_0x3ddddd){_0x2e7ff5['agicommand']=_0x3ddddd;if(_0x2e7ff5[_0xe78d('0xb')]('retry')){_0x2e7ff5[_0xe78d('0xc')]=parseInt(_0x2e7ff5[_0xe78d('0xd')],0xa);}_0x31208b[_0xe78d('0xe')](_[_0xe78d('0xf')](_0x2e7ff5,_0xe78d('0x10')));}function initGraph(_0x129fca,_0x459579){var _0x1314bd=new Graph();for(var _0x1c6dda in _0x129fca){if(_0x129fca['hasOwnProperty'](_0x1c6dda)){if(_[_0xe78d('0x11')](_0x129fca[_0x1c6dda])){for(var _0x135711=0x0;_0x135711<_0x129fca[_0x1c6dda][_0xe78d('0x12')];_0x135711+=0x1){addVertex(_0x1314bd,_0x129fca[_0x1c6dda][_0x135711],_0x1c6dda);}}else{addVertex(_0x1314bd,_0x129fca[_0x1c6dda],_0x1c6dda);}}}for(var _0x2b3c17=0x0;_0x2b3c17<_0x459579['length'];_0x2b3c17+=0x1){if(_0x459579[_0x2b3c17]['source']&&_0x459579[_0x2b3c17][_0xe78d('0x13')]){_0x1314bd['addEdge'](_0x459579[_0x2b3c17]['source'],_0x459579[_0x2b3c17][_0xe78d('0x13')],_0x459579[_0x2b3c17][_0xe78d('0x14')]);}}return _0x1314bd;}function getRoot(_0x13c122){return parser[_0xe78d('0x15')](_0x13c122,{'object':!![]})[_0xe78d('0x16')][_0xe78d('0x17')];}function inspect(_0x205cd3){return util[_0xe78d('0x18')](_0x205cd3,{'showHidden':![],'depth':null});}function initialize(_0x59d9c8,_0x2905a6){var _0x357ca6=getRoot(_0x59d9c8['production']);if(!_0x357ca6||!_0x357ca6[_0xe78d('0x19')])return;var _0x4f0aef,_0x795f6c,_0x788b4c;logger[_0xe78d('0x1a')](_0xe78d('0x17'),JSON[_0xe78d('0x1b')](_0x357ca6,null,0x2));_0x2905a6[_0xe78d('0x1c')]=moment()[_0xe78d('0x1d')](_0xe78d('0x1e'));_0x4f0aef=initGraph(_[_0xe78d('0xf')](_0x357ca6,_0xe78d('0x10')),_0x357ca6[_0xe78d('0x10')]);_0x795f6c=new Vertices(_0x2905a6,rpc,mailRpc);logger[_0xe78d('0x1f')](util[_0xe78d('0x1d')](_0xe78d('0x20'),_0x2905a6['arg_1'],_0x2905a6['calleridname'],_0x2905a6[_0xe78d('0x21')],_0x2905a6[_0xe78d('0x22')],_0x2905a6['uniqueid']));_0x4f0aef[_0xe78d('0x23')](_0x357ca6[_0xe78d('0x19')]['id'],function(_0x4b1123){try{_0x4b1123=_0x795f6c[_0xe78d('0x24')](_0x4b1123);logger[_0xe78d('0x1a')](_0xe78d('0x25'),JSON[_0xe78d('0x1b')](_0x4b1123,null,0x2));if(_0x4b1123['agicommand']===_0xe78d('0x26')){logger[_0xe78d('0x1f')](_0xe78d('0x27'));_0x2905a6[_0xe78d('0x28')]=_0x4b1123[_0xe78d('0x28')]||_0x2905a6[_0xe78d('0x28')];_0x2905a6[_0xe78d('0x29')]=_0x4b1123[_0xe78d('0x29')];_0x2905a6['priority']=_0x4b1123[_0xe78d('0x2a')]?_0x4b1123['priority']-0x1:0x1;return null;}else if(_0x4b1123&&_0x795f6c[_0x4b1123[_0xe78d('0x2b')]]){_0x788b4c=_0x795f6c[_0x4b1123[_0xe78d('0x2b')]](_0x4b1123);logger[_0xe78d('0x1f')](_0xe78d('0x2c'),JSON[_0xe78d('0x1b')](_0x788b4c,null,0x2));if(_0x788b4c&&_0x788b4c[_0xe78d('0x2d')]===AGI_CODE_SUCCESS&&_0x788b4c['result']!==AGI_RESULT_ERROR&&!_0x2905a6[_0xe78d('0x2e')]){logger[_0xe78d('0x1a')](_0xe78d('0x2c'),inspect(_0x788b4c));return _[_0xe78d('0x2f')](_0x788b4c[_0xe78d('0x30')])?null:_0x788b4c[_0xe78d('0x30')][_0xe78d('0x31')]();}else{logger[_0xe78d('0x8')]('response',inspect(_0x788b4c));return null;}}else{logger['error'](_0xe78d('0x32'));return null;}}catch(_0x501d58){logger['error'](_0x501d58[_0xe78d('0xa')]);return null;}});if(_0x357ca6[_0xe78d('0x33')]){logger[_0xe78d('0x1f')](util[_0xe78d('0x1d')](_0xe78d('0x34'),_0x2905a6[_0xe78d('0x35')],_0x2905a6[_0xe78d('0x36')],_0x2905a6[_0xe78d('0x21')],_0x2905a6['dnid'],_0x2905a6[_0xe78d('0x37')]));_0x4f0aef[_0xe78d('0x23')](_0x357ca6[_0xe78d('0x33')]['id'],function(_0x39c176){try{_0x39c176=_0x795f6c[_0xe78d('0x24')](_0x39c176);logger[_0xe78d('0x1a')](_0xe78d('0x25'),JSON[_0xe78d('0x1b')](_0x39c176,null,0x2));if(_0x39c176&&_0x795f6c[_0x39c176['agicommand']]){_0x788b4c=_0x795f6c[_0x39c176[_0xe78d('0x2b')]](_0x39c176);if(_0x788b4c){logger[_0xe78d('0x1a')]('response',inspect(_0x788b4c));return _[_0xe78d('0x2f')](_0x788b4c['result'])?null:_0x788b4c[_0xe78d('0x30')][_0xe78d('0x31')]();}else{logger['error'](_0xe78d('0x2c'),inspect(_0x788b4c));return null;}}else{logger[_0xe78d('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x552430){logger[_0xe78d('0x8')](_0x552430[_0xe78d('0xa')]);return null;}});}logger[_0xe78d('0x1f')](util[_0xe78d('0x1d')](_0xe78d('0x38'),_0x2905a6[_0xe78d('0x35')],_0x2905a6[_0xe78d('0x36')],_0x2905a6['callerid'],_0x2905a6['dnid'],_0x2905a6[_0xe78d('0x37')]));logger['info'](util[_0xe78d('0x1d')](_0xe78d('0x39'),_0x2905a6[_0xe78d('0x28')],_0x2905a6['extension'],parseInt(_0x2905a6[_0xe78d('0x2a')],0xa)+0x1));_0x2905a6['continueAt'](_0x2905a6[_0xe78d('0x28')],_0x2905a6[_0xe78d('0x29')],parseInt(_0x2905a6[_0xe78d('0x2a')],0xa)+0x1);_0x2905a6['close']();}function handleNotFound(_0x306f51){logger['error'](util['format'](_0xe78d('0x3a'),_0x306f51['arg_1']));_0x306f51[_0xe78d('0x3b')](_0x306f51[_0xe78d('0x28')],_0x306f51[_0xe78d('0x29')],parseInt(_0x306f51['priority'],0xa)+0x1);_0x306f51[_0xe78d('0x3c')]();}function handleUnpublished(_0x36c4ff){logger[_0xe78d('0x8')](util['format'](_0xe78d('0x3d'),_0x36c4ff[_0xe78d('0x35')]));_0x36c4ff['continueAt'](_0x36c4ff[_0xe78d('0x28')],_0x36c4ff[_0xe78d('0x29')],parseInt(_0x36c4ff[_0xe78d('0x2a')],0xa)+0x1);_0x36c4ff[_0xe78d('0x3c')]();}module[_0xe78d('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2d3d146..65a092d 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 _0x17bd=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice','trim','length','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x17bd,0xfb));var _0xd17b=function(_0xfdb9e0,_0x3ce65a){_0xfdb9e0=_0xfdb9e0-0x0;var _0x38a65e=_0x17bd[_0xfdb9e0];return _0x38a65e;};'use strict';var util=require(_0xd17b('0x0'));var Transform=require(_0xd17b('0x1'))[_0xd17b('0x2')];function AGIReply(_0x5ef066){Transform[_0xd17b('0x3')](this,_0x5ef066);this[_0xd17b('0x4')]='';this[_0xd17b('0x5')]=![];}util[_0xd17b('0x6')](AGIReply,Transform);AGIReply[_0xd17b('0x7')][_0xd17b('0x8')]=function(_0x10895b,_0x4d11f6,_0x125454){var _0x219a19='\x0a',_0x347c89=['\x0a\x0a',_0xd17b('0x9')],_0x1c7ef1=-0x1,_0x24594c=-0x1,_0x4a28ce='',_0x17e791=0x0,_0x511852='',_0x31e4e5='';this[_0xd17b('0x4')]+=_0x10895b[_0xd17b('0xa')]();_0x511852=this['_localBuffer'];if(!this[_0xd17b('0x5')]){_0x17e791=0x0;while(_0x347c89[_0x17e791]){while((_0x24594c=_0x511852[_0xd17b('0xb')](_0x347c89[_0x17e791]))!=-0x1){_0x4a28ce=_0x347c89[_0x17e791];_0x31e4e5=_0x511852[_0xd17b('0xc')](0x0,_0x24594c);_0x511852=_0x511852[_0xd17b('0xc')](_0x24594c+_0x4a28ce['length']);var _0x17fd00=_0x31e4e5[_0xd17b('0xd')](_0x219a19),_0x4d4dfa=0x0,_0x467904={},_0x2362ac='',_0x2258e3='',_0x482264=-0x1;while(_0x17fd00[_0x4d4dfa]){_0x482264=_0x17fd00[_0x4d4dfa][_0xd17b('0xb')](':');if(_0x482264!=-0x1){_0x2362ac=_0x17fd00[_0x4d4dfa][_0xd17b('0xe')](0x0,_0x482264)[_0xd17b('0xf')]();_0x2258e3=_0x17fd00[_0x4d4dfa][_0xd17b('0xe')](_0x482264+0x1)['trim']();if(_0x2362ac[_0xd17b('0x10')]>0x0){_0x467904[_0x2362ac]=_0x2258e3;}}else{}_0x4d4dfa++;}this[_0xd17b('0x11')](_0xd17b('0x12'),_0x467904);this[_0xd17b('0x5')]=!![];}_0x17e791++;}this['_localBuffer']=_0x511852;}else{while((_0x1c7ef1=_0x511852['indexOf'](_0x219a19))!=-0x1){_0x31e4e5=_0x511852['substring'](0x0,_0x1c7ef1);this[_0xd17b('0x11')]('line',_0x31e4e5);_0x511852=_0x511852[_0xd17b('0xc')](_0x1c7ef1+_0x219a19[_0xd17b('0x10')]);}this['_localBuffer']=_0x511852;}_0x125454();};module[_0xd17b('0x13')]=AGIReply; \ No newline at end of file +var _0x8f37=['exports','util','stream','Transform','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','length','emit','headers','line'];(function(_0x63271e,_0x3fa061){var _0x54d673=function(_0x5f006f){while(--_0x5f006f){_0x63271e['push'](_0x63271e['shift']());}};_0x54d673(++_0x3fa061);}(_0x8f37,0x190));var _0x78f3=function(_0xe862e7,_0x4af90f){_0xe862e7=_0xe862e7-0x0;var _0x4a1693=_0x8f37[_0xe862e7];return _0x4a1693;};'use strict';var util=require(_0x78f3('0x0'));var Transform=require(_0x78f3('0x1'))[_0x78f3('0x2')];function AGIReply(_0x5c221b){Transform['call'](this,_0x5c221b);this[_0x78f3('0x3')]='';this[_0x78f3('0x4')]=![];}util[_0x78f3('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x78f3('0x6')]=function(_0x4e9e4e,_0x3eaa33,_0x597b85){var _0x11c6ad='\x0a',_0x3dc185=['\x0a\x0a',_0x78f3('0x7')],_0x492dc7=-0x1,_0x58bd73=-0x1,_0x55e353='',_0x35d861=0x0,_0x423223='',_0x552bef='';this[_0x78f3('0x3')]+=_0x4e9e4e[_0x78f3('0x8')]();_0x423223=this[_0x78f3('0x3')];if(!this[_0x78f3('0x4')]){_0x35d861=0x0;while(_0x3dc185[_0x35d861]){while((_0x58bd73=_0x423223['indexOf'](_0x3dc185[_0x35d861]))!=-0x1){_0x55e353=_0x3dc185[_0x35d861];_0x552bef=_0x423223[_0x78f3('0x9')](0x0,_0x58bd73);_0x423223=_0x423223[_0x78f3('0x9')](_0x58bd73+_0x55e353['length']);var _0x3d7cf3=_0x552bef[_0x78f3('0xa')](_0x11c6ad),_0x26466c=0x0,_0x2cc16b={},_0x532f29='',_0x134063='',_0x217945=-0x1;while(_0x3d7cf3[_0x26466c]){_0x217945=_0x3d7cf3[_0x26466c][_0x78f3('0xb')](':');if(_0x217945!=-0x1){_0x532f29=_0x3d7cf3[_0x26466c][_0x78f3('0xc')](0x0,_0x217945)[_0x78f3('0xd')]();_0x134063=_0x3d7cf3[_0x26466c][_0x78f3('0xc')](_0x217945+0x1)[_0x78f3('0xd')]();if(_0x532f29[_0x78f3('0xe')]>0x0){_0x2cc16b[_0x532f29]=_0x134063;}}else{}_0x26466c++;}this[_0x78f3('0xf')](_0x78f3('0x10'),_0x2cc16b);this[_0x78f3('0x4')]=!![];}_0x35d861++;}this[_0x78f3('0x3')]=_0x423223;}else{while((_0x492dc7=_0x423223[_0x78f3('0xb')](_0x11c6ad))!=-0x1){_0x552bef=_0x423223[_0x78f3('0x9')](0x0,_0x492dc7);this[_0x78f3('0xf')](_0x78f3('0x11'),_0x552bef);_0x423223=_0x423223[_0x78f3('0x9')](_0x492dc7+_0x11c6ad[_0x78f3('0xe')]);}this[_0x78f3('0x3')]=_0x423223;}_0x597b85();};module[_0x78f3('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 fe45277..ee6b808 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 _0x3667=['Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','phone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createCmContact','CreateCmContact','getPauseById','agentLogin','PauseUser','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut'];(function(_0x1238e0,_0x16bd9b){var _0x59dfc8=function(_0x3cd547){while(--_0x3cd547){_0x1238e0['push'](_0x1238e0['shift']());}};_0x59dfc8(++_0x16bd9b);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var moment=require(_0x7366('0x1'));var jayson=require(_0x7366('0x2'));var client=jayson[_0x7366('0x3')][_0x7366('0x4')]({'port':0x2329});function request(_0x5d1072,_0x27a90d){return new Promise(function(_0x1cfcc9,_0x4b32a7){return client[_0x7366('0x5')](_0x5d1072,_0x27a90d)[_0x7366('0x6')](function(_0x1a35f8){if(_0x1a35f8[_0x7366('0x7')]){return _0x4b32a7(_0x1a35f8[_0x7366('0x7')]['message']);}else{return _0x1cfcc9(_0x1a35f8[_0x7366('0x8')]);}})[_0x7366('0x9')](function(_0x2dd32b){return _0x4b32a7(_0x2dd32b);});});}exports[_0x7366('0xa')]=function(){return request(_0x7366('0xb'),{'options':{'raw':![],'attributes':['id',_0x7366('0xc'),_0x7366('0xd')]}});};exports[_0x7366('0xe')]=function(_0x18aee5){return request(_0x7366('0xf'),{'options':{'raw':![],'where':{'name':_0x18aee5},'attributes':[_0x7366('0xd')]}});};exports[_0x7366('0x10')]=function(_0x57ea7f){return request(_0x7366('0x11'),{'options':{'raw':![],'where':{'id':_0x57ea7f},'include':[{'model':_0x7366('0x12'),'as':_0x7366('0x13'),'include':[{'model':_0x7366('0x14'),'as':_0x7366('0x14')}]}],'attributes':['id',_0x7366('0xc'),_0x7366('0x15')],'smtp':!![]}});};exports[_0x7366('0x16')]=function(_0x37e47e){return request(_0x7366('0xf'),{'options':{'where':{'id':_0x37e47e},'attributes':[_0x7366('0xc')]}});};exports[_0x7366('0x17')]=function(_0x27500c){return request(_0x7366('0x18'),{'options':{'where':{'id':_0x27500c},'attributes':[_0x7366('0xc')]}});};exports['getVariableById']=function(_0x23e763){return request(_0x7366('0x19'),{'options':{'where':{'id':_0x23e763},'attributes':[_0x7366('0xc')]}});};exports[_0x7366('0x1a')]=function(_0xe2c87b){return request(_0x7366('0x1b'),{'options':{'where':{'id':_0xe2c87b},'attributes':[_0x7366('0x1c')]}});};exports[_0x7366('0x1d')]=function(_0x83e5d5){return request(_0x7366('0x1e'),{'options':{'where':{'id':_0x83e5d5},'attributes':[_0x7366('0xc')]}});};exports['getContactByPhone']=function(_0x208ac8){return request('GetContactByPhone',{'options':{'where':{'phone':_0x208ac8[_0x7366('0x1f')]},'attributes':['id']}});};exports[_0x7366('0x20')]=function(_0x3f23cd){return request('ShowTrunk',{'options':{'where':{'id':_0x3f23cd},'attributes':[_0x7366('0xc')]}});};exports[_0x7366('0x21')]=function(_0x3cfde9){return request('ShowSound',{'options':{'where':{'id':_0x3cfde9},'attributes':[_0x7366('0x22')]}});};exports[_0x7366('0x23')]=function(_0x482946){return request(_0x7366('0x24'),{'options':{'raw':![],'where':{'id':_0x482946},'include':[{'model':_0x7366('0x25'),'as':_0x7366('0x26')}]}});};exports[_0x7366('0x27')]=function(_0x3c30a2){return request(_0x7366('0x28'),{'options':{'where':{'id':_0x3c30a2},'attributes':['id',_0x7366('0xc')]}});};exports[_0x7366('0x29')]=function(_0x2095a1){return request(_0x7366('0x2a'),{'body':_0x2095a1});};exports[_0x7366('0x2b')]=function(_0x1dc875){return request(_0x7366('0x2c'),{'body':_0x1dc875});};exports['createSquareReport']=function(_0xb63a21){return request('CreateSquareReport',{'body':_[_0x7366('0x2d')](_0xb63a21,{'project_name':_0xb63a21['arg_1'],'prev_project_name':_0xb63a21['arg_2']||'','is_subproject':_0xb63a21[_0x7366('0x2e')]?!![]:![],'leaveAt':moment()['format'](_0x7366('0x2f'))})});};exports['createSquareRecording']=function(_0x256633){return request(_0x7366('0x30'),{'body':_0x256633});};exports['createSquareMessage']=function(_0x6d196a){return request('CreateSquareMessage',{'body':_0x6d196a});};exports[_0x7366('0x31')]=function(_0x2b61af){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2b61af[_0x7366('0x1f')],'ListId':_0x2b61af['ListId']}}})[_0x7366('0x6')](function(_0x46f80f){if(_0x46f80f){return _0x46f80f;}return request(_0x7366('0x32'),{'body':_0x2b61af});});};exports[_0x7366('0x33')]=function(_0x2dda4b){return request('ShowPause',{'options':{'where':{'id':_0x2dda4b},'attributes':[_0x7366('0xc')]}});};exports[_0x7366('0x34')]=function(_0x538d42,_0x4a0863){return request('LoginUser',{'body':{'interface':_0x4a0863},'options':{'where':_0x538d42}});};exports['agentPause']=function(_0x2a1d46,_0x43d487,_0x163a29){return request(_0x7366('0x35'),{'body':{'type':_0x43d487,'uniqueid':_0x163a29},'options':{'where':_0x2a1d46}});};exports['agentUnpause']=function(_0x3ca5e6){return request(_0x7366('0x36'),{'body':{},'options':{'where':_0x3ca5e6}});};exports[_0x7366('0x37')]=function(_0x21547f){return request('LogoutUser',{'body':{},'options':{'where':_0x21547f}});}; \ No newline at end of file +var _0xd51f=['request','then','error','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','save_name','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http'];(function(_0x40e4d1,_0x265805){var _0x31811a=function(_0x123311){while(--_0x123311){_0x40e4d1['push'](_0x40e4d1['shift']());}};_0x31811a(++_0x265805);}(_0xd51f,0xf0));var _0xfd51=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd51f[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xfd51('0x0'));var moment=require(_0xfd51('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xfd51('0x2')][_0xfd51('0x3')]({'port':0x2329});function request(_0x583496,_0x1fa890){return new Promise(function(_0x1d01a0,_0x49bb3e){return client[_0xfd51('0x4')](_0x583496,_0x1fa890)[_0xfd51('0x5')](function(_0x5c3129){if(_0x5c3129[_0xfd51('0x6')]){return _0x49bb3e(_0x5c3129[_0xfd51('0x6')]['message']);}else{return _0x1d01a0(_0x5c3129[_0xfd51('0x7')]);}})[_0xfd51('0x8')](function(_0x2c3fb2){return _0x49bb3e(_0x2c3fb2);});});}exports[_0xfd51('0x9')]=function(){return request(_0xfd51('0xa'),{'options':{'raw':![],'attributes':['id','name',_0xfd51('0xb')]}});};exports[_0xfd51('0xc')]=function(_0x2878c6){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2878c6},'attributes':[_0xfd51('0xb')]}});};exports['getMailAccountById']=function(_0x57838c){return request(_0xfd51('0xd'),{'options':{'raw':![],'where':{'id':_0x57838c},'include':[{'model':_0xfd51('0xe'),'as':_0xfd51('0xf'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id','name',_0xfd51('0x10')],'smtp':!![]}});};exports[_0xfd51('0x11')]=function(_0x3519f1){return request(_0xfd51('0x12'),{'options':{'where':{'id':_0x3519f1},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x14')]=function(_0x2c56f5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2c56f5},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x15')]=function(_0x28ee51){return request(_0xfd51('0x16'),{'options':{'where':{'id':_0x28ee51},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x17')]=function(_0x44f473){return request(_0xfd51('0x18'),{'options':{'where':{'id':_0x44f473},'attributes':['dsn']}});};exports[_0xfd51('0x19')]=function(_0x55e9bf){return request(_0xfd51('0x1a'),{'options':{'where':{'id':_0x55e9bf},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x1b')]=function(_0x32ad55){return request(_0xfd51('0x1c'),{'options':{'where':{'phone':_0x32ad55[_0xfd51('0x1d')]},'attributes':['id']}});};exports[_0xfd51('0x1e')]=function(_0x440352){return request('ShowTrunk',{'options':{'where':{'id':_0x440352},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x1f')]=function(_0x2aab50){return request('ShowSound',{'options':{'where':{'id':_0x2aab50},'attributes':[_0xfd51('0x20')]}});};exports['getIntervalById']=function(_0x6f6672){return request(_0xfd51('0x21'),{'options':{'raw':![],'where':{'id':_0x6f6672},'include':[{'model':_0xfd51('0x22'),'as':_0xfd51('0x23')}]}});};exports['getSmsAccountById']=function(_0x34eca6){return request(_0xfd51('0x24'),{'options':{'where':{'id':_0x34eca6},'attributes':['id',_0xfd51('0x13')]}});};exports[_0xfd51('0x25')]=function(_0x3efad3){return request(_0xfd51('0x26'),{'body':_0x3efad3});};exports[_0xfd51('0x27')]=function(_0x2c68c8){return request('CreateSquareDetailsReport',{'body':_0x2c68c8});};exports[_0xfd51('0x28')]=function(_0x1f3146){return request(_0xfd51('0x29'),{'body':_[_0xfd51('0x2a')](_0x1f3146,{'project_name':_0x1f3146['arg_1'],'prev_project_name':_0x1f3146[_0xfd51('0x2b')]||'','is_subproject':_0x1f3146[_0xfd51('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0xfd51('0x2c'))})});};exports[_0xfd51('0x2d')]=function(_0x5d8467){return request(_0xfd51('0x2e'),{'body':_0x5d8467});};exports[_0xfd51('0x2f')]=function(_0x3eb82c){return request(_0xfd51('0x30'),{'body':_0x3eb82c});};exports[_0xfd51('0x31')]=function(_0x1a355b){return request(_0xfd51('0x32'),{'options':{'raw':![],'where':{'phone':_0x1a355b['phone'],'ListId':_0x1a355b[_0xfd51('0x33')]}}})[_0xfd51('0x5')](function(_0x56392b){if(_0x56392b){return _0x56392b;}return request('CreateCmContact',{'body':_0x1a355b});});};exports[_0xfd51('0x34')]=function(_0x58a6d4){return request(_0xfd51('0x35'),{'options':{'where':{'id':_0x58a6d4},'attributes':[_0xfd51('0x13')]}});};exports[_0xfd51('0x36')]=function(_0x37bfb9,_0x36b6fe){return request('LoginUser',{'body':{'interface':_0x36b6fe},'options':{'where':_0x37bfb9}});};exports[_0xfd51('0x37')]=function(_0x24115f,_0x1a4e3d,_0x4341bc){return request(_0xfd51('0x38'),{'body':{'type':_0x1a4e3d,'uniqueid':_0x4341bc},'options':{'where':_0x24115f}});};exports[_0xfd51('0x39')]=function(_0x3c3b32){return request(_0xfd51('0x3a'),{'body':{},'options':{'where':_0x3c3b32}});};exports[_0xfd51('0x3b')]=function(_0x1f81a0){return request(_0xfd51('0x3c'),{'body':{},'options':{'where':_0x1f81a0}});}; \ 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 c560f9b..87be207 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 _0x9bb8=['exports','./polly','./lex'];(function(_0xb19de0,_0x28572e){var _0x4d39ec=function(_0x15114d){while(--_0x15114d){_0xb19de0['push'](_0xb19de0['shift']());}};_0x4d39ec(++_0x28572e);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};var polly=require(_0x89bb('0x0'));var lex=require(_0x89bb('0x1'));module[_0x89bb('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x89b8=['exports','./polly','./lex'];(function(_0x48845d,_0x4338c2){var _0x5bad7d=function(_0x1bf3f4){while(--_0x1bf3f4){_0x48845d['push'](_0x48845d['shift']());}};_0x5bad7d(++_0x4338c2);}(_0x89b8,0x19f));var _0x889b=function(_0x450735,_0x5c15c5){_0x450735=_0x450735-0x0;var _0x460ddc=_0x89b8[_0x450735];return _0x460ddc;};var polly=require(_0x889b('0x0'));var lex=require(_0x889b('0x1'));module[_0x889b('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 3edee99..22515b4 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 _0x6e6c=['exports','./lib/api'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ 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 7555bc9..3461f90 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x282132,_0x54cbdb){var _0x3d464e=function(_0x24ac42){while(--_0x24ac42){_0x282132['push'](_0x282132['shift']());}};_0x3d464e(++_0x54cbdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x49d9d8,_0x52a3ee){var _0x384510=function(_0x1c1b4c){while(--_0x1c1b4c){_0x49d9d8['push'](_0x49d9d8['shift']());}};_0x384510(++_0x52a3ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index c5a1dbf..4d26338 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 _0xd52b=['exports'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xd52b,0xa7));var _0xbd52=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd52b[_0x501510];return _0x1e6ee5;};'use strict';var polly=require('./lib/api');module[_0xbd52('0x0')]=function(_0x2e1fcb,_0x38cda5,_0x47eda8,_0x50e45a,_0x40141d,_0x5d88cd,_0x1a065e){return polly(_0x2e1fcb,_0x38cda5,_0x47eda8,_0x50e45a,_0x40141d,_0x5d88cd,_0x1a065e);}; \ No newline at end of file +var _0xb828=['./lib/api'];(function(_0x48406e,_0x455a6e){var _0xf82b3b=function(_0x3db76f){while(--_0x3db76f){_0x48406e['push'](_0x48406e['shift']());}};_0xf82b3b(++_0x455a6e);}(_0xb828,0xd8));var _0x8b82=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xb828[_0x5c1cdc];return _0x2e8317;};'use strict';var polly=require(_0x8b82('0x0'));module['exports']=function(_0xae8faf,_0x30ca62,_0x3d4cd8,_0x215ef9,_0x5d2fbd,_0x286526,_0x5aeaed){return polly(_0xae8faf,_0x30ca62,_0x3d4cd8,_0x215ef9,_0x5d2fbd,_0x286526,_0x5aeaed);}; \ 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 a89b425..0d99077 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 _0x4823=['exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4823,0xa8));var _0x3482=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x4823[_0x2a5099];return _0x2802f1;};'use strict';var fs=require('fs');var path=require(_0x3482('0x0'));var BPromise=require(_0x3482('0x1'));var rs=require(_0x3482('0x2'));var AWS=require(_0x3482('0x3'));function pollyResult(_0x56232b,_0x44626b,_0x58fbc3){return new BPromise(function(_0x4862a0,_0x117eeb){_0x56232b[_0x3482('0x4')](_0x44626b,function(_0xeb09dc,_0xbae4ae){if(_0xeb09dc){_0x117eeb(_0xeb09dc);}else if(_0xbae4ae){if(_0xbae4ae[_0x3482('0x5')]instanceof Buffer){fs[_0x3482('0x6')](_0x58fbc3,_0xbae4ae['AudioStream'],function(_0x2365dd){if(_0x2365dd){_0x117eeb(_0x2365dd);}else{_0x4862a0();}});}else{_0x117eeb(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x117eeb(new Error(_0x3482('0x7')));}});});}module[_0x3482('0x8')]=function(_0x13409b,_0x36ee5f,_0x33aedc,_0x28896e,_0x114dcb,_0x5f2440,_0x9d8fac){var _0x137c01=new AWS[(_0x3482('0x9'))]({'accessKeyId':_0x13409b,'secretAccessKey':_0x36ee5f,'region':_0x33aedc});var _0xadf727={'Text':_0x114dcb,'TextType':_0x5f2440||'text','OutputFormat':_0x3482('0xa'),'VoiceId':_0x28896e};return pollyResult(_0x137c01,_0xadf727,_0x9d8fac);}; \ No newline at end of file +var _0x4010=['Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x47d24e,_0x172110){var _0x361aed=function(_0x5b6ffa){while(--_0x5b6ffa){_0x47d24e['push'](_0x47d24e['shift']());}};_0x361aed(++_0x172110);}(_0x4010,0x19d));var _0x0401=function(_0x1bf972,_0x10c5ea){_0x1bf972=_0x1bf972-0x0;var _0x2db558=_0x4010[_0x1bf972];return _0x2db558;};'use strict';var fs=require('fs');var path=require(_0x0401('0x0'));var BPromise=require('bluebird');var rs=require(_0x0401('0x1'));var AWS=require(_0x0401('0x2'));function pollyResult(_0x363edd,_0x149ee4,_0x5f5d20){return new BPromise(function(_0x1e7a5c,_0x1b40f4){_0x363edd[_0x0401('0x3')](_0x149ee4,function(_0x384d3f,_0x3c1b47){if(_0x384d3f){_0x1b40f4(_0x384d3f);}else if(_0x3c1b47){if(_0x3c1b47['AudioStream']instanceof Buffer){fs['writeFile'](_0x5f5d20,_0x3c1b47[_0x0401('0x4')],function(_0x508f52){if(_0x508f52){_0x1b40f4(_0x508f52);}else{_0x1e7a5c();}});}else{_0x1b40f4(new Error(_0x0401('0x5')));}}else{_0x1b40f4(new Error(_0x0401('0x6')));}});});}module['exports']=function(_0x1e92c2,_0x34c510,_0x5caadb,_0x4072b3,_0x4e6158,_0x45e335,_0x3d2eb8){var _0x554af6=new AWS[(_0x0401('0x7'))]({'accessKeyId':_0x1e92c2,'secretAccessKey':_0x34c510,'region':_0x5caadb});var _0x279d9c={'Text':_0x4e6158,'TextType':_0x45e335||_0x0401('0x8'),'OutputFormat':_0x0401('0x9'),'VoiceId':_0x4072b3};return pollyResult(_0x554af6,_0x279d9c,_0x3d2eb8);}; \ 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 5b11b80..08adcb9 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc955=['./lib/api'];(function(_0x5f2c2c,_0x1c2005){var _0x4a2da6=function(_0x21121e){while(--_0x21121e){_0x5f2c2c['push'](_0x5f2c2c['shift']());}};_0x4a2da6(++_0x1c2005);}(_0xc955,0x1eb));var _0x5c95=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xc955[_0x53cf8e];return _0x459197;};'use strict';var asr=require(_0x5c95('0x0'));module['exports']=function(_0x322388,_0x2d6212,_0x1e2dcc,_0x5a0bdb){return asr(_0x322388,_0x2d6212,_0x1e2dcc);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x4eae36,_0x40e350,_0x1040bf,_0x288263){return asr(_0x4eae36,_0x40e350,_0x1040bf);}; \ 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 ab655b8..cb9feeb 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 _0x4157=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x5d7e9b,_0xa47817){var _0x409583=function(_0x27af69){while(--_0x27af69){_0x5d7e9b['push'](_0x5d7e9b['shift']());}};_0x409583(++_0xa47817);}(_0x4157,0xf3));var _0x7415=function(_0x58e06b,_0x29849e){_0x58e06b=_0x58e06b-0x0;var _0x5e89be=_0x4157[_0x58e06b];return _0x5e89be;};'use strict';var url=require(_0x7415('0x0'));var BPromise=require(_0x7415('0x1'));var fs=require('fs');var host=_0x7415('0x2');module[_0x7415('0x3')]=function(_0x4509ca,_0x4c49e7,_0x3efb60){return new BPromise(function(_0x3bef76,_0x311038){var _0x341b12;if(typeof _0x4509ca!==_0x7415('0x4')||_0x4509ca[_0x7415('0x5')]===0x0){return _0x311038(_0x7415('0x6'));}if(typeof _0x4c49e7!==_0x7415('0x4')||_0x4c49e7[_0x7415('0x5')]===0x0){return _0x311038('key\x20should\x20be\x20a\x20string');}if(typeof _0x3efb60!==_0x7415('0x7')&&(typeof _0x3efb60!=='string'||_0x3efb60[_0x7415('0x5')]===0x0)){return _0x311038('lang\x20should\x20be\x20a\x20string');}try{_0x341b12=fs[_0x7415('0x8')](_0x4509ca)[_0x7415('0x9')](_0x7415('0xa'));}catch(_0xb023fa){return _0x311038(_0xb023fa);}return _0x3bef76({'method':_0x7415('0xb'),'uri':host+_0x7415('0xc')+_0x4c49e7,'body':{'config':{'encoding':_0x7415('0xd'),'sampleRateHertz':'8000','languageCode':_0x3efb60},'audio':{'content':_0x341b12}},'json':!![]});});}; \ No newline at end of file +var _0x6658=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x4fb13c,_0x1f612a){var _0x10e0f3=function(_0x4d0642){while(--_0x4d0642){_0x4fb13c['push'](_0x4fb13c['shift']());}};_0x10e0f3(++_0x1f612a);}(_0x6658,0x198));var _0x8665=function(_0x1bb967,_0x36d747){_0x1bb967=_0x1bb967-0x0;var _0x39580f=_0x6658[_0x1bb967];return _0x39580f;};'use strict';var url=require(_0x8665('0x0'));var BPromise=require(_0x8665('0x1'));var fs=require('fs');var host=_0x8665('0x2');module[_0x8665('0x3')]=function(_0x45eb4a,_0x454e7c,_0x252590){return new BPromise(function(_0x49b4d3,_0x4f1343){var _0xf643d8;if(typeof _0x45eb4a!==_0x8665('0x4')||_0x45eb4a['length']===0x0){return _0x4f1343('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x454e7c!==_0x8665('0x4')||_0x454e7c[_0x8665('0x5')]===0x0){return _0x4f1343(_0x8665('0x6'));}if(typeof _0x252590!==_0x8665('0x7')&&(typeof _0x252590!==_0x8665('0x4')||_0x252590[_0x8665('0x5')]===0x0)){return _0x4f1343(_0x8665('0x8'));}try{_0xf643d8=fs[_0x8665('0x9')](_0x45eb4a)['toString'](_0x8665('0xa'));}catch(_0x20da7d){return _0x4f1343(_0x20da7d);}return _0x49b4d3({'method':_0x8665('0xb'),'uri':host+_0x8665('0xc')+_0x454e7c,'body':{'config':{'encoding':_0x8665('0xd'),'sampleRateHertz':_0x8665('0xe'),'languageCode':_0x252590},'audio':{'content':_0xf643d8}},'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 3427ac4..e70bbc3 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 _0x9a25=['./asr','exports'];(function(_0x501093,_0x52d61e){var _0x10556c=function(_0x284cba){while(--_0x284cba){_0x501093['push'](_0x501093['shift']());}};_0x10556c(++_0x52d61e);}(_0x9a25,0x1e8));var _0x59a2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9a25[_0x501510];return _0x1e6ee5;};var asr=require(_0x59a2('0x0'));module[_0x59a2('0x1')]={'asr':asr}; \ No newline at end of file +var _0x66a0=['./asr','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66a0,0x130));var _0x066a=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x66a0[_0x29a29f];return _0x443ea3;};var asr=require(_0x066a('0x0'));module[_0x066a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 44260f4..29823d4 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 _0x6e0d=['https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','writeFile','chmodSync','777','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','data','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','replace','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','pipe','transcode','wav','end','info','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','split','readFileSync','toString','googleCloudTTS'];(function(_0x33898d,_0x2ec079){var _0x330c08=function(_0x112667){while(--_0x112667){_0x33898d['push'](_0x33898d['shift']());}};_0x330c08(++_0x2ec079);}(_0x6e0d,0x1e3));var _0xd6e0=function(_0x222092,_0x44c427){_0x222092=_0x222092-0x0;var _0x37947e=_0x6e0d[_0x222092];return _0x37947e;};'use strict';var apiai=require(_0xd6e0('0x0'));var BPromise=require(_0xd6e0('0x1'));var dialogflow=require(_0xd6e0('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xd6e0('0x3'));var md5=require(_0xd6e0('0x4'));var path=require(_0xd6e0('0x5'));var querystring=require(_0xd6e0('0x6'));var rp=require(_0xd6e0('0x7'));var rs=require(_0xd6e0('0x8'));var sox=require(_0xd6e0('0x9'));var tts=require(_0xd6e0('0xa'));var urlParse=require(_0xd6e0('0xb'))[_0xd6e0('0xc')];var util=require('util');var aws=require('./aws');var google=require(_0xd6e0('0xd'));var sestek=require(_0xd6e0('0xe'));var tilde=require(_0xd6e0('0xf'));var logger=require(_0xd6e0('0x10'))(_0xd6e0('0x11'));var ISPEECH_API=_0xd6e0('0x12');function downloadFile(_0x44ceda,_0x9d88d0){return new BPromise(function(_0x417a3f,_0xf621bc){var _0x20a473=urlParse(_0x44ceda);var _0x1165d9=_0x20a473[_0xd6e0('0x13')]===_0xd6e0('0x14')?https:http;var _0x2ba99a={'host':_0x20a473['host'],'path':_0x20a473[_0xd6e0('0x5')],'headers':{'user-agent':_0xd6e0('0x15')}};_0x1165d9[_0xd6e0('0x16')](_0x2ba99a,function(_0x3beb77){if(_0x3beb77['statusCode']!==0xc8){logger['error'](_0xd6e0('0x17')+_0x44ceda+_0xd6e0('0x18')+_0x3beb77[_0xd6e0('0x19')]+'\x20('+_0x3beb77[_0xd6e0('0x1a')]+')');_0xf621bc(new Error(_0xd6e0('0x17')+_0x44ceda+_0xd6e0('0x18')+_0x3beb77[_0xd6e0('0x19')]+'\x20('+_0x3beb77['statusMessage']+')'));return;}var _0x31b230=fs[_0xd6e0('0x1b')](_0x9d88d0);_0x31b230['on'](_0xd6e0('0x1c'),function(){logger['info'](_0xd6e0('0x1d'));_0x31b230[_0xd6e0('0x1e')](_0x417a3f);});_0x31b230['on'](_0xd6e0('0x1f'),function(_0x5207a0){fs['unlink'](_0x9d88d0);logger[_0xd6e0('0x1f')]('download\x20error',_0x5207a0);_0xf621bc(_0x5207a0);});_0x3beb77[_0xd6e0('0x20')](_0x31b230);})['on'](_0xd6e0('0x1f'),function(_0xfa2bd7){logger[_0xd6e0('0x1f')](_0xfa2bd7);_0xf621bc(_0xfa2bd7);})['end']();});}function uploadFile(_0x4a0252){return new BPromise(function(_0x46cec9,_0x3ef788){var _0x483bd0=urlParse(_0x4a0252);var _0x272fbb=_0x483bd0[_0xd6e0('0x13')]===_0xd6e0('0x14')?https:http;var _0x13f8ea={'host':_0x483bd0['host'],'path':_0x483bd0['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x272fbb[_0xd6e0('0x16')](_0x13f8ea,function(_0x302c45){if(_0x302c45[_0xd6e0('0x19')]!==0xc8){_0x3ef788(new Error(_0xd6e0('0x17')+_0x4a0252+_0xd6e0('0x18')+_0x302c45[_0xd6e0('0x19')]+'\x20('+_0x302c45[_0xd6e0('0x1a')]+')'));return;}var _0xf406e2='';_0x302c45['on']('data',function(_0xdf48bb){_0xf406e2+=_0xdf48bb;});_0x302c45['on']('end',function(){_0x46cec9(_0xf406e2);});})['on']('error',function(_0x3532ae){_0x3ef788(_0x3532ae);})['end']();});}function convertFile(_0x51e377,_0x5e8752){return new BPromise(function(_0x49d20b,_0x28fe2f){var _0x3b9834=sox[_0xd6e0('0x21')](_0x51e377,_0x5e8752,{'sampleRate':0x1f40,'format':_0xd6e0('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b9834['on'](_0xd6e0('0x1f'),function(_0x56ff2a){logger[_0xd6e0('0x1f')]('error\x20convert',_0x56ff2a);_0x28fe2f(_0x56ff2a);});_0x3b9834['on'](_0xd6e0('0x23'),function(){logger[_0xd6e0('0x24')]('finish\x20to\x20convert');_0x49d20b();});_0x3b9834['start']();});}function base64Decode(_0x2fb2f0,_0x89f6ce){var _0xf11975=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x28'));fs[_0xd6e0('0x29')](_0xf11975,_0x2fb2f0,_0xd6e0('0x2a'));return convertFile(_0xf11975,_0x89f6ce)[_0xd6e0('0x2b')](function(){try{fs[_0xd6e0('0x2c')](_0xf11975);fs['chmodSync'](_0x89f6ce,'777');}catch(_0x2b5374){logger['error'](_0x2b5374);}return _0x89f6ce[_0xd6e0('0x2d')]('.')[0x0];});}function base64Encode(_0x59209f){var _0x4811ae=fs[_0xd6e0('0x2e')](_0x59209f);return new Buffer(_0x4811ae)[_0xd6e0('0x2f')]('base64');}exports[_0xd6e0('0x30')]=function(_0x7de9a4,_0x191f7b,_0x4bf685,_0x2da065,_0x202ec7,_0x533c42){var _0x489543,_0x297a65;var _0x2777cb=_0xd6e0('0x31');var _0x2d48c3='?key='+_0x7de9a4;var _0x2116eb={};if(_0x191f7b===_0xd6e0('0x32')){_0x2116eb['input']={'ssml':_0x4bf685};}else{_0x2116eb[_0xd6e0('0x33')]={'text':_0x4bf685};};_0x2116eb[_0xd6e0('0x34')]={'languageCode':_0x2da065,'ssmlGender':_0x202ec7};_0x2116eb[_0xd6e0('0x35')]={'audioEncoding':_0xd6e0('0x36'),'sampleRateHertz':0x1f40};var _0x2c030f={'url':_0x2777cb+_0xd6e0('0x37')+_0x2d48c3,'method':_0xd6e0('0x38'),'json':!![],'body':_0x2116eb};return rp(_0x2c030f)[_0xd6e0('0x2b')](function(_0x4e8b4d){return new BPromise(function(_0x559de0,_0x433da6){_0x489543=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x39'));var _0x5ed3c4=Buffer['from'](_0x4e8b4d['audioContent'],_0xd6e0('0x2a'));return fs[_0xd6e0('0x3a')](_0x489543,_0x5ed3c4,function(_0x42f9f9){_0x433da6(_0x42f9f9);},function(_0x2cf243){fs[_0xd6e0('0x3b')](_0x489543,_0xd6e0('0x3c'));_0x559de0(_0x2cf243);});});})[_0xd6e0('0x2b')](function(_0xb116fa){_0x297a65=path[_0xd6e0('0x25')](__dirname,'tmp',rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x28'));return convertFile(_0x489543,_0x297a65);})['then'](function(){try{fs[_0xd6e0('0x2c')](_0x489543);fs[_0xd6e0('0x3b')](_0x297a65,_0xd6e0('0x3c'));}catch(_0x3d3d4a){logger[_0xd6e0('0x1f')](_0x3d3d4a);}logger[_0xd6e0('0x24')](_0xd6e0('0x3d'),_0x297a65[_0xd6e0('0x2d')]('.')[0x0]);return _0x297a65[_0xd6e0('0x2d')]('.')[0x0];});};exports[_0xd6e0('0x3e')]=function(_0xb898ca,_0x524e40){var _0x4840fc='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x438e90,_0x1e057a;var _0x45369d;var _0x114244={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4840fc,'headers':{'Content-Type':_0xd6e0('0x3f')},'body':_0xd6e0('0x40')+encodeURIComponent(JSON[_0xd6e0('0x41')]([[[_0xd6e0('0x42'),JSON[_0xd6e0('0x41')]([_0xb898ca,_0x524e40||'en',![],_0xd6e0('0x43')]),null,_0xd6e0('0x44')]]]))};return rp(_0x114244)['then'](function(_0x1cb7f8){try{_0x45369d=eval(_0x1cb7f8['slice'](0x5))[0x0][0x2];}catch(_0x2fe33b){throw new Error('parse\x20response\x20failed:\x0a'+_0x1cb7f8[_0xd6e0('0x45')]);}if(!_0x45369d){if(_0xb898ca['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd6e0('0x46')+_0x524e40+_0xd6e0('0x47'));}}try{_0x45369d=eval(_0x45369d)[0x0];}catch(_0x4b500c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd6e0('0x45')]);}const _0x41940e=_0x45369d;_0x438e90=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs['generate'](0x4)+'.mp3');fs[_0xd6e0('0x29')](_0x438e90,_0x45369d,{'encoding':_0xd6e0('0x2a')});_0x1e057a=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x28'));return convertFile(_0x438e90,_0x1e057a);})['then'](function(){try{fs[_0xd6e0('0x2c')](_0x438e90);fs['chmodSync'](_0x1e057a,'777');}catch(_0x19493a){logger[_0xd6e0('0x1f')](_0x19493a);}logger[_0xd6e0('0x24')]('goggleTTS\x20path',_0x1e057a[_0xd6e0('0x2d')]('.')[0x0]);return _0x1e057a[_0xd6e0('0x2d')]('.')[0x0];});};exports[_0xd6e0('0x48')]=function(_0x38b85a,_0xcd7d54,_0x55eb4){return google[_0xd6e0('0x49')](_0x38b85a,_0xcd7d54,_0x55eb4)[_0xd6e0('0x2b')](function(_0x4fb303){logger[_0xd6e0('0x24')](_0x4fb303[_0xd6e0('0x4a')]);return rp(_0x4fb303);})['then'](function(_0x40ccc9){var _0xdfc652='';var _0xf04bef=0x0;try{fs[_0xd6e0('0x2c')](_0x38b85a);}catch(_0x3aa174){logger[_0xd6e0('0x1f')](_0x3aa174);}if(_0x40ccc9&&_0x40ccc9[_0xd6e0('0x4b')]){_0xdfc652=_0x40ccc9[_0xd6e0('0x4b')][_0xd6e0('0x4c')](function(_0x3c59ca){return _0x3c59ca&&_0x3c59ca[_0xd6e0('0x4d')][0x0]&&_0x3c59ca[_0xd6e0('0x4d')][0x0]['transcript']?_0x3c59ca[_0xd6e0('0x4d')][0x0][_0xd6e0('0x4e')]:'';})[_0xd6e0('0x4f')]('\x0a');_0xf04bef=_0x40ccc9['results'][_0xd6e0('0x4c')](function(_0x3fc6ea){return _0x3fc6ea&&_0x3fc6ea[_0xd6e0('0x4d')][0x0]&&_0x3fc6ea[_0xd6e0('0x4d')][0x0]['confidence']?_0x3fc6ea[_0xd6e0('0x4d')][0x0][_0xd6e0('0x50')]:0x0;})[_0xd6e0('0x4f')]('\x0a');}logger[_0xd6e0('0x24')](_0xd6e0('0x51'),_0xdfc652);logger['info'](_0xd6e0('0x52'),_0xf04bef);return{'transcript':_0xdfc652,'confidence':_0xf04bef};})[_0xd6e0('0x53')](function(_0x420f30){logger[_0xd6e0('0x1f')]('[%s]\x20%s:%s',_0x420f30[_0xd6e0('0x19')],_0x420f30[_0xd6e0('0x54')],_0x420f30[_0xd6e0('0x55')]);});};exports[_0xd6e0('0x56')]=function(_0x5646e8,_0x1a65cb,_0x574c78,_0x3144ec){var _0x2e1cee=apiai(_0x1a65cb,{'language':_0x3144ec||'en'});return _0x2e1cee['textRequest'](_0x574c78,{'sessionId':md5(_0x5646e8)})[_0xd6e0('0x2b')](function(_0x1e6e8c){logger['info'](JSON[_0xd6e0('0x41')](_0x1e6e8c));return{'source':_0x1e6e8c[_0xd6e0('0x57')][_0xd6e0('0x58')],'resolvedQuery':_0x1e6e8c[_0xd6e0('0x57')][_0xd6e0('0x59')],'action':_0x1e6e8c['result'][_0xd6e0('0x5a')],'actionIncomplete':_0x1e6e8c['result'][_0xd6e0('0x5b')],'speech':_0x1e6e8c[_0xd6e0('0x57')]['fulfillment'][_0xd6e0('0x5c')],'score':_0x1e6e8c['result'][_0xd6e0('0x5d')],'statusCode':_0x1e6e8c[_0xd6e0('0x5e')]['code'],'endConversation':_0x1e6e8c[_0xd6e0('0x57')][_0xd6e0('0x5f')]['endConversation']||![],'isFallbackIntent':_0x1e6e8c[_0xd6e0('0x57')][_0xd6e0('0x5f')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x405e6e,_0x3ba879,_0x1599d0,_0x13ae37,_0x594d6d,_0x1dceb5){var _0x46bcc4=_0x13ae37[_0xd6e0('0x60')](/\\n/g,'\x0a');var _0x543781={'credentials':{'private_key':_0x46bcc4,'client_email':_0x1599d0}};var _0x1e5f3c=new dialogflow['SessionsClient'](_0x543781);var _0x42dd88=_0x1e5f3c[_0xd6e0('0x61')](_0x3ba879,md5(_0x405e6e));var _0x1d869e={'session':_0x42dd88,'queryInput':{'text':{'text':_0x594d6d,'languageCode':_0x1dceb5}}};return _0x1e5f3c[_0xd6e0('0x62')](_0x1d869e)[_0xd6e0('0x2b')](function(_0x58f1a1){if(_0x58f1a1&&_0x58f1a1[_0xd6e0('0x63')]){logger[_0xd6e0('0x24')](_0xd6e0('0x64'),JSON['stringify'](_0x58f1a1));var _0x29cc4f=_0x58f1a1[0x0];if(_0x29cc4f){var _0x5ef531={'action':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x5a')],'allRequiredParamsPresent':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x66')],'endConversation':_0x29cc4f['queryResult'][_0xd6e0('0x67')]&&_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x67')]['fields']?_0x29cc4f['queryResult'][_0xd6e0('0x67')][_0xd6e0('0x68')]['end_conversation'][_0xd6e0('0x69')]:![],'fulfillmentText':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x6a')],'intentName':_0x29cc4f[_0xd6e0('0x65')]['intent'][_0xd6e0('0x54')],'intentDisplayName':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x6b')][_0xd6e0('0x6c')],'isFallbackIntent':_0x29cc4f[_0xd6e0('0x65')]['intent']['isFallback'],'languageCode':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x6d')],'queryText':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x6e')],'responseId':_0x29cc4f[_0xd6e0('0x6f')],'score':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x70')],'speech':_0x29cc4f[_0xd6e0('0x65')][_0xd6e0('0x6a')],'providerResponse':JSON[_0xd6e0('0x41')](_0x58f1a1)};return _0x5ef531;}}});};exports['tildeASR']=function(_0x395829,_0x4c3aa9,_0x40bf34,_0x573b66){return tilde['asr'](_0x395829,_0x4c3aa9,_0x40bf34,_0x573b66)['then'](function(_0xbd8ff2){try{fs[_0xd6e0('0x2c')](_0x395829);}catch(_0x446a94){logger[_0xd6e0('0x1f')](_0x446a94);}logger[_0xd6e0('0x24')]('Tilde\x20ASR\x20transcription',_0xbd8ff2[_0xd6e0('0x4e')]);logger[_0xd6e0('0x24')]('Tilde\x20ASR\x20confidence',_0xbd8ff2[_0xd6e0('0x50')]);return _0xbd8ff2;});};exports[_0xd6e0('0x71')]=function(_0x292fd3,_0x1933fa,_0x37f9ed,_0x44078e,_0x4df417,_0x181458){var _0x24847a=path['resolve'](__dirname,'tmp',rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x39'));var _0x4a14c3;return aws[_0xd6e0('0x72')](_0x292fd3,_0x1933fa,_0x37f9ed,_0x44078e,_0x4df417,_0x181458,_0x24847a)['then'](function(){_0x4a14c3=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x28'));return convertFile(_0x24847a,_0x4a14c3);})[_0xd6e0('0x2b')](function(){try{fs[_0xd6e0('0x2c')](_0x24847a);fs[_0xd6e0('0x3b')](_0x4a14c3,'777');}catch(_0x361e4f){logger[_0xd6e0('0x1f')](_0x361e4f);}return _0x4a14c3[_0xd6e0('0x2d')]('.')[0x0];});};exports[_0xd6e0('0x73')]=function(_0x4b6fcf,_0x3596f3,_0x3dbcf5,_0x46455a,_0x4ffa25,_0x418a43){return aws[_0xd6e0('0x74')](_0x4b6fcf,_0x3596f3,_0x3dbcf5,_0x46455a,_0x4ffa25,_0x418a43)[_0xd6e0('0x2b')](function(_0x11bd0b){logger[_0xd6e0('0x24')](JSON[_0xd6e0('0x41')](_0x11bd0b));return _0x11bd0b;});};exports[_0xd6e0('0x75')]=function(_0x52f69a,_0xb74b4b,_0x275edb,_0x56ab97){var _0x2b8090=util['format'](_0xd6e0('0x76'),ISPEECH_API,_0x52f69a,encodeURIComponent(_0xb74b4b),_0x275edb,_0x56ab97);var _0x4900ed=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+'.mp3');var _0x4e159e;return downloadFile(_0x2b8090,_0x4900ed)[_0xd6e0('0x2b')](function(){_0x4e159e=path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+'.wav');return convertFile(_0x4900ed,_0x4e159e);})[_0xd6e0('0x2b')](function(){try{fs[_0xd6e0('0x2c')](_0x4900ed);fs[_0xd6e0('0x3b')](_0x4e159e,_0xd6e0('0x3c'));}catch(_0x3c7bb1){logger['error'](_0x3c7bb1);}return _0x4e159e[_0xd6e0('0x2d')]('.')[0x0];});};exports[_0xd6e0('0x77')]=function(_0x2daa23,_0x3e4a40,_0x5dc508,_0x2b9132){var _0x25f3ba=util[_0xd6e0('0x78')](_0xd6e0('0x79'),ISPEECH_API,_0x3e4a40,_0x5dc508,base64Encode(_0x2daa23),_0x2b9132?util['format'](_0xd6e0('0x7a'),encodeURIComponent(_0x2b9132)):_0xd6e0('0x7b'));return uploadFile(_0x25f3ba)[_0xd6e0('0x2b')](function(_0x234360){return querystring[_0xd6e0('0xc')](_0x234360);});};exports[_0xd6e0('0x7c')]=function(_0x40d9f8,_0x1901be){return sestek[_0xd6e0('0x7d')](_0x40d9f8,_0x1901be)[_0xd6e0('0x2b')](function(_0x268733){logger['info'](JSON['stringify'](_0x268733));var _0x2c96d4={'speech':_0x268733[_0xd6e0('0x7e')],'action':_0x268733[_0xd6e0('0x7f')]?_0x268733[_0xd6e0('0x7f')][_0xd6e0('0x80')]:undefined,'actiondata':_0x268733[_0xd6e0('0x7f')]?_0x268733[_0xd6e0('0x7f')][_0xd6e0('0x81')]:undefined};if(_0x268733[_0xd6e0('0x7f')]&&_0x268733[_0xd6e0('0x7f')][_0xd6e0('0x82')]){return base64Decode(_0x268733[_0xd6e0('0x7f')][_0xd6e0('0x82')]['Data'],path[_0xd6e0('0x25')](__dirname,_0xd6e0('0x26'),rs[_0xd6e0('0x27')](0x4)+_0xd6e0('0x28')))['then'](function(_0x274963){_0x2c96d4[_0xd6e0('0x83')]=_0x274963;return _0x2c96d4;});}return _0x2c96d4;});};exports[_0xd6e0('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x0f63=['close','unlink','download\x20error','end','request\x20to\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','.mp3','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','randomstring','google-tts-api','url','util','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file'];(function(_0x54acf7,_0x131887){var _0x2f2872=function(_0x5d9e19){while(--_0x5d9e19){_0x54acf7['push'](_0x54acf7['shift']());}};_0x2f2872(++_0x131887);}(_0x0f63,0x175));var _0x30f6=function(_0x2d7396,_0x34b744){_0x2d7396=_0x2d7396-0x0;var _0x179b20=_0x0f63[_0x2d7396];return _0x179b20;};'use strict';var apiai=require(_0x30f6('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x30f6('0x1'));var fs=require('fs');var http=require(_0x30f6('0x2'));var https=require(_0x30f6('0x3'));var md5=require(_0x30f6('0x4'));var path=require(_0x30f6('0x5'));var querystring=require(_0x30f6('0x6'));var rp=require('request-promise');var rs=require(_0x30f6('0x7'));var sox=require('sox');var tts=require(_0x30f6('0x8'));var urlParse=require(_0x30f6('0x9'))['parse'];var util=require(_0x30f6('0xa'));var aws=require(_0x30f6('0xb'));var google=require(_0x30f6('0xc'));var sestek=require('./sestek');var tilde=require(_0x30f6('0xd'));var logger=require(_0x30f6('0xe'))('agi');var ISPEECH_API=_0x30f6('0xf');function downloadFile(_0x52d82e,_0x565db0){return new BPromise(function(_0x3c94c5,_0x5c7264){var _0xc4b45f=urlParse(_0x52d82e);var _0x4bbe0e=_0xc4b45f[_0x30f6('0x10')]===_0x30f6('0x11')?https:http;var _0x37ed98={'host':_0xc4b45f[_0x30f6('0x12')],'path':_0xc4b45f[_0x30f6('0x5')],'headers':{'user-agent':_0x30f6('0x13')}};_0x4bbe0e[_0x30f6('0x14')](_0x37ed98,function(_0x26ef9b){if(_0x26ef9b[_0x30f6('0x15')]!==0xc8){logger[_0x30f6('0x16')]('request\x20to\x20'+_0x52d82e+_0x30f6('0x17')+_0x26ef9b[_0x30f6('0x15')]+'\x20('+_0x26ef9b[_0x30f6('0x18')]+')');_0x5c7264(new Error('request\x20to\x20'+_0x52d82e+_0x30f6('0x17')+_0x26ef9b['statusCode']+'\x20('+_0x26ef9b['statusMessage']+')'));return;}var _0x442b5f=fs[_0x30f6('0x19')](_0x565db0);_0x442b5f['on'](_0x30f6('0x1a'),function(){logger[_0x30f6('0x1b')](_0x30f6('0x1c'));_0x442b5f[_0x30f6('0x1d')](_0x3c94c5);});_0x442b5f['on'](_0x30f6('0x16'),function(_0x17e324){fs[_0x30f6('0x1e')](_0x565db0);logger[_0x30f6('0x16')](_0x30f6('0x1f'),_0x17e324);_0x5c7264(_0x17e324);});_0x26ef9b['pipe'](_0x442b5f);})['on'](_0x30f6('0x16'),function(_0x37e859){logger[_0x30f6('0x16')](_0x37e859);_0x5c7264(_0x37e859);})[_0x30f6('0x20')]();});}function uploadFile(_0x4b2f95){return new BPromise(function(_0x99a3ad,_0x159704){var _0x264ab9=urlParse(_0x4b2f95);var _0x1f72af=_0x264ab9[_0x30f6('0x10')]===_0x30f6('0x11')?https:http;var _0x243ede={'host':_0x264ab9['host'],'path':_0x264ab9[_0x30f6('0x5')],'headers':{'user-agent':_0x30f6('0x13')}};_0x1f72af[_0x30f6('0x14')](_0x243ede,function(_0x1bb81c){if(_0x1bb81c[_0x30f6('0x15')]!==0xc8){_0x159704(new Error(_0x30f6('0x21')+_0x4b2f95+'\x20failed,\x20status\x20code\x20=\x20'+_0x1bb81c[_0x30f6('0x15')]+'\x20('+_0x1bb81c[_0x30f6('0x18')]+')'));return;}var _0x2053f7='';_0x1bb81c['on'](_0x30f6('0x22'),function(_0x231d7e){_0x2053f7+=_0x231d7e;});_0x1bb81c['on'](_0x30f6('0x20'),function(){_0x99a3ad(_0x2053f7);});})['on']('error',function(_0xb931b6){_0x159704(_0xb931b6);})[_0x30f6('0x20')]();});}function convertFile(_0x2bf962,_0xba7f4d){return new BPromise(function(_0x352446,_0x28384f){var _0x569df0=sox[_0x30f6('0x23')](_0x2bf962,_0xba7f4d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x569df0['on'](_0x30f6('0x16'),function(_0x2aa291){logger[_0x30f6('0x16')](_0x30f6('0x24'),_0x2aa291);_0x28384f(_0x2aa291);});_0x569df0['on'](_0x30f6('0x20'),function(){logger['info'](_0x30f6('0x25'));_0x352446();});_0x569df0[_0x30f6('0x26')]();});}function base64Decode(_0x27c255,_0x40af55){var _0x3c0a4f=path[_0x30f6('0x27')](__dirname,_0x30f6('0x28'),rs[_0x30f6('0x29')](0x4)+_0x30f6('0x2a'));fs[_0x30f6('0x2b')](_0x3c0a4f,_0x27c255,_0x30f6('0x2c'));return convertFile(_0x3c0a4f,_0x40af55)['then'](function(){try{fs[_0x30f6('0x1e')](_0x3c0a4f);fs[_0x30f6('0x2d')](_0x40af55,_0x30f6('0x2e'));}catch(_0x203338){logger[_0x30f6('0x16')](_0x203338);}return _0x40af55[_0x30f6('0x2f')]('.')[0x0];});}function base64Encode(_0x5ca14c){var _0x565442=fs[_0x30f6('0x30')](_0x5ca14c);return new Buffer(_0x565442)['toString'](_0x30f6('0x2c'));}exports[_0x30f6('0x31')]=function(_0x13e5b7,_0x37070d,_0x565b87,_0x1e1371,_0x36aa2c,_0x45c206){var _0x5310fd,_0x4add28;var _0x5853a7=_0x30f6('0x32');var _0x5054f0=_0x30f6('0x33')+_0x13e5b7;var _0x320deb={};if(_0x37070d===_0x30f6('0x34')){_0x320deb[_0x30f6('0x35')]={'ssml':_0x565b87};}else{_0x320deb[_0x30f6('0x35')]={'text':_0x565b87};};_0x320deb['voice']={'languageCode':_0x1e1371,'ssmlGender':_0x36aa2c};_0x320deb[_0x30f6('0x36')]={'audioEncoding':_0x30f6('0x37'),'sampleRateHertz':0x1f40};var _0x586c03={'url':_0x5853a7+'text:synthesize'+_0x5054f0,'method':'POST','json':!![],'body':_0x320deb};return rp(_0x586c03)['then'](function(_0x7325d5){return new BPromise(function(_0x599583,_0x465f4c){_0x5310fd=path[_0x30f6('0x27')](__dirname,'tmp',rs[_0x30f6('0x29')](0x4)+'.mp3');var _0x14743a=Buffer[_0x30f6('0x38')](_0x7325d5[_0x30f6('0x39')],_0x30f6('0x2c'));return fs[_0x30f6('0x3a')](_0x5310fd,_0x14743a,function(_0x131047){_0x465f4c(_0x131047);},function(_0x3a0697){fs[_0x30f6('0x2d')](_0x5310fd,_0x30f6('0x2e'));_0x599583(_0x3a0697);});});})[_0x30f6('0x3b')](function(_0x2c4b2e){_0x4add28=path[_0x30f6('0x27')](__dirname,_0x30f6('0x28'),rs[_0x30f6('0x29')](0x4)+_0x30f6('0x2a'));return convertFile(_0x5310fd,_0x4add28);})[_0x30f6('0x3b')](function(){try{fs['unlink'](_0x5310fd);fs[_0x30f6('0x2d')](_0x4add28,'777');}catch(_0x1a2a9e){logger[_0x30f6('0x16')](_0x1a2a9e);}logger[_0x30f6('0x1b')](_0x30f6('0x3c'),_0x4add28[_0x30f6('0x2f')]('.')[0x0]);return _0x4add28['split']('.')[0x0];});};exports[_0x30f6('0x3d')]=function(_0x3b2cf6,_0x7eb7fb){var _0x267a20='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x34f973,_0x5656d1;var _0x53812e;var _0x44dc51={'encoding':_0x30f6('0x3e'),'method':_0x30f6('0x3f'),'timeout':0x2710,'url':_0x267a20,'headers':{'Content-Type':_0x30f6('0x40')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x30f6('0x41'),JSON[_0x30f6('0x42')]([_0x3b2cf6,_0x7eb7fb||'en',![],_0x30f6('0x43')]),null,_0x30f6('0x44')]]]))};return rp(_0x44dc51)[_0x30f6('0x3b')](function(_0x4a8407){try{_0x53812e=eval(_0x4a8407['slice'](0x5))[0x0][0x2];}catch(_0x119328){throw new Error(_0x30f6('0x45')+_0x4a8407[_0x30f6('0x22')]);}if(!_0x53812e){if(_0x3b2cf6[_0x30f6('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x30f6('0x47')+_0x7eb7fb+'\x22\x20might\x20not\x20exist');}}try{_0x53812e=eval(_0x53812e)[0x0];}catch(_0x2854fc){throw new Error(_0x30f6('0x45')+res['data']);}const _0x25bcda=_0x53812e;_0x34f973=path['resolve'](__dirname,_0x30f6('0x28'),rs[_0x30f6('0x29')](0x4)+_0x30f6('0x48'));fs[_0x30f6('0x2b')](_0x34f973,_0x53812e,{'encoding':_0x30f6('0x2c')});_0x5656d1=path['resolve'](__dirname,_0x30f6('0x28'),rs['generate'](0x4)+_0x30f6('0x2a'));return convertFile(_0x34f973,_0x5656d1);})[_0x30f6('0x3b')](function(){try{fs[_0x30f6('0x1e')](_0x34f973);fs[_0x30f6('0x2d')](_0x5656d1,'777');}catch(_0x4aca3e){logger[_0x30f6('0x16')](_0x4aca3e);}logger[_0x30f6('0x1b')](_0x30f6('0x49'),_0x5656d1[_0x30f6('0x2f')]('.')[0x0]);return _0x5656d1[_0x30f6('0x2f')]('.')[0x0];});};exports[_0x30f6('0x4a')]=function(_0x2f1eb0,_0x1b0c3a,_0x52e1f7){return google['asr'](_0x2f1eb0,_0x1b0c3a,_0x52e1f7)['then'](function(_0x360d35){logger[_0x30f6('0x1b')](_0x360d35[_0x30f6('0x4b')]);return rp(_0x360d35);})[_0x30f6('0x3b')](function(_0x50ea63){var _0x20c949='';var _0x339217=0x0;try{fs[_0x30f6('0x1e')](_0x2f1eb0);}catch(_0x3d2b93){logger[_0x30f6('0x16')](_0x3d2b93);}if(_0x50ea63&&_0x50ea63[_0x30f6('0x4c')]){_0x20c949=_0x50ea63[_0x30f6('0x4c')][_0x30f6('0x4d')](function(_0x36f7b1){return _0x36f7b1&&_0x36f7b1[_0x30f6('0x4e')][0x0]&&_0x36f7b1[_0x30f6('0x4e')][0x0]['transcript']?_0x36f7b1[_0x30f6('0x4e')][0x0][_0x30f6('0x4f')]:'';})['join']('\x0a');_0x339217=_0x50ea63[_0x30f6('0x4c')][_0x30f6('0x4d')](function(_0x310120){return _0x310120&&_0x310120['alternatives'][0x0]&&_0x310120[_0x30f6('0x4e')][0x0][_0x30f6('0x50')]?_0x310120['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x30f6('0x1b')](_0x30f6('0x51'),_0x20c949);logger[_0x30f6('0x1b')]('googleASR\x20confidence',_0x339217);return{'transcript':_0x20c949,'confidence':_0x339217};})[_0x30f6('0x52')](function(_0x252301){logger['error'](_0x30f6('0x53'),_0x252301[_0x30f6('0x15')],_0x252301[_0x30f6('0x54')],_0x252301[_0x30f6('0x55')]);});};exports[_0x30f6('0x56')]=function(_0x55c899,_0x514320,_0x5ac930,_0x259e82){var _0x4137a8=apiai(_0x514320,{'language':_0x259e82||'en'});return _0x4137a8[_0x30f6('0x57')](_0x5ac930,{'sessionId':md5(_0x55c899)})[_0x30f6('0x3b')](function(_0xc4e331){logger['info'](JSON[_0x30f6('0x42')](_0xc4e331));return{'source':_0xc4e331['result']['source'],'resolvedQuery':_0xc4e331[_0x30f6('0x58')][_0x30f6('0x59')],'action':_0xc4e331['result'][_0x30f6('0x5a')],'actionIncomplete':_0xc4e331['result'][_0x30f6('0x5b')],'speech':_0xc4e331['result'][_0x30f6('0x5c')][_0x30f6('0x5d')],'score':_0xc4e331[_0x30f6('0x58')][_0x30f6('0x5e')],'statusCode':_0xc4e331[_0x30f6('0x5f')][_0x30f6('0x60')],'endConversation':_0xc4e331[_0x30f6('0x58')]['metadata'][_0x30f6('0x61')]||![],'isFallbackIntent':_0xc4e331[_0x30f6('0x58')]['metadata']['isFallbackIntent']};});};exports[_0x30f6('0x62')]=function(_0x4957b5,_0x5f0a7f,_0x295d33,_0x5d9e51,_0x1cc8f9,_0x2f1fdf){var _0x5e940f=_0x5d9e51['replace'](/\\n/g,'\x0a');var _0x39f82f={'credentials':{'private_key':_0x5e940f,'client_email':_0x295d33}};var _0x4fbc00=new dialogflow[(_0x30f6('0x63'))](_0x39f82f);var _0x3894b2=_0x4fbc00['sessionPath'](_0x5f0a7f,md5(_0x4957b5));var _0x20ee4f={'session':_0x3894b2,'queryInput':{'text':{'text':_0x1cc8f9,'languageCode':_0x2f1fdf}}};return _0x4fbc00[_0x30f6('0x64')](_0x20ee4f)['then'](function(_0x135cc8){if(_0x135cc8&&_0x135cc8[_0x30f6('0x46')]){logger['info'](_0x30f6('0x65'),JSON[_0x30f6('0x42')](_0x135cc8));var _0x2d2606=_0x135cc8[0x0];if(_0x2d2606){var _0x1362e4={'action':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x5a')],'allRequiredParamsPresent':_0x2d2606['queryResult'][_0x30f6('0x67')],'endConversation':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x68')]&&_0x2d2606[_0x30f6('0x66')]['diagnosticInfo'][_0x30f6('0x69')]?_0x2d2606[_0x30f6('0x66')]['diagnosticInfo'][_0x30f6('0x69')][_0x30f6('0x6a')]['boolValue']:![],'fulfillmentText':_0x2d2606[_0x30f6('0x66')]['fulfillmentText'],'intentName':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x6b')][_0x30f6('0x54')],'intentDisplayName':_0x2d2606['queryResult'][_0x30f6('0x6b')]['displayName'],'isFallbackIntent':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x6b')]['isFallback'],'languageCode':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x6c')],'queryText':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x6d')],'responseId':_0x2d2606[_0x30f6('0x6e')],'score':_0x2d2606[_0x30f6('0x66')][_0x30f6('0x6f')],'speech':_0x2d2606['queryResult'][_0x30f6('0x70')],'providerResponse':JSON[_0x30f6('0x42')](_0x135cc8)};return _0x1362e4;}}});};exports[_0x30f6('0x71')]=function(_0x2608a7,_0x46d7fb,_0x4e9cb4,_0x24d3f5){return tilde[_0x30f6('0x72')](_0x2608a7,_0x46d7fb,_0x4e9cb4,_0x24d3f5)['then'](function(_0x3dcd98){try{fs[_0x30f6('0x1e')](_0x2608a7);}catch(_0x3a6fbd){logger['error'](_0x3a6fbd);}logger['info'](_0x30f6('0x73'),_0x3dcd98['transcript']);logger['info'](_0x30f6('0x74'),_0x3dcd98[_0x30f6('0x50')]);return _0x3dcd98;});};exports['awsPolly']=function(_0x461542,_0x30ec39,_0x4c3fcb,_0x56def0,_0x416d1d,_0x5ef53b){var _0x1772b2=path[_0x30f6('0x27')](__dirname,_0x30f6('0x28'),rs['generate'](0x4)+_0x30f6('0x48'));var _0x53894d;return aws[_0x30f6('0x75')](_0x461542,_0x30ec39,_0x4c3fcb,_0x56def0,_0x416d1d,_0x5ef53b,_0x1772b2)[_0x30f6('0x3b')](function(){_0x53894d=path[_0x30f6('0x27')](__dirname,'tmp',rs[_0x30f6('0x29')](0x4)+'.wav');return convertFile(_0x1772b2,_0x53894d);})[_0x30f6('0x3b')](function(){try{fs[_0x30f6('0x1e')](_0x1772b2);fs[_0x30f6('0x2d')](_0x53894d,_0x30f6('0x2e'));}catch(_0x167b5b){logger['error'](_0x167b5b);}return _0x53894d[_0x30f6('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x56ee1b,_0x136ca4,_0x2630ab,_0x219efc,_0x274615,_0x2b9a24){return aws[_0x30f6('0x76')](_0x56ee1b,_0x136ca4,_0x2630ab,_0x219efc,_0x274615,_0x2b9a24)[_0x30f6('0x3b')](function(_0x5c4a95){logger['info'](JSON[_0x30f6('0x42')](_0x5c4a95));return _0x5c4a95;});};exports['ispeechTTS']=function(_0x1c2fbf,_0x12fb0e,_0x6ba046,_0x44afe2){var _0x42bbe0=util[_0x30f6('0x77')](_0x30f6('0x78'),ISPEECH_API,_0x1c2fbf,encodeURIComponent(_0x12fb0e),_0x6ba046,_0x44afe2);var _0x30f188=path[_0x30f6('0x27')](__dirname,_0x30f6('0x28'),rs[_0x30f6('0x29')](0x4)+_0x30f6('0x48'));var _0x4be589;return downloadFile(_0x42bbe0,_0x30f188)[_0x30f6('0x3b')](function(){_0x4be589=path[_0x30f6('0x27')](__dirname,_0x30f6('0x28'),rs['generate'](0x4)+_0x30f6('0x2a'));return convertFile(_0x30f188,_0x4be589);})[_0x30f6('0x3b')](function(){try{fs[_0x30f6('0x1e')](_0x30f188);fs[_0x30f6('0x2d')](_0x4be589,_0x30f6('0x2e'));}catch(_0xdf5761){logger[_0x30f6('0x16')](_0xdf5761);}return _0x4be589[_0x30f6('0x2f')]('.')[0x0];});};exports[_0x30f6('0x79')]=function(_0x32b0ce,_0x4052cc,_0x52a431,_0x2226cc){var _0xd5740e=util[_0x30f6('0x77')](_0x30f6('0x7a'),ISPEECH_API,_0x4052cc,_0x52a431,base64Encode(_0x32b0ce),_0x2226cc?util[_0x30f6('0x77')](_0x30f6('0x7b'),encodeURIComponent(_0x2226cc)):_0x30f6('0x7c'));return uploadFile(_0xd5740e)[_0x30f6('0x3b')](function(_0x5a6eab){return querystring['parse'](_0x5a6eab);});};exports[_0x30f6('0x7d')]=function(_0x564008,_0x1fb39f){return sestek[_0x30f6('0x7e')](_0x564008,_0x1fb39f)[_0x30f6('0x3b')](function(_0x5d1e7c){logger[_0x30f6('0x1b')](JSON[_0x30f6('0x42')](_0x5d1e7c));var _0x451297={'speech':_0x5d1e7c[_0x30f6('0x7f')],'action':_0x5d1e7c[_0x30f6('0x80')]?_0x5d1e7c['channelData'][_0x30f6('0x81')]:undefined,'actiondata':_0x5d1e7c[_0x30f6('0x80')]?_0x5d1e7c[_0x30f6('0x80')][_0x30f6('0x82')]:undefined};if(_0x5d1e7c[_0x30f6('0x80')]&&_0x5d1e7c[_0x30f6('0x80')][_0x30f6('0x83')]){return base64Decode(_0x5d1e7c[_0x30f6('0x80')][_0x30f6('0x83')][_0x30f6('0x84')],path['resolve'](__dirname,_0x30f6('0x28'),rs[_0x30f6('0x29')](0x4)+_0x30f6('0x2a')))[_0x30f6('0x3b')](function(_0x484a86){_0x451297['audiofile']=_0x484a86;return _0x451297;});}return _0x451297;});};exports[_0x30f6('0x85')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 8f34e03..e2c237f 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xee88=['exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xee88,0xbd));var _0x8ee8=function(_0x3229b5,_0xa50ad6){_0x3229b5=_0x3229b5-0x0;var _0xce50a5=_0xee88[_0x3229b5];return _0xce50a5;};var nda=require('./nda');module[_0x8ee8('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 10b94f8..e3fad41 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 _0xb98f=['ndaactivity_type','message','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password'];(function(_0x48c612,_0x432076){var _0x5f0583=function(_0x2ebc92){while(--_0x2ebc92){_0x48c612['push'](_0x48c612['shift']());}};_0x5f0583(++_0x432076);}(_0xb98f,0xce));var _0xfb98=function(_0x1e1e9a,_0x1cfcc9){_0x1e1e9a=_0x1e1e9a-0x0;var _0x1d3b57=_0xb98f[_0x1e1e9a];return _0x1d3b57;};'use strict';var rp=require(_0xfb98('0x0'));var url=require(_0xfb98('0x1'));var logger=require(_0xfb98('0x2'))(_0xfb98('0x3'));module[_0xfb98('0x4')]=function(_0x4f16b2,_0x5570ce){var _0x593d54={'method':_0xfb98('0x5'),'uri':url[_0xfb98('0x6')](_0x5570ce[_0xfb98('0x7')],_0xfb98('0x8')),'form':{'grant_type':'password','username':_0x5570ce[_0xfb98('0x9')],'password':_0x5570ce[_0xfb98('0xa')]},'json':!![]};return rp(_0x593d54)['then'](function(_0x27b394){var _0x4d06fc={'method':'POST','uri':url['resolve'](_0x5570ce['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5570ce[_0xfb98('0xb')]||_0xfb98('0xc'),'channelId':'Nda','conversation':{'id':_0x4f16b2['uniqueid']},'from':{'id':_0x4f16b2[_0xfb98('0xd')],'name':_0x4f16b2['calleridname']},'recipient':{'id':_0x4f16b2[_0xfb98('0xe')],'name':_0x4f16b2[_0xfb98('0xf')]},'text':_0x5570ce[_0xfb98('0x10')],'channelData':{}},'headers':{'Authorization':_0xfb98('0x11')+_0x27b394[_0xfb98('0x12')]},'json':!![]};if(_0x5570ce[_0xfb98('0x13')]){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x16')]=_0x5570ce[_0xfb98('0x13')];}if(_0x5570ce[_0xfb98('0x17')]=='1'){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5570ce[_0xfb98('0x19')]){_0x4d06fc['body'][_0xfb98('0x15')][_0xfb98('0x1a')]=_0x5570ce[_0xfb98('0x19')];if(_0x5570ce[_0xfb98('0x1b')]){_0x4d06fc[_0xfb98('0x14')]['channelData'][_0xfb98('0x1c')]=_0x5570ce[_0xfb98('0x1b')];}}logger[_0xfb98('0x1d')](JSON[_0xfb98('0x1e')](_0x4d06fc));return rp(_0x4d06fc);});}; \ No newline at end of file +var _0x402f=['calleridname','project','body','channelData','AudioOutputSettings','audio/wav','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','resolve','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid'];(function(_0x4f6328,_0x3ad203){var _0x15fce0=function(_0x1e9cfb){while(--_0x1e9cfb){_0x4f6328['push'](_0x4f6328['shift']());}};_0x15fce0(++_0x3ad203);}(_0x402f,0x6f));var _0xf402=function(_0x2f0f36,_0x2ce07b){_0x2f0f36=_0x2f0f36-0x0;var _0x1152c5=_0x402f[_0x2f0f36];return _0x1152c5;};'use strict';var rp=require(_0xf402('0x0'));var url=require('url');var logger=require(_0xf402('0x1'))('agi');module['exports']=function(_0x3ccbce,_0xe1847c){var _0x86f726={'method':'POST','uri':url[_0xf402('0x2')](_0xe1847c['ndauth_url'],_0xf402('0x3')),'form':{'grant_type':_0xf402('0x4'),'username':_0xe1847c[_0xf402('0x5')],'password':_0xe1847c[_0xf402('0x4')]},'json':!![]};return rp(_0x86f726)[_0xf402('0x6')](function(_0x55c515){var _0x4d1771={'method':_0xf402('0x7'),'uri':url[_0xf402('0x2')](_0xe1847c[_0xf402('0x8')],_0xf402('0x9')),'body':{'type':_0xe1847c[_0xf402('0xa')]||_0xf402('0xb'),'channelId':_0xf402('0xc'),'conversation':{'id':_0x3ccbce[_0xf402('0xd')]},'from':{'id':_0x3ccbce['callerid'],'name':_0x3ccbce[_0xf402('0xe')]},'recipient':{'id':_0x3ccbce['dnid'],'name':_0x3ccbce['extension']},'text':_0xe1847c['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x55c515['access_token']},'json':!![]};if(_0xe1847c[_0xf402('0xf')]){_0x4d1771['body']['channelData']['ProjectName']=_0xe1847c[_0xf402('0xf')];}if(_0xe1847c['ndagenerate_audio']=='1'){_0x4d1771[_0xf402('0x10')][_0xf402('0x11')][_0xf402('0x12')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf402('0x13')};}if(_0xe1847c['custom_action']){_0x4d1771[_0xf402('0x10')]['channelData'][_0xf402('0x14')]=_0xe1847c['custom_action'];if(_0xe1847c['custom_action_data']){_0x4d1771['body'][_0xf402('0x11')][_0xf402('0x15')]=_0xe1847c[_0xf402('0x16')];}}logger[_0xf402('0x17')](JSON[_0xf402('0x18')](_0x4d1771));return rp(_0x4d1771);});}; \ 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 ef75689..e452ee5 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 _0x4870=['exports','./lib/api'];(function(_0x4b8bf0,_0x19323c){var _0x56db6a=function(_0x4d704f){while(--_0x4d704f){_0x4b8bf0['push'](_0x4b8bf0['shift']());}};_0x56db6a(++_0x19323c);}(_0x4870,0x8f));var _0x0487=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4870[_0x40a045];return _0x1a687c;};'use strict';var asr=require(_0x0487('0x0'));module[_0x0487('0x1')]=function(_0xeb7296,_0x14e11a,_0x375f0a,_0x4bd782){return asr(_0xeb7296,_0x14e11a,_0x375f0a,_0x4bd782);}; \ No newline at end of file +var _0xe992=['exports','./lib/api'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xe992,0xf1));var _0x2e99=function(_0x5c4375,_0x2766c3){_0x5c4375=_0x5c4375-0x0;var _0x3369d6=_0xe992[_0x5c4375];return _0x3369d6;};'use strict';var asr=require(_0x2e99('0x0'));module[_0x2e99('0x1')]=function(_0x31ecdc,_0xa7744a,_0x4fab32,_0x1e0f91){return asr(_0x31ecdc,_0xa7744a,_0x4fab32,_0x1e0f91);}; \ 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 eb87581..fbac6bb 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 _0xa4e0=['parse','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','terminate'];(function(_0x1e6dc4,_0xc37ed6){var _0x5409cb=function(_0x5955ef){while(--_0x5955ef){_0x1e6dc4['push'](_0x1e6dc4['shift']());}};_0x5409cb(++_0xc37ed6);}(_0xa4e0,0xc4));var _0x0a4e=function(_0x5aab0d,_0x5f328c){_0x5aab0d=_0x5aab0d-0x0;var _0x272b83=_0xa4e0[_0x5aab0d];return _0x272b83;};'use strict';var BPromise=require(_0x0a4e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0a4e('0x1'));var crypto=require(_0x0a4e('0x2'));var logger=require(_0x0a4e('0x3'))('agi');module[_0x0a4e('0x4')]=function(_0x34b5b9,_0x29fa8e,_0x5b7506,_0x222803){return new BPromise(function(_0x211911,_0x26d76f){logger[_0x0a4e('0x5')](_0x0a4e('0x6'),_0x222803||_0x0a4e('0x7'));var _0x4ebdb1=new WebSocket(_0x222803||_0x0a4e('0x7'),{'perMessageDeflate':![]});var _0x5a647a='';var _0x3e46d6='0';var _0x1eefe8='1';var _0x1d2582=_0x0a4e('0x8');function _0x41b267(_0x532239){var _0x2600d2=crypto['createHash']('sha1');_0x2600d2[_0x0a4e('0x9')](_0x532239);return _0x2600d2[_0x0a4e('0xa')](_0x0a4e('0xb'));}function _0x31ea3a(){try{logger[_0x0a4e('0x5')](_0x0a4e('0xc'));var _0x3c1b52=moment()['unix']();var _0x199853=_0x41b267(_0x3c1b52+_0x29fa8e+_0x5b7506);_0x4ebdb1[_0x0a4e('0xd')](JSON[_0x0a4e('0xe')]({'appID':_0x29fa8e,'timestamp':_0x3c1b52,'appKey':_0x199853}));var _0xa7cad9=fs[_0x0a4e('0xf')](_0x34b5b9);_0xa7cad9['on'](_0x0a4e('0x10'),function(_0x34dd42){_0x4ebdb1[_0x0a4e('0xd')](_0x34dd42);});_0xa7cad9['on'](_0x0a4e('0x11'),function(){_0x4ebdb1['send']('EOS');});}catch(_0x27dbb4){logger[_0x0a4e('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0a4e('0xe')](_0x27dbb4));_0x4ebdb1[_0x0a4e('0x13')]();}}function _0x3ceb56(_0x39a95f){try{if(_0x39a95f){var _0x237535=JSON[_0x0a4e('0x14')](_0x39a95f);switch(_0x237535['status']){case 0x0:if(_0x237535[_0x0a4e('0x15')]){if(_0x237535[_0x0a4e('0x15')][_0x0a4e('0x16')]){logger[_0x0a4e('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x0a4e('0xe')](_0x237535[_0x0a4e('0x15')][_0x0a4e('0x17')]));_0x5a647a=_0x237535[_0x0a4e('0x15')][_0x0a4e('0x17')][0x0][_0x0a4e('0x18')];_0x3e46d6=_0x237535['result']['hypotheses'][0x0][_0x0a4e('0x19')];_0x1eefe8='0';_0x1d2582=_0x0a4e('0x1a');_0x4ebdb1[_0x0a4e('0x13')]();}}break;case 0x1:logger[_0x0a4e('0x5')](_0x0a4e('0x8'));_0x1eefe8='1';_0x1d2582=_0x0a4e('0x8');break;case 0x2:logger[_0x0a4e('0x5')](_0x0a4e('0x1b'));_0x1eefe8='2';_0x1d2582='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x0a4e('0x1c'));_0x1eefe8='9';_0x1d2582='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x0a4e('0x5')]('Authentication\x20failed.');_0x1eefe8='10';_0x1d2582=_0x0a4e('0x1d');break;case 0xb:logger[_0x0a4e('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1eefe8='11';_0x1d2582=_0x0a4e('0x1e');}}}catch(_0x41edb8){logger[_0x0a4e('0x12')](_0x0a4e('0x1f'),JSON[_0x0a4e('0xe')](_0x41edb8));_0x4ebdb1[_0x0a4e('0x13')]();}}function _0x53a9d9(){logger['info'](_0x0a4e('0x20'));_0x211911({'transcript':_0x5a647a,'confidence':_0x3e46d6,'status':_0x1eefe8,'status_message':_0x1d2582});}function _0x3253aa(_0x1d56cb){logger[_0x0a4e('0x12')](_0x0a4e('0x21'));if(!_[_0x0a4e('0x22')](_0x1d56cb)){logger[_0x0a4e('0x12')](_['isObject'](_0x1d56cb)?JSON['stringify'](_0x1d56cb):_0x1d56cb);}}_0x4ebdb1['on']('open',_0x31ea3a);_0x4ebdb1['on'](_0x0a4e('0x23'),_0x3ceb56);_0x4ebdb1['on'](_0x0a4e('0x11'),_0x53a9d9);_0x4ebdb1['on'](_0x0a4e('0x12'),_0x3253aa);});}; \ No newline at end of file +var _0x2cbb=['sha1','update','digest','hex','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x4ec91d,_0x42e568){var _0x5aa6f8=function(_0x1c1e70){while(--_0x1c1e70){_0x4ec91d['push'](_0x4ec91d['shift']());}};_0x5aa6f8(++_0x42e568);}(_0x2cbb,0x96));var _0xb2cb=function(_0x100338,_0x5cdbcc){_0x100338=_0x100338-0x0;var _0x330d32=_0x2cbb[_0x100338];return _0x330d32;};'use strict';var BPromise=require('bluebird');var _=require(_0xb2cb('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb2cb('0x1'));var crypto=require(_0xb2cb('0x2'));var logger=require(_0xb2cb('0x3'))(_0xb2cb('0x4'));module[_0xb2cb('0x5')]=function(_0xd1e58c,_0x2e4190,_0x4ee1bd,_0x149f0a){return new BPromise(function(_0x1d9f91,_0x599606){logger[_0xb2cb('0x6')](_0xb2cb('0x7'),_0x149f0a||_0xb2cb('0x8'));var _0x364042=new WebSocket(_0x149f0a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x459b93='';var _0x3a351a='0';var _0xf36744='1';var _0x45f443='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x57a13f(_0x155e5c){var _0x8b3b50=crypto[_0xb2cb('0x9')](_0xb2cb('0xa'));_0x8b3b50[_0xb2cb('0xb')](_0x155e5c);return _0x8b3b50[_0xb2cb('0xc')](_0xb2cb('0xd'));}function _0x162855(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x141484=moment()['unix']();var _0x500fc7=_0x57a13f(_0x141484+_0x2e4190+_0x4ee1bd);_0x364042[_0xb2cb('0xe')](JSON[_0xb2cb('0xf')]({'appID':_0x2e4190,'timestamp':_0x141484,'appKey':_0x500fc7}));var _0x2854d8=fs[_0xb2cb('0x10')](_0xd1e58c);_0x2854d8['on'](_0xb2cb('0x11'),function(_0x3b5ee3){_0x364042['send'](_0x3b5ee3);});_0x2854d8['on'](_0xb2cb('0x12'),function(){_0x364042[_0xb2cb('0xe')](_0xb2cb('0x13'));});}catch(_0x341da4){logger[_0xb2cb('0x14')](_0xb2cb('0x15'),JSON[_0xb2cb('0xf')](_0x341da4));_0x364042[_0xb2cb('0x16')]();}}function _0x1d23b1(_0x277c8e){try{if(_0x277c8e){var _0x188e9d=JSON[_0xb2cb('0x17')](_0x277c8e);switch(_0x188e9d[_0xb2cb('0x18')]){case 0x0:if(_0x188e9d['result']){if(_0x188e9d[_0xb2cb('0x19')]['final']){logger[_0xb2cb('0x6')](_0xb2cb('0x1a'),JSON[_0xb2cb('0xf')](_0x188e9d[_0xb2cb('0x19')][_0xb2cb('0x1b')]));_0x459b93=_0x188e9d['result'][_0xb2cb('0x1b')][0x0][_0xb2cb('0x1c')];_0x3a351a=_0x188e9d['result'][_0xb2cb('0x1b')][0x0][_0xb2cb('0x1d')];_0xf36744='0';_0x45f443=_0xb2cb('0x1e');_0x364042[_0xb2cb('0x16')]();}}break;case 0x1:logger[_0xb2cb('0x6')](_0xb2cb('0x1f'));_0xf36744='1';_0x45f443=_0xb2cb('0x1f');break;case 0x2:logger[_0xb2cb('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xf36744='2';_0x45f443=_0xb2cb('0x20');break;case 0x9:logger[_0xb2cb('0x6')](_0xb2cb('0x21'));_0xf36744='9';_0x45f443=_0xb2cb('0x21');break;case 0xa:logger[_0xb2cb('0x6')](_0xb2cb('0x22'));_0xf36744='10';_0x45f443=_0xb2cb('0x22');break;case 0xb:logger['info'](_0xb2cb('0x23'));_0xf36744='11';_0x45f443=_0xb2cb('0x23');}}}catch(_0x320458){logger[_0xb2cb('0x14')](_0xb2cb('0x24'),JSON[_0xb2cb('0xf')](_0x320458));_0x364042[_0xb2cb('0x16')]();}}function _0x5aee6a(){logger[_0xb2cb('0x6')](_0xb2cb('0x25'));_0x1d9f91({'transcript':_0x459b93,'confidence':_0x3a351a,'status':_0xf36744,'status_message':_0x45f443});}function _0x97320(_0x28ce3b){logger[_0xb2cb('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb2cb('0x26')](_0x28ce3b)){logger[_0xb2cb('0x14')](_[_0xb2cb('0x27')](_0x28ce3b)?JSON['stringify'](_0x28ce3b):_0x28ce3b);}}_0x364042['on']('open',_0x162855);_0x364042['on']('message',_0x1d23b1);_0x364042['on'](_0xb2cb('0x12'),_0x5aee6a);_0x364042['on']('error',_0x97320);});}; \ 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 b3dd631..bf1e082 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 _0xcda3=['exports','./asr'];(function(_0x26fe11,_0x3baf26){var _0x481bf5=function(_0x390017){while(--_0x390017){_0x26fe11['push'](_0x26fe11['shift']());}};_0x481bf5(++_0x3baf26);}(_0xcda3,0x183));var _0x3cda=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xcda3[_0x2fc012];return _0x2891f9;};var asr=require(_0x3cda('0x0'));module[_0x3cda('0x1')]={'asr':asr}; \ No newline at end of file +var _0x88c4=['exports'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x88c4,0x1a3));var _0x488c=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x88c4[_0x238830];return _0x5917f0;};var asr=require('./asr');module[_0x488c('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 535ac9e..4598f5f 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 _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x3a2e4c,_0x538db2){var _0x237c2c=function(_0xc1e9f5){while(--_0xc1e9f5){_0x3a2e4c['push'](_0x3a2e4c['shift']());}};_0x237c2c(++_0x538db2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0f54745..b96c430 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 _0xae87=['VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','randomstring','moment','request-promise','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','mailRpc','prototype','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','sendMailMessage','interval','map','Intervals','format','getQueryOdbc','open','error','info','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','headers','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','stringify','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','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()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20query\x20configured','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','wav','beep','recordFile','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','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%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','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','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','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block'];(function(_0xcadbdc,_0x3d830e){var _0x280408=function(_0xd1c38e){while(--_0xd1c38e){_0xcadbdc['push'](_0xcadbdc['shift']());}};_0x280408(++_0x3d830e);}(_0xae87,0x1ce));var _0x7ae8=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xae87[_0x45e98e];return _0x374dba;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x7ae8('0x0'));var moment=require(_0x7ae8('0x1'));var Mustache=require('mustache');var rp=require(_0x7ae8('0x2'));var logger=require('../../config/logger')('agi');var config=require(_0x7ae8('0x3'));var shared=require(_0x7ae8('0x4'));var scripts=require(_0x7ae8('0x5'));var FILES_PATH=_0x7ae8('0x6');var recursiveMapAttributes=['rawHeaders',_0x7ae8('0x7')];var verticesWithRetry=[_0x7ae8('0x8'),_0x7ae8('0x9'),_0x7ae8('0xa')];var AGIVertices=function(_0x1f049b,_0x45dfc2,_0x2138eb){this['channel']=_0x1f049b;this['rpc']=_0x45dfc2;this[_0x7ae8('0xb')]=_0x2138eb;};AGIVertices[_0x7ae8('0xc')]['getVariable']=function(_0xa3fb7a,_0x4aa39f){this[_0x7ae8('0xd')]['getVariableById'](_0xa3fb7a)[_0x7ae8('0xe')](function(_0x4bf950){_0x4aa39f(null,_0x4bf950?_0x4bf950[_0x7ae8('0xf')]:![]);})[_0x7ae8('0x10')](function(_0x3e41c1){_0x4aa39f(_0x3e41c1);});};AGIVertices['prototype'][_0x7ae8('0x11')]=function(_0x3b5605,_0x47b913){this[_0x7ae8('0xd')][_0x7ae8('0x12')](_0x3b5605)[_0x7ae8('0xe')](function(_0x381211){_0x47b913(null,_0x381211?_0x381211[_0x7ae8('0xf')]:![]);})[_0x7ae8('0x10')](function(_0xcf3a3d){_0x47b913(_0xcf3a3d);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x13')]=function(_0x107f39,_0x712147){this[_0x7ae8('0xd')]['getSquareProjectById'](_0x107f39)[_0x7ae8('0xe')](function(_0x252334){_0x712147(null,_0x252334?_0x252334['name']:![]);})[_0x7ae8('0x10')](function(_0x1ae8c5){_0x712147(_0x1ae8c5);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x14')]=function(_0x510aea,_0x4f21c0){this['rpc'][_0x7ae8('0x15')](_0x510aea)[_0x7ae8('0xe')](function(_0x587d0a){_0x4f21c0(null,_0x587d0a?_0x587d0a[_0x7ae8('0x16')]:![]);})['catch'](function(_0xddd2f5){_0x4f21c0(_0xddd2f5);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x17')]=function(_0x35cbed,_0x41116e){this[_0x7ae8('0xd')][_0x7ae8('0x18')](_0x35cbed)[_0x7ae8('0xe')](function(_0x3566f3){_0x41116e(null,_0x3566f3?_0x3566f3[_0x7ae8('0xf')]:![]);})[_0x7ae8('0x10')](function(_0x26d043){_0x41116e(_0x26d043);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x19')]=function(_0x2e11d9,_0x525b88){this['rpc'][_0x7ae8('0x1a')](_0x2e11d9)['then'](function(_0x5b2423){_0x525b88(null,_0x5b2423?_0x5b2423[_0x7ae8('0xf')]:![]);})['catch'](function(_0x33faec){_0x525b88(_0x33faec);});};AGIVertices[_0x7ae8('0xc')]['getSound']=function(_0x3fa339,_0xa9f18a){var _0x45e15c=this;this[_0x7ae8('0xd')][_0x7ae8('0x1b')](_0x3fa339)[_0x7ae8('0xe')](function(_0x4ff980){_0xa9f18a(null,_0x4ff980?_0x45e15c[_0x7ae8('0x1c')](_0x4ff980['save_name']):![]);})[_0x7ae8('0x10')](function(_0x14d1a6){_0xa9f18a(_0x14d1a6);});};AGIVertices[_0x7ae8('0xc')]['getMailAccount']=function(_0x3af383,_0x31d933){this[_0x7ae8('0xd')]['getMailAccountById'](_0x3af383)[_0x7ae8('0xe')](function(_0x39d750){_0x31d933(null,_0x39d750?_0x39d750:![]);})[_0x7ae8('0x10')](function(_0x1c76cd){_0x31d933(_0x1c76cd);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1d')]=function(_0x63cc2c,_0x4c86e8,_0x2be8b7){this[_0x7ae8('0xb')][_0x7ae8('0x1d')](_0x63cc2c,_0x4c86e8)['then'](function(){_0x2be8b7(null);})[_0x7ae8('0x10')](function(_0x40edfd){_0x2be8b7(_0x40edfd);});};AGIVertices[_0x7ae8('0xc')]['getIntervals']=function(_0x24d111,_0x56614a){this['rpc']['getIntervalById'](_0x24d111)[_0x7ae8('0xe')](function(_0x2a44c3){if(_0x2a44c3){if(_0x2a44c3['IntervalId']){_0x56614a(null,[_0x2a44c3[_0x7ae8('0x1e')]]);}else{_0x56614a(null,_[_0x7ae8('0x1f')](_0x2a44c3[_0x7ae8('0x20')],_0x7ae8('0x1e')));}}else{_0x56614a(null,![]);}})['catch'](function(_0x136cc9){_0x56614a(_0x136cc9);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1c')]=function(_0x52e056){return util[_0x7ae8('0x21')]('%s/sounds/converted/%s',FILES_PATH,_0x52e056);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x22')]=function(_0x11629f,_0x29cb06,_0x513f3c){odbc[_0x7ae8('0x23')](_0x11629f,function(_0x4359b2){if(_0x4359b2){logger[_0x7ae8('0x24')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4359b2);_0x513f3c(_0x4359b2);}else{logger[_0x7ae8('0x25')]('ODBC\x20connection\x20successfully');odbc['query'](_0x29cb06,function(_0x8aa4a4,_0x4f5a24){if(_0x8aa4a4){logger['info'](_0x7ae8('0x26'),_0x29cb06);_0x513f3c(_0x8aa4a4);}else{logger[_0x7ae8('0x25')]('Query\x20executed\x20correctly\x20%s',_0x29cb06);odbc[_0x7ae8('0x27')](function(_0x623827){if(_0x623827){logger[_0x7ae8('0x24')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x623827);}_0x513f3c(null,_0x4f5a24);});}});}});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x28')]=function(_0x2a8861,_0x2f5630){this['rpc'][_0x7ae8('0x29')](_0x2a8861)[_0x7ae8('0xe')](function(_0x3e17c9){_0x2f5630(null,_0x3e17c9?_0x3e17c9:![]);})[_0x7ae8('0x10')](function(_0x2ecce3){_0x2f5630(_0x2ecce3);});};AGIVertices['prototype']['createSmsMessage']=function(_0x59bb66,_0x454721){this[_0x7ae8('0xd')][_0x7ae8('0x2a')](_0x59bb66)[_0x7ae8('0xe')](function(_0x4e2adb){_0x454721(null,_0x4e2adb);})[_0x7ae8('0x10')](function(_0x3e17b4){_0x454721(_0x3e17b4);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x2b')]=function(_0x3883c5,_0x3f5176,_0x15fb49){this[_0x7ae8('0xd')][_0x7ae8('0x2b')]({'uniqueid':this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],'node':_0x3883c5[_0x7ae8('0x2e')],'application':_0x3883c5[_0x7ae8('0x2f')],'data':_0x3f5176||null,'project_name':this[_0x7ae8('0x2c')][_0x7ae8('0x30')],'callerid':this[_0x7ae8('0x2c')][_0x7ae8('0x31')]})[_0x7ae8('0xe')](function(_0x3649d8){if(_0x15fb49){_0x15fb49(null,_0x3649d8);}})['catch'](function(_0x20f30e){if(_0x15fb49){_0x15fb49(_0x20f30e);}});};AGIVertices['prototype'][_0x7ae8('0x32')]=function(_0x1f521b,_0x34ba44,_0x6db21e,_0x3d83d){this[_0x7ae8('0xd')]['createSquareRecording']({'uniqueid':this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],'callerid':this[_0x7ae8('0x2c')][_0x7ae8('0x31')],'calleridname':this[_0x7ae8('0x2c')][_0x7ae8('0x33')],'context':this[_0x7ae8('0x2c')]['context'],'extension':this[_0x7ae8('0x2c')][_0x7ae8('0x34')],'priority':this[_0x7ae8('0x2c')][_0x7ae8('0x35')],'accountcode':this['channel'][_0x7ae8('0x36')],'dnid':this[_0x7ae8('0x2c')]['dnid'],'projectName':this[_0x7ae8('0x2c')][_0x7ae8('0x30')],'saveName':_0x34ba44,'filename':_0x1f521b['file']||_0x34ba44,'savePath':_0x6db21e})[_0x7ae8('0xe')](function(_0x63c528){_0x3d83d(null,_0x63c528);})[_0x7ae8('0x10')](function(_0x58ac5e){_0x3d83d(_0x58ac5e);});};AGIVertices['prototype']['createSquareMessage']=function(_0x52a373,_0xe01ccd,_0x338390,_0x5c832e,_0x46de0b){this[_0x7ae8('0xd')][_0x7ae8('0x37')]({'uniqueid':this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],'body':_0x52a373,'direction':_0xe01ccd,'providerName':_0x338390,'providerResponse':_0x5c832e})[_0x7ae8('0xe')](function(_0xa8ee86){if(_0x46de0b){_0x46de0b(null,_0xa8ee86);}})['catch'](function(_0x4781b5){if(_0x46de0b){_0x46de0b(_0x4781b5);}});};AGIVertices['prototype'][_0x7ae8('0x38')]=function(_0x43904a,_0x597d15){this[_0x7ae8('0xd')]['createCmContact']({'firstName':_[_0x7ae8('0x39')](_0x43904a[_0x7ae8('0xf')])||_[_0x7ae8('0x3a')](_0x43904a[_0x7ae8('0xf')])?_0x7ae8('0x3b')+Math['random']():_0x43904a[_0x7ae8('0xf')],'lastName':_['isEmpty'](_0x43904a[_0x7ae8('0x3c')])||_[_0x7ae8('0x3a')](_0x43904a[_0x7ae8('0x3c')])?null:_0x43904a[_0x7ae8('0x3c')],'phone':_0x43904a[_0x7ae8('0x3d')],'ListId':_0x43904a['list_id'],'scheduledat':_0x43904a['scheduledAt'],'callbackUniqueid':this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],'tags':_0x7ae8('0x3e'),'description':_0x7ae8('0x3f')+_0x43904a[_0x7ae8('0x40')][_0x7ae8('0x41')](),'priority':_0x43904a[_0x7ae8('0x42')]})[_0x7ae8('0xe')](function(_0x24dfa3){_0x597d15(null,_0x24dfa3);})[_0x7ae8('0x10')](function(_0x251c25){_0x597d15(_0x251c25);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x43')]=function(_0x5f33bf,_0x4515bc){this[_0x7ae8('0xd')][_0x7ae8('0x44')](_0x5f33bf)[_0x7ae8('0xe')](function(_0x1e669c){_0x4515bc(null,_0x1e669c?_0x1e669c[_0x7ae8('0xf')]:![]);})[_0x7ae8('0x10')](function(_0xc05c31){_0x4515bc(_0xc05c31);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x45')]=function(_0x35be88,_0x195a84,_0x3cc3de){var _0x327884={'role':'agent'};_0x327884[_0x35be88]=this['channel'][_0x7ae8('0x31')];this['rpc']['agentPause'](_0x327884,_0x195a84,this[_0x7ae8('0x2c')]['uniqueid'])[_0x7ae8('0xe')](function(_0x646339){_0x3cc3de(null,_[_0x7ae8('0x3a')](_0x646339)?![]:!![]);})[_0x7ae8('0x10')](function(_0x1a9a88){logger[_0x7ae8('0x24')](_0x1a9a88);_0x3cc3de(null,![]);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x46')]=function(_0x565313,_0x1e8ebe){var _0x477ac6={'role':_0x7ae8('0x47')};_0x477ac6[_0x565313]=this[_0x7ae8('0x2c')]['callerid'];this[_0x7ae8('0xd')][_0x7ae8('0x46')](_0x477ac6)[_0x7ae8('0xe')](function(_0x42527a){_0x1e8ebe(null,_['isNil'](_0x42527a)?![]:!![]);})['catch'](function(_0x3c3ea2){logger[_0x7ae8('0x24')](_0x3c3ea2);_0x1e8ebe(null,![]);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x48')]=function(_0x4042fd,_0x39eb7a){var _0x10b139={'role':_0x7ae8('0x47')};_0x10b139[_0x4042fd]=this[_0x7ae8('0x2c')][_0x7ae8('0x31')];this[_0x7ae8('0xd')][_0x7ae8('0x48')](_0x10b139)[_0x7ae8('0xe')](function(_0x30bb3e){_0x39eb7a(null,_[_0x7ae8('0x3a')](_0x30bb3e)?![]:!![]);})['catch'](function(_0x2e25ae){logger[_0x7ae8('0x24')](_0x2e25ae);_0x39eb7a(null,![]);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x49')]=function(_0x208ef6,_0x12249d){var _0x2323cb={'role':_0x7ae8('0x47')};_0x2323cb[_0x208ef6]=this[_0x7ae8('0x2c')][_0x7ae8('0x31')];var _0x56d44d=_0x208ef6!='internal'?util[_0x7ae8('0x21')](_0x7ae8('0x4a'),_0x7ae8('0x4b'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')]):undefined;this[_0x7ae8('0xd')]['agentLogin'](_0x2323cb,_0x56d44d)[_0x7ae8('0xe')](function(_0x3abe95){_0x12249d(null,_[_0x7ae8('0x3a')](_0x3abe95)?![]:!![]);})['catch'](function(_0x1767d1){logger[_0x7ae8('0x24')](_0x1767d1);_0x12249d(null,![]);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x4c')]=function(_0x4fb753,_0x462729){sh[_0x7ae8('0x4d')](_[_0x7ae8('0x4e')](_0x4fb753),function(_0x509da2,_0x1763f5){var _0x4fe4d7=_0x1763f5[_0x7ae8('0x4f')](/(\r\n|\n|\r)/gm,'');_0x462729(null,_0x4fe4d7);});};AGIVertices[_0x7ae8('0xc')]['googleCloudTTS']=function(_0x287b97,_0x3abba6){scripts[_0x7ae8('0x50')](_0x287b97[_0x7ae8('0x51')],_0x287b97['google_cloud_tts_text_type']||_0x7ae8('0x52'),_0x287b97[_0x7ae8('0x52')],_0x287b97[_0x7ae8('0x53')]||_0x7ae8('0x54'),_0x287b97[_0x7ae8('0x55')]||_0x7ae8('0x56'),_0x287b97['audioEncoding']||_0x7ae8('0x57'))[_0x7ae8('0xe')](function(_0x59fbd3){_0x3abba6(null,_0x59fbd3);})[_0x7ae8('0x10')](function(_0x47ab02){_0x3abba6(_0x47ab02);});};AGIVertices['prototype']['googleTTS']=function(_0x192f63,_0x477987){scripts[_0x7ae8('0x58')](_0x192f63[_0x7ae8('0x52')],_0x192f63[_0x7ae8('0x59')]||'en',0x1)['then'](function(_0x5d6189){_0x477987(null,_0x5d6189);})['catch'](function(_0x3b1a9e){_0x477987(_0x3b1a9e);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x5a')]=function(_0x165d9a,_0x14d22c){var _0x193a5d={'uri':_0x165d9a['url'],'method':_0x165d9a[_0x7ae8('0x5b')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x165d9a[_0x7ae8('0x5c')])==='number'&&parseInt(_0x165d9a['timeout'])>=0x1?parseInt(_0x165d9a[_0x7ae8('0x5c')])*0x3e8:0x5*0x3e8};if(_[_0x7ae8('0x5d')]([_0x7ae8('0x5e'),_0x7ae8('0x5f')],_0x193a5d[_0x7ae8('0x5b')]['toUpperCase']())){try{_0x193a5d['body']=_0x165d9a[_0x7ae8('0x7')]?JSON[_0x7ae8('0x60')](_0x165d9a[_0x7ae8('0x7')]):{};}catch(_0x1cca53){logger['error'](_0x7ae8('0x61'),_0x1cca53);}}try{_0x193a5d['headers']=_0x165d9a[_0x7ae8('0x62')]?JSON[_0x7ae8('0x60')](_0x165d9a[_0x7ae8('0x62')]):{};}catch(_0x38d0f4){logger['error'](_0x7ae8('0x63'),_0x38d0f4);}if(_0x165d9a['computedVariables']){try{var _0xaab303=require(_0x165d9a[_0x7ae8('0x64')])['sync'](this,_0x193a5d);_0x193a5d[_0x7ae8('0x65')]=Mustache[_0x7ae8('0x66')](_0x165d9a[_0x7ae8('0x67')],_0xaab303,{},['$$','$$']);if(_0x193a5d['headers']){_0x193a5d[_0x7ae8('0x68')]=JSON[_0x7ae8('0x60')](Mustache[_0x7ae8('0x66')](JSON['stringify'](_0x193a5d[_0x7ae8('0x68')]),_0xaab303,{},['$$','$$']));}if(_0x193a5d[_0x7ae8('0x69')]){_0x193a5d[_0x7ae8('0x69')]=JSON['parse'](Mustache[_0x7ae8('0x66')](JSON['stringify'](_0x193a5d[_0x7ae8('0x69')]),_0xaab303,{},['$$','$$']));}}catch(_0x35c1b1){logger[_0x7ae8('0x24')](_0x7ae8('0x6a'),_0x35c1b1);}}rp(_0x193a5d)[_0x7ae8('0xe')](function(_0x5d18e9){var _0x402af4={'statusCode':_0x5d18e9[_0x7ae8('0x6b')]||0xc8,'statusMessage':_0x5d18e9[_0x7ae8('0x6c')]||'OK','headers':_0x5d18e9[_0x7ae8('0x68')]||{},'body':_0x5d18e9[_0x7ae8('0x69')]||{}};_0x14d22c(null,_0x402af4);})[_0x7ae8('0x10')](function(_0x4b7672){var _0x4c57e6={'statusCode':_0x4b7672[_0x7ae8('0x6b')]||0x1f4,'statusMessage':_0x4b7672[_0x7ae8('0x6d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4b7672['options'][_0x7ae8('0x68')]||{},'body':_0x4b7672[_0x7ae8('0x6e')][_0x7ae8('0x69')]||{}};_0x14d22c(null,_0x4c57e6);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x6f')]=function(_0x1926df,_0x2f81a3){scripts[_0x7ae8('0x6f')](this['channel'][_0x7ae8('0x2d')],_0x1926df[_0x7ae8('0x70')],_0x1926df[_0x7ae8('0x52')],_0x1926df[_0x7ae8('0x71')]||'en')[_0x7ae8('0xe')](function(_0xbb0375){_0x2f81a3(null,_0xbb0375);})[_0x7ae8('0x10')](function(_0x21618b){_0x2f81a3(_0x21618b);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x72')]=function(_0x54d270,_0x326ab7){scripts[_0x7ae8('0x72')](this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],_0x54d270[_0x7ae8('0x73')],_0x54d270['client_email'],_0x54d270[_0x7ae8('0x74')],_0x54d270[_0x7ae8('0x52')],_0x54d270['dialogflowV2_language']||'en')[_0x7ae8('0xe')](function(_0x53f786){_0x326ab7(null,_0x53f786);})[_0x7ae8('0x10')](function(_0x37a420){_0x326ab7(_0x37a420);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x75')]=function(_0x210208,_0x5606e4){scripts['sestekNDA'](this[_0x7ae8('0x2c')],_0x210208)[_0x7ae8('0xe')](function(_0x29d7c7){_0x5606e4(null,_0x29d7c7);})[_0x7ae8('0x10')](function(_0x3fab25){_0x5606e4(_0x3fab25);});};AGIVertices['prototype'][_0x7ae8('0x76')]=function(_0x245981,_0x4e4bea){scripts[_0x7ae8('0x76')](_0x245981['key'],_0x245981[_0x7ae8('0x52')],_0x245981[_0x7ae8('0x77')]||'en-US',_0x245981[_0x7ae8('0x78')])[_0x7ae8('0xe')](function(_0x29c624){_0x4e4bea(null,_0x29c624);})[_0x7ae8('0x10')](function(_0x12623e){_0x4e4bea(_0x12623e);});};AGIVertices[_0x7ae8('0xc')]['ispeechASR']=function(_0x5bdc8f,_0x8bab09,_0x180f5f){scripts[_0x7ae8('0x79')](_0x8bab09,_0x5bdc8f[_0x7ae8('0x70')],_0x5bdc8f['ispeech_asr_language']||'en-US',this[_0x7ae8('0x7a')](_0x5bdc8f['model'])?_0x5bdc8f[_0x7ae8('0x7b')]:undefined)['then'](function(_0x4512e8){_0x180f5f(null,_0x4512e8);})[_0x7ae8('0x10')](function(_0x17d63b){_0x180f5f(_0x17d63b);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x7c')]=function(_0x246cf7,_0x3bb8ec){scripts[_0x7ae8('0x7c')](_0x246cf7['aws_access_key_id'],_0x246cf7[_0x7ae8('0x7d')],_0x246cf7['aws_polly_region'],_0x246cf7[_0x7ae8('0x7e')]||_0x7ae8('0x7f'),_0x246cf7['text'],_0x246cf7[_0x7ae8('0x80')]||_0x7ae8('0x52'))[_0x7ae8('0xe')](function(_0xc49a1e){_0x3bb8ec(null,_0xc49a1e);})[_0x7ae8('0x10')](function(_0x1ff159){_0x3bb8ec(_0x1ff159);});};AGIVertices['prototype'][_0x7ae8('0x81')]=function(_0x55e8f3,_0x256d30){scripts[_0x7ae8('0x81')](this[_0x7ae8('0x2c')][_0x7ae8('0x2d')],_0x55e8f3[_0x7ae8('0x82')],_0x55e8f3[_0x7ae8('0x7d')],_0x55e8f3[_0x7ae8('0x83')],_0x55e8f3[_0x7ae8('0x52')],_0x55e8f3[_0x7ae8('0x84')])['then'](function(_0x809057){_0x256d30(null,_0x809057);})[_0x7ae8('0x10')](function(_0x154325){_0x256d30(_0x154325);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x85')]=function(_0x72e2c3,_0x1e8b7a,_0x46e979){scripts['googleASR'](_0x1e8b7a,_0x72e2c3[_0x7ae8('0x70')],_0x72e2c3['google_asr_language']||_0x7ae8('0x54'))['then'](function(_0x37b712){_0x46e979(null,_0x37b712);})[_0x7ae8('0x10')](function(_0x1e561c){_0x46e979(_0x1e561c);});};AGIVertices['prototype'][_0x7ae8('0x86')]=function(_0xc668c1,_0x53e628,_0x15bf75){scripts[_0x7ae8('0x86')](_0x53e628,_0xc668c1[_0x7ae8('0x87')],_0xc668c1[_0x7ae8('0x88')],_0xc668c1[_0x7ae8('0x65')])[_0x7ae8('0xe')](function(_0x210be5){_0x15bf75(null,_0x210be5);})[_0x7ae8('0x10')](function(_0x2a6224){_0x15bf75(_0x2a6224);});};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x89')]=function(_0x29623a){var _0x438df1=_[_0x7ae8('0x5d')](verticesWithRetry,_0x29623a[_0x7ae8('0x2f')])?_0x29623a:_[_0x7ae8('0x8a')](_0x29623a);for(var _0x5bf395 in _0x438df1){if(_0x438df1[_0x7ae8('0x8b')](_0x5bf395)){if(_0x438df1[_0x5bf395]&&_[_0x7ae8('0x8c')](_0x438df1[_0x5bf395])){if(_[_0x7ae8('0x5d')](recursiveMapAttributes,_0x5bf395)){_0x438df1[_0x5bf395]=this[_0x7ae8('0x8d')](_0x438df1[_0x5bf395]);}else{_0x438df1[_0x5bf395]=this[_0x7ae8('0x8e')](_0x438df1[_0x5bf395]);}}}}return _0x438df1;};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x8f')]=function(_0x4d5064){for(var _0x5c116b in _0x4d5064){if(_0x4d5064[_0x7ae8('0x8b')](_0x5c116b)){if(_[_0x7ae8('0x90')](_0x4d5064[_0x5c116b])){this[_0x7ae8('0x8f')](_0x4d5064[_0x5c116b]);}else if(_[_0x7ae8('0x91')](_0x4d5064[_0x5c116b])){for(var _0xcc1fec=0x0;_0xcc1fec<_0x4d5064[_0x5c116b]['length'];_0xcc1fec++){this['recursiveNodeIndex'](_0x4d5064[_0x5c116b][_0xcc1fec]);}}else if(_[_0x7ae8('0x8c')](_0x4d5064[_0x5c116b])){_0x4d5064[_0x5c116b]=this['replaceAllVariables'](_0x4d5064[_0x5c116b]);}}}};AGIVertices[_0x7ae8('0xc')]['saveRestApiResult']=function(_0x51e76a,_0x480545){for(var _0x3a0dc0 in _0x51e76a){if(_0x51e76a[_0x7ae8('0x8b')](_0x3a0dc0)){if(_['isPlainObject'](_0x51e76a[_0x3a0dc0])){if(!_[_0x7ae8('0x39')](_0x51e76a[_0x3a0dc0])){this[_0x7ae8('0x92')](_0x51e76a[_0x3a0dc0],util['format'](_0x7ae8('0x93'),_0x480545,_0x3a0dc0));}}else if(_[_0x7ae8('0x91')](_0x51e76a[_0x3a0dc0])){for(var _0x3d97d8=0x0;_0x3d97d8<_0x51e76a[_0x3a0dc0][_0x7ae8('0x94')];_0x3d97d8++){this[_0x7ae8('0x92')](_0x51e76a[_0x3a0dc0][_0x3d97d8],util['format']('%s.%s',_0x480545,_0x3a0dc0+'['+_0x3d97d8+']'));}}else{if(!_['isNil'](_0x51e76a[_0x3a0dc0])){this['channel'][_0x7ae8('0x95')](util['format'](_0x7ae8('0x93'),_0x480545,_0x3a0dc0),_0x51e76a[_0x3a0dc0]);}}}}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x8d')]=function(_0x53f81e){try{var _0x4c61b7=JSON['parse'](_0x53f81e);this[_0x7ae8('0x8f')](_0x4c61b7);return JSON[_0x7ae8('0x96')](_0x4c61b7);}catch(_0x4ad3b8){return this[_0x7ae8('0x8e')](_0x53f81e);}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x8e')]=function(_0x3cabed){var _0x4b935b=_0x3cabed['split']('{');for(var _0x2f988b=0x1;_0x2f988b<_0x4b935b[_0x7ae8('0x94')];_0x2f988b+=0x1){var _0x472c85=_0x4b935b[_0x2f988b][_0x7ae8('0x97')]('}');if(_0x472c85[_0x7ae8('0x94')]>0x1){_0x3cabed=_0x3cabed[_0x7ae8('0x98')]('{'+_0x472c85[0x0]+'}',this['channel'][_0x7ae8('0x99')](_0x472c85[0x0])[_0x7ae8('0x9a')]||_0x472c85[0x0]);}}if(_0x4b935b['length']===0x1){return _0x3cabed['toString']();}return this[_0x7ae8('0x8e')](_0x3cabed);};AGIVertices['prototype'][_0x7ae8('0x9b')]=function(_0xfa1db7,_0x3f55eb){var _0x533407=this[_0x7ae8('0x2c')]['getVariable'](_0xfa1db7);if(_0x533407[_0x7ae8('0x9c')]===-0x1){return _0x533407;}logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x9d'),_0x3f55eb,_0x533407[_0x7ae8('0x9a')]));return this[_0x7ae8('0x2c')][_0x7ae8('0x95')](_0x3f55eb,_0x533407['extra']);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x7a')]=function(_0x3819b2){return _0x3819b2&&_0x3819b2!=='0'&&_0x3819b2!=='-1'&&_0x3819b2!=='';};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x9e')]=function(_0x1378a0){this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x1378a0,'-');_0x1378a0[_0x7ae8('0xa0')]=_0x1378a0[_0x7ae8('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xa1')]=function(_0x24e8a0){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xa2'),_0x24e8a0[_0x7ae8('0x2e')]));if(!this['isConfigured'](_0x24e8a0['text'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}var _0x522e61='\x22'+_0x24e8a0['text']+'\x22';if(this[_0x7ae8('0x7a')](_0x24e8a0['options'])){_0x522e61+=','+_0x24e8a0['options'];}var _0x1f0d39=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0xa5'),_0x522e61);if(_0x1f0d39['result']===-0x1){return _0x1f0d39;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0xa6'),_0x522e61));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xa7')]=function(_0x11c47e){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xa8'),_0x11c47e['label']));if(!this[_0x7ae8('0x7a')](_0x11c47e[_0x7ae8('0xa9')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xaa'));}var _0x3ffd1a=_0x11c47e[_0x7ae8('0xa9')];if(this[_0x7ae8('0x7a')](_0x11c47e[_0x7ae8('0x6e')])){_0x3ffd1a+=','+_0x11c47e['options'];}var _0x5a2f4f=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0xab'),_0x3ffd1a);if(_0x5a2f4f[_0x7ae8('0x9c')]===-0x1){return _0x5a2f4f;}var _0x103313=this[_0x7ae8('0x9b')](_0x7ae8('0xac'),_0x7ae8('0xad'));if(_0x103313[_0x7ae8('0x9c')]===-0x1){return _0x103313;}var _0x456a51=this[_0x7ae8('0x9b')]('RECOG_INPUT()',_0x7ae8('0xae'));if(_0x456a51['result']===-0x1){return _0x456a51;}var _0x594a7a=this[_0x7ae8('0x9b')](_0x7ae8('0xaf'),_0x7ae8('0xb0'));if(_0x594a7a[_0x7ae8('0x9c')]===-0x1){return _0x594a7a;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0xb1'),_0x3ffd1a));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xb2')]=function(_0x1fd833){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xb3'),_0x1fd833[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')][_0x7ae8('0xb2')]([_0x1fd833['command'],_0x1fd833[_0x7ae8('0xb4')]]);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xb5')]=function(_0x356026){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0xb6'),_0x356026[_0x7ae8('0x2e')]));if(this[_0x7ae8('0x7a')](_0x356026[_0x7ae8('0x5c')])){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xb7'),_0x356026[_0x7ae8('0x5c')]));var _0x9cb6d2=this[_0x7ae8('0x2c')][_0x7ae8('0xb8')](_0x356026[_0x7ae8('0x5c')]);if(_0x9cb6d2[_0x7ae8('0x9c')]===-0x1){return _0x9cb6d2;}}return this['channel'][_0x7ae8('0xb5')]();};AGIVertices['prototype'][_0x7ae8('0x3e')]=function(_0x1e6a5f){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xb9'),_0x1e6a5f['label']));if(!this[_0x7ae8('0x7a')](_0x1e6a5f['list_id'])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x1e6a5f,'no\x20list\x20selected');}_0x1e6a5f[_0x7ae8('0x40')]=moment();if(this[_0x7ae8('0x7a')](_0x1e6a5f['delay'])){_0x1e6a5f[_0x7ae8('0x40')]=moment()[_0x7ae8('0xba')](_0x1e6a5f[_0x7ae8('0xbb')],_0x7ae8('0xbc'));}if(!this[_0x7ae8('0x7a')](_0x1e6a5f['callback_priority'])){_0x1e6a5f[_0x7ae8('0x42')]=0x2;}this[_0x7ae8('0x38')][_0x7ae8('0x9f')](this,_0x1e6a5f);return this['channel']['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xbd'),_0x1e6a5f[_0x7ae8('0x3d')],_0x1e6a5f[_0x7ae8('0xbe')],_0x1e6a5f['scheduledAt']));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xbf')]=function(_0x34550d){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xc0'),_0x34550d['label']));var _0x2890e2=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x34550d[_0x7ae8('0xc1')],_0x34550d[_0x7ae8('0x6e')]);if(_0x2890e2[_0x7ae8('0x9c')]===-0x1){return _0x2890e2;}return this['channel']['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xc2'),_0x34550d[_0x7ae8('0xc1')],_0x34550d[_0x7ae8('0x6e')]));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xc3')]=function(_0x105d44){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xc4'),_0x105d44[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x105d44[_0x7ae8('0x52')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}var _0x53881c='\x22'+_0x105d44['text']+'\x22';if(this['isConfigured'](_0x105d44['options'])){_0x53881c+=','+_0x105d44[_0x7ae8('0x6e')];}var _0x913f7=this[_0x7ae8('0x2c')]['exec'](_0x7ae8('0xa5'),_0x53881c);if(_0x913f7['result']===-0x1){return _0x913f7;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xa6'),_0x53881c));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xc5')]=function(_0x401eb4){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x401eb4[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x401eb4['text'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}var _0xcbeab8='\x22'+_0x401eb4[_0x7ae8('0x52')]+'\x22';if(this[_0x7ae8('0x7a')](_0x401eb4[_0x7ae8('0x6e')])){_0xcbeab8+=','+_0x401eb4['options'];}var _0x14751a=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0xa5'),_0xcbeab8);if(_0x14751a['result']===-0x1){return _0x14751a;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xa6'),_0xcbeab8));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xc6')]=function(_0x193f29){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xc7'),_0x193f29[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x193f29['grammar'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xaa'));}var _0xd5c525=_0x193f29[_0x7ae8('0xa9')];if(this['isConfigured'](_0x193f29['options'])){_0xd5c525+=','+_0x193f29['options'];}var _0x1728ef=this[_0x7ae8('0x2c')]['exec']('MRCPRecog',_0xd5c525);if(_0x1728ef[_0x7ae8('0x9c')]===-0x1){return _0x1728ef;}var _0x2dc38f=this[_0x7ae8('0x9b')](_0x7ae8('0xac'),_0x7ae8('0xc8'));if(_0x2dc38f[_0x7ae8('0x9c')]===-0x1){return _0x2dc38f;}var _0x46e414=this[_0x7ae8('0x9b')](_0x7ae8('0xc9'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x46e414['result']===-0x1){return _0x46e414;}var _0x175380=this[_0x7ae8('0x9b')](_0x7ae8('0xaf'),_0x7ae8('0xca'));if(_0x175380['result']===-0x1){return _0x175380;}return this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xb1'),_0xd5c525));};AGIVertices[_0x7ae8('0xc')]['sestekasr']=function(_0x469977){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0xcb'),_0x469977[_0x7ae8('0x2e')]));if(!this['isConfigured'](_0x469977['grammar'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xaa'));}var _0x501cb3=_0x469977[_0x7ae8('0xa9')];if(this[_0x7ae8('0x7a')](_0x469977[_0x7ae8('0x6e')])){_0x501cb3+=','+_0x469977[_0x7ae8('0x6e')];}var _0x32730a=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0xab'),_0x501cb3);if(_0x32730a[_0x7ae8('0x9c')]===-0x1){return _0x32730a;}var _0x2f4e57=this[_0x7ae8('0x9b')](_0x7ae8('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x2f4e57[_0x7ae8('0x9c')]===-0x1){return _0x2f4e57;}var _0x1e85a5=this[_0x7ae8('0x9b')](_0x7ae8('0xc9'),_0x7ae8('0xcc'));if(_0x1e85a5['result']===-0x1){return _0x1e85a5;}var _0x42d0d8=this[_0x7ae8('0x9b')](_0x7ae8('0xaf'),_0x7ae8('0xcd'));if(_0x42d0d8['result']===-0x1){return _0x42d0d8;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('Executed\x20command\x20MRCPRecog\x20%s',_0x501cb3));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xce')]=function(_0x3e3651){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xcf'),_0x3e3651[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x3e3651['odbc_id'])){return this[_0x7ae8('0x2c')]['error'](_0x3e3651,'no\x20database\x20selected');}var _0x3fbb38=this[_0x7ae8('0x14')]['sync'](this,_0x3e3651[_0x7ae8('0xd0')]);if(!_0x3fbb38){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x3e3651,'no\x20odbc\x20database\x20found');}if(!this[_0x7ae8('0x7a')](_0x3e3651['query'])){return this[_0x7ae8('0x2c')]['error'](_0x3e3651,_0x7ae8('0xd1'));}var _0x48b225=_0x3e3651[_0x7ae8('0xd2')][_0x7ae8('0x4f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xd3'),_0x48b225));var _0x5aae1e=this['getQueryOdbc'][_0x7ae8('0x9f')](this,_0x3fbb38,_0x48b225);this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x3e3651,_0x48b225);if(!this[_0x7ae8('0x7a')](_0x3e3651['variable_id'])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xd4'));}var _0x55b077=this[_0x7ae8('0x99')][_0x7ae8('0x9f')](this,_0x3e3651[_0x7ae8('0xd5')]);if(!_0x55b077){return this[_0x7ae8('0x2c')]['error'](_0x3e3651,_0x7ae8('0xd6'));}var _0x9a87b9=this;_0x5aae1e[_0x7ae8('0xd7')](function(_0x163812,_0x5a2cde){Object[_0x7ae8('0xd8')](_0x163812)[_0x7ae8('0xd7')](function(_0x525856){_0x9a87b9[_0x7ae8('0x2c')][_0x7ae8('0x95')](util[_0x7ae8('0x21')](_0x7ae8('0xd9'),_0x55b077,_0x5a2cde,_0x525856),_0x163812[_0x525856]);});});this['channel'][_0x7ae8('0x95')](util[_0x7ae8('0x21')]('%s_ROWS_COUNT',_0x55b077),_0x5aae1e[_0x7ae8('0x94')]);return this[_0x7ae8('0x2c')]['noop'](util['format'](_0x7ae8('0xda'),_0x55b077));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xdb')]=function(_0x261c05){logger[_0x7ae8('0xdc')](util['format'](_0x7ae8('0xdd'),_0x261c05[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x261c05[_0x7ae8('0xde')])){return this[_0x7ae8('0x2c')]['error'](_0x261c05,_0x7ae8('0xdf'));}var _0x714684=this[_0x7ae8('0x17')][_0x7ae8('0x9f')](this,_0x261c05[_0x7ae8('0xde')]);if(!_0x714684){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x261c05,_0x7ae8('0xe0'));}var _0x464dcb=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0xe1'),[util[_0x7ae8('0x21')]('SIP/%s',_0x714684),_0x261c05[_0x7ae8('0x5c')],_0x261c05['opts'],_0x261c05[_0x7ae8('0x67')]]);if(_0x464dcb['result']===-0x1){return _0x464dcb;}return this['channel']['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xe2'),'DIAL'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xe3')]=function(_0x51cc35){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xe4'),_0x51cc35[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x51cc35['key'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xe5'));}if(!this[_0x7ae8('0x7a')](_0x51cc35[_0x7ae8('0x52')])){return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}this['channel'][_0x7ae8('0xe6')]=!![];this[_0x7ae8('0x2b')](_0x51cc35);this['createSquareMessage'](_0x51cc35[_0x7ae8('0x52')],'in','','');this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xe7'),_0x51cc35['text']));var _0x10160b=this[_0x7ae8('0x6f')][_0x7ae8('0x9f')](this,_0x51cc35);if(_0x10160b){for(var _0x4fe4cb in _0x10160b){if(_0x10160b[_0x7ae8('0x8b')](_0x4fe4cb)){this[_0x7ae8('0x2c')]['setVariable'](util[_0x7ae8('0x21')](_0x7ae8('0xe8'),_0x4fe4cb[_0x7ae8('0xe9')]()),_0x10160b[_0x4fe4cb]);}}this[_0x7ae8('0x37')](_0x10160b[_0x7ae8('0xea')],_0x7ae8('0xeb'),'dialogflow','');return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xec'),_0x10160b[_0x7ae8('0xea')]));}return this[_0x7ae8('0x2c')]['error'](_0x51cc35,_0x7ae8('0xed'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0xee')]=function(_0x233404){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0xef'),_0x233404[_0x7ae8('0x2e')]));if(!this['isConfigured'](_0x233404[_0x7ae8('0x73')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xf0'));}if(!this[_0x7ae8('0x7a')](_0x233404[_0x7ae8('0xf1')])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xf2'));}if(!this[_0x7ae8('0x7a')](_0x233404['private_key'])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xf3'));}if(!this[_0x7ae8('0x7a')](_0x233404['dialogflowV2_language'])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xf4'));}if(!this[_0x7ae8('0x7a')](_0x233404[_0x7ae8('0x52')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}this[_0x7ae8('0x2c')][_0x7ae8('0xe6')]=!![];this[_0x7ae8('0x2b')](_0x233404);this[_0x7ae8('0x37')](_0x233404[_0x7ae8('0x52')],'in','','');this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0xf5'),_0x233404[_0x7ae8('0x52')]));var _0x4202a8=this[_0x7ae8('0x72')][_0x7ae8('0x9f')](this,_0x233404);if(_0x4202a8){for(var _0x4edc6b in _0x4202a8){if(_0x4202a8[_0x7ae8('0x8b')](_0x4edc6b)){if(_0x4edc6b!=='providerResponse'){this[_0x7ae8('0x2c')][_0x7ae8('0x95')](util[_0x7ae8('0x21')]('DIALOGFLOW_%s',_0x4edc6b[_0x7ae8('0xe9')]()),_0x4202a8[_0x4edc6b]);}}}this[_0x7ae8('0x37')](_0x4202a8[_0x7ae8('0xea')],_0x7ae8('0xeb'),_0x7ae8('0xee'),_0x4202a8[_0x7ae8('0xf6')]);return this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xf7'),_0x4202a8['speech']));}return this['channel'][_0x7ae8('0x24')](_0x233404,_0x7ae8('0xf8'));};AGIVertices['prototype'][_0x7ae8('0xf9')]=function(_0x171401){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x171401['label']));if(!this['isConfigured'](_0x171401[_0x7ae8('0xfa')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xfb'));}if(!this[_0x7ae8('0x7a')](_0x171401['username'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xfc'));}if(!this[_0x7ae8('0x7a')](_0x171401['password'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xfd'));}if(!this[_0x7ae8('0x7a')](_0x171401[_0x7ae8('0xfe')])){return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}this['channel']['bot']=!![];this[_0x7ae8('0x2b')](_0x171401);this[_0x7ae8('0x37')](_0x171401[_0x7ae8('0x52')],'in','','');this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xff'),_0x171401['text']));var _0x592967=this[_0x7ae8('0x75')]['sync'](this,_0x171401);if(_0x592967){for(var _0x361f7a in _0x592967){if(_0x592967[_0x7ae8('0x8b')](_0x361f7a)){this['channel'][_0x7ae8('0x95')](util['format'](_0x7ae8('0x100'),_0x361f7a[_0x7ae8('0xe9')]()),_0x592967[_0x361f7a]);}}this['createSquareMessage'](_0x592967[_0x7ae8('0xea')],'out',_0x7ae8('0xf9'),'');if(_0x592967[_0x7ae8('0x101')]){this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x102'),_0x592967[_0x7ae8('0x101')]));var _0xed9c5c=this[_0x7ae8('0x2c')][_0x7ae8('0x103')](_0x592967[_0x7ae8('0x101')]);try{fs[_0x7ae8('0x104')](_0x592967[_0x7ae8('0x101')]+_0x7ae8('0x105'));}catch(_0x4a9906){logger[_0x7ae8('0x24')](_0x4a9906);}return _0xed9c5c;}else{return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x106'),_0x592967[_0x7ae8('0xea')]));}}return this['channel'][_0x7ae8('0x24')](_0x171401,_0x7ae8('0x107'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x108')]=function(_0x2f8bdd){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x109'),_0x2f8bdd[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')]('end');};AGIVertices[_0x7ae8('0xc')]['ext_dial']=function(_0x411ffc){logger['info'](util['format'](_0x7ae8('0x10a'),_0x411ffc['label']));var _0x58506f='';if(_0x411ffc[_0x7ae8('0x10b')]){if(!this[_0x7ae8('0x7a')](_0x411ffc[_0x7ae8('0x10b')])){return this[_0x7ae8('0x2c')]['error'](_0x411ffc,_0x7ae8('0x10c'));}else{var _0x57b96d=parseInt(_0x411ffc[_0x7ae8('0x10b')],0xa);if(isNaN(_0x57b96d)){_0x58506f=_0x411ffc[_0x7ae8('0x10b')];}else{_0x58506f=this[_0x7ae8('0x19')][_0x7ae8('0x9f')](this,_0x411ffc[_0x7ae8('0x10b')]);if(!_0x58506f){return this['channel']['error'](_0x411ffc,'no\x20trunk\x20found');}}}}else if(_0x411ffc['trunk_name']){_0x58506f=_0x411ffc[_0x7ae8('0x10d')];}else{return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x411ffc,_0x7ae8('0x10c'));}var _0x414eab=this[_0x7ae8('0x2c')]['exec'](_0x7ae8('0xe1'),[util[_0x7ae8('0x21')]('SIP/%s/%s',_0x58506f,_0x411ffc[_0x7ae8('0x3d')]),_0x411ffc['timeout'],_0x411ffc[_0x7ae8('0x10e')],_0x411ffc[_0x7ae8('0x67')]]);if(_0x414eab[_0x7ae8('0x9c')]===-0x1){return _0x414eab;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0xe2'),_0x7ae8('0xe1')));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x10f')]=function(_0x40a2c0){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x110'),_0x40a2c0[_0x7ae8('0x2e')]));return this['channel'][_0x7ae8('0xa3')]('finally');};AGIVertices[_0x7ae8('0xc')]['getdigits']=function(_0x29b3f2){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x29b3f2[_0x7ae8('0x2e')]));if(_0x29b3f2[_0x7ae8('0xa0')]===0x0){return this['maxRetry'](_0x29b3f2);}_0x29b3f2[_0x7ae8('0xa0')]-=0x1;if(!this['isConfigured'](_0x29b3f2[_0x7ae8('0x111')])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x29b3f2,_0x7ae8('0x112'));}var _0x54a59f=this[_0x7ae8('0x113')][_0x7ae8('0x9f')](this,_0x29b3f2[_0x7ae8('0x111')]);if(!_0x54a59f){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x29b3f2,_0x7ae8('0x114'));}if(!this[_0x7ae8('0x7a')](_0x29b3f2[_0x7ae8('0xd5')])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x7ae8('0xd4'));}var _0x179f9e=this[_0x7ae8('0x2c')][_0x7ae8('0x115')](_0x54a59f,_0x29b3f2[_0x7ae8('0x116')],_0x29b3f2[_0x7ae8('0x117')]);var _0x263017=_0x179f9e[_0x7ae8('0x9c')]?_0x179f9e[_0x7ae8('0x9c')][_0x7ae8('0x41')]():'';logger['info']('test',JSON['stringify'](_0x179f9e));if(_0x179f9e[_0x7ae8('0x9c')]===-0x1){this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x29b3f2,_0x263017);return _0x179f9e;}else if(_0x179f9e[_0x7ae8('0x9a')]===_0x7ae8('0x5c')){_0x179f9e[_0x7ae8('0x9c')]=_0x263017[_0x7ae8('0x94')]>=parseInt(_0x29b3f2['mindigit'])?'x':'i';}else{_0x179f9e[_0x7ae8('0x9c')]=_0x263017[_0x7ae8('0x94')]>=parseInt(_0x29b3f2['mindigit'])&&_0x263017[_0x7ae8('0x94')]<=parseInt(_0x29b3f2[_0x7ae8('0x117')])?'x':'i';}var _0x2d1a48=this[_0x7ae8('0x99')]['sync'](this,_0x29b3f2[_0x7ae8('0xd5')]);if(!_0x2d1a48){return this[_0x7ae8('0x2c')]['error'](_0x29b3f2,_0x7ae8('0xd6'));}this[_0x7ae8('0x2c')][_0x7ae8('0x95')](_0x2d1a48,_0x263017);if(this[_0x7ae8('0x7a')](_0x29b3f2['hiddendigitsnum'])){var _0x2b9a85=parseInt(_0x29b3f2['hiddendigitsnum'],0xa);var _0xbb5971=rs[_0x7ae8('0x118')]({'charset':'*','length':_0x2b9a85});var _0x4697cf=_0x263017[_0x7ae8('0x94')];if(_0x4697cf>0x0){if(_0x4697cf>_0x2b9a85){this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x29b3f2,_0x29b3f2[_0x7ae8('0x119')]===_0x7ae8('0x11a')?_0xbb5971+_0x263017[_0x7ae8('0x11b')](_0x2b9a85):_0x263017[_0x7ae8('0x11b')](0x0,_0x4697cf-_0x2b9a85)+_0xbb5971);}else{this['createSquareDetailsReport']['sync'](this,_0x29b3f2,rs[_0x7ae8('0x118')]({'charset':'*','length':_0x4697cf}));}}else{this['createSquareDetailsReport']['sync'](this,_0x29b3f2,'');}}else{this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x29b3f2,_0x263017);}return _0x179f9e;};AGIVertices['prototype'][_0x7ae8('0xa')]=function(_0x176297){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x11c'),_0x176297['label']));return this[_0x7ae8('0x9')](_0x176297);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x11d')]=function(_0x38f2c7){logger[_0x7ae8('0x25')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x38f2c7[_0x7ae8('0x2e')]));this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x38f2c7,_0x38f2c7['goalname']);return this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x11e'),_0x38f2c7[_0x7ae8('0x11f')]));};AGIVertices[_0x7ae8('0xc')]['awspolly']=function(_0x5c8d1f){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x120'),_0x5c8d1f[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x5c8d1f[_0x7ae8('0x82')])||!this[_0x7ae8('0x7a')](_0x5c8d1f['aws_secret_access_key'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x121'));}if(!this[_0x7ae8('0x7a')](_0x5c8d1f[_0x7ae8('0x52')])){return this['channel'][_0x7ae8('0xa3')]('no\x20text\x20configured');}this[_0x7ae8('0x2c')]['noop'](util['format'](_0x7ae8('0x122'),_0x5c8d1f[_0x7ae8('0x52')]));var _0xbb257d=this[_0x7ae8('0x7c')]['sync'](this,_0x5c8d1f);if(_0xbb257d){this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x123'),_0xbb257d));var _0x134c70=this[_0x7ae8('0x2c')][_0x7ae8('0x103')](_0xbb257d);try{fs[_0x7ae8('0x104')](_0xbb257d+_0x7ae8('0x105'));}catch(_0x41a277){logger[_0x7ae8('0x24')](_0x41a277);}return _0x134c70;}return this[_0x7ae8('0x2c')]['error'](_0x5c8d1f,_0x7ae8('0x124'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x125')]=function(_0x3a050a){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x126'),_0x3a050a[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x3a050a['aws_access_key_id'])||!this[_0x7ae8('0x7a')](_0x3a050a[_0x7ae8('0x7d')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x121'));}if(!this[_0x7ae8('0x7a')](_0x3a050a['aws_bot_name'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')]('no\x20bot\x20name\x20configured');}if(!this[_0x7ae8('0x7a')](_0x3a050a[_0x7ae8('0x52')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xa4'));}this['channel'][_0x7ae8('0xe6')]=!![];this[_0x7ae8('0x2b')](_0x3a050a);this['createSquareMessage'](_0x3a050a['text'],'in','','');this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('Trying\x20Amazon\x20Lex:\x20%s',_0x3a050a[_0x7ae8('0x52')]));var _0x508bac=this['awsLex'][_0x7ae8('0x9f')](this,_0x3a050a);if(_0x508bac){for(var _0x4439e2 in _0x508bac){if(_0x508bac[_0x7ae8('0x8b')](_0x4439e2)&&_[_0x7ae8('0x8c')](_0x508bac[_0x4439e2])){this[_0x7ae8('0x2c')]['setVariable'](util['format'](_0x7ae8('0x127'),_0x4439e2[_0x7ae8('0xe9')]()),_0x508bac[_0x4439e2]);}}if(_[_0x7ae8('0x3a')](_0x508bac[_0x7ae8('0x6d')])){return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0x128'));}else{this['createSquareMessage'](_0x508bac[_0x7ae8('0x6d')],_0x7ae8('0xeb'),'amazonlex','');return this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x129'),_0x508bac[_0x7ae8('0x6d')]));}}return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x3a050a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7ae8('0xc')]['googleasr']=function(_0x5125ac){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5125ac['label'],_0x5125ac[_0x7ae8('0x5c')]));if(!this[_0x7ae8('0x7a')](_0x5125ac[_0x7ae8('0x70')])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xe5'));}var _0xed3e7f=_0x7ae8('0x12a');var _0x7ea84e=util[_0x7ae8('0x21')]('%s/recordings/%s',FILES_PATH,rs[_0x7ae8('0x118')](0x4));var _0x548d4d=util[_0x7ae8('0x21')](_0x7ae8('0x93'),_0x7ea84e,_0xed3e7f);var _0xc79861=!![];if(_0x5125ac[_0x7ae8('0x12b')]==='NOBEEP'){_0xc79861=![];}var _0x2dde13=this[_0x7ae8('0x2c')][_0x7ae8('0x12c')](_0x7ea84e,_0xed3e7f,_0x5125ac[_0x7ae8('0x12d')],_0x5125ac[_0x7ae8('0x5c')],undefined,_0xc79861);if(_0x2dde13['result']!==-0x1){this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0x12e'),_0x548d4d));var _0x12cee3=this[_0x7ae8('0x85')][_0x7ae8('0x9f')](this,_0x5125ac,_0x548d4d);if(_0x12cee3){for(var _0x533ebe in _0x12cee3){if(_0x12cee3['hasOwnProperty'](_0x533ebe)){this[_0x7ae8('0x2c')][_0x7ae8('0x95')](util['format'](_0x7ae8('0x12f'),_0x533ebe[_0x7ae8('0xe9')]()),_0x12cee3[_0x533ebe]);}}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x130'),JSON[_0x7ae8('0x96')](_0x12cee3)));}}return _0x2dde13;};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x131')]=function(_0x41ef63){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x132'),_0x41ef63[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x41ef63[_0x7ae8('0x87')])){return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0x133'));}if(!this['isConfigured'](_0x41ef63[_0x7ae8('0x88')])){return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0x134'));}var _0x4830fa=_0x7ae8('0x12a');var _0x578f2e=util[_0x7ae8('0x21')]('%s/recordings/%s',FILES_PATH,rs[_0x7ae8('0x118')](0x4));var _0x47e34f=util[_0x7ae8('0x21')]('%s.%s',_0x578f2e,_0x4830fa);var _0x420d67=!![];if(_0x41ef63[_0x7ae8('0x12b')]===_0x7ae8('0x135')){_0x420d67=![];}var _0x3ff7d1=this[_0x7ae8('0x2c')][_0x7ae8('0x12c')](_0x578f2e,_0x4830fa,_0x41ef63['intKey'],_0x41ef63['timeout'],undefined,_0x420d67);if(_0x3ff7d1['result']!==-0x1){this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x136'),_0x47e34f));var _0x134814=this[_0x7ae8('0x86')]['sync'](this,_0x41ef63,_0x47e34f);if(_0x134814){for(var _0xd15ed3 in _0x134814){if(_0x134814[_0x7ae8('0x8b')](_0xd15ed3)){this[_0x7ae8('0x2c')][_0x7ae8('0x95')](util[_0x7ae8('0x21')](_0x7ae8('0x137'),_0xd15ed3[_0x7ae8('0xe9')]()),_0x134814[_0xd15ed3]);}}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x138'),JSON[_0x7ae8('0x96')](_0x134814)));}}return _0x3ff7d1;};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x139')]=function(_0x39f414){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x13a'),_0x39f414[_0x7ae8('0x2e')]));return this['channel'][_0x7ae8('0x13b')](_0x39f414[_0x7ae8('0x13c')],_0x39f414['extension'],_0x39f414[_0x7ae8('0x35')]);};AGIVertices[_0x7ae8('0xc')]['gotoif']=function(_0x2a33cd){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a33cd[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x2a33cd[_0x7ae8('0x13d')])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x2a33cd,_0x7ae8('0x13e'));}try{var _0x2e8f0e=eval(_0x2a33cd['condition'])?_0x7ae8('0x13f'):_0x7ae8('0x140');this['channel']['noop'](util[_0x7ae8('0x21')](_0x7ae8('0x141'),_0x2a33cd[_0x7ae8('0x13d')],_0x2e8f0e));return{'code':0xc8,'result':_0x2e8f0e};}catch(_0x97aa01){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x142')]=function(_0x2ac217){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x143'),_0x2ac217[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x2ac217[_0x7ae8('0x144')])){return this['channel'][_0x7ae8('0x24')](_0x2ac217,_0x7ae8('0x145'));}var _0x4cecfb=this[_0x7ae8('0x146')][_0x7ae8('0x9f')](this,_0x2ac217[_0x7ae8('0x144')]);if(!_0x4cecfb){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x2ac217,'no\x20intervals\x20found');}for(var _0x4faeb9=0x0;_0x4faeb9<_0x4cecfb[_0x7ae8('0x94')];_0x4faeb9+=0x1){var _0x3e1513=this[_0x7ae8('0x2c')][_0x7ae8('0x99')](util['format'](_0x7ae8('0x147'),_0x4cecfb[_0x4faeb9]));if(_0x3e1513[_0x7ae8('0x9c')]===-0x1){return _0x3e1513;}logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x148'),_0x4cecfb[_0x4faeb9],_0x3e1513['extra']));if(_0x3e1513[_0x7ae8('0x9a')]===_0x7ae8('0x13f')){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x148'),_0x4cecfb[_0x4faeb9],_0x7ae8('0x13f')));this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x148'),_0x4cecfb[_0x4faeb9],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format'](_0x7ae8('0x148'),_0x4cecfb[_0x4faeb9],_0x7ae8('0x140')));this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0x148'),_0x4cecfb[_0x4faeb9],_0x7ae8('0x140')));}}return{'code':0xc8,'result':_0x7ae8('0x140')};};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x149')]=function(_0x4ec3f4){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x14a'),_0x4ec3f4[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')]['hangup']();};AGIVertices['prototype'][_0x7ae8('0x14b')]=function(_0x362a50){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x14c'),_0x362a50['label']));if(!this[_0x7ae8('0x7a')](_0x362a50[_0x7ae8('0x70')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xe5'));}var _0x3f3a08='wav';var _0x52ea11=util[_0x7ae8('0x21')](_0x7ae8('0x14d'),FILES_PATH,rs[_0x7ae8('0x118')](0x4));var _0x74b752=util['format'](_0x7ae8('0x93'),_0x52ea11,_0x3f3a08);var _0x43e28b=!![];if(_0x362a50[_0x7ae8('0x12b')]===_0x7ae8('0x135')){_0x43e28b=![];}var _0x52b611=this['channel'][_0x7ae8('0x12c')](_0x52ea11,_0x3f3a08,_0x362a50['intKey'],_0x362a50[_0x7ae8('0x5c')],undefined,_0x43e28b);if(_0x52b611[_0x7ae8('0x9c')]!==-0x1){this['channel']['noop'](util[_0x7ae8('0x21')](_0x7ae8('0x14e'),_0x74b752));var _0x69e393=this[_0x7ae8('0x79')]['sync'](this,_0x362a50,_0x74b752);if(_0x69e393){for(var _0x23cf9a in _0x69e393){if(_0x69e393['hasOwnProperty'](_0x23cf9a)){this[_0x7ae8('0x2c')][_0x7ae8('0x95')](util[_0x7ae8('0x21')](_0x7ae8('0x14f'),_0x23cf9a[_0x7ae8('0xe9')]()),_0x69e393[_0x23cf9a]);}}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('IspeechASR\x20Result\x20%s',JSON[_0x7ae8('0x96')](_0x69e393)));}}return _0x52b611;};AGIVertices['prototype'][_0x7ae8('0x150')]=function(_0x22912e){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x151'),_0x22912e['label']));if(!this['isConfigured'](_0x22912e['key'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xe5'));}if(!this[_0x7ae8('0x7a')](_0x22912e[_0x7ae8('0x52')])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xa4'));}this['channel'][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x152'),_0x22912e[_0x7ae8('0x52')]));var _0x853912=this['ispeechTTS'][_0x7ae8('0x9f')](this,_0x22912e);if(_0x853912){this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x14e'),_0x853912));var _0x23e5ce=this['channel'][_0x7ae8('0x103')](_0x853912,_0x22912e[_0x7ae8('0x12d')]);try{fs['unlink'](_0x853912+_0x7ae8('0x105'));}catch(_0x51caf8){logger[_0x7ae8('0x24')](_0x51caf8);}return _0x23e5ce;}return this[_0x7ae8('0x2c')]['error'](_0x22912e,_0x7ae8('0x153'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x154')]=function(_0x2a94cd){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x155'),_0x2a94cd[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x2a94cd[_0x7ae8('0x156')])){return this['channel'][_0x7ae8('0x24')](_0x2a94cd,_0x7ae8('0x157'));}logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x158'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x2a94cd[_0x7ae8('0x156')]));var _0x1173ee=this[_0x7ae8('0x49')][_0x7ae8('0x9f')](this,_0x2a94cd['findBy']);if(_0x1173ee){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x2a94cd[_0x7ae8('0x156')]));this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x159'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x2a94cd['findBy']));return{'code':0xc8,'result':_0x7ae8('0x15a')};}else{logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x15b'),this['channel'][_0x7ae8('0x31')],_0x2a94cd[_0x7ae8('0x156')]));this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')]['callerid'],_0x2a94cd[_0x7ae8('0x156')]));return{'code':0xc8,'result':_0x7ae8('0x15c')};}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x15d')]=function(_0x431e79){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x15e'),_0x431e79[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x431e79[_0x7ae8('0x156')])){return this['channel'][_0x7ae8('0x24')](_0x431e79,_0x7ae8('0x157'));}logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x158'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x431e79[_0x7ae8('0x156')]));var _0x32868b=this['agentLogout'][_0x7ae8('0x9f')](this,_0x431e79[_0x7ae8('0x156')]);if(_0x32868b){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x431e79[_0x7ae8('0x156')]));this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x431e79[_0x7ae8('0x156')]));return{'code':0xc8,'result':_0x7ae8('0x15a')};}else{logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x431e79[_0x7ae8('0x156')]));this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x431e79[_0x7ae8('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x15f')]=function(_0x2f6928){logger['info'](util['format'](_0x7ae8('0x160'),_0x2f6928['label']));if(!this['isConfigured'](_0x2f6928['operation'])){return this[_0x7ae8('0x2c')]['error'](_0x2f6928,_0x7ae8('0x161'));}this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('math\x20%s',_0x2f6928[_0x7ae8('0x162')]));var _0x38de44=eval(_0x2f6928[_0x7ae8('0x162')]);if(!this[_0x7ae8('0x7a')](_0x2f6928[_0x7ae8('0xd5')])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xd4'));}var _0x2898b5=this['getVariable'][_0x7ae8('0x9f')](this,_0x2f6928[_0x7ae8('0xd5')]);if(!_0x2898b5){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x2f6928,_0x7ae8('0xd6'));}if(_[_0x7ae8('0x91')](_0x38de44)){var _0x586af7=this;_0x38de44[_0x7ae8('0xd7')](function(_0x28c264,_0x4bc24e){_0x586af7[_0x7ae8('0x2c')][_0x7ae8('0x95')](util[_0x7ae8('0x21')](_0x7ae8('0x163'),_0x2898b5,_0x4bc24e),_0x28c264);});return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x164'),_0x2898b5));}else{return this['channel'][_0x7ae8('0x95')](_0x2898b5,_0x38de44);}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x8')]=function(_0x53cad4){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x165'),_0x53cad4[_0x7ae8('0x2e')]));if(_0x53cad4[_0x7ae8('0xa0')]===0x0){return this['maxRetry'](_0x53cad4);}_0x53cad4[_0x7ae8('0xa0')]-=0x1;if(!this[_0x7ae8('0x7a')](_0x53cad4['file_id'])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x53cad4,'no\x20file\x20audio\x20selected');}var _0x3b85fe=this[_0x7ae8('0x113')][_0x7ae8('0x9f')](this,_0x53cad4[_0x7ae8('0x111')]);if(!_0x3b85fe){return this[_0x7ae8('0x2c')]['error'](_0x53cad4,_0x7ae8('0x114'));}var _0x191866=this[_0x7ae8('0x2c')][_0x7ae8('0x115')](_0x3b85fe,_0x53cad4[_0x7ae8('0x116')],_0x53cad4['digit']);var _0x2d3602=_0x191866['result'];if(_0x191866[_0x7ae8('0x9c')]===-0x1){this['createSquareDetailsReport'][_0x7ae8('0x9f')](this,_0x53cad4,'-1');return _0x191866;}else if(_0x191866[_0x7ae8('0x9a')]===_0x7ae8('0x5c')){_0x191866['result']=_0x191866['result'][_0x7ae8('0x94')]>0x0?_0x191866[_0x7ae8('0x9c')]:'t';}else if(_['isEmpty'](_0x191866[_0x7ae8('0x9c')])){_0x191866[_0x7ae8('0x9c')]='#';_0x2d3602='#';}if(!this[_0x7ae8('0x7a')](_0x53cad4[_0x7ae8('0xd5')])){this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0xd4'));}else{var _0x293f86=this['getVariable'][_0x7ae8('0x9f')](this,_0x53cad4[_0x7ae8('0xd5')]);if(!_0x293f86){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x53cad4,_0x7ae8('0xd6'));}this[_0x7ae8('0x2c')]['setVariable'](_0x293f86,_0x2d3602);}this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x53cad4,_0x2d3602);return _0x191866;};AGIVertices['prototype'][_0x7ae8('0xa3')]=function(_0x145dad){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x166'),_0x145dad[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')]['noop'](_0x145dad[_0x7ae8('0x167')]||_0x145dad[_0x7ae8('0x2e')]);};AGIVertices['prototype'][_0x7ae8('0x168')]=function(_0x3e4ca0){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x169'),_0x3e4ca0[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x3e4ca0['findBy'])){return this[_0x7ae8('0x2c')]['error'](_0x3e4ca0,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x158'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x3e4ca0[_0x7ae8('0x156')]));var _0x344190=this['getPause'][_0x7ae8('0x9f')](this,_0x3e4ca0[_0x7ae8('0x16a')]);var _0x2b782a=this['agentPause']['sync'](this,_0x3e4ca0['findBy'],_0x344190);if(_0x2b782a){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this['channel'][_0x7ae8('0x31')],_0x3e4ca0[_0x7ae8('0x156')]));this[_0x7ae8('0x2c')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x3e4ca0[_0x7ae8('0x156')]));return{'code':0xc8,'result':_0x7ae8('0x15a')};}else{logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x3e4ca0['findBy']));this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this['channel'][_0x7ae8('0x31')],_0x3e4ca0[_0x7ae8('0x156')]));return{'code':0xc8,'result':_0x7ae8('0x15c')};}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x16b')]=function(_0x2e23bd){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x16c'),_0x2e23bd[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x2e23bd['file_id'])){return this[_0x7ae8('0x2c')]['error'](_0x2e23bd,'no\x20file\x20audio\x20selected');}var _0x190e29=this['getSound']['sync'](this,_0x2e23bd['file_id']);if(!_0x190e29){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x2e23bd,_0x7ae8('0x114'));}var _0x1fbeef=this[_0x7ae8('0x2c')]['exec'](_0x7ae8('0x16d'),[_0x190e29,_0x2e23bd[_0x7ae8('0x10e')]]);if(_0x1fbeef[_0x7ae8('0x9c')]===-0x1){return _0x1fbeef;}return this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xc2'),_0x7ae8('0x16d'),_0x190e29));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x16e')]=function(_0x4dd6f3){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x16f'),_0x4dd6f3['label']));if(!this[_0x7ae8('0x7a')](_0x4dd6f3['queue_id'])){return this['channel']['error'](_0x4dd6f3,_0x7ae8('0x170'));}var _0x6d8f38='';var _0x2487a1=parseInt(_0x4dd6f3['queue_id'],0xa);if(isNaN(_0x2487a1)){_0x6d8f38=_0x4dd6f3[_0x7ae8('0x171')];}else{_0x6d8f38=this['getVoiceQueue']['sync'](this,_0x4dd6f3[_0x7ae8('0x171')]);if(!_0x6d8f38){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x4dd6f3,_0x7ae8('0x172'));}}var _0x2e788f='';if(this[_0x7ae8('0x7a')](_0x4dd6f3[_0x7ae8('0x111')])){var _0x5ee24b=this['getSound'][_0x7ae8('0x9f')](this,_0x4dd6f3[_0x7ae8('0x111')]);if(_0x5ee24b){_0x2e788f=_0x5ee24b;}}this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x4dd6f3,_0x6d8f38);if(_0x4dd6f3[_0x7ae8('0x10e')][_0x7ae8('0x173')]('x')<0x0){_0x4dd6f3[_0x7ae8('0x10e')]+='x';}if(_0x4dd6f3[_0x7ae8('0x10e')][_0x7ae8('0x173')]('X')<0x0){_0x4dd6f3[_0x7ae8('0x10e')]+='X';}this[_0x7ae8('0x2c')][_0x7ae8('0x95')]('XMCS-QUEUE',_0x6d8f38?_0x6d8f38[_0x7ae8('0x174')]():'');var _0x507ee5=this[_0x7ae8('0x2c')]['exec'](_0x7ae8('0x175'),[_0x6d8f38,_0x4dd6f3[_0x7ae8('0x10e')],_0x4dd6f3['url'],_0x2e788f,_0x4dd6f3['timeout'],_0x4dd6f3[_0x7ae8('0xb2')],_0x4dd6f3['macro'],_0x4dd6f3['gosub'],'',_0x4dd6f3[_0x7ae8('0x176')]]);if(_0x507ee5[_0x7ae8('0x9c')]===-0x1){return _0x507ee5;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('Executed\x20command\x20%s\x20%s',_0x7ae8('0x175'),_0x6d8f38));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x177')]=function(_0x1f4ebb){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x178'),_0x1f4ebb[_0x7ae8('0x2e')]));var _0x1405d7=_0x1f4ebb[_0x7ae8('0x179')]||'wav';var _0x25bd56=util[_0x7ae8('0x21')](_0x7ae8('0x17a'),this['channel'][_0x7ae8('0x2d')],rs['generate'](0x5));var _0x20da7b=util[_0x7ae8('0x21')](_0x7ae8('0x17b'),FILES_PATH,_0x25bd56,_0x1405d7);var _0x57ba55=util['format'](_0x7ae8('0x14d'),FILES_PATH,_0x25bd56);this[_0x7ae8('0x32')][_0x7ae8('0x9f')](this,_0x1f4ebb,_0x25bd56,_0x20da7b);this[_0x7ae8('0x2c')][_0x7ae8('0x95')](_0x7ae8('0x17c'),_0x25bd56);logger['info'](_0x7ae8('0x17d'),_0x57ba55,_0x1405d7,_0x1f4ebb[_0x7ae8('0x17e')],_0x1f4ebb[_0x7ae8('0x5c')]);return this[_0x7ae8('0x2c')][_0x7ae8('0x12c')](_0x57ba55,_0x1405d7,_0x1f4ebb[_0x7ae8('0x17e')],_0x1f4ebb[_0x7ae8('0x5c')],undefined,!![]);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x17f')]=function(_0x4c460e){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x180'),_0x4c460e[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x4c460e[_0x7ae8('0x67')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x181'));}var _0xd7bad6=this['restAPI'][_0x7ae8('0x9f')](this,_0x4c460e);logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x182'),util[_0x7ae8('0x183')](_0xd7bad6,{'showHidden':![],'depth':null})));if(!this[_0x7ae8('0x7a')](_0x4c460e['variable_id'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x54946b=this[_0x7ae8('0x99')][_0x7ae8('0x9f')](this,_0x4c460e['variable_id']);if(!_0x54946b){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x4c460e,_0x7ae8('0xd6'));}this[_0x7ae8('0x2c')]['setVariable'](util[_0x7ae8('0x21')](_0x7ae8('0x184'),_0x54946b),_0xd7bad6[_0x7ae8('0x6b')]?_0xd7bad6[_0x7ae8('0x6b')]:_0x7ae8('0x185'));this[_0x7ae8('0x2c')][_0x7ae8('0x95')](util['format'](_0x7ae8('0x186'),_0x54946b),_0xd7bad6['statusMessage']?_0xd7bad6[_0x7ae8('0x6c')]:'OK');if(_0xd7bad6[_0x7ae8('0x69')]){try{this[_0x7ae8('0x92')](_0xd7bad6[_0x7ae8('0x69')],_0x54946b);}catch(_0x213711){logger[_0x7ae8('0x24')](util[_0x7ae8('0x21')](_0x7ae8('0x187'),_0x54946b));}}return this[_0x7ae8('0x2c')]['noop'](util['format'](_0x7ae8('0xda'),_0x54946b));};AGIVertices['prototype'][_0x7ae8('0x188')]=function(_0x31c52f){logger[_0x7ae8('0x25')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x31c52f[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')][_0x7ae8('0x189')](_0x31c52f['digits'][_0x7ae8('0x4f')](/\s+/g,''),_0x31c52f[_0x7ae8('0x17e')]);};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x18a')]=function(_0x2c68e0){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x18b'),_0x2c68e0[_0x7ae8('0x2e')]));return this['channel'][_0x7ae8('0x18c')](_0x2c68e0[_0x7ae8('0x18d')][_0x7ae8('0x4f')](/\s+/g,''),_0x2c68e0['escape_digits']);};AGIVertices[_0x7ae8('0xc')]['sayphonetic']=function(_0x3b3ae1){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x18e'),_0x3b3ae1[_0x7ae8('0x2e')]));return this[_0x7ae8('0x2c')]['sayPhonetic'](_0x3b3ae1[_0x7ae8('0x52')],_0x3b3ae1[_0x7ae8('0x17e')]);};AGIVertices['prototype'][_0x7ae8('0x18f')]=function(_0x374aa9){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x190'),_0x374aa9[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x374aa9['account_id'])){return this['channel']['noop'](_0x7ae8('0x191'));}var _0x4879ce=this[_0x7ae8('0x192')][_0x7ae8('0x9f')](this,_0x374aa9['account_id']);if(!_0x4879ce||!_0x4879ce[_0x7ae8('0x193')]){return this[_0x7ae8('0x2c')]['error'](_0x374aa9,'no\x20mail\x20account\x20found');}var _0x5ae85d={'from':util[_0x7ae8('0x21')](_0x7ae8('0x194'),_0x4879ce[_0x7ae8('0xf')],_0x4879ce[_0x7ae8('0x195')]||_0x4879ce[_0x7ae8('0x193')][_0x7ae8('0x196')]),'to':_0x374aa9['to']||'','cc':_0x374aa9['cc']||'','bcc':_0x374aa9[_0x7ae8('0x197')]||'','subject':_0x374aa9['subject'],'html':_0x374aa9['text'],'text':_0x374aa9['text']};if(this[_0x7ae8('0x7a')](_0x374aa9[_0x7ae8('0x198')])){}logger[_0x7ae8('0xdc')](_0x7ae8('0x199'),JSON[_0x7ae8('0x96')](_0x5ae85d));this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x374aa9,_0x374aa9[_0x7ae8('0x19a')]);this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x19b'),_0x4879ce[_0x7ae8('0xf')]));this['sendMailMessage'][_0x7ae8('0x9f')](this,_0x4879ce['smtpOptions'],_0x5ae85d);return this['channel'][_0x7ae8('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7ae8('0xc')]['sendFax']=function(_0x24dd61){logger['info'](util['format'](_0x7ae8('0x19c'),_0x24dd61[_0x7ae8('0x2e')]));return this['channel'][_0x7ae8('0xa3')](_0x7ae8('0x19d'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x19e')]=function(_0x42f1ac){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x19f'),_0x42f1ac['label']));if(!this['isConfigured'](_0x42f1ac['sms_account_id'])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x1a0'));}var _0x108f41=this['getSmsAccount'][_0x7ae8('0x9f')](this,_0x42f1ac[_0x7ae8('0x1a1')]);if(!_0x108f41){return this['channel'][_0x7ae8('0x24')](_0x42f1ac,_0x7ae8('0x1a2'));}var _0x214514={'body':_0x42f1ac[_0x7ae8('0x1a3')],'phone':_0x42f1ac['to']||'','SmsAccountId':_0x108f41['id']};logger[_0x7ae8('0xdc')]('sendSMS\x20message',JSON['stringify'](_0x214514));this[_0x7ae8('0x2b')]['sync'](this,_0x42f1ac,_0x42f1ac[_0x7ae8('0x1a1')]);this['channel']['noop'](util[_0x7ae8('0x21')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x108f41[_0x7ae8('0xf')]));this[_0x7ae8('0x2a')][_0x7ae8('0x9f')](this,_0x214514);return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x1a4'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1a5')]=function(_0x3092f5){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x1a6'),_0x3092f5['label']));if(!this[_0x7ae8('0x7a')](_0x3092f5['variable_id'])){return this[_0x7ae8('0x2c')]['error'](_0x3092f5,_0x7ae8('0x1a7'));}var _0x376a6e=this['getVariable'][_0x7ae8('0x9f')](this,_0x3092f5['variable_id']);if(!_0x376a6e){return this[_0x7ae8('0x2c')]['error'](_0x3092f5,'no\x20variable\x20found');}return this['channel'][_0x7ae8('0x95')](_0x376a6e,_0x3092f5['variable_value']);};AGIVertices[_0x7ae8('0xc')]['start']=function(_0x41f92e){logger[_0x7ae8('0x25')](util['format'](_0x7ae8('0x1a8'),_0x41f92e[_0x7ae8('0x2e')]));this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0x1a9'));if(_0x41f92e['answer']==='yes'){this['channel'][_0x7ae8('0xa3')](_0x7ae8('0x1aa'));return this[_0x7ae8('0x2c')][_0x7ae8('0xb5')]();}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x1ab'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1ac')]=function(_0x5b0123){logger['info'](util['format'](_0x7ae8('0x1ad'),_0x5b0123[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x5b0123['project_id'])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x5b0123,_0x7ae8('0x1ae'));}var _0x3979b6=this['getSquareProject'][_0x7ae8('0x9f')](this,_0x5b0123[_0x7ae8('0x1af')]);if(!this[_0x7ae8('0x7a')](_0x3979b6)){return this[_0x7ae8('0x2c')]['error'](_0x5b0123,util[_0x7ae8('0x21')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5b0123['project_id']));}if(_0x3979b6===this[_0x7ae8('0x2c')][_0x7ae8('0x30')]){return this['channel']['error'](_0x5b0123,_0x7ae8('0x1b0'));}this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x5b0123,_0x3979b6);var _0x26a9a8=this[_0x7ae8('0x2c')]['exec'](_0x7ae8('0x1b1'),util[_0x7ae8('0x21')](_0x7ae8('0x1b2'),config[_0x7ae8('0xb2')][_0x7ae8('0x1b3')]||'127.0.0.1',_0x3979b6,this[_0x7ae8('0x2c')][_0x7ae8('0x30')]));if(_0x26a9a8[_0x7ae8('0x9c')]===-0x1){return _0x26a9a8;}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util['format'](_0x7ae8('0xc2'),_0x7ae8('0x1b1'),_0x3979b6));};AGIVertices[_0x7ae8('0xc')]['system']=function(_0x5666cd){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x1b4'),_0x5666cd['label']));var _0x2cb584=this[_0x7ae8('0x4c')][_0x7ae8('0x9f')](this,_0x5666cd[_0x7ae8('0x1b5')]);this[_0x7ae8('0x2b')][_0x7ae8('0x9f')](this,_0x5666cd,_0x5666cd[_0x7ae8('0x1b5')]);if(this[_0x7ae8('0x7a')](_0x5666cd['variable_id'])){var _0x1092ee=this['getVariable']['sync'](this,_0x5666cd[_0x7ae8('0xd5')]);if(_0x1092ee){this['channel'][_0x7ae8('0x95')](_0x1092ee,_0x2cb584);return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x1b6'),_0x5666cd[_0x7ae8('0x1b5')],_0x1092ee));}}return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x1b7'),_0x5666cd['command']));};AGIVertices[_0x7ae8('0xc')]['google_cloud_tts']=function(_0x119d8b){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x1b8'),_0x119d8b[_0x7ae8('0x2e')]));_0x119d8b['text']=_0x119d8b['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x119d8b[_0x7ae8('0x51')])){return this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](_0x7ae8('0x1b9'));}if(!this[_0x7ae8('0x7a')](_0x119d8b[_0x7ae8('0x52')])){return this[_0x7ae8('0x2c')]['noop'](_0x7ae8('0xa4'));}this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x1ba'),_0x119d8b[_0x7ae8('0x52')]));var _0x124283=this[_0x7ae8('0x50')]['sync'](this,_0x119d8b);if(_0x124283){this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x1bb'),_0x124283));var _0xa7ee4c=this[_0x7ae8('0x2c')][_0x7ae8('0x103')](_0x124283);try{fs[_0x7ae8('0x104')](_0x124283+_0x7ae8('0x105'));}catch(_0x56993e){logger[_0x7ae8('0x24')](_0x56993e);}return _0xa7ee4c;}return this[_0x7ae8('0x2c')]['error'](_0x119d8b,_0x7ae8('0x1bc'));};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1bd')]=function(_0x6a8b66){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x6a8b66[_0x7ae8('0x2e')]));_0x6a8b66[_0x7ae8('0x52')]=_0x6a8b66[_0x7ae8('0x52')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7ae8('0x7a')](_0x6a8b66[_0x7ae8('0x52')])){return this['channel'][_0x7ae8('0xa3')]('no\x20text\x20configured');}this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x1be'),_0x6a8b66[_0x7ae8('0x52')]));var _0x535ead=this[_0x7ae8('0x58')][_0x7ae8('0x9f')](this,_0x6a8b66);if(_0x535ead){this['channel'][_0x7ae8('0xa3')](util['format'](_0x7ae8('0x1bf'),_0x535ead));var _0x3d64e0=this['channel']['streamFile'](_0x535ead);try{fs[_0x7ae8('0x104')](_0x535ead+_0x7ae8('0x105'));}catch(_0x512d62){logger[_0x7ae8('0x24')](_0x512d62);}return _0x3d64e0;}return this[_0x7ae8('0x2c')]['error'](_0x6a8b66,_0x7ae8('0x1c0'));};AGIVertices[_0x7ae8('0xc')]['unpause']=function(_0x13c54c){logger['info'](util['format'](_0x7ae8('0x1c1'),_0x13c54c[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x13c54c[_0x7ae8('0x156')])){return this[_0x7ae8('0x2c')][_0x7ae8('0x24')](_0x13c54c,_0x7ae8('0x157'));}logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x158'),this[_0x7ae8('0x2c')]['callerid'],_0x13c54c['findBy']));var _0x116d70=this['agentUnpause']['sync'](this,_0x13c54c[_0x7ae8('0x156')]);if(_0x116d70){logger[_0x7ae8('0x25')](util[_0x7ae8('0x21')](_0x7ae8('0x159'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x13c54c[_0x7ae8('0x156')]));this['channel'][_0x7ae8('0xa3')](util[_0x7ae8('0x21')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7ae8('0x31')],_0x13c54c['findBy']));return{'code':0xc8,'result':_0x7ae8('0x15a')};}else{logger['info'](util['format'](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')]['callerid'],_0x13c54c[_0x7ae8('0x156')]));this[_0x7ae8('0x2c')][_0x7ae8('0xa3')](util[_0x7ae8('0x21')](_0x7ae8('0x15b'),this[_0x7ae8('0x2c')][_0x7ae8('0x31')],_0x13c54c['findBy']));return{'code':0xc8,'result':_0x7ae8('0x15c')};}};AGIVertices[_0x7ae8('0xc')][_0x7ae8('0x1c2')]=function(_0x9e5d8f){logger['info'](util[_0x7ae8('0x21')](_0x7ae8('0x1c3'),_0x9e5d8f[_0x7ae8('0x2e')]));var _0x5e51f4=this[_0x7ae8('0x2c')][_0x7ae8('0x4d')](_0x7ae8('0x1c4'),[_0x9e5d8f[_0x7ae8('0x1c5')],_0x9e5d8f[_0x7ae8('0x6e')]]);if(_0x5e51f4[_0x7ae8('0x9c')]===-0x1){return _0x5e51f4;}return this[_0x7ae8('0x2c')]['noop'](util[_0x7ae8('0x21')](_0x7ae8('0xc2'),_0x7ae8('0x1c4'),_0x9e5d8f[_0x7ae8('0x1c5')]));};AGIVertices['prototype']['vswitch']=function(_0x2b5754){logger['info'](util['format'](_0x7ae8('0x1c6'),_0x2b5754[_0x7ae8('0x2e')]));if(!this[_0x7ae8('0x7a')](_0x2b5754[_0x7ae8('0xd5')])){return this['channel'][_0x7ae8('0x24')](_0x2b5754,_0x7ae8('0x1a7'));}var _0x186eab=this[_0x7ae8('0x99')][_0x7ae8('0x9f')](this,_0x2b5754[_0x7ae8('0xd5')]);if(!_0x186eab){return this[_0x7ae8('0x2c')]['error'](_0x2b5754,_0x7ae8('0xd6'));}var _0x60449e=this[_0x7ae8('0x2c')]['getVariable'](_0x186eab);return{'code':0xc8,'result':_0x60449e[_0x7ae8('0x9a')]?_0x60449e[_0x7ae8('0x9a')]:'-'};};String[_0x7ae8('0xc')][_0x7ae8('0x98')]=function(_0x5b77b7,_0x57bca5){return this[_0x7ae8('0x97')](_0x5b77b7)[_0x7ae8('0x1c7')](_0x57bca5);};module[_0x7ae8('0x1c8')]=AGIVertices; \ No newline at end of file +var _0xcf14=['Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','agentPause','playback','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','bcc','subject','template_id','debug','sendMail\x20message','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','no\x20variable\x20selected','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','extension','priority','accountcode','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','method','timeout','number','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','text','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','tildeASR','appid','uri','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','extra','getAndSetVariable','result','setVariable','maxRetry','retry','mrcpsynth','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','add','delay','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','dial','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','Executed\x20command\x20%s','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s'];(function(_0x2c4822,_0x424e11){var _0x520bef=function(_0x3504a9){while(--_0x3504a9){_0x2c4822['push'](_0x2c4822['shift']());}};_0x520bef(++_0x424e11);}(_0xcf14,0xa1));var _0x4cf1=function(_0x2c5f01,_0xdfd2f5){_0x2c5f01=_0x2c5f01-0x0;var _0x481aa7=_0xcf14[_0x2c5f01];return _0x481aa7;};'use strict';var fs=require('fs');var util=require(_0x4cf1('0x0'));var _=require('lodash');var sh=require(_0x4cf1('0x1'));var odbc=require(_0x4cf1('0x2'))();var rs=require('randomstring');var moment=require(_0x4cf1('0x3'));var Mustache=require(_0x4cf1('0x4'));var rp=require(_0x4cf1('0x5'));var logger=require(_0x4cf1('0x6'))('agi');var config=require(_0x4cf1('0x7'));var shared=require(_0x4cf1('0x8'));var scripts=require(_0x4cf1('0x9'));var FILES_PATH=_0x4cf1('0xa');var recursiveMapAttributes=[_0x4cf1('0xb'),_0x4cf1('0xc')];var verticesWithRetry=[_0x4cf1('0xd'),'getdigits',_0x4cf1('0xe')];var AGIVertices=function(_0x208cdd,_0x46c2de,_0x37db9f){this[_0x4cf1('0xf')]=_0x208cdd;this[_0x4cf1('0x10')]=_0x46c2de;this[_0x4cf1('0x11')]=_0x37db9f;};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x13')]=function(_0x28af26,_0x26d254){this[_0x4cf1('0x10')][_0x4cf1('0x14')](_0x28af26)[_0x4cf1('0x15')](function(_0x592557){_0x26d254(null,_0x592557?_0x592557[_0x4cf1('0x16')]:![]);})[_0x4cf1('0x17')](function(_0x1ae8fb){_0x26d254(_0x1ae8fb);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x18')]=function(_0x16bae8,_0x10abde){this[_0x4cf1('0x10')][_0x4cf1('0x19')](_0x16bae8)[_0x4cf1('0x15')](function(_0x3e320f){_0x10abde(null,_0x3e320f?_0x3e320f[_0x4cf1('0x16')]:![]);})[_0x4cf1('0x17')](function(_0x2a8cf7){_0x10abde(_0x2a8cf7);});};AGIVertices[_0x4cf1('0x12')]['getSquareProject']=function(_0x3e3cd8,_0x527dca){this[_0x4cf1('0x10')][_0x4cf1('0x1a')](_0x3e3cd8)[_0x4cf1('0x15')](function(_0x1f20c0){_0x527dca(null,_0x1f20c0?_0x1f20c0[_0x4cf1('0x16')]:![]);})['catch'](function(_0x4499f7){_0x527dca(_0x4499f7);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x1b')]=function(_0x4557e0,_0x52b5a2){this['rpc'][_0x4cf1('0x1c')](_0x4557e0)[_0x4cf1('0x15')](function(_0x5603ae){_0x52b5a2(null,_0x5603ae?_0x5603ae[_0x4cf1('0x1d')]:![]);})[_0x4cf1('0x17')](function(_0x3cc036){_0x52b5a2(_0x3cc036);});};AGIVertices[_0x4cf1('0x12')]['getUser']=function(_0x3469ac,_0x158000){this[_0x4cf1('0x10')][_0x4cf1('0x1e')](_0x3469ac)[_0x4cf1('0x15')](function(_0x2945b4){_0x158000(null,_0x2945b4?_0x2945b4['name']:![]);})[_0x4cf1('0x17')](function(_0x5bb535){_0x158000(_0x5bb535);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x1f')]=function(_0x1b0ad4,_0x371fac){this[_0x4cf1('0x10')][_0x4cf1('0x20')](_0x1b0ad4)[_0x4cf1('0x15')](function(_0x326ca6){_0x371fac(null,_0x326ca6?_0x326ca6[_0x4cf1('0x16')]:![]);})[_0x4cf1('0x17')](function(_0x395f52){_0x371fac(_0x395f52);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x21')]=function(_0x4bcd78,_0x4498b5){var _0x1ccc90=this;this[_0x4cf1('0x10')][_0x4cf1('0x22')](_0x4bcd78)[_0x4cf1('0x15')](function(_0x27d360){_0x4498b5(null,_0x27d360?_0x1ccc90[_0x4cf1('0x23')](_0x27d360[_0x4cf1('0x24')]):![]);})[_0x4cf1('0x17')](function(_0x1e8dbf){_0x4498b5(_0x1e8dbf);});};AGIVertices[_0x4cf1('0x12')]['getMailAccount']=function(_0x18232e,_0x167da0){this['rpc'][_0x4cf1('0x25')](_0x18232e)[_0x4cf1('0x15')](function(_0x29f111){_0x167da0(null,_0x29f111?_0x29f111:![]);})[_0x4cf1('0x17')](function(_0x1fab26){_0x167da0(_0x1fab26);});};AGIVertices[_0x4cf1('0x12')]['sendMailMessage']=function(_0x3763f5,_0x59d7ae,_0x31758b){this[_0x4cf1('0x11')][_0x4cf1('0x26')](_0x3763f5,_0x59d7ae)[_0x4cf1('0x15')](function(){_0x31758b(null);})[_0x4cf1('0x17')](function(_0x5e298f){_0x31758b(_0x5e298f);});};AGIVertices[_0x4cf1('0x12')]['getIntervals']=function(_0x59ba8f,_0x47dd9b){this[_0x4cf1('0x10')][_0x4cf1('0x27')](_0x59ba8f)[_0x4cf1('0x15')](function(_0x3e938b){if(_0x3e938b){if(_0x3e938b[_0x4cf1('0x28')]){_0x47dd9b(null,[_0x3e938b[_0x4cf1('0x29')]]);}else{_0x47dd9b(null,_[_0x4cf1('0x2a')](_0x3e938b[_0x4cf1('0x2b')],'interval'));}}else{_0x47dd9b(null,![]);}})['catch'](function(_0x48d93a){_0x47dd9b(_0x48d93a);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x23')]=function(_0xb0d56a){return util[_0x4cf1('0x2c')](_0x4cf1('0x2d'),FILES_PATH,_0xb0d56a);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x2e')]=function(_0x576ef2,_0x102e1a,_0x6a0a06){odbc[_0x4cf1('0x2f')](_0x576ef2,function(_0x38637f){if(_0x38637f){logger[_0x4cf1('0x30')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x38637f);_0x6a0a06(_0x38637f);}else{logger['info'](_0x4cf1('0x31'));odbc[_0x4cf1('0x32')](_0x102e1a,function(_0x835dd6,_0x2ec283){if(_0x835dd6){logger[_0x4cf1('0x33')](_0x4cf1('0x34'),_0x102e1a);_0x6a0a06(_0x835dd6);}else{logger[_0x4cf1('0x33')]('Query\x20executed\x20correctly\x20%s',_0x102e1a);odbc[_0x4cf1('0x35')](function(_0x7c23a0){if(_0x7c23a0){logger[_0x4cf1('0x30')](_0x4cf1('0x36'),_0x7c23a0);}_0x6a0a06(null,_0x2ec283);});}});}});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x37')]=function(_0x483961,_0x5348f5){this[_0x4cf1('0x10')][_0x4cf1('0x38')](_0x483961)[_0x4cf1('0x15')](function(_0x45f90f){_0x5348f5(null,_0x45f90f?_0x45f90f:![]);})[_0x4cf1('0x17')](function(_0x43d336){_0x5348f5(_0x43d336);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x39')]=function(_0x29f7a5,_0x3cd153){this[_0x4cf1('0x10')]['createSmsMessage'](_0x29f7a5)[_0x4cf1('0x15')](function(_0x2f3f00){_0x3cd153(null,_0x2f3f00);})['catch'](function(_0x25f111){_0x3cd153(_0x25f111);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x3a')]=function(_0xc2b163,_0x2b2ee4,_0x5a4078){this[_0x4cf1('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x4cf1('0x3b')],'node':_0xc2b163[_0x4cf1('0x3c')],'application':_0xc2b163[_0x4cf1('0x3d')],'data':_0x2b2ee4||null,'project_name':this[_0x4cf1('0xf')][_0x4cf1('0x3e')],'callerid':this[_0x4cf1('0xf')][_0x4cf1('0x3f')]})[_0x4cf1('0x15')](function(_0x1567cb){if(_0x5a4078){_0x5a4078(null,_0x1567cb);}})[_0x4cf1('0x17')](function(_0x1defca){if(_0x5a4078){_0x5a4078(_0x1defca);}});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x40')]=function(_0x2133fe,_0xa90309,_0x20a5a2,_0x4986fc){this[_0x4cf1('0x10')][_0x4cf1('0x40')]({'uniqueid':this[_0x4cf1('0xf')][_0x4cf1('0x3b')],'callerid':this[_0x4cf1('0xf')][_0x4cf1('0x3f')],'calleridname':this[_0x4cf1('0xf')]['calleridname'],'context':this[_0x4cf1('0xf')]['context'],'extension':this[_0x4cf1('0xf')][_0x4cf1('0x41')],'priority':this[_0x4cf1('0xf')][_0x4cf1('0x42')],'accountcode':this[_0x4cf1('0xf')][_0x4cf1('0x43')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0x4cf1('0x3e')],'saveName':_0xa90309,'filename':_0x2133fe[_0x4cf1('0x44')]||_0xa90309,'savePath':_0x20a5a2})[_0x4cf1('0x15')](function(_0x58c3cd){_0x4986fc(null,_0x58c3cd);})[_0x4cf1('0x17')](function(_0x267036){_0x4986fc(_0x267036);});};AGIVertices['prototype'][_0x4cf1('0x45')]=function(_0x3e3e5d,_0x1f228b,_0xcef16d,_0x248fb3,_0x5b6fb5){this[_0x4cf1('0x10')][_0x4cf1('0x45')]({'uniqueid':this[_0x4cf1('0xf')][_0x4cf1('0x3b')],'body':_0x3e3e5d,'direction':_0x1f228b,'providerName':_0xcef16d,'providerResponse':_0x248fb3})[_0x4cf1('0x15')](function(_0x4f7adf){if(_0x5b6fb5){_0x5b6fb5(null,_0x4f7adf);}})[_0x4cf1('0x17')](function(_0x2c1811){if(_0x5b6fb5){_0x5b6fb5(_0x2c1811);}});};AGIVertices['prototype']['createCmContact']=function(_0x5ac7d2,_0x2eda02){this[_0x4cf1('0x10')][_0x4cf1('0x46')]({'firstName':_['isEmpty'](_0x5ac7d2[_0x4cf1('0x16')])||_[_0x4cf1('0x47')](_0x5ac7d2[_0x4cf1('0x16')])?'callback_'+Math[_0x4cf1('0x48')]():_0x5ac7d2[_0x4cf1('0x16')],'lastName':_[_0x4cf1('0x49')](_0x5ac7d2[_0x4cf1('0x4a')])||_['isNil'](_0x5ac7d2[_0x4cf1('0x4a')])?null:_0x5ac7d2[_0x4cf1('0x4a')],'phone':_0x5ac7d2['phone'],'ListId':_0x5ac7d2[_0x4cf1('0x4b')],'scheduledat':_0x5ac7d2[_0x4cf1('0x4c')],'callbackUniqueid':this[_0x4cf1('0xf')]['uniqueid'],'tags':_0x4cf1('0x4d'),'description':_0x4cf1('0x4e')+_0x5ac7d2[_0x4cf1('0x4c')][_0x4cf1('0x4f')](),'priority':_0x5ac7d2[_0x4cf1('0x50')]})[_0x4cf1('0x15')](function(_0x2d161f){_0x2eda02(null,_0x2d161f);})['catch'](function(_0x5bc4c9){_0x2eda02(_0x5bc4c9);});};AGIVertices[_0x4cf1('0x12')]['getPause']=function(_0x3d38c8,_0x39b15a){this[_0x4cf1('0x10')][_0x4cf1('0x51')](_0x3d38c8)[_0x4cf1('0x15')](function(_0x23938e){_0x39b15a(null,_0x23938e?_0x23938e[_0x4cf1('0x16')]:![]);})['catch'](function(_0x25b070){_0x39b15a(_0x25b070);});};AGIVertices[_0x4cf1('0x12')]['agentPause']=function(_0x38aa06,_0xa92bc0,_0xa56dc9){var _0x5a4872={'role':_0x4cf1('0x52')};_0x5a4872[_0x38aa06]=this[_0x4cf1('0xf')][_0x4cf1('0x3f')];this[_0x4cf1('0x10')]['agentPause'](_0x5a4872,_0xa92bc0,this['channel'][_0x4cf1('0x3b')])[_0x4cf1('0x15')](function(_0x514657){_0xa56dc9(null,_[_0x4cf1('0x47')](_0x514657)?![]:!![]);})[_0x4cf1('0x17')](function(_0x3f6973){logger['error'](_0x3f6973);_0xa56dc9(null,![]);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x53')]=function(_0x80fec5,_0x572091){var _0x14a7d6={'role':_0x4cf1('0x52')};_0x14a7d6[_0x80fec5]=this[_0x4cf1('0xf')][_0x4cf1('0x3f')];this['rpc'][_0x4cf1('0x53')](_0x14a7d6)['then'](function(_0x586662){_0x572091(null,_[_0x4cf1('0x47')](_0x586662)?![]:!![]);})[_0x4cf1('0x17')](function(_0x18cc9f){logger[_0x4cf1('0x30')](_0x18cc9f);_0x572091(null,![]);});};AGIVertices['prototype'][_0x4cf1('0x54')]=function(_0x1db02d,_0x35001f){var _0x4ca89f={'role':'agent'};_0x4ca89f[_0x1db02d]=this[_0x4cf1('0xf')][_0x4cf1('0x3f')];this['rpc'][_0x4cf1('0x54')](_0x4ca89f)['then'](function(_0x2f8d03){_0x35001f(null,_[_0x4cf1('0x47')](_0x2f8d03)?![]:!![]);})[_0x4cf1('0x17')](function(_0x163fea){logger[_0x4cf1('0x30')](_0x163fea);_0x35001f(null,![]);});};AGIVertices['prototype'][_0x4cf1('0x55')]=function(_0x40c37e,_0x283424){var _0x3f711e={'role':_0x4cf1('0x52')};_0x3f711e[_0x40c37e]=this['channel'][_0x4cf1('0x3f')];var _0x4d2977=_0x40c37e!='internal'?util[_0x4cf1('0x2c')](_0x4cf1('0x56'),_0x4cf1('0x57'),this['channel'][_0x4cf1('0x3f')]):undefined;this[_0x4cf1('0x10')][_0x4cf1('0x55')](_0x3f711e,_0x4d2977)[_0x4cf1('0x15')](function(_0x2a12c7){_0x283424(null,_[_0x4cf1('0x47')](_0x2a12c7)?![]:!![]);})[_0x4cf1('0x17')](function(_0x516862){logger[_0x4cf1('0x30')](_0x516862);_0x283424(null,![]);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x58')]=function(_0x5b19ec,_0x1e831f){sh[_0x4cf1('0x59')](_[_0x4cf1('0x5a')](_0x5b19ec),function(_0x191ee7,_0x48ec33){var _0x3d3c4f=_0x48ec33[_0x4cf1('0x5b')](/(\r\n|\n|\r)/gm,'');_0x1e831f(null,_0x3d3c4f);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4beb0d,_0x1b204f){scripts[_0x4cf1('0x5c')](_0x4beb0d[_0x4cf1('0x5d')],_0x4beb0d['google_cloud_tts_text_type']||'text',_0x4beb0d['text'],_0x4beb0d[_0x4cf1('0x5e')]||_0x4cf1('0x5f'),_0x4beb0d[_0x4cf1('0x60')]||_0x4cf1('0x61'),_0x4beb0d[_0x4cf1('0x62')]||_0x4cf1('0x63'))['then'](function(_0x123d5a){_0x1b204f(null,_0x123d5a);})['catch'](function(_0x4987e2){_0x1b204f(_0x4987e2);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x64')]=function(_0x15fc9e,_0x3bafc2){scripts['googleTTS'](_0x15fc9e['text'],_0x15fc9e['google_tts_language']||'en',0x1)['then'](function(_0xcf5d72){_0x3bafc2(null,_0xcf5d72);})[_0x4cf1('0x17')](function(_0x472086){_0x3bafc2(_0x472086);});};AGIVertices[_0x4cf1('0x12')]['restAPI']=function(_0x39c455,_0x21c22d){var _0x4ac9b6={'uri':_0x39c455['url'],'method':_0x39c455[_0x4cf1('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x39c455[_0x4cf1('0x66')])===_0x4cf1('0x67')&&parseInt(_0x39c455[_0x4cf1('0x66')])>=0x1?parseInt(_0x39c455[_0x4cf1('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x4cf1('0x68')]([_0x4cf1('0x69'),'PUT'],_0x4ac9b6['method'][_0x4cf1('0x6a')]())){try{_0x4ac9b6[_0x4cf1('0x6b')]=_0x39c455[_0x4cf1('0xc')]?JSON[_0x4cf1('0x6c')](_0x39c455[_0x4cf1('0xc')]):{};}catch(_0x5e5769){logger[_0x4cf1('0x30')](_0x4cf1('0x6d'),_0x5e5769);}}try{_0x4ac9b6['headers']=_0x39c455[_0x4cf1('0xb')]?JSON[_0x4cf1('0x6c')](_0x39c455[_0x4cf1('0xb')]):{};}catch(_0x1c1eb9){logger['error'](_0x4cf1('0x6e'),_0x1c1eb9);}if(_0x39c455[_0x4cf1('0x6f')]){try{var _0x64e59e=require(_0x39c455[_0x4cf1('0x6f')])[_0x4cf1('0x70')](this,_0x4ac9b6);_0x4ac9b6['uri']=Mustache[_0x4cf1('0x71')](_0x39c455[_0x4cf1('0x72')],_0x64e59e,{},['$$','$$']);if(_0x4ac9b6[_0x4cf1('0x73')]){_0x4ac9b6[_0x4cf1('0x73')]=JSON[_0x4cf1('0x6c')](Mustache[_0x4cf1('0x71')](JSON[_0x4cf1('0x74')](_0x4ac9b6[_0x4cf1('0x73')]),_0x64e59e,{},['$$','$$']));}if(_0x4ac9b6['body']){_0x4ac9b6['body']=JSON[_0x4cf1('0x6c')](Mustache[_0x4cf1('0x71')](JSON[_0x4cf1('0x74')](_0x4ac9b6[_0x4cf1('0x6b')]),_0x64e59e,{},['$$','$$']));}}catch(_0x4d1ce3){logger[_0x4cf1('0x30')](_0x4cf1('0x75'),_0x4d1ce3);}}rp(_0x4ac9b6)[_0x4cf1('0x15')](function(_0x250d1e){var _0x5b6053={'statusCode':_0x250d1e[_0x4cf1('0x76')]||0xc8,'statusMessage':_0x250d1e[_0x4cf1('0x77')]||'OK','headers':_0x250d1e['headers']||{},'body':_0x250d1e[_0x4cf1('0x6b')]||{}};_0x21c22d(null,_0x5b6053);})['catch'](function(_0x24bfbe){var _0x312dc2={'statusCode':_0x24bfbe['statusCode']||0x1f4,'statusMessage':_0x24bfbe[_0x4cf1('0x78')]||_0x4cf1('0x79'),'headers':_0x24bfbe[_0x4cf1('0x7a')]['headers']||{},'body':_0x24bfbe[_0x4cf1('0x7a')][_0x4cf1('0x6b')]||{}};_0x21c22d(null,_0x312dc2);});};AGIVertices[_0x4cf1('0x12')]['googleDialogflow']=function(_0x27338e,_0x2763b7){scripts[_0x4cf1('0x7b')](this[_0x4cf1('0xf')][_0x4cf1('0x3b')],_0x27338e[_0x4cf1('0x7c')],_0x27338e[_0x4cf1('0x7d')],_0x27338e[_0x4cf1('0x7e')]||'en')[_0x4cf1('0x15')](function(_0x3fabec){_0x2763b7(null,_0x3fabec);})[_0x4cf1('0x17')](function(_0x11b4cc){_0x2763b7(_0x11b4cc);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x4d5177,_0x56f963){scripts[_0x4cf1('0x7f')](this[_0x4cf1('0xf')][_0x4cf1('0x3b')],_0x4d5177[_0x4cf1('0x80')],_0x4d5177[_0x4cf1('0x81')],_0x4d5177[_0x4cf1('0x82')],_0x4d5177[_0x4cf1('0x7d')],_0x4d5177['dialogflowV2_language']||'en')[_0x4cf1('0x15')](function(_0x2ebe0a){_0x56f963(null,_0x2ebe0a);})[_0x4cf1('0x17')](function(_0x1023d2){_0x56f963(_0x1023d2);});};AGIVertices['prototype'][_0x4cf1('0x83')]=function(_0x1cde5e,_0x7822d4){scripts[_0x4cf1('0x83')](this[_0x4cf1('0xf')],_0x1cde5e)[_0x4cf1('0x15')](function(_0xd01710){_0x7822d4(null,_0xd01710);})[_0x4cf1('0x17')](function(_0x29ca5f){_0x7822d4(_0x29ca5f);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x84')]=function(_0x341ed9,_0x59bc13){scripts[_0x4cf1('0x84')](_0x341ed9[_0x4cf1('0x7c')],_0x341ed9['text'],_0x341ed9[_0x4cf1('0x85')]||_0x4cf1('0x5f'),_0x341ed9['speed'])[_0x4cf1('0x15')](function(_0x46bfa9){_0x59bc13(null,_0x46bfa9);})[_0x4cf1('0x17')](function(_0x3d9a48){_0x59bc13(_0x3d9a48);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x86')]=function(_0x109217,_0x43f97,_0x31622b){scripts[_0x4cf1('0x86')](_0x43f97,_0x109217[_0x4cf1('0x7c')],_0x109217['ispeech_asr_language']||_0x4cf1('0x5f'),this[_0x4cf1('0x87')](_0x109217[_0x4cf1('0x88')])?_0x109217[_0x4cf1('0x88')]:undefined)['then'](function(_0x3d6c3b){_0x31622b(null,_0x3d6c3b);})[_0x4cf1('0x17')](function(_0x1c6ee7){_0x31622b(_0x1c6ee7);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x89')]=function(_0x4e0bfd,_0xa4b2c1){scripts[_0x4cf1('0x89')](_0x4e0bfd[_0x4cf1('0x8a')],_0x4e0bfd[_0x4cf1('0x8b')],_0x4e0bfd['aws_polly_region'],_0x4e0bfd[_0x4cf1('0x8c')]||_0x4cf1('0x8d'),_0x4e0bfd['text'],_0x4e0bfd[_0x4cf1('0x8e')]||_0x4cf1('0x7d'))['then'](function(_0x24b423){_0xa4b2c1(null,_0x24b423);})[_0x4cf1('0x17')](function(_0x52d857){_0xa4b2c1(_0x52d857);});};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x8f')]=function(_0x57656f,_0x1248cb){scripts[_0x4cf1('0x8f')](this[_0x4cf1('0xf')][_0x4cf1('0x3b')],_0x57656f[_0x4cf1('0x8a')],_0x57656f[_0x4cf1('0x8b')],_0x57656f['aws_lex_region'],_0x57656f[_0x4cf1('0x7d')],_0x57656f[_0x4cf1('0x90')])[_0x4cf1('0x15')](function(_0x11e17a){_0x1248cb(null,_0x11e17a);})[_0x4cf1('0x17')](function(_0x193cbd){_0x1248cb(_0x193cbd);});};AGIVertices[_0x4cf1('0x12')]['googleASR']=function(_0x3aa868,_0x49138a,_0x144860){scripts['googleASR'](_0x49138a,_0x3aa868[_0x4cf1('0x7c')],_0x3aa868['google_asr_language']||'en-US')['then'](function(_0x78206b){_0x144860(null,_0x78206b);})[_0x4cf1('0x17')](function(_0x4758f5){_0x144860(_0x4758f5);});};AGIVertices[_0x4cf1('0x12')]['tildeASR']=function(_0x179a6d,_0x258337,_0x473185){scripts[_0x4cf1('0x91')](_0x258337,_0x179a6d[_0x4cf1('0x92')],_0x179a6d['appsecret'],_0x179a6d[_0x4cf1('0x93')])[_0x4cf1('0x15')](function(_0xbc50ed){_0x473185(null,_0xbc50ed);})[_0x4cf1('0x17')](function(_0x542b59){_0x473185(_0x542b59);});};AGIVertices[_0x4cf1('0x12')]['clear']=function(_0x1698ca){var _0x4e89af=_[_0x4cf1('0x68')](verticesWithRetry,_0x1698ca[_0x4cf1('0x3d')])?_0x1698ca:_[_0x4cf1('0x94')](_0x1698ca);for(var _0x3a97fb in _0x4e89af){if(_0x4e89af[_0x4cf1('0x95')](_0x3a97fb)){if(_0x4e89af[_0x3a97fb]&&_[_0x4cf1('0x96')](_0x4e89af[_0x3a97fb])){if(_[_0x4cf1('0x68')](recursiveMapAttributes,_0x3a97fb)){_0x4e89af[_0x3a97fb]=this[_0x4cf1('0x97')](_0x4e89af[_0x3a97fb]);}else{_0x4e89af[_0x3a97fb]=this[_0x4cf1('0x98')](_0x4e89af[_0x3a97fb]);}}}}return _0x4e89af;};AGIVertices['prototype'][_0x4cf1('0x99')]=function(_0x3ef1ae){for(var _0x2364b7 in _0x3ef1ae){if(_0x3ef1ae['hasOwnProperty'](_0x2364b7)){if(_[_0x4cf1('0x9a')](_0x3ef1ae[_0x2364b7])){this[_0x4cf1('0x99')](_0x3ef1ae[_0x2364b7]);}else if(_['isArray'](_0x3ef1ae[_0x2364b7])){for(var _0x44642f=0x0;_0x44642f<_0x3ef1ae[_0x2364b7][_0x4cf1('0x9b')];_0x44642f++){this[_0x4cf1('0x99')](_0x3ef1ae[_0x2364b7][_0x44642f]);}}else if(_[_0x4cf1('0x96')](_0x3ef1ae[_0x2364b7])){_0x3ef1ae[_0x2364b7]=this[_0x4cf1('0x98')](_0x3ef1ae[_0x2364b7]);}}}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x9c')]=function(_0x4b3517,_0x67af5){for(var _0xe5be65 in _0x4b3517){if(_0x4b3517['hasOwnProperty'](_0xe5be65)){if(_[_0x4cf1('0x9a')](_0x4b3517[_0xe5be65])){if(!_[_0x4cf1('0x49')](_0x4b3517[_0xe5be65])){this[_0x4cf1('0x9c')](_0x4b3517[_0xe5be65],util[_0x4cf1('0x2c')](_0x4cf1('0x9d'),_0x67af5,_0xe5be65));}}else if(_[_0x4cf1('0x9e')](_0x4b3517[_0xe5be65])){for(var _0xdab395=0x0;_0xdab395<_0x4b3517[_0xe5be65][_0x4cf1('0x9b')];_0xdab395++){this[_0x4cf1('0x9c')](_0x4b3517[_0xe5be65][_0xdab395],util[_0x4cf1('0x2c')](_0x4cf1('0x9d'),_0x67af5,_0xe5be65+'['+_0xdab395+']'));}}else{if(!_[_0x4cf1('0x47')](_0x4b3517[_0xe5be65])){this[_0x4cf1('0xf')]['setVariable'](util[_0x4cf1('0x2c')]('%s.%s',_0x67af5,_0xe5be65),_0x4b3517[_0xe5be65]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x55dcdb){try{var _0x114dbd=JSON[_0x4cf1('0x6c')](_0x55dcdb);this['recursiveNodeIndex'](_0x114dbd);return JSON['stringify'](_0x114dbd);}catch(_0x2ce56a){return this[_0x4cf1('0x98')](_0x55dcdb);}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x98')]=function(_0x5e325f){var _0x21c66f=_0x5e325f[_0x4cf1('0x9f')]('{');for(var _0x54b6fc=0x1;_0x54b6fc<_0x21c66f[_0x4cf1('0x9b')];_0x54b6fc+=0x1){var _0x109974=_0x21c66f[_0x54b6fc][_0x4cf1('0x9f')]('}');if(_0x109974[_0x4cf1('0x9b')]>0x1){_0x5e325f=_0x5e325f[_0x4cf1('0xa0')]('{'+_0x109974[0x0]+'}',this[_0x4cf1('0xf')][_0x4cf1('0x13')](_0x109974[0x0])[_0x4cf1('0xa1')]||_0x109974[0x0]);}}if(_0x21c66f[_0x4cf1('0x9b')]===0x1){return _0x5e325f['toString']();}return this['replaceAllVariables'](_0x5e325f);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xa2')]=function(_0x116912,_0xc4cd70){var _0x3a5f9c=this['channel'][_0x4cf1('0x13')](_0x116912);if(_0x3a5f9c[_0x4cf1('0xa3')]===-0x1){return _0x3a5f9c;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xc4cd70,_0x3a5f9c[_0x4cf1('0xa1')]));return this['channel'][_0x4cf1('0xa4')](_0xc4cd70,_0x3a5f9c[_0x4cf1('0xa1')]);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x87')]=function(_0x166348){return _0x166348&&_0x166348!=='0'&&_0x166348!=='-1'&&_0x166348!=='';};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xa5')]=function(_0x346744){this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x346744,'-');_0x346744[_0x4cf1('0xa6')]=_0x346744[_0x4cf1('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xa7')]=function(_0x4ef0ca){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4ef0ca[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x4ef0ca[_0x4cf1('0x7d')])){return this['channel']['noop'](_0x4cf1('0xa8'));}var _0x5d2035='\x22'+_0x4ef0ca[_0x4cf1('0x7d')]+'\x22';if(this['isConfigured'](_0x4ef0ca['options'])){_0x5d2035+=','+_0x4ef0ca[_0x4cf1('0x7a')];}var _0x340bab=this[_0x4cf1('0xf')][_0x4cf1('0x59')](_0x4cf1('0xa9'),_0x5d2035);if(_0x340bab['result']===-0x1){return _0x340bab;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xab'),_0x5d2035));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xac')]=function(_0x553888){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x553888[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x553888['grammar'])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20grammar\x20configured');}var _0x33de3d=_0x553888[_0x4cf1('0xad')];if(this[_0x4cf1('0x87')](_0x553888[_0x4cf1('0x7a')])){_0x33de3d+=','+_0x553888['options'];}var _0x527014=this[_0x4cf1('0xf')]['exec'](_0x4cf1('0xae'),_0x33de3d);if(_0x527014[_0x4cf1('0xa3')]===-0x1){return _0x527014;}var _0x54ff20=this[_0x4cf1('0xa2')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x54ff20[_0x4cf1('0xa3')]===-0x1){return _0x54ff20;}var _0x1bad47=this[_0x4cf1('0xa2')](_0x4cf1('0xaf'),_0x4cf1('0xb0'));if(_0x1bad47['result']===-0x1){return _0x1bad47;}var _0x10a502=this[_0x4cf1('0xa2')]('RECOG_INSTANCE()',_0x4cf1('0xb1'));if(_0x10a502[_0x4cf1('0xa3')]===-0x1){return _0x10a502;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xb2'),_0x33de3d));};AGIVertices[_0x4cf1('0x12')]['agi']=function(_0x5adb0d){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0xb3'),_0x5adb0d[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')][_0x4cf1('0xb4')]([_0x5adb0d[_0x4cf1('0xb5')],_0x5adb0d[_0x4cf1('0xb6')]]);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xb7')]=function(_0x2e31f1){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0xb8'),_0x2e31f1[_0x4cf1('0x3c')]));if(this[_0x4cf1('0x87')](_0x2e31f1['timeout'])){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2e31f1['timeout']));var _0x63bfc8=this[_0x4cf1('0xf')][_0x4cf1('0xb9')](_0x2e31f1['timeout']);if(_0x63bfc8['result']===-0x1){return _0x63bfc8;}}return this['channel']['answer']();};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x4d')]=function(_0x48c001){logger[_0x4cf1('0x33')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x48c001[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x48c001[_0x4cf1('0x4b')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x48c001,_0x4cf1('0xba'));}_0x48c001[_0x4cf1('0x4c')]=moment();if(this['isConfigured'](_0x48c001['delay'])){_0x48c001[_0x4cf1('0x4c')]=moment()[_0x4cf1('0xbb')](_0x48c001[_0x4cf1('0xbc')],'minutes');}if(!this['isConfigured'](_0x48c001['callback_priority'])){_0x48c001[_0x4cf1('0x50')]=0x2;}this['createCmContact'][_0x4cf1('0x70')](this,_0x48c001);return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x48c001[_0x4cf1('0xbd')],_0x48c001[_0x4cf1('0x4b')],_0x48c001[_0x4cf1('0x4c')]));};AGIVertices[_0x4cf1('0x12')]['custom_app']=function(_0x445d3e){logger['info'](util['format'](_0x4cf1('0xbe'),_0x445d3e['label']));var _0x21ca4f=this['channel']['exec'](_0x445d3e[_0x4cf1('0xbf')],_0x445d3e[_0x4cf1('0x7a')]);if(_0x21ca4f[_0x4cf1('0xa3')]===-0x1){return _0x21ca4f;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0xc0'),_0x445d3e[_0x4cf1('0xbf')],_0x445d3e['options']));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xc1')]=function(_0x3a3be9){logger['info'](util[_0x4cf1('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x3a3be9[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x3a3be9[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}var _0x28df1f='\x22'+_0x3a3be9['text']+'\x22';if(this['isConfigured'](_0x3a3be9[_0x4cf1('0x7a')])){_0x28df1f+=','+_0x3a3be9[_0x4cf1('0x7a')];}var _0x371b58=this[_0x4cf1('0xf')][_0x4cf1('0x59')](_0x4cf1('0xa9'),_0x28df1f);if(_0x371b58['result']===-0x1){return _0x371b58;}return this['channel'][_0x4cf1('0xaa')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x28df1f));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xc2')]=function(_0x39c80f){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x39c80f[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x39c80f[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20text\x20configured');}var _0x4b7a38='\x22'+_0x39c80f['text']+'\x22';if(this[_0x4cf1('0x87')](_0x39c80f[_0x4cf1('0x7a')])){_0x4b7a38+=','+_0x39c80f[_0x4cf1('0x7a')];}var _0xd1b0a2=this[_0x4cf1('0xf')][_0x4cf1('0x59')](_0x4cf1('0xa9'),_0x4b7a38);if(_0xd1b0a2[_0x4cf1('0xa3')]===-0x1){return _0xd1b0a2;}return this[_0x4cf1('0xf')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4b7a38));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xc3')]=function(_0x83c73e){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0xc4'),_0x83c73e[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x83c73e['grammar'])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xc5'));}var _0x493078=_0x83c73e[_0x4cf1('0xad')];if(this[_0x4cf1('0x87')](_0x83c73e[_0x4cf1('0x7a')])){_0x493078+=','+_0x83c73e[_0x4cf1('0x7a')];}var _0x14206b=this['channel'][_0x4cf1('0x59')](_0x4cf1('0xae'),_0x493078);if(_0x14206b[_0x4cf1('0xa3')]===-0x1){return _0x14206b;}var _0x2f084a=this[_0x4cf1('0xa2')]('RECOG_CONFIDENCE()',_0x4cf1('0xc6'));if(_0x2f084a[_0x4cf1('0xa3')]===-0x1){return _0x2f084a;}var _0x1561f5=this[_0x4cf1('0xa2')](_0x4cf1('0xaf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1561f5[_0x4cf1('0xa3')]===-0x1){return _0x1561f5;}var _0x4a00cb=this[_0x4cf1('0xa2')](_0x4cf1('0xc7'),'LUMENVOX_ASR_INSTANCE');if(_0x4a00cb[_0x4cf1('0xa3')]===-0x1){return _0x4a00cb;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xb2'),_0x493078));};AGIVertices['prototype'][_0x4cf1('0xc8')]=function(_0x26db70){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0xc9'),_0x26db70[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x26db70['grammar'])){return this[_0x4cf1('0xf')]['noop']('no\x20grammar\x20configured');}var _0x34ba89=_0x26db70['grammar'];if(this['isConfigured'](_0x26db70['options'])){_0x34ba89+=','+_0x26db70['options'];}var _0x59e46c=this[_0x4cf1('0xf')][_0x4cf1('0x59')]('MRCPRecog',_0x34ba89);if(_0x59e46c['result']===-0x1){return _0x59e46c;}var _0x240ca4=this[_0x4cf1('0xa2')](_0x4cf1('0xca'),_0x4cf1('0xcb'));if(_0x240ca4[_0x4cf1('0xa3')]===-0x1){return _0x240ca4;}var _0x1bd248=this[_0x4cf1('0xa2')](_0x4cf1('0xaf'),_0x4cf1('0xcc'));if(_0x1bd248[_0x4cf1('0xa3')]===-0x1){return _0x1bd248;}var _0x3def7f=this['getAndSetVariable'](_0x4cf1('0xc7'),_0x4cf1('0xcd'));if(_0x3def7f[_0x4cf1('0xa3')]===-0x1){return _0x3def7f;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xb2'),_0x34ba89));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xce')]=function(_0x563a03){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0xcf'),_0x563a03['label']));if(!this['isConfigured'](_0x563a03['odbc_id'])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x563a03,_0x4cf1('0xd0'));}var _0x4b8d38=this[_0x4cf1('0x1b')]['sync'](this,_0x563a03[_0x4cf1('0xd1')]);if(!_0x4b8d38){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x563a03,_0x4cf1('0xd2'));}if(!this['isConfigured'](_0x563a03[_0x4cf1('0x32')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x563a03,_0x4cf1('0xd3'));}var _0x1f62d9=_0x563a03['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4cf1('0xaa')](util['format'](_0x4cf1('0xd4'),_0x1f62d9));var _0x2dd478=this[_0x4cf1('0x2e')]['sync'](this,_0x4b8d38,_0x1f62d9);this[_0x4cf1('0x3a')]['sync'](this,_0x563a03,_0x1f62d9);if(!this[_0x4cf1('0x87')](_0x563a03[_0x4cf1('0xd5')])){return this['channel'][_0x4cf1('0xaa')](_0x4cf1('0xd6'));}var _0x2ed787=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x563a03[_0x4cf1('0xd5')]);if(!_0x2ed787){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x563a03,'no\x20variable\x20found');}var _0x269b82=this;_0x2dd478[_0x4cf1('0xd7')](function(_0x122204,_0x570d5a){Object['keys'](_0x122204)[_0x4cf1('0xd7')](function(_0x5ccf9c){_0x269b82['channel'][_0x4cf1('0xa4')](util['format'](_0x4cf1('0xd8'),_0x2ed787,_0x570d5a,_0x5ccf9c),_0x122204[_0x5ccf9c]);});});this[_0x4cf1('0xf')][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')]('%s_ROWS_COUNT',_0x2ed787),_0x2dd478[_0x4cf1('0x9b')]);return this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')]('variable\x20%s\x20set',_0x2ed787));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xd9')]=function(_0x4c82f3){logger['debug'](util[_0x4cf1('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4c82f3['label']));if(!this[_0x4cf1('0x87')](_0x4c82f3[_0x4cf1('0xda')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x4c82f3,_0x4cf1('0xdb'));}var _0x3661f6=this[_0x4cf1('0xdc')]['sync'](this,_0x4c82f3[_0x4cf1('0xda')]);if(!_0x3661f6){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x4c82f3,_0x4cf1('0xdd'));}var _0x5c1c23=this['channel']['exec'](_0x4cf1('0xde'),[util[_0x4cf1('0x2c')]('SIP/%s',_0x3661f6),_0x4c82f3[_0x4cf1('0x66')],_0x4c82f3['opts'],_0x4c82f3[_0x4cf1('0x72')]]);if(_0x5c1c23[_0x4cf1('0xa3')]===-0x1){return _0x5c1c23;}return this[_0x4cf1('0xf')]['noop'](util['format'](_0x4cf1('0xdf'),_0x4cf1('0xde')));};AGIVertices[_0x4cf1('0x12')]['dialogflow']=function(_0x5c3966){logger['info'](util[_0x4cf1('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5c3966[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x5c3966[_0x4cf1('0x7c')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xe0'));}if(!this[_0x4cf1('0x87')](_0x5c3966[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20text\x20configured');}this[_0x4cf1('0xf')]['bot']=!![];this[_0x4cf1('0x3a')](_0x5c3966);this[_0x4cf1('0x45')](_0x5c3966[_0x4cf1('0x7d')],'in','','');this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('Trying\x20Dialogflow:\x20%s',_0x5c3966[_0x4cf1('0x7d')]));var _0x5af9e1=this[_0x4cf1('0x7b')][_0x4cf1('0x70')](this,_0x5c3966);if(_0x5af9e1){for(var _0x5152ee in _0x5af9e1){if(_0x5af9e1[_0x4cf1('0x95')](_0x5152ee)){this['channel']['setVariable'](util[_0x4cf1('0x2c')](_0x4cf1('0xe1'),_0x5152ee[_0x4cf1('0x6a')]()),_0x5af9e1[_0x5152ee]);}}this[_0x4cf1('0x45')](_0x5af9e1[_0x4cf1('0xe2')],_0x4cf1('0xe3'),'dialogflow','');return this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xe4'),_0x5af9e1[_0x4cf1('0xe2')]));}return this[_0x4cf1('0xf')]['error'](_0x5c3966,_0x4cf1('0xe5'));};AGIVertices[_0x4cf1('0x12')]['dialogflowV2']=function(_0x1c11e8){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0xe6'),_0x1c11e8[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x1c11e8[_0x4cf1('0x80')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xe7'));}if(!this[_0x4cf1('0x87')](_0x1c11e8['client_email'])){return this['channel'][_0x4cf1('0xaa')]('no\x20client_email\x20configured');}if(!this[_0x4cf1('0x87')](_0x1c11e8['private_key'])){return this['channel'][_0x4cf1('0xaa')](_0x4cf1('0xe8'));}if(!this[_0x4cf1('0x87')](_0x1c11e8[_0x4cf1('0xe9')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20anguage\x20configured');}if(!this[_0x4cf1('0x87')](_0x1c11e8['text'])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}this[_0x4cf1('0xf')][_0x4cf1('0xea')]=!![];this[_0x4cf1('0x3a')](_0x1c11e8);this['createSquareMessage'](_0x1c11e8[_0x4cf1('0x7d')],'in','','');this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xeb'),_0x1c11e8[_0x4cf1('0x7d')]));var _0x723ce7=this[_0x4cf1('0x7f')]['sync'](this,_0x1c11e8);if(_0x723ce7){for(var _0x250fab in _0x723ce7){if(_0x723ce7['hasOwnProperty'](_0x250fab)){if(_0x250fab!==_0x4cf1('0xec')){this[_0x4cf1('0xf')][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')]('DIALOGFLOW_%s',_0x250fab['toUpperCase']()),_0x723ce7[_0x250fab]);}}}this[_0x4cf1('0x45')](_0x723ce7['speech'],_0x4cf1('0xe3'),_0x4cf1('0xed'),_0x723ce7[_0x4cf1('0xec')]);return this['channel'][_0x4cf1('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x723ce7[_0x4cf1('0xe2')]));}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x1c11e8,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x4cf1('0x12')]['sesteknda']=function(_0x5453d0){logger[_0x4cf1('0x33')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5453d0['label']));if(!this[_0x4cf1('0x87')](_0x5453d0[_0x4cf1('0xee')])){return this['channel'][_0x4cf1('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4cf1('0x87')](_0x5453d0[_0x4cf1('0xef')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xf0'));}if(!this[_0x4cf1('0x87')](_0x5453d0[_0x4cf1('0xf1')])){return this[_0x4cf1('0xf')]['noop'](_0x4cf1('0xf2'));}if(!this[_0x4cf1('0x87')](_0x5453d0[_0x4cf1('0xf3')])){return this['channel'][_0x4cf1('0xaa')]('no\x20text\x20configured');}this[_0x4cf1('0xf')][_0x4cf1('0xea')]=!![];this[_0x4cf1('0x3a')](_0x5453d0);this[_0x4cf1('0x45')](_0x5453d0['text'],'in','','');this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0xf4'),_0x5453d0[_0x4cf1('0x7d')]));var _0x57e2a4=this['sestekNDA']['sync'](this,_0x5453d0);if(_0x57e2a4){for(var _0x1783ee in _0x57e2a4){if(_0x57e2a4['hasOwnProperty'](_0x1783ee)){this[_0x4cf1('0xf')][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')]('SESTEK_NDA_%s',_0x1783ee[_0x4cf1('0x6a')]()),_0x57e2a4[_0x1783ee]);}}this[_0x4cf1('0x45')](_0x57e2a4[_0x4cf1('0xe2')],_0x4cf1('0xe3'),'sesteknda','');if(_0x57e2a4[_0x4cf1('0xf5')]){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xf6'),_0x57e2a4['audiofile']));var _0x42ef0a=this['channel'][_0x4cf1('0xf7')](_0x57e2a4[_0x4cf1('0xf5')]);try{fs[_0x4cf1('0xf8')](_0x57e2a4[_0x4cf1('0xf5')]+'.wav');}catch(_0x22d4d4){logger[_0x4cf1('0x30')](_0x22d4d4);}return _0x42ef0a;}else{return this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xf9'),_0x57e2a4[_0x4cf1('0xe2')]));}}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x5453d0,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xfa')]=function(_0x4736c2){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0xfb'),_0x4736c2['label']));return this['channel'][_0x4cf1('0xaa')](_0x4cf1('0xfa'));};AGIVertices[_0x4cf1('0x12')]['ext_dial']=function(_0x555703){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x555703[_0x4cf1('0x3c')]));var _0x3f93da='';if(_0x555703[_0x4cf1('0xfc')]){if(!this['isConfigured'](_0x555703['trunk_id'])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x555703,_0x4cf1('0xfd'));}else{var _0x1e8383=parseInt(_0x555703['trunk_id'],0xa);if(isNaN(_0x1e8383)){_0x3f93da=_0x555703[_0x4cf1('0xfc')];}else{_0x3f93da=this[_0x4cf1('0x1f')][_0x4cf1('0x70')](this,_0x555703[_0x4cf1('0xfc')]);if(!_0x3f93da){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x555703,_0x4cf1('0xfe'));}}}}else if(_0x555703[_0x4cf1('0xff')]){_0x3f93da=_0x555703[_0x4cf1('0xff')];}else{return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x555703,_0x4cf1('0xfd'));}var _0x3b09f4=this[_0x4cf1('0xf')][_0x4cf1('0x59')](_0x4cf1('0xde'),[util[_0x4cf1('0x2c')](_0x4cf1('0x100'),_0x3f93da,_0x555703[_0x4cf1('0xbd')]),_0x555703[_0x4cf1('0x66')],_0x555703['opts'],_0x555703[_0x4cf1('0x72')]]);if(_0x3b09f4[_0x4cf1('0xa3')]===-0x1){return _0x3b09f4;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('Executed\x20command\x20%s',_0x4cf1('0xde')));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x101')]=function(_0x15df3b){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x102'),_0x15df3b[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')]['noop'](_0x4cf1('0x101'));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x103')]=function(_0x50cec7){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x104'),_0x50cec7[_0x4cf1('0x3c')]));if(_0x50cec7[_0x4cf1('0xa6')]===0x0){return this['maxRetry'](_0x50cec7);}_0x50cec7['retry']-=0x1;if(!this[_0x4cf1('0x87')](_0x50cec7[_0x4cf1('0x105')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x50cec7,'no\x20file\x20audio\x20selected');}var _0x23b64e=this[_0x4cf1('0x21')]['sync'](this,_0x50cec7[_0x4cf1('0x105')]);if(!_0x23b64e){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x50cec7,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x50cec7[_0x4cf1('0xd5')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x4cf1('0xd6'));}var _0x5119e9=this[_0x4cf1('0xf')]['getData'](_0x23b64e,_0x50cec7['response'],_0x50cec7[_0x4cf1('0x106')]);var _0x2e904a=_0x5119e9['result']?_0x5119e9[_0x4cf1('0xa3')]['toString']():'';logger['info'](_0x4cf1('0x107'),JSON[_0x4cf1('0x74')](_0x5119e9));if(_0x5119e9[_0x4cf1('0xa3')]===-0x1){this[_0x4cf1('0x3a')]['sync'](this,_0x50cec7,_0x2e904a);return _0x5119e9;}else if(_0x5119e9['extra']===_0x4cf1('0x66')){_0x5119e9[_0x4cf1('0xa3')]=_0x2e904a[_0x4cf1('0x9b')]>=parseInt(_0x50cec7['mindigit'])?'x':'i';}else{_0x5119e9[_0x4cf1('0xa3')]=_0x2e904a[_0x4cf1('0x9b')]>=parseInt(_0x50cec7[_0x4cf1('0x108')])&&_0x2e904a[_0x4cf1('0x9b')]<=parseInt(_0x50cec7[_0x4cf1('0x106')])?'x':'i';}var _0x186e45=this['getVariable'][_0x4cf1('0x70')](this,_0x50cec7['variable_id']);if(!_0x186e45){return this['channel'][_0x4cf1('0x30')](_0x50cec7,_0x4cf1('0x109'));}this[_0x4cf1('0xf')]['setVariable'](_0x186e45,_0x2e904a);if(this[_0x4cf1('0x87')](_0x50cec7[_0x4cf1('0x10a')])){var _0x26771e=parseInt(_0x50cec7[_0x4cf1('0x10a')],0xa);var _0x581f1b=rs['generate']({'charset':'*','length':_0x26771e});var _0x270cd1=_0x2e904a[_0x4cf1('0x9b')];if(_0x270cd1>0x0){if(_0x270cd1>_0x26771e){this['createSquareDetailsReport'][_0x4cf1('0x70')](this,_0x50cec7,_0x50cec7['hiddendigitspos']===_0x4cf1('0x10b')?_0x581f1b+_0x2e904a[_0x4cf1('0x10c')](_0x26771e):_0x2e904a[_0x4cf1('0x10c')](0x0,_0x270cd1-_0x26771e)+_0x581f1b);}else{this['createSquareDetailsReport'][_0x4cf1('0x70')](this,_0x50cec7,rs[_0x4cf1('0x10d')]({'charset':'*','length':_0x270cd1}));}}else{this['createSquareDetailsReport']['sync'](this,_0x50cec7,'');}}else{this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x50cec7,_0x2e904a);}return _0x5119e9;};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xe')]=function(_0x9632b5){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x10e'),_0x9632b5[_0x4cf1('0x3c')]));return this[_0x4cf1('0x103')](_0x9632b5);};AGIVertices['prototype'][_0x4cf1('0x10f')]=function(_0x514661){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x110'),_0x514661[_0x4cf1('0x3c')]));this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x514661,_0x514661[_0x4cf1('0x111')]);return this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x112'),_0x514661[_0x4cf1('0x111')]));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x113')]=function(_0x2c400a){logger['info'](util[_0x4cf1('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2c400a[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x2c400a[_0x4cf1('0x8a')])||!this[_0x4cf1('0x87')](_0x2c400a[_0x4cf1('0x8b')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2c400a[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x114'),_0x2c400a[_0x4cf1('0x7d')]));var _0x5e77ad=this[_0x4cf1('0x89')][_0x4cf1('0x70')](this,_0x2c400a);if(_0x5e77ad){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x115'),_0x5e77ad));var _0x42e99e=this[_0x4cf1('0xf')][_0x4cf1('0xf7')](_0x5e77ad);try{fs[_0x4cf1('0xf8')](_0x5e77ad+_0x4cf1('0x116'));}catch(_0x28341d){logger[_0x4cf1('0x30')](_0x28341d);}return _0x42e99e;}return this[_0x4cf1('0xf')]['error'](_0x2c400a,_0x4cf1('0x117'));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x118')]=function(_0xa244bf){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x119'),_0xa244bf[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0xa244bf[_0x4cf1('0x8a')])||!this[_0x4cf1('0x87')](_0xa244bf[_0x4cf1('0x8b')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4cf1('0x87')](_0xa244bf[_0x4cf1('0x90')])){return this['channel']['noop'](_0x4cf1('0x11a'));}if(!this[_0x4cf1('0x87')](_0xa244bf['text'])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20text\x20configured');}this[_0x4cf1('0xf')][_0x4cf1('0xea')]=!![];this[_0x4cf1('0x3a')](_0xa244bf);this[_0x4cf1('0x45')](_0xa244bf[_0x4cf1('0x7d')],'in','','');this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('Trying\x20Amazon\x20Lex:\x20%s',_0xa244bf[_0x4cf1('0x7d')]));var _0x16a0b8=this[_0x4cf1('0x8f')][_0x4cf1('0x70')](this,_0xa244bf);if(_0x16a0b8){for(var _0x2e9e6a in _0x16a0b8){if(_0x16a0b8[_0x4cf1('0x95')](_0x2e9e6a)&&_[_0x4cf1('0x96')](_0x16a0b8[_0x2e9e6a])){this[_0x4cf1('0xf')][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')](_0x4cf1('0x11b'),_0x2e9e6a[_0x4cf1('0x6a')]()),_0x16a0b8[_0x2e9e6a]);}}if(_['isNil'](_0x16a0b8[_0x4cf1('0x78')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x11c'));}else{this[_0x4cf1('0x45')](_0x16a0b8[_0x4cf1('0x78')],_0x4cf1('0xe3'),_0x4cf1('0x11d'),'');return this[_0x4cf1('0xf')]['noop'](util['format'](_0x4cf1('0x11e'),_0x16a0b8[_0x4cf1('0x78')]));}}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0xa244bf,_0x4cf1('0x11f'));};AGIVertices['prototype'][_0x4cf1('0x120')]=function(_0x445dfd){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x121'),_0x445dfd['label'],_0x445dfd[_0x4cf1('0x66')]));if(!this['isConfigured'](_0x445dfd['key'])){return this['channel'][_0x4cf1('0xaa')](_0x4cf1('0xe0'));}var _0x39230d='wav';var _0x1964a9=util['format'](_0x4cf1('0x122'),FILES_PATH,rs[_0x4cf1('0x10d')](0x4));var _0x488c0e=util['format'](_0x4cf1('0x9d'),_0x1964a9,_0x39230d);var _0x278fa8=!![];if(_0x445dfd[_0x4cf1('0x123')]===_0x4cf1('0x124')){_0x278fa8=![];}var _0x225429=this[_0x4cf1('0xf')][_0x4cf1('0x125')](_0x1964a9,_0x39230d,_0x445dfd['intKey'],_0x445dfd[_0x4cf1('0x66')],undefined,_0x278fa8);if(_0x225429['result']!==-0x1){this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x126'),_0x488c0e));var _0x1e3800=this[_0x4cf1('0x127')][_0x4cf1('0x70')](this,_0x445dfd,_0x488c0e);if(_0x1e3800){for(var _0xcd7445 in _0x1e3800){if(_0x1e3800[_0x4cf1('0x95')](_0xcd7445)){this[_0x4cf1('0xf')]['setVariable'](util[_0x4cf1('0x2c')](_0x4cf1('0x128'),_0xcd7445[_0x4cf1('0x6a')]()),_0x1e3800[_0xcd7445]);}}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x129'),JSON[_0x4cf1('0x74')](_0x1e3800)));}}return _0x225429;};AGIVertices['prototype'][_0x4cf1('0x12a')]=function(_0x235a41){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x12b'),_0x235a41[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x235a41[_0x4cf1('0x92')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x12c'));}if(!this[_0x4cf1('0x87')](_0x235a41[_0x4cf1('0x12d')])){return this['channel'][_0x4cf1('0xaa')](_0x4cf1('0x12e'));}var _0x1afe1f=_0x4cf1('0x12f');var _0x2d69c1=util['format'](_0x4cf1('0x122'),FILES_PATH,rs[_0x4cf1('0x10d')](0x4));var _0x592612=util[_0x4cf1('0x2c')](_0x4cf1('0x9d'),_0x2d69c1,_0x1afe1f);var _0x274cea=!![];if(_0x235a41[_0x4cf1('0x123')]===_0x4cf1('0x124')){_0x274cea=![];}var _0x14304c=this[_0x4cf1('0xf')][_0x4cf1('0x125')](_0x2d69c1,_0x1afe1f,_0x235a41[_0x4cf1('0x130')],_0x235a41[_0x4cf1('0x66')],undefined,_0x274cea);if(_0x14304c[_0x4cf1('0xa3')]!==-0x1){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x131'),_0x592612));var _0x35c923=this[_0x4cf1('0x91')]['sync'](this,_0x235a41,_0x592612);if(_0x35c923){for(var _0x5092ef in _0x35c923){if(_0x35c923['hasOwnProperty'](_0x5092ef)){this['channel']['setVariable'](util[_0x4cf1('0x2c')]('TILDE_ASR_%s',_0x5092ef[_0x4cf1('0x6a')]()),_0x35c923[_0x5092ef]);}}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x132'),JSON[_0x4cf1('0x74')](_0x35c923)));}}return _0x14304c;};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x133')]=function(_0x198131){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x134'),_0x198131['label']));return this[_0x4cf1('0xf')]['continueAt'](_0x198131[_0x4cf1('0x135')],_0x198131[_0x4cf1('0x41')],_0x198131[_0x4cf1('0x42')]);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x136')]=function(_0x4d927a){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x137'),_0x4d927a[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x4d927a[_0x4cf1('0x138')])){return this[_0x4cf1('0xf')]['error'](_0x4d927a,'no\x20condition\x20configured');}try{var _0x68c8ca=eval(_0x4d927a[_0x4cf1('0x138')])?_0x4cf1('0x139'):_0x4cf1('0x13a');this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x13b'),_0x4d927a[_0x4cf1('0x138')],_0x68c8ca));return{'code':0xc8,'result':_0x68c8ca};}catch(_0x157b54){return{'code':0xc8,'result':_0x4cf1('0x13a')};}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x13c')]=function(_0x14c9a3){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x13d'),_0x14c9a3[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x14c9a3[_0x4cf1('0x13e')])){return this[_0x4cf1('0xf')]['error'](_0x14c9a3,_0x4cf1('0x13f'));}var _0x13b306=this[_0x4cf1('0x140')]['sync'](this,_0x14c9a3['interval_id']);if(!_0x13b306){return this['channel']['error'](_0x14c9a3,_0x4cf1('0x141'));}for(var _0x1bcb41=0x0;_0x1bcb41<_0x13b306[_0x4cf1('0x9b')];_0x1bcb41+=0x1){var _0x5d9cd3=this[_0x4cf1('0xf')][_0x4cf1('0x13')](util[_0x4cf1('0x2c')]('IFTIME(%s?true:false)',_0x13b306[_0x1bcb41]));if(_0x5d9cd3[_0x4cf1('0xa3')]===-0x1){return _0x5d9cd3;}logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x142'),_0x13b306[_0x1bcb41],_0x5d9cd3[_0x4cf1('0xa1')]));if(_0x5d9cd3[_0x4cf1('0xa1')]===_0x4cf1('0x139')){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x142'),_0x13b306[_0x1bcb41],'true'));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x142'),_0x13b306[_0x1bcb41],_0x4cf1('0x139')));return{'code':0xc8,'result':_0x4cf1('0x139')};}else{logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x142'),_0x13b306[_0x1bcb41],_0x4cf1('0x13a')));this['channel']['noop'](util['format']('IFTIME\x20%s\x20%s',_0x13b306[_0x1bcb41],_0x4cf1('0x13a')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x143')]=function(_0x132ccf){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x144'),_0x132ccf[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')][_0x4cf1('0x143')]();};AGIVertices[_0x4cf1('0x12')]['ispeechasr']=function(_0x30f93f){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x145'),_0x30f93f['label']));if(!this[_0x4cf1('0x87')](_0x30f93f[_0x4cf1('0x7c')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xe0'));}var _0x4a8c29=_0x4cf1('0x12f');var _0x1f64f7=util['format'](_0x4cf1('0x122'),FILES_PATH,rs['generate'](0x4));var _0x57395c=util[_0x4cf1('0x2c')](_0x4cf1('0x9d'),_0x1f64f7,_0x4a8c29);var _0x57f3bc=!![];if(_0x30f93f[_0x4cf1('0x123')]==='NOBEEP'){_0x57f3bc=![];}var _0xc0bca0=this['channel'][_0x4cf1('0x125')](_0x1f64f7,_0x4a8c29,_0x30f93f[_0x4cf1('0x130')],_0x30f93f[_0x4cf1('0x66')],undefined,_0x57f3bc);if(_0xc0bca0[_0x4cf1('0xa3')]!==-0x1){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x146'),_0x57395c));var _0x39bf85=this[_0x4cf1('0x86')][_0x4cf1('0x70')](this,_0x30f93f,_0x57395c);if(_0x39bf85){for(var _0x46b37f in _0x39bf85){if(_0x39bf85[_0x4cf1('0x95')](_0x46b37f)){this[_0x4cf1('0xf')]['setVariable'](util[_0x4cf1('0x2c')](_0x4cf1('0x147'),_0x46b37f[_0x4cf1('0x6a')]()),_0x39bf85[_0x46b37f]);}}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x148'),JSON[_0x4cf1('0x74')](_0x39bf85)));}}return _0xc0bca0;};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x149')]=function(_0x269639){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x14a'),_0x269639[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x269639[_0x4cf1('0x7c')])){return this[_0x4cf1('0xf')]['noop']('no\x20key\x20configured');}if(!this[_0x4cf1('0x87')](_0x269639[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x14b'),_0x269639[_0x4cf1('0x7d')]));var _0x2bafe6=this[_0x4cf1('0x84')][_0x4cf1('0x70')](this,_0x269639);if(_0x2bafe6){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('ispeech\x20%s\x20file\x20created',_0x2bafe6));var _0x420af2=this[_0x4cf1('0xf')]['streamFile'](_0x2bafe6,_0x269639['intKey']);try{fs[_0x4cf1('0xf8')](_0x2bafe6+_0x4cf1('0x116'));}catch(_0xc6aa79){logger[_0x4cf1('0x30')](_0xc6aa79);}return _0x420af2;}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x269639,_0x4cf1('0x14c'));};AGIVertices['prototype']['login']=function(_0x57f9dd){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x14d'),_0x57f9dd[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x57f9dd[_0x4cf1('0x14e')])){return this[_0x4cf1('0xf')]['error'](_0x57f9dd,_0x4cf1('0x14f'));}logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x150'),this[_0x4cf1('0xf')]['callerid'],_0x57f9dd['findBy']));var _0x29e6ad=this[_0x4cf1('0x55')][_0x4cf1('0x70')](this,_0x57f9dd['findBy']);if(_0x29e6ad){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x57f9dd[_0x4cf1('0x14e')]));this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x57f9dd[_0x4cf1('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x152'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x57f9dd['findBy']));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x152'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x57f9dd[_0x4cf1('0x14e')]));return{'code':0xc8,'result':_0x4cf1('0x153')};}};AGIVertices['prototype']['logout']=function(_0x5d6575){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x154'),_0x5d6575[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x5d6575[_0x4cf1('0x14e')])){return this['channel'][_0x4cf1('0x30')](_0x5d6575,_0x4cf1('0x14f'));}logger[_0x4cf1('0x33')](util['format'](_0x4cf1('0x150'),this[_0x4cf1('0xf')]['callerid'],_0x5d6575[_0x4cf1('0x14e')]));var _0x3bec9d=this[_0x4cf1('0x54')][_0x4cf1('0x70')](this,_0x5d6575[_0x4cf1('0x14e')]);if(_0x3bec9d){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x5d6575['findBy']));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this['channel']['callerid'],_0x5d6575[_0x4cf1('0x14e')]));return{'code':0xc8,'result':_0x4cf1('0x155')};}else{logger[_0x4cf1('0x33')](util['format'](_0x4cf1('0x152'),this['channel'][_0x4cf1('0x3f')],_0x5d6575[_0x4cf1('0x14e')]));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x152'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x5d6575[_0x4cf1('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x156')]=function(_0x586c71){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x157'),_0x586c71[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x586c71[_0x4cf1('0x158')])){return this[_0x4cf1('0xf')]['error'](_0x586c71,_0x4cf1('0x159'));}this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x15a'),_0x586c71['operation']));var _0x59ba72=eval(_0x586c71[_0x4cf1('0x158')]);if(!this['isConfigured'](_0x586c71[_0x4cf1('0xd5')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xd6'));}var _0x610921=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x586c71[_0x4cf1('0xd5')]);if(!_0x610921){return this[_0x4cf1('0xf')]['error'](_0x586c71,'no\x20variable\x20found');}if(_[_0x4cf1('0x9e')](_0x59ba72)){var _0x5c9d5e=this;_0x59ba72[_0x4cf1('0xd7')](function(_0x54c02f,_0x4ab2b1){_0x5c9d5e[_0x4cf1('0xf')][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')]('%s[%s]',_0x610921,_0x4ab2b1),_0x54c02f);});return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x15b'),_0x610921));}else{return this[_0x4cf1('0xf')][_0x4cf1('0xa4')](_0x610921,_0x59ba72);}};AGIVertices[_0x4cf1('0x12')]['menu']=function(_0x1037be){logger[_0x4cf1('0x33')](util['format'](_0x4cf1('0x15c'),_0x1037be[_0x4cf1('0x3c')]));if(_0x1037be[_0x4cf1('0xa6')]===0x0){return this[_0x4cf1('0xa5')](_0x1037be);}_0x1037be[_0x4cf1('0xa6')]-=0x1;if(!this[_0x4cf1('0x87')](_0x1037be[_0x4cf1('0x105')])){return this['channel'][_0x4cf1('0x30')](_0x1037be,_0x4cf1('0x15d'));}var _0x4ef0fc=this['getSound'][_0x4cf1('0x70')](this,_0x1037be[_0x4cf1('0x105')]);if(!_0x4ef0fc){return this[_0x4cf1('0xf')]['error'](_0x1037be,_0x4cf1('0x15e'));}var _0x239abf=this[_0x4cf1('0xf')]['getData'](_0x4ef0fc,_0x1037be[_0x4cf1('0x15f')],_0x1037be['digit']);var _0x52d02f=_0x239abf['result'];if(_0x239abf['result']===-0x1){this[_0x4cf1('0x3a')]['sync'](this,_0x1037be,'-1');return _0x239abf;}else if(_0x239abf[_0x4cf1('0xa1')]==='timeout'){_0x239abf['result']=_0x239abf[_0x4cf1('0xa3')]['length']>0x0?_0x239abf['result']:'t';}else if(_[_0x4cf1('0x49')](_0x239abf[_0x4cf1('0xa3')])){_0x239abf[_0x4cf1('0xa3')]='#';_0x52d02f='#';}if(!this[_0x4cf1('0x87')](_0x1037be[_0x4cf1('0xd5')])){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xd6'));}else{var _0x173ad8=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x1037be[_0x4cf1('0xd5')]);if(!_0x173ad8){return this[_0x4cf1('0xf')]['error'](_0x1037be,_0x4cf1('0x109'));}this[_0x4cf1('0xf')][_0x4cf1('0xa4')](_0x173ad8,_0x52d02f);}this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x1037be,_0x52d02f);return _0x239abf;};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0xaa')]=function(_0xbc33ef){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x160'),_0xbc33ef[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0xbc33ef[_0x4cf1('0x161')]||_0xbc33ef[_0x4cf1('0x3c')]);};AGIVertices['prototype'][_0x4cf1('0x162')]=function(_0x187c16){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x163'),_0x187c16['label']));if(!this[_0x4cf1('0x87')](_0x187c16['findBy'])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x187c16,_0x4cf1('0x14f'));}logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x187c16[_0x4cf1('0x14e')]));var _0x57d7d8=this[_0x4cf1('0x164')][_0x4cf1('0x70')](this,_0x187c16[_0x4cf1('0x165')]);var _0x1b90c8=this[_0x4cf1('0x166')]['sync'](this,_0x187c16[_0x4cf1('0x14e')],_0x57d7d8);if(_0x1b90c8){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x187c16[_0x4cf1('0x14e')]));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x187c16['findBy']));return{'code':0xc8,'result':_0x4cf1('0x155')};}else{logger[_0x4cf1('0x33')](util['format'](_0x4cf1('0x152'),this[_0x4cf1('0xf')]['callerid'],_0x187c16[_0x4cf1('0x14e')]));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this[_0x4cf1('0xf')]['callerid'],_0x187c16['findBy']));return{'code':0xc8,'result':_0x4cf1('0x153')};}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x167')]=function(_0x4cde24){logger['info'](util[_0x4cf1('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4cde24[_0x4cf1('0x3c')]));if(!this['isConfigured'](_0x4cde24['file_id'])){return this[_0x4cf1('0xf')]['error'](_0x4cde24,'no\x20file\x20audio\x20selected');}var _0x479350=this[_0x4cf1('0x21')][_0x4cf1('0x70')](this,_0x4cde24[_0x4cf1('0x105')]);if(!_0x479350){return this['channel'][_0x4cf1('0x30')](_0x4cde24,_0x4cf1('0x15e'));}var _0x2796cb=this[_0x4cf1('0xf')][_0x4cf1('0x59')]('PLAYBACK',[_0x479350,_0x4cde24[_0x4cf1('0x168')]]);if(_0x2796cb[_0x4cf1('0xa3')]===-0x1){return _0x2796cb;}return this['channel']['noop'](util['format'](_0x4cf1('0xc0'),'PLAYBACK',_0x479350));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x169')]=function(_0x52bb1d){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x16a'),_0x52bb1d[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x52bb1d['queue_id'])){return this['channel'][_0x4cf1('0x30')](_0x52bb1d,_0x4cf1('0x16b'));}var _0xd07b15='';var _0xef405c=parseInt(_0x52bb1d['queue_id'],0xa);if(isNaN(_0xef405c)){_0xd07b15=_0x52bb1d[_0x4cf1('0x16c')];}else{_0xd07b15=this[_0x4cf1('0x18')]['sync'](this,_0x52bb1d[_0x4cf1('0x16c')]);if(!_0xd07b15){return this[_0x4cf1('0xf')]['error'](_0x52bb1d,_0x4cf1('0x16d'));}}var _0x542596='';if(this['isConfigured'](_0x52bb1d[_0x4cf1('0x105')])){var _0x1f8646=this[_0x4cf1('0x21')][_0x4cf1('0x70')](this,_0x52bb1d['file_id']);if(_0x1f8646){_0x542596=_0x1f8646;}}this[_0x4cf1('0x3a')]['sync'](this,_0x52bb1d,_0xd07b15);if(_0x52bb1d['opts'][_0x4cf1('0x16e')]('x')<0x0){_0x52bb1d['opts']+='x';}if(_0x52bb1d['opts'][_0x4cf1('0x16e')]('X')<0x0){_0x52bb1d[_0x4cf1('0x168')]+='X';}this[_0x4cf1('0xf')][_0x4cf1('0xa4')]('XMCS-QUEUE',_0xd07b15?_0xd07b15[_0x4cf1('0x16f')]():'');var _0x338730=this[_0x4cf1('0xf')][_0x4cf1('0x59')](_0x4cf1('0x170'),[_0xd07b15,_0x52bb1d[_0x4cf1('0x168')],_0x52bb1d[_0x4cf1('0x72')],_0x542596,_0x52bb1d[_0x4cf1('0x66')],_0x52bb1d[_0x4cf1('0xb4')],_0x52bb1d[_0x4cf1('0x171')],_0x52bb1d[_0x4cf1('0x172')],'',_0x52bb1d[_0x4cf1('0x173')]]);if(_0x338730[_0x4cf1('0xa3')]===-0x1){return _0x338730;}return this[_0x4cf1('0xf')]['noop'](util['format'](_0x4cf1('0xc0'),_0x4cf1('0x170'),_0xd07b15));};AGIVertices['prototype'][_0x4cf1('0x174')]=function(_0x3ec644){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x175'),_0x3ec644[_0x4cf1('0x3c')]));var _0x1fe4b7=_0x3ec644[_0x4cf1('0x176')]||_0x4cf1('0x12f');var _0x5cdf22=util['format'](_0x4cf1('0x177'),this[_0x4cf1('0xf')]['uniqueid'],rs['generate'](0x5));var _0x481631=util[_0x4cf1('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x5cdf22,_0x1fe4b7);var _0x166d18=util[_0x4cf1('0x2c')](_0x4cf1('0x122'),FILES_PATH,_0x5cdf22);this[_0x4cf1('0x40')][_0x4cf1('0x70')](this,_0x3ec644,_0x5cdf22,_0x481631);this[_0x4cf1('0xf')][_0x4cf1('0xa4')]('RECORDING_SAVENAME',_0x5cdf22);logger[_0x4cf1('0x33')](_0x4cf1('0x178'),_0x166d18,_0x1fe4b7,_0x3ec644['escape_digits'],_0x3ec644[_0x4cf1('0x66')]);return this['channel']['recordFile'](_0x166d18,_0x1fe4b7,_0x3ec644[_0x4cf1('0x179')],_0x3ec644['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x50d60c){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x50d60c[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x50d60c[_0x4cf1('0x72')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x17a'));}var _0x25fec4=this['restAPI']['sync'](this,_0x50d60c);logger['info'](util['format'](_0x4cf1('0x17b'),util[_0x4cf1('0x17c')](_0x25fec4,{'showHidden':![],'depth':null})));if(!this[_0x4cf1('0x87')](_0x50d60c[_0x4cf1('0xd5')])){return this[_0x4cf1('0xf')]['noop'](_0x4cf1('0x17d'));}var _0x290ed6=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x50d60c[_0x4cf1('0xd5')]);if(!_0x290ed6){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x50d60c,_0x4cf1('0x109'));}this['channel']['setVariable'](util['format'](_0x4cf1('0x17e'),_0x290ed6),_0x25fec4[_0x4cf1('0x76')]?_0x25fec4['statusCode']:_0x4cf1('0x17f'));this['channel'][_0x4cf1('0xa4')](util[_0x4cf1('0x2c')](_0x4cf1('0x180'),_0x290ed6),_0x25fec4[_0x4cf1('0x77')]?_0x25fec4[_0x4cf1('0x77')]:'OK');if(_0x25fec4[_0x4cf1('0x6b')]){try{this[_0x4cf1('0x9c')](_0x25fec4[_0x4cf1('0x6b')],_0x290ed6);}catch(_0x3de40c){logger['error'](util[_0x4cf1('0x2c')](_0x4cf1('0x181'),_0x290ed6));}}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x182'),_0x290ed6));};AGIVertices[_0x4cf1('0x12')]['saydigits']=function(_0x1f7fbb){logger['info'](util[_0x4cf1('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1f7fbb[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')][_0x4cf1('0x183')](_0x1f7fbb['digits'][_0x4cf1('0x5b')](/\s+/g,''),_0x1f7fbb['escape_digits']);};AGIVertices[_0x4cf1('0x12')]['saynumber']=function(_0x5d5ea1){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5d5ea1['label']));return this[_0x4cf1('0xf')][_0x4cf1('0x184')](_0x5d5ea1[_0x4cf1('0x67')][_0x4cf1('0x5b')](/\s+/g,''),_0x5d5ea1[_0x4cf1('0x179')]);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x185')]=function(_0x4f0830){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x186'),_0x4f0830[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')]['sayPhonetic'](_0x4f0830[_0x4cf1('0x7d')],_0x4f0830['escape_digits']);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x187')]=function(_0x23dd79){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x188'),_0x23dd79['label']));if(!this[_0x4cf1('0x87')](_0x23dd79['account_id'])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('no\x20mail\x20account\x20configured');}var _0x2bd837=this[_0x4cf1('0x189')]['sync'](this,_0x23dd79[_0x4cf1('0x18a')]);if(!_0x2bd837||!_0x2bd837[_0x4cf1('0x18b')]){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x23dd79,_0x4cf1('0x18c'));}var _0x560530={'from':util[_0x4cf1('0x2c')]('\x22%s\x22\x20<%s>',_0x2bd837['name'],_0x2bd837['email']||_0x2bd837[_0x4cf1('0x18b')]['user']),'to':_0x23dd79['to']||'','cc':_0x23dd79['cc']||'','bcc':_0x23dd79[_0x4cf1('0x18d')]||'','subject':_0x23dd79[_0x4cf1('0x18e')],'html':_0x23dd79['text'],'text':_0x23dd79[_0x4cf1('0x7d')]};if(this['isConfigured'](_0x23dd79[_0x4cf1('0x18f')])){}logger[_0x4cf1('0x190')](_0x4cf1('0x191'),JSON[_0x4cf1('0x74')](_0x560530));this['createSquareDetailsReport']['sync'](this,_0x23dd79,_0x23dd79[_0x4cf1('0x18a')]);this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x2bd837['name']));this[_0x4cf1('0x26')][_0x4cf1('0x70')](this,_0x2bd837[_0x4cf1('0x192')],_0x560530);return this[_0x4cf1('0xf')][_0x4cf1('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x193')]=function(_0x132be7){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x194'),_0x132be7[_0x4cf1('0x3c')]));return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x195'));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x196')]=function(_0x899e6e){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x899e6e['label']));if(!this[_0x4cf1('0x87')](_0x899e6e[_0x4cf1('0x197')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x198'));}var _0x133943=this[_0x4cf1('0x37')]['sync'](this,_0x899e6e[_0x4cf1('0x197')]);if(!_0x133943){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x899e6e,'no\x20sms\x20account\x20found');}var _0x2ad23f={'body':_0x899e6e[_0x4cf1('0x199')],'phone':_0x899e6e['to']||'','SmsAccountId':_0x133943['id']};logger[_0x4cf1('0x190')](_0x4cf1('0x19a'),JSON[_0x4cf1('0x74')](_0x2ad23f));this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x899e6e,_0x899e6e['sms_account_id']);this['channel'][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x19b'),_0x133943['name']));this['createSmsMessage'][_0x4cf1('0x70')](this,_0x2ad23f);return this[_0x4cf1('0xf')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x5e0731){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x19c'),_0x5e0731[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x5e0731[_0x4cf1('0xd5')])){return this[_0x4cf1('0xf')]['error'](_0x5e0731,'no\x20variable\x20selected');}var _0x118fdc=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x5e0731[_0x4cf1('0xd5')]);if(!_0x118fdc){return this[_0x4cf1('0xf')]['error'](_0x5e0731,_0x4cf1('0x109'));}return this[_0x4cf1('0xf')][_0x4cf1('0xa4')](_0x118fdc,_0x5e0731[_0x4cf1('0x19d')]);};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x19e')]=function(_0x26fe36){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x19f'),_0x26fe36['label']));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0x1a0'));if(_0x26fe36[_0x4cf1('0xb7')]==='yes'){this[_0x4cf1('0xf')]['noop']('Answer');return this[_0x4cf1('0xf')][_0x4cf1('0xb7')]();}return this[_0x4cf1('0xf')]['noop']('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x2b12d1){logger[_0x4cf1('0x33')](util['format'](_0x4cf1('0x1a1'),_0x2b12d1[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x2b12d1[_0x4cf1('0x1a2')])){return this['channel']['error'](_0x2b12d1,_0x4cf1('0x1a3'));}var _0x17516a=this['getSquareProject'][_0x4cf1('0x70')](this,_0x2b12d1[_0x4cf1('0x1a2')]);if(!this[_0x4cf1('0x87')](_0x17516a)){return this[_0x4cf1('0xf')]['error'](_0x2b12d1,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2b12d1['project_id']));}if(_0x17516a===this[_0x4cf1('0xf')][_0x4cf1('0x3e')]){return this['channel']['error'](_0x2b12d1,_0x4cf1('0x1a4'));}this[_0x4cf1('0x3a')][_0x4cf1('0x70')](this,_0x2b12d1,_0x17516a);var _0x38983a=this[_0x4cf1('0xf')]['exec'](_0x4cf1('0x1a5'),util[_0x4cf1('0x2c')](_0x4cf1('0x1a6'),config[_0x4cf1('0xb4')][_0x4cf1('0x1a7')]||_0x4cf1('0x1a8'),_0x17516a,this['channel'][_0x4cf1('0x3e')]));if(_0x38983a[_0x4cf1('0xa3')]===-0x1){return _0x38983a;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xc0'),_0x4cf1('0x1a5'),_0x17516a));};AGIVertices[_0x4cf1('0x12')]['system']=function(_0x19a163){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x1a9'),_0x19a163[_0x4cf1('0x3c')]));var _0xc7c1ca=this[_0x4cf1('0x58')]['sync'](this,_0x19a163[_0x4cf1('0xb5')]);this[_0x4cf1('0x3a')]['sync'](this,_0x19a163,_0x19a163['command']);if(this[_0x4cf1('0x87')](_0x19a163[_0x4cf1('0xd5')])){var _0x5065cb=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x19a163['variable_id']);if(_0x5065cb){this['channel'][_0x4cf1('0xa4')](_0x5065cb,_0xc7c1ca);return this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x1aa'),_0x19a163[_0x4cf1('0xb5')],_0x5065cb));}}return this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x1ab'),_0x19a163[_0x4cf1('0xb5')]));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x1ac')]=function(_0x552a57){logger['info'](util[_0x4cf1('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x552a57[_0x4cf1('0x3c')]));_0x552a57[_0x4cf1('0x7d')]=_0x552a57[_0x4cf1('0x7d')][_0x4cf1('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x552a57[_0x4cf1('0x5d')])){return this['channel'][_0x4cf1('0xaa')]('no\x20apiKey\x20configured');}if(!this[_0x4cf1('0x87')](_0x552a57[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x1ad'),_0x552a57[_0x4cf1('0x7d')]));var _0x23ab71=this[_0x4cf1('0x5c')][_0x4cf1('0x70')](this,_0x552a57);if(_0x23ab71){this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x1ae'),_0x23ab71));var _0x5642a1=this[_0x4cf1('0xf')][_0x4cf1('0xf7')](_0x23ab71);try{fs[_0x4cf1('0xf8')](_0x23ab71+_0x4cf1('0x116'));}catch(_0x42a96d){logger[_0x4cf1('0x30')](_0x42a96d);}return _0x5642a1;}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x552a57,_0x4cf1('0x1af'));};AGIVertices[_0x4cf1('0x12')]['tts']=function(_0x4bfab2){logger['info'](util[_0x4cf1('0x2c')](_0x4cf1('0x1b0'),_0x4bfab2[_0x4cf1('0x3c')]));_0x4bfab2[_0x4cf1('0x7d')]=_0x4bfab2[_0x4cf1('0x7d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4cf1('0x87')](_0x4bfab2[_0x4cf1('0x7d')])){return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](_0x4cf1('0xa8'));}this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x1b1'),_0x4bfab2[_0x4cf1('0x7d')]));var _0x3a6522=this['googleTTS']['sync'](this,_0x4bfab2);if(_0x3a6522){this['channel'][_0x4cf1('0xaa')](util['format'](_0x4cf1('0x1b2'),_0x3a6522));var _0x23384c=this['channel']['streamFile'](_0x3a6522);try{fs['unlink'](_0x3a6522+_0x4cf1('0x116'));}catch(_0x172a4e){logger[_0x4cf1('0x30')](_0x172a4e);}return _0x23384c;}return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x4bfab2,_0x4cf1('0x1b3'));};AGIVertices['prototype'][_0x4cf1('0x1b4')]=function(_0x456f53){logger['info'](util['format'](_0x4cf1('0x1b5'),_0x456f53[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x456f53['findBy'])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x456f53,_0x4cf1('0x14f'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x456f53[_0x4cf1('0x14e')]));var _0x42e69b=this['agentUnpause'][_0x4cf1('0x70')](this,_0x456f53['findBy']);if(_0x42e69b){logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this[_0x4cf1('0xf')]['callerid'],_0x456f53[_0x4cf1('0x14e')]));this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0x151'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x456f53[_0x4cf1('0x14e')]));return{'code':0xc8,'result':_0x4cf1('0x155')};}else{logger[_0x4cf1('0x33')](util[_0x4cf1('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x456f53['findBy']));this[_0x4cf1('0xf')]['noop'](util[_0x4cf1('0x2c')](_0x4cf1('0x152'),this[_0x4cf1('0xf')][_0x4cf1('0x3f')],_0x456f53[_0x4cf1('0x14e')]));return{'code':0xc8,'result':_0x4cf1('0x153')};}};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x1b6')]=function(_0x540f77){logger['info'](util['format'](_0x4cf1('0x1b7'),_0x540f77[_0x4cf1('0x3c')]));var _0x4eba1d=this[_0x4cf1('0xf')]['exec']('VOICEMAIL',[_0x540f77[_0x4cf1('0x1b8')],_0x540f77['options']]);if(_0x4eba1d[_0x4cf1('0xa3')]===-0x1){return _0x4eba1d;}return this[_0x4cf1('0xf')][_0x4cf1('0xaa')](util[_0x4cf1('0x2c')](_0x4cf1('0xc0'),'VOICEMAIL',_0x540f77[_0x4cf1('0x1b8')]));};AGIVertices[_0x4cf1('0x12')][_0x4cf1('0x1b9')]=function(_0x25cbdb){logger[_0x4cf1('0x33')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x25cbdb[_0x4cf1('0x3c')]));if(!this[_0x4cf1('0x87')](_0x25cbdb[_0x4cf1('0xd5')])){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x25cbdb,_0x4cf1('0x1ba'));}var _0x6973a5=this[_0x4cf1('0x13')][_0x4cf1('0x70')](this,_0x25cbdb['variable_id']);if(!_0x6973a5){return this[_0x4cf1('0xf')][_0x4cf1('0x30')](_0x25cbdb,'no\x20variable\x20found');}var _0x278067=this[_0x4cf1('0xf')][_0x4cf1('0x13')](_0x6973a5);return{'code':0xc8,'result':_0x278067[_0x4cf1('0xa1')]?_0x278067[_0x4cf1('0xa1')]:'-'};};String['prototype'][_0x4cf1('0xa0')]=function(_0x2eec1b,_0x77823e){return this[_0x4cf1('0x9f')](_0x2eec1b)[_0x4cf1('0x1bb')](_0x77823e);};module[_0x4cf1('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ca7f3a6..f1e6b1c 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 _0x40f3=['attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','hangup','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','interface','queue','ACW','mandatoryDisposition','name','Action','then','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0x40f3,0x86));var _0x340f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x40f3[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x340f('0x0'));var moment=require(_0x340f('0x1'));var ami=require(_0x340f('0x2'));var logger=require(_0x340f('0x3'))(_0x340f('0x4'));var RpcUser=require(_0x340f('0x5'));var RpcVoiceAgentReport=require(_0x340f('0x6'));function Acw(_0x930cbc){this[_0x340f('0x7')]=_0x930cbc['voiceQueues'];this[_0x340f('0x8')]=_0x930cbc['agents'];this['timers']=_0x930cbc[_0x340f('0x9')];this[_0x340f('0xa')]={};ami['on'](_0x340f('0xb'),this['syncAgentConnect']['bind'](this));ami['on'](_0x340f('0xc'),this['syncHangupRequest']['bind'](this));ami['on'](_0x340f('0xd'),this[_0x340f('0xe')][_0x340f('0xf')](this));ami['on'](_0x340f('0x10'),this[_0x340f('0x11')]['bind'](this));ami['on'](_0x340f('0x12'),this[_0x340f('0x13')][_0x340f('0xf')](this));ami['on'](_0x340f('0x14'),this[_0x340f('0x15')][_0x340f('0xf')](this));ami['on'](_0x340f('0x16'),this[_0x340f('0x17')]['bind'](this));}function getDiff(_0x1d4b3f){var _0x5a2bb3=moment()[_0x340f('0x18')](0x0);var _0x255bea=moment(_0x1d4b3f)[_0x340f('0x18')](0x0);return _0x5a2bb3['diff'](_0x255bea,_0x340f('0x19'));}Acw[_0x340f('0x1a')]['startAcw']=function(_0xcea813){try{var _0x3addb5=this;var _0x24c160=this['channels'][_0xcea813][_0x340f('0x1b')];var _0x449b6c=this['channels'][_0xcea813][_0x340f('0x1c')];var _0x79fa46=this['voiceQueues'][_0x449b6c];var _0xa28f81=![];var _0x4ca6bb=_0x340f('0x1d');if(_0x79fa46[_0x340f('0x1e')]){if(_0x79fa46['mandatoryDispositionPause'][_0x340f('0x1f')]){_0xa28f81=!![];_0x4ca6bb=_0x79fa46['mandatoryDispositionPause'][_0x340f('0x1f')];}}return ami[_0x340f('0x20')]({'action':'QueuePause','interface':_0x24c160,'paused':!![],'reason':_0x4ca6bb})[_0x340f('0x21')](function(){if(_0x3addb5[_0x340f('0x8')][_0x24c160]){return RpcUser['getAgent'](_0x3addb5[_0x340f('0x8')][_0x24c160]['id'])['then'](function(_0x3c5f93){if(_0x3c5f93&&!_0x3c5f93['voicePause']){logger[_0x340f('0x22')](_0x340f('0x23'),_0xcea813,_0x24c160,_0x449b6c);var _0x387a54=_0x3addb5[_0x340f('0xa')][_0xcea813][_0x340f('0x24')]&&_0x3addb5[_0x340f('0xa')][_0xcea813][_0x340f('0x25')]?_0x3addb5[_0x340f('0xa')][_0xcea813]['destlinkedid']:_0xcea813;return RpcUser[_0x340f('0x26')](_0x3addb5[_0x340f('0x8')][_0x24c160],_0x4ca6bb,_0x387a54)['then'](function(){if(!_0xa28f81){_0x3addb5[_0x340f('0x9')][_0x24c160]={};logger['info'](_0x340f('0x27'),_0xcea813,_0x3addb5[_0x340f('0x7')][_0x449b6c][_0x340f('0x28')],_0x24c160,_0x449b6c);_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x29')]=setTimeout(_0x3addb5[_0x340f('0x2a')][_0x340f('0xf')](_0x3addb5,_0x24c160),_0x3addb5[_0x340f('0x7')][_0x449b6c]['acwTimeout']*0x3e8);_0x3addb5[_0x340f('0x9')][_0x24c160]['lastPauseAt']=moment()['format'](_0x340f('0x2b'));_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x2c')]=_0xcea813;_0x3addb5['timers'][_0x24c160]['queue']=_0x449b6c;_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x2d')]=function(){var _0x412145=getDiff(_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x2e')]);clearTimeout(_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x29')]);_0x3addb5['timers'][_0x24c160][_0x340f('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x412145},_0x3addb5[_0x340f('0x9')][_0x24c160][_0x340f('0x2c')],_0x24c160)[_0x340f('0x21')](function(_0x3b8224){logger[_0x340f('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0xcea813,_0x412145,_0x3b8224);})[_0x340f('0x2f')](function(_0x3f00d9){logger['error'](_0x340f('0x30'),_0xcea813,_0x3f00d9);});delete _0x3addb5[_0x340f('0x9')][_0x24c160];};}});}else{logger[_0x340f('0x22')](_0x340f('0x31'),_0xcea813,_0x24c160,_0x449b6c);}});}})[_0x340f('0x2f')](function(){logger[_0x340f('0x32')](_0x340f('0x27'),_0xcea813,_0x3addb5['voiceQueues'][_0x449b6c][_0x340f('0x28')],_0x24c160,_0x449b6c);})[_0x340f('0x33')](function(){delete _0x3addb5['channels'][_0xcea813];});}catch(_0x34d683){logger['error'](_0x340f('0x34'),_0x34d683[_0x340f('0x35')]);}};Acw[_0x340f('0x1a')][_0x340f('0x2a')]=function(_0x129f3c){try{var _0x5209d0=this;if(_0x5209d0[_0x340f('0x9')][_0x129f3c]){_0x5209d0[_0x340f('0x9')][_0x129f3c][_0x340f('0x29')]=![];var _0x128bce=_0x5209d0[_0x340f('0x9')][_0x129f3c][_0x340f('0x2c')];var _0x1ef89d=_0x5209d0['timers'][_0x129f3c][_0x340f('0x1c')];var _0x3253b8=_0x5209d0['voiceQueues'][_0x1ef89d][_0x340f('0x28')];logger[_0x340f('0x22')](_0x340f('0x36'),_0x128bce,_0x129f3c);RpcUser[_0x340f('0x37')](this[_0x340f('0x8')][_0x129f3c]);RpcVoiceAgentReport[_0x340f('0x38')]({'acwtime':_0x3253b8,'agentacw':!![]},_0x128bce,_0x129f3c)['then'](function(_0x221fb9){logger['info'](_0x340f('0x39'),_0x128bce,_0x3253b8,_0x221fb9);})[_0x340f('0x2f')](function(_0x21dd9a){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x128bce,_0x21dd9a);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x129f3c);if(_0x5209d0['timers']){logger[_0x340f('0x22')]('[ACW][TIMERS]',JSON[_0x340f('0x3a')](_0x5209d0[_0x340f('0x9')]));}}}catch(_0x373ac6){logger[_0x340f('0x32')]('[ACW][STOP]\x20%s',_0x373ac6[_0x340f('0x35')]);}};Acw[_0x340f('0x1a')][_0x340f('0x3b')]=function(_0x162f9f){try{if(this['voiceQueues'][_0x162f9f['queue']]&&(this[_0x340f('0x7')][_0x162f9f[_0x340f('0x1c')]]['acw']||this[_0x340f('0x7')][_0x162f9f[_0x340f('0x1c')]]['mandatoryDisposition'])){if(this[_0x340f('0x8')][_0x162f9f[_0x340f('0x1b')]]){this[_0x340f('0xa')][_0x162f9f['uniqueid']]={'queue':_0x162f9f[_0x340f('0x1c')],'interface':_0x162f9f[_0x340f('0x1b')],'destlinkedid':_0x162f9f['destlinkedid']};}}}catch(_0x5882f6){logger[_0x340f('0x32')](_0x340f('0x3c'),_0x5882f6[_0x340f('0x35')]);}};Acw[_0x340f('0x1a')][_0x340f('0x17')]=function(_0x4768b4){try{if(this[_0x340f('0x7')][_0x4768b4[_0x340f('0x1c')]]&&(this['voiceQueues'][_0x4768b4[_0x340f('0x1c')]][_0x340f('0x4')]||this[_0x340f('0x7')][_0x4768b4[_0x340f('0x1c')]]['mandatoryDisposition'])){if(this[_0x340f('0x8')][_0x4768b4[_0x340f('0x1b')]]){this[_0x340f('0xa')][_0x4768b4[_0x340f('0x2c')]]={'queue':_0x4768b4[_0x340f('0x1c')],'interface':_0x4768b4[_0x340f('0x1b')]};}}}catch(_0x49e0a8){logger[_0x340f('0x32')](_0x340f('0x3d'),_0x49e0a8[_0x340f('0x35')]);}};Acw[_0x340f('0x1a')]['syncHangupRequest']=function(_0x8dde4c){try{if(this[_0x340f('0xa')][_0x8dde4c[_0x340f('0x2c')]]&&_[_0x340f('0x3e')](this[_0x340f('0xa')][_0x8dde4c['uniqueid']]['attended'])){logger[_0x340f('0x22')](_0x340f('0x3f'),_0x8dde4c[_0x340f('0x2c')]);this['startAcw'](_0x8dde4c[_0x340f('0x2c')]);}else if(this[_0x340f('0xa')][_0x8dde4c[_0x340f('0x40')]]&&_['isUndefined'](this[_0x340f('0xa')][_0x8dde4c[_0x340f('0x40')]]['attended'])){logger[_0x340f('0x22')](_0x340f('0x41'),_0x8dde4c[_0x340f('0x40')]);this['startAcw'](_0x8dde4c['linkedid']);}}catch(_0x4bf662){logger[_0x340f('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x4bf662[_0x340f('0x35')]);}};Acw['prototype']['syncHangup']=function(_0x26f4c7){try{if(this[_0x340f('0xa')][_0x26f4c7['uniqueid']]&&this[_0x340f('0xa')][_0x26f4c7['uniqueid']]['attended']){logger[_0x340f('0x22')](_0x340f('0x42'),_0x26f4c7[_0x340f('0x2c')]);this[_0x340f('0x43')](_0x26f4c7['uniqueid']);}else if(this['channels'][_0x26f4c7[_0x340f('0x40')]]&&this['channels'][_0x26f4c7[_0x340f('0x40')]][_0x340f('0x24')]){logger['info'](_0x340f('0x44'),_0x26f4c7[_0x340f('0x40')]);this[_0x340f('0x43')](_0x26f4c7[_0x340f('0x40')]);}}catch(_0x1563c5){logger[_0x340f('0x32')](_0x340f('0x45'),_0x1563c5['message']);}};Acw[_0x340f('0x1a')][_0x340f('0x13')]=function(_0x32f44a){try{if(!_[_0x340f('0x46')](this[_0x340f('0xa')][_0x32f44a[_0x340f('0x47')]])){this['startAcw'](_0x32f44a[_0x340f('0x47')]);if(this[_0x340f('0xa')][_0x32f44a[_0x340f('0x48')]]){this[_0x340f('0xa')][_0x32f44a[_0x340f('0x48')]][_0x340f('0x24')]=!![];this['channels'][_0x32f44a[_0x340f('0x49')]]=this[_0x340f('0xa')][_0x32f44a['secondtransfereruniqueid']];delete this[_0x340f('0xa')][_0x32f44a[_0x340f('0x48')]];}}else if(!_[_0x340f('0x46')](this[_0x340f('0xa')][_0x32f44a['transfertargetuniqueid']])){this[_0x340f('0x43')](_0x32f44a['transfertargetuniqueid']);if(this[_0x340f('0xa')][_0x32f44a[_0x340f('0x4a')]]){this[_0x340f('0xa')][_0x32f44a[_0x340f('0x4a')]]['attended']=!![];this['channels'][_0x32f44a['transfereeuniqueid']]=this[_0x340f('0xa')][_0x32f44a['origtransfereruniqueid']];delete this[_0x340f('0xa')][_0x32f44a[_0x340f('0x4a')]];}}}catch(_0x27517f){logger[_0x340f('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x27517f[_0x340f('0x35')]);}};Acw[_0x340f('0x1a')]['syncBlindTransfer']=function(_0x481988){try{if(this[_0x340f('0xa')][_0x481988['transfereruniqueid']]){logger[_0x340f('0x22')](_0x340f('0x4b'),JSON['stringify'](_0x481988[_0x340f('0x4c')]));this[_0x340f('0x43')](_0x481988[_0x340f('0x4c')]);}else if(this[_0x340f('0xa')][_0x481988[_0x340f('0x4d')]]){logger[_0x340f('0x22')](_0x340f('0x4e'),JSON['stringify'](_0x481988[_0x340f('0x4d')]));this[_0x340f('0x43')](_0x481988['transfererlinkedid']);}}catch(_0xcfd93b){logger[_0x340f('0x32')](_0x340f('0x4f'),_0xcfd93b[_0x340f('0x35')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x169d7f){try{if(this[_0x340f('0x7')][_0x169d7f[_0x340f('0x1c')]]&&this[_0x340f('0x7')][_0x169d7f[_0x340f('0x1c')]][_0x340f('0x50')]===_0x340f('0x51')){if(this[_0x340f('0x8')][_0x169d7f['interface']]){logger['info'](_0x340f('0x52'),_0x169d7f[_0x340f('0x2c')],_0x169d7f['interface'],_0x169d7f[_0x340f('0x1c')]);return RpcUser[_0x340f('0x26')](this[_0x340f('0x8')][_0x169d7f['interface']],_0x340f('0x53'),_0x169d7f['uniqueid']);}}}catch(_0x10b989){logger[_0x340f('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x10b989[_0x340f('0x35')]);}};module[_0x340f('0x54')]=Acw; \ No newline at end of file +var _0x0cd2=['stopAcw','uniqueid','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0cd2,0x75));var _0x20cd=function(_0x2d766c,_0x2a4ec4){_0x2d766c=_0x2d766c-0x0;var _0x579a64=_0x0cd2[_0x2d766c];return _0x579a64;};'use strict';var _=require(_0x20cd('0x0'));var moment=require(_0x20cd('0x1'));var ami=require(_0x20cd('0x2'));var logger=require('../../../config/logger')(_0x20cd('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x20cd('0x4'));function Acw(_0x59eb9d){this[_0x20cd('0x5')]=_0x59eb9d[_0x20cd('0x5')];this[_0x20cd('0x6')]=_0x59eb9d[_0x20cd('0x6')];this[_0x20cd('0x7')]=_0x59eb9d[_0x20cd('0x7')];this[_0x20cd('0x8')]={};ami['on'](_0x20cd('0x9'),this[_0x20cd('0xa')][_0x20cd('0xb')](this));ami['on'](_0x20cd('0xc'),this[_0x20cd('0xd')][_0x20cd('0xb')](this));ami['on'](_0x20cd('0xe'),this['syncHangup'][_0x20cd('0xb')](this));ami['on'](_0x20cd('0xf'),this[_0x20cd('0x10')]['bind'](this));ami['on'](_0x20cd('0x11'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x20cd('0x12'),this[_0x20cd('0x13')][_0x20cd('0xb')](this));ami['on'](_0x20cd('0x14'),this[_0x20cd('0x15')][_0x20cd('0xb')](this));}function getDiff(_0x4d6e7a){var _0x59f8d7=moment()['milliseconds'](0x0);var _0x337cb8=moment(_0x4d6e7a)['milliseconds'](0x0);return _0x59f8d7[_0x20cd('0x16')](_0x337cb8,_0x20cd('0x17'));}Acw[_0x20cd('0x18')][_0x20cd('0x19')]=function(_0xc96b43){try{var _0x5db04a=this;var _0x54598d=this[_0x20cd('0x8')][_0xc96b43][_0x20cd('0x1a')];var _0x3f0bc4=this[_0x20cd('0x8')][_0xc96b43][_0x20cd('0x1b')];var _0x36fc3e=this[_0x20cd('0x5')][_0x3f0bc4];var _0x8e7835=![];var _0x1bc3aa=_0x20cd('0x1c');if(_0x36fc3e[_0x20cd('0x1d')]){if(_0x36fc3e['mandatoryDispositionPause'][_0x20cd('0x1e')]){_0x8e7835=!![];_0x1bc3aa=_0x36fc3e[_0x20cd('0x1f')][_0x20cd('0x1e')];}}return ami[_0x20cd('0x20')]({'action':_0x20cd('0x21'),'interface':_0x54598d,'paused':!![],'reason':_0x1bc3aa})[_0x20cd('0x22')](function(){if(_0x5db04a['agents'][_0x54598d]){return RpcUser[_0x20cd('0x23')](_0x5db04a['agents'][_0x54598d]['id'])['then'](function(_0x3fb1af){if(_0x3fb1af&&!_0x3fb1af[_0x20cd('0x24')]){logger[_0x20cd('0x25')](_0x20cd('0x26'),_0xc96b43,_0x54598d,_0x3f0bc4);var _0x5801a3=_0x5db04a[_0x20cd('0x8')][_0xc96b43][_0x20cd('0x27')]&&_0x5db04a[_0x20cd('0x8')][_0xc96b43]['destlinkedid']?_0x5db04a[_0x20cd('0x8')][_0xc96b43]['destlinkedid']:_0xc96b43;return RpcUser[_0x20cd('0x28')](_0x5db04a[_0x20cd('0x6')][_0x54598d],_0x1bc3aa,_0x5801a3)[_0x20cd('0x22')](function(){if(!_0x8e7835){_0x5db04a[_0x20cd('0x7')][_0x54598d]={};logger[_0x20cd('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xc96b43,_0x5db04a[_0x20cd('0x5')][_0x3f0bc4][_0x20cd('0x29')],_0x54598d,_0x3f0bc4);_0x5db04a[_0x20cd('0x7')][_0x54598d][_0x20cd('0x2a')]=setTimeout(_0x5db04a['stopAcw'][_0x20cd('0xb')](_0x5db04a,_0x54598d),_0x5db04a[_0x20cd('0x5')][_0x3f0bc4][_0x20cd('0x29')]*0x3e8);_0x5db04a['timers'][_0x54598d]['lastPauseAt']=moment()[_0x20cd('0x2b')](_0x20cd('0x2c'));_0x5db04a[_0x20cd('0x7')][_0x54598d]['uniqueid']=_0xc96b43;_0x5db04a[_0x20cd('0x7')][_0x54598d][_0x20cd('0x1b')]=_0x3f0bc4;_0x5db04a[_0x20cd('0x7')][_0x54598d][_0x20cd('0x2d')]=function(){var _0x36b435=getDiff(_0x5db04a[_0x20cd('0x7')][_0x54598d]['lastPauseAt']);clearTimeout(_0x5db04a[_0x20cd('0x7')][_0x54598d][_0x20cd('0x2a')]);_0x5db04a['timers'][_0x54598d][_0x20cd('0x2a')]=![];RpcVoiceAgentReport[_0x20cd('0x2e')]({'acwtime':_0x36b435},_0x5db04a[_0x20cd('0x7')][_0x54598d]['uniqueid'],_0x54598d)[_0x20cd('0x22')](function(_0x4f03f3){logger['info'](_0x20cd('0x2f'),_0xc96b43,_0x36b435,_0x4f03f3);})[_0x20cd('0x30')](function(_0x3a208c){logger[_0x20cd('0x31')](_0x20cd('0x32'),_0xc96b43,_0x3a208c);});delete _0x5db04a[_0x20cd('0x7')][_0x54598d];};}});}else{logger[_0x20cd('0x25')](_0x20cd('0x33'),_0xc96b43,_0x54598d,_0x3f0bc4);}});}})[_0x20cd('0x30')](function(){logger['error'](_0x20cd('0x34'),_0xc96b43,_0x5db04a[_0x20cd('0x5')][_0x3f0bc4][_0x20cd('0x29')],_0x54598d,_0x3f0bc4);})[_0x20cd('0x35')](function(){delete _0x5db04a[_0x20cd('0x8')][_0xc96b43];});}catch(_0x5674ca){logger[_0x20cd('0x31')]('[ACW][START]\x20%s',_0x5674ca[_0x20cd('0x36')]);}};Acw['prototype'][_0x20cd('0x37')]=function(_0x2abfdb){try{var _0x22a1d4=this;if(_0x22a1d4[_0x20cd('0x7')][_0x2abfdb]){_0x22a1d4['timers'][_0x2abfdb][_0x20cd('0x2a')]=![];var _0x15031e=_0x22a1d4[_0x20cd('0x7')][_0x2abfdb][_0x20cd('0x38')];var _0x3f4b28=_0x22a1d4[_0x20cd('0x7')][_0x2abfdb][_0x20cd('0x1b')];var _0x3c51e8=_0x22a1d4[_0x20cd('0x5')][_0x3f4b28][_0x20cd('0x29')];logger[_0x20cd('0x25')]('[%s][TIMER][STOP][AGENT:%s]',_0x15031e,_0x2abfdb);RpcUser['saveUnpause'](this[_0x20cd('0x6')][_0x2abfdb]);RpcVoiceAgentReport[_0x20cd('0x2e')]({'acwtime':_0x3c51e8,'agentacw':!![]},_0x15031e,_0x2abfdb)[_0x20cd('0x22')](function(_0x1bdba6){logger['info'](_0x20cd('0x2f'),_0x15031e,_0x3c51e8,_0x1bdba6);})[_0x20cd('0x30')](function(_0x1a762c){logger[_0x20cd('0x31')](_0x20cd('0x32'),_0x15031e,_0x1a762c);});}else{logger[_0x20cd('0x31')](_0x20cd('0x39'),_0x2abfdb);if(_0x22a1d4[_0x20cd('0x7')]){logger['info'](_0x20cd('0x3a'),JSON['stringify'](_0x22a1d4['timers']));}}}catch(_0x1fd60c){logger[_0x20cd('0x31')](_0x20cd('0x3b'),_0x1fd60c['message']);}};Acw['prototype'][_0x20cd('0xa')]=function(_0x4d3d92){try{if(this['voiceQueues'][_0x4d3d92['queue']]&&(this['voiceQueues'][_0x4d3d92['queue']]['acw']||this[_0x20cd('0x5')][_0x4d3d92[_0x20cd('0x1b')]]['mandatoryDisposition'])){if(this[_0x20cd('0x6')][_0x4d3d92[_0x20cd('0x1a')]]){this[_0x20cd('0x8')][_0x4d3d92['uniqueid']]={'queue':_0x4d3d92[_0x20cd('0x1b')],'interface':_0x4d3d92[_0x20cd('0x1a')],'destlinkedid':_0x4d3d92[_0x20cd('0x3c')]};}}}catch(_0x251572){logger[_0x20cd('0x31')](_0x20cd('0x3d'),_0x251572[_0x20cd('0x36')]);}};Acw[_0x20cd('0x18')][_0x20cd('0x15')]=function(_0x46a5e6){try{if(this['voiceQueues'][_0x46a5e6['queue']]&&(this[_0x20cd('0x5')][_0x46a5e6[_0x20cd('0x1b')]][_0x20cd('0x3')]||this[_0x20cd('0x5')][_0x46a5e6[_0x20cd('0x1b')]][_0x20cd('0x1d')])){if(this['agents'][_0x46a5e6[_0x20cd('0x1a')]]){this[_0x20cd('0x8')][_0x46a5e6[_0x20cd('0x38')]]={'queue':_0x46a5e6[_0x20cd('0x1b')],'interface':_0x46a5e6[_0x20cd('0x1a')]};}}}catch(_0x4ae633){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x4ae633[_0x20cd('0x36')]);}};Acw[_0x20cd('0x18')][_0x20cd('0xd')]=function(_0x58f3f0){try{if(this[_0x20cd('0x8')][_0x58f3f0[_0x20cd('0x38')]]&&_[_0x20cd('0x3e')](this[_0x20cd('0x8')][_0x58f3f0[_0x20cd('0x38')]][_0x20cd('0x27')])){logger['info'](_0x20cd('0x3f'),_0x58f3f0[_0x20cd('0x38')]);this['startAcw'](_0x58f3f0[_0x20cd('0x38')]);}else if(this[_0x20cd('0x8')][_0x58f3f0[_0x20cd('0x40')]]&&_[_0x20cd('0x3e')](this[_0x20cd('0x8')][_0x58f3f0[_0x20cd('0x40')]][_0x20cd('0x27')])){logger[_0x20cd('0x25')](_0x20cd('0x41'),_0x58f3f0[_0x20cd('0x40')]);this[_0x20cd('0x19')](_0x58f3f0['linkedid']);}}catch(_0x5eb9cf){logger['error'](_0x20cd('0x42'),_0x5eb9cf[_0x20cd('0x36')]);}};Acw[_0x20cd('0x18')][_0x20cd('0x43')]=function(_0x11f92b){try{if(this[_0x20cd('0x8')][_0x11f92b[_0x20cd('0x38')]]&&this[_0x20cd('0x8')][_0x11f92b['uniqueid']][_0x20cd('0x27')]){logger[_0x20cd('0x25')](_0x20cd('0x44'),_0x11f92b['uniqueid']);this[_0x20cd('0x19')](_0x11f92b[_0x20cd('0x38')]);}else if(this[_0x20cd('0x8')][_0x11f92b[_0x20cd('0x40')]]&&this[_0x20cd('0x8')][_0x11f92b['linkedid']][_0x20cd('0x27')]){logger[_0x20cd('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x11f92b[_0x20cd('0x40')]);this['startAcw'](_0x11f92b[_0x20cd('0x40')]);}}catch(_0x3f38bd){logger[_0x20cd('0x31')]('[ACW][syncHangup]\x20%s',_0x3f38bd['message']);}};Acw['prototype'][_0x20cd('0x45')]=function(_0x4b7f21){try{if(!_[_0x20cd('0x46')](this['channels'][_0x4b7f21['transfereeuniqueid']])){this['startAcw'](_0x4b7f21[_0x20cd('0x47')]);if(this[_0x20cd('0x8')][_0x4b7f21[_0x20cd('0x48')]]){this[_0x20cd('0x8')][_0x4b7f21['secondtransfereruniqueid']]['attended']=!![];this[_0x20cd('0x8')][_0x4b7f21['transfertargetuniqueid']]=this[_0x20cd('0x8')][_0x4b7f21[_0x20cd('0x48')]];delete this[_0x20cd('0x8')][_0x4b7f21['secondtransfereruniqueid']];}}else if(!_[_0x20cd('0x46')](this[_0x20cd('0x8')][_0x4b7f21[_0x20cd('0x49')]])){this[_0x20cd('0x19')](_0x4b7f21['transfertargetuniqueid']);if(this[_0x20cd('0x8')][_0x4b7f21[_0x20cd('0x4a')]]){this[_0x20cd('0x8')][_0x4b7f21['origtransfereruniqueid']][_0x20cd('0x27')]=!![];this[_0x20cd('0x8')][_0x4b7f21['transfereeuniqueid']]=this['channels'][_0x4b7f21['origtransfereruniqueid']];delete this[_0x20cd('0x8')][_0x4b7f21['origtransfereruniqueid']];}}}catch(_0x255fb1){logger[_0x20cd('0x31')](_0x20cd('0x4b'),_0x255fb1['message']);}};Acw[_0x20cd('0x18')][_0x20cd('0x13')]=function(_0x4e42f8){try{if(this['channels'][_0x4e42f8[_0x20cd('0x4c')]]){logger[_0x20cd('0x25')](_0x20cd('0x4d'),JSON[_0x20cd('0x4e')](_0x4e42f8['transfereruniqueid']));this[_0x20cd('0x19')](_0x4e42f8[_0x20cd('0x4c')]);}else if(this[_0x20cd('0x8')][_0x4e42f8[_0x20cd('0x4f')]]){logger['info'](_0x20cd('0x50'),JSON[_0x20cd('0x4e')](_0x4e42f8['transfererlinkedid']));this[_0x20cd('0x19')](_0x4e42f8[_0x20cd('0x4f')]);}}catch(_0x2a4a71){logger['error'](_0x20cd('0x51'),_0x2a4a71['message']);}};Acw[_0x20cd('0x18')][_0x20cd('0x10')]=function(_0x525491){try{if(this['voiceQueues'][_0x525491[_0x20cd('0x1b')]]&&this[_0x20cd('0x5')][_0x525491[_0x20cd('0x1b')]][_0x20cd('0x52')]==='all'){if(this['agents'][_0x525491[_0x20cd('0x1a')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x525491[_0x20cd('0x38')],_0x525491[_0x20cd('0x1a')],_0x525491[_0x20cd('0x1b')]);return RpcUser[_0x20cd('0x28')](this[_0x20cd('0x6')][_0x525491['interface']],_0x20cd('0x53'),_0x525491[_0x20cd('0x38')]);}}}catch(_0x3be6a6){logger['error'](_0x20cd('0x54'),_0x3be6a6['message']);}};module[_0x20cd('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cc5d7f8..24a6cfc 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 _0xed25=['password','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xed25,0x97));var _0x5ed2=function(_0x5c3cfd,_0x491545){_0x5c3cfd=_0x5c3cfd-0x0;var _0x3488f1=_0xed25[_0x5c3cfd];return _0x3488f1;};'use strict';var Manager=require(_0x5ed2('0x0'));var BPromise=require(_0x5ed2('0x1'));var util=require(_0x5ed2('0x2'));var logger=require(_0x5ed2('0x3'))(_0x5ed2('0x4'));var config=require(_0x5ed2('0x5'));var ami=new Manager(config[_0x5ed2('0x6')][_0x5ed2('0x7')],config[_0x5ed2('0x6')]['ip'],config[_0x5ed2('0x6')][_0x5ed2('0x8')],config[_0x5ed2('0x6')][_0x5ed2('0x9')],!![]);ami[_0x5ed2('0xa')]();ami['Action']=BPromise['promisify'](ami[_0x5ed2('0xb')]);function error(_0x7b20){logger[_0x5ed2('0xc')](util[_0x5ed2('0xd')](_0x5ed2('0xe'),config[_0x5ed2('0x6')][_0x5ed2('0x8')],config[_0x5ed2('0x6')]['ip'],config[_0x5ed2('0x6')]['port'],util['inspect'](_0x7b20,![],null)));}function close(){logger['error'](util[_0x5ed2('0xd')](_0x5ed2('0xf'),config[_0x5ed2('0x6')][_0x5ed2('0x8')],config[_0x5ed2('0x6')]['ip'],config[_0x5ed2('0x6')][_0x5ed2('0x7')]));}ami[_0x5ed2('0x10')]=function(){return function(){return ami[_0x5ed2('0x11')]({'action':_0x5ed2('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5ed2('0x11')]({'action':_0x5ed2('0x13')});};};ami[_0x5ed2('0x14')]=function(){return function(){return ami[_0x5ed2('0x11')]({'action':_0x5ed2('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x5ed2('0x11')]({'action':_0x5ed2('0x16')});};};ami[_0x5ed2('0x17')]=function(){return function(){return ami['Action']({'action':_0x5ed2('0x18')});};};function connect(){logger[_0x5ed2('0x19')](util['format'](_0x5ed2('0x1a'),config[_0x5ed2('0x6')][_0x5ed2('0x8')],config[_0x5ed2('0x6')]['ip'],config['asterisk']['port']));ami[_0x5ed2('0x1b')](_0x5ed2('0xc'),error);ami['once'](_0x5ed2('0x1c'),close);}ami['on'](_0x5ed2('0x1d'),connect);ami['on'](_0x5ed2('0x1e'),function(_0x4510e6){logger[_0x5ed2('0x19')](util['format'](_0x5ed2('0x1f'),config[_0x5ed2('0x6')][_0x5ed2('0x8')],config[_0x5ed2('0x6')]['ip'],config['asterisk'][_0x5ed2('0x7')],util[_0x5ed2('0x20')](_0x4510e6,![],null)));});ami['on'](_0x5ed2('0x21'),function(){logger['info'](util[_0x5ed2('0xd')](_0x5ed2('0x22'),config[_0x5ed2('0x6')]['username'],config['asterisk']['ip'],config[_0x5ed2('0x6')][_0x5ed2('0x7')]));return Promise['resolve']()[_0x5ed2('0x23')](ami['actionSipShowRegistry']())[_0x5ed2('0x23')](ami[_0x5ed2('0x24')]())['then'](ami[_0x5ed2('0x14')]())[_0x5ed2('0x23')](ami[_0x5ed2('0x25')]())['then'](ami[_0x5ed2('0x17')]())[_0x5ed2('0x26')](function(_0x331267){logger['error'](_0x5ed2('0x27'),util[_0x5ed2('0x20')](_0x331267,{'showHidden':![],'depth':null}));});});ami[_0x5ed2('0x1b')](_0x5ed2('0xc'),error);ami[_0x5ed2('0x1b')](_0x5ed2('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0x5681=['port','password','keepConnected','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','username','resolve','then','actionDeviceStateList','catch','exports','asterisk-manager','../../config/logger','ami','asterisk'];(function(_0x2cea74,_0x176b02){var _0x41af9d=function(_0x490453){while(--_0x490453){_0x2cea74['push'](_0x2cea74['shift']());}};_0x41af9d(++_0x176b02);}(_0x5681,0x1e6));var _0x1568=function(_0x26f192,_0x1659d5){_0x26f192=_0x26f192-0x0;var _0x222f38=_0x5681[_0x26f192];return _0x222f38;};'use strict';var Manager=require(_0x1568('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x1568('0x1'))(_0x1568('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x1568('0x3')][_0x1568('0x4')],config[_0x1568('0x3')]['ip'],config[_0x1568('0x3')]['username'],config[_0x1568('0x3')][_0x1568('0x5')],!![]);ami[_0x1568('0x6')]();ami[_0x1568('0x7')]=BPromise[_0x1568('0x8')](ami[_0x1568('0x9')]);function error(_0x4359b6){logger[_0x1568('0xa')](util[_0x1568('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x1568('0x3')]['username'],config['asterisk']['ip'],config[_0x1568('0x3')][_0x1568('0x4')],util[_0x1568('0xc')](_0x4359b6,![],null)));}function close(){logger[_0x1568('0xa')](util[_0x1568('0xb')](_0x1568('0xd'),config[_0x1568('0x3')]['username'],config['asterisk']['ip'],config[_0x1568('0x3')][_0x1568('0x4')]));}ami[_0x1568('0xe')]=function(){return function(){return ami[_0x1568('0x7')]({'action':_0x1568('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x1568('0x7')]({'action':_0x1568('0x10')});};};ami[_0x1568('0x11')]=function(){return function(){return ami[_0x1568('0x7')]({'action':_0x1568('0x12')});};};ami[_0x1568('0x13')]=function(){return function(){return ami[_0x1568('0x7')]({'action':_0x1568('0x14')});};};ami[_0x1568('0x15')]=function(){return function(){return ami[_0x1568('0x7')]({'action':_0x1568('0x16')});};};function connect(){logger[_0x1568('0x17')](util[_0x1568('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x1568('0x3')]['username'],config[_0x1568('0x3')]['ip'],config[_0x1568('0x3')][_0x1568('0x4')]));ami['once'](_0x1568('0xa'),error);ami['once'](_0x1568('0x18'),close);}ami['on'](_0x1568('0x19'),connect);ami['on'](_0x1568('0x1a'),function(_0x210071){logger[_0x1568('0x17')](util[_0x1568('0xb')](_0x1568('0x1b'),config[_0x1568('0x3')]['username'],config[_0x1568('0x3')]['ip'],config[_0x1568('0x3')][_0x1568('0x4')],util[_0x1568('0xc')](_0x210071,![],null)));});ami['on']('fullybooted',function(){logger[_0x1568('0x17')](util[_0x1568('0xb')](_0x1568('0x1c'),config['asterisk'][_0x1568('0x1d')],config[_0x1568('0x3')]['ip'],config[_0x1568('0x3')][_0x1568('0x4')]));return Promise[_0x1568('0x1e')]()[_0x1568('0x1f')](ami[_0x1568('0xe')]())[_0x1568('0x1f')](ami[_0x1568('0x20')]())[_0x1568('0x1f')](ami[_0x1568('0x11')]())[_0x1568('0x1f')](ami[_0x1568('0x13')]())['then'](ami[_0x1568('0x15')]())[_0x1568('0x21')](function(_0x2dd4b3){logger[_0x1568('0xa')]('[ami.js][fullybooted]',util[_0x1568('0xc')](_0x2dd4b3,{'showHidden':![],'depth':null}));});});ami['once'](_0x1568('0xa'),error);ami['once'](_0x1568('0x18'),close);module[_0x1568('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4c86c45..df1bf88 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x161299,_0x4991c7){var _0x293d51=function(_0x44f04d){while(--_0x44f04d){_0x161299['push'](_0x161299['shift']());}};_0x293d51(++_0x4991c7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x46fc27,_0x4ff2c0){_0x46fc27=_0x46fc27-0x0;var _0x4caf32=_0xb43b[_0x46fc27];return _0x4caf32;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0xcb91[_0x5e4b85];return _0x5cd3cb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7be2fa4..ef36eb4 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 _0xf154=['countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','dialDropRetryFrequency','ContactId','ListId','CampaignId','Drop','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','add','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','agents','stateinterface','isNil','idHopper','syncQueueStatusComplete','run','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','amdstatus','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[syncHangupInAMDIvr]','outboundAnswerCallsDay','createStateFinal','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','reachable','map','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact]','checkPreviewRecallReminder','Agent','handleIvr','actionOriginate','object','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','[originateError]:\x20%s','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','getDataPredictive','Predictive\x20after\x20first\x20interval','dialPredictiveInterval','recalculate\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','merge','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','dialMethod','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','floor','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\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]','m\x20=\x20','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','Interval','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','format','campaign:ivr:%s','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','UNKNOWN_TIMEZONE','isArray','push','Action','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','command','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','progressive','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xf154,0x147));var _0x4f15=function(_0xeaac0d,_0x1d121f){_0xeaac0d=_0xeaac0d-0x0;var _0x59efcc=_0xf154[_0xeaac0d];return _0x59efcc;};'use strict';var util=require(_0x4f15('0x0'));var _=require('lodash');var uuid=require(_0x4f15('0x1'));var moment=require(_0x4f15('0x2'));var rr=require('rr');var Redis=require(_0x4f15('0x3'));var utils=require(_0x4f15('0x4'));var hopperUtils=require(_0x4f15('0x5'));var ut=require(_0x4f15('0x6'));var config=require(_0x4f15('0x7'));var logger=require(_0x4f15('0x8'))(_0x4f15('0x9'));var loggerBooked=require(_0x4f15('0x8'))(_0x4f15('0xa'));var loggerPredictive=require(_0x4f15('0x8'))(_0x4f15('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x4f15('0xc'));var ami=require(_0x4f15('0xd'));config[_0x4f15('0xe')]=_[_0x4f15('0xf')](config[_0x4f15('0xe')],{'host':_0x4f15('0x10'),'port':0x18eb});var io=require(_0x4f15('0x11'))(new Redis(config[_0x4f15('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x4f15('0x12'));var RpcSetting=require(_0x4f15('0x13'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x4f15('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x4f15('0x15'));var Hangup=require(_0x4f15('0x16'));var ipAgi=process[_0x4f15('0x17')][_0x4f15('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4f15('0x19')][_0x4f15('0x1a')]=function(_0x93403d){this[_0x4f15('0x1b')]=this[_0x4f15('0x1b')]?this[_0x4f15('0x1b')][_0x4f15('0x1c')](_0x93403d):_0x93403d();};function Dialer(_0x2d573f,_0x167337){this[_0x4f15('0x1d')]=new Sequence();this[_0x4f15('0x1e')]=_0x167337;this[_0x4f15('0x1f')]=_0x2d573f[_0x4f15('0x1f')];this[_0x4f15('0x20')]=_0x2d573f[_0x4f15('0x20')];this['agents']=_0x2d573f['agents'];this[_0x4f15('0x21')]=_0x2d573f['trunks'];this[_0x4f15('0x22')]=config[_0x4f15('0x22')]||0x2;this[_0x4f15('0x23')]={};this['actions']={};this[_0x4f15('0x24')]={};this[_0x4f15('0x25')]={};this[_0x4f15('0x26')]={};this[_0x4f15('0x27')]={};this[_0x4f15('0x28')]={};this[_0x4f15('0x29')]={};this[_0x4f15('0x2a')]={};this[_0x4f15('0x2b')]={};this[_0x4f15('0x2c')]={};ami['on'](_0x4f15('0x2d'),this[_0x4f15('0x2e')][_0x4f15('0x2f')](this));ami['on']('queuecallerabandon',this[_0x4f15('0x30')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x31'),this[_0x4f15('0x32')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x33'),this[_0x4f15('0x34')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x35'),this[_0x4f15('0xc')][_0x4f15('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0x4f15('0x36')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x37'),this[_0x4f15('0x38')]['bind'](this));ami['on'](_0x4f15('0x39'),this[_0x4f15('0x3a')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x3b'),this[_0x4f15('0x3c')][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x3d'),this['syncQueueMember'][_0x4f15('0x2f')](this));ami['on'](_0x4f15('0x3e'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0x4f15('0x3f')]();RpcSetting[_0x4f15('0x40')]()['then'](function(_0x311ca3){previewRecallmeReminderInterval=_0x311ca3[_0x4f15('0x41')];});}function isNotNull(_0x196d55){return _0x196d55!==null&&!_[_0x4f15('0x42')](_0x196d55);}function msgResponse(_0x198e97,_0x280fea,_0x398684){return{'action':_0x198e97,'response':_0x280fea,'message':_0x398684,'stack':_0x398684};}function emit(_0x21a86d,_0x18a8a0,_0x37f802){io['to'](_0x21a86d)[_0x4f15('0x43')](_0x18a8a0,_0x37f802);}function emitOutboundVoiceQueueSummary(_0x270fdb){if(_0x270fdb[_0x4f15('0x44')]===_0x4f15('0x45')){logger[_0x4f15('0x46')](_0x4f15('0x47'),util[_0x4f15('0x48')](_0x270fdb,{'showHidden':![],'depth':null}));emit(util['format'](_0x4f15('0x49'),_0x270fdb['name']),_0x4f15('0x4a'),_0x270fdb);}}function checkGetDataPredictive(_0x8a025a){if(isNotNull(_0x8a025a)&&!_[_0x4f15('0x4b')](_0x8a025a)){loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x4d'));loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x4e'),_0x8a025a['predictiveIntervalTotalCalls']);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x4f'),_0x8a025a['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x4f15('0x50'),_0x8a025a[_0x4f15('0x51')]);loggerPredictive['info'](_0x4f15('0x52'),_0x8a025a[_0x4f15('0x53')]);loggerPredictive['info'](_0x4f15('0x54'),_0x8a025a['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x55'),_0x8a025a[_0x4f15('0x56')]);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x57'));if(_0x8a025a[_0x4f15('0x58')]>0x0){if(!_[_0x4f15('0x42')](_0x8a025a[_0x4f15('0x56')])&&_0x8a025a[_0x4f15('0x56')]>0x0){return!![];}loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x59'));if(!_[_0x4f15('0x42')](_0x8a025a['predictiveIntervalAvgHoldtime'])&&_0x8a025a[_0x4f15('0x5a')]>0x0){return!![];}loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x5b'));}else{loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x5c'));}}else{loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x5d'));}return![];}function mergeDataErlangB(_0x4278f7){return function(_0x408d1b){loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x5e'));loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x5f'),_0x408d1b[_0x4f15('0x60')]);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x61'),_0x408d1b['erlangCallToSecond']);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x62'),_0x408d1b[_0x4f15('0x63')]);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x64'),_0x408d1b[_0x4f15('0x65')]);loggerPredictive['info'](_0x4f15('0x62'),_0x408d1b[_0x4f15('0x63')]);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x57'));_['merge'](_0x4278f7,_0x408d1b);};}function ifInterval(_0x250d01,_0x1dbe8d){if(_[_0x4f15('0x42')](_0x1dbe8d)){return![];}return utils[_0x4f15('0x66')](undefined,_0x1dbe8d)<_0x250d01*0x3c;}function clearPredictiveAttributes(_0xdf6a4){if(_0xdf6a4[_0x4f15('0x28')]){_0xdf6a4[_0x4f15('0x28')]=undefined;loggerPredictive['debug'](_0xdf6a4[_0x4f15('0x67')],_0x4f15('0x68'));}if(_0xdf6a4[_0x4f15('0x27')]){_0xdf6a4[_0x4f15('0x27')]=undefined;loggerPredictive[_0x4f15('0x46')](_0xdf6a4[_0x4f15('0x67')],_0x4f15('0x69'));}if(_0xdf6a4[_0x4f15('0x6a')]){clearInterval(_0xdf6a4['handlePredictive']);_0xdf6a4[_0x4f15('0x6a')]=undefined;loggerPredictive[_0x4f15('0x46')](_0xdf6a4['name'],_0x4f15('0x6b'));}}function loggerCatchPredictive(_0x1c286d,_0x5490f9){return function(_0x27c171){loggerPredictive[_0x4f15('0x6c')](_0x5490f9[_0x4f15('0x67')],_0x1c286d);loggerPredictive[_0x4f15('0x6c')](_0x27c171[_0x4f15('0x6d')]);clearPredictiveAttributes(_0x5490f9);};}function loggerCatch(_0x1f8ccf){return function(_0x2a9cfe){logger['error'](_0x1f8ccf,util[_0x4f15('0x48')](_0x2a9cfe,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3a68ea,_0x242d1f,_0xc897a4){return function(_0x384631){utils['checkContactLowerLimitOriginate'](_0x242d1f,_0xc897a4,0x0);logger[_0x4f15('0x6c')](_0x3a68ea,util['inspect'](_0x384631,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3a4445){return function(_0x4af93b){if(isNotNull(_0x4af93b)&&isNotNull(_0x4af93b[0x0])){if(_0x4af93b[0x0][_0x4f15('0x6e')]>0x0){_0x3a4445[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x71')];logger[_0x4f15('0x4c')]('[getContactDialer2][ReScheduled]'+_0x3a4445[_0x4f15('0x67')],_0x4af93b[0x0][_0x4f15('0x6e')],'contacts');}else{_0x3a4445[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x72')];logger[_0x4f15('0x4c')](_0x4f15('0x73')+_0x3a4445[_0x4f15('0x67')]);}}};}function createObjHistory(_0x592960,_0x1a14e3,_0x2cf59e,_0x5d2826,_0x51343b){_0x592960['message']=_0x2cf59e;var _0x2bf493=new Action(_0x592960,_0x1a14e3);var _0x15cc60=new History(_0x2bf493);_0x15cc60[_0x4f15('0x74')]=_0x5d2826;_0x15cc60[_0x4f15('0x75')]=_0x51343b;_0x15cc60['endtime']=_0x2bf493[_0x4f15('0x76')];return _0x15cc60;}function unlockQueueStatus(_0x5ad833,_0x4cd658){setTimeout(function(){if(_['isUndefined'](_0x5ad833[_0x4f15('0x77')])){loggerBooked['error'](_0x4f15('0x78'),_0x4cd658);}_0x5ad833[_0x4f15('0x77')]=!![];loggerBooked[_0x4f15('0x4c')](_0x4f15('0x79'),_0x4cd658,JSON[_0x4f15('0x7a')](_[_0x4f15('0x7b')](_0x5ad833,[_0x4f15('0x67'),_0x4f15('0x77')])));},0x1f3);}function checkInterval(_0x4a3168){return function(){if(!isNotNull(_0x4a3168['Interval'])){_0x4a3168[_0x4f15('0x6f')]=utils['CAMPAIGN_STATUS'][_0x4f15('0x7c')];throw _0x4a3168['name']+_0x4f15('0x7d');}if(!isNotNull(_0x4a3168['Interval'][_0x4f15('0x7e')])){_0x4a3168[_0x4f15('0x6f')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4a3168[_0x4f15('0x67')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4f15('0x4b')](_0x4a3168[_0x4f15('0x7f')][_0x4f15('0x7e')]))){_0x4a3168['message']=utils[_0x4f15('0x70')]['NULL_INTERVAL'];throw _0x4a3168['name']+_0x4f15('0x7d');}};}function checkIsIVRCampaignActive(_0x2e6324){return function(){if(!utils[_0x4f15('0x80')](_0x2e6324)){_0x2e6324[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x81')];throw _0x2e6324[_0x4f15('0x67')]+_0x4f15('0x82');}};}function emitCampaignSummary(_0x204648){if(utils['isIVRCampaign'](_0x204648)){emit(util[_0x4f15('0x83')](_0x4f15('0x84'),_0x204648['name']),'campaign:save',_0x204648);}}function loggerCatchQueueSummary(_0x26627b,_0x2e881d){return function(_0x240735){clearPredictiveAttributes(_0x2e881d);emitCampaignSummary(_0x2e881d);loggerSyncQueueSummary['debug'](_0x26627b,util['inspect'](_0x240735,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4a4c84){if(_0x4a4c84[_0x4f15('0x85')]){if(_0x4a4c84[_0x4f15('0x86')]===0x0){_0x4a4c84[_0x4f15('0x85')]=![];_0x4a4c84['message']=utils[_0x4f15('0x70')][_0x4f15('0x81')];loggerSyncQueueSummary[_0x4f15('0x46')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a4c84[_0x4f15('0x67')],_0x4f15('0x87'));}else{_0x4a4c84[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x88')];loggerSyncQueueSummary[_0x4f15('0x46')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a4c84[_0x4f15('0x67')],'is\x20disactive');}emitCampaignSummary(_0x4a4c84);}}function myreject(_0x4c87f9){return function(_0x2243bd){return _0x4c87f9(msgResponse(_0x4f15('0x89'),_0x4f15('0x8a'),JSON[_0x4f15('0x7a')](_0x2243bd)));};}Dialer[_0x4f15('0x19')][_0x4f15('0x8b')]=function(_0x1dd589){return!_[_0x4f15('0x42')](_0x1dd589)&&_0x1dd589&&!_[_0x4f15('0x42')](_0x1dd589[_0x4f15('0x67')])&&!_['isUndefined'](_0x1dd589[_0x4f15('0x8c')])&&_0x1dd589['active']&&(this[_0x4f15('0x21')][util['format']('SIP/%s',_0x1dd589[_0x4f15('0x67')])][_0x4f15('0x8d')]==='reachable'||this[_0x4f15('0x21')][util[_0x4f15('0x83')]('SIP/%s',_0x1dd589[_0x4f15('0x67')])]['status']===_0x4f15('0x8e'));};Dialer[_0x4f15('0x19')][_0x4f15('0x8f')]=function(_0xc4d817){var _0xbd1bb4=this;return function(){if(!_0xbd1bb4['isTrunkReachable'](_0xc4d817[_0x4f15('0x90')])){if(!_0xbd1bb4[_0x4f15('0x8b')](_0xc4d817[_0x4f15('0x91')])){_0xc4d817[_0x4f15('0x6f')]=utils[_0x4f15('0x70')]['TRUNK_NOT_REACHABLE'];throw _0xc4d817[_0x4f15('0x67')]+_0x4f15('0x92');}}};};Dialer[_0x4f15('0x19')][_0x4f15('0x93')]=function(_0x129f00,_0x458b9d,_0x472f33,_0x9c7055){var _0x36d85b=this;return function(){var _0x416f91=!![];return _0x36d85b['ifTimeIvr'](_0x129f00,_0x458b9d,_0x472f33,_0x9c7055,_0x416f91);};};Dialer[_0x4f15('0x19')][_0x4f15('0x94')]=function(_0x2c81ca,_0x4908f9,_0x4cb9fe,_0x2baeae){var _0x3bf5b7=this;return function(){var _0x1fd56c=![];return _0x3bf5b7['ifTimeIvr'](_0x2c81ca['Intervals'],_0x4908f9,_0x4cb9fe,_0x2baeae,_0x1fd56c);};};Dialer[_0x4f15('0x19')][_0x4f15('0x95')]=function(_0x4037fc,_0x4fed9d,_0x11dec4,_0x5c87d2,_0x32f017){var _0x33246c=[];return new Promise(function(_0x220222,_0x5867b8){if(!isNotNull(_0x4037fc)){_0x5c87d2[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x7c')];return _0x5867b8(msgResponse('ifTime',_0x4f15('0x96'),_0x11dec4+_0x4f15('0x97')));}if(_[_0x4f15('0x4b')](_0x4037fc)){_0x5c87d2[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x98')];return _0x5867b8(msgResponse(_0x4f15('0x99'),_0x4f15('0x96'),_0x11dec4+'\x20Intervals\x20is\x20empty\x20'));}if(_0x4fed9d&&_['isUndefined'](config[_0x4f15('0x9a')][_0x4fed9d])){_0x5c87d2[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x9b')];return _0x5867b8(msgResponse(_0x4f15('0x99'),'Failure',_0x11dec4+'\x20Timezone\x20unknow\x20'+_0x4fed9d));}if(_[_0x4f15('0x9c')](_0x4037fc)){for(var _0x31f6ce=0x0;_0x31f6ce<_0x4037fc['length'];_0x31f6ce+=0x1){_0x33246c[_0x4f15('0x9d')](ami[_0x4f15('0x9e')]({'action':'command','command':util[_0x4f15('0x83')](_0x4f15('0x9f'),_0x4037fc[_0x31f6ce][_0x4f15('0xa0')],!_[_0x4f15('0x42')](config['timezones'][_0x4fed9d])?_0x4fed9d:'')})[_0x4f15('0xa1')](function(_0xe0ece7){return _0xe0ece7[_0x4f15('0xa2')][_0x4f15('0xa3')](_0x4f15('0xa4'))>=0x0;})[_0x4f15('0xa5')](myreject(_0x5867b8)));}}else{_0x33246c['push'](ami[_0x4f15('0x9e')]({'action':_0x4f15('0xa6'),'command':util[_0x4f15('0x83')](_0x4f15('0x9f'),_0x4037fc,!_[_0x4f15('0x42')](config[_0x4f15('0x9a')][_0x4fed9d])?_0x4fed9d:'')})['then'](function(_0x529df6){return _0x529df6[_0x4f15('0xa2')][_0x4f15('0xa3')](_0x4f15('0xa4'))>=0x0;})['catch'](myreject(_0x5867b8)));}Promise[_0x4f15('0xa7')](_0x33246c)[_0x4f15('0xa1')](function(_0x22e08e){var _0x3f3fdb=_[_0x4f15('0xa8')](_0x22e08e);if(_0x3f3fdb){return _0x220222(_0x3f3fdb);}else{_0x5c87d2['message']=_0x32f017?utils[_0x4f15('0x70')][_0x4f15('0xa9')]:utils[_0x4f15('0x70')]['OVERTIME_INTERVAL'];return _0x5867b8(msgResponse(_0x4f15('0xaa'),_0x4f15('0x96'),_0x4f15('0xab')+_0x32f017+'\x20'+_0x11dec4+_0x4f15('0xac')+util['inspect'](_0x4037fc,{'showHidden':![],'depth':null})+_0x4f15('0xad')+_0x4fed9d));}})['catch'](function(_0x139bc8){return _0x5867b8(msgResponse(_0x4f15('0x99'),_0x4f15('0x96'),JSON['stringify'](_0x139bc8)));});});};Dialer[_0x4f15('0x19')][_0x4f15('0xae')]=function(){var _0x7051d0=this;return cmHopper[_0x4f15('0xaf')]({'active':![]},{'where':{'active':!![]}})[_0x4f15('0xa1')](function(){setInterval(function(){_0x7051d0[_0x4f15('0xb0')]();},0x3e8);});};Dialer[_0x4f15('0x19')][_0x4f15('0xb0')]=function(){var _0x309020=this;var _0x378b8e;for(var _0x46f67e in this[_0x4f15('0x20')]){if(typeof this['campaigns'][_0x46f67e]!==_0x4f15('0xb1')){_0x378b8e=this['campaigns'][_0x46f67e];if(utils['isIVRCampaign'](_0x378b8e)&&utils[_0x4f15('0x80')](_0x378b8e)){_0x378b8e[_0x4f15('0x85')]=!![];Promise[_0x4f15('0xb2')]()[_0x4f15('0xa1')](checkIsIVRCampaignActive(_0x378b8e))['then'](checkInterval(_0x378b8e))[_0x4f15('0xa1')](_0x309020[_0x4f15('0x8f')](_0x378b8e))[_0x4f15('0xa1')](_0x309020['checkIfTime'](_0x378b8e[_0x4f15('0xb3')],_0x378b8e[_0x4f15('0xb4')],_0x378b8e[_0x4f15('0x67')],_0x378b8e))['then'](_0x309020[_0x4f15('0x94')](_0x378b8e[_0x4f15('0x7f')],_0x378b8e[_0x4f15('0xb4')],_0x378b8e[_0x4f15('0x67')],_0x378b8e))[_0x4f15('0xa1')](_0x309020[_0x4f15('0xb5')](_0x378b8e))[_0x4f15('0xa5')](loggerCatchQueueSummary('[syncCampaigns]',_0x378b8e));}else{notSendMessagesCampaign(_0x378b8e);}}}};Dialer['prototype'][_0x4f15('0xb6')]=function(_0x2063e1){if(_0x2063e1['dialMethod']!==_0x4f15('0xb')){clearPredictiveAttributes(_0x2063e1);}switch(_0x2063e1['dialMethod']){case _0x4f15('0xb7'):this['handlePower'](_0x2063e1,0x1);break;case _0x4f15('0xb8'):this['handlePower'](_0x2063e1,_0x2063e1[_0x4f15('0xb9')]);break;case'predictive':this['predictive'](_0x2063e1);break;case _0x4f15('0xa'):this[_0x4f15('0xba')](_0x2063e1,0x1);break;default:logger[_0x4f15('0x6c')](_0x4f15('0xbb'),_0x2063e1['name'],_0x4f15('0xbc'));}};Dialer[_0x4f15('0x19')][_0x4f15('0x99')]=function(_0x45ba40,_0x23d6dd){var _0x397ff8=_0x45ba40[_0x4f15('0xb4')];var _0xd76a3a=_0x23d6dd?_0x45ba40['dialGlobalInterval']:_0x45ba40['Interval'][_0x4f15('0x7e')];logger[_0x4f15('0xbd')]('Dialer::ifTime()',_0xd76a3a,_0x397ff8,_0x45ba40[_0x4f15('0x67')],util[_0x4f15('0x83')](_0x4f15('0xbe'),_0x45ba40['name'],_0x45ba40['id']));var _0x1d9c98=null;return Interval[_0x4f15('0xbf')](_0xd76a3a,_0x397ff8)[_0x4f15('0xa1')](function(_0x40989b){if(_0x40989b===!![]){return _0x40989b;}else{_0x45ba40['message']=_0x23d6dd?utils['CAMPAIGN_STATUS'][_0x4f15('0xa9')]:utils[_0x4f15('0x70')][_0x4f15('0xc0')];_0x1d9c98=msgResponse(_0x4f15('0xaa'),'Failure',_0x4f15('0xab')+_0x23d6dd+'\x20'+_0x45ba40['name']+_0x4f15('0xac')+util['inspect'](_0xd76a3a,{'showHidden':![],'depth':null})+_0x4f15('0xad')+_0x397ff8);}if(_0x1d9c98!==null){logger[_0x4f15('0xbd')](_0x4f15('0xc1'),_0x1d9c98);_0x1d9c98['isGlobal']=_0x23d6dd;throw _0x1d9c98;}})[_0x4f15('0xa5')](function(_0x27170e){logger[_0x4f15('0x6c')](_0x4f15('0xc2'),_0x27170e);throw msgResponse('[ifTime][Action]',_0x4f15('0x8a'),util['inspect'](_0x27170e,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x4f15('0x2e')]=function(_0x299b25){if(this['voiceQueues'][_0x299b25[_0x4f15('0xc3')]]){if(this[_0x4f15('0x25')][_0x299b25[_0x4f15('0xc4')]]&&this[_0x4f15('0x25')][_0x299b25[_0x4f15('0xc4')]][_0x4f15('0x44')]!==_0x4f15('0xc5')){this[_0x4f15('0xc6')](this[_0x4f15('0x1f')][_0x299b25[_0x4f15('0xc3')]]);this[_0x4f15('0x25')][_0x299b25[_0x4f15('0xc4')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x4f15('0x19')]['syncAgentComplete']=function(_0x59c4c1){var _0x1eb061=this[_0x4f15('0x25')][_0x59c4c1[_0x4f15('0xc4')]];if(this[_0x4f15('0x1f')][_0x59c4c1[_0x4f15('0xc3')]]){if(_0x1eb061&&_0x1eb061[_0x4f15('0x44')]!==_0x4f15('0xc5')){delete this[_0x4f15('0x25')][_0x59c4c1[_0x4f15('0xc4')]];this[_0x4f15('0x1f')][_0x59c4c1[_0x4f15('0xc3')]]['outboundAnswerCallsDay']+=0x1;var _0x463359=new AgentComplete(_0x1eb061,_0x59c4c1);if(_0x59c4c1[_0x4f15('0xc7')]===_0x4f15('0xc8')){_0x463359[_0x4f15('0xc9')]=this[_0x4f15('0x1f')][_0x59c4c1[_0x4f15('0xc3')]]['dialQueueProject2']&&this[_0x4f15('0x1f')][_0x59c4c1[_0x4f15('0xc3')]]['dialAgiAfterHangupAgent']?moment()[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x4f15('0xca')](_0x463359)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0xcb')));hopperUtils[_0x4f15('0xcc')](_0x463359)['catch'](loggerCatch(_0x4f15('0xcd')));}}};Dialer['prototype'][_0x4f15('0x30')]=function(_0x62dc84){var _0xfbf34e=this[_0x4f15('0x25')][_0x62dc84[_0x4f15('0xc4')]];var _0x397350=this;var _0x377028=![];var _0x5a8bda;var _0x1f3278;if(this[_0x4f15('0x1f')][_0x62dc84['queue']]){if(_0xfbf34e&&_0xfbf34e[_0x4f15('0x44')]!=='ivr'){delete this['uniqueId'][_0x62dc84[_0x4f15('0xc4')]];this[_0x4f15('0xc6')](this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]]);_0xfbf34e[_0x4f15('0xce')]=moment()[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b59f8=new QueueCallerAbandon(_0xfbf34e,_0x62dc84);if(utils[_0x4f15('0x66')](_0xfbf34e['droptime'],_0xfbf34e[_0x4f15('0xcf')])>=_0xfbf34e[_0x4f15('0xd0')]){this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]][_0x4f15('0x51')]+=0x1;this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]][_0x4f15('0xd1')]+=0x1;this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b59f8[_0x4f15('0x74')]=0xa;_0x4b59f8[_0x4f15('0x75')]='Drop';_0x4b59f8[_0x4f15('0xd2')]=_0x4f15('0xd3');_0x4b59f8['agiafterat']=this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]]['dialQueueProject2']?moment()['format'](_0x4f15('0xd4')):undefined;_0x4b59f8[_0x4f15('0xd5')]+=0x1;_0x4b59f8[_0x4f15('0xd6')]+=0x1;_0x5a8bda=this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]]['dialDropRetryFrequency'];_0x1f3278=this[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x4f15('0xd7')](_0x4b59f8,_0x4b59f8[_0x4f15('0x74')],_0xfbf34e[_0x4f15('0xd8')])[_0x4f15('0xa1')](function(_0x5e559d){_0x377028=_0x5e559d[_0x4f15('0xd9')]==0x1;if(_0x4b59f8[_0x4f15('0xd5')]>=_0x397350['voiceQueues'][_0x62dc84[_0x4f15('0xc3')]]['dialDropMaxRetry']){_0x397350[_0x4f15('0xda')](_0x4b59f8,_0x5e559d['additional']);}else{hopperUtils[_0x4f15('0xdb')]({'active':![],'countdropretry':_0x4b59f8[_0x4f15('0xd5')],'scheduledat':moment()['add'](_0x397350['voiceQueues'][_0x62dc84[_0x4f15('0xc3')]][_0x4f15('0xdc')],'minutes')[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfbf34e[_0x4f15('0xdd')],'ListId':_0xfbf34e[_0x4f15('0xde')],'VoiceQueueId':_0xfbf34e['VoiceQueueId']||undefined,'CampaignId':_0xfbf34e[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact][Drop]'));var _0x1466a1=new History(_0x4b59f8);_0x1466a1[_0x4f15('0x74')]=0xa;_0x1466a1[_0x4f15('0x75')]=_0x4f15('0xe0');_0x1466a1['starttime']=moment()[_0x4f15('0x83')](_0x4f15('0xd4'));_0x1466a1['endtime']=_0x1466a1[_0x4f15('0x76')];_0x1466a1[_0x4f15('0xe1')]=_0x4b59f8[_0x4f15('0xe1')];_0x1466a1[_0x4f15('0xe2')]=_0x4b59f8[_0x4f15('0xe2')];hopperUtils[_0x4f15('0xca')](_0x1466a1)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x4f15('0xa1')](function(){if(_0x377028)hopperUtils[_0x4f15('0xe3')](_0x4b59f8,_0x5a8bda,_0x1f3278)[_0x4f15('0xa1')](function(){return 0x1;});});}else{this[_0x4f15('0x1f')][_0x62dc84['queue']][_0x4f15('0x53')]+=0x1;this['voiceQueues'][_0x62dc84[_0x4f15('0xc3')]][_0x4f15('0xe4')]+=0x1;_0x4b59f8['state']=0xb;_0x4b59f8[_0x4f15('0x75')]=_0x4f15('0xe5');_0x4b59f8[_0x4f15('0xd2')]='CALLEREXIT';_0x4b59f8[_0x4f15('0xe6')]+=0x1;_0x4b59f8[_0x4f15('0xd6')]+=0x1;_0x5a8bda=this[_0x4f15('0x1f')][_0x62dc84['queue']][_0x4f15('0xe7')];_0x1f3278=this[_0x4f15('0x1f')][_0x62dc84['queue']][_0x4f15('0xe8')];hopperUtils[_0x4f15('0xd7')](_0x4b59f8,_0x4b59f8[_0x4f15('0x74')],_0xfbf34e[_0x4f15('0xd8')])[_0x4f15('0xa1')](function(_0x4a1f47){if(_0x4b59f8[_0x4f15('0xe6')]>=_0x397350[_0x4f15('0x1f')][_0x62dc84[_0x4f15('0xc3')]][_0x4f15('0xe9')]){_0x397350[_0x4f15('0xda')](_0x4b59f8,_0x4a1f47[_0x4f15('0xd9')]);}else{hopperUtils[_0x4f15('0xdb')]({'active':![],'countabandonedretry':_0x4b59f8[_0x4f15('0xe6')],'scheduledat':moment()[_0x4f15('0xea')](_0x397350[_0x4f15('0x1f')][_0x62dc84['queue']][_0x4f15('0xe7')],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0xfbf34e['ContactId'],'ListId':_0xfbf34e[_0x4f15('0xde')],'VoiceQueueId':_0xfbf34e[_0x4f15('0xec')]||undefined,'CampaignId':_0xfbf34e[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch(_0x4f15('0xed')));var _0x44e648=new History(_0x4b59f8);_0x44e648[_0x4f15('0x74')]=0xb;_0x44e648[_0x4f15('0x75')]=_0x4f15('0xe5');_0x44e648['starttime']=moment()['format'](_0x4f15('0xd4'));_0x44e648[_0x4f15('0xee')]=_0x44e648[_0x4f15('0x76')];_0x44e648['calleridname']=_0x4b59f8['calleridname'];_0x44e648[_0x4f15('0xe2')]=_0x4b59f8['calleridnum'];hopperUtils['createHistory'](_0x44e648)['catch'](loggerCatch(_0x4f15('0xef')));}})[_0x4f15('0xa1')](function(){if(_0x377028)hopperUtils[_0x4f15('0xe3')](_0x4b59f8,_0x5a8bda,_0x1f3278)[_0x4f15('0xa1')](function(){return 0x1;});});}}}};Dialer[_0x4f15('0x19')]['syncNewExten']=function(_0x12e759){if(this[_0x4f15('0xf0')][_0x12e759['uniqueid']]){this['actions'][_0x12e759[_0x4f15('0xc4')]][_0x4f15('0xf1')]=_0x12e759['channel'];}if(this[_0x4f15('0x25')][_0x12e759[_0x4f15('0xc4')]]){this[_0x4f15('0x25')][_0x12e759['uniqueid']][_0x4f15('0xf1')]=_0x12e759['channel'];}};Dialer[_0x4f15('0x19')]['syncQueueMember']=function(_0x5e29ca){if(!this['actions'][_0x5e29ca[_0x4f15('0xf2')]]){return;}var _0x957524=this[_0x4f15('0x1f')][this[_0x4f15('0xf0')][_0x5e29ca['actionid']][_0x4f15('0xc3')]][_0x4f15('0xf3')]||_0x4f15('0xf4');if(_0x957524===_0x4f15('0xf5')){if(this[_0x4f15('0xf0')][_0x5e29ca[_0x4f15('0xf2')]]&&_['isNil'](this[_0x4f15('0xf0')][_0x5e29ca[_0x4f15('0xf2')]][_0x4f15('0xf6')])&&_0x5e29ca[_0x4f15('0x8d')]==='1'&&_0x5e29ca[_0x4f15('0xf7')]==='0'){if(this[_0x4f15('0xf8')][_0x5e29ca[_0x4f15('0xf9')]]){if(!this[_0x4f15('0xf8')][_0x5e29ca['stateinterface']][_0x4f15('0xf6')]){this[_0x4f15('0xf8')][_0x5e29ca[_0x4f15('0xf9')]][_0x4f15('0xf6')]=!![];this['actions'][_0x5e29ca[_0x4f15('0xf2')]][_0x4f15('0xf6')]=!![];this[_0x4f15('0xf0')][_0x5e29ca['actionid']][_0x4f15('0xf9')]=_0x5e29ca[_0x4f15('0xf9')];}}}}else if(_0x957524===_0x4f15('0xf4')){if(this[_0x4f15('0xf0')][_0x5e29ca[_0x4f15('0xf2')]]){if(this['agents'][_0x5e29ca[_0x4f15('0xf9')]]){this[_0x4f15('0xf0')][_0x5e29ca[_0x4f15('0xf2')]][_0x4f15('0xf9')]=_0x5e29ca[_0x4f15('0xf9')];if(_[_0x4f15('0xfa')](this[_0x4f15('0x2a')][this['actions'][_0x5e29ca['actionid']][_0x4f15('0xc3')]])){this[_0x4f15('0x2a')][this[_0x4f15('0xf0')][_0x5e29ca['actionid']]['queue']]=[];}this[_0x4f15('0x2a')][this['actions'][_0x5e29ca[_0x4f15('0xf2')]][_0x4f15('0xc3')]][_0x4f15('0x9d')](_['merge'](_['pick'](this[_0x4f15('0xf0')][_0x5e29ca[_0x4f15('0xf2')]],[_0x4f15('0xfb'),'stateinterface']),{'status':_0x5e29ca['status'],'paused':_0x5e29ca['paused']}));}}}};Dialer['prototype'][_0x4f15('0xfc')]=function(_0x4544ed){if(!this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]]){return;}var _0x3bea4c=this;var _0x2042b3=this['voiceQueues'][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]]['queue']];var _0x10d8ce=_0x2042b3[_0x4f15('0xf3')]||_0x4f15('0xf4');if(_0x10d8ce===_0x4f15('0xf5')){if(this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]]&&this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]]['stateinterface']){this[_0x4f15('0x1e')][_0x4f15('0xfd')](this['actions'][_0x4544ed['actionid']][_0x4f15('0xfb')],this['actions'][_0x4544ed['actionid']][_0x4f15('0xf9')])[_0x4f15('0xa5')](function(_0x46c68e){logger[_0x4f15('0x6c')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x4f15('0x48')](_0x46c68e,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3bea4c['updateOriginated'](_0x3bea4c[_0x4f15('0x1f')][_0x3bea4c[_0x4f15('0xf0')][_0x4544ed['actionid']][_0x4f15('0xc3')]]);_0x3bea4c[_0x4f15('0xf8')][_0x3bea4c[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xf9')]][_0x4f15('0xf6')]=![];delete _0x3bea4c[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]];unlockQueueStatus(_0x2042b3);});}else{this['updateOriginated'](this[_0x4f15('0x1f')][this['actions'][_0x4544ed['actionid']]['queue']]);hopperUtils[_0x4f15('0xdb')]({'active':![],'ContactId':this['actions'][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xdd')],'ListId':this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xde')],'VoiceQueueId':this[_0x4f15('0xf0')][_0x4544ed['actionid']][_0x4f15('0xec')]||undefined,'CampaignId':this['actions'][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]];unlockQueueStatus(_0x2042b3);}}else if(_0x10d8ce===_0x4f15('0xf4')){var _0x153185;if(this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]]&&!_['isEmpty'](this[_0x4f15('0x2a')][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xc3')]])){if(this[_0x4f15('0x2b')][_0x3bea4c[_0x4f15('0xf0')][_0x4544ed['actionid']][_0x4f15('0xc3')]]){this['queueBookedRR'][_0x3bea4c['actions'][_0x4544ed[_0x4f15('0xf2')]]['queue']]=this[_0x4f15('0x2b')][this['actions'][_0x4544ed[_0x4f15('0xf2')]]['queue']]?this[_0x4f15('0x2b')][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xc3')]]:this['queueBooked'][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xc3')]]?this[_0x4f15('0x2a')][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xc3')]][_0x4f15('0xfe')]||0x0:0x0;}this[_0x4f15('0x2a')][this[_0x4f15('0xf0')][_0x4544ed[_0x4f15('0xf2')]][_0x4f15('0xc3')]]['_rr']=this[_0x4f15('0x2b')][this[_0x4f15('0xf0')][_0x4544ed['actionid']][_0x4f15('0xc3')]];for(var _0x4892c1=0x0;_0x4892c1=_0x551c82[_0x4f15('0x126')]){_0x23b4ad[_0x4f15('0x127')](_0x1d0387,_0x310ef0,_0x57d68d,_0x4f15('0x128'));}else{if(_0x1d0387[_0x4f15('0x11f')]>=_0x551c82[_0x4f15('0x129')]){_0x23b4ad['createStateFinal'](_0x1d0387,_0x310ef0,_0x57d68d,_0x4f15('0x12a'));}else{hopperUtils[_0x4f15('0xdb')]({'active':![],'countmachineretry':_0x1d0387['countmachineretry'],'scheduledat':moment()[_0x4f15('0xea')](_0x551c82['dialMachineRetryFrequency'],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0x1d0387['ContactId'],'ListId':_0x1d0387[_0x4f15('0xde')],'VoiceQueueId':_0x1d0387[_0x4f15('0xec')]||undefined,'CampaignId':_0x1d0387['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x310ef0({'reschedule':0x1});}}});}if(_0x5041a5[_0x4f15('0x44')]===_0x4f15('0xc5')&&this['campaigns'][_0x5041a5['queue']]['dialAMDActive']&&_0x1b95a7[_0x4f15('0x111')]==='HANGUP'){delete this[_0x4f15('0x25')][_0x1b95a7[_0x4f15('0xc4')]];this[_0x4f15('0xc6')](this[_0x4f15('0x20')][_0x5041a5[_0x4f15('0xc3')]]);_0x4bae45=new Hangup(_0x5041a5,_0x1b95a7);_0x4bae45[_0x4f15('0x74')]=0x12;_0x4bae45[_0x4f15('0x75')]=_0x4f15('0x113');_0x4bae45[_0x4f15('0x114')]=_0x4f15('0x115');ami[_0x4f15('0x43')](_0x4f15('0x116'),ut[_0x4f15('0x117')](_0x4bae45,_0x4f15('0x118')));this[_0x4f15('0x119')](_0x4bae45,'[syncHangupInAMDIvr][createHistory]',_0x4f15('0x12b'));}if(_0x5041a5[_0x4f15('0x44')]===_0x4f15('0xc5')&&this[_0x4f15('0x20')][_0x5041a5['queue']]['dialAMDActive']&&_0x1b95a7[_0x4f15('0x111')]===_0x4f15('0x11c')){return new Promise(function(_0x2ccc5c,_0x3dfa14){delete _0x23b4ad[_0x4f15('0x25')][_0x1b95a7['uniqueid']];_0x23b4ad[_0x4f15('0xc6')](_0x23b4ad['campaigns'][_0x5041a5['queue']]);_0x23b4ad[_0x4f15('0x20')][_0x5041a5[_0x4f15('0xc3')]][_0x4f15('0x12c')]+=0x1;_0x23b4ad[_0x4f15('0x20')][_0x5041a5[_0x4f15('0xc3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4e2dcc=_0x23b4ad['campaigns'][_0x5041a5[_0x4f15('0xc3')]];var _0x1e4c88=new Hangup(_0x5041a5,_0x1b95a7);_0x1e4c88[_0x4f15('0x74')]=0x13;_0x1e4c88[_0x4f15('0x75')]='Machine';_0x1e4c88['membername']='AMD';_0x1e4c88[_0x4f15('0x11f')]+=0x1;_0x1e4c88[_0x4f15('0xd6')]+=0x1;_0x1e4c88[_0x4f15('0x118')]=!![];ami[_0x4f15('0x43')]('custom:amd',ut[_0x4f15('0x117')](_0x1e4c88,_0x4f15('0x118')));hopperUtils[_0x4f15('0xca')](_0x1e4c88)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1e4c88[_0x4f15('0x121')]+_0x1e4c88['countcongestionretry']+_0x1e4c88[_0x4f15('0x123')]+_0x1e4c88[_0x4f15('0x124')]+_0x1e4c88[_0x4f15('0xd5')]+_0x1e4c88[_0x4f15('0xe6')]+_0x1e4c88[_0x4f15('0x11f')]+_0x1e4c88[_0x4f15('0x125')]>=_0x4e2dcc[_0x4f15('0x126')]){_0x23b4ad['stateGlobal'](_0x1e4c88,_0x2ccc5c,_0x3dfa14,_0x4f15('0x128'));}else{if(_0x1e4c88[_0x4f15('0x11f')]>=_0x4e2dcc[_0x4f15('0x129')]){_0x23b4ad[_0x4f15('0x12d')](_0x1e4c88,_0x2ccc5c,_0x3dfa14,_0x4f15('0x12a'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1e4c88[_0x4f15('0x11f')],'scheduledat':moment()[_0x4f15('0xea')](_0x4e2dcc['dialMachineRetryFrequency'],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0x1e4c88[_0x4f15('0xdd')],'ListId':_0x1e4c88['ListId'],'VoiceQueueId':_0x1e4c88[_0x4f15('0xec')]||undefined,'CampaignId':_0x1e4c88[_0x4f15('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x2ccc5c({'reschedule':0x1});}}});}}};Dialer[_0x4f15('0x19')][_0x4f15('0x38')]=function(_0x31cc50){var _0x359f59=this['uniqueId'][_0x31cc50[_0x4f15('0xc4')]];var _0x5de12d;if(_0x359f59&&_0x359f59[_0x4f15('0x44')]==='ivr'){delete this['uniqueId'][_0x31cc50[_0x4f15('0xc4')]];this[_0x4f15('0xc6')](this['campaigns'][_0x359f59[_0x4f15('0xc3')]]);this[_0x4f15('0x20')][_0x359f59[_0x4f15('0xc3')]]['ivrAnswerCallsDay']+=0x1;_0x5de12d=new Hangup(_0x359f59,_0x31cc50);hopperUtils['createHistory'](_0x5de12d)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x4f15('0xcc')](_0x5de12d)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x12e')));}if(_0x359f59&&_0x359f59[_0x4f15('0x44')]!=='ivr'&&isNotNull(this[_0x4f15('0x1f')][_0x359f59[_0x4f15('0xc3')]][_0x4f15('0x12f')])){delete this[_0x4f15('0x25')][_0x31cc50['uniqueid']];this['updateOriginated'](this[_0x4f15('0x1f')][_0x359f59[_0x4f15('0xc3')]]);this[_0x4f15('0x1f')][_0x359f59['queue']][_0x4f15('0x12c')]+=0x1;this[_0x4f15('0x1f')][_0x359f59[_0x4f15('0xc3')]][_0x4f15('0x11d')]+=0x1;_0x5de12d=new Hangup(_0x359f59,_0x31cc50);_0x5de12d[_0x4f15('0x74')]=0x10;_0x5de12d[_0x4f15('0x75')]=_0x4f15('0x130');_0x5de12d[_0x4f15('0x114')]='AGI';hopperUtils[_0x4f15('0xca')](_0x5de12d)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x131')));hopperUtils[_0x4f15('0xcc')](_0x5de12d)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x12e')));}if(_0x359f59&&_0x359f59[_0x4f15('0x44')]!==_0x4f15('0xc5')&&!isNotNull(this[_0x4f15('0x1f')][_0x359f59['queue']][_0x4f15('0x12f')])){delete this['uniqueId'][_0x31cc50[_0x4f15('0xc4')]];this[_0x4f15('0xc6')](this[_0x4f15('0x1f')][_0x359f59[_0x4f15('0xc3')]]);this['voiceQueues'][_0x359f59[_0x4f15('0xc3')]]['outboundUnknownCallsDay']+=0x1;_0x5de12d=new Hangup(_0x359f59,_0x31cc50);_0x5de12d['state']=0xc;_0x5de12d['statedesc']=_0x31cc50[_0x4f15('0x132')];_0x5de12d[_0x4f15('0x114')]=_0x4f15('0x133');hopperUtils[_0x4f15('0xca')](_0x5de12d)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x131')));hopperUtils[_0x4f15('0xcc')](_0x5de12d)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x12e')));}};Dialer[_0x4f15('0x19')]['syncQueueSummary']=function(_0x3bf948){var _0x1eb5c9=this;if(!_0x1eb5c9[_0x4f15('0x2c')][_0x3bf948[_0x4f15('0x67')]]){_0x1eb5c9[_0x4f15('0x2c')][_0x3bf948[_0x4f15('0x67')]]={'running':![]};}else if(_0x1eb5c9[_0x4f15('0x2c')][_0x3bf948['name']][_0x4f15('0x134')]===!![]){return;}else if(_0x1eb5c9['queuesSummary'][_0x3bf948['name']][_0x4f15('0x134')]===![]){_0x1eb5c9[_0x4f15('0x2c')][_0x3bf948[_0x4f15('0x67')]][_0x4f15('0x134')]=!![];}var _0x45dadd=_0x1eb5c9[_0x4f15('0x1f')][_0x3bf948[_0x4f15('0x67')]];var _0x2e104e=_0x45dadd[_0x4f15('0x6f')]!==utils['CAMPAIGN_STATUS'][_0x4f15('0x81')];var _0x7df32f=utils[_0x4f15('0x135')](_0x45dadd);_0x45dadd[_0x4f15('0x136')]=utils[_0x4f15('0x137')](_0x45dadd,_0x1eb5c9['trunks']);Promise[_0x4f15('0xb2')]()[_0x4f15('0xa1')](function(){if(_0x45dadd[_0x4f15('0x136')]===utils[_0x4f15('0x70')][_0x4f15('0x81')]){if(_0x2e104e){clearPredictiveAttributes(_0x45dadd);_0x3bf948[_0x4f15('0x27')]=undefined;_0x3bf948[_0x4f15('0x28')]=undefined;}if(_0x45dadd['statusMessage']===utils[_0x4f15('0x70')][_0x4f15('0x81')]){_0x3bf948[_0x4f15('0x138')]=0x0;_0x3bf948[_0x4f15('0xf7')]=0x0;_0x3bf948['inUse']=0x0;_0x3bf948[_0x4f15('0x139')]=0x0;_0x3bf948[_0x4f15('0x13a')]=0x0;}}else if(_0x45dadd[_0x4f15('0x136')]===utils[_0x4f15('0x70')][_0x4f15('0x13b')]&&!_0x7df32f){return _0x1eb5c9[_0x4f15('0x99')](_0x45dadd,!![])[_0x4f15('0xa1')](function(){return _0x1eb5c9[_0x4f15('0x99')](_0x45dadd,![]);})[_0x4f15('0xa1')](function(){return _0x1eb5c9[_0x4f15('0xb6')](_0x45dadd);})[_0x4f15('0xa5')](function(_0x2c7169){loggerSyncQueueSummary['debug'](_0x4f15('0x13c'),util[_0x4f15('0x48')](_0x2c7169,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x45dadd);});}else{clearPredictiveAttributes(_0x45dadd);}})[_0x4f15('0xa1')](function(){var _0x1182c3=_0x3bf948[_0x4f15('0x13d')](_0x45dadd);if(_0x1182c3||_0x45dadd[_0x4f15('0x13e')]){_0x45dadd[_0x4f15('0x13e')]=![];_0x3bf948[_0x4f15('0x13f')](_0x45dadd);Object[_0x4f15('0x140')](_0x45dadd,_0x3bf948);emitOutboundVoiceQueueSummary(_0x3bf948);}_0x1eb5c9[_0x4f15('0x2c')][_0x45dadd[_0x4f15('0x67')]]['running']=![];})[_0x4f15('0xa5')](function(_0x479e58){logger[_0x4f15('0x6c')]('[syncQueueSummary]',util[_0x4f15('0x48')](_0x479e58,{'showHidden':![],'depth':null}));_0x1eb5c9[_0x4f15('0x2c')][_0x45dadd[_0x4f15('0x67')]][_0x4f15('0x134')]=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x4f15('0x141')](function(){var _0x5a6089=_[_0x4f15('0x142')](this[_0x4f15('0x1f')],function(_0x4bf122){return _0x4bf122[_0x4f15('0x143')];});var _0x31be21=_[_0x4f15('0x142')](this[_0x4f15('0xf8')],function(_0x5a8dbc){return _0x5a8dbc['online']&&_0x5a8dbc[_0x4f15('0x8d')]===_0x4f15('0x144');});if(_0x5a6089[_0x4f15('0xff')]>0x0&&_0x31be21[_0x4f15('0xff')]>0x0){return Promise['resolve']()[_0x4f15('0xa1')](cmHopper['handlePreviewRecallNotifications'](_[_0x4f15('0x145')](_0x5a6089,'id'),previewRecallmeReminderInterval,_[_0x4f15('0x145')](_0x31be21,'id')))[_0x4f15('0xa1')](function(_0x4d7876){for(var _0x4c90ea=0x0;_0x4c90ea<_0x4d7876[_0x4f15('0xff')];_0x4c90ea++){var _0x4b4e24=_0x4d7876[_0x4c90ea]['Agent'][_0x4f15('0x67')];if(_0x4b4e24)io['to'](util[_0x4f15('0x83')](_0x4f15('0x146'),_0x4b4e24))[_0x4f15('0x43')](_0x4f15('0x147'),{'hopper':_0x4d7876[_0x4c90ea]});}})[_0x4f15('0xa5')](function(_0x214492){logger[_0x4f15('0x6c')]('checkPreviewRecallReminder',_0x214492);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4f15('0x19')][_0x4f15('0x3f')]=function(){var _0x459ed7=this;setInterval(function(){_0x459ed7[_0x4f15('0x148')](_0x459ed7[_0x4f15('0x25')],_0x4f15('0x149'));_0x459ed7[_0x4f15('0x148')](_0x459ed7[_0x4f15('0xf0')],_0x4f15('0x14a'));},0x32c8);};Dialer[_0x4f15('0x19')][_0x4f15('0x148')]=function(_0x40928f,_0xfdb152){var _0x2b7649=this;for(var _0x27bbea in _0x40928f){if(typeof _0x40928f[_0x27bbea]!==_0x4f15('0xb1')){this[_0x4f15('0x1d')][_0x4f15('0x1a')](function(){if(!_[_0x4f15('0xfa')](_0x40928f[_0x27bbea])){return ami[_0x4f15('0x9e')]({'action':_0x4f15('0x8d'),'channel':_0x40928f[_0x27bbea]['channel']})[_0x4f15('0xa5')](function(_0x48229b){if(_0x48229b[_0x4f15('0x6f')]===_0x4f15('0x14b')){setTimeout(function(){if(_0x40928f[_0x27bbea]&&_0x40928f[_0x27bbea][_0x4f15('0x44')]!==_0x4f15('0xc5')){_0x2b7649[_0x4f15('0xc6')](_0x2b7649['voiceQueues'][_0x40928f[_0x27bbea][_0x4f15('0xc3')]]);logger[_0x4f15('0x6c')](_0x4f15('0x14c'),_0xfdb152,_0x27bbea,_0x40928f[_0x27bbea]['queue']);delete _0x40928f[_0x27bbea];}if(_0x40928f[_0x27bbea]&&_0x40928f[_0x27bbea][_0x4f15('0x44')]===_0x4f15('0xc5')){_0x2b7649[_0x4f15('0xc6')](_0x2b7649[_0x4f15('0x20')][_0x40928f[_0x27bbea]['queue']]);logger[_0x4f15('0x6c')](_0x4f15('0x14d'),_0xfdb152,_0x27bbea,_0x40928f[_0x27bbea][_0x4f15('0xc3')]);delete _0x40928f[_0x27bbea];}},0x2328);}});}});}}};Dialer['prototype'][_0x4f15('0x14e')]=function(_0x54c0c5){return Promise[_0x4f15('0xb2')]()[_0x4f15('0xa1')](voiceQueueRt[_0x4f15('0x14e')](_0x54c0c5))[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x14f')));};Dialer[_0x4f15('0x19')][_0x4f15('0xc6')]=function(_0xb68259){if(!_['isUndefined'](_0xb68259)&&_0xb68259!==null){if(typeof _0xb68259['originated']!==_0x4f15('0xb1')){if(_0xb68259[_0x4f15('0x86')]>0x0){_0xb68259[_0x4f15('0x86')]-=0x1;}else{logger[_0x4f15('0x6c')](_0x4f15('0x150'));}}}else{logger[_0x4f15('0x6c')](_0x4f15('0x151'));}};Dialer[_0x4f15('0x19')][_0x4f15('0x152')]=function(_0xdd264b,_0x3c4bb5){var _0x4710b2=this;return function(_0x2f9209){_0x4710b2[_0x4f15('0xc6')](_0x3c4bb5);logger[_0x4f15('0x6c')](_0xdd264b,util[_0x4f15('0x48')](_0x2f9209,{'showHidden':![],'depth':null}));};};Dialer[_0x4f15('0x19')]['emptyContact']=function(_0x1a6001,_0xb38ec4,_0x424fc5){var _0x192627={'state':0x19,'statedesc':_0x4f15('0x153')};this[_0x4f15('0xc6')](_0xb38ec4);this[_0x4f15('0x119')](_['merge'](_0x192627,_[_0x4f15('0x7b')](_0x424fc5,[_0x4f15('0xdd'),'ListId',_0x4f15('0x154'),_0x4f15('0xec'),_0x4f15('0xdf')])),'[emptyContact][createHistory]',_0x4f15('0x155'));logger[_0x4f15('0x6c')](_0x1a6001);};Dialer[_0x4f15('0x19')][_0x4f15('0x119')]=function(_0x53284f,_0x5e1358,_0x1b6cb7){hopperUtils[_0x4f15('0xca')](_0x53284f)[_0x4f15('0xa5')](loggerCatch(_0x5e1358));hopperUtils[_0x4f15('0xcc')](_0x53284f)[_0x4f15('0xa5')](loggerCatch(_0x1b6cb7));};Dialer[_0x4f15('0x19')]['queueCallerAbandonCreateState']=function(_0x1487cd,_0x2832a6){hopperUtils[_0x4f15('0xca')](_0x1487cd)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2832a6==0x0){hopperUtils[_0x4f15('0xcc')](_0x1487cd)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x4f15('0x156')]=function(_0x55283a){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_0x55283a['id'],previewRecallmeReminderInterval))[_0x4f15('0xa1')](function(_0x44d271){for(var _0x59a5a0=0x0;_0x59a5a0<_0x44d271[_0x4f15('0xff')];_0x59a5a0++){var _0x33fa3f=_0x44d271[_0x59a5a0][_0x4f15('0x157')][_0x4f15('0x67')];if(_0x33fa3f)io['to'](util[_0x4f15('0x83')](_0x4f15('0x146'),_0x33fa3f))[_0x4f15('0x43')](_0x4f15('0x147'),{'hopper':_0x44d271[_0x59a5a0]});}})[_0x4f15('0xa5')](function(){});};Dialer['prototype'][_0x4f15('0xb5')]=function(_0x126825){var _0x1bef09=this;return function(){_0x1bef09[_0x4f15('0x158')](_0x126825);};};Dialer['prototype'][_0x4f15('0x159')]=function(_0x2c8aee,_0xedd4fa){var _0x524d89=this;var _0x25422d=uuid['v4']();this['actions'][_0x25422d]=new Action(_0x2c8aee,_0xedd4fa,_0x25422d);return new Promise(function(_0xb3b86e,_0x2216cd){if(_[_0x4f15('0x42')](_0x2c8aee)&&typeof _0x2c8aee!==_0x4f15('0x15a')){return _0x2216cd(msgResponse('originate',_0x4f15('0x96'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0xedd4fa[_0x4f15('0x15b')])||_0xedd4fa[_0x4f15('0x15b')]===null){return _0x2216cd(msgResponse(_0x4f15('0x15c'),_0x4f15('0x96'),'contact\x20is\x20undefine'));}var _0x1b0236={'XMD-CALLERID':_0x524d89[_0x4f15('0xf0')][_0x25422d][_0x4f15('0x15d')](),'XMD-AGI':_0x2c8aee[_0x4f15('0x12f')]?util[_0x4f15('0x83')](_0x4f15('0x15e'),ipAgi,_0x2c8aee['dialQueueProject']):_0x4f15('0x15f'),'XMD-AGIAFTER':_0x2c8aee[_0x4f15('0x160')]?util[_0x4f15('0x83')](_0x4f15('0x15e'),ipAgi,_0x2c8aee[_0x4f15('0x160')]):_0x4f15('0x15f'),'XMD-QUEUE':utils[_0x4f15('0x161')](_0x2c8aee)?util[_0x4f15('0x83')]('\x22%s,%s%s,,,%s\x22',_0x2c8aee[_0x4f15('0x67')],_0x2c8aee[_0x4f15('0x162')]||'',_0x2c8aee[_0x4f15('0x163')]?'c':'',_0x2c8aee[_0x4f15('0xd0')]||0x3):'NONE','XMD-CONTACTID':_0xedd4fa[_0x4f15('0xdd')],'XMD-CDRTYPE':_0x4f15('0x9'),'CALLERID(all)':_0x524d89[_0x4f15('0xf0')][_0x25422d][_0x4f15('0x15d')](),'XMD-AMD':_0x2c8aee[_0x4f15('0x11b')]?_0x4f15('0x13b'):_0x4f15('0x15f'),'XMD-DESTINATION':_0x4f15('0x110')};if(_0x2c8aee['dialAMDActive']){_0x1b0236[_0x4f15('0x164')]=_0x2c8aee[_0x4f15('0x165')]||0x9c4;_0x1b0236['XMD-AMDGREETING']=_0x2c8aee['dialAMDGreeting']||0x5dc;_0x1b0236[_0x4f15('0x166')]=_0x2c8aee[_0x4f15('0x167')]||0x320;_0x1b0236[_0x4f15('0x168')]=_0x2c8aee[_0x4f15('0x169')]||0x1388;_0x1b0236['XMD-AMDMINWORDLENGTH']=_0x2c8aee[_0x4f15('0x16a')]||0x64;_0x1b0236[_0x4f15('0x16b')]=_0x2c8aee[_0x4f15('0x16c')]||0x32;_0x1b0236[_0x4f15('0x16d')]=_0x2c8aee[_0x4f15('0x16e')]||0x3;_0x1b0236[_0x4f15('0x16f')]=_0x2c8aee['dialAMDSilenceThreshold']||0x100;_0x1b0236[_0x4f15('0x170')]=_0x2c8aee['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x4f15('0x161')](_0x2c8aee)){_0x1b0236[_0x4f15('0x171')]=_0xedd4fa[_0x4f15('0xec')];}else{_0x1b0236['XMD-CAMPAIGNID']=_0xedd4fa[_0x4f15('0xdf')];}for(var _0x1673cc in _0xedd4fa[_0x4f15('0x172')]){if(typeof _0xedd4fa['Contact'][_0x1673cc]!==_0x4f15('0xb1')){if(isNotNull(_0xedd4fa[_0x4f15('0x172')][_0x1673cc])&&_0x1673cc!=='id'&&_0x1673cc!==_0x4f15('0x173')&&_0x1673cc!==_0x4f15('0x174')&&_0x1673cc!==_0x4f15('0x175')){_0x1b0236[util['format'](_0x4f15('0x176'),_0x4f15('0x177'),_['toUpper'](_0x1673cc))]=_0xedd4fa['Contact'][_0x1673cc];}}}var _0x1ff246=_0x524d89[_0x4f15('0x8b')](_0x2c8aee[_0x4f15('0x90')])?utils['getCallerId'](_0x2c8aee['Trunk']['callerid'],_0x2c8aee[_0x4f15('0x178')],_0x2c8aee[_0x4f15('0x179')]>0x0?utils[_0x4f15('0x17a')](_0x2c8aee[_0x4f15('0x17b')],_0x2c8aee[_0x4f15('0x179')]):_0x2c8aee['dialOriginateCallerIdNumber']):utils[_0x4f15('0x17c')](_[_0x4f15('0xfa')](_0x2c8aee['TrunkBackup'])?_0x2c8aee['Trunk']['callerid']:_0x2c8aee[_0x4f15('0x91')][_0x4f15('0x17d')],_0x2c8aee['dialOriginateCallerIdName'],_0x2c8aee[_0x4f15('0x179')]>0x0?utils[_0x4f15('0x17a')](_0x2c8aee['dialOriginateCallerIdNumber'],_0x2c8aee[_0x4f15('0x179')]):_0x2c8aee[_0x4f15('0x17b')]);if(_0x1ff246){_0x1b0236[_0x4f15('0x17e')]=_0x524d89['actions'][_0x25422d]['originatecalleridname']=utils[_0x4f15('0x17f')](_0x1ff246);_0x1b0236[_0x4f15('0x180')]=_0xedd4fa[_0x4f15('0x15b')];}_0x2c8aee[_0x4f15('0x181')]=_0x1b0236;return ami['Action']({'actionid':_0x25422d,'action':_0x4f15('0x15c'),'channel':_0x524d89['isTrunkReachable'](_0x2c8aee[_0x4f15('0x90')])?util[_0x4f15('0x83')](_0x4f15('0x182'),_0x2c8aee[_0x4f15('0x90')][_0x4f15('0x67')],isNotNull(_0x2c8aee['dialPrefix'])?_0x2c8aee[_0x4f15('0x183')][_0x4f15('0x184')]()||'':'',_0x2c8aee[_0x4f15('0x185')]>0x0?_0xedd4fa[_0x4f15('0x15b')]['substring'](_0x2c8aee[_0x4f15('0x185')]):_0xedd4fa[_0x4f15('0x15b')]):util[_0x4f15('0x83')]('SIP/%s/%s%s',_['isNil'](_0x2c8aee[_0x4f15('0x91')])?_0x2c8aee[_0x4f15('0x90')]['name']:_0x2c8aee[_0x4f15('0x91')][_0x4f15('0x67')],isNotNull(_0x2c8aee['dialPrefix'])?_0x2c8aee[_0x4f15('0x183')][_0x4f15('0x184')]()||'':'',_0x2c8aee['dialCutDigit']>0x0?_0xedd4fa[_0x4f15('0x15b')]['substring'](_0x2c8aee['dialCutDigit']):_0xedd4fa[_0x4f15('0x15b')]),'callerid':_0x1ff246,'Exten':_0x4f15('0x110'),'Context':_0x4f15('0x186'),'Priority':'1','variable':_0x1b0236,'timeout':(_0x2c8aee['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x25422d})['then'](function(_0x34d59f){return _0xb3b86e(_0x34d59f);})['catch'](function(_0x8678a4){_0x2c8aee['outboundOriginateFailureCallsDay']+=0x1;var _0x2717f9=new History(_0x524d89[_0x4f15('0xf0')][_0x25422d]);logger[_0x4f15('0x6c')](util[_0x4f15('0x83')](_0x4f15('0x187'),JSON[_0x4f15('0x7a')](_0x8678a4)));_0x2717f9[_0x4f15('0x74')]=0xe;_0x2717f9[_0x4f15('0x75')]='OriginateError';_0x2717f9['starttime']=moment()[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss');_0x2717f9[_0x4f15('0xee')]=_0x2717f9['starttime'];hopperUtils[_0x4f15('0xca')](_0x2717f9)[_0x4f15('0xa5')](loggerCatch('[originate][error]'));_0x524d89[_0x4f15('0xcc')](_0x2717f9)[_0x4f15('0xa5')](loggerCatch('[originate][error]'))[_0x4f15('0x1c')](function(){delete _0x524d89[_0x4f15('0xf0')][_0x25422d];return _0x2216cd(msgResponse(_0x4f15('0x15c'),_0x4f15('0x8a'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x4f15('0x188')]=function(_0x4fc30f,_0x567adc,_0x15c428){var _0xa648ef=new History(_0x567adc);if(_0xa648ef[_0x4f15('0x121')]+_0xa648ef['countcongestionretry']+_0xa648ef[_0x4f15('0x123')]+_0xa648ef[_0x4f15('0x124')]+_0xa648ef['countdropretry']+_0xa648ef['countabandonedretry']+_0xa648ef[_0x4f15('0x11f')]+_0xa648ef[_0x4f15('0x125')]>=_0x15c428['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4fc30f){case 0x3:if(_0xa648ef[_0x4f15('0x123')]>=_0x15c428[_0x4f15('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xa648ef[_0x4f15('0x123')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428[_0x4f15('0x18a')],'minutes')[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa648ef[_0x4f15('0xdd')],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef['VoiceQueueId']||undefined,'CampaignId':_0xa648ef['CampaignId']||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xa648ef['countbusyretry']>=_0x15c428[_0x4f15('0x18b')]-0x1){return!![];}hopperUtils[_0x4f15('0xdb')]({'active':![],'countbusyretry':_0xa648ef[_0x4f15('0x121')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428['dialBusyRetryFrequency'],_0x4f15('0xeb'))['format'](_0x4f15('0xd4')),'ContactId':_0xa648ef[_0x4f15('0xdd')],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef[_0x4f15('0xec')]||undefined,'CampaignId':_0xa648ef['CampaignId']||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xa648ef[_0x4f15('0x122')]>=_0x15c428[_0x4f15('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0xa648ef['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x15c428['dialCongestionRetryFrequency'],_0x4f15('0xeb'))['format'](_0x4f15('0xd4')),'ContactId':_0xa648ef[_0x4f15('0xdd')],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef[_0x4f15('0xec')]||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xa648ef[_0x4f15('0x124')]>=_0x15c428[_0x4f15('0x18d')]-0x1){return!![];}else{hopperUtils[_0x4f15('0xdb')]({'active':![],'countnosuchnumberretry':_0xa648ef[_0x4f15('0x124')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428[_0x4f15('0x18e')],'minutes')[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa648ef[_0x4f15('0xdd')],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef['VoiceQueueId']||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})['catch'](loggerCatch(_0x4f15('0x18f')));}break;case 0xa:if(_0xa648ef[_0x4f15('0xd5')]>=_0x15c428[_0x4f15('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xa648ef[_0x4f15('0xd5')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428[_0x4f15('0xdc')],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0xa648ef['ContactId'],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef[_0x4f15('0xec')]||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x191')));break;case 0xb:if(_0xa648ef[_0x4f15('0xe6')]>=_0x15c428[_0x4f15('0xe9')]-0x1){return!![];}hopperUtils[_0x4f15('0xdb')]({'active':![],'countabandonedretry':_0xa648ef[_0x4f15('0xe6')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428[_0x4f15('0xe7')],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0xa648ef['ContactId'],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef[_0x4f15('0xec')]||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xa648ef[_0x4f15('0x11f')]>=_0x15c428[_0x4f15('0x129')]-0x1){return!![];}hopperUtils[_0x4f15('0xdb')]({'active':![],'countmachineretry':_0xa648ef[_0x4f15('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x15c428[_0x4f15('0x192')],'minutes')[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa648ef[_0x4f15('0xdd')],'ListId':_0xa648ef[_0x4f15('0xde')],'VoiceQueueId':_0xa648ef['VoiceQueueId']||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xa648ef[_0x4f15('0x125')]>=_0x15c428[_0x4f15('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xa648ef[_0x4f15('0x125')]+=0x1,'scheduledat':moment()[_0x4f15('0xea')](_0x15c428[_0x4f15('0x194')],_0x4f15('0xeb'))[_0x4f15('0x83')](_0x4f15('0xd4')),'ContactId':_0xa648ef['ContactId'],'ListId':_0xa648ef['ListId'],'VoiceQueueId':_0xa648ef[_0x4f15('0xec')]||undefined,'CampaignId':_0xa648ef[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x195')));break;default:return!![];}};Dialer['prototype'][_0x4f15('0x10d')]=function(_0x3026bb,_0xbbd181,_0xee39b1){var _0x297c38=this;var _0x4124de=new History(_0x3026bb);var _0x1c416a=![];var _0x8864f0;var _0x67bdc2;return new Promise(function(_0x22d6d5,_0x28caa2){if(_[_0x4f15('0x42')](_0xbbd181)&&typeof _0xbbd181!=='object'){return _0x28caa2(msgResponse(_0x4f15('0x196'),_0x4f15('0x96'),_0x4f15('0x197')));}if(_[_0x4f15('0x42')](_0xee39b1)&&typeof _0xee39b1!==_0x4f15('0x15a')){return _0x28caa2(msgResponse(_0x4f15('0x196'),_0x4f15('0x96'),_0x4f15('0x198')));}hopperUtils[_0x4f15('0xd7')](_0x4124de,_0xee39b1[_0x4f15('0xc7')],_0xbbd181)[_0x4f15('0xa1')](function(_0x391715){if(_0x391715[_0x4f15('0xd9')]==0x1)_0x1c416a=!![];switch(_0xee39b1[_0x4f15('0xc7')]){case'0':_0xbbd181[_0x4f15('0x199')]+=0x1;_0x4124de[_0x4f15('0x74')]=0x0;_0x4124de['statedesc']=_0x4f15('0x19a');_0x4124de[_0x4f15('0x124')]+=0x1;_0x4124de[_0x4f15('0xd6')]+=0x1;ami['emit'](_0x4f15('0x19b'),ut['buildObj'](_0x3026bb,_0x4f15('0x19c')));_0x8864f0=_0xbbd181[_0x4f15('0x18e')];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];hopperUtils[_0x4f15('0xca')](_0x4124de)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x120')));if(_0x297c38['checkRetriveMax'](0x0,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x124')]>=_0xbbd181[_0x4f15('0x18d')]){_0x297c38[_0x4f15('0x12d')](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x19d'));}else{_0x297c38[_0x4f15('0x127')](_0x4124de,_0x22d6d5,_0x28caa2,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xbbd181[_0x4f15('0x19e')]+=0x1;_0x4124de[_0x4f15('0x74')]=0x3;_0x4124de[_0x4f15('0x75')]=_0x4f15('0x19f');_0x4124de[_0x4f15('0x123')]+=0x1;_0x4124de[_0x4f15('0xd6')]+=0x1;var _0x48fad7=ut['buildNoAnswerEventPayload'](_0x3026bb,_0xbbd181);ami[_0x4f15('0x43')](_0x4f15('0x1a0'),_0x48fad7);_0x8864f0=_0xbbd181[_0x4f15('0x18a')];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];hopperUtils[_0x4f15('0xca')](_0x4124de)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x297c38['checkRetriveMax'](0x3,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x123')]>=_0xbbd181[_0x4f15('0x189')]){_0x297c38['createStateFinal'](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1a1'));}else{_0x297c38['stateGlobal'](_0x4124de,_0x22d6d5,_0x28caa2,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xbbd181[_0x4f15('0x1a2')]+=0x1;_0x4124de[_0x4f15('0x74')]=0x5;_0x4124de[_0x4f15('0x75')]=_0x4f15('0x1a3');_0x4124de[_0x4f15('0x121')]+=0x1;_0x4124de[_0x4f15('0xd6')]+=0x1;ami[_0x4f15('0x43')](_0x4f15('0x1a4'),ut['buildObj'](_0x3026bb,_0x4f15('0x1a5')));_0x8864f0=_0xbbd181[_0x4f15('0x1a6')];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];hopperUtils[_0x4f15('0xca')](_0x4124de)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x297c38[_0x4f15('0x188')](0x5,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x121')]>=_0xbbd181[_0x4f15('0x18b')]){_0x297c38[_0x4f15('0x12d')](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1a7'));}else{_0x297c38[_0x4f15('0x127')](_0x4124de,_0x22d6d5,_0x28caa2,'reason\x205\x20busy');}}break;case'8':_0xbbd181[_0x4f15('0x1a8')]+=0x1;_0x4124de['state']=0x8;_0x4124de[_0x4f15('0x75')]=_0x4f15('0x1a9');_0x4124de[_0x4f15('0x122')]+=0x1;_0x4124de['countglobal']+=0x1;_0x8864f0=_0xbbd181[_0x4f15('0x1aa')];_0x67bdc2=_0xbbd181['callAdditionalPhoneAfterMin'];ami[_0x4f15('0x43')]('custom:agentcongestion',ut[_0x4f15('0x117')](_0x3026bb,'congestion'));hopperUtils['createHistory'](_0x4124de)['catch'](loggerCatch(_0x4f15('0x1ab')));if(_0x297c38[_0x4f15('0x188')](0x8,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x122')]>=_0xbbd181[_0x4f15('0x18c')]){_0x297c38['createStateFinal'](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1ac'));}else{_0x297c38[_0x4f15('0x127')](_0x4124de,_0x22d6d5,_0x28caa2,'reason\x208\x20congestion');}}break;case'11':_0xbbd181['outboundAbandonedCallsDay']+=0x1;_0x4124de[_0x4f15('0x74')]=0xb;_0x4124de[_0x4f15('0x75')]='Abandoned';_0x4124de['countabandonedretry']+=0x1;_0x4124de[_0x4f15('0xd6')]+=0x1;_0x8864f0=_0xbbd181[_0x4f15('0xe7')];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];hopperUtils['createHistory'](_0x4124de)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x297c38[_0x4f15('0x188')](0xb,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de['countabandonedretry']>=_0xbbd181['dialAbandonedMaxRetry']){_0x297c38['createStateFinal'](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1ad'));}else{_0x297c38['stateGlobal'](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1ad'));}}break;case'20':_0xbbd181[_0x4f15('0x1ae')]+=0x1;_0x4124de[_0x4f15('0x74')]=0x14;_0x4124de[_0x4f15('0x75')]=_0x4f15('0x1af');_0x4124de[_0x4f15('0x125')]+=0x1;_0x4124de['countglobal']+=0x1;_0x8864f0=_0xbbd181['dialAgentRejectRetryFrequency'];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];ami[_0x4f15('0x43')](_0x4f15('0x1b0'),ut['buildObj'](_0x3026bb,_0x4f15('0x1b1')));hopperUtils['createHistory'](_0x4124de)[_0x4f15('0xa5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x297c38[_0x4f15('0x188')](0x14,_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x125')]>=_0xbbd181[_0x4f15('0x193')]){_0x297c38['createStateFinal'](_0x4124de,_0x22d6d5,_0x28caa2,'reason\x2020\x20agentreject');}else{_0x297c38[_0x4f15('0x127')](_0x4124de,_0x22d6d5,_0x28caa2,_0x4f15('0x1b2'));}}break;default:_0xbbd181[_0x4f15('0x1b3')]+=0x1;_0x4124de[_0x4f15('0x74')]=0xc;_0x4124de[_0x4f15('0x75')]=_0xee39b1[_0x4f15('0xc7')];_0x8864f0=_0xbbd181['dialAgentRejectRetryFrequency'];_0x67bdc2=_0xbbd181[_0x4f15('0xe8')];hopperUtils['createHistory'](_0x4124de)[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x1b4')));if(_0x297c38[_0x4f15('0x188')](_0xee39b1[_0x4f15('0xc7')],_0x3026bb,_0xbbd181)&&!_0x1c416a){if(_0x4124de[_0x4f15('0x121')]+_0x4124de['countcongestionretry']+_0x4124de['countnoanswerretry']+_0x4124de[_0x4f15('0x124')]+_0x4124de['countdropretry']+_0x4124de[_0x4f15('0xe6')]+_0x4124de[_0x4f15('0x11f')]+_0x4124de[_0x4f15('0x125')]>=_0xbbd181[_0x4f15('0x126')]){_0x297c38[_0x4f15('0x127')](_0x4124de,_0x22d6d5,_0x28caa2,_0xee39b1[_0x4f15('0xc7')]);}else{_0x297c38[_0x4f15('0x12d')](_0x4124de,_0x22d6d5,_0x28caa2,_0xee39b1[_0x4f15('0xc7')]);}}}})['then'](function(){if(_0x1c416a){hopperUtils[_0x4f15('0xe3')](_0x4124de,_0x8864f0,_0x67bdc2)[_0x4f15('0xa1')](function(){return _0x22d6d5(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x5185f4,_0x2277dd,_0x45bfed,_0x46db11){var _0x3938dc=new Final(_0x5185f4);_0x3938dc[_0x4f15('0x74')]=0xf;_0x3938dc[_0x4f15('0x75')]=_0x4f15('0x1b5');this[_0x4f15('0x12d')](_0x3938dc,_0x2277dd,_0x45bfed,_0x46db11);};Dialer[_0x4f15('0x19')][_0x4f15('0x12d')]=function(_0x24bb3c,_0x2618cf,_0x1c6063,_0x4e2ede){hopperUtils['moveContactManagedDialer'](_0x24bb3c)[_0x4f15('0xa1')](function(){return _0x2618cf(msgResponse('[callProgressDetecting]','Success',_0x4e2ede));})[_0x4f15('0xa5')](function(){return _0x1c6063(msgResponse(_0x4f15('0x1b6'),_0x4f15('0x96'),'contact\x20not\x20moved'));});};Dialer[_0x4f15('0x19')][_0x4f15('0xb')]=function(_0x5937de){var _0x5ea880=_0x5937de[_0x4f15('0x1b7')]/0x64;var _0x3eb913=_0x5937de[_0x4f15('0xd1')]/(_0x5937de[_0x4f15('0xd1')]+_0x5937de[_0x4f15('0x12c')]);var _0x5b35ec=Math[_0x4f15('0x1b8')](_0x5937de[_0x4f15('0x1b9')]*(_0x5937de['predictiveIntervalMaxThreshold']/0x64));var _0x46c38d=Math[_0x4f15('0x1b8')](_0x5937de[_0x4f15('0x1b9')]*(_0x5937de[_0x4f15('0x1ba')]/0x64));var _0x53ef93=_0x5937de[_0x4f15('0x138')]+_0x5937de['talking'];var _0x120496=Math['floor'](_0x5937de[_0x4f15('0x60')]*_0x5937de['erlangAbandonmentRate']*_0x5937de[_0x4f15('0x1bb')]*_0x5937de[_0x4f15('0x1bc')]);if(_[_0x4f15('0x42')](_0x5937de[_0x4f15('0x28')])){if(!_[_0x4f15('0x42')](_0x5937de[_0x4f15('0x27')])){_0x5937de[_0x4f15('0x27')]=undefined;loggerPredictive[_0x4f15('0x6c')](_0x4f15('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x4f15('0x42')](_0x5937de[_0x4f15('0x6a')])){loggerPredictive[_0x4f15('0x6c')](_0x4f15('0x1bd'),_0x4f15('0x1be'));clearInterval(_0x5937de['handlePredictive']);_0x5937de[_0x4f15('0x6a')]=undefined;}_0x5937de[_0x4f15('0x28')]=moment()[_0x4f15('0x83')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4f15('0x4c')](_0x5937de[_0x4f15('0x67')],_0x4f15('0x1bf'),_0x5937de[_0x4f15('0x28')]);this[_0x4f15('0xba')](_0x5937de,0x1);}else if(ifInterval(_0x5937de['dialPredictiveInterval'],_0x5937de['startProgressive'])){this[_0x4f15('0xba')](_0x5937de,0x1);loggerPredictiveCalls['info'](_0x4f15('0x1c0'),_0x5937de[_0x4f15('0x28')],_0x5937de[_0x4f15('0x67')]);_0x5937de[_0x4f15('0x60')]=0x0;_0x5937de[_0x4f15('0x1c1')]=0x0;}else if(_0x5ea880<_0x3eb913&&_0x5937de[_0x4f15('0x1c2')]===_0x4f15('0x1c3')){clearPredictiveAttributes(_0x5937de);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x1c4'),_0x4f15('0x1c5'),_0x3eb913,_0x4f15('0x28'),_0x5937de[_0x4f15('0x67')]);}else if(_0x120496<_0x5937de[_0x4f15('0x1c1')]&&_0x5937de[_0x4f15('0x1c2')]===_0x4f15('0x1c3')){clearPredictiveAttributes(_0x5937de);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x1c6'),'Max\x20Drop\x20',_0x120496,_0x4f15('0x1c7'),_0x5937de['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5937de[_0x4f15('0x67')]);}else if(!ifInterval(_0x5937de['dialPredictiveInterval'],_0x5937de[_0x4f15('0x28')])&&_[_0x4f15('0x42')](_0x5937de[_0x4f15('0x27')])&&!_[_0x4f15('0x42')](_0x5937de[_0x4f15('0x28')])){_0x5937de[_0x4f15('0x27')]=moment()[_0x4f15('0x83')](_0x4f15('0xd4'));loggerPredictive[_0x4f15('0x4c')](_0x5937de[_0x4f15('0x67')],'started\x20in\x20predictive\x20at',_0x5937de['startPredictive']);hopperUtils['avgHandleTime'](_0x5937de['dialPredictiveInterval'])[_0x4f15('0xa1')](this[_0x4f15('0x1c8')](_0x5937de))[_0x4f15('0xa1')](mergeDataErlangB(_0x5937de))[_0x4f15('0xa1')](this['startMethodPredictive'](_0x5937de))['catch'](loggerCatchPredictive(_0x4f15('0x1c9'),_0x5937de));}else if(!ifInterval(_0x5937de[_0x4f15('0x1ca')],_0x5937de[_0x4f15('0x27')])){_0x5937de[_0x4f15('0x1c1')]=0x0;_0x5937de[_0x4f15('0x27')]=moment()['format'](_0x4f15('0xd4'));loggerPredictive[_0x4f15('0x4c')](_0x5937de['name'],_0x4f15('0x1cb'),_0x5937de[_0x4f15('0x27')]);clearInterval(_0x5937de['handlePredictive']);_0x5937de[_0x4f15('0x6a')]=undefined;hopperUtils[_0x4f15('0x1cc')](_0x5937de[_0x4f15('0x1ca')])[_0x4f15('0xa1')](this[_0x4f15('0x1c8')](_0x5937de))[_0x4f15('0xa1')](mergeDataErlangB(_0x5937de))['then'](this[_0x4f15('0x1cd')](_0x5937de))[_0x4f15('0xa5')](loggerCatchPredictive(_0x4f15('0x1ce'),_0x5937de));}else if(_0x5937de[_0x4f15('0x1b9')]&&_0x53ef93<_0x5937de[_0x4f15('0x1b9')]-_0x46c38d){clearPredictiveAttributes(_0x5937de);loggerPredictive['info'](_0x5937de[_0x4f15('0x67')],_0x4f15('0x1cf'),_0x53ef93,_0x4f15('0x1d0'),_0x5937de['predictiveIntervalAvailable'],'-',_0x46c38d,'=',_0x5937de['predictiveIntervalAvailable']-_0x46c38d,')');}else if(_0x5937de['predictiveIntervalAvailable']&&_0x53ef93>_0x5937de['predictiveIntervalAvailable']+_0x5b35ec){clearPredictiveAttributes(_0x5937de);loggerPredictive[_0x4f15('0x4c')](_0x5937de[_0x4f15('0x67')],_0x4f15('0x1cf'),_0x53ef93,_0x4f15('0x1d1'),_0x5937de[_0x4f15('0x1b9')],'+',_0x5b35ec,'=',_0x5937de[_0x4f15('0x1b9')]+_0x5b35ec,')');}};Dialer['prototype'][_0x4f15('0x1c8')]=function(_0xc84660){var _0x519c66=this;return function(_0x25a0a9){return new Promise(function(_0x230cf9,_0x257fea){_[_0x4f15('0x1d2')](_0xc84660,_0x25a0a9[0x0]);if(checkGetDataPredictive(_0x25a0a9[0x0])){var _0x2d4be8=_0xc84660['predictiveIntervalAvailable']=_0xc84660[_0x4f15('0x139')]+_0xc84660[_0x4f15('0x138')];var _0xb0d043=_0xc84660[_0x4f15('0x1ca')]*0x3c;var _0x1e13a3=_0x25a0a9[0x0][_0x4f15('0x56')]+_0x25a0a9[0x0][_0x4f15('0x5a')];var _0x5cacc5=(_0x25a0a9[0x0]['predictiveIntervalAnsweredCalls']+_0x25a0a9[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25a0a9[0x0][_0x4f15('0x53')])/_0x25a0a9[0x0][_0x4f15('0x58')];_0xc84660[_0x4f15('0x1bb')]=_0x5cacc5>0x0?_0x5cacc5:0x1;switch(_0xc84660[_0x4f15('0x1c2')]){case _0x4f15('0x1c3'):var _0x3090ba=_0xc84660[_0x4f15('0x1b7')]/0x64;return _0x519c66[_0x4f15('0x1d3')](_0x2d4be8,_0xb0d043,_0x1e13a3,_0x5cacc5,_0x3090ba)[_0x4f15('0xa1')](function(_0x216f1f){return _0x230cf9(_0x216f1f);});case'agentBusyFactor':var _0x5ee580=_0xc84660['dialPredictiveOptimizationPercentage']/0x64;return _0x519c66[_0x4f15('0x1d4')](_0x2d4be8,_0xb0d043,_0x1e13a3,_0x5cacc5,_0x5ee580)[_0x4f15('0xa1')](function(_0x1c28c7){return _0x230cf9(_0x1c28c7);});default:return _0x257fea(msgResponse(_0x4f15('0x1d5'),_0x4f15('0x96'),_0x4f15('0x1d6')));}}else{return _0x257fea(msgResponse(_0x4f15('0x1d5'),_0x4f15('0x96'),_0x4f15('0x1d7')));}});};};Dialer[_0x4f15('0x19')]['getDataPredictiveOld']=function(_0x1c171e){var _0x2eb696=this;return function(_0x349e23){return new Promise(function(_0x3dd2d3,_0x3b65fb){_[_0x4f15('0x1d2')](_0x1c171e,_0x349e23[0x0]);if(checkGetDataPredictive(_0x349e23[0x0])){loggerPredictive['info'](JSON[_0x4f15('0x7a')](_0x349e23[0x0]));if(_0x1c171e['dialPredictiveOptimization']===_0x4f15('0x1c3')){return _0x2eb696[_0x4f15('0x14e')](_0x1c171e['id'])[_0x4f15('0xa1')](function(_0x18da86){var _0x3d6342=_0x1c171e[_0x4f15('0x1d8')]-_0x18da86[0x0][_0x4f15('0x1d9')];var _0xad693e=_0x1c171e[_0x4f15('0x1ca')]*0x3c;var _0x214b72=_0x349e23[0x0][_0x4f15('0x56')]+_0x349e23[0x0][_0x4f15('0x5a')];var _0x3b9cc1=(_0x349e23[0x0][_0x4f15('0x1da')]+_0x349e23[0x0][_0x4f15('0x51')]+_0x349e23[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x349e23[0x0][_0x4f15('0x58')];var _0x5f2fd8=_0x1c171e[_0x4f15('0x1b7')]/0x64;_0x1c171e['predictiveIntervalPauses']=_0x18da86[0x0][_0x4f15('0x1d9')]||0x0;_0x1c171e['predictiveIntervalHitRate']=_0x3b9cc1>0x0?_0x3b9cc1:0x1;return _0x2eb696[_0x4f15('0x1d3')](_0x3d6342,_0xad693e,_0x214b72,_0x3b9cc1,_0x5f2fd8);})[_0x4f15('0xa1')](function(_0x4ab9c9){return _0x3dd2d3(_0x4ab9c9);})[_0x4f15('0xa5')](function(_0x51bc7d){return _0x3b65fb(msgResponse('[CatchErlangB]',_0x4f15('0x96'),JSON[_0x4f15('0x7a')](_0x51bc7d)));});}if(_0x1c171e[_0x4f15('0x1c2')]==='agentBusyFactor'){return _0x2eb696[_0x4f15('0x14e')](_0x1c171e['id'])[_0x4f15('0xa1')](function(_0x378aa9){var _0x533f54=_0x1c171e[_0x4f15('0x1d8')]-_0x378aa9[0x0][_0x4f15('0x1d9')];var _0x463296=_0x1c171e[_0x4f15('0x1ca')]*0x3c;var _0x1fdf94=_0x349e23[0x0]['predictiveIntervalAvgTalktime']+_0x349e23[0x0]['predictiveIntervalAvgHoldtime'];var _0x4f0747=(_0x349e23[0x0][_0x4f15('0x1da')]+_0x349e23[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x349e23[0x0][_0x4f15('0x53')])/_0x349e23[0x0][_0x4f15('0x58')];var _0x1b179f=_0x1c171e[_0x4f15('0x1b7')]/0x64;_0x1c171e[_0x4f15('0x1db')]=_0x378aa9[0x0][_0x4f15('0x1d9')]||0x0;_0x1c171e[_0x4f15('0x1bb')]=_0x4f0747>0x0?_0x4f0747:0x1;return _0x2eb696['busyFactor'](_0x533f54,_0x463296,_0x1fdf94,_0x4f0747,_0x1b179f);})[_0x4f15('0xa1')](function(_0x5d4312){return _0x3dd2d3(_0x5d4312);})[_0x4f15('0xa5')](function(_0x5916d2){return _0x3b65fb(msgResponse(_0x4f15('0x1dc'),_0x4f15('0x96'),JSON[_0x4f15('0x7a')](_0x5916d2)));});}}else{return _0x3b65fb(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x28a36e){var _0x5e09ac=this;return function(){var _0x22c342=0x0;var _0x27df39=Math['floor'](_0x28a36e[_0x4f15('0x1dd')]*0x3e8);if(_0x27df39>0x0){_0x27df39=_0x27df39<0x64?0x64:_0x27df39;loggerPredictive[_0x4f15('0x4c')](_0x28a36e['name'],_0x4f15('0x1de'),_0x27df39,_0x4f15('0x1df'));_0x28a36e[_0x4f15('0x6a')]=setInterval(function(){_0x5e09ac['handlePredictive'](_0x28a36e);loggerPredictiveCalls['info'](_0x4f15('0x1e0'),_0x22c342+=0x1);},_0x27df39);}else{loggerPredictive[_0x4f15('0x4c')](_0x28a36e[_0x4f15('0x67')],_0x4f15('0x1e1'));}};};Dialer['prototype'][_0x4f15('0x1e2')]=function(_0x35890c,_0x32f8af){var _0x4e13ff=this;return function(_0x26f324){if(_[_0x4f15('0x4b')](_0x26f324)){if(_[_0x4f15('0xfa')](_0x32f8af[_0x4f15('0x154')])||!_0x32f8af['recallme']){if(_0x35890c[_0x4f15('0x1e3')]===_0x4f15('0xa')){_0x35890c[_0x4f15('0x77')]=_[_0x4f15('0x42')](_0x35890c[_0x4f15('0x77')])?!![]:_0x35890c[_0x4f15('0x77')];var _0xb73cec=uuid['v4']();_0x4e13ff['actions'][_0xb73cec]=new Action(_0x35890c,_0x32f8af,_0xb73cec);loggerBooked[_0x4f15('0x4c')](_0x4f15('0x1e4'),_0xb73cec,'queueStatusComplete:\x20',JSON['stringify'](_0x35890c[_0x4f15('0x77')]),_0x4f15('0x1e5'),_0x35890c[_0x4f15('0x67')]);if(_0x35890c[_0x4f15('0x77')]){_0x35890c[_0x4f15('0x77')]=![];_0x4e13ff[_0x4f15('0x2a')][_0x4e13ff[_0x4f15('0xf0')][_0xb73cec][_0x4f15('0xc3')]]=[];ami[_0x4f15('0x9e')]({'actionid':_0xb73cec,'action':_0x4f15('0x1e6'),'queue':_0x35890c[_0x4f15('0x67')]})[_0x4f15('0xa5')](function(){_0x4e13ff[_0x4f15('0xc6')](_0x35890c);hopperUtils[_0x4f15('0xdb')]({'active':![],'ContactId':_0x4e13ff[_0x4f15('0xf0')][_0xb73cec]['ContactId'],'ListId':_0x4e13ff[_0x4f15('0xf0')][_0xb73cec]['ListId'],'VoiceQueueId':_0x4e13ff[_0x4f15('0xf0')][_0xb73cec][_0x4f15('0xec')]||undefined,'CampaignId':_0x4e13ff['actions'][_0xb73cec][_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x1e7')));delete _0x4e13ff['actions'][_0xb73cec];});}else{loggerBooked[_0x4f15('0x4c')]('[booked][checkContactBlack][else]',JSON[_0x4f15('0x7a')](_0x35890c[_0x4f15('0x77')]),_0x4f15('0x1e5'),_0x35890c[_0x4f15('0x67')]);_0x4e13ff[_0x4f15('0xc6')](_0x35890c);hopperUtils[_0x4f15('0xdb')]({'active':![],'ContactId':_0x4e13ff['actions'][_0xb73cec][_0x4f15('0xdd')],'ListId':_0x4e13ff['actions'][_0xb73cec][_0x4f15('0xde')],'VoiceQueueId':_0x4e13ff[_0x4f15('0xf0')][_0xb73cec]['VoiceQueueId']||undefined,'CampaignId':_0x4e13ff[_0x4f15('0xf0')][_0xb73cec][_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x1e7')));delete _0x4e13ff[_0x4f15('0xf0')][_0xb73cec];}}else{return _0x4e13ff[_0x4f15('0x159')](_0x35890c,_0x32f8af);}}else{if(utils[_0x4f15('0x66')](undefined,_0x32f8af[_0x4f15('0x1e8')])<_0x35890c['dialRecallMeTimeout']*0x3c){if(_0x32f8af['Agent']&&!_0x32f8af[_0x4f15('0x157')][_0x4f15('0x1e9')]){_0x4e13ff[_0x4f15('0x1e')][_0x4f15('0xfd')](_0x32f8af['id'])[_0x4f15('0x1c')](function(){_0x4e13ff[_0x4f15('0xc6')](_0x35890c);});}else{hopperUtils[_0x4f15('0x1ea')]({'active':![]},_0x32f8af['id'],0x1)[_0x4f15('0x1c')](function(){_0x4e13ff[_0x4f15('0xc6')](_0x35890c);});}}else{_0x35890c[_0x4f15('0x1eb')]+=0x1;_0x4e13ff[_0x4f15('0xc6')](_0x35890c);if(_0x35890c[_0x4f15('0x1ec')]){hopperUtils[_0x4f15('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x32f8af['ContactId'],'ListId':_0x32f8af[_0x4f15('0xde')],'VoiceQueueId':_0x32f8af[_0x4f15('0xec')]||undefined,'CampaignId':_0x32f8af[_0x4f15('0xdf')]||undefined})[_0x4f15('0xa5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x35890c,_0x32f8af,utils['CAMPAIGN_STATUS'][_0x4f15('0x1ed')],0x17,_0x4f15('0x1ee')))[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x1ef')));}else{_0x4e13ff[_0x4f15('0x119')](createObjHistory(_0x35890c,_0x32f8af,utils[_0x4f15('0x70')][_0x4f15('0x1f0')],0x16,'RecallFailedTimeout'),_0x4f15('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x35890c['outboundBlacklistCallsDay']+=0x1;_0x4e13ff[_0x4f15('0x119')](createObjHistory(_0x35890c,_0x32f8af,utils[_0x4f15('0x70')][_0x4f15('0x1f2')],0xd,_0x4f15('0x1f3')),'[Originate][historyBlacklist]',_0x4f15('0x1f4'));throw _0x4f15('0x1f5');}};};Dialer['prototype'][_0x4f15('0x158')]=function(_0xeb279b){var _0x17c8ec=this;var _0x4ffec2=_0xeb279b[_0x4f15('0x1f6')]-_0xeb279b[_0x4f15('0x86')]-_0xeb279b[_0x4f15('0x1f7')];emitCampaignSummary(_0xeb279b);if(_0x4ffec2>0x0){if(_0x4ffec2>this[_0x4f15('0x22')]){_0x4ffec2=this[_0x4f15('0x22')];}_0xeb279b['temp']+=_0x4ffec2;hopperUtils['getContactDialerIvr'](_0xeb279b['id'],_0x4ffec2,_0xeb279b['dialOrderByScheduledAt'],_0xeb279b)[_0x4f15('0xa1')](function(_0x5b7fc2){_0xeb279b['temp']-=_0x4ffec2;_0xeb279b[_0x4f15('0x1f7')]=_0xeb279b[_0x4f15('0x1f7')]>0x0?_0xeb279b[_0x4f15('0x1f7')]:0x0;if(!utils['checkContactEmpty'](_0x5b7fc2)){_0xeb279b[_0x4f15('0x6f')]=utils[_0x4f15('0x70')]['NO_AVAILABLE_CONTACTS'];logger[_0x4f15('0x4c')](_0x4f15('0x1f8')+_0xeb279b['name']);}else{_0xeb279b[_0x4f15('0x86')]+=_0x5b7fc2[_0x4f15('0xff')];_0xeb279b['message']=utils['CAMPAIGN_STATUS'][_0x4f15('0x1f9')];for(var _0x4ee326=0x0;_0x4ee326<_0x5b7fc2[_0x4f15('0xff')];_0x4ee326+=0x1){_0xeb279b[_0x4f15('0x1fa')]+=0x1;if(_[_0x4f15('0xfa')](_0x5b7fc2[_0x4ee326])||_[_0x4f15('0xfa')](_0x5b7fc2[_0x4ee326][_0x4f15('0x172')])||_[_0x4f15('0xfa')](_0x5b7fc2[_0x4ee326][_0x4f15('0x15b')])){_0x17c8ec[_0x4f15('0x1fb')](_0x4f15('0x1fc'),_0xeb279b,_0x5b7fc2[_0x4ee326]);}else{hopperUtils[_0x4f15('0x1fd')](_[_0x4f15('0x7b')](_0x5b7fc2[_0x4ee326],[_0x4f15('0xdf'),_0x4f15('0x15b')]))['then'](_0x17c8ec[_0x4f15('0x1e2')](_0xeb279b,_0x5b7fc2[_0x4ee326]))[_0x4f15('0xa5')](_0x17c8ec[_0x4f15('0x152')](_0x4f15('0x1fe'),_0xeb279b));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0xeb279b,_0x4ffec2));}};Dialer[_0x4f15('0x19')][_0x4f15('0xba')]=function(_0x3ba8c6,_0x2ba537){var _0x55a8be=this;var _0x41560e=[];if(_0x2ba537<0x1||_0x3ba8c6[_0x4f15('0x1e3')]==='booked'){_0x2ba537=0x1;}var _0x2ac90a=Math[_0x4f15('0x1ff')](_0x3ba8c6['available']*_0x2ba537)-_0x3ba8c6[_0x4f15('0x86')]-_0x3ba8c6['temp'];if(_0x3ba8c6[_0x4f15('0x200')]>0x0){var _0x5eaa01=_0x3ba8c6[_0x4f15('0x200')]-_0x3ba8c6[_0x4f15('0x86')]-_0x3ba8c6[_0x4f15('0x139')]-_0x3ba8c6['temp']-_0x3ba8c6['pTalking'];if(_0x2ac90a>_0x5eaa01){_0x2ac90a=_0x5eaa01;}}if(_0x2ac90a>0x0){if(_0x3ba8c6[_0x4f15('0x1e3')]==='booked'){_0x2ac90a=0x1;}if(_0x2ac90a>this[_0x4f15('0x22')]){_0x2ac90a=this[_0x4f15('0x22')];}_0x3ba8c6[_0x4f15('0x1f7')]+=_0x2ac90a;for(var _0x5ef45e in this[_0x4f15('0xf8')]){if(typeof this[_0x4f15('0xf8')][_0x5ef45e]!==_0x4f15('0xb1')){if(this[_0x4f15('0xf8')][_0x5ef45e][_0x4f15('0x74')]===_0x4f15('0x201')&&this[_0x4f15('0xf8')][_0x5ef45e][_0x4f15('0x8d')]==='reachable'){_0x41560e[_0x4f15('0x9d')](this[_0x4f15('0xf8')][_0x5ef45e]['id']);}}}hopperUtils[_0x4f15('0x202')](_0x3ba8c6,_0x41560e,_0x2ac90a)[_0x4f15('0xa1')](function(_0xb822e6){_0x3ba8c6[_0x4f15('0x1f7')]-=_0x2ac90a;_0x3ba8c6[_0x4f15('0x1f7')]=_0x3ba8c6['temp']>0x0?_0x3ba8c6['temp']:0x0;if(!utils[_0x4f15('0x203')](_0xb822e6)){hopperUtils[_0x4f15('0x204')](_0x3ba8c6)[_0x4f15('0xa1')](sendMessageReschedule(_0x3ba8c6))[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x205')));}else{_0x3ba8c6[_0x4f15('0x86')]+=_0xb822e6['length'];_0x3ba8c6[_0x4f15('0x6f')]=_0x3ba8c6[_0x4f15('0x1e3')]==='booked'?utils[_0x4f15('0x70')][_0x4f15('0x13b')]:utils['CAMPAIGN_STATUS'][_0x4f15('0x1f9')];for(var _0x4f3443=0x0;_0x4f3443<_0xb822e6['length'];_0x4f3443+=0x1){if(_['isNil'](_0xb822e6[_0x4f3443])||_['isNil'](_0xb822e6[_0x4f3443]['Contact'])||_[_0x4f15('0xfa')](_0xb822e6[_0x4f3443][_0x4f15('0x15b')])){_0x55a8be[_0x4f15('0x1fb')](_0x4f15('0x1fc'),_0x3ba8c6,_0xb822e6[_0x4f3443]);}else{hopperUtils[_0x4f15('0x206')](_['pick'](_0xb822e6[_0x4f3443],['VoiceQueueId',_0x4f15('0x15b')]))['then'](_0x55a8be[_0x4f15('0x1e2')](_0x3ba8c6,_0xb822e6[_0x4f3443]))[_0x4f15('0xa5')](_0x55a8be[_0x4f15('0x152')]('[actionOriginate]\x20',_0x3ba8c6));}}}})[_0x4f15('0xa5')](loggerGetContactDialer(_0x4f15('0x207'),_0x3ba8c6,_0x2ac90a));}};Dialer[_0x4f15('0x19')][_0x4f15('0x6a')]=function(_0x3c5059){if(_0x3c5059[_0x4f15('0x200')]>0x0){var _0x3da5ca=_0x3c5059[_0x4f15('0x200')]-_0x3c5059[_0x4f15('0x86')]-_0x3c5059[_0x4f15('0x139')];if(_0x3da5ca>0x0){this['tryOriginatePredictive'](_0x3c5059);}else{loggerPredictiveCalls['info'](_0x4f15('0x208'));}}else{this['tryOriginatePredictive'](_0x3c5059);}};Dialer['prototype'][_0x4f15('0x209')]=function(_0x15924e){var _0x363824=this;var _0x45bbfc=[];_0x15924e[_0x4f15('0x86')]+=0x1;for(var _0x3f2017 in this[_0x4f15('0xf8')]){if(typeof this[_0x4f15('0xf8')][_0x3f2017]!==_0x4f15('0xb1')){if(this['agents'][_0x3f2017]['state']===_0x4f15('0x201')&&this['agents'][_0x3f2017][_0x4f15('0x8d')]===_0x4f15('0x144')){_0x45bbfc[_0x4f15('0x9d')](this[_0x4f15('0xf8')][_0x3f2017]['id']);}}}return this['getContactDialer'](_0x15924e['id'],_0x45bbfc,0x1,_0x15924e[_0x4f15('0x20a')],_0x15924e)[_0x4f15('0xa1')](function(_0x522f76){if(!utils[_0x4f15('0x203')](_0x522f76)){utils['checkContactLowerLimitOriginate'](_0x15924e,0x1,0x0);return hopperUtils['countReScheduled'](_0x15924e)[_0x4f15('0xa1')](sendMessageReschedule(_0x15924e))[_0x4f15('0xa5')](loggerCatch(_0x4f15('0x205')));}else{_0x15924e[_0x4f15('0x6f')]=utils[_0x4f15('0x70')][_0x4f15('0x1f9')];if(_[_0x4f15('0xfa')](_0x522f76[0x0])||_[_0x4f15('0xfa')](_0x522f76[0x0][_0x4f15('0x172')])||_[_0x4f15('0xfa')](_0x522f76[0x0][_0x4f15('0x15b')])){_0x363824[_0x4f15('0x1fb')](_0x4f15('0x1fc'),_0x15924e,_0x522f76[0x0]);}else{return hopperUtils[_0x4f15('0x206')](_[_0x4f15('0x7b')](_0x522f76[0x0],[_0x4f15('0xec'),_0x4f15('0x15b')]))[_0x4f15('0xa1')](_0x363824[_0x4f15('0x1e2')](_0x15924e,_0x522f76[0x0]))[_0x4f15('0xa5')](_0x363824[_0x4f15('0x152')](_0x4f15('0x20b'),_0x15924e));}}})[_0x4f15('0xa5')](loggerGetContactDialer(_0x4f15('0x20c'),_0x15924e,0x1));};Dialer[_0x4f15('0x19')][_0x4f15('0x1d3')]=function(_0x9fc316,_0xf01e05,_0xc02159,_0x326b66,_0x5e22f2,_0x49e5e8){loggerPredictive[_0x4f15('0x4c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x4f15('0x20d'),_0x9fc316);loggerPredictive[_0x4f15('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf01e05);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x20e'),_0xc02159);loggerPredictive['info'](_0x4f15('0x20f'),_0x326b66);loggerPredictive['info'](_0x4f15('0x210'),_0x5e22f2);loggerPredictive[_0x4f15('0x4c')]('---------------------------');return new Promise(function(_0x39e37a,_0x20818d){if(_0x9fc316<=0x0||isNaN(_0x9fc316)){return _0x20818d(msgResponse(_0x4f15('0x211'),'Error','m\x20=\x20'+_0x9fc316));}if(_0xc02159<=0x0||isNaN(_0xc02159)){return _0x20818d(msgResponse(_0x4f15('0x211'),_0x4f15('0x8a'),_0x4f15('0x212')+_0xc02159));}if(_0x326b66<=0x0||isNaN(_0x326b66)){return _0x20818d(msgResponse(_0x4f15('0x211'),'Error',_0x4f15('0x213')+_0x326b66));}if(_0xf01e05<=0x0||isNaN(_0xf01e05)){return _0x20818d(msgResponse('[abandonmentRate]',_0x4f15('0x8a'),_0x4f15('0x214')+_0xf01e05));}if(_0x5e22f2<=0x0||isNaN(_0x5e22f2)){return _0x20818d(msgResponse(_0x4f15('0x211'),_0x4f15('0x8a'),_0x4f15('0x215')+_0x5e22f2));}_0x49e5e8=_0x49e5e8||0x0;var _0x3a01cb=0x1/_0xc02159;var _0x15f4ba=0x0;var _0x2d8b49=0x0;var _0x64ad72=0x0;var _0x43676b=0x0;for(var _0x2af0c9=0x0;_0x64ad72<_0x5e22f2;_0x2af0c9+=0x1){_0x2d8b49=_0x2af0c9/_0xf01e05;_0x15f4ba=(_0x326b66*_0x2d8b49+_0x49e5e8)/_0x3a01cb;_0x64ad72=utils[_0x4f15('0x216')](_0x15f4ba,_0x9fc316);_0x43676b=_0x15f4ba/_0x9fc316*(0x1-utils[_0x4f15('0x216')](_0x15f4ba,_0x9fc316));}return _0x39e37a({'erlangCalls':_0x2af0c9,'erlangCallToSecond':_0xf01e05/_0x2af0c9,'erlangAbandonmentRate':_0x64ad72,'erlangBusyFactor':_0x43676b});});};Dialer[_0x4f15('0x19')]['busyFactor']=function(_0x2f6f2e,_0x3623ed,_0x1cd07d,_0x4a1830,_0x513f1a,_0x55a061){loggerPredictive[_0x4f15('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x4f15('0x20d'),_0x2f6f2e);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x217'),_0x3623ed);loggerPredictive[_0x4f15('0x4c')]('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',_0x1cd07d);loggerPredictive[_0x4f15('0x4c')]('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',_0x4a1830);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x218'),_0x513f1a);loggerPredictive[_0x4f15('0x4c')](_0x4f15('0x57'));return new Promise(function(_0x1ead14,_0x2f91ab){if(_0x2f6f2e<=0x0||isNaN(_0x2f6f2e)){return _0x2f91ab(msgResponse(_0x4f15('0x219'),_0x4f15('0x8a'),_0x4f15('0x21a')+_0x2f6f2e));}if(_0x1cd07d<=0x0||isNaN(_0x1cd07d)){return _0x2f91ab(msgResponse(_0x4f15('0x219'),_0x4f15('0x8a'),'Ts\x20=\x20'+_0x1cd07d));}if(_0x4a1830<=0x0||isNaN(_0x4a1830)){return _0x2f91ab(msgResponse(_0x4f15('0x219'),_0x4f15('0x8a'),_0x4f15('0x213')+_0x4a1830));}if(_0x3623ed<=0x0||isNaN(_0x3623ed)){return _0x2f91ab(msgResponse(_0x4f15('0x219'),_0x4f15('0x8a'),_0x4f15('0x214')+_0x3623ed));}if(_0x513f1a<=0x0||isNaN(_0x513f1a)){return _0x2f91ab(msgResponse(_0x4f15('0x219'),_0x4f15('0x8a'),_0x4f15('0x21b')+_0x513f1a));}_0x55a061=_0x55a061||0x0;var _0x1f9214=0x1/_0x1cd07d;var _0x205d65=0x0;var _0x6f7b68=0x0;var _0x599b42=0x0;var _0x35ad8e=0x0;for(var _0x3b96ba=0x0;_0x35ad8e<_0x513f1a;_0x3b96ba+=0x1){_0x6f7b68=_0x3b96ba/_0x3623ed;_0x205d65=(_0x4a1830*_0x6f7b68+_0x55a061)/_0x1f9214;_0x599b42=utils[_0x4f15('0x216')](_0x205d65,_0x2f6f2e);_0x35ad8e=_0x205d65/_0x2f6f2e*(0x1-utils[_0x4f15('0x216')](_0x205d65,_0x2f6f2e));}return _0x1ead14({'erlangCalls':_0x3b96ba,'erlangCallToSecond':_0x3623ed/_0x3b96ba,'erlangAbandonmentRate':_0x599b42,'erlangBusyFactor':_0x35ad8e});});};module['exports']=Dialer; \ No newline at end of file +var _0x2735=['dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','loggedIn','predictiveIntervalPauses','startMethodPredictive','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','run','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Ts\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','Action','command','interval','timezones','content','indexOf','iftime\x20%s,%s','true','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueId','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','starttime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','VoiceQueueId','[rescheduleContact][Abandoned]','Abandoned','channel','actionid','rrmemory','isNil','locked','paused','stateinterface','idHopper','syncQueueStatusComplete','roundrobin','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','moveContactManagedDialer','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','launchHandleIvr','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','undefined','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','Trunk','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s'];(function(_0x2a516a,_0x522514){var _0x4c1c06=function(_0x558943){while(--_0x558943){_0x2a516a['push'](_0x2a516a['shift']());}};_0x4c1c06(++_0x522514);}(_0x2735,0x9c));var _0x5273=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2735[_0x513aa5];return _0x1a1a7c;};'use strict';var util=require(_0x5273('0x0'));var _=require(_0x5273('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x5273('0x2'));var utils=require('./utils');var hopperUtils=require(_0x5273('0x3'));var ut=require(_0x5273('0x4'));var config=require('../../../config/environment/');var logger=require(_0x5273('0x5'))(_0x5273('0x6'));var loggerBooked=require(_0x5273('0x5'))('booked');var loggerPredictive=require(_0x5273('0x5'))(_0x5273('0x7'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x5273('0x5'))(_0x5273('0x8'));var ami=require(_0x5273('0x9'));config[_0x5273('0xa')]=_[_0x5273('0xb')](config[_0x5273('0xa')],{'host':_0x5273('0xc'),'port':0x18eb});var io=require(_0x5273('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x5273('0xe'));var voiceQueueRt=require(_0x5273('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x5273('0x10'));var Action=require('./models/action');var History=require(_0x5273('0x11'));var Final=require(_0x5273('0x12'));var AgentComplete=require(_0x5273('0x13'));var QueueCallerAbandon=require(_0x5273('0x14'));var Hangup=require(_0x5273('0x15'));var ipAgi=process[_0x5273('0x16')][_0x5273('0x17')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5273('0x18')][_0x5273('0x19')]=function(_0x38fd7b){this['tail']=this[_0x5273('0x1a')]?this[_0x5273('0x1a')][_0x5273('0x1b')](_0x38fd7b):_0x38fd7b();};function Dialer(_0xa9b0d6,_0x42bfdf){this[_0x5273('0x1c')]=new Sequence();this[_0x5273('0x1d')]=_0x42bfdf;this[_0x5273('0x1e')]=_0xa9b0d6['voiceQueues'];this[_0x5273('0x1f')]=_0xa9b0d6[_0x5273('0x1f')];this[_0x5273('0x20')]=_0xa9b0d6['agents'];this['trunks']=_0xa9b0d6[_0x5273('0x21')];this[_0x5273('0x22')]=config[_0x5273('0x22')]||0x2;this[_0x5273('0x23')]={};this[_0x5273('0x24')]={};this[_0x5273('0x25')]={};this['uniqueId']={};this[_0x5273('0x26')]={};this[_0x5273('0x27')]={};this[_0x5273('0x28')]={};this[_0x5273('0x29')]={};this[_0x5273('0x2a')]={};this[_0x5273('0x2b')]={};this['queuesSummary']={};ami['on'](_0x5273('0x2c'),this[_0x5273('0x2d')][_0x5273('0x2e')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x5273('0x2e')](this));ami['on'](_0x5273('0x2f'),this[_0x5273('0x30')]['bind'](this));ami['on'](_0x5273('0x31'),this[_0x5273('0x32')][_0x5273('0x2e')](this));ami['on'](_0x5273('0x33'),this[_0x5273('0x8')][_0x5273('0x2e')](this));ami['on']('custom:queuesummarycomplete',this[_0x5273('0x34')][_0x5273('0x2e')](this));ami['on']('hangup',this[_0x5273('0x35')]['bind'](this));ami['on'](_0x5273('0x36'),this[_0x5273('0x37')]['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x5273('0x38'),this['syncQueueMember'][_0x5273('0x2e')](this));ami['on'](_0x5273('0x39'),this['syncQueueStatusComplete'][_0x5273('0x2e')](this));this[_0x5273('0x3a')]();this[_0x5273('0x3b')]();RpcSetting[_0x5273('0x3c')]()[_0x5273('0x3d')](function(_0x3167b8){previewRecallmeReminderInterval=_0x3167b8['previewRecallmeReminderInterval'];});}function isNotNull(_0x384761){return _0x384761!==null&&!_[_0x5273('0x3e')](_0x384761);}function msgResponse(_0x39a826,_0x3cfe6e,_0x4c24b8){return{'action':_0x39a826,'response':_0x3cfe6e,'message':_0x4c24b8,'stack':_0x4c24b8};}function emit(_0x47ed32,_0x2a2589,_0x50eced){io['to'](_0x47ed32)['emit'](_0x2a2589,_0x50eced);}function emitOutboundVoiceQueueSummary(_0x381492){if(_0x381492['type']===_0x5273('0x3f')){logger[_0x5273('0x40')](_0x5273('0x41'),util[_0x5273('0x42')](_0x381492,{'showHidden':![],'depth':null}));emit(util[_0x5273('0x43')](_0x5273('0x44'),_0x381492[_0x5273('0x45')]),_0x5273('0x46'),_0x381492);}}function checkGetDataPredictive(_0x4e4397){if(isNotNull(_0x4e4397)&&!_[_0x5273('0x47')](_0x4e4397)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x5273('0x48'),_0x4e4397['predictiveIntervalTotalCalls']);loggerPredictive[_0x5273('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e4397[_0x5273('0x4a')]);loggerPredictive[_0x5273('0x49')](_0x5273('0x4b'),_0x4e4397[_0x5273('0x4c')]);loggerPredictive[_0x5273('0x49')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e4397['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5273('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e4397[_0x5273('0x4d')]);loggerPredictive[_0x5273('0x49')](_0x5273('0x4e'),_0x4e4397[_0x5273('0x4f')]);loggerPredictive[_0x5273('0x49')](_0x5273('0x50'));if(_0x4e4397[_0x5273('0x51')]>0x0){if(!_['isUndefined'](_0x4e4397[_0x5273('0x4f')])&&_0x4e4397[_0x5273('0x4f')]>0x0){return!![];}loggerPredictive[_0x5273('0x49')](_0x5273('0x52'));if(!_[_0x5273('0x3e')](_0x4e4397[_0x5273('0x4d')])&&_0x4e4397[_0x5273('0x4d')]>0x0){return!![];}loggerPredictive[_0x5273('0x49')](_0x5273('0x53'));}else{loggerPredictive[_0x5273('0x49')](_0x5273('0x54'));}}else{loggerPredictive[_0x5273('0x49')](_0x5273('0x55'));}return![];}function mergeDataErlangB(_0x2ec8af){return function(_0x34ecd2){loggerPredictive[_0x5273('0x49')](_0x5273('0x56'));loggerPredictive[_0x5273('0x49')](_0x5273('0x57'),_0x34ecd2['erlangCalls']);loggerPredictive[_0x5273('0x49')](_0x5273('0x58'),_0x34ecd2[_0x5273('0x59')]);loggerPredictive[_0x5273('0x49')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34ecd2[_0x5273('0x5a')]);loggerPredictive[_0x5273('0x49')](_0x5273('0x5b'),_0x34ecd2[_0x5273('0x5c')]);loggerPredictive[_0x5273('0x49')](_0x5273('0x5d'),_0x34ecd2[_0x5273('0x5a')]);loggerPredictive['info'](_0x5273('0x50'));_[_0x5273('0x5e')](_0x2ec8af,_0x34ecd2);};}function ifInterval(_0x59b561,_0x462711){if(_[_0x5273('0x3e')](_0x462711)){return![];}return utils[_0x5273('0x5f')](undefined,_0x462711)<_0x59b561*0x3c;}function clearPredictiveAttributes(_0x2e4b94){if(_0x2e4b94[_0x5273('0x28')]){_0x2e4b94[_0x5273('0x28')]=undefined;loggerPredictive[_0x5273('0x40')](_0x2e4b94[_0x5273('0x45')],'startProgressive\x20value\x20cleared');}if(_0x2e4b94[_0x5273('0x27')]){_0x2e4b94[_0x5273('0x27')]=undefined;loggerPredictive['debug'](_0x2e4b94[_0x5273('0x45')],_0x5273('0x60'));}if(_0x2e4b94['handlePredictive']){clearInterval(_0x2e4b94[_0x5273('0x61')]);_0x2e4b94[_0x5273('0x61')]=undefined;loggerPredictive['debug'](_0x2e4b94[_0x5273('0x45')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0xc852b6,_0x42c93d){return function(_0x755e7f){loggerPredictive['error'](_0x42c93d['name'],_0xc852b6);loggerPredictive[_0x5273('0x62')](_0x755e7f[_0x5273('0x63')]);clearPredictiveAttributes(_0x42c93d);};}function loggerCatch(_0x3dd8f5){return function(_0x590f86){logger[_0x5273('0x62')](_0x3dd8f5,util[_0x5273('0x42')](_0x590f86,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xa0c2cb,_0x3d66a1,_0xd6126b){return function(_0x51f2a3){utils['checkContactLowerLimitOriginate'](_0x3d66a1,_0xd6126b,0x0);logger['error'](_0xa0c2cb,util[_0x5273('0x42')](_0x51f2a3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xbed90a){return function(_0x2d9470){if(isNotNull(_0x2d9470)&&isNotNull(_0x2d9470[0x0])){if(_0x2d9470[0x0][_0x5273('0x64')]>0x0){_0xbed90a['message']=utils[_0x5273('0x65')][_0x5273('0x66')];logger[_0x5273('0x49')]('[getContactDialer2][ReScheduled]'+_0xbed90a[_0x5273('0x45')],_0x2d9470[0x0][_0x5273('0x64')],_0x5273('0x67'));}else{_0xbed90a[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x69')];logger[_0x5273('0x49')](_0x5273('0x6a')+_0xbed90a[_0x5273('0x45')]);}}};}function createObjHistory(_0x441f5f,_0x34a9a7,_0x2af889,_0x1d70fe,_0x29a3d1){_0x441f5f[_0x5273('0x68')]=_0x2af889;var _0x396b87=new Action(_0x441f5f,_0x34a9a7);var _0x4b0023=new History(_0x396b87);_0x4b0023[_0x5273('0x6b')]=_0x1d70fe;_0x4b0023[_0x5273('0x6c')]=_0x29a3d1;_0x4b0023[_0x5273('0x6d')]=_0x396b87['starttime'];return _0x4b0023;}function unlockQueueStatus(_0x486de2,_0x3448d7){setTimeout(function(){if(_[_0x5273('0x3e')](_0x486de2[_0x5273('0x6e')])){loggerBooked[_0x5273('0x62')](_0x5273('0x6f'),_0x3448d7);}_0x486de2[_0x5273('0x6e')]=!![];loggerBooked[_0x5273('0x49')]('[booked][unlockQueueStatus]',_0x3448d7,JSON['stringify'](_[_0x5273('0x70')](_0x486de2,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1746c9){return function(){if(!isNotNull(_0x1746c9[_0x5273('0x71')])){_0x1746c9[_0x5273('0x68')]=utils['CAMPAIGN_STATUS'][_0x5273('0x72')];throw _0x1746c9['name']+_0x5273('0x73');}if(!isNotNull(_0x1746c9[_0x5273('0x71')][_0x5273('0x74')])){_0x1746c9[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x72')];throw _0x1746c9[_0x5273('0x45')]+_0x5273('0x73');}if(!isNotNull(_[_0x5273('0x47')](_0x1746c9[_0x5273('0x71')]['Intervals']))){_0x1746c9[_0x5273('0x68')]=utils[_0x5273('0x65')]['NULL_INTERVAL'];throw _0x1746c9[_0x5273('0x45')]+_0x5273('0x73');}};}function checkIsIVRCampaignActive(_0x9ff1c5){return function(){if(!utils['isIVRCampaignActive'](_0x9ff1c5)){_0x9ff1c5[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x75')];throw _0x9ff1c5[_0x5273('0x45')]+_0x5273('0x76');}};}function emitCampaignSummary(_0x40df33){if(utils[_0x5273('0x77')](_0x40df33)){emit(util[_0x5273('0x43')](_0x5273('0x78'),_0x40df33[_0x5273('0x45')]),_0x5273('0x79'),_0x40df33);}}function loggerCatchQueueSummary(_0x2d8187,_0xf5321e){return function(_0x4f505f){clearPredictiveAttributes(_0xf5321e);emitCampaignSummary(_0xf5321e);loggerSyncQueueSummary['debug'](_0x2d8187,util[_0x5273('0x42')](_0x4f505f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x555096){if(_0x555096[_0x5273('0x7a')]){if(_0x555096['originated']===0x0){_0x555096[_0x5273('0x7a')]=![];_0x555096[_0x5273('0x68')]=utils[_0x5273('0x65')]['INACTIVE'];loggerSyncQueueSummary[_0x5273('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x555096[_0x5273('0x45')],_0x5273('0x7b'));}else{_0x555096[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x7c')];loggerSyncQueueSummary['debug'](_0x5273('0x7d'),_0x555096['name'],_0x5273('0x7e'));}emitCampaignSummary(_0x555096);}}function myreject(_0x555e79){return function(_0x3d6a6c){return _0x555e79(msgResponse(_0x5273('0x7f'),_0x5273('0x80'),JSON[_0x5273('0x81')](_0x3d6a6c)));};}Dialer[_0x5273('0x18')][_0x5273('0x82')]=function(_0x262c65){return!_[_0x5273('0x3e')](_0x262c65)&&_0x262c65&&!_[_0x5273('0x3e')](_0x262c65[_0x5273('0x45')])&&!_[_0x5273('0x3e')](_0x262c65[_0x5273('0x83')])&&_0x262c65[_0x5273('0x83')]&&(this[_0x5273('0x21')][util['format'](_0x5273('0x84'),_0x262c65[_0x5273('0x45')])][_0x5273('0x85')]===_0x5273('0x86')||this[_0x5273('0x21')][util['format'](_0x5273('0x84'),_0x262c65['name'])][_0x5273('0x85')]===_0x5273('0x87'));};Dialer[_0x5273('0x18')][_0x5273('0x88')]=function(_0x1e6cf9){var _0x2ccb35=this;return function(){if(!_0x2ccb35[_0x5273('0x82')](_0x1e6cf9['Trunk'])){if(!_0x2ccb35[_0x5273('0x82')](_0x1e6cf9[_0x5273('0x89')])){_0x1e6cf9[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x8a')];throw _0x1e6cf9[_0x5273('0x45')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x5273('0x18')][_0x5273('0x8b')]=function(_0x4e5ec7,_0x44e32b,_0x1612ce,_0x45a56f){var _0x29c355=this;return function(){var _0x520d65=!![];return _0x29c355['ifTimeIvr'](_0x4e5ec7,_0x44e32b,_0x1612ce,_0x45a56f,_0x520d65);};};Dialer['prototype'][_0x5273('0x8c')]=function(_0x5dc159,_0x55ac01,_0x3668d5,_0xff0492){var _0x15324b=this;return function(){var _0x30288c=![];return _0x15324b[_0x5273('0x8d')](_0x5dc159[_0x5273('0x74')],_0x55ac01,_0x3668d5,_0xff0492,_0x30288c);};};Dialer[_0x5273('0x18')][_0x5273('0x8d')]=function(_0x3a6373,_0x1645aa,_0x2cdc1a,_0x50e280,_0x485b27){var _0x1bf3a3=[];return new Promise(function(_0x4ae03d,_0x93cfab){if(!isNotNull(_0x3a6373)){_0x50e280[_0x5273('0x68')]=utils['CAMPAIGN_STATUS'][_0x5273('0x72')];return _0x93cfab(msgResponse(_0x5273('0x8e'),_0x5273('0x8f'),_0x2cdc1a+_0x5273('0x90')));}if(_[_0x5273('0x47')](_0x3a6373)){_0x50e280[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x91')];return _0x93cfab(msgResponse(_0x5273('0x8e'),_0x5273('0x8f'),_0x2cdc1a+_0x5273('0x92')));}if(_0x1645aa&&_['isUndefined'](config['timezones'][_0x1645aa])){_0x50e280[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x93')];return _0x93cfab(msgResponse(_0x5273('0x8e'),_0x5273('0x8f'),_0x2cdc1a+_0x5273('0x94')+_0x1645aa));}if(_['isArray'](_0x3a6373)){for(var _0x2f0a40=0x0;_0x2f0a40<_0x3a6373[_0x5273('0x95')];_0x2f0a40+=0x1){_0x1bf3a3[_0x5273('0x96')](ami[_0x5273('0x97')]({'action':_0x5273('0x98'),'command':util[_0x5273('0x43')]('iftime\x20%s,%s',_0x3a6373[_0x2f0a40][_0x5273('0x99')],!_[_0x5273('0x3e')](config[_0x5273('0x9a')][_0x1645aa])?_0x1645aa:'')})[_0x5273('0x3d')](function(_0x29dd0e){return _0x29dd0e[_0x5273('0x9b')][_0x5273('0x9c')]('true')>=0x0;})['catch'](myreject(_0x93cfab)));}}else{_0x1bf3a3['push'](ami[_0x5273('0x97')]({'action':_0x5273('0x98'),'command':util[_0x5273('0x43')](_0x5273('0x9d'),_0x3a6373,!_['isUndefined'](config['timezones'][_0x1645aa])?_0x1645aa:'')})[_0x5273('0x3d')](function(_0x3e6d36){return _0x3e6d36[_0x5273('0x9b')]['indexOf'](_0x5273('0x9e'))>=0x0;})[_0x5273('0x9f')](myreject(_0x93cfab)));}Promise[_0x5273('0xa0')](_0x1bf3a3)[_0x5273('0x3d')](function(_0xdbfd73){var _0x2889d8=_['some'](_0xdbfd73);if(_0x2889d8){return _0x4ae03d(_0x2889d8);}else{_0x50e280[_0x5273('0x68')]=_0x485b27?utils[_0x5273('0x65')][_0x5273('0xa1')]:utils[_0x5273('0x65')][_0x5273('0xa2')];return _0x93cfab(msgResponse('[ifTime][promiseAll]',_0x5273('0x8f'),_0x5273('0xa3')+_0x485b27+'\x20'+_0x2cdc1a+_0x5273('0xa4')+util[_0x5273('0x42')](_0x3a6373,{'showHidden':![],'depth':null})+_0x5273('0xa5')+_0x1645aa));}})[_0x5273('0x9f')](function(_0x1b4b32){return _0x93cfab(msgResponse(_0x5273('0x8e'),_0x5273('0x8f'),JSON[_0x5273('0x81')](_0x1b4b32)));});});};Dialer[_0x5273('0x18')][_0x5273('0x3a')]=function(){var _0x3f0a93=this;return cmHopper[_0x5273('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x5273('0x3d')](function(){setInterval(function(){_0x3f0a93['syncCampaigns']();},0x3e8);});};Dialer[_0x5273('0x18')][_0x5273('0xa7')]=function(){var _0x3e2be7=this;var _0x1f38db;for(var _0x502be8 in this['campaigns']){if(typeof this['campaigns'][_0x502be8]!=='undefined'){_0x1f38db=this['campaigns'][_0x502be8];if(utils[_0x5273('0x77')](_0x1f38db)&&utils[_0x5273('0xa8')](_0x1f38db)){_0x1f38db[_0x5273('0x7a')]=!![];Promise[_0x5273('0xa9')]()[_0x5273('0x3d')](checkIsIVRCampaignActive(_0x1f38db))[_0x5273('0x3d')](checkInterval(_0x1f38db))[_0x5273('0x3d')](_0x3e2be7[_0x5273('0x88')](_0x1f38db))[_0x5273('0x3d')](_0x3e2be7[_0x5273('0x8b')](_0x1f38db['dialGlobalInterval'],_0x1f38db[_0x5273('0xaa')],_0x1f38db[_0x5273('0x45')],_0x1f38db))[_0x5273('0x3d')](_0x3e2be7[_0x5273('0x8c')](_0x1f38db[_0x5273('0x71')],_0x1f38db[_0x5273('0xaa')],_0x1f38db[_0x5273('0x45')],_0x1f38db))[_0x5273('0x3d')](_0x3e2be7['launchHandleIvr'](_0x1f38db))[_0x5273('0x9f')](loggerCatchQueueSummary(_0x5273('0xab'),_0x1f38db));}else{notSendMessagesCampaign(_0x1f38db);}}}};Dialer[_0x5273('0x18')][_0x5273('0xac')]=function(_0x39b5d8){if(_0x39b5d8[_0x5273('0xad')]!==_0x5273('0x7')){clearPredictiveAttributes(_0x39b5d8);}switch(_0x39b5d8[_0x5273('0xad')]){case _0x5273('0xae'):this[_0x5273('0xaf')](_0x39b5d8,0x1);break;case _0x5273('0xb0'):this[_0x5273('0xaf')](_0x39b5d8,_0x39b5d8[_0x5273('0xb1')]);break;case _0x5273('0x7'):this['predictive'](_0x39b5d8);break;case _0x5273('0xb2'):this[_0x5273('0xaf')](_0x39b5d8,0x1);break;default:logger[_0x5273('0x62')](_0x5273('0xb3'),_0x39b5d8[_0x5273('0x45')],'method\x20not\x20recognized');}};Dialer[_0x5273('0x18')][_0x5273('0x8e')]=function(_0x5d4536,_0x46a083){var _0x1e57f2=_0x5d4536[_0x5273('0xaa')];var _0x2923f7=_0x46a083?_0x5d4536[_0x5273('0xb4')]:_0x5d4536[_0x5273('0x71')][_0x5273('0x74')];logger['silly'](_0x5273('0xb5'),_0x2923f7,_0x1e57f2,_0x5d4536['name'],util['format'](_0x5273('0xb6'),_0x5d4536[_0x5273('0x45')],_0x5d4536['id']));var _0xcfe040=null;return Interval[_0x5273('0xb7')](_0x2923f7,_0x1e57f2)[_0x5273('0x3d')](function(_0x54b7c4){if(_0x54b7c4===!![]){return _0x54b7c4;}else{_0x5d4536['message']=_0x46a083?utils[_0x5273('0x65')][_0x5273('0xa1')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0xcfe040=msgResponse(_0x5273('0xb8'),'Failure',_0x5273('0xa3')+_0x46a083+'\x20'+_0x5d4536['name']+_0x5273('0xa4')+util[_0x5273('0x42')](_0x2923f7,{'showHidden':![],'depth':null})+_0x5273('0xa5')+_0x1e57f2);}if(_0xcfe040!==null){logger[_0x5273('0xb9')](_0x5273('0xba'),_0xcfe040);_0xcfe040[_0x5273('0xbb')]=_0x46a083;throw _0xcfe040;}})[_0x5273('0x9f')](function(_0x69933a){logger['error']('AMI\x20IfTime',_0x69933a);throw msgResponse(_0x5273('0x7f'),'Error',util[_0x5273('0x42')](_0x69933a,{'showHidden':![],'depth':null}));});};Dialer[_0x5273('0x18')]['syncAgentConnect']=function(_0x345bed){if(this[_0x5273('0x1e')][_0x345bed[_0x5273('0xbc')]]){if(this[_0x5273('0xbd')][_0x345bed[_0x5273('0xbe')]]&&this[_0x5273('0xbd')][_0x345bed['uniqueid']][_0x5273('0xbf')]!==_0x5273('0xc0')){this[_0x5273('0xc1')](this[_0x5273('0x1e')][_0x345bed[_0x5273('0xbc')]]);this['uniqueId'][_0x345bed['uniqueid']][_0x5273('0xc2')]=moment()[_0x5273('0x43')](_0x5273('0xc3'));}}};Dialer['prototype'][_0x5273('0x32')]=function(_0x42b115){var _0x48c1a0=this['uniqueId'][_0x42b115[_0x5273('0xbe')]];if(this[_0x5273('0x1e')][_0x42b115['queue']]){if(_0x48c1a0&&_0x48c1a0[_0x5273('0xbf')]!==_0x5273('0xc0')){delete this[_0x5273('0xbd')][_0x42b115[_0x5273('0xbe')]];this[_0x5273('0x1e')][_0x42b115[_0x5273('0xbc')]][_0x5273('0xc4')]+=0x1;var _0x27fbdd=new AgentComplete(_0x48c1a0,_0x42b115);if(_0x42b115[_0x5273('0xc5')]===_0x5273('0xc6')){_0x27fbdd[_0x5273('0xc7')]=this[_0x5273('0x1e')][_0x42b115[_0x5273('0xbc')]]['dialQueueProject2']&&this[_0x5273('0x1e')][_0x42b115[_0x5273('0xbc')]][_0x5273('0xc8')]?moment()['format'](_0x5273('0xc3')):undefined;}hopperUtils['createHistory'](_0x27fbdd)['catch'](loggerCatch(_0x5273('0xc9')));hopperUtils['moveContactManagedDialer'](_0x27fbdd)['catch'](loggerCatch(_0x5273('0xca')));}}};Dialer[_0x5273('0x18')][_0x5273('0xcb')]=function(_0x2d858d){var _0x270194=this['uniqueId'][_0x2d858d[_0x5273('0xbe')]];var _0x52868d=this;var _0x2b9c14=![];var _0x2845cd;var _0x1f6f61;if(this['voiceQueues'][_0x2d858d[_0x5273('0xbc')]]){if(_0x270194&&_0x270194['type']!==_0x5273('0xc0')){delete this['uniqueId'][_0x2d858d[_0x5273('0xbe')]];this['updateOriginated'](this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]]);_0x270194[_0x5273('0xcc')]=moment()[_0x5273('0x43')](_0x5273('0xc3'));var _0x4731f4=new QueueCallerAbandon(_0x270194,_0x2d858d);if(utils[_0x5273('0x5f')](_0x270194[_0x5273('0xcc')],_0x270194[_0x5273('0xcd')])>=_0x270194[_0x5273('0xce')]){this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xcf')]+=0x1;this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xd0')]+=0x1;_0x4731f4[_0x5273('0x6b')]=0xa;_0x4731f4['statedesc']=_0x5273('0xd1');_0x4731f4[_0x5273('0xd2')]=_0x5273('0xd3');_0x4731f4[_0x5273('0xc7')]=this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xd4')]?moment()[_0x5273('0x43')](_0x5273('0xc3')):undefined;_0x4731f4[_0x5273('0xd5')]+=0x1;_0x4731f4['countglobal']+=0x1;_0x2845cd=this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xd6')];_0x1f6f61=this['voiceQueues'][_0x2d858d['queue']][_0x5273('0xd7')];hopperUtils[_0x5273('0xd8')](_0x4731f4,_0x4731f4['state'],_0x270194['voiceQueue'])['then'](function(_0x17bf1b){_0x2b9c14=_0x17bf1b[_0x5273('0xd9')]==0x1;if(_0x4731f4['countdropretry']>=_0x52868d[_0x5273('0x1e')][_0x2d858d['queue']]['dialDropMaxRetry']){_0x52868d[_0x5273('0xda')](_0x4731f4,_0x17bf1b[_0x5273('0xd9')]);}else{hopperUtils[_0x5273('0xdb')]({'active':![],'countdropretry':_0x4731f4[_0x5273('0xd5')],'scheduledat':moment()[_0x5273('0xdc')](_0x52868d[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xd6')],_0x5273('0xdd'))['format'](_0x5273('0xc3')),'ContactId':_0x270194[_0x5273('0xde')],'ListId':_0x270194[_0x5273('0xdf')],'VoiceQueueId':_0x270194['VoiceQueueId']||undefined,'CampaignId':_0x270194[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch('[rescheduleContact][Drop]'));var _0x22e3ce=new History(_0x4731f4);_0x22e3ce[_0x5273('0x6b')]=0xa;_0x22e3ce['statedesc']='Drop';_0x22e3ce['starttime']=moment()[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x22e3ce[_0x5273('0x6d')]=_0x22e3ce[_0x5273('0xe1')];_0x22e3ce[_0x5273('0xe2')]=_0x4731f4[_0x5273('0xe2')];_0x22e3ce[_0x5273('0xe3')]=_0x4731f4[_0x5273('0xe3')];hopperUtils[_0x5273('0xe4')](_0x22e3ce)[_0x5273('0x9f')](loggerCatch(_0x5273('0xe5')));}})[_0x5273('0x3d')](function(){if(_0x2b9c14)hopperUtils[_0x5273('0xe6')](_0x4731f4,_0x2845cd,_0x1f6f61)[_0x5273('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x2d858d['queue']][_0x5273('0xe7')]+=0x1;this[_0x5273('0x1e')][_0x2d858d['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4731f4[_0x5273('0x6b')]=0xb;_0x4731f4[_0x5273('0x6c')]='Abandoned';_0x4731f4['dropreason']='CALLEREXIT';_0x4731f4[_0x5273('0xe8')]+=0x1;_0x4731f4[_0x5273('0xe9')]+=0x1;_0x2845cd=this['voiceQueues'][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xea')];_0x1f6f61=this[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x4731f4,_0x4731f4[_0x5273('0x6b')],_0x270194['voiceQueue'])[_0x5273('0x3d')](function(_0x12cf55){if(_0x4731f4[_0x5273('0xe8')]>=_0x52868d[_0x5273('0x1e')][_0x2d858d[_0x5273('0xbc')]][_0x5273('0xeb')]){_0x52868d[_0x5273('0xda')](_0x4731f4,_0x12cf55[_0x5273('0xd9')]);}else{hopperUtils[_0x5273('0xdb')]({'active':![],'countabandonedretry':_0x4731f4[_0x5273('0xe8')],'scheduledat':moment()[_0x5273('0xdc')](_0x52868d[_0x5273('0x1e')][_0x2d858d['queue']][_0x5273('0xea')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x270194[_0x5273('0xde')],'ListId':_0x270194[_0x5273('0xdf')],'VoiceQueueId':_0x270194[_0x5273('0xec')]||undefined,'CampaignId':_0x270194[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0xed')));var _0x2f5ecd=new History(_0x4731f4);_0x2f5ecd[_0x5273('0x6b')]=0xb;_0x2f5ecd[_0x5273('0x6c')]=_0x5273('0xee');_0x2f5ecd[_0x5273('0xe1')]=moment()[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f5ecd[_0x5273('0x6d')]=_0x2f5ecd[_0x5273('0xe1')];_0x2f5ecd[_0x5273('0xe2')]=_0x4731f4['calleridname'];_0x2f5ecd[_0x5273('0xe3')]=_0x4731f4['calleridnum'];hopperUtils['createHistory'](_0x2f5ecd)[_0x5273('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x5273('0x3d')](function(){if(_0x2b9c14)hopperUtils[_0x5273('0xe6')](_0x4731f4,_0x2845cd,_0x1f6f61)['then'](function(){return 0x1;});});}}}};Dialer[_0x5273('0x18')][_0x5273('0x37')]=function(_0x2a70b5){if(this['actions'][_0x2a70b5[_0x5273('0xbe')]]){this['actions'][_0x2a70b5[_0x5273('0xbe')]][_0x5273('0xef')]=_0x2a70b5[_0x5273('0xef')];}if(this[_0x5273('0xbd')][_0x2a70b5[_0x5273('0xbe')]]){this['uniqueId'][_0x2a70b5[_0x5273('0xbe')]]['channel']=_0x2a70b5[_0x5273('0xef')];}};Dialer[_0x5273('0x18')]['syncQueueMember']=function(_0x10988c){if(!this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]]){return;}var _0x3789fa=this[_0x5273('0x1e')][this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]][_0x5273('0xbc')]]['strategy']||_0x5273('0xf1');if(_0x3789fa==='roundrobin'){if(this['actions'][_0x10988c[_0x5273('0xf0')]]&&_[_0x5273('0xf2')](this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]][_0x5273('0xf3')])&&_0x10988c[_0x5273('0x85')]==='1'&&_0x10988c[_0x5273('0xf4')]==='0'){if(this['agents'][_0x10988c[_0x5273('0xf5')]]){if(!this[_0x5273('0x20')][_0x10988c[_0x5273('0xf5')]][_0x5273('0xf3')]){this['agents'][_0x10988c[_0x5273('0xf5')]][_0x5273('0xf3')]=!![];this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]][_0x5273('0xf3')]=!![];this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]][_0x5273('0xf5')]=_0x10988c['stateinterface'];}}}}else if(_0x3789fa===_0x5273('0xf1')){if(this[_0x5273('0x24')][_0x10988c['actionid']]){if(this[_0x5273('0x20')][_0x10988c['stateinterface']]){this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]]['stateinterface']=_0x10988c[_0x5273('0xf5')];if(_['isNil'](this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x10988c['actionid']][_0x5273('0xbc')]])){this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x10988c['actionid']][_0x5273('0xbc')]]=[];}this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x10988c[_0x5273('0xf0')]]['queue']][_0x5273('0x96')](_[_0x5273('0x5e')](_['pick'](this[_0x5273('0x24')][_0x10988c['actionid']],[_0x5273('0xf6'),_0x5273('0xf5')]),{'status':_0x10988c['status'],'paused':_0x10988c['paused']}));}}}};Dialer['prototype'][_0x5273('0xf7')]=function(_0x321667){if(!this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]]){return;}var _0x127dc6=this;var _0x28cd88=this[_0x5273('0x1e')][this[_0x5273('0x24')][_0x321667['actionid']][_0x5273('0xbc')]];var _0x20ebcf=_0x28cd88['strategy']||_0x5273('0xf1');if(_0x20ebcf===_0x5273('0xf8')){if(this['actions'][_0x321667[_0x5273('0xf0')]]&&this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xf5')]){this[_0x5273('0x1d')]['run'](this[_0x5273('0x24')][_0x321667['actionid']]['idHopper'],this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xf5')])[_0x5273('0x9f')](function(_0x49140a){logger[_0x5273('0x62')](_0x5273('0xf9'),util[_0x5273('0x42')](_0x49140a,{'showHidden':![],'depth':null}));})[_0x5273('0x1b')](function(){_0x127dc6['updateOriginated'](_0x127dc6[_0x5273('0x1e')][_0x127dc6[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]]['queue']]);_0x127dc6[_0x5273('0x20')][_0x127dc6['actions'][_0x321667['actionid']][_0x5273('0xf5')]]['locked']=![];delete _0x127dc6[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]];unlockQueueStatus(_0x28cd88);});}else{this['updateOriginated'](this[_0x5273('0x1e')][this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]);hopperUtils[_0x5273('0xdb')]({'active':![],'ContactId':this['actions'][_0x321667[_0x5273('0xf0')]][_0x5273('0xde')],'ListId':this[_0x5273('0x24')][_0x321667['actionid']][_0x5273('0xdf')],'VoiceQueueId':this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xec')]||undefined,'CampaignId':this['actions'][_0x321667[_0x5273('0xf0')]][_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0xfa')));delete this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]];unlockQueueStatus(_0x28cd88);}}else if(_0x20ebcf===_0x5273('0xf1')){var _0x2cb88b;if(this['actions'][_0x321667[_0x5273('0xf0')]]&&!_[_0x5273('0x47')](this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]])){if(this['queueBookedRR'][_0x127dc6[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]){this[_0x5273('0x2b')][_0x127dc6['actions'][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]=this['queueBookedRR'][this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]?this[_0x5273('0x2b')][this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]:this[_0x5273('0x2a')][this['actions'][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]]?this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x321667['actionid']][_0x5273('0xbc')]][_0x5273('0xfb')]||0x0:0x0;}this[_0x5273('0x2a')][this[_0x5273('0x24')][_0x321667[_0x5273('0xf0')]][_0x5273('0xbc')]][_0x5273('0xfb')]=this[_0x5273('0x2b')][this['actions'][_0x321667['actionid']][_0x5273('0xbc')]];for(var _0x1317a0=0x0;_0x1317a0=_0x59ca95[_0x5273('0x120')]){_0x10b545[_0x5273('0x121')](_0x431bb1,_0x5c84f6,_0x3bf121,_0x5273('0x122'));}else{if(_0x431bb1['countmachineretry']>=_0x59ca95[_0x5273('0x123')]){_0x10b545[_0x5273('0x124')](_0x431bb1,_0x5c84f6,_0x3bf121,_0x5273('0x125'));}else{hopperUtils[_0x5273('0xdb')]({'active':![],'countmachineretry':_0x431bb1['countmachineretry'],'scheduledat':moment()[_0x5273('0xdc')](_0x59ca95[_0x5273('0x126')],'minutes')[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x431bb1[_0x5273('0xde')],'ListId':_0x431bb1[_0x5273('0xdf')],'VoiceQueueId':_0x431bb1[_0x5273('0xec')]||undefined,'CampaignId':_0x431bb1[_0x5273('0xe0')]||undefined})['catch'](loggerCatch(_0x5273('0x127')));_0x5c84f6({'reschedule':0x1});}}});}if(_0x5b5ee1[_0x5273('0xbf')]===_0x5273('0xc0')&&this['campaigns'][_0x5b5ee1[_0x5273('0xbc')]][_0x5273('0x10a')]&&_0x12b5c7[_0x5273('0x10b')]==='HANGUP'){delete this[_0x5273('0xbd')][_0x12b5c7['uniqueid']];this[_0x5273('0xc1')](this['campaigns'][_0x5b5ee1['queue']]);_0x26e593=new Hangup(_0x5b5ee1,_0x12b5c7);_0x26e593['state']=0x12;_0x26e593[_0x5273('0x6c')]=_0x5273('0x10e');_0x26e593[_0x5273('0x118')]=_0x5273('0x10f');ami[_0x5273('0x119')](_0x5273('0x110'),ut['buildObj'](_0x26e593,_0x5273('0x112')));this['saveInDb'](_0x26e593,_0x5273('0x128'),_0x5273('0x129'));}if(_0x5b5ee1['type']==='ivr'&&this['campaigns'][_0x5b5ee1[_0x5273('0xbc')]][_0x5273('0x10a')]&&_0x12b5c7['value']===_0x5273('0x116')){return new Promise(function(_0x222914,_0x5588e3){delete _0x10b545[_0x5273('0xbd')][_0x12b5c7['uniqueid']];_0x10b545[_0x5273('0xc1')](_0x10b545['campaigns'][_0x5b5ee1['queue']]);_0x10b545[_0x5273('0x1f')][_0x5b5ee1['queue']]['outboundAnswerCallsDay']+=0x1;_0x10b545[_0x5273('0x1f')][_0x5b5ee1[_0x5273('0xbc')]][_0x5273('0x10d')]+=0x1;var _0x164ae3=_0x10b545[_0x5273('0x1f')][_0x5b5ee1[_0x5273('0xbc')]];var _0x14ea3e=new Hangup(_0x5b5ee1,_0x12b5c7);_0x14ea3e[_0x5273('0x6b')]=0x13;_0x14ea3e[_0x5273('0x6c')]=_0x5273('0x117');_0x14ea3e['membername']='AMD';_0x14ea3e[_0x5273('0x11e')]+=0x1;_0x14ea3e[_0x5273('0xe9')]+=0x1;_0x14ea3e['amd']=!![];ami[_0x5273('0x119')](_0x5273('0x110'),ut[_0x5273('0x111')](_0x14ea3e,_0x5273('0x112')));hopperUtils['createHistory'](_0x14ea3e)[_0x5273('0x9f')](loggerCatch(_0x5273('0x11a')));if(_0x14ea3e[_0x5273('0x11b')]+_0x14ea3e[_0x5273('0x11c')]+_0x14ea3e['countnoanswerretry']+_0x14ea3e[_0x5273('0x12a')]+_0x14ea3e[_0x5273('0xd5')]+_0x14ea3e[_0x5273('0xe8')]+_0x14ea3e[_0x5273('0x11e')]+_0x14ea3e[_0x5273('0x11f')]>=_0x164ae3[_0x5273('0x120')]){_0x10b545['stateGlobal'](_0x14ea3e,_0x222914,_0x5588e3,'reason19\x20machine....');}else{if(_0x14ea3e[_0x5273('0x11e')]>=_0x164ae3[_0x5273('0x123')]){_0x10b545['createStateFinal'](_0x14ea3e,_0x222914,_0x5588e3,_0x5273('0x125'));}else{hopperUtils[_0x5273('0xdb')]({'active':![],'countmachineretry':_0x14ea3e[_0x5273('0x11e')],'scheduledat':moment()[_0x5273('0xdc')](_0x164ae3[_0x5273('0x126')],_0x5273('0xdd'))[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x14ea3e['ContactId'],'ListId':_0x14ea3e[_0x5273('0xdf')],'VoiceQueueId':_0x14ea3e[_0x5273('0xec')]||undefined,'CampaignId':_0x14ea3e[_0x5273('0xe0')]||undefined})['catch'](loggerCatch(_0x5273('0x127')));_0x222914({'reschedule':0x1});}}});}}};Dialer[_0x5273('0x18')]['syncHangup']=function(_0x25bad3){var _0x26d228=this[_0x5273('0xbd')][_0x25bad3['uniqueid']];var _0x264bb0;if(_0x26d228&&_0x26d228[_0x5273('0xbf')]===_0x5273('0xc0')){delete this[_0x5273('0xbd')][_0x25bad3[_0x5273('0xbe')]];this[_0x5273('0xc1')](this[_0x5273('0x1f')][_0x26d228[_0x5273('0xbc')]]);this[_0x5273('0x1f')][_0x26d228[_0x5273('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x264bb0=new Hangup(_0x26d228,_0x25bad3);hopperUtils[_0x5273('0xe4')](_0x264bb0)[_0x5273('0x9f')](loggerCatch(_0x5273('0x12b')));hopperUtils['moveContactManagedDialer'](_0x264bb0)[_0x5273('0x9f')](loggerCatch(_0x5273('0x12c')));}if(_0x26d228&&_0x26d228[_0x5273('0xbf')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x26d228[_0x5273('0xbc')]][_0x5273('0x12d')])){delete this[_0x5273('0xbd')][_0x25bad3['uniqueid']];this[_0x5273('0xc1')](this['voiceQueues'][_0x26d228[_0x5273('0xbc')]]);this[_0x5273('0x1e')][_0x26d228[_0x5273('0xbc')]][_0x5273('0xc4')]+=0x1;this[_0x5273('0x1e')][_0x26d228[_0x5273('0xbc')]][_0x5273('0x10d')]+=0x1;_0x264bb0=new Hangup(_0x26d228,_0x25bad3);_0x264bb0[_0x5273('0x6b')]=0x10;_0x264bb0[_0x5273('0x6c')]='AnswerAGI';_0x264bb0['membername']=_0x5273('0x12e');hopperUtils[_0x5273('0xe4')](_0x264bb0)['catch'](loggerCatch(_0x5273('0x12b')));hopperUtils[_0x5273('0x12f')](_0x264bb0)[_0x5273('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0x26d228&&_0x26d228[_0x5273('0xbf')]!==_0x5273('0xc0')&&!isNotNull(this[_0x5273('0x1e')][_0x26d228[_0x5273('0xbc')]][_0x5273('0x12d')])){delete this['uniqueId'][_0x25bad3[_0x5273('0xbe')]];this['updateOriginated'](this['voiceQueues'][_0x26d228[_0x5273('0xbc')]]);this[_0x5273('0x1e')][_0x26d228[_0x5273('0xbc')]][_0x5273('0x130')]+=0x1;_0x264bb0=new Hangup(_0x26d228,_0x25bad3);_0x264bb0[_0x5273('0x6b')]=0xc;_0x264bb0[_0x5273('0x6c')]=_0x25bad3[_0x5273('0x131')];_0x264bb0[_0x5273('0x118')]=_0x5273('0x132');hopperUtils[_0x5273('0xe4')](_0x264bb0)['catch'](loggerCatch(_0x5273('0x12b')));hopperUtils[_0x5273('0x12f')](_0x264bb0)['catch'](loggerCatch(_0x5273('0x12c')));}};Dialer[_0x5273('0x18')][_0x5273('0x8')]=function(_0x32e770){var _0x34f7a8=this;if(!_0x34f7a8[_0x5273('0x133')][_0x32e770[_0x5273('0x45')]]){_0x34f7a8['queuesSummary'][_0x32e770[_0x5273('0x45')]]={'running':![]};}else if(_0x34f7a8['queuesSummary'][_0x32e770['name']][_0x5273('0x134')]===!![]){return;}else if(_0x34f7a8[_0x5273('0x133')][_0x32e770[_0x5273('0x45')]]['running']===![]){_0x34f7a8['queuesSummary'][_0x32e770[_0x5273('0x45')]][_0x5273('0x134')]=!![];}var _0x1905fe=_0x34f7a8[_0x5273('0x1e')][_0x32e770[_0x5273('0x45')]];var _0x35d98e=_0x1905fe[_0x5273('0x68')]!==utils[_0x5273('0x65')][_0x5273('0x75')];var _0x2e7c03=utils[_0x5273('0x135')](_0x1905fe);_0x1905fe[_0x5273('0x136')]=utils[_0x5273('0x137')](_0x1905fe,_0x34f7a8[_0x5273('0x21')]);Promise[_0x5273('0xa9')]()[_0x5273('0x3d')](function(){if(_0x1905fe[_0x5273('0x136')]===utils[_0x5273('0x65')]['INACTIVE']){if(_0x35d98e){clearPredictiveAttributes(_0x1905fe);_0x32e770[_0x5273('0x27')]=undefined;_0x32e770[_0x5273('0x28')]=undefined;}if(_0x1905fe[_0x5273('0x136')]===utils[_0x5273('0x65')][_0x5273('0x75')]){_0x32e770[_0x5273('0x138')]=0x0;_0x32e770[_0x5273('0xf4')]=0x0;_0x32e770[_0x5273('0x139')]=0x0;_0x32e770[_0x5273('0x13a')]=0x0;_0x32e770[_0x5273('0x13b')]=0x0;}}else if(_0x1905fe[_0x5273('0x136')]===utils[_0x5273('0x65')][_0x5273('0x13c')]&&!_0x2e7c03){return _0x34f7a8[_0x5273('0x8e')](_0x1905fe,!![])['then'](function(){return _0x34f7a8[_0x5273('0x8e')](_0x1905fe,![]);})[_0x5273('0x3d')](function(){return _0x34f7a8[_0x5273('0xac')](_0x1905fe);})[_0x5273('0x9f')](function(_0x2df7da){loggerSyncQueueSummary[_0x5273('0x40')](_0x5273('0x13d'),util[_0x5273('0x42')](_0x2df7da,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1905fe);});}else{clearPredictiveAttributes(_0x1905fe);}})[_0x5273('0x3d')](function(){var _0x371eb6=_0x32e770[_0x5273('0x13e')](_0x1905fe);if(_0x371eb6||_0x1905fe['queueSummaryCountersUpdated']){_0x1905fe[_0x5273('0x13f')]=![];_0x32e770['updateReportFromOutboundQueue'](_0x1905fe);Object[_0x5273('0x140')](_0x1905fe,_0x32e770);emitOutboundVoiceQueueSummary(_0x32e770);}_0x34f7a8['queuesSummary'][_0x1905fe[_0x5273('0x45')]][_0x5273('0x134')]=![];})[_0x5273('0x9f')](function(_0x2feedf){logger['error'](_0x5273('0x13d'),util['inspect'](_0x2feedf,{'showHidden':![],'depth':null}));_0x34f7a8[_0x5273('0x133')][_0x1905fe[_0x5273('0x45')]][_0x5273('0x134')]=![];});};Dialer[_0x5273('0x18')][_0x5273('0x34')]=_[_0x5273('0x141')](function(){var _0x2e1006=_[_0x5273('0x142')](this[_0x5273('0x1e')],function(_0x59cb1b){return _0x59cb1b[_0x5273('0x143')];});var _0x561eef=_[_0x5273('0x142')](this[_0x5273('0x20')],function(_0x3c7fa2){return _0x3c7fa2[_0x5273('0x144')]&&_0x3c7fa2[_0x5273('0x85')]===_0x5273('0x86');});if(_0x2e1006[_0x5273('0x95')]>0x0&&_0x561eef[_0x5273('0x95')]>0x0){return Promise[_0x5273('0xa9')]()[_0x5273('0x3d')](cmHopper[_0x5273('0x145')](_[_0x5273('0x146')](_0x2e1006,'id'),previewRecallmeReminderInterval,_[_0x5273('0x146')](_0x561eef,'id')))[_0x5273('0x3d')](function(_0x5a1f6a){for(var _0x573114=0x0;_0x573114<_0x5a1f6a[_0x5273('0x95')];_0x573114++){var _0x11f0a9=_0x5a1f6a[_0x573114]['Agent'][_0x5273('0x45')];if(_0x11f0a9)io['to'](util[_0x5273('0x43')](_0x5273('0x147'),_0x11f0a9))[_0x5273('0x119')](_0x5273('0x148'),{'hopper':_0x5a1f6a[_0x573114]});}})[_0x5273('0x9f')](function(_0x407e17){logger['error'](_0x5273('0x149'),_0x407e17);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5273('0x18')][_0x5273('0x3b')]=function(){var _0x33e98a=this;setInterval(function(){_0x33e98a[_0x5273('0x14a')](_0x33e98a['uniqueId'],_0x5273('0x14b'));_0x33e98a[_0x5273('0x14a')](_0x33e98a[_0x5273('0x24')],_0x5273('0x14c'));},0x32c8);};Dialer[_0x5273('0x18')][_0x5273('0x14a')]=function(_0x5b5879,_0x2d8157){var _0x24eeda=this;for(var _0x1d336b in _0x5b5879){if(typeof _0x5b5879[_0x1d336b]!=='undefined'){this[_0x5273('0x1c')]['enqueue'](function(){if(!_[_0x5273('0xf2')](_0x5b5879[_0x1d336b])){return ami['Action']({'action':'status','channel':_0x5b5879[_0x1d336b][_0x5273('0xef')]})[_0x5273('0x9f')](function(_0x47af03){if(_0x47af03['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5b5879[_0x1d336b]&&_0x5b5879[_0x1d336b]['type']!==_0x5273('0xc0')){_0x24eeda[_0x5273('0xc1')](_0x24eeda['voiceQueues'][_0x5b5879[_0x1d336b][_0x5273('0xbc')]]);logger[_0x5273('0x62')]('[Dialer][checkChannel]',_0x2d8157,_0x1d336b,_0x5b5879[_0x1d336b][_0x5273('0xbc')]);delete _0x5b5879[_0x1d336b];}if(_0x5b5879[_0x1d336b]&&_0x5b5879[_0x1d336b][_0x5273('0xbf')]===_0x5273('0xc0')){_0x24eeda['updateOriginated'](_0x24eeda[_0x5273('0x1f')][_0x5b5879[_0x1d336b]['queue']]);logger[_0x5273('0x62')]('[Dialer][checkChannel][ivr]',_0x2d8157,_0x1d336b,_0x5b5879[_0x1d336b][_0x5273('0xbc')]);delete _0x5b5879[_0x1d336b];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x134ae8){return Promise['resolve']()[_0x5273('0x3d')](voiceQueueRt[_0x5273('0x14d')](_0x134ae8))[_0x5273('0x9f')](loggerCatch(_0x5273('0x14e')));};Dialer[_0x5273('0x18')][_0x5273('0xc1')]=function(_0x52df42){if(!_[_0x5273('0x3e')](_0x52df42)&&_0x52df42!==null){if(typeof _0x52df42['originated']!=='undefined'){if(_0x52df42[_0x5273('0x14f')]>0x0){_0x52df42['originated']-=0x1;}else{logger[_0x5273('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5273('0x62')](_0x5273('0x150'));}};Dialer[_0x5273('0x18')][_0x5273('0x151')]=function(_0x131e35,_0x1dee51){var _0x45c789=this;return function(_0xe6dfb){_0x45c789[_0x5273('0xc1')](_0x1dee51);logger[_0x5273('0x62')](_0x131e35,util[_0x5273('0x42')](_0xe6dfb,{'showHidden':![],'depth':null}));};};Dialer[_0x5273('0x18')]['emptyContact']=function(_0x5de914,_0x95dcb0,_0x1e51c0){var _0x523cac={'state':0x19,'statedesc':_0x5273('0x152')};this[_0x5273('0xc1')](_0x95dcb0);this['saveInDb'](_[_0x5273('0x5e')](_0x523cac,_['pick'](_0x1e51c0,[_0x5273('0xde'),_0x5273('0xdf'),'UserId','VoiceQueueId',_0x5273('0xe0')])),_0x5273('0x153'),_0x5273('0x154'));logger[_0x5273('0x62')](_0x5de914);};Dialer[_0x5273('0x18')][_0x5273('0x113')]=function(_0x324b99,_0xa9a016,_0x57acf4){hopperUtils[_0x5273('0xe4')](_0x324b99)['catch'](loggerCatch(_0xa9a016));hopperUtils[_0x5273('0x12f')](_0x324b99)['catch'](loggerCatch(_0x57acf4));};Dialer[_0x5273('0x18')][_0x5273('0xda')]=function(_0x56d2c4,_0x2d73d4){hopperUtils[_0x5273('0xe4')](_0x56d2c4)[_0x5273('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2d73d4==0x0){hopperUtils['moveContactManagedDialer'](_0x56d2c4)['catch'](loggerCatch(_0x5273('0x155')));}};Dialer[_0x5273('0x18')][_0x5273('0x149')]=function(_0x1c705a){return Promise[_0x5273('0xa9')]()[_0x5273('0x3d')](cmHopper[_0x5273('0x145')](_0x1c705a['id'],previewRecallmeReminderInterval))[_0x5273('0x3d')](function(_0x4befe4){for(var _0x3d0813=0x0;_0x3d0813<_0x4befe4[_0x5273('0x95')];_0x3d0813++){var _0x4b6172=_0x4befe4[_0x3d0813][_0x5273('0x156')][_0x5273('0x45')];if(_0x4b6172)io['to'](util[_0x5273('0x43')](_0x5273('0x147'),_0x4b6172))[_0x5273('0x119')](_0x5273('0x148'),{'hopper':_0x4befe4[_0x3d0813]});}})[_0x5273('0x9f')](function(){});};Dialer[_0x5273('0x18')][_0x5273('0x157')]=function(_0x51a7aa){var _0x3a9da2=this;return function(){_0x3a9da2[_0x5273('0x158')](_0x51a7aa);};};Dialer[_0x5273('0x18')][_0x5273('0x159')]=function(_0x2c0780,_0x30f5d4){var _0x3232ba=this;var _0x4506b2=uuid['v4']();this[_0x5273('0x24')][_0x4506b2]=new Action(_0x2c0780,_0x30f5d4,_0x4506b2);return new Promise(function(_0x33637e,_0x1ce68c){if(_[_0x5273('0x3e')](_0x2c0780)&&typeof _0x2c0780!==_0x5273('0x15a')){return _0x1ce68c(msgResponse('originate',_0x5273('0x8f'),_0x5273('0x15b')));}if(_['isUndefined'](_0x30f5d4[_0x5273('0x15c')])||_0x30f5d4[_0x5273('0x15c')]===null){return _0x1ce68c(msgResponse(_0x5273('0x15d'),'Failure',_0x5273('0x15e')));}var _0x46d8f1={'XMD-CALLERID':_0x3232ba[_0x5273('0x24')][_0x4506b2]['getCaller'](),'XMD-AGI':_0x2c0780[_0x5273('0x12d')]?util['format'](_0x5273('0x15f'),ipAgi,_0x2c0780[_0x5273('0x12d')]):_0x5273('0x160'),'XMD-AGIAFTER':_0x2c0780[_0x5273('0xd4')]?util[_0x5273('0x43')](_0x5273('0x15f'),ipAgi,_0x2c0780[_0x5273('0xd4')]):'NONE','XMD-QUEUE':utils[_0x5273('0x161')](_0x2c0780)?util[_0x5273('0x43')](_0x5273('0x162'),_0x2c0780[_0x5273('0x45')],_0x2c0780['dialQueueOptions']||'',_0x2c0780[_0x5273('0xc8')]?'c':'',_0x2c0780[_0x5273('0xce')]||0x3):_0x5273('0x160'),'XMD-CONTACTID':_0x30f5d4[_0x5273('0xde')],'XMD-CDRTYPE':_0x5273('0x6'),'CALLERID(all)':_0x3232ba[_0x5273('0x24')][_0x4506b2][_0x5273('0x163')](),'XMD-AMD':_0x2c0780[_0x5273('0x10a')]?_0x5273('0x13c'):_0x5273('0x160'),'XMD-DESTINATION':_0x5273('0x164')};if(_0x2c0780[_0x5273('0x10a')]){_0x46d8f1[_0x5273('0x165')]=_0x2c0780[_0x5273('0x166')]||0x9c4;_0x46d8f1[_0x5273('0x167')]=_0x2c0780[_0x5273('0x168')]||0x5dc;_0x46d8f1[_0x5273('0x169')]=_0x2c0780[_0x5273('0x16a')]||0x320;_0x46d8f1[_0x5273('0x16b')]=_0x2c0780[_0x5273('0x16c')]||0x1388;_0x46d8f1[_0x5273('0x16d')]=_0x2c0780[_0x5273('0x16e')]||0x64;_0x46d8f1[_0x5273('0x16f')]=_0x2c0780[_0x5273('0x170')]||0x32;_0x46d8f1[_0x5273('0x171')]=_0x2c0780[_0x5273('0x172')]||0x3;_0x46d8f1[_0x5273('0x173')]=_0x2c0780[_0x5273('0x174')]||0x100;_0x46d8f1[_0x5273('0x175')]=_0x2c0780[_0x5273('0x176')]||0x1388;}if(utils[_0x5273('0x161')](_0x2c0780)){_0x46d8f1[_0x5273('0x177')]=_0x30f5d4[_0x5273('0xec')];}else{_0x46d8f1[_0x5273('0x178')]=_0x30f5d4['CampaignId'];}for(var _0x150b59 in _0x30f5d4[_0x5273('0x179')]){if(typeof _0x30f5d4['Contact'][_0x150b59]!==_0x5273('0x17a')){if(isNotNull(_0x30f5d4[_0x5273('0x179')][_0x150b59])&&_0x150b59!=='id'&&_0x150b59!==_0x5273('0x17b')&&_0x150b59!=='createdAt'&&_0x150b59!==_0x5273('0x17c')){_0x46d8f1[util[_0x5273('0x43')](_0x5273('0x17d'),_0x5273('0x17e'),_[_0x5273('0x17f')](_0x150b59))]=_0x30f5d4[_0x5273('0x179')][_0x150b59];}}}var _0x3b55c5=_0x3232ba[_0x5273('0x82')](_0x2c0780['Trunk'])?utils['getCallerId'](_0x2c0780['Trunk'][_0x5273('0x180')],_0x2c0780['dialOriginateCallerIdName'],_0x2c0780[_0x5273('0x181')]>0x0?utils[_0x5273('0x182')](_0x2c0780[_0x5273('0x183')],_0x2c0780[_0x5273('0x181')]):_0x2c0780[_0x5273('0x183')]):utils[_0x5273('0x184')](_['isNil'](_0x2c0780[_0x5273('0x89')])?_0x2c0780[_0x5273('0x185')][_0x5273('0x180')]:_0x2c0780[_0x5273('0x89')][_0x5273('0x180')],_0x2c0780[_0x5273('0x186')],_0x2c0780[_0x5273('0x181')]>0x0?utils[_0x5273('0x182')](_0x2c0780[_0x5273('0x183')],_0x2c0780[_0x5273('0x181')]):_0x2c0780[_0x5273('0x183')]);if(_0x3b55c5){_0x46d8f1[_0x5273('0x187')]=_0x3232ba[_0x5273('0x24')][_0x4506b2][_0x5273('0x188')]=utils[_0x5273('0x189')](_0x3b55c5);_0x46d8f1[_0x5273('0x18a')]=_0x30f5d4[_0x5273('0x15c')];}_0x2c0780[_0x5273('0x18b')]=_0x46d8f1;return ami['Action']({'actionid':_0x4506b2,'action':_0x5273('0x15d'),'channel':_0x3232ba[_0x5273('0x82')](_0x2c0780[_0x5273('0x185')])?util[_0x5273('0x43')](_0x5273('0x18c'),_0x2c0780[_0x5273('0x185')][_0x5273('0x45')],isNotNull(_0x2c0780[_0x5273('0x18d')])?_0x2c0780[_0x5273('0x18d')][_0x5273('0x18e')]()||'':'',_0x2c0780[_0x5273('0x18f')]>0x0?_0x30f5d4[_0x5273('0x15c')][_0x5273('0x190')](_0x2c0780['dialCutDigit']):_0x30f5d4[_0x5273('0x15c')]):util[_0x5273('0x43')](_0x5273('0x18c'),_['isNil'](_0x2c0780[_0x5273('0x89')])?_0x2c0780[_0x5273('0x185')][_0x5273('0x45')]:_0x2c0780[_0x5273('0x89')]['name'],isNotNull(_0x2c0780[_0x5273('0x18d')])?_0x2c0780[_0x5273('0x18d')]['trim']()||'':'',_0x2c0780[_0x5273('0x18f')]>0x0?_0x30f5d4[_0x5273('0x15c')][_0x5273('0x190')](_0x2c0780[_0x5273('0x18f')]):_0x30f5d4[_0x5273('0x15c')]),'callerid':_0x3b55c5,'Exten':_0x5273('0x164'),'Context':_0x5273('0x191'),'Priority':'1','variable':_0x46d8f1,'timeout':(_0x2c0780['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4506b2})[_0x5273('0x3d')](function(_0x59ef1b){return _0x33637e(_0x59ef1b);})['catch'](function(_0x16a448){_0x2c0780[_0x5273('0x192')]+=0x1;var _0x2a0c0b=new History(_0x3232ba['actions'][_0x4506b2]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x5273('0x81')](_0x16a448)));_0x2a0c0b['state']=0xe;_0x2a0c0b[_0x5273('0x6c')]=_0x5273('0x193');_0x2a0c0b[_0x5273('0xe1')]=moment()[_0x5273('0x43')](_0x5273('0xc3'));_0x2a0c0b['endtime']=_0x2a0c0b[_0x5273('0xe1')];hopperUtils[_0x5273('0xe4')](_0x2a0c0b)[_0x5273('0x9f')](loggerCatch(_0x5273('0x194')));_0x3232ba[_0x5273('0x12f')](_0x2a0c0b)['catch'](loggerCatch(_0x5273('0x194')))[_0x5273('0x1b')](function(){delete _0x3232ba[_0x5273('0x24')][_0x4506b2];return _0x1ce68c(msgResponse(_0x5273('0x15d'),_0x5273('0x80'),_0x5273('0x195')));});});});};Dialer[_0x5273('0x18')][_0x5273('0x196')]=function(_0x1af21e,_0x5c5987,_0x5d90e3){var _0x3009de=new History(_0x5c5987);if(_0x3009de[_0x5273('0x11b')]+_0x3009de[_0x5273('0x11c')]+_0x3009de['countnoanswerretry']+_0x3009de[_0x5273('0x12a')]+_0x3009de[_0x5273('0xd5')]+_0x3009de[_0x5273('0xe8')]+_0x3009de[_0x5273('0x11e')]+_0x3009de[_0x5273('0x11f')]>=_0x5d90e3[_0x5273('0x120')]-0x1){return!![];}switch(_0x1af21e){case 0x3:if(_0x3009de[_0x5273('0x11d')]>=_0x5d90e3[_0x5273('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3009de[_0x5273('0x11d')]+=0x1,'scheduledat':moment()['add'](_0x5d90e3['dialNoAnswerRetryFrequency'],_0x5273('0xdd'))['format'](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de['VoiceQueueId']||undefined,'CampaignId':_0x3009de[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0x198')));break;case 0x5:if(_0x3009de[_0x5273('0x11b')]>=_0x5d90e3[_0x5273('0x199')]-0x1){return!![];}hopperUtils[_0x5273('0xdb')]({'active':![],'countbusyretry':_0x3009de['countbusyretry']+=0x1,'scheduledat':moment()[_0x5273('0xdc')](_0x5d90e3[_0x5273('0x19a')],_0x5273('0xdd'))[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de['ListId'],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3009de[_0x5273('0x11c')]>=_0x5d90e3[_0x5273('0x19b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x3009de[_0x5273('0x11c')]+=0x1,'scheduledat':moment()[_0x5273('0xdc')](_0x5d90e3[_0x5273('0x19c')],_0x5273('0xdd'))[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3009de[_0x5273('0x12a')]>=_0x5d90e3[_0x5273('0x19d')]-0x1){return!![];}else{hopperUtils[_0x5273('0xdb')]({'active':![],'countnosuchnumberretry':_0x3009de[_0x5273('0x12a')]+=0x1,'scheduledat':moment()[_0x5273('0xdc')](_0x5d90e3[_0x5273('0x19e')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de['CampaignId']||undefined})['catch'](loggerCatch(_0x5273('0x19f')));}break;case 0xa:if(_0x3009de['countdropretry']>=_0x5d90e3[_0x5273('0x1a0')]-0x1){return!![];}hopperUtils[_0x5273('0xdb')]({'active':![],'countdropretry':_0x3009de[_0x5273('0xd5')]+=0x1,'scheduledat':moment()['add'](_0x5d90e3[_0x5273('0xd6')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de['CampaignId']||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0x1a1')));break;case 0xb:if(_0x3009de[_0x5273('0xe8')]>=_0x5d90e3[_0x5273('0xeb')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3009de[_0x5273('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x5d90e3[_0x5273('0xea')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0xed')));break;case 0x13:if(_0x3009de[_0x5273('0x11e')]>=_0x5d90e3[_0x5273('0x123')]-0x1){return!![];}hopperUtils[_0x5273('0xdb')]({'active':![],'countmachineretry':_0x3009de[_0x5273('0x11e')]+=0x1,'scheduledat':moment()[_0x5273('0xdc')](_0x5d90e3[_0x5273('0x126')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3009de['countagentrejectretry']>=_0x5d90e3[_0x5273('0x1a2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x3009de[_0x5273('0x11f')]+=0x1,'scheduledat':moment()[_0x5273('0xdc')](_0x5d90e3[_0x5273('0x1a3')],_0x5273('0xdd'))[_0x5273('0x43')](_0x5273('0xc3')),'ContactId':_0x3009de[_0x5273('0xde')],'ListId':_0x3009de[_0x5273('0xdf')],'VoiceQueueId':_0x3009de[_0x5273('0xec')]||undefined,'CampaignId':_0x3009de[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x5273('0x18')][_0x5273('0x105')]=function(_0x10b9a7,_0x10f8cc,_0x117c79){var _0x3c289f=this;var _0x30fb0c=new History(_0x10b9a7);var _0x1f4fec=![];var _0x2fc771;var _0x3a1187;return new Promise(function(_0x1793fe,_0x1ac4f5){if(_['isUndefined'](_0x10f8cc)&&typeof _0x10f8cc!==_0x5273('0x15a')){return _0x1ac4f5(msgResponse(_0x5273('0x1a4'),_0x5273('0x8f'),_0x5273('0x1a5')));}if(_['isUndefined'](_0x117c79)&&typeof _0x117c79!==_0x5273('0x15a')){return _0x1ac4f5(msgResponse('[callProgressDetecting]',_0x5273('0x8f'),_0x5273('0x1a6')));}hopperUtils[_0x5273('0xd8')](_0x30fb0c,_0x117c79[_0x5273('0xc5')],_0x10f8cc)['then'](function(_0x17e4aa){if(_0x17e4aa[_0x5273('0xd9')]==0x1)_0x1f4fec=!![];switch(_0x117c79[_0x5273('0xc5')]){case'0':_0x10f8cc['outboundNoSuchCallsDay']+=0x1;_0x30fb0c['state']=0x0;_0x30fb0c['statedesc']=_0x5273('0x1a7');_0x30fb0c[_0x5273('0x12a')]+=0x1;_0x30fb0c['countglobal']+=0x1;ami[_0x5273('0x119')](_0x5273('0x1a8'),ut['buildObj'](_0x10b9a7,_0x5273('0x1a9')));_0x2fc771=_0x10f8cc[_0x5273('0x19e')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];hopperUtils[_0x5273('0xe4')](_0x30fb0c)[_0x5273('0x9f')](loggerCatch(_0x5273('0x11a')));if(_0x3c289f[_0x5273('0x196')](0x0,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x12a')]>=_0x10f8cc[_0x5273('0x19d')]){_0x3c289f[_0x5273('0x124')](_0x30fb0c,_0x1793fe,_0x1ac4f5,'reason\x200\x20no\x20such\x20number....');}else{_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1aa'));}}break;case'3':_0x10f8cc[_0x5273('0x1ab')]+=0x1;_0x30fb0c[_0x5273('0x6b')]=0x3;_0x30fb0c[_0x5273('0x6c')]='NoAnswer';_0x30fb0c[_0x5273('0x11d')]+=0x1;_0x30fb0c['countglobal']+=0x1;var _0x16c504=ut[_0x5273('0x1ac')](_0x10b9a7,_0x10f8cc);ami[_0x5273('0x119')](_0x5273('0x1ad'),_0x16c504);_0x2fc771=_0x10f8cc['dialNoAnswerRetryFrequency'];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];hopperUtils[_0x5273('0xe4')](_0x30fb0c)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3c289f[_0x5273('0x196')](0x3,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x11d')]>=_0x10f8cc[_0x5273('0x197')]){_0x3c289f[_0x5273('0x124')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1ae'));}else{_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1ae'));}}break;case'5':_0x10f8cc[_0x5273('0x1af')]+=0x1;_0x30fb0c[_0x5273('0x6b')]=0x5;_0x30fb0c[_0x5273('0x6c')]=_0x5273('0x1b0');_0x30fb0c['countbusyretry']+=0x1;_0x30fb0c[_0x5273('0xe9')]+=0x1;ami[_0x5273('0x119')]('custom:agentbusy',ut['buildObj'](_0x10b9a7,_0x5273('0x1b1')));_0x2fc771=_0x10f8cc[_0x5273('0x19a')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];hopperUtils['createHistory'](_0x30fb0c)[_0x5273('0x9f')](loggerCatch(_0x5273('0x1b2')));if(_0x3c289f['checkRetriveMax'](0x5,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x11b')]>=_0x10f8cc['dialBusyMaxRetry']){_0x3c289f[_0x5273('0x124')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1b3'));}else{_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1b3'));}}break;case'8':_0x10f8cc[_0x5273('0x1b4')]+=0x1;_0x30fb0c['state']=0x8;_0x30fb0c['statedesc']=_0x5273('0x1b5');_0x30fb0c['countcongestionretry']+=0x1;_0x30fb0c[_0x5273('0xe9')]+=0x1;_0x2fc771=_0x10f8cc[_0x5273('0x19c')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];ami[_0x5273('0x119')](_0x5273('0x1b6'),ut[_0x5273('0x111')](_0x10b9a7,_0x5273('0x1b7')));hopperUtils['createHistory'](_0x30fb0c)[_0x5273('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3c289f[_0x5273('0x196')](0x8,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x11c')]>=_0x10f8cc[_0x5273('0x19b')]){_0x3c289f['createStateFinal'](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1b8'));}else{_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1b8'));}}break;case'11':_0x10f8cc['outboundAbandonedCallsDay']+=0x1;_0x30fb0c[_0x5273('0x6b')]=0xb;_0x30fb0c[_0x5273('0x6c')]=_0x5273('0xee');_0x30fb0c['countabandonedretry']+=0x1;_0x30fb0c['countglobal']+=0x1;_0x2fc771=_0x10f8cc[_0x5273('0xea')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];hopperUtils['createHistory'](_0x30fb0c)['catch'](loggerCatch(_0x5273('0x1b9')));if(_0x3c289f[_0x5273('0x196')](0xb,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0xe8')]>=_0x10f8cc[_0x5273('0xeb')]){_0x3c289f['createStateFinal'](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1ba'));}else{_0x3c289f['stateGlobal'](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1ba'));}}break;case'20':_0x10f8cc[_0x5273('0x1bb')]+=0x1;_0x30fb0c[_0x5273('0x6b')]=0x14;_0x30fb0c['statedesc']='AgentReject';_0x30fb0c[_0x5273('0x11f')]+=0x1;_0x30fb0c[_0x5273('0xe9')]+=0x1;_0x2fc771=_0x10f8cc[_0x5273('0x1a3')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];ami['emit'](_0x5273('0x1bc'),ut[_0x5273('0x111')](_0x10b9a7,_0x5273('0x1bd')));hopperUtils['createHistory'](_0x30fb0c)[_0x5273('0x9f')](loggerCatch(_0x5273('0x1be')));if(_0x3c289f[_0x5273('0x196')](0x14,_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x11f')]>=_0x10f8cc[_0x5273('0x1a2')]){_0x3c289f['createStateFinal'](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1bf'));}else{_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x5273('0x1bf'));}}break;default:_0x10f8cc['outboundUnknownCallsDay']+=0x1;_0x30fb0c[_0x5273('0x6b')]=0xc;_0x30fb0c[_0x5273('0x6c')]=_0x117c79['reason'];_0x2fc771=_0x10f8cc[_0x5273('0x1a3')];_0x3a1187=_0x10f8cc[_0x5273('0xd7')];hopperUtils['createHistory'](_0x30fb0c)[_0x5273('0x9f')](loggerCatch(_0x5273('0x1c0')));if(_0x3c289f[_0x5273('0x196')](_0x117c79[_0x5273('0xc5')],_0x10b9a7,_0x10f8cc)&&!_0x1f4fec){if(_0x30fb0c[_0x5273('0x11b')]+_0x30fb0c[_0x5273('0x11c')]+_0x30fb0c['countnoanswerretry']+_0x30fb0c[_0x5273('0x12a')]+_0x30fb0c[_0x5273('0xd5')]+_0x30fb0c['countabandonedretry']+_0x30fb0c[_0x5273('0x11e')]+_0x30fb0c[_0x5273('0x11f')]>=_0x10f8cc[_0x5273('0x120')]){_0x3c289f[_0x5273('0x121')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x117c79[_0x5273('0xc5')]);}else{_0x3c289f[_0x5273('0x124')](_0x30fb0c,_0x1793fe,_0x1ac4f5,_0x117c79[_0x5273('0xc5')]);}}}})['then'](function(){if(_0x1f4fec){hopperUtils[_0x5273('0xe6')](_0x30fb0c,_0x2fc771,_0x3a1187)[_0x5273('0x3d')](function(){return _0x1793fe(0x1);});}});});};Dialer[_0x5273('0x18')]['stateGlobal']=function(_0x536488,_0x1e7f8c,_0x509002,_0x691899){var _0x49d88e=new Final(_0x536488);_0x49d88e['state']=0xf;_0x49d88e[_0x5273('0x6c')]='Global';this['createStateFinal'](_0x49d88e,_0x1e7f8c,_0x509002,_0x691899);};Dialer[_0x5273('0x18')][_0x5273('0x124')]=function(_0x11ad89,_0xea9cc2,_0x33f234,_0x5db629){hopperUtils[_0x5273('0x12f')](_0x11ad89)['then'](function(){return _0xea9cc2(msgResponse(_0x5273('0x1a4'),_0x5273('0x104'),_0x5db629));})[_0x5273('0x9f')](function(){return _0x33f234(msgResponse('[moveContactManagedDialer][0]',_0x5273('0x8f'),'contact\x20not\x20moved'));});};Dialer[_0x5273('0x18')][_0x5273('0x7')]=function(_0x2331a8){var _0x272e46=_0x2331a8[_0x5273('0x1c1')]/0x64;var _0x23e0b5=_0x2331a8[_0x5273('0xcf')]/(_0x2331a8[_0x5273('0xcf')]+_0x2331a8['outboundAnswerCallsDay']);var _0x5486ae=Math[_0x5273('0x1c2')](_0x2331a8[_0x5273('0x1c3')]*(_0x2331a8[_0x5273('0x1c4')]/0x64));var _0x5c019e=Math[_0x5273('0x1c2')](_0x2331a8[_0x5273('0x1c3')]*(_0x2331a8[_0x5273('0x1c5')]/0x64));var _0x405981=_0x2331a8['available']+_0x2331a8['talking'];var _0x36a6a7=Math['floor'](_0x2331a8['erlangCalls']*_0x2331a8[_0x5273('0x5a')]*_0x2331a8[_0x5273('0x1c6')]*_0x2331a8[_0x5273('0x1c7')]);if(_[_0x5273('0x3e')](_0x2331a8[_0x5273('0x28')])){if(!_[_0x5273('0x3e')](_0x2331a8[_0x5273('0x27')])){_0x2331a8[_0x5273('0x27')]=undefined;loggerPredictive[_0x5273('0x62')](_0x5273('0x1c8'),_0x5273('0x1c9'));}if(!_[_0x5273('0x3e')](_0x2331a8[_0x5273('0x61')])){loggerPredictive[_0x5273('0x62')](_0x5273('0x1c8'),_0x5273('0x1ca'));clearInterval(_0x2331a8[_0x5273('0x61')]);_0x2331a8[_0x5273('0x61')]=undefined;}_0x2331a8[_0x5273('0x28')]=moment()[_0x5273('0x43')](_0x5273('0xc3'));loggerPredictive[_0x5273('0x49')](_0x2331a8[_0x5273('0x45')],_0x5273('0x1cb'),_0x2331a8[_0x5273('0x28')]);this[_0x5273('0xaf')](_0x2331a8,0x1);}else if(ifInterval(_0x2331a8[_0x5273('0x1cc')],_0x2331a8[_0x5273('0x28')])){this[_0x5273('0xaf')](_0x2331a8,0x1);loggerPredictiveCalls['info'](_0x5273('0x1cd'),_0x2331a8[_0x5273('0x28')],_0x2331a8['name']);_0x2331a8['erlangCalls']=0x0;_0x2331a8['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x272e46<_0x23e0b5&&_0x2331a8['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x2331a8);loggerPredictive[_0x5273('0x49')](_0x5273('0x1ce'),_0x5273('0x1cf'),_0x23e0b5,'startProgressive',_0x2331a8['name']);}else if(_0x36a6a7<_0x2331a8[_0x5273('0xd0')]&&_0x2331a8[_0x5273('0x1d0')]===_0x5273('0x1d1')){clearPredictiveAttributes(_0x2331a8);loggerPredictive[_0x5273('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5273('0x1d2'),_0x36a6a7,_0x5273('0x1d3'),_0x2331a8[_0x5273('0xd0')],'startProgressive',_0x2331a8[_0x5273('0x45')]);}else if(!ifInterval(_0x2331a8[_0x5273('0x1cc')],_0x2331a8[_0x5273('0x28')])&&_[_0x5273('0x3e')](_0x2331a8[_0x5273('0x27')])&&!_[_0x5273('0x3e')](_0x2331a8['startProgressive'])){_0x2331a8['startPredictive']=moment()[_0x5273('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2331a8[_0x5273('0x45')],'started\x20in\x20predictive\x20at',_0x2331a8[_0x5273('0x27')]);hopperUtils[_0x5273('0x1d4')](_0x2331a8['dialPredictiveInterval'])[_0x5273('0x3d')](this[_0x5273('0x1d5')](_0x2331a8))['then'](mergeDataErlangB(_0x2331a8))[_0x5273('0x3d')](this['startMethodPredictive'](_0x2331a8))[_0x5273('0x9f')](loggerCatchPredictive(_0x5273('0x1d6'),_0x2331a8));}else if(!ifInterval(_0x2331a8[_0x5273('0x1cc')],_0x2331a8[_0x5273('0x27')])){_0x2331a8[_0x5273('0xd0')]=0x0;_0x2331a8['startPredictive']=moment()['format'](_0x5273('0xc3'));loggerPredictive['info'](_0x2331a8[_0x5273('0x45')],_0x5273('0x1d7'),_0x2331a8['startPredictive']);clearInterval(_0x2331a8['handlePredictive']);_0x2331a8['handlePredictive']=undefined;hopperUtils[_0x5273('0x1d4')](_0x2331a8[_0x5273('0x1cc')])[_0x5273('0x3d')](this['getDataPredictive'](_0x2331a8))['then'](mergeDataErlangB(_0x2331a8))[_0x5273('0x3d')](this['startMethodPredictive'](_0x2331a8))[_0x5273('0x9f')](loggerCatchPredictive(_0x5273('0x1d8'),_0x2331a8));}else if(_0x2331a8['predictiveIntervalAvailable']&&_0x405981<_0x2331a8['predictiveIntervalAvailable']-_0x5c019e){clearPredictiveAttributes(_0x2331a8);loggerPredictive[_0x5273('0x49')](_0x2331a8['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x405981,_0x5273('0x1d9'),_0x2331a8[_0x5273('0x1c3')],'-',_0x5c019e,'=',_0x2331a8[_0x5273('0x1c3')]-_0x5c019e,')');}else if(_0x2331a8[_0x5273('0x1c3')]&&_0x405981>_0x2331a8[_0x5273('0x1c3')]+_0x5486ae){clearPredictiveAttributes(_0x2331a8);loggerPredictive[_0x5273('0x49')](_0x2331a8['name'],_0x5273('0x1da'),_0x405981,')\x20are\x20more\x20than\x20threshold\x20(',_0x2331a8['predictiveIntervalAvailable'],'+',_0x5486ae,'=',_0x2331a8[_0x5273('0x1c3')]+_0x5486ae,')');}};Dialer[_0x5273('0x18')][_0x5273('0x1d5')]=function(_0xcbca91){var _0x39cd47=this;return function(_0x75a3a7){return new Promise(function(_0x33bafe,_0x3d1161){_['merge'](_0xcbca91,_0x75a3a7[0x0]);if(checkGetDataPredictive(_0x75a3a7[0x0])){var _0x2bd015=_0xcbca91[_0x5273('0x1c3')]=_0xcbca91[_0x5273('0x13a')]+_0xcbca91[_0x5273('0x138')];var _0x2e412b=_0xcbca91[_0x5273('0x1cc')]*0x3c;var _0x92a9e7=_0x75a3a7[0x0]['predictiveIntervalAvgTalktime']+_0x75a3a7[0x0][_0x5273('0x4d')];var _0x432e85=(_0x75a3a7[0x0][_0x5273('0x4a')]+_0x75a3a7[0x0][_0x5273('0x4c')]+_0x75a3a7[0x0][_0x5273('0xe7')])/_0x75a3a7[0x0][_0x5273('0x51')];_0xcbca91[_0x5273('0x1c6')]=_0x432e85>0x0?_0x432e85:0x1;switch(_0xcbca91[_0x5273('0x1d0')]){case _0x5273('0x1d1'):var _0x332b35=_0xcbca91[_0x5273('0x1c1')]/0x64;return _0x39cd47[_0x5273('0x1db')](_0x2bd015,_0x2e412b,_0x92a9e7,_0x432e85,_0x332b35)[_0x5273('0x3d')](function(_0x31cd71){return _0x33bafe(_0x31cd71);});case'agentBusyFactor':var _0x4b577f=_0xcbca91[_0x5273('0x1c1')]/0x64;return _0x39cd47[_0x5273('0x1dc')](_0x2bd015,_0x2e412b,_0x92a9e7,_0x432e85,_0x4b577f)[_0x5273('0x3d')](function(_0x5d464f){return _0x33bafe(_0x5d464f);});default:return _0x3d1161(msgResponse('[getDataPredictive]',_0x5273('0x8f'),_0x5273('0x1dd')));}}else{return _0x3d1161(msgResponse(_0x5273('0x1de'),_0x5273('0x8f'),_0x5273('0x1df')));}});};};Dialer[_0x5273('0x18')]['getDataPredictiveOld']=function(_0x3dfb56){var _0x334040=this;return function(_0x54d5b2){return new Promise(function(_0x246879,_0x5d2fa1){_[_0x5273('0x5e')](_0x3dfb56,_0x54d5b2[0x0]);if(checkGetDataPredictive(_0x54d5b2[0x0])){loggerPredictive[_0x5273('0x49')](JSON[_0x5273('0x81')](_0x54d5b2[0x0]));if(_0x3dfb56['dialPredictiveOptimization']===_0x5273('0x1d1')){return _0x334040[_0x5273('0x14d')](_0x3dfb56['id'])[_0x5273('0x3d')](function(_0x2fcec7){var _0x5e4441=_0x3dfb56['loggedIn']-_0x2fcec7[0x0]['outboundQueuePauses'];var _0x3c625b=_0x3dfb56[_0x5273('0x1cc')]*0x3c;var _0x12e847=_0x54d5b2[0x0][_0x5273('0x4f')]+_0x54d5b2[0x0][_0x5273('0x4d')];var _0x47bd21=(_0x54d5b2[0x0]['predictiveIntervalAnsweredCalls']+_0x54d5b2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x54d5b2[0x0][_0x5273('0xe7')])/_0x54d5b2[0x0]['predictiveIntervalTotalCalls'];var _0x4c29ba=_0x3dfb56[_0x5273('0x1c1')]/0x64;_0x3dfb56['predictiveIntervalPauses']=_0x2fcec7[0x0][_0x5273('0x1e0')]||0x0;_0x3dfb56[_0x5273('0x1c6')]=_0x47bd21>0x0?_0x47bd21:0x1;return _0x334040['abandonmentRate'](_0x5e4441,_0x3c625b,_0x12e847,_0x47bd21,_0x4c29ba);})[_0x5273('0x3d')](function(_0x37cbba){return _0x246879(_0x37cbba);})[_0x5273('0x9f')](function(_0x36b29c){return _0x5d2fa1(msgResponse(_0x5273('0x1e1'),_0x5273('0x8f'),JSON['stringify'](_0x36b29c)));});}if(_0x3dfb56[_0x5273('0x1d0')]==='agentBusyFactor'){return _0x334040[_0x5273('0x14d')](_0x3dfb56['id'])[_0x5273('0x3d')](function(_0x2948bb){var _0x1504ea=_0x3dfb56[_0x5273('0x1e2')]-_0x2948bb[0x0][_0x5273('0x1e0')];var _0x43fd16=_0x3dfb56[_0x5273('0x1cc')]*0x3c;var _0x51fd9a=_0x54d5b2[0x0][_0x5273('0x4f')]+_0x54d5b2[0x0]['predictiveIntervalAvgHoldtime'];var _0x5bc205=(_0x54d5b2[0x0]['predictiveIntervalAnsweredCalls']+_0x54d5b2[0x0][_0x5273('0x4c')]+_0x54d5b2[0x0][_0x5273('0xe7')])/_0x54d5b2[0x0][_0x5273('0x51')];var _0x4cb995=_0x3dfb56[_0x5273('0x1c1')]/0x64;_0x3dfb56[_0x5273('0x1e3')]=_0x2948bb[0x0]['outboundQueuePauses']||0x0;_0x3dfb56[_0x5273('0x1c6')]=_0x5bc205>0x0?_0x5bc205:0x1;return _0x334040[_0x5273('0x1dc')](_0x1504ea,_0x43fd16,_0x51fd9a,_0x5bc205,_0x4cb995);})['then'](function(_0x4f8994){return _0x246879(_0x4f8994);})['catch'](function(_0xc21595){return _0x5d2fa1(msgResponse(_0x5273('0x1e1'),_0x5273('0x8f'),JSON[_0x5273('0x81')](_0xc21595)));});}}else{return _0x5d2fa1(msgResponse(_0x5273('0x1de'),_0x5273('0x8f'),_0x5273('0x1df')));}});};};Dialer['prototype'][_0x5273('0x1e4')]=function(_0x353694){var _0xe14e53=this;return function(){var _0x241629=0x0;var _0x5de902=Math[_0x5273('0x1e5')](_0x353694[_0x5273('0x59')]*0x3e8);if(_0x5de902>0x0){_0x5de902=_0x5de902<0x64?0x64:_0x5de902;loggerPredictive[_0x5273('0x49')](_0x353694['name'],_0x5273('0x1e6'),_0x5de902,_0x5273('0x1e7'));_0x353694['handlePredictive']=setInterval(function(){_0xe14e53[_0x5273('0x61')](_0x353694);loggerPredictiveCalls[_0x5273('0x49')](_0x5273('0x1e8'),_0x241629+=0x1);},_0x5de902);}else{loggerPredictive[_0x5273('0x49')](_0x353694[_0x5273('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x5273('0x18')][_0x5273('0x1e9')]=function(_0x93ebc6,_0x49e307){var _0x292e6d=this;return function(_0x2244b0){if(_[_0x5273('0x47')](_0x2244b0)){if(_['isNil'](_0x49e307[_0x5273('0x1ea')])||!_0x49e307[_0x5273('0x1eb')]){if(_0x93ebc6['dialMethod']===_0x5273('0xb2')){_0x93ebc6[_0x5273('0x6e')]=_[_0x5273('0x3e')](_0x93ebc6[_0x5273('0x6e')])?!![]:_0x93ebc6[_0x5273('0x6e')];var _0x8f2a76=uuid['v4']();_0x292e6d[_0x5273('0x24')][_0x8f2a76]=new Action(_0x93ebc6,_0x49e307,_0x8f2a76);loggerBooked[_0x5273('0x49')](_0x5273('0x1ec'),_0x8f2a76,_0x5273('0x1ed'),JSON[_0x5273('0x81')](_0x93ebc6[_0x5273('0x6e')]),_0x5273('0x1ee'),_0x93ebc6[_0x5273('0x45')]);if(_0x93ebc6[_0x5273('0x6e')]){_0x93ebc6[_0x5273('0x6e')]=![];_0x292e6d['queueBooked'][_0x292e6d[_0x5273('0x24')][_0x8f2a76]['queue']]=[];ami['Action']({'actionid':_0x8f2a76,'action':_0x5273('0x1ef'),'queue':_0x93ebc6['name']})[_0x5273('0x9f')](function(){_0x292e6d['updateOriginated'](_0x93ebc6);hopperUtils[_0x5273('0xdb')]({'active':![],'ContactId':_0x292e6d[_0x5273('0x24')][_0x8f2a76]['ContactId'],'ListId':_0x292e6d[_0x5273('0x24')][_0x8f2a76][_0x5273('0xdf')],'VoiceQueueId':_0x292e6d['actions'][_0x8f2a76][_0x5273('0xec')]||undefined,'CampaignId':_0x292e6d['actions'][_0x8f2a76][_0x5273('0xe0')]||undefined})['catch'](loggerCatch(_0x5273('0x1f0')));delete _0x292e6d[_0x5273('0x24')][_0x8f2a76];});}else{loggerBooked['info'](_0x5273('0x1f1'),JSON[_0x5273('0x81')](_0x93ebc6['queueStatusComplete']),_0x5273('0x1ee'),_0x93ebc6[_0x5273('0x45')]);_0x292e6d[_0x5273('0xc1')](_0x93ebc6);hopperUtils[_0x5273('0xdb')]({'active':![],'ContactId':_0x292e6d[_0x5273('0x24')][_0x8f2a76][_0x5273('0xde')],'ListId':_0x292e6d['actions'][_0x8f2a76][_0x5273('0xdf')],'VoiceQueueId':_0x292e6d[_0x5273('0x24')][_0x8f2a76][_0x5273('0xec')]||undefined,'CampaignId':_0x292e6d[_0x5273('0x24')][_0x8f2a76][_0x5273('0xe0')]||undefined})['catch'](loggerCatch(_0x5273('0x1f0')));delete _0x292e6d[_0x5273('0x24')][_0x8f2a76];}}else{return _0x292e6d[_0x5273('0x159')](_0x93ebc6,_0x49e307);}}else{if(utils[_0x5273('0x5f')](undefined,_0x49e307[_0x5273('0x1f2')])<_0x93ebc6[_0x5273('0x1f3')]*0x3c){if(_0x49e307[_0x5273('0x156')]&&!_0x49e307['Agent'][_0x5273('0x1f4')]){_0x292e6d['preview'][_0x5273('0x1f5')](_0x49e307['id'])['finally'](function(){_0x292e6d['updateOriginated'](_0x93ebc6);});}else{hopperUtils[_0x5273('0x1f6')]({'active':![]},_0x49e307['id'],0x1)[_0x5273('0x1b')](function(){_0x292e6d[_0x5273('0xc1')](_0x93ebc6);});}}else{_0x93ebc6[_0x5273('0x1f7')]+=0x1;_0x292e6d['updateOriginated'](_0x93ebc6);if(_0x93ebc6['dialRecallInQueue']){hopperUtils[_0x5273('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x49e307['ContactId'],'ListId':_0x49e307[_0x5273('0xdf')],'VoiceQueueId':_0x49e307[_0x5273('0xec')]||undefined,'CampaignId':_0x49e307[_0x5273('0xe0')]||undefined})[_0x5273('0x9f')](loggerCatch(_0x5273('0x1f8')));hopperUtils[_0x5273('0xe4')](createObjHistory(_0x93ebc6,_0x49e307,utils[_0x5273('0x65')][_0x5273('0x1f9')],0x17,_0x5273('0x1fa')))[_0x5273('0x9f')](loggerCatch(_0x5273('0x1fb')));}else{_0x292e6d['saveInDb'](createObjHistory(_0x93ebc6,_0x49e307,utils[_0x5273('0x65')][_0x5273('0x1fc')],0x16,_0x5273('0x1fd')),_0x5273('0x1fe'),_0x5273('0x1ff'));}}}}else{_0x93ebc6[_0x5273('0x200')]+=0x1;_0x292e6d[_0x5273('0x113')](createObjHistory(_0x93ebc6,_0x49e307,utils[_0x5273('0x65')][_0x5273('0x201')],0xd,_0x5273('0x202')),_0x5273('0x203'),_0x5273('0x204'));throw'inBlackList';}};};Dialer[_0x5273('0x18')][_0x5273('0x158')]=function(_0xc1473a){var _0x557915=this;var _0x1549c6=_0xc1473a[_0x5273('0x205')]-_0xc1473a[_0x5273('0x14f')]-_0xc1473a[_0x5273('0x206')];emitCampaignSummary(_0xc1473a);if(_0x1549c6>0x0){if(_0x1549c6>this['maxNumberOriginate']){_0x1549c6=this[_0x5273('0x22')];}_0xc1473a[_0x5273('0x206')]+=_0x1549c6;hopperUtils['getContactDialerIvr'](_0xc1473a['id'],_0x1549c6,_0xc1473a[_0x5273('0x207')],_0xc1473a)[_0x5273('0x3d')](function(_0x2ae01d){_0xc1473a[_0x5273('0x206')]-=_0x1549c6;_0xc1473a[_0x5273('0x206')]=_0xc1473a[_0x5273('0x206')]>0x0?_0xc1473a[_0x5273('0x206')]:0x0;if(!utils['checkContactEmpty'](_0x2ae01d)){_0xc1473a[_0x5273('0x68')]=utils[_0x5273('0x65')]['NO_AVAILABLE_CONTACTS'];logger[_0x5273('0x49')](_0x5273('0x208')+_0xc1473a[_0x5273('0x45')]);}else{_0xc1473a[_0x5273('0x14f')]+=_0x2ae01d['length'];_0xc1473a[_0x5273('0x68')]=utils[_0x5273('0x65')]['RUNNING'];for(var _0x3603a3=0x0;_0x3603a3<_0x2ae01d['length'];_0x3603a3+=0x1){_0xc1473a[_0x5273('0x209')]+=0x1;if(_[_0x5273('0xf2')](_0x2ae01d[_0x3603a3])||_['isNil'](_0x2ae01d[_0x3603a3][_0x5273('0x179')])||_[_0x5273('0xf2')](_0x2ae01d[_0x3603a3][_0x5273('0x15c')])){_0x557915[_0x5273('0x20a')]('[actionOriginate]\x20',_0xc1473a,_0x2ae01d[_0x3603a3]);}else{hopperUtils[_0x5273('0x20b')](_['pick'](_0x2ae01d[_0x3603a3],[_0x5273('0xe0'),_0x5273('0x15c')]))[_0x5273('0x3d')](_0x557915[_0x5273('0x1e9')](_0xc1473a,_0x2ae01d[_0x3603a3]))[_0x5273('0x9f')](_0x557915[_0x5273('0x151')](_0x5273('0x20c'),_0xc1473a));}}}})[_0x5273('0x9f')](loggerGetContactDialer('[getContactCampaign2]',_0xc1473a,_0x1549c6));}};Dialer[_0x5273('0x18')][_0x5273('0xaf')]=function(_0x4d95c5,_0x34f1f2){var _0x4f9827=this;var _0x5190eb=[];if(_0x34f1f2<0x1||_0x4d95c5[_0x5273('0xad')]===_0x5273('0xb2')){_0x34f1f2=0x1;}var _0xea269f=Math[_0x5273('0x1e5')](_0x4d95c5['available']*_0x34f1f2)-_0x4d95c5[_0x5273('0x14f')]-_0x4d95c5[_0x5273('0x206')];if(_0x4d95c5['dialLimitQueue']>0x0){var _0x1b0d4b=_0x4d95c5[_0x5273('0x20d')]-_0x4d95c5['originated']-_0x4d95c5[_0x5273('0x13a')]-_0x4d95c5['temp']-_0x4d95c5[_0x5273('0x13b')];if(_0xea269f>_0x1b0d4b){_0xea269f=_0x1b0d4b;}}if(_0xea269f>0x0){if(_0x4d95c5[_0x5273('0xad')]==='booked'){_0xea269f=0x1;}if(_0xea269f>this[_0x5273('0x22')]){_0xea269f=this[_0x5273('0x22')];}_0x4d95c5['temp']+=_0xea269f;for(var _0x5b939f in this[_0x5273('0x20')]){if(typeof this['agents'][_0x5b939f]!==_0x5273('0x17a')){if(this['agents'][_0x5b939f][_0x5273('0x6b')]===_0x5273('0x20e')&&this['agents'][_0x5b939f][_0x5273('0x85')]===_0x5273('0x86')){_0x5190eb[_0x5273('0x96')](this[_0x5273('0x20')][_0x5b939f]['id']);}}}hopperUtils[_0x5273('0x20f')](_0x4d95c5,_0x5190eb,_0xea269f)['then'](function(_0x24048f){_0x4d95c5['temp']-=_0xea269f;_0x4d95c5[_0x5273('0x206')]=_0x4d95c5['temp']>0x0?_0x4d95c5[_0x5273('0x206')]:0x0;if(!utils[_0x5273('0x210')](_0x24048f)){hopperUtils[_0x5273('0x211')](_0x4d95c5)[_0x5273('0x3d')](sendMessageReschedule(_0x4d95c5))[_0x5273('0x9f')](loggerCatch(_0x5273('0x212')));}else{_0x4d95c5[_0x5273('0x14f')]+=_0x24048f[_0x5273('0x95')];_0x4d95c5[_0x5273('0x68')]=_0x4d95c5[_0x5273('0xad')]==='booked'?utils[_0x5273('0x65')]['ACTIVE']:utils[_0x5273('0x65')][_0x5273('0x213')];for(var _0x3ac17c=0x0;_0x3ac17c<_0x24048f['length'];_0x3ac17c+=0x1){if(_['isNil'](_0x24048f[_0x3ac17c])||_['isNil'](_0x24048f[_0x3ac17c][_0x5273('0x179')])||_[_0x5273('0xf2')](_0x24048f[_0x3ac17c][_0x5273('0x15c')])){_0x4f9827[_0x5273('0x20a')]('[actionOriginate]\x20',_0x4d95c5,_0x24048f[_0x3ac17c]);}else{hopperUtils[_0x5273('0x214')](_[_0x5273('0x70')](_0x24048f[_0x3ac17c],['VoiceQueueId',_0x5273('0x15c')]))[_0x5273('0x3d')](_0x4f9827[_0x5273('0x1e9')](_0x4d95c5,_0x24048f[_0x3ac17c]))[_0x5273('0x9f')](_0x4f9827[_0x5273('0x151')](_0x5273('0x215'),_0x4d95c5));}}}})[_0x5273('0x9f')](loggerGetContactDialer(_0x5273('0x216'),_0x4d95c5,_0xea269f));}};Dialer[_0x5273('0x18')][_0x5273('0x61')]=function(_0xa4c722){if(_0xa4c722[_0x5273('0x20d')]>0x0){var _0x38cb02=_0xa4c722[_0x5273('0x20d')]-_0xa4c722[_0x5273('0x14f')]-_0xa4c722['talking'];if(_0x38cb02>0x0){this[_0x5273('0x217')](_0xa4c722);}else{loggerPredictiveCalls[_0x5273('0x49')](_0x5273('0x218'));}}else{this[_0x5273('0x217')](_0xa4c722);}};Dialer[_0x5273('0x18')][_0x5273('0x217')]=function(_0x4f6704){var _0x26dc7a=this;var _0x3dfb0d=[];_0x4f6704['originated']+=0x1;for(var _0x157ec1 in this[_0x5273('0x20')]){if(typeof this['agents'][_0x157ec1]!==_0x5273('0x17a')){if(this[_0x5273('0x20')][_0x157ec1]['state']===_0x5273('0x20e')&&this[_0x5273('0x20')][_0x157ec1][_0x5273('0x85')]===_0x5273('0x86')){_0x3dfb0d['push'](this[_0x5273('0x20')][_0x157ec1]['id']);}}}return this['getContactDialer'](_0x4f6704['id'],_0x3dfb0d,0x1,_0x4f6704[_0x5273('0x207')],_0x4f6704)[_0x5273('0x3d')](function(_0x18bfde){if(!utils[_0x5273('0x210')](_0x18bfde)){utils[_0x5273('0x219')](_0x4f6704,0x1,0x0);return hopperUtils[_0x5273('0x211')](_0x4f6704)['then'](sendMessageReschedule(_0x4f6704))[_0x5273('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x4f6704[_0x5273('0x68')]=utils[_0x5273('0x65')][_0x5273('0x213')];if(_['isNil'](_0x18bfde[0x0])||_[_0x5273('0xf2')](_0x18bfde[0x0][_0x5273('0x179')])||_['isNil'](_0x18bfde[0x0][_0x5273('0x15c')])){_0x26dc7a['emptyContact'](_0x5273('0x215'),_0x4f6704,_0x18bfde[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x5273('0x70')](_0x18bfde[0x0],[_0x5273('0xec'),_0x5273('0x15c')]))[_0x5273('0x3d')](_0x26dc7a[_0x5273('0x1e9')](_0x4f6704,_0x18bfde[0x0]))[_0x5273('0x9f')](_0x26dc7a['loggerHandler'](_0x5273('0x21a'),_0x4f6704));}}})[_0x5273('0x9f')](loggerGetContactDialer(_0x5273('0x21b'),_0x4f6704,0x1));};Dialer[_0x5273('0x18')][_0x5273('0x1db')]=function(_0x162d7b,_0x28acc5,_0x36316c,_0x3caa67,_0x4d87b0,_0x194140){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x5273('0x49')]('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',_0x162d7b);loggerPredictive[_0x5273('0x49')](_0x5273('0x21c'),_0x28acc5);loggerPredictive[_0x5273('0x49')]('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',_0x36316c);loggerPredictive[_0x5273('0x49')](_0x5273('0x21d'),_0x3caa67);loggerPredictive[_0x5273('0x49')](_0x5273('0x21e'),_0x4d87b0);loggerPredictive[_0x5273('0x49')](_0x5273('0x50'));return new Promise(function(_0x26bc1d,_0x5a2486){if(_0x162d7b<=0x0||isNaN(_0x162d7b)){return _0x5a2486(msgResponse('[abandonmentRate]',_0x5273('0x80'),_0x5273('0x21f')+_0x162d7b));}if(_0x36316c<=0x0||isNaN(_0x36316c)){return _0x5a2486(msgResponse(_0x5273('0x220'),_0x5273('0x80'),'Ts\x20=\x20'+_0x36316c));}if(_0x3caa67<=0x0||isNaN(_0x3caa67)){return _0x5a2486(msgResponse(_0x5273('0x220'),_0x5273('0x80'),'p\x20=\x20'+_0x3caa67));}if(_0x28acc5<=0x0||isNaN(_0x28acc5)){return _0x5a2486(msgResponse(_0x5273('0x220'),_0x5273('0x80'),_0x5273('0x221')+_0x28acc5));}if(_0x4d87b0<=0x0||isNaN(_0x4d87b0)){return _0x5a2486(msgResponse('[abandonmentRate]',_0x5273('0x80'),'Amax\x20=\x20'+_0x4d87b0));}_0x194140=_0x194140||0x0;var _0x935a6c=0x1/_0x36316c;var _0xdbda4e=0x0;var _0x310fa6=0x0;var _0x1e8b14=0x0;var _0x48de93=0x0;for(var _0x253717=0x0;_0x1e8b14<_0x4d87b0;_0x253717+=0x1){_0x310fa6=_0x253717/_0x28acc5;_0xdbda4e=(_0x3caa67*_0x310fa6+_0x194140)/_0x935a6c;_0x1e8b14=utils['erlangb'](_0xdbda4e,_0x162d7b);_0x48de93=_0xdbda4e/_0x162d7b*(0x1-utils[_0x5273('0x222')](_0xdbda4e,_0x162d7b));}return _0x26bc1d({'erlangCalls':_0x253717,'erlangCallToSecond':_0x28acc5/_0x253717,'erlangAbandonmentRate':_0x1e8b14,'erlangBusyFactor':_0x48de93});});};Dialer[_0x5273('0x18')][_0x5273('0x1dc')]=function(_0x4379ee,_0x1ee1b8,_0x30a89a,_0x4d11de,_0x5a1f1f,_0x727e18){loggerPredictive['info'](_0x5273('0x223'));loggerPredictive[_0x5273('0x49')]('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',_0x4379ee);loggerPredictive['info'](_0x5273('0x21c'),_0x1ee1b8);loggerPredictive[_0x5273('0x49')]('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',_0x30a89a);loggerPredictive[_0x5273('0x49')](_0x5273('0x21d'),_0x4d11de);loggerPredictive[_0x5273('0x49')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a1f1f);loggerPredictive[_0x5273('0x49')](_0x5273('0x50'));return new Promise(function(_0x22a644,_0x146d7a){if(_0x4379ee<=0x0||isNaN(_0x4379ee)){return _0x146d7a(msgResponse(_0x5273('0x224'),_0x5273('0x80'),_0x5273('0x21f')+_0x4379ee));}if(_0x30a89a<=0x0||isNaN(_0x30a89a)){return _0x146d7a(msgResponse(_0x5273('0x224'),_0x5273('0x80'),_0x5273('0x225')+_0x30a89a));}if(_0x4d11de<=0x0||isNaN(_0x4d11de)){return _0x146d7a(msgResponse('[busyFactor]',_0x5273('0x80'),_0x5273('0x226')+_0x4d11de));}if(_0x1ee1b8<=0x0||isNaN(_0x1ee1b8)){return _0x146d7a(msgResponse(_0x5273('0x224'),_0x5273('0x80'),'interval\x20=\x20'+_0x1ee1b8));}if(_0x5a1f1f<=0x0||isNaN(_0x5a1f1f)){return _0x146d7a(msgResponse(_0x5273('0x224'),_0x5273('0x80'),_0x5273('0x227')+_0x5a1f1f));}_0x727e18=_0x727e18||0x0;var _0x1237c8=0x1/_0x30a89a;var _0x1677f7=0x0;var _0x22de26=0x0;var _0x5ec4ec=0x0;var _0x7d5539=0x0;for(var _0x34e97d=0x0;_0x7d5539<_0x5a1f1f;_0x34e97d+=0x1){_0x22de26=_0x34e97d/_0x1ee1b8;_0x1677f7=(_0x4d11de*_0x22de26+_0x727e18)/_0x1237c8;_0x5ec4ec=utils[_0x5273('0x222')](_0x1677f7,_0x4379ee);_0x7d5539=_0x1677f7/_0x4379ee*(0x1-utils[_0x5273('0x222')](_0x1677f7,_0x4379ee));}return _0x22a644({'erlangCalls':_0x34e97d,'erlangCallToSecond':_0x1ee1b8/_0x34e97d,'erlangAbandonmentRate':_0x5ec4ec,'erlangBusyFactor':_0x7d5539});});};module[_0x5273('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 42bc18a..745094a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x086b=['originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x49bb5f,_0x12574a){var _0x1af88a=function(_0x43ec77){while(--_0x43ec77){_0x49bb5f['push'](_0x49bb5f['shift']());}};_0x1af88a(++_0x12574a);}(_0x086b,0xeb));var _0xb086=function(_0x206a01,_0x352cd9){_0x206a01=_0x206a01-0x0;var _0xacf93d=_0x086b[_0x206a01];return _0xacf93d;};'use strict';var util=require(_0xb086('0x0'));var _=require(_0xb086('0x1'));var moment=require(_0xb086('0x2'));function checkNameSurname(_0x4120a7,_0x3cbba1,_0x1008c8){var _0x29d775='';if(!_['isNil'](_0x3cbba1)&&_0xb086('0x3')===typeof _0x3cbba1){_0x29d775+=_0x3cbba1;}if(!_[_0xb086('0x4')](_0x1008c8)&&'string'===typeof _0x1008c8){_0x29d775+='\x20'+_0x1008c8;}if(_0x29d775!==''){return _0x29d775;}return _0x4120a7;}function Action(_0xf0353f,_0x1afdf2,_0x45998c){this[_0xb086('0x5')]=_0xf0353f;this[_0xb086('0x6')]=_0x45998c||undefined;this[_0xb086('0x7')]=checkNameSurname(_0x1afdf2['Contact'][_0xb086('0x8')],_0x1afdf2['Contact'][_0xb086('0x9')],_0x1afdf2[_0xb086('0xa')][_0xb086('0xb')]);this['number']=_0x1afdf2[_0xb086('0x8')];this['queue']=_0xf0353f['name'];this['active']=_0x1afdf2['active']||![];this['type']=_0xf0353f['type'];this[_0xb086('0xc')]=_0xf0353f[_0xb086('0xc')]||0x3;this[_0xb086('0xd')]=_0x1afdf2[_0xb086('0xd')];this['countbusyretry']=_0x1afdf2[_0xb086('0xe')];this[_0xb086('0xf')]=_0x1afdf2['countcongestionretry'];this[_0xb086('0x10')]=_0x1afdf2['countnoanswerretry'];this[_0xb086('0x11')]=_0x1afdf2['countnosuchnumberretry'];this[_0xb086('0x12')]=_0x1afdf2['countdropretry'];this[_0xb086('0x13')]=_0x1afdf2[_0xb086('0x13')];this[_0xb086('0x14')]=_0x1afdf2['countmachineretry'];this[_0xb086('0x15')]=_0x1afdf2[_0xb086('0x15')];this[_0xb086('0x16')]=_0x1afdf2[_0xb086('0x16')];this[_0xb086('0x17')]=_0x1afdf2[_0xb086('0x17')];this[_0xb086('0x18')]=_0x1afdf2[_0xb086('0x18')];this['VoiceQueueId']=_0x1afdf2[_0xb086('0x19')];this[_0xb086('0x1a')]=_0x1afdf2[_0xb086('0x1a')];this[_0xb086('0x1b')]=_0x1afdf2['id'];this['ContactFirstName']=_0x1afdf2[_0xb086('0xa')][_0xb086('0x9')]||'';this[_0xb086('0x1c')]=moment()[_0xb086('0x1d')](_0xb086('0x1e'));this[_0xb086('0x1f')]=_0x1afdf2[_0xb086('0x1f')];this[_0xb086('0x20')]=_0x1afdf2[_0xb086('0x20')];this[_0xb086('0x21')]=_0x1afdf2[_0xb086('0x21')];this[_0xb086('0x22')]=_0x1afdf2[_0xb086('0x22')];this[_0xb086('0x23')]='';this[_0xb086('0x24')]='';}Action[_0xb086('0x25')][_0xb086('0x26')]=function(){return util[_0xb086('0x1d')](_0xb086('0x27'),this[_0xb086('0x7')],this[_0xb086('0x5')][_0xb086('0x28')]>0x0?this[_0xb086('0x29')][_0xb086('0x2a')](this['voiceQueue'][_0xb086('0x28')]):this[_0xb086('0x29')]);};Action[_0xb086('0x25')][_0xb086('0x2b')]=function(){return this['queue'];};module[_0xb086('0x2c')]=Action; \ No newline at end of file +var _0xde74=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x253637,_0x477072){var _0x9ba9d8=function(_0x2cf672){while(--_0x2cf672){_0x253637['push'](_0x253637['shift']());}};_0x9ba9d8(++_0x477072);}(_0xde74,0x1e5));var _0x4de7=function(_0x472546,_0x43c4f3){_0x472546=_0x472546-0x0;var _0x1b178a=_0xde74[_0x472546];return _0x1b178a;};'use strict';var util=require(_0x4de7('0x0'));var _=require(_0x4de7('0x1'));var moment=require(_0x4de7('0x2'));function checkNameSurname(_0x3cc03d,_0x5d2c29,_0x863bb8){var _0x4e5ff0='';if(!_[_0x4de7('0x3')](_0x5d2c29)&&_0x4de7('0x4')===typeof _0x5d2c29){_0x4e5ff0+=_0x5d2c29;}if(!_['isNil'](_0x863bb8)&&_0x4de7('0x4')===typeof _0x863bb8){_0x4e5ff0+='\x20'+_0x863bb8;}if(_0x4e5ff0!==''){return _0x4e5ff0;}return _0x3cc03d;}function Action(_0x334131,_0x2b949d,_0x1ab94b){this[_0x4de7('0x5')]=_0x334131;this[_0x4de7('0x6')]=_0x1ab94b||undefined;this[_0x4de7('0x7')]=checkNameSurname(_0x2b949d['Contact'][_0x4de7('0x8')],_0x2b949d['Contact'][_0x4de7('0x9')],_0x2b949d['Contact'][_0x4de7('0xa')]);this[_0x4de7('0xb')]=_0x2b949d[_0x4de7('0x8')];this[_0x4de7('0xc')]=_0x334131[_0x4de7('0x7')];this['active']=_0x2b949d[_0x4de7('0xd')]||![];this[_0x4de7('0xe')]=_0x334131[_0x4de7('0xe')];this['dialQueueTimeout']=_0x334131[_0x4de7('0xf')]||0x3;this[_0x4de7('0x10')]=_0x2b949d[_0x4de7('0x10')];this[_0x4de7('0x11')]=_0x2b949d['countbusyretry'];this[_0x4de7('0x12')]=_0x2b949d['countcongestionretry'];this[_0x4de7('0x13')]=_0x2b949d[_0x4de7('0x13')];this[_0x4de7('0x14')]=_0x2b949d['countnosuchnumberretry'];this['countdropretry']=_0x2b949d['countdropretry'];this[_0x4de7('0x15')]=_0x2b949d[_0x4de7('0x15')];this[_0x4de7('0x16')]=_0x2b949d['countmachineretry'];this[_0x4de7('0x17')]=_0x2b949d[_0x4de7('0x17')];this[_0x4de7('0x18')]=_0x2b949d[_0x4de7('0x18')];this[_0x4de7('0x19')]=_0x2b949d[_0x4de7('0x19')];this[_0x4de7('0x1a')]=_0x2b949d[_0x4de7('0x1a')];this[_0x4de7('0x1b')]=_0x2b949d[_0x4de7('0x1b')];this[_0x4de7('0x1c')]=_0x2b949d[_0x4de7('0x1c')];this['idHopper']=_0x2b949d['id'];this['ContactFirstName']=_0x2b949d['Contact'][_0x4de7('0x9')]||'';this['starttime']=moment()[_0x4de7('0x1d')](_0x4de7('0x1e'));this[_0x4de7('0x1f')]=_0x2b949d[_0x4de7('0x1f')];this[_0x4de7('0x20')]=_0x2b949d[_0x4de7('0x20')];this[_0x4de7('0x21')]=_0x2b949d[_0x4de7('0x21')];this[_0x4de7('0x22')]=_0x2b949d[_0x4de7('0x22')];this[_0x4de7('0x23')]='';this[_0x4de7('0x24')]='';}Action[_0x4de7('0x25')][_0x4de7('0x26')]=function(){return util['format'](_0x4de7('0x27'),this[_0x4de7('0x7')],this['voiceQueue'][_0x4de7('0x28')]>0x0?this[_0x4de7('0xb')][_0x4de7('0x29')](this[_0x4de7('0x5')][_0x4de7('0x28')]):this[_0x4de7('0xb')]);};Action[_0x4de7('0x25')][_0x4de7('0x2a')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 9fb6bb6..bea1c3c 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x691b=['agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x46974b,_0x1edcf5){var _0x4dc881=function(_0x51634f){while(--_0x51634f){_0x46974b['push'](_0x46974b['shift']());}};_0x4dc881(++_0x1edcf5);}(_0x691b,0x88));var _0xb691=function(_0x3ed29f,_0x1a2d3e){_0x3ed29f=_0x3ed29f-0x0;var _0x18e33d=_0x691b[_0x3ed29f];return _0x18e33d;};'use strict';var moment=require(_0xb691('0x0'));var utils=require(_0xb691('0x1'));function AgentComplete(_0x142104,_0x8b5aac){this[_0xb691('0x2')]=0x4;this[_0xb691('0x3')]=_0xb691('0x4');this[_0xb691('0x5')]=_0x142104[_0xb691('0x5')];this[_0xb691('0x6')]=_0x142104[_0xb691('0x6')];this[_0xb691('0x7')]=_0x142104[_0xb691('0x6')]===_0xb691('0x8')?_0xb691('0x9'):_0x142104[_0xb691('0x6')];this[_0xb691('0xa')]=_0x142104[_0xb691('0xa')];this[_0xb691('0xb')]=_0x142104[_0xb691('0xb')];this[_0xb691('0xc')]=_0x142104[_0xb691('0xc')];this[_0xb691('0xd')]=_0x142104[_0xb691('0xa')]+_0x142104[_0xb691('0xb')]+_0x142104[_0xb691('0xc')]+_0x142104[_0xb691('0xe')]+_0x142104[_0xb691('0xf')]+_0x142104['countabandonedretry']+_0x142104[_0xb691('0x10')]+_0x142104[_0xb691('0x11')];this[_0xb691('0xe')]=_0x142104['countnosuchnumberretry'];this[_0xb691('0xf')]=_0x142104[_0xb691('0xf')];this[_0xb691('0x12')]=_0x142104[_0xb691('0x12')];this[_0xb691('0x10')]=_0x142104['countmachineretry'];this['countagentrejectretry']=_0x142104[_0xb691('0x11')];this[_0xb691('0x13')]=_0x8b5aac[_0xb691('0x13')];this['calleridname']=_0x142104[_0xb691('0x14')];this[_0xb691('0x15')]=_0x142104[_0xb691('0x16')];this['starttime']=_0x142104[_0xb691('0x17')];this[_0xb691('0x18')]=_0x142104[_0xb691('0x18')];this['answertime']=_0x142104[_0xb691('0x19')];this[_0xb691('0x1a')]=moment()[_0xb691('0x1b')](_0xb691('0x1c'));this['ringtime']=utils[_0xb691('0x1d')](_0x142104[_0xb691('0x18')],_0x142104[_0xb691('0x17')]);this[_0xb691('0x1e')]=utils[_0xb691('0x1d')](_0x142104['answertime'],_0x142104[_0xb691('0x18')]);this[_0xb691('0x1f')]=utils['getSeconds'](this['endtime'],_0x142104[_0xb691('0x19')]);this[_0xb691('0x9')]=_0x8b5aac[_0xb691('0x9')];this[_0xb691('0x20')]=_0x8b5aac[_0xb691('0x20')];this['reason']=_0x8b5aac['reason'];this[_0xb691('0x21')]=_0x142104[_0xb691('0x21')];this[_0xb691('0x22')]=_0x142104[_0xb691('0x22')];this[_0xb691('0x23')]=_0x142104['callbackat'];this[_0xb691('0x24')]=_0x142104[_0xb691('0x24')];this[_0xb691('0x25')]=_0x142104['ContactId'];this[_0xb691('0x26')]=_0x142104[_0xb691('0x26')];this[_0xb691('0x27')]=_0x142104[_0xb691('0x27')];this[_0xb691('0x28')]=_0x142104['VoiceQueueId'];this[_0xb691('0x29')]=_0x142104['CampaignId'];this[_0xb691('0x2a')]=_0x142104[_0xb691('0x2a')]||'';this[_0xb691('0x2b')]=_0x142104['originatecalleridname']||'';this[_0xb691('0x2c')]=_0x142104[_0xb691('0x2c')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x9b72=['reason','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','ringtime','getSeconds','holdtime','membername'];(function(_0x24bcad,_0x32e3a0){var _0x3d1f9d=function(_0x19724f){while(--_0x19724f){_0x24bcad['push'](_0x24bcad['shift']());}};_0x3d1f9d(++_0x32e3a0);}(_0x9b72,0x1b0));var _0x29b7=function(_0x275f92,_0xf6eb4c){_0x275f92=_0x275f92-0x0;var _0x51556=_0x9b72[_0x275f92];return _0x51556;};'use strict';var moment=require(_0x29b7('0x0'));var utils=require(_0x29b7('0x1'));function AgentComplete(_0x126257,_0x39b523){this[_0x29b7('0x2')]=0x4;this[_0x29b7('0x3')]=_0x29b7('0x4');this[_0x29b7('0x5')]=_0x126257[_0x29b7('0x5')];this[_0x29b7('0x6')]=_0x126257[_0x29b7('0x6')];this[_0x29b7('0x7')]=_0x126257['type']==='outbound'?_0x29b7('0x8'):_0x126257[_0x29b7('0x6')];this[_0x29b7('0x9')]=_0x126257[_0x29b7('0x9')];this['countcongestionretry']=_0x126257[_0x29b7('0xa')];this[_0x29b7('0xb')]=_0x126257[_0x29b7('0xb')];this[_0x29b7('0xc')]=_0x126257[_0x29b7('0x9')]+_0x126257[_0x29b7('0xa')]+_0x126257['countnoanswerretry']+_0x126257[_0x29b7('0xd')]+_0x126257['countdropretry']+_0x126257['countabandonedretry']+_0x126257['countmachineretry']+_0x126257['countagentrejectretry'];this[_0x29b7('0xd')]=_0x126257['countnosuchnumberretry'];this[_0x29b7('0xe')]=_0x126257['countdropretry'];this[_0x29b7('0xf')]=_0x126257[_0x29b7('0xf')];this[_0x29b7('0x10')]=_0x126257[_0x29b7('0x10')];this[_0x29b7('0x11')]=_0x126257[_0x29b7('0x11')];this[_0x29b7('0x12')]=_0x39b523[_0x29b7('0x12')];this[_0x29b7('0x13')]=_0x126257[_0x29b7('0x14')];this['calleridnum']=_0x126257[_0x29b7('0x15')];this[_0x29b7('0x16')]=_0x126257[_0x29b7('0x16')];this[_0x29b7('0x17')]=_0x126257[_0x29b7('0x17')];this[_0x29b7('0x18')]=_0x126257[_0x29b7('0x18')];this[_0x29b7('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x29b7('0x1a')]=utils[_0x29b7('0x1b')](_0x126257[_0x29b7('0x17')],_0x126257[_0x29b7('0x16')]);this[_0x29b7('0x1c')]=utils[_0x29b7('0x1b')](_0x126257[_0x29b7('0x18')],_0x126257[_0x29b7('0x17')]);this['talktime']=utils[_0x29b7('0x1b')](this[_0x29b7('0x19')],_0x126257[_0x29b7('0x18')]);this[_0x29b7('0x8')]=_0x39b523[_0x29b7('0x8')];this[_0x29b7('0x1d')]=_0x39b523[_0x29b7('0x1d')];this[_0x29b7('0x1e')]=_0x39b523['reason'];this[_0x29b7('0x1f')]=_0x126257['callback'];this[_0x29b7('0x20')]=_0x126257[_0x29b7('0x20')];this[_0x29b7('0x21')]=_0x126257[_0x29b7('0x21')];this['recallme']=_0x126257['recallme'];this['ContactId']=_0x126257[_0x29b7('0x22')];this['ListId']=_0x126257['ListId'];this[_0x29b7('0x23')]=_0x126257[_0x29b7('0x23')];this[_0x29b7('0x24')]=_0x126257[_0x29b7('0x24')];this['CampaignId']=_0x126257[_0x29b7('0x25')];this[_0x29b7('0x26')]=_0x126257['originatecalleridnum']||'';this[_0x29b7('0x27')]=_0x126257[_0x29b7('0x27')]||'';this[_0x29b7('0x28')]=_0x126257[_0x29b7('0x28')];}module[_0x29b7('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index cd5a361..f4cf2d8 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x872a=['statedesc','exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0x25e4ad,_0x5559f2){var _0x37f874=function(_0x206bc4){while(--_0x206bc4){_0x25e4ad['push'](_0x25e4ad['shift']());}};_0x37f874(++_0x5559f2);}(_0x872a,0x8a));var _0xa872=function(_0x250193,_0x596adb){_0x250193=_0x250193-0x0;var _0x5c2f3f=_0x872a[_0x250193];return _0x5c2f3f;};'use strict';function Final(_0x1045e3){this[_0xa872('0x0')]=_0x1045e3[_0xa872('0x0')];this[_0xa872('0x1')]=_0x1045e3[_0xa872('0x1')];this[_0xa872('0x2')]=_0x1045e3[_0xa872('0x2')];this['campaigntype']=_0x1045e3[_0xa872('0x2')]==='outbound'?_0xa872('0x3'):_0x1045e3[_0xa872('0x2')];this[_0xa872('0x4')]=_0x1045e3[_0xa872('0x4')];this['countcongestionretry']=_0x1045e3[_0xa872('0x5')];this[_0xa872('0x6')]=_0x1045e3[_0xa872('0x6')];this['countglobal']=_0x1045e3[_0xa872('0x4')]+_0x1045e3[_0xa872('0x5')]+_0x1045e3['countnoanswerretry']+_0x1045e3[_0xa872('0x7')]+_0x1045e3[_0xa872('0x8')]+_0x1045e3[_0xa872('0x9')]+_0x1045e3['countmachineretry']+_0x1045e3[_0xa872('0xa')];this[_0xa872('0x7')]=_0x1045e3['countnosuchnumberretry'];this['countdropretry']=_0x1045e3[_0xa872('0x8')];this[_0xa872('0x9')]=_0x1045e3[_0xa872('0x9')];this['countmachineretry']=_0x1045e3[_0xa872('0xb')];this[_0xa872('0xa')]=_0x1045e3[_0xa872('0xa')];this[_0xa872('0x3')]=_0x1045e3[_0xa872('0x3')];this[_0xa872('0xc')]=_0x1045e3['calleridname'];this[_0xa872('0xd')]=_0x1045e3[_0xa872('0xd')];this[_0xa872('0xe')]=_0x1045e3[_0xa872('0xe')];this[_0xa872('0xf')]=_0x1045e3[_0xa872('0xf')];this[_0xa872('0x10')]=_0x1045e3[_0xa872('0xf')];this[_0xa872('0x11')]=_0x1045e3[_0xa872('0x11')]||0x0;this[_0xa872('0x12')]=_0x1045e3[_0xa872('0x12')]||0x0;this['talktime']=_0x1045e3[_0xa872('0x13')]||0x0;this[_0xa872('0x14')]=_0x1045e3[_0xa872('0x14')];this['callbackuniqueid']=_0x1045e3[_0xa872('0x15')];this[_0xa872('0x16')]=_0x1045e3[_0xa872('0x16')];this['recallme']=_0x1045e3[_0xa872('0x17')];this['ContactId']=_0x1045e3[_0xa872('0x18')];this['ListId']=_0x1045e3[_0xa872('0x19')];this[_0xa872('0x1a')]=_0x1045e3['UserId'];this['VoiceQueueId']=_0x1045e3[_0xa872('0x1b')];this['CampaignId']=_0x1045e3[_0xa872('0x1c')];this[_0xa872('0x1d')]=_0x1045e3['originatecalleridnum']||'';this['originatecalleridname']=_0x1045e3[_0xa872('0x1e')]||'';this[_0xa872('0x1f')]=_0x1045e3[_0xa872('0x1f')];this[_0xa872('0x20')]=_0x1045e3[_0xa872('0x20')];}module[_0xa872('0x21')]=Final; \ No newline at end of file +var _0xba14=['exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','state','statedesc'];(function(_0x1e6d65,_0x4e0538){var _0x2a3119=function(_0x2babc5){while(--_0x2babc5){_0x1e6d65['push'](_0x1e6d65['shift']());}};_0x2a3119(++_0x4e0538);}(_0xba14,0x15f));var _0x4ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba14[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x34016a){this[_0x4ba1('0x0')]=_0x34016a[_0x4ba1('0x0')];this[_0x4ba1('0x1')]=_0x34016a['scheduledat'];this[_0x4ba1('0x2')]=_0x34016a[_0x4ba1('0x2')];this[_0x4ba1('0x3')]=_0x34016a[_0x4ba1('0x2')]===_0x4ba1('0x4')?_0x4ba1('0x5'):_0x34016a['type'];this[_0x4ba1('0x6')]=_0x34016a[_0x4ba1('0x6')];this[_0x4ba1('0x7')]=_0x34016a['countcongestionretry'];this[_0x4ba1('0x8')]=_0x34016a[_0x4ba1('0x8')];this[_0x4ba1('0x9')]=_0x34016a[_0x4ba1('0x6')]+_0x34016a[_0x4ba1('0x7')]+_0x34016a['countnoanswerretry']+_0x34016a['countnosuchnumberretry']+_0x34016a[_0x4ba1('0xa')]+_0x34016a[_0x4ba1('0xb')]+_0x34016a[_0x4ba1('0xc')]+_0x34016a[_0x4ba1('0xd')];this[_0x4ba1('0xe')]=_0x34016a['countnosuchnumberretry'];this['countdropretry']=_0x34016a[_0x4ba1('0xa')];this['countabandonedretry']=_0x34016a[_0x4ba1('0xb')];this[_0x4ba1('0xc')]=_0x34016a[_0x4ba1('0xc')];this['countagentrejectretry']=_0x34016a[_0x4ba1('0xd')];this[_0x4ba1('0x5')]=_0x34016a[_0x4ba1('0x5')];this['calleridname']=_0x34016a[_0x4ba1('0xf')];this['calleridnum']=_0x34016a[_0x4ba1('0x10')];this[_0x4ba1('0x11')]=_0x34016a[_0x4ba1('0x11')];this[_0x4ba1('0x12')]=_0x34016a[_0x4ba1('0x12')];this[_0x4ba1('0x13')]=_0x34016a[_0x4ba1('0x12')];this[_0x4ba1('0x14')]=_0x34016a[_0x4ba1('0x14')]||0x0;this['holdtime']=_0x34016a[_0x4ba1('0x15')]||0x0;this[_0x4ba1('0x16')]=_0x34016a[_0x4ba1('0x16')]||0x0;this[_0x4ba1('0x17')]=_0x34016a['callback'];this[_0x4ba1('0x18')]=_0x34016a[_0x4ba1('0x18')];this[_0x4ba1('0x19')]=_0x34016a[_0x4ba1('0x19')];this['recallme']=_0x34016a[_0x4ba1('0x1a')];this[_0x4ba1('0x1b')]=_0x34016a[_0x4ba1('0x1b')];this['ListId']=_0x34016a[_0x4ba1('0x1c')];this[_0x4ba1('0x1d')]=_0x34016a[_0x4ba1('0x1d')];this[_0x4ba1('0x1e')]=_0x34016a[_0x4ba1('0x1e')];this['CampaignId']=_0x34016a['CampaignId'];this['originatecalleridnum']=_0x34016a['originatecalleridnum']||'';this[_0x4ba1('0x1f')]=_0x34016a['originatecalleridname']||'';this['state']=_0x34016a[_0x4ba1('0x20')];this[_0x4ba1('0x21')]=_0x34016a[_0x4ba1('0x21')];}module[_0x4ba1('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 865257b..f3edf55 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc75=['campaigntype','outbound','queue','amd','countcongestionretry','countnoanswerretry','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','scheduledat','type'];(function(_0x59778f,_0xc4c8c7){var _0x4896d1=function(_0x4dde86){while(--_0x4dde86){_0x59778f['push'](_0x59778f['shift']());}};_0x4896d1(++_0xc4c8c7);}(_0xfc75,0x8b));var _0x5fc7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfc75[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0x5fc7('0x0'));var utils=require(_0x5fc7('0x1'));function Hangup(_0x54903e,_0x2a0dda){this['state']=0x4;this[_0x5fc7('0x2')]='Answer';this['scheduledat']=_0x54903e[_0x5fc7('0x3')];this['type']=_0x54903e[_0x5fc7('0x4')];this[_0x5fc7('0x5')]=_0x54903e['type']===_0x5fc7('0x6')?_0x5fc7('0x7'):_0x54903e[_0x5fc7('0x4')];this['amd']=_0x54903e[_0x5fc7('0x8')]||![];this['countbusyretry']=_0x54903e['countbusyretry'];this['countcongestionretry']=_0x54903e[_0x5fc7('0x9')];this[_0x5fc7('0xa')]=_0x54903e[_0x5fc7('0xa')];this['countglobal']=_0x54903e[_0x5fc7('0xb')]+_0x54903e[_0x5fc7('0x9')]+_0x54903e['countnoanswerretry']+_0x54903e['countnosuchnumberretry']+_0x54903e[_0x5fc7('0xc')]+_0x54903e[_0x5fc7('0xd')]+_0x54903e[_0x5fc7('0xe')]+_0x54903e['countagentrejectretry'];this[_0x5fc7('0xf')]=_0x54903e[_0x5fc7('0xf')];this[_0x5fc7('0xc')]=_0x54903e['countdropretry'];this[_0x5fc7('0xd')]=_0x54903e[_0x5fc7('0xd')];this[_0x5fc7('0xe')]=_0x54903e[_0x5fc7('0xe')];this['countagentrejectretry']=_0x54903e[_0x5fc7('0x10')];this[_0x5fc7('0x11')]=_0x2a0dda[_0x5fc7('0x11')];this['calleridname']=_0x54903e[_0x5fc7('0x12')];this['calleridnum']=_0x54903e['number'];this[_0x5fc7('0x13')]=_0x54903e[_0x5fc7('0x13')];this[_0x5fc7('0x14')]=_0x54903e['responsetime'];this[_0x5fc7('0x15')]=moment()[_0x5fc7('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5fc7('0x17')]=utils[_0x5fc7('0x18')](_0x54903e['responsetime'],_0x54903e[_0x5fc7('0x13')]);this[_0x5fc7('0x19')]=0x0;this['talktime']=utils[_0x5fc7('0x18')](this['endtime'],_0x54903e[_0x5fc7('0x14')]);this[_0x5fc7('0x7')]=_0x54903e[_0x5fc7('0x7')];this['membername']='IVR';this['reason']=_0x2a0dda[_0x5fc7('0x1a')];this['callback']=_0x54903e[_0x5fc7('0x1b')];this['callbackuniqueid']=_0x54903e[_0x5fc7('0x1c')];this[_0x5fc7('0x1d')]=_0x54903e[_0x5fc7('0x1d')];this[_0x5fc7('0x1e')]=_0x54903e[_0x5fc7('0x1e')];this[_0x5fc7('0x1f')]=_0x54903e['ContactId'];this['ListId']=_0x54903e[_0x5fc7('0x20')];this['UserId']=_0x54903e['UserId'];this[_0x5fc7('0x21')]=_0x54903e[_0x5fc7('0x21')];this[_0x5fc7('0x22')]=_0x54903e[_0x5fc7('0x22')];}module[_0x5fc7('0x23')]=Hangup; \ No newline at end of file +var _0x7444=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7444,0x178));var _0x4744=function(_0x347a5b,_0x661844){_0x347a5b=_0x347a5b-0x0;var _0x3498a3=_0x7444[_0x347a5b];return _0x3498a3;};'use strict';var moment=require('moment');var utils=require(_0x4744('0x0'));function Hangup(_0x14f595,_0x11af27){this[_0x4744('0x1')]=0x4;this[_0x4744('0x2')]=_0x4744('0x3');this['scheduledat']=_0x14f595[_0x4744('0x4')];this[_0x4744('0x5')]=_0x14f595[_0x4744('0x5')];this['campaigntype']=_0x14f595[_0x4744('0x5')]===_0x4744('0x6')?'queue':_0x14f595[_0x4744('0x5')];this[_0x4744('0x7')]=_0x14f595[_0x4744('0x7')]||![];this[_0x4744('0x8')]=_0x14f595['countbusyretry'];this[_0x4744('0x9')]=_0x14f595[_0x4744('0x9')];this[_0x4744('0xa')]=_0x14f595[_0x4744('0xa')];this['countglobal']=_0x14f595[_0x4744('0x8')]+_0x14f595[_0x4744('0x9')]+_0x14f595[_0x4744('0xa')]+_0x14f595[_0x4744('0xb')]+_0x14f595[_0x4744('0xc')]+_0x14f595[_0x4744('0xd')]+_0x14f595[_0x4744('0xe')]+_0x14f595[_0x4744('0xf')];this[_0x4744('0xb')]=_0x14f595[_0x4744('0xb')];this[_0x4744('0xc')]=_0x14f595[_0x4744('0xc')];this[_0x4744('0xd')]=_0x14f595['countabandonedretry'];this[_0x4744('0xe')]=_0x14f595['countmachineretry'];this[_0x4744('0xf')]=_0x14f595[_0x4744('0xf')];this['uniqueid']=_0x11af27[_0x4744('0x10')];this[_0x4744('0x11')]=_0x14f595[_0x4744('0x12')];this[_0x4744('0x13')]=_0x14f595[_0x4744('0x14')];this[_0x4744('0x15')]=_0x14f595[_0x4744('0x15')];this[_0x4744('0x16')]=_0x14f595[_0x4744('0x16')];this[_0x4744('0x17')]=moment()['format'](_0x4744('0x18'));this[_0x4744('0x19')]=utils[_0x4744('0x1a')](_0x14f595['responsetime'],_0x14f595[_0x4744('0x15')]);this['holdtime']=0x0;this['talktime']=utils[_0x4744('0x1a')](this[_0x4744('0x17')],_0x14f595[_0x4744('0x16')]);this['queue']=_0x14f595[_0x4744('0x1b')];this['membername']=_0x4744('0x1c');this[_0x4744('0x1d')]=_0x11af27[_0x4744('0x1e')];this[_0x4744('0x1f')]=_0x14f595[_0x4744('0x1f')];this[_0x4744('0x20')]=_0x14f595['callbackuniqueid'];this['callbackat']=_0x14f595[_0x4744('0x21')];this['recallme']=_0x14f595[_0x4744('0x22')];this[_0x4744('0x23')]=_0x14f595['ContactId'];this[_0x4744('0x24')]=_0x14f595['ListId'];this['UserId']=_0x14f595[_0x4744('0x25')];this[_0x4744('0x26')]=_0x14f595[_0x4744('0x26')];this['CampaignId']=_0x14f595[_0x4744('0x27')];}module[_0x4744('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 6c07f2a..2bf975e 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa662=['responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','exports','../utils','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','name','calleridnum','number','starttime'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0xa662,0x131));var _0x2a66=function(_0x42bb3a,_0xe72028){_0x42bb3a=_0x42bb3a-0x0;var _0x1993e9=_0xa662[_0x42bb3a];return _0x1993e9;};'use strict';var utils=require(_0x2a66('0x0'));function History(_0x3e3c46){this['uniqueid']=_0x3e3c46[_0x2a66('0x1')];this['scheduledat']=_0x3e3c46[_0x2a66('0x2')]||undefined;this[_0x2a66('0x3')]=_0x3e3c46[_0x2a66('0x3')];this[_0x2a66('0x4')]=_0x3e3c46[_0x2a66('0x3')]==='outbound'?'queue':_0x3e3c46[_0x2a66('0x3')];this[_0x2a66('0x5')]=_0x3e3c46['countbusyretry'];this[_0x2a66('0x6')]=_0x3e3c46[_0x2a66('0x6')];this[_0x2a66('0x7')]=_0x3e3c46[_0x2a66('0x7')];this['countglobal']=_0x3e3c46[_0x2a66('0x5')]+_0x3e3c46['countcongestionretry']+_0x3e3c46[_0x2a66('0x7')]+_0x3e3c46[_0x2a66('0x8')]+_0x3e3c46['countdropretry']+_0x3e3c46['countabandonedretry']+_0x3e3c46[_0x2a66('0x9')]+_0x3e3c46[_0x2a66('0xa')];this[_0x2a66('0x8')]=_0x3e3c46[_0x2a66('0x8')];this[_0x2a66('0xb')]=_0x3e3c46[_0x2a66('0xb')];this['countabandonedretry']=_0x3e3c46[_0x2a66('0xc')];this['countmachineretry']=_0x3e3c46[_0x2a66('0x9')];this[_0x2a66('0xa')]=_0x3e3c46[_0x2a66('0xa')];this[_0x2a66('0xd')]=_0x3e3c46[_0x2a66('0xd')];this[_0x2a66('0xe')]=_0x3e3c46[_0x2a66('0xf')];this[_0x2a66('0x10')]=_0x3e3c46[_0x2a66('0x11')];this['starttime']=_0x3e3c46[_0x2a66('0x12')];this[_0x2a66('0x13')]=_0x3e3c46[_0x2a66('0x13')];this[_0x2a66('0x14')]=_0x3e3c46[_0x2a66('0x13')];this[_0x2a66('0x15')]=utils[_0x2a66('0x16')](_0x3e3c46[_0x2a66('0x13')],_0x3e3c46[_0x2a66('0x12')]);this['holdtime']=0x0;this[_0x2a66('0x17')]=0x0;this[_0x2a66('0x18')]=_0x3e3c46[_0x2a66('0x18')];this[_0x2a66('0x19')]=_0x3e3c46['callbackuniqueid'];this[_0x2a66('0x1a')]=_0x3e3c46['callbackat'];this[_0x2a66('0x1b')]=_0x3e3c46[_0x2a66('0x1b')];this[_0x2a66('0x1c')]=_0x3e3c46[_0x2a66('0x1c')];this[_0x2a66('0x1d')]=_0x3e3c46['ListId'];this['UserId']=_0x3e3c46[_0x2a66('0x1e')];this[_0x2a66('0x1f')]=_0x3e3c46[_0x2a66('0x1f')];this[_0x2a66('0x20')]=_0x3e3c46[_0x2a66('0x20')];this[_0x2a66('0x21')]=_0x3e3c46[_0x2a66('0x21')]||'';this['originatecalleridname']=_0x3e3c46['originatecalleridname']||'';this[_0x2a66('0x22')]=_0x3e3c46[_0x2a66('0x22')];this['statedesc']=_0x3e3c46['statedesc'];}module[_0x2a66('0x23')]=History; \ No newline at end of file +var _0x8383=['number','starttime','responsetime','endtime','ringtime','getSeconds','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','calleridnum'];(function(_0x532875,_0x1ca8c3){var _0x5a47f7=function(_0x208d84){while(--_0x208d84){_0x532875['push'](_0x532875['shift']());}};_0x5a47f7(++_0x1ca8c3);}(_0x8383,0x1a9));var _0x3838=function(_0x297e76,_0x60d1a4){_0x297e76=_0x297e76-0x0;var _0x2d6b71=_0x8383[_0x297e76];return _0x2d6b71;};'use strict';var utils=require(_0x3838('0x0'));function History(_0xc17e33){this[_0x3838('0x1')]=_0xc17e33[_0x3838('0x1')];this[_0x3838('0x2')]=_0xc17e33[_0x3838('0x2')]||undefined;this[_0x3838('0x3')]=_0xc17e33[_0x3838('0x3')];this[_0x3838('0x4')]=_0xc17e33[_0x3838('0x3')]===_0x3838('0x5')?_0x3838('0x6'):_0xc17e33['type'];this[_0x3838('0x7')]=_0xc17e33[_0x3838('0x7')];this[_0x3838('0x8')]=_0xc17e33[_0x3838('0x8')];this[_0x3838('0x9')]=_0xc17e33[_0x3838('0x9')];this[_0x3838('0xa')]=_0xc17e33[_0x3838('0x7')]+_0xc17e33[_0x3838('0x8')]+_0xc17e33[_0x3838('0x9')]+_0xc17e33['countnosuchnumberretry']+_0xc17e33[_0x3838('0xb')]+_0xc17e33[_0x3838('0xc')]+_0xc17e33['countmachineretry']+_0xc17e33[_0x3838('0xd')];this[_0x3838('0xe')]=_0xc17e33['countnosuchnumberretry'];this['countdropretry']=_0xc17e33['countdropretry'];this['countabandonedretry']=_0xc17e33[_0x3838('0xc')];this[_0x3838('0xf')]=_0xc17e33[_0x3838('0xf')];this[_0x3838('0xd')]=_0xc17e33['countagentrejectretry'];this[_0x3838('0x6')]=_0xc17e33['queue'];this[_0x3838('0x10')]=_0xc17e33[_0x3838('0x11')];this[_0x3838('0x12')]=_0xc17e33[_0x3838('0x13')];this['starttime']=_0xc17e33[_0x3838('0x14')];this[_0x3838('0x15')]=_0xc17e33[_0x3838('0x15')];this[_0x3838('0x16')]=_0xc17e33[_0x3838('0x15')];this[_0x3838('0x17')]=utils[_0x3838('0x18')](_0xc17e33['responsetime'],_0xc17e33[_0x3838('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0xc17e33['callback'];this[_0x3838('0x19')]=_0xc17e33[_0x3838('0x19')];this[_0x3838('0x1a')]=_0xc17e33['callbackat'];this[_0x3838('0x1b')]=_0xc17e33['recallme'];this[_0x3838('0x1c')]=_0xc17e33[_0x3838('0x1c')];this['ListId']=_0xc17e33[_0x3838('0x1d')];this[_0x3838('0x1e')]=_0xc17e33['UserId'];this['VoiceQueueId']=_0xc17e33[_0x3838('0x1f')];this['CampaignId']=_0xc17e33[_0x3838('0x20')];this[_0x3838('0x21')]=_0xc17e33[_0x3838('0x21')]||'';this[_0x3838('0x22')]=_0xc17e33[_0x3838('0x22')]||'';this['state']=_0xc17e33[_0x3838('0x23')];this[_0x3838('0x24')]=_0xc17e33['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index bef76f5..2b53557 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c3=['statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state'];(function(_0x1ed366,_0x4a1c6e){var _0x151b50=function(_0x3315d1){while(--_0x3315d1){_0x1ed366['push'](_0x1ed366['shift']());}};_0x151b50(++_0x4a1c6e);}(_0xf6c3,0x16a));var _0x3f6c=function(_0x3e065b,_0x42fe6a){_0x3e065b=_0x3e065b-0x0;var _0x2a6eb3=_0xf6c3[_0x3e065b];return _0x2a6eb3;};'use strict';var utils=require(_0x3f6c('0x0'));function QueueCallerAbandon(_0x30a0c6,_0x91d2a){this['scheduledat']=_0x30a0c6[_0x3f6c('0x1')];this[_0x3f6c('0x2')]=_0x30a0c6[_0x3f6c('0x2')];this[_0x3f6c('0x3')]=_0x30a0c6['type']===_0x3f6c('0x4')?'queue':_0x30a0c6[_0x3f6c('0x2')];this['countbusyretry']=_0x30a0c6[_0x3f6c('0x5')];this[_0x3f6c('0x6')]=_0x30a0c6[_0x3f6c('0x6')];this[_0x3f6c('0x7')]=_0x30a0c6[_0x3f6c('0x7')];this[_0x3f6c('0x8')]=_0x30a0c6[_0x3f6c('0x5')]+_0x30a0c6['countcongestionretry']+_0x30a0c6[_0x3f6c('0x7')]+_0x30a0c6[_0x3f6c('0x9')]+_0x30a0c6['countdropretry']+_0x30a0c6[_0x3f6c('0xa')]+_0x30a0c6['countmachineretry']+_0x30a0c6[_0x3f6c('0xb')];this[_0x3f6c('0x9')]=_0x30a0c6['countnosuchnumberretry'];this[_0x3f6c('0xc')]=_0x30a0c6[_0x3f6c('0xc')];this[_0x3f6c('0xa')]=_0x30a0c6['countabandonedretry'];this[_0x3f6c('0xd')]=_0x30a0c6['countmachineretry'];this[_0x3f6c('0xb')]=_0x30a0c6[_0x3f6c('0xb')];this[_0x3f6c('0xe')]=_0x91d2a[_0x3f6c('0xe')];this[_0x3f6c('0xf')]=_0x30a0c6[_0x3f6c('0x10')];this[_0x3f6c('0x11')]=_0x30a0c6[_0x3f6c('0x12')];this[_0x3f6c('0x13')]=_0x30a0c6[_0x3f6c('0x13')];this[_0x3f6c('0x14')]=_0x30a0c6[_0x3f6c('0x14')];this[_0x3f6c('0x15')]=_0x30a0c6[_0x3f6c('0x15')];this['dropreason']=_0x30a0c6[_0x3f6c('0x16')];this[_0x3f6c('0x17')]=this[_0x3f6c('0x15')];this['ringtime']=utils[_0x3f6c('0x18')](_0x30a0c6['responsetime'],_0x30a0c6[_0x3f6c('0x13')]);this[_0x3f6c('0x19')]=utils[_0x3f6c('0x18')](this[_0x3f6c('0x15')],_0x30a0c6[_0x3f6c('0x14')]);this[_0x3f6c('0x1a')]=0x0;this[_0x3f6c('0x1b')]=_0x91d2a[_0x3f6c('0x1b')];this[_0x3f6c('0x1c')]=_0x91d2a[_0x3f6c('0x1d')];this[_0x3f6c('0x1e')]=_0x91d2a['reason'];this['callback']=_0x30a0c6[_0x3f6c('0x1f')];this[_0x3f6c('0x20')]=_0x30a0c6['callbackuniqueid'];this[_0x3f6c('0x21')]=_0x30a0c6[_0x3f6c('0x21')];this[_0x3f6c('0x22')]=_0x30a0c6[_0x3f6c('0x22')];this['ContactId']=_0x30a0c6['ContactId'];this[_0x3f6c('0x23')]=_0x30a0c6[_0x3f6c('0x23')];this[_0x3f6c('0x24')]=_0x30a0c6[_0x3f6c('0x24')];this[_0x3f6c('0x25')]=_0x30a0c6[_0x3f6c('0x25')];this[_0x3f6c('0x26')]=_0x30a0c6[_0x3f6c('0x26')];this[_0x3f6c('0x27')]=_0x30a0c6[_0x3f6c('0x27')]||'';this[_0x3f6c('0x28')]=_0x30a0c6['originatecalleridname']||'';this[_0x3f6c('0x29')]=_0x30a0c6[_0x3f6c('0x29')];this[_0x3f6c('0x2a')]=_0x30a0c6[_0x3f6c('0x2a')];this['statedesc']=_0x30a0c6[_0x3f6c('0x2b')];}module[_0x3f6c('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0xd045=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xd045,0x197));var _0x5d04=function(_0xbb44ba,_0x35634f){_0xbb44ba=_0xbb44ba-0x0;var _0x330a08=_0xd045[_0xbb44ba];return _0x330a08;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x3bebb4,_0x4a5948){this[_0x5d04('0x0')]=_0x3bebb4[_0x5d04('0x0')];this[_0x5d04('0x1')]=_0x3bebb4[_0x5d04('0x1')];this[_0x5d04('0x2')]=_0x3bebb4[_0x5d04('0x1')]===_0x5d04('0x3')?_0x5d04('0x4'):_0x3bebb4[_0x5d04('0x1')];this[_0x5d04('0x5')]=_0x3bebb4[_0x5d04('0x5')];this[_0x5d04('0x6')]=_0x3bebb4[_0x5d04('0x6')];this[_0x5d04('0x7')]=_0x3bebb4['countnoanswerretry'];this[_0x5d04('0x8')]=_0x3bebb4[_0x5d04('0x5')]+_0x3bebb4[_0x5d04('0x6')]+_0x3bebb4[_0x5d04('0x7')]+_0x3bebb4[_0x5d04('0x9')]+_0x3bebb4[_0x5d04('0xa')]+_0x3bebb4[_0x5d04('0xb')]+_0x3bebb4[_0x5d04('0xc')]+_0x3bebb4[_0x5d04('0xd')];this[_0x5d04('0x9')]=_0x3bebb4[_0x5d04('0x9')];this[_0x5d04('0xa')]=_0x3bebb4[_0x5d04('0xa')];this[_0x5d04('0xb')]=_0x3bebb4['countabandonedretry'];this['countmachineretry']=_0x3bebb4[_0x5d04('0xc')];this[_0x5d04('0xd')]=_0x3bebb4[_0x5d04('0xd')];this[_0x5d04('0xe')]=_0x4a5948[_0x5d04('0xe')];this[_0x5d04('0xf')]=_0x3bebb4[_0x5d04('0x10')];this[_0x5d04('0x11')]=_0x3bebb4[_0x5d04('0x12')];this[_0x5d04('0x13')]=_0x3bebb4[_0x5d04('0x13')];this['responsetime']=_0x3bebb4[_0x5d04('0x14')];this[_0x5d04('0x15')]=_0x3bebb4[_0x5d04('0x15')];this[_0x5d04('0x16')]=_0x3bebb4['dropreason'];this[_0x5d04('0x17')]=this[_0x5d04('0x15')];this['ringtime']=utils[_0x5d04('0x18')](_0x3bebb4[_0x5d04('0x14')],_0x3bebb4['starttime']);this['holdtime']=utils[_0x5d04('0x18')](this[_0x5d04('0x15')],_0x3bebb4['responsetime']);this[_0x5d04('0x19')]=0x0;this[_0x5d04('0x4')]=_0x4a5948[_0x5d04('0x4')];this['membername']=_0x4a5948['connectedlinename'];this[_0x5d04('0x1a')]=_0x4a5948[_0x5d04('0x1a')];this['callback']=_0x3bebb4[_0x5d04('0x1b')];this[_0x5d04('0x1c')]=_0x3bebb4[_0x5d04('0x1c')];this[_0x5d04('0x1d')]=_0x3bebb4[_0x5d04('0x1d')];this[_0x5d04('0x1e')]=_0x3bebb4[_0x5d04('0x1e')];this[_0x5d04('0x1f')]=_0x3bebb4['ContactId'];this[_0x5d04('0x20')]=_0x3bebb4[_0x5d04('0x20')];this[_0x5d04('0x21')]=_0x3bebb4['UserId'];this[_0x5d04('0x22')]=_0x3bebb4[_0x5d04('0x22')];this['CampaignId']=_0x3bebb4['CampaignId'];this[_0x5d04('0x23')]=_0x3bebb4['originatecalleridnum']||'';this[_0x5d04('0x24')]=_0x3bebb4['originatecalleridname']||'';this[_0x5d04('0x25')]=_0x3bebb4['agiafterat'];this[_0x5d04('0x26')]=_0x3bebb4[_0x5d04('0x26')];this[_0x5d04('0x27')]=_0x3bebb4['statedesc'];}module[_0x5d04('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 118f668..6047f82 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0xb3b301,_0xbcc5c9){var _0x354665=function(_0x42c049){while(--_0x42c049){_0xb3b301['push'](_0xb3b301['shift']());}};_0x354665(++_0xbcc5c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0xacf940,_0x26e3ca){var _0x2af1bd=function(_0x9308e0){while(--_0x9308e0){_0xacf940['push'](_0xacf940['shift']());}};_0x2af1bd(++_0x26e3ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 7071c8d..903369b 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57af=['dialer','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','decrementOriginate','erlangb','checkContactLowerLimitOriginate','lodash','util','../../../../config/logger'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x57af,0x99));var _0xf57a=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x57af[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xf57a('0x0'));var moment=require('moment');var util=require(_0xf57a('0x1'));var logger=require(_0xf57a('0x2'))(_0xf57a('0x3'));var timezones=require('../../../../config/environment/shared')[_0xf57a('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xf57a('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xf57a('0x6'),'DEACTIVATED':_0xf57a('0x7'),'DISACTIVED':_0xf57a('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xf57a('0x9'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xf57a('0xa'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xf57a('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0xf57a('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xf57a('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xf57a('0xe'),'UNREACHABLE_TRUNK':_0xf57a('0xf')};exports[_0xf57a('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1dcbbf){return _0x1dcbbf[_0xf57a('0x11')]===_0xf57a('0x12');}exports[_0xf57a('0x13')]=isPreviewCampaign;function isIVRCampaign(_0xee31c6){return _0xee31c6[_0xf57a('0x14')]===_0xf57a('0x15');}exports[_0xf57a('0x16')]=isIVRCampaign;function isOutboundQueue(_0x3e28b0){return _0x3e28b0[_0xf57a('0x14')]===_0xf57a('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xc2aa89){return _0xc2aa89['dialActive'];}exports[_0xf57a('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x43bf58){return _0x43bf58[_0xf57a('0x19')];}exports[_0xf57a('0x1a')]=isIVRCampaignActive;function getSeconds(_0x16b550,_0x4130d9){var _0x300192=moment(_0x16b550)[_0xf57a('0x1b')](0x0);var _0x223276=moment(_0x4130d9)[_0xf57a('0x1b')](0x0);return _0x300192[_0xf57a('0x1c')](_0x223276,_0xf57a('0x1d'));}exports[_0xf57a('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x526f99,_0xbb6ef4){var _0x2661cc=![];var _0x5e8fce=_0x526f99[_0xf57a('0x11')]!==_0xbb6ef4[_0xf57a('0x11')]||_0x526f99[_0xf57a('0x1f')]!==_0xbb6ef4[_0xf57a('0x1f')]||_0x526f99[_0xf57a('0x20')]!==_0xbb6ef4[_0xf57a('0x20')];var _0xe88806=_0x526f99[_0xf57a('0x21')]!==_0xbb6ef4[_0xf57a('0x21')]||_0x526f99[_0xf57a('0x22')]!==_0xbb6ef4[_0xf57a('0x22')]||_0x526f99[_0xf57a('0x23')]!==_0xbb6ef4[_0xf57a('0x23')]||_0x526f99[_0xf57a('0x24')]!==_0xbb6ef4[_0xf57a('0x24')]||_0x526f99[_0xf57a('0x25')]!==_0xbb6ef4['talking']||_0x526f99[_0xf57a('0x26')]!==_0xbb6ef4[_0xf57a('0x26')]||_0x526f99[_0xf57a('0x27')]!==_0xbb6ef4[_0xf57a('0x27')]||_0x526f99[_0xf57a('0x28')]!==_0xbb6ef4[_0xf57a('0x28')]||_0x526f99[_0xf57a('0x29')]!==_0xbb6ef4[_0xf57a('0x29')];if(_0x526f99[_0xf57a('0x2a')]&&_0xbb6ef4[_0xf57a('0x2a')]){_0x2661cc=_0x526f99[_0xf57a('0x2a')][_0xf57a('0x2b')]!==_0xbb6ef4[_0xf57a('0x2a')][_0xf57a('0x2b')]||_0x526f99[_0xf57a('0x2a')][_0xf57a('0x19')]!==_0xbb6ef4[_0xf57a('0x2a')]['active'];}return _0x5e8fce||_0xe88806||_0x2661cc;}exports[_0xf57a('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2e012b){var _0x31ce95=null;var _0x55022e=_0x2e012b['dialTimezone'];if(_[_0xf57a('0x2d')](_0x2e012b[_0xf57a('0x2e')])||_[_0xf57a('0x2d')](_0x2e012b[_0xf57a('0x2f')])||_['isNil'](_0x2e012b[_0xf57a('0x2f')][_0xf57a('0x30')])){_0x31ce95=CAMPAIGN_STATUS[_0xf57a('0x31')];}else if(_[_0xf57a('0x32')](_0x2e012b[_0xf57a('0x2e')])||_[_0xf57a('0x32')](_0x2e012b[_0xf57a('0x2f')][_0xf57a('0x30')])){_0x31ce95=CAMPAIGN_STATUS[_0xf57a('0x33')];}else if(_0x55022e&&!timezones[_0x55022e]){_0x31ce95=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x31ce95;}function checkAnyValidTrunk(_0x422910,_0x1367c0){var _0xf0d5f5=null;var _0x342312=_0xf57a('0x34');var _0x107646=['reachable',_0xf57a('0x35')];var _0x34aaa8=!![];if(_0x422910[_0xf57a('0x2a')]&&_0x422910[_0xf57a('0x2a')][_0xf57a('0x19')]){_0x342312+=_0x422910[_0xf57a('0x2a')][_0xf57a('0x2b')];_0xf0d5f5=_0x1367c0[_0x342312];_0x34aaa8=_0x107646[_0xf57a('0x36')](_0xf0d5f5[_0xf57a('0x37')]);}else if(_0x422910[_0xf57a('0x38')]&&_0x422910[_0xf57a('0x38')]['active']){_0x342312+=_0x422910['TrunkBackup'][_0xf57a('0x2b')];_0xf0d5f5=_0x1367c0[_0x342312];_0x34aaa8=_0x107646[_0xf57a('0x36')](_0xf0d5f5[_0xf57a('0x37')]);}return _0x34aaa8;}function getQueueCampaignStatusMessage(_0x2c53fb,_0x489bdf){var _0x175e21=CAMPAIGN_STATUS[_0xf57a('0x5')];var _0x3cf789=isPreviewCampaign(_0x2c53fb);if(!isQueueCampaignActive(_0x2c53fb)){if(_0x3cf789){_0x175e21=CAMPAIGN_STATUS[_0xf57a('0x39')];}else{if(_0x2c53fb['originated']===0x0&&_0x2c53fb[_0xf57a('0x25')]===0x0&&_0x2c53fb[_0xf57a('0x27')]===0x0&&(_0x2c53fb['pTalking']||0x0)===0x0){_0x175e21=CAMPAIGN_STATUS['INACTIVE'];}else{_0x175e21=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2c53fb[_0xf57a('0x22')]===0x0){_0x175e21=CAMPAIGN_STATUS[_0xf57a('0x3a')];}else if(!checkAnyValidTrunk(_0x2c53fb,_0x489bdf)){_0x175e21=CAMPAIGN_STATUS[_0xf57a('0x3b')];}else if(!isPreviewCampaign(_0x2c53fb)){var _0x5a25c4=checkAnyValidQueueCampaignInterval(_0x2c53fb);if(_0x5a25c4){_0x175e21=_0x5a25c4;}}return _0x175e21;}exports[_0xf57a('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x335803){var _0x1c8da3=CAMPAIGN_STATUS[_0xf57a('0x3d')];if(_0x335803[_0xf57a('0x29')]===0x0&&_0x335803[_0xf57a('0x25')]===0x0&&_0x335803[_0xf57a('0x27')]===0x0&&(_0x335803[_0xf57a('0x26')]||0x0)===0x0){_0x1c8da3=CAMPAIGN_STATUS[_0xf57a('0x39')];}return _0x1c8da3;}exports[_0xf57a('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5e2099){var _0x30a78a=_0x5e2099['match'](/"(.*?)"/);return _0x30a78a?_0x30a78a[0x1]:_0x5e2099;}exports[_0xf57a('0x3f')]=extractCalleridName;function getCallerId(_0x5da7c7,_0x2b2115,_0x9a1277){if(!_[_0xf57a('0x40')](_0x9a1277)&&typeof _0x9a1277==='string'&&!_[_0xf57a('0x32')](_0x9a1277)){if(!_[_0xf57a('0x40')](_0x2b2115)&&typeof _0x2b2115===_0xf57a('0x41')&&!_[_0xf57a('0x32')](_0x2b2115)){return util['format'](_0xf57a('0x42'),_0x2b2115,_0x9a1277);}return util[_0xf57a('0x43')](_0xf57a('0x42'),_0x9a1277,_0x9a1277);}if(!_[_0xf57a('0x40')](_0x5da7c7)&&typeof _0x5da7c7===_0xf57a('0x41')&&!_[_0xf57a('0x32')](_0x5da7c7)){return _0x5da7c7;}return _0xf57a('0x44');}exports[_0xf57a('0x45')]=getCallerId;function getCallerIdRandom(_0x4191b1,_0xdee39){var _0x28805a;var _0x1a9bbe;var _0x3bd08;if(_0xdee39<=0x0){_0xdee39=0x1;}_0x28805a=new RegExp(_0xf57a('0x46')+_0xdee39+'}$');_0x1a9bbe=Math[_0xf57a('0x47')](0xa,_0xdee39-0x1);_0x3bd08=Math[_0xf57a('0x47')](0xa,_0xdee39)-0x1;return util['format']('%s',_[_0xf57a('0x48')](_0x4191b1,_0x28805a,_['random'](_0x1a9bbe,_0x3bd08)[_0xf57a('0x49')]()));}exports[_0xf57a('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x505878){if(_0x505878[_0xf57a('0x29')]&&_0x505878[_0xf57a('0x29')]>0x0){_0x505878[_0xf57a('0x29')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xf57a('0x4b')]=decrementOriginate;function checkContactEmpty(_0x5b528e){return _0x5b528e&&_0x5b528e['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x33dba1,_0x2b4996){if(_0x2b4996===0x0){return 0x0;}var _0x2b5a0a=0x1;for(var _0x38add4=0x1;_0x38add4<=_0x2b4996;_0x38add4+=0x1){_0x2b5a0a=0x1+_0x2b5a0a*_0x38add4/_0x33dba1;}return 0x1/_0x2b5a0a;}exports[_0xf57a('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x433e18,_0x1d0f10,_0x2fae96){if(_0x1d0f10>_0x2fae96){for(var _0xd4b74a=0x0;_0xd4b74a<_0x1d0f10-_0x2fae96;_0xd4b74a+=0x1){decrementOriginate(_0x433e18);}}}exports[_0xf57a('0x4d')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xaca8=['AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','decrementOriginate','length','checkContactLowerLimitOriginate','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','AGENTS_NOT_LOGGED'];(function(_0x102ae8,_0x4a19c3){var _0x5a5486=function(_0x9c8f30){while(--_0x9c8f30){_0x102ae8['push'](_0x102ae8['shift']());}};_0x5a5486(++_0x4a19c3);}(_0xaca8,0x17d));var _0x8aca=function(_0x149fda,_0x489a55){_0x149fda=_0x149fda-0x0;var _0x3790d9=_0xaca8[_0x149fda];return _0x3790d9;};'use strict';var _=require('lodash');var moment=require(_0x8aca('0x0'));var util=require(_0x8aca('0x1'));var logger=require(_0x8aca('0x2'))(_0x8aca('0x3'));var timezones=require(_0x8aca('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x8aca('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x8aca('0x6'),'DEACTIVATED':_0x8aca('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x8aca('0x8'),'NO_AVAILABLE_CONTACTS':_0x8aca('0x9'),'NULL_INTERVAL':_0x8aca('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x8aca('0xb'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x8aca('0xc'),'UNKNOWN_TIMEZONE':_0x8aca('0xd'),'UNREACHABLE_TRUNK':_0x8aca('0xe')};exports[_0x8aca('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3b97fd){return _0x3b97fd[_0x8aca('0x10')]===_0x8aca('0x11');}exports[_0x8aca('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x558b50){return _0x558b50[_0x8aca('0x13')]===_0x8aca('0x14');}exports[_0x8aca('0x15')]=isIVRCampaign;function isOutboundQueue(_0x3b9c4d){return _0x3b9c4d[_0x8aca('0x13')]===_0x8aca('0x16');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x3772bf){return _0x3772bf[_0x8aca('0x17')];}exports[_0x8aca('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x257c9b){return _0x257c9b[_0x8aca('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x33ef5c,_0x3d68eb){var _0x42b698=moment(_0x33ef5c)[_0x8aca('0x1a')](0x0);var _0x560f47=moment(_0x3d68eb)['milliseconds'](0x0);return _0x42b698[_0x8aca('0x1b')](_0x560f47,_0x8aca('0x1c'));}exports[_0x8aca('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x41cfc7,_0x4f0255){var _0x3ca5ff=![];var _0x2601c0=_0x41cfc7[_0x8aca('0x10')]!==_0x4f0255[_0x8aca('0x10')]||_0x41cfc7[_0x8aca('0x17')]!==_0x4f0255[_0x8aca('0x17')]||_0x41cfc7[_0x8aca('0x1e')]!==_0x4f0255[_0x8aca('0x1e')];var _0x120a4d=_0x41cfc7[_0x8aca('0x1f')]!==_0x4f0255[_0x8aca('0x1f')]||_0x41cfc7[_0x8aca('0x20')]!==_0x4f0255[_0x8aca('0x20')]||_0x41cfc7[_0x8aca('0x21')]!==_0x4f0255['loggedInDb']||_0x41cfc7['paused']!==_0x4f0255[_0x8aca('0x22')]||_0x41cfc7[_0x8aca('0x23')]!==_0x4f0255[_0x8aca('0x23')]||_0x41cfc7[_0x8aca('0x24')]!==_0x4f0255[_0x8aca('0x24')]||_0x41cfc7[_0x8aca('0x25')]!==_0x4f0255[_0x8aca('0x25')]||_0x41cfc7[_0x8aca('0x26')]!==_0x4f0255[_0x8aca('0x26')]||_0x41cfc7[_0x8aca('0x27')]!==_0x4f0255[_0x8aca('0x27')];if(_0x41cfc7[_0x8aca('0x28')]&&_0x4f0255['Trunk']){_0x3ca5ff=_0x41cfc7[_0x8aca('0x28')][_0x8aca('0x29')]!==_0x4f0255['Trunk'][_0x8aca('0x29')]||_0x41cfc7[_0x8aca('0x28')][_0x8aca('0x19')]!==_0x4f0255[_0x8aca('0x28')][_0x8aca('0x19')];}return _0x2601c0||_0x120a4d||_0x3ca5ff;}exports[_0x8aca('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x25c4c5){var _0x47475d=null;var _0x1812f1=_0x25c4c5[_0x8aca('0x2b')];if(_[_0x8aca('0x2c')](_0x25c4c5[_0x8aca('0x2d')])||_[_0x8aca('0x2c')](_0x25c4c5[_0x8aca('0x2e')])||_[_0x8aca('0x2c')](_0x25c4c5[_0x8aca('0x2e')][_0x8aca('0x2f')])){_0x47475d=CAMPAIGN_STATUS[_0x8aca('0x30')];}else if(_['isEmpty'](_0x25c4c5[_0x8aca('0x2d')])||_[_0x8aca('0x31')](_0x25c4c5[_0x8aca('0x2e')][_0x8aca('0x2f')])){_0x47475d=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1812f1&&!timezones[_0x1812f1]){_0x47475d=CAMPAIGN_STATUS[_0x8aca('0x32')];}return _0x47475d;}function checkAnyValidTrunk(_0x57cfab,_0x36e0c7){var _0x471e5b=null;var _0xf5a4a0=_0x8aca('0x33');var _0x2d3817=[_0x8aca('0x34'),_0x8aca('0x35')];var _0x217c15=!![];if(_0x57cfab['Trunk']&&_0x57cfab[_0x8aca('0x28')][_0x8aca('0x19')]){_0xf5a4a0+=_0x57cfab['Trunk'][_0x8aca('0x29')];_0x471e5b=_0x36e0c7[_0xf5a4a0];_0x217c15=_0x2d3817[_0x8aca('0x36')](_0x471e5b[_0x8aca('0x37')]);}else if(_0x57cfab['TrunkBackup']&&_0x57cfab[_0x8aca('0x38')][_0x8aca('0x19')]){_0xf5a4a0+=_0x57cfab['TrunkBackup'][_0x8aca('0x29')];_0x471e5b=_0x36e0c7[_0xf5a4a0];_0x217c15=_0x2d3817['includes'](_0x471e5b[_0x8aca('0x37')]);}return _0x217c15;}function getQueueCampaignStatusMessage(_0x112931,_0xdd1db3){var _0x6c5047=CAMPAIGN_STATUS['ACTIVE'];var _0x1e6e69=isPreviewCampaign(_0x112931);if(!isQueueCampaignActive(_0x112931)){if(_0x1e6e69){_0x6c5047=CAMPAIGN_STATUS[_0x8aca('0x39')];}else{if(_0x112931[_0x8aca('0x27')]===0x0&&_0x112931[_0x8aca('0x23')]===0x0&&_0x112931[_0x8aca('0x25')]===0x0&&(_0x112931[_0x8aca('0x24')]||0x0)===0x0){_0x6c5047=CAMPAIGN_STATUS['INACTIVE'];}else{_0x6c5047=CAMPAIGN_STATUS[_0x8aca('0x3a')];}}}else if(_0x112931[_0x8aca('0x20')]===0x0){_0x6c5047=CAMPAIGN_STATUS[_0x8aca('0x3b')];}else if(!checkAnyValidTrunk(_0x112931,_0xdd1db3)){_0x6c5047=CAMPAIGN_STATUS[_0x8aca('0x3c')];}else if(!isPreviewCampaign(_0x112931)){var _0x566bc3=checkAnyValidQueueCampaignInterval(_0x112931);if(_0x566bc3){_0x6c5047=_0x566bc3;}}return _0x6c5047;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3337d3){var _0x431457=CAMPAIGN_STATUS['DISACTIVED'];if(_0x3337d3[_0x8aca('0x27')]===0x0&&_0x3337d3['talking']===0x0&&_0x3337d3['waiting']===0x0&&(_0x3337d3[_0x8aca('0x24')]||0x0)===0x0){_0x431457=CAMPAIGN_STATUS[_0x8aca('0x39')];}return _0x431457;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x48431d){var _0x5bbac4=_0x48431d[_0x8aca('0x3d')](/"(.*?)"/);return _0x5bbac4?_0x5bbac4[0x1]:_0x48431d;}exports[_0x8aca('0x3e')]=extractCalleridName;function getCallerId(_0x409cea,_0x4f148c,_0x281f83){if(!_[_0x8aca('0x3f')](_0x281f83)&&typeof _0x281f83==='string'&&!_[_0x8aca('0x31')](_0x281f83)){if(!_[_0x8aca('0x3f')](_0x4f148c)&&typeof _0x4f148c===_0x8aca('0x40')&&!_['isEmpty'](_0x4f148c)){return util['format'](_0x8aca('0x41'),_0x4f148c,_0x281f83);}return util[_0x8aca('0x42')](_0x8aca('0x41'),_0x281f83,_0x281f83);}if(!_[_0x8aca('0x3f')](_0x409cea)&&typeof _0x409cea===_0x8aca('0x40')&&!_[_0x8aca('0x31')](_0x409cea)){return _0x409cea;}return _0x8aca('0x43');}exports[_0x8aca('0x44')]=getCallerId;function getCallerIdRandom(_0x400c3d,_0x597e6c){var _0x2ce4d1;var _0x491e2e;var _0x4c439e;if(_0x597e6c<=0x0){_0x597e6c=0x1;}_0x2ce4d1=new RegExp(_0x8aca('0x45')+_0x597e6c+'}$');_0x491e2e=Math[_0x8aca('0x46')](0xa,_0x597e6c-0x1);_0x4c439e=Math[_0x8aca('0x46')](0xa,_0x597e6c)-0x1;return util[_0x8aca('0x42')]('%s',_[_0x8aca('0x47')](_0x400c3d,_0x2ce4d1,_[_0x8aca('0x48')](_0x491e2e,_0x4c439e)[_0x8aca('0x49')]()));}exports[_0x8aca('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x4348fd){if(_0x4348fd[_0x8aca('0x27')]&&_0x4348fd[_0x8aca('0x27')]>0x0){_0x4348fd['originated']-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x8aca('0x4b')]=decrementOriginate;function checkContactEmpty(_0x3697f0){return _0x3697f0&&_0x3697f0[_0x8aca('0x4c')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x3b02d4,_0x33e09f){if(_0x33e09f===0x0){return 0x0;}var _0x56df67=0x1;for(var _0x10d95c=0x1;_0x10d95c<=_0x33e09f;_0x10d95c+=0x1){_0x56df67=0x1+_0x56df67*_0x10d95c/_0x3b02d4;}return 0x1/_0x56df67;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x1eee1d,_0xd0e5f,_0x189243){if(_0xd0e5f>_0x189243){for(var _0x170fdb=0x0;_0x170fdb<_0xd0e5f-_0x189243;_0x170fdb+=0x1){decrementOriginate(_0x1eee1d);}}}exports[_0x8aca('0x4d')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f75d61d..30da419 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x1b2f84,_0x21951c){var _0x2e2f25=function(_0xc80e8e){while(--_0xc80e8e){_0x1b2f84['push'](_0x1b2f84['shift']());}};_0x2e2f25(++_0x21951c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4a1701,_0x313a9f){var _0x90a62f=function(_0x423592){while(--_0x423592){_0x4a1701['push'](_0x4a1701['shift']());}};_0x90a62f(++_0x313a9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0104caf..d8a46e2 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 _0x0b81=['isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','fax','catch','error','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','execute','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables'];(function(_0x223354,_0x590668){var _0x34475a=function(_0x535e10){while(--_0x535e10){_0x223354['push'](_0x223354['shift']());}};_0x34475a(++_0x590668);}(_0x0b81,0x1db));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x10b8('0x0'));var _=require(_0x10b8('0x1'));var BPromise=require(_0x10b8('0x2'));var uuid=require(_0x10b8('0x3'));var moment=require(_0x10b8('0x4'));var path=require(_0x10b8('0x5'));var tiff2pdf=require(_0x10b8('0x6'));var gs=require(_0x10b8('0x7'));var logger=require(_0x10b8('0x8'))('fax');var ami=require('../ami');var rpcDb=require(_0x10b8('0x9'));var Channel=require(_0x10b8('0xa'));var ut=require(_0x10b8('0xb'));var Action=require(_0x10b8('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x10b8('0xd'));function Fax(_0x22e978){this[_0x10b8('0xe')]={};this[_0x10b8('0xf')]=_0x22e978[_0x10b8('0xf')];this[_0x10b8('0x10')]=_0x22e978[_0x10b8('0x10')];this[_0x10b8('0x11')]={};ami['on'](_0x10b8('0x12'),this[_0x10b8('0x13')][_0x10b8('0x14')](this));ami['on']('varset',this[_0x10b8('0x15')][_0x10b8('0x14')](this));ami['on'](_0x10b8('0x16'),this[_0x10b8('0x17')][_0x10b8('0x14')](this));ami['on'](_0x10b8('0x18'),this['syncNewExten'][_0x10b8('0x14')](this));ami['on'](_0x10b8('0x19'),this[_0x10b8('0x1a')][_0x10b8('0x14')](this));ami['on']('receivefax',this[_0x10b8('0x1b')][_0x10b8('0x14')](this));ami['on'](_0x10b8('0x1c'),this[_0x10b8('0x1d')][_0x10b8('0x14')](this));ami['on'](_0x10b8('0x1e'),this['syncOriginateResponse'][_0x10b8('0x14')](this));}Fax[_0x10b8('0x1f')][_0x10b8('0x13')]=function(_0x3f8a48){if(_0x3f8a48[_0x10b8('0x20')]===_0x10b8('0x21')){for(var _0x58106c in this[_0x10b8('0xf')]){if(this[_0x10b8('0xf')]['hasOwnProperty'](_0x58106c)){if(_0x3f8a48[_0x10b8('0x22')]===this[_0x10b8('0xf')][_0x58106c][_0x10b8('0x23')]){this['channels'][_0x3f8a48['uniqueid']]={};this['channels'][_0x3f8a48[_0x10b8('0x24')]][_0x10b8('0x25')]=_0x3f8a48['channel'];this[_0x10b8('0xe')][_0x3f8a48[_0x10b8('0x24')]]['id']=this['faxAccounts'][_0x58106c]['id'];this[_0x10b8('0xe')][_0x3f8a48[_0x10b8('0x24')]][_0x10b8('0x26')]=this[_0x10b8('0xf')][_0x58106c][_0x10b8('0x26')];logger['info'](_0x3f8a48[_0x10b8('0x24')],_0x10b8('0x27'));}}}}if(this[_0x10b8('0x11')][_0x3f8a48[_0x10b8('0x24')]]){this['channels'][_0x3f8a48[_0x10b8('0x24')]]={};this['channels'][_0x3f8a48[_0x10b8('0x24')]][_0x10b8('0x25')]=_0x3f8a48['channel'];logger[_0x10b8('0x28')](_0x3f8a48[_0x10b8('0x24')],_0x10b8('0x27'));}};Fax[_0x10b8('0x1f')][_0x10b8('0x15')]=function(_0x5b32ed){if(this[_0x10b8('0xe')][_0x5b32ed[_0x10b8('0x24')]]){for(var _0x24fe0f in _0x5b32ed[_0x10b8('0x29')]){if(_0x5b32ed['variable']['hasOwnProperty'](_0x24fe0f)){this['channels'][_0x5b32ed[_0x10b8('0x24')]][_0x24fe0f]=_0x5b32ed[_0x10b8('0x2a')];}}}};Fax[_0x10b8('0x1f')][_0x10b8('0x17')]=function(_0x2ce332){if(this['channels'][_0x2ce332[_0x10b8('0x24')]]){this[_0x10b8('0xe')][_0x2ce332[_0x10b8('0x24')]][_0x10b8('0x2b')]=_0x2ce332[_0x10b8('0x2b')];this['channels'][_0x2ce332[_0x10b8('0x24')]][_0x10b8('0x2c')]=_0x2ce332[_0x10b8('0x2c')];}};Fax[_0x10b8('0x1f')]['syncNewExten']=function(_0x4024da){if(this[_0x10b8('0xe')][_0x4024da['uniqueid']]){for(var _0x4bf568 in _0x4024da[_0x10b8('0x29')]){if(_0x4024da['variable'][_0x10b8('0x2d')](_0x4bf568)){this[_0x10b8('0xe')][_0x4024da[_0x10b8('0x24')]][_0x4bf568]=_0x4024da[_0x10b8('0x2a')];}}}};Fax['prototype'][_0x10b8('0x1a')]=function(_0x184d40){if(this[_0x10b8('0xe')][_0x184d40['uniqueid']]){this[_0x10b8('0xe')][_0x184d40[_0x10b8('0x24')]]['operation']=_0x184d40[_0x10b8('0x2e')];this['channels'][_0x184d40[_0x10b8('0x24')]][_0x10b8('0x2f')]=_0x184d40[_0x10b8('0x2f')];this[_0x10b8('0xe')][_0x184d40[_0x10b8('0x24')]]['localstationid']=_0x184d40[_0x10b8('0x23')];this[_0x10b8('0xe')][_0x184d40[_0x10b8('0x24')]][_0x10b8('0x30')]=_0x184d40[_0x10b8('0x30')];logger[_0x10b8('0x28')](_0x184d40[_0x10b8('0x24')],_0x10b8('0x31'));}};Fax[_0x10b8('0x1f')][_0x10b8('0x1b')]=function(_0x5b71f3){var _0x1a06ef=this;if(this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]]){var _0x527eae=this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]]['id'];this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x32')]=_0x5b71f3[_0x10b8('0x32')];this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x33')]=_0x5b71f3[_0x10b8('0x33')];this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x23')]=_0x5b71f3[_0x10b8('0x23')];this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x34')]=_0x5b71f3['resolution'];this[_0x10b8('0xe')][_0x5b71f3['uniqueid']][_0x10b8('0x35')]=_0x5b71f3[_0x10b8('0x35')];this['channels'][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x30')]=_0x5b71f3[_0x10b8('0x30')];this[_0x10b8('0xe')][_0x5b71f3[_0x10b8('0x24')]][_0x10b8('0x36')]=_0x5b71f3['calleridnum'];if(this['channels'][_0x5b71f3['uniqueid']][_0x10b8('0x33')]>0x0){tiff2pdf(_0x5b71f3[_0x10b8('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x432947){logger[_0x10b8('0x28')](_0x5b71f3[_0x10b8('0x24')],_0x10b8('0x37'),_0x432947['message']);attachment[_0x10b8('0x38')]({'name':path['parse'](_0x5b71f3['filename'])['name'],'basename':path[_0x10b8('0x39')](_0x5b71f3[_0x10b8('0x30')])[_0x10b8('0x26')]+_0x10b8('0x3a'),'type':_0x10b8('0x3b')})[_0x10b8('0x3c')](function(_0x203586){faxAccount['notify'](_0x527eae,{'from':_0x5b71f3[_0x10b8('0x36')],'mapKey':_0x10b8('0x3d'),'body':path[_0x10b8('0x39')](_0x5b71f3[_0x10b8('0x30')])[_0x10b8('0x26')]+_0x10b8('0x3a'),'AttachmentId':_0x203586['id']})[_0x10b8('0x3e')](function(_0x159b76){logger[_0x10b8('0x3f')](_0x5b71f3['uniqueid'],'\x20notify\x20',JSON[_0x10b8('0x40')](_0x159b76));});})['catch'](function(_0xd512c0){logger[_0x10b8('0x3f')](_0x5b71f3[_0x10b8('0x24')],_0x10b8('0x41'),JSON['stringify'](_0xd512c0));});});}logger[_0x10b8('0x28')](_0x5b71f3[_0x10b8('0x24')],_0x10b8('0x41'));}};Fax[_0x10b8('0x1f')][_0x10b8('0x42')]=function(_0x169401){if(this[_0x10b8('0x11')][_0x169401[_0x10b8('0x24')]]){_[_0x10b8('0x43')](this[_0x10b8('0xe')][_0x169401[_0x10b8('0x24')]],_[_0x10b8('0x44')](_0x169401,[_0x10b8('0x45'),_0x10b8('0x46')]));}};function updateStatus(_0x371a78){if(_0x371a78[_0x10b8('0x47')]){faxMessage[_0x10b8('0x48')](_0x371a78[_0x10b8('0x47')],{'failMessage':_0x10b8('0x49')})[_0x10b8('0x3c')](function(_0x3b88f8){ut[_0x10b8('0x4a')](_0x10b8('0x4b'),_0x3b88f8);})[_0x10b8('0x3e')](function(_0x2d3e3c){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x2d3e3c);});}else{ut[_0x10b8('0x4a')](_0x10b8('0x4c'));}}Fax[_0x10b8('0x1f')][_0x10b8('0x4d')]=function(_0x46b212,_0x509faf,_0x5df8de){var _0x293309=this;var _0x24b181={};if(_0x509faf){_0x24b181={'read':_0x509faf};}else{_0x24b181={'failMessage':_0x5df8de};}if(this[_0x10b8('0x11')][_0x46b212][_0x10b8('0x47')]){faxMessage[_0x10b8('0x48')](this[_0x10b8('0x11')][_0x46b212][_0x10b8('0x47')],_0x24b181)[_0x10b8('0x3c')](function(_0x251a5d){ut[_0x10b8('0x4a')](_0x10b8('0x4e'),_0x251a5d);})['catch'](function(_0x4e1e75){ut['logger']('[Fax][Message][NoUpdate1]',_0x4e1e75);})[_0x10b8('0x4f')](function(){delete _0x293309[_0x10b8('0xe')][_0x46b212];delete _0x293309['actions'][_0x46b212];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x10b8('0xe')][_0x46b212];delete this[_0x10b8('0x11')][_0x46b212];}};Fax['prototype'][_0x10b8('0x1d')]=function(_0x490609){var _0x2aec85=this;if(this[_0x10b8('0xe')][_0x490609[_0x10b8('0x24')]]){if(this[_0x10b8('0x11')][_0x490609[_0x10b8('0x24')]]){this['channels'][_0x490609[_0x10b8('0x24')]]['id']=this['actions'][_0x490609[_0x10b8('0x24')]]['id'];this[_0x10b8('0xe')][_0x490609[_0x10b8('0x24')]]['name']=this[_0x10b8('0x11')][_0x490609['uniqueid']][_0x10b8('0x26')];}logger[_0x10b8('0x28')](_0x490609[_0x10b8('0x24')],this[_0x10b8('0x11')][_0x490609[_0x10b8('0x24')]]?_0x10b8('0x50'):_0x10b8('0x51'),JSON[_0x10b8('0x40')](this[_0x10b8('0xe')][_0x490609['uniqueid']]));if(this['actions'][_0x490609[_0x10b8('0x24')]]){if(this[_0x10b8('0xe')][_0x490609[_0x10b8('0x24')]][_0x10b8('0x52')]>0x0&&this['channels'][_0x490609['uniqueid']]['faxstatus']===_0x10b8('0x53')){this[_0x10b8('0x4d')](_0x490609[_0x10b8('0x24')],!![]);}else{this[_0x10b8('0x4d')](_0x490609[_0x10b8('0x24')],![],this[_0x10b8('0xe')][_0x490609[_0x10b8('0x24')]][_0x10b8('0x54')]?_0x10b8('0x55')+this[_0x10b8('0xe')][_0x490609[_0x10b8('0x24')]]['faxstatusstring']:_0x10b8('0x56'));}}}};Fax[_0x10b8('0x1f')][_0x10b8('0x57')]=function(_0x558b61){var _0x3f5f61=this;return new BPromise(function(_0x1adb8f,_0x280c36){_0x3f5f61[_0x10b8('0x58')](_0x558b61,_0x3f5f61[_0x10b8('0xf')][_0x558b61[_0x10b8('0x59')]])[_0x10b8('0x3c')](function(_0x31b53c){ut[_0x10b8('0x4a')](_0x10b8('0x5a'),_0x31b53c);_0x1adb8f(ut[_0x10b8('0x5b')](_0x10b8('0x5c')));})['catch'](function(_0x3c7163){ut[_0x10b8('0x4a')](_0x10b8('0x5d'),_0x3c7163);updateStatus(_0x558b61);_0x280c36(ut['message'](_0x10b8('0x5e')));});});};Fax['prototype'][_0x10b8('0x5f')]=function(_0x2c0335){var _0x2e1687=this;return new BPromise(function(_0x4c710d,_0x348052){var _0x327264=_0x2e1687[_0x10b8('0x60')](_0x2e1687[_0x10b8('0xf')][_0x2c0335['FaxAccountId']][_0x10b8('0x61')],_0x2c0335);if(_0x327264['isValid']){_0x4c710d(ut[_0x10b8('0x5b')](_0x10b8('0x62')));}else{_0x348052(ut[_0x10b8('0x5b')](_0x327264[_0x10b8('0x5b')]));}});};function originate(_0x1b07e8,_0x1ac79c,_0x5c8ae9){return new BPromise(function(_0x20e9ce,_0x43619f){if(_0x5c8ae9){var _0x5a923d=util[_0x10b8('0x63')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x1b07e8['path'])[_0x10b8('0x26')],_0x1b07e8['path']);gs[_0x10b8('0x64')](_0x5a923d)[_0x10b8('0x3c')](function(){_0x1b07e8[_0x10b8('0x5')]=util['format']('%s/%s.tif',path['parse'](_0x1b07e8[_0x10b8('0x5')])['dir'],path[_0x10b8('0x39')](_0x1b07e8[_0x10b8('0x5')])['name']);_0x1ac79c['XMF-PATH']=_0x1b07e8[_0x10b8('0x5')];ut[_0x10b8('0x4a')](_0x10b8('0x65'),'');ami['Action'](ut[_0x10b8('0x66')](_0x1b07e8,_0x1ac79c))[_0x10b8('0x3c')](function(_0x3807b6){_0x20e9ce(_0x3807b6);})['catch'](function(_0x1c80a9){_0x43619f(_0x1c80a9);});})[_0x10b8('0x3e')](function(_0x4ec430){_0x43619f(_0x4ec430);});}else{ami[_0x10b8('0x67')](ut[_0x10b8('0x66')](_0x1b07e8,_0x1ac79c))['then'](function(_0x5475b1){_0x20e9ce(_0x5475b1);})['catch'](function(_0x421876){_0x43619f(_0x421876);});}});}Fax[_0x10b8('0x1f')][_0x10b8('0x58')]=function(_0x517a72,_0x254e15){var _0x2fb266=this;return new BPromise(function(_0x5a6d6e,_0x223bae){var _0x5e92ca=uuid['v4']();var _0x373638=ut[_0x10b8('0x68')](_0x517a72,_0x254e15);_0x2fb266[_0x10b8('0x11')][_0x5e92ca]=new Action(_0x5e92ca,_0x254e15,_0x517a72);var _0x25c09a=_0x2fb266['actions'][_0x5e92ca];if(path[_0x10b8('0x39')](_0x517a72[_0x10b8('0x5')])['ext']===_0x10b8('0x3a')){originate(_0x25c09a,_0x373638,!![])['then'](function(_0x3f2d24){_0x5a6d6e(_0x3f2d24);})[_0x10b8('0x3e')](function(_0x20ba73){_0x223bae(_0x20ba73);});}else{originate(_0x25c09a,_0x373638,![])['then'](function(_0x5bc621){_0x5a6d6e(_0x5bc621);})[_0x10b8('0x3e')](function(_0x201b66){_0x223bae(_0x201b66);});}});};Fax[_0x10b8('0x1f')]['isTrunkReachable']=function(_0x2028f7){return!_[_0x10b8('0x69')](_0x2028f7)&&!_[_0x10b8('0x69')](_0x2028f7['name'])&&!_['isNil'](_0x2028f7['active'])&&_0x2028f7[_0x10b8('0x6a')]&&!_['isNil'](this[_0x10b8('0x10')][util['format']('SIP/%s',_0x2028f7[_0x10b8('0x26')])])&&!_[_0x10b8('0x69')](this[_0x10b8('0x10')][util[_0x10b8('0x63')]('SIP/%s',_0x2028f7[_0x10b8('0x26')])][_0x10b8('0x2f')])&&(this[_0x10b8('0x10')][util[_0x10b8('0x63')](_0x10b8('0x6b'),_0x2028f7[_0x10b8('0x26')])]['status']==='reachable'||this[_0x10b8('0x10')][util[_0x10b8('0x63')](_0x10b8('0x6b'),_0x2028f7[_0x10b8('0x26')])][_0x10b8('0x2f')]===_0x10b8('0x6c'));};Fax[_0x10b8('0x1f')][_0x10b8('0x60')]=function(_0x2cb12b,_0x10c625){if(!this[_0x10b8('0x6d')](_0x2cb12b)){ut[_0x10b8('0x4a')](_0x10b8('0x6e'),_[_0x10b8('0x69')](_0x2cb12b)?'':_0x2cb12b[_0x10b8('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x10b8('0x6f')};}if(_[_0x10b8('0x69')](_0x10c625[_0x10b8('0x3d')])){ut['logger'](_0x10b8('0x70'),JSON[_0x10b8('0x40')](_0x10c625));return{'isValid':![],'message':_0x10b8('0x71')};}if(_[_0x10b8('0x69')](_0x10c625['path'])){ut[_0x10b8('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x10b8('0x40')](_0x10c625));return{'isValid':![],'message':_0x10b8('0x72')};}return{'isValid':!![],'message':_0x10b8('0x73')};};module['exports']=Fax; \ No newline at end of file +var _0x463e=['Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','format','execute','%s/%s.tif','dir'];(function(_0x5e388f,_0x5c76ed){var _0x2c1112=function(_0x4b20d2){while(--_0x4b20d2){_0x5e388f['push'](_0x5e388f['shift']());}};_0x2c1112(++_0x5c76ed);}(_0x463e,0x87));var _0xe463=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x463e[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xe463('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xe463('0x1'));var moment=require(_0xe463('0x2'));var path=require(_0xe463('0x3'));var tiff2pdf=require(_0xe463('0x4'));var gs=require(_0xe463('0x5'));var logger=require(_0xe463('0x6'))(_0xe463('0x7'));var ami=require(_0xe463('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xe463('0x9'));var ut=require(_0xe463('0xa'));var Action=require(_0xe463('0xb'));var faxAccount=require(_0xe463('0xc'));var attachment=require(_0xe463('0xd'));var faxMessage=require(_0xe463('0xe'));function Fax(_0x38a66d){this[_0xe463('0xf')]={};this[_0xe463('0x10')]=_0x38a66d['faxAccounts'];this[_0xe463('0x11')]=_0x38a66d[_0xe463('0x11')];this[_0xe463('0x12')]={};ami['on'](_0xe463('0x13'),this[_0xe463('0x14')][_0xe463('0x15')](this));ami['on'](_0xe463('0x16'),this['syncVarSet'][_0xe463('0x15')](this));ami['on'](_0xe463('0x17'),this[_0xe463('0x18')]['bind'](this));ami['on'](_0xe463('0x19'),this['syncNewExten'][_0xe463('0x15')](this));ami['on']('faxstatus',this[_0xe463('0x1a')][_0xe463('0x15')](this));ami['on'](_0xe463('0x1b'),this[_0xe463('0x1c')][_0xe463('0x15')](this));ami['on'](_0xe463('0x1d'),this[_0xe463('0x1e')]['bind'](this));ami['on'](_0xe463('0x1f'),this[_0xe463('0x20')]['bind'](this));}Fax[_0xe463('0x21')][_0xe463('0x14')]=function(_0x4190d6){if(_0x4190d6[_0xe463('0x22')]===_0xe463('0x23')){for(var _0x117788 in this['faxAccounts']){if(this[_0xe463('0x10')][_0xe463('0x24')](_0x117788)){if(_0x4190d6[_0xe463('0x25')]===this[_0xe463('0x10')][_0x117788]['localstationid']){this[_0xe463('0xf')][_0x4190d6[_0xe463('0x26')]]={};this[_0xe463('0xf')][_0x4190d6['uniqueid']][_0xe463('0x27')]=_0x4190d6[_0xe463('0x27')];this['channels'][_0x4190d6['uniqueid']]['id']=this[_0xe463('0x10')][_0x117788]['id'];this[_0xe463('0xf')][_0x4190d6['uniqueid']][_0xe463('0x28')]=this['faxAccounts'][_0x117788][_0xe463('0x28')];logger[_0xe463('0x29')](_0x4190d6['uniqueid'],_0xe463('0x2a'));}}}}if(this[_0xe463('0x12')][_0x4190d6[_0xe463('0x26')]]){this[_0xe463('0xf')][_0x4190d6[_0xe463('0x26')]]={};this[_0xe463('0xf')][_0x4190d6[_0xe463('0x26')]]['channel']=_0x4190d6[_0xe463('0x27')];logger['info'](_0x4190d6['uniqueid'],_0xe463('0x2a'));}};Fax[_0xe463('0x21')]['syncVarSet']=function(_0x5e18bf){if(this[_0xe463('0xf')][_0x5e18bf[_0xe463('0x26')]]){for(var _0x5ac678 in _0x5e18bf[_0xe463('0x2b')]){if(_0x5e18bf[_0xe463('0x2b')]['hasOwnProperty'](_0x5ac678)){this['channels'][_0x5e18bf[_0xe463('0x26')]][_0x5ac678]=_0x5e18bf[_0xe463('0x2c')];}}}};Fax['prototype']['syncNewState']=function(_0x13aa2f){if(this[_0xe463('0xf')][_0x13aa2f[_0xe463('0x26')]]){this[_0xe463('0xf')][_0x13aa2f['uniqueid']][_0xe463('0x2d')]=_0x13aa2f['channelstate'];this[_0xe463('0xf')][_0x13aa2f[_0xe463('0x26')]]['channelstatedesc']=_0x13aa2f['channelstatedesc'];}};Fax[_0xe463('0x21')][_0xe463('0x2e')]=function(_0xa9fb80){if(this['channels'][_0xa9fb80[_0xe463('0x26')]]){for(var _0x354bd6 in _0xa9fb80[_0xe463('0x2b')]){if(_0xa9fb80['variable'][_0xe463('0x24')](_0x354bd6)){this[_0xe463('0xf')][_0xa9fb80['uniqueid']][_0x354bd6]=_0xa9fb80[_0xe463('0x2c')];}}}};Fax['prototype'][_0xe463('0x1a')]=function(_0x5f29be){if(this[_0xe463('0xf')][_0x5f29be[_0xe463('0x26')]]){this[_0xe463('0xf')][_0x5f29be[_0xe463('0x26')]][_0xe463('0x2f')]=_0x5f29be['operation'];this[_0xe463('0xf')][_0x5f29be[_0xe463('0x26')]][_0xe463('0x30')]=_0x5f29be['status'];this[_0xe463('0xf')][_0x5f29be['uniqueid']][_0xe463('0x31')]=_0x5f29be[_0xe463('0x31')];this['channels'][_0x5f29be[_0xe463('0x26')]][_0xe463('0x32')]=_0x5f29be[_0xe463('0x32')];logger[_0xe463('0x29')](_0x5f29be[_0xe463('0x26')],_0xe463('0x33'));}};Fax['prototype'][_0xe463('0x1c')]=function(_0x255d76){var _0x377fb0=this;if(this['channels'][_0x255d76[_0xe463('0x26')]]){var _0xfb72da=this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]]['id'];this['channels'][_0x255d76[_0xe463('0x26')]]['remotestationid']=_0x255d76[_0xe463('0x34')];this['channels'][_0x255d76[_0xe463('0x26')]][_0xe463('0x35')]=_0x255d76[_0xe463('0x35')];this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x31')]=_0x255d76[_0xe463('0x31')];this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x36')]=_0x255d76[_0xe463('0x36')];this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x37')]=_0x255d76[_0xe463('0x37')];this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x32')]=_0x255d76[_0xe463('0x32')];this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x38')]=_0x255d76[_0xe463('0x38')];if(this[_0xe463('0xf')][_0x255d76[_0xe463('0x26')]][_0xe463('0x35')]>0x0){tiff2pdf(_0x255d76[_0xe463('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x4a1c1d){logger[_0xe463('0x29')](_0x255d76[_0xe463('0x26')],_0xe463('0x39'),_0x4a1c1d['message']);attachment[_0xe463('0x3a')]({'name':path['parse'](_0x255d76[_0xe463('0x32')])[_0xe463('0x28')],'basename':path[_0xe463('0x3b')](_0x255d76[_0xe463('0x32')])['name']+_0xe463('0x3c'),'type':_0xe463('0x3d')})[_0xe463('0x3e')](function(_0x3465a8){faxAccount[_0xe463('0x3f')](_0xfb72da,{'from':_0x255d76[_0xe463('0x38')],'mapKey':_0xe463('0x7'),'body':path[_0xe463('0x3b')](_0x255d76['filename'])[_0xe463('0x28')]+'.pdf','AttachmentId':_0x3465a8['id']})[_0xe463('0x40')](function(_0x4b6ce4){logger[_0xe463('0x41')](_0x255d76[_0xe463('0x26')],_0xe463('0x42'),JSON['stringify'](_0x4b6ce4));});})['catch'](function(_0x19f03){logger[_0xe463('0x41')](_0x255d76[_0xe463('0x26')],'\x20receiveFax\x20',JSON['stringify'](_0x19f03));});});}logger[_0xe463('0x29')](_0x255d76[_0xe463('0x26')],'\x20receiveFax\x20');}};Fax[_0xe463('0x21')][_0xe463('0x20')]=function(_0x2b3556){if(this[_0xe463('0x12')][_0x2b3556[_0xe463('0x26')]]){_[_0xe463('0x43')](this[_0xe463('0xf')][_0x2b3556[_0xe463('0x26')]],_[_0xe463('0x44')](_0x2b3556,[_0xe463('0x45'),_0xe463('0x46')]));}};function updateStatus(_0x57eb34){if(_0x57eb34[_0xe463('0x47')]){faxMessage[_0xe463('0x48')](_0x57eb34['AttachmentId'],{'failMessage':_0xe463('0x49')})[_0xe463('0x3e')](function(_0x581ee6){ut[_0xe463('0x4a')](_0xe463('0x4b'),_0x581ee6);})['catch'](function(_0x463220){ut[_0xe463('0x4a')](_0xe463('0x4c'),_0x463220);});}else{ut[_0xe463('0x4a')](_0xe463('0x4d'));}}Fax[_0xe463('0x21')][_0xe463('0x4e')]=function(_0x3cd90c,_0x22fcf5,_0x54cc15){var _0x5eb8aa=this;var _0x3f11d4={};if(_0x22fcf5){_0x3f11d4={'read':_0x22fcf5};}else{_0x3f11d4={'failMessage':_0x54cc15};}if(this['actions'][_0x3cd90c][_0xe463('0x47')]){faxMessage[_0xe463('0x48')](this[_0xe463('0x12')][_0x3cd90c][_0xe463('0x47')],_0x3f11d4)[_0xe463('0x3e')](function(_0x25cd43){ut[_0xe463('0x4a')](_0xe463('0x4f'),_0x25cd43);})[_0xe463('0x40')](function(_0x3d50ab){ut[_0xe463('0x4a')](_0xe463('0x50'),_0x3d50ab);})['finally'](function(){delete _0x5eb8aa['channels'][_0x3cd90c];delete _0x5eb8aa['actions'][_0x3cd90c];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xe463('0xf')][_0x3cd90c];delete this[_0xe463('0x12')][_0x3cd90c];}};Fax['prototype'][_0xe463('0x1e')]=function(_0x295898){var _0x416d51=this;if(this['channels'][_0x295898['uniqueid']]){if(this[_0xe463('0x12')][_0x295898[_0xe463('0x26')]]){this['channels'][_0x295898[_0xe463('0x26')]]['id']=this[_0xe463('0x12')][_0x295898[_0xe463('0x26')]]['id'];this[_0xe463('0xf')][_0x295898['uniqueid']][_0xe463('0x28')]=this['actions'][_0x295898[_0xe463('0x26')]][_0xe463('0x28')];}logger['info'](_0x295898[_0xe463('0x26')],this[_0xe463('0x12')][_0x295898[_0xe463('0x26')]]?_0xe463('0x51'):_0xe463('0x52'),JSON[_0xe463('0x53')](this['channels'][_0x295898[_0xe463('0x26')]]));if(this[_0xe463('0x12')][_0x295898[_0xe463('0x26')]]){if(this[_0xe463('0xf')][_0x295898['uniqueid']][_0xe463('0x54')]>0x0&&this[_0xe463('0xf')][_0x295898[_0xe463('0x26')]][_0xe463('0x55')]===_0xe463('0x56')){this[_0xe463('0x4e')](_0x295898['uniqueid'],!![]);}else{this[_0xe463('0x4e')](_0x295898[_0xe463('0x26')],![],this[_0xe463('0xf')][_0x295898['uniqueid']][_0xe463('0x57')]?'SENDING\x20FAILED:\x20'+this[_0xe463('0xf')][_0x295898[_0xe463('0x26')]][_0xe463('0x57')]:_0xe463('0x58'));}}}};Fax['prototype'][_0xe463('0x59')]=function(_0x383730){var _0x336604=this;return new BPromise(function(_0x7678a7,_0x5ad929){_0x336604['execOriginate'](_0x383730,_0x336604[_0xe463('0x10')][_0x383730[_0xe463('0x5a')]])[_0xe463('0x3e')](function(_0x566d53){ut[_0xe463('0x4a')]('[Fax][execOriginate][success]',_0x566d53);_0x7678a7(ut[_0xe463('0x5b')]('Fax\x20received'));})[_0xe463('0x40')](function(_0x227cf6){ut[_0xe463('0x4a')](_0xe463('0x5c'),_0x227cf6);updateStatus(_0x383730);_0x5ad929(ut[_0xe463('0x5b')](_0xe463('0x5d')));});});};Fax[_0xe463('0x21')][_0xe463('0x5e')]=function(_0x34d6b8){var _0x152fae=this;return new BPromise(function(_0x501780,_0x462ec3){var _0x1ebcab=_0x152fae['checkTrunk'](_0x152fae[_0xe463('0x10')][_0x34d6b8[_0xe463('0x5a')]][_0xe463('0x5f')],_0x34d6b8);if(_0x1ebcab[_0xe463('0x60')]){_0x501780(ut[_0xe463('0x5b')]('Trunk\x20Reachable'));}else{_0x462ec3(ut[_0xe463('0x5b')](_0x1ebcab[_0xe463('0x5b')]));}});};function originate(_0x5e8fc2,_0x30a4ca,_0xedeac8){return new BPromise(function(_0x351f73,_0x281ed8){if(_0xedeac8){var _0xe62d01=util[_0xe463('0x61')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xe463('0x3b')](_0x5e8fc2['path'])[_0xe463('0x28')],_0x5e8fc2[_0xe463('0x3')]);gs[_0xe463('0x62')](_0xe62d01)[_0xe463('0x3e')](function(){_0x5e8fc2[_0xe463('0x3')]=util['format'](_0xe463('0x63'),path[_0xe463('0x3b')](_0x5e8fc2[_0xe463('0x3')])[_0xe463('0x64')],path['parse'](_0x5e8fc2[_0xe463('0x3')])[_0xe463('0x28')]);_0x30a4ca['XMF-PATH']=_0x5e8fc2[_0xe463('0x3')];ut[_0xe463('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe463('0x65')](ut[_0xe463('0x66')](_0x5e8fc2,_0x30a4ca))[_0xe463('0x3e')](function(_0x1133b8){_0x351f73(_0x1133b8);})[_0xe463('0x40')](function(_0x3b7539){_0x281ed8(_0x3b7539);});})['catch'](function(_0x529c82){_0x281ed8(_0x529c82);});}else{ami[_0xe463('0x65')](ut[_0xe463('0x66')](_0x5e8fc2,_0x30a4ca))[_0xe463('0x3e')](function(_0x25c459){_0x351f73(_0x25c459);})['catch'](function(_0xdd4ab6){_0x281ed8(_0xdd4ab6);});}});}Fax[_0xe463('0x21')][_0xe463('0x67')]=function(_0x430577,_0x3b3448){var _0x20a77=this;return new BPromise(function(_0x47e8a1,_0x5b0308){var _0x27c312=uuid['v4']();var _0xf5fc08=ut[_0xe463('0x68')](_0x430577,_0x3b3448);_0x20a77[_0xe463('0x12')][_0x27c312]=new Action(_0x27c312,_0x3b3448,_0x430577);var _0x4dc3a3=_0x20a77[_0xe463('0x12')][_0x27c312];if(path[_0xe463('0x3b')](_0x430577[_0xe463('0x3')])[_0xe463('0x69')]==='.pdf'){originate(_0x4dc3a3,_0xf5fc08,!![])[_0xe463('0x3e')](function(_0x4f5101){_0x47e8a1(_0x4f5101);})['catch'](function(_0x39d6d3){_0x5b0308(_0x39d6d3);});}else{originate(_0x4dc3a3,_0xf5fc08,![])['then'](function(_0x518075){_0x47e8a1(_0x518075);})[_0xe463('0x40')](function(_0x476d85){_0x5b0308(_0x476d85);});}});};Fax[_0xe463('0x21')][_0xe463('0x6a')]=function(_0x9dc308){return!_[_0xe463('0x6b')](_0x9dc308)&&!_[_0xe463('0x6b')](_0x9dc308['name'])&&!_[_0xe463('0x6b')](_0x9dc308[_0xe463('0x6c')])&&_0x9dc308[_0xe463('0x6c')]&&!_[_0xe463('0x6b')](this['trunks'][util[_0xe463('0x61')](_0xe463('0x6d'),_0x9dc308[_0xe463('0x28')])])&&!_[_0xe463('0x6b')](this[_0xe463('0x11')][util[_0xe463('0x61')]('SIP/%s',_0x9dc308[_0xe463('0x28')])][_0xe463('0x30')])&&(this[_0xe463('0x11')][util[_0xe463('0x61')](_0xe463('0x6d'),_0x9dc308['name'])][_0xe463('0x30')]===_0xe463('0x6e')||this[_0xe463('0x11')][util[_0xe463('0x61')](_0xe463('0x6d'),_0x9dc308['name'])][_0xe463('0x30')]===_0xe463('0x6f'));};Fax['prototype'][_0xe463('0x70')]=function(_0x2326eb,_0xb0be11){if(!this[_0xe463('0x6a')](_0x2326eb)){ut[_0xe463('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xe463('0x6b')](_0x2326eb)?'':_0x2326eb[_0xe463('0x28')]+_0xe463('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xe463('0x6b')](_0xb0be11[_0xe463('0x7')])){ut[_0xe463('0x4a')](_0xe463('0x72'),JSON['stringify'](_0xb0be11));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0xb0be11['path'])){ut['logger'](_0xe463('0x73'),JSON[_0xe463('0x53')](_0xb0be11));return{'isValid':![],'message':_0xe463('0x74')};}return{'isValid':!![],'message':_0xe463('0x75')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 13463b8..1089590 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 _0x50b9=['notify','resolve','then','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x50b9,0x14e));var _0x950b=function(_0x24dbad,_0x38302c){_0x24dbad=_0x24dbad-0x0;var _0x8624ac=_0x50b9[_0x24dbad];return _0x8624ac;};'use strict';var util=require('util');var BPromise=require(_0x950b('0x0'));var logger=require(_0x950b('0x1'))(_0x950b('0x2'));var _=require(_0x950b('0x3'));var faxAccount=require(_0x950b('0x4'));function loggerCatch(_0xe25414){return function(_0x2e6e22){logger[_0x950b('0x5')](_0xe25414,util['inspect'](_0x2e6e22,{'showHidden':![],'depth':null}));};}exports[_0x950b('0x6')]=function(_0x43c220,_0x4235d3){return BPromise[_0x950b('0x7')]()[_0x950b('0x8')](faxAccount['notify'](_0x43c220,_0x4235d3))['catch'](loggerCatch(_0x950b('0x9')));}; \ No newline at end of file +var _0x17a3=['catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then','notify'];(function(_0x30d5d8,_0x33ad41){var _0x4abd4d=function(_0x308324){while(--_0x308324){_0x30d5d8['push'](_0x30d5d8['shift']());}};_0x4abd4d(++_0x33ad41);}(_0x17a3,0xfe));var _0x317a=function(_0x23347e,_0x350e6c){_0x23347e=_0x23347e-0x0;var _0x24efed=_0x17a3[_0x23347e];return _0x24efed;};'use strict';var util=require(_0x317a('0x0'));var BPromise=require('bluebird');var logger=require(_0x317a('0x1'))(_0x317a('0x2'));var _=require(_0x317a('0x3'));var faxAccount=require(_0x317a('0x4'));function loggerCatch(_0x165049){return function(_0x20d1e4){logger[_0x317a('0x5')](_0x165049,util[_0x317a('0x6')](_0x20d1e4,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4613dc,_0x15e147){return BPromise[_0x317a('0x7')]()[_0x317a('0x8')](faxAccount[_0x317a('0x9')](_0x4613dc,_0x15e147))[_0x317a('0xa')](loggerCatch('[Notify]\x20'));}; \ 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 caaaa63..ba9cf98 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 _0xbdbd=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x28edc8,_0x2d2749){var _0x3c24fc=function(_0x214d21){while(--_0x214d21){_0x28edc8['push'](_0x28edc8['shift']());}};_0x3c24fc(++_0x2d2749);}(_0xbdbd,0x1c3));var _0xdbdb=function(_0x47b3e2,_0x53155e){_0x47b3e2=_0x47b3e2-0x0;var _0x11918e=_0xbdbd[_0x47b3e2];return _0x11918e;};'use strict';var util=require(_0xdbdb('0x0'));var logger=require(_0xdbdb('0x1'))(_0xdbdb('0x2'));var BPromise=require(_0xdbdb('0x3'));var exec=require(_0xdbdb('0x4'))[_0xdbdb('0x5')];exports[_0xdbdb('0x6')]=function(_0x463e16){return new BPromise(function(_0x542528,_0x2ccae3){exec(_0x463e16,function(_0x163738,_0x537944,_0x443062){logger[_0xdbdb('0x7')](_0xdbdb('0x8'),_0x537944);if(_0x163738){logger[_0xdbdb('0x7')](_0xdbdb('0x8'),_0xdbdb('0x9'),util[_0xdbdb('0xa')](_0x163738,{'showHidden':![],'depth':null}),_0x537944,_0x443062);_0x2ccae3(_0x163738);}_0x542528(_0x537944);});});}; \ No newline at end of file +var _0xc4ef=['Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process','exec','info'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xc4ef,0xe9));var _0xfc4e=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xc4ef[_0x9e0cb3];return _0x5926b7;};'use strict';var util=require(_0xfc4e('0x0'));var logger=require(_0xfc4e('0x1'))(_0xfc4e('0x2'));var BPromise=require(_0xfc4e('0x3'));var exec=require(_0xfc4e('0x4'))[_0xfc4e('0x5')];exports['execute']=function(_0x281a32){return new BPromise(function(_0x242729,_0x2163fe){exec(_0x281a32,function(_0x12e4ae,_0x3bf2ca,_0x39bc82){logger[_0xfc4e('0x6')](_0xfc4e('0x7'),_0x3bf2ca);if(_0x12e4ae){logger[_0xfc4e('0x6')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x12e4ae,{'showHidden':![],'depth':null}),_0x3bf2ca,_0x39bc82);_0x2163fe(_0x12e4ae);}_0x242729(_0x3bf2ca);});});}; \ 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 27024b8..ee6992c 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 _0x4aa8=['gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0x3bd347,_0x8ad864){var _0x7f0254=function(_0x20cf7e){while(--_0x20cf7e){_0x3bd347['push'](_0x3bd347['shift']());}};_0x7f0254(++_0x8ad864);}(_0x4aa8,0xeb));var _0x84aa=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x4aa8[_0x1f9f37];return _0x21c080;};'use strict';var util=require(_0x84aa('0x0'));var _=require(_0x84aa('0x1'));var moment=require(_0x84aa('0x2'));var logger=require(_0x84aa('0x3'))(_0x84aa('0x4'));exports[_0x84aa('0x5')]=function(_0x1beb1d){return{'message':_0x1beb1d};};exports[_0x84aa('0x6')]=function(_0x530360,_0x5d1340){logger[_0x84aa('0x7')](_0x530360,util[_0x84aa('0x8')](_0x5d1340,{'showHidden':![],'depth':null}));};exports[_0x84aa('0x9')]=function(_0x4e9f4a,_0x285f6b){var _0x16bcbd={'XMF-ECM':_0x285f6b[_0x84aa('0xa')],'XMF-HEADERINFO':_0x285f6b[_0x84aa('0xb')],'XMF-MINRATE':_0x285f6b[_0x84aa('0xc')],'XMF-MAXRATE':_0x285f6b[_0x84aa('0xd')],'XMF-MODEM':util[_0x84aa('0xe')](_0x84aa('0xf'),_0x285f6b[_0x84aa('0x10')]),'XMF-GATEWAY':_0x285f6b[_0x84aa('0x11')],'XMF-FAXDETECT':_0x285f6b[_0x84aa('0x12')],'XMF-T38TIMEOUT':_0x285f6b[_0x84aa('0x13')],'XMF-LOCALSTATIONID':_0x285f6b[_0x84aa('0x14')],'XMF-PATH':_0x4e9f4a[_0x84aa('0x15')]};return _0x16bcbd;};exports[_0x84aa('0x16')]=function(_0x4d528c,_0x5a703a){return{'actionid':_0x4d528c[_0x84aa('0x17')],'action':_0x84aa('0x18'),'channel':_0x4d528c[_0x84aa('0x19')],'Exten':_0x84aa('0x1a'),'Context':'from-sip','Priority':'1','callerid':util[_0x84aa('0xe')](_0x84aa('0x1b'),_0x4d528c[_0x84aa('0xb')]?_0x4d528c[_0x84aa('0xb')]:'',_0x4d528c[_0x84aa('0x14')]),'variable':_0x5a703a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d528c['uniqueid']};}; \ No newline at end of file +var _0x2ffd=['fax','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','lodash','moment','../../../../config/logger'];(function(_0x401b1a,_0x24bddf){var _0x51e72f=function(_0x3cd0e9){while(--_0x3cd0e9){_0x401b1a['push'](_0x401b1a['shift']());}};_0x51e72f(++_0x24bddf);}(_0x2ffd,0xc3));var _0xd2ff=function(_0x153bc0,_0x16e027){_0x153bc0=_0x153bc0-0x0;var _0x470629=_0x2ffd[_0x153bc0];return _0x470629;};'use strict';var util=require('util');var _=require(_0xd2ff('0x0'));var moment=require(_0xd2ff('0x1'));var logger=require(_0xd2ff('0x2'))(_0xd2ff('0x3'));exports['message']=function(_0x4ef177){return{'message':_0x4ef177};};exports[_0xd2ff('0x4')]=function(_0x57bd00,_0x4c04c3){logger[_0xd2ff('0x5')](_0x57bd00,util['inspect'](_0x4c04c3,{'showHidden':![],'depth':null}));};exports[_0xd2ff('0x6')]=function(_0x42a5e5,_0x3c5f84){var _0x4d4459={'XMF-ECM':_0x3c5f84[_0xd2ff('0x7')],'XMF-HEADERINFO':_0x3c5f84[_0xd2ff('0x8')],'XMF-MINRATE':_0x3c5f84[_0xd2ff('0x9')],'XMF-MAXRATE':_0x3c5f84[_0xd2ff('0xa')],'XMF-MODEM':util[_0xd2ff('0xb')]('\x22%s\x22',_0x3c5f84[_0xd2ff('0xc')]),'XMF-GATEWAY':_0x3c5f84[_0xd2ff('0xd')],'XMF-FAXDETECT':_0x3c5f84[_0xd2ff('0xe')],'XMF-T38TIMEOUT':_0x3c5f84[_0xd2ff('0xf')],'XMF-LOCALSTATIONID':_0x3c5f84[_0xd2ff('0x10')],'XMF-PATH':_0x42a5e5[_0xd2ff('0x11')]};return _0x4d4459;};exports['variablesAction']=function(_0x16edde,_0x261fcd){return{'actionid':_0x16edde[_0xd2ff('0x12')],'action':'originate','channel':_0x16edde[_0xd2ff('0x13')],'Exten':_0xd2ff('0x14'),'Context':_0xd2ff('0x15'),'Priority':'1','callerid':util[_0xd2ff('0xb')]('\x22%s\x22\x20<%s>',_0x16edde[_0xd2ff('0x8')]?_0x16edde[_0xd2ff('0x8')]:'',_0x16edde[_0xd2ff('0x10')]),'variable':_0x261fcd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x16edde['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 63d5399..9ca67fa 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 _0x5a65=['getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts'];(function(_0x298b53,_0x3f830d){var _0x370c14=function(_0x16a8d7){while(--_0x16a8d7){_0x298b53['push'](_0x298b53['shift']());}};_0x370c14(++_0x3f830d);}(_0x5a65,0xa0));var _0x55a6=function(_0x10e546,_0x3c11a6){_0x10e546=_0x10e546-0x0;var _0x17e93d=_0x5a65[_0x10e546];return _0x17e93d;};'use strict';var util=require(_0x55a6('0x0'));var moment=require(_0x55a6('0x1'));var server=require(_0x55a6('0x2'));var Realtime=require(_0x55a6('0x3'));var Report=require(_0x55a6('0x4'));var Acw=require(_0x55a6('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x55a6('0x6'));var Preview=require(_0x55a6('0x7'));var Fax=require(_0x55a6('0x8'));var user=require(_0x55a6('0x9'));var voiceQueue=require(_0x55a6('0xa'));var voiceQueueReport=require(_0x55a6('0xb'));var voiceCallReport=require(_0x55a6('0xc'));var trunk=require(_0x55a6('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x55a6('0xe'));var cmHopperHistory=require(_0x55a6('0xf'));var campaign=require(_0x55a6('0x10'));var voiceExtension=require(_0x55a6('0x11'));var faxAccount=require(_0x55a6('0x12'));var zendesk=require(_0x55a6('0x13'));var salesforce=require(_0x55a6('0x14'));var sugarcrm=require(_0x55a6('0x15'));var freshdesk=require(_0x55a6('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x55a6('0x17'));var vtiger=require(_0x55a6('0x18'));var freshsales=require(_0x55a6('0x19'));var servicenow=require(_0x55a6('0x1a'));var dynamics365=require(_0x55a6('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x55a6('0x1c'))(_0x55a6('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x55a6('0x1e')](_0x55a6('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x55a6('0x1e')](_0x55a6('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x55a6('0x20')]()[_0x55a6('0x21')](user[_0x55a6('0x22')]())[_0x55a6('0x21')](realtime[_0x55a6('0x23')]())[_0x55a6('0x21')](user[_0x55a6('0x24')]())[_0x55a6('0x21')](realtime[_0x55a6('0x25')]())[_0x55a6('0x21')](trunk[_0x55a6('0x26')]())[_0x55a6('0x21')](realtime['initTrunks']())[_0x55a6('0x21')](voiceQueue[_0x55a6('0x27')]())[_0x55a6('0x21')](realtime[_0x55a6('0x28')]())[_0x55a6('0x21')](trigger[_0x55a6('0x29')]())['then'](realtime[_0x55a6('0x2a')]())[_0x55a6('0x21')](template['getTemplates']())[_0x55a6('0x21')](realtime['initTemplates']())['then'](zendesk[_0x55a6('0x2b')]())['then'](realtime['initZendeskAccounts']())[_0x55a6('0x21')](salesforce[_0x55a6('0x2c')]())[_0x55a6('0x21')](realtime[_0x55a6('0x2d')]())['then'](sugarcrm[_0x55a6('0x2e')]())['then'](realtime[_0x55a6('0x2f')]())[_0x55a6('0x21')](freshdesk['getFreshdeskAccounts']())[_0x55a6('0x21')](realtime[_0x55a6('0x30')]())[_0x55a6('0x21')](desk[_0x55a6('0x31')]())[_0x55a6('0x21')](realtime[_0x55a6('0x32')]())[_0x55a6('0x21')](zoho[_0x55a6('0x33')]())[_0x55a6('0x21')](realtime['initZohoAccounts']())[_0x55a6('0x21')](vtiger[_0x55a6('0x34')]())['then'](realtime[_0x55a6('0x35')]())[_0x55a6('0x21')](freshsales['getFreshsalesAccounts']())[_0x55a6('0x21')](realtime['initFreshsalesAccounts']())[_0x55a6('0x21')](servicenow[_0x55a6('0x36')]())[_0x55a6('0x21')](realtime[_0x55a6('0x37')]())['then'](dynamics365[_0x55a6('0x38')]())['then'](realtime['initDynamics365Accounts']())[_0x55a6('0x21')](campaign[_0x55a6('0x39')]())['then'](realtime['initCampaigns']())[_0x55a6('0x21')](voiceExtension[_0x55a6('0x3a')]())[_0x55a6('0x21')](realtime[_0x55a6('0x3b')]())[_0x55a6('0x21')](faxAccount[_0x55a6('0x3c')]())[_0x55a6('0x21')](realtime[_0x55a6('0x3d')]())[_0x55a6('0x21')](function(){return realtime;});}function initParams(){return Promise[_0x55a6('0x20')]()[_0x55a6('0x21')](voiceQueueReport[_0x55a6('0x3e')]())[_0x55a6('0x21')](realtime[_0x55a6('0x3f')]())[_0x55a6('0x21')](cmHopperHistory[_0x55a6('0x40')]())[_0x55a6('0x21')](realtime[_0x55a6('0x41')]())['then'](cmHopperHistory[_0x55a6('0x42')]())[_0x55a6('0x21')](realtime['initCampaignHopperHistory']())[_0x55a6('0x21')](voiceCallReport[_0x55a6('0x43')]())[_0x55a6('0x21')](realtime[_0x55a6('0x44')]())['catch'](function(_0x49c207){logger[_0x55a6('0x45')](_0x55a6('0x46'),util[_0x55a6('0x47')](_0x49c207,{'showHidden':![],'depth':null}));});}function main(){return server[_0x55a6('0x48')](realtime,preview,fax)[_0x55a6('0x21')](function(){return initRealtime();})[_0x55a6('0x21')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x392a3c){logger['error'](_0x55a6('0x49'),util[_0x55a6('0x47')](_0x392a3c,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4c72=['initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','moment','./server','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x513a3d,_0x5441fd){var _0x18e146=function(_0x37ae94){while(--_0x37ae94){_0x513a3d['push'](_0x513a3d['shift']());}};_0x18e146(++_0x5441fd);}(_0x4c72,0x1b4));var _0x24c7=function(_0x5b7d8e,_0xd36032){_0x5b7d8e=_0x5b7d8e-0x0;var _0x2cec85=_0x4c72[_0x5b7d8e];return _0x2cec85;};'use strict';var util=require('util');var moment=require(_0x24c7('0x0'));var server=require(_0x24c7('0x1'));var Realtime=require('./realtime');var Report=require(_0x24c7('0x2'));var Acw=require(_0x24c7('0x3'));var Trigger=require(_0x24c7('0x4'));var Dialer=require(_0x24c7('0x5'));var Preview=require(_0x24c7('0x6'));var Fax=require('./fax');var user=require(_0x24c7('0x7'));var voiceQueue=require(_0x24c7('0x8'));var voiceQueueReport=require(_0x24c7('0x9'));var voiceCallReport=require(_0x24c7('0xa'));var trunk=require(_0x24c7('0xb'));var trigger=require(_0x24c7('0xc'));var template=require(_0x24c7('0xd'));var cmHopperHistory=require(_0x24c7('0xe'));var campaign=require(_0x24c7('0xf'));var voiceExtension=require(_0x24c7('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x24c7('0x11'));var salesforce=require(_0x24c7('0x12'));var sugarcrm=require(_0x24c7('0x13'));var freshdesk=require(_0x24c7('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x24c7('0x15'));var freshsales=require(_0x24c7('0x16'));var servicenow=require(_0x24c7('0x17'));var dynamics365=require(_0x24c7('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x24c7('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x24c7('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x24c7('0x1a')](_0x24c7('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x24c7('0x1c')]()[_0x24c7('0x1d')](user[_0x24c7('0x1e')]())[_0x24c7('0x1d')](realtime['initAgents']())[_0x24c7('0x1d')](user[_0x24c7('0x1f')]())[_0x24c7('0x1d')](realtime['initTelephones']())[_0x24c7('0x1d')](trunk[_0x24c7('0x20')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x21')]())[_0x24c7('0x1d')](voiceQueue['getVoiceQueues']())[_0x24c7('0x1d')](realtime[_0x24c7('0x22')]())[_0x24c7('0x1d')](trigger[_0x24c7('0x23')]())['then'](realtime[_0x24c7('0x24')]())[_0x24c7('0x1d')](template['getTemplates']())[_0x24c7('0x1d')](realtime['initTemplates']())[_0x24c7('0x1d')](zendesk[_0x24c7('0x25')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x26')]())[_0x24c7('0x1d')](salesforce[_0x24c7('0x27')]())[_0x24c7('0x1d')](realtime['initSalesforceAccounts']())[_0x24c7('0x1d')](sugarcrm[_0x24c7('0x28')]())['then'](realtime[_0x24c7('0x29')]())['then'](freshdesk[_0x24c7('0x2a')]())['then'](realtime[_0x24c7('0x2b')]())[_0x24c7('0x1d')](desk[_0x24c7('0x2c')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x2d')]())[_0x24c7('0x1d')](zoho[_0x24c7('0x2e')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x2f')]())[_0x24c7('0x1d')](vtiger[_0x24c7('0x30')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x31')]())[_0x24c7('0x1d')](freshsales[_0x24c7('0x32')]())['then'](realtime[_0x24c7('0x33')]())['then'](servicenow[_0x24c7('0x34')]())['then'](realtime[_0x24c7('0x35')]())[_0x24c7('0x1d')](dynamics365[_0x24c7('0x36')]())[_0x24c7('0x1d')](realtime['initDynamics365Accounts']())[_0x24c7('0x1d')](campaign['getCampaigns']())[_0x24c7('0x1d')](realtime[_0x24c7('0x37')]())[_0x24c7('0x1d')](voiceExtension[_0x24c7('0x38')]())[_0x24c7('0x1d')](realtime['initVoiceExtensions']())[_0x24c7('0x1d')](faxAccount[_0x24c7('0x39')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x3a')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x24c7('0x1c')]()[_0x24c7('0x1d')](voiceQueueReport[_0x24c7('0x3b')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x3c')]())[_0x24c7('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x24c7('0x1d')](realtime[_0x24c7('0x3d')]())[_0x24c7('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x24c7('0x1d')](realtime[_0x24c7('0x3e')]())[_0x24c7('0x1d')](voiceCallReport[_0x24c7('0x3f')]())[_0x24c7('0x1d')](realtime[_0x24c7('0x40')]())[_0x24c7('0x41')](function(_0x7f64f1){logger[_0x24c7('0x42')](_0x24c7('0x43'),util[_0x24c7('0x44')](_0x7f64f1,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x24c7('0x1d')](function(){return initRealtime();})[_0x24c7('0x1d')](function(){return initParams();})[_0x24c7('0x1d')](function(){report[_0x24c7('0x45')]();setInterval(initRealtime,0x1388);})[_0x24c7('0x41')](function(_0x3aa15){logger['error'](_0x24c7('0x46'),util['inspect'](_0x3aa15,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 84b14fa..6a2b7a6 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 _0x67da=['state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','stringify','emit','user:save','user:presence','exports','lodash','util','moment','redis','defaults','localhost','name','email','accountcode','fullname'];(function(_0x2fd8fb,_0x20e366){var _0x107495=function(_0x10e832){while(--_0x10e832){_0x2fd8fb['push'](_0x2fd8fb['shift']());}};_0x107495(++_0x20e366);}(_0x67da,0x198));var _0xa67d=function(_0x1a1947,_0x54798f){_0x1a1947=_0x1a1947-0x0;var _0x5781ec=_0x67da[_0x1a1947];return _0x5781ec;};'use strict';var _=require(_0xa67d('0x0'));var util=require(_0xa67d('0x1'));var moment=require(_0xa67d('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa67d('0x3')]=_[_0xa67d('0x4')](config[_0xa67d('0x3')],{'host':_0xa67d('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa67d('0x3')]));function Agent(_0x578a75){this['id']=_0x578a75['id']||0x0;this[_0xa67d('0x6')]=_0x578a75[_0xa67d('0x6')]||'';this[_0xa67d('0x7')]=_0x578a75[_0xa67d('0x7')]||'';this[_0xa67d('0x8')]=_0x578a75[_0xa67d('0x8')]||'';this[_0xa67d('0x9')]=_0x578a75[_0xa67d('0x9')]||'';this[_0xa67d('0xa')]=_0xa67d('0xb');this[_0xa67d('0xc')]=0x0;this[_0xa67d('0xd')]=_0xa67d('0xb');this[_0xa67d('0xe')]='';this[_0xa67d('0xf')]='';this[_0xa67d('0x10')]='';this[_0xa67d('0x11')]='';this[_0xa67d('0x12')]=_0x578a75[_0xa67d('0x12')]||![];this[_0xa67d('0x13')]=_0xa67d('0xb');this[_0xa67d('0x14')]=0x0;this[_0xa67d('0x15')]='';this[_0xa67d('0x16')]='';this[_0xa67d('0x17')]=![];this['local']=![];this[_0xa67d('0x18')]='';}Agent[_0xa67d('0x19')][_0xa67d('0x1a')]=function(_0xe43fa7){var _0x1feba6;if(_0xe43fa7&&_0xe43fa7[_0xa67d('0xa')]){_0x1feba6=_0xe43fa7[_0xa67d('0xa')]['toLowerCase']();switch(_0x1feba6){case _0xa67d('0x1b'):_0x1feba6='idle';break;case _0xa67d('0x1c'):_0x1feba6=_0xa67d('0x1d');break;}}if(_0x1feba6&&this[_0xa67d('0x13')]!==_0x1feba6||_0xe43fa7[_0xa67d('0x1e')]){this['voiceStatusTime']=_[_0xa67d('0x1f')](moment()[_0xa67d('0x20')]('x'));}if(_0x1feba6){this[_0xa67d('0x13')]=_0x1feba6;}var _0x386cd2={'id':this['id'],'name':this[_0xa67d('0x6')],'email':this[_0xa67d('0x7')],'accountcode':this[_0xa67d('0x8')],'fullname':this[_0xa67d('0x9')],'state':this['state'],'stateTime':this[_0xa67d('0xc')],'status':this[_0xa67d('0xd')],'address':this[_0xa67d('0xe')],'online':this[_0xa67d('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xa67d('0x15')],'voiceStatusQueue':this[_0xa67d('0x16')],'interface':this[_0xa67d('0x11')],'onhold':this[_0xa67d('0x17')]};var _0x2d38b1=md5(JSON[_0xa67d('0x21')](_0x386cd2));if(this[_0xa67d('0x18')]!==_0x2d38b1){this['md5']=_0x2d38b1;io['to'](util[_0xa67d('0x20')]('user:%s',_0x386cd2[_0xa67d('0x6')]))[_0xa67d('0x22')](_0xa67d('0x23'),_0x386cd2);io[_0xa67d('0x22')](_0xa67d('0x24'),_0x386cd2);}};module[_0xa67d('0x25')]=Agent; \ No newline at end of file +var _0xb29d=['voiceStatus','statePause','toNumber','format','stateTime','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','localhost','name','email','accountcode','fullname','state','unknown','status','address','phone','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','toLowerCase','not_inuse','inuse'];(function(_0x22730b,_0x3aafcd){var _0x20af64=function(_0x27b43e){while(--_0x27b43e){_0x22730b['push'](_0x22730b['shift']());}};_0x20af64(++_0x3aafcd);}(_0xb29d,0x107));var _0xdb29=function(_0x4b3c41,_0x309c20){_0x4b3c41=_0x4b3c41-0x0;var _0x24e289=_0xb29d[_0x4b3c41];return _0x24e289;};'use strict';var _=require(_0xdb29('0x0'));var util=require(_0xdb29('0x1'));var moment=require(_0xdb29('0x2'));var md5=require(_0xdb29('0x3'));var Redis=require(_0xdb29('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xdb29('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x36b159){this['id']=_0x36b159['id']||0x0;this['name']=_0x36b159[_0xdb29('0x6')]||'';this[_0xdb29('0x7')]=_0x36b159[_0xdb29('0x7')]||'';this[_0xdb29('0x8')]=_0x36b159[_0xdb29('0x8')]||'';this[_0xdb29('0x9')]=_0x36b159[_0xdb29('0x9')]||'';this[_0xdb29('0xa')]=_0xdb29('0xb');this['stateTime']=0x0;this[_0xdb29('0xc')]='unknown';this[_0xdb29('0xd')]='';this[_0xdb29('0xe')]='';this['mobile']='';this['interface']='';this[_0xdb29('0xf')]=_0x36b159['online']||![];this['voiceStatus']=_0xdb29('0xb');this[_0xdb29('0x10')]=0x0;this[_0xdb29('0x11')]='';this[_0xdb29('0x12')]='';this[_0xdb29('0x13')]=![];this[_0xdb29('0x14')]=![];this['md5']='';}Agent[_0xdb29('0x15')]['updateStatusRealtime']=function(_0x5f4419){var _0x37f5fe;if(_0x5f4419&&_0x5f4419['state']){_0x37f5fe=_0x5f4419[_0xdb29('0xa')][_0xdb29('0x16')]();switch(_0x37f5fe){case _0xdb29('0x17'):_0x37f5fe='idle';break;case _0xdb29('0x18'):_0x37f5fe='talking';break;}}if(_0x37f5fe&&this[_0xdb29('0x19')]!==_0x37f5fe||_0x5f4419[_0xdb29('0x1a')]){this[_0xdb29('0x10')]=_[_0xdb29('0x1b')](moment()[_0xdb29('0x1c')]('x'));}if(_0x37f5fe){this[_0xdb29('0x19')]=_0x37f5fe;}var _0x41dc4e={'id':this['id'],'name':this[_0xdb29('0x6')],'email':this[_0xdb29('0x7')],'accountcode':this[_0xdb29('0x8')],'fullname':this['fullname'],'state':this[_0xdb29('0xa')],'stateTime':this[_0xdb29('0x1d')],'status':this[_0xdb29('0xc')],'address':this[_0xdb29('0xd')],'online':this[_0xdb29('0xf')],'voiceStatus':this[_0xdb29('0x19')],'voiceStatusTime':this[_0xdb29('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0xdb29('0x13')]};var _0x1ea363=md5(JSON[_0xdb29('0x1e')](_0x41dc4e));if(this['md5']!==_0x1ea363){this[_0xdb29('0x3')]=_0x1ea363;io['to'](util[_0xdb29('0x1c')](_0xdb29('0x1f'),_0x41dc4e[_0xdb29('0x6')]))[_0xdb29('0x20')](_0xdb29('0x21'),_0x41dc4e);io[_0xdb29('0x20')](_0xdb29('0x22'),_0x41dc4e);}};module[_0xdb29('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f31641d..68ef7af 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 _0x91ce=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','ivrAnswerCallsDay','ivrTotalCallsDays'];(function(_0x42cccc,_0x2890f6){var _0x18ad85=function(_0x15216e){while(--_0x15216e){_0x42cccc['push'](_0x42cccc['shift']());}};_0x18ad85(++_0x2890f6);}(_0x91ce,0xf1));var _0xe91c=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x91ce[_0x18b344];return _0x5ef6bb;};'use strict';function Campaign(_0x2ad285){this['id']=_0x2ad285['id']||0x0;this[_0xe91c('0x0')]=_0x2ad285[_0xe91c('0x0')]||'';this[_0xe91c('0x1')]=_0x2ad285[_0xe91c('0x1')]||'campaign';this['originated']=0x0;this['temp']=0x0;this[_0xe91c('0x2')]=0x0;this[_0xe91c('0x3')]=0x0;this['message']='';this[_0xe91c('0x4')]=!![];this[_0xe91c('0x5')]=_0x2ad285['active'];this[_0xe91c('0x6')]=_0x2ad285[_0xe91c('0x6')];this[_0xe91c('0x7')]=_0x2ad285[_0xe91c('0x7')]||null;this[_0xe91c('0x8')]=_0x2ad285[_0xe91c('0x8')]?_0x2ad285[_0xe91c('0x8')]:null;this[_0xe91c('0x9')]=_0x2ad285[_0xe91c('0x9')];this[_0xe91c('0xa')]=_0x2ad285[_0xe91c('0xa')];this[_0xe91c('0xb')]=_0x2ad285[_0xe91c('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x2ad285[_0xe91c('0xc')];this['dialCongestionRetryFrequency']=_0x2ad285[_0xe91c('0xd')];this[_0xe91c('0xe')]=_0x2ad285[_0xe91c('0xe')];this['dialBusyRetryFrequency']=_0x2ad285[_0xe91c('0xf')];this[_0xe91c('0x10')]=_0x2ad285[_0xe91c('0x10')];this[_0xe91c('0x11')]=_0x2ad285[_0xe91c('0x11')];this[_0xe91c('0x12')]=_0x2ad285[_0xe91c('0x12')];this[_0xe91c('0x13')]=_0x2ad285[_0xe91c('0x13')]||0x3;this[_0xe91c('0x14')]=_0x2ad285[_0xe91c('0x14')]||0x96;this[_0xe91c('0x15')]=_0x2ad285[_0xe91c('0x15')]||0x3;this['dialDropRetryFrequency']=_0x2ad285[_0xe91c('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x2ad285[_0xe91c('0x17')]||0x3;this[_0xe91c('0x18')]=_0x2ad285[_0xe91c('0x18')]||0x96;this[_0xe91c('0x19')]=_0x2ad285[_0xe91c('0x19')]||0x3;this[_0xe91c('0x1a')]=_0x2ad285['dialMachineRetryFrequency']||0x96;this[_0xe91c('0x1b')]=_0x2ad285[_0xe91c('0x1b')]||0x3;this[_0xe91c('0x1c')]=_0x2ad285[_0xe91c('0x1c')]||0x96;this[_0xe91c('0x1d')]=_0x2ad285[_0xe91c('0x1d')]||_0xe91c('0x1e');this[_0xe91c('0x1f')]=_0x2ad285['dialPrefix']||undefined;this[_0xe91c('0x20')]=_0x2ad285[_0xe91c('0x20')]||undefined;this['dialCutDigit']=_0x2ad285['dialCutDigit']||undefined;this['TrunkBackup']=_0x2ad285[_0xe91c('0x21')]?_0x2ad285[_0xe91c('0x21')]:undefined;this[_0xe91c('0x22')]=_0x2ad285[_0xe91c('0x22')]?_0x2ad285[_0xe91c('0x22')]:undefined;this[_0xe91c('0x23')]=_0x2ad285[_0xe91c('0x23')]?_0x2ad285[_0xe91c('0x23')]:undefined;this[_0xe91c('0x24')]=_0x2ad285[_0xe91c('0x24')]?_0x2ad285[_0xe91c('0x24')]:undefined;this[_0xe91c('0x25')]=_0x2ad285['SquareProject']?_0x2ad285[_0xe91c('0x24')][_0xe91c('0x0')]:undefined;this['dialAMDActive']=_0x2ad285[_0xe91c('0x26')]||![];this[_0xe91c('0x27')]=_0x2ad285['dialAMDInitialSilence'];this[_0xe91c('0x28')]=_0x2ad285[_0xe91c('0x28')];this[_0xe91c('0x29')]=_0x2ad285[_0xe91c('0x29')];this[_0xe91c('0x2a')]=_0x2ad285[_0xe91c('0x2a')];this['dialAMDMinWordLength']=_0x2ad285[_0xe91c('0x2b')];this[_0xe91c('0x2c')]=_0x2ad285[_0xe91c('0x2c')];this[_0xe91c('0x2d')]=_0x2ad285[_0xe91c('0x2d')];this[_0xe91c('0x2e')]=_0x2ad285['dialAMDSilenceThreshold'];this[_0xe91c('0x2f')]=_0x2ad285[_0xe91c('0x2f')];}module[_0xe91c('0x30')]=Campaign; \ No newline at end of file +var _0x606c=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0xce3797,_0x1671a3){var _0x7849f3=function(_0x396abc){while(--_0x396abc){_0xce3797['push'](_0xce3797['shift']());}};_0x7849f3(++_0x1671a3);}(_0x606c,0x12d));var _0xc606=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x606c[_0x562362];return _0x3a18ce;};'use strict';function Campaign(_0x47583f){this['id']=_0x47583f['id']||0x0;this[_0xc606('0x0')]=_0x47583f[_0xc606('0x0')]||'';this['type']=_0x47583f['type']||_0xc606('0x1');this[_0xc606('0x2')]=0x0;this[_0xc606('0x3')]=0x0;this[_0xc606('0x4')]=0x0;this[_0xc606('0x5')]=0x0;this['message']='';this[_0xc606('0x6')]=!![];this[_0xc606('0x7')]=_0x47583f[_0xc606('0x7')];this[_0xc606('0x8')]=_0x47583f[_0xc606('0x8')];this[_0xc606('0x9')]=_0x47583f[_0xc606('0x9')]||null;this[_0xc606('0xa')]=_0x47583f[_0xc606('0xa')]?_0x47583f[_0xc606('0xa')]:null;this[_0xc606('0xb')]=_0x47583f[_0xc606('0xb')];this[_0xc606('0xc')]=_0x47583f[_0xc606('0xc')];this[_0xc606('0xd')]=_0x47583f[_0xc606('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x47583f[_0xc606('0xe')];this['dialCongestionRetryFrequency']=_0x47583f[_0xc606('0xf')];this[_0xc606('0x10')]=_0x47583f[_0xc606('0x10')];this[_0xc606('0x11')]=_0x47583f[_0xc606('0x11')];this[_0xc606('0x12')]=_0x47583f[_0xc606('0x12')];this[_0xc606('0x13')]=_0x47583f[_0xc606('0x13')];this[_0xc606('0x14')]=_0x47583f['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x47583f['dialNoSuchNumberMaxRetry']||0x3;this[_0xc606('0x15')]=_0x47583f[_0xc606('0x15')]||0x96;this[_0xc606('0x16')]=_0x47583f[_0xc606('0x16')]||0x3;this[_0xc606('0x17')]=_0x47583f['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x47583f['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x47583f['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x47583f[_0xc606('0x18')]||0x3;this[_0xc606('0x19')]=_0x47583f[_0xc606('0x19')]||0x96;this[_0xc606('0x1a')]=_0x47583f[_0xc606('0x1a')]||0x3;this[_0xc606('0x1b')]=_0x47583f[_0xc606('0x1b')]||0x96;this[_0xc606('0x1c')]=_0x47583f[_0xc606('0x1c')]||'DESC';this['dialPrefix']=_0x47583f['dialPrefix']||undefined;this[_0xc606('0x1d')]=_0x47583f[_0xc606('0x1d')]||undefined;this[_0xc606('0x1e')]=_0x47583f[_0xc606('0x1e')]||undefined;this['TrunkBackup']=_0x47583f[_0xc606('0x1f')]?_0x47583f['TrunkBackup']:undefined;this[_0xc606('0x20')]=_0x47583f[_0xc606('0x20')]?_0x47583f[_0xc606('0x20')]:undefined;this[_0xc606('0x21')]=_0x47583f[_0xc606('0x21')]?_0x47583f[_0xc606('0x21')]:undefined;this[_0xc606('0x22')]=_0x47583f['SquareProject']?_0x47583f[_0xc606('0x22')]:undefined;this[_0xc606('0x23')]=_0x47583f['SquareProject']?_0x47583f[_0xc606('0x22')][_0xc606('0x0')]:undefined;this[_0xc606('0x24')]=_0x47583f['dialAMDActive']||![];this[_0xc606('0x25')]=_0x47583f[_0xc606('0x25')];this[_0xc606('0x26')]=_0x47583f['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x47583f['dialAMDAfterGreetingSilence'];this[_0xc606('0x27')]=_0x47583f['dialAMDTotalAnalysisTime'];this[_0xc606('0x28')]=_0x47583f[_0xc606('0x28')];this[_0xc606('0x29')]=_0x47583f[_0xc606('0x29')];this['dialAMDMaximumNumberOfWords']=_0x47583f[_0xc606('0x2a')];this[_0xc606('0x2b')]=_0x47583f[_0xc606('0x2b')];this[_0xc606('0x2c')]=_0x47583f[_0xc606('0x2c')];}module[_0xc606('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4b5a5f0..f5ae091 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 _0x8227=['unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime'];(function(_0x58389d,_0x3137df){var _0x2be20a=function(_0x2b6f46){while(--_0x2b6f46){_0x58389d['push'](_0x58389d['shift']());}};_0x2be20a(++_0x3137df);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this['starttime']=null;this[_0x7822('0x0')]='';this['destinationchannel']='';this[_0x7822('0x1')]=0x0;this[_0x7822('0x2')]='';this[_0x7822('0x3')]=undefined;this[_0x7822('0x4')]=undefined;this['accountcode']=0x0;this[_0x7822('0x5')]='';this[_0x7822('0x6')]=0x0;this[_0x7822('0x7')]=0x0;this[_0x7822('0x8')]=0x0;this[_0x7822('0x9')]=![];this[_0x7822('0xa')]=null;this[_0x7822('0xb')]=null;this[_0x7822('0xc')]=![];this['abandoned']=![];this[_0x7822('0xd')]='';this['lastdata']='';this[_0x7822('0xe')]=0x0;this[_0x7822('0xf')]=0x0;this[_0x7822('0x10')]=0x0;this[_0x7822('0x11')]=null;this[_0x7822('0x12')]=null;this[_0x7822('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x7822('0x14')]=null;this['monitors']=[];this[_0x7822('0x15')]=undefined;this[_0x7822('0x16')]=undefined;this[_0x7822('0x17')]=undefined;this[_0x7822('0x18')]=0x0;}module[_0x7822('0x19')]=Channel; \ No newline at end of file +var _0xd92a=['lastdata','duration','billableseconds','type','tag','monitor','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication'];(function(_0x4dd5ef,_0x57e62c){var _0x484b6e=function(_0x24ff57){while(--_0x24ff57){_0x4dd5ef['push'](_0x4dd5ef['shift']());}};_0x484b6e(++_0x57e62c);}(_0xd92a,0x1bc));var _0xad92=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd92a[_0x2c91e9];return _0x13f0ff;};'use strict';function Channel(){this['starttime']=null;this[_0xad92('0x0')]='';this[_0xad92('0x1')]='';this[_0xad92('0x2')]=0x0;this['calleridname']='';this[_0xad92('0x3')]=undefined;this[_0xad92('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0xad92('0x5')]=0x0;this[_0xad92('0x6')]=0x0;this['answered']=![];this[_0xad92('0x7')]=null;this[_0xad92('0x8')]=null;this[_0xad92('0x9')]=![];this[_0xad92('0xa')]=![];this[_0xad92('0xb')]='';this[_0xad92('0xc')]='';this[_0xad92('0xd')]=0x0;this[_0xad92('0xe')]=0x0;this['holdtime']=0x0;this[_0xad92('0xf')]=null;this[_0xad92('0x10')]=null;this['disposition']=null;this[_0xad92('0x11')]=![];this[_0xad92('0x12')]=null;this[_0xad92('0x13')]=null;this['monitors']=[];this[_0xad92('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xad92('0x15')]=undefined;this[_0xad92('0x16')]=0x0;}module[_0xad92('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 25f8114..be37b26 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 _0x430e=['exports','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x19dcb5,_0x38a067){var _0x490ba0=function(_0xb13da5){while(--_0xb13da5){_0x19dcb5['push'](_0x19dcb5['shift']());}};_0x490ba0(++_0x38a067);}(_0x430e,0xa6));var _0xe430=function(_0x203387,_0x25ee77){_0x203387=_0x203387-0x0;var _0x358e6b=_0x430e[_0x203387];return _0x358e6b;};'use strict';function DeskAccount(_0x18d602){this['id']=_0x18d602['id']||0x0;this['name']=_0x18d602['name']||'';this[_0xe430('0x0')]=_0x18d602[_0xe430('0x0')]||'';this[_0xe430('0x1')]=_0x18d602[_0xe430('0x1')]||'';this[_0xe430('0x2')]=_0x18d602['authType']||'';this[_0xe430('0x3')]=_0x18d602[_0xe430('0x3')]||'';this['consumerKey']=_0x18d602['consumerKey']||'';this[_0xe430('0x4')]=_0x18d602[_0xe430('0x4')]||'';this[_0xe430('0x5')]=_0x18d602['token']||'';this[_0xe430('0x6')]=_0x18d602[_0xe430('0x6')]||'';this[_0xe430('0x7')]=_0x18d602['type']||'';this[_0xe430('0x8')]=_0x18d602[_0xe430('0x8')]||'';this[_0xe430('0x9')]=_0x18d602[_0xe430('0x9')]||{};}module[_0xe430('0xa')]=DeskAccount; \ No newline at end of file +var _0x1e69=['token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x4b7bad,_0x135acf){var _0x4da111=function(_0x28650c){while(--_0x28650c){_0x4b7bad['push'](_0x4b7bad['shift']());}};_0x4da111(++_0x135acf);}(_0x1e69,0x19d));var _0x91e6=function(_0x58128c,_0x425570){_0x58128c=_0x58128c-0x0;var _0x2f3728=_0x1e69[_0x58128c];return _0x2f3728;};'use strict';function DeskAccount(_0x5d578d){this['id']=_0x5d578d['id']||0x0;this[_0x91e6('0x0')]=_0x5d578d[_0x91e6('0x0')]||'';this['username']=_0x5d578d[_0x91e6('0x1')]||'';this[_0x91e6('0x2')]=_0x5d578d[_0x91e6('0x2')]||'';this[_0x91e6('0x3')]=_0x5d578d[_0x91e6('0x3')]||'';this[_0x91e6('0x4')]=_0x5d578d[_0x91e6('0x4')]||'';this['consumerKey']=_0x5d578d[_0x91e6('0x5')]||'';this[_0x91e6('0x6')]=_0x5d578d[_0x91e6('0x6')]||'';this['token']=_0x5d578d[_0x91e6('0x7')]||'';this['tokenSecret']=_0x5d578d[_0x91e6('0x8')]||'';this['type']=_0x5d578d['type']||'';this[_0x91e6('0x9')]=_0x5d578d['serverUrl']||'';this[_0x91e6('0xa')]=_0x5d578d[_0x91e6('0xa')]||{};}module[_0x91e6('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ac6dc4f..b865904 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 _0x8ea2=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x24a5c7,_0x1bb162){var _0x3c6bbd=function(_0x12145f){while(--_0x12145f){_0x24a5c7['push'](_0x24a5c7['shift']());}};_0x3c6bbd(++_0x1bb162);}(_0x8ea2,0x165));var _0x28ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea2[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x5bf92c){this['id']=_0x5bf92c['id']||0x0;this[_0x28ea('0x0')]=_0x5bf92c[_0x28ea('0x0')]||'';this[_0x28ea('0x1')]=_0x5bf92c[_0x28ea('0x1')]||'';this[_0x28ea('0x2')]=_0x5bf92c[_0x28ea('0x2')]||'';this['remoteUri']=_0x5bf92c[_0x28ea('0x3')]||'';this[_0x28ea('0x4')]=_0x5bf92c[_0x28ea('0x4')]||'';this[_0x28ea('0x5')]=_0x5bf92c[_0x28ea('0x5')]||'';this[_0x28ea('0x6')]=_0x5bf92c['clientSecret']||{};this[_0x28ea('0x7')]=_0x5bf92c[_0x28ea('0x7')]||'';this[_0x28ea('0x8')]=_0x5bf92c[_0x28ea('0x8')]||![];this[_0x28ea('0x9')]=_0x5bf92c[_0x28ea('0x9')]||{};this['CloudProvider']=_0x5bf92c[_0x28ea('0xa')]||{};}module[_0x28ea('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xc579=['serverUrl','modernAuthentication','CloudProvider','exports','name','username','tenantId','clientId','clientSecret'];(function(_0x528511,_0x815fd3){var _0xd1b2b7=function(_0x3bf131){while(--_0x3bf131){_0x528511['push'](_0x528511['shift']());}};_0xd1b2b7(++_0x815fd3);}(_0xc579,0x1bd));var _0x9c57=function(_0x9db8cc,_0x288003){_0x9db8cc=_0x9db8cc-0x0;var _0x4b3107=_0xc579[_0x9db8cc];return _0x4b3107;};'use strict';function Dynamics365Account(_0x544fb7){this['id']=_0x544fb7['id']||0x0;this['name']=_0x544fb7[_0x9c57('0x0')]||'';this[_0x9c57('0x1')]=_0x544fb7[_0x9c57('0x1')]||'';this['password']=_0x544fb7['password']||'';this['remoteUri']=_0x544fb7['remoteUri']||'';this[_0x9c57('0x2')]=_0x544fb7[_0x9c57('0x2')]||'';this[_0x9c57('0x3')]=_0x544fb7['clientId']||'';this[_0x9c57('0x4')]=_0x544fb7[_0x9c57('0x4')]||{};this[_0x9c57('0x5')]=_0x544fb7[_0x9c57('0x5')]||'';this[_0x9c57('0x6')]=_0x544fb7[_0x9c57('0x6')]||![];this['Configurations']=_0x544fb7['Configurations']||{};this['CloudProvider']=_0x544fb7[_0x9c57('0x7')]||{};}module[_0x9c57('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b8cc7e3..f052cb1 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 _0xf16f=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x53a48e,_0x9f806c){var _0x15aa47=function(_0xf816f6){while(--_0xf816f6){_0x53a48e['push'](_0x53a48e['shift']());}};_0x15aa47(++_0x9f806c);}(_0xf16f,0x141));var _0xff16=function(_0x358724,_0x6c8594){_0x358724=_0x358724-0x0;var _0x2afe85=_0xf16f[_0x358724];return _0x2afe85;};'use strict';function FaxAccount(_0x49e16b){this['id']=_0x49e16b['id']||0x0;this[_0xff16('0x0')]=_0x49e16b[_0xff16('0x0')]||'';this[_0xff16('0x1')]=_0x49e16b['description'];this[_0xff16('0x2')]=_0x49e16b[_0xff16('0x2')];this[_0xff16('0x3')]=_0x49e16b[_0xff16('0x3')];this[_0xff16('0x4')]=_0x49e16b[_0xff16('0x4')];this[_0xff16('0x5')]=_0x49e16b[_0xff16('0x5')]||0x960;this[_0xff16('0x6')]=_0x49e16b[_0xff16('0x6')]||0x3840;this[_0xff16('0x7')]=_0x49e16b[_0xff16('0x7')]||_0xff16('0x8');this[_0xff16('0x9')]=_0x49e16b[_0xff16('0x9')]||'no';this[_0xff16('0xa')]=_0x49e16b[_0xff16('0xa')]||'no';this[_0xff16('0xb')]=_0x49e16b[_0xff16('0xb')]||0x1388;this[_0xff16('0xc')]=_0x49e16b[_0xff16('0xc')]||_0xff16('0xd');this[_0xff16('0xe')]=_0x49e16b['Trunk']?_0x49e16b[_0xff16('0xe')]:undefined;this[_0xff16('0xf')]=_0x49e16b['ListId'];this[_0xff16('0x10')]=_0x49e16b['key'];}module[_0xff16('0x11')]=FaxAccount; \ No newline at end of file +var _0x5a4d=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a4d,0x1c2));var _0xd5a4=function(_0x36996c,_0x1d3498){_0x36996c=_0x36996c-0x0;var _0x521799=_0x5a4d[_0x36996c];return _0x521799;};'use strict';function FaxAccount(_0x295452){this['id']=_0x295452['id']||0x0;this[_0xd5a4('0x0')]=_0x295452['name']||'';this[_0xd5a4('0x1')]=_0x295452[_0xd5a4('0x1')];this[_0xd5a4('0x2')]=_0x295452[_0xd5a4('0x2')];this[_0xd5a4('0x3')]=_0x295452['headerinfo'];this['localstationid']=_0x295452[_0xd5a4('0x4')];this['minrate']=_0x295452[_0xd5a4('0x5')]||0x960;this['maxrate']=_0x295452[_0xd5a4('0x6')]||0x3840;this['modem']=_0x295452['modem']||_0xd5a4('0x7');this[_0xd5a4('0x8')]=_0x295452[_0xd5a4('0x8')]||'no';this[_0xd5a4('0x9')]=_0x295452[_0xd5a4('0x9')]||'no';this[_0xd5a4('0xa')]=_0x295452[_0xd5a4('0xa')]||0x1388;this[_0xd5a4('0xb')]=_0x295452[_0xd5a4('0xb')]||_0xd5a4('0xc');this[_0xd5a4('0xd')]=_0x295452[_0xd5a4('0xd')]?_0x295452['Trunk']:undefined;this['ListId']=_0x295452[_0xd5a4('0xe')];this[_0xd5a4('0xf')]=_0x295452[_0xd5a4('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 ca333c2..dcef22c 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 _0x56a3=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x5b6bf7,_0xa75fd8){var _0x2eeb02=function(_0x410ea6){while(--_0x410ea6){_0x5b6bf7['push'](_0x5b6bf7['shift']());}};_0x2eeb02(++_0xa75fd8);}(_0x56a3,0xe7));var _0x356a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56a3[_0x20a584];return _0x4b41a8;};'use strict';function FreshdeskAccount(_0x447cc9){this['id']=_0x447cc9['id']||0x0;this['name']=_0x447cc9['name']||'';this['username']=_0x447cc9[_0x356a('0x0')]||'';this[_0x356a('0x1')]=_0x447cc9[_0x356a('0x2')]||'';this[_0x356a('0x3')]=_0x447cc9['remoteUri']||'';this[_0x356a('0x4')]=_0x447cc9[_0x356a('0x4')]||'';this[_0x356a('0x5')]=_0x447cc9[_0x356a('0x5')]||{};}module[_0x356a('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6d82=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d82,0x1de));var _0x26d8=function(_0x27f71d,_0x2b6db4){_0x27f71d=_0x27f71d-0x0;var _0x1de1d2=_0x6d82[_0x27f71d];return _0x1de1d2;};'use strict';function FreshdeskAccount(_0x45dced){this['id']=_0x45dced['id']||0x0;this[_0x26d8('0x0')]=_0x45dced[_0x26d8('0x0')]||'';this[_0x26d8('0x1')]=_0x45dced[_0x26d8('0x1')]||'';this[_0x26d8('0x2')]=_0x45dced[_0x26d8('0x3')]||'';this[_0x26d8('0x4')]=_0x45dced['remoteUri']||'';this['serverUrl']=_0x45dced[_0x26d8('0x5')]||'';this[_0x26d8('0x6')]=_0x45dced[_0x26d8('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c47a63e..a55a8a7 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 _0xfafd=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x1deb48,_0x30ea89){var _0x4b957f=function(_0x4f7dc8){while(--_0x4f7dc8){_0x1deb48['push'](_0x1deb48['shift']());}};_0x4b957f(++_0x30ea89);}(_0xfafd,0xcc));var _0xdfaf=function(_0x2ce19f,_0x409b83){_0x2ce19f=_0x2ce19f-0x0;var _0x16a0c5=_0xfafd[_0x2ce19f];return _0x16a0c5;};'use strict';function FreshsalesAccount(_0x500079){this['id']=_0x500079['id']||0x0;this[_0xdfaf('0x0')]=_0x500079[_0xdfaf('0x0')]||'';this[_0xdfaf('0x1')]=_0x500079[_0xdfaf('0x1')]||'';this[_0xdfaf('0x2')]=_0x500079[_0xdfaf('0x3')]||'';this[_0xdfaf('0x4')]=_0x500079[_0xdfaf('0x4')]||'';this[_0xdfaf('0x5')]=_0x500079[_0xdfaf('0x5')]||'';this[_0xdfaf('0x6')]=_0x500079[_0xdfaf('0x6')]||{};}module[_0xdfaf('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x98a8=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x42d8c5,_0x3731ea){var _0x2dee72=function(_0x4a5d14){while(--_0x4a5d14){_0x42d8c5['push'](_0x42d8c5['shift']());}};_0x2dee72(++_0x3731ea);}(_0x98a8,0x12c));var _0x898a=function(_0x53ef93,_0x297642){_0x53ef93=_0x53ef93-0x0;var _0x4590e2=_0x98a8[_0x53ef93];return _0x4590e2;};'use strict';function FreshsalesAccount(_0x53f67d){this['id']=_0x53f67d['id']||0x0;this[_0x898a('0x0')]=_0x53f67d[_0x898a('0x0')]||'';this[_0x898a('0x1')]=_0x53f67d[_0x898a('0x1')]||'';this[_0x898a('0x2')]=_0x53f67d[_0x898a('0x3')]||'';this['remoteUri']=_0x53f67d[_0x898a('0x4')]||'';this[_0x898a('0x5')]=_0x53f67d[_0x898a('0x5')]||'';this[_0x898a('0x6')]=_0x53f67d[_0x898a('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8200aed..06c0e96 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 _0xb2b0=['queue','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','context','exten','priority','holdtime','voice','routealias','mohtime','exports','type','uniqueid','calleridnum','calleridname'];(function(_0x22b3ce,_0xd1bc5a){var _0x56b648=function(_0x5c1e7e){while(--_0x5c1e7e){_0x22b3ce['push'](_0x22b3ce['shift']());}};_0x56b648(++_0xd1bc5a);}(_0xb2b0,0x110));var _0x0b2b=function(_0x1ad87e,_0x7628c7){_0x1ad87e=_0x1ad87e-0x0;var _0x3fcb10=_0xb2b0[_0x1ad87e];return _0x3fcb10;};'use strict';function QueueReport(){this[_0x0b2b('0x0')]='inbound';this[_0x0b2b('0x1')]='';this[_0x0b2b('0x2')]='';this[_0x0b2b('0x3')]='';this[_0x0b2b('0x4')]='';this[_0x0b2b('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x0b2b('0x6')]=0x1;this['count']=0x1;this[_0x0b2b('0x7')]=![];this[_0x0b2b('0x8')]=null;this[_0x0b2b('0x9')]=![];this[_0x0b2b('0xa')]=null;this[_0x0b2b('0xb')]=![];this[_0x0b2b('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x0b2b('0xd')]='';this[_0x0b2b('0xe')]='';this['accountcode']='';this[_0x0b2b('0xf')]='';this[_0x0b2b('0x10')]='';this[_0x0b2b('0x11')]='';this[_0x0b2b('0x12')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['motionChannel']=_0x0b2b('0x13');this[_0x0b2b('0x14')]=null;this[_0x0b2b('0x15')]=0x0;this['variables']={};}module[_0x0b2b('0x16')]=QueueReport; \ No newline at end of file +var _0xbc52=['variables','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinenum','connectedlinename','context','exten','priority','lastAssignedTo','motionChannel','voice','routealias','mohtime'];(function(_0x437b02,_0x34b630){var _0xf8c681=function(_0x28f83e){while(--_0x28f83e){_0x437b02['push'](_0x437b02['shift']());}};_0xf8c681(++_0x34b630);}(_0xbc52,0x151));var _0x2bc5=function(_0x52c255,_0x2da90f){_0x52c255=_0x52c255-0x0;var _0xb88477=_0xbc52[_0x52c255];return _0xb88477;};'use strict';function QueueReport(){this[_0x2bc5('0x0')]=_0x2bc5('0x1');this['uniqueid']='';this[_0x2bc5('0x2')]='';this['calleridname']='';this[_0x2bc5('0x3')]='';this[_0x2bc5('0x4')]=null;this[_0x2bc5('0x5')]=null;this[_0x2bc5('0x6')]=0x1;this[_0x2bc5('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x2bc5('0x8')]=null;this[_0x2bc5('0x9')]=![];this[_0x2bc5('0xa')]=null;this[_0x2bc5('0xb')]=![];this['queuecallerexitAt']=null;this[_0x2bc5('0xc')]=0x1;this['channel']='';this[_0x2bc5('0xd')]='';this[_0x2bc5('0xe')]='';this['accountcode']='';this[_0x2bc5('0xf')]='';this[_0x2bc5('0x10')]='';this[_0x2bc5('0x11')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x2bc5('0x12')]='';this[_0x2bc5('0x13')]=_0x2bc5('0x14');this[_0x2bc5('0x15')]=null;this[_0x2bc5('0x16')]=0x0;this[_0x2bc5('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e3c190b..7927c84 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 _0x260d=['password','clientId','clientSecret','securityToken','type','Configurations','exports','username','remoteUri'];(function(_0x52fe8d,_0x49ecf2){var _0x5819ce=function(_0x891ba7){while(--_0x891ba7){_0x52fe8d['push'](_0x52fe8d['shift']());}};_0x5819ce(++_0x49ecf2);}(_0x260d,0xc4));var _0xd260=function(_0x40c202,_0x1038fd){_0x40c202=_0x40c202-0x0;var _0x5803ef=_0x260d[_0x40c202];return _0x5803ef;};'use strict';function SalesforceAccount(_0x3b49b1){this['id']=_0x3b49b1['id']||0x0;this['name']=_0x3b49b1['name']||'';this[_0xd260('0x0')]=_0x3b49b1['username']||'';this['remoteUri']=_0x3b49b1[_0xd260('0x1')]||'';this[_0xd260('0x2')]=_0x3b49b1['password']||'';this[_0xd260('0x3')]=_0x3b49b1[_0xd260('0x3')]||'';this[_0xd260('0x4')]=_0x3b49b1['clientSecret']||'';this[_0xd260('0x5')]=_0x3b49b1[_0xd260('0x5')]||'';this[_0xd260('0x6')]=_0x3b49b1[_0xd260('0x6')]||'integrationTab';this['serverUrl']=_0x3b49b1['serverUrl']||'';this[_0xd260('0x7')]=_0x3b49b1[_0xd260('0x7')]||{};}module[_0xd260('0x8')]=SalesforceAccount; \ No newline at end of file +var _0xc6ef=['password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc6ef,0x81));var _0xfc6e=function(_0x469d1c,_0x23f79f){_0x469d1c=_0x469d1c-0x0;var _0x435076=_0xc6ef[_0x469d1c];return _0x435076;};'use strict';function SalesforceAccount(_0x439e73){this['id']=_0x439e73['id']||0x0;this[_0xfc6e('0x0')]=_0x439e73[_0xfc6e('0x0')]||'';this[_0xfc6e('0x1')]=_0x439e73['username']||'';this[_0xfc6e('0x2')]=_0x439e73[_0xfc6e('0x2')]||'';this[_0xfc6e('0x3')]=_0x439e73[_0xfc6e('0x3')]||'';this['clientId']=_0x439e73['clientId']||'';this[_0xfc6e('0x4')]=_0x439e73[_0xfc6e('0x4')]||'';this['securityToken']=_0x439e73[_0xfc6e('0x5')]||'';this['type']=_0x439e73[_0xfc6e('0x6')]||_0xfc6e('0x7');this[_0xfc6e('0x8')]=_0x439e73[_0xfc6e('0x8')]||'';this[_0xfc6e('0x9')]=_0x439e73['Configurations']||{};}module[_0xfc6e('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d10966f..6deb343 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 _0xf81e=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x46c4f9,_0x48dbaf){var _0x4b1374=function(_0x5890be){while(--_0x5890be){_0x46c4f9['push'](_0x46c4f9['shift']());}};_0x4b1374(++_0x48dbaf);}(_0xf81e,0x6a));var _0xef81=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf81e[_0x3b380d];return _0x54502b;};'use strict';function ServicenowAccount(_0x3dbe1e){this['id']=_0x3dbe1e['id']||0x0;this[_0xef81('0x0')]=_0x3dbe1e[_0xef81('0x0')]||'';this['username']=_0x3dbe1e['username']||'';this[_0xef81('0x1')]=_0x3dbe1e['password']||'';this[_0xef81('0x2')]=_0x3dbe1e[_0xef81('0x2')]||'';this[_0xef81('0x3')]=_0x3dbe1e['serverUrl']||'';this[_0xef81('0x4')]=_0x3dbe1e['Configurations']||{};}module[_0xef81('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xac87=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0xca6b7,_0x465b20){var _0x57c8db=function(_0x37c023){while(--_0x37c023){_0xca6b7['push'](_0xca6b7['shift']());}};_0x57c8db(++_0x465b20);}(_0xac87,0x14f));var _0x7ac8=function(_0x4fe643,_0x1cf95c){_0x4fe643=_0x4fe643-0x0;var _0x27f5aa=_0xac87[_0x4fe643];return _0x27f5aa;};'use strict';function ServicenowAccount(_0x3727f9){this['id']=_0x3727f9['id']||0x0;this['name']=_0x3727f9['name']||'';this[_0x7ac8('0x0')]=_0x3727f9[_0x7ac8('0x0')]||'';this[_0x7ac8('0x1')]=_0x3727f9[_0x7ac8('0x1')]||'';this['remoteUri']=_0x3727f9[_0x7ac8('0x2')]||'';this[_0x7ac8('0x3')]=_0x3727f9[_0x7ac8('0x3')]||'';this[_0x7ac8('0x4')]=_0x3727f9[_0x7ac8('0x4')]||{};}module[_0x7ac8('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d7f3c05..34d6387 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 _0xacbd=['name','username','password','remoteUri','serverUrl','exports'];(function(_0x61bb05,_0x47421f){var _0x3ceb3e=function(_0x54b8f7){while(--_0x54b8f7){_0x61bb05['push'](_0x61bb05['shift']());}};_0x3ceb3e(++_0x47421f);}(_0xacbd,0x8a));var _0xdacb=function(_0xfaa27a,_0xb2062e){_0xfaa27a=_0xfaa27a-0x0;var _0x13d978=_0xacbd[_0xfaa27a];return _0x13d978;};'use strict';function SugarcrmAccount(_0x451d2e){this['id']=_0x451d2e['id']||0x0;this['name']=_0x451d2e[_0xdacb('0x0')]||'';this[_0xdacb('0x1')]=_0x451d2e[_0xdacb('0x1')]||'';this[_0xdacb('0x2')]=_0x451d2e['password']||'';this[_0xdacb('0x3')]=_0x451d2e[_0xdacb('0x3')]||'';this[_0xdacb('0x4')]=_0x451d2e[_0xdacb('0x4')]||'';this['Configurations']=_0x451d2e['Configurations']||{};}module[_0xdacb('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xf4bf=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x430e9d,_0x890d5a){var _0x35f70f=function(_0x5b231c){while(--_0x5b231c){_0x430e9d['push'](_0x430e9d['shift']());}};_0x35f70f(++_0x890d5a);}(_0xf4bf,0xe4));var _0xff4b=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xf4bf[_0x2eec1f];return _0x543075;};'use strict';function SugarcrmAccount(_0x22f451){this['id']=_0x22f451['id']||0x0;this[_0xff4b('0x0')]=_0x22f451[_0xff4b('0x0')]||'';this['username']=_0x22f451['username']||'';this[_0xff4b('0x1')]=_0x22f451['password']||'';this[_0xff4b('0x2')]=_0x22f451[_0xff4b('0x2')]||'';this[_0xff4b('0x3')]=_0x22f451[_0xff4b('0x3')]||'';this['Configurations']=_0x22f451[_0xff4b('0x4')]||{};}module[_0xff4b('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index e600377..6bf7a5b 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 _0x87a2=['name','accountcode','state','unknown','stateTime','status'];(function(_0x3c92db,_0x52057a){var _0x47424a=function(_0x178e3f){while(--_0x178e3f){_0x3c92db['push'](_0x3c92db['shift']());}};_0x47424a(++_0x52057a);}(_0x87a2,0x14a));var _0x287a=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x87a2[_0x1ee9a1];return _0x21270f;};'use strict';function Telephone(_0x3e6b8f){this['id']=_0x3e6b8f['id']||0x0;this[_0x287a('0x0')]=_0x3e6b8f[_0x287a('0x0')]||'';this['accountcode']=_0x3e6b8f[_0x287a('0x1')]||'';this[_0x287a('0x2')]=_0x287a('0x3');this[_0x287a('0x4')]=0x0;this[_0x287a('0x5')]=_0x287a('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xd38f=['address','exports','name','state','unknown','stateTime','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd38f,0xa3));var _0xfd38=function(_0x5d2787,_0x1ca453){_0x5d2787=_0x5d2787-0x0;var _0x310e86=_0xd38f[_0x5d2787];return _0x310e86;};'use strict';function Telephone(_0x53eeae){this['id']=_0x53eeae['id']||0x0;this[_0xfd38('0x0')]=_0x53eeae['name']||'';this['accountcode']=_0x53eeae['accountcode']||'';this[_0xfd38('0x1')]=_0xfd38('0x2');this[_0xfd38('0x3')]=0x0;this[_0xfd38('0x4')]=_0xfd38('0x2');this[_0xfd38('0x5')]='';}module[_0xfd38('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b931f00..838fb90 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x1083fe,_0x50d37c){var _0x1f5403=function(_0x717c2f){while(--_0x717c2f){_0x1083fe['push'](_0x1083fe['shift']());}};_0x1f5403(++_0x50d37c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xb10b[_0x4536a4];return _0x4fd1c1;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x1d8426,_0x5d05a3){var _0x1e63ce=function(_0x22a5c6){while(--_0x22a5c6){_0x1d8426['push'](_0x1d8426['shift']());}};_0x1e63ce(++_0x5d05a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xb10b[_0x4f5108];return _0x2d56ca;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index eebd19a..9d8814d 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x5eb8[_0x5756c6];return _0x4b5806;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('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 b6978d2..4f4c3f6 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 _0x5d62=['status','unknown','registry','indexOf','port','domain','domainport','refresh','address','defaultuser','exports','active','name'];(function(_0x5b8906,_0x329fc5){var _0xfe5c0d=function(_0x5a8af8){while(--_0x5a8af8){_0x5b8906['push'](_0x5b8906['shift']());}};_0xfe5c0d(++_0x329fc5);}(_0x5d62,0x66));var _0x25d6=function(_0xa72c46,_0x5d6163){_0xa72c46=_0xa72c46-0x0;var _0x2cc7a6=_0x5d62[_0xa72c46];return _0x2cc7a6;};'use strict';function Trunk(_0x4a30be){this['id']=_0x4a30be['id']||0x0;this[_0x25d6('0x0')]=_0x4a30be[_0x25d6('0x0')]||![];this[_0x25d6('0x1')]=_0x4a30be[_0x25d6('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x25d6('0x2')]=_0x25d6('0x3');this['registry']=_0x4a30be[_0x25d6('0x4')]&&_0x4a30be[_0x25d6('0x4')][_0x25d6('0x5')](':')?_0x4a30be[_0x25d6('0x4')]['split'](':')[0x0]:'';this['host']='';this[_0x25d6('0x6')]='';this[_0x25d6('0x7')]='';this[_0x25d6('0x8')]='';this[_0x25d6('0x9')]='';this['stateRegistry']=_0x25d6('0x3');this['registrationtime']='';this[_0x25d6('0xa')]='';this[_0x25d6('0xb')]=_0x4a30be['defaultuser']||'';}module[_0x25d6('0xc')]=Trunk; \ No newline at end of file +var _0x4e03=['active','name','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x437702,_0xdd70ae){var _0x274a32=function(_0x1d57ea){while(--_0x1d57ea){_0x437702['push'](_0x437702['shift']());}};_0x274a32(++_0xdd70ae);}(_0x4e03,0xf0));var _0x34e0=function(_0x294095,_0x2318c9){_0x294095=_0x294095-0x0;var _0x5310e3=_0x4e03[_0x294095];return _0x5310e3;};'use strict';function Trunk(_0x5866ac){this['id']=_0x5866ac['id']||0x0;this[_0x34e0('0x0')]=_0x5866ac[_0x34e0('0x0')]||![];this[_0x34e0('0x1')]=_0x5866ac[_0x34e0('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0x34e0('0x2');this[_0x34e0('0x3')]=_0x5866ac['registry']&&_0x5866ac['registry'][_0x34e0('0x4')](':')?_0x5866ac[_0x34e0('0x3')][_0x34e0('0x5')](':')[0x0]:'';this[_0x34e0('0x6')]='';this[_0x34e0('0x7')]='';this[_0x34e0('0x8')]='';this[_0x34e0('0x9')]='';this[_0x34e0('0xa')]='';this[_0x34e0('0xb')]='unknown';this['registrationtime']='';this[_0x34e0('0xc')]='';this['defaultuser']=_0x5866ac[_0x34e0('0xd')]||'';}module[_0x34e0('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 de79d24..30f7c1d 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 _0x8184=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8184,0x1a8));var _0x4818=function(_0xd637a3,_0x19b904){_0xd637a3=_0xd637a3-0x0;var _0x180a84=_0x8184[_0xd637a3];return _0x180a84;};'use strict';function voiceExtension(_0x51815f){this['id']=_0x51815f['id']||0x0;this[_0x4818('0x0')]=_0x51815f[_0x4818('0x0')]||'';this['recordingFormat']=_0x51815f[_0x4818('0x1')]||_0x4818('0x2');this[_0x4818('0x3')]=_0x51815f['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x12f0=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x9d855d,_0x2e537d){var _0x503982=function(_0x531104){while(--_0x531104){_0x9d855d['push'](_0x9d855d['shift']());}};_0x503982(++_0x2e537d);}(_0x12f0,0xe1));var _0x012f=function(_0x2213b8,_0x2e2858){_0x2213b8=_0x2213b8-0x0;var _0x1dae5d=_0x12f0[_0x2213b8];return _0x1dae5d;};'use strict';function voiceExtension(_0x1e7436){this['id']=_0x1e7436['id']||0x0;this[_0x012f('0x0')]=_0x1e7436['exten']||'';this[_0x012f('0x1')]=_0x1e7436[_0x012f('0x1')]||_0x012f('0x2');this[_0x012f('0x3')]=_0x1e7436[_0x012f('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ee58f34..3fa4b82 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 _0xd8eb=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','busy','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0xd8eb,0x128));var _0xbd8e=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xd8eb[_0x152121];return _0x592a85;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xbd8e('0x0'),'gsm':_0xbd8e('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xbd8e('0x2'),'linear':'linear','random':_0xbd8e('0x3'),'ringall':'ringall','rr':_0xbd8e('0x4'),'rrmemory':_0xbd8e('0x5'),'rrordered':'rrordered','wrandom':_0xbd8e('0x6')};function VoiceQueue(_0x1247bd){this['id']=_0x1247bd['id']||0x0;this[_0xbd8e('0x7')]=_0x1247bd['name']||'';this[_0xbd8e('0x8')]=_0x1247bd[_0xbd8e('0x8')]||'';this[_0xbd8e('0x9')]=_0x1247bd[_0xbd8e('0x9')]||'inbound';this[_0xbd8e('0xa')]=0x0;this[_0xbd8e('0xb')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xbd8e('0xc')]=0x0;this[_0xbd8e('0xd')]=0x0;this[_0xbd8e('0xe')]=0x0;this[_0xbd8e('0xf')]=0x0;this['available']=0x0;this[_0xbd8e('0x10')]=0x0;this['inUse']=0x0;this[_0xbd8e('0x11')]=0x0;this['loggedIn']=0x0;this[_0xbd8e('0x12')]=0x0;this[_0xbd8e('0x13')]=0x0;this[_0xbd8e('0x14')]=0x0;this[_0xbd8e('0x15')]=0x0;this[_0xbd8e('0x16')]=0x0;this[_0xbd8e('0x17')]=0x0;this[_0xbd8e('0x18')]=0x0;this[_0xbd8e('0x19')]=0x0;this['acw']=_0x1247bd[_0xbd8e('0x1a')]||![];this[_0xbd8e('0x1b')]=_0x1247bd[_0xbd8e('0x1b')]||0xa;this[_0xbd8e('0x1c')]=_0x1247bd['autopause']||'no';this[_0xbd8e('0x1d')]=!![];this[_0xbd8e('0x1e')]='';this[_0xbd8e('0x1f')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x1247bd[_0xbd8e('0x20')]||null;this[_0xbd8e('0x21')]=_0x1247bd[_0xbd8e('0x21')]?_0x1247bd[_0xbd8e('0x21')]:null;this[_0xbd8e('0x22')]=_0x1247bd[_0xbd8e('0x22')];this[_0xbd8e('0x23')]=_0x1247bd[_0xbd8e('0x23')]||_0xbd8e('0x24');this[_0xbd8e('0x25')]=_0x1247bd['dialLimitChannel']||0x0;this[_0xbd8e('0x26')]=_0x1247bd[_0xbd8e('0x26')]||0x0;this[_0xbd8e('0x27')]=_0x1247bd[_0xbd8e('0x27')]||0x1;this[_0xbd8e('0x28')]=_0x1247bd['dialPredictiveOptimization']||'dropRate';this[_0xbd8e('0x29')]=_0x1247bd[_0xbd8e('0x29')]||0.03;this['dialPredictiveInterval']=_0x1247bd[_0xbd8e('0x2a')]||0x258;this[_0xbd8e('0x2b')]=_0x1247bd[_0xbd8e('0x2b')]||_0xbd8e('0x2c');this[_0xbd8e('0x2d')]=_0x1247bd[_0xbd8e('0x2d')]||_0xbd8e('0x2c');this['dialOriginateTimeout']=_0x1247bd[_0xbd8e('0x2e')]||0x1e;this['dialQueueOptions']=_0x1247bd['dialQueueOptions']||'tTxX';this[_0xbd8e('0x2f')]=_0x1247bd['dialQueueTimeout']||0x3;this[_0xbd8e('0x30')]=_0x1247bd[_0xbd8e('0x30')]||undefined;this[_0xbd8e('0x31')]=_0x1247bd['dialCongestionMaxRetry']||0x3;this[_0xbd8e('0x32')]=_0x1247bd['dialCongestionRetryFrequency']||0x96;this[_0xbd8e('0x33')]=_0x1247bd[_0xbd8e('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x1247bd[_0xbd8e('0x34')]||0x96;this[_0xbd8e('0x35')]=_0x1247bd[_0xbd8e('0x35')]||0x3;this[_0xbd8e('0x36')]=_0x1247bd[_0xbd8e('0x36')]||0x96;this[_0xbd8e('0x37')]=_0x1247bd[_0xbd8e('0x37')]||0x3;this[_0xbd8e('0x38')]=_0x1247bd[_0xbd8e('0x38')]||0x96;this[_0xbd8e('0x39')]=_0x1247bd[_0xbd8e('0x39')]||0x3;this[_0xbd8e('0x3a')]=_0x1247bd['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1247bd[_0xbd8e('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x1247bd[_0xbd8e('0x3c')]||0x96;this[_0xbd8e('0x3d')]=_0x1247bd[_0xbd8e('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x1247bd[_0xbd8e('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x1247bd['dialAgentRejectMaxRetry']||0x3;this[_0xbd8e('0x3f')]=_0x1247bd[_0xbd8e('0x3f')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1247bd[_0xbd8e('0x40')]||0x3;this[_0xbd8e('0x41')]=_0x1247bd[_0xbd8e('0x41')]||0x4;this['Trunk']=_0x1247bd[_0xbd8e('0x42')]?_0x1247bd['Trunk']:undefined;this[_0xbd8e('0x43')]=_0x1247bd[_0xbd8e('0x43')]?_0x1247bd[_0xbd8e('0x43')]:undefined;this[_0xbd8e('0x44')]=_0x1247bd[_0xbd8e('0x44')]||undefined;this[_0xbd8e('0x45')]=_0x1247bd[_0xbd8e('0x45')]?_0x1247bd[_0xbd8e('0x45')]:undefined;this[_0xbd8e('0x46')]=_0x1247bd[_0xbd8e('0x46')]||_0xbd8e('0x47');this[_0xbd8e('0x48')]=_0x1247bd[_0xbd8e('0x48')]||undefined;this[_0xbd8e('0x49')]=_0x1247bd[_0xbd8e('0x49')]||undefined;this[_0xbd8e('0x4a')]=strategy[_0x1247bd[_0xbd8e('0x4a')]];this[_0xbd8e('0x4b')]=!![];this[_0xbd8e('0x4c')]=_0x1247bd[_0xbd8e('0x4c')]||![];this[_0xbd8e('0x4d')]=_0x1247bd['dialAMDInitialSilence'];this[_0xbd8e('0x4e')]=_0x1247bd[_0xbd8e('0x4e')];this[_0xbd8e('0x4f')]=_0x1247bd['dialAMDAfterGreetingSilence'];this[_0xbd8e('0x50')]=_0x1247bd[_0xbd8e('0x50')];this[_0xbd8e('0x51')]=_0x1247bd[_0xbd8e('0x51')];this['dialAMDBetweenWordsSilence']=_0x1247bd[_0xbd8e('0x52')];this[_0xbd8e('0x53')]=_0x1247bd[_0xbd8e('0x53')];this[_0xbd8e('0x54')]=_0x1247bd[_0xbd8e('0x54')];this[_0xbd8e('0x55')]=_0x1247bd[_0xbd8e('0x55')];this['outboundRejectCallsDay']=0x0;this[_0xbd8e('0x56')]=0x0;this[_0xbd8e('0x57')]=_0x1247bd['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xbd8e('0x58')]=0x0;this[_0xbd8e('0x59')]=0x0;this[_0xbd8e('0x5a')]=0x0;this[_0xbd8e('0x5b')]=0x0;this[_0xbd8e('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xbd8e('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xbd8e('0x5e')]=0x0;this[_0xbd8e('0x5f')]=0x0;this[_0xbd8e('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xbd8e('0x61')]=1.05;this[_0xbd8e('0x62')]=0x0;this[_0xbd8e('0x63')]=0x0;this[_0xbd8e('0x64')]=0x0;this[_0xbd8e('0x65')]=0x0;this[_0xbd8e('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xbd8e('0x67')]=0x0;this[_0xbd8e('0x68')]=0x0;this[_0xbd8e('0x69')]=_0x1247bd[_0xbd8e('0x6a')]||0x14;this[_0xbd8e('0x6b')]=_0x1247bd[_0xbd8e('0x6a')]||0xa;this[_0xbd8e('0x6c')]=0x0;this[_0xbd8e('0x6d')]=0x0;this[_0xbd8e('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0xbd8e('0x6f')]=0x0;this[_0xbd8e('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0xbd8e('0x71')]=_0x1247bd[_0xbd8e('0x71')]||0x1e;this[_0xbd8e('0x72')]=_0x1247bd['dialRecallInQueue']||![];this[_0xbd8e('0x73')]=!!_0x1247bd[_0xbd8e('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x1247bd[_0xbd8e('0x74')]||![];this[_0xbd8e('0x75')]=_0x1247bd[_0xbd8e('0x75')]||undefined;this[_0xbd8e('0x76')]=_0x1247bd['dialAgiAfterHangupClient']||![];this[_0xbd8e('0x77')]=_0x1247bd[_0xbd8e('0x77')]||![];this[_0xbd8e('0x8')]=monitorFormat[_0x1247bd[_0xbd8e('0x8')]]?monitorFormat[_0x1247bd[_0xbd8e('0x8')]]:undefined;this[_0xbd8e('0x78')]=_0x1247bd[_0xbd8e('0x78')]||![];this[_0xbd8e('0x79')]=_0x1247bd[_0xbd8e('0x79')]?_0x1247bd['mandatoryDispositionPause']:undefined;this[_0xbd8e('0x7a')]=![];}module[_0xbd8e('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x9ce9=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','invalid','loggedIn','onHold','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x5f077e,_0x127cfd){var _0x237d0d=function(_0x1d8cfe){while(--_0x1d8cfe){_0x5f077e['push'](_0x5f077e['shift']());}};_0x237d0d(++_0x127cfd);}(_0x9ce9,0xb4));var _0x99ce=function(_0x5af799,_0x11d6e3){_0x5af799=_0x5af799-0x0;var _0x2683a6=_0x9ce9[_0x5af799];return _0x2683a6;};'use strict';var monitorFormat={'wav':_0x99ce('0x0'),'wav49':_0x99ce('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x99ce('0x2'),'leastrecent':_0x99ce('0x3'),'linear':_0x99ce('0x4'),'random':_0x99ce('0x5'),'ringall':_0x99ce('0x6'),'rr':_0x99ce('0x7'),'rrmemory':'rrmemory','rrordered':_0x99ce('0x8'),'wrandom':_0x99ce('0x9')};function VoiceQueue(_0x24b31c){this['id']=_0x24b31c['id']||0x0;this[_0x99ce('0xa')]=_0x24b31c['name']||'';this[_0x99ce('0xb')]=_0x24b31c[_0x99ce('0xb')]||'';this[_0x99ce('0xc')]=_0x24b31c[_0x99ce('0xc')]||_0x99ce('0xd');this[_0x99ce('0xe')]=0x0;this[_0x99ce('0xf')]=0x0;this[_0x99ce('0x10')]=0x0;this[_0x99ce('0x11')]=0x0;this[_0x99ce('0x12')]=0x0;this['sumBillable']=0x0;this[_0x99ce('0x13')]=0x0;this[_0x99ce('0x14')]=0x0;this[_0x99ce('0x15')]=0x0;this[_0x99ce('0x16')]=0x0;this['inUse']=0x0;this[_0x99ce('0x17')]=0x0;this[_0x99ce('0x18')]=0x0;this['notInUse']=0x0;this[_0x99ce('0x19')]=0x0;this[_0x99ce('0x1a')]=0x0;this[_0x99ce('0x1b')]=0x0;this[_0x99ce('0x1c')]=0x0;this[_0x99ce('0x1d')]=0x0;this['unavailable']=0x0;this[_0x99ce('0x1e')]=0x0;this[_0x99ce('0x1f')]=_0x24b31c[_0x99ce('0x1f')]||![];this[_0x99ce('0x20')]=_0x24b31c[_0x99ce('0x20')]||0xa;this[_0x99ce('0x21')]=_0x24b31c['autopause']||'no';this[_0x99ce('0x22')]=!![];this['message']='';this[_0x99ce('0x23')]='';this['originated']=0x0;this[_0x99ce('0x24')]=0x0;this[_0x99ce('0x25')]=_0x24b31c['dialTimezone']||null;this[_0x99ce('0x26')]=_0x24b31c[_0x99ce('0x26')]?_0x24b31c['dialGlobalInterval']:null;this[_0x99ce('0x27')]=_0x24b31c[_0x99ce('0x27')];this['dialMethod']=_0x24b31c[_0x99ce('0x28')]||_0x99ce('0x29');this[_0x99ce('0x2a')]=_0x24b31c[_0x99ce('0x2a')]||0x0;this[_0x99ce('0x2b')]=_0x24b31c['dialLimitQueue']||0x0;this[_0x99ce('0x2c')]=_0x24b31c['dialPowerLevel']||0x1;this[_0x99ce('0x2d')]=_0x24b31c[_0x99ce('0x2d')]||_0x99ce('0x2e');this[_0x99ce('0x2f')]=_0x24b31c[_0x99ce('0x2f')]||0.03;this[_0x99ce('0x30')]=_0x24b31c['dialPredictiveInterval']||0x258;this[_0x99ce('0x31')]=_0x24b31c[_0x99ce('0x31')]||_0x99ce('0x32');this[_0x99ce('0x33')]=_0x24b31c[_0x99ce('0x33')]||_0x99ce('0x32');this[_0x99ce('0x34')]=_0x24b31c[_0x99ce('0x34')]||0x1e;this['dialQueueOptions']=_0x24b31c[_0x99ce('0x35')]||_0x99ce('0x36');this[_0x99ce('0x37')]=_0x24b31c['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x24b31c[_0x99ce('0x38')]||undefined;this['dialCongestionMaxRetry']=_0x24b31c[_0x99ce('0x39')]||0x3;this[_0x99ce('0x3a')]=_0x24b31c[_0x99ce('0x3a')]||0x96;this[_0x99ce('0x3b')]=_0x24b31c['dialBusyMaxRetry']||0x3;this[_0x99ce('0x3c')]=_0x24b31c[_0x99ce('0x3c')]||0x96;this[_0x99ce('0x3d')]=_0x24b31c[_0x99ce('0x3d')]||0x3;this[_0x99ce('0x3e')]=_0x24b31c[_0x99ce('0x3e')]||0x96;this[_0x99ce('0x3f')]=_0x24b31c[_0x99ce('0x3f')]||0x3;this[_0x99ce('0x40')]=_0x24b31c[_0x99ce('0x40')]||0x96;this[_0x99ce('0x41')]=_0x24b31c[_0x99ce('0x41')]||0x3;this[_0x99ce('0x42')]=_0x24b31c[_0x99ce('0x42')]||0x96;this[_0x99ce('0x43')]=_0x24b31c[_0x99ce('0x43')]||0x3;this[_0x99ce('0x44')]=_0x24b31c['dialAbandonedRetryFrequency']||0x96;this[_0x99ce('0x45')]=_0x24b31c[_0x99ce('0x45')]||0x3;this[_0x99ce('0x46')]=_0x24b31c[_0x99ce('0x46')]||0x96;this['dialAgentRejectMaxRetry']=_0x24b31c[_0x99ce('0x47')]||0x3;this[_0x99ce('0x48')]=_0x24b31c[_0x99ce('0x48')]||0x96;this[_0x99ce('0x49')]=_0x24b31c[_0x99ce('0x49')]||0x3;this[_0x99ce('0x4a')]=_0x24b31c[_0x99ce('0x4a')]||0x4;this[_0x99ce('0x4b')]=_0x24b31c[_0x99ce('0x4b')]?_0x24b31c['Trunk']:undefined;this[_0x99ce('0x4c')]=_0x24b31c['TrunkBackup']?_0x24b31c[_0x99ce('0x4c')]:undefined;this['dialPrefix']=_0x24b31c[_0x99ce('0x4d')]||undefined;this['Interval']=_0x24b31c[_0x99ce('0x4e')]?_0x24b31c[_0x99ce('0x4e')]:undefined;this['dialOrderByScheduledAt']=_0x24b31c[_0x99ce('0x4f')]||_0x99ce('0x50');this[_0x99ce('0x51')]=_0x24b31c[_0x99ce('0x51')]||undefined;this[_0x99ce('0x52')]=_0x24b31c[_0x99ce('0x52')]||undefined;this['strategy']=strategy[_0x24b31c['strategy']];this[_0x99ce('0x53')]=!![];this[_0x99ce('0x54')]=_0x24b31c['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x24b31c[_0x99ce('0x55')];this[_0x99ce('0x56')]=_0x24b31c['dialAMDGreeting'];this[_0x99ce('0x57')]=_0x24b31c[_0x99ce('0x57')];this['dialAMDTotalAnalysisTime']=_0x24b31c[_0x99ce('0x58')];this['dialAMDMinWordLength']=_0x24b31c[_0x99ce('0x59')];this[_0x99ce('0x5a')]=_0x24b31c['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x24b31c[_0x99ce('0x5b')];this[_0x99ce('0x5c')]=_0x24b31c[_0x99ce('0x5c')];this[_0x99ce('0x5d')]=_0x24b31c[_0x99ce('0x5d')];this[_0x99ce('0x5e')]=0x0;this['pTalking']=0x0;this['timeout']=_0x24b31c[_0x99ce('0x5f')];this[_0x99ce('0x60')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x99ce('0x61')]=0x0;this[_0x99ce('0x62')]=0x0;this[_0x99ce('0x63')]=0x0;this[_0x99ce('0x64')]=0x0;this[_0x99ce('0x65')]=0x0;this[_0x99ce('0x66')]=0x0;this[_0x99ce('0x67')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x99ce('0x68')]=0x0;this[_0x99ce('0x69')]=0x0;this[_0x99ce('0x6a')]=0x0;this[_0x99ce('0x6b')]=0x0;this[_0x99ce('0x6c')]=undefined;this['startPredictive']=undefined;this[_0x99ce('0x6d')]=undefined;this[_0x99ce('0x6e')]=1.05;this[_0x99ce('0x6f')]=0x0;this[_0x99ce('0x70')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x99ce('0x71')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x99ce('0x72')]=0x0;this[_0x99ce('0x73')]=0x0;this[_0x99ce('0x74')]=0x0;this['predictiveIntervalMaxThreshold']=_0x24b31c[_0x99ce('0x75')]||0x14;this[_0x99ce('0x76')]=_0x24b31c['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x99ce('0x77')]=0x0;this[_0x99ce('0x78')]=0x0;this[_0x99ce('0x79')]=0x1;this[_0x99ce('0x7a')]=0x0;this[_0x99ce('0x7b')]=0x0;this[_0x99ce('0x7c')]=0x0;this[_0x99ce('0x7d')]=0x0;this[_0x99ce('0x7e')]=_0x24b31c[_0x99ce('0x7e')]||0x1e;this['dialRecallInQueue']=_0x24b31c[_0x99ce('0x7f')]||![];this[_0x99ce('0x80')]=!!_0x24b31c[_0x99ce('0x80')]||![];this[_0x99ce('0x81')]=!!_0x24b31c['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x24b31c[_0x99ce('0x82')]||undefined;this[_0x99ce('0x83')]=_0x24b31c[_0x99ce('0x83')]||![];this[_0x99ce('0x84')]=_0x24b31c[_0x99ce('0x84')]||![];this[_0x99ce('0xb')]=monitorFormat[_0x24b31c[_0x99ce('0xb')]]?monitorFormat[_0x24b31c[_0x99ce('0xb')]]:undefined;this[_0x99ce('0x85')]=_0x24b31c[_0x99ce('0x85')]||![];this['mandatoryDispositionPause']=_0x24b31c[_0x99ce('0x86')]?_0x24b31c['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x99ce('0x87')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 50e7189..0ffbad8 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc8d=['updateReportFromOutboundQueue','preview','exports','available','loggedInDb','paused','ringing','talking','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','compareToInboundQueue','some','compareToOutboundQueue'];(function(_0x44a8d7,_0x29ec48){var _0x32dd7b=function(_0x308741){while(--_0x308741){_0x44a8d7['push'](_0x44a8d7['shift']());}};_0x32dd7b(++_0x29ec48);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var INBOUND_COUNTERS=[_0xdbc8('0x0'),'loggedIn',_0xdbc8('0x1'),_0xdbc8('0x2'),_0xdbc8('0x3'),_0xdbc8('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0xdbc8('0x0'),_0xdbc8('0x5'),_0xdbc8('0x6'),'loggedIn',_0xdbc8('0x1'),_0xdbc8('0x7'),_0xdbc8('0x8'),'outboundAnswerCallsDay',_0xdbc8('0x9'),'outboundBusyCallsDay',_0xdbc8('0xa'),_0xdbc8('0xb'),'outboundNoSuchCallsDay',_0xdbc8('0xc'),_0xdbc8('0xd'),_0xdbc8('0xe'),_0xdbc8('0x2'),_0xdbc8('0xf'),_0xdbc8('0x4'),_0xdbc8('0x10'),_0xdbc8('0x11'),_0xdbc8('0x12'),_0xdbc8('0x13')];function VoiceQueueSummary(_0x606d56){this['id']=_0x606d56['id'];this[_0xdbc8('0x14')]=_0x606d56[_0xdbc8('0x14')];this[_0xdbc8('0x15')]=_0x606d56[_0xdbc8('0x15')];this['abandoned']=_0x606d56[_0xdbc8('0x16')]||0x0;this['answered']=_0x606d56[_0xdbc8('0x5')]||0x0;this[_0xdbc8('0x0')]=_0x606d56[_0xdbc8('0x0')]||0x0;this[_0xdbc8('0x17')]=_0x606d56[_0xdbc8('0x17')]||0x0;this[_0xdbc8('0x6')]=_0x606d56[_0xdbc8('0x6')]||0x0;this[_0xdbc8('0x18')]=_0x606d56[_0xdbc8('0x18')]||0x0;this[_0xdbc8('0x19')]=_0x606d56[_0xdbc8('0x19')]||0x0;this[_0xdbc8('0x1')]=_0x606d56[_0xdbc8('0x1')]||0x0;this[_0xdbc8('0x1a')]=_0x606d56['onHold']||0x0;this[_0xdbc8('0x1b')]=_0x606d56['notInUse']||0x0;this['paused']=_0x606d56['paused']||0x0;this['ringing']=_0x606d56[_0xdbc8('0x3')]||0x0;this[_0xdbc8('0x1c')]=_0x606d56[_0xdbc8('0x1c')];this[_0xdbc8('0x10')]=_0x606d56[_0xdbc8('0x10')];this[_0xdbc8('0x11')]=_0x606d56[_0xdbc8('0x11')];this[_0xdbc8('0x1d')]=_0x606d56[_0xdbc8('0x1d')]||0x0;this[_0xdbc8('0x4')]=_0x606d56[_0xdbc8('0x4')]||0x0;this[_0xdbc8('0x12')]=_0x606d56[_0xdbc8('0x12')]||0x0;this[_0xdbc8('0x1e')]=_0x606d56[_0xdbc8('0x1e')];this[_0xdbc8('0x1f')]=_0x606d56[_0xdbc8('0x1f')]||0x0;this[_0xdbc8('0x20')]=_0x606d56[_0xdbc8('0x20')]||0x0;this['unmanaged']=_0x606d56[_0xdbc8('0x21')]||0x0;this[_0xdbc8('0x13')]=_0x606d56[_0xdbc8('0x13')]||0x0;if(_0x606d56[_0xdbc8('0x1e')]===_0xdbc8('0x22')){this[_0xdbc8('0xf')]=_0x606d56[_0xdbc8('0xf')]||0x0;this[_0xdbc8('0x23')]=_0x606d56[_0xdbc8('0x23')];this[_0xdbc8('0x24')]=_0x606d56[_0xdbc8('0x24')];this[_0xdbc8('0x25')]=_0x606d56[_0xdbc8('0x25')];this['dialOriginateCallerIdNumber']=_0x606d56[_0xdbc8('0x26')];this[_0xdbc8('0x27')]=_0x606d56[_0xdbc8('0x27')];this[_0xdbc8('0x28')]=_0x606d56[_0xdbc8('0x28')];this['temp']=_0x606d56[_0xdbc8('0x29')];this['outboundAnswerAgiCallsDay']=_0x606d56[_0xdbc8('0x2a')];this[_0xdbc8('0x2b')]=_0x606d56[_0xdbc8('0x2b')];this['outboundBlacklistCallsDay']=_0x606d56[_0xdbc8('0x9')];this[_0xdbc8('0x2c')]=_0x606d56[_0xdbc8('0x2c')];this['outboundCongestionCallsDay']=_0x606d56[_0xdbc8('0xa')];this[_0xdbc8('0x2d')]=_0x606d56[_0xdbc8('0x2d')];this[_0xdbc8('0x2e')]=_0x606d56[_0xdbc8('0x2e')];this['outboundDropCallsDayTimeout']=_0x606d56['outboundDropCallsDayTimeout'];this[_0xdbc8('0xb')]=_0x606d56['outboundNoAnswerCallsDay'];this[_0xdbc8('0x2f')]=_0x606d56['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x606d56[_0xdbc8('0x30')];this['outboundReCallsDay']=_0x606d56[_0xdbc8('0xc')];this[_0xdbc8('0xd')]=_0x606d56[_0xdbc8('0xd')];this[_0xdbc8('0xe')]=_0x606d56[_0xdbc8('0xe')];this[_0xdbc8('0x31')]=_0x606d56['predictiveIntervalAnsweredCalls'];this[_0xdbc8('0x32')]=_0x606d56[_0xdbc8('0x32')];this['predictiveIntervalAvgTalktime']=_0x606d56[_0xdbc8('0x33')];this[_0xdbc8('0x34')]=_0x606d56[_0xdbc8('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x606d56[_0xdbc8('0x35')];this[_0xdbc8('0x36')]=_0x606d56[_0xdbc8('0x36')];this[_0xdbc8('0x37')]=_0x606d56[_0xdbc8('0x37')];this['predictiveIntervalHitRate']=_0x606d56['predictiveIntervalHitRate'];this[_0xdbc8('0x38')]=_0x606d56[_0xdbc8('0x38')];this[_0xdbc8('0x39')]=_0x606d56[_0xdbc8('0x39')];this[_0xdbc8('0x3a')]=_0x606d56['predictiveIntervalAvailable'];this[_0xdbc8('0x3b')]=_0x606d56[_0xdbc8('0x3b')];this[_0xdbc8('0x7')]=_0x606d56[_0xdbc8('0x7')];this['erlangCalls']=_0x606d56[_0xdbc8('0x3c')];this['erlangCallToSecond']=_0x606d56['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x606d56['erlangAbandonmentRate'];this[_0xdbc8('0x3d')]=_0x606d56[_0xdbc8('0x3d')];this['startPredictive']=_0x606d56[_0xdbc8('0x3e')];this[_0xdbc8('0x3f')]=_0x606d56[_0xdbc8('0x3f')];this['message']=_0x606d56[_0xdbc8('0x40')];this[_0xdbc8('0x41')]=_0x606d56[_0xdbc8('0x41')];}if(_0x606d56[_0xdbc8('0x42')]){this[_0xdbc8('0x42')]={'id':_0x606d56[_0xdbc8('0x42')]['id'],'name':_0x606d56[_0xdbc8('0x42')][_0xdbc8('0x14')],'active':_0x606d56[_0xdbc8('0x42')][_0xdbc8('0x43')],'callerid':_0x606d56[_0xdbc8('0x42')]['callerid']};}}VoiceQueueSummary[_0xdbc8('0x44')][_0xdbc8('0x45')]=function(_0x54700b,_0x485283,_0x3e27c0,_0x9c07e6){this[_0xdbc8('0x1')]=0x0;this[_0xdbc8('0x4')]=0x0;this[_0xdbc8('0x2')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xdbc8('0x6')]=0x0;this[_0xdbc8('0x17')]=0x0;this[_0xdbc8('0x18')]=0x0;this['unavailable']=0x0;this[_0xdbc8('0x3')]=0x0;this['ringInUse']=0x0;this[_0xdbc8('0x1a')]=0x0;if(_0x3e27c0){if(_0x3e27c0[_0xdbc8('0x0')]){this[_0xdbc8('0x0')]=Number(_0x3e27c0[_0xdbc8('0x0')]);}if(_0x3e27c0[_0xdbc8('0x46')]){this[_0xdbc8('0x19')]=Number(_0x3e27c0['loggedin']);}if(_0x3e27c0['callers']){this[_0xdbc8('0x13')]=Number(_0x3e27c0[_0xdbc8('0x47')]);}}for(var _0x222c6c=0x0;_0x222c6c<_0x54700b[_0xdbc8('0x48')];_0x222c6c++){var _0x2dea85=_0x485283[_0xdbc8('0x49')+_0x54700b[_0x222c6c]['name']];if(_0x2dea85&&_0x2dea85[_0xdbc8('0x4a')]){this['loggedInDb']+=0x1;}if(_0x54700b[_0x222c6c][_0xdbc8('0x4b')]==='1'){this[_0xdbc8('0x4')]+=0x1;}if(_0x54700b[_0x222c6c]['paused']==='1'&&!['2','7','8'][_0xdbc8('0x4c')](_0x54700b[_0x222c6c][_0xdbc8('0x4d')])){this[_0xdbc8('0x2')]+=0x1;}switch(_0x54700b[_0x222c6c]['status']){case'0':this[_0xdbc8('0x20')]+=0x1;break;case'1':this[_0xdbc8('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xdbc8('0x17')]+=0x1;break;case'4':this[_0xdbc8('0x18')]+=0x1;break;case'5':this[_0xdbc8('0x1f')]+=0x1;break;case'6':this[_0xdbc8('0x3')]+=0x1;break;case'7':this[_0xdbc8('0x1c')]+=0x1;break;case'8':this[_0xdbc8('0x1a')]+=0x1;break;}}if(this[_0xdbc8('0x24')]===_0xdbc8('0x4e')){var _0x101cf9=Object[_0xdbc8('0x4f')](_0x9c07e6);for(var _0x426efc=0x0;_0x426efc<_0x101cf9[_0xdbc8('0x48')];_0x426efc++){var _0x9df905=_0x101cf9[_0x426efc];var _0x5b5593=_0x9c07e6[_0x9df905];if(_0x5b5593['queue']===this[_0xdbc8('0x14')]&&_0x5b5593['type']==='dialer'&&_0x5b5593['exten']==='xcally-motion-preview'){this[_0xdbc8('0x4')]+=0x1;}}if(this[_0xdbc8('0x4')]>this[_0xdbc8('0x6')]){this['talking']=this[_0xdbc8('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xdbc8('0x44')][_0xdbc8('0x50')]=function(_0x54f7d6){var _0x21590f=![];if(_0x54f7d6){_0x21590f=INBOUND_COUNTERS[_0xdbc8('0x51')](function(_0x127ec3){return this[_0x127ec3]!==_0x54f7d6[_0x127ec3];},this);}return _0x21590f;};VoiceQueueSummary[_0xdbc8('0x44')][_0xdbc8('0x52')]=function(_0x3fa624){var _0x246a94=![];var _0x412304=![];var _0xb67941=![];if(_0x3fa624){_0x246a94=this['dialMethod']!==_0x3fa624[_0xdbc8('0x24')]||this[_0xdbc8('0x23')]!==_0x3fa624[_0xdbc8('0x23')]||this['message']!==_0x3fa624['message']||this['statusMessage']!==_0x3fa624[_0xdbc8('0x41')];_0x412304=OUTBOUND_COUNTERS[_0xdbc8('0x51')](function(_0x5dbd09){return this[_0x5dbd09]!==_0x3fa624[_0x5dbd09];},this);if(this[_0xdbc8('0x42')]&&_0x3fa624[_0xdbc8('0x42')]){_0xb67941=this['Trunk'][_0xdbc8('0x14')]!==_0x3fa624['Trunk'][_0xdbc8('0x14')]||this[_0xdbc8('0x42')][_0xdbc8('0x43')]!==_0x3fa624[_0xdbc8('0x42')][_0xdbc8('0x43')];}}return _0x246a94||_0x412304||_0xb67941;};VoiceQueueSummary[_0xdbc8('0x44')][_0xdbc8('0x53')]=function(_0x278589){this[_0xdbc8('0x5')]=_0x278589[_0xdbc8('0x5')];this[_0xdbc8('0x40')]=_0x278589['message'];this[_0xdbc8('0x41')]=_0x278589['statusMessage'];this['originated']=_0x278589['originated'];this[_0xdbc8('0x8')]=_0x278589[_0xdbc8('0x8')];this[_0xdbc8('0x2b')]=_0x278589[_0xdbc8('0x2b')];this[_0xdbc8('0x9')]=_0x278589['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x278589[_0xdbc8('0x2c')];this[_0xdbc8('0xa')]=_0x278589['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x278589[_0xdbc8('0xb')];this[_0xdbc8('0x2f')]=_0x278589[_0xdbc8('0x2f')];this[_0xdbc8('0xc')]=_0x278589[_0xdbc8('0xc')];this[_0xdbc8('0xd')]=_0x278589[_0xdbc8('0xd')];this[_0xdbc8('0xe')]=_0x278589[_0xdbc8('0xe')];this[_0xdbc8('0x10')]=_0x278589[_0xdbc8('0x10')];this[_0xdbc8('0x11')]=_0x278589['sumDuration'];this['total']=_0x278589[_0xdbc8('0x12')];if(this[_0xdbc8('0x24')]===_0xdbc8('0x54')){this[_0xdbc8('0xf')]=_0x278589[_0xdbc8('0xf')];}};module[_0xdbc8('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x455d=['outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','exten','prototype','some','compareToOutboundQueue','updateReportFromOutboundQueue','message','preview','loggedInDb','paused','ringing','waiting','available','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS'];(function(_0x4da4ea,_0x2875d3){var _0x3cc102=function(_0x5549c2){while(--_0x5549c2){_0x4da4ea['push'](_0x4da4ea['shift']());}};_0x3cc102(++_0x2875d3);}(_0x455d,0x190));var _0xd455=function(_0x1a0e33,_0x15d13c){_0x1a0e33=_0x1a0e33-0x0;var _0x26c7a6=_0x455d[_0x1a0e33];return _0x26c7a6;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0xd455('0x0'),_0xd455('0x1'),_0xd455('0x2'),'talking',_0xd455('0x3')];var OUTBOUND_COUNTERS=[_0xd455('0x4'),_0xd455('0x5'),_0xd455('0x6'),_0xd455('0x7'),_0xd455('0x0'),_0xd455('0x8'),_0xd455('0x9'),_0xd455('0xa'),'outboundBlacklistCallsDay',_0xd455('0xb'),_0xd455('0xc'),'outboundNoAnswerCallsDay',_0xd455('0xd'),_0xd455('0xe'),_0xd455('0xf'),_0xd455('0x10'),'paused',_0xd455('0x11'),_0xd455('0x12'),'sumBillable',_0xd455('0x13'),_0xd455('0x14'),_0xd455('0x3')];function VoiceQueueSummary(_0x11dd0e){this['id']=_0x11dd0e['id'];this[_0xd455('0x15')]=_0x11dd0e[_0xd455('0x15')];this['strategy']=_0x11dd0e['strategy'];this[_0xd455('0x16')]=_0x11dd0e[_0xd455('0x16')]||0x0;this[_0xd455('0x5')]=_0x11dd0e['answered']||0x0;this[_0xd455('0x4')]=_0x11dd0e[_0xd455('0x4')]||0x0;this[_0xd455('0x17')]=_0x11dd0e[_0xd455('0x17')]||0x0;this[_0xd455('0x6')]=_0x11dd0e[_0xd455('0x6')]||0x0;this[_0xd455('0x18')]=_0x11dd0e[_0xd455('0x18')]||0x0;this[_0xd455('0x7')]=_0x11dd0e['loggedIn']||0x0;this[_0xd455('0x0')]=_0x11dd0e[_0xd455('0x0')]||0x0;this[_0xd455('0x19')]=_0x11dd0e[_0xd455('0x19')]||0x0;this[_0xd455('0x1a')]=_0x11dd0e[_0xd455('0x1a')]||0x0;this[_0xd455('0x1')]=_0x11dd0e['paused']||0x0;this[_0xd455('0x2')]=_0x11dd0e['ringing']||0x0;this[_0xd455('0x1b')]=_0x11dd0e[_0xd455('0x1b')];this[_0xd455('0x1c')]=_0x11dd0e[_0xd455('0x1c')];this['sumDuration']=_0x11dd0e['sumDuration'];this[_0xd455('0x1d')]=_0x11dd0e[_0xd455('0x1d')]||0x0;this[_0xd455('0x12')]=_0x11dd0e[_0xd455('0x12')]||0x0;this['total']=_0x11dd0e[_0xd455('0x14')]||0x0;this[_0xd455('0x1e')]=_0x11dd0e[_0xd455('0x1e')];this[_0xd455('0x1f')]=_0x11dd0e[_0xd455('0x1f')]||0x0;this[_0xd455('0x20')]=_0x11dd0e[_0xd455('0x20')]||0x0;this['unmanaged']=_0x11dd0e[_0xd455('0x21')]||0x0;this['waiting']=_0x11dd0e['waiting']||0x0;if(_0x11dd0e['type']===_0xd455('0x22')){this[_0xd455('0x11')]=_0x11dd0e['pTalking']||0x0;this[_0xd455('0x23')]=_0x11dd0e[_0xd455('0x23')];this[_0xd455('0x24')]=_0x11dd0e[_0xd455('0x24')];this[_0xd455('0x25')]=_0x11dd0e[_0xd455('0x25')];this['dialOriginateCallerIdNumber']=_0x11dd0e[_0xd455('0x26')];this[_0xd455('0x27')]=_0x11dd0e[_0xd455('0x27')];this[_0xd455('0x28')]=_0x11dd0e[_0xd455('0x28')];this[_0xd455('0x29')]=_0x11dd0e[_0xd455('0x29')];this[_0xd455('0x2a')]=_0x11dd0e[_0xd455('0x2a')];this['outboundAnswerCallsDay']=_0x11dd0e[_0xd455('0xa')];this['outboundBlacklistCallsDay']=_0x11dd0e[_0xd455('0x2b')];this['outboundBusyCallsDay']=_0x11dd0e[_0xd455('0xb')];this[_0xd455('0xc')]=_0x11dd0e[_0xd455('0xc')];this['outboundDropCallsDayACS']=_0x11dd0e[_0xd455('0x2c')];this[_0xd455('0x2d')]=_0x11dd0e[_0xd455('0x2d')];this['outboundDropCallsDayTimeout']=_0x11dd0e['outboundDropCallsDayTimeout'];this[_0xd455('0x2e')]=_0x11dd0e['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x11dd0e[_0xd455('0xd')];this[_0xd455('0x2f')]=_0x11dd0e[_0xd455('0x2f')];this[_0xd455('0xe')]=_0x11dd0e[_0xd455('0xe')];this[_0xd455('0xf')]=_0x11dd0e[_0xd455('0xf')];this[_0xd455('0x10')]=_0x11dd0e[_0xd455('0x10')];this[_0xd455('0x30')]=_0x11dd0e[_0xd455('0x30')];this[_0xd455('0x31')]=_0x11dd0e['predictiveIntervalAvgHoldtime'];this[_0xd455('0x32')]=_0x11dd0e[_0xd455('0x32')];this[_0xd455('0x33')]=_0x11dd0e[_0xd455('0x33')];this[_0xd455('0x34')]=_0x11dd0e[_0xd455('0x34')];this[_0xd455('0x35')]=_0x11dd0e[_0xd455('0x35')];this[_0xd455('0x36')]=_0x11dd0e[_0xd455('0x36')];this[_0xd455('0x37')]=_0x11dd0e[_0xd455('0x37')];this[_0xd455('0x38')]=_0x11dd0e[_0xd455('0x38')];this[_0xd455('0x39')]=_0x11dd0e[_0xd455('0x39')];this[_0xd455('0x3a')]=_0x11dd0e[_0xd455('0x3a')];this[_0xd455('0x3b')]=_0x11dd0e[_0xd455('0x3b')];this[_0xd455('0x8')]=_0x11dd0e[_0xd455('0x8')];this[_0xd455('0x3c')]=_0x11dd0e[_0xd455('0x3c')];this[_0xd455('0x3d')]=_0x11dd0e[_0xd455('0x3d')];this[_0xd455('0x3e')]=_0x11dd0e[_0xd455('0x3e')];this[_0xd455('0x3f')]=_0x11dd0e[_0xd455('0x3f')];this[_0xd455('0x40')]=_0x11dd0e[_0xd455('0x40')];this[_0xd455('0x41')]=_0x11dd0e['startProgressive'];this['message']=_0x11dd0e['message'];this[_0xd455('0x42')]=_0x11dd0e[_0xd455('0x42')];}if(_0x11dd0e['Trunk']){this[_0xd455('0x43')]={'id':_0x11dd0e[_0xd455('0x43')]['id'],'name':_0x11dd0e[_0xd455('0x43')][_0xd455('0x15')],'active':_0x11dd0e[_0xd455('0x43')][_0xd455('0x44')],'callerid':_0x11dd0e['Trunk'][_0xd455('0x45')]};}}VoiceQueueSummary['prototype'][_0xd455('0x46')]=function(_0xc055ab,_0x591753,_0x277109,_0x144718){this['loggedInDb']=0x0;this[_0xd455('0x12')]=0x0;this[_0xd455('0x1')]=0x0;this[_0xd455('0x20')]=0x0;this[_0xd455('0x1a')]=0x0;this[_0xd455('0x6')]=0x0;this[_0xd455('0x17')]=0x0;this[_0xd455('0x18')]=0x0;this[_0xd455('0x1f')]=0x0;this[_0xd455('0x2')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x277109){if(_0x277109['available']){this['available']=Number(_0x277109[_0xd455('0x4')]);}if(_0x277109[_0xd455('0x47')]){this[_0xd455('0x7')]=Number(_0x277109['loggedin']);}if(_0x277109[_0xd455('0x48')]){this['waiting']=Number(_0x277109[_0xd455('0x48')]);}}for(var _0x2aa8ae=0x0;_0x2aa8ae<_0xc055ab[_0xd455('0x49')];_0x2aa8ae++){var _0x3c34df=_0x591753['SIP/'+_0xc055ab[_0x2aa8ae]['name']];if(_0x3c34df&&_0x3c34df[_0xd455('0x4a')]){this[_0xd455('0x0')]+=0x1;}if(_0xc055ab[_0x2aa8ae][_0xd455('0x4b')]==='1'){this[_0xd455('0x12')]+=0x1;}if(_0xc055ab[_0x2aa8ae][_0xd455('0x1')]==='1'&&!['2','7','8'][_0xd455('0x4c')](_0xc055ab[_0x2aa8ae][_0xd455('0x4d')])){this[_0xd455('0x1')]+=0x1;}switch(_0xc055ab[_0x2aa8ae][_0xd455('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xd455('0x1a')]+=0x1;break;case'2':this[_0xd455('0x6')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xd455('0x18')]+=0x1;break;case'5':this[_0xd455('0x1f')]+=0x1;break;case'6':this[_0xd455('0x2')]+=0x1;break;case'7':this[_0xd455('0x1b')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xd455('0x4e')){var _0x1dd769=Object[_0xd455('0x4f')](_0x144718);for(var _0x3844db=0x0;_0x3844db<_0x1dd769['length'];_0x3844db++){var _0x552299=_0x1dd769[_0x3844db];var _0x254a9e=_0x144718[_0x552299];if(_0x254a9e[_0xd455('0x50')]===this[_0xd455('0x15')]&&_0x254a9e['type']===_0xd455('0x51')&&_0x254a9e[_0xd455('0x52')]==='xcally-motion-preview'){this[_0xd455('0x12')]+=0x1;}}if(this['talking']>this[_0xd455('0x6')]){this[_0xd455('0x12')]=this[_0xd455('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xd455('0x53')]['compareToInboundQueue']=function(_0x3cce24){var _0xfa0a5=![];if(_0x3cce24){_0xfa0a5=INBOUND_COUNTERS[_0xd455('0x54')](function(_0x2f3ab2){return this[_0x2f3ab2]!==_0x3cce24[_0x2f3ab2];},this);}return _0xfa0a5;};VoiceQueueSummary['prototype'][_0xd455('0x55')]=function(_0x32406d){var _0x2882e9=![];var _0xd805e2=![];var _0x30579e=![];if(_0x32406d){_0x2882e9=this[_0xd455('0x24')]!==_0x32406d[_0xd455('0x24')]||this[_0xd455('0x23')]!==_0x32406d[_0xd455('0x23')]||this['message']!==_0x32406d['message']||this[_0xd455('0x42')]!==_0x32406d[_0xd455('0x42')];_0xd805e2=OUTBOUND_COUNTERS[_0xd455('0x54')](function(_0x31b135){return this[_0x31b135]!==_0x32406d[_0x31b135];},this);if(this[_0xd455('0x43')]&&_0x32406d[_0xd455('0x43')]){_0x30579e=this[_0xd455('0x43')]['name']!==_0x32406d[_0xd455('0x43')]['name']||this['Trunk'][_0xd455('0x44')]!==_0x32406d[_0xd455('0x43')]['active'];}}return _0x2882e9||_0xd805e2||_0x30579e;};VoiceQueueSummary['prototype'][_0xd455('0x56')]=function(_0x183008){this[_0xd455('0x5')]=_0x183008[_0xd455('0x5')];this[_0xd455('0x57')]=_0x183008[_0xd455('0x57')];this[_0xd455('0x42')]=_0x183008[_0xd455('0x42')];this[_0xd455('0x8')]=_0x183008[_0xd455('0x8')];this[_0xd455('0x9')]=_0x183008[_0xd455('0x9')];this['outboundAnswerCallsDay']=_0x183008['outboundAnswerCallsDay'];this[_0xd455('0x2b')]=_0x183008[_0xd455('0x2b')];this['outboundBusyCallsDay']=_0x183008[_0xd455('0xb')];this['outboundCongestionCallsDay']=_0x183008[_0xd455('0xc')];this[_0xd455('0x2e')]=_0x183008[_0xd455('0x2e')];this[_0xd455('0xd')]=_0x183008[_0xd455('0xd')];this[_0xd455('0xe')]=_0x183008['outboundReCallsDay'];this[_0xd455('0xf')]=_0x183008[_0xd455('0xf')];this[_0xd455('0x10')]=_0x183008[_0xd455('0x10')];this[_0xd455('0x1c')]=_0x183008[_0xd455('0x1c')];this[_0xd455('0x13')]=_0x183008['sumDuration'];this[_0xd455('0x14')]=_0x183008[_0xd455('0x14')];if(this['dialMethod']===_0xd455('0x58')){this[_0xd455('0x11')]=_0x183008['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 00817da..1012060 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 _0xf722=['username','accessKey','remoteUri','serverUrl','exports','name'];(function(_0x19bb8d,_0x35cbd5){var _0x201bb6=function(_0x56b528){while(--_0x56b528){_0x19bb8d['push'](_0x19bb8d['shift']());}};_0x201bb6(++_0x35cbd5);}(_0xf722,0x197));var _0x2f72=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf722[_0x618414];return _0x21c19a;};'use strict';function VtigerAccount(_0x4a887a){this['id']=_0x4a887a['id']||0x0;this[_0x2f72('0x0')]=_0x4a887a[_0x2f72('0x0')]||'';this['username']=_0x4a887a[_0x2f72('0x1')]||'';this[_0x2f72('0x2')]=_0x4a887a['accessKey']||'';this[_0x2f72('0x3')]=_0x4a887a[_0x2f72('0x3')]||'';this['serverUrl']=_0x4a887a[_0x2f72('0x4')]||'';this['Configurations']=_0x4a887a['Configurations']||{};}module[_0x2f72('0x5')]=VtigerAccount; \ No newline at end of file +var _0x9cfa=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4898b9,_0x3945d2){var _0x56a3f=function(_0x261c11){while(--_0x261c11){_0x4898b9['push'](_0x4898b9['shift']());}};_0x56a3f(++_0x3945d2);}(_0x9cfa,0xce));var _0xa9cf=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9cfa[_0x397e5f];return _0x5302b8;};'use strict';function VtigerAccount(_0x104a90){this['id']=_0x104a90['id']||0x0;this[_0xa9cf('0x0')]=_0x104a90[_0xa9cf('0x0')]||'';this[_0xa9cf('0x1')]=_0x104a90[_0xa9cf('0x1')]||'';this[_0xa9cf('0x2')]=_0x104a90[_0xa9cf('0x2')]||'';this[_0xa9cf('0x3')]=_0x104a90[_0xa9cf('0x3')]||'';this['serverUrl']=_0x104a90[_0xa9cf('0x4')]||'';this[_0xa9cf('0x5')]=_0x104a90[_0xa9cf('0x5')]||{};}module[_0xa9cf('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5c66f9c..a649b4d 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 _0x3fc0=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','authType'];(function(_0x573725,_0x3d0257){var _0x3c40fe=function(_0xde5d70){while(--_0xde5d70){_0x573725['push'](_0x573725['shift']());}};_0x3c40fe(++_0x3d0257);}(_0x3fc0,0x181));var _0x03fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fc0[_0x14add3];return _0x4a174f;};'use strict';function ZendeskAccount(_0x442faf){this['id']=_0x442faf['id']||0x0;this[_0x03fc('0x0')]=_0x442faf[_0x03fc('0x0')]||'';this[_0x03fc('0x1')]=_0x442faf['username']||'';this[_0x03fc('0x2')]=_0x442faf[_0x03fc('0x2')]||'';this[_0x03fc('0x3')]=_0x442faf[_0x03fc('0x3')]||'';this['remoteUri']=_0x442faf['remoteUri']||'';this['authType']=_0x442faf[_0x03fc('0x4')]||'';this[_0x03fc('0x5')]=_0x442faf[_0x03fc('0x5')]||_0x03fc('0x6');this[_0x03fc('0x7')]=_0x442faf[_0x03fc('0x7')]||'';this[_0x03fc('0x8')]=_0x442faf[_0x03fc('0x8')]||{};}module[_0x03fc('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x73ca=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x73ca,0x112));var _0xa73c=function(_0x1aaaf1,_0x4941ab){_0x1aaaf1=_0x1aaaf1-0x0;var _0x185875=_0x73ca[_0x1aaaf1];return _0x185875;};'use strict';function ZendeskAccount(_0x1fdaea){this['id']=_0x1fdaea['id']||0x0;this['name']=_0x1fdaea[_0xa73c('0x0')]||'';this[_0xa73c('0x1')]=_0x1fdaea[_0xa73c('0x1')]||'';this['password']=_0x1fdaea[_0xa73c('0x2')]||'';this['token']=_0x1fdaea[_0xa73c('0x3')]||'';this[_0xa73c('0x4')]=_0x1fdaea[_0xa73c('0x4')]||'';this[_0xa73c('0x5')]=_0x1fdaea['authType']||'';this['type']=_0x1fdaea[_0xa73c('0x6')]||_0xa73c('0x7');this['serverUrl']=_0x1fdaea[_0xa73c('0x8')]||'';this[_0xa73c('0x9')]=_0x1fdaea[_0xa73c('0x9')]||{};}module[_0xa73c('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a4ebb9e..c7382dd 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 _0x44dc=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5c6f64,_0x3d7aa0){var _0x23a835=function(_0x183159){while(--_0x183159){_0x5c6f64['push'](_0x5c6f64['shift']());}};_0x23a835(++_0x3d7aa0);}(_0x44dc,0x64));var _0xc44d=function(_0x169639,_0x146136){_0x169639=_0x169639-0x0;var _0x277351=_0x44dc[_0x169639];return _0x277351;};'use strict';function ZohoAccount(_0x2d16de){this['id']=_0x2d16de['id']||0x0;this[_0xc44d('0x0')]=_0x2d16de['name']||'';this[_0xc44d('0x1')]=_0x2d16de['description']||'';this[_0xc44d('0x2')]=_0x2d16de[_0xc44d('0x2')]||'';this[_0xc44d('0x3')]=_0x2d16de[_0xc44d('0x3')]||'';this[_0xc44d('0x4')]=_0x2d16de[_0xc44d('0x4')]||'';this[_0xc44d('0x5')]=_0x2d16de[_0xc44d('0x5')]||'';this[_0xc44d('0x6')]=_0x2d16de['serverUrl']||'';this['code']=_0x2d16de[_0xc44d('0x7')]||'';this[_0xc44d('0x8')]=_0x2d16de[_0xc44d('0x8')]||'';this[_0xc44d('0x9')]=_0x2d16de[_0xc44d('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x09c1=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x09c1,0x15c));var _0x109c=function(_0x3e8d78,_0xef4524){_0x3e8d78=_0x3e8d78-0x0;var _0x50532d=_0x09c1[_0x3e8d78];return _0x50532d;};'use strict';function ZohoAccount(_0x1bcc3f){this['id']=_0x1bcc3f['id']||0x0;this[_0x109c('0x0')]=_0x1bcc3f[_0x109c('0x0')]||'';this[_0x109c('0x1')]=_0x1bcc3f['description']||'';this['host']=_0x1bcc3f[_0x109c('0x2')]||'';this[_0x109c('0x3')]=_0x1bcc3f[_0x109c('0x3')]||'';this[_0x109c('0x4')]=_0x1bcc3f[_0x109c('0x4')]||'';this[_0x109c('0x5')]=_0x1bcc3f[_0x109c('0x5')]||'';this[_0x109c('0x6')]=_0x1bcc3f[_0x109c('0x6')]||'';this[_0x109c('0x7')]=_0x1bcc3f[_0x109c('0x7')]||'';this[_0x109c('0x8')]=_0x1bcc3f[_0x109c('0x8')]||'';this[_0x109c('0x9')]=_0x1bcc3f[_0x109c('0x9')]||{};}module[_0x109c('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 30d7211..9dab92b 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 _0x1eba=['channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name'];(function(_0x12a9f6,_0xcf352a){var _0x243b7b=function(_0x4c95a2){while(--_0x4c95a2){_0x12a9f6['push'](_0x12a9f6['shift']());}};_0x243b7b(++_0xcf352a);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x1eba[_0x3c4f1f];return _0x19cb69;};'use strict';var util=require(_0xa1eb('0x0'));var _=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));function checkNameSurname(_0x2158d5,_0x3ef7ee,_0x5865fc){var _0x56c5f2='';if(!_[_0xa1eb('0x3')](_0x3ef7ee)&&_0xa1eb('0x4')===typeof _0x3ef7ee){_0x56c5f2+=_0x3ef7ee;}if(!_[_0xa1eb('0x3')](_0x5865fc)&&_0xa1eb('0x4')===typeof _0x5865fc){_0x56c5f2+='\x20'+_0x5865fc;}if(_0x56c5f2!==''){return _0x56c5f2;}return _0x2158d5;}function Action(_0x138789,_0x2933d0,_0x1d0d67,_0x2bfbb0,_0x39a5a3){this[_0xa1eb('0x5')]=_0x1d0d67||undefined;this[_0xa1eb('0x6')]=_0x138789['id'];this[_0xa1eb('0x7')]=_0x2933d0['name'];this[_0xa1eb('0x8')]=_0x2933d0['type'];this[_0xa1eb('0x9')]='queue';this[_0xa1eb('0xa')]=![];this['membername']=_[_0xa1eb('0x3')](_0x138789['Agent'])?undefined:_0x138789[_0xa1eb('0xb')][_0xa1eb('0xc')];this[_0xa1eb('0xd')]=this['membername']?util[_0xa1eb('0xe')](_0xa1eb('0xf'),this['membername']):_0x2bfbb0||undefined;this[_0xa1eb('0x10')]=checkNameSurname(_0x138789['Contact']['phone'],_0x138789[_0xa1eb('0x11')]['firstName'],_0x138789[_0xa1eb('0x11')][_0xa1eb('0x12')]);this[_0xa1eb('0x13')]=_0x138789[_0xa1eb('0x13')]||![];this[_0xa1eb('0x14')]=_0x138789[_0xa1eb('0x15')];this[_0xa1eb('0x16')]=_0x138789[_0xa1eb('0x16')];this[_0xa1eb('0x17')]=_0x138789['countbusyretry']||0x0;this[_0xa1eb('0x18')]=_0x138789['countcongestionretry']||0x0;this[_0xa1eb('0x19')]=_0x138789[_0xa1eb('0x19')]||0x0;this[_0xa1eb('0x1a')]=(_0x138789[_0xa1eb('0x17')]||0x0)+(_0x138789['countcongestionretry']||0x0)+(_0x138789[_0xa1eb('0x19')]||0x0)+(_0x138789[_0xa1eb('0x1b')]||0x0)+(_0x138789[_0xa1eb('0x1c')]||0x0)+(_0x138789[_0xa1eb('0x1d')]||0x0)+(_0x138789[_0xa1eb('0x1e')]||0x0)+(_0x138789[_0xa1eb('0x1f')]||0x0);this[_0xa1eb('0x1b')]=_0x138789[_0xa1eb('0x1b')]||0x0;this['countdropretry']=_0x138789[_0xa1eb('0x1c')]||0x0;this['countabandonedretry']=_0x138789[_0xa1eb('0x1d')]||0x0;this[_0xa1eb('0x1e')]=_0x138789[_0xa1eb('0x1e')]||0x0;this[_0xa1eb('0x1f')]=_0x138789['countagentrejectretry']||0x0;this['callback']=_0x138789[_0xa1eb('0x20')];this[_0xa1eb('0x21')]=_0x138789['callbackuniqueid'];this[_0xa1eb('0x22')]=_0x138789[_0xa1eb('0x22')];this[_0xa1eb('0x23')]=_0x138789[_0xa1eb('0x23')];this[_0xa1eb('0x24')]=_0x138789[_0xa1eb('0x24')];this[_0xa1eb('0x25')]=_0x138789[_0xa1eb('0x25')];this[_0xa1eb('0x26')]=_[_0xa1eb('0x3')](_0x138789[_0xa1eb('0xb')])?_0x138789[_0xa1eb('0x26')]:_0x138789['Agent']['id'];this[_0xa1eb('0x27')]=_0x138789[_0xa1eb('0x27')];this['originatecalleridnum']='';this[_0xa1eb('0x28')]='';}Action['prototype'][_0xa1eb('0x29')]=function(){return util[_0xa1eb('0xe')]('\x22%s\x22\x20<%s>',this[_0xa1eb('0x10')],this[_0xa1eb('0x2a')]);};module[_0xa1eb('0x2b')]=Action; \ No newline at end of file +var _0x5204=['isNil','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','lodash'];(function(_0x5e3c4c,_0x570558){var _0x33064e=function(_0x2af5b6){while(--_0x2af5b6){_0x5e3c4c['push'](_0x5e3c4c['shift']());}};_0x33064e(++_0x570558);}(_0x5204,0xdf));var _0x4520=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x5204[_0x3457b4];return _0xaa8fa9;};'use strict';var util=require(_0x4520('0x0'));var _=require(_0x4520('0x1'));var moment=require('moment');function checkNameSurname(_0x12a3a1,_0x3bf0b1,_0x10cbc2){var _0x36caca='';if(!_[_0x4520('0x2')](_0x3bf0b1)&&'string'===typeof _0x3bf0b1){_0x36caca+=_0x3bf0b1;}if(!_[_0x4520('0x2')](_0x10cbc2)&&'string'===typeof _0x10cbc2){_0x36caca+='\x20'+_0x10cbc2;}if(_0x36caca!==''){return _0x36caca;}return _0x12a3a1;}function Action(_0x180174,_0x209381,_0xe0a256,_0xe741c2,_0x396d29){this[_0x4520('0x3')]=_0xe0a256||undefined;this[_0x4520('0x4')]=_0x180174['id'];this['queue']=_0x209381[_0x4520('0x5')];this['type']=_0x209381[_0x4520('0x6')];this[_0x4520('0x7')]=_0x4520('0x8');this[_0x4520('0x9')]=![];this[_0x4520('0xa')]=_[_0x4520('0x2')](_0x180174[_0x4520('0xb')])?undefined:_0x180174[_0x4520('0xb')][_0x4520('0x5')];this[_0x4520('0xc')]=this[_0x4520('0xa')]?util[_0x4520('0xd')](_0x4520('0xe'),this[_0x4520('0xa')]):_0xe741c2||undefined;this[_0x4520('0xf')]=checkNameSurname(_0x180174[_0x4520('0x10')][_0x4520('0x11')],_0x180174[_0x4520('0x10')][_0x4520('0x12')],_0x180174[_0x4520('0x10')][_0x4520('0x13')]);this['active']=_0x180174[_0x4520('0x14')]||![];this[_0x4520('0x15')]=_0x180174[_0x4520('0x11')];this[_0x4520('0x16')]=_0x180174[_0x4520('0x16')];this['countbusyretry']=_0x180174[_0x4520('0x17')]||0x0;this[_0x4520('0x18')]=_0x180174[_0x4520('0x18')]||0x0;this[_0x4520('0x19')]=_0x180174[_0x4520('0x19')]||0x0;this[_0x4520('0x1a')]=(_0x180174[_0x4520('0x17')]||0x0)+(_0x180174[_0x4520('0x18')]||0x0)+(_0x180174[_0x4520('0x19')]||0x0)+(_0x180174[_0x4520('0x1b')]||0x0)+(_0x180174[_0x4520('0x1c')]||0x0)+(_0x180174[_0x4520('0x1d')]||0x0)+(_0x180174['countmachineretry']||0x0)+(_0x180174[_0x4520('0x1e')]||0x0);this['countnosuchnumberretry']=_0x180174['countnosuchnumberretry']||0x0;this['countdropretry']=_0x180174[_0x4520('0x1c')]||0x0;this['countabandonedretry']=_0x180174[_0x4520('0x1d')]||0x0;this[_0x4520('0x1f')]=_0x180174[_0x4520('0x1f')]||0x0;this['countagentrejectretry']=_0x180174[_0x4520('0x1e')]||0x0;this[_0x4520('0x20')]=_0x180174[_0x4520('0x20')];this['callbackuniqueid']=_0x180174[_0x4520('0x21')];this[_0x4520('0x22')]=_0x180174[_0x4520('0x22')];this[_0x4520('0x23')]=_0x180174[_0x4520('0x23')];this['ContactId']=_0x180174[_0x4520('0x24')];this[_0x4520('0x25')]=_0x180174[_0x4520('0x25')];this[_0x4520('0x26')]=_['isNil'](_0x180174[_0x4520('0xb')])?_0x180174[_0x4520('0x26')]:_0x180174[_0x4520('0xb')]['id'];this[_0x4520('0x27')]=_0x180174[_0x4520('0x27')];this[_0x4520('0x28')]='';this[_0x4520('0x29')]='';}Action[_0x4520('0x2a')][_0x4520('0x2b')]=function(){return util[_0x4520('0xd')]('\x22%s\x22\x20<%s>',this[_0x4520('0xf')],this['number']);};module[_0x4520('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6c81da6..331b332 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 _0x3e74=['unmonitored','run','execRun','unlock','unlockContact','getContactPreview','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variables','variablesAction','Action','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','response','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','uuid','moment','ioredis','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','prototype','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','recallMe','clearZombieChannel','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','Agent','voicePause','[RecallMe]','disableContact','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','dialBusyRetryFrequency','busy','additional','Global','dialBusyMaxRetry','countbusyretry','incrementPreviewCounters','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Queue','agents','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable'];(function(_0x51fb53,_0x337b2f){var _0x4c0fb5=function(_0x21287b){while(--_0x21287b){_0x51fb53['push'](_0x51fb53['shift']());}};_0x4c0fb5(++_0x337b2f);}(_0x3e74,0x175));var _0x43e7=function(_0x258750,_0x1cda2d){_0x258750=_0x258750-0x0;var _0x3613d5=_0x3e74[_0x258750];return _0x3613d5;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var uuid=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x43e7('0x4'));var loggerAction=require('../../../config/logger')(_0x43e7('0x5'));var ami=require(_0x43e7('0x6'));var rpcDb=require(_0x43e7('0x7'));var cmHopperAdditionalPhone=require(_0x43e7('0x8'));var Action=require(_0x43e7('0x9'));var ut=require('./util/util');var utils=require(_0x43e7('0xa'));config[_0x43e7('0xb')]=_[_0x43e7('0xc')](config[_0x43e7('0xb')],{'host':_0x43e7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x39c8bd){this[_0x43e7('0xe')]=this['tail']?this[_0x43e7('0xe')]['finally'](_0x39c8bd):_0x39c8bd();};function Preview(_0xf7c520){this[_0x43e7('0xf')]=new Sequence();this['campaignsPreview']=_0xf7c520[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xf7c520[_0x43e7('0x11')];this[_0x43e7('0x12')]={};this['agents']=_0xf7c520['agents'];this[_0x43e7('0x13')]=0x0;ami['on'](_0x43e7('0x14'),this[_0x43e7('0x15')]['bind'](this));ami['on']('hangup',this[_0x43e7('0x16')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x18'),this[_0x43e7('0x19')]['bind'](this));ami['on']('dialend',this[_0x43e7('0x1a')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x17')](this));this[_0x43e7('0x22')](this[_0x43e7('0x23')]);}function emit(_0x177ee1,_0x4b5d64,_0xef1a5a){io['to'](_0x177ee1)[_0x43e7('0x24')](_0x4b5d64,_0xef1a5a);}function emitVoiceQueueChannelRemove(_0x4b386b){logger[_0x43e7('0x25')](_0x43e7('0x26'),JSON[_0x43e7('0x27')](_0x4b386b));emit(util[_0x43e7('0x28')](_0x43e7('0x29'),_0x4b386b[_0x43e7('0x2a')]),'voice_queue_channel:remove',_0x4b386b);io[_0x43e7('0x24')]('voice_queue_presence:remove',_0x4b386b);}function notSendMessagesQueue(_0x4c9df3){if(_0x4c9df3[_0x43e7('0x2b')]){if(_0x4c9df3[_0x43e7('0x2c')]===0x0&&_0x4c9df3['pTalking']===0x0){_0x4c9df3[_0x43e7('0x2b')]=![];_0x4c9df3['available']=0x0;_0x4c9df3[_0x43e7('0x2d')]=0x0;_0x4c9df3['message']=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3['name']+'\x20is\x20not\x20active');}else{_0x4c9df3[_0x43e7('0x32')]=utils['CAMPAIGN_STATUS'][_0x43e7('0x33')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3[_0x43e7('0x2a')]+'\x20is\x20deactivated');}}}Preview[_0x43e7('0x34')][_0x43e7('0x22')]=function(){var _0x45b675=this;setInterval(function(){_0x45b675[_0x43e7('0x35')]();},0x7cf);};Preview[_0x43e7('0x34')][_0x43e7('0x35')]=function(){var _0x2b85a5=this[_0x43e7('0x23')];this[_0x43e7('0x13')]+=0x1;for(var _0x35dbcd in _0x2b85a5){if(_0x2b85a5[_0x43e7('0x36')](_0x35dbcd)&&(_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')||_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]==='booked')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(this[_0x43e7('0x13')]>0x7){this[_0x43e7('0x13')]=0x0;this[_0x43e7('0x3a')]();}}if(_0x2b85a5['hasOwnProperty'](_0x35dbcd)&&_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(_0x2b85a5[_0x35dbcd]['dialActive']){this['setMessage'](_0x2b85a5[_0x35dbcd]);if(_0x2b85a5[_0x35dbcd]['dialPreviewAutoRecallMe'])this[_0x43e7('0x3b')](_0x2b85a5[_0x35dbcd]);}else{notSendMessagesQueue(_0x2b85a5[_0x35dbcd]);}}}};Preview[_0x43e7('0x34')][_0x43e7('0x3c')]=function(_0x234fe6){var _0x108313=this;this[_0x43e7('0xf')]['enqueue'](function(){if(!_['isNil'](_0x108313['actions'][_0x234fe6])){loggerAction['info']('[clearZombieChannels][talking]',_0x234fe6,'Queue',_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')],'originated:\x20',JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]][_0x43e7('0x2c')]),_0x43e7('0x3e'),JSON[_0x43e7('0x27')](_0x108313['campaignsPreview'][_0x108313['actions'][_0x234fe6]['queue']][_0x43e7('0x3f')]),JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]),JSON[_0x43e7('0x27')](_[_0x43e7('0x41')](_0x108313[_0x43e7('0x12')][_0x234fe6],[_0x43e7('0x42'),'UserId',_0x43e7('0x43'),_0x43e7('0x44')])));return ami['Action']({'action':_0x43e7('0x45'),'channel':_0x108313['actions'][_0x234fe6][_0x43e7('0x46')]})[_0x43e7('0x47')](function(_0x1c6f45){if(_0x1c6f45[_0x43e7('0x32')]===_0x43e7('0x48')){setTimeout(function(){if(_0x108313[_0x43e7('0x12')][_0x234fe6]){ut['updateOriginated'](_0x108313['campaignsPreview'][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]],_0x43e7('0x49'));if(_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]===!![]){ut['decrementTalkink'](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']],_0x43e7('0x49'));ut['loggerError'](_0x43e7('0x4a')+_0x234fe6,_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')]);}ut[_0x43e7('0x4b')](_0x43e7('0x4c')+_0x234fe6,_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']);delete _0x108313['actions'][_0x234fe6];}},0x2328);}});}});};Preview[_0x43e7('0x34')][_0x43e7('0x3a')]=function(){var _0xe979b5=this;loggerAction[_0x43e7('0x25')]('[action]',_['size'](this['actions']));for(var _0x35e4fb in this['actions']){if(_0xe979b5[_0x43e7('0x12')]['hasOwnProperty'](_0x35e4fb)){_0xe979b5['clearZombieChannel'](_0x35e4fb);}}};Preview[_0x43e7('0x34')]['recallMe']=function(_0x2de14f){var _0x39db7f=this;rpcDb[_0x43e7('0x4d')](_0x2de14f['id'],ut[_0x43e7('0x4e')](this['agents']))[_0x43e7('0x4f')](function(_0x2b9046){if(!_[_0x43e7('0x50')](_0x2b9046)){for(var _0x1fd277=0x0;_0x1fd277<_0x2b9046[_0x43e7('0x51')];_0x1fd277+=0x1){if(ut[_0x43e7('0x52')](_0x2b9046[_0x1fd277]['scheduledat'])<_0x2de14f['dialRecallMeTimeout']*0x3c){if(_0x2b9046[_0x1fd277][_0x43e7('0x53')]&&!_0x2b9046[_0x1fd277][_0x43e7('0x53')][_0x43e7('0x54')]){_0x39db7f['run'](_0x2b9046[_0x1fd277]['id'])['then'](ut['logger2'](_0x43e7('0x55')))[_0x43e7('0x47')](ut['logger2'](_0x43e7('0x55')));}else{rpcDb[_0x43e7('0x56')](_0x2b9046[_0x1fd277]['id']);}}else{var _0x3c96fe=new Action(_0x2b9046[_0x1fd277],_0x2de14f);_0x3c96fe['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2de14f['outboundReCallsDay']+=0x1;ut[_0x43e7('0x57')](_0x3c96fe,0x17,_0x43e7('0x58'));if(_0x2de14f['dialRecallInQueue']){rpcDb[_0x43e7('0x59')](ut[_0x43e7('0x5a')](_0x2b9046[_0x1fd277]));rpcDb[_0x43e7('0x5b')](_0x3c96fe,_0x43e7('0x5c'));}else{ut['logCustomer'](_0x3c96fe,0x16,_0x43e7('0x5d'));rpcDb['createCustomerHistory'](_0x3c96fe,'[HistoryRecallClose]');rpcDb[_0x43e7('0x5e')](_0x3c96fe,_0x43e7('0x5f'));}}}}})[_0x43e7('0x47')](ut[_0x43e7('0x60')](_0x43e7('0x61')));};Preview[_0x43e7('0x34')][_0x43e7('0x62')]=function(_0x256ddd){_0x256ddd[_0x43e7('0x2b')]=!![];if(ut[_0x43e7('0x63')](_0x256ddd['loggedIn'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x43e7('0x64')](_0x256ddd['dialActive'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];}else if(!this[_0x43e7('0x65')](_0x256ddd[_0x43e7('0x66')])){if(!this['isTrunkReachable'](_0x256ddd['TrunkBackup'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x67')];}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}};Preview[_0x43e7('0x34')][_0x43e7('0x69')]=function(_0x4ace49,_0x1ec35a,_0x2da2f3){var _0x50a3fa=this;var _0x4314d8=this[_0x43e7('0x12')][_0x1ec35a];var _0x2d0052=this['campaignsPreview'][_0x4314d8['queue']];var _0x459c13;var _0x3d9a29=![];var _0x4ebdde=0x2;var _0x283dd8=0x3;if(_0x2d0052){switch(_0x2da2f3){case'1':_0x2d0052['outboundNoSuchCallsDay']+=0x1;_0x4314d8['countnosuchnumberretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x0,_0x43e7('0x6c'));ami[_0x43e7('0x24')]('custom:agentnosuchnumber',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x6e')));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0x6f'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'0',_0x2d0052)[_0x43e7('0x4f')](function(_0x5bb536){_0x3d9a29=_0x5bb536['additional']==0x1;_0x4ebdde=_0x2d0052['dialNoSuchNumberRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0x74'));}else{if(_0x4314d8[_0x43e7('0x75')]>=_0x2d0052[_0x43e7('0x76')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x75'),_0x2d0052[_0x43e7('0x79')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x4314d8[_0x43e7('0x75')]++;logger[_0x43e7('0x25')](_0x43e7('0x7d'),_0x4314d8['countnosuchnumberretry']);logger['info']('id',_0x4314d8[_0x43e7('0x7e')]);_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8['idContact'],'field':{'countnosuchnumberretry':_0x4314d8['countnosuchnumberretry']}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});break;case _0x43e7('0x80'):var _0x135791=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x4314d8[_0x43e7('0x81')]=_0x135791;_0x4314d8[_0x43e7('0x82')]=_0x135791;_0x4314d8[_0x43e7('0x40')]=!![];_0x2d0052[_0x43e7('0x3f')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x83'),_0x4314d8[_0x43e7('0x84')],'\x20Queue',_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);ami['emit']('custom:agentconnect',ut[_0x43e7('0x6d')](_0x4314d8,'connect',this['campaignsPreview'][_0x4314d8[_0x43e7('0x3d')]]));if(_0x2d0052[_0x43e7('0x85')]){ami['emit'](_0x43e7('0x86'),ut[_0x43e7('0x87')](_0x4314d8));}break;case'16':ami[_0x43e7('0x24')](_0x43e7('0x88'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89'),this[_0x43e7('0x23')][_0x4314d8['queue']]));emitVoiceQueueChannelRemove(ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89')));_0x2d0052['outboundAnswerCallsDay']+=0x1;_0x2d0052[_0x43e7('0x8a')]+=0x1;_0x2d0052['answered']+=0x1;ut[_0x43e7('0x8b')](_0x2d0052,_0x43e7('0x8c'));_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x4,_0x43e7('0x8d'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0x8e'));rpcDb['createCustomerFinal'](_0x4314d8,_0x43e7('0x8f'));rpcDb[_0x43e7('0x90')](_0x4314d8);_0x2d0052[_0x43e7('0x91')]+=_0x4314d8[_0x43e7('0x92')];_0x2d0052[_0x43e7('0x93')]+=_0x4314d8['talktime'];logger[_0x43e7('0x25')](_0x43e7('0x94'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);delete this['actions'][_0x4ace49['linkedid']];break;case _0x43e7('0x96'):_0x2d0052['outboundBusyCallsDay']+=0x1;_0x4314d8['countbusyretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x5,_0x43e7('0x97'));_0x4ebdde=_0x2d0052[_0x43e7('0x98')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentbusy',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x99')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'5',_0x2d0052)[_0x43e7('0x4f')](function(_0x184ae3){_0x3d9a29=_0x184ae3[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4314d8['countbusyretry']>=_0x2d0052[_0x43e7('0x9c')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x9d'),_0x2d0052[_0x43e7('0x98')]),_0x4314d8['unlockAgent'],_0x4314d8['activeContact']);}}}else{_0x4314d8['countbusyretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countbusyretry':_0x4314d8['countbusyretry']}})['then'](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0x9f'):_0x2d0052['outboundNoAnswerCallsDay']+=0x1;_0x4314d8[_0x43e7('0xa0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x3,'NoAnswer');_0x4ebdde=_0x2d0052[_0x43e7('0xa1')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];var _0xa66309=ut[_0x43e7('0xa2')](_0x4314d8,_0x2d0052);ami[_0x43e7('0x24')](_0x43e7('0xa3'),_0xa66309);rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xa4'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'3',_0x2d0052)['then'](function(_0x109c86){_0x3d9a29=_0x109c86[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xa5'));}else{if(_0x4314d8['countnoanswerretry']>=_0x2d0052[_0x43e7('0xa6')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xa4'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xa0'),_0x2d0052[_0x43e7('0xa1')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xa7'):_0x2d0052['outboundCongestionCallsDay']+=0x1;_0x4314d8['countcongestionretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x8,_0x43e7('0xa8'));_0x4ebdde=_0x2d0052[_0x43e7('0xa9')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];ami['emit'](_0x43e7('0xaa'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xab')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xac'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'8',_0x2d0052)['then'](function(_0x403276){_0x3d9a29=_0x403276[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xad'));}else{if(_0x4314d8[_0x43e7('0xae')]>=_0x2d0052['dialCongestionMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xac'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xae'),_0x2d0052['dialBusyRetryFrequency']),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8['countcongestionretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countcongestionretry':_0x4314d8[_0x43e7('0xae')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'CANCEL':_0x2d0052[_0x43e7('0xaf')]+=0x1;_0x4314d8[_0x43e7('0xb0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x14,_0x43e7('0xb1'));_0x4ebdde=_0x2d0052[_0x43e7('0xb2')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentreject',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xb3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xb4'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'20',_0x2d0052)['then'](function(_0x2c5bf9){_0x3d9a29=_0x2c5bf9[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4314d8[_0x43e7('0xb0')]>=_0x2d0052['dialAgentRejectMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xb5'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xb0'),_0x2d0052['dialAgentRejectRetryFrequency']),_0x4314d8['unlockAgent'],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xb6'):_0x2d0052[_0x43e7('0xb7')]+=0x1;_0x4314d8[_0x43e7('0xb8')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xb,_0x43e7('0xb9'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xba'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'11',_0x2d0052)[_0x43e7('0x4f')](function(_0x3286b1){_0x3d9a29=_0x3286b1[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xba'));}else{if(_0x4314d8[_0x43e7('0xbb')]>=_0x2d0052[_0x43e7('0xbc')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x43e7('0x77')](ut['scheduledAt'](_0x4314d8,_0x43e7('0xb8'),_0x2d0052[_0x43e7('0xbd')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'18':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countmachineretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x12,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami[_0x43e7('0x24')](_0x43e7('0xc1'),ut['buildObj'](_0x4314d8,'amd'));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0xc2'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'18',_0x2d0052)['then'](function(_0x4d7f0f){_0x3d9a29=_0x4d7f0f[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x12,'Global');rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc2'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc2'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];break;case'19':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut['totalGlobal'](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x13,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami['emit'](_0x43e7('0xc1'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xc3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][machine]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'18',_0x2d0052)['then'](function(_0x299086){_0x3d9a29=_0x299086[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut['totalGlobal'](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc4'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc4'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});delete this['actions'][_0x4ace49[_0x43e7('0x7c')]];break;default:if(_0x4314d8[_0x43e7('0x40')]){ut[_0x43e7('0x8b')](_0x2d0052,'[default]');ut[_0x43e7('0x4b')](_0x43e7('0xc5')+_0x2d0052[_0x43e7('0x2a')],_0x4ace49);}_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xc,_0x4ace49['cause-txt']||_0x4ace49['dialstatus']);_0x4ebdde=_0x2d0052['dialAgentRejectRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xc6'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'20',_0x2d0052)[_0x43e7('0x4f')](function(_0x40019e){_0x3d9a29=_0x40019e[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc7'));}else{rpcDb['createCustomerFinal'](_0x4314d8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});}});}if(!(_0x4314d8['dialAnswer']&&_0x2da2f3==='16')){ut[_0x43e7('0xc8')](_0x2d0052,_0x43e7('0xc9'));logger[_0x43e7('0x25')](_0x43e7('0xca'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052['name'],_0x43e7('0xcb'),_0x2d0052['originated']);}if(_0x2da2f3!=='ANSWER'){delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];delete this['actions'][_0x4ace49['destlinkedid']];}_0x2d0052[_0x43e7('0xcc')]=!![];}};Preview[_0x43e7('0x34')]['callProgressDetectingAgent']=function(_0x189c38,_0x156a3c,_0x302138){if(_[_0x43e7('0xcd')](_0x156a3c)&&'object'!==typeof _0x156a3c){return;}if(_['isUndefined'](_0x302138)&&_0x43e7('0xce')!==typeof _0x302138){return;}switch(_0x302138[_0x43e7('0xcf')]){case'0':ut[_0x43e7('0xd0')](_0x189c38,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x189c38,_0x43e7('0xd1'));break;case'3':ut[_0x43e7('0xd0')](_0x189c38,0x3,_0x43e7('0xd2'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd4'));break;case'5':ut[_0x43e7('0xd0')](_0x189c38,0x5,_0x43e7('0x97'));rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x189c38,0x8,'Congestion');rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x43e7('0xd0')](_0x189c38,0x16,_0x43e7('0xd5'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd6'));break;default:ut[_0x43e7('0xd0')](_0x189c38,0xc,_0x302138['reason']);rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd7'));}ut[_0x43e7('0xc8')](_0x156a3c,_0x43e7('0xd8'));logger['info'](_0x43e7('0xd9'),_0x189c38[_0x43e7('0x84')],_0x43e7('0x95'),_0x156a3c[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x156a3c[_0x43e7('0x2c')]);delete this[_0x43e7('0x12')][_0x189c38['uniqueid']];};Preview[_0x43e7('0x34')][_0x43e7('0x70')]=function(_0x20fab2,_0x3637d9,_0x3c52d3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20fab2,_0x3637d9,_0x3c52d3)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x7f')]=function(_0x577ac6,_0x235418,_0x368c57){return cmHopperAdditionalPhone[_0x43e7('0x7f')](_0x577ac6,_0x235418,_0x368c57)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x9e')]=function(_0x1e5d48){return Promise['resolve']()[_0x43e7('0x4f')](cmHopperAdditionalPhone[_0x43e7('0x9e')](_0x1e5d48))['catch'](logger[_0x43e7('0x25')](_0x43e7('0xda')));};Preview[_0x43e7('0x34')][_0x43e7('0xdb')]=function(_0x15b04a,_0x3b5f39,_0x4d5736,_0xcbdb35,_0xa5981f){var _0x19ddfa=this;return new Promise(function(_0x4a4031,_0x5a7f2e){if(_[_0x43e7('0x50')](_0x3b5f39)||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdc')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdd')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0x43')])){_0x5a7f2e(ut[_0x43e7('0x32')]('Contact\x20is\x20undefined',_0xcbdb35,_0xa5981f));return;}var _0x723c7=uuid['v4']();var _0xfbdb90=_0x19ddfa[_0x43e7('0x23')][_0x3b5f39[_0x43e7('0xde')][_0x43e7('0x2a')]];var _0x114e00=_0x4d5736?_0x19ddfa[_0x43e7('0xdf')][_0x4d5736]['id']:undefined;_0x19ddfa[_0x43e7('0x12')][_0x723c7]=new Action(_0x3b5f39,_0xfbdb90,_0x723c7,_0x4d5736,_0x114e00);var _0x51e17c=_0x19ddfa[_0x43e7('0x12')][_0x723c7];_0x51e17c[_0x43e7('0x7a')]=_0xcbdb35;_0x51e17c[_0x43e7('0x7b')]=_0xa5981f;_0x51e17c[_0x43e7('0xe0')]=_0x4d5736;if(_[_0x43e7('0xe1')](_0x15b04a)){_0x19ddfa['execCall'](_0x51e17c,_0xfbdb90,_0x3b5f39,_0x4d5736)[_0x43e7('0x4f')](function(_0x186e57){logger[_0x43e7('0x25')](_0x43e7('0xe2'),_0x43e7('0xe3')+_0x51e17c['queue']+_0x43e7('0xe4')+_0x51e17c['idContact'],JSON[_0x43e7('0x27')](_0x186e57));ami[_0x43e7('0x24')](_0x43e7('0xe5'),ut[_0x43e7('0x6d')](_0x51e17c,'called',_0x19ddfa[_0x43e7('0x23')][_0x51e17c[_0x43e7('0x3d')]]));_0x4a4031(ut[_0x43e7('0x32')](_0x43e7('0xe6')));})[_0x43e7('0x47')](function(_0x27bbd6){ut[_0x43e7('0x30')](_0x43e7('0xe7'),_0x27bbd6);_0x5a7f2e(ut[_0x43e7('0x32')](_0x43e7('0xe8'),_0xcbdb35,_0xa5981f));});}else{_0xfbdb90[_0x43e7('0xe9')]+=0x1;ut['logBlacklist'](_0x51e17c);rpcDb['createHistory'](_0x51e17c,_0x43e7('0xea'));delete _0x19ddfa['actions'][_0x723c7];_0x5a7f2e(ut['message'](_0x43e7('0xeb'),_0xcbdb35,_0xa5981f));}});};Preview[_0x43e7('0x34')]['isTrunkReachable']=function(_0x143be2){return!_['isNil'](_0x143be2)&&!_['isNil'](_0x143be2['name'])&&!_[_0x43e7('0x50')](_0x143be2[_0x43e7('0xec')])&&_0x143be2[_0x43e7('0xec')]&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])])&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')])&&(this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')]===_0x43e7('0xee')||this['trunks'][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2['name'])][_0x43e7('0x45')]===_0x43e7('0xef'));};Preview[_0x43e7('0x34')][_0x43e7('0xf0')]=function(_0x49441c,_0x31797a){return this[_0x43e7('0xf1')](_0x49441c,_0x31797a)['then'](function(_0x43500a){return _[_0x43e7('0x41')](_0x43500a,[_0x43e7('0x32')]);})['catch'](function(_0x22b824){if(_0x22b824[_0x43e7('0xf2')]){rpcDb[_0x43e7('0xf3')](_0x49441c);}if(_0x22b824[_0x43e7('0xec')]){rpcDb[_0x43e7('0x56')](_0x49441c);}throw _['pick'](_0x22b824,[_0x43e7('0x32')]);});};Preview[_0x43e7('0x34')]['execRun']=function(_0x1d31f5,_0x47b03b){var _0x4bf8ad=this;var _0x55baca,_0x5486a6;return rpcDb[_0x43e7('0xf4')](_0x1d31f5)[_0x43e7('0x4f')](function(_0x7f518f){if(!_[_0x43e7('0x50')](_0x7f518f[0x0])){_0x5486a6=_0x7f518f[0x0]['recallme']?![]:!![];_0x55baca=_0x7f518f[0x0]['recallme']?!![]:![];_0x55baca=_0x47b03b?!![]:_0x55baca;}var _0x267b26=_0x4bf8ad['validateContact'](_0x7f518f);if(_0x267b26[_0x43e7('0xf5')]){rpcDb['checkIsBlackList'](_[_0x43e7('0x41')](_0x7f518f[0x0],['VoiceQueueId','phone']))['then'](function(_0x5653b0){_0x4bf8ad[_0x43e7('0xdb')](_0x5653b0,_0x7f518f[0x0],_0x47b03b,_0x5486a6,_0x55baca)[_0x43e7('0x4f')](function(_0x574658){return _0x574658;})['catch'](function(_0x466aa7){throw _0x466aa7;});})[_0x43e7('0x47')](function(_0x517289){ut['logger'](_0x43e7('0xf6'),_0x517289);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),_0x5486a6,_0x55baca);});}else{throw ut[_0x43e7('0x32')](_0x267b26['message'],_0x5486a6,_0x55baca);}})[_0x43e7('0x47')](function(_0x536b7d){ut[_0x43e7('0x30')](_0x43e7('0xf8'),_0x536b7d);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),![],!![]);});};Preview[_0x43e7('0x34')][_0x43e7('0xf9')]=function(_0x2cbbda){if(_['isNil'](_0x2cbbda)||_[_0x43e7('0xe1')](_0x2cbbda)||!_[_0x43e7('0x50')](_0x2cbbda[0x0]['Agent'])&&_[_0x43e7('0x50')](_0x2cbbda[0x0][_0x43e7('0x53')][_0x43e7('0x2a')])){ut[_0x43e7('0x30')](_0x43e7('0xfa'),_0x2cbbda);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3fd573=this['campaignsPreview'][_0x2cbbda[0x0][_0x43e7('0xde')]['name']];_0x3fd573[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];if(_[_0x43e7('0x50')](_0x3fd573)){ut[_0x43e7('0x30')]('[Preview][validateContact][Empty\x20Campaign]',_0x3fd573);return{'isValid':![],'message':_0x43e7('0xfb')};}if(!this['isTrunkReachable'](_0x3fd573[_0x43e7('0x66')])){ut[_0x43e7('0x30')](_0x43e7('0xfc'),'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0xfd'));if(!this[_0x43e7('0x65')](_0x3fd573[_0x43e7('0xfe')])){ut[_0x43e7('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x3fd573[_0x43e7('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x43e7('0xff')};}}if(!ut[_0x43e7('0x64')](_0x3fd573[_0x43e7('0x100')])){ut[_0x43e7('0x30')](_0x43e7('0x101'),_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0x102'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x43e7('0x103')};};Preview[_0x43e7('0x34')][_0x43e7('0x104')]=function(_0xbc6e18,_0x16c757,_0xf9178f,_0x3bb7ab){var _0x2be8c7=this;return new Promise(function(_0x2bb14d,_0x57f7ea){var _0x240478=_0xbc6e18['uniqueid'];var _0x2b7b33=_0x2be8c7[_0x43e7('0x65')](_0x16c757['Trunk'])?util[_0x43e7('0x28')](_0x43e7('0x105'),_0x16c757['Trunk'][_0x43e7('0x2a')],_[_0x43e7('0x50')](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757[_0x43e7('0x108')]>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]):util[_0x43e7('0x28')](_0x43e7('0x105'),_['isNil'](_0x16c757[_0x43e7('0xfe')])?_0x16c757[_0x43e7('0x66')]['name']:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x2a')],_['isNil'](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757['dialCutDigit']>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]);var _0x2ed5e0=_0x2be8c7[_0x43e7('0x65')](_0x16c757[_0x43e7('0x66')])?ut['getCallerId'](_0x16c757['Trunk'][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757[_0x43e7('0x10c')]>0x0?ut[_0x43e7('0x10d')](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]):ut[_0x43e7('0x10f')](_[_0x43e7('0x50')](_0x16c757['TrunkBackup'])?_0x16c757[_0x43e7('0x66')][_0x43e7('0x10a')]:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]);if(_0x2ed5e0){_0xbc6e18[_0x43e7('0x110')]=ut['extractCalleridName'](_0x2ed5e0);_0xbc6e18[_0x43e7('0x111')]=ut['extractCalleridNumber'](_0x2ed5e0);}var _0x1c7f6a=ut[_0x43e7('0x112')](_0x16c757,_0xf9178f,_0x2b7b33,_0x2ed5e0,_0x240478,_0xbc6e18);_[_0x43e7('0x113')](_0xbc6e18,ut[_0x43e7('0x114')](_0x1c7f6a));_0xbc6e18[_0x43e7('0x115')]=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x16c757[_0x43e7('0x116')]=_0x1c7f6a;var _0x202421=ut[_0x43e7('0x117')](_0xbc6e18,_0x16c757,_0x1c7f6a,_0xbc6e18[_0x43e7('0x7b')],_0x3bb7ab);return ami[_0x43e7('0x118')](_0x202421)[_0x43e7('0x4f')](function(_0x4637f6){_0x16c757[_0x43e7('0x2c')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x119'),_0x240478,_0x43e7('0x95'),_0x16c757[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x16c757['originated']);_0x2bb14d(_0x4637f6);})[_0x43e7('0x47')](function(_0x24d6e4){ut['logAgent'](_0xbc6e18,0xe,_0x43e7('0x11a'));rpcDb[_0x43e7('0xd3')](_0xbc6e18,'[originateFailure][logOriginateFailure]');_0x57f7ea(_0x24d6e4);});});};Preview[_0x43e7('0x34')][_0x43e7('0x11b')]=function(_0x2b9cf9){if(this['actions'][_0x2b9cf9['linkedid']]){this[_0x43e7('0x12')][_0x2b9cf9[_0x43e7('0x7c')]][_0x43e7('0x46')]=_0x2b9cf9[_0x43e7('0x46')];}};Preview[_0x43e7('0x34')][_0x43e7('0x15')]=function(_0x25b5a2){var _0xfe77ea=this;var _0x5d2cb0=this[_0x43e7('0x12')][_0x25b5a2[_0x43e7('0x11c')]];if(_0x5d2cb0){if(_0x5d2cb0[_0x43e7('0xe0')]&&this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]){ut[_0x43e7('0x11d')](_0x5d2cb0,this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]][_0x43e7('0x2a')],this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]['id']);}var _0x218743=_['clone'](_0x5d2cb0);_0x218743[_0x43e7('0x81')]=moment()[_0x43e7('0x28')](_0x43e7('0x11e'));var _0x21c8b9=_0xfe77ea[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]];if(ut['isFailure'](_0x25b5a2[_0x43e7('0x11f')])){if(_0x5d2cb0['unlockAgent']){rpcDb[_0x43e7('0xf3')](_0x5d2cb0[_0x43e7('0x7e')]);}if(_0x5d2cb0[_0x43e7('0x7b')]){rpcDb['disableContact'](_0x5d2cb0[_0x43e7('0x7e')]);}ami[_0x43e7('0x24')]('custom:agentringnoanswer',ut[_0x43e7('0x6d')](_0x5d2cb0,'rejected',this[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]]));this[_0x43e7('0x120')](_0x218743,_0x21c8b9,_0x25b5a2);}else{_0x5d2cb0[_0x43e7('0x115')]=moment()['format'](_0x43e7('0x11e'));ut[_0x43e7('0xd0')](_0x218743,0x4,_0x43e7('0x8d'));rpcDb['createAgentHistory'](_0x218743,_0x43e7('0x121'));}}};Preview[_0x43e7('0x34')][_0x43e7('0x16')]=function(_0x431345){var _0x77c2f=this[_0x43e7('0x12')][_0x431345['linkedid']];var _0x3f057e;if(_0x77c2f){_0x3f057e=this['campaignsPreview'][_0x77c2f[_0x43e7('0x3d')]];logger[_0x43e7('0x25')]('[syncHangup][talking]',_0x431345[_0x43e7('0x7c')],_0x43e7('0x95'),_0x3f057e['name'],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);}if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]]&&_0x431345['linkedid']!==_0x431345['uniqueid']){if(_0x431345[_0x43e7('0x122')]==='16'&&this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345['linkedid']][_0x43e7('0x40')]){logger[_0x43e7('0x25')]('[syncHangup][talking][cause]',_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],_0x43e7('0x95'),_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345['linkedid'],_0x431345[_0x43e7('0x122')]);}}else if(_0x77c2f&&_['isNil'](_0x77c2f[_0x43e7('0x123')])&&_0x3f057e[_0x43e7('0x124')]&&_0x431345['linkedid']===_0x431345[_0x43e7('0x84')]&&_['isNil'](_0x431345[_0x43e7('0xcf')])&&_0x431345[_0x43e7('0x122')]==='16'&&_0x431345[_0x43e7('0x125')]==='6'&&_['isUndefined'](_0x77c2f['transfer'])){if(_0x77c2f[_0x43e7('0x7a')]){rpcDb[_0x43e7('0xf3')](_0x77c2f['idContact']);}if(_0x77c2f[_0x43e7('0x7b')]){rpcDb[_0x43e7('0x56')](_0x77c2f[_0x43e7('0x7e')]);}_0x431345['reason']='22';this[_0x43e7('0x120')](_0x77c2f,_0x3f057e,_0x431345);}else if(_0x77c2f&&_0x77c2f[_0x43e7('0x126')]){if(_0x431345[_0x43e7('0x122')]==='16'&&this['actions'][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x127'),_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],'\x20Queue',_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x128'),_0x431345[_0x43e7('0x7c')],_0x431345['cause'],'\x20Queue',_0x3f057e['name'],'pTalking:\x20',_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')][_0x43e7('0x1a')]=function(_0x51dc07){if(this['actions'][_0x51dc07[_0x43e7('0x129')]]&&_0x51dc07[_0x43e7('0x129')]!==_0x51dc07['destuniqueid']){this['callProgressDetectingCustomer'](_0x51dc07,_0x51dc07[_0x43e7('0x129')],_0x51dc07[_0x43e7('0xc0')]);}};Preview['prototype'][_0x43e7('0x19')]=function(_0x57bcab){if(this['actions'][_0x57bcab[_0x43e7('0x7c')]]&&_0x57bcab[_0x43e7('0x7c')]!==_0x57bcab['uniqueid']&&!this['actions'][_0x57bcab[_0x43e7('0x7c')]][_0x43e7('0x40')]){if(_0x57bcab[_0x43e7('0x122')]==='1'){this[_0x43e7('0x69')](_0x57bcab,_0x57bcab['linkedid'],_0x57bcab[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')]['addVariable']=function(_0x560373,_0x4cdb87,_0x4eaf92){if(this[_0x43e7('0x12')][_0x560373]){if(_[_0x43e7('0x50')](this['actions'][_0x560373]['variables'])){this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')]={};}this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')][_0x4cdb87]=_0x4eaf92;}};Preview[_0x43e7('0x34')]['syncVarSet']=function(_0x3836e7){try{if(!_[_0x43e7('0x50')](_0x3836e7)){if(ut[_0x43e7('0x12a')](_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0])){this['addVariable'](_0x3836e7[_0x43e7('0x84')],_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0],_0x3836e7[_0x43e7('0x12d')]);}}}catch(_0x5564b4){logger[_0x43e7('0x12e')](_0x43e7('0x12f'),util[_0x43e7('0x130')](_0x5564b4,{'showHidden':![],'depth':null}));}};Preview[_0x43e7('0x34')][_0x43e7('0x1f')]=function(_0x308403){if(_0x308403){if(this['actions'][_0x308403[_0x43e7('0x131')]]){this[_0x43e7('0x12')][_0x308403[_0x43e7('0x131')]][_0x43e7('0x126')]=!![];}}};Preview['prototype'][_0x43e7('0x21')]=function(_0x48c784){if(_0x48c784){if(this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']]){this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']][_0x43e7('0x126')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x00bb=['swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','syncVarSet','filterKey','keys','variable','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','INACTIVE','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','stringify','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var uuid=require(_0xb00b('0x2'));var moment=require('moment');var Redis=require(_0xb00b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var loggerAction=require('../../../config/logger')(_0xb00b('0x6'));var ami=require(_0xb00b('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xb00b('0x8'));var utils=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitVoiceQueueChannelRemove(_0x3501af){logger['info'](_0xb00b('0x24'),JSON['stringify'](_0x3501af));emit(util[_0xb00b('0x25')](_0xb00b('0x26'),_0x3501af['name']),_0xb00b('0x27'),_0x3501af);io[_0xb00b('0x23')]('voice_queue_presence:remove',_0x3501af);}function notSendMessagesQueue(_0x3ab3cc){if(_0x3ab3cc[_0xb00b('0x28')]){if(_0x3ab3cc['originated']===0x0&&_0x3ab3cc[_0xb00b('0x29')]===0x0){_0x3ab3cc[_0xb00b('0x28')]=![];_0x3ab3cc[_0xb00b('0x2a')]=0x0;_0x3ab3cc[_0xb00b('0x2b')]=0x0;_0x3ab3cc['message']=utils['CAMPAIGN_STATUS'][_0xb00b('0x2c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3ab3cc['name']+_0xb00b('0x2d'));}else{_0x3ab3cc[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x30')];ut[_0xb00b('0x31')](_0xb00b('0x32'),_0x3ab3cc[_0xb00b('0x33')]+'\x20is\x20deactivated');}}}Preview[_0xb00b('0xd')]['loopCampaigns']=function(){var _0x450129=this;setInterval(function(){_0x450129[_0xb00b('0x34')]();},0x7cf);};Preview[_0xb00b('0xd')]['syncCampaigns']=function(){var _0x2fc11a=this[_0xb00b('0x22')];this[_0xb00b('0x35')]+=0x1;for(var _0x183233 in _0x2fc11a){if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&(_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x5')||_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x38'))&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(this[_0xb00b('0x35')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb00b('0x3a')]();}}if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&_0x2fc11a[_0x183233]['dialMethod']===_0xb00b('0x5')&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(_0x2fc11a[_0x183233][_0xb00b('0x3b')]){this[_0xb00b('0x3c')](_0x2fc11a[_0x183233]);if(_0x2fc11a[_0x183233][_0xb00b('0x3d')])this[_0xb00b('0x3e')](_0x2fc11a[_0x183233]);}else{notSendMessagesQueue(_0x2fc11a[_0x183233]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x3f')]=function(_0x594840){var _0x57e8f9=this;this['sequence'][_0xb00b('0xe')](function(){if(!_[_0xb00b('0x40')](_0x57e8f9[_0xb00b('0x13')][_0x594840])){loggerAction[_0xb00b('0x41')]('[clearZombieChannels][talking]',_0x594840,_0xb00b('0x42'),_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')],_0xb00b('0x44'),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x45')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]][_0xb00b('0x29')]),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x46')]),JSON[_0xb00b('0x45')](_['pick'](_0x57e8f9[_0xb00b('0x13')][_0x594840],[_0xb00b('0x47'),_0xb00b('0x48'),_0xb00b('0x49'),_0xb00b('0x4a')])));return ami[_0xb00b('0x4b')]({'action':'status','channel':_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x4c')]})['catch'](function(_0x17ff34){if(_0x17ff34[_0xb00b('0x2e')]===_0xb00b('0x4d')){setTimeout(function(){if(_0x57e8f9[_0xb00b('0x13')][_0x594840]){ut[_0xb00b('0x4e')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));if(_0x57e8f9[_0xb00b('0x13')][_0x594840]['dialAnswer']===!![]){ut['decrementTalkink'](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));ut[_0xb00b('0x50')](_0xb00b('0x51')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840]['queue']);}ut[_0xb00b('0x50')](_0xb00b('0x52')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]);delete _0x57e8f9[_0xb00b('0x13')][_0x594840];}},0x2328);}});}});};Preview[_0xb00b('0xd')][_0xb00b('0x3a')]=function(){var _0x974a29=this;loggerAction[_0xb00b('0x41')](_0xb00b('0x53'),_[_0xb00b('0x54')](this[_0xb00b('0x13')]));for(var _0x577bad in this[_0xb00b('0x13')]){if(_0x974a29[_0xb00b('0x13')][_0xb00b('0x36')](_0x577bad)){_0x974a29[_0xb00b('0x3f')](_0x577bad);}}};Preview[_0xb00b('0xd')][_0xb00b('0x3e')]=function(_0xd97f49){var _0x1b4f09=this;rpcDb[_0xb00b('0x55')](_0xd97f49['id'],ut[_0xb00b('0x56')](this[_0xb00b('0x14')]))[_0xb00b('0x57')](function(_0x5dbe00){if(!_['isNil'](_0x5dbe00)){for(var _0x47c6c0=0x0;_0x47c6c0<_0x5dbe00[_0xb00b('0x58')];_0x47c6c0+=0x1){if(ut[_0xb00b('0x59')](_0x5dbe00[_0x47c6c0]['scheduledat'])<_0xd97f49[_0xb00b('0x5a')]*0x3c){if(_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')]&&!_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')][_0xb00b('0x5c')]){_0x1b4f09['run'](_0x5dbe00[_0x47c6c0]['id'])['then'](ut[_0xb00b('0x5d')](_0xb00b('0x5e')))['catch'](ut['logger2'](_0xb00b('0x5e')));}else{rpcDb[_0xb00b('0x5f')](_0x5dbe00[_0x47c6c0]['id']);}}else{var _0x4e0be4=new Action(_0x5dbe00[_0x47c6c0],_0xd97f49);_0x4e0be4[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd97f49['outboundReCallsDay']+=0x1;ut[_0xb00b('0x61')](_0x4e0be4,0x17,'RecallInQueue');if(_0xd97f49[_0xb00b('0x62')]){rpcDb[_0xb00b('0x63')](ut[_0xb00b('0x64')](_0x5dbe00[_0x47c6c0]));rpcDb[_0xb00b('0x65')](_0x4e0be4,_0xb00b('0x66'));}else{ut[_0xb00b('0x61')](_0x4e0be4,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e0be4,_0xb00b('0x67'));rpcDb[_0xb00b('0x68')](_0x4e0be4,'[HistoryRecallClose]');}}}}})[_0xb00b('0x69')](ut[_0xb00b('0x5d')]('[getContactRecallMe]'));};Preview[_0xb00b('0xd')][_0xb00b('0x3c')]=function(_0x3b5d82){_0x3b5d82['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3b5d82[_0xb00b('0x6a')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6b')];}else if(!ut['isActive'](_0x3b5d82[_0xb00b('0x3b')])){_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xb00b('0x6c')](_0x3b5d82['Trunk'])){if(!this[_0xb00b('0x6c')](_0x3b5d82[_0xb00b('0x6d')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6e')];}else{_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS'][_0xb00b('0x6f')];}}else{_0x3b5d82['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];}};Preview[_0xb00b('0xd')]['callProgressDetectingCustomer']=function(_0x248335,_0x25f1f6,_0x4ba53a){var _0x598a55=this;var _0x24e826=this[_0xb00b('0x13')][_0x25f1f6];var _0x219b74=this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]];var _0x279467;var _0x347949=![];var _0x3a0b90=0x2;var _0x4c3067=0x3;if(_0x219b74){switch(_0x4ba53a){case'1':_0x219b74[_0xb00b('0x70')]+=0x1;_0x24e826[_0xb00b('0x71')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x0,_0xb00b('0x73'));ami[_0xb00b('0x23')](_0xb00b('0x74'),ut[_0xb00b('0x75')](_0x24e826,'nosuchnumber'));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x76'));_0x598a55[_0xb00b('0x77')](_0x24e826,'0',_0x219b74)[_0xb00b('0x57')](function(_0x4b1e5f){_0x347949=_0x4b1e5f[_0xb00b('0x78')]==0x1;_0x3a0b90=_0x219b74[_0xb00b('0x79')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb['createCustomerFinal'](_0x279467,_0xb00b('0x7f'));}else{if(_0x24e826['countnosuchnumberretry']>=_0x219b74[_0xb00b('0x80')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0x81')](_0x24e826,'countnosuchnumberretry',_0x219b74[_0xb00b('0x79')]),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}delete this['actions'][_0x248335['linkedid']];}else{_0x24e826['countnosuchnumberretry']++;logger[_0xb00b('0x41')](_0xb00b('0x84'),_0x24e826[_0xb00b('0x71')]);logger['info']('id',_0x24e826[_0xb00b('0x85')]);_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnosuchnumberretry':_0x24e826[_0xb00b('0x71')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0x87'):var _0x5622a4=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x24e826[_0xb00b('0x89')]=_0x5622a4;_0x24e826['answertime']=_0x5622a4;_0x24e826['dialAnswer']=!![];_0x219b74[_0xb00b('0x29')]+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x8a'),_0x24e826['uniqueid'],'\x20Queue',_0x219b74['name'],'pTalking:\x20',_0x219b74[_0xb00b('0x29')]);ami['emit'](_0xb00b('0x8b'),ut[_0xb00b('0x75')](_0x24e826,'connect',this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));if(_0x219b74[_0xb00b('0x8c')]){ami[_0xb00b('0x23')](_0xb00b('0x8d'),ut['buildAcw'](_0x24e826));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0x8e'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0x8f'),this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x75')](_0x24e826,'complete'));_0x219b74[_0xb00b('0x90')]+=0x1;_0x219b74[_0xb00b('0x91')]+=0x1;_0x219b74[_0xb00b('0x92')]+=0x1;ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0x94'));_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x4,'Answer');rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x95'));rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0x96'));rpcDb[_0xb00b('0x97')](_0x24e826);_0x219b74[_0xb00b('0x98')]+=_0x24e826[_0xb00b('0x99')];_0x219b74[_0xb00b('0x9a')]+=_0x24e826['talktime'];logger[_0xb00b('0x41')](_0xb00b('0x9b'),_0x24e826[_0xb00b('0x9c')],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x9e'),_0x219b74[_0xb00b('0x29')]);delete this['actions'][_0x248335[_0xb00b('0x9f')]];break;case _0xb00b('0xa0'):_0x219b74[_0xb00b('0xa1')]+=0x1;_0x24e826[_0xb00b('0xa2')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x5,_0xb00b('0xa3'));_0x3a0b90=_0x219b74['dialBusyRetryFrequency'];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami['emit'](_0xb00b('0xa4'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xa5')));rpcDb['createCustomerHistory'](_0x24e826,'[callProgressDetectingCustomer][logBusy]');_0x598a55[_0xb00b('0x77')](_0x24e826,'5',_0x219b74)[_0xb00b('0x57')](function(_0x33a483){_0x347949=_0x33a483[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xa6'));}else{if(_0x24e826[_0xb00b('0xa2')]>=_0x219b74[_0xb00b('0xa7')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xa8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24e826,_0xb00b('0xa2'),_0x219b74[_0xb00b('0xa9')]),_0x24e826['unlockAgent'],_0x24e826['activeContact']);}}}else{_0x24e826[_0xb00b('0xa2')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countbusyretry':_0x24e826['countbusyretry']}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xab'):_0x219b74[_0xb00b('0xac')]+=0x1;_0x24e826[_0xb00b('0xad')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x3,'NoAnswer');_0x3a0b90=_0x219b74[_0xb00b('0xae')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];var _0x545dfd=ut[_0xb00b('0xaf')](_0x24e826,_0x219b74);ami[_0xb00b('0x23')](_0xb00b('0xb0'),_0x545dfd);rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xb1'));_0x598a55[_0xb00b('0x77')](_0x24e826,'3',_0x219b74)[_0xb00b('0x57')](function(_0x2423b2){_0x347949=_0x2423b2[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,'Global');rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xb2'));}else{if(_0x24e826[_0xb00b('0xad')]>=_0x219b74[_0xb00b('0xb3')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0xb1'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xad'),_0x219b74[_0xb00b('0xae')]),_0x24e826['unlockAgent'],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826['countnoanswerretry']}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xb5'):_0x219b74[_0xb00b('0xb6')]+=0x1;_0x24e826[_0xb00b('0xb7')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x8,_0xb00b('0xb8'));_0x3a0b90=_0x219b74[_0xb00b('0xb9')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami[_0xb00b('0x23')]('custom:agentcongestion',ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xba')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xbb'));_0x598a55['verifyAdditionalPhones'](_0x24e826,'8',_0x219b74)[_0xb00b('0x57')](function(_0xb27b8b){_0x347949=_0xb27b8b['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24e826[_0xb00b('0xb7')]>=_0x219b74[_0xb00b('0xbc')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xbb'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xb7'),_0x219b74[_0xb00b('0xa9')]),_0x24e826[_0xb00b('0x82')],_0x24e826['activeContact']);}}}else{_0x24e826['countcongestionretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countcongestionretry':_0x24e826[_0xb00b('0xb7')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xbd'):_0x219b74['outboundRejectCallsDay']+=0x1;_0x24e826[_0xb00b('0xbe')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x14,_0xb00b('0xbf'));_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74['callAdditionalPhoneAfterMin'];ami[_0xb00b('0x23')](_0xb00b('0xc1'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xc2')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xc3'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x55ea09){_0x347949=_0x55ea09[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x14,'AgentReject');rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24e826[_0xb00b('0xbe')]>=_0x219b74['dialAgentRejectMaxRetry']){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xbe'),_0x219b74['dialAgentRejectRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826['countnoanswerretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826['idContact'],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'ABANDONED':_0x219b74[_0xb00b('0xc5')]+=0x1;_0x24e826[_0xb00b('0xc6')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xc7'));_0x598a55[_0xb00b('0x77')](_0x24e826,'11',_0x219b74)[_0xb00b('0x57')](function(_0x2d5652){_0x347949=_0x2d5652[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut['totalGlobal'](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xc7'));}else{if(_0x24e826[_0xb00b('0xc8')]>=_0x219b74[_0xb00b('0xc9')]){rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb00b('0xb4')](ut['scheduledAt'](_0x24e826,_0xb00b('0xc6'),_0x219b74['dialAbandonedRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'18':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0xcb')]+=0x1;_0x24e826['countglobal']=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x12,_0x248335[_0xb00b('0xcc')]||_0x248335[_0xb00b('0xcd')]);ami['emit'](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,'amd'));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');_0x598a55[_0xb00b('0x77')](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x49fe3f){_0x347949=_0x49fe3f[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x12,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})['then'](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335['linkedid']];break;case'19':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x13,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);ami[_0xb00b('0x23')](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xcf')));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][machine]');_0x598a55['verifyAdditionalPhones'](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x23d306){_0x347949=_0x23d306[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut['cloneAction'](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd0'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd0'));}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55['incrementPreviewCounters']({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];break;default:if(_0x24e826[_0xb00b('0x46')]){ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0xd1'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x219b74[_0xb00b('0x33')],_0x248335);}_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut['logCustomer'](_0x24e826,0xc,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xd2'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x142674){_0x347949=_0x142674['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd3'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd3'));}delete this['actions'][_0x248335[_0xb00b('0x9f')]];}else{_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});}});}if(!(_0x24e826[_0xb00b('0x46')]&&_0x4ba53a==='16')){ut[_0xb00b('0x4e')](_0x219b74,_0xb00b('0xd4'));logger[_0xb00b('0x41')](_0xb00b('0xd5'),_0x24e826['uniqueid'],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x44'),_0x219b74[_0xb00b('0xd6')]);}if(_0x4ba53a!=='ANSWER'){delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0xd7')]];}_0x219b74[_0xb00b('0xd8')]=!![];}};Preview[_0xb00b('0xd')][_0xb00b('0xd9')]=function(_0x3184de,_0x48ac4b,_0x5f0fab){if(_[_0xb00b('0xda')](_0x48ac4b)&&_0xb00b('0xdb')!==typeof _0x48ac4b){return;}if(_[_0xb00b('0xda')](_0x5f0fab)&&'object'!==typeof _0x5f0fab){return;}switch(_0x5f0fab[_0xb00b('0xdc')]){case'0':ut[_0xb00b('0xdd')](_0x3184de,0x0,_0xb00b('0x73'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xde'));break;case'3':ut[_0xb00b('0xdd')](_0x3184de,0x3,_0xb00b('0xdf'));rpcDb['createAgentHistory'](_0x3184de,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xb00b('0xdd')](_0x3184de,0x5,'Busy');rpcDb[_0xb00b('0xe0')](_0x3184de,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3184de,0x8,_0xb00b('0xb8'));rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));break;case'22':ut[_0xb00b('0xdd')](_0x3184de,0x16,_0xb00b('0xe2'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xe3'));break;default:ut['logAgent'](_0x3184de,0xc,_0x5f0fab['reason']);rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));}ut[_0xb00b('0x4e')](_0x48ac4b,_0xb00b('0xe4'));logger[_0xb00b('0x41')](_0xb00b('0xe5'),_0x3184de['uniqueid'],_0xb00b('0x9d'),_0x48ac4b['name'],_0xb00b('0x44'),_0x48ac4b[_0xb00b('0xd6')]);delete this[_0xb00b('0x13')][_0x3184de['uniqueid']];};Preview[_0xb00b('0xd')][_0xb00b('0x77')]=function(_0x20790f,_0x3dc8d2,_0x5d224c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20790f,_0x3dc8d2,_0x5d224c)[_0xb00b('0x69')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')]['swapAdditionalPhones']=function(_0x505ae2,_0x2fecca,_0x330bc7){return cmHopperAdditionalPhone[_0xb00b('0xaa')](_0x505ae2,_0x2fecca,_0x330bc7)[_0xb00b('0x69')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')][_0xb00b('0x86')]=function(_0x9facaf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb00b('0x86')](_0x9facaf))['catch'](logger['info'](_0xb00b('0xe6')));};Preview['prototype'][_0xb00b('0xe7')]=function(_0x481671,_0x1b751e,_0x5712fd,_0x3de808,_0x3289aa){var _0x1ec560=this;return new Promise(function(_0x54498c,_0x442b28){if(_['isNil'](_0x1b751e)||_[_0xb00b('0x40')](_0x1b751e[_0xb00b('0xe8')])||_['isNil'](_0x1b751e['phone'])||_['isNil'](_0x1b751e['VoiceQueueId'])){_0x442b28(ut[_0xb00b('0x2e')]('Contact\x20is\x20undefined',_0x3de808,_0x3289aa));return;}var _0x134d17=uuid['v4']();var _0x5ad4d4=_0x1ec560[_0xb00b('0x22')][_0x1b751e[_0xb00b('0x42')][_0xb00b('0x33')]];var _0x44b2f1=_0x5712fd?_0x1ec560[_0xb00b('0x14')][_0x5712fd]['id']:undefined;_0x1ec560['actions'][_0x134d17]=new Action(_0x1b751e,_0x5ad4d4,_0x134d17,_0x5712fd,_0x44b2f1);var _0x8292fe=_0x1ec560[_0xb00b('0x13')][_0x134d17];_0x8292fe[_0xb00b('0x82')]=_0x3de808;_0x8292fe[_0xb00b('0x83')]=_0x3289aa;_0x8292fe['lookAgent']=_0x5712fd;if(_['isEmpty'](_0x481671)){_0x1ec560[_0xb00b('0xe9')](_0x8292fe,_0x5ad4d4,_0x1b751e,_0x5712fd)[_0xb00b('0x57')](function(_0x181393){logger[_0xb00b('0x41')](_0xb00b('0xea'),_0xb00b('0xeb')+_0x8292fe[_0xb00b('0x43')]+_0xb00b('0xec')+_0x8292fe[_0xb00b('0x85')],JSON['stringify'](_0x181393));ami[_0xb00b('0x23')](_0xb00b('0xed'),ut['buildObj'](_0x8292fe,_0xb00b('0xee'),_0x1ec560['campaignsPreview'][_0x8292fe[_0xb00b('0x43')]]));_0x54498c(ut[_0xb00b('0x2e')]('Calling'));})['catch'](function(_0x32264a){ut[_0xb00b('0x31')](_0xb00b('0xef'),_0x32264a);_0x442b28(ut['message'](_0xb00b('0xf0'),_0x3de808,_0x3289aa));});}else{_0x5ad4d4[_0xb00b('0xf1')]+=0x1;ut[_0xb00b('0xf2')](_0x8292fe);rpcDb['createHistory'](_0x8292fe,_0xb00b('0xf3'));delete _0x1ec560['actions'][_0x134d17];_0x442b28(ut['message']('Contact\x20in\x20black\x20List',_0x3de808,_0x3289aa));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x1b8d45){return!_[_0xb00b('0x40')](_0x1b8d45)&&!_['isNil'](_0x1b8d45['name'])&&!_[_0xb00b('0x40')](_0x1b8d45[_0xb00b('0xf4')])&&_0x1b8d45['active']&&!_[_0xb00b('0x40')](this[_0xb00b('0x12')][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45[_0xb00b('0x33')])])&&!_[_0xb00b('0x40')](this['trunks'][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')])&&(this['trunks'][util['format'](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf7')||this[_0xb00b('0x12')][util['format']('SIP/%s',_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf8'));};Preview['prototype'][_0xb00b('0xf9')]=function(_0x18e86f,_0x3aa8c0){return this[_0xb00b('0xfa')](_0x18e86f,_0x3aa8c0)[_0xb00b('0x57')](function(_0x166ff5){return _[_0xb00b('0xfb')](_0x166ff5,[_0xb00b('0x2e')]);})['catch'](function(_0x1b097a){if(_0x1b097a[_0xb00b('0xfc')]){rpcDb[_0xb00b('0xfd')](_0x18e86f);}if(_0x1b097a['active']){rpcDb['disableContact'](_0x18e86f);}throw _['pick'](_0x1b097a,[_0xb00b('0x2e')]);});};Preview[_0xb00b('0xd')][_0xb00b('0xfa')]=function(_0x4bc6df,_0x399902){var _0x34985d=this;var _0x2057d1,_0xdee547;return rpcDb[_0xb00b('0xfe')](_0x4bc6df)['then'](function(_0x1674ab){if(!_['isNil'](_0x1674ab[0x0])){_0xdee547=_0x1674ab[0x0][_0xb00b('0xff')]?![]:!![];_0x2057d1=_0x1674ab[0x0][_0xb00b('0xff')]?!![]:![];_0x2057d1=_0x399902?!![]:_0x2057d1;}var _0xde6b5=_0x34985d[_0xb00b('0x100')](_0x1674ab);if(_0xde6b5[_0xb00b('0x101')]){rpcDb[_0xb00b('0x102')](_['pick'](_0x1674ab[0x0],[_0xb00b('0x49'),_0xb00b('0x103')]))[_0xb00b('0x57')](function(_0x278d9e){_0x34985d[_0xb00b('0xe7')](_0x278d9e,_0x1674ab[0x0],_0x399902,_0xdee547,_0x2057d1)[_0xb00b('0x57')](function(_0x26cd15){return _0x26cd15;})[_0xb00b('0x69')](function(_0xd2f1ba){throw _0xd2f1ba;});})[_0xb00b('0x69')](function(_0x5f1258){ut[_0xb00b('0x31')](_0xb00b('0x104'),_0x5f1258);throw ut['message'](_0xb00b('0x105'),_0xdee547,_0x2057d1);});}else{throw ut['message'](_0xde6b5['message'],_0xdee547,_0x2057d1);}})['catch'](function(_0x384a16){ut['logger'](_0xb00b('0x106'),_0x384a16);throw ut[_0xb00b('0x2e')](_0xb00b('0x105'),![],!![]);});};Preview[_0xb00b('0xd')][_0xb00b('0x100')]=function(_0x116ced){if(_[_0xb00b('0x40')](_0x116ced)||_[_0xb00b('0x107')](_0x116ced)||!_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')])&&_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')][_0xb00b('0x33')])){ut[_0xb00b('0x31')]('[Preview][validateContact][Empty\x20Contact]',_0x116ced);return{'isValid':![],'message':_0xb00b('0x108')};}var _0x15f9cd=this[_0xb00b('0x22')][_0x116ced[0x0][_0xb00b('0x42')][_0xb00b('0x33')]];_0x15f9cd['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];if(_['isNil'](_0x15f9cd)){ut['logger'](_0xb00b('0x109'),_0x15f9cd);return{'isValid':![],'message':_0xb00b('0x10a')};}if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x10b')])){ut[_0xb00b('0x31')](_0xb00b('0x10c'),_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x10e'));if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x6d')])){ut['logger'](_0xb00b('0x10c'),_0x15f9cd['name']+_0xb00b('0x10f'));return{'isValid':![],'message':_0xb00b('0x110')};}}if(!ut[_0xb00b('0x111')](_0x15f9cd[_0xb00b('0x3b')])){ut[_0xb00b('0x31')](_0xb00b('0x112'),_0x15f9cd['name']+_0xb00b('0x113'));return{'isValid':![],'message':_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x113')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb00b('0xd')][_0xb00b('0xe9')]=function(_0x58dbf6,_0x199ba1,_0x16cca9,_0x3c57b2){var _0xca4a87=this;return new Promise(function(_0x456515,_0x26145a){var _0x31fa5b=_0x58dbf6[_0xb00b('0x9c')];var _0x1ba141=_0xca4a87['isTrunkReachable'](_0x199ba1[_0xb00b('0x10b')])?util[_0xb00b('0x25')]('SIP/%s/%s%s',_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x114')])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1[_0xb00b('0x116')]>0x0?_0x16cca9[_0xb00b('0x103')][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9[_0xb00b('0x103')]):util['format'](_0xb00b('0x118'),_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1['Trunk'][_0xb00b('0x33')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1['dialPrefix'])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1['dialCutDigit']>0x0?_0x16cca9['phone'][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9['phone']);var _0x1256a8=_0xca4a87['isTrunkReachable'](_0x199ba1['Trunk'])?ut[_0xb00b('0x119')](_0x199ba1['Trunk']['callerid'],_0x199ba1[_0xb00b('0x11a')],_0x199ba1[_0xb00b('0x11b')]>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1[_0xb00b('0x11b')]):_0x199ba1[_0xb00b('0x11d')]):ut[_0xb00b('0x119')](_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x11e')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x11e')],_0x199ba1[_0xb00b('0x11a')],_0x199ba1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1['dialRandomLastDigitCallerIdNumber']):_0x199ba1[_0xb00b('0x11d')]);if(_0x1256a8){_0x58dbf6['originatecalleridname']=ut[_0xb00b('0x11f')](_0x1256a8);_0x58dbf6[_0xb00b('0x120')]=ut[_0xb00b('0x121')](_0x1256a8);}var _0x5657ee=ut[_0xb00b('0x122')](_0x199ba1,_0x16cca9,_0x1ba141,_0x1256a8,_0x31fa5b,_0x58dbf6);_[_0xb00b('0x123')](_0x58dbf6,ut['toLowerVariables'](_0x5657ee));_0x58dbf6[_0xb00b('0x60')]=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x199ba1[_0xb00b('0x124')]=_0x5657ee;var _0x57bfab=ut[_0xb00b('0x125')](_0x58dbf6,_0x199ba1,_0x5657ee,_0x58dbf6[_0xb00b('0x83')],_0x3c57b2);return ami[_0xb00b('0x4b')](_0x57bfab)['then'](function(_0x571811){_0x199ba1['originated']+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x126'),_0x31fa5b,_0xb00b('0x9d'),_0x199ba1[_0xb00b('0x33')],_0xb00b('0x44'),_0x199ba1[_0xb00b('0xd6')]);_0x456515(_0x571811);})[_0xb00b('0x69')](function(_0x39b4c6){ut[_0xb00b('0xdd')](_0x58dbf6,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58dbf6,_0xb00b('0x127'));_0x26145a(_0x39b4c6);});});};Preview[_0xb00b('0xd')]['syncNewExten']=function(_0x42fdce){if(this['actions'][_0x42fdce[_0xb00b('0x9f')]]){this['actions'][_0x42fdce[_0xb00b('0x9f')]][_0xb00b('0x4c')]=_0x42fdce['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x5573c9){var _0x44767a=this;var _0x4d4dbe=this[_0xb00b('0x13')][_0x5573c9[_0xb00b('0x128')]];if(_0x4d4dbe){if(_0x4d4dbe[_0xb00b('0x129')]&&this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]]){ut[_0xb00b('0x12a')](_0x4d4dbe,this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]][_0xb00b('0x33')],this[_0xb00b('0x14')][_0x4d4dbe['lookAgent']]['id']);}var _0x4cff99=_[_0xb00b('0x12b')](_0x4d4dbe);_0x4cff99['responsetime']=moment()[_0xb00b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x198536=_0x44767a[_0xb00b('0x22')][_0x4d4dbe['queue']];if(ut[_0xb00b('0x12c')](_0x5573c9['response'])){if(_0x4d4dbe[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x4d4dbe['idContact']);}if(_0x4d4dbe[_0xb00b('0x83')]){rpcDb[_0xb00b('0x5f')](_0x4d4dbe[_0xb00b('0x85')]);}ami[_0xb00b('0x23')](_0xb00b('0x12d'),ut['buildObj'](_0x4d4dbe,_0xb00b('0x12e'),this[_0xb00b('0x22')][_0x4d4dbe['queue']]));this['callProgressDetectingAgent'](_0x4cff99,_0x198536,_0x5573c9);}else{_0x4d4dbe[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x4cff99,0x4,_0xb00b('0x12f'));rpcDb[_0xb00b('0xe0')](_0x4cff99,_0xb00b('0x130'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0xcaefbd){var _0x482fc4=this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]];var _0x22f2f6;if(_0x482fc4){_0x22f2f6=this[_0xb00b('0x22')][_0x482fc4['queue']];logger[_0xb00b('0x41')](_0xb00b('0x131'),_0xcaefbd['linkedid'],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6['pTalking']);}if(this['actions'][_0xcaefbd[_0xb00b('0x9f')]]&&_0xcaefbd[_0xb00b('0x9f')]!==_0xcaefbd[_0xb00b('0x9c')]){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){this['callProgressDetectingCustomer'](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this['actions'][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger[_0xb00b('0x41')]('[syncHangup][talking][cause]',_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6['name'],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}else if(_0x482fc4&&_[_0xb00b('0x40')](_0x482fc4[_0xb00b('0x134')])&&_0x22f2f6['dialQueueProject']&&_0xcaefbd[_0xb00b('0x9f')]===_0xcaefbd[_0xb00b('0x9c')]&&_['isNil'](_0xcaefbd['reason'])&&_0xcaefbd['cause']==='16'&&_0xcaefbd[_0xb00b('0x135')]==='6'&&_[_0xb00b('0xda')](_0x482fc4[_0xb00b('0x136')])){if(_0x482fc4[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x482fc4[_0xb00b('0x85')]);}if(_0x482fc4[_0xb00b('0x83')]){rpcDb['disableContact'](_0x482fc4['idContact']);}_0xcaefbd[_0xb00b('0xdc')]='22';this[_0xb00b('0xd9')](_0x482fc4,_0x22f2f6,_0xcaefbd);}else if(_0x482fc4&&_0x482fc4['transfer']){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger['info'](_0xb00b('0x137'),_0xcaefbd['linkedid'],_0xcaefbd['cause'],'\x20Queue',_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){logger[_0xb00b('0x41')](_0xb00b('0x138'),_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],'pTalking:\x20',_0x22f2f6['pTalking']);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x1e0206){if(this[_0xb00b('0x13')][_0x1e0206[_0xb00b('0xd7')]]&&_0x1e0206[_0xb00b('0xd7')]!==_0x1e0206['destuniqueid']){this[_0xb00b('0x133')](_0x1e0206,_0x1e0206[_0xb00b('0xd7')],_0x1e0206[_0xb00b('0xcd')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x45ad1f){if(this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]]&&_0x45ad1f[_0xb00b('0x9f')]!==_0x45ad1f[_0xb00b('0x9c')]&&!this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]][_0xb00b('0x46')]){if(_0x45ad1f[_0xb00b('0x132')]==='1'){this['callProgressDetectingCustomer'](_0x45ad1f,_0x45ad1f['linkedid'],_0x45ad1f[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x139')]=function(_0x121451,_0x2e9604,_0x19fce8){if(this[_0xb00b('0x13')][_0x121451]){if(_['isNil'](this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')])){this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')]={};}this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')][_0x2e9604]=_0x19fce8;}};Preview['prototype'][_0xb00b('0x13a')]=function(_0x1ec1c7){try{if(!_['isNil'](_0x1ec1c7)){if(ut[_0xb00b('0x13b')](_[_0xb00b('0x13c')](_0x1ec1c7[_0xb00b('0x13d')])[0x0])){this[_0xb00b('0x139')](_0x1ec1c7[_0xb00b('0x9c')],_[_0xb00b('0x13c')](_0x1ec1c7['variable'])[0x0],_0x1ec1c7['value']);}}}catch(_0x465238){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x465238,{'showHidden':![],'depth':null}));}};Preview[_0xb00b('0xd')][_0xb00b('0x1f')]=function(_0x5a400c){if(_0x5a400c){if(this['actions'][_0x5a400c[_0xb00b('0x13e')]]){this[_0xb00b('0x13')][_0x5a400c[_0xb00b('0x13e')]][_0xb00b('0x136')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x3fd141){if(_0x3fd141){if(this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]){this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]['transfer']=!![];}}};module[_0xb00b('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 66d60f2..30de470 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 _0x0792=['../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview'];(function(_0xbfec58,_0x5f4153){var _0x3dc84d=function(_0x498ef6){while(--_0x498ef6){_0xbfec58['push'](_0xbfec58['shift']());}};_0x3dc84d(++_0x5f4153);}(_0x0792,0x17d));var _0x2079=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x0792[_0x35a274];return _0x40d905;};'use strict';var util=require(_0x2079('0x0'));var BPromise=require(_0x2079('0x1'));var logger=require(_0x2079('0x2'))(_0x2079('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x2079('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x2079('0x5'));var voiceQueueReport=require(_0x2079('0x6'));function loggerCatch(_0x3189cb){return function(_0x3c01ed){logger[_0x2079('0x7')](_0x3189cb,util['inspect'](_0x3c01ed,{'showHidden':![],'depth':null}));};}function create(_0x5aad8f){return cmHopperHistory[_0x2079('0x8')](_0x5aad8f)[_0x2079('0x9')](loggerCatch(_0x2079('0xa')));}function createAgent(_0x466d2f){return BPromise[_0x2079('0xb')]()[_0x2079('0xc')](agentReportPreview[_0x2079('0x8')](_0x466d2f))[_0x2079('0x9')](loggerCatch(_0x2079('0xa')));}function moveContact(_0x27c848){return cmHopper[_0x2079('0xd')](_0x27c848,!![])[_0x2079('0x9')](loggerCatch(_0x2079('0xe')));}exports[_0x2079('0xf')]=function(_0x1e0622){return cmHopperBlack[_0x2079('0xf')](_0x1e0622)[_0x2079('0x9')](loggerCatch(_0x2079('0x10')));};exports[_0x2079('0x11')]=function(_0x21b413){return BPromise['resolve']()['then'](cmHopper[_0x2079('0x11')](_0x21b413))['catch'](loggerCatch(_0x2079('0x12')));};exports[_0x2079('0x8')]=function(_0x161a4e,_0x560e3e){create(_0x161a4e)['catch'](loggerCatch(_0x560e3e));moveContact(_0x161a4e)['catch'](loggerCatch(_0x560e3e));};exports[_0x2079('0x13')]=function(_0x378467,_0x5e3f4f){createAgent(_0x378467)[_0x2079('0x9')](loggerCatch(_0x5e3f4f));};exports[_0x2079('0x14')]=function(_0x5835af,_0x474e87){create(_0x5835af)['catch'](loggerCatch(_0x474e87));};exports['createCustomerFinal']=function(_0x4e70a5,_0x162245){moveContact(_0x4e70a5)[_0x2079('0x9')](loggerCatch(_0x162245));};exports[_0x2079('0x15')]=function(_0x1b8ab8,_0x1755af,_0x479735){if(_0x1755af){_0x1b8ab8[_0x2079('0x16')]=null;}if(_0x479735){_0x1b8ab8[_0x2079('0x17')]=![];}return cmHopper[_0x2079('0x15')](_0x1b8ab8)['catch'](loggerCatch(_0x2079('0x18')));};exports['countReScheduled']=function(_0x2e3079){return cmHopper[_0x2079('0x19')](_0x2e3079)[_0x2079('0x9')](loggerCatch(_0x2079('0x1a')));};exports[_0x2079('0x1b')]=function(_0x512ea8){return cmHopper['unlockContact']({'UserId':null},_0x512ea8,0x1)[_0x2079('0x9')](loggerCatch(_0x2079('0x1c')));};exports[_0x2079('0x1d')]=function(_0x1543ed){return cmHopper['unlockContact']({'active':![]},_0x1543ed,0x1)['catch'](loggerCatch(_0x2079('0x1e')));};exports[_0x2079('0x1f')]=function(_0x321f60){var _0x55257b={};_0x55257b[_0x2079('0x20')]=_0x321f60[_0x2079('0x20')];_0x55257b[_0x2079('0x21')]=_0x321f60[_0x2079('0x21')];_0x55257b['calleridnum']=_0x321f60['calleridnum'];_0x55257b[_0x2079('0x22')]=_0x321f60[_0x2079('0x22')];_0x55257b[_0x2079('0x23')]=_0x321f60['queue'];_0x55257b['queuecallerjoinAt']=_0x321f60[_0x2079('0x24')];_0x55257b[_0x2079('0x25')]=_0x321f60[_0x2079('0x24')];_0x55257b['queuecallercomplete']=0x1;_0x55257b['queuecallercompleteAt']=_0x321f60[_0x2079('0x26')];_0x55257b[_0x2079('0x27')]=_0x321f60[_0x2079('0x28')];_0x55257b[_0x2079('0x29')]=_0x2079('0x2a');_0x55257b[_0x2079('0x2b')]=_0x2079('0x2c');_0x55257b[_0x2079('0x2d')]=0x0;_0x55257b[_0x2079('0x2e')]=0x1;_0x55257b[_0x2079('0x2f')]=_0x321f60[_0x2079('0x28')];_0x55257b[_0x2079('0x30')]=_0x2079('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0x2079('0x32')](_0x55257b))[_0x2079('0x9')](loggerCatch(_0x2079('0x33')));};exports[_0x2079('0x34')]=function(_0x567be6,_0x2fa6f2){return BPromise[_0x2079('0xb')]()[_0x2079('0xc')](cmHopper[_0x2079('0x34')](_0x567be6,_0x2fa6f2))[_0x2079('0x9')](loggerCatch(_0x2079('0x35')));};exports[_0x2079('0x36')]=function(_0x204ec4){return cmHopper[_0x2079('0x15')](_0x204ec4,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5f6b=['calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5f6b,0xde));var _0xb5f6=function(_0x171b89,_0xde7fb6){_0x171b89=_0x171b89-0x0;var _0x284ee1=_0x5f6b[_0x171b89];return _0x284ee1;};'use strict';var util=require(_0xb5f6('0x0'));var BPromise=require(_0xb5f6('0x1'));var logger=require(_0xb5f6('0x2'))(_0xb5f6('0x3'));var cmHopper=require(_0xb5f6('0x4'));var cmHopperHistory=require(_0xb5f6('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xb5f6('0x6'));var voiceQueueReport=require(_0xb5f6('0x7'));function loggerCatch(_0x120db9){return function(_0x3f4df4){logger[_0xb5f6('0x8')](_0x120db9,util[_0xb5f6('0x9')](_0x3f4df4,{'showHidden':![],'depth':null}));};}function create(_0x4ea3d5){return cmHopperHistory[_0xb5f6('0xa')](_0x4ea3d5)[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0xc')));}function createAgent(_0x43cac8){return BPromise[_0xb5f6('0xd')]()[_0xb5f6('0xe')](agentReportPreview['createHistory'](_0x43cac8))['catch'](loggerCatch(_0xb5f6('0xc')));}function moveContact(_0x221b54){return cmHopper[_0xb5f6('0xf')](_0x221b54,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x12645f){return cmHopperBlack[_0xb5f6('0x10')](_0x12645f)[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0x11')));};exports[_0xb5f6('0x12')]=function(_0x17fffe){return BPromise['resolve']()[_0xb5f6('0xe')](cmHopper[_0xb5f6('0x12')](_0x17fffe))[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0x13')));};exports[_0xb5f6('0xa')]=function(_0x3112a7,_0x3c5792){create(_0x3112a7)[_0xb5f6('0xb')](loggerCatch(_0x3c5792));moveContact(_0x3112a7)[_0xb5f6('0xb')](loggerCatch(_0x3c5792));};exports['createAgentHistory']=function(_0x156bf3,_0x1055b6){createAgent(_0x156bf3)[_0xb5f6('0xb')](loggerCatch(_0x1055b6));};exports['createCustomerHistory']=function(_0x2cfd23,_0x2557bd){create(_0x2cfd23)[_0xb5f6('0xb')](loggerCatch(_0x2557bd));};exports[_0xb5f6('0x14')]=function(_0x41a837,_0x5271cd){moveContact(_0x41a837)['catch'](loggerCatch(_0x5271cd));};exports[_0xb5f6('0x15')]=function(_0x4dc280,_0xa26454,_0x60f8c4){if(_0xa26454){_0x4dc280['UserId']=null;}if(_0x60f8c4){_0x4dc280[_0xb5f6('0x16')]=![];}return cmHopper[_0xb5f6('0x15')](_0x4dc280)['catch'](loggerCatch(_0xb5f6('0x17')));};exports[_0xb5f6('0x18')]=function(_0x28531f){return cmHopper[_0xb5f6('0x18')](_0x28531f)[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0x19')));};exports[_0xb5f6('0x1a')]=function(_0x19670f){return cmHopper[_0xb5f6('0x1a')]({'UserId':null},_0x19670f,0x1)[_0xb5f6('0xb')](loggerCatch('[unlockContact]\x20'));};exports[_0xb5f6('0x1b')]=function(_0x139712){return cmHopper[_0xb5f6('0x1a')]({'active':![]},_0x139712,0x1)[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0x1c')));};exports[_0xb5f6('0x1d')]=function(_0x4f5edd){var _0x1c4a2c={};_0x1c4a2c[_0xb5f6('0x1e')]=_0x4f5edd[_0xb5f6('0x1e')];_0x1c4a2c[_0xb5f6('0x1f')]=_0x4f5edd[_0xb5f6('0x1f')];_0x1c4a2c['calleridnum']=_0x4f5edd[_0xb5f6('0x20')];_0x1c4a2c[_0xb5f6('0x21')]=_0x4f5edd[_0xb5f6('0x21')];_0x1c4a2c[_0xb5f6('0x22')]=_0x4f5edd[_0xb5f6('0x22')];_0x1c4a2c[_0xb5f6('0x23')]=_0x4f5edd[_0xb5f6('0x24')];_0x1c4a2c['queuecallerleaveAt']=_0x4f5edd[_0xb5f6('0x24')];_0x1c4a2c[_0xb5f6('0x25')]=0x1;_0x1c4a2c[_0xb5f6('0x26')]=_0x4f5edd[_0xb5f6('0x27')];_0x1c4a2c[_0xb5f6('0x28')]=_0x4f5edd[_0xb5f6('0x29')];_0x1c4a2c[_0xb5f6('0x2a')]=_0xb5f6('0x2b');_0x1c4a2c[_0xb5f6('0x2c')]='xcally-motion-preview';_0x1c4a2c[_0xb5f6('0x2d')]=0x0;_0x1c4a2c[_0xb5f6('0x2e')]=0x1;_0x1c4a2c['lastAssignedTo']=_0x4f5edd[_0xb5f6('0x29')];_0x1c4a2c[_0xb5f6('0x2f')]=_0xb5f6('0x30');return BPromise[_0xb5f6('0xd')]()[_0xb5f6('0xe')](voiceQueueReport['create'](_0x1c4a2c))['catch'](loggerCatch(_0xb5f6('0x31')));};exports['getContactRecallMe']=function(_0x9188fd,_0x5329f2){return BPromise[_0xb5f6('0xd')]()['then'](cmHopper['getContactRecallMe'](_0x9188fd,_0x5329f2))[_0xb5f6('0xb')](loggerCatch(_0xb5f6('0x32')));};exports['rescheduleContactInQueue']=function(_0xf2cfa1){return cmHopper['rescheduleContact'](_0xf2cfa1,!![],!![])[_0xb5f6('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 f5ff000..e9f4e2e 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 _0x722f=['noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','logger','info','loggerError','error','logger2','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','idContact','type','campaigntype','dialAnswer','active','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber'];(function(_0x33923a,_0x2115bb){var _0x365b2c=function(_0x18c177){while(--_0x18c177){_0x33923a['push'](_0x33923a['shift']());}};_0x365b2c(++_0x2115bb);}(_0x722f,0x13d));var _0xf722=function(_0x18af1a,_0x1595a0){_0x18af1a=_0x18af1a-0x0;var _0x5e4a08=_0x722f[_0x18af1a];return _0x5e4a08;};'use strict';var util=require(_0xf722('0x0'));var _=require(_0xf722('0x1'));var moment=require(_0xf722('0x2'));var logger=require(_0xf722('0x3'))(_0xf722('0x4'));var ipAgi=process[_0xf722('0x5')][_0xf722('0x6')]||_0xf722('0x7');var utils=require('../../dialer/utils');exports[_0xf722('0x8')]=function(_0xc7fd4){return function(_0x268e1e){logger['error'](_0xc7fd4,util['inspect'](_0x268e1e,{'showHidden':![],'depth':null}));};};exports[_0xf722('0x9')]=function(_0x58f6b8,_0x38a8b2){logger[_0xf722('0xa')](_0x58f6b8,util['inspect'](_0x38a8b2,{'showHidden':![],'depth':null}));};exports[_0xf722('0xb')]=function(_0x266ecd,_0x1eac32){logger[_0xf722('0xc')](_0x266ecd,util['inspect'](_0x1eac32,{'showHidden':![],'depth':null}));};exports[_0xf722('0xd')]=function(_0x4e5e20){return function(_0x59476c){logger[_0xf722('0xa')](_0x4e5e20,util[_0xf722('0xe')](_0x59476c,{'showHidden':![],'depth':null}));};};exports[_0xf722('0xf')]=function(_0x656526,_0x46932b,_0x312ee0){return{'message':_0x656526,'unlock':_0x46932b,'active':_0x312ee0};};exports[_0xf722('0x10')]=function(_0x6c3988,_0x3d5168,_0x447ded){if(!_[_0xf722('0x11')](_0x447ded)&&_0xf722('0x12')===typeof _0x447ded&&!_[_0xf722('0x13')](_0x447ded)){if(!_['isUndefined'](_0x3d5168)&&_0xf722('0x12')===typeof _0x3d5168&&!_[_0xf722('0x13')](_0x3d5168)){return util[_0xf722('0x14')](_0xf722('0x15'),_0x3d5168,_0x447ded);}return util[_0xf722('0x14')](_0xf722('0x15'),_0x447ded,_0x447ded);}if(!_[_0xf722('0x11')](_0x6c3988)&&_0xf722('0x12')===typeof _0x6c3988&&!_[_0xf722('0x13')](_0x6c3988)){return _0x6c3988;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x3c66b5){if(_[_0xf722('0x16')](_0x3c66b5)){return![];}return _0x3c66b5;};exports[_0xf722('0x17')]=function(_0x54a8a3,_0x15630c,_0x1c253c,_0x509d1a,_0x50c9bb,_0x4f3785){var _0x510a61={'XMD-QUEUE':_0x15630c[_0xf722('0x18')]?_0x15630c[_0xf722('0x18')]['name']:'','XMD-CALLERID':_0x509d1a,'XMD-CALLERID-PREVIEW':_0x4f3785?util[_0xf722('0x14')](_0xf722('0x15'),_0x4f3785[_0xf722('0x19')],_0x4f3785['calleridnum']):_0x509d1a,'XMD-DIALID':_0x50c9bb,'XMD-CONTACTID':_0x15630c[_0xf722('0x1a')],'XMD-CDRTYPE':_0xf722('0x1b'),'CALLERID(all)':_0x509d1a,'XMD-VOICEQUEUEID':_0x15630c[_0xf722('0x1c')],'XMD-DIALCHANNEL':_0x1c253c,'XMD-DIALTIMEOUT':_0x54a8a3[_0xf722('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xf722('0x14')](_0xf722('0x1e'),_0x54a8a3[_0xf722('0x1f')]?'g':'',_['isEmpty'](_0x54a8a3[_0xf722('0x20')])?'':_0xf722('0x21')),'XMD-DIALURL':_0x54a8a3[_0xf722('0x22')]||'','XMD-AGI':_0x54a8a3[_0xf722('0x23')]?util[_0xf722('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54a8a3[_0xf722('0x23')]):'NONE','XMD-AGIAFTER':_0x54a8a3[_0xf722('0x1f')]?util['format'](_0xf722('0x24'),ipAgi,_0x54a8a3['dialQueueProject2']):_0xf722('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x4f3785?_0x4f3785[_0xf722('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4f3785?_0x4f3785[_0xf722('0x27')]:'','XMD-DESTINATION':_0xf722('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xf722('0x13')](_0x54a8a3[_0xf722('0x20')])){_0x510a61[util[_0xf722('0x14')]('%s',_0xf722('0x29'))]=_0x54a8a3[_0xf722('0x20')];_0x510a61[util[_0xf722('0x14')]('%s',_0xf722('0x2a'))]=_0x50c9bb;}if(_0x15630c&&_0x15630c[_0xf722('0x2b')]){for(var _0x2c3bc1 in _0x15630c['Contact']){if(_0x15630c[_0xf722('0x2b')]['hasOwnProperty'](_0x2c3bc1)){if(!_[_0xf722('0x16')](_0x15630c[_0xf722('0x2b')][_0x2c3bc1])&&_0x2c3bc1!=='id'&&_0x2c3bc1!==_0xf722('0x2c')&&_0x2c3bc1!==_0xf722('0x2d')&&_0x2c3bc1!==_0xf722('0x2e')){_0x510a61[util[_0xf722('0x14')](_0xf722('0x2f'),_0xf722('0x30'),_[_0xf722('0x31')](_0x2c3bc1))]=_0x15630c['Contact'][_0x2c3bc1];}}}}return _0x510a61;};exports[_0xf722('0x32')]=function(_0xb9e30f){var _0x58354b={};for(var _0xcb5993 in _0xb9e30f){if(_0xb9e30f[_0xf722('0x33')](_0xcb5993)){_0x58354b[util['format']('%s',_[_0xf722('0x34')](_0xcb5993))]=_0xb9e30f[_0xcb5993];}}return{'variables':_0x58354b};};exports['updateOriginated']=function(_0x5bf448,_0x88d630){if(!_[_0xf722('0x16')](_0x5bf448)){if(_0x5bf448[_0xf722('0x33')](_0xf722('0x35'))){if(_0x5bf448[_0xf722('0x35')]>0x0){_0x5bf448['originated']-=0x1;}else{logger[_0xf722('0xc')](_0xf722('0x36'),_0x88d630);}}}else{logger['error'](_0xf722('0x37'),_0x88d630);}};exports['logBlacklist']=function(_0xba51cf){var _0x43aa84=moment()['format'](_0xf722('0x38'));_0xba51cf[_0xf722('0x39')]=0xd;_0xba51cf[_0xf722('0x3a')]=_0xf722('0x3b');_0xba51cf[_0xf722('0x3c')]=_0x43aa84;_0xba51cf[_0xf722('0x3d')]=_0x43aa84;_0xba51cf[_0xf722('0x3e')]=_0x43aa84;};exports[_0xf722('0x3f')]=function(_0x10daf3,_0x13633d,_0x3b13e0){var _0x4b73d5=moment()[_0xf722('0x14')](_0xf722('0x38'));_0x10daf3['state']=_0x13633d;_0x10daf3[_0xf722('0x3a')]=_0x3b13e0;_0x10daf3[_0xf722('0x3d')]=_0x4b73d5;_0x10daf3[_0xf722('0x40')]=utils['getSeconds'](_0x10daf3[_0xf722('0x3d')],_0x10daf3[_0xf722('0x3c')]);};exports[_0xf722('0x41')]=function(_0x3da284,_0x285f94,_0x1a9c14){_0x3da284[_0xf722('0x42')]=_0x285f94;_0x3da284[_0xf722('0x43')]=_0x1a9c14;};exports[_0xf722('0x44')]=function(_0x1a25f5,_0x4ae350,_0x1f8e39){var _0x5bfcc3=moment()[_0xf722('0x14')](_0xf722('0x38'));_0x1a25f5[_0xf722('0x39')]=_0x4ae350;_0x1a25f5[_0xf722('0x3a')]=_0x1f8e39;_0x1a25f5['responsetime']=_0x1a25f5[_0xf722('0x3d')]?_0x1a25f5[_0xf722('0x3d')]:_0x5bfcc3;_0x1a25f5[_0xf722('0x3e')]=_0x1a25f5['endtime']?_0x1a25f5[_0xf722('0x3e')]:_0x5bfcc3;_0x1a25f5['ringtime']=utils[_0xf722('0x45')](_0x1a25f5[_0xf722('0x3d')]||0x0,_0x1a25f5['starttime']||0x0);_0x1a25f5[_0xf722('0x46')]=_0x1a25f5[_0xf722('0x47')]?utils[_0xf722('0x45')](_0x1a25f5[_0xf722('0x3e')],_0x1a25f5[_0xf722('0x47')]):0x0;};exports[_0xf722('0x48')]=function(_0x1e4acd){return _0x1e4acd===_0xf722('0x49');};exports[_0xf722('0x4a')]=function(_0x470d2d,_0x586826,_0x4728dc,_0x4d50d1,_0x230f11){var _0x4c306c=_0x4d50d1?'RECALL':_0x470d2d[_0xf722('0x19')];_0x4c306c=_0x230f11?_0xf722('0x4b'):_0x4c306c;return{'actionid':_0x470d2d[_0xf722('0x4c')],'action':_0xf722('0x4d'),'channel':_0x470d2d[_0xf722('0x4e')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x4c306c,_0x470d2d[_0xf722('0x4f')]),'Exten':'xcally-motion-preview','Context':_0xf722('0x50'),'Priority':'1','variable':_0x4728dc,'timeout':(_0x586826['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x470d2d[_0xf722('0x4c')]};};exports[_0xf722('0x51')]=function(_0x2c00f4){return _0x2c00f4[_0xf722('0x52')]+_0x2c00f4[_0xf722('0x53')]+_0x2c00f4[_0xf722('0x54')]+_0x2c00f4[_0xf722('0x55')]+_0x2c00f4[_0xf722('0x56')];};exports[_0xf722('0x57')]=function(_0x1b1d5f){var _0x5393ed=_[_0xf722('0x58')](_0x1b1d5f);_0x5393ed[_0xf722('0x39')]=0xf;_0x5393ed['statedesc']=_0xf722('0x59');return _0x5393ed;};exports[_0xf722('0x5a')]=function(_0x5f1b12,_0x450302,_0x23407c){var _0x1bd8f5={};_0x1bd8f5[_0x450302]=_0x5f1b12[_0x450302];_0x1bd8f5['active']=![];_0x1bd8f5[_0xf722('0x5b')]=moment()[_0xf722('0x5c')](_0x23407c,'minutes')[_0xf722('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bd8f5[_0xf722('0x1a')]=_0x5f1b12[_0xf722('0x1a')];_0x1bd8f5[_0xf722('0x5d')]=_0x5f1b12['ListId'];_0x1bd8f5['VoiceQueueId']=_0x5f1b12['VoiceQueueId']||undefined;return _0x1bd8f5;};exports[_0xf722('0x5e')]=function(_0xc64115,_0x3bbd1a){if(!_['isNil'](_0xc64115)){if(_0xc64115[_0xf722('0x5f')]>0x0){_0xc64115['pTalking']-=0x1;}else{logger['error'](_0x3bbd1a,_0xf722('0x60'));}}else{logger[_0xf722('0xc')](_0x3bbd1a,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xf722('0x61')]=function(_0x462496){if(_0x462496<=0x0){return!![];}return![];};function buildObj(_0xd4c8da,_0x205701,_0x128628){_0xd4c8da[_0xf722('0x62')]=_0x205701;_0xd4c8da[_0xf722('0x63')]=_0xd4c8da[_0xf722('0x64')];_0xd4c8da[_0xf722('0x65')]=_0xd4c8da['channelAgent'];_0xd4c8da[_0xf722('0x66')]=_0xf722('0x67');if(_0x128628){_0xd4c8da[_0xf722('0x68')]=_0x128628[_0xf722('0x68')];}return _0xd4c8da;}exports[_0xf722('0x69')]=buildObj;exports[_0xf722('0x6a')]=function(_0x56709e){var _0x3e2fab={};_0x3e2fab[_0xf722('0x64')]=_0x56709e['queue'];_0x3e2fab[_0xf722('0x65')]=_0x56709e['channelAgent'];_0x3e2fab[_0xf722('0x4c')]=_0x56709e[_0xf722('0x4c')];return _0x3e2fab;};exports[_0xf722('0x6b')]=function(_0x3369a1){var _0x5d0704=[];for(var _0x4acab7 in _0x3369a1){if(_0x3369a1[_0xf722('0x33')](_0x4acab7)){if(!_[_0xf722('0x16')](_0x3369a1[_0x4acab7])&&_0x3369a1[_0x4acab7][_0xf722('0x39')]===_0xf722('0x6c')&&_0x3369a1[_0x4acab7][_0xf722('0x6d')]===_0xf722('0x6e')){_0x5d0704[_0xf722('0x6f')](_0x3369a1[_0x4acab7]['id']);}}}return _0x5d0704;};exports[_0xf722('0x70')]=function(_0x2eed8c){var _0xfa8137=moment()[_0xf722('0x71')](0x0);var _0x1ec67f=moment(_0x2eed8c)[_0xf722('0x71')](0x0);return _0xfa8137[_0xf722('0x72')](_0x1ec67f,_0xf722('0x73'));};exports['createBody']=function(_0x5eab13){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5eab13[_0xf722('0x1a')],'ListId':_0x5eab13['ListId'],'VoiceQueueId':_0x5eab13[_0xf722('0x1c')]||undefined,'CampaignId':_0x5eab13[_0xf722('0x74')]||undefined};};exports['filterKey']=function(_0x16251d){if(_0x16251d==='uniqueid'||_0x16251d===_0xf722('0x75')||_0x16251d===_0xf722('0x64')||_0x16251d===_0xf722('0x76')||_0x16251d===_0xf722('0x77')||_0x16251d===_0xf722('0x78')||_0x16251d==='membername'||_0x16251d===_0xf722('0x4e')||_0x16251d===_0xf722('0x19')||_0x16251d===_0xf722('0x79')||_0x16251d===_0xf722('0x4f')||_0x16251d==='scheduledat'||_0x16251d===_0xf722('0x52')||_0x16251d===_0xf722('0x53')||_0x16251d==='countnoanswerretry'||_0x16251d==='countglobal'||_0x16251d===_0xf722('0x7a')||_0x16251d==='callbackuniqueid'||_0x16251d===_0xf722('0x7b')||_0x16251d==='recallme'||_0x16251d===_0xf722('0x1a')||_0x16251d===_0xf722('0x5d')||_0x16251d===_0xf722('0x43')||_0x16251d==='VoiceQueueId'||_0x16251d===_0xf722('0x7c')||_0x16251d===_0xf722('0x7d')||_0x16251d===_0xf722('0x7e')||_0x16251d===_0xf722('0x7f')||_0x16251d==='xmd-listid'||_0x16251d==='xmd-dialurl'||_0x16251d==='xmd-dialtimeout'||_0x16251d===_0xf722('0x80')||_0x16251d===_0xf722('0x81')||_0x16251d===_0xf722('0x82')||_0x16251d===_0xf722('0x83')||_0x16251d===_0xf722('0x84')||_0x16251d===_0xf722('0x85')||_0x16251d===_0xf722('0x86')||_0x16251d===_0xf722('0x87')||_0x16251d==='rtpaudioqos'||_0x16251d===_0xf722('0x88')||_0x16251d==='rtpaudioqosjitter'||_0x16251d==='rtpaudioqosjitterbridged'||_0x16251d===_0xf722('0x89')||_0x16251d===_0xf722('0x8a')||_0x16251d==='rtpaudioqosrtt'||_0x16251d==='rtpaudioqosrttbridged'||_0x16251d===_0xf722('0x8b')||_0x16251d===_0xf722('0x88')||_0x16251d===_0xf722('0x8c')||_0x16251d===_0xf722('0x8d')||_0x16251d===_0xf722('0x89')||_0x16251d===_0xf722('0x8a')||_0x16251d===_0xf722('0x8e')||_0x16251d===_0xf722('0x8f')||_0x16251d==='bridgepeer'||_0x16251d===_0xf722('0x90')||_0x16251d==='state'||_0x16251d===_0xf722('0x3a')){return![];}return!![];};exports[_0xf722('0x91')]=function(_0x1d2ba0,_0x20e9fc){var _0x495afe,_0x5d9c98,_0x26788b;if(_0x20e9fc<=0x0){_0x20e9fc=0x1;}_0x495afe=new RegExp('\x5cw{0,'+_0x20e9fc+'}$');_0x5d9c98=Math[_0xf722('0x92')](0xa,_0x20e9fc-0x1);_0x26788b=Math[_0xf722('0x92')](0xa,_0x20e9fc)-0x1;return util[_0xf722('0x14')]('%s',_[_0xf722('0x93')](_0x1d2ba0,_0x495afe,_[_0xf722('0x94')](_0x5d9c98,_0x26788b)));};exports['extractCalleridName']=function(_0x1604a){var _0x27c125=_0x1604a[_0xf722('0x95')](/"(.*?)"/);return _0x27c125?_0x27c125[0x1]:_0x1604a;};exports[_0xf722('0x96')]=function(_0x4c6788){var _0x1c7a59=_0x4c6788[_0xf722('0x95')](/<(.*?)>/);return _0x1c7a59?_0x1c7a59[0x1]:_0x4c6788;};function buildNoAnswerEventPayload(_0x3732e0,_0xaa51b8){var _0x5cf7d7=buildObj(_0x3732e0,_0xf722('0x97'));if(!_[_0xf722('0x13')](_0xaa51b8[_0xf722('0x98')])){Object[_0xf722('0x99')](_0xaa51b8[_0xf722('0x98')])[_0xf722('0x9a')](function(_0x21be99){_0x5cf7d7[_0x21be99[_0xf722('0x9b')]()]=_0xaa51b8[_0xf722('0x98')][_0x21be99];});}return _0x5cf7d7;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1bad=['extractCalleridName','match','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','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','responsetime','endtime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','not_inuse','reachable','push','getDiff','milliseconds','CampaignId','filterKey','idContact','type','dialAnswer','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace'];(function(_0x4e4cb2,_0x5f30a1){var _0x6e493f=function(_0x330ad0){while(--_0x330ad0){_0x4e4cb2['push'](_0x4e4cb2['shift']());}};_0x6e493f(++_0x5f30a1);}(_0x1bad,0x96));var _0xd1ba=function(_0x5a314b,_0x1c8988){_0x5a314b=_0x5a314b-0x0;var _0x4e2307=_0x1bad[_0x5a314b];return _0x4e2307;};'use strict';var util=require(_0xd1ba('0x0'));var _=require('lodash');var moment=require(_0xd1ba('0x1'));var logger=require(_0xd1ba('0x2'))(_0xd1ba('0x3'));var ipAgi=process[_0xd1ba('0x4')][_0xd1ba('0x5')]||_0xd1ba('0x6');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x14a871){return function(_0xbabf79){logger[_0xd1ba('0x7')](_0x14a871,util[_0xd1ba('0x8')](_0xbabf79,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x54ef23,_0xccec91){logger[_0xd1ba('0x9')](_0x54ef23,util['inspect'](_0xccec91,{'showHidden':![],'depth':null}));};exports[_0xd1ba('0xa')]=function(_0x14fdc5,_0x3f24dc){logger[_0xd1ba('0x7')](_0x14fdc5,util[_0xd1ba('0x8')](_0x3f24dc,{'showHidden':![],'depth':null}));};exports[_0xd1ba('0xb')]=function(_0x3ceba5){return function(_0x15c973){logger[_0xd1ba('0x9')](_0x3ceba5,util[_0xd1ba('0x8')](_0x15c973,{'showHidden':![],'depth':null}));};};exports[_0xd1ba('0xc')]=function(_0x440684,_0x582d74,_0x1f2ab9){return{'message':_0x440684,'unlock':_0x582d74,'active':_0x1f2ab9};};exports[_0xd1ba('0xd')]=function(_0x18999c,_0x254246,_0x1edcb5){if(!_[_0xd1ba('0xe')](_0x1edcb5)&&_0xd1ba('0xf')===typeof _0x1edcb5&&!_[_0xd1ba('0x10')](_0x1edcb5)){if(!_[_0xd1ba('0xe')](_0x254246)&&'string'===typeof _0x254246&&!_[_0xd1ba('0x10')](_0x254246)){return util[_0xd1ba('0x11')](_0xd1ba('0x12'),_0x254246,_0x1edcb5);}return util[_0xd1ba('0x11')](_0xd1ba('0x12'),_0x1edcb5,_0x1edcb5);}if(!_[_0xd1ba('0xe')](_0x18999c)&&_0xd1ba('0xf')===typeof _0x18999c&&!_[_0xd1ba('0x10')](_0x18999c)){return _0x18999c;}return'\x22\x22\x20<>';};exports[_0xd1ba('0x13')]=function(_0x290c0d){if(_[_0xd1ba('0x14')](_0x290c0d)){return![];}return _0x290c0d;};exports[_0xd1ba('0x15')]=function(_0x4d6ee5,_0x5cc8bc,_0x3be06c,_0x2f1aec,_0xdfcecf,_0xab34b4){var _0xd2b10f={'XMD-QUEUE':_0x5cc8bc[_0xd1ba('0x16')]?_0x5cc8bc[_0xd1ba('0x16')][_0xd1ba('0x17')]:'','XMD-CALLERID':_0x2f1aec,'XMD-CALLERID-PREVIEW':_0xab34b4?util[_0xd1ba('0x11')]('\x22%s\x22\x20<%s>',_0xab34b4[_0xd1ba('0x18')],_0xab34b4[_0xd1ba('0x19')]):_0x2f1aec,'XMD-DIALID':_0xdfcecf,'XMD-CONTACTID':_0x5cc8bc[_0xd1ba('0x1a')],'XMD-CDRTYPE':_0xd1ba('0x1b'),'CALLERID(all)':_0x2f1aec,'XMD-VOICEQUEUEID':_0x5cc8bc[_0xd1ba('0x1c')],'XMD-DIALCHANNEL':_0x3be06c,'XMD-DIALTIMEOUT':_0x4d6ee5[_0xd1ba('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xd1ba('0x11')](_0xd1ba('0x1e'),_0x4d6ee5[_0xd1ba('0x1f')]?'g':'',_[_0xd1ba('0x10')](_0x4d6ee5[_0xd1ba('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4d6ee5['dialPreviewUrl']||'','XMD-AGI':_0x4d6ee5[_0xd1ba('0x21')]?util[_0xd1ba('0x11')](_0xd1ba('0x22'),ipAgi,_0x4d6ee5[_0xd1ba('0x21')]):_0xd1ba('0x23'),'XMD-AGIAFTER':_0x4d6ee5[_0xd1ba('0x1f')]?util['format'](_0xd1ba('0x22'),ipAgi,_0x4d6ee5[_0xd1ba('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xab34b4?_0xab34b4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xab34b4?_0xab34b4[_0xd1ba('0x24')]:'','XMD-DESTINATION':_0xd1ba('0x25'),'SIPADDHEADER':_0xd1ba('0x26')};if(!_[_0xd1ba('0x10')](_0x4d6ee5[_0xd1ba('0x20')])){_0xd2b10f[util['format']('%s',_0xd1ba('0x27'))]=_0x4d6ee5[_0xd1ba('0x20')];_0xd2b10f[util[_0xd1ba('0x11')]('%s',_0xd1ba('0x28'))]=_0xdfcecf;}if(_0x5cc8bc&&_0x5cc8bc['Contact']){for(var _0x25fb1a in _0x5cc8bc[_0xd1ba('0x29')]){if(_0x5cc8bc[_0xd1ba('0x29')][_0xd1ba('0x2a')](_0x25fb1a)){if(!_['isNil'](_0x5cc8bc[_0xd1ba('0x29')][_0x25fb1a])&&_0x25fb1a!=='id'&&_0x25fb1a!==_0xd1ba('0x2b')&&_0x25fb1a!==_0xd1ba('0x2c')&&_0x25fb1a!==_0xd1ba('0x2d')){_0xd2b10f[util[_0xd1ba('0x11')](_0xd1ba('0x2e'),'XMD-',_[_0xd1ba('0x2f')](_0x25fb1a))]=_0x5cc8bc[_0xd1ba('0x29')][_0x25fb1a];}}}}return _0xd2b10f;};exports[_0xd1ba('0x30')]=function(_0x127404){var _0x22c25f={};for(var _0x4ba320 in _0x127404){if(_0x127404[_0xd1ba('0x2a')](_0x4ba320)){_0x22c25f[util[_0xd1ba('0x11')]('%s',_[_0xd1ba('0x31')](_0x4ba320))]=_0x127404[_0x4ba320];}}return{'variables':_0x22c25f};};exports[_0xd1ba('0x32')]=function(_0x4924b5,_0x29c5de){if(!_[_0xd1ba('0x14')](_0x4924b5)){if(_0x4924b5['hasOwnProperty'](_0xd1ba('0x33'))){if(_0x4924b5['originated']>0x0){_0x4924b5[_0xd1ba('0x33')]-=0x1;}else{logger[_0xd1ba('0x7')](_0xd1ba('0x34'),_0x29c5de);}}}else{logger[_0xd1ba('0x7')](_0xd1ba('0x35'),_0x29c5de);}};exports[_0xd1ba('0x36')]=function(_0x200c62){var _0x4348f5=moment()[_0xd1ba('0x11')](_0xd1ba('0x37'));_0x200c62[_0xd1ba('0x38')]=0xd;_0x200c62[_0xd1ba('0x39')]=_0xd1ba('0x3a');_0x200c62[_0xd1ba('0x3b')]=_0x4348f5;_0x200c62[_0xd1ba('0x3c')]=_0x4348f5;_0x200c62[_0xd1ba('0x3d')]=_0x4348f5;};exports['logAgent']=function(_0x1cc97d,_0x41d29d,_0x3a9c1c){var _0x18a49f=moment()['format'](_0xd1ba('0x37'));_0x1cc97d[_0xd1ba('0x38')]=_0x41d29d;_0x1cc97d[_0xd1ba('0x39')]=_0x3a9c1c;_0x1cc97d[_0xd1ba('0x3c')]=_0x18a49f;_0x1cc97d[_0xd1ba('0x3e')]=utils[_0xd1ba('0x3f')](_0x1cc97d[_0xd1ba('0x3c')],_0x1cc97d[_0xd1ba('0x3b')]);};exports[_0xd1ba('0x40')]=function(_0x370bc1,_0x4fbeb1,_0xcc7340){_0x370bc1[_0xd1ba('0x41')]=_0x4fbeb1;_0x370bc1[_0xd1ba('0x42')]=_0xcc7340;};exports[_0xd1ba('0x43')]=function(_0x229d9c,_0x37a946,_0x1c946d){var _0x1e993d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x229d9c[_0xd1ba('0x38')]=_0x37a946;_0x229d9c[_0xd1ba('0x39')]=_0x1c946d;_0x229d9c[_0xd1ba('0x3c')]=_0x229d9c[_0xd1ba('0x3c')]?_0x229d9c['responsetime']:_0x1e993d;_0x229d9c[_0xd1ba('0x3d')]=_0x229d9c[_0xd1ba('0x3d')]?_0x229d9c[_0xd1ba('0x3d')]:_0x1e993d;_0x229d9c[_0xd1ba('0x3e')]=utils[_0xd1ba('0x3f')](_0x229d9c[_0xd1ba('0x3c')]||0x0,_0x229d9c[_0xd1ba('0x3b')]||0x0);_0x229d9c[_0xd1ba('0x44')]=_0x229d9c[_0xd1ba('0x45')]?utils[_0xd1ba('0x3f')](_0x229d9c['endtime'],_0x229d9c['answertime']):0x0;};exports['isFailure']=function(_0x19920f){return _0x19920f===_0xd1ba('0x46');};exports[_0xd1ba('0x47')]=function(_0x14cb68,_0x38633b,_0x1b9730,_0x4d15e1,_0x1278c9){var _0x4dfc0d=_0x4d15e1?_0xd1ba('0x48'):_0x14cb68[_0xd1ba('0x18')];_0x4dfc0d=_0x1278c9?_0xd1ba('0x49'):_0x4dfc0d;return{'actionid':_0x14cb68[_0xd1ba('0x4a')],'action':_0xd1ba('0x4b'),'channel':_0x14cb68[_0xd1ba('0x4c')],'callerid':util[_0xd1ba('0x11')](_0xd1ba('0x12'),_0x4dfc0d,_0x14cb68[_0xd1ba('0x19')]),'Exten':_0xd1ba('0x25'),'Context':_0xd1ba('0x4d'),'Priority':'1','variable':_0x1b9730,'timeout':(_0x38633b[_0xd1ba('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x14cb68[_0xd1ba('0x4a')]};};exports['totalGlobal']=function(_0x32964f){return _0x32964f[_0xd1ba('0x4f')]+_0x32964f[_0xd1ba('0x50')]+_0x32964f['countnoanswerretry']+_0x32964f[_0xd1ba('0x51')]+_0x32964f['countnosuchnumberretry'];};exports['cloneAction']=function(_0x376fad){var _0x26137c=_['clone'](_0x376fad);_0x26137c[_0xd1ba('0x38')]=0xf;_0x26137c[_0xd1ba('0x39')]=_0xd1ba('0x52');return _0x26137c;};exports[_0xd1ba('0x53')]=function(_0x259bc9,_0x3f5857,_0x523711){var _0x3fdd1b={};_0x3fdd1b[_0x3f5857]=_0x259bc9[_0x3f5857];_0x3fdd1b['active']=![];_0x3fdd1b[_0xd1ba('0x54')]=moment()[_0xd1ba('0x55')](_0x523711,_0xd1ba('0x56'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3fdd1b[_0xd1ba('0x1a')]=_0x259bc9[_0xd1ba('0x1a')];_0x3fdd1b[_0xd1ba('0x57')]=_0x259bc9[_0xd1ba('0x57')];_0x3fdd1b[_0xd1ba('0x1c')]=_0x259bc9['VoiceQueueId']||undefined;return _0x3fdd1b;};exports['decrementTalkink']=function(_0x52a422,_0x333525){if(!_[_0xd1ba('0x14')](_0x52a422)){if(_0x52a422['pTalking']>0x0){_0x52a422[_0xd1ba('0x58')]-=0x1;}else{logger[_0xd1ba('0x7')](_0x333525,_0xd1ba('0x59'));}}else{logger[_0xd1ba('0x7')](_0x333525,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xd1ba('0x5a')]=function(_0xa92e78){if(_0xa92e78<=0x0){return!![];}return![];};function buildObj(_0x5df68f,_0x292aa0,_0x116d8a){_0x5df68f[_0xd1ba('0x5b')]=_0x292aa0;_0x5df68f[_0xd1ba('0x17')]=_0x5df68f[_0xd1ba('0x5c')];_0x5df68f[_0xd1ba('0x5d')]=_0x5df68f[_0xd1ba('0x4c')];_0x5df68f[_0xd1ba('0x5e')]='voice';if(_0x116d8a){_0x5df68f[_0xd1ba('0x5f')]=_0x116d8a['mandatoryDisposition'];}return _0x5df68f;}exports[_0xd1ba('0x60')]=buildObj;exports[_0xd1ba('0x61')]=function(_0x3ad97d){var _0x30f717={};_0x30f717['queue']=_0x3ad97d[_0xd1ba('0x5c')];_0x30f717['interface']=_0x3ad97d[_0xd1ba('0x4c')];_0x30f717[_0xd1ba('0x4a')]=_0x3ad97d[_0xd1ba('0x4a')];return _0x30f717;};exports['agentReadyId']=function(_0x8074fd){var _0x5675ac=[];for(var _0x4da517 in _0x8074fd){if(_0x8074fd[_0xd1ba('0x2a')](_0x4da517)){if(!_[_0xd1ba('0x14')](_0x8074fd[_0x4da517])&&_0x8074fd[_0x4da517]['state']===_0xd1ba('0x62')&&_0x8074fd[_0x4da517]['status']===_0xd1ba('0x63')){_0x5675ac[_0xd1ba('0x64')](_0x8074fd[_0x4da517]['id']);}}}return _0x5675ac;};exports[_0xd1ba('0x65')]=function(_0x539045){var _0x22ad0d=moment()[_0xd1ba('0x66')](0x0);var _0x3ba15f=moment(_0x539045)[_0xd1ba('0x66')](0x0);return _0x22ad0d['diff'](_0x3ba15f,'seconds');};exports['createBody']=function(_0x2b78b6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b78b6[_0xd1ba('0x1a')],'ListId':_0x2b78b6[_0xd1ba('0x57')],'VoiceQueueId':_0x2b78b6[_0xd1ba('0x1c')]||undefined,'CampaignId':_0x2b78b6[_0xd1ba('0x67')]||undefined};};exports[_0xd1ba('0x68')]=function(_0x553c8e){if(_0x553c8e===_0xd1ba('0x4a')||_0x553c8e===_0xd1ba('0x69')||_0x553c8e==='queue'||_0x553c8e===_0xd1ba('0x6a')||_0x553c8e==='campaigntype'||_0x553c8e===_0xd1ba('0x6b')||_0x553c8e==='membername'||_0x553c8e===_0xd1ba('0x4c')||_0x553c8e==='calleridname'||_0x553c8e==='active'||_0x553c8e===_0xd1ba('0x19')||_0x553c8e===_0xd1ba('0x54')||_0x553c8e===_0xd1ba('0x4f')||_0x553c8e===_0xd1ba('0x50')||_0x553c8e==='countnoanswerretry'||_0x553c8e===_0xd1ba('0x6c')||_0x553c8e==='callback'||_0x553c8e==='callbackuniqueid'||_0x553c8e===_0xd1ba('0x6d')||_0x553c8e===_0xd1ba('0x6e')||_0x553c8e===_0xd1ba('0x1a')||_0x553c8e===_0xd1ba('0x57')||_0x553c8e==='UserId'||_0x553c8e===_0xd1ba('0x1c')||_0x553c8e===_0xd1ba('0x6f')||_0x553c8e===_0xd1ba('0x70')||_0x553c8e===_0xd1ba('0x71')||_0x553c8e==='xmd-phone'||_0x553c8e===_0xd1ba('0x72')||_0x553c8e===_0xd1ba('0x73')||_0x553c8e===_0xd1ba('0x74')||_0x553c8e===_0xd1ba('0x75')||_0x553c8e===_0xd1ba('0x76')||_0x553c8e==='xmd-dialchannel'||_0x553c8e===_0xd1ba('0x77')||_0x553c8e===_0xd1ba('0x78')||_0x553c8e===_0xd1ba('0x79')||_0x553c8e===_0xd1ba('0x7a')||_0x553c8e===_0xd1ba('0x7b')||_0x553c8e===_0xd1ba('0x7c')||_0x553c8e===_0xd1ba('0x7d')||_0x553c8e===_0xd1ba('0x7e')||_0x553c8e===_0xd1ba('0x7f')||_0x553c8e===_0xd1ba('0x80')||_0x553c8e==='rtpaudioqoslossbridged'||_0x553c8e===_0xd1ba('0x81')||_0x553c8e===_0xd1ba('0x82')||_0x553c8e==='rtpaudioqos'||_0x553c8e==='rtpaudioqosbridged'||_0x553c8e===_0xd1ba('0x7e')||_0x553c8e===_0xd1ba('0x7f')||_0x553c8e===_0xd1ba('0x80')||_0x553c8e===_0xd1ba('0x83')||_0x553c8e===_0xd1ba('0x81')||_0x553c8e===_0xd1ba('0x82')||_0x553c8e===_0xd1ba('0x84')||_0x553c8e===_0xd1ba('0x85')||_0x553c8e===_0xd1ba('0x38')||_0x553c8e==='statedesc'){return![];}return!![];};exports[_0xd1ba('0x86')]=function(_0x181f55,_0x5ce784){var _0x248a0e,_0x3fe779,_0x158ff7;if(_0x5ce784<=0x0){_0x5ce784=0x1;}_0x248a0e=new RegExp(_0xd1ba('0x87')+_0x5ce784+'}$');_0x3fe779=Math[_0xd1ba('0x88')](0xa,_0x5ce784-0x1);_0x158ff7=Math[_0xd1ba('0x88')](0xa,_0x5ce784)-0x1;return util[_0xd1ba('0x11')]('%s',_[_0xd1ba('0x89')](_0x181f55,_0x248a0e,_['random'](_0x3fe779,_0x158ff7)));};exports[_0xd1ba('0x8a')]=function(_0x430498){var _0x1b8ab1=_0x430498[_0xd1ba('0x8b')](/"(.*?)"/);return _0x1b8ab1?_0x1b8ab1[0x1]:_0x430498;};exports['extractCalleridNumber']=function(_0x5da98d){var _0x346d0e=_0x5da98d['match'](/<(.*?)>/);return _0x346d0e?_0x346d0e[0x1]:_0x5da98d;};function buildNoAnswerEventPayload(_0x1948ac,_0x458ae4){var _0xa4af78=buildObj(_0x1948ac,'noanswer');if(!_[_0xd1ba('0x10')](_0x458ae4[_0xd1ba('0x8c')])){Object[_0xd1ba('0x8d')](_0x458ae4[_0xd1ba('0x8c')])[_0xd1ba('0x8e')](function(_0x5bdb55){_0xa4af78[_0x5bdb55['toLowerCase']()]=_0x458ae4['variables'][_0x5bdb55];});}return _0xa4af78;}exports[_0xd1ba('0x8f')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e14d9b1..6f3102b 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 _0xa827=['string','number','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x195441,_0x5f0364){var _0x20b9ae=function(_0x13eae2){while(--_0x13eae2){_0x195441['push'](_0x195441['shift']());}};_0x20b9ae(++_0x5f0364);}(_0xa827,0x167));var _0x7a82=function(_0x2acff0,_0x13f6c7){_0x2acff0=_0x2acff0-0x0;var _0xf55bdc=_0xa827[_0x2acff0];return _0xf55bdc;};'use strict';exports[_0x7a82('0x0')]={'queue':{'type':_0x7a82('0x1'),'required':!![]},'interface':{'type':_0x7a82('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x7a82('0x2'),'required':![]},'paused':{'type':_0x7a82('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x7a82('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x7a82('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x7a82('0x1'),'required':![]}};exports[_0x7a82('0x4')]={'module':{'type':'string','required':![]}};exports[_0x7a82('0x5')]={'uniqueid':{'type':_0x7a82('0x1'),'required':!![]}};exports[_0x7a82('0x6')]={'uniqueid':{'type':_0x7a82('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x7a82('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x7a82('0x7')]={'uniqueid':{'type':_0x7a82('0x1'),'required':!![]}};exports[_0x7a82('0x8')]={'uniqueid':{'type':_0x7a82('0x1'),'required':!![]},'exten':{'type':_0x7a82('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x54c4=['boolean','queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x13ad55,_0x35f957){var _0xce1e6b=function(_0x21864e){while(--_0x21864e){_0x13ad55['push'](_0x13ad55['shift']());}};_0xce1e6b(++_0x35f957);}(_0x54c4,0xde));var _0x454c=function(_0x35cc28,_0xc628d9){_0x35cc28=_0x35cc28-0x0;var _0x2330e0=_0x54c4[_0x35cc28];return _0x2330e0;};'use strict';exports[_0x454c('0x0')]={'queue':{'type':_0x454c('0x1'),'required':!![]},'interface':{'type':_0x454c('0x1'),'required':!![]},'membername':{'type':_0x454c('0x1'),'required':!![]},'penalty':{'type':_0x454c('0x2'),'required':![]},'paused':{'type':_0x454c('0x3'),'required':![]}};exports[_0x454c('0x4')]={'queue':{'type':_0x454c('0x1'),'required':!![]},'interface':{'type':_0x454c('0x1'),'required':!![]}};exports[_0x454c('0x5')]={'interface':{'type':_0x454c('0x1'),'required':!![]},'paused':{'type':_0x454c('0x3')},'reason':{'type':_0x454c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x454c('0x1'),'required':![]}};exports[_0x454c('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x454c('0x1'),'required':!![]},'filename':{'type':_0x454c('0x1')},'format':{'type':_0x454c('0x1')},'mixmonitorid':{'type':_0x454c('0x1')}};exports[_0x454c('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x454c('0x8')]={'uniqueid':{'type':_0x454c('0x1'),'required':!![]},'exten':{'type':_0x454c('0x1'),'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 cb18828..060fac4 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x337551,_0x20111b){var _0x1f9671=function(_0x4fa062){while(--_0x4fa062){_0x337551['push'](_0x337551['shift']());}};_0x1f9671(++_0x20111b);}(_0xb10b,0x12a));var _0xbb10=function(_0x962de1,_0x361057){_0x962de1=_0x962de1-0x0;var _0x14085a=_0xb10b[_0x962de1];return _0x14085a;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x3fd27c,_0x2697a2){var _0x954d17=function(_0x28da03){while(--_0x28da03){_0x3fd27c['push'](_0x3fd27c['shift']());}};_0x954d17(++_0x2697a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28edf6,_0x5c661e){_0x28edf6=_0x28edf6-0x0;var _0x112906=_0x5f2f[_0x28edf6];return _0x112906;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 86dbfe1..ae6d923 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1f7=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x2c74f6,_0x34efe8){var _0x11c101=function(_0x5c21fa){while(--_0x5c21fa){_0x2c74f6['push'](_0x2c74f6['shift']());}};_0x11c101(++_0x34efe8);}(_0xd1f7,0xcf));var _0x7d1f=function(_0x415ba5,_0x54bcc0){_0x415ba5=_0x415ba5-0x0;var _0x30423e=_0xd1f7[_0x415ba5];return _0x30423e;};'use strict';function mergeDBDataToRealtime(_0x5d7510,_0x1e9c53){var _0x135b92=Object['assign']({},_0x5d7510);for(var _0x261bb5 in _0x1e9c53){if(_0x135b92[_0x7d1f('0x0')](_0x261bb5)){_0x135b92[_0x261bb5]=_0x1e9c53[_0x261bb5];}}return _0x135b92;}exports[_0x7d1f('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +'use strict';function mergeDBDataToRealtime(_0x2f04dd,_0x49436b){var _0x5a3541=Object['assign']({},_0x2f04dd);for(var _0x453b7f in _0x49436b){if(_0x5a3541['hasOwnProperty'](_0x453b7f)){_0x5a3541[_0x453b7f]=_0x49436b[_0x453b7f];}}return _0x5a3541;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3145d4b..12fc285 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 _0xde50=['telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','keys','length','getCallType','channel','split','calleridnum','internal','destination','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','UserId','membername','create','monitors','monitorFilename','filename','createdAt','connectedlinename','connectedlinenum','exten','voiceAgentReport','forEach','Local','substring','mobile','indexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents'];(function(_0x3dcefe,_0x1568e6){var _0x2284e5=function(_0x4cd9b2){while(--_0x4cd9b2){_0x3dcefe['push'](_0x3dcefe['shift']());}};_0x2284e5(++_0x1568e6);}(_0xde50,0xfe));var _0x0de5=function(_0x5e4d21,_0x47145b){_0x5e4d21=_0x5e4d21-0x0;var _0x479038=_0xde50[_0x5e4d21];return _0x479038;};'use strict';var _=require(_0x0de5('0x0'));var moment=require('moment');var util=require(_0x0de5('0x1'));var config=require(_0x0de5('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x0de5('0x3'));var RpcVoiceDialReport=require(_0x0de5('0x4'));var RpcMemberReport=require(_0x0de5('0x5'));var RpcVoiceQueueReport=require(_0x0de5('0x6'));var RpcVoiceRecording=require(_0x0de5('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x0de5('0x8'));var VoiceCallReport=require(_0x0de5('0x9'));var VoiceAgentReport=require(_0x0de5('0xa'));var VoiceDialReport=require(_0x0de5('0xb'));var UserReport=require('./userReport');function Report(_0x1f98d2){this['realtime']=_0x1f98d2;this[_0x0de5('0xc')]=_0x1f98d2[_0x0de5('0xc')];this[_0x0de5('0xd')]=_0x1f98d2['telephones'];}Report[_0x0de5('0xe')][_0x0de5('0xf')]=function(_0x2a011f){var _0x1145af=new VoiceQueueReport(this[_0x0de5('0x10')]);var _0x5d1ce4=new VoiceAgentReport(this[_0x0de5('0x10')]);var _0x240029=new VoiceDialReport(this[_0x0de5('0x10')]);var _0x13051a=new VoiceCallReport(this[_0x0de5('0x10')]);var _0xc26aac=new UserReport(this[_0x0de5('0x10')]);if(config[_0x0de5('0x11')]&&config[_0x0de5('0x11')][_0x0de5('0x12')]){ami['on'](_0x0de5('0x13'),this[_0x0de5('0x14')][_0x0de5('0x15')](this));ami['on'](_0x0de5('0x16'),this[_0x0de5('0x17')]['bind'](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x0de5('0x15')](this));ami['on'](_0x0de5('0x18'),this[_0x0de5('0x19')]['bind'](this));ami['on']('blindtransfer',this[_0x0de5('0x1a')][_0x0de5('0x15')](this));ami['on']('attendedtransfer',this[_0x0de5('0x1b')][_0x0de5('0x15')](this));}};Report[_0x0de5('0xe')][_0x0de5('0x1c')]=function(_0x1d9425){var _0x1e4ae5;_0x1e4ae5=_[_0x0de5('0x1d')](this[_0x0de5('0xc')],function(_0x22bf6b){return _0x22bf6b['accountcode']==_0x1d9425||_0x22bf6b[_0x0de5('0x1e')]==_0x1d9425;});if(_[_0x0de5('0x1f')](_0x1e4ae5)){var _0x1c9406=_['find'](this[_0x0de5('0xd')],function(_0x5aac09){return _0x5aac09[_0x0de5('0x20')]==_0x1d9425||_0x5aac09['name']==_0x1d9425;});if(_0x1c9406){_0x1e4ae5=_[_0x0de5('0x1d')](this[_0x0de5('0xc')],function(_0x58f74f){return _0x58f74f[_0x0de5('0x21')]==util['format']('SIP/%s',_0x1c9406[_0x0de5('0x1e')]);});}}return _0x1e4ae5;};Report['prototype']['voiceQueueReport']=function(_0x11040f){for(var _0x4d7f50=0x0;_0x4d7f50<_0x11040f['length'];_0x4d7f50+=0x1){var _0x4ef233=this[_0x0de5('0x1c')](_0x11040f[_0x4d7f50]['connectedlinenum']);if(_0x4ef233){_0x11040f[_0x4d7f50][_0x0de5('0x20')]=_0x4ef233[_0x0de5('0x20')];_0x11040f[_0x4d7f50][_0x0de5('0x22')]=!![];_0x11040f[_0x4d7f50][_0x0de5('0x23')]=_0x4ef233[_0x0de5('0x1e')];_0x11040f[_0x4d7f50][_0x0de5('0x21')]=_[_0x0de5('0x1f')](_0x4ef233[_0x0de5('0x21')])?util[_0x0de5('0x24')](_0x0de5('0x25'),_0x4ef233[_0x0de5('0x1e')]):_0x4ef233[_0x0de5('0x21')];if(_0x11040f[_0x4d7f50][_0x0de5('0x26')]){_0x11040f[_0x4d7f50][_0x0de5('0x27')]=moment()[_0x0de5('0x24')](_0x0de5('0x28'));}if(_0x11040f[_0x4d7f50]['queuecallerexit']){_0x11040f[_0x4d7f50][_0x0de5('0x29')]=moment()[_0x0de5('0x24')](_0x0de5('0x28'));}RpcMemberReport[_0x0de5('0x14')](_0x11040f[_0x4d7f50]);}RpcVoiceQueueReport['create'](_0x11040f[_0x4d7f50]);}};function extractCalleridNumber(_0x3d5fc7){var _0x5bb2db=_0x3d5fc7[_0x0de5('0x2a')](/<(.*?)>/);return _0x5bb2db?_0x5bb2db[0x1]:_0x3d5fc7;}Report['prototype']['getAgentByInternal']=function(_0x785121){for(var _0x5ace40=0x0;_0x5ace40/);return _0x2f162d?_0x2f162d[0x1]:_0xda7c97;}Report[_0x1b8c('0xd')][_0x1b8c('0x2b')]=function(_0x911cdf){for(var _0x2c2678=0x0;_0x2c2678',_0x3c393c['calleridname'],_0x3c393c[_0x1b8c('0x3d')]);}if(RpcVoiceTransferReport['transfers'][_0x3c393c[_0x1b8c('0x40')]]){var _0x36cc46=RpcVoiceTransferReport['transfers'][_0x3c393c[_0x1b8c('0x40')]];_0x36cc46[_0x1b8c('0x41')]=_0x3c393c[_0x1b8c('0x42')];RpcVoiceTransferReport[_0x1b8c('0x43')](_0x36cc46);delete RpcVoiceTransferReport[_0x1b8c('0x44')][_0x3c393c[_0x1b8c('0x40')]];}if(_[_0x1b8c('0x24')](_0x3c393c['type'])){_0x3c393c[_0x1b8c('0x32')]=this[_0x1b8c('0x2e')](_0x3c393c);}if(_[_0x1b8c('0x24')](_0x3c393c[_0x1b8c('0x45')])){var _0x4c19cf=_0x3c393c['channel'][_0x1b8c('0x30')]('-')[0x0];var _0x167267=this['agents'][_0x4c19cf];if(!_0x167267)_0x167267=this[_0x1b8c('0x2b')](_0x3c393c[_0x1b8c('0x1a')]);if(_0x167267){_0x3c393c[_0x1b8c('0x45')]=_0x167267['id'];_0x3c393c[_0x1b8c('0x46')]=_0x167267['name'];}}RpcVoiceCallReport[_0x1b8c('0x29')](_0x3c393c);if(_0x3c393c[_0x1b8c('0x47')]){for(var _0x39eded=0x0;_0x39eded<_0x3c393c[_0x1b8c('0x48')][_0x1b8c('0x2d')];_0x39eded+=0x1){_0x3c393c['monitorFilename']=_0x3c393c[_0x1b8c('0x48')][_0x39eded][_0x1b8c('0x49')];_0x3c393c[_0x1b8c('0x4a')]=_0x3c393c['monitors'][_0x39eded][_0x1b8c('0x4a')];if(_0x3c393c['exten']=='xcally-motion-preview'){_0x3c393c[_0x1b8c('0x3d')]=_0x3c393c[_0x1b8c('0x20')];_0x3c393c[_0x1b8c('0x4b')]=_0x3c393c[_0x1b8c('0x4c')];_0x3c393c[_0x1b8c('0x20')]=_0x3c393c['accountcode'];_0x3c393c[_0x1b8c('0x4c')]=_0x3c393c[_0x1b8c('0x46')];_0x3c393c[_0x1b8c('0x4d')]=_0x3c393c[_0x1b8c('0x4e')];}else if(_0x3c393c[_0x1b8c('0x4d')]=='xcally-motion-dialer'){_0x3c393c[_0x1b8c('0x3d')]=_0x3c393c[_0x1b8c('0x31')];_0x3c393c[_0x1b8c('0x4d')]=_0x3c393c['originatecalleridnum'];}RpcVoiceRecording[_0x1b8c('0x29')](_0x3c393c);}}};Report[_0x1b8c('0xd')]['voiceAgentReport']=function(_0x3dfdd0){if(_[_0x1b8c('0x4f')](_0x3dfdd0)){_0x3dfdd0['forEach'](function(_0x1aecab){RpcVoiceAgentReport[_0x1b8c('0x29')](_0x1aecab);});}else{RpcVoiceAgentReport[_0x1b8c('0x29')](_0x3dfdd0);}};Report[_0x1b8c('0xd')][_0x1b8c('0x16')]=function(_0x629794){RpcVoiceDialReport['create'](_0x629794);var _0x396e76;var _0x33c8f2;var _0x32d4e1=_0x629794[_0x1b8c('0x2f')];if(_[_0x1b8c('0x50')](_0x32d4e1,_0x1b8c('0x51'))){_0x33c8f2=_0x32d4e1[_0x1b8c('0x52')](_0x32d4e1[_0x1b8c('0x53')]('/')+0x1,_0x32d4e1[_0x1b8c('0x53')]('@'));_0x396e76=_[_0x1b8c('0x1b')](this[_0x1b8c('0xb')],function(_0x4fb5ce){return _0x4fb5ce['mobile']==_0x33c8f2||_0x4fb5ce[_0x1b8c('0x54')]==_0x33c8f2||_0x4fb5ce['accountcode']==_0x33c8f2;});}else{_0x33c8f2=_0x32d4e1[_0x1b8c('0x52')](_0x32d4e1['indexOf']('/')+0x1,_0x32d4e1['lastIndexOf']('-'));_0x396e76=this[_0x1b8c('0x19')](_0x33c8f2);}if(_0x396e76){_0x629794[_0x1b8c('0x23')]=_[_0x1b8c('0x24')](_0x396e76[_0x1b8c('0x23')])?util['format']('SIP/%s',_0x396e76[_0x1b8c('0x1c')]):_0x396e76[_0x1b8c('0x23')];_0x629794[_0x1b8c('0x46')]=_0x396e76[_0x1b8c('0x1c')];_0x629794['accountcode']=_0x396e76[_0x1b8c('0x1a')];RpcMemberReport['voiceDialReport'](_0x629794);}};Report[_0x1b8c('0xd')]['blindTransfer']=function(_0x5b572){RpcVoiceTransferReport['transfers'][_0x5b572[_0x1b8c('0x55')]]=_0x5b572;};Report['prototype'][_0x1b8c('0x18')]=function(_0x588995){RpcVoiceTransferReport[_0x1b8c('0x18')](_0x588995);};module[_0x1b8c('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index d9a1817..9401b9e 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 _0xa018=['state','debug','[userReport][registry]','username','merge','omit','actionid','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','telephone:%s','telephone:save','Local','substring','indexOf','mobile','accountcode','updateStatusRealtime','syncPeerStatus','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','lodash','moment','ioredis','bluebird','ami','../ami','defaults','redis','localhost','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s'];(function(_0x2598f0,_0x3d61ff){var _0x4448c8=function(_0x3cc057){while(--_0x3cc057){_0x2598f0['push'](_0x2598f0['shift']());}};_0x4448c8(++_0x3d61ff);}(_0xa018,0xf2));var _0x8a01=function(_0x7fab68,_0x410ee5){_0x7fab68=_0x7fab68-0x0;var _0x240cee=_0xa018[_0x7fab68];return _0x240cee;};'use strict';var _=require(_0x8a01('0x0'));var moment=require(_0x8a01('0x1'));var util=require('util');var Redis=require(_0x8a01('0x2'));var BPromise=require(_0x8a01('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x8a01('0x4'));var ami=require(_0x8a01('0x5'));config['redis']=_[_0x8a01('0x6')](config[_0x8a01('0x7')],{'host':_0x8a01('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a01('0x7')]));function UserReport(_0x80b575){this[_0x8a01('0x9')]=_0x80b575['trunks'];this['agents']=_0x80b575[_0x8a01('0xa')];this[_0x8a01('0xb')]=_0x80b575['telephones'];ami['on'](_0x8a01('0xc'),this['syncRegistry'][_0x8a01('0xd')](this));ami['on'](_0x8a01('0xe'),this['syncRegistry'][_0x8a01('0xd')](this));ami['on'](_0x8a01('0xf'),this[_0x8a01('0x10')][_0x8a01('0xd')](this));ami['on'](_0x8a01('0x11'),this['syncPeerStatus'][_0x8a01('0xd')](this));return this[_0x8a01('0x12')]();}function showSipRegistrations(){Promise[_0x8a01('0x13')]()['then'](ami[_0x8a01('0x14')]())[_0x8a01('0x15')](function(_0x559f9e){logger[_0x8a01('0x16')](_0x8a01('0x17'),util[_0x8a01('0x18')](_0x559f9e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x8a01('0x19')](ami['actionDeviceStateList']())[_0x8a01('0x15')](function(_0x11cc12){logger[_0x8a01('0x16')](_0x8a01('0x1a'),util[_0x8a01('0x18')](_0x11cc12,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8a01('0x13')]()['then'](ami[_0x8a01('0x1b')]())[_0x8a01('0x15')](function(_0x2e4238){logger[_0x8a01('0x16')]('[userReport][sippeerstatus]',util[_0x8a01('0x18')](_0x2e4238,{'showHidden':![],'depth':null}));});}UserReport[_0x8a01('0x1c')][_0x8a01('0x12')]=function(){setInterval(function(){BPromise[_0x8a01('0x13')]()[_0x8a01('0x19')](showSipRegistrations())[_0x8a01('0x19')](listDeviceStates())[_0x8a01('0x19')](showPeersStatus());},0x32c8);};UserReport[_0x8a01('0x1c')][_0x8a01('0x1d')]=function(_0x199be5){return _0x199be5!==null&&!_[_0x8a01('0x1e')](_0x199be5);};UserReport[_0x8a01('0x1c')][_0x8a01('0x1f')]=function(_0x3a20ef,_0x1393c2,_0x2123fe){io['to'](_0x3a20ef)[_0x8a01('0x1f')](_0x1393c2,_0x2123fe);};UserReport[_0x8a01('0x1c')]['syncRegistry']=function(_0x41bbd3){try{if(this[_0x8a01('0x1d')](_0x41bbd3)){logger[_0x8a01('0x20')](_0x8a01('0x21'),_0x41bbd3['username'],_0x41bbd3[_0x8a01('0x22')]);logger[_0x8a01('0x23')](_0x8a01('0x24'),util[_0x8a01('0x18')](_0x41bbd3,{'showHidden':![],'depth':null}));var _0xcac6e3=_['find'](this[_0x8a01('0x9')],{'defaultuser':_0x41bbd3[_0x8a01('0x25')]});if(_0xcac6e3){_0x41bbd3['stateRegistry']=_0x41bbd3[_0x8a01('0x22')];_[_0x8a01('0x26')](_0xcac6e3,_[_0x8a01('0x27')](_0x41bbd3,['event',_0x8a01('0x28'),_0x8a01('0x25'),_0x8a01('0x22')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x8a01('0x18')](_0xcac6e3,{'showHidden':![],'depth':null}));this['emit'](util[_0x8a01('0x29')](_0x8a01('0x2a'),_0xcac6e3[_0x8a01('0x2b')]),'trunk:save',_0xcac6e3);}}}catch(_0x48ada5){logger[_0x8a01('0x16')](_0x8a01('0x24'),util[_0x8a01('0x18')](_0x48ada5,{'showHidden':![],'depth':null}));}};UserReport[_0x8a01('0x1c')][_0x8a01('0x10')]=function(_0x544541){try{if(this[_0x8a01('0x1d')](_0x544541)){logger[_0x8a01('0x20')](_0x8a01('0x2c'),_0x544541[_0x8a01('0x2d')],_0x544541[_0x8a01('0x22')]);logger[_0x8a01('0x23')](_0x8a01('0x2e'),util[_0x8a01('0x18')](_0x544541,{'showHidden':![],'depth':null}));if(this[_0x8a01('0xa')][_0x544541[_0x8a01('0x2d')]]){if(!this['agents'][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x2f')]||_0x544541[_0x8a01('0x22')]['toLowerCase']()=='inuse'){this[_0x8a01('0xa')][_0x544541[_0x8a01('0x2d')]]['local']=![];if(this[_0x8a01('0xa')][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x22')]!==_0x544541[_0x8a01('0x22')][_0x8a01('0x30')]()){this['agents'][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x31')]=_[_0x8a01('0x32')](moment()[_0x8a01('0x29')]('x'));}this['agents'][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x22')]=_0x544541[_0x8a01('0x22')][_0x8a01('0x30')]();this[_0x8a01('0xa')][_0x544541['device']]['updateStatusRealtime'](_0x544541);}}else if(this[_0x8a01('0xb')][_0x544541[_0x8a01('0x2d')]]){if(this[_0x8a01('0xb')][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x22')]!==_0x544541[_0x8a01('0x22')][_0x8a01('0x30')]()){this[_0x8a01('0xb')][_0x544541[_0x8a01('0x2d')]]['stateTime']=_[_0x8a01('0x32')](moment()[_0x8a01('0x29')]('x'));}this[_0x8a01('0xb')][_0x544541[_0x8a01('0x2d')]]['state']=_0x544541[_0x8a01('0x22')]['toLowerCase']();logger[_0x8a01('0x23')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x8a01('0x18')](this[_0x8a01('0xb')][_0x544541['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x8a01('0x29')](_0x8a01('0x33'),this['telephones'][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x2b')]),_0x8a01('0x34'),this['telephones'][_0x544541[_0x8a01('0x2d')]]);}else if(this[_0x8a01('0x9')][_0x544541[_0x8a01('0x2d')]]){if(this[_0x8a01('0x9')][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x22')]!==_0x544541['state'][_0x8a01('0x30')]()){this[_0x8a01('0x9')][_0x544541['device']]['stateTime']=_[_0x8a01('0x32')](moment()[_0x8a01('0x29')]('x'));}this[_0x8a01('0x9')][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x22')]=_0x544541[_0x8a01('0x22')]['toLowerCase']();logger[_0x8a01('0x23')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x8a01('0x18')](this['trunks'][_0x544541['device']],{'showHidden':![],'depth':null}));this[_0x8a01('0x1f')](util[_0x8a01('0x29')]('trunk:%s',this[_0x8a01('0x9')][_0x544541[_0x8a01('0x2d')]][_0x8a01('0x2b')]),'trunk:save',this[_0x8a01('0x9')][_0x544541[_0x8a01('0x2d')]]);}else if(_['startsWith'](_0x544541['device'],_0x8a01('0x35'))){var _0xabb611=_0x544541[_0x8a01('0x2d')];var _0x4368a1=_0xabb611[_0x8a01('0x36')](_0xabb611[_0x8a01('0x37')]('/')+0x1,_0xabb611[_0x8a01('0x37')]('@'));var _0x3e058a=_['find'](this[_0x8a01('0xa')],function(_0x1f2112){return _0x1f2112[_0x8a01('0x38')]==_0x4368a1||_0x1f2112['phone']==_0x4368a1||_0x1f2112[_0x8a01('0x39')]==_0x4368a1;});if(_0x3e058a){if(_0x3e058a[_0x8a01('0x22')]!==_0x544541['state'][_0x8a01('0x30')]()){_0x3e058a[_0x8a01('0x31')]=_[_0x8a01('0x32')](moment()[_0x8a01('0x29')]('x'));}_0x3e058a[_0x8a01('0x22')]=_0x544541['state']['toLowerCase']();_0x3e058a[_0x8a01('0x2f')]=!![];_0x3e058a[_0x8a01('0x3a')](_0x544541);}}}}catch(_0x4b20b9){logger[_0x8a01('0x16')]('[userReport][devicestatechange]',util[_0x8a01('0x18')](_0x4b20b9,{'showHidden':![],'depth':null}));}};UserReport[_0x8a01('0x1c')][_0x8a01('0x3b')]=function(_0x509ab2){try{if(this[_0x8a01('0x1d')](_0x509ab2)&&this[_0x8a01('0x1d')](_0x509ab2['peerstatus'])){logger[_0x8a01('0x20')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x509ab2[_0x8a01('0x3c')],_0x509ab2[_0x8a01('0x3d')],_0x509ab2[_0x8a01('0x11')]);logger[_0x8a01('0x23')](_0x8a01('0x3e'),util[_0x8a01('0x18')](_0x509ab2,{'showHidden':![],'depth':null}));if(this[_0x8a01('0xa')][_0x509ab2[_0x8a01('0x3c')]]){if(!this[_0x8a01('0xa')][_0x509ab2[_0x8a01('0x3c')]][_0x8a01('0x2f')]||_0x509ab2[_0x8a01('0x11')][_0x8a01('0x30')]()==_0x8a01('0x3f')){this[_0x8a01('0xa')][_0x509ab2[_0x8a01('0x3c')]]['local']=![];this[_0x8a01('0xa')][_0x509ab2[_0x8a01('0x3c')]][_0x8a01('0x40')]=_0x509ab2[_0x8a01('0x11')][_0x8a01('0x30')]();this['agents'][_0x509ab2[_0x8a01('0x3c')]][_0x8a01('0x3d')]=_0x509ab2[_0x8a01('0x3d')];this[_0x8a01('0xa')][_0x509ab2['peer']]['updateStatusRealtime'](_0x509ab2);}}else if(this['telephones'][_0x509ab2[_0x8a01('0x3c')]]){this['telephones'][_0x509ab2['peer']][_0x8a01('0x40')]=_0x509ab2[_0x8a01('0x11')]['toLowerCase']();this[_0x8a01('0xb')][_0x509ab2['peer']][_0x8a01('0x3d')]=_0x509ab2['address'];logger[_0x8a01('0x23')](_0x8a01('0x41'),util['inspect'](this[_0x8a01('0xb')][_0x509ab2[_0x8a01('0x3c')]],{'showHidden':![],'depth':null}));this[_0x8a01('0x1f')](util[_0x8a01('0x29')]('telephone:%s',this[_0x8a01('0xb')][_0x509ab2[_0x8a01('0x3c')]]['name']),'telephone:save',this[_0x8a01('0xb')][_0x509ab2[_0x8a01('0x3c')]]);}else if(this['trunks'][_0x509ab2[_0x8a01('0x3c')]]){this[_0x8a01('0x9')][_0x509ab2[_0x8a01('0x3c')]]['status']=_0x509ab2[_0x8a01('0x11')][_0x8a01('0x30')]();this['trunks'][_0x509ab2[_0x8a01('0x3c')]]['address']=_0x509ab2['address'];logger['debug'](_0x8a01('0x42'),util[_0x8a01('0x18')](this['trunks'][_0x509ab2[_0x8a01('0x3c')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this['trunks'][_0x509ab2['peer']][_0x8a01('0x2b')]),_0x8a01('0x43'),this[_0x8a01('0x9')][_0x509ab2['peer']]);}}}catch(_0x570fe6){logger[_0x8a01('0x16')]('[userReport][peerstatus]',util['inspect'](_0x570fe6,{'showHidden':![],'depth':null}));}};module[_0x8a01('0x44')]=UserReport; \ No newline at end of file +var _0x2804=['local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:save','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','actionDeviceStateList','catch','[userReport][devicestatelist]','inspect','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]'];(function(_0x100f8e,_0x1efaa3){var _0x5587df=function(_0x273a7e){while(--_0x273a7e){_0x100f8e['push'](_0x100f8e['shift']());}};_0x5587df(++_0x1efaa3);}(_0x2804,0xf8));var _0x4280=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2804[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4280('0x0'));var moment=require(_0x4280('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x4280('0x2'));var config=require(_0x4280('0x3'));var logger=require('../../../config/logger')(_0x4280('0x4'));var ami=require(_0x4280('0x5'));config[_0x4280('0x6')]=_[_0x4280('0x7')](config[_0x4280('0x6')],{'host':_0x4280('0x8'),'port':0x18eb});var io=require(_0x4280('0x9'))(new Redis(config[_0x4280('0x6')]));function UserReport(_0x205035){this[_0x4280('0xa')]=_0x205035[_0x4280('0xa')];this['agents']=_0x205035[_0x4280('0xb')];this[_0x4280('0xc')]=_0x205035[_0x4280('0xc')];ami['on'](_0x4280('0xd'),this[_0x4280('0xe')]['bind'](this));ami['on'](_0x4280('0xf'),this[_0x4280('0xe')][_0x4280('0x10')](this));ami['on']('devicestatechange',this[_0x4280('0x11')][_0x4280('0x10')](this));ami['on'](_0x4280('0x12'),this[_0x4280('0x13')][_0x4280('0x10')](this));return this[_0x4280('0x14')]();}function showSipRegistrations(){Promise[_0x4280('0x15')]()[_0x4280('0x16')](ami[_0x4280('0x17')]())['catch'](function(_0x2d367f){logger[_0x4280('0x18')](_0x4280('0x19'),util['inspect'](_0x2d367f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x4280('0x15')]()[_0x4280('0x16')](ami[_0x4280('0x1a')]())[_0x4280('0x1b')](function(_0x5cbbb1){logger[_0x4280('0x18')](_0x4280('0x1c'),util[_0x4280('0x1d')](_0x5cbbb1,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x4280('0x15')]()['then'](ami['actionSipPeerStatus']())['catch'](function(_0x4fd436){logger[_0x4280('0x18')]('[userReport][sippeerstatus]',util[_0x4280('0x1d')](_0x4fd436,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x4280('0x14')]=function(){setInterval(function(){BPromise[_0x4280('0x15')]()['then'](showSipRegistrations())[_0x4280('0x16')](listDeviceStates())[_0x4280('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x4280('0x1e')]['isNotNull']=function(_0x32d73f){return _0x32d73f!==null&&!_['isUndefined'](_0x32d73f);};UserReport['prototype'][_0x4280('0x1f')]=function(_0x1b4abe,_0x3f6d8c,_0x137b84){io['to'](_0x1b4abe)[_0x4280('0x1f')](_0x3f6d8c,_0x137b84);};UserReport[_0x4280('0x1e')]['syncRegistry']=function(_0x36fc71){try{if(this[_0x4280('0x20')](_0x36fc71)){logger[_0x4280('0x21')](_0x4280('0x22'),_0x36fc71[_0x4280('0x23')],_0x36fc71[_0x4280('0x24')]);logger[_0x4280('0x25')](_0x4280('0x26'),util[_0x4280('0x1d')](_0x36fc71,{'showHidden':![],'depth':null}));var _0x11262e=_[_0x4280('0x27')](this[_0x4280('0xa')],{'defaultuser':_0x36fc71[_0x4280('0x23')]});if(_0x11262e){_0x36fc71[_0x4280('0x28')]=_0x36fc71[_0x4280('0x24')];_['merge'](_0x11262e,_[_0x4280('0x29')](_0x36fc71,[_0x4280('0x2a'),_0x4280('0x2b'),_0x4280('0x23'),'state']));logger[_0x4280('0x25')](_0x4280('0x2c'),util[_0x4280('0x1d')](_0x11262e,{'showHidden':![],'depth':null}));this[_0x4280('0x1f')](util[_0x4280('0x2d')](_0x4280('0x2e'),_0x11262e[_0x4280('0x2f')]),_0x4280('0x30'),_0x11262e);}}}catch(_0x1a0fcf){logger['error'](_0x4280('0x26'),util[_0x4280('0x1d')](_0x1a0fcf,{'showHidden':![],'depth':null}));}};UserReport[_0x4280('0x1e')][_0x4280('0x11')]=function(_0x2eb94c){try{if(this[_0x4280('0x20')](_0x2eb94c)){logger['info'](_0x4280('0x31'),_0x2eb94c[_0x4280('0x32')],_0x2eb94c[_0x4280('0x24')]);logger['debug'](_0x4280('0x33'),util[_0x4280('0x1d')](_0x2eb94c,{'showHidden':![],'depth':null}));if(this['agents'][_0x2eb94c[_0x4280('0x32')]]){if(!this[_0x4280('0xb')][_0x2eb94c['device']][_0x4280('0x34')]||_0x2eb94c[_0x4280('0x24')][_0x4280('0x35')]()==_0x4280('0x36')){this[_0x4280('0xb')][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x34')]=![];if(this[_0x4280('0xb')][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x24')]!==_0x2eb94c[_0x4280('0x24')][_0x4280('0x35')]()){this['agents'][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x37')]=_[_0x4280('0x38')](moment()[_0x4280('0x2d')]('x'));}this[_0x4280('0xb')][_0x2eb94c['device']][_0x4280('0x24')]=_0x2eb94c['state'][_0x4280('0x35')]();this[_0x4280('0xb')][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x39')](_0x2eb94c);}}else if(this[_0x4280('0xc')][_0x2eb94c[_0x4280('0x32')]]){if(this[_0x4280('0xc')][_0x2eb94c[_0x4280('0x32')]]['state']!==_0x2eb94c['state'][_0x4280('0x35')]()){this['telephones'][_0x2eb94c[_0x4280('0x32')]]['stateTime']=_['toNumber'](moment()[_0x4280('0x2d')]('x'));}this['telephones'][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x24')]=_0x2eb94c[_0x4280('0x24')][_0x4280('0x35')]();logger[_0x4280('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x4280('0x1d')](this[_0x4280('0xc')][_0x2eb94c[_0x4280('0x32')]],{'showHidden':![],'depth':null}));this[_0x4280('0x1f')](util[_0x4280('0x2d')]('telephone:%s',this[_0x4280('0xc')][_0x2eb94c['device']][_0x4280('0x2f')]),_0x4280('0x3a'),this[_0x4280('0xc')][_0x2eb94c[_0x4280('0x32')]]);}else if(this[_0x4280('0xa')][_0x2eb94c[_0x4280('0x32')]]){if(this[_0x4280('0xa')][_0x2eb94c[_0x4280('0x32')]]['state']!==_0x2eb94c[_0x4280('0x24')]['toLowerCase']()){this[_0x4280('0xa')][_0x2eb94c[_0x4280('0x32')]][_0x4280('0x37')]=_[_0x4280('0x38')](moment()['format']('x'));}this['trunks'][_0x2eb94c[_0x4280('0x32')]]['state']=_0x2eb94c[_0x4280('0x24')]['toLowerCase']();logger[_0x4280('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x4280('0x1d')](this['trunks'][_0x2eb94c['device']],{'showHidden':![],'depth':null}));this[_0x4280('0x1f')](util[_0x4280('0x2d')](_0x4280('0x2e'),this['trunks'][_0x2eb94c['device']][_0x4280('0x2f')]),_0x4280('0x30'),this[_0x4280('0xa')][_0x2eb94c[_0x4280('0x32')]]);}else if(_[_0x4280('0x3b')](_0x2eb94c[_0x4280('0x32')],'Local')){var _0x4486a5=_0x2eb94c[_0x4280('0x32')];var _0x4bff44=_0x4486a5[_0x4280('0x3c')](_0x4486a5[_0x4280('0x3d')]('/')+0x1,_0x4486a5[_0x4280('0x3d')]('@'));var _0x5b6c3c=_['find'](this[_0x4280('0xb')],function(_0x154f01){return _0x154f01[_0x4280('0x3e')]==_0x4bff44||_0x154f01[_0x4280('0x3f')]==_0x4bff44||_0x154f01[_0x4280('0x40')]==_0x4bff44;});if(_0x5b6c3c){if(_0x5b6c3c[_0x4280('0x24')]!==_0x2eb94c[_0x4280('0x24')][_0x4280('0x35')]()){_0x5b6c3c['stateTime']=_['toNumber'](moment()['format']('x'));}_0x5b6c3c['state']=_0x2eb94c[_0x4280('0x24')]['toLowerCase']();_0x5b6c3c[_0x4280('0x34')]=!![];_0x5b6c3c[_0x4280('0x39')](_0x2eb94c);}}}}catch(_0x272802){logger[_0x4280('0x18')]('[userReport][devicestatechange]',util[_0x4280('0x1d')](_0x272802,{'showHidden':![],'depth':null}));}};UserReport[_0x4280('0x1e')][_0x4280('0x13')]=function(_0x4b9ff2){try{if(this['isNotNull'](_0x4b9ff2)&&this[_0x4280('0x20')](_0x4b9ff2[_0x4280('0x12')])){logger[_0x4280('0x21')](_0x4280('0x41'),_0x4b9ff2[_0x4280('0x42')],_0x4b9ff2['address'],_0x4b9ff2[_0x4280('0x12')]);logger[_0x4280('0x25')]('[userReport][peerstatus]',util[_0x4280('0x1d')](_0x4b9ff2,{'showHidden':![],'depth':null}));if(this[_0x4280('0xb')][_0x4b9ff2[_0x4280('0x42')]]){if(!this[_0x4280('0xb')][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x34')]||_0x4b9ff2[_0x4280('0x12')][_0x4280('0x35')]()==_0x4280('0x43')){this[_0x4280('0xb')][_0x4b9ff2['peer']]['local']=![];this[_0x4280('0xb')][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x44')]=_0x4b9ff2['peerstatus'][_0x4280('0x35')]();this[_0x4280('0xb')][_0x4b9ff2[_0x4280('0x42')]]['address']=_0x4b9ff2['address'];this[_0x4280('0xb')][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x39')](_0x4b9ff2);}}else if(this[_0x4280('0xc')][_0x4b9ff2[_0x4280('0x42')]]){this[_0x4280('0xc')][_0x4b9ff2['peer']][_0x4280('0x44')]=_0x4b9ff2[_0x4280('0x12')][_0x4280('0x35')]();this['telephones'][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x45')]=_0x4b9ff2[_0x4280('0x45')];logger[_0x4280('0x25')](_0x4280('0x46'),util[_0x4280('0x1d')](this[_0x4280('0xc')][_0x4b9ff2[_0x4280('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x4280('0x47'),this[_0x4280('0xc')][_0x4b9ff2['peer']][_0x4280('0x2f')]),_0x4280('0x3a'),this[_0x4280('0xc')][_0x4b9ff2[_0x4280('0x42')]]);}else if(this[_0x4280('0xa')][_0x4b9ff2[_0x4280('0x42')]]){this[_0x4280('0xa')][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x44')]=_0x4b9ff2[_0x4280('0x12')]['toLowerCase']();this[_0x4280('0xa')][_0x4b9ff2[_0x4280('0x42')]][_0x4280('0x45')]=_0x4b9ff2[_0x4280('0x45')];logger[_0x4280('0x25')](_0x4280('0x48'),util[_0x4280('0x1d')](this['trunks'][_0x4b9ff2[_0x4280('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x4280('0x2d')]('trunk:%s',this[_0x4280('0xa')][_0x4b9ff2[_0x4280('0x42')]]['name']),_0x4280('0x30'),this['trunks'][_0x4b9ff2[_0x4280('0x42')]]);}}}catch(_0x5d6bc0){logger['error'](_0x4280('0x49'),util[_0x4280('0x1d')](_0x5d6bc0,{'showHidden':![],'depth':null}));}};module[_0x4280('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 07ebaec..c44819b 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 _0x0842=['voiceChannels','channels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','merge','omit','privilege','debug','inspect','calleridnum','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','holdtime','connect','routealias','pick','destconnectedlinenum','split','name','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','interface','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberrealtime','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','lodash','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter'];(function(_0x461bbd,_0x417bd3){var _0x250d55=function(_0x1acf73){while(--_0x1acf73){_0x461bbd['push'](_0x461bbd['shift']());}};_0x250d55(++_0x417bd3);}(_0x0842,0x125));var _0x2084=function(_0x3b8e51,_0x5eb61a){_0x3b8e51=_0x3b8e51-0x0;var _0x37068f=_0x0842[_0x3b8e51];return _0x37068f;};'use strict';var _=require(_0x2084('0x0'));var moment=require('moment');var util=require(_0x2084('0x1'));var Redis=require(_0x2084('0x2'));var config=require('../../../config/environment');var logger=require(_0x2084('0x3'))(_0x2084('0x4'));var ami=require(_0x2084('0x5'));config[_0x2084('0x6')]=_[_0x2084('0x7')](config[_0x2084('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2084('0x8'))(new Redis(config[_0x2084('0x6')]));function VoiceAgentReport(_0x2db0de){this['channels']={};this[_0x2084('0x9')]=_0x2db0de[_0x2084('0xa')];this[_0x2084('0xb')]=_0x2db0de[_0x2084('0xb')];this['agents']=_0x2db0de[_0x2084('0xc')];this[_0x2084('0xd')]={};ami['on']('agentcalled',this[_0x2084('0xe')][_0x2084('0xf')](this));ami['on']('agentconnect',this[_0x2084('0x10')][_0x2084('0xf')](this));ami['on']('agentringnoanswer',this[_0x2084('0x11')][_0x2084('0xf')](this));ami['on'](_0x2084('0x12'),this[_0x2084('0x13')][_0x2084('0xf')](this));ami['on'](_0x2084('0x14'),this[_0x2084('0x15')][_0x2084('0xf')](this));ami['on'](_0x2084('0x16'),this[_0x2084('0x17')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x2084('0xf')](this));ami['on'](_0x2084('0x18'),this[_0x2084('0x19')][_0x2084('0xf')](this));ami['on'](_0x2084('0x1a'),this[_0x2084('0x1b')][_0x2084('0xf')](this));ami['on'](_0x2084('0x1c'),this[_0x2084('0x1d')][_0x2084('0xf')](this));ami['on'](_0x2084('0x1e'),this[_0x2084('0x1f')][_0x2084('0xf')](this));}VoiceAgentReport['prototype'][_0x2084('0x20')]=function(_0x4c97fb,_0x510d6f,_0x164f7b){io['to'](_0x4c97fb)[_0x2084('0x20')](_0x510d6f,_0x164f7b);};VoiceAgentReport[_0x2084('0x21')][_0x2084('0x22')]=function(_0x475a55){return _0x475a55!==null&&!_[_0x2084('0x23')](_0x475a55);};VoiceAgentReport['prototype'][_0x2084('0xe')]=function(_0x6b52e1){try{if(this[_0x2084('0x22')](_0x6b52e1)){logger[_0x2084('0x24')](_0x2084('0x25'),_0x6b52e1[_0x2084('0x26')],_0x6b52e1[_0x2084('0x27')],_0x6b52e1[_0x2084('0x28')]);logger['debug'](_0x2084('0x29'),_0x6b52e1[_0x2084('0x26')],util['inspect'](_0x6b52e1,{'showHidden':![],'depth':null}));if(_[_0x2084('0x23')](this[_0x2084('0xa')][_0x6b52e1[_0x2084('0x26')]])){this[_0x2084('0xa')][_0x6b52e1[_0x2084('0x26')]]={};}var _0x75582b=this[_0x2084('0xc')][_0x6b52e1['interface']];var _0xee60c4=this['channels'][_0x6b52e1[_0x2084('0x26')]][_0x6b52e1['destuniqueid']];var _0x7db838=this[_0x2084('0xb')][_0x6b52e1[_0x2084('0x2a')]];var _0xfc6cd=this[_0x2084('0xd')][_0x6b52e1[_0x2084('0x26')]];if(_[_0x2084('0x23')](_0xee60c4)){_0xee60c4={'agentcalledAt':moment()[_0x2084('0x2b')](_0x2084('0x2c')),'lastevent':_0x2084('0x2d'),'mandatoryDisposition':_0x7db838&&_0x7db838[_0x2084('0x2e')]?_0x7db838[_0x2084('0x2e')]:![],'type':_0x7db838&&_0x7db838[_0x2084('0x2f')]?_0x7db838['type']:_0x2084('0x30'),'variables':_0xfc6cd,'motionChannel':_0x2084('0x31')};}_[_0x2084('0x32')](_0xee60c4,_[_0x2084('0x33')](_0x6b52e1,['event',_0x2084('0x34')]));logger[_0x2084('0x35')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x6b52e1[_0x2084('0x26')],util[_0x2084('0x36')](_0xee60c4,{'showHidden':![],'depth':null}));ami[_0x2084('0x20')]('custom:agentcalled',_0xee60c4);var _0x6d1950={'id':_0x75582b['id'],'calleridnum':_0xee60c4[_0x2084('0x37')],'queue':_0xee60c4[_0x2084('0x2a')],'variables':_0xee60c4[_0x2084('0xd')],'uniqueid':_0x6b52e1[_0x2084('0x26')]};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x6b52e1[_0x2084('0x26')],util[_0x2084('0x36')](_0x6d1950,{'showHidden':![],'depth':null}));this['emit'](util[_0x2084('0x2b')](_0x2084('0x38'),_0x6b52e1[_0x2084('0x27')]),_0x2084('0x39'),_0x6d1950);}}catch(_0x4fcf83){logger[_0x2084('0x3a')](_0x2084('0x3b'),_0x6b52e1[_0x2084('0x26')],util[_0x2084('0x36')](_0x4fcf83,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')]['syncAgentConnect']=function(_0x181858){try{if(this[_0x2084('0x22')](_0x181858)){if(this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]]){logger[_0x2084('0x35')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x181858[_0x2084('0x26')],util[_0x2084('0x36')](_0x181858,{'showHidden':![],'depth':null}));for(var _0x5f0f9f in this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]]){if(this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x2084('0x3c')](_0x5f0f9f)){if(_0x181858['destuniqueid']===_0x5f0f9f){logger[_0x2084('0x24')](_0x2084('0x3d'),_0x181858[_0x2084('0x26')],_0x181858['membername'],_0x181858[_0x2084('0x28')]);this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x3e')]=moment()[_0x2084('0x2b')](_0x2084('0x2c'));this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x3f')]=_0x181858['connectedlinename'];this[_0x2084('0xa')][_0x181858['uniqueid']][_0x5f0f9f][_0x2084('0x40')]=_0x181858[_0x2084('0x40')];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x41')]=_0x181858['destchannelstate'];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f]['destchannelstatedesc']=_0x181858['destchannelstatedesc'];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x42')]=_0x181858['holdtime'];this[_0x2084('0xa')][_0x181858['uniqueid']][_0x5f0f9f]['lastevent']=_0x2084('0x43');if(this[_0x2084('0x9')][this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x26')]]){var _0x314e55=this['voiceChannels'][this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x26')]][_0x2084('0x44')];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x44')]=_0x314e55;_0x181858['routealias']=_0x314e55;}_[_0x2084('0x32')](this[_0x2084('0xc')][_0x181858['interface']],_[_0x2084('0x45')](_0x181858,[_0x2084('0x2a'),_0x2084('0x46'),'routealias']));var _0x27ab2d=this['agents'][_0x181858['channel'][_0x2084('0x47')]('-')[0x0]];var _0xbf18cd={'id':_0x27ab2d['id'],'name':_0x27ab2d[_0x2084('0x48')],'agentconnected':!![],'destaccountcode':_0x27ab2d[_0x2084('0x49')],'destconnectedlinenum':this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x181858['destuniqueid']][_0x2084('0x4a')],'queue':this['channels'][_0x181858[_0x2084('0x26')]][_0x181858[_0x2084('0x28')]][_0x2084('0x2a')],'routealias':this[_0x2084('0xa')][_0x181858['uniqueid']][_0x181858['destuniqueid']][_0x2084('0x44')],'uniqueid':this[_0x2084('0xa')][_0x181858['uniqueid']][_0x181858[_0x2084('0x28')]][_0x2084('0x26')]};logger[_0x2084('0x35')](_0x2084('0x4b'),_0x181858[_0x2084('0x26')],util['inspect'](_0xbf18cd,{'showHidden':![],'depth':null}));ami['emit'](_0x2084('0x4c'),_0xbf18cd);logger[_0x2084('0x35')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x181858[_0x2084('0x26')],util[_0x2084('0x36')](_0xbf18cd,{'showHidden':![],'depth':null}));this['emit'](util[_0x2084('0x2b')](_0x2084('0x38'),_0x181858['membername']),_0x2084('0x4d'),_0xbf18cd);}else if(!this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x4e')]&&!this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f]['agentcomplete']){logger[_0x2084('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x181858[_0x2084('0x26')],this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f]['membername'],_0x5f0f9f);this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x4e')]=!![];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x4f')]=moment()[_0x2084('0x2b')](_0x2084('0x2c'));this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x50')]=_0x181858[_0x2084('0x28')];this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f][_0x2084('0x51')]=_0x181858[_0x2084('0x27')];this[_0x2084('0xa')][_0x181858['uniqueid']][_0x5f0f9f][_0x2084('0x52')]='answered_elsewhere';this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f]['reason']=_0x2084('0x53');logger['debug'](_0x2084('0x54'),_0x181858[_0x2084('0x26')],util[_0x2084('0x36')](this[_0x2084('0xa')][_0x181858[_0x2084('0x26')]][_0x5f0f9f],{'showHidden':![],'depth':null}));ami[_0x2084('0x20')](_0x2084('0x55'),this[_0x2084('0xa')][_0x181858['uniqueid']][_0x5f0f9f]);}}}}}}catch(_0x5aa1e8){logger[_0x2084('0x3a')](_0x2084('0x56'),_0x181858[_0x2084('0x26')],util[_0x2084('0x36')](_0x5aa1e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')][_0x2084('0x11')]=function(_0x5b052c){try{if(this[_0x2084('0x22')](_0x5b052c)){logger['debug'](_0x2084('0x57'),_0x5b052c[_0x2084('0x26')],util[_0x2084('0x36')](_0x5b052c,{'showHidden':![],'depth':null}));if(this[_0x2084('0xa')][_0x5b052c[_0x2084('0x26')]]&&this[_0x2084('0xa')][_0x5b052c[_0x2084('0x26')]][_0x5b052c[_0x2084('0x28')]]){logger['info'](_0x2084('0x58'),_0x5b052c[_0x2084('0x26')],_0x5b052c[_0x2084('0x27')],_0x5b052c['destuniqueid']);var _0x19d481=this[_0x2084('0xc')][_0x5b052c[_0x2084('0x59')]];var _0x47f76d=this[_0x2084('0xa')][_0x5b052c[_0x2084('0x26')]][_0x5b052c[_0x2084('0x28')]];_0x47f76d[_0x2084('0x4e')]=!![];_0x47f76d[_0x2084('0x4f')]=moment()['format'](_0x2084('0x2c'));_0x47f76d[_0x2084('0x52')]=_0x2084('0x5a');_0x47f76d[_0x2084('0x5b')]=_0x2084('0x5a');var _0x5ad9ef={'id':_0x19d481['id'],'name':_0x19d481[_0x2084('0x48')],'queue':_0x47f76d[_0x2084('0x2a')],'uniqueid':_0x47f76d[_0x2084('0x26')]};logger[_0x2084('0x35')](_0x2084('0x5c'),_0x5b052c[_0x2084('0x26')],util['inspect'](_0x5ad9ef,{'showHidden':![],'depth':null}));this[_0x2084('0x20')](util[_0x2084('0x2b')]('user:%s',_0x19d481['name']),'user:agentringnoanswer',_0x5ad9ef);ami['emit']('custom:agentringnoanswer',_0x47f76d);}}}catch(_0x406a43){logger[_0x2084('0x3a')](_0x2084('0x5d'),_0x5b052c[_0x2084('0x26')],util['inspect'](_0x406a43,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')]['syncQueueCallerAbandon']=function(_0x110f72){try{if(this[_0x2084('0x22')](_0x110f72)){logger[_0x2084('0x35')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x110f72['uniqueid'],util[_0x2084('0x36')](_0x110f72,{'showHidden':![],'depth':null}));if(this['channels'][_0x110f72[_0x2084('0x26')]]){for(var _0x3b5320 in this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]]){if(this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]]['hasOwnProperty'](_0x3b5320)&&!this['channels'][_0x110f72['uniqueid']][_0x3b5320]['agentringnoanswer']&&!this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320][_0x2084('0x14')]){logger[_0x2084('0x24')](_0x2084('0x5e'),_0x110f72[_0x2084('0x26')],this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320]['membername'],_0x3b5320);this['channels'][_0x110f72[_0x2084('0x26')]][_0x3b5320][_0x2084('0x4e')]=!![];this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320][_0x2084('0x4f')]=moment()[_0x2084('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320][_0x2084('0x52')]='abandoned';this['channels'][_0x110f72['uniqueid']][_0x3b5320]['reason']=_0x2084('0x5f');logger[_0x2084('0x35')](_0x2084('0x60'),_0x110f72[_0x2084('0x26')],util[_0x2084('0x36')](this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320],{'showHidden':![],'depth':null}));ami[_0x2084('0x20')](_0x2084('0x61'),this[_0x2084('0xa')][_0x110f72[_0x2084('0x26')]][_0x3b5320]);}}}}}catch(_0x3dd605){logger[_0x2084('0x3a')]('[%s][voiceAgentReport][queuecallerabandon]',_0x110f72['uniqueid'],util[_0x2084('0x36')](_0x3dd605,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x3e4d3e){try{if(this[_0x2084('0x22')](_0x3e4d3e)){logger[_0x2084('0x35')](_0x2084('0x62'),_0x3e4d3e[_0x2084('0x26')],util[_0x2084('0x36')](_0x3e4d3e,{'showHidden':![],'depth':null}));if(this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]]){for(var _0xf01ec5 in this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]]){if(this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0x2084('0x3c')](_0xf01ec5)){if(this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x3e')]&&!this['channels'][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x14')]){logger[_0x2084('0x24')](_0x2084('0x63'),_0x3e4d3e[_0x2084('0x26')],this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x27')],_0xf01ec5);this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x14')]=!![];this[_0x2084('0xa')][_0x3e4d3e['uniqueid']][_0xf01ec5]['agentcompleteAt']=moment()[_0x2084('0x2b')](_0x2084('0x2c'));this['channels'][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x52')]='complete';this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x5b')]=_0x3e4d3e[_0x2084('0x5b')]==_0x2084('0x64')?_0x2084('0x65'):_0x3e4d3e['reason'];this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x66')]=_0x3e4d3e['talktime'];if(this[_0x2084('0xb')][_0x3e4d3e['queue']]&&this[_0x2084('0xb')][_0x3e4d3e['queue']][_0x2084('0x67')]){this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5][_0x2084('0x68')]=this[_0x2084('0xb')][_0x3e4d3e['queue']][_0x2084('0x69')];this['channels'][_0x3e4d3e['uniqueid']][_0xf01ec5][_0x2084('0x6a')]=!![];}this[_0x2084('0xc')][_0x3e4d3e[_0x2084('0x59')]]=_[_0x2084('0x33')](this[_0x2084('0xc')][_0x3e4d3e[_0x2084('0x59')]],[_0x2084('0x2a'),_0x2084('0x46')]);logger[_0x2084('0x35')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x3e4d3e['uniqueid'],util['inspect'](this[_0x2084('0xa')][_0x3e4d3e['uniqueid']][_0xf01ec5],{'showHidden':![],'depth':null}));ami[_0x2084('0x20')](_0x2084('0x6b'),this[_0x2084('0xa')][_0x3e4d3e[_0x2084('0x26')]][_0xf01ec5]);logger[_0x2084('0x35')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3e4d3e[_0x2084('0x26')],util['inspect']({'id':this[_0x2084('0xc')][_0x3e4d3e[_0x2084('0x59')]]['id'],'destaccountcode':_0x3e4d3e[_0x2084('0x6c')]},{'showHidden':![],'depth':null}));this[_0x2084('0x20')](util['format'](_0x2084('0x38'),_0x3e4d3e[_0x2084('0x27')]),_0x2084('0x6d'),{'id':this['agents'][_0x3e4d3e[_0x2084('0x59')]]['id'],'destaccountcode':Number(_0x3e4d3e['destaccountcode'])});}}}}}}catch(_0x2100cc){logger[_0x2084('0x3a')](_0x2084('0x6e'),_0x3e4d3e[_0x2084('0x26')],util[_0x2084('0x36')](_0x2100cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')]['syncVarSet']=function(_0xcb5850){try{if(this[_0x2084('0x22')](_0xcb5850)){logger[_0x2084('0x35')](_0x2084('0x6f'),_0xcb5850['uniqueid'],util[_0x2084('0x36')](_0xcb5850,{'showHidden':![],'depth':null}));this[_0x2084('0x70')](_0xcb5850[_0x2084('0x26')],_[_0x2084('0x71')](_0xcb5850[_0x2084('0x72')])[0x0],_0xcb5850[_0x2084('0x73')]);if(this['channels'][_0xcb5850[_0x2084('0x26')]]){for(var _0x2acd8b in this[_0x2084('0xa')][_0xcb5850['uniqueid']]){if(this[_0x2084('0xa')][_0xcb5850[_0x2084('0x26')]][_0x2084('0x3c')](_0x2acd8b)){logger[_0x2084('0x24')](_0x2084('0x74'),_0xcb5850['uniqueid'],_0x2acd8b,_[_0x2084('0x71')](_0xcb5850[_0x2084('0x72')])[0x0],_0xcb5850[_0x2084('0x73')]);if(_[_0x2084('0x23')](this[_0x2084('0xa')][_0xcb5850[_0x2084('0x26')]][_0x2acd8b]['variables'])){this[_0x2084('0xa')][_0xcb5850['uniqueid']][_0x2acd8b][_0x2084('0xd')]={};}this['channels'][_0xcb5850[_0x2084('0x26')]][_0x2acd8b][_0x2084('0xd')]=this[_0x2084('0xd')][_0xcb5850[_0x2084('0x26')]];}}}}}catch(_0x1ace08){logger[_0x2084('0x3a')](_0x2084('0x75'),_0xcb5850[_0x2084('0x26')],util['inspect'](_0x1ace08,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')][_0x2084('0x70')]=function(_0xb48951,_0x547078,_0x55c93c){var _0x1897f6=[_0x2084('0x76'),_0x2084('0x77'),_0x2084('0x78'),_0x2084('0x79'),'rtpaudioqosloss',_0x2084('0x7a'),_0x2084('0x7b'),'rtpaudioqosrttbridged',_0x2084('0x7c'),_0x2084('0x7d'),_0x2084('0x7e'),'bridgepvtcallid',_0x2084('0x7f'),'memberdynamic',_0x2084('0x80'),_0x2084('0x81'),_0x2084('0x27'),'memberpenalty',_0x2084('0x82')];if(!_['isNil'](_0x547078)&&!_['includes'](_0x1897f6,_0x547078)){if(_[_0x2084('0x23')](this[_0x2084('0xd')][_0xb48951])){this[_0x2084('0xd')][_0xb48951]={};}this[_0x2084('0xd')][_0xb48951][_0x547078]=_0x55c93c;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x17d03c){try{if(this[_0x2084('0x22')](_0x17d03c)){logger[_0x2084('0x35')](_0x2084('0x83'),_0x17d03c['uniqueid'],util[_0x2084('0x36')](_0x17d03c,{'showHidden':![],'depth':null}));if(this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]]){for(var _0x212d4e in this[_0x2084('0xa')][_0x17d03c['uniqueid']]){if(this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]][_0x2084('0x3c')](_0x212d4e)){if(this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]][_0x212d4e][_0x2084('0x5b')]==_0x2084('0x64')&&this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]][_0x212d4e][_0x2084('0x14')]){logger[_0x2084('0x24')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x17d03c[_0x2084('0x26')],_0x212d4e);this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]][_0x212d4e][_0x2084('0x84')]=moment()[_0x2084('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x2084('0x35')](_0x2084('0x85'),_0x17d03c[_0x2084('0x26')],util[_0x2084('0x36')](_['values'](this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x2084('0x20')](_0x2084('0x86'),_[_0x2084('0x87')](this[_0x2084('0xa')][_0x17d03c['uniqueid']]));delete this[_0x2084('0xa')][_0x17d03c[_0x2084('0x26')]];}if(this['variables'][_0x17d03c['uniqueid']]){delete this[_0x2084('0xd')][_0x17d03c[_0x2084('0x26')]];}}}catch(_0x59cb4d){logger[_0x2084('0x3a')](_0x2084('0x88'),_0x17d03c[_0x2084('0x26')],util[_0x2084('0x36')](_0x59cb4d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')]['syncAttendedTransfer']=function(_0x1e968b){try{if(this[_0x2084('0x22')](_0x1e968b)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1e968b['uniqueid'],util[_0x2084('0x36')](_0x1e968b,{'showHidden':![],'depth':null}));if(this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]]){for(var _0x8ac4a8 in this['channels'][_0x1e968b[_0x2084('0x89')]]){if(this[_0x2084('0xa')][_0x1e968b['transfereeuniqueid']][_0x2084('0x3c')](_0x8ac4a8)){if(_0x1e968b['origtransfereruniqueid']===_0x8ac4a8){logger[_0x2084('0x24')](_0x2084('0x8a'),_0x1e968b['uniqueid'],this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8]['membername'],_0x8ac4a8);var _0x2c92c8=moment();this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8]['agentcomplete']=!![];this['channels'][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8][_0x2084('0x84')]=moment()[_0x2084('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8][_0x2084('0x52')]=_0x2084('0x8b');this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8][_0x2084('0x5b')]=_0x2084('0x64');this[_0x2084('0xa')][_0x1e968b[_0x2084('0x89')]][_0x8ac4a8][_0x2084('0x66')]=_0x2c92c8[_0x2084('0x8c')](this[_0x2084('0xa')][_0x1e968b['transfereeuniqueid']][_0x8ac4a8]['agentconnectAt'],_0x2084('0x8d'));}}}}if(this['channels'][_0x1e968b[_0x2084('0x8e')]]){var _0xbdc4b6=this[_0x2084('0xa')][_0x1e968b[_0x2084('0x8e')]];this[_0x2084('0xa')][_0x1e968b[_0x2084('0x8e')]]=this[_0x2084('0xa')][_0x1e968b['transfereeuniqueid']];this['channels'][_0x1e968b[_0x2084('0x89')]]=_0xbdc4b6;}}}catch(_0x568fca){logger[_0x2084('0x3a')](_0x2084('0x8f'),_0x1e968b[_0x2084('0x26')],util[_0x2084('0x36')](_0x568fca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')][_0x2084('0x1f')]=function(_0x3fe9c4){try{if(this[_0x2084('0x22')](_0x3fe9c4)){logger[_0x2084('0x35')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3fe9c4[_0x2084('0x26')],util['inspect'](_0x3fe9c4,{'showHidden':![],'depth':null}));if(this[_0x2084('0xa')][_0x3fe9c4['transfereeuniqueid']]){for(var _0x1c9d5e in this['channels'][_0x3fe9c4['transfereeuniqueid']]){if(this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]]['hasOwnProperty'](_0x1c9d5e)){if(_0x3fe9c4[_0x2084('0x90')]===_0x1c9d5e){logger[_0x2084('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3fe9c4['uniqueid'],this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x27')],_0x1c9d5e);var _0x416afa=moment();this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x14')]=!![];this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x84')]=_0x416afa;this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x52')]=_0x2084('0x8b');this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e]['reason']=_0x2084('0x64');this[_0x2084('0xa')][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x66')]=_0x416afa['diff'](this['channels'][_0x3fe9c4[_0x2084('0x89')]][_0x1c9d5e][_0x2084('0x3e')],_0x2084('0x8d'));}}}}}}catch(_0x3045f7){logger[_0x2084('0x3a')]('[%s][voiceAgentReport][blindtransfer]',_0x3fe9c4[_0x2084('0x26')],util[_0x2084('0x36')](_0x3045f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2084('0x21')][_0x2084('0x19')]=function(_0x38f264){var _0x58df7b='';try{if(this['isNotNull'](_0x38f264)){logger[_0x2084('0x35')](_0x2084('0x91'),_0x38f264['uniqueid'],util[_0x2084('0x36')](_0x38f264,{'showHidden':![],'depth':null}));if(_0x38f264[_0x2084('0x92')]){_0x58df7b=_0x38f264[_0x2084('0x92')][_0x2084('0x93')](0x0,_0x38f264[_0x2084('0x92')][_0x2084('0x94')]('-'));if(this[_0x2084('0xc')][_0x58df7b]){logger[_0x2084('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x38f264[_0x2084('0x26')],_0x58df7b);this[_0x2084('0xc')][_0x58df7b][_0x2084('0x95')]=!![];}}}}catch(_0x217c70){logger[_0x2084('0x3a')](_0x2084('0x96'),_0x38f264[_0x2084('0x26')],util[_0x2084('0x36')](_0x217c70,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2084('0x1b')]=function(_0x5ec9d3){var _0x5dd3e6='';try{if(this[_0x2084('0x22')](_0x5ec9d3)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5ec9d3[_0x2084('0x26')],util[_0x2084('0x36')](_0x5ec9d3,{'showHidden':![],'depth':null}));if(_0x5ec9d3[_0x2084('0x92')]){_0x5dd3e6=_0x5ec9d3[_0x2084('0x92')][_0x2084('0x93')](0x0,_0x5ec9d3['channel'][_0x2084('0x94')]('-'));if(this[_0x2084('0xc')][_0x5dd3e6]){logger[_0x2084('0x24')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5ec9d3[_0x2084('0x26')],_0x5dd3e6);this['agents'][_0x5dd3e6][_0x2084('0x95')]=![];}}}}catch(_0x4dd239){logger[_0x2084('0x3a')]('[%s][voiceAgentReport][musiconholdstop]',_0x5ec9d3['uniqueid'],util[_0x2084('0x36')](_0x4dd239,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa162=['acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','sipcallid','sipuri','memberinterface','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncVarSet','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','isUndefined','interface','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','voice','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','merge','pick','destconnectedlinenum','channel','split','name','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%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]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa162,0x1f1));var _0x2a16=function(_0x4be54a,_0x1599ef){_0x4be54a=_0x4be54a-0x0;var _0x454ab0=_0xa162[_0x4be54a];return _0x454ab0;};'use strict';var _=require(_0x2a16('0x0'));var moment=require(_0x2a16('0x1'));var util=require('util');var Redis=require(_0x2a16('0x2'));var config=require(_0x2a16('0x3'));var logger=require(_0x2a16('0x4'))(_0x2a16('0x5'));var ami=require('../ami');config[_0x2a16('0x6')]=_[_0x2a16('0x7')](config[_0x2a16('0x6')],{'host':_0x2a16('0x8'),'port':0x18eb});var io=require(_0x2a16('0x9'))(new Redis(config[_0x2a16('0x6')]));function VoiceAgentReport(_0x1530bc){this[_0x2a16('0xa')]={};this['voiceChannels']=_0x1530bc[_0x2a16('0xa')];this[_0x2a16('0xb')]=_0x1530bc['voiceQueues'];this[_0x2a16('0xc')]=_0x1530bc[_0x2a16('0xc')];this[_0x2a16('0xd')]={};ami['on'](_0x2a16('0xe'),this[_0x2a16('0xf')]['bind'](this));ami['on']('agentconnect',this[_0x2a16('0x10')][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x12'),this[_0x2a16('0x13')][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x14'),this['syncQueueCallerAbandon'][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x15'),this['syncAgentComplete'][_0x2a16('0x11')](this));ami['on']('varset',this[_0x2a16('0x16')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x2a16('0x11')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x17'),this[_0x2a16('0x18')][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x19'),this[_0x2a16('0x1a')][_0x2a16('0x11')](this));ami['on'](_0x2a16('0x1b'),this[_0x2a16('0x1c')][_0x2a16('0x11')](this));}VoiceAgentReport['prototype'][_0x2a16('0x1d')]=function(_0x14adde,_0x5ad7f6,_0x22f049){io['to'](_0x14adde)[_0x2a16('0x1d')](_0x5ad7f6,_0x22f049);};VoiceAgentReport['prototype']['isNotNull']=function(_0x2f0c3d){return _0x2f0c3d!==null&&!_['isUndefined'](_0x2f0c3d);};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0xf')]=function(_0x141d2e){try{if(this[_0x2a16('0x1f')](_0x141d2e)){logger['info'](_0x2a16('0x20'),_0x141d2e['uniqueid'],_0x141d2e[_0x2a16('0x21')],_0x141d2e[_0x2a16('0x22')]);logger[_0x2a16('0x23')](_0x2a16('0x24'),_0x141d2e[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x141d2e,{'showHidden':![],'depth':null}));if(_[_0x2a16('0x27')](this[_0x2a16('0xa')][_0x141d2e[_0x2a16('0x25')]])){this['channels'][_0x141d2e[_0x2a16('0x25')]]={};}var _0x5462c5=this['agents'][_0x141d2e[_0x2a16('0x28')]];var _0x35e618=this['channels'][_0x141d2e['uniqueid']][_0x141d2e[_0x2a16('0x22')]];var _0x3239ec=this[_0x2a16('0xb')][_0x141d2e['queue']];var _0x2fec7f=this['variables'][_0x141d2e[_0x2a16('0x25')]];if(_[_0x2a16('0x27')](_0x35e618)){_0x35e618={'agentcalledAt':moment()[_0x2a16('0x29')](_0x2a16('0x2a')),'lastevent':'called','mandatoryDisposition':_0x3239ec&&_0x3239ec['mandatoryDisposition']?_0x3239ec[_0x2a16('0x2b')]:![],'type':_0x3239ec&&_0x3239ec[_0x2a16('0x2c')]?_0x3239ec[_0x2a16('0x2c')]:'inbound','variables':_0x2fec7f,'motionChannel':_0x2a16('0x2d')};}_['merge'](_0x35e618,_[_0x2a16('0x2e')](_0x141d2e,[_0x2a16('0x2f'),'privilege']));logger[_0x2a16('0x23')](_0x2a16('0x30'),_0x141d2e[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x35e618,{'showHidden':![],'depth':null}));ami[_0x2a16('0x1d')](_0x2a16('0x31'),_0x35e618);var _0x4583f6={'id':_0x5462c5['id'],'calleridnum':_0x35e618[_0x2a16('0x32')],'queue':_0x35e618[_0x2a16('0x33')],'variables':_0x35e618[_0x2a16('0xd')],'uniqueid':_0x141d2e[_0x2a16('0x25')]};logger[_0x2a16('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x141d2e['uniqueid'],util[_0x2a16('0x26')](_0x4583f6,{'showHidden':![],'depth':null}));this[_0x2a16('0x1d')](util['format']('user:%s',_0x141d2e[_0x2a16('0x21')]),_0x2a16('0x34'),_0x4583f6);}}catch(_0x62d5ff){logger[_0x2a16('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x141d2e[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x62d5ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')]['syncAgentConnect']=function(_0x724915){try{if(this[_0x2a16('0x1f')](_0x724915)){if(this['channels'][_0x724915['uniqueid']]){logger[_0x2a16('0x23')](_0x2a16('0x36'),_0x724915[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x724915,{'showHidden':![],'depth':null}));for(var _0x249b95 in this['channels'][_0x724915[_0x2a16('0x25')]]){if(this['channels'][_0x724915[_0x2a16('0x25')]][_0x2a16('0x37')](_0x249b95)){if(_0x724915[_0x2a16('0x22')]===_0x249b95){logger[_0x2a16('0x38')](_0x2a16('0x39'),_0x724915['uniqueid'],_0x724915['membername'],_0x724915['destuniqueid']);this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x3a')]=moment()[_0x2a16('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2a16('0xa')][_0x724915['uniqueid']][_0x249b95][_0x2a16('0x3b')]=_0x724915[_0x2a16('0x3b')];this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x3c')]=_0x724915['connectedlinenum'];this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x3d')]=_0x724915[_0x2a16('0x3d')];this['channels'][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x3e')]=_0x724915['destchannelstatedesc'];this['channels'][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x3f')]=_0x724915['holdtime'];this[_0x2a16('0xa')][_0x724915['uniqueid']][_0x249b95][_0x2a16('0x40')]='connect';if(this[_0x2a16('0x41')][this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]['uniqueid']]){var _0x1a44f8=this[_0x2a16('0x41')][this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]['uniqueid']][_0x2a16('0x42')];this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]['routealias']=_0x1a44f8;_0x724915[_0x2a16('0x42')]=_0x1a44f8;}_[_0x2a16('0x43')](this[_0x2a16('0xc')][_0x724915[_0x2a16('0x28')]],_[_0x2a16('0x44')](_0x724915,[_0x2a16('0x33'),_0x2a16('0x45'),_0x2a16('0x42')]));var _0x350191=this[_0x2a16('0xc')][_0x724915[_0x2a16('0x46')][_0x2a16('0x47')]('-')[0x0]];var _0x5f551a={'id':_0x350191['id'],'name':_0x350191[_0x2a16('0x48')],'agentconnected':!![],'destaccountcode':_0x350191[_0x2a16('0x49')],'destconnectedlinenum':this['channels'][_0x724915[_0x2a16('0x25')]][_0x724915[_0x2a16('0x22')]][_0x2a16('0x4a')],'queue':this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x724915[_0x2a16('0x22')]][_0x2a16('0x33')],'routealias':this['channels'][_0x724915[_0x2a16('0x25')]][_0x724915[_0x2a16('0x22')]][_0x2a16('0x42')],'uniqueid':this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x724915[_0x2a16('0x22')]][_0x2a16('0x25')]};logger['debug'](_0x2a16('0x4b'),_0x724915[_0x2a16('0x25')],util['inspect'](_0x5f551a,{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',_0x5f551a);logger['debug'](_0x2a16('0x4c'),_0x724915[_0x2a16('0x25')],util['inspect'](_0x5f551a,{'showHidden':![],'depth':null}));this[_0x2a16('0x1d')](util[_0x2a16('0x29')](_0x2a16('0x4d'),_0x724915['membername']),_0x2a16('0x4e'),_0x5f551a);}else if(!this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x12')]&&!this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x15')]){logger[_0x2a16('0x38')](_0x2a16('0x4f'),_0x724915[_0x2a16('0x25')],this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]['membername'],_0x249b95);this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]['agentringnoanswer']=!![];this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x50')]=moment()[_0x2a16('0x29')](_0x2a16('0x2a'));this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x51')]=_0x724915[_0x2a16('0x22')];this['channels'][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x52')]=_0x724915[_0x2a16('0x21')];this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x40')]=_0x2a16('0x53');this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95][_0x2a16('0x54')]='answered_elsewhere';logger['debug'](_0x2a16('0x55'),_0x724915[_0x2a16('0x25')],util[_0x2a16('0x26')](this[_0x2a16('0xa')][_0x724915['uniqueid']][_0x249b95],{'showHidden':![],'depth':null}));ami[_0x2a16('0x1d')](_0x2a16('0x56'),this[_0x2a16('0xa')][_0x724915[_0x2a16('0x25')]][_0x249b95]);}}}}}}catch(_0x58158d){logger[_0x2a16('0x35')](_0x2a16('0x57'),_0x724915[_0x2a16('0x25')],util['inspect'](_0x58158d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x13')]=function(_0x33701d){try{if(this[_0x2a16('0x1f')](_0x33701d)){logger[_0x2a16('0x23')](_0x2a16('0x58'),_0x33701d[_0x2a16('0x25')],util['inspect'](_0x33701d,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0x33701d[_0x2a16('0x25')]]&&this[_0x2a16('0xa')][_0x33701d['uniqueid']][_0x33701d[_0x2a16('0x22')]]){logger[_0x2a16('0x38')](_0x2a16('0x59'),_0x33701d[_0x2a16('0x25')],_0x33701d['membername'],_0x33701d[_0x2a16('0x22')]);var _0x242478=this['agents'][_0x33701d[_0x2a16('0x28')]];var _0x3091fc=this[_0x2a16('0xa')][_0x33701d[_0x2a16('0x25')]][_0x33701d[_0x2a16('0x22')]];_0x3091fc[_0x2a16('0x12')]=!![];_0x3091fc[_0x2a16('0x50')]=moment()[_0x2a16('0x29')](_0x2a16('0x2a'));_0x3091fc[_0x2a16('0x40')]=_0x2a16('0x5a');_0x3091fc[_0x2a16('0x54')]=_0x2a16('0x5a');var _0x2e30e8={'id':_0x242478['id'],'name':_0x242478[_0x2a16('0x48')],'queue':_0x3091fc['queue'],'uniqueid':_0x3091fc[_0x2a16('0x25')]};logger[_0x2a16('0x23')](_0x2a16('0x5b'),_0x33701d[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x2e30e8,{'showHidden':![],'depth':null}));this[_0x2a16('0x1d')](util[_0x2a16('0x29')](_0x2a16('0x4d'),_0x242478[_0x2a16('0x48')]),'user:agentringnoanswer',_0x2e30e8);ami[_0x2a16('0x1d')](_0x2a16('0x5c'),_0x3091fc);}}}catch(_0x436718){logger[_0x2a16('0x35')](_0x2a16('0x5d'),_0x33701d['uniqueid'],util['inspect'](_0x436718,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a16('0x5e')]=function(_0x222542){try{if(this[_0x2a16('0x1f')](_0x222542)){logger[_0x2a16('0x23')](_0x2a16('0x5f'),_0x222542[_0x2a16('0x25')],util['inspect'](_0x222542,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]]){for(var _0x4ba0e4 in this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]]){if(this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]][_0x2a16('0x37')](_0x4ba0e4)&&!this['channels'][_0x222542[_0x2a16('0x25')]][_0x4ba0e4][_0x2a16('0x12')]&&!this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]][_0x4ba0e4]['agentcomplete']){logger[_0x2a16('0x38')](_0x2a16('0x60'),_0x222542[_0x2a16('0x25')],this['channels'][_0x222542[_0x2a16('0x25')]][_0x4ba0e4][_0x2a16('0x21')],_0x4ba0e4);this['channels'][_0x222542[_0x2a16('0x25')]][_0x4ba0e4]['agentringnoanswer']=!![];this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]][_0x4ba0e4]['agentringnoanswerAt']=moment()[_0x2a16('0x29')](_0x2a16('0x2a'));this[_0x2a16('0xa')][_0x222542[_0x2a16('0x25')]][_0x4ba0e4]['lastevent']='abandoned';this['channels'][_0x222542[_0x2a16('0x25')]][_0x4ba0e4][_0x2a16('0x54')]='abandoned';logger[_0x2a16('0x23')](_0x2a16('0x61'),_0x222542[_0x2a16('0x25')],util[_0x2a16('0x26')](this['channels'][_0x222542['uniqueid']][_0x4ba0e4],{'showHidden':![],'depth':null}));ami['emit'](_0x2a16('0x62'),this['channels'][_0x222542[_0x2a16('0x25')]][_0x4ba0e4]);}}}}}catch(_0x3728d6){logger[_0x2a16('0x35')](_0x2a16('0x63'),_0x222542[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x3728d6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a16('0x64')]=function(_0xe1a9){try{if(this['isNotNull'](_0xe1a9)){logger[_0x2a16('0x23')](_0x2a16('0x65'),_0xe1a9['uniqueid'],util[_0x2a16('0x26')](_0xe1a9,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0xe1a9['uniqueid']]){for(var _0x32b266 in this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]]){if(this[_0x2a16('0xa')][_0xe1a9['uniqueid']][_0x2a16('0x37')](_0x32b266)){if(this['channels'][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x3a')]&&!this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x15')]){logger['info'](_0x2a16('0x66'),_0xe1a9[_0x2a16('0x25')],this['channels'][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x21')],_0x32b266);this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]][_0x32b266]['agentcomplete']=!![];this[_0x2a16('0xa')][_0xe1a9['uniqueid']][_0x32b266][_0x2a16('0x67')]=moment()[_0x2a16('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]][_0x32b266]['lastevent']=_0x2a16('0x68');this[_0x2a16('0xa')][_0xe1a9['uniqueid']][_0x32b266]['reason']=_0xe1a9[_0x2a16('0x54')]=='transfer'?_0x2a16('0x69'):_0xe1a9[_0x2a16('0x54')];this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x6a')]=_0xe1a9[_0x2a16('0x6a')];if(this[_0x2a16('0xb')][_0xe1a9[_0x2a16('0x33')]]&&this['voiceQueues'][_0xe1a9[_0x2a16('0x33')]][_0x2a16('0x6b')]){this['channels'][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x6c')]=this[_0x2a16('0xb')][_0xe1a9[_0x2a16('0x33')]]['acwTimeout'];this[_0x2a16('0xa')][_0xe1a9[_0x2a16('0x25')]][_0x32b266][_0x2a16('0x6d')]=!![];}this[_0x2a16('0xc')][_0xe1a9[_0x2a16('0x28')]]=_[_0x2a16('0x2e')](this[_0x2a16('0xc')][_0xe1a9[_0x2a16('0x28')]],[_0x2a16('0x33'),_0x2a16('0x45')]);logger[_0x2a16('0x23')](_0x2a16('0x6e'),_0xe1a9['uniqueid'],util[_0x2a16('0x26')](this['channels'][_0xe1a9[_0x2a16('0x25')]][_0x32b266],{'showHidden':![],'depth':null}));ami[_0x2a16('0x1d')]('custom:agentcomplete',this['channels'][_0xe1a9[_0x2a16('0x25')]][_0x32b266]);logger[_0x2a16('0x23')](_0x2a16('0x6f'),_0xe1a9[_0x2a16('0x25')],util[_0x2a16('0x26')]({'id':this[_0x2a16('0xc')][_0xe1a9[_0x2a16('0x28')]]['id'],'destaccountcode':_0xe1a9['destaccountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x2a16('0x29')](_0x2a16('0x4d'),_0xe1a9['membername']),_0x2a16('0x70'),{'id':this[_0x2a16('0xc')][_0xe1a9[_0x2a16('0x28')]]['id'],'destaccountcode':Number(_0xe1a9[_0x2a16('0x71')])});}}}}}}catch(_0x614b51){logger[_0x2a16('0x35')](_0x2a16('0x72'),_0xe1a9['uniqueid'],util[_0x2a16('0x26')](_0x614b51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x16')]=function(_0xb768f0){try{if(this['isNotNull'](_0xb768f0)){logger[_0x2a16('0x23')]('[%s][voiceAgentReport][varset]\x20event:',_0xb768f0[_0x2a16('0x25')],util['inspect'](_0xb768f0,{'showHidden':![],'depth':null}));this[_0x2a16('0x73')](_0xb768f0[_0x2a16('0x25')],_['keys'](_0xb768f0[_0x2a16('0x74')])[0x0],_0xb768f0[_0x2a16('0x75')]);if(this['channels'][_0xb768f0[_0x2a16('0x25')]]){for(var _0x490b4e in this['channels'][_0xb768f0[_0x2a16('0x25')]]){if(this[_0x2a16('0xa')][_0xb768f0['uniqueid']][_0x2a16('0x37')](_0x490b4e)){logger[_0x2a16('0x38')](_0x2a16('0x76'),_0xb768f0[_0x2a16('0x25')],_0x490b4e,_[_0x2a16('0x77')](_0xb768f0[_0x2a16('0x74')])[0x0],_0xb768f0['value']);if(_[_0x2a16('0x27')](this[_0x2a16('0xa')][_0xb768f0[_0x2a16('0x25')]][_0x490b4e]['variables'])){this[_0x2a16('0xa')][_0xb768f0[_0x2a16('0x25')]][_0x490b4e][_0x2a16('0xd')]={};}this[_0x2a16('0xa')][_0xb768f0[_0x2a16('0x25')]][_0x490b4e][_0x2a16('0xd')]=this['variables'][_0xb768f0[_0x2a16('0x25')]];}}}}}catch(_0x5db809){logger['error'](_0x2a16('0x78'),_0xb768f0[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x5db809,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x383b35,_0x1e4ff5,_0x4bcc5d){var _0x30a1e5=['rtpaudioqos',_0x2a16('0x79'),'rtpaudioqosjitter',_0x2a16('0x7a'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x2a16('0x7b'),_0x2a16('0x7c'),'bridgepeer','bridgepvtcallid','membercalls','memberdynamic',_0x2a16('0x7d'),'memberlastcall',_0x2a16('0x21'),'memberpenalty',_0x2a16('0x7e')];if(!_[_0x2a16('0x7f')](_0x1e4ff5)&&!_['includes'](_0x30a1e5,_0x1e4ff5)){if(_['isUndefined'](this['variables'][_0x383b35])){this[_0x2a16('0xd')][_0x383b35]={};}this['variables'][_0x383b35][_0x1e4ff5]=_0x4bcc5d;}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x80')]=function(_0x4574be){try{if(this[_0x2a16('0x1f')](_0x4574be)){logger[_0x2a16('0x23')](_0x2a16('0x81'),_0x4574be['uniqueid'],util[_0x2a16('0x26')](_0x4574be,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0x4574be['uniqueid']]){for(var _0x1bf490 in this[_0x2a16('0xa')][_0x4574be['uniqueid']]){if(this[_0x2a16('0xa')][_0x4574be[_0x2a16('0x25')]][_0x2a16('0x37')](_0x1bf490)){if(this[_0x2a16('0xa')][_0x4574be[_0x2a16('0x25')]][_0x1bf490][_0x2a16('0x54')]==_0x2a16('0x82')&&this[_0x2a16('0xa')][_0x4574be['uniqueid']][_0x1bf490][_0x2a16('0x15')]){logger[_0x2a16('0x38')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4574be['uniqueid'],_0x1bf490);this['channels'][_0x4574be[_0x2a16('0x25')]][_0x1bf490]['agentcompleteAt']=moment()[_0x2a16('0x29')](_0x2a16('0x2a'));}}}logger[_0x2a16('0x23')](_0x2a16('0x83'),_0x4574be[_0x2a16('0x25')],util[_0x2a16('0x26')](_[_0x2a16('0x84')](this[_0x2a16('0xa')][_0x4574be['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x2a16('0x84')](this[_0x2a16('0xa')][_0x4574be[_0x2a16('0x25')]]));delete this[_0x2a16('0xa')][_0x4574be['uniqueid']];}if(this[_0x2a16('0xd')][_0x4574be[_0x2a16('0x25')]]){delete this[_0x2a16('0xd')][_0x4574be[_0x2a16('0x25')]];}}}catch(_0x5d20ab){logger['error']('[%s][voiceAgentReport][hangup]',_0x4574be[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x5d20ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x1a')]=function(_0x4683ed){try{if(this['isNotNull'](_0x4683ed)){logger[_0x2a16('0x23')](_0x2a16('0x85'),_0x4683ed['uniqueid'],util[_0x2a16('0x26')](_0x4683ed,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]]){for(var _0x1c17f7 in this[_0x2a16('0xa')][_0x4683ed['transfereeuniqueid']]){if(this[_0x2a16('0xa')][_0x4683ed['transfereeuniqueid']][_0x2a16('0x37')](_0x1c17f7)){if(_0x4683ed[_0x2a16('0x87')]===_0x1c17f7){logger[_0x2a16('0x38')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4683ed[_0x2a16('0x25')],this['channels'][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7][_0x2a16('0x21')],_0x1c17f7);var _0x52e994=moment();this['channels'][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7]['agentcomplete']=!![];this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7]['agentcompleteAt']=moment()[_0x2a16('0x29')](_0x2a16('0x2a'));this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7][_0x2a16('0x40')]=_0x2a16('0x68');this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7]['reason']='transfer';this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7][_0x2a16('0x6a')]=_0x52e994[_0x2a16('0x88')](this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]][_0x1c17f7][_0x2a16('0x3a')],'seconds');}}}}if(this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x89')]]){var _0x4c4f16=this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x89')]];this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x89')]]=this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]];this[_0x2a16('0xa')][_0x4683ed[_0x2a16('0x86')]]=_0x4c4f16;}}}catch(_0x52e78e){logger[_0x2a16('0x35')]('[%s][voiceAgentReport][attendedtransfer]',_0x4683ed[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x52e78e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a16('0x1c')]=function(_0x285742){try{if(this[_0x2a16('0x1f')](_0x285742)){logger[_0x2a16('0x23')](_0x2a16('0x8a'),_0x285742[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x285742,{'showHidden':![],'depth':null}));if(this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]]){for(var _0x3e9dfa in this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]]){if(this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x2a16('0x37')](_0x3e9dfa)){if(_0x285742['transfereruniqueid']===_0x3e9dfa){logger['info'](_0x2a16('0x8b'),_0x285742[_0x2a16('0x25')],this['channels'][_0x285742[_0x2a16('0x86')]][_0x3e9dfa][_0x2a16('0x21')],_0x3e9dfa);var _0x50010a=moment();this['channels'][_0x285742['transfereeuniqueid']][_0x3e9dfa][_0x2a16('0x15')]=!![];this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x3e9dfa][_0x2a16('0x67')]=_0x50010a;this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x3e9dfa]['lastevent']='complete';this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x3e9dfa][_0x2a16('0x54')]=_0x2a16('0x82');this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x3e9dfa]['talktime']=_0x50010a[_0x2a16('0x88')](this[_0x2a16('0xa')][_0x285742[_0x2a16('0x86')]][_0x3e9dfa][_0x2a16('0x3a')],_0x2a16('0x8c'));}}}}}}catch(_0x5c2a81){logger['error'](_0x2a16('0x8d'),_0x285742[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x5c2a81,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x8e')]=function(_0x18547c){var _0x54fb76='';try{if(this[_0x2a16('0x1f')](_0x18547c)){logger[_0x2a16('0x23')](_0x2a16('0x8f'),_0x18547c[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x18547c,{'showHidden':![],'depth':null}));if(_0x18547c[_0x2a16('0x46')]){_0x54fb76=_0x18547c[_0x2a16('0x46')][_0x2a16('0x90')](0x0,_0x18547c['channel'][_0x2a16('0x91')]('-'));if(this[_0x2a16('0xc')][_0x54fb76]){logger['info'](_0x2a16('0x92'),_0x18547c['uniqueid'],_0x54fb76);this[_0x2a16('0xc')][_0x54fb76][_0x2a16('0x93')]=!![];}}}}catch(_0x21a36b){logger[_0x2a16('0x35')](_0x2a16('0x94'),_0x18547c[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x21a36b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a16('0x1e')][_0x2a16('0x18')]=function(_0x1cbe20){var _0x2217de='';try{if(this[_0x2a16('0x1f')](_0x1cbe20)){logger[_0x2a16('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1cbe20[_0x2a16('0x25')],util[_0x2a16('0x26')](_0x1cbe20,{'showHidden':![],'depth':null}));if(_0x1cbe20[_0x2a16('0x46')]){_0x2217de=_0x1cbe20['channel'][_0x2a16('0x90')](0x0,_0x1cbe20[_0x2a16('0x46')][_0x2a16('0x91')]('-'));if(this['agents'][_0x2217de]){logger[_0x2a16('0x38')](_0x2a16('0x95'),_0x1cbe20[_0x2a16('0x25')],_0x2217de);this[_0x2a16('0xc')][_0x2217de][_0x2a16('0x93')]=![];}}}}catch(_0x45a31e){logger[_0x2a16('0x35')](_0x2a16('0x96'),_0x1cbe20[_0x2a16('0x25')],util['inspect'](_0x45a31e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 343f032..1960aa4 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 _0x5535=['xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%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','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','transferType','resolve','then','isEmpty','getSettings','Action','catch','StopMixMonitor','finally','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','defaults','socket.io-emitter','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','appdata','startsWith','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','includes','applicationdata','cdr(','match','type','queue','[%s][voiceCallReport][newstate]\x20event:','channelstate','answertime','seconds','connectedlinename','destinationchannel','UserId','membername','answered','holdtime','diff','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','monitorFilename','find','monitors','isNil','push','[%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','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s'];(function(_0x620b59,_0x6a3e2a){var _0x330edd=function(_0x3357cf){while(--_0x3357cf){_0x620b59['push'](_0x620b59['shift']());}};_0x330edd(++_0x6a3e2a);}(_0x5535,0x105));var _0x5553=function(_0x51a9b6,_0x1fdadc){_0x51a9b6=_0x51a9b6-0x0;var _0x5a0e49=_0x5535[_0x51a9b6];return _0x5a0e49;};'use strict';var _=require(_0x5553('0x0'));var moment=require('moment');var util=require(_0x5553('0x1'));var path=require(_0x5553('0x2'));var Redis=require(_0x5553('0x3'));var config=require(_0x5553('0x4'));var logger=require('../../../config/logger')(_0x5553('0x5'));var ami=require(_0x5553('0x6'));var Channel=require(_0x5553('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0x5553('0x8'),'queue',_0x5553('0x9'),_0x5553('0xa'),_0x5553('0xb'),_0x5553('0xc')];var dispositions=['NO\x20ANSWER',_0x5553('0xd'),'FAILED',_0x5553('0xe'),'NO\x20ANSWER',_0x5553('0xe'),'ANSWERED',_0x5553('0xf'),'FAILED','FAILED',_0x5553('0xd')];config['redis']=_[_0x5553('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5553('0x11'))(new Redis(config[_0x5553('0x12')]));function VoiceCallReport(_0x3d4ecd){this[_0x5553('0x13')]=_0x3d4ecd[_0x5553('0x13')];this[_0x5553('0x14')]=_0x3d4ecd[_0x5553('0x14')];this[_0x5553('0x15')]={};ami['on'](_0x5553('0x16'),this[_0x5553('0x17')][_0x5553('0x18')](this));ami['on']('newexten',this[_0x5553('0x17')]['bind'](this));ami['on'](_0x5553('0x19'),this['syncNewChannel'][_0x5553('0x18')](this));ami['on']('newstate',this[_0x5553('0x1a')][_0x5553('0x18')](this));ami['on'](_0x5553('0x1b'),this[_0x5553('0x1c')]['bind'](this));ami['on'](_0x5553('0x1d'),this[_0x5553('0x1e')][_0x5553('0x18')](this));ami['on']('newcallerid',this[_0x5553('0x1f')]['bind'](this));ami['on'](_0x5553('0x20'),this[_0x5553('0x21')]['bind'](this));ami['on']('blindtransfer',this[_0x5553('0x22')][_0x5553('0x18')](this));ami['on']('musiconholdstart',this[_0x5553('0x23')]['bind'](this));ami['on'](_0x5553('0x24'),this[_0x5553('0x25')]['bind'](this));try{logger[_0x5553('0x26')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x5553('0x27')]();}catch(_0x4f2ece){logger[_0x5553('0x28')]('[voiceCallReport][coreshowchannels]',util[_0x5553('0x29')](_0x4f2ece,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5553('0x2a')][_0x5553('0x2b')]=function(_0x121f89){return _0x121f89!==null&&!_[_0x5553('0x2c')](_0x121f89);};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x2d')]=function(_0x53d9a5,_0x4b6f4f,_0x26ef4e){io['to'](_0x53d9a5)[_0x5553('0x2d')](_0x4b6f4f,_0x26ef4e);};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x1f')]=function(_0x3fc305){try{if(this['isNotNull'](_0x3fc305)){logger[_0x5553('0x26')](_0x5553('0x2e'),_0x3fc305['uniqueid'],_0x3fc305[_0x5553('0x2f')],_0x3fc305[_0x5553('0x30')]);logger['debug'](_0x5553('0x31'),_0x3fc305[_0x5553('0x32')],util[_0x5553('0x29')](_0x3fc305,{'showHidden':![],'depth':null}));if(_0x3fc305['uniqueid']===_0x3fc305[_0x5553('0x33')]){if(!_[_0x5553('0x2c')](this[_0x5553('0x13')][_0x3fc305[_0x5553('0x32')]])){_[_0x5553('0x34')](this['channels'][_0x3fc305[_0x5553('0x32')]],_[_0x5553('0x35')](_0x3fc305,_[_0x5553('0x36')](this[_0x5553('0x13')][_0x3fc305[_0x5553('0x32')]])));}}if(_0x3fc305[_0x5553('0x37')]===_0x5553('0x38')){if(this[_0x5553('0x14')][_0x3fc305[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]]){if(_0x3fc305[_0x5553('0x3b')]==_0x5553('0x3c')){this[_0x5553('0x14')][_0x3fc305[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]][_0x5553('0x3d')]=_0x3fc305[_0x5553('0x3e')];this[_0x5553('0x2d')](util[_0x5553('0x3f')](_0x5553('0x40'),this['agents'][_0x3fc305[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]]['name']),_0x5553('0x41'),{'destaccountcode':this[_0x5553('0x14')][_0x3fc305['channel'][_0x5553('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3fc305[_0x5553('0x3e')]});}}}}}catch(_0x232a21){logger[_0x5553('0x28')](_0x5553('0x42'),_0x3fc305[_0x5553('0x32')],util[_0x5553('0x29')](_0x232a21,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5553('0x2a')]['syncNewChannel']=function(_0x431046){try{if(this[_0x5553('0x2b')](_0x431046)){logger[_0x5553('0x43')](_0x5553('0x44'),_0x431046[_0x5553('0x32')],util[_0x5553('0x29')](_0x431046,{'showHidden':![],'depth':null}));if(this['channels'][_0x431046[_0x5553('0x32')]]){return;}if(_0x431046[_0x5553('0x39')]==='OutgoingSpoolFailed'){return;}if(_0x431046['uniqueid']!==_0x431046[_0x5553('0x33')]&&!this[_0x5553('0x15')][_0x431046[_0x5553('0x33')]]){return;}logger[_0x5553('0x26')](_0x5553('0x45'),_0x431046[_0x5553('0x32')],_0x431046[_0x5553('0x37')],_0x431046[_0x5553('0x3b')]);this[_0x5553('0x13')][_0x431046[_0x5553('0x32')]]=new Channel();this[_0x5553('0x13')][_0x431046[_0x5553('0x32')]][_0x5553('0x46')]=moment()[_0x5553('0x3f')](_0x5553('0x47'));this['channels'][_0x431046[_0x5553('0x32')]][_0x5553('0x48')]=dispositions[_[_0x5553('0x49')](_0x431046['channelstate'])];_[_0x5553('0x34')](this[_0x5553('0x13')][_0x431046[_0x5553('0x32')]],_['pick'](_0x431046,_[_0x5553('0x36')](this[_0x5553('0x13')][_0x431046[_0x5553('0x32')]])));if(_0x431046[_0x5553('0x37')]==='from-sip'){var _0xf40a14=this['agents'][_0x431046[_0x5553('0x39')]['split']('-')[0x0]];if(_0xf40a14&&typeof _0xf40a14[_0x5553('0x3d')]===_0x5553('0x4a')){_0xf40a14[_0x5553('0x3d')]=_0x431046[_0x5553('0x3b')];logger[_0x5553('0x43')](_0x5553('0x4b'),_0x431046[_0x5553('0x32')],util[_0x5553('0x29')]({'id':_0xf40a14['id'],'destaccountcode':_0xf40a14[_0x5553('0x4c')],'destconnectedlinenum':_0x431046[_0x5553('0x3b')]},{'showHidden':![],'depth':null}));this[_0x5553('0x2d')](util[_0x5553('0x3f')](_0x5553('0x40'),_0xf40a14[_0x5553('0x4d')]),'user:agentconnect',{'id':_0xf40a14['id'],'destaccountcode':_0xf40a14[_0x5553('0x4c')],'destconnectedlinenum':_0x431046[_0x5553('0x3b')]});}}}}catch(_0xb7f63d){logger[_0x5553('0x28')](_0x5553('0x4e'),_0x431046['uniqueid'],util[_0x5553('0x29')](_0xb7f63d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x17')]=function(_0x4243e2){try{if(this[_0x5553('0x2b')](_0x4243e2)){logger[_0x5553('0x43')](_0x5553('0x4f'),_0x4243e2[_0x5553('0x32')],util[_0x5553('0x29')](_0x4243e2,{'showHidden':![],'depth':null}));if(_0x4243e2[_0x5553('0x39')]==='OutgoingSpoolFailed'||_0x4243e2[_0x5553('0x3b')]==='h')return;if(_0x4243e2['uniqueid']===_0x4243e2[_0x5553('0x33')]||this[_0x5553('0x15')][_0x4243e2[_0x5553('0x33')]]){_0x4243e2[_0x5553('0x50')]=_0x4243e2[_0x5553('0x50')]?_0x4243e2[_0x5553('0x50')]['toLowerCase']():undefined;_0x4243e2['applicationdata']=_0x4243e2[_0x5553('0x51')]||_0x4243e2['applicationdata'];if(_0x4243e2[_0x5553('0x51')]&&!_0x4243e2['appdata'][_0x5553('0x52')]('CDR(routeAlias)')&&_0x4243e2[_0x5553('0x50')]!=='queue'){_0x4243e2['applicationdata']=_0x4243e2['applicationdata'][_0x5553('0x53')]();}logger[_0x5553('0x26')](_0x5553('0x54'),_0x4243e2[_0x5553('0x32')],_0x4243e2[_0x5553('0x50')],_0x4243e2['applicationdata']);if(_[_0x5553('0x2c')](this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]])){this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]]=new Channel();this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]][_0x5553('0x46')]=_0x4243e2[_0x5553('0x55')]?moment()[_0x5553('0x56')](moment['duration'](_0x4243e2[_0x5553('0x55')])['seconds'](),'seconds')['format'](_0x5553('0x47')):moment()[_0x5553('0x3f')](_0x5553('0x47'));this['channels'][_0x4243e2['uniqueid']][_0x5553('0x48')]='NO\x20ANSWER';}_['merge'](this[_0x5553('0x13')][_0x4243e2['uniqueid']],_[_0x5553('0x35')](_0x4243e2,_[_0x5553('0x36')](this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]])));if(_[_0x5553('0x57')](applications,_0x4243e2['application'])){this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]]['lastapplication']=_0x4243e2[_0x5553('0x50')];this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]]['lastdata']=_0x4243e2[_0x5553('0x58')];if(_0x4243e2[_0x5553('0x50')]===_0x5553('0x8')&&_[_0x5553('0x52')](_0x4243e2['applicationdata']['toLowerCase'](),_0x5553('0x59'))){var _0x369097=_0x4243e2['applicationdata'][_0x5553('0x3a')]('=');var _0x2c35c4=_0x369097[0x0][_0x5553('0x53')]()[_0x5553('0x5a')](/cdr\((.*)\)/);if(_0x2c35c4){if(_0x2c35c4[0x1]===_0x5553('0x5b')&&!_['isNil'](this['channels'][_0x4243e2[_0x5553('0x32')]][_0x2c35c4[0x1]]))return;this[_0x5553('0x13')][_0x4243e2['uniqueid']][_0x2c35c4[0x1]]=_0x369097[0x1];}}else if(_0x4243e2[_0x5553('0x50')]==='queue'){this[_0x5553('0x13')][_0x4243e2[_0x5553('0x32')]][_0x5553('0x5c')]=_0x4243e2[_0x5553('0x58')]['split'](',')[0x0];}}}}}catch(_0x290260){logger[_0x5553('0x28')]('[%s][voiceCallReport][newexten]',_0x4243e2['uniqueid'],util[_0x5553('0x29')](_0x290260,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x12229f){try{if(this[_0x5553('0x2b')](_0x12229f)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x12229f[_0x5553('0x32')],_0x12229f['linkedid'],_0x12229f['calleridname'],_0x12229f[_0x5553('0x30')]);logger['debug'](_0x5553('0x5d'),_0x12229f[_0x5553('0x32')],util[_0x5553('0x29')](_0x12229f,{'showHidden':![],'depth':null}));if(_0x12229f[_0x5553('0x5e')]!=='6')return;var _0x2cd7ac=this['agents'][_0x12229f['channel'][_0x5553('0x3a')]('-')[0x0]];if(_0x12229f[_0x5553('0x32')]!==_0x12229f[_0x5553('0x33')]){var _0x146fc2=moment();if(this[_0x5553('0x13')][_0x12229f['linkedid']]){if(!this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]]['answered']){this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]]['answered']=!![];this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]][_0x5553('0x5f')]=_0x146fc2['format'](_0x5553('0x47'));if(this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]][_0x5553('0x46')]){this['channels'][_0x12229f[_0x5553('0x33')]]['holdtime']=_0x146fc2['diff'](this['channels'][_0x12229f['linkedid']]['starttime'],_0x5553('0x60'));}}this['channels'][_0x12229f[_0x5553('0x33')]][_0x5553('0x33')]=_0x12229f[_0x5553('0x32')];if(_0x12229f['calleridnum']!==_0x5553('0x3c')){this[_0x5553('0x13')][_0x12229f['linkedid']][_0x5553('0x3e')]=_0x12229f[_0x5553('0x30')];}this[_0x5553('0x13')][_0x12229f['linkedid']][_0x5553('0x61')]=_0x12229f['calleridname'];this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]][_0x5553('0x62')]=_0x12229f['channel'];this[_0x5553('0x13')][_0x12229f['linkedid']][_0x5553('0x48')]=dispositions[_[_0x5553('0x49')](_0x12229f[_0x5553('0x5e')])];if(_0x2cd7ac){this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]][_0x5553('0x63')]=_0x2cd7ac['id'];this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]][_0x5553('0x64')]=_0x2cd7ac['name'];}}if(this['channels'][_0x12229f[_0x5553('0x32')]]){if(!this['channels'][_0x12229f['uniqueid']][_0x5553('0x65')]){this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]][_0x5553('0x65')]=!![];this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]]['answertime']=_0x146fc2[_0x5553('0x3f')](_0x5553('0x47'));if(this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]]['starttime']){this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]][_0x5553('0x66')]=_0x146fc2[_0x5553('0x67')](this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]][_0x5553('0x46')],_0x5553('0x60'));}}if(_0x12229f[_0x5553('0x30')]!==_0x5553('0x3c')){this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]][_0x5553('0x3e')]=_0x12229f[_0x5553('0x30')];}this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]]['connectedlinename']=_0x12229f[_0x5553('0x2f')];this['channels'][_0x12229f[_0x5553('0x32')]]['destinationchannel']=_0x12229f[_0x5553('0x39')];this['channels'][_0x12229f[_0x5553('0x32')]][_0x5553('0x48')]=dispositions[_[_0x5553('0x49')](_0x12229f[_0x5553('0x5e')])];}}else{if(this[_0x5553('0x13')][_0x12229f[_0x5553('0x32')]]){if(_0x2cd7ac){this['channels'][_0x12229f[_0x5553('0x32')]][_0x5553('0x63')]=_0x2cd7ac['id'];this['channels'][_0x12229f[_0x5553('0x32')]][_0x5553('0x64')]=_0x2cd7ac['name'];}}}if(_0x12229f[_0x5553('0x37')]===_0x5553('0x38')){if(_0x2cd7ac){_0x2cd7ac[_0x5553('0x3d')]=_0x12229f['exten'];var _0x1acddc,_0x2c8b2f;if(this['channels'][_0x12229f[_0x5553('0x32')]]){_0x1acddc=this[_0x5553('0x13')][_0x12229f['uniqueid']][_0x5553('0x68')];_0x2c8b2f=this['channels'][_0x12229f[_0x5553('0x32')]][_0x5553('0x5c')];}else if(this[_0x5553('0x13')][_0x12229f[_0x5553('0x33')]]){_0x1acddc=this['channels'][_0x12229f[_0x5553('0x33')]][_0x5553('0x68')];_0x2c8b2f=this['channels'][_0x12229f[_0x5553('0x33')]][_0x5553('0x5c')];}_0x2cd7ac[_0x5553('0x5c')]=_0x2c8b2f;_0x2cd7ac[_0x5553('0x68')]=_0x1acddc;var _0x573562={'id':_0x2cd7ac['id'],'name':_0x2cd7ac[_0x5553('0x4d')],'agentconnected':!![],'destaccountcode':_0x2cd7ac[_0x5553('0x4c')],'destconnectedlinenum':_0x12229f[_0x5553('0x3b')],'queue':_0x2c8b2f||undefined,'routealias':_0x1acddc,'uniqueid':_0x12229f[_0x5553('0x33')]};logger[_0x5553('0x43')](_0x5553('0x69'),_0x12229f[_0x5553('0x32')],util[_0x5553('0x29')](_0x573562,{'showHidden':![],'depth':null}));this[_0x5553('0x2d')](util[_0x5553('0x3f')](_0x5553('0x40'),_0x2cd7ac[_0x5553('0x4d')]),_0x5553('0x41'),_0x573562);}}}}catch(_0x556ddf){logger[_0x5553('0x28')](_0x5553('0x6a'),_0x12229f[_0x5553('0x32')],util[_0x5553('0x29')](_0x556ddf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x6b')]=function(_0x357b4b,_0x72df57){try{if(this[_0x5553('0x13')][_0x357b4b]){logger[_0x5553('0x26')](_0x5553('0x6c'),_0x357b4b,_0x72df57);this[_0x5553('0x13')][_0x357b4b][_0x5553('0x6d')]=!![];if(_[_0x5553('0x6e')](_0x72df57,'.wav49')){_0x72df57=_0x72df57[_0x5553('0x6f')](_0x5553('0x70'),'.WAV');}this[_0x5553('0x13')][_0x357b4b][_0x5553('0x71')]=_0x72df57;var _0x26bf30=_[_0x5553('0x72')](this['channels'][_0x357b4b][_0x5553('0x73')],{'filename':_0x72df57});if(_[_0x5553('0x74')](_0x26bf30)){this[_0x5553('0x13')][_0x357b4b]['monitors'][_0x5553('0x75')]({'filename':_0x72df57,'createdAt':moment()[_0x5553('0x3f')](_0x5553('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0x5ad37c){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x357b4b,util[_0x5553('0x29')](_0x5ad37c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x1c')]=function(_0x594061){try{if(this['isNotNull'](_0x594061)){logger[_0x5553('0x43')](_0x5553('0x76'),_0x594061['uniqueid'],util['inspect'](_0x594061,{'showHidden':![],'depth':null}));if(this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]]&&_0x594061[_0x5553('0x39')]!='OutgoingSpoolFailed'){if(this[_0x5553('0x2b')](_0x594061['variable'])){if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x78')])){logger[_0x5553('0x26')](_0x5553('0x79'),_0x594061['uniqueid'],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x6b')](_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')]);}else if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x7b')])){logger[_0x5553('0x26')](_0x5553('0x7c'),_0x594061['uniqueid'],_0x594061[_0x5553('0x7a')]);this['channels'][_0x594061['uniqueid']][_0x5553('0x30')]=_0x594061[_0x5553('0x7a')];}else if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x7d')])){logger[_0x5553('0x26')](_0x5553('0x7e'),_0x594061[_0x5553('0x32')],_0x594061['value']);this[_0x5553('0x13')][_0x594061['uniqueid']][_0x5553('0x7f')]=_0x594061[_0x5553('0x7a')];}else if(this['isNotNull'](_0x594061[_0x5553('0x77')]['xmd-cdrtype'])){logger['info'](_0x5553('0x80'),_0x594061['uniqueid'],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]][_0x5553('0x5b')]=_0x594061['value'];}else if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x81')])){logger[_0x5553('0x26')](_0x5553('0x82'),_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')][_0x5553('0x3a')](',')[0x0]);this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]][_0x5553('0x5c')]=_0x594061[_0x5553('0x7a')][_0x5553('0x3a')](',')[0x0];}else if(this['isNotNull'](_0x594061[_0x5553('0x77')][_0x5553('0x83')])){logger['info'](_0x5553('0x84'),_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061['uniqueid']]['originatecalleridnum']=_0x594061['value'];}else if(this['isNotNull'](_0x594061['variable']['xmd-destination'])){logger[_0x5553('0x26')](_0x5553('0x85'),_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]]['destination']=_0x594061[_0x5553('0x7a')];}else if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')]['xmd-callerid-preview'])){logger[_0x5553('0x26')](_0x5553('0x86'),_0x594061['uniqueid'],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]][_0x5553('0x87')]=_0x594061['value'];}else if(this[_0x5553('0x2b')](_0x594061['variable'][_0x5553('0x88')])){logger[_0x5553('0x26')](_0x5553('0x89'),_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061[_0x5553('0x32')]][_0x5553('0x5c')]=_0x594061['value'];}else if(this['isNotNull'](_0x594061[_0x5553('0x77')][_0x5553('0x8a')])){logger[_0x5553('0x26')](_0x5553('0x8b'),_0x594061[_0x5553('0x32')],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061['uniqueid']][_0x5553('0x8c')]=_0x594061[_0x5553('0x7a')];}}}else if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x78')])){if(_0x594061[_0x5553('0x7a')]){var _0x33c5c1=path[_0x5553('0x8d')](_0x594061[_0x5553('0x7a')])[_0x5553('0x4d')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x33c5c1,_0x594061[_0x5553('0x7a')]);this[_0x5553('0x6b')](_0x33c5c1,_0x594061[_0x5553('0x7a')]);}}else if(this[_0x5553('0x13')][_0x594061['linkedid']]){if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')])){if(this[_0x5553('0x2b')](_0x594061[_0x5553('0x77')][_0x5553('0x8a')])){logger[_0x5553('0x26')](_0x5553('0x8b'),_0x594061['linkedid'],_0x594061[_0x5553('0x7a')]);this[_0x5553('0x13')][_0x594061[_0x5553('0x33')]]['sipcalllinkedid']=_0x594061[_0x5553('0x7a')];}}}}}catch(_0x3490af){logger[_0x5553('0x28')]('[%s][voiceCallReport][varset]',_0x594061['uniqueid'],util[_0x5553('0x29')](_0x3490af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5553('0x2a')][_0x5553('0x1e')]=function(_0x58514e){try{if(this[_0x5553('0x2b')](_0x58514e)){logger[_0x5553('0x43')](_0x5553('0x8e'),_0x58514e[_0x5553('0x32')],util['inspect'](_0x58514e,{'showHidden':![],'depth':null}));if(this[_0x5553('0x15')][_0x58514e['linkedid']]){if(this[_0x5553('0x13')][this['blindTransfers'][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]]){this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]]['uniqueid']=_0x58514e[_0x5553('0x32')];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]][_0x5553('0x65')]=this[_0x5553('0x13')][_0x58514e['uniqueid']]['answered'];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]]['linkedid']][_0x5553('0x5f')]=this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x5f')];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]][_0x5553('0x62')]=this['channels'][this['blindTransfers'][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]][_0x5553('0x39')];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]][_0x5553('0x48')]=this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x48')];this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]]=this[_0x5553('0x13')][this['blindTransfers'][_0x58514e[_0x5553('0x33')]]['linkedid']];delete this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x33')]];}else if(this[_0x5553('0x13')][this['blindTransfers'][_0x58514e[_0x5553('0x33')]]['uniqueid']]){this[_0x5553('0x13')][this['blindTransfers'][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]][_0x5553('0x32')]=[this[_0x5553('0x13')][this['blindTransfers'][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]][_0x5553('0x33')],this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e['linkedid']][_0x5553('0x32')]][_0x5553('0x33')]=this['channels'][this[_0x5553('0x15')][_0x58514e['linkedid']]['uniqueid']]['uniqueid']][0x0];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]]['uniqueid']][_0x5553('0x65')]=this['channels'][_0x58514e[_0x5553('0x32')]]['answered'];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]][_0x5553('0x5f')]=this['channels'][_0x58514e[_0x5553('0x32')]][_0x5553('0x5f')];this['channels'][this['blindTransfers'][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]][_0x5553('0x62')]=this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]]['uniqueid']][_0x5553('0x39')];this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]][_0x5553('0x48')]=this[_0x5553('0x13')][_0x58514e['uniqueid']]['disposition'];this['channels'][_0x58514e[_0x5553('0x32')]]=this[_0x5553('0x13')][this[_0x5553('0x15')][_0x58514e['linkedid']][_0x5553('0x32')]];delete this['channels'][this[_0x5553('0x15')][_0x58514e[_0x5553('0x33')]][_0x5553('0x32')]];}}if(this['channels'][_0x58514e[_0x5553('0x32')]]){logger['info'](_0x5553('0x8f'),_0x58514e[_0x5553('0x32')],_0x58514e[_0x5553('0x90')]);var _0x3b8129=moment();this['channels'][_0x58514e[_0x5553('0x32')]][_0x5553('0x91')]=_0x3b8129[_0x5553('0x3f')](_0x5553('0x47'));this['channels'][_0x58514e[_0x5553('0x32')]]['duration']=_0x3b8129[_0x5553('0x67')](this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x46')],_0x5553('0x60'));if(this[_0x5553('0x13')][_0x58514e['uniqueid']][_0x5553('0x65')]){this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]]['billableseconds']=_0x3b8129['diff'](this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x5f')],_0x5553('0x60'));this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]]['holdtime']=this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x55')]-this[_0x5553('0x13')][_0x58514e[_0x5553('0x32')]][_0x5553('0x92')];}if(_0x58514e[_0x5553('0x37')]==='from-sip'){if(this[_0x5553('0x14')][_0x58514e[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]]){this['agents'][_0x58514e[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]]=_[_0x5553('0x93')](this[_0x5553('0x14')][_0x58514e['channel'][_0x5553('0x3a')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x5553('0x94'),_0x58514e[_0x5553('0x32')],util[_0x5553('0x29')]({'id':this['agents'][_0x58514e['channel'][_0x5553('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x5553('0x14')][_0x58514e['channel']['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x5553('0x2d')](util['format'](_0x5553('0x40'),this[_0x5553('0x14')][_0x58514e[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]][_0x5553('0x4d')]),'user:agentcomplete',{'id':this[_0x5553('0x14')][_0x58514e['channel'][_0x5553('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x5553('0x14')][_0x58514e[_0x5553('0x39')][_0x5553('0x3a')]('-')[0x0]]['accountcode']});for(var _0x18ec6a=0x0;_0x18ec6a0x0?!![]:![];if(!_0x535a46){return this[_0x7c07('0x18')](this[_0x7c07('0x14')][_0x7c07('0x6b')]);}};VoiceQueueReport[_0x7c07('0xb')]['syncQueueMember']=function(_0xc7a35f){var _0x319f8a=this[_0x7c07('0x14')]['id'];if(this[_0x7c07('0x14')][_0x7c07('0x5d')][_0x319f8a]&&this[_0x7c07('0x14')][_0x7c07('0x5d')][_0x319f8a][_0xc7a35f[_0x7c07('0x5b')]]){this[_0x7c07('0x14')][_0x7c07('0x5d')][_0x319f8a][_0xc7a35f[_0x7c07('0x5b')]][_0x7c07('0x10')]['push'](_0xc7a35f);}};VoiceQueueReport['prototype'][_0x7c07('0x17')]=function(_0x2faed1){var _0x4eec2f=this;try{if(this['isNotNull'](_0x2faed1)&&this['isNotNull'](_0x2faed1[_0x7c07('0x4e')])){logger[_0x7c07('0x47')](_0x7c07('0x6c'),util[_0x7c07('0x41')](_0x2faed1,{'showHidden':![],'depth':null}));var _0x478b0b=this[_0x7c07('0x12')][_0x2faed1[_0x7c07('0x4e')]];if(_0x478b0b){logger[_0x7c07('0x6d')](_0x7c07('0x6e'),_0x478b0b[_0x7c07('0x61')]);this[_0x7c07('0x14')][_0x7c07('0x60')][_0x478b0b[_0x7c07('0x61')]]={'summaryEvent':_0x2faed1};this[_0x7c07('0x14')][_0x7c07('0x6a')]+=0x1;return ami[_0x7c07('0x3b')]({'action':_0x7c07('0x5d'),'queue':_0x478b0b[_0x7c07('0x61')]})['then'](function(_0x5b2ab2){if(!_0x4eec2f['summary']['queuestatus'][_0x2faed1[_0x7c07('0x5b')]]){_0x4eec2f['summary'][_0x7c07('0x5d')][_0x2faed1['actionid']]={};}_0x4eec2f[_0x7c07('0x14')][_0x7c07('0x5d')][_0x2faed1[_0x7c07('0x5b')]][_0x5b2ab2[_0x7c07('0x5b')]]={'queue':_0x478b0b[_0x7c07('0x61')],'agents':[]};})['catch'](function(_0x544588){throw _0x544588;});}}}catch(_0x43a507){logger['error']('[voiceQueueReport][queuesummary]',util[_0x7c07('0x41')](_0x43a507,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')][_0x7c07('0x18')]=function(_0x27837f){if(this[_0x7c07('0x14')][_0x7c07('0x6a')]>0x0){this[_0x7c07('0x14')][_0x7c07('0x6b')]=_0x27837f;return;}logger['debug'](_0x7c07('0x6f'),util['inspect'](_0x27837f,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x7c07('0x4b')](_0x7c07('0x70'),{});};VoiceQueueReport['prototype'][_0x7c07('0x1e')]=function(_0x38fccc){try{if(this['isNotNull'](_0x38fccc)){logger[_0x7c07('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x38fccc[_0x7c07('0x4a')],util['inspect'](_0x38fccc,{'showHidden':![],'depth':null}));if(_[_0x7c07('0x71')](this[_0x7c07('0xe')][_0x38fccc[_0x7c07('0x4a')]])){this[_0x7c07('0xe')][_0x38fccc['uniqueid']]=[];}if(_[_0x7c07('0x71')](this['channels'][_0x38fccc['uniqueid']])){this[_0x7c07('0x38')][_0x38fccc[_0x7c07('0x4a')]]={};}var _0x23cf40=new QueueReport();_0x23cf40[_0x7c07('0x4e')]=_0x38fccc[_0x7c07('0x4e')];_0x23cf40[_0x7c07('0x68')]=this[_0x7c07('0x12')][_0x23cf40[_0x7c07('0x4e')]]&&this[_0x7c07('0x12')][_0x23cf40[_0x7c07('0x4e')]][_0x7c07('0x68')]?this[_0x7c07('0x12')][_0x23cf40[_0x7c07('0x4e')]]['type']||_0x7c07('0x56'):'inbound';_0x23cf40['queuecallerjoinAt']=moment()['format'](_0x7c07('0x72'));_0x23cf40[_0x7c07('0x73')]=_0x38fccc[_0x7c07('0x73')];_0x23cf40['count']=_0x38fccc[_0x7c07('0x74')];_0x23cf40['uniqueid']=_0x38fccc[_0x7c07('0x4a')];_0x23cf40[_0x7c07('0x75')]=this[_0x7c07('0x38')][_0x38fccc[_0x7c07('0x4a')]][_0x7c07('0x75')];logger['info'](_0x7c07('0x76'),_0x23cf40[_0x7c07('0x4e')],_0x23cf40[_0x7c07('0x68')]);_['merge'](_0x23cf40,_[_0x7c07('0x77')](_0x38fccc,_[_0x7c07('0x78')](_0x23cf40)));this[_0x7c07('0xe')][_0x38fccc[_0x7c07('0x4a')]][_0x7c07('0x79')](_0x23cf40);this[_0x7c07('0x38')][_0x38fccc[_0x7c07('0x4a')]]=_0x23cf40;this[_0x7c07('0x46')](_0x23cf40,_0x7c07('0x1d'));}}catch(_0x2a09b3){logger[_0x7c07('0x3f')](_0x7c07('0x7a'),_0x38fccc[_0x7c07('0x4a')],util['inspect'](_0x2a09b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')]['syncQueueCallerAbandon']=function(_0x5e2002){try{if(this[_0x7c07('0x7b')](_0x5e2002)){logger['debug'](_0x7c07('0x7c'),_0x5e2002[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x5e2002,{'showHidden':![],'depth':null}));if(this[_0x7c07('0xe')][_0x5e2002[_0x7c07('0x4a')]]){var _0x49f7f9=_[_0x7c07('0x7d')](this[_0x7c07('0xe')][_0x5e2002['uniqueid']]);_0x49f7f9[_0x7c07('0x7e')]=![];_0x49f7f9[_0x7c07('0x7f')]=null;_0x49f7f9[_0x7c07('0x80')]=_0x5e2002[_0x7c07('0x80')];_0x49f7f9[_0x7c07('0x81')]=_0x5e2002[_0x7c07('0x81')];_0x49f7f9[_0x7c07('0x82')]=!![];_0x49f7f9[_0x7c07('0x83')]=moment()[_0x7c07('0x4c')](_0x7c07('0x72'));_0x49f7f9[_0x7c07('0x53')]=_0x7c07('0x84');_0x49f7f9[_0x7c07('0x85')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x49f7f9[_0x7c07('0x4e')],_0x49f7f9[_0x7c07('0x68')]);this['channels'][_0x5e2002[_0x7c07('0x4a')]]=_0x49f7f9;this[_0x7c07('0x51')](_0x49f7f9,'queuecallerabandon');}}}catch(_0x4b69db){logger[_0x7c07('0x3f')](_0x7c07('0x7c'),_0x5e2002[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x4b69db,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')][_0x7c07('0x21')]=function(_0x3e558b){try{if(this['isNotNull'](_0x3e558b)){logger[_0x7c07('0x47')](_0x7c07('0x86'),_0x3e558b[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x3e558b,{'showHidden':![],'depth':null}));if(this[_0x7c07('0xe')][_0x3e558b['uniqueid']]){var _0x1023ff=_[_0x7c07('0x7d')](this[_0x7c07('0xe')][_0x3e558b['uniqueid']]);_0x1023ff[_0x7c07('0x87')]=moment()[_0x7c07('0x4c')](_0x7c07('0x72'));_0x1023ff['connectedlinenum']=_0x3e558b[_0x7c07('0x88')];_0x1023ff[_0x7c07('0x89')]=_0x3e558b['connectedlinename'];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1023ff[_0x7c07('0x4e')],_0x1023ff[_0x7c07('0x68')],_0x3e558b[_0x7c07('0x88')],_0x3e558b['connectedlinename']);this[_0x7c07('0x38')][_0x3e558b[_0x7c07('0x4a')]]=_0x1023ff;this[_0x7c07('0x46')](_0x1023ff,_0x7c07('0x20'));}}}catch(_0x11757b){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x3e558b[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x11757b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')][_0x7c07('0x25')]=function(_0x884d8e){try{if(this[_0x7c07('0x7b')](_0x884d8e)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x884d8e['uniqueid'],util['inspect'](_0x884d8e,{'showHidden':![],'depth':null}));if(this[_0x7c07('0xe')][_0x884d8e[_0x7c07('0x4a')]]){var _0x5c4512=_[_0x7c07('0x7d')](this[_0x7c07('0xe')][_0x884d8e['uniqueid']]);_0x5c4512[_0x7c07('0x7e')]=!![];_0x5c4512[_0x7c07('0x53')]=_0x7c07('0x8a');logger[_0x7c07('0x6d')](_0x7c07('0x8b'),_0x5c4512[_0x7c07('0x4e')],_0x5c4512[_0x7c07('0x68')]);}}}catch(_0x353c50){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x884d8e['uniqueid'],util[_0x7c07('0x41')](_0x353c50,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')]['syncAgentComplete']=function(_0x58acf9){try{if(this['isNotNull'](_0x58acf9)){logger[_0x7c07('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x58acf9[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x58acf9,{'showHidden':![],'depth':null}));if(this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x4a')]]){var _0x1995d8=_[_0x7c07('0x7d')](this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x4a')]]);_0x1995d8[_0x7c07('0x82')]=![];_0x1995d8[_0x7c07('0x83')]=null;_0x1995d8['assigned']=!![];_0x1995d8['lastAssignedTo']=_0x58acf9[_0x7c07('0x8c')];_0x1995d8[_0x7c07('0x80')]=_0x58acf9[_0x7c07('0x80')];_0x1995d8[_0x7c07('0x7e')]=!![];_0x1995d8[_0x7c07('0x8d')]=![];_0x1995d8[_0x7c07('0x8e')]=null;if(!_0x1995d8[_0x7c07('0x8f')]){if(_0x58acf9[_0x7c07('0x90')]==_0x7c07('0x8f')){_0x1995d8['queuecallerexitreason']=_0x7c07('0x91');logger[_0x7c07('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1995d8['queue'],_0x1995d8[_0x7c07('0x68')]);}else{if(_[_0x7c07('0x92')](_0x58acf9[_0x7c07('0x3d')][_0x7c07('0x93')](),'local/')){if(this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x94')]]){var _0x8722ff=_[_0x7c07('0x7d')](this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x94')]]);_0x8722ff[_0x7c07('0x7e')]=![];_0x8722ff[_0x7c07('0x8d')]=!![];_0x8722ff[_0x7c07('0x8e')]=moment(_0x1995d8[_0x7c07('0x95')])['add'](_0x58acf9[_0x7c07('0x80')],_0x7c07('0x96'))[_0x7c07('0x4c')](_0x7c07('0x72'));_0x8722ff[_0x7c07('0x53')]=_0x7c07('0x97');_0x8722ff[_0x7c07('0x8f')]=!![];_0x8722ff[_0x7c07('0x98')]=_0x7c07('0x99');_0x8722ff[_0x7c07('0x9a')]=_0x58acf9[_0x7c07('0x9b')];_0x8722ff[_0x7c07('0x9c')]=_0x58acf9['uniqueid'];logger[_0x7c07('0x6d')](_0x7c07('0x9d'),_0x8722ff['queue'],_0x8722ff[_0x7c07('0x68')]);var _0x21e0ae=this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x94')]];this['queueReports'][_0x58acf9[_0x7c07('0x94')]]=this['queueReports'][_0x58acf9[_0x7c07('0x4a')]];this[_0x7c07('0xe')][_0x58acf9[_0x7c07('0x4a')]]=_0x21e0ae;}}else{_0x1995d8['queuecallerexitreason']=_0x7c07('0x9e')+_0x58acf9['reason'][_0x7c07('0x9f')]();logger[_0x7c07('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1995d8[_0x7c07('0x4e')],_0x1995d8['type'],_0x1995d8[_0x7c07('0x53')]);}}}this[_0x7c07('0x38')][_0x58acf9[_0x7c07('0x4a')]]=_0x1995d8;this['emitVoiceQueueChannelRemove'](_0x1995d8,'agentcomplete');}}}catch(_0x319883){logger[_0x7c07('0x3f')](_0x7c07('0xa0'),_0x58acf9['uniqueid'],util['inspect'](_0x319883,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')][_0x7c07('0x27')]=function(_0x14dcca){try{if(this[_0x7c07('0x7b')](_0x14dcca)){logger[_0x7c07('0x47')](_0x7c07('0xa1'),_0x14dcca[_0x7c07('0x4a')],util[_0x7c07('0x41')](_0x14dcca,{'showHidden':![],'depth':null}));this['addVariable'](_0x14dcca[_0x7c07('0x4a')],_[_0x7c07('0x78')](_0x14dcca[_0x7c07('0xa2')])[0x0],_0x14dcca[_0x7c07('0xa3')]);if(this['queueReports'][_0x14dcca[_0x7c07('0x4a')]]){var _0x3002a2=_[_0x7c07('0x7d')](this['queueReports'][_0x14dcca['uniqueid']]);if(_0x3002a2){if(this[_0x7c07('0x7b')](_0x14dcca[_0x7c07('0xa2')])&&this[_0x7c07('0x7b')](_0x14dcca[_0x7c07('0xa2')][_0x7c07('0x5d')])){switch(_0x14dcca[_0x7c07('0xa3')]){case _0x7c07('0xa4'):_0x3002a2[_0x7c07('0x8d')]=![];_0x3002a2[_0x7c07('0x8e')]=null;break;case _0x7c07('0xa5'):_0x3002a2[_0x7c07('0xa6')]=_0x7c07('0xa7');_0x3002a2[_0x7c07('0x8d')]=!![];_0x3002a2['queuecallerexitAt']=moment()[_0x7c07('0x4c')](_0x7c07('0x72'));_0x3002a2[_0x7c07('0x87')]=moment()['format'](_0x7c07('0x72'));logger[_0x7c07('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x14dcca['uniqueid'],util['inspect'](_0x3002a2,{'showHidden':![],'depth':null}));ami[_0x7c07('0x4b')](_0x7c07('0xa8'),_0x3002a2);break;default:_0x3002a2[_0x7c07('0x8d')]=!![];_0x3002a2[_0x7c07('0x8e')]=moment()[_0x7c07('0x4c')](_0x7c07('0x72'));_0x3002a2['queuecallerleaveAt']=moment()[_0x7c07('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3002a2[_0x7c07('0x82')]=![];_0x3002a2[_0x7c07('0x83')]=null;_0x3002a2[_0x7c07('0x53')]=_0x14dcca[_0x7c07('0xa3')];this['channels'][_0x14dcca[_0x7c07('0x4a')]]=_0x3002a2;this['emitVoiceQueueChannelRemove'](_0x3002a2,'varset');}else if(this[_0x7c07('0x7b')](_0x14dcca[_0x7c07('0xa2')])&&this[_0x7c07('0x7b')](_0x14dcca[_0x7c07('0xa2')][_0x7c07('0xa9')])){if(!_0x3002a2[_0x7c07('0x82')]){_0x3002a2[_0x7c07('0x8d')]=!![];_0x3002a2[_0x7c07('0x8e')]=moment()['format'](_0x7c07('0x72'));_0x3002a2[_0x7c07('0x53')]=_0x7c07('0xaa');_0x3002a2[_0x7c07('0x87')]=moment()[_0x7c07('0x4c')](_0x7c07('0x72'));this['channels'][_0x14dcca[_0x7c07('0x4a')]]=_0x3002a2;}}logger['info'](_0x7c07('0xab'),_0x14dcca[_0x7c07('0x4a')],_0x3002a2[_0x7c07('0x4e')],_0x3002a2[_0x7c07('0x68')],_['keys'](_0x14dcca[_0x7c07('0xa2')])[0x0],_0x14dcca['value']);_0x3002a2[_0x7c07('0x15')]=this[_0x7c07('0x15')][_0x14dcca[_0x7c07('0x4a')]];}}}}catch(_0x5edd47){logger[_0x7c07('0x3f')](_0x7c07('0xa1'),_0x14dcca[_0x7c07('0x4a')],util['inspect'](_0x5edd47,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c07('0xb')]['addVariable']=function(_0x5a6aa1,_0x52c980,_0x242721){var _0x5f3358=[_0x7c07('0xac'),_0x7c07('0xad'),_0x7c07('0xae'),_0x7c07('0xaf'),'rtpaudioqosloss',_0x7c07('0xb0'),_0x7c07('0xb1'),_0x7c07('0xb2'),'sipcallid',_0x7c07('0xb3'),'bridgepeer',_0x7c07('0xb4'),_0x7c07('0xb5'),_0x7c07('0xb6'),_0x7c07('0xb7'),_0x7c07('0xb8'),_0x7c07('0x8c'),'memberpenalty',_0x7c07('0xb9')];if(!_[_0x7c07('0xba')](_0x52c980)&&!_[_0x7c07('0xbb')](_0x5f3358,_0x52c980)){if(_[_0x7c07('0x71')](this[_0x7c07('0x15')][_0x5a6aa1])){this['variables'][_0x5a6aa1]={};}this[_0x7c07('0x15')][_0x5a6aa1][_0x52c980]=_0x242721;}};VoiceQueueReport[_0x7c07('0xb')][_0x7c07('0xbc')]=function(_0x1fa0cc,_0x42631c,_0x249814){var _0x563f3f={};for(var _0x16ae38=0x0;_0x16ae380x0?!![]:![];if(!_0xe378ee){return this[_0x59ee('0x18')](this[_0x59ee('0x48')]['completeEvent']);}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x1a')]=function(_0x57d0b7){var _0x2cb937=this['summary']['id'];if(this[_0x59ee('0x48')][_0x59ee('0x67')][_0x2cb937]&&this[_0x59ee('0x48')][_0x59ee('0x67')][_0x2cb937][_0x57d0b7['actionid']]){this['summary']['queuestatus'][_0x2cb937][_0x57d0b7[_0x59ee('0x5e')]][_0x59ee('0x11')][_0x59ee('0x6b')](_0x57d0b7);}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x17')]=function(_0x17359b){var _0x373dc1=this;try{if(this[_0x59ee('0x6c')](_0x17359b)&&this[_0x59ee('0x6c')](_0x17359b[_0x59ee('0x4f')])){logger[_0x59ee('0x4c')](_0x59ee('0x6d'),util[_0x59ee('0x42')](_0x17359b,{'showHidden':![],'depth':null}));var _0x357c47=this[_0x59ee('0x14')][_0x17359b['queue']];if(_0x357c47){logger[_0x59ee('0x6e')](_0x59ee('0x6f'),_0x357c47[_0x59ee('0x65')]);this[_0x59ee('0x48')][_0x59ee('0x5a')][_0x357c47[_0x59ee('0x65')]]={'summaryEvent':_0x17359b};this[_0x59ee('0x48')][_0x59ee('0x6a')]+=0x1;return ami['Action']({'action':_0x59ee('0x67'),'queue':_0x357c47[_0x59ee('0x65')]})[_0x59ee('0x5d')](function(_0x45c394){if(!_0x373dc1['summary']['queuestatus'][_0x17359b['actionid']]){_0x373dc1['summary']['queuestatus'][_0x17359b['actionid']]={};}_0x373dc1['summary'][_0x59ee('0x67')][_0x17359b['actionid']][_0x45c394['actionid']]={'queue':_0x357c47[_0x59ee('0x65')],'agents':[]};})[_0x59ee('0x3e')](function(_0x36e56f){throw _0x36e56f;});}}}catch(_0x17bc89){logger[_0x59ee('0x40')](_0x59ee('0x70'),util[_0x59ee('0x42')](_0x17bc89,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x59ee('0xb')]['syncQueueSummaryComplete']=function(_0x511fe1){if(this[_0x59ee('0x48')][_0x59ee('0x6a')]>0x0){this[_0x59ee('0x48')][_0x59ee('0x71')]=_0x511fe1;return;}logger[_0x59ee('0x4c')](_0x59ee('0x72'),util['inspect'](_0x511fe1,{'showHidden':![],'depth':null}));this[_0x59ee('0x48')]=initializeSummary();ami[_0x59ee('0x4a')](_0x59ee('0x73'),{});};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x1c')]=function(_0x5838d3){try{if(this[_0x59ee('0x6c')](_0x5838d3)){logger['debug'](_0x59ee('0x74'),_0x5838d3[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x5838d3,{'showHidden':![],'depth':null}));if(_[_0x59ee('0x76')](this[_0x59ee('0xf')][_0x5838d3[_0x59ee('0x75')]])){this[_0x59ee('0xf')][_0x5838d3['uniqueid']]=[];}if(_[_0x59ee('0x76')](this[_0x59ee('0x12')][_0x5838d3[_0x59ee('0x75')]])){this['channels'][_0x5838d3['uniqueid']]={};}var _0x4c60ca=new QueueReport();_0x4c60ca[_0x59ee('0x4f')]=_0x5838d3['queue'];_0x4c60ca[_0x59ee('0x68')]=this[_0x59ee('0x14')][_0x4c60ca[_0x59ee('0x4f')]]&&this[_0x59ee('0x14')][_0x4c60ca[_0x59ee('0x4f')]][_0x59ee('0x68')]?this[_0x59ee('0x14')][_0x4c60ca[_0x59ee('0x4f')]]['type']||_0x59ee('0x57'):_0x59ee('0x57');_0x4c60ca['queuecallerjoinAt']=moment()[_0x59ee('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c60ca[_0x59ee('0x77')]=_0x5838d3[_0x59ee('0x77')];_0x4c60ca[_0x59ee('0x78')]=_0x5838d3[_0x59ee('0x78')];_0x4c60ca[_0x59ee('0x75')]=_0x5838d3[_0x59ee('0x75')];_0x4c60ca['routealias']=this[_0x59ee('0x12')][_0x5838d3[_0x59ee('0x75')]]['routealias'];logger[_0x59ee('0x6e')](_0x59ee('0x79'),_0x4c60ca[_0x59ee('0x4f')],_0x4c60ca[_0x59ee('0x68')]);_['merge'](_0x4c60ca,_['pick'](_0x5838d3,_[_0x59ee('0x7a')](_0x4c60ca)));this[_0x59ee('0xf')][_0x5838d3['uniqueid']][_0x59ee('0x6b')](_0x4c60ca);this[_0x59ee('0x12')][_0x5838d3[_0x59ee('0x75')]]=_0x4c60ca;this[_0x59ee('0x4b')](_0x4c60ca,'queuecallerjoin');}}catch(_0x249e5a){logger['error'](_0x59ee('0x74'),_0x5838d3[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x249e5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x1d')]=function(_0x350540){try{if(this['isNotNull'](_0x350540)){logger['debug'](_0x59ee('0x7b'),_0x350540[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x350540,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x350540['uniqueid']]){var _0x143813=_[_0x59ee('0x7c')](this['queueReports'][_0x350540[_0x59ee('0x75')]]);_0x143813['queuecallercomplete']=![];_0x143813[_0x59ee('0x7d')]=null;_0x143813[_0x59ee('0x7e')]=_0x350540['holdtime'];_0x143813['originalposition']=_0x350540['originalposition'];_0x143813[_0x59ee('0x7f')]=!![];_0x143813[_0x59ee('0x80')]=moment()[_0x59ee('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x143813[_0x59ee('0x81')]=_0x59ee('0x82');_0x143813[_0x59ee('0x83')]=null;logger[_0x59ee('0x6e')](_0x59ee('0x84'),_0x143813['queue'],_0x143813[_0x59ee('0x68')]);this[_0x59ee('0x12')][_0x350540[_0x59ee('0x75')]]=_0x143813;this['emitVoiceQueueChannelRemove'](_0x143813,'queuecallerabandon');}}}catch(_0x210332){logger[_0x59ee('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x350540[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x210332,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x1f')]=function(_0x267b3e){try{if(this['isNotNull'](_0x267b3e)){logger[_0x59ee('0x4c')](_0x59ee('0x85'),_0x267b3e[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x267b3e,{'showHidden':![],'depth':null}));if(this[_0x59ee('0xf')][_0x267b3e[_0x59ee('0x75')]]){var _0x5b874e=_[_0x59ee('0x7c')](this[_0x59ee('0xf')][_0x267b3e['uniqueid']]);_0x5b874e[_0x59ee('0x86')]=moment()[_0x59ee('0x4e')](_0x59ee('0x87'));_0x5b874e[_0x59ee('0x88')]=_0x267b3e['connectedlinenum'];_0x5b874e[_0x59ee('0x89')]=_0x267b3e[_0x59ee('0x89')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5b874e[_0x59ee('0x4f')],_0x5b874e['type'],_0x267b3e[_0x59ee('0x88')],_0x267b3e[_0x59ee('0x89')]);this[_0x59ee('0x12')][_0x267b3e[_0x59ee('0x75')]]=_0x5b874e;this[_0x59ee('0x4b')](_0x5b874e,_0x59ee('0x1e'));}}}catch(_0x319bdc){logger[_0x59ee('0x40')](_0x59ee('0x85'),_0x267b3e[_0x59ee('0x75')],util['inspect'](_0x319bdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x34f8a1){try{if(this[_0x59ee('0x6c')](_0x34f8a1)){logger['debug'](_0x59ee('0x8a'),_0x34f8a1[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x34f8a1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x34f8a1['uniqueid']]){var _0x19a9de=_[_0x59ee('0x7c')](this[_0x59ee('0xf')][_0x34f8a1[_0x59ee('0x75')]]);_0x19a9de[_0x59ee('0x8b')]=!![];_0x19a9de[_0x59ee('0x81')]=_0x59ee('0x8c');logger[_0x59ee('0x6e')](_0x59ee('0x8d'),_0x19a9de[_0x59ee('0x4f')],_0x19a9de[_0x59ee('0x68')]);}}}catch(_0x36ae9f){logger[_0x59ee('0x40')](_0x59ee('0x8a'),_0x34f8a1[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x36ae9f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x4b22f6){try{if(this[_0x59ee('0x6c')](_0x4b22f6)){logger[_0x59ee('0x4c')](_0x59ee('0x8e'),_0x4b22f6[_0x59ee('0x75')],util['inspect'](_0x4b22f6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b22f6['uniqueid']]){var _0x234b8b=_['last'](this['queueReports'][_0x4b22f6[_0x59ee('0x75')]]);_0x234b8b[_0x59ee('0x7f')]=![];_0x234b8b[_0x59ee('0x80')]=null;_0x234b8b[_0x59ee('0x8f')]=!![];_0x234b8b[_0x59ee('0x83')]=_0x4b22f6[_0x59ee('0x90')];_0x234b8b['holdtime']=_0x4b22f6[_0x59ee('0x7e')];_0x234b8b[_0x59ee('0x8b')]=!![];_0x234b8b[_0x59ee('0x91')]=![];_0x234b8b[_0x59ee('0x92')]=null;if(!_0x234b8b[_0x59ee('0x93')]){if(_0x4b22f6['reason']==_0x59ee('0x93')){_0x234b8b[_0x59ee('0x81')]=_0x59ee('0x94');logger[_0x59ee('0x6e')](_0x59ee('0x95'),_0x234b8b[_0x59ee('0x4f')],_0x234b8b[_0x59ee('0x68')]);}else{if(_['startsWith'](_0x4b22f6[_0x59ee('0x3d')][_0x59ee('0x96')](),_0x59ee('0x97'))){if(this[_0x59ee('0xf')][_0x4b22f6[_0x59ee('0x98')]]){var _0x24fa58=_['last'](this[_0x59ee('0xf')][_0x4b22f6[_0x59ee('0x98')]]);_0x24fa58[_0x59ee('0x8b')]=![];_0x24fa58[_0x59ee('0x91')]=!![];_0x24fa58[_0x59ee('0x92')]=moment(_0x234b8b[_0x59ee('0x99')])[_0x59ee('0x9a')](_0x4b22f6['holdtime'],_0x59ee('0x9b'))['format'](_0x59ee('0x87'));_0x24fa58[_0x59ee('0x81')]=_0x59ee('0x9c');_0x24fa58[_0x59ee('0x93')]=!![];_0x24fa58['transfertype']=_0x59ee('0x9d');_0x24fa58[_0x59ee('0x9e')]=_0x4b22f6['destexten'];_0x24fa58[_0x59ee('0x9f')]=_0x4b22f6[_0x59ee('0x75')];logger['info'](_0x59ee('0xa0'),_0x24fa58[_0x59ee('0x4f')],_0x24fa58['type']);var _0x332995=this[_0x59ee('0xf')][_0x4b22f6[_0x59ee('0x98')]];this[_0x59ee('0xf')][_0x4b22f6[_0x59ee('0x98')]]=this[_0x59ee('0xf')][_0x4b22f6[_0x59ee('0x75')]];this[_0x59ee('0xf')][_0x4b22f6['uniqueid']]=_0x332995;}}else{_0x234b8b[_0x59ee('0x81')]=_0x59ee('0xa1')+_0x4b22f6['reason'][_0x59ee('0xa2')]();logger[_0x59ee('0x6e')](_0x59ee('0xa3'),_0x234b8b[_0x59ee('0x4f')],_0x234b8b[_0x59ee('0x68')],_0x234b8b[_0x59ee('0x81')]);}}}this[_0x59ee('0x12')][_0x4b22f6[_0x59ee('0x75')]]=_0x234b8b;this[_0x59ee('0x52')](_0x234b8b,'agentcomplete');}}}catch(_0x1a610e){logger[_0x59ee('0x40')](_0x59ee('0x8e'),_0x4b22f6['uniqueid'],util[_0x59ee('0x42')](_0x1a610e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0x23')]=function(_0x5969d8){try{if(this[_0x59ee('0x6c')](_0x5969d8)){logger[_0x59ee('0x4c')](_0x59ee('0xa4'),_0x5969d8[_0x59ee('0x75')],util['inspect'](_0x5969d8,{'showHidden':![],'depth':null}));this[_0x59ee('0xa5')](_0x5969d8['uniqueid'],_['keys'](_0x5969d8[_0x59ee('0xa6')])[0x0],_0x5969d8[_0x59ee('0xa7')]);if(this[_0x59ee('0xf')][_0x5969d8[_0x59ee('0x75')]]){var _0x58938d=_['last'](this[_0x59ee('0xf')][_0x5969d8['uniqueid']]);if(_0x58938d){if(this[_0x59ee('0x6c')](_0x5969d8['variable'])&&this['isNotNull'](_0x5969d8[_0x59ee('0xa6')][_0x59ee('0x67')])){switch(_0x5969d8['value']){case _0x59ee('0xa8'):_0x58938d[_0x59ee('0x91')]=![];_0x58938d['queuecallerexitAt']=null;break;case _0x59ee('0xa9'):_0x58938d[_0x59ee('0xaa')]='timeout';_0x58938d[_0x59ee('0x91')]=!![];_0x58938d[_0x59ee('0x92')]=moment()[_0x59ee('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x58938d[_0x59ee('0x86')]=moment()[_0x59ee('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x59ee('0x4c')](_0x59ee('0xab'),_0x5969d8[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x58938d,{'showHidden':![],'depth':null}));ami[_0x59ee('0x4a')]('custom:timeout',_0x58938d);break;default:_0x58938d[_0x59ee('0x91')]=!![];_0x58938d[_0x59ee('0x92')]=moment()[_0x59ee('0x4e')](_0x59ee('0x87'));_0x58938d['queuecallerleaveAt']=moment()[_0x59ee('0x4e')](_0x59ee('0x87'));}_0x58938d['queuecallerabandon']=![];_0x58938d['queuecallerabandonAt']=null;_0x58938d['queuecallerexitreason']=_0x5969d8[_0x59ee('0xa7')];this['channels'][_0x5969d8[_0x59ee('0x75')]]=_0x58938d;this['emitVoiceQueueChannelRemove'](_0x58938d,'varset');}else if(this[_0x59ee('0x6c')](_0x5969d8['variable'])&&this[_0x59ee('0x6c')](_0x5969d8[_0x59ee('0xa6')]['queueposition'])){if(!_0x58938d[_0x59ee('0x7f')]){_0x58938d['queuecallerexit']=!![];_0x58938d['queuecallerexitAt']=moment()['format'](_0x59ee('0x87'));_0x58938d[_0x59ee('0x81')]='EXITWITHKEY';_0x58938d['queuecallerleaveAt']=moment()[_0x59ee('0x4e')](_0x59ee('0x87'));this['channels'][_0x5969d8[_0x59ee('0x75')]]=_0x58938d;}}logger[_0x59ee('0x6e')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5969d8[_0x59ee('0x75')],_0x58938d[_0x59ee('0x4f')],_0x58938d[_0x59ee('0x68')],_['keys'](_0x5969d8[_0x59ee('0xa6')])[0x0],_0x5969d8[_0x59ee('0xa7')]);_0x58938d[_0x59ee('0x44')]=this['variables'][_0x5969d8[_0x59ee('0x75')]];}}}}catch(_0x4fbb9d){logger[_0x59ee('0x40')](_0x59ee('0xa4'),_0x5969d8[_0x59ee('0x75')],util[_0x59ee('0x42')](_0x4fbb9d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0xa5')]=function(_0x113d13,_0x6f648a,_0x30b390){var _0x36342c=['rtpaudioqos',_0x59ee('0xac'),'rtpaudioqosjitter',_0x59ee('0xad'),_0x59ee('0xae'),'rtpaudioqoslossbridged',_0x59ee('0xaf'),_0x59ee('0xb0'),_0x59ee('0xb1'),_0x59ee('0xb2'),'bridgepeer','bridgepvtcallid','membercalls',_0x59ee('0xb3'),_0x59ee('0xb4'),_0x59ee('0xb5'),_0x59ee('0x90'),_0x59ee('0xb6'),_0x59ee('0xb7')];if(!_[_0x59ee('0x3a')](_0x6f648a)&&!_[_0x59ee('0xb8')](_0x36342c,_0x6f648a)){if(_[_0x59ee('0x76')](this[_0x59ee('0x44')][_0x113d13])){this['variables'][_0x113d13]={};}this[_0x59ee('0x44')][_0x113d13][_0x6f648a]=_0x30b390;}};VoiceQueueReport[_0x59ee('0xb')][_0x59ee('0xb9')]=function(_0x412022,_0x4fa0f0,_0x5acbc1){var _0x528f2f={};for(var _0x215f66=0x0;_0x215f66=0x0?moment(_0x5a91a0[_0x61d9('0x18')])[_0x61d9('0xe')](_0x5a91a0[_0x61d9('0x17')],_0x61d9('0x19')):null,'data1':_0x61d9('0x1a'),'data2':_0x5a91a0[_0x61d9('0x13')],'data3':_0x5a91a0[_0x61d9('0xf')],'data4':_0x5a91a0['dialstring']||null,'role':_0x61d9('0x11'),'internal':_0x5a91a0[_0x61d9('0x13')]?_[_0x61d9('0x12')](_0x5a91a0[_0x61d9('0x13')]):undefined,'uniqueid':_0x5a91a0[_0x61d9('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xca53=['outbound','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','agent','toNumber','accountcode','voice','membername','starttime','endtime','diff'];(function(_0xc69bc1,_0x2eb3e5){var _0x16307a=function(_0x31204b){while(--_0x31204b){_0xc69bc1['push'](_0xc69bc1['shift']());}};_0x16307a(++_0x2eb3e5);}(_0xca53,0x108));var _0x3ca5=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0xca53[_0x503790];return _0x388092;};'use strict';var moment=require(_0x3ca5('0x0'));var _=require(_0x3ca5('0x1'));var util=require(_0x3ca5('0x2'));var client=require(_0x3ca5('0x3'));exports[_0x3ca5('0x4')]=function(_0x18e459){var _0x34d384=_0x18e459[_0x3ca5('0x5')]||_0x18e459['queuecallerexitAt'];return client[_0x3ca5('0x6')](_0x3ca5('0x7'),{'body':{'channel':'voice','membername':_0x18e459[_0x3ca5('0x8')],'interface':_[_0x3ca5('0x9')](_0x18e459[_0x3ca5('0xa')])?util[_0x3ca5('0xb')](_0x3ca5('0xc'),_0x18e459[_0x3ca5('0x8')]):_0x18e459[_0x3ca5('0xa')],'type':_0x3ca5('0xd'),'enterAt':_0x18e459['queuecallerleaveAt'],'exitAt':_0x34d384,'duration':moment(_0x34d384)['diff'](_0x18e459[_0x3ca5('0xe')],_0x3ca5('0xf')),'data1':_0x3ca5('0x10'),'data2':_0x18e459[_0x3ca5('0x11')],'data3':_0x18e459['exten'],'data4':null,'data5':_0x18e459['queue'],'role':_0x3ca5('0x12'),'internal':_0x18e459['accountcode']?_[_0x3ca5('0x13')](_0x18e459[_0x3ca5('0x14')]):undefined,'uniqueid':_0x18e459['uniqueid']},'log':_0x3ca5('0x7')});};exports['voiceDialReport']=function(_0x4f9dee){return client[_0x3ca5('0x6')]('CreateMemberReport',{'body':{'channel':_0x3ca5('0x15'),'membername':_0x4f9dee[_0x3ca5('0x16')],'interface':_0x4f9dee[_0x3ca5('0xa')],'type':_0x3ca5('0xd'),'enterAt':_0x4f9dee[_0x3ca5('0x17')],'exitAt':_0x4f9dee[_0x3ca5('0x18')],'duration':moment(_0x4f9dee[_0x3ca5('0x18')])['diff'](_0x4f9dee[_0x3ca5('0x17')],_0x3ca5('0xf'))>=0x0?moment(_0x4f9dee[_0x3ca5('0x18')])[_0x3ca5('0x19')](_0x4f9dee[_0x3ca5('0x17')],_0x3ca5('0xf')):null,'data1':_0x3ca5('0x1a'),'data2':_0x4f9dee[_0x3ca5('0x14')],'data3':_0x4f9dee['exten'],'data4':_0x4f9dee[_0x3ca5('0x1b')]||null,'role':_0x3ca5('0x12'),'internal':_0x4f9dee[_0x3ca5('0x14')]?_[_0x3ca5('0x13')](_0x4f9dee['accountcode']):undefined,'uniqueid':_0x4f9dee[_0x3ca5('0x1c')]},'log':_0x3ca5('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d1e6b05..c46e9be 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75e3=['getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0xe802e4,_0x9e6543){var _0x2e3a2c=function(_0x3e32ff){while(--_0x3e32ff){_0xe802e4['push'](_0xe802e4['shift']());}};_0x2e3a2c(++_0x9e6543);}(_0x75e3,0x104));var _0x375e=function(_0x29bc1f,_0x22b424){_0x29bc1f=_0x29bc1f-0x0;var _0x2e332c=_0x75e3[_0x29bc1f];return _0x2e332c;};'use strict';var client=require('../client');exports[_0x375e('0x0')]=function(){return client[_0x375e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x375e('0x2'),_0x375e('0x3')]},'log':_0x375e('0x4')});}; \ No newline at end of file +var _0xbee0=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','Request','ShowSetting'];(function(_0x5890b3,_0x2addca){var _0x518084=function(_0x4923aa){while(--_0x4923aa){_0x5890b3['push'](_0x5890b3['shift']());}};_0x518084(++_0x2addca);}(_0xbee0,0x147));var _0x0bee=function(_0x2094a2,_0x372841){_0x2094a2=_0x2094a2-0x0;var _0x1afad8=_0xbee0[_0x2094a2];return _0x1afad8;};'use strict';var client=require('../client');exports[_0x0bee('0x0')]=function(){return client[_0x0bee('0x1')](_0x0bee('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0bee('0x3'),_0x0bee('0x4')]},'log':_0x0bee('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9f57522..6e90a46 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 _0x0444=['name','../client','Request','GetTemplate'];(function(_0x11b1ff,_0x22498b){var _0x1529c9=function(_0x36c610){while(--_0x36c610){_0x11b1ff['push'](_0x11b1ff['shift']());}};_0x1529c9(++_0x22498b);}(_0x0444,0xbd));var _0x4044=function(_0x53c918,_0x4f7a4c){_0x53c918=_0x53c918-0x0;var _0x2466d9=_0x0444[_0x53c918];return _0x2466d9;};'use strict';var client=require(_0x4044('0x0'));exports['getTemplates']=function(_0x4fe379){return function(_0x139226){return client[_0x4044('0x1')](_0x4044('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4044('0x3'),'html']},'log':_0x4044('0x2')});};}; \ No newline at end of file +var _0xd958=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x383426,_0x31891a){var _0x56661b=function(_0x17e8e2){while(--_0x17e8e2){_0x383426['push'](_0x383426['shift']());}};_0x56661b(++_0x31891a);}(_0xd958,0xb8));var _0x8d95=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd958[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x8d95('0x0'));exports[_0x8d95('0x1')]=function(_0x5c134f){return function(_0x549758){return client[_0x8d95('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x8d95('0x3'),_0x8d95('0x4')]},'log':_0x8d95('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a92edb5..eea87cc 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 _0x31d7=['data5','GetTrigger','../client','Request','name','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data3','data4'];(function(_0x59b583,_0x354f2a){var _0x15844a=function(_0x5a4d2e){while(--_0x5a4d2e){_0x59b583['push'](_0x59b583['shift']());}};_0x15844a(++_0x354f2a);}(_0x31d7,0xb6));var _0x731d=function(_0x561da1,_0x1cb5d7){_0x561da1=_0x561da1-0x0;var _0x550bb3=_0x31d7[_0x561da1];return _0x550bb3;};'use strict';var client=require(_0x731d('0x0'));exports['getTriggers']=function(_0x526c97){return function(_0x1138e6){return client[_0x731d('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x731d('0x2'),'channel',_0x731d('0x3')],'include':[{'model':_0x731d('0x4'),'as':_0x731d('0x5'),'attributes':['id',_0x731d('0x6'),_0x731d('0x7'),_0x731d('0x8')]},{'model':'Condition','as':_0x731d('0x9'),'attributes':['id',_0x731d('0x6'),_0x731d('0x7'),_0x731d('0x8')]},{'model':_0x731d('0xa'),'as':_0x731d('0xb'),'attributes':['id',_0x731d('0xc'),_0x731d('0xd'),'data2',_0x731d('0xe'),_0x731d('0xf'),_0x731d('0x10'),'data6','data7']}]},'log':_0x731d('0x11')});};}; \ No newline at end of file +var _0xf8ab=['Condition','operator','Actions','data1','data2','data3','data5','data7','../client','getTriggers','Request','GetTrigger','name','status','AllConditions','value'];(function(_0x1a7a1b,_0x518846){var _0x350750=function(_0x4ab680){while(--_0x4ab680){_0x1a7a1b['push'](_0x1a7a1b['shift']());}};_0x350750(++_0x518846);}(_0xf8ab,0xd8));var _0xbf8a=function(_0x56f4e6,_0x1de088){_0x56f4e6=_0x56f4e6-0x0;var _0x1594af=_0xf8ab[_0x56f4e6];return _0x1594af;};'use strict';var client=require(_0xbf8a('0x0'));exports[_0xbf8a('0x1')]=function(_0x28a103){return function(_0x41698f){return client[_0xbf8a('0x2')](_0xbf8a('0x3'),{'options':{'raw':![],'attributes':['id',_0xbf8a('0x4'),'channel',_0xbf8a('0x5')],'include':[{'model':'Condition','as':_0xbf8a('0x6'),'attributes':['id','field','operator',_0xbf8a('0x7')]},{'model':_0xbf8a('0x8'),'as':'AnyConditions','attributes':['id','field',_0xbf8a('0x9'),_0xbf8a('0x7')]},{'model':'Action','as':_0xbf8a('0xa'),'attributes':['id','action',_0xbf8a('0xb'),_0xbf8a('0xc'),_0xbf8a('0xd'),'data4',_0xbf8a('0xe'),'data6',_0xbf8a('0xf')]}]},'log':_0xbf8a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b45fb99..84d8e99 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 _0xea03=['GetTrunk','name','../client','Request'];(function(_0x122938,_0x1223d0){var _0x1363cc=function(_0x683697){while(--_0x683697){_0x122938['push'](_0x122938['shift']());}};_0x1363cc(++_0x1223d0);}(_0xea03,0x1ba));var _0x3ea0=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xea03[_0xdaab62];return _0x13d767;};'use strict';var client=require(_0x3ea0('0x0'));exports['getTrunks']=function(_0x19d13f){return function(_0x1e8b44){return client[_0x3ea0('0x1')](_0x3ea0('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3ea0('0x3'),'registry','defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xf301=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x59a413,_0x47507b){var _0x2120ef=function(_0x109a4d){while(--_0x109a4d){_0x59a413['push'](_0x59a413['shift']());}};_0x2120ef(++_0x47507b);}(_0xf301,0xe6));var _0x1f30=function(_0x5b7a85,_0x483fb0){_0x5b7a85=_0x5b7a85-0x0;var _0x453546=_0xf301[_0x5b7a85];return _0x453546;};'use strict';var client=require(_0x1f30('0x0'));exports[_0x1f30('0x1')]=function(_0x27de90){return function(_0x2f177d){return client[_0x1f30('0x2')](_0x1f30('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1f30('0x4'),_0x1f30('0x5'),_0x1f30('0x6')]},'log':_0x1f30('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 95edbbe..4e34863 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0xca8ee6,_0x500814){var _0x338251=function(_0x5ef912){while(--_0x5ef912){_0xca8ee6['push'](_0xca8ee6['shift']());}};_0x338251(++_0x500814);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xcb91[_0x1911ed];return _0x11edaa;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x5f0547,_0x5f4ab8){var _0x2ba8d8=function(_0x46a243){while(--_0x46a243){_0x5f0547['push'](_0x5f0547['shift']());}};_0x2ba8d8(++_0x5f4ab8);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 63fe123..5a3d6a9 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 _0xb915=['../client','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xb915,0x145));var _0x5b91=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb915[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x5b91('0x0'));exports['create']=function(_0x35815d){return client['Request'](_0x5b91('0x1'),{'body':_0x35815d,'log':_0x5b91('0x1')});};exports[_0x5b91('0x2')]=function(_0x4eedd4,_0x599ff5,_0x4d77ec){return client[_0x5b91('0x3')](_0x5b91('0x4'),{'body':_0x4eedd4,'options':{'where':{'uniqueid':_0x599ff5,'interface':_0x4d77ec,'agentcomplete':!![]}},'log':_0x5b91('0x4')});}; \ No newline at end of file +var _0x0cf7=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x0cf7,0x67));var _0x70cf=function(_0x438747,_0x1e8e6a){_0x438747=_0x438747-0x0;var _0x23cf79=_0x0cf7[_0x438747];return _0x23cf79;};'use strict';var client=require(_0x70cf('0x0'));exports['create']=function(_0x3c147f){return client[_0x70cf('0x1')]('CreateVoiceAgentReport',{'body':_0x3c147f,'log':_0x70cf('0x2')});};exports[_0x70cf('0x3')]=function(_0x42a848,_0x463ea0,_0x1dd5f9){return client[_0x70cf('0x1')](_0x70cf('0x4'),{'body':_0x42a848,'options':{'where':{'uniqueid':_0x463ea0,'interface':_0x1dd5f9,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7e9ba8d..d3d5c16 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 _0x72e5=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x72e5,0x137));var _0x572e=function(_0x26d5ec,_0x30160b){_0x26d5ec=_0x26d5ec-0x0;var _0xce9696=_0x72e5[_0x26d5ec];return _0xce9696;};'use strict';var moment=require(_0x572e('0x0'));var util=require(_0x572e('0x1'));var _=require('lodash');var client=require(_0x572e('0x2'));exports[_0x572e('0x3')]=function(_0x30b2b2){return client[_0x572e('0x4')](_0x572e('0x5'),{'body':_[_0x572e('0x6')](_0x30b2b2,{'source':_0x30b2b2['calleridnum'],'destinationcontext':_0x30b2b2[_0x572e('0x7')],'callerid':_0x30b2b2[_0x572e('0x8')],'amaflags':_0x572e('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x572e('0xa')]=function(){return function(){return client[_0x572e('0x4')](_0x572e('0xb'),{'options':{'where':{'type':[_0x572e('0xc')],'createdAt':{'$between':[moment()[_0x572e('0xd')](_0x572e('0xe'))[_0x572e('0xf')](_0x572e('0x10')),moment()[_0x572e('0x11')](_0x572e('0xe'))[_0x572e('0xf')](_0x572e('0x10'))]}},'attributes':[_0x572e('0x12'),_0x572e('0x13'),_0x572e('0x14'),_0x572e('0x15')]},'log':_0x572e('0x16')});};}; \ No newline at end of file +var _0x85d4=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid'];(function(_0x351c8f,_0x1a92ae){var _0x8deaa4=function(_0x582df0){while(--_0x582df0){_0x351c8f['push'](_0x351c8f['shift']());}};_0x8deaa4(++_0x1a92ae);}(_0x85d4,0x157));var _0x485d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x85d4[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var util=require(_0x485d('0x0'));var _=require(_0x485d('0x1'));var client=require(_0x485d('0x2'));exports['create']=function(_0x575482){return client[_0x485d('0x3')](_0x485d('0x4'),{'body':_[_0x485d('0x5')](_0x575482,{'source':_0x575482[_0x485d('0x6')],'destinationcontext':_0x575482[_0x485d('0x7')],'callerid':_0x575482[_0x485d('0x8')],'amaflags':_0x485d('0x9')}),'log':_0x485d('0x4')});};exports[_0x485d('0xa')]=function(){return function(){return client[_0x485d('0x3')](_0x485d('0xb'),{'options':{'where':{'type':[_0x485d('0xc')],'createdAt':{'$between':[moment()['startOf']('day')[_0x485d('0xd')](_0x485d('0xe')),moment()[_0x485d('0xf')](_0x485d('0x10'))[_0x485d('0xd')](_0x485d('0xe'))]}},'attributes':[_0x485d('0x11'),_0x485d('0x12'),_0x485d('0x13'),_0x485d('0x14')]},'log':_0x485d('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 6b487bf..2733c41 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 _0x4662=['Request','create'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0x4662,0x103));var _0x2466=function(_0x241894,_0x14c936){_0x241894=_0x241894-0x0;var _0x17ff86=_0x4662[_0x241894];return _0x17ff86;};'use strict';var client=require('../client');exports[_0x2466('0x0')]=function(_0x493c73){return client[_0x2466('0x1')]('CreateVoiceDialReport',{'body':_0x493c73,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x6ece=['CreateVoiceDialReport','create','Request'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0x6ece,0x1d8));var _0xe6ec=function(_0x43f291,_0x571cf5){_0x43f291=_0x43f291-0x0;var _0x5d4abc=_0x6ece[_0x43f291];return _0x5d4abc;};'use strict';var client=require('../client');exports[_0xe6ec('0x0')]=function(_0x12f204){return client[_0xe6ec('0x1')]('CreateVoiceDialReport',{'body':_0x12f204,'log':_0xe6ec('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b3b5787..7bf61bb 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 _0xe130=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x4a3e5d,_0x256331){var _0xf3ae2f=function(_0x4b6778){while(--_0x4b6778){_0x4a3e5d['push'](_0x4a3e5d['shift']());}};_0xf3ae2f(++_0x256331);}(_0xe130,0x127));var _0x0e13=function(_0x19b09b,_0x517eca){_0x19b09b=_0x19b09b-0x0;var _0x37a0f8=_0xe130[_0x19b09b];return _0x37a0f8;};'use strict';var client=require(_0x0e13('0x0'));exports[_0x0e13('0x1')]=function(){return function(){return client['Request'](_0x0e13('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0e13('0x3'),_0x0e13('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0e13('0x1')});};}; \ No newline at end of file +var _0x8e0d=['exten','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x4abc8f,_0xef597d){var _0x5d7939=function(_0x145f23){while(--_0x145f23){_0x4abc8f['push'](_0x4abc8f['shift']());}};_0x5d7939(++_0xef597d);}(_0x8e0d,0x82));var _0xd8e0=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x8e0d[_0x48d6a3];return _0x38bfa0;};'use strict';var client=require(_0xd8e0('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xd8e0('0x1'),{'options':{'raw':!![],'attributes':['id',_0xd8e0('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd8e0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2bd599a..7346ed8 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 _0xa175=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x5b7f48,_0x4d8a1d){var _0x2424b0=function(_0x21b28b){while(--_0x21b28b){_0x5b7f48['push'](_0x5b7f48['shift']());}};_0x2424b0(++_0x4d8a1d);}(_0xa175,0x15d));var _0x5a17=function(_0x3d4ce3,_0x5c584f){_0x3d4ce3=_0x3d4ce3-0x0;var _0x140c76=_0xa175[_0x3d4ce3];return _0x140c76;};'use strict';var client=require('../client');exports[_0x5a17('0x0')]=function(){return function(){return client[_0x5a17('0x1')](_0x5a17('0x2'),{'options':{'raw':![],'attributes':['id',_0x5a17('0x3'),_0x5a17('0x4'),'acwTimeout',_0x5a17('0x5'),'monitor_format',_0x5a17('0x6'),_0x5a17('0x7'),_0x5a17('0x8'),_0x5a17('0x9'),_0x5a17('0xa'),_0x5a17('0xb'),'dialPredictiveOptimization',_0x5a17('0xc'),_0x5a17('0xd'),_0x5a17('0xe'),'dialOriginateCallerIdNumber',_0x5a17('0xf'),_0x5a17('0x10'),'dialQueueTimeout',_0x5a17('0x11'),_0x5a17('0x12'),_0x5a17('0x13'),_0x5a17('0x14'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x5a17('0x15'),_0x5a17('0x16'),_0x5a17('0x17'),_0x5a17('0x18'),_0x5a17('0x19'),_0x5a17('0x1a'),_0x5a17('0x1b'),_0x5a17('0x1c'),_0x5a17('0x1d'),_0x5a17('0x1e'),'dialAMDTotalAnalysisTime',_0x5a17('0x1f'),_0x5a17('0x20'),_0x5a17('0x21'),_0x5a17('0x22'),_0x5a17('0x23'),_0x5a17('0x24'),_0x5a17('0x25'),_0x5a17('0x26'),'dialOrderByScheduledAt',_0x5a17('0x27'),'dialAgiAfterHangupClient',_0x5a17('0x28'),_0x5a17('0x29'),'strategy',_0x5a17('0x2a'),_0x5a17('0x2b'),'dialNoSuchNumberMaxRetry',_0x5a17('0x2c'),_0x5a17('0x2d'),'dialDropRetryFrequency',_0x5a17('0x2e'),_0x5a17('0x2f'),'dialMachineMaxRetry',_0x5a17('0x30'),'dialAgentRejectMaxRetry',_0x5a17('0x31'),_0x5a17('0x32'),_0x5a17('0x33'),_0x5a17('0x34'),_0x5a17('0x35'),_0x5a17('0x36')],'include':[{'model':_0x5a17('0x37'),'as':'Trunk','attributes':['id','name','callerid',_0x5a17('0x38')]},{'model':_0x5a17('0x39'),'as':_0x5a17('0x3a'),'attributes':['id',_0x5a17('0x3')]},{'model':_0x5a17('0x37'),'as':_0x5a17('0x3b'),'attributes':['id',_0x5a17('0x3'),'callerid',_0x5a17('0x38')]},{'model':'Interval','as':_0x5a17('0x3c'),'attributes':['id',_0x5a17('0x3')],'include':[{'model':_0x5a17('0x3c'),'as':'Intervals','attributes':['id',_0x5a17('0x3'),_0x5a17('0x3d')]}]}]},'log':_0x5a17('0x0')});};}; \ No newline at end of file +var _0x21b4=['dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy'];(function(_0x412b2a,_0x11fb8a){var _0x5872e3=function(_0x202191){while(--_0x202191){_0x412b2a['push'](_0x412b2a['shift']());}};_0x5872e3(++_0x11fb8a);}(_0x21b4,0x15b));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x421b('0x0'));exports[_0x421b('0x1')]=function(){return function(){return client[_0x421b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x421b('0x3'),_0x421b('0x4'),_0x421b('0x5'),_0x421b('0x6'),_0x421b('0x7'),_0x421b('0x8'),_0x421b('0x9'),_0x421b('0xa'),_0x421b('0xb'),'dialLimitQueue',_0x421b('0xc'),_0x421b('0xd'),_0x421b('0xe'),'dialPredictiveInterval',_0x421b('0xf'),_0x421b('0x10'),'dialOriginateTimeout','dialQueueOptions',_0x421b('0x11'),_0x421b('0x12'),'dialCongestionMaxRetry',_0x421b('0x13'),_0x421b('0x14'),_0x421b('0x15'),_0x421b('0x16'),_0x421b('0x17'),'dialGlobalMaxRetry','dialTimezone',_0x421b('0x18'),_0x421b('0x19'),'dialCheckDuplicateType',_0x421b('0x1a'),_0x421b('0x1b'),_0x421b('0x1c'),_0x421b('0x1d'),_0x421b('0x1e'),_0x421b('0x1f'),_0x421b('0x20'),_0x421b('0x21'),_0x421b('0x22'),_0x421b('0x23'),_0x421b('0x24'),_0x421b('0x25'),_0x421b('0x26'),'dialOrderByScheduledAt',_0x421b('0x27'),_0x421b('0x28'),_0x421b('0x29'),_0x421b('0x7'),_0x421b('0x2a'),_0x421b('0x2b'),'dialCutDigit',_0x421b('0x2c'),_0x421b('0x2d'),_0x421b('0x2e'),_0x421b('0x2f'),_0x421b('0x30'),_0x421b('0x31'),_0x421b('0x32'),'dialMachineRetryFrequency',_0x421b('0x33'),_0x421b('0x34'),_0x421b('0x35'),_0x421b('0x36'),_0x421b('0x37'),'dialPreviewAutoRecallMe',_0x421b('0x38')],'include':[{'model':_0x421b('0x39'),'as':'Trunk','attributes':['id','name',_0x421b('0x3a'),_0x421b('0x3b')]},{'model':_0x421b('0x3c'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x421b('0x39'),'as':_0x421b('0x3d'),'attributes':['id',_0x421b('0x3'),_0x421b('0x3a'),_0x421b('0x3b')]},{'model':_0x421b('0x3e'),'as':_0x421b('0x3e'),'attributes':['id',_0x421b('0x3')],'include':[{'model':_0x421b('0x3e'),'as':_0x421b('0x3f'),'attributes':['id',_0x421b('0x3'),_0x421b('0x40')]}]}]},'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 7598532..349c29a 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1278f9,_0x14c7ab){var _0x1efcc3=function(_0x1be486){while(--_0x1be486){_0x1278f9['push'](_0x1278f9['shift']());}};_0x1efcc3(++_0x14c7ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x245ba4,_0x290091){var _0x5abf52=function(_0x526aa8){while(--_0x526aa8){_0x245ba4['push'](_0x245ba4['shift']());}};_0x5abf52(++_0x290091);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 85923e9..0be8db4 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 _0x33ee=['getVoiceQueueRtPauses','Request'];(function(_0x36e3ba,_0x1912e8){var _0x7972c7=function(_0x52e712){while(--_0x52e712){_0x36e3ba['push'](_0x36e3ba['shift']());}};_0x7972c7(++_0x1912e8);}(_0x33ee,0x151));var _0xe33e=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x33ee[_0x4fbfd9];return _0x31dc94;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x72b1bb){return function(){return client[_0xe33e('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x72b1bb,'paused':!![]},'raw':!![]},'log':_0xe33e('0x1')});};}; \ No newline at end of file +var _0x5f96=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x5f96,0x179));var _0x65f9=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x5f96[_0x1beef3];return _0x5af964;};'use strict';var client=require('../client');exports[_0x65f9('0x0')]=function(_0x229f6f){return function(){return client[_0x65f9('0x1')](_0x65f9('0x2'),{'options':{'where':{'VoiceQueueId':_0x229f6f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6222528..5d4b4fa 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x339b2d,_0x159f80){var _0x1cbbbc=function(_0x3c206a){while(--_0x3c206a){_0x339b2d['push'](_0x339b2d['shift']());}};_0x1cbbbc(++_0x159f80);}(_0x7a54,0x106));var _0x47a5=function(_0xad7fa8,_0x4eb4b1){_0xad7fa8=_0xad7fa8-0x0;var _0x186c4c=_0x7a54[_0xad7fa8];return _0x186c4c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1445ec,_0x139a01){var _0x4be7cd=function(_0x2c3fc2){while(--_0x2c3fc2){_0x1445ec['push'](_0x1445ec['shift']());}};_0x4be7cd(++_0x139a01);}(_0x7a54,0x106));var _0x47a5=function(_0x15167c,_0x5d3377){_0x15167c=_0x15167c-0x0;var _0x2d22ed=_0x7a54[_0x15167c];return _0x2d22ed;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4f34ed1..0187b8c 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 _0x74f8=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x388550,_0x3fd74b){var _0x735860=function(_0x50783c){while(--_0x50783c){_0x388550['push'](_0x388550['shift']());}};_0x735860(++_0x3fd74b);}(_0x74f8,0x68));var _0x874f=function(_0x4daed5,_0x59660c){_0x4daed5=_0x4daed5-0x0;var _0xd2eec1=_0x74f8[_0x4daed5];return _0xd2eec1;};'use strict';var client=require(_0x874f('0x0'));exports[_0x874f('0x1')]={};exports[_0x874f('0x2')]=function(_0x280968){return client[_0x874f('0x3')](_0x874f('0x4'),{'body':{'result':_0x280968[_0x874f('0x5')],'transfererchannel':_0x280968[_0x874f('0x6')],'transferercalleridnum':_0x280968[_0x874f('0x7')],'transferercalleridname':_0x280968[_0x874f('0x8')],'transfererconnectedlinenum':_0x280968[_0x874f('0x9')],'transfererconnectedlinename':_0x280968[_0x874f('0xa')],'transfereraccountcode':_0x280968[_0x874f('0xb')],'transferercontext':_0x280968[_0x874f('0xc')],'transfererexten':_0x280968[_0x874f('0xd')],'transfererlinkedid':_0x280968[_0x874f('0xe')],'transfereechannel':_0x280968[_0x874f('0xf')],'transfereecalleridnum':_0x280968[_0x874f('0x10')],'transfereecalleridname':_0x280968[_0x874f('0x11')],'transfereeconnectedlinenum':_0x280968[_0x874f('0x12')],'transfereeconnectedlinename':_0x280968[_0x874f('0x13')],'transfereeaccountcode':_0x280968[_0x874f('0x14')],'transfereecontext':_0x280968['transfereecontext'],'transfereeexten':_0x280968['transfereeexten'],'transfereelinkedid':_0x280968[_0x874f('0x15')],'isexternal':_0x280968[_0x874f('0x16')],'context':_0x280968['context'],'extension':_0x280968['extension'],'type':'blind'},'log':_0x874f('0x4')});};exports[_0x874f('0x17')]=function(_0x237d6f){return client[_0x874f('0x3')](_0x874f('0x4'),{'body':{'result':_0x237d6f[_0x874f('0x5')],'transfererchannel':_0x237d6f['origtransfererchannel'],'transferercalleridnum':_0x237d6f[_0x874f('0x18')],'transferercalleridname':_0x237d6f['origtransferercalleridname'],'transfererconnectedlinenum':_0x237d6f[_0x874f('0x19')],'transfererconnectedlinename':_0x237d6f[_0x874f('0x1a')],'transfereraccountcode':_0x237d6f[_0x874f('0x1b')],'transferercontext':_0x237d6f[_0x874f('0x1c')],'transfererexten':_0x237d6f[_0x874f('0x1d')],'transfererlinkedid':_0x237d6f[_0x874f('0x1e')],'transfereechannel':_0x237d6f['transfertargetchannel'],'transfereecalleridnum':_0x237d6f[_0x874f('0x1f')],'transfereecalleridname':_0x237d6f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x237d6f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x237d6f[_0x874f('0x20')],'transfereeaccountcode':_0x237d6f['transfertargetaccountcode'],'transfereecontext':_0x237d6f['transfertargetcontext'],'transfereeexten':_0x237d6f[_0x874f('0x21')],'transfereelinkedid':_0x237d6f[_0x874f('0x22')],'isexternal':_0x237d6f['isexternal'],'context':_0x237d6f['origtransferercontext'],'extension':_0x237d6f[_0x874f('0x23')],'type':_0x874f('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xcd4a=['transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','blindTransfer','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xcd4a,0x1e1));var _0xacd4=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0xcd4a[_0x267d8d];return _0x11a98f;};'use strict';var client=require('../client');exports[_0xacd4('0x0')]={};exports[_0xacd4('0x1')]=function(_0x251ce6){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x251ce6[_0xacd4('0x2')],'transfererchannel':_0x251ce6[_0xacd4('0x3')],'transferercalleridnum':_0x251ce6['transferercalleridnum'],'transferercalleridname':_0x251ce6[_0xacd4('0x4')],'transfererconnectedlinenum':_0x251ce6[_0xacd4('0x5')],'transfererconnectedlinename':_0x251ce6[_0xacd4('0x6')],'transfereraccountcode':_0x251ce6[_0xacd4('0x7')],'transferercontext':_0x251ce6[_0xacd4('0x8')],'transfererexten':_0x251ce6['transfererexten'],'transfererlinkedid':_0x251ce6[_0xacd4('0x9')],'transfereechannel':_0x251ce6['transfereechannel'],'transfereecalleridnum':_0x251ce6[_0xacd4('0xa')],'transfereecalleridname':_0x251ce6[_0xacd4('0xb')],'transfereeconnectedlinenum':_0x251ce6[_0xacd4('0xc')],'transfereeconnectedlinename':_0x251ce6[_0xacd4('0xd')],'transfereeaccountcode':_0x251ce6[_0xacd4('0xe')],'transfereecontext':_0x251ce6['transfereecontext'],'transfereeexten':_0x251ce6[_0xacd4('0xf')],'transfereelinkedid':_0x251ce6[_0xacd4('0x10')],'isexternal':_0x251ce6[_0xacd4('0x11')],'context':_0x251ce6[_0xacd4('0x12')],'extension':_0x251ce6[_0xacd4('0x13')],'type':_0xacd4('0x14')},'log':_0xacd4('0x15')});};exports[_0xacd4('0x16')]=function(_0x2b9311){return client[_0xacd4('0x17')](_0xacd4('0x15'),{'body':{'result':_0x2b9311[_0xacd4('0x2')],'transfererchannel':_0x2b9311[_0xacd4('0x18')],'transferercalleridnum':_0x2b9311[_0xacd4('0x19')],'transferercalleridname':_0x2b9311[_0xacd4('0x1a')],'transfererconnectedlinenum':_0x2b9311['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2b9311[_0xacd4('0x1b')],'transfereraccountcode':_0x2b9311['origtransfereraccountcode'],'transferercontext':_0x2b9311[_0xacd4('0x1c')],'transfererexten':_0x2b9311['secondtransfererexten'],'transfererlinkedid':_0x2b9311[_0xacd4('0x1d')],'transfereechannel':_0x2b9311[_0xacd4('0x1e')],'transfereecalleridnum':_0x2b9311['transfertargetcalleridnum'],'transfereecalleridname':_0x2b9311[_0xacd4('0x1f')],'transfereeconnectedlinenum':_0x2b9311[_0xacd4('0x20')],'transfereeconnectedlinename':_0x2b9311['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b9311['transfertargetaccountcode'],'transfereecontext':_0x2b9311[_0xacd4('0x21')],'transfereeexten':_0x2b9311[_0xacd4('0x22')],'transfereelinkedid':_0x2b9311[_0xacd4('0x23')],'isexternal':_0x2b9311[_0xacd4('0x11')],'context':_0x2b9311[_0xacd4('0x24')],'extension':_0x2b9311[_0xacd4('0x25')],'type':'attended'},'log':_0xacd4('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 014f4a8..a99bbc1 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 _0x7fbe=['omit','undefined','values','voicechannel','join','channels','uniqueid','channel','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','catch','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','type','includes','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','custom:','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','pick','reload','module','action','Reload','then','message','isConnected','command','Action','voiceQueues','hasOwnProperty','push','length','find'];(function(_0x3bc87e,_0x2402c0){var _0x574f94=function(_0x18a508){while(--_0x18a508){_0x3bc87e['push'](_0x3bc87e['shift']());}};_0x574f94(++_0x2402c0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x50c16c,_0x43b99e){_0x50c16c=_0x50c16c-0x0;var _0x24dc5f=_0x7fbe[_0x50c16c];return _0x24dc5f;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xe7fb('0x0'));var schema=require(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var config=require(_0xe7fb('0x3'));var properties=require(_0xe7fb('0x4'));var ami=require(_0xe7fb('0x5'));var VoiceQueueSummary=require(_0xe7fb('0x6'));exports[_0xe7fb('0x7')]=function(_0x36ab90,_0x5dbf04,_0x290172){return new Promise(function(_0x12d1b0,_0x24cd67){var _0x1f943f={'QueuePause':function(_0x5ad75b){return new Promise(function(_0x213ebc){var _0x228f6b=util[_0xe7fb('0x8')](_0xe7fb('0x9'),'SIP',_0x5ad75b['name']);if(_0x36ab90[_0xe7fb('0xa')]&&_0x36ab90[_0xe7fb('0xa')][_0x228f6b]&&_0x36ab90[_0xe7fb('0xa')][_0x228f6b][_0xe7fb('0xb')]){_0x36ab90[_0xe7fb('0xa')][_0x228f6b][_0xe7fb('0xc')]();}if(_0x36ab90[_0xe7fb('0xd')][_0x228f6b]){_0x36ab90[_0xe7fb('0xd')][_0x228f6b][_0xe7fb('0xe')]({'statePause':_0x5ad75b[_0xe7fb('0xf')]?!![]:![]});}_0x213ebc({'code':0xc8,'message':_0xe7fb('0x10')});});},'Reload':function(_0x188e1d){var _0xdf9760=this;return new Promise(function(_0x45fe75,_0x7fe4d3){if(ami['isConnected']()==![]){return _0x7fe4d3(_0xdf9760[_0xe7fb('0x11')](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}_0x188e1d=_[_0xe7fb('0x15')](_0x188e1d,_['keys'](properties[_0xe7fb('0x16')][_0xe7fb('0x17')]));_0x188e1d[_0xe7fb('0x18')]=_0xe7fb('0x19');return ami['Action'](_0x188e1d)[_0xe7fb('0x1a')](function(_0x5ebc87){_0x45fe75({'code':0xc8,'message':_0x5ebc87[_0xe7fb('0x1b')]});})['catch'](function(_0x1e77fd){_0x7fe4d3(_0xdf9760[_0xe7fb('0x11')](0x1f5,_0x1e77fd[_0xe7fb('0x1b')]));});});},'Command':function(_0x182269){var _0x5df1a1=this;return new Promise(function(_0x44466e,_0x5d1c87){if(ami[_0xe7fb('0x1c')]()==![]){return _0x5d1c87(_0x5df1a1['error'](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}_0x182269=_[_0xe7fb('0x15')](_0x182269,_0xe7fb('0x1d'));_0x182269[_0xe7fb('0x18')]='Command';return ami[_0xe7fb('0x1e')](_0x182269)[_0xe7fb('0x1a')](function(_0x5da3d9){_0x44466e({'code':0xc8,'message':_0x5da3d9['content']});})['catch'](function(_0x35e4db){_0x5d1c87(_0x5df1a1['error'](0x1f5,_0x35e4db['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4026b1){var _0x32e8b2=[];for(var _0x2996ae in _0x36ab90['voiceQueues']){if(_0x36ab90[_0xe7fb('0x1f')][_0xe7fb('0x20')](_0x2996ae)){var _0x390f32=_0x36ab90[_0xe7fb('0x1f')][_0x2996ae];var _0x392d75=new VoiceQueueSummary(_0x390f32);_0x32e8b2[_0xe7fb('0x21')](_0x392d75);}}_0x4026b1({'count':_0x32e8b2[_0xe7fb('0x22')],'rows':_0x32e8b2});});},'UpdateVoiceQueue':function(_0x59e015){return new Promise(function(_0x5df9f2,_0x1086e6){var _0x3bdee9=_[_0xe7fb('0x23')](_0x36ab90['voiceQueues'],{'id':parseInt(_0x59e015['id'])});var _0xb1f2f4=_[_0xe7fb('0x24')](_0x59e015,['id']);if(_0x3bdee9){for(var _0xd3fffe in _0xb1f2f4){if(typeof _0xb1f2f4[_0xd3fffe]!==_0xe7fb('0x25')&&typeof _0x3bdee9[_0xd3fffe]!==_0xe7fb('0x25')){_0x3bdee9[_0xd3fffe]=_0xb1f2f4[_0xd3fffe];}}_0x5df9f2(_0x3bdee9);}else{_0x1086e6();}});},'VoiceChannels':function(){return new Promise(function(_0x1256d4){var _0x1d57a7=_[_0xe7fb('0x26')](_0x36ab90['channels']);_0x1256d4({'count':_0x1d57a7[_0xe7fb('0x22')],'rows':_0x1d57a7});});},'VoiceChannelMixMonitor':function(_0x1742f3){var _0x29d1ca=this;return new Promise(function(_0x547a04,_0x517d70){if(ami[_0xe7fb('0x1c')]()==![]){return _0x517d70(_0x29d1ca['error'](0x1f4,[config[_0xe7fb('0x12')]['ip'],config[_0xe7fb('0x12')][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}var _0x1af472=schema(properties[_0xe7fb('0x27')])[_0xe7fb('0x1')](_0x1742f3);if(_0x1af472[_0xe7fb('0x22')]>0x0){return _0x517d70(_0x29d1ca[_0xe7fb('0x11')](0x1f4,_['map'](_0x1af472,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x209eaa=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x29')],{'uniqueid':_0x1742f3[_0xe7fb('0x2a')]});if(_0x209eaa&&_0x209eaa[_0xe7fb('0x2b')]){var _0x147eb1=util[_0xe7fb('0x8')]('%s.%s',_0x1742f3[_0xe7fb('0x2c')]||_0x1742f3[_0xe7fb('0x2a')],_0x1742f3[_0xe7fb('0x8')]||'wav');return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x2d'),'channel':_0x209eaa[_0xe7fb('0x2b')],'file':_0x147eb1,'options':_0xe7fb('0x2e')})[_0xe7fb('0x1a')](function(_0x35b828){var _0xfeefb1=_[_0xe7fb('0x23')](_0x209eaa[_0xe7fb('0x2f')],{'filename':_0xe7fb('0x30')+_0x147eb1[_0xe7fb('0x31')]()});if(_[_0xe7fb('0x32')](_0xfeefb1)){_0x209eaa[_0xe7fb('0x2f')][_0xe7fb('0x21')]({'filename':_0xe7fb('0x30')+_0x147eb1[_0xe7fb('0x31')](),'createdAt':moment()[_0xe7fb('0x8')](_0xe7fb('0x33')),'mixmonitorid':_0x35b828[_0xe7fb('0x34')],'status':'rec'});}else{_0xfeefb1[_0xe7fb('0x34')]=_0x35b828[_0xe7fb('0x34')];_0xfeefb1[_0xe7fb('0x35')]=_0xe7fb('0x36');}_0x547a04({'code':0xc8,'message':[_0x1742f3['uniqueid'],_0xe7fb('0x37'),_0x35b828[_0xe7fb('0x34')]][_0xe7fb('0x28')]('\x20'),'mixmonitorid':_0x35b828[_0xe7fb('0x34')]});})['catch'](function(_0x2f976f){_0x517d70(_0x29d1ca[_0xe7fb('0x11')](0x1f5,[_0x1742f3[_0xe7fb('0x2a')],_0x2f976f[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')));});}else{return _0x517d70(_0x29d1ca['error'](0x1f5,_0xe7fb('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x35139f){var _0x3a96cd=this;return new Promise(function(_0x4b263d,_0x36a341){if(ami[_0xe7fb('0x1c')]()==![]){return _0x36a341(_0x3a96cd['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xe7fb('0x28')]('\x20')));}var _0x957ca3=schema(properties[_0xe7fb('0x27')])['validate'](_0x35139f);if(_0x957ca3[_0xe7fb('0x22')]>0x0){return _0x36a341(_0x3a96cd['error'](0x1f4,_[_0xe7fb('0x39')](_0x957ca3,_0xe7fb('0x1b'))['join'](',\x20')));}var _0x108a16=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x29')],{'uniqueid':_0x35139f[_0xe7fb('0x2a')]});if(_0x108a16){return Promise['resolve']()[_0xe7fb('0x1a')](function(){if(_0x108a16[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':'StopMixMonitor','channel':_0x108a16[_0xe7fb('0x2b')],'mixmonitorid':_0x35139f[_0xe7fb('0x34')]})[_0xe7fb('0x3a')](function(){});}})[_0xe7fb('0x1a')](function(){if(_0x108a16[_0xe7fb('0x3b')]){return ami['Action']({'action':_0xe7fb('0x3c'),'channel':_0x108a16['destinationchannel'],'mixmonitorid':_0x35139f[_0xe7fb('0x34')]})[_0xe7fb('0x3a')](function(){});}})[_0xe7fb('0x1a')](function(){var _0x1ecbfd=_[_0xe7fb('0x23')](_0x108a16['monitors'],{'mixmonitorid':_0x35139f[_0xe7fb('0x34')]});if(_0x1ecbfd){_0x1ecbfd['status']='stop';}})[_0xe7fb('0x1a')](function(){var _0x3d740f=util[_0xe7fb('0x8')]('%s.%s',_0x35139f[_0xe7fb('0x2c')]||_0x35139f[_0xe7fb('0x2a')],_0x35139f['format']||'wav');var _0x284bcb=_[_0xe7fb('0x23')](_0x108a16[_0xe7fb('0x2f')],{'filename':_0xe7fb('0x30')+_0x3d740f[_0xe7fb('0x31')]()});if(_0x284bcb){_0x284bcb[_0xe7fb('0x35')]=_0xe7fb('0x3d');}})[_0xe7fb('0x1a')](function(){_0x4b263d({'code':0xc8,'message':[_0x35139f['uniqueid'],_0xe7fb('0x3e')]['join']('\x20')});})[_0xe7fb('0x3a')](function(_0x102da9){_0x36a341(_0x3a96cd['error'](0x1f5,[_0x35139f[_0xe7fb('0x2a')],_0x102da9['message'][_0xe7fb('0x31')]()]['join']('\x20')));});}else{return _0x36a341(_0x3a96cd[_0xe7fb('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x467c5a){var _0x59158c=this;return new Promise(function(_0x1fff6c){var _0x1b6442=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x3f')]);var _0xb8179a={'count':_0x1b6442[_0xe7fb('0x22')],'rows':_0x1b6442};if(_0x467c5a&&_0x467c5a[_0xe7fb('0x40')]){if(!['inbound','outbound'][_0xe7fb('0x41')](_0x467c5a['type'])){return _0x24cd67(_0x59158c['error'](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x50b8df=_['filter'](_0x1b6442,function(_0x18773c){return _0x18773c[_0xe7fb('0x40')]===_0x467c5a[_0xe7fb('0x40')];});_0xb8179a[_0xe7fb('0x42')]=_0x50b8df['length'];_0xb8179a[_0xe7fb('0x43')]=_0x50b8df;}_0x1fff6c(_0xb8179a);});},'VoiceQueuesChannel':function(_0x236b35){var _0x195e52=this;return new Promise(function(_0x4a9372,_0x56c512){var _0x2f3b72=schema(properties[_0xe7fb('0x44')])[_0xe7fb('0x1')](_0x236b35);if(_0x2f3b72['length']>0x0){return _0x56c512(_0x195e52[_0xe7fb('0x11')](0x1f4,_[_0xe7fb('0x39')](_0x2f3b72,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x548cd4=_['find'](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x236b35[_0xe7fb('0x2a')]});if(_0x548cd4){_0x4a9372(_0x548cd4);}else{return _0x56c512(_0x195e52[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x3b0147){var _0x5dd7c8=this;return new Promise(function(_0x9c45a,_0x349a2a){if(ami[_0xe7fb('0x1c')]()==![]){return _0x349a2a(_0x5dd7c8['error'](0x1f4,[config['asterisk']['ip'],config[_0xe7fb('0x12')][_0xe7fb('0x13')],_0xe7fb('0x14')][_0xe7fb('0x28')]('\x20')));}var _0x40f546=schema(properties[_0xe7fb('0x45')])['validate'](_0x3b0147);if(_0x40f546[_0xe7fb('0x22')]>0x0){return _0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f4,_[_0xe7fb('0x39')](_0x40f546,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x1e0d69=_['find'](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x3b0147['uniqueid']});if(_0x1e0d69&&_0x1e0d69[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x46'),'channel':_0x1e0d69[_0xe7fb('0x2b')]})['then'](function(_0x47ac92){_0x9c45a({'code':0xc8,'message':[_0x3b0147[_0xe7fb('0x2a')],_0x47ac92[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')});})[_0xe7fb('0x3a')](function(_0x50dc34){_0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f5,[_0x3b0147['uniqueid'],_0x50dc34[_0xe7fb('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0x1b2fc7){var _0x5da884=this;return new Promise(function(_0x475716,_0x34b7a5){if(ami[_0xe7fb('0x1c')]()==![]){return _0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}var _0x4136ae=schema(properties[_0xe7fb('0x47')])['validate'](_0x1b2fc7);if(_0x4136ae[_0xe7fb('0x22')]>0x0){return _0x34b7a5(_0x5da884['error'](0x1f4,_[_0xe7fb('0x39')](_0x4136ae,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x5c0104=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x1b2fc7[_0xe7fb('0x2a')]});if(_0x5c0104&&_0x5c0104[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x48'),'channel':_0x5c0104[_0xe7fb('0x2b')],'exten':_0x1b2fc7[_0xe7fb('0x49')],'context':_0x1b2fc7['context']||_0x5c0104['context'],'priority':0x1})[_0xe7fb('0x1a')](function(_0x3a674e){_0x475716({'code':0xc8,'message':[_0x1b2fc7[_0xe7fb('0x2a')],_0x3a674e['message']['toLowerCase']()][_0xe7fb('0x28')]('\x20')});})[_0xe7fb('0x3a')](function(_0xad7c53){_0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f5,[_0x1b2fc7[_0xe7fb('0x2a')],_0xad7c53[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')));});}else{return _0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'Agents':function(_0x1ff5e7){return new Promise(function(_0xf423ab){var _0x12b91f=_['values'](_0x36ab90['agents']);if(_0x1ff5e7&&_0x1ff5e7['id']){var _0x125427=_[_0xe7fb('0x23')](_0x12b91f,function(_0x178395){return _0x178395['id']===_0x1ff5e7['id'];});_0xf423ab(_0x125427);}else{_0xf423ab({'count':_0x12b91f[_0xe7fb('0x22')],'rows':_0x12b91f});}});},'Telephones':function(){return new Promise(function(_0x8dd368){var _0x562493=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x4a')]);_0x8dd368({'count':_0x562493[_0xe7fb('0x22')],'rows':_0x562493});});},'Trunks':function(){return new Promise(function(_0x1457fc){var _0x16553c=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x4b')]);_0x1457fc({'count':_0x16553c[_0xe7fb('0x22')],'rows':_0x16553c});});},'OutboundChannels':function(){return new Promise(function(_0xa7fa61){var _0x51eaec=_[_0xe7fb('0x26')](_0x36ab90['outboundChannels']);_0xa7fa61({'count':_0x51eaec[_0xe7fb('0x22')],'rows':_0x51eaec});});},'Outbound':function(){return new Promise(function(_0x2f13f2){_0x2f13f2(_0x36ab90[_0xe7fb('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x31c159){var _0x318d06=_['values'](_0x36ab90[_0xe7fb('0x4d')]);_0x31c159({'count':_0x318d06[_0xe7fb('0x22')],'rows':_0x318d06});});},'VoiceQueuesPreview':function(_0x4fd57a){var _0x2bf4aa=this;return new Promise(function(_0x15d881,_0x172547){_0x5dbf04[_0xe7fb('0x4e')](_0x4fd57a['id'])[_0xe7fb('0x1a')](function(_0x3d139f){_0x15d881({'code':0xc8,'message':_0x3d139f[_0xe7fb('0x1b')]});})[_0xe7fb('0x3a')](function(_0x14b028){_0x172547(_0x2bf4aa[_0xe7fb('0x11')](0x1f4,_0x14b028[_0xe7fb('0x1b')]));});});},'EventManager':function(_0x52b8a1){var _0x4b5f7e=this;return new Promise(function(_0x48a015,_0x13265b){if(!_0x52b8a1[_0xe7fb('0x4f')]){return _0x13265b(_0x4b5f7e[_0xe7fb('0x11')](0x1f4,_0xe7fb('0x50')));}ami['emit'](_0xe7fb('0x51')+_0x52b8a1[_0xe7fb('0x4f')],_0x52b8a1[_0xe7fb('0x1b')]);_0x48a015({'code':0xc8,'message':_0x52b8a1});});},'FaxAccounts':function(){return new Promise(function(_0x138a5e){var _0x5982f9=_[_0xe7fb('0x26')](_0x36ab90['faxAccounts']);_0x138a5e({'count':_0x5982f9[_0xe7fb('0x22')],'rows':_0x5982f9});});},'SendFax':function(_0x325c51){var _0xd49119=this;return new Promise(function(_0x1d278d,_0x7c3f19){_0x290172['send'](_0x325c51)[_0xe7fb('0x1a')](function(_0x5b8f3e){_0x1d278d({'code':0xc8,'message':_0x5b8f3e[_0xe7fb('0x1b')]});})['catch'](function(_0x2aeeed){_0x7c3f19(_0xd49119[_0xe7fb('0x11')](0x1f4,_0x2aeeed['message']));});});},'CheckAfterSend':function(_0x2b6d69){var _0x31642f=this;return new Promise(function(_0xb19e94,_0x4181fd){_0x290172['checkAfterSend'](_0x2b6d69)[_0xe7fb('0x1a')](function(_0x277335){_0xb19e94({'code':0xc8,'message':_0x277335[_0xe7fb('0x1b')]});})['catch'](function(_0x11d5b6){_0x4181fd(_0x31642f['error'](0x1f4,_0x11d5b6['message']));});});}};var _0x511bdc=jayson[_0xe7fb('0x52')](_0x1f943f)[_0xe7fb('0x53')]();_0x511bdc['on']('error',function(_0xf40e0a){return _0x24cd67(_0xf40e0a);});_0x511bdc[_0xe7fb('0x7')](0x232a,_0xe7fb('0x54'),function(){console[_0xe7fb('0x55')](_0xe7fb('0x56'),0x232a);return _0x12d1b0(_0xe7fb('0x57')+0x232a);});});}; \ No newline at end of file +var _0x6b8f=['validate','../properties','../ami','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','pick','keys','reload','module','action','then','message','catch','username','join','command','Action','content','voiceQueues','hasOwnProperty','find','omit','undefined','values','length','isConnected','voicechannel','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','resolve','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','rows','voicequeuechannel','map','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util'];(function(_0x1936d5,_0xa17065){var _0x5a3a6c=function(_0x5b30b0){while(--_0x5b30b0){_0x1936d5['push'](_0x1936d5['shift']());}};_0x5a3a6c(++_0xa17065);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x515386,_0x56f44e){_0x515386=_0x515386-0x0;var _0x3f7765=_0x6b8f[_0x515386];return _0x3f7765;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var jayson=require('jayson/promise');var schema=require(_0xf6b8('0x1'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xf6b8('0x2'));var ami=require(_0xf6b8('0x3'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0xf6b8('0x4')]=function(_0xf25536,_0x347a0b,_0x549eac){return new Promise(function(_0x2d035e,_0x79c66d){var _0x446336={'QueuePause':function(_0x3c3430){return new Promise(function(_0x557910){var _0x5f07f4=util[_0xf6b8('0x5')]('%s/%s',_0xf6b8('0x6'),_0x3c3430[_0xf6b8('0x7')]);if(_0xf25536[_0xf6b8('0x8')]&&_0xf25536[_0xf6b8('0x8')][_0x5f07f4]&&_0xf25536[_0xf6b8('0x8')][_0x5f07f4][_0xf6b8('0x9')]){_0xf25536['timers'][_0x5f07f4]['updateAcw']();}if(_0xf25536['agents'][_0x5f07f4]){_0xf25536[_0xf6b8('0xa')][_0x5f07f4][_0xf6b8('0xb')]({'statePause':_0x3c3430[_0xf6b8('0xc')]?!![]:![]});}_0x557910({'code':0xc8,'message':_0xf6b8('0xd')});});},'Reload':function(_0x5a6118){var _0x4e5235=this;return new Promise(function(_0x748e77,_0x3899a9){if(ami['isConnected']()==![]){return _0x3899a9(_0x4e5235[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')]['username'],_0xf6b8('0x10')]['join']('\x20')));}_0x5a6118=_[_0xf6b8('0x11')](_0x5a6118,_[_0xf6b8('0x12')](properties[_0xf6b8('0x13')][_0xf6b8('0x14')]));_0x5a6118[_0xf6b8('0x15')]='Reload';return ami['Action'](_0x5a6118)[_0xf6b8('0x16')](function(_0x56508b){_0x748e77({'code':0xc8,'message':_0x56508b[_0xf6b8('0x17')]});})[_0xf6b8('0x18')](function(_0x4a93a8){_0x3899a9(_0x4e5235['error'](0x1f5,_0x4a93a8[_0xf6b8('0x17')]));});});},'Command':function(_0x2e2b29){var _0x3081db=this;return new Promise(function(_0x2cac60,_0x4df5f4){if(ami['isConnected']()==![]){return _0x4df5f4(_0x3081db['error'](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],'ami\x20disconnected'][_0xf6b8('0x1a')]('\x20')));}_0x2e2b29=_[_0xf6b8('0x11')](_0x2e2b29,_0xf6b8('0x1b'));_0x2e2b29[_0xf6b8('0x15')]='Command';return ami[_0xf6b8('0x1c')](_0x2e2b29)['then'](function(_0x22c52d){_0x2cac60({'code':0xc8,'message':_0x22c52d[_0xf6b8('0x1d')]});})[_0xf6b8('0x18')](function(_0x4127c9){_0x4df5f4(_0x3081db[_0xf6b8('0xe')](0x1f5,_0x4127c9[_0xf6b8('0x17')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4edd29){var _0x1aca8a=[];for(var _0x1ebfea in _0xf25536['voiceQueues']){if(_0xf25536[_0xf6b8('0x1e')][_0xf6b8('0x1f')](_0x1ebfea)){var _0x324057=_0xf25536[_0xf6b8('0x1e')][_0x1ebfea];var _0x3365b8=new VoiceQueueSummary(_0x324057);_0x1aca8a['push'](_0x3365b8);}}_0x4edd29({'count':_0x1aca8a['length'],'rows':_0x1aca8a});});},'UpdateVoiceQueue':function(_0xfa77d3){return new Promise(function(_0x9050c6,_0x5a9514){var _0x459ed0=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x1e')],{'id':parseInt(_0xfa77d3['id'])});var _0x5a7f55=_[_0xf6b8('0x21')](_0xfa77d3,['id']);if(_0x459ed0){for(var _0xc958f4 in _0x5a7f55){if(typeof _0x5a7f55[_0xc958f4]!=='undefined'&&typeof _0x459ed0[_0xc958f4]!==_0xf6b8('0x22')){_0x459ed0[_0xc958f4]=_0x5a7f55[_0xc958f4];}}_0x9050c6(_0x459ed0);}else{_0x5a9514();}});},'VoiceChannels':function(){return new Promise(function(_0xfdf601){var _0x324eeb=_[_0xf6b8('0x23')](_0xf25536['channels']);_0xfdf601({'count':_0x324eeb[_0xf6b8('0x24')],'rows':_0x324eeb});});},'VoiceChannelMixMonitor':function(_0xd984c0){var _0x4006a6=this;return new Promise(function(_0x48b07f,_0x7c7546){if(ami[_0xf6b8('0x25')]()==![]){return _0x7c7546(_0x4006a6[_0xf6b8('0xe')](0x1f4,[config['asterisk']['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],_0xf6b8('0x10')][_0xf6b8('0x1a')]('\x20')));}var _0x4be3cb=schema(properties[_0xf6b8('0x26')])[_0xf6b8('0x1')](_0xd984c0);if(_0x4be3cb[_0xf6b8('0x24')]>0x0){return _0x7c7546(_0x4006a6['error'](0x1f4,_['map'](_0x4be3cb,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x258e69=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x27')],{'uniqueid':_0xd984c0[_0xf6b8('0x28')]});if(_0x258e69&&_0x258e69[_0xf6b8('0x29')]){var _0x7aaa3c=util[_0xf6b8('0x5')](_0xf6b8('0x2a'),_0xd984c0[_0xf6b8('0x2b')]||_0xd984c0[_0xf6b8('0x28')],_0xd984c0[_0xf6b8('0x5')]||_0xf6b8('0x2c'));return ami[_0xf6b8('0x1c')]({'action':_0xf6b8('0x2d'),'channel':_0x258e69[_0xf6b8('0x29')],'file':_0x7aaa3c,'options':_0xf6b8('0x2e')})['then'](function(_0x54a675){var _0x2b1e36=_[_0xf6b8('0x20')](_0x258e69[_0xf6b8('0x2f')],{'filename':_0xf6b8('0x30')+_0x7aaa3c[_0xf6b8('0x31')]()});if(_[_0xf6b8('0x32')](_0x2b1e36)){_0x258e69[_0xf6b8('0x2f')][_0xf6b8('0x33')]({'filename':_0xf6b8('0x30')+_0x7aaa3c[_0xf6b8('0x31')](),'createdAt':moment()[_0xf6b8('0x5')](_0xf6b8('0x34')),'mixmonitorid':_0x54a675['mixmonitorid'],'status':_0xf6b8('0x35')});}else{_0x2b1e36[_0xf6b8('0x36')]=_0x54a675['mixmonitorid'];_0x2b1e36[_0xf6b8('0x37')]=_0xf6b8('0x35');}_0x48b07f({'code':0xc8,'message':[_0xd984c0[_0xf6b8('0x28')],_0xf6b8('0x38'),_0x54a675[_0xf6b8('0x36')]][_0xf6b8('0x1a')]('\x20'),'mixmonitorid':_0x54a675[_0xf6b8('0x36')]});})[_0xf6b8('0x18')](function(_0x1c42fe){_0x7c7546(_0x4006a6[_0xf6b8('0xe')](0x1f5,[_0xd984c0[_0xf6b8('0x28')],_0x1c42fe[_0xf6b8('0x17')][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x7c7546(_0x4006a6['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f42c2){var _0x3bb212=this;return new Promise(function(_0x2c68f5,_0x45daea){if(ami[_0xf6b8('0x25')]()==![]){return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')]['username'],_0xf6b8('0x10')]['join']('\x20')));}var _0x2040fb=schema(properties[_0xf6b8('0x26')])[_0xf6b8('0x1')](_0x5f42c2);if(_0x2040fb[_0xf6b8('0x24')]>0x0){return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f4,_['map'](_0x2040fb,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x126850=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x27')],{'uniqueid':_0x5f42c2['uniqueid']});if(_0x126850){return Promise[_0xf6b8('0x39')]()[_0xf6b8('0x16')](function(){if(_0x126850[_0xf6b8('0x29')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x126850[_0xf6b8('0x29')],'mixmonitorid':_0x5f42c2[_0xf6b8('0x36')]})[_0xf6b8('0x18')](function(){});}})[_0xf6b8('0x16')](function(){if(_0x126850['destinationchannel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x126850[_0xf6b8('0x3a')],'mixmonitorid':_0x5f42c2['mixmonitorid']})[_0xf6b8('0x18')](function(){});}})[_0xf6b8('0x16')](function(){var _0x12f582=_[_0xf6b8('0x20')](_0x126850[_0xf6b8('0x2f')],{'mixmonitorid':_0x5f42c2[_0xf6b8('0x36')]});if(_0x12f582){_0x12f582[_0xf6b8('0x37')]=_0xf6b8('0x3b');}})[_0xf6b8('0x16')](function(){var _0x597511=util[_0xf6b8('0x5')]('%s.%s',_0x5f42c2[_0xf6b8('0x2b')]||_0x5f42c2[_0xf6b8('0x28')],_0x5f42c2[_0xf6b8('0x5')]||_0xf6b8('0x2c'));var _0x1abf17=_[_0xf6b8('0x20')](_0x126850[_0xf6b8('0x2f')],{'filename':'/var/spool/asterisk/monitor/'+_0x597511[_0xf6b8('0x31')]()});if(_0x1abf17){_0x1abf17[_0xf6b8('0x37')]=_0xf6b8('0x3b');}})[_0xf6b8('0x16')](function(){_0x2c68f5({'code':0xc8,'message':[_0x5f42c2['uniqueid'],_0xf6b8('0x3c')][_0xf6b8('0x1a')]('\x20')});})['catch'](function(_0x3a38eb){_0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f5,[_0x5f42c2[_0xf6b8('0x28')],_0x3a38eb[_0xf6b8('0x17')][_0xf6b8('0x31')]()]['join']('\x20')));});}else{return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannels':function(_0x5754eb){var _0x497b26=this;return new Promise(function(_0x55c392){var _0x22c1eb=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x3e')]);var _0xc20eee={'count':_0x22c1eb['length'],'rows':_0x22c1eb};if(_0x5754eb&&_0x5754eb[_0xf6b8('0x3f')]){if(![_0xf6b8('0x40'),_0xf6b8('0x41')][_0xf6b8('0x42')](_0x5754eb[_0xf6b8('0x3f')])){return _0x79c66d(_0x497b26[_0xf6b8('0xe')](0x190,_0xf6b8('0x43')));}var _0x4e4c90=_['filter'](_0x22c1eb,function(_0x4b81a0){return _0x4b81a0[_0xf6b8('0x3f')]===_0x5754eb['type'];});_0xc20eee['count']=_0x4e4c90[_0xf6b8('0x24')];_0xc20eee[_0xf6b8('0x44')]=_0x4e4c90;}_0x55c392(_0xc20eee);});},'VoiceQueuesChannel':function(_0x15965a){var _0x25cf3d=this;return new Promise(function(_0x34ca51,_0x1190f3){var _0x4f78e0=schema(properties[_0xf6b8('0x45')])[_0xf6b8('0x1')](_0x15965a);if(_0x4f78e0[_0xf6b8('0x24')]>0x0){return _0x1190f3(_0x25cf3d[_0xf6b8('0xe')](0x1f4,_['map'](_0x4f78e0,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x5c27b1=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x15965a[_0xf6b8('0x28')]});if(_0x5c27b1){_0x34ca51(_0x5c27b1);}else{return _0x1190f3(_0x25cf3d['error'](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannelHangup':function(_0x38720f){var _0x3e8213=this;return new Promise(function(_0x8c5d73,_0x37db90){if(ami[_0xf6b8('0x25')]()==![]){return _0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],_0xf6b8('0x10')][_0xf6b8('0x1a')]('\x20')));}var _0x5d124b=schema(properties['voicequeuechannelhangup'])['validate'](_0x38720f);if(_0x5d124b[_0xf6b8('0x24')]>0x0){return _0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f4,_[_0xf6b8('0x46')](_0x5d124b,_0xf6b8('0x17'))['join'](',\x20')));}var _0x1b7c82=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x38720f['uniqueid']});if(_0x1b7c82&&_0x1b7c82[_0xf6b8('0x29')]){return ami[_0xf6b8('0x1c')]({'action':_0xf6b8('0x47'),'channel':_0x1b7c82['channel']})['then'](function(_0x9105bb){_0x8c5d73({'code':0xc8,'message':[_0x38720f[_0xf6b8('0x28')],_0x9105bb[_0xf6b8('0x17')][_0xf6b8('0x31')]()]['join']('\x20')});})[_0xf6b8('0x18')](function(_0x5ebf65){_0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f5,[_0x38720f[_0xf6b8('0x28')],_0x5ebf65[_0xf6b8('0x17')][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x37db90(_0x3e8213['error'](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannelRedirect':function(_0x1f869b){var _0x227f5e=this;return new Promise(function(_0x28e1d7,_0x1980de){if(ami[_0xf6b8('0x25')]()==![]){return _0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],'ami\x20disconnected'][_0xf6b8('0x1a')]('\x20')));}var _0x135ce3=schema(properties[_0xf6b8('0x48')])['validate'](_0x1f869b);if(_0x135ce3[_0xf6b8('0x24')]>0x0){return _0x1980de(_0x227f5e['error'](0x1f4,_[_0xf6b8('0x46')](_0x135ce3,'message')['join'](',\x20')));}var _0x3c4e8a=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x1f869b[_0xf6b8('0x28')]});if(_0x3c4e8a&&_0x3c4e8a[_0xf6b8('0x29')]){return ami['Action']({'action':_0xf6b8('0x49'),'channel':_0x3c4e8a[_0xf6b8('0x29')],'exten':_0x1f869b['exten'],'context':_0x1f869b['context']||_0x3c4e8a[_0xf6b8('0x4a')],'priority':0x1})[_0xf6b8('0x16')](function(_0xdb1c77){_0x28e1d7({'code':0xc8,'message':[_0x1f869b[_0xf6b8('0x28')],_0xdb1c77[_0xf6b8('0x17')]['toLowerCase']()]['join']('\x20')});})[_0xf6b8('0x18')](function(_0x2d86fc){_0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f5,[_0x1f869b[_0xf6b8('0x28')],_0x2d86fc['message'][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f5,_0xf6b8('0x3d')));}});},'Agents':function(_0x3b06c8){return new Promise(function(_0x2e43a1){var _0x7a8ae6=_['values'](_0xf25536['agents']);if(_0x3b06c8&&_0x3b06c8['id']){var _0x2d32bb=_[_0xf6b8('0x20')](_0x7a8ae6,function(_0x3f3969){return _0x3f3969['id']===_0x3b06c8['id'];});_0x2e43a1(_0x2d32bb);}else{_0x2e43a1({'count':_0x7a8ae6[_0xf6b8('0x24')],'rows':_0x7a8ae6});}});},'Telephones':function(){return new Promise(function(_0x4707ff){var _0x19c149=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x4b')]);_0x4707ff({'count':_0x19c149['length'],'rows':_0x19c149});});},'Trunks':function(){return new Promise(function(_0x2d3bae){var _0x213a14=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x4c')]);_0x2d3bae({'count':_0x213a14[_0xf6b8('0x24')],'rows':_0x213a14});});},'OutboundChannels':function(){return new Promise(function(_0x55f2ae){var _0x3af46c=_['values'](_0xf25536[_0xf6b8('0x4d')]);_0x55f2ae({'count':_0x3af46c[_0xf6b8('0x24')],'rows':_0x3af46c});});},'Outbound':function(){return new Promise(function(_0x2d6261){_0x2d6261(_0xf25536[_0xf6b8('0x41')]);});},'Campaigns':function(){return new Promise(function(_0x141d6a){var _0x4492f6=_['values'](_0xf25536[_0xf6b8('0x4e')]);_0x141d6a({'count':_0x4492f6[_0xf6b8('0x24')],'rows':_0x4492f6});});},'VoiceQueuesPreview':function(_0x1c6692){var _0x3d76ee=this;return new Promise(function(_0x396a7c,_0x3d6e09){_0x347a0b[_0xf6b8('0x4f')](_0x1c6692['id'])['then'](function(_0x288449){_0x396a7c({'code':0xc8,'message':_0x288449[_0xf6b8('0x17')]});})['catch'](function(_0x286e8d){_0x3d6e09(_0x3d76ee[_0xf6b8('0xe')](0x1f4,_0x286e8d[_0xf6b8('0x17')]));});});},'EventManager':function(_0x288b94){var _0x57fcdb=this;return new Promise(function(_0x23ef5e,_0x452de0){if(!_0x288b94[_0xf6b8('0x50')]){return _0x452de0(_0x57fcdb['error'](0x1f4,_0xf6b8('0x51')));}ami['emit']('custom:'+_0x288b94[_0xf6b8('0x50')],_0x288b94[_0xf6b8('0x17')]);_0x23ef5e({'code':0xc8,'message':_0x288b94});});},'FaxAccounts':function(){return new Promise(function(_0x36a84c){var _0x2b1c7d=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x52')]);_0x36a84c({'count':_0x2b1c7d[_0xf6b8('0x24')],'rows':_0x2b1c7d});});},'SendFax':function(_0x2e66bf){var _0x3292d3=this;return new Promise(function(_0x18949a,_0xa03ad3){_0x549eac[_0xf6b8('0x53')](_0x2e66bf)[_0xf6b8('0x16')](function(_0x4684b2){_0x18949a({'code':0xc8,'message':_0x4684b2[_0xf6b8('0x17')]});})['catch'](function(_0x4d9845){_0xa03ad3(_0x3292d3[_0xf6b8('0xe')](0x1f4,_0x4d9845[_0xf6b8('0x17')]));});});},'CheckAfterSend':function(_0x5b113b){var _0x171db9=this;return new Promise(function(_0x1b4dee,_0x3b4df4){_0x549eac[_0xf6b8('0x54')](_0x5b113b)['then'](function(_0x3cd8fc){_0x1b4dee({'code':0xc8,'message':_0x3cd8fc[_0xf6b8('0x17')]});})[_0xf6b8('0x18')](function(_0x48829d){_0x3b4df4(_0x171db9['error'](0x1f4,_0x48829d['message']));});});}};var _0x3e174b=jayson[_0xf6b8('0x55')](_0x446336)['http']();_0x3e174b['on'](_0xf6b8('0xe'),function(_0x51800b){return _0x79c66d(_0x51800b);});_0x3e174b[_0xf6b8('0x4')](0x232a,_0xf6b8('0x56'),function(){console['log'](_0xf6b8('0x57'),0x232a);return _0x2d035e(_0xf6b8('0x58')+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 ccf3d24..1eda97c 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 _0x20a2=['calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','data3','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled'];(function(_0x134d29,_0x12d260){var _0x27f0c4=function(_0x13e82a){while(--_0x13e82a){_0x134d29['push'](_0x134d29['shift']());}};_0x27f0c4(++_0x12d260);}(_0x20a2,0xf2));var _0x220a=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x20a2[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x220a('0x0'));var BPromise=require(_0x220a('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x220a('0x2'));var logger=require(_0x220a('0x3'))(_0x220a('0x4'));var cmContactRpc=require(_0x220a('0x5'));config[_0x220a('0x6')]=_[_0x220a('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x220a('0x8'))(new Redis(config[_0x220a('0x6')]));function emit(_0x2eeae8,_0x232828,_0x66fa55,_0x57030d,_0x2970ac){logger[_0x220a('0x9')](_0x220a('0xa'),_0x2eeae8,_0x232828['id'],_0x66fa55,_0x57030d,JSON[_0x220a('0xb')](_0x2970ac));io['to'](_0x66fa55)[_0x220a('0xc')](_0x57030d,_0x2970ac);}exports[_0x220a('0xd')]=function(_0x23aadc,_0x45782f,_0x298cda,_0xaef9b1){var _0x5368e9,_0x237bef;var _0x13dbb3={};var _0x565e36;var _0x1e675b=Number(_0x298cda['data1']);var _0x21c426=_0x298cda[_0x220a('0xe')]?Boolean(Number(_0x298cda[_0x220a('0xe')])):![];var _0x89d350;var _0x4803c6=![];if(!_[_0x220a('0xf')](_0x298cda[_0x220a('0x10')])){if(_0x298cda['data5']=='1')_0x4803c6=!![];}if(!_0x4803c6){if(_0xaef9b1[_0x220a('0x11')]){_0x13dbb3['id']=_0xaef9b1[_0x220a('0x11')];}}if(!_0x13dbb3['id']){_0x13dbb3['ListId']=_0x1e675b;_0x89d350=_0x298cda[_0x220a('0x12')]&&_0x298cda[_0x220a('0x12')]!=='0'?_0x298cda[_0x220a('0x12')]['split'](','):[_0x220a('0x13')];_0x13dbb3['$or']=_[_0x220a('0x14')](_0x89d350,function(_0x124c28){var _0x2a1b42={};_0x2a1b42[_0x124c28]=_0xaef9b1[_0x220a('0x15')]?_0xaef9b1[_0x220a('0x16')]:_0xaef9b1[_0x220a('0x17')];return _0x2a1b42;});_0x565e36=_0xaef9b1[_0x220a('0x15')]?_0xaef9b1[_0x220a('0x16')]:_0xaef9b1['calleridnum'];}var _0x417980=['id',_0x220a('0x18'),_0x220a('0x19'),_0x220a('0x13'),_0x220a('0x1a'),_0x220a('0x1b'),_0x220a('0x1c'),_0x220a('0x1d'),_0x220a('0x1e'),_0x220a('0x1f')];var _0x5be1fb=_['union'](_0x417980,_0x89d350);BPromise[_0x220a('0x20')]()[_0x220a('0x21')](cmContactRpc[_0x220a('0x22')]({'attributes':_0x5be1fb,'where':_0x13dbb3,'phone':_0x565e36}))[_0x220a('0x21')](function(_0x2dae9f){_0x237bef=_0x2dae9f;if(!_[_0x220a('0x23')](_0x237bef)){if(_0x237bef[_0x220a('0x24')]===0x1){_0x5368e9=_0x237bef[0x0];logger[_0x220a('0x9')](_0x220a('0x25'),_0xaef9b1['uniqueid'],_0x45782f['id'],_0x5368e9['id']);}else{logger[_0x220a('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xaef9b1[_0x220a('0x26')],_0x45782f['id'],_['map'](_0x237bef,'id')[_0x220a('0x27')](','));}return;}else{logger[_0x220a('0x9')](_0x220a('0x28'),_0xaef9b1[_0x220a('0x26')],_0x45782f['id']);var _0x4378b2={'ListId':_0x1e675b};var _0x3ca893=_0x298cda['data4']&&_0x298cda[_0x220a('0x29')]!=='0'?_0x298cda['data4']:_0x220a('0x13');if(_0x21c426){logger[_0x220a('0x9')](_0x220a('0x2a'),_0xaef9b1[_0x220a('0x26')],_0x45782f['id']);_0x4378b2[_0x3ca893]=_[_0x220a('0xf')](_0xaef9b1[_0x220a('0x15')])?_0xaef9b1[_0x220a('0x17')]:_0xaef9b1[_0x220a('0x16')];if(_[_0x220a('0xf')](_0xaef9b1[_0x220a('0x15')])){_0x4378b2[_0x220a('0x18')]=_0xaef9b1[_0x220a('0x2b')]&&_0xaef9b1[_0x220a('0x2b')]!==_0x220a('0x2c')?_0xaef9b1[_0x220a('0x2b')]:_0x220a('0x2d');}else{_0x4378b2[_0x220a('0x18')]=_0xaef9b1[_0x220a('0x2e')]&&_0xaef9b1[_0x220a('0x2e')]!==_0x220a('0x2c')?_0xaef9b1['destcalleridname']:_0x220a('0x2d');}return BPromise[_0x220a('0x20')]()['then'](cmContactRpc[_0x220a('0x2f')](_0x4378b2))[_0x220a('0x21')](function(_0x3c9de7){_0x5368e9=_0x3c9de7;_0x237bef['push'](_0x3c9de7);if(_0x5368e9){logger['info'](_0x220a('0x30'),_0xaef9b1[_0x220a('0x26')],_0x45782f['id'],_0x5368e9['id']);}return;});}else{logger[_0x220a('0x9')](_0x220a('0x31'),_0xaef9b1[_0x220a('0x26')],_0x45782f['id']);_0x4378b2[_0x3ca893]=_[_0x220a('0xf')](_0xaef9b1[_0x220a('0x15')])?_0xaef9b1[_0x220a('0x17')]:_0xaef9b1['destcalleridnum'];if(_[_0x220a('0xf')](_0xaef9b1['routeId'])){_0x4378b2[_0x220a('0x18')]=_0xaef9b1[_0x220a('0x2b')]&&_0xaef9b1[_0x220a('0x2b')]!==_0x220a('0x2c')?_0xaef9b1[_0x220a('0x2b')]:_0x220a('0x2d');}else{_0x4378b2[_0x220a('0x18')]=_0xaef9b1[_0x220a('0x2e')]&&_0xaef9b1[_0x220a('0x2e')]!==_0x220a('0x2c')?_0xaef9b1[_0x220a('0x2e')]:_0x220a('0x2d');}_0x5368e9=_0x4378b2;_0x237bef[_0x220a('0x32')](_0x4378b2);return;}}})[_0x220a('0x21')](function(){if(_0x23aadc){emit(_0xaef9b1['uniqueid'],_0x45782f,util['format'](_0x220a('0x33'),_0x23aadc[_0x220a('0x34')]),util['format'](_0x220a('0x35'),_0x298cda[_0x220a('0x36')][_0x220a('0x37')]()),{'evt':_[_0x220a('0x38')](_0xaef9b1,{'autoCreate':_0x21c426}),'contact':_0x5368e9===undefined?{}:_0x5368e9,'contacts':_0x237bef[_0x220a('0x24')]===0x0?undefined:_0x237bef});}});}; \ No newline at end of file +var _0x3c8b=['redis','defaults','localhost','socket.io-emitter','info','exec','data2','data5','xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','ListId','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x169e1f,_0x101e5d){_0x169e1f=_0x169e1f-0x0;var _0x187d4f=_0x3c8b[_0x169e1f];return _0x187d4f;};'use strict';var _=require('lodash');var BPromise=require(_0xb3c8('0x0'));var Redis=require('ioredis');var util=require(_0xb3c8('0x1'));var config=require(_0xb3c8('0x2'));var logger=require(_0xb3c8('0x3'))('trigger');var cmContactRpc=require(_0xb3c8('0x4'));config[_0xb3c8('0x5')]=_[_0xb3c8('0x6')](config[_0xb3c8('0x5')],{'host':_0xb3c8('0x7'),'port':0x18eb});var io=require(_0xb3c8('0x8'))(new Redis(config[_0xb3c8('0x5')]));function emit(_0x375af0,_0x47aa5b,_0x13c8f3,_0x5ec6a7,_0x460956){logger[_0xb3c8('0x9')]('[CM][%s][%s]',_0x375af0,_0x47aa5b['id'],_0x13c8f3,_0x5ec6a7,JSON['stringify'](_0x460956));io['to'](_0x13c8f3)['emit'](_0x5ec6a7,_0x460956);}exports[_0xb3c8('0xa')]=function(_0x363230,_0xdf4041,_0x508b1f,_0x3f88f6){var _0x12963c,_0x21eac8;var _0x135ee8={};var _0x5427a9;var _0x1048ae=Number(_0x508b1f['data1']);var _0x4c2d04=_0x508b1f['data2']?Boolean(Number(_0x508b1f[_0xb3c8('0xb')])):![];var _0x36a816;var _0x34d866=![];if(!_['isNil'](_0x508b1f['data5'])){if(_0x508b1f[_0xb3c8('0xc')]=='1')_0x34d866=!![];}if(!_0x34d866){if(_0x3f88f6[_0xb3c8('0xd')]){_0x135ee8['id']=_0x3f88f6[_0xb3c8('0xd')];}}if(!_0x135ee8['id']){_0x135ee8['ListId']=_0x1048ae;_0x36a816=_0x508b1f['data3']&&_0x508b1f[_0xb3c8('0xe')]!=='0'?_0x508b1f[_0xb3c8('0xe')][_0xb3c8('0xf')](','):['phone'];_0x135ee8[_0xb3c8('0x10')]=_[_0xb3c8('0x11')](_0x36a816,function(_0x385f8b){var _0x401b55={};_0x401b55[_0x385f8b]=_0x3f88f6[_0xb3c8('0x12')]?_0x3f88f6[_0xb3c8('0x13')]:_0x3f88f6[_0xb3c8('0x14')];return _0x401b55;});_0x5427a9=_0x3f88f6[_0xb3c8('0x12')]?_0x3f88f6[_0xb3c8('0x13')]:_0x3f88f6['calleridnum'];}var _0x58db91=['id',_0xb3c8('0x15'),'lastName','phone',_0xb3c8('0x16'),'fax',_0xb3c8('0x17'),'createdAt','scheduledAt',_0xb3c8('0x18')];var _0x50fa67=_[_0xb3c8('0x19')](_0x58db91,_0x36a816);BPromise[_0xb3c8('0x1a')]()[_0xb3c8('0x1b')](cmContactRpc['getContacts']({'attributes':_0x50fa67,'where':_0x135ee8,'phone':_0x5427a9}))[_0xb3c8('0x1b')](function(_0x541df4){_0x21eac8=_0x541df4;if(!_[_0xb3c8('0x1c')](_0x21eac8)){if(_0x21eac8[_0xb3c8('0x1d')]===0x1){_0x12963c=_0x21eac8[0x0];logger[_0xb3c8('0x9')](_0xb3c8('0x1e'),_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041['id'],_0x12963c['id']);}else{logger[_0xb3c8('0x9')](_0xb3c8('0x20'),_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041['id'],_[_0xb3c8('0x11')](_0x21eac8,'id')['join'](','));}return;}else{logger[_0xb3c8('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041['id']);var _0x1c5bca={'ListId':_0x1048ae};var _0x2ef1ad=_0x508b1f[_0xb3c8('0x21')]&&_0x508b1f['data4']!=='0'?_0x508b1f[_0xb3c8('0x21')]:_0xb3c8('0x22');if(_0x4c2d04){logger[_0xb3c8('0x9')](_0xb3c8('0x23'),_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041['id']);_0x1c5bca[_0x2ef1ad]=_[_0xb3c8('0x24')](_0x3f88f6[_0xb3c8('0x12')])?_0x3f88f6['calleridnum']:_0x3f88f6[_0xb3c8('0x13')];if(_[_0xb3c8('0x24')](_0x3f88f6['routeId'])){_0x1c5bca[_0xb3c8('0x15')]=_0x3f88f6[_0xb3c8('0x25')]&&_0x3f88f6[_0xb3c8('0x25')]!==_0xb3c8('0x26')?_0x3f88f6[_0xb3c8('0x25')]:_0xb3c8('0x27');}else{_0x1c5bca[_0xb3c8('0x15')]=_0x3f88f6['destcalleridname']&&_0x3f88f6[_0xb3c8('0x28')]!==_0xb3c8('0x26')?_0x3f88f6[_0xb3c8('0x28')]:_0xb3c8('0x27');}return BPromise[_0xb3c8('0x1a')]()['then'](cmContactRpc[_0xb3c8('0x29')](_0x1c5bca))[_0xb3c8('0x1b')](function(_0x44a840){_0x12963c=_0x44a840;_0x21eac8[_0xb3c8('0x2a')](_0x44a840);if(_0x12963c){logger[_0xb3c8('0x9')](_0xb3c8('0x2b'),_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041['id'],_0x12963c['id']);}return;});}else{logger[_0xb3c8('0x9')](_0xb3c8('0x2c'),_0x3f88f6['uniqueid'],_0xdf4041['id']);_0x1c5bca[_0x2ef1ad]=_[_0xb3c8('0x24')](_0x3f88f6['routeId'])?_0x3f88f6[_0xb3c8('0x14')]:_0x3f88f6[_0xb3c8('0x13')];if(_[_0xb3c8('0x24')](_0x3f88f6[_0xb3c8('0x12')])){_0x1c5bca[_0xb3c8('0x15')]=_0x3f88f6[_0xb3c8('0x25')]&&_0x3f88f6['calleridname']!==_0xb3c8('0x26')?_0x3f88f6['calleridname']:_0xb3c8('0x27');}else{_0x1c5bca[_0xb3c8('0x15')]=_0x3f88f6[_0xb3c8('0x28')]&&_0x3f88f6[_0xb3c8('0x28')]!==''?_0x3f88f6[_0xb3c8('0x28')]:_0xb3c8('0x27');}_0x12963c=_0x1c5bca;_0x21eac8[_0xb3c8('0x2a')](_0x1c5bca);return;}}})[_0xb3c8('0x1b')](function(){if(_0x363230){emit(_0x3f88f6[_0xb3c8('0x1f')],_0xdf4041,util[_0xb3c8('0x2d')]('user:%s',_0x363230[_0xb3c8('0x2e')]),util[_0xb3c8('0x2d')](_0xb3c8('0x2f'),_0x508b1f[_0xb3c8('0x30')][_0xb3c8('0x31')]()),{'evt':_['merge'](_0x3f88f6,{'autoCreate':_0x4c2d04}),'contact':_0x12963c===undefined?{}:_0x12963c,'contacts':_0x21eac8['length']===0x0?undefined:_0x21eac8});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fb5830c..cd5c98c 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 _0xacc6=['custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialend','syncAgentDial','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','info','clone','motionChannel','voice','checkTriggers','prototype','hasOwnProperty','merge','variables','Actions','length','interface','action','toLowerCase','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','windowWidth','data5','800','data6','600','winApplication','winArguments','format','user:%s','trigger:%s:%s','data1','jscripty','name','contactmanager','exec','queue','script','parse','query','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','operator','ChatWebsiteId','AccountId','value','interaction','message','event','membername','lastevent','routeId','mailSubstatus','null','substatus','undefined','offlineMessage','equals','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/logger','../ami','redis','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect'];(function(_0x2b3b7a,_0x253924){var _0x394c33=function(_0xf7e30d){while(--_0xf7e30d){_0x2b3b7a['push'](_0x2b3b7a['shift']());}};_0x394c33(++_0x253924);}(_0xacc6,0x150));var _0x6acc=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0xacc6[_0x335271];return _0xa9fff8;};'use strict';var util=require(_0x6acc('0x0'));var _=require(_0x6acc('0x1'));var url=require(_0x6acc('0x2'));var Mustache=require(_0x6acc('0x3'));var Redis=require(_0x6acc('0x4'));var urlforward=require('./urlforward');var integration=require(_0x6acc('0x5'));var cmContact=require(_0x6acc('0x6'));var script=require(_0x6acc('0x7'));var config=require('../../../config/environment');var logger=require(_0x6acc('0x8'))('trigger');var ami=require(_0x6acc('0x9'));config[_0x6acc('0xa')]=_['defaults'](config[_0x6acc('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6acc('0xb'))(new Redis(config[_0x6acc('0xa')]));var operators={'equals':function(_0x23d253,_0x3b248e){return _0x23d253==_0x3b248e;},'not_equals':function(_0x4d6b7f,_0x1343cb){return _0x4d6b7f!=_0x1343cb;}};var barAndWebActions=['popup',_0x6acc('0x2'),_0x6acc('0xc')];function Trigger(_0xb8647d){this[_0x6acc('0xd')]=_0xb8647d[_0x6acc('0xd')];this[_0x6acc('0xe')]=_0xb8647d['agents'];this[_0x6acc('0xf')]=_0xb8647d[_0x6acc('0xf')];this[_0x6acc('0x10')]=_0xb8647d[_0x6acc('0x10')];this[_0x6acc('0x11')]=_0xb8647d['voiceExtensions'];this['zendeskAccounts']=_0xb8647d[_0x6acc('0x12')];this[_0x6acc('0x13')]=_0xb8647d[_0x6acc('0x13')];this[_0x6acc('0x14')]=_0xb8647d[_0x6acc('0x14')];this[_0x6acc('0x15')]=_0xb8647d[_0x6acc('0x15')];this[_0x6acc('0x16')]=_0xb8647d[_0x6acc('0x16')];this[_0x6acc('0x17')]=_0xb8647d[_0x6acc('0x17')];this[_0x6acc('0x18')]=_0xb8647d[_0x6acc('0x18')];this[_0x6acc('0x19')]=_0xb8647d[_0x6acc('0x19')];this[_0x6acc('0x1a')]=_0xb8647d[_0x6acc('0x1a')];this[_0x6acc('0x1b')]=_0xb8647d['freshsalesAccounts'];this[_0x6acc('0x1c')]={'zendesk':this[_0x6acc('0x12')],'salesforce':this[_0x6acc('0x14')],'freshdesk':this[_0x6acc('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6acc('0x16')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x6acc('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6acc('0x19')]};ami['on'](_0x6acc('0x1d'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x20'),this['syncCustomEvent'][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x21'),this['syncCustomEvent'][_0x6acc('0x1f')](this));ami['on']('custom:agentcomplete',this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x22'),this[_0x6acc('0x1e')]['bind'](this));ami['on'](_0x6acc('0x23'),this[_0x6acc('0x1e')]['bind'](this));ami['on'](_0x6acc('0x24'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x25'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x26'),this[_0x6acc('0x1e')]['bind'](this));ami['on'](_0x6acc('0x27'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x28'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x29'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x2a'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x2b'),this[_0x6acc('0x2c')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x2d'),this[_0x6acc('0x1e')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x2e'),this[_0x6acc('0x1e')]['bind'](this));ami['on'](_0x6acc('0x2f'),this[_0x6acc('0x1e')]['bind'](this));ami['on'](_0x6acc('0x30'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x6acc('0x1f')](this));ami['on'](_0x6acc('0x31'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6acc('0x32'),this[_0x6acc('0x1e')][_0x6acc('0x1f')](this));}Trigger['prototype'][_0x6acc('0x33')]=function(_0x1133f8,_0x103da4,_0x11c789){logger[_0x6acc('0x34')](_0x1133f8,_0x103da4,JSON['stringify'](_0x11c789));io['to'](_0x1133f8)[_0x6acc('0x33')](_0x103da4,_0x11c789);};Trigger['prototype'][_0x6acc('0x1e')]=function(_0x40c2ff){var _0x5d6c84=_[_0x6acc('0x35')](_0x40c2ff);if(typeof _0x5d6c84['motionChannel']==='undefined'){_0x5d6c84[_0x6acc('0x36')]=_0x6acc('0x37');}this[_0x6acc('0x38')](_0x5d6c84);};Trigger['prototype'][_0x6acc('0x2c')]=function(_0x490897){if(this[_0x6acc('0xe')][_0x490897['interface']]){this[_0x6acc('0x1e')](_0x490897);}};Trigger[_0x6acc('0x39')]['checkTriggers']=function(_0x14279b){var _0x118aed;for(var _0x1415b2 in this[_0x6acc('0xd')]){if(this[_0x6acc('0xd')][_0x6acc('0x3a')](_0x1415b2)){if(this[_0x6acc('0xd')][_0x1415b2]['status']){_0x118aed=this['checkTrigger'](this[_0x6acc('0xd')][_0x1415b2],_0x14279b);if(_0x118aed){_[_0x6acc('0x3b')](_0x14279b,_0x14279b[_0x6acc('0x3c')]);for(var _0x540820=0x0,_0x458126,_0x12df54,_0x24a8f0;_0x5408200x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x3c56e8,_0x2182dd){_0x3c56e8=_0x3c56e8-0x0;var _0x4474e7=_0xe14b[_0x3c56e8];return _0x4474e7;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 3c9d8f0..8b1624e 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 _0x572e=[']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','resolve','CloudProvider','data5','POST','clientId','username','password','then','access_token','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','calleridnum','/systemusers(','userId','Bearer\x20','body','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','&$filter=','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x364597,_0x1bfb47){var _0x4cf5a3=function(_0x14245d){while(--_0x14245d){_0x364597['push'](_0x364597['shift']());}};_0x4cf5a3(++_0x1bfb47);}(_0x572e,0x71));var _0xe572=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x572e[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xe572('0x0'));var rp=require(_0xe572('0x1'));var util=require(_0xe572('0x2'));var intUtil=require(_0xe572('0x3'));var md5=require(_0xe572('0x4'));var Redis=require(_0xe572('0x5'));var logger=require(_0xe572('0x6'))(_0xe572('0x7'));var config=require(_0xe572('0x8'));config['redis']=_[_0xe572('0x9')](config[_0xe572('0xa')],{'host':_0xe572('0xb'),'port':0x18eb});var io=require(_0xe572('0xc'))(new Redis(config[_0xe572('0xa')]));function getAuthToken(_0x257f58,_0x50648a,_0x368bd7){if(_0x257f58[_0xe572('0xd')]){_0x257f58[_0xe572('0xe')]=_0x257f58['CloudProvider'][_0xe572('0xf')];_0x257f58['tenantId']=_0x257f58['CloudProvider']['data2'];return Promise[_0xe572('0x10')](_0x257f58[_0xe572('0x11')][_0xe572('0x12')]);}var _0x16d437={'method':_0xe572('0x13'),'uri':_0x50648a,'form':{'client_id':_0x257f58[_0xe572('0x14')],'resource':_0x257f58[_0xe572('0xe')],'username':_0x257f58[_0xe572('0x15')],'password':_0x257f58[_0xe572('0x16')],'grant_type':_0xe572('0x16'),'client_secret':_0x257f58['clientSecret']},'json':!![]};return rp(_0x16d437)[_0xe572('0x17')](function(_0x43afef){return _0x43afef[_0xe572('0x18')];})['catch'](function(_0x2969d9){logger[_0xe572('0x19')]('['+[_0x368bd7['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2969d9[_0xe572('0x1a')];});}function getUser(_0x3b5f7f,_0x33519b,_0x32851a,_0x3835dc,_0x5d9925,_0x5a40bf){return new Promise(function(_0x36476d,_0x4ef558){return getAuthToken(_0x33519b,_0x3835dc,_0x5a40bf)[_0xe572('0x17')](function(_0x1fb7ba){var _0x391647={'method':_0xe572('0x1b'),'uri':_0x5d9925+_0xe572('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x1fb7ba,'OData-Version':_0xe572('0x1d')},'json':!![]};return rp(_0x391647);})[_0xe572('0x17')](function(_0x59dde9){var _0x2fb5a2=_0x59dde9[_0xe572('0x1e')];var _0x33a4e9=![];var _0x15bbee=null;if(!_['isNil'](_0x32851a)){if(intUtil[_0xe572('0x1f')](_0x32851a['email'])){_0x3b5f7f[_0xe572('0x20')]=_0x32851a[_0xe572('0x21')];for(_0x15bbee=0x0;_0x15bbee<_0x2fb5a2[_0xe572('0x22')];_0x15bbee++){if(_0x2fb5a2[_0x15bbee][_0xe572('0x23')]===_0x32851a[_0xe572('0x21')]&&!_0x2fb5a2[_0x15bbee][_0xe572('0x24')]){_0x33a4e9=!![];logger[_0xe572('0x25')]('['+[_0x5a40bf[_0xe572('0x26')]()]+_0xe572('0x27')+_0x2fb5a2[_0x15bbee][_0xe572('0x28')]+'!');_0x3b5f7f['userId']=_0x2fb5a2[_0x15bbee]['systemuserid'];}}}}if(!_0x33a4e9){logger[_0xe572('0x25')]('['+[_0x5a40bf[_0xe572('0x26')]()]+_0xe572('0x29'));_0x3b5f7f[_0xe572('0x20')]=_0x33519b[_0xe572('0x15')];for(_0x15bbee=0x0;_0x15bbee<_0x2fb5a2[_0xe572('0x22')];_0x15bbee++){if(_0x2fb5a2[_0x15bbee][_0xe572('0x23')]===_0x33519b['username']){_0x3b5f7f['userId']=_0x2fb5a2[_0x15bbee]['systemuserid'];}}}_0x36476d(_0x3b5f7f);})[_0xe572('0x2a')](function(_0x25bc3f){_0x4ef558(_0x25bc3f[_0xe572('0x1a')]);});});}function createEndUser(_0x43ff72,_0x45b977,_0x29e9a4,_0x1d8ca0,_0x115051,_0xb15f96,_0x5bd3ce){return new Promise(function(_0x30246f,_0x2fe155){return getAuthToken(_0x45b977,_0x29e9a4,_0xb15f96)[_0xe572('0x17')](function(_0x3def88){var _0x1a3e68=_0xb15f96['toLowerCase']()===_0xe572('0x2b')?_0x115051[_0xe572('0x2c')]:_0x115051[_0xe572('0x2d')];var _0x512537={'method':_0xe572('0x13'),'uri':_0x1d8ca0+'contacts','body':{'fullname':_0x1a3e68,'firstname':_0x1a3e68,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe572('0x2e')+_0x43ff72[_0xe572('0x2f')]+')'},'headers':{'Authorization':_0xe572('0x30')+_0x3def88,'OData-Version':_0xe572('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x512537[_0xe572('0x31')][_0x5bd3ce]=_0x1a3e68;return rp(_0x512537);})[_0xe572('0x17')](function(_0x2abb91){var _0x5dc0dc=_0x2abb91['headers'][_0xe572('0x32')];var _0x4d8d42=_0x5dc0dc[_0xe572('0x33')](_0x5dc0dc[_0xe572('0x34')]('(')+0x1,_0x5dc0dc[_0xe572('0x34')](')'));_0x43ff72[_0xe572('0x35')]=_0x4d8d42;_0x30246f(_0x43ff72);})[_0xe572('0x2a')](function(_0x4b117a){_0x2fe155(_0x4b117a[_0xe572('0x1a')]);});});}function getEndUser(_0x252a6f,_0x566af8,_0x198b1f,_0x3c34e0,_0x550994,_0x3daa7c,_0x2207ea,_0x935dd6){var _0x5a2327=_0x3daa7c[_0xe572('0x36')]()===_0xe572('0x2b')?_0x550994[_0xe572('0x2c')]:_0x550994['calleridnum'];return getAuthToken(_0x566af8,_0x198b1f,_0x3daa7c)['then'](function(_0x42bfcd){_0x935dd6=_0x935dd6?_0x935dd6:_0xe572('0x37');var _0x71b35a={'method':_0xe572('0x1b'),'uri':_0x3c34e0+_0xe572('0x38')+_0x935dd6+_0xe572('0x39')+_0x935dd6+'\x20eq\x20\x27'+_0x5a2327[_0xe572('0x3a')]('+',_0xe572('0x3b'))+'\x27','headers':{'Authorization':_0xe572('0x30')+_0x42bfcd,'If-None-Match':null,'OData-Version':_0xe572('0x1d')},'json':!![]};return rp(_0x71b35a);})[_0xe572('0x17')](function(_0x16aafe){var _0x2cad16=![];if(!_0x16aafe)return _0x2cad16;var _0x1e4d7c=_0x16aafe[_0xe572('0x1e')];for(var _0x59d6a9=0x0;_0x59d6a9<_0x1e4d7c[_0xe572('0x22')];_0x59d6a9++){if(_0x1e4d7c[_0x59d6a9][_0x935dd6]===_0x5a2327){_0x2cad16=!![];_0x252a6f[_0xe572('0x35')]=_0x1e4d7c[_0x59d6a9][_0xe572('0x3c')];}}return _0x2cad16;})[_0xe572('0x17')](function(_0x154cc7){if(_0x154cc7)return _0x252a6f;if(_0x2207ea==='nothing'){logger['info']('['+[_0x3daa7c[_0xe572('0x26')]()]+_0xe572('0x3d'));return _0x252a6f;}return createEndUser(_0x252a6f,_0x566af8,_0x198b1f,_0x3c34e0,_0x550994,_0x3daa7c,_0x935dd6)[_0xe572('0x17')](function(_0x38beaf){logger['info']('['+[_0x3daa7c[_0xe572('0x26')]()]+_0xe572('0x3e'),_0x38beaf[_0xe572('0x35')]);return _0x38beaf;});});}function getCustomFields(_0x5c98a2,_0x4d0620,_0x3fc686){var _0x2bfafc={};if(_0x5c98a2[_0xe572('0x22')]>0x0){_[_0xe572('0x3f')](_0x5c98a2,function(_0x1f9ff9){if(_['includes']([_0xe572('0x40'),'picklist'],_0x1f9ff9[_0xe572('0x41')])&&_0x1f9ff9['nameField']&&!_0x1f9ff9[_0xe572('0x42')]){var _0x2218a9=_0x1f9ff9[_0xe572('0x43')]['toLowerCase']();var _0x34190d=_0x2218a9['substring'](0x0,_0x2218a9[_0xe572('0x44')]('_'));var _0x9a8da=_0x2218a9[_0xe572('0x33')](_0x2218a9[_0xe572('0x44')]('_')+0x1);if(_0x34190d===_0x3fc686){_0x2bfafc[_0x9a8da]=_0x1f9ff9[_0xe572('0x45')];}}});}return _0x2bfafc;}function getTicket(_0x515124,_0x401e58,_0x4fef54,_0x30d4da,_0x26e3c9,_0x5ed032,_0x2c9ff1){return new Promise(function(_0x347d2d,_0x527887){var _0x52cfb7;return getAuthToken(_0x401e58,_0x4fef54,_0x2c9ff1)[_0xe572('0x17')](function(_0x542c40){if(_0x5ed032[_0xe572('0x46')]===_0xe572('0x47')){_0x52cfb7={'method':_0xe572('0x13'),'uri':_0x30d4da+_0xe572('0x48'),'body':Object['assign']({},{'title':intUtil[_0xe572('0x49')](_0x5ed032[_0xe572('0x4a')],_0x26e3c9,'\x20'),'description':intUtil['getString'](_0x5ed032[_0xe572('0x4b')],_0x26e3c9,'\x0a'),'customerid_contact@odata.bind':_0x515124[_0xe572('0x35')]?_0xe572('0x4c')+_0x515124[_0xe572('0x35')]+')':undefined,'ownerid@odata.bind':_0xe572('0x2e')+_0x515124[_0xe572('0x2f')]+')','caseorigincode':'1'},getCustomFields(_0x5ed032[_0xe572('0x4d')],_0x26e3c9,_0x5ed032[_0xe572('0x46')])),'headers':{'Authorization':_0xe572('0x30')+_0x542c40,'OData-Version':_0xe572('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5ed032[_0xe572('0x46')]===_0xe572('0x4e')){var _0x1734b2=_0x515124[_0xe572('0x35')]?[{'partyid_systemuser@odata.bind':_0xe572('0x2e')+_0x515124['userId']+')','participationtypemask':_0x515124['callDirection']===_0xe572('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x515124['enduserId']+')','participationtypemask':_0x515124[_0xe572('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe572('0x2e')+_0x515124['userId']+')','participationtypemask':_0x515124['callDirection']===_0xe572('0x4f')?0x2:0x1}];_0x52cfb7={'method':_0xe572('0x13'),'uri':_0x30d4da+'phonecalls','body':Object[_0xe572('0x51')]({},{'subject':intUtil['getString'](_0x5ed032[_0xe572('0x4a')],_0x26e3c9,'\x20'),'phonenumber':String(_0x26e3c9['calleridnum']),'description':intUtil['getString'](_0x5ed032[_0xe572('0x4b')],_0x26e3c9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x515124[_0xe572('0x35')]?'/contacts('+_0x515124[_0xe572('0x35')]+')':undefined,'ownerid@odata.bind':_0xe572('0x2e')+_0x515124[_0xe572('0x2f')]+')','directioncode':_0x515124[_0xe572('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1734b2},getCustomFields(_0x5ed032[_0xe572('0x4d')],_0x26e3c9,_0x5ed032[_0xe572('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x542c40,'OData-Version':_0xe572('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x52cfb7);})[_0xe572('0x17')](function(_0x3c04c4){var _0x5575cf=_0x3c04c4['headers']['odata-entityid'];var _0x1d51d5=_0x5575cf[_0xe572('0x33')](_0x5575cf['lastIndexOf']('(')+0x1,_0x5575cf[_0xe572('0x34')](')'));_0x515124['ticketId']=_0x1d51d5;_0x347d2d(_0x515124);})['catch'](function(_0x182d7f){_0x527887(_0x182d7f['message']);});});}function emit(_0x2bb7b7,_0x16300a,_0x55ecce,_0x3db5f7){var _0x453822={'uri':util[_0xe572('0x52')](_0xe572('0x53'),_0x2bb7b7,_0x55ecce,_0x3db5f7)};io['to'](util['format'](_0xe572('0x54'),_0x16300a))['emit'](_0xe572('0x55'),_0x453822);}exports['cs']=function(_0x310b6f,_0x2653a7,_0xfed87b,_0x1a49d7,_0x4fcc72,_0x58debb,_0x2444ce,_0x1b00dd){var _0x291af5={};_0x58debb[_0xe572('0xe')]=_0x58debb['modernAuthentication']?intUtil[_0xe572('0x56')](_0x58debb[_0xe572('0x11')][_0xe572('0xf')]):intUtil[_0xe572('0x56')](_0x58debb[_0xe572('0xe')]);_0x58debb[_0xe572('0x57')]=intUtil[_0xe572('0x56')](_0x58debb[_0xe572('0x57')]);_0x291af5[_0xe572('0x50')]=_0x1b00dd===_0xe572('0x4f')||_0x1b00dd===_0xe572('0x58')?_0xe572('0x4f'):_0xe572('0x2b');var _0x2a578d=_0x58debb[_0xe572('0xd')]?util[_0xe572('0x52')](_0xe572('0x59'),_0x58debb[_0xe572('0x11')][_0xe572('0xf')]):util[_0xe572('0x52')](_0xe572('0x59'),_0x58debb[_0xe572('0xe')]);var _0x2abb21=util[_0xe572('0x52')](_0xe572('0x5a'),_0x58debb['tenantId']);var _0x39693f=util[_0xe572('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58debb['serverUrl'],_0x2653a7['uniqueid'],md5(_0x2653a7[_0xe572('0x5b')]));if(_0x4fcc72&&_0x4fcc72[_0xe572('0x5c')]){logger[_0xe572('0x25')](_0xe572('0x5d'),'Recording\x20is\x20enabled!');_0x2653a7[_0xe572('0x5e')]=_0x39693f;}else if(_0x2444ce&&_0x2444ce[_0xe572('0x5f')]&&_0x2444ce[_0xe572('0x5f')]!=='none'){logger['info'](_0xe572('0x60'),_0xe572('0x61'));_0x2653a7[_0xe572('0x5e')]=_0x39693f;}else{_0x2653a7['recordingURL']='';}return getUser(_0x291af5,_0x58debb,_0x1a49d7,_0x2abb21,_0x2a578d,_0x1b00dd)[_0xe572('0x17')](function(_0x19afa1){logger[_0xe572('0x25')]('['+_0x1b00dd[_0xe572('0x26')]()+_0xe572('0x62'),_0x19afa1[_0xe572('0x2f')]);logger[_0xe572('0x25')]('['+_0x1b00dd['toUpperCase']()+_0xe572('0x63'),_0x19afa1[_0xe572('0x20')]);return getEndUser(_0x19afa1,_0x58debb,_0x2abb21,_0x2a578d,_0x2653a7,_0x1b00dd,_0xfed87b[_0xe572('0x64')],_0xfed87b['additionalSearchContact']);})[_0xe572('0x17')](function(_0x32a21a){logger[_0xe572('0x25')]('['+_0x1b00dd['toUpperCase']()+_0xe572('0x65'),_0x32a21a['enduserId']);logger['info']('['+_0x1b00dd[_0xe572('0x26')]()+_0xe572('0x66'),_0x2653a7[_0xe572('0x2d')]);return getTicket(_0x32a21a,_0x58debb,_0x2abb21,_0x2a578d,_0x2653a7,_0xfed87b,_0x1b00dd);})[_0xe572('0x17')](function(_0x3b1f20){logger[_0xe572('0x25')](util[_0xe572('0x52')]('['+_0x1b00dd[_0xe572('0x26')]()+_0xe572('0x67'),_0xfed87b['ticketType'],_0x3b1f20[_0xe572('0x68')]));logger[_0xe572('0x25')](util['format']('['+_0x1b00dd['toUpperCase']()+_0xe572('0x69'),_0x1b00dd));if(_0x1b00dd!=='unmanaged'&&_0xfed87b[_0xe572('0x6a')]){logger[_0xe572('0x25')]('['+_0x1b00dd[_0xe572('0x26')]()+']',_0xe572('0x6b'));emit(_0x58debb[_0xe572('0xe')],_0x1a49d7[_0xe572('0x6c')],_0xfed87b[_0xe572('0x46')],_0x3b1f20[_0xe572('0x68')]);}})['catch'](function(_0x323b46){logger[_0xe572('0x19')]('['+_0x1b00dd[_0xe572('0x26')]()+_0xe572('0x6d'),_0x323b46['message']);console[_0xe572('0x19')](_0xe572('0x6e'),_0x323b46);});}; \ No newline at end of file +var _0xe7c5=['internalemailaddress','isdisabled','systemuserid','info','userId','toLowerCase','outbound','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','telephone1','GET','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','indexOf','content','ticketType','incidents','assign','Subjects','getString','Descriptions','phonecall','queue','/contacts(','callDirection','Fields','odata-entityid','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','tenantId','data2','data5','POST','clientId','remoteUri','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length'];(function(_0x956671,_0x10d4b5){var _0x460fcd=function(_0x1ca84e){while(--_0x1ca84e){_0x956671['push'](_0x956671['shift']());}};_0x460fcd(++_0x10d4b5);}(_0xe7c5,0x1f3));var _0x5e7c=function(_0x3da13a,_0x51cafe){_0x3da13a=_0x3da13a-0x0;var _0x54ac0b=_0xe7c5[_0x3da13a];return _0x54ac0b;};'use strict';var _=require(_0x5e7c('0x0'));var rp=require(_0x5e7c('0x1'));var util=require(_0x5e7c('0x2'));var intUtil=require(_0x5e7c('0x3'));var md5=require('md5');var Redis=require(_0x5e7c('0x4'));var logger=require(_0x5e7c('0x5'))(_0x5e7c('0x6'));var config=require(_0x5e7c('0x7'));config[_0x5e7c('0x8')]=_['defaults'](config[_0x5e7c('0x8')],{'host':_0x5e7c('0x9'),'port':0x18eb});var io=require(_0x5e7c('0xa'))(new Redis(config['redis']));function getAuthToken(_0xb1f571,_0x5f2bb7,_0x45cf1f){if(_0xb1f571[_0x5e7c('0xb')]){_0xb1f571['remoteUri']=_0xb1f571[_0x5e7c('0xc')]['data7'];_0xb1f571[_0x5e7c('0xd')]=_0xb1f571[_0x5e7c('0xc')][_0x5e7c('0xe')];return Promise['resolve'](_0xb1f571[_0x5e7c('0xc')][_0x5e7c('0xf')]);}var _0x415c00={'method':_0x5e7c('0x10'),'uri':_0x5f2bb7,'form':{'client_id':_0xb1f571[_0x5e7c('0x11')],'resource':_0xb1f571[_0x5e7c('0x12')],'username':_0xb1f571[_0x5e7c('0x13')],'password':_0xb1f571[_0x5e7c('0x14')],'grant_type':_0x5e7c('0x14'),'client_secret':_0xb1f571[_0x5e7c('0x15')]},'json':!![]};return rp(_0x415c00)[_0x5e7c('0x16')](function(_0x17e1e5){return _0x17e1e5['access_token'];})[_0x5e7c('0x17')](function(_0x3f4fa6){logger[_0x5e7c('0x18')]('['+[_0x45cf1f[_0x5e7c('0x19')]()]+_0x5e7c('0x1a'));return _0x3f4fa6[_0x5e7c('0x1b')];});}function getUser(_0x39c197,_0x1fdd74,_0x4c64a1,_0xfaf4b0,_0x5bbd80,_0x5d986c){return new Promise(function(_0x2ddb34,_0x44c920){return getAuthToken(_0x1fdd74,_0xfaf4b0,_0x5d986c)[_0x5e7c('0x16')](function(_0xbb0e01){var _0x2a21c1={'method':'GET','uri':_0x5bbd80+_0x5e7c('0x1c'),'headers':{'Authorization':_0x5e7c('0x1d')+_0xbb0e01,'OData-Version':_0x5e7c('0x1e')},'json':!![]};return rp(_0x2a21c1);})[_0x5e7c('0x16')](function(_0x572eaf){var _0x2441b6=_0x572eaf[_0x5e7c('0x1f')];var _0x24f9e4=![];var _0x1f18a8=null;if(!_[_0x5e7c('0x20')](_0x4c64a1)){if(intUtil['validateEmail'](_0x4c64a1[_0x5e7c('0x21')])){_0x39c197[_0x5e7c('0x22')]=_0x4c64a1[_0x5e7c('0x21')];for(_0x1f18a8=0x0;_0x1f18a8<_0x2441b6[_0x5e7c('0x23')];_0x1f18a8++){if(_0x2441b6[_0x1f18a8][_0x5e7c('0x24')]===_0x4c64a1[_0x5e7c('0x21')]&&!_0x2441b6[_0x1f18a8][_0x5e7c('0x25')]){_0x24f9e4=!![];logger['info']('['+[_0x5d986c[_0x5e7c('0x19')]()]+']\x20Agent\x20found\x20'+_0x2441b6[_0x1f18a8][_0x5e7c('0x26')]+'!');_0x39c197['userId']=_0x2441b6[_0x1f18a8][_0x5e7c('0x26')];}}}}if(!_0x24f9e4){logger[_0x5e7c('0x27')]('['+[_0x5d986c['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x39c197[_0x5e7c('0x22')]=_0x1fdd74[_0x5e7c('0x13')];for(_0x1f18a8=0x0;_0x1f18a8<_0x2441b6[_0x5e7c('0x23')];_0x1f18a8++){if(_0x2441b6[_0x1f18a8][_0x5e7c('0x24')]===_0x1fdd74[_0x5e7c('0x13')]){_0x39c197[_0x5e7c('0x28')]=_0x2441b6[_0x1f18a8]['systemuserid'];}}}_0x2ddb34(_0x39c197);})[_0x5e7c('0x17')](function(_0x3f7a47){_0x44c920(_0x3f7a47[_0x5e7c('0x1b')]);});});}function createEndUser(_0x28bcba,_0x234ca5,_0x4e985a,_0x2bd101,_0x37fc8f,_0x2e26b3,_0x1c97a5){return new Promise(function(_0xf11a18,_0x177acd){return getAuthToken(_0x234ca5,_0x4e985a,_0x2e26b3)[_0x5e7c('0x16')](function(_0x428a64){var _0x2e96c5=_0x2e26b3[_0x5e7c('0x29')]()===_0x5e7c('0x2a')?_0x37fc8f['destcalleridnum']:_0x37fc8f[_0x5e7c('0x2b')];var _0x19db7c={'method':_0x5e7c('0x10'),'uri':_0x2bd101+_0x5e7c('0x2c'),'body':{'fullname':_0x2e96c5,'firstname':_0x2e96c5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5e7c('0x2d')+_0x28bcba[_0x5e7c('0x28')]+')'},'headers':{'Authorization':_0x5e7c('0x1d')+_0x428a64,'OData-Version':_0x5e7c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x19db7c[_0x5e7c('0x2e')][_0x1c97a5]=_0x2e96c5;return rp(_0x19db7c);})[_0x5e7c('0x16')](function(_0x58bc91){var _0x60be4e=_0x58bc91[_0x5e7c('0x2f')]['odata-entityid'];var _0x5474aa=_0x60be4e[_0x5e7c('0x30')](_0x60be4e[_0x5e7c('0x31')]('(')+0x1,_0x60be4e['lastIndexOf'](')'));_0x28bcba[_0x5e7c('0x32')]=_0x5474aa;_0xf11a18(_0x28bcba);})[_0x5e7c('0x17')](function(_0x13691c){_0x177acd(_0x13691c[_0x5e7c('0x1b')]);});});}function getEndUser(_0x53c18f,_0xe41a6f,_0x418a49,_0x412b5f,_0x50036d,_0x19ea21,_0x37241a,_0x5696eb){var _0x213f9b=_0x19ea21[_0x5e7c('0x29')]()===_0x5e7c('0x2a')?_0x50036d['destcalleridnum']:_0x50036d[_0x5e7c('0x2b')];return getAuthToken(_0xe41a6f,_0x418a49,_0x19ea21)['then'](function(_0x50ae36){_0x5696eb=_0x5696eb?_0x5696eb:_0x5e7c('0x33');var _0x4a811b={'method':_0x5e7c('0x34'),'uri':_0x412b5f+'contacts?$select='+_0x5696eb+_0x5e7c('0x35')+_0x5696eb+_0x5e7c('0x36')+_0x213f9b[_0x5e7c('0x37')]('+',_0x5e7c('0x38'))+'\x27','headers':{'Authorization':_0x5e7c('0x1d')+_0x50ae36,'If-None-Match':null,'OData-Version':_0x5e7c('0x1e')},'json':!![]};return rp(_0x4a811b);})[_0x5e7c('0x16')](function(_0x7650b5){var _0x569404=![];if(!_0x7650b5)return _0x569404;var _0x1e70dd=_0x7650b5[_0x5e7c('0x1f')];for(var _0x2eda6e=0x0;_0x2eda6e<_0x1e70dd[_0x5e7c('0x23')];_0x2eda6e++){if(_0x1e70dd[_0x2eda6e][_0x5696eb]===_0x213f9b){_0x569404=!![];_0x53c18f[_0x5e7c('0x32')]=_0x1e70dd[_0x2eda6e][_0x5e7c('0x39')];}}return _0x569404;})[_0x5e7c('0x16')](function(_0x2aa489){if(_0x2aa489)return _0x53c18f;if(_0x37241a===_0x5e7c('0x3a')){logger[_0x5e7c('0x27')]('['+[_0x19ea21[_0x5e7c('0x19')]()]+_0x5e7c('0x3b'));return _0x53c18f;}return createEndUser(_0x53c18f,_0xe41a6f,_0x418a49,_0x412b5f,_0x50036d,_0x19ea21,_0x5696eb)[_0x5e7c('0x16')](function(_0x4ec3ce){logger[_0x5e7c('0x27')]('['+[_0x19ea21['toUpperCase']()]+_0x5e7c('0x3c'),_0x4ec3ce[_0x5e7c('0x32')]);return _0x4ec3ce;});});}function getCustomFields(_0x5658e4,_0x22b6ca,_0xa2eb92){var _0x4e8baf={};if(_0x5658e4[_0x5e7c('0x23')]>0x0){_[_0x5e7c('0x3d')](_0x5658e4,function(_0x462c42){if(_[_0x5e7c('0x3e')]([_0x5e7c('0x3f'),_0x5e7c('0x40')],_0x462c42[_0x5e7c('0x41')])&&_0x462c42[_0x5e7c('0x42')]&&!_0x462c42['customField']){var _0x29e544=_0x462c42['idField']['toLowerCase']();var _0x4b5d2d=_0x29e544['substring'](0x0,_0x29e544['indexOf']('_'));var _0x36be9c=_0x29e544[_0x5e7c('0x30')](_0x29e544[_0x5e7c('0x43')]('_')+0x1);if(_0x4b5d2d===_0xa2eb92){_0x4e8baf[_0x36be9c]=_0x462c42[_0x5e7c('0x44')];}}});}return _0x4e8baf;}function getTicket(_0x445f21,_0x5e27ff,_0x4adf30,_0xca6bff,_0x53c3a2,_0x53122b,_0x3efc5c){return new Promise(function(_0x53aaba,_0x580c73){var _0x5f1c3d;return getAuthToken(_0x5e27ff,_0x4adf30,_0x3efc5c)[_0x5e7c('0x16')](function(_0x382dc8){if(_0x53122b[_0x5e7c('0x45')]==='incident'){_0x5f1c3d={'method':_0x5e7c('0x10'),'uri':_0xca6bff+_0x5e7c('0x46'),'body':Object[_0x5e7c('0x47')]({},{'title':intUtil['getString'](_0x53122b[_0x5e7c('0x48')],_0x53c3a2,'\x20'),'description':intUtil[_0x5e7c('0x49')](_0x53122b[_0x5e7c('0x4a')],_0x53c3a2,'\x0a'),'customerid_contact@odata.bind':_0x445f21[_0x5e7c('0x32')]?'/contacts('+_0x445f21[_0x5e7c('0x32')]+')':undefined,'ownerid@odata.bind':_0x5e7c('0x2d')+_0x445f21[_0x5e7c('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x53122b['Fields'],_0x53c3a2,_0x53122b[_0x5e7c('0x45')])),'headers':{'Authorization':_0x5e7c('0x1d')+_0x382dc8,'OData-Version':_0x5e7c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x53122b[_0x5e7c('0x45')]===_0x5e7c('0x4b')){var _0x8351fe=_0x445f21['enduserId']?[{'partyid_systemuser@odata.bind':_0x5e7c('0x2d')+_0x445f21[_0x5e7c('0x28')]+')','participationtypemask':_0x445f21['callDirection']===_0x5e7c('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x5e7c('0x4d')+_0x445f21['enduserId']+')','participationtypemask':_0x445f21[_0x5e7c('0x4e')]===_0x5e7c('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5e7c('0x2d')+_0x445f21[_0x5e7c('0x28')]+')','participationtypemask':_0x445f21[_0x5e7c('0x4e')]===_0x5e7c('0x4c')?0x2:0x1}];_0x5f1c3d={'method':'POST','uri':_0xca6bff+'phonecalls','body':Object[_0x5e7c('0x47')]({},{'subject':intUtil['getString'](_0x53122b['Subjects'],_0x53c3a2,'\x20'),'phonenumber':String(_0x53c3a2['calleridnum']),'description':intUtil['getString'](_0x53122b[_0x5e7c('0x4a')],_0x53c3a2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x445f21[_0x5e7c('0x32')]?_0x5e7c('0x4d')+_0x445f21[_0x5e7c('0x32')]+')':undefined,'ownerid@odata.bind':_0x5e7c('0x2d')+_0x445f21[_0x5e7c('0x28')]+')','directioncode':_0x445f21[_0x5e7c('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x8351fe},getCustomFields(_0x53122b[_0x5e7c('0x4f')],_0x53c3a2,_0x53122b['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x382dc8,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5f1c3d);})['then'](function(_0x524900){var _0x9c7a9=_0x524900['headers'][_0x5e7c('0x50')];var _0x158b3c=_0x9c7a9[_0x5e7c('0x30')](_0x9c7a9[_0x5e7c('0x31')]('(')+0x1,_0x9c7a9[_0x5e7c('0x31')](')'));_0x445f21[_0x5e7c('0x51')]=_0x158b3c;_0x53aaba(_0x445f21);})[_0x5e7c('0x17')](function(_0x5656bf){_0x580c73(_0x5656bf[_0x5e7c('0x1b')]);});});}function emit(_0x26dd6e,_0x4fef8b,_0x11bace,_0x57167b){var _0x120760={'uri':util[_0x5e7c('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x26dd6e,_0x11bace,_0x57167b)};io['to'](util[_0x5e7c('0x52')](_0x5e7c('0x53'),_0x4fef8b))[_0x5e7c('0x54')](_0x5e7c('0x55'),_0x120760);}exports['cs']=function(_0xa3b64f,_0x4b09d5,_0x59f82c,_0x9e50ba,_0x313e8b,_0x28046d,_0x332c72,_0x28eecd){var _0x45c294={};_0x28046d[_0x5e7c('0x12')]=_0x28046d[_0x5e7c('0xb')]?intUtil[_0x5e7c('0x56')](_0x28046d[_0x5e7c('0xc')][_0x5e7c('0x57')]):intUtil['stripTrailingSlash'](_0x28046d[_0x5e7c('0x12')]);_0x28046d[_0x5e7c('0x58')]=intUtil['stripTrailingSlash'](_0x28046d[_0x5e7c('0x58')]);_0x45c294[_0x5e7c('0x4e')]=_0x28eecd==='queue'||_0x28eecd===_0x5e7c('0x59')?_0x5e7c('0x4c'):_0x5e7c('0x2a');var _0x16a322=_0x28046d[_0x5e7c('0xb')]?util[_0x5e7c('0x52')](_0x5e7c('0x5a'),_0x28046d[_0x5e7c('0xc')][_0x5e7c('0x57')]):util[_0x5e7c('0x52')](_0x5e7c('0x5a'),_0x28046d[_0x5e7c('0x12')]);var _0x7b8001=util[_0x5e7c('0x52')]('https://login.microsoftonline.com/%s/oauth2/token',_0x28046d[_0x5e7c('0xd')]);var _0xf1bc29=util[_0x5e7c('0x52')](_0x5e7c('0x5b'),_0x28046d['serverUrl'],_0x4b09d5[_0x5e7c('0x5c')],md5(_0x4b09d5[_0x5e7c('0x5c')]));if(_0x313e8b&&_0x313e8b[_0x5e7c('0x5d')]){logger[_0x5e7c('0x27')]('[QUEUE]',_0x5e7c('0x5e'));_0x4b09d5[_0x5e7c('0x5f')]=_0xf1bc29;}else if(_0x332c72&&_0x332c72[_0x5e7c('0x60')]&&_0x332c72[_0x5e7c('0x60')]!==_0x5e7c('0x61')){logger['info'](_0x5e7c('0x62'),_0x5e7c('0x5e'));_0x4b09d5[_0x5e7c('0x5f')]=_0xf1bc29;}else{_0x4b09d5[_0x5e7c('0x5f')]='';}return getUser(_0x45c294,_0x28046d,_0x9e50ba,_0x7b8001,_0x16a322,_0x28eecd)['then'](function(_0x3f61e1){logger[_0x5e7c('0x27')]('['+_0x28eecd[_0x5e7c('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x3f61e1[_0x5e7c('0x28')]);logger[_0x5e7c('0x27')]('['+_0x28eecd[_0x5e7c('0x19')]()+_0x5e7c('0x63'),_0x3f61e1[_0x5e7c('0x22')]);return getEndUser(_0x3f61e1,_0x28046d,_0x7b8001,_0x16a322,_0x4b09d5,_0x28eecd,_0x59f82c[_0x5e7c('0x64')],_0x59f82c[_0x5e7c('0x65')]);})[_0x5e7c('0x16')](function(_0x1fef13){logger[_0x5e7c('0x27')]('['+_0x28eecd[_0x5e7c('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1fef13[_0x5e7c('0x32')]);logger['info']('['+_0x28eecd[_0x5e7c('0x19')]()+_0x5e7c('0x66'),_0x4b09d5[_0x5e7c('0x2b')]);return getTicket(_0x1fef13,_0x28046d,_0x7b8001,_0x16a322,_0x4b09d5,_0x59f82c,_0x28eecd);})[_0x5e7c('0x16')](function(_0x17e89a){logger[_0x5e7c('0x27')](util[_0x5e7c('0x52')]('['+_0x28eecd[_0x5e7c('0x19')]()+_0x5e7c('0x67'),_0x59f82c[_0x5e7c('0x45')],_0x17e89a[_0x5e7c('0x51')]));logger[_0x5e7c('0x27')](util['format']('['+_0x28eecd[_0x5e7c('0x19')]()+_0x5e7c('0x68'),_0x28eecd));if(_0x28eecd!=='unmanaged'&&_0x59f82c['openNewTab']){logger[_0x5e7c('0x27')]('['+_0x28eecd[_0x5e7c('0x19')]()+']',_0x5e7c('0x69'));emit(_0x28046d[_0x5e7c('0x12')],_0x9e50ba['name'],_0x59f82c[_0x5e7c('0x45')],_0x17e89a[_0x5e7c('0x51')]);}})[_0x5e7c('0x17')](function(_0x1b574a){logger['error']('['+_0x28eecd[_0x5e7c('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x1b574a[_0x5e7c('0x1b')]);console[_0x5e7c('0x18')](_0x5e7c('0x6a'),_0x1b574a);});}; \ 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 645de3d..aa1a6b7 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 _0xc47d=['Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','toUpperCase','calleridname','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','info','merge','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','format','%s/api/v2/tickets','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','remoteUri','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','string','picklist','nameField','toLowerCase','content','type','idField','push','variableName','customField','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x3a0afe,_0x24e3f6){var _0x41db6d=function(_0x134336){while(--_0x134336){_0x3a0afe['push'](_0x3a0afe['shift']());}};_0x41db6d(++_0x24e3f6);}(_0xc47d,0x1cb));var _0xdc47=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc47d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var rp=require(_0xdc47('0x0'));var md5=require(_0xdc47('0x1'));var util=require(_0xdc47('0x2'));var Redis=require(_0xdc47('0x3'));var intUtil=require(_0xdc47('0x4'));var config=require('../../../../config/environment');var logger=require(_0xdc47('0x5'))(_0xdc47('0x6'));config[_0xdc47('0x7')]=_['defaults'](config['redis'],{'host':_0xdc47('0x8'),'port':0x18eb});var io=require(_0xdc47('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xdc47('0xa'),'Accept':'application/json'};function emit(_0x3f83ce,_0xaaf852,_0x22d130){io['to'](_0x3f83ce)['emit'](_0xaaf852,_0x22d130);}function getTicket(_0x5defca,_0x484262,_0x355fb4,_0x21abff,_0x2b4227){logger[_0xdc47('0xb')]('Creating\x20new\x20ticket...');var _0x3ebcc0=_[_0xdc47('0xc')]({'responder_id':_0x484262['id'],'requester_id':_0x355fb4['id'],'name':util['format']('Caller\x20-\x20%s',_0x2b4227['calleridname']),'phone':_0x2b4227[_0xdc47('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdc47('0xe')](_0x21abff[_0xdc47('0xf')],_0x2b4227,'\x20'),'description':intUtil[_0xdc47('0xe')](_0x21abff[_0xdc47('0x10')],_0x2b4227,_0xdc47('0x11')),'tags':getTags(_0x21abff[_0xdc47('0x12')],'name')},getCustomFields(_0x21abff[_0xdc47('0x13')],_0x2b4227));_0x3ebcc0[_0xdc47('0x14')]=_['mapValues'](_[_0xdc47('0x15')](_0x3ebcc0[_0xdc47('0x14')],'id'),_0xdc47('0x16'));return request({'uri':util[_0xdc47('0x17')](_0xdc47('0x18'),_0x5defca['remoteUri']),'method':'POST','body':_0x3ebcc0})['then'](function(_0x380495){logger[_0xdc47('0xb')]('Ticket\x20created!');return _0x380495;});}function getUser(_0x54c938,_0x5aed0a){if(intUtil['validateEmail'](_0x5aed0a)){return request({'uri':util['format'](_0xdc47('0x19'),_0x54c938['remoteUri']),'qs':{'email':_0x5aed0a}})['then'](function(_0x706478){if(_0x706478['length']){logger[_0xdc47('0xb')](_0xdc47('0x1a'));return _[_0xdc47('0x1b')](_0x706478,function(_0x19869a){return _0x19869a[_0xdc47('0x1c')]['email']===_0x5aed0a;});}else{logger[_0xdc47('0xb')](_0xdc47('0x1d'));return request({'uri':util[_0xdc47('0x17')](_0xdc47('0x1e'),_0x54c938['remoteUri'])})[_0xdc47('0x1f')](function(_0x52b1ed){logger[_0xdc47('0xb')]('Admin\x20account\x20selected.');return _0x52b1ed;});}});}else{logger[_0xdc47('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdc47('0x17')](_0xdc47('0x1e'),_0x54c938['remoteUri'])})[_0xdc47('0x1f')](function(_0x5d8497){logger[_0xdc47('0xb')]('Admin\x20account\x20selected.');return _0x5d8497;});}}function getEndUser(_0x399f51,_0xbce3ee,_0x531d16){logger[_0xdc47('0xb')](_0xdc47('0x20'),_0x531d16);return request({'uri':util[_0xdc47('0x17')](_0xdc47('0x21'),_0x399f51['remoteUri']),'qs':{'phone':_0x531d16}})[_0xdc47('0x1f')](function(_0x902296){if(_0x902296[_0xdc47('0x22')]){logger[_0xdc47('0xb')](_0xdc47('0x23'));return _[_0xdc47('0x1b')](_0x902296,{'phone':_0x531d16});}else{logger[_0xdc47('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xdc47('0x17')]('%s/api/v2/contacts',_0x399f51[_0xdc47('0x24')]),'method':'POST','body':{'name':_0xbce3ee,'phone':_0x531d16}})['then'](function(_0x216a01){logger[_0xdc47('0xb')]('Enduser\x20created.');return _0x216a01;});}});}function getAuth(_0x239175){return util[_0xdc47('0x17')](_0xdc47('0x25'),new Buffer(_0x239175['apiKey']+':X')[_0xdc47('0x26')](_0xdc47('0x27')));}function request(_0x2398dd){logger[_0xdc47('0x28')](_0xdc47('0x29'),JSON[_0xdc47('0x2a')](_0x2398dd));return rp(_['defaults'](_0x2398dd,{'method':_0xdc47('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x162c0e,_0x17e749){var _0x2e7e8d=[];if(_0x162c0e&&_0x162c0e[_0xdc47('0x22')]>0x0){_0x2e7e8d=_['map'](_0x162c0e,_0x17e749);}return _0x2e7e8d;}function getCustomFields(_0x67f3fd,_0x212530){var _0x46d674=[];var _0x505a0d={'custom_fields':[]};if(_0x67f3fd[_0xdc47('0x22')]>0x0){_[_0xdc47('0x2c')](_0x67f3fd,function(_0x1df5ce){if(_['includes']([_0xdc47('0x2d'),_0xdc47('0x2e')],_0x1df5ce['type'])&&_0x1df5ce[_0xdc47('0x2f')]&&!_0x1df5ce['customField']){_0x505a0d[_0x1df5ce[_0xdc47('0x2f')][_0xdc47('0x30')]()]=_0x1df5ce[_0xdc47('0x31')][_0xdc47('0x26')]();}else if(_['includes']([_0xdc47('0x2d'),_0xdc47('0x2e')],_0x1df5ce[_0xdc47('0x32')])&&_0x1df5ce[_0xdc47('0x33')]&&_0x1df5ce['customField']){_0x505a0d['custom_fields'][_0xdc47('0x34')]({'id':_0x1df5ce[_0xdc47('0x33')],'value':_0x1df5ce['content'][_0xdc47('0x26')]()});}else if(_0x1df5ce['type']==='variable'&&_0x1df5ce[_0xdc47('0x35')]&&_0x1df5ce[_0xdc47('0x33')]&&_0x1df5ce[_0xdc47('0x36')]){_0x212530[_0x1df5ce[_0xdc47('0x35')]]&&_0x505a0d[_0xdc47('0x14')][_0xdc47('0x34')]({'id':_0x1df5ce[_0xdc47('0x33')],'value':_0x212530[_0x1df5ce[_0xdc47('0x35')]][_0xdc47('0x26')]()});}else if(_0x1df5ce['type']===_0xdc47('0x37')&&_0x1df5ce[_0xdc47('0x38')]&&_0x1df5ce[_0xdc47('0x38')][_0xdc47('0x39')]&&_0x1df5ce[_0xdc47('0x33')]&&_0x1df5ce['customField']){_0x212530[_0x1df5ce[_0xdc47('0x38')]['name']['toLowerCase']()]&&_0x505a0d[_0xdc47('0x14')][_0xdc47('0x34')]({'id':_0x1df5ce[_0xdc47('0x33')],'value':_0x212530[_0x1df5ce[_0xdc47('0x38')]['name'][_0xdc47('0x30')]()]['toString']()});}});}return _0x505a0d;}exports[_0xdc47('0x3a')]=function(_0x4080b3,_0x452df1,_0xfc1cc,_0x21d9ec,_0x4fcebb,_0x4127cb){var _0x3d5f2e,_0x113378;_0x4127cb['remoteUri']=intUtil[_0xdc47('0x3b')](_0x4127cb[_0xdc47('0x24')]);_0x4127cb[_0xdc47('0x3c')]=intUtil['stripTrailingSlash'](_0x4127cb[_0xdc47('0x3c')]);if(_0x4fcebb&&_0x4fcebb[_0xdc47('0x3d')]){logger[_0xdc47('0xb')](_0xdc47('0x3e'),_0xdc47('0x3f'));_0x452df1['recordingURL']=util['format'](_0xdc47('0x40'),_0x4127cb['serverUrl'],_0x452df1[_0xdc47('0x41')],md5(_0x452df1[_0xdc47('0x41')]));}else{_0x452df1[_0xdc47('0x42')]='';}headers[_0xdc47('0x43')]=getAuth(_0x4127cb);return getUser(_0x4127cb,_0x21d9ec[_0xdc47('0x44')])[_0xdc47('0x1f')](function(_0x2552fe){_0x3d5f2e=_0x2552fe;logger['info'](_0xdc47('0x45'),_0x3d5f2e['id']);return getEndUser(_0x4127cb,_0x452df1['calleridname'],_0x452df1[_0xdc47('0xd')]);})[_0xdc47('0x1f')](function(_0x2691ed){_0x113378=_0x2691ed;logger[_0xdc47('0xb')](_0xdc47('0x46'),_0x113378['id']);return getTicket(_0x4127cb,_0x3d5f2e,_0x113378,_0xfc1cc,_0x452df1);})[_0xdc47('0x1f')](function(_0x4bab25){if(_0x4bab25&&_0x4bab25['id']){logger[_0xdc47('0xb')](_0xdc47('0x47'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4bab25['id']);logger[_0xdc47('0xb')](_0xdc47('0x3e'),_0xdc47('0x48'));emit(util['format'](_0xdc47('0x49'),_0x21d9ec[_0xdc47('0x39')]),'trigger:browser:url',{'uri':util[_0xdc47('0x17')](_0xdc47('0x4a'),_0x4127cb[_0xdc47('0x24')],_0x4bab25['id'])});}})[_0xdc47('0x4b')](function(_0x3953f1){logger[_0xdc47('0x4c')](_0xdc47('0x3e'),JSON[_0xdc47('0x2a')](_0x3953f1));});};exports[_0xdc47('0x4d')]=function(_0x25150c,_0x380d94,_0x32387e,_0xbeb5ae,_0x3e184a,_0x2fcbbe,_0x25649e){var _0x4bc404,_0x5677ed;_0x2fcbbe['remoteUri']=intUtil['stripTrailingSlash'](_0x2fcbbe['remoteUri']);_0x2fcbbe[_0xdc47('0x3c')]=intUtil[_0xdc47('0x3b')](_0x2fcbbe[_0xdc47('0x3c')]);if(_0x25649e&&_0x25649e[_0xdc47('0x4e')]&&_0x25649e[_0xdc47('0x4e')]!==_0xdc47('0x4f')){logger[_0xdc47('0xb')](_0xdc47('0x50'),_0xdc47('0x3f'));_0x380d94[_0xdc47('0x42')]=util[_0xdc47('0x17')](_0xdc47('0x40'),_0x2fcbbe[_0xdc47('0x3c')],_0x380d94[_0xdc47('0x41')],md5(_0x380d94[_0xdc47('0x41')]));}headers[_0xdc47('0x43')]=getAuth(_0x2fcbbe);return getUser(_0x2fcbbe,_0xbeb5ae[_0xdc47('0x44')])[_0xdc47('0x1f')](function(_0x12d3d7){_0x4bc404=_0x12d3d7;logger['info'](_0xdc47('0x45'),_0x4bc404['id']);return getEndUser(_0x2fcbbe,_0x380d94[_0xdc47('0x51')],_0x380d94['destcalleridnum']);})['then'](function(_0x30afd9){_0x5677ed=_0x30afd9;logger[_0xdc47('0xb')](_0xdc47('0x46'),_0x5677ed['id']);return getTicket(_0x2fcbbe,_0x4bc404,_0x5677ed,_0x32387e,_0x380d94);})[_0xdc47('0x1f')](function(_0x5d5f23){if(_0x5d5f23&&_0x5d5f23['id']){logger[_0xdc47('0xb')](_0xdc47('0x47'));logger[_0xdc47('0xb')](_0xdc47('0x52'),_0x5d5f23['id']);logger[_0xdc47('0xb')]('[OUTBOUND]',_0xdc47('0x48'));emit(util['format']('user:%s',_0xbeb5ae['name']),_0xdc47('0x53'),{'uri':util[_0xdc47('0x17')]('%s/helpdesk/tickets/%d',_0x2fcbbe[_0xdc47('0x24')],_0x5d5f23['id'])});}})['catch'](function(_0x5984cf){logger[_0xdc47('0x4c')](_0xdc47('0x50'),JSON[_0xdc47('0x2a')](_0x5984cf));});};exports['unmanaged']=function(_0x571d42,_0x323b1c,_0x1f7952,_0x28db2c,_0x370789,_0xb0a28e){var _0x2946cd,_0x613e88;_0xb0a28e[_0xdc47('0x24')]=intUtil[_0xdc47('0x3b')](_0xb0a28e[_0xdc47('0x24')]);_0xb0a28e[_0xdc47('0x3c')]=intUtil[_0xdc47('0x3b')](_0xb0a28e[_0xdc47('0x3c')]);if(_0x370789&&_0x370789[_0xdc47('0x3d')]){logger[_0xdc47('0xb')]('['+_0x323b1c['lastevent'][_0xdc47('0x54')]()+']',_0xdc47('0x3f'));_0x323b1c[_0xdc47('0x42')]=util[_0xdc47('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb0a28e[_0xdc47('0x3c')],_0x323b1c['uniqueid'],md5(_0x323b1c[_0xdc47('0x41')]));}else{_0x323b1c[_0xdc47('0x42')]='';}headers[_0xdc47('0x43')]=getAuth(_0xb0a28e);return getUser(_0xb0a28e,'')[_0xdc47('0x1f')](function(_0x1f8671){_0x2946cd=_0x1f8671;logger[_0xdc47('0xb')]('The\x20User\x20ID\x20is:',_0x2946cd['id']);return getEndUser(_0xb0a28e,_0x323b1c[_0xdc47('0x55')],_0x323b1c[_0xdc47('0xd')]);})[_0xdc47('0x1f')](function(_0x230e0e){_0x613e88=_0x230e0e;logger[_0xdc47('0xb')]('The\x20Enduser\x20ID\x20is:',_0x613e88['id']);return getTicket(_0xb0a28e,_0x2946cd,_0x613e88,_0x1f7952,_0x323b1c);})[_0xdc47('0x1f')](function(_0x1f88cf){if(_0x1f88cf){logger[_0xdc47('0xb')](_0xdc47('0x47'));logger[_0xdc47('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1f88cf['id']);}})[_0xdc47('0x4b')](function(_0x309e8d){logger[_0xdc47('0x4c')]('['+_0x323b1c[_0xdc47('0x56')][_0xdc47('0x54')]()+']',JSON['stringify'](_0x309e8d));});}; \ No newline at end of file +var _0x65ec=['GET','map','forEach','string','type','nameField','toLowerCase','content','includes','idField','customField','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','format','remoteUri','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\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','apiKey','toString','base64','debug','[HTTP]','stringify'];(function(_0x1d39b8,_0x4f449d){var _0x2e5245=function(_0x3f7a7a){while(--_0x3f7a7a){_0x1d39b8['push'](_0x1d39b8['shift']());}};_0x2e5245(++_0x4f449d);}(_0x65ec,0xdb));var _0xc65e=function(_0x5116f1,_0x4813db){_0x5116f1=_0x5116f1-0x0;var _0x1523c9=_0x65ec[_0x5116f1];return _0x1523c9;};'use strict';var _=require('lodash');var rp=require(_0xc65e('0x0'));var md5=require('md5');var util=require(_0xc65e('0x1'));var Redis=require(_0xc65e('0x2'));var intUtil=require(_0xc65e('0x3'));var config=require(_0xc65e('0x4'));var logger=require(_0xc65e('0x5'))(_0xc65e('0x6'));config[_0xc65e('0x7')]=_[_0xc65e('0x8')](config[_0xc65e('0x7')],{'host':_0xc65e('0x9'),'port':0x18eb});var io=require(_0xc65e('0xa'))(new Redis(config[_0xc65e('0x7')]));var headers={'Content-Type':_0xc65e('0xb'),'Accept':_0xc65e('0xb')};function emit(_0x3703c0,_0x2ef298,_0x58d4ca){io['to'](_0x3703c0)['emit'](_0x2ef298,_0x58d4ca);}function getTicket(_0x234e6,_0x52065b,_0x21acfe,_0x263824,_0x14544c){logger[_0xc65e('0xc')](_0xc65e('0xd'));var _0x264ef6=_[_0xc65e('0xe')]({'responder_id':_0x52065b['id'],'requester_id':_0x21acfe['id'],'name':util['format']('Caller\x20-\x20%s',_0x14544c[_0xc65e('0xf')]),'phone':_0x14544c[_0xc65e('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x263824[_0xc65e('0x11')],_0x14544c,'\x20'),'description':intUtil['getString'](_0x263824[_0xc65e('0x12')],_0x14544c,_0xc65e('0x13')),'tags':getTags(_0x263824['Tags'],_0xc65e('0x14'))},getCustomFields(_0x263824[_0xc65e('0x15')],_0x14544c));_0x264ef6[_0xc65e('0x16')]=_[_0xc65e('0x17')](_[_0xc65e('0x18')](_0x264ef6[_0xc65e('0x16')],'id'),_0xc65e('0x19'));return request({'uri':util[_0xc65e('0x1a')]('%s/api/v2/tickets',_0x234e6[_0xc65e('0x1b')]),'method':'POST','body':_0x264ef6})[_0xc65e('0x1c')](function(_0x2fb7c1){logger[_0xc65e('0xc')]('Ticket\x20created!');return _0x2fb7c1;});}function getUser(_0x164f9a,_0x538177){if(intUtil[_0xc65e('0x1d')](_0x538177)){return request({'uri':util[_0xc65e('0x1a')](_0xc65e('0x1e'),_0x164f9a[_0xc65e('0x1b')]),'qs':{'email':_0x538177}})['then'](function(_0x2c97bc){if(_0x2c97bc[_0xc65e('0x1f')]){logger[_0xc65e('0xc')](_0xc65e('0x20'));return _[_0xc65e('0x21')](_0x2c97bc,function(_0x456dc2){return _0x456dc2['contact'][_0xc65e('0x22')]===_0x538177;});}else{logger[_0xc65e('0xc')](_0xc65e('0x23'));return request({'uri':util[_0xc65e('0x1a')](_0xc65e('0x24'),_0x164f9a[_0xc65e('0x1b')])})['then'](function(_0x28bea5){logger[_0xc65e('0xc')]('Admin\x20account\x20selected.');return _0x28bea5;});}});}else{logger[_0xc65e('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc65e('0x1a')](_0xc65e('0x24'),_0x164f9a[_0xc65e('0x1b')])})['then'](function(_0x19ad4c){logger[_0xc65e('0xc')]('Admin\x20account\x20selected.');return _0x19ad4c;});}}function getEndUser(_0x3a7485,_0x5d8675,_0x522dbc){logger[_0xc65e('0xc')](_0xc65e('0x25'),_0x522dbc);return request({'uri':util[_0xc65e('0x1a')](_0xc65e('0x26'),_0x3a7485[_0xc65e('0x1b')]),'qs':{'phone':_0x522dbc}})[_0xc65e('0x1c')](function(_0x431f7f){if(_0x431f7f[_0xc65e('0x1f')]){logger[_0xc65e('0xc')](_0xc65e('0x27'));return _[_0xc65e('0x21')](_0x431f7f,{'phone':_0x522dbc});}else{logger[_0xc65e('0xc')](_0xc65e('0x28'));return request({'uri':util[_0xc65e('0x1a')](_0xc65e('0x26'),_0x3a7485[_0xc65e('0x1b')]),'method':_0xc65e('0x29'),'body':{'name':_0x5d8675,'phone':_0x522dbc}})[_0xc65e('0x1c')](function(_0x67eb0f){logger[_0xc65e('0xc')]('Enduser\x20created.');return _0x67eb0f;});}});}function getAuth(_0x24ab94){return util[_0xc65e('0x1a')]('Basic\x20%s',new Buffer(_0x24ab94[_0xc65e('0x2a')]+':X')[_0xc65e('0x2b')](_0xc65e('0x2c')));}function request(_0x14062f){logger[_0xc65e('0x2d')](_0xc65e('0x2e'),JSON[_0xc65e('0x2f')](_0x14062f));return rp(_['defaults'](_0x14062f,{'method':_0xc65e('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x24581b,_0x891080){var _0x47b2ea=[];if(_0x24581b&&_0x24581b[_0xc65e('0x1f')]>0x0){_0x47b2ea=_[_0xc65e('0x31')](_0x24581b,_0x891080);}return _0x47b2ea;}function getCustomFields(_0x594c65,_0x5626c0){var _0xe4f580=[];var _0x38ee07={'custom_fields':[]};if(_0x594c65[_0xc65e('0x1f')]>0x0){_[_0xc65e('0x32')](_0x594c65,function(_0x1a2a77){if(_['includes']([_0xc65e('0x33'),'picklist'],_0x1a2a77[_0xc65e('0x34')])&&_0x1a2a77[_0xc65e('0x35')]&&!_0x1a2a77['customField']){_0x38ee07[_0x1a2a77[_0xc65e('0x35')][_0xc65e('0x36')]()]=_0x1a2a77[_0xc65e('0x37')]['toString']();}else if(_[_0xc65e('0x38')](['string','picklist'],_0x1a2a77['type'])&&_0x1a2a77[_0xc65e('0x39')]&&_0x1a2a77[_0xc65e('0x3a')]){_0x38ee07['custom_fields']['push']({'id':_0x1a2a77[_0xc65e('0x39')],'value':_0x1a2a77[_0xc65e('0x37')][_0xc65e('0x2b')]()});}else if(_0x1a2a77[_0xc65e('0x34')]===_0xc65e('0x3b')&&_0x1a2a77['variableName']&&_0x1a2a77[_0xc65e('0x39')]&&_0x1a2a77[_0xc65e('0x3a')]){_0x5626c0[_0x1a2a77[_0xc65e('0x3c')]]&&_0x38ee07['custom_fields'][_0xc65e('0x3d')]({'id':_0x1a2a77['idField'],'value':_0x5626c0[_0x1a2a77['variableName']][_0xc65e('0x2b')]()});}else if(_0x1a2a77[_0xc65e('0x34')]==='customVariable'&&_0x1a2a77[_0xc65e('0x3e')]&&_0x1a2a77[_0xc65e('0x3e')][_0xc65e('0x14')]&&_0x1a2a77[_0xc65e('0x39')]&&_0x1a2a77[_0xc65e('0x3a')]){_0x5626c0[_0x1a2a77[_0xc65e('0x3e')][_0xc65e('0x14')]['toLowerCase']()]&&_0x38ee07['custom_fields'][_0xc65e('0x3d')]({'id':_0x1a2a77['idField'],'value':_0x5626c0[_0x1a2a77[_0xc65e('0x3e')]['name']['toLowerCase']()][_0xc65e('0x2b')]()});}});}return _0x38ee07;}exports[_0xc65e('0x3f')]=function(_0x57a89f,_0x3c7fc7,_0x58aba1,_0x175fed,_0xef3669,_0x302909){var _0x3bcb5b,_0x2df762;_0x302909[_0xc65e('0x1b')]=intUtil[_0xc65e('0x40')](_0x302909['remoteUri']);_0x302909['serverUrl']=intUtil[_0xc65e('0x40')](_0x302909[_0xc65e('0x41')]);if(_0xef3669&&_0xef3669['monitor_format']){logger[_0xc65e('0xc')](_0xc65e('0x42'),_0xc65e('0x43'));_0x3c7fc7['recordingURL']=util[_0xc65e('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x302909[_0xc65e('0x41')],_0x3c7fc7[_0xc65e('0x44')],md5(_0x3c7fc7['uniqueid']));}else{_0x3c7fc7['recordingURL']='';}headers[_0xc65e('0x45')]=getAuth(_0x302909);return getUser(_0x302909,_0x175fed[_0xc65e('0x22')])[_0xc65e('0x1c')](function(_0x31bdb2){_0x3bcb5b=_0x31bdb2;logger[_0xc65e('0xc')]('The\x20User\x20ID\x20is:',_0x3bcb5b['id']);return getEndUser(_0x302909,_0x3c7fc7['calleridname'],_0x3c7fc7[_0xc65e('0x10')]);})[_0xc65e('0x1c')](function(_0x4403d6){_0x2df762=_0x4403d6;logger[_0xc65e('0xc')](_0xc65e('0x46'),_0x2df762['id']);return getTicket(_0x302909,_0x3bcb5b,_0x2df762,_0x58aba1,_0x3c7fc7);})[_0xc65e('0x1c')](function(_0x4e7368){if(_0x4e7368&&_0x4e7368['id']){logger[_0xc65e('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x4e7368['id']);logger[_0xc65e('0xc')](_0xc65e('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc65e('0x1a')](_0xc65e('0x47'),_0x175fed[_0xc65e('0x14')]),_0xc65e('0x48'),{'uri':util[_0xc65e('0x1a')](_0xc65e('0x49'),_0x302909[_0xc65e('0x1b')],_0x4e7368['id'])});}})[_0xc65e('0x4a')](function(_0x4582c8){logger[_0xc65e('0x4b')](_0xc65e('0x42'),JSON['stringify'](_0x4582c8));});};exports[_0xc65e('0x4c')]=function(_0x5b0cd2,_0x4aad5d,_0x4ba9a2,_0x2fbb95,_0x395d6a,_0x353244,_0x1f413c){var _0x3d1a14,_0x1ab159;_0x353244[_0xc65e('0x1b')]=intUtil[_0xc65e('0x40')](_0x353244['remoteUri']);_0x353244[_0xc65e('0x41')]=intUtil[_0xc65e('0x40')](_0x353244[_0xc65e('0x41')]);if(_0x1f413c&&_0x1f413c[_0xc65e('0x4d')]&&_0x1f413c[_0xc65e('0x4d')]!=='none'){logger['info'](_0xc65e('0x4e'),_0xc65e('0x43'));_0x4aad5d[_0xc65e('0x4f')]=util['format'](_0xc65e('0x50'),_0x353244[_0xc65e('0x41')],_0x4aad5d[_0xc65e('0x44')],md5(_0x4aad5d[_0xc65e('0x44')]));}headers[_0xc65e('0x45')]=getAuth(_0x353244);return getUser(_0x353244,_0x2fbb95[_0xc65e('0x22')])[_0xc65e('0x1c')](function(_0x34eb48){_0x3d1a14=_0x34eb48;logger[_0xc65e('0xc')](_0xc65e('0x51'),_0x3d1a14['id']);return getEndUser(_0x353244,_0x4aad5d[_0xc65e('0x52')],_0x4aad5d['destcalleridnum']);})[_0xc65e('0x1c')](function(_0x34315d){_0x1ab159=_0x34315d;logger['info'](_0xc65e('0x46'),_0x1ab159['id']);return getTicket(_0x353244,_0x3d1a14,_0x1ab159,_0x4ba9a2,_0x4aad5d);})[_0xc65e('0x1c')](function(_0x47e8f6){if(_0x47e8f6&&_0x47e8f6['id']){logger[_0xc65e('0xc')](_0xc65e('0x53'));logger[_0xc65e('0xc')](_0xc65e('0x54'),_0x47e8f6['id']);logger[_0xc65e('0xc')](_0xc65e('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc65e('0x1a')](_0xc65e('0x47'),_0x2fbb95['name']),_0xc65e('0x48'),{'uri':util[_0xc65e('0x1a')](_0xc65e('0x49'),_0x353244[_0xc65e('0x1b')],_0x47e8f6['id'])});}})[_0xc65e('0x4a')](function(_0x3ce859){logger['error']('[OUTBOUND]',JSON[_0xc65e('0x2f')](_0x3ce859));});};exports[_0xc65e('0x55')]=function(_0xe837b5,_0x226144,_0x2d225c,_0x4d846b,_0x1e2eb9,_0x111baa){var _0x518bba,_0x1c3a46;_0x111baa[_0xc65e('0x1b')]=intUtil[_0xc65e('0x40')](_0x111baa[_0xc65e('0x1b')]);_0x111baa['serverUrl']=intUtil[_0xc65e('0x40')](_0x111baa[_0xc65e('0x41')]);if(_0x1e2eb9&&_0x1e2eb9[_0xc65e('0x56')]){logger[_0xc65e('0xc')]('['+_0x226144[_0xc65e('0x57')][_0xc65e('0x58')]()+']',_0xc65e('0x43'));_0x226144[_0xc65e('0x4f')]=util[_0xc65e('0x1a')](_0xc65e('0x50'),_0x111baa[_0xc65e('0x41')],_0x226144['uniqueid'],md5(_0x226144[_0xc65e('0x44')]));}else{_0x226144[_0xc65e('0x4f')]='';}headers[_0xc65e('0x45')]=getAuth(_0x111baa);return getUser(_0x111baa,'')[_0xc65e('0x1c')](function(_0x2a3288){_0x518bba=_0x2a3288;logger[_0xc65e('0xc')](_0xc65e('0x51'),_0x518bba['id']);return getEndUser(_0x111baa,_0x226144[_0xc65e('0xf')],_0x226144[_0xc65e('0x10')]);})['then'](function(_0x5b15a8){_0x1c3a46=_0x5b15a8;logger[_0xc65e('0xc')](_0xc65e('0x46'),_0x1c3a46['id']);return getTicket(_0x111baa,_0x518bba,_0x1c3a46,_0x2d225c,_0x226144);})[_0xc65e('0x1c')](function(_0x22fea4){if(_0x22fea4){logger[_0xc65e('0xc')](_0xc65e('0x53'));logger[_0xc65e('0xc')](_0xc65e('0x54'),_0x22fea4['id']);}})[_0xc65e('0x4a')](function(_0x36a338){logger['error']('['+_0x226144[_0xc65e('0x57')]['toUpperCase']()+']',JSON[_0xc65e('0x2f')](_0x36a338));});}; \ 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 9c16e4b..5e4c1ab 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 _0x2c66=['GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','catch','error','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','toUpperCase','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','socket.io-emitter'];(function(_0x2ea445,_0x1da228){var _0x390525=function(_0x29664b){while(--_0x29664b){_0x2ea445['push'](_0x2ea445['shift']());}};_0x390525(++_0x1da228);}(_0x2c66,0xea));var _0x62c6=function(_0x33007f,_0x4b38d2){_0x33007f=_0x33007f-0x0;var _0x10d38c=_0x2c66[_0x33007f];return _0x10d38c;};'use strict';var _=require('lodash');var rp=require(_0x62c6('0x0'));var md5=require(_0x62c6('0x1'));var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x62c6('0x2'));var intUtil=require(_0x62c6('0x3'));var config=require(_0x62c6('0x4'));var logger=require('../../../../config/logger')(_0x62c6('0x5'));config['redis']=_[_0x62c6('0x6')](config[_0x62c6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x62c6('0x8'))(new Redis(config[_0x62c6('0x7')]));function getAdminId(_0x1248ee,_0x1c4ede,_0x5c9706,_0x4a58b6){return new Promise(function(_0x43bfd4,_0x161345){var _0x870321=![];var _0x2119ac={'method':_0x62c6('0x9'),'uri':_0x4a58b6+_0x62c6('0xa'),'json':!![]};_0x2119ac[_0x62c6('0xb')]=_0x5c9706;logger[_0x62c6('0xc')](_0x62c6('0xd'));return rp(_0x2119ac)[_0x62c6('0xe')](function(_0x2ac5f1){if(_0x2ac5f1){var _0x3643ae=_0x2ac5f1[_0x62c6('0xf')];var _0x4c8510=null;for(_0x4c8510=0x0;_0x4c8510<_0x3643ae[_0x62c6('0x10')];_0x4c8510++){if(_0x3643ae[_0x4c8510]['email']===_0x1248ee[_0x62c6('0x11')]){_0x1248ee[_0x62c6('0x12')]=_0x3643ae[_0x4c8510]['id'];_0x870321=!![];}}if(_0x870321){logger[_0x62c6('0xc')](_0x62c6('0x13'),_0x1248ee['adminId']);_0x43bfd4(_0x1248ee);}else{_0x161345({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x161345({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x62c6('0x14')](function(_0x2f52cd){logger[_0x62c6('0x15')]('['+[_0x1c4ede['toUpperCase']()]+']',_0x2f52cd[_0x62c6('0x16')]);_0x161345(_0x2f52cd);});});}function getUser(_0x4fe268,_0x3f3801,_0x4a39ff){return function(_0x255e7a){return new Promise(function(_0x6b9eb2,_0x128ab8){var _0x46c499={'method':_0x62c6('0x9'),'uri':_0x4a39ff+_0x62c6('0xa'),'json':!![]};_0x46c499[_0x62c6('0xb')]=_0x3f3801;logger[_0x62c6('0xc')](_0x62c6('0x17'));return rp(_0x46c499)[_0x62c6('0xe')](function(_0x3cd691){if(_0x3cd691){var _0x426dad=_0x3cd691[_0x62c6('0xf')];var _0x1b55b3=![];var _0x58eb7f=null;if(_0x255e7a['agentEmail']!==null){logger['info'](_0x62c6('0x18'),_0x255e7a[_0x62c6('0x19')]);_0x255e7a[_0x62c6('0x1a')]=_0x255e7a[_0x62c6('0x19')];for(_0x58eb7f=0x0;_0x58eb7f<_0x426dad['length'];_0x58eb7f++){if(_0x426dad[_0x58eb7f][_0x62c6('0x1b')]===_0x255e7a[_0x62c6('0x19')]){_0x1b55b3=!![];_0x255e7a['userId']=_0x426dad[_0x58eb7f]['id'];logger[_0x62c6('0xc')]('User\x20found:',_0x255e7a[_0x62c6('0x1c')]);}}}if(!_0x1b55b3){logger[_0x62c6('0xc')](_0x62c6('0x1d'));_0x255e7a[_0x62c6('0x1a')]=_0x255e7a[_0x62c6('0x11')];_0x255e7a[_0x62c6('0x1c')]=_0x255e7a[_0x62c6('0x12')];_0x1b55b3=!![];}if(_0x1b55b3){_0x6b9eb2(_0x255e7a);}else{_0x128ab8({'statusCode':0x194,'message':_0x62c6('0x1e')});}}else{_0x128ab8({'statusCode':0x194,'message':_0x62c6('0x1e')});}})[_0x62c6('0x14')](function(_0x1684a4){logger[_0x62c6('0x15')]('['+[_0x4fe268[_0x62c6('0x1f')]()]+']',_0x1684a4[_0x62c6('0x16')]);_0x128ab8(_0x1684a4);});});};}function searchContact(_0x3caf79,_0x9fcbc3,_0x2a2cbf,_0x2a6c10){return new Promise(function(_0x4e6801,_0x4ca41c){var _0x26b647={'method':'GET','headers':_0x9fcbc3,'uri':_0x3caf79+'/api/lookup?q='+_0x2a6c10+'&f='+_0x2a2cbf+_0x62c6('0x20'),'json':!![]};rp(_0x26b647)[_0x62c6('0xe')](function(_0x2e03d4){var _0x12c7c9=_[_0x62c6('0x21')](_0x2e03d4[_0x62c6('0x22')][_0x62c6('0x22')],[_0x2a2cbf,_0x2a6c10]);_0x4e6801(_0x12c7c9);})[_0x62c6('0x14')](function(_0x447d89){_0x4ca41c(_0x447d89);});});}function getEndUser(_0x42213c,_0x4476cf,_0x1fc49b){return function(_0x1fcbf9){return new Promise(function(_0x596caf,_0x1d43e6){logger['info'](util[_0x62c6('0x23')](_0x62c6('0x24'),_0x1fcbf9[_0x62c6('0x25')]));searchContact(_0x1fc49b,_0x4476cf,_0x62c6('0x26'),_0x1fcbf9[_0x62c6('0x25')])[_0x62c6('0xe')](function(_0x197209){if(_0x197209){_0x1fcbf9['endUserId']=_0x197209['id'];logger['info'](_0x62c6('0x27'),_0x1fcbf9[_0x62c6('0x28')]);return _0x596caf(_0x1fcbf9);}searchContact(_0x1fc49b,_0x4476cf,_0x62c6('0x29'),_0x1fcbf9[_0x62c6('0x25')])['then'](function(_0x106d97){if(_0x106d97){_0x1fcbf9[_0x62c6('0x28')]=_0x106d97['id'];logger['info'](_0x62c6('0x2a'),_0x1fcbf9[_0x62c6('0x28')]);return _0x596caf(_0x1fcbf9);}createEndUser(_0x1fcbf9,_0x42213c,_0x4476cf,_0x1fc49b)[_0x62c6('0xe')](function(_0x7571fa){logger[_0x62c6('0xc')]('Contact\x20created:',_0x7571fa[_0x62c6('0x28')]);return _0x596caf(_0x7571fa);});});})[_0x62c6('0x14')](function(_0x278eb6){_0x1d43e6(_0x278eb6);});});};}function createEndUser(_0x155bf8,_0x3175b1,_0x4e3b74,_0x57bb3c){return new Promise(function(_0x1c6036,_0x39666c){var _0x368d76=moment();var _0x39d4a2={'method':_0x62c6('0x2b'),'uri':_0x57bb3c+_0x62c6('0x2c'),'body':{'contact':{'last_name':_0x155bf8[_0x62c6('0x25')],'work_number':_0x155bf8[_0x62c6('0x25')],'mobile_number':_0x155bf8['contactNumber'],'owner_id':_0x155bf8['userId'],'created_at':_0x368d76[_0x62c6('0x23')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x39d4a2[_0x62c6('0xb')]=_0x4e3b74;logger[_0x62c6('0xc')](_0x62c6('0x2d'));return rp(_0x39d4a2)[_0x62c6('0xe')](function(_0x5cda41){_0x155bf8[_0x62c6('0x28')]=_0x5cda41[_0x62c6('0x2e')]['id'];_0x1c6036(_0x155bf8);})['catch'](function(_0x5a2946){logger[_0x62c6('0x15')]('['+[_0x3175b1[_0x62c6('0x1f')]()]+']',_0x5a2946['message']);_0x39666c(_0x5a2946[_0x62c6('0x16')]);});});}function getTicket(_0xaecf73,_0x441936,_0x29a2a8,_0x12f910,_0x3f505c){return function(_0x28e2c2){logger[_0x62c6('0xc')](_0x62c6('0x2f'));return new Promise(function(_0x45bec9,_0x56bcc4){var _0x293eba=moment();var _0xb4456a={'method':_0x62c6('0x2b'),'uri':_0x29a2a8+_0x62c6('0x30'),'body':{'title':intUtil[_0x62c6('0x31')](_0x12f910[_0x62c6('0x32')],_0x3f505c,'\x20'),'description':intUtil[_0x62c6('0x31')](_0x12f910['Descriptions'],_0x3f505c,'\x0a'),'owner_id':_0x28e2c2[_0x62c6('0x1c')],'creater_id':_0x28e2c2['adminId'],'targetable_id':_0x28e2c2[_0x62c6('0x28')],'targetable_type':'Contact','created_at':_0x293eba[_0x62c6('0x23')](_0x62c6('0x33')),'due_date':_0x293eba[_0x62c6('0x34')](0x1e,'m')[_0x62c6('0x23')](_0x62c6('0x33'))},'json':!![]};_0xb4456a[_0x62c6('0xb')]=_0x441936;return rp(_0xb4456a)['then'](function(_0x46d7ea){_0x28e2c2[_0x62c6('0x35')]=_0x46d7ea['task']['id'];logger[_0x62c6('0xc')]('Task\x20created:',_0x28e2c2[_0x62c6('0x35')]);_0x45bec9(_0x28e2c2);})[_0x62c6('0x14')](function(_0x40f4eb){logger[_0x62c6('0x15')]('['+[_0xaecf73[_0x62c6('0x1f')]()]+']',_0x40f4eb[_0x62c6('0x16')]);_0x56bcc4(_0x40f4eb['message']);});});};}function emit(_0x3fa604,_0x1ea1b1,_0x320a42){var _0x42a8fb={'uri':_0x3fa604+_0x62c6('0x36')+_0x320a42};io['to'](util[_0x62c6('0x23')](_0x62c6('0x37'),_0x1ea1b1))[_0x62c6('0x38')](_0x62c6('0x39'),_0x42a8fb);}exports['cs']=function(_0x4bda63,_0x4662c4,_0x28374c,_0x5876e7,_0x16f207,_0x361374,_0x3483d8,_0x4a8836){var _0x41a318={};var _0x4b8500={'Authorization':_0x62c6('0x3a')+_0x361374['apiKey']};_0x361374[_0x62c6('0x3b')]=intUtil['stripTrailingSlash'](_0x361374[_0x62c6('0x3b')]);_0x361374[_0x62c6('0x3c')]=intUtil[_0x62c6('0x3d')](_0x361374[_0x62c6('0x3c')]);var _0x1ec9dd=_0x361374[_0x62c6('0x3b')];_0x41a318[_0x62c6('0x11')]=_0x361374[_0x62c6('0x3e')];_0x41a318['contactNumber']=_0x4a8836[_0x62c6('0x3f')]()==='outbound'?_0x4662c4['destcalleridnum']:_0x4662c4[_0x62c6('0x40')];_0x41a318[_0x62c6('0x41')]=_0x4a8836===_0x62c6('0x42')||_0x4a8836===_0x62c6('0x43')?_0x62c6('0x42'):'outbound';if(_0x5876e7){_0x41a318[_0x62c6('0x19')]=_0x5876e7[_0x62c6('0x1b')];}var _0x79ba4f=util[_0x62c6('0x23')](_0x62c6('0x44'),_0x361374[_0x62c6('0x3c')],_0x4662c4[_0x62c6('0x45')],md5(_0x4662c4[_0x62c6('0x45')]));if(_0x16f207&&_0x16f207[_0x62c6('0x46')]){logger[_0x62c6('0xc')](_0x62c6('0x47'),_0x62c6('0x48'));_0x4662c4[_0x62c6('0x49')]=_0x79ba4f;}else if(_0x3483d8&&_0x3483d8[_0x62c6('0x4a')]&&_0x3483d8['recordingFormat']!=='none'){logger['info'](_0x62c6('0x4b'),_0x62c6('0x48'));_0x4662c4[_0x62c6('0x49')]=_0x79ba4f;}else{_0x4662c4[_0x62c6('0x49')]='';}return getAdminId(_0x41a318,_0x4a8836,_0x4b8500,_0x1ec9dd)[_0x62c6('0xe')](getUser(_0x4a8836,_0x4b8500,_0x1ec9dd))['then'](getEndUser(_0x4a8836,_0x4b8500,_0x1ec9dd))[_0x62c6('0xe')](getTicket(_0x4a8836,_0x4b8500,_0x1ec9dd,_0x28374c,_0x4662c4))[_0x62c6('0xe')](function(_0x291cb2){logger[_0x62c6('0xc')](util[_0x62c6('0x23')](_0x62c6('0x4c'),_0x291cb2['ticketId']));if(_0x4a8836!==_0x62c6('0x43')){logger['info']('['+[_0x4a8836[_0x62c6('0x1f')]()]+']',_0x62c6('0x4d'));emit(_0x1ec9dd,_0x5876e7[_0x62c6('0x4e')],_0x291cb2[_0x62c6('0x28')]);}})[_0x62c6('0x14')](function(_0x497a04){logger[_0x62c6('0x15')]('['+[_0x4a8836[_0x62c6('0x1f')]()]+_0x62c6('0x4f'),util[_0x62c6('0x50')](_0x497a04,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4932=['username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','Requested\x20Resource\x20not\x20Found','error','toUpperCase','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','Admin\x20selected','adminId','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','contact','catch','message','Creating\x20new\x20task','POST','getString','Subjects','add','YYYY-MM-DDTHH:mm:ss','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x105a8e,_0x12dd9a){var _0x298729=function(_0x3e9079){while(--_0x3e9079){_0x105a8e['push'](_0x105a8e['shift']());}};_0x298729(++_0x12dd9a);}(_0x4932,0x1be));var _0x2493=function(_0x47640d,_0x109c5a){_0x47640d=_0x47640d-0x0;var _0x22246f=_0x4932[_0x47640d];return _0x22246f;};'use strict';var _=require(_0x2493('0x0'));var rp=require(_0x2493('0x1'));var md5=require(_0x2493('0x2'));var util=require('util');var moment=require(_0x2493('0x3'));var Promise=require(_0x2493('0x4'));var Redis=require(_0x2493('0x5'));var intUtil=require('./util');var config=require(_0x2493('0x6'));var logger=require(_0x2493('0x7'))(_0x2493('0x8'));config[_0x2493('0x9')]=_[_0x2493('0xa')](config[_0x2493('0x9')],{'host':_0x2493('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2493('0x9')]));function getAdminId(_0x2e4dbb,_0x44f0fb,_0x55c3d7,_0x58955e){return new Promise(function(_0x59c563,_0x4467bb){var _0x304679=![];var _0x370777={'method':_0x2493('0xc'),'uri':_0x58955e+_0x2493('0xd'),'json':!![]};_0x370777[_0x2493('0xe')]=_0x55c3d7;logger[_0x2493('0xf')](_0x2493('0x10'));return rp(_0x370777)[_0x2493('0x11')](function(_0x22e793){if(_0x22e793){var _0x36760e=_0x22e793[_0x2493('0x12')];var _0x5f5473=null;for(_0x5f5473=0x0;_0x5f5473<_0x36760e[_0x2493('0x13')];_0x5f5473++){if(_0x36760e[_0x5f5473]['email']===_0x2e4dbb[_0x2493('0x14')]){_0x2e4dbb['adminId']=_0x36760e[_0x5f5473]['id'];_0x304679=!![];}}if(_0x304679){logger[_0x2493('0xf')]('Admin\x20found:',_0x2e4dbb['adminId']);_0x59c563(_0x2e4dbb);}else{_0x4467bb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4467bb({'statusCode':0x194,'message':_0x2493('0x15')});}})['catch'](function(_0x4dd514){logger[_0x2493('0x16')]('['+[_0x44f0fb[_0x2493('0x17')]()]+']',_0x4dd514['message']);_0x4467bb(_0x4dd514);});});}function getUser(_0x445990,_0x3574c8,_0x161edf){return function(_0x21704a){return new Promise(function(_0x5cdade,_0xa0f3a8){var _0x3879b4={'method':_0x2493('0xc'),'uri':_0x161edf+_0x2493('0xd'),'json':!![]};_0x3879b4[_0x2493('0xe')]=_0x3574c8;logger[_0x2493('0xf')]('Getting\x20user\x20list');return rp(_0x3879b4)[_0x2493('0x11')](function(_0x349c6c){if(_0x349c6c){var _0x3f85ea=_0x349c6c['users'];var _0x27c9b3=![];var _0x1b1501=null;if(_0x21704a[_0x2493('0x18')]!==null){logger[_0x2493('0xf')](_0x2493('0x19'),_0x21704a[_0x2493('0x18')]);_0x21704a[_0x2493('0x1a')]=_0x21704a['agentEmail'];for(_0x1b1501=0x0;_0x1b1501<_0x3f85ea['length'];_0x1b1501++){if(_0x3f85ea[_0x1b1501][_0x2493('0x1b')]===_0x21704a['agentEmail']){_0x27c9b3=!![];_0x21704a[_0x2493('0x1c')]=_0x3f85ea[_0x1b1501]['id'];logger[_0x2493('0xf')]('User\x20found:',_0x21704a[_0x2493('0x1c')]);}}}if(!_0x27c9b3){logger['info'](_0x2493('0x1d'));_0x21704a['userEmail']=_0x21704a[_0x2493('0x14')];_0x21704a[_0x2493('0x1c')]=_0x21704a[_0x2493('0x1e')];_0x27c9b3=!![];}if(_0x27c9b3){_0x5cdade(_0x21704a);}else{_0xa0f3a8({'statusCode':0x194,'message':_0x2493('0x15')});}}else{_0xa0f3a8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x5d6aa3){logger[_0x2493('0x16')]('['+[_0x445990[_0x2493('0x17')]()]+']',_0x5d6aa3['message']);_0xa0f3a8(_0x5d6aa3);});});};}function searchContact(_0x5f0f54,_0x4642e3,_0x4ae11c,_0x37940a){return new Promise(function(_0x1c84b9,_0x4a73ba){var _0x2b62b1={'method':_0x2493('0xc'),'headers':_0x4642e3,'uri':_0x5f0f54+'/api/lookup?q='+_0x37940a+_0x2493('0x1f')+_0x4ae11c+_0x2493('0x20'),'json':!![]};rp(_0x2b62b1)['then'](function(_0x5c4a1a){var _0x5a3413=_[_0x2493('0x21')](_0x5c4a1a[_0x2493('0x22')][_0x2493('0x22')],[_0x4ae11c,_0x37940a]);_0x1c84b9(_0x5a3413);})['catch'](function(_0x45c5ba){_0x4a73ba(_0x45c5ba);});});}function getEndUser(_0x151441,_0x451093,_0x8c26ba){return function(_0x59de09){return new Promise(function(_0x21530e,_0x3e0f05){logger[_0x2493('0xf')](util[_0x2493('0x23')](_0x2493('0x24'),_0x59de09[_0x2493('0x25')]));searchContact(_0x8c26ba,_0x451093,_0x2493('0x26'),_0x59de09[_0x2493('0x25')])[_0x2493('0x11')](function(_0x134ce1){if(_0x134ce1){_0x59de09[_0x2493('0x27')]=_0x134ce1['id'];logger[_0x2493('0xf')](_0x2493('0x28'),_0x59de09[_0x2493('0x27')]);return _0x21530e(_0x59de09);}searchContact(_0x8c26ba,_0x451093,_0x2493('0x29'),_0x59de09[_0x2493('0x25')])[_0x2493('0x11')](function(_0x394d14){if(_0x394d14){_0x59de09[_0x2493('0x27')]=_0x394d14['id'];logger[_0x2493('0xf')](_0x2493('0x2a'),_0x59de09[_0x2493('0x27')]);return _0x21530e(_0x59de09);}createEndUser(_0x59de09,_0x151441,_0x451093,_0x8c26ba)['then'](function(_0x3c7c52){logger[_0x2493('0xf')](_0x2493('0x2b'),_0x3c7c52[_0x2493('0x27')]);return _0x21530e(_0x3c7c52);});});})['catch'](function(_0x574200){_0x3e0f05(_0x574200);});});};}function createEndUser(_0x136673,_0x353dcf,_0x3ed3c6,_0x20001d){return new Promise(function(_0x5e03d4,_0x19f54b){var _0x579055=moment();var _0x4a2c5e={'method':'POST','uri':_0x20001d+_0x2493('0x2c'),'body':{'contact':{'last_name':_0x136673[_0x2493('0x25')],'work_number':_0x136673[_0x2493('0x25')],'mobile_number':_0x136673[_0x2493('0x25')],'owner_id':_0x136673[_0x2493('0x1c')],'created_at':_0x579055['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4a2c5e[_0x2493('0xe')]=_0x3ed3c6;logger[_0x2493('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4a2c5e)[_0x2493('0x11')](function(_0x55f3aa){_0x136673[_0x2493('0x27')]=_0x55f3aa[_0x2493('0x2d')]['id'];_0x5e03d4(_0x136673);})[_0x2493('0x2e')](function(_0x4282e5){logger[_0x2493('0x16')]('['+[_0x353dcf['toUpperCase']()]+']',_0x4282e5[_0x2493('0x2f')]);_0x19f54b(_0x4282e5[_0x2493('0x2f')]);});});}function getTicket(_0x22095f,_0x206ff2,_0x1035d5,_0x1197e2,_0x38f395){return function(_0x655883){logger['info'](_0x2493('0x30'));return new Promise(function(_0x37ce27,_0x4ad376){var _0x517cd9=moment();var _0x57a2a4={'method':_0x2493('0x31'),'uri':_0x1035d5+'/api/tasks','body':{'title':intUtil[_0x2493('0x32')](_0x1197e2[_0x2493('0x33')],_0x38f395,'\x20'),'description':intUtil[_0x2493('0x32')](_0x1197e2['Descriptions'],_0x38f395,'\x0a'),'owner_id':_0x655883['userId'],'creater_id':_0x655883[_0x2493('0x1e')],'targetable_id':_0x655883[_0x2493('0x27')],'targetable_type':'Contact','created_at':_0x517cd9['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x517cd9[_0x2493('0x34')](0x1e,'m')[_0x2493('0x23')](_0x2493('0x35'))},'json':!![]};_0x57a2a4[_0x2493('0xe')]=_0x206ff2;return rp(_0x57a2a4)[_0x2493('0x11')](function(_0x234dc3){_0x655883['ticketId']=_0x234dc3['task']['id'];logger[_0x2493('0xf')](_0x2493('0x36'),_0x655883[_0x2493('0x37')]);_0x37ce27(_0x655883);})[_0x2493('0x2e')](function(_0x53208d){logger[_0x2493('0x16')]('['+[_0x22095f[_0x2493('0x17')]()]+']',_0x53208d['message']);_0x4ad376(_0x53208d[_0x2493('0x2f')]);});});};}function emit(_0x5a1c2d,_0x4832d9,_0x24c2fe){var _0x5b0298={'uri':_0x5a1c2d+'/contacts/'+_0x24c2fe};io['to'](util[_0x2493('0x23')](_0x2493('0x38'),_0x4832d9))[_0x2493('0x39')](_0x2493('0x3a'),_0x5b0298);}exports['cs']=function(_0x356b3e,_0x66ff81,_0x501001,_0x209877,_0x579b34,_0x3cb949,_0x27b360,_0x4210d1){var _0x3300d1={};var _0x214a03={'Authorization':_0x2493('0x3b')+_0x3cb949[_0x2493('0x3c')]};_0x3cb949[_0x2493('0x3d')]=intUtil[_0x2493('0x3e')](_0x3cb949[_0x2493('0x3d')]);_0x3cb949[_0x2493('0x3f')]=intUtil[_0x2493('0x3e')](_0x3cb949[_0x2493('0x3f')]);var _0x231dde=_0x3cb949[_0x2493('0x3d')];_0x3300d1[_0x2493('0x14')]=_0x3cb949[_0x2493('0x40')];_0x3300d1[_0x2493('0x25')]=_0x4210d1[_0x2493('0x41')]()==='outbound'?_0x66ff81[_0x2493('0x42')]:_0x66ff81[_0x2493('0x43')];_0x3300d1[_0x2493('0x44')]=_0x4210d1===_0x2493('0x45')||_0x4210d1===_0x2493('0x46')?_0x2493('0x45'):_0x2493('0x47');if(_0x209877){_0x3300d1[_0x2493('0x18')]=_0x209877[_0x2493('0x1b')];}var _0x290593=util[_0x2493('0x23')](_0x2493('0x48'),_0x3cb949[_0x2493('0x3f')],_0x66ff81['uniqueid'],md5(_0x66ff81[_0x2493('0x49')]));if(_0x579b34&&_0x579b34[_0x2493('0x4a')]){logger[_0x2493('0xf')](_0x2493('0x4b'),_0x2493('0x4c'));_0x66ff81[_0x2493('0x4d')]=_0x290593;}else if(_0x27b360&&_0x27b360['recordingFormat']&&_0x27b360[_0x2493('0x4e')]!=='none'){logger[_0x2493('0xf')](_0x2493('0x4f'),_0x2493('0x4c'));_0x66ff81['recordingURL']=_0x290593;}else{_0x66ff81[_0x2493('0x4d')]='';}return getAdminId(_0x3300d1,_0x4210d1,_0x214a03,_0x231dde)[_0x2493('0x11')](getUser(_0x4210d1,_0x214a03,_0x231dde))[_0x2493('0x11')](getEndUser(_0x4210d1,_0x214a03,_0x231dde))[_0x2493('0x11')](getTicket(_0x4210d1,_0x214a03,_0x231dde,_0x501001,_0x66ff81))[_0x2493('0x11')](function(_0x1b3210){logger['info'](util['format'](_0x2493('0x50'),_0x1b3210[_0x2493('0x37')]));if(_0x4210d1!=='unmanaged'){logger[_0x2493('0xf')]('['+[_0x4210d1[_0x2493('0x17')]()]+']',_0x2493('0x51'));emit(_0x231dde,_0x209877[_0x2493('0x52')],_0x1b3210['endUserId']);}})[_0x2493('0x2e')](function(_0x5ac972){logger['error']('['+[_0x4210d1[_0x2493('0x17')]()]+_0x2493('0x53'),util[_0x2493('0x54')](_0x5ac972,{'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 3cd4350..a152e6e 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 _0x8c6f=['./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','vtiger','dynamics365','freshsales','includes','data1','data2','find','data3','queue','routeId','log','unmanaged','toLowerCase','sugarcrm','freshdesk','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','util'];(function(_0x56f02c,_0x3d0a76){var _0x18baf2=function(_0x5d1666){while(--_0x5d1666){_0x56f02c['push'](_0x56f02c['shift']());}};_0x18baf2(++_0x3d0a76);}(_0x8c6f,0x8b));var _0xf8c6=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x8c6f[_0x29d915];return _0x160f86;};'use strict';var _=require('lodash');var util=require(_0xf8c6('0x0'));var zendesk=require(_0xf8c6('0x1'));var salesforce=require(_0xf8c6('0x2'));var sugarcrm=require(_0xf8c6('0x3'));var freshdesk=require(_0xf8c6('0x4'));var zoho=require(_0xf8c6('0x5'));var desk=require(_0xf8c6('0x6'));var vtiger=require(_0xf8c6('0x7'));var servicenow=require(_0xf8c6('0x8'));var dynamics365=require(_0xf8c6('0x9'));var freshsales=require(_0xf8c6('0xa'));var integrations=[_0xf8c6('0xb'),_0xf8c6('0xc'),'sugarcrm','freshdesk','zoho','desk',_0xf8c6('0xd'),_0xf8c6('0xe'),_0xf8c6('0xf'),'servicenow'];exports['exec']=function(_0x3fcaf7,_0x76d8c8,_0x52c165,_0x3401ea,_0x3d4c57,_0x47f4c8){if(_0x52c165){if(_[_0xf8c6('0x10')](integrations,_0x3fcaf7['data1']['toLowerCase']())){try{var _0x22bfa0=null;var _0x15b24d='';var _0x39a281=_0x52c165[_0x3fcaf7[_0xf8c6('0x11')]['toLowerCase']()];if(_0x39a281){var _0x303add=_0x39a281[_0x3fcaf7[_0xf8c6('0x12')]];if(_0x303add){var _0x426a61=_[_0xf8c6('0x13')](_0x303add['Configurations'],{'id':parseInt(_0x3fcaf7[_0xf8c6('0x14')],0xa)});if(_0x426a61){if(_0x3401ea){if(_0x3d4c57&&_0x76d8c8[_0xf8c6('0x15')]){_0x15b24d=_0xf8c6('0x15');}else if(_0x76d8c8[_0xf8c6('0x16')]){_0x15b24d='outbound';}else{console[_0xf8c6('0x17')]('EVENT\x20UNKNOWN',_0x76d8c8);}}else{_0x15b24d=_0xf8c6('0x18');}switch(_0x3fcaf7[_0xf8c6('0x11')][_0xf8c6('0x19')]()){case _0xf8c6('0xb'):zendesk[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case'salesforce':salesforce[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case _0xf8c6('0x1a'):sugarcrm[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case _0xf8c6('0x1b'):freshdesk[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case'zoho':zoho[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case _0xf8c6('0x1c'):desk[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case _0xf8c6('0xd'):vtiger[_0x15b24d](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8);break;case _0xf8c6('0xf'):freshsales['cs'](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8,_0x15b24d);break;case'servicenow':servicenow['cs'](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8,_0x15b24d);break;case _0xf8c6('0xe'):dynamics365['cs'](_0x3fcaf7,_0x76d8c8,_0x426a61,_0x3401ea,_0x3d4c57,_0x303add,_0x47f4c8,_0x15b24d);break;default:console['log'](_0xf8c6('0x1d'));}}else{_0x22bfa0=require(_0xf8c6('0x1e'))(_0x3fcaf7['data1']['toLowerCase']());_0x22bfa0[_0xf8c6('0x1f')](_0xf8c6('0x20'),util[_0xf8c6('0x21')](_0xf8c6('0x22'),_0x3fcaf7[_0xf8c6('0x11')][_0xf8c6('0x19')](),_0x3fcaf7[_0xf8c6('0x14')]));}}else{_0x22bfa0=require(_0xf8c6('0x1e'))(_0x3fcaf7[_0xf8c6('0x11')][_0xf8c6('0x19')]());_0x22bfa0['error'](_0xf8c6('0x20'),util[_0xf8c6('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x3fcaf7['data1']['toLowerCase'](),_0x3fcaf7[_0xf8c6('0x12')]));}}else{}}catch(_0x595be8){console[_0xf8c6('0x1f')](_0x595be8);}}}}; \ No newline at end of file +var _0x17d5=['./freshdesk','./zoho','./vtiger','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','[EXEC]','format','error','util','./zendesk','./salesforce','./sugarcrm'];(function(_0xe86218,_0x563933){var _0x451d87=function(_0x1330dc){while(--_0x1330dc){_0xe86218['push'](_0xe86218['shift']());}};_0x451d87(++_0x563933);}(_0x17d5,0xa6));var _0x517d=function(_0x2dd9d3,_0x3e2780){_0x2dd9d3=_0x2dd9d3-0x0;var _0x534180=_0x17d5[_0x2dd9d3];return _0x534180;};'use strict';var _=require('lodash');var util=require(_0x517d('0x0'));var zendesk=require(_0x517d('0x1'));var salesforce=require(_0x517d('0x2'));var sugarcrm=require(_0x517d('0x3'));var freshdesk=require(_0x517d('0x4'));var zoho=require(_0x517d('0x5'));var desk=require('./desk');var vtiger=require(_0x517d('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x517d('0x7'));var integrations=[_0x517d('0x8'),_0x517d('0x9'),_0x517d('0xa'),'freshdesk',_0x517d('0xb'),_0x517d('0xc'),'vtiger',_0x517d('0xd'),_0x517d('0xe'),_0x517d('0xf')];exports['exec']=function(_0xb5dc5a,_0x3ab010,_0x4000f2,_0x16e2fe,_0x4a08cd,_0x1e609c){if(_0x4000f2){if(_[_0x517d('0x10')](integrations,_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')]())){try{var _0x502adc=null;var _0x4daf4d='';var _0x291591=_0x4000f2[_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')]()];if(_0x291591){var _0x3419c0=_0x291591[_0xb5dc5a[_0x517d('0x13')]];if(_0x3419c0){var _0x4c19f2=_[_0x517d('0x14')](_0x3419c0[_0x517d('0x15')],{'id':parseInt(_0xb5dc5a[_0x517d('0x16')],0xa)});if(_0x4c19f2){if(_0x16e2fe){if(_0x4a08cd&&_0x3ab010['queue']){_0x4daf4d=_0x517d('0x17');}else if(_0x3ab010[_0x517d('0x18')]){_0x4daf4d=_0x517d('0x19');}else{console[_0x517d('0x1a')](_0x517d('0x1b'),_0x3ab010);}}else{_0x4daf4d=_0x517d('0x1c');}switch(_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')]()){case _0x517d('0x8'):zendesk[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case'salesforce':salesforce[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case'sugarcrm':sugarcrm[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case'freshdesk':freshdesk[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case _0x517d('0xb'):zoho[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case'desk':desk[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case'vtiger':vtiger[_0x4daf4d](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c);break;case _0x517d('0xe'):freshsales['cs'](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c,_0x4daf4d);break;case _0x517d('0xf'):servicenow['cs'](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c,_0x4daf4d);break;case _0x517d('0xd'):dynamics365['cs'](_0xb5dc5a,_0x3ab010,_0x4c19f2,_0x16e2fe,_0x4a08cd,_0x3419c0,_0x1e609c,_0x4daf4d);break;default:console[_0x517d('0x1a')](_0x517d('0x1d'));}}else{_0x502adc=require(_0x517d('0x1e'))(_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')]());_0x502adc['error'](_0x517d('0x1f'),util[_0x517d('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0xb5dc5a['data1'][_0x517d('0x12')](),_0xb5dc5a[_0x517d('0x16')]));}}else{_0x502adc=require(_0x517d('0x1e'))(_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')]());_0x502adc['error'](_0x517d('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0xb5dc5a[_0x517d('0x11')][_0x517d('0x12')](),_0xb5dc5a[_0x517d('0x13')]));}}else{}}catch(_0x3e46aa){console[_0x517d('0x21')](_0x3e46aa);}}}}; \ 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 d75d342..1ec3d09 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 _0x1462=['util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','account','WhatId','Case','endUserType','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject','find','execute','then','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','length','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','','upperFirst','create','forEach','includes','string','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce'];(function(_0x3996e2,_0x5a4ed5){var _0x586f0c=function(_0x45a867){while(--_0x45a867){_0x3996e2['push'](_0x3996e2['shift']());}};_0x586f0c(++_0x5a4ed5);}(_0x1462,0x7a));var _0x2146=function(_0x5246e5,_0x376853){_0x5246e5=_0x5246e5-0x0;var _0xcaa328=_0x1462[_0x5246e5];return _0xcaa328;};'use strict';var _=require(_0x2146('0x0'));var rp=require(_0x2146('0x1'));var moment=require(_0x2146('0x2'));var BPromise=require(_0x2146('0x3'));var md5=require(_0x2146('0x4'));var jsforce=require(_0x2146('0x5'));var util=require(_0x2146('0x6'));var Redis=require(_0x2146('0x7'));var intUtil=require(_0x2146('0x8'));var config=require('../../../../config/environment');var logger=require(_0x2146('0x9'))(_0x2146('0xa'));config[_0x2146('0xb')]=_[_0x2146('0xc')](config[_0x2146('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x2146('0xd'))(new Redis(config[_0x2146('0xb')]));function emit(_0x474aeb,_0x5a02b6,_0x3687ad){io['to'](_0x474aeb)[_0x2146('0xe')](_0x5a02b6,_0x3687ad);}function getTicket(_0x450131,_0x109ef2,_0x5e820f,_0x45a472,_0x4c1aaf,_0x5b80d0,_0xa57e9c,_0x24234e){var _0x2d633d=Object[_0x2146('0xf')]({},{'OwnerId':_0x109ef2['id'],'Subject':intUtil[_0x2146('0x10')](_0x45a472[_0x2146('0x11')],_0x4c1aaf,'\x20'),'Description':intUtil[_0x2146('0x10')](_0x45a472[_0x2146('0x12')],_0x4c1aaf,'\x0a')},getCustomFields(_0x5b80d0,_0x4c1aaf));if(_0x5e820f){if(_0x45a472[_0x2146('0x13')]===_0x2146('0x14')){_0x2d633d[_0x2146('0x15')]=moment[_0x2146('0x16')]();_0x2d633d[_0x2146('0x17')]=![];_0x2d633d[_0x2146('0x18')]=![];if(_0x5e820f['endUserType']===_0x2146('0x19')||_0x5e820f['endUserType']===_0x2146('0x1a')){_0x2d633d['WhoId']=_0x5e820f['id'];}else if(_0x5e820f['endUserType']===_0x2146('0x1b')){_0x2d633d[_0x2146('0x1c')]=_0x5e820f['id'];}}else if(_0x45a472[_0x2146('0x13')]===_0x2146('0x1d')){if(_0x5e820f[_0x2146('0x1e')]===_0x2146('0x19')){_0x2d633d['ContactId']=_0x5e820f['id'];}else if(_0x5e820f[_0x2146('0x1e')]===_0x2146('0x1b')){_0x2d633d[_0x2146('0x1f')]=_0x5e820f['id'];}else if(_0x5e820f['endUserType']==='lead'&&_0x45a472['leadId']){_0x2d633d[_0x45a472[_0x2146('0x20')]]=_0x5e820f['id'];}else{logger[_0x2146('0x21')](_0x2146('0x22'));}}}return _0xa57e9c['sobject'](_0x45a472[_0x2146('0x13')])['create'](_0x2d633d);}function getUser(_0x14558b,_0x5e7934,_0x48093b){if(!_[_0x2146('0x23')](_0x5e7934)&&intUtil[_0x2146('0x24')](_0x5e7934)){var _0x273a87={'Email':_0x5e7934};var _0x13f1e6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48093b[_0x2146('0x25')]('User')[_0x2146('0x26')](_0x273a87,_0x13f1e6)[_0x2146('0x27')]()[_0x2146('0x28')](function(_0x5155a4){if(_0x5155a4['length']){var _0x22d2c6=_[_0x2146('0x26')](_0x5155a4,function(_0x5351c0){return _0x5351c0['Email']===_0x5e7934;});if(_0x22d2c6){logger['info'](_0x2146('0x29'),_0x5e7934);return BPromise[_0x2146('0x2a')]({'id':_0x22d2c6['Id'],'name':_0x22d2c6[_0x2146('0x2b')]});}}else{logger[_0x2146('0x21')](_0x2146('0x2c'),_0x5e7934);return _0x48093b[_0x2146('0x2d')]()[_0x2146('0x28')](function(_0x38766d){return BPromise['resolve']({'id':_0x38766d[_0x2146('0x2e')],'name':_0x38766d[_0x2146('0x2f')]});});}});}else{logger[_0x2146('0x21')](_0x2146('0x2c'),_0x5e7934);return _0x48093b['identity']()[_0x2146('0x28')](function(_0x4b03b9){return BPromise[_0x2146('0x2a')]({'id':_0x4b03b9[_0x2146('0x2e')],'name':_0x4b03b9[_0x2146('0x2f')]});});}}function getEndUser(_0x5b7186,_0xe7bfbd,_0x580890,_0x89ebd2,_0x3216b9){var _0x244c58={'$or':{'Phone':_0x89ebd2}};var _0x22731a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2146('0x2a')]()[_0x2146('0x28')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x89ebd2,_0xe7bfbd[_0x2146('0x30')]);switch(_0xe7bfbd['moduleSearch']){case _0x2146('0x31'):var _0x300350=_[_0x2146('0x32')](_0x244c58);if(_0xe7bfbd[_0x2146('0x33')]){var _0x494a9e={};_0x494a9e[_0xe7bfbd[_0x2146('0x33')]]=_0x89ebd2;_['merge'](_0x300350[_0x2146('0x34')],_0x494a9e);}return _0x3216b9[_0x2146('0x25')](_0x2146('0x35'))[_0x2146('0x26')](_0x300350,_0x22731a)['execute']()[_0x2146('0x28')](function(_0x436efe){if(_0x436efe&&_0x436efe[_0x2146('0x36')]){return _0x436efe;}else{var _0x5a29a7=_[_0x2146('0x32')](_0x244c58);if(_0xe7bfbd[_0x2146('0x37')]){var _0x263c1c={};_0x263c1c[_0xe7bfbd['additionalSearchLead']]=_0x89ebd2;_[_0x2146('0x38')](_0x5a29a7['$or'],_0x263c1c);}return _0x3216b9['sobject'](_0x2146('0x39'))[_0x2146('0x26')](_0x5a29a7,_0x22731a);}});case'account_contact_lead':var _0x21c55a=_['cloneDeep'](_0x244c58);if(_0xe7bfbd[_0x2146('0x3a')]){var _0x494a9e={};_0x494a9e[_0xe7bfbd[_0x2146('0x3a')]]=_0x89ebd2;_[_0x2146('0x38')](_0x21c55a['$or'],_0x494a9e);}return _0x3216b9[_0x2146('0x25')](_0x2146('0x3b'))[_0x2146('0x26')](_0x21c55a,_0x22731a)[_0x2146('0x27')]()['then'](function(_0x2a40ce){if(_0x2a40ce&&_0x2a40ce[_0x2146('0x36')]){return _0x2a40ce;}else{var _0x556301=_['cloneDeep'](_0x244c58);if(_0xe7bfbd[_0x2146('0x33')]){var _0x864cd3={};_0x864cd3[_0xe7bfbd[_0x2146('0x33')]]=_0x89ebd2;_[_0x2146('0x38')](_0x556301[_0x2146('0x34')],_0x864cd3);}return _0x3216b9[_0x2146('0x25')]('Contact')[_0x2146('0x26')](_0x556301,_0x22731a)[_0x2146('0x28')](function(_0x3dbe16){if(_0x3dbe16&&_0x3dbe16[_0x2146('0x36')]){return _0x3dbe16;}else{var _0x253833=_[_0x2146('0x32')](_0x244c58);if(_0xe7bfbd['additionalSearchLead']){var _0x4cdcfb={};_0x4cdcfb[_0xe7bfbd[_0x2146('0x37')]]=_0x89ebd2;_[_0x2146('0x38')](_0x253833[_0x2146('0x34')],_0x4cdcfb);}return _0x3216b9['sobject'](_0x2146('0x39'))[_0x2146('0x26')](_0x253833,_0x22731a);}});}});case _0x2146('0x19'):var _0x300350=_[_0x2146('0x32')](_0x244c58);if(_0xe7bfbd['additionalSearchContact']){var _0x494a9e={};_0x494a9e[_0xe7bfbd[_0x2146('0x33')]]=_0x89ebd2;_['merge'](_0x300350['$or'],_0x494a9e);}return _0x3216b9[_0x2146('0x25')](_0x2146('0x35'))['find'](_0x300350,_0x22731a)[_0x2146('0x27')]();case _0x2146('0x1a'):var _0x21d89c=_['cloneDeep'](_0x244c58);if(_0xe7bfbd['additionalSearchLead']){var _0x494a9e={};_0x494a9e[_0xe7bfbd[_0x2146('0x37')]]=_0x89ebd2;_[_0x2146('0x38')](_0x21d89c[_0x2146('0x34')],_0x494a9e);}return _0x3216b9[_0x2146('0x25')](_0x2146('0x39'))[_0x2146('0x26')](_0x21d89c,_0x22731a);case _0x2146('0x1b'):var _0x21c55a=_[_0x2146('0x32')](_0x244c58);if(_0xe7bfbd[_0x2146('0x3a')]){var _0x494a9e={};_0x494a9e[_0xe7bfbd[_0x2146('0x3a')]]=_0x89ebd2;_['merge'](_0x21c55a[_0x2146('0x34')],_0x494a9e);}return _0x3216b9[_0x2146('0x25')](_0x2146('0x3b'))[_0x2146('0x26')](_0x21c55a,_0x22731a);default:return null;}})[_0x2146('0x28')](function(_0x43f7b1){if(_0x43f7b1&&_0x43f7b1[_0x2146('0x36')]){var _0x463f22=_['first'](_0x43f7b1);if(_0x463f22){return BPromise[_0x2146('0x2a')]({'id':_0x463f22['Id'],'name':_0x463f22[_0x2146('0x2b')],'phone':_0x463f22[_0x2146('0x3c')],'endUserType':_0x463f22[_0x2146('0x3d')][_0x2146('0x3e')][_0x2146('0x3f')]()});}}})['then'](function(_0x2cc3b3){if(_0x2cc3b3){logger[_0x2146('0x21')](_0x2146('0x40'),_0x2cc3b3[_0x2146('0x1e')],_0x89ebd2);return BPromise[_0x2146('0x2a')](_0x2cc3b3);}else{logger[_0x2146('0x21')](_0x2146('0x41'),_0x89ebd2);var _0x30ab2e={'Phone':_0x89ebd2};if(_0xe7bfbd[_0x2146('0x42')]){if(_0xe7bfbd['moduleCreate']==='contact'){logger['info'](_0x2146('0x43'),_0x89ebd2,_0xe7bfbd[_0x2146('0x42')]);_0x30ab2e[_0x2146('0x44')]=_0x580890!==''?_0x580890:util[_0x2146('0x45')](_0x2146('0x46'),_0x89ebd2);}else if(_0xe7bfbd[_0x2146('0x42')]===_0x2146('0x1a')){logger[_0x2146('0x21')](_0x2146('0x43'),_0x89ebd2,_0xe7bfbd['moduleCreate']);_0x30ab2e[_0x2146('0x44')]=_0x580890!==''?_0x580890:util[_0x2146('0x45')](_0x2146('0x46'),_0x89ebd2);_0x30ab2e[_0x2146('0x47')]='No\x20Company';}else if(_0xe7bfbd[_0x2146('0x42')]===_0x2146('0x1b')){logger[_0x2146('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x89ebd2,_0xe7bfbd[_0x2146('0x42')]);_0x30ab2e['Name']=_0x580890!==_0x2146('0x48')?_0x580890:util[_0x2146('0x45')](_0x2146('0x46'),_0x89ebd2);}else{return null;}}return _0x3216b9['sobject'](_[_0x2146('0x49')](_0xe7bfbd[_0x2146('0x42')]))[_0x2146('0x4a')](_0x30ab2e)['then'](function(_0x17a852){return BPromise[_0x2146('0x2a')]({'id':_0x17a852['id'],'endUserType':_0xe7bfbd[_0x2146('0x42')]});});}});}function getCustomFields(_0x15462f,_0x556e28){var _0x201764={};if(_0x15462f[_0x2146('0x36')]>0x0){_[_0x2146('0x4b')](_0x15462f,function(_0xf56828){if(_[_0x2146('0x4c')]([_0x2146('0x4d'),'picklist'],_0xf56828['type'])&&_0xf56828[_0x2146('0x4e')]){_0x201764[_0xf56828[_0x2146('0x4e')]]=_0xf56828[_0x2146('0x4f')][_0x2146('0x50')]();}else if(_0xf56828[_0x2146('0x3e')]===_0x2146('0x51')&&_0xf56828[_0x2146('0x52')]&&_0xf56828['idField']){_0x556e28[_0xf56828[_0x2146('0x52')]]&&(_0x201764[_0xf56828['idField']]=_0x556e28[_0xf56828[_0x2146('0x52')]][_0x2146('0x50')]());}else if(_0xf56828[_0x2146('0x3e')]==='customVariable'&&_0xf56828[_0x2146('0x53')]&&_0xf56828[_0x2146('0x53')][_0x2146('0x54')]&&_0xf56828[_0x2146('0x4e')]){_0x556e28[_0xf56828[_0x2146('0x53')]['name'][_0x2146('0x3f')]()]&&(_0x201764[_0xf56828['idField']]=_0x556e28[_0xf56828[_0x2146('0x53')]['name'][_0x2146('0x3f')]()][_0x2146('0x50')]());}});}return _0x201764;}function getConnection(_0x543011){var _0x53ddd6=_0x543011[_0x2146('0x55')][_0x2146('0x56')](_0x543011[_0x2146('0x57')]);var _0x22c8e2=new jsforce[(_0x2146('0x58'))]({'oauth2':{'loginUrl':_0x543011[_0x2146('0x59')]||_0x2146('0x5a'),'clientId':_0x543011[_0x2146('0x5b')],'clientSecret':_0x543011[_0x2146('0x5c')]}});return _0x22c8e2['login'](_0x543011['username'],_0x53ddd6)[_0x2146('0x28')](function(){logger[_0x2146('0x21')](_0x2146('0x5d'));return _0x22c8e2;});}exports[_0x2146('0x5e')]=function(_0x1e2b9b,_0xa320a4,_0x56d01c,_0x4f9844,_0x39ba1d,_0x5754e6){var _0x3e9196,_0x58eb57,_0x4809cf,_0x159545;_0x5754e6['serverUrl']=intUtil['stripTrailingSlash'](_0x5754e6[_0x2146('0x5f')]);_0x5754e6[_0x2146('0x59')]=intUtil[_0x2146('0x60')](_0x5754e6[_0x2146('0x59')]);if(_0x39ba1d&&_0x39ba1d['monitor_format']){logger[_0x2146('0x21')](_0x2146('0x61'),'Recording\x20is\x20enabled!');_0xa320a4[_0x2146('0x62')]=util[_0x2146('0x45')](_0x2146('0x63'),_0x5754e6[_0x2146('0x5f')],_0xa320a4[_0x2146('0x64')],md5(_0xa320a4[_0x2146('0x64')]));}else{_0xa320a4['recordingURL']='';}return getConnection(_0x5754e6)[_0x2146('0x28')](function(_0x59ba29){_0x159545=_0x59ba29;return getUser(_0x5754e6,_0x4f9844[_0x2146('0x65')],_0x159545);})[_0x2146('0x28')](function(_0x50c4df){_0x3e9196=_0x50c4df;return getEndUser(_0x5754e6,_0x56d01c,_0xa320a4[_0x2146('0x66')],_0xa320a4[_0x2146('0x67')],_0x159545);})[_0x2146('0x28')](function(_0x2414c8){_0x58eb57=_0x2414c8;return getTicket(_0x5754e6,_0x3e9196,_0x58eb57,_0x56d01c,_0xa320a4,_0x56d01c['Fields'],_0x159545,_0x2146('0x5e'));})[_0x2146('0x28')](function(_0x28e238){_0x4809cf=_0x28e238;logger[_0x2146('0x21')](_0x2146('0x68'),_0x4809cf['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4809cf['id'],_0x4f9844[_0x2146('0x54')],_0x5754e6[_0x2146('0x3e')]);switch(_0x5754e6[_0x2146('0x3e')]){case _0x2146('0x69'):emit(util[_0x2146('0x45')](_0x2146('0x6a'),_0x4f9844[_0x2146('0x54')]),_0x2146('0x6b'),{'recordId':_0x4809cf['id']});break;case _0x2146('0x6c'):emit(util[_0x2146('0x45')](_0x2146('0x6a'),_0x4f9844[_0x2146('0x54')]),_0x2146('0x6d'),{'uri':util['format'](_0x2146('0x6e'),_0x159545[_0x2146('0x6f')],_0x4809cf['id'])});break;default:logger[_0x2146('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x2146('0x71')](function(_0x4a7073){logger[_0x2146('0x70')](_0x2146('0x61'),_0x4a7073);});};exports['outbound']=function(_0x409bd6,_0x32dcdc,_0x37592e,_0x14fa8a,_0x58a5f5,_0x292e62,_0x50da78){var _0x1f23fd,_0x6630b,_0x3c6a49,_0x39970f;_0x292e62['serverUrl']=intUtil[_0x2146('0x60')](_0x292e62[_0x2146('0x5f')]);_0x292e62[_0x2146('0x59')]=intUtil[_0x2146('0x60')](_0x292e62['remoteUri']);if(_0x50da78&&_0x50da78[_0x2146('0x72')]&&_0x50da78[_0x2146('0x72')]!==_0x2146('0x73')){logger[_0x2146('0x21')](_0x2146('0x74'),_0x2146('0x75'));_0x32dcdc['recordingURL']=util[_0x2146('0x45')](_0x2146('0x63'),_0x292e62[_0x2146('0x5f')],_0x32dcdc[_0x2146('0x64')],md5(_0x32dcdc[_0x2146('0x64')]));}return getConnection(_0x292e62)['then'](function(_0x2d7dd8){_0x39970f=_0x2d7dd8;return getUser(_0x292e62,_0x14fa8a[_0x2146('0x65')],_0x39970f);})['then'](function(_0x203d3b){_0x1f23fd=_0x203d3b;return getEndUser(_0x292e62,_0x37592e,_0x32dcdc[_0x2146('0x76')],_0x32dcdc['destcalleridnum'],_0x39970f);})[_0x2146('0x28')](function(_0x33149d){_0x6630b=_0x33149d;return getTicket(_0x292e62,_0x1f23fd,_0x6630b,_0x37592e,_0x32dcdc,_0x37592e[_0x2146('0x77')],_0x39970f,_0x2146('0x78'));})[_0x2146('0x28')](function(_0x25235c){_0x3c6a49=_0x25235c;logger[_0x2146('0x21')](_0x2146('0x79'),_0x3c6a49['id']);logger['info'](_0x2146('0x7a'),_0x3c6a49['id'],_0x14fa8a[_0x2146('0x54')],_0x292e62[_0x2146('0x3e')]);switch(_0x292e62['type']){case _0x2146('0x69'):emit(util[_0x2146('0x45')](_0x2146('0x6a'),_0x14fa8a[_0x2146('0x54')]),_0x2146('0x6b'),{'recordId':_0x3c6a49['id']});break;case _0x2146('0x6c'):emit(util[_0x2146('0x45')](_0x2146('0x6a'),_0x14fa8a[_0x2146('0x54')]),_0x2146('0x6d'),{'uri':util[_0x2146('0x45')](_0x2146('0x6e'),_0x39970f['instanceUrl'],_0x3c6a49['id'])});break;default:logger[_0x2146('0x70')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x2146('0x71')](function(_0x51f9c7){logger[_0x2146('0x70')](_0x2146('0x74'),_0x51f9c7);});};exports[_0x2146('0x7b')]=function(_0x34f8d3,_0x20246c,_0x22ac72,_0x33a5b4,_0x498e40,_0x2af254){var _0x4bb47e,_0xc30a31,_0x226901,_0x5a0598;_0x2af254[_0x2146('0x5f')]=intUtil['stripTrailingSlash'](_0x2af254[_0x2146('0x5f')]);_0x2af254['remoteUri']=intUtil[_0x2146('0x60')](_0x2af254['remoteUri']);if(_0x498e40&&_0x498e40[_0x2146('0x7c')]){logger[_0x2146('0x21')]('['+_0x20246c[_0x2146('0x7d')][_0x2146('0x7e')]()+']','Recording\x20is\x20enabled!');_0x20246c[_0x2146('0x62')]=util[_0x2146('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2af254[_0x2146('0x5f')],_0x20246c[_0x2146('0x64')],md5(_0x20246c[_0x2146('0x64')]));}else{_0x20246c['recordingURL']='';}return getConnection(_0x2af254)[_0x2146('0x28')](function(_0x1d0955){_0x5a0598=_0x1d0955;if(!_[_0x2146('0x23')](_0x33a5b4)){return getUser(_0x2af254,_0x33a5b4[_0x2146('0x54')],_0x5a0598);}else{return getUser(_0x2af254,null,_0x5a0598);}})[_0x2146('0x28')](function(_0x214240){_0x4bb47e=_0x214240;return getEndUser(_0x2af254,_0x22ac72,_0x20246c[_0x2146('0x66')],_0x20246c[_0x2146('0x67')],_0x5a0598);})[_0x2146('0x28')](function(_0x21ec2f){_0xc30a31=_0x21ec2f;return getTicket(_0x2af254,_0x4bb47e,_0xc30a31,_0x22ac72,_0x20246c,_0x22ac72[_0x2146('0x77')],_0x5a0598);})['then'](function(_0x130cf6){_0x226901=_0x130cf6;logger[_0x2146('0x21')]('['+_0x20246c[_0x2146('0x7d')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x226901['id']);logger['info']('['+_0x20246c[_0x2146('0x7d')][_0x2146('0x7e')]()+_0x2146('0x7f'),_0x2af254[_0x2146('0x3e')]);})['catch'](function(_0x136655){logger[_0x2146('0x70')]('['+_0x20246c['lastevent'][_0x2146('0x7e')]()+']',_0x136655);});}; \ No newline at end of file +var _0x568c=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','unmanaged','toUpperCase','isNil','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','Contact','lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl'];(function(_0x3edf2d,_0x312186){var _0x6069b5=function(_0x434e2a){while(--_0x434e2a){_0x3edf2d['push'](_0x3edf2d['shift']());}};_0x6069b5(++_0x312186);}(_0x568c,0x1a2));var _0xc568=function(_0x9b6627,_0x393ac1){_0x9b6627=_0x9b6627-0x0;var _0x4a8979=_0x568c[_0x9b6627];return _0x4a8979;};'use strict';var _=require(_0xc568('0x0'));var rp=require('request-promise');var moment=require(_0xc568('0x1'));var BPromise=require('bluebird');var md5=require(_0xc568('0x2'));var jsforce=require(_0xc568('0x3'));var util=require(_0xc568('0x4'));var Redis=require(_0xc568('0x5'));var intUtil=require('./util');var config=require(_0xc568('0x6'));var logger=require(_0xc568('0x7'))(_0xc568('0x8'));config['redis']=_[_0xc568('0x9')](config[_0xc568('0xa')],{'host':_0xc568('0xb'),'port':0x18eb});var io=require(_0xc568('0xc'))(new Redis(config['redis']));function emit(_0x1a1b96,_0x411b8c,_0x2989cc){io['to'](_0x1a1b96)[_0xc568('0xd')](_0x411b8c,_0x2989cc);}function getTicket(_0x3c4095,_0x20b25b,_0x11b856,_0x181e7c,_0x176f61,_0xba73,_0x108795,_0x3cbd9d){var _0x4a3c1e=Object[_0xc568('0xe')]({},{'OwnerId':_0x20b25b['id'],'Subject':intUtil[_0xc568('0xf')](_0x181e7c[_0xc568('0x10')],_0x176f61,'\x20'),'Description':intUtil['getString'](_0x181e7c[_0xc568('0x11')],_0x176f61,'\x0a')},getCustomFields(_0xba73,_0x176f61));if(_0x11b856){if(_0x181e7c['ticketType']==='Task'){_0x4a3c1e['ActivityDate']=moment['utc']();_0x4a3c1e['IsReminderSet']=![];_0x4a3c1e[_0xc568('0x12')]=![];if(_0x11b856[_0xc568('0x13')]===_0xc568('0x14')||_0x11b856[_0xc568('0x13')]==='lead'){_0x4a3c1e[_0xc568('0x15')]=_0x11b856['id'];}else if(_0x11b856[_0xc568('0x13')]===_0xc568('0x16')){_0x4a3c1e[_0xc568('0x17')]=_0x11b856['id'];}}else if(_0x181e7c[_0xc568('0x18')]===_0xc568('0x19')){if(_0x11b856[_0xc568('0x13')]===_0xc568('0x14')){_0x4a3c1e[_0xc568('0x1a')]=_0x11b856['id'];}else if(_0x11b856[_0xc568('0x13')]===_0xc568('0x16')){_0x4a3c1e[_0xc568('0x1b')]=_0x11b856['id'];}else if(_0x11b856[_0xc568('0x13')]==='lead'&&_0x181e7c[_0xc568('0x1c')]){_0x4a3c1e[_0x181e7c[_0xc568('0x1c')]]=_0x11b856['id'];}else{logger[_0xc568('0x1d')](_0xc568('0x1e'));}}}return _0x108795['sobject'](_0x181e7c[_0xc568('0x18')])[_0xc568('0x1f')](_0x4a3c1e);}function getUser(_0x49d904,_0x461036,_0x4f8aa3){if(!_['isNil'](_0x461036)&&intUtil[_0xc568('0x20')](_0x461036)){var _0x2486e5={'Email':_0x461036};var _0xd45a75={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4f8aa3[_0xc568('0x21')](_0xc568('0x22'))[_0xc568('0x23')](_0x2486e5,_0xd45a75)[_0xc568('0x24')]()[_0xc568('0x25')](function(_0x487e9a){if(_0x487e9a[_0xc568('0x26')]){var _0x31c546=_[_0xc568('0x23')](_0x487e9a,function(_0x162c46){return _0x162c46[_0xc568('0x27')]===_0x461036;});if(_0x31c546){logger[_0xc568('0x1d')](_0xc568('0x28'),_0x461036);return BPromise[_0xc568('0x29')]({'id':_0x31c546['Id'],'name':_0x31c546[_0xc568('0x2a')]});}}else{logger[_0xc568('0x1d')](_0xc568('0x2b'),_0x461036);return _0x4f8aa3[_0xc568('0x2c')]()[_0xc568('0x25')](function(_0x4bda43){return BPromise[_0xc568('0x29')]({'id':_0x4bda43[_0xc568('0x2d')],'name':_0x4bda43[_0xc568('0x2e')]});});}});}else{logger[_0xc568('0x1d')](_0xc568('0x2b'),_0x461036);return _0x4f8aa3[_0xc568('0x2c')]()[_0xc568('0x25')](function(_0xf98b04){return BPromise[_0xc568('0x29')]({'id':_0xf98b04[_0xc568('0x2d')],'name':_0xf98b04['display_name']});});}}function getEndUser(_0x1094f2,_0x91ad07,_0x579ae8,_0x1eb2f6,_0x26d8af){var _0x8f64cd={'$or':{'Phone':_0x1eb2f6}};var _0x32cb1a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc568('0x29')]()['then'](function(){logger[_0xc568('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1eb2f6,_0x91ad07[_0xc568('0x2f')]);switch(_0x91ad07['moduleSearch']){case _0xc568('0x30'):var _0x35fc52=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x32')]){var _0x6c1068={};_0x6c1068[_0x91ad07['additionalSearchContact']]=_0x1eb2f6;_[_0xc568('0x33')](_0x35fc52[_0xc568('0x34')],_0x6c1068);}return _0x26d8af['sobject']('Contact')[_0xc568('0x23')](_0x35fc52,_0x32cb1a)['execute']()['then'](function(_0x5346ed){if(_0x5346ed&&_0x5346ed[_0xc568('0x26')]){return _0x5346ed;}else{var _0x49f3d7=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x35')]){var _0x29574c={};_0x29574c[_0x91ad07[_0xc568('0x35')]]=_0x1eb2f6;_[_0xc568('0x33')](_0x49f3d7[_0xc568('0x34')],_0x29574c);}return _0x26d8af[_0xc568('0x21')]('Lead')[_0xc568('0x23')](_0x49f3d7,_0x32cb1a);}});case _0xc568('0x36'):var _0x538565=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x37')]){var _0x6c1068={};_0x6c1068[_0x91ad07[_0xc568('0x37')]]=_0x1eb2f6;_['merge'](_0x538565[_0xc568('0x34')],_0x6c1068);}return _0x26d8af[_0xc568('0x21')](_0xc568('0x38'))[_0xc568('0x23')](_0x538565,_0x32cb1a)[_0xc568('0x24')]()[_0xc568('0x25')](function(_0x33639a){if(_0x33639a&&_0x33639a[_0xc568('0x26')]){return _0x33639a;}else{var _0x293319=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x32')]){var _0x2b5285={};_0x2b5285[_0x91ad07['additionalSearchContact']]=_0x1eb2f6;_['merge'](_0x293319['$or'],_0x2b5285);}return _0x26d8af['sobject']('Contact')['find'](_0x293319,_0x32cb1a)['then'](function(_0x22df7b){if(_0x22df7b&&_0x22df7b['length']){return _0x22df7b;}else{var _0x3b11be=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x35')]){var _0x4252c8={};_0x4252c8[_0x91ad07[_0xc568('0x35')]]=_0x1eb2f6;_[_0xc568('0x33')](_0x3b11be[_0xc568('0x34')],_0x4252c8);}return _0x26d8af[_0xc568('0x21')](_0xc568('0x39'))[_0xc568('0x23')](_0x3b11be,_0x32cb1a);}});}});case _0xc568('0x14'):var _0x35fc52=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x32')]){var _0x6c1068={};_0x6c1068[_0x91ad07[_0xc568('0x32')]]=_0x1eb2f6;_[_0xc568('0x33')](_0x35fc52[_0xc568('0x34')],_0x6c1068);}return _0x26d8af['sobject'](_0xc568('0x3a'))[_0xc568('0x23')](_0x35fc52,_0x32cb1a)[_0xc568('0x24')]();case _0xc568('0x3b'):var _0x5e7df8=_['cloneDeep'](_0x8f64cd);if(_0x91ad07[_0xc568('0x35')]){var _0x6c1068={};_0x6c1068[_0x91ad07[_0xc568('0x35')]]=_0x1eb2f6;_[_0xc568('0x33')](_0x5e7df8[_0xc568('0x34')],_0x6c1068);}return _0x26d8af['sobject'](_0xc568('0x39'))[_0xc568('0x23')](_0x5e7df8,_0x32cb1a);case'account':var _0x538565=_[_0xc568('0x31')](_0x8f64cd);if(_0x91ad07[_0xc568('0x37')]){var _0x6c1068={};_0x6c1068[_0x91ad07['additionalSearchAccount']]=_0x1eb2f6;_[_0xc568('0x33')](_0x538565['$or'],_0x6c1068);}return _0x26d8af[_0xc568('0x21')](_0xc568('0x38'))[_0xc568('0x23')](_0x538565,_0x32cb1a);default:return null;}})['then'](function(_0x118385){if(_0x118385&&_0x118385[_0xc568('0x26')]){var _0x4df684=_[_0xc568('0x3c')](_0x118385);if(_0x4df684){return BPromise['resolve']({'id':_0x4df684['Id'],'name':_0x4df684[_0xc568('0x2a')],'phone':_0x4df684[_0xc568('0x3d')],'endUserType':_0x4df684[_0xc568('0x3e')][_0xc568('0x3f')][_0xc568('0x40')]()});}}})['then'](function(_0x1cae92){if(_0x1cae92){logger['info'](_0xc568('0x41'),_0x1cae92['endUserType'],_0x1eb2f6);return BPromise[_0xc568('0x29')](_0x1cae92);}else{logger[_0xc568('0x1d')](_0xc568('0x42'),_0x1eb2f6);var _0x428389={'Phone':_0x1eb2f6};if(_0x91ad07['moduleCreate']){if(_0x91ad07[_0xc568('0x43')]==='contact'){logger[_0xc568('0x1d')](_0xc568('0x44'),_0x1eb2f6,_0x91ad07[_0xc568('0x43')]);_0x428389[_0xc568('0x45')]=_0x579ae8!==_0xc568('0x46')?_0x579ae8:util[_0xc568('0x47')]('Caller\x20-\x20%s',_0x1eb2f6);}else if(_0x91ad07['moduleCreate']===_0xc568('0x3b')){logger[_0xc568('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1eb2f6,_0x91ad07['moduleCreate']);_0x428389[_0xc568('0x45')]=_0x579ae8!==_0xc568('0x46')?_0x579ae8:util[_0xc568('0x47')]('Caller\x20-\x20%s',_0x1eb2f6);_0x428389['Company']=_0xc568('0x48');}else if(_0x91ad07['moduleCreate']===_0xc568('0x16')){logger[_0xc568('0x1d')](_0xc568('0x44'),_0x1eb2f6,_0x91ad07['moduleCreate']);_0x428389[_0xc568('0x2a')]=_0x579ae8!==_0xc568('0x46')?_0x579ae8:util[_0xc568('0x47')](_0xc568('0x49'),_0x1eb2f6);}else{return null;}}return _0x26d8af[_0xc568('0x21')](_['upperFirst'](_0x91ad07['moduleCreate']))['create'](_0x428389)[_0xc568('0x25')](function(_0x22c275){return BPromise[_0xc568('0x29')]({'id':_0x22c275['id'],'endUserType':_0x91ad07[_0xc568('0x43')]});});}});}function getCustomFields(_0x2708b6,_0x28343c){var _0x2675f1={};if(_0x2708b6[_0xc568('0x26')]>0x0){_[_0xc568('0x4a')](_0x2708b6,function(_0x223f77){if(_[_0xc568('0x4b')]([_0xc568('0x4c'),_0xc568('0x4d')],_0x223f77[_0xc568('0x3f')])&&_0x223f77['idField']){_0x2675f1[_0x223f77[_0xc568('0x4e')]]=_0x223f77['content'][_0xc568('0x4f')]();}else if(_0x223f77[_0xc568('0x3f')]===_0xc568('0x50')&&_0x223f77[_0xc568('0x51')]&&_0x223f77[_0xc568('0x4e')]){_0x28343c[_0x223f77[_0xc568('0x51')]]&&(_0x2675f1[_0x223f77[_0xc568('0x4e')]]=_0x28343c[_0x223f77['variableName']][_0xc568('0x4f')]());}else if(_0x223f77['type']===_0xc568('0x52')&&_0x223f77[_0xc568('0x53')]&&_0x223f77[_0xc568('0x53')][_0xc568('0x54')]&&_0x223f77[_0xc568('0x4e')]){_0x28343c[_0x223f77[_0xc568('0x53')]['name']['toLowerCase']()]&&(_0x2675f1[_0x223f77[_0xc568('0x4e')]]=_0x28343c[_0x223f77['Variable'][_0xc568('0x54')][_0xc568('0x40')]()][_0xc568('0x4f')]());}});}return _0x2675f1;}function getConnection(_0x380bb1){var _0x2d8911=_0x380bb1[_0xc568('0x55')][_0xc568('0x56')](_0x380bb1[_0xc568('0x57')]);var _0x4d0900=new jsforce['Connection']({'oauth2':{'loginUrl':_0x380bb1['remoteUri']||_0xc568('0x58'),'clientId':_0x380bb1[_0xc568('0x59')],'clientSecret':_0x380bb1[_0xc568('0x5a')]}});return _0x4d0900[_0xc568('0x5b')](_0x380bb1[_0xc568('0x5c')],_0x2d8911)[_0xc568('0x25')](function(){logger['info'](_0xc568('0x5d'));return _0x4d0900;});}exports[_0xc568('0x5e')]=function(_0x418e99,_0x192281,_0x17458f,_0x5f1c03,_0x9f50f5,_0x3c8fa0){var _0x215883,_0x2bceb1,_0x4ec62c,_0x35db7b;_0x3c8fa0[_0xc568('0x5f')]=intUtil[_0xc568('0x60')](_0x3c8fa0['serverUrl']);_0x3c8fa0[_0xc568('0x61')]=intUtil[_0xc568('0x60')](_0x3c8fa0[_0xc568('0x61')]);if(_0x9f50f5&&_0x9f50f5[_0xc568('0x62')]){logger[_0xc568('0x1d')](_0xc568('0x63'),_0xc568('0x64'));_0x192281[_0xc568('0x65')]=util[_0xc568('0x47')](_0xc568('0x66'),_0x3c8fa0[_0xc568('0x5f')],_0x192281[_0xc568('0x67')],md5(_0x192281[_0xc568('0x67')]));}else{_0x192281[_0xc568('0x65')]='';}return getConnection(_0x3c8fa0)[_0xc568('0x25')](function(_0xedbb4f){_0x35db7b=_0xedbb4f;return getUser(_0x3c8fa0,_0x5f1c03['email'],_0x35db7b);})[_0xc568('0x25')](function(_0x1da032){_0x215883=_0x1da032;return getEndUser(_0x3c8fa0,_0x17458f,_0x192281[_0xc568('0x68')],_0x192281[_0xc568('0x69')],_0x35db7b);})[_0xc568('0x25')](function(_0x4ac2f8){_0x2bceb1=_0x4ac2f8;return getTicket(_0x3c8fa0,_0x215883,_0x2bceb1,_0x17458f,_0x192281,_0x17458f['Fields'],_0x35db7b,'queue');})[_0xc568('0x25')](function(_0x59bd46){_0x4ec62c=_0x59bd46;logger[_0xc568('0x1d')](_0xc568('0x6a'),_0x4ec62c['id']);logger[_0xc568('0x1d')](_0xc568('0x6b'),_0x4ec62c['id'],_0x5f1c03[_0xc568('0x54')],_0x3c8fa0[_0xc568('0x3f')]);switch(_0x3c8fa0[_0xc568('0x3f')]){case'integrationTab':emit(util[_0xc568('0x47')](_0xc568('0x6c'),_0x5f1c03[_0xc568('0x54')]),_0xc568('0x6d'),{'recordId':_0x4ec62c['id']});break;case _0xc568('0x6e'):emit(util[_0xc568('0x47')](_0xc568('0x6c'),_0x5f1c03['name']),_0xc568('0x6f'),{'uri':util['format'](_0xc568('0x70'),_0x35db7b[_0xc568('0x71')],_0x4ec62c['id'])});break;default:logger['error'](_0xc568('0x72'));}})[_0xc568('0x73')](function(_0xaa24b){logger[_0xc568('0x74')](_0xc568('0x63'),_0xaa24b);});};exports['outbound']=function(_0x515b1d,_0x13b9a7,_0x4933d2,_0x207a52,_0x226cb7,_0x1b8181,_0x5616b2){var _0x44c84f,_0x29dd15,_0x2b3955,_0x249306;_0x1b8181[_0xc568('0x5f')]=intUtil['stripTrailingSlash'](_0x1b8181[_0xc568('0x5f')]);_0x1b8181['remoteUri']=intUtil[_0xc568('0x60')](_0x1b8181['remoteUri']);if(_0x5616b2&&_0x5616b2[_0xc568('0x75')]&&_0x5616b2['recordingFormat']!=='none'){logger[_0xc568('0x1d')](_0xc568('0x76'),_0xc568('0x64'));_0x13b9a7['recordingURL']=util[_0xc568('0x47')](_0xc568('0x66'),_0x1b8181[_0xc568('0x5f')],_0x13b9a7['uniqueid'],md5(_0x13b9a7[_0xc568('0x67')]));}return getConnection(_0x1b8181)[_0xc568('0x25')](function(_0xaff066){_0x249306=_0xaff066;return getUser(_0x1b8181,_0x207a52[_0xc568('0x77')],_0x249306);})['then'](function(_0x1c05d3){_0x44c84f=_0x1c05d3;return getEndUser(_0x1b8181,_0x4933d2,_0x13b9a7[_0xc568('0x78')],_0x13b9a7[_0xc568('0x79')],_0x249306);})['then'](function(_0xede3e2){_0x29dd15=_0xede3e2;return getTicket(_0x1b8181,_0x44c84f,_0x29dd15,_0x4933d2,_0x13b9a7,_0x4933d2[_0xc568('0x7a')],_0x249306,_0xc568('0x7b'));})[_0xc568('0x25')](function(_0x5238a1){_0x2b3955=_0x5238a1;logger[_0xc568('0x1d')](_0xc568('0x7c'),_0x2b3955['id']);logger[_0xc568('0x1d')](_0xc568('0x7d'),_0x2b3955['id'],_0x207a52[_0xc568('0x54')],_0x1b8181['type']);switch(_0x1b8181['type']){case _0xc568('0x7e'):emit(util['format'](_0xc568('0x6c'),_0x207a52[_0xc568('0x54')]),_0xc568('0x6d'),{'recordId':_0x2b3955['id']});break;case'newTab':emit(util['format'](_0xc568('0x6c'),_0x207a52[_0xc568('0x54')]),'trigger:browser:url',{'uri':util[_0xc568('0x47')]('%s/%s/e',_0x249306[_0xc568('0x71')],_0x2b3955['id'])});break;default:logger[_0xc568('0x74')](_0xc568('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xc568('0x73')](function(_0x1615f2){logger['error'](_0xc568('0x76'),_0x1615f2);});};exports[_0xc568('0x7f')]=function(_0x516a0a,_0x3d2a7a,_0x50d15e,_0x2c2220,_0x309349,_0x33dcae){var _0x4c12b1,_0x235f40,_0x255853,_0x6e2da1;_0x33dcae[_0xc568('0x5f')]=intUtil[_0xc568('0x60')](_0x33dcae[_0xc568('0x5f')]);_0x33dcae[_0xc568('0x61')]=intUtil[_0xc568('0x60')](_0x33dcae[_0xc568('0x61')]);if(_0x309349&&_0x309349[_0xc568('0x62')]){logger[_0xc568('0x1d')]('['+_0x3d2a7a['lastevent'][_0xc568('0x80')]()+']',_0xc568('0x64'));_0x3d2a7a[_0xc568('0x65')]=util['format'](_0xc568('0x66'),_0x33dcae[_0xc568('0x5f')],_0x3d2a7a[_0xc568('0x67')],md5(_0x3d2a7a[_0xc568('0x67')]));}else{_0x3d2a7a[_0xc568('0x65')]='';}return getConnection(_0x33dcae)[_0xc568('0x25')](function(_0x15fa40){_0x6e2da1=_0x15fa40;if(!_[_0xc568('0x81')](_0x2c2220)){return getUser(_0x33dcae,_0x2c2220['name'],_0x6e2da1);}else{return getUser(_0x33dcae,null,_0x6e2da1);}})[_0xc568('0x25')](function(_0x105e32){_0x4c12b1=_0x105e32;return getEndUser(_0x33dcae,_0x50d15e,_0x3d2a7a[_0xc568('0x68')],_0x3d2a7a[_0xc568('0x69')],_0x6e2da1);})['then'](function(_0x3c8a3a){_0x235f40=_0x3c8a3a;return getTicket(_0x33dcae,_0x4c12b1,_0x235f40,_0x50d15e,_0x3d2a7a,_0x50d15e[_0xc568('0x7a')],_0x6e2da1);})[_0xc568('0x25')](function(_0x200668){_0x255853=_0x200668;logger[_0xc568('0x1d')]('['+_0x3d2a7a[_0xc568('0x82')][_0xc568('0x80')]()+_0xc568('0x83'),_0x255853['id']);logger[_0xc568('0x1d')]('['+_0x3d2a7a['lastevent'][_0xc568('0x80')]()+_0xc568('0x84'),_0x33dcae[_0xc568('0x3f')]);})[_0xc568('0x73')](function(_0x1e70a8){logger['error']('['+_0x3d2a7a[_0xc568('0x82')]['toUpperCase']()+']',_0x1e70a8);});}; \ 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 1275530..d4ae44a 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 _0x2019=['toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','length','active','userId','adminId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','nameField','customField','content','includes','idField','toLowerCase','toString','variable','variableName','type','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/logger','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2019,0x19b));var _0x9201=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x2019[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x9201('0x0'));var Promise=require(_0x9201('0x1'));var rp=require('request-promise');var util=require(_0x9201('0x2'));var md5=require(_0x9201('0x3'));var Redis=require(_0x9201('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9201('0x5'))('servicenow');config[_0x9201('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9201('0x7'))(new Redis(config[_0x9201('0x6')]));function getAdminUser(_0x314ffe,_0x6fc147,_0x49a1e7,_0x9311f7,_0x2e4752,_0x11c409){return new Promise(function(_0x441e0e,_0x345360){var _0x52be61={'method':_0x9201('0x8'),'uri':_0x9311f7+_0x9201('0x9')+'&'+_0x2e4752+'&'+_0x11c409,'auth':_0x6fc147,'json':!![]};return rp(_0x52be61)[_0x9201('0xa')](function(_0x2471da){if(_0x2471da[_0x9201('0xb')]['length']>0x0){_0x49a1e7['adminId']=_0x2471da[_0x9201('0xb')][0x0][_0x9201('0xc')];}logger['info']('['+[_0x314ffe[_0x9201('0xd')]()]+_0x9201('0xe'),_0x49a1e7);_0x441e0e(_0x49a1e7);})[_0x9201('0xf')](function(_0xf5ed33){logger[_0x9201('0x10')]('['+[_0x314ffe[_0x9201('0xd')]()]+']',_0xf5ed33[_0x9201('0x11')]);_0x345360(_0xf5ed33[_0x9201('0x11')]);});});}function getUser(_0x40fe5e,_0x4a04b2,_0x175c29,_0x484387,_0x447293){return function(_0x5d930d){logger[_0x9201('0x12')]('['+[_0x40fe5e['toUpperCase']()]+_0x9201('0x13'),_0x5d930d);return new Promise(function(_0xa75682,_0x5aa409){if(intUtil[_0x9201('0x14')](_0x5d930d[_0x9201('0x15')])){var _0x2d7d75={'method':_0x9201('0x8'),'uri':_0x175c29+'sys_user?sysparm_query=email%3D'+_0x5d930d[_0x9201('0x15')]+'&'+_0x484387+'&'+_0x447293,'auth':_0x4a04b2,'json':!![]};logger[_0x9201('0x12')]('['+[_0x40fe5e['toUpperCase']()]+_0x9201('0x16'),_0x2d7d75);return rp(_0x2d7d75)[_0x9201('0xa')](function(_0x4759b9){logger[_0x9201('0x12')]('['+[_0x40fe5e[_0x9201('0xd')]()]+'],\x20getUser\x20entity',_0x4759b9);if(_0x4759b9[_0x9201('0xb')][_0x9201('0x17')]>0x0&&String(_0x4759b9[_0x9201('0xb')][0x0][_0x9201('0x18')])==='true'){_0x5d930d['userId']=_0x4759b9[_0x9201('0xb')][0x0]['sys_id'];}else{_0x5d930d[_0x9201('0x19')]=_0x5d930d[_0x9201('0x1a')];_0x5d930d[_0x9201('0x15')]=_0x5d930d[_0x9201('0x1b')];}logger[_0x9201('0x12')]('['+[_0x40fe5e[_0x9201('0xd')]()]+'],\x20getUser\x20crm',_0x5d930d);_0xa75682(_0x5d930d);})[_0x9201('0xf')](function(_0x485b9c){logger[_0x9201('0x10')]('['+[_0x40fe5e['toUpperCase']()]+']',_0x485b9c[_0x9201('0x11')]);_0x5aa409(_0x485b9c[_0x9201('0x11')]);});}else{logger['info']('['+[_0x40fe5e[_0x9201('0xd')]()]+']\x20using\x20admin\x20profile');_0x5d930d['userId']=_0x5d930d[_0x9201('0x1a')];_0x5d930d[_0x9201('0x15')]=_0x5d930d[_0x9201('0x1b')];_0xa75682(_0x5d930d);}});};}function createEndUser(_0x4d2c26,_0x5a4493,_0xc995f0,_0x1db3b1,_0x5243a4){logger[_0x9201('0x12')]('['+[_0x4d2c26[_0x9201('0xd')]()]+_0x9201('0x1c'),_0xc995f0);return new Promise(function(_0x3eeb81,_0x5d7712){var _0x127ae2={'method':_0x9201('0x1d'),'uri':_0x1db3b1+'sys_user?'+_0x5243a4,'body':{'user_name':_0xc995f0['endUserNumber'],'roles':_0x9201('0x1e'),'first_name':_0xc995f0[_0x9201('0x1f')],'active':'true','date_format':_0x9201('0x20'),'phone':_0xc995f0[_0x9201('0x1f')]},'auth':_0x5a4493,'json':!![]};return rp(_0x127ae2)['then'](function(_0x177536){logger[_0x9201('0x12')]('['+[_0x4d2c26[_0x9201('0xd')]()]+_0x9201('0x21'),_0x177536['result']);_0xc995f0['endUserId']=_0x177536[_0x9201('0xb')][_0x9201('0xc')];_0x3eeb81(_0xc995f0);})['catch'](function(_0x174f56){logger[_0x9201('0x10')]('['+[_0x4d2c26[_0x9201('0xd')]()]+']',_0x174f56[_0x9201('0x11')]);_0x5d7712(_0x174f56[_0x9201('0x11')]);});});}function getEndUser(_0x283a85,_0x391a54,_0xf837cf,_0x1724d1,_0x1c63ab){return function(_0xb7770e){logger[_0x9201('0x12')]('['+[_0x283a85[_0x9201('0xd')]()]+_0x9201('0x22'),_0xb7770e);return new Promise(function(_0x4638ee,_0x265aed){var _0x45c36d={'method':_0x9201('0x8'),'uri':_0xf837cf+'sys_user?sysparm_query=phone%3D'+_0xb7770e['endUserNumber']+'&'+_0x1724d1+'&'+_0x1c63ab,'auth':_0x391a54,'json':!![]};return rp(_0x45c36d)[_0x9201('0xa')](function(_0x1d6ce4){if(_0x1d6ce4[_0x9201('0xb')][_0x9201('0x17')]>0x0){_0xb7770e[_0x9201('0x23')]=_0x1d6ce4['result'][0x0][_0x9201('0xc')];logger[_0x9201('0x12')]('['+[_0x283a85[_0x9201('0xd')]()]+_0x9201('0x24'),_0xb7770e);_0x4638ee(_0xb7770e);}else{return createEndUser(_0x283a85,_0x391a54,_0xb7770e,_0xf837cf,_0x1724d1)[_0x9201('0xa')](function(_0x205db3){logger[_0x9201('0x12')]('['+[_0x283a85[_0x9201('0xd')]()]+_0x9201('0x25'),_0x205db3);_0x4638ee(_0x205db3);});}})[_0x9201('0xf')](function(_0x26409f){logger['error']('['+[_0x283a85[_0x9201('0xd')]()]+']',_0x26409f[_0x9201('0x11')]);_0x265aed(_0x26409f[_0x9201('0x11')]);});});};}function getCustomFields(_0x12f80a,_0x1caabd){var _0x295242={};if(_0x12f80a[_0x9201('0x17')]>0x0){_[_0x9201('0x26')](_0x12f80a,function(_0x4f3360){if(_['includes']([_0x9201('0x27'),_0x9201('0x28')],_0x4f3360['type'])&&_0x4f3360[_0x9201('0x29')]&&!_0x4f3360[_0x9201('0x2a')]){_0x295242[_0x4f3360[_0x9201('0x29')]['toLowerCase']()]=_0x4f3360[_0x9201('0x2b')]['toString']();}else if(_[_0x9201('0x2c')](['string','picklist'],_0x4f3360['type'])&&_0x4f3360['idField']&&_0x4f3360['customField']){_0x295242[_0x4f3360[_0x9201('0x2d')][_0x9201('0x2e')]()]=_0x4f3360[_0x9201('0x2b')][_0x9201('0x2f')]();}else if(_0x4f3360['type']===_0x9201('0x30')&&_0x4f3360[_0x9201('0x31')]&&_0x4f3360[_0x9201('0x2d')]&&_0x4f3360['customField']){_0x295242[_0x4f3360[_0x9201('0x2d')][_0x9201('0x2e')]()]=_0x1caabd[_0x4f3360['variableName']]['toString']();}else if(_0x4f3360[_0x9201('0x32')]===_0x9201('0x33')&&_0x4f3360[_0x9201('0x34')]&&_0x4f3360[_0x9201('0x34')][_0x9201('0x35')]&&_0x4f3360['idField']&&_0x4f3360[_0x9201('0x2a')]){_0x295242[_0x4f3360[_0x9201('0x2d')][_0x9201('0x2e')]()]=_0x1caabd[_0x4f3360[_0x9201('0x34')][_0x9201('0x35')][_0x9201('0x2e')]()][_0x9201('0x2f')]();}});}return _0x295242;}function getTicket(_0x8db3eb,_0x3ee039,_0x2ceccb,_0x55e806,_0x1e0bfe,_0x233447){return function(_0x4d3c35){logger[_0x9201('0x12')]('['+[_0x8db3eb[_0x9201('0xd')]()]+_0x9201('0x36'),_0x4d3c35);return new Promise(function(_0x230802,_0x517a09){var _0x1adcfc=_0x8db3eb[_0x9201('0x2e')]()===_0x9201('0x37')?_0x4d3c35[_0x9201('0x19')]:_0x4d3c35[_0x9201('0x23')];var _0x5343b1={'method':_0x9201('0x1d'),'uri':_0x2ceccb+_0x9201('0x38')+'?'+_0x233447,'body':Object[_0x9201('0x39')]({},{'active':'true','caller_id':_0x1adcfc,'assigned_to':_0x4d3c35[_0x9201('0x19')],'short_description':intUtil[_0x9201('0x3a')](_0x55e806[_0x9201('0x3b')],_0x1e0bfe,'\x20'),'description':intUtil[_0x9201('0x3a')](_0x55e806[_0x9201('0x3c')],_0x1e0bfe,'\x0a')},getCustomFields(_0x55e806['Fields'],_0x1e0bfe)),'auth':_0x3ee039,'json':!![]};return rp(_0x5343b1)[_0x9201('0xa')](function(_0x1b4bd){logger['info']('['+[_0x8db3eb[_0x9201('0xd')]()]+_0x9201('0x3d'),_0x1b4bd[_0x9201('0xb')]);_0x4d3c35[_0x9201('0x3e')]=_0x1b4bd[_0x9201('0xb')][_0x9201('0xc')];_0x4d3c35[_0x9201('0x3f')]=_0x1b4bd[_0x9201('0xb')][_0x9201('0x40')];logger[_0x9201('0x12')]('['+[_0x8db3eb[_0x9201('0xd')]()]+']\x20getTicket\x20crm',_0x4d3c35);_0x230802(_0x4d3c35);})['catch'](function(_0x5f1d09){logger[_0x9201('0x10')]('['+[_0x8db3eb[_0x9201('0xd')]()]+']',_0x5f1d09[_0x9201('0x11')]);_0x517a09(_0x5f1d09[_0x9201('0x11')]);});});};}function createRemoteTag(_0x256546,_0x3cd6b7,_0x43b88c,_0x54e2b6){return new Promise(function(_0x266ed3,_0x5b018f){var _0x270508={'method':'POST','uri':_0x43b88c+_0x9201('0x41')+'?'+_0x54e2b6,'body':{'short_description':_0x256546,'global':!![],'active':!![],'name':_0x256546},'auth':_0x3cd6b7,'json':!![]};return rp(_0x270508)[_0x9201('0xa')](function(_0x26adb0){var _0x3605c8=_0x26adb0[_0x9201('0xb')]['sys_id'];_0x266ed3(_0x3605c8);});});}function getRemoteTag(_0x1e9d34,_0x5a62c8,_0x44f445,_0x3c10fe,_0x19e978){return new Promise(function(_0x449350,_0x1831c8){var _0xa2231b={'method':_0x9201('0x8'),'uri':_0x44f445+_0x9201('0x41')+_0x9201('0x42')+_0x1e9d34+'&'+_0x3c10fe,'auth':_0x5a62c8,'json':!![]};return rp(_0xa2231b)[_0x9201('0xa')](function(_0x388f8b){if(_0x388f8b[_0x9201('0xb')][_0x9201('0x17')]>0x0){var _0xa20c8f=_0x388f8b[_0x9201('0xb')][0x0][_0x9201('0xc')];_0x449350(_0xa20c8f);}else{return createRemoteTag(_0x1e9d34,_0x5a62c8,_0x44f445,_0x3c10fe)[_0x9201('0xa')](function(_0x110662){_0x449350(_0x110662);});}});});}function assignTagToIncident(_0x504602,_0xbfa61a,_0x285913,_0x4417bf,_0x3362f3){return new Promise(function(_0x340791,_0x40a49e){var _0x2d3f3b={'method':'POST','uri':_0x285913+_0x9201('0x43')+'?'+_0x3362f3,'body':{'label':_0x504602,'table':_0x9201('0x38'),'id_type':_0x9201('0x44'),'table_key':_0x4417bf[_0x9201('0x3e')],'title':_0x9201('0x45')+_0x4417bf[_0x9201('0x3f')],'id_display':_0x4417bf[_0x9201('0x3f')]},'auth':_0xbfa61a,'json':!![]};return rp(_0x2d3f3b)[_0x9201('0xa')](function(_0x179221){_0x340791();})[_0x9201('0xf')](function(){_0x340791();});});}function manageTags(_0x33e608,_0x1c3377,_0x518e40,_0x35b3b5,_0x12d03f,_0x25a93b,_0x4bd5c5){return new Promise(function(_0x31d536,_0x397dde){var _0x293b4e=[];_0x1c3377[_0x9201('0x26')](function(_0x44e782){_0x293b4e[_0x9201('0x46')](getRemoteTag(_0x44e782,_0x518e40,_0x35b3b5,_0x25a93b,_0x4bd5c5));});return Promise[_0x9201('0x47')](_0x293b4e)[_0x9201('0xa')](function(_0x3394a6){if(_0x3394a6[_0x9201('0x17')]){logger[_0x9201('0x12')]('['+[_0x33e608[_0x9201('0xd')]()]+_0x9201('0x48'),_0x3394a6);var _0x5e7e92=[];_0x3394a6[_0x9201('0x26')](function(_0x1d51f1){_0x5e7e92['push'](assignTagToIncident(_0x1d51f1,_0x518e40,_0x35b3b5,_0x12d03f,_0x25a93b));});return Promise[_0x9201('0x47')](_0x5e7e92)[_0x9201('0xa')](function(){_0x31d536();})[_0x9201('0xf')](function(){_0x31d536();});}else{_0x31d536();}});});}function getTags(_0x1b5a3e,_0x486c7e,_0x58edbe,_0x1ee044,_0x1bd23f,_0x12c8e9){return function(_0x664123){return new Promise(function(_0x1270ba,_0x55db6b){var _0xf8cd58=[];var _0x41d56c=_0x1ee044[_0x9201('0x49')];if(_0x41d56c&&_0x41d56c[_0x9201('0x17')]>0x0){_0xf8cd58=_[_0x9201('0x4a')](_0x41d56c,_0x9201('0x35'));}if(_0xf8cd58[_0x9201('0x17')]>0x0){return manageTags(_0x1b5a3e,_0xf8cd58,_0x486c7e,_0x58edbe,_0x664123,_0x1bd23f,_0x12c8e9)[_0x9201('0xa')](function(){_0x1270ba(_0x664123);});}else{_0x1270ba(_0x664123);}});};}function emit(_0x3611d1,_0x24ba72,_0x23310a){var _0x2d06fc=_0x9201('0x4b')+_0x9201('0x4c')+_0x9201('0x4d')+_0x9201('0x4e');var _0x234540={'uri':_0x3611d1+_0x9201('0x4f')+_0x23310a+_0x2d06fc};io['to'](util[_0x9201('0x50')]('user:%s',_0x24ba72))[_0x9201('0x51')](_0x9201('0x52'),_0x234540);}exports['cs']=function(_0x5823a6,_0x526a36,_0x2df770,_0x372382,_0x55583b,_0x97e295,_0x5c69ee,_0x4b33e4){var _0x424129={};var _0x1ddd09={'user':_0x97e295['username'],'pass':_0x97e295['password']};var _0xe47abb=_0x9201('0x53');var _0x457677=_0x9201('0x54');_0x97e295[_0x9201('0x55')]=intUtil[_0x9201('0x56')](_0x97e295[_0x9201('0x55')]);_0x97e295['serverUrl']=intUtil['stripTrailingSlash'](_0x97e295[_0x9201('0x57')]);var _0x376587=util[_0x9201('0x50')](_0x9201('0x58'),_0x97e295[_0x9201('0x55')]);_0x424129[_0x9201('0x15')]=!_['isNil'](_0x372382)?_0x372382[_0x9201('0x59')]:null;_0x424129['adminEmail']=_0x97e295['email'];_0x424129['endUserNumber']=_0x4b33e4[_0x9201('0x2e')]()===_0x9201('0x37')?_0x526a36[_0x9201('0x5a')]:_0x526a36[_0x9201('0x5b')];_0x424129[_0x9201('0x5c')]=_0x4b33e4===_0x9201('0x5d')||_0x4b33e4===_0x9201('0x5e')?_0x9201('0x5d'):_0x9201('0x37');var _0x14731f=util['format'](_0x9201('0x5f'),_0x97e295[_0x9201('0x57')],_0x526a36['uniqueid'],md5(_0x526a36[_0x9201('0x60')]));if(_0x55583b&&_0x55583b[_0x9201('0x61')]){logger['info']('[QUEUE]',_0x9201('0x62'));_0x526a36[_0x9201('0x63')]=_0x14731f;}else if(_0x5c69ee&&_0x5c69ee[_0x9201('0x64')]&&_0x5c69ee['recordingFormat']!==_0x9201('0x65')){logger[_0x9201('0x12')]('[OUTBOUND]',_0x9201('0x62'));_0x526a36[_0x9201('0x63')]=_0x14731f;}else{_0x526a36[_0x9201('0x63')]='';}return getAdminUser(_0x4b33e4,_0x1ddd09,_0x424129,_0x376587,_0x457677,_0xe47abb)['then'](getUser(_0x4b33e4,_0x1ddd09,_0x376587,_0x457677,_0xe47abb))[_0x9201('0xa')](getEndUser(_0x4b33e4,_0x1ddd09,_0x376587,_0x457677,_0xe47abb))[_0x9201('0xa')](getTicket(_0x4b33e4,_0x1ddd09,_0x376587,_0x2df770,_0x526a36,_0x457677))[_0x9201('0xa')](function(_0x3929b2){logger['info'](util[_0x9201('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3929b2['ticketId']));logger[_0x9201('0x12')](util[_0x9201('0x50')](_0x9201('0x66'),_0x4b33e4));if(_0x4b33e4!==_0x9201('0x5e')){logger['info']('['+[_0x4b33e4[_0x9201('0xd')]()]+']',_0x9201('0x67'));emit(_0x97e295[_0x9201('0x55')],_0x372382['name'],_0x3929b2[_0x9201('0x3e')]);}})[_0x9201('0xf')](function(_0x48877a){logger[_0x9201('0x10')]('['+[_0x4b33e4[_0x9201('0xd')]()]+_0x9201('0x68'),util[_0x9201('0x69')](_0x48877a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb6e6=['lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm','adminEmail','POST','sys_user?','user','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name','outbound','incident','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect'];(function(_0x9e9067,_0x1b57d0){var _0x525877=function(_0x8cf375){while(--_0x8cf375){_0x9e9067['push'](_0x9e9067['shift']());}};_0x525877(++_0x1b57d0);}(_0xb6e6,0x6a));var _0x6b6e=function(_0x5b8535,_0x335c46){_0x5b8535=_0x5b8535-0x0;var _0x4a5481=_0xb6e6[_0x5b8535];return _0x4a5481;};'use strict';var _=require(_0x6b6e('0x0'));var Promise=require(_0x6b6e('0x1'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x6b6e('0x2'));var intUtil=require(_0x6b6e('0x3'));var config=require(_0x6b6e('0x4'));var logger=require(_0x6b6e('0x5'))(_0x6b6e('0x6'));config[_0x6b6e('0x7')]=_['defaults'](config[_0x6b6e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6b6e('0x8'))(new Redis(config[_0x6b6e('0x7')]));function getAdminUser(_0x5be446,_0x4c17a8,_0x692f5,_0x69fb6c,_0x4b64ec,_0x53e84a){return new Promise(function(_0xb26332,_0x25f398){var _0x36d9d0={'method':_0x6b6e('0x9'),'uri':_0x69fb6c+_0x6b6e('0xa')+'&'+_0x4b64ec+'&'+_0x53e84a,'auth':_0x4c17a8,'json':!![]};return rp(_0x36d9d0)[_0x6b6e('0xb')](function(_0x470a41){if(_0x470a41[_0x6b6e('0xc')][_0x6b6e('0xd')]>0x0){_0x692f5[_0x6b6e('0xe')]=_0x470a41[_0x6b6e('0xc')][0x0][_0x6b6e('0xf')];}logger['info']('['+[_0x5be446[_0x6b6e('0x10')]()]+_0x6b6e('0x11'),_0x692f5);_0xb26332(_0x692f5);})[_0x6b6e('0x12')](function(_0xe3dbf4){logger[_0x6b6e('0x13')]('['+[_0x5be446[_0x6b6e('0x10')]()]+']',_0xe3dbf4[_0x6b6e('0x14')]);_0x25f398(_0xe3dbf4[_0x6b6e('0x14')]);});});}function getUser(_0x2a9cde,_0x239498,_0x396dad,_0x409e0d,_0x14c49d){return function(_0x4acc77){logger['info']('['+[_0x2a9cde[_0x6b6e('0x10')]()]+_0x6b6e('0x15'),_0x4acc77);return new Promise(function(_0x3c9cec,_0x4a675f){if(intUtil[_0x6b6e('0x16')](_0x4acc77['userEmail'])){var _0x2e0b2b={'method':'GET','uri':_0x396dad+_0x6b6e('0x17')+_0x4acc77[_0x6b6e('0x18')]+'&'+_0x409e0d+'&'+_0x14c49d,'auth':_0x239498,'json':!![]};logger[_0x6b6e('0x19')]('['+[_0x2a9cde[_0x6b6e('0x10')]()]+_0x6b6e('0x1a'),_0x2e0b2b);return rp(_0x2e0b2b)[_0x6b6e('0xb')](function(_0x3249ee){logger['info']('['+[_0x2a9cde[_0x6b6e('0x10')]()]+_0x6b6e('0x1b'),_0x3249ee);if(_0x3249ee[_0x6b6e('0xc')][_0x6b6e('0xd')]>0x0&&String(_0x3249ee['result'][0x0]['active'])===_0x6b6e('0x1c')){_0x4acc77[_0x6b6e('0x1d')]=_0x3249ee['result'][0x0][_0x6b6e('0xf')];}else{_0x4acc77[_0x6b6e('0x1d')]=_0x4acc77['adminId'];_0x4acc77[_0x6b6e('0x18')]=_0x4acc77['adminEmail'];}logger[_0x6b6e('0x19')]('['+[_0x2a9cde['toUpperCase']()]+_0x6b6e('0x1e'),_0x4acc77);_0x3c9cec(_0x4acc77);})[_0x6b6e('0x12')](function(_0x2caeb9){logger[_0x6b6e('0x13')]('['+[_0x2a9cde[_0x6b6e('0x10')]()]+']',_0x2caeb9[_0x6b6e('0x14')]);_0x4a675f(_0x2caeb9['message']);});}else{logger[_0x6b6e('0x19')]('['+[_0x2a9cde['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x4acc77[_0x6b6e('0x1d')]=_0x4acc77['adminId'];_0x4acc77[_0x6b6e('0x18')]=_0x4acc77[_0x6b6e('0x1f')];_0x3c9cec(_0x4acc77);}});};}function createEndUser(_0x3fd506,_0x1fd069,_0x37b4e0,_0x18da96,_0x2bcb03){logger[_0x6b6e('0x19')]('['+[_0x3fd506[_0x6b6e('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x37b4e0);return new Promise(function(_0x5daff9,_0x9f8380){var _0x5c695a={'method':_0x6b6e('0x20'),'uri':_0x18da96+_0x6b6e('0x21')+_0x2bcb03,'body':{'user_name':_0x37b4e0['endUserNumber'],'roles':_0x6b6e('0x22'),'first_name':_0x37b4e0['endUserNumber'],'active':_0x6b6e('0x1c'),'date_format':'System','phone':_0x37b4e0[_0x6b6e('0x23')]},'auth':_0x1fd069,'json':!![]};return rp(_0x5c695a)['then'](function(_0x5ba477){logger[_0x6b6e('0x19')]('['+[_0x3fd506[_0x6b6e('0x10')]()]+'],\x20EndUser\x20schema',_0x5ba477['result']);_0x37b4e0['endUserId']=_0x5ba477[_0x6b6e('0xc')][_0x6b6e('0xf')];_0x5daff9(_0x37b4e0);})[_0x6b6e('0x12')](function(_0x1c8f92){logger[_0x6b6e('0x13')]('['+[_0x3fd506[_0x6b6e('0x10')]()]+']',_0x1c8f92['message']);_0x9f8380(_0x1c8f92[_0x6b6e('0x14')]);});});}function getEndUser(_0x3e0900,_0x4295ae,_0x469a6a,_0x4fba29,_0x5e624e){return function(_0x3560c1){logger[_0x6b6e('0x19')]('['+[_0x3e0900[_0x6b6e('0x10')]()]+_0x6b6e('0x24'),_0x3560c1);return new Promise(function(_0x3779db,_0x3bfdf0){var _0x462ac9={'method':'GET','uri':_0x469a6a+_0x6b6e('0x25')+_0x3560c1['endUserNumber']+'&'+_0x4fba29+'&'+_0x5e624e,'auth':_0x4295ae,'json':!![]};return rp(_0x462ac9)[_0x6b6e('0xb')](function(_0xf50298){if(_0xf50298['result'][_0x6b6e('0xd')]>0x0){_0x3560c1[_0x6b6e('0x26')]=_0xf50298[_0x6b6e('0xc')][0x0][_0x6b6e('0xf')];logger[_0x6b6e('0x19')]('['+[_0x3e0900['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x3560c1);_0x3779db(_0x3560c1);}else{return createEndUser(_0x3e0900,_0x4295ae,_0x3560c1,_0x469a6a,_0x4fba29)['then'](function(_0x69c38e){logger[_0x6b6e('0x19')]('['+[_0x3e0900[_0x6b6e('0x10')]()]+_0x6b6e('0x27'),_0x69c38e);_0x3779db(_0x69c38e);});}})[_0x6b6e('0x12')](function(_0x1fbdcb){logger[_0x6b6e('0x13')]('['+[_0x3e0900[_0x6b6e('0x10')]()]+']',_0x1fbdcb[_0x6b6e('0x14')]);_0x3bfdf0(_0x1fbdcb[_0x6b6e('0x14')]);});});};}function getCustomFields(_0x50ba64,_0x4f2c2f){var _0x5e8e39={};if(_0x50ba64[_0x6b6e('0xd')]>0x0){_[_0x6b6e('0x28')](_0x50ba64,function(_0x55da7e){if(_[_0x6b6e('0x29')]([_0x6b6e('0x2a'),_0x6b6e('0x2b')],_0x55da7e[_0x6b6e('0x2c')])&&_0x55da7e['nameField']&&!_0x55da7e[_0x6b6e('0x2d')]){_0x5e8e39[_0x55da7e[_0x6b6e('0x2e')][_0x6b6e('0x2f')]()]=_0x55da7e[_0x6b6e('0x30')][_0x6b6e('0x31')]();}else if(_['includes']([_0x6b6e('0x2a'),_0x6b6e('0x2b')],_0x55da7e[_0x6b6e('0x2c')])&&_0x55da7e[_0x6b6e('0x32')]&&_0x55da7e[_0x6b6e('0x2d')]){_0x5e8e39[_0x55da7e[_0x6b6e('0x32')][_0x6b6e('0x2f')]()]=_0x55da7e[_0x6b6e('0x30')][_0x6b6e('0x31')]();}else if(_0x55da7e[_0x6b6e('0x2c')]===_0x6b6e('0x33')&&_0x55da7e[_0x6b6e('0x34')]&&_0x55da7e['idField']&&_0x55da7e['customField']){_0x5e8e39[_0x55da7e[_0x6b6e('0x32')][_0x6b6e('0x2f')]()]=_0x4f2c2f[_0x55da7e[_0x6b6e('0x34')]][_0x6b6e('0x31')]();}else if(_0x55da7e[_0x6b6e('0x2c')]===_0x6b6e('0x35')&&_0x55da7e['Variable']&&_0x55da7e[_0x6b6e('0x36')][_0x6b6e('0x37')]&&_0x55da7e['idField']&&_0x55da7e[_0x6b6e('0x2d')]){_0x5e8e39[_0x55da7e[_0x6b6e('0x32')][_0x6b6e('0x2f')]()]=_0x4f2c2f[_0x55da7e[_0x6b6e('0x36')][_0x6b6e('0x37')]['toLowerCase']()][_0x6b6e('0x31')]();}});}return _0x5e8e39;}function getTicket(_0x34b55a,_0x5a760f,_0x82073c,_0x58fa5d,_0x33c9ec,_0x3929e3){return function(_0x4a9b74){logger['info']('['+[_0x34b55a[_0x6b6e('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x4a9b74);return new Promise(function(_0x2e3e0a,_0x372b98){var _0x54d360=_0x34b55a[_0x6b6e('0x2f')]()===_0x6b6e('0x38')?_0x4a9b74[_0x6b6e('0x1d')]:_0x4a9b74[_0x6b6e('0x26')];var _0x155c3d={'method':_0x6b6e('0x20'),'uri':_0x82073c+_0x6b6e('0x39')+'?'+_0x3929e3,'body':Object['assign']({},{'active':_0x6b6e('0x1c'),'caller_id':_0x54d360,'assigned_to':_0x4a9b74['userId'],'short_description':intUtil['getString'](_0x58fa5d[_0x6b6e('0x3a')],_0x33c9ec,'\x20'),'description':intUtil[_0x6b6e('0x3b')](_0x58fa5d[_0x6b6e('0x3c')],_0x33c9ec,'\x0a')},getCustomFields(_0x58fa5d[_0x6b6e('0x3d')],_0x33c9ec)),'auth':_0x5a760f,'json':!![]};return rp(_0x155c3d)[_0x6b6e('0xb')](function(_0x4a3d91){logger[_0x6b6e('0x19')]('['+[_0x34b55a['toUpperCase']()]+_0x6b6e('0x3e'),_0x4a3d91[_0x6b6e('0xc')]);_0x4a9b74[_0x6b6e('0x3f')]=_0x4a3d91['result'][_0x6b6e('0xf')];_0x4a9b74['ticketNumber']=_0x4a3d91[_0x6b6e('0xc')][_0x6b6e('0x40')];logger[_0x6b6e('0x19')]('['+[_0x34b55a['toUpperCase']()]+_0x6b6e('0x41'),_0x4a9b74);_0x2e3e0a(_0x4a9b74);})['catch'](function(_0x103a55){logger[_0x6b6e('0x13')]('['+[_0x34b55a[_0x6b6e('0x10')]()]+']',_0x103a55[_0x6b6e('0x14')]);_0x372b98(_0x103a55[_0x6b6e('0x14')]);});});};}function createRemoteTag(_0x203e4e,_0x2891d2,_0x5b757c,_0x21c9a0){return new Promise(function(_0x1502f4,_0x13dc91){var _0x44f713={'method':_0x6b6e('0x20'),'uri':_0x5b757c+_0x6b6e('0x42')+'?'+_0x21c9a0,'body':{'short_description':_0x203e4e,'global':!![],'active':!![],'name':_0x203e4e},'auth':_0x2891d2,'json':!![]};return rp(_0x44f713)['then'](function(_0x48849e){var _0x8d103d=_0x48849e['result'][_0x6b6e('0xf')];_0x1502f4(_0x8d103d);});});}function getRemoteTag(_0x51faf0,_0x4b5377,_0x256df9,_0xaa785c,_0x494bba){return new Promise(function(_0x2e9d7a,_0x546455){var _0x44e2b3={'method':_0x6b6e('0x9'),'uri':_0x256df9+_0x6b6e('0x42')+_0x6b6e('0x43')+_0x51faf0+'&'+_0xaa785c,'auth':_0x4b5377,'json':!![]};return rp(_0x44e2b3)['then'](function(_0xeb4068){if(_0xeb4068[_0x6b6e('0xc')][_0x6b6e('0xd')]>0x0){var _0x8ddb60=_0xeb4068[_0x6b6e('0xc')][0x0][_0x6b6e('0xf')];_0x2e9d7a(_0x8ddb60);}else{return createRemoteTag(_0x51faf0,_0x4b5377,_0x256df9,_0xaa785c)[_0x6b6e('0xb')](function(_0x2a98a0){_0x2e9d7a(_0x2a98a0);});}});});}function assignTagToIncident(_0x411390,_0x3454ff,_0x19d39b,_0x588ae6,_0x5ba0b8){return new Promise(function(_0x13dd9f,_0x56332d){var _0x2d4f8c={'method':_0x6b6e('0x20'),'uri':_0x19d39b+_0x6b6e('0x44')+'?'+_0x5ba0b8,'body':{'label':_0x411390,'table':_0x6b6e('0x39'),'id_type':'Incident','table_key':_0x588ae6['ticketId'],'title':'Incident\x20-\x20'+_0x588ae6['ticketNumber'],'id_display':_0x588ae6[_0x6b6e('0x45')]},'auth':_0x3454ff,'json':!![]};return rp(_0x2d4f8c)[_0x6b6e('0xb')](function(_0x2a52a9){_0x13dd9f();})['catch'](function(){_0x13dd9f();});});}function manageTags(_0x1f7a36,_0x13f4da,_0x3d6b66,_0xbf7b4c,_0x12cb49,_0x5e389e,_0x18ff80){return new Promise(function(_0x5b0d69,_0x4ab807){var _0x9ffb8e=[];_0x13f4da[_0x6b6e('0x28')](function(_0x31ef0f){_0x9ffb8e[_0x6b6e('0x46')](getRemoteTag(_0x31ef0f,_0x3d6b66,_0xbf7b4c,_0x5e389e,_0x18ff80));});return Promise[_0x6b6e('0x47')](_0x9ffb8e)[_0x6b6e('0xb')](function(_0x57616f){if(_0x57616f[_0x6b6e('0xd')]){logger[_0x6b6e('0x19')]('['+[_0x1f7a36[_0x6b6e('0x10')]()]+_0x6b6e('0x48'),_0x57616f);var _0x534c5b=[];_0x57616f[_0x6b6e('0x28')](function(_0x5579ee){_0x534c5b[_0x6b6e('0x46')](assignTagToIncident(_0x5579ee,_0x3d6b66,_0xbf7b4c,_0x12cb49,_0x5e389e));});return Promise[_0x6b6e('0x47')](_0x534c5b)[_0x6b6e('0xb')](function(){_0x5b0d69();})[_0x6b6e('0x12')](function(){_0x5b0d69();});}else{_0x5b0d69();}});});}function getTags(_0x44d28e,_0x54c6fc,_0x4c85ec,_0x32a99d,_0x517b64,_0x39433c){return function(_0x5cda71){return new Promise(function(_0x45c904,_0x81c3e2){var _0x2ebc7c=[];var _0x413d5b=_0x32a99d[_0x6b6e('0x49')];if(_0x413d5b&&_0x413d5b['length']>0x0){_0x2ebc7c=_[_0x6b6e('0x4a')](_0x413d5b,_0x6b6e('0x37'));}if(_0x2ebc7c[_0x6b6e('0xd')]>0x0){return manageTags(_0x44d28e,_0x2ebc7c,_0x54c6fc,_0x4c85ec,_0x5cda71,_0x517b64,_0x39433c)[_0x6b6e('0xb')](function(){_0x45c904(_0x5cda71);});}else{_0x45c904(_0x5cda71);}});};}function emit(_0x28dcd6,_0xea688f,_0x52e891){var _0x242ec3=_0x6b6e('0x4b')+_0x6b6e('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x48e35c={'uri':_0x28dcd6+_0x6b6e('0x4d')+_0x52e891+_0x242ec3};io['to'](util[_0x6b6e('0x4e')](_0x6b6e('0x4f'),_0xea688f))[_0x6b6e('0x50')](_0x6b6e('0x51'),_0x48e35c);}exports['cs']=function(_0x2db723,_0x76af55,_0x339223,_0x2a7a76,_0x3a2e46,_0x599bc2,_0x2c77b0,_0x464c77){var _0x260955={};var _0x39e51f={'user':_0x599bc2[_0x6b6e('0x52')],'pass':_0x599bc2[_0x6b6e('0x53')]};var _0x19d036=_0x6b6e('0x54');var _0x3a7c05=_0x6b6e('0x55');_0x599bc2[_0x6b6e('0x56')]=intUtil[_0x6b6e('0x57')](_0x599bc2[_0x6b6e('0x56')]);_0x599bc2[_0x6b6e('0x58')]=intUtil[_0x6b6e('0x57')](_0x599bc2[_0x6b6e('0x58')]);var _0x4972f8=util[_0x6b6e('0x4e')](_0x6b6e('0x59'),_0x599bc2[_0x6b6e('0x56')]);_0x260955['userEmail']=!_[_0x6b6e('0x5a')](_0x2a7a76)?_0x2a7a76['email']:null;_0x260955['adminEmail']=_0x599bc2[_0x6b6e('0x5b')];_0x260955[_0x6b6e('0x23')]=_0x464c77[_0x6b6e('0x2f')]()===_0x6b6e('0x38')?_0x76af55['destcalleridnum']:_0x76af55['calleridnum'];_0x260955[_0x6b6e('0x5c')]=_0x464c77==='queue'||_0x464c77==='unmanaged'?_0x6b6e('0x5d'):_0x6b6e('0x38');var _0x34a311=util[_0x6b6e('0x4e')](_0x6b6e('0x5e'),_0x599bc2[_0x6b6e('0x58')],_0x76af55[_0x6b6e('0x5f')],md5(_0x76af55['uniqueid']));if(_0x3a2e46&&_0x3a2e46[_0x6b6e('0x60')]){logger['info']('[QUEUE]',_0x6b6e('0x61'));_0x76af55['recordingURL']=_0x34a311;}else if(_0x2c77b0&&_0x2c77b0['recordingFormat']&&_0x2c77b0[_0x6b6e('0x62')]!==_0x6b6e('0x63')){logger[_0x6b6e('0x19')]('[OUTBOUND]',_0x6b6e('0x61'));_0x76af55[_0x6b6e('0x64')]=_0x34a311;}else{_0x76af55[_0x6b6e('0x64')]='';}return getAdminUser(_0x464c77,_0x39e51f,_0x260955,_0x4972f8,_0x3a7c05,_0x19d036)[_0x6b6e('0xb')](getUser(_0x464c77,_0x39e51f,_0x4972f8,_0x3a7c05,_0x19d036))['then'](getEndUser(_0x464c77,_0x39e51f,_0x4972f8,_0x3a7c05,_0x19d036))[_0x6b6e('0xb')](getTicket(_0x464c77,_0x39e51f,_0x4972f8,_0x339223,_0x76af55,_0x3a7c05))[_0x6b6e('0xb')](function(_0x56281a){logger[_0x6b6e('0x19')](util[_0x6b6e('0x4e')](_0x6b6e('0x65'),_0x56281a[_0x6b6e('0x3f')]));logger[_0x6b6e('0x19')](util['format'](_0x6b6e('0x66'),_0x464c77));if(_0x464c77!==_0x6b6e('0x67')){logger[_0x6b6e('0x19')]('['+[_0x464c77['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x599bc2[_0x6b6e('0x56')],_0x2a7a76[_0x6b6e('0x37')],_0x56281a[_0x6b6e('0x3f')]);}})[_0x6b6e('0x12')](function(_0x555629){logger['error']('['+[_0x464c77[_0x6b6e('0x10')]()]+_0x6b6e('0x68'),util[_0x6b6e('0x69')](_0x555629,{'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 a0f742a..51baba6 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 _0x3355=['contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','lodash','bluebird','util','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','POST','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x3355,0x17d));var _0x5335=function(_0x4ff753,_0x113391){_0x4ff753=_0x4ff753-0x0;var _0x469ac8=_0x3355[_0x4ff753];return _0x469ac8;};'use strict';var _=require(_0x5335('0x0'));var rp=require('request-promise');var BPromise=require(_0x5335('0x1'));var md5=require('md5');var util=require(_0x5335('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5335('0x3'));config[_0x5335('0x4')]=_[_0x5335('0x5')](config[_0x5335('0x4')],{'host':_0x5335('0x6'),'port':0x18eb});var io=require(_0x5335('0x7'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x14a21e,_0x2bab08,_0x33283f){io['to'](_0x14a21e)[_0x5335('0x8')](_0x2bab08,_0x33283f);}function getTicket(_0x4bf8fc,_0x31dc73,_0x3ef796,_0xaf44bb,_0x257687,_0x36ef7e,_0x3649c8,_0x3127be){logger[_0x5335('0x9')]('Creating\x20new\x20ticket...');var _0xf5252b=new Date();var _0x2111eb=[{'name':'name','value':intUtil[_0x5335('0xa')](_0xaf44bb[_0x5335('0xb')],_0x257687,'\x20')},{'name':_0x5335('0xc'),'value':_0x31dc73['id']},{'name':_0x5335('0xd'),'value':_0x31dc73['id']},{'name':_0x5335('0xe'),'value':intUtil[_0x5335('0xa')](_0xaf44bb[_0x5335('0xf')],_0x257687,'\x0a')},{'name':'date_start','value':_0xf5252b[_0x5335('0x10')]()[_0x5335('0x11')](0x0,0x13)[_0x5335('0x12')]('T','\x20')},{'name':_0x5335('0x13'),'value':'0'},{'name':_0x5335('0x14'),'value':'15'},{'name':_0x5335('0x15'),'value':_0x3ef796['id']},{'name':_0x5335('0x16'),'value':_0x5335('0x17')},{'name':_0x5335('0x18'),'value':_0x3ef796[_0x5335('0x19')]},{'name':'direction','value':_0x3127be}];if(_0x36ef7e['length']){_['forEach'](_0x36ef7e,function(_0x25d7ff){if(_0x257687[_0x25d7ff[_0x5335('0x1a')]]){_0x2111eb[_0x5335('0x1b')]({'name':_0x25d7ff[_0x5335('0x1c')],'value':_0x257687[_0x25d7ff['variableName']]});}});}return request({'form':{'method':_0x5335('0x1d'),'input_type':_0x5335('0x1e'),'response_type':_0x5335('0x1e'),'rest_data':JSON[_0x5335('0x1f')]({'session':_0x3649c8['id'],'module_name':'Calls','name_value_list':_0x2111eb})}});}function getAuth(_0x3b7b1c){return util[_0x5335('0x20')](_0x5335('0x21'),new Buffer(_0x3b7b1c[_0x5335('0x22')]+':X')[_0x5335('0x23')](_0x5335('0x24')));}function getServerInfo(_0x565fb8){return request({'form':{'method':_0x5335('0x25'),'input_type':_0x5335('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x565fb8['id']})}});}function getUser(_0x5914fc,_0x4abf4e,_0x5c1c05){if(!_[_0x5335('0x26')](_0x4abf4e)){logger[_0x5335('0x9')]('Getting\x20agent\x20with\x20name',_0x4abf4e);return request({'form':{'method':'get_entry_list','input_type':_0x5335('0x1e'),'response_type':_0x5335('0x1e'),'rest_data':JSON[_0x5335('0x1f')]({'session':_0x5c1c05['id'],'module_name':_0x5335('0x27'),'query':util[_0x5335('0x20')](_0x5335('0x28'),_0x4abf4e),'order_by':'','offset':'0','select_fields':['id',_0x5335('0x19'),_0x5335('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5335('0x2a')](function(_0x2572b9){if(_0x2572b9[_0x5335('0x2b')]['length']){var _0x1cb0c5=_[_0x5335('0x2c')](_0x2572b9[_0x5335('0x2b')],function(_0x2d7c40){return _0x2d7c40['name_value_list'][_0x5335('0x29')][_0x5335('0x2d')]===_0x4abf4e;});if(_0x1cb0c5){logger[_0x5335('0x9')](_0x5335('0x2e'));return BPromise[_0x5335('0x2f')]({'id':_0x1cb0c5[_0x5335('0x30')]['id']['value'],'name':_0x1cb0c5[_0x5335('0x30')][_0x5335('0x19')]['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5c1c05[_0x5335('0x30')][_0x5335('0x31')]['value'],'name':_0x5c1c05[_0x5335('0x30')][_0x5335('0x29')][_0x5335('0x2d')]});});}else{logger[_0x5335('0x9')](_0x5335('0x32'));return BPromise[_0x5335('0x2f')]({'id':_0x5c1c05[_0x5335('0x30')]['user_id'][_0x5335('0x2d')],'name':_0x5c1c05[_0x5335('0x30')]['user_name']['value']});}}function getEndUser(_0x5a8656,_0x5409ef,_0x405162,_0xdadf10){logger[_0x5335('0x9')](_0x5335('0x33'),_0x405162);return request({'form':{'method':_0x5335('0x34'),'input_type':_0x5335('0x1e'),'response_type':'JSON','rest_data':JSON[_0x5335('0x1f')]({'session':_0xdadf10['id'],'module_name':_0x5335('0x17'),'query':util[_0x5335('0x20')](_0x5335('0x35'),_0x405162),'order_by':'','offset':'0','select_fields':['id',_0x5335('0x19'),_0x5335('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f4171){if(_0x2f4171['entry_list'][_0x5335('0x37')]){var _0x18ec3c=_['find'](_0x2f4171[_0x5335('0x2b')],function(_0x2eadd3){return _0x2eadd3[_0x5335('0x30')][_0x5335('0x36')][_0x5335('0x2d')]===_0x405162;});if(_0x18ec3c){logger['info'](_0x5335('0x38'));return BPromise['resolve']({'id':_0x18ec3c[_0x5335('0x30')]['id'][_0x5335('0x2d')],'name':_0x18ec3c[_0x5335('0x30')][_0x5335('0x19')][_0x5335('0x2d')],'phone':_0x18ec3c[_0x5335('0x30')][_0x5335('0x36')]['value']});}}else{logger[_0x5335('0x9')](_0x5335('0x39'));return request({'form':{'method':_0x5335('0x1d'),'input_type':_0x5335('0x1e'),'response_type':_0x5335('0x1e'),'rest_data':JSON[_0x5335('0x1f')]({'session':_0xdadf10['id'],'module_name':_0x5335('0x17'),'name_value_list':[{'name':_0x5335('0x3a'),'value':_0x5409ef!==_0x5335('0x3b')?_0x5409ef:util[_0x5335('0x20')](_0x5335('0x3c'),_0x405162)},{'name':'phone_home','value':_0x405162}]})}})[_0x5335('0x2a')](function(_0x9104ec){logger[_0x5335('0x9')](_0x5335('0x3d'));return BPromise[_0x5335('0x2f')]({'id':_0x9104ec['id'],'name':_0x9104ec[_0x5335('0x2b')][_0x5335('0x3a')][_0x5335('0x2d')],'phone':_0x9104ec[_0x5335('0x2b')]['phone_home'][_0x5335('0x2d')]});});}});}function request(_0x38e94c){logger['debug']('[HTTP]',JSON[_0x5335('0x1f')](_0x38e94c));return rp(_['merge'](def,_0x38e94c));}function getTags(_0x17298c,_0x2719a6){var _0x32b30d=[];if(_0x17298c&&_0x17298c[_0x5335('0x37')]>0x0){_0x32b30d=_[_0x5335('0x3e')](_0x17298c,_0x2719a6);}return _0x32b30d;}function getCustomFields(_0x5375a2,_0x2287f1){var _0x56f969=[];var _0x1257fd={'custom_fields':[]};if(_0x5375a2[_0x5335('0x37')]>0x0){_[_0x5335('0x3f')](_0x5375a2,function(_0x349b9a){if(_0x349b9a[_0x5335('0x40')]===_0x5335('0x41')&&_0x349b9a[_0x5335('0x42')]&&!_0x349b9a[_0x5335('0x43')]){_0x1257fd[_0x349b9a[_0x5335('0x42')][_0x5335('0x44')]()]=_0x349b9a[_0x5335('0x45')]['toString']();}else if(_0x349b9a[_0x5335('0x40')]===_0x5335('0x41')&&_0x349b9a[_0x5335('0x1c')]&&_0x349b9a['customField']){_0x1257fd['custom_fields'][_0x5335('0x1b')]({'id':_0x349b9a[_0x5335('0x1c')],'value':_0x349b9a[_0x5335('0x45')]['toString']()});}else if(_0x349b9a[_0x5335('0x40')]===_0x5335('0x46')&&_0x349b9a['variableName']&&_0x349b9a['idField']&&_0x349b9a['customField']){_0x2287f1[_0x349b9a[_0x5335('0x1a')]]&&_0x1257fd[_0x5335('0x47')]['push']({'id':_0x349b9a['idField'],'value':_0x2287f1[_0x349b9a[_0x5335('0x1a')]][_0x5335('0x23')]()});}else if(_0x349b9a[_0x5335('0x40')]===_0x5335('0x48')&&_0x349b9a[_0x5335('0x49')]&&_0x349b9a[_0x5335('0x49')][_0x5335('0x19')]&&_0x349b9a['idField']&&_0x349b9a[_0x5335('0x43')]){_0x2287f1[_0x349b9a[_0x5335('0x49')]['name'][_0x5335('0x44')]()]&&_0x1257fd[_0x5335('0x47')][_0x5335('0x1b')]({'id':_0x349b9a[_0x5335('0x1c')],'value':_0x2287f1[_0x349b9a['Variable'][_0x5335('0x19')][_0x5335('0x44')]()][_0x5335('0x23')]()});}});}return _0x1257fd;}function getConnection(_0x5a6918){return request({'method':_0x5335('0x4a'),'form':{'method':_0x5335('0x4b'),'input_type':'JSON','response_type':_0x5335('0x1e'),'rest_data':JSON[_0x5335('0x1f')]({'user_auth':{'user_name':_0x5a6918[_0x5335('0x4c')],'password':_0x5a6918[_0x5335('0x4d')],'encryption':_0x5335('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5335('0x2a')](function(_0x37d1b4){var _0x37aeea=_0x37d1b4;if(_0x37aeea['id']){def['sessionID']=_0x37aeea['id'];return BPromise[_0x5335('0x2f')](_0x37aeea);}else{throw new Error(util['format'](_0x5335('0x4f'),_0x5a6918['id']));}});}function setRelationship(_0x5b3b7b,_0x21e7c1,_0x4ad658,_0x4b0695){return request({'form':{'method':_0x5335('0x50'),'input_type':_0x5335('0x1e'),'response_type':_0x5335('0x1e'),'rest_data':JSON['stringify']({'session':_0x5b3b7b['id'],'module_name':_0x5335('0x51'),'module_id':_0x4ad658['id'],'link_field_name':_0x4b0695,'related_ids':[_0x21e7c1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2ce6f3,_0x4c2bba,_0x4311e9,_0x3d56ed,_0xedd47d,_0x1601ca){var _0xc27118,_0x17e5b8,_0x49d47c,_0x1e0e10;_0x1601ca['remoteUri']=intUtil[_0x5335('0x52')](_0x1601ca['remoteUri']);_0x1601ca['serverUrl']=intUtil['stripTrailingSlash'](_0x1601ca[_0x5335('0x53')]);def[_0x5335('0x54')]=util[_0x5335('0x20')](_0x5335('0x55'),_0x1601ca[_0x5335('0x56')]);if(_0xedd47d&&_0xedd47d['monitor_format']){logger[_0x5335('0x9')]('[QUEUE]',_0x5335('0x57'));_0x4c2bba['recordingURL']=util[_0x5335('0x20')](_0x5335('0x58'),_0x1601ca[_0x5335('0x53')],_0x4c2bba[_0x5335('0x59')],md5(_0x4c2bba['uniqueid']));}else{_0x4c2bba[_0x5335('0x5a')]='';}return getConnection(_0x1601ca)[_0x5335('0x2a')](function(_0xbc62bd){_0x1e0e10=_0xbc62bd;return getUser(_0x1601ca,_0x3d56ed['name'],_0x1e0e10);})[_0x5335('0x2a')](function(_0x38863b){_0xc27118=_0x38863b;logger[_0x5335('0x9')](_0x5335('0x5b'),_0xc27118['id']);return getEndUser(_0x1601ca,_0x4c2bba[_0x5335('0x5c')],_0x4c2bba[_0x5335('0x5d')],_0x1e0e10);})[_0x5335('0x2a')](function(_0x86b8b6){_0x17e5b8=_0x86b8b6;logger[_0x5335('0x9')]('The\x20Enduser\x20ID\x20is:',_0x17e5b8['id']);return getTicket(_0x1601ca,_0xc27118,_0x17e5b8,_0x4311e9,_0x4c2bba,_0x4311e9[_0x5335('0x5e')],_0x1e0e10,_0x5335('0x5f'));})['then'](function(_0x545fc1){_0x49d47c=_0x545fc1;logger[_0x5335('0x9')](_0x5335('0x60'));logger['info'](_0x5335('0x61'),_0x49d47c['id']);return setRelationship(_0x1e0e10,_0xc27118,_0x49d47c,_0x5335('0x62'));})[_0x5335('0x2a')](function(){return setRelationship(_0x1e0e10,_0x17e5b8,_0x49d47c,_0x5335('0x63'));})[_0x5335('0x2a')](function(){return getServerInfo(_0x1e0e10);})['then'](function(_0xd51df2){var _0x15b41d=parseInt(_0xd51df2[_0x5335('0x64')][_0x5335('0x65')](0x0));var _0x7260fe=util[_0x5335('0x20')](_0x5335('0x66'),_0x1601ca[_0x5335('0x56')],_0x49d47c['id']);if(_0x15b41d>0x6){_0x7260fe=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1601ca[_0x5335('0x56')],_0x49d47c['id']);}logger['info'](_0x5335('0x67'),_0x5335('0x68'));emit(util[_0x5335('0x20')](_0x5335('0x69'),_0x3d56ed[_0x5335('0x19')]),_0x5335('0x6a'),{'uri':_0x7260fe});})['catch'](function(_0x13171){logger[_0x5335('0x6b')]('[QUEUE]',JSON['stringify'](_0x13171));});};exports[_0x5335('0x6c')]=function(_0x1ac1c0,_0x22eba5,_0x14fef1,_0x2791cc,_0x10f90c,_0x515164,_0x509bbb){var _0x35cedf,_0x2bcea2,_0x522c3b,_0x1c4928;_0x515164[_0x5335('0x56')]=intUtil[_0x5335('0x52')](_0x515164[_0x5335('0x56')]);_0x515164[_0x5335('0x53')]=intUtil['stripTrailingSlash'](_0x515164[_0x5335('0x53')]);def[_0x5335('0x54')]=util[_0x5335('0x20')](_0x5335('0x55'),_0x515164[_0x5335('0x56')]);if(_0x509bbb&&_0x509bbb[_0x5335('0x6d')]&&_0x509bbb[_0x5335('0x6d')]!==_0x5335('0x6e')){logger[_0x5335('0x9')](_0x5335('0x6f'),_0x5335('0x57'));_0x22eba5[_0x5335('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x515164['serverUrl'],_0x22eba5[_0x5335('0x59')],md5(_0x22eba5[_0x5335('0x59')]));}return getConnection(_0x515164)[_0x5335('0x2a')](function(_0x476053){_0x1c4928=_0x476053;return getUser(_0x515164,_0x2791cc[_0x5335('0x19')],_0x1c4928);})['then'](function(_0x2d1c51){_0x35cedf=_0x2d1c51;logger['info']('The\x20User\x20ID\x20is:',_0x35cedf['id']);return getEndUser(_0x515164,_0x22eba5[_0x5335('0x70')],_0x22eba5[_0x5335('0x71')],_0x1c4928);})[_0x5335('0x2a')](function(_0x33c656){_0x2bcea2=_0x33c656;logger['info'](_0x5335('0x72'),_0x2bcea2['id']);return getTicket(_0x515164,_0x35cedf,_0x2bcea2,_0x14fef1,_0x22eba5,_0x14fef1['Fields'],_0x1c4928,_0x5335('0x73'));})[_0x5335('0x2a')](function(_0xb1a8aa){_0x522c3b=_0xb1a8aa;logger[_0x5335('0x9')]('Ticket\x20created!');logger[_0x5335('0x9')](_0x5335('0x61'),_0x522c3b['id']);return setRelationship(_0x1c4928,_0x35cedf,_0x522c3b,_0x5335('0x62'));})[_0x5335('0x2a')](function(){return setRelationship(_0x1c4928,_0x2bcea2,_0x522c3b,_0x5335('0x63'));})['then'](function(){return getServerInfo(_0x1c4928);})[_0x5335('0x2a')](function(_0x4383a9){var _0x8357cb=parseInt(_0x4383a9[_0x5335('0x64')][_0x5335('0x65')](0x0));var _0x15c68b=util[_0x5335('0x20')](_0x5335('0x66'),_0x515164['remoteUri'],_0x522c3b['id']);if(_0x8357cb>0x6){_0x15c68b=util[_0x5335('0x20')](_0x5335('0x74'),_0x515164[_0x5335('0x56')],_0x522c3b['id']);}logger[_0x5335('0x9')](_0x5335('0x6f'),_0x5335('0x68'));emit(util['format'](_0x5335('0x69'),_0x2791cc[_0x5335('0x19')]),_0x5335('0x6a'),{'uri':_0x15c68b});})['catch'](function(_0xd40655){logger[_0x5335('0x6b')](_0x5335('0x6f'),JSON[_0x5335('0x1f')](_0xd40655));});};exports[_0x5335('0x75')]=function(_0x5e021d,_0x3f401d,_0x184da8,_0x42f932,_0xc26036,_0x57d139){var _0x20141d,_0x5de2f5,_0x4b3a95,_0x140fbe;_0x57d139[_0x5335('0x56')]=intUtil[_0x5335('0x52')](_0x57d139[_0x5335('0x56')]);_0x57d139[_0x5335('0x53')]=intUtil[_0x5335('0x52')](_0x57d139[_0x5335('0x53')]);def[_0x5335('0x54')]=util['format'](_0x5335('0x55'),_0x57d139['remoteUri']);if(_0xc26036&&_0xc26036['monitor_format']){logger[_0x5335('0x9')]('['+_0x3f401d[_0x5335('0x76')]['toUpperCase']()+']',_0x5335('0x57'));_0x3f401d[_0x5335('0x5a')]=util[_0x5335('0x20')](_0x5335('0x58'),_0x57d139[_0x5335('0x53')],_0x3f401d[_0x5335('0x59')],md5(_0x3f401d[_0x5335('0x59')]));}else{_0x3f401d[_0x5335('0x5a')]='';}return getConnection(_0x57d139)[_0x5335('0x2a')](function(_0x593d88){_0x140fbe=_0x593d88;if(!_[_0x5335('0x26')](_0x42f932)){return getUser(_0x57d139,_0x42f932[_0x5335('0x19')],_0x140fbe);}else{return getUser(_0x57d139,null,_0x140fbe);}})[_0x5335('0x2a')](function(_0x4e1795){_0x20141d=_0x4e1795;logger[_0x5335('0x9')]('The\x20User\x20ID\x20is:',_0x20141d['id']);return getEndUser(_0x57d139,_0x3f401d[_0x5335('0x5c')],_0x3f401d[_0x5335('0x5d')],_0x140fbe);})['then'](function(_0xae407a){_0x5de2f5=_0xae407a;logger[_0x5335('0x9')](_0x5335('0x72'),_0x5de2f5['id']);return getTicket(_0x57d139,_0x20141d,_0x5de2f5,_0x184da8,_0x3f401d,_0x184da8[_0x5335('0x5e')],_0x140fbe,_0x5335('0x5f'));})[_0x5335('0x2a')](function(_0x4fed53){_0x4b3a95=_0x4fed53;logger[_0x5335('0x9')](_0x5335('0x60'));logger['info'](_0x5335('0x61'),_0x4b3a95['id']);return setRelationship(_0x140fbe,_0x20141d,_0x4b3a95,'users');})[_0x5335('0x2a')](function(){return setRelationship(_0x140fbe,_0x5de2f5,_0x4b3a95,_0x5335('0x63'));})[_0x5335('0x2a')](function(){return getServerInfo(_0x140fbe);})['catch'](function(_0x195512){logger[_0x5335('0x6b')]('['+_0x3f401d[_0x5335('0x76')][_0x5335('0x77')]()+']',JSON[_0x5335('0x1f')](_0x195512));});}; \ No newline at end of file +var _0x2fa2=['outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','contacts','version','charAt','unmanaged','uri','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','bluebird','md5','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','direction','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','length','map','string','nameField','type','customField','custom_fields','push','content','variable','Variable','toLowerCase','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','%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','error'];(function(_0x51eb91,_0x4799d5){var _0x1c4fc4=function(_0x1fd807){while(--_0x1fd807){_0x51eb91['push'](_0x51eb91['shift']());}};_0x1c4fc4(++_0x4799d5);}(_0x2fa2,0x8a));var _0x22fa=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x2fa2[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x22fa('0x0'));var rp=require('request-promise');var BPromise=require(_0x22fa('0x1'));var md5=require(_0x22fa('0x2'));var util=require(_0x22fa('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x22fa('0x4'));var logger=require(_0x22fa('0x5'))(_0x22fa('0x6'));config[_0x22fa('0x7')]=_[_0x22fa('0x8')](config['redis'],{'host':_0x22fa('0x9'),'port':0x18eb});var io=require(_0x22fa('0xa'))(new Redis(config[_0x22fa('0x7')]));var def={'method':_0x22fa('0xb'),'json':!![]};function emit(_0x2158c7,_0x1d8b42,_0x4cb0ce){io['to'](_0x2158c7)['emit'](_0x1d8b42,_0x4cb0ce);}function getTicket(_0x58525a,_0x2fac8e,_0x33bd1f,_0x101f23,_0x3bd55f,_0x4e1ef7,_0x29a000,_0xf455a8){logger[_0x22fa('0xc')](_0x22fa('0xd'));var _0x34c620=new Date();var _0x5ce6fd=[{'name':_0x22fa('0xe'),'value':intUtil[_0x22fa('0xf')](_0x101f23['Subjects'],_0x3bd55f,'\x20')},{'name':_0x22fa('0x10'),'value':_0x2fac8e['id']},{'name':_0x22fa('0x11'),'value':_0x2fac8e['id']},{'name':_0x22fa('0x12'),'value':intUtil['getString'](_0x101f23[_0x22fa('0x13')],_0x3bd55f,'\x0a')},{'name':_0x22fa('0x14'),'value':_0x34c620[_0x22fa('0x15')]()[_0x22fa('0x16')](0x0,0x13)[_0x22fa('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x22fa('0x18'),'value':'15'},{'name':_0x22fa('0x19'),'value':_0x33bd1f['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x33bd1f[_0x22fa('0xe')]},{'name':_0x22fa('0x1a'),'value':_0xf455a8}];if(_0x4e1ef7['length']){_[_0x22fa('0x1b')](_0x4e1ef7,function(_0x18a1c5){if(_0x3bd55f[_0x18a1c5[_0x22fa('0x1c')]]){_0x5ce6fd['push']({'name':_0x18a1c5[_0x22fa('0x1d')],'value':_0x3bd55f[_0x18a1c5[_0x22fa('0x1c')]]});}});}return request({'form':{'method':_0x22fa('0x1e'),'input_type':_0x22fa('0x1f'),'response_type':_0x22fa('0x1f'),'rest_data':JSON[_0x22fa('0x20')]({'session':_0x29a000['id'],'module_name':'Calls','name_value_list':_0x5ce6fd})}});}function getAuth(_0x1ea66e){return util[_0x22fa('0x21')](_0x22fa('0x22'),new Buffer(_0x1ea66e[_0x22fa('0x23')]+':X')[_0x22fa('0x24')](_0x22fa('0x25')));}function getServerInfo(_0x4e2381){return request({'form':{'method':_0x22fa('0x26'),'input_type':'JSON','response_type':_0x22fa('0x1f'),'rest_data':JSON[_0x22fa('0x20')]({'session':_0x4e2381['id']})}});}function getUser(_0x267526,_0x21f604,_0x1cc1a3){if(!_[_0x22fa('0x27')](_0x21f604)){logger[_0x22fa('0xc')](_0x22fa('0x28'),_0x21f604);return request({'form':{'method':_0x22fa('0x29'),'input_type':_0x22fa('0x1f'),'response_type':'JSON','rest_data':JSON[_0x22fa('0x20')]({'session':_0x1cc1a3['id'],'module_name':'Employees','query':util[_0x22fa('0x21')](_0x22fa('0x2a'),_0x21f604),'order_by':'','offset':'0','select_fields':['id',_0x22fa('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x22fa('0x2b')](function(_0x148510){if(_0x148510[_0x22fa('0x2c')]['length']){var _0x5d721d=_[_0x22fa('0x2d')](_0x148510[_0x22fa('0x2c')],function(_0x234c88){return _0x234c88[_0x22fa('0x2e')][_0x22fa('0x2f')][_0x22fa('0x30')]===_0x21f604;});if(_0x5d721d){logger[_0x22fa('0xc')]('Agent\x20found!');return BPromise[_0x22fa('0x31')]({'id':_0x5d721d[_0x22fa('0x2e')]['id'][_0x22fa('0x30')],'name':_0x5d721d[_0x22fa('0x2e')][_0x22fa('0xe')][_0x22fa('0x30')]});}}logger[_0x22fa('0xc')](_0x22fa('0x32'));return BPromise['resolve']({'id':_0x1cc1a3[_0x22fa('0x2e')][_0x22fa('0x33')][_0x22fa('0x30')],'name':_0x1cc1a3[_0x22fa('0x2e')][_0x22fa('0x2f')][_0x22fa('0x30')]});});}else{logger[_0x22fa('0xc')](_0x22fa('0x34'));return BPromise[_0x22fa('0x31')]({'id':_0x1cc1a3[_0x22fa('0x2e')]['user_id'][_0x22fa('0x30')],'name':_0x1cc1a3[_0x22fa('0x2e')][_0x22fa('0x2f')][_0x22fa('0x30')]});}}function getEndUser(_0x2e36a6,_0x185be3,_0x5ad79d,_0x3b11ef){logger[_0x22fa('0xc')](_0x22fa('0x35'),_0x5ad79d);return request({'form':{'method':_0x22fa('0x29'),'input_type':'JSON','response_type':_0x22fa('0x1f'),'rest_data':JSON['stringify']({'session':_0x3b11ef['id'],'module_name':'Contacts','query':util[_0x22fa('0x21')](_0x22fa('0x36'),_0x5ad79d),'order_by':'','offset':'0','select_fields':['id',_0x22fa('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x22fa('0x2b')](function(_0xf0dfc5){if(_0xf0dfc5[_0x22fa('0x2c')]['length']){var _0x136ecd=_[_0x22fa('0x2d')](_0xf0dfc5[_0x22fa('0x2c')],function(_0x2aba4f){return _0x2aba4f[_0x22fa('0x2e')][_0x22fa('0x37')][_0x22fa('0x30')]===_0x5ad79d;});if(_0x136ecd){logger[_0x22fa('0xc')](_0x22fa('0x38'));return BPromise['resolve']({'id':_0x136ecd['name_value_list']['id'][_0x22fa('0x30')],'name':_0x136ecd[_0x22fa('0x2e')][_0x22fa('0xe')][_0x22fa('0x30')],'phone':_0x136ecd[_0x22fa('0x2e')][_0x22fa('0x37')][_0x22fa('0x30')]});}}else{logger[_0x22fa('0xc')](_0x22fa('0x39'));return request({'form':{'method':_0x22fa('0x1e'),'input_type':_0x22fa('0x1f'),'response_type':_0x22fa('0x1f'),'rest_data':JSON['stringify']({'session':_0x3b11ef['id'],'module_name':'Contacts','name_value_list':[{'name':_0x22fa('0x3a'),'value':_0x185be3!==_0x22fa('0x3b')?_0x185be3:util['format'](_0x22fa('0x3c'),_0x5ad79d)},{'name':_0x22fa('0x37'),'value':_0x5ad79d}]})}})['then'](function(_0x368bed){logger[_0x22fa('0xc')](_0x22fa('0x3d'));return BPromise[_0x22fa('0x31')]({'id':_0x368bed['id'],'name':_0x368bed[_0x22fa('0x2c')][_0x22fa('0x3a')]['value'],'phone':_0x368bed[_0x22fa('0x2c')][_0x22fa('0x37')][_0x22fa('0x30')]});});}});}function request(_0x582f93){logger[_0x22fa('0x3e')](_0x22fa('0x3f'),JSON[_0x22fa('0x20')](_0x582f93));return rp(_['merge'](def,_0x582f93));}function getTags(_0x3fc5d9,_0x4bb2cf){var _0xa79763=[];if(_0x3fc5d9&&_0x3fc5d9[_0x22fa('0x40')]>0x0){_0xa79763=_[_0x22fa('0x41')](_0x3fc5d9,_0x4bb2cf);}return _0xa79763;}function getCustomFields(_0x62a6a4,_0x187465){var _0x805026=[];var _0x4e35e2={'custom_fields':[]};if(_0x62a6a4[_0x22fa('0x40')]>0x0){_[_0x22fa('0x1b')](_0x62a6a4,function(_0x29e590){if(_0x29e590['type']===_0x22fa('0x42')&&_0x29e590[_0x22fa('0x43')]&&!_0x29e590['customField']){_0x4e35e2[_0x29e590['nameField']['toLowerCase']()]=_0x29e590['content'][_0x22fa('0x24')]();}else if(_0x29e590[_0x22fa('0x44')]===_0x22fa('0x42')&&_0x29e590[_0x22fa('0x1d')]&&_0x29e590[_0x22fa('0x45')]){_0x4e35e2[_0x22fa('0x46')][_0x22fa('0x47')]({'id':_0x29e590[_0x22fa('0x1d')],'value':_0x29e590[_0x22fa('0x48')]['toString']()});}else if(_0x29e590['type']===_0x22fa('0x49')&&_0x29e590[_0x22fa('0x1c')]&&_0x29e590[_0x22fa('0x1d')]&&_0x29e590['customField']){_0x187465[_0x29e590['variableName']]&&_0x4e35e2['custom_fields'][_0x22fa('0x47')]({'id':_0x29e590[_0x22fa('0x1d')],'value':_0x187465[_0x29e590[_0x22fa('0x1c')]][_0x22fa('0x24')]()});}else if(_0x29e590[_0x22fa('0x44')]==='customVariable'&&_0x29e590['Variable']&&_0x29e590[_0x22fa('0x4a')][_0x22fa('0xe')]&&_0x29e590[_0x22fa('0x1d')]&&_0x29e590['customField']){_0x187465[_0x29e590['Variable'][_0x22fa('0xe')][_0x22fa('0x4b')]()]&&_0x4e35e2[_0x22fa('0x46')][_0x22fa('0x47')]({'id':_0x29e590[_0x22fa('0x1d')],'value':_0x187465[_0x29e590[_0x22fa('0x4a')]['name']['toLowerCase']()][_0x22fa('0x24')]()});}});}return _0x4e35e2;}function getConnection(_0x29c036){return request({'method':_0x22fa('0xb'),'form':{'method':_0x22fa('0x4c'),'input_type':_0x22fa('0x1f'),'response_type':_0x22fa('0x1f'),'rest_data':JSON[_0x22fa('0x20')]({'user_auth':{'user_name':_0x29c036[_0x22fa('0x4d')],'password':_0x29c036[_0x22fa('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x22fa('0x2b')](function(_0x378b8b){var _0x523112=_0x378b8b;if(_0x523112['id']){def[_0x22fa('0x4f')]=_0x523112['id'];return BPromise[_0x22fa('0x31')](_0x523112);}else{throw new Error(util[_0x22fa('0x21')](_0x22fa('0x50'),_0x29c036['id']));}});}function setRelationship(_0x1a1463,_0x152554,_0x5ef22b,_0x2de8a3){return request({'form':{'method':_0x22fa('0x51'),'input_type':_0x22fa('0x1f'),'response_type':_0x22fa('0x1f'),'rest_data':JSON[_0x22fa('0x20')]({'session':_0x1a1463['id'],'module_name':'Calls','module_id':_0x5ef22b['id'],'link_field_name':_0x2de8a3,'related_ids':[_0x152554['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x22fa('0x52')]=function(_0x580cfb,_0x5e2d10,_0x301a43,_0x342b6e,_0x1828ae,_0x2e075d){var _0x1b361a,_0x47a056,_0x54236a,_0x2459dd;_0x2e075d[_0x22fa('0x53')]=intUtil['stripTrailingSlash'](_0x2e075d['remoteUri']);_0x2e075d[_0x22fa('0x54')]=intUtil['stripTrailingSlash'](_0x2e075d[_0x22fa('0x54')]);def['uri']=util[_0x22fa('0x21')]('%s/service/v4_1/rest.php',_0x2e075d[_0x22fa('0x53')]);if(_0x1828ae&&_0x1828ae[_0x22fa('0x55')]){logger['info'](_0x22fa('0x56'),_0x22fa('0x57'));_0x5e2d10['recordingURL']=util[_0x22fa('0x21')](_0x22fa('0x58'),_0x2e075d[_0x22fa('0x54')],_0x5e2d10[_0x22fa('0x59')],md5(_0x5e2d10['uniqueid']));}else{_0x5e2d10[_0x22fa('0x5a')]='';}return getConnection(_0x2e075d)[_0x22fa('0x2b')](function(_0x3534e9){_0x2459dd=_0x3534e9;return getUser(_0x2e075d,_0x342b6e['name'],_0x2459dd);})[_0x22fa('0x2b')](function(_0x57eb92){_0x1b361a=_0x57eb92;logger[_0x22fa('0xc')](_0x22fa('0x5b'),_0x1b361a['id']);return getEndUser(_0x2e075d,_0x5e2d10[_0x22fa('0x5c')],_0x5e2d10[_0x22fa('0x5d')],_0x2459dd);})[_0x22fa('0x2b')](function(_0x3d22a0){_0x47a056=_0x3d22a0;logger[_0x22fa('0xc')]('The\x20Enduser\x20ID\x20is:',_0x47a056['id']);return getTicket(_0x2e075d,_0x1b361a,_0x47a056,_0x301a43,_0x5e2d10,_0x301a43['Fields'],_0x2459dd,_0x22fa('0x5e'));})[_0x22fa('0x2b')](function(_0x17101e){_0x54236a=_0x17101e;logger['info'](_0x22fa('0x5f'));logger[_0x22fa('0xc')](_0x22fa('0x60'),_0x54236a['id']);return setRelationship(_0x2459dd,_0x1b361a,_0x54236a,_0x22fa('0x61'));})[_0x22fa('0x2b')](function(){return setRelationship(_0x2459dd,_0x47a056,_0x54236a,'contacts');})[_0x22fa('0x2b')](function(){return getServerInfo(_0x2459dd);})[_0x22fa('0x2b')](function(_0x40ca5f){var _0x2276ad=parseInt(_0x40ca5f['version']['charAt'](0x0));var _0x13dc00=util[_0x22fa('0x21')](_0x22fa('0x62'),_0x2e075d[_0x22fa('0x53')],_0x54236a['id']);if(_0x2276ad>0x6){_0x13dc00=util[_0x22fa('0x21')](_0x22fa('0x63'),_0x2e075d['remoteUri'],_0x54236a['id']);}logger['info'](_0x22fa('0x56'),_0x22fa('0x64'));emit(util[_0x22fa('0x21')](_0x22fa('0x65'),_0x342b6e[_0x22fa('0xe')]),'trigger:browser:url',{'uri':_0x13dc00});})[_0x22fa('0x66')](function(_0x44327a){logger[_0x22fa('0x67')]('[QUEUE]',JSON[_0x22fa('0x20')](_0x44327a));});};exports[_0x22fa('0x68')]=function(_0x234f9a,_0x48ba1f,_0x15fc66,_0x35918c,_0x5a3dd6,_0x45d792,_0x7da20d){var _0x2c6540,_0x1039e2,_0x4402fd,_0x571863;_0x45d792[_0x22fa('0x53')]=intUtil['stripTrailingSlash'](_0x45d792[_0x22fa('0x53')]);_0x45d792[_0x22fa('0x54')]=intUtil[_0x22fa('0x69')](_0x45d792[_0x22fa('0x54')]);def['uri']=util[_0x22fa('0x21')](_0x22fa('0x6a'),_0x45d792[_0x22fa('0x53')]);if(_0x7da20d&&_0x7da20d[_0x22fa('0x6b')]&&_0x7da20d[_0x22fa('0x6b')]!==_0x22fa('0x6c')){logger[_0x22fa('0xc')](_0x22fa('0x6d'),_0x22fa('0x57'));_0x48ba1f[_0x22fa('0x5a')]=util['format'](_0x22fa('0x58'),_0x45d792[_0x22fa('0x54')],_0x48ba1f[_0x22fa('0x59')],md5(_0x48ba1f[_0x22fa('0x59')]));}return getConnection(_0x45d792)[_0x22fa('0x2b')](function(_0x5a23c2){_0x571863=_0x5a23c2;return getUser(_0x45d792,_0x35918c[_0x22fa('0xe')],_0x571863);})['then'](function(_0x38e54e){_0x2c6540=_0x38e54e;logger[_0x22fa('0xc')](_0x22fa('0x5b'),_0x2c6540['id']);return getEndUser(_0x45d792,_0x48ba1f[_0x22fa('0x6e')],_0x48ba1f[_0x22fa('0x6f')],_0x571863);})['then'](function(_0x1a597d){_0x1039e2=_0x1a597d;logger[_0x22fa('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1039e2['id']);return getTicket(_0x45d792,_0x2c6540,_0x1039e2,_0x15fc66,_0x48ba1f,_0x15fc66[_0x22fa('0x70')],_0x571863,'Outbound');})[_0x22fa('0x2b')](function(_0x41183f){_0x4402fd=_0x41183f;logger[_0x22fa('0xc')]('Ticket\x20created!');logger[_0x22fa('0xc')](_0x22fa('0x60'),_0x4402fd['id']);return setRelationship(_0x571863,_0x2c6540,_0x4402fd,_0x22fa('0x61'));})[_0x22fa('0x2b')](function(){return setRelationship(_0x571863,_0x1039e2,_0x4402fd,_0x22fa('0x71'));})[_0x22fa('0x2b')](function(){return getServerInfo(_0x571863);})[_0x22fa('0x2b')](function(_0x5b0160){var _0x414915=parseInt(_0x5b0160[_0x22fa('0x72')][_0x22fa('0x73')](0x0));var _0x582973=util[_0x22fa('0x21')](_0x22fa('0x62'),_0x45d792[_0x22fa('0x53')],_0x4402fd['id']);if(_0x414915>0x6){_0x582973=util[_0x22fa('0x21')](_0x22fa('0x63'),_0x45d792[_0x22fa('0x53')],_0x4402fd['id']);}logger[_0x22fa('0xc')]('[OUTBOUND]',_0x22fa('0x64'));emit(util[_0x22fa('0x21')](_0x22fa('0x65'),_0x35918c['name']),'trigger:browser:url',{'uri':_0x582973});})['catch'](function(_0x1f866a){logger[_0x22fa('0x67')](_0x22fa('0x6d'),JSON[_0x22fa('0x20')](_0x1f866a));});};exports[_0x22fa('0x74')]=function(_0x2e82cc,_0x431eae,_0x2bfcdb,_0x5e111b,_0x2012e4,_0x3fb6ff){var _0x2844fa,_0x1d8f18,_0x4f02d9,_0x27ac01;_0x3fb6ff[_0x22fa('0x53')]=intUtil['stripTrailingSlash'](_0x3fb6ff[_0x22fa('0x53')]);_0x3fb6ff['serverUrl']=intUtil['stripTrailingSlash'](_0x3fb6ff[_0x22fa('0x54')]);def[_0x22fa('0x75')]=util[_0x22fa('0x21')](_0x22fa('0x6a'),_0x3fb6ff['remoteUri']);if(_0x2012e4&&_0x2012e4[_0x22fa('0x55')]){logger[_0x22fa('0xc')]('['+_0x431eae[_0x22fa('0x76')][_0x22fa('0x77')]()+']','Recording\x20is\x20enabled!');_0x431eae[_0x22fa('0x5a')]=util['format'](_0x22fa('0x58'),_0x3fb6ff[_0x22fa('0x54')],_0x431eae['uniqueid'],md5(_0x431eae[_0x22fa('0x59')]));}else{_0x431eae[_0x22fa('0x5a')]='';}return getConnection(_0x3fb6ff)[_0x22fa('0x2b')](function(_0x462d13){_0x27ac01=_0x462d13;if(!_[_0x22fa('0x27')](_0x5e111b)){return getUser(_0x3fb6ff,_0x5e111b['name'],_0x27ac01);}else{return getUser(_0x3fb6ff,null,_0x27ac01);}})[_0x22fa('0x2b')](function(_0x474ffc){_0x2844fa=_0x474ffc;logger[_0x22fa('0xc')](_0x22fa('0x5b'),_0x2844fa['id']);return getEndUser(_0x3fb6ff,_0x431eae[_0x22fa('0x5c')],_0x431eae['calleridnum'],_0x27ac01);})[_0x22fa('0x2b')](function(_0x34a355){_0x1d8f18=_0x34a355;logger[_0x22fa('0xc')](_0x22fa('0x78'),_0x1d8f18['id']);return getTicket(_0x3fb6ff,_0x2844fa,_0x1d8f18,_0x2bfcdb,_0x431eae,_0x2bfcdb[_0x22fa('0x70')],_0x27ac01,'Inbound');})[_0x22fa('0x2b')](function(_0x1a19ba){_0x4f02d9=_0x1a19ba;logger['info'](_0x22fa('0x5f'));logger[_0x22fa('0xc')](_0x22fa('0x60'),_0x4f02d9['id']);return setRelationship(_0x27ac01,_0x2844fa,_0x4f02d9,'users');})[_0x22fa('0x2b')](function(){return setRelationship(_0x27ac01,_0x1d8f18,_0x4f02d9,_0x22fa('0x71'));})[_0x22fa('0x2b')](function(){return getServerInfo(_0x27ac01);})[_0x22fa('0x66')](function(_0x22c889){logger[_0x22fa('0x67')]('['+_0x431eae[_0x22fa('0x76')]['toUpperCase']()+']',JSON[_0x22fa('0x20')](_0x22c889));});}; \ 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 017ae48..cc06e99 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 _0x455d=['keyValue','keyType','key','format','%s:\x20%s','variableName','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','sortBy','type','string','push','variable','toString','customVariable','Variable','name','toLowerCase'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x455d,0x1bd));var _0xd455=function(_0x5046a6,_0x36001c){_0x5046a6=_0x5046a6-0x0;var _0x4a0b70=_0x455d[_0x5046a6];return _0x4a0b70;};'use strict';var _=require('lodash');var util=require(_0xd455('0x0'));exports['getString']=function(_0x8d5e3d,_0x18d2fd,_0x12d296){var _0x3fd641=[];if(_0x8d5e3d['length']>0x0){var _0x4e5eed=_[_0xd455('0x1')](_0x8d5e3d,['id']);for(var _0x377768=0x0;_0x377768<_0x4e5eed['length'];_0x377768++){var _0x1771d6=_0x4e5eed[_0x377768];if(_0x1771d6[_0xd455('0x2')]===_0xd455('0x3')){_0x3fd641[_0xd455('0x4')](_0x1771d6['content']);}else if(_0x1771d6[_0xd455('0x2')]===_0xd455('0x5')&&_0x1771d6['variableName']){_0x18d2fd[_0x1771d6['variableName']]&&_0x3fd641[_0xd455('0x4')](_0x18d2fd[_0x1771d6['variableName']][_0xd455('0x6')]());}else if(_0x1771d6[_0xd455('0x2')]===_0xd455('0x7')&&_0x1771d6['Variable']&&_0x1771d6[_0xd455('0x8')]['name']){_0x18d2fd[_0x1771d6['Variable']['name']['toLowerCase']()]&&_0x3fd641[_0xd455('0x4')](_0x18d2fd[_0x1771d6[_0xd455('0x8')][_0xd455('0x9')][_0xd455('0xa')]()][_0xd455('0x6')]());}else if(_0x1771d6['type']===_0xd455('0xb')){if(_0x1771d6[_0xd455('0xc')]===_0xd455('0x3')&&_0x1771d6[_0xd455('0xd')]){_0x3fd641[_0xd455('0x4')](util[_0xd455('0xe')](_0xd455('0xf'),_0x1771d6[_0xd455('0xd')],_0x1771d6['keyContent']));}else if(_0x1771d6['keyType']===_0xd455('0x5')&&_0x1771d6[_0xd455('0x10')]&&_0x1771d6[_0xd455('0xd')]){_0x18d2fd[_0x1771d6[_0xd455('0x10')]]&&_0x3fd641[_0xd455('0x4')](util[_0xd455('0xe')](_0xd455('0xf'),_0x1771d6[_0xd455('0xd')],_0x18d2fd[_0x1771d6[_0xd455('0x10')]]));}else if(_0x1771d6[_0xd455('0xc')]===_0xd455('0x7')&&_0x1771d6[_0xd455('0x8')]&&_0x1771d6[_0xd455('0x8')][_0xd455('0x9')]&&_0x1771d6['key']){_0x18d2fd[_0x1771d6[_0xd455('0x8')]['name'][_0xd455('0xa')]()]&&_0x3fd641[_0xd455('0x4')](util[_0xd455('0xe')]('%s:\x20%s',_0x1771d6['key'],_0x18d2fd[_0x1771d6['Variable'][_0xd455('0x9')][_0xd455('0xa')]()]));}}}}return _0x3fd641[_0xd455('0x11')](_0x12d296);};exports[_0xd455('0x12')]=function(_0x3d38c6){var _0x439115=_0x3d38c6[_0xd455('0x13')](-0x1);if(_0x439115==='/'){_0x3d38c6=_0x3d38c6['substring'](0x0,_0x3d38c6[_0xd455('0x14')](_0x439115));}return _0x3d38c6;};exports[_0xd455('0x15')]=function(_0x21e36a){if(!_[_0xd455('0x16')](_0x21e36a)&&_0x21e36a!==''){var _0x5b2d83=/^(([^<>()\[\]\\.,;:\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 _0x5b2d83[_0xd455('0x17')](String(_0x21e36a)[_0xd455('0xa')]());}else{return![];}}; \ No newline at end of file +var _0xa00f=['Variable','name','keyValue','keyType','key','%s:\x20%s','variable','format','toLowerCase','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','type','string','push','variableName','toString','customVariable'];(function(_0x329bcd,_0x398856){var _0x4d8336=function(_0x5c7554){while(--_0x5c7554){_0x329bcd['push'](_0x329bcd['shift']());}};_0x4d8336(++_0x398856);}(_0xa00f,0x1e4));var _0xfa00=function(_0x599f4d,_0x408d7c){_0x599f4d=_0x599f4d-0x0;var _0x4abff8=_0xa00f[_0x599f4d];return _0x4abff8;};'use strict';var _=require(_0xfa00('0x0'));var util=require('util');exports[_0xfa00('0x1')]=function(_0x5a2459,_0x593a3f,_0x35560b){var _0x1e43e9=[];if(_0x5a2459[_0xfa00('0x2')]>0x0){var _0x48270e=_[_0xfa00('0x3')](_0x5a2459,['id']);for(var _0x2335d5=0x0;_0x2335d5<_0x48270e[_0xfa00('0x2')];_0x2335d5++){var _0x5a0f6f=_0x48270e[_0x2335d5];if(_0x5a0f6f[_0xfa00('0x4')]===_0xfa00('0x5')){_0x1e43e9[_0xfa00('0x6')](_0x5a0f6f['content']);}else if(_0x5a0f6f[_0xfa00('0x4')]==='variable'&&_0x5a0f6f[_0xfa00('0x7')]){_0x593a3f[_0x5a0f6f[_0xfa00('0x7')]]&&_0x1e43e9[_0xfa00('0x6')](_0x593a3f[_0x5a0f6f[_0xfa00('0x7')]][_0xfa00('0x8')]());}else if(_0x5a0f6f[_0xfa00('0x4')]===_0xfa00('0x9')&&_0x5a0f6f['Variable']&&_0x5a0f6f[_0xfa00('0xa')]['name']){_0x593a3f[_0x5a0f6f['Variable'][_0xfa00('0xb')]['toLowerCase']()]&&_0x1e43e9[_0xfa00('0x6')](_0x593a3f[_0x5a0f6f[_0xfa00('0xa')][_0xfa00('0xb')]['toLowerCase']()]['toString']());}else if(_0x5a0f6f[_0xfa00('0x4')]===_0xfa00('0xc')){if(_0x5a0f6f[_0xfa00('0xd')]==='string'&&_0x5a0f6f[_0xfa00('0xe')]){_0x1e43e9[_0xfa00('0x6')](util['format'](_0xfa00('0xf'),_0x5a0f6f[_0xfa00('0xe')],_0x5a0f6f['keyContent']));}else if(_0x5a0f6f[_0xfa00('0xd')]===_0xfa00('0x10')&&_0x5a0f6f['variableName']&&_0x5a0f6f[_0xfa00('0xe')]){_0x593a3f[_0x5a0f6f['variableName']]&&_0x1e43e9[_0xfa00('0x6')](util[_0xfa00('0x11')](_0xfa00('0xf'),_0x5a0f6f[_0xfa00('0xe')],_0x593a3f[_0x5a0f6f['variableName']]));}else if(_0x5a0f6f[_0xfa00('0xd')]==='customVariable'&&_0x5a0f6f[_0xfa00('0xa')]&&_0x5a0f6f[_0xfa00('0xa')]['name']&&_0x5a0f6f['key']){_0x593a3f[_0x5a0f6f[_0xfa00('0xa')][_0xfa00('0xb')][_0xfa00('0x12')]()]&&_0x1e43e9[_0xfa00('0x6')](util[_0xfa00('0x11')](_0xfa00('0xf'),_0x5a0f6f[_0xfa00('0xe')],_0x593a3f[_0x5a0f6f[_0xfa00('0xa')]['name'][_0xfa00('0x12')]()]));}}}}return _0x1e43e9[_0xfa00('0x13')](_0x35560b);};exports[_0xfa00('0x14')]=function(_0x4cfe2e){var _0x1b0d63=_0x4cfe2e[_0xfa00('0x15')](-0x1);if(_0x1b0d63==='/'){_0x4cfe2e=_0x4cfe2e['substring'](0x0,_0x4cfe2e[_0xfa00('0x16')](_0x1b0d63));}return _0x4cfe2e;};exports[_0xfa00('0x17')]=function(_0x32526c){if(!_[_0xfa00('0x18')](_0x32526c)&&_0x32526c!==''){var _0x27689f=/^(([^<>()\[\]\\.,;:\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 _0x27689f[_0xfa00('0x19')](String(_0x32526c)[_0xfa00('0x12')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a7a1df2..4ae3291 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x372203,_0x478c75){var _0x4d387c=function(_0x1e367a){while(--_0x1e367a){_0x372203['push'](_0x372203['shift']());}};_0x4d387c(++_0x478c75);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','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','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x4e62ca,_0xe85442){var _0x16007a=function(_0x52329b){while(--_0x52329b){_0x4e62ca['push'](_0x4e62ca['shift']());}};_0x16007a(++_0xe85442);}(_0xe706,0xa3));var _0x6e70=function(_0x89ace6,_0x39064b){_0x89ace6=_0x89ace6-0x0;var _0x302694=_0xe706[_0x89ace6];return _0x302694;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));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 io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 20cfd3b..db90180 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 _0x3ba9=['Displaying\x20ticket\x20to\x20agent...','newTab','[QUEUE]','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','info','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','type','customField','nameField','toLowerCase','content','picklist','custom_fields','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab'];(function(_0xcc8f00,_0x9fe352){var _0x32c498=function(_0x5f2fff){while(--_0x5f2fff){_0xcc8f00['push'](_0xcc8f00['shift']());}};_0x32c498(++_0x9fe352);}(_0x3ba9,0x102));var _0x93ba=function(_0x542f2f,_0x16cbd2){_0x542f2f=_0x542f2f-0x0;var _0x115950=_0x3ba9[_0x542f2f];return _0x115950;};'use strict';var _=require(_0x93ba('0x0'));var rp=require(_0x93ba('0x1'));var md5=require(_0x93ba('0x2'));var util=require(_0x93ba('0x3'));var Redis=require(_0x93ba('0x4'));var intUtil=require('./util');var config=require(_0x93ba('0x5'));var logger=require(_0x93ba('0x6'))(_0x93ba('0x7'));config['redis']=_[_0x93ba('0x8')](config[_0x93ba('0x9')],{'host':_0x93ba('0xa'),'port':0x18eb});var io=require(_0x93ba('0xb'))(new Redis(config[_0x93ba('0x9')]));function emit(_0x3006fe,_0x480037,_0x4a0761){io['to'](_0x3006fe)['emit'](_0x480037,_0x4a0761);}var headers={'Content-Type':_0x93ba('0xc'),'Accept':_0x93ba('0xc')};function getTicket(_0x1eb0d6,_0xf45346,_0xb3dca4,_0x2619dc,_0x14b228){logger[_0x93ba('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x93ba('0xe'),_0x1eb0d6[_0x93ba('0xf')]),'method':'POST','body':{'ticket':_[_0x93ba('0x10')]({'requester_id':_0xb3dca4['id'],'submitter_id':_0xf45346?_0xf45346['id']:undefined,'assignee_id':_0xf45346?_0xf45346['id']:undefined,'tags':getTags(_0x2619dc[_0x93ba('0x11')],_0x93ba('0x12')),'subject':intUtil[_0x93ba('0x13')](_0x2619dc[_0x93ba('0x14')],_0x14b228,'\x20'),'description':intUtil['getString'](_0x2619dc['Descriptions'],_0x14b228,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2619dc[_0x93ba('0x15')],_0x14b228,'\x0a')}},getCustomFields(_0x2619dc['Fields'],_0x14b228))}})[_0x93ba('0x16')](function(_0x59e26b){logger[_0x93ba('0xd')](_0x93ba('0x17'));return _0x59e26b[_0x93ba('0x18')];});}function getUser(_0x32b9b4,_0xc41c29){if(intUtil[_0x93ba('0x19')](_0xc41c29)){logger[_0x93ba('0xd')]('Getting\x20agent\x20with\x20email',_0xc41c29);return request({'uri':util[_0x93ba('0x1a')](_0x93ba('0x1b'),_0x32b9b4[_0x93ba('0xf')]),'qs':{'query':util[_0x93ba('0x1a')](_0x93ba('0x1c'),_0xc41c29)}})[_0x93ba('0x16')](function(_0xc7946e){if(_0xc7946e[_0x93ba('0x1d')]){logger[_0x93ba('0xd')](_0x93ba('0x1e'));return _[_0x93ba('0x1f')](_0xc7946e['results'],{'email':_0xc41c29,'role':_0x93ba('0x20')});}else{logger[_0x93ba('0xd')](_0x93ba('0x21'));return request({'uri':util[_0x93ba('0x1a')]('%s/users/me.json',_0x32b9b4[_0x93ba('0xf')])})[_0x93ba('0x16')](function(_0x577fac){logger[_0x93ba('0xd')]('Admin\x20account\x20selected.');return _0x577fac['user'];});}});}else{logger[_0x93ba('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x93ba('0x1a')](_0x93ba('0x22'),_0x32b9b4[_0x93ba('0xf')])})[_0x93ba('0x16')](function(_0x651182){logger[_0x93ba('0xd')](_0x93ba('0x23'));return _0x651182['user'];});}}function getEndUser(_0x5853fa,_0x1fb076,_0x12eadd){logger[_0x93ba('0xd')](_0x93ba('0x24'),_0x12eadd);return request({'uri':util[_0x93ba('0x1a')](_0x93ba('0x1b'),_0x5853fa[_0x93ba('0xf')]),'qs':{'query':util[_0x93ba('0x1a')](_0x93ba('0x25'),_0x12eadd)}})[_0x93ba('0x16')](function(_0x4864cc){var _0x54580f;if(_0x4864cc[_0x93ba('0x26')][_0x93ba('0x27')]){_0x4864cc[_0x93ba('0x26')]=_[_0x93ba('0x28')](_0x4864cc[_0x93ba('0x26')],{'suspended':![],'role':_0x93ba('0x29')});if(_0x4864cc[_0x93ba('0x26')][_0x93ba('0x27')]){_0x54580f=_['first'](_0x4864cc[_0x93ba('0x26')]);}}if(_0x54580f){logger['info']('Enduser\x20found!');return _0x54580f;}else{logger[_0x93ba('0xd')](_0x93ba('0x2a'));return request({'uri':util[_0x93ba('0x1a')](_0x93ba('0x2b'),_0x5853fa[_0x93ba('0xf')]),'method':_0x93ba('0x2c'),'body':{'user':{'role':'end-user','name':util[_0x93ba('0x1a')](_0x93ba('0x2d'),_0x1fb076||_0x12eadd),'phone':_0x12eadd}}})[_0x93ba('0x16')](function(_0x1bc0bc){logger[_0x93ba('0xd')](_0x93ba('0x2e'));return _0x1bc0bc[_0x93ba('0x2f')];});}});}function getAuth(_0x14fc7f){var _0x19b5d2;if(_0x14fc7f[_0x93ba('0x30')]===_0x93ba('0x31')){_0x19b5d2=util[_0x93ba('0x1a')]('%s:%s',_0x14fc7f[_0x93ba('0x32')],_0x14fc7f['password']);}else if(_0x14fc7f[_0x93ba('0x30')]==='token'){_0x19b5d2=util[_0x93ba('0x1a')](_0x93ba('0x33'),_0x14fc7f[_0x93ba('0x32')],_0x14fc7f['token']);}return util[_0x93ba('0x1a')](_0x93ba('0x34'),new Buffer(_0x19b5d2)[_0x93ba('0x35')](_0x93ba('0x36')));}function request(_0x162bfc){logger[_0x93ba('0x37')](_0x93ba('0x38'),JSON['stringify'](_0x162bfc));return rp(_[_0x93ba('0x8')](_0x162bfc,{'method':_0x93ba('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x275a60,_0x51114e){var _0x42f37e=[];if(_0x275a60&&_0x275a60[_0x93ba('0x27')]>0x0){_0x42f37e=_[_0x93ba('0x3a')](_0x275a60,_0x51114e);}return _0x42f37e;}function getCustomFields(_0x3cd725,_0x4e45a6){var _0x3d21d7=[];var _0x4f5443={'custom_fields':[]};if(_0x3cd725['length']>0x0){_[_0x93ba('0x3b')](_0x3cd725,function(_0xfcb0b6){if(_[_0x93ba('0x3c')]([_0x93ba('0x3d'),'picklist'],_0xfcb0b6[_0x93ba('0x3e')])&&_0xfcb0b6['nameField']&&!_0xfcb0b6[_0x93ba('0x3f')]){_0x4f5443[_0xfcb0b6[_0x93ba('0x40')][_0x93ba('0x41')]()]=_0xfcb0b6[_0x93ba('0x42')][_0x93ba('0x35')]();}else if(_['includes'](['string',_0x93ba('0x43')],_0xfcb0b6[_0x93ba('0x3e')])&&_0xfcb0b6['idField']&&_0xfcb0b6[_0x93ba('0x3f')]){_0x4f5443[_0x93ba('0x44')][_0x93ba('0x45')]({'id':_0xfcb0b6[_0x93ba('0x46')],'value':_0xfcb0b6['content'][_0x93ba('0x35')]()});}else if(_0xfcb0b6['type']===_0x93ba('0x47')&&_0xfcb0b6[_0x93ba('0x48')]&&_0xfcb0b6[_0x93ba('0x46')]&&_0xfcb0b6[_0x93ba('0x3f')]){_0x4e45a6[_0xfcb0b6['variableName']]&&_0x4f5443[_0x93ba('0x44')][_0x93ba('0x45')]({'id':_0xfcb0b6[_0x93ba('0x46')],'value':_0x4e45a6[_0xfcb0b6[_0x93ba('0x48')]][_0x93ba('0x35')]()});}else if(_0xfcb0b6[_0x93ba('0x3e')]===_0x93ba('0x49')&&_0xfcb0b6[_0x93ba('0x4a')]&&_0xfcb0b6[_0x93ba('0x4a')][_0x93ba('0x12')]&&_0xfcb0b6[_0x93ba('0x46')]&&_0xfcb0b6[_0x93ba('0x3f')]){_0x4e45a6[_0xfcb0b6[_0x93ba('0x4a')][_0x93ba('0x12')][_0x93ba('0x41')]()]&&_0x4f5443['custom_fields']['push']({'id':_0xfcb0b6[_0x93ba('0x46')],'value':_0x4e45a6[_0xfcb0b6['Variable'][_0x93ba('0x12')][_0x93ba('0x41')]()][_0x93ba('0x35')]()});}});}return _0x4f5443;}exports['queue']=function(_0x2ea47b,_0x5bac30,_0x3fba0f,_0x400f96,_0x35e5de,_0x4ce2ac){var _0xf897bf,_0x21428d;_0x4ce2ac['remoteUri']=intUtil[_0x93ba('0x4b')](_0x4ce2ac[_0x93ba('0xf')]);_0x4ce2ac[_0x93ba('0x4c')]=intUtil[_0x93ba('0x4b')](_0x4ce2ac[_0x93ba('0x4c')]);if(_0x35e5de&&_0x35e5de[_0x93ba('0x4d')]){logger[_0x93ba('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5bac30['recordingURL']=util[_0x93ba('0x1a')](_0x93ba('0x4e'),_0x4ce2ac[_0x93ba('0x4c')],_0x5bac30[_0x93ba('0x4f')],md5(_0x5bac30[_0x93ba('0x4f')]));}else{_0x5bac30[_0x93ba('0x50')]='';}headers[_0x93ba('0x51')]=getAuth(_0x4ce2ac);return getUser(_0x4ce2ac,_0x400f96['email'])[_0x93ba('0x16')](function(_0x28ac36){_0xf897bf=_0x28ac36;logger[_0x93ba('0xd')](_0x93ba('0x52'),_0xf897bf['id']);return getEndUser(_0x4ce2ac,_0x5bac30[_0x93ba('0x53')],_0x5bac30[_0x93ba('0x54')]);})['then'](function(_0x1d41e9){_0x21428d=_0x1d41e9;logger[_0x93ba('0xd')]('The\x20Enduser\x20ID\x20is:',_0x21428d['id']);return getTicket(_0x4ce2ac,_0xf897bf,_0x21428d,_0x3fba0f,_0x5bac30);})['then'](function(_0x558d37){if(_0x558d37){logger['info'](_0x93ba('0x55'),_0x558d37['id']);switch(_0x4ce2ac[_0x93ba('0x3e')]){case _0x93ba('0x56'):logger['info']('[QUEUE]',_0x93ba('0x57'));return request({'uri':util[_0x93ba('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4ce2ac[_0x93ba('0xf')],_0xf897bf['id'],_0x558d37['id']),'method':'POST'});case _0x93ba('0x58'):logger[_0x93ba('0xd')](_0x93ba('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x93ba('0x1a')](_0x93ba('0x5a'),_0x400f96[_0x93ba('0x12')]),_0x93ba('0x5b'),{'uri':util['format'](_0x93ba('0x5c'),_0x4ce2ac[_0x93ba('0xf')][_0x93ba('0x5d')](_0x93ba('0x5e'),''),_0x558d37['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x93ba('0x5f')](function(_0x284b9c){logger[_0x93ba('0x60')](_0x93ba('0x61'),util['inspect'](_0x284b9c,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x141a6b,_0x3e11d6,_0x567bf9,_0x5b9b1c,_0xd8baa9,_0x512552,_0x2b3691){var _0x52facc,_0x3a4eac;_0x512552[_0x93ba('0xf')]=intUtil['stripTrailingSlash'](_0x512552[_0x93ba('0xf')]);_0x512552[_0x93ba('0x4c')]=intUtil[_0x93ba('0x4b')](_0x512552[_0x93ba('0x4c')]);if(_0x2b3691&&_0x2b3691['recordingFormat']&&_0x2b3691[_0x93ba('0x62')]!==_0x93ba('0x63')){logger[_0x93ba('0xd')](_0x93ba('0x64'),'Recording\x20is\x20enabled!');_0x3e11d6[_0x93ba('0x50')]=util[_0x93ba('0x1a')](_0x93ba('0x4e'),_0x512552[_0x93ba('0x4c')],_0x3e11d6[_0x93ba('0x4f')],md5(_0x3e11d6[_0x93ba('0x4f')]));}headers[_0x93ba('0x51')]=getAuth(_0x512552);return getUser(_0x512552,_0x5b9b1c[_0x93ba('0x65')])[_0x93ba('0x16')](function(_0x13ae9d){_0x52facc=_0x13ae9d;logger[_0x93ba('0xd')](_0x93ba('0x52'),_0x52facc['id']);return getEndUser(_0x512552,_0x3e11d6[_0x93ba('0x66')],_0x3e11d6[_0x93ba('0x67')]);})[_0x93ba('0x16')](function(_0x22fadd){_0x3a4eac=_0x22fadd;logger[_0x93ba('0xd')](_0x93ba('0x68'),_0x3a4eac['id']);return getTicket(_0x512552,_0x52facc,_0x3a4eac,_0x567bf9,_0x3e11d6);})[_0x93ba('0x16')](function(_0x4a6e19){if(_0x4a6e19){logger[_0x93ba('0xd')](_0x93ba('0x55'),_0x4a6e19['id']);switch(_0x512552[_0x93ba('0x3e')]){case'integrationTab':logger[_0x93ba('0xd')](_0x93ba('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x93ba('0x69'),_0x512552['remoteUri'],_0x52facc['id'],_0x4a6e19['id']),'method':_0x93ba('0x2c')});case _0x93ba('0x58'):logger[_0x93ba('0xd')]('[OUTBOUND]',_0x93ba('0x6a'));emit(util['format']('user:%s',_0x5b9b1c[_0x93ba('0x12')]),_0x93ba('0x5b'),{'uri':util['format'](_0x93ba('0x5c'),_0x512552[_0x93ba('0xf')][_0x93ba('0x5d')](_0x93ba('0x5e'),''),_0x4a6e19['id'])});break;default:logger['error'](_0x93ba('0x64'),_0x93ba('0x6b'));}}})['catch'](function(_0x524e22){logger[_0x93ba('0x60')](_0x93ba('0x6c'),util[_0x93ba('0x6d')](_0x524e22,{'showHidden':!![],'depth':null}));});};exports[_0x93ba('0x6e')]=function(_0x6a260e,_0xe6f0f1,_0x505732,_0x3f04d9,_0x3164fe,_0x3c9732){var _0x2b1ba8,_0xd7c76f;_0x3c9732[_0x93ba('0xf')]=intUtil[_0x93ba('0x4b')](_0x3c9732['remoteUri']);_0x3c9732[_0x93ba('0x4c')]=intUtil[_0x93ba('0x4b')](_0x3c9732[_0x93ba('0x4c')]);if(_0x3164fe&&_0x3164fe[_0x93ba('0x4d')]){logger[_0x93ba('0xd')]('['+_0xe6f0f1[_0x93ba('0x6f')]['toUpperCase']()+']',_0x93ba('0x70'));_0xe6f0f1[_0x93ba('0x50')]=util[_0x93ba('0x1a')](_0x93ba('0x4e'),_0x3c9732[_0x93ba('0x4c')],_0xe6f0f1['uniqueid'],md5(_0xe6f0f1['uniqueid']));}else{_0xe6f0f1[_0x93ba('0x50')]='';}headers[_0x93ba('0x51')]=getAuth(_0x3c9732);return getUser(_0x3c9732)[_0x93ba('0x16')](function(_0x1b8139){_0x2b1ba8=_0x1b8139;logger[_0x93ba('0xd')]('The\x20User\x20ID\x20is:',_0x2b1ba8['id']);return getEndUser(_0x3c9732,_0xe6f0f1[_0x93ba('0x53')],_0xe6f0f1[_0x93ba('0x54')]);})['then'](function(_0x231e2d){_0xd7c76f=_0x231e2d;logger[_0x93ba('0xd')](_0x93ba('0x68'),_0xd7c76f['id']);return getTicket(_0x3c9732,_0x2b1ba8,_0xd7c76f,_0x505732,_0xe6f0f1);})[_0x93ba('0x16')](function(_0x58361e){if(_0x58361e){logger['info'](_0x93ba('0x55'),_0x58361e['id']);}})[_0x93ba('0x5f')](function(_0x1a0147){logger['error']('['+_0xe6f0f1[_0x93ba('0x6f')][_0x93ba('0x71')]()+']'+_0x93ba('0x72'),util[_0x93ba('0x6d')](_0x1a0147,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfcb7=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','Enduser\x20found!','Caller\x20-\x20%s','password','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','application/json','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find'];(function(_0x17060d,_0x3c8ffb){var _0x5e139e=function(_0x5b9fd4){while(--_0x5b9fd4){_0x17060d['push'](_0x17060d['shift']());}};_0x5e139e(++_0x3c8ffb);}(_0xfcb7,0xc0));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fcb('0x0'));var rp=require(_0x7fcb('0x1'));var md5=require(_0x7fcb('0x2'));var util=require('util');var Redis=require(_0x7fcb('0x3'));var intUtil=require('./util');var config=require(_0x7fcb('0x4'));var logger=require(_0x7fcb('0x5'))(_0x7fcb('0x6'));config[_0x7fcb('0x7')]=_['defaults'](config[_0x7fcb('0x7')],{'host':_0x7fcb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7fcb('0x7')]));function emit(_0x562184,_0x5c79f8,_0x28e606){io['to'](_0x562184)['emit'](_0x5c79f8,_0x28e606);}var headers={'Content-Type':_0x7fcb('0x9'),'Accept':_0x7fcb('0x9')};function getTicket(_0x5d3292,_0x2d3e05,_0xfdb1b5,_0x465aa7,_0x53ac92){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x7fcb('0xa')](_0x7fcb('0xb'),_0x5d3292['remoteUri']),'method':_0x7fcb('0xc'),'body':{'ticket':_[_0x7fcb('0xd')]({'requester_id':_0xfdb1b5['id'],'submitter_id':_0x2d3e05?_0x2d3e05['id']:undefined,'assignee_id':_0x2d3e05?_0x2d3e05['id']:undefined,'tags':getTags(_0x465aa7['Tags'],_0x7fcb('0xe')),'subject':intUtil[_0x7fcb('0xf')](_0x465aa7[_0x7fcb('0x10')],_0x53ac92,'\x20'),'description':intUtil[_0x7fcb('0xf')](_0x465aa7['Descriptions'],_0x53ac92,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7fcb('0xf')](_0x465aa7[_0x7fcb('0x11')],_0x53ac92,'\x0a')}},getCustomFields(_0x465aa7[_0x7fcb('0x12')],_0x53ac92))}})['then'](function(_0x196493){logger[_0x7fcb('0x13')](_0x7fcb('0x14'));return _0x196493[_0x7fcb('0x15')];});}function getUser(_0x537058,_0x33f9b5){if(intUtil[_0x7fcb('0x16')](_0x33f9b5)){logger[_0x7fcb('0x13')]('Getting\x20agent\x20with\x20email',_0x33f9b5);return request({'uri':util[_0x7fcb('0xa')](_0x7fcb('0x17'),_0x537058[_0x7fcb('0x18')]),'qs':{'query':util[_0x7fcb('0xa')](_0x7fcb('0x19'),_0x33f9b5)}})['then'](function(_0x3b1890){if(_0x3b1890['count']){logger[_0x7fcb('0x13')](_0x7fcb('0x1a'));return _[_0x7fcb('0x1b')](_0x3b1890['results'],{'email':_0x33f9b5,'role':_0x7fcb('0x1c')});}else{logger[_0x7fcb('0x13')](_0x7fcb('0x1d'));return request({'uri':util['format'](_0x7fcb('0x1e'),_0x537058['remoteUri'])})[_0x7fcb('0x1f')](function(_0x170f44){logger[_0x7fcb('0x13')](_0x7fcb('0x20'));return _0x170f44[_0x7fcb('0x21')];});}});}else{logger[_0x7fcb('0x13')](_0x7fcb('0x1d'));return request({'uri':util[_0x7fcb('0xa')](_0x7fcb('0x1e'),_0x537058[_0x7fcb('0x18')])})[_0x7fcb('0x1f')](function(_0x43b9f8){logger[_0x7fcb('0x13')](_0x7fcb('0x20'));return _0x43b9f8[_0x7fcb('0x21')];});}}function getEndUser(_0x338045,_0x376cbb,_0x2e9819){logger['info'](_0x7fcb('0x22'),_0x2e9819);return request({'uri':util[_0x7fcb('0xa')]('%s/search.json',_0x338045[_0x7fcb('0x18')]),'qs':{'query':util[_0x7fcb('0xa')](_0x7fcb('0x23'),_0x2e9819)}})[_0x7fcb('0x1f')](function(_0xa19165){var _0x2d07d6;if(_0xa19165[_0x7fcb('0x24')][_0x7fcb('0x25')]){_0xa19165[_0x7fcb('0x24')]=_['filter'](_0xa19165[_0x7fcb('0x24')],{'suspended':![],'role':_0x7fcb('0x26')});if(_0xa19165[_0x7fcb('0x24')][_0x7fcb('0x25')]){_0x2d07d6=_[_0x7fcb('0x27')](_0xa19165[_0x7fcb('0x24')]);}}if(_0x2d07d6){logger[_0x7fcb('0x13')](_0x7fcb('0x28'));return _0x2d07d6;}else{logger[_0x7fcb('0x13')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7fcb('0xa')]('%s/users.json',_0x338045[_0x7fcb('0x18')]),'method':_0x7fcb('0xc'),'body':{'user':{'role':_0x7fcb('0x26'),'name':util[_0x7fcb('0xa')](_0x7fcb('0x29'),_0x376cbb||_0x2e9819),'phone':_0x2e9819}}})[_0x7fcb('0x1f')](function(_0x1027d1){logger['info']('Enduser\x20created.');return _0x1027d1[_0x7fcb('0x21')];});}});}function getAuth(_0x431ca1){var _0x15558c;if(_0x431ca1['authType']===_0x7fcb('0x2a')){_0x15558c=util[_0x7fcb('0xa')]('%s:%s',_0x431ca1[_0x7fcb('0x2b')],_0x431ca1[_0x7fcb('0x2a')]);}else if(_0x431ca1['authType']===_0x7fcb('0x2c')){_0x15558c=util['format'](_0x7fcb('0x2d'),_0x431ca1[_0x7fcb('0x2b')],_0x431ca1[_0x7fcb('0x2c')]);}return util[_0x7fcb('0xa')]('Basic\x20%s',new Buffer(_0x15558c)[_0x7fcb('0x2e')](_0x7fcb('0x2f')));}function request(_0x4e95c3){logger[_0x7fcb('0x30')](_0x7fcb('0x31'),JSON[_0x7fcb('0x32')](_0x4e95c3));return rp(_[_0x7fcb('0x33')](_0x4e95c3,{'method':_0x7fcb('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3dd82b,_0x32e8e5){var _0x304449=[];if(_0x3dd82b&&_0x3dd82b['length']>0x0){_0x304449=_[_0x7fcb('0x35')](_0x3dd82b,_0x32e8e5);}return _0x304449;}function getCustomFields(_0x59185b,_0x52ada){var _0x1a2527=[];var _0x3cd254={'custom_fields':[]};if(_0x59185b[_0x7fcb('0x25')]>0x0){_[_0x7fcb('0x36')](_0x59185b,function(_0x330f75){if(_[_0x7fcb('0x37')]([_0x7fcb('0x38'),_0x7fcb('0x39')],_0x330f75[_0x7fcb('0x3a')])&&_0x330f75[_0x7fcb('0x3b')]&&!_0x330f75[_0x7fcb('0x3c')]){_0x3cd254[_0x330f75[_0x7fcb('0x3b')]['toLowerCase']()]=_0x330f75[_0x7fcb('0x3d')][_0x7fcb('0x2e')]();}else if(_[_0x7fcb('0x37')]([_0x7fcb('0x38'),_0x7fcb('0x39')],_0x330f75['type'])&&_0x330f75[_0x7fcb('0x3e')]&&_0x330f75[_0x7fcb('0x3c')]){_0x3cd254[_0x7fcb('0x3f')]['push']({'id':_0x330f75[_0x7fcb('0x3e')],'value':_0x330f75[_0x7fcb('0x3d')][_0x7fcb('0x2e')]()});}else if(_0x330f75[_0x7fcb('0x3a')]===_0x7fcb('0x40')&&_0x330f75[_0x7fcb('0x41')]&&_0x330f75[_0x7fcb('0x3e')]&&_0x330f75['customField']){_0x52ada[_0x330f75[_0x7fcb('0x41')]]&&_0x3cd254[_0x7fcb('0x3f')][_0x7fcb('0x42')]({'id':_0x330f75['idField'],'value':_0x52ada[_0x330f75[_0x7fcb('0x41')]]['toString']()});}else if(_0x330f75[_0x7fcb('0x3a')]===_0x7fcb('0x43')&&_0x330f75[_0x7fcb('0x44')]&&_0x330f75[_0x7fcb('0x44')][_0x7fcb('0xe')]&&_0x330f75[_0x7fcb('0x3e')]&&_0x330f75[_0x7fcb('0x3c')]){_0x52ada[_0x330f75[_0x7fcb('0x44')][_0x7fcb('0xe')][_0x7fcb('0x45')]()]&&_0x3cd254['custom_fields'][_0x7fcb('0x42')]({'id':_0x330f75[_0x7fcb('0x3e')],'value':_0x52ada[_0x330f75[_0x7fcb('0x44')]['name'][_0x7fcb('0x45')]()]['toString']()});}});}return _0x3cd254;}exports[_0x7fcb('0x46')]=function(_0x4ac5b9,_0x59e872,_0x254ea6,_0x459053,_0x392b01,_0x21659e){var _0x378ea4,_0x55894a;_0x21659e[_0x7fcb('0x18')]=intUtil[_0x7fcb('0x47')](_0x21659e[_0x7fcb('0x18')]);_0x21659e[_0x7fcb('0x48')]=intUtil[_0x7fcb('0x47')](_0x21659e[_0x7fcb('0x48')]);if(_0x392b01&&_0x392b01['monitor_format']){logger[_0x7fcb('0x13')]('[QUEUE]',_0x7fcb('0x49'));_0x59e872[_0x7fcb('0x4a')]=util[_0x7fcb('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21659e[_0x7fcb('0x48')],_0x59e872['uniqueid'],md5(_0x59e872[_0x7fcb('0x4b')]));}else{_0x59e872[_0x7fcb('0x4a')]='';}headers[_0x7fcb('0x4c')]=getAuth(_0x21659e);return getUser(_0x21659e,_0x459053[_0x7fcb('0x4d')])[_0x7fcb('0x1f')](function(_0x152c9a){_0x378ea4=_0x152c9a;logger[_0x7fcb('0x13')](_0x7fcb('0x4e'),_0x378ea4['id']);return getEndUser(_0x21659e,_0x59e872[_0x7fcb('0x4f')],_0x59e872[_0x7fcb('0x50')]);})[_0x7fcb('0x1f')](function(_0xabcb24){_0x55894a=_0xabcb24;logger['info'](_0x7fcb('0x51'),_0x55894a['id']);return getTicket(_0x21659e,_0x378ea4,_0x55894a,_0x254ea6,_0x59e872);})[_0x7fcb('0x1f')](function(_0x48344f){if(_0x48344f){logger[_0x7fcb('0x13')](_0x7fcb('0x52'),_0x48344f['id']);switch(_0x21659e[_0x7fcb('0x3a')]){case _0x7fcb('0x53'):logger[_0x7fcb('0x13')](_0x7fcb('0x54'),_0x7fcb('0x55'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x21659e[_0x7fcb('0x18')],_0x378ea4['id'],_0x48344f['id']),'method':'POST'});case _0x7fcb('0x56'):logger[_0x7fcb('0x13')](_0x7fcb('0x54'),_0x7fcb('0x57'));emit(util[_0x7fcb('0xa')](_0x7fcb('0x58'),_0x459053[_0x7fcb('0xe')]),_0x7fcb('0x59'),{'uri':util[_0x7fcb('0xa')](_0x7fcb('0x5a'),_0x21659e['remoteUri'][_0x7fcb('0x5b')]('/api/v2',''),_0x48344f['id'])});break;default:logger['error'](_0x7fcb('0x54'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7fcb('0x5c')](function(_0x177fe6){logger[_0x7fcb('0x5d')](_0x7fcb('0x5e'),util[_0x7fcb('0x5f')](_0x177fe6,{'showHidden':!![],'depth':null}));});};exports[_0x7fcb('0x60')]=function(_0x13ba87,_0x2c8180,_0x45a33a,_0x27f25e,_0x288e35,_0x1831de,_0x4e31c9){var _0x158dc3,_0x5b7146;_0x1831de[_0x7fcb('0x18')]=intUtil['stripTrailingSlash'](_0x1831de[_0x7fcb('0x18')]);_0x1831de[_0x7fcb('0x48')]=intUtil['stripTrailingSlash'](_0x1831de[_0x7fcb('0x48')]);if(_0x4e31c9&&_0x4e31c9[_0x7fcb('0x61')]&&_0x4e31c9[_0x7fcb('0x61')]!==_0x7fcb('0x62')){logger[_0x7fcb('0x13')](_0x7fcb('0x63'),_0x7fcb('0x49'));_0x2c8180[_0x7fcb('0x4a')]=util[_0x7fcb('0xa')](_0x7fcb('0x64'),_0x1831de[_0x7fcb('0x48')],_0x2c8180[_0x7fcb('0x4b')],md5(_0x2c8180[_0x7fcb('0x4b')]));}headers[_0x7fcb('0x4c')]=getAuth(_0x1831de);return getUser(_0x1831de,_0x27f25e[_0x7fcb('0x4d')])['then'](function(_0x1f0188){_0x158dc3=_0x1f0188;logger[_0x7fcb('0x13')](_0x7fcb('0x4e'),_0x158dc3['id']);return getEndUser(_0x1831de,_0x2c8180['destcalleridname'],_0x2c8180[_0x7fcb('0x65')]);})[_0x7fcb('0x1f')](function(_0xb9415f){_0x5b7146=_0xb9415f;logger[_0x7fcb('0x13')](_0x7fcb('0x51'),_0x5b7146['id']);return getTicket(_0x1831de,_0x158dc3,_0x5b7146,_0x45a33a,_0x2c8180);})[_0x7fcb('0x1f')](function(_0x520f92){if(_0x520f92){logger[_0x7fcb('0x13')](_0x7fcb('0x52'),_0x520f92['id']);switch(_0x1831de[_0x7fcb('0x3a')]){case _0x7fcb('0x53'):logger[_0x7fcb('0x13')](_0x7fcb('0x63'),_0x7fcb('0x55'));return request({'uri':util[_0x7fcb('0xa')](_0x7fcb('0x66'),_0x1831de[_0x7fcb('0x18')],_0x158dc3['id'],_0x520f92['id']),'method':_0x7fcb('0xc')});case'newTab':logger[_0x7fcb('0x13')](_0x7fcb('0x63'),_0x7fcb('0x57'));emit(util[_0x7fcb('0xa')](_0x7fcb('0x58'),_0x27f25e[_0x7fcb('0xe')]),_0x7fcb('0x59'),{'uri':util[_0x7fcb('0xa')](_0x7fcb('0x5a'),_0x1831de['remoteUri'][_0x7fcb('0x5b')](_0x7fcb('0x67'),''),_0x520f92['id'])});break;default:logger[_0x7fcb('0x5d')](_0x7fcb('0x63'),_0x7fcb('0x68'));}}})[_0x7fcb('0x5c')](function(_0x10f919){logger[_0x7fcb('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7fcb('0x5f')](_0x10f919,{'showHidden':!![],'depth':null}));});};exports[_0x7fcb('0x69')]=function(_0x9080cf,_0xeccb05,_0x17c555,_0x4dbd4b,_0x14764b,_0x18ccca){var _0x51db09,_0x4a6f25;_0x18ccca[_0x7fcb('0x18')]=intUtil[_0x7fcb('0x47')](_0x18ccca[_0x7fcb('0x18')]);_0x18ccca[_0x7fcb('0x48')]=intUtil[_0x7fcb('0x47')](_0x18ccca[_0x7fcb('0x48')]);if(_0x14764b&&_0x14764b[_0x7fcb('0x6a')]){logger['info']('['+_0xeccb05[_0x7fcb('0x6b')][_0x7fcb('0x6c')]()+']',_0x7fcb('0x49'));_0xeccb05[_0x7fcb('0x4a')]=util['format'](_0x7fcb('0x64'),_0x18ccca['serverUrl'],_0xeccb05[_0x7fcb('0x4b')],md5(_0xeccb05['uniqueid']));}else{_0xeccb05['recordingURL']='';}headers['Authorization']=getAuth(_0x18ccca);return getUser(_0x18ccca)[_0x7fcb('0x1f')](function(_0x26b18f){_0x51db09=_0x26b18f;logger[_0x7fcb('0x13')](_0x7fcb('0x4e'),_0x51db09['id']);return getEndUser(_0x18ccca,_0xeccb05['calleridname'],_0xeccb05['calleridnum']);})['then'](function(_0x5d34a1){_0x4a6f25=_0x5d34a1;logger[_0x7fcb('0x13')]('The\x20Enduser\x20ID\x20is:',_0x4a6f25['id']);return getTicket(_0x18ccca,_0x51db09,_0x4a6f25,_0x17c555,_0xeccb05);})[_0x7fcb('0x1f')](function(_0x7fdd2a){if(_0x7fdd2a){logger[_0x7fcb('0x13')](_0x7fcb('0x52'),_0x7fdd2a['id']);}})['catch'](function(_0x19cbec){logger[_0x7fcb('0x5d')]('['+_0xeccb05[_0x7fcb('0x6b')][_0x7fcb('0x6c')]()+']'+_0x7fcb('0x6d'),util[_0x7fcb('0x5f')](_0x19cbec,{'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 9f9b71b..390e2b1 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 _0x42bd=['Full_Name','First_Name','Last_Name','Leads','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','format','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','recordingURL','email','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','md5','util','./util','moment','ioredis','bluebird','redis','localhost','socket.io-emitter','emit','debug','stringify','forEach','string','picklist','type','content','toString','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x42bd,0xd9));var _0xd42b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x42bd[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xd42b('0x0'));var util=require(_0xd42b('0x1'));var intUtil=require(_0xd42b('0x2'));var moment=require(_0xd42b('0x3'));var Redis=require(_0xd42b('0x4'));var BPromise=require(_0xd42b('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0xd42b('0x6')]=_['defaults'](config[_0xd42b('0x6')],{'host':_0xd42b('0x7'),'port':0x18eb});var io=require(_0xd42b('0x8'))(new Redis(config[_0xd42b('0x6')]));function emit(_0x135898,_0x343d09,_0x4e7373){io['to'](_0x135898)[_0xd42b('0x9')](_0x343d09,_0x4e7373);}function request(_0xf1943f){logger[_0xd42b('0xa')]('[HTTP]',JSON[_0xd42b('0xb')](_0xf1943f));return rp(_0xf1943f);}function getCustomFields(_0x9cc65e,_0x38a933){var _0x50dd59={};if(_0x9cc65e['length']>0x0){_[_0xd42b('0xc')](_0x9cc65e,function(_0x5288bf){if(_['includes']([_0xd42b('0xd'),_0xd42b('0xe')],_0x5288bf[_0xd42b('0xf')])&&_0x5288bf['idField']){_0x50dd59[_0x5288bf['idField']]=_0x5288bf[_0xd42b('0x10')][_0xd42b('0x11')]();}else if(_0x5288bf['type']==='variable'&&_0x5288bf[_0xd42b('0x12')]&&_0x5288bf[_0xd42b('0x13')]&&_0x38a933[_0x5288bf['variableName']]){_0x50dd59[_0x5288bf['idField']]=_0x38a933[_0x5288bf[_0xd42b('0x12')]][_0xd42b('0x11')]();}else if(_0x5288bf[_0xd42b('0xf')]===_0xd42b('0x14')&&_0x5288bf[_0xd42b('0x15')]&&_0x5288bf[_0xd42b('0x15')][_0xd42b('0x16')]&&_0x5288bf[_0xd42b('0x13')]&&_0x38a933[_0x5288bf['Variable'][_0xd42b('0x16')]['toLowerCase']()]){_0x50dd59[_0x5288bf[_0xd42b('0x13')]]=_0x38a933[_0x5288bf[_0xd42b('0x15')][_0xd42b('0x16')][_0xd42b('0x17')]()][_0xd42b('0x11')]();}});}return _0x50dd59;}function getName(_0x246c67){if(_0x246c67[_0xd42b('0x18')]('\x20')>0x0){var _0x133ff5=_0x246c67[_0xd42b('0x19')](/ (.+)/);if(_0x133ff5[0x1]){return _0x133ff5;}}return[_0x246c67,_0x246c67];}var accountsTokens={};function getAccessToken(_0x4295d0){return new Promise(function(_0x150b53,_0x4e8320){if(!_[_0xd42b('0x1a')](accountsTokens[_0x4295d0['id']])&&!_[_0xd42b('0x1a')](accountsTokens[_0x4295d0['id']][_0xd42b('0x1b')])){if(moment()[_0xd42b('0x1c')](accountsTokens[_0x4295d0['id']][_0xd42b('0x1d')])){_0x150b53(accountsTokens[_0x4295d0['id']][_0xd42b('0x1b')]);}}var _0x46e55f;switch(_0x4295d0[_0xd42b('0x1e')]){case'US':_0x46e55f=_0xd42b('0x1f');break;case'AU':_0x46e55f=_0xd42b('0x20');break;case'EU':_0x46e55f=_0xd42b('0x21');break;case'IN':_0x46e55f=_0xd42b('0x22');break;case'CN':_0x46e55f=_0xd42b('0x23');break;default:_0x46e55f='https://accounts.zoho.eu';break;}var _0x5c8bda={'method':_0xd42b('0x24'),'uri':_0x46e55f+_0xd42b('0x25'),'qs':{'refresh_token':_0x4295d0['refreshToken'],'client_id':_0x4295d0[_0xd42b('0x26')],'client_secret':_0x4295d0[_0xd42b('0x27')],'grant_type':_0xd42b('0x28')},'json':!![]};return rp(_0x5c8bda)[_0xd42b('0x29')](function(_0xc78cc){accountsTokens[_0x4295d0['id']]={'access_token':_0xc78cc[_0xd42b('0x1b')],'expires_in':moment()[_0xd42b('0x2a')](_0xc78cc['expires_in'],_0xd42b('0x2b'))};_0x150b53(_0xc78cc[_0xd42b('0x1b')]);})[_0xd42b('0x2c')](function(_0x4d57c7){logger['error'](_0xd42b('0x2d'),_0x4d57c7[_0xd42b('0x2e')]);_0x4e8320(_0x4d57c7);});});}function getUser(_0x38197f,_0x37c09a,_0x39a452,_0x57b480){logger[_0xd42b('0x2f')](_0xd42b('0x30'));return request({'method':_0xd42b('0x31'),'uri':util['format'](_0xd42b('0x32'),_0x37c09a),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xd42b('0x33')+_0x38197f},'json':!![]})[_0xd42b('0x29')](function(_0x4d09b3){if(_0x4d09b3[_0xd42b('0x34')]){var _0x5d666b=-0x1;if(_[_0xd42b('0x35')](_0x4d09b3[_0xd42b('0x34')])){if(!_[_0xd42b('0x1a')](_0x57b480)){_0x5d666b=_[_0xd42b('0x36')](_0x4d09b3[_0xd42b('0x34')],function(_0x28e9a9){return _0x28e9a9['email']===_0x57b480;});}if(_0x5d666b>=0x0){logger['info'](_0xd42b('0x37'));}else{logger[_0xd42b('0x2f')]('Using\x20the\x20admin\x20account!');_0x5d666b=_['findIndex'](_0x4d09b3[_0xd42b('0x34')],function(_0x3185a2){return _0x3185a2[_0xd42b('0x38')][_0xd42b('0x16')]===_0xd42b('0x39');});}return _0x4d09b3[_0xd42b('0x34')][_0x5d666b];}else{if(_0x4d09b3[_0xd42b('0x3a')][_0xd42b('0x38')]['name']===_0xd42b('0x39')){logger[_0xd42b('0x2f')](_0xd42b('0x3b'));user=_0x4d09b3[_0xd42b('0x3a')];return user;}else{logger['error'](_0xd42b('0x3c'),JSON[_0xd42b('0xb')](_0x4d09b3));throw new Error(_0xd42b('0x3d')+JSON[_0xd42b('0xb')](_0x4d09b3));}}}else{logger[_0xd42b('0x3e')](_0xd42b('0x3c'),JSON[_0xd42b('0xb')](_0x4d09b3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd42b('0xb')](_0x4d09b3));}})[_0xd42b('0x2c')](function(_0x378bd8){console[_0xd42b('0x3e')](_0x378bd8);});}function getZohoUser(_0x33e57a,_0xd81e2a){return new BPromise(function(_0x11f9d2,_0x2f9718){request(_0x33e57a)[_0xd42b('0x29')](function(_0x2ec9b5){var _0x32e0c2=null;if(_0x2ec9b5){_0x32e0c2=_0x2ec9b5[_0xd42b('0x3f')][0x0];_0x32e0c2[_0xd42b('0x40')]=_0xd81e2a;}_0x11f9d2(_0x32e0c2);})['catch'](function(_0x3542ac){_0x2f9718(_0x3542ac);});});}function createEndUser(_0x2baa19,_0x903579,_0x411bbe,_0x5a6ebc,_0x1e01e3,_0x122d42){var _0x411bbe=getName(_0x411bbe);return request({'method':_0xd42b('0x24'),'uri':_0xd42b('0x41')+_0x903579+'/crm/v2/'+_[_0xd42b('0x42')](_0x122d42[_0xd42b('0x43')])+'s','body':{'data':[{'Last_Name':_0x411bbe[0x1],'First_Name':_0x411bbe[0x0],'Phone':_0x5a6ebc,'Owner':{'name':!_[_0xd42b('0x1a')](_0x1e01e3[_0xd42b('0x44')]['name'])?_0x1e01e3[_0xd42b('0x44')][_0xd42b('0x16')]:!_[_0xd42b('0x1a')](_0x1e01e3['first_name'])?_0x1e01e3[_0xd42b('0x45')]+'\x20'+_0x1e01e3[_0xd42b('0x46')]:_0x1e01e3['last_name'],'id':_0x1e01e3['id']}}]},'headers':{'Authorization':_0xd42b('0x33')+_0x2baa19},'json':!![]})[_0xd42b('0x29')](function(_0x176849){if(_0x176849&&_0x176849[_0xd42b('0x3f')][0x0][_0xd42b('0x47')]==='SUCCESS'){var _0x53e8ba=_0x176849[_0xd42b('0x3f')][0x0][_0xd42b('0x48')];_0x53e8ba[_0xd42b('0x40')]=_['startCase'](_0x122d42['moduleCreate'])+'s';return _0x53e8ba;}logger[_0xd42b('0x3e')](_0xd42b('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xd42b('0xb')](data));})['catch'](function(_0x432f78){console[_0xd42b('0x49')](_0xd42b('0x4a'),_0x432f78);});}function getEndUser(_0x95271a,_0x2cf1d6,_0x55e2fb,_0x399b75,_0x2db88c,_0x255065,_0x2b4665){var _0x39d304={'method':_0xd42b('0x31'),'uri':'','headers':{'Authorization':_0xd42b('0x33')+_0x95271a},'json':!![]};switch(_0x2b4665[_0xd42b('0x4b')]){case'contact_lead':_0x39d304[_0xd42b('0x4c')]=_0xd42b('0x41')+_0x2cf1d6+_0xd42b('0x4d')+_0x2db88c+'))';return getZohoUser(_0x39d304,'Contacts')[_0xd42b('0x29')](function(_0x4ffaba){if(_0x4ffaba)return _0x4ffaba;_0x39d304[_0xd42b('0x4c')]='https://www.zohoapis.'+_0x2cf1d6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2db88c+'))';return getZohoUser(_0x39d304,'Leads')[_0xd42b('0x29')](function(_0x17b3e2){if(_0x17b3e2)return _0x17b3e2;if(_0x2b4665[_0xd42b('0x43')]!=_0xd42b('0x4e')){return createEndUser(_0x95271a,_0x2cf1d6,_0x399b75,_0x2db88c,_0x255065,_0x2b4665);}else{return{};}});});break;case _0xd42b('0x4f'):_0x39d304[_0xd42b('0x4c')]=_0xd42b('0x41')+_0x2cf1d6+_0xd42b('0x4d')+_0x2db88c+'))';return getZohoUser(_0x39d304,_0xd42b('0x50'))[_0xd42b('0x29')](function(_0x102e8b){if(_0x102e8b)return _0x102e8b;if(_0x2b4665[_0xd42b('0x43')]!='nothing'){return createEndUser(_0x95271a,_0x2cf1d6,_0x399b75,_0x2db88c,_0x255065,_0x2b4665);}else{return{};}});break;case _0xd42b('0x51'):_0x39d304[_0xd42b('0x4c')]=_0xd42b('0x41')+_0x2cf1d6+_0xd42b('0x52')+_0x2db88c+'))';return getZohoUser(_0x39d304,'Leads')[_0xd42b('0x29')](function(_0x29b14b){if(_0x29b14b)return _0x29b14b;if(_0x2b4665['moduleCreate']!=_0xd42b('0x4e')){return createEndUser(_0x95271a,_0x2cf1d6,_0x399b75,_0x2db88c,_0x255065,_0x2b4665);}else{return{};}});break;}}function getCall(_0x5f1514,_0x2d6e14,_0x4c9c94,_0x513623,_0x239b8a,_0x56a170,_0x3ee30d,_0x148bb5){logger[_0xd42b('0x2f')]('Creating\x20new\x20call...');var _0x583bca={};_0x583bca[_0xd42b('0x53')]={'name':!_[_0xd42b('0x1a')](_0x513623[_0xd42b('0x44')][_0xd42b('0x16')])&&!_[_0xd42b('0x1a')](_0x513623[_0xd42b('0x38')][_0xd42b('0x16')])&&_0x513623[_0xd42b('0x38')][_0xd42b('0x16')]===_0xd42b('0x54')?_0x513623[_0xd42b('0x44')]['name']:!_[_0xd42b('0x1a')](_0x513623['first_name'])?_0x513623[_0xd42b('0x45')]+'\x20'+_0x513623['last_name']:_0x513623[_0xd42b('0x46')],'id':_0x513623['id']};_0x583bca[_0xd42b('0x55')]=intUtil[_0xd42b('0x56')](_0x56a170[_0xd42b('0x57')],_0x3ee30d,'\x20');_0x583bca[_0xd42b('0x58')]=intUtil[_0xd42b('0x56')](_0x56a170[_0xd42b('0x59')],_0x3ee30d,'\x0a');if(_0x239b8a[_0xd42b('0x40')]===_0xd42b('0x50')){_0x583bca[_0xd42b('0x5a')]={'name':!_['isNil'](_0x239b8a[_0xd42b('0x5b')])?_0x239b8a[_0xd42b('0x5b')]:!_['isNil'](_0x239b8a[_0xd42b('0x5c')])?_0x239b8a['First_Name']+'\x20'+_0x239b8a['Last_Name']:_0x239b8a[_0xd42b('0x5d')],'id':_0x239b8a['id']};}if(_0x239b8a[_0xd42b('0x40')]===_0xd42b('0x5e')){_0x583bca[_0xd42b('0x5f')]={'name':!_[_0xd42b('0x1a')](_0x239b8a[_0xd42b('0x5b')])?_0x239b8a['Full_Name']:!_['isNil'](_0x239b8a[_0xd42b('0x5c')])?_0x239b8a[_0xd42b('0x5c')]+'\x20'+_0x239b8a['Last_Name']:_0x239b8a['Last_Name'],'id':_0x239b8a['id']};_0x583bca['$se_module']=_['startCase'](_0x239b8a[_0xd42b('0x40')]);}if(_0x3ee30d[_0xd42b('0x60')]){_0x583bca[_0xd42b('0x61')]=moment[_0xd42b('0x62')](parseInt(_0x3ee30d[_0xd42b('0x60')])*0x3e8)['format'](_0xd42b('0x63'));}else if(_0x3ee30d['answertime']&&_0x3ee30d[_0xd42b('0x64')]){_0x583bca[_0xd42b('0x61')]=moment[_0xd42b('0x62')](moment(_0x3ee30d[_0xd42b('0x64')],_0xd42b('0x65'))['diff'](moment(_0x3ee30d[_0xd42b('0x66')],_0xd42b('0x65'))))[_0xd42b('0x67')](_0xd42b('0x63'));}switch(_0x3ee30d[_0xd42b('0x68')]){case _0xd42b('0x69'):_0x583bca['Call_Result']=_0xd42b('0x6a');break;case _0xd42b('0x6b'):case _0xd42b('0x6c'):_0x583bca[_0xd42b('0x6d')]=_0xd42b('0x6e');break;case _0xd42b('0x6f'):_0x583bca[_0xd42b('0x6d')]=_0xd42b('0x70');break;case _0xd42b('0x71'):_0x583bca[_0xd42b('0x6d')]=_0xd42b('0x72');break;case _0xd42b('0x73'):_0x583bca['Call_Result']=_0xd42b('0x74');default:}_0x583bca['Call_Start_Time']=(_0x148bb5===_0xd42b('0x75')?moment(_0x3ee30d[_0xd42b('0x66')])[_0xd42b('0x67')](_0xd42b('0x65')):moment(_0x3ee30d['agentcalledAt'])[_0xd42b('0x67')](_0xd42b('0x65')))||moment()[_0xd42b('0x67')](_0xd42b('0x65'));_0x583bca[_0xd42b('0x76')]=_0x148bb5||_0xd42b('0x77');_0x583bca=_[_0xd42b('0x78')](_0x583bca,getCustomFields(_0x56a170[_0xd42b('0x79')],_0x3ee30d));return request({'method':_0xd42b('0x24'),'uri':_0xd42b('0x41')+_0x2d6e14+_0xd42b('0x7a'),'headers':{'Authorization':_0xd42b('0x33')+_0x5f1514},'body':{'data':[_0x583bca]},'json':!![]})[_0xd42b('0x29')](function(_0x46aa4e){if(_0x46aa4e&&_0x46aa4e[_0xd42b('0x3f')][0x0]['code']===_0xd42b('0x7b')){logger[_0xd42b('0x2f')](_0xd42b('0x7c'));return{'id':_0x46aa4e['data'][0x0][_0xd42b('0x48')]['id']};}})[_0xd42b('0x2c')](function(_0xb95564){logger[_0xd42b('0x2f')](_0xd42b('0x7d'),_0xb95564[_0xd42b('0x2e')]);console[_0xd42b('0x49')](_0xd42b('0x7d'),_0xb95564);});}exports[_0xd42b('0x7e')]=function(_0x422457,_0x558ec0,_0x1fcea8,_0x50993f,_0x5ca193,_0x10ce51){var _0x292399,_0x5b625d,_0x44b560;_0x10ce51['host']=intUtil['stripTrailingSlash'](_0x10ce51[_0xd42b('0x7f')]);_0x10ce51['serverUrl']=intUtil['stripTrailingSlash'](_0x10ce51[_0xd42b('0x80')]);if(_0x5ca193&&_0x5ca193[_0xd42b('0x81')]){logger[_0xd42b('0x2f')](_0xd42b('0x82'),_0xd42b('0x83'));_0x558ec0['recordingURL']=_0x10ce51[_0xd42b('0x80')]+_0xd42b('0x84')+_0x558ec0['uniqueid']+_0xd42b('0x85')+md5(_0x558ec0[_0xd42b('0x86')]);}else{_0x558ec0['recordingURL']='';}var _0x22c2f4=_0x10ce51[_0xd42b('0x7f')]===_0xd42b('0x87')?'eu':_0xd42b('0x88');return getAccessToken(_0x10ce51)[_0xd42b('0x29')](function(_0x5a109e){_0x44b560=_0x5a109e;return getUser(_0x44b560,_0x22c2f4,_0x10ce51,_0x50993f['email']);})[_0xd42b('0x29')](function(_0x5f22d9){_0x292399=_0x5f22d9;logger['info'](_0xd42b('0x89'),_0x292399['id']);return getEndUser(_0x44b560,_0x22c2f4,_0x10ce51,_0x558ec0['calleridname'],_0x558ec0[_0xd42b('0x8a')],_0x292399,_0x1fcea8);})['then'](function(_0x701398){_0x5b625d=_0x701398;return getCall(_0x44b560,_0x22c2f4,_0x10ce51,_0x292399,_0x5b625d,_0x1fcea8,_0x558ec0,_0xd42b('0x77'));})[_0xd42b('0x29')](function(_0x40e6ab){if(_0x40e6ab){logger[_0xd42b('0x2f')]('The\x20Call\x20ID\x20is:',_0x40e6ab['id']);logger[_0xd42b('0x2f')](_0xd42b('0x82'),_0xd42b('0x8b'));emit(util[_0xd42b('0x67')](_0xd42b('0x8c'),_0x50993f[_0xd42b('0x16')]),_0xd42b('0x8d'),{'uri':'https://crm.'+_0x10ce51[_0xd42b('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x40e6ab['id']});}})[_0xd42b('0x2c')](function(_0x51accf){logger[_0xd42b('0x3e')](_0xd42b('0x82'),JSON[_0xd42b('0xb')](_0x51accf));});};exports[_0xd42b('0x75')]=function(_0x556d57,_0xd88bc,_0x54bfbb,_0x167d40,_0x55c1eb,_0x302cfe,_0x33c9be){var _0x2b6c80,_0x1d11b0,_0x3c7f8f;_0x302cfe['host']=intUtil[_0xd42b('0x8e')](_0x302cfe['host']);_0x302cfe[_0xd42b('0x80')]=intUtil[_0xd42b('0x8e')](_0x302cfe['serverUrl']);if(_0x33c9be&&_0x33c9be[_0xd42b('0x8f')]&&_0x33c9be['recordingFormat']!==_0xd42b('0x90')){logger[_0xd42b('0x2f')](_0xd42b('0x91'),_0xd42b('0x83'));_0xd88bc[_0xd42b('0x92')]=_0x302cfe['serverUrl']+_0xd42b('0x84')+_0xd88bc[_0xd42b('0x86')]+_0xd42b('0x85')+md5(_0xd88bc[_0xd42b('0x86')]);}var _0x4bea2b=_0x302cfe[_0xd42b('0x7f')]===_0xd42b('0x87')?'eu':'com';return getAccessToken(_0x302cfe)[_0xd42b('0x29')](function(_0x2766c8){_0x3c7f8f=_0x2766c8;return getUser(_0x3c7f8f,_0x4bea2b,_0x302cfe,_0x167d40[_0xd42b('0x93')]);})[_0xd42b('0x29')](function(_0x2d5db0){_0x2b6c80=_0x2d5db0;logger[_0xd42b('0x2f')](_0xd42b('0x89'),_0x2b6c80['id']);return getEndUser(_0x3c7f8f,_0x4bea2b,_0x302cfe,_0xd88bc[_0xd42b('0x94')],_0xd88bc[_0xd42b('0x95')],_0x2b6c80,_0x54bfbb);})[_0xd42b('0x29')](function(_0x36ad20){_0x1d11b0=_0x36ad20;return getCall(_0x3c7f8f,_0x4bea2b,_0x302cfe,_0x2b6c80,_0x1d11b0,_0x54bfbb,_0xd88bc,'Outbound');})[_0xd42b('0x29')](function(_0x1cc2d4){if(_0x1cc2d4){logger['info'](_0xd42b('0x96'),_0x1cc2d4['id']);logger[_0xd42b('0x2f')](_0xd42b('0x91'),_0xd42b('0x8b'));emit(util[_0xd42b('0x67')](_0xd42b('0x8c'),_0x167d40[_0xd42b('0x16')]),_0xd42b('0x8d'),{'uri':'https://crm.'+_0x302cfe[_0xd42b('0x7f')]+_0xd42b('0x97')+_0x1cc2d4['id']});}})[_0xd42b('0x2c')](function(_0xce199f){logger['error'](_0xd42b('0x91'),JSON[_0xd42b('0xb')](_0xce199f));});};exports[_0xd42b('0x98')]=function(_0x10ff6f,_0xcb93c3,_0x1c6153,_0x3943d3,_0x275b50,_0x2a427a){var _0x12627f,_0x3ffa47,_0x54294b;_0x2a427a[_0xd42b('0x7f')]=intUtil[_0xd42b('0x8e')](_0x2a427a[_0xd42b('0x7f')]);_0x2a427a['serverUrl']=intUtil['stripTrailingSlash'](_0x2a427a[_0xd42b('0x80')]);if(_0x275b50&&_0x275b50[_0xd42b('0x81')]){logger['info']('['+_0xcb93c3['lastevent'][_0xd42b('0x99')]()+']',_0xd42b('0x83'));_0xcb93c3['recordingURL']=_0x2a427a[_0xd42b('0x80')]+_0xd42b('0x84')+_0xcb93c3['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0xcb93c3['uniqueid']);}else{_0xcb93c3[_0xd42b('0x92')]='';}var _0x5e1fa5=_0x2a427a[_0xd42b('0x7f')]===_0xd42b('0x87')?'eu':_0xd42b('0x88');return getAccessToken(_0x2a427a)[_0xd42b('0x29')](function(_0x2cd5ab){_0x54294b=_0x2cd5ab;return getUser(_0x54294b,_0x5e1fa5,_0x2a427a);})[_0xd42b('0x29')](function(_0x194620){_0x12627f=_0x194620;logger['info']('The\x20User\x20ID\x20is:',_0x12627f['id']);return getEndUser(_0x54294b,_0x5e1fa5,_0x2a427a,_0xcb93c3['calleridname'],_0xcb93c3['calleridnum'],_0x12627f,_0x1c6153);})[_0xd42b('0x29')](function(_0xa63fb0){_0x3ffa47=_0xa63fb0;return getCall(_0x54294b,_0x5e1fa5,_0x2a427a,_0x12627f,_0x3ffa47,_0x1c6153,_0xcb93c3,_0xd42b('0x77'));})[_0xd42b('0x29')](function(_0x302871){if(_0x302871){logger['info'](_0xd42b('0x96'),_0x302871['id']);}})[_0xd42b('0x2c')](function(_0x45d8a4){logger[_0xd42b('0x3e')]('['+_0xcb93c3['lastevent'][_0xd42b('0x99')]()+']',JSON[_0xd42b('0xb')](_0x45d8a4));});}; \ No newline at end of file +var _0x9809=['zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','monitor_format','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','https://accounts.zoho.com','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','getString','Descriptions','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','rejected','Rejected','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stripTrailingSlash','host','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token='];(function(_0x1081e1,_0x3682a8){var _0x30d627=function(_0x2c2bd8){while(--_0x2c2bd8){_0x1081e1['push'](_0x1081e1['shift']());}};_0x30d627(++_0x3682a8);}(_0x9809,0x1da));var _0x9980=function(_0x1395be,_0x4f9480){_0x1395be=_0x1395be-0x0;var _0x286520=_0x9809[_0x1395be];return _0x286520;};'use strict';var _=require(_0x9980('0x0'));var rp=require(_0x9980('0x1'));var md5=require(_0x9980('0x2'));var util=require(_0x9980('0x3'));var intUtil=require(_0x9980('0x4'));var moment=require(_0x9980('0x5'));var Redis=require(_0x9980('0x6'));var BPromise=require(_0x9980('0x7'));var config=require(_0x9980('0x8'));var logger=require(_0x9980('0x9'))(_0x9980('0xa'));config['redis']=_[_0x9980('0xb')](config[_0x9980('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x9980('0xd'))(new Redis(config['redis']));function emit(_0x283d1f,_0x333a73,_0x4d545d){io['to'](_0x283d1f)[_0x9980('0xe')](_0x333a73,_0x4d545d);}function request(_0x2553c0){logger[_0x9980('0xf')](_0x9980('0x10'),JSON[_0x9980('0x11')](_0x2553c0));return rp(_0x2553c0);}function getCustomFields(_0x3b118c,_0x119f9c){var _0x17183e={};if(_0x3b118c[_0x9980('0x12')]>0x0){_[_0x9980('0x13')](_0x3b118c,function(_0x163fe3){if(_['includes']([_0x9980('0x14'),_0x9980('0x15')],_0x163fe3[_0x9980('0x16')])&&_0x163fe3['idField']){_0x17183e[_0x163fe3[_0x9980('0x17')]]=_0x163fe3[_0x9980('0x18')][_0x9980('0x19')]();}else if(_0x163fe3[_0x9980('0x16')]===_0x9980('0x1a')&&_0x163fe3[_0x9980('0x1b')]&&_0x163fe3['idField']&&_0x119f9c[_0x163fe3['variableName']]){_0x17183e[_0x163fe3[_0x9980('0x17')]]=_0x119f9c[_0x163fe3[_0x9980('0x1b')]][_0x9980('0x19')]();}else if(_0x163fe3[_0x9980('0x16')]===_0x9980('0x1c')&&_0x163fe3['Variable']&&_0x163fe3[_0x9980('0x1d')]['name']&&_0x163fe3[_0x9980('0x17')]&&_0x119f9c[_0x163fe3[_0x9980('0x1d')][_0x9980('0x1e')][_0x9980('0x1f')]()]){_0x17183e[_0x163fe3[_0x9980('0x17')]]=_0x119f9c[_0x163fe3[_0x9980('0x1d')][_0x9980('0x1e')]['toLowerCase']()]['toString']();}});}return _0x17183e;}function getName(_0x32a7c3){if(_0x32a7c3[_0x9980('0x20')]('\x20')>0x0){var _0x59b7a1=_0x32a7c3[_0x9980('0x21')](/ (.+)/);if(_0x59b7a1[0x1]){return _0x59b7a1;}}return[_0x32a7c3,_0x32a7c3];}var accountsTokens={};function getAccessToken(_0x2ef81b){return new Promise(function(_0x34d68c,_0x2a39cc){if(!_['isNil'](accountsTokens[_0x2ef81b['id']])&&!_[_0x9980('0x22')](accountsTokens[_0x2ef81b['id']][_0x9980('0x23')])){if(moment()['isBefore'](accountsTokens[_0x2ef81b['id']]['expires_in'])){_0x34d68c(accountsTokens[_0x2ef81b['id']]['access_token']);}}var _0x4c499f;switch(_0x2ef81b['zone']){case'US':_0x4c499f=_0x9980('0x24');break;case'AU':_0x4c499f='https://accounts.zoho.com.au';break;case'EU':_0x4c499f='https://accounts.zoho.eu';break;case'IN':_0x4c499f='https://accounts.zoho.in';break;case'CN':_0x4c499f='https://accounts.zoho.com.cn';break;default:_0x4c499f=_0x9980('0x25');break;}var _0xab31f8={'method':_0x9980('0x26'),'uri':_0x4c499f+'/oauth/v2/token','qs':{'refresh_token':_0x2ef81b[_0x9980('0x27')],'client_id':_0x2ef81b[_0x9980('0x28')],'client_secret':_0x2ef81b[_0x9980('0x29')],'grant_type':_0x9980('0x2a')},'json':!![]};return rp(_0xab31f8)[_0x9980('0x2b')](function(_0x432d9d){accountsTokens[_0x2ef81b['id']]={'access_token':_0x432d9d[_0x9980('0x23')],'expires_in':moment()[_0x9980('0x2c')](_0x432d9d[_0x9980('0x2d')],_0x9980('0x2e'))};_0x34d68c(_0x432d9d[_0x9980('0x23')]);})[_0x9980('0x2f')](function(_0x1a4534){logger[_0x9980('0x30')](_0x9980('0x31'),_0x1a4534[_0x9980('0x32')]);_0x2a39cc(_0x1a4534);});});}function getUser(_0x24ef6e,_0x56457a,_0x520e13,_0x1bc53c){logger[_0x9980('0x33')](_0x9980('0x34'));return request({'method':_0x9980('0x35'),'uri':util[_0x9980('0x36')]('https://www.zohoapis.%s/crm/v2/users',_0x56457a),'qs':{'type':_0x9980('0x37')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x24ef6e},'json':!![]})[_0x9980('0x2b')](function(_0x21ed7b){if(_0x21ed7b['users']){var _0x404a46=-0x1;if(_[_0x9980('0x38')](_0x21ed7b[_0x9980('0x39')])){if(!_[_0x9980('0x22')](_0x1bc53c)){_0x404a46=_[_0x9980('0x3a')](_0x21ed7b[_0x9980('0x39')],function(_0x231cb0){return _0x231cb0[_0x9980('0x3b')]===_0x1bc53c;});}if(_0x404a46>=0x0){logger[_0x9980('0x33')](_0x9980('0x3c'));}else{logger[_0x9980('0x33')](_0x9980('0x3d'));_0x404a46=_['findIndex'](_0x21ed7b['users'],function(_0x218f6d){return _0x218f6d[_0x9980('0x3e')][_0x9980('0x1e')]===_0x9980('0x3f');});}return _0x21ed7b[_0x9980('0x39')][_0x404a46];}else{if(_0x21ed7b['user'][_0x9980('0x3e')][_0x9980('0x1e')]===_0x9980('0x3f')){logger[_0x9980('0x33')](_0x9980('0x3d'));user=_0x21ed7b['user'];return user;}else{logger['error'](_0x9980('0x40'),JSON['stringify'](_0x21ed7b));throw new Error(_0x9980('0x41')+JSON[_0x9980('0x11')](_0x21ed7b));}}}else{logger[_0x9980('0x30')](_0x9980('0x40'),JSON[_0x9980('0x11')](_0x21ed7b));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x9980('0x11')](_0x21ed7b));}})[_0x9980('0x2f')](function(_0x6bb4ed){console[_0x9980('0x30')](_0x6bb4ed);});}function getZohoUser(_0x3d39be,_0x1bbb23){return new BPromise(function(_0x301c4c,_0x14fa5d){request(_0x3d39be)[_0x9980('0x2b')](function(_0x327f70){var _0x9f3094=null;if(_0x327f70){_0x9f3094=_0x327f70[_0x9980('0x42')][0x0];_0x9f3094[_0x9980('0x43')]=_0x1bbb23;}_0x301c4c(_0x9f3094);})[_0x9980('0x2f')](function(_0x327d84){_0x14fa5d(_0x327d84);});});}function createEndUser(_0x5ec069,_0x33718c,_0x4c8ce5,_0x381455,_0x1778fc,_0x15e4d4){var _0x4c8ce5=getName(_0x4c8ce5);return request({'method':_0x9980('0x26'),'uri':_0x9980('0x44')+_0x33718c+_0x9980('0x45')+_[_0x9980('0x46')](_0x15e4d4['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4c8ce5[0x1],'First_Name':_0x4c8ce5[0x0],'Phone':_0x381455,'Owner':{'name':!_[_0x9980('0x22')](_0x1778fc[_0x9980('0x47')][_0x9980('0x1e')])?_0x1778fc[_0x9980('0x47')][_0x9980('0x1e')]:!_[_0x9980('0x22')](_0x1778fc[_0x9980('0x48')])?_0x1778fc[_0x9980('0x48')]+'\x20'+_0x1778fc[_0x9980('0x49')]:_0x1778fc[_0x9980('0x49')],'id':_0x1778fc['id']}}]},'headers':{'Authorization':_0x9980('0x4a')+_0x5ec069},'json':!![]})[_0x9980('0x2b')](function(_0xb63a96){if(_0xb63a96&&_0xb63a96[_0x9980('0x42')][0x0][_0x9980('0x4b')]===_0x9980('0x4c')){var _0x3fe0bd=_0xb63a96[_0x9980('0x42')][0x0][_0x9980('0x4d')];_0x3fe0bd[_0x9980('0x43')]=_[_0x9980('0x46')](_0x15e4d4[_0x9980('0x4e')])+'s';return _0x3fe0bd;}logger[_0x9980('0x30')](_0x9980('0x40'),JSON[_0x9980('0x11')](data));throw new Error(_0x9980('0x4f')+JSON['stringify'](data));})[_0x9980('0x2f')](function(_0x2b9e2a){console[_0x9980('0x50')](_0x9980('0x51'),_0x2b9e2a);});}function getEndUser(_0x1435b2,_0x3ac87b,_0x1cd5fc,_0x40ee1a,_0x548ea2,_0x419688,_0x1a137a){var _0x1c16b5={'method':_0x9980('0x35'),'uri':'','headers':{'Authorization':_0x9980('0x4a')+_0x1435b2},'json':!![]};switch(_0x1a137a[_0x9980('0x52')]){case _0x9980('0x53'):_0x1c16b5[_0x9980('0x54')]=_0x9980('0x44')+_0x3ac87b+_0x9980('0x55')+_0x548ea2+'))';return getZohoUser(_0x1c16b5,_0x9980('0x56'))[_0x9980('0x2b')](function(_0xc07394){if(_0xc07394)return _0xc07394;_0x1c16b5[_0x9980('0x54')]=_0x9980('0x44')+_0x3ac87b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x548ea2+'))';return getZohoUser(_0x1c16b5,_0x9980('0x57'))[_0x9980('0x2b')](function(_0x5868e1){if(_0x5868e1)return _0x5868e1;if(_0x1a137a[_0x9980('0x4e')]!='nothing'){return createEndUser(_0x1435b2,_0x3ac87b,_0x40ee1a,_0x548ea2,_0x419688,_0x1a137a);}else{return{};}});});break;case _0x9980('0x58'):_0x1c16b5[_0x9980('0x54')]='https://www.zohoapis.'+_0x3ac87b+_0x9980('0x55')+_0x548ea2+'))';return getZohoUser(_0x1c16b5,_0x9980('0x56'))['then'](function(_0x3de44b){if(_0x3de44b)return _0x3de44b;if(_0x1a137a[_0x9980('0x4e')]!=_0x9980('0x59')){return createEndUser(_0x1435b2,_0x3ac87b,_0x40ee1a,_0x548ea2,_0x419688,_0x1a137a);}else{return{};}});break;case'lead':_0x1c16b5[_0x9980('0x54')]=_0x9980('0x44')+_0x3ac87b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x548ea2+'))';return getZohoUser(_0x1c16b5,_0x9980('0x57'))[_0x9980('0x2b')](function(_0x51d5f3){if(_0x51d5f3)return _0x51d5f3;if(_0x1a137a[_0x9980('0x4e')]!=_0x9980('0x59')){return createEndUser(_0x1435b2,_0x3ac87b,_0x40ee1a,_0x548ea2,_0x419688,_0x1a137a);}else{return{};}});break;}}function getCall(_0x1a4cb0,_0x5a2319,_0x1d9aa5,_0x158390,_0x69cca9,_0x2afc31,_0x44d08d,_0x3eeb5c){logger[_0x9980('0x33')](_0x9980('0x5a'));var _0x8b0c27={};_0x8b0c27[_0x9980('0x5b')]={'name':!_['isNil'](_0x158390['role'][_0x9980('0x1e')])&&!_[_0x9980('0x22')](_0x158390[_0x9980('0x3e')][_0x9980('0x1e')])&&_0x158390[_0x9980('0x3e')]['name']===_0x9980('0x5c')?_0x158390[_0x9980('0x47')]['name']:!_[_0x9980('0x22')](_0x158390['first_name'])?_0x158390[_0x9980('0x48')]+'\x20'+_0x158390[_0x9980('0x49')]:_0x158390[_0x9980('0x49')],'id':_0x158390['id']};_0x8b0c27['Subject']=intUtil['getString'](_0x2afc31[_0x9980('0x5d')],_0x44d08d,'\x20');_0x8b0c27[_0x9980('0x5e')]=intUtil[_0x9980('0x5f')](_0x2afc31[_0x9980('0x60')],_0x44d08d,'\x0a');if(_0x69cca9[_0x9980('0x43')]===_0x9980('0x56')){_0x8b0c27['Who_Id']={'name':!_[_0x9980('0x22')](_0x69cca9[_0x9980('0x61')])?_0x69cca9['Full_Name']:!_[_0x9980('0x22')](_0x69cca9[_0x9980('0x62')])?_0x69cca9['First_Name']+'\x20'+_0x69cca9['Last_Name']:_0x69cca9['Last_Name'],'id':_0x69cca9['id']};}if(_0x69cca9[_0x9980('0x43')]===_0x9980('0x57')){_0x8b0c27[_0x9980('0x63')]={'name':!_[_0x9980('0x22')](_0x69cca9[_0x9980('0x61')])?_0x69cca9[_0x9980('0x61')]:!_[_0x9980('0x22')](_0x69cca9[_0x9980('0x62')])?_0x69cca9[_0x9980('0x62')]+'\x20'+_0x69cca9[_0x9980('0x64')]:_0x69cca9[_0x9980('0x64')],'id':_0x69cca9['id']};_0x8b0c27[_0x9980('0x65')]=_['startCase'](_0x69cca9[_0x9980('0x43')]);}if(_0x44d08d[_0x9980('0x66')]){_0x8b0c27[_0x9980('0x67')]=moment[_0x9980('0x68')](parseInt(_0x44d08d[_0x9980('0x66')])*0x3e8)[_0x9980('0x36')](_0x9980('0x69'));}else if(_0x44d08d[_0x9980('0x6a')]&&_0x44d08d[_0x9980('0x6b')]){_0x8b0c27['Call_Duration']=moment['utc'](moment(_0x44d08d[_0x9980('0x6b')],_0x9980('0x6c'))[_0x9980('0x6d')](moment(_0x44d08d[_0x9980('0x6e')],_0x9980('0x6c'))))[_0x9980('0x36')](_0x9980('0x69'));}switch(_0x44d08d['lastevent']){case _0x9980('0x6f'):_0x8b0c27[_0x9980('0x70')]=_0x9980('0x71');break;case'complete':case'connect':_0x8b0c27['Call_Result']='Answered';break;case _0x9980('0x72'):_0x8b0c27['Call_Result']=_0x9980('0x73');break;case'abandoned':_0x8b0c27[_0x9980('0x70')]='Abandoned';break;case _0x9980('0x74'):_0x8b0c27[_0x9980('0x70')]=_0x9980('0x75');default:}_0x8b0c27[_0x9980('0x76')]=(_0x3eeb5c==='outbound'?moment(_0x44d08d[_0x9980('0x6e')])[_0x9980('0x36')](_0x9980('0x6c')):moment(_0x44d08d[_0x9980('0x77')])['format'](_0x9980('0x6c')))||moment()['format'](_0x9980('0x6c'));_0x8b0c27[_0x9980('0x78')]=_0x3eeb5c||_0x9980('0x79');_0x8b0c27=_[_0x9980('0x7a')](_0x8b0c27,getCustomFields(_0x2afc31['Fields'],_0x44d08d));return request({'method':_0x9980('0x26'),'uri':_0x9980('0x44')+_0x5a2319+_0x9980('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1a4cb0},'body':{'data':[_0x8b0c27]},'json':!![]})['then'](function(_0x200daf){if(_0x200daf&&_0x200daf[_0x9980('0x42')][0x0][_0x9980('0x4b')]===_0x9980('0x4c')){logger[_0x9980('0x33')](_0x9980('0x7c'));return{'id':_0x200daf[_0x9980('0x42')][0x0][_0x9980('0x4d')]['id']};}})[_0x9980('0x2f')](function(_0x28ad45){logger[_0x9980('0x33')](_0x9980('0x7d'),_0x28ad45['stack']);console[_0x9980('0x50')]('err',_0x28ad45);});}exports['queue']=function(_0x796740,_0x408bd5,_0x5e70b2,_0xf29ff5,_0x20ac08,_0x4b0ce5){var _0x1d3249,_0x912fa1,_0x3db467;_0x4b0ce5['host']=intUtil[_0x9980('0x7e')](_0x4b0ce5[_0x9980('0x7f')]);_0x4b0ce5[_0x9980('0x80')]=intUtil[_0x9980('0x7e')](_0x4b0ce5[_0x9980('0x80')]);if(_0x20ac08&&_0x20ac08['monitor_format']){logger[_0x9980('0x33')](_0x9980('0x81'),'Recording\x20is\x20enabled!');_0x408bd5[_0x9980('0x82')]=_0x4b0ce5[_0x9980('0x80')]+_0x9980('0x83')+_0x408bd5[_0x9980('0x84')]+_0x9980('0x85')+md5(_0x408bd5[_0x9980('0x84')]);}else{_0x408bd5['recordingURL']='';}var _0x325c20=_0x4b0ce5[_0x9980('0x7f')]===_0x9980('0x86')?'eu':_0x9980('0x87');return getAccessToken(_0x4b0ce5)[_0x9980('0x2b')](function(_0x5916a9){_0x3db467=_0x5916a9;return getUser(_0x3db467,_0x325c20,_0x4b0ce5,_0xf29ff5[_0x9980('0x3b')]);})[_0x9980('0x2b')](function(_0x350eb0){_0x1d3249=_0x350eb0;logger['info'](_0x9980('0x88'),_0x1d3249['id']);return getEndUser(_0x3db467,_0x325c20,_0x4b0ce5,_0x408bd5[_0x9980('0x89')],_0x408bd5[_0x9980('0x8a')],_0x1d3249,_0x5e70b2);})[_0x9980('0x2b')](function(_0x5b041c){_0x912fa1=_0x5b041c;return getCall(_0x3db467,_0x325c20,_0x4b0ce5,_0x1d3249,_0x912fa1,_0x5e70b2,_0x408bd5,_0x9980('0x79'));})[_0x9980('0x2b')](function(_0x24157e){if(_0x24157e){logger[_0x9980('0x33')](_0x9980('0x8b'),_0x24157e['id']);logger[_0x9980('0x33')](_0x9980('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9980('0x36')]('user:%s',_0xf29ff5[_0x9980('0x1e')]),'trigger:browser:url',{'uri':_0x9980('0x8c')+_0x4b0ce5['host']+_0x9980('0x8d')+_0x24157e['id']});}})[_0x9980('0x2f')](function(_0x4223c1){logger[_0x9980('0x30')](_0x9980('0x81'),JSON[_0x9980('0x11')](_0x4223c1));});};exports[_0x9980('0x8e')]=function(_0xe82816,_0x3b0a4c,_0x34476a,_0x2c104c,_0x281a51,_0x2b9f1c,_0x334e10){var _0x1b2f79,_0x246ae7,_0x563d37;_0x2b9f1c[_0x9980('0x7f')]=intUtil['stripTrailingSlash'](_0x2b9f1c[_0x9980('0x7f')]);_0x2b9f1c[_0x9980('0x80')]=intUtil['stripTrailingSlash'](_0x2b9f1c[_0x9980('0x80')]);if(_0x334e10&&_0x334e10['recordingFormat']&&_0x334e10['recordingFormat']!==_0x9980('0x8f')){logger['info'](_0x9980('0x90'),_0x9980('0x91'));_0x3b0a4c[_0x9980('0x82')]=_0x2b9f1c[_0x9980('0x80')]+'/api/voice/recordings/'+_0x3b0a4c['uniqueid']+_0x9980('0x85')+md5(_0x3b0a4c['uniqueid']);}var _0x37cae5=_0x2b9f1c[_0x9980('0x7f')]===_0x9980('0x86')?'eu':_0x9980('0x87');return getAccessToken(_0x2b9f1c)[_0x9980('0x2b')](function(_0x56b9af){_0x563d37=_0x56b9af;return getUser(_0x563d37,_0x37cae5,_0x2b9f1c,_0x2c104c[_0x9980('0x3b')]);})[_0x9980('0x2b')](function(_0x1d402e){_0x1b2f79=_0x1d402e;logger[_0x9980('0x33')](_0x9980('0x88'),_0x1b2f79['id']);return getEndUser(_0x563d37,_0x37cae5,_0x2b9f1c,_0x3b0a4c[_0x9980('0x92')],_0x3b0a4c[_0x9980('0x93')],_0x1b2f79,_0x34476a);})['then'](function(_0x1b2a19){_0x246ae7=_0x1b2a19;return getCall(_0x563d37,_0x37cae5,_0x2b9f1c,_0x1b2f79,_0x246ae7,_0x34476a,_0x3b0a4c,'Outbound');})['then'](function(_0x599e58){if(_0x599e58){logger[_0x9980('0x33')](_0x9980('0x8b'),_0x599e58['id']);logger[_0x9980('0x33')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9980('0x36')]('user:%s',_0x2c104c[_0x9980('0x1e')]),_0x9980('0x94'),{'uri':_0x9980('0x8c')+_0x2b9f1c[_0x9980('0x7f')]+_0x9980('0x8d')+_0x599e58['id']});}})[_0x9980('0x2f')](function(_0x4703dc){logger['error'](_0x9980('0x90'),JSON[_0x9980('0x11')](_0x4703dc));});};exports[_0x9980('0x95')]=function(_0x5da9b1,_0x330e93,_0x36a663,_0x559a27,_0x3a6e7f,_0x4effc2){var _0x2017e1,_0x5841c2,_0x223ac2;_0x4effc2[_0x9980('0x7f')]=intUtil['stripTrailingSlash'](_0x4effc2[_0x9980('0x7f')]);_0x4effc2[_0x9980('0x80')]=intUtil['stripTrailingSlash'](_0x4effc2[_0x9980('0x80')]);if(_0x3a6e7f&&_0x3a6e7f[_0x9980('0x96')]){logger[_0x9980('0x33')]('['+_0x330e93[_0x9980('0x97')]['toUpperCase']()+']',_0x9980('0x91'));_0x330e93['recordingURL']=_0x4effc2[_0x9980('0x80')]+'/api/voice/recordings/'+_0x330e93[_0x9980('0x84')]+_0x9980('0x85')+md5(_0x330e93[_0x9980('0x84')]);}else{_0x330e93[_0x9980('0x82')]='';}var _0x442cbf=_0x4effc2[_0x9980('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4effc2)['then'](function(_0x22a8c0){_0x223ac2=_0x22a8c0;return getUser(_0x223ac2,_0x442cbf,_0x4effc2);})[_0x9980('0x2b')](function(_0x1e9a54){_0x2017e1=_0x1e9a54;logger['info'](_0x9980('0x88'),_0x2017e1['id']);return getEndUser(_0x223ac2,_0x442cbf,_0x4effc2,_0x330e93['calleridname'],_0x330e93[_0x9980('0x8a')],_0x2017e1,_0x36a663);})['then'](function(_0x1ae732){_0x5841c2=_0x1ae732;return getCall(_0x223ac2,_0x442cbf,_0x4effc2,_0x2017e1,_0x5841c2,_0x36a663,_0x330e93,_0x9980('0x79'));})[_0x9980('0x2b')](function(_0x489f81){if(_0x489f81){logger['info'](_0x9980('0x8b'),_0x489f81['id']);}})[_0x9980('0x2f')](function(_0x18ae31){logger[_0x9980('0x30')]('['+_0x330e93[_0x9980('0x97')]['toUpperCase']()+']',JSON['stringify'](_0x18ae31));});}; \ 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 bd4af86..ddc4d48 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 _0xaedb=['mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0x4f46a3,_0x1bf5a8){var _0x3d3d5a=function(_0x44a584){while(--_0x44a584){_0x4f46a3['push'](_0x4f46a3['shift']());}};_0x3d3d5a(++_0x1bf5a8);}(_0xaedb,0xc3));var _0xbaed=function(_0x3836d5,_0x24e547){_0x3836d5=_0x3836d5-0x0;var _0x434c74=_0xaedb[_0x3836d5];return _0x434c74;};'use strict';var util=require('util');var sh=require(_0xbaed('0x0'));var Mustache=require(_0xbaed('0x1'));var logger=require(_0xbaed('0x2'))(_0xbaed('0x3'));exports['exec']=function(_0x3cb18e,_0x1e4144){var _0x4acf54=_0x3cb18e[_0xbaed('0x4')]?_0x3cb18e[_0xbaed('0x4')]:_0xbaed('0x5');var _0x268786=_0x3cb18e[_0xbaed('0x6')]?Mustache[_0xbaed('0x7')](_0x3cb18e['data3'],_0x1e4144):_0x1e4144;sh[_0xbaed('0x8')](_0x268786,function(_0x136391,_0x3c185a,_0x2d0bce){if(_0x136391!==0x0){logger[_0xbaed('0x9')](util[_0xbaed('0xa')](_0xbaed('0xb'),_0x4acf54,_0x268786,_0x136391,_0x2d0bce));}else{logger[_0xbaed('0xc')](util[_0xbaed('0xa')](_0xbaed('0xd'),_0x4acf54,_0x268786,_0x3c185a));}});}; \ No newline at end of file +var _0xc3e0=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x470727,_0x545f62){var _0x17fef8=function(_0x3ea777){while(--_0x3ea777){_0x470727['push'](_0x470727['shift']());}};_0x17fef8(++_0x545f62);}(_0xc3e0,0x160));var _0x0c3e=function(_0x272f49,_0x3cdd11){_0x272f49=_0x272f49-0x0;var _0x4c6564=_0xc3e0[_0x272f49];return _0x4c6564;};'use strict';var util=require(_0x0c3e('0x0'));var sh=require(_0x0c3e('0x1'));var Mustache=require(_0x0c3e('0x2'));var logger=require('../../../../config/logger')(_0x0c3e('0x3'));exports[_0x0c3e('0x4')]=function(_0xc0522b,_0x37e433){var _0x1eb77f=_0xc0522b[_0x0c3e('0x5')]?_0xc0522b[_0x0c3e('0x5')]:'Script';var _0x60b323=_0xc0522b[_0x0c3e('0x6')]?Mustache[_0x0c3e('0x7')](_0xc0522b[_0x0c3e('0x6')],_0x37e433):_0x37e433;sh[_0x0c3e('0x4')](_0x60b323,function(_0xa841ae,_0x1c300b,_0x2b5887){if(_0xa841ae!==0x0){logger[_0x0c3e('0x8')](util[_0x0c3e('0x9')](_0x0c3e('0xa'),_0x1eb77f,_0x60b323,_0xa841ae,_0x2b5887));}else{logger[_0x0c3e('0xb')](util['format'](_0x0c3e('0xc'),_0x1eb77f,_0x60b323,_0x1c300b));}});}; \ 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 b685b54..ccc28f2 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 _0xbf07=['format','data2','then',',\x20request\x20body:\x20','object','stringify','%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','../../../../config/logger','trigger','toUpperCase','render','number','data5','headers','data6','parse','error','data1','GET','DELETE','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info'];(function(_0x5cf2ce,_0x45403d){var _0x510e1d=function(_0x1c08ec){while(--_0x1c08ec){_0x5cf2ce['push'](_0x5cf2ce['shift']());}};_0x510e1d(++_0x45403d);}(_0xbf07,0x14c));var _0x7bf0=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xbf07[_0x3e5bc8];return _0xfd84bc;};'use strict';var rp=require(_0x7bf0('0x0'));var util=require('util');var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x7bf0('0x1'))(_0x7bf0('0x2'));exports['exec']=function(_0x3f934d,_0x54af25){var _0x341709,_0x58f1d4;var _0x4df967={'method':_0x3f934d['data1'][_0x7bf0('0x3')](),'uri':Mustache[_0x7bf0('0x4')](_0x3f934d['data2'],_0x54af25),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3f934d['data5'])===_0x7bf0('0x5')&&parseInt(_0x3f934d[_0x7bf0('0x6')])>=0x1&&parseInt(_0x3f934d[_0x7bf0('0x6')])<=0xa?parseInt(_0x3f934d[_0x7bf0('0x6')])*0x3e8:0x5*0x3e8};try{_0x4df967[_0x7bf0('0x7')]=_0x3f934d[_0x7bf0('0x8')]?JSON[_0x7bf0('0x9')](Mustache[_0x7bf0('0x4')](_0x3f934d[_0x7bf0('0x8')],_0x54af25)):{};}catch(_0x3686a1){logger[_0x7bf0('0xa')](_0x3686a1['stack']);}switch(_0x3f934d[_0x7bf0('0xb')][_0x7bf0('0x3')]()){case _0x7bf0('0xc'):case _0x7bf0('0xd'):_0x341709=null;_0x4df967['qs']=_0x54af25;break;case'POST':case _0x7bf0('0xe'):if(_0x3f934d[_0x7bf0('0xf')]){try{_0x341709=JSON[_0x7bf0('0x9')](Mustache['render'](_0x3f934d[_0x7bf0('0xf')],_0x54af25));_0x4df967[_0x7bf0('0x10')]=_0x341709;}catch(_0x2325d7){logger['error'](_0x2325d7[_0x7bf0('0x11')]);logger['error'](_0x7bf0('0x12'));}}else{_0x341709=_0x54af25;_0x4df967[_0x7bf0('0x10')]=_0x341709;}break;}logger[_0x7bf0('0x13')](util[_0x7bf0('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3f934d[_0x7bf0('0xb')],_0x3f934d[_0x7bf0('0x15')],JSON['stringify'](_0x4df967)));rp(_0x4df967)[_0x7bf0('0x16')](function(_0x18427e){_0x341709=!_['isNil'](_0x341709)?_0x7bf0('0x17')+_0x341709:'';_0x58f1d4=typeof _0x18427e[_0x7bf0('0x10')]===_0x7bf0('0x18')?JSON[_0x7bf0('0x19')](_0x18427e[_0x7bf0('0x10')]):_0x18427e[_0x7bf0('0x10')];logger[_0x7bf0('0x13')](util[_0x7bf0('0x14')](_0x7bf0('0x1a'),_0x3f934d[_0x7bf0('0xb')],_0x3f934d[_0x7bf0('0x15')],_0x18427e[_0x7bf0('0x1b')],_0x58f1d4));})[_0x7bf0('0x1c')](function(_0x3a22eb){logger['error'](util[_0x7bf0('0x14')](_0x7bf0('0x1d'),_0x3f934d[_0x7bf0('0xb')],_0x3f934d[_0x7bf0('0x15')],_0x3a22eb[_0x7bf0('0x1b')],_0x3a22eb[_0x7bf0('0x1e')],_0x3a22eb[_0x7bf0('0x1f')]));});}; \ No newline at end of file +var _0x3e80=['format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','mustache','trigger','exec','render','data2','data5','number','headers','data6','parse','error','stack','data1','toUpperCase','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil'];(function(_0x5753c3,_0x5878be){var _0x47e08c=function(_0x589f4c){while(--_0x589f4c){_0x5753c3['push'](_0x5753c3['shift']());}};_0x47e08c(++_0x5878be);}(_0x3e80,0x1c7));var _0x03e8=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x3e80[_0x57486e];return _0x5f110b;};'use strict';var rp=require('request-promise');var util=require(_0x03e8('0x0'));var _=require('lodash');var Mustache=require(_0x03e8('0x1'));var logger=require('../../../../config/logger')(_0x03e8('0x2'));exports[_0x03e8('0x3')]=function(_0x1582f0,_0x5f49a6){var _0xa21940,_0x5b242f;var _0x128903={'method':_0x1582f0['data1']['toUpperCase'](),'uri':Mustache[_0x03e8('0x4')](_0x1582f0[_0x03e8('0x5')],_0x5f49a6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1582f0[_0x03e8('0x6')])===_0x03e8('0x7')&&parseInt(_0x1582f0[_0x03e8('0x6')])>=0x1&&parseInt(_0x1582f0[_0x03e8('0x6')])<=0xa?parseInt(_0x1582f0[_0x03e8('0x6')])*0x3e8:0x5*0x3e8};try{_0x128903[_0x03e8('0x8')]=_0x1582f0[_0x03e8('0x9')]?JSON[_0x03e8('0xa')](Mustache[_0x03e8('0x4')](_0x1582f0[_0x03e8('0x9')],_0x5f49a6)):{};}catch(_0x3f1593){logger[_0x03e8('0xb')](_0x3f1593[_0x03e8('0xc')]);}switch(_0x1582f0[_0x03e8('0xd')][_0x03e8('0xe')]()){case _0x03e8('0xf'):case _0x03e8('0x10'):_0xa21940=null;_0x128903['qs']=_0x5f49a6;break;case _0x03e8('0x11'):case'PUT':if(_0x1582f0[_0x03e8('0x12')]){try{_0xa21940=JSON[_0x03e8('0xa')](Mustache[_0x03e8('0x4')](_0x1582f0[_0x03e8('0x12')],_0x5f49a6));_0x128903[_0x03e8('0x13')]=_0xa21940;}catch(_0x5372fc){logger[_0x03e8('0xb')](_0x5372fc['stack']);logger[_0x03e8('0xb')](_0x03e8('0x14'));}}else{_0xa21940=_0x5f49a6;_0x128903[_0x03e8('0x13')]=_0xa21940;}break;}logger['info'](util['format'](_0x03e8('0x15'),_0x1582f0['data1'],_0x1582f0[_0x03e8('0x5')],JSON[_0x03e8('0x16')](_0x128903)));rp(_0x128903)[_0x03e8('0x17')](function(_0x6bab0d){_0xa21940=!_[_0x03e8('0x18')](_0xa21940)?',\x20request\x20body:\x20'+_0xa21940:'';_0x5b242f=typeof _0x6bab0d[_0x03e8('0x13')]==='object'?JSON['stringify'](_0x6bab0d[_0x03e8('0x13')]):_0x6bab0d[_0x03e8('0x13')];logger['info'](util[_0x03e8('0x19')](_0x03e8('0x1a'),_0x1582f0[_0x03e8('0xd')],_0x1582f0['data2'],_0x6bab0d[_0x03e8('0x1b')],_0x5b242f));})['catch'](function(_0x5d9f0f){logger[_0x03e8('0xb')](util[_0x03e8('0x19')](_0x03e8('0x1c'),_0x1582f0[_0x03e8('0xd')],_0x1582f0[_0x03e8('0x5')],_0x5d9f0f['statusCode'],_0x5d9f0f['name'],_0x5d9f0f[_0x03e8('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7cea994..f2adeb2 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 _0x8a08=['rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x204d3f,_0x340cd0){var _0x2d9a8a=function(_0x4987d4){while(--_0x4987d4){_0x204d3f['push'](_0x204d3f['shift']());}};_0x2d9a8a(++_0x340cd0);}(_0x8a08,0x6e));var _0x88a0=function(_0x3c5474,_0x25d58a){_0x3c5474=_0x3c5474-0x0;var _0x4cc189=_0x8a08[_0x3c5474];return _0x4cc189;};'use strict';var jayson=require(_0x88a0('0x0'));var BPromise=require(_0x88a0('0x1'));var logger=require(_0x88a0('0x2'))(_0x88a0('0x3'));var client=jayson[_0x88a0('0x4')][_0x88a0('0x5')]({'port':0x2329});client[_0x88a0('0x6')]=function(_0x23de83,_0x7c0305){return new BPromise(function(_0x2881d9,_0x533771){return client[_0x88a0('0x7')](_0x23de83,_0x7c0305)[_0x88a0('0x8')](function(_0x1f5d71){logger[_0x88a0('0x9')](_0x88a0('0xa'),_0x88a0('0x3'),_0x23de83,_0x7c0305,_0x1f5d71);if(_0x1f5d71[_0x88a0('0xb')]){logger[_0x88a0('0xb')](_0x88a0('0xa'),_0x88a0('0x3'),_0x23de83,_0x1f5d71[_0x88a0('0xb')][_0x88a0('0xc')],_0x7c0305);return _0x533771(_0x1f5d71[_0x88a0('0xb')][_0x88a0('0xc')]);}else{return _0x2881d9(_0x1f5d71[_0x88a0('0xd')]);}})[_0x88a0('0xe')](function(_0x3df7f1){logger['error'](_0x88a0('0xa'),_0x88a0('0x3'),_0x23de83,_0x3df7f1,_0x7c0305);return _0x533771(_0x3df7f1);});});};module['exports']=client; \ No newline at end of file +var _0xbfe9=['Request','then','debug','error','rpc','message','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x2c3e9e,_0xa87662){var _0x13058a=function(_0x43ead7){while(--_0x43ead7){_0x2c3e9e['push'](_0x2c3e9e['shift']());}};_0x13058a(++_0xa87662);}(_0xbfe9,0x1df));var _0x9bfe=function(_0x444781,_0x4c1340){_0x444781=_0x444781-0x0;var _0x3d87af=_0xbfe9[_0x444781];return _0x3d87af;};'use strict';var jayson=require(_0x9bfe('0x0'));var BPromise=require(_0x9bfe('0x1'));var logger=require(_0x9bfe('0x2'))(_0x9bfe('0x3'));var client=jayson['client'][_0x9bfe('0x4')]({'port':0x2329});client[_0x9bfe('0x5')]=function(_0x586353,_0x5f0c0c){return new BPromise(function(_0x40ed08,_0x529a6d){return client['request'](_0x586353,_0x5f0c0c)[_0x9bfe('0x6')](function(_0x449806){logger[_0x9bfe('0x7')]('rpc',_0x9bfe('0x3'),_0x586353,_0x5f0c0c,_0x449806);if(_0x449806[_0x9bfe('0x8')]){logger[_0x9bfe('0x8')](_0x9bfe('0x9'),_0x9bfe('0x3'),_0x586353,_0x449806[_0x9bfe('0x8')][_0x9bfe('0xa')],_0x5f0c0c);return _0x529a6d(_0x449806[_0x9bfe('0x8')]['message']);}else{return _0x40ed08(_0x449806['result']);}})['catch'](function(_0x2abc43){logger[_0x9bfe('0x8')](_0x9bfe('0x9'),_0x9bfe('0x3'),_0x586353,_0x2abc43,_0x5f0c0c);return _0x529a6d(_0x2abc43);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 054a9bf..b594e0b 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 _0x238a=['getMailAccounts','refresh','mailAccounts','listen','getSettings','error','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then'];(function(_0x2aa7f4,_0x40a5ab){var _0x4d6a16=function(_0xf475b7){while(--_0xf475b7){_0x2aa7f4['push'](_0x2aa7f4['shift']());}};_0x4d6a16(++_0x40a5ab);}(_0x238a,0x13e));var _0xa238=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x238a[_0x50a0c2];return _0x5ebadd;};'use strict';var server=require('./server');var Realtime=require(_0xa238('0x0'));var EmailChannel=require(_0xa238('0x1'));var mailAccount=require(_0xa238('0x2'));var setting=require(_0xa238('0x3'));var logger=require(_0xa238('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa238('0x5')]()[_0xa238('0x6')](mailAccount[_0xa238('0x7')]())[_0xa238('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xa238('0x8')](realtime[_0xa238('0x9')]);return realtime;});}function main(){return server[_0xa238('0xa')](realtime,email)[_0xa238('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xa238('0xb')]();})[_0xa238('0x6')](function(_0x21faca){return setInterval(initRealtime,_0x21faca['loginMailFrequency']*0x3e8);})['catch'](function(_0x3aafe7){logger[_0xa238('0xc')]('Email\x20service\x20initialization',_0x3aafe7);});}main(); \ No newline at end of file +var _0x296a=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','resolve'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x296a,0x190));var _0xa296=function(_0x3c33a9,_0x50d20e){_0x3c33a9=_0x3c33a9-0x0;var _0x248ce9=_0x296a[_0x3c33a9];return _0x248ce9;};'use strict';var server=require(_0xa296('0x0'));var Realtime=require(_0xa296('0x1'));var EmailChannel=require(_0xa296('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xa296('0x3'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa296('0x4')]()[_0xa296('0x5')](mailAccount[_0xa296('0x6')]())[_0xa296('0x5')](realtime[_0xa296('0x7')]())['then'](function(){email[_0xa296('0x8')](realtime[_0xa296('0x9')]);return realtime;});}function main(){return server[_0xa296('0xa')](realtime,email)[_0xa296('0x5')](function(){return initRealtime();})[_0xa296('0x5')](function(){return setting[_0xa296('0xb')]();})[_0xa296('0x5')](function(_0x863991){return setInterval(initRealtime,_0x863991['loginMailFrequency']*0x3e8);})[_0xa296('0xc')](function(_0xe0ea67){logger[_0xa296('0xd')](_0xa296('0xe'),_0xe0ea67);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1d1c823..cce40d3 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 _0x157b=['start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','active','Imap','stringify','md5','mailAccount:update','refresh','service','provider','hasOwnProperty','bind','email','handleImapEmail','end','error','handleImapError','isNil','status','disabled','messageStatus','handleImapBox','connected','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount'];(function(_0x350b03,_0x499a52){var _0x128a6b=function(_0x503380){while(--_0x503380){_0x350b03['push'](_0x350b03['shift']());}};_0x128a6b(++_0x499a52);}(_0x157b,0x141));var _0xb157=function(_0x2fe822,_0x4bd3a1){_0x2fe822=_0x2fe822-0x0;var _0x4d4ce6=_0x157b[_0x2fe822];return _0x4d4ce6;};'use strict';var _=require(_0xb157('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xb157('0x1'));var config=require('../../../config/environment');var logger=require(_0xb157('0x2'))('email');config[_0xb157('0x3')]=_[_0xb157('0x4')](config['redis'],{'host':_0xb157('0x5'),'port':0x18eb});var io=require(_0xb157('0x6'))(new Redis(config[_0xb157('0x3')]));var EmailImap=require(_0xb157('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xb157('0x8'));var md5Accounts={};function EmailChannel(_0x466c88){logger['info'](_0xb157('0x9'));this[_0xb157('0xa')]=_0x466c88['mailAccounts'];this[_0xb157('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xb157('0xc')][_0xb157('0xd')]=function(_0x5790ac){var _0xbe4031=this['mailAccounts'][_0x5790ac];var _0x463bd8={'id':_0xbe4031['id'],'name':_0xbe4031[_0xb157('0xe')],'key':_0xbe4031['key'],'active':_0xbe4031[_0xb157('0xf')],'Imap':{'status':_0xbe4031['Imap']['status'],'messageStatus':_0xbe4031[_0xb157('0x10')]['messageStatus'],'total':_0xbe4031['Imap']['total']}};if(_['isNil'](md5Accounts[_0x5790ac])){md5Accounts[_0x5790ac]={};}var _0x31352d=md5(JSON[_0xb157('0x11')](_0x463bd8));if(md5Accounts[_0x5790ac]['md5']!==_0x31352d){md5Accounts[_0x5790ac][_0xb157('0x12')]=_0x31352d;io[_0xb157('0xd')](_0xb157('0x13'),_0x463bd8);}};EmailChannel[_0xb157('0xc')][_0xb157('0x14')]=function(_0x37d730){for(var _0x30f884 in _0x37d730){if(_0x37d730['hasOwnProperty'](_0x30f884)){if(_0x37d730[_0x30f884]['Imap']&&_0x37d730[_0x30f884][_0xb157('0xf')]){var _0x1c0fe7=_0x37d730[_0x30f884]['Imap'];if(!_0x1c0fe7[_0xb157('0x15')]&&_0x37d730[_0x30f884][_0xb157('0x16')]!=='custom')_0x1c0fe7[_0xb157('0x15')]=_0x37d730[_0x30f884][_0xb157('0x16')];if(!this[_0xb157('0xb')][_0xb157('0x17')](_0x1c0fe7['id'])){this[_0xb157('0xb')][_0x1c0fe7['id']]=new EmailImap(_0x1c0fe7,_0x37d730[_0x30f884]['email']);this['imapAccounts'][_0x1c0fe7['id']]['on']('box',this['handleImapBox'][_0xb157('0x18')](this,_0x30f884));this[_0xb157('0xb')][_0x1c0fe7['id']]['on'](_0xb157('0x19'),this[_0xb157('0x1a')]['bind'](this,_0x30f884));this[_0xb157('0xb')][_0x1c0fe7['id']]['on'](_0xb157('0x1b'),this['handleImapEnd'][_0xb157('0x18')](this,_0x30f884));this[_0xb157('0xb')][_0x1c0fe7['id']]['on'](_0xb157('0x1c'),this[_0xb157('0x1d')][_0xb157('0x18')](this,_0x30f884));}}else{if(_[_0xb157('0x1e')](this[_0xb157('0xa')][_0x30f884][_0xb157('0x10')])){this['mailAccounts'][_0x30f884][_0xb157('0x10')]={};}this[_0xb157('0xa')][_0x30f884][_0xb157('0x10')][_0xb157('0x1f')]=_0xb157('0x20');this[_0xb157('0xa')][_0x30f884]['Imap'][_0xb157('0x21')]='';this['emit'](_0x30f884);}}}};EmailChannel[_0xb157('0xc')][_0xb157('0x22')]=function(_0xadcf5c,_0x439ac4){if(this[_0xb157('0xa')][_0xadcf5c]){this[_0xb157('0xa')][_0xadcf5c]['Imap'][_0xb157('0x1f')]=_0xb157('0x23');this[_0xb157('0xa')][_0xadcf5c][_0xb157('0x10')]['messageStatus']=_0x439ac4[_0xb157('0xe')];if(_0x439ac4[_0xb157('0x24')]){this[_0xb157('0xa')][_0xadcf5c]['Imap'][_0xb157('0x25')]=_0x439ac4['messages']['total'];}return this[_0xb157('0xd')](_0xadcf5c);}};EmailChannel[_0xb157('0xc')][_0xb157('0x1a')]=function(_0xfaf113,_0xba458c){logger[_0xb157('0x26')](_0xb157('0x27'),_0xba458c[_0xb157('0x28')],_0xba458c['lastName'],_0xba458c[_0xb157('0x29')],_0xfaf113);if(this[_0xb157('0xa')][_0xfaf113]){return mailAccount[_0xb157('0x2a')](_0xfaf113,_0xba458c)[_0xb157('0x2b')](function(_0x2de00b){if(_0x2de00b){logger[_0xb157('0x26')]('Mail\x20accepted\x20from\x20routing');}})[_0xb157('0x2c')](function(_0x98dc67){logger[_0xb157('0x1c')](_0xb157('0x2d'),JSON[_0xb157('0x11')](_0x98dc67));});}};EmailChannel[_0xb157('0xc')]['handleImapEnd']=function(_0x170438){if(this[_0xb157('0xa')][_0x170438]&&this['mailAccounts'][_0x170438][_0xb157('0x10')]){if(this[_0xb157('0xb')][this[_0xb157('0xa')][_0x170438][_0xb157('0x10')]['id']]){delete this[_0xb157('0xb')][this[_0xb157('0xa')][_0x170438][_0xb157('0x10')]['id']];}this[_0xb157('0xa')][_0x170438][_0xb157('0x10')][_0xb157('0x2e')]=moment();this[_0xb157('0xd')](_0x170438);}};EmailChannel[_0xb157('0xc')][_0xb157('0x1d')]=function(_0xc33767,_0x179ed4){if(this[_0xb157('0xa')][_0xc33767]){this['mailAccounts'][_0xc33767]['Imap'][_0xb157('0x1f')]=_0xb157('0x1c');this[_0xb157('0xa')][_0xc33767]['Imap']['messageStatus']=_0x179ed4;return this[_0xb157('0xd')](_0xc33767);}};EmailChannel[_0xb157('0xc')][_0xb157('0x2f')]=function(_0x199370,_0x5a8ded){return this[_0xb157('0x30')][_0xb157('0x31')](_0x199370,_0x5a8ded);};EmailChannel[_0xb157('0xc')][_0xb157('0x32')]=function(_0x264aa6){var _0x5c698d=this;if(this[_0xb157('0xa')][_0x264aa6['id']]){if(_[_0xb157('0x1e')](this[_0xb157('0xa')][_0x264aa6['id']][_0xb157('0x33')])){this[_0xb157('0xa')][_0x264aa6['id']][_0xb157('0x33')]={};}this[_0xb157('0xa')][_0x264aa6['id']]['Smtp'][_0xb157('0x2e')]=moment();return new BPromise(function(_0x564979,_0x314fcf){return _0x5c698d[_0xb157('0x30')][_0xb157('0x34')](_0x264aa6)[_0xb157('0x2b')](function(_0x14019f){_0x5c698d['mailAccounts'][_0x264aa6['id']][_0xb157('0x33')][_0xb157('0x1f')]=_0xb157('0x35');_0x5c698d[_0xb157('0xa')][_0x264aa6['id']]['Smtp']['messageStatus']='';_0x5c698d[_0xb157('0xd')](_0x264aa6['id']);_0x564979(_0x14019f);})[_0xb157('0x2c')](function(_0x1138df){_0x5c698d['mailAccounts'][_0x264aa6['id']][_0xb157('0x33')][_0xb157('0x1f')]=_0xb157('0x1c');_0x5c698d[_0xb157('0xa')][_0x264aa6['id']][_0xb157('0x33')][_0xb157('0x21')]=_0x1138df;_0x5c698d['emit'](_0x264aa6['id']);_0x314fcf(_0x1138df);});});}return this[_0xb157('0x30')][_0xb157('0x34')](_0x264aa6);};module[_0xb157('0x36')]=EmailChannel; \ No newline at end of file +var _0x9161=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','Smtp','lastSync','verify','then','verified','exports','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','messageStatus','Imap','total','isNil','md5','mailAccount:update','hasOwnProperty','service','custom','provider','box','bind','end','handleImapEnd','error','handleImapError','status','disabled','handleImapBox','connected','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch'];(function(_0x4ac9ef,_0x10112e){var _0xa2c42e=function(_0x991829){while(--_0x991829){_0x4ac9ef['push'](_0x4ac9ef['shift']());}};_0xa2c42e(++_0x10112e);}(_0x9161,0x199));var _0x1916=function(_0x55af9c,_0x33bb0e){_0x55af9c=_0x55af9c-0x0;var _0x59d222=_0x9161[_0x55af9c];return _0x59d222;};'use strict';var _=require(_0x1916('0x0'));var moment=require('moment');var BPromise=require(_0x1916('0x1'));var md5=require('md5');var Redis=require(_0x1916('0x2'));var config=require(_0x1916('0x3'));var logger=require(_0x1916('0x4'))(_0x1916('0x5'));config[_0x1916('0x6')]=_[_0x1916('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1916('0x8'))(new Redis(config[_0x1916('0x6')]));var EmailImap=require(_0x1916('0x9'));var EmailSmtp=require(_0x1916('0xa'));var mailAccount=require(_0x1916('0xb'));var md5Accounts={};function EmailChannel(_0x12df74){logger['info']('start\x20email\x20channel');this[_0x1916('0xc')]=_0x12df74['mailAccounts'];this[_0x1916('0xd')]={};this[_0x1916('0xe')]=new EmailSmtp();}EmailChannel[_0x1916('0xf')][_0x1916('0x10')]=function(_0x33d4a0){var _0x38305d=this['mailAccounts'][_0x33d4a0];var _0x5a164b={'id':_0x38305d['id'],'name':_0x38305d[_0x1916('0x11')],'key':_0x38305d['key'],'active':_0x38305d[_0x1916('0x12')],'Imap':{'status':_0x38305d['Imap']['status'],'messageStatus':_0x38305d['Imap'][_0x1916('0x13')],'total':_0x38305d[_0x1916('0x14')][_0x1916('0x15')]}};if(_[_0x1916('0x16')](md5Accounts[_0x33d4a0])){md5Accounts[_0x33d4a0]={};}var _0x2b5596=md5(JSON['stringify'](_0x5a164b));if(md5Accounts[_0x33d4a0][_0x1916('0x17')]!==_0x2b5596){md5Accounts[_0x33d4a0]['md5']=_0x2b5596;io[_0x1916('0x10')](_0x1916('0x18'),_0x5a164b);}};EmailChannel[_0x1916('0xf')]['refresh']=function(_0x32aed2){for(var _0x2362b4 in _0x32aed2){if(_0x32aed2[_0x1916('0x19')](_0x2362b4)){if(_0x32aed2[_0x2362b4][_0x1916('0x14')]&&_0x32aed2[_0x2362b4][_0x1916('0x12')]){var _0x2351ca=_0x32aed2[_0x2362b4][_0x1916('0x14')];if(!_0x2351ca[_0x1916('0x1a')]&&_0x32aed2[_0x2362b4]['provider']!==_0x1916('0x1b'))_0x2351ca[_0x1916('0x1a')]=_0x32aed2[_0x2362b4][_0x1916('0x1c')];if(!this[_0x1916('0xd')]['hasOwnProperty'](_0x2351ca['id'])){this[_0x1916('0xd')][_0x2351ca['id']]=new EmailImap(_0x2351ca,_0x32aed2[_0x2362b4][_0x1916('0x5')]);this[_0x1916('0xd')][_0x2351ca['id']]['on'](_0x1916('0x1d'),this['handleImapBox'][_0x1916('0x1e')](this,_0x2362b4));this[_0x1916('0xd')][_0x2351ca['id']]['on'](_0x1916('0x5'),this['handleImapEmail'][_0x1916('0x1e')](this,_0x2362b4));this[_0x1916('0xd')][_0x2351ca['id']]['on'](_0x1916('0x1f'),this[_0x1916('0x20')][_0x1916('0x1e')](this,_0x2362b4));this['imapAccounts'][_0x2351ca['id']]['on'](_0x1916('0x21'),this[_0x1916('0x22')][_0x1916('0x1e')](this,_0x2362b4));}}else{if(_[_0x1916('0x16')](this[_0x1916('0xc')][_0x2362b4]['Imap'])){this[_0x1916('0xc')][_0x2362b4]['Imap']={};}this[_0x1916('0xc')][_0x2362b4][_0x1916('0x14')][_0x1916('0x23')]=_0x1916('0x24');this[_0x1916('0xc')][_0x2362b4][_0x1916('0x14')][_0x1916('0x13')]='';this[_0x1916('0x10')](_0x2362b4);}}}};EmailChannel[_0x1916('0xf')][_0x1916('0x25')]=function(_0x14470f,_0x571996){if(this[_0x1916('0xc')][_0x14470f]){this[_0x1916('0xc')][_0x14470f]['Imap']['status']=_0x1916('0x26');this[_0x1916('0xc')][_0x14470f][_0x1916('0x14')]['messageStatus']=_0x571996['name'];if(_0x571996['messages']){this[_0x1916('0xc')][_0x14470f][_0x1916('0x14')][_0x1916('0x15')]=_0x571996['messages'][_0x1916('0x15')];}return this['emit'](_0x14470f);}};EmailChannel[_0x1916('0xf')][_0x1916('0x27')]=function(_0xab76c6,_0xa8963b){logger[_0x1916('0x28')](_0x1916('0x29'),_0xa8963b[_0x1916('0x2a')],_0xa8963b[_0x1916('0x2b')],_0xa8963b[_0x1916('0x2c')],_0xab76c6);if(this[_0x1916('0xc')][_0xab76c6]){return mailAccount[_0x1916('0x2d')](_0xab76c6,_0xa8963b)['then'](function(_0x491cbb){if(_0x491cbb){logger[_0x1916('0x28')]('Mail\x20accepted\x20from\x20routing');}})[_0x1916('0x2e')](function(_0x5aaf19){logger[_0x1916('0x21')](_0x1916('0x2f'),JSON[_0x1916('0x30')](_0x5aaf19));});}};EmailChannel['prototype'][_0x1916('0x20')]=function(_0x1356c2){if(this['mailAccounts'][_0x1356c2]&&this['mailAccounts'][_0x1356c2]['Imap']){if(this[_0x1916('0xd')][this[_0x1916('0xc')][_0x1356c2]['Imap']['id']]){delete this[_0x1916('0xd')][this[_0x1916('0xc')][_0x1356c2][_0x1916('0x14')]['id']];}this[_0x1916('0xc')][_0x1356c2][_0x1916('0x14')]['lastSync']=moment();this['emit'](_0x1356c2);}};EmailChannel[_0x1916('0xf')][_0x1916('0x22')]=function(_0x28f6b8,_0x204aa2){if(this['mailAccounts'][_0x28f6b8]){this[_0x1916('0xc')][_0x28f6b8]['Imap'][_0x1916('0x23')]=_0x1916('0x21');this['mailAccounts'][_0x28f6b8]['Imap']['messageStatus']=_0x204aa2;return this['emit'](_0x28f6b8);}};EmailChannel['prototype'][_0x1916('0x31')]=function(_0x554e86,_0x24a090){return this[_0x1916('0xe')][_0x1916('0x32')](_0x554e86,_0x24a090);};EmailChannel[_0x1916('0xf')]['verifySmtp']=function(_0xee8c6c){var _0x191652=this;if(this['mailAccounts'][_0xee8c6c['id']]){if(_[_0x1916('0x16')](this[_0x1916('0xc')][_0xee8c6c['id']][_0x1916('0x33')])){this[_0x1916('0xc')][_0xee8c6c['id']]['Smtp']={};}this['mailAccounts'][_0xee8c6c['id']][_0x1916('0x33')][_0x1916('0x34')]=moment();return new BPromise(function(_0x4aa715,_0x45b3d8){return _0x191652['smtp'][_0x1916('0x35')](_0xee8c6c)[_0x1916('0x36')](function(_0x5a755d){_0x191652['mailAccounts'][_0xee8c6c['id']]['Smtp'][_0x1916('0x23')]=_0x1916('0x37');_0x191652[_0x1916('0xc')][_0xee8c6c['id']][_0x1916('0x33')][_0x1916('0x13')]='';_0x191652[_0x1916('0x10')](_0xee8c6c['id']);_0x4aa715(_0x5a755d);})[_0x1916('0x2e')](function(_0x58d6bc){_0x191652['mailAccounts'][_0xee8c6c['id']][_0x1916('0x33')][_0x1916('0x23')]=_0x1916('0x21');_0x191652[_0x1916('0xc')][_0xee8c6c['id']][_0x1916('0x33')][_0x1916('0x13')]=_0x58d6bc;_0x191652[_0x1916('0x10')](_0xee8c6c['id']);_0x45b3d8(_0x58d6bc);});});}return this[_0x1916('0xe')][_0x1916('0x35')](_0xee8c6c);};module[_0x1916('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f84e026..a19d598 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 _0x67ca=['email','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','error','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','util','imap','simpleParser','Iconv','EventEmitter','../../../config/logger','mailbox','account','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x67ca,0x107));var _0xa67c=function(_0x27fd15,_0x379ded){_0x27fd15=_0x27fd15-0x0;var _0x532c1a=_0x67ca[_0x27fd15];return _0x532c1a;};'use strict';var _=require('lodash');var util=require(_0xa67c('0x0'));var Imap=require(_0xa67c('0x1'));var simpleParser=require('mailparser')[_0xa67c('0x2')];var Iconv=require('iconv')[_0xa67c('0x3')];var EventEmitter=require('events')[_0xa67c('0x4')];var utils=require('./utils');var logger=require(_0xa67c('0x5'))('email');function EmailImap(_0x505700,_0x1ae4ad){this[_0xa67c('0x6')]=_0x505700['mailbox'];this['account']=this['getAccount'](_0x505700,_0x1ae4ad);this['imap']=new Imap(this[_0xa67c('0x7')]);this['imap'][_0xa67c('0x8')]('ready',this[_0xa67c('0x9')][_0xa67c('0xa')](this));this[_0xa67c('0x1')][_0xa67c('0x8')](_0xa67c('0xb'),this[_0xa67c('0xc')][_0xa67c('0xa')](this));this[_0xa67c('0x1')]['on']('error',this[_0xa67c('0xd')][_0xa67c('0xa')](this));this[_0xa67c('0x1')][_0xa67c('0xe')]();}util[_0xa67c('0xf')](EmailImap,EventEmitter);EmailImap[_0xa67c('0x10')][_0xa67c('0x11')]=function(_0x49c575,_0x4f8040){var _0x481243={'connTimeout':_0x49c575[_0xa67c('0x12')]?_0x49c575['connTimeout']*0x3e8:0x2710,'authTimeout':_0x49c575[_0xa67c('0x13')]?_0x49c575[_0xa67c('0x13')]*0x3e8:0x1388};if(_0x49c575['service']){_0x481243[_0xa67c('0x14')]=_0x49c575['user'];if(_0x49c575['modernAuthentication']){_0x481243[_0xa67c('0x15')]=utils[_0xa67c('0x16')](_0x49c575[_0xa67c('0x17')][_0xa67c('0x18')],_0x49c575[_0xa67c('0x14')]);}else{_0x481243[_0xa67c('0x19')]=_0x49c575[_0xa67c('0x19')];}}else{if(_0x49c575[_0xa67c('0x1a')]){_0x481243['user']=_0x49c575[_0xa67c('0x14')];_0x481243[_0xa67c('0x19')]=_0x49c575[_0xa67c('0x19')];}}_0x481243[_0xa67c('0x1b')]=_0x4f8040||_0x49c575[_0xa67c('0x14')]||_0xa67c('0x1c');_0x481243[_0xa67c('0x1d')]=_0x49c575[_0xa67c('0x1d')];_0x481243['port']=_0x49c575[_0xa67c('0x1e')]||0x3e1;if(_0x49c575[_0xa67c('0x1f')]){_0x481243[_0xa67c('0x1f')]=!![];}else{_0x481243[_0xa67c('0x1f')]=![];_0x481243[_0xa67c('0x20')]=_0xa67c('0x21');}return _0x481243;};EmailImap['prototype'][_0xa67c('0x9')]=function(){this[_0xa67c('0x1')][_0xa67c('0x22')](this[_0xa67c('0x6')],![],this[_0xa67c('0x23')][_0xa67c('0xa')](this));};EmailImap[_0xa67c('0x10')]['handleOpenBox']=function(_0x20f672,_0x39f43d){if(_0x20f672){this[_0xa67c('0xd')](_0x20f672,!![]);}else{this[_0xa67c('0x24')](_0xa67c('0x25'),_0x39f43d);this[_0xa67c('0x26')]();}};EmailImap[_0xa67c('0x10')][_0xa67c('0x27')]=function(_0xdda1f0){if(_0xdda1f0){this[_0xa67c('0xd')](_0xdda1f0,!![]);}else{this[_0xa67c('0x1')][_0xa67c('0xb')]();}};EmailImap['prototype'][_0xa67c('0x26')]=function(){this['imap'][_0xa67c('0x28')]([_0xa67c('0x29')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0xa67c('0x2a')]=function(_0x35f962,_0x3ee17e){if(_0x35f962){this['handleError'](_0x35f962,!![]);}else{if(_0x3ee17e['length']){try{var _0x9cdf36=this[_0xa67c('0x1')][_0xa67c('0x2b')](_0x3ee17e,{'bodies':'','markSeen':!![]});_0x9cdf36['on'](_0xa67c('0x2c'),this['handleFetchMessage'][_0xa67c('0xa')](this));_0x9cdf36['once'](_0xa67c('0x2d'),this[_0xa67c('0x2e')]['bind'](this));_0x9cdf36[_0xa67c('0x8')](_0xa67c('0xb'),this['handleFetchEnd'][_0xa67c('0xa')](this));}catch(_0x202fbb){logger[_0xa67c('0x2d')](_0x202fbb);}}else{this[_0xa67c('0x1')][_0xa67c('0x2f')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x447108){_0x447108['on'](_0xa67c('0x30'),this[_0xa67c('0x31')]['bind'](this));_0x447108[_0xa67c('0x8')](_0xa67c('0x32'),this[_0xa67c('0x33')][_0xa67c('0xa')](this));_0x447108[_0xa67c('0x8')]('end',this[_0xa67c('0x34')][_0xa67c('0xa')](this));};EmailImap['prototype'][_0xa67c('0x31')]=function(_0x3d32bd){simpleParser(_0x3d32bd,{'Iconv':Iconv},this[_0xa67c('0x35')][_0xa67c('0xa')](this));};EmailImap[_0xa67c('0x10')][_0xa67c('0x33')]=function(){};EmailImap[_0xa67c('0x10')]['handleMessageEnd']=function(){};EmailImap[_0xa67c('0x10')][_0xa67c('0x35')]=function(_0x3df1a3,_0x45a02c){if(_0x3df1a3){logger['error'](_0x3df1a3);}else{var _0x51695c=this;utils[_0xa67c('0x36')](this[_0xa67c('0x7')],_0x45a02c,function(_0x26034c){_0x51695c[_0xa67c('0x24')](_0xa67c('0x1b'),_0x26034c);});}};EmailImap['prototype'][_0xa67c('0x37')]=function(){this[_0xa67c('0x1')][_0xa67c('0x2f')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xa67c('0x10')][_0xa67c('0x2e')]=function(_0x4adb47){this[_0xa67c('0xd')](_0x4adb47);this[_0xa67c('0x1')]['closeBox'](!![],this[_0xa67c('0x27')][_0xa67c('0xa')](this));};EmailImap['prototype'][_0xa67c('0xc')]=function(){this[_0xa67c('0x24')]('end');};EmailImap['prototype'][_0xa67c('0xd')]=function(_0x23e5b2,_0x294d5d){logger[_0xa67c('0x2d')](_0xa67c('0xd'),this['account']['email'],JSON[_0xa67c('0x38')](_0x23e5b2));var _0x35995a='';if(_0x23e5b2){if(_0x23e5b2[_0xa67c('0x39')]){_0x35995a=_0x23e5b2[_0xa67c('0x39')];}else{for(var _0x480b59 in _0x23e5b2){if(_0x23e5b2['hasOwnProperty'](_0x480b59)){_0x35995a+=_['upperFirst'](_0x480b59)+':\x20'+_0x23e5b2[_0x480b59]+'\x0a';}}}}if(_0x294d5d){this['imap']['end']();}else{this[_0xa67c('0x24')](_0xa67c('0x2d'),_0x35995a);this[_0xa67c('0x24')](_0xa67c('0xb'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xffd6=['autotls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','closeBox','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','events','EventEmitter','./utils','email','mailbox','account','getAccount','once','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls'];(function(_0x20c47c,_0x443272){var _0x1cfcd7=function(_0x144ced){while(--_0x144ced){_0x20c47c['push'](_0x20c47c['shift']());}};_0x1cfcd7(++_0x443272);}(_0xffd6,0x1d4));var _0x6ffd=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0xffd6[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var Imap=require(_0x6ffd('0x2'));var simpleParser=require(_0x6ffd('0x3'))[_0x6ffd('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x6ffd('0x5'))[_0x6ffd('0x6')];var utils=require(_0x6ffd('0x7'));var logger=require('../../../config/logger')(_0x6ffd('0x8'));function EmailImap(_0x4d20df,_0x86546d){this[_0x6ffd('0x9')]=_0x4d20df[_0x6ffd('0x9')];this[_0x6ffd('0xa')]=this[_0x6ffd('0xb')](_0x4d20df,_0x86546d);this[_0x6ffd('0x2')]=new Imap(this[_0x6ffd('0xa')]);this['imap'][_0x6ffd('0xc')]('ready',this[_0x6ffd('0xd')]['bind'](this));this[_0x6ffd('0x2')][_0x6ffd('0xc')](_0x6ffd('0xe'),this[_0x6ffd('0xf')][_0x6ffd('0x10')](this));this['imap']['on'](_0x6ffd('0x11'),this[_0x6ffd('0x12')][_0x6ffd('0x10')](this));this[_0x6ffd('0x2')][_0x6ffd('0x13')]();}util[_0x6ffd('0x14')](EmailImap,EventEmitter);EmailImap[_0x6ffd('0x15')][_0x6ffd('0xb')]=function(_0x5e0098,_0x23a0e3){var _0x150b03={'connTimeout':_0x5e0098[_0x6ffd('0x16')]?_0x5e0098[_0x6ffd('0x16')]*0x3e8:0x2710,'authTimeout':_0x5e0098[_0x6ffd('0x17')]?_0x5e0098[_0x6ffd('0x17')]*0x3e8:0x1388};if(_0x5e0098[_0x6ffd('0x18')]){_0x150b03[_0x6ffd('0x19')]=_0x5e0098['user'];if(_0x5e0098[_0x6ffd('0x1a')]){_0x150b03['xoauth2']=utils[_0x6ffd('0x1b')](_0x5e0098[_0x6ffd('0x1c')][_0x6ffd('0x1d')],_0x5e0098[_0x6ffd('0x19')]);}else{_0x150b03[_0x6ffd('0x1e')]=_0x5e0098[_0x6ffd('0x1e')];}}else{if(_0x5e0098[_0x6ffd('0x1f')]){_0x150b03[_0x6ffd('0x19')]=_0x5e0098['user'];_0x150b03[_0x6ffd('0x1e')]=_0x5e0098[_0x6ffd('0x1e')];}}_0x150b03[_0x6ffd('0x8')]=_0x23a0e3||_0x5e0098[_0x6ffd('0x19')]||_0x6ffd('0x20');_0x150b03[_0x6ffd('0x21')]=_0x5e0098[_0x6ffd('0x21')];_0x150b03[_0x6ffd('0x22')]=_0x5e0098['port']||0x3e1;if(_0x5e0098[_0x6ffd('0x23')]){_0x150b03[_0x6ffd('0x23')]=!![];}else{_0x150b03[_0x6ffd('0x23')]=![];_0x150b03[_0x6ffd('0x24')]=_0x6ffd('0x25');}return _0x150b03;};EmailImap[_0x6ffd('0x15')]['handleReady']=function(){this[_0x6ffd('0x2')][_0x6ffd('0x26')](this[_0x6ffd('0x9')],![],this[_0x6ffd('0x27')][_0x6ffd('0x10')](this));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x27')]=function(_0x5ebb3b,_0x58fbd3){if(_0x5ebb3b){this[_0x6ffd('0x12')](_0x5ebb3b,!![]);}else{this[_0x6ffd('0x28')]('box',_0x58fbd3);this[_0x6ffd('0x29')]();}};EmailImap['prototype'][_0x6ffd('0x2a')]=function(_0x39581f){if(_0x39581f){this[_0x6ffd('0x12')](_0x39581f,!![]);}else{this[_0x6ffd('0x2')]['end']();}};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x29')]=function(){this[_0x6ffd('0x2')]['search']([_0x6ffd('0x2b')],this[_0x6ffd('0x2c')][_0x6ffd('0x10')](this));};EmailImap[_0x6ffd('0x15')]['handleReadUnseen']=function(_0x1ccd82,_0x24e978){if(_0x1ccd82){this[_0x6ffd('0x12')](_0x1ccd82,!![]);}else{if(_0x24e978[_0x6ffd('0x2d')]){try{var _0x25e105=this['imap'][_0x6ffd('0x2e')](_0x24e978,{'bodies':'','markSeen':!![]});_0x25e105['on'](_0x6ffd('0x2f'),this[_0x6ffd('0x30')]['bind'](this));_0x25e105['once'](_0x6ffd('0x11'),this['handleFetchError']['bind'](this));_0x25e105[_0x6ffd('0xc')](_0x6ffd('0xe'),this[_0x6ffd('0x31')][_0x6ffd('0x10')](this));}catch(_0x224b71){logger[_0x6ffd('0x11')](_0x224b71);}}else{this[_0x6ffd('0x2')]['closeBox'](!![],this[_0x6ffd('0x2a')][_0x6ffd('0x10')](this));}}};EmailImap['prototype'][_0x6ffd('0x30')]=function(_0x1629bb){_0x1629bb['on'](_0x6ffd('0x32'),this[_0x6ffd('0x33')][_0x6ffd('0x10')](this));_0x1629bb[_0x6ffd('0xc')](_0x6ffd('0x34'),this['handleMessageAttributes'][_0x6ffd('0x10')](this));_0x1629bb[_0x6ffd('0xc')](_0x6ffd('0xe'),this[_0x6ffd('0x35')]['bind'](this));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x33')]=function(_0xd355f4){simpleParser(_0xd355f4,{'Iconv':Iconv},this[_0x6ffd('0x36')]['bind'](this));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x37')]=function(){};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x35')]=function(){};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x36')]=function(_0x1790e9,_0x2dbcf1){if(_0x1790e9){logger[_0x6ffd('0x11')](_0x1790e9);}else{var _0x301e19=this;utils['parser'](this['account'],_0x2dbcf1,function(_0x29d2b7){_0x301e19[_0x6ffd('0x28')](_0x6ffd('0x8'),_0x29d2b7);});}};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x31')]=function(){this[_0x6ffd('0x2')][_0x6ffd('0x38')](!![],this[_0x6ffd('0x2a')][_0x6ffd('0x10')](this));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x39')]=function(_0x54dd97){this['handleError'](_0x54dd97);this[_0x6ffd('0x2')][_0x6ffd('0x38')](!![],this[_0x6ffd('0x2a')]['bind'](this));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0xf')]=function(){this[_0x6ffd('0x28')](_0x6ffd('0xe'));};EmailImap[_0x6ffd('0x15')][_0x6ffd('0x12')]=function(_0x3e55bc,_0x4b02ae){logger[_0x6ffd('0x11')](_0x6ffd('0x12'),this[_0x6ffd('0xa')][_0x6ffd('0x8')],JSON[_0x6ffd('0x3a')](_0x3e55bc));var _0x1c1053='';if(_0x3e55bc){if(_0x3e55bc[_0x6ffd('0x3b')]){_0x1c1053=_0x3e55bc[_0x6ffd('0x3b')];}else{for(var _0x3a926c in _0x3e55bc){if(_0x3e55bc[_0x6ffd('0x3c')](_0x3a926c)){_0x1c1053+=_[_0x6ffd('0x3d')](_0x3a926c)+':\x20'+_0x3e55bc[_0x3a926c]+'\x0a';}}}}if(_0x4b02ae){this[_0x6ffd('0x2')][_0x6ffd('0xe')]();}else{this['emit'](_0x6ffd('0x11'),_0x1c1053);this[_0x6ffd('0x28')](_0x6ffd('0xe'));}};module[_0x6ffd('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index afcd7dc..3d80e8f 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 _0x4958=['verify','createTransport','exports','nodemailer-plugin-inline-base64','prototype','send','compile','toString'];(function(_0x57e9b1,_0x36175c){var _0x4f10b0=function(_0x5d378c){while(--_0x5d378c){_0x57e9b1['push'](_0x57e9b1['shift']());}};_0x4f10b0(++_0x36175c);}(_0x4958,0xcb));var _0x8495=function(_0x3d65ec,_0x5e9ab8){_0x3d65ec=_0x3d65ec-0x0;var _0x558950=_0x4958[_0x3d65ec];return _0x558950;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x8495('0x0'));function EmailSmtp(){}EmailSmtp[_0x8495('0x1')][_0x8495('0x2')]=function(_0x250b3d,_0x2cfbfe){return new Promise(function(_0x45f158,_0x4dde87){var _0x524de7=nodemailer['createTransport'](_0x250b3d);_0x524de7['use'](_0x8495('0x3'),inlineBase64());_0x524de7['sendMail'](_0x2cfbfe,function(_0x91993c,_0x2a9fe4){if(_0x91993c){_0x4dde87(_0x91993c[_0x8495('0x4')]());}else{_0x45f158(_0x2a9fe4);}});});};EmailSmtp[_0x8495('0x1')][_0x8495('0x5')]=function(_0x21ed57){return new Promise(function(_0x4798f8,_0x331785){var _0x17e362=nodemailer[_0x8495('0x6')](_0x21ed57);_0x17e362['verify'](function(_0x48d9f9,_0x36c858){if(_0x48d9f9){_0x331785(_0x48d9f9['toString']());}else{if(_0x36c858){_0x4798f8(_0x36c858);}else{_0x331785('Not\x20verifired');}}});});};module[_0x8495('0x7')]=EmailSmtp; \ No newline at end of file +var _0xccd5=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString'];(function(_0x29b188,_0x3d9882){var _0x52262b=function(_0x1663b1){while(--_0x1663b1){_0x29b188['push'](_0x29b188['shift']());}};_0x52262b(++_0x3d9882);}(_0xccd5,0x1f2));var _0x5ccd=function(_0x2b9c5a,_0x52f3e7){_0x2b9c5a=_0x2b9c5a-0x0;var _0x2e0b2b=_0xccd5[_0x2b9c5a];return _0x2e0b2b;};'use strict';var nodemailer=require(_0x5ccd('0x0'));var inlineBase64=require(_0x5ccd('0x1'));function EmailSmtp(){}EmailSmtp[_0x5ccd('0x2')][_0x5ccd('0x3')]=function(_0x14ae95,_0x24ff0d){return new Promise(function(_0x277fb9,_0x5ab22c){var _0x53ed50=nodemailer[_0x5ccd('0x4')](_0x14ae95);_0x53ed50['use'](_0x5ccd('0x5'),inlineBase64());_0x53ed50[_0x5ccd('0x6')](_0x24ff0d,function(_0x2b79bf,_0x204576){if(_0x2b79bf){_0x5ab22c(_0x2b79bf[_0x5ccd('0x7')]());}else{_0x277fb9(_0x204576);}});});};EmailSmtp['prototype'][_0x5ccd('0x8')]=function(_0xabfccd){return new Promise(function(_0x16d0e1,_0x82decd){var _0x3c674f=nodemailer[_0x5ccd('0x4')](_0xabfccd);_0x3c674f[_0x5ccd('0x8')](function(_0x14ae5f,_0x17d448){if(_0x14ae5f){_0x82decd(_0x14ae5f[_0x5ccd('0x7')]());}else{if(_0x17d448){_0x16d0e1(_0x17d448);}else{_0x82decd(_0x5ccd('0x9'));}}});});};module[_0x5ccd('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 704c015..c2625c8 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 _0x5af4=['indexOf','line','isAutoreply','from','subject','messageId','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','BodyHTML','Attachments','Data','

Empty\x20message

','generateXOAuth2Token','user=','base64','moment','randomstring','util','../../../config/logger','value','address','anonymous','generate','name','split','length','slice','join','Anonymous','head','pop','isEmpty','@xcally.com','test','html','includes','attachments','push','replace','_SRC','_IMG','body','textAsHtml','0x1?_0x52f0fc[_0x45af('0xb')](0x0,-0x1)[_0x45af('0xc')]('\x20'):_0x44c794[_0x45af('0x8')];}return _0x45af('0xd');}function getLastName(_0x117900){var _0x2dfac9=_[_0x45af('0xe')](_0x117900['value']);if(_0x2dfac9&&_0x2dfac9[_0x45af('0x8')]){var _0x1e31b6=_0x2dfac9['name'][_0x45af('0x9')](/\s+/);return _0x1e31b6[_0x45af('0xa')]>0x1?_0x1e31b6[_0x45af('0xf')]():'';}return'';}function getMails(_0x1fc854,_0x5eb34c){var _0x59c25a='';for(var _0x3585c5=0x0;_0x3585c5<_0x5eb34c[_0x45af('0x4')][_0x45af('0xa')];_0x3585c5+=0x1){if(_0x5eb34c[_0x45af('0x4')][_0x3585c5][_0x45af('0x5')]!==_0x1fc854){if(!_[_0x45af('0x10')](_0x59c25a)){_0x59c25a+=',';}_0x59c25a+=_0x5eb34c['value'][_0x3585c5][_0x45af('0x8')]||_0x5eb34c['value'][_0x3585c5]['address']||'';_0x59c25a+='\x20<';_0x59c25a+=_0x5eb34c[_0x45af('0x4')][_0x3585c5]['address']?_0x5eb34c['value'][_0x3585c5][_0x45af('0x5')]:_0x45af('0x6')+random[_0x45af('0x7')](0x6)+_0x45af('0x11');_0x59c25a+='>';}}return _0x59c25a;}function parseEmail(_0x25f9e2,_0x41078b,_0x144fa5){if(_0x41078b['html']){var _0x4fd73b=/)<[^<]*)*<\/script>/gi;while(_0x4fd73b[_0x45af('0x12')](_0x41078b[_0x45af('0x13')])){_0x41078b['html']=_0x41078b[_0x45af('0x13')]['replace'](_0x4fd73b,'');}if(_0x41078b[_0x45af('0x13')][_0x45af('0x14')]('{_0x5af860[_0x45af('0x16')](_0x4f487d['filename']);});var _0x34140b=/]+>/g;var _0x35303f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3a15c5=_0x41078b['html'][_0x45af('0x17')](_0x35303f,_0x45af('0x18'));var _0x139670=_0x3a15c5[_0x45af('0x17')](_0x34140b,_0x45af('0x19'));for(let _0x4b4149=0x0;_0x4b4149<_0x5af860[_0x45af('0xa')];_0x4b4149++){var _0x3337cd=_0x139670[_0x45af('0x17')](_0x45af('0x19'),'\x20[Attachment:\x20'+_0x5af860[_0x4b4149]+'\x20]');_0x139670=_0x3337cd;}_0x41078b[_0x45af('0x13')]=_0x139670;}_0x144fa5[_0x45af('0x1a')]=_0x41078b[_0x45af('0x13')];}else{_0x144fa5[_0x45af('0x1a')]=_0x41078b[_0x45af('0x1b')];}if(_0x144fa5[_0x45af('0x1a')]){_0x144fa5[_0x45af('0x1a')]=_0x144fa5[_0x45af('0x1a')][_0x45af('0x17')](/0x0){var _0x5e129f=['Auto-Submitted:\x20auto-replied',_0x45af('0x2b'),_0x45af('0x2c')];for(var _0x14e8af=0x0;_0x14e8af<_0x41078b['headerLines'][_0x45af('0xa')];_0x14e8af++){var _0x281f3a=_[_0x45af('0x2d')](_0x5e129f,_0x41078b[_0x45af('0x2a')][_0x14e8af][_0x45af('0x2e')]);if(_0x281f3a>=0x0){_0x144fa5[_0x45af('0x2f')]=!![];}}}return _0x144fa5;}exports['parser']=function(_0x4fd0b9,_0x1a0b5e,_0x3d5296){var _0xfe7ca9={'from':getAddress(_0x1a0b5e[_0x45af('0x30')]),'firstName':getFirstName(_0x1a0b5e[_0x45af('0x30')]),'lastName':getLastName(_0x1a0b5e[_0x45af('0x30')]),'mapKey':_0x45af('0x20'),'message':{'from':getMails(_0x4fd0b9[_0x45af('0x20')],_0x1a0b5e[_0x45af('0x30')]),'to':_0x4fd0b9[_0x45af('0x20')],'cc':'','subject':_0x1a0b5e[_0x45af('0x31')]||'','messageId':_0x1a0b5e[_0x45af('0x32')],'inReplyTo':_0x1a0b5e['inReplyTo'],'sentAt':moment(_0x1a0b5e['date'])[_0x45af('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1a0b5e[_0x45af('0x13')]&&!_0x1a0b5e[_0x45af('0x1b')]){var _0x497a5f=_['filter'](_0x1a0b5e['attachments'],{'contentType':_0x45af('0x33')});if(_0x497a5f[_0x45af('0xa')]){logger[_0x45af('0x34')](util[_0x45af('0x25')](_0x45af('0x35'),_0x1a0b5e[_0x45af('0x32')]));tnef[_0x45af('0x36')](_['first'](_0x497a5f)[_0x45af('0x37')],function(_0x12566f,_0x24f9c8){if(_0x24f9c8){_0x1a0b5e['html']=_0x24f9c8[_0x45af('0x38')]||'

Empty\x20message

';if(_0x24f9c8[_0x45af('0x39')]){for(var _0x306eb6=0x0;_0x306eb6<_0x24f9c8[_0x45af('0x39')][_0x45af('0xa')];_0x306eb6++){var _0x56df1e=_0x24f9c8['Attachments'][_0x306eb6];_0xfe7ca9[_0x45af('0x1d')][_0x45af('0x15')]['push']({'filename':_0x56df1e['Title'],'content':Buffer[_0x45af('0x30')](_0x56df1e[_0x45af('0x3a')])});}}}_0x3d5296(parseEmail(_0x4fd0b9,_0x1a0b5e,_0xfe7ca9));});}else{_0x1a0b5e[_0x45af('0x13')]=_0x45af('0x3b');_0x3d5296(parseEmail(_0x4fd0b9,_0x1a0b5e,_0xfe7ca9));}}else{_0x3d5296(parseEmail(_0x4fd0b9,_0x1a0b5e,_0xfe7ca9));}};exports[_0x45af('0x3c')]=function(_0x4ce22e,_0x4a3591){var _0x401fd7=[_0x45af('0x3d')+(_0x4a3591||''),'auth=Bearer\x20'+_0x4ce22e,'',''];return Buffer[_0x45af('0x30')](_0x401fd7[_0x45af('0xc')](''),'utf-8')['toString'](_0x45af('0x3e'));}; \ No newline at end of file +var _0xfe77=['format','filter','application/ms-tnef','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','../../../config/environment','head','address','generate','@xcally.com','value','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','attachments','forEach','filename','replace','_IMG','\x20]','body','textAsHtml','message','originTo','email','originCc','bcc','type','attachment','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date'];(function(_0x37dd9d,_0x317c54){var _0x33ec83=function(_0x243af0){while(--_0x243af0){_0x37dd9d['push'](_0x37dd9d['shift']());}};_0x33ec83(++_0x317c54);}(_0xfe77,0x133));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fe7('0x0'));var moment=require(_0x7fe7('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x7fe7('0x2'));var util=require(_0x7fe7('0x3'));var tnef=require(_0x7fe7('0x4'));var logger=require('../../../config/logger')('email');var config=require(_0x7fe7('0x5'));function getAddress(_0x30adc1){var _0x395f41=_[_0x7fe7('0x6')](_0x30adc1['value']);return _0x395f41&&_0x395f41[_0x7fe7('0x7')]?_0x395f41['address']:'anonymous'+random[_0x7fe7('0x8')](0x6)+_0x7fe7('0x9');}function getFirstName(_0x4b3d64){var _0x41992f=_[_0x7fe7('0x6')](_0x4b3d64[_0x7fe7('0xa')]);if(_0x41992f&&_0x41992f[_0x7fe7('0xb')]){if(_0x41992f[_0x7fe7('0xb')]==_0x41992f[_0x7fe7('0x7')]){return _0x41992f[_0x7fe7('0xb')]['substring'](0x0,_0x41992f[_0x7fe7('0xb')][_0x7fe7('0xc')]('@'));}var _0x5e3892=_0x41992f[_0x7fe7('0xb')][_0x7fe7('0xd')](/\s+/);return _0x5e3892[_0x7fe7('0xe')]>0x1?_0x5e3892[_0x7fe7('0xf')](0x0,-0x1)[_0x7fe7('0x10')]('\x20'):_0x41992f['name'];}return _0x7fe7('0x11');}function getLastName(_0x429b45){var _0x7952bf=_[_0x7fe7('0x6')](_0x429b45[_0x7fe7('0xa')]);if(_0x7952bf&&_0x7952bf[_0x7fe7('0xb')]){var _0x54530f=_0x7952bf['name'][_0x7fe7('0xd')](/\s+/);return _0x54530f[_0x7fe7('0xe')]>0x1?_0x54530f[_0x7fe7('0x12')]():'';}return'';}function getMails(_0x479b80,_0x38e712){var _0x2e7c64='';for(var _0xa410e0=0x0;_0xa410e0<_0x38e712[_0x7fe7('0xa')]['length'];_0xa410e0+=0x1){if(_0x38e712[_0x7fe7('0xa')][_0xa410e0][_0x7fe7('0x7')]!==_0x479b80){if(!_[_0x7fe7('0x13')](_0x2e7c64)){_0x2e7c64+=',';}_0x2e7c64+=_0x38e712[_0x7fe7('0xa')][_0xa410e0][_0x7fe7('0xb')]||_0x38e712['value'][_0xa410e0]['address']||'';_0x2e7c64+='\x20<';_0x2e7c64+=_0x38e712[_0x7fe7('0xa')][_0xa410e0][_0x7fe7('0x7')]?_0x38e712['value'][_0xa410e0][_0x7fe7('0x7')]:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x2e7c64+='>';}}return _0x2e7c64;}function parseEmail(_0x50d1d4,_0x335cdb,_0xf6f15){if(_0x335cdb[_0x7fe7('0x14')]){var _0x23e99b=/)<[^<]*)*<\/script>/gi;while(_0x23e99b[_0x7fe7('0x15')](_0x335cdb[_0x7fe7('0x14')])){_0x335cdb[_0x7fe7('0x14')]=_0x335cdb[_0x7fe7('0x14')]['replace'](_0x23e99b,'');}if(_0x335cdb[_0x7fe7('0x14')][_0x7fe7('0x16')]('{_0x5a792f['push'](_0x255616[_0x7fe7('0x19')]);});var _0x39dc11=/]+>/g;var _0x458a75=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xbf5c16=_0x335cdb[_0x7fe7('0x14')]['replace'](_0x458a75,'_SRC');var _0x5e5a16=_0xbf5c16[_0x7fe7('0x1a')](_0x39dc11,'_IMG');for(let _0x2bb055=0x0;_0x2bb055<_0x5a792f['length'];_0x2bb055++){var _0x33bf9b=_0x5e5a16['replace'](_0x7fe7('0x1b'),'\x20[Attachment:\x20'+_0x5a792f[_0x2bb055]+_0x7fe7('0x1c'));_0x5e5a16=_0x33bf9b;}_0x335cdb['html']=_0x5e5a16;}_0xf6f15[_0x7fe7('0x1d')]=_0x335cdb[_0x7fe7('0x14')];}else{_0xf6f15[_0x7fe7('0x1d')]=_0x335cdb[_0x7fe7('0x1e')];}if(_0xf6f15['body']){_0xf6f15['body']=_0xf6f15[_0x7fe7('0x1d')][_0x7fe7('0x1a')](/0x0){var _0x53f102=[_0x7fe7('0x2f'),_0x7fe7('0x30'),_0x7fe7('0x31')];for(var _0x22ab2e=0x0;_0x22ab2e<_0x335cdb[_0x7fe7('0x2e')][_0x7fe7('0xe')];_0x22ab2e++){var _0x3bef8e=_[_0x7fe7('0xc')](_0x53f102,_0x335cdb[_0x7fe7('0x2e')][_0x22ab2e][_0x7fe7('0x32')]);if(_0x3bef8e>=0x0){_0xf6f15[_0x7fe7('0x33')]=!![];}}}return _0xf6f15;}exports[_0x7fe7('0x34')]=function(_0x57a8a6,_0x37565f,_0x1f2d66){var _0x21af6c={'from':getAddress(_0x37565f[_0x7fe7('0x35')]),'firstName':getFirstName(_0x37565f[_0x7fe7('0x35')]),'lastName':getLastName(_0x37565f[_0x7fe7('0x35')]),'mapKey':_0x7fe7('0x21'),'message':{'from':getMails(_0x57a8a6[_0x7fe7('0x21')],_0x37565f[_0x7fe7('0x35')]),'to':_0x57a8a6['email'],'cc':'','subject':_0x37565f[_0x7fe7('0x36')]||'','messageId':_0x37565f[_0x7fe7('0x37')],'inReplyTo':_0x37565f[_0x7fe7('0x38')],'sentAt':moment(_0x37565f[_0x7fe7('0x39')])[_0x7fe7('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x37565f[_0x7fe7('0x14')]&&!_0x37565f[_0x7fe7('0x1e')]){var _0x5e088a=_[_0x7fe7('0x3b')](_0x37565f[_0x7fe7('0x17')],{'contentType':_0x7fe7('0x3c')});if(_0x5e088a[_0x7fe7('0xe')]){logger['info'](util[_0x7fe7('0x3a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x37565f[_0x7fe7('0x37')]));tnef[_0x7fe7('0x3d')](_[_0x7fe7('0x3e')](_0x5e088a)[_0x7fe7('0x2b')],function(_0x2b0247,_0x365aaa){if(_0x365aaa){_0x37565f[_0x7fe7('0x14')]=_0x365aaa[_0x7fe7('0x3f')]||_0x7fe7('0x40');if(_0x365aaa[_0x7fe7('0x41')]){for(var _0x3863dd=0x0;_0x3863dd<_0x365aaa['Attachments'][_0x7fe7('0xe')];_0x3863dd++){var _0x3f751d=_0x365aaa['Attachments'][_0x3863dd];_0x21af6c['message'][_0x7fe7('0x17')]['push']({'filename':_0x3f751d[_0x7fe7('0x42')],'content':Buffer[_0x7fe7('0x35')](_0x3f751d[_0x7fe7('0x43')])});}}}_0x1f2d66(parseEmail(_0x57a8a6,_0x37565f,_0x21af6c));});}else{_0x37565f[_0x7fe7('0x14')]='

Empty\x20message

';_0x1f2d66(parseEmail(_0x57a8a6,_0x37565f,_0x21af6c));}}else{_0x1f2d66(parseEmail(_0x57a8a6,_0x37565f,_0x21af6c));}};exports['generateXOAuth2Token']=function(_0x21c89a,_0x151465){var _0x27b4ba=[_0x7fe7('0x44')+(_0x151465||''),_0x7fe7('0x45')+_0x21c89a,'',''];return Buffer[_0x7fe7('0x35')](_0x27b4ba['join'](''),_0x7fe7('0x46'))[_0x7fe7('0x47')](_0x7fe7('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8262048..edaaf42 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8326=['SERV','active','Imap','Smtp','lodash','name','Service','key'];(function(_0x33c797,_0x430c30){var _0x514ff7=function(_0x17920c){while(--_0x17920c){_0x33c797['push'](_0x33c797['shift']());}};_0x514ff7(++_0x430c30);}(_0x8326,0x144));var _0x6832=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0x8326[_0x23fd1b];return _0x304e83;};'use strict';var _=require(_0x6832('0x0'));function MailAccount(_0x59bec8){this['id']=_0x59bec8['id']||0x0;this[_0x6832('0x1')]=_0x59bec8[_0x6832('0x1')]||_0x6832('0x2');this[_0x6832('0x3')]=_0x59bec8[_0x6832('0x3')]||_0x6832('0x4');this[_0x6832('0x5')]=_0x59bec8[_0x6832('0x5')]||![];this[_0x6832('0x6')]=_0x59bec8[_0x6832('0x6')]||[];this[_0x6832('0x7')]=_0x59bec8[_0x6832('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x29f7=['Imap','Smtp','exports','lodash','name','key','SERV','active'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x29f7,0x1f3));var _0x729f=function(_0x594a50,_0x3d18a9){_0x594a50=_0x594a50-0x0;var _0x3953e1=_0x29f7[_0x594a50];return _0x3953e1;};'use strict';var _=require(_0x729f('0x0'));function MailAccount(_0x31cd24){this['id']=_0x31cd24['id']||0x0;this['name']=_0x31cd24[_0x729f('0x1')]||'Service';this[_0x729f('0x2')]=_0x31cd24[_0x729f('0x2')]||_0x729f('0x3');this[_0x729f('0x4')]=_0x31cd24['active']||![];this[_0x729f('0x5')]=_0x31cd24[_0x729f('0x5')]||[];this[_0x729f('0x6')]=_0x31cd24[_0x729f('0x6')]||[];}module[_0x729f('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c45ecb8..27450c4 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb33c=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0xa335e6,_0x207280){var _0x3ffdd8=function(_0x4a4f6e){while(--_0x4a4f6e){_0xa335e6['push'](_0xa335e6['shift']());}};_0x3ffdd8(++_0x207280);}(_0xb33c,0xac));var _0xcb33=function(_0x147a64,_0x21ed26){_0x147a64=_0x147a64-0x0;var _0x4a2767=_0xb33c[_0x147a64];return _0x4a2767;};'use strict';var _=require(_0xcb33('0x0'));var MailAccount=require(_0xcb33('0x1'));var Realtime=function(){this[_0xcb33('0x2')]={};};function freeIsNotKey(_0x3f5556,_0x4c4d91,_0x132174){var _0xed386b=_[_0xcb33('0x3')](_0x3f5556,function(_0x32827e,_0x3b255e){return _0x32827e[_0x132174];});for(var _0x542b6b in _0x4c4d91){if(_0x4c4d91['hasOwnProperty'](_0x542b6b)){if(!_0xed386b[_0x542b6b]){delete _0x4c4d91[_0x542b6b];}}}}Realtime[_0xcb33('0x4')][_0xcb33('0x5')]=function(_0x13107b,_0x4d7ea6){for(var _0x39318e in _0x4d7ea6){if(_0x13107b[_0xcb33('0x6')](_0x39318e)){_0x13107b[_0x39318e]=_0x4d7ea6[_0x39318e];}}};Realtime[_0xcb33('0x4')][_0xcb33('0x7')]=function(){var _0x4f93d8=this;return function(_0x5a22f2){if(_0x5a22f2){freeIsNotKey(_0x5a22f2,_0x4f93d8[_0xcb33('0x2')],'id');for(var _0xe6d3c0=0x0,_0x47396b={},_0x41ad67={};_0xe6d3c0<_0x5a22f2[_0xcb33('0x8')];_0xe6d3c0+=0x1){_0x47396b=_0x5a22f2[_0xe6d3c0];if(_['isUndefined'](_0x4f93d8['mailAccounts'][_0x47396b['id']])){_0x4f93d8[_0xcb33('0x2')][_0x47396b['id']]=new MailAccount(_0x47396b);}else{_[_0xcb33('0x9')](_0x4f93d8[_0xcb33('0x2')][_0x47396b['id']],_0x47396b);}}}return _0x4f93d8[_0xcb33('0x2')];};};module[_0xcb33('0xa')]=Realtime; \ No newline at end of file +var _0x6cf7=['lodash','../model/mailAccount','mailAccounts','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports'];(function(_0xa4aa5e,_0x1540fc){var _0x4a05ca=function(_0x47ee80){while(--_0x47ee80){_0xa4aa5e['push'](_0xa4aa5e['shift']());}};_0x4a05ca(++_0x1540fc);}(_0x6cf7,0x1d6));var _0x76cf=function(_0x3dc55d,_0xd07e93){_0x3dc55d=_0x3dc55d-0x0;var _0x3aa7f3=_0x6cf7[_0x3dc55d];return _0x3aa7f3;};'use strict';var _=require(_0x76cf('0x0'));var MailAccount=require(_0x76cf('0x1'));var Realtime=function(){this[_0x76cf('0x2')]={};};function freeIsNotKey(_0x26a005,_0xd0270f,_0x2ce4fe){var _0x34332f=_['mapKeys'](_0x26a005,function(_0x12d93d,_0x3b1913){return _0x12d93d[_0x2ce4fe];});for(var _0x5e56ed in _0xd0270f){if(_0xd0270f['hasOwnProperty'](_0x5e56ed)){if(!_0x34332f[_0x5e56ed]){delete _0xd0270f[_0x5e56ed];}}}}Realtime[_0x76cf('0x3')][_0x76cf('0x4')]=function(_0x4bcdf4,_0x1e4595){for(var _0x1c4464 in _0x1e4595){if(_0x4bcdf4['hasOwnProperty'](_0x1c4464)){_0x4bcdf4[_0x1c4464]=_0x1e4595[_0x1c4464];}}};Realtime[_0x76cf('0x3')][_0x76cf('0x5')]=function(){var _0x38a2d8=this;return function(_0x27ab66){if(_0x27ab66){freeIsNotKey(_0x27ab66,_0x38a2d8['mailAccounts'],'id');for(var _0x5d81f2=0x0,_0x1d4b43={},_0x6d462f={};_0x5d81f2<_0x27ab66[_0x76cf('0x6')];_0x5d81f2+=0x1){_0x1d4b43=_0x27ab66[_0x5d81f2];if(_[_0x76cf('0x7')](_0x38a2d8[_0x76cf('0x2')][_0x1d4b43['id']])){_0x38a2d8[_0x76cf('0x2')][_0x1d4b43['id']]=new MailAccount(_0x1d4b43);}else{_[_0x76cf('0x8')](_0x38a2d8[_0x76cf('0x2')][_0x1d4b43['id']],_0x1d4b43);}}}return _0x38a2d8[_0x76cf('0x2')];};};module[_0x76cf('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 01affe0..e4d4c3b 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74af=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active','key','ListId','TemplateId','MailServerIn','Imap','service','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x74af,0x178));var _0xf74a=function(_0x2700b8,_0x1f1a88){_0x2700b8=_0x2700b8-0x0;var _0x4afc0f=_0x74af[_0x2700b8];return _0x4afc0f;};'use strict';var client=require(_0xf74a('0x0'));exports[_0xf74a('0x1')]=function(){return function(){return client[_0xf74a('0x2')](_0xf74a('0x3'),{'options':{'attributes':['id',_0xf74a('0x4'),_0xf74a('0x5'),'service',_0xf74a('0x6'),_0xf74a('0x7'),_0xf74a('0x8'),_0xf74a('0x9'),_0xf74a('0xa')],'raw':![],'include':[{'model':_0xf74a('0xb'),'as':_0xf74a('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0xf74a('0x4'),_0xf74a('0xd'),_0xf74a('0xe'),_0xf74a('0xf')],'as':_0xf74a('0x10')}]},{'model':_0xf74a('0x11'),'as':_0xf74a('0x12'),'include':[{'model':_0xf74a('0x10'),'attributes':['id',_0xf74a('0x4'),_0xf74a('0xd'),_0xf74a('0xe'),_0xf74a('0xf')],'as':_0xf74a('0x10')}]}]},'log':_0xf74a('0x13')});};};exports[_0xf74a('0x14')]=function(_0x548260,_0x1289b1){return client['Request'](_0xf74a('0x15'),{'account':{'id':_0x548260},'body':_0x1289b1,'log':_0xf74a('0x15')});}; \ No newline at end of file +var _0x5078=['CloudProvider','type','data5','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5078,0x148));var _0x8507=function(_0x3ee4d1,_0x35cbfd){_0x3ee4d1=_0x3ee4d1-0x0;var _0x24b28a=_0x5078[_0x3ee4d1];return _0x24b28a;};'use strict';var client=require(_0x8507('0x0'));exports[_0x8507('0x1')]=function(){return function(){return client[_0x8507('0x2')](_0x8507('0x3'),{'options':{'attributes':['id',_0x8507('0x4'),_0x8507('0x5'),_0x8507('0x6'),_0x8507('0x7'),_0x8507('0x8'),_0x8507('0x9'),_0x8507('0xa'),_0x8507('0xb')],'raw':![],'include':[{'model':_0x8507('0xc'),'as':_0x8507('0xd'),'include':[{'model':_0x8507('0xe'),'attributes':['id',_0x8507('0x4'),'service',_0x8507('0xf'),_0x8507('0x10')],'as':_0x8507('0xe')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x8507('0xe'),'attributes':['id',_0x8507('0x4'),_0x8507('0x6'),_0x8507('0xf'),_0x8507('0x10')],'as':_0x8507('0xe')}]}]},'log':_0x8507('0x11')});};};exports['notify']=function(_0x344a8e,_0x2c2bd5){return client[_0x8507('0x2')](_0x8507('0x12'),{'account':{'id':_0x344a8e},'body':_0x2c2bd5,'log':_0x8507('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index dfabdc2..28da8dc 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b2=['getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x4d4db5,_0x3bcc08){var _0x5d5e6e=function(_0x266c11){while(--_0x266c11){_0x4d4db5['push'](_0x4d4db5['shift']());}};_0x5d5e6e(++_0x3bcc08);}(_0xa1b2,0x7c));var _0x2a1b=function(_0x4db577,_0x50ed06){_0x4db577=_0x4db577-0x0;var _0x33b938=_0xa1b2[_0x4db577];return _0x33b938;};'use strict';var client=require('../client');exports[_0x2a1b('0x0')]=function(){return client[_0x2a1b('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2a1b('0x2')]},'log':_0x2a1b('0x3')});}; \ No newline at end of file +var _0x1180=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x39be4d,_0x44ae6d){var _0xc72d4c=function(_0x370a2a){while(--_0x370a2a){_0x39be4d['push'](_0x39be4d['shift']());}};_0xc72d4c(++_0x44ae6d);}(_0x1180,0x193));var _0x0118=function(_0x5609ac,_0x1371bb){_0x5609ac=_0x5609ac-0x0;var _0x223aa1=_0x1180[_0x5609ac];return _0x223aa1;};'use strict';var client=require(_0x0118('0x0'));exports[_0x0118('0x1')]=function(){return client[_0x0118('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0118('0x3')]},'log':_0x0118('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0f6bb66..36c5d99 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index d603778..63e7d0d 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe845=['timeout','listen','port','socket.io','websocket','polling','redis','defaults','../../config/socketio','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','ioredis','../../config/environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe845,0xa6));var _0x5e84=function(_0xfca055,_0x10db1c){_0xfca055=_0xfca055-0x0;var _0x172894=_0xe845[_0xfca055];return _0x172894;};'use strict';var _=require('lodash');var http=require(_0x5e84('0x0'));var express=require(_0x5e84('0x1'));var sticky=require('sticky-session');var Redis=require(_0x5e84('0x2'));var config=require(_0x5e84('0x3'));var app=express();var server=http['createServer'](app);server[_0x5e84('0x4')]=0xdbba0;if(sticky[_0x5e84('0x5')](server,config[_0x5e84('0x6')])){var socketio=require(_0x5e84('0x7'))(server,{'transports':[_0x5e84('0x8'),_0x5e84('0x9')]});config[_0x5e84('0xa')]=_[_0x5e84('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x5e84('0xa')]),'subClient':new Redis(config[_0x5e84('0xa')])}));require('../../config/triggers')['default']();require(_0x5e84('0xc'))['default'](socketio);require('../../config/express')['default'](app);require('../../routes')['default'](app);}else{server['once'](_0x5e84('0xd'),function(){console[_0x5e84('0xe')](_0x5e84('0xf'),config[_0x5e84('0x6')]);});}exports=module[_0x5e84('0x10')]=app; \ No newline at end of file +var _0x5d92=['socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/socketio','default','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','listen','port'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x5d92,0x11a));var _0x25d9=function(_0x1811ca,_0x41bfc3){_0x1811ca=_0x1811ca-0x0;var _0x20ec80=_0x5d92[_0x1811ca];return _0x20ec80;};'use strict';var _=require(_0x25d9('0x0'));var http=require(_0x25d9('0x1'));var express=require(_0x25d9('0x2'));var sticky=require(_0x25d9('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x25d9('0x4')](server,config[_0x25d9('0x5')])){var socketio=require(_0x25d9('0x6'))(server,{'transports':[_0x25d9('0x7'),_0x25d9('0x8')]});config[_0x25d9('0x9')]=_[_0x25d9('0xa')](config[_0x25d9('0x9')],{'host':_0x25d9('0xb'),'port':0x18eb});socketio['adapter'](require(_0x25d9('0xc'))({'pubClient':new Redis(config[_0x25d9('0x9')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x25d9('0xd'))[_0x25d9('0xe')](socketio);require('../../config/express')[_0x25d9('0xe')](app);require('../../routes')[_0x25d9('0xe')](app);}else{server['once'](_0x25d9('0xf'),function(){console[_0x25d9('0x10')](_0x25d9('0x11'),config[_0x25d9('0x5')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 67d770c..8597b45 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2412=['client','http','Request','request','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x244047,_0x32f924){var _0xfe8007=function(_0x60d786){while(--_0x60d786){_0x244047['push'](_0x244047['shift']());}};_0xfe8007(++_0x32f924);}(_0x2412,0x74));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x2241('0x0'));var BPromise=require(_0x2241('0x1'));var logger=require(_0x2241('0x2'))(_0x2241('0x3'));var client=jayson[_0x2241('0x4')][_0x2241('0x5')]({'port':0x2329});client[_0x2241('0x6')]=function(_0x55939b,_0x8dd8d9){return new BPromise(function(_0x4ea142,_0x596a50){return client[_0x2241('0x7')](_0x55939b,_0x8dd8d9)['then'](function(_0x4c9861){logger[_0x2241('0x8')]('rpc',_0x2241('0x3'),_0x55939b,_0x8dd8d9,_0x4c9861);if(_0x4c9861[_0x2241('0x9')]){logger[_0x2241('0x9')](_0x2241('0xa'),'routing',_0x55939b,_0x4c9861['error'][_0x2241('0xb')],_0x8dd8d9);return _0x596a50(_0x4c9861[_0x2241('0x9')][_0x2241('0xb')]);}else{return _0x4ea142(_0x4c9861[_0x2241('0xc')]);}})[_0x2241('0xd')](function(_0x22d3ba){logger[_0x2241('0x9')]('rpc',_0x2241('0x3'),_0x55939b,_0x22d3ba,_0x8dd8d9);return _0x596a50(_0x22d3ba);});});};module[_0x2241('0xe')]=client; \ No newline at end of file +var _0x5b90=['exports','jayson/promise','bluebird','routing','client','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x5be1d6,_0x52ab2a){var _0x5d9bd4=function(_0x4f05ba){while(--_0x4f05ba){_0x5be1d6['push'](_0x5be1d6['shift']());}};_0x5d9bd4(++_0x52ab2a);}(_0x5b90,0x7f));var _0x05b9=function(_0x131916,_0x8eb089){_0x131916=_0x131916-0x0;var _0x283e61=_0x5b90[_0x131916];return _0x283e61;};'use strict';var jayson=require(_0x05b9('0x0'));var BPromise=require(_0x05b9('0x1'));var logger=require('../../config/logger')(_0x05b9('0x2'));var client=jayson[_0x05b9('0x3')]['http']({'port':0x2329});client[_0x05b9('0x4')]=function(_0x2e83eb,_0x75d492){return new BPromise(function(_0x5c3958,_0x43b83b){return client[_0x05b9('0x5')](_0x2e83eb,_0x75d492)[_0x05b9('0x6')](function(_0x2a6927){logger[_0x05b9('0x7')](_0x05b9('0x8'),_0x05b9('0x2'),_0x2e83eb,_0x75d492,_0x2a6927);if(_0x2a6927[_0x05b9('0x9')]){logger['error']('rpc','routing',_0x2e83eb,_0x2a6927[_0x05b9('0x9')]['message'],_0x75d492);return _0x43b83b(_0x2a6927[_0x05b9('0x9')][_0x05b9('0xa')]);}else{return _0x5c3958(_0x2a6927[_0x05b9('0xb')]);}})[_0x05b9('0xc')](function(_0x443f6d){logger[_0x05b9('0x9')](_0x05b9('0x8'),_0x05b9('0x2'),_0x2e83eb,_0x443f6d,_0x75d492);return _0x43b83b(_0x443f6d);});});};module[_0x05b9('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ddbe060..5ec58bc 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21bf=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x2d6919,_0x514f66){var _0x9057e5=function(_0x563448){while(--_0x563448){_0x2d6919['push'](_0x2d6919['shift']());}};_0x9057e5(++_0x514f66);}(_0x21bf,0x7b));var _0xf21b=function(_0x6d967,_0x3bddfd){_0x6d967=_0x6d967-0x0;var _0x383869=_0x21bf[_0x6d967];return _0x383869;};'use strict';var BPromise=require(_0xf21b('0x0'));var server=require(_0xf21b('0x1'));var Realtime=require('./realtime');var user=require(_0xf21b('0x2'));var interval=require(_0xf21b('0x3'));var openchannelQueue=require(_0xf21b('0x4'));var chatQueue=require(_0xf21b('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xf21b('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xf21b('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf21b('0x8')]()[_0xf21b('0x9')](user[_0xf21b('0xa')]())['then'](realtime[_0xf21b('0xb')]())['then'](interval[_0xf21b('0xc')]())[_0xf21b('0x9')](realtime[_0xf21b('0xd')]())[_0xf21b('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xf21b('0x9')](realtime[_0xf21b('0xe')]())[_0xf21b('0x9')](chatQueue[_0xf21b('0xf')]())['then'](realtime[_0xf21b('0x10')]())[_0xf21b('0x9')](smsQueue['getSmsQueues']())[_0xf21b('0x9')](realtime['initSmsQueues']())['then'](mailQueue[_0xf21b('0x11')]())[_0xf21b('0x9')](realtime[_0xf21b('0x12')]())[_0xf21b('0x9')](faxQueue['getFaxQueues']())[_0xf21b('0x9')](realtime[_0xf21b('0x13')]())[_0xf21b('0x9')](whatsappQueue[_0xf21b('0x14')]())[_0xf21b('0x9')](realtime[_0xf21b('0x15')]())[_0xf21b('0x9')](function(){return realtime;});}function main(){return server[_0xf21b('0x16')](realtime)[_0xf21b('0x9')](function(_0x133b28){return initRealtime();})['then'](function(_0x1b944d){return setInterval(initRealtime,0x1388);})[_0xf21b('0x17')](function(_0x15ca7e){console[_0xf21b('0x18')](_0x15ca7e);});}main(); \ No newline at end of file +var _0xd659=['resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x21f56d,_0x17d68e){var _0x1f0e11=function(_0x4635b2){while(--_0x4635b2){_0x21f56d['push'](_0x21f56d['shift']());}};_0x1f0e11(++_0x17d68e);}(_0xd659,0x147));var _0x9d65=function(_0xc3ac55,_0x52d626){_0xc3ac55=_0xc3ac55-0x0;var _0x34c0e7=_0xd659[_0xc3ac55];return _0x34c0e7;};'use strict';var BPromise=require(_0x9d65('0x0'));var server=require('./server');var Realtime=require(_0x9d65('0x1'));var user=require(_0x9d65('0x2'));var interval=require(_0x9d65('0x3'));var openchannelQueue=require(_0x9d65('0x4'));var chatQueue=require(_0x9d65('0x5'));var smsQueue=require(_0x9d65('0x6'));var mailQueue=require(_0x9d65('0x7'));var faxQueue=require(_0x9d65('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x9d65('0x9')]()[_0x9d65('0xa')](user[_0x9d65('0xb')]())[_0x9d65('0xa')](realtime[_0x9d65('0xc')]())[_0x9d65('0xa')](interval[_0x9d65('0xd')]())[_0x9d65('0xa')](realtime[_0x9d65('0xe')]())[_0x9d65('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x9d65('0xa')](realtime[_0x9d65('0xf')]())[_0x9d65('0xa')](chatQueue['getChatQueues']())[_0x9d65('0xa')](realtime['initChatQueues']())['then'](smsQueue[_0x9d65('0x10')]())[_0x9d65('0xa')](realtime['initSmsQueues']())[_0x9d65('0xa')](mailQueue[_0x9d65('0x11')]())['then'](realtime[_0x9d65('0x12')]())[_0x9d65('0xa')](faxQueue[_0x9d65('0x13')]())[_0x9d65('0xa')](realtime['initFaxQueues']())[_0x9d65('0xa')](whatsappQueue[_0x9d65('0x14')]())[_0x9d65('0xa')](realtime[_0x9d65('0x15')]())[_0x9d65('0xa')](function(){return realtime;});}function main(){return server[_0x9d65('0x16')](realtime)['then'](function(_0x3e7849){return initRealtime();})['then'](function(_0x1a731d){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4b9729){console[_0x9d65('0x17')](_0x4b9729);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index cc206f4..55b4853 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x1870f8,_0x207d93){var _0x1d7bf7=function(_0x3e7d3a){while(--_0x3e7d3a){_0x1870f8['push'](_0x1870f8['shift']());}};_0x1d7bf7(++_0x207d93);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x30e6cc,_0x38cd70){var _0x203473=function(_0x364731){while(--_0x364731){_0x30e6cc['push'](_0x30e6cc['shift']());}};_0x203473(++_0x38cd70);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x5fc3[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f3bba41..ac455c5 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f4d=['message','result','catch','SendMail','bluebird','jayson/promise','request','then','error'];(function(_0x116a41,_0x46e23b){var _0x348cb3=function(_0x40647d){while(--_0x40647d){_0x116a41['push'](_0x116a41['shift']());}};_0x348cb3(++_0x46e23b);}(_0x6f4d,0x1ab));var _0xd6f4=function(_0x170bcd,_0xf33f75){_0x170bcd=_0x170bcd-0x0;var _0x39cb12=_0x6f4d[_0x170bcd];return _0x39cb12;};'use strict';var BPromise=require(_0xd6f4('0x0'));var jayson=require(_0xd6f4('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x167bcf,_0x5b5163){return new BPromise(function(_0x4c1c57,_0xfa9bc1){return client[_0xd6f4('0x2')](_0x167bcf,_0x5b5163)[_0xd6f4('0x3')](function(_0xf09cd1){if(_0xf09cd1[_0xd6f4('0x4')]){return _0xfa9bc1(_0xf09cd1[_0xd6f4('0x4')][_0xd6f4('0x5')]);}else{return _0x4c1c57(_0xf09cd1[_0xd6f4('0x6')]);}})[_0xd6f4('0x7')](function(_0x30dd78){return _0xfa9bc1(_0x30dd78);});});}exports['sendMailMessage']=function(_0x54f70f,_0x4d7c5e){return request(_0xd6f4('0x8'),{'account':_0x54f70f,'message':_0x4d7c5e});}; \ No newline at end of file +var _0xb344=['message','result','catch','sendMailMessage','jayson/promise','http','request','error'];(function(_0x36b045,_0x9127d4){var _0x319575=function(_0x19a102){while(--_0x19a102){_0x36b045['push'](_0x36b045['shift']());}};_0x319575(++_0x9127d4);}(_0xb344,0x7c));var _0x4b34=function(_0x3a223a,_0x303433){_0x3a223a=_0x3a223a-0x0;var _0xb6ac7d=_0xb344[_0x3a223a];return _0xb6ac7d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4b34('0x0'));var client=jayson['client'][_0x4b34('0x1')]({'port':0x232b});function request(_0x563364,_0x73d97a){return new BPromise(function(_0x49fa62,_0xac15e3){return client[_0x4b34('0x2')](_0x563364,_0x73d97a)['then'](function(_0x2aac20){if(_0x2aac20[_0x4b34('0x3')]){return _0xac15e3(_0x2aac20[_0x4b34('0x3')][_0x4b34('0x4')]);}else{return _0x49fa62(_0x2aac20[_0x4b34('0x5')]);}})[_0x4b34('0x6')](function(_0x229f39){return _0xac15e3(_0x229f39);});});}exports[_0x4b34('0x7')]=function(_0x360005,_0x118ed5){return request('SendMail',{'account':_0x360005,'message':_0x118ed5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ffbf64a..2e28f5c 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xece7=['faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','fax','sms','Status','StatusTime','toNumber','format','chatStatus','smsStatus','openchannelStatus','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','emit','exports','lodash','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity'];(function(_0x559720,_0x4d3062){var _0x4c51ff=function(_0x4fc989){while(--_0x4fc989){_0x559720['push'](_0x559720['shift']());}};_0x4c51ff(++_0x4d3062);}(_0xece7,0x1ee));var _0x7ece=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xece7[_0x568a61];return _0x334c3b;};'use strict';var _=require(_0x7ece('0x0'));var moment=require(_0x7ece('0x1'));var md5=require('md5');var Redis=require(_0x7ece('0x2'));var config=require('../../../config/environment');config[_0x7ece('0x3')]=_[_0x7ece('0x4')](config['redis'],{'host':_0x7ece('0x5'),'port':0x18eb});var io=require(_0x7ece('0x6'))(new Redis(config[_0x7ece('0x3')]));function Agent(_0x121fde){this['id']=_0x121fde['id']||0x0;this[_0x7ece('0x7')]=_0x121fde[_0x7ece('0x7')]||'';this[_0x7ece('0x8')]=_0x121fde[_0x7ece('0x8')]||!![];this['voicePause']=_0x121fde[_0x7ece('0x9')]||![];this['chatPause']=_0x121fde[_0x7ece('0xa')]||![];this[_0x7ece('0xb')]=_0x121fde[_0x7ece('0xb')]||![];this[_0x7ece('0xc')]=_0x121fde[_0x7ece('0xc')]||![];this[_0x7ece('0xd')]=_0x121fde[_0x7ece('0xd')]||![];this[_0x7ece('0xe')]=_0x121fde[_0x7ece('0xe')]||![];this['chatStatus']=_0x7ece('0xf');this[_0x7ece('0x10')]=0x0;this[_0x7ece('0x11')]=_0x121fde[_0x7ece('0x11')]||0x0;this[_0x7ece('0x12')]=0x0;this[_0x7ece('0x13')]=_0x7ece('0xf');this[_0x7ece('0x14')]=0x0;this[_0x7ece('0x15')]=_0x121fde['mailCapacity']||0x0;this[_0x7ece('0x16')]=0x0;this[_0x7ece('0x17')]='unknown';this[_0x7ece('0x18')]=0x0;this[_0x7ece('0x19')]=_0x121fde[_0x7ece('0x19')]||0x0;this[_0x7ece('0x1a')]=0x0;this['smsStatus']=_0x7ece('0xf');this[_0x7ece('0x1b')]=0x0;this[_0x7ece('0x1c')]=_0x121fde[_0x7ece('0x1c')]||0x0;this[_0x7ece('0x1d')]=0x0;this[_0x7ece('0x1e')]='unknown';this[_0x7ece('0x1f')]=0x0;this['whatsappCapacity']=_0x121fde[_0x7ece('0x20')]||0x0;this[_0x7ece('0x21')]=0x0;this['openchannelStatus']=_0x7ece('0xf');this[_0x7ece('0x22')]=0x0;this[_0x7ece('0x23')]=_0x121fde[_0x7ece('0x23')]||0x0;this[_0x7ece('0x24')]=0x0;this['busy']=![];this[_0x7ece('0x25')]=undefined;this[_0x7ece('0x26')]='';this['chatWaitingInteractions']={};this[_0x7ece('0x27')]={};this[_0x7ece('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x7ece('0x29')]={};this['whatsappWaitingInteractions']={};this[_0x7ece('0x2a')]();}Agent[_0x7ece('0x2b')][_0x7ece('0x2c')]=function(_0x78efc8){if(this[_0x78efc8+_0x7ece('0x2d')]>0x0){if(this[_0x78efc8+'Capacity']>0x0&&this[_0x78efc8+_0x7ece('0x2d')]>=this[_0x78efc8+'Capacity']){return _0x7ece('0x2e');}else{return _0x7ece('0x2f');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x19b4dd=[_0x7ece('0x30'),_0x7ece('0x31'),_0x7ece('0x32'),_0x7ece('0x33'),_0x7ece('0x34'),'whatsapp'];for(var _0x59c2fb=0x0;_0x59c2fb<_0x19b4dd['length'];_0x59c2fb+=0x1){var _0x4e31b4=this['getChannelStatus'](_0x19b4dd[_0x59c2fb]);if(this[_0x19b4dd[_0x59c2fb]+_0x7ece('0x35')]!==_0x4e31b4){this[_0x19b4dd[_0x59c2fb]+_0x7ece('0x36')]=_[_0x7ece('0x37')](moment()[_0x7ece('0x38')]('x'));}this[_0x19b4dd[_0x59c2fb]+'Status']=_0x4e31b4;}var _0x3d5ff5={'id':this['id'],'name':this['name'],'online':this[_0x7ece('0x8')],'voicePause':this[_0x7ece('0x9')],'chatPause':this[_0x7ece('0xa')],'mailPause':this[_0x7ece('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x7ece('0xc')],'openchannelPause':this[_0x7ece('0xe')],'chatStatus':this[_0x7ece('0x39')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x7ece('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7ece('0x13')],'mailStatusTime':this[_0x7ece('0x14')],'mailCapacity':this[_0x7ece('0x15')],'mailCurrentCapacity':this[_0x7ece('0x16')],'faxStatus':this[_0x7ece('0x17')],'faxStatusTime':this[_0x7ece('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7ece('0x3a')],'smsStatusTime':this[_0x7ece('0x1b')],'smsCapacity':this[_0x7ece('0x1c')],'smsCurrentCapacity':this[_0x7ece('0x1d')],'whatsappStatus':this[_0x7ece('0x1e')],'whatsappStatusTime':this[_0x7ece('0x1f')],'whatsappCapacity':this[_0x7ece('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x7ece('0x3b')],'openchannelStatusTime':this[_0x7ece('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7ece('0x24')],'busy':this['busy'],'busyQueue':this[_0x7ece('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x7ece('0x27')],'mailWaitingInteractions':this[_0x7ece('0x28')],'openchannelWaitingInteractions':this[_0x7ece('0x3c')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x7ece('0x3d')]};var _0x542170=md5(JSON[_0x7ece('0x3e')](_0x3d5ff5));if(this[_0x7ece('0x26')]!==_0x542170){this[_0x7ece('0x26')]=_0x542170;io[_0x7ece('0x3f')]('user:save',_0x3d5ff5);}};module[_0x7ece('0x40')]=Agent; \ No newline at end of file +var _0x521c=['faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','md5','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','mailCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelCurrentCapacity','busy','faxWaitingInteractions','whatsappWaitingInteractions','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0x521c,0x17c));var _0xc521=function(_0x3d386b,_0xb6dba8){_0x3d386b=_0x3d386b-0x0;var _0x4abf3a=_0x521c[_0x3d386b];return _0x4abf3a;};'use strict';var _=require(_0xc521('0x0'));var moment=require(_0xc521('0x1'));var md5=require('md5');var Redis=require(_0xc521('0x2'));var config=require(_0xc521('0x3'));config['redis']=_[_0xc521('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc521('0x5')]));function Agent(_0x25e727){this['id']=_0x25e727['id']||0x0;this['name']=_0x25e727[_0xc521('0x6')]||'';this['online']=_0x25e727[_0xc521('0x7')]||!![];this[_0xc521('0x8')]=_0x25e727[_0xc521('0x8')]||![];this['chatPause']=_0x25e727['chatPause']||![];this['mailPause']=_0x25e727[_0xc521('0x9')]||![];this[_0xc521('0xa')]=_0x25e727[_0xc521('0xa')]||![];this[_0xc521('0xb')]=_0x25e727[_0xc521('0xb')]||![];this[_0xc521('0xc')]=_0x25e727[_0xc521('0xc')]||![];this[_0xc521('0xd')]=_0xc521('0xe');this[_0xc521('0xf')]=0x0;this['chatCapacity']=_0x25e727[_0xc521('0x10')]||0x0;this[_0xc521('0x11')]=0x0;this[_0xc521('0x12')]='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x25e727['mailCapacity']||0x0;this[_0xc521('0x13')]=0x0;this[_0xc521('0x14')]='unknown';this[_0xc521('0x15')]=0x0;this[_0xc521('0x16')]=_0x25e727['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xc521('0xe');this[_0xc521('0x17')]=0x0;this[_0xc521('0x18')]=_0x25e727[_0xc521('0x18')]||0x0;this[_0xc521('0x19')]=0x0;this['whatsappStatus']=_0xc521('0xe');this[_0xc521('0x1a')]=0x0;this[_0xc521('0x1b')]=_0x25e727[_0xc521('0x1b')]||0x0;this[_0xc521('0x1c')]=0x0;this[_0xc521('0x1d')]='unknown';this[_0xc521('0x1e')]=0x0;this[_0xc521('0x1f')]=_0x25e727[_0xc521('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xc521('0x20')]=undefined;this[_0xc521('0x21')]='';this[_0xc521('0x22')]={};this['faxWaitingInteractions']={};this[_0xc521('0x23')]={};this[_0xc521('0x24')]={};this[_0xc521('0x25')]={};this['whatsappWaitingInteractions']={};this[_0xc521('0x26')]();}Agent[_0xc521('0x27')][_0xc521('0x28')]=function(_0x456bd0){if(this[_0x456bd0+_0xc521('0x29')]>0x0){if(this[_0x456bd0+'Capacity']>0x0&&this[_0x456bd0+_0xc521('0x29')]>=this[_0x456bd0+'Capacity']){return _0xc521('0x2a');}else{return _0xc521('0x2b');}}else{return _0xc521('0x2c');}};Agent['prototype'][_0xc521('0x26')]=function(){var _0x5f5414=['mail',_0xc521('0x2d'),_0xc521('0x2e'),_0xc521('0x2f'),_0xc521('0x30'),_0xc521('0x31')];for(var _0x4a6768=0x0;_0x4a6768<_0x5f5414[_0xc521('0x32')];_0x4a6768+=0x1){var _0x18fdc1=this[_0xc521('0x28')](_0x5f5414[_0x4a6768]);if(this[_0x5f5414[_0x4a6768]+_0xc521('0x33')]!==_0x18fdc1){this[_0x5f5414[_0x4a6768]+_0xc521('0x34')]=_[_0xc521('0x35')](moment()[_0xc521('0x36')]('x'));}this[_0x5f5414[_0x4a6768]+_0xc521('0x33')]=_0x18fdc1;}var _0x2a4dda={'id':this['id'],'name':this[_0xc521('0x6')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xc521('0x37')],'mailPause':this[_0xc521('0x9')],'smsPause':this[_0xc521('0xb')],'faxPause':this[_0xc521('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc521('0x10')],'chatCurrentCapacity':this[_0xc521('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc521('0x38')],'mailCurrentCapacity':this[_0xc521('0x13')],'faxStatus':this[_0xc521('0x14')],'faxStatusTime':this[_0xc521('0x15')],'faxCapacity':this[_0xc521('0x16')],'faxCurrentCapacity':this[_0xc521('0x39')],'smsStatus':this[_0xc521('0x3a')],'smsStatusTime':this[_0xc521('0x17')],'smsCapacity':this[_0xc521('0x18')],'smsCurrentCapacity':this[_0xc521('0x19')],'whatsappStatus':this[_0xc521('0x3b')],'whatsappStatusTime':this[_0xc521('0x1a')],'whatsappCapacity':this[_0xc521('0x1b')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xc521('0x1d')],'openchannelStatusTime':this[_0xc521('0x1e')],'openchannelCapacity':this[_0xc521('0x1f')],'openchannelCurrentCapacity':this[_0xc521('0x3c')],'busy':this[_0xc521('0x3d')],'busyQueue':this[_0xc521('0x20')],'chatWaitingInteractions':this[_0xc521('0x22')],'faxWaitingInteractions':this[_0xc521('0x3e')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xc521('0x25')],'whatsappWaitingInteractions':this[_0xc521('0x3f')]};var _0x3f9bc0=md5(JSON['stringify'](_0x2a4dda));if(this[_0xc521('0x21')]!==_0x3f9bc0){this[_0xc521('0x21')]=_0x3f9bc0;io[_0xc521('0x40')](_0xc521('0x41'),_0x2a4dda);}};module[_0xc521('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index cd477c8..c852712 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 _0x0392=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','loggedIn','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x14afdf,_0x3adb43){var _0x4b1e8e=function(_0x3bf19c){while(--_0x3bf19c){_0x14afdf['push'](_0x14afdf['shift']());}};_0x4b1e8e(++_0x3adb43);}(_0x0392,0xc4));var _0x2039=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x0392[_0x47a40b];return _0x19610c;};'use strict';var _=require('lodash');var md5=require(_0x2039('0x0'));var util=require('util');var Redis=require(_0x2039('0x1'));var config=require(_0x2039('0x2'));config[_0x2039('0x3')]=_[_0x2039('0x4')](config[_0x2039('0x3')],{'host':_0x2039('0x5'),'port':0x18eb});var io=require(_0x2039('0x6'))(new Redis(config[_0x2039('0x3')]));function ChatQueue(_0x55da0e){this['id']=_0x55da0e['id']||0x0;this['name']=_0x55da0e[_0x2039('0x7')]||'';this[_0x2039('0x8')]=_0x55da0e[_0x2039('0x8')]||0xa;this[_0x2039('0x9')]=_0x55da0e[_0x2039('0x9')]||_0x2039('0xa');this[_0x2039('0xb')]=_0x55da0e[_0x2039('0xb')];this['mapAgentsId']={};this[_0x2039('0xc')]=0x0;this[_0x2039('0x0')]='';this[_0x2039('0xd')]();this[_0x2039('0xe')]();}ChatQueue['prototype'][_0x2039('0xd')]=function(){var _0x938dbb=this[_0x2039('0xf')]['_rr'];this[_0x2039('0xf')]=_['map'](this[_0x2039('0xb')],'id');this[_0x2039('0xf')][_0x2039('0x10')]=_0x938dbb;};ChatQueue[_0x2039('0x11')][_0x2039('0xe')]=function(){this[_0x2039('0x12')]=0x0;this['paused']=0x0;for(var _0x3eef63=0x0;_0x3eef63=0x0?this[_0x2039('0x16')]:0x0;var _0x405882={'id':this['id'],'available':this[_0x2039('0x16')],'loggedIn':this[_0x2039('0x12')],'name':this[_0x2039('0x7')],'paused':this[_0x2039('0x15')],'waiting':this[_0x2039('0xc')]};var _0x2ba2f3=md5(JSON[_0x2039('0x17')](_0x405882));if(this['md5']!==_0x2ba2f3){this[_0x2039('0x0')]=_0x2ba2f3;io['to'](util[_0x2039('0x18')](_0x2039('0x19'),_0x405882[_0x2039('0x7')]))[_0x2039('0x1a')](_0x2039('0x1b'),_0x405882);}};module[_0x2039('0x1c')]=ChatQueue; \ No newline at end of file +var _0xf74a=['format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0xf74a,0x17d));var _0xaf74=function(_0x8e9d78,_0x310ef6){_0x8e9d78=_0x8e9d78-0x0;var _0x4b6f13=_0xf74a[_0x8e9d78];return _0x4b6f13;};'use strict';var _=require(_0xaf74('0x0'));var md5=require(_0xaf74('0x1'));var util=require(_0xaf74('0x2'));var Redis=require(_0xaf74('0x3'));var config=require(_0xaf74('0x4'));config['redis']=_[_0xaf74('0x5')](config[_0xaf74('0x6')],{'host':_0xaf74('0x7'),'port':0x18eb});var io=require(_0xaf74('0x8'))(new Redis(config['redis']));function ChatQueue(_0x2eeacd){this['id']=_0x2eeacd['id']||0x0;this[_0xaf74('0x9')]=_0x2eeacd[_0xaf74('0x9')]||'';this[_0xaf74('0xa')]=_0x2eeacd[_0xaf74('0xa')]||0xa;this[_0xaf74('0xb')]=_0x2eeacd['strategy']||'beepall';this[_0xaf74('0xc')]=_0x2eeacd[_0xaf74('0xc')];this[_0xaf74('0xd')]={};this[_0xaf74('0xe')]=0x0;this[_0xaf74('0x1')]='';this[_0xaf74('0xf')]();this[_0xaf74('0x10')]();}ChatQueue[_0xaf74('0x11')][_0xaf74('0xf')]=function(){var _0x44d14b=this['mapAgentsId'][_0xaf74('0x12')];this[_0xaf74('0xd')]=_[_0xaf74('0x13')](this[_0xaf74('0xc')],'id');this[_0xaf74('0xd')][_0xaf74('0x12')]=_0x44d14b;};ChatQueue['prototype'][_0xaf74('0x10')]=function(){this[_0xaf74('0x14')]=0x0;this[_0xaf74('0x15')]=0x0;for(var _0x2ff47e=0x0;_0x2ff47e=0x0?this['available']:0x0;var _0x1c3edc={'id':this['id'],'available':this[_0xaf74('0x18')],'loggedIn':this[_0xaf74('0x14')],'name':this['name'],'paused':this[_0xaf74('0x15')],'waiting':this['waiting']};var _0x341f88=md5(JSON['stringify'](_0x1c3edc));if(this['md5']!==_0x341f88){this[_0xaf74('0x1')]=_0x341f88;io['to'](util[_0xaf74('0x19')](_0xaf74('0x1a'),_0x1c3edc[_0xaf74('0x9')]))[_0xaf74('0x1b')]('chat_queue:save',_0x1c3edc);}};module[_0xaf74('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c9b2011..57c077b 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 _0xc9c2=['prototype','loggedIn','paused','length','faxPause','available','stringify','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0xc9c2,0xe1));var _0x2c9c=function(_0x56170e,_0x4b970b){_0x56170e=_0x56170e-0x0;var _0x3ecd25=_0xc9c2[_0x56170e];return _0x3ecd25;};'use strict';var _=require(_0x2c9c('0x0'));var md5=require(_0x2c9c('0x1'));var util=require(_0x2c9c('0x2'));var Redis=require(_0x2c9c('0x3'));var config=require(_0x2c9c('0x4'));config[_0x2c9c('0x5')]=_[_0x2c9c('0x6')](config['redis'],{'host':_0x2c9c('0x7'),'port':0x18eb});var io=require(_0x2c9c('0x8'))(new Redis(config[_0x2c9c('0x5')]));function FaxQueue(_0x1943ce){this['id']=_0x1943ce['id']||0x0;this[_0x2c9c('0x9')]=_0x1943ce[_0x2c9c('0x9')]||'';this['timeout']=_0x1943ce['timeout']||0xa;this['strategy']=_0x1943ce[_0x2c9c('0xa')]||'beepall';this[_0x2c9c('0xb')]=_0x1943ce['Agents'];this[_0x2c9c('0xc')]={};this[_0x2c9c('0xd')]=0x0;this[_0x2c9c('0x1')]='';this[_0x2c9c('0xe')]();this[_0x2c9c('0xf')]();}FaxQueue['prototype'][_0x2c9c('0xe')]=function(){var _0x2e3a6e=this[_0x2c9c('0xc')][_0x2c9c('0x10')];this[_0x2c9c('0xc')]=_[_0x2c9c('0x11')](this[_0x2c9c('0xb')],'id');this[_0x2c9c('0xc')][_0x2c9c('0x10')]=_0x2e3a6e;};FaxQueue[_0x2c9c('0x12')][_0x2c9c('0xf')]=function(){this[_0x2c9c('0x13')]=0x0;this[_0x2c9c('0x14')]=0x0;for(var _0xa41df0=0x0;_0xa41df0=0x0?this[_0x2c9c('0x17')]:0x0;var _0x2aedf3={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x2c9c('0x9')],'paused':this[_0x2c9c('0x14')],'waiting':this['waiting']};var _0x3dfc17=md5(JSON[_0x2c9c('0x18')](_0x2aedf3));if(this['md5']!==_0x3dfc17){this[_0x2c9c('0x1')]=_0x3dfc17;io['to'](util[_0x2c9c('0x19')]('fax:queue:%s',_0x2aedf3[_0x2c9c('0x9')]))['emit']('fax_queue:save',_0x2aedf3);}};module[_0x2c9c('0x1a')]=FaxQueue; \ No newline at end of file +var _0x3746=['mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','loggedIn','faxPause','available','waiting','md5','format','fax:queue:%s','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x4f63b7,_0x220857){var _0x598295=function(_0x165747){while(--_0x165747){_0x4f63b7['push'](_0x4f63b7['shift']());}};_0x598295(++_0x220857);}(_0x3746,0x11d));var _0x6374=function(_0x5d9ead,_0x475593){_0x5d9ead=_0x5d9ead-0x0;var _0x4067f4=_0x3746[_0x5d9ead];return _0x4067f4;};'use strict';var _=require(_0x6374('0x0'));var md5=require('md5');var util=require(_0x6374('0x1'));var Redis=require('ioredis');var config=require(_0x6374('0x2'));config[_0x6374('0x3')]=_[_0x6374('0x4')](config[_0x6374('0x3')],{'host':_0x6374('0x5'),'port':0x18eb});var io=require(_0x6374('0x6'))(new Redis(config[_0x6374('0x3')]));function FaxQueue(_0x21ce82){this['id']=_0x21ce82['id']||0x0;this[_0x6374('0x7')]=_0x21ce82['name']||'';this[_0x6374('0x8')]=_0x21ce82['timeout']||0xa;this[_0x6374('0x9')]=_0x21ce82[_0x6374('0x9')]||_0x6374('0xa');this['Agents']=_0x21ce82[_0x6374('0xb')];this[_0x6374('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x6374('0xd')]();this[_0x6374('0xe')]();}FaxQueue[_0x6374('0xf')][_0x6374('0xd')]=function(){var _0x4bc1e0=this[_0x6374('0xc')][_0x6374('0x10')];this[_0x6374('0xc')]=_[_0x6374('0x11')](this[_0x6374('0xb')],'id');this[_0x6374('0xc')][_0x6374('0x10')]=_0x4bc1e0;};FaxQueue[_0x6374('0xf')][_0x6374('0xe')]=function(){this['loggedIn']=0x0;this[_0x6374('0x12')]=0x0;for(var _0x368a22=0x0;_0x368a22=0x0?this[_0x6374('0x15')]:0x0;var _0x228fb8={'id':this['id'],'available':this[_0x6374('0x15')],'loggedIn':this[_0x6374('0x13')],'name':this[_0x6374('0x7')],'paused':this[_0x6374('0x12')],'waiting':this[_0x6374('0x16')]};var _0x5d7538=md5(JSON['stringify'](_0x228fb8));if(this[_0x6374('0x17')]!==_0x5d7538){this[_0x6374('0x17')]=_0x5d7538;io['to'](util[_0x6374('0x18')](_0x6374('0x19'),_0x228fb8['name']))['emit']('fax_queue:save',_0x228fb8);}};module[_0x6374('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c8f9e2b..e85bc24 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 _0x567c=['name','Intervals'];(function(_0x4683c5,_0x18b1c2){var _0xc80041=function(_0x2f4b12){while(--_0x2f4b12){_0x4683c5['push'](_0x4683c5['shift']());}};_0xc80041(++_0x18b1c2);}(_0x567c,0xec));var _0xc567=function(_0x884b91,_0x2ad5ad){_0x884b91=_0x884b91-0x0;var _0x268a2f=_0x567c[_0x884b91];return _0x268a2f;};'use strict';function Interval(_0x4c73d5){this['id']=_0x4c73d5['id']||0x0;this['name']=_0x4c73d5[_0xc567('0x0')]||'';this[_0xc567('0x1')]=_0x4c73d5['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x4b18=['exports','name','Intervals'];(function(_0x3e9404,_0x47173b){var _0x81543b=function(_0x9a7185){while(--_0x9a7185){_0x3e9404['push'](_0x3e9404['shift']());}};_0x81543b(++_0x47173b);}(_0x4b18,0x10c));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x258895){this['id']=_0x258895['id']||0x0;this[_0x84b1('0x0')]=_0x258895[_0x84b1('0x0')]||'';this['Intervals']=_0x258895[_0x84b1('0x1')]||{};}module[_0x84b1('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 4f4a7b9..74e7682 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 _0x4a9a=['emit','mail_queue:save','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','format','mail:queue:%s'];(function(_0x115128,_0x22ec77){var _0x5c9383=function(_0x21d941){while(--_0x21d941){_0x115128['push'](_0x115128['shift']());}};_0x5c9383(++_0x22ec77);}(_0x4a9a,0x89));var _0xa4a9=function(_0x211917,_0x97e446){_0x211917=_0x211917-0x0;var _0x2e4551=_0x4a9a[_0x211917];return _0x2e4551;};'use strict';var _=require(_0xa4a9('0x0'));var md5=require('md5');var util=require(_0xa4a9('0x1'));var Redis=require('ioredis');var config=require(_0xa4a9('0x2'));config[_0xa4a9('0x3')]=_[_0xa4a9('0x4')](config[_0xa4a9('0x3')],{'host':_0xa4a9('0x5'),'port':0x18eb});var io=require(_0xa4a9('0x6'))(new Redis(config['redis']));function MailQueue(_0x71c9b2){this['id']=_0x71c9b2['id']||0x0;this['name']=_0x71c9b2[_0xa4a9('0x7')]||'';this[_0xa4a9('0x8')]=_0x71c9b2[_0xa4a9('0x8')]||0xa;this[_0xa4a9('0x9')]=_0x71c9b2[_0xa4a9('0x9')]||_0xa4a9('0xa');this[_0xa4a9('0xb')]=_0x71c9b2[_0xa4a9('0xb')];this[_0xa4a9('0xc')]={};this[_0xa4a9('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xa4a9('0xe')]();}MailQueue[_0xa4a9('0xf')]['updateRouting']=function(){var _0xc4b897=this['mapAgentsId'][_0xa4a9('0x10')];this['mapAgentsId']=_[_0xa4a9('0x11')](this[_0xa4a9('0xb')],'id');this['mapAgentsId'][_0xa4a9('0x10')]=_0xc4b897;};MailQueue[_0xa4a9('0xf')][_0xa4a9('0xe')]=function(){this['loggedIn']=0x0;this[_0xa4a9('0x12')]=0x0;for(var _0x299846=0x0;_0x299846=0x0?this[_0xa4a9('0x15')]:0x0;var _0x600227={'id':this['id'],'available':this[_0xa4a9('0x15')],'loggedIn':this[_0xa4a9('0x16')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa4a9('0xd')]};var _0x4c685d=md5(JSON['stringify'](_0x600227));if(this['md5']!==_0x4c685d){this['md5']=_0x4c685d;io['to'](util[_0xa4a9('0x17')](_0xa4a9('0x18'),_0x600227[_0xa4a9('0x7')]))[_0xa4a9('0x19')](_0xa4a9('0x1a'),_0x600227);}};module['exports']=MailQueue; \ No newline at end of file +var _0x48cf=['length','online','loggedIn','mailPause','available','stringify','mail:queue:%s','exports','md5','util','ioredis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','paused'];(function(_0x41c14,_0x47327a){var _0xfd4168=function(_0x3ef0d7){while(--_0x3ef0d7){_0x41c14['push'](_0x41c14['shift']());}};_0xfd4168(++_0x47327a);}(_0x48cf,0x161));var _0xf48c=function(_0x1d337e,_0x54ebed){_0x1d337e=_0x1d337e-0x0;var _0x28dedd=_0x48cf[_0x1d337e];return _0x28dedd;};'use strict';var _=require('lodash');var md5=require(_0xf48c('0x0'));var util=require(_0xf48c('0x1'));var Redis=require(_0xf48c('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xf48c('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x549294){this['id']=_0x549294['id']||0x0;this[_0xf48c('0x4')]=_0x549294[_0xf48c('0x4')]||'';this[_0xf48c('0x5')]=_0x549294['timeout']||0xa;this[_0xf48c('0x6')]=_0x549294[_0xf48c('0x6')]||'beepall';this[_0xf48c('0x7')]=_0x549294[_0xf48c('0x7')];this[_0xf48c('0x8')]={};this[_0xf48c('0x9')]=0x0;this[_0xf48c('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xf48c('0xa')][_0xf48c('0xb')]=function(){var _0x59d71b=this['mapAgentsId'][_0xf48c('0xc')];this[_0xf48c('0x8')]=_[_0xf48c('0xd')](this[_0xf48c('0x7')],'id');this[_0xf48c('0x8')][_0xf48c('0xc')]=_0x59d71b;};MailQueue[_0xf48c('0xa')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xf48c('0xe')]=0x0;for(var _0x1fd35a=0x0;_0x1fd35a=0x0?this[_0xf48c('0x13')]:0x0;var _0x243aa5={'id':this['id'],'available':this[_0xf48c('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xf48c('0x4')],'paused':this[_0xf48c('0xe')],'waiting':this[_0xf48c('0x9')]};var _0x4301db=md5(JSON[_0xf48c('0x14')](_0x243aa5));if(this[_0xf48c('0x0')]!==_0x4301db){this[_0xf48c('0x0')]=_0x4301db;io['to'](util['format'](_0xf48c('0x15'),_0x243aa5[_0xf48c('0x4')]))['emit']('mail_queue:save',_0x243aa5);}};module[_0xf48c('0x16')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0e600a8..cc2cfcc 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x55fa6b,_0x4ef8a1){var _0xf484a5=function(_0x250a72){while(--_0x250a72){_0x55fa6b['push'](_0x55fa6b['shift']());}};_0xf484a5(++_0x4ef8a1);}(_0x814b,0x1a2));var _0xb814=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x814b[_0x204eb7];return _0x37e444;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x7a54,0x106));var _0x47a5=function(_0x219c48,_0x49dcab){_0x219c48=_0x219c48-0x0;var _0x308f2b=_0x7a54[_0x219c48];return _0x308f2b;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bd81b89..3a7a5ec 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 _0xf041=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis'];(function(_0xc7f23c,_0x2be758){var _0x4b4def=function(_0x1b3aab){while(--_0x1b3aab){_0xc7f23c['push'](_0xc7f23c['shift']());}};_0x4b4def(++_0x2be758);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1f04('0x0'));var Redis=require(_0x1f04('0x1'));var config=require(_0x1f04('0x2'));config[_0x1f04('0x3')]=_['defaults'](config[_0x1f04('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1f04('0x4'))(new Redis(config['redis']));function SmsQueue(_0x530a67){this['id']=_0x530a67['id']||0x0;this[_0x1f04('0x5')]=_0x530a67['name']||'';this[_0x1f04('0x6')]=_0x530a67[_0x1f04('0x6')]||0xa;this[_0x1f04('0x7')]=_0x530a67[_0x1f04('0x7')]||'beepall';this[_0x1f04('0x8')]=_0x530a67[_0x1f04('0x8')];this[_0x1f04('0x9')]={};this[_0x1f04('0xa')]=0x0;this[_0x1f04('0xb')]='';this[_0x1f04('0xc')]();this[_0x1f04('0xd')]();}SmsQueue[_0x1f04('0xe')]['updateRouting']=function(){var _0x4f4e37=this[_0x1f04('0x9')][_0x1f04('0xf')];this[_0x1f04('0x9')]=_[_0x1f04('0x10')](this[_0x1f04('0x8')],'id');this[_0x1f04('0x9')][_0x1f04('0xf')]=_0x4f4e37;};SmsQueue[_0x1f04('0xe')][_0x1f04('0xd')]=function(){this[_0x1f04('0x11')]=0x0;this[_0x1f04('0x12')]=0x0;for(var _0x4ebd86=0x0;_0x4ebd86=0x0?this['available']:0x0;var _0x4964bd={'id':this['id'],'available':this[_0x1f04('0x15')],'loggedIn':this[_0x1f04('0x11')],'name':this[_0x1f04('0x5')],'paused':this[_0x1f04('0x12')],'waiting':this[_0x1f04('0xa')]};var _0x30d2e5=md5(JSON[_0x1f04('0x16')](_0x4964bd));if(this[_0x1f04('0xb')]!==_0x30d2e5){this['md5']=_0x30d2e5;io['to'](util[_0x1f04('0x17')](_0x1f04('0x18'),_0x4964bd[_0x1f04('0x5')]))['emit'](_0x1f04('0x19'),_0x4964bd);}};module[_0x1f04('0x1a')]=SmsQueue; \ No newline at end of file +var _0x7aaf=['_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','util','ioredis','defaults','localhost','redis','name','timeout','beepall','Agents','md5','updateRouting','updateRealtime'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x124951,_0x52cdad){_0x124951=_0x124951-0x0;var _0x281c18=_0x7aaf[_0x124951];return _0x281c18;};'use strict';var _=require(_0xf7aa('0x0'));var md5=require('md5');var util=require(_0xf7aa('0x1'));var Redis=require(_0xf7aa('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xf7aa('0x3')](config['redis'],{'host':_0xf7aa('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf7aa('0x5')]));function SmsQueue(_0x20dc82){this['id']=_0x20dc82['id']||0x0;this[_0xf7aa('0x6')]=_0x20dc82[_0xf7aa('0x6')]||'';this['timeout']=_0x20dc82[_0xf7aa('0x7')]||0xa;this['strategy']=_0x20dc82['strategy']||_0xf7aa('0x8');this[_0xf7aa('0x9')]=_0x20dc82['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf7aa('0xa')]='';this[_0xf7aa('0xb')]();this[_0xf7aa('0xc')]();}SmsQueue['prototype'][_0xf7aa('0xb')]=function(){var _0x5a7b21=this['mapAgentsId'][_0xf7aa('0xd')];this[_0xf7aa('0xe')]=_[_0xf7aa('0xf')](this[_0xf7aa('0x9')],'id');this[_0xf7aa('0xe')][_0xf7aa('0xd')]=_0x5a7b21;};SmsQueue[_0xf7aa('0x10')][_0xf7aa('0xc')]=function(){this[_0xf7aa('0x11')]=0x0;this[_0xf7aa('0x12')]=0x0;for(var _0x5d3ed3=0x0;_0x5d3ed3=0x0?this[_0xf7aa('0x16')]:0x0;var _0x305d6e={'id':this['id'],'available':this[_0xf7aa('0x16')],'loggedIn':this[_0xf7aa('0x11')],'name':this[_0xf7aa('0x6')],'paused':this[_0xf7aa('0x12')],'waiting':this['waiting']};var _0x59b540=md5(JSON[_0xf7aa('0x17')](_0x305d6e));if(this['md5']!==_0x59b540){this[_0xf7aa('0xa')]=_0x59b540;io['to'](util[_0xf7aa('0x18')](_0xf7aa('0x19'),_0x305d6e['name']))['emit'](_0xf7aa('0x1a'),_0x305d6e);}};module[_0xf7aa('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index dbfe3c0..e885c92 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 _0x742a=['map','updateRealtime','loggedIn','paused','length','online','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x302960,_0x3deb4f){var _0x6a3882=function(_0x399276){while(--_0x399276){_0x302960['push'](_0x302960['shift']());}};_0x6a3882(++_0x3deb4f);}(_0x742a,0x11a));var _0xa742=function(_0x5e6ebe,_0x373752){_0x5e6ebe=_0x5e6ebe-0x0;var _0x5d80a0=_0x742a[_0x5e6ebe];return _0x5d80a0;};'use strict';var _=require('lodash');var md5=require(_0xa742('0x0'));var util=require(_0xa742('0x1'));var Redis=require(_0xa742('0x2'));var config=require(_0xa742('0x3'));config[_0xa742('0x4')]=_[_0xa742('0x5')](config['redis'],{'host':_0xa742('0x6'),'port':0x18eb});var io=require(_0xa742('0x7'))(new Redis(config[_0xa742('0x4')]));function WhatsappQueue(_0x4329b8){this['id']=_0x4329b8['id']||0x0;this['name']=_0x4329b8[_0xa742('0x8')]||'';this[_0xa742('0x9')]=_0x4329b8[_0xa742('0x9')]||0xa;this[_0xa742('0xa')]=_0x4329b8[_0xa742('0xa')]||_0xa742('0xb');this['Agents']=_0x4329b8[_0xa742('0xc')];this[_0xa742('0xd')]={};this[_0xa742('0xe')]=0x0;this[_0xa742('0x0')]='';this[_0xa742('0xf')]();this['updateRealtime']();}WhatsappQueue[_0xa742('0x10')][_0xa742('0xf')]=function(){var _0x3f4701=this[_0xa742('0xd')][_0xa742('0x11')];this[_0xa742('0xd')]=_[_0xa742('0x12')](this[_0xa742('0xc')],'id');this['mapAgentsId'][_0xa742('0x11')]=_0x3f4701;};WhatsappQueue[_0xa742('0x10')][_0xa742('0x13')]=function(){this[_0xa742('0x14')]=0x0;this[_0xa742('0x15')]=0x0;for(var _0x380275=0x0;_0x380275=0x0?this['available']:0x0;var _0x56f73b={'id':this['id'],'available':this[_0xa742('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xa742('0x8')],'paused':this[_0xa742('0x15')],'waiting':this[_0xa742('0xe')]};var _0x1e99b9=md5(JSON['stringify'](_0x56f73b));if(this[_0xa742('0x0')]!==_0x1e99b9){this[_0xa742('0x0')]=_0x1e99b9;io['to'](util[_0xa742('0x19')](_0xa742('0x1a'),_0x56f73b[_0xa742('0x8')]))[_0xa742('0x1b')](_0xa742('0x1c'),_0x56f73b);}};module[_0xa742('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x4f4b=['lodash','ioredis','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','Agents','updateRealtime','loggedIn','length','online','paused','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x4fc20b,_0x30ee6c){var _0x450777=function(_0x3bf049){while(--_0x3bf049){_0x4fc20b['push'](_0x4fc20b['shift']());}};_0x450777(++_0x30ee6c);}(_0x4f4b,0xbd));var _0xb4f4=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4f4b[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xb4f4('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xb4f4('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xb4f4('0x2')],{'host':_0xb4f4('0x3'),'port':0x18eb});var io=require(_0xb4f4('0x4'))(new Redis(config['redis']));function WhatsappQueue(_0x55d3ad){this['id']=_0x55d3ad['id']||0x0;this[_0xb4f4('0x5')]=_0x55d3ad['name']||'';this[_0xb4f4('0x6')]=_0x55d3ad[_0xb4f4('0x6')]||0xa;this['strategy']=_0x55d3ad['strategy']||_0xb4f4('0x7');this['Agents']=_0x55d3ad['Agents'];this[_0xb4f4('0x8')]={};this[_0xb4f4('0x9')]=0x0;this[_0xb4f4('0xa')]='';this[_0xb4f4('0xb')]();this['updateRealtime']();}WhatsappQueue[_0xb4f4('0xc')][_0xb4f4('0xb')]=function(){var _0x507c8a=this[_0xb4f4('0x8')][_0xb4f4('0xd')];this[_0xb4f4('0x8')]=_[_0xb4f4('0xe')](this[_0xb4f4('0xf')],'id');this[_0xb4f4('0x8')][_0xb4f4('0xd')]=_0x507c8a;};WhatsappQueue['prototype'][_0xb4f4('0x10')]=function(){this[_0xb4f4('0x11')]=0x0;this['paused']=0x0;for(var _0x398c7d=0x0;_0x398c7d=0x0?this[_0xb4f4('0x15')]:0x0;var _0x507c38={'id':this['id'],'available':this[_0xb4f4('0x15')],'loggedIn':this[_0xb4f4('0x11')],'name':this['name'],'paused':this[_0xb4f4('0x14')],'waiting':this[_0xb4f4('0x9')]};var _0x2b6ca6=md5(JSON[_0xb4f4('0x16')](_0x507c38));if(this[_0xb4f4('0xa')]!==_0x2b6ca6){this[_0xb4f4('0xa')]=_0x2b6ca6;io['to'](util['format'](_0xb4f4('0x17'),_0x507c38[_0xb4f4('0x5')]))[_0xb4f4('0x18')](_0xb4f4('0x19'),_0x507c38);}};module[_0xb4f4('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0e1506e..8ccf3fb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x533b7c,_0xd52089){var _0x42d2c3=function(_0x2864ea){while(--_0x2864ea){_0x533b7c['push'](_0x533b7c['shift']());}};_0x42d2c3(++_0xd52089);}(_0xb10b,0x12a));var _0xbb10=function(_0xf8053,_0x4b5401){_0xf8053=_0xf8053-0x0;var _0x2fe82f=_0xb10b[_0xf8053];return _0x2fe82f;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7fc5fa3..2aa8f77 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 _0xed22=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x26f577,_0x1357d6){var _0x4e9003=function(_0x4f1f9e){while(--_0x4f1f9e){_0x26f577['push'](_0x26f577['shift']());}};_0x4e9003(++_0x1357d6);}(_0xed22,0xc7));var _0x2ed2=function(_0x49b3be,_0x4e68b9){_0x49b3be=_0x49b3be-0x0;var _0x1081ea=_0xed22[_0x49b3be];return _0x1081ea;};'use strict';var client=require(_0x2ed2('0x0'));exports[_0x2ed2('0x1')]=function(_0x27f9f9,_0x41bf67){return client[_0x2ed2('0x2')](_0x2ed2('0x3'),{'body':_0x41bf67,'options':{'where':{'id':_0x27f9f9}},'log':_0x2ed2('0x4')});};exports[_0x2ed2('0x5')]=function(_0x563e03,_0x5ec79b){return client['Request'](_0x2ed2('0x6'),{'body':_0x5ec79b,'options':{'where':{'id':_0x563e03}},'log':_0x2ed2('0x7')});}; \ No newline at end of file +var _0xc38d=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xc38d,0x89));var _0xdc38=function(_0x3d7303,_0xbfce88){_0x3d7303=_0x3d7303-0x0;var _0x2252d=_0xc38d[_0x3d7303];return _0x2252d;};'use strict';var client=require(_0xdc38('0x0'));exports[_0xdc38('0x1')]=function(_0x35b5c,_0x55c9a2){return client['Request'](_0xdc38('0x2'),{'body':_0x55c9a2,'options':{'where':{'id':_0x35b5c}},'log':_0xdc38('0x3')});};exports[_0xdc38('0x4')]=function(_0x462c6f,_0x44d092){return client['Request'](_0xdc38('0x5'),{'body':_0x44d092,'options':{'where':{'id':_0x462c6f}},'log':_0xdc38('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index be82680..9a6511c 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 _0x61e7=['CreateChatMessage','createChatMessage','Request'];(function(_0x4eae89,_0x379876){var _0x378d92=function(_0x45c46b){while(--_0x45c46b){_0x4eae89['push'](_0x4eae89['shift']());}};_0x378d92(++_0x379876);}(_0x61e7,0x10d));var _0x761e=function(_0x22539d,_0x3cdc4d){_0x22539d=_0x22539d-0x0;var _0x2c3fa6=_0x61e7[_0x22539d];return _0x2c3fa6;};'use strict';var client=require('../client');exports['create']=function(_0x3ffecc){return client[_0x761e('0x0')](_0x761e('0x1'),{'body':_0x3ffecc,'log':_0x761e('0x2')});}; \ No newline at end of file +var _0x7651=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x469744,_0x34aab4){var _0x5a2c66=function(_0x415f9f){while(--_0x415f9f){_0x469744['push'](_0x469744['shift']());}};_0x5a2c66(++_0x34aab4);}(_0x7651,0x179));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1765('0x0'));exports['create']=function(_0x2ef783){return client[_0x1765('0x1')](_0x1765('0x2'),{'body':_0x2ef783,'log':_0x1765('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f68f397..f8d48e3 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 _0x9009=['../client','Request','GetChatQueue','timeout','strategy','User','Agents','online','chatPause'];(function(_0x552cf8,_0x493a58){var _0x5b0eca=function(_0xbc6b6d){while(--_0xbc6b6d){_0x552cf8['push'](_0x552cf8['shift']());}};_0x5b0eca(++_0x493a58);}(_0x9009,0x1d4));var _0x9900=function(_0x287406,_0x5ec023){_0x287406=_0x287406-0x0;var _0x451c9f=_0x9009[_0x287406];return _0x451c9f;};'use strict';var client=require(_0x9900('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x9900('0x1')](_0x9900('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9900('0x3'),_0x9900('0x4')],'include':[{'model':_0x9900('0x5'),'as':_0x9900('0x6'),'attributes':['id','name',_0x9900('0x7'),_0x9900('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xabe8=['timeout','User','online','chatPause','../client','getChatQueues','Request','name'];(function(_0x608fa5,_0xe8df83){var _0x391956=function(_0x22845f){while(--_0x22845f){_0x608fa5['push'](_0x608fa5['shift']());}};_0x391956(++_0xe8df83);}(_0xabe8,0x8c));var _0x8abe=function(_0x4ed955,_0xabd42e){_0x4ed955=_0x4ed955-0x0;var _0xa17954=_0xabe8[_0x4ed955];return _0xa17954;};'use strict';var client=require(_0x8abe('0x0'));exports[_0x8abe('0x1')]=function(){return function(){return client[_0x8abe('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x8abe('0x3'),_0x8abe('0x4'),'strategy'],'include':[{'model':_0x8abe('0x5'),'as':'Agents','attributes':['id',_0x8abe('0x3'),_0x8abe('0x6'),_0x8abe('0x7')]}]},'log':_0x8abe('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3df74c4..6657669 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 _0xb07f=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x8d01f8,_0xe728a9){var _0x29f7f3=function(_0x43485a){while(--_0x43485a){_0x8d01f8['push'](_0x8d01f8['shift']());}};_0x29f7f3(++_0xe728a9);}(_0xb07f,0x109));var _0xfb07=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0xb07f[_0x2f23c6];return _0x12e26a;};'use strict';var client=require(_0xfb07('0x0'));exports[_0xfb07('0x1')]=function(_0x3088a0){return client[_0xfb07('0x2')](_0xfb07('0x3'),{'body':_0x3088a0,'log':_0xfb07('0x3')});};exports[_0xfb07('0x4')]=function(_0x25212c,_0x3b3c05){return client[_0xfb07('0x2')](_0xfb07('0x5'),{'body':_0x3b3c05,'options':{'where':{'uniqueid':_0x25212c},'order':[['id','DESC']],'limit':0x1},'log':_0xfb07('0x5')});}; \ No newline at end of file +var _0x8128=['CreateChatQueueReport','DESC','UpdateChatQueueReport','../client','Request'];(function(_0x487581,_0x55ccce){var _0x4d63eb=function(_0x4567d4){while(--_0x4567d4){_0x487581['push'](_0x487581['shift']());}};_0x4d63eb(++_0x55ccce);}(_0x8128,0x1b1));var _0x8812=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8128[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0x8812('0x0'));exports['create']=function(_0x529739){return client[_0x8812('0x1')](_0x8812('0x2'),{'body':_0x529739,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1c189a,_0x2aeddc){return client[_0x8812('0x1')]('UpdateChatQueueReport',{'body':_0x2aeddc,'options':{'where':{'uniqueid':_0x1c189a},'order':[['id',_0x8812('0x3')]],'limit':0x1},'log':_0x8812('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 07183fc..0dbdbee 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x7a54,0x106));var _0x47a5=function(_0x2972ba,_0x4e0841){_0x2972ba=_0x2972ba-0x0;var _0x4809f8=_0x7a54[_0x2972ba];return _0x4809f8;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x7a54,0x106));var _0x47a5=function(_0x17b24c,_0x39cbb5){_0x17b24c=_0x17b24c-0x0;var _0x282a9b=_0x7a54[_0x17b24c];return _0x282a9b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 1439e48..0f9845b 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 _0xc16b=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xc16b,0x90));var _0xbc16=function(_0x2b63d5,_0x340d67){_0x2b63d5=_0x2b63d5-0x0;var _0x2d769a=_0xc16b[_0x2b63d5];return _0x2d769a;};'use strict';var client=require(_0xbc16('0x0'));exports['create']=function(_0x20f583){return client[_0xbc16('0x1')](_0xbc16('0x2'),{'body':_0x20f583,'log':_0xbc16('0x3')});}; \ No newline at end of file +var _0x8075=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x5b58ba,_0x16159f){var _0xc67099=function(_0x1c5b8a){while(--_0x1c5b8a){_0x5b58ba['push'](_0x5b58ba['shift']());}};_0xc67099(++_0x16159f);}(_0x8075,0x14d));var _0x5807=function(_0x43da10,_0x164096){_0x43da10=_0x43da10-0x0;var _0x37e34c=_0x8075[_0x43da10];return _0x37e34c;};'use strict';var client=require(_0x5807('0x0'));exports[_0x5807('0x1')]=function(_0x1d7612){return client[_0x5807('0x2')](_0x5807('0x3'),{'body':_0x1d7612,'log':_0x5807('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b1141f9..404be06 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 _0xed93=['Agents','online','faxPause','getFaxQueues','../client','Request','name','timeout','strategy','User'];(function(_0xaf69ab,_0x18856c){var _0x21a455=function(_0x5d31d0){while(--_0x5d31d0){_0xaf69ab['push'](_0xaf69ab['shift']());}};_0x21a455(++_0x18856c);}(_0xed93,0x86));var _0x3ed9=function(_0x13ac6c,_0xed33c5){_0x13ac6c=_0x13ac6c-0x0;var _0x2238a0=_0xed93[_0x13ac6c];return _0x2238a0;};'use strict';var client=require(_0x3ed9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x3ed9('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x3ed9('0x2'),_0x3ed9('0x3'),_0x3ed9('0x4')],'include':[{'model':_0x3ed9('0x5'),'as':_0x3ed9('0x6'),'attributes':['id',_0x3ed9('0x2'),_0x3ed9('0x7'),_0x3ed9('0x8')]}]},'log':_0x3ed9('0x9')});};}; \ No newline at end of file +var _0x1c3a=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x19553d,_0x1edcef){var _0x5de0af=function(_0x3b8c34){while(--_0x3b8c34){_0x19553d['push'](_0x19553d['shift']());}};_0x5de0af(++_0x1edcef);}(_0x1c3a,0x1c5));var _0xa1c3=function(_0x270b9d,_0x8e1c){_0x270b9d=_0x270b9d-0x0;var _0x32ac0c=_0x1c3a[_0x270b9d];return _0x32ac0c;};'use strict';var client=require(_0xa1c3('0x0'));exports[_0xa1c3('0x1')]=function(){return function(){return client[_0xa1c3('0x2')](_0xa1c3('0x3'),{'options':{'raw':![],'attributes':['id',_0xa1c3('0x4'),_0xa1c3('0x5'),_0xa1c3('0x6')],'include':[{'model':_0xa1c3('0x7'),'as':_0xa1c3('0x8'),'attributes':['id',_0xa1c3('0x4'),_0xa1c3('0x9'),_0xa1c3('0xa')]}]},'log':_0xa1c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 00fe9e9..10a873b 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 _0x72ea=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x1acd47,_0x3b1322){var _0x6a3e9d=function(_0x371c16){while(--_0x371c16){_0x1acd47['push'](_0x1acd47['shift']());}};_0x6a3e9d(++_0x3b1322);}(_0x72ea,0x1e8));var _0xa72e=function(_0x20ef0f,_0x4da794){_0x20ef0f=_0x20ef0f-0x0;var _0x16f135=_0x72ea[_0x20ef0f];return _0x16f135;};'use strict';var client=require(_0xa72e('0x0'));exports[_0xa72e('0x1')]=function(_0x13cf9c){return client['Request'](_0xa72e('0x2'),{'body':_0x13cf9c,'log':_0xa72e('0x2')});};exports[_0xa72e('0x3')]=function(_0x2a9a12,_0x351fb9){return client[_0xa72e('0x4')](_0xa72e('0x5'),{'body':_0x351fb9,'options':{'where':{'uniqueid':_0x2a9a12},'order':[['id',_0xa72e('0x6')]],'limit':0x1},'log':_0xa72e('0x5')});}; \ No newline at end of file +var _0xd08e=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x4498f5,_0x2d3ae8){var _0x38a460=function(_0x13defd){while(--_0x13defd){_0x4498f5['push'](_0x4498f5['shift']());}};_0x38a460(++_0x2d3ae8);}(_0xd08e,0x120));var _0xed08=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xd08e[_0x5c3ae9];return _0x3f5950;};'use strict';var client=require(_0xed08('0x0'));exports[_0xed08('0x1')]=function(_0x15987c){return client[_0xed08('0x2')](_0xed08('0x3'),{'body':_0x15987c,'log':_0xed08('0x3')});};exports[_0xed08('0x4')]=function(_0x3a20dc,_0x394069){return client[_0xed08('0x2')](_0xed08('0x5'),{'body':_0x394069,'options':{'where':{'uniqueid':_0x3a20dc},'order':[['id',_0xed08('0x6')]],'limit':0x1},'log':_0xed08('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6079e99..b81670e 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 _0x8e0c=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x8e0c,0x1e7));var _0xc8e0=function(_0x59eee1,_0x16037c){_0x59eee1=_0x59eee1-0x0;var _0x5145d8=_0x8e0c[_0x59eee1];return _0x5145d8;};'use strict';var client=require(_0xc8e0('0x0'));exports[_0xc8e0('0x1')]=function(){return function(){return client[_0xc8e0('0x2')](_0xc8e0('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc8e0('0x4')],'include':[{'model':_0xc8e0('0x5'),'as':'Intervals','attributes':['id','name',_0xc8e0('0x6')]}]},'log':_0xc8e0('0x1')});};}; \ No newline at end of file +var _0x45f5=['Intervals','name','interval','../client','getIntervals','Interval'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x45f5,0x1c5));var _0x545f=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x45f5[_0xed5f9c];return _0x3a1c43;};'use strict';var client=require(_0x545f('0x0'));exports[_0x545f('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x545f('0x2'),'as':_0x545f('0x3'),'attributes':['id',_0x545f('0x4'),_0x545f('0x5')]}]},'log':_0x545f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 36d64ee..d446fa9 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 _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x137668,_0xd838c0){var _0x3226fa=function(_0x17d949){while(--_0x17d949){_0x137668['push'](_0x137668['shift']());}};_0x3226fa(++_0xd838c0);}(_0x5c3c,0x132));var _0xc5c3=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x5c3c[_0x432fca];return _0x3adba4;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file +var _0x2032=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x58a5ec,_0x5059bf){_0x58a5ec=_0x58a5ec-0x0;var _0x49f8e2=_0x2032[_0x58a5ec];return _0x49f8e2;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(_0x1e103d,_0xcd892f){return client['Request'](_0x2203('0x1'),{'body':_0xcd892f,'options':{'where':{'id':_0x1e103d}},'log':_0x2203('0x2')});};exports['addTags']=function(_0x46c49a,_0x880dcd){return client[_0x2203('0x3')](_0x2203('0x4'),{'body':_0x880dcd,'options':{'where':{'id':_0x46c49a}},'log':_0x2203('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b53a8de..1c265fc 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 _0xb28d=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x2b674d,_0x4c6f0f){var _0x32dd54=function(_0xc3f584){while(--_0xc3f584){_0x2b674d['push'](_0x2b674d['shift']());}};_0x32dd54(++_0x4c6f0f);}(_0xb28d,0x8c));var _0xdb28=function(_0x5a4a1f,_0x3f90b6){_0x5a4a1f=_0x5a4a1f-0x0;var _0x43db26=_0xb28d[_0x5a4a1f];return _0x43db26;};'use strict';var client=require(_0xdb28('0x0'));exports[_0xdb28('0x1')]=function(_0x9f8821){return client[_0xdb28('0x2')](_0xdb28('0x3'),{'body':_0x9f8821,'log':_0xdb28('0x4')});}; \ No newline at end of file +var _0x1ed4=['../client','create','Request','CreateMailMessage'];(function(_0x5b3e24,_0x4fa7b5){var _0x7c0ee5=function(_0x12bf27){while(--_0x12bf27){_0x5b3e24['push'](_0x5b3e24['shift']());}};_0x7c0ee5(++_0x4fa7b5);}(_0x1ed4,0xc0));var _0x41ed=function(_0x4989b0,_0x507b0f){_0x4989b0=_0x4989b0-0x0;var _0x12a6d5=_0x1ed4[_0x4989b0];return _0x12a6d5;};'use strict';var client=require(_0x41ed('0x0'));exports[_0x41ed('0x1')]=function(_0x36e71b){return client[_0x41ed('0x2')](_0x41ed('0x3'),{'body':_0x36e71b,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c8f2bb4..46a8006 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 _0xfe39=['name','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xfe39,0x8d));var _0x9fe3=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfe39[_0x25e7cb];return _0x375d92;};'use strict';var client=require(_0x9fe3('0x0'));exports[_0x9fe3('0x1')]=function(){return function(){return client['Request'](_0x9fe3('0x2'),{'options':{'raw':![],'attributes':['id',_0x9fe3('0x3'),'timeout',_0x9fe3('0x4')],'include':[{'model':_0x9fe3('0x5'),'as':_0x9fe3('0x6'),'attributes':['id',_0x9fe3('0x3'),_0x9fe3('0x7'),_0x9fe3('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xabac=['Request','GetMailQueue','name','timeout','strategy','mailPause','getMailQueues'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xabac,0xf4));var _0xcaba=function(_0x186412,_0x156e12){_0x186412=_0x186412-0x0;var _0x3abbd4=_0xabac[_0x186412];return _0x3abbd4;};'use strict';var client=require('../client');exports[_0xcaba('0x0')]=function(){return function(){return client[_0xcaba('0x1')](_0xcaba('0x2'),{'options':{'raw':![],'attributes':['id',_0xcaba('0x3'),_0xcaba('0x4'),_0xcaba('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xcaba('0x6')]}]},'log':_0xcaba('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b26ba84..830ee5e 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 _0xbf07=['Request','CreateMailQueueReport','update','DESC','create'];(function(_0x14a1fd,_0x5bcd57){var _0x3167bc=function(_0x3401ca){while(--_0x3401ca){_0x14a1fd['push'](_0x14a1fd['shift']());}};_0x3167bc(++_0x5bcd57);}(_0xbf07,0x1df));var _0x7bf0=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xbf07[_0x71e493];return _0x3d40ab;};'use strict';var client=require('../client');exports[_0x7bf0('0x0')]=function(_0x1ce952){return client[_0x7bf0('0x1')](_0x7bf0('0x2'),{'body':_0x1ce952,'log':_0x7bf0('0x2')});};exports[_0x7bf0('0x3')]=function(_0x1be55a,_0x302fc9){return client[_0x7bf0('0x1')]('UpdateMailQueueReport',{'body':_0x302fc9,'options':{'where':{'uniqueid':_0x1be55a},'order':[['id',_0x7bf0('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x093b=['CreateMailQueueReport','update','DESC','../client','create','Request'];(function(_0x5d0d10,_0x486c39){var _0x5b89dd=function(_0x136a87){while(--_0x136a87){_0x5d0d10['push'](_0x5d0d10['shift']());}};_0x5b89dd(++_0x486c39);}(_0x093b,0x1c5));var _0xb093=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x093b[_0x1646fa];return _0x5a47a5;};'use strict';var client=require(_0xb093('0x0'));exports[_0xb093('0x1')]=function(_0x2a4f57){return client[_0xb093('0x2')](_0xb093('0x3'),{'body':_0x2a4f57,'log':'CreateMailQueueReport'});};exports[_0xb093('0x4')]=function(_0x26b963,_0x1f4f23){return client[_0xb093('0x2')]('UpdateMailQueueReport',{'body':_0x1f4f23,'options':{'where':{'uniqueid':_0x26b963},'order':[['id',_0xb093('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 23a6554..c05fe26 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 _0x9282=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x3fe15d,_0x4a55e2){var _0x171fed=function(_0x5bb7c1){while(--_0x5bb7c1){_0x3fe15d['push'](_0x3fe15d['shift']());}};_0x171fed(++_0x4a55e2);}(_0x9282,0x1a7));var _0x2928=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0x9282[_0xe1063b];return _0x3f79b1;};'use strict';var client=require('../client');exports[_0x2928('0x0')]=function(_0x10ff73,_0x13eafc){return client[_0x2928('0x1')](_0x2928('0x2'),{'body':_0x13eafc,'options':{'where':{'id':_0x10ff73}},'log':_0x2928('0x3')});};exports[_0x2928('0x4')]=function(_0x5aa5b8,_0x24dfd8){return client['Request'](_0x2928('0x5'),{'body':_0x24dfd8,'options':{'where':{'id':_0x5aa5b8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc80d=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x264181,_0x586a6d){var _0x52a81d=function(_0x5a321d){while(--_0x5a321d){_0x264181['push'](_0x264181['shift']());}};_0x52a81d(++_0x586a6d);}(_0xc80d,0x1c1));var _0xdc80=function(_0xa13217,_0x4aa341){_0xa13217=_0xa13217-0x0;var _0x359201=_0xc80d[_0xa13217];return _0x359201;};'use strict';var client=require(_0xdc80('0x0'));exports[_0xdc80('0x1')]=function(_0x4af839,_0x46bda1){return client[_0xdc80('0x2')](_0xdc80('0x3'),{'body':_0x46bda1,'options':{'where':{'id':_0x4af839}},'log':_0xdc80('0x4')});};exports[_0xdc80('0x5')]=function(_0x10e16f,_0x1c72d0){return client[_0xdc80('0x2')](_0xdc80('0x6'),{'body':_0x1c72d0,'options':{'where':{'id':_0x10e16f}},'log':_0xdc80('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index cef28a1..d202c1c 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 _0x71c3=['CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2a771b,_0x11867a){var _0x58283d=function(_0x150af5){while(--_0x150af5){_0x2a771b['push'](_0x2a771b['shift']());}};_0x58283d(++_0x11867a);}(_0x71c3,0x16c));var _0x371c=function(_0x5d582f,_0x557bd6){_0x5d582f=_0x5d582f-0x0;var _0x22695c=_0x71c3[_0x5d582f];return _0x22695c;};'use strict';var client=require('../client');exports['create']=function(_0x14f0d3){return client['Request'](_0x371c('0x0'),{'body':_0x14f0d3,'log':_0x371c('0x1')});}; \ No newline at end of file +var _0x78c7=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2ad9a0,_0x2c0ce4){var _0xafe65a=function(_0x263e2c){while(--_0x263e2c){_0x2ad9a0['push'](_0x2ad9a0['shift']());}};_0xafe65a(++_0x2c0ce4);}(_0x78c7,0x198));var _0x778c=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x78c7[_0x47aa64];return _0x549c7a;};'use strict';var client=require(_0x778c('0x0'));exports['create']=function(_0x563aa1){return client[_0x778c('0x1')](_0x778c('0x2'),{'body':_0x563aa1,'log':_0x778c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 614d4c4..a5e26c6 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 _0x1770=['strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name'];(function(_0x26c7d7,_0x569883){var _0x1bd372=function(_0x7c7ff3){while(--_0x7c7ff3){_0x26c7d7['push'](_0x26c7d7['shift']());}};_0x1bd372(++_0x569883);}(_0x1770,0x6c));var _0x0177=function(_0x3c38c7,_0x14dd97){_0x3c38c7=_0x3c38c7-0x0;var _0x4aa4b1=_0x1770[_0x3c38c7];return _0x4aa4b1;};'use strict';var client=require(_0x0177('0x0'));exports[_0x0177('0x1')]=function(){return function(){return client['Request'](_0x0177('0x2'),{'options':{'raw':![],'attributes':['id',_0x0177('0x3'),'timeout',_0x0177('0x4')],'include':[{'model':_0x0177('0x5'),'as':_0x0177('0x6'),'attributes':['id',_0x0177('0x3'),'online',_0x0177('0x7')]}]},'log':_0x0177('0x1')});};}; \ No newline at end of file +var _0x8140=['Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8140,0x9c));var _0x0814=function(_0x45c60a,_0x17f344){_0x45c60a=_0x45c60a-0x0;var _0x25ab1b=_0x8140[_0x45c60a];return _0x25ab1b;};'use strict';var client=require('../client');exports[_0x0814('0x0')]=function(){return function(){return client[_0x0814('0x1')](_0x0814('0x2'),{'options':{'raw':![],'attributes':['id',_0x0814('0x3'),_0x0814('0x4'),_0x0814('0x5')],'include':[{'model':'User','as':_0x0814('0x6'),'attributes':['id','name',_0x0814('0x7'),_0x0814('0x8')]}]},'log':_0x0814('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1cd3dc7..28a9826 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 _0xe0dd=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe0dd,0x163));var _0xde0d=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xe0dd[_0x2d8fc2];return _0x3a9e53;};'use strict';var client=require(_0xde0d('0x0'));exports[_0xde0d('0x1')]=function(_0x50e4cd){return client[_0xde0d('0x2')](_0xde0d('0x3'),{'body':_0x50e4cd,'log':_0xde0d('0x3')});};exports[_0xde0d('0x4')]=function(_0x14b459,_0x21700d){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x21700d,'options':{'where':{'uniqueid':_0x14b459},'order':[['id',_0xde0d('0x5')]],'limit':0x1},'log':_0xde0d('0x6')});}; \ No newline at end of file +var _0xa7b1=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x232732,_0x2823ae){var _0x1796a9=function(_0x2840e6){while(--_0x2840e6){_0x232732['push'](_0x232732['shift']());}};_0x1796a9(++_0x2823ae);}(_0xa7b1,0x194));var _0x1a7b=function(_0x1aebe4,_0x54dba3){_0x1aebe4=_0x1aebe4-0x0;var _0x5b600d=_0xa7b1[_0x1aebe4];return _0x5b600d;};'use strict';var client=require('../client');exports[_0x1a7b('0x0')]=function(_0x5284e3){return client[_0x1a7b('0x1')](_0x1a7b('0x2'),{'body':_0x5284e3,'log':_0x1a7b('0x2')});};exports[_0x1a7b('0x3')]=function(_0x1f6f8d,_0x43c1ca){return client[_0x1a7b('0x1')](_0x1a7b('0x4'),{'body':_0x43c1ca,'options':{'where':{'uniqueid':_0x1f6f8d},'order':[['id',_0x1a7b('0x5')]],'limit':0x1},'log':_0x1a7b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fd626b0..71f62d1 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 _0x4453=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags'];(function(_0x137177,_0x151028){var _0x487c48=function(_0x5a2e88){while(--_0x5a2e88){_0x137177['push'](_0x137177['shift']());}};_0x487c48(++_0x151028);}(_0x4453,0x9c));var _0x3445=function(_0x5ee936,_0x5775c0){_0x5ee936=_0x5ee936-0x0;var _0x2cf998=_0x4453[_0x5ee936];return _0x2cf998;};'use strict';var client=require(_0x3445('0x0'));exports[_0x3445('0x1')]=function(_0x4b8f62,_0x298f9e){return client[_0x3445('0x2')]('UpdateSmsInteraction',{'body':_0x298f9e,'options':{'where':{'id':_0x4b8f62}},'log':_0x3445('0x3')});};exports[_0x3445('0x4')]=function(_0xfff5,_0x22c15c){return client[_0x3445('0x2')](_0x3445('0x5'),{'body':_0x22c15c,'options':{'where':{'id':_0xfff5}},'log':_0x3445('0x6')});}; \ No newline at end of file +var _0xde50=['UpdateSmsInteraction','addTags','Request'];(function(_0x522cbd,_0x244cbb){var _0xf435d7=function(_0x5f0efb){while(--_0x5f0efb){_0x522cbd['push'](_0x522cbd['shift']());}};_0xf435d7(++_0x244cbb);}(_0xde50,0x140));var _0x0de5=function(_0x53dba2,_0x1b09e5){_0x53dba2=_0x53dba2-0x0;var _0x415221=_0xde50[_0x53dba2];return _0x415221;};'use strict';var client=require('../client');exports['update']=function(_0x2938ef,_0x34b791){return client[_0x0de5('0x0')](_0x0de5('0x1'),{'body':_0x34b791,'options':{'where':{'id':_0x2938ef}},'log':'updateSmsInteraction'});};exports[_0x0de5('0x2')]=function(_0x5c22bc,_0x16fcda){return client['Request']('AddTagsToSmsInteraction',{'body':_0x16fcda,'options':{'where':{'id':_0x5c22bc}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e5c81e8..925af86 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 _0x69d5=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x69d5,0x1e9));var _0x569d=function(_0x1725ed,_0x479706){_0x1725ed=_0x1725ed-0x0;var _0x29e8ca=_0x69d5[_0x1725ed];return _0x29e8ca;};'use strict';var client=require('../client');exports[_0x569d('0x0')]=function(_0xffb8aa){return client[_0x569d('0x1')](_0x569d('0x2'),{'body':_0xffb8aa,'log':_0x569d('0x3')});}; \ No newline at end of file +var _0x37c6=['createSmsMessage','CreateSmsMessage'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x37c6,0x133));var _0x637c=function(_0x25e626,_0x8a67){_0x25e626=_0x25e626-0x0;var _0x42ae01=_0x37c6[_0x25e626];return _0x42ae01;};'use strict';var client=require('../client');exports['create']=function(_0x340b8c){return client['Request'](_0x637c('0x0'),{'body':_0x340b8c,'log':_0x637c('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index deb9010..129266a 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3cb532,_0x5b59e5){var _0x181fa4=function(_0xa61d48){while(--_0xa61d48){_0x3cb532['push'](_0x3cb532['shift']());}};_0x181fa4(++_0x5b59e5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcb91[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x41045f,_0x54994c){var _0x2721c8=function(_0x20bb67){while(--_0x20bb67){_0x41045f['push'](_0x41045f['shift']());}};_0x2721c8(++_0x54994c);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 76c679c..d900b9e 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x319bc0,_0x34f937){var _0x51d912=function(_0x3d5d71){while(--_0x3d5d71){_0x319bc0['push'](_0x319bc0['shift']());}};_0x51d912(++_0x34f937);}(_0x55ca,0x126));var _0xa55c=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x55ca[_0x5fa520];return _0x1bf6c4;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x35b205,_0x24e696){var _0x20ecb2=function(_0xead3ac){while(--_0xead3ac){_0x35b205['push'](_0x35b205['shift']());}};_0x20ecb2(++_0x24e696);}(_0x70e0,0x17b));var _0x070e=function(_0x1ebf86,_0x655c9f){_0x1ebf86=_0x1ebf86-0x0;var _0x44edc7=_0x70e0[_0x1ebf86];return _0x44edc7;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 96f4098..70777e8 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x160142,_0x23a880){var _0x58a624=function(_0x389097){while(--_0x389097){_0x160142['push'](_0x160142['shift']());}};_0x58a624(++_0x23a880);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x4aaa64,_0xae32ab){var _0x9aac36=function(_0x3ca958){while(--_0x3ca958){_0x4aaa64['push'](_0x4aaa64['shift']());}};_0x9aac36(++_0xae32ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index bfdb3a7..44c9c3d 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 _0xdfa0=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0xdfa0,0x69));var _0x0dfa=function(_0x3c10f7,_0x16480e){_0x3c10f7=_0x3c10f7-0x0;var _0x1b15d5=_0xdfa0[_0x3c10f7];return _0x1b15d5;};'use strict';var client=require(_0x0dfa('0x0'));exports['update']=function(_0x277084,_0x37ab88){return client['Request'](_0x0dfa('0x1'),{'body':_0x37ab88,'options':{'where':{'id':_0x277084}},'log':_0x0dfa('0x2')});};exports[_0x0dfa('0x3')]=function(_0x4dbbab,_0x373c4e){return client['Request'](_0x0dfa('0x4'),{'body':_0x373c4e,'options':{'where':{'id':_0x4dbbab}},'log':_0x0dfa('0x5')});}; \ No newline at end of file +var _0xfd87=['addTags','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3fbb91,_0x5ec106){var _0x3eb213=function(_0x118b9f){while(--_0x118b9f){_0x3fbb91['push'](_0x3fbb91['shift']());}};_0x3eb213(++_0x5ec106);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7fd8('0x0'));exports[_0x7fd8('0x1')]=function(_0xd3eb35,_0x42ecd1){return client[_0x7fd8('0x2')](_0x7fd8('0x3'),{'body':_0x42ecd1,'options':{'where':{'id':_0xd3eb35}},'log':_0x7fd8('0x4')});};exports[_0x7fd8('0x5')]=function(_0x4429f2,_0x43b442){return client[_0x7fd8('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x43b442,'options':{'where':{'id':_0x4429f2}},'log':_0x7fd8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 258d938..ac7bcf1 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 _0x4f36=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x43eca7,_0x3861c8){var _0x151255=function(_0x184742){while(--_0x184742){_0x43eca7['push'](_0x43eca7['shift']());}};_0x151255(++_0x3861c8);}(_0x4f36,0x169));var _0x64f3=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x4f36[_0x57d370];return _0x550fd2;};'use strict';var client=require(_0x64f3('0x0'));exports[_0x64f3('0x1')]=function(_0x5b37eb){return client[_0x64f3('0x2')](_0x64f3('0x3'),{'body':_0x5b37eb,'log':_0x64f3('0x4')});}; \ No newline at end of file +var _0xf408=['../client','create'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xf408,0x176));var _0x8f40=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0xf408[_0x3a2295];return _0x569710;};'use strict';var client=require(_0x8f40('0x0'));exports[_0x8f40('0x1')]=function(_0x2e2ed6){return client['Request']('CreateWhatsappMessage',{'body':_0x2e2ed6,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b575d96..28cc281 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 _0xd8aa=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause'];(function(_0x2e9334,_0x3addc8){var _0x35306e=function(_0x197deb){while(--_0x197deb){_0x2e9334['push'](_0x2e9334['shift']());}};_0x35306e(++_0x3addc8);}(_0xd8aa,0x118));var _0xad8a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd8aa[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xad8a('0x0'));exports[_0xad8a('0x1')]=function(){return function(){return client[_0xad8a('0x2')](_0xad8a('0x3'),{'options':{'raw':![],'attributes':['id',_0xad8a('0x4'),'timeout',_0xad8a('0x5')],'include':[{'model':_0xad8a('0x6'),'as':_0xad8a('0x7'),'attributes':['id',_0xad8a('0x4'),_0xad8a('0x8'),_0xad8a('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x8910=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x47878b,_0x45d098){var _0x57183e=function(_0x3a6906){while(--_0x3a6906){_0x47878b['push'](_0x47878b['shift']());}};_0x57183e(++_0x45d098);}(_0x8910,0x121));var _0x0891=function(_0x32e9e9,_0x3df5aa){_0x32e9e9=_0x32e9e9-0x0;var _0x400b63=_0x8910[_0x32e9e9];return _0x400b63;};'use strict';var client=require('../client');exports[_0x0891('0x0')]=function(){return function(){return client[_0x0891('0x1')](_0x0891('0x2'),{'options':{'raw':![],'attributes':['id',_0x0891('0x3'),_0x0891('0x4'),_0x0891('0x5')],'include':[{'model':_0x0891('0x6'),'as':_0x0891('0x7'),'attributes':['id',_0x0891('0x3'),_0x0891('0x8'),_0x0891('0x9')]}]},'log':_0x0891('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index eacbbb3..1e074f0 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 _0xd8c6=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x230447,_0x95aeee){var _0x208fd5=function(_0xdf38b3){while(--_0xdf38b3){_0x230447['push'](_0x230447['shift']());}};_0x208fd5(++_0x95aeee);}(_0xd8c6,0xd7));var _0x6d8c=function(_0x10784b,_0x59bd34){_0x10784b=_0x10784b-0x0;var _0x3123b4=_0xd8c6[_0x10784b];return _0x3123b4;};'use strict';var client=require(_0x6d8c('0x0'));exports['create']=function(_0x5ea5f1){return client[_0x6d8c('0x1')](_0x6d8c('0x2'),{'body':_0x5ea5f1,'log':_0x6d8c('0x2')});};exports[_0x6d8c('0x3')]=function(_0xd18a42,_0x5a8c10){return client[_0x6d8c('0x1')]('UpdateWhatsappQueueReport',{'body':_0x5a8c10,'options':{'where':{'uniqueid':_0xd18a42},'order':[['id','DESC']],'limit':0x1},'log':_0x6d8c('0x4')});}; \ No newline at end of file +var _0x06d4=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x1bb572,_0x3674d8){var _0x3716e3=function(_0x5593ed){while(--_0x5593ed){_0x1bb572['push'](_0x1bb572['shift']());}};_0x3716e3(++_0x3674d8);}(_0x06d4,0x15b));var _0x406d=function(_0x30bfae,_0x15eb2b){_0x30bfae=_0x30bfae-0x0;var _0x23a4c9=_0x06d4[_0x30bfae];return _0x23a4c9;};'use strict';var client=require(_0x406d('0x0'));exports[_0x406d('0x1')]=function(_0x122028){return client[_0x406d('0x2')](_0x406d('0x3'),{'body':_0x122028,'log':'CreateWhatsappQueueReport'});};exports[_0x406d('0x4')]=function(_0x5b5aa3,_0x34d71b){return client['Request'](_0x406d('0x5'),{'body':_0x34d71b,'options':{'where':{'uniqueid':_0x5b5aa3},'order':[['id','DESC']],'limit':0x1},'log':_0x406d('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 614823b..c2b592a 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 _0x1b29=['timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','string','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents'];(function(_0x557f77,_0x2ff13f){var _0x166ce5=function(_0x153405){while(--_0x153405){_0x557f77['push'](_0x557f77['shift']());}};_0x166ce5(++_0x2ff13f);}(_0x1b29,0x116));var _0x91b2=function(_0x2faf38,_0x43b0ec){_0x2faf38=_0x2faf38-0x0;var _0x35ced6=_0x1b29[_0x2faf38];return _0x35ced6;};'use strict';var schema=require(_0x91b2('0x0'));var _=require(_0x91b2('0x1'));var util=require(_0x91b2('0x2'));var seqqueue=require(_0x91b2('0x3'));var logger=require(_0x91b2('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x91b2('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x257e75,_0x67d578,_0x88b65d){return logger[_0x91b2('0x6')](util['format'](_0x91b2('0x7'),_0x257e75,_0x67d578[_0x91b2('0x8')],_0x88b65d));}function handleFindAgent(_0x2fdcbb){return function(_0x36d679){return _0x36d679[_0x91b2('0x8')][_0x91b2('0x9')]()===_0x2fdcbb['toLowerCase']();};}exports[_0x91b2('0xa')]=function(_0x5cc9dd,_0x109949,_0x232e76,_0x125164){return function(_0x194612){try{var _0x39a0a9={'name':_0x109949[0x0],'timeout':_0x109949[0x1]};var _0x81b61a=queue[_0x91b2('0x0')](_0x39a0a9,{'typecast':!![]});if(_0x81b61a['length']){logger[_0x91b2('0xb')](_0x91b2('0xc'),_0x5cc9dd,_[_0x91b2('0xd')](_0x81b61a,_0x91b2('0xe'))[_0x91b2('0xf')](',\x20'));_0x194612[_0x91b2('0x10')]();}else{var _0x218044=_[_0x91b2('0x11')](_0x232e76[_0x91b2('0x12')],handleFindAgent(_0x39a0a9[_0x91b2('0x8')]));if(_0x218044){var _0x230588=(_0x39a0a9[_0x91b2('0x13')]||0xa)*0x3e8;var _0x1bc5d5,_0x11f61b;var _0xce979e=seqqueue[_0x91b2('0x14')](_0x230588);_0xce979e['id']=_0x5cc9dd;_0xce979e['atimeout']=_0x230588;_0xce979e[_0x91b2('0x15')]=_0x125164[_0x91b2('0x15')];writeLog(_0x5cc9dd,_0x218044,util['format'](_0x91b2('0x16'),_0x230588));_0x232e76[_0x91b2('0x17')][_0x5cc9dd]['on'](_0x91b2('0x18'),function(){logger[_0x91b2('0x6')](_0x91b2('0x19'),_0x5cc9dd);clearTimeout(_0x11f61b);_0x11f61b=undefined;_0xce979e[_0x91b2('0x1a')]();if(_0x232e76['rules'][_0x5cc9dd]){delete _0x232e76['rules'][_0x5cc9dd];}_0x194612[_0x91b2('0x10')]();});_0x232e76[_0x91b2('0x17')][_0x5cc9dd]['on'](_0x91b2('0x1b'),function(){if(_0x232e76[_0x91b2('0x17')][_0x5cc9dd]){delete _0x232e76[_0x91b2('0x17')][_0x5cc9dd];}});_0x11f61b=setTimeout(function(){logger[_0x91b2('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x5cc9dd);clearTimeout(_0x11f61b);_0xce979e[_0x91b2('0x1a')]();_0x194612[_0x91b2('0x1c')]();},_0x230588);strategy[_0x91b2('0x1d')](_0xce979e,_0x218044,_0x232e76,_0x125164);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5cc9dd,_0x39a0a9[_0x91b2('0x8')]);_0x194612[_0x91b2('0x10')]();}}}catch(_0x7667eb){console[_0x91b2('0x1e')](_0x7667eb);logger[_0x91b2('0xb')](_0x91b2('0x1f'),_0x5cc9dd,_0x7667eb[_0x91b2('0x20')]);_0x194612[_0x91b2('0x10')]();}};}; \ No newline at end of file +var _0x1c34=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x124555,_0x48f05){var _0x157269=function(_0x37d5af){while(--_0x37d5af){_0x124555['push'](_0x124555['shift']());}};_0x157269(++_0x48f05);}(_0x1c34,0x65));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x41c3('0x0'));var _=require(_0x41c3('0x1'));var util=require('util');var seqqueue=require(_0x41c3('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x41c3('0x3'));var queue=schema({'name':{'type':_0x41c3('0x4'),'required':!![],'message':_0x41c3('0x5')},'timeout':{'type':_0x41c3('0x6'),'message':_0x41c3('0x7')}});function writeLog(_0x594b96,_0x3d33e7,_0xb775c0){return logger[_0x41c3('0x8')](util[_0x41c3('0x9')](_0x41c3('0xa'),_0x594b96,_0x3d33e7[_0x41c3('0xb')],_0xb775c0));}function handleFindAgent(_0x3cbd57){return function(_0x12ca4a){return _0x12ca4a[_0x41c3('0xb')][_0x41c3('0xc')]()===_0x3cbd57[_0x41c3('0xc')]();};}exports[_0x41c3('0xd')]=function(_0x4213a8,_0x387334,_0x159945,_0xe385e0){return function(_0x282019){try{var _0x42bb4e={'name':_0x387334[0x0],'timeout':_0x387334[0x1]};var _0x313dd0=queue['validate'](_0x42bb4e,{'typecast':!![]});if(_0x313dd0['length']){logger['error'](_0x41c3('0xe'),_0x4213a8,_[_0x41c3('0xf')](_0x313dd0,_0x41c3('0x10'))[_0x41c3('0x11')](',\x20'));_0x282019[_0x41c3('0x12')]();}else{var _0x4c836c=_[_0x41c3('0x13')](_0x159945[_0x41c3('0x14')],handleFindAgent(_0x42bb4e['name']));if(_0x4c836c){var _0x43e798=(_0x42bb4e[_0x41c3('0x15')]||0xa)*0x3e8;var _0x42fd4e,_0x24f94e;var _0x245e09=seqqueue[_0x41c3('0x16')](_0x43e798);_0x245e09['id']=_0x4213a8;_0x245e09['atimeout']=_0x43e798;_0x245e09[_0x41c3('0x17')]=_0xe385e0[_0x41c3('0x17')];writeLog(_0x4213a8,_0x4c836c,util[_0x41c3('0x9')](_0x41c3('0x18'),_0x43e798));_0x159945[_0x41c3('0x19')][_0x4213a8]['on'](_0x41c3('0x1a'),function(){logger[_0x41c3('0x8')](_0x41c3('0x1b'),_0x4213a8);clearTimeout(_0x24f94e);_0x24f94e=undefined;_0x245e09[_0x41c3('0x1c')]();if(_0x159945['rules'][_0x4213a8]){delete _0x159945[_0x41c3('0x19')][_0x4213a8];}_0x282019[_0x41c3('0x12')]();});_0x159945['rules'][_0x4213a8]['on'](_0x41c3('0x1d'),function(){if(_0x159945[_0x41c3('0x19')][_0x4213a8]){delete _0x159945['rules'][_0x4213a8];}});_0x24f94e=setTimeout(function(){logger[_0x41c3('0x8')](_0x41c3('0x1e'),_0x4213a8);clearTimeout(_0x24f94e);_0x245e09[_0x41c3('0x1c')]();_0x282019[_0x41c3('0x1f')]();},_0x43e798);strategy[_0x41c3('0x20')](_0x245e09,_0x4c836c,_0x159945,_0xe385e0);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4213a8,_0x42bb4e['name']);_0x282019['stop']();}}}catch(_0x287bfc){console[_0x41c3('0x21')](_0x287bfc);logger[_0x41c3('0x22')](_0x41c3('0x23'),_0x4213a8,_0x287bfc[_0x41c3('0x24')]);_0x282019[_0x41c3('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 50bb7b1..a5a5d2c 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 _0x9b4b=['sms','phone','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','body','amazonlex','providerResponse','create','dialogState','Failed','lodash','moment','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x16f07d,_0x278463){var _0x1b38d5=function(_0x575740){while(--_0x575740){_0x16f07d['push'](_0x16f07d['shift']());}};_0x1b38d5(++_0x278463);}(_0x9b4b,0x9f));var _0xb9b4=function(_0x592307,_0x2b8719){_0x592307=_0x592307-0x0;var _0x244eb8=_0x9b4b[_0x592307];return _0x244eb8;};'use strict';var _=require(_0xb9b4('0x0'));var moment=require(_0xb9b4('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xb9b4('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb9b4('0x3')),'faxMessage':require(_0xb9b4('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xcafce,_0x2d89be){return function(_0x446a32){try{if(!_[_0xb9b4('0x5')](this[_0xb9b4('0x6')][_0xb9b4('0x7')])){logger[_0xb9b4('0x8')](_0xb9b4('0x9'),_0xcafce,_0xb9b4('0xa'));return _0x446a32[_0xb9b4('0xb')]();}var _0x4fed39={'ContactId':this[_0xb9b4('0xc')]['id'],'sentAt':moment()[_0xb9b4('0xd')](_0xb9b4('0xe')),'direction':_0xb9b4('0xf')};if(this[_0xb9b4('0x10')]===_0xb9b4('0x11')||this[_0xb9b4('0x10')]==='whatsapp'){_0x4fed39[_0xb9b4('0x12')]=this[_0xb9b4('0x6')][_0xb9b4('0x12')];}var _0x507eb3=this[_0xb9b4('0x10')];if(_0x507eb3==='chat'){_0x4fed39[_0xb9b4('0x13')]=this[_0xb9b4('0x14')]['id'];}else{_0x4fed39[_['upperFirst'](_0x507eb3)+_0xb9b4('0x15')]=this['account']['id'];}_0x4fed39[_[_0xb9b4('0x16')](_0x507eb3)+'InteractionId']=this['interaction']['id'];if(this[_0xb9b4('0x6')][_0xb9b4('0x17')]){var _0x3fcb66=_0x2d89be[0x4];if(!_[_0xb9b4('0x18')](_0x3fcb66)){_0x4fed39['body']=utils['getMustacheRender'](_0x3fcb66,this);return rpc[_0x507eb3+_0xb9b4('0x19')]['create'](_0x4fed39)[_0xb9b4('0x1a')](function(_0x4dda86){logger[_0xb9b4('0x8')](_0xb9b4('0x9'),_0xcafce,_0x4fed39['body']);})[_0xb9b4('0x1b')](function(_0x43c4a9){logger[_0xb9b4('0x1c')]('[%s][AMAZONLEX]\x20%s',_0xcafce,JSON[_0xb9b4('0x1d')](_0x43c4a9));})[_0xb9b4('0x1e')](function(){logger[_0xb9b4('0x8')](_0xb9b4('0x1f'),_0xcafce);_0x446a32[_0xb9b4('0x20')]();});}else{logger[_0xb9b4('0x8')](_0xb9b4('0x21'),_0xcafce);_0x446a32[_0xb9b4('0x20')]();}}else{var _0x52acb7=this;var _0x5eb3f2=new AWS[(_0xb9b4('0x22'))]({'accessKeyId':_0x2d89be[0x0],'secretAccessKey':_0x2d89be[0x1],'region':_0x2d89be[0x2]});var _0x3cd541={'botAlias':'$LATEST','botName':_0x2d89be[0x3],'inputText':this['message']['body'],'userId':this[_0xb9b4('0x10')]+':'+this[_0xb9b4('0x6')]['id'][_0xb9b4('0x23')]()};_0x5eb3f2[_0xb9b4('0x24')](_0x3cd541,function(_0x3b7725,_0x5c08f0){if(_0x3b7725){logger[_0xb9b4('0x1c')](_0xb9b4('0x9'),_0xcafce,_0x3b7725[_0xb9b4('0x25')]);_0x446a32[_0xb9b4('0xb')]();}else if(_0x5c08f0&&_0x5c08f0['message']){_0x52acb7[_0xb9b4('0x26')]['amazonlex']=_0x5c08f0;_0x4fed39[_0xb9b4('0x26')]=_0x5c08f0[_0xb9b4('0x25')];_0x4fed39['providerName']=_0xb9b4('0x27');_0x4fed39[_0xb9b4('0x28')]=JSON[_0xb9b4('0x1d')](_0x5c08f0);return rpc[_0x507eb3+'Message'][_0xb9b4('0x29')](_0x4fed39)[_0xb9b4('0x1a')](function(_0x63c844){logger[_0xb9b4('0x8')](_0xb9b4('0x9'),_0xcafce,_0x4fed39[_0xb9b4('0x26')]);if(_0x5c08f0[_0xb9b4('0x2a')]==_0xb9b4('0x2b')){_0x446a32[_0xb9b4('0xb')]();}else{_0x446a32['stop']();}})[_0xb9b4('0x1b')](function(_0xf6fcbf){logger['error'](_0xb9b4('0x9'),_0xcafce,JSON['stringify'](_0xf6fcbf));_0x446a32[_0xb9b4('0xb')]();});}else{_0x446a32[_0xb9b4('0xb')]();}});}}catch(_0x3e22f9){logger[_0xb9b4('0x1c')](_0xb9b4('0x9'),_0xcafce,JSON[_0xb9b4('0x1d')](_0x3e22f9));_0x446a32['stop']();}};}; \ No newline at end of file +var _0x494f=['created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','Failed','catch','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account'];(function(_0x4b5020,_0x1bd24e){var _0x137b65=function(_0xa24a){while(--_0xa24a){_0x4b5020['push'](_0x4b5020['shift']());}};_0x137b65(++_0x1bd24e);}(_0x494f,0x77));var _0xf494=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x494f[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xf494('0x0'));var logger=require(_0xf494('0x1'))('routing');var rpc={'chatMessage':require(_0xf494('0x2')),'openchannelMessage':require(_0xf494('0x3')),'mailMessage':require(_0xf494('0x4')),'smsMessage':require(_0xf494('0x5')),'faxMessage':require(_0xf494('0x6')),'whatsappMessage':require(_0xf494('0x7'))};exports['consequence']=function(_0x19f543,_0x53517f){return function(_0x5925eb){try{if(!_['isNil'](this[_0xf494('0x8')][_0xf494('0x9')])){logger[_0xf494('0xa')](_0xf494('0xb'),_0x19f543,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5925eb[_0xf494('0xc')]();}var _0x1034ea={'ContactId':this[_0xf494('0xd')]['id'],'sentAt':moment()[_0xf494('0xe')](_0xf494('0xf')),'direction':_0xf494('0x10')};if(this[_0xf494('0x11')]===_0xf494('0x12')||this['channel']==='whatsapp'){_0x1034ea[_0xf494('0x13')]=this['interaction'][_0xf494('0x13')];}var _0xa63008=this[_0xf494('0x11')];if(_0xa63008===_0xf494('0x14')){_0x1034ea[_0xf494('0x15')]=this['account']['id'];}else{_0x1034ea[_[_0xf494('0x16')](_0xa63008)+_0xf494('0x17')]=this[_0xf494('0x18')]['id'];}_0x1034ea[_[_0xf494('0x16')](_0xa63008)+'InteractionId']=this[_0xf494('0x8')]['id'];if(this['interaction'][_0xf494('0x19')]){var _0x4a07f7=_0x53517f[0x4];if(!_[_0xf494('0x1a')](_0x4a07f7)){_0x1034ea[_0xf494('0x1b')]=utils[_0xf494('0x1c')](_0x4a07f7,this);return rpc[_0xa63008+_0xf494('0x1d')][_0xf494('0x1e')](_0x1034ea)[_0xf494('0x1f')](function(_0x91fb3b){logger[_0xf494('0xa')](_0xf494('0xb'),_0x19f543,_0x1034ea[_0xf494('0x1b')]);})['catch'](function(_0x454568){logger[_0xf494('0x20')](_0xf494('0xb'),_0x19f543,JSON[_0xf494('0x21')](_0x454568));})[_0xf494('0x22')](function(){logger[_0xf494('0xa')](_0xf494('0x23'),_0x19f543);_0x5925eb[_0xf494('0x24')]();});}else{logger[_0xf494('0xa')](_0xf494('0x25'),_0x19f543);_0x5925eb[_0xf494('0x24')]();}}else{var _0x309d52=this;var _0x5b8732=new AWS[(_0xf494('0x26'))]({'accessKeyId':_0x53517f[0x0],'secretAccessKey':_0x53517f[0x1],'region':_0x53517f[0x2]});var _0x30c2e1={'botAlias':_0xf494('0x27'),'botName':_0x53517f[0x3],'inputText':this[_0xf494('0x28')]['body'],'userId':this[_0xf494('0x11')]+':'+this[_0xf494('0x8')]['id'][_0xf494('0x29')]()};_0x5b8732[_0xf494('0x2a')](_0x30c2e1,function(_0x47354c,_0x4063a2){if(_0x47354c){logger[_0xf494('0x20')](_0xf494('0xb'),_0x19f543,_0x47354c[_0xf494('0x28')]);_0x5925eb[_0xf494('0xc')]();}else if(_0x4063a2&&_0x4063a2[_0xf494('0x28')]){_0x309d52[_0xf494('0x1b')][_0xf494('0x2b')]=_0x4063a2;_0x1034ea[_0xf494('0x1b')]=_0x4063a2[_0xf494('0x28')];_0x1034ea['providerName']=_0xf494('0x2b');_0x1034ea[_0xf494('0x2c')]=JSON[_0xf494('0x21')](_0x4063a2);return rpc[_0xa63008+_0xf494('0x1d')][_0xf494('0x1e')](_0x1034ea)[_0xf494('0x1f')](function(_0x34082c){logger['info']('[%s][AMAZONLEX]\x20%s',_0x19f543,_0x1034ea[_0xf494('0x1b')]);if(_0x4063a2[_0xf494('0x2d')]==_0xf494('0x2e')){_0x5925eb[_0xf494('0xc')]();}else{_0x5925eb[_0xf494('0x24')]();}})[_0xf494('0x2f')](function(_0x3b50f3){logger[_0xf494('0x20')](_0xf494('0xb'),_0x19f543,JSON['stringify'](_0x3b50f3));_0x5925eb[_0xf494('0xc')]();});}else{_0x5925eb[_0xf494('0xc')]();}});}}catch(_0x48e5c9){logger['error']('[%s][AMAZONLEX]\x20%s',_0x19f543,JSON[_0xf494('0x21')](_0x48e5c9));_0x5925eb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 720aaca..e97b261 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 _0x9051=['html','','','headers','auto-replied','All','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','then','catch','error','stringify','finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','inReplyTo'];(function(_0x40ceac,_0x493dc7){var _0x2945da=function(_0x3624a7){while(--_0x3624a7){_0x40ceac['push'](_0x40ceac['shift']());}};_0x2945da(++_0x493dc7);}(_0x9051,0xdf));var _0x1905=function(_0x1289e7,_0x1d2b99){_0x1289e7=_0x1289e7-0x0;var _0x1a1999=_0x9051[_0x1289e7];return _0x1a1999;};'use strict';var _=require(_0x1905('0x0'));var moment=require(_0x1905('0x1'));var utils=require(_0x1905('0x2'));var logger=require(_0x1905('0x3'))(_0x1905('0x4'));var rpc={'chatMessage':require(_0x1905('0x5')),'openchannelMessage':require(_0x1905('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1905('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x1905('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1905('0x9')),'smsInteraction':require(_0x1905('0xa')),'faxInteraction':require(_0x1905('0xb')),'whatsappInteraction':require(_0x1905('0xc'))};var mailRpc=require(_0x1905('0xd'));exports[_0x1905('0xe')]=function(_0x2e4323,_0x2e9cf7,_0x2af1db,_0x48fa26){return function(_0x2bfef2){try{var _0x3008a3=this['channel'];if(_0x3008a3==='mail'&&_0x48fa26[_0x1905('0xf')]['isAutoreply']){logger[_0x1905('0x10')](_0x1905('0x11'),_0x2e4323,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2bfef2[_0x1905('0x12')]();}if(_0x2e9cf7[0x0]==='1'&&(_[_0x1905('0x13')](this[_0x1905('0x14')][_0x1905('0x15')])||!this[_0x1905('0x14')]['created'])){logger[_0x1905('0x10')]('[%s][AUTOREPLY]\x20%s',_0x2e4323,_0x1905('0x16'));return _0x2bfef2[_0x1905('0x12')]();}if(_0x2e9cf7[0x0]==='2'&&this[_0x1905('0x14')][_0x1905('0x17')]){logger[_0x1905('0x10')](_0x1905('0x18'),_0x2e4323,_0x1905('0x19'));return _0x2bfef2['next']();}var _0x4c079e={'ContactId':this[_0x1905('0x1a')]['id'],'sentAt':moment()['format'](_0x1905('0x1b')),'direction':_0x1905('0x1c')};if(this[_0x1905('0x1d')]===_0x1905('0x1e')){_0x4c079e[_0x1905('0xf')]=utils[_0x1905('0x1f')](_0x2e9cf7[0x2],this);}else{_0x4c079e[_0x1905('0xf')]=utils[_0x1905('0x1f')](_0x2e9cf7[0x1],this);}if(this[_0x1905('0x20')]){_0x4c079e['to']=this['message']['from']||'';if(this['channel']===_0x1905('0x1e')&&_0x2e9cf7[0x1]==='1'){_0x4c079e['cc']=this['message']['cc']||'';}_0x4c079e[_0x1905('0x21')]=this['message']['to']||'';_0x4c079e['phone']=this[_0x1905('0x20')]['phone']||'';_0x4c079e[_0x1905('0x22')]=!![];if(this[_0x1905('0x20')][_0x1905('0x23')]){_0x4c079e[_0x1905('0x23')]='';_0x4c079e['subject']+=_[_0x1905('0x24')](this[_0x1905('0x20')][_0x1905('0x23')],_0x1905('0x25'))?'':_0x1905('0x26');_0x4c079e[_0x1905('0x23')]+=this[_0x1905('0x20')][_0x1905('0x23')];}}if(this[_0x1905('0x1d')]===_0x1905('0x27')){_0x4c079e[_0x1905('0x28')]=this[_0x1905('0x29')]['id'];}else{_0x4c079e[_[_0x1905('0x2a')](this['channel'])+'AccountId']=this[_0x1905('0x29')]['id'];}_0x4c079e[_['upperFirst'](this[_0x1905('0x1d')])+_0x1905('0x2b')]=this[_0x1905('0x14')]['id'];var _0x2c6fc6=this['interaction'];if(rpc[this[_0x1905('0x1d')]+'Message']){if(this[_0x1905('0x1d')]===_0x1905('0x1e')){_0x4c079e[_0x1905('0x2c')]=this['message']['messageId'];_0x4c079e[_0x1905('0x2d')]=_0x1905('0x2e')+_['replace'](_0x4c079e[_0x1905('0xf')],'','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence'];(function(_0xcedc4b,_0x4af99d){var _0x23efcc=function(_0x4f7ff4){while(--_0x4f7ff4){_0xcedc4b['push'](_0xcedc4b['shift']());}};_0x23efcc(++_0x4af99d);}(_0x237e,0xcf));var _0xe237=function(_0x35556f,_0x3c08fa){_0x35556f=_0x35556f-0x0;var _0xde28f=_0x237e[_0x35556f];return _0xde28f;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xe237('0x0'));var logger=require('../../../../config/logger')(_0xe237('0x1'));var rpc={'chatMessage':require(_0xe237('0x2')),'openchannelMessage':require(_0xe237('0x3')),'mailMessage':require(_0xe237('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe237('0x5')),'whatsappMessage':require(_0xe237('0x6')),'chatInteraction':require(_0xe237('0x7')),'openchannelInteraction':require(_0xe237('0x8')),'mailInteraction':require(_0xe237('0x9')),'smsInteraction':require(_0xe237('0xa')),'faxInteraction':require(_0xe237('0xb')),'whatsappInteraction':require(_0xe237('0xc'))};var mailRpc=require(_0xe237('0xd'));exports[_0xe237('0xe')]=function(_0x29d11d,_0x10618b,_0x5468cf,_0x44f191){return function(_0x34a314){try{var _0x84ff0e=this[_0xe237('0xf')];if(_0x84ff0e===_0xe237('0x10')&&_0x44f191[_0xe237('0x11')][_0xe237('0x12')]){logger[_0xe237('0x13')](_0xe237('0x14'),_0x29d11d,_0xe237('0x15'));return _0x34a314[_0xe237('0x16')]();}if(_0x10618b[0x0]==='1'&&(_[_0xe237('0x17')](this[_0xe237('0x18')]['created'])||!this[_0xe237('0x18')][_0xe237('0x19')])){logger[_0xe237('0x13')](_0xe237('0x14'),_0x29d11d,_0xe237('0x1a'));return _0x34a314[_0xe237('0x16')]();}if(_0x10618b[0x0]==='2'&&this[_0xe237('0x18')][_0xe237('0x1b')]){logger[_0xe237('0x13')](_0xe237('0x1c'),_0x29d11d,_0xe237('0x1d'));return _0x34a314[_0xe237('0x16')]();}var _0x1583ce={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe237('0x1e')](_0xe237('0x1f')),'direction':_0xe237('0x20')};if(this['channel']===_0xe237('0x10')){_0x1583ce['body']=utils[_0xe237('0x21')](_0x10618b[0x2],this);}else{_0x1583ce['body']=utils[_0xe237('0x21')](_0x10618b[0x1],this);}if(this[_0xe237('0x22')]){_0x1583ce['to']=this[_0xe237('0x22')][_0xe237('0x23')]||'';if(this['channel']===_0xe237('0x10')&&_0x10618b[0x1]==='1'){_0x1583ce['cc']=this[_0xe237('0x22')]['cc']||'';}_0x1583ce['from']=this['message']['to']||'';_0x1583ce[_0xe237('0x24')]=this[_0xe237('0x22')]['phone']||'';_0x1583ce[_0xe237('0x25')]=!![];if(this[_0xe237('0x22')][_0xe237('0x26')]){_0x1583ce[_0xe237('0x26')]='';_0x1583ce[_0xe237('0x26')]+=_[_0xe237('0x27')](this[_0xe237('0x22')][_0xe237('0x26')],_0xe237('0x28'))?'':_0xe237('0x29');_0x1583ce[_0xe237('0x26')]+=this[_0xe237('0x22')][_0xe237('0x26')];}}if(this[_0xe237('0xf')]==='chat'){_0x1583ce[_0xe237('0x2a')]=this[_0xe237('0x2b')]['id'];}else{_0x1583ce[_['upperFirst'](this[_0xe237('0xf')])+_0xe237('0x2c')]=this[_0xe237('0x2b')]['id'];}_0x1583ce[_[_0xe237('0x2d')](this[_0xe237('0xf')])+'InteractionId']=this[_0xe237('0x18')]['id'];var _0x4171b6=this['interaction'];if(rpc[this[_0xe237('0xf')]+_0xe237('0x2e')]){if(this['channel']===_0xe237('0x10')){_0x1583ce[_0xe237('0x2f')]=this[_0xe237('0x22')][_0xe237('0x30')];_0x1583ce[_0xe237('0x31')]=_0xe237('0x32')+_[_0xe237('0x33')](_0x1583ce[_0xe237('0x11')],_0xe237('0x34'),_0xe237('0x35'))+_0xe237('0x36');_0x1583ce[_0xe237('0x37')]={'Auto-Submitted':_0xe237('0x38'),'X-Auto-Response-Suppress':_0xe237('0x39'),'Precedence':_0xe237('0x3a')};return mailRpc[_0xe237('0x3b')](this[_0xe237('0x2b')][_0xe237('0x3c')],_0x1583ce)['then'](function(_0x468b71){logger[_0xe237('0x13')](_0xe237('0x3d'),_0x29d11d);_0x1583ce[_0xe237('0x30')]=_0x468b71[_0xe237('0x22')][_0xe237('0x30')];return rpc[_0x84ff0e+_0xe237('0x2e')][_0xe237('0x3e')](_0x1583ce);})[_0xe237('0x3f')](function(_0x49a791){logger['info']('[%s][AUTOREPLY]\x20%s',_0x29d11d,JSON[_0xe237('0x40')](_0x49a791));})[_0xe237('0x41')](function(_0x5bd28b){logger[_0xe237('0x42')](_0xe237('0x43'),_0x29d11d,JSON[_0xe237('0x40')](_0x5bd28b));})[_0xe237('0x44')](function(){Promise[_0xe237('0x45')]()['then'](function(){if(_0x10618b[0x0]!=='2'||_0x4171b6[_0xe237('0x1b')])return;return rpc[_0x84ff0e+_0xe237('0x46')][_0xe237('0x47')](_0x4171b6['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1af216){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x29d11d,JSON[_0xe237('0x40')](_0x1af216));})['catch'](function(_0x105008){logger['error'](_0xe237('0x48'),_0x29d11d,JSON[_0xe237('0x40')](_0x105008));});})['then'](function(){_0x34a314[_0xe237('0x16')]();});});}else{return rpc[this['channel']+'Message'][_0xe237('0x3e')](_0x1583ce)['then'](function(){logger[_0xe237('0x13')](_0xe237('0x14'),_0x29d11d,_0x1583ce[_0xe237('0x11')]);})[_0xe237('0x41')](function(_0x1b08b0){logger['error']('[%s][AUTOREPLY]\x20%s',_0x29d11d,JSON['stringify'](_0x1b08b0));})[_0xe237('0x44')](function(){Promise[_0xe237('0x45')]()[_0xe237('0x3f')](function(){if(_0x10618b[0x0]!=='2'||_0x4171b6[_0xe237('0x1b')])return;return rpc[_0x84ff0e+_0xe237('0x46')]['update'](_0x4171b6['id'],{'autoreplyExecuted':!![]})['then'](function(_0xd3c2a7){logger[_0xe237('0x13')](_0xe237('0x1c'),_0x29d11d,JSON['stringify'](_0xd3c2a7));})[_0xe237('0x41')](function(_0xb0709d){logger[_0xe237('0x42')](_0xe237('0x48'),_0x29d11d,JSON['stringify'](_0xb0709d));});})[_0xe237('0x3f')](function(){_0x34a314[_0xe237('0x16')]();});});}}}catch(_0x48de2b){logger[_0xe237('0x42')]('[%s][AUTOREPLY]\x20%s',_0x29d11d,JSON['stringify'](_0x48de2b));_0x34a314[_0xe237('0x49')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3d24e4a..5977dc0 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe02d=['format','system','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xe02d,0x97));var _0xde02=function(_0x17c728,_0x5b802f){_0x17c728=_0x17c728-0x0;var _0x1dc66d=_0xe02d[_0x17c728];return _0x1dc66d;};'use strict';var moment=require(_0xde02('0x0'));var logger=require(_0xde02('0x1'))('routing');var rpc={'chatInteraction':require(_0xde02('0x2')),'openchannelInteraction':require(_0xde02('0x3')),'smsInteraction':require(_0xde02('0x4')),'mailInteraction':require(_0xde02('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xde02('0x6'))};exports[_0xde02('0x7')]=function(_0x4a935a,_0x14e019,_0x494fbb,_0x4dc268){return function(_0x2d083d){try{logger[_0xde02('0x8')](_0xde02('0x9'),_0x4a935a,_0x14e019[0x0]);var _0x3c6346={'closed':0x1,'closedAt':moment()[_0xde02('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xde02('0xb'),'disposition':_0x14e019[0x0]};if(rpc[_0x4dc268['channel']+'Interaction']){rpc[_0x4dc268['channel']+_0xde02('0xc')][_0xde02('0xd')](_0x4dc268[_0xde02('0xe')]['id'],_0x3c6346)[_0xde02('0xf')](function(_0x100569){logger[_0xde02('0x8')](_0xde02('0x10'),_0x4a935a,_0x4dc268[_0xde02('0xe')]['id']);})[_0xde02('0x11')](function(_0x3f040c){logger[_0xde02('0x12')](_0xde02('0x13'),_0x4a935a,JSON[_0xde02('0x14')](_0x3f040c));})[_0xde02('0x15')](function(){_0x2d083d[_0xde02('0x16')]();});}}catch(_0x322512){logger['error'](_0xde02('0x13'),_0x4a935a,JSON[_0xde02('0x14')](_0x322512));_0x2d083d[_0xde02('0x16')]();}};}; \ No newline at end of file +var _0xbf22=['catch','error','finally','stop','stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbf22,0x10d));var _0x2bf2=function(_0x43f00,_0x3d0b21){_0x43f00=_0x43f00-0x0;var _0x2c1aa8=_0xbf22[_0x43f00];return _0x2c1aa8;};'use strict';var moment=require(_0x2bf2('0x0'));var logger=require(_0x2bf2('0x1'))('routing');var rpc={'chatInteraction':require(_0x2bf2('0x2')),'openchannelInteraction':require(_0x2bf2('0x3')),'smsInteraction':require(_0x2bf2('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2bf2('0x5')),'whatsappInteraction':require(_0x2bf2('0x6'))};exports['consequence']=function(_0x24ce59,_0x48c259,_0x345a1f,_0x43215a){return function(_0x3338fe){try{logger[_0x2bf2('0x7')](_0x2bf2('0x8'),_0x24ce59,_0x48c259[0x0]);var _0x24a71a={'closed':0x1,'closedAt':moment()[_0x2bf2('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x2bf2('0xa'),'disposition':_0x48c259[0x0]};if(rpc[_0x43215a[_0x2bf2('0xb')]+_0x2bf2('0xc')]){rpc[_0x43215a[_0x2bf2('0xb')]+_0x2bf2('0xc')][_0x2bf2('0xd')](_0x43215a[_0x2bf2('0xe')]['id'],_0x24a71a)[_0x2bf2('0xf')](function(_0x2c6c7f){logger[_0x2bf2('0x7')](_0x2bf2('0x10'),_0x24ce59,_0x43215a[_0x2bf2('0xe')]['id']);})[_0x2bf2('0x11')](function(_0x559edc){logger[_0x2bf2('0x12')]('[%s][CLOSE]\x20%s',_0x24ce59,JSON['stringify'](_0x559edc));})[_0x2bf2('0x13')](function(){_0x3338fe[_0x2bf2('0x14')]();});}}catch(_0x3350ab){logger[_0x2bf2('0x12')]('[%s][CLOSE]\x20%s',_0x24ce59,JSON[_0x2bf2('0x15')](_0x3350ab));_0x3338fe[_0x2bf2('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index adb9229..0fbfdce 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02b6=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','dialogflow','fulfillment','speech','providerResponse','result','metadata','endConversation','error','stringify','lodash','apiai-promise','md5','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','catch','finally'];(function(_0x159aa0,_0x5b9b1a){var _0x1a7fa7=function(_0x33d78b){while(--_0x33d78b){_0x159aa0['push'](_0x159aa0['shift']());}};_0x1a7fa7(++_0x5b9b1a);}(_0x02b6,0xfe));var _0x602b=function(_0x5a8d1f,_0x5c4f55){_0x5a8d1f=_0x5a8d1f-0x0;var _0x1a4bc8=_0x02b6[_0x5a8d1f];return _0x1a4bc8;};'use strict';var _=require(_0x602b('0x0'));var moment=require('moment');var apiai=require(_0x602b('0x1'));var md5=require(_0x602b('0x2'));var utils=require(_0x602b('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x602b('0x4')),'openchannelMessage':require(_0x602b('0x5')),'mailMessage':require(_0x602b('0x6')),'smsMessage':require(_0x602b('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x602b('0x8'))};exports['consequence']=function(_0x265e3b,_0xac6c85){return function(_0x140c8a){try{if(!_[_0x602b('0x9')](this[_0x602b('0xa')][_0x602b('0xb')])){logger[_0x602b('0xc')](_0x602b('0xd'),_0x265e3b,_0x602b('0xe'));return _0x140c8a[_0x602b('0xf')]();}var _0x4fb0a2={'ContactId':this[_0x602b('0x10')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x602b('0x11')};if(this['channel']===_0x602b('0x12')||this[_0x602b('0x13')]==='whatsapp'){_0x4fb0a2[_0x602b('0x14')]=this[_0x602b('0xa')][_0x602b('0x14')];}var _0x56a4d3=this[_0x602b('0x13')];if(_0x56a4d3===_0x602b('0x15')){_0x4fb0a2[_0x602b('0x16')]=this[_0x602b('0x17')]['id'];}else{_0x4fb0a2[_[_0x602b('0x18')](_0x56a4d3)+_0x602b('0x19')]=this[_0x602b('0x17')]['id'];}_0x4fb0a2[_['upperFirst'](_0x56a4d3)+'InteractionId']=this[_0x602b('0xa')]['id'];if(this[_0x602b('0xa')][_0x602b('0x1a')]){var _0x18abb6=_0xac6c85[0x2];if(!_[_0x602b('0x1b')](_0x18abb6)){_0x4fb0a2[_0x602b('0x1c')]=utils[_0x602b('0x1d')](_0x18abb6,this);return rpc[_0x56a4d3+_0x602b('0x1e')][_0x602b('0x1f')](_0x4fb0a2)['then'](function(_0x48d992){logger[_0x602b('0xc')](_0x602b('0xd'),_0x265e3b,_0x4fb0a2['body']);})[_0x602b('0x20')](function(_0x581a3b){logger['error'](_0x602b('0xd'),_0x265e3b,JSON['stringify'](_0x581a3b));})[_0x602b('0x21')](function(){logger['info'](_0x602b('0x22'),_0x265e3b);_0x140c8a[_0x602b('0x23')]();});}else{logger[_0x602b('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x265e3b);_0x140c8a[_0x602b('0x23')]();}}else{var _0x1264c8=this;var _0x580b66=apiai(_0xac6c85[0x0],{'language':_0xac6c85[0x1]||'en'});return _0x580b66[_0x602b('0x24')](this[_0x602b('0x25')][_0x602b('0x1c')],{'sessionId':md5(this[_0x602b('0xa')]['id'])})[_0x602b('0x26')](function(_0xb3beff){_0x1264c8[_0x602b('0x1c')][_0x602b('0x27')]=_0xb3beff;_0x4fb0a2[_0x602b('0x1c')]=_0xb3beff['result'][_0x602b('0x28')][_0x602b('0x29')];_0x4fb0a2['providerName']=_0x602b('0x27');_0x4fb0a2[_0x602b('0x2a')]=JSON['stringify'](_0xb3beff);return rpc[_0x56a4d3+_0x602b('0x1e')][_0x602b('0x1f')](_0x4fb0a2)[_0x602b('0x26')](function(_0x2bb5b7){logger[_0x602b('0xc')](_0x602b('0xd'),_0x265e3b,_0x4fb0a2[_0x602b('0x1c')]);if(_0xb3beff[_0x602b('0x2b')][_0x602b('0x2c')][_0x602b('0x2d')]){_0x140c8a[_0x602b('0xf')]();}else{_0x140c8a['stop']();}})[_0x602b('0x20')](function(_0x582ccc){logger[_0x602b('0x2e')](_0x602b('0xd'),_0x265e3b,JSON[_0x602b('0x2f')](_0x582ccc));_0x140c8a[_0x602b('0xf')]();});})[_0x602b('0x20')](function(_0x3647cf){logger[_0x602b('0x2e')](_0x602b('0xd'),_0x265e3b,_0x3647cf[_0x602b('0x25')]);_0x140c8a[_0x602b('0xf')]();});}}catch(_0x407f54){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x265e3b,JSON[_0x602b('0x2f')](_0x407f54));_0x140c8a[_0x602b('0x23')]();}};}; \ No newline at end of file +var _0x87d8=['AccountId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','providerName','providerResponse','Message','metadata','stop','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','next','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account'];(function(_0x137f83,_0x51684d){var _0x2a625d=function(_0x3f1965){while(--_0x3f1965){_0x137f83['push'](_0x137f83['shift']());}};_0x2a625d(++_0x51684d);}(_0x87d8,0x1a9));var _0x887d=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0x87d8[_0x177dc7];return _0x19b7dc;};'use strict';var _=require('lodash');var moment=require(_0x887d('0x0'));var apiai=require(_0x887d('0x1'));var md5=require(_0x887d('0x2'));var utils=require(_0x887d('0x3'));var logger=require(_0x887d('0x4'))(_0x887d('0x5'));var rpc={'chatMessage':require(_0x887d('0x6')),'openchannelMessage':require(_0x887d('0x7')),'mailMessage':require(_0x887d('0x8')),'smsMessage':require(_0x887d('0x9')),'faxMessage':require(_0x887d('0xa')),'whatsappMessage':require(_0x887d('0xb'))};exports[_0x887d('0xc')]=function(_0x16820a,_0x242f79){return function(_0x479f76){try{if(!_[_0x887d('0xd')](this[_0x887d('0xe')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x16820a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x479f76[_0x887d('0xf')]();}var _0x31488d={'ContactId':this[_0x887d('0x10')]['id'],'sentAt':moment()[_0x887d('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x887d('0x12')]===_0x887d('0x13')||this[_0x887d('0x12')]===_0x887d('0x14')){_0x31488d[_0x887d('0x15')]=this[_0x887d('0xe')][_0x887d('0x15')];}var _0x1e331b=this['channel'];if(_0x1e331b===_0x887d('0x16')){_0x31488d[_0x887d('0x17')]=this[_0x887d('0x18')]['id'];}else{_0x31488d[_['upperFirst'](_0x1e331b)+_0x887d('0x19')]=this[_0x887d('0x18')]['id'];}_0x31488d[_['upperFirst'](_0x1e331b)+'InteractionId']=this['interaction']['id'];if(this[_0x887d('0xe')][_0x887d('0x1a')]){var _0x5d4fce=_0x242f79[0x2];if(!_[_0x887d('0x1b')](_0x5d4fce)){_0x31488d[_0x887d('0x1c')]=utils[_0x887d('0x1d')](_0x5d4fce,this);return rpc[_0x1e331b+'Message'][_0x887d('0x1e')](_0x31488d)[_0x887d('0x1f')](function(_0x5e97ec){logger[_0x887d('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x16820a,_0x31488d[_0x887d('0x1c')]);})[_0x887d('0x21')](function(_0x1ab5fc){logger[_0x887d('0x22')](_0x887d('0x23'),_0x16820a,JSON[_0x887d('0x24')](_0x1ab5fc));})[_0x887d('0x25')](function(){logger[_0x887d('0x20')](_0x887d('0x26'),_0x16820a);_0x479f76['stop']();});}else{logger['info'](_0x887d('0x27'),_0x16820a);_0x479f76['stop']();}}else{var _0x2aca37=this;var _0x311aed=apiai(_0x242f79[0x0],{'language':_0x242f79[0x1]||'en'});return _0x311aed[_0x887d('0x28')](this[_0x887d('0x29')][_0x887d('0x1c')],{'sessionId':md5(this[_0x887d('0xe')]['id'])})['then'](function(_0x332bed){_0x2aca37[_0x887d('0x1c')]['dialogflow']=_0x332bed;_0x31488d['body']=_0x332bed[_0x887d('0x2a')][_0x887d('0x2b')][_0x887d('0x2c')];_0x31488d[_0x887d('0x2d')]='dialogflow';_0x31488d[_0x887d('0x2e')]=JSON[_0x887d('0x24')](_0x332bed);return rpc[_0x1e331b+_0x887d('0x2f')]['create'](_0x31488d)[_0x887d('0x1f')](function(_0x1b96eb){logger[_0x887d('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x16820a,_0x31488d['body']);if(_0x332bed[_0x887d('0x2a')][_0x887d('0x30')]['endConversation']){_0x479f76['next']();}else{_0x479f76[_0x887d('0x31')]();}})['catch'](function(_0x26a239){logger[_0x887d('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x16820a,JSON[_0x887d('0x24')](_0x26a239));_0x479f76[_0x887d('0xf')]();});})['catch'](function(_0x5edbe5){logger['error'](_0x887d('0x23'),_0x16820a,_0x5edbe5[_0x887d('0x29')]);_0x479f76[_0x887d('0xf')]();});}}catch(_0x1d2a53){logger[_0x887d('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x16820a,JSON[_0x887d('0x24')](_0x1d2a53));_0x479f76[_0x887d('0x31')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 3e8d468..0eabda5 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fc8=['lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','catch'];(function(_0x2ad759,_0x500de5){var _0x12362b=function(_0x4cfe9c){while(--_0x4cfe9c){_0x2ad759['push'](_0x2ad759['shift']());}};_0x12362b(++_0x500de5);}(_0x0fc8,0xe1));var _0x80fc=function(_0xeb1c15,_0x20d2da){_0xeb1c15=_0xeb1c15-0x0;var _0x3d8692=_0x0fc8[_0xeb1c15];return _0x3d8692;};'use strict';var _=require(_0x80fc('0x0'));var dialogflow=require(_0x80fc('0x1'));var md5=require(_0x80fc('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x80fc('0x3'))(_0x80fc('0x4'));var utils=require(_0x80fc('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x80fc('0x6')),'smsMessage':require(_0x80fc('0x7')),'faxMessage':require(_0x80fc('0x8')),'whatsappMessage':require(_0x80fc('0x9'))};function createMessage(_0x243f48,_0x1534f9,_0x3d2750,_0x419953){return new Promise(function(_0x3cbd6b,_0x4a2270){var _0x2688ec=_[_0x80fc('0xa')](_0x3d2750);_0x2688ec[_0x80fc('0xb')]=_0x419953;return rpc[_0x1534f9+_0x80fc('0xc')]['create'](_0x2688ec)[_0x80fc('0xd')](function(){logger[_0x80fc('0xe')](_0x80fc('0xf'),_0x243f48,_0x2688ec[_0x80fc('0xb')]);_0x3cbd6b();})['catch'](function(_0x387ed3){logger[_0x80fc('0x10')](_0x80fc('0xf'),_0x243f48,JSON['stringify'](_0x387ed3));_0x4a2270(_0x387ed3);});});}exports[_0x80fc('0x11')]=function(_0x82f57c,_0x4ccea2){return function(_0x4ca8b1){try{if(!_[_0x80fc('0x12')](this[_0x80fc('0x13')]['UserId'])){logger[_0x80fc('0xe')](_0x80fc('0xf'),_0x82f57c,_0x80fc('0x14'));return _0x4ca8b1[_0x80fc('0x15')]();}var _0x1c69af={'ContactId':this[_0x80fc('0x16')]['id'],'sentAt':moment()[_0x80fc('0x17')](_0x80fc('0x18')),'direction':_0x80fc('0x19')};if(this['channel']===_0x80fc('0x1a')||this[_0x80fc('0x1b')]===_0x80fc('0x1c')){_0x1c69af[_0x80fc('0x1d')]=this['interaction'][_0x80fc('0x1d')];}var _0x3e634b=this[_0x80fc('0x1b')];if(_0x3e634b===_0x80fc('0x1e')){_0x1c69af[_0x80fc('0x1f')]=this[_0x80fc('0x20')]['id'];}else{_0x1c69af[_['upperFirst'](_0x3e634b)+_0x80fc('0x21')]=this[_0x80fc('0x20')]['id'];}_0x1c69af[_[_0x80fc('0x22')](_0x3e634b)+_0x80fc('0x23')]=this[_0x80fc('0x13')]['id'];if(this[_0x80fc('0x13')][_0x80fc('0x24')]){var _0x229e22=_0x4ccea2[0x4];if(!_[_0x80fc('0x25')](_0x229e22)){_0x1c69af[_0x80fc('0xb')]=utils[_0x80fc('0x26')](_0x229e22,this);return rpc[_0x3e634b+'Message']['create'](_0x1c69af)[_0x80fc('0xd')](function(_0xbcb7dd){logger[_0x80fc('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x82f57c,_0x1c69af[_0x80fc('0xb')]);})['catch'](function(_0x59fe23){logger[_0x80fc('0x10')](_0x80fc('0xf'),_0x82f57c,JSON[_0x80fc('0x27')](_0x59fe23));})[_0x80fc('0x28')](function(){logger[_0x80fc('0xe')](_0x80fc('0x29'),_0x82f57c);_0x4ca8b1['stop']();});}else{logger['info'](_0x80fc('0x2a'),_0x82f57c);_0x4ca8b1[_0x80fc('0x2b')]();}}else{var _0xecfc03=this;var _0x385b7b=_0x4ccea2[0x2]['replace'](/\\n/g,'\x0a');var _0x29a839={'credentials':{'private_key':_0x385b7b,'client_email':_0x4ccea2[0x1]}};var _0x20272a=new dialogflow[(_0x80fc('0x2c'))](_0x29a839);var _0xa89ebf=_0x20272a[_0x80fc('0x2d')](_0x4ccea2[0x0],md5(_0xecfc03['interaction']['id']));var _0x51ae47={'session':_0xa89ebf,'queryInput':{'text':{'text':_0xecfc03[_0x80fc('0x2e')][_0x80fc('0xb')],'languageCode':_0x4ccea2[0x3]||'en'}}};return _0x20272a[_0x80fc('0x2f')](_0x51ae47)[_0x80fc('0xd')](function(_0x3e2ba3){if(_0x3e2ba3&&_0x3e2ba3[_0x80fc('0x30')]){_0xecfc03[_0x80fc('0xb')][_0x80fc('0x31')]=_0x3e2ba3;var _0xaac22c=_0x3e2ba3[0x0];var _0x4bd7ad=_0xaac22c[_0x80fc('0x32')][_0x80fc('0x33')]&&_0xaac22c[_0x80fc('0x32')][_0x80fc('0x33')]['fields']?_0xaac22c[_0x80fc('0x32')]['diagnosticInfo'][_0x80fc('0x34')][_0x80fc('0x35')][_0x80fc('0x36')]:![];_0xecfc03['body'][_0x80fc('0x37')]=_0xaac22c['queryResult'][_0x80fc('0x38')];_0xecfc03[_0x80fc('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0xaac22c[_0x80fc('0x32')][_0x80fc('0x39')];_0xecfc03[_0x80fc('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0xaac22c[_0x80fc('0x32')]['diagnosticInfo']&&_0xaac22c[_0x80fc('0x32')][_0x80fc('0x33')][_0x80fc('0x34')]?_0xaac22c['queryResult'][_0x80fc('0x33')]['fields']['end_conversation']['boolValue']:![];_0xecfc03[_0x80fc('0xb')][_0x80fc('0x3a')]=_0xaac22c[_0x80fc('0x32')][_0x80fc('0x3b')]['name'];_0xecfc03[_0x80fc('0xb')][_0x80fc('0x3c')]=_0xaac22c['queryResult'][_0x80fc('0x3b')][_0x80fc('0x3d')];_0xecfc03[_0x80fc('0xb')][_0x80fc('0x3e')]=_0xaac22c[_0x80fc('0x32')]['intent'][_0x80fc('0x3f')];_0xecfc03['body'][_0x80fc('0x40')]=_0xaac22c[_0x80fc('0x32')][_0x80fc('0x41')];_0xecfc03[_0x80fc('0xb')][_0x80fc('0x42')]=_0xaac22c[_0x80fc('0x32')][_0x80fc('0x43')];_0xecfc03['body'][_0x80fc('0x44')]=_0xaac22c['queryResult'][_0x80fc('0x45')];_0x1c69af[_0x80fc('0x46')]=_0x80fc('0x31');_0x1c69af[_0x80fc('0x47')]=JSON['stringify'](_0x3e2ba3);var _0x47c8d0=[];for(var _0x15ad4e=0x0;_0x15ad4e<_0x3e2ba3[_0x80fc('0x30')];_0x15ad4e++){var _0x420f98=_0x3e2ba3[_0x15ad4e];if(_0x420f98&&_0x420f98[_0x80fc('0x32')]&&_0x420f98[_0x80fc('0x32')]['fulfillmentText']){_0x47c8d0['push'](createMessage(_0x82f57c,_0x3e634b,_0x1c69af,_0x420f98[_0x80fc('0x32')][_0x80fc('0x48')]));}}return Promise[_0x80fc('0x49')](_0x47c8d0)[_0x80fc('0xd')](function(){if(_0x4bd7ad){_0x4ca8b1['next']();}else{_0x4ca8b1[_0x80fc('0x2b')]();}})['catch'](function(_0x23c085){logger[_0x80fc('0x10')](_0x80fc('0xf'),_0x82f57c,JSON[_0x80fc('0x27')](_0x23c085));_0x4ca8b1[_0x80fc('0x15')]();});}})[_0x80fc('0x4a')](function(_0x3c4d3a){logger[_0x80fc('0x10')](_0x80fc('0xf'),_0x82f57c,_0x3c4d3a['message']);_0x4ca8b1[_0x80fc('0x15')]();});}}catch(_0x5f7521){logger[_0x80fc('0x10')](_0x80fc('0xf'),_0x82f57c,JSON[_0x80fc('0x27')](_0x5f7521));_0x4ca8b1[_0x80fc('0x2b')]();}};}; \ No newline at end of file +var _0x8ccc=['name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','info','catch','error','stringify','consequence','interaction','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','created','getMustacheRender','then','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent'];(function(_0x24701a,_0x1eeeb9){var _0x1e9a84=function(_0x4d9b61){while(--_0x4d9b61){_0x24701a['push'](_0x24701a['shift']());}};_0x1e9a84(++_0x1eeeb9);}(_0x8ccc,0x16f));var _0xc8cc=function(_0xbd853b,_0x56b979){_0xbd853b=_0xbd853b-0x0;var _0x18f27f=_0x8ccc[_0xbd853b];return _0x18f27f;};'use strict';var _=require(_0xc8cc('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0xc8cc('0x1'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0xc8cc('0x2'));var utils=require('./utils');var rpc={'chatMessage':require(_0xc8cc('0x3')),'openchannelMessage':require(_0xc8cc('0x4')),'mailMessage':require(_0xc8cc('0x5')),'smsMessage':require(_0xc8cc('0x6')),'faxMessage':require(_0xc8cc('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x51ca6c,_0x1a474d,_0x3e26d4,_0x46a646){return new Promise(function(_0x36cc28,_0xd39f7d){var _0xab548c=_[_0xc8cc('0x8')](_0x3e26d4);_0xab548c[_0xc8cc('0x9')]=_0x46a646;return rpc[_0x1a474d+_0xc8cc('0xa')][_0xc8cc('0xb')](_0xab548c)['then'](function(){logger[_0xc8cc('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x51ca6c,_0xab548c[_0xc8cc('0x9')]);_0x36cc28();})[_0xc8cc('0xd')](function(_0xb64dcf){logger[_0xc8cc('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x51ca6c,JSON[_0xc8cc('0xf')](_0xb64dcf));_0xd39f7d(_0xb64dcf);});});}exports[_0xc8cc('0x10')]=function(_0x421bc5,_0x3c28f3){return function(_0x20dfa7){try{if(!_['isNil'](this[_0xc8cc('0x11')][_0xc8cc('0x12')])){logger[_0xc8cc('0xc')](_0xc8cc('0x13'),_0x421bc5,_0xc8cc('0x14'));return _0x20dfa7[_0xc8cc('0x15')]();}var _0x205496={'ContactId':this[_0xc8cc('0x16')]['id'],'sentAt':moment()[_0xc8cc('0x17')](_0xc8cc('0x18')),'direction':_0xc8cc('0x19')};if(this[_0xc8cc('0x1a')]===_0xc8cc('0x1b')||this[_0xc8cc('0x1a')]===_0xc8cc('0x1c')){_0x205496[_0xc8cc('0x1d')]=this[_0xc8cc('0x11')][_0xc8cc('0x1d')];}var _0x10dec8=this[_0xc8cc('0x1a')];if(_0x10dec8===_0xc8cc('0x1e')){_0x205496['ChatWebsiteId']=this[_0xc8cc('0x1f')]['id'];}else{_0x205496[_[_0xc8cc('0x20')](_0x10dec8)+_0xc8cc('0x21')]=this[_0xc8cc('0x1f')]['id'];}_0x205496[_[_0xc8cc('0x20')](_0x10dec8)+'InteractionId']=this[_0xc8cc('0x11')]['id'];if(this['interaction'][_0xc8cc('0x22')]){var _0x57cf09=_0x3c28f3[0x4];if(!_['isEmpty'](_0x57cf09)){_0x205496[_0xc8cc('0x9')]=utils[_0xc8cc('0x23')](_0x57cf09,this);return rpc[_0x10dec8+_0xc8cc('0xa')][_0xc8cc('0xb')](_0x205496)[_0xc8cc('0x24')](function(_0x16ca33){logger[_0xc8cc('0xc')](_0xc8cc('0x13'),_0x421bc5,_0x205496[_0xc8cc('0x9')]);})[_0xc8cc('0xd')](function(_0x473fd7){logger['error'](_0xc8cc('0x13'),_0x421bc5,JSON['stringify'](_0x473fd7));})['finally'](function(){logger[_0xc8cc('0xc')](_0xc8cc('0x25'),_0x421bc5);_0x20dfa7[_0xc8cc('0x26')]();});}else{logger[_0xc8cc('0xc')](_0xc8cc('0x27'),_0x421bc5);_0x20dfa7['stop']();}}else{var _0xd11846=this;var _0x394c28=_0x3c28f3[0x2][_0xc8cc('0x28')](/\\n/g,'\x0a');var _0x5856c8={'credentials':{'private_key':_0x394c28,'client_email':_0x3c28f3[0x1]}};var _0x166c7d=new dialogflow[(_0xc8cc('0x29'))](_0x5856c8);var _0x58c2ef=_0x166c7d[_0xc8cc('0x2a')](_0x3c28f3[0x0],md5(_0xd11846[_0xc8cc('0x11')]['id']));var _0x9c88e3={'session':_0x58c2ef,'queryInput':{'text':{'text':_0xd11846[_0xc8cc('0x2b')]['body'],'languageCode':_0x3c28f3[0x3]||'en'}}};return _0x166c7d[_0xc8cc('0x2c')](_0x9c88e3)[_0xc8cc('0x24')](function(_0x995cc1){if(_0x995cc1&&_0x995cc1[_0xc8cc('0x2d')]){_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x2e')]=_0x995cc1;var _0x57e722=_0x995cc1[0x0];var _0x20ddbb=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x30')]&&_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x30')][_0xc8cc('0x31')]?_0x57e722['queryResult']['diagnosticInfo'][_0xc8cc('0x31')][_0xc8cc('0x32')][_0xc8cc('0x33')]:![];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x34')]=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x35')];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x36')]=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x37')];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x38')]=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x30')]&&_0x57e722['queryResult']['diagnosticInfo'][_0xc8cc('0x31')]?_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x30')][_0xc8cc('0x31')][_0xc8cc('0x32')]['boolValue']:![];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x39')]=_0x57e722['queryResult'][_0xc8cc('0x3a')][_0xc8cc('0x3b')];_0xd11846['body'][_0xc8cc('0x3c')]=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x3a')][_0xc8cc('0x3d')];_0xd11846[_0xc8cc('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x57e722['queryResult'][_0xc8cc('0x3a')]['isFallback'];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x3e')]=_0x57e722[_0xc8cc('0x2f')]['languageCode'];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x3f')]=_0x57e722[_0xc8cc('0x2f')][_0xc8cc('0x40')];_0xd11846[_0xc8cc('0x9')][_0xc8cc('0x41')]=_0x57e722['queryResult'][_0xc8cc('0x42')];_0x205496[_0xc8cc('0x43')]=_0xc8cc('0x2e');_0x205496[_0xc8cc('0x44')]=JSON['stringify'](_0x995cc1);var _0x3dfcdf=[];for(var _0x465a06=0x0;_0x465a06<_0x995cc1['length'];_0x465a06++){var _0x3ba8ed=_0x995cc1[_0x465a06];if(_0x3ba8ed&&_0x3ba8ed[_0xc8cc('0x2f')]&&_0x3ba8ed[_0xc8cc('0x2f')][_0xc8cc('0x45')]){_0x3dfcdf[_0xc8cc('0x46')](createMessage(_0x421bc5,_0x10dec8,_0x205496,_0x3ba8ed['queryResult']['fulfillmentText']));}}return Promise['all'](_0x3dfcdf)['then'](function(){if(_0x20ddbb){_0x20dfa7[_0xc8cc('0x15')]();}else{_0x20dfa7[_0xc8cc('0x26')]();}})['catch'](function(_0x3340d8){logger['error'](_0xc8cc('0x13'),_0x421bc5,JSON[_0xc8cc('0xf')](_0x3340d8));_0x20dfa7[_0xc8cc('0x15')]();});}})[_0xc8cc('0xd')](function(_0x492461){logger[_0xc8cc('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x421bc5,_0x492461[_0xc8cc('0x2b')]);_0x20dfa7[_0xc8cc('0x15')]();});}}catch(_0x13da79){logger['error'](_0xc8cc('0x13'),_0x421bc5,JSON['stringify'](_0x13da79));_0x20dfa7[_0xc8cc('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 7905861..cd9d394 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7f3=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','map','message','stop','priorityTrue','priorityFalse','info','next'];(function(_0xd7affc,_0x510735){var _0x212bbf=function(_0x5d75f4){while(--_0x5d75f4){_0xd7affc['push'](_0xd7affc['shift']());}};_0x212bbf(++_0x510735);}(_0xd7f3,0xa5));var _0x3d7f=function(_0x562f0a,_0x1593f5){_0x562f0a=_0x562f0a-0x0;var _0x1b2cba=_0xd7f3[_0x562f0a];return _0x1b2cba;};'use strict';var schema=require(_0x3d7f('0x0'));var _=require(_0x3d7f('0x1'));var htmlToText=require(_0x3d7f('0x2'));var utils=require(_0x3d7f('0x3'));var logger=require(_0x3d7f('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x3d7f('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x3d7f('0x5'),'message':_0x3d7f('0x6')}});exports[_0x3d7f('0x7')]=function(_0x199d1d,_0x1ad902){return function(_0x4ecf53){try{var _0x3dcd21={'condition':htmlToText['fromString'](utils[_0x3d7f('0x8')](_0x1ad902[0x0],this),{'wordwrap':![]})[_0x3d7f('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ad902[0x1],'priorityFalse':_0x1ad902[0x2]};var _0x11b80f=gotoif[_0x3d7f('0x0')](_0x3dcd21,{'typecast':!![]});if(_0x11b80f[_0x3d7f('0xa')]){logger[_0x3d7f('0xb')]('[%s][GOTOIF]\x20%s',_0x199d1d,_[_0x3d7f('0xc')](_0x11b80f,_0x3d7f('0xd'))['join'](',\x20'));_0x4ecf53[_0x3d7f('0xe')]();}else{try{var _0x227829=eval('('+_0x3dcd21['condition']+')');var _0x5eaaad=_0x227829?_0x3dcd21[_0x3d7f('0xf')]:_0x3dcd21[_0x3d7f('0x10')];logger[_0x3d7f('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x199d1d,_0x3dcd21['condition'],_0x227829,_0x5eaaad||_0x3d7f('0x12'));if(_0x5eaaad){var _0x20bf98=_['findIndex'](_0x4ecf53['rules'](),{'p':_0x5eaaad});if(_0x20bf98>=0x0){logger['info'](_0x3d7f('0x13'),_0x199d1d,_0x5eaaad||'next',_0x20bf98);_0x4ecf53[_0x3d7f('0x12')](_0x20bf98);}else{logger[_0x3d7f('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x199d1d,_0x5eaaad||_0x3d7f('0x12'));_0x4ecf53[_0x3d7f('0xe')]();}}else{_0x4ecf53[_0x3d7f('0x12')]();}}catch(_0x380732){logger[_0x3d7f('0xb')](_0x3d7f('0x14'),_0x199d1d,_0x380732[_0x3d7f('0xd')]);_0x4ecf53[_0x3d7f('0xe')]();}}}catch(_0x23aa33){logger['error'](_0x3d7f('0x15'),_0x199d1d,JSON[_0x3d7f('0x16')](_0x23aa33));_0x4ecf53['stop']();}};}; \ No newline at end of file +var _0xba4e=['error','validate','lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x3d7c2e,_0x167ddc){var _0x30b781=function(_0x2b2a68){while(--_0x2b2a68){_0x3d7c2e['push'](_0x3d7c2e['shift']());}};_0x30b781(++_0x167ddc);}(_0xba4e,0x139));var _0xeba4=function(_0x4b2a8f,_0x5277ac){_0x4b2a8f=_0x4b2a8f-0x0;var _0x311556=_0xba4e[_0x4b2a8f];return _0x311556;};'use strict';var schema=require(_0xeba4('0x0'));var _=require(_0xeba4('0x1'));var htmlToText=require(_0xeba4('0x2'));var utils=require('./utils');var logger=require(_0xeba4('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xeba4('0x4'),'required':!![],'message':_0xeba4('0x5')},'priorityTrue':{'type':_0xeba4('0x6'),'message':_0xeba4('0x7')},'priorityFalse':{'type':_0xeba4('0x6'),'message':_0xeba4('0x8')}});exports[_0xeba4('0x9')]=function(_0x833414,_0x267fd2){return function(_0x28081c){try{var _0x21a0b5={'condition':htmlToText[_0xeba4('0xa')](utils['getMustacheRender'](_0x267fd2[0x0],this),{'wordwrap':![]})[_0xeba4('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x267fd2[0x1],'priorityFalse':_0x267fd2[0x2]};var _0x558b60=gotoif[_0xeba4('0x0')](_0x21a0b5,{'typecast':!![]});if(_0x558b60['length']){logger['error'](_0xeba4('0xc'),_0x833414,_['map'](_0x558b60,_0xeba4('0xd'))['join'](',\x20'));_0x28081c[_0xeba4('0xe')]();}else{try{var _0x4c278e=eval('('+_0x21a0b5[_0xeba4('0xf')]+')');var _0xb5af7d=_0x4c278e?_0x21a0b5[_0xeba4('0x10')]:_0x21a0b5[_0xeba4('0x11')];logger[_0xeba4('0x12')](_0xeba4('0x13'),_0x833414,_0x21a0b5['condition'],_0x4c278e,_0xb5af7d||_0xeba4('0x14'));if(_0xb5af7d){var _0x53361b=_[_0xeba4('0x15')](_0x28081c[_0xeba4('0x16')](),{'p':_0xb5af7d});if(_0x53361b>=0x0){logger[_0xeba4('0x12')](_0xeba4('0x17'),_0x833414,_0xb5af7d||_0xeba4('0x14'),_0x53361b);_0x28081c['next'](_0x53361b);}else{logger[_0xeba4('0x12')](_0xeba4('0x18'),_0x833414,_0xb5af7d||'next');_0x28081c[_0xeba4('0xe')]();}}else{_0x28081c[_0xeba4('0x14')]();}}catch(_0x28190a){logger[_0xeba4('0x19')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x833414,_0x28190a[_0xeba4('0xd')]);_0x28081c['stop']();}}}catch(_0x27d888){logger[_0xeba4('0x19')](_0xeba4('0xc'),_0x833414,JSON['stringify'](_0x27d888));_0x28081c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e1af0b4..ca997a8 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 _0x5e91=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','error','validate','lodash','../../../../config/logger','routing','number'];(function(_0xa71f02,_0x5c9690){var _0x19798a=function(_0x8b592c){while(--_0x8b592c){_0xa71f02['push'](_0xa71f02['shift']());}};_0x19798a(++_0x5c9690);}(_0x5e91,0x187));var _0x15e9=function(_0xee4b51,_0x82653a){_0xee4b51=_0xee4b51-0x0;var _0x5c4317=_0x5e91[_0xee4b51];return _0x5c4317;};'use strict';var schema=require(_0x15e9('0x0'));var _=require(_0x15e9('0x1'));var logger=require(_0x15e9('0x2'))(_0x15e9('0x3'));var gotop=schema({'priority':{'type':_0x15e9('0x4'),'required':!![],'message':_0x15e9('0x5')}});exports[_0x15e9('0x6')]=function(_0x3a2db7,_0x275a03){return function(_0x449c79){try{var _0x2062bc={'priority':_0x275a03[0x0]};var _0x57ade0=gotop[_0x15e9('0x0')](_0x2062bc,{'typecast':!![]});if(_0x57ade0[_0x15e9('0x7')]){logger['error'](_0x15e9('0x8'),_0x3a2db7,_[_0x15e9('0x9')](_0x57ade0,_0x15e9('0xa'))['join'](',\x20'));_0x449c79[_0x15e9('0xb')]();}else{logger[_0x15e9('0xc')](_0x15e9('0xd'),_0x3a2db7,_0x2062bc[_0x15e9('0xe')]);if(_0x2062bc[_0x15e9('0xe')]){var _0x3f0b44=_[_0x15e9('0xf')](_0x449c79['rules'](),{'p':_0x2062bc[_0x15e9('0xe')]});if(_0x3f0b44>=0x0){logger[_0x15e9('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3a2db7,_0x2062bc[_0x15e9('0xe')]||_0x15e9('0x10'),_0x3f0b44);_0x449c79[_0x15e9('0x10')](_0x3f0b44);}else{logger[_0x15e9('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3a2db7,_0x2062bc[_0x15e9('0xe')]||_0x15e9('0x10'));_0x449c79['stop']();}}else{_0x449c79[_0x15e9('0x10')]();}}}catch(_0x4a23be){logger[_0x15e9('0x11')](_0x15e9('0x8'),_0x3a2db7,JSON['stringify'](_0x4a23be));_0x449c79[_0x15e9('0xb')]();}};}; \ No newline at end of file +var _0xab01=['[%s][GOTOP]\x20%s','stringify','validate','lodash','number','length','error','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop'];(function(_0x4a7a75,_0x380fc3){var _0x28086c=function(_0x1a57c3){while(--_0x1a57c3){_0x4a7a75['push'](_0x4a7a75['shift']());}};_0x28086c(++_0x380fc3);}(_0xab01,0x192));var _0x1ab0=function(_0x5a3018,_0xe6f19a){_0x5a3018=_0x5a3018-0x0;var _0x53399d=_0xab01[_0x5a3018];return _0x53399d;};'use strict';var schema=require(_0x1ab0('0x0'));var _=require(_0x1ab0('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x1ab0('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x19da22,_0x1e8c8c){return function(_0xba7eae){try{var _0xf9c2d={'priority':_0x1e8c8c[0x0]};var _0x573e6e=gotop[_0x1ab0('0x0')](_0xf9c2d,{'typecast':!![]});if(_0x573e6e[_0x1ab0('0x3')]){logger[_0x1ab0('0x4')]('[%s][GOTOP]\x20%s',_0x19da22,_['map'](_0x573e6e,_0x1ab0('0x5'))['join'](',\x20'));_0xba7eae['stop']();}else{logger[_0x1ab0('0x6')](_0x1ab0('0x7'),_0x19da22,_0xf9c2d[_0x1ab0('0x8')]);if(_0xf9c2d[_0x1ab0('0x8')]){var _0x2a6955=_[_0x1ab0('0x9')](_0xba7eae[_0x1ab0('0xa')](),{'p':_0xf9c2d[_0x1ab0('0x8')]});if(_0x2a6955>=0x0){logger['info'](_0x1ab0('0xb'),_0x19da22,_0xf9c2d['priority']||_0x1ab0('0xc'),_0x2a6955);_0xba7eae[_0x1ab0('0xc')](_0x2a6955);}else{logger[_0x1ab0('0x6')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x19da22,_0xf9c2d[_0x1ab0('0x8')]||'next');_0xba7eae[_0x1ab0('0xd')]();}}else{_0xba7eae[_0x1ab0('0xc')]();}}}catch(_0x45ede6){logger['error'](_0x1ab0('0xe'),_0x19da22,JSON[_0x1ab0('0xf')](_0x45ede6));_0xba7eae[_0x1ab0('0xd')]();}};}; \ 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 abbc9f1..7a64da0 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 _0x95c7=['info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then'];(function(_0x2c61f1,_0x32bcf0){var _0x24c91c=function(_0x29ab38){while(--_0x29ab38){_0x2c61f1['push'](_0x2c61f1['shift']());}};_0x24c91c(++_0x32bcf0);}(_0x95c7,0x1a7));var _0x795c=function(_0x19b7ee,_0x22d9a1){_0x19b7ee=_0x19b7ee-0x0;var _0x2f14cc=_0x95c7[_0x19b7ee];return _0x2f14cc;};'use strict';var _=require(_0x795c('0x0'));var utils=require(_0x795c('0x1'));var logger=require(_0x795c('0x2'))(_0x795c('0x3'));var rpc={'chatMessage':require(_0x795c('0x4')),'openchannelMessage':require(_0x795c('0x5')),'mailMessage':require(_0x795c('0x6')),'smsMessage':require(_0x795c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x29a610,_0x539589){return function(_0x1cdcda){try{var _0x1de00c={'body':utils['getMustacheRender'](_0x539589[0x0],this),'ContactId':this[_0x795c('0x8')]['id']};if(this[_0x795c('0x9')]===_0x795c('0xa')){_0x1de00c[_0x795c('0xb')]=this[_0x795c('0xc')]['id'];}else{_0x1de00c[_[_0x795c('0xd')](this[_0x795c('0x9')])+_0x795c('0xe')]=this[_0x795c('0xc')]['id'];}_0x1de00c[_[_0x795c('0xd')](this[_0x795c('0x9')])+_0x795c('0xf')]=this['interaction']['id'];if(rpc[this[_0x795c('0x9')]+'Message']){return rpc[this[_0x795c('0x9')]+_0x795c('0x10')][_0x795c('0x11')](_0x1de00c)[_0x795c('0x12')](function(_0x1db4fe){logger[_0x795c('0x13')](_0x795c('0x14'),_0x29a610,_0x1de00c[_0x795c('0x15')]);_0x1cdcda['next']();})[_0x795c('0x16')](function(_0x7e3962){logger[_0x795c('0x17')](_0x795c('0x14'),_0x29a610,JSON[_0x795c('0x18')](_0x7e3962));_0x1cdcda['stop']();});}}catch(_0x5b88bb){logger['error'](_0x795c('0x14'),_0x29a610,JSON[_0x795c('0x18')](_0x5b88bb));_0x1cdcda[_0x795c('0x19')]();}};}; \ No newline at end of file +var _0xd1f1=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','AccountId','account','upperFirst','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger'];(function(_0x2391ab,_0x10b86d){var _0x598a88=function(_0x54271a){while(--_0x54271a){_0x2391ab['push'](_0x2391ab['shift']());}};_0x598a88(++_0x10b86d);}(_0xd1f1,0x84));var _0x1d1f=function(_0x4f14bd,_0x28b9db){_0x4f14bd=_0x4f14bd-0x0;var _0x515b8b=_0xd1f1[_0x4f14bd];return _0x515b8b;};'use strict';var _=require(_0x1d1f('0x0'));var utils=require(_0x1d1f('0x1'));var logger=require(_0x1d1f('0x2'))(_0x1d1f('0x3'));var rpc={'chatMessage':require(_0x1d1f('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1d1f('0x5')),'smsMessage':require(_0x1d1f('0x6')),'faxMessage':require(_0x1d1f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1d1f('0x8')]=function(_0x13e896,_0x54e8a0){return function(_0x2337fc){try{var _0x5c285a={'body':utils[_0x1d1f('0x9')](_0x54e8a0[0x0],this),'ContactId':this[_0x1d1f('0xa')]['id']};if(this[_0x1d1f('0xb')]===_0x1d1f('0xc')){_0x5c285a['ChatWebsiteId']=this['account']['id'];}else{_0x5c285a[_['upperFirst'](this[_0x1d1f('0xb')])+_0x1d1f('0xd')]=this[_0x1d1f('0xe')]['id'];}_0x5c285a[_[_0x1d1f('0xf')](this['channel'])+_0x1d1f('0x10')]=this[_0x1d1f('0x11')]['id'];if(rpc[this[_0x1d1f('0xb')]+_0x1d1f('0x12')]){return rpc[this[_0x1d1f('0xb')]+_0x1d1f('0x12')]['create'](_0x5c285a)['then'](function(_0x48e2c0){logger[_0x1d1f('0x13')](_0x1d1f('0x14'),_0x13e896,_0x5c285a[_0x1d1f('0x15')]);_0x2337fc[_0x1d1f('0x16')]();})[_0x1d1f('0x17')](function(_0x465f20){logger[_0x1d1f('0x18')](_0x1d1f('0x14'),_0x13e896,JSON[_0x1d1f('0x19')](_0x465f20));_0x2337fc[_0x1d1f('0x1a')]();});}}catch(_0x2ec931){logger[_0x1d1f('0x18')](_0x1d1f('0x14'),_0x13e896,JSON['stringify'](_0x2ec931));_0x2337fc[_0x1d1f('0x1a')]();}};}; \ 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 cfadc63..9e5abcd 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 _0x02b4=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x343a58,_0x7dc868){var _0x3992e4=function(_0x1f2d63){while(--_0x1f2d63){_0x343a58['push'](_0x343a58['shift']());}};_0x3992e4(++_0x7dc868);}(_0x02b4,0x110));var _0x402b=function(_0x8b26f3,_0x222928){_0x8b26f3=_0x8b26f3-0x0;var _0x453699=_0x02b4[_0x8b26f3];return _0x453699;};'use strict';var utils=require(_0x402b('0x0'));var logger=require(_0x402b('0x1'))(_0x402b('0x2'));exports[_0x402b('0x3')]=function(_0x25db18,_0x51666f){return function(_0x193b26){try{logger[_0x402b('0x4')](_0x402b('0x5'),_0x25db18,utils[_0x402b('0x6')](_0x51666f[0x0],this));_0x193b26[_0x402b('0x7')]();}catch(_0x617073){logger[_0x402b('0x8')](_0x402b('0x5'),_0x25db18,JSON[_0x402b('0x9')](_0x617073));_0x193b26[_0x402b('0xa')]();}};}; \ No newline at end of file +var _0xe293=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils'];(function(_0x4f613c,_0x425015){var _0x50cffd=function(_0x5b86f1){while(--_0x5b86f1){_0x4f613c['push'](_0x4f613c['shift']());}};_0x50cffd(++_0x425015);}(_0xe293,0x95));var _0x3e29=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xe293[_0xc0d9bc];return _0x32ff73;};'use strict';var utils=require(_0x3e29('0x0'));var logger=require(_0x3e29('0x1'))(_0x3e29('0x2'));exports[_0x3e29('0x3')]=function(_0x477dbf,_0x239000){return function(_0x2af019){try{logger[_0x3e29('0x4')](_0x3e29('0x5'),_0x477dbf,utils[_0x3e29('0x6')](_0x239000[0x0],this));_0x2af019[_0x3e29('0x7')]();}catch(_0x5d552b){logger[_0x3e29('0x8')](_0x3e29('0x5'),_0x477dbf,JSON[_0x3e29('0x9')](_0x5d552b));_0x2af019['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 26aa044..dfa1bbf 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 _0xbb22=['Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','strategy','rrmemory','beepall','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','queue_id','account','queue','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','info','[%s][END:QUEUE][NAME:%s]','body','update\x20queue\x20report','[%s][QUEUE]\x20%s','map','join','find'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xbb22,0x1ef));var _0x2bb2=function(_0x2e6611,_0x144c74){_0x2e6611=_0x2e6611-0x0;var _0x1737ab=_0xbb22[_0x2e6611];return _0x1737ab;};'use strict';var schema=require('validate');var _=require(_0x2bb2('0x0'));var util=require(_0x2bb2('0x1'));var seqqueue=require(_0x2bb2('0x2'));var moment=require(_0x2bb2('0x3'));var Redis=require(_0x2bb2('0x4'));var config=require(_0x2bb2('0x5'));var logger=require(_0x2bb2('0x6'))(_0x2bb2('0x7'));var strategy=require(_0x2bb2('0x8'));config['redis']=_['defaults'](config[_0x2bb2('0x9')],{'host':_0x2bb2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x2bb2('0xb'),_0x2bb2('0xc'),_0x2bb2('0xd'),'from','joinAt'];function emit(_0x24ee5b,_0x370abe,_0x5e42f4){io['to'](_0x24ee5b)['emit'](_0x370abe,_0x5e42f4);}function emitChannelQueueInteraction(_0x670e6f,_0x5d8128,_0x291172,_0x418cbb,_0x5e44b3,_0x2e80b6,_0x371052,_0x17bd1b){var _0x3ed329=_[_0x2bb2('0xe')](_0x291172);_0x3ed329[_0x2bb2('0xb')]=_0x17bd1b;_0x3ed329[_0x2bb2('0xd')]=_0x5d8128;_0x3ed329[_0x2bb2('0xc')]=_0x418cbb;_0x3ed329['id']=_0x5e44b3;if(_0x2e80b6){attributes[_0x2bb2('0xf')](_[_0x2bb2('0x10')](_0x670e6f)+_0x2bb2('0x11'));_0x371052[util[_0x2bb2('0x12')](_0x2bb2('0x13'),_0x670e6f)][_0x5e44b3]=_[_0x2bb2('0x14')](_0x3ed329,attributes);}else{delete _0x371052[util[_0x2bb2('0x12')](_0x2bb2('0x13'),_0x670e6f)][_0x5e44b3];}emit(util['format'](_0x2bb2('0x15'),_0x670e6f,_0x5d8128),util[_0x2bb2('0x12')](_0x2bb2('0x16'),_0x670e6f,_0x2e80b6?_0x2bb2('0x17'):_0x2bb2('0x18')),_[_0x2bb2('0x14')](_0x3ed329,attributes));}var rpc={'openchannelQueueReport':require(_0x2bb2('0x19')),'mailQueueReport':require(_0x2bb2('0x1a')),'chatQueueReport':require(_0x2bb2('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x2bb2('0x1c')),'whatsappQueueReport':require(_0x2bb2('0x1d'))};var queue=schema({'name':{'type':_0x2bb2('0x1e'),'required':!![],'message':_0x2bb2('0x1f')},'timeout':{'type':_0x2bb2('0x20'),'message':_0x2bb2('0x21')}});function startRouting(_0x47af42,_0x147891,_0x30e363,_0x5239b7){if(_0x47af42&&_0x147891&&_0x30e363){_0x147891[_0x2bb2('0x22')]+=0x1;var _0x1857cc={'uniqueid':_0x47af42,'from':_0x30e363['body']?_0x30e363['body']['from']:'','joinAt':moment()[_0x2bb2('0x12')](_0x2bb2('0x23')),'ContactId':_0x30e363[_0x2bb2('0x24')]?_0x30e363[_0x2bb2('0x24')]['id']:null,'ListId':_0x30e363['list']?_0x30e363[_0x2bb2('0x25')]['id']:null};_0x1857cc[_[_0x2bb2('0x26')](_0x30e363[_0x2bb2('0x27')])+_0x2bb2('0x28')]=_0x147891['id']||null;_0x1857cc[_[_0x2bb2('0x26')](_0x30e363[_0x2bb2('0x27')])+_0x2bb2('0x11')]=_0x30e363[_0x2bb2('0x29')]?_0x30e363['interaction']['id']:null;_0x1857cc[_[_0x2bb2('0x26')](_0x30e363[_0x2bb2('0x27')])+'MessageId']=_0x30e363[_0x2bb2('0x2a')]?_0x30e363[_0x2bb2('0x2a')]['id']:null;_0x1857cc[_[_0x2bb2('0x26')](_0x30e363[_0x2bb2('0x27')])+(_0x30e363[_0x2bb2('0x27')]!==_0x2bb2('0x2b')?_0x2bb2('0x2c'):_0x2bb2('0x2d'))]=_0x30e363[_0x2bb2('0xc')]?_0x30e363['account']['id']:null;logger['info'](util['format'](_0x2bb2('0x2e'),_0x47af42,_0x147891['name']));emitChannelQueueInteraction(_0x30e363[_0x2bb2('0x27')],_0x147891[_0x2bb2('0x2f')],_0x1857cc,_0x30e363[_0x2bb2('0xc')][_0x2bb2('0x2f')],_0x30e363[_0x2bb2('0x2a')]['id'],!![],_0x5239b7,_0x147891['id']);if(rpc[_0x30e363[_0x2bb2('0x27')]+_0x2bb2('0x30')]){return rpc[_0x30e363[_0x2bb2('0x27')]+_0x2bb2('0x30')][_0x2bb2('0x31')](_0x1857cc)[_0x2bb2('0x32')](function(_0x364e37){logger[_0x2bb2('0x33')](_0x2bb2('0x34'));});}}}function stopRouting(_0xb5d65e,_0x504438,_0xe5eed2,_0x41a27b){if(_0xb5d65e&&_0x504438){_0x504438[_0x2bb2('0x22')]-=0x1;var _0x5910b7={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x2bb2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2bb2('0x35')};logger['info'](util['format'](_0x2bb2('0x36'),_0xb5d65e,_0x504438[_0x2bb2('0x2f')]));emitChannelQueueInteraction(_0xe5eed2[_0x2bb2('0x27')],_0x504438[_0x2bb2('0x2f')],_0xe5eed2['body'],_0xe5eed2[_0x2bb2('0xc')][_0x2bb2('0x2f')],_0xe5eed2[_0x2bb2('0x2a')]['id'],![],_0x41a27b,_0x504438['id']);if(rpc[_0xe5eed2[_0x2bb2('0x27')]+'QueueReport']){return rpc[_0xe5eed2[_0x2bb2('0x27')]+_0x2bb2('0x30')][_0x2bb2('0x37')](_0xb5d65e,_0x5910b7)[_0x2bb2('0x32')](function(_0x27334d){logger[_0x2bb2('0x33')]('update\x20queue\x20report');});}}}function endRouting(_0x458b4f,_0xaf7e09,_0x518099,_0x4d4724){if(_0x458b4f&&_0xaf7e09){_0xaf7e09[_0x2bb2('0x22')]-=0x1;var _0x564bae={'leaveAt':moment()['format'](_0x2bb2('0x23')),'exitAt':moment()['format'](_0x2bb2('0x23')),'reason':_0x2bb2('0x38')};logger[_0x2bb2('0x39')](util[_0x2bb2('0x12')](_0x2bb2('0x3a'),_0x458b4f,_0xaf7e09[_0x2bb2('0x2f')]));emitChannelQueueInteraction(_0x518099[_0x2bb2('0x27')],_0xaf7e09[_0x2bb2('0x2f')],_0x518099[_0x2bb2('0x3b')],_0x518099[_0x2bb2('0xc')][_0x2bb2('0x2f')],_0x518099['message']['id'],![],_0x4d4724);if(rpc[_0x518099[_0x2bb2('0x27')]+_0x2bb2('0x30')]){return rpc[_0x518099[_0x2bb2('0x27')]+'QueueReport'][_0x2bb2('0x37')](_0x458b4f,_0x564bae)[_0x2bb2('0x32')](function(_0xd6911c){logger['error'](_0x2bb2('0x3c'));});}}}function handleFindQueue(_0x41e994){return function(_0x162102){return _0x162102['name']['toLowerCase']()===_0x41e994['toLowerCase']();};}exports['consequence']=function(_0x1710a1,_0x2e3816,_0x48fbd6,_0x3dafcf){return function(_0x3c77b4){try{var _0x427efb={'name':_0x2e3816[0x0],'timeout':_0x2e3816[0x1]};var _0x1562ea=queue['validate'](_0x427efb,{'typecast':!![]});if(_0x1562ea['length']){logger[_0x2bb2('0x33')](_0x2bb2('0x3d'),_0x1710a1,_[_0x2bb2('0x3e')](_0x1562ea,_0x2bb2('0x2a'))[_0x2bb2('0x3f')](',\x20'));_0x3c77b4['stop']();}else{var _0x1c3f82=_[_0x2bb2('0x40')](_0x48fbd6[_0x3dafcf[_0x2bb2('0x27')]+_0x2bb2('0x41')],handleFindQueue(_0x427efb[_0x2bb2('0x2f')]));if(_0x1c3f82){startRouting(_0x1710a1,_0x1c3f82,_0x3dafcf,_0x48fbd6);var _0x2c0fa0=(_0x1c3f82[_0x2bb2('0x38')]||0xa)*0x3e8;var _0x163735=(_0x427efb[_0x2bb2('0x38')]||0x14)*0x3e8;var _0x1d97c2;if(_0x2c0fa0>_0x163735){_0x163735=_0x2c0fa0;}var _0x43c8ba=seqqueue[_0x2bb2('0x42')](_0x2c0fa0);_0x43c8ba['id']=_0x1710a1;_0x43c8ba[_0x2bb2('0x43')]=_0x2c0fa0;_0x43c8ba[_0x2bb2('0x44')]=_0x163735;_0x43c8ba[_0x2bb2('0x27')]=_0x3dafcf[_0x2bb2('0x27')];_0x48fbd6[_0x2bb2('0x45')][_0x1710a1]['on'](_0x2bb2('0x46'),function(){logger[_0x2bb2('0x39')](_0x2bb2('0x47'),_0x1710a1);stopRouting(_0x1710a1,_0x1c3f82,_0x3dafcf,_0x48fbd6);clearTimeout(_0x1d97c2);_0x1d97c2=undefined;_0x43c8ba[_0x2bb2('0x48')](!![]);if(_0x48fbd6[_0x2bb2('0x45')][_0x1710a1]){delete _0x48fbd6[_0x2bb2('0x45')][_0x1710a1];}_0x3c77b4[_0x2bb2('0x49')]();});_0x48fbd6[_0x2bb2('0x45')][_0x1710a1]['on'](_0x2bb2('0x4a'),function(){if(_0x48fbd6['rules'][_0x1710a1]){delete _0x48fbd6[_0x2bb2('0x45')][_0x1710a1];}});_0x1d97c2=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x1710a1);endRouting(_0x1710a1,_0x1c3f82,_0x3dafcf,_0x48fbd6);clearTimeout(_0x1d97c2);_0x43c8ba[_0x2bb2('0x48')](!![]);_0x3c77b4['next']();},_0x163735);switch(_0x1c3f82[_0x2bb2('0x4b')]){case _0x2bb2('0x4c'):strategy['rrmemory'](_0x43c8ba,_0x1c3f82,_0x48fbd6,_0x3dafcf);break;default:strategy[_0x2bb2('0x4d')](_0x43c8ba,_0x1c3f82,_0x48fbd6,_0x3dafcf);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1710a1,_0x427efb[_0x2bb2('0x2f')]);_0x3c77b4[_0x2bb2('0x49')]();}}}catch(_0x5956cf){console[_0x2bb2('0x4e')](_0x5956cf);logger[_0x2bb2('0x33')]('[%s][QUEUE]\x20%s',_0x1710a1,_0x5956cf[_0x2bb2('0x4f')]);_0x3c77b4[_0x2bb2('0x49')]();}};}; \ No newline at end of file +var _0xfd0c=['queue','joinAt','emit','clone','account','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','channel','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','consequence','length','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','close','complete','rrmemory','beepall','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id'];(function(_0x3a11e4,_0x38d6c9){var _0x95a641=function(_0x1cf9f4){while(--_0x1cf9f4){_0x3a11e4['push'](_0x3a11e4['shift']());}};_0x95a641(++_0x38d6c9);}(_0xfd0c,0x12a));var _0xcfd0=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0xfd0c[_0xbec8e6];return _0x4aa6f2;};'use strict';var schema=require(_0xcfd0('0x0'));var _=require(_0xcfd0('0x1'));var util=require(_0xcfd0('0x2'));var seqqueue=require(_0xcfd0('0x3'));var moment=require('moment');var Redis=require(_0xcfd0('0x4'));var config=require(_0xcfd0('0x5'));var logger=require(_0xcfd0('0x6'))(_0xcfd0('0x7'));var strategy=require(_0xcfd0('0x8'));config[_0xcfd0('0x9')]=_[_0xcfd0('0xa')](config[_0xcfd0('0x9')],{'host':_0xcfd0('0xb'),'port':0x18eb});var io=require(_0xcfd0('0xc'))(new Redis(config[_0xcfd0('0x9')]));var attributes=['id',_0xcfd0('0xd'),'account',_0xcfd0('0xe'),'from',_0xcfd0('0xf')];function emit(_0xb63300,_0x22000a,_0x89d4e9){io['to'](_0xb63300)[_0xcfd0('0x10')](_0x22000a,_0x89d4e9);}function emitChannelQueueInteraction(_0x5eb511,_0x237ba8,_0x4cb9c7,_0x14dc97,_0x494420,_0x1ab2a0,_0x4d1bc2,_0x30c04b){var _0x1a9a9c=_[_0xcfd0('0x11')](_0x4cb9c7);_0x1a9a9c[_0xcfd0('0xd')]=_0x30c04b;_0x1a9a9c[_0xcfd0('0xe')]=_0x237ba8;_0x1a9a9c[_0xcfd0('0x12')]=_0x14dc97;_0x1a9a9c['id']=_0x494420;if(_0x1ab2a0){attributes[_0xcfd0('0x13')](_[_0xcfd0('0x14')](_0x5eb511)+'InteractionId');_0x4d1bc2[util[_0xcfd0('0x15')](_0xcfd0('0x16'),_0x5eb511)][_0x494420]=_[_0xcfd0('0x17')](_0x1a9a9c,attributes);}else{delete _0x4d1bc2[util['format'](_0xcfd0('0x16'),_0x5eb511)][_0x494420];}emit(util[_0xcfd0('0x15')](_0xcfd0('0x18'),_0x5eb511,_0x237ba8),util['format'](_0xcfd0('0x19'),_0x5eb511,_0x1ab2a0?_0xcfd0('0x1a'):_0xcfd0('0x1b')),_[_0xcfd0('0x17')](_0x1a9a9c,attributes));}var rpc={'openchannelQueueReport':require(_0xcfd0('0x1c')),'mailQueueReport':require(_0xcfd0('0x1d')),'chatQueueReport':require(_0xcfd0('0x1e')),'smsQueueReport':require(_0xcfd0('0x1f')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xcfd0('0x20'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xcfd0('0x21')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2f2634,_0x27e17d,_0x51e795,_0x26644e){if(_0x2f2634&&_0x27e17d&&_0x51e795){_0x27e17d[_0xcfd0('0x22')]+=0x1;var _0x1dc81a={'uniqueid':_0x2f2634,'from':_0x51e795['body']?_0x51e795[_0xcfd0('0x23')][_0xcfd0('0x24')]:'','joinAt':moment()[_0xcfd0('0x15')](_0xcfd0('0x25')),'ContactId':_0x51e795[_0xcfd0('0x26')]?_0x51e795[_0xcfd0('0x26')]['id']:null,'ListId':_0x51e795[_0xcfd0('0x27')]?_0x51e795[_0xcfd0('0x27')]['id']:null};_0x1dc81a[_['upperFirst'](_0x51e795['channel'])+_0xcfd0('0x28')]=_0x27e17d['id']||null;_0x1dc81a[_[_0xcfd0('0x29')](_0x51e795[_0xcfd0('0x2a')])+'InteractionId']=_0x51e795[_0xcfd0('0x2b')]?_0x51e795[_0xcfd0('0x2b')]['id']:null;_0x1dc81a[_['upperFirst'](_0x51e795[_0xcfd0('0x2a')])+_0xcfd0('0x2c')]=_0x51e795[_0xcfd0('0x2d')]?_0x51e795[_0xcfd0('0x2d')]['id']:null;_0x1dc81a[_[_0xcfd0('0x29')](_0x51e795[_0xcfd0('0x2a')])+(_0x51e795[_0xcfd0('0x2a')]!==_0xcfd0('0x2e')?'AccountId':_0xcfd0('0x2f'))]=_0x51e795[_0xcfd0('0x12')]?_0x51e795[_0xcfd0('0x12')]['id']:null;logger[_0xcfd0('0x30')](util[_0xcfd0('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x2f2634,_0x27e17d[_0xcfd0('0x31')]));emitChannelQueueInteraction(_0x51e795['channel'],_0x27e17d[_0xcfd0('0x31')],_0x1dc81a,_0x51e795[_0xcfd0('0x12')][_0xcfd0('0x31')],_0x51e795['message']['id'],!![],_0x26644e,_0x27e17d['id']);if(rpc[_0x51e795[_0xcfd0('0x2a')]+_0xcfd0('0x32')]){return rpc[_0x51e795[_0xcfd0('0x2a')]+_0xcfd0('0x32')][_0xcfd0('0x33')](_0x1dc81a)[_0xcfd0('0x34')](function(_0x176da4){logger[_0xcfd0('0x35')](_0xcfd0('0x36'));});}}}function stopRouting(_0x2dae1d,_0x234ba4,_0x1dc3ae,_0x5f2f47){if(_0x2dae1d&&_0x234ba4){_0x234ba4[_0xcfd0('0x22')]-=0x1;var _0x14b8b4={'leaveAt':moment()['format'](_0xcfd0('0x25')),'acceptAt':moment()[_0xcfd0('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xcfd0('0x30')](util[_0xcfd0('0x15')](_0xcfd0('0x37'),_0x2dae1d,_0x234ba4['name']));emitChannelQueueInteraction(_0x1dc3ae[_0xcfd0('0x2a')],_0x234ba4[_0xcfd0('0x31')],_0x1dc3ae[_0xcfd0('0x23')],_0x1dc3ae[_0xcfd0('0x12')][_0xcfd0('0x31')],_0x1dc3ae['message']['id'],![],_0x5f2f47,_0x234ba4['id']);if(rpc[_0x1dc3ae['channel']+_0xcfd0('0x32')]){return rpc[_0x1dc3ae['channel']+_0xcfd0('0x32')][_0xcfd0('0x38')](_0x2dae1d,_0x14b8b4)['catch'](function(_0x281d6e){logger[_0xcfd0('0x35')](_0xcfd0('0x39'));});}}}function endRouting(_0x5babb9,_0x2beab2,_0xee8199,_0x25e2d9){if(_0x5babb9&&_0x2beab2){_0x2beab2[_0xcfd0('0x22')]-=0x1;var _0x514856={'leaveAt':moment()[_0xcfd0('0x15')](_0xcfd0('0x25')),'exitAt':moment()[_0xcfd0('0x15')](_0xcfd0('0x25')),'reason':'timeout'};logger[_0xcfd0('0x30')](util[_0xcfd0('0x15')](_0xcfd0('0x3a'),_0x5babb9,_0x2beab2[_0xcfd0('0x31')]));emitChannelQueueInteraction(_0xee8199['channel'],_0x2beab2[_0xcfd0('0x31')],_0xee8199[_0xcfd0('0x23')],_0xee8199[_0xcfd0('0x12')][_0xcfd0('0x31')],_0xee8199[_0xcfd0('0x2d')]['id'],![],_0x25e2d9);if(rpc[_0xee8199[_0xcfd0('0x2a')]+_0xcfd0('0x32')]){return rpc[_0xee8199[_0xcfd0('0x2a')]+_0xcfd0('0x32')][_0xcfd0('0x38')](_0x5babb9,_0x514856)[_0xcfd0('0x34')](function(_0x58be64){logger[_0xcfd0('0x35')](_0xcfd0('0x39'));});}}}function handleFindQueue(_0x29c65a){return function(_0x177ca7){return _0x177ca7[_0xcfd0('0x31')]['toLowerCase']()===_0x29c65a['toLowerCase']();};}exports[_0xcfd0('0x3b')]=function(_0x350d5c,_0x24b4cb,_0x4e47d5,_0x212df7){return function(_0x52a7f9){try{var _0x46e990={'name':_0x24b4cb[0x0],'timeout':_0x24b4cb[0x1]};var _0x39cdc5=queue['validate'](_0x46e990,{'typecast':!![]});if(_0x39cdc5[_0xcfd0('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x350d5c,_[_0xcfd0('0x3d')](_0x39cdc5,'message')[_0xcfd0('0x3e')](',\x20'));_0x52a7f9[_0xcfd0('0x3f')]();}else{var _0x36b3c9=_[_0xcfd0('0x40')](_0x4e47d5[_0x212df7['channel']+_0xcfd0('0x41')],handleFindQueue(_0x46e990[_0xcfd0('0x31')]));if(_0x36b3c9){startRouting(_0x350d5c,_0x36b3c9,_0x212df7,_0x4e47d5);var _0x3a52e2=(_0x36b3c9[_0xcfd0('0x42')]||0xa)*0x3e8;var _0x158e40=(_0x46e990['timeout']||0x14)*0x3e8;var _0x4ea328;if(_0x3a52e2>_0x158e40){_0x158e40=_0x3a52e2;}var _0x1e8c33=seqqueue[_0xcfd0('0x43')](_0x3a52e2);_0x1e8c33['id']=_0x350d5c;_0x1e8c33[_0xcfd0('0x44')]=_0x3a52e2;_0x1e8c33[_0xcfd0('0x45')]=_0x158e40;_0x1e8c33[_0xcfd0('0x2a')]=_0x212df7[_0xcfd0('0x2a')];_0x4e47d5[_0xcfd0('0x46')][_0x350d5c]['on']('end',function(){logger[_0xcfd0('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x350d5c);stopRouting(_0x350d5c,_0x36b3c9,_0x212df7,_0x4e47d5);clearTimeout(_0x4ea328);_0x4ea328=undefined;_0x1e8c33[_0xcfd0('0x47')](!![]);if(_0x4e47d5[_0xcfd0('0x46')][_0x350d5c]){delete _0x4e47d5['rules'][_0x350d5c];}_0x52a7f9[_0xcfd0('0x3f')]();});_0x4e47d5[_0xcfd0('0x46')][_0x350d5c]['on'](_0xcfd0('0x48'),function(){if(_0x4e47d5[_0xcfd0('0x46')][_0x350d5c]){delete _0x4e47d5['rules'][_0x350d5c];}});_0x4ea328=setTimeout(function(){logger[_0xcfd0('0x30')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x350d5c);endRouting(_0x350d5c,_0x36b3c9,_0x212df7,_0x4e47d5);clearTimeout(_0x4ea328);_0x1e8c33[_0xcfd0('0x47')](!![]);_0x52a7f9['next']();},_0x158e40);switch(_0x36b3c9['strategy']){case _0xcfd0('0x49'):strategy[_0xcfd0('0x49')](_0x1e8c33,_0x36b3c9,_0x4e47d5,_0x212df7);break;default:strategy[_0xcfd0('0x4a')](_0x1e8c33,_0x36b3c9,_0x4e47d5,_0x212df7);}}else{logger[_0xcfd0('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x350d5c,_0x46e990['name']);_0x52a7f9['stop']();}}}catch(_0x47c815){console[_0xcfd0('0x4b')](_0x47c815);logger[_0xcfd0('0x35')](_0xcfd0('0x4c'),_0x350d5c,_0x47c815[_0xcfd0('0x4d')]);_0x52a7f9[_0xcfd0('0x3f')]();}};}; \ 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 002a6a7..5144e85 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 _0x00bb=['bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','forcedOwnership','agents','busy','busyQueue','channel','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','handleRun'];(function(_0x4d0d10,_0x5638d1){var _0x2a3db1=function(_0x201542){while(--_0x201542){_0x4d0d10['push'](_0x4d0d10['shift']());}};_0x2a3db1(++_0x5638d1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xb00b('0x0'));var uuid=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var logger=require('../../../../../config/logger')(_0xb00b('0x3'));var Agent=function(_0x47a3bf,_0x278c5e,_0x464fe7,_0x582ef9){this[_0xb00b('0x4')]=uuid['v4']();this[_0xb00b('0x5')]=_0x47a3bf;this['agent']=_0x278c5e;this['realtime']=_0x464fe7;this['routing']=_0x582ef9;this[_0xb00b('0x5')][_0xb00b('0x6')](this[_0xb00b('0x7')][_0xb00b('0x8')](this),this[_0xb00b('0x9')][_0xb00b('0x8')](this));this['squeue']['on']('timeout',this[_0xb00b('0x9')][_0xb00b('0x8')](this));this[_0xb00b('0x5')]['on'](_0xb00b('0xa'),this[_0xb00b('0xb')]['bind'](this));};Agent[_0xb00b('0xc')]['push']=function(){this['squeue']['push'](this[_0xb00b('0x7')][_0xb00b('0x8')](this),this[_0xb00b('0x9')][_0xb00b('0x8')](this));};Agent[_0xb00b('0xc')][_0xb00b('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xb00b('0xc')][_0xb00b('0x7')]=function(){logger['debug'](_0xb00b('0xd'),this[_0xb00b('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0xb00b('0xe')]['agents'][this['agent']['id']])){logger[_0xb00b('0xf')](_0xb00b('0x10'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);setTimeout(this['push'][_0xb00b('0x8')](this),0x3e8);}else{if(this['routing'][_0xb00b('0x12')]||util['isAgentAvailable'](this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],this['squeue']['channel'],![])){this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']][_0xb00b('0x14')]=!![];this[_0xb00b('0xe')][_0xb00b('0x13')][this['agent']['id']][_0xb00b('0x15')]=undefined;util['saveWaitingNotification'](this[_0xb00b('0xe')],this[_0xb00b('0x3')],this['agent'],this[_0xb00b('0x5')][_0xb00b('0x16')]);util['showNotification'](this[_0xb00b('0x4')],this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],null,this[_0xb00b('0x3')]);util[_0xb00b('0x17')](this['squeue']['id'],this['realtime'][_0xb00b('0x13')][this['agent']['id']],'RINGING'+(this['routing'][_0xb00b('0x12')]?_0xb00b('0x18'):''));}else{logger[_0xb00b('0xf')](_0xb00b('0x19'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);setTimeout(this[_0xb00b('0x6')]['bind'](this),0x3e8);}}};Agent[_0xb00b('0xc')]['handleTimeout']=function(_0x450129){if(_[_0xb00b('0x1a')](this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']])){return logger[_0xb00b('0xf')](_0xb00b('0x10'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);}else{logger[_0xb00b('0xf')](_0xb00b('0x1b'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);util['hideNotification'](this[_0xb00b('0x4')],this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],null,this['routing']);this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']][_0xb00b('0x14')]=![];this[_0xb00b('0xe')][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']][_0xb00b('0x15')]=undefined;util[_0xb00b('0x1c')](this['realtime'],this['routing'],this['agent'],this[_0xb00b('0x5')][_0xb00b('0x16')]);util[_0xb00b('0x17')](this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],_0x450129?_0xb00b('0x1d'):_0xb00b('0x1e'));}if(!_0x450129){setTimeout(this[_0xb00b('0x6')][_0xb00b('0x8')](this),0x3e8);}};function agent(_0x8785ec,_0x3302ac,_0x5efc18,_0x55451e){return new Agent(_0x8785ec,_0x3302ac,_0x5efc18,_0x55451e);}module[_0xb00b('0x1f')]=agent; \ No newline at end of file +var _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4c8540,_0x1243ae){_0x4c8540=_0x4c8540-0x0;var _0x32f264=_0xd0bb[_0x4c8540];return _0x32f264;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=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 c7798ab..5d31091 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 _0x7832=['length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','agents','busy','busyQueue','channel','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','timeout','bind','drained','handleDrained','prototype','handleTimeout','isNil','Agents'];(function(_0x1ba80c,_0x5707eb){var _0x13de97=function(_0x363eb3){while(--_0x363eb3){_0x1ba80c['push'](_0x1ba80c['shift']());}};_0x13de97(++_0x5707eb);}(_0x7832,0xe2));var _0x2783=function(_0x4d5ad7,_0x5708e4){_0x4d5ad7=_0x4d5ad7-0x0;var _0x154dad=_0x7832[_0x4d5ad7];return _0x154dad;};'use strict';var _=require(_0x2783('0x0'));var uuid=require(_0x2783('0x1'));var util=require(_0x2783('0x2'));var logger=require(_0x2783('0x3'))(_0x2783('0x4'));var Beepall=function(_0x2f0848,_0x42267c,_0x5d6b03,_0x19ae4f){this[_0x2783('0x5')]=uuid['v4']();this[_0x2783('0x6')]=_0x2f0848;this[_0x2783('0x7')]=_0x42267c;this[_0x2783('0x8')]=_0x5d6b03;this['routing']=_0x19ae4f;this['squeue'][_0x2783('0x9')](this[_0x2783('0xa')]['bind'](this),this['handleTimeout']['bind'](this));this[_0x2783('0x6')]['on'](_0x2783('0xb'),this['handleTimeout'][_0x2783('0xc')](this));this[_0x2783('0x6')]['on'](_0x2783('0xd'),this[_0x2783('0xe')][_0x2783('0xc')](this));};Beepall[_0x2783('0xf')]['push']=function(){this[_0x2783('0x6')][_0x2783('0x9')](this['handleRun'][_0x2783('0xc')](this),this[_0x2783('0x10')][_0x2783('0xc')](this));};Beepall[_0x2783('0xf')]['handleDrained']=function(){this[_0x2783('0x10')](!![]);};Beepall[_0x2783('0xf')]['handleRun']=function(){var _0x27f16e=!![];if(!_[_0x2783('0x11')](this[_0x2783('0x7')])&&!_['isNil'](this[_0x2783('0x7')][_0x2783('0x12')])&&this[_0x2783('0x7')][_0x2783('0x12')][_0x2783('0x13')]>0x0){for(var _0x3da34f=0x0,_0x5d6208;_0x3da34f0x0){for(var _0x4a7b6f=0x0,_0x569e88;_0x4a7b6f0x0&&_0x16291d[_0x383ce5+'CurrentCapacity']>=_0x16291d[_0x383ce5+_0xf7da('0x20')]){writeLog(_0x58236d,_0x16291d,_0x383ce5['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0xbfdac8,_0x5ba876,_0x2b9392,_0x4118b4,_0x12f839){return sendNotification(!![],_0xbfdac8,_0x5ba876,_0x2b9392,_0x4118b4,_0x12f839);};exports[_0xf7da('0x22')]=function(_0x5aef96,_0x58f2f1,_0x174ecc,_0x4075f4,_0x41960c){return sendNotification(![],_0x5aef96,_0x58f2f1,_0x174ecc,_0x4075f4,_0x41960c);};exports[_0xf7da('0x23')]=function(_0x42fbec,_0x4c693c,_0x3e1979){var _0x3f6d0b=_0x4c693c[_0xf7da('0x24')][_0xf7da('0x25')];if(!_0x3f6d0b&&_0x3e1979){_0x3f6d0b=_0x3e1979['id'];}var _0x396ff1=_[_0xf7da('0x26')](_0x42fbec[_0x4c693c[_0xf7da('0x27')]+'QueuesWaitingInteractions'],function(_0x240813){var _0x2b4d71=_['capitalize'](_0x4c693c[_0xf7da('0x27')])+_0xf7da('0x28');return _0x240813[_0x2b4d71]===_0x4c693c[_0xf7da('0x24')]['id'];});if(!_0x396ff1&&_0x3f6d0b){_0x396ff1=_[_0xf7da('0x26')](_0x42fbec['agents'][_0x3f6d0b][_0x4c693c[_0xf7da('0x27')]+'WaitingInteractions'],function(_0x5cb711){return _0x5cb711['id']===_0x4c693c['interaction']['id'];});}return _0x396ff1;};exports[_0xf7da('0x29')]=function(_0x5adc63,_0x451906,_0x1eab9a,_0x2a501d){_0x5adc63[_0xf7da('0x2a')][_0x1eab9a['id']][_0x2a501d+_0xf7da('0x2b')][_0x451906[_0xf7da('0x15')]['id']]={'id':_0x451906['interaction']['id']};};exports[_0xf7da('0x2c')]=function(_0x2d96b1,_0x2b9e8b,_0x341c68,_0x1762d5){delete _0x2d96b1['agents'][_0x341c68['id']][_0x1762d5+_0xf7da('0x2b')][_0x2b9e8b[_0xf7da('0x15')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x778e=['socket.io-emitter','format','user:%s','name','emit','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost'];(function(_0x1c88d8,_0x25e6df){var _0x5d09c8=function(_0x38bc84){while(--_0x38bc84){_0x1c88d8['push'](_0x1c88d8['shift']());}};_0x5d09c8(++_0x25e6df);}(_0x778e,0x196));var _0xe778=function(_0x13d979,_0x148fdf){_0x13d979=_0x13d979-0x0;var _0x1f9e80=_0x778e[_0x13d979];return _0x1f9e80;};'use strict';var _=require(_0xe778('0x0'));var util=require(_0xe778('0x1'));var utils=require(_0xe778('0x2'));var Redis=require(_0xe778('0x3'));var config=require(_0xe778('0x4'));var logger=require(_0xe778('0x5'))(_0xe778('0x6'));config[_0xe778('0x7')]=_[_0xe778('0x8')](config[_0xe778('0x7')],{'host':_0xe778('0x9'),'port':0x18eb});var io=require(_0xe778('0xa'))(new Redis(config[_0xe778('0x7')]));function sendNotification(_0x4e1dc8,_0x3bbee6,_0x48da93,_0x48ab91,_0x55389b,_0x36f4aa){io['to'](util[_0xe778('0xb')](_0xe778('0xc'),_0x48ab91[_0xe778('0xd')]))[_0xe778('0xe')]('user:save',_0x48ab91);var _0x2fb997=_0x36f4aa||{};var _0x2c63e3=_0x48da93['split']('.');var _0x4347cc={'uniqueid':_0x3bbee6,'channel':_0x2c63e3[0x0],'id':_0x2c63e3[0x1],'title':_0x2c63e3[0x0]+_0xe778('0xf'),'interactionId':_0x2c63e3[0x2],'queue':_0x55389b?_0x55389b[_0xe778('0xd')]:null,'sound':_0x2fb997[_0xe778('0x10')]['notificationSound'],'shake':_0x2fb997[_0xe778('0x10')][_0xe778('0x11')]};try{if(!_0x2fb997[_0xe778('0x12')]){_0x2fb997[_0xe778('0x12')]={};}if(_0x55389b){_0x2fb997['body'][_0xe778('0x13')]=_0x55389b;}else if(_0x2fb997[_0xe778('0x12')]['queue']){delete _0x2fb997[_0xe778('0x12')][_0xe778('0x13')];}_0x4347cc[_0xe778('0x14')]=utils[_0xe778('0x15')](_0x2fb997[_0xe778('0x10')]['notificationTemplate'],_0x2fb997);}catch(_0x51bf7c){_0x4347cc[_0xe778('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xe778('0x16')](util[_0xe778('0xb')](_0xe778('0x17'),_0x3bbee6,_0x51bf7c[_0xe778('0x18')]));}io['to'](util[_0xe778('0xb')](_0xe778('0xc'),_0x48ab91[_0xe778('0xd')]))[_0xe778('0xe')](util['format'](_0xe778('0x19'),_0x4e1dc8?_0xe778('0x1a'):_0xe778('0x1b')),_0x4347cc);}function writeLog(_0x350cd6,_0x378f6a,_0x5548c5){return logger['debug'](util[_0xe778('0xb')](_0xe778('0x1c'),_0x350cd6,_0x378f6a['name'],_0x5548c5));}exports[_0xe778('0x1d')]=function(_0x19f33d,_0x23e21f,_0x275a79,_0x6d004b){if(_0x23e21f[_0xe778('0x1e')]){writeLog(_0x19f33d,_0x23e21f,'BUSY');return![];}if(!_0x23e21f[_0xe778('0x1f')]){writeLog(_0x19f33d,_0x23e21f,_0xe778('0x20'));return![];}if(_0x23e21f[_0x275a79+_0xe778('0x21')]){writeLog(_0x19f33d,_0x23e21f,_0xe778('0x22'));return![];}if(_0x6d004b&&_0x23e21f[_0xe778('0x23')](_0x275a79+_0xe778('0x24'))&&_0x23e21f[_0xe778('0x23')](_0x275a79+'CurrentCapacity')){if(_0x23e21f[_0x275a79+'Capacity']>0x0&&_0x23e21f[_0x275a79+_0xe778('0x25')]>=_0x23e21f[_0x275a79+_0xe778('0x24')]){writeLog(_0x19f33d,_0x23e21f,_0x275a79['toUpperCase']()+_0xe778('0x26'));return![];}}return!![];};exports[_0xe778('0x27')]=function(_0x50ce,_0x431eca,_0x3b0035,_0x1ea9a8,_0x4994f5){return sendNotification(!![],_0x50ce,_0x431eca,_0x3b0035,_0x1ea9a8,_0x4994f5);};exports['hideNotification']=function(_0x6925c4,_0x1bd724,_0x3d1276,_0x9446ec,_0x5de3c4){return sendNotification(![],_0x6925c4,_0x1bd724,_0x3d1276,_0x9446ec,_0x5de3c4);};exports[_0xe778('0x28')]=function(_0x529136,_0x95a4f8,_0x5132d8){var _0x14a27e=_0x95a4f8[_0xe778('0x29')][_0xe778('0x2a')];if(!_0x14a27e&&_0x5132d8){_0x14a27e=_0x5132d8['id'];}var _0x401c2c=_[_0xe778('0x2b')](_0x529136[_0x95a4f8[_0xe778('0x2c')]+_0xe778('0x2d')],function(_0x3efdb5){var _0x2224e2=_['capitalize'](_0x95a4f8[_0xe778('0x2c')])+_0xe778('0x2e');return _0x3efdb5[_0x2224e2]===_0x95a4f8[_0xe778('0x29')]['id'];});if(!_0x401c2c&&_0x14a27e){_0x401c2c=_[_0xe778('0x2b')](_0x529136['agents'][_0x14a27e][_0x95a4f8[_0xe778('0x2c')]+_0xe778('0x2f')],function(_0x49360d){return _0x49360d['id']===_0x95a4f8[_0xe778('0x29')]['id'];});}return _0x401c2c;};exports[_0xe778('0x30')]=function(_0x3969a1,_0x579010,_0x4775bf,_0x406da6){_0x3969a1[_0xe778('0x31')][_0x4775bf['id']][_0x406da6+_0xe778('0x2f')][_0x579010['message']['id']]={'id':_0x579010[_0xe778('0x29')]['id']};};exports[_0xe778('0x32')]=function(_0x137dfd,_0x36d606,_0x4f4af,_0xd1aaa5){delete _0x137dfd[_0xe778('0x31')][_0x4f4af['id']][_0xd1aaa5+_0xe778('0x2f')][_0x36d606[_0xe778('0x18')]['id']];};exports[_0xe778('0x33')]=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 dba15b3..da521da 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 _0xcda7=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xcda7,0xce));var _0x7cda=function(_0x345190,_0x3f6649){_0x345190=_0x345190-0x0;var _0x397ddf=_0xcda7[_0x345190];return _0x397ddf;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require('lodash');var utils=require(_0x7cda('0x0'));var logger=require(_0x7cda('0x1'))(_0x7cda('0x2'));var system=schema({'command':{'type':_0x7cda('0x3'),'required':!![],'message':_0x7cda('0x4')}});exports[_0x7cda('0x5')]=function(_0x160848,_0x53da0d){return function(_0x282cd5){try{var _0x369ad3={'command':_0x53da0d[0x0]};var _0x5699e5=system['validate'](_0x369ad3,{'typecast':!![]});if(_0x5699e5[_0x7cda('0x6')]){logger[_0x7cda('0x7')](_0x7cda('0x8'),_0x160848,_[_0x7cda('0x9')](_0x5699e5,_0x7cda('0xa'))[_0x7cda('0xb')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x160848);_0x282cd5[_0x7cda('0xc')]();}else{var _0x2e65b0=this;var _0x4a3957=utils[_0x7cda('0xd')](_0x53da0d[0x0],this);logger['info'](_0x7cda('0xe'),_0x160848,_0x4a3957);sh['exec'](_[_0x7cda('0xf')](_0x4a3957),function(_0x4cf67c,_0x32aca1){logger[_0x7cda('0x10')](_0x7cda('0x11'),_0x160848,_0x4cf67c);if(_0x4cf67c==0x0){var _0x15601a=_0x32aca1[_0x7cda('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x7cda('0x13')](_0x53da0d[0x1])||_[_0x7cda('0x14')](_0x53da0d[0x1])){logger['info'](_0x7cda('0x15'),_0x160848);_0x2e65b0[_0x7cda('0x16')][_0x53da0d[0x1]]=_0x15601a;}else{logger[_0x7cda('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x160848,_0x53da0d[0x1],_0x15601a);_0x2e65b0[_0x7cda('0x16')][_0x53da0d[0x1]]=_0x15601a;}}_0x282cd5[_0x7cda('0xc')]();});}}catch(_0x18b8fd){logger[_0x7cda('0x7')](_0x7cda('0x8'),_0x160848,_[_0x7cda('0x17')](_0x18b8fd)?JSON[_0x7cda('0x18')](_0x18b8fd):_0x18b8fd);logger[_0x7cda('0x10')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x160848);_0x282cd5[_0x7cda('0xc')]();}};}; \ No newline at end of file +var _0x0fcf=['[%s][SYSTEM]\x20%s','isObject','stringify','lodash','./utils','../../../../config/logger','routing','string','consequence','validate','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x3e834a,_0x33654b){var _0xe8ab5b=function(_0x3d4ed8){while(--_0x3d4ed8){_0x3e834a['push'](_0x3e834a['shift']());}};_0xe8ab5b(++_0x33654b);}(_0x0fcf,0xdb));var _0xf0fc=function(_0x608b35,_0x69f514){_0x608b35=_0x608b35-0x0;var _0x58bc5a=_0x0fcf[_0x608b35];return _0x58bc5a;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xf0fc('0x0'));var utils=require(_0xf0fc('0x1'));var logger=require(_0xf0fc('0x2'))(_0xf0fc('0x3'));var system=schema({'command':{'type':_0xf0fc('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf0fc('0x5')]=function(_0x20cc07,_0x16ec27){return function(_0x59a3d6){try{var _0x4f1255={'command':_0x16ec27[0x0]};var _0x3ba564=system[_0xf0fc('0x6')](_0x4f1255,{'typecast':!![]});if(_0x3ba564[_0xf0fc('0x7')]){logger[_0xf0fc('0x8')]('[%s][SYSTEM]\x20%s',_0x20cc07,_[_0xf0fc('0x9')](_0x3ba564,_0xf0fc('0xa'))[_0xf0fc('0xb')](',\x20'));logger[_0xf0fc('0xc')](_0xf0fc('0xd'),_0x20cc07);_0x59a3d6[_0xf0fc('0xe')]();}else{var _0x4eb655=this;var _0x173dbe=utils['getMustacheRender'](_0x16ec27[0x0],this);logger[_0xf0fc('0xc')](_0xf0fc('0xf'),_0x20cc07,_0x173dbe);sh[_0xf0fc('0x10')](_['trim'](_0x173dbe),function(_0x42f8c6,_0x46aaf9){logger[_0xf0fc('0xc')](_0xf0fc('0x11'),_0x20cc07,_0x42f8c6);if(_0x42f8c6==0x0){var _0x55f293=_0x46aaf9[_0xf0fc('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xf0fc('0x13')](_0x16ec27[0x1])||_[_0xf0fc('0x14')](_0x16ec27[0x1])){logger[_0xf0fc('0xc')](_0xf0fc('0x15'),_0x20cc07);_0x4eb655[_0xf0fc('0x16')][_0x16ec27[0x1]]=_0x55f293;}else{logger[_0xf0fc('0xc')](_0xf0fc('0x17'),_0x20cc07,_0x16ec27[0x1],_0x55f293);_0x4eb655[_0xf0fc('0x16')][_0x16ec27[0x1]]=_0x55f293;}}_0x59a3d6[_0xf0fc('0xe')]();});}}catch(_0x28e9d7){logger['error'](_0xf0fc('0x18'),_0x20cc07,_[_0xf0fc('0x19')](_0x28e9d7)?JSON[_0xf0fc('0x1a')](_0x28e9d7):_0x28e9d7);logger[_0xf0fc('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x20cc07);_0x59a3d6[_0xf0fc('0xe')]();}};}; \ 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 050aab9..d1076b2 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 _0xb14f=['../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','next','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x5ad9c9,_0x323a20){var _0x5082d9=function(_0x2bdd4f){while(--_0x2bdd4f){_0x5ad9c9['push'](_0x5ad9c9['shift']());}};_0x5082d9(++_0x323a20);}(_0xb14f,0x14b));var _0xfb14=function(_0x33d807,_0x2dc7fc){_0x33d807=_0x33d807-0x0;var _0x299f13=_0xb14f[_0x33d807];return _0x299f13;};'use strict';var schema=require(_0xfb14('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xfb14('0x1')),'openchannelInteraction':require(_0xfb14('0x2')),'smsInteraction':require(_0xfb14('0x3')),'mailInteraction':require(_0xfb14('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfb14('0x5'))};var logger=require('../../../../config/logger')(_0xfb14('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfb14('0x7')}});exports[_0xfb14('0x8')]=function(_0x2a3199,_0x2fb1c7,_0x3f2bee,_0x3f832){return function(_0x99a6ee){try{var _0x5827d0={'tag':_0x2fb1c7[0x0]};var _0x13688c=tag[_0xfb14('0x0')](_0x5827d0,{'typecast':!![]});if(_0x13688c['length']){logger[_0xfb14('0x9')](_0xfb14('0xa'),_0x2a3199,_[_0xfb14('0xb')](_0x13688c,_0xfb14('0xc'))['join'](',\x20'));logger[_0xfb14('0xd')](_0xfb14('0xe'),_0x2a3199);_0x99a6ee['next']();}else{var _0x521ed8={'ids':[_0x2fb1c7[0x0]]};if(rpc[_0x3f832[_0xfb14('0xf')]+_0xfb14('0x10')]){rpc[_0x3f832[_0xfb14('0xf')]+_0xfb14('0x10')][_0xfb14('0x11')](_0x3f832['interaction']['id'],_0x521ed8)[_0xfb14('0x12')](function(_0x40d2ec){logger['info'](_0xfb14('0x13'),_0x2a3199,_0x2fb1c7[0x1],_0x3f832['channel'],_0x3f832['interaction']['id']);})['catch'](function(_0x47d399){logger[_0xfb14('0x9')]('[%s][TAG]\x20%s',_0x2a3199,JSON['stringify'](_0x47d399));logger['info'](_0xfb14('0xe'),_0x2a3199);})[_0xfb14('0x14')](function(){_0x99a6ee[_0xfb14('0x15')]();});}}}catch(_0x5ebf09){logger[_0xfb14('0x9')](_0xfb14('0xa'),_0x2a3199,_[_0xfb14('0x16')](_0x5ebf09)?JSON[_0xfb14('0x17')](_0x5ebf09):_0x5ebf09);logger[_0xfb14('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a3199);_0x99a6ee[_0xfb14('0x15')]();}};}; \ No newline at end of file +var _0x5cb0=['channel','Interaction','addTags','interaction','then','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x4e7e3d,_0x2ecc71){var _0x263bc9=function(_0x5ddd1a){while(--_0x5ddd1a){_0x4e7e3d['push'](_0x4e7e3d['shift']());}};_0x263bc9(++_0x2ecc71);}(_0x5cb0,0x125));var _0x05cb=function(_0x19fa8f,_0x42739f){_0x19fa8f=_0x19fa8f-0x0;var _0x1290ba=_0x5cb0[_0x19fa8f];return _0x1290ba;};'use strict';var schema=require(_0x05cb('0x0'));var _=require(_0x05cb('0x1'));var rpc={'chatInteraction':require(_0x05cb('0x2')),'openchannelInteraction':require(_0x05cb('0x3')),'smsInteraction':require(_0x05cb('0x4')),'mailInteraction':require(_0x05cb('0x5')),'faxInteraction':require(_0x05cb('0x6')),'whatsappInteraction':require(_0x05cb('0x7'))};var logger=require(_0x05cb('0x8'))(_0x05cb('0x9'));var tag=schema({'tag':{'type':_0x05cb('0xa'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x05cb('0xb')]=function(_0x4ccbec,_0x4e4a07,_0x47dd55,_0x4c83db){return function(_0x5175e3){try{var _0x53f77b={'tag':_0x4e4a07[0x0]};var _0x1a4935=tag['validate'](_0x53f77b,{'typecast':!![]});if(_0x1a4935[_0x05cb('0xc')]){logger[_0x05cb('0xd')](_0x05cb('0xe'),_0x4ccbec,_[_0x05cb('0xf')](_0x1a4935,'message')['join'](',\x20'));logger[_0x05cb('0x10')](_0x05cb('0x11'),_0x4ccbec);_0x5175e3[_0x05cb('0x12')]();}else{var _0x3aed4c={'ids':[_0x4e4a07[0x0]]};if(rpc[_0x4c83db[_0x05cb('0x13')]+_0x05cb('0x14')]){rpc[_0x4c83db[_0x05cb('0x13')]+_0x05cb('0x14')][_0x05cb('0x15')](_0x4c83db[_0x05cb('0x16')]['id'],_0x3aed4c)[_0x05cb('0x17')](function(_0x1d6280){logger[_0x05cb('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4ccbec,_0x4e4a07[0x1],_0x4c83db[_0x05cb('0x13')],_0x4c83db[_0x05cb('0x16')]['id']);})['catch'](function(_0x4c5c08){logger[_0x05cb('0xd')](_0x05cb('0xe'),_0x4ccbec,JSON[_0x05cb('0x18')](_0x4c5c08));logger[_0x05cb('0x10')](_0x05cb('0x11'),_0x4ccbec);})[_0x05cb('0x19')](function(){_0x5175e3[_0x05cb('0x12')]();});}}}catch(_0xd415bf){logger[_0x05cb('0xd')]('[%s][TAG]\x20%s',_0x4ccbec,_['isObject'](_0xd415bf)?JSON[_0x05cb('0x18')](_0xd415bf):_0xd415bf);logger[_0x05cb('0x10')](_0x05cb('0x11'),_0x4ccbec);_0x5175e3[_0x05cb('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 62a6014..0cd22b9 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3da=['logged','channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','includes','push','urlOnAnswer','?params=','title','2.0','method','login','stringify','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x11cbb5,_0x390441){var _0x54b8d3=function(_0x162ca2){while(--_0x162ca2){_0x11cbb5['push'](_0x11cbb5['shift']());}};_0x54b8d3(++_0x390441);}(_0xa3da,0x10b));var _0xaa3d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa3da[_0x2b10c6];return _0x3789d2;};'use strict';var rp=require(_0xaa3d('0x0'));var logger=require(_0xaa3d('0x1'))(_0xaa3d('0x2'));var _=require(_0xaa3d('0x3'));var arr=[];exports[_0xaa3d('0x4')]=function(_0x905db5,_0x5c57f7){return function(_0x1fec33){var _0x31b374=_0x5c57f7[0xa];var _0x3b0f59=_0x5c57f7[0xb];var _0x1a390f=_0x5c57f7[0xc];var _0x2a546f=_0x5c57f7[0xd];var _0x812f66=_0x5c57f7[0xe];var _0xfc0e56=_0x5c57f7[0xf]['replace'](/\n/g,_0xaa3d('0x5'));var _0x3286a9=_0x5c57f7[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xaa3d('0x6')](_0x3b0f59)){arr[_0xaa3d('0x7')](_0x3b0f59);var _0x207ee3=_0x5c57f7[0x3];var _0x4ae364=_0x5c57f7[0x4];var _0x492be8=_0x5c57f7[0x1];var _0x3417ab=_0x5c57f7[0x0];var _0x28f9a3={};_0x28f9a3[_0xaa3d('0x8')]=_0x5c57f7[0x8]+_0xaa3d('0x9')+_0x1a390f+'|'+_0x31b374+'|'+_0x2a546f+'|'+_0x3b0f59+'|'+_0x812f66;_0x28f9a3['urlOnRing']=_0x5c57f7[0x7]+_0xaa3d('0x9')+_0x1a390f+'|'+_0x31b374+'|'+_0x2a546f+'|'+_0x3b0f59+'|'+_0x812f66+'|'+_0xfc0e56+'|'+_0x3286a9;_0x28f9a3[_0xaa3d('0xa')]=_0x5c57f7[0x9];var _0x248899={};_0x248899['jsonrpc']=_0xaa3d('0xb');_0x248899[_0xaa3d('0xc')]=_0xaa3d('0xd');var _0x18b9a7=[];_0x18b9a7[_0xaa3d('0x7')](_0x5c57f7[0x2]);_0x18b9a7[_0xaa3d('0x7')](_0x5c57f7[0x5]);_0x18b9a7[_0xaa3d('0x7')](_0x5c57f7[0x6]);_0x248899['params']=_0x18b9a7;_0x248899['id']=0x1;var _0x273bc0=JSON[_0xaa3d('0xe')](_0x248899);var _0x3b54cf={'encoding':_0xaa3d('0xf'),'method':_0xaa3d('0x10'),'timeout':0x2710,'url':_0x207ee3,'headers':{'Content-Type':_0xaa3d('0x11')},'body':_0x273bc0};return rp(_0x3b54cf)[_0xaa3d('0x12')](function(_0x255edd){const _0x38ec2e=JSON[_0xaa3d('0x13')](_0x255edd);if(!_0x38ec2e[_0xaa3d('0x14')][_0xaa3d('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x8de063=_0x3b0f59;var _0x394e7f=_0xaa3d('0x16')+_0x492be8+_0xaa3d('0x17')+_0x3417ab+'&sessionId='+_0x8de063+_0xaa3d('0x18')+JSON['stringify'](_0x28f9a3);var _0x19b20d=_0x4ae364+'?'+_0x394e7f;return rp(_0x19b20d);})[_0xaa3d('0x12')](function(_0x53a796){logger['info'](_0xaa3d('0x19'),_0x905db5,_0x53a796);_0x1fec33[_0xaa3d('0x1a')]();})[_0xaa3d('0x1b')](function(_0x16f085){logger['error'](_0xaa3d('0x1c'),_0x905db5,_['isObject'](_0x16f085)?JSON[_0xaa3d('0xe')](_0x16f085):_0x16f085);_0x1fec33[_0xaa3d('0x1a')]();});}else{logger[_0xaa3d('0x1d')](_0xaa3d('0x1e'),_0x905db5);_0x1fec33[_0xaa3d('0x1f')]();}};}; \ No newline at end of file +var _0xcf88=['urlOnRing','jsonrpc','2.0','method','params','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params='];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf88,0x160));var _0x8cf8=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xcf88[_0x47b58b];return _0x46bebe;};'use strict';var rp=require(_0x8cf8('0x0'));var logger=require(_0x8cf8('0x1'))(_0x8cf8('0x2'));var _=require(_0x8cf8('0x3'));var arr=[];exports[_0x8cf8('0x4')]=function(_0x4543a6,_0xf88df1){return function(_0x57e28b){var _0x9e3ade=_0xf88df1[0xa];var _0x142865=_0xf88df1[0xb];var _0x51403a=_0xf88df1[0xc];var _0x90b8a1=_0xf88df1[0xd];var _0xb4be80=_0xf88df1[0xe];var _0x4fc86a=_0xf88df1[0xf][_0x8cf8('0x5')](/\n/g,_0x8cf8('0x6'));var _0x10c8fd=_0xf88df1[0x10][_0x8cf8('0x5')](/\n/g,'\x20');if(!arr[_0x8cf8('0x7')](_0x142865)){arr[_0x8cf8('0x8')](_0x142865);var _0x5b1959=_0xf88df1[0x3];var _0x58697f=_0xf88df1[0x4];var _0x3ba7eb=_0xf88df1[0x1];var _0x1115ff=_0xf88df1[0x0];var _0x390fcf={};_0x390fcf[_0x8cf8('0x9')]=_0xf88df1[0x8]+_0x8cf8('0xa')+_0x51403a+'|'+_0x9e3ade+'|'+_0x90b8a1+'|'+_0x142865+'|'+_0xb4be80;_0x390fcf[_0x8cf8('0xb')]=_0xf88df1[0x7]+_0x8cf8('0xa')+_0x51403a+'|'+_0x9e3ade+'|'+_0x90b8a1+'|'+_0x142865+'|'+_0xb4be80+'|'+_0x4fc86a+'|'+_0x10c8fd;_0x390fcf['title']=_0xf88df1[0x9];var _0x28c3fd={};_0x28c3fd[_0x8cf8('0xc')]=_0x8cf8('0xd');_0x28c3fd[_0x8cf8('0xe')]='login';var _0x3d9506=[];_0x3d9506[_0x8cf8('0x8')](_0xf88df1[0x2]);_0x3d9506['push'](_0xf88df1[0x5]);_0x3d9506[_0x8cf8('0x8')](_0xf88df1[0x6]);_0x28c3fd[_0x8cf8('0xf')]=_0x3d9506;_0x28c3fd['id']=0x1;var _0x590866=JSON[_0x8cf8('0x10')](_0x28c3fd);var _0x5aa15e={'encoding':_0x8cf8('0x11'),'method':_0x8cf8('0x12'),'timeout':0x2710,'url':_0x5b1959,'headers':{'Content-Type':_0x8cf8('0x13')},'body':_0x590866};return rp(_0x5aa15e)[_0x8cf8('0x14')](function(_0x549dd7){const _0x50783a=JSON[_0x8cf8('0x15')](_0x549dd7);if(!_0x50783a[_0x8cf8('0x16')]['logged']){throw new Error(_0x8cf8('0x17'));}var _0x28a9b1=_0x142865;var _0x302002=_0x8cf8('0x18')+_0x3ba7eb+_0x8cf8('0x19')+_0x1115ff+'&sessionId='+_0x28a9b1+_0x8cf8('0x1a')+JSON['stringify'](_0x390fcf);var _0x1cd39d=_0x58697f+'?'+_0x302002;return rp(_0x1cd39d);})[_0x8cf8('0x14')](function(_0x144c73){logger[_0x8cf8('0x1b')](_0x8cf8('0x1c'),_0x4543a6,_0x144c73);_0x57e28b[_0x8cf8('0x1d')]();})['catch'](function(_0x3ac58d){logger['error']('[%s][TVOX]\x20%s',_0x4543a6,_[_0x8cf8('0x1e')](_0x3ac58d)?JSON[_0x8cf8('0x10')](_0x3ac58d):_0x3ac58d);_0x57e28b[_0x8cf8('0x1d')]();});}else{logger[_0x8cf8('0x1b')](_0x8cf8('0x1f'),_0x4543a6);_0x57e28b[_0x8cf8('0x20')]();}};}; \ 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 f1cdc12..f426e88 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x426c23,_0x34814f){var _0x27dd03=function(_0x54d472){while(--_0x54d472){_0x426c23['push'](_0x426c23['shift']());}};_0x27dd03(++_0x34814f);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x263ee9,_0x2832d6){var _0x48b1b0=function(_0x17ed75){while(--_0x17ed75){_0x263ee9['push'](_0x263ee9['shift']());}};_0x48b1b0(++_0x2832d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4c577a9..378c7a0 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 _0xadaf=['openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','interaction','applications','isArray','length','join','app','autoreply','split','mail','push','slice','dialogflow','amazonlex','appdata','tag','tvox','getMustacheRender','account','notificationTemplate','message','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0xb77190,_0x228d17){var _0x4a699d=function(_0x2c4cf0){while(--_0x2c4cf0){_0xb77190['push'](_0xb77190['shift']());}};_0x4a699d(++_0x228d17);}(_0xadaf,0x123));var _0xfada=function(_0x3b6787,_0x3ab0c3){_0x3b6787=_0x3b6787-0x0;var _0x23b539=_0xadaf[_0x3b6787];return _0x23b539;};'use strict';var _=require(_0xfada('0x0'));var util=require(_0xfada('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0xfada('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0xfada('0x3'))('routing');var rpc={'openchannelQueueReport':require(_0xfada('0x4')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xfada('0x5')),'smsQueueReport':require(_0xfada('0x6')),'faxQueueReport':require(_0xfada('0x7')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xfada('0x8'));function getId(_0x21d01f,_0x2ce1eb,_0x50d3df){return util[_0xfada('0x9')](_0xfada('0xa'),_0x21d01f,_0x2ce1eb||0x0,_0x50d3df||0x0);}function getIntervals(_0x53ca81,_0x4a4a46){var _0x98d959=[];if(!_['isNil'](_0x4a4a46[_0xfada('0xb')])&&!_[_0xfada('0xc')](_0x53ca81[_0x4a4a46[_0xfada('0xb')]])&&!_['isNil'](_0x53ca81[_0x4a4a46[_0xfada('0xb')]][_0xfada('0xd')])){_0x98d959=_[_0xfada('0xe')](_0x53ca81[_0x4a4a46[_0xfada('0xb')]][_0xfada('0xd')],_0xfada('0xf'));}else if(!_[_0xfada('0xc')](_0x4a4a46[_0xfada('0xf')])){_0x98d959=[_0x4a4a46[_0xfada('0xf')]];}return _0x98d959;}exports[_0xfada('0x10')]=function(_0x495899){_0x495899[_0xfada('0x11')]={};return new BPromise(function(_0x773d20,_0xba8f9a){var _0x542089={'Start':function(_0x23d27e){var _0x1eb47c=this;return new Promise(function(_0x5cf601,_0x275f3b){if(_0x23d27e){try{var _0x395281=[];var _0x20eecb=getId(_0x23d27e[_0xfada('0x12')],_0x23d27e['message']?_0x23d27e['message']['id']:0x0,_0x23d27e[_0xfada('0x13')]?_0x23d27e['interaction']['id']:0x0);var _0x3f675e=sUtils['checkWaitingNotifications'](_0x495899,_0x23d27e);if(!_0x3f675e&&_0x23d27e[_0xfada('0x14')]&&_[_0xfada('0x15')](_0x23d27e[_0xfada('0x14')])&&_0x23d27e[_0xfada('0x14')][_0xfada('0x16')]){for(var _0x11ef05=0x0;_0x11ef05<_0x23d27e['applications'][_0xfada('0x16')];_0x11ef05+=0x1){var _0x3bb0a5=_0x23d27e[_0xfada('0x14')][_0x11ef05];if(fs['existsSync'](path[_0xfada('0x17')](__dirname,'applications',_0x3bb0a5['app']+'.js'))){var _0x12296c=[];switch(_0x3bb0a5[_0xfada('0x18')]['toLowerCase']()){case _0xfada('0x19'):var _0x1f1d25=_0x3bb0a5['appdata'][_0xfada('0x1a')](',');if(_0x23d27e[_0xfada('0x12')]===_0xfada('0x1b')){_0x12296c['push'](_0x1f1d25[0x0]);_0x12296c[_0xfada('0x1c')](_0x1f1d25[0x1]);_0x12296c[_0xfada('0x1c')](_0x1f1d25[_0xfada('0x1d')](0x2,_0x1f1d25[_0xfada('0x16')])[_0xfada('0x17')](','));}else{_0x12296c[_0xfada('0x1c')](_0x1f1d25[0x0]);_0x12296c['push'](_0x1f1d25[_0xfada('0x1d')](0x1,_0x1f1d25[_0xfada('0x16')])[_0xfada('0x17')](','));}break;case _0xfada('0x1e'):var _0x213b85=_0x3bb0a5['appdata'][_0xfada('0x1a')](',');_0x12296c[_0xfada('0x1c')](_0x213b85[0x0]);_0x12296c[_0xfada('0x1c')](_0x213b85[0x1]);_0x12296c[_0xfada('0x1c')](_0x213b85['slice'](0x2,_0x213b85[_0xfada('0x16')])[_0xfada('0x17')](','));break;case'dialogflowv2':var _0xda0fa4=_0x3bb0a5['appdata']['split'](',');_0x12296c[_0xfada('0x1c')](_0xda0fa4[0x0]);_0x12296c['push'](_0xda0fa4[0x1]);_0x12296c[_0xfada('0x1c')](_0xda0fa4[0x2]);_0x12296c[_0xfada('0x1c')](_0xda0fa4[0x3]);_0x12296c['push'](_0xda0fa4[_0xfada('0x1d')](0x4,_0xda0fa4['length'])[_0xfada('0x17')](','));break;case _0xfada('0x1f'):var _0x1530a3=_0x3bb0a5[_0xfada('0x20')][_0xfada('0x1a')](',');_0x12296c[_0xfada('0x1c')](_0x1530a3[0x0]);_0x12296c['push'](_0x1530a3[0x1]);_0x12296c[_0xfada('0x1c')](_0x1530a3[0x2]);_0x12296c[_0xfada('0x1c')](_0x1530a3[0x3]);_0x12296c[_0xfada('0x1c')](_0x1530a3[_0xfada('0x1d')](0x4,_0x1530a3['length'])[_0xfada('0x17')](','));break;case'message':_0x12296c[_0xfada('0x1c')](_0x3bb0a5[_0xfada('0x20')]);break;case _0xfada('0x21'):_0x12296c[_0xfada('0x1c')](_0x3bb0a5['TagId']);_0x12296c[_0xfada('0x1c')](_0x3bb0a5['appdata']);break;case _0xfada('0x22'):var _0xf1cea4=utils[_0xfada('0x23')](_0x23d27e[_0xfada('0x24')][_0xfada('0x25')],_0x23d27e);var _0x53e280=_0x3bb0a5[_0xfada('0x20')]['split'](',');_0x12296c[_0xfada('0x1c')](_0x53e280[0x0]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x1]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x2]);_0x12296c['push'](_0x53e280[0x3]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x4]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x5]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x6]);_0x12296c['push'](_0x53e280[0x7]);_0x12296c['push'](_0x53e280[0x8]);_0x12296c[_0xfada('0x1c')](_0x53e280[0x9]);_0x12296c[_0xfada('0x1c')](_0x53e280[0xa]);_0x12296c[_0xfada('0x1c')](_0x23d27e[_0xfada('0x13')]['id']);_0x12296c[_0xfada('0x1c')](_0x23d27e[_0xfada('0x26')]['id']);_0x12296c[_0xfada('0x1c')](_0x3bb0a5[_0xfada('0x27')]);_0x12296c['push'](_0x23d27e[_0xfada('0x13')][_0xfada('0x28')]);_0x12296c[_0xfada('0x1c')](_0x23d27e[_0xfada('0x29')][_0xfada('0x29')]);_0x12296c[_0xfada('0x1c')](_0xf1cea4);break;default:_0x12296c=_[_0xfada('0xc')](_0x3bb0a5['appdata'])?[]:_0x3bb0a5['appdata'][_0xfada('0x1a')](',');}var _0x297d66={'id':util[_0xfada('0x9')](_0xfada('0x2a'),_0x20eecb,_0x3bb0a5['id'],_0x3bb0a5[_0xfada('0x18')]),'condition':require('./interval')[_0xfada('0x2b')](_0x20eecb,getIntervals(_0x495899['intervals'],_0x3bb0a5),_0x495899),'consequence':require(_0xfada('0x2c')+_0x3bb0a5[_0xfada('0x18')])[_0xfada('0x2d')](_0x20eecb,_0x12296c,_0x495899,_0x23d27e),'p':_0x3bb0a5[_0xfada('0x2e')]||0x0};logger[_0xfada('0x2f')](_0xfada('0x30'),_0x297d66['id'],'on\x20interval',getIntervals(_0x495899['intervals'],_0x3bb0a5)['join'](_0xfada('0x31')));_0x395281['push'](_0x297d66);}else{logger[_0xfada('0x32')](_0xfada('0x33'),path['join'](__dirname,_0xfada('0x14'),_0x3bb0a5[_0xfada('0x18')]+'.js'));}}_0x495899[_0xfada('0x11')][_0x20eecb]=new RuleEngine(_0x395281);_0x495899[_0xfada('0x11')][_0x20eecb][_0xfada('0x34')](_0x23d27e,function(_0x13c072){logger[_0xfada('0x2f')]('Applications\x20executed',JSON[_0xfada('0x35')](_0x13c072[_0xfada('0x36')]));if(_0x495899[_0xfada('0x11')][_0x20eecb]){_0x495899[_0xfada('0x11')][_0x20eecb]['emit']('complete');}});return _0x5cf601({'code':0xc8,'message':_0x23d27e});}else{if(_0x3f675e){logger['info'](util['format'](_0xfada('0x37'),_0x20eecb));}else{logger[_0xfada('0x2f')](_0xfada('0x38'));}return _0x5cf601({'code':0xc8,'message':_0x23d27e});}}catch(_0x5c83cd){logger[_0xfada('0x32')](_0x5c83cd[_0xfada('0x39')]);return _0x275f3b(_0x1eb47c[_0xfada('0x32')](0x1f4,_0x5c83cd));}}return _0x275f3b(_0xfada('0x3a'));});},'AcceptMessage':function(_0x30e758){var _0x427ab5=this;return new Promise(function(_0x4c5e85,_0x476924){if(_0x30e758['agent']&&_0x30e758[_0xfada('0x3b')]['id']){if(_0x495899[_0xfada('0x3c')][_0x30e758[_0xfada('0x3b')]['id']]){_0x495899[_0xfada('0x3c')][_0x30e758[_0xfada('0x3b')]['id']][_0xfada('0x3d')]=![];_0x495899[_0xfada('0x3c')][_0x30e758[_0xfada('0x3b')]['id']]['busyQueue']=undefined;}}if(_0x30e758['message']&&_0x30e758[_0xfada('0x26')]['id']){try{var _0x429f77=getId(_0x30e758[_0xfada('0x12')],_0x30e758[_0xfada('0x26')]?_0x30e758['message']['id']:0x0,_0x30e758[_0xfada('0x13')]?_0x30e758[_0xfada('0x13')]['id']:0x0);if(_0x495899['rules'][_0x429f77]){_0x495899[_0xfada('0x11')][_0x429f77][_0xfada('0x3e')](_0xfada('0x3f'));if(rpc[_0x30e758[_0xfada('0x12')]+'QueueReport']){rpc[_0x30e758[_0xfada('0x12')]+_0xfada('0x40')][_0xfada('0x41')](_0x429f77,{'UserId':_0x30e758[_0xfada('0x26')]['UserId']})[_0xfada('0x42')](function(){logger[_0xfada('0x32')](_0xfada('0x43'));});}}return _0x4c5e85({'code':0xc8,'message':_0x30e758});}catch(_0x47b606){logger[_0xfada('0x32')](_0x47b606[_0xfada('0x39')]);return _0x476924(_0x427ab5[_0xfada('0x32')](0x1f4,_0x47b606));}}logger[_0xfada('0x32')](_0xfada('0x44'));return _0x476924(_0x427ab5[_0xfada('0x32')](0x1f4,_0xfada('0x44')));});},'RejectMessage':function(_0x36f95c){var _0x503b3d=this;return new Promise(function(_0x2f2399,_0x2ac443){if(_0x36f95c[_0xfada('0x3b')]&&_0x36f95c['agent']['id']){try{if(_0x495899[_0xfada('0x3c')][_0x36f95c['agent']['id']]){_0x495899['agents'][_0x36f95c[_0xfada('0x3b')]['id']]['busy']=![];_0x495899[_0xfada('0x3c')][_0x36f95c[_0xfada('0x3b')]['id']]['busyQueue']=undefined;}return _0x2f2399({'code':0xc8,'message':_0x36f95c});}catch(_0x4c2832){logger['error'](_0x4c2832[_0xfada('0x39')]);return _0x2ac443(_0x503b3d[_0xfada('0x32')](0x1f4,_0x4c2832));}}logger['error'](_0xfada('0x44'));return _0x2ac443(_0x503b3d['error'](0x1f4,_0xfada('0x44')));});},'AbandonInteraction':function(_0x6a696d){var _0x4048e6=this;return new Promise(function(_0x46bb88,_0x4296a5){if(_0x6a696d[_0xfada('0x12')]&&_0x6a696d[_0xfada('0x13')]&&_0x6a696d[_0xfada('0x13')]['id']){try{var _0x2fe1a4=getId(_0x6a696d[_0xfada('0x12')],_0x6a696d[_0xfada('0x26')]?_0x6a696d[_0xfada('0x26')]['id']:0x0,_0x6a696d[_0xfada('0x13')]?_0x6a696d[_0xfada('0x13')]['id']:0x0);if(_0x495899['rules'][_0x2fe1a4]){_0x495899[_0xfada('0x11')][_0x2fe1a4][_0xfada('0x3e')](_0xfada('0x3f'));}return _0x46bb88({'code':0xc8,'message':_0x6a696d});}catch(_0x564b61){logger['error'](_0x564b61[_0xfada('0x39')]);return _0x4296a5(_0x4048e6[_0xfada('0x32')](0x1f4,_0x564b61));}}logger['error'](_0xfada('0x44'));return _0x4296a5(_0x4048e6[_0xfada('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x19d008){var _0xbcab4f=this;return new Promise(function(_0x5bb73e,_0x223e73){if(_0x495899['agents'][_0xfada('0x45')](_0x19d008['id'])){for(var _0x232d1c in _0x19d008['capacity']){if(_0x19d008[_0xfada('0x46')]['hasOwnProperty'](_0x232d1c)){if(_0x495899['agents'][_0x19d008['id']]['hasOwnProperty'](_0x232d1c+_0xfada('0x47'))){_0x495899[_0xfada('0x3c')][_0x19d008['id']][_0x232d1c+_0xfada('0x47')]=parseInt(_0x19d008['capacity'][_0x232d1c],0xa);}}}_0x495899[_0xfada('0x3c')][_0x19d008['id']][_0xfada('0x48')]();return _0x5bb73e({'code':0xc8,'message':_0x495899['agents'][_0x19d008['id']]});}else{return _0x223e73(_0xbcab4f[_0xfada('0x32')](0x1f4,_0xfada('0x49')));}});},'Agents':function(_0x3c2deb){return new Promise(function(_0x194919){var _0xd36c6=_[_0xfada('0x4a')](_0x495899[_0xfada('0x3c')]);if(_0x3c2deb&&_0x3c2deb['id']){var _0x12b517=_[_0xfada('0x4b')](_0xd36c6,function(_0x503064){return _0x503064['id']===_0x3c2deb['id'];});_0x194919(_0x12b517);}else{_0x194919({'count':_0xd36c6[_0xfada('0x16')],'rows':_0xd36c6});}});},'ChatQueues':function(){return new Promise(function(_0x46c6e0){var _0x22cb30=[];for(var _0x394acb in _0x495899[_0xfada('0x4c')]){if(_0x495899[_0xfada('0x4c')][_0xfada('0x45')](_0x394acb)){var _0x298247=_0x495899[_0xfada('0x4c')][_0x394acb];var _0x5ea10a={'id':_0x298247['id'],'available':_0x298247[_0xfada('0x4d')],'loggedIn':_0x298247[_0xfada('0x4e')],'name':_0x298247[_0xfada('0x4f')],'paused':_0x298247[_0xfada('0x50')],'waiting':_0x298247[_0xfada('0x51')]};_0x22cb30['push'](_0x5ea10a);}}_0x46c6e0({'count':_0x22cb30[_0xfada('0x16')],'rows':_0x22cb30});});},'MailQueues':function(){return new Promise(function(_0x3d820a){var _0x2d8ad7=[];for(var _0x492a23 in _0x495899['mailQueues']){if(_0x495899[_0xfada('0x52')][_0xfada('0x45')](_0x492a23)){var _0x4729dd=_0x495899['mailQueues'][_0x492a23];var _0xeb28b2={'id':_0x4729dd['id'],'available':_0x4729dd['available'],'loggedIn':_0x4729dd['loggedIn'],'name':_0x4729dd[_0xfada('0x4f')],'paused':_0x4729dd['paused'],'waiting':_0x4729dd[_0xfada('0x51')]};_0x2d8ad7[_0xfada('0x1c')](_0xeb28b2);}}_0x3d820a({'count':_0x2d8ad7[_0xfada('0x16')],'rows':_0x2d8ad7});});},'OpenchannelQueues':function(){return new Promise(function(_0x244060){var _0x2e9f6b=[];for(var _0x3579a0 in _0x495899['openchannelQueues']){if(_0x495899[_0xfada('0x53')][_0xfada('0x45')](_0x3579a0)){var _0x1dbe8b=_0x495899[_0xfada('0x53')][_0x3579a0];var _0x57119e={'id':_0x1dbe8b['id'],'available':_0x1dbe8b['available'],'loggedIn':_0x1dbe8b[_0xfada('0x4e')],'name':_0x1dbe8b[_0xfada('0x4f')],'paused':_0x1dbe8b['paused'],'waiting':_0x1dbe8b[_0xfada('0x51')]};_0x2e9f6b[_0xfada('0x1c')](_0x57119e);}}_0x244060({'count':_0x2e9f6b[_0xfada('0x16')],'rows':_0x2e9f6b});});},'SmsQueues':function(){return new Promise(function(_0xaff7f8){var _0x444dd9=[];for(var _0x3bb0e5 in _0x495899[_0xfada('0x54')]){if(_0x495899['smsQueues']['hasOwnProperty'](_0x3bb0e5)){var _0x2f47a5=_0x495899['smsQueues'][_0x3bb0e5];var _0x4a01eb={'id':_0x2f47a5['id'],'available':_0x2f47a5[_0xfada('0x4d')],'loggedIn':_0x2f47a5['loggedIn'],'name':_0x2f47a5[_0xfada('0x4f')],'paused':_0x2f47a5['paused'],'waiting':_0x2f47a5[_0xfada('0x51')]};_0x444dd9['push'](_0x4a01eb);}}_0xaff7f8({'count':_0x444dd9['length'],'rows':_0x444dd9});});},'FaxQueues':function(){return new Promise(function(_0x29a1fb){var _0x138f4f=[];for(var _0xb7507f in _0x495899['faxQueues']){if(_0x495899[_0xfada('0x55')]['hasOwnProperty'](_0xb7507f)){var _0x5bca3c=_0x495899[_0xfada('0x55')][_0xb7507f];var _0x296dc0={'id':_0x5bca3c['id'],'available':_0x5bca3c['available'],'loggedIn':_0x5bca3c[_0xfada('0x4e')],'name':_0x5bca3c[_0xfada('0x4f')],'paused':_0x5bca3c[_0xfada('0x50')],'waiting':_0x5bca3c[_0xfada('0x51')]};_0x138f4f['push'](_0x296dc0);}}_0x29a1fb({'count':_0x138f4f['length'],'rows':_0x138f4f});});},'WhatsappQueues':function(){return new Promise(function(_0x38e478){var _0x26b68f=[];for(var _0x2fb5f3 in _0x495899[_0xfada('0x56')]){if(_0x495899[_0xfada('0x56')][_0xfada('0x45')](_0x2fb5f3)){var _0x4a1225=_0x495899['whatsappQueues'][_0x2fb5f3];var _0xdb3ac6={'id':_0x4a1225['id'],'available':_0x4a1225[_0xfada('0x4d')],'loggedIn':_0x4a1225[_0xfada('0x4e')],'name':_0x4a1225['name'],'paused':_0x4a1225[_0xfada('0x50')],'waiting':_0x4a1225['waiting']};_0x26b68f[_0xfada('0x1c')](_0xdb3ac6);}}_0x38e478({'count':_0x26b68f['length'],'rows':_0x26b68f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xbf50d){var _0x3e8f52=_[_0xfada('0x4a')](_0x495899[_0xfada('0x57')]);_0xbf50d({'count':_0x3e8f52[_0xfada('0x16')],'rows':_0x3e8f52});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2e04eb){var _0x586713=_['values'](_0x495899[_0xfada('0x58')]);_0x2e04eb({'count':_0x586713['length'],'rows':_0x586713});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x16ce18){var _0x12ec49=_[_0xfada('0x4a')](_0x495899[_0xfada('0x59')]);_0x16ce18({'count':_0x12ec49[_0xfada('0x16')],'rows':_0x12ec49});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2fbd50){var _0x415295=_['values'](_0x495899['smsQueuesWaitingInteractions']);_0x2fbd50({'count':_0x415295[_0xfada('0x16')],'rows':_0x415295});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x217292){var _0x33c41f=_[_0xfada('0x4a')](_0x495899[_0xfada('0x5a')]);_0x217292({'count':_0x33c41f[_0xfada('0x16')],'rows':_0x33c41f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x109bd4){var _0x4583a5=_['values'](_0x495899[_0xfada('0x5b')]);_0x109bd4({'count':_0x4583a5[_0xfada('0x16')],'rows':_0x4583a5});});}};var _0x5983c6=jayson['server'](_0x542089)['http']();_0x5983c6['on'](_0xfada('0x32'),function(_0x5ca004){logger['error'](JSON[_0xfada('0x35')](_0x5ca004));return _0xba8f9a(_0x5ca004);});_0x5983c6[_0xfada('0x10')](0x232c,_0xfada('0x5c'),function(){console[_0xfada('0x5d')](_0xfada('0x5e'),0x232c);return _0x773d20('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x3b8a=['QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','length','join','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','ContactId','body','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit'];(function(_0x36c21d,_0x4be87f){var _0x25d652=function(_0x3bfed5){while(--_0x3bfed5){_0x36c21d['push'](_0x36c21d['shift']());}};_0x25d652(++_0x4be87f);}(_0x3b8a,0x1ac));var _0xa3b8=function(_0x33a960,_0x4dc36e){_0x33a960=_0x33a960-0x0;var _0x293029=_0x3b8a[_0x33a960];return _0x293029;};'use strict';var _=require(_0xa3b8('0x0'));var util=require(_0xa3b8('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xa3b8('0x2'));var BPromise=require(_0xa3b8('0x3'));var utils=require(_0xa3b8('0x4'));var sUtils=require(_0xa3b8('0x5'));var logger=require(_0xa3b8('0x6'))(_0xa3b8('0x7'));var rpc={'openchannelQueueReport':require(_0xa3b8('0x8')),'mailQueueReport':require(_0xa3b8('0x9')),'chatQueueReport':require(_0xa3b8('0xa')),'smsQueueReport':require(_0xa3b8('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa3b8('0xc'))};var RuleEngine=require(_0xa3b8('0xd'));function getId(_0x126b9a,_0x30c365,_0x33c59e){return util[_0xa3b8('0xe')](_0xa3b8('0xf'),_0x126b9a,_0x30c365||0x0,_0x33c59e||0x0);}function getIntervals(_0x5489de,_0x163047){var _0x19a2fa=[];if(!_[_0xa3b8('0x10')](_0x163047[_0xa3b8('0x11')])&&!_['isNil'](_0x5489de[_0x163047[_0xa3b8('0x11')]])&&!_[_0xa3b8('0x10')](_0x5489de[_0x163047[_0xa3b8('0x11')]][_0xa3b8('0x12')])){_0x19a2fa=_[_0xa3b8('0x13')](_0x5489de[_0x163047[_0xa3b8('0x11')]][_0xa3b8('0x12')],_0xa3b8('0x14'));}else if(!_[_0xa3b8('0x10')](_0x163047[_0xa3b8('0x14')])){_0x19a2fa=[_0x163047['interval']];}return _0x19a2fa;}exports[_0xa3b8('0x15')]=function(_0x168841){_0x168841[_0xa3b8('0x16')]={};return new BPromise(function(_0x3da337,_0x135f51){var _0x5b6a68={'Start':function(_0x40c817){var _0x150f7a=this;return new Promise(function(_0x1c7708,_0x17daca){if(_0x40c817){try{var _0x43e949=[];var _0x2439e9=getId(_0x40c817[_0xa3b8('0x17')],_0x40c817[_0xa3b8('0x18')]?_0x40c817[_0xa3b8('0x18')]['id']:0x0,_0x40c817[_0xa3b8('0x19')]?_0x40c817[_0xa3b8('0x19')]['id']:0x0);var _0x271c98=sUtils['checkWaitingNotifications'](_0x168841,_0x40c817);if(!_0x271c98&&_0x40c817[_0xa3b8('0x1a')]&&_[_0xa3b8('0x1b')](_0x40c817[_0xa3b8('0x1a')])&&_0x40c817[_0xa3b8('0x1a')]['length']){for(var _0x579e23=0x0;_0x579e23<_0x40c817['applications']['length'];_0x579e23+=0x1){var _0x45357c=_0x40c817['applications'][_0x579e23];if(fs['existsSync'](path['join'](__dirname,_0xa3b8('0x1a'),_0x45357c[_0xa3b8('0x1c')]+_0xa3b8('0x1d')))){var _0x4951fd=[];switch(_0x45357c[_0xa3b8('0x1c')][_0xa3b8('0x1e')]()){case _0xa3b8('0x1f'):var _0x2719ef=_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');if(_0x40c817[_0xa3b8('0x17')]===_0xa3b8('0x22')){_0x4951fd[_0xa3b8('0x23')](_0x2719ef[0x0]);_0x4951fd[_0xa3b8('0x23')](_0x2719ef[0x1]);_0x4951fd[_0xa3b8('0x23')](_0x2719ef[_0xa3b8('0x24')](0x2,_0x2719ef[_0xa3b8('0x25')])[_0xa3b8('0x26')](','));}else{_0x4951fd[_0xa3b8('0x23')](_0x2719ef[0x0]);_0x4951fd['push'](_0x2719ef[_0xa3b8('0x24')](0x1,_0x2719ef[_0xa3b8('0x25')])['join'](','));}break;case'dialogflow':var _0x3dc03a=_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');_0x4951fd[_0xa3b8('0x23')](_0x3dc03a[0x0]);_0x4951fd[_0xa3b8('0x23')](_0x3dc03a[0x1]);_0x4951fd[_0xa3b8('0x23')](_0x3dc03a[_0xa3b8('0x24')](0x2,_0x3dc03a['length'])[_0xa3b8('0x26')](','));break;case _0xa3b8('0x27'):var _0x59f964=_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');_0x4951fd[_0xa3b8('0x23')](_0x59f964[0x0]);_0x4951fd['push'](_0x59f964[0x1]);_0x4951fd['push'](_0x59f964[0x2]);_0x4951fd[_0xa3b8('0x23')](_0x59f964[0x3]);_0x4951fd[_0xa3b8('0x23')](_0x59f964[_0xa3b8('0x24')](0x4,_0x59f964['length'])[_0xa3b8('0x26')](','));break;case'amazonlex':var _0x15d989=_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');_0x4951fd[_0xa3b8('0x23')](_0x15d989[0x0]);_0x4951fd[_0xa3b8('0x23')](_0x15d989[0x1]);_0x4951fd[_0xa3b8('0x23')](_0x15d989[0x2]);_0x4951fd[_0xa3b8('0x23')](_0x15d989[0x3]);_0x4951fd['push'](_0x15d989[_0xa3b8('0x24')](0x4,_0x15d989[_0xa3b8('0x25')])[_0xa3b8('0x26')](','));break;case'message':_0x4951fd[_0xa3b8('0x23')](_0x45357c[_0xa3b8('0x20')]);break;case _0xa3b8('0x28'):_0x4951fd[_0xa3b8('0x23')](_0x45357c[_0xa3b8('0x29')]);_0x4951fd[_0xa3b8('0x23')](_0x45357c[_0xa3b8('0x20')]);break;case _0xa3b8('0x2a'):var _0x2885ac=utils[_0xa3b8('0x2b')](_0x40c817[_0xa3b8('0x2c')]['notificationTemplate'],_0x40c817);var _0xb854f9=_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');_0x4951fd['push'](_0xb854f9[0x0]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x1]);_0x4951fd['push'](_0xb854f9[0x2]);_0x4951fd['push'](_0xb854f9[0x3]);_0x4951fd['push'](_0xb854f9[0x4]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x5]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x6]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x7]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x8]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0x9]);_0x4951fd[_0xa3b8('0x23')](_0xb854f9[0xa]);_0x4951fd['push'](_0x40c817[_0xa3b8('0x19')]['id']);_0x4951fd[_0xa3b8('0x23')](_0x40c817[_0xa3b8('0x18')]['id']);_0x4951fd[_0xa3b8('0x23')](_0x45357c['ChatWebsiteId']);_0x4951fd[_0xa3b8('0x23')](_0x40c817[_0xa3b8('0x19')][_0xa3b8('0x2d')]);_0x4951fd[_0xa3b8('0x23')](_0x40c817[_0xa3b8('0x2e')][_0xa3b8('0x2e')]);_0x4951fd[_0xa3b8('0x23')](_0x2885ac);break;default:_0x4951fd=_[_0xa3b8('0x10')](_0x45357c[_0xa3b8('0x20')])?[]:_0x45357c[_0xa3b8('0x20')][_0xa3b8('0x21')](',');}var _0x3918ce={'id':util[_0xa3b8('0xe')]('%s:%s:%s',_0x2439e9,_0x45357c['id'],_0x45357c['app']),'condition':require('./interval')['condition'](_0x2439e9,getIntervals(_0x168841[_0xa3b8('0x2f')],_0x45357c),_0x168841),'consequence':require('./applications/'+_0x45357c[_0xa3b8('0x1c')])[_0xa3b8('0x30')](_0x2439e9,_0x4951fd,_0x168841,_0x40c817),'p':_0x45357c[_0xa3b8('0x31')]||0x0};logger[_0xa3b8('0x32')](_0xa3b8('0x33'),_0x3918ce['id'],_0xa3b8('0x34'),getIntervals(_0x168841[_0xa3b8('0x2f')],_0x45357c)[_0xa3b8('0x26')](_0xa3b8('0x35')));_0x43e949[_0xa3b8('0x23')](_0x3918ce);}else{logger[_0xa3b8('0x36')](_0xa3b8('0x37'),path[_0xa3b8('0x26')](__dirname,_0xa3b8('0x1a'),_0x45357c[_0xa3b8('0x1c')]+'.js'));}}_0x168841[_0xa3b8('0x16')][_0x2439e9]=new RuleEngine(_0x43e949);_0x168841['rules'][_0x2439e9][_0xa3b8('0x38')](_0x40c817,function(_0x1d494d){logger[_0xa3b8('0x32')](_0xa3b8('0x39'),JSON[_0xa3b8('0x3a')](_0x1d494d[_0xa3b8('0x3b')]));if(_0x168841[_0xa3b8('0x16')][_0x2439e9]){_0x168841[_0xa3b8('0x16')][_0x2439e9]['emit']('complete');}});return _0x1c7708({'code':0xc8,'message':_0x40c817});}else{if(_0x271c98){logger['info'](util['format']('Skipped\x20routing\x20for\x20%s',_0x2439e9));}else{logger['info'](_0xa3b8('0x3c'));}return _0x1c7708({'code':0xc8,'message':_0x40c817});}}catch(_0x2e3f00){logger[_0xa3b8('0x36')](_0x2e3f00['stack']);return _0x17daca(_0x150f7a[_0xa3b8('0x36')](0x1f4,_0x2e3f00));}}return _0x17daca(_0xa3b8('0x3d'));});},'AcceptMessage':function(_0x17eb5e){var _0x460c5c=this;return new Promise(function(_0x1c019a,_0x6386c8){if(_0x17eb5e[_0xa3b8('0x3e')]&&_0x17eb5e[_0xa3b8('0x3e')]['id']){if(_0x168841[_0xa3b8('0x3f')][_0x17eb5e['agent']['id']]){_0x168841[_0xa3b8('0x3f')][_0x17eb5e[_0xa3b8('0x3e')]['id']][_0xa3b8('0x40')]=![];_0x168841[_0xa3b8('0x3f')][_0x17eb5e['agent']['id']][_0xa3b8('0x41')]=undefined;}}if(_0x17eb5e[_0xa3b8('0x18')]&&_0x17eb5e[_0xa3b8('0x18')]['id']){try{var _0x32e91e=getId(_0x17eb5e[_0xa3b8('0x17')],_0x17eb5e[_0xa3b8('0x18')]?_0x17eb5e[_0xa3b8('0x18')]['id']:0x0,_0x17eb5e[_0xa3b8('0x19')]?_0x17eb5e[_0xa3b8('0x19')]['id']:0x0);if(_0x168841[_0xa3b8('0x16')][_0x32e91e]){_0x168841[_0xa3b8('0x16')][_0x32e91e][_0xa3b8('0x42')]('end');if(rpc[_0x17eb5e['channel']+_0xa3b8('0x43')]){rpc[_0x17eb5e[_0xa3b8('0x17')]+_0xa3b8('0x43')][_0xa3b8('0x44')](_0x32e91e,{'UserId':_0x17eb5e[_0xa3b8('0x18')][_0xa3b8('0x45')]})['catch'](function(){logger[_0xa3b8('0x36')](_0xa3b8('0x46'));});}}return _0x1c019a({'code':0xc8,'message':_0x17eb5e});}catch(_0x514c55){logger['error'](_0x514c55[_0xa3b8('0x47')]);return _0x6386c8(_0x460c5c[_0xa3b8('0x36')](0x1f4,_0x514c55));}}logger[_0xa3b8('0x36')](_0xa3b8('0x48'));return _0x6386c8(_0x460c5c['error'](0x1f4,_0xa3b8('0x48')));});},'RejectMessage':function(_0x1173f1){var _0x311ef4=this;return new Promise(function(_0x2fa156,_0x5009a8){if(_0x1173f1[_0xa3b8('0x3e')]&&_0x1173f1[_0xa3b8('0x3e')]['id']){try{if(_0x168841[_0xa3b8('0x3f')][_0x1173f1[_0xa3b8('0x3e')]['id']]){_0x168841[_0xa3b8('0x3f')][_0x1173f1[_0xa3b8('0x3e')]['id']]['busy']=![];_0x168841[_0xa3b8('0x3f')][_0x1173f1[_0xa3b8('0x3e')]['id']][_0xa3b8('0x41')]=undefined;}return _0x2fa156({'code':0xc8,'message':_0x1173f1});}catch(_0xf31644){logger[_0xa3b8('0x36')](_0xf31644[_0xa3b8('0x47')]);return _0x5009a8(_0x311ef4[_0xa3b8('0x36')](0x1f4,_0xf31644));}}logger['error']('message\x20is\x20empty');return _0x5009a8(_0x311ef4['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2776f3){var _0x58c2c1=this;return new Promise(function(_0x16ccc4,_0x24f25f){if(_0x2776f3[_0xa3b8('0x17')]&&_0x2776f3[_0xa3b8('0x19')]&&_0x2776f3[_0xa3b8('0x19')]['id']){try{var _0x19a2b9=getId(_0x2776f3[_0xa3b8('0x17')],_0x2776f3[_0xa3b8('0x18')]?_0x2776f3[_0xa3b8('0x18')]['id']:0x0,_0x2776f3['interaction']?_0x2776f3[_0xa3b8('0x19')]['id']:0x0);if(_0x168841[_0xa3b8('0x16')][_0x19a2b9]){_0x168841['rules'][_0x19a2b9]['emit']('end');}return _0x16ccc4({'code':0xc8,'message':_0x2776f3});}catch(_0x4e8bae){logger['error'](_0x4e8bae[_0xa3b8('0x47')]);return _0x24f25f(_0x58c2c1[_0xa3b8('0x36')](0x1f4,_0x4e8bae));}}logger[_0xa3b8('0x36')](_0xa3b8('0x48'));return _0x24f25f(_0x58c2c1[_0xa3b8('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3188cb){var _0x51a8cb=this;return new Promise(function(_0x4a7cb1,_0x11cb84){if(_0x168841['agents'][_0xa3b8('0x49')](_0x3188cb['id'])){for(var _0x270a24 in _0x3188cb[_0xa3b8('0x4a')]){if(_0x3188cb['capacity']['hasOwnProperty'](_0x270a24)){if(_0x168841[_0xa3b8('0x3f')][_0x3188cb['id']][_0xa3b8('0x49')](_0x270a24+_0xa3b8('0x4b'))){_0x168841[_0xa3b8('0x3f')][_0x3188cb['id']][_0x270a24+_0xa3b8('0x4b')]=parseInt(_0x3188cb['capacity'][_0x270a24],0xa);}}}_0x168841[_0xa3b8('0x3f')][_0x3188cb['id']][_0xa3b8('0x4c')]();return _0x4a7cb1({'code':0xc8,'message':_0x168841[_0xa3b8('0x3f')][_0x3188cb['id']]});}else{return _0x11cb84(_0x51a8cb[_0xa3b8('0x36')](0x1f4,_0xa3b8('0x4d')));}});},'Agents':function(_0x5587f2){return new Promise(function(_0x4b38a3){var _0x763f5a=_[_0xa3b8('0x4e')](_0x168841[_0xa3b8('0x3f')]);if(_0x5587f2&&_0x5587f2['id']){var _0x52e803=_['find'](_0x763f5a,function(_0x5eeadb){return _0x5eeadb['id']===_0x5587f2['id'];});_0x4b38a3(_0x52e803);}else{_0x4b38a3({'count':_0x763f5a['length'],'rows':_0x763f5a});}});},'ChatQueues':function(){return new Promise(function(_0x35e058){var _0x3cf8eb=[];for(var _0x1be104 in _0x168841[_0xa3b8('0x4f')]){if(_0x168841[_0xa3b8('0x4f')]['hasOwnProperty'](_0x1be104)){var _0x17621f=_0x168841['chatQueues'][_0x1be104];var _0x2ca40b={'id':_0x17621f['id'],'available':_0x17621f[_0xa3b8('0x50')],'loggedIn':_0x17621f[_0xa3b8('0x51')],'name':_0x17621f[_0xa3b8('0x52')],'paused':_0x17621f[_0xa3b8('0x53')],'waiting':_0x17621f['waiting']};_0x3cf8eb[_0xa3b8('0x23')](_0x2ca40b);}}_0x35e058({'count':_0x3cf8eb[_0xa3b8('0x25')],'rows':_0x3cf8eb});});},'MailQueues':function(){return new Promise(function(_0x1c0b66){var _0xd1d35b=[];for(var _0x105950 in _0x168841['mailQueues']){if(_0x168841[_0xa3b8('0x54')][_0xa3b8('0x49')](_0x105950)){var _0x17624c=_0x168841[_0xa3b8('0x54')][_0x105950];var _0x5a00ce={'id':_0x17624c['id'],'available':_0x17624c['available'],'loggedIn':_0x17624c[_0xa3b8('0x51')],'name':_0x17624c[_0xa3b8('0x52')],'paused':_0x17624c[_0xa3b8('0x53')],'waiting':_0x17624c[_0xa3b8('0x55')]};_0xd1d35b['push'](_0x5a00ce);}}_0x1c0b66({'count':_0xd1d35b['length'],'rows':_0xd1d35b});});},'OpenchannelQueues':function(){return new Promise(function(_0x9ad0e4){var _0x2201aa=[];for(var _0x434e28 in _0x168841[_0xa3b8('0x56')]){if(_0x168841[_0xa3b8('0x56')][_0xa3b8('0x49')](_0x434e28)){var _0x46c199=_0x168841[_0xa3b8('0x56')][_0x434e28];var _0x45e24b={'id':_0x46c199['id'],'available':_0x46c199[_0xa3b8('0x50')],'loggedIn':_0x46c199[_0xa3b8('0x51')],'name':_0x46c199[_0xa3b8('0x52')],'paused':_0x46c199[_0xa3b8('0x53')],'waiting':_0x46c199[_0xa3b8('0x55')]};_0x2201aa[_0xa3b8('0x23')](_0x45e24b);}}_0x9ad0e4({'count':_0x2201aa[_0xa3b8('0x25')],'rows':_0x2201aa});});},'SmsQueues':function(){return new Promise(function(_0x27835f){var _0x53279a=[];for(var _0x158dc8 in _0x168841[_0xa3b8('0x57')]){if(_0x168841[_0xa3b8('0x57')][_0xa3b8('0x49')](_0x158dc8)){var _0x459c44=_0x168841[_0xa3b8('0x57')][_0x158dc8];var _0x2e9069={'id':_0x459c44['id'],'available':_0x459c44[_0xa3b8('0x50')],'loggedIn':_0x459c44['loggedIn'],'name':_0x459c44[_0xa3b8('0x52')],'paused':_0x459c44[_0xa3b8('0x53')],'waiting':_0x459c44[_0xa3b8('0x55')]};_0x53279a[_0xa3b8('0x23')](_0x2e9069);}}_0x27835f({'count':_0x53279a[_0xa3b8('0x25')],'rows':_0x53279a});});},'FaxQueues':function(){return new Promise(function(_0x288cb9){var _0x3dd5d8=[];for(var _0x2e946c in _0x168841[_0xa3b8('0x58')]){if(_0x168841[_0xa3b8('0x58')][_0xa3b8('0x49')](_0x2e946c)){var _0x5d542e=_0x168841[_0xa3b8('0x58')][_0x2e946c];var _0x42045b={'id':_0x5d542e['id'],'available':_0x5d542e[_0xa3b8('0x50')],'loggedIn':_0x5d542e[_0xa3b8('0x51')],'name':_0x5d542e[_0xa3b8('0x52')],'paused':_0x5d542e[_0xa3b8('0x53')],'waiting':_0x5d542e[_0xa3b8('0x55')]};_0x3dd5d8[_0xa3b8('0x23')](_0x42045b);}}_0x288cb9({'count':_0x3dd5d8[_0xa3b8('0x25')],'rows':_0x3dd5d8});});},'WhatsappQueues':function(){return new Promise(function(_0x4fe46f){var _0x42b262=[];for(var _0x458b31 in _0x168841[_0xa3b8('0x59')]){if(_0x168841['whatsappQueues']['hasOwnProperty'](_0x458b31)){var _0x59fe95=_0x168841[_0xa3b8('0x59')][_0x458b31];var _0xb9351f={'id':_0x59fe95['id'],'available':_0x59fe95[_0xa3b8('0x50')],'loggedIn':_0x59fe95['loggedIn'],'name':_0x59fe95['name'],'paused':_0x59fe95[_0xa3b8('0x53')],'waiting':_0x59fe95[_0xa3b8('0x55')]};_0x42b262[_0xa3b8('0x23')](_0xb9351f);}}_0x4fe46f({'count':_0x42b262[_0xa3b8('0x25')],'rows':_0x42b262});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4384a2){var _0x4a72ad=_[_0xa3b8('0x4e')](_0x168841[_0xa3b8('0x5a')]);_0x4384a2({'count':_0x4a72ad[_0xa3b8('0x25')],'rows':_0x4a72ad});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x41fc78){var _0x21a5b6=_[_0xa3b8('0x4e')](_0x168841[_0xa3b8('0x5b')]);_0x41fc78({'count':_0x21a5b6[_0xa3b8('0x25')],'rows':_0x21a5b6});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2e99c3){var _0x38e22d=_['values'](_0x168841[_0xa3b8('0x5c')]);_0x2e99c3({'count':_0x38e22d[_0xa3b8('0x25')],'rows':_0x38e22d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xd20797){var _0xf0fd1f=_[_0xa3b8('0x4e')](_0x168841['smsQueuesWaitingInteractions']);_0xd20797({'count':_0xf0fd1f[_0xa3b8('0x25')],'rows':_0xf0fd1f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2c344b){var _0x31f348=_['values'](_0x168841[_0xa3b8('0x5d')]);_0x2c344b({'count':_0x31f348[_0xa3b8('0x25')],'rows':_0x31f348});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xf66d46){var _0x2206e8=_[_0xa3b8('0x4e')](_0x168841[_0xa3b8('0x5e')]);_0xf66d46({'count':_0x2206e8['length'],'rows':_0x2206e8});});}};var _0x3b45fb=jayson['server'](_0x5b6a68)[_0xa3b8('0x5f')]();_0x3b45fb['on'](_0xa3b8('0x36'),function(_0x2a9ca2){logger[_0xa3b8('0x36')](JSON[_0xa3b8('0x3a')](_0x2a9ca2));return _0x135f51(_0x2a9ca2);});_0x3b45fb[_0xa3b8('0x15')](0x232c,_0xa3b8('0x60'),function(){console[_0xa3b8('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3da337(_0xa3b8('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7d639a4..6900c87 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 _0x6ef5=['jayson/promise','lodash','routing','client','http','request','then','error','message','rules','info','stop','Command','format','iftime\x20%s','indexOf','true','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x6ef5,0xcf));var _0x56ef=function(_0x369be5,_0x33bd84){_0x369be5=_0x369be5-0x0;var _0x1c608a=_0x6ef5[_0x369be5];return _0x1c608a;};'use strict';var util=require(_0x56ef('0x0'));var BPromise=require('bluebird');var jayson=require(_0x56ef('0x1'));var _=require(_0x56ef('0x2'));var logger=require('../../../config/logger')(_0x56ef('0x3'));var client=jayson[_0x56ef('0x4')][_0x56ef('0x5')]({'port':0x232a});function request(_0x1d31cc,_0x794bb5){return new BPromise(function(_0x567ffa,_0x52d303){return client[_0x56ef('0x6')](_0x1d31cc,_0x794bb5)[_0x56ef('0x7')](function(_0x360cf2){if(_0x360cf2[_0x56ef('0x8')]){return _0x52d303(_0x360cf2[_0x56ef('0x8')][_0x56ef('0x9')]);}else{return _0x567ffa(_0x360cf2['result']);}})['catch'](function(_0x198ee5){return _0x52d303(_0x198ee5);});});}exports['condition']=function(_0x1fe69f,_0x548bf8,_0x5f60e3){return function(_0x2b8f43){if(_0x5f60e3[_0x56ef('0xa')]&&!_0x5f60e3[_0x56ef('0xa')][_0x1fe69f]){logger[_0x56ef('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1fe69f);return _0x2b8f43[_0x56ef('0xc')]();}var _0x2fffa3=[];for(var _0x6ace33=0x0;_0x6ace33<_0x548bf8['length'];_0x6ace33+=0x1){_0x2fffa3['push'](request(_0x56ef('0xd'),{'command':util[_0x56ef('0xe')](_0x56ef('0xf'),_0x548bf8[_0x6ace33])})['then'](function(_0xc500b8){return _0xc500b8&&_0xc500b8[_0x56ef('0x9')]&&_0xc500b8[_0x56ef('0x9')][_0x56ef('0x10')](_0x56ef('0x11'))>=0x0?!![]:![];})[_0x56ef('0x12')](function(_0x81419f){logger[_0x56ef('0x8')]('[%s][INTERVAL]\x20%s',_0x1fe69f,_0x548bf8[_0x6ace33]);}));}BPromise[_0x56ef('0x13')](_0x2fffa3)[_0x56ef('0x7')](function(_0xb27cf6){var _0xc21cea=_[_0x56ef('0x14')](_0xb27cf6);logger[_0x56ef('0xb')](_0x56ef('0x15'),_0x1fe69f,_0x548bf8[_0x56ef('0x16')](_0x56ef('0x17')),_0xc21cea);_0x2b8f43[_0x56ef('0x18')](_0xc21cea);})['catch'](function(_0x452b33){console[_0x56ef('0x19')](_0x452b33);logger['error'](_0x56ef('0x15'),_0x1fe69f,_0x548bf8[_0x56ef('0x16')]('\x20|\x20'),_0x452b33['stack']);_0x2b8f43[_0x56ef('0xc')]();});};}; \ No newline at end of file +var _0xf8c4=['stop','length','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','then','error','result','catch','rules'];(function(_0x41a073,_0x3ea9e2){var _0x4b2c53=function(_0xa609ae){while(--_0xa609ae){_0x41a073['push'](_0x41a073['shift']());}};_0x4b2c53(++_0x3ea9e2);}(_0xf8c4,0x120));var _0x4f8c=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0xf8c4[_0x46f3f8];return _0xbc57cd;};'use strict';var util=require(_0x4f8c('0x0'));var BPromise=require(_0x4f8c('0x1'));var jayson=require(_0x4f8c('0x2'));var _=require(_0x4f8c('0x3'));var logger=require(_0x4f8c('0x4'))(_0x4f8c('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x2b4e87,_0x1fbe3c){return new BPromise(function(_0x116413,_0x389dbf){return client[_0x4f8c('0x6')](_0x2b4e87,_0x1fbe3c)[_0x4f8c('0x7')](function(_0x2688c3){if(_0x2688c3[_0x4f8c('0x8')]){return _0x389dbf(_0x2688c3[_0x4f8c('0x8')]['message']);}else{return _0x116413(_0x2688c3[_0x4f8c('0x9')]);}})[_0x4f8c('0xa')](function(_0x450295){return _0x389dbf(_0x450295);});});}exports['condition']=function(_0xad2544,_0x230972,_0x5c76ab){return function(_0x43c87a){if(_0x5c76ab[_0x4f8c('0xb')]&&!_0x5c76ab[_0x4f8c('0xb')][_0xad2544]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xad2544);return _0x43c87a[_0x4f8c('0xc')]();}var _0x2ff3cb=[];for(var _0x5e61aa=0x0;_0x5e61aa<_0x230972[_0x4f8c('0xd')];_0x5e61aa+=0x1){_0x2ff3cb[_0x4f8c('0xe')](request(_0x4f8c('0xf'),{'command':util['format'](_0x4f8c('0x10'),_0x230972[_0x5e61aa])})[_0x4f8c('0x7')](function(_0x45ba72){return _0x45ba72&&_0x45ba72[_0x4f8c('0x11')]&&_0x45ba72[_0x4f8c('0x11')][_0x4f8c('0x12')](_0x4f8c('0x13'))>=0x0?!![]:![];})[_0x4f8c('0xa')](function(_0x31c321){logger[_0x4f8c('0x8')](_0x4f8c('0x14'),_0xad2544,_0x230972[_0x5e61aa]);}));}BPromise[_0x4f8c('0x15')](_0x2ff3cb)[_0x4f8c('0x7')](function(_0x23a2ef){var _0x536574=_[_0x4f8c('0x16')](_0x23a2ef);logger[_0x4f8c('0x17')](_0x4f8c('0x18'),_0xad2544,_0x230972[_0x4f8c('0x19')](_0x4f8c('0x1a')),_0x536574);_0x43c87a[_0x4f8c('0x1b')](_0x536574);})[_0x4f8c('0xa')](function(_0x22508e){console[_0x4f8c('0x1c')](_0x22508e);logger[_0x4f8c('0x8')](_0x4f8c('0x18'),_0xad2544,_0x230972[_0x4f8c('0x19')](_0x4f8c('0x1a')),_0x22508e[_0x4f8c('0x1d')]);_0x43c87a[_0x4f8c('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 39ed25c..b99d052 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 _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x9fe800,_0x3b6171){var _0x50cafc=function(_0x4d74b6){while(--_0x4d74b6){_0x9fe800['push'](_0x9fe800['shift']());}};_0x50cafc(++_0x3b6171);}(_0xe706,0xa3));var _0x6e70=function(_0x5d949e,_0x555707){_0x5d949e=_0x5d949e-0x0;var _0x445c1e=_0xe706[_0x5d949e];return _0x445c1e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file +var _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x24c553,_0x49c4a5){var _0x1c7a6c=function(_0x567409){while(--_0x567409){_0x24c553['push'](_0x24c553['shift']());}};_0x1c7a6c(++_0x49c4a5);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb9a7[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 197ffcc..04ad743 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 _0xa899=['lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','lastevent','accountcode','UserId','CreateVoiceCallReport','request','blinds','recording','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue'];(function(_0x599c3e,_0x3c1970){var _0x3bd178=function(_0x1ccfb0){while(--_0x1ccfb0){_0x599c3e['push'](_0x599c3e['shift']());}};_0x3bd178(++_0x3c1970);}(_0xa899,0x155));var _0x9a89=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xa899[_0x879e31];return _0x3467e8;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var utils=require(_0x9a89('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x9a89('0x3'),_0x9a89('0x4'),_0x9a89('0x4'),_0x9a89('0x3'),_0x9a89('0x3'),_0x9a89('0x3'),_0x9a89('0x5'),_0x9a89('0x6'),_0x9a89('0x4'),_0x9a89('0x4'),_0x9a89('0x4')];var channels={};function writeDB(_0x995cf7){var _0x5e5454;if(transfers['blinds'][_0x995cf7['uniqueid']]){_0x5e5454=_0x995cf7[_0x9a89('0x7')];_0x995cf7[_0x9a89('0x7')]=transfers['blinds'][_0x995cf7[_0x9a89('0x7')]]['transfereeuniqueid'];}utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0xa'),_0x995cf7[_0x9a89('0x7')],_0x995cf7[_0x9a89('0xb')],_0x995cf7[_0x9a89('0xc')],_0x995cf7[_0x9a89('0xd')],_0x995cf7['interface'],_0x995cf7['calleridnum'],_0x995cf7[_0x9a89('0xe')],_0x995cf7[_0x9a89('0xf')]));if(_0x995cf7[_0x9a89('0x10')]){utils['getUserByInternal'](_0x995cf7['accountcode'])['then'](function(_0x1c66a3){if(_0x1c66a3){_0x995cf7[_0x9a89('0x11')]=_0x1c66a3['id'];}utils['request'](_0x9a89('0x12'),_0x995cf7);});}else{utils[_0x9a89('0x13')](_0x9a89('0x12'),_0x995cf7);}if(channels[_0x995cf7[_0x9a89('0x7')]]){delete channels[_0x995cf7['uniqueid']];}else if(_0x5e5454&&channels[_0x5e5454]){if(!transfers[_0x9a89('0x14')][_0x5e5454][_0x9a89('0x15')])delete transfers['blinds'][_0x5e5454];delete channels[_0x5e5454];}}exports['newchannel']=function(_0x35221f){try{utils['debug'](util[_0x9a89('0x9')](_0x9a89('0x16'),_0x35221f['uniqueid']),_0x35221f);if(_0x35221f[_0x9a89('0x7')]==_0x35221f['linkedid']&&_0x35221f[_0x9a89('0xb')]!=_0x9a89('0x17')){utils['info'](util[_0x9a89('0x9')](_0x9a89('0x18'),_0x35221f[_0x9a89('0x7')],_0x35221f[_0x9a89('0x19')],_0x35221f[_0x9a89('0x1a')]));channels[_0x35221f[_0x9a89('0x7')]]={'uniqueid':_0x35221f[_0x9a89('0x7')],'accountcode':_0x35221f[_0x9a89('0x10')],'source':_0x35221f['calleridnum'],'destination':_0x35221f['exten'],'destinationcontext':_0x35221f[_0x9a89('0x19')],'channel':_0x35221f[_0x9a89('0xb')],'starttime':utils[_0x9a89('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9a89('0x3'),'amaflags':_0x9a89('0x1c')};}}catch(_0x3cc288){utils['error'](util['format'](_0x9a89('0x16'),_0x35221f['uniqueid']),_0x3cc288);}};exports[_0x9a89('0x1d')]=function(_0x2cca01){try{utils[_0x9a89('0x1e')](util[_0x9a89('0x9')](_0x9a89('0x1f'),_0x2cca01[_0x9a89('0x7')]),_0x2cca01);if(!_[_0x9a89('0x20')](channels[_0x2cca01['uniqueid']])&&_0x2cca01[_0x9a89('0x21')]==0x6){utils['info'](util[_0x9a89('0x9')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2cca01['uniqueid'],_0x2cca01[_0x9a89('0x19')],_0x2cca01[_0x9a89('0xb')]));if(_['isNil'](channels[_0x2cca01[_0x9a89('0x7')]]['systemanswertime'])){channels[_0x2cca01[_0x9a89('0x7')]][_0x9a89('0x22')]=utils[_0x9a89('0x1b')]();}}else if(!_[_0x9a89('0x20')](channels[_0x2cca01[_0x9a89('0x23')]])&&_0x2cca01[_0x9a89('0x21')]==0x6&&_0x2cca01[_0x9a89('0x19')]!='transfer'){utils['info'](util['format'](_0x9a89('0x24'),_0x2cca01['uniqueid'],_0x2cca01[_0x9a89('0x23')],_0x2cca01[_0x9a89('0x19')],_0x2cca01[_0x9a89('0xb')]));channels[_0x2cca01['linkedid']][_0x9a89('0x10')]=_0x2cca01['accountcode'];channels[_0x2cca01[_0x9a89('0x23')]][_0x9a89('0x25')]=_0x2cca01[_0x9a89('0xb')];if(_[_0x9a89('0x20')](channels[_0x2cca01[_0x9a89('0x23')]]['answertime'])){channels[_0x2cca01[_0x9a89('0x23')]][_0x9a89('0x26')]=utils[_0x9a89('0x1b')]();}channels[_0x2cca01[_0x9a89('0x23')]][_0x9a89('0x27')]=dispositions[_[_0x9a89('0x28')](_0x2cca01[_0x9a89('0x21')])]||_0x9a89('0x5');}}catch(_0x330f2c){utils['error'](util[_0x9a89('0x9')](_0x9a89('0x1f'),_0x2cca01[_0x9a89('0x7')]),_0x330f2c);}};exports[_0x9a89('0x29')]=function(_0x36b137){try{if(!_[_0x9a89('0x20')](channels[_0x36b137[_0x9a89('0x7')]])){utils[_0x9a89('0x1e')](util[_0x9a89('0x9')](_0x9a89('0x2a'),_0x36b137['uniqueid']),_0x36b137);if(_[_0x9a89('0x20')](channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x2b')])){channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x2b')]=_0x36b137[_0x9a89('0x2c')]+'\x20<'+_0x36b137[_0x9a89('0x2d')]+'>';}utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x2e'),_0x36b137[_0x9a89('0x7')],channels[_0x36b137[_0x9a89('0x7')]]['callerid'],_0x36b137[_0x9a89('0x2f')]));channels[_0x36b137['uniqueid']][_0x9a89('0x30')]=utils[_0x9a89('0x1b')]();channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x31')]=utils[_0x9a89('0x32')](channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x30')],channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x33')]);channels[_0x36b137['uniqueid']][_0x9a89('0x34')]=channels[_0x36b137[_0x9a89('0x7')]][_0x9a89('0x26')]?utils[_0x9a89('0x32')](channels[_0x36b137['uniqueid']]['endtime'],channels[_0x36b137[_0x9a89('0x7')]]['answertime']):0x0;writeDB(channels[_0x36b137[_0x9a89('0x7')]]);}}catch(_0x2f5a78){utils[_0x9a89('0x35')](util[_0x9a89('0x9')](_0x9a89('0x2a'),_0x36b137[_0x9a89('0x7')]),_0x2f5a78);}};exports[_0x9a89('0x36')]=function(_0x23974a){try{if(!_['isNil'](channels[_0x23974a['localtwolinkedid']])){utils['debug'](util[_0x9a89('0x9')]('[%s][calls][attendedtransfer]',_0x23974a['origtransfereruniqueid']),_0x23974a);if(channels[_0x23974a[_0x9a89('0x37')]][_0x9a89('0xb')]==_0x23974a[_0x9a89('0x38')]){utils['info'](util[_0x9a89('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x23974a[_0x9a89('0x39')],_0x23974a['localtwolinkedid'],_0x23974a[_0x9a89('0x3a')]));channels[_0x23974a[_0x9a89('0x37')]][_0x9a89('0x25')]=_0x23974a['secondtransfererchannel'];channels[_0x23974a[_0x9a89('0x37')]][_0x9a89('0x3b')]=_0x9a89('0x3c');}else if(channels[_0x23974a['localtwolinkedid']]['channel']=_0x23974a[_0x9a89('0x3d')]){utils['info'](util[_0x9a89('0x9')](_0x9a89('0x3e'),_0x23974a['origtransfereruniqueid'],_0x23974a[_0x9a89('0x37')],_0x23974a[_0x9a89('0x3f')]));channels[_0x23974a['localtwolinkedid']]['destinationchannel']=_0x23974a[_0x9a89('0x3f')];channels[_0x23974a[_0x9a89('0x37')]]['userfield']=_0x9a89('0x3c');}}}catch(_0x483c02){utils[_0x9a89('0x35')](util[_0x9a89('0x9')](_0x9a89('0x40'),_0x23974a[_0x9a89('0x39')]),_0x483c02);}};exports[_0x9a89('0x41')]=function(_0x4f9b7b){try{if(!_[_0x9a89('0x20')](channels[_0x4f9b7b['uniqueid']])){utils[_0x9a89('0x1e')](util[_0x9a89('0x9')]('[%s][calls][musiconholdstart]',_0x4f9b7b[_0x9a89('0x7')]),_0x4f9b7b);channels[_0x4f9b7b[_0x9a89('0x7')]][_0x9a89('0x42')]=utils[_0x9a89('0x1b')]();utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x43'),_0x4f9b7b[_0x9a89('0x7')],channels[_0x4f9b7b[_0x9a89('0x7')]][_0x9a89('0x42')]));}}catch(_0x293fb5){utils['error'](util[_0x9a89('0x9')](_0x9a89('0x44'),_0x4f9b7b[_0x9a89('0x7')]),_0x293fb5);}};exports['musiconholdstop']=function(_0x2f20c9){try{if(!_[_0x9a89('0x20')](channels[_0x2f20c9['uniqueid']])){utils['debug'](util[_0x9a89('0x9')](_0x9a89('0x45'),_0x2f20c9[_0x9a89('0x7')]),_0x2f20c9);if(!_['isNil'](channels[_0x2f20c9[_0x9a89('0x7')]][_0x9a89('0x42')])){channels[_0x2f20c9[_0x9a89('0x7')]]['mohtime']+=utils[_0x9a89('0x32')](utils['now'](),channels[_0x2f20c9[_0x9a89('0x7')]]['musiconholdstartAt']);utils['info'](util[_0x9a89('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2f20c9['uniqueid'],channels[_0x2f20c9['uniqueid']]['mohtime']));delete channels[_0x2f20c9['uniqueid']]['musiconholdstartAt'];}}}catch(_0x348925){utils['error'](util[_0x9a89('0x9')](_0x9a89('0x45'),_0x2f20c9['uniqueid']),_0x348925);}};exports[_0x9a89('0x46')]=function(_0x5c7215){try{if(!_['isNil'](channels[_0x5c7215[_0x9a89('0x7')]])){utils[_0x9a89('0x1e')](util[_0x9a89('0x9')](_0x9a89('0x47'),_0x5c7215['uniqueid']),_0x5c7215);if(!_[_0x9a89('0x20')](_0x5c7215['variable'][_0x9a89('0x48')])){utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x49'),_0x5c7215[_0x9a89('0x7')],_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0x4b')]=_0x5c7215[_0x9a89('0x4a')];}if(!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')]['xmd-phone'])){utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x4d'),_0x5c7215[_0x9a89('0x7')],_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215['uniqueid']]['destination']=_0x5c7215[_0x9a89('0x4a')];channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0x2b')]='\x22'+_0x5c7215['value']+'\x22\x20<'+_0x5c7215['value']+'>';}if(!_['isNil'](_0x5c7215['variable'][_0x9a89('0x4e')])||!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')]['xmd-callerid'])){utils['info'](util[_0x9a89('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5c7215['uniqueid'],!_[_0x9a89('0x20')](_0x5c7215['variable'][_0x9a89('0x4e')])?_0x9a89('0x4e'):'xmd-callerid',_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215[_0x9a89('0x7')]]['callerid']=_0x5c7215[_0x9a89('0x4a')];}if(!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')]['xmd-queue'])||!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')]['xmcs-queue'])){utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x4f'),_0x5c7215['uniqueid'],!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')][_0x9a89('0x50')])?_0x9a89('0x50'):'xmcs-queue',_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215['uniqueid']][_0x9a89('0x51')]=_0x9a89('0x52');channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0x53')]=_0x5c7215[_0x9a89('0x4a')];channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0xc')]=!![];}if(!_[_0x9a89('0x20')](_0x5c7215['variable']['xmd-contactid'])){utils[_0x9a89('0x8')](util['format'](_0x9a89('0x54'),_0x5c7215[_0x9a89('0x7')],_0x5c7215['value']));channels[_0x5c7215['uniqueid']][_0x9a89('0x55')]=_0x5c7215[_0x9a89('0x4a')];}if(!_[_0x9a89('0x20')](_0x5c7215[_0x9a89('0x4c')][_0x9a89('0x56')])){utils[_0x9a89('0x8')](util[_0x9a89('0x9')](_0x9a89('0x57'),_0x5c7215[_0x9a89('0x7')],_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215['uniqueid']][_0x9a89('0x58')]=_0x5c7215[_0x9a89('0x4a')];}if(!_['isNil'](_0x5c7215[_0x9a89('0x4c')]['outboundrouteid'])){utils['info'](util[_0x9a89('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5c7215[_0x9a89('0x7')],_0x5c7215[_0x9a89('0x4a')]));channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0x59')]=_0x5c7215[_0x9a89('0x4a')];}if(!_['isNil'](_0x5c7215['variable'][_0x9a89('0x5a')])){utils['info'](util[_0x9a89('0x9')](_0x9a89('0x5b'),_0x5c7215[_0x9a89('0x7')],_0x5c7215['value']));channels[_0x5c7215[_0x9a89('0x7')]][_0x9a89('0x5a')]=_0x5c7215[_0x9a89('0x4a')];}}}catch(_0x461445){utils['error'](util[_0x9a89('0x9')](_0x9a89('0x47'),_0x5c7215[_0x9a89('0x7')]),_0x461445);}};exports[_0x9a89('0x5c')]=function(_0x56c375){try{if(!_[_0x9a89('0x20')](channels[_0x56c375[_0x9a89('0x7')]])){utils[_0x9a89('0x1e')](util[_0x9a89('0x9')](_0x9a89('0x5d'),_0x56c375[_0x9a89('0x7')]),_0x56c375);utils['info'](util[_0x9a89('0x9')](_0x9a89('0x5e'),_0x56c375['uniqueid'],_0x56c375[_0x9a89('0x5f')],_0x56c375[_0x9a89('0x60')]));if(_0x56c375[_0x9a89('0x5f')][_0x9a89('0x61')]()==_0x9a89('0x62')&&_[_0x9a89('0x63')](_0x56c375[_0x9a89('0x60')][_0x9a89('0x61')](),'cdr')){var _0x2474f0=_0x56c375[_0x9a89('0x60')][_0x9a89('0x64')]('=');var _0x1a3959=_0x2474f0[0x0][_0x9a89('0x65')](_0x2474f0[0x0][_0x9a89('0x66')]('(')+0x1,_0x2474f0[0x0]['lastIndexOf'](')'));var _0x50ade8=_0x2474f0[0x1];channels[_0x56c375['uniqueid']][_0x1a3959]=_0x50ade8;}if(!_['includes'](['hangup',_0x9a89('0x67'),_0x9a89('0x68'),_0x9a89('0x62'),_0x9a89('0x69')],_0x56c375[_0x9a89('0x5f')][_0x9a89('0x61')]())){channels[_0x56c375[_0x9a89('0x7')]]['lastapplication']=_0x56c375[_0x9a89('0x5f')];channels[_0x56c375[_0x9a89('0x7')]]['lastdata']=_0x56c375['appdata'];}}}catch(_0x35b864){utils[_0x9a89('0x35')](util[_0x9a89('0x9')](_0x9a89('0x5d'),_0x56c375[_0x9a89('0x7')]),_0x35b864);}}; \ No newline at end of file +var _0x9402=['xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','accountcode','request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<'];(function(_0x1e0da3,_0x3ac2f5){var _0x3b2330=function(_0x3056df){while(--_0x3056df){_0x1e0da3['push'](_0x1e0da3['shift']());}};_0x3b2330(++_0x3ac2f5);}(_0x9402,0x85));var _0x2940=function(_0x48cdab,_0x1d82bd){_0x48cdab=_0x48cdab-0x0;var _0x52afb6=_0x9402[_0x48cdab];return _0x52afb6;};'use strict';var _=require(_0x2940('0x0'));var util=require(_0x2940('0x1'));var utils=require(_0x2940('0x2'));var transfers=require(_0x2940('0x3'));var dispositions=[_0x2940('0x4'),'FAILED',_0x2940('0x5'),_0x2940('0x4'),_0x2940('0x4'),_0x2940('0x4'),'ANSWERED',_0x2940('0x6'),_0x2940('0x5'),_0x2940('0x5'),'FAILED'];var channels={};function writeDB(_0x6a584e){var _0x110f49;if(transfers[_0x2940('0x7')][_0x6a584e[_0x2940('0x8')]]){_0x110f49=_0x6a584e[_0x2940('0x8')];_0x6a584e['uniqueid']=transfers['blinds'][_0x6a584e['uniqueid']]['transfereeuniqueid'];}utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0xb'),_0x6a584e[_0x2940('0x8')],_0x6a584e[_0x2940('0xc')],_0x6a584e[_0x2940('0xd')],_0x6a584e[_0x2940('0xe')],_0x6a584e[_0x2940('0xf')],_0x6a584e[_0x2940('0x10')],_0x6a584e['connectedlinenum'],_0x6a584e[_0x2940('0x11')]));if(_0x6a584e['accountcode']){utils['getUserByInternal'](_0x6a584e[_0x2940('0x12')])['then'](function(_0x285880){if(_0x285880){_0x6a584e['UserId']=_0x285880['id'];}utils[_0x2940('0x13')](_0x2940('0x14'),_0x6a584e);});}else{utils['request'](_0x2940('0x14'),_0x6a584e);}if(channels[_0x6a584e[_0x2940('0x8')]]){delete channels[_0x6a584e[_0x2940('0x8')]];}else if(_0x110f49&&channels[_0x110f49]){if(!transfers[_0x2940('0x7')][_0x110f49][_0x2940('0x15')])delete transfers[_0x2940('0x7')][_0x110f49];delete channels[_0x110f49];}}exports['newchannel']=function(_0x381631){try{utils['debug'](util['format'](_0x2940('0x16'),_0x381631[_0x2940('0x8')]),_0x381631);if(_0x381631[_0x2940('0x8')]==_0x381631[_0x2940('0x17')]&&_0x381631['channel']!=_0x2940('0x18')){utils['info'](util[_0x2940('0xa')](_0x2940('0x19'),_0x381631[_0x2940('0x8')],_0x381631[_0x2940('0x1a')],_0x381631[_0x2940('0x1b')]));channels[_0x381631[_0x2940('0x8')]]={'uniqueid':_0x381631['uniqueid'],'accountcode':_0x381631[_0x2940('0x12')],'source':_0x381631[_0x2940('0x10')],'destination':_0x381631[_0x2940('0x1b')],'destinationcontext':_0x381631['context'],'channel':_0x381631[_0x2940('0xc')],'starttime':utils[_0x2940('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2940('0x1d')};}}catch(_0x4ca2e2){utils['error'](util[_0x2940('0xa')](_0x2940('0x16'),_0x381631[_0x2940('0x8')]),_0x4ca2e2);}};exports[_0x2940('0x1e')]=function(_0x3e0e7c){try{utils[_0x2940('0x1f')](util['format'](_0x2940('0x20'),_0x3e0e7c[_0x2940('0x8')]),_0x3e0e7c);if(!_[_0x2940('0x21')](channels[_0x3e0e7c[_0x2940('0x8')]])&&_0x3e0e7c[_0x2940('0x22')]==0x6){utils[_0x2940('0x9')](util[_0x2940('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3e0e7c[_0x2940('0x8')],_0x3e0e7c[_0x2940('0x1a')],_0x3e0e7c[_0x2940('0xc')]));if(_[_0x2940('0x21')](channels[_0x3e0e7c[_0x2940('0x8')]][_0x2940('0x23')])){channels[_0x3e0e7c['uniqueid']][_0x2940('0x23')]=utils[_0x2940('0x1c')]();}}else if(!_[_0x2940('0x21')](channels[_0x3e0e7c[_0x2940('0x17')]])&&_0x3e0e7c['channelstate']==0x6&&_0x3e0e7c[_0x2940('0x1a')]!='transfer'){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x24'),_0x3e0e7c[_0x2940('0x8')],_0x3e0e7c['linkedid'],_0x3e0e7c[_0x2940('0x1a')],_0x3e0e7c['channel']));channels[_0x3e0e7c[_0x2940('0x17')]][_0x2940('0x12')]=_0x3e0e7c[_0x2940('0x12')];channels[_0x3e0e7c['linkedid']][_0x2940('0x25')]=_0x3e0e7c[_0x2940('0xc')];if(_[_0x2940('0x21')](channels[_0x3e0e7c['linkedid']][_0x2940('0x26')])){channels[_0x3e0e7c[_0x2940('0x17')]]['answertime']=utils[_0x2940('0x1c')]();}channels[_0x3e0e7c[_0x2940('0x17')]][_0x2940('0x27')]=dispositions[_[_0x2940('0x28')](_0x3e0e7c[_0x2940('0x22')])]||'ANSWERED';}}catch(_0x391aa4){utils[_0x2940('0x29')](util[_0x2940('0xa')](_0x2940('0x20'),_0x3e0e7c[_0x2940('0x8')]),_0x391aa4);}};exports[_0x2940('0x2a')]=function(_0x434862){try{if(!_['isNil'](channels[_0x434862['uniqueid']])){utils[_0x2940('0x1f')](util[_0x2940('0xa')](_0x2940('0x2b'),_0x434862[_0x2940('0x8')]),_0x434862);if(_[_0x2940('0x21')](channels[_0x434862['uniqueid']][_0x2940('0x2c')])){channels[_0x434862['uniqueid']][_0x2940('0x2c')]=_0x434862[_0x2940('0x2d')]+'\x20<'+_0x434862[_0x2940('0x10')]+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x434862[_0x2940('0x8')],channels[_0x434862[_0x2940('0x8')]]['callerid'],_0x434862[_0x2940('0x2e')]));channels[_0x434862[_0x2940('0x8')]]['endtime']=utils['now']();channels[_0x434862[_0x2940('0x8')]]['duration']=utils[_0x2940('0x2f')](channels[_0x434862[_0x2940('0x8')]][_0x2940('0x30')],channels[_0x434862[_0x2940('0x8')]][_0x2940('0x31')]);channels[_0x434862[_0x2940('0x8')]]['billableseconds']=channels[_0x434862[_0x2940('0x8')]][_0x2940('0x26')]?utils['diffTime'](channels[_0x434862[_0x2940('0x8')]][_0x2940('0x30')],channels[_0x434862[_0x2940('0x8')]][_0x2940('0x26')]):0x0;writeDB(channels[_0x434862['uniqueid']]);}}catch(_0x4325fc){utils[_0x2940('0x29')](util[_0x2940('0xa')](_0x2940('0x2b'),_0x434862[_0x2940('0x8')]),_0x4325fc);}};exports[_0x2940('0x32')]=function(_0x468c01){try{if(!_[_0x2940('0x21')](channels[_0x468c01[_0x2940('0x33')]])){utils[_0x2940('0x1f')](util['format'](_0x2940('0x34'),_0x468c01['origtransfereruniqueid']),_0x468c01);if(channels[_0x468c01[_0x2940('0x33')]]['channel']==_0x468c01[_0x2940('0x35')]){utils[_0x2940('0x9')](util[_0x2940('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x468c01[_0x2940('0x36')],_0x468c01[_0x2940('0x33')],_0x468c01[_0x2940('0x37')]));channels[_0x468c01[_0x2940('0x33')]][_0x2940('0x25')]=_0x468c01['secondtransfererchannel'];channels[_0x468c01[_0x2940('0x33')]]['userfield']=_0x2940('0x38');}else if(channels[_0x468c01[_0x2940('0x33')]][_0x2940('0xc')]=_0x468c01[_0x2940('0x39')]){utils[_0x2940('0x9')](util['format'](_0x2940('0x3a'),_0x468c01['origtransfereruniqueid'],_0x468c01[_0x2940('0x33')],_0x468c01[_0x2940('0x3b')]));channels[_0x468c01[_0x2940('0x33')]][_0x2940('0x25')]=_0x468c01[_0x2940('0x3b')];channels[_0x468c01[_0x2940('0x33')]]['userfield']='_attended';}}}catch(_0x2dfc06){utils[_0x2940('0x29')](util[_0x2940('0xa')]('[%s][calls][attendedtransfer]',_0x468c01[_0x2940('0x36')]),_0x2dfc06);}};exports[_0x2940('0x3c')]=function(_0x2326d1){try{if(!_[_0x2940('0x21')](channels[_0x2326d1['uniqueid']])){utils[_0x2940('0x1f')](util[_0x2940('0xa')]('[%s][calls][musiconholdstart]',_0x2326d1['uniqueid']),_0x2326d1);channels[_0x2326d1['uniqueid']][_0x2940('0x3d')]=utils[_0x2940('0x1c')]();utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x3e'),_0x2326d1[_0x2940('0x8')],channels[_0x2326d1['uniqueid']][_0x2940('0x3d')]));}}catch(_0x28a1e2){utils[_0x2940('0x29')](util[_0x2940('0xa')](_0x2940('0x3f'),_0x2326d1[_0x2940('0x8')]),_0x28a1e2);}};exports['musiconholdstop']=function(_0x26d96a){try{if(!_['isNil'](channels[_0x26d96a[_0x2940('0x8')]])){utils[_0x2940('0x1f')](util[_0x2940('0xa')]('[%s][calls][musiconholdstop]',_0x26d96a['uniqueid']),_0x26d96a);if(!_['isNil'](channels[_0x26d96a[_0x2940('0x8')]][_0x2940('0x3d')])){channels[_0x26d96a[_0x2940('0x8')]][_0x2940('0x40')]+=utils[_0x2940('0x2f')](utils[_0x2940('0x1c')](),channels[_0x26d96a['uniqueid']]['musiconholdstartAt']);utils[_0x2940('0x9')](util[_0x2940('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x26d96a[_0x2940('0x8')],channels[_0x26d96a['uniqueid']]['mohtime']));delete channels[_0x26d96a[_0x2940('0x8')]][_0x2940('0x3d')];}}}catch(_0xb180ee){utils[_0x2940('0x29')](util[_0x2940('0xa')](_0x2940('0x41'),_0x26d96a['uniqueid']),_0xb180ee);}};exports[_0x2940('0x42')]=function(_0x5cd91b){try{if(!_['isNil'](channels[_0x5cd91b['uniqueid']])){utils[_0x2940('0x1f')](util['format'](_0x2940('0x43'),_0x5cd91b['uniqueid']),_0x5cd91b);if(!_[_0x2940('0x21')](_0x5cd91b['variable'][_0x2940('0x44')])){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x45'),_0x5cd91b[_0x2940('0x8')],_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b[_0x2940('0x8')]][_0x2940('0x47')]=_0x5cd91b[_0x2940('0x46')];}if(!_['isNil'](_0x5cd91b[_0x2940('0x48')][_0x2940('0x49')])){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x4a'),_0x5cd91b[_0x2940('0x8')],_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b['uniqueid']][_0x2940('0x4b')]=_0x5cd91b[_0x2940('0x46')];channels[_0x5cd91b['uniqueid']]['callerid']='\x22'+_0x5cd91b['value']+_0x2940('0x4c')+_0x5cd91b[_0x2940('0x46')]+'>';}if(!_[_0x2940('0x21')](_0x5cd91b[_0x2940('0x48')][_0x2940('0x4d')])||!_[_0x2940('0x21')](_0x5cd91b['variable'][_0x2940('0x4e')])){utils[_0x2940('0x9')](util[_0x2940('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5cd91b['uniqueid'],!_[_0x2940('0x21')](_0x5cd91b[_0x2940('0x48')]['xmd-callerid-preview'])?_0x2940('0x4d'):'xmd-callerid',_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b['uniqueid']]['callerid']=_0x5cd91b[_0x2940('0x46')];}if(!_[_0x2940('0x21')](_0x5cd91b['variable']['xmd-queue'])||!_['isNil'](_0x5cd91b['variable']['xmcs-queue'])){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x4f'),_0x5cd91b[_0x2940('0x8')],!_[_0x2940('0x21')](_0x5cd91b[_0x2940('0x48')]['xmd-queue'])?'xmd-queue':_0x2940('0x50'),_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b[_0x2940('0x8')]]['lastapplication']=_0x2940('0x51');channels[_0x5cd91b[_0x2940('0x8')]][_0x2940('0x52')]=_0x5cd91b[_0x2940('0x46')];channels[_0x5cd91b['uniqueid']][_0x2940('0xd')]=!![];}if(!_[_0x2940('0x21')](_0x5cd91b['variable'][_0x2940('0x53')])){utils['info'](util[_0x2940('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5cd91b[_0x2940('0x8')],_0x5cd91b['value']));channels[_0x5cd91b[_0x2940('0x8')]][_0x2940('0x54')]=_0x5cd91b[_0x2940('0x46')];}if(!_[_0x2940('0x21')](_0x5cd91b[_0x2940('0x48')][_0x2940('0x55')])){utils[_0x2940('0x9')](util['format'](_0x2940('0x56'),_0x5cd91b[_0x2940('0x8')],_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b[_0x2940('0x8')]][_0x2940('0x57')]=_0x5cd91b[_0x2940('0x46')];}if(!_['isNil'](_0x5cd91b[_0x2940('0x48')][_0x2940('0x58')])){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x59'),_0x5cd91b[_0x2940('0x8')],_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b[_0x2940('0x8')]]['routeid']=_0x5cd91b[_0x2940('0x46')];}if(!_[_0x2940('0x21')](_0x5cd91b[_0x2940('0x48')][_0x2940('0x5a')])){utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x5b'),_0x5cd91b[_0x2940('0x8')],_0x5cd91b[_0x2940('0x46')]));channels[_0x5cd91b['uniqueid']]['sipcallid']=_0x5cd91b[_0x2940('0x46')];}}}catch(_0x4f9dbf){utils[_0x2940('0x29')](util[_0x2940('0xa')](_0x2940('0x43'),_0x5cd91b[_0x2940('0x8')]),_0x4f9dbf);}};exports['newexten']=function(_0x25853e){try{if(!_[_0x2940('0x21')](channels[_0x25853e[_0x2940('0x8')]])){utils['debug'](util['format'](_0x2940('0x5c'),_0x25853e[_0x2940('0x8')]),_0x25853e);utils[_0x2940('0x9')](util[_0x2940('0xa')](_0x2940('0x5d'),_0x25853e[_0x2940('0x8')],_0x25853e[_0x2940('0x5e')],_0x25853e[_0x2940('0x5f')]));if(_0x25853e[_0x2940('0x5e')][_0x2940('0x60')]()==_0x2940('0x61')&&_[_0x2940('0x62')](_0x25853e[_0x2940('0x5f')][_0x2940('0x60')](),_0x2940('0x63'))){var _0x1f5975=_0x25853e[_0x2940('0x5f')][_0x2940('0x64')]('=');var _0x5d36ba=_0x1f5975[0x0]['substring'](_0x1f5975[0x0][_0x2940('0x65')]('(')+0x1,_0x1f5975[0x0][_0x2940('0x65')](')'));var _0x33b630=_0x1f5975[0x1];channels[_0x25853e[_0x2940('0x8')]][_0x5d36ba]=_0x33b630;}if(!_['includes']([_0x2940('0x2a'),_0x2940('0x66'),_0x2940('0x67'),_0x2940('0x61'),_0x2940('0x68')],_0x25853e[_0x2940('0x5e')]['toLowerCase']())){channels[_0x25853e['uniqueid']]['lastapplication']=_0x25853e['application'];channels[_0x25853e['uniqueid']]['lastdata']=_0x25853e[_0x2940('0x5f')];}}}catch(_0x255981){utils['error'](util[_0x2940('0xa')](_0x2940('0x5c'),_0x25853e[_0x2940('0x8')]),_0x255981);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 36bbf3b..daa33c5 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 _0xf273=['close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x347cae,_0x528d86){var _0x1843bc=function(_0x42bb31){while(--_0x42bb31){_0x347cae['push'](_0x347cae['shift']());}};_0x1843bc(++_0x528d86);}(_0xf273,0xce));var _0x3f27=function(_0x44fc6c,_0x43aea8){_0x44fc6c=_0x44fc6c-0x0;var _0x23d3d6=_0xf273[_0x44fc6c];return _0x23d3d6;};'use strict';var utils=require(_0x3f27('0x0'));exports[_0x3f27('0x1')]=function(){utils[_0x3f27('0x2')](_0x3f27('0x3'));};exports[_0x3f27('0x4')]=function(){utils['info'](_0x3f27('0x5'));};exports[_0x3f27('0x6')]=function(){utils[_0x3f27('0x2')](_0x3f27('0x7'));};exports[_0x3f27('0x8')]=function(_0x5eb457){utils[_0x3f27('0x8')](_0x3f27('0x9'),_0x5eb457);};exports[_0x3f27('0xa')]=function(){utils[_0x3f27('0x2')]('[core]\x20close');};exports[_0x3f27('0xb')]=function(_0x892cc){}; \ No newline at end of file +var _0xe94a=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x3655ca,_0xdb09fa){var _0x2d2ff8=function(_0x427d93){while(--_0x427d93){_0x3655ca['push'](_0x3655ca['shift']());}};_0x2d2ff8(++_0xdb09fa);}(_0xe94a,0x10b));var _0xae94=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xe94a[_0x4991d6];return _0x50faf7;};'use strict';var utils=require('./utils');exports[_0xae94('0x0')]=function(){utils[_0xae94('0x1')](_0xae94('0x2'));};exports['shutdown']=function(){utils[_0xae94('0x1')](_0xae94('0x3'));};exports[_0xae94('0x4')]=function(){utils[_0xae94('0x1')](_0xae94('0x5'));};exports[_0xae94('0x6')]=function(_0xac9d3e){utils[_0xae94('0x6')](_0xae94('0x7'),_0xac9d3e);};exports[_0xae94('0x8')]=function(){utils[_0xae94('0x1')](_0xae94('0x9'));};exports[_0xae94('0xa')]=function(_0x13494f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9e9b1de..65d5a0d 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 _0x50bf=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','info','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','assign','lastevent','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x50bf,0xa3));var _0xf50b=function(_0x10868f,_0x59dc1d){_0x10868f=_0x10868f-0x0;var _0x209138=_0x50bf[_0x10868f];return _0x209138;};'use strict';var _=require('lodash');var util=require(_0xf50b('0x0'));var utils=require(_0xf50b('0x1'));var dials={};function writeDB(_0x4cde97){utils['info'](util['format'](_0xf50b('0x2'),_0x4cde97[_0xf50b('0x3')],_0x4cde97[_0xf50b('0x4')],_0x4cde97[_0xf50b('0x5')],_0x4cde97['calleridnum'],_0x4cde97[_0xf50b('0x6')],_0x4cde97[_0xf50b('0x7')]));utils[_0xf50b('0x8')](_0xf50b('0x9'),_0x4cde97);delete dials[_0x4cde97[_0xf50b('0x3')]];}exports['newexten']=function(_0x1d998f){try{utils[_0xf50b('0xa')](util['format'](_0xf50b('0xb'),_0x1d998f[_0xf50b('0x3')]),_0x1d998f);utils[_0xf50b('0xc')](util[_0xf50b('0xd')](_0xf50b('0xe'),_0x1d998f[_0xf50b('0x3')],_0x1d998f['application'],_0x1d998f[_0xf50b('0xf')]));if(_0x1d998f[_0xf50b('0x10')][_0xf50b('0x11')]()==_0xf50b('0x12')&&_['startsWith'](_0x1d998f[_0xf50b('0xf')][_0xf50b('0x11')](),_0xf50b('0x13'))){var _0x26d4d5=_0x1d998f[_0xf50b('0xf')][_0xf50b('0x14')]('=');dials[_0x1d998f['uniqueid']]={'routeId':_0x26d4d5[0x1]};}}catch(_0x195211){utils[_0xf50b('0x15')](util['format'](_0xf50b('0xb'),_0x1d998f['uniqueid']),_0x195211);}};exports[_0xf50b('0x16')]=function(_0x5c8d32){try{utils[_0xf50b('0xa')](util[_0xf50b('0xd')](_0xf50b('0x17'),_0x5c8d32[_0xf50b('0x3')]),_0x5c8d32);if(!_[_0xf50b('0x18')](_0x5c8d32[_0xf50b('0x19')][_0xf50b('0x1a')])){utils[_0xf50b('0xc')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5c8d32[_0xf50b('0x3')],_0x5c8d32[_0xf50b('0x1b')]));dials[_0x5c8d32[_0xf50b('0x3')]]={'routeId':_0x5c8d32[_0xf50b('0x1b')]};}}catch(_0x14b98f){utils['error'](util[_0xf50b('0xd')](_0xf50b('0x17'),_0x5c8d32[_0xf50b('0x3')]),_0x14b98f);}};exports[_0xf50b('0x1c')]=function(_0x27ad92){try{if(!_[_0xf50b('0x18')](dials[_0x27ad92[_0xf50b('0x3')]])){utils[_0xf50b('0xa')](util[_0xf50b('0xd')](_0xf50b('0x1d'),_0x27ad92['uniqueid']),_0x27ad92);dials[_0x27ad92[_0xf50b('0x3')]]=_['assign'](dials[_0x27ad92[_0xf50b('0x3')]],_0x27ad92);dials[_0x27ad92['uniqueid']][_0xf50b('0x1e')]=utils[_0xf50b('0x1f')]();dials[_0x27ad92['uniqueid']]['lastevent']='called';utils[_0xf50b('0xc')](util[_0xf50b('0xd')](_0xf50b('0x20'),_0x27ad92[_0xf50b('0x3')],dials[_0x27ad92[_0xf50b('0x3')]][_0xf50b('0x1e')]));}}catch(_0x1042a9){utils[_0xf50b('0x15')](util[_0xf50b('0xd')](_0xf50b('0x1d'),_0x27ad92[_0xf50b('0x3')]),_0x1042a9);}};exports[_0xf50b('0x21')]=function(_0x4c210f){try{if(!_[_0xf50b('0x18')](dials[_0x4c210f[_0xf50b('0x3')]])){utils[_0xf50b('0xa')](util[_0xf50b('0xd')]('[%s][dials][dialend]',_0x4c210f['uniqueid']),_0x4c210f);dials[_0x4c210f[_0xf50b('0x3')]]['dialstatus']=_0x4c210f[_0xf50b('0x7')];if(_0x4c210f[_0xf50b('0x7')]==_0xf50b('0x22')){dials[_0x4c210f[_0xf50b('0x3')]]=_[_0xf50b('0x23')](dials[_0x4c210f['uniqueid']],_0x4c210f);dials[_0x4c210f[_0xf50b('0x3')]]['answertime']=utils[_0xf50b('0x1f')]();dials[_0x4c210f['uniqueid']][_0xf50b('0x24')]=_0xf50b('0x25');utils['info'](util[_0xf50b('0xd')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4c210f[_0xf50b('0x3')],_0x4c210f['dialstatus'],dials[_0x4c210f[_0xf50b('0x3')]][_0xf50b('0x26')]));}else{utils[_0xf50b('0xc')](util[_0xf50b('0xd')](_0xf50b('0x27'),_0x4c210f['uniqueid'],_0x4c210f[_0xf50b('0x7')]));}}}catch(_0x5fda17){utils[_0xf50b('0x15')](util[_0xf50b('0xd')](_0xf50b('0x28'),_0x4c210f[_0xf50b('0x3')]),_0x5fda17);}};exports['hangup']=function(_0x1e9499){try{if(!_[_0xf50b('0x18')](dials[_0x1e9499[_0xf50b('0x3')]])){utils[_0xf50b('0xa')](util[_0xf50b('0xd')](_0xf50b('0x29'),_0x1e9499[_0xf50b('0x3')]),_0x1e9499);utils[_0xf50b('0xc')](util[_0xf50b('0xd')](_0xf50b('0x2a'),_0x1e9499[_0xf50b('0x3')],_0x1e9499[_0xf50b('0x2b')],_0x1e9499[_0xf50b('0x2c')],_0x1e9499[_0xf50b('0x2d')]));dials[_0x1e9499[_0xf50b('0x3')]]=_[_0xf50b('0x23')](dials[_0x1e9499['uniqueid']],{'endtime':utils[_0xf50b('0x1f')](),'lastevent':_0xf50b('0x2e')});dials[_0x1e9499['uniqueid']][_0xf50b('0x2f')]=utils[_0xf50b('0x30')](dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x31')],dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x1e')]);dials[_0x1e9499[_0xf50b('0x3')]]['holdtime']=utils[_0xf50b('0x30')](dials[_0x1e9499[_0xf50b('0x3')]]['answertime']||dials[_0x1e9499['uniqueid']][_0xf50b('0x31')],dials[_0x1e9499['uniqueid']][_0xf50b('0x1e')]);dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x32')]=dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x26')]?utils['diffTime'](dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x31')],dials[_0x1e9499[_0xf50b('0x3')]][_0xf50b('0x26')]):0x0;writeDB(dials[_0x1e9499['uniqueid']]);}}catch(_0x33d373){utils[_0xf50b('0x15')](util[_0xf50b('0xd')](_0xf50b('0x29'),_0x1e9499[_0xf50b('0x3')]),_0x33d373);}}; \ No newline at end of file +var _0xbfda=['cdr(routeid)','split','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0xbfda,0x8c));var _0xabfd=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xbfda[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var utils=require(_0xabfd('0x2'));var dials={};function writeDB(_0x51e20e){utils[_0xabfd('0x3')](util['format'](_0xabfd('0x4'),_0x51e20e[_0xabfd('0x5')],_0x51e20e[_0xabfd('0x6')],_0x51e20e[_0xabfd('0x7')],_0x51e20e[_0xabfd('0x8')],_0x51e20e[_0xabfd('0x9')],_0x51e20e[_0xabfd('0xa')]));utils[_0xabfd('0xb')](_0xabfd('0xc'),_0x51e20e);delete dials[_0x51e20e[_0xabfd('0x5')]];}exports[_0xabfd('0xd')]=function(_0x51fab5){try{utils[_0xabfd('0xe')](util['format']('[%s][dials][newexten]',_0x51fab5[_0xabfd('0x5')]),_0x51fab5);utils[_0xabfd('0x3')](util[_0xabfd('0xf')](_0xabfd('0x10'),_0x51fab5[_0xabfd('0x5')],_0x51fab5['application'],_0x51fab5[_0xabfd('0x11')]));if(_0x51fab5[_0xabfd('0x12')]['toLowerCase']()==_0xabfd('0x13')&&_[_0xabfd('0x14')](_0x51fab5[_0xabfd('0x11')][_0xabfd('0x15')](),_0xabfd('0x16'))){var _0x3241e9=_0x51fab5[_0xabfd('0x11')][_0xabfd('0x17')]('=');dials[_0x51fab5[_0xabfd('0x5')]]={'routeId':_0x3241e9[0x1]};}}catch(_0x3b8154){utils['error'](util['format']('[%s][dials][newexten]',_0x51fab5['uniqueid']),_0x3b8154);}};exports[_0xabfd('0x18')]=function(_0x109b69){try{utils[_0xabfd('0xe')](util[_0xabfd('0xf')]('[%s][dials][varset]',_0x109b69[_0xabfd('0x5')]),_0x109b69);if(!_[_0xabfd('0x19')](_0x109b69['variable'][_0xabfd('0x1a')])){utils[_0xabfd('0x3')](util[_0xabfd('0xf')](_0xabfd('0x1b'),_0x109b69[_0xabfd('0x5')],_0x109b69[_0xabfd('0x1c')]));dials[_0x109b69[_0xabfd('0x5')]]={'routeId':_0x109b69['value']};}}catch(_0x11918f){utils[_0xabfd('0x1d')](util[_0xabfd('0xf')]('[%s][dials][varset]',_0x109b69[_0xabfd('0x5')]),_0x11918f);}};exports[_0xabfd('0x1e')]=function(_0x4ee960){try{if(!_[_0xabfd('0x19')](dials[_0x4ee960[_0xabfd('0x5')]])){utils['debug'](util[_0xabfd('0xf')](_0xabfd('0x1f'),_0x4ee960[_0xabfd('0x5')]),_0x4ee960);dials[_0x4ee960[_0xabfd('0x5')]]=_['assign'](dials[_0x4ee960['uniqueid']],_0x4ee960);dials[_0x4ee960[_0xabfd('0x5')]]['starttime']=utils[_0xabfd('0x20')]();dials[_0x4ee960[_0xabfd('0x5')]][_0xabfd('0x21')]='called';utils['info'](util['format'](_0xabfd('0x22'),_0x4ee960[_0xabfd('0x5')],dials[_0x4ee960[_0xabfd('0x5')]][_0xabfd('0x23')]));}}catch(_0xf099f2){utils[_0xabfd('0x1d')](util['format'](_0xabfd('0x1f'),_0x4ee960['uniqueid']),_0xf099f2);}};exports[_0xabfd('0x24')]=function(_0x44a91c){try{if(!_['isNil'](dials[_0x44a91c[_0xabfd('0x5')]])){utils[_0xabfd('0xe')](util['format']('[%s][dials][dialend]',_0x44a91c[_0xabfd('0x5')]),_0x44a91c);dials[_0x44a91c[_0xabfd('0x5')]][_0xabfd('0xa')]=_0x44a91c['dialstatus'];if(_0x44a91c[_0xabfd('0xa')]=='ANSWER'){dials[_0x44a91c[_0xabfd('0x5')]]=_[_0xabfd('0x25')](dials[_0x44a91c[_0xabfd('0x5')]],_0x44a91c);dials[_0x44a91c['uniqueid']][_0xabfd('0x26')]=utils[_0xabfd('0x20')]();dials[_0x44a91c[_0xabfd('0x5')]][_0xabfd('0x21')]=_0xabfd('0x27');utils[_0xabfd('0x3')](util[_0xabfd('0xf')](_0xabfd('0x28'),_0x44a91c[_0xabfd('0x5')],_0x44a91c['dialstatus'],dials[_0x44a91c['uniqueid']][_0xabfd('0x26')]));}else{utils[_0xabfd('0x3')](util[_0xabfd('0xf')](_0xabfd('0x29'),_0x44a91c['uniqueid'],_0x44a91c[_0xabfd('0xa')]));}}}catch(_0x6bc206){utils[_0xabfd('0x1d')](util['format'](_0xabfd('0x2a'),_0x44a91c[_0xabfd('0x5')]),_0x6bc206);}};exports[_0xabfd('0x2b')]=function(_0x479f7a){try{if(!_['isNil'](dials[_0x479f7a[_0xabfd('0x5')]])){utils[_0xabfd('0xe')](util[_0xabfd('0xf')](_0xabfd('0x2c'),_0x479f7a[_0xabfd('0x5')]),_0x479f7a);utils[_0xabfd('0x3')](util['format'](_0xabfd('0x2d'),_0x479f7a[_0xabfd('0x5')],_0x479f7a['calleridnum'],_0x479f7a[_0xabfd('0x2e')],_0x479f7a[_0xabfd('0x2f')]));dials[_0x479f7a[_0xabfd('0x5')]]=_[_0xabfd('0x25')](dials[_0x479f7a['uniqueid']],{'endtime':utils[_0xabfd('0x20')](),'lastevent':_0xabfd('0x30')});dials[_0x479f7a['uniqueid']][_0xabfd('0x31')]=utils[_0xabfd('0x32')](dials[_0x479f7a['uniqueid']][_0xabfd('0x33')],dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x23')]);dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x34')]=utils[_0xabfd('0x32')](dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x26')]||dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x33')],dials[_0x479f7a['uniqueid']][_0xabfd('0x23')]);dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x35')]=dials[_0x479f7a[_0xabfd('0x5')]]['answertime']?utils[_0xabfd('0x32')](dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x33')],dials[_0x479f7a[_0xabfd('0x5')]][_0xabfd('0x26')]):0x0;writeDB(dials[_0x479f7a[_0xabfd('0x5')]]);}}catch(_0x103d03){utils[_0xabfd('0x1d')](util['format'](_0xabfd('0x2c'),_0x479f7a[_0xabfd('0x5')]),_0x103d03);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c911c8f..77e9745 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 _0x7433=['[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup'];(function(_0x10677d,_0x5d2e53){var _0x1bcfab=function(_0x22a8e5){while(--_0x22a8e5){_0x10677d['push'](_0x10677d['shift']());}};_0x1bcfab(++_0x5d2e53);}(_0x7433,0x17e));var _0x3743=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x7433[_0x4d2993];return _0x427374;};var AsteriskManager=require(_0x3743('0x0'));var config=require(_0x3743('0x1'));var utils=require(_0x3743('0x2'));var util=require(_0x3743('0x3'));var isXDREnabled=config[_0x3743('0x4')]&&config[_0x3743('0x4')]['disabled']?!config[_0x3743('0x4')][_0x3743('0x5')]:!![];var isProduction=config[_0x3743('0x6')]===_0x3743('0x7')||![];var isLocalAsterisk=config[_0x3743('0x4')]&&config[_0x3743('0x4')][_0x3743('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x3743('0x9')],config['asterisk']['ip'],config[_0x3743('0xa')][_0x3743('0xb')],config[_0x3743('0xa')][_0x3743('0xc')],!![]);ami[_0x3743('0xd')]();if(!isXDREnabled){utils[_0x3743('0xe')](_0x3743('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x3743('0xe')](_0x3743('0x10'));}else{var agents=require(_0x3743('0x11'));var calls=require('./calls.controller');var queues=require(_0x3743('0x12'));var recordings=require('./recordings.controller');var members=require(_0x3743('0x13'));var dials=require(_0x3743('0x14'));var transfers=require(_0x3743('0x15'));var core=require(_0x3743('0x16'));ami['on'](_0x3743('0x17'),core[_0x3743('0x17')]);ami['on'](_0x3743('0x18'),core[_0x3743('0x18')]);ami['on'](_0x3743('0x19'),core[_0x3743('0x19')]);ami['on'](_0x3743('0x1a'),core['error']);ami['on'](_0x3743('0x1b'),core[_0x3743('0x1b')]);ami['on'](_0x3743('0x1c'),core[_0x3743('0x1c')]);ami['on'](_0x3743('0x1d'),function(_0x22c70f){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x20'),_0x22c70f[_0x3743('0x21')]),_0x22c70f);members[_0x3743('0x1d')](_0x22c70f);}catch(_0x3b7a5b){utils[_0x3743('0x1a')](util[_0x3743('0x1f')]('[%s][index][devicestatechange]',_0x22c70f['device']),_0x3b7a5b);}});ami['on'](_0x3743('0x22'),function(_0x37b42a){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x23'),_0x37b42a[_0x3743('0x24')]),_0x37b42a);agents[_0x3743('0x22')](_0x37b42a);}catch(_0x12e64f){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x23'),_0x37b42a['uniqueid']),_0x12e64f);}});ami['on'](_0x3743('0x25'),function(_0x4de052){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x26'),_0x4de052[_0x3743('0x24')]),_0x4de052);agents[_0x3743('0x25')](_0x4de052);}catch(_0x50106e){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x26'),_0x4de052[_0x3743('0x24')]),_0x50106e);}});ami['on'](_0x3743('0x27'),function(_0x5bb2ec){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')]('[%s][index][agentconnect]',_0x5bb2ec[_0x3743('0x24')]),_0x5bb2ec);agents['agentconnect'](_0x5bb2ec);queues[_0x3743('0x27')](_0x5bb2ec);}catch(_0x273798){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x28'),_0x5bb2ec[_0x3743('0x24')]),_0x273798);}});ami['on'](_0x3743('0x29'),function(_0x5f311d){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x2a'),_0x5f311d[_0x3743('0x24')]),_0x5f311d);agents[_0x3743('0x29')](_0x5f311d);queues[_0x3743('0x29')](_0x5f311d);members[_0x3743('0x29')](_0x5f311d);}catch(_0x9a65d0){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x2a'),_0x5f311d['uniqueid']),_0x9a65d0);}});ami['on'](_0x3743('0x2b'),function(_0x4eefa9){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x2c'),_0x4eefa9['uniqueid']),_0x4eefa9);agents[_0x3743('0x2b')](_0x4eefa9);queues[_0x3743('0x2b')](_0x4eefa9);}catch(_0xb84cc0){utils[_0x3743('0x1a')](util['format'](_0x3743('0x2c'),_0x4eefa9[_0x3743('0x24')]),_0xb84cc0);}});ami['on']('queuecallerjoin',function(_0x87cf82){try{utils['debug'](util[_0x3743('0x1f')](_0x3743('0x2d'),_0x87cf82[_0x3743('0x24')]),_0x87cf82);queues['queuecallerjoin'](_0x87cf82);recordings[_0x3743('0x2e')](_0x87cf82);}catch(_0x39642b){utils['error'](util[_0x3743('0x1f')]('[%s][index][queuecallerjoin]',_0x87cf82['uniqueid']),_0x39642b);}});ami['on'](_0x3743('0x2f'),function(_0x5b46cb){try{utils['debug'](util[_0x3743('0x1f')](_0x3743('0x30'),_0x5b46cb[_0x3743('0x24')]),_0x5b46cb);queues['queuecallerleave'](_0x5b46cb);}catch(_0x1cf874){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x30'),_0x5b46cb[_0x3743('0x24')]),_0x1cf874);}});ami['on']('musiconholdstart',function(_0x9b18d5){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x31'),_0x9b18d5['uniqueid']),_0x9b18d5);queues[_0x3743('0x32')](_0x9b18d5);calls[_0x3743('0x32')](_0x9b18d5);}catch(_0x3208bd){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x31'),_0x9b18d5['uniqueid']),_0x3208bd);}});ami['on'](_0x3743('0x33'),function(_0x4b0c04){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')]('[%s][index][musiconholdstop]',_0x4b0c04['uniqueid']),_0x4b0c04);queues[_0x3743('0x33')](_0x4b0c04);calls[_0x3743('0x33')](_0x4b0c04);}catch(_0x4209d7){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x34'),_0x4b0c04['uniqueid']),_0x4209d7);}});ami['on'](_0x3743('0x35'),function(_0x4c585c){try{utils['debug'](util['format'](_0x3743('0x36'),_0x4c585c[_0x3743('0x24')]),_0x4c585c);calls[_0x3743('0x35')](_0x4c585c);recordings[_0x3743('0x35')](_0x4c585c);}catch(_0x4dc7b6){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x36'),_0x4c585c['uniqueid']),_0x4dc7b6);}});ami['on'](_0x3743('0x37'),function(_0x264a83){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x38'),_0x264a83[_0x3743('0x24')]),_0x264a83);calls[_0x3743('0x37')](_0x264a83);recordings[_0x3743('0x37')](_0x264a83);dials[_0x3743('0x37')](_0x264a83);agents[_0x3743('0x37')](_0x264a83);queues[_0x3743('0x37')](_0x264a83);}catch(_0x42ca39){utils['error'](util[_0x3743('0x1f')](_0x3743('0x38'),_0x264a83['uniqueid']),_0x42ca39);}});ami['on'](_0x3743('0x39'),function(_0x534c72){try{utils[_0x3743('0x1e')](util['format']('[%s][index][cdr]',_0x534c72[_0x3743('0x24')]),_0x534c72);members[_0x3743('0x39')](_0x534c72);}catch(_0x22382d){utils[_0x3743('0x1a')](util['format'](_0x3743('0x3a'),_0x534c72['uniqueid']),_0x22382d);}});ami['on'](_0x3743('0x3b'),function(_0x148b67){try{utils[_0x3743('0x1e')](util['format'](_0x3743('0x3c'),_0x148b67[_0x3743('0x24')]),_0x148b67);queues[_0x3743('0x3b')](_0x148b67);agents[_0x3743('0x3b')](_0x148b67);transfers[_0x3743('0x3b')](_0x148b67);recordings['blindtransfer'](_0x148b67);}catch(_0x42b73e){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x3c'),_0x148b67[_0x3743('0x24')]),_0x42b73e);}});ami['on'](_0x3743('0x3d'),function(_0xf5d44f){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x3e'),_0xf5d44f['origtransfereruniqueid']),_0xf5d44f);queues[_0x3743('0x3d')](_0xf5d44f);transfers[_0x3743('0x3d')](_0xf5d44f);agents['attendedtransfer'](_0xf5d44f);calls['attendedtransfer'](_0xf5d44f);}catch(_0x4952ad){utils[_0x3743('0x1a')](util['format']('[%s][index][attendedtransfer]',_0xf5d44f['origtransfereruniqueid']),_0x4952ad);}});ami['on']('varset',function(_0x58a575){try{utils[_0x3743('0x1e')](util[_0x3743('0x1f')](_0x3743('0x3f'),_0x58a575['uniqueid']),_0x58a575);queues[_0x3743('0x40')](_0x58a575);recordings['varset'](_0x58a575);calls['varset'](_0x58a575);dials[_0x3743('0x40')](_0x58a575);}catch(_0xb8175b){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x3f'),_0x58a575['uniqueid']),_0xb8175b);}});ami['on']('newexten',function(_0x1783d3){try{utils[_0x3743('0x1e')](util['format'](_0x3743('0x41'),_0x1783d3[_0x3743('0x24')]),_0x1783d3);calls[_0x3743('0x42')](_0x1783d3);recordings[_0x3743('0x42')](_0x1783d3);dials[_0x3743('0x42')](_0x1783d3);}catch(_0x410892){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x41'),_0x1783d3['uniqueid']),_0x410892);}});ami['on'](_0x3743('0x43'),function(_0x1bc55e){try{utils['debug'](util[_0x3743('0x1f')](_0x3743('0x44'),_0x1bc55e[_0x3743('0x24')]),_0x1bc55e);calls[_0x3743('0x43')](_0x1bc55e);recordings[_0x3743('0x43')](_0x1bc55e);}catch(_0x218360){utils['error'](util[_0x3743('0x1f')](_0x3743('0x44'),_0x1bc55e['uniqueid']),_0x218360);}});ami['on'](_0x3743('0x45'),function(_0x3ff5b0){try{utils[_0x3743('0x1e')](util['format'](_0x3743('0x46'),_0x3ff5b0['uniqueid']),_0x3ff5b0);dials[_0x3743('0x45')](_0x3ff5b0);}catch(_0x41aae7){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x47'),_0x3ff5b0[_0x3743('0x24')]),_0x41aae7);}});ami['on']('dialend',function(_0x2e5702){try{utils['debug'](util[_0x3743('0x1f')](_0x3743('0x48'),_0x2e5702[_0x3743('0x24')]),_0x2e5702);dials['dialend'](_0x2e5702);}catch(_0x56d7f4){utils[_0x3743('0x1a')](util[_0x3743('0x1f')](_0x3743('0x48'),_0x2e5702[_0x3743('0x24')]),_0x56d7f4);}});} \ No newline at end of file +var _0x1de9=['env','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','format','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled'];(function(_0x8e3bce,_0x44900a){var _0x3a6424=function(_0x31032b){while(--_0x31032b){_0x8e3bce['push'](_0x8e3bce['shift']());}};_0x3a6424(++_0x44900a);}(_0x1de9,0x116));var _0x91de=function(_0x3685b0,_0x111044){_0x3685b0=_0x3685b0-0x0;var _0x548adb=_0x1de9[_0x3685b0];return _0x548adb;};var AsteriskManager=require(_0x91de('0x0'));var config=require(_0x91de('0x1'));var utils=require(_0x91de('0x2'));var util=require(_0x91de('0x3'));var isXDREnabled=config[_0x91de('0x4')]&&config[_0x91de('0x4')][_0x91de('0x5')]?!config[_0x91de('0x4')][_0x91de('0x5')]:!![];var isProduction=config[_0x91de('0x6')]===_0x91de('0x7')||![];var isLocalAsterisk=config[_0x91de('0x4')]&&config[_0x91de('0x4')][_0x91de('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x91de('0x9')][_0x91de('0xa')],config[_0x91de('0x9')]['ip'],config[_0x91de('0x9')][_0x91de('0xb')],config[_0x91de('0x9')][_0x91de('0xc')],!![]);ami[_0x91de('0xd')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x91de('0xe')](_0x91de('0xf'));}else{var agents=require(_0x91de('0x10'));var calls=require(_0x91de('0x11'));var queues=require('./queues.controller');var recordings=require(_0x91de('0x12'));var members=require('./members.controller');var dials=require(_0x91de('0x13'));var transfers=require(_0x91de('0x14'));var core=require(_0x91de('0x15'));ami['on'](_0x91de('0x16'),core[_0x91de('0x16')]);ami['on'](_0x91de('0x17'),core[_0x91de('0x17')]);ami['on'](_0x91de('0x18'),core['fullybooted']);ami['on'](_0x91de('0x19'),core[_0x91de('0x19')]);ami['on'](_0x91de('0x1a'),core[_0x91de('0x1a')]);ami['on'](_0x91de('0x1b'),core[_0x91de('0x1b')]);ami['on'](_0x91de('0x1c'),function(_0xfff788){try{utils[_0x91de('0x1d')](util['format'](_0x91de('0x1e'),_0xfff788[_0x91de('0x1f')]),_0xfff788);members['devicestatechange'](_0xfff788);}catch(_0xa1b4d3){utils[_0x91de('0x19')](util['format']('[%s][index][devicestatechange]',_0xfff788[_0x91de('0x1f')]),_0xa1b4d3);}});ami['on'](_0x91de('0x20'),function(_0x535aba){try{utils[_0x91de('0x1d')](util['format']('[%s][index][agentcalled]',_0x535aba[_0x91de('0x21')]),_0x535aba);agents[_0x91de('0x20')](_0x535aba);}catch(_0x16b8f3){utils[_0x91de('0x19')](util['format'](_0x91de('0x22'),_0x535aba[_0x91de('0x21')]),_0x16b8f3);}});ami['on'](_0x91de('0x23'),function(_0x4cd494){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][agentringnoanswer]',_0x4cd494['uniqueid']),_0x4cd494);agents['agentringnoanswer'](_0x4cd494);}catch(_0x3c1c44){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x25'),_0x4cd494[_0x91de('0x21')]),_0x3c1c44);}});ami['on'](_0x91de('0x26'),function(_0x3a46aa){try{utils[_0x91de('0x1d')](util['format'](_0x91de('0x27'),_0x3a46aa[_0x91de('0x21')]),_0x3a46aa);agents[_0x91de('0x26')](_0x3a46aa);queues[_0x91de('0x26')](_0x3a46aa);}catch(_0x4886a0){utils[_0x91de('0x19')](util[_0x91de('0x24')]('[%s][index][agentconnect]',_0x3a46aa['uniqueid']),_0x4886a0);}});ami['on'](_0x91de('0x28'),function(_0x537375){try{utils[_0x91de('0x1d')](util['format']('[%s][index][agentcomplete]',_0x537375[_0x91de('0x21')]),_0x537375);agents[_0x91de('0x28')](_0x537375);queues[_0x91de('0x28')](_0x537375);members[_0x91de('0x28')](_0x537375);}catch(_0x3e5a9e){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x29'),_0x537375[_0x91de('0x21')]),_0x3e5a9e);}});ami['on'](_0x91de('0x2a'),function(_0xfa2ac5){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][queuecallerabandon]',_0xfa2ac5[_0x91de('0x21')]),_0xfa2ac5);agents[_0x91de('0x2a')](_0xfa2ac5);queues[_0x91de('0x2a')](_0xfa2ac5);}catch(_0x1acfce){utils['error'](util[_0x91de('0x24')](_0x91de('0x2b'),_0xfa2ac5['uniqueid']),_0x1acfce);}});ami['on']('queuecallerjoin',function(_0x459de0){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][queuecallerjoin]',_0x459de0[_0x91de('0x21')]),_0x459de0);queues[_0x91de('0x2c')](_0x459de0);recordings[_0x91de('0x2c')](_0x459de0);}catch(_0x5b688b){utils[_0x91de('0x19')](util['format'](_0x91de('0x2d'),_0x459de0[_0x91de('0x21')]),_0x5b688b);}});ami['on'](_0x91de('0x2e'),function(_0x257cfb){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][queuecallerleave]',_0x257cfb[_0x91de('0x21')]),_0x257cfb);queues[_0x91de('0x2e')](_0x257cfb);}catch(_0x3d2d22){utils[_0x91de('0x19')](util['format'](_0x91de('0x2f'),_0x257cfb['uniqueid']),_0x3d2d22);}});ami['on'](_0x91de('0x30'),function(_0x14270c){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][musiconholdstart]',_0x14270c[_0x91de('0x21')]),_0x14270c);queues[_0x91de('0x30')](_0x14270c);calls[_0x91de('0x30')](_0x14270c);}catch(_0x18c203){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x31'),_0x14270c[_0x91de('0x21')]),_0x18c203);}});ami['on']('musiconholdstop',function(_0x2a0649){try{utils['debug'](util['format'](_0x91de('0x32'),_0x2a0649[_0x91de('0x21')]),_0x2a0649);queues[_0x91de('0x33')](_0x2a0649);calls['musiconholdstop'](_0x2a0649);}catch(_0x419e9c){utils[_0x91de('0x19')](util[_0x91de('0x24')]('[%s][index][musiconholdstop]',_0x2a0649['uniqueid']),_0x419e9c);}});ami['on']('newstate',function(_0x34fa0e){try{utils['debug'](util[_0x91de('0x24')](_0x91de('0x34'),_0x34fa0e[_0x91de('0x21')]),_0x34fa0e);calls[_0x91de('0x35')](_0x34fa0e);recordings[_0x91de('0x35')](_0x34fa0e);}catch(_0x57b516){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x34'),_0x34fa0e[_0x91de('0x21')]),_0x57b516);}});ami['on']('hangup',function(_0x75904d){try{utils['debug'](util['format'](_0x91de('0x36'),_0x75904d[_0x91de('0x21')]),_0x75904d);calls['hangup'](_0x75904d);recordings[_0x91de('0x37')](_0x75904d);dials[_0x91de('0x37')](_0x75904d);agents[_0x91de('0x37')](_0x75904d);queues[_0x91de('0x37')](_0x75904d);}catch(_0x3f9421){utils[_0x91de('0x19')](util[_0x91de('0x24')]('[%s][index][hangup]',_0x75904d[_0x91de('0x21')]),_0x3f9421);}});ami['on'](_0x91de('0x38'),function(_0x281c2b){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][cdr]',_0x281c2b[_0x91de('0x21')]),_0x281c2b);members[_0x91de('0x38')](_0x281c2b);}catch(_0x14778c){utils['error'](util['format'](_0x91de('0x39'),_0x281c2b[_0x91de('0x21')]),_0x14778c);}});ami['on'](_0x91de('0x3a'),function(_0x1239ce){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')](_0x91de('0x3b'),_0x1239ce[_0x91de('0x21')]),_0x1239ce);queues[_0x91de('0x3a')](_0x1239ce);agents[_0x91de('0x3a')](_0x1239ce);transfers['blindtransfer'](_0x1239ce);recordings[_0x91de('0x3a')](_0x1239ce);}catch(_0x1d180e){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x3b'),_0x1239ce['uniqueid']),_0x1d180e);}});ami['on']('attendedtransfer',function(_0x129c36){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')](_0x91de('0x3c'),_0x129c36[_0x91de('0x3d')]),_0x129c36);queues[_0x91de('0x3e')](_0x129c36);transfers[_0x91de('0x3e')](_0x129c36);agents[_0x91de('0x3e')](_0x129c36);calls[_0x91de('0x3e')](_0x129c36);}catch(_0x57372a){utils[_0x91de('0x19')](util['format'](_0x91de('0x3c'),_0x129c36[_0x91de('0x3d')]),_0x57372a);}});ami['on'](_0x91de('0x3f'),function(_0x256796){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][varset]',_0x256796['uniqueid']),_0x256796);queues['varset'](_0x256796);recordings[_0x91de('0x3f')](_0x256796);calls[_0x91de('0x3f')](_0x256796);dials[_0x91de('0x3f')](_0x256796);}catch(_0x3d3460){utils[_0x91de('0x19')](util['format']('[%s][index][varset]',_0x256796['uniqueid']),_0x3d3460);}});ami['on'](_0x91de('0x40'),function(_0x282584){try{utils['debug'](util[_0x91de('0x24')]('[%s][index][newexten]',_0x282584[_0x91de('0x21')]),_0x282584);calls['newexten'](_0x282584);recordings['newexten'](_0x282584);dials['newexten'](_0x282584);}catch(_0x1bcb83){utils[_0x91de('0x19')](util[_0x91de('0x24')](_0x91de('0x41'),_0x282584[_0x91de('0x21')]),_0x1bcb83);}});ami['on']('newchannel',function(_0x5bbed2){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')](_0x91de('0x42'),_0x5bbed2[_0x91de('0x21')]),_0x5bbed2);calls[_0x91de('0x43')](_0x5bbed2);recordings[_0x91de('0x43')](_0x5bbed2);}catch(_0x420e63){utils[_0x91de('0x19')](util[_0x91de('0x24')]('[%s][index][newchannel]',_0x5bbed2[_0x91de('0x21')]),_0x420e63);}});ami['on']('dialbegin',function(_0x4d2e42){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')]('[%s][index][dialbegin]',_0x4d2e42[_0x91de('0x21')]),_0x4d2e42);dials[_0x91de('0x44')](_0x4d2e42);}catch(_0x3a7756){utils[_0x91de('0x19')](util[_0x91de('0x24')]('[%s]dialbegin',_0x4d2e42[_0x91de('0x21')]),_0x3a7756);}});ami['on'](_0x91de('0x45'),function(_0x2d36f5){try{utils[_0x91de('0x1d')](util[_0x91de('0x24')](_0x91de('0x46'),_0x2d36f5[_0x91de('0x21')]),_0x2d36f5);dials[_0x91de('0x45')](_0x2d36f5);}catch(_0x49fc9b){utils[_0x91de('0x19')](util['format'](_0x91de('0x46'),_0x2d36f5[_0x91de('0x21')]),_0x49fc9b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5d3be69..13c72fe 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 _0xf875=['source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','Queue:','info','format','interface','channel','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','type'];(function(_0x13e779,_0x4f3ea1){var _0x2751db=function(_0x399a94){while(--_0x399a94){_0x13e779['push'](_0x13e779['shift']());}};_0x2751db(++_0x4f3ea1);}(_0xf875,0x138));var _0x5f87=function(_0x1b2540,_0x197222){_0x1b2540=_0x1b2540-0x0;var _0x35dc3f=_0xf875[_0x1b2540];return _0x35dc3f;};'use strict';var _=require(_0x5f87('0x0'));var util=require('util');var utils=require(_0x5f87('0x1'));var members={};var exclude=[_0x5f87('0x2'),_0x5f87('0x3')];function writeDB(_0x515edb){utils[_0x5f87('0x4')](util[_0x5f87('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x515edb['uniqueid'],_0x515edb[_0x5f87('0x6')],_0x515edb[_0x5f87('0x7')],_0x515edb[_0x5f87('0x8')],_0x515edb[_0x5f87('0x9')],_0x515edb['type']));if(_0x515edb['interface']){utils[_0x5f87('0xa')](_0x515edb['interface'])['then'](function(_0xb4cafb){if(_0xb4cafb){_0x515edb[_0x5f87('0x9')]=_0xb4cafb[_0x5f87('0xb')];_0x515edb[_0x5f87('0xc')]=_0xb4cafb['internal'];utils[_0x5f87('0xd')](_0x5f87('0xe'),_0x515edb);}else{utils[_0x5f87('0xf')](_0x515edb[_0x5f87('0x6')]['split']('/')[0x1])['then'](function(_0x112b6e){if(_0x112b6e){_0x515edb[_0x5f87('0x9')]=_0x112b6e['name'];_0x515edb[_0x5f87('0xc')]=_0x112b6e[_0x5f87('0xc')];utils[_0x5f87('0xd')](_0x5f87('0xe'),_0x515edb);}});}})[_0x5f87('0x10')](function(_0x35f80f){utils[_0x5f87('0x11')](util[_0x5f87('0x5')](_0x5f87('0x12'),_0x515edb[_0x5f87('0x13')]),_0x35f80f);});}delete members[_0x515edb[_0x5f87('0x6')]];}function startsWith(_0x4e7ad1,_0x139178){return _[_0x5f87('0x14')](_0x4e7ad1,function(_0x2048ea){return _[_0x5f87('0x15')](_0x139178,_0x2048ea);});}exports['devicestatechange']=function(_0x4acfe6){try{utils[_0x5f87('0x16')](util[_0x5f87('0x5')](_0x5f87('0x17'),members[_0x4acfe6['device']]?members[_0x4acfe6['device']][_0x5f87('0x13')]:_0x4acfe6[_0x5f87('0x18')]),_0x4acfe6);utils[_0x5f87('0x4')](util[_0x5f87('0x5')](_0x5f87('0x19'),members[_0x4acfe6[_0x5f87('0x18')]]?members[_0x4acfe6[_0x5f87('0x18')]][_0x5f87('0x13')]:_0x4acfe6[_0x5f87('0x18')],_0x4acfe6[_0x5f87('0x1a')],_0x4acfe6['device']));switch(_0x4acfe6[_0x5f87('0x1a')]){case _0x5f87('0x1b'):case _0x5f87('0x1c'):if(!startsWith(exclude,_0x4acfe6['device'])){members[_0x4acfe6['device']]={'channel':_0x5f87('0x1d'),'interface':_0x4acfe6[_0x5f87('0x18')],'type':'TALKING','enterAt':utils[_0x5f87('0x1e')](),'role':_0x5f87('0x1f')};}break;case _0x5f87('0x20'):if(!_['isNil'](members[_0x4acfe6[_0x5f87('0x18')]])){members[_0x4acfe6['device']][_0x5f87('0x21')]=utils['now']();members[_0x4acfe6[_0x5f87('0x18')]]['duration']=utils[_0x5f87('0x22')](members[_0x4acfe6[_0x5f87('0x18')]][_0x5f87('0x21')],members[_0x4acfe6['device']][_0x5f87('0x23')]);if(members[_0x4acfe6['device']]['uniqueid']){writeDB(members[_0x4acfe6[_0x5f87('0x18')]]);}}break;default:break;}}catch(_0x3a1725){utils[_0x5f87('0x11')](util['format'](_0x5f87('0x17'),members[_0x4acfe6[_0x5f87('0x18')]]?members[_0x4acfe6[_0x5f87('0x18')]][_0x5f87('0x13')]:_0x4acfe6[_0x5f87('0x18')]),_0x3a1725);}};exports[_0x5f87('0x24')]=function(_0x10fd3c){try{if(!_[_0x5f87('0x25')](members[_0x10fd3c[_0x5f87('0x6')]])){utils['debug'](util[_0x5f87('0x5')](_0x5f87('0x26'),_0x10fd3c['uniqueid']),_0x10fd3c);utils[_0x5f87('0x4')](util['format'](_0x5f87('0x27'),_0x10fd3c[_0x5f87('0x13')],_0x10fd3c[_0x5f87('0x6')],_0x10fd3c[_0x5f87('0x28')]));members[_0x10fd3c[_0x5f87('0x6')]]=_[_0x5f87('0x29')](members[_0x10fd3c['interface']],{'data4':_0x10fd3c[_0x5f87('0x28')],'uniqueid':_0x10fd3c[_0x5f87('0x13')]});}}catch(_0x5b8294){utils['error'](util[_0x5f87('0x5')]('[%s][members][agentcomplete]',_0x10fd3c[_0x5f87('0x13')]),_0x5b8294);}};exports[_0x5f87('0x2a')]=function(_0x47d337){try{utils[_0x5f87('0x16')](util['format']('[%s][members][cdr]',_0x47d337[_0x5f87('0x13')]),_0x47d337);if(_0x47d337[_0x5f87('0x7')]){var _0x3356d5=_0x47d337[_0x5f87('0x7')]['split']('-')[0x0];if(!_[_0x5f87('0x25')](members[_0x3356d5])){members[_0x3356d5]=_[_0x5f87('0x29')](members[_0x3356d5],{'data1':members[_0x3356d5][_0x5f87('0x2b')]||_0x47d337[_0x5f87('0x2c')],'data2':members[_0x3356d5][_0x5f87('0x8')]||_0x47d337[_0x5f87('0x2d')],'data3':members[_0x3356d5]['data3']||_0x47d337['destination'],'uniqueid':members[_0x3356d5][_0x5f87('0x13')]||_0x47d337['uniqueid']});utils[_0x5f87('0x4')](util[_0x5f87('0x5')](_0x5f87('0x2e'),_0x47d337[_0x5f87('0x13')],members[_0x3356d5][_0x5f87('0x2b')],members[_0x3356d5][_0x5f87('0x8')],members[_0x3356d5][_0x5f87('0x2f')]));if(members[_0x3356d5]['exitAt']){writeDB(members[_0x3356d5]);}}}if(_0x47d337[_0x5f87('0x30')]){var _0x2563b7=_0x47d337[_0x5f87('0x30')][_0x5f87('0x31')]('-')[0x0];if(!_[_0x5f87('0x25')](members[_0x2563b7])){members[_0x2563b7]=_['assign'](members[_0x2563b7],{'data1':members[_0x2563b7][_0x5f87('0x2b')]||_0x47d337['type'],'data2':members[_0x2563b7][_0x5f87('0x8')]||_0x47d337['source'],'data3':members[_0x2563b7]['data3']||_0x47d337['destination'],'uniqueid':members[_0x2563b7][_0x5f87('0x13')]||_0x47d337[_0x5f87('0x13')]});utils[_0x5f87('0x4')](util[_0x5f87('0x5')](_0x5f87('0x2e'),_0x47d337['uniqueid'],members[_0x2563b7][_0x5f87('0x2b')],members[_0x2563b7][_0x5f87('0x8')],members[_0x2563b7]['data3']));if(members[_0x2563b7][_0x5f87('0x21')]){writeDB(members[_0x2563b7]);}}}}catch(_0x36ff8d){utils[_0x5f87('0x11')](util[_0x5f87('0x5')](_0x5f87('0x32'),_0x47d337['uniqueid']),_0x36ff8d);}}; \ No newline at end of file +var _0x5f90=['now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','channel','data1','data3','destinationchannel','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','name','split','internal','request','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','isNil','exitAt'];(function(_0x2826d9,_0x28f60f){var _0x96122b=function(_0x59c6e0){while(--_0x59c6e0){_0x2826d9['push'](_0x2826d9['shift']());}};_0x96122b(++_0x28f60f);}(_0x5f90,0xae));var _0x05f9=function(_0x35c137,_0x5f2bd0){_0x35c137=_0x35c137-0x0;var _0x36f749=_0x5f90[_0x35c137];return _0x36f749;};'use strict';var _=require(_0x05f9('0x0'));var util=require('util');var utils=require(_0x05f9('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x05f9('0x2')];function writeDB(_0x53c7be){utils[_0x05f9('0x3')](util[_0x05f9('0x4')](_0x05f9('0x5'),_0x53c7be[_0x05f9('0x6')],_0x53c7be[_0x05f9('0x7')],_0x53c7be['channel'],_0x53c7be[_0x05f9('0x8')],_0x53c7be[_0x05f9('0x9')],_0x53c7be[_0x05f9('0xa')]));if(_0x53c7be[_0x05f9('0x7')]){utils[_0x05f9('0xb')](_0x53c7be[_0x05f9('0x7')])['then'](function(_0x495768){if(_0x495768){_0x53c7be[_0x05f9('0x9')]=_0x495768[_0x05f9('0xc')];_0x53c7be['internal']=_0x495768['internal'];utils['request']('CreateMemberReport',_0x53c7be);}else{utils['getUserByName'](_0x53c7be[_0x05f9('0x7')][_0x05f9('0xd')]('/')[0x1])['then'](function(_0x5a63bc){if(_0x5a63bc){_0x53c7be[_0x05f9('0x9')]=_0x5a63bc['name'];_0x53c7be[_0x05f9('0xe')]=_0x5a63bc[_0x05f9('0xe')];utils[_0x05f9('0xf')](_0x05f9('0x10'),_0x53c7be);}});}})[_0x05f9('0x11')](function(_0x1659f8){utils[_0x05f9('0x12')](util['format'](_0x05f9('0x13'),_0x53c7be['uniqueid']),_0x1659f8);});}delete members[_0x53c7be[_0x05f9('0x7')]];}function startsWith(_0x5bbb6d,_0xe18ce9){return _[_0x05f9('0x14')](_0x5bbb6d,function(_0x548233){return _[_0x05f9('0x15')](_0xe18ce9,_0x548233);});}exports[_0x05f9('0x16')]=function(_0x12a553){try{utils[_0x05f9('0x17')](util[_0x05f9('0x4')]('[%s][members][devicestatechange]',members[_0x12a553['device']]?members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x6')]:_0x12a553[_0x05f9('0x18')]),_0x12a553);utils[_0x05f9('0x3')](util['format'](_0x05f9('0x19'),members[_0x12a553[_0x05f9('0x18')]]?members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x6')]:_0x12a553[_0x05f9('0x18')],_0x12a553[_0x05f9('0x1a')],_0x12a553[_0x05f9('0x18')]));switch(_0x12a553['state']){case _0x05f9('0x1b'):case _0x05f9('0x1c'):if(!startsWith(exclude,_0x12a553[_0x05f9('0x18')])){members[_0x12a553[_0x05f9('0x18')]]={'channel':_0x05f9('0x1d'),'interface':_0x12a553[_0x05f9('0x18')],'type':_0x05f9('0x1e'),'enterAt':utils['now'](),'role':_0x05f9('0x1f')};}break;case'NOT_INUSE':if(!_[_0x05f9('0x20')](members[_0x12a553[_0x05f9('0x18')]])){members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x21')]=utils[_0x05f9('0x22')]();members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x23')]=utils[_0x05f9('0x24')](members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x21')],members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x25')]);if(members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x6')]){writeDB(members[_0x12a553[_0x05f9('0x18')]]);}}break;default:break;}}catch(_0x522dfa){utils[_0x05f9('0x12')](util[_0x05f9('0x4')]('[%s][members][devicestatechange]',members[_0x12a553[_0x05f9('0x18')]]?members[_0x12a553[_0x05f9('0x18')]][_0x05f9('0x6')]:_0x12a553[_0x05f9('0x18')]),_0x522dfa);}};exports[_0x05f9('0x26')]=function(_0x3ec0fa){try{if(!_[_0x05f9('0x20')](members[_0x3ec0fa[_0x05f9('0x7')]])){utils['debug'](util[_0x05f9('0x4')](_0x05f9('0x27'),_0x3ec0fa['uniqueid']),_0x3ec0fa);utils[_0x05f9('0x3')](util[_0x05f9('0x4')](_0x05f9('0x28'),_0x3ec0fa[_0x05f9('0x6')],_0x3ec0fa[_0x05f9('0x7')],_0x3ec0fa['queue']));members[_0x3ec0fa['interface']]=_[_0x05f9('0x29')](members[_0x3ec0fa[_0x05f9('0x7')]],{'data4':_0x3ec0fa[_0x05f9('0x2a')],'uniqueid':_0x3ec0fa[_0x05f9('0x6')]});}}catch(_0x4c9422){utils[_0x05f9('0x12')](util[_0x05f9('0x4')](_0x05f9('0x27'),_0x3ec0fa[_0x05f9('0x6')]),_0x4c9422);}};exports[_0x05f9('0x2b')]=function(_0x28f595){try{utils[_0x05f9('0x17')](util[_0x05f9('0x4')](_0x05f9('0x2c'),_0x28f595[_0x05f9('0x6')]),_0x28f595);if(_0x28f595[_0x05f9('0x2d')]){var _0x153242=_0x28f595[_0x05f9('0x2d')][_0x05f9('0xd')]('-')[0x0];if(!_[_0x05f9('0x20')](members[_0x153242])){members[_0x153242]=_['assign'](members[_0x153242],{'data1':members[_0x153242][_0x05f9('0x2e')]||_0x28f595[_0x05f9('0xa')],'data2':members[_0x153242][_0x05f9('0x8')]||_0x28f595['source'],'data3':members[_0x153242][_0x05f9('0x2f')]||_0x28f595['destination'],'uniqueid':members[_0x153242]['uniqueid']||_0x28f595['uniqueid']});utils[_0x05f9('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x28f595[_0x05f9('0x6')],members[_0x153242][_0x05f9('0x2e')],members[_0x153242]['data2'],members[_0x153242][_0x05f9('0x2f')]));if(members[_0x153242][_0x05f9('0x21')]){writeDB(members[_0x153242]);}}}if(_0x28f595[_0x05f9('0x30')]){var _0x1091ad=_0x28f595['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x1091ad])){members[_0x1091ad]=_[_0x05f9('0x29')](members[_0x1091ad],{'data1':members[_0x1091ad]['data1']||_0x28f595[_0x05f9('0xa')],'data2':members[_0x1091ad][_0x05f9('0x8')]||_0x28f595[_0x05f9('0x31')],'data3':members[_0x1091ad][_0x05f9('0x2f')]||_0x28f595[_0x05f9('0x32')],'uniqueid':members[_0x1091ad][_0x05f9('0x6')]||_0x28f595[_0x05f9('0x6')]});utils['info'](util['format'](_0x05f9('0x33'),_0x28f595[_0x05f9('0x6')],members[_0x1091ad]['data1'],members[_0x1091ad][_0x05f9('0x8')],members[_0x1091ad][_0x05f9('0x2f')]));if(members[_0x1091ad][_0x05f9('0x21')]){writeDB(members[_0x1091ad]);}}}}catch(_0x556e3b){utils[_0x05f9('0x12')](util[_0x05f9('0x4')]('[%s][members][cdr]',_0x28f595[_0x05f9('0x6')]),_0x556e3b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8a70497..3bebd7c 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 _0x0bc4=['mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','error','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','calleridnum','calleridname','holdtime'];(function(_0x3d883a,_0x14b667){var _0x2a0299=function(_0x2a3875){while(--_0x2a3875){_0x3d883a['push'](_0x3d883a['shift']());}};_0x2a0299(++_0x14b667);}(_0x0bc4,0x136));var _0x40bc=function(_0x3ea40b,_0x44e4f6){_0x3ea40b=_0x3ea40b-0x0;var _0x49dca9=_0x0bc4[_0x3ea40b];return _0x49dca9;};'use strict';var _=require(_0x40bc('0x0'));var util=require(_0x40bc('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x12150d){utils[_0x40bc('0x2')](util['format'](_0x40bc('0x3'),_0x12150d[_0x40bc('0x4')],_0x12150d['channel'],_0x12150d[_0x40bc('0x5')],_0x12150d['lastAssignedTo'],_0x12150d['calleridnum'],_0x12150d[_0x40bc('0x6')],_0x12150d[_0x40bc('0x7')]));if(_0x12150d[_0x40bc('0x5')]){utils[_0x40bc('0x8')](_0x12150d[_0x40bc('0x5')])['then'](function(_0x1757d7){if(_0x1757d7){_0x12150d['type']=_0x1757d7[_0x40bc('0x9')];}utils[_0x40bc('0xa')](_0x40bc('0xb'),_0x12150d);});}else{utils['request'](_0x40bc('0xb'),_0x12150d);}if(_0x12150d[_0x40bc('0xc')]){delete queues[_0x12150d[_0x40bc('0xc')]];}else{delete queues[_0x12150d[_0x40bc('0x4')]];}}exports[_0x40bc('0xd')]=function(_0x5de479){try{utils[_0x40bc('0xe')](util[_0x40bc('0xf')](_0x40bc('0x10'),_0x5de479['uniqueid']),_0x5de479);utils[_0x40bc('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5de479[_0x40bc('0x4')],_0x5de479['queue'],_0x5de479['position']));queues[_0x5de479[_0x40bc('0x4')]]=_[_0x40bc('0x11')](_0x5de479,{'originalposition':_0x5de479[_0x40bc('0x12')],'queuecallerjoinAt':utils[_0x40bc('0x13')](),'mohtime':0x0});}catch(_0x38eb0c){utils['error'](util['format'](_0x40bc('0x10'),_0x5de479[_0x40bc('0x4')]),_0x38eb0c);}};exports[_0x40bc('0x14')]=function(_0x4442b5){try{if(!_[_0x40bc('0x15')](queues[_0x4442b5[_0x40bc('0x4')]])){utils['debug'](util[_0x40bc('0xf')](_0x40bc('0x16'),_0x4442b5[_0x40bc('0x4')]),_0x4442b5);if(queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x17')]){if(!queues[_0x4442b5['uniqueid']]['queuecallerabandon']&&!queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x18')]){queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x19')]=!![];queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x1a')]=utils['now']();queues[_0x4442b5[_0x40bc('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x40bc('0x2')](util[_0x40bc('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4442b5[_0x40bc('0x4')],queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x1b')],queues[_0x4442b5[_0x40bc('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x4442b5[_0x40bc('0x4')]]);}else if(queues[_0x4442b5[_0x40bc('0x4')]]['transfereduniqueid']){utils[_0x40bc('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4442b5[_0x40bc('0x4')],queues[_0x4442b5[_0x40bc('0x4')]][_0x40bc('0x1b')],queues[_0x4442b5[_0x40bc('0x4')]]['transfereduniqueid']));queues[queues[_0x4442b5[_0x40bc('0x4')]]['transfereduniqueid']]=queues[_0x4442b5[_0x40bc('0x4')]];queues[queues[_0x4442b5[_0x40bc('0x4')]]['transfereduniqueid']][_0x40bc('0x1c')]=0x2;delete queues[_0x4442b5[_0x40bc('0x4')]];}}}catch(_0x188b23){utils['error'](util[_0x40bc('0xf')](_0x40bc('0x16'),_0x4442b5[_0x40bc('0x4')]),_0x188b23);}};exports[_0x40bc('0x1d')]=function(_0x34951a){try{utils[_0x40bc('0xe')](util['format']('[%s][queues][varset]',_0x34951a[_0x40bc('0x4')]),_0x34951a);if(!_[_0x40bc('0x15')](_0x34951a[_0x40bc('0x1e')][_0x40bc('0x1f')])&&_0x34951a[_0x40bc('0x20')][_0x40bc('0x21')]()!==_0x40bc('0x22')){if(!_[_0x40bc('0x15')](queues[_0x34951a[_0x40bc('0x4')]])){queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x24')]=null;queues[_0x34951a[_0x40bc('0x4')]]['queuecallerexit']=!![];queues[_0x34951a['uniqueid']]['queuecallerexitAt']=utils[_0x40bc('0x13')]();queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x7')]=_0x34951a['value'][_0x40bc('0x21')]();utils[_0x40bc('0x2')](util[_0x40bc('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x34951a['uniqueid'],queues[_0x34951a[_0x40bc('0x4')]]['name'],_0x34951a['value'],queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x7')]));writeDB(queues[_0x34951a[_0x40bc('0x4')]]);}}else if(!_[_0x40bc('0x15')](_0x34951a[_0x40bc('0x1e')]['queueposition'])){if(!_[_0x40bc('0x15')](queues[_0x34951a[_0x40bc('0x4')]])&&!queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x23')]){queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x34951a[_0x40bc('0x4')]]['queuecallerabandonAt']=null;queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x18')]=!![];queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x25')]=utils[_0x40bc('0x13')]();queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x7')]=_0x40bc('0x26');utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x27'),_0x34951a['uniqueid'],queues[_0x34951a[_0x40bc('0x4')]][_0x40bc('0x1b')],_0x34951a[_0x40bc('0x20')],queues[_0x34951a[_0x40bc('0x4')]]['queuecallerexitreason']));}}}catch(_0x598355){utils['error'](util[_0x40bc('0xf')](_0x40bc('0x28'),_0x34951a['uniqueid']),_0x598355);}};exports[_0x40bc('0x23')]=function(_0x1a9225){try{if(!_[_0x40bc('0x15')](queues[_0x1a9225[_0x40bc('0x4')]])){utils[_0x40bc('0xe')](util[_0x40bc('0xf')](_0x40bc('0x29'),_0x1a9225[_0x40bc('0x4')]),_0x1a9225);queues[_0x1a9225[_0x40bc('0x4')]][_0x40bc('0x18')]=![];queues[_0x1a9225[_0x40bc('0x4')]][_0x40bc('0x25')]=null;queues[_0x1a9225['uniqueid']]['queuecallerabandon']=!![];queues[_0x1a9225['uniqueid']][_0x40bc('0x24')]=utils[_0x40bc('0x13')]();queues[_0x1a9225[_0x40bc('0x4')]][_0x40bc('0x7')]=_0x40bc('0x2a');utils[_0x40bc('0x2')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1a9225[_0x40bc('0x4')],queues[_0x1a9225[_0x40bc('0x4')]][_0x40bc('0x1b')],queues[_0x1a9225['uniqueid']][_0x40bc('0x7')]));}}catch(_0x54ec23){utils[_0x40bc('0x2b')](util[_0x40bc('0xf')](_0x40bc('0x29'),_0x1a9225[_0x40bc('0x4')]),_0x54ec23);}};exports['queuecallerleave']=function(_0xd279ed){try{if(!_['isNil'](queues[_0xd279ed[_0x40bc('0x4')]])){utils[_0x40bc('0xe')](util[_0x40bc('0xf')](_0x40bc('0x2c'),_0xd279ed[_0x40bc('0x4')]),_0xd279ed);utils[_0x40bc('0x2')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xd279ed[_0x40bc('0x4')],queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x1b')],_0xd279ed[_0x40bc('0x2d')],_0xd279ed[_0x40bc('0x2e')]));queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x2f')]=!![];queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x17')]=utils['now']();queues[_0xd279ed[_0x40bc('0x4')]]['holdtime']=utils[_0x40bc('0x30')](queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x17')],queues[_0xd279ed['uniqueid']][_0x40bc('0x31')]);queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x12')]=_0xd279ed['position'];queues[_0xd279ed[_0x40bc('0x4')]]['count']=_0xd279ed[_0x40bc('0x32')];queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x2d')]=_0xd279ed[_0x40bc('0x2d')];queues[_0xd279ed[_0x40bc('0x4')]][_0x40bc('0x2e')]=_0xd279ed[_0x40bc('0x2e')];}}catch(_0x196c0d){utils[_0x40bc('0x2b')](util['format'](_0x40bc('0x2c'),_0xd279ed[_0x40bc('0x4')]),_0x196c0d);}};exports['agentconnect']=function(_0x1e7f1f){try{if(!_[_0x40bc('0x15')](queues[_0x1e7f1f[_0x40bc('0x4')]])){utils[_0x40bc('0xe')](util[_0x40bc('0xf')]('[%s][queues][agentconnect]',_0x1e7f1f[_0x40bc('0x4')]),_0x1e7f1f);utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x33'),_0x1e7f1f['uniqueid'],queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x1b')],_0x1e7f1f[_0x40bc('0x34')],_0x1e7f1f[_0x40bc('0x35')]));queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x24')]=null;queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x18')]=![];queues[_0x1e7f1f['uniqueid']][_0x40bc('0x7')]=null;queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x25')]=null;queues[_0x1e7f1f[_0x40bc('0x4')]]['assigned']=!![];queues[_0x1e7f1f[_0x40bc('0x4')]][_0x40bc('0x6')]=_0x1e7f1f[_0x40bc('0x35')];queues[_0x1e7f1f[_0x40bc('0x4')]]['lastAssignedTo']=_0x1e7f1f[_0x40bc('0x34')];}}catch(_0x40dc74){utils[_0x40bc('0x2b')](util[_0x40bc('0xf')](_0x40bc('0x36'),_0x1e7f1f[_0x40bc('0x4')]),_0x40dc74);}};exports[_0x40bc('0x37')]=function(_0x47f81e){try{if(!_[_0x40bc('0x15')](queues[_0x47f81e[_0x40bc('0x4')]])){if(queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x17')]){utils[_0x40bc('0xe')](util[_0x40bc('0xf')]('[%s][queues][agentcomplete]',_0x47f81e[_0x40bc('0x4')]),_0x47f81e);queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x23')]=![];queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x24')]=null;queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x18')]=![];queues[_0x47f81e[_0x40bc('0x4')]]['queuecallerexitAt']=null;queues[_0x47f81e[_0x40bc('0x4')]]['assigned']=!![];queues[_0x47f81e[_0x40bc('0x4')]]['lastAssignedTo']=_0x47f81e[_0x40bc('0x34')];queues[_0x47f81e[_0x40bc('0x4')]]['queuecallercomplete']=!![];queues[_0x47f81e[_0x40bc('0x4')]]['queuecallercompleteAt']=utils[_0x40bc('0x13')]();if(_0x47f81e['reason']==_0x40bc('0x38')){if(!queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x38')]){queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x7')]=_0x40bc('0x39');}}else{queues[_0x47f81e['uniqueid']]['queuecallerexitreason']=_0x40bc('0x3a')+_0x47f81e[_0x40bc('0x3b')][_0x40bc('0x21')]();}utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x3c'),_0x47f81e[_0x40bc('0x4')],queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x1b')],_0x47f81e['membername'],queues[_0x47f81e[_0x40bc('0x4')]][_0x40bc('0x7')]));writeDB(queues[_0x47f81e[_0x40bc('0x4')]]);}}}catch(_0x300f59){utils['error'](util[_0x40bc('0xf')](_0x40bc('0x3d'),_0x47f81e[_0x40bc('0x4')]),_0x300f59);}};exports['blindtransfer']=function(_0x35705f){try{if(!_[_0x40bc('0x15')](queues[_0x35705f['transfereeuniqueid']])){utils[_0x40bc('0xe')](util[_0x40bc('0xf')](_0x40bc('0x3e'),_0x35705f['uniqueid']),_0x35705f);queues[_0x35705f['transfereeuniqueid']][_0x40bc('0x38')]=!![];queues[_0x35705f[_0x40bc('0x3f')]][_0x40bc('0x40')]=_0x40bc('0x41');queues[_0x35705f[_0x40bc('0x3f')]][_0x40bc('0x42')]=_0x35705f[_0x40bc('0x43')];queues[_0x35705f[_0x40bc('0x3f')]][_0x40bc('0x44')]=_0x35705f['transfereeuniqueid'];queues[_0x35705f[_0x40bc('0x3f')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x45'),_0x35705f[_0x40bc('0x4')],queues[_0x35705f[_0x40bc('0x3f')]][_0x40bc('0x1b')],_0x35705f[_0x40bc('0x3f')],_0x35705f['extension']));}}catch(_0x5cf4c3){utils[_0x40bc('0x2b')](util[_0x40bc('0xf')](_0x40bc('0x3e'),_0x35705f[_0x40bc('0x4')]),_0x5cf4c3);}};exports[_0x40bc('0x46')]=function(_0xd910a2){try{utils[_0x40bc('0xe')](util[_0x40bc('0xf')](_0x40bc('0x47'),_0xd910a2['origtransfereruniqueid']),_0xd910a2);if(_0xd910a2[_0x40bc('0x48')]==_0xd910a2[_0x40bc('0x49')]){if(!_[_0x40bc('0x15')](queues[_0xd910a2['secondtransfererlinkedid']])){utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x4a'),_0xd910a2[_0x40bc('0x48')],queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0x1b')],_0xd910a2['origtransfererexten']));queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0x38')]=!![];queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0x40')]=_0x40bc('0x4c');queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0x42')]=_0xd910a2['origtransfererexten'];queues[_0xd910a2['secondtransfererlinkedid']][_0x40bc('0x44')]=_0xd910a2['origtransfereruniqueid'];queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0x7')]=_0x40bc('0x4d');}if(!_[_0x40bc('0x15')](queues[_0xd910a2[_0x40bc('0x49')]])){if(_0xd910a2[_0x40bc('0x4e')]&&queues[_0xd910a2[_0x40bc('0x4e')]]){queues[_0xd910a2[_0x40bc('0x4e')]][_0x40bc('0x1c')]=0x1;queues[_0xd910a2[_0x40bc('0x3f')]]=_['clone'](queues[_0xd910a2[_0x40bc('0x4e')]]);queues[_0xd910a2['transfereeuniqueid']][_0x40bc('0xc')]=_0xd910a2['transfertargetuniqueid'];queues[_0xd910a2['transfereeuniqueid']][_0x40bc('0x1c')]=0x2;queues[_0xd910a2['transfereeuniqueid']][_0x40bc('0x4f')]=queues[_0xd910a2[_0x40bc('0x4b')]]['calleridnum'];queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x50')]=queues[_0xd910a2[_0x40bc('0x4b')]]['calleridname'];queues[_0xd910a2[_0x40bc('0x3f')]]['queuecallerjoinAt']=utils[_0x40bc('0x13')]();queues[_0xd910a2['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x40bc('0x13')]();queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x51')]=0x0;queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x52')]=0x0;utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x53'),_0xd910a2['origtransfereruniqueid'],queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x1b')],queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x4f')],queues[_0xd910a2[_0x40bc('0x3f')]][_0x40bc('0x50')]));}else{utils[_0x40bc('0x2')](util['format'](_0x40bc('0x54'),_0xd910a2[_0x40bc('0x48')],queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x1b')],_0xd910a2[_0x40bc('0x4b')]));queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0xc')]=_0xd910a2['secondtransfererlinkedid'];}}}else if(_0xd910a2[_0x40bc('0x55')]==_0xd910a2[_0x40bc('0x4b')]){if(!_[_0x40bc('0x15')](queues[_0xd910a2[_0x40bc('0x49')]])){utils[_0x40bc('0x2')](util['format'](_0x40bc('0x56'),_0xd910a2[_0x40bc('0x48')],queues[_0xd910a2['origtransfererlinkedid']][_0x40bc('0x1b')],_0xd910a2['secondtransfereruniqueid'],_0xd910a2[_0x40bc('0x57')]));queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x38')]=!![];queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x40')]='ATTENDED';queues[_0xd910a2['origtransfererlinkedid']][_0x40bc('0x42')]=_0xd910a2[_0x40bc('0x57')];queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x44')]=_0xd910a2[_0x40bc('0x55')];queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x40bc('0x15')](queues[_0xd910a2[_0x40bc('0x4b')]])){if(_0xd910a2[_0x40bc('0x58')]&&queues[_0xd910a2[_0x40bc('0x58')]]){queues[_0xd910a2['transfertargetlinkedid']][_0x40bc('0x1c')]=0x1;queues[_0xd910a2[_0x40bc('0x59')]]=_[_0x40bc('0x5a')](queues[_0xd910a2[_0x40bc('0x58')]]);queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0xc')]=_0xd910a2['transfertargetuniqueid'];queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x1c')]=0x2;queues[_0xd910a2[_0x40bc('0x59')]][_0x40bc('0x4f')]=queues[_0xd910a2[_0x40bc('0x49')]][_0x40bc('0x4f')];queues[_0xd910a2[_0x40bc('0x59')]]['calleridname']=queues[_0xd910a2['origtransfererlinkedid']][_0x40bc('0x50')];queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x31')]=utils[_0x40bc('0x13')]();queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x17')]=utils[_0x40bc('0x13')]();queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x51')]=0x0;queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x52')]=0x0;utils[_0x40bc('0x2')](util[_0x40bc('0xf')](_0x40bc('0x5b'),_0xd910a2[_0x40bc('0x48')],queues[_0xd910a2['transfertargetuniqueid']][_0x40bc('0x1b')],queues[_0xd910a2['transfertargetuniqueid']]['transfereduniqueid'],queues[_0xd910a2[_0x40bc('0x59')]][_0x40bc('0x4f')],queues[_0xd910a2['transfertargetuniqueid']]['calleridname']));}else{utils[_0x40bc('0x2')](util['format'](_0x40bc('0x54'),_0xd910a2['origtransfereruniqueid'],queues[_0xd910a2['secondtransfererlinkedid']][_0x40bc('0x1b')],_0xd910a2[_0x40bc('0x49')]));queues[_0xd910a2[_0x40bc('0x4b')]][_0x40bc('0xc')]=_0xd910a2[_0x40bc('0x49')];}}}}catch(_0x843509){utils[_0x40bc('0x2b')](util['format']('[%s][queues][attendedtransfer]',_0xd910a2[_0x40bc('0x48')]),_0x843509);}};exports[_0x40bc('0x5c')]=function(_0x3822a2){try{if(!_[_0x40bc('0x15')](queues[_0x3822a2['uniqueid']])){utils[_0x40bc('0xe')](util['format'](_0x40bc('0x5d'),_0x3822a2[_0x40bc('0x4')]),_0x3822a2);queues[_0x3822a2[_0x40bc('0x4')]][_0x40bc('0x5e')]=utils['now']();utils['info'](util[_0x40bc('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3822a2[_0x40bc('0x4')],queues[_0x3822a2[_0x40bc('0x4')]][_0x40bc('0x1b')],queues[_0x3822a2[_0x40bc('0x4')]][_0x40bc('0x5e')]));}}catch(_0x3ba8eb){utils['error'](util[_0x40bc('0xf')](_0x40bc('0x5d'),_0x3822a2[_0x40bc('0x4')]),_0x3ba8eb);}};exports[_0x40bc('0x5f')]=function(_0x5385bd){try{if(!_['isNil'](queues[_0x5385bd[_0x40bc('0x4')]])){if(!_[_0x40bc('0x15')](queues[_0x5385bd[_0x40bc('0x4')]][_0x40bc('0x5e')])){utils[_0x40bc('0xe')](util[_0x40bc('0xf')]('[%s][queues][musiconholdstop]',_0x5385bd[_0x40bc('0x4')]),_0x5385bd);queues[_0x5385bd[_0x40bc('0x4')]][_0x40bc('0x52')]+=utils[_0x40bc('0x30')](utils[_0x40bc('0x13')](),queues[_0x5385bd['uniqueid']][_0x40bc('0x5e')]);utils['info'](util[_0x40bc('0xf')](_0x40bc('0x60'),_0x5385bd[_0x40bc('0x4')],queues[_0x5385bd[_0x40bc('0x4')]][_0x40bc('0x1b')],queues[_0x5385bd[_0x40bc('0x4')]][_0x40bc('0x52')]));delete queues[_0x5385bd[_0x40bc('0x4')]]['musiconholdstartAt'];}}}catch(_0x49b229){utils[_0x40bc('0x2b')](util[_0x40bc('0xf')](_0x40bc('0x61'),_0x5385bd[_0x40bc('0x4')]),_0x49b229);}}; \ No newline at end of file +var _0xb036=['CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase'];(function(_0x1ea04b,_0xc34175){var _0x534868=function(_0x3c5319){while(--_0x3c5319){_0x1ea04b['push'](_0x1ea04b['shift']());}};_0x534868(++_0xc34175);}(_0xb036,0xaf));var _0x6b03=function(_0x1d446b,_0x5e4581){_0x1d446b=_0x1d446b-0x0;var _0x8e658a=_0xb036[_0x1d446b];return _0x8e658a;};'use strict';var _=require(_0x6b03('0x0'));var util=require(_0x6b03('0x1'));var utils=require(_0x6b03('0x2'));var queues={};function writeDB(_0x1693cd){utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x5'),_0x1693cd[_0x6b03('0x6')],_0x1693cd[_0x6b03('0x7')],_0x1693cd[_0x6b03('0x8')],_0x1693cd[_0x6b03('0x9')],_0x1693cd['calleridnum'],_0x1693cd[_0x6b03('0xa')],_0x1693cd[_0x6b03('0xb')]));if(_0x1693cd[_0x6b03('0x8')]){utils['getVoiceQueueByName'](_0x1693cd['queue'])['then'](function(_0x59d75e){if(_0x59d75e){_0x1693cd[_0x6b03('0xc')]=_0x59d75e[_0x6b03('0xc')];}utils['request'](_0x6b03('0xd'),_0x1693cd);});}else{utils[_0x6b03('0xe')](_0x6b03('0xd'),_0x1693cd);}if(_0x1693cd[_0x6b03('0xf')]){delete queues[_0x1693cd[_0x6b03('0xf')]];}else{delete queues[_0x1693cd['uniqueid']];}}exports[_0x6b03('0x10')]=function(_0x301edd){try{utils[_0x6b03('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x301edd[_0x6b03('0x6')]),_0x301edd);utils[_0x6b03('0x3')](util[_0x6b03('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x301edd[_0x6b03('0x6')],_0x301edd['queue'],_0x301edd[_0x6b03('0x12')]));queues[_0x301edd[_0x6b03('0x6')]]=_[_0x6b03('0x13')](_0x301edd,{'originalposition':_0x301edd[_0x6b03('0x12')],'queuecallerjoinAt':utils[_0x6b03('0x14')](),'mohtime':0x0});}catch(_0x39b666){utils[_0x6b03('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x301edd[_0x6b03('0x6')]),_0x39b666);}};exports[_0x6b03('0x16')]=function(_0x229c3a){try{if(!_[_0x6b03('0x17')](queues[_0x229c3a[_0x6b03('0x6')]])){utils['debug'](util[_0x6b03('0x4')]('[%s][queues][hangup]',_0x229c3a[_0x6b03('0x6')]),_0x229c3a);if(queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0x18')]){if(!queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0x19')]&&!queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0x1a')]){queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0x1b')]=!![];queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0x1c')]=utils[_0x6b03('0x14')]();queues[_0x229c3a[_0x6b03('0x6')]]['queuecallerexitreason']=_0x6b03('0x1d');}utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x1e'),_0x229c3a[_0x6b03('0x6')],queues[_0x229c3a['uniqueid']][_0x6b03('0x1f')],queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0xb')]));writeDB(queues[_0x229c3a[_0x6b03('0x6')]]);}else if(queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0xf')]){utils['info'](util[_0x6b03('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x229c3a['uniqueid'],queues[_0x229c3a[_0x6b03('0x6')]]['name'],queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0xf')]));queues[queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0xf')]]=queues[_0x229c3a[_0x6b03('0x6')]];queues[queues[_0x229c3a[_0x6b03('0x6')]][_0x6b03('0xf')]][_0x6b03('0x20')]=0x2;delete queues[_0x229c3a[_0x6b03('0x6')]];}}}catch(_0x59ed2f){utils[_0x6b03('0x15')](util[_0x6b03('0x4')](_0x6b03('0x21'),_0x229c3a['uniqueid']),_0x59ed2f);}};exports[_0x6b03('0x22')]=function(_0xcc0f6a){try{utils[_0x6b03('0x11')](util[_0x6b03('0x4')](_0x6b03('0x23'),_0xcc0f6a[_0x6b03('0x6')]),_0xcc0f6a);if(!_[_0x6b03('0x17')](_0xcc0f6a['variable'][_0x6b03('0x24')])&&_0xcc0f6a[_0x6b03('0x25')][_0x6b03('0x26')]()!==_0x6b03('0x27')){if(!_[_0x6b03('0x17')](queues[_0xcc0f6a[_0x6b03('0x6')]])){queues[_0xcc0f6a['uniqueid']]['queuecallerabandon']=![];queues[_0xcc0f6a[_0x6b03('0x6')]]['queuecallerabandonAt']=null;queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0x1a')]=!![];queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0x28')]=utils[_0x6b03('0x14')]();queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0xb')]=_0xcc0f6a[_0x6b03('0x25')][_0x6b03('0x26')]();utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x29'),_0xcc0f6a[_0x6b03('0x6')],queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0x1f')],_0xcc0f6a[_0x6b03('0x25')],queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0xb')]));writeDB(queues[_0xcc0f6a[_0x6b03('0x6')]]);}}else if(!_['isNil'](_0xcc0f6a['variable'][_0x6b03('0x2a')])){if(!_['isNil'](queues[_0xcc0f6a['uniqueid']])&&!queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0x19')]){queues[_0xcc0f6a['uniqueid']][_0x6b03('0x19')]=![];queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0x2b')]=null;queues[_0xcc0f6a['uniqueid']]['queuecallerexit']=!![];queues[_0xcc0f6a['uniqueid']]['queuecallerexitAt']=utils[_0x6b03('0x14')]();queues[_0xcc0f6a[_0x6b03('0x6')]]['queuecallerexitreason']=_0x6b03('0x2c');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xcc0f6a['uniqueid'],queues[_0xcc0f6a[_0x6b03('0x6')]]['name'],_0xcc0f6a[_0x6b03('0x25')],queues[_0xcc0f6a[_0x6b03('0x6')]][_0x6b03('0xb')]));}}}catch(_0x36bbd7){utils[_0x6b03('0x15')](util['format']('[%s][queues][varset]',_0xcc0f6a[_0x6b03('0x6')]),_0x36bbd7);}};exports[_0x6b03('0x19')]=function(_0x18f091){try{if(!_['isNil'](queues[_0x18f091[_0x6b03('0x6')]])){utils[_0x6b03('0x11')](util['format'](_0x6b03('0x2d'),_0x18f091[_0x6b03('0x6')]),_0x18f091);queues[_0x18f091[_0x6b03('0x6')]][_0x6b03('0x1a')]=![];queues[_0x18f091['uniqueid']][_0x6b03('0x28')]=null;queues[_0x18f091[_0x6b03('0x6')]][_0x6b03('0x19')]=!![];queues[_0x18f091[_0x6b03('0x6')]][_0x6b03('0x2b')]=utils[_0x6b03('0x14')]();queues[_0x18f091['uniqueid']][_0x6b03('0xb')]=_0x6b03('0x2e');utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x2f'),_0x18f091[_0x6b03('0x6')],queues[_0x18f091[_0x6b03('0x6')]][_0x6b03('0x1f')],queues[_0x18f091[_0x6b03('0x6')]]['queuecallerexitreason']));}}catch(_0x4508ec){utils[_0x6b03('0x15')](util['format']('[%s][queues][queuecallerabandon]',_0x18f091[_0x6b03('0x6')]),_0x4508ec);}};exports[_0x6b03('0x30')]=function(_0x205b48){try{if(!_['isNil'](queues[_0x205b48[_0x6b03('0x6')]])){utils[_0x6b03('0x11')](util[_0x6b03('0x4')](_0x6b03('0x31'),_0x205b48[_0x6b03('0x6')]),_0x205b48);utils['info'](util['format'](_0x6b03('0x32'),_0x205b48[_0x6b03('0x6')],queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x1f')],_0x205b48[_0x6b03('0x33')],_0x205b48['connectedlinename']));queues[_0x205b48[_0x6b03('0x6')]]['queuecallerleave']=!![];queues[_0x205b48['uniqueid']][_0x6b03('0x18')]=utils[_0x6b03('0x14')]();queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x34')]=utils['diffTime'](queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x18')],queues[_0x205b48[_0x6b03('0x6')]]['queuecallerjoinAt']);queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x12')]=_0x205b48['position'];queues[_0x205b48['uniqueid']]['count']=_0x205b48['count'];queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x33')]=_0x205b48[_0x6b03('0x33')];queues[_0x205b48[_0x6b03('0x6')]][_0x6b03('0x35')]=_0x205b48[_0x6b03('0x35')];}}catch(_0x47a489){utils['error'](util[_0x6b03('0x4')](_0x6b03('0x31'),_0x205b48[_0x6b03('0x6')]),_0x47a489);}};exports[_0x6b03('0x36')]=function(_0x4ccbb9){try{if(!_[_0x6b03('0x17')](queues[_0x4ccbb9[_0x6b03('0x6')]])){utils['debug'](util[_0x6b03('0x4')](_0x6b03('0x37'),_0x4ccbb9[_0x6b03('0x6')]),_0x4ccbb9);utils[_0x6b03('0x3')](util['format'](_0x6b03('0x38'),_0x4ccbb9['uniqueid'],queues[_0x4ccbb9[_0x6b03('0x6')]][_0x6b03('0x1f')],_0x4ccbb9[_0x6b03('0x39')],_0x4ccbb9[_0x6b03('0x3a')]));queues[_0x4ccbb9[_0x6b03('0x6')]]['queuecallerabandon']=![];queues[_0x4ccbb9[_0x6b03('0x6')]][_0x6b03('0x19')]=![];queues[_0x4ccbb9[_0x6b03('0x6')]][_0x6b03('0x2b')]=null;queues[_0x4ccbb9['uniqueid']][_0x6b03('0x1a')]=![];queues[_0x4ccbb9[_0x6b03('0x6')]]['queuecallerexitreason']=null;queues[_0x4ccbb9['uniqueid']]['queuecallerexitAt']=null;queues[_0x4ccbb9[_0x6b03('0x6')]]['assigned']=!![];queues[_0x4ccbb9['uniqueid']][_0x6b03('0xa')]=_0x4ccbb9[_0x6b03('0x3a')];queues[_0x4ccbb9[_0x6b03('0x6')]][_0x6b03('0x9')]=_0x4ccbb9['membername'];}}catch(_0x10075b){utils[_0x6b03('0x15')](util['format'](_0x6b03('0x37'),_0x4ccbb9[_0x6b03('0x6')]),_0x10075b);}};exports[_0x6b03('0x3b')]=function(_0x3a12f6){try{if(!_[_0x6b03('0x17')](queues[_0x3a12f6[_0x6b03('0x6')]])){if(queues[_0x3a12f6[_0x6b03('0x6')]]['queuecallerleaveAt']){utils[_0x6b03('0x11')](util[_0x6b03('0x4')]('[%s][queues][agentcomplete]',_0x3a12f6['uniqueid']),_0x3a12f6);queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x19')]=![];queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x19')]=![];queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x2b')]=null;queues[_0x3a12f6[_0x6b03('0x6')]]['queuecallerexit']=![];queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x28')]=null;queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x3c')]=!![];queues[_0x3a12f6[_0x6b03('0x6')]]['lastAssignedTo']=_0x3a12f6[_0x6b03('0x39')];queues[_0x3a12f6['uniqueid']][_0x6b03('0x1b')]=!![];queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x1c')]=utils[_0x6b03('0x14')]();if(_0x3a12f6[_0x6b03('0x3d')]==_0x6b03('0x3e')){if(!queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x3e')]){queues[_0x3a12f6['uniqueid']]['queuecallerexitreason']=_0x6b03('0x3f');}}else{queues[_0x3a12f6['uniqueid']][_0x6b03('0xb')]=_0x6b03('0x40')+_0x3a12f6[_0x6b03('0x3d')][_0x6b03('0x26')]();}utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x41'),_0x3a12f6[_0x6b03('0x6')],queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0x1f')],_0x3a12f6[_0x6b03('0x39')],queues[_0x3a12f6[_0x6b03('0x6')]][_0x6b03('0xb')]));writeDB(queues[_0x3a12f6[_0x6b03('0x6')]]);}}}catch(_0x205771){utils['error'](util['format'](_0x6b03('0x42'),_0x3a12f6[_0x6b03('0x6')]),_0x205771);}};exports[_0x6b03('0x43')]=function(_0x49f097){try{if(!_[_0x6b03('0x17')](queues[_0x49f097[_0x6b03('0x44')]])){utils['debug'](util[_0x6b03('0x4')](_0x6b03('0x45'),_0x49f097['uniqueid']),_0x49f097);queues[_0x49f097[_0x6b03('0x44')]][_0x6b03('0x3e')]=!![];queues[_0x49f097[_0x6b03('0x44')]]['transfertype']=_0x6b03('0x46');queues[_0x49f097[_0x6b03('0x44')]][_0x6b03('0x47')]=_0x49f097[_0x6b03('0x48')];queues[_0x49f097[_0x6b03('0x44')]][_0x6b03('0x49')]=_0x49f097[_0x6b03('0x44')];queues[_0x49f097[_0x6b03('0x44')]]['queuecallerexitreason']=_0x6b03('0x4a');utils['info'](util['format'](_0x6b03('0x4b'),_0x49f097[_0x6b03('0x6')],queues[_0x49f097['transfereeuniqueid']][_0x6b03('0x1f')],_0x49f097['transfereeuniqueid'],_0x49f097[_0x6b03('0x48')]));}}catch(_0x51d7f9){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x49f097['uniqueid']),_0x51d7f9);}};exports[_0x6b03('0x4c')]=function(_0x4dea2b){try{utils['debug'](util[_0x6b03('0x4')]('[%s][queues][attendedtransfer]',_0x4dea2b[_0x6b03('0x4d')]),_0x4dea2b);if(_0x4dea2b[_0x6b03('0x4d')]==_0x4dea2b[_0x6b03('0x4e')]){if(!_[_0x6b03('0x17')](queues[_0x4dea2b[_0x6b03('0x4f')]])){utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x50'),_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x4f')]]['name'],_0x4dea2b[_0x6b03('0x51')]));queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x3e')]=!![];queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x52')]=_0x6b03('0x53');queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x47')]=_0x4dea2b[_0x6b03('0x51')];queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x49')]=_0x4dea2b['origtransfereruniqueid'];queues[_0x4dea2b['secondtransfererlinkedid']][_0x6b03('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x6b03('0x17')](queues[_0x4dea2b[_0x6b03('0x4e')]])){if(_0x4dea2b[_0x6b03('0x54')]&&queues[_0x4dea2b[_0x6b03('0x54')]]){queues[_0x4dea2b[_0x6b03('0x54')]]['queuecallerenterreason']=0x1;queues[_0x4dea2b[_0x6b03('0x44')]]=_[_0x6b03('0x55')](queues[_0x4dea2b[_0x6b03('0x54')]]);queues[_0x4dea2b['transfereeuniqueid']]['transfereduniqueid']=_0x4dea2b[_0x6b03('0x56')];queues[_0x4dea2b['transfereeuniqueid']][_0x6b03('0x20')]=0x2;queues[_0x4dea2b[_0x6b03('0x44')]]['calleridnum']=queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x57')];queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x58')]=queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x58')];queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x59')]=utils[_0x6b03('0x14')]();queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x18')]=utils['now']();queues[_0x4dea2b['transfereeuniqueid']][_0x6b03('0x34')]=0x0;queues[_0x4dea2b['transfereeuniqueid']][_0x6b03('0x5a')]=0x0;utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x5b'),_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x1f')],queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x57')],queues[_0x4dea2b[_0x6b03('0x44')]][_0x6b03('0x58')]));}else{utils[_0x6b03('0x3')](util[_0x6b03('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0x1f')],_0x4dea2b['secondtransfererlinkedid']));queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0xf')]=_0x4dea2b[_0x6b03('0x4f')];}}}else if(_0x4dea2b[_0x6b03('0x5c')]==_0x4dea2b[_0x6b03('0x4f')]){if(!_[_0x6b03('0x17')](queues[_0x4dea2b['origtransfererlinkedid']])){utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x5d'),_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0x1f')],_0x4dea2b['secondtransfereruniqueid'],_0x4dea2b[_0x6b03('0x5e')]));queues[_0x4dea2b['origtransfererlinkedid']]['transfer']=!![];queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0x52')]='ATTENDED';queues[_0x4dea2b['origtransfererlinkedid']][_0x6b03('0x47')]=_0x4dea2b[_0x6b03('0x5e')];queues[_0x4dea2b['origtransfererlinkedid']][_0x6b03('0x49')]=_0x4dea2b['secondtransfereruniqueid'];queues[_0x4dea2b[_0x6b03('0x4e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x6b03('0x17')](queues[_0x4dea2b['secondtransfererlinkedid']])){if(_0x4dea2b['transfertargetlinkedid']&&queues[_0x4dea2b[_0x6b03('0x5f')]]){queues[_0x4dea2b['transfertargetlinkedid']][_0x6b03('0x20')]=0x1;queues[_0x4dea2b[_0x6b03('0x56')]]=_[_0x6b03('0x55')](queues[_0x4dea2b[_0x6b03('0x5f')]]);queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0xf')]=_0x4dea2b['transfertargetuniqueid'];queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x20')]=0x2;queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x57')]=queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0x57')];queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x58')]=queues[_0x4dea2b[_0x6b03('0x4e')]][_0x6b03('0x58')];queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x59')]=utils[_0x6b03('0x14')]();queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x18')]=utils[_0x6b03('0x14')]();queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x34')]=0x0;queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x5a')]=0x0;utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x60'),_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x56')]]['name'],queues[_0x4dea2b['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x4dea2b[_0x6b03('0x56')]]['calleridnum'],queues[_0x4dea2b[_0x6b03('0x56')]][_0x6b03('0x58')]));}else{utils[_0x6b03('0x3')](util[_0x6b03('0x4')](_0x6b03('0x61'),_0x4dea2b[_0x6b03('0x4d')],queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0x1f')],_0x4dea2b[_0x6b03('0x4e')]));queues[_0x4dea2b[_0x6b03('0x4f')]][_0x6b03('0xf')]=_0x4dea2b[_0x6b03('0x4e')];}}}}catch(_0x4c27ee){utils[_0x6b03('0x15')](util[_0x6b03('0x4')](_0x6b03('0x62'),_0x4dea2b['origtransfereruniqueid']),_0x4c27ee);}};exports[_0x6b03('0x63')]=function(_0x215391){try{if(!_[_0x6b03('0x17')](queues[_0x215391['uniqueid']])){utils[_0x6b03('0x11')](util[_0x6b03('0x4')](_0x6b03('0x64'),_0x215391['uniqueid']),_0x215391);queues[_0x215391['uniqueid']][_0x6b03('0x65')]=utils['now']();utils[_0x6b03('0x3')](util['format'](_0x6b03('0x66'),_0x215391['uniqueid'],queues[_0x215391['uniqueid']][_0x6b03('0x1f')],queues[_0x215391['uniqueid']][_0x6b03('0x65')]));}}catch(_0x1abffc){utils[_0x6b03('0x15')](util[_0x6b03('0x4')](_0x6b03('0x64'),_0x215391['uniqueid']),_0x1abffc);}};exports[_0x6b03('0x67')]=function(_0x233822){try{if(!_['isNil'](queues[_0x233822[_0x6b03('0x6')]])){if(!_[_0x6b03('0x17')](queues[_0x233822[_0x6b03('0x6')]][_0x6b03('0x65')])){utils[_0x6b03('0x11')](util[_0x6b03('0x4')](_0x6b03('0x68'),_0x233822['uniqueid']),_0x233822);queues[_0x233822[_0x6b03('0x6')]][_0x6b03('0x5a')]+=utils[_0x6b03('0x69')](utils[_0x6b03('0x14')](),queues[_0x233822[_0x6b03('0x6')]]['musiconholdstartAt']);utils['info'](util[_0x6b03('0x4')](_0x6b03('0x6a'),_0x233822[_0x6b03('0x6')],queues[_0x233822[_0x6b03('0x6')]][_0x6b03('0x1f')],queues[_0x233822[_0x6b03('0x6')]][_0x6b03('0x5a')]));delete queues[_0x233822['uniqueid']][_0x6b03('0x65')];}}}catch(_0x3e13cc){utils[_0x6b03('0x15')](util[_0x6b03('0x4')](_0x6b03('0x68'),_0x233822[_0x6b03('0x6')]),_0x3e13cc);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 25d32ac..79e2c96 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 _0x5add=['./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','.wav49','value','replace','.WAV','find','monitors','push','error','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','application','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','./utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5add,0xd9));var _0xd5ad=function(_0x273dcf,_0x20de05){_0x273dcf=_0x273dcf-0x0;var _0x5cb01e=_0x5add[_0x273dcf];return _0x5cb01e;};'use strict';var _=require(_0xd5ad('0x0'));var util=require('util');var utils=require(_0xd5ad('0x1'));var transfers=require(_0xd5ad('0x2'));var recordings={};function writeDB(_0x463fae){var _0x24572d;utils[_0xd5ad('0x3')](util[_0xd5ad('0x4')](_0xd5ad('0x5'),_0x463fae[_0xd5ad('0x6')]));if(transfers['blinds'][_0x463fae[_0xd5ad('0x6')]]){_0x24572d=_0x463fae[_0xd5ad('0x6')];_0x463fae[_0xd5ad('0x6')]=transfers['blinds'][_0x463fae[_0xd5ad('0x6')]][_0xd5ad('0x7')];}if(_0x463fae[_0xd5ad('0x8')]){utils[_0xd5ad('0x9')](_0x463fae[_0xd5ad('0x8')])[_0xd5ad('0xa')](function(_0x57fc65){if(_0x57fc65){_0x463fae[_0xd5ad('0xb')]=_0x57fc65[_0xd5ad('0xc')];_0x463fae[_0xd5ad('0xd')]=_0x57fc65['id'];}utils[_0xd5ad('0xe')]('CreateVoiceRecording',_0x463fae);});}else{utils[_0xd5ad('0xe')](_0xd5ad('0xf'),_0x463fae);}if(_0x24572d)delete transfers[_0xd5ad('0x10')][_0x24572d];}exports[_0xd5ad('0x11')]=function(_0x4a98b6){try{utils[_0xd5ad('0x12')](util[_0xd5ad('0x4')](_0xd5ad('0x13'),_0x4a98b6[_0xd5ad('0x6')]),_0x4a98b6);if(_0x4a98b6[_0xd5ad('0x6')]==_0x4a98b6['linkedid']){utils[_0xd5ad('0x3')](util['format'](_0xd5ad('0x14'),_0x4a98b6[_0xd5ad('0x6')],_0x4a98b6[_0xd5ad('0x15')],_0x4a98b6['exten']));recordings[_0x4a98b6[_0xd5ad('0x6')]]={'uniqueid':_0x4a98b6['uniqueid'],'accountcode':_0x4a98b6[_0xd5ad('0x8')],'exten':_0x4a98b6['exten'],'context':_0x4a98b6[_0xd5ad('0x15')],'channel':_0x4a98b6[_0xd5ad('0x16')],'monitors':[]};}}catch(_0x13dd09){utils['error'](util[_0xd5ad('0x4')](_0xd5ad('0x13'),_0x4a98b6['uniqueid']),_0x13dd09);}};exports[_0xd5ad('0x17')]=function(_0x2f11da){try{utils[_0xd5ad('0x12')](util[_0xd5ad('0x4')](_0xd5ad('0x18'),_0x2f11da[_0xd5ad('0x6')]),_0x2f11da);if(!_[_0xd5ad('0x19')](recordings[_0x2f11da[_0xd5ad('0x6')]])&&_0x2f11da['channelstate']==0x6){utils['info'](util[_0xd5ad('0x4')](_0xd5ad('0x1a'),_0x2f11da['uniqueid'],_0x2f11da[_0xd5ad('0x15')],_0x2f11da['channel']));}else if(!_[_0xd5ad('0x19')](recordings[_0x2f11da[_0xd5ad('0x1b')]])&&_0x2f11da[_0xd5ad('0x1c')]==0x6&&_0x2f11da[_0xd5ad('0x15')]!=_0xd5ad('0x1d')){utils[_0xd5ad('0x3')](util[_0xd5ad('0x4')](_0xd5ad('0x1e'),_0x2f11da['uniqueid'],_0x2f11da['linkedid'],_0x2f11da[_0xd5ad('0x15')],_0x2f11da['channel']));recordings[_0x2f11da[_0xd5ad('0x1b')]][_0xd5ad('0x8')]=_0x2f11da[_0xd5ad('0x8')];}}catch(_0x206d41){utils['error'](util['format'](_0xd5ad('0x18'),_0x2f11da[_0xd5ad('0x6')]),_0x206d41);}};exports[_0xd5ad('0x1f')]=function(_0x336244){try{if(!_[_0xd5ad('0x19')](_0x336244[_0xd5ad('0x20')])&&!_['isNil'](_0x336244[_0xd5ad('0x20')][_0xd5ad('0x21')])){utils[_0xd5ad('0x12')](util['format'](_0xd5ad('0x22'),_0x336244[_0xd5ad('0x6')]),_0x336244);utils[_0xd5ad('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x336244[_0xd5ad('0x6')],_0x336244[_0xd5ad('0x20')],_0x336244['value']));if(_[_0xd5ad('0x23')](_0x336244['value'],_0xd5ad('0x24'))){_0x336244[_0xd5ad('0x25')]=_0x336244[_0xd5ad('0x25')][_0xd5ad('0x26')](_0xd5ad('0x24'),_0xd5ad('0x27'));}if(recordings[_0x336244['linkedid']]){var _0x2215e5=_[_0xd5ad('0x28')](recordings[_0x336244[_0xd5ad('0x1b')]][_0xd5ad('0x29')],{'value':_0x336244['value']});if(_[_0xd5ad('0x19')](_0x2215e5)){recordings[_0x336244['linkedid']][_0xd5ad('0x29')][_0xd5ad('0x2a')]({'value':_0x336244['value']});}}}}catch(_0x257d38){utils[_0xd5ad('0x2b')](util[_0xd5ad('0x4')](_0xd5ad('0x22'),_0x336244[_0xd5ad('0x6')]),_0x257d38);}};exports[_0xd5ad('0x2c')]=function(_0x3f9909){try{if(!_[_0xd5ad('0x19')](recordings[_0x3f9909['uniqueid']])){utils[_0xd5ad('0x12')](util[_0xd5ad('0x4')]('[%s][recordings][hangup]',_0x3f9909[_0xd5ad('0x6')]),_0x3f9909);utils[_0xd5ad('0x3')](util['format'](_0xd5ad('0x2d'),_0x3f9909[_0xd5ad('0x6')],_0x3f9909[_0xd5ad('0x2e')],_0x3f9909[_0xd5ad('0x2f')],_0x3f9909[_0xd5ad('0x30')]));recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x2e')]=_0x3f9909['calleridnum'];recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x2f')]=_0x3f9909[_0xd5ad('0x2f')];recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x31')]=_0x3f9909[_0xd5ad('0x31')];recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x32')]=_0x3f9909[_0xd5ad('0x32')];if(recordings[_0x3f9909['uniqueid']][_0xd5ad('0x33')]==_0xd5ad('0x34')&&recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x8')]){recordings[_0x3f9909[_0xd5ad('0x6')]][_0xd5ad('0x31')]=recordings[_0x3f9909['uniqueid']][_0xd5ad('0x8')];recordings[_0x3f9909['uniqueid']][_0xd5ad('0x32')]='';}recordings[_0x3f9909['uniqueid']][_0xd5ad('0x29')][_0xd5ad('0x35')](function(_0x245ce2){var _0x49b54b=_[_0xd5ad('0x36')](recordings[_0x3f9909['uniqueid']]);_0x49b54b['value']=_0x245ce2['value'];writeDB(_0x49b54b);});delete recordings[_0x3f9909[_0xd5ad('0x6')]];}}catch(_0x5aa49c){utils[_0xd5ad('0x2b')](util[_0xd5ad('0x4')]('[%s][recordings][hangup]',_0x3f9909[_0xd5ad('0x6')]),_0x5aa49c);}};exports['newexten']=function(_0x38ec01){try{if(!_['isNil'](recordings[_0x38ec01['uniqueid']])){utils[_0xd5ad('0x12')](util[_0xd5ad('0x4')](_0xd5ad('0x37'),_0x38ec01[_0xd5ad('0x6')]),_0x38ec01);utils[_0xd5ad('0x3')](util[_0xd5ad('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x38ec01['uniqueid'],_0x38ec01[_0xd5ad('0x38')],_0x38ec01['appdata']));if(_0x38ec01['application'][_0xd5ad('0x39')]()=='set'&&_['startsWith'](_0x38ec01['appdata'][_0xd5ad('0x39')](),_0xd5ad('0x3a'))){var _0xef159a=_0x38ec01['appdata'][_0xd5ad('0x3b')]('=');var _0x50a34f=_0xef159a[0x0][_0xd5ad('0x3c')](_0xef159a[0x0]['lastIndexOf']('(')+0x1,_0xef159a[0x0][_0xd5ad('0x3d')](')'));var _0x3cf705=_0xef159a[0x1];recordings[_0x38ec01[_0xd5ad('0x6')]][_0x50a34f]=_0x3cf705;}}}catch(_0x3e5670){utils[_0xd5ad('0x2b')](util['format'](_0xd5ad('0x37'),_0x38ec01[_0xd5ad('0x6')]),_0x3e5670);}};exports[_0xd5ad('0x3e')]=function(_0x523598){try{if(!_[_0xd5ad('0x19')](recordings[_0x523598[_0xd5ad('0x6')]])){utils[_0xd5ad('0x12')](util['format'](_0xd5ad('0x3f'),_0x523598[_0xd5ad('0x6')]),_0x523598);utils['info'](util[_0xd5ad('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x523598[_0xd5ad('0x6')],_0x523598[_0xd5ad('0x40')]));recordings[_0x523598['uniqueid']][_0xd5ad('0x40')]=_0x523598['queue'];}}catch(_0x5f5b60){utils[_0xd5ad('0x2b')](util['format'](_0xd5ad('0x3f'),_0x523598[_0xd5ad('0x6')]),_0x5f5b60);}};exports[_0xd5ad('0x41')]=function(_0x17086c){try{utils['debug'](util[_0xd5ad('0x4')]('[%s][recordings][blindtransfer]',_0x17086c[_0xd5ad('0x6')]),_0x17086c);utils[_0xd5ad('0x3')](util['format'](_0xd5ad('0x42'),_0x17086c['uniqueid'],_0x17086c['transferercalleridnum'],_0x17086c[_0xd5ad('0x43')],_0x17086c[_0xd5ad('0x44')],_0x17086c[_0xd5ad('0x45')]));if(recordings[_0x17086c[_0xd5ad('0x46')]]&&transfers[_0xd5ad('0x10')][_0x17086c[_0xd5ad('0x46')]]){transfers['blinds'][_0x17086c[_0xd5ad('0x46')]][_0xd5ad('0x47')]=!![];}}catch(_0x2d91de){utils[_0xd5ad('0x2b')](util[_0xd5ad('0x4')](_0xd5ad('0x48'),_0x17086c['uniqueid']),_0x2d91de);}}; \ No newline at end of file +var _0xdc67=['value','endsWith','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereruniqueid','recording','lodash','util','./transfers.controller','format','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','blinds','newchannel','debug','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s'];(function(_0x1143ce,_0x5c49a4){var _0xb4b17f=function(_0x55bbf4){while(--_0x55bbf4){_0x1143ce['push'](_0x1143ce['shift']());}};_0xb4b17f(++_0x5c49a4);}(_0xdc67,0x1d5));var _0x7dc6=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xdc67[_0x19a49f];return _0x5351ae;};'use strict';var _=require(_0x7dc6('0x0'));var util=require(_0x7dc6('0x1'));var utils=require('./utils');var transfers=require(_0x7dc6('0x2'));var recordings={};function writeDB(_0x196de7){var _0x612de2;utils['info'](util[_0x7dc6('0x3')]('[%s][recordings][writeDB]',_0x196de7['uniqueid']));if(transfers['blinds'][_0x196de7['uniqueid']]){_0x612de2=_0x196de7['uniqueid'];_0x196de7[_0x7dc6('0x4')]=transfers['blinds'][_0x196de7[_0x7dc6('0x4')]][_0x7dc6('0x5')];}if(_0x196de7[_0x7dc6('0x6')]){utils[_0x7dc6('0x7')](_0x196de7['accountcode'])['then'](function(_0x25226a){if(_0x25226a){_0x196de7[_0x7dc6('0x8')]=_0x25226a[_0x7dc6('0x9')];_0x196de7[_0x7dc6('0xa')]=_0x25226a['id'];}utils[_0x7dc6('0xb')]('CreateVoiceRecording',_0x196de7);});}else{utils[_0x7dc6('0xb')]('CreateVoiceRecording',_0x196de7);}if(_0x612de2)delete transfers[_0x7dc6('0xc')][_0x612de2];}exports[_0x7dc6('0xd')]=function(_0x43913e){try{utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0xf'),_0x43913e[_0x7dc6('0x4')]),_0x43913e);if(_0x43913e['uniqueid']==_0x43913e['linkedid']){utils[_0x7dc6('0x10')](util[_0x7dc6('0x3')](_0x7dc6('0x11'),_0x43913e[_0x7dc6('0x4')],_0x43913e[_0x7dc6('0x12')],_0x43913e[_0x7dc6('0x13')]));recordings[_0x43913e['uniqueid']]={'uniqueid':_0x43913e[_0x7dc6('0x4')],'accountcode':_0x43913e[_0x7dc6('0x6')],'exten':_0x43913e['exten'],'context':_0x43913e[_0x7dc6('0x12')],'channel':_0x43913e[_0x7dc6('0x14')],'monitors':[]};}}catch(_0xde7149){utils[_0x7dc6('0x15')](util[_0x7dc6('0x3')](_0x7dc6('0xf'),_0x43913e[_0x7dc6('0x4')]),_0xde7149);}};exports[_0x7dc6('0x16')]=function(_0x1ba697){try{utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0x17'),_0x1ba697['uniqueid']),_0x1ba697);if(!_['isNil'](recordings[_0x1ba697[_0x7dc6('0x4')]])&&_0x1ba697['channelstate']==0x6){utils[_0x7dc6('0x10')](util[_0x7dc6('0x3')](_0x7dc6('0x18'),_0x1ba697['uniqueid'],_0x1ba697['context'],_0x1ba697[_0x7dc6('0x14')]));}else if(!_['isNil'](recordings[_0x1ba697[_0x7dc6('0x19')]])&&_0x1ba697[_0x7dc6('0x1a')]==0x6&&_0x1ba697['context']!=_0x7dc6('0x1b')){utils['info'](util['format'](_0x7dc6('0x1c'),_0x1ba697[_0x7dc6('0x4')],_0x1ba697[_0x7dc6('0x19')],_0x1ba697[_0x7dc6('0x12')],_0x1ba697['channel']));recordings[_0x1ba697[_0x7dc6('0x19')]][_0x7dc6('0x6')]=_0x1ba697[_0x7dc6('0x6')];}}catch(_0x2eaec2){utils[_0x7dc6('0x15')](util[_0x7dc6('0x3')](_0x7dc6('0x17'),_0x1ba697[_0x7dc6('0x4')]),_0x2eaec2);}};exports[_0x7dc6('0x1d')]=function(_0xcc6b54){try{if(!_[_0x7dc6('0x1e')](_0xcc6b54[_0x7dc6('0x1f')])&&!_[_0x7dc6('0x1e')](_0xcc6b54[_0x7dc6('0x1f')][_0x7dc6('0x20')])){utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0x21'),_0xcc6b54[_0x7dc6('0x4')]),_0xcc6b54);utils[_0x7dc6('0x10')](util[_0x7dc6('0x3')](_0x7dc6('0x22'),_0xcc6b54[_0x7dc6('0x4')],_0xcc6b54[_0x7dc6('0x1f')],_0xcc6b54[_0x7dc6('0x23')]));if(_[_0x7dc6('0x24')](_0xcc6b54[_0x7dc6('0x23')],_0x7dc6('0x25'))){_0xcc6b54[_0x7dc6('0x23')]=_0xcc6b54[_0x7dc6('0x23')][_0x7dc6('0x26')](_0x7dc6('0x25'),_0x7dc6('0x27'));}if(recordings[_0xcc6b54[_0x7dc6('0x19')]]){var _0x13a0b5=_[_0x7dc6('0x28')](recordings[_0xcc6b54[_0x7dc6('0x19')]][_0x7dc6('0x29')],{'value':_0xcc6b54[_0x7dc6('0x23')]});if(_[_0x7dc6('0x1e')](_0x13a0b5)){recordings[_0xcc6b54[_0x7dc6('0x19')]]['monitors']['push']({'value':_0xcc6b54['value']});}}}}catch(_0x440fb3){utils[_0x7dc6('0x15')](util['format'](_0x7dc6('0x21'),_0xcc6b54['uniqueid']),_0x440fb3);}};exports[_0x7dc6('0x2a')]=function(_0xc9c3a2){try{if(!_[_0x7dc6('0x1e')](recordings[_0xc9c3a2['uniqueid']])){utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0x2b'),_0xc9c3a2[_0x7dc6('0x4')]),_0xc9c3a2);utils[_0x7dc6('0x10')](util[_0x7dc6('0x3')](_0x7dc6('0x2c'),_0xc9c3a2[_0x7dc6('0x4')],_0xc9c3a2[_0x7dc6('0x2d')],_0xc9c3a2[_0x7dc6('0x2e')],_0xc9c3a2[_0x7dc6('0x2f')]));recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x2d')]=_0xc9c3a2[_0x7dc6('0x2d')];recordings[_0xc9c3a2['uniqueid']][_0x7dc6('0x2e')]=_0xc9c3a2['calleridname'];recordings[_0xc9c3a2['uniqueid']][_0x7dc6('0x30')]=_0xc9c3a2[_0x7dc6('0x30')];recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x31')]=_0xc9c3a2['connectedlinename'];if(recordings[_0xc9c3a2[_0x7dc6('0x4')]]['type']==_0x7dc6('0x32')&&recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x6')]){recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x30')]=recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x6')];recordings[_0xc9c3a2[_0x7dc6('0x4')]][_0x7dc6('0x31')]='';}recordings[_0xc9c3a2['uniqueid']][_0x7dc6('0x29')]['forEach'](function(_0x13cb51){var _0x30c523=_[_0x7dc6('0x33')](recordings[_0xc9c3a2[_0x7dc6('0x4')]]);_0x30c523[_0x7dc6('0x23')]=_0x13cb51[_0x7dc6('0x23')];writeDB(_0x30c523);});delete recordings[_0xc9c3a2[_0x7dc6('0x4')]];}}catch(_0x13e679){utils[_0x7dc6('0x15')](util[_0x7dc6('0x3')](_0x7dc6('0x2b'),_0xc9c3a2[_0x7dc6('0x4')]),_0x13e679);}};exports[_0x7dc6('0x34')]=function(_0x13a9ca){try{if(!_[_0x7dc6('0x1e')](recordings[_0x13a9ca[_0x7dc6('0x4')]])){utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0x35'),_0x13a9ca[_0x7dc6('0x4')]),_0x13a9ca);utils[_0x7dc6('0x10')](util['format'](_0x7dc6('0x36'),_0x13a9ca[_0x7dc6('0x4')],_0x13a9ca[_0x7dc6('0x37')],_0x13a9ca[_0x7dc6('0x38')]));if(_0x13a9ca['application'][_0x7dc6('0x39')]()=='set'&&_[_0x7dc6('0x3a')](_0x13a9ca[_0x7dc6('0x38')]['toLowerCase'](),_0x7dc6('0x3b'))){var _0x4dcd0f=_0x13a9ca[_0x7dc6('0x38')][_0x7dc6('0x3c')]('=');var _0x315863=_0x4dcd0f[0x0][_0x7dc6('0x3d')](_0x4dcd0f[0x0][_0x7dc6('0x3e')]('(')+0x1,_0x4dcd0f[0x0][_0x7dc6('0x3e')](')'));var _0x5a89fc=_0x4dcd0f[0x1];recordings[_0x13a9ca[_0x7dc6('0x4')]][_0x315863]=_0x5a89fc;}}}catch(_0xd80a90){utils['error'](util['format'](_0x7dc6('0x35'),_0x13a9ca['uniqueid']),_0xd80a90);}};exports['queuecallerjoin']=function(_0x5ab6ec){try{if(!_[_0x7dc6('0x1e')](recordings[_0x5ab6ec['uniqueid']])){utils[_0x7dc6('0xe')](util[_0x7dc6('0x3')](_0x7dc6('0x3f'),_0x5ab6ec[_0x7dc6('0x4')]),_0x5ab6ec);utils['info'](util['format'](_0x7dc6('0x40'),_0x5ab6ec[_0x7dc6('0x4')],_0x5ab6ec[_0x7dc6('0x41')]));recordings[_0x5ab6ec[_0x7dc6('0x4')]]['queue']=_0x5ab6ec[_0x7dc6('0x41')];}}catch(_0x3ed8a9){utils[_0x7dc6('0x15')](util[_0x7dc6('0x3')]('[%s][recordings][queuecallerjoin]',_0x5ab6ec[_0x7dc6('0x4')]),_0x3ed8a9);}};exports[_0x7dc6('0x42')]=function(_0x27f5cd){try{utils[_0x7dc6('0xe')](util['format'](_0x7dc6('0x43'),_0x27f5cd[_0x7dc6('0x4')]),_0x27f5cd);utils[_0x7dc6('0x10')](util[_0x7dc6('0x3')](_0x7dc6('0x44'),_0x27f5cd[_0x7dc6('0x4')],_0x27f5cd[_0x7dc6('0x45')],_0x27f5cd['transferercalleridname'],_0x27f5cd['transfereecalleridnum'],_0x27f5cd['transfereecalleridname']));if(recordings[_0x27f5cd[_0x7dc6('0x46')]]&&transfers['blinds'][_0x27f5cd[_0x7dc6('0x46')]]){transfers[_0x7dc6('0xc')][_0x27f5cd['transfereruniqueid']][_0x7dc6('0x47')]=!![];}}catch(_0x1e3618){utils['error'](util[_0x7dc6('0x3')](_0x7dc6('0x43'),_0x27f5cd[_0x7dc6('0x4')]),_0x1e3618);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7ee1fa0..2814c5e 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 _0xed42=['[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','CreateVoiceTransferReport','blinds','debug'];(function(_0x3ec448,_0x4694df){var _0x4f6618=function(_0x29a447){while(--_0x29a447){_0x3ec448['push'](_0x3ec448['shift']());}};_0x4f6618(++_0x4694df);}(_0xed42,0x11a));var _0x2ed4=function(_0x26e359,_0x33f445){_0x26e359=_0x26e359-0x0;var _0x99b90=_0xed42[_0x26e359];return _0x99b90;};'use strict';var _=require(_0x2ed4('0x0'));var util=require(_0x2ed4('0x1'));var utils=require(_0x2ed4('0x2'));function writeDB(_0x3b4f05){utils[_0x2ed4('0x3')](util[_0x2ed4('0x4')](_0x2ed4('0x5'),_0x3b4f05['type']===_0x2ed4('0x6')?_0x3b4f05[_0x2ed4('0x7')]:_0x3b4f05['uniqueid'],_0x3b4f05[_0x2ed4('0x8')]));utils['request'](_0x2ed4('0x9'),_0x3b4f05);}exports[_0x2ed4('0xa')]={};exports['blindtransfer']=function(_0xd55b0b){try{utils[_0x2ed4('0xb')](util[_0x2ed4('0x4')](_0x2ed4('0xc'),_0xd55b0b[_0x2ed4('0xd')]),_0xd55b0b);utils[_0x2ed4('0x3')](util[_0x2ed4('0x4')](_0x2ed4('0xe'),_0xd55b0b[_0x2ed4('0xd')],_0xd55b0b[_0x2ed4('0xf')],_0xd55b0b[_0x2ed4('0x10')],_0xd55b0b['transfereecalleridnum'],_0xd55b0b[_0x2ed4('0x11')]));_0xd55b0b[_0x2ed4('0x8')]=_0x2ed4('0x12');exports[_0x2ed4('0xa')][_0xd55b0b['transfereruniqueid']]=_0xd55b0b;writeDB(_0xd55b0b);}catch(_0x901d4){utils['error'](util[_0x2ed4('0x4')](_0x2ed4('0xc'),_0xd55b0b[_0x2ed4('0xd')]),_0x901d4);}};exports[_0x2ed4('0x13')]=function(_0x1e8d86){try{utils[_0x2ed4('0xb')](util[_0x2ed4('0x4')](_0x2ed4('0x14'),_0x1e8d86[_0x2ed4('0x7')]),_0x1e8d86);utils[_0x2ed4('0x3')](util[_0x2ed4('0x4')](_0x2ed4('0x15'),_0x1e8d86[_0x2ed4('0x7')],_0x1e8d86[_0x2ed4('0x16')],_0x1e8d86[_0x2ed4('0x17')],_0x1e8d86[_0x2ed4('0x18')],_0x1e8d86['transfertargetcalleridname']));_0x1e8d86=_['assign'](_0x1e8d86,{'transfererchannel':_0x1e8d86['origtransfererchannel'],'transferercalleridnum':_0x1e8d86[_0x2ed4('0x16')],'transferercalleridname':_0x1e8d86[_0x2ed4('0x17')],'transfererconnectedlinenum':_0x1e8d86[_0x2ed4('0x19')],'transfererconnectedlinename':_0x1e8d86['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1e8d86[_0x2ed4('0x1a')],'transferercontext':_0x1e8d86['secondtransferercontext'],'transfererexten':_0x1e8d86[_0x2ed4('0x1b')],'transfererlinkedid':_0x1e8d86[_0x2ed4('0x1c')],'context':_0x1e8d86[_0x2ed4('0x1d')],'extension':_0x1e8d86[_0x2ed4('0x1e')],'type':_0x2ed4('0x6')});if(_[_0x2ed4('0x1f')](_0x1e8d86[_0x2ed4('0x20')])){_0x1e8d86=_[_0x2ed4('0x21')](_0x1e8d86,{'transfereechannel':_0x1e8d86[_0x2ed4('0x22')],'transfereecalleridnum':_0x1e8d86[_0x2ed4('0x18')],'transfereecalleridname':_0x1e8d86['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1e8d86[_0x2ed4('0x23')],'transfereeconnectedlinename':_0x1e8d86[_0x2ed4('0x24')],'transfereeaccountcode':_0x1e8d86[_0x2ed4('0x25')],'transfereecontext':_0x1e8d86[_0x2ed4('0x26')],'transfereeexten':_0x1e8d86[_0x2ed4('0x27')],'transfereelinkedid':_0x1e8d86[_0x2ed4('0x28')]});}writeDB(_0x1e8d86);}catch(_0x2106ea){utils[_0x2ed4('0x29')](util[_0x2ed4('0x4')](_0x2ed4('0x14'),_0x1e8d86['origtransfereruniqueid']),_0x2106ea);}}; \ No newline at end of file +var _0x6d59=['error','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','uniqueid','type','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid'];(function(_0x27ba9c,_0x51b231){var _0x382c72=function(_0x44ef44){while(--_0x44ef44){_0x27ba9c['push'](_0x27ba9c['shift']());}};_0x382c72(++_0x51b231);}(_0x6d59,0x111));var _0x96d5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6d59[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x96d5('0x0'));var utils=require(_0x96d5('0x1'));function writeDB(_0x31b5f6){utils[_0x96d5('0x2')](util[_0x96d5('0x3')](_0x96d5('0x4'),_0x31b5f6['type']==='attended'?_0x31b5f6['origtransfereruniqueid']:_0x31b5f6[_0x96d5('0x5')],_0x31b5f6[_0x96d5('0x6')]));utils['request']('CreateVoiceTransferReport',_0x31b5f6);}exports['blinds']={};exports[_0x96d5('0x7')]=function(_0x4aae38){try{utils[_0x96d5('0x8')](util['format']('[%s][transfers][blindtransfer]',_0x4aae38[_0x96d5('0x5')]),_0x4aae38);utils[_0x96d5('0x2')](util[_0x96d5('0x3')](_0x96d5('0x9'),_0x4aae38[_0x96d5('0x5')],_0x4aae38[_0x96d5('0xa')],_0x4aae38['transferercalleridname'],_0x4aae38[_0x96d5('0xb')],_0x4aae38[_0x96d5('0xc')]));_0x4aae38[_0x96d5('0x6')]='blind';exports[_0x96d5('0xd')][_0x4aae38[_0x96d5('0xe')]]=_0x4aae38;writeDB(_0x4aae38);}catch(_0x37e7e7){utils[_0x96d5('0xf')](util[_0x96d5('0x3')]('[%s][transfers][blindtransfer]',_0x4aae38['uniqueid']),_0x37e7e7);}};exports['attendedtransfer']=function(_0x51f19d){try{utils['debug'](util[_0x96d5('0x3')]('[%s][transfers][attendedtransfer]',_0x51f19d[_0x96d5('0x10')]),_0x51f19d);utils[_0x96d5('0x2')](util[_0x96d5('0x3')](_0x96d5('0x11'),_0x51f19d[_0x96d5('0x10')],_0x51f19d['origtransferercalleridnum'],_0x51f19d['origtransferercalleridname'],_0x51f19d['transfertargetcalleridnum'],_0x51f19d[_0x96d5('0x12')]));_0x51f19d=_[_0x96d5('0x13')](_0x51f19d,{'transfererchannel':_0x51f19d[_0x96d5('0x14')],'transferercalleridnum':_0x51f19d[_0x96d5('0x15')],'transferercalleridname':_0x51f19d[_0x96d5('0x16')],'transfererconnectedlinenum':_0x51f19d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x51f19d[_0x96d5('0x17')],'transfereraccountcode':_0x51f19d[_0x96d5('0x18')],'transferercontext':_0x51f19d[_0x96d5('0x19')],'transfererexten':_0x51f19d[_0x96d5('0x1a')],'transfererlinkedid':_0x51f19d[_0x96d5('0x1b')],'context':_0x51f19d[_0x96d5('0x1c')],'extension':_0x51f19d['origtransfererexten'],'type':'attended'});if(_[_0x96d5('0x1d')](_0x51f19d[_0x96d5('0x1e')])){_0x51f19d=_[_0x96d5('0x13')](_0x51f19d,{'transfereechannel':_0x51f19d[_0x96d5('0x1f')],'transfereecalleridnum':_0x51f19d[_0x96d5('0x20')],'transfereecalleridname':_0x51f19d['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x51f19d[_0x96d5('0x21')],'transfereeconnectedlinename':_0x51f19d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x51f19d[_0x96d5('0x22')],'transfereecontext':_0x51f19d['transfertargetcontext'],'transfereeexten':_0x51f19d['transfertargetexten'],'transfereelinkedid':_0x51f19d[_0x96d5('0x23')]});}writeDB(_0x51f19d);}catch(_0x130d3a){utils[_0x96d5('0xf')](util[_0x96d5('0x3')]('[%s][transfers][attendedtransfer]',_0x51f19d[_0x96d5('0x10')]),_0x130d3a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 60697cf..2e28d00 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 _0xa6ce=['then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','info','inspect','debug','error','request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa6ce,0x15e));var _0xea6c=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xa6ce[_0x500419];return _0x241c1a;};'use strict';var BPromise=require(_0xea6c('0x0'));var jayson=require('jayson/promise');var moment=require(_0xea6c('0x1'));var util=require(_0xea6c('0x2'));var client=jayson['client'][_0xea6c('0x3')]({'port':0x2329});var logger=require(_0xea6c('0x4'))('xdr');exports['info']=function(_0x2ac723,_0x1eea8f){logger[_0xea6c('0x5')](_0x2ac723,_0x1eea8f?util[_0xea6c('0x6')](_0x1eea8f,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x7')]=function(_0x8a751f,_0x5c3ba1){logger[_0xea6c('0x7')](_0x8a751f,_0x5c3ba1?util[_0xea6c('0x6')](_0x5c3ba1,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x8')]=function(_0x202528,_0x29b813){logger[_0xea6c('0x8')](_0x202528,_0x29b813?util[_0xea6c('0x6')](_0x29b813,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x9')]=function(_0x2c414a,_0x3b70a4){return client[_0xea6c('0x9')](_0x2c414a,{'body':_0x3b70a4})[_0xea6c('0xa')](function(_0xfc7a5e){logger[_0xea6c('0x7')]('[utils][request]\x20name:%s',_0x2c414a,_0xfc7a5e?util[_0xea6c('0x6')](_0xfc7a5e,{'showHidden':![],'depth':null}):'');})[_0xea6c('0xb')](function(_0x36c0a8){logger['error'](_0xea6c('0xc'),_0x2c414a,_0x36c0a8?util[_0xea6c('0x6')](_0x36c0a8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4db782){return client[_0xea6c('0x9')](_0xea6c('0xd'),{'options':{'raw':!![],'attributes':['id',_0xea6c('0xe'),_0xea6c('0xf'),_0xea6c('0x10')],'where':_0x4db782,'limit':0x1}})[_0xea6c('0xa')](function(_0x5a51f9){logger[_0xea6c('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xea6c('0x11')](_0x4db782),_0x5a51f9?util[_0xea6c('0x6')](_0x5a51f9,{'showHidden':![],'depth':null}):'');return _0x5a51f9[_0xea6c('0x12')][_0xea6c('0x13')]?_0x5a51f9[_0xea6c('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x2dbbcb){return new BPromise(function(_0x2f4bd0,_0x254f8e){if(_0x2dbbcb){return getUser({'internal':_0x2dbbcb})[_0xea6c('0xa')](function(_0x9ba42b){logger[_0xea6c('0x5')](_0xea6c('0x14'),_0x2dbbcb,_0x9ba42b?_0xea6c('0x15'):_0xea6c('0x16'));return _0x2f4bd0(_0x9ba42b);})[_0xea6c('0xb')](function(_0x52a322){logger[_0xea6c('0x8')]('[utils][getUserByInternal]',_0x52a322?util[_0xea6c('0x6')](_0x52a322,{'showHidden':![],'depth':null}):'');return _0x2f4bd0(null);});}return _0x2f4bd0(null);});};exports['getUserByInterface']=function(_0x204e07){return new BPromise(function(_0x341139,_0x1d3eca){if(_0x204e07){return getUser({'interface':_0x204e07})['then'](function(_0x417cfa){logger[_0xea6c('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x204e07,_0x417cfa?'found':_0xea6c('0x16'));return _0x341139(_0x417cfa);})['catch'](function(_0x540406){logger[_0xea6c('0x8')](_0xea6c('0x17'),_0x540406?util[_0xea6c('0x6')](_0x540406,{'showHidden':![],'depth':null}):'');return _0x341139(null);});}return _0x341139(null);});};exports[_0xea6c('0x18')]=function(_0x303303){return new BPromise(function(_0x4fa0ea,_0x3bfe88){if(_0x303303){return getUser({'name':_0x303303})['then'](function(_0x5df5e9){logger[_0xea6c('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x303303,_0x5df5e9?_0xea6c('0x15'):_0xea6c('0x16'));return _0x4fa0ea(_0x5df5e9);})[_0xea6c('0xb')](function(_0x269b48){logger[_0xea6c('0x8')](_0xea6c('0x19'),_0x269b48?util[_0xea6c('0x6')](_0x269b48,{'showHidden':![],'depth':null}):'');return _0x4fa0ea(null);});}return _0x4fa0ea(null);});};exports[_0xea6c('0x1a')]=function(_0x348a38){return new BPromise(function(_0x118385,_0x15327f){if(_0x348a38){return client[_0xea6c('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xea6c('0xf'),_0xea6c('0x1b'),'acw','acwTimeout'],'where':{'name':_0x348a38},'limit':0x1}})['then'](function(_0x434fa7){logger[_0xea6c('0x7')](_0xea6c('0x1c'),_0x348a38,_0x434fa7?util[_0xea6c('0x6')](_0x434fa7,{'showHidden':![],'depth':null}):'');logger[_0xea6c('0x5')](_0xea6c('0x1d'),_0x348a38,_0x434fa7?_0xea6c('0x15'):_0xea6c('0x16'));return _0x118385(_0x434fa7[_0xea6c('0x12')]['length']?_0x434fa7[_0xea6c('0x12')][0x0]:null);})[_0xea6c('0xb')](function(_0x439013){logger[_0xea6c('0x8')](_0xea6c('0x1e'),_0x439013?util[_0xea6c('0x6')](_0x439013,{'showHidden':![],'depth':null}):'');return _0x118385(null);});}return _0x118385(null);});};exports['addTime']=function(_0xc0c5b9,_0x18c59e){return moment(_0xc0c5b9)['add'](_0x18c59e,_0xea6c('0x1f'))[_0xea6c('0x20')](_0xea6c('0x21'));};exports['subtractTime']=function(_0x5ef27c,_0x4fa399){return moment(_0x5ef27c)['subtract'](_0x4fa399,'seconds')[_0xea6c('0x20')](_0xea6c('0x21'));};exports[_0xea6c('0x22')]=function(_0x151c66,_0x507d35){return moment(_0x151c66)[_0xea6c('0x23')](moment(_0x507d35),_0xea6c('0x1f'));};exports[_0xea6c('0x24')]=function(_0x525861,_0x1d8794){return parseInt(_0x525861,0xa)+parseInt(_0x1d8794,0xa);};exports[_0xea6c('0x25')]=function(){return moment()['format'](_0xea6c('0x21'));};exports[_0xea6c('0x26')]=function(_0x3033da,_0x261082){if(_0x261082){return moment(_0x3033da)[_0xea6c('0x26')](_0x261082);}return!![];};exports[_0xea6c('0x27')]=function(_0x1fbb3d,_0x3259aa){if(_0x3259aa){return moment(_0x1fbb3d)[_0xea6c('0x27')](_0x3259aa);}else if(_0x1fbb3d){return!![];}return![];}; \ No newline at end of file +var _0x9c32=['request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','notfound','[utils][getUserByInterface]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','diff','isBefore','jayson/promise','client','http','../../config/logger','info','inspect','debug','error'];(function(_0x5e7360,_0x851fcc){var _0x5c55ab=function(_0x3bd2ab){while(--_0x3bd2ab){_0x5e7360['push'](_0x5e7360['shift']());}};_0x5c55ab(++_0x851fcc);}(_0x9c32,0xbb));var _0x29c3=function(_0xa85aae,_0x139625){_0xa85aae=_0xa85aae-0x0;var _0x366a91=_0x9c32[_0xa85aae];return _0x366a91;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x29c3('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0x29c3('0x1')][_0x29c3('0x2')]({'port':0x2329});var logger=require(_0x29c3('0x3'))('xdr');exports[_0x29c3('0x4')]=function(_0x402499,_0x40b2bf){logger[_0x29c3('0x4')](_0x402499,_0x40b2bf?util[_0x29c3('0x5')](_0x40b2bf,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x6')]=function(_0x373ed0,_0x424874){logger[_0x29c3('0x6')](_0x373ed0,_0x424874?util[_0x29c3('0x5')](_0x424874,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x7')]=function(_0xa5dfeb,_0x553e70){logger[_0x29c3('0x7')](_0xa5dfeb,_0x553e70?util[_0x29c3('0x5')](_0x553e70,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x8')]=function(_0x590452,_0x22c128){return client[_0x29c3('0x8')](_0x590452,{'body':_0x22c128})[_0x29c3('0x9')](function(_0x53aec3){logger['debug'](_0x29c3('0xa'),_0x590452,_0x53aec3?util['inspect'](_0x53aec3,{'showHidden':![],'depth':null}):'');})[_0x29c3('0xb')](function(_0x5f157f){logger[_0x29c3('0x7')](_0x29c3('0xa'),_0x590452,_0x5f157f?util[_0x29c3('0x5')](_0x5f157f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x486a10){return client[_0x29c3('0x8')](_0x29c3('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x29c3('0xd'),_0x29c3('0xe')],'where':_0x486a10,'limit':0x1}})[_0x29c3('0x9')](function(_0x9ee76f){logger[_0x29c3('0x6')](_0x29c3('0xf'),JSON[_0x29c3('0x10')](_0x486a10),_0x9ee76f?util['inspect'](_0x9ee76f,{'showHidden':![],'depth':null}):'');return _0x9ee76f[_0x29c3('0x11')]['length']?_0x9ee76f[_0x29c3('0x11')][0x0]:null;});}exports[_0x29c3('0x12')]=function(_0x531088){return new BPromise(function(_0x143f3c,_0x284b80){if(_0x531088){return getUser({'internal':_0x531088})[_0x29c3('0x9')](function(_0x3f8a9e){logger[_0x29c3('0x4')](_0x29c3('0x13'),_0x531088,_0x3f8a9e?_0x29c3('0x14'):'notfound');return _0x143f3c(_0x3f8a9e);})[_0x29c3('0xb')](function(_0x37a6e8){logger[_0x29c3('0x7')](_0x29c3('0x15'),_0x37a6e8?util[_0x29c3('0x5')](_0x37a6e8,{'showHidden':![],'depth':null}):'');return _0x143f3c(null);});}return _0x143f3c(null);});};exports['getUserByInterface']=function(_0x9c29c4){return new BPromise(function(_0x4183bb,_0x308f88){if(_0x9c29c4){return getUser({'interface':_0x9c29c4})[_0x29c3('0x9')](function(_0x507778){logger[_0x29c3('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x9c29c4,_0x507778?_0x29c3('0x14'):_0x29c3('0x16'));return _0x4183bb(_0x507778);})['catch'](function(_0x369c8f){logger['error'](_0x29c3('0x17'),_0x369c8f?util['inspect'](_0x369c8f,{'showHidden':![],'depth':null}):'');return _0x4183bb(null);});}return _0x4183bb(null);});};exports['getUserByName']=function(_0x3d10f1){return new BPromise(function(_0x5684c8,_0x4d45e6){if(_0x3d10f1){return getUser({'name':_0x3d10f1})[_0x29c3('0x9')](function(_0xa9a7bd){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x3d10f1,_0xa9a7bd?_0x29c3('0x14'):_0x29c3('0x16'));return _0x5684c8(_0xa9a7bd);})[_0x29c3('0xb')](function(_0x511341){logger['error']('[utils][getUserByName]',_0x511341?util[_0x29c3('0x5')](_0x511341,{'showHidden':![],'depth':null}):'');return _0x5684c8(null);});}return _0x5684c8(null);});};exports['getVoiceQueueByName']=function(_0x5b6044){return new BPromise(function(_0x69ae6f,_0x3aedf3){if(_0x5b6044){return client['request'](_0x29c3('0x18'),{'options':{'raw':!![],'attributes':['id',_0x29c3('0xd'),_0x29c3('0x19'),_0x29c3('0x1a'),'acwTimeout'],'where':{'name':_0x5b6044},'limit':0x1}})['then'](function(_0x490200){logger[_0x29c3('0x6')](_0x29c3('0x1b'),_0x5b6044,_0x490200?util[_0x29c3('0x5')](_0x490200,{'showHidden':![],'depth':null}):'');logger[_0x29c3('0x4')](_0x29c3('0x1c'),_0x5b6044,_0x490200?'found':_0x29c3('0x16'));return _0x69ae6f(_0x490200[_0x29c3('0x11')][_0x29c3('0x1d')]?_0x490200[_0x29c3('0x11')][0x0]:null);})[_0x29c3('0xb')](function(_0x54e50f){logger[_0x29c3('0x7')](_0x29c3('0x1e'),_0x54e50f?util[_0x29c3('0x5')](_0x54e50f,{'showHidden':![],'depth':null}):'');return _0x69ae6f(null);});}return _0x69ae6f(null);});};exports[_0x29c3('0x1f')]=function(_0x166400,_0x218626){return moment(_0x166400)[_0x29c3('0x20')](_0x218626,_0x29c3('0x21'))['format'](_0x29c3('0x22'));};exports['subtractTime']=function(_0x1890dd,_0x5c3266){return moment(_0x1890dd)['subtract'](_0x5c3266,'seconds')[_0x29c3('0x23')](_0x29c3('0x22'));};exports[_0x29c3('0x24')]=function(_0x1f7ba2,_0x443b42){return moment(_0x1f7ba2)[_0x29c3('0x25')](moment(_0x443b42),_0x29c3('0x21'));};exports['sumTime']=function(_0x18965c,_0x3b45d0){return parseInt(_0x18965c,0xa)+parseInt(_0x3b45d0,0xa);};exports['now']=function(){return moment()['format'](_0x29c3('0x22'));};exports['isAfter']=function(_0x10fa5a,_0x28e2de){if(_0x28e2de){return moment(_0x10fa5a)['isAfter'](_0x28e2de);}return!![];};exports[_0x29c3('0x26')]=function(_0x1d0b7c,_0x4b2183){if(_0x4b2183){return moment(_0x1d0b7c)[_0x29c3('0x26')](_0x4b2183);}else if(_0x1d0b7c){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index c04b333..3df127d 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4d9=['other','agent_name','test','setupLoggers','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','catch','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','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)','connection'];(function(_0x515866,_0x288ed8){var _0x18fd28=function(_0x430574){while(--_0x430574){_0x515866['push'](_0x515866['shift']());}};_0x18fd28(++_0x288ed8);}(_0xa4d9,0x88));var _0x9a4d=function(_0x591c22,_0x342884){_0x591c22=_0x591c22-0x0;var _0x53d5a7=_0xa4d9[_0x591c22];return _0x53d5a7;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x9a4d('0x0'));var path=require(_0x9a4d('0x1'));var util=require(_0x9a4d('0x2'));var fileLogger=require('./loggers')[_0x9a4d('0x3')];var safeTemplate=require(_0x9a4d('0x4'))[_0x9a4d('0x5')];var maskSensitiveData=require(_0x9a4d('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x4c0ac4(_0xf39b19){var _0x3139b1=path[_0x9a4d('0x7')](_0x9a4d('0x8'),_0x9a4d('0x9'),_0x9a4d('0xa'));var _0x279e23=path[_0x9a4d('0x7')](_0x9a4d('0xb'),_0xf39b19[_0x9a4d('0xc')]+'-'+_0xf39b19[_0x9a4d('0xd')]);return fs[_0x9a4d('0xe')](path['join'](_0x3139b1,_0x279e23))[_0x9a4d('0xf')](function(){var _0x1e95e2=fileLogger(_0x9a4d('0xb'),path[_0x9a4d('0x7')](_0x3139b1,_0x279e23));return _0x1e95e2;})['catch'](function(_0x1b451a){throw _0x1b451a;});}this[_0x9a4d('0x9')]=function(_0x52825a,_0x487701,_0x4e7dfa,_0x5a6b3c){return _0x4c0ac4(_0x52825a[_0x9a4d('0x10')])[_0x9a4d('0xf')](function(_0x3bd6fe){var _0x56f807=_0x3bd6fe[_0x487701];return _0x56f807;})[_0x9a4d('0xf')](function(_0x3c9f98){var _0x85555a=_0x52825a[_0x9a4d('0x10')]?_0x52825a[_0x9a4d('0x10')]['id']:'no-user';var _0xe56392=_0x5a6b3c[_0x9a4d('0x11')];var _0x119ff8=_0x5a6b3c['timestamp'];var _0x3ef580=new Date(Number(_0x119ff8));return _0x3c9f98(_0x85555a,_0x3ef580,_0x4e7dfa,_0xe56392);})[_0x9a4d('0x12')](function(_0x4e9536){fileLogger(_0x9a4d('0xb'))[_0x9a4d('0x13')](_0x4e9536);});};}function setupLoggers(_0x59e2f1){return new Promise(function(_0x29b5ac){var _0x17f397=new ClientSideLogger();var _0x3ced97=fileLogger('api');var _0x220e0f=fileLogger(_0x9a4d('0x14'));_0x59e2f1[_0x9a4d('0x15')]('client-side-logger',_0x17f397);_0x59e2f1[_0x9a4d('0x16')](ewinston[_0x9a4d('0x17')]({'winstonInstance':_0x3ced97,'meta':![],'statusLevels':!![],'msg':function(_0x819086,_0x2b6221){var _0x57305c=_0x9a4d('0x18');if(!_['isEmpty'](_0x819086[_0x9a4d('0x19')])){_0x57305c+=_0x9a4d('0x1a');var _0x56f160=_0x819086['body'];maskSensitiveData(_0x56f160);}return safeTemplate(util[_0x9a4d('0x1b')](_0x57305c,_0x819086[_0x9a4d('0x1c')],_0x819086[_0x9a4d('0x1d')][_0x9a4d('0x1e')]?_0x819086[_0x9a4d('0x1d')][_0x9a4d('0x1e')]:_0x819086['connection'][_0x9a4d('0x1f')]||_0x819086['ip'],_0x819086[_0x9a4d('0x20')],_0x2b6221[_0x9a4d('0x21')],_0x2b6221[_0x9a4d('0x22')],_0x819086['user']?_0x819086[_0x9a4d('0x10')]['id']:null,_0x819086[_0x9a4d('0x10')]?_0x819086[_0x9a4d('0x10')]['name']:null,_0x819086[_0x9a4d('0x10')]?_0x819086[_0x9a4d('0x10')][_0x9a4d('0xc')]:null,_0x56f160?util[_0x9a4d('0x23')](_0x56f160,![],null):''));}}));_0x59e2f1['use'](ewinston[_0x9a4d('0x17')]({'winstonInstance':_0x220e0f,'meta':![],'statusLevels':!![],'msg':function(_0x486c36,_0x1a74e0){var _0x5d7bcb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x486c36[_0x9a4d('0x19')]&&_0x486c36['body'][_0x9a4d('0x24')]&&_0x486c36[_0x9a4d('0x19')][_0x9a4d('0x25')]){_0x5d7bcb=_0x9a4d('0x26');}return util[_0x9a4d('0x1b')](_0x5d7bcb,_0x486c36['method'],_0x486c36[_0x9a4d('0x1d')][_0x9a4d('0x1e')]?_0x486c36['headers'][_0x9a4d('0x1e')]:_0x486c36[_0x9a4d('0x27')][_0x9a4d('0x1f')]||_0x486c36['ip'],_0x486c36['url'],_0x1a74e0[_0x9a4d('0x21')],_0x1a74e0[_0x9a4d('0x22')],_0x486c36[_0x9a4d('0x10')]?_0x486c36['user']['id']:null,_0x486c36['user']?_0x486c36[_0x9a4d('0x10')][_0x9a4d('0xd')]:null,_0x486c36[_0x9a4d('0x10')]?_0x486c36[_0x9a4d('0x10')][_0x9a4d('0xc')]:null,_0x486c36[_0x9a4d('0x19')]&&_0x486c36['body'][_0x9a4d('0x24')]?_0x486c36[_0x9a4d('0x19')][_0x9a4d('0x24')]:_0x9a4d('0x28'),_0x486c36[_0x9a4d('0x19')]&&_0x486c36[_0x9a4d('0x19')][_0x9a4d('0x25')]?_0x486c36[_0x9a4d('0x19')][_0x9a4d('0x25')]:'',_0x486c36[_0x9a4d('0x19')]&&_0x486c36[_0x9a4d('0x19')][_0x9a4d('0x29')]?_0x486c36['body']['agent_name']:'');},'ignoreRoute':function(_0x4846f2){var _0x58b05f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x58b05f[_0x9a4d('0x2a')](_0x4846f2['url']);}}));return _0x29b5ac();});}exports[_0x9a4d('0x2b')]=setupLoggers; \ No newline at end of file +var _0x3a84=['role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','name','then','user','no-user','data','catch','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode'];(function(_0x44d88c,_0x4e0cb4){var _0x508da7=function(_0x464d98){while(--_0x464d98){_0x44d88c['push'](_0x44d88c['shift']());}};_0x508da7(++_0x4e0cb4);}(_0x3a84,0xbf));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};var fs=require(_0x43a8('0x0'));var _=require(_0x43a8('0x1'));var ewinston=require(_0x43a8('0x2'));var path=require(_0x43a8('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x43a8('0x4')];var safeTemplate=require(_0x43a8('0x5'))[_0x43a8('0x6')];var maskSensitiveData=require(_0x43a8('0x7'))[_0x43a8('0x8')];function ClientSideLogger(){function _0xcf8a84(_0x3259a1){var _0x4a2409=path[_0x43a8('0x9')](_0x43a8('0xa'),'log',_0x43a8('0xb'));var _0xf074be=path[_0x43a8('0x9')](_0x43a8('0xc'),_0x3259a1['role']+'-'+_0x3259a1[_0x43a8('0xd')]);return fs['ensureDir'](path[_0x43a8('0x9')](_0x4a2409,_0xf074be))[_0x43a8('0xe')](function(){var _0x1ab4a7=fileLogger(_0x43a8('0xc'),path[_0x43a8('0x9')](_0x4a2409,_0xf074be));return _0x1ab4a7;})['catch'](function(_0x59faa9){throw _0x59faa9;});}this['log']=function(_0xa7d78f,_0x5a6ac8,_0x32151a,_0x708ffd){return _0xcf8a84(_0xa7d78f['user'])[_0x43a8('0xe')](function(_0x3d8ae3){var _0x16bd20=_0x3d8ae3[_0x5a6ac8];return _0x16bd20;})[_0x43a8('0xe')](function(_0x1b610a){var _0x4271cd=_0xa7d78f[_0x43a8('0xf')]?_0xa7d78f[_0x43a8('0xf')]['id']:_0x43a8('0x10');var _0x11ef26=_0x708ffd[_0x43a8('0x11')];var _0xe10556=_0x708ffd['timestamp'];var _0x57e320=new Date(Number(_0xe10556));return _0x1b610a(_0x4271cd,_0x57e320,_0x32151a,_0x11ef26);})[_0x43a8('0x12')](function(_0x33402c){fileLogger(_0x43a8('0xc'))['error'](_0x33402c);});};}function setupLoggers(_0x463ed3){return new Promise(function(_0x3f2743){var _0x122a9f=new ClientSideLogger();var _0x33ca51=fileLogger(_0x43a8('0x13'));var _0x46d256=fileLogger(_0x43a8('0x14'));_0x463ed3['set'](_0x43a8('0x15'),_0x122a9f);_0x463ed3['use'](ewinston[_0x43a8('0x16')]({'winstonInstance':_0x33ca51,'meta':![],'statusLevels':!![],'msg':function(_0x17e71b,_0x354f11){var _0x4ee583=_0x43a8('0x17');if(!_[_0x43a8('0x18')](_0x17e71b[_0x43a8('0x19')])){_0x4ee583+=_0x43a8('0x1a');var _0x56a044=_0x17e71b[_0x43a8('0x19')];maskSensitiveData(_0x56a044);}return safeTemplate(util['format'](_0x4ee583,_0x17e71b[_0x43a8('0x1b')],_0x17e71b[_0x43a8('0x1c')][_0x43a8('0x1d')]?_0x17e71b['headers'][_0x43a8('0x1d')]:_0x17e71b[_0x43a8('0x1e')][_0x43a8('0x1f')]||_0x17e71b['ip'],_0x17e71b[_0x43a8('0x20')],_0x354f11[_0x43a8('0x21')],_0x354f11['responseTime'],_0x17e71b[_0x43a8('0xf')]?_0x17e71b[_0x43a8('0xf')]['id']:null,_0x17e71b['user']?_0x17e71b[_0x43a8('0xf')][_0x43a8('0xd')]:null,_0x17e71b['user']?_0x17e71b[_0x43a8('0xf')][_0x43a8('0x22')]:null,_0x56a044?util['inspect'](_0x56a044,![],null):''));}}));_0x463ed3[_0x43a8('0x23')](ewinston[_0x43a8('0x16')]({'winstonInstance':_0x46d256,'meta':![],'statusLevels':!![],'msg':function(_0x543022,_0x353d5a){var _0x332c16=_0x43a8('0x24');if(_0x543022[_0x43a8('0x19')]&&_0x543022['body'][_0x43a8('0x25')]&&_0x543022[_0x43a8('0x19')][_0x43a8('0x26')]){_0x332c16=_0x43a8('0x27');}return util['format'](_0x332c16,_0x543022[_0x43a8('0x1b')],_0x543022['headers']['x-forwarded-for']?_0x543022[_0x43a8('0x1c')][_0x43a8('0x1d')]:_0x543022[_0x43a8('0x1e')][_0x43a8('0x1f')]||_0x543022['ip'],_0x543022['url'],_0x353d5a[_0x43a8('0x21')],_0x353d5a[_0x43a8('0x28')],_0x543022[_0x43a8('0xf')]?_0x543022['user']['id']:null,_0x543022[_0x43a8('0xf')]?_0x543022['user'][_0x43a8('0xd')]:null,_0x543022[_0x43a8('0xf')]?_0x543022[_0x43a8('0xf')]['role']:null,_0x543022[_0x43a8('0x19')]&&_0x543022[_0x43a8('0x19')][_0x43a8('0x25')]?_0x543022['body'][_0x43a8('0x25')]:_0x43a8('0x29'),_0x543022[_0x43a8('0x19')]&&_0x543022[_0x43a8('0x19')][_0x43a8('0x26')]?_0x543022[_0x43a8('0x19')][_0x43a8('0x26')]:'',_0x543022['body']&&_0x543022[_0x43a8('0x19')][_0x43a8('0x2a')]?_0x543022[_0x43a8('0x19')][_0x43a8('0x2a')]:'');},'ignoreRoute':function(_0x465eb8){var _0x39b07b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x39b07b[_0x43a8('0x2b')](_0x465eb8['url']);}}));return _0x3f2743();});}exports[_0x43a8('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index daaec53..8152288 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1045=['lodash','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime'];(function(_0x14915d,_0x46bdd6){var _0x4852d8=function(_0x5c46fc){while(--_0x5c46fc){_0x14915d['push'](_0x14915d['shift']());}};_0x4852d8(++_0x46bdd6);}(_0x1045,0xbe));var _0x5104=function(_0x3aaaef,_0x17845c){_0x3aaaef=_0x3aaaef-0x0;var _0x287b68=_0x1045[_0x3aaaef];return _0x287b68;};var _=require(_0x5104('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x9fdd95){return _0x9fdd95[_0x5104('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x5104('0x2');var EINVALID_DATE=_0x5104('0x3');function throwIfDateNotValid(_0xd770c0){if(!_0xd770c0['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3d8029){var _0xa06f76=_0x3d8029[_0x5104('0x4')](':')[_0x5104('0x5')](function(_0x303650){return parseInt(_0x303650,0xa);});var _0xc6839a=_0xa06f76[0x0];var _0x3f4168=_0xa06f76[0x1];if(_0xc6839a<0x0||_0xc6839a>0x17||_0x3f4168<0x0||_0x3f4168>0x3b){throw new Error(EINVALID_DATE);}return[_0xc6839a,_0x3f4168];}function circularDoWInterval(_0x1ed199,_0x1dcc80){if(_0x1ed199===_0x1dcc80){return[_0x1ed199];}else{var _0x76e68c=moment[_0x5104('0x6')]();moment['locale']('en');var _0x4c74f6=moment['weekdaysShort']()['map'](function(_0x23dea6){return _0x23dea6[_0x5104('0x7')]();});moment['locale'](_0x76e68c);var _0x473efc=_0x4c74f6['indexOf'](_0x1ed199);var _0x4e117e=_0x4c74f6[_0x5104('0x8')](_0x1dcc80);if(_0x4e117e>_0x473efc){return _0x4c74f6['slice'](_0x473efc,_0x4e117e+0x1);}else{var _0x5b7988=_0x4c74f6[_0x5104('0x9')](0x0,_0x4e117e+0x1);var _0x24e840=_0x4c74f6['slice'](_0x473efc);return _0x24e840[_0x5104('0xa')](_0x5b7988);}}}module[_0x5104('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3ff52e,_0x4b1246){if(_0x3ff52e===_0x4b1246){return[_0x3ff52e];}else{var _0xc4d399=moment[_0x5104('0x6')]();moment[_0x5104('0x6')]('en');var _0x1c6b0a=moment[_0x5104('0xc')]()[_0x5104('0x5')](function(_0x12faf8){return _0x12faf8[_0x5104('0x7')]();});moment[_0x5104('0x6')](_0xc4d399);var _0xc81904=_0x1c6b0a[_0x5104('0x8')](_0x3ff52e);var _0x5f5aae=_0x1c6b0a['indexOf'](_0x4b1246);if(_0x5f5aae>_0xc81904){return _0x1c6b0a['slice'](_0xc81904,_0x5f5aae+0x1);}else{var _0x1620d7=_0x1c6b0a[_0x5104('0x9')](0x0,_0x5f5aae+0x1);var _0x3dcbb2=_0x1c6b0a['slice'](_0xc81904);return _0x3dcbb2[_0x5104('0xa')](_0x1620d7);}}}module[_0x5104('0xb')][_0x5104('0xd')]=circularMonthInterval;function parseDom(_0x45d47f){var _0x30bb3d=parseInt(_0x45d47f,0xa);if(_0x30bb3d<0x1||_0x30bb3d>0x1f){throw new Error(EINVALID_DATE);}return _0x30bb3d;}function timeCompare(_0x11d867,_0x1cb4ab,_0x1015df){var _0x14a02b=_0x11d867[_0x5104('0xe')]();var _0x2c2144=extractTime(_0x1cb4ab);var _0x5d79d2=_0x2c2144[0x0];var _0x3a731f=_0x2c2144[0x1];var _0x1860e9=_0x11d867[_0x5104('0xe')]()['hours'](_0x5d79d2)[_0x5104('0xf')](_0x3a731f);throwIfDateNotValid(_0x1860e9);var _0x28dfba=extractTime(_0x1015df);var _0xa4c018=_0x28dfba[0x0];var _0x28062e=_0x28dfba[0x1];var _0x3be607=_0x11d867[_0x5104('0xe')]()[_0x5104('0x10')](_0xa4c018)[_0x5104('0xf')](_0x28062e);throwIfDateNotValid(_0x3be607);if(_0x3be607[_0x5104('0x11')](_0x1860e9)){var _0x244a4d=_0x14a02b['clone']()['startOf'](_0x5104('0x12'));var _0x2db374=_0x14a02b[_0x5104('0xe')]()[_0x5104('0x13')](_0x5104('0x12'));return _0x14a02b[_0x5104('0x14')](_0x1860e9,_0x2db374,undefined,'[]')||_0x14a02b[_0x5104('0x14')](_0x244a4d,_0x3be607,undefined,'[]');}else{return _0x14a02b['isBetween'](_0x1860e9,_0x3be607,undefined,'[]');}}module['exports'][_0x5104('0x15')]=timeCompare;function dowCompare(_0xf51ac8,_0x37c781,_0x5417a4){var _0x39d5b7=_0xf51ac8[_0x5104('0x6')]('en')[_0x5104('0x16')](_0x5104('0x17'))[_0x5104('0x7')]();return circularDoWInterval(_0x37c781,_0x5417a4)[_0x5104('0x18')](_0x39d5b7);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x22c530,_0x47e61f,_0x3557af){var _0x50db11=_0x22c530[_0x5104('0x19')]();if(_0x47e61f===_0x3557af){return _0x50db11===_0x47e61f;}else{var _0x48bce0=_0x22c530[_0x5104('0x1a')]();var _0x440bd4=_0x47e61f<_0x3557af;let _0x98d17f=![];var _0x21bad1=0x0;var _0x218b57=0x0;if(_0x440bd4){_0x21bad1=Math[_0x5104('0x1b')](0x1,_0x47e61f);_0x218b57=Math[_0x5104('0x1c')](_0x3557af,_0x48bce0);_0x98d17f=_0x50db11>=_0x21bad1&&_0x50db11<=_0x218b57;}else{_0x21bad1=Math[_0x5104('0x1c')](_0x47e61f,_0x48bce0);_0x218b57=Math['max'](0x1,_0x3557af);_0x98d17f=_0x50db11>=_0x21bad1||_0x50db11<=_0x218b57;}return _0x98d17f;}}module[_0x5104('0xb')][_0x5104('0x1d')]=domCompare;function monthCompare(_0x1b5fb9,_0x30b79b,_0x180cb2){var _0x4bc445=_0x1b5fb9['locale']('en')[_0x5104('0x16')](_0x5104('0x1e'))[_0x5104('0x7')]();return circularMonthInterval(_0x30b79b,_0x180cb2)[_0x5104('0x18')](_0x4bc445);}module[_0x5104('0xb')][_0x5104('0x1f')]=monthCompare;function iftime(_0x223f03,_0x3824fb=moment['tz'][_0x5104('0x20')](),_0x5d1ec1=moment()){if(!validateRx[_0x5104('0x21')](_0x223f03)){throw new Error(EINVALID_STRING);}else{var _0x56ca6b=(moment[_0x5104('0x22')](_0x5d1ec1)?_0x5d1ec1[_0x5104('0xe')]():moment(_0x5d1ec1))['tz'](_0x3824fb)[_0x5104('0x6')]('en');throwIfDateNotValid(_0x56ca6b);var _0x103a1c=_0x223f03[_0x5104('0x4')](',');var _0x2d6219=_0x103a1c[0x0];var _0x4a9153=_0x103a1c[0x1];var _0x4ea44b=_0x103a1c[0x2];var _0x16a851=_0x103a1c[0x3];let _0x4ba648=!![];if(_0x2d6219!=='*'){var _0x100590=_0x2d6219[_0x5104('0x4')]('-');var _0x2c740e=_[_0x5104('0x23')](_0x100590[0x0],0x5,'0');var _0x59e5e1=_0x100590[_0x5104('0x24')]===0x2?_[_0x5104('0x23')](_0x100590[0x1],0x5,'0'):_0x2c740e;_0x4ba648=timeCompare(_0x56ca6b,_0x2c740e,_0x59e5e1);}let _0x18d6bb=!![];if(_0x4a9153!=='*'){var _0x48f866=_0x4a9153[_0x5104('0x4')]('-');var _0x416279=_0x48f866[0x0];var _0x10df91=_0x48f866['length']===0x2?_0x48f866[0x1]:_0x416279;_0x18d6bb=dowCompare(_0x56ca6b,_0x416279,_0x10df91);}let _0x16ef30=!![];if(_0x4ea44b!=='*'){var _0x342a94=_0x4ea44b['split']('-');var _0x2c0513=parseDom(_0x342a94[0x0]);var _0x1210ce=_0x342a94[_0x5104('0x24')]===0x2?parseDom(_0x342a94[0x1]):_0x2c0513;_0x16ef30=domCompare(_0x56ca6b,_0x2c0513,_0x1210ce);}let _0x5081bb=!![];if(_0x16a851!=='*'){var _0x1a77e8=_0x16a851[_0x5104('0x4')]('-');var _0x35ff1c=_0x1a77e8[0x0];var _0xf54309=_0x1a77e8[_0x5104('0x24')]===0x2?_0x1a77e8[0x1]:_0x1a77e8[0x0];_0x5081bb=monthCompare(_0x56ca6b,_0x35ff1c,_0xf54309);}return _0x4ba648&&_0x18d6bb&&_0x16ef30&&_0x5081bb;}}module[_0x5104('0xb')][_0x5104('0x25')]=iftime; \ No newline at end of file +var _0x9d5d=['ddd','includes','date','daysInMonth','max','min','MMM','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','slice','concat','exports','circularDoWInterval','monthsShort','indexOf','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x9d5d,0x144));var _0xd9d5=function(_0x5b2fd6,_0x3ac3cb){_0x5b2fd6=_0x5b2fd6-0x0;var _0x8dbc5b=_0x9d5d[_0x5b2fd6];return _0x8dbc5b;};var _=require(_0xd9d5('0x0'));var moment=require(_0xd9d5('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xd9d5('0x2')](function(_0x5dc798){return _0x5dc798[_0xd9d5('0x3')];})[_0xd9d5('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xd9d5('0x5');var EINVALID_DATE=_0xd9d5('0x6');function throwIfDateNotValid(_0x22a34d){if(!_0x22a34d['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x169504){var _0x389c9d=_0x169504[_0xd9d5('0x7')](':')['map'](function(_0x1ea43d){return parseInt(_0x1ea43d,0xa);});var _0x559327=_0x389c9d[0x0];var _0xa7ea3=_0x389c9d[0x1];if(_0x559327<0x0||_0x559327>0x17||_0xa7ea3<0x0||_0xa7ea3>0x3b){throw new Error(EINVALID_DATE);}return[_0x559327,_0xa7ea3];}function circularDoWInterval(_0x45bc9a,_0x5a4cfd){if(_0x45bc9a===_0x5a4cfd){return[_0x45bc9a];}else{var _0x3dfad0=moment['locale']();moment[_0xd9d5('0x8')]('en');var _0x16cab5=moment[_0xd9d5('0x9')]()['map'](function(_0x111c7e){return _0x111c7e[_0xd9d5('0xa')]();});moment['locale'](_0x3dfad0);var _0x29f762=_0x16cab5['indexOf'](_0x45bc9a);var _0x1d42df=_0x16cab5['indexOf'](_0x5a4cfd);if(_0x1d42df>_0x29f762){return _0x16cab5[_0xd9d5('0xb')](_0x29f762,_0x1d42df+0x1);}else{var _0x2bbff6=_0x16cab5[_0xd9d5('0xb')](0x0,_0x1d42df+0x1);var _0x21ccc2=_0x16cab5['slice'](_0x29f762);return _0x21ccc2[_0xd9d5('0xc')](_0x2bbff6);}}}module[_0xd9d5('0xd')][_0xd9d5('0xe')]=circularDoWInterval;function circularMonthInterval(_0x37e811,_0x1a8272){if(_0x37e811===_0x1a8272){return[_0x37e811];}else{var _0x3eaebd=moment[_0xd9d5('0x8')]();moment[_0xd9d5('0x8')]('en');var _0x117b3f=moment[_0xd9d5('0xf')]()[_0xd9d5('0x2')](function(_0x23d86a){return _0x23d86a['toLowerCase']();});moment[_0xd9d5('0x8')](_0x3eaebd);var _0xdac44=_0x117b3f[_0xd9d5('0x10')](_0x37e811);var _0x346ddc=_0x117b3f[_0xd9d5('0x10')](_0x1a8272);if(_0x346ddc>_0xdac44){return _0x117b3f[_0xd9d5('0xb')](_0xdac44,_0x346ddc+0x1);}else{var _0xffed52=_0x117b3f[_0xd9d5('0xb')](0x0,_0x346ddc+0x1);var _0x5b1e3d=_0x117b3f[_0xd9d5('0xb')](_0xdac44);return _0x5b1e3d[_0xd9d5('0xc')](_0xffed52);}}}module[_0xd9d5('0xd')][_0xd9d5('0x11')]=circularMonthInterval;function parseDom(_0x5682f2){var _0x114cc9=parseInt(_0x5682f2,0xa);if(_0x114cc9<0x1||_0x114cc9>0x1f){throw new Error(EINVALID_DATE);}return _0x114cc9;}function timeCompare(_0x4b2230,_0x9efdb8,_0xb95157){var _0xb91506=_0x4b2230[_0xd9d5('0x12')]();var _0x55a586=extractTime(_0x9efdb8);var _0x549d67=_0x55a586[0x0];var _0x241075=_0x55a586[0x1];var _0x4a951f=_0x4b2230[_0xd9d5('0x12')]()[_0xd9d5('0x13')](_0x549d67)[_0xd9d5('0x14')](_0x241075);throwIfDateNotValid(_0x4a951f);var _0x267ef4=extractTime(_0xb95157);var _0xc5da98=_0x267ef4[0x0];var _0x44cbe1=_0x267ef4[0x1];var _0x4c47f2=_0x4b2230['clone']()[_0xd9d5('0x13')](_0xc5da98)[_0xd9d5('0x14')](_0x44cbe1);throwIfDateNotValid(_0x4c47f2);if(_0x4c47f2[_0xd9d5('0x15')](_0x4a951f)){var _0x36c71f=_0xb91506[_0xd9d5('0x12')]()[_0xd9d5('0x16')](_0xd9d5('0x17'));var _0x23accc=_0xb91506[_0xd9d5('0x12')]()['endOf']('day');return _0xb91506['isBetween'](_0x4a951f,_0x23accc,undefined,'[]')||_0xb91506[_0xd9d5('0x18')](_0x36c71f,_0x4c47f2,undefined,'[]');}else{return _0xb91506[_0xd9d5('0x18')](_0x4a951f,_0x4c47f2,undefined,'[]');}}module[_0xd9d5('0xd')][_0xd9d5('0x19')]=timeCompare;function dowCompare(_0x5af554,_0x221ef7,_0x524777){var _0x18bb4e=_0x5af554[_0xd9d5('0x8')]('en')[_0xd9d5('0x1a')](_0xd9d5('0x1b'))['toLowerCase']();return circularDoWInterval(_0x221ef7,_0x524777)[_0xd9d5('0x1c')](_0x18bb4e);}module[_0xd9d5('0xd')]['dowCompare']=dowCompare;function domCompare(_0x21d6fe,_0x52a66f,_0x4a6a6a){var _0x3149bf=_0x21d6fe[_0xd9d5('0x1d')]();if(_0x52a66f===_0x4a6a6a){return _0x3149bf===_0x52a66f;}else{var _0x5a9bde=_0x21d6fe[_0xd9d5('0x1e')]();var _0x286bfe=_0x52a66f<_0x4a6a6a;let _0x1673e7=![];var _0x454f7a=0x0;var _0x3777ed=0x0;if(_0x286bfe){_0x454f7a=Math[_0xd9d5('0x1f')](0x1,_0x52a66f);_0x3777ed=Math[_0xd9d5('0x20')](_0x4a6a6a,_0x5a9bde);_0x1673e7=_0x3149bf>=_0x454f7a&&_0x3149bf<=_0x3777ed;}else{_0x454f7a=Math[_0xd9d5('0x20')](_0x52a66f,_0x5a9bde);_0x3777ed=Math[_0xd9d5('0x1f')](0x1,_0x4a6a6a);_0x1673e7=_0x3149bf>=_0x454f7a||_0x3149bf<=_0x3777ed;}return _0x1673e7;}}module[_0xd9d5('0xd')]['domCompare']=domCompare;function monthCompare(_0xc21a71,_0x35d997,_0x1282a5){var _0x260781=_0xc21a71[_0xd9d5('0x8')]('en')[_0xd9d5('0x1a')](_0xd9d5('0x21'))['toLowerCase']();return circularMonthInterval(_0x35d997,_0x1282a5)[_0xd9d5('0x1c')](_0x260781);}module[_0xd9d5('0xd')]['monthCompare']=monthCompare;function iftime(_0x548a71,_0x474f1f=moment['tz']['guess'](),_0xd01b3c=moment()){if(!validateRx[_0xd9d5('0x22')](_0x548a71)){throw new Error(EINVALID_STRING);}else{var _0x2124e5=(moment[_0xd9d5('0x23')](_0xd01b3c)?_0xd01b3c['clone']():moment(_0xd01b3c))['tz'](_0x474f1f)['locale']('en');throwIfDateNotValid(_0x2124e5);var _0x4cd910=_0x548a71['split'](',');var _0x443353=_0x4cd910[0x0];var _0x3ec2c6=_0x4cd910[0x1];var _0x1c159d=_0x4cd910[0x2];var _0x429c4d=_0x4cd910[0x3];let _0x37df98=!![];if(_0x443353!=='*'){var _0x3be400=_0x443353['split']('-');var _0x3bb08c=_[_0xd9d5('0x24')](_0x3be400[0x0],0x5,'0');var _0x3f67a9=_0x3be400['length']===0x2?_[_0xd9d5('0x24')](_0x3be400[0x1],0x5,'0'):_0x3bb08c;_0x37df98=timeCompare(_0x2124e5,_0x3bb08c,_0x3f67a9);}let _0x4e228d=!![];if(_0x3ec2c6!=='*'){var _0x115da5=_0x3ec2c6[_0xd9d5('0x7')]('-');var _0x5ac493=_0x115da5[0x0];var _0x1e41d2=_0x115da5[_0xd9d5('0x25')]===0x2?_0x115da5[0x1]:_0x5ac493;_0x4e228d=dowCompare(_0x2124e5,_0x5ac493,_0x1e41d2);}let _0x43d1fa=!![];if(_0x1c159d!=='*'){var _0x1a3bed=_0x1c159d[_0xd9d5('0x7')]('-');var _0x8ba4d1=parseDom(_0x1a3bed[0x0]);var _0x20ca45=_0x1a3bed[_0xd9d5('0x25')]===0x2?parseDom(_0x1a3bed[0x1]):_0x8ba4d1;_0x43d1fa=domCompare(_0x2124e5,_0x8ba4d1,_0x20ca45);}let _0xa7013c=!![];if(_0x429c4d!=='*'){var _0x3ba14f=_0x429c4d[_0xd9d5('0x7')]('-');var _0x42a55b=_0x3ba14f[0x0];var _0x4b1994=_0x3ba14f[_0xd9d5('0x25')]===0x2?_0x3ba14f[0x1]:_0x3ba14f[0x0];_0xa7013c=monthCompare(_0x2124e5,_0x42a55b,_0x4b1994);}return _0x37df98&&_0x4e228d&&_0x43d1fa&&_0xa7013c;}}module[_0xd9d5('0xd')][_0xd9d5('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 9a4d128..5667315 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb33a=['join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','Console','warn','%s-%s','error','File','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xb33a,0x188));var _0xab33=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xb33a[_0x26b622];return _0x58a028;};'use strict';var path=require(_0xab33('0x0'));var util=require(_0xab33('0x1'));var moment=require(_0xab33('0x2'));var winston=require(_0xab33('0x3'));var config=require(_0xab33('0x4'));var debugLevel=config[_0xab33('0x5')]?config[_0xab33('0x5')][_0xab33('0x6')]():_0xab33('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xab33('0x8'),'error':_0xab33('0x9'),'warn':_0xab33('0xa'),'info':_0xab33('0xb'),'print':'bold\x20white','success':_0xab33('0xc'),'http':_0xab33('0xd'),'verbose':_0xab33('0xe'),'debug':'bold\x20blue','silly':_0xab33('0xf')};winston[_0xab33('0x10')](XC_LOG_COLORS);function getLogFileName(_0x24e761,_0x56c51d,_0x2fd47e){var _0x432536=_0x24e761||_0xab33('0x11');return path[_0xab33('0x12')](_0x432536,util[_0xab33('0x13')](_0xab33('0x14'),_0x56c51d,_0x2fd47e));}function formatter(_0x313b70,_0x4bae3f){_0x4bae3f[_0xab33('0x15')]=_0x4bae3f[_0xab33('0x15')][_0xab33('0x16')](/@@{/g,_0xab33('0x17'))[_0xab33('0x16')](/}@@/g,_0xab33('0x18'))[_0xab33('0x16')](/@{/g,'{{')[_0xab33('0x16')](/}@/g,'}}');return util[_0xab33('0x13')](_0xab33('0x19'),moment()[_0xab33('0x13')](_0xab33('0x1a')),_0x4bae3f['level'][_0xab33('0x1b')](),_0x313b70,_0x4bae3f[_0xab33('0x15')]);}function fileFormat(_0x49b5cb,_0x478478){_0x478478[_0xab33('0x15')]=_0x478478[_0xab33('0x15')][_0xab33('0x16')](/@@{/g,_0xab33('0x17'))[_0xab33('0x16')](/}@@/g,'}}}')[_0xab33('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x578302=_0x478478[_0xab33('0x1c')]&&Object[_0xab33('0x1d')](_0x478478[_0xab33('0x1c')])[_0xab33('0x1e')]?'\x0a\x09'+JSON[_0xab33('0x1f')](_0x478478[_0xab33('0x1c')]):'';return util[_0xab33('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xab33('0x13')](_0xab33('0x1a')),_0x478478[_0xab33('0x20')][_0xab33('0x1b')](),_0x49b5cb,_0x478478[_0xab33('0x15')],_0x578302);}function consoleLogger(){var _0x571fa9=new winston[(_0xab33('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab33('0x22'))][(_0xab33('0x23'))]({'level':_0xab33('0x24'),'json':![],'formatter':function(_0x4f095d){return formatter('',_0x4f095d);}})]});return _0x571fa9;}function fileLogger(_0x4b5b41,_0x5df7f3){var _0x11dea8=new winston[(_0xab33('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab33('0x22'))]['File']({'name':util[_0xab33('0x13')](_0xab33('0x25'),_0x4b5b41,_0xab33('0x26')),'filename':getLogFileName(_0x5df7f3,_0x4b5b41,_0xab33('0x26')),'level':_0xab33('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38506f){return fileFormat(_0x4b5b41,_0x38506f);}}),new winston[(_0xab33('0x22'))][(_0xab33('0x27'))]({'name':util['format'](_0xab33('0x25'),_0x4b5b41,debugLevel),'filename':getLogFileName(_0x5df7f3,_0x4b5b41,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4eb691){return fileFormat(_0x4b5b41,_0x4eb691);}}),new winston[(_0xab33('0x22'))]['Console']({'level':_0xab33('0x24'),'json':![],'formatter':function(_0x44ec8c){return fileFormat(_0x4b5b41,_0x44ec8c);}})]});return _0x11dea8;}exports['consoleLogger']=consoleLogger;exports[_0xab33('0x28')]=fileLogger; \ No newline at end of file +var _0x4cb7=['toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','warn','transports','File','%s-%s','error','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x4cb7,0x1c8));var _0x74cb=function(_0x5af6b7,_0xb86b){_0x5af6b7=_0x5af6b7-0x0;var _0x1037bd=_0x4cb7[_0x5af6b7];return _0x1037bd;};'use strict';var path=require(_0x74cb('0x0'));var util=require(_0x74cb('0x1'));var moment=require(_0x74cb('0x2'));var winston=require(_0x74cb('0x3'));var config=require(_0x74cb('0x4'));var debugLevel=config[_0x74cb('0x5')]?config['debugLevel'][_0x74cb('0x6')]():_0x74cb('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x74cb('0x8'),'error':_0x74cb('0x9'),'warn':_0x74cb('0xa'),'info':_0x74cb('0xb'),'print':_0x74cb('0xc'),'success':_0x74cb('0xd'),'http':_0x74cb('0xe'),'verbose':_0x74cb('0xf'),'debug':_0x74cb('0x10'),'silly':_0x74cb('0x11')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x3f6edd,_0x51564f,_0xc15cf6){var _0x34c73c=_0x3f6edd||_0x74cb('0x12');return path[_0x74cb('0x13')](_0x34c73c,util[_0x74cb('0x14')]('%s-%s.log',_0x51564f,_0xc15cf6));}function formatter(_0x4c835d,_0x4fe05d){_0x4fe05d[_0x74cb('0x15')]=_0x4fe05d[_0x74cb('0x15')][_0x74cb('0x16')](/@@{/g,'{{{')[_0x74cb('0x16')](/}@@/g,_0x74cb('0x17'))[_0x74cb('0x16')](/@{/g,'{{')[_0x74cb('0x16')](/}@/g,'}}');return util['format'](_0x74cb('0x18'),moment()[_0x74cb('0x14')](_0x74cb('0x19')),_0x4fe05d['level'][_0x74cb('0x1a')](),_0x4c835d,_0x4fe05d[_0x74cb('0x15')]);}function fileFormat(_0x16760c,_0x2cfc42){_0x2cfc42[_0x74cb('0x15')]=_0x2cfc42['message'][_0x74cb('0x16')](/@@{/g,'{{{')[_0x74cb('0x16')](/}@@/g,_0x74cb('0x17'))['replace'](/@{/g,'{{')[_0x74cb('0x16')](/}@/g,'}}');var _0x2d82bf=_0x2cfc42[_0x74cb('0x1b')]&&Object[_0x74cb('0x1c')](_0x2cfc42[_0x74cb('0x1b')])[_0x74cb('0x1d')]?'\x0a\x09'+JSON[_0x74cb('0x1e')](_0x2cfc42[_0x74cb('0x1b')]):'';return util[_0x74cb('0x14')](_0x74cb('0x1f'),moment()[_0x74cb('0x14')](_0x74cb('0x19')),_0x2cfc42[_0x74cb('0x20')]['toUpperCase'](),_0x16760c,_0x2cfc42[_0x74cb('0x15')],_0x2d82bf);}function consoleLogger(){var _0x431576=new winston[(_0x74cb('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x74cb('0x22'),'json':![],'formatter':function(_0x51089a){return formatter('',_0x51089a);}})]});return _0x431576;}function fileLogger(_0x59c3c7,_0x911354){var _0x388ae5=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x74cb('0x23'))][(_0x74cb('0x24'))]({'name':util[_0x74cb('0x14')](_0x74cb('0x25'),_0x59c3c7,_0x74cb('0x26')),'filename':getLogFileName(_0x911354,_0x59c3c7,_0x74cb('0x26')),'level':_0x74cb('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1db65c){return fileFormat(_0x59c3c7,_0x1db65c);}}),new winston[(_0x74cb('0x23'))][(_0x74cb('0x24'))]({'name':util[_0x74cb('0x14')](_0x74cb('0x25'),_0x59c3c7,debugLevel),'filename':getLogFileName(_0x911354,_0x59c3c7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54f8aa){return fileFormat(_0x59c3c7,_0x54f8aa);}}),new winston['transports'][(_0x74cb('0x27'))]({'level':'warn','json':![],'formatter':function(_0x46572f){return fileFormat(_0x59c3c7,_0x46572f);}})]});return _0x388ae5;}exports[_0x74cb('0x28')]=consoleLogger;exports[_0x74cb('0x29')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 2a0fe9d..c2d20b7 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x57ca,0x108));var _0xa57c=function(_0x1269f8,_0xf0b86b){_0x1269f8=_0x1269f8-0x0;var _0x441e03=_0x57ca[_0x1269f8];return _0x441e03;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x48ceba,_0xa099af){var _0x374533=function(_0x273f92){while(--_0x273f92){_0x48ceba['push'](_0x48ceba['shift']());}};_0x374533(++_0xa099af);}(_0x66fa,0x117));var _0xa66f=function(_0x4c29f9,_0x2e70f7){_0x4c29f9=_0x4c29f9-0x0;var _0x39429d=_0x66fa[_0x4c29f9];return _0x39429d;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 12a55c3..cb03859 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x538a7e,_0x2d2733){var _0x3ac90f=function(_0x3ab40a){while(--_0x3ab40a){_0x538a7e['push'](_0x538a7e['shift']());}};_0x3ac90f(++_0x2d2733);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ff332,_0x145564){_0x3ff332=_0x3ff332-0x0;var _0x5a2264=_0xb10b[_0x3ff332];return _0x5a2264;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file +var _0xbaf0=['exports','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce'];(function(_0x441c1d,_0x1ec65b){var _0x5a0078=function(_0x4807eb){while(--_0x4807eb){_0x441c1d['push'](_0x441c1d['shift']());}};_0x5a0078(++_0x1ec65b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x286ac2){return _0x286ac2==='{{'?_0x0baf('0x0'):_0x0baf('0x1');}function safeTemplate(_0x263f79){var _0x1688bc=_0x263f79;if(typeof _0x263f79===_0x0baf('0x2')){_0x1688bc=_0x263f79['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x0baf('0x3')](_0x263f79)){_0x1688bc=_0x263f79[_0x0baf('0x4')](function(_0x2d3fa5){return safeTemplate(_0x2d3fa5);});}else if(_[_0x0baf('0x5')](_0x263f79)){_0x1688bc=Object[_0x0baf('0x6')](_0x263f79)[_0x0baf('0x7')](function(_0x1a10b1,_0x2dcaac){_0x1a10b1[_0x2dcaac]=safeTemplate(_0x263f79[_0x2dcaac]);return _0x1a10b1;},{});}return _0x1688bc;}module[_0x0baf('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b9af092..d7ccafc 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23f9=['root','resolve','server/app.json','legacy-libs','isArray','apps','motion2','env','NODE_PATH','string','pathExists','then','updated','info','writeJSON','exports','fs-extra'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x23f9,0x1ec));var _0x923f=function(_0x5d7f3e,_0x50fa6a){_0x5d7f3e=_0x5d7f3e-0x0;var _0x1d4fae=_0x23f9[_0x5d7f3e];return _0x1d4fae;};var fs=require(_0x923f('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x923f('0x1')];var APP_JSON_PATH=path[_0x923f('0x2')](root,_0x923f('0x3'));var NODEPATH=path[_0x923f('0x2')](root,_0x923f('0x4'));function setLegacyLibsNodeEnvPath(_0x25d45d){let _0x210e1b=![];if(Array[_0x923f('0x5')](_0x25d45d[_0x923f('0x6')])){var _0x3951d4=_0x25d45d['apps']['findIndex'](function(_0x33d4fa){return _0x33d4fa['name']===_0x923f('0x7');});if(_0x3951d4>-0x1){var _0x231f78=_0x25d45d[_0x923f('0x6')][_0x3951d4];if(typeof _0x231f78[_0x923f('0x8')][_0x923f('0x9')]!==_0x923f('0xa')){_0x231f78[_0x923f('0x8')][_0x923f('0x9')]=NODEPATH;_0x210e1b=!![];}}return{'appConfig':_0x25d45d,'updated':_0x210e1b};}}function updateAppConfig(_0x1b1917){return fs[_0x923f('0xb')](APP_JSON_PATH)[_0x923f('0xc')](function(_0xdc5a52){if(_0xdc5a52){return fs['readJSON'](APP_JSON_PATH)[_0x923f('0xc')](function(_0x22da1a){var _0x54a604=setLegacyLibsNodeEnvPath(_0x22da1a);if(_0x54a604[_0x923f('0xd')]){_0x1b1917[_0x923f('0xe')]('Updating\x20app.json');return fs[_0x923f('0xf')](APP_JSON_PATH,_0x22da1a,{'spaces':0x2});}else{return Promise[_0x923f('0x2')]();}});}else{return Promise['resolve']();}});}module[_0x923f('0x10')]=updateAppConfig; \ No newline at end of file +var _0xbfee=['server/app.json','legacy-libs','isArray','findIndex','apps','env','NODE_PATH','string','pathExists','then','readJSON','updated','writeJSON','exports','fs-extra','path','../config/environment','root','resolve'];(function(_0x1941aa,_0x4a0b42){var _0x5626eb=function(_0x3ab026){while(--_0x3ab026){_0x1941aa['push'](_0x1941aa['shift']());}};_0x5626eb(++_0x4a0b42);}(_0xbfee,0x80));var _0xebfe=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbfee[_0x11005e];return _0x29338f;};var fs=require(_0xebfe('0x0'));var path=require(_0xebfe('0x1'));var config=require(_0xebfe('0x2'));var root=config[_0xebfe('0x3')];var APP_JSON_PATH=path[_0xebfe('0x4')](root,_0xebfe('0x5'));var NODEPATH=path[_0xebfe('0x4')](root,_0xebfe('0x6'));function setLegacyLibsNodeEnvPath(_0x1e519c){let _0x30a4d5=![];if(Array[_0xebfe('0x7')](_0x1e519c['apps'])){var _0x222ed0=_0x1e519c['apps'][_0xebfe('0x8')](function(_0x954952){return _0x954952['name']==='motion2';});if(_0x222ed0>-0x1){var _0xbbba74=_0x1e519c[_0xebfe('0x9')][_0x222ed0];if(typeof _0xbbba74[_0xebfe('0xa')][_0xebfe('0xb')]!==_0xebfe('0xc')){_0xbbba74[_0xebfe('0xa')]['NODE_PATH']=NODEPATH;_0x30a4d5=!![];}}return{'appConfig':_0x1e519c,'updated':_0x30a4d5};}}function updateAppConfig(_0x1a8675){return fs[_0xebfe('0xd')](APP_JSON_PATH)[_0xebfe('0xe')](function(_0x569d10){if(_0x569d10){return fs[_0xebfe('0xf')](APP_JSON_PATH)[_0xebfe('0xe')](function(_0x5a3efc){var _0x2773ca=setLegacyLibsNodeEnvPath(_0x5a3efc);if(_0x2773ca[_0xebfe('0x10')]){_0x1a8675['info']('Updating\x20app.json');return fs[_0xebfe('0x11')](APP_JSON_PATH,_0x5a3efc,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xebfe('0x4')]();}});}module[_0xebfe('0x12')]=updateAppConfig; \ No newline at end of file